Built motion from commit 7779d534.|2.6.11
authorsupport <support@xcally.com>
Thu, 23 Jun 2022 16:53:13 +0000 (16:53 +0000)
committersupport <support@xcally.com>
Thu, 23 Jun 2022 16:53:13 +0000 (16:53 +0000)
2441 files changed:
apidoc/api_project.js
apidoc/api_project.json
legacy-libs/grpc/README.md
legacy-libs/grpc/binding.gyp
legacy-libs/grpc/deps/grpc/include/grpc/grpc.h
legacy-libs/grpc/deps/grpc/include/grpc/grpc_security.h
legacy-libs/grpc/deps/grpc/include/grpc/impl/codegen/grpc_types.h
legacy-libs/grpc/deps/grpc/include/grpc/impl/codegen/port_platform.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backend_metric.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backend_metric.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backup_poller.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/channel_connectivity.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/client_channel.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/client_channel_channelz.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/client_channel_channelz.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/client_channel_factory.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/connector.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health_check_client.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/http_proxy.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy_registry.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/parse_address.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver_factory.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver_registry.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver_registry.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolving_lb_policy.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolving_lb_policy.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/retry_throttle.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/server_address.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/server_address.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/subchannel.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/subchannel.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/subchannel_interface.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_idle/client_idle_filter.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/filters/http/client/http_client_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/http/client_authority_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/http/message_compress/message_compress_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/http/server/http_server_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/load_reporting/registered_opencensus_objects.h
legacy-libs/grpc/deps/grpc/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/filters/max_age/max_age_filter.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/server/chttp2_server.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.h
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/context_list.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/frame_data.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/frame_goaway.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/hpack_parser.h
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/hpack_table.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/hpack_table.h
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/internal.h
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/parsing.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/chttp2/transport/stream_map.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/client/secure/cronet_channel_create.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/transport/cronet_transport.cc
legacy-libs/grpc/deps/grpc/src/core/ext/transport/inproc/inproc_transport.cc
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/type/percent.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/type/range.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/gogoproto/gogo.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/api/annotations.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/api/http.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/any.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/duration.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/empty.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/struct.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/google/rpc/status.upb.h
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/validate/validate.upb.h
legacy-libs/grpc/deps/grpc/src/core/lib/channel/channel_args.cc
legacy-libs/grpc/deps/grpc/src/core/lib/channel/channel_args.h
legacy-libs/grpc/deps/grpc/src/core/lib/channel/channel_stack.h
legacy-libs/grpc/deps/grpc/src/core/lib/channel/channelz.cc
legacy-libs/grpc/deps/grpc/src/core/lib/channel/channelz.h
legacy-libs/grpc/deps/grpc/src/core/lib/compression/compression.cc
legacy-libs/grpc/deps/grpc/src/core/lib/compression/compression_args.cc
legacy-libs/grpc/deps/grpc/src/core/lib/compression/compression_args.h
legacy-libs/grpc/deps/grpc/src/core/lib/compression/compression_internal.cc
legacy-libs/grpc/deps/grpc/src/core/lib/compression/compression_internal.h
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/env_linux.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/env_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/host_port.cc [deleted file]
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/host_port.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/log_linux.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/log_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/string.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/string.h
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/sync_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/time_precise.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gpr/time_precise.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/abstract.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/atomic.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/debug_location.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/fork.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/fork.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/host_port.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/host_port.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/inlined_vector.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/map.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/memory.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/ref_counted.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/ref_counted_ptr.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/string_view.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/thd.h
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/thd_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/thd_windows.cc
legacy-libs/grpc/deps/grpc/src/core/lib/http/httpcli_security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/cfstream_handle.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/cfstream_handle.h
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/combiner.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/error.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/error.h
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/ev_epollex_linux.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/ev_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/exec_ctx.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/exec_ctx.h
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/threadpool.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/threadpool.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/fork_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/iocp_windows.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/iomgr_posix_cfstream.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/iomgr_uv.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/lockfree_event.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/resolve_address_custom.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/resolve_address_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/resolve_address_windows.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/sockaddr_utils.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/socket_windows.h
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_client_cfstream.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_client_custom.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_custom.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_posix.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_server_custom.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_server_windows.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/tcp_windows.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/timer_custom.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/timer_manager.cc
legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/timer_manager.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/credentials.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/credentials.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/jwt/json_token.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/jwt/json_token.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/oauth2/oauth2_credentials.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/credentials/tls/spiffe_credentials.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/alts/alts_security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/fake/fake_security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/local/local_security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/security_connector.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.cc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/tls/spiffe_security_connector.h
legacy-libs/grpc/deps/grpc/src/core/lib/security/transport/client_auth_filter.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/util/json_util.cc
legacy-libs/grpc/deps/grpc/src/core/lib/security/util/json_util.h
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice.cc
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice_buffer.cc
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice_hash_table.h
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice_intern.cc
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice_internal.h
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice_utils.h
legacy-libs/grpc/deps/grpc/src/core/lib/slice/slice_weak_hash_table.h
legacy-libs/grpc/deps/grpc/src/core/lib/surface/call.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/channel.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/completion_queue.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/init.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/init_secure.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/lame_client.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/server.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/server.h
legacy-libs/grpc/deps/grpc/src/core/lib/surface/validate_metadata.cc
legacy-libs/grpc/deps/grpc/src/core/lib/surface/version.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/byte_stream.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/byte_stream.h
legacy-libs/grpc/deps/grpc/src/core/lib/transport/error_utils.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/metadata.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/metadata.h
legacy-libs/grpc/deps/grpc/src/core/lib/transport/metadata_batch.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/metadata_batch.h
legacy-libs/grpc/deps/grpc/src/core/lib/transport/static_metadata.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/static_metadata.h
legacy-libs/grpc/deps/grpc/src/core/lib/transport/timeout_encoding.cc
legacy-libs/grpc/deps/grpc/src/core/lib/transport/timeout_encoding.h
legacy-libs/grpc/deps/grpc/src/core/lib/transport/transport.h
legacy-libs/grpc/deps/grpc/src/core/plugin_registry/grpc_cronet_plugin_registry.cc [deleted file]
legacy-libs/grpc/deps/grpc/src/core/plugin_registry/grpc_plugin_registry.cc
legacy-libs/grpc/deps/grpc/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_client.cc
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_tsi_utils.cc
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_tsi_utils.h
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.c [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.h [deleted file]
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common_api.cc
legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common_api.h
legacy-libs/grpc/deps/grpc/src/core/tsi/ssl/session_cache/ssl_session_cache.h
legacy-libs/grpc/deps/grpc/src/core/tsi/ssl_transport_security.cc
legacy-libs/grpc/deps/grpc/src/core/tsi/ssl_transport_security.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/LICENSE
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/README.md
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/algorithm/algorithm.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/algorithm/container.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/attributes.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/call_once.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/casts.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/config.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/const_init.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/dynamic_annotations.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/atomic_hook.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/bits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/cycleclock.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/direct_mmap.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/endian.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/exception_safety_testing.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/exception_testing.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/hide_ptr.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/identity.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/inline_variable.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/inline_variable_testing.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/invoke.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/log_severity.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_extension.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_extension_c.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook_c.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook_invoke.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/per_thread_tls.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/pretty_function.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/raw_logging.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/scheduling_mode.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/scoped_set_env.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/sysinfo.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/thread_annotations.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/thread_identity.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/throw_delegate.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/unaligned_access.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/log_severity.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/macros.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/optimization.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/policy_checks.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/port.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/thread_annotations.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/fixed_array.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/flat_hash_map.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/flat_hash_set.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/inlined_vector.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/common.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/container_memory.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/counting_allocator.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_generator_testing.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_policy_testing.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtable_debug.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/have_sse.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/inlined_vector.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/layout.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/node_hash_policy.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/test_instance_tracker.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/tracked.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_members_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_members_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/node_hash_map.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/node_hash_set.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/failure_signal_handler.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/demangle.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/examine_stack.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stack_consumption.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/symbolize.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/leak_check.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/stacktrace.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/config.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/declare.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/flag.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/flag.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/parse.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/path_util.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/program_name.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/registry.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/type_erased.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/usage.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/marshalling.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/parse.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/usage.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/usage_config.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/hash.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/hash_testing.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/city.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/hash.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/memory/memory.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/meta/type_traits.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/bernoulli_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/beta_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/discrete_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/distribution_format_traits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/distributions.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/exponential_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/gaussian_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/chi_square.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_caller.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_impl.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_test_util.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distributions.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/explicit_seed_seq.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/fastmath.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/nanobenchmark.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/pcg_engine.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/platform.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/pool_urbg.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen-keys.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_detect.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_engine.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_slow.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_traits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/seed_material.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/sequence_urbg.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/traits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/uniform_helper.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/poisson_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/random.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/seed_gen_exception.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/seed_sequences.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/uniform_int_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/uniform_real_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/zipf_distribution.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/ascii.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/ascii_ctype.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/charconv.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/escaping.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/char_map.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/charconv_parse.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/escaping_test_common.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/memutil.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/numbers_test_common.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/ostringstream.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/pow10_helper.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/output.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/utf8.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/match.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/numbers.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_cat.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_format.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_join.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_replace.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_split.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/string_view.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/strip.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/substitute.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/barrier.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/blocking_counter.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/thread_pool.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/waiter.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/mutex.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/notification.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/civil_time.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/clock.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/testdata/README.zoneinfo [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/test_util.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/zoneinfo.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/time.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/any.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/bad_any_cast.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/bad_optional_access.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/bad_variant_access.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/compare.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/optional.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/span.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/variant.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/optional.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/span.h
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/variant.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/utility/utility.h
legacy-libs/grpc/deps/grpc/third_party/nanopb/CHANGELOG.txt [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/LICENSE.txt [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/README.md [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_common.c [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_common.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_decode.c [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_decode.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_encode.c [deleted file]
legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_encode.h [deleted file]
legacy-libs/grpc/deps/grpc/third_party/upb/LICENSE [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/README.md [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/examples/bazel/test_binary.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/upb/json/parser.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/tests/conformance_upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/tests/corpus/README [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/tests/pb/test_varint.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/tests/test_util.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/tests/upb_test.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/third_party/lunit/LICENSE [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/third_party/lunit/README.google [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/README [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/def.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/msg.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb/pb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/stdc++/string.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/decode.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/decode.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/def.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/def.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/encode.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/encode.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/generated_util.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers-inl.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/parser.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/printer.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/printer.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/legacy_msg_reflection.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/legacy_msg_reflection.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/msg.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/msg.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/msgfactory.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/msgfactory.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/compile_decoder.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.int.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/encoder.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/encoder.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/textprinter.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/textprinter.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/varint.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/varint.int.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/port.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/port_def.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/port_undef.inc [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/table.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/table.int.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/upb.c [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upb/upb.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upbc/generator.h [new file with mode: 0644]
legacy-libs/grpc/deps/grpc/third_party/upb/upbc/message_layout.h [new file with mode: 0644]
legacy-libs/grpc/ext/call.cc
legacy-libs/grpc/ext/channel.cc
legacy-libs/grpc/ext/slice.cc
legacy-libs/grpc/ext/slice.h
legacy-libs/grpc/index.d.ts
legacy-libs/grpc/index.js
legacy-libs/grpc/node_modules/abbrev/LICENSE [deleted file]
legacy-libs/grpc/node_modules/abbrev/README.md [deleted file]
legacy-libs/grpc/node_modules/abbrev/abbrev.js [deleted file]
legacy-libs/grpc/node_modules/abbrev/package.json [deleted file]
legacy-libs/grpc/node_modules/ansi-regex/index.js [deleted file]
legacy-libs/grpc/node_modules/ansi-regex/package.json [deleted file]
legacy-libs/grpc/node_modules/ansi-regex/readme.md [deleted file]
legacy-libs/grpc/node_modules/aproba/LICENSE [deleted file]
legacy-libs/grpc/node_modules/aproba/README.md [deleted file]
legacy-libs/grpc/node_modules/aproba/index.js [deleted file]
legacy-libs/grpc/node_modules/aproba/package.json [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/CHANGES.md [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/LICENSE [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/README.md [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/index.js [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/package.json [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/tracker-base.js [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/tracker-group.js [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/tracker-stream.js [deleted file]
legacy-libs/grpc/node_modules/are-we-there-yet/tracker.js [deleted file]
legacy-libs/grpc/node_modules/balanced-match/LICENSE.md [deleted file]
legacy-libs/grpc/node_modules/balanced-match/README.md [deleted file]
legacy-libs/grpc/node_modules/balanced-match/index.js [deleted file]
legacy-libs/grpc/node_modules/balanced-match/package.json [deleted file]
legacy-libs/grpc/node_modules/brace-expansion/LICENSE [deleted file]
legacy-libs/grpc/node_modules/brace-expansion/README.md [deleted file]
legacy-libs/grpc/node_modules/brace-expansion/index.js [deleted file]
legacy-libs/grpc/node_modules/brace-expansion/package.json [deleted file]
legacy-libs/grpc/node_modules/camelcase/index.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/camelcase/license [moved from legacy-libs/grpc/node_modules/ansi-regex/license with 100% similarity]
legacy-libs/grpc/node_modules/camelcase/package.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/camelcase/readme.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/chownr/LICENSE [deleted file]
legacy-libs/grpc/node_modules/chownr/README.md [deleted file]
legacy-libs/grpc/node_modules/chownr/chownr.js [deleted file]
legacy-libs/grpc/node_modules/chownr/package.json [deleted file]
legacy-libs/grpc/node_modules/cliui/CHANGELOG.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/cliui/LICENSE.txt [new file with mode: 0644]
legacy-libs/grpc/node_modules/cliui/README.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/cliui/index.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/cliui/package.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/code-point-at/index.js [deleted file]
legacy-libs/grpc/node_modules/code-point-at/license [deleted file]
legacy-libs/grpc/node_modules/code-point-at/package.json [deleted file]
legacy-libs/grpc/node_modules/code-point-at/readme.md [deleted file]
legacy-libs/grpc/node_modules/concat-map/LICENSE [deleted file]
legacy-libs/grpc/node_modules/concat-map/README.markdown [deleted file]
legacy-libs/grpc/node_modules/concat-map/example/map.js [deleted file]
legacy-libs/grpc/node_modules/concat-map/index.js [deleted file]
legacy-libs/grpc/node_modules/concat-map/package.json [deleted file]
legacy-libs/grpc/node_modules/concat-map/test/map.js [deleted file]
legacy-libs/grpc/node_modules/console-control-strings/LICENSE [deleted file]
legacy-libs/grpc/node_modules/console-control-strings/README.md [deleted file]
legacy-libs/grpc/node_modules/console-control-strings/README.md~ [deleted file]
legacy-libs/grpc/node_modules/console-control-strings/index.js [deleted file]
legacy-libs/grpc/node_modules/console-control-strings/package.json [deleted file]
legacy-libs/grpc/node_modules/core-util-is/LICENSE [deleted file]
legacy-libs/grpc/node_modules/core-util-is/README.md [deleted file]
legacy-libs/grpc/node_modules/core-util-is/float.patch [deleted file]
legacy-libs/grpc/node_modules/core-util-is/lib/util.js [deleted file]
legacy-libs/grpc/node_modules/core-util-is/package.json [deleted file]
legacy-libs/grpc/node_modules/core-util-is/test.js [deleted file]
legacy-libs/grpc/node_modules/deep-extend/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/deep-extend/LICENSE [deleted file]
legacy-libs/grpc/node_modules/deep-extend/README.md [deleted file]
legacy-libs/grpc/node_modules/deep-extend/index.js [deleted file]
legacy-libs/grpc/node_modules/deep-extend/lib/deep-extend.js [deleted file]
legacy-libs/grpc/node_modules/deep-extend/package.json [deleted file]
legacy-libs/grpc/node_modules/delegates/History.md [deleted file]
legacy-libs/grpc/node_modules/delegates/License [deleted file]
legacy-libs/grpc/node_modules/delegates/Makefile [deleted file]
legacy-libs/grpc/node_modules/delegates/Readme.md [deleted file]
legacy-libs/grpc/node_modules/delegates/index.js [deleted file]
legacy-libs/grpc/node_modules/delegates/package.json [deleted file]
legacy-libs/grpc/node_modules/delegates/test/index.js [deleted file]
legacy-libs/grpc/node_modules/detect-libc/LICENSE [deleted file]
legacy-libs/grpc/node_modules/detect-libc/README.md [deleted file]
legacy-libs/grpc/node_modules/detect-libc/bin/detect-libc.js [deleted file]
legacy-libs/grpc/node_modules/detect-libc/lib/detect-libc.js [deleted file]
legacy-libs/grpc/node_modules/detect-libc/package.json [deleted file]
legacy-libs/grpc/node_modules/fs-minipass/LICENSE [deleted file]
legacy-libs/grpc/node_modules/fs-minipass/README.md [deleted file]
legacy-libs/grpc/node_modules/fs-minipass/index.js [deleted file]
legacy-libs/grpc/node_modules/fs-minipass/package.json [deleted file]
legacy-libs/grpc/node_modules/fs.realpath/LICENSE [deleted file]
legacy-libs/grpc/node_modules/fs.realpath/README.md [deleted file]
legacy-libs/grpc/node_modules/fs.realpath/index.js [deleted file]
legacy-libs/grpc/node_modules/fs.realpath/old.js [deleted file]
legacy-libs/grpc/node_modules/fs.realpath/package.json [deleted file]
legacy-libs/grpc/node_modules/gauge/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/gauge/LICENSE [deleted file]
legacy-libs/grpc/node_modules/gauge/README.md [deleted file]
legacy-libs/grpc/node_modules/gauge/base-theme.js [deleted file]
legacy-libs/grpc/node_modules/gauge/error.js [deleted file]
legacy-libs/grpc/node_modules/gauge/has-color.js [deleted file]
legacy-libs/grpc/node_modules/gauge/index.js [deleted file]
legacy-libs/grpc/node_modules/gauge/package.json [deleted file]
legacy-libs/grpc/node_modules/gauge/plumbing.js [deleted file]
legacy-libs/grpc/node_modules/gauge/process.js [deleted file]
legacy-libs/grpc/node_modules/gauge/progress-bar.js [deleted file]
legacy-libs/grpc/node_modules/gauge/render-template.js [deleted file]
legacy-libs/grpc/node_modules/gauge/set-immediate.js [deleted file]
legacy-libs/grpc/node_modules/gauge/set-interval.js [deleted file]
legacy-libs/grpc/node_modules/gauge/spin.js [deleted file]
legacy-libs/grpc/node_modules/gauge/template-item.js [deleted file]
legacy-libs/grpc/node_modules/gauge/theme-set.js [deleted file]
legacy-libs/grpc/node_modules/gauge/themes.js [deleted file]
legacy-libs/grpc/node_modules/gauge/wide-truncate.js [deleted file]
legacy-libs/grpc/node_modules/has-unicode/LICENSE [deleted file]
legacy-libs/grpc/node_modules/has-unicode/README.md [deleted file]
legacy-libs/grpc/node_modules/has-unicode/index.js [deleted file]
legacy-libs/grpc/node_modules/has-unicode/package.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/Changelog.md [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/LICENSE [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/README.md [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-codec.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-data.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/index.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/internal.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-codec.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data-generated.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/big5-added.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp936.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp949.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp950.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/eucjp.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gbk-added.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/shiftjis.json [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/utf16.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/encodings/utf7.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/lib/bom-handling.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/lib/extend-node.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/lib/index.d.ts [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/lib/index.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/lib/streams.js [deleted file]
legacy-libs/grpc/node_modules/iconv-lite/package.json [deleted file]
legacy-libs/grpc/node_modules/ignore-walk/LICENSE [deleted file]
legacy-libs/grpc/node_modules/ignore-walk/README.md [deleted file]
legacy-libs/grpc/node_modules/ignore-walk/index.js [deleted file]
legacy-libs/grpc/node_modules/ignore-walk/package.json [deleted file]
legacy-libs/grpc/node_modules/inflight/LICENSE [deleted file]
legacy-libs/grpc/node_modules/inflight/README.md [deleted file]
legacy-libs/grpc/node_modules/inflight/inflight.js [deleted file]
legacy-libs/grpc/node_modules/inflight/package.json [deleted file]
legacy-libs/grpc/node_modules/inherits/LICENSE [deleted file]
legacy-libs/grpc/node_modules/inherits/README.md [deleted file]
legacy-libs/grpc/node_modules/inherits/inherits.js [deleted file]
legacy-libs/grpc/node_modules/inherits/inherits_browser.js [deleted file]
legacy-libs/grpc/node_modules/inherits/package.json [deleted file]
legacy-libs/grpc/node_modules/ini/LICENSE [deleted file]
legacy-libs/grpc/node_modules/ini/README.md [deleted file]
legacy-libs/grpc/node_modules/ini/ini.js [deleted file]
legacy-libs/grpc/node_modules/ini/package.json [deleted file]
legacy-libs/grpc/node_modules/is-fullwidth-code-point/index.js [deleted file]
legacy-libs/grpc/node_modules/is-fullwidth-code-point/license [deleted file]
legacy-libs/grpc/node_modules/is-fullwidth-code-point/package.json [deleted file]
legacy-libs/grpc/node_modules/is-fullwidth-code-point/readme.md [deleted file]
legacy-libs/grpc/node_modules/isarray/Makefile [deleted file]
legacy-libs/grpc/node_modules/isarray/README.md [deleted file]
legacy-libs/grpc/node_modules/isarray/component.json [deleted file]
legacy-libs/grpc/node_modules/isarray/index.js [deleted file]
legacy-libs/grpc/node_modules/isarray/package.json [deleted file]
legacy-libs/grpc/node_modules/isarray/test.js [deleted file]
legacy-libs/grpc/node_modules/minimatch/LICENSE [deleted file]
legacy-libs/grpc/node_modules/minimatch/README.md [deleted file]
legacy-libs/grpc/node_modules/minimatch/minimatch.js [deleted file]
legacy-libs/grpc/node_modules/minimatch/package.json [deleted file]
legacy-libs/grpc/node_modules/minimist/LICENSE [deleted file]
legacy-libs/grpc/node_modules/minimist/example/parse.js [deleted file]
legacy-libs/grpc/node_modules/minimist/index.js [deleted file]
legacy-libs/grpc/node_modules/minimist/package.json [deleted file]
legacy-libs/grpc/node_modules/minimist/readme.markdown [deleted file]
legacy-libs/grpc/node_modules/minimist/test/all_bool.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/bool.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/dash.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/default_bool.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/dotted.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/kv_short.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/long.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/num.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/parse.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/parse_modified.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/short.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/stop_early.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/unknown.js [deleted file]
legacy-libs/grpc/node_modules/minimist/test/whitespace.js [deleted file]
legacy-libs/grpc/node_modules/minipass/LICENSE [deleted file]
legacy-libs/grpc/node_modules/minipass/README.md [deleted file]
legacy-libs/grpc/node_modules/minipass/index.js [deleted file]
legacy-libs/grpc/node_modules/minipass/package.json [deleted file]
legacy-libs/grpc/node_modules/minizlib/LICENSE [deleted file]
legacy-libs/grpc/node_modules/minizlib/README.md [deleted file]
legacy-libs/grpc/node_modules/minizlib/constants.js [deleted file]
legacy-libs/grpc/node_modules/minizlib/index.js [deleted file]
legacy-libs/grpc/node_modules/minizlib/package.json [deleted file]
legacy-libs/grpc/node_modules/mkdirp/bin/cmd.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/bin/usage.txt [deleted file]
legacy-libs/grpc/node_modules/mkdirp/examples/pow.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/index.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/LICENSE [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/example/parse.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/index.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/package.json [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/readme.markdown [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dash.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/default_bool.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dotted.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/long.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/short.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/whitespace.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/package.json [deleted file]
legacy-libs/grpc/node_modules/mkdirp/readme.markdown [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/chmod.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/clobber.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/mkdirp.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/opts_fs.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/opts_fs_sync.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/perm.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/perm_sync.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/race.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/rel.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/return.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/return_sync.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/root.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/sync.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/umask.js [deleted file]
legacy-libs/grpc/node_modules/mkdirp/test/umask_sync.js [deleted file]
legacy-libs/grpc/node_modules/nan/CHANGELOG.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/LICENSE.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/README.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/asyncworker.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/buffers.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/callback.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/converters.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/errors.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/json.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/maybe_types.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/methods.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/new.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/node_misc.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/object_wrappers.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/persistent.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/scopes.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/script.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/string_bytes.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/v8_internals.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/doc/v8_misc.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/include_dirs.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_callbacks.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_callbacks_12_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_callbacks_pre_12_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_converters.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_converters_43_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_converters_pre_43_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_define_own_property_helper.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_implementation_12_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_implementation_pre_12_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_json.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_maybe_43_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_maybe_pre_43_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_new.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_object_wrap.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_persistent_12_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_persistent_pre_12_inl.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_private.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_string_bytes.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_typedarray_contents.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/nan_weak.h [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/package.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/tools/1to2.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/tools/README.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/nan/tools/package.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/needle/README.md [deleted file]
legacy-libs/grpc/node_modules/needle/bin/needle [deleted file]
legacy-libs/grpc/node_modules/needle/examples/deflated-stream.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/digest-auth.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/download-to-file.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/multipart-stream.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/parsed-stream.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/parsed-stream2.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/stream-events.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/stream-to-file.js [deleted file]
legacy-libs/grpc/node_modules/needle/examples/upload-image.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/auth.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/cookies.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/decoder.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/multipart.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/needle.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/parsers.js [deleted file]
legacy-libs/grpc/node_modules/needle/lib/querystring.js [deleted file]
legacy-libs/grpc/node_modules/needle/license.txt [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/LICENSE [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/README.md [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/node.js [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/package.json [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/src/browser.js [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/src/common.js [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/src/index.js [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/debug/src/node.js [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/ms/index.js [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/ms/license.md [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/ms/package.json [deleted file]
legacy-libs/grpc/node_modules/needle/node_modules/ms/readme.md [deleted file]
legacy-libs/grpc/node_modules/needle/package.json [deleted file]
legacy-libs/grpc/node_modules/needle/test/basic_auth_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/compression_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/cookies_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/decoder_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/errors_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/headers_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/helpers.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/long_string_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/output_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/parsing_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/post_data_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/proxy_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/querystring_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/redirect_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/redirect_with_timeout.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/request_stream_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/response_stream_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/socket_pool_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/url_spec.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/utils/formidable.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/utils/proxy.js [deleted file]
legacy-libs/grpc/node_modules/needle/test/utils/test.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/LICENSE [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/README.md [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/appveyor.yml [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/contributing.md [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/build.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/clean.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/configure.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/info.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/install.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/node-pre-gyp.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/package.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/pre-binding.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/publish.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/rebuild.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/reinstall.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/reveal.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/testbinary.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/testpackage.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/unpublish.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/compile.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/napi.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/s3_setup.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/versioning.js [deleted file]
legacy-libs/grpc/node_modules/node-pre-gyp/package.json [deleted file]
legacy-libs/grpc/node_modules/nopt/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/nopt/LICENSE [deleted file]
legacy-libs/grpc/node_modules/nopt/README.md [deleted file]
legacy-libs/grpc/node_modules/nopt/bin/nopt.js [deleted file]
legacy-libs/grpc/node_modules/nopt/examples/my-program.js [deleted file]
legacy-libs/grpc/node_modules/nopt/lib/nopt.js [deleted file]
legacy-libs/grpc/node_modules/nopt/package.json [deleted file]
legacy-libs/grpc/node_modules/nopt/test/basic.js [deleted file]
legacy-libs/grpc/node_modules/npm-bundled/LICENSE [deleted file]
legacy-libs/grpc/node_modules/npm-bundled/README.md [deleted file]
legacy-libs/grpc/node_modules/npm-bundled/index.js [deleted file]
legacy-libs/grpc/node_modules/npm-bundled/package.json [deleted file]
legacy-libs/grpc/node_modules/npm-packlist/LICENSE [deleted file]
legacy-libs/grpc/node_modules/npm-packlist/README.md [deleted file]
legacy-libs/grpc/node_modules/npm-packlist/index.js [deleted file]
legacy-libs/grpc/node_modules/npm-packlist/package.json [deleted file]
legacy-libs/grpc/node_modules/npmlog/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/npmlog/LICENSE [deleted file]
legacy-libs/grpc/node_modules/npmlog/README.md [deleted file]
legacy-libs/grpc/node_modules/npmlog/log.js [deleted file]
legacy-libs/grpc/node_modules/npmlog/package.json [deleted file]
legacy-libs/grpc/node_modules/number-is-nan/index.js [deleted file]
legacy-libs/grpc/node_modules/number-is-nan/license [deleted file]
legacy-libs/grpc/node_modules/number-is-nan/package.json [deleted file]
legacy-libs/grpc/node_modules/number-is-nan/readme.md [deleted file]
legacy-libs/grpc/node_modules/object-assign/index.js [deleted file]
legacy-libs/grpc/node_modules/object-assign/license [deleted file]
legacy-libs/grpc/node_modules/object-assign/package.json [deleted file]
legacy-libs/grpc/node_modules/object-assign/readme.md [deleted file]
legacy-libs/grpc/node_modules/once/LICENSE [deleted file]
legacy-libs/grpc/node_modules/once/README.md [deleted file]
legacy-libs/grpc/node_modules/once/once.js [deleted file]
legacy-libs/grpc/node_modules/once/package.json [deleted file]
legacy-libs/grpc/node_modules/os-homedir/index.js [deleted file]
legacy-libs/grpc/node_modules/os-homedir/license [deleted file]
legacy-libs/grpc/node_modules/os-homedir/package.json [deleted file]
legacy-libs/grpc/node_modules/os-homedir/readme.md [deleted file]
legacy-libs/grpc/node_modules/os-tmpdir/index.js [deleted file]
legacy-libs/grpc/node_modules/os-tmpdir/license [deleted file]
legacy-libs/grpc/node_modules/os-tmpdir/package.json [deleted file]
legacy-libs/grpc/node_modules/os-tmpdir/readme.md [deleted file]
legacy-libs/grpc/node_modules/osenv/LICENSE [deleted file]
legacy-libs/grpc/node_modules/osenv/README.md [deleted file]
legacy-libs/grpc/node_modules/osenv/osenv.js [deleted file]
legacy-libs/grpc/node_modules/osenv/package.json [deleted file]
legacy-libs/grpc/node_modules/path-is-absolute/index.js [deleted file]
legacy-libs/grpc/node_modules/path-is-absolute/license [deleted file]
legacy-libs/grpc/node_modules/path-is-absolute/package.json [deleted file]
legacy-libs/grpc/node_modules/path-is-absolute/readme.md [deleted file]
legacy-libs/grpc/node_modules/process-nextick-args/index.js [deleted file]
legacy-libs/grpc/node_modules/process-nextick-args/license.md [deleted file]
legacy-libs/grpc/node_modules/process-nextick-args/package.json [deleted file]
legacy-libs/grpc/node_modules/process-nextick-args/readme.md [deleted file]
legacy-libs/grpc/node_modules/protobufjs/dist/README.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js.gz [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.map [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js.gz [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.map [new file with mode: 0644]
legacy-libs/grpc/node_modules/protobufjs/package.json
legacy-libs/grpc/node_modules/rc/LICENSE.APACHE2 [deleted file]
legacy-libs/grpc/node_modules/rc/LICENSE.BSD [deleted file]
legacy-libs/grpc/node_modules/rc/LICENSE.MIT [deleted file]
legacy-libs/grpc/node_modules/rc/README.md [deleted file]
legacy-libs/grpc/node_modules/rc/browser.js [deleted file]
legacy-libs/grpc/node_modules/rc/cli.js [deleted file]
legacy-libs/grpc/node_modules/rc/index.js [deleted file]
legacy-libs/grpc/node_modules/rc/lib/utils.js [deleted file]
legacy-libs/grpc/node_modules/rc/package.json [deleted file]
legacy-libs/grpc/node_modules/rc/test/ini.js [deleted file]
legacy-libs/grpc/node_modules/rc/test/nested-env-vars.js [deleted file]
legacy-libs/grpc/node_modules/rc/test/test.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/CONTRIBUTING.md [deleted file]
legacy-libs/grpc/node_modules/readable-stream/GOVERNANCE.md [deleted file]
legacy-libs/grpc/node_modules/readable-stream/LICENSE [deleted file]
legacy-libs/grpc/node_modules/readable-stream/README.md [deleted file]
legacy-libs/grpc/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md [deleted file]
legacy-libs/grpc/node_modules/readable-stream/duplex-browser.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/duplex.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/_stream_duplex.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/_stream_passthrough.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/_stream_readable.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/_stream_transform.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/_stream_writable.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/BufferList.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/destroy.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream-browser.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/package.json [deleted file]
legacy-libs/grpc/node_modules/readable-stream/passthrough.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/readable-browser.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/readable.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/transform.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/writable-browser.js [deleted file]
legacy-libs/grpc/node_modules/readable-stream/writable.js [deleted file]
legacy-libs/grpc/node_modules/rimraf/LICENSE [deleted file]
legacy-libs/grpc/node_modules/rimraf/README.md [deleted file]
legacy-libs/grpc/node_modules/rimraf/bin.js [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/LICENSE [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/README.md [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/changelog.md [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/common.js [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/glob.js [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/package.json [deleted file]
legacy-libs/grpc/node_modules/rimraf/node_modules/glob/sync.js [deleted file]
legacy-libs/grpc/node_modules/rimraf/package.json [deleted file]
legacy-libs/grpc/node_modules/rimraf/rimraf.js [deleted file]
legacy-libs/grpc/node_modules/safe-buffer/LICENSE [deleted file]
legacy-libs/grpc/node_modules/safe-buffer/README.md [deleted file]
legacy-libs/grpc/node_modules/safe-buffer/index.d.ts [deleted file]
legacy-libs/grpc/node_modules/safe-buffer/index.js [deleted file]
legacy-libs/grpc/node_modules/safe-buffer/package.json [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/LICENSE [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/Porting-Buffer.md [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/Readme.md [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/dangerous.js [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/package.json [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/safer.js [deleted file]
legacy-libs/grpc/node_modules/safer-buffer/tests.js [deleted file]
legacy-libs/grpc/node_modules/sax/LICENSE [deleted file]
legacy-libs/grpc/node_modules/sax/README.md [deleted file]
legacy-libs/grpc/node_modules/sax/lib/sax.js [deleted file]
legacy-libs/grpc/node_modules/sax/package.json [deleted file]
legacy-libs/grpc/node_modules/semver/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/semver/LICENSE [deleted file]
legacy-libs/grpc/node_modules/semver/README.md [deleted file]
legacy-libs/grpc/node_modules/semver/bin/semver [deleted file]
legacy-libs/grpc/node_modules/semver/package.json [deleted file]
legacy-libs/grpc/node_modules/semver/range.bnf [deleted file]
legacy-libs/grpc/node_modules/semver/semver.js [deleted file]
legacy-libs/grpc/node_modules/set-blocking/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/set-blocking/LICENSE.txt [deleted file]
legacy-libs/grpc/node_modules/set-blocking/README.md [deleted file]
legacy-libs/grpc/node_modules/set-blocking/index.js [deleted file]
legacy-libs/grpc/node_modules/set-blocking/package.json [deleted file]
legacy-libs/grpc/node_modules/signal-exit/CHANGELOG.md [deleted file]
legacy-libs/grpc/node_modules/signal-exit/LICENSE.txt [deleted file]
legacy-libs/grpc/node_modules/signal-exit/README.md [deleted file]
legacy-libs/grpc/node_modules/signal-exit/index.js [deleted file]
legacy-libs/grpc/node_modules/signal-exit/package.json [deleted file]
legacy-libs/grpc/node_modules/signal-exit/signals.js [deleted file]
legacy-libs/grpc/node_modules/string-width/index.js [deleted file]
legacy-libs/grpc/node_modules/string-width/license [deleted file]
legacy-libs/grpc/node_modules/string-width/package.json [deleted file]
legacy-libs/grpc/node_modules/string-width/readme.md [deleted file]
legacy-libs/grpc/node_modules/string_decoder/LICENSE [deleted file]
legacy-libs/grpc/node_modules/string_decoder/README.md [deleted file]
legacy-libs/grpc/node_modules/string_decoder/lib/string_decoder.js [deleted file]
legacy-libs/grpc/node_modules/string_decoder/package.json [deleted file]
legacy-libs/grpc/node_modules/strip-ansi/index.js [deleted file]
legacy-libs/grpc/node_modules/strip-ansi/license [deleted file]
legacy-libs/grpc/node_modules/strip-ansi/package.json [deleted file]
legacy-libs/grpc/node_modules/strip-ansi/readme.md [deleted file]
legacy-libs/grpc/node_modules/strip-json-comments/index.js [deleted file]
legacy-libs/grpc/node_modules/strip-json-comments/license [deleted file]
legacy-libs/grpc/node_modules/strip-json-comments/package.json [deleted file]
legacy-libs/grpc/node_modules/strip-json-comments/readme.md [deleted file]
legacy-libs/grpc/node_modules/tar/LICENSE [deleted file]
legacy-libs/grpc/node_modules/tar/README.md [deleted file]
legacy-libs/grpc/node_modules/tar/index.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/buffer.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/create.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/extract.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/header.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/high-level-opt.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/large-numbers.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/list.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/mkdir.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/mode-fix.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/pack.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/parse.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/pax.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/read-entry.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/replace.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/types.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/unpack.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/update.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/warn-mixin.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/winchars.js [deleted file]
legacy-libs/grpc/node_modules/tar/lib/write-entry.js [deleted file]
legacy-libs/grpc/node_modules/tar/package.json [deleted file]
legacy-libs/grpc/node_modules/util-deprecate/History.md [deleted file]
legacy-libs/grpc/node_modules/util-deprecate/LICENSE [deleted file]
legacy-libs/grpc/node_modules/util-deprecate/README.md [deleted file]
legacy-libs/grpc/node_modules/util-deprecate/browser.js [deleted file]
legacy-libs/grpc/node_modules/util-deprecate/node.js [deleted file]
legacy-libs/grpc/node_modules/util-deprecate/package.json [deleted file]
legacy-libs/grpc/node_modules/wide-align/LICENSE [deleted file]
legacy-libs/grpc/node_modules/wide-align/README.md [deleted file]
legacy-libs/grpc/node_modules/wide-align/align.js [deleted file]
legacy-libs/grpc/node_modules/wide-align/package.json [deleted file]
legacy-libs/grpc/node_modules/window-size/LICENSE [new file with mode: 0644]
legacy-libs/grpc/node_modules/window-size/README.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/window-size/cli.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/window-size/index.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/window-size/package.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/wrappy/LICENSE [deleted file]
legacy-libs/grpc/node_modules/wrappy/README.md [deleted file]
legacy-libs/grpc/node_modules/wrappy/package.json [deleted file]
legacy-libs/grpc/node_modules/wrappy/wrappy.js [deleted file]
legacy-libs/grpc/node_modules/yallist/LICENSE [deleted file]
legacy-libs/grpc/node_modules/yallist/README.md [deleted file]
legacy-libs/grpc/node_modules/yallist/iterator.js [deleted file]
legacy-libs/grpc/node_modules/yallist/package.json [deleted file]
legacy-libs/grpc/node_modules/yallist/yallist.js [deleted file]
legacy-libs/grpc/node_modules/yargs/CHANGELOG.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/LICENSE [moved from legacy-libs/grpc/node_modules/mkdirp/LICENSE with 100% similarity]
legacy-libs/grpc/node_modules/yargs/README.md [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/completion.sh.hbs [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/index.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/lib/completion.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/lib/parser.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/lib/tokenize-arg-string.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/lib/usage.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/lib/validation.js [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/de.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/en.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/es.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/fr.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/id.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/ja.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/ko.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/nb.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/pirate.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/pl.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/pt.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/pt_BR.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/tr.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/locales/zh.json [new file with mode: 0644]
legacy-libs/grpc/node_modules/yargs/package.json [new file with mode: 0644]
legacy-libs/grpc/package.json
legacy-libs/grpc/src/client.js
legacy-libs/grpc/src/client_interceptors.js
legacy-libs/grpc/src/common.js
legacy-libs/grpc/src/metadata.js
legacy-libs/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node
legacy-libs/grpc/src/server.js
server/api/action/action.attributes.js
server/api/action/action.controller.js
server/api/action/action.model.js
server/api/action/action.rpc.js
server/api/action/index.js
server/api/analyticCustomReport/analyticCustomReport.attributes.js
server/api/analyticCustomReport/analyticCustomReport.controller.js
server/api/analyticCustomReport/analyticCustomReport.model.js
server/api/analyticCustomReport/analyticCustomReport.rpc.js
server/api/analyticCustomReport/index.js
server/api/analyticDefaultReport/analyticDefaultReport.attributes.js
server/api/analyticDefaultReport/analyticDefaultReport.controller.js
server/api/analyticDefaultReport/analyticDefaultReport.model.js
server/api/analyticDefaultReport/analyticDefaultReport.rpc.js
server/api/analyticDefaultReport/index.js
server/api/analyticExtractedReport/analyticExtractedReport.attributes.js
server/api/analyticExtractedReport/analyticExtractedReport.controller.js
server/api/analyticExtractedReport/analyticExtractedReport.model.js
server/api/analyticExtractedReport/analyticExtractedReport.rpc.js
server/api/analyticExtractedReport/index.js
server/api/analyticFieldReport/analyticFieldReport.attributes.js
server/api/analyticFieldReport/analyticFieldReport.controller.js
server/api/analyticFieldReport/analyticFieldReport.model.js
server/api/analyticFieldReport/analyticFieldReport.rpc.js
server/api/analyticFieldReport/index.js
server/api/analyticMetric/analyticMetric.attributes.js
server/api/analyticMetric/analyticMetric.controller.js
server/api/analyticMetric/analyticMetric.model.js
server/api/analyticMetric/analyticMetric.rpc.js
server/api/analyticMetric/index.js
server/api/analyticTreeReport/analyticTreeReport.attributes.js
server/api/analyticTreeReport/analyticTreeReport.controller.js
server/api/analyticTreeReport/analyticTreeReport.model.js
server/api/analyticTreeReport/analyticTreeReport.rpc.js
server/api/analyticTreeReport/index.js
server/api/attachment/attachment.attributes.js
server/api/attachment/attachment.controller.js
server/api/attachment/attachment.model.js
server/api/attachment/attachment.rpc.js
server/api/attachment/index.js
server/api/authActiveDirectory/authActiveDirectory.controller.js
server/api/authActiveDirectory/index.js
server/api/authGoogle/authGoogle.controller.js
server/api/authGoogle/index.js
server/api/authLocal/authLocal.controller.js
server/api/authLocal/index.js
server/api/automation/automation.attributes.js
server/api/automation/automation.controller.js
server/api/automation/automation.model.js
server/api/automation/automation.rpc.js
server/api/automation/index.js
server/api/campaign/campaign.attributes.js
server/api/campaign/campaign.controller.js
server/api/campaign/campaign.model.js
server/api/campaign/campaign.rpc.js
server/api/campaign/index.js
server/api/cannedAnswer/cannedAnswer.attributes.js
server/api/cannedAnswer/cannedAnswer.controller.js
server/api/cannedAnswer/cannedAnswer.model.js
server/api/cannedAnswer/cannedAnswer.rpc.js
server/api/cannedAnswer/index.js
server/api/cdr/cdr.attributes.js
server/api/cdr/cdr.controller.js
server/api/cdr/cdr.model.js
server/api/cdr/cdr.rpc.js
server/api/cdr/index.js
server/api/chatApplication/chatApplication.attributes.js
server/api/chatApplication/chatApplication.controller.js
server/api/chatApplication/chatApplication.model.js
server/api/chatApplication/chatApplication.rpc.js
server/api/chatApplication/index.js
server/api/chatGroup/chatGroup.attributes.js
server/api/chatGroup/chatGroup.controller.js
server/api/chatGroup/chatGroup.events.js
server/api/chatGroup/chatGroup.model.js
server/api/chatGroup/chatGroup.rpc.js
server/api/chatGroup/chatGroup.socket.js
server/api/chatGroup/index.js
server/api/chatInteraction/chatInteraction.attributes.js
server/api/chatInteraction/chatInteraction.controller.js
server/api/chatInteraction/chatInteraction.events.js
server/api/chatInteraction/chatInteraction.model.js
server/api/chatInteraction/chatInteraction.rpc.js
server/api/chatInteraction/chatInteraction.socket.js
server/api/chatInteraction/index.js
server/api/chatInternalMessage/chatInternalMessage.attributes.js
server/api/chatInternalMessage/chatInternalMessage.controller.js
server/api/chatInternalMessage/chatInternalMessage.events.js
server/api/chatInternalMessage/chatInternalMessage.model.js
server/api/chatInternalMessage/chatInternalMessage.rpc.js
server/api/chatInternalMessage/chatInternalMessage.socket.js
server/api/chatInternalMessage/index.js
server/api/chatMessage/chatMessage.attributes.js
server/api/chatMessage/chatMessage.controller.js
server/api/chatMessage/chatMessage.events.js
server/api/chatMessage/chatMessage.model.js
server/api/chatMessage/chatMessage.rpc.js
server/api/chatMessage/chatMessage.socket.js
server/api/chatMessage/index.js
server/api/chatOfflineMessage/chatOfflineMessage.attributes.js
server/api/chatOfflineMessage/chatOfflineMessage.controller.js
server/api/chatOfflineMessage/chatOfflineMessage.events.js
server/api/chatOfflineMessage/chatOfflineMessage.model.js
server/api/chatOfflineMessage/chatOfflineMessage.rpc.js
server/api/chatOfflineMessage/index.js
server/api/chatProactiveAction/chatProactiveAction.attributes.js
server/api/chatProactiveAction/chatProactiveAction.controller.js
server/api/chatProactiveAction/chatProactiveAction.model.js
server/api/chatProactiveAction/chatProactiveAction.rpc.js
server/api/chatProactiveAction/index.js
server/api/chatQueue/chatQueue.attributes.js
server/api/chatQueue/chatQueue.controller.js
server/api/chatQueue/chatQueue.events.js
server/api/chatQueue/chatQueue.model.js
server/api/chatQueue/chatQueue.rpc.js
server/api/chatQueue/chatQueue.socket.js
server/api/chatQueue/index.js
server/api/chatQueueReport/chatQueueReport.attributes.js
server/api/chatQueueReport/chatQueueReport.controller.js
server/api/chatQueueReport/chatQueueReport.model.js
server/api/chatQueueReport/chatQueueReport.rpc.js
server/api/chatQueueReport/index.js
server/api/chatTransferReport/chatTransferReport.attributes.js
server/api/chatTransferReport/chatTransferReport.controller.js
server/api/chatTransferReport/chatTransferReport.model.js
server/api/chatTransferReport/chatTransferReport.rpc.js
server/api/chatTransferReport/index.js
server/api/chatWebsite/chatWebsite.attributes.js
server/api/chatWebsite/chatWebsite.controller.js
server/api/chatWebsite/chatWebsite.events.js
server/api/chatWebsite/chatWebsite.model.js
server/api/chatWebsite/chatWebsite.rpc.js
server/api/chatWebsite/chatWebsite.socket.js
server/api/chatWebsite/index.js
server/api/client-side-logs.js
server/api/cloudProvider/cloudProvider.attributes.js
server/api/cloudProvider/cloudProvider.controller.js
server/api/cloudProvider/cloudProvider.model.js
server/api/cloudProvider/cloudProvider.oauth.js
server/api/cloudProvider/cloudProvider.rpc.js
server/api/cloudProvider/index.js
server/api/cmCompany/cmCompany.attributes.js
server/api/cmCompany/cmCompany.controller.js
server/api/cmCompany/cmCompany.model.js
server/api/cmCompany/cmCompany.rpc.js
server/api/cmCompany/index.js
server/api/cmContact/cmContact.attributes.js
server/api/cmContact/cmContact.controller.js
server/api/cmContact/cmContact.events.js
server/api/cmContact/cmContact.model.js
server/api/cmContact/cmContact.rpc.js
server/api/cmContact/cmContact.socket.js
server/api/cmContact/index.js
server/api/cmContactHasItem/cmContactHasItem.attributes.js
server/api/cmContactHasItem/cmContactHasItem.controller.js
server/api/cmContactHasItem/cmContactHasItem.model.js
server/api/cmContactHasItem/cmContactHasItem.rpc.js
server/api/cmContactHasItem/index.js
server/api/cmCustomField/cmCustomField.attributes.js
server/api/cmCustomField/cmCustomField.controller.js
server/api/cmCustomField/cmCustomField.model.js
server/api/cmCustomField/cmCustomField.rpc.js
server/api/cmCustomField/index.js
server/api/cmHopper/cmHopper.attributes.js
server/api/cmHopper/cmHopper.controller.js
server/api/cmHopper/cmHopper.model.js
server/api/cmHopper/cmHopper.rpc.js
server/api/cmHopper/index.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js
server/api/cmHopperAdditionalPhone/index.js
server/api/cmHopperBlack/cmHopperBlack.attributes.js
server/api/cmHopperBlack/cmHopperBlack.controller.js
server/api/cmHopperBlack/cmHopperBlack.model.js
server/api/cmHopperBlack/cmHopperBlack.rpc.js
server/api/cmHopperBlack/index.js
server/api/cmHopperFinal/cmHopperFinal.attributes.js
server/api/cmHopperFinal/cmHopperFinal.controller.js
server/api/cmHopperFinal/cmHopperFinal.model.js
server/api/cmHopperFinal/cmHopperFinal.rpc.js
server/api/cmHopperFinal/index.js
server/api/cmHopperHistory/cmHopperHistory.attributes.js
server/api/cmHopperHistory/cmHopperHistory.controller.js
server/api/cmHopperHistory/cmHopperHistory.model.js
server/api/cmHopperHistory/cmHopperHistory.rpc.js
server/api/cmHopperHistory/index.js
server/api/cmList/cmList.attributes.js
server/api/cmList/cmList.controller.js
server/api/cmList/cmList.events.js
server/api/cmList/cmList.model.js
server/api/cmList/cmList.rpc.js
server/api/cmList/cmList.socket.js
server/api/cmList/index.js
server/api/condition/condition.attributes.js
server/api/condition/condition.controller.js
server/api/condition/condition.model.js
server/api/condition/condition.rpc.js
server/api/condition/index.js
server/api/contactItemType/contactItemType.attributes.js
server/api/contactItemType/contactItemType.controller.js
server/api/contactItemType/contactItemType.model.js
server/api/contactItemType/contactItemType.rpc.js
server/api/contactItemType/index.js
server/api/dashboard/dashboard.attributes.js
server/api/dashboard/dashboard.controller.js
server/api/dashboard/dashboard.events.js
server/api/dashboard/dashboard.model.js
server/api/dashboard/dashboard.rpc.js
server/api/dashboard/dashboard.socket.js
server/api/dashboard/index.js
server/api/dashboardItem/dashboardItem.attributes.js
server/api/dashboardItem/dashboardItem.controller.js
server/api/dashboardItem/dashboardItem.events.js
server/api/dashboardItem/dashboardItem.model.js
server/api/dashboardItem/dashboardItem.rpc.js
server/api/dashboardItem/dashboardItem.socket.js
server/api/dashboardItem/index.js
server/api/disposition/disposition.attributes.js
server/api/disposition/disposition.controller.js
server/api/disposition/disposition.model.js
server/api/disposition/disposition.rpc.js
server/api/disposition/index.js
server/api/faxAccount/faxAccount.attributes.js
server/api/faxAccount/faxAccount.controller.js
server/api/faxAccount/faxAccount.events.js
server/api/faxAccount/faxAccount.model.js
server/api/faxAccount/faxAccount.rpc.js
server/api/faxAccount/faxAccount.socket.js
server/api/faxAccount/index.js
server/api/faxApplication/faxApplication.attributes.js
server/api/faxApplication/faxApplication.controller.js
server/api/faxApplication/faxApplication.model.js
server/api/faxApplication/faxApplication.rpc.js
server/api/faxApplication/index.js
server/api/faxInteraction/faxInteraction.attributes.js
server/api/faxInteraction/faxInteraction.controller.js
server/api/faxInteraction/faxInteraction.events.js
server/api/faxInteraction/faxInteraction.model.js
server/api/faxInteraction/faxInteraction.rpc.js
server/api/faxInteraction/faxInteraction.socket.js
server/api/faxInteraction/index.js
server/api/faxMessage/faxMessage.attributes.js
server/api/faxMessage/faxMessage.controller.js
server/api/faxMessage/faxMessage.events.js
server/api/faxMessage/faxMessage.model.js
server/api/faxMessage/faxMessage.rpc.js
server/api/faxMessage/faxMessage.socket.js
server/api/faxMessage/index.js
server/api/faxQueue/faxQueue.attributes.js
server/api/faxQueue/faxQueue.controller.js
server/api/faxQueue/faxQueue.events.js
server/api/faxQueue/faxQueue.model.js
server/api/faxQueue/faxQueue.rpc.js
server/api/faxQueue/faxQueue.socket.js
server/api/faxQueue/index.js
server/api/faxQueueReport/faxQueueReport.attributes.js
server/api/faxQueueReport/faxQueueReport.controller.js
server/api/faxQueueReport/faxQueueReport.model.js
server/api/faxQueueReport/faxQueueReport.rpc.js
server/api/faxQueueReport/index.js
server/api/faxTransferReport/faxTransferReport.attributes.js
server/api/faxTransferReport/faxTransferReport.controller.js
server/api/faxTransferReport/faxTransferReport.model.js
server/api/faxTransferReport/faxTransferReport.rpc.js
server/api/faxTransferReport/index.js
server/api/intDeskAccount/index.js
server/api/intDeskAccount/intDeskAccount.attributes.js
server/api/intDeskAccount/intDeskAccount.controller.js
server/api/intDeskAccount/intDeskAccount.model.js
server/api/intDeskAccount/intDeskAccount.rpc.js
server/api/intDeskConfiguration/index.js
server/api/intDeskConfiguration/intDeskConfiguration.attributes.js
server/api/intDeskConfiguration/intDeskConfiguration.controller.js
server/api/intDeskConfiguration/intDeskConfiguration.model.js
server/api/intDeskConfiguration/intDeskConfiguration.rpc.js
server/api/intDeskField/index.js
server/api/intDeskField/intDeskField.attributes.js
server/api/intDeskField/intDeskField.controller.js
server/api/intDeskField/intDeskField.model.js
server/api/intDeskField/intDeskField.rpc.js
server/api/intDynamics365Account/index.js
server/api/intDynamics365Account/intDynamics365Account.attributes.js
server/api/intDynamics365Account/intDynamics365Account.controller.js
server/api/intDynamics365Account/intDynamics365Account.model.js
server/api/intDynamics365Account/intDynamics365Account.rpc.js
server/api/intDynamics365Configuration/index.js
server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js
server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js
server/api/intDynamics365Configuration/intDynamics365Configuration.model.js
server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js
server/api/intDynamics365Field/index.js
server/api/intDynamics365Field/intDynamics365Field.attributes.js
server/api/intDynamics365Field/intDynamics365Field.controller.js
server/api/intDynamics365Field/intDynamics365Field.model.js
server/api/intDynamics365Field/intDynamics365Field.rpc.js
server/api/intFreshdeskAccount/index.js
server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js
server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js
server/api/intFreshdeskAccount/intFreshdeskAccount.model.js
server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js
server/api/intFreshdeskConfiguration/index.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js
server/api/intFreshdeskField/index.js
server/api/intFreshdeskField/intFreshdeskField.attributes.js
server/api/intFreshdeskField/intFreshdeskField.controller.js
server/api/intFreshdeskField/intFreshdeskField.model.js
server/api/intFreshdeskField/intFreshdeskField.rpc.js
server/api/intFreshsalesAccount/index.js
server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js
server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js
server/api/intFreshsalesAccount/intFreshsalesAccount.model.js
server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js
server/api/intFreshsalesConfiguration/index.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js
server/api/intFreshsalesField/index.js
server/api/intFreshsalesField/intFreshsalesField.attributes.js
server/api/intFreshsalesField/intFreshsalesField.controller.js
server/api/intFreshsalesField/intFreshsalesField.model.js
server/api/intFreshsalesField/intFreshsalesField.rpc.js
server/api/intSalesforceAccount/index.js
server/api/intSalesforceAccount/intSalesforceAccount.attributes.js
server/api/intSalesforceAccount/intSalesforceAccount.controller.js
server/api/intSalesforceAccount/intSalesforceAccount.model.js
server/api/intSalesforceAccount/intSalesforceAccount.rpc.js
server/api/intSalesforceConfiguration/index.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js
server/api/intSalesforceField/index.js
server/api/intSalesforceField/intSalesforceField.attributes.js
server/api/intSalesforceField/intSalesforceField.controller.js
server/api/intSalesforceField/intSalesforceField.model.js
server/api/intSalesforceField/intSalesforceField.rpc.js
server/api/intServicenowAccount/index.js
server/api/intServicenowAccount/intServicenowAccount.attributes.js
server/api/intServicenowAccount/intServicenowAccount.controller.js
server/api/intServicenowAccount/intServicenowAccount.model.js
server/api/intServicenowAccount/intServicenowAccount.rpc.js
server/api/intServicenowConfiguration/index.js
server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js
server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js
server/api/intServicenowConfiguration/intServicenowConfiguration.model.js
server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js
server/api/intServicenowField/index.js
server/api/intServicenowField/intServicenowField.attributes.js
server/api/intServicenowField/intServicenowField.controller.js
server/api/intServicenowField/intServicenowField.model.js
server/api/intServicenowField/intServicenowField.rpc.js
server/api/intSugarcrmAccount/index.js
server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js
server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js
server/api/intSugarcrmAccount/intSugarcrmAccount.model.js
server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js
server/api/intSugarcrmConfiguration/index.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js
server/api/intSugarcrmField/index.js
server/api/intSugarcrmField/intSugarcrmField.attributes.js
server/api/intSugarcrmField/intSugarcrmField.controller.js
server/api/intSugarcrmField/intSugarcrmField.model.js
server/api/intSugarcrmField/intSugarcrmField.rpc.js
server/api/intVtigerAccount/index.js
server/api/intVtigerAccount/intVtigerAccount.attributes.js
server/api/intVtigerAccount/intVtigerAccount.controller.js
server/api/intVtigerAccount/intVtigerAccount.model.js
server/api/intVtigerAccount/intVtigerAccount.rpc.js
server/api/intVtigerConfiguration/index.js
server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js
server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js
server/api/intVtigerConfiguration/intVtigerConfiguration.model.js
server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js
server/api/intVtigerField/index.js
server/api/intVtigerField/intVtigerField.attributes.js
server/api/intVtigerField/intVtigerField.controller.js
server/api/intVtigerField/intVtigerField.model.js
server/api/intVtigerField/intVtigerField.rpc.js
server/api/intZendeskAccount/index.js
server/api/intZendeskAccount/intZendeskAccount.attributes.js
server/api/intZendeskAccount/intZendeskAccount.controller.js
server/api/intZendeskAccount/intZendeskAccount.model.js
server/api/intZendeskAccount/intZendeskAccount.rpc.js
server/api/intZendeskConfiguration/index.js
server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js
server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js
server/api/intZendeskConfiguration/intZendeskConfiguration.model.js
server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js
server/api/intZendeskField/index.js
server/api/intZendeskField/intZendeskField.attributes.js
server/api/intZendeskField/intZendeskField.controller.js
server/api/intZendeskField/intZendeskField.model.js
server/api/intZendeskField/intZendeskField.rpc.js
server/api/intZohoAccount/index.js
server/api/intZohoAccount/intZohoAccount.attributes.js
server/api/intZohoAccount/intZohoAccount.controller.js
server/api/intZohoAccount/intZohoAccount.model.js
server/api/intZohoAccount/intZohoAccount.rpc.js
server/api/intZohoConfiguration/index.js
server/api/intZohoConfiguration/intZohoConfiguration.attributes.js
server/api/intZohoConfiguration/intZohoConfiguration.controller.js
server/api/intZohoConfiguration/intZohoConfiguration.model.js
server/api/intZohoConfiguration/intZohoConfiguration.rpc.js
server/api/intZohoField/index.js
server/api/intZohoField/intZohoField.attributes.js
server/api/intZohoField/intZohoField.controller.js
server/api/intZohoField/intZohoField.model.js
server/api/intZohoField/intZohoField.rpc.js
server/api/integration/index.js
server/api/integration/integration.attributes.js
server/api/integration/integration.controller.js
server/api/integration/integration.model.js
server/api/integration/integration.rpc.js
server/api/integrationReport/index.js
server/api/integrationReport/integrationReport.attributes.js
server/api/integrationReport/integrationReport.controller.js
server/api/integrationReport/integrationReport.model.js
server/api/integrationReport/integrationReport.rpc.js
server/api/interval/index.js
server/api/interval/interval.attributes.js
server/api/interval/interval.controller.js
server/api/interval/interval.model.js
server/api/interval/interval.rpc.js
server/api/jira/index.js
server/api/jira/jira.controller.js
server/api/jscriptyAnswerReport/index.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js
server/api/jscriptyProject/index.js
server/api/jscriptyProject/jscriptyProject.attributes.js
server/api/jscriptyProject/jscriptyProject.controller.js
server/api/jscriptyProject/jscriptyProject.model.js
server/api/jscriptyProject/jscriptyProject.rpc.js
server/api/jscriptyQuestionReport/index.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js
server/api/jscriptySessionReport/index.js
server/api/jscriptySessionReport/jscriptySessionReport.attributes.js
server/api/jscriptySessionReport/jscriptySessionReport.controller.js
server/api/jscriptySessionReport/jscriptySessionReport.model.js
server/api/jscriptySessionReport/jscriptySessionReport.rpc.js
server/api/license/index.js
server/api/license/license.attributes.js
server/api/license/license.controller.js
server/api/license/license.model.js
server/api/license/license.rpc.js
server/api/mailAccount/index.js
server/api/mailAccount/mailAccount.attributes.js
server/api/mailAccount/mailAccount.controller.js
server/api/mailAccount/mailAccount.events.js
server/api/mailAccount/mailAccount.model.js
server/api/mailAccount/mailAccount.rpc.js
server/api/mailAccount/mailAccount.socket.js
server/api/mailApplication/index.js
server/api/mailApplication/mailApplication.attributes.js
server/api/mailApplication/mailApplication.controller.js
server/api/mailApplication/mailApplication.model.js
server/api/mailApplication/mailApplication.rpc.js
server/api/mailInteraction/index.js
server/api/mailInteraction/mailInteraction.attributes.js
server/api/mailInteraction/mailInteraction.controller.js
server/api/mailInteraction/mailInteraction.events.js
server/api/mailInteraction/mailInteraction.model.js
server/api/mailInteraction/mailInteraction.rpc.js
server/api/mailInteraction/mailInteraction.socket.js
server/api/mailMessage/index.js
server/api/mailMessage/mailMessage.attributes.js
server/api/mailMessage/mailMessage.controller.js
server/api/mailMessage/mailMessage.events.js
server/api/mailMessage/mailMessage.model.js
server/api/mailMessage/mailMessage.rpc.js
server/api/mailMessage/mailMessage.socket.js
server/api/mailQueue/index.js
server/api/mailQueue/mailQueue.attributes.js
server/api/mailQueue/mailQueue.controller.js
server/api/mailQueue/mailQueue.events.js
server/api/mailQueue/mailQueue.model.js
server/api/mailQueue/mailQueue.rpc.js
server/api/mailQueue/mailQueue.socket.js
server/api/mailQueueReport/index.js
server/api/mailQueueReport/mailQueueReport.attributes.js
server/api/mailQueueReport/mailQueueReport.controller.js
server/api/mailQueueReport/mailQueueReport.model.js
server/api/mailQueueReport/mailQueueReport.rpc.js
server/api/mailServerIn/index.js
server/api/mailServerIn/mailServerIn.attributes.js
server/api/mailServerIn/mailServerIn.model.js
server/api/mailServerIn/mailServerIn.rpc.js
server/api/mailServerOut/index.js
server/api/mailServerOut/mailServerOut.attributes.js
server/api/mailServerOut/mailServerOut.controller.js
server/api/mailServerOut/mailServerOut.model.js
server/api/mailServerOut/mailServerOut.rpc.js
server/api/mailSubstatus/index.js
server/api/mailSubstatus/mailSubstatus.attributes.js
server/api/mailSubstatus/mailSubstatus.controller.js
server/api/mailSubstatus/mailSubstatus.events.js
server/api/mailSubstatus/mailSubstatus.model.js
server/api/mailSubstatus/mailSubstatus.rpc.js
server/api/mailTransferReport/index.js
server/api/mailTransferReport/mailTransferReport.attributes.js
server/api/mailTransferReport/mailTransferReport.controller.js
server/api/mailTransferReport/mailTransferReport.model.js
server/api/mailTransferReport/mailTransferReport.rpc.js
server/api/memberReport/index.js
server/api/memberReport/memberReport.attributes.js
server/api/memberReport/memberReport.controller.js
server/api/memberReport/memberReport.model.js
server/api/memberReport/memberReport.rpc.js
server/api/migration/index.js
server/api/migration/migration.attributes.js
server/api/migration/migration.controller.js
server/api/migration/migration.model.js
server/api/migration/migration.rpc.js
server/api/network/index.js
server/api/network/network.attributes.js
server/api/network/network.controller.js
server/api/network/network.model.js
server/api/network/network.rpc.js
server/api/openchannelAccount/index.js
server/api/openchannelAccount/openchannelAccount.attributes.js
server/api/openchannelAccount/openchannelAccount.controller.js
server/api/openchannelAccount/openchannelAccount.events.js
server/api/openchannelAccount/openchannelAccount.model.js
server/api/openchannelAccount/openchannelAccount.rpc.js
server/api/openchannelAccount/openchannelAccount.socket.js
server/api/openchannelApplication/index.js
server/api/openchannelApplication/openchannelApplication.attributes.js
server/api/openchannelApplication/openchannelApplication.controller.js
server/api/openchannelApplication/openchannelApplication.model.js
server/api/openchannelApplication/openchannelApplication.rpc.js
server/api/openchannelInteraction/index.js
server/api/openchannelInteraction/openchannelInteraction.attributes.js
server/api/openchannelInteraction/openchannelInteraction.controller.js
server/api/openchannelInteraction/openchannelInteraction.events.js
server/api/openchannelInteraction/openchannelInteraction.model.js
server/api/openchannelInteraction/openchannelInteraction.rpc.js
server/api/openchannelInteraction/openchannelInteraction.socket.js
server/api/openchannelMessage/index.js
server/api/openchannelMessage/openchannelMessage.attributes.js
server/api/openchannelMessage/openchannelMessage.controller.js
server/api/openchannelMessage/openchannelMessage.events.js
server/api/openchannelMessage/openchannelMessage.model.js
server/api/openchannelMessage/openchannelMessage.rpc.js
server/api/openchannelMessage/openchannelMessage.socket.js
server/api/openchannelQueue/index.js
server/api/openchannelQueue/openchannelQueue.attributes.js
server/api/openchannelQueue/openchannelQueue.controller.js
server/api/openchannelQueue/openchannelQueue.events.js
server/api/openchannelQueue/openchannelQueue.model.js
server/api/openchannelQueue/openchannelQueue.rpc.js
server/api/openchannelQueue/openchannelQueue.socket.js
server/api/openchannelQueueReport/index.js
server/api/openchannelQueueReport/openchannelQueueReport.attributes.js
server/api/openchannelQueueReport/openchannelQueueReport.controller.js
server/api/openchannelQueueReport/openchannelQueueReport.model.js
server/api/openchannelQueueReport/openchannelQueueReport.rpc.js
server/api/openchannelTransferReport/index.js
server/api/openchannelTransferReport/openchannelTransferReport.attributes.js
server/api/openchannelTransferReport/openchannelTransferReport.controller.js
server/api/openchannelTransferReport/openchannelTransferReport.model.js
server/api/openchannelTransferReport/openchannelTransferReport.rpc.js
server/api/pause/index.js
server/api/pause/pause.attributes.js
server/api/pause/pause.controller.js
server/api/pause/pause.model.js
server/api/pause/pause.rpc.js
server/api/plugin/index.js
server/api/plugin/plugin.attributes.js
server/api/plugin/plugin.controller.js
server/api/plugin/plugin.events.js
server/api/plugin/plugin.model.js
server/api/plugin/plugin.rpc.js
server/api/plugin/plugin.socket.js
server/api/pm2/index.js
server/api/pm2/pm2.controller.js
server/api/realtime/index.js
server/api/realtime/realtime.controller.js
server/api/reportAgentPreview/index.js
server/api/reportAgentPreview/reportAgentPreview.attributes.js
server/api/reportAgentPreview/reportAgentPreview.model.js
server/api/reportAgentPreview/reportAgentPreview.rpc.js
server/api/rpc/index.js
server/api/rpc/rpc.controller.js
server/api/schedule/index.js
server/api/schedule/schedule.attributes.js
server/api/schedule/schedule.controller.js
server/api/schedule/schedule.model.js
server/api/schedule/schedule.rpc.js
server/api/screenRecording/index.js
server/api/screenRecording/screenRecording.attributes.js
server/api/screenRecording/screenRecording.controller.js
server/api/screenRecording/screenRecording.model.js
server/api/screenRecording/screenRecording.rpc.js
server/api/setting/index.js
server/api/setting/setting.attributes.js
server/api/setting/setting.controller.js
server/api/setting/setting.model.js
server/api/setting/setting.rpc.js
server/api/smsAccount/index.js
server/api/smsAccount/smsAccount.attributes.js
server/api/smsAccount/smsAccount.controller.js
server/api/smsAccount/smsAccount.events.js
server/api/smsAccount/smsAccount.model.js
server/api/smsAccount/smsAccount.rpc.js
server/api/smsAccount/smsAccount.socket.js
server/api/smsApplication/index.js
server/api/smsApplication/smsApplication.attributes.js
server/api/smsApplication/smsApplication.controller.js
server/api/smsApplication/smsApplication.model.js
server/api/smsApplication/smsApplication.rpc.js
server/api/smsInteraction/index.js
server/api/smsInteraction/smsInteraction.attributes.js
server/api/smsInteraction/smsInteraction.controller.js
server/api/smsInteraction/smsInteraction.events.js
server/api/smsInteraction/smsInteraction.model.js
server/api/smsInteraction/smsInteraction.rpc.js
server/api/smsInteraction/smsInteraction.socket.js
server/api/smsMessage/index.js
server/api/smsMessage/smsMessage.attributes.js
server/api/smsMessage/smsMessage.controller.js
server/api/smsMessage/smsMessage.events.js
server/api/smsMessage/smsMessage.model.js
server/api/smsMessage/smsMessage.rpc.js
server/api/smsMessage/smsMessage.socket.js
server/api/smsQueue/index.js
server/api/smsQueue/smsQueue.attributes.js
server/api/smsQueue/smsQueue.controller.js
server/api/smsQueue/smsQueue.events.js
server/api/smsQueue/smsQueue.model.js
server/api/smsQueue/smsQueue.rpc.js
server/api/smsQueue/smsQueue.socket.js
server/api/smsQueueReport/index.js
server/api/smsQueueReport/smsQueueReport.attributes.js
server/api/smsQueueReport/smsQueueReport.controller.js
server/api/smsQueueReport/smsQueueReport.model.js
server/api/smsQueueReport/smsQueueReport.rpc.js
server/api/smsTransferReport/index.js
server/api/smsTransferReport/smsTransferReport.attributes.js
server/api/smsTransferReport/smsTransferReport.controller.js
server/api/smsTransferReport/smsTransferReport.model.js
server/api/smsTransferReport/smsTransferReport.rpc.js
server/api/sound/index.js
server/api/sound/sound.attributes.js
server/api/sound/sound.controller.js
server/api/sound/sound.model.js
server/api/sound/sound.rpc.js
server/api/squareMessage/index.js
server/api/squareMessage/squareMessage.attributes.js
server/api/squareMessage/squareMessage.controller.js
server/api/squareMessage/squareMessage.model.js
server/api/squareMessage/squareMessage.rpc.js
server/api/squareOdbc/index.js
server/api/squareOdbc/squareOdbc.attributes.js
server/api/squareOdbc/squareOdbc.controller.js
server/api/squareOdbc/squareOdbc.model.js
server/api/squareOdbc/squareOdbc.rpc.js
server/api/squareProject/index.js
server/api/squareProject/squareProject.attributes.js
server/api/squareProject/squareProject.controller.js
server/api/squareProject/squareProject.events.js
server/api/squareProject/squareProject.model.js
server/api/squareProject/squareProject.rpc.js
server/api/squareProject/squareProject.socket.js
server/api/squareRecording/index.js
server/api/squareRecording/squareRecording.attributes.js
server/api/squareRecording/squareRecording.controller.js
server/api/squareRecording/squareRecording.model.js
server/api/squareRecording/squareRecording.rpc.js
server/api/squareReport/index.js
server/api/squareReport/squareReport.attributes.js
server/api/squareReport/squareReport.controller.js
server/api/squareReport/squareReport.model.js
server/api/squareReport/squareReport.rpc.js
server/api/squareReportDetail/index.js
server/api/squareReportDetail/squareReportDetail.attributes.js
server/api/squareReportDetail/squareReportDetail.controller.js
server/api/squareReportDetail/squareReportDetail.model.js
server/api/squareReportDetail/squareReportDetail.rpc.js
server/api/system/index.js
server/api/system/system.controller.js
server/api/tag/index.js
server/api/tag/tag.attributes.js
server/api/tag/tag.controller.js
server/api/tag/tag.model.js
server/api/tag/tag.rpc.js
server/api/team/index.js
server/api/team/team.attributes.js
server/api/team/team.controller.js
server/api/team/team.events.js
server/api/team/team.model.js
server/api/team/team.rpc.js
server/api/team/team.socket.js
server/api/teamVoicePrefix/teamVoicePrefix.attributes.js
server/api/teamVoicePrefix/teamVoicePrefix.model.js
server/api/teamVoiceQueue/index.js
server/api/teamVoiceQueue/teamVoiceQueue.attributes.js
server/api/teamVoiceQueue/teamVoiceQueue.model.js
server/api/teamVoiceQueue/teamVoiceQueue.rpc.js
server/api/template/index.js
server/api/template/template.attributes.js
server/api/template/template.controller.js
server/api/template/template.model.js
server/api/template/template.rpc.js
server/api/trigger/index.js
server/api/trigger/trigger.attributes.js
server/api/trigger/trigger.controller.js
server/api/trigger/trigger.model.js
server/api/trigger/trigger.rpc.js
server/api/trunk/index.js
server/api/trunk/trunk.attributes.js
server/api/trunk/trunk.controller.js
server/api/trunk/trunk.model.js
server/api/trunk/trunk.rpc.js
server/api/user-setting/index.js
server/api/user-setting/user-setting.attributes.js
server/api/user-setting/user-setting.controller.js
server/api/user-setting/user-setting.events.js
server/api/user-setting/user-setting.model.js
server/api/user-setting/user-setting.socket.js
server/api/user/index.js
server/api/user/user.attributes.js
server/api/user/user.controller.js
server/api/user/user.events.js
server/api/user/user.model.js
server/api/user/user.rpc.js
server/api/user/user.socket.js
server/api/userChatQueue/index.js
server/api/userChatQueue/userChatQueue.attributes.js
server/api/userChatQueue/userChatQueue.model.js
server/api/userChatQueue/userChatQueue.rpc.js
server/api/userFaxQueue/index.js
server/api/userFaxQueue/userFaxQueue.attributes.js
server/api/userFaxQueue/userFaxQueue.model.js
server/api/userFaxQueue/userFaxQueue.rpc.js
server/api/userMailQueue/index.js
server/api/userMailQueue/userMailQueue.attributes.js
server/api/userMailQueue/userMailQueue.model.js
server/api/userMailQueue/userMailQueue.rpc.js
server/api/userNotification/index.js
server/api/userNotification/userNotification.attributes.js
server/api/userNotification/userNotification.controller.js
server/api/userNotification/userNotification.events.js
server/api/userNotification/userNotification.model.js
server/api/userNotification/userNotification.rpc.js
server/api/userNotification/userNotification.socket.js
server/api/userOpenchannelQueue/index.js
server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js
server/api/userOpenchannelQueue/userOpenchannelQueue.model.js
server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js
server/api/userProfile/index.js
server/api/userProfile/userProfile.attributes.js
server/api/userProfile/userProfile.controller.js
server/api/userProfile/userProfile.events.js
server/api/userProfile/userProfile.model.js
server/api/userProfile/userProfile.rpc.js
server/api/userProfile/userProfile.socket.js
server/api/userProfileResource/index.js
server/api/userProfileResource/userProfileResource.attributes.js
server/api/userProfileResource/userProfileResource.controller.js
server/api/userProfileResource/userProfileResource.model.js
server/api/userProfileResource/userProfileResource.rpc.js
server/api/userProfileSection/index.js
server/api/userProfileSection/userProfileSection.attributes.js
server/api/userProfileSection/userProfileSection.controller.js
server/api/userProfileSection/userProfileSection.model.js
server/api/userProfileSection/userProfileSection.rpc.js
server/api/userSmsQueue/index.js
server/api/userSmsQueue/userSmsQueue.attributes.js
server/api/userSmsQueue/userSmsQueue.model.js
server/api/userSmsQueue/userSmsQueue.rpc.js
server/api/userVoicePrefix/userVoicePrefix.attributes.js
server/api/userVoicePrefix/userVoicePrefix.model.js
server/api/userVoiceQueue/index.js
server/api/userVoiceQueue/userVoiceQueue.attributes.js
server/api/userVoiceQueue/userVoiceQueue.model.js
server/api/userVoiceQueue/userVoiceQueue.rpc.js
server/api/userVoiceQueueRt/index.js
server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js
server/api/userVoiceQueueRt/userVoiceQueueRt.events.js
server/api/userVoiceQueueRt/userVoiceQueueRt.model.js
server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js
server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js
server/api/userWhatsappQueue/index.js
server/api/userWhatsappQueue/userWhatsappQueue.attributes.js
server/api/userWhatsappQueue/userWhatsappQueue.model.js
server/api/userWhatsappQueue/userWhatsappQueue.rpc.js
server/api/variable/index.js
server/api/variable/variable.attributes.js
server/api/variable/variable.controller.js
server/api/variable/variable.model.js
server/api/variable/variable.rpc.js
server/api/version/index.js
server/api/version/version.controller.js
server/api/voiceAgentReport/index.js
server/api/voiceAgentReport/voiceAgentReport.attributes.js
server/api/voiceAgentReport/voiceAgentReport.controller.js
server/api/voiceAgentReport/voiceAgentReport.model.js
server/api/voiceAgentReport/voiceAgentReport.rpc.js
server/api/voiceCallReport/index.js
server/api/voiceCallReport/voiceCallReport.attributes.js
server/api/voiceCallReport/voiceCallReport.controller.js
server/api/voiceCallReport/voiceCallReport.model.js
server/api/voiceCallReport/voiceCallReport.rpc.js
server/api/voiceChanSpy/index.js
server/api/voiceChanSpy/voiceChanSpy.attributes.js
server/api/voiceChanSpy/voiceChanSpy.controller.js
server/api/voiceChanSpy/voiceChanSpy.model.js
server/api/voiceChanSpy/voiceChanSpy.rpc.js
server/api/voiceContext/index.js
server/api/voiceContext/voiceContext.attributes.js
server/api/voiceContext/voiceContext.controller.js
server/api/voiceContext/voiceContext.model.js
server/api/voiceContext/voiceContext.rpc.js
server/api/voiceDialReport/index.js
server/api/voiceDialReport/voiceDialReport.attributes.js
server/api/voiceDialReport/voiceDialReport.controller.js
server/api/voiceDialReport/voiceDialReport.model.js
server/api/voiceDialReport/voiceDialReport.rpc.js
server/api/voiceExtension/index.js
server/api/voiceExtension/voiceExtension.attributes.js
server/api/voiceExtension/voiceExtension.controller.js
server/api/voiceExtension/voiceExtension.events.js
server/api/voiceExtension/voiceExtension.model.js
server/api/voiceExtension/voiceExtension.rpc.js
server/api/voiceExtension/voiceExtension.socket.js
server/api/voiceMail/index.js
server/api/voiceMail/voiceMail.attributes.js
server/api/voiceMail/voiceMail.controller.js
server/api/voiceMail/voiceMail.model.js
server/api/voiceMail/voiceMail.rpc.js
server/api/voiceMailMessage/index.js
server/api/voiceMailMessage/voiceMailMessage.attributes.js
server/api/voiceMailMessage/voiceMailMessage.controller.js
server/api/voiceMailMessage/voiceMailMessage.model.js
server/api/voiceMailMessage/voiceMailMessage.rpc.js
server/api/voiceMusicOnHold/index.js
server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js
server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js
server/api/voiceMusicOnHold/voiceMusicOnHold.model.js
server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js
server/api/voicePrefix/index.js
server/api/voicePrefix/voicePrefix.attributes.js
server/api/voicePrefix/voicePrefix.controller.js
server/api/voicePrefix/voicePrefix.events.js
server/api/voicePrefix/voicePrefix.model.js
server/api/voicePrefix/voicePrefix.rpc.js
server/api/voicePrefix/voicePrefix.socket.js
server/api/voiceQueue/index.js
server/api/voiceQueue/voiceQueue.attributes.js
server/api/voiceQueue/voiceQueue.controller.js
server/api/voiceQueue/voiceQueue.events.js
server/api/voiceQueue/voiceQueue.model.js
server/api/voiceQueue/voiceQueue.rpc.js
server/api/voiceQueue/voiceQueue.socket.js
server/api/voiceQueueReport/index.js
server/api/voiceQueueReport/voiceQueueReport.attributes.js
server/api/voiceQueueReport/voiceQueueReport.controller.js
server/api/voiceQueueReport/voiceQueueReport.events.js
server/api/voiceQueueReport/voiceQueueReport.model.js
server/api/voiceQueueReport/voiceQueueReport.rpc.js
server/api/voiceQueueReport/voiceQueueReport.socket.js
server/api/voiceQueuesLog/index.js
server/api/voiceQueuesLog/voiceQueuesLog.attributes.js
server/api/voiceQueuesLog/voiceQueuesLog.controller.js
server/api/voiceQueuesLog/voiceQueuesLog.model.js
server/api/voiceQueuesLog/voiceQueuesLog.rpc.js
server/api/voiceRecording/index.js
server/api/voiceRecording/voiceRecording.attributes.js
server/api/voiceRecording/voiceRecording.controller.js
server/api/voiceRecording/voiceRecording.model.js
server/api/voiceRecording/voiceRecording.rpc.js
server/api/voiceTransferReport/index.js
server/api/voiceTransferReport/voiceTransferReport.attributes.js
server/api/voiceTransferReport/voiceTransferReport.controller.js
server/api/voiceTransferReport/voiceTransferReport.model.js
server/api/voiceTransferReport/voiceTransferReport.rpc.js
server/api/webbar/index.js
server/api/webbar/webbar.controller.js
server/api/whatsappAccount/index.js
server/api/whatsappAccount/whatsappAccount.attributes.js
server/api/whatsappAccount/whatsappAccount.controller.js
server/api/whatsappAccount/whatsappAccount.events.js
server/api/whatsappAccount/whatsappAccount.model.js
server/api/whatsappAccount/whatsappAccount.rpc.js
server/api/whatsappAccount/whatsappAccount.socket.js
server/api/whatsappApplication/index.js
server/api/whatsappApplication/whatsappApplication.attributes.js
server/api/whatsappApplication/whatsappApplication.controller.js
server/api/whatsappApplication/whatsappApplication.model.js
server/api/whatsappApplication/whatsappApplication.rpc.js
server/api/whatsappInteraction/index.js
server/api/whatsappInteraction/whatsappInteraction.attributes.js
server/api/whatsappInteraction/whatsappInteraction.controller.js
server/api/whatsappInteraction/whatsappInteraction.events.js
server/api/whatsappInteraction/whatsappInteraction.model.js
server/api/whatsappInteraction/whatsappInteraction.rpc.js
server/api/whatsappInteraction/whatsappInteraction.socket.js
server/api/whatsappMessage/index.js
server/api/whatsappMessage/whatsappMessage.attributes.js
server/api/whatsappMessage/whatsappMessage.controller.js
server/api/whatsappMessage/whatsappMessage.events.js
server/api/whatsappMessage/whatsappMessage.model.js
server/api/whatsappMessage/whatsappMessage.rpc.js
server/api/whatsappMessage/whatsappMessage.socket.js
server/api/whatsappQueue/index.js
server/api/whatsappQueue/whatsappQueue.attributes.js
server/api/whatsappQueue/whatsappQueue.controller.js
server/api/whatsappQueue/whatsappQueue.events.js
server/api/whatsappQueue/whatsappQueue.model.js
server/api/whatsappQueue/whatsappQueue.rpc.js
server/api/whatsappQueue/whatsappQueue.socket.js
server/api/whatsappQueueReport/index.js
server/api/whatsappQueueReport/whatsappQueueReport.attributes.js
server/api/whatsappQueueReport/whatsappQueueReport.controller.js
server/api/whatsappQueueReport/whatsappQueueReport.model.js
server/api/whatsappQueueReport/whatsappQueueReport.rpc.js
server/api/whatsappTransferReport/index.js
server/api/whatsappTransferReport/whatsappTransferReport.attributes.js
server/api/whatsappTransferReport/whatsappTransferReport.controller.js
server/api/whatsappTransferReport/whatsappTransferReport.model.js
server/api/whatsappTransferReport/whatsappTransferReport.rpc.js
server/app.js
server/components/auth/service.js
server/components/contacts/index.js
server/components/contacts/sql-utils.js
server/components/encryptor/index.js
server/components/export/csv.js
server/components/export/pdf.js
server/components/export/xlsx.js
server/components/extensions/rewrite.js
server/components/import/cm/csv.js
server/components/import/cm/csv2.js
server/components/import/cm/csvUpdates.js
server/components/integrations/configuration.js
server/components/interaction/service.js
server/components/interaction/sql-utils.js
server/components/interaction/update-interaction.js
server/components/interaction/utils.js
server/components/license/service.js
server/components/parsers/advancedSearch.js
server/components/parsers/qs.js
server/components/realtime/agents.js
server/components/realtime/queues.js
server/config/express.js
server/config/license/hardware.js
server/config/license/index.js
server/config/license/util.js
server/config/local.env.js
server/config/logger.js
server/config/pm2/config.js
server/config/pm2/index.js
server/config/schedule/chat.js
server/config/schedule/cloud-provider.js
server/config/schedule/index.js
server/config/schedule/transcribe.js
server/config/schedule/whatsapp.js
server/config/seedContact.js
server/config/seedUsers.js
server/config/socketio.js
server/config/triggers/index.js
server/config/utils.js
server/errors/api.js
server/errors/index.js
server/mysqldb/index.js
server/routes.js
server/rpc/index.js
server/services/agi/channel.js
server/services/agi/error.js
server/services/agi/events.js
server/services/agi/graph/index.js
server/services/agi/index.js
server/services/agi/mailRpc/index.js
server/services/agi/project.js
server/services/agi/reply.js
server/services/agi/rpc/index.js
server/services/agi/scripts/aws/index.js
server/services/agi/scripts/aws/lex/index.js
server/services/agi/scripts/aws/lex/lib/api.js
server/services/agi/scripts/aws/polly/index.js
server/services/agi/scripts/aws/polly/lib/api.js
server/services/agi/scripts/google/asr/index.js
server/services/agi/scripts/google/asr/lib/api.js
server/services/agi/scripts/google/index.js
server/services/agi/scripts/index.js
server/services/agi/scripts/sestek/index.js
server/services/agi/scripts/sestek/nda/index.js
server/services/agi/scripts/tilde/asr/index.js
server/services/agi/scripts/tilde/asr/lib/api.js
server/services/agi/scripts/tilde/index.js
server/services/agi/server.js
server/services/agi/vertices.js
server/services/ami/acw/index.js
server/services/ami/ami.js
server/services/ami/client.js
server/services/ami/dialer/index.js
server/services/ami/dialer/models/action.js
server/services/ami/dialer/models/agentComplete.js
server/services/ami/dialer/models/final.js
server/services/ami/dialer/models/hangup.js
server/services/ami/dialer/models/history.js
server/services/ami/dialer/models/queueCallerAbandon.js
server/services/ami/dialer/utils/hopper.js
server/services/ami/dialer/utils/index.js
server/services/ami/fax/action.js
server/services/ami/fax/index.js
server/services/ami/fax/rpcDb.js
server/services/ami/fax/util/gs.js
server/services/ami/fax/util/util.js
server/services/ami/index.js
server/services/ami/model/agent.js
server/services/ami/model/campaign.js
server/services/ami/model/channel.js
server/services/ami/model/deskAccount.js
server/services/ami/model/dynamics365Account.js
server/services/ami/model/faxAccount.js
server/services/ami/model/freshdeskAccount.js
server/services/ami/model/freshsalesAccount.js
server/services/ami/model/queueReport.js
server/services/ami/model/salesforceAccount.js
server/services/ami/model/servicenowAccount.js
server/services/ami/model/sugarcrmAccount.js
server/services/ami/model/telephone.js
server/services/ami/model/template.js
server/services/ami/model/trigger.js
server/services/ami/model/trunk.js
server/services/ami/model/voiceExtension.js
server/services/ami/model/voiceQueue.js
server/services/ami/model/voiceQueueSummary.js
server/services/ami/model/vtigerAccount.js
server/services/ami/model/zendeskAccount.js
server/services/ami/model/zohoAccount.js
server/services/ami/preview/action.js
server/services/ami/preview/index.js
server/services/ami/preview/rpcDb.js
server/services/ami/preview/util/util.js
server/services/ami/properties.js
server/services/ami/realtime/index.js
server/services/ami/realtime/utils.js
server/services/ami/report/index.js
server/services/ami/report/userReport.js
server/services/ami/report/voiceAgentReport.js
server/services/ami/report/voiceCallReport.js
server/services/ami/report/voiceDialReport.js
server/services/ami/report/voiceQueueReport.js
server/services/ami/rpc/agentReportPreview.js
server/services/ami/rpc/attachment.js
server/services/ami/rpc/campaign.js
server/services/ami/rpc/cmContact.js
server/services/ami/rpc/cmHopper.js
server/services/ami/rpc/cmHopperAdditionalPhone.js
server/services/ami/rpc/cmHopperBlack.js
server/services/ami/rpc/cmHopperFinal.js
server/services/ami/rpc/cmHopperHistory.js
server/services/ami/rpc/faxAccount.js
server/services/ami/rpc/faxMessage.js
server/services/ami/rpc/integrations/desk.js
server/services/ami/rpc/integrations/dynamics365.js
server/services/ami/rpc/integrations/freshdesk.js
server/services/ami/rpc/integrations/freshsales.js
server/services/ami/rpc/integrations/salesforce.js
server/services/ami/rpc/integrations/servicenow.js
server/services/ami/rpc/integrations/sugarcrm.js
server/services/ami/rpc/integrations/vtiger.js
server/services/ami/rpc/integrations/zendesk.js
server/services/ami/rpc/integrations/zoho.js
server/services/ami/rpc/interval.js
server/services/ami/rpc/memberReport.js
server/services/ami/rpc/setting.js
server/services/ami/rpc/template.js
server/services/ami/rpc/trigger.js
server/services/ami/rpc/trunk.js
server/services/ami/rpc/user.js
server/services/ami/rpc/voiceAgentReport.js
server/services/ami/rpc/voiceCallReport.js
server/services/ami/rpc/voiceDialReport.js
server/services/ami/rpc/voiceExtension.js
server/services/ami/rpc/voiceQueue.js
server/services/ami/rpc/voiceQueueReport.js
server/services/ami/rpc/voiceQueueRt.js
server/services/ami/rpc/voiceRecording.js
server/services/ami/rpc/voiceTransferReport.js
server/services/ami/server/index.js
server/services/ami/trigger/cmContact/index.js
server/services/ami/trigger/index.js
server/services/ami/trigger/integration/desk.js
server/services/ami/trigger/integration/dynamics365.js
server/services/ami/trigger/integration/freshdesk.js
server/services/ami/trigger/integration/freshsales.js
server/services/ami/trigger/integration/index.js
server/services/ami/trigger/integration/salesforce.js
server/services/ami/trigger/integration/servicenow.js
server/services/ami/trigger/integration/sugarcrm.js
server/services/ami/trigger/integration/util.js
server/services/ami/trigger/integration/vtiger.js
server/services/ami/trigger/integration/zendesk.js
server/services/ami/trigger/integration/zoho.js
server/services/ami/trigger/script/index.js
server/services/ami/trigger/urlforward/index.js
server/services/email/client.js
server/services/email/index.js
server/services/email/lib/email.js
server/services/email/lib/imap.js
server/services/email/lib/smtp.js
server/services/email/lib/utils.js
server/services/email/model/mailAccount.js
server/services/email/realtime/index.js
server/services/email/rpc/mailAccount.js
server/services/email/rpc/setting.js
server/services/email/server/index.js
server/services/express/index.js
server/services/routing/client.js
server/services/routing/index.js
server/services/routing/lib/rule-engine.js
server/services/routing/mailRpc/index.js
server/services/routing/model/agent.js
server/services/routing/model/chatQueue.js
server/services/routing/model/faxQueue.js
server/services/routing/model/interval.js
server/services/routing/model/mailQueue.js
server/services/routing/model/openchannelQueue.js
server/services/routing/model/smsQueue.js
server/services/routing/model/whatsappQueue.js
server/services/routing/realtime/index.js
server/services/routing/rpc/chatInteraction.js
server/services/routing/rpc/chatMessage.js
server/services/routing/rpc/chatQueue.js
server/services/routing/rpc/chatQueueReport.js
server/services/routing/rpc/faxInteraction.js
server/services/routing/rpc/faxMessage.js
server/services/routing/rpc/faxQueue.js
server/services/routing/rpc/faxQueueReport.js
server/services/routing/rpc/interval.js
server/services/routing/rpc/mailInteraction.js
server/services/routing/rpc/mailMessage.js
server/services/routing/rpc/mailQueue.js
server/services/routing/rpc/mailQueueReport.js
server/services/routing/rpc/openchannelInteraction.js
server/services/routing/rpc/openchannelMessage.js
server/services/routing/rpc/openchannelQueue.js
server/services/routing/rpc/openchannelQueueReport.js
server/services/routing/rpc/smsInteraction.js
server/services/routing/rpc/smsMessage.js
server/services/routing/rpc/smsQueue.js
server/services/routing/rpc/smsQueueReport.js
server/services/routing/rpc/user.js
server/services/routing/rpc/whatsappInteraction.js
server/services/routing/rpc/whatsappMessage.js
server/services/routing/rpc/whatsappQueue.js
server/services/routing/rpc/whatsappQueueReport.js
server/services/routing/server/applications/agent.js
server/services/routing/server/applications/amazonlex.js
server/services/routing/server/applications/autoreply.js
server/services/routing/server/applications/close.js
server/services/routing/server/applications/dialogflow.js
server/services/routing/server/applications/dialogflowV2.js
server/services/routing/server/applications/gotoif.js
server/services/routing/server/applications/gotop.js
server/services/routing/server/applications/message.js
server/services/routing/server/applications/noop.js
server/services/routing/server/applications/queue.js
server/services/routing/server/applications/strategy/agent.js
server/services/routing/server/applications/strategy/beepall.js
server/services/routing/server/applications/strategy/index.js
server/services/routing/server/applications/strategy/rrmemory.js
server/services/routing/server/applications/strategy/util.js
server/services/routing/server/applications/system.js
server/services/routing/server/applications/tag.js
server/services/routing/server/applications/tvox.js
server/services/routing/server/applications/utils.js
server/services/routing/server/index.js
server/services/routing/server/interval.js
server/services/xdr/agents.controller.js
server/services/xdr/calls.controller.js
server/services/xdr/core.controller.js
server/services/xdr/dials.controller.js
server/services/xdr/index.js
server/services/xdr/members.controller.js
server/services/xdr/queues.controller.js
server/services/xdr/recordings.controller.js
server/services/xdr/transfers.controller.js
server/services/xdr/utils.js
server/utils/client-side-logger.js
server/utils/iftime.js
server/utils/loggers.js
server/utils/mask-sensitive-data.js
server/utils/safe-template.js
server/utils/update-app-config.js

index 1b74cf4..07dd1bf 100644 (file)
@@ -17,7 +17,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2022-06-23T16:23:22.290Z",
+    "time": "2022-06-23T16:45:08.982Z",
     "url": "http://apidocjs.com",
     "version": "0.24.0"
   }
index a92f66a..1d7a040 100644 (file)
@@ -17,7 +17,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2022-06-23T16:23:22.290Z",
+    "time": "2022-06-23T16:45:08.982Z",
     "url": "http://apidocjs.com",
     "version": "0.24.0"
   }
index 1dd78c8..f0a7ab9 100644 (file)
@@ -1,11 +1,18 @@
 [![npm](https://img.shields.io/npm/v/grpc.svg)](https://www.npmjs.com/package/grpc)
 # Node.js gRPC Library
 
+**This library is now only receiving bug fixes and runtime compatibility updates. In April 2021 it will be deprecated and will no longer receive any updates. We recommend using [`@grpc/grpc-js`](https://www.npmjs.com/package/@grpc/grpc-js) instead.**
+
 ## PREREQUISITES
 - `node`: This requires `node` to be installed, version `4.0` or above. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package.
 
 - **Note:** If you installed `node` via a package manager and the version is still less than `4.0`, try directly installing it from [nodejs.org](https://nodejs.org).
 
+## LATEST VERSIONS SUPPORTED
+
+ - Node: 14
+ - Electron: 11.2
+
 ## INSTALLATION
 
 Install the gRPC NPM package
@@ -28,7 +35,7 @@ The `--build-from-source` option will work even when installing another package
 
 The official electron documentation recommends to [build all of your native packages from source](https://electronjs.org/docs/tutorial/using-native-node-modules#modules-that-rely-on-node-pre-gyp). While the reasons behind this are technically good - many native extensions won't be packaged to work properly with electron - the gRPC source code is fairly difficult to build from source due to its complex nature, and we're also providing working electron pre-built binaries. Therefore, we recommend that you do not follow this model for using gRPC with electron. Also, for the same reason, `electron-rebuild` will always build from source. We advise you to not use this tool if you are depending on gRPC. Please note that there's not just one way to get native extensions running in electron, and that there's never any silver bullet for anything. The following instructions try to cater about some of the most generic ways, but different edge cases might require different methodologies.
 
-The best to get gRPC to work with electron is to do this, possibly in your `postinstall` script of your `package.json` file:
+The best way to get gRPC to work with electron is to do this, possibly in the `postinstall` script of your `package.json` file:
 
 ```
 npm rebuild --target=2.0.0 --runtime=electron --dist-url=https://atom.io/download/electron
index ba5152d..067eef4 100644 (file)
         '-g',
         '-Wall',
         '-Wextra',
-        '-Werror',
-        '-Wno-long-long',
-        '-Wno-unused-parameter',
         '-DOSATOMIC_USE_INLINED=1',
-        '-Wno-deprecated-declarations',
-        '-Ithird_party/nanopb',
-        '-DPB_FIELD_32BIT',
+        '-Ithird_party/upb',
+        '-Isrc/core/ext/upb-generated',
         '-fvisibility=hidden',
     ],
     'ldflags': [
         '-g',
     ],
     'cflags_c': [
-      '-Werror',
       '-std=c99'
     ],
     'cflags_cc': [
-      '-Werror',
-      '-std=c++1y'
+      '-std=c++14'
     ],
     'include_dirs': [
       'deps/grpc',
       'deps/grpc/include',
+      'deps/grpc/src/core/ext/upb-generated',
+      'deps/grpc/third_party/abseil-cpp',
       'deps/grpc/third_party/address_sorting/include',
       'deps/grpc/third_party/cares',
       'deps/grpc/third_party/cares/cares',
-      'deps/grpc/third_party/abseil-cpp',
       'deps/grpc/third_party/nanopb',
+      'deps/grpc/third_party/upb',
+      'deps/grpc/third_party/upb/generated_for_cmake',
     ],
     'defines': [
       'PB_FIELD_32BIT',
       'GPR_BACKWARDS_COMPATIBILITY_MODE',
       'GRPC_ARES=1',
       'GRPC_UV',
-      'GRPC_NODE_VERSION="1.22.3"',
+      'GRPC_NODE_VERSION="1.24.5"',
       'CARES_STATICLIB',
       'CARES_SYMBOL_HIDING'
     ],
               '-g',
               '-Wall',
               '-Wextra',
-              '-Werror',
-              '-Wno-long-long',
-              '-Wno-unused-parameter',
               '-DOSATOMIC_USE_INLINED=1',
-              '-Wno-deprecated-declarations',
-              '-Ithird_party/nanopb',
-              '-DPB_FIELD_32BIT',
+              '-Ithird_party/upb',
+              '-Isrc/core/ext/upb-generated',
               '-fvisibility=hidden',
           ],
           'OTHER_CPLUSPLUSFLAGS': [
               '-g',
               '-Wall',
               '-Wextra',
-              '-Werror',
-              '-Wno-long-long',
-              '-Wno-unused-parameter',
               '-DOSATOMIC_USE_INLINED=1',
-              '-Wno-deprecated-declarations',
-              '-Ithird_party/nanopb',
-              '-DPB_FIELD_32BIT',
+              '-Ithird_party/upb',
+              '-Isrc/core/ext/upb-generated',
               '-fvisibility=hidden',
             '-stdlib=libc++',
             '-std=c++1y',
         'deps/grpc/src/core/lib/gpr/env_linux.cc',
         'deps/grpc/src/core/lib/gpr/env_posix.cc',
         'deps/grpc/src/core/lib/gpr/env_windows.cc',
-        'deps/grpc/src/core/lib/gpr/host_port.cc',
         'deps/grpc/src/core/lib/gpr/log.cc',
         'deps/grpc/src/core/lib/gpr/log_android.cc',
         'deps/grpc/src/core/lib/gpr/log_linux.cc',
         'deps/grpc/src/core/lib/gprpp/arena.cc',
         'deps/grpc/src/core/lib/gprpp/fork.cc',
         'deps/grpc/src/core/lib/gprpp/global_config_env.cc',
+        'deps/grpc/src/core/lib/gprpp/host_port.cc',
         'deps/grpc/src/core/lib/gprpp/thd_posix.cc',
         'deps/grpc/src/core/lib/gprpp/thd_windows.cc',
         'deps/grpc/src/core/lib/profiling/basic_timers.cc',
         'deps/grpc/src/core/lib/iomgr/ev_windows.cc',
         'deps/grpc/src/core/lib/iomgr/exec_ctx.cc',
         'deps/grpc/src/core/lib/iomgr/executor.cc',
+        'deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.cc',
+        'deps/grpc/src/core/lib/iomgr/executor/threadpool.cc',
         'deps/grpc/src/core/lib/iomgr/fork_posix.cc',
         'deps/grpc/src/core/lib/iomgr/fork_windows.cc',
         'deps/grpc/src/core/lib/iomgr/gethostname_fallback.cc',
         'deps/grpc/src/core/lib/security/security_connector/security_connector.cc',
         'deps/grpc/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc',
         'deps/grpc/src/core/lib/security/security_connector/ssl_utils.cc',
+        'deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.cc',
         'deps/grpc/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc',
         'deps/grpc/src/core/lib/security/transport/client_auth_filter.cc',
         'deps/grpc/src/core/lib/security/transport/secure_endpoint.cc',
         'deps/grpc/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc',
         'deps/grpc/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc',
         'deps/grpc/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc',
-        'deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc',
-        'deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc',
         'deps/grpc/src/core/tsi/alts/handshaker/alts_tsi_utils.cc',
         'deps/grpc/src/core/tsi/alts/handshaker/transport_security_common_api.cc',
-        'deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.c',
-        'deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.c',
-        'deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.c',
-        'deps/grpc/third_party/nanopb/pb_common.c',
-        'deps/grpc/third_party/nanopb/pb_decode.c',
-        'deps/grpc/third_party/nanopb/pb_encode.c',
+        'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c',
+        'deps/grpc/third_party/upb/upb/decode.c',
+        'deps/grpc/third_party/upb/upb/encode.c',
+        'deps/grpc/third_party/upb/upb/msg.c',
+        'deps/grpc/third_party/upb/upb/port.c',
+        'deps/grpc/third_party/upb/upb/table.c',
+        'deps/grpc/third_party/upb/upb/upb.c',
         'deps/grpc/src/core/tsi/transport_security.cc',
         'deps/grpc/src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
         'deps/grpc/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
         'deps/grpc/src/core/ext/transport/chttp2/client/authority.cc',
         'deps/grpc/src/core/ext/transport/chttp2/client/chttp2_connector.cc',
+        'deps/grpc/src/core/ext/filters/client_channel/backend_metric.cc',
         'deps/grpc/src/core/ext/filters/client_channel/backup_poller.cc',
         'deps/grpc/src/core/ext/filters/client_channel/channel_connectivity.cc',
         'deps/grpc/src/core/ext/filters/client_channel/client_channel.cc',
         'deps/grpc/src/core/ext/filters/client_channel/subchannel.cc',
         'deps/grpc/src/core/ext/filters/client_channel/subchannel_pool_interface.cc',
         'deps/grpc/src/core/ext/filters/deadline/deadline_filter.cc',
-        'deps/grpc/src/core/ext/filters/client_channel/health/health.pb.c',
+        'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/gogoproto/gogo.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/validate/validate.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/api/annotations.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/api/http.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/any.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/duration.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/empty.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/struct.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/google/rpc/status.upb.c',
         'deps/grpc/src/core/tsi/fake_transport_security.cc',
         'deps/grpc/src/core/tsi/local_transport_security.cc',
         'deps/grpc/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc',
+        'deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c',
         'deps/grpc/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc',
-        'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c',
-        'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c',
-        'deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/type/percent.upb.c',
+        'deps/grpc/src/core/ext/upb-generated/envoy/type/range.upb.c',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc',
         'deps/grpc/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc',
         'deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc',
         'deps/grpc/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
         'deps/grpc/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
         'deps/grpc/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
+        'deps/grpc/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc',
         'deps/grpc/src/core/ext/filters/census/grpc_context.cc',
+        'deps/grpc/src/core/ext/filters/client_idle/client_idle_filter.cc',
         'deps/grpc/src/core/ext/filters/max_age/max_age_filter.cc',
         'deps/grpc/src/core/ext/filters/message_size/message_size_filter.cc',
         'deps/grpc/src/core/ext/filters/http/client_authority_filter.cc',
index 9a99e01..cb46477 100644 (file)
@@ -224,7 +224,9 @@ GRPCAPI grpc_call* grpc_channel_create_call(
 GRPCAPI void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq,
                                void* tag, void* reserved);
 
-/** Pre-register a method/host pair on a channel. */
+/** Pre-register a method/host pair on a channel.
+    method and host are not owned and must remain alive while the server is
+    running. */
 GRPCAPI void* grpc_channel_register_call(grpc_channel* channel,
                                          const char* method, const char* host,
                                          void* reserved);
index 139c0c3..794900b 100644 (file)
@@ -328,6 +328,31 @@ GRPCAPI grpc_call_credentials* grpc_google_iam_credentials_create(
     const char* authorization_token, const char* authority_selector,
     void* reserved);
 
+/** Options for creating STS Oauth Token Exchange credentials following the IETF
+   draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16.
+   Optional fields may be set to NULL or empty string. It is the responsibility
+   of the caller to ensure that the subject and actor tokens are refreshed on
+   disk at the specified paths. This API is used for experimental purposes for
+   now and may change in the future. */
+typedef struct {
+  const char* token_exchange_service_uri; /* Required. */
+  const char* resource;                   /* Optional. */
+  const char* audience;                   /* Optional. */
+  const char* scope;                      /* Optional. */
+  const char* requested_token_type;       /* Optional. */
+  const char* subject_token_path;         /* Required. */
+  const char* subject_token_type;         /* Required. */
+  const char* actor_token_path;           /* Optional. */
+  const char* actor_token_type;           /* Optional. */
+} grpc_sts_credentials_options;
+
+/** Creates an STS credentials following the STS Token Exchanged specifed in the
+   IETF draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16.
+   This API is used for experimental purposes for now and may change in the
+   future. */
+GRPCAPI grpc_call_credentials* grpc_sts_credentials_create(
+    const grpc_sts_credentials_options* options, void* reserved);
+
 /** Callback function to be called by the metadata credentials plugin
    implementation when the metadata is ready.
    - user_data is the opaque pointer that was passed in the get_metadata method
@@ -753,6 +778,21 @@ GRPCAPI int grpc_tls_key_materials_config_set_key_materials(
     const grpc_ssl_pem_key_cert_pair** pem_key_cert_pairs,
     size_t num_key_cert_pairs);
 
+/** Set grpc_tls_key_materials_config instance with a provided version number,
+    which is used to keep track of the version of key materials.
+    It returns 1 on success and 0 on failure. It is used for
+    experimental purpose for now and subject to change.
+ */
+GRPCAPI int grpc_tls_key_materials_config_set_version(
+    grpc_tls_key_materials_config* config, int version);
+
+/** Get the version number of a grpc_tls_key_materials_config instance.
+    It returns the version number on success and -1 on failure.
+    It is used for experimental purpose for now and subject to change.
+ */
+GRPCAPI int grpc_tls_key_materials_config_get_version(
+    grpc_tls_key_materials_config* config);
+
 /** --- TLS credential reload config. ---
     It is used for experimental purpose for now and subject to change.*/
 
@@ -768,10 +808,11 @@ typedef void (*grpc_tls_on_credential_reload_done_cb)(
 /** A struct containing all information necessary to schedule/cancel
     a credential reload request. cb and cb_user_data represent a gRPC-provided
     callback and an argument passed to it. key_materials is an in/output
-    parameter containing currently used/newly reloaded credentials. status and
-    error_details are used to hold information about errors occurred when a
-    credential reload request is scheduled/cancelled. It is used for
-    experimental purpose for now and subject to change. */
+    parameter containing currently used/newly reloaded credentials. If
+    credential reload does not result in a new credential, key_materials should
+    not be modified. status and error_details are used to hold information about
+    errors occurred when a credential reload request is scheduled/cancelled. It
+    is used for experimental purpose for now and subject to change. */
 struct grpc_tls_credential_reload_arg {
   grpc_tls_on_credential_reload_done_cb cb;
   void* cb_user_data;
index 65582e6..8108b85 100644 (file)
@@ -157,8 +157,9 @@ typedef struct {
 /** Maximum message length that the channel can send. Int valued, bytes.
     -1 means unlimited. */
 #define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length"
-/** Maximum time that a channel may have no outstanding rpcs. Int valued,
-    milliseconds. INT_MAX means unlimited. */
+/** Maximum time that a channel may have no outstanding rpcs, after which the
+ * server will close the connection. Int valued, milliseconds. INT_MAX means
+ * unlimited. */
 #define GRPC_ARG_MAX_CONNECTION_IDLE_MS "grpc.max_connection_idle_ms"
 /** Maximum time that a channel may exist. Int valued, milliseconds.
  * INT_MAX means unlimited. */
@@ -166,6 +167,10 @@ typedef struct {
 /** Grace period after the channel reaches its max age. Int valued,
    milliseconds. INT_MAX means unlimited. */
 #define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms"
+/** Timeout after the last RPC finishes on the client channel at which the
+ * channel goes back into IDLE state. Int valued, milliseconds. INT_MAX means
+ * unlimited. The default value is 30 minutes and the min value is 1 second. */
+#define GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS "grpc.client_idle_timeout_ms"
 /** Enable/disable support for per-message compression. Defaults to 1, unless
     GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */
 #define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression"
@@ -321,6 +326,11 @@ typedef struct {
    balancer before using fallback backend addresses from the resolver.
    If 0, enter fallback mode immediately. Default value is 10000. */
 #define GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS "grpc.xds_fallback_timeout_ms"
+/* Time in milliseconds to wait before a locality is deleted after it's removed
+   from the received EDS update. If 0, delete the locality immediately. Default
+   value is 15 minutes. */
+#define GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS \
+  "grpc.xds_locality_retention_interval_ms"
 /** If non-zero, grpc server's cronet compression workaround will be enabled */
 #define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
   "grpc.workaround.cronet_compression"
index d7294d5..ca1d0ae 100644 (file)
  *  - some syscalls to be made directly
  */
 
+/*
+ * Defines GRPC_USE_CPP_STD_LIB to use standard C++ library instead of
+ * in-house library if possible. (e.g. std::map)
+ */
+#ifndef GRPC_USE_CPP_STD_LIB
+#define GRPC_USE_CPP_STD_LIB 1
+#endif
+
 /* Get windows.h included everywhere (we need it) */
 #if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
 #ifndef WIN32_LEAN_AND_MEAN
 #endif
 #endif /* GPR_NO_AUTODETECT_PLATFORM */
 
+#if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)
+/*
+ * For backward compatibility mode, reset _FORTIFY_SOURCE to prevent
+ * a library from having non-standard symbols such as __asprintf_chk.
+ * This helps non-glibc systems such as alpine using musl to find symbols.
+ */
+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE 0
+#endif
+#endif
+
 /*
  *  There are platforms for which TLS should not be used even though the
  * compiler makes it seem like it's supported (Android NDK < r12b for example).
@@ -451,6 +471,23 @@ typedef unsigned __int64 uint64_t;
 #include <stdint.h>
 #endif /* _MSC_VER */
 
+/* Type of cycle clock implementation */
+#ifdef GPR_LINUX
+/* Disable cycle clock by default.
+   TODO(soheil): enable when we support fallback for unstable cycle clocks.
+#if defined(__i386__)
+#define GPR_CYCLE_COUNTER_RDTSC_32 1
+#elif defined(__x86_64__) || defined(__amd64__)
+#define GPR_CYCLE_COUNTER_RDTSC_64 1
+#else
+#define GPR_CYCLE_COUNTER_FALLBACK 1
+#endif
+*/
+#define GPR_CYCLE_COUNTER_FALLBACK 1
+#else
+#define GPR_CYCLE_COUNTER_FALLBACK 1
+#endif /* GPR_LINUX */
+
 /* Cache line alignment */
 #ifndef GPR_CACHELINE_SIZE_LOG
 #if defined(__i386__) || defined(__x86_64__)
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backend_metric.cc b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backend_metric.cc
new file mode 100644 (file)
index 0000000..0d6aa2f
--- /dev/null
@@ -0,0 +1,78 @@
+//
+// Copyright 2019 gRPC authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/ext/filters/client_channel/backend_metric.h"
+
+#include "src/core/lib/gprpp/string_view.h"
+#include "udpa/data/orca/v1/orca_load_report.upb.h"
+
+namespace grpc_core {
+
+namespace {
+
+template <typename EntryType>
+Map<StringView, double, StringLess> ParseMap(
+    udpa_data_orca_v1_OrcaLoadReport* msg,
+    EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*),
+    upb_strview (*key_func)(const EntryType*),
+    double (*value_func)(const EntryType*), Arena* arena) {
+  Map<StringView, double, StringLess> result;
+  size_t size;
+  const auto* const* entries = entry_func(msg, &size);
+  for (size_t i = 0; i < size; ++i) {
+    upb_strview key_view = key_func(entries[i]);
+    char* key = static_cast<char*>(arena->Alloc(key_view.size + 1));
+    memcpy(key, key_view.data, key_view.size);
+    result[StringView(key, key_view.size)] = value_func(entries[i]);
+  }
+  return result;
+}
+
+}  // namespace
+
+const LoadBalancingPolicy::BackendMetricData* ParseBackendMetricData(
+    const grpc_slice& serialized_load_report, Arena* arena) {
+  upb::Arena upb_arena;
+  udpa_data_orca_v1_OrcaLoadReport* msg =
+      udpa_data_orca_v1_OrcaLoadReport_parse(
+          reinterpret_cast<const char*>(
+              GRPC_SLICE_START_PTR(serialized_load_report)),
+          GRPC_SLICE_LENGTH(serialized_load_report), upb_arena.ptr());
+  if (msg == nullptr) return nullptr;
+  LoadBalancingPolicy::BackendMetricData* backend_metric_data =
+      arena->New<LoadBalancingPolicy::BackendMetricData>();
+  backend_metric_data->cpu_utilization =
+      udpa_data_orca_v1_OrcaLoadReport_cpu_utilization(msg);
+  backend_metric_data->mem_utilization =
+      udpa_data_orca_v1_OrcaLoadReport_mem_utilization(msg);
+  backend_metric_data->requests_per_second =
+      udpa_data_orca_v1_OrcaLoadReport_rps(msg);
+  backend_metric_data->request_cost =
+      ParseMap<udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry>(
+          msg, udpa_data_orca_v1_OrcaLoadReport_mutable_request_cost,
+          udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_key,
+          udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_value, arena);
+  backend_metric_data->utilization =
+      ParseMap<udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry>(
+          msg, udpa_data_orca_v1_OrcaLoadReport_mutable_utilization,
+          udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_key,
+          udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_value, arena);
+  return backend_metric_data;
+}
+
+}  // namespace grpc_core
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backend_metric.h b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/backend_metric.h
new file mode 100644 (file)
index 0000000..d92b76c
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// Copyright 2019 gRPC authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKEND_METRIC_H
+#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKEND_METRIC_H
+
+#include <grpc/support/port_platform.h>
+
+#include <grpc/slice.h>
+
+#include "src/core/ext/filters/client_channel/lb_policy.h"
+#include "src/core/lib/gprpp/arena.h"
+
+namespace grpc_core {
+
+// Parses the serialized load report and allocates a BackendMetricData
+// object on the arena.
+const LoadBalancingPolicy::BackendMetricData* ParseBackendMetricData(
+    const grpc_slice& serialized_load_report, Arena* arena);
+
+}  // namespace grpc_core
+
+#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKEND_METRIC_H */
index 9e51a83..2e2d8d6 100644 (file)
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/global_config.h"
 #include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/iomgr.h"
 #include "src/core/lib/iomgr/pollset.h"
 #include "src/core/lib/iomgr/timer.h"
 #include "src/core/lib/surface/channel.h"
@@ -153,7 +155,7 @@ static void g_poller_init_locked() {
 
 void grpc_client_channel_start_backup_polling(
     grpc_pollset_set* interested_parties) {
-  if (g_poll_interval_ms == 0) {
+  if (g_poll_interval_ms == 0 || grpc_iomgr_run_in_background()) {
     return;
   }
   gpr_mu_lock(&g_poller_mu);
@@ -171,7 +173,7 @@ void grpc_client_channel_start_backup_polling(
 
 void grpc_client_channel_stop_backup_polling(
     grpc_pollset_set* interested_parties) {
-  if (g_poll_interval_ms == 0) {
+  if (g_poll_interval_ms == 0 || grpc_iomgr_run_in_background()) {
     return;
   }
   grpc_pollset_set_del_pollset(interested_parties, g_poller->pollset);
index 232183d..58170e6 100644 (file)
@@ -111,6 +111,12 @@ static void finished_completion(void* pw, grpc_cq_completion* ignored) {
 
 static void partly_done(state_watcher* w, bool due_to_completion,
                         grpc_error* error) {
+  bool end_op = false;
+  void* end_op_tag = nullptr;
+  grpc_error* end_op_error = nullptr;
+  grpc_completion_queue* end_op_cq = nullptr;
+  grpc_cq_completion* end_op_completion_storage = nullptr;
+
   if (due_to_completion) {
     grpc_timer_cancel(&w->alarm);
   } else {
@@ -152,8 +158,11 @@ static void partly_done(state_watcher* w, bool due_to_completion,
         w->error = error;
       }
       w->phase = CALLING_BACK_AND_FINISHED;
-      grpc_cq_end_op(w->cq, w->tag, w->error, finished_completion, w,
-                     &w->completion_storage);
+      end_op = true;
+      end_op_cq = w->cq;
+      end_op_tag = w->tag;
+      end_op_error = w->error;
+      end_op_completion_storage = &w->completion_storage;
       break;
     case CALLING_BACK_AND_FINISHED:
       GPR_UNREACHABLE_CODE(return );
@@ -161,6 +170,11 @@ static void partly_done(state_watcher* w, bool due_to_completion,
   }
   gpr_mu_unlock(&w->mu);
 
+  if (end_op) {
+    grpc_cq_end_op(end_op_cq, end_op_tag, end_op_error, finished_completion, w,
+                   end_op_completion_storage);
+  }
+
   GRPC_ERROR_UNREF(error);
 }
 
index 0b612e6..0a9b5ac 100644 (file)
@@ -31,6 +31,7 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 
+#include "src/core/ext/filters/client_channel/backend_metric.h"
 #include "src/core/ext/filters/client_channel/backup_poller.h"
 #include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
 #include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
@@ -129,7 +130,7 @@ class ChannelData {
     return disconnect_error_.Load(MemoryOrder::ACQUIRE);
   }
 
-  grpc_combiner* data_plane_combiner() const { return data_plane_combiner_; }
+  Mutex* data_plane_mu() const { return &data_plane_mu_; }
 
   LoadBalancingPolicy::SubchannelPicker* picker() const {
     return picker_.get();
@@ -147,6 +148,9 @@ class ChannelData {
     return service_config_;
   }
 
+  RefCountedPtr<ConnectedSubchannel> GetConnectedSubchannelInDataPlane(
+      SubchannelInterface* subchannel) const;
+
   grpc_connectivity_state CheckConnectivityState(bool try_to_connect);
   void AddExternalConnectivityWatcher(grpc_polling_entity pollent,
                                       grpc_connectivity_state* state,
@@ -161,9 +165,7 @@ class ChannelData {
   }
 
  private:
-  class ConnectivityStateAndPickerSetter;
-  class ServiceConfigSetter;
-  class GrpcSubchannel;
+  class SubchannelWrapper;
   class ClientChannelControlHelper;
 
   class ExternalConnectivityWatcher {
@@ -210,6 +212,18 @@ class ChannelData {
   ChannelData(grpc_channel_element_args* args, grpc_error** error);
   ~ChannelData();
 
+  void UpdateStateAndPickerLocked(
+      grpc_connectivity_state state, const char* reason,
+      UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker);
+
+  void UpdateServiceConfigLocked(
+      RefCountedPtr<ServerRetryThrottleData> retry_throttle_data,
+      RefCountedPtr<ServiceConfig> service_config);
+
+  void CreateResolvingLoadBalancingPolicyLocked();
+
+  void DestroyResolvingLoadBalancingPolicyLocked();
+
   static bool ProcessResolverResultLocked(
       void* arg, const Resolver::Result& result, const char** lb_policy_name,
       RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config,
@@ -235,14 +249,16 @@ class ChannelData {
   const size_t per_rpc_retry_buffer_size_;
   grpc_channel_stack* owning_stack_;
   ClientChannelFactory* client_channel_factory_;
-  UniquePtr<char> server_name_;
+  const grpc_channel_args* channel_args_;
   RefCountedPtr<ServiceConfig> default_service_config_;
+  UniquePtr<char> server_name_;
+  UniquePtr<char> target_uri_;
   channelz::ChannelNode* channelz_node_;
 
   //
-  // Fields used in the data plane.  Guarded by data_plane_combiner.
+  // Fields used in the data plane.  Guarded by data_plane_mu.
   //
-  grpc_combiner* data_plane_combiner_;
+  mutable Mutex data_plane_mu_;
   UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker_;
   QueuedPick* queued_picks_ = nullptr;  // Linked list of queued picks.
   // Data from service config.
@@ -262,10 +278,23 @@ class ChannelData {
   UniquePtr<char> health_check_service_name_;
   RefCountedPtr<ServiceConfig> saved_service_config_;
   bool received_first_resolver_result_ = false;
+  // The number of SubchannelWrapper instances referencing a given Subchannel.
   Map<Subchannel*, int> subchannel_refcount_map_;
+  // The set of SubchannelWrappers that currently exist.
+  // No need to hold a ref, since the map is updated in the control-plane
+  // combiner when the SubchannelWrappers are created and destroyed.
+  // TODO(roth): We really want to use a set here, not a map.  Since we don't
+  // currently have a set implementation, we use a map and ignore the value.
+  Map<SubchannelWrapper*, bool> subchannel_wrappers_;
+  // Pending ConnectedSubchannel updates for each SubchannelWrapper.
+  // Updates are queued here in the control plane combiner and then applied
+  // in the data plane mutex when the picker is updated.
+  Map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>,
+      RefCountedPtrLess<SubchannelWrapper>>
+      pending_subchannel_updates_;
 
   //
-  // Fields accessed from both data plane and control plane combiners.
+  // Fields accessed from both data plane mutex and control plane combiner.
   //
   Atomic<grpc_error*> disconnect_error_;
 
@@ -299,17 +328,87 @@ class CallData {
   void MaybeApplyServiceConfigToCallLocked(grpc_call_element* elem);
 
   // Invoked by channel for queued picks when the picker is updated.
-  static void StartPickLocked(void* arg, grpc_error* error);
+  static void PickSubchannel(void* arg, grpc_error* error);
+
+  // Helper function for performing a pick while holding the data plane
+  // mutex.  Returns true if the pick is complete, in which case the caller
+  // must invoke PickDone() or AsyncPickDone() with the returned error.
+  bool PickSubchannelLocked(grpc_call_element* elem, grpc_error** error);
+
+  // Schedules a callback to process the completed pick.  The callback
+  // will not run until after this method returns.
+  void AsyncPickDone(grpc_call_element* elem, grpc_error* error);
 
  private:
   class QueuedPickCanceller;
 
+  class Metadata : public LoadBalancingPolicy::MetadataInterface {
+   public:
+    Metadata(CallData* calld, grpc_metadata_batch* batch)
+        : calld_(calld), batch_(batch) {}
+
+    void Add(StringView key, StringView value) override {
+      grpc_linked_mdelem* linked_mdelem = static_cast<grpc_linked_mdelem*>(
+          calld_->arena_->Alloc(sizeof(grpc_linked_mdelem)));
+      linked_mdelem->md = grpc_mdelem_from_slices(
+          grpc_core::ExternallyManagedSlice(key.data(), key.size()),
+          grpc_core::ExternallyManagedSlice(value.data(), value.size()));
+      GPR_ASSERT(grpc_metadata_batch_link_tail(batch_, linked_mdelem) ==
+                 GRPC_ERROR_NONE);
+    }
+
+    Iterator Begin() const override {
+      static_assert(sizeof(grpc_linked_mdelem*) <= sizeof(Iterator),
+                    "iterator size too large");
+      return reinterpret_cast<Iterator>(batch_->list.head);
+    }
+    bool IsEnd(Iterator it) const override {
+      return reinterpret_cast<grpc_linked_mdelem*>(it) == nullptr;
+    }
+    void Next(Iterator* it) const override {
+      *it = reinterpret_cast<Iterator>(
+          reinterpret_cast<grpc_linked_mdelem*>(*it)->next);
+    }
+    StringView Key(Iterator it) const override {
+      return StringView(
+          GRPC_MDKEY(reinterpret_cast<grpc_linked_mdelem*>(it)->md));
+    }
+    StringView Value(Iterator it) const override {
+      return StringView(
+          GRPC_MDVALUE(reinterpret_cast<grpc_linked_mdelem*>(it)->md));
+    }
+
+    void Erase(Iterator* it) override {
+      grpc_linked_mdelem* linked_mdelem =
+          reinterpret_cast<grpc_linked_mdelem*>(*it);
+      *it = reinterpret_cast<Iterator>(linked_mdelem->next);
+      grpc_metadata_batch_remove(batch_, linked_mdelem);
+    }
+
+   private:
+    CallData* calld_;
+    grpc_metadata_batch* batch_;
+  };
+
   class LbCallState : public LoadBalancingPolicy::CallState {
    public:
     explicit LbCallState(CallData* calld) : calld_(calld) {}
 
     void* Alloc(size_t size) override { return calld_->arena_->Alloc(size); }
 
+    const LoadBalancingPolicy::BackendMetricData* GetBackendMetricData()
+        override {
+      if (calld_->backend_metric_data_ == nullptr) {
+        grpc_linked_mdelem* md = calld_->recv_trailing_metadata_->idx.named
+                                     .x_endpoint_load_metrics_bin;
+        if (md != nullptr) {
+          calld_->backend_metric_data_ =
+              ParseBackendMetricData(GRPC_MDVALUE(md->md), calld_->arena_);
+        }
+      }
+      return calld_->backend_metric_data_;
+    }
+
    private:
     CallData* calld_;
   };
@@ -621,7 +720,7 @@ class CallData {
   grpc_deadline_state deadline_state_;
 
   grpc_slice path_;  // Request path.
-  gpr_timespec call_start_time_;
+  gpr_cycle_counter call_start_time_;
   grpc_millis deadline_;
   Arena* arena_;
   grpc_call_stack* owning_call_;
@@ -642,9 +741,11 @@ class CallData {
   bool service_config_applied_ = false;
   QueuedPickCanceller* pick_canceller_ = nullptr;
   LbCallState lb_call_state_;
+  const LoadBalancingPolicy::BackendMetricData* backend_metric_data_ = nullptr;
   RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
   void (*lb_recv_trailing_metadata_ready_)(
-      void* user_data, grpc_metadata_batch* recv_trailing_metadata,
+      void* user_data, grpc_error* error,
+      LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata,
       LoadBalancingPolicy::CallState* call_state) = nullptr;
   void* lb_recv_trailing_metadata_ready_user_data_ = nullptr;
   grpc_closure pick_closure_;
@@ -707,127 +808,301 @@ class CallData {
 };
 
 //
-// ChannelData::ConnectivityStateAndPickerSetter
+// ChannelData::SubchannelWrapper
 //
 
-// A fire-and-forget class that sets the channel's connectivity state
-// and then hops into the data plane combiner to update the picker.
-// Must be instantiated while holding the control plane combiner.
-// Deletes itself when done.
-class ChannelData::ConnectivityStateAndPickerSetter {
+// This class is a wrapper for Subchannel that hides details of the
+// channel's implementation (such as the health check service name and
+// connected subchannel) from the LB policy API.
+//
+// Note that no synchronization is needed here, because even if the
+// underlying subchannel is shared between channels, this wrapper will only
+// be used within one channel, so it will always be synchronized by the
+// control plane combiner.
+class ChannelData::SubchannelWrapper : public SubchannelInterface {
  public:
-  ConnectivityStateAndPickerSetter(
-      ChannelData* chand, grpc_connectivity_state state, const char* reason,
-      UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker)
-      : chand_(chand), picker_(std::move(picker)) {
-    // Update connectivity state here, while holding control plane combiner.
-    grpc_connectivity_state_set(&chand->state_tracker_, state, reason);
-    if (chand->channelz_node_ != nullptr) {
-      chand->channelz_node_->SetConnectivityState(state);
-      chand->channelz_node_->AddTraceEvent(
-          channelz::ChannelTrace::Severity::Info,
-          grpc_slice_from_static_string(
-              GetChannelConnectivityStateChangeString(state)));
-    }
-    // Bounce into the data plane combiner to reset the picker.
-    GRPC_CHANNEL_STACK_REF(chand->owning_stack_,
-                           "ConnectivityStateAndPickerSetter");
-    GRPC_CLOSURE_INIT(&closure_, SetPicker, this,
-                      grpc_combiner_scheduler(chand->data_plane_combiner_));
-    GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE);
+  SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
+                    UniquePtr<char> health_check_service_name)
+      : SubchannelInterface(&grpc_client_channel_routing_trace),
+        chand_(chand),
+        subchannel_(subchannel),
+        health_check_service_name_(std::move(health_check_service_name)) {
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+      gpr_log(GPR_INFO,
+              "chand=%p: creating subchannel wrapper %p for subchannel %p",
+              chand, this, subchannel_);
+    }
+    GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper");
+    auto* subchannel_node = subchannel_->channelz_node();
+    if (subchannel_node != nullptr) {
+      auto it = chand_->subchannel_refcount_map_.find(subchannel_);
+      if (it == chand_->subchannel_refcount_map_.end()) {
+        chand_->channelz_node_->AddChildSubchannel(subchannel_node->uuid());
+        it = chand_->subchannel_refcount_map_.emplace(subchannel_, 0).first;
+      }
+      ++it->second;
+    }
+    chand_->subchannel_wrappers_[this] = true;
   }
 
- private:
-  static const char* GetChannelConnectivityStateChangeString(
-      grpc_connectivity_state state) {
-    switch (state) {
-      case GRPC_CHANNEL_IDLE:
-        return "Channel state change to IDLE";
-      case GRPC_CHANNEL_CONNECTING:
-        return "Channel state change to CONNECTING";
-      case GRPC_CHANNEL_READY:
-        return "Channel state change to READY";
-      case GRPC_CHANNEL_TRANSIENT_FAILURE:
-        return "Channel state change to TRANSIENT_FAILURE";
-      case GRPC_CHANNEL_SHUTDOWN:
-        return "Channel state change to SHUTDOWN";
-    }
-    GPR_UNREACHABLE_CODE(return "UNKNOWN");
-  }
-
-  static void SetPicker(void* arg, grpc_error* ignored) {
-    auto* self = static_cast<ConnectivityStateAndPickerSetter*>(arg);
-    // Update picker.
-    self->chand_->picker_ = std::move(self->picker_);
-    // Re-process queued picks.
-    for (QueuedPick* pick = self->chand_->queued_picks_; pick != nullptr;
-         pick = pick->next) {
-      CallData::StartPickLocked(pick->elem, GRPC_ERROR_NONE);
+  ~SubchannelWrapper() {
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+      gpr_log(GPR_INFO,
+              "chand=%p: destroying subchannel wrapper %p for subchannel %p",
+              chand_, this, subchannel_);
     }
-    // Clean up.
-    GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
-                             "ConnectivityStateAndPickerSetter");
-    Delete(self);
+    chand_->subchannel_wrappers_.erase(this);
+    auto* subchannel_node = subchannel_->channelz_node();
+    if (subchannel_node != nullptr) {
+      auto it = chand_->subchannel_refcount_map_.find(subchannel_);
+      GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
+      --it->second;
+      if (it->second == 0) {
+        chand_->channelz_node_->RemoveChildSubchannel(subchannel_node->uuid());
+        chand_->subchannel_refcount_map_.erase(it);
+      }
+    }
+    GRPC_SUBCHANNEL_UNREF(subchannel_, "unref from LB");
+    GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "SubchannelWrapper");
   }
 
-  ChannelData* chand_;
-  UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker_;
-  grpc_closure closure_;
-};
+  grpc_connectivity_state CheckConnectivityState() override {
+    RefCountedPtr<ConnectedSubchannel> connected_subchannel;
+    grpc_connectivity_state connectivity_state =
+        subchannel_->CheckConnectivityState(health_check_service_name_.get(),
+                                            &connected_subchannel);
+    MaybeUpdateConnectedSubchannel(std::move(connected_subchannel));
+    return connectivity_state;
+  }
 
-//
-// ChannelData::ServiceConfigSetter
-//
+  void WatchConnectivityState(
+      grpc_connectivity_state initial_state,
+      UniquePtr<ConnectivityStateWatcherInterface> watcher) override {
+    auto& watcher_wrapper = watcher_map_[watcher.get()];
+    GPR_ASSERT(watcher_wrapper == nullptr);
+    watcher_wrapper = New<WatcherWrapper>(std::move(watcher),
+                                          Ref(DEBUG_LOCATION, "WatcherWrapper"),
+                                          initial_state);
+    subchannel_->WatchConnectivityState(
+        initial_state,
+        UniquePtr<char>(gpr_strdup(health_check_service_name_.get())),
+        OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
+            watcher_wrapper));
+  }
 
-// A fire-and-forget class that sets the channel's service config data
-// in the data plane combiner.  Deletes itself when done.
-class ChannelData::ServiceConfigSetter {
- public:
-  ServiceConfigSetter(
-      ChannelData* chand,
-      Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
-          retry_throttle_data,
-      RefCountedPtr<ServiceConfig> service_config)
-      : chand_(chand),
-        retry_throttle_data_(retry_throttle_data),
-        service_config_(std::move(service_config)) {
-    GRPC_CHANNEL_STACK_REF(chand->owning_stack_, "ServiceConfigSetter");
-    GRPC_CLOSURE_INIT(&closure_, SetServiceConfigData, this,
-                      grpc_combiner_scheduler(chand->data_plane_combiner_));
-    GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE);
+  void CancelConnectivityStateWatch(
+      ConnectivityStateWatcherInterface* watcher) override {
+    auto it = watcher_map_.find(watcher);
+    GPR_ASSERT(it != watcher_map_.end());
+    subchannel_->CancelConnectivityStateWatch(health_check_service_name_.get(),
+                                              it->second);
+    watcher_map_.erase(it);
+  }
+
+  void AttemptToConnect() override { subchannel_->AttemptToConnect(); }
+
+  void ResetBackoff() override { subchannel_->ResetBackoff(); }
+
+  const grpc_channel_args* channel_args() override {
+    return subchannel_->channel_args();
+  }
+
+  void UpdateHealthCheckServiceName(UniquePtr<char> health_check_service_name) {
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+      gpr_log(GPR_INFO,
+              "chand=%p: subchannel wrapper %p: updating health check service "
+              "name from \"%s\" to \"%s\"",
+              chand_, this, health_check_service_name_.get(),
+              health_check_service_name.get());
+    }
+    for (auto& p : watcher_map_) {
+      WatcherWrapper*& watcher_wrapper = p.second;
+      // Cancel the current watcher and create a new one using the new
+      // health check service name.
+      // TODO(roth): If there is not already an existing health watch
+      // call for the new name, then the watcher will initially report
+      // state CONNECTING.  If the LB policy is currently reporting
+      // state READY, this may cause it to switch to CONNECTING before
+      // switching back to READY.  This could cause a small delay for
+      // RPCs being started on the channel.  If/when this becomes a
+      // problem, we may be able to handle it by waiting for the new
+      // watcher to report READY before we use it to replace the old one.
+      WatcherWrapper* replacement = watcher_wrapper->MakeReplacement();
+      subchannel_->CancelConnectivityStateWatch(
+          health_check_service_name_.get(), watcher_wrapper);
+      watcher_wrapper = replacement;
+      subchannel_->WatchConnectivityState(
+          replacement->last_seen_state(),
+          UniquePtr<char>(gpr_strdup(health_check_service_name.get())),
+          OrphanablePtr<Subchannel::ConnectivityStateWatcherInterface>(
+              replacement));
+    }
+    // Save the new health check service name.
+    health_check_service_name_ = std::move(health_check_service_name);
+  }
+
+  // Caller must be holding the control-plane combiner.
+  ConnectedSubchannel* connected_subchannel() const {
+    return connected_subchannel_.get();
+  }
+
+  // Caller must be holding the data-plane mutex.
+  ConnectedSubchannel* connected_subchannel_in_data_plane() const {
+    return connected_subchannel_in_data_plane_.get();
+  }
+  void set_connected_subchannel_in_data_plane(
+      RefCountedPtr<ConnectedSubchannel> connected_subchannel) {
+    connected_subchannel_in_data_plane_ = std::move(connected_subchannel);
   }
 
  private:
-  static void SetServiceConfigData(void* arg, grpc_error* ignored) {
-    ServiceConfigSetter* self = static_cast<ServiceConfigSetter*>(arg);
-    ChannelData* chand = self->chand_;
-    // Update channel state.
-    chand->received_service_config_data_ = true;
-    if (self->retry_throttle_data_.has_value()) {
-      chand->retry_throttle_data_ =
-          internal::ServerRetryThrottleMap::GetDataForServer(
-              chand->server_name_.get(),
-              self->retry_throttle_data_.value().max_milli_tokens,
-              self->retry_throttle_data_.value().milli_token_ratio);
-    }
-    chand->service_config_ = std::move(self->service_config_);
-    // Apply service config to queued picks.
-    for (QueuedPick* pick = chand->queued_picks_; pick != nullptr;
-         pick = pick->next) {
-      CallData* calld = static_cast<CallData*>(pick->elem->call_data);
-      calld->MaybeApplyServiceConfigToCallLocked(pick->elem);
+  // Subchannel and SubchannelInterface have different interfaces for
+  // their respective ConnectivityStateWatcherInterface classes.
+  // The one in Subchannel updates the ConnectedSubchannel along with
+  // the state, whereas the one in SubchannelInterface does not expose
+  // the ConnectedSubchannel.
+  //
+  // This wrapper provides a bridge between the two.  It implements
+  // Subchannel::ConnectivityStateWatcherInterface and wraps
+  // the instance of SubchannelInterface::ConnectivityStateWatcherInterface
+  // that was passed in by the LB policy.  We pass an instance of this
+  // class to the underlying Subchannel, and when we get updates from
+  // the subchannel, we pass those on to the wrapped watcher to return
+  // the update to the LB policy.  This allows us to set the connected
+  // subchannel before passing the result back to the LB policy.
+  class WatcherWrapper : public Subchannel::ConnectivityStateWatcherInterface {
+   public:
+    WatcherWrapper(
+        UniquePtr<SubchannelInterface::ConnectivityStateWatcherInterface>
+            watcher,
+        RefCountedPtr<SubchannelWrapper> parent,
+        grpc_connectivity_state initial_state)
+        : watcher_(std::move(watcher)),
+          parent_(std::move(parent)),
+          last_seen_state_(initial_state) {}
+
+    ~WatcherWrapper() { parent_.reset(DEBUG_LOCATION, "WatcherWrapper"); }
+
+    void Orphan() override { Unref(); }
+
+    void OnConnectivityStateChange(
+        grpc_connectivity_state new_state,
+        RefCountedPtr<ConnectedSubchannel> connected_subchannel) override {
+      if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+        gpr_log(GPR_INFO,
+                "chand=%p: connectivity change for subchannel wrapper %p "
+                "subchannel %p (connected_subchannel=%p state=%s); "
+                "hopping into combiner",
+                parent_->chand_, parent_.get(), parent_->subchannel_,
+                connected_subchannel.get(),
+                grpc_connectivity_state_name(new_state));
+      }
+      // Will delete itself.
+      New<Updater>(Ref(), new_state, std::move(connected_subchannel));
+    }
+
+    grpc_pollset_set* interested_parties() override {
+      SubchannelInterface::ConnectivityStateWatcherInterface* watcher =
+          watcher_.get();
+      if (watcher_ == nullptr) watcher = replacement_->watcher_.get();
+      return watcher->interested_parties();
+    }
+
+    WatcherWrapper* MakeReplacement() {
+      auto* replacement =
+          New<WatcherWrapper>(std::move(watcher_), parent_, last_seen_state_);
+      replacement_ = replacement;
+      return replacement;
+    }
+
+    grpc_connectivity_state last_seen_state() const { return last_seen_state_; }
+
+   private:
+    class Updater {
+     public:
+      Updater(RefCountedPtr<WatcherWrapper> parent,
+              grpc_connectivity_state new_state,
+              RefCountedPtr<ConnectedSubchannel> connected_subchannel)
+          : parent_(std::move(parent)),
+            state_(new_state),
+            connected_subchannel_(std::move(connected_subchannel)) {
+        GRPC_CLOSURE_INIT(
+            &closure_, ApplyUpdateInControlPlaneCombiner, this,
+            grpc_combiner_scheduler(parent_->parent_->chand_->combiner_));
+        GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE);
+      }
+
+     private:
+      static void ApplyUpdateInControlPlaneCombiner(void* arg,
+                                                    grpc_error* error) {
+        Updater* self = static_cast<Updater*>(arg);
+        if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+          gpr_log(GPR_INFO,
+                  "chand=%p: processing connectivity change in combiner "
+                  "for subchannel wrapper %p subchannel %p "
+                  "(connected_subchannel=%p state=%s): watcher=%p",
+                  self->parent_->parent_->chand_, self->parent_->parent_.get(),
+                  self->parent_->parent_->subchannel_,
+                  self->connected_subchannel_.get(),
+                  grpc_connectivity_state_name(self->state_),
+                  self->parent_->watcher_.get());
+        }
+        // Ignore update if the parent WatcherWrapper has been replaced
+        // since this callback was scheduled.
+        if (self->parent_->watcher_ == nullptr) return;
+        self->parent_->last_seen_state_ = self->state_;
+        self->parent_->parent_->MaybeUpdateConnectedSubchannel(
+            std::move(self->connected_subchannel_));
+        self->parent_->watcher_->OnConnectivityStateChange(self->state_);
+        Delete(self);
+      }
+
+      RefCountedPtr<WatcherWrapper> parent_;
+      grpc_connectivity_state state_;
+      RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
+      grpc_closure closure_;
+    };
+
+    UniquePtr<SubchannelInterface::ConnectivityStateWatcherInterface> watcher_;
+    RefCountedPtr<SubchannelWrapper> parent_;
+    grpc_connectivity_state last_seen_state_;
+    WatcherWrapper* replacement_ = nullptr;
+  };
+
+  void MaybeUpdateConnectedSubchannel(
+      RefCountedPtr<ConnectedSubchannel> connected_subchannel) {
+    // Update the connected subchannel only if the channel is not shutting
+    // down.  This is because once the channel is shutting down, we
+    // ignore picker updates from the LB policy, which means that
+    // UpdateStateAndPickerLocked() will never process the entries
+    // in chand_->pending_subchannel_updates_.  So we don't want to add
+    // entries there that will never be processed, since that would
+    // leave dangling refs to the channel and prevent its destruction.
+    grpc_error* disconnect_error = chand_->disconnect_error();
+    if (disconnect_error != GRPC_ERROR_NONE) return;
+    // Not shutting down, so do the update.
+    if (connected_subchannel_ != connected_subchannel) {
+      connected_subchannel_ = std::move(connected_subchannel);
+      // Record the new connected subchannel so that it can be updated
+      // in the data plane mutex the next time the picker is updated.
+      chand_->pending_subchannel_updates_[Ref(
+          DEBUG_LOCATION, "ConnectedSubchannelUpdate")] = connected_subchannel_;
     }
-    // Clean up.
-    GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_,
-                             "ServiceConfigSetter");
-    Delete(self);
   }
 
   ChannelData* chand_;
-  Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
-      retry_throttle_data_;
-  RefCountedPtr<ServiceConfig> service_config_;
-  grpc_closure closure_;
+  Subchannel* subchannel_;
+  UniquePtr<char> health_check_service_name_;
+  // Maps from the address of the watcher passed to us by the LB policy
+  // to the address of the WrapperWatcher that we passed to the underlying
+  // subchannel.  This is needed so that when the LB policy calls
+  // CancelConnectivityStateWatch() with its watcher, we know the
+  // corresponding WrapperWatcher to cancel on the underlying subchannel.
+  Map<ConnectivityStateWatcherInterface*, WatcherWrapper*> watcher_map_;
+  // To be accessed only in the control plane combiner.
+  RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
+  // To be accessed only in the data plane mutex.
+  RefCountedPtr<ConnectedSubchannel> connected_subchannel_in_data_plane_;
 };
 
 //
@@ -947,89 +1222,6 @@ void ChannelData::ExternalConnectivityWatcher::WatchConnectivityStateLocked(
 }
 
 //
-// ChannelData::GrpcSubchannel
-//
-
-// This class is a wrapper for Subchannel that hides details of the
-// channel's implementation (such as the health check service name) from
-// the LB policy API.
-//
-// Note that no synchronization is needed here, because even if the
-// underlying subchannel is shared between channels, this wrapper will only
-// be used within one channel, so it will always be synchronized by the
-// control plane combiner.
-class ChannelData::GrpcSubchannel : public SubchannelInterface {
- public:
-  GrpcSubchannel(ChannelData* chand, Subchannel* subchannel,
-                 UniquePtr<char> health_check_service_name)
-      : chand_(chand),
-        subchannel_(subchannel),
-        health_check_service_name_(std::move(health_check_service_name)) {
-    GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "GrpcSubchannel");
-    auto* subchannel_node = subchannel_->channelz_node();
-    if (subchannel_node != nullptr) {
-      intptr_t subchannel_uuid = subchannel_node->uuid();
-      auto it = chand_->subchannel_refcount_map_.find(subchannel_);
-      if (it == chand_->subchannel_refcount_map_.end()) {
-        chand_->channelz_node_->AddChildSubchannel(subchannel_uuid);
-        it = chand_->subchannel_refcount_map_.emplace(subchannel_, 0).first;
-      }
-      ++it->second;
-    }
-  }
-
-  ~GrpcSubchannel() {
-    auto* subchannel_node = subchannel_->channelz_node();
-    if (subchannel_node != nullptr) {
-      intptr_t subchannel_uuid = subchannel_node->uuid();
-      auto it = chand_->subchannel_refcount_map_.find(subchannel_);
-      GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
-      --it->second;
-      if (it->second == 0) {
-        chand_->channelz_node_->RemoveChildSubchannel(subchannel_uuid);
-        chand_->subchannel_refcount_map_.erase(it);
-      }
-    }
-    GRPC_SUBCHANNEL_UNREF(subchannel_, "unref from LB");
-    GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "GrpcSubchannel");
-  }
-
-  grpc_connectivity_state CheckConnectivityState(
-      RefCountedPtr<ConnectedSubchannelInterface>* connected_subchannel)
-      override {
-    RefCountedPtr<ConnectedSubchannel> tmp;
-    auto retval = subchannel_->CheckConnectivityState(
-        health_check_service_name_.get(), &tmp);
-    *connected_subchannel = std::move(tmp);
-    return retval;
-  }
-
-  void WatchConnectivityState(
-      grpc_connectivity_state initial_state,
-      UniquePtr<ConnectivityStateWatcher> watcher) override {
-    subchannel_->WatchConnectivityState(
-        initial_state,
-        UniquePtr<char>(gpr_strdup(health_check_service_name_.get())),
-        std::move(watcher));
-  }
-
-  void CancelConnectivityStateWatch(
-      ConnectivityStateWatcher* watcher) override {
-    subchannel_->CancelConnectivityStateWatch(health_check_service_name_.get(),
-                                              watcher);
-  }
-
-  void AttemptToConnect() override { subchannel_->AttemptToConnect(); }
-
-  void ResetBackoff() override { subchannel_->ResetBackoff(); }
-
- private:
-  ChannelData* chand_;
-  Subchannel* subchannel_;
-  UniquePtr<char> health_check_service_name_;
-};
-
-//
 // ChannelData::ClientChannelControlHelper
 //
 
@@ -1066,20 +1258,14 @@ class ChannelData::ClientChannelControlHelper
         chand_->client_channel_factory_->CreateSubchannel(new_args);
     grpc_channel_args_destroy(new_args);
     if (subchannel == nullptr) return nullptr;
-    return MakeRefCounted<GrpcSubchannel>(chand_, subchannel,
-                                          std::move(health_check_service_name));
-  }
-
-  grpc_channel* CreateChannel(const char* target,
-                              const grpc_channel_args& args) override {
-    return chand_->client_channel_factory_->CreateChannel(target, &args);
+    return MakeRefCounted<SubchannelWrapper>(
+        chand_, subchannel, std::move(health_check_service_name));
   }
 
   void UpdateState(
       grpc_connectivity_state state,
       UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker) override {
-    grpc_error* disconnect_error =
-        chand_->disconnect_error_.Load(MemoryOrder::ACQUIRE);
+    grpc_error* disconnect_error = chand_->disconnect_error();
     if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
       const char* extra = disconnect_error == GRPC_ERROR_NONE
                               ? ""
@@ -1089,20 +1275,18 @@ class ChannelData::ClientChannelControlHelper
     }
     // Do update only if not shutting down.
     if (disconnect_error == GRPC_ERROR_NONE) {
-      // Will delete itself.
-      New<ConnectivityStateAndPickerSetter>(chand_, state, "helper",
-                                            std::move(picker));
+      chand_->UpdateStateAndPickerLocked(state, "helper", std::move(picker));
     }
   }
 
   // No-op -- we should never get this from ResolvingLoadBalancingPolicy.
   void RequestReresolution() override {}
 
-  void AddTraceEvent(TraceSeverity severity, const char* message) override {
+  void AddTraceEvent(TraceSeverity severity, StringView message) override {
     if (chand_->channelz_node_ != nullptr) {
       chand_->channelz_node_->AddTraceEvent(
           ConvertSeverityEnum(severity),
-          grpc_slice_from_copied_string(message));
+          grpc_slice_from_copied_buffer(message.data(), message.size()));
     }
   }
 
@@ -1175,7 +1359,6 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
       client_channel_factory_(
           ClientChannelFactory::GetFromChannelArgs(args->channel_args)),
       channelz_node_(GetChannelzNode(args->channel_args)),
-      data_plane_combiner_(grpc_combiner_create()),
       combiner_(grpc_combiner_create()),
       interested_parties_(grpc_pollset_set_create()),
       subchannel_pool_(GetSubchannelPool(args->channel_args)),
@@ -1226,59 +1409,156 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
   grpc_channel_args* new_args = nullptr;
   grpc_proxy_mappers_map_name(server_uri, args->channel_args, &proxy_name,
                               &new_args);
-  UniquePtr<char> target_uri(proxy_name != nullptr ? proxy_name
-                                                   : gpr_strdup(server_uri));
+  target_uri_.reset(proxy_name != nullptr ? proxy_name
+                                          : gpr_strdup(server_uri));
+  channel_args_ = new_args != nullptr
+                      ? new_args
+                      : grpc_channel_args_copy(args->channel_args);
+  if (!ResolverRegistry::IsValidTarget(target_uri_.get())) {
+    *error =
+        GRPC_ERROR_CREATE_FROM_STATIC_STRING("the target uri is not valid.");
+    return;
+  }
+  *error = GRPC_ERROR_NONE;
+}
+
+ChannelData::~ChannelData() {
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+    gpr_log(GPR_INFO, "chand=%p: destroying channel", this);
+  }
+  DestroyResolvingLoadBalancingPolicyLocked();
+  grpc_channel_args_destroy(channel_args_);
+  // Stop backup polling.
+  grpc_client_channel_stop_backup_polling(interested_parties_);
+  grpc_pollset_set_destroy(interested_parties_);
+  GRPC_COMBINER_UNREF(combiner_, "client_channel");
+  GRPC_ERROR_UNREF(disconnect_error_.Load(MemoryOrder::RELAXED));
+  grpc_connectivity_state_destroy(&state_tracker_);
+  gpr_mu_destroy(&info_mu_);
+}
+
+void ChannelData::UpdateStateAndPickerLocked(
+    grpc_connectivity_state state, const char* reason,
+    UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker) {
+  // Clean the control plane when entering IDLE.
+  if (picker_ == nullptr) {
+    health_check_service_name_.reset();
+    saved_service_config_.reset();
+    received_first_resolver_result_ = false;
+  }
+  // Update connectivity state.
+  grpc_connectivity_state_set(&state_tracker_, state, reason);
+  if (channelz_node_ != nullptr) {
+    channelz_node_->SetConnectivityState(state);
+    channelz_node_->AddTraceEvent(
+        channelz::ChannelTrace::Severity::Info,
+        grpc_slice_from_static_string(
+            channelz::ChannelNode::GetChannelConnectivityStateChangeString(
+                state)));
+  }
+  // Grab data plane lock to do subchannel updates and update the picker.
+  //
+  // Note that we want to minimize the work done while holding the data
+  // plane lock, to keep the critical section small.  So, for all of the
+  // objects that we might wind up unreffing here, we actually hold onto
+  // the refs until after we release the lock, and then unref them at
+  // that point.  This includes the following:
+  // - refs to subchannel wrappers in the keys of pending_subchannel_updates_
+  // - ref stored in retry_throttle_data_
+  // - ref stored in service_config_
+  // - ownership of the existing picker in picker_
+  RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_to_unref;
+  RefCountedPtr<ServiceConfig> service_config_to_unref;
+  {
+    MutexLock lock(&data_plane_mu_);
+    // Handle subchannel updates.
+    for (auto& p : pending_subchannel_updates_) {
+      if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+        gpr_log(GPR_INFO,
+                "chand=%p: updating subchannel wrapper %p data plane "
+                "connected_subchannel to %p",
+                this, p.first.get(), p.second.get());
+      }
+      // Note: We do not remove the entry from pending_subchannel_updates_
+      // here, since this would unref the subchannel wrapper; instead,
+      // we wait until we've released the lock to clear the map.
+      p.first->set_connected_subchannel_in_data_plane(std::move(p.second));
+    }
+    // Swap out the picker.
+    // Note: Original value will be destroyed after the lock is released.
+    picker_.swap(picker);
+    // Clean the data plane if the updated picker is nullptr.
+    if (picker_ == nullptr) {
+      received_service_config_data_ = false;
+      // Note: We save the objects to unref until after the lock is released.
+      retry_throttle_data_to_unref = std::move(retry_throttle_data_);
+      service_config_to_unref = std::move(service_config_);
+    }
+    // Re-process queued picks.
+    for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) {
+      grpc_call_element* elem = pick->elem;
+      CallData* calld = static_cast<CallData*>(elem->call_data);
+      grpc_error* error = GRPC_ERROR_NONE;
+      if (calld->PickSubchannelLocked(elem, &error)) {
+        calld->AsyncPickDone(elem, error);
+      }
+    }
+  }
+  // Clear the pending update map after releasing the lock, to keep the
+  // critical section small.
+  pending_subchannel_updates_.clear();
+}
+
+void ChannelData::UpdateServiceConfigLocked(
+    RefCountedPtr<ServerRetryThrottleData> retry_throttle_data,
+    RefCountedPtr<ServiceConfig> service_config) {
+  // Grab data plane lock to update service config.
+  //
+  // We defer unreffing the old values (and deallocating memory) until
+  // after releasing the lock to keep the critical section small.
+  {
+    MutexLock lock(&data_plane_mu_);
+    // Update service config.
+    received_service_config_data_ = true;
+    // Old values will be unreffed after lock is released.
+    retry_throttle_data_.swap(retry_throttle_data);
+    service_config_.swap(service_config);
+    // Apply service config to queued picks.
+    for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) {
+      CallData* calld = static_cast<CallData*>(pick->elem->call_data);
+      calld->MaybeApplyServiceConfigToCallLocked(pick->elem);
+    }
+  }
+  // Old values will be unreffed after lock is released when they go out
+  // of scope.
+}
+
+void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
   // Instantiate resolving LB policy.
   LoadBalancingPolicy::Args lb_args;
   lb_args.combiner = combiner_;
   lb_args.channel_control_helper =
       UniquePtr<LoadBalancingPolicy::ChannelControlHelper>(
           New<ClientChannelControlHelper>(this));
-  lb_args.args = new_args != nullptr ? new_args : args->channel_args;
+  lb_args.args = channel_args_;
+  UniquePtr<char> target_uri(gpr_strdup(target_uri_.get()));
   resolving_lb_policy_.reset(New<ResolvingLoadBalancingPolicy>(
       std::move(lb_args), &grpc_client_channel_routing_trace,
-      std::move(target_uri), ProcessResolverResultLocked, this, error));
-  grpc_channel_args_destroy(new_args);
-  if (*error != GRPC_ERROR_NONE) {
-    // Orphan the resolving LB policy and flush the exec_ctx to ensure
-    // that it finishes shutting down.  This ensures that if we are
-    // failing, we destroy the ClientChannelControlHelper (and thus
-    // unref the channel stack) before we return.
-    // TODO(roth): This is not a complete solution, because it only
-    // catches the case where channel stack initialization fails in this
-    // particular filter.  If there is a failure in a different filter, we
-    // will leave a dangling ref here, which can cause a crash.  Fortunately,
-    // in practice, there are no other filters that can cause failures in
-    // channel stack initialization, so this works for now.
-    resolving_lb_policy_.reset();
-    ExecCtx::Get()->Flush();
-  } else {
-    grpc_pollset_set_add_pollset_set(resolving_lb_policy_->interested_parties(),
-                                     interested_parties_);
-    if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
-      gpr_log(GPR_INFO, "chand=%p: created resolving_lb_policy=%p", this,
-              resolving_lb_policy_.get());
-    }
+      std::move(target_uri), ProcessResolverResultLocked, this));
+  grpc_pollset_set_add_pollset_set(resolving_lb_policy_->interested_parties(),
+                                   interested_parties_);
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
+    gpr_log(GPR_INFO, "chand=%p: created resolving_lb_policy=%p", this,
+            resolving_lb_policy_.get());
   }
 }
 
-ChannelData::~ChannelData() {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
-    gpr_log(GPR_INFO, "chand=%p: destroying channel", this);
-  }
+void ChannelData::DestroyResolvingLoadBalancingPolicyLocked() {
   if (resolving_lb_policy_ != nullptr) {
     grpc_pollset_set_del_pollset_set(resolving_lb_policy_->interested_parties(),
                                      interested_parties_);
     resolving_lb_policy_.reset();
   }
-  // Stop backup polling.
-  grpc_client_channel_stop_backup_polling(interested_parties_);
-  grpc_pollset_set_destroy(interested_parties_);
-  GRPC_COMBINER_UNREF(data_plane_combiner_, "client_channel");
-  GRPC_COMBINER_UNREF(combiner_, "client_channel");
-  GRPC_ERROR_UNREF(disconnect_error_.Load(MemoryOrder::RELAXED));
-  grpc_connectivity_state_destroy(&state_tracker_);
-  gpr_mu_destroy(&info_mu_);
 }
 
 void ChannelData::ProcessLbPolicy(
@@ -1411,6 +1691,11 @@ bool ChannelData::ProcessResolverResultLocked(
     } else {
       chand->health_check_service_name_.reset();
     }
+    // Update health check service name used by existing subchannel wrappers.
+    for (const auto& p : chand->subchannel_wrappers_) {
+      p.first->UpdateHealthCheckServiceName(
+          UniquePtr<char>(gpr_strdup(chand->health_check_service_name_.get())));
+    }
     // Save service config.
     chand->saved_service_config_ = std::move(service_config);
   }
@@ -1419,15 +1704,20 @@ bool ChannelData::ProcessResolverResultLocked(
   // if we feel it is unnecessary.
   if (service_config_changed || !chand->received_first_resolver_result_) {
     chand->received_first_resolver_result_ = true;
-    Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
-        retry_throttle_data;
+    RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
     if (parsed_service_config != nullptr) {
-      retry_throttle_data = parsed_service_config->retry_throttling();
+      Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
+          retry_throttle_config = parsed_service_config->retry_throttling();
+      if (retry_throttle_config.has_value()) {
+        retry_throttle_data =
+            internal::ServerRetryThrottleMap::GetDataForServer(
+                chand->server_name_.get(),
+                retry_throttle_config.value().max_milli_tokens,
+                retry_throttle_config.value().milli_token_ratio);
+      }
     }
-    // Create service config setter to update channel state in the data
-    // plane combiner.  Destroys itself when done.
-    New<ServiceConfigSetter>(chand, retry_throttle_data,
-                             chand->saved_service_config_);
+    chand->UpdateServiceConfigLocked(std::move(retry_throttle_data),
+                                     chand->saved_service_config_);
   }
   UniquePtr<char> processed_lb_policy_name;
   chand->ProcessLbPolicy(result, parsed_service_config,
@@ -1451,9 +1741,13 @@ grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) {
   }
   LoadBalancingPolicy::PickResult result =
       picker_->Pick(LoadBalancingPolicy::PickArgs());
-  if (result.connected_subchannel != nullptr) {
-    ConnectedSubchannel* connected_subchannel =
-        static_cast<ConnectedSubchannel*>(result.connected_subchannel.get());
+  ConnectedSubchannel* connected_subchannel = nullptr;
+  if (result.subchannel != nullptr) {
+    SubchannelWrapper* subchannel =
+        static_cast<SubchannelWrapper*>(result.subchannel.get());
+    connected_subchannel = subchannel->connected_subchannel();
+  }
+  if (connected_subchannel != nullptr) {
     connected_subchannel->Ping(op->send_ping.on_initiate, op->send_ping.on_ack);
   } else {
     if (result.error == GRPC_ERROR_NONE) {
@@ -1494,22 +1788,35 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) {
       chand->resolving_lb_policy_->ResetBackoffLocked();
     }
   }
-  // Disconnect.
+  // Disconnect or enter IDLE.
   if (op->disconnect_with_error != GRPC_ERROR_NONE) {
-    grpc_error* error = GRPC_ERROR_NONE;
-    GPR_ASSERT(chand->disconnect_error_.CompareExchangeStrong(
-        &error, op->disconnect_with_error, MemoryOrder::ACQ_REL,
-        MemoryOrder::ACQUIRE));
-    grpc_pollset_set_del_pollset_set(
-        chand->resolving_lb_policy_->interested_parties(),
-        chand->interested_parties_);
-    chand->resolving_lb_policy_.reset();
-    // Will delete itself.
-    New<ConnectivityStateAndPickerSetter>(
-        chand, GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
-        UniquePtr<LoadBalancingPolicy::SubchannelPicker>(
-            New<LoadBalancingPolicy::TransientFailurePicker>(
-                GRPC_ERROR_REF(op->disconnect_with_error))));
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
+      gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", chand,
+              grpc_error_string(op->disconnect_with_error));
+    }
+    chand->DestroyResolvingLoadBalancingPolicyLocked();
+    intptr_t value;
+    if (grpc_error_get_int(op->disconnect_with_error,
+                           GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, &value) &&
+        static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
+      if (chand->disconnect_error() == GRPC_ERROR_NONE) {
+        // Enter IDLE state.
+        chand->UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE,
+                                          "channel entering IDLE", nullptr);
+      }
+      GRPC_ERROR_UNREF(op->disconnect_with_error);
+    } else {
+      // Disconnect.
+      GPR_ASSERT(chand->disconnect_error_.Load(MemoryOrder::RELAXED) ==
+                 GRPC_ERROR_NONE);
+      chand->disconnect_error_.Store(op->disconnect_with_error,
+                                     MemoryOrder::RELEASE);
+      chand->UpdateStateAndPickerLocked(
+          GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
+          UniquePtr<LoadBalancingPolicy::SubchannelPicker>(
+              New<LoadBalancingPolicy::TransientFailurePicker>(
+                  GRPC_ERROR_REF(op->disconnect_with_error))));
+    }
   }
   GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "start_transport_op");
   GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE);
@@ -1570,10 +1877,23 @@ void ChannelData::RemoveQueuedPick(QueuedPick* to_remove,
   }
 }
 
+RefCountedPtr<ConnectedSubchannel>
+ChannelData::GetConnectedSubchannelInDataPlane(
+    SubchannelInterface* subchannel) const {
+  SubchannelWrapper* subchannel_wrapper =
+      static_cast<SubchannelWrapper*>(subchannel);
+  ConnectedSubchannel* connected_subchannel =
+      subchannel_wrapper->connected_subchannel_in_data_plane();
+  if (connected_subchannel == nullptr) return nullptr;
+  return connected_subchannel->Ref();
+}
+
 void ChannelData::TryToConnectLocked(void* arg, grpc_error* error_ignored) {
   auto* chand = static_cast<ChannelData*>(arg);
   if (chand->resolving_lb_policy_ != nullptr) {
     chand->resolving_lb_policy_->ExitIdleLocked();
+  } else {
+    chand->CreateResolvingLoadBalancingPolicyLocked();
   }
   GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "TryToConnect");
 }
@@ -1653,6 +1973,10 @@ CallData::CallData(grpc_call_element* elem, const ChannelData& chand,
 CallData::~CallData() {
   grpc_slice_unref_internal(path_);
   GRPC_ERROR_UNREF(cancel_error_);
+  if (backend_metric_data_ != nullptr) {
+    backend_metric_data_
+        ->LoadBalancingPolicy::BackendMetricData::~BackendMetricData();
+  }
   // Make sure there are no remaining pending batches.
   for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
     GPR_ASSERT(pending_batches_[i].batch == nullptr);
@@ -1731,8 +2055,8 @@ void CallData::StartTransportStreamOpBatch(
   // Add the batch to the pending list.
   calld->PendingBatchesAdd(elem, batch);
   // Check if we've already gotten a subchannel call.
-  // Note that once we have completed the pick, we do not need to enter
-  // the channel combiner, which is more efficient (especially for
+  // Note that once we have picked a subchannel, we do not need to acquire
+  // the channel's data plane mutex, which is more efficient (especially for
   // streaming calls).
   if (calld->subchannel_call_ != nullptr) {
     if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
@@ -1744,18 +2068,15 @@ void CallData::StartTransportStreamOpBatch(
     return;
   }
   // We do not yet have a subchannel call.
-  // For batches containing a send_initial_metadata op, enter the channel
-  // combiner to start a pick.
+  // For batches containing a send_initial_metadata op, acquire the
+  // channel's data plane mutex to pick a subchannel.
   if (GPR_LIKELY(batch->send_initial_metadata)) {
     if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
-      gpr_log(GPR_INFO, "chand=%p calld=%p: entering client_channel combiner",
+      gpr_log(GPR_INFO,
+              "chand=%p calld=%p: grabbing data plane mutex to perform pick",
               chand, calld);
     }
-    GRPC_CLOSURE_SCHED(
-        GRPC_CLOSURE_INIT(
-            &batch->handler_private.closure, StartPickLocked, elem,
-            grpc_combiner_scheduler(chand->data_plane_combiner())),
-        GRPC_ERROR_NONE);
+    PickSubchannel(elem, GRPC_ERROR_NONE);
   } else {
     // For all other batches, release the call combiner.
     if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
@@ -1879,9 +2200,10 @@ void CallData::RecvTrailingMetadataReadyForLoadBalancingPolicy(
     void* arg, grpc_error* error) {
   CallData* calld = static_cast<CallData*>(arg);
   // Invoke callback to LB policy.
+  Metadata trailing_metadata(calld, calld->recv_trailing_metadata_);
   calld->lb_recv_trailing_metadata_ready_(
-      calld->lb_recv_trailing_metadata_ready_user_data_,
-      calld->recv_trailing_metadata_, &calld->lb_call_state_);
+      calld->lb_recv_trailing_metadata_ready_user_data_, error,
+      &trailing_metadata, &calld->lb_call_state_);
   // Chain to original callback.
   GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_ready_,
                    GRPC_ERROR_REF(error));
@@ -2157,9 +2479,8 @@ void CallData::DoRetry(grpc_call_element* elem,
   GPR_ASSERT(method_params_ != nullptr);
   const auto* retry_policy = method_params_->retry_policy();
   GPR_ASSERT(retry_policy != nullptr);
-  // Reset subchannel call and connected subchannel.
+  // Reset subchannel call.
   subchannel_call_.reset();
-  connected_subchannel_.reset();
   // Compute backoff delay.
   grpc_millis next_attempt_time;
   if (server_pushback_ms >= 0) {
@@ -2183,8 +2504,8 @@ void CallData::DoRetry(grpc_call_element* elem,
             this, next_attempt_time - ExecCtx::Get()->Now());
   }
   // Schedule retry after computed delay.
-  GRPC_CLOSURE_INIT(&pick_closure_, StartPickLocked, elem,
-                    grpc_combiner_scheduler(chand->data_plane_combiner()));
+  GRPC_CLOSURE_INIT(&pick_closure_, PickSubchannel, elem,
+                    grpc_schedule_on_exec_ctx);
   grpc_timer_init(&retry_timer_, next_attempt_time, &pick_closure_);
   // Update bookkeeping.
   if (retry_state != nullptr) retry_state->retry_dispatched = true;
@@ -2889,8 +3210,8 @@ void CallData::AddRetriableSendInitialMetadataOp(
     SubchannelCallRetryState* retry_state,
     SubchannelCallBatchData* batch_data) {
   // Maps the number of retries to the corresponding metadata value slice.
-  static const grpc_slice* retry_count_strings[] = {
-      &GRPC_MDSTR_1, &GRPC_MDSTR_2, &GRPC_MDSTR_3, &GRPC_MDSTR_4};
+  const grpc_slice* retry_count_strings[] = {&GRPC_MDSTR_1, &GRPC_MDSTR_2,
+                                             &GRPC_MDSTR_3, &GRPC_MDSTR_4};
   // We need to make a copy of the metadata batch for each attempt, since
   // the filters in the subchannel stack may modify this batch, and we don't
   // want those modifications to be passed forward to subsequent attempts.
@@ -2907,8 +3228,7 @@ void CallData::AddRetriableSendInitialMetadataOp(
   if (GPR_UNLIKELY(retry_state->send_initial_metadata.idx.named
                        .grpc_previous_rpc_attempts != nullptr)) {
     grpc_metadata_batch_remove(&retry_state->send_initial_metadata,
-                               retry_state->send_initial_metadata.idx.named
-                                   .grpc_previous_rpc_attempts);
+                               GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
   }
   if (GPR_UNLIKELY(num_attempts_completed_ > 0)) {
     grpc_mdelem retry_md = grpc_mdelem_create(
@@ -2918,7 +3238,7 @@ void CallData::AddRetriableSendInitialMetadataOp(
         &retry_state->send_initial_metadata,
         &retry_state
              ->send_initial_metadata_storage[send_initial_metadata_.list.count],
-        retry_md);
+        retry_md, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
     if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
       gpr_log(GPR_ERROR, "error adding retry metadata: %s",
               grpc_error_string(error));
@@ -3277,13 +3597,14 @@ void CallData::CreateSubchannelCall(grpc_call_element* elem) {
   ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
   const size_t parent_data_size =
       enable_retries_ ? sizeof(SubchannelCallRetryState) : 0;
-  const ConnectedSubchannel::CallArgs call_args = {
-      pollent_, path_, call_start_time_, deadline_, arena_,
+  SubchannelCall::Args call_args = {
+      std::move(connected_subchannel_), pollent_, path_, call_start_time_,
+      deadline_, arena_,
       // TODO(roth): When we implement hedging support, we will probably
       // need to use a separate call context for each subchannel call.
       call_context_, call_combiner_, parent_data_size};
   grpc_error* error = GRPC_ERROR_NONE;
-  subchannel_call_ = connected_subchannel_->CreateCall(call_args, &error);
+  subchannel_call_ = SubchannelCall::Create(std::move(call_args), &error);
   if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
     gpr_log(GPR_INFO, "chand=%p calld=%p: create subchannel_call=%p: error=%s",
             chand, this, subchannel_call_.get(), grpc_error_string(error));
@@ -3299,6 +3620,11 @@ void CallData::CreateSubchannelCall(grpc_call_element* elem) {
   }
 }
 
+void CallData::AsyncPickDone(grpc_call_element* elem, grpc_error* error) {
+  GRPC_CLOSURE_INIT(&pick_closure_, PickDone, elem, grpc_schedule_on_exec_ctx);
+  GRPC_CLOSURE_SCHED(&pick_closure_, error);
+}
+
 void CallData::PickDone(void* arg, grpc_error* error) {
   grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
   ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
@@ -3321,10 +3647,9 @@ class CallData::QueuedPickCanceller {
  public:
   explicit QueuedPickCanceller(grpc_call_element* elem) : elem_(elem) {
     auto* calld = static_cast<CallData*>(elem->call_data);
-    auto* chand = static_cast<ChannelData*>(elem->channel_data);
     GRPC_CALL_STACK_REF(calld->owning_call_, "QueuedPickCanceller");
     GRPC_CLOSURE_INIT(&closure_, &CancelLocked, this,
-                      grpc_combiner_scheduler(chand->data_plane_combiner()));
+                      grpc_schedule_on_exec_ctx);
     calld->call_combiner_->SetNotifyOnCancel(&closure_);
   }
 
@@ -3333,6 +3658,7 @@ class CallData::QueuedPickCanceller {
     auto* self = static_cast<QueuedPickCanceller*>(arg);
     auto* chand = static_cast<ChannelData*>(self->elem_->channel_data);
     auto* calld = static_cast<CallData*>(self->elem_->call_data);
+    MutexLock lock(chand->data_plane_mu());
     if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
       gpr_log(GPR_INFO,
               "chand=%p calld=%p: cancelling queued pick: "
@@ -3404,7 +3730,7 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {
     // from the client API, reset the deadline timer.
     if (chand->deadline_checking_enabled() && method_params_->timeout() != 0) {
       const grpc_millis per_method_deadline =
-          grpc_timespec_to_millis_round_up(call_start_time_) +
+          grpc_cycle_counter_to_millis_round_up(call_start_time_) +
           method_params_->timeout();
       if (per_method_deadline < deadline_) {
         deadline_ = per_method_deadline;
@@ -3451,20 +3777,44 @@ const char* PickResultTypeName(
       return "COMPLETE";
     case LoadBalancingPolicy::PickResult::PICK_QUEUE:
       return "QUEUE";
-    case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE:
-      return "TRANSIENT_FAILURE";
+    case LoadBalancingPolicy::PickResult::PICK_FAILED:
+      return "FAILED";
   }
   GPR_UNREACHABLE_CODE(return "UNKNOWN");
 }
 
-void CallData::StartPickLocked(void* arg, grpc_error* error) {
+void CallData::PickSubchannel(void* arg, grpc_error* error) {
   grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
   CallData* calld = static_cast<CallData*>(elem->call_data);
   ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
-  GPR_ASSERT(calld->connected_subchannel_ == nullptr);
-  GPR_ASSERT(calld->subchannel_call_ == nullptr);
+  bool pick_complete;
+  {
+    MutexLock lock(chand->data_plane_mu());
+    pick_complete = calld->PickSubchannelLocked(elem, &error);
+  }
+  if (pick_complete) {
+    PickDone(elem, error);
+    GRPC_ERROR_UNREF(error);
+  }
+}
+
+bool CallData::PickSubchannelLocked(grpc_call_element* elem,
+                                    grpc_error** error) {
+  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
+  GPR_ASSERT(connected_subchannel_ == nullptr);
+  GPR_ASSERT(subchannel_call_ == nullptr);
+  // The picker being null means that the channel is currently in IDLE state.
+  // The incoming call will make the channel exit IDLE.
+  if (chand->picker() == nullptr) {
+    // Bounce into the control plane combiner to exit IDLE.
+    chand->CheckConnectivityState(/*try_to_connect=*/true);
+    // Queue the pick, so that it will be attempted once the channel
+    // becomes connected.
+    AddCallToQueuedPicksLocked(elem);
+    return false;
+  }
   // Apply service config to call if needed.
-  calld->MaybeApplyServiceConfigToCallLocked(elem);
+  MaybeApplyServiceConfigToCallLocked(elem);
   // If this is a retry, use the send_initial_metadata payload that
   // we've cached; otherwise, use the pending batch.  The
   // send_initial_metadata batch will be the first pending batch in the
@@ -3476,41 +3826,38 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) {
   // subchannel's copy of the metadata batch (which is copied for each
   // attempt) to the LB policy instead the one from the parent channel.
   LoadBalancingPolicy::PickArgs pick_args;
-  pick_args.call_state = &calld->lb_call_state_;
-  pick_args.initial_metadata =
-      calld->seen_send_initial_metadata_
-          ? &calld->send_initial_metadata_
-          : calld->pending_batches_[0]
-                .batch->payload->send_initial_metadata.send_initial_metadata;
+  pick_args.call_state = &lb_call_state_;
+  Metadata initial_metadata(
+      this,
+      seen_send_initial_metadata_
+          ? &send_initial_metadata_
+          : pending_batches_[0]
+                .batch->payload->send_initial_metadata.send_initial_metadata);
+  pick_args.initial_metadata = &initial_metadata;
   // Grab initial metadata flags so that we can check later if the call has
   // wait_for_ready enabled.
   const uint32_t send_initial_metadata_flags =
-      calld->seen_send_initial_metadata_
-          ? calld->send_initial_metadata_flags_
-          : calld->pending_batches_[0]
-                .batch->payload->send_initial_metadata
-                .send_initial_metadata_flags;
-  // When done, we schedule this closure to leave the data plane combiner.
-  GRPC_CLOSURE_INIT(&calld->pick_closure_, PickDone, elem,
-                    grpc_schedule_on_exec_ctx);
+      seen_send_initial_metadata_ ? send_initial_metadata_flags_
+                                  : pending_batches_[0]
+                                        .batch->payload->send_initial_metadata
+                                        .send_initial_metadata_flags;
   // Attempt pick.
   auto result = chand->picker()->Pick(pick_args);
   if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
     gpr_log(GPR_INFO,
-            "chand=%p calld=%p: LB pick returned %s (connected_subchannel=%p, "
-            "error=%s)",
-            chand, calld, PickResultTypeName(result.type),
-            result.connected_subchannel.get(), grpc_error_string(result.error));
+            "chand=%p calld=%p: LB pick returned %s (subchannel=%p, error=%s)",
+            chand, this, PickResultTypeName(result.type),
+            result.subchannel.get(), grpc_error_string(result.error));
   }
   switch (result.type) {
-    case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE: {
+    case LoadBalancingPolicy::PickResult::PICK_FAILED: {
       // If we're shutting down, fail all RPCs.
       grpc_error* disconnect_error = chand->disconnect_error();
       if (disconnect_error != GRPC_ERROR_NONE) {
         GRPC_ERROR_UNREF(result.error);
-        GRPC_CLOSURE_SCHED(&calld->pick_closure_,
-                           GRPC_ERROR_REF(disconnect_error));
-        break;
+        if (pick_queued_) RemoveCallFromQueuedPicksLocked(elem);
+        *error = GRPC_ERROR_REF(disconnect_error);
+        return true;
       }
       // If wait_for_ready is false, then the error indicates the RPC
       // attempt's final status.
@@ -3518,19 +3865,20 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) {
            GRPC_INITIAL_METADATA_WAIT_FOR_READY) == 0) {
         // Retry if appropriate; otherwise, fail.
         grpc_status_code status = GRPC_STATUS_OK;
-        grpc_error_get_status(result.error, calld->deadline_, &status, nullptr,
+        grpc_error_get_status(result.error, deadline_, &status, nullptr,
                               nullptr, nullptr);
-        if (!calld->enable_retries_ ||
-            !calld->MaybeRetry(elem, nullptr /* batch_data */, status,
-                               nullptr /* server_pushback_md */)) {
+        const bool retried = enable_retries_ &&
+                             MaybeRetry(elem, nullptr /* batch_data */, status,
+                                        nullptr /* server_pushback_md */);
+        if (!retried) {
           grpc_error* new_error =
               GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
                   "Failed to pick subchannel", &result.error, 1);
           GRPC_ERROR_UNREF(result.error);
-          GRPC_CLOSURE_SCHED(&calld->pick_closure_, new_error);
+          *error = new_error;
         }
-        if (calld->pick_queued_) calld->RemoveCallFromQueuedPicksLocked(elem);
-        break;
+        if (pick_queued_) RemoveCallFromQueuedPicksLocked(elem);
+        return !retried;
       }
       // If wait_for_ready is true, then queue to retry when we get a new
       // picker.
@@ -3538,21 +3886,26 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) {
     }
     // Fallthrough
     case LoadBalancingPolicy::PickResult::PICK_QUEUE:
-      if (!calld->pick_queued_) calld->AddCallToQueuedPicksLocked(elem);
-      break;
+      if (!pick_queued_) AddCallToQueuedPicksLocked(elem);
+      return false;
     default:  // PICK_COMPLETE
+      if (pick_queued_) RemoveCallFromQueuedPicksLocked(elem);
       // Handle drops.
-      if (GPR_UNLIKELY(result.connected_subchannel == nullptr)) {
+      if (GPR_UNLIKELY(result.subchannel == nullptr)) {
         result.error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
             "Call dropped by load balancing policy");
+      } else {
+        // Grab a ref to the connected subchannel while we're still
+        // holding the data plane mutex.
+        connected_subchannel_ =
+            chand->GetConnectedSubchannelInDataPlane(result.subchannel.get());
+        GPR_ASSERT(connected_subchannel_ != nullptr);
       }
-      calld->connected_subchannel_ = std::move(result.connected_subchannel);
-      calld->lb_recv_trailing_metadata_ready_ =
-          result.recv_trailing_metadata_ready;
-      calld->lb_recv_trailing_metadata_ready_user_data_ =
+      lb_recv_trailing_metadata_ready_ = result.recv_trailing_metadata_ready;
+      lb_recv_trailing_metadata_ready_user_data_ =
           result.recv_trailing_metadata_ready_user_data;
-      GRPC_CLOSURE_SCHED(&calld->pick_closure_, result.error);
-      if (calld->pick_queued_) calld->RemoveCallFromQueuedPicksLocked(elem);
+      *error = result.error;
+      return true;
   }
 }
 
index e068d11..87a7660 100644 (file)
 namespace grpc_core {
 namespace channelz {
 
-SubchannelNode::SubchannelNode(Subchannel* subchannel,
+SubchannelNode::SubchannelNode(const char* target_address,
                                size_t channel_tracer_max_nodes)
-    : BaseNode(EntityType::kSubchannel),
-      subchannel_(subchannel),
-      target_(UniquePtr<char>(gpr_strdup(subchannel_->GetTargetAddress()))),
+    : BaseNode(EntityType::kSubchannel,
+               UniquePtr<char>(gpr_strdup(target_address))),
+      target_(UniquePtr<char>(gpr_strdup(target_address))),
       trace_(channel_tracer_max_nodes) {}
 
 SubchannelNode::~SubchannelNode() {}
 
+void SubchannelNode::UpdateConnectivityState(grpc_connectivity_state state) {
+  connectivity_state_.Store(state, MemoryOrder::RELAXED);
+}
+
+void SubchannelNode::SetChildSocket(RefCountedPtr<SocketNode> socket) {
+  MutexLock lock(&socket_mu_);
+  child_socket_ = std::move(socket);
+}
+
 void SubchannelNode::PopulateConnectivityState(grpc_json* json) {
-  grpc_connectivity_state state;
-  if (subchannel_ == nullptr) {
-    state = GRPC_CHANNEL_SHUTDOWN;
-  } else {
-    state = subchannel_->CheckConnectivityState(
-        nullptr /* health_check_service_name */,
-        nullptr /* connected_subchannel */);
-  }
+  grpc_connectivity_state state =
+      connectivity_state_.Load(MemoryOrder::RELAXED);
   json = grpc_json_create_child(nullptr, json, "state", nullptr,
                                 GRPC_JSON_OBJECT, false);
   grpc_json_create_child(nullptr, json, "state",
@@ -87,14 +90,20 @@ grpc_json* SubchannelNode::RenderJson() {
   call_counter_.PopulateCallCounts(json);
   json = top_level_json;
   // populate the child socket.
-  intptr_t socket_uuid = subchannel_->GetChildSocketUuid();
-  if (socket_uuid != 0) {
+  RefCountedPtr<SocketNode> child_socket;
+  {
+    MutexLock lock(&socket_mu_);
+    child_socket = child_socket_;
+  }
+  if (child_socket != nullptr && child_socket->uuid() != 0) {
     grpc_json* array_parent = grpc_json_create_child(
         nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false);
     json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr,
                                            nullptr, GRPC_JSON_OBJECT, false);
-    grpc_json_add_number_string_child(json_iterator, nullptr, "socketId",
-                                      socket_uuid);
+    grpc_json* sibling_iterator = grpc_json_add_number_string_child(
+        json_iterator, nullptr, "socketId", child_socket->uuid());
+    grpc_json_create_child(sibling_iterator, json_iterator, "name",
+                           child_socket->name(), GRPC_JSON_STRING, false);
   }
   return top_level_json;
 }
index 9f11e92..5a1a1ad 100644 (file)
@@ -34,13 +34,16 @@ namespace channelz {
 
 class SubchannelNode : public BaseNode {
  public:
-  SubchannelNode(Subchannel* subchannel, size_t channel_tracer_max_nodes);
+  SubchannelNode(const char* target_address, size_t channel_tracer_max_nodes);
   ~SubchannelNode() override;
 
-  void MarkSubchannelDestroyed() {
-    GPR_ASSERT(subchannel_ != nullptr);
-    subchannel_ = nullptr;
-  }
+  // Sets the subchannel's connectivity state without health checking.
+  void UpdateConnectivityState(grpc_connectivity_state state);
+
+  // Used when the subchannel's child socket changes. This should be set when
+  // the subchannel's transport is created and set to nullptr when the
+  // subchannel unrefs the transport.
+  void SetChildSocket(RefCountedPtr<SocketNode> socket);
 
   grpc_json* RenderJson() override;
 
@@ -61,7 +64,9 @@ class SubchannelNode : public BaseNode {
  private:
   void PopulateConnectivityState(grpc_json* json);
 
-  Subchannel* subchannel_;
+  Atomic<grpc_connectivity_state> connectivity_state_{GRPC_CHANNEL_IDLE};
+  Mutex socket_mu_;
+  RefCountedPtr<SocketNode> child_socket_;
   UniquePtr<char> target_;
   CallCountingHelper call_counter_;
   ChannelTrace trace_;
index 21f78a8..42bc7cb 100644 (file)
@@ -36,10 +36,6 @@ class ClientChannelFactory {
   virtual Subchannel* CreateSubchannel(const grpc_channel_args* args)
       GRPC_ABSTRACT;
 
-  // Creates a channel for the specified target with the specified args.
-  virtual grpc_channel* CreateChannel(
-      const char* target, const grpc_channel_args* args) GRPC_ABSTRACT;
-
   // Returns a channel arg containing the specified factory.
   static grpc_arg CreateChannelArg(ClientChannelFactory* factory);
 
index ea34dcd..2bd5ff2 100644 (file)
@@ -22,6 +22,7 @@
 #include <grpc/support/port_platform.h>
 
 #include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/channel/channelz.h"
 #include "src/core/lib/iomgr/resolve_address.h"
 #include "src/core/lib/transport/transport.h"
 
@@ -48,8 +49,15 @@ typedef struct {
   /** channel arguments (to be passed to the filters) */
   grpc_channel_args* channel_args;
 
-  /** socket uuid of the connected transport. 0 if not available */
-  intptr_t socket_uuid;
+  /** channelz socket node of the connected transport. nullptr if not available
+   */
+  grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket;
+
+  void reset() {
+    transport = nullptr;
+    channel_args = nullptr;
+    socket = nullptr;
+  }
 } grpc_connect_out_args;
 
 struct grpc_connector_vtable {
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.c
deleted file mode 100644 (file)
index 5499c54..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/ext/filters/client_channel/health/health.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, STATIC  , FIRST, grpc_health_v1_HealthCheckRequest, service, service, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2] = {
-    PB_FIELD(  1, UENUM   , OPTIONAL, STATIC  , FIRST, grpc_health_v1_HealthCheckResponse, status, status, 0),
-    PB_LAST_FIELD
-};
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.h
deleted file mode 100644 (file)
index 9d54ccd..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED
-#define PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED
-#include "pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enum definitions */
-typedef enum _grpc_health_v1_HealthCheckResponse_ServingStatus {
-    grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN = 0,
-    grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING = 1,
-    grpc_health_v1_HealthCheckResponse_ServingStatus_NOT_SERVING = 2,
-    grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN = 3
-} grpc_health_v1_HealthCheckResponse_ServingStatus;
-#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MIN grpc_health_v1_HealthCheckResponse_ServingStatus_UNKNOWN
-#define _grpc_health_v1_HealthCheckResponse_ServingStatus_MAX grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN
-#define _grpc_health_v1_HealthCheckResponse_ServingStatus_ARRAYSIZE ((grpc_health_v1_HealthCheckResponse_ServingStatus)(grpc_health_v1_HealthCheckResponse_ServingStatus_SERVICE_UNKNOWN+1))
-
-/* Struct definitions */
-typedef struct _grpc_health_v1_HealthCheckRequest {
-    bool has_service;
-    char service[200];
-/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckRequest) */
-} grpc_health_v1_HealthCheckRequest;
-
-typedef struct _grpc_health_v1_HealthCheckResponse {
-    bool has_status;
-    grpc_health_v1_HealthCheckResponse_ServingStatus status;
-/* @@protoc_insertion_point(struct:grpc_health_v1_HealthCheckResponse) */
-} grpc_health_v1_HealthCheckResponse;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define grpc_health_v1_HealthCheckRequest_init_default {false, ""}
-#define grpc_health_v1_HealthCheckResponse_init_default {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0}
-#define grpc_health_v1_HealthCheckRequest_init_zero {false, ""}
-#define grpc_health_v1_HealthCheckResponse_init_zero {false, (grpc_health_v1_HealthCheckResponse_ServingStatus)0}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define grpc_health_v1_HealthCheckRequest_service_tag 1
-#define grpc_health_v1_HealthCheckResponse_status_tag 1
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t grpc_health_v1_HealthCheckRequest_fields[2];
-extern const pb_field_t grpc_health_v1_HealthCheckResponse_fields[2];
-
-/* Maximum encoded size of messages (where known) */
-#define grpc_health_v1_HealthCheckRequest_size   203
-#define grpc_health_v1_HealthCheckResponse_size  2
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define HEALTH_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
index faa2ba5..2662d84 100644 (file)
 
 #include "src/core/ext/filters/client_channel/health/health_check_client.h"
 
-#include "pb_decode.h"
-#include "pb_encode.h"
-#include "src/core/ext/filters/client_channel/health/health.pb.h"
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gprpp/sync.h"
 #include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/transport/error_utils.h"
 #include "src/core/lib/transport/status_metadata.h"
+#include "src/proto/grpc/health/v1/health.upb.h"
 
 #define HEALTH_CHECK_INITIAL_CONNECT_BACKOFF_SECONDS 1
 #define HEALTH_CHECK_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -202,19 +200,16 @@ namespace {
 
 void EncodeRequest(const char* service_name,
                    ManualConstructor<SliceBufferByteStream>* send_message) {
-  grpc_health_v1_HealthCheckRequest request_struct;
-  request_struct.has_service = true;
-  snprintf(request_struct.service, sizeof(request_struct.service), "%s",
-           service_name);
-  pb_ostream_t ostream;
-  memset(&ostream, 0, sizeof(ostream));
-  pb_encode(&ostream, grpc_health_v1_HealthCheckRequest_fields,
-            &request_struct);
-  grpc_slice request_slice = GRPC_SLICE_MALLOC(ostream.bytes_written);
-  ostream = pb_ostream_from_buffer(GRPC_SLICE_START_PTR(request_slice),
-                                   GRPC_SLICE_LENGTH(request_slice));
-  GPR_ASSERT(pb_encode(&ostream, grpc_health_v1_HealthCheckRequest_fields,
-                       &request_struct) != 0);
+  upb::Arena arena;
+  grpc_health_v1_HealthCheckRequest* request_struct =
+      grpc_health_v1_HealthCheckRequest_new(arena.ptr());
+  grpc_health_v1_HealthCheckRequest_set_service(
+      request_struct, upb_strview_makez(service_name));
+  size_t buf_length;
+  char* buf = grpc_health_v1_HealthCheckRequest_serialize(
+      request_struct, arena.ptr(), &buf_length);
+  grpc_slice request_slice = GRPC_SLICE_MALLOC(buf_length);
+  memcpy(GRPC_SLICE_START_PTR(request_slice), buf, buf_length);
   grpc_slice_buffer slice_buffer;
   grpc_slice_buffer_init(&slice_buffer);
   grpc_slice_buffer_add(&slice_buffer, request_slice);
@@ -248,24 +243,19 @@ bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error** error) {
     }
   }
   // Deserialize message.
-  grpc_health_v1_HealthCheckResponse response_struct;
-  pb_istream_t istream =
-      pb_istream_from_buffer(recv_message, slice_buffer->length);
-  if (!pb_decode(&istream, grpc_health_v1_HealthCheckResponse_fields,
-                 &response_struct)) {
+  upb::Arena arena;
+  grpc_health_v1_HealthCheckResponse* response_struct =
+      grpc_health_v1_HealthCheckResponse_parse(
+          reinterpret_cast<char*>(recv_message), slice_buffer->length,
+          arena.ptr());
+  if (response_struct == nullptr) {
     // Can't parse message; assume unhealthy.
     *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
         "cannot parse health check response");
     return false;
   }
-  if (!response_struct.has_status) {
-    // Field not present; assume unhealthy.
-    *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-        "status field not present in health check response");
-    return false;
-  }
-  return response_struct.status ==
-         grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING;
+  int32_t status = grpc_health_v1_HealthCheckResponse_status(response_struct);
+  return status == grpc_health_v1_HealthCheckResponse_SERVING;
 }
 
 }  // namespace
@@ -310,19 +300,19 @@ void HealthCheckClient::CallState::Orphan() {
 }
 
 void HealthCheckClient::CallState::StartCall() {
-  ConnectedSubchannel::CallArgs args = {
+  SubchannelCall::Args args = {
+      health_check_client_->connected_subchannel_,
       &pollent_,
       GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH,
-      gpr_now(GPR_CLOCK_MONOTONIC),  // start_time
-      GRPC_MILLIS_INF_FUTURE,        // deadline
+      gpr_get_cycle_counter(),  // start_time
+      GRPC_MILLIS_INF_FUTURE,   // deadline
       arena_,
       context_,
       &call_combiner_,
       0,  // parent_data_size
   };
   grpc_error* error = GRPC_ERROR_NONE;
-  call_ = health_check_client_->connected_subchannel_->CreateCall(args, &error)
-              .release();
+  call_ = SubchannelCall::Create(std::move(args), &error).release();
   // Register after-destruction callback.
   GRPC_CLOSURE_INIT(&after_call_stack_destruction_, AfterCallStackDestruction,
                     this, grpc_schedule_on_exec_ctx);
@@ -356,7 +346,8 @@ void HealthCheckClient::CallState::StartCall() {
       &send_initial_metadata_, &path_metadata_storage_,
       grpc_mdelem_from_slices(
           GRPC_MDSTR_PATH,
-          GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH));
+          GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH),
+      GRPC_BATCH_PATH);
   GPR_ASSERT(error == GRPC_ERROR_NONE);
   payload_.send_initial_metadata.send_initial_metadata =
       &send_initial_metadata_;
index 8951a29..b21bf46 100644 (file)
@@ -31,8 +31,8 @@
 #include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/slice/b64.h"
 #include "src/core/lib/uri/uri_parser.h"
 
@@ -47,10 +47,12 @@ static char* get_http_proxy_server(char** user_cred) {
   char* proxy_name = nullptr;
   char** authority_strs = nullptr;
   size_t authority_nstrs;
-  /* Prefer using 'https_proxy'. Fallback on 'http_proxy' if it is not set. The
+  /* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set.
+   * Also prefer using 'https_proxy' with fallback on 'http_proxy'. The
    * fallback behavior can be removed if there's a demand for it.
    */
-  char* uri_str = gpr_getenv("https_proxy");
+  char* uri_str = gpr_getenv("grpc_proxy");
+  if (uri_str == nullptr) uri_str = gpr_getenv("https_proxy");
   if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy");
   if (uri_str == nullptr) return nullptr;
   grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
@@ -122,21 +124,24 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
             server_uri);
     goto no_use_proxy;
   }
-  no_proxy_str = gpr_getenv("no_proxy");
+  /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */
+  no_proxy_str = gpr_getenv("no_grpc_proxy");
+  if (no_proxy_str == nullptr) no_proxy_str = gpr_getenv("no_proxy");
   if (no_proxy_str != nullptr) {
     static const char* NO_PROXY_SEPARATOR = ",";
     bool use_proxy = true;
-    char* server_host;
-    char* server_port;
-    if (!gpr_split_host_port(uri->path[0] == '/' ? uri->path + 1 : uri->path,
-                             &server_host, &server_port)) {
+    grpc_core::UniquePtr<char> server_host;
+    grpc_core::UniquePtr<char> server_port;
+    if (!grpc_core::SplitHostPort(
+            uri->path[0] == '/' ? uri->path + 1 : uri->path, &server_host,
+            &server_port)) {
       gpr_log(GPR_INFO,
               "unable to split host and port, not checking no_proxy list for "
               "host '%s'",
               server_uri);
       gpr_free(no_proxy_str);
     } else {
-      size_t uri_len = strlen(server_host);
+      size_t uri_len = strlen(server_host.get());
       char** no_proxy_hosts;
       size_t num_no_proxy_hosts;
       gpr_string_split(no_proxy_str, NO_PROXY_SEPARATOR, &no_proxy_hosts,
@@ -145,8 +150,8 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
         char* no_proxy_entry = no_proxy_hosts[i];
         size_t no_proxy_len = strlen(no_proxy_entry);
         if (no_proxy_len <= uri_len &&
-            gpr_stricmp(no_proxy_entry, &server_host[uri_len - no_proxy_len]) ==
-                0) {
+            gpr_stricmp(no_proxy_entry,
+                        &(server_host.get()[uri_len - no_proxy_len])) == 0) {
           gpr_log(GPR_INFO, "not using proxy for host in no_proxy list '%s'",
                   server_uri);
           use_proxy = false;
@@ -157,8 +162,6 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
         gpr_free(no_proxy_hosts[i]);
       }
       gpr_free(no_proxy_hosts);
-      gpr_free(server_host);
-      gpr_free(server_port);
       gpr_free(no_proxy_str);
       if (!use_proxy) goto no_use_proxy;
     }
index 3e4d370..41a7d2d 100644 (file)
@@ -43,23 +43,8 @@ LoadBalancingPolicy::~LoadBalancingPolicy() {
 }
 
 void LoadBalancingPolicy::Orphan() {
-  // Invoke ShutdownAndUnrefLocked() inside of the combiner.
-  // TODO(roth): Is this actually needed?  We should already be in the
-  // combiner here.  Note that if we directly call ShutdownLocked(),
-  // then we can probably remove the hack whereby the helper is
-  // destroyed at shutdown instead of at destruction.
-  GRPC_CLOSURE_SCHED(
-      GRPC_CLOSURE_CREATE(&LoadBalancingPolicy::ShutdownAndUnrefLocked, this,
-                          grpc_combiner_scheduler(combiner_)),
-      GRPC_ERROR_NONE);
-}
-
-void LoadBalancingPolicy::ShutdownAndUnrefLocked(void* arg,
-                                                 grpc_error* ignored) {
-  LoadBalancingPolicy* policy = static_cast<LoadBalancingPolicy*>(arg);
-  policy->ShutdownLocked();
-  policy->channel_control_helper_.reset();
-  policy->Unref();
+  ShutdownLocked();
+  Unref();
 }
 
 //
@@ -144,7 +129,7 @@ void LoadBalancingPolicy::QueuePicker::CallExitIdle(void* arg,
 LoadBalancingPolicy::PickResult
 LoadBalancingPolicy::TransientFailurePicker::Pick(PickArgs args) {
   PickResult result;
-  result.type = PickResult::PICK_TRANSIENT_FAILURE;
+  result.type = PickResult::PICK_FAILED;
   result.error = GRPC_ERROR_REF(error_);
   return result;
 }
index f98a41d..093d5fc 100644 (file)
 #include "src/core/ext/filters/client_channel/service_config.h"
 #include "src/core/ext/filters/client_channel/subchannel_interface.h"
 #include "src/core/lib/gprpp/abstract.h"
+#include "src/core/lib/gprpp/map.h"
 #include "src/core/lib/gprpp/orphanable.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/gprpp/string_view.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/polling_entity.h"
 #include "src/core/lib/transport/connectivity_state.h"
-#include "src/core/lib/transport/metadata_batch.h"
 
 namespace grpc_core {
 
@@ -42,15 +43,15 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount;
 ///
 /// Channel: An abstraction that manages connections to backend servers
 ///   on behalf of a client application.  The application creates a channel
-///   for a given server name and then sends RPCs on it, and the channel
-///   figures out which backend server to send each RPC to.  A channel
+///   for a given server name and then sends calls (RPCs) on it, and the
+///   channel figures out which backend server to send each call to.  A channel
 ///   contains a resolver, a load balancing policy (or a tree of LB policies),
 ///   and a set of one or more subchannels.
 ///
 /// Subchannel: A subchannel represents a connection to one backend server.
 ///   The LB policy decides which subchannels to create, manages the
 ///   connectivity state of those subchannels, and decides which subchannel
-///   to send any given RPC to.
+///   to send any given call to.
 ///
 /// Resolver: A plugin that takes a gRPC server URI and resolves it to a
 ///   list of one or more addresses and a service config, as described
@@ -59,12 +60,12 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount;
 ///
 /// Load Balancing (LB) Policy: A plugin that takes a list of addresses
 ///   from the resolver, maintains and manages a subchannel for each
-///   backend address, and decides which subchannel to send each RPC on.
+///   backend address, and decides which subchannel to send each call on.
 ///   An LB policy has two parts:
 ///   - A LoadBalancingPolicy, which deals with the control plane work of
 ///     managing subchannels.
 ///   - A SubchannelPicker, which handles the data plane work of
-///     determining which subchannel a given RPC should be sent on.
+///     determining which subchannel a given call should be sent on.
 
 /// LoadBalacingPolicy API.
 ///
@@ -77,7 +78,28 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount;
 // interested_parties() hooks from the API.
 class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
  public:
+  // Represents backend metrics reported by the backend to the client.
+  struct BackendMetricData {
+    /// CPU utilization expressed as a fraction of available CPU resources.
+    double cpu_utilization;
+    /// Memory utilization expressed as a fraction of available memory
+    /// resources.
+    double mem_utilization;
+    /// Total requests per second being served by the backend.  This
+    /// should include all services that a backend is responsible for.
+    uint64_t requests_per_second;
+    /// Application-specific requests cost metrics.  Metric names are
+    /// determined by the application.  Each value is an absolute cost
+    /// (e.g. 3487 bytes of storage) associated with the request.
+    Map<StringView, double, StringLess> request_cost;
+    /// Application-specific resource utilization metrics.  Metric names
+    /// are determined by the application.  Each value is expressed as a
+    /// fraction of total resources available.
+    Map<StringView, double, StringLess> utilization;
+  };
+
   /// Interface for accessing per-call state.
+  /// Implemented by the client channel and used by the SubchannelPicker.
   class CallState {
    public:
     CallState() = default;
@@ -89,73 +111,112 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
     /// for allocations that need to be made on a per-call basis.
     virtual void* Alloc(size_t size) GRPC_ABSTRACT;
 
+    /// Returns the backend metric data returned by the server for the call,
+    /// or null if no backend metric data was returned.
+    virtual const BackendMetricData* GetBackendMetricData() GRPC_ABSTRACT;
+
+    GRPC_ABSTRACT_BASE_CLASS
+  };
+
+  /// Interface for accessing metadata.
+  /// Implemented by the client channel and used by the SubchannelPicker.
+  class MetadataInterface {
+   public:
+    // Implementations whose iterators fit in intptr_t may internally
+    // cast this directly to their iterator type.  Otherwise, they may
+    // dynamically allocate their iterators and store the address here.
+    typedef intptr_t Iterator;
+
+    virtual ~MetadataInterface() = default;
+
+    /// Adds a key/value pair.
+    /// Does NOT take ownership of \a key or \a value.
+    /// Implementations must ensure that the key and value remain alive
+    /// until the call ends.  If desired, they may be allocated via
+    /// CallState::Alloc().
+    virtual void Add(StringView key, StringView value) GRPC_ABSTRACT;
+
+    /// Iteration interface.
+    virtual Iterator Begin() const GRPC_ABSTRACT;
+    virtual bool IsEnd(Iterator it) const GRPC_ABSTRACT;
+    virtual void Next(Iterator* it) const GRPC_ABSTRACT;
+    virtual StringView Key(Iterator it) const GRPC_ABSTRACT;
+    virtual StringView Value(Iterator it) const GRPC_ABSTRACT;
+
+    /// Removes the element pointed to by \a it, which is modified to
+    /// point to the next element.
+    virtual void Erase(Iterator* it) GRPC_ABSTRACT;
+
     GRPC_ABSTRACT_BASE_CLASS
   };
 
-  /// Arguments used when picking a subchannel for an RPC.
+  /// Arguments used when picking a subchannel for a call.
   struct PickArgs {
     /// Initial metadata associated with the picking call.
     /// The LB policy may use the existing metadata to influence its routing
     /// decision, and it may add new metadata elements to be sent with the
     /// call to the chosen backend.
-    // TODO(roth): Provide a more generic metadata API here.
-    grpc_metadata_batch* initial_metadata = nullptr;
+    MetadataInterface* initial_metadata;
     /// An interface for accessing call state.  Can be used to allocate
     /// data associated with the call in an efficient way.
     CallState* call_state;
   };
 
-  /// The result of picking a subchannel for an RPC.
+  /// The result of picking a subchannel for a call.
   struct PickResult {
     enum ResultType {
-      /// Pick complete.  If connected_subchannel is non-null, client channel
-      /// can immediately proceed with the call on connected_subchannel;
-      /// otherwise, call should be dropped.
+      /// Pick complete.  If \a subchannel is non-null, the client channel
+      /// will immediately proceed with the call on that subchannel;
+      /// otherwise, it will drop the call.
       PICK_COMPLETE,
       /// Pick cannot be completed until something changes on the control
-      /// plane.  Client channel will queue the pick and try again the
+      /// plane.  The client channel will queue the pick and try again the
       /// next time the picker is updated.
       PICK_QUEUE,
-      /// LB policy is in transient failure.  If the pick is wait_for_ready,
-      /// client channel will wait for the next picker and try again;
-      /// otherwise, the call will be failed immediately (although it may
-      /// be retried if the client channel is configured to do so).
-      /// The Pick() method will set its error parameter if this value is
-      /// returned.
-      PICK_TRANSIENT_FAILURE,
+      /// Pick failed.  If the call is wait_for_ready, the client channel
+      /// will wait for the next picker and try again; otherwise, it
+      /// will immediately fail the call with the status indicated via
+      /// \a error (although the call may be retried if the client channel
+      /// is configured to do so).
+      PICK_FAILED,
     };
     ResultType type;
 
     /// Used only if type is PICK_COMPLETE.  Will be set to the selected
     /// subchannel, or nullptr if the LB policy decides to drop the call.
-    RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel;
+    RefCountedPtr<SubchannelInterface> subchannel;
 
-    /// Used only if type is PICK_TRANSIENT_FAILURE.
-    /// Error to be set when returning a transient failure.
+    /// Used only if type is PICK_FAILED.
+    /// Error to be set when returning a failure.
     // TODO(roth): Replace this with something similar to grpc::Status,
     // so that we don't expose grpc_error to this API.
     grpc_error* error = GRPC_ERROR_NONE;
 
     /// Used only if type is PICK_COMPLETE.
-    /// Callback set by lb policy to be notified of trailing metadata.
+    /// Callback set by LB policy to be notified of trailing metadata.
     /// The user_data argument will be set to the
     /// recv_trailing_metadata_ready_user_data field.
     /// recv_trailing_metadata will be set to the metadata, which may be
     /// modified by the callback.  The callback does not take ownership,
     /// however, so any data that needs to be used after returning must
     /// be copied.
+    /// call_state can be used to obtain backend metric data.
+    // TODO(roth): Replace grpc_error with something better before we allow
+    // people outside of gRPC team to use this API.
     void (*recv_trailing_metadata_ready)(
-        void* user_data, grpc_metadata_batch* recv_trailing_metadata,
+        void* user_data, grpc_error* error,
+        MetadataInterface* recv_trailing_metadata,
         CallState* call_state) = nullptr;
     void* recv_trailing_metadata_ready_user_data = nullptr;
   };
 
   /// A subchannel picker is the object used to pick the subchannel to
-  /// use for a given RPC.
+  /// use for a given call.  This is implemented by the LB policy and
+  /// used by the client channel to perform picks.
   ///
   /// Pickers are intended to encapsulate all of the state and logic
   /// needed on the data plane (i.e., to actually process picks for
-  /// individual RPCs sent on the channel) while excluding all of the
+  /// individual calls sent on the channel) while excluding all of the
   /// state and logic needed on the control plane (i.e., resolver
   /// updates, connectivity state notifications, etc); the latter should
   /// live in the LB policy object itself.
@@ -173,8 +234,8 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
     GRPC_ABSTRACT_BASE_CLASS
   };
 
-  /// A proxy object used by the LB policy to communicate with the client
-  /// channel.
+  /// A proxy object implemented by the client channel and used by the
+  /// LB policy to communicate with the channel.
   // TODO(juanlishen): Consider adding a mid-layer subclass that helps handle
   // things like swapping in pending policy when it's ready. Currently, we are
   // duplicating the logic in many subclasses.
@@ -187,12 +248,6 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
     virtual RefCountedPtr<SubchannelInterface> CreateSubchannel(
         const grpc_channel_args& args) GRPC_ABSTRACT;
 
-    /// Creates a channel with the specified target and channel args.
-    /// This can be used in cases where the LB policy needs to create a
-    /// channel for its own use (e.g., to talk to an external load balancer).
-    virtual grpc_channel* CreateChannel(
-        const char* target, const grpc_channel_args& args) GRPC_ABSTRACT;
-
     /// Sets the connectivity state and returns a new picker to be used
     /// by the client channel.
     virtual void UpdateState(grpc_connectivity_state state,
@@ -202,10 +257,9 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
     virtual void RequestReresolution() GRPC_ABSTRACT;
 
     /// Adds a trace message associated with the channel.
-    /// Does NOT take ownership of \a message.
     enum TraceSeverity { TRACE_INFO, TRACE_WARNING, TRACE_ERROR };
     virtual void AddTraceEvent(TraceSeverity severity,
-                               const char* message) GRPC_ABSTRACT;
+                               StringView message) GRPC_ABSTRACT;
 
     GRPC_ABSTRACT_BASE_CLASS
   };
@@ -282,6 +336,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
 
   grpc_pollset_set* interested_parties() const { return interested_parties_; }
 
+  // Note: This must be invoked while holding the combiner.
   void Orphan() override;
 
   // A picker that returns PICK_QUEUE for all picks.
@@ -322,7 +377,6 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
 
   // Note: LB policies MUST NOT call any method on the helper from their
   // constructor.
-  // Note: This will return null after ShutdownLocked() has been called.
   ChannelControlHelper* channel_control_helper() const {
     return channel_control_helper_.get();
   }
@@ -331,8 +385,6 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
   virtual void ShutdownLocked() GRPC_ABSTRACT;
 
  private:
-  static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored);
-
   /// Combiner under which LB policy actions take place.
   grpc_combiner* combiner_;
   /// Owned pointer to interested parties in load balancing decisions.
index 3bb31fe..3057b26 100644 (file)
 
 #include "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h"
 
+#include <string.h>
+
 #include <grpc/support/atm.h>
 #include <grpc/support/log.h>
 
+#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h"
 #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/profiling/timers.h"
@@ -95,22 +98,33 @@ static void start_transport_stream_op_batch(
   GPR_TIMER_SCOPE("clr_start_transport_stream_op_batch", 0);
   // Handle send_initial_metadata.
   if (batch->send_initial_metadata) {
-    // Grab client stats object from user_data for LB token metadata.
-    grpc_linked_mdelem* lb_token =
-        batch->payload->send_initial_metadata.send_initial_metadata->idx.named
-            .lb_token;
-    if (lb_token != nullptr) {
+    // Grab client stats object from metadata.
+    grpc_linked_mdelem* client_stats_md =
+        batch->payload->send_initial_metadata.send_initial_metadata->list.head;
+    for (; client_stats_md != nullptr;
+         client_stats_md = client_stats_md->next) {
+      if (GRPC_SLICE_START_PTR(GRPC_MDKEY(client_stats_md->md)) ==
+          static_cast<const void*>(grpc_core::kGrpcLbClientStatsMetadataKey)) {
+        break;
+      }
+    }
+    if (client_stats_md != nullptr) {
       grpc_core::GrpcLbClientStats* client_stats =
-          static_cast<grpc_core::GrpcLbClientStats*>(grpc_mdelem_get_user_data(
-              lb_token->md, grpc_core::GrpcLbClientStats::Destroy));
+          const_cast<grpc_core::GrpcLbClientStats*>(
+              reinterpret_cast<const grpc_core::GrpcLbClientStats*>(
+                  GRPC_SLICE_START_PTR(GRPC_MDVALUE(client_stats_md->md))));
       if (client_stats != nullptr) {
-        calld->client_stats = client_stats->Ref();
+        calld->client_stats.reset(client_stats);
         // Intercept completion.
         calld->original_on_complete_for_send = batch->on_complete;
         GRPC_CLOSURE_INIT(&calld->on_complete_for_send, on_complete_for_send,
                           calld, grpc_schedule_on_exec_ctx);
         batch->on_complete = &calld->on_complete_for_send;
       }
+      // Remove metadata so it doesn't go out on the wire.
+      grpc_metadata_batch_remove(
+          batch->payload->send_initial_metadata.send_initial_metadata,
+          client_stats_md);
     }
   }
   // Intercept completion of recv_initial_metadata.
index a87dfda..7f3c2b2 100644 (file)
@@ -84,7 +84,6 @@
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/gprpp/memory.h"
 #define GRPC_GRPCLB_DEFAULT_FALLBACK_TIMEOUT_MS 10000
 
 #define GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN "grpc.grpclb_address_lb_token"
+#define GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS "grpc.grpclb_address_client_stats"
 
 namespace grpc_core {
 
 TraceFlag grpc_lb_glb_trace(false, "glb");
 
+const char kGrpcLbClientStatsMetadataKey[] = "grpclb_client_stats";
+const char kGrpcLbLbTokenMetadataKey[] = "lb-token";
+
 namespace {
 
 constexpr char kGrpclb[] = "grpclb";
@@ -161,9 +164,7 @@ class GrpcLb : public LoadBalancingPolicy {
     bool seen_serverlist() const { return seen_serverlist_; }
 
    private:
-    // So Delete() can access our private dtor.
-    template <typename T>
-    friend void grpc_core::Delete(T*);
+    GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
 
     ~BalancerCallState();
 
@@ -292,12 +293,10 @@ class GrpcLb : public LoadBalancingPolicy {
 
     RefCountedPtr<SubchannelInterface> CreateSubchannel(
         const grpc_channel_args& args) override;
-    grpc_channel* CreateChannel(const char* target,
-                                const grpc_channel_args& args) override;
     void UpdateState(grpc_connectivity_state state,
                      UniquePtr<SubchannelPicker> picker) override;
     void RequestReresolution() override;
-    void AddTraceEvent(TraceSeverity severity, const char* message) override;
+    void AddTraceEvent(TraceSeverity severity, StringView message) override;
 
     void set_child(LoadBalancingPolicy* child) { child_ = child; }
 
@@ -408,18 +407,18 @@ void ParseServer(const grpc_grpclb_server* server,
   const uint16_t netorder_port = grpc_htons((uint16_t)server->port);
   /* the addresses are given in binary format (a in(6)_addr struct) in
    * server->ip_address.bytes. */
-  const grpc_grpclb_ip_address* ip = &server->ip_address;
-  if (ip->size == 4) {
+  const grpc_grpclb_server_ip_address& ip = server->ip_address;
+  if (ip.size == 4) {
     addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
     grpc_sockaddr_in* addr4 = reinterpret_cast<grpc_sockaddr_in*>(&addr->addr);
     addr4->sin_family = GRPC_AF_INET;
-    memcpy(&addr4->sin_addr, ip->bytes, ip->size);
+    memcpy(&addr4->sin_addr, ip.data, ip.size);
     addr4->sin_port = netorder_port;
-  } else if (ip->size == 16) {
+  } else if (ip.size == 16) {
     addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in6));
     grpc_sockaddr_in6* addr6 = (grpc_sockaddr_in6*)&addr->addr;
     addr6->sin6_family = GRPC_AF_INET6;
-    memcpy(&addr6->sin6_addr, ip->bytes, ip->size);
+    memcpy(&addr6->sin6_addr, ip.data, ip.size);
     addr6->sin6_port = netorder_port;
   }
 }
@@ -448,28 +447,48 @@ UniquePtr<char> GrpcLb::Serverlist::AsText() const {
   return result;
 }
 
-// vtable for LB token channel arg.
+// vtables for channel args for LB token and client stats.
 void* lb_token_copy(void* token) {
-  return token == nullptr
-             ? nullptr
-             : (void*)GRPC_MDELEM_REF(grpc_mdelem{(uintptr_t)token}).payload;
+  return gpr_strdup(static_cast<char*>(token));
 }
-void lb_token_destroy(void* token) {
-  if (token != nullptr) {
-    GRPC_MDELEM_UNREF(grpc_mdelem{(uintptr_t)token});
-  }
+void lb_token_destroy(void* token) { gpr_free(token); }
+void* client_stats_copy(void* p) {
+  GrpcLbClientStats* client_stats = static_cast<GrpcLbClientStats*>(p);
+  client_stats->Ref().release();
+  return p;
+}
+void client_stats_destroy(void* p) {
+  GrpcLbClientStats* client_stats = static_cast<GrpcLbClientStats*>(p);
+  client_stats->Unref();
 }
-int lb_token_cmp(void* token1, void* token2) {
+int equal_cmp(void* p1, void* p2) {
   // Always indicate a match, since we don't want this channel arg to
   // affect the subchannel's key in the index.
+  // TODO(roth): Is this right?  This does prevent us from needlessly
+  // recreating the subchannel whenever the LB token or client stats
+  // changes (i.e., when the balancer call is terminated and reestablished).
+  // However, it means that we don't actually recreate the subchannel,
+  // which means that we won't ever switch over to using the new LB
+  // token or client stats.  A better approach might be to find somewhere
+  // other than the subchannel args to store the LB token and client
+  // stats.  They could be stored in a map and then looked up for each
+  // call (although we'd need to make sure our Map<> implementation is
+  // performant enough).  Or we could do something more complicated whereby
+  // we create our own subchannel wrapper to store them, although that would
+  // involve a lot of refcounting overhead.
+  // Given that we're trying to move from grpclb to xds at this point,
+  // and that no one has actually reported any problems with this, we
+  // probably won't bother fixing this at this point.
   return 0;
 }
 const grpc_arg_pointer_vtable lb_token_arg_vtable = {
-    lb_token_copy, lb_token_destroy, lb_token_cmp};
+    lb_token_copy, lb_token_destroy, equal_cmp};
+const grpc_arg_pointer_vtable client_stats_arg_vtable = {
+    client_stats_copy, client_stats_destroy, equal_cmp};
 
 bool IsServerValid(const grpc_grpclb_server* server, size_t idx, bool log) {
   if (server->drop) return false;
-  const grpc_grpclb_ip_address* ip = &server->ip_address;
+  const grpc_grpclb_server_ip_address& ip = server->ip_address;
   if (GPR_UNLIKELY(server->port >> 16 != 0)) {
     if (log) {
       gpr_log(GPR_ERROR,
@@ -478,12 +497,12 @@ bool IsServerValid(const grpc_grpclb_server* server, size_t idx, bool log) {
     }
     return false;
   }
-  if (GPR_UNLIKELY(ip->size != 4 && ip->size != 16)) {
+  if (GPR_UNLIKELY(ip.size != 4 && ip.size != 16)) {
     if (log) {
       gpr_log(GPR_ERROR,
               "Expected IP to be 4 or 16 bytes, got %d at index %lu of "
               "serverlist. Ignoring",
-              ip->size, (unsigned long)idx);
+              ip.size, (unsigned long)idx);
     }
     return false;
   }
@@ -501,20 +520,14 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList(
     grpc_resolved_address addr;
     ParseServer(server, &addr);
     // LB token processing.
-    grpc_mdelem lb_token;
-    if (server->has_load_balance_token) {
+    char lb_token[GPR_ARRAY_SIZE(server->load_balance_token) + 1];
+    if (server->load_balance_token[0] != 0) {
       const size_t lb_token_max_length =
           GPR_ARRAY_SIZE(server->load_balance_token);
       const size_t lb_token_length =
           strnlen(server->load_balance_token, lb_token_max_length);
-      grpc_slice lb_token_mdstr = grpc_slice_from_copied_buffer(
-          server->load_balance_token, lb_token_length);
-      lb_token = grpc_mdelem_from_slices(GRPC_MDSTR_LB_TOKEN, lb_token_mdstr);
-      if (client_stats != nullptr) {
-        GPR_ASSERT(grpc_mdelem_set_user_data(
-                       lb_token, GrpcLbClientStats::Destroy,
-                       client_stats->Ref().release()) == client_stats);
-      }
+      memcpy(lb_token, server->load_balance_token, lb_token_length);
+      lb_token[lb_token_length] = '\0';
     } else {
       char* uri = grpc_sockaddr_to_uri(&addr);
       gpr_log(GPR_INFO,
@@ -522,16 +535,21 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList(
               "be used instead",
               uri);
       gpr_free(uri);
-      lb_token = GRPC_MDELEM_LB_TOKEN_EMPTY;
+      lb_token[0] = '\0';
     }
     // Add address.
-    grpc_arg arg = grpc_channel_arg_pointer_create(
-        const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN),
-        (void*)lb_token.payload, &lb_token_arg_vtable);
-    grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1);
+    InlinedVector<grpc_arg, 2> args_to_add;
+    args_to_add.emplace_back(grpc_channel_arg_pointer_create(
+        const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token,
+        &lb_token_arg_vtable));
+    if (client_stats != nullptr) {
+      args_to_add.emplace_back(grpc_channel_arg_pointer_create(
+          const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS), client_stats,
+          &client_stats_arg_vtable));
+    }
+    grpc_channel_args* args = grpc_channel_args_copy_and_add(
+        nullptr, args_to_add.data(), args_to_add.size());
     addresses.emplace_back(addr, args);
-    // Clean up.
-    GRPC_MDELEM_UNREF(lb_token);
   }
   return addresses;
 }
@@ -575,27 +593,36 @@ GrpcLb::PickResult GrpcLb::Picker::Pick(PickArgs args) {
   result = child_picker_->Pick(args);
   // If pick succeeded, add LB token to initial metadata.
   if (result.type == PickResult::PICK_COMPLETE &&
-      result.connected_subchannel != nullptr) {
-    const grpc_arg* arg = grpc_channel_args_find(
-        result.connected_subchannel->args(), GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN);
+      result.subchannel != nullptr) {
+    // Encode client stats object into metadata for use by
+    // client_load_reporting filter.
+    const grpc_arg* arg =
+        grpc_channel_args_find(result.subchannel->channel_args(),
+                               GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS);
+    if (arg != nullptr && arg->type == GRPC_ARG_POINTER &&
+        arg->value.pointer.p != nullptr) {
+      GrpcLbClientStats* client_stats =
+          static_cast<GrpcLbClientStats*>(arg->value.pointer.p);
+      client_stats->Ref().release();  // Ref passed via metadata.
+      // The metadata value is a hack: we pretend the pointer points to
+      // a string and rely on the client_load_reporting filter to know
+      // how to interpret it.
+      args.initial_metadata->Add(
+          kGrpcLbClientStatsMetadataKey,
+          StringView(reinterpret_cast<const char*>(client_stats), 0));
+      // Update calls-started.
+      client_stats->AddCallStarted();
+    }
+    // Encode the LB token in metadata.
+    arg = grpc_channel_args_find(result.subchannel->channel_args(),
+                                 GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN);
     if (arg == nullptr) {
-      gpr_log(GPR_ERROR,
-              "[grpclb %p picker %p] No LB token for connected subchannel %p",
-              parent_, this, result.connected_subchannel.get());
+      gpr_log(GPR_ERROR, "[grpclb %p picker %p] No LB token for subchannel %p",
+              parent_, this, result.subchannel.get());
       abort();
     }
-    grpc_mdelem lb_token = {reinterpret_cast<uintptr_t>(arg->value.pointer.p)};
-    GPR_ASSERT(!GRPC_MDISNULL(lb_token));
-    grpc_linked_mdelem* mdelem_storage = static_cast<grpc_linked_mdelem*>(
-        args.call_state->Alloc(sizeof(grpc_linked_mdelem)));
-    GPR_ASSERT(grpc_metadata_batch_add_tail(
-                   args.initial_metadata, mdelem_storage,
-                   GRPC_MDELEM_REF(lb_token)) == GRPC_ERROR_NONE);
-    GrpcLbClientStats* client_stats = static_cast<GrpcLbClientStats*>(
-        grpc_mdelem_get_user_data(lb_token, GrpcLbClientStats::Destroy));
-    if (client_stats != nullptr) {
-      client_stats->AddCallStarted();
-    }
+    args.initial_metadata->Add(kGrpcLbLbTokenMetadataKey,
+                               static_cast<char*>(arg->value.pointer.p));
   }
   return result;
 }
@@ -623,15 +650,6 @@ RefCountedPtr<SubchannelInterface> GrpcLb::Helper::CreateSubchannel(
   return parent_->channel_control_helper()->CreateSubchannel(args);
 }
 
-grpc_channel* GrpcLb::Helper::CreateChannel(const char* target,
-                                            const grpc_channel_args& args) {
-  if (parent_->shutting_down_ ||
-      (!CalledByPendingChild() && !CalledByCurrentChild())) {
-    return nullptr;
-  }
-  return parent_->channel_control_helper()->CreateChannel(target, args);
-}
-
 void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
                                  UniquePtr<SubchannelPicker> picker) {
   if (parent_->shutting_down_) return;
@@ -727,8 +745,7 @@ void GrpcLb::Helper::RequestReresolution() {
   }
 }
 
-void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity,
-                                   const char* message) {
+void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity, StringView message) {
   if (parent_->shutting_down_ ||
       (!CalledByPendingChild() && !CalledByCurrentChild())) {
     return;
@@ -761,13 +778,14 @@ GrpcLb::BalancerCallState::BalancerCallState(
       GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD,
       nullptr, deadline, nullptr);
   // Init the LB call request payload.
+  upb::Arena arena;
   grpc_grpclb_request* request =
-      grpc_grpclb_request_create(grpclb_policy()->server_name_);
-  grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
+      grpc_grpclb_request_create(grpclb_policy()->server_name_, arena.ptr());
+  grpc_slice request_payload_slice =
+      grpc_grpclb_request_encode(request, arena.ptr());
   send_message_payload_ =
       grpc_raw_byte_buffer_create(&request_payload_slice, 1);
   grpc_slice_unref_internal(request_payload_slice);
-  grpc_grpclb_request_destroy(request);
   // Init other data associated with the LB call.
   grpc_metadata_array_init(&lb_initial_metadata_recv_);
   grpc_metadata_array_init(&lb_trailing_metadata_recv_);
@@ -911,27 +929,32 @@ void GrpcLb::BalancerCallState::MaybeSendClientLoadReportLocked(
 
 bool GrpcLb::BalancerCallState::LoadReportCountersAreZero(
     grpc_grpclb_request* request) {
-  GrpcLbClientStats::DroppedCallCounts* drop_entries =
-      static_cast<GrpcLbClientStats::DroppedCallCounts*>(
-          request->client_stats.calls_finished_with_drop.arg);
-  return request->client_stats.num_calls_started == 0 &&
-         request->client_stats.num_calls_finished == 0 &&
-         request->client_stats.num_calls_finished_with_client_failed_to_send ==
+  const grpc_lb_v1_ClientStats* cstats =
+      grpc_lb_v1_LoadBalanceRequest_client_stats(request);
+  if (cstats == nullptr) {
+    return true;
+  }
+  size_t drop_count;
+  grpc_lb_v1_ClientStats_calls_finished_with_drop(cstats, &drop_count);
+  return grpc_lb_v1_ClientStats_num_calls_started(cstats) == 0 &&
+         grpc_lb_v1_ClientStats_num_calls_finished(cstats) == 0 &&
+         grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send(
+             cstats) == 0 &&
+         grpc_lb_v1_ClientStats_num_calls_finished_known_received(cstats) ==
              0 &&
-         request->client_stats.num_calls_finished_known_received == 0 &&
-         (drop_entries == nullptr || drop_entries->size() == 0);
+         drop_count == 0;
 }
 
 void GrpcLb::BalancerCallState::SendClientLoadReportLocked() {
   // Construct message payload.
   GPR_ASSERT(send_message_payload_ == nullptr);
+  upb::Arena arena;
   grpc_grpclb_request* request =
-      grpc_grpclb_load_report_request_create(client_stats_.get());
+      grpc_grpclb_load_report_request_create(client_stats_.get(), arena.ptr());
   // Skip client load report if the counters were all zero in the last
   // report and they are still zero in this one.
   if (LoadReportCountersAreZero(request)) {
     if (last_client_load_report_counters_were_zero_) {
-      grpc_grpclb_request_destroy(request);
       ScheduleNextClientLoadReportLocked();
       return;
     }
@@ -939,11 +962,11 @@ void GrpcLb::BalancerCallState::SendClientLoadReportLocked() {
   } else {
     last_client_load_report_counters_were_zero_ = false;
   }
-  grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
+  grpc_slice request_payload_slice =
+      grpc_grpclb_request_encode(request, arena.ptr());
   send_message_payload_ =
       grpc_raw_byte_buffer_create(&request_payload_slice, 1);
   grpc_slice_unref_internal(request_payload_slice);
-  grpc_grpclb_request_destroy(request);
   // Send the report.
   grpc_op op;
   memset(&op, 0, sizeof(op));
@@ -1005,16 +1028,20 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked(
   grpc_byte_buffer_reader_destroy(&bbr);
   grpc_byte_buffer_destroy(lb_calld->recv_message_payload_);
   lb_calld->recv_message_payload_ = nullptr;
-  grpc_grpclb_initial_response* initial_response;
+  const grpc_grpclb_initial_response* initial_response;
   grpc_grpclb_serverlist* serverlist;
+  upb::Arena arena;
   if (!lb_calld->seen_initial_response_ &&
-      (initial_response = grpc_grpclb_initial_response_parse(response_slice)) !=
-          nullptr) {
+      (initial_response = grpc_grpclb_initial_response_parse(
+           response_slice, arena.ptr())) != nullptr) {
     // Have NOT seen initial response, look for initial response.
-    if (initial_response->has_client_stats_report_interval) {
-      lb_calld->client_stats_report_interval_ = GPR_MAX(
-          GPR_MS_PER_SEC, grpc_grpclb_duration_to_millis(
-                              &initial_response->client_stats_report_interval));
+    const google_protobuf_Duration* client_stats_report_interval =
+        grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval(
+            initial_response);
+    if (client_stats_report_interval != nullptr) {
+      lb_calld->client_stats_report_interval_ =
+          GPR_MAX(GPR_MS_PER_SEC,
+                  grpc_grpclb_duration_to_millis(client_stats_report_interval));
       if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) {
         gpr_log(GPR_INFO,
                 "[grpclb %p] lb_calld=%p: Received initial LB response "
@@ -1029,7 +1056,6 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked(
               "client load reporting NOT enabled",
               grpclb_policy, lb_calld);
     }
-    grpc_grpclb_initial_response_destroy(initial_response);
     lb_calld->seen_initial_response_ = true;
   } else if ((serverlist = grpc_grpclb_response_parse_serverlist(
                   response_slice)) != nullptr) {
@@ -1238,7 +1264,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
       // the LB channel.
       GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
       // The LB channel should use the authority indicated by the target
-      // authority table (see \a grpc_lb_policy_grpclb_modify_lb_channel_args),
+      // authority table (see \a ModifyGrpclbBalancerChannelArgs),
       // as opposed to the authority from the parent channel.
       GRPC_ARG_DEFAULT_AUTHORITY,
       // Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be
@@ -1274,7 +1300,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
       args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(),
       args_to_add.size());
   // Make any necessary modifications for security.
-  return grpc_lb_policy_grpclb_modify_lb_channel_args(addresses, new_args);
+  return ModifyGrpclbBalancerChannelArgs(addresses, new_args);
 }
 
 //
@@ -1415,10 +1441,10 @@ void GrpcLb::UpdateLocked(UpdateArgs args) {
 
 // Returns the backend addresses extracted from the given addresses.
 ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) {
-  void* lb_token = (void*)GRPC_MDELEM_LB_TOKEN_EMPTY.payload;
+  static const char* lb_token = "";
   grpc_arg arg = grpc_channel_arg_pointer_create(
-      const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token,
-      &lb_token_arg_vtable);
+      const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN),
+      const_cast<char*>(lb_token), &lb_token_arg_vtable);
   ServerAddressList backend_addresses;
   for (size_t i = 0; i < addresses.size(); ++i) {
     if (!addresses[i].IsBalancer()) {
@@ -1450,8 +1476,7 @@ void GrpcLb::ProcessAddressesAndChannelArgsLocked(
   if (lb_channel_ == nullptr) {
     char* uri_str;
     gpr_asprintf(&uri_str, "fake:///%s", server_name_);
-    lb_channel_ =
-        channel_control_helper()->CreateChannel(uri_str, *lb_channel_args);
+    lb_channel_ = CreateGrpclbBalancerChannel(uri_str, *lb_channel_args);
     GPR_ASSERT(lb_channel_ != nullptr);
     gpr_free(uri_str);
   }
@@ -1830,7 +1855,12 @@ bool maybe_add_client_load_reporting_filter(grpc_channel_stack_builder* builder,
       grpc_channel_args_find(args, GRPC_ARG_LB_POLICY_NAME);
   if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_STRING &&
       strcmp(channel_arg->value.string, "grpclb") == 0) {
-    return grpc_channel_stack_builder_append_filter(
+    // TODO(roth): When we get around to re-attempting
+    // https://github.com/grpc/grpc/pull/16214, we should try to keep
+    // this filter at the very top of the subchannel stack, since that
+    // will minimize the number of metadata elements that the filter
+    // needs to iterate through to find the ClientStats object.
+    return grpc_channel_stack_builder_prepend_filter(
         builder, (const grpc_channel_filter*)arg, nullptr, nullptr);
   }
   return true;
index 4d39c4d..a032b5d 100644 (file)
 #define GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER \
   "grpc.address_is_backend_from_grpclb_load_balancer"
 
+namespace grpc_core {
+
+extern const char kGrpcLbClientStatsMetadataKey[];
+extern const char kGrpcLbLbTokenMetadataKey[];
+
+}  // namespace grpc_core
+
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H \
         */
index b713e26..c723763 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include <grpc/grpc.h>
+
 #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h"
 
-grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args(
-    const grpc_core::ServerAddressList& addresses, grpc_channel_args* args) {
+namespace grpc_core {
+
+grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
+    const ServerAddressList& addresses, grpc_channel_args* args) {
   return args;
 }
+
+grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
+                                          const grpc_channel_args& args) {
+  return grpc_insecure_channel_create(target_uri, &args, nullptr);
+}
+
+}  // namespace grpc_core
index c78ba36..1458233 100644 (file)
 
 #include "src/core/ext/filters/client_channel/server_address.h"
 
+namespace grpc_core {
+
 /// Makes any necessary modifications to \a args for use in the grpclb
 /// balancer channel.
 ///
 /// Takes ownership of \a args.
 ///
 /// Caller takes ownership of the returned args.
-grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args(
-    const grpc_core::ServerAddressList& addresses, grpc_channel_args* args);
+grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
+    const ServerAddressList& addresses, grpc_channel_args* args);
+
+grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
+                                          const grpc_channel_args& args);
+
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \
         */
index 892cdeb..5bc4f51 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <string.h>
 
+#include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
 
@@ -35,6 +36,7 @@
 #include "src/core/lib/slice/slice_internal.h"
 
 namespace grpc_core {
+
 namespace {
 
 int BalancerNameCmp(const grpc_core::UniquePtr<char>& a,
@@ -65,37 +67,53 @@ RefCountedPtr<TargetAuthorityTable> CreateTargetAuthorityTable(
 }
 
 }  // namespace
-}  // namespace grpc_core
 
-grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args(
-    const grpc_core::ServerAddressList& addresses, grpc_channel_args* args) {
-  const char* args_to_remove[1];
-  size_t num_args_to_remove = 0;
-  grpc_arg args_to_add[2];
-  size_t num_args_to_add = 0;
+grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
+    const ServerAddressList& addresses, grpc_channel_args* args) {
+  InlinedVector<const char*, 1> args_to_remove;
+  InlinedVector<grpc_arg, 2> args_to_add;
   // Add arg for targets info table.
-  grpc_core::RefCountedPtr<grpc_core::TargetAuthorityTable>
-      target_authority_table = grpc_core::CreateTargetAuthorityTable(addresses);
-  args_to_add[num_args_to_add++] =
-      grpc_core::CreateTargetAuthorityTableChannelArg(
-          target_authority_table.get());
+  RefCountedPtr<TargetAuthorityTable> target_authority_table =
+      CreateTargetAuthorityTable(addresses);
+  args_to_add.emplace_back(
+      CreateTargetAuthorityTableChannelArg(target_authority_table.get()));
   // Substitute the channel credentials with a version without call
   // credentials: the load balancer is not necessarily trusted to handle
   // bearer token credentials.
   grpc_channel_credentials* channel_credentials =
       grpc_channel_credentials_find_in_args(args);
-  grpc_core::RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
+  RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
   if (channel_credentials != nullptr) {
     creds_sans_call_creds =
         channel_credentials->duplicate_without_call_credentials();
     GPR_ASSERT(creds_sans_call_creds != nullptr);
-    args_to_remove[num_args_to_remove++] = GRPC_ARG_CHANNEL_CREDENTIALS;
-    args_to_add[num_args_to_add++] =
-        grpc_channel_credentials_to_arg(creds_sans_call_creds.get());
+    args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS);
+    args_to_add.emplace_back(
+        grpc_channel_credentials_to_arg(creds_sans_call_creds.get()));
   }
   grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove(
-      args, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add);
+      args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
+      args_to_add.size());
   // Clean up.
   grpc_channel_args_destroy(args);
   return result;
 }
+
+grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
+                                          const grpc_channel_args& args) {
+  grpc_channel_credentials* creds =
+      grpc_channel_credentials_find_in_args(&args);
+  if (creds == nullptr) {
+    // Build with security but parent channel is insecure.
+    return grpc_insecure_channel_create(target_uri, &args, nullptr);
+  }
+  const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
+  grpc_channel_args* new_args =
+      grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
+  grpc_channel* channel =
+      grpc_secure_channel_create(creds, target_uri, new_args, nullptr);
+  grpc_channel_args_destroy(new_args);
+  return channel;
+}
+
+}  // namespace grpc_core
index 22cefc9..68097e1 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
-#include "pb_decode.h"
-#include "pb_encode.h"
 #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
+#include "src/core/lib/gpr/useful.h"
 
-#include <grpc/support/alloc.h>
-
-/* invoked once for every Server in ServerList */
-static bool count_serverlist(pb_istream_t* stream, const pb_field_t* field,
-                             void** arg) {
-  grpc_grpclb_serverlist* sl = static_cast<grpc_grpclb_serverlist*>(*arg);
-  grpc_grpclb_server server;
-  if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, &server))) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream));
-    return false;
-  }
-  ++sl->num_servers;
-  return true;
-}
-
-typedef struct decode_serverlist_arg {
-  /* The decoding callback is invoked once per server in serverlist. Remember
-   * which index of the serverlist are we currently decoding */
-  size_t decoding_idx;
-  /* The decoded serverlist */
-  grpc_grpclb_serverlist* serverlist;
-} decode_serverlist_arg;
+#include "google/protobuf/duration.upb.h"
+#include "google/protobuf/timestamp.upb.h"
 
-/* invoked once for every Server in ServerList */
-static bool decode_serverlist(pb_istream_t* stream, const pb_field_t* field,
-                              void** arg) {
-  decode_serverlist_arg* dec_arg = static_cast<decode_serverlist_arg*>(*arg);
-  GPR_ASSERT(dec_arg->serverlist->num_servers >= dec_arg->decoding_idx);
-  grpc_grpclb_server* server =
-      static_cast<grpc_grpclb_server*>(gpr_zalloc(sizeof(grpc_grpclb_server)));
-  if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, server))) {
-    gpr_free(server);
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream));
-    return false;
-  }
-  dec_arg->serverlist->servers[dec_arg->decoding_idx++] = server;
-  return true;
-}
+#include <grpc/support/alloc.h>
 
-grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name) {
-  grpc_grpclb_request* req = static_cast<grpc_grpclb_request*>(
-      gpr_malloc(sizeof(grpc_grpclb_request)));
-  req->has_client_stats = false;
-  req->has_initial_request = true;
-  req->initial_request.has_name = true;
-  // GCC warns (-Wstringop-truncation) because the destination
-  // buffer size is identical to max-size, leading to a potential
-  // char[] with no null terminator.  nanopb can handle it fine,
-  // and parantheses around strncpy silence that compiler warning.
-  (strncpy(req->initial_request.name, lb_service_name,
-           GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH));
+namespace grpc_core {
+
+grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name,
+                                                upb_arena* arena) {
+  grpc_grpclb_request* req = grpc_lb_v1_LoadBalanceRequest_new(arena);
+  grpc_lb_v1_InitialLoadBalanceRequest* initial_request =
+      grpc_lb_v1_LoadBalanceRequest_mutable_initial_request(req, arena);
+  size_t name_len =
+      GPR_MIN(strlen(lb_service_name), GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH);
+  grpc_lb_v1_InitialLoadBalanceRequest_set_name(
+      initial_request, upb_strview_make(lb_service_name, name_len));
   return req;
 }
 
-static void populate_timestamp(gpr_timespec timestamp,
-                               grpc_grpclb_timestamp* timestamp_pb) {
-  timestamp_pb->has_seconds = true;
-  timestamp_pb->seconds = timestamp.tv_sec;
-  timestamp_pb->has_nanos = true;
-  timestamp_pb->nanos = timestamp.tv_nsec;
-}
+namespace {
 
-static bool encode_string(pb_ostream_t* stream, const pb_field_t* field,
-                          void* const* arg) {
-  char* str = static_cast<char*>(*arg);
-  if (!pb_encode_tag_for_field(stream, field)) return false;
-  return pb_encode_string(stream, reinterpret_cast<uint8_t*>(str), strlen(str));
+void google_protobuf_Timestamp_assign(google_protobuf_Timestamp* timestamp,
+                                      const gpr_timespec& value) {
+  google_protobuf_Timestamp_set_seconds(timestamp, value.tv_sec);
+  google_protobuf_Timestamp_set_nanos(timestamp, value.tv_nsec);
 }
 
-static bool encode_drops(pb_ostream_t* stream, const pb_field_t* field,
-                         void* const* arg) {
-  grpc_core::GrpcLbClientStats::DroppedCallCounts* drop_entries =
-      static_cast<grpc_core::GrpcLbClientStats::DroppedCallCounts*>(*arg);
-  if (drop_entries == nullptr) return true;
-  for (size_t i = 0; i < drop_entries->size(); ++i) {
-    if (!pb_encode_tag_for_field(stream, field)) return false;
-    grpc_lb_v1_ClientStatsPerToken drop_message;
-    drop_message.load_balance_token.funcs.encode = encode_string;
-    drop_message.load_balance_token.arg = (*drop_entries)[i].token.get();
-    drop_message.has_num_calls = true;
-    drop_message.num_calls = (*drop_entries)[i].count;
-    if (!pb_encode_submessage(stream, grpc_lb_v1_ClientStatsPerToken_fields,
-                              &drop_message)) {
-      return false;
-    }
-  }
-  return true;
-}
+}  // namespace
 
 grpc_grpclb_request* grpc_grpclb_load_report_request_create(
-    grpc_core::GrpcLbClientStats* client_stats) {
-  grpc_grpclb_request* req = static_cast<grpc_grpclb_request*>(
-      gpr_zalloc(sizeof(grpc_grpclb_request)));
-  req->has_client_stats = true;
-  req->client_stats.has_timestamp = true;
-  populate_timestamp(gpr_now(GPR_CLOCK_REALTIME), &req->client_stats.timestamp);
-  req->client_stats.has_num_calls_started = true;
-  req->client_stats.has_num_calls_finished = true;
-  req->client_stats.has_num_calls_finished_with_client_failed_to_send = true;
-  req->client_stats.has_num_calls_finished_with_client_failed_to_send = true;
-  req->client_stats.has_num_calls_finished_known_received = true;
-  req->client_stats.calls_finished_with_drop.funcs.encode = encode_drops;
-  grpc_core::UniquePtr<grpc_core::GrpcLbClientStats::DroppedCallCounts>
-      drop_counts;
-  client_stats->Get(
-      &req->client_stats.num_calls_started,
-      &req->client_stats.num_calls_finished,
-      &req->client_stats.num_calls_finished_with_client_failed_to_send,
-      &req->client_stats.num_calls_finished_known_received, &drop_counts);
-  // Will be deleted in grpc_grpclb_request_destroy().
-  req->client_stats.calls_finished_with_drop.arg = drop_counts.release();
+    GrpcLbClientStats* client_stats, upb_arena* arena) {
+  grpc_grpclb_request* req = grpc_lb_v1_LoadBalanceRequest_new(arena);
+  grpc_lb_v1_ClientStats* req_stats =
+      grpc_lb_v1_LoadBalanceRequest_mutable_client_stats(req, arena);
+  google_protobuf_Timestamp_assign(
+      grpc_lb_v1_ClientStats_mutable_timestamp(req_stats, arena),
+      gpr_now(GPR_CLOCK_REALTIME));
+
+  int64_t num_calls_started;
+  int64_t num_calls_finished;
+  int64_t num_calls_finished_with_client_failed_to_send;
+  int64_t num_calls_finished_known_received;
+  UniquePtr<GrpcLbClientStats::DroppedCallCounts> drop_token_counts;
+  client_stats->Get(&num_calls_started, &num_calls_finished,
+                    &num_calls_finished_with_client_failed_to_send,
+                    &num_calls_finished_known_received, &drop_token_counts);
+  grpc_lb_v1_ClientStats_set_num_calls_started(req_stats, num_calls_started);
+  grpc_lb_v1_ClientStats_set_num_calls_finished(req_stats, num_calls_finished);
+  grpc_lb_v1_ClientStats_set_num_calls_finished_with_client_failed_to_send(
+      req_stats, num_calls_finished_with_client_failed_to_send);
+  grpc_lb_v1_ClientStats_set_num_calls_finished_known_received(
+      req_stats, num_calls_finished_known_received);
+  if (drop_token_counts != nullptr) {
+    for (size_t i = 0; i < drop_token_counts->size(); ++i) {
+      GrpcLbClientStats::DropTokenCount& cur = (*drop_token_counts)[i];
+      grpc_lb_v1_ClientStatsPerToken* cur_msg =
+          grpc_lb_v1_ClientStats_add_calls_finished_with_drop(req_stats, arena);
+
+      const size_t token_len = strlen(cur.token.get());
+      char* token = reinterpret_cast<char*>(upb_arena_malloc(arena, token_len));
+      memcpy(token, cur.token.get(), token_len);
+
+      grpc_lb_v1_ClientStatsPerToken_set_load_balance_token(
+          cur_msg, upb_strview_make(token, token_len));
+      grpc_lb_v1_ClientStatsPerToken_set_num_calls(cur_msg, cur.count);
+    }
+  }
   return req;
 }
 
-grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request) {
-  size_t encoded_length;
-  pb_ostream_t sizestream;
-  pb_ostream_t outputstream;
-  grpc_slice slice;
-  memset(&sizestream, 0, sizeof(pb_ostream_t));
-  pb_encode(&sizestream, grpc_lb_v1_LoadBalanceRequest_fields, request);
-  encoded_length = sizestream.bytes_written;
-
-  slice = GRPC_SLICE_MALLOC(encoded_length);
-  outputstream =
-      pb_ostream_from_buffer(GRPC_SLICE_START_PTR(slice), encoded_length);
-  GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v1_LoadBalanceRequest_fields,
-                       request) != 0);
-  return slice;
-}
-
-void grpc_grpclb_request_destroy(grpc_grpclb_request* request) {
-  if (request->has_client_stats) {
-    grpc_core::GrpcLbClientStats::DroppedCallCounts* drop_entries =
-        static_cast<grpc_core::GrpcLbClientStats::DroppedCallCounts*>(
-            request->client_stats.calls_finished_with_drop.arg);
-    grpc_core::Delete(drop_entries);
-  }
-  gpr_free(request);
+grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request,
+                                      upb_arena* arena) {
+  size_t buf_length;
+  char* buf =
+      grpc_lb_v1_LoadBalanceRequest_serialize(request, arena, &buf_length);
+  return grpc_slice_from_copied_buffer(buf, buf_length);
 }
 
-typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response;
-grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse(
-    const grpc_slice& encoded_grpc_grpclb_response) {
-  pb_istream_t stream = pb_istream_from_buffer(
-      const_cast<uint8_t*>(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)),
-      GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response));
-  grpc_grpclb_response res;
-  memset(&res, 0, sizeof(grpc_grpclb_response));
-  if (GPR_UNLIKELY(
-          !pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res))) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
+const grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse(
+    const grpc_slice& encoded_grpc_grpclb_response, upb_arena* arena) {
+  grpc_lb_v1_LoadBalanceResponse* response =
+      grpc_lb_v1_LoadBalanceResponse_parse(
+          reinterpret_cast<const char*>(
+              GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)),
+          GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response), arena);
+  if (response == nullptr) {
+    gpr_log(GPR_ERROR, "grpc_lb_v1_LoadBalanceResponse parse error");
     return nullptr;
   }
-
-  if (!res.has_initial_response) return nullptr;
-
-  grpc_grpclb_initial_response* initial_res =
-      static_cast<grpc_grpclb_initial_response*>(
-          gpr_malloc(sizeof(grpc_grpclb_initial_response)));
-  memcpy(initial_res, &res.initial_response,
-         sizeof(grpc_grpclb_initial_response));
-
-  return initial_res;
+  return grpc_lb_v1_LoadBalanceResponse_initial_response(response);
 }
 
 grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
     const grpc_slice& encoded_grpc_grpclb_response) {
-  pb_istream_t stream = pb_istream_from_buffer(
-      const_cast<uint8_t*>(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)),
-      GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response));
-  pb_istream_t stream_at_start = stream;
-  grpc_grpclb_serverlist* sl = static_cast<grpc_grpclb_serverlist*>(
+  upb::Arena arena;
+  grpc_lb_v1_LoadBalanceResponse* response =
+      grpc_lb_v1_LoadBalanceResponse_parse(
+          reinterpret_cast<const char*>(
+              GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response)),
+          GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response), arena.ptr());
+  if (response == nullptr) {
+    gpr_log(GPR_ERROR, "grpc_lb_v1_LoadBalanceResponse parse error");
+    return nullptr;
+  }
+  grpc_grpclb_serverlist* server_list = static_cast<grpc_grpclb_serverlist*>(
       gpr_zalloc(sizeof(grpc_grpclb_serverlist)));
-  grpc_grpclb_response res;
-  memset(&res, 0, sizeof(grpc_grpclb_response));
   // First pass: count number of servers.
-  res.server_list.servers.funcs.decode = count_serverlist;
-  res.server_list.servers.arg = sl;
-  bool status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res);
-  if (GPR_UNLIKELY(!status)) {
-    gpr_free(sl);
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
-    return nullptr;
+  const grpc_lb_v1_ServerList* server_list_msg =
+      grpc_lb_v1_LoadBalanceResponse_server_list(response);
+  size_t server_count = 0;
+  const grpc_lb_v1_Server* const* servers = nullptr;
+  if (server_list_msg != nullptr) {
+    servers = grpc_lb_v1_ServerList_servers(server_list_msg, &server_count);
   }
   // Second pass: populate servers.
-  if (sl->num_servers > 0) {
-    sl->servers = static_cast<grpc_grpclb_server**>(
-        gpr_zalloc(sizeof(grpc_grpclb_server*) * sl->num_servers));
-    decode_serverlist_arg decode_arg;
-    memset(&decode_arg, 0, sizeof(decode_arg));
-    decode_arg.serverlist = sl;
-    res.server_list.servers.funcs.decode = decode_serverlist;
-    res.server_list.servers.arg = &decode_arg;
-    status = pb_decode(&stream_at_start, grpc_lb_v1_LoadBalanceResponse_fields,
-                       &res);
-    if (GPR_UNLIKELY(!status)) {
-      grpc_grpclb_destroy_serverlist(sl);
-      gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
-      return nullptr;
+  if (server_count > 0) {
+    server_list->servers = static_cast<grpc_grpclb_server**>(
+        gpr_zalloc(sizeof(grpc_grpclb_server*) * server_count));
+    server_list->num_servers = server_count;
+    for (size_t i = 0; i < server_count; ++i) {
+      grpc_grpclb_server* cur = server_list->servers[i] =
+          static_cast<grpc_grpclb_server*>(
+              gpr_zalloc(sizeof(grpc_grpclb_server)));
+      upb_strview address = grpc_lb_v1_Server_ip_address(servers[i]);
+      if (address.size == 0) {
+        ;  // Nothing to do because cur->ip_address is an empty string.
+      } else if (address.size <= GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE) {
+        cur->ip_address.size = static_cast<int32_t>(address.size);
+        memcpy(cur->ip_address.data, address.data, address.size);
+      }
+      cur->port = grpc_lb_v1_Server_port(servers[i]);
+      upb_strview token = grpc_lb_v1_Server_load_balance_token(servers[i]);
+      if (token.size == 0) {
+        ;  // Nothing to do because cur->load_balance_token is an empty string.
+      } else if (token.size <= GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE) {
+        memcpy(cur->load_balance_token, token.data, token.size);
+      } else {
+        gpr_log(GPR_ERROR,
+                "grpc_lb_v1_LoadBalanceResponse has too long token. len=%zu",
+                token.size);
+      }
+      cur->drop = grpc_lb_v1_Server_drop(servers[i]);
     }
   }
-  return sl;
+  return server_list;
 }
 
 void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist) {
@@ -239,16 +180,17 @@ void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist) {
 }
 
 grpc_grpclb_serverlist* grpc_grpclb_serverlist_copy(
-    const grpc_grpclb_serverlist* sl) {
+    const grpc_grpclb_serverlist* server_list) {
   grpc_grpclb_serverlist* copy = static_cast<grpc_grpclb_serverlist*>(
       gpr_zalloc(sizeof(grpc_grpclb_serverlist)));
-  copy->num_servers = sl->num_servers;
+  copy->num_servers = server_list->num_servers;
   copy->servers = static_cast<grpc_grpclb_server**>(
-      gpr_malloc(sizeof(grpc_grpclb_server*) * sl->num_servers));
-  for (size_t i = 0; i < sl->num_servers; i++) {
+      gpr_malloc(sizeof(grpc_grpclb_server*) * server_list->num_servers));
+  for (size_t i = 0; i < server_list->num_servers; i++) {
     copy->servers[i] = static_cast<grpc_grpclb_server*>(
         gpr_malloc(sizeof(grpc_grpclb_server)));
-    memcpy(copy->servers[i], sl->servers[i], sizeof(grpc_grpclb_server));
+    memcpy(copy->servers[i], server_list->servers[i],
+           sizeof(grpc_grpclb_server));
   }
   return copy;
 }
@@ -274,38 +216,11 @@ bool grpc_grpclb_server_equals(const grpc_grpclb_server* lhs,
   return memcmp(lhs, rhs, sizeof(grpc_grpclb_server)) == 0;
 }
 
-int grpc_grpclb_duration_compare(const grpc_grpclb_duration* lhs,
-                                 const grpc_grpclb_duration* rhs) {
-  GPR_ASSERT(lhs && rhs);
-  if (lhs->has_seconds && rhs->has_seconds) {
-    if (lhs->seconds < rhs->seconds) return -1;
-    if (lhs->seconds > rhs->seconds) return 1;
-  } else if (lhs->has_seconds) {
-    return 1;
-  } else if (rhs->has_seconds) {
-    return -1;
-  }
-
-  GPR_ASSERT(lhs->seconds == rhs->seconds);
-  if (lhs->has_nanos && rhs->has_nanos) {
-    if (lhs->nanos < rhs->nanos) return -1;
-    if (lhs->nanos > rhs->nanos) return 1;
-  } else if (lhs->has_nanos) {
-    return 1;
-  } else if (rhs->has_nanos) {
-    return -1;
-  }
-
-  return 0;
-}
-
-grpc_millis grpc_grpclb_duration_to_millis(grpc_grpclb_duration* duration_pb) {
+grpc_millis grpc_grpclb_duration_to_millis(
+    const grpc_grpclb_duration* duration_pb) {
   return static_cast<grpc_millis>(
-      (duration_pb->has_seconds ? duration_pb->seconds : 0) * GPR_MS_PER_SEC +
-      (duration_pb->has_nanos ? duration_pb->nanos : 0) / GPR_NS_PER_MS);
+      google_protobuf_Duration_seconds(duration_pb) * GPR_MS_PER_SEC +
+      google_protobuf_Duration_nanos(duration_pb) / GPR_NS_PER_MS);
 }
 
-void grpc_grpclb_initial_response_destroy(
-    grpc_grpclb_initial_response* response) {
-  gpr_free(response);
-}
+}  // namespace grpc_core
index 8005f6f..3062e95 100644 (file)
 #include <grpc/slice_buffer.h>
 
 #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h"
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/proto/grpc/lb/v1/load_balancer.upb.h"
 
 #define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128
+#define GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE 16
+#define GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE 50
+
+namespace grpc_core {
 
-typedef grpc_lb_v1_Server_ip_address_t grpc_grpclb_ip_address;
 typedef grpc_lb_v1_LoadBalanceRequest grpc_grpclb_request;
+typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response;
 typedef grpc_lb_v1_InitialLoadBalanceResponse grpc_grpclb_initial_response;
-typedef grpc_lb_v1_Server grpc_grpclb_server;
 typedef google_protobuf_Duration grpc_grpclb_duration;
 typedef google_protobuf_Timestamp grpc_grpclb_timestamp;
 
 typedef struct {
+  int32_t size;
+  char data[GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE];
+} grpc_grpclb_server_ip_address;
+
+// Contains server information. When the drop field is not true, use the other
+// fields.
+typedef struct {
+  grpc_grpclb_server_ip_address ip_address;
+  int32_t port;
+  char load_balance_token[GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE];
+  bool drop;
+} grpc_grpclb_server;
+
+typedef struct {
   grpc_grpclb_server** servers;
   size_t num_servers;
 } grpc_grpclb_serverlist;
 
-/** Create a request for a gRPC LB service under \a lb_service_name */
-grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name);
+/**
+ * Create a request for a gRPC LB service under \a lb_service_name.
+ * \a lb_service_name should be alive when returned request is being used.
+ */
+grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name,
+                                                upb_arena* arena);
 grpc_grpclb_request* grpc_grpclb_load_report_request_create(
-    grpc_core::GrpcLbClientStats* client_stats);
+    grpc_core::GrpcLbClientStats* client_stats, upb_arena* arena);
 
 /** Protocol Buffers v3-encode \a request */
-grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request);
-
-/** Destroy \a request */
-void grpc_grpclb_request_destroy(grpc_grpclb_request* request);
+grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request,
+                                      upb_arena* arena);
 
 /** Parse (ie, decode) the bytes in \a encoded_grpc_grpclb_response as a \a
  * grpc_grpclb_initial_response */
-grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse(
-    const grpc_slice& encoded_grpc_grpclb_response);
+const grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse(
+    const grpc_slice& encoded_grpc_grpclb_response, upb_arena* arena);
 
 /** Parse the list of servers from an encoded \a grpc_grpclb_response */
 grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
@@ -75,16 +94,10 @@ bool grpc_grpclb_server_equals(const grpc_grpclb_server* lhs,
 /** Destroy \a serverlist */
 void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist);
 
-/** Compare \a lhs against \a rhs and return 0 if \a lhs and \a rhs are equal,
- * < 0 if \a lhs represents a duration shorter than \a rhs and > 0 otherwise */
-int grpc_grpclb_duration_compare(const grpc_grpclb_duration* lhs,
-                                 const grpc_grpclb_duration* rhs);
-
-grpc_millis grpc_grpclb_duration_to_millis(grpc_grpclb_duration* duration_pb);
+grpc_millis grpc_grpclb_duration_to_millis(
+    const grpc_grpclb_duration* duration_pb);
 
-/** Destroy \a initial_response */
-void grpc_grpclb_initial_response_destroy(
-    grpc_grpclb_initial_response* response);
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H \
         */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c
deleted file mode 100644 (file)
index 131d9b7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t google_protobuf_Duration_fields[3] = {
-    PB_FIELD(  1, INT64   , OPTIONAL, STATIC  , FIRST, google_protobuf_Duration, seconds, seconds, 0),
-    PB_FIELD(  2, INT32   , OPTIONAL, STATIC  , OTHER, google_protobuf_Duration, nanos, seconds, 0),
-    PB_LAST_FIELD
-};
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h
deleted file mode 100644 (file)
index 93070c6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GOOGLE_PROTOBUF_DURATION_PB_H_INCLUDED
-#define PB_GOOGLE_PROTOBUF_DURATION_PB_H_INCLUDED
-#include "pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Struct definitions */
-typedef struct _google_protobuf_Duration {
-    bool has_seconds;
-    int64_t seconds;
-    bool has_nanos;
-    int32_t nanos;
-/* @@protoc_insertion_point(struct:google_protobuf_Duration) */
-} google_protobuf_Duration;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define google_protobuf_Duration_init_default    {false, 0, false, 0}
-#define google_protobuf_Duration_init_zero       {false, 0, false, 0}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define google_protobuf_Duration_seconds_tag     1
-#define google_protobuf_Duration_nanos_tag       2
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t google_protobuf_Duration_fields[3];
-
-/* Maximum encoded size of messages (where known) */
-#define google_protobuf_Duration_size            22
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define DURATION_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c
deleted file mode 100644 (file)
index b6f8ffc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t google_protobuf_Timestamp_fields[3] = {
-    PB_FIELD(  1, INT64   , OPTIONAL, STATIC  , FIRST, google_protobuf_Timestamp, seconds, seconds, 0),
-    PB_FIELD(  2, INT32   , OPTIONAL, STATIC  , OTHER, google_protobuf_Timestamp, nanos, seconds, 0),
-    PB_LAST_FIELD
-};
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h
deleted file mode 100644 (file)
index 7f48481..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
-#define PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
-#include "pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Struct definitions */
-typedef struct _google_protobuf_Timestamp {
-    bool has_seconds;
-    int64_t seconds;
-    bool has_nanos;
-    int32_t nanos;
-/* @@protoc_insertion_point(struct:google_protobuf_Timestamp) */
-} google_protobuf_Timestamp;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define google_protobuf_Timestamp_init_default   {false, 0, false, 0}
-#define google_protobuf_Timestamp_init_zero      {false, 0, false, 0}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define google_protobuf_Timestamp_seconds_tag    1
-#define google_protobuf_Timestamp_nanos_tag      2
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t google_protobuf_Timestamp_fields[3];
-
-/* Maximum encoded size of messages (where known) */
-#define google_protobuf_Timestamp_size           22
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define TIMESTAMP_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c
deleted file mode 100644 (file)
index f6538e1..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3] = {
-    PB_FIELD(  1, MESSAGE , OPTIONAL, STATIC  , FIRST, grpc_lb_v1_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v1_InitialLoadBalanceRequest_fields),
-    PB_FIELD(  2, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v1_ClientStats_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, STATIC  , FIRST, grpc_lb_v1_InitialLoadBalanceRequest, name, name, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, CALLBACK, FIRST, grpc_lb_v1_ClientStatsPerToken, load_balance_token, load_balance_token, 0),
-    PB_FIELD(  2, INT64   , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_ClientStatsPerToken, num_calls, load_balance_token, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_ClientStats_fields[7] = {
-    PB_FIELD(  1, MESSAGE , OPTIONAL, STATIC  , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &google_protobuf_Timestamp_fields),
-    PB_FIELD(  2, INT64   , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_ClientStats, num_calls_started, timestamp, 0),
-    PB_FIELD(  3, INT64   , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_ClientStats, num_calls_finished, num_calls_started, 0),
-    PB_FIELD(  6, INT64   , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_client_failed_to_send, num_calls_finished, 0),
-    PB_FIELD(  7, INT64   , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_known_received, num_calls_finished_with_client_failed_to_send, 0),
-    PB_FIELD(  8, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_lb_v1_ClientStats, calls_finished_with_drop, num_calls_finished_known_received, &grpc_lb_v1_ClientStatsPerToken_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3] = {
-    PB_FIELD(  1, MESSAGE , OPTIONAL, STATIC  , FIRST, grpc_lb_v1_LoadBalanceResponse, initial_response, initial_response, &grpc_lb_v1_InitialLoadBalanceResponse_fields),
-    PB_FIELD(  2, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_LoadBalanceResponse, server_list, initial_response, &grpc_lb_v1_ServerList_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, STATIC  , FIRST, grpc_lb_v1_InitialLoadBalanceResponse, load_balancer_delegate, load_balancer_delegate, 0),
-    PB_FIELD(  2, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &google_protobuf_Duration_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_ServerList_fields[2] = {
-    PB_FIELD(  1, MESSAGE , REPEATED, CALLBACK, FIRST, grpc_lb_v1_ServerList, servers, servers, &grpc_lb_v1_Server_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_lb_v1_Server_fields[5] = {
-    PB_FIELD(  1, BYTES   , OPTIONAL, STATIC  , FIRST, grpc_lb_v1_Server, ip_address, ip_address, 0),
-    PB_FIELD(  2, INT32   , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_Server, port, ip_address, 0),
-    PB_FIELD(  3, STRING  , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_Server, load_balance_token, port, 0),
-    PB_FIELD(  4, BOOL    , OPTIONAL, STATIC  , OTHER, grpc_lb_v1_Server, drop, load_balance_token, 0),
-    PB_LAST_FIELD
-};
-
-
-/* Check that field information fits in pb_field_t */
-#if !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_32BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in 8 or 16 bit
- * field descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
-#endif
-
-#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_16BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in the default
- * 8 bit descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
-#endif
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
deleted file mode 100644 (file)
index a4ff516..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
-#define PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
-#include "pb.h"
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h"
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Struct definitions */
-typedef struct _grpc_lb_v1_ServerList {
-    pb_callback_t servers;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */
-} grpc_lb_v1_ServerList;
-
-typedef struct _grpc_lb_v1_ClientStats {
-    bool has_timestamp;
-    google_protobuf_Timestamp timestamp;
-    bool has_num_calls_started;
-    int64_t num_calls_started;
-    bool has_num_calls_finished;
-    int64_t num_calls_finished;
-    bool has_num_calls_finished_with_client_failed_to_send;
-    int64_t num_calls_finished_with_client_failed_to_send;
-    bool has_num_calls_finished_known_received;
-    int64_t num_calls_finished_known_received;
-    pb_callback_t calls_finished_with_drop;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */
-} grpc_lb_v1_ClientStats;
-
-typedef struct _grpc_lb_v1_ClientStatsPerToken {
-    pb_callback_t load_balance_token;
-    bool has_num_calls;
-    int64_t num_calls;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStatsPerToken) */
-} grpc_lb_v1_ClientStatsPerToken;
-
-typedef struct _grpc_lb_v1_InitialLoadBalanceRequest {
-    bool has_name;
-    char name[128];
-/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceRequest) */
-} grpc_lb_v1_InitialLoadBalanceRequest;
-
-typedef struct _grpc_lb_v1_InitialLoadBalanceResponse {
-    bool has_load_balancer_delegate;
-    char load_balancer_delegate[64];
-    bool has_client_stats_report_interval;
-    google_protobuf_Duration client_stats_report_interval;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */
-} grpc_lb_v1_InitialLoadBalanceResponse;
-
-typedef PB_BYTES_ARRAY_T(16) grpc_lb_v1_Server_ip_address_t;
-typedef struct _grpc_lb_v1_Server {
-    bool has_ip_address;
-    grpc_lb_v1_Server_ip_address_t ip_address;
-    bool has_port;
-    int32_t port;
-    bool has_load_balance_token;
-    char load_balance_token[50];
-    bool has_drop;
-    bool drop;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_Server) */
-} grpc_lb_v1_Server;
-
-typedef struct _grpc_lb_v1_LoadBalanceRequest {
-    bool has_initial_request;
-    grpc_lb_v1_InitialLoadBalanceRequest initial_request;
-    bool has_client_stats;
-    grpc_lb_v1_ClientStats client_stats;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceRequest) */
-} grpc_lb_v1_LoadBalanceRequest;
-
-typedef struct _grpc_lb_v1_LoadBalanceResponse {
-    bool has_initial_response;
-    grpc_lb_v1_InitialLoadBalanceResponse initial_response;
-    bool has_server_list;
-    grpc_lb_v1_ServerList server_list;
-/* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceResponse) */
-} grpc_lb_v1_LoadBalanceResponse;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define grpc_lb_v1_LoadBalanceRequest_init_default {false, grpc_lb_v1_InitialLoadBalanceRequest_init_default, false, grpc_lb_v1_ClientStats_init_default}
-#define grpc_lb_v1_InitialLoadBalanceRequest_init_default {false, ""}
-#define grpc_lb_v1_ClientStatsPerToken_init_default {{{NULL}, NULL}, false, 0}
-#define grpc_lb_v1_ClientStats_init_default      {false, google_protobuf_Timestamp_init_default, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}}
-#define grpc_lb_v1_LoadBalanceResponse_init_default {false, grpc_lb_v1_InitialLoadBalanceResponse_init_default, false, grpc_lb_v1_ServerList_init_default}
-#define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false, google_protobuf_Duration_init_default}
-#define grpc_lb_v1_ServerList_init_default       {{{NULL}, NULL}}
-#define grpc_lb_v1_Server_init_default           {false, {0, {0}}, false, 0, false, "", false, 0}
-#define grpc_lb_v1_LoadBalanceRequest_init_zero  {false, grpc_lb_v1_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v1_ClientStats_init_zero}
-#define grpc_lb_v1_InitialLoadBalanceRequest_init_zero {false, ""}
-#define grpc_lb_v1_ClientStatsPerToken_init_zero {{{NULL}, NULL}, false, 0}
-#define grpc_lb_v1_ClientStats_init_zero         {false, google_protobuf_Timestamp_init_zero, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}}
-#define grpc_lb_v1_LoadBalanceResponse_init_zero {false, grpc_lb_v1_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v1_ServerList_init_zero}
-#define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false, google_protobuf_Duration_init_zero}
-#define grpc_lb_v1_ServerList_init_zero          {{{NULL}, NULL}}
-#define grpc_lb_v1_Server_init_zero              {false, {0, {0}}, false, 0, false, "", false, 0}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define grpc_lb_v1_ServerList_servers_tag        1
-#define grpc_lb_v1_ClientStats_timestamp_tag     1
-#define grpc_lb_v1_ClientStats_num_calls_started_tag 2
-#define grpc_lb_v1_ClientStats_num_calls_finished_tag 3
-#define grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send_tag 6
-#define grpc_lb_v1_ClientStats_num_calls_finished_known_received_tag 7
-#define grpc_lb_v1_ClientStats_calls_finished_with_drop_tag 8
-#define grpc_lb_v1_ClientStatsPerToken_load_balance_token_tag 1
-#define grpc_lb_v1_ClientStatsPerToken_num_calls_tag 2
-#define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1
-#define grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate_tag 1
-#define grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval_tag 2
-#define grpc_lb_v1_Server_ip_address_tag         1
-#define grpc_lb_v1_Server_port_tag               2
-#define grpc_lb_v1_Server_load_balance_token_tag 3
-#define grpc_lb_v1_Server_drop_tag               4
-#define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1
-#define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2
-#define grpc_lb_v1_LoadBalanceResponse_initial_response_tag 1
-#define grpc_lb_v1_LoadBalanceResponse_server_list_tag 2
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3];
-extern const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2];
-extern const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3];
-extern const pb_field_t grpc_lb_v1_ClientStats_fields[7];
-extern const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3];
-extern const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3];
-extern const pb_field_t grpc_lb_v1_ServerList_fields[2];
-extern const pb_field_t grpc_lb_v1_Server_fields[5];
-
-/* Maximum encoded size of messages (where known) */
-#define grpc_lb_v1_LoadBalanceRequest_size       (140 + grpc_lb_v1_ClientStats_size)
-#define grpc_lb_v1_InitialLoadBalanceRequest_size 131
-/* grpc_lb_v1_ClientStatsPerToken_size depends on runtime parameters */
-/* grpc_lb_v1_ClientStats_size depends on runtime parameters */
-#define grpc_lb_v1_LoadBalanceResponse_size      (98 + grpc_lb_v1_ServerList_size)
-#define grpc_lb_v1_InitialLoadBalanceResponse_size 90
-/* grpc_lb_v1_ServerList_size depends on runtime parameters */
-#define grpc_lb_v1_Server_size                   83
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define LOAD_BALANCER_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
index 00036d8..b40b032 100644 (file)
@@ -28,7 +28,6 @@
 #include "src/core/ext/filters/client_channel/subchannel.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
 #include "src/core/lib/transport/connectivity_state.h"
 
@@ -85,9 +84,8 @@ class PickFirst : public LoadBalancingPolicy {
    public:
     PickFirstSubchannelList(PickFirst* policy, TraceFlag* tracer,
                             const ServerAddressList& addresses,
-                            grpc_combiner* combiner,
                             const grpc_channel_args& args)
-        : SubchannelList(policy, tracer, addresses, combiner,
+        : SubchannelList(policy, tracer, addresses,
                          policy->channel_control_helper(), args) {
       // Need to maintain a ref to the LB policy as long as we maintain
       // any references to subchannels, since the subchannels'
@@ -111,23 +109,26 @@ class PickFirst : public LoadBalancingPolicy {
 
   class Picker : public SubchannelPicker {
    public:
-    explicit Picker(
-        RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel)
-        : connected_subchannel_(std::move(connected_subchannel)) {}
+    explicit Picker(RefCountedPtr<SubchannelInterface> subchannel)
+        : subchannel_(std::move(subchannel)) {}
 
     PickResult Pick(PickArgs args) override {
       PickResult result;
       result.type = PickResult::PICK_COMPLETE;
-      result.connected_subchannel = connected_subchannel_;
+      result.subchannel = subchannel_;
       return result;
     }
 
    private:
-    RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel_;
+    RefCountedPtr<SubchannelInterface> subchannel_;
   };
 
   void ShutdownLocked() override;
 
+  void AttemptToConnectUsingLatestUpdateArgsLocked();
+
+  // Lateset update args.
+  UpdateArgs latest_update_args_;
   // All our subchannels.
   OrphanablePtr<PickFirstSubchannelList> subchannel_list_;
   // Latest pending subchannel list.
@@ -166,59 +167,41 @@ void PickFirst::ShutdownLocked() {
 void PickFirst::ExitIdleLocked() {
   if (shutdown_) return;
   if (idle_) {
-    idle_ = false;
-    if (subchannel_list_ == nullptr ||
-        subchannel_list_->num_subchannels() == 0) {
-      grpc_error* error = grpc_error_set_int(
-          GRPC_ERROR_CREATE_FROM_STATIC_STRING("No addresses to connect to"),
-          GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
-      channel_control_helper()->UpdateState(
-          GRPC_CHANNEL_TRANSIENT_FAILURE,
-          UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
-    } else {
-      subchannel_list_->subchannel(0)
-          ->CheckConnectivityStateAndStartWatchingLocked();
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
+      gpr_log(GPR_INFO, "Pick First %p exiting idle", this);
     }
+    idle_ = false;
+    AttemptToConnectUsingLatestUpdateArgsLocked();
   }
 }
 
 void PickFirst::ResetBackoffLocked() {
-  subchannel_list_->ResetBackoffLocked();
+  if (subchannel_list_ != nullptr) subchannel_list_->ResetBackoffLocked();
   if (latest_pending_subchannel_list_ != nullptr) {
     latest_pending_subchannel_list_->ResetBackoffLocked();
   }
 }
 
-void PickFirst::UpdateLocked(UpdateArgs args) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
-    gpr_log(GPR_INFO,
-            "Pick First %p received update with %" PRIuPTR " addresses", this,
-            args.addresses.size());
-  }
-  grpc_arg new_arg = grpc_channel_arg_integer_create(
-      const_cast<char*>(GRPC_ARG_INHIBIT_HEALTH_CHECKING), 1);
-  grpc_channel_args* new_args =
-      grpc_channel_args_copy_and_add(args.args, &new_arg, 1);
+void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
+  // Create a subchannel list from the latest_update_args_.
   auto subchannel_list = MakeOrphanable<PickFirstSubchannelList>(
-      this, &grpc_lb_pick_first_trace, args.addresses, combiner(), *new_args);
-  grpc_channel_args_destroy(new_args);
+      this, &grpc_lb_pick_first_trace, latest_update_args_.addresses,
+      *latest_update_args_.args);
+  // Empty update or no valid subchannels.
   if (subchannel_list->num_subchannels() == 0) {
-    // Empty update or no valid subchannels. Unsubscribe from all current
-    // subchannels.
+    // Unsubscribe from all current subchannels.
     subchannel_list_ = std::move(subchannel_list);  // Empty list.
     selected_ = nullptr;
     // If not idle, put the channel in TRANSIENT_FAILURE.
     // (If we are idle, then this will happen in ExitIdleLocked() if we
     // haven't gotten a non-empty update by the time the application tries
     // to start a new call.)
-    if (!idle_) {
-      grpc_error* error = grpc_error_set_int(
-          GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
-          GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
-      channel_control_helper()->UpdateState(
-          GRPC_CHANNEL_TRANSIENT_FAILURE,
-          UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
-    }
+    grpc_error* error =
+        grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
+                           GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
+    channel_control_helper()->UpdateState(
+        GRPC_CHANNEL_TRANSIENT_FAILURE,
+        UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
     return;
   }
   // If one of the subchannels in the new list is already in state
@@ -226,8 +209,6 @@ void PickFirst::UpdateLocked(UpdateArgs args) {
   // currently selected subchannel is also present in the update.  It
   // can also happen if one of the subchannels in the update is already
   // in the global subchannel pool because it's in use by another channel.
-  // TODO(roth): If we're in IDLE state, we should probably defer this
-  // check and instead do it in ExitIdleLocked().
   for (size_t i = 0; i < subchannel_list->num_subchannels(); ++i) {
     PickFirstSubchannelData* sd = subchannel_list->subchannel(i);
     grpc_connectivity_state state = sd->CheckConnectivityStateLocked();
@@ -239,10 +220,6 @@ void PickFirst::UpdateLocked(UpdateArgs args) {
       // not have contained the currently selected subchannel), drop
       // it, so that it doesn't override what we've done here.
       latest_pending_subchannel_list_.reset();
-      // Make sure that subsequent calls to ExitIdleLocked() don't cause
-      // us to start watching a subchannel other than the one we've
-      // selected.
-      idle_ = false;
       return;
     }
   }
@@ -252,13 +229,11 @@ void PickFirst::UpdateLocked(UpdateArgs args) {
     subchannel_list_ = std::move(subchannel_list);
     // If we're not in IDLE state, start trying to connect to the first
     // subchannel in the new list.
-    if (!idle_) {
-      // Note: No need to use CheckConnectivityStateAndStartWatchingLocked()
-      // here, since we've already checked the initial connectivity
-      // state of all subchannels above.
-      subchannel_list_->subchannel(0)->StartConnectivityWatchLocked();
-      subchannel_list_->subchannel(0)->subchannel()->AttemptToConnect();
-    }
+    // Note: No need to use CheckConnectivityStateAndStartWatchingLocked()
+    // here, since we've already checked the initial connectivity
+    // state of all subchannels above.
+    subchannel_list_->subchannel(0)->StartConnectivityWatchLocked();
+    subchannel_list_->subchannel(0)->subchannel()->AttemptToConnect();
   } else {
     // We do have a selected subchannel (which means it's READY), so keep
     // using it until one of the subchannels in the new list reports READY.
@@ -274,16 +249,35 @@ void PickFirst::UpdateLocked(UpdateArgs args) {
     latest_pending_subchannel_list_ = std::move(subchannel_list);
     // If we're not in IDLE state, start trying to connect to the first
     // subchannel in the new list.
-    if (!idle_) {
-      // Note: No need to use CheckConnectivityStateAndStartWatchingLocked()
-      // here, since we've already checked the initial connectivity
-      // state of all subchannels above.
-      latest_pending_subchannel_list_->subchannel(0)
-          ->StartConnectivityWatchLocked();
-      latest_pending_subchannel_list_->subchannel(0)
-          ->subchannel()
-          ->AttemptToConnect();
-    }
+    // Note: No need to use CheckConnectivityStateAndStartWatchingLocked()
+    // here, since we've already checked the initial connectivity
+    // state of all subchannels above.
+    latest_pending_subchannel_list_->subchannel(0)
+        ->StartConnectivityWatchLocked();
+    latest_pending_subchannel_list_->subchannel(0)
+        ->subchannel()
+        ->AttemptToConnect();
+  }
+}
+
+void PickFirst::UpdateLocked(UpdateArgs args) {
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
+    gpr_log(GPR_INFO,
+            "Pick First %p received update with %" PRIuPTR " addresses", this,
+            args.addresses.size());
+  }
+  // Update the latest_update_args_
+  grpc_arg new_arg = grpc_channel_arg_integer_create(
+      const_cast<char*>(GRPC_ARG_INHIBIT_HEALTH_CHECKING), 1);
+  const grpc_channel_args* new_args =
+      grpc_channel_args_copy_and_add(args.args, &new_arg, 1);
+  GPR_SWAP(const grpc_channel_args*, new_args, args.args);
+  grpc_channel_args_destroy(new_args);
+  latest_update_args_ = std::move(args);
+  // If we are not in idle, start connection attempt immediately.
+  // Otherwise, we defer the attempt into ExitIdleLocked().
+  if (!idle_) {
+    AttemptToConnectUsingLatestUpdateArgsLocked();
   }
 }
 
@@ -338,10 +332,12 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
         // also set the channel state to IDLE. The reason is that if the new
         // state is TRANSIENT_FAILURE due to a GOAWAY reception we don't want
         // to connect to the re-resolved backends until we leave IDLE state.
+        // TODO(qianchengz): We may want to request re-resolution in
+        // ExitIdleLocked().
         p->idle_ = true;
         p->channel_control_helper()->RequestReresolution();
         p->selected_ = nullptr;
-        CancelConnectivityWatchLocked("selected subchannel failed; going IDLE");
+        p->subchannel_list_.reset();
         p->channel_control_helper()->UpdateState(
             GRPC_CHANNEL_IDLE, UniquePtr<SubchannelPicker>(New<QueuePicker>(
                                    p->Ref(DEBUG_LOCATION, "QueuePicker"))));
@@ -351,8 +347,8 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
         // some connectivity state notifications.
         if (connectivity_state == GRPC_CHANNEL_READY) {
           p->channel_control_helper()->UpdateState(
-              GRPC_CHANNEL_READY, UniquePtr<SubchannelPicker>(New<Picker>(
-                                      connected_subchannel()->Ref())));
+              GRPC_CHANNEL_READY,
+              UniquePtr<SubchannelPicker>(New<Picker>(subchannel()->Ref())));
         } else {  // CONNECTING
           p->channel_control_helper()->UpdateState(
               connectivity_state, UniquePtr<SubchannelPicker>(New<QueuePicker>(
@@ -447,12 +443,17 @@ void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
     p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
   }
   // Cases 1 and 2.
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
+    gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p, subchannel());
+  }
   p->selected_ = this;
   p->channel_control_helper()->UpdateState(
       GRPC_CHANNEL_READY,
-      UniquePtr<SubchannelPicker>(New<Picker>(connected_subchannel()->Ref())));
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
-    gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p, subchannel());
+      UniquePtr<SubchannelPicker>(New<Picker>(subchannel()->Ref())));
+  for (size_t i = 0; i < subchannel_list()->num_subchannels(); ++i) {
+    if (i != Index()) {
+      subchannel_list()->subchannel(i)->ShutdownLocked();
+    }
   }
 }
 
index c6655c7..04308ee 100644 (file)
@@ -38,7 +38,6 @@
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
 #include "src/core/lib/transport/connectivity_state.h"
 #include "src/core/lib/transport/static_metadata.h"
@@ -106,9 +105,8 @@ class RoundRobin : public LoadBalancingPolicy {
    public:
     RoundRobinSubchannelList(RoundRobin* policy, TraceFlag* tracer,
                              const ServerAddressList& addresses,
-                             grpc_combiner* combiner,
                              const grpc_channel_args& args)
-        : SubchannelList(policy, tracer, addresses, combiner,
+        : SubchannelList(policy, tracer, addresses,
                          policy->channel_control_helper(), args) {
       // Need to maintain a ref to the LB policy as long as we maintain
       // any references to subchannels, since the subchannels'
@@ -155,7 +153,7 @@ class RoundRobin : public LoadBalancingPolicy {
     RoundRobin* parent_;
 
     size_t last_picked_index_;
-    InlinedVector<RefCountedPtr<ConnectedSubchannelInterface>, 10> subchannels_;
+    InlinedVector<RefCountedPtr<SubchannelInterface>, 10> subchannels_;
   };
 
   void ShutdownLocked() override;
@@ -180,10 +178,9 @@ RoundRobin::Picker::Picker(RoundRobin* parent,
                            RoundRobinSubchannelList* subchannel_list)
     : parent_(parent) {
   for (size_t i = 0; i < subchannel_list->num_subchannels(); ++i) {
-    auto* connected_subchannel =
-        subchannel_list->subchannel(i)->connected_subchannel();
-    if (connected_subchannel != nullptr) {
-      subchannels_.push_back(connected_subchannel->Ref());
+    RoundRobinSubchannelData* sd = subchannel_list->subchannel(i);
+    if (sd->connectivity_state() == GRPC_CHANNEL_READY) {
+      subchannels_.push_back(sd->subchannel()->Ref());
     }
   }
   // For discussion on why we generate a random starting index for
@@ -204,14 +201,13 @@ RoundRobin::PickResult RoundRobin::Picker::Pick(PickArgs args) {
   last_picked_index_ = (last_picked_index_ + 1) % subchannels_.size();
   if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) {
     gpr_log(GPR_INFO,
-            "[RR %p picker %p] returning index %" PRIuPTR
-            ", connected_subchannel=%p",
+            "[RR %p picker %p] returning index %" PRIuPTR ", subchannel=%p",
             parent_, this, last_picked_index_,
             subchannels_[last_picked_index_].get());
   }
   PickResult result;
   result.type = PickResult::PICK_COMPLETE;
-  result.connected_subchannel = subchannels_[last_picked_index_];
+  result.subchannel = subchannels_[last_picked_index_];
   return result;
 }
 
@@ -424,7 +420,7 @@ void RoundRobin::UpdateLocked(UpdateArgs args) {
     }
   }
   latest_pending_subchannel_list_ = MakeOrphanable<RoundRobinSubchannelList>(
-      this, &grpc_lb_round_robin_trace, args.addresses, combiner(), *args.args);
+      this, &grpc_lb_round_robin_trace, args.addresses, *args.args);
   if (latest_pending_subchannel_list_->num_subchannels() == 0) {
     // If the new list is empty, immediately promote the new list to the
     // current list and transition to TRANSIENT_FAILURE.
index 7d70928..34cd0f5 100644 (file)
@@ -39,7 +39,6 @@
 #include "src/core/lib/gprpp/ref_counted.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/closure.h"
-#include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
 #include "src/core/lib/transport/connectivity_state.h"
 
@@ -64,8 +63,7 @@ class MySubchannelList
 };
 
 */
-// All methods with a Locked() suffix must be called from within the
-// client_channel combiner.
+// All methods will be called from within the client_channel combiner.
 
 namespace grpc_core {
 
@@ -93,20 +91,13 @@ class SubchannelData {
   // Returns a pointer to the subchannel.
   SubchannelInterface* subchannel() const { return subchannel_.get(); }
 
-  // Returns the connected subchannel.  Will be null if the subchannel
-  // is not connected.
-  ConnectedSubchannelInterface* connected_subchannel() const {
-    return connected_subchannel_.get();
-  }
-
   // Synchronously checks the subchannel's connectivity state.
   // Must not be called while there is a connectivity notification
   // pending (i.e., between calling StartConnectivityWatchLocked() and
   // calling CancelConnectivityWatchLocked()).
   grpc_connectivity_state CheckConnectivityStateLocked() {
     GPR_ASSERT(pending_watcher_ == nullptr);
-    connectivity_state_ =
-        subchannel()->CheckConnectivityState(&connected_subchannel_);
+    connectivity_state_ = subchannel_->CheckConnectivityState();
     return connectivity_state_;
   }
 
@@ -144,7 +135,8 @@ class SubchannelData {
 
  private:
   // Watcher for subchannel connectivity state.
-  class Watcher : public SubchannelInterface::ConnectivityStateWatcher {
+  class Watcher
+      : public SubchannelInterface::ConnectivityStateWatcherInterface {
    public:
     Watcher(
         SubchannelData<SubchannelListType, SubchannelDataType>* subchannel_data,
@@ -154,42 +146,13 @@ class SubchannelData {
 
     ~Watcher() { subchannel_list_.reset(DEBUG_LOCATION, "Watcher dtor"); }
 
-    void OnConnectivityStateChange(grpc_connectivity_state new_state,
-                                   RefCountedPtr<ConnectedSubchannelInterface>
-                                       connected_subchannel) override;
+    void OnConnectivityStateChange(grpc_connectivity_state new_state) override;
 
     grpc_pollset_set* interested_parties() override {
       return subchannel_list_->policy()->interested_parties();
     }
 
    private:
-    // A fire-and-forget class that bounces into the combiner to process
-    // a connectivity state update.
-    class Updater {
-     public:
-      Updater(
-          SubchannelData<SubchannelListType, SubchannelDataType>*
-              subchannel_data,
-          RefCountedPtr<SubchannelList<SubchannelListType, SubchannelDataType>>
-              subchannel_list,
-          grpc_connectivity_state state,
-          RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel);
-
-      ~Updater() {
-        subchannel_list_.reset(DEBUG_LOCATION, "Watcher::Updater dtor");
-      }
-
-     private:
-      static void OnUpdateLocked(void* arg, grpc_error* error);
-
-      SubchannelData<SubchannelListType, SubchannelDataType>* subchannel_data_;
-      RefCountedPtr<SubchannelList<SubchannelListType, SubchannelDataType>>
-          subchannel_list_;
-      const grpc_connectivity_state state_;
-      RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel_;
-      grpc_closure closure_;
-    };
-
     SubchannelData<SubchannelListType, SubchannelDataType>* subchannel_data_;
     RefCountedPtr<SubchannelListType> subchannel_list_;
   };
@@ -202,10 +165,10 @@ class SubchannelData {
   // The subchannel.
   RefCountedPtr<SubchannelInterface> subchannel_;
   // Will be non-null when the subchannel's state is being watched.
-  SubchannelInterface::ConnectivityStateWatcher* pending_watcher_ = nullptr;
+  SubchannelInterface::ConnectivityStateWatcherInterface* pending_watcher_ =
+      nullptr;
   // Data updated by the watcher.
   grpc_connectivity_state connectivity_state_;
-  RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel_;
 };
 
 // A list of subchannels.
@@ -232,7 +195,6 @@ class SubchannelList : public InternallyRefCounted<SubchannelListType> {
   // the backoff code out of subchannels and into LB policies.
   void ResetBackoffLocked();
 
-  // Note: Caller must ensure that this is invoked inside of the combiner.
   void Orphan() override {
     ShutdownLocked();
     InternallyRefCounted<SubchannelListType>::Unref(DEBUG_LOCATION, "shutdown");
@@ -242,7 +204,7 @@ class SubchannelList : public InternallyRefCounted<SubchannelListType> {
 
  protected:
   SubchannelList(LoadBalancingPolicy* policy, TraceFlag* tracer,
-                 const ServerAddressList& addresses, grpc_combiner* combiner,
+                 const ServerAddressList& addresses,
                  LoadBalancingPolicy::ChannelControlHelper* helper,
                  const grpc_channel_args& args);
 
@@ -263,8 +225,6 @@ class SubchannelList : public InternallyRefCounted<SubchannelListType> {
 
   TraceFlag* tracer_;
 
-  grpc_combiner* combiner_;
-
   // The list of subchannels.
   SubchannelVector subchannels_;
 
@@ -284,59 +244,26 @@ class SubchannelList : public InternallyRefCounted<SubchannelListType> {
 
 template <typename SubchannelListType, typename SubchannelDataType>
 void SubchannelData<SubchannelListType, SubchannelDataType>::Watcher::
-    OnConnectivityStateChange(
-        grpc_connectivity_state new_state,
-        RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel) {
-  // Will delete itself.
-  New<Updater>(subchannel_data_,
-               subchannel_list_->Ref(DEBUG_LOCATION, "Watcher::Updater"),
-               new_state, std::move(connected_subchannel));
-}
-
-template <typename SubchannelListType, typename SubchannelDataType>
-SubchannelData<SubchannelListType, SubchannelDataType>::Watcher::Updater::
-    Updater(
-        SubchannelData<SubchannelListType, SubchannelDataType>* subchannel_data,
-        RefCountedPtr<SubchannelList<SubchannelListType, SubchannelDataType>>
-            subchannel_list,
-        grpc_connectivity_state state,
-        RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel)
-    : subchannel_data_(subchannel_data),
-      subchannel_list_(std::move(subchannel_list)),
-      state_(state),
-      connected_subchannel_(std::move(connected_subchannel)) {
-  GRPC_CLOSURE_INIT(&closure_, &OnUpdateLocked, this,
-                    grpc_combiner_scheduler(subchannel_list_->combiner_));
-  GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE);
-}
-
-template <typename SubchannelListType, typename SubchannelDataType>
-void SubchannelData<SubchannelListType, SubchannelDataType>::Watcher::Updater::
-    OnUpdateLocked(void* arg, grpc_error* error) {
-  Updater* self = static_cast<Updater*>(arg);
-  SubchannelData* sd = self->subchannel_data_;
-  if (GRPC_TRACE_FLAG_ENABLED(*sd->subchannel_list_->tracer())) {
+    OnConnectivityStateChange(grpc_connectivity_state new_state) {
+  if (GRPC_TRACE_FLAG_ENABLED(*subchannel_list_->tracer())) {
     gpr_log(GPR_INFO,
             "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
             " (subchannel %p): connectivity changed: state=%s, "
-            "connected_subchannel=%p, shutting_down=%d, pending_watcher=%p",
-            sd->subchannel_list_->tracer()->name(),
-            sd->subchannel_list_->policy(), sd->subchannel_list_, sd->Index(),
-            sd->subchannel_list_->num_subchannels(), sd->subchannel_.get(),
-            grpc_connectivity_state_name(self->state_),
-            self->connected_subchannel_.get(),
-            sd->subchannel_list_->shutting_down(), sd->pending_watcher_);
+            "shutting_down=%d, pending_watcher=%p",
+            subchannel_list_->tracer()->name(), subchannel_list_->policy(),
+            subchannel_list_.get(), subchannel_data_->Index(),
+            subchannel_list_->num_subchannels(),
+            subchannel_data_->subchannel_.get(),
+            grpc_connectivity_state_name(new_state),
+            subchannel_list_->shutting_down(),
+            subchannel_data_->pending_watcher_);
   }
-  if (!sd->subchannel_list_->shutting_down() &&
-      sd->pending_watcher_ != nullptr) {
-    sd->connectivity_state_ = self->state_;
-    // Get or release ref to connected subchannel.
-    sd->connected_subchannel_ = std::move(self->connected_subchannel_);
+  if (!subchannel_list_->shutting_down() &&
+      subchannel_data_->pending_watcher_ != nullptr) {
+    subchannel_data_->connectivity_state_ = new_state;
     // Call the subclass's ProcessConnectivityChangeLocked() method.
-    sd->ProcessConnectivityChangeLocked(sd->connectivity_state_);
+    subchannel_data_->ProcessConnectivityChangeLocked(new_state);
   }
-  // Clean up.
-  Delete(self);
 }
 
 //
@@ -371,7 +298,6 @@ void SubchannelData<SubchannelListType, SubchannelDataType>::
               subchannel_.get());
     }
     subchannel_.reset();
-    connected_subchannel_.reset();
   }
 }
 
@@ -400,7 +326,7 @@ void SubchannelData<SubchannelListType,
       New<Watcher>(this, subchannel_list()->Ref(DEBUG_LOCATION, "Watcher"));
   subchannel_->WatchConnectivityState(
       connectivity_state_,
-      UniquePtr<SubchannelInterface::ConnectivityStateWatcher>(
+      UniquePtr<SubchannelInterface::ConnectivityStateWatcherInterface>(
           pending_watcher_));
 }
 
@@ -434,13 +360,12 @@ void SubchannelData<SubchannelListType, SubchannelDataType>::ShutdownLocked() {
 template <typename SubchannelListType, typename SubchannelDataType>
 SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
     LoadBalancingPolicy* policy, TraceFlag* tracer,
-    const ServerAddressList& addresses, grpc_combiner* combiner,
+    const ServerAddressList& addresses,
     LoadBalancingPolicy::ChannelControlHelper* helper,
     const grpc_channel_args& args)
     : InternallyRefCounted<SubchannelListType>(tracer),
       policy_(policy),
-      tracer_(tracer),
-      combiner_(GRPC_COMBINER_REF(combiner, "subchannel_list")) {
+      tracer_(tracer) {
   if (GRPC_TRACE_FLAG_ENABLED(*tracer_)) {
     gpr_log(GPR_INFO,
             "[%s %p] Creating subchannel list %p for %" PRIuPTR " subchannels",
@@ -509,7 +434,6 @@ SubchannelList<SubchannelListType, SubchannelDataType>::~SubchannelList() {
     gpr_log(GPR_INFO, "[%s %p] Destroying subchannel_list %p", tracer_->name(),
             policy_, this);
   }
-  GRPC_COMBINER_UNREF(combiner_, "subchannel_list");
 }
 
 template <typename SubchannelListType, typename SubchannelDataType>
index e790ec2..5856bc5 100644 (file)
@@ -84,7 +84,6 @@
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/gprpp/map.h"
 #define GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS 120
 #define GRPC_XDS_RECONNECT_JITTER 0.2
 #define GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS 10000
+#define GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS 1000
+#define GRPC_XDS_DEFAULT_LOCALITY_RETENTION_INTERVAL_MS (15 * 60 * 1000)
 
 namespace grpc_core {
 
@@ -117,10 +118,6 @@ TraceFlag grpc_lb_xds_trace(false, "xds");
 namespace {
 
 constexpr char kXds[] = "xds_experimental";
-constexpr char kDefaultLocalityRegion[] = "xds_default_locality_region";
-constexpr char kDefaultLocalityZone[] = "xds_default_locality_zone";
-constexpr char kDefaultLocalitySubzone[] = "xds_default_locality_subzone";
-constexpr uint32_t kDefaultLocalityWeight = 3;
 
 class ParsedXdsConfig : public LoadBalancingPolicy::Config {
  public:
@@ -159,100 +156,192 @@ class XdsLb : public LoadBalancingPolicy {
   void ResetBackoffLocked() override;
 
  private:
-  struct LocalityServerlistEntry;
-  using LocalityList = InlinedVector<UniquePtr<LocalityServerlistEntry>, 1>;
-
-  /// Contains a channel to the LB server and all the data related to the
-  /// channel.
-  class BalancerChannelState
-      : public InternallyRefCounted<BalancerChannelState> {
+  // Contains a channel to the LB server and all the data related to the
+  // channel. Holds a ref to the xds policy.
+  class LbChannelState : public InternallyRefCounted<LbChannelState> {
    public:
-    /// Contains a call to the LB server and all the data related to the call.
-    class BalancerCallState : public InternallyRefCounted<BalancerCallState> {
+    // An LB call wrapper that can restart a call upon failure. Holds a ref to
+    // the LB channel. The template parameter is the kind of wrapped LB call.
+    template <typename T>
+    class RetryableLbCall : public InternallyRefCounted<RetryableLbCall<T>> {
      public:
-      explicit BalancerCallState(RefCountedPtr<BalancerChannelState> lb_chand);
+      explicit RetryableLbCall(RefCountedPtr<LbChannelState> lb_chand);
 
-      // It's the caller's responsibility to ensure that Orphan() is called from
-      // inside the combiner.
       void Orphan() override;
 
-      void StartQuery();
+      void OnCallFinishedLocked();
 
-      RefCountedPtr<XdsLbClientStats> client_stats() const {
-        return client_stats_;
-      }
+      T* lb_calld() const { return lb_calld_.get(); }
+      LbChannelState* lb_chand() const { return lb_chand_.get(); }
+
+     private:
+      void StartNewCallLocked();
+      void StartRetryTimerLocked();
+      static void OnRetryTimerLocked(void* arg, grpc_error* error);
+
+      // The wrapped LB call that talks to the LB server. It's instantiated
+      // every time we start a new call. It's null during call retry backoff.
+      OrphanablePtr<T> lb_calld_;
+      // The owing LB channel.
+      RefCountedPtr<LbChannelState> lb_chand_;
+
+      // Retry state.
+      BackOff backoff_;
+      grpc_timer retry_timer_;
+      grpc_closure on_retry_timer_;
+      bool retry_timer_callback_pending_ = false;
+
+      bool shutting_down_ = false;
+    };
+
+    // Contains an EDS call to the LB server.
+    class EdsCallState : public InternallyRefCounted<EdsCallState> {
+     public:
+      // The ctor and dtor should not be used directly.
+      explicit EdsCallState(
+          RefCountedPtr<RetryableLbCall<EdsCallState>> parent);
+      ~EdsCallState() override;
+
+      void Orphan() override;
 
-      bool seen_initial_response() const { return seen_initial_response_; }
+      RetryableLbCall<EdsCallState>* parent() const { return parent_.get(); }
+      LbChannelState* lb_chand() const { return parent_->lb_chand(); }
+      XdsLb* xdslb_policy() const { return lb_chand()->xdslb_policy(); }
+      bool seen_response() const { return seen_response_; }
 
      private:
-      // So Delete() can access our private dtor.
-      template <typename T>
-      friend void grpc_core::Delete(T*);
+      static void OnResponseReceivedLocked(void* arg, grpc_error* error);
+      static void OnStatusReceivedLocked(void* arg, grpc_error* error);
 
-      ~BalancerCallState();
+      bool IsCurrentCallOnChannel() const;
 
-      XdsLb* xdslb_policy() const { return lb_chand_->xdslb_policy_.get(); }
+      // The owning RetryableLbCall<>.
+      RefCountedPtr<RetryableLbCall<EdsCallState>> parent_;
+      bool seen_response_ = false;
 
-      bool IsCurrentCallOnChannel() const {
-        return this == lb_chand_->lb_calld_.get();
-      }
+      // Always non-NULL.
+      grpc_call* lb_call_;
+
+      // recv_initial_metadata
+      grpc_metadata_array initial_metadata_recv_;
+
+      // send_message
+      grpc_byte_buffer* send_message_payload_ = nullptr;
+
+      // recv_message
+      grpc_byte_buffer* recv_message_payload_ = nullptr;
+      grpc_closure on_response_received_;
+
+      // recv_trailing_metadata
+      grpc_metadata_array trailing_metadata_recv_;
+      grpc_status_code status_code_;
+      grpc_slice status_details_;
+      grpc_closure on_status_received_;
+    };
+
+    // Contains an LRS call to the LB server.
+    class LrsCallState : public InternallyRefCounted<LrsCallState> {
+     public:
+      // The ctor and dtor should not be used directly.
+      explicit LrsCallState(
+          RefCountedPtr<RetryableLbCall<LrsCallState>> parent);
+      ~LrsCallState() override;
+
+      void Orphan() override;
+
+      void MaybeStartReportingLocked();
+
+      RetryableLbCall<LrsCallState>* parent() { return parent_.get(); }
+      LbChannelState* lb_chand() const { return parent_->lb_chand(); }
+      XdsLb* xdslb_policy() const { return lb_chand()->xdslb_policy(); }
+      bool seen_response() const { return seen_response_; }
+
+     private:
+      // Reports client-side load stats according to a fixed interval.
+      class Reporter : public InternallyRefCounted<Reporter> {
+       public:
+        Reporter(RefCountedPtr<LrsCallState> parent,
+                 grpc_millis report_interval)
+            : parent_(std::move(parent)), report_interval_(report_interval) {
+          GRPC_CLOSURE_INIT(
+              &on_next_report_timer_, OnNextReportTimerLocked, this,
+              grpc_combiner_scheduler(xdslb_policy()->combiner()));
+          GRPC_CLOSURE_INIT(
+              &on_report_done_, OnReportDoneLocked, this,
+              grpc_combiner_scheduler(xdslb_policy()->combiner()));
+          ScheduleNextReportLocked();
+        }
+
+        void Orphan() override;
 
-      void ScheduleNextClientLoadReportLocked();
-      void SendClientLoadReportLocked();
+       private:
+        void ScheduleNextReportLocked();
+        static void OnNextReportTimerLocked(void* arg, grpc_error* error);
+        void SendReportLocked();
+        static void OnReportDoneLocked(void* arg, grpc_error* error);
 
-      static bool LoadReportCountersAreZero(xds_grpclb_request* request);
+        bool IsCurrentReporterOnCall() const {
+          return this == parent_->reporter_.get();
+        }
+        XdsLb* xdslb_policy() const { return parent_->xdslb_policy(); }
+
+        // The owning LRS call.
+        RefCountedPtr<LrsCallState> parent_;
+
+        // The load reporting state.
+        const grpc_millis report_interval_;
+        bool last_report_counters_were_zero_ = false;
+        bool next_report_timer_callback_pending_ = false;
+        grpc_timer next_report_timer_;
+        grpc_closure on_next_report_timer_;
+        grpc_closure on_report_done_;
+      };
 
-      static void MaybeSendClientLoadReportLocked(void* arg, grpc_error* error);
       static void OnInitialRequestSentLocked(void* arg, grpc_error* error);
-      static void OnBalancerMessageReceivedLocked(void* arg, grpc_error* error);
-      static void OnBalancerStatusReceivedLocked(void* arg, grpc_error* error);
+      static void OnResponseReceivedLocked(void* arg, grpc_error* error);
+      static void OnStatusReceivedLocked(void* arg, grpc_error* error);
+
+      bool IsCurrentCallOnChannel() const;
 
-      // The owning LB channel.
-      RefCountedPtr<BalancerChannelState> lb_chand_;
+      // The owning RetryableLbCall<>.
+      RefCountedPtr<RetryableLbCall<LrsCallState>> parent_;
+      bool seen_response_ = false;
 
-      // The streaming call to the LB server. Always non-NULL.
-      grpc_call* lb_call_ = nullptr;
+      // Always non-NULL.
+      grpc_call* lb_call_;
 
       // recv_initial_metadata
-      grpc_metadata_array lb_initial_metadata_recv_;
+      grpc_metadata_array initial_metadata_recv_;
 
       // send_message
       grpc_byte_buffer* send_message_payload_ = nullptr;
-      grpc_closure lb_on_initial_request_sent_;
+      grpc_closure on_initial_request_sent_;
 
       // recv_message
       grpc_byte_buffer* recv_message_payload_ = nullptr;
-      grpc_closure lb_on_balancer_message_received_;
-      bool seen_initial_response_ = false;
+      grpc_closure on_response_received_;
 
       // recv_trailing_metadata
-      grpc_closure lb_on_balancer_status_received_;
-      grpc_metadata_array lb_trailing_metadata_recv_;
-      grpc_status_code lb_call_status_;
-      grpc_slice lb_call_status_details_;
-
-      // The stats for client-side load reporting associated with this LB call.
-      // Created after the first serverlist is received.
-      RefCountedPtr<XdsLbClientStats> client_stats_;
-      grpc_millis client_stats_report_interval_ = 0;
-      grpc_timer client_load_report_timer_;
-      bool client_load_report_timer_callback_pending_ = false;
-      bool last_client_load_report_counters_were_zero_ = false;
-      bool client_load_report_is_due_ = false;
-      // The closure used for either the load report timer or the callback for
-      // completion of sending the load report.
-      grpc_closure client_load_report_closure_;
+      grpc_metadata_array trailing_metadata_recv_;
+      grpc_status_code status_code_;
+      grpc_slice status_details_;
+      grpc_closure on_status_received_;
+
+      // Load reporting state.
+      grpc_millis load_reporting_interval_ = 0;
+      OrphanablePtr<Reporter> reporter_;
     };
 
-    BalancerChannelState(const char* balancer_name,
-                         const grpc_channel_args& args,
-                         RefCountedPtr<XdsLb> parent_xdslb_policy);
-    ~BalancerChannelState();
+    LbChannelState(RefCountedPtr<XdsLb> xdslb_policy, const char* balancer_name,
+                   const grpc_channel_args& args);
+    ~LbChannelState();
 
     void Orphan() override;
 
     grpc_channel* channel() const { return channel_; }
-    BalancerCallState* lb_calld() const { return lb_calld_.get(); }
+    XdsLb* xdslb_policy() const { return xdslb_policy_.get(); }
+    EdsCallState* eds_calld() const { return eds_calld_->lb_calld(); }
+    LrsCallState* lrs_calld() const { return lrs_calld_->lb_calld(); }
 
     bool IsCurrentChannel() const {
       return this == xdslb_policy_->lb_chand_.get();
@@ -260,11 +349,7 @@ class XdsLb : public LoadBalancingPolicy {
     bool IsPendingChannel() const {
       return this == xdslb_policy_->pending_lb_chand_.get();
     }
-    bool HasActiveCall() const { return lb_calld_ != nullptr; }
-
-    void StartCallRetryTimerLocked();
-    static void OnCallRetryTimerLocked(void* arg, grpc_error* error);
-    void StartCallLocked();
+    bool HasActiveEdsCall() const { return eds_calld_->lb_calld() != nullptr; }
 
     void StartConnectivityWatchLocked();
     void CancelConnectivityWatchLocked();
@@ -280,29 +365,35 @@ class XdsLb : public LoadBalancingPolicy {
     grpc_connectivity_state connectivity_ = GRPC_CHANNEL_IDLE;
     grpc_closure on_connectivity_changed_;
 
-    // The data associated with the current LB call. It holds a ref to this LB
-    // channel. It's instantiated every time we query for backends. It's reset
-    // whenever the current LB call is no longer needed (e.g., the LB policy is
-    // shutting down, or the LB call has ended). A non-NULL lb_calld_ always
-    // contains a non-NULL lb_call_.
-    OrphanablePtr<BalancerCallState> lb_calld_;
-    BackOff lb_call_backoff_;
-    grpc_timer lb_call_retry_timer_;
-    grpc_closure lb_on_call_retry_;
-    bool retry_timer_callback_pending_ = false;
+    // The retryable XDS calls to the LB server.
+    OrphanablePtr<RetryableLbCall<EdsCallState>> eds_calld_;
+    OrphanablePtr<RetryableLbCall<LrsCallState>> lrs_calld_;
   };
 
-  // Since pickers are UniquePtrs we use this RefCounted wrapper
-  // to control references to it by the xds picker and the locality
-  // entry
-  class PickerRef : public RefCounted<PickerRef> {
+  // We need this wrapper for the following reasons:
+  // 1. To process per-locality load reporting.
+  // 2. Since pickers are UniquePtrs we use this RefCounted wrapper to control
+  // references to it by the xds picker and the locality entry.
+  class PickerWrapper : public RefCounted<PickerWrapper> {
    public:
-    explicit PickerRef(UniquePtr<SubchannelPicker> picker)
-        : picker_(std::move(picker)) {}
-    PickResult Pick(PickArgs args) { return picker_->Pick(args); }
+    PickerWrapper(UniquePtr<SubchannelPicker> picker,
+                  RefCountedPtr<XdsClientStats::LocalityStats> locality_stats)
+        : picker_(std::move(picker)),
+          locality_stats_(std::move(locality_stats)) {
+      locality_stats_->RefByPicker();
+    }
+    ~PickerWrapper() { locality_stats_->UnrefByPicker(); }
+
+    PickResult Pick(PickArgs args);
 
    private:
+    static void RecordCallCompletion(
+        void* arg, grpc_error* error,
+        LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata,
+        LoadBalancingPolicy::CallState* call_state);
+
     UniquePtr<SubchannelPicker> picker_;
+    RefCountedPtr<XdsClientStats::LocalityStats> locality_stats_;
   };
 
   // The picker will use a stateless weighting algorithm to pick the locality to
@@ -314,18 +405,21 @@ class XdsLb : public LoadBalancingPolicy {
     // proportional to the locality's weight. The start of the range is the
     // previous value in the vector and is 0 for the first element.
     using PickerList =
-        InlinedVector<Pair<uint32_t, RefCountedPtr<PickerRef>>, 1>;
-    Picker(RefCountedPtr<XdsLbClientStats> client_stats, PickerList pickers)
-        : client_stats_(std::move(client_stats)),
-          pickers_(std::move(pickers)) {}
+        InlinedVector<Pair<uint32_t, RefCountedPtr<PickerWrapper>>, 1>;
+    Picker(RefCountedPtr<XdsLb> xds_policy, PickerList pickers)
+        : xds_policy_(std::move(xds_policy)),
+          pickers_(std::move(pickers)),
+          drop_config_(xds_policy_->drop_config_) {}
 
     PickResult Pick(PickArgs args) override;
 
    private:
-    // Calls the picker of the locality that the key falls within
+    // Calls the picker of the locality that the key falls within.
     PickResult PickFromLocality(const uint32_t key, PickArgs args);
-    RefCountedPtr<XdsLbClientStats> client_stats_;
+
+    RefCountedPtr<XdsLb> xds_policy_;
     PickerList pickers_;
+    RefCountedPtr<XdsDropConfig> drop_config_;
   };
 
   class FallbackHelper : public ChannelControlHelper {
@@ -337,12 +431,10 @@ class XdsLb : public LoadBalancingPolicy {
 
     RefCountedPtr<SubchannelInterface> CreateSubchannel(
         const grpc_channel_args& args) override;
-    grpc_channel* CreateChannel(const char* target,
-                                const grpc_channel_args& args) override;
     void UpdateState(grpc_connectivity_state state,
                      UniquePtr<SubchannelPicker> picker) override;
     void RequestReresolution() override;
-    void AddTraceEvent(TraceSeverity severity, const char* message) override;
+    void AddTraceEvent(TraceSeverity severity, StringView message) override;
 
     void set_child(LoadBalancingPolicy* child) { child_ = child; }
 
@@ -354,63 +446,30 @@ class XdsLb : public LoadBalancingPolicy {
     LoadBalancingPolicy* child_ = nullptr;
   };
 
-  class LocalityName : public RefCounted<LocalityName> {
-   public:
-    struct Less {
-      bool operator()(const RefCountedPtr<LocalityName>& lhs,
-                      const RefCountedPtr<LocalityName>& rhs) {
-        int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get());
-        if (cmp_result != 0) return cmp_result < 0;
-        cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get());
-        if (cmp_result != 0) return cmp_result < 0;
-        return strcmp(lhs->subzone_.get(), rhs->subzone_.get()) < 0;
-      }
-    };
-
-    LocalityName(UniquePtr<char> region, UniquePtr<char> zone,
-                 UniquePtr<char> subzone)
-        : region_(std::move(region)),
-          zone_(std::move(zone)),
-          subzone_(std::move(subzone)) {}
-
-    bool operator==(const LocalityName& other) const {
-      return strcmp(region_.get(), other.region_.get()) == 0 &&
-             strcmp(zone_.get(), other.zone_.get()) == 0 &&
-             strcmp(subzone_.get(), other.subzone_.get()) == 0;
-    }
-
-    const char* AsHumanReadableString() {
-      if (human_readable_string_ == nullptr) {
-        char* tmp;
-        gpr_asprintf(&tmp, "{region=\"%s\", zone=\"%s\", subzone=\"%s\"}",
-                     region_.get(), zone_.get(), subzone_.get());
-        human_readable_string_.reset(tmp);
-      }
-      return human_readable_string_.get();
-    }
-
-   private:
-    UniquePtr<char> region_;
-    UniquePtr<char> zone_;
-    UniquePtr<char> subzone_;
-    UniquePtr<char> human_readable_string_;
-  };
-
   class LocalityMap {
    public:
     class LocalityEntry : public InternallyRefCounted<LocalityEntry> {
      public:
       LocalityEntry(RefCountedPtr<XdsLb> parent,
-                    RefCountedPtr<LocalityName> name, uint32_t locality_weight);
+                    RefCountedPtr<XdsLocalityName> name);
       ~LocalityEntry();
 
-      void UpdateLocked(xds_grpclb_serverlist* serverlist,
+      void UpdateLocked(uint32_t locality_weight, ServerAddressList serverlist,
                         LoadBalancingPolicy::Config* child_policy_config,
                         const grpc_channel_args* args);
       void ShutdownLocked();
       void ResetBackoffLocked();
+      void DeactivateLocked();
       void Orphan() override;
 
+      grpc_connectivity_state connectivity_state() const {
+        return connectivity_state_;
+      }
+      uint32_t locality_weight() const { return locality_weight_; }
+      RefCountedPtr<PickerWrapper> picker_wrapper() const {
+        return picker_wrapper_;
+      }
+
      private:
       class Helper : public ChannelControlHelper {
        public:
@@ -421,13 +480,10 @@ class XdsLb : public LoadBalancingPolicy {
 
         RefCountedPtr<SubchannelInterface> CreateSubchannel(
             const grpc_channel_args& args) override;
-        grpc_channel* CreateChannel(const char* target,
-                                    const grpc_channel_args& args) override;
         void UpdateState(grpc_connectivity_state state,
                          UniquePtr<SubchannelPicker> picker) override;
         void RequestReresolution() override;
-        void AddTraceEvent(TraceSeverity severity,
-                           const char* message) override;
+        void AddTraceEvent(TraceSeverity severity, StringView message) override;
         void set_child(LoadBalancingPolicy* child) { child_ = child; }
 
        private:
@@ -437,50 +493,50 @@ class XdsLb : public LoadBalancingPolicy {
         RefCountedPtr<LocalityEntry> entry_;
         LoadBalancingPolicy* child_ = nullptr;
       };
+
       // Methods for dealing with the child policy.
       OrphanablePtr<LoadBalancingPolicy> CreateChildPolicyLocked(
           const char* name, const grpc_channel_args* args);
       grpc_channel_args* CreateChildPolicyArgsLocked(
           const grpc_channel_args* args);
 
+      static void OnDelayedRemovalTimerLocked(void* arg, grpc_error* error);
+
       RefCountedPtr<XdsLb> parent_;
-      RefCountedPtr<LocalityName> name_;
+      RefCountedPtr<XdsLocalityName> name_;
       OrphanablePtr<LoadBalancingPolicy> child_policy_;
       OrphanablePtr<LoadBalancingPolicy> pending_child_policy_;
-      RefCountedPtr<PickerRef> picker_ref_;
-      grpc_connectivity_state connectivity_state_;
+      RefCountedPtr<PickerWrapper> picker_wrapper_;
+      grpc_connectivity_state connectivity_state_ = GRPC_CHANNEL_IDLE;
       uint32_t locality_weight_;
+      grpc_closure on_delayed_removal_timer_;
+      grpc_timer delayed_removal_timer_;
+      bool delayed_removal_timer_callback_pending_ = false;
     };
 
-    void UpdateLocked(const LocalityList& locality_list,
+    explicit LocalityMap(XdsLb* xds_policy) : xds_policy_(xds_policy) {}
+
+    void UpdateLocked(const XdsLocalityList& locality_list,
                       LoadBalancingPolicy::Config* child_policy_config,
-                      const grpc_channel_args* args, XdsLb* parent);
+                      const grpc_channel_args* args, XdsLb* parent,
+                      bool is_initial_update = false);
+    void UpdateXdsPickerLocked();
     void ShutdownLocked();
     void ResetBackoffLocked();
 
    private:
-    void PruneLocalities(const LocalityList& locality_list);
-    Map<RefCountedPtr<LocalityName>, OrphanablePtr<LocalityEntry>,
-        LocalityName::Less>
+    XdsLb* xds_policy_;
+    Map<RefCountedPtr<XdsLocalityName>, OrphanablePtr<LocalityEntry>,
+        XdsLocalityName::Less>
         map_;
   };
 
-  struct LocalityServerlistEntry {
-    ~LocalityServerlistEntry() { xds_grpclb_destroy_serverlist(serverlist); }
-
-    RefCountedPtr<LocalityName> locality_name;
-    uint32_t locality_weight;
-    // The deserialized response from the balancer. May be nullptr until one
-    // such response has arrived.
-    xds_grpclb_serverlist* serverlist;
-  };
-
   ~XdsLb();
 
   void ShutdownLocked() override;
 
   // Helper function used in UpdateLocked().
-  void ProcessAddressesAndChannelArgsLocked(const ServerAddressList& addresses,
+  void ProcessAddressesAndChannelArgsLocked(ServerAddressList addresses,
                                             const grpc_channel_args& args);
 
   // Parses the xds config given the JSON node of the first child of XdsConfig.
@@ -489,7 +545,7 @@ class XdsLb : public LoadBalancingPolicy {
   // found. Does nothing upon failure.
   void ParseLbConfig(const ParsedXdsConfig* xds_config);
 
-  BalancerChannelState* LatestLbChannel() const {
+  LbChannelState* LatestLbChannel() const {
     return pending_lb_chand_ != nullptr ? pending_lb_chand_.get()
                                         : lb_chand_.get();
   }
@@ -502,7 +558,7 @@ class XdsLb : public LoadBalancingPolicy {
       const char* name, const grpc_channel_args* args);
   void MaybeExitFallbackMode();
 
-  // Who the client is trying to communicate with.
+  // Name of the backend server to connect to.
   const char* server_name_ = nullptr;
 
   // Name of the balancer to connect to.
@@ -515,11 +571,11 @@ class XdsLb : public LoadBalancingPolicy {
   bool shutting_down_ = false;
 
   // The channel for communicating with the LB server.
-  OrphanablePtr<BalancerChannelState> lb_chand_;
-  OrphanablePtr<BalancerChannelState> pending_lb_chand_;
+  OrphanablePtr<LbChannelState> lb_chand_;
+  OrphanablePtr<LbChannelState> pending_lb_chand_;
 
   // Timeout in milliseconds for the LB call. 0 means no deadline.
-  int lb_call_timeout_ms_ = 0;
+  const grpc_millis lb_call_timeout_ms_;
 
   // Whether the checks for fallback at startup are ALL pending. There are
   // several cases where this can be reset:
@@ -531,7 +587,7 @@ class XdsLb : public LoadBalancingPolicy {
   bool fallback_at_startup_checks_pending_ = false;
   // Timeout in milliseconds for before using fallback backend addresses.
   // 0 means not using fallback.
-  int lb_fallback_timeout_ms_ = 0;
+  const grpc_millis lb_fallback_timeout_ms_;
   // The backend addresses from the resolver.
   ServerAddressList fallback_backend_addresses_;
   // Fallback timer.
@@ -546,34 +602,75 @@ class XdsLb : public LoadBalancingPolicy {
 
   // The policy to use for the backends.
   RefCountedPtr<LoadBalancingPolicy::Config> child_policy_config_;
+  const grpc_millis locality_retention_interval_ms_;
   // Map of policies to use in the backend
   LocalityMap locality_map_;
   // TODO(mhaidry) : Add support for multiple maps of localities
   // with different priorities
-  LocalityList locality_serverlist_;
+  XdsLocalityList locality_list_;
   // TODO(mhaidry) : Add a pending locality map that may be swapped with the
   // the current one when new localities in the pending map are ready
   // to accept connections
+
+  // The config for dropping calls.
+  RefCountedPtr<XdsDropConfig> drop_config_;
+
+  // The stats for client-side load reporting.
+  XdsClientStats client_stats_;
 };
 
 //
+// XdsLb::PickerWrapper::Pick
+//
+
+LoadBalancingPolicy::PickResult XdsLb::PickerWrapper::Pick(
+    LoadBalancingPolicy::PickArgs args) {
+  // Forward the pick to the picker returned from the child policy.
+  PickResult result = picker_->Pick(args);
+  if (result.type != PickResult::PICK_COMPLETE ||
+      result.subchannel == nullptr || locality_stats_ == nullptr) {
+    return result;
+  }
+  // Record a call started.
+  locality_stats_->AddCallStarted();
+  // Intercept the recv_trailing_metadata op to record call completion.
+  result.recv_trailing_metadata_ready = RecordCallCompletion;
+  result.recv_trailing_metadata_ready_user_data =
+      locality_stats_->Ref(DEBUG_LOCATION, "LocalityStats+call").release();
+  return result;
+}
+
+// Note that the following callback does not run in either the control plane
+// combiner or the data plane combiner.
+void XdsLb::PickerWrapper::RecordCallCompletion(
+    void* arg, grpc_error* error,
+    LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata,
+    LoadBalancingPolicy::CallState* call_state) {
+  XdsClientStats::LocalityStats* locality_stats =
+      static_cast<XdsClientStats::LocalityStats*>(arg);
+  const bool call_failed = error != GRPC_ERROR_NONE;
+  locality_stats->AddCallFinished(call_failed);
+  locality_stats->Unref(DEBUG_LOCATION, "LocalityStats+call");
+}
+
+//
 // XdsLb::Picker
 //
 
 XdsLb::PickResult XdsLb::Picker::Pick(PickArgs args) {
-  // TODO(roth): Add support for drop handling.
-  // Generate a random number between 0 and the total weight
-  const uint32_t key =
-      (rand() * pickers_[pickers_.size() - 1].first) / RAND_MAX;
+  // Handle drop.
+  const UniquePtr<char>* drop_category;
+  if (drop_config_->ShouldDrop(&drop_category)) {
+    xds_policy_->client_stats_.AddCallDropped(*drop_category);
+    PickResult result;
+    result.type = PickResult::PICK_COMPLETE;
+    return result;
+  }
+  // Generate a random number in [0, total weight).
+  const uint32_t key = rand() % pickers_[pickers_.size() - 1].first;
   // Forward pick to whichever locality maps to the range in which the
   // random number falls in.
-  PickResult result = PickFromLocality(key, args);
-  // If pick succeeded, add client stats.
-  if (result.type == PickResult::PICK_COMPLETE &&
-      result.connected_subchannel != nullptr && client_stats_ != nullptr) {
-    // TODO(roth): Add support for client stats.
-  }
-  return result;
+  return PickFromLocality(key, args);
 }
 
 XdsLb::PickResult XdsLb::Picker::PickFromLocality(const uint32_t key,
@@ -621,15 +718,6 @@ RefCountedPtr<SubchannelInterface> XdsLb::FallbackHelper::CreateSubchannel(
   return parent_->channel_control_helper()->CreateSubchannel(args);
 }
 
-grpc_channel* XdsLb::FallbackHelper::CreateChannel(
-    const char* target, const grpc_channel_args& args) {
-  if (parent_->shutting_down_ ||
-      (!CalledByPendingFallback() && !CalledByCurrentFallback())) {
-    return nullptr;
-  }
-  return parent_->channel_control_helper()->CreateChannel(target, args);
-}
-
 void XdsLb::FallbackHelper::UpdateState(grpc_connectivity_state state,
                                         UniquePtr<SubchannelPicker> picker) {
   if (parent_->shutting_down_) return;
@@ -672,7 +760,7 @@ void XdsLb::FallbackHelper::RequestReresolution() {
 }
 
 void XdsLb::FallbackHelper::AddTraceEvent(TraceSeverity severity,
-                                          const char* message) {
+                                          StringView message) {
   if (parent_->shutting_down_ ||
       (!CalledByPendingFallback() && !CalledByCurrentFallback())) {
     return;
@@ -681,172 +769,45 @@ void XdsLb::FallbackHelper::AddTraceEvent(TraceSeverity severity,
 }
 
 //
-// serverlist parsing code
-//
-
-// Returns the backend addresses extracted from the given addresses.
-ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) {
-  ServerAddressList backend_addresses;
-  for (size_t i = 0; i < addresses.size(); ++i) {
-    if (!addresses[i].IsBalancer()) {
-      backend_addresses.emplace_back(addresses[i]);
-    }
-  }
-  return backend_addresses;
-}
-
-bool IsServerValid(const xds_grpclb_server* server, size_t idx, bool log) {
-  if (server->drop) return false;
-  const xds_grpclb_ip_address* ip = &server->ip_address;
-  if (GPR_UNLIKELY(server->port >> 16 != 0)) {
-    if (log) {
-      gpr_log(GPR_ERROR,
-              "Invalid port '%d' at index %lu of serverlist. Ignoring.",
-              server->port, (unsigned long)idx);
-    }
-    return false;
-  }
-  if (GPR_UNLIKELY(ip->size != 4 && ip->size != 16)) {
-    if (log) {
-      gpr_log(GPR_ERROR,
-              "Expected IP to be 4 or 16 bytes, got %d at index %lu of "
-              "serverlist. Ignoring",
-              ip->size, (unsigned long)idx);
-    }
-    return false;
-  }
-  return true;
-}
-
-void ParseServer(const xds_grpclb_server* server, grpc_resolved_address* addr) {
-  memset(addr, 0, sizeof(*addr));
-  if (server->drop) return;
-  const uint16_t netorder_port = grpc_htons((uint16_t)server->port);
-  /* the addresses are given in binary format (a in(6)_addr struct) in
-   * server->ip_address.bytes. */
-  const xds_grpclb_ip_address* ip = &server->ip_address;
-  if (ip->size == 4) {
-    addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
-    grpc_sockaddr_in* addr4 = reinterpret_cast<grpc_sockaddr_in*>(&addr->addr);
-    addr4->sin_family = GRPC_AF_INET;
-    memcpy(&addr4->sin_addr, ip->bytes, ip->size);
-    addr4->sin_port = netorder_port;
-  } else if (ip->size == 16) {
-    addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in6));
-    grpc_sockaddr_in6* addr6 = (grpc_sockaddr_in6*)&addr->addr;
-    addr6->sin6_family = GRPC_AF_INET6;
-    memcpy(&addr6->sin6_addr, ip->bytes, ip->size);
-    addr6->sin6_port = netorder_port;
-  }
-}
-
-// Returns addresses extracted from \a serverlist.
-ServerAddressList ProcessServerlist(const xds_grpclb_serverlist* serverlist) {
-  ServerAddressList addresses;
-  for (size_t i = 0; i < serverlist->num_servers; ++i) {
-    const xds_grpclb_server* server = serverlist->servers[i];
-    if (!IsServerValid(serverlist->servers[i], i, false)) continue;
-    grpc_resolved_address addr;
-    ParseServer(server, &addr);
-    addresses.emplace_back(addr, nullptr);
-  }
-  return addresses;
-}
-
-//
-// XdsLb::BalancerChannelState
+// XdsLb::LbChannelState
 //
 
-XdsLb::BalancerChannelState::BalancerChannelState(
-    const char* balancer_name, const grpc_channel_args& args,
-    RefCountedPtr<XdsLb> parent_xdslb_policy)
-    : InternallyRefCounted<BalancerChannelState>(&grpc_lb_xds_trace),
-      xdslb_policy_(std::move(parent_xdslb_policy)),
-      lb_call_backoff_(
-          BackOff::Options()
-              .set_initial_backoff(GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS *
-                                   1000)
-              .set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER)
-              .set_jitter(GRPC_XDS_RECONNECT_JITTER)
-              .set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
-  GRPC_CLOSURE_INIT(&on_connectivity_changed_,
-                    &XdsLb::BalancerChannelState::OnConnectivityChangedLocked,
+XdsLb::LbChannelState::LbChannelState(RefCountedPtr<XdsLb> xdslb_policy,
+                                      const char* balancer_name,
+                                      const grpc_channel_args& args)
+    : InternallyRefCounted<LbChannelState>(&grpc_lb_xds_trace),
+      xdslb_policy_(std::move(xdslb_policy)) {
+  GRPC_CLOSURE_INIT(&on_connectivity_changed_, OnConnectivityChangedLocked,
                     this, grpc_combiner_scheduler(xdslb_policy_->combiner()));
-  channel_ = xdslb_policy_->channel_control_helper()->CreateChannel(
-      balancer_name, args);
+  channel_ = CreateXdsBalancerChannel(balancer_name, args);
   GPR_ASSERT(channel_ != nullptr);
-  StartCallLocked();
-}
-
-XdsLb::BalancerChannelState::~BalancerChannelState() {
-  xdslb_policy_.reset(DEBUG_LOCATION, "BalancerChannelState");
-  grpc_channel_destroy(channel_);
+  eds_calld_.reset(New<RetryableLbCall<EdsCallState>>(
+      Ref(DEBUG_LOCATION, "LbChannelState+eds")));
+  lrs_calld_.reset(New<RetryableLbCall<LrsCallState>>(
+      Ref(DEBUG_LOCATION, "LbChannelState+lrs")));
 }
 
-void XdsLb::BalancerChannelState::Orphan() {
-  shutting_down_ = true;
-  lb_calld_.reset();
-  if (retry_timer_callback_pending_) grpc_timer_cancel(&lb_call_retry_timer_);
-  Unref(DEBUG_LOCATION, "lb_channel_orphaned");
-}
-
-void XdsLb::BalancerChannelState::StartCallRetryTimerLocked() {
-  grpc_millis next_try = lb_call_backoff_.NextAttemptTime();
+XdsLb::LbChannelState::~LbChannelState() {
   if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
-    gpr_log(GPR_INFO,
-            "[xdslb %p] Failed to connect to LB server (lb_chand: %p)...",
-            xdslb_policy_.get(), this);
-    grpc_millis timeout = next_try - ExecCtx::Get()->Now();
-    if (timeout > 0) {
-      gpr_log(GPR_INFO, "[xdslb %p] ... retry_timer_active in %" PRId64 "ms.",
-              xdslb_policy_.get(), timeout);
-    } else {
-      gpr_log(GPR_INFO, "[xdslb %p] ... retry_timer_active immediately.",
-              xdslb_policy_.get());
-    }
-  }
-  Ref(DEBUG_LOCATION, "on_balancer_call_retry_timer").release();
-  GRPC_CLOSURE_INIT(&lb_on_call_retry_, &OnCallRetryTimerLocked, this,
-                    grpc_combiner_scheduler(xdslb_policy_->combiner()));
-  grpc_timer_init(&lb_call_retry_timer_, next_try, &lb_on_call_retry_);
-  retry_timer_callback_pending_ = true;
-}
-
-void XdsLb::BalancerChannelState::OnCallRetryTimerLocked(void* arg,
-                                                         grpc_error* error) {
-  BalancerChannelState* lb_chand = static_cast<BalancerChannelState*>(arg);
-  lb_chand->retry_timer_callback_pending_ = false;
-  if (!lb_chand->shutting_down_ && error == GRPC_ERROR_NONE &&
-      lb_chand->lb_calld_ == nullptr) {
-    if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
-      gpr_log(GPR_INFO,
-              "[xdslb %p] Restarting call to LB server (lb_chand: %p)",
-              lb_chand->xdslb_policy_.get(), lb_chand);
-    }
-    lb_chand->StartCallLocked();
+    gpr_log(GPR_INFO, "[xdslb %p] Destroying LB channel %p", xdslb_policy(),
+            this);
   }
-  lb_chand->Unref(DEBUG_LOCATION, "on_balancer_call_retry_timer");
+  grpc_channel_destroy(channel_);
 }
 
-void XdsLb::BalancerChannelState::StartCallLocked() {
-  if (shutting_down_) return;
-  GPR_ASSERT(channel_ != nullptr);
-  GPR_ASSERT(lb_calld_ == nullptr);
-  lb_calld_ = MakeOrphanable<BalancerCallState>(Ref());
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
-    gpr_log(GPR_INFO,
-            "[xdslb %p] Query for backends (lb_chand: %p, lb_calld: %p)",
-            xdslb_policy_.get(), this, lb_calld_.get());
-  }
-  lb_calld_->StartQuery();
+void XdsLb::LbChannelState::Orphan() {
+  shutting_down_ = true;
+  eds_calld_.reset();
+  lrs_calld_.reset();
+  Unref(DEBUG_LOCATION, "LbChannelState+orphaned");
 }
 
-void XdsLb::BalancerChannelState::StartConnectivityWatchLocked() {
+void XdsLb::LbChannelState::StartConnectivityWatchLocked() {
   grpc_channel_element* client_channel_elem =
       grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
   GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
   // Ref held by callback.
-  Ref(DEBUG_LOCATION, "watch_lb_channel_connectivity").release();
+  Ref(DEBUG_LOCATION, "LbChannelState+start_watch").release();
   grpc_client_channel_watch_connectivity_state(
       client_channel_elem,
       grpc_polling_entity_create_from_pollset_set(
@@ -854,7 +815,7 @@ void XdsLb::BalancerChannelState::StartConnectivityWatchLocked() {
       &connectivity_, &on_connectivity_changed_, nullptr);
 }
 
-void XdsLb::BalancerChannelState::CancelConnectivityWatchLocked() {
+void XdsLb::LbChannelState::CancelConnectivityWatchLocked() {
   grpc_channel_element* client_channel_elem =
       grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
   GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
@@ -865,9 +826,9 @@ void XdsLb::BalancerChannelState::CancelConnectivityWatchLocked() {
       nullptr, &on_connectivity_changed_, nullptr);
 }
 
-void XdsLb::BalancerChannelState::OnConnectivityChangedLocked(
-    void* arg, grpc_error* error) {
-  BalancerChannelState* self = static_cast<BalancerChannelState*>(arg);
+void XdsLb::LbChannelState::OnConnectivityChangedLocked(void* arg,
+                                                        grpc_error* error) {
+  LbChannelState* self = static_cast<LbChannelState*>(arg);
   if (!self->shutting_down_ &&
       self->xdslb_policy_->fallback_at_startup_checks_pending_) {
     if (self->connectivity_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {
@@ -894,84 +855,145 @@ void XdsLb::BalancerChannelState::OnConnectivityChangedLocked(
     self->xdslb_policy_->UpdateFallbackPolicyLocked();
   }
   // Done watching connectivity state, so drop ref.
-  self->Unref(DEBUG_LOCATION, "watch_lb_channel_connectivity");
+  self->Unref(DEBUG_LOCATION, "LbChannelState+watch_done");
 }
 
 //
-// XdsLb::BalancerChannelState::BalancerCallState
+// XdsLb::LbChannelState::RetryableLbCall<>
 //
 
-XdsLb::BalancerChannelState::BalancerCallState::BalancerCallState(
-    RefCountedPtr<BalancerChannelState> lb_chand)
-    : InternallyRefCounted<BalancerCallState>(&grpc_lb_xds_trace),
-      lb_chand_(std::move(lb_chand)) {
-  GPR_ASSERT(xdslb_policy() != nullptr);
-  GPR_ASSERT(!xdslb_policy()->shutting_down_);
+template <typename T>
+XdsLb::LbChannelState::RetryableLbCall<T>::RetryableLbCall(
+    RefCountedPtr<LbChannelState> lb_chand)
+    : lb_chand_(std::move(lb_chand)),
+      backoff_(
+          BackOff::Options()
+              .set_initial_backoff(GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS *
+                                   1000)
+              .set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER)
+              .set_jitter(GRPC_XDS_RECONNECT_JITTER)
+              .set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
+  GRPC_CLOSURE_INIT(
+      &on_retry_timer_, OnRetryTimerLocked, this,
+      grpc_combiner_scheduler(lb_chand_->xdslb_policy()->combiner()));
+  StartNewCallLocked();
+}
+
+template <typename T>
+void XdsLb::LbChannelState::RetryableLbCall<T>::Orphan() {
+  shutting_down_ = true;
+  lb_calld_.reset();
+  if (retry_timer_callback_pending_) grpc_timer_cancel(&retry_timer_);
+  this->Unref(DEBUG_LOCATION, "RetryableLbCall+orphaned");
+}
+
+template <typename T>
+void XdsLb::LbChannelState::RetryableLbCall<T>::OnCallFinishedLocked() {
+  const bool seen_response = lb_calld_->seen_response();
+  lb_calld_.reset();
+  if (seen_response) {
+    // If we lost connection to the LB server, reset backoff and restart the LB
+    // call immediately.
+    backoff_.Reset();
+    StartNewCallLocked();
+  } else {
+    // If we failed to connect to the LB server, retry later.
+    StartRetryTimerLocked();
+  }
+}
+
+template <typename T>
+void XdsLb::LbChannelState::RetryableLbCall<T>::StartNewCallLocked() {
+  if (shutting_down_) return;
+  GPR_ASSERT(lb_chand_->channel_ != nullptr);
+  GPR_ASSERT(lb_calld_ == nullptr);
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+    gpr_log(GPR_INFO,
+            "[xdslb %p] Start new call from retryable call (lb_chand: %p, "
+            "retryable call: %p)",
+            lb_chand()->xdslb_policy(), lb_chand(), this);
+  }
+  lb_calld_ = MakeOrphanable<T>(
+      this->Ref(DEBUG_LOCATION, "RetryableLbCall+start_new_call"));
+}
+
+template <typename T>
+void XdsLb::LbChannelState::RetryableLbCall<T>::StartRetryTimerLocked() {
+  if (shutting_down_) return;
+  const grpc_millis next_attempt_time = backoff_.NextAttemptTime();
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+    grpc_millis timeout = GPR_MAX(next_attempt_time - ExecCtx::Get()->Now(), 0);
+    gpr_log(GPR_INFO,
+            "[xdslb %p] Failed to connect to LB server (lb_chand: %p) "
+            "retry timer will fire in %" PRId64 "ms.",
+            lb_chand()->xdslb_policy(), lb_chand(), timeout);
+  }
+  this->Ref(DEBUG_LOCATION, "RetryableLbCall+retry_timer_start").release();
+  grpc_timer_init(&retry_timer_, next_attempt_time, &on_retry_timer_);
+  retry_timer_callback_pending_ = true;
+}
+
+template <typename T>
+void XdsLb::LbChannelState::RetryableLbCall<T>::OnRetryTimerLocked(
+    void* arg, grpc_error* error) {
+  RetryableLbCall* lb_calld = static_cast<RetryableLbCall*>(arg);
+  lb_calld->retry_timer_callback_pending_ = false;
+  if (!lb_calld->shutting_down_ && error == GRPC_ERROR_NONE) {
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+      gpr_log(GPR_INFO,
+              "[xdslb %p] Retry timer fires (lb_chand: %p, retryable call: %p)",
+              lb_calld->lb_chand()->xdslb_policy(), lb_calld->lb_chand(),
+              lb_calld);
+    }
+    lb_calld->StartNewCallLocked();
+  }
+  lb_calld->Unref(DEBUG_LOCATION, "RetryableLbCall+retry_timer_done");
+}
+
+//
+// XdsLb::LbChannelState::EdsCallState
+//
+
+XdsLb::LbChannelState::EdsCallState::EdsCallState(
+    RefCountedPtr<RetryableLbCall<EdsCallState>> parent)
+    : InternallyRefCounted<EdsCallState>(&grpc_lb_xds_trace),
+      parent_(std::move(parent)) {
   // Init the LB call. Note that the LB call will progress every time there's
-  // activity in xdslb_policy_->interested_parties(), which is comprised of
+  // activity in xdslb_policy()->interested_parties(), which is comprised of
   // the polling entities from client_channel.
+  GPR_ASSERT(xdslb_policy() != nullptr);
   GPR_ASSERT(xdslb_policy()->server_name_ != nullptr);
   GPR_ASSERT(xdslb_policy()->server_name_[0] != '\0');
   const grpc_millis deadline =
       xdslb_policy()->lb_call_timeout_ms_ == 0
           ? GRPC_MILLIS_INF_FUTURE
           : ExecCtx::Get()->Now() + xdslb_policy()->lb_call_timeout_ms_;
+  // Create an LB call with the specified method name.
   lb_call_ = grpc_channel_create_pollset_set_call(
-      lb_chand_->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
+      lb_chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
       xdslb_policy()->interested_parties(),
-      GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD,
+      GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS,
       nullptr, deadline, nullptr);
+  GPR_ASSERT(lb_call_ != nullptr);
   // Init the LB call request payload.
-  xds_grpclb_request* request =
-      xds_grpclb_request_create(xdslb_policy()->server_name_);
-  grpc_slice request_payload_slice = xds_grpclb_request_encode(request);
+  grpc_slice request_payload_slice =
+      XdsEdsRequestCreateAndEncode(xdslb_policy()->server_name_);
   send_message_payload_ =
       grpc_raw_byte_buffer_create(&request_payload_slice, 1);
   grpc_slice_unref_internal(request_payload_slice);
-  xds_grpclb_request_destroy(request);
   // Init other data associated with the LB call.
-  grpc_metadata_array_init(&lb_initial_metadata_recv_);
-  grpc_metadata_array_init(&lb_trailing_metadata_recv_);
-  GRPC_CLOSURE_INIT(&lb_on_initial_request_sent_, OnInitialRequestSentLocked,
-                    this, grpc_combiner_scheduler(xdslb_policy()->combiner()));
-  GRPC_CLOSURE_INIT(&lb_on_balancer_message_received_,
-                    OnBalancerMessageReceivedLocked, this,
+  grpc_metadata_array_init(&initial_metadata_recv_);
+  grpc_metadata_array_init(&trailing_metadata_recv_);
+  GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceivedLocked, this,
                     grpc_combiner_scheduler(xdslb_policy()->combiner()));
-  GRPC_CLOSURE_INIT(&lb_on_balancer_status_received_,
-                    OnBalancerStatusReceivedLocked, this,
+  GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceivedLocked, this,
                     grpc_combiner_scheduler(xdslb_policy()->combiner()));
-}
-
-XdsLb::BalancerChannelState::BalancerCallState::~BalancerCallState() {
-  GPR_ASSERT(lb_call_ != nullptr);
-  grpc_call_unref(lb_call_);
-  grpc_metadata_array_destroy(&lb_initial_metadata_recv_);
-  grpc_metadata_array_destroy(&lb_trailing_metadata_recv_);
-  grpc_byte_buffer_destroy(send_message_payload_);
-  grpc_byte_buffer_destroy(recv_message_payload_);
-  grpc_slice_unref_internal(lb_call_status_details_);
-}
-
-void XdsLb::BalancerChannelState::BalancerCallState::Orphan() {
-  GPR_ASSERT(lb_call_ != nullptr);
-  // If we are here because xdslb_policy wants to cancel the call,
-  // lb_on_balancer_status_received_ will complete the cancellation and clean
-  // up. Otherwise, we are here because xdslb_policy has to orphan a failed
-  // call, then the following cancellation will be a no-op.
-  grpc_call_cancel(lb_call_, nullptr);
-  if (client_load_report_timer_callback_pending_) {
-    grpc_timer_cancel(&client_load_report_timer_);
-  }
-  // Note that the initial ref is hold by lb_on_balancer_status_received_
-  // instead of the caller of this function. So the corresponding unref happens
-  // in lb_on_balancer_status_received_ instead of here.
-}
-
-void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() {
-  GPR_ASSERT(lb_call_ != nullptr);
+  // Start the call.
   if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
-    gpr_log(GPR_INFO, "[xdslb %p] Starting LB call (lb_calld: %p, lb_call: %p)",
-            xdslb_policy(), this, lb_call_);
+    gpr_log(GPR_INFO,
+            "[xdslb %p] Starting EDS call (lb_chand: %p, lb_calld: %p, "
+            "lb_call: %p)",
+            xdslb_policy(), lb_chand(), this, lb_call_);
   }
   // Create the ops.
   grpc_call_error call_error;
@@ -991,19 +1013,14 @@ void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() {
   op->flags = 0;
   op->reserved = nullptr;
   op++;
-  // TODO(roth): We currently track this ref manually.  Once the
-  // ClosureRef API is ready, we should pass the RefCountedPtr<> along
-  // with the callback.
-  auto self = Ref(DEBUG_LOCATION, "on_initial_request_sent");
-  self.release();
-  call_error = grpc_call_start_batch_and_execute(
-      lb_call_, ops, (size_t)(op - ops), &lb_on_initial_request_sent_);
+  call_error = grpc_call_start_batch_and_execute(lb_call_, ops,
+                                                 (size_t)(op - ops), nullptr);
   GPR_ASSERT(GRPC_CALL_OK == call_error);
   // Op: recv initial metadata.
   op = ops;
   op->op = GRPC_OP_RECV_INITIAL_METADATA;
   op->data.recv_initial_metadata.recv_initial_metadata =
-      &lb_initial_metadata_recv_;
+      &initial_metadata_recv_;
   op->flags = 0;
   op->reserved = nullptr;
   op++;
@@ -1013,21 +1030,16 @@ void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() {
   op->flags = 0;
   op->reserved = nullptr;
   op++;
-  // TODO(roth): We currently track this ref manually.  Once the
-  // ClosureRef API is ready, we should pass the RefCountedPtr<> along
-  // with the callback.
-  self = Ref(DEBUG_LOCATION, "on_message_received");
-  self.release();
+  Ref(DEBUG_LOCATION, "EDS+OnResponseReceivedLocked").release();
   call_error = grpc_call_start_batch_and_execute(
-      lb_call_, ops, (size_t)(op - ops), &lb_on_balancer_message_received_);
+      lb_call_, ops, (size_t)(op - ops), &on_response_received_);
   GPR_ASSERT(GRPC_CALL_OK == call_error);
   // Op: recv server status.
   op = ops;
   op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
-  op->data.recv_status_on_client.trailing_metadata =
-      &lb_trailing_metadata_recv_;
-  op->data.recv_status_on_client.status = &lb_call_status_;
-  op->data.recv_status_on_client.status_details = &lb_call_status_details_;
+  op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv_;
+  op->data.recv_status_on_client.status = &status_code_;
+  op->data.recv_status_on_client.status_details = &status_details_;
   op->flags = 0;
   op->reserved = nullptr;
   op++;
@@ -1035,276 +1047,203 @@ void XdsLb::BalancerChannelState::BalancerCallState::StartQuery() {
   // ref instead of a new ref. When it's invoked, it's the initial ref that is
   // unreffed.
   call_error = grpc_call_start_batch_and_execute(
-      lb_call_, ops, (size_t)(op - ops), &lb_on_balancer_status_received_);
+      lb_call_, ops, (size_t)(op - ops), &on_status_received_);
   GPR_ASSERT(GRPC_CALL_OK == call_error);
 }
 
-void XdsLb::BalancerChannelState::BalancerCallState::
-    ScheduleNextClientLoadReportLocked() {
-  const grpc_millis next_client_load_report_time =
-      ExecCtx::Get()->Now() + client_stats_report_interval_;
-  GRPC_CLOSURE_INIT(&client_load_report_closure_,
-                    MaybeSendClientLoadReportLocked, this,
-                    grpc_combiner_scheduler(xdslb_policy()->combiner()));
-  grpc_timer_init(&client_load_report_timer_, next_client_load_report_time,
-                  &client_load_report_closure_);
-  client_load_report_timer_callback_pending_ = true;
+XdsLb::LbChannelState::EdsCallState::~EdsCallState() {
+  grpc_metadata_array_destroy(&initial_metadata_recv_);
+  grpc_metadata_array_destroy(&trailing_metadata_recv_);
+  grpc_byte_buffer_destroy(send_message_payload_);
+  grpc_byte_buffer_destroy(recv_message_payload_);
+  grpc_slice_unref_internal(status_details_);
+  GPR_ASSERT(lb_call_ != nullptr);
+  grpc_call_unref(lb_call_);
 }
 
-void XdsLb::BalancerChannelState::BalancerCallState::
-    MaybeSendClientLoadReportLocked(void* arg, grpc_error* error) {
-  BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
-  lb_calld->client_load_report_timer_callback_pending_ = false;
-  if (error != GRPC_ERROR_NONE || !lb_calld->IsCurrentCallOnChannel()) {
-    lb_calld->Unref(DEBUG_LOCATION, "client_load_report");
-    return;
-  }
-  // If we've already sent the initial request, then we can go ahead and send
-  // the load report. Otherwise, we need to wait until the initial request has
-  // been sent to send this (see OnInitialRequestSentLocked()).
-  if (lb_calld->send_message_payload_ == nullptr) {
-    lb_calld->SendClientLoadReportLocked();
-  } else {
-    lb_calld->client_load_report_is_due_ = true;
-  }
-}
-
-bool XdsLb::BalancerChannelState::BalancerCallState::LoadReportCountersAreZero(
-    xds_grpclb_request* request) {
-  XdsLbClientStats::DroppedCallCounts* drop_entries =
-      static_cast<XdsLbClientStats::DroppedCallCounts*>(
-          request->client_stats.calls_finished_with_drop.arg);
-  return request->client_stats.num_calls_started == 0 &&
-         request->client_stats.num_calls_finished == 0 &&
-         request->client_stats.num_calls_finished_with_client_failed_to_send ==
-             0 &&
-         request->client_stats.num_calls_finished_known_received == 0 &&
-         (drop_entries == nullptr || drop_entries->empty());
-}
-
-// TODO(vpowar): Use LRS to send the client Load Report.
-void XdsLb::BalancerChannelState::BalancerCallState::
-    SendClientLoadReportLocked() {
-  // Construct message payload.
-  GPR_ASSERT(send_message_payload_ == nullptr);
-  xds_grpclb_request* request =
-      xds_grpclb_load_report_request_create_locked(client_stats_.get());
-  // Skip client load report if the counters were all zero in the last
-  // report and they are still zero in this one.
-  if (LoadReportCountersAreZero(request)) {
-    if (last_client_load_report_counters_were_zero_) {
-      xds_grpclb_request_destroy(request);
-      ScheduleNextClientLoadReportLocked();
-      return;
-    }
-    last_client_load_report_counters_were_zero_ = true;
-  } else {
-    last_client_load_report_counters_were_zero_ = false;
-  }
-  // TODO(vpowar): Send the report on LRS stream.
-  xds_grpclb_request_destroy(request);
+void XdsLb::LbChannelState::EdsCallState::Orphan() {
+  GPR_ASSERT(lb_call_ != nullptr);
+  // If we are here because xdslb_policy wants to cancel the call,
+  // on_status_received_ will complete the cancellation and clean up. Otherwise,
+  // we are here because xdslb_policy has to orphan a failed call, then the
+  // following cancellation will be a no-op.
+  grpc_call_cancel(lb_call_, nullptr);
+  // Note that the initial ref is hold by on_status_received_. So the
+  // corresponding unref happens in on_status_received_ instead of here.
 }
 
-void XdsLb::BalancerChannelState::BalancerCallState::OnInitialRequestSentLocked(
+void XdsLb::LbChannelState::EdsCallState::OnResponseReceivedLocked(
     void* arg, grpc_error* error) {
-  BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
-  grpc_byte_buffer_destroy(lb_calld->send_message_payload_);
-  lb_calld->send_message_payload_ = nullptr;
-  // If we attempted to send a client load report before the initial request was
-  // sent (and this lb_calld is still in use), send the load report now.
-  if (lb_calld->client_load_report_is_due_ &&
-      lb_calld->IsCurrentCallOnChannel()) {
-    lb_calld->SendClientLoadReportLocked();
-    lb_calld->client_load_report_is_due_ = false;
-  }
-  lb_calld->Unref(DEBUG_LOCATION, "on_initial_request_sent");
-}
-
-void XdsLb::BalancerChannelState::BalancerCallState::
-    OnBalancerMessageReceivedLocked(void* arg, grpc_error* error) {
-  BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
-  XdsLb* xdslb_policy = lb_calld->xdslb_policy();
+  EdsCallState* eds_calld = static_cast<EdsCallState*>(arg);
+  LbChannelState* lb_chand = eds_calld->lb_chand();
+  XdsLb* xdslb_policy = eds_calld->xdslb_policy();
   // Empty payload means the LB call was cancelled.
-  if (!lb_calld->IsCurrentCallOnChannel() ||
-      lb_calld->recv_message_payload_ == nullptr) {
-    lb_calld->Unref(DEBUG_LOCATION, "on_message_received");
+  if (!eds_calld->IsCurrentCallOnChannel() ||
+      eds_calld->recv_message_payload_ == nullptr) {
+    eds_calld->Unref(DEBUG_LOCATION, "EDS+OnResponseReceivedLocked");
     return;
   }
+  // Read the response.
   grpc_byte_buffer_reader bbr;
-  grpc_byte_buffer_reader_init(&bbr, lb_calld->recv_message_payload_);
+  grpc_byte_buffer_reader_init(&bbr, eds_calld->recv_message_payload_);
   grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
   grpc_byte_buffer_reader_destroy(&bbr);
-  grpc_byte_buffer_destroy(lb_calld->recv_message_payload_);
-  lb_calld->recv_message_payload_ = nullptr;
-  xds_grpclb_initial_response* initial_response;
-  xds_grpclb_serverlist* serverlist;
-  if (!lb_calld->seen_initial_response_ &&
-      (initial_response = xds_grpclb_initial_response_parse(response_slice)) !=
-          nullptr) {
-    // Have NOT seen initial response, look for initial response.
-    // TODO(juanlishen): When we convert this to use the xds protocol, the
-    // balancer will send us a fallback timeout such that we should go into
-    // fallback mode if we have lost contact with the balancer after a certain
-    // period of time. We will need to save the timeout value here, and then
-    // when the balancer call ends, we will need to start a timer for the
-    // specified period of time, and if the timer fires, we go into fallback
-    // mode. We will also need to cancel the timer when we receive a serverlist
-    // from the balancer.
-    if (initial_response->has_client_stats_report_interval) {
-      const grpc_millis interval = xds_grpclb_duration_to_millis(
-          &initial_response->client_stats_report_interval);
-      if (interval > 0) {
-        lb_calld->client_stats_report_interval_ =
-            GPR_MAX(GPR_MS_PER_SEC, interval);
-      }
+  grpc_byte_buffer_destroy(eds_calld->recv_message_payload_);
+  eds_calld->recv_message_payload_ = nullptr;
+  // TODO(juanlishen): When we convert this to use the xds protocol, the
+  // balancer will send us a fallback timeout such that we should go into
+  // fallback mode if we have lost contact with the balancer after a certain
+  // period of time. We will need to save the timeout value here, and then
+  // when the balancer call ends, we will need to start a timer for the
+  // specified period of time, and if the timer fires, we go into fallback
+  // mode. We will also need to cancel the timer when we receive a serverlist
+  // from the balancer.
+  // This anonymous lambda is a hack to avoid the usage of goto.
+  [&]() {
+    // Parse the response.
+    XdsUpdate update;
+    grpc_error* parse_error =
+        XdsEdsResponseDecodeAndParse(response_slice, &update);
+    if (parse_error != GRPC_ERROR_NONE) {
+      gpr_log(GPR_ERROR, "[xdslb %p] EDS response parsing failed. error=%s",
+              xdslb_policy, grpc_error_string(parse_error));
+      GRPC_ERROR_UNREF(parse_error);
+      return;
     }
-    if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
-      if (lb_calld->client_stats_report_interval_ != 0) {
-        gpr_log(GPR_INFO,
-                "[xdslb %p] Received initial LB response message; "
-                "client load reporting interval = %" PRId64 " milliseconds",
-                xdslb_policy, lb_calld->client_stats_report_interval_);
-      } else {
-        gpr_log(GPR_INFO,
-                "[xdslb %p] Received initial LB response message; client load "
-                "reporting NOT enabled",
-                xdslb_policy);
-      }
+    if (update.locality_list.empty() && !update.drop_all) {
+      char* response_slice_str =
+          grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX);
+      gpr_log(GPR_ERROR,
+              "[xdslb %p] EDS response '%s' doesn't contain any valid locality "
+              "but doesn't require to drop all calls. Ignoring.",
+              xdslb_policy, response_slice_str);
+      gpr_free(response_slice_str);
+      return;
     }
-    xds_grpclb_initial_response_destroy(initial_response);
-    lb_calld->seen_initial_response_ = true;
-  } else if ((serverlist = xds_grpclb_response_parse_serverlist(
-                  response_slice)) != nullptr) {
-    // Have seen initial response, look for serverlist.
-    GPR_ASSERT(lb_calld->lb_call_ != nullptr);
+    eds_calld->seen_response_ = true;
     if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
       gpr_log(GPR_INFO,
-              "[xdslb %p] Serverlist with %" PRIuPTR " servers received",
-              xdslb_policy, serverlist->num_servers);
-      for (size_t i = 0; i < serverlist->num_servers; ++i) {
-        grpc_resolved_address addr;
-        ParseServer(serverlist->servers[i], &addr);
-        char* ipport;
-        grpc_sockaddr_to_string(&ipport, &addr, false);
-        gpr_log(GPR_INFO, "[xdslb %p] Serverlist[%" PRIuPTR "]: %s",
-                xdslb_policy, i, ipport);
-        gpr_free(ipport);
+              "[xdslb %p] EDS response with %" PRIuPTR
+              " localities and %" PRIuPTR
+              " drop categories received (drop_all=%d)",
+              xdslb_policy, update.locality_list.size(),
+              update.drop_config->drop_category_list().size(), update.drop_all);
+      for (size_t i = 0; i < update.locality_list.size(); ++i) {
+        const XdsLocalityInfo& locality = update.locality_list[i];
+        gpr_log(GPR_INFO,
+                "[xdslb %p] Locality %" PRIuPTR " %s contains %" PRIuPTR
+                " server addresses",
+                xdslb_policy, i,
+                locality.locality_name->AsHumanReadableString(),
+                locality.serverlist.size());
+        for (size_t j = 0; j < locality.serverlist.size(); ++j) {
+          char* ipport;
+          grpc_sockaddr_to_string(&ipport, &locality.serverlist[j].address(),
+                                  false);
+          gpr_log(GPR_INFO,
+                  "[xdslb %p] Locality %" PRIuPTR
+                  " %s, server address %" PRIuPTR ": %s",
+                  xdslb_policy, i,
+                  locality.locality_name->AsHumanReadableString(), j, ipport);
+          gpr_free(ipport);
+        }
+      }
+      for (size_t i = 0; i < update.drop_config->drop_category_list().size();
+           ++i) {
+        const XdsDropConfig::DropCategory& drop_category =
+            update.drop_config->drop_category_list()[i];
+        gpr_log(GPR_INFO,
+                "[xdslb %p] Drop category %s has drop rate %d per million",
+                xdslb_policy, drop_category.name.get(),
+                drop_category.parts_per_million);
       }
     }
-    // Pending LB channel receives a serverlist; promote it.
+    // Pending LB channel receives a response; promote it.
     // Note that this call can't be on a discarded pending channel, because
     // such channels don't have any current call but we have checked this call
     // is a current call.
-    if (!lb_calld->lb_chand_->IsCurrentChannel()) {
+    if (!lb_chand->IsCurrentChannel()) {
       if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
         gpr_log(GPR_INFO,
-                "[xdslb %p] Promoting pending LB channel %p to replace "
-                "current LB channel %p",
-                xdslb_policy, lb_calld->lb_chand_.get(),
-                lb_calld->xdslb_policy()->lb_chand_.get());
+                "[xdslb %p] Pending LB channel %p receives EDS response; "
+                "promoting it to replace current LB channel %p",
+                xdslb_policy, lb_chand, xdslb_policy->lb_chand_.get());
       }
-      lb_calld->xdslb_policy()->lb_chand_ =
-          std::move(lb_calld->xdslb_policy()->pending_lb_chand_);
-    }
-    // Start sending client load report only after we start using the
-    // serverlist returned from the current LB call.
-    if (lb_calld->client_stats_report_interval_ > 0 &&
-        lb_calld->client_stats_ == nullptr) {
-      lb_calld->client_stats_ = MakeRefCounted<XdsLbClientStats>();
-      lb_calld->Ref(DEBUG_LOCATION, "client_load_report").release();
-      lb_calld->ScheduleNextClientLoadReportLocked();
+      // TODO(juanlishen): Maybe promote the pending LB channel when the
+      // response results a READY locality map.
+      xdslb_policy->lb_chand_ = std::move(xdslb_policy->pending_lb_chand_);
     }
-    if (!xdslb_policy->locality_serverlist_.empty() &&
-        xds_grpclb_serverlist_equals(
-            xdslb_policy->locality_serverlist_[0]->serverlist, serverlist)) {
+    // At this point, lb_chand must be the current LB channel, so try to start
+    // load reporting.
+    LrsCallState* lrs_calld = lb_chand->lrs_calld_->lb_calld();
+    if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
+    // If the balancer tells us to drop all the calls, we should exit fallback
+    // mode immediately.
+    if (update.drop_all) xdslb_policy->MaybeExitFallbackMode();
+    // Update the drop config.
+    const bool drop_config_changed =
+        xdslb_policy->drop_config_ == nullptr ||
+        *xdslb_policy->drop_config_ != *update.drop_config;
+    xdslb_policy->drop_config_ = std::move(update.drop_config);
+    // Ignore identical locality update.
+    if (xdslb_policy->locality_list_ == update.locality_list) {
       if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
         gpr_log(GPR_INFO,
-                "[xdslb %p] Incoming server list identical to current, "
-                "ignoring.",
-                xdslb_policy);
+                "[xdslb %p] Incoming locality list identical to current, "
+                "ignoring. (drop_config_changed=%d)",
+                xdslb_policy, drop_config_changed);
       }
-      xds_grpclb_destroy_serverlist(serverlist);
-    } else {  // New serverlist.
-      // If the balancer tells us to drop all the calls, we should exit fallback
-      // mode immediately.
-      // TODO(juanlishen): When we add EDS drop, we should change to check
-      // drop_percentage.
-      if (serverlist->num_servers == 0) xdslb_policy->MaybeExitFallbackMode();
-      if (!xdslb_policy->locality_serverlist_.empty()) {
-        xds_grpclb_destroy_serverlist(
-            xdslb_policy->locality_serverlist_[0]->serverlist);
-      } else {
-        // Initialize locality serverlist, currently the list only handles
-        // one child.
-        xdslb_policy->locality_serverlist_.emplace_back(
-            MakeUnique<LocalityServerlistEntry>());
-        xdslb_policy->locality_serverlist_[0]->locality_name =
-            MakeRefCounted<LocalityName>(
-                UniquePtr<char>(gpr_strdup(kDefaultLocalityRegion)),
-                UniquePtr<char>(gpr_strdup(kDefaultLocalityZone)),
-                UniquePtr<char>(gpr_strdup(kDefaultLocalitySubzone)));
-        xdslb_policy->locality_serverlist_[0]->locality_weight =
-            kDefaultLocalityWeight;
+      if (drop_config_changed) {
+        xdslb_policy->locality_map_.UpdateXdsPickerLocked();
       }
-      // Update the serverlist in the XdsLb instance. This serverlist
-      // instance will be destroyed either upon the next update or when the
-      // XdsLb instance is destroyed.
-      xdslb_policy->locality_serverlist_[0]->serverlist = serverlist;
-      xdslb_policy->locality_map_.UpdateLocked(
-          xdslb_policy->locality_serverlist_,
-          xdslb_policy->child_policy_config_.get(), xdslb_policy->args_,
-          xdslb_policy);
+      return;
     }
-  } else {
-    // No valid initial response or serverlist found.
-    char* response_slice_str =
-        grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX);
-    gpr_log(GPR_ERROR,
-            "[xdslb %p] Invalid LB response received: '%s'. Ignoring.",
-            xdslb_policy, response_slice_str);
-    gpr_free(response_slice_str);
-  }
+    // Update the locality list.
+    xdslb_policy->locality_list_ = std::move(update.locality_list);
+    // Update the locality map.
+    xdslb_policy->locality_map_.UpdateLocked(
+        xdslb_policy->locality_list_, xdslb_policy->child_policy_config_.get(),
+        xdslb_policy->args_, xdslb_policy);
+  }();
   grpc_slice_unref_internal(response_slice);
-  if (!xdslb_policy->shutting_down_) {
-    // Keep listening for serverlist updates.
-    grpc_op op;
-    memset(&op, 0, sizeof(op));
-    op.op = GRPC_OP_RECV_MESSAGE;
-    op.data.recv_message.recv_message = &lb_calld->recv_message_payload_;
-    op.flags = 0;
-    op.reserved = nullptr;
-    // Reuse the "OnBalancerMessageReceivedLocked" ref taken in StartQuery().
-    const grpc_call_error call_error = grpc_call_start_batch_and_execute(
-        lb_calld->lb_call_, &op, 1,
-        &lb_calld->lb_on_balancer_message_received_);
-    GPR_ASSERT(GRPC_CALL_OK == call_error);
-  } else {
-    lb_calld->Unref(DEBUG_LOCATION, "on_message_received+xds_shutdown");
+  if (xdslb_policy->shutting_down_) {
+    eds_calld->Unref(DEBUG_LOCATION,
+                     "EDS+OnResponseReceivedLocked+xds_shutdown");
+    return;
   }
+  // Keep listening for serverlist updates.
+  grpc_op op;
+  memset(&op, 0, sizeof(op));
+  op.op = GRPC_OP_RECV_MESSAGE;
+  op.data.recv_message.recv_message = &eds_calld->recv_message_payload_;
+  op.flags = 0;
+  op.reserved = nullptr;
+  GPR_ASSERT(eds_calld->lb_call_ != nullptr);
+  // Reuse the "EDS+OnResponseReceivedLocked" ref taken in ctor.
+  const grpc_call_error call_error = grpc_call_start_batch_and_execute(
+      eds_calld->lb_call_, &op, 1, &eds_calld->on_response_received_);
+  GPR_ASSERT(GRPC_CALL_OK == call_error);
 }
 
-void XdsLb::BalancerChannelState::BalancerCallState::
-    OnBalancerStatusReceivedLocked(void* arg, grpc_error* error) {
-  BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
-  XdsLb* xdslb_policy = lb_calld->xdslb_policy();
-  BalancerChannelState* lb_chand = lb_calld->lb_chand_.get();
-  GPR_ASSERT(lb_calld->lb_call_ != nullptr);
+void XdsLb::LbChannelState::EdsCallState::OnStatusReceivedLocked(
+    void* arg, grpc_error* error) {
+  EdsCallState* eds_calld = static_cast<EdsCallState*>(arg);
+  LbChannelState* lb_chand = eds_calld->lb_chand();
+  XdsLb* xdslb_policy = eds_calld->xdslb_policy();
   if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
-    char* status_details =
-        grpc_slice_to_c_string(lb_calld->lb_call_status_details_);
+    char* status_details = grpc_slice_to_c_string(eds_calld->status_details_);
     gpr_log(GPR_INFO,
-            "[xdslb %p] Status from LB server received. Status = %d, details "
-            "= '%s', (lb_chand: %p, lb_calld: %p, lb_call: %p), error '%s'",
-            xdslb_policy, lb_calld->lb_call_status_, status_details, lb_chand,
-            lb_calld, lb_calld->lb_call_, grpc_error_string(error));
+            "[xdslb %p] EDS call status received. Status = %d, details "
+            "= '%s', (lb_chand: %p, eds_calld: %p, lb_call: %p), error '%s'",
+            xdslb_policy, eds_calld->status_code_, status_details, lb_chand,
+            eds_calld, eds_calld->lb_call_, grpc_error_string(error));
     gpr_free(status_details);
   }
   // Ignore status from a stale call.
-  if (lb_calld->IsCurrentCallOnChannel()) {
+  if (eds_calld->IsCurrentCallOnChannel()) {
     // Because this call is the current one on the channel, the channel can't
     // have been swapped out; otherwise, the call should have been reset.
     GPR_ASSERT(lb_chand->IsCurrentChannel() || lb_chand->IsPendingChannel());
-    GPR_ASSERT(!xdslb_policy->shutting_down_);
     if (lb_chand != xdslb_policy->LatestLbChannel()) {
       // This channel must be the current one and there is a pending one. Swap
       // in the pending one and we are done.
@@ -1312,23 +1251,13 @@ void XdsLb::BalancerChannelState::BalancerCallState::
         gpr_log(GPR_INFO,
                 "[xdslb %p] Promoting pending LB channel %p to replace "
                 "current LB channel %p",
-                xdslb_policy, lb_calld->lb_chand_.get(),
-                lb_calld->xdslb_policy()->lb_chand_.get());
+                xdslb_policy, lb_chand, xdslb_policy->lb_chand_.get());
       }
       xdslb_policy->lb_chand_ = std::move(xdslb_policy->pending_lb_chand_);
     } else {
       // This channel is the most recently created one. Try to restart the call
       // and reresolve.
-      lb_chand->lb_calld_.reset();
-      if (lb_calld->seen_initial_response_) {
-        // If we lost connection to the LB server, reset the backoff and restart
-        // the LB call immediately.
-        lb_chand->lb_call_backoff_.Reset();
-        lb_chand->StartCallLocked();
-      } else {
-        // If we failed to connect to the LB server, retry later.
-        lb_chand->StartCallRetryTimerLocked();
-      }
+      eds_calld->parent_->OnCallFinishedLocked();
       xdslb_policy->channel_control_helper()->RequestReresolution();
       // If the fallback-at-startup checks are pending, go into fallback mode
       // immediately.  This short-circuits the timeout for the
@@ -1344,7 +1273,369 @@ void XdsLb::BalancerChannelState::BalancerCallState::
       }
     }
   }
-  lb_calld->Unref(DEBUG_LOCATION, "lb_call_ended");
+  eds_calld->Unref(DEBUG_LOCATION, "EDS+OnStatusReceivedLocked");
+}
+
+bool XdsLb::LbChannelState::EdsCallState::IsCurrentCallOnChannel() const {
+  // If the retryable EDS call is null (which only happens when the LB channel
+  // is shutting down), all the EDS calls are stale.
+  if (lb_chand()->eds_calld_ == nullptr) return false;
+  return this == lb_chand()->eds_calld_->lb_calld();
+}
+
+//
+// XdsLb::LbChannelState::LrsCallState::Reporter
+//
+
+void XdsLb::LbChannelState::LrsCallState::Reporter::Orphan() {
+  if (next_report_timer_callback_pending_) {
+    grpc_timer_cancel(&next_report_timer_);
+  }
+}
+
+void XdsLb::LbChannelState::LrsCallState::Reporter::ScheduleNextReportLocked() {
+  const grpc_millis next_report_time = ExecCtx::Get()->Now() + report_interval_;
+  grpc_timer_init(&next_report_timer_, next_report_time,
+                  &on_next_report_timer_);
+  next_report_timer_callback_pending_ = true;
+}
+
+void XdsLb::LbChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
+    void* arg, grpc_error* error) {
+  Reporter* self = static_cast<Reporter*>(arg);
+  self->next_report_timer_callback_pending_ = false;
+  if (error != GRPC_ERROR_NONE || !self->IsCurrentReporterOnCall()) {
+    self->Unref(DEBUG_LOCATION, "Reporter+timer");
+    return;
+  }
+  self->SendReportLocked();
+}
+
+void XdsLb::LbChannelState::LrsCallState::Reporter::SendReportLocked() {
+  // Create a request that contains the load report.
+  grpc_slice request_payload_slice = XdsLrsRequestCreateAndEncode(
+      xdslb_policy()->server_name_, &xdslb_policy()->client_stats_);
+  // Skip client load report if the counters were all zero in the last
+  // report and they are still zero in this one.
+  const bool old_val = last_report_counters_were_zero_;
+  last_report_counters_were_zero_ = static_cast<bool>(
+      grpc_slice_eq(request_payload_slice, grpc_empty_slice()));
+  if (old_val && last_report_counters_were_zero_) {
+    ScheduleNextReportLocked();
+    return;
+  }
+  parent_->send_message_payload_ =
+      grpc_raw_byte_buffer_create(&request_payload_slice, 1);
+  grpc_slice_unref_internal(request_payload_slice);
+  // Send the report.
+  grpc_op op;
+  memset(&op, 0, sizeof(op));
+  op.op = GRPC_OP_SEND_MESSAGE;
+  op.data.send_message.send_message = parent_->send_message_payload_;
+  grpc_call_error call_error = grpc_call_start_batch_and_execute(
+      parent_->lb_call_, &op, 1, &on_report_done_);
+  if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) {
+    gpr_log(GPR_ERROR,
+            "[xdslb %p] lb_calld=%p call_error=%d sending client load report",
+            xdslb_policy(), this, call_error);
+    GPR_ASSERT(GRPC_CALL_OK == call_error);
+  }
+}
+
+void XdsLb::LbChannelState::LrsCallState::Reporter::OnReportDoneLocked(
+    void* arg, grpc_error* error) {
+  Reporter* self = static_cast<Reporter*>(arg);
+  grpc_byte_buffer_destroy(self->parent_->send_message_payload_);
+  self->parent_->send_message_payload_ = nullptr;
+  if (error != GRPC_ERROR_NONE || !self->IsCurrentReporterOnCall()) {
+    // If this reporter is no longer the current one on the call, the reason
+    // might be that it was orphaned for a new one due to config update.
+    if (!self->IsCurrentReporterOnCall()) {
+      self->parent_->MaybeStartReportingLocked();
+    }
+    self->Unref(DEBUG_LOCATION, "Reporter+report_done");
+    return;
+  }
+  self->ScheduleNextReportLocked();
+}
+
+//
+// XdsLb::LbChannelState::LrsCallState
+//
+
+XdsLb::LbChannelState::LrsCallState::LrsCallState(
+    RefCountedPtr<RetryableLbCall<LrsCallState>> parent)
+    : InternallyRefCounted<LrsCallState>(&grpc_lb_xds_trace),
+      parent_(std::move(parent)) {
+  // Init the LB call. Note that the LB call will progress every time there's
+  // activity in xdslb_policy()->interested_parties(), which is comprised of
+  // the polling entities from client_channel.
+  GPR_ASSERT(xdslb_policy() != nullptr);
+  GPR_ASSERT(xdslb_policy()->server_name_ != nullptr);
+  GPR_ASSERT(xdslb_policy()->server_name_[0] != '\0');
+  const grpc_millis deadline =
+      xdslb_policy()->lb_call_timeout_ms_ == 0
+          ? GRPC_MILLIS_INF_FUTURE
+          : ExecCtx::Get()->Now() + xdslb_policy()->lb_call_timeout_ms_;
+  lb_call_ = grpc_channel_create_pollset_set_call(
+      lb_chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
+      xdslb_policy()->interested_parties(),
+      GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS,
+      nullptr, deadline, nullptr);
+  GPR_ASSERT(lb_call_ != nullptr);
+  // Init the LB call request payload.
+  grpc_slice request_payload_slice =
+      XdsLrsRequestCreateAndEncode(xdslb_policy()->server_name_);
+  send_message_payload_ =
+      grpc_raw_byte_buffer_create(&request_payload_slice, 1);
+  grpc_slice_unref_internal(request_payload_slice);
+  // Init other data associated with the LRS call.
+  grpc_metadata_array_init(&initial_metadata_recv_);
+  grpc_metadata_array_init(&trailing_metadata_recv_);
+  GRPC_CLOSURE_INIT(&on_initial_request_sent_, OnInitialRequestSentLocked, this,
+                    grpc_combiner_scheduler(xdslb_policy()->combiner()));
+  GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceivedLocked, this,
+                    grpc_combiner_scheduler(xdslb_policy()->combiner()));
+  GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceivedLocked, this,
+                    grpc_combiner_scheduler(xdslb_policy()->combiner()));
+  // Start the call.
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+    gpr_log(GPR_INFO,
+            "[xdslb %p] Starting LRS call (lb_chand: %p, lb_calld: %p, "
+            "lb_call: %p)",
+            xdslb_policy(), lb_chand(), this, lb_call_);
+  }
+  // Create the ops.
+  grpc_call_error call_error;
+  grpc_op ops[3];
+  memset(ops, 0, sizeof(ops));
+  // Op: send initial metadata.
+  grpc_op* op = ops;
+  op->op = GRPC_OP_SEND_INITIAL_METADATA;
+  op->data.send_initial_metadata.count = 0;
+  op->flags = 0;
+  op->reserved = nullptr;
+  op++;
+  // Op: send request message.
+  GPR_ASSERT(send_message_payload_ != nullptr);
+  op->op = GRPC_OP_SEND_MESSAGE;
+  op->data.send_message.send_message = send_message_payload_;
+  op->flags = 0;
+  op->reserved = nullptr;
+  op++;
+  Ref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked").release();
+  call_error = grpc_call_start_batch_and_execute(
+      lb_call_, ops, (size_t)(op - ops), &on_initial_request_sent_);
+  GPR_ASSERT(GRPC_CALL_OK == call_error);
+  // Op: recv initial metadata.
+  op = ops;
+  op->op = GRPC_OP_RECV_INITIAL_METADATA;
+  op->data.recv_initial_metadata.recv_initial_metadata =
+      &initial_metadata_recv_;
+  op->flags = 0;
+  op->reserved = nullptr;
+  op++;
+  // Op: recv response.
+  op->op = GRPC_OP_RECV_MESSAGE;
+  op->data.recv_message.recv_message = &recv_message_payload_;
+  op->flags = 0;
+  op->reserved = nullptr;
+  op++;
+  Ref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked").release();
+  call_error = grpc_call_start_batch_and_execute(
+      lb_call_, ops, (size_t)(op - ops), &on_response_received_);
+  GPR_ASSERT(GRPC_CALL_OK == call_error);
+  // Op: recv server status.
+  op = ops;
+  op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
+  op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv_;
+  op->data.recv_status_on_client.status = &status_code_;
+  op->data.recv_status_on_client.status_details = &status_details_;
+  op->flags = 0;
+  op->reserved = nullptr;
+  op++;
+  // This callback signals the end of the LB call, so it relies on the initial
+  // ref instead of a new ref. When it's invoked, it's the initial ref that is
+  // unreffed.
+  call_error = grpc_call_start_batch_and_execute(
+      lb_call_, ops, (size_t)(op - ops), &on_status_received_);
+  GPR_ASSERT(GRPC_CALL_OK == call_error);
+}
+
+XdsLb::LbChannelState::LrsCallState::~LrsCallState() {
+  grpc_metadata_array_destroy(&initial_metadata_recv_);
+  grpc_metadata_array_destroy(&trailing_metadata_recv_);
+  grpc_byte_buffer_destroy(send_message_payload_);
+  grpc_byte_buffer_destroy(recv_message_payload_);
+  grpc_slice_unref_internal(status_details_);
+  GPR_ASSERT(lb_call_ != nullptr);
+  grpc_call_unref(lb_call_);
+}
+
+void XdsLb::LbChannelState::LrsCallState::Orphan() {
+  reporter_.reset();
+  GPR_ASSERT(lb_call_ != nullptr);
+  // If we are here because xdslb_policy wants to cancel the call,
+  // on_status_received_ will complete the cancellation and clean up. Otherwise,
+  // we are here because xdslb_policy has to orphan a failed call, then the
+  // following cancellation will be a no-op.
+  grpc_call_cancel(lb_call_, nullptr);
+  // Note that the initial ref is hold by on_status_received_. So the
+  // corresponding unref happens in on_status_received_ instead of here.
+}
+
+void XdsLb::LbChannelState::LrsCallState::MaybeStartReportingLocked() {
+  // Don't start if this is not the current call on the current channel.
+  if (!IsCurrentCallOnChannel() || !lb_chand()->IsCurrentChannel()) return;
+  // Don't start again if already started.
+  if (reporter_ != nullptr) return;
+  // Don't start if the previous send_message op (of the initial request or the
+  // last report of the previous reporter) hasn't completed.
+  if (send_message_payload_ != nullptr) return;
+  // Don't start if no LRS response has arrived.
+  if (!seen_response()) return;
+  // Don't start if the EDS call hasn't received any valid response. Note that
+  // this must be the first channel because it is the current channel but its
+  // EDS call hasn't seen any response.
+  EdsCallState* eds_calld = lb_chand()->eds_calld_->lb_calld();
+  if (eds_calld == nullptr || !eds_calld->seen_response()) return;
+  // Start reporting.
+  lb_chand()->xdslb_policy_->client_stats_.MaybeInitLastReportTime();
+  reporter_ = MakeOrphanable<Reporter>(
+      Ref(DEBUG_LOCATION, "LRS+load_report+start"), load_reporting_interval_);
+}
+
+void XdsLb::LbChannelState::LrsCallState::OnInitialRequestSentLocked(
+    void* arg, grpc_error* error) {
+  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
+  // Clear the send_message_payload_.
+  grpc_byte_buffer_destroy(lrs_calld->send_message_payload_);
+  lrs_calld->send_message_payload_ = nullptr;
+  lrs_calld->MaybeStartReportingLocked();
+  lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked");
+}
+
+void XdsLb::LbChannelState::LrsCallState::OnResponseReceivedLocked(
+    void* arg, grpc_error* error) {
+  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
+  XdsLb* xdslb_policy = lrs_calld->xdslb_policy();
+  // Empty payload means the LB call was cancelled.
+  if (!lrs_calld->IsCurrentCallOnChannel() ||
+      lrs_calld->recv_message_payload_ == nullptr) {
+    lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
+    return;
+  }
+  // Read the response.
+  grpc_byte_buffer_reader bbr;
+  grpc_byte_buffer_reader_init(&bbr, lrs_calld->recv_message_payload_);
+  grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
+  grpc_byte_buffer_reader_destroy(&bbr);
+  grpc_byte_buffer_destroy(lrs_calld->recv_message_payload_);
+  lrs_calld->recv_message_payload_ = nullptr;
+  // This anonymous lambda is a hack to avoid the usage of goto.
+  [&]() {
+    // Parse the response.
+    grpc_millis new_load_reporting_interval;
+    grpc_error* parse_error = XdsLrsResponseDecodeAndParse(
+        response_slice, &new_load_reporting_interval,
+        xdslb_policy->server_name_);
+    if (parse_error != GRPC_ERROR_NONE) {
+      gpr_log(GPR_ERROR, "[xdslb %p] LRS response parsing failed. error=%s",
+              xdslb_policy, grpc_error_string(parse_error));
+      GRPC_ERROR_UNREF(parse_error);
+      return;
+    }
+    lrs_calld->seen_response_ = true;
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+      gpr_log(GPR_INFO,
+              "[xdslb %p] LRS response received, load_report_interval=%" PRId64
+              "ms",
+              xdslb_policy, new_load_reporting_interval);
+    }
+    if (new_load_reporting_interval <
+        GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS) {
+      new_load_reporting_interval =
+          GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS;
+      if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+        gpr_log(
+            GPR_INFO,
+            "[xdslb %p] Increased load_report_interval to minimum value %dms",
+            xdslb_policy, GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
+      }
+    }
+    // Ignore identical update.
+    if (lrs_calld->load_reporting_interval_ == new_load_reporting_interval) {
+      if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+        gpr_log(GPR_INFO,
+                "[xdslb %p] Incoming LRS response identical to current, "
+                "ignoring.",
+                xdslb_policy);
+      }
+      return;
+    }
+    // Stop current load reporting (if any) to adopt the new reporting interval.
+    lrs_calld->reporter_.reset();
+    // Record the new config.
+    lrs_calld->load_reporting_interval_ = new_load_reporting_interval;
+    // Try starting sending load report.
+    lrs_calld->MaybeStartReportingLocked();
+  }();
+  grpc_slice_unref_internal(response_slice);
+  if (xdslb_policy->shutting_down_) {
+    lrs_calld->Unref(DEBUG_LOCATION,
+                     "LRS+OnResponseReceivedLocked+xds_shutdown");
+    return;
+  }
+  // Keep listening for LRS config updates.
+  grpc_op op;
+  memset(&op, 0, sizeof(op));
+  op.op = GRPC_OP_RECV_MESSAGE;
+  op.data.recv_message.recv_message = &lrs_calld->recv_message_payload_;
+  op.flags = 0;
+  op.reserved = nullptr;
+  GPR_ASSERT(lrs_calld->lb_call_ != nullptr);
+  // Reuse the "OnResponseReceivedLocked" ref taken in ctor.
+  const grpc_call_error call_error = grpc_call_start_batch_and_execute(
+      lrs_calld->lb_call_, &op, 1, &lrs_calld->on_response_received_);
+  GPR_ASSERT(GRPC_CALL_OK == call_error);
+}
+
+void XdsLb::LbChannelState::LrsCallState::OnStatusReceivedLocked(
+    void* arg, grpc_error* error) {
+  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
+  XdsLb* xdslb_policy = lrs_calld->xdslb_policy();
+  LbChannelState* lb_chand = lrs_calld->lb_chand();
+  GPR_ASSERT(lrs_calld->lb_call_ != nullptr);
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
+    char* status_details = grpc_slice_to_c_string(lrs_calld->status_details_);
+    gpr_log(GPR_INFO,
+            "[xdslb %p] LRS call status received. Status = %d, details "
+            "= '%s', (lb_chand: %p, lb_calld: %p, lb_call: %p), error '%s'",
+            xdslb_policy, lrs_calld->status_code_, status_details, lb_chand,
+            lrs_calld, lrs_calld->lb_call_, grpc_error_string(error));
+    gpr_free(status_details);
+  }
+  // Ignore status from a stale call.
+  if (lrs_calld->IsCurrentCallOnChannel()) {
+    // Because this call is the current one on the channel, the channel can't
+    // have been swapped out; otherwise, the call should have been reset.
+    GPR_ASSERT(lb_chand->IsCurrentChannel() || lb_chand->IsPendingChannel());
+    GPR_ASSERT(!xdslb_policy->shutting_down_);
+    if (lb_chand == xdslb_policy->LatestLbChannel()) {
+      // This channel is the most recently created one. Try to restart the call
+      // and reresolve.
+      lrs_calld->parent_->OnCallFinishedLocked();
+      xdslb_policy->channel_control_helper()->RequestReresolution();
+    }
+  }
+  lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked");
+}
+
+bool XdsLb::LbChannelState::LrsCallState::IsCurrentCallOnChannel() const {
+  // If the retryable LRS call is null (which only happens when the LB channel
+  // is shutting down), all the LRS calls are stale.
+  if (lb_chand()->lrs_calld_ == nullptr) return false;
+  return this == lb_chand()->lrs_calld_->lb_calld();
 }
 
 //
@@ -1366,7 +1657,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) {
       // factory will re-add this arg with the right value.
       GRPC_ARG_SERVER_URI,
       // The LB channel should use the authority indicated by the target
-      // authority table (see \a grpc_lb_policy_xds_modify_lb_channel_args),
+      // authority table (see \a ModifyXdsBalancerChannelArgs),
       // as opposed to the authority from the parent channel.
       GRPC_ARG_DEFAULT_AUTHORITY,
       // Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be
@@ -1397,7 +1688,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) {
       args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(),
       args_to_add.size());
   // Make any necessary modifications for security.
-  return grpc_lb_policy_xds_modify_lb_channel_args(new_args);
+  return ModifyXdsBalancerChannelArgs(new_args);
 }
 
 //
@@ -1406,8 +1697,15 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) {
 
 XdsLb::XdsLb(Args args)
     : LoadBalancingPolicy(std::move(args)),
-      locality_map_(),
-      locality_serverlist_() {
+      lb_call_timeout_ms_(grpc_channel_args_find_integer(
+          args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS, {0, 0, INT_MAX})),
+      lb_fallback_timeout_ms_(grpc_channel_args_find_integer(
+          args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS,
+          {GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX})),
+      locality_retention_interval_ms_(grpc_channel_args_find_integer(
+          args.args, GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS,
+          {GRPC_XDS_DEFAULT_LOCALITY_RETENTION_INTERVAL_MS, 0, INT_MAX})),
+      locality_map_(this) {
   // Record server name.
   const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI);
   const char* server_uri = grpc_channel_arg_get_string(arg);
@@ -1421,13 +1719,6 @@ XdsLb::XdsLb(Args args)
             server_name_);
   }
   grpc_uri_destroy(uri);
-  // Record LB call timeout.
-  arg = grpc_channel_args_find(args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS);
-  lb_call_timeout_ms_ = grpc_channel_arg_get_integer(arg, {0, 0, INT_MAX});
-  // Record fallback timeout.
-  arg = grpc_channel_args_find(args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS);
-  lb_fallback_timeout_ms_ = grpc_channel_arg_get_integer(
-      arg, {GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX});
 }
 
 XdsLb::~XdsLb() {
@@ -1436,7 +1727,7 @@ XdsLb::~XdsLb() {
   }
   gpr_free((void*)server_name_);
   grpc_channel_args_destroy(args_);
-  locality_serverlist_.clear();
+  locality_list_.clear();
 }
 
 void XdsLb::ShutdownLocked() {
@@ -1485,9 +1776,9 @@ void XdsLb::ResetBackoffLocked() {
 }
 
 void XdsLb::ProcessAddressesAndChannelArgsLocked(
-    const ServerAddressList& addresses, const grpc_channel_args& args) {
+    ServerAddressList addresses, const grpc_channel_args& args) {
   // Update fallback address list.
-  fallback_backend_addresses_ = ExtractBackendAddresses(addresses);
+  fallback_backend_addresses_ = std::move(addresses);
   // Make sure that GRPC_ARG_LB_POLICY_NAME is set in channel args,
   // since we use this to trigger the client_load_reporting filter.
   static const char* args_to_remove[] = {GRPC_ARG_LB_POLICY_NAME};
@@ -1508,11 +1799,10 @@ void XdsLb::ProcessAddressesAndChannelArgsLocked(
         strcmp(last_balancer_name.get(), balancer_name_.get()) != 0;
   }
   if (create_lb_channel) {
-    OrphanablePtr<BalancerChannelState> lb_chand =
-        MakeOrphanable<BalancerChannelState>(
-            balancer_name_.get(), *lb_channel_args,
-            Ref(DEBUG_LOCATION, "BalancerChannelState"));
-    if (lb_chand_ == nullptr || !lb_chand_->HasActiveCall()) {
+    OrphanablePtr<LbChannelState> lb_chand = MakeOrphanable<LbChannelState>(
+        Ref(DEBUG_LOCATION, "XdsLb+LbChannelState"), balancer_name_.get(),
+        *lb_channel_args);
+    if (lb_chand_ == nullptr || !lb_chand_->HasActiveEdsCall()) {
       GPR_ASSERT(pending_lb_chand_ == nullptr);
       // If we do not have a working LB channel yet, use the newly created one.
       lb_chand_ = std::move(lb_chand);
@@ -1527,6 +1817,7 @@ void XdsLb::ProcessAddressesAndChannelArgsLocked(
 void XdsLb::ParseLbConfig(const ParsedXdsConfig* xds_config) {
   if (xds_config == nullptr || xds_config->balancer_name() == nullptr) return;
   // TODO(yashykt) : does this need to be a gpr_strdup
+  // TODO(juanlishen): Read balancer name from bootstrap file.
   balancer_name_ = UniquePtr<char>(gpr_strdup(xds_config->balancer_name()));
   child_policy_config_ = xds_config->child_policy();
   fallback_policy_config_ = xds_config->fallback_policy();
@@ -1539,9 +1830,9 @@ void XdsLb::UpdateLocked(UpdateArgs args) {
     gpr_log(GPR_ERROR, "[xdslb %p] LB config parsing fails.", this);
     return;
   }
-  ProcessAddressesAndChannelArgsLocked(args.addresses, *args.args);
-  locality_map_.UpdateLocked(locality_serverlist_, child_policy_config_.get(),
-                             args_, this);
+  ProcessAddressesAndChannelArgsLocked(std::move(args.addresses), *args.args);
+  locality_map_.UpdateLocked(locality_list_, child_policy_config_.get(), args_,
+                             this, is_initial_update);
   // Update the existing fallback policy. The fallback policy config and/or the
   // fallback addresses may be new.
   if (fallback_policy_ != nullptr) UpdateFallbackPolicyLocked();
@@ -1739,44 +2030,111 @@ void XdsLb::MaybeExitFallbackMode() {
 // XdsLb::LocalityMap
 //
 
-void XdsLb::LocalityMap::PruneLocalities(const LocalityList& locality_list) {
-  for (auto iter = map_.begin(); iter != map_.end();) {
-    bool found = false;
-    for (size_t i = 0; i < locality_list.size(); i++) {
-      if (*locality_list[i]->locality_name == *iter->first) {
-        found = true;
+void XdsLb::LocalityMap::UpdateLocked(
+    const XdsLocalityList& locality_list,
+    LoadBalancingPolicy::Config* child_policy_config,
+    const grpc_channel_args* args, XdsLb* parent, bool is_initial_update) {
+  if (parent->shutting_down_) return;
+  // Add or update the localities in locality_list.
+  for (size_t i = 0; i < locality_list.size(); i++) {
+    auto& locality_name = locality_list[i].locality_name;
+    auto iter = map_.find(locality_name);
+    // Add a new entry in the locality map if a new locality is received in the
+    // locality list.
+    if (iter == map_.end()) {
+      OrphanablePtr<LocalityEntry> new_entry = MakeOrphanable<LocalityEntry>(
+          parent->Ref(DEBUG_LOCATION, "LocalityEntry"), locality_name);
+      iter = map_.emplace(locality_name, std::move(new_entry)).first;
+    }
+    // Keep a copy of serverlist in locality_list_ so that we can compare it
+    // with the future ones.
+    iter->second->UpdateLocked(locality_list[i].lb_weight,
+                               locality_list[i].serverlist, child_policy_config,
+                               args);
+  }
+  // Remove (later) the localities not in locality_list.
+  for (auto& p : map_) {
+    const XdsLocalityName* locality_name = p.first.get();
+    LocalityEntry* locality_entry = p.second.get();
+    bool in_locality_list = false;
+    for (size_t i = 0; i < locality_list.size(); ++i) {
+      if (*locality_list[i].locality_name == *locality_name) {
+        in_locality_list = true;
         break;
       }
     }
-    if (!found) {  // Remove entries not present in the locality list
-      iter = map_.erase(iter);
-    } else
-      iter++;
+    if (!in_locality_list) locality_entry->DeactivateLocked();
   }
+  // Generate a new xds picker immediately.
+  if (!is_initial_update) UpdateXdsPickerLocked();
 }
 
-void XdsLb::LocalityMap::UpdateLocked(
-    const LocalityList& locality_serverlist,
-    LoadBalancingPolicy::Config* child_policy_config,
-    const grpc_channel_args* args, XdsLb* parent) {
-  if (parent->shutting_down_) return;
-  for (size_t i = 0; i < locality_serverlist.size(); i++) {
-    auto iter = map_.find(locality_serverlist[i]->locality_name);
-    if (iter == map_.end()) {
-      OrphanablePtr<LocalityEntry> new_entry = MakeOrphanable<LocalityEntry>(
-          parent->Ref(DEBUG_LOCATION, "LocalityEntry"),
-          locality_serverlist[i]->locality_name,
-          locality_serverlist[i]->locality_weight);
-      iter = map_.emplace(locality_serverlist[i]->locality_name,
-                          std::move(new_entry))
-                 .first;
+void XdsLb::LocalityMap::UpdateXdsPickerLocked() {
+  // If we are in fallback mode, don't generate an xds picker from localities.
+  if (xds_policy_->fallback_policy_ != nullptr) return;
+  // Construct a new xds picker which maintains a map of all locality pickers
+  // that are ready. Each locality is represented by a portion of the range
+  // proportional to its weight, such that the total range is the sum of the
+  // weights of all localities.
+  uint32_t end = 0;
+  size_t num_connecting = 0;
+  size_t num_idle = 0;
+  size_t num_transient_failures = 0;
+  Picker::PickerList pickers;
+  for (auto& p : map_) {
+    const LocalityEntry* entry = p.second.get();
+    if (entry->locality_weight() == 0) continue;
+    switch (entry->connectivity_state()) {
+      case GRPC_CHANNEL_READY: {
+        end += entry->locality_weight();
+        pickers.push_back(MakePair(end, entry->picker_wrapper()));
+        break;
+      }
+      case GRPC_CHANNEL_CONNECTING: {
+        num_connecting++;
+        break;
+      }
+      case GRPC_CHANNEL_IDLE: {
+        num_idle++;
+        break;
+      }
+      case GRPC_CHANNEL_TRANSIENT_FAILURE: {
+        num_transient_failures++;
+        break;
+      }
+      default:
+        GPR_UNREACHABLE_CODE(return );
     }
-    // Don't create new child policies if not directed to
-    xds_grpclb_serverlist* serverlist =
-        parent->locality_serverlist_[i]->serverlist;
-    iter->second->UpdateLocked(serverlist, child_policy_config, args);
   }
-  PruneLocalities(locality_serverlist);
+  // Pass on the constructed xds picker if it has any ready pickers in their map
+  // otherwise pass a QueuePicker if any of the locality pickers are in a
+  // connecting or idle state, finally return a transient failure picker if all
+  // locality pickers are in transient failure.
+  if (!pickers.empty()) {
+    xds_policy_->channel_control_helper()->UpdateState(
+        GRPC_CHANNEL_READY,
+        UniquePtr<LoadBalancingPolicy::SubchannelPicker>(
+            New<Picker>(xds_policy_->Ref(DEBUG_LOCATION, "XdsLb+Picker"),
+                        std::move(pickers))));
+  } else if (num_connecting > 0) {
+    xds_policy_->channel_control_helper()->UpdateState(
+        GRPC_CHANNEL_CONNECTING,
+        UniquePtr<SubchannelPicker>(
+            New<QueuePicker>(xds_policy_->Ref(DEBUG_LOCATION, "QueuePicker"))));
+  } else if (num_idle > 0) {
+    xds_policy_->channel_control_helper()->UpdateState(
+        GRPC_CHANNEL_IDLE,
+        UniquePtr<SubchannelPicker>(
+            New<QueuePicker>(xds_policy_->Ref(DEBUG_LOCATION, "QueuePicker"))));
+  } else {
+    grpc_error* error =
+        grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                               "connections to all active localities failing"),
+                           GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
+    xds_policy_->channel_control_helper()->UpdateState(
+        GRPC_CHANNEL_TRANSIENT_FAILURE,
+        UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
+  }
 }
 
 void XdsLb::LocalityMap::ShutdownLocked() { map_.clear(); }
@@ -1792,15 +2150,14 @@ void XdsLb::LocalityMap::ResetBackoffLocked() {
 //
 
 XdsLb::LocalityMap::LocalityEntry::LocalityEntry(
-    RefCountedPtr<XdsLb> parent, RefCountedPtr<LocalityName> name,
-    uint32_t locality_weight)
-    : parent_(std::move(parent)),
-      name_(std::move(name)),
-      locality_weight_(locality_weight) {
+    RefCountedPtr<XdsLb> parent, RefCountedPtr<XdsLocalityName> name)
+    : parent_(std::move(parent)), name_(std::move(name)) {
   if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
     gpr_log(GPR_INFO, "[xdslb %p] created LocalityEntry %p for %s",
             parent_.get(), this, name_->AsHumanReadableString());
   }
+  GRPC_CLOSURE_INIT(&on_delayed_removal_timer_, OnDelayedRemovalTimerLocked,
+                    this, grpc_combiner_scheduler(parent_->combiner()));
 }
 
 XdsLb::LocalityMap::LocalityEntry::~LocalityEntry() {
@@ -1864,13 +2221,18 @@ XdsLb::LocalityMap::LocalityEntry::CreateChildPolicyLocked(
 }
 
 void XdsLb::LocalityMap::LocalityEntry::UpdateLocked(
-    xds_grpclb_serverlist* serverlist,
+    uint32_t locality_weight, ServerAddressList serverlist,
     LoadBalancingPolicy::Config* child_policy_config,
     const grpc_channel_args* args_in) {
   if (parent_->shutting_down_) return;
+  // Update locality weight.
+  locality_weight_ = locality_weight;
+  if (delayed_removal_timer_callback_pending_) {
+    grpc_timer_cancel(&delayed_removal_timer_);
+  }
   // Construct update args.
   UpdateArgs update_args;
-  update_args.addresses = ProcessServerlist(serverlist);
+  update_args.addresses = std::move(serverlist);
   update_args.config =
       child_policy_config == nullptr ? nullptr : child_policy_config->Ref();
   update_args.args = CreateChildPolicyArgsLocked(args_in);
@@ -1989,6 +2351,12 @@ void XdsLb::LocalityMap::LocalityEntry::ShutdownLocked() {
         parent_->interested_parties());
     pending_child_policy_.reset();
   }
+  // Drop our ref to the child's picker, in case it's holding a ref to
+  // the child.
+  picker_wrapper_.reset();
+  if (delayed_removal_timer_callback_pending_) {
+    grpc_timer_cancel(&delayed_removal_timer_);
+  }
 }
 
 void XdsLb::LocalityMap::LocalityEntry::ResetBackoffLocked() {
@@ -2003,6 +2371,36 @@ void XdsLb::LocalityMap::LocalityEntry::Orphan() {
   Unref();
 }
 
+void XdsLb::LocalityMap::LocalityEntry::DeactivateLocked() {
+  // If locality retaining is disabled, delete the locality immediately.
+  if (parent_->locality_retention_interval_ms_ == 0) {
+    parent_->locality_map_.map_.erase(name_);
+    return;
+  }
+  // If already deactivated, don't do that again.
+  if (locality_weight_ == 0) return;
+  // Set the locality weight to 0 so that future xds picker won't contain this
+  // locality.
+  locality_weight_ = 0;
+  // Start a timer to delete the locality.
+  Ref(DEBUG_LOCATION, "LocalityEntry+timer").release();
+  grpc_timer_init(
+      &delayed_removal_timer_,
+      ExecCtx::Get()->Now() + parent_->locality_retention_interval_ms_,
+      &on_delayed_removal_timer_);
+  delayed_removal_timer_callback_pending_ = true;
+}
+
+void XdsLb::LocalityMap::LocalityEntry::OnDelayedRemovalTimerLocked(
+    void* arg, grpc_error* error) {
+  LocalityEntry* self = static_cast<LocalityEntry*>(arg);
+  self->delayed_removal_timer_callback_pending_ = false;
+  if (error == GRPC_ERROR_NONE && self->locality_weight_ == 0) {
+    self->parent_->locality_map_.map_.erase(self->name_);
+  }
+  self->Unref(DEBUG_LOCATION, "LocalityEntry+timer");
+}
+
 //
 // XdsLb::LocalityEntry::Helper
 //
@@ -2027,15 +2425,6 @@ XdsLb::LocalityMap::LocalityEntry::Helper::CreateSubchannel(
   return entry_->parent_->channel_control_helper()->CreateSubchannel(args);
 }
 
-grpc_channel* XdsLb::LocalityMap::LocalityEntry::Helper::CreateChannel(
-    const char* target, const grpc_channel_args& args) {
-  if (entry_->parent_->shutting_down_ ||
-      (!CalledByPendingChild() && !CalledByCurrentChild())) {
-    return nullptr;
-  }
-  return entry_->parent_->channel_control_helper()->CreateChannel(target, args);
-}
-
 void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState(
     grpc_connectivity_state state, UniquePtr<SubchannelPicker> picker) {
   if (entry_->parent_->shutting_down_) return;
@@ -2062,81 +2451,14 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState(
     entry_->parent_->MaybeCancelFallbackAtStartupChecks();
     entry_->parent_->MaybeExitFallbackMode();
   }
-  // If we are in fallback mode, ignore update request from the child policy.
-  if (entry_->parent_->fallback_policy_ != nullptr) return;
   GPR_ASSERT(entry_->parent_->lb_chand_ != nullptr);
-  RefCountedPtr<XdsLbClientStats> client_stats =
-      entry_->parent_->lb_chand_->lb_calld() == nullptr
-          ? nullptr
-          : entry_->parent_->lb_chand_->lb_calld()->client_stats();
-  // Cache the picker and its state in the entry
-  entry_->picker_ref_ = MakeRefCounted<PickerRef>(std::move(picker));
+  // Cache the picker and its state in the entry.
+  entry_->picker_wrapper_ = MakeRefCounted<PickerWrapper>(
+      std::move(picker),
+      entry_->parent_->client_stats_.FindLocalityStats(entry_->name_));
   entry_->connectivity_state_ = state;
-  // Construct a new xds picker which maintains a map of all locality pickers
-  // that are ready. Each locality is represented by a portion of the range
-  // proportional to its weight, such that the total range is the sum of the
-  // weights of all localities
-  uint32_t end = 0;
-  size_t num_connecting = 0;
-  size_t num_idle = 0;
-  size_t num_transient_failures = 0;
-  auto& locality_map = this->entry_->parent_->locality_map_.map_;
-  Picker::PickerList pickers;
-  for (auto& p : locality_map) {
-    const LocalityEntry* entry = p.second.get();
-    grpc_connectivity_state connectivity_state = entry->connectivity_state_;
-    switch (connectivity_state) {
-      case GRPC_CHANNEL_READY: {
-        end += entry->locality_weight_;
-        pickers.push_back(MakePair(end, entry->picker_ref_));
-        break;
-      }
-      case GRPC_CHANNEL_CONNECTING: {
-        num_connecting++;
-        break;
-      }
-      case GRPC_CHANNEL_IDLE: {
-        num_idle++;
-        break;
-      }
-      case GRPC_CHANNEL_TRANSIENT_FAILURE: {
-        num_transient_failures++;
-        break;
-      }
-      default: {
-        gpr_log(GPR_ERROR, "Invalid locality connectivity state - %d",
-                connectivity_state);
-      }
-    }
-  }
-  // Pass on the constructed xds picker if it has any ready pickers in their map
-  // otherwise pass a QueuePicker if any of the locality pickers are in a
-  // connecting or idle state, finally return a transient failure picker if all
-  // locality pickers are in transient failure
-  if (pickers.size() > 0) {
-    entry_->parent_->channel_control_helper()->UpdateState(
-        GRPC_CHANNEL_READY,
-        UniquePtr<LoadBalancingPolicy::SubchannelPicker>(
-            New<Picker>(std::move(client_stats), std::move(pickers))));
-  } else if (num_connecting > 0) {
-    entry_->parent_->channel_control_helper()->UpdateState(
-        GRPC_CHANNEL_CONNECTING,
-        UniquePtr<SubchannelPicker>(New<QueuePicker>(
-            this->entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker"))));
-  } else if (num_idle > 0) {
-    entry_->parent_->channel_control_helper()->UpdateState(
-        GRPC_CHANNEL_IDLE,
-        UniquePtr<SubchannelPicker>(New<QueuePicker>(
-            this->entry_->parent_->Ref(DEBUG_LOCATION, "QueuePicker"))));
-  } else {
-    GPR_ASSERT(num_transient_failures == locality_map.size());
-    grpc_error* error =
-        grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                               "connections to all localities failing"),
-                           GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
-    entry_->parent_->channel_control_helper()->UpdateState(
-        state, UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
-  }
+  // Construct a new xds picker and pass it to the channel.
+  entry_->parent_->locality_map_.UpdateXdsPickerLocked();
 }
 
 void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() {
@@ -2157,14 +2479,14 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() {
   // from the balancer, so we can ignore the re-resolution request from
   // the child policy. Otherwise, pass the re-resolution request up to the
   // channel.
-  if (entry_->parent_->lb_chand_->lb_calld() == nullptr ||
-      !entry_->parent_->lb_chand_->lb_calld()->seen_initial_response()) {
+  if (entry_->parent_->lb_chand_->eds_calld() == nullptr ||
+      !entry_->parent_->lb_chand_->eds_calld()->seen_response()) {
     entry_->parent_->channel_control_helper()->RequestReresolution();
   }
 }
 
 void XdsLb::LocalityMap::LocalityEntry::Helper::AddTraceEvent(
-    TraceSeverity severity, const char* message) {
+    TraceSeverity severity, StringView message) {
   if (entry_->parent_->shutting_down_ ||
       (!CalledByPendingChild() && !CalledByCurrentChild())) {
     return;
@@ -2243,10 +2565,6 @@ class XdsFactory : public LoadBalancingPolicyFactory {
         }
       }
     }
-    if (balancer_name == nullptr) {
-      error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-          "field:balancerName error:not found"));
-    }
     if (error_list.empty()) {
       return RefCountedPtr<LoadBalancingPolicy::Config>(New<ParsedXdsConfig>(
           balancer_name, std::move(child_policy), std::move(fallback_policy)));
index 0aa145a..386517d 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include <grpc/grpc.h>
+
 #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h"
 
-grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args(
-    grpc_channel_args* args) {
+namespace grpc_core {
+
+grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args) {
   return args;
 }
+
+grpc_channel* CreateXdsBalancerChannel(const char* target_uri,
+                                       const grpc_channel_args& args) {
+  return grpc_insecure_channel_create(target_uri, &args, nullptr);
+}
+
+}  // namespace grpc_core
index f713b7f..516bac1 100644 (file)
 
 #include <grpc/impl/codegen/grpc_types.h>
 
+namespace grpc_core {
+
 /// Makes any necessary modifications to \a args for use in the xds
 /// balancer channel.
 ///
 /// Takes ownership of \a args.
 ///
 /// Caller takes ownership of the returned args.
-grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args(
-    grpc_channel_args* args);
+grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args);
+
+grpc_channel* CreateXdsBalancerChannel(const char* target_uri,
+                                       const grpc_channel_args& args);
+
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_CHANNEL_H \
         */
index 7f8c232..720d5a0 100644 (file)
 
 #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h"
 
+#include <string.h>
+
+#include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <string.h>
 
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/client_channel/server_address.h"
 #include "src/core/lib/security/transport/target_authority_table.h"
 #include "src/core/lib/slice/slice_internal.h"
 
-grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args(
-    grpc_channel_args* args) {
-  const char* args_to_remove[1];
-  size_t num_args_to_remove = 0;
-  grpc_arg args_to_add[2];
-  size_t num_args_to_add = 0;
+namespace grpc_core {
+
+grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args) {
+  InlinedVector<const char*, 1> args_to_remove;
+  InlinedVector<grpc_arg, 2> args_to_add;
   // Substitute the channel credentials with a version without call
   // credentials: the load balancer is not necessarily trusted to handle
   // bearer token credentials.
   grpc_channel_credentials* channel_credentials =
       grpc_channel_credentials_find_in_args(args);
-  grpc_core::RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
+  RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
   if (channel_credentials != nullptr) {
     creds_sans_call_creds =
         channel_credentials->duplicate_without_call_credentials();
     GPR_ASSERT(creds_sans_call_creds != nullptr);
-    args_to_remove[num_args_to_remove++] = GRPC_ARG_CHANNEL_CREDENTIALS;
-    args_to_add[num_args_to_add++] =
-        grpc_channel_credentials_to_arg(creds_sans_call_creds.get());
+    args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS);
+    args_to_add.emplace_back(
+        grpc_channel_credentials_to_arg(creds_sans_call_creds.get()));
   }
   grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove(
-      args, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add);
+      args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
+      args_to_add.size());
   // Clean up.
   grpc_channel_args_destroy(args);
   return result;
 }
+
+grpc_channel* CreateXdsBalancerChannel(const char* target_uri,
+                                       const grpc_channel_args& args) {
+  grpc_channel_credentials* creds =
+      grpc_channel_credentials_find_in_args(&args);
+  if (creds == nullptr) {
+    // Build with security but parent channel is insecure.
+    return grpc_insecure_channel_create(target_uri, &args, nullptr);
+  }
+  const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
+  grpc_channel_args* new_args =
+      grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
+  grpc_channel* channel =
+      grpc_secure_channel_create(creds, target_uri, new_args, nullptr);
+  grpc_channel_args_destroy(new_args);
+  return channel;
+}
+
+}  // namespace grpc_core
index cdf5408..a866d50 100644 (file)
 
 namespace grpc_core {
 
-void XdsLbClientStats::AddCallStarted() {
-  gpr_atm_full_fetch_add(&num_calls_started_, (gpr_atm)1);
+namespace {
+
+template <typename T>
+T GetAndResetCounter(Atomic<T>* from) {
+  return from->Exchange(0, MemoryOrder::RELAXED);
+}
+
+}  // namespace
+
+//
+// XdsClientStats::LocalityStats::LoadMetric::Snapshot
+//
+
+bool XdsClientStats::LocalityStats::LoadMetric::Snapshot::IsAllZero() const {
+  return total_metric_value == 0 && num_requests_finished_with_metric == 0;
+}
+
+//
+// XdsClientStats::LocalityStats::LoadMetric
+//
+
+XdsClientStats::LocalityStats::LoadMetric::Snapshot
+XdsClientStats::LocalityStats::LoadMetric::GetSnapshotAndReset() {
+  Snapshot metric = {num_requests_finished_with_metric_, total_metric_value_};
+  num_requests_finished_with_metric_ = 0;
+  total_metric_value_ = 0;
+  return metric;
 }
 
-void XdsLbClientStats::AddCallFinished(bool finished_with_client_failed_to_send,
-                                       bool finished_known_received) {
-  gpr_atm_full_fetch_add(&num_calls_finished_, (gpr_atm)1);
-  if (finished_with_client_failed_to_send) {
-    gpr_atm_full_fetch_add(&num_calls_finished_with_client_failed_to_send_,
-                           (gpr_atm)1);
+//
+// XdsClientStats::LocalityStats::Snapshot
+//
+
+bool XdsClientStats::LocalityStats::Snapshot::IsAllZero() {
+  if (total_successful_requests != 0 || total_requests_in_progress != 0 ||
+      total_error_requests != 0 || total_issued_requests != 0) {
+    return false;
   }
-  if (finished_known_received) {
-    gpr_atm_full_fetch_add(&num_calls_finished_known_received_, (gpr_atm)1);
+  for (auto& p : load_metric_stats) {
+    const LoadMetric::Snapshot& metric_value = p.second;
+    if (!metric_value.IsAllZero()) return false;
   }
+  return true;
 }
 
-void XdsLbClientStats::AddCallDroppedLocked(char* token) {
-  // Increment num_calls_started and num_calls_finished.
-  gpr_atm_full_fetch_add(&num_calls_started_, (gpr_atm)1);
-  gpr_atm_full_fetch_add(&num_calls_finished_, (gpr_atm)1);
-  // Record the drop.
-  if (drop_token_counts_ == nullptr) {
-    drop_token_counts_.reset(New<DroppedCallCounts>());
-  }
-  for (size_t i = 0; i < drop_token_counts_->size(); ++i) {
-    if (strcmp((*drop_token_counts_)[i].token.get(), token) == 0) {
-      ++(*drop_token_counts_)[i].count;
-      return;
+//
+// XdsClientStats::LocalityStats
+//
+
+XdsClientStats::LocalityStats::Snapshot
+XdsClientStats::LocalityStats::GetSnapshotAndReset() {
+  Snapshot snapshot = {
+      GetAndResetCounter(&total_successful_requests_),
+      // Don't reset total_requests_in_progress because it's not
+      // related to a single reporting interval.
+      total_requests_in_progress_.Load(MemoryOrder::RELAXED),
+      GetAndResetCounter(&total_error_requests_),
+      GetAndResetCounter(&total_issued_requests_)};
+  {
+    MutexLock lock(&load_metric_stats_mu_);
+    for (auto& p : load_metric_stats_) {
+      const char* metric_name = p.first.get();
+      LoadMetric& metric_value = p.second;
+      snapshot.load_metric_stats.emplace(
+          UniquePtr<char>(gpr_strdup(metric_name)),
+          metric_value.GetSnapshotAndReset());
     }
   }
-  // Not found, so add a new entry.
-  drop_token_counts_->emplace_back(UniquePtr<char>(gpr_strdup(token)), 1);
+  return snapshot;
 }
 
-namespace {
+void XdsClientStats::LocalityStats::AddCallStarted() {
+  total_issued_requests_.FetchAdd(1, MemoryOrder::RELAXED);
+  total_requests_in_progress_.FetchAdd(1, MemoryOrder::RELAXED);
+}
 
-void AtomicGetAndResetCounter(int64_t* value, gpr_atm* counter) {
-  *value = static_cast<int64_t>(gpr_atm_full_xchg(counter, (gpr_atm)0));
+void XdsClientStats::LocalityStats::AddCallFinished(bool fail) {
+  Atomic<uint64_t>& to_increment =
+      fail ? total_error_requests_ : total_successful_requests_;
+  to_increment.FetchAdd(1, MemoryOrder::RELAXED);
+  total_requests_in_progress_.FetchAdd(-1, MemoryOrder::ACQ_REL);
 }
 
-}  // namespace
+//
+// XdsClientStats::Snapshot
+//
 
-void XdsLbClientStats::GetLocked(
-    int64_t* num_calls_started, int64_t* num_calls_finished,
-    int64_t* num_calls_finished_with_client_failed_to_send,
-    int64_t* num_calls_finished_known_received,
-    UniquePtr<DroppedCallCounts>* drop_token_counts) {
-  AtomicGetAndResetCounter(num_calls_started, &num_calls_started_);
-  AtomicGetAndResetCounter(num_calls_finished, &num_calls_finished_);
-  AtomicGetAndResetCounter(num_calls_finished_with_client_failed_to_send,
-                           &num_calls_finished_with_client_failed_to_send_);
-  AtomicGetAndResetCounter(num_calls_finished_known_received,
-                           &num_calls_finished_known_received_);
-  *drop_token_counts = std::move(drop_token_counts_);
+bool XdsClientStats::Snapshot::IsAllZero() {
+  for (auto& p : upstream_locality_stats) {
+    if (!p.second.IsAllZero()) return false;
+  }
+  for (auto& p : dropped_requests) {
+    if (p.second != 0) return false;
+  }
+  return total_dropped_requests == 0;
+}
+
+//
+// XdsClientStats
+//
+
+XdsClientStats::Snapshot XdsClientStats::GetSnapshotAndReset() {
+  grpc_millis now = ExecCtx::Get()->Now();
+  // Record total_dropped_requests and reporting interval in the snapshot.
+  Snapshot snapshot;
+  snapshot.total_dropped_requests =
+      GetAndResetCounter(&total_dropped_requests_);
+  snapshot.load_report_interval = now - last_report_time_;
+  // Update last report time.
+  last_report_time_ = now;
+  // Snapshot all the other stats.
+  for (auto& p : upstream_locality_stats_) {
+    snapshot.upstream_locality_stats.emplace(p.first,
+                                             p.second->GetSnapshotAndReset());
+  }
+  {
+    MutexLock lock(&dropped_requests_mu_);
+#if GRPC_USE_CPP_STD_LIB
+    // This is a workaround for the case where some compilers cannot build
+    // move-assignment of map with non-copyable but movable key.
+    // https://stackoverflow.com/questions/36475497
+    std::swap(snapshot.dropped_requests, dropped_requests_);
+    dropped_requests_.clear();
+#else
+    snapshot.dropped_requests = std::move(dropped_requests_);
+#endif
+  }
+  return snapshot;
+}
+
+void XdsClientStats::MaybeInitLastReportTime() {
+  if (last_report_time_ == -1) last_report_time_ = ExecCtx::Get()->Now();
+}
+
+RefCountedPtr<XdsClientStats::LocalityStats> XdsClientStats::FindLocalityStats(
+    const RefCountedPtr<XdsLocalityName>& locality_name) {
+  auto iter = upstream_locality_stats_.find(locality_name);
+  if (iter == upstream_locality_stats_.end()) {
+    iter = upstream_locality_stats_
+               .emplace(locality_name, MakeRefCounted<LocalityStats>())
+               .first;
+  }
+  return iter->second;
+}
+
+void XdsClientStats::PruneLocalityStats() {
+  auto iter = upstream_locality_stats_.begin();
+  while (iter != upstream_locality_stats_.end()) {
+    if (iter->second->IsSafeToDelete()) {
+      iter = upstream_locality_stats_.erase(iter);
+    } else {
+      ++iter;
+    }
+  }
+}
+
+void XdsClientStats::AddCallDropped(const UniquePtr<char>& category) {
+  total_dropped_requests_.FetchAdd(1, MemoryOrder::RELAXED);
+  MutexLock lock(&dropped_requests_mu_);
+  auto iter = dropped_requests_.find(category);
+  if (iter == dropped_requests_.end()) {
+    dropped_requests_.emplace(UniquePtr<char>(gpr_strdup(category.get())), 1);
+  } else {
+    ++iter->second;
+  }
 }
 
 }  // namespace grpc_core
index fa0b9f4..6e8dd96 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
-#include <grpc/support/atm.h>
+#include <grpc/support/string_util.h>
 
+#include "src/core/lib/gprpp/atomic.h"
 #include "src/core/lib/gprpp/inlined_vector.h"
+#include "src/core/lib/gprpp/map.h"
 #include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/gprpp/ref_counted.h"
+#include "src/core/lib/gprpp/sync.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
 
 namespace grpc_core {
 
-class XdsLbClientStats : public RefCounted<XdsLbClientStats> {
+class XdsLocalityName : public RefCounted<XdsLocalityName> {
  public:
-  struct DropTokenCount {
-    UniquePtr<char> token;
-    int64_t count;
+  struct Less {
+    bool operator()(const RefCountedPtr<XdsLocalityName>& lhs,
+                    const RefCountedPtr<XdsLocalityName>& rhs) const {
+      int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get());
+      if (cmp_result != 0) return cmp_result < 0;
+      cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get());
+      if (cmp_result != 0) return cmp_result < 0;
+      return strcmp(lhs->sub_zone_.get(), rhs->sub_zone_.get()) < 0;
+    }
+  };
+
+  XdsLocalityName(UniquePtr<char> region, UniquePtr<char> zone,
+                  UniquePtr<char> subzone)
+      : region_(std::move(region)),
+        zone_(std::move(zone)),
+        sub_zone_(std::move(subzone)) {}
+
+  bool operator==(const XdsLocalityName& other) const {
+    return strcmp(region_.get(), other.region_.get()) == 0 &&
+           strcmp(zone_.get(), other.zone_.get()) == 0 &&
+           strcmp(sub_zone_.get(), other.sub_zone_.get()) == 0;
+  }
+
+  const char* region() const { return region_.get(); }
+  const char* zone() const { return zone_.get(); }
+  const char* sub_zone() const { return sub_zone_.get(); }
+
+  const char* AsHumanReadableString() {
+    if (human_readable_string_ == nullptr) {
+      char* tmp;
+      gpr_asprintf(&tmp, "{region=\"%s\", zone=\"%s\", sub_zone=\"%s\"}",
+                   region_.get(), zone_.get(), sub_zone_.get());
+      human_readable_string_.reset(tmp);
+    }
+    return human_readable_string_.get();
+  }
+
+ private:
+  UniquePtr<char> region_;
+  UniquePtr<char> zone_;
+  UniquePtr<char> sub_zone_;
+  UniquePtr<char> human_readable_string_;
+};
+
+// The stats classes (i.e., XdsClientStats, LocalityStats, and LoadMetric) can
+// be taken a snapshot (and reset) to populate the load report. The snapshots
+// are contained in the respective Snapshot structs. The Snapshot structs have
+// no synchronization. The stats classes use several different synchronization
+// methods. 1. Most of the counters are Atomic<>s for performance. 2. Some of
+// the Map<>s are protected by Mutex if we are not guaranteed that the accesses
+// to them are synchronized by the callers. 3. The Map<>s to which the accesses
+// are already synchronized by the callers do not have additional
+// synchronization here. Note that the Map<>s we mentioned in 2 and 3 refer to
+// the map's tree structure rather than the content in each tree node.
+class XdsClientStats {
+ public:
+  class LocalityStats : public RefCounted<LocalityStats> {
+   public:
+    class LoadMetric {
+     public:
+      struct Snapshot {
+        bool IsAllZero() const;
 
-    DropTokenCount(UniquePtr<char> token, int64_t count)
-        : token(std::move(token)), count(count) {}
+        uint64_t num_requests_finished_with_metric;
+        double total_metric_value;
+      };
+
+      // Returns a snapshot of this instance and reset all the accumulative
+      // counters.
+      Snapshot GetSnapshotAndReset();
+
+     private:
+      uint64_t num_requests_finished_with_metric_{0};
+      double total_metric_value_{0};
+    };
+
+    using LoadMetricMap = Map<UniquePtr<char>, LoadMetric, StringLess>;
+    using LoadMetricSnapshotMap =
+        Map<UniquePtr<char>, LoadMetric::Snapshot, StringLess>;
+
+    struct Snapshot {
+      // TODO(juanlishen): Change this to const method when const_iterator is
+      // added to Map<>.
+      bool IsAllZero();
+
+      uint64_t total_successful_requests;
+      uint64_t total_requests_in_progress;
+      uint64_t total_error_requests;
+      uint64_t total_issued_requests;
+      LoadMetricSnapshotMap load_metric_stats;
+    };
+
+    // Returns a snapshot of this instance and reset all the accumulative
+    // counters.
+    Snapshot GetSnapshotAndReset();
+
+    // Each XdsLb::PickerWrapper holds a ref to the perspective LocalityStats.
+    // If the refcount is 0, there won't be new calls recorded to the
+    // LocalityStats, so the LocalityStats can be safely deleted when all the
+    // in-progress calls have finished.
+    // Only be called from the control plane combiner.
+    void RefByPicker() { picker_refcount_.FetchAdd(1, MemoryOrder::ACQ_REL); }
+    // Might be called from the control plane combiner or the data plane
+    // combiner.
+    // TODO(juanlishen): Once https://github.com/grpc/grpc/pull/19390 is merged,
+    //  this method will also only be invoked in the control plane combiner.
+    //  We may then be able to simplify the LocalityStats' lifetime by making it
+    //  RefCounted<> and populating the protobuf in its dtor.
+    void UnrefByPicker() { picker_refcount_.FetchSub(1, MemoryOrder::ACQ_REL); }
+    // Only be called from the control plane combiner.
+    // The only place where the picker_refcount_ can be increased is
+    // RefByPicker(), which also can only be called from the control plane
+    // combiner. Also, if the picker_refcount_ is 0, total_requests_in_progress_
+    // can't be increased from 0. So it's safe to delete the LocalityStats right
+    // after this method returns true.
+    bool IsSafeToDelete() {
+      return picker_refcount_.FetchAdd(0, MemoryOrder::ACQ_REL) == 0 &&
+             total_requests_in_progress_.FetchAdd(0, MemoryOrder::ACQ_REL) == 0;
+    }
+
+    void AddCallStarted();
+    void AddCallFinished(bool fail = false);
+
+   private:
+    Atomic<uint64_t> total_successful_requests_{0};
+    Atomic<uint64_t> total_requests_in_progress_{0};
+    // Requests that were issued (not dropped) but failed.
+    Atomic<uint64_t> total_error_requests_{0};
+    Atomic<uint64_t> total_issued_requests_{0};
+    // Protects load_metric_stats_. A mutex is necessary because the length of
+    // load_metric_stats_ can be accessed by both the callback intercepting the
+    // call's recv_trailing_metadata (not from any combiner) and the load
+    // reporting thread (from the control plane combiner).
+    Mutex load_metric_stats_mu_;
+    LoadMetricMap load_metric_stats_;
+    // Can be accessed from either the control plane combiner or the data plane
+    // combiner.
+    Atomic<uint8_t> picker_refcount_{0};
   };
 
-  typedef InlinedVector<DropTokenCount, 10> DroppedCallCounts;
+  // TODO(juanlishen): The value type of Map<> must be movable in current
+  // implementation. To avoid making LocalityStats movable, we wrap it by
+  // UniquePtr<>. We should remove this wrapper if the value type of Map<>
+  // doesn't have to be movable.
+  using LocalityStatsMap =
+      Map<RefCountedPtr<XdsLocalityName>, RefCountedPtr<LocalityStats>,
+          XdsLocalityName::Less>;
+  using LocalityStatsSnapshotMap =
+      Map<RefCountedPtr<XdsLocalityName>, LocalityStats::Snapshot,
+          XdsLocalityName::Less>;
+  using DroppedRequestsMap = Map<UniquePtr<char>, uint64_t, StringLess>;
+  using DroppedRequestsSnapshotMap = DroppedRequestsMap;
 
-  XdsLbClientStats() {}
+  struct Snapshot {
+    // TODO(juanlishen): Change this to const method when const_iterator is
+    // added to Map<>.
+    bool IsAllZero();
 
-  void AddCallStarted();
-  void AddCallFinished(bool finished_with_client_failed_to_send,
-                       bool finished_known_received);
+    LocalityStatsSnapshotMap upstream_locality_stats;
+    uint64_t total_dropped_requests;
+    DroppedRequestsSnapshotMap dropped_requests;
+    // The actual load report interval.
+    grpc_millis load_report_interval;
+  };
 
-  // This method is not thread-safe; caller must synchronize.
-  void AddCallDroppedLocked(char* token);
+  // Returns a snapshot of this instance and reset all the accumulative
+  // counters.
+  Snapshot GetSnapshotAndReset();
 
-  // This method is not thread-safe; caller must synchronize.
-  void GetLocked(int64_t* num_calls_started, int64_t* num_calls_finished,
-                 int64_t* num_calls_finished_with_client_failed_to_send,
-                 int64_t* num_calls_finished_known_received,
-                 UniquePtr<DroppedCallCounts>* drop_token_counts);
+  void MaybeInitLastReportTime();
+  RefCountedPtr<LocalityStats> FindLocalityStats(
+      const RefCountedPtr<XdsLocalityName>& locality_name);
+  void PruneLocalityStats();
+  void AddCallDropped(const UniquePtr<char>& category);
 
  private:
-  // This field must only be accessed via *_locked() methods.
-  UniquePtr<DroppedCallCounts> drop_token_counts_;
-  // These fields may be accessed from multiple threads at a time.
-  gpr_atm num_calls_started_ = 0;
-  gpr_atm num_calls_finished_ = 0;
-  gpr_atm num_calls_finished_with_client_failed_to_send_ = 0;
-  gpr_atm num_calls_finished_known_received_ = 0;
+  // The stats for each locality.
+  LocalityStatsMap upstream_locality_stats_;
+  Atomic<uint64_t> total_dropped_requests_{0};
+  // Protects dropped_requests_. A mutex is necessary because the length of
+  // dropped_requests_ can be accessed by both the picker (from data plane
+  // combiner) and the load reporting thread (from the control plane combiner).
+  Mutex dropped_requests_mu_;
+  DroppedRequestsMap dropped_requests_;
+  // The timestamp of last reporting. For the LB-policy-wide first report, the
+  // last_report_time is the time we scheduled the first reporting timer.
+  grpc_millis last_report_time_ = -1;
 };
 
 }  // namespace grpc_core
index 58f26bf..16d5f9a 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
-#include "pb_decode.h"
-#include "pb_encode.h"
-#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h"
+#include <algorithm>
 
+#include <grpc/impl/codegen/log.h>
 #include <grpc/support/alloc.h>
+#include <grpc/support/string_util.h>
 
-/* invoked once for every Server in ServerList */
-static bool count_serverlist(pb_istream_t* stream, const pb_field_t* field,
-                             void** arg) {
-  xds_grpclb_serverlist* sl = static_cast<xds_grpclb_serverlist*>(*arg);
-  xds_grpclb_server server;
-  if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, &server))) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream));
-    return false;
-  }
-  ++sl->num_servers;
-  return true;
-}
+#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h"
+#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
 
-typedef struct decode_serverlist_arg {
-  /* The decoding callback is invoked once per server in serverlist. Remember
-   * which index of the serverlist are we currently decoding */
-  size_t decoding_idx;
-  /* The decoded serverlist */
-  xds_grpclb_serverlist* serverlist;
-} decode_serverlist_arg;
+#include "envoy/api/v2/core/address.upb.h"
+#include "envoy/api/v2/core/base.upb.h"
+#include "envoy/api/v2/discovery.upb.h"
+#include "envoy/api/v2/eds.upb.h"
+#include "envoy/api/v2/endpoint/endpoint.upb.h"
+#include "envoy/api/v2/endpoint/load_report.upb.h"
+#include "envoy/service/load_stats/v2/lrs.upb.h"
+#include "envoy/type/percent.upb.h"
+#include "google/protobuf/any.upb.h"
+#include "google/protobuf/duration.upb.h"
+#include "google/protobuf/struct.upb.h"
+#include "google/protobuf/timestamp.upb.h"
+#include "google/protobuf/wrappers.upb.h"
+#include "upb/upb.h"
 
-/* invoked once for every Server in ServerList */
-static bool decode_serverlist(pb_istream_t* stream, const pb_field_t* field,
-                              void** arg) {
-  decode_serverlist_arg* dec_arg = static_cast<decode_serverlist_arg*>(*arg);
-  GPR_ASSERT(dec_arg->serverlist->num_servers >= dec_arg->decoding_idx);
-  xds_grpclb_server* server =
-      static_cast<xds_grpclb_server*>(gpr_zalloc(sizeof(xds_grpclb_server)));
-  if (GPR_UNLIKELY(!pb_decode(stream, grpc_lb_v1_Server_fields, server))) {
-    gpr_free(server);
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(stream));
-    return false;
-  }
-  dec_arg->serverlist->servers[dec_arg->decoding_idx++] = server;
-  return true;
-}
+namespace grpc_core {
 
-xds_grpclb_request* xds_grpclb_request_create(const char* lb_service_name) {
-  xds_grpclb_request* req =
-      static_cast<xds_grpclb_request*>(gpr_malloc(sizeof(xds_grpclb_request)));
-  req->has_client_stats = false;
-  req->has_initial_request = true;
-  req->initial_request.has_name = true;
-  // GCC warns (-Wstringop-truncation) because the destination
-  // buffer size is identical to max-size, leading to a potential
-  // char[] with no null terminator.  nanopb can handle it fine,
-  // and parantheses around strncpy silence that compiler warning.
-  (strncpy(req->initial_request.name, lb_service_name,
-           XDS_SERVICE_NAME_MAX_LENGTH));
-  return req;
-}
+namespace {
 
-static void populate_timestamp(gpr_timespec timestamp,
-                               xds_grpclb_timestamp* timestamp_pb) {
-  timestamp_pb->has_seconds = true;
-  timestamp_pb->seconds = timestamp.tv_sec;
-  timestamp_pb->has_nanos = true;
-  timestamp_pb->nanos = timestamp.tv_nsec;
-}
+constexpr char kEdsTypeUrl[] =
+    "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment";
+constexpr char kEndpointRequired[] = "endpointRequired";
 
-static bool encode_string(pb_ostream_t* stream, const pb_field_t* field,
-                          void* const* arg) {
-  char* str = static_cast<char*>(*arg);
-  if (!pb_encode_tag_for_field(stream, field)) return false;
-  return pb_encode_string(stream, reinterpret_cast<uint8_t*>(str), strlen(str));
-}
+}  // namespace
 
-static bool encode_drops(pb_ostream_t* stream, const pb_field_t* field,
-                         void* const* arg) {
-  grpc_core::XdsLbClientStats::DroppedCallCounts* drop_entries =
-      static_cast<grpc_core::XdsLbClientStats::DroppedCallCounts*>(*arg);
-  if (drop_entries == nullptr) return true;
-  for (size_t i = 0; i < drop_entries->size(); ++i) {
-    if (!pb_encode_tag_for_field(stream, field)) return false;
-    grpc_lb_v1_ClientStatsPerToken drop_message;
-    drop_message.load_balance_token.funcs.encode = encode_string;
-    drop_message.load_balance_token.arg = (*drop_entries)[i].token.get();
-    drop_message.has_num_calls = true;
-    drop_message.num_calls = (*drop_entries)[i].count;
-    if (!pb_encode_submessage(stream, grpc_lb_v1_ClientStatsPerToken_fields,
-                              &drop_message)) {
-      return false;
+bool XdsDropConfig::ShouldDrop(const UniquePtr<char>** category_name) const {
+  for (size_t i = 0; i < drop_category_list_.size(); ++i) {
+    const auto& drop_category = drop_category_list_[i];
+    // Generate a random number in [0, 1000000).
+    const int random = rand() % 1000000;
+    if (random < drop_category.parts_per_million) {
+      *category_name = &drop_category.name;
+      return true;
     }
   }
-  return true;
+  return false;
 }
 
-xds_grpclb_request* xds_grpclb_load_report_request_create_locked(
-    grpc_core::XdsLbClientStats* client_stats) {
-  xds_grpclb_request* req =
-      static_cast<xds_grpclb_request*>(gpr_zalloc(sizeof(xds_grpclb_request)));
-  req->has_client_stats = true;
-  req->client_stats.has_timestamp = true;
-  populate_timestamp(gpr_now(GPR_CLOCK_REALTIME), &req->client_stats.timestamp);
-  req->client_stats.has_num_calls_started = true;
-  req->client_stats.has_num_calls_finished = true;
-  req->client_stats.has_num_calls_finished_with_client_failed_to_send = true;
-  req->client_stats.has_num_calls_finished_with_client_failed_to_send = true;
-  req->client_stats.has_num_calls_finished_known_received = true;
-  req->client_stats.calls_finished_with_drop.funcs.encode = encode_drops;
-  grpc_core::UniquePtr<grpc_core::XdsLbClientStats::DroppedCallCounts>
-      drop_counts;
-  client_stats->GetLocked(
-      &req->client_stats.num_calls_started,
-      &req->client_stats.num_calls_finished,
-      &req->client_stats.num_calls_finished_with_client_failed_to_send,
-      &req->client_stats.num_calls_finished_known_received, &drop_counts);
-  // Will be deleted in xds_grpclb_request_destroy().
-  req->client_stats.calls_finished_with_drop.arg = drop_counts.release();
-  return req;
+grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) {
+  upb::Arena arena;
+  // Create a request.
+  envoy_api_v2_DiscoveryRequest* request =
+      envoy_api_v2_DiscoveryRequest_new(arena.ptr());
+  envoy_api_v2_core_Node* node =
+      envoy_api_v2_DiscoveryRequest_mutable_node(request, arena.ptr());
+  google_protobuf_Struct* metadata =
+      envoy_api_v2_core_Node_mutable_metadata(node, arena.ptr());
+  google_protobuf_Struct_FieldsEntry* field =
+      google_protobuf_Struct_add_fields(metadata, arena.ptr());
+  google_protobuf_Struct_FieldsEntry_set_key(
+      field, upb_strview_makez(kEndpointRequired));
+  google_protobuf_Value* value =
+      google_protobuf_Struct_FieldsEntry_mutable_value(field, arena.ptr());
+  google_protobuf_Value_set_bool_value(value, true);
+  envoy_api_v2_DiscoveryRequest_add_resource_names(
+      request, upb_strview_makez(service_name), arena.ptr());
+  envoy_api_v2_DiscoveryRequest_set_type_url(request,
+                                             upb_strview_makez(kEdsTypeUrl));
+  // Encode the request.
+  size_t output_length;
+  char* output = envoy_api_v2_DiscoveryRequest_serialize(request, arena.ptr(),
+                                                         &output_length);
+  return grpc_slice_from_copied_buffer(output, output_length);
 }
 
-grpc_slice xds_grpclb_request_encode(const xds_grpclb_request* request) {
-  size_t encoded_length;
-  pb_ostream_t sizestream;
-  pb_ostream_t outputstream;
-  grpc_slice slice;
-  memset(&sizestream, 0, sizeof(pb_ostream_t));
-  pb_encode(&sizestream, grpc_lb_v1_LoadBalanceRequest_fields, request);
-  encoded_length = sizestream.bytes_written;
+namespace {
 
-  slice = GRPC_SLICE_MALLOC(encoded_length);
-  outputstream =
-      pb_ostream_from_buffer(GRPC_SLICE_START_PTR(slice), encoded_length);
-  GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v1_LoadBalanceRequest_fields,
-                       request) != 0);
-  return slice;
-}
-
-void xds_grpclb_request_destroy(xds_grpclb_request* request) {
-  if (request->has_client_stats) {
-    grpc_core::XdsLbClientStats::DroppedCallCounts* drop_entries =
-        static_cast<grpc_core::XdsLbClientStats::DroppedCallCounts*>(
-            request->client_stats.calls_finished_with_drop.arg);
-    grpc_core::Delete(drop_entries);
+grpc_error* ServerAddressParseAndAppend(
+    const envoy_api_v2_endpoint_LbEndpoint* lb_endpoint,
+    ServerAddressList* list) {
+  // Find the ip:port.
+  const envoy_api_v2_endpoint_Endpoint* endpoint =
+      envoy_api_v2_endpoint_LbEndpoint_endpoint(lb_endpoint);
+  const envoy_api_v2_core_Address* address =
+      envoy_api_v2_endpoint_Endpoint_address(endpoint);
+  const envoy_api_v2_core_SocketAddress* socket_address =
+      envoy_api_v2_core_Address_socket_address(address);
+  upb_strview address_strview =
+      envoy_api_v2_core_SocketAddress_address(socket_address);
+  uint32_t port = envoy_api_v2_core_SocketAddress_port_value(socket_address);
+  if (GPR_UNLIKELY(port >> 16) != 0) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid port.");
   }
-  gpr_free(request);
+  // Populate grpc_resolved_address.
+  grpc_resolved_address addr;
+  char* address_str = static_cast<char*>(gpr_malloc(address_strview.size + 1));
+  memcpy(address_str, address_strview.data, address_strview.size);
+  address_str[address_strview.size] = '\0';
+  grpc_string_to_sockaddr(&addr, address_str, port);
+  gpr_free(address_str);
+  // Append the address to the list.
+  list->emplace_back(addr, nullptr);
+  return GRPC_ERROR_NONE;
 }
 
-typedef grpc_lb_v1_LoadBalanceResponse xds_grpclb_response;
-xds_grpclb_initial_response* xds_grpclb_initial_response_parse(
-    const grpc_slice& encoded_xds_grpclb_response) {
-  pb_istream_t stream = pb_istream_from_buffer(
-      const_cast<uint8_t*>(GRPC_SLICE_START_PTR(encoded_xds_grpclb_response)),
-      GRPC_SLICE_LENGTH(encoded_xds_grpclb_response));
-  xds_grpclb_response res;
-  memset(&res, 0, sizeof(xds_grpclb_response));
-  if (GPR_UNLIKELY(
-          !pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res))) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
-    return nullptr;
-  }
+namespace {
 
-  if (!res.has_initial_response) return nullptr;
+UniquePtr<char> StringCopy(const upb_strview& strview) {
+  char* str = static_cast<char*>(gpr_malloc(strview.size + 1));
+  memcpy(str, strview.data, strview.size);
+  str[strview.size] = '\0';
+  return UniquePtr<char>(str);
+}
 
-  xds_grpclb_initial_response* initial_res =
-      static_cast<xds_grpclb_initial_response*>(
-          gpr_malloc(sizeof(xds_grpclb_initial_response)));
-  memcpy(initial_res, &res.initial_response,
-         sizeof(xds_grpclb_initial_response));
+}  // namespace
 
-  return initial_res;
+grpc_error* LocalityParse(
+    const envoy_api_v2_endpoint_LocalityLbEndpoints* locality_lb_endpoints,
+    XdsLocalityInfo* locality_info) {
+  // Parse LB weight.
+  const google_protobuf_UInt32Value* lb_weight =
+      envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight(
+          locality_lb_endpoints);
+  // If LB weight is not specified, it means this locality is assigned no load.
+  // TODO(juanlishen): When we support CDS to configure the inter-locality
+  // policy, we should change the LB weight handling.
+  locality_info->lb_weight =
+      lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0;
+  if (locality_info->lb_weight == 0) return GRPC_ERROR_NONE;
+  // Parse locality name.
+  const envoy_api_v2_core_Locality* locality =
+      envoy_api_v2_endpoint_LocalityLbEndpoints_locality(locality_lb_endpoints);
+  locality_info->locality_name = MakeRefCounted<XdsLocalityName>(
+      StringCopy(envoy_api_v2_core_Locality_region(locality)),
+      StringCopy(envoy_api_v2_core_Locality_zone(locality)),
+      StringCopy(envoy_api_v2_core_Locality_sub_zone(locality)));
+  // Parse the addresses.
+  size_t size;
+  const envoy_api_v2_endpoint_LbEndpoint* const* lb_endpoints =
+      envoy_api_v2_endpoint_LocalityLbEndpoints_lb_endpoints(
+          locality_lb_endpoints, &size);
+  for (size_t i = 0; i < size; ++i) {
+    grpc_error* error = ServerAddressParseAndAppend(lb_endpoints[i],
+                                                    &locality_info->serverlist);
+    if (error != GRPC_ERROR_NONE) return error;
+  }
+  // Parse the priority.
+  locality_info->priority =
+      envoy_api_v2_endpoint_LocalityLbEndpoints_priority(locality_lb_endpoints);
+  return GRPC_ERROR_NONE;
 }
 
-xds_grpclb_serverlist* xds_grpclb_response_parse_serverlist(
-    const grpc_slice& encoded_xds_grpclb_response) {
-  pb_istream_t stream = pb_istream_from_buffer(
-      const_cast<uint8_t*>(GRPC_SLICE_START_PTR(encoded_xds_grpclb_response)),
-      GRPC_SLICE_LENGTH(encoded_xds_grpclb_response));
-  pb_istream_t stream_at_start = stream;
-  xds_grpclb_serverlist* sl = static_cast<xds_grpclb_serverlist*>(
-      gpr_zalloc(sizeof(xds_grpclb_serverlist)));
-  xds_grpclb_response res;
-  memset(&res, 0, sizeof(xds_grpclb_response));
-  // First pass: count number of servers.
-  res.server_list.servers.funcs.decode = count_serverlist;
-  res.server_list.servers.arg = sl;
-  bool status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res);
-  if (GPR_UNLIKELY(!status)) {
-    gpr_free(sl);
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
-    return nullptr;
+grpc_error* DropParseAndAppend(
+    const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* drop_overload,
+    XdsDropConfig* drop_config, bool* drop_all) {
+  // Get the category.
+  upb_strview category =
+      envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_category(
+          drop_overload);
+  if (category.size == 0) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty drop category name");
   }
-  // Second pass: populate servers.
-  if (sl->num_servers > 0) {
-    sl->servers = static_cast<xds_grpclb_server**>(
-        gpr_zalloc(sizeof(xds_grpclb_server*) * sl->num_servers));
-    decode_serverlist_arg decode_arg;
-    memset(&decode_arg, 0, sizeof(decode_arg));
-    decode_arg.serverlist = sl;
-    res.server_list.servers.funcs.decode = decode_serverlist;
-    res.server_list.servers.arg = &decode_arg;
-    status = pb_decode(&stream_at_start, grpc_lb_v1_LoadBalanceResponse_fields,
-                       &res);
-    if (GPR_UNLIKELY(!status)) {
-      xds_grpclb_destroy_serverlist(sl);
-      gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
-      return nullptr;
-    }
+  // Get the drop rate (per million).
+  const envoy_type_FractionalPercent* drop_percentage =
+      envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_drop_percentage(
+          drop_overload);
+  uint32_t numerator = envoy_type_FractionalPercent_numerator(drop_percentage);
+  const auto denominator =
+      static_cast<envoy_type_FractionalPercent_DenominatorType>(
+          envoy_type_FractionalPercent_denominator(drop_percentage));
+  // Normalize to million.
+  switch (denominator) {
+    case envoy_type_FractionalPercent_HUNDRED:
+      numerator *= 10000;
+      break;
+    case envoy_type_FractionalPercent_TEN_THOUSAND:
+      numerator *= 100;
+      break;
+    case envoy_type_FractionalPercent_MILLION:
+      break;
+    default:
+      return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unknown denominator type");
   }
-  return sl;
+  // Cap numerator to 1000000.
+  numerator = GPR_MIN(numerator, 1000000);
+  if (numerator == 1000000) *drop_all = true;
+  drop_config->AddCategory(StringCopy(category), numerator);
+  return GRPC_ERROR_NONE;
 }
 
-void xds_grpclb_destroy_serverlist(xds_grpclb_serverlist* serverlist) {
-  if (serverlist == nullptr) {
-    return;
+}  // namespace
+
+grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response,
+                                         XdsUpdate* update) {
+  upb::Arena arena;
+  // Decode the response.
+  const envoy_api_v2_DiscoveryResponse* response =
+      envoy_api_v2_DiscoveryResponse_parse(
+          reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
+          GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
+  // Parse the response.
+  if (response == nullptr) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No response found.");
   }
-  for (size_t i = 0; i < serverlist->num_servers; i++) {
-    gpr_free(serverlist->servers[i]);
+  // Check the type_url of the response.
+  upb_strview type_url = envoy_api_v2_DiscoveryResponse_type_url(response);
+  upb_strview expected_type_url = upb_strview_makez(kEdsTypeUrl);
+  if (!upb_strview_eql(type_url, expected_type_url)) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not EDS.");
   }
-  gpr_free(serverlist->servers);
-  gpr_free(serverlist);
-}
-
-xds_grpclb_serverlist* xds_grpclb_serverlist_copy(
-    const xds_grpclb_serverlist* sl) {
-  xds_grpclb_serverlist* copy = static_cast<xds_grpclb_serverlist*>(
-      gpr_zalloc(sizeof(xds_grpclb_serverlist)));
-  copy->num_servers = sl->num_servers;
-  copy->servers = static_cast<xds_grpclb_server**>(
-      gpr_malloc(sizeof(xds_grpclb_server*) * sl->num_servers));
-  for (size_t i = 0; i < sl->num_servers; i++) {
-    copy->servers[i] =
-        static_cast<xds_grpclb_server*>(gpr_malloc(sizeof(xds_grpclb_server)));
-    memcpy(copy->servers[i], sl->servers[i], sizeof(xds_grpclb_server));
+  // Get the resources from the response.
+  size_t size;
+  const google_protobuf_Any* const* resources =
+      envoy_api_v2_DiscoveryResponse_resources(response, &size);
+  if (size < 1) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "EDS response contains 0 resource.");
   }
-  return copy;
-}
-
-bool xds_grpclb_serverlist_equals(const xds_grpclb_serverlist* lhs,
-                                  const xds_grpclb_serverlist* rhs) {
-  if (lhs == nullptr || rhs == nullptr) {
-    return false;
+  // Check the type_url of the resource.
+  type_url = google_protobuf_Any_type_url(resources[0]);
+  if (!upb_strview_eql(type_url, expected_type_url)) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resource is not EDS.");
   }
-  if (lhs->num_servers != rhs->num_servers) {
-    return false;
+  // Get the cluster_load_assignment.
+  upb_strview encoded_cluster_load_assignment =
+      google_protobuf_Any_value(resources[0]);
+  envoy_api_v2_ClusterLoadAssignment* cluster_load_assignment =
+      envoy_api_v2_ClusterLoadAssignment_parse(
+          encoded_cluster_load_assignment.data,
+          encoded_cluster_load_assignment.size, arena.ptr());
+  // Get the endpoints.
+  const envoy_api_v2_endpoint_LocalityLbEndpoints* const* endpoints =
+      envoy_api_v2_ClusterLoadAssignment_endpoints(cluster_load_assignment,
+                                                   &size);
+  for (size_t i = 0; i < size; ++i) {
+    XdsLocalityInfo locality_info;
+    grpc_error* error = LocalityParse(endpoints[i], &locality_info);
+    if (error != GRPC_ERROR_NONE) return error;
+    // Filter out locality with weight 0.
+    if (locality_info.lb_weight == 0) continue;
+    update->locality_list.push_back(std::move(locality_info));
   }
-  for (size_t i = 0; i < lhs->num_servers; i++) {
-    if (!xds_grpclb_server_equals(lhs->servers[i], rhs->servers[i])) {
-      return false;
+  // The locality list is sorted here into deterministic order so that it's
+  // easier to check if two locality lists contain the same set of localities.
+  std::sort(update->locality_list.data(),
+            update->locality_list.data() + update->locality_list.size(),
+            XdsLocalityInfo::Less());
+  // Get the drop config.
+  update->drop_config = MakeRefCounted<XdsDropConfig>();
+  const envoy_api_v2_ClusterLoadAssignment_Policy* policy =
+      envoy_api_v2_ClusterLoadAssignment_policy(cluster_load_assignment);
+  if (policy != nullptr) {
+    const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const*
+        drop_overload =
+            envoy_api_v2_ClusterLoadAssignment_Policy_drop_overloads(policy,
+                                                                     &size);
+    for (size_t i = 0; i < size; ++i) {
+      grpc_error* error = DropParseAndAppend(
+          drop_overload[i], update->drop_config.get(), &update->drop_all);
+      if (error != GRPC_ERROR_NONE) return error;
     }
   }
-  return true;
+  return GRPC_ERROR_NONE;
 }
 
-bool xds_grpclb_server_equals(const xds_grpclb_server* lhs,
-                              const xds_grpclb_server* rhs) {
-  return memcmp(lhs, rhs, sizeof(xds_grpclb_server)) == 0;
+namespace {
+
+grpc_slice LrsRequestEncode(
+    const envoy_service_load_stats_v2_LoadStatsRequest* request,
+    upb_arena* arena) {
+  size_t output_length;
+  char* output = envoy_service_load_stats_v2_LoadStatsRequest_serialize(
+      request, arena, &output_length);
+  return grpc_slice_from_copied_buffer(output, output_length);
 }
 
-int xds_grpclb_duration_compare(const xds_grpclb_duration* lhs,
-                                const xds_grpclb_duration* rhs) {
-  GPR_ASSERT(lhs && rhs);
-  if (lhs->has_seconds && rhs->has_seconds) {
-    if (lhs->seconds < rhs->seconds) return -1;
-    if (lhs->seconds > rhs->seconds) return 1;
-  } else if (lhs->has_seconds) {
-    return 1;
-  } else if (rhs->has_seconds) {
-    return -1;
-  }
+}  // namespace
 
-  GPR_ASSERT(lhs->seconds == rhs->seconds);
-  if (lhs->has_nanos && rhs->has_nanos) {
-    if (lhs->nanos < rhs->nanos) return -1;
-    if (lhs->nanos > rhs->nanos) return 1;
-  } else if (lhs->has_nanos) {
-    return 1;
-  } else if (rhs->has_nanos) {
-    return -1;
-  }
+grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name) {
+  upb::Arena arena;
+  // Create a request.
+  envoy_service_load_stats_v2_LoadStatsRequest* request =
+      envoy_service_load_stats_v2_LoadStatsRequest_new(arena.ptr());
+  // Add cluster stats. There is only one because we only use one server name in
+  // one channel.
+  envoy_api_v2_endpoint_ClusterStats* cluster_stats =
+      envoy_service_load_stats_v2_LoadStatsRequest_add_cluster_stats(
+          request, arena.ptr());
+  // Set the cluster name.
+  envoy_api_v2_endpoint_ClusterStats_set_cluster_name(
+      cluster_stats, upb_strview_makez(server_name));
+  return LrsRequestEncode(request, arena.ptr());
+}
+
+namespace {
 
-  return 0;
+void LocalityStatsPopulate(envoy_api_v2_endpoint_UpstreamLocalityStats* output,
+#if GRPC_USE_CPP_STD_LIB
+                           // TODO(veblush): Clean up this
+                           // This is to address the difference between
+                           // std::map and Map. #else block will be gone
+                           // once using stdlib is enabled by default.
+                           Pair<const RefCountedPtr<XdsLocalityName>,
+#else
+                           Pair<RefCountedPtr<XdsLocalityName>,
+#endif
+                                XdsClientStats::LocalityStats::Snapshot>& input,
+                           upb_arena* arena) {
+  // Set sub_zone.
+  envoy_api_v2_core_Locality* locality =
+      envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_locality(output,
+                                                                   arena);
+  envoy_api_v2_core_Locality_set_sub_zone(
+      locality, upb_strview_makez(input.first->sub_zone()));
+  // Set total counts.
+  XdsClientStats::LocalityStats::Snapshot& snapshot = input.second;
+  envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_successful_requests(
+      output, snapshot.total_successful_requests);
+  envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_requests_in_progress(
+      output, snapshot.total_requests_in_progress);
+  envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_error_requests(
+      output, snapshot.total_error_requests);
+  envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_issued_requests(
+      output, snapshot.total_issued_requests);
+  // Add load metric stats.
+  for (auto& p : snapshot.load_metric_stats) {
+    const char* metric_name = p.first.get();
+    const XdsClientStats::LocalityStats::LoadMetric::Snapshot& metric_value =
+        p.second;
+    envoy_api_v2_endpoint_EndpointLoadMetricStats* load_metric =
+        envoy_api_v2_endpoint_UpstreamLocalityStats_add_load_metric_stats(
+            output, arena);
+    envoy_api_v2_endpoint_EndpointLoadMetricStats_set_metric_name(
+        load_metric, upb_strview_makez(metric_name));
+    envoy_api_v2_endpoint_EndpointLoadMetricStats_set_num_requests_finished_with_metric(
+        load_metric, metric_value.num_requests_finished_with_metric);
+    envoy_api_v2_endpoint_EndpointLoadMetricStats_set_total_metric_value(
+        load_metric, metric_value.total_metric_value);
+  }
 }
 
-grpc_millis xds_grpclb_duration_to_millis(xds_grpclb_duration* duration_pb) {
-  return static_cast<grpc_millis>(
-      (duration_pb->has_seconds ? duration_pb->seconds : 0) * GPR_MS_PER_SEC +
-      (duration_pb->has_nanos ? duration_pb->nanos : 0) / GPR_NS_PER_MS);
+}  // namespace
+
+grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name,
+                                        XdsClientStats* client_stats) {
+  upb::Arena arena;
+  XdsClientStats::Snapshot snapshot = client_stats->GetSnapshotAndReset();
+  // Prune unused locality stats.
+  client_stats->PruneLocalityStats();
+  // When all the counts are zero, return empty slice.
+  if (snapshot.IsAllZero()) return grpc_empty_slice();
+  // Create a request.
+  envoy_service_load_stats_v2_LoadStatsRequest* request =
+      envoy_service_load_stats_v2_LoadStatsRequest_new(arena.ptr());
+  // Add cluster stats. There is only one because we only use one server name in
+  // one channel.
+  envoy_api_v2_endpoint_ClusterStats* cluster_stats =
+      envoy_service_load_stats_v2_LoadStatsRequest_add_cluster_stats(
+          request, arena.ptr());
+  // Set the cluster name.
+  envoy_api_v2_endpoint_ClusterStats_set_cluster_name(
+      cluster_stats, upb_strview_makez(server_name));
+  // Add locality stats.
+  for (auto& p : snapshot.upstream_locality_stats) {
+    envoy_api_v2_endpoint_UpstreamLocalityStats* locality_stats =
+        envoy_api_v2_endpoint_ClusterStats_add_upstream_locality_stats(
+            cluster_stats, arena.ptr());
+    LocalityStatsPopulate(locality_stats, p, arena.ptr());
+  }
+  // Add dropped requests.
+  for (auto& p : snapshot.dropped_requests) {
+    const char* category = p.first.get();
+    const uint64_t count = p.second;
+    envoy_api_v2_endpoint_ClusterStats_DroppedRequests* dropped_requests =
+        envoy_api_v2_endpoint_ClusterStats_add_dropped_requests(cluster_stats,
+                                                                arena.ptr());
+    envoy_api_v2_endpoint_ClusterStats_DroppedRequests_set_category(
+        dropped_requests, upb_strview_makez(category));
+    envoy_api_v2_endpoint_ClusterStats_DroppedRequests_set_dropped_count(
+        dropped_requests, count);
+  }
+  // Set total dropped requests.
+  envoy_api_v2_endpoint_ClusterStats_set_total_dropped_requests(
+      cluster_stats, snapshot.total_dropped_requests);
+  // Set real load report interval.
+  gpr_timespec timespec =
+      grpc_millis_to_timespec(snapshot.load_report_interval, GPR_TIMESPAN);
+  google_protobuf_Duration* load_report_interval =
+      envoy_api_v2_endpoint_ClusterStats_mutable_load_report_interval(
+          cluster_stats, arena.ptr());
+  google_protobuf_Duration_set_seconds(load_report_interval, timespec.tv_sec);
+  google_protobuf_Duration_set_nanos(load_report_interval, timespec.tv_nsec);
+  return LrsRequestEncode(request, arena.ptr());
 }
 
-void xds_grpclb_initial_response_destroy(
-    xds_grpclb_initial_response* response) {
-  gpr_free(response);
+grpc_error* XdsLrsResponseDecodeAndParse(const grpc_slice& encoded_response,
+                                         grpc_millis* load_reporting_interval,
+                                         const char* expected_server_name) {
+  upb::Arena arena;
+  // Decode the response.
+  const envoy_service_load_stats_v2_LoadStatsResponse* decoded_response =
+      envoy_service_load_stats_v2_LoadStatsResponse_parse(
+          reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
+          GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
+  // Parse the response.
+  if (decoded_response == nullptr) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No response found.");
+  }
+  // Check the cluster size in the response.
+  size_t size;
+  const upb_strview* clusters =
+      envoy_service_load_stats_v2_LoadStatsResponse_clusters(decoded_response,
+                                                             &size);
+  if (size != 1) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "The number of clusters (server names) is not 1.");
+  }
+  // Check the cluster name in the response
+  if (strncmp(expected_server_name, clusters[0].data, clusters[0].size) != 0) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "Unexpected cluster (server name).");
+  }
+  // Get the load report interval.
+  const google_protobuf_Duration* load_reporting_interval_duration =
+      envoy_service_load_stats_v2_LoadStatsResponse_load_reporting_interval(
+          decoded_response);
+  gpr_timespec timespec{
+      google_protobuf_Duration_seconds(load_reporting_interval_duration),
+      google_protobuf_Duration_nanos(load_reporting_interval_duration),
+      GPR_TIMESPAN};
+  *load_reporting_interval = gpr_time_to_millis(timespec);
+  return GRPC_ERROR_NONE;
 }
+
+}  // namespace grpc_core
index e52d20f..759c04c 100644 (file)
 
 #include <grpc/slice_buffer.h>
 
-#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
 #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h"
-#include "src/core/lib/iomgr/exec_ctx.h"
-
-#define XDS_SERVICE_NAME_MAX_LENGTH 128
-
-typedef grpc_lb_v1_Server_ip_address_t xds_grpclb_ip_address;
-typedef grpc_lb_v1_LoadBalanceRequest xds_grpclb_request;
-typedef grpc_lb_v1_InitialLoadBalanceResponse xds_grpclb_initial_response;
-typedef grpc_lb_v1_Server xds_grpclb_server;
-typedef google_protobuf_Duration xds_grpclb_duration;
-typedef google_protobuf_Timestamp xds_grpclb_timestamp;
-
-typedef struct {
-  xds_grpclb_server** servers;
-  size_t num_servers;
-} xds_grpclb_serverlist;
-
-/** Create a request for a gRPC LB service under \a lb_service_name */
-xds_grpclb_request* xds_grpclb_request_create(const char* lb_service_name);
-xds_grpclb_request* xds_grpclb_load_report_request_create_locked(
-    grpc_core::XdsLbClientStats* client_stats);
-
-/** Protocol Buffers v3-encode \a request */
-grpc_slice xds_grpclb_request_encode(const xds_grpclb_request* request);
-
-/** Destroy \a request */
-void xds_grpclb_request_destroy(xds_grpclb_request* request);
-
-/** Parse (ie, decode) the bytes in \a encoded_xds_grpclb_response as a \a
- * xds_grpclb_initial_response */
-xds_grpclb_initial_response* xds_grpclb_initial_response_parse(
-    const grpc_slice& encoded_xds_grpclb_response);
-
-/** Parse the list of servers from an encoded \a xds_grpclb_response */
-xds_grpclb_serverlist* xds_grpclb_response_parse_serverlist(
-    const grpc_slice& encoded_xds_grpclb_response);
-
-/** Return a copy of \a sl. The caller is responsible for calling \a
- * xds_grpclb_destroy_serverlist on the returned copy. */
-xds_grpclb_serverlist* xds_grpclb_serverlist_copy(
-    const xds_grpclb_serverlist* sl);
-
-bool xds_grpclb_serverlist_equals(const xds_grpclb_serverlist* lhs,
-                                  const xds_grpclb_serverlist* rhs);
-
-bool xds_grpclb_server_equals(const xds_grpclb_server* lhs,
-                              const xds_grpclb_server* rhs);
-
-/** Destroy \a serverlist */
-void xds_grpclb_destroy_serverlist(xds_grpclb_serverlist* serverlist);
-
-/** Compare \a lhs against \a rhs and return 0 if \a lhs and \a rhs are equal,
- * < 0 if \a lhs represents a duration shorter than \a rhs and > 0 otherwise */
-int xds_grpclb_duration_compare(const xds_grpclb_duration* lhs,
-                                const xds_grpclb_duration* rhs);
-
-grpc_millis xds_grpclb_duration_to_millis(xds_grpclb_duration* duration_pb);
-
-/** Destroy \a initial_response */
-void xds_grpclb_initial_response_destroy(xds_grpclb_initial_response* response);
+#include "src/core/ext/filters/client_channel/server_address.h"
+
+namespace grpc_core {
+
+struct XdsLocalityInfo {
+  bool operator==(const XdsLocalityInfo& other) const {
+    return *locality_name == *other.locality_name &&
+           serverlist == other.serverlist && lb_weight == other.lb_weight &&
+           priority == other.priority;
+  }
+
+  // This comparator only compares the locality names.
+  struct Less {
+    bool operator()(const XdsLocalityInfo& lhs,
+                    const XdsLocalityInfo& rhs) const {
+      return XdsLocalityName::Less()(lhs.locality_name, rhs.locality_name);
+    }
+  };
+
+  RefCountedPtr<XdsLocalityName> locality_name;
+  ServerAddressList serverlist;
+  uint32_t lb_weight;
+  uint32_t priority;
+};
+
+using XdsLocalityList = InlinedVector<XdsLocalityInfo, 1>;
+
+// There are two phases of accessing this class's content:
+// 1. to initialize in the control plane combiner;
+// 2. to use in the data plane combiner.
+// So no additional synchronization is needed.
+class XdsDropConfig : public RefCounted<XdsDropConfig> {
+ public:
+  struct DropCategory {
+    bool operator==(const DropCategory& other) const {
+      return strcmp(name.get(), other.name.get()) == 0 &&
+             parts_per_million == other.parts_per_million;
+    }
+
+    UniquePtr<char> name;
+    const uint32_t parts_per_million;
+  };
+
+  using DropCategoryList = InlinedVector<DropCategory, 2>;
+
+  void AddCategory(UniquePtr<char> name, uint32_t parts_per_million) {
+    drop_category_list_.emplace_back(
+        DropCategory{std::move(name), parts_per_million});
+  }
+
+  // The only method invoked from the data plane combiner.
+  bool ShouldDrop(const UniquePtr<char>** category_name) const;
+
+  const DropCategoryList& drop_category_list() const {
+    return drop_category_list_;
+  }
+
+  bool operator==(const XdsDropConfig& other) const {
+    return drop_category_list_ == other.drop_category_list_;
+  }
+  bool operator!=(const XdsDropConfig& other) const {
+    return !(*this == other);
+  }
+
+ private:
+  DropCategoryList drop_category_list_;
+};
+
+struct XdsUpdate {
+  XdsLocalityList locality_list;
+  RefCountedPtr<XdsDropConfig> drop_config;
+  bool drop_all = false;
+};
+
+// Creates an EDS request querying \a service_name.
+grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name);
+
+// Parses the EDS response and returns the args to update locality map. If there
+// is any error, the output update is invalid.
+grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response,
+                                         XdsUpdate* update);
+
+// Creates an LRS request querying \a server_name.
+grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name);
+
+// Creates an LRS request sending client-side load reports. If all the counters
+// in \a client_stats are zero, returns empty slice.
+grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name,
+                                        XdsClientStats* client_stats);
+
+// Parses the LRS response and returns the client-side load reporting interval.
+// If there is any error (e.g., the found server name doesn't match \a
+// expected_server_name), the output config is invalid.
+grpc_error* XdsLrsResponseDecodeAndParse(const grpc_slice& encoded_response,
+                                         grpc_millis* load_reporting_interval,
+                                         const char* expected_server_name);
+
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_LOAD_BALANCER_API_H \
         */
index 20099b5..c078895 100644 (file)
@@ -117,8 +117,13 @@ namespace {
 grpc_json* ParseLoadBalancingConfigHelper(const grpc_json* lb_config_array,
                                           grpc_error** error) {
   GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
+  if (lb_config_array == nullptr) {
+    *error =
+        GRPC_ERROR_CREATE_FROM_STATIC_STRING("LB config JSON tree is null");
+    return nullptr;
+  }
   char* error_msg;
-  if (lb_config_array == nullptr || lb_config_array->type != GRPC_JSON_ARRAY) {
+  if (lb_config_array->type != GRPC_JSON_ARRAY) {
     gpr_asprintf(&error_msg, "field:%s error:type should be array",
                  lb_config_array->key);
     *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg);
index c5e1ed8..fbfbb44 100644 (file)
@@ -33,8 +33,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 
 #ifdef GRPC_POSIX_SOCKET
 #include <errno.h>
@@ -73,9 +73,9 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
                               bool log_errors) {
   bool success = false;
   // Split host and port.
-  char* host;
-  char* port;
-  if (!gpr_split_host_port(hostport, &host, &port)) {
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  if (!grpc_core::SplitHostPort(hostport, &host, &port)) {
     if (log_errors) {
       gpr_log(GPR_ERROR, "Failed gpr_split_host_port(%s, ...)", hostport);
     }
@@ -86,8 +86,10 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
   addr->len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
   grpc_sockaddr_in* in = reinterpret_cast<grpc_sockaddr_in*>(addr->addr);
   in->sin_family = GRPC_AF_INET;
-  if (grpc_inet_pton(GRPC_AF_INET, host, &in->sin_addr) == 0) {
-    if (log_errors) gpr_log(GPR_ERROR, "invalid ipv4 address: '%s'", host);
+  if (grpc_inet_pton(GRPC_AF_INET, host.get(), &in->sin_addr) == 0) {
+    if (log_errors) {
+      gpr_log(GPR_ERROR, "invalid ipv4 address: '%s'", host.get());
+    }
     goto done;
   }
   // Parse port.
@@ -96,15 +98,14 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
     goto done;
   }
   int port_num;
-  if (sscanf(port, "%d", &port_num) != 1 || port_num < 0 || port_num > 65535) {
-    if (log_errors) gpr_log(GPR_ERROR, "invalid ipv4 port: '%s'", port);
+  if (sscanf(port.get(), "%d", &port_num) != 1 || port_num < 0 ||
+      port_num > 65535) {
+    if (log_errors) gpr_log(GPR_ERROR, "invalid ipv4 port: '%s'", port.get());
     goto done;
   }
   in->sin_port = grpc_htons(static_cast<uint16_t>(port_num));
   success = true;
 done:
-  gpr_free(host);
-  gpr_free(port);
   return success;
 }
 
@@ -124,9 +125,9 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
                               bool log_errors) {
   bool success = false;
   // Split host and port.
-  char* host;
-  char* port;
-  if (!gpr_split_host_port(hostport, &host, &port)) {
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  if (!grpc_core::SplitHostPort(hostport, &host, &port)) {
     if (log_errors) {
       gpr_log(GPR_ERROR, "Failed gpr_split_host_port(%s, ...)", hostport);
     }
@@ -138,11 +139,12 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
   grpc_sockaddr_in6* in6 = reinterpret_cast<grpc_sockaddr_in6*>(addr->addr);
   in6->sin6_family = GRPC_AF_INET6;
   // Handle the RFC6874 syntax for IPv6 zone identifiers.
-  char* host_end = static_cast<char*>(gpr_memrchr(host, '%', strlen(host)));
+  char* host_end =
+      static_cast<char*>(gpr_memrchr(host.get(), '%', strlen(host.get())));
   if (host_end != nullptr) {
-    GPR_ASSERT(host_end >= host);
+    GPR_ASSERT(host_end >= host.get());
     char host_without_scope[GRPC_INET6_ADDRSTRLEN + 1];
-    size_t host_without_scope_len = static_cast<size_t>(host_end - host);
+    size_t host_without_scope_len = static_cast<size_t>(host_end - host.get());
     uint32_t sin6_scope_id = 0;
     if (host_without_scope_len > GRPC_INET6_ADDRSTRLEN) {
       if (log_errors) {
@@ -154,7 +156,7 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
       }
       goto done;
     }
-    strncpy(host_without_scope, host, host_without_scope_len);
+    strncpy(host_without_scope, host.get(), host_without_scope_len);
     host_without_scope[host_without_scope_len] = '\0';
     if (grpc_inet_pton(GRPC_AF_INET6, host_without_scope, &in6->sin6_addr) ==
         0) {
@@ -163,9 +165,9 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
       }
       goto done;
     }
-    if (gpr_parse_bytes_to_uint32(host_end + 1,
-                                  strlen(host) - host_without_scope_len - 1,
-                                  &sin6_scope_id) == 0) {
+    if (gpr_parse_bytes_to_uint32(
+            host_end + 1, strlen(host.get()) - host_without_scope_len - 1,
+            &sin6_scope_id) == 0) {
       if ((sin6_scope_id = grpc_if_nametoindex(host_end + 1)) == 0) {
         gpr_log(GPR_ERROR,
                 "Invalid interface name: '%s'. "
@@ -177,8 +179,10 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
     // Handle "sin6_scope_id" being type "u_long". See grpc issue #10027.
     in6->sin6_scope_id = sin6_scope_id;
   } else {
-    if (grpc_inet_pton(GRPC_AF_INET6, host, &in6->sin6_addr) == 0) {
-      if (log_errors) gpr_log(GPR_ERROR, "invalid ipv6 address: '%s'", host);
+    if (grpc_inet_pton(GRPC_AF_INET6, host.get(), &in6->sin6_addr) == 0) {
+      if (log_errors) {
+        gpr_log(GPR_ERROR, "invalid ipv6 address: '%s'", host.get());
+      }
       goto done;
     }
   }
@@ -188,15 +192,14 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
     goto done;
   }
   int port_num;
-  if (sscanf(port, "%d", &port_num) != 1 || port_num < 0 || port_num > 65535) {
-    if (log_errors) gpr_log(GPR_ERROR, "invalid ipv6 port: '%s'", port);
+  if (sscanf(port.get(), "%d", &port_num) != 1 || port_num < 0 ||
+      port_num > 65535) {
+    if (log_errors) gpr_log(GPR_ERROR, "invalid ipv6 port: '%s'", port.get());
     goto done;
   }
   in6->sin6_port = grpc_htons(static_cast<uint16_t>(port_num));
   success = true;
 done:
-  gpr_free(host);
-  gpr_free(port);
   return success;
 }
 
index 87a4442..829a860 100644 (file)
@@ -117,12 +117,10 @@ class Resolver : public InternallyRefCounted<Resolver> {
   /// implementations.  At that point, this method can go away.
   virtual void ResetBackoffLocked() {}
 
+  // Note: This must be invoked while holding the combiner.
   void Orphan() override {
-    // Invoke ShutdownAndUnrefLocked() inside of the combiner.
-    GRPC_CLOSURE_SCHED(
-        GRPC_CLOSURE_CREATE(&Resolver::ShutdownAndUnrefLocked, this,
-                            grpc_combiner_scheduler(combiner_)),
-        GRPC_ERROR_NONE);
+    ShutdownLocked();
+    Unref();
   }
 
   GRPC_ABSTRACT_BASE_CLASS
@@ -147,12 +145,6 @@ class Resolver : public InternallyRefCounted<Resolver> {
   ResultHandler* result_handler() const { return result_handler_.get(); }
 
  private:
-  static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) {
-    Resolver* resolver = static_cast<Resolver*>(arg);
-    resolver->ShutdownLocked();
-    resolver->Unref();
-  }
-
   UniquePtr<ResultHandler> result_handler_;
   grpc_combiner* combiner_;
 };
index 32a339a..65f8052 100644 (file)
@@ -38,7 +38,6 @@
 #include "src/core/ext/filters/client_channel/service_config.h"
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/combiner.h"
@@ -145,7 +144,7 @@ AresDnsResolver::AresDnsResolver(ResolverArgs args)
   arg = grpc_channel_args_find(channel_args_,
                                GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
   min_time_between_resolutions_ =
-      grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
+      grpc_channel_arg_get_integer(arg, {1000 * 30, 0, INT_MAX});
   // Enable SRV queries option
   arg = grpc_channel_args_find(channel_args_, GRPC_ARG_DNS_ENABLE_SRV_QUERIES);
   enable_srv_queries_ = grpc_channel_arg_get_bool(arg, false);
@@ -401,7 +400,8 @@ void AresDnsResolver::MaybeStartResolvingLocked() {
       // new closure API is done, find a way to track this ref with the timer
       // callback as part of the type system.
       Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown").release();
-      grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
+      grpc_timer_init(&next_resolution_timer_,
+                      ExecCtx::Get()->Now() + ms_until_next_resolution,
                       &on_next_resolution_);
       return;
     }
@@ -433,6 +433,8 @@ void AresDnsResolver::StartResolvingLocked() {
 
 class AresDnsResolverFactory : public ResolverFactory {
  public:
+  bool IsValidUri(const grpc_uri* uri) const override { return true; }
+
   OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
     return OrphanablePtr<Resolver>(New<AresDnsResolver>(std::move(args)));
   }
index 7d52159..addae23 100644 (file)
@@ -31,6 +31,9 @@
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/iomgr/combiner.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/sockaddr_windows.h"
 #include "src/core/lib/iomgr/socket_windows.h"
 #include "src/core/lib/iomgr/tcp_windows.h"
 #include "src/core/lib/slice/slice_internal.h"
@@ -50,6 +53,32 @@ struct iovec {
 
 namespace grpc_core {
 
+/* c-ares reads and takes action on the error codes of the
+ * "virtual socket operations" in this file, via the WSAGetLastError
+ * APIs. If code in this file wants to set a specific WSA error that
+ * c-ares should read, it must do so by calling SetWSAError() on the
+ * WSAErrorContext instance passed to it. A WSAErrorContext must only be
+ * instantiated at the top of the virtual socket function callstack. */
+class WSAErrorContext {
+ public:
+  explicit WSAErrorContext(){};
+
+  ~WSAErrorContext() {
+    if (error_ != 0) {
+      WSASetLastError(error_);
+    }
+  }
+
+  /* Disallow copy and assignment operators */
+  WSAErrorContext(const WSAErrorContext&) = delete;
+  WSAErrorContext& operator=(const WSAErrorContext&) = delete;
+
+  void SetWSAError(int error) { error_ = error; }
+
+ private:
+  int error_ = 0;
+};
+
 /* c-ares creates its own sockets and is meant to read them when readable and
  * write them when writeable. To fit this socket usage model into the grpc
  * windows poller (which gives notifications when attempted reads and writes are
@@ -68,11 +97,14 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
     WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY,
   };
 
-  GrpcPolledFdWindows(ares_socket_t as, grpc_combiner* combiner)
+  GrpcPolledFdWindows(ares_socket_t as, grpc_combiner* combiner,
+                      int address_family, int socket_type)
       : read_buf_(grpc_empty_slice()),
         write_buf_(grpc_empty_slice()),
-        write_state_(WRITE_IDLE),
-        gotten_into_driver_list_(false) {
+        tcp_write_state_(WRITE_IDLE),
+        gotten_into_driver_list_(false),
+        address_family_(address_family),
+        socket_type_(socket_type) {
     gpr_asprintf(&name_, "c-ares socket: %" PRIdPTR, as);
     winsocket_ = grpc_winsocket_create(as, name_);
     combiner_ = GRPC_COMBINER_REF(combiner, name_);
@@ -82,6 +114,16 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
     GRPC_CLOSURE_INIT(&outer_write_closure_,
                       &GrpcPolledFdWindows::OnIocpWriteable, this,
                       grpc_combiner_scheduler(combiner_));
+    GRPC_CLOSURE_INIT(&on_tcp_connect_locked_,
+                      &GrpcPolledFdWindows::OnTcpConnectLocked, this,
+                      grpc_combiner_scheduler(combiner_));
+    GRPC_CLOSURE_INIT(&continue_register_for_on_readable_locked_,
+                      &GrpcPolledFdWindows::ContinueRegisterForOnReadableLocked,
+                      this, grpc_combiner_scheduler(combiner_));
+    GRPC_CLOSURE_INIT(
+        &continue_register_for_on_writeable_locked_,
+        &GrpcPolledFdWindows::ContinueRegisterForOnWriteableLocked, this,
+        grpc_combiner_scheduler(combiner_));
   }
 
   ~GrpcPolledFdWindows() {
@@ -111,6 +153,33 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
     grpc_slice_unref_internal(read_buf_);
     GPR_ASSERT(!read_buf_has_data_);
     read_buf_ = GRPC_SLICE_MALLOC(4192);
+    if (connect_done_) {
+      GRPC_CLOSURE_SCHED(&continue_register_for_on_readable_locked_,
+                         GRPC_ERROR_NONE);
+    } else {
+      GPR_ASSERT(pending_continue_register_for_on_readable_locked_ == nullptr);
+      pending_continue_register_for_on_readable_locked_ =
+          &continue_register_for_on_readable_locked_;
+    }
+  }
+
+  static void ContinueRegisterForOnReadableLocked(void* arg,
+                                                  grpc_error* unused_error) {
+    GrpcPolledFdWindows* grpc_polled_fd =
+        static_cast<GrpcPolledFdWindows*>(arg);
+    grpc_polled_fd->InnerContinueRegisterForOnReadableLocked(GRPC_ERROR_NONE);
+  }
+
+  void InnerContinueRegisterForOnReadableLocked(grpc_error* unused_error) {
+    GRPC_CARES_TRACE_LOG(
+        "fd:|%s| InnerContinueRegisterForOnReadableLocked "
+        "wsa_connect_error_:%d",
+        GetName(), wsa_connect_error_);
+    GPR_ASSERT(connect_done_);
+    if (wsa_connect_error_ != 0) {
+      ScheduleAndNullReadClosure(GRPC_WSA_ERROR(wsa_connect_error_, "connect"));
+      return;
+    }
     WSABUF buffer;
     buffer.buf = (char*)GRPC_SLICE_START_PTR(read_buf_);
     buffer.len = GRPC_SLICE_LENGTH(read_buf_);
@@ -123,13 +192,14 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
                     &winsocket_->read_info.overlapped, nullptr)) {
       int wsa_last_error = WSAGetLastError();
       char* msg = gpr_format_message(wsa_last_error);
-      grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
       GRPC_CARES_TRACE_LOG(
-          "RegisterForOnReadableLocked: WSARecvFrom error:|%s|. fd:|%s|", msg,
-          GetName());
+          "fd:|%s| RegisterForOnReadableLocked WSARecvFrom error code:|%d| "
+          "msg:|%s|",
+          GetName(), wsa_last_error, msg);
       gpr_free(msg);
       if (wsa_last_error != WSA_IO_PENDING) {
-        ScheduleAndNullReadClosure(error);
+        ScheduleAndNullReadClosure(
+            GRPC_WSA_ERROR(wsa_last_error, "WSARecvFrom"));
         return;
       }
     }
@@ -137,23 +207,68 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
   }
 
   void RegisterForOnWriteableLocked(grpc_closure* write_closure) override {
-    GRPC_CARES_TRACE_LOG(
-        "RegisterForOnWriteableLocked. fd:|%s|. Current write state: %d",
-        GetName(), write_state_);
+    if (socket_type_ == SOCK_DGRAM) {
+      GRPC_CARES_TRACE_LOG("fd:|%s| RegisterForOnWriteableLocked called",
+                           GetName());
+    } else {
+      GPR_ASSERT(socket_type_ == SOCK_STREAM);
+      GRPC_CARES_TRACE_LOG(
+          "fd:|%s| RegisterForOnWriteableLocked called tcp_write_state_: %d",
+          GetName(), tcp_write_state_);
+    }
     GPR_ASSERT(write_closure_ == nullptr);
     write_closure_ = write_closure;
-    switch (write_state_) {
-      case WRITE_IDLE:
-        ScheduleAndNullWriteClosure(GRPC_ERROR_NONE);
-        break;
-      case WRITE_REQUESTED:
-        write_state_ = WRITE_PENDING;
-        SendWriteBuf(nullptr, &winsocket_->write_info.overlapped);
-        grpc_socket_notify_on_write(winsocket_, &outer_write_closure_);
-        break;
-      case WRITE_PENDING:
-      case WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY:
-        abort();
+    if (connect_done_) {
+      GRPC_CLOSURE_SCHED(&continue_register_for_on_writeable_locked_,
+                         GRPC_ERROR_NONE);
+    } else {
+      GPR_ASSERT(pending_continue_register_for_on_writeable_locked_ == nullptr);
+      pending_continue_register_for_on_writeable_locked_ =
+          &continue_register_for_on_writeable_locked_;
+    }
+  }
+
+  static void ContinueRegisterForOnWriteableLocked(void* arg,
+                                                   grpc_error* unused_error) {
+    GrpcPolledFdWindows* grpc_polled_fd =
+        static_cast<GrpcPolledFdWindows*>(arg);
+    grpc_polled_fd->InnerContinueRegisterForOnWriteableLocked(GRPC_ERROR_NONE);
+  }
+
+  void InnerContinueRegisterForOnWriteableLocked(grpc_error* unused_error) {
+    GRPC_CARES_TRACE_LOG(
+        "fd:|%s| InnerContinueRegisterForOnWriteableLocked "
+        "wsa_connect_error_:%d",
+        GetName(), wsa_connect_error_);
+    GPR_ASSERT(connect_done_);
+    if (wsa_connect_error_ != 0) {
+      ScheduleAndNullWriteClosure(
+          GRPC_WSA_ERROR(wsa_connect_error_, "connect"));
+      return;
+    }
+    if (socket_type_ == SOCK_DGRAM) {
+      ScheduleAndNullWriteClosure(GRPC_ERROR_NONE);
+    } else {
+      GPR_ASSERT(socket_type_ == SOCK_STREAM);
+      int wsa_error_code = 0;
+      switch (tcp_write_state_) {
+        case WRITE_IDLE:
+          ScheduleAndNullWriteClosure(GRPC_ERROR_NONE);
+          break;
+        case WRITE_REQUESTED:
+          tcp_write_state_ = WRITE_PENDING;
+          if (SendWriteBuf(nullptr, &winsocket_->write_info.overlapped,
+                           &wsa_error_code) != 0) {
+            ScheduleAndNullWriteClosure(
+                GRPC_WSA_ERROR(wsa_error_code, "WSASend (overlapped)"));
+          } else {
+            grpc_socket_notify_on_write(winsocket_, &outer_write_closure_);
+          }
+          break;
+        case WRITE_PENDING:
+        case WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY:
+          abort();
+      }
     }
   }
 
@@ -171,13 +286,15 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
 
   const char* GetName() override { return name_; }
 
-  ares_ssize_t RecvFrom(void* data, ares_socket_t data_len, int flags,
+  ares_ssize_t RecvFrom(WSAErrorContext* wsa_error_ctx, void* data,
+                        ares_socket_t data_len, int flags,
                         struct sockaddr* from, ares_socklen_t* from_len) {
     GRPC_CARES_TRACE_LOG(
-        "RecvFrom called on fd:|%s|. Current read buf length:|%d|", GetName(),
-        GRPC_SLICE_LENGTH(read_buf_));
+        "fd:|%s| RecvFrom called read_buf_has_data:%d Current read buf "
+        "length:|%d|",
+        GetName(), read_buf_has_data_, GRPC_SLICE_LENGTH(read_buf_));
     if (!read_buf_has_data_) {
-      WSASetLastError(WSAEWOULDBLOCK);
+      wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK);
       return -1;
     }
     ares_ssize_t bytes_read = 0;
@@ -215,54 +332,99 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
     return out;
   }
 
-  int SendWriteBuf(LPDWORD bytes_sent_ptr, LPWSAOVERLAPPED overlapped) {
+  int SendWriteBuf(LPDWORD bytes_sent_ptr, LPWSAOVERLAPPED overlapped,
+                   int* wsa_error_code) {
     WSABUF buf;
     buf.len = GRPC_SLICE_LENGTH(write_buf_);
     buf.buf = (char*)GRPC_SLICE_START_PTR(write_buf_);
     DWORD flags = 0;
     int out = WSASend(grpc_winsocket_wrapped_socket(winsocket_), &buf, 1,
                       bytes_sent_ptr, flags, overlapped, nullptr);
+    *wsa_error_code = WSAGetLastError();
     GRPC_CARES_TRACE_LOG(
-        "WSASend: name:%s. buf len:%d. bytes sent: %d. overlapped %p. return "
-        "val: %d",
-        GetName(), buf.len, *bytes_sent_ptr, overlapped, out);
+        "fd:|%s| SendWriteBuf WSASend buf.len:%d *bytes_sent_ptr:%d "
+        "overlapped:%p "
+        "return:%d *wsa_error_code:%d",
+        GetName(), buf.len, bytes_sent_ptr != nullptr ? *bytes_sent_ptr : 0,
+        overlapped, out, *wsa_error_code);
     return out;
   }
 
-  ares_ssize_t TrySendWriteBufSyncNonBlocking() {
-    GPR_ASSERT(write_state_ == WRITE_IDLE);
+  ares_ssize_t SendV(WSAErrorContext* wsa_error_ctx, const struct iovec* iov,
+                     int iov_count) {
+    GRPC_CARES_TRACE_LOG(
+        "fd:|%s| SendV called connect_done_:%d wsa_connect_error_:%d",
+        GetName(), connect_done_, wsa_connect_error_);
+    if (!connect_done_) {
+      wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK);
+      return -1;
+    }
+    if (wsa_connect_error_ != 0) {
+      wsa_error_ctx->SetWSAError(wsa_connect_error_);
+      return -1;
+    }
+    switch (socket_type_) {
+      case SOCK_DGRAM:
+        return SendVUDP(wsa_error_ctx, iov, iov_count);
+      case SOCK_STREAM:
+        return SendVTCP(wsa_error_ctx, iov, iov_count);
+      default:
+        abort();
+    }
+  }
+
+  ares_ssize_t SendVUDP(WSAErrorContext* wsa_error_ctx, const struct iovec* iov,
+                        int iov_count) {
+    // c-ares doesn't handle retryable errors on writes of UDP sockets.
+    // Therefore, the sendv handler for UDP sockets must only attempt
+    // to write everything inline.
+    GRPC_CARES_TRACE_LOG("fd:|%s| SendVUDP called", GetName());
+    GPR_ASSERT(GRPC_SLICE_LENGTH(write_buf_) == 0);
+    grpc_slice_unref_internal(write_buf_);
+    write_buf_ = FlattenIovec(iov, iov_count);
     DWORD bytes_sent = 0;
-    if (SendWriteBuf(&bytes_sent, nullptr) != 0) {
-      int wsa_last_error = WSAGetLastError();
-      char* msg = gpr_format_message(wsa_last_error);
+    int wsa_error_code = 0;
+    if (SendWriteBuf(&bytes_sent, nullptr, &wsa_error_code) != 0) {
+      wsa_error_ctx->SetWSAError(wsa_error_code);
+      char* msg = gpr_format_message(wsa_error_code);
       GRPC_CARES_TRACE_LOG(
-          "TrySendWriteBufSyncNonBlocking: SendWriteBuf error:|%s|. fd:|%s|",
-          msg, GetName());
+          "fd:|%s| SendVUDP SendWriteBuf error code:%d msg:|%s|", GetName(),
+          wsa_error_code, msg);
       gpr_free(msg);
-      if (wsa_last_error == WSA_IO_PENDING) {
-        WSASetLastError(WSAEWOULDBLOCK);
-        write_state_ = WRITE_REQUESTED;
-      }
+      return -1;
     }
     write_buf_ = grpc_slice_sub_no_ref(write_buf_, bytes_sent,
                                        GRPC_SLICE_LENGTH(write_buf_));
     return bytes_sent;
   }
 
-  ares_ssize_t SendV(const struct iovec* iov, int iov_count) {
-    GRPC_CARES_TRACE_LOG("SendV called on fd:|%s|. Current write state: %d",
-                         GetName(), write_state_);
-    switch (write_state_) {
+  ares_ssize_t SendVTCP(WSAErrorContext* wsa_error_ctx, const struct iovec* iov,
+                        int iov_count) {
+    // The "sendv" handler on TCP sockets buffers up write
+    // requests and returns an artifical WSAEWOULDBLOCK. Writing that buffer out
+    // in the background, and making further send progress in general, will
+    // happen as long as c-ares continues to show interest in writeability on
+    // this fd.
+    GRPC_CARES_TRACE_LOG("fd:|%s| SendVTCP called tcp_write_state_:%d",
+                         GetName(), tcp_write_state_);
+    switch (tcp_write_state_) {
       case WRITE_IDLE:
+        tcp_write_state_ = WRITE_REQUESTED;
         GPR_ASSERT(GRPC_SLICE_LENGTH(write_buf_) == 0);
         grpc_slice_unref_internal(write_buf_);
         write_buf_ = FlattenIovec(iov, iov_count);
-        return TrySendWriteBufSyncNonBlocking();
+        wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK);
+        return -1;
       case WRITE_REQUESTED:
       case WRITE_PENDING:
-        WSASetLastError(WSAEWOULDBLOCK);
+        wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK);
         return -1;
       case WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY:
+        // c-ares is retrying a send on data that we previously returned
+        // WSAEWOULDBLOCK for, but then subsequently wrote out in the
+        // background. Right now, we assume that c-ares is retrying the same
+        // send again. If c-ares still needs to send even more data, we'll get
+        // to it eventually.
         grpc_slice currently_attempted = FlattenIovec(iov, iov_count);
         GPR_ASSERT(GRPC_SLICE_LENGTH(currently_attempted) >=
                    GRPC_SLICE_LENGTH(write_buf_));
@@ -272,31 +434,160 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
                      GRPC_SLICE_START_PTR(write_buf_)[i]);
           total_sent++;
         }
-        grpc_slice_unref_internal(write_buf_);
-        write_buf_ =
-            grpc_slice_sub_no_ref(currently_attempted, total_sent,
-                                  GRPC_SLICE_LENGTH(currently_attempted));
-        write_state_ = WRITE_IDLE;
-        total_sent += TrySendWriteBufSyncNonBlocking();
+        grpc_slice_unref_internal(currently_attempted);
+        tcp_write_state_ = WRITE_IDLE;
         return total_sent;
     }
     abort();
   }
 
-  int Connect(const struct sockaddr* target, ares_socklen_t target_len) {
+  static void OnTcpConnectLocked(void* arg, grpc_error* error) {
+    GrpcPolledFdWindows* grpc_polled_fd =
+        static_cast<GrpcPolledFdWindows*>(arg);
+    grpc_polled_fd->InnerOnTcpConnectLocked(error);
+  }
+
+  void InnerOnTcpConnectLocked(grpc_error* error) {
+    GRPC_CARES_TRACE_LOG(
+        "fd:%s InnerOnTcpConnectLocked error:|%s| "
+        "pending_register_for_readable:%" PRIdPTR
+        " pending_register_for_writeable:%" PRIdPTR,
+        GetName(), grpc_error_string(error),
+        pending_continue_register_for_on_readable_locked_,
+        pending_continue_register_for_on_writeable_locked_);
+    GPR_ASSERT(!connect_done_);
+    connect_done_ = true;
+    GPR_ASSERT(wsa_connect_error_ == 0);
+    if (error == GRPC_ERROR_NONE) {
+      DWORD transferred_bytes = 0;
+      DWORD flags;
+      BOOL wsa_success =
+          WSAGetOverlappedResult(grpc_winsocket_wrapped_socket(winsocket_),
+                                 &winsocket_->write_info.overlapped,
+                                 &transferred_bytes, FALSE, &flags);
+      GPR_ASSERT(transferred_bytes == 0);
+      if (!wsa_success) {
+        wsa_connect_error_ = WSAGetLastError();
+        char* msg = gpr_format_message(wsa_connect_error_);
+        GRPC_CARES_TRACE_LOG(
+            "fd:%s InnerOnTcpConnectLocked WSA overlapped result code:%d "
+            "msg:|%s|",
+            GetName(), wsa_connect_error_, msg);
+        gpr_free(msg);
+      }
+    } else {
+      // Spoof up an error code that will cause any future c-ares operations on
+      // this fd to abort.
+      wsa_connect_error_ = WSA_OPERATION_ABORTED;
+    }
+    if (pending_continue_register_for_on_readable_locked_ != nullptr) {
+      GRPC_CLOSURE_SCHED(pending_continue_register_for_on_readable_locked_,
+                         GRPC_ERROR_NONE);
+    }
+    if (pending_continue_register_for_on_writeable_locked_ != nullptr) {
+      GRPC_CLOSURE_SCHED(pending_continue_register_for_on_writeable_locked_,
+                         GRPC_ERROR_NONE);
+    }
+  }
+
+  int Connect(WSAErrorContext* wsa_error_ctx, const struct sockaddr* target,
+              ares_socklen_t target_len) {
+    switch (socket_type_) {
+      case SOCK_DGRAM:
+        return ConnectUDP(wsa_error_ctx, target, target_len);
+      case SOCK_STREAM:
+        return ConnectTCP(wsa_error_ctx, target, target_len);
+      default:
+        abort();
+    }
+  }
+
+  int ConnectUDP(WSAErrorContext* wsa_error_ctx, const struct sockaddr* target,
+                 ares_socklen_t target_len) {
+    GRPC_CARES_TRACE_LOG("fd:%s ConnectUDP", GetName());
+    GPR_ASSERT(!connect_done_);
+    GPR_ASSERT(wsa_connect_error_ == 0);
     SOCKET s = grpc_winsocket_wrapped_socket(winsocket_);
-    GRPC_CARES_TRACE_LOG("Connect: fd:|%s|", GetName());
     int out =
         WSAConnect(s, target, target_len, nullptr, nullptr, nullptr, nullptr);
-    if (out != 0) {
+    wsa_connect_error_ = WSAGetLastError();
+    wsa_error_ctx->SetWSAError(wsa_connect_error_);
+    connect_done_ = true;
+    char* msg = gpr_format_message(wsa_connect_error_);
+    GRPC_CARES_TRACE_LOG("fd:%s WSAConnect error code:|%d| msg:|%s|", GetName(),
+                         wsa_connect_error_, msg);
+    gpr_free(msg);
+    // c-ares expects a posix-style connect API
+    return out == 0 ? 0 : -1;
+  }
+
+  int ConnectTCP(WSAErrorContext* wsa_error_ctx, const struct sockaddr* target,
+                 ares_socklen_t target_len) {
+    GRPC_CARES_TRACE_LOG("fd:%s ConnectTCP", GetName());
+    LPFN_CONNECTEX ConnectEx;
+    GUID guid = WSAID_CONNECTEX;
+    DWORD ioctl_num_bytes;
+    SOCKET s = grpc_winsocket_wrapped_socket(winsocket_);
+    if (WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &guid, sizeof(guid),
+                 &ConnectEx, sizeof(ConnectEx), &ioctl_num_bytes, nullptr,
+                 nullptr) != 0) {
+      int wsa_last_error = WSAGetLastError();
+      wsa_error_ctx->SetWSAError(wsa_last_error);
+      char* msg = gpr_format_message(wsa_last_error);
+      GRPC_CARES_TRACE_LOG(
+          "fd:%s WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER) error code:%d "
+          "msg:|%s|",
+          GetName(), wsa_last_error, msg);
+      gpr_free(msg);
+      connect_done_ = true;
+      wsa_connect_error_ = wsa_last_error;
+      return -1;
+    }
+    grpc_resolved_address wildcard4_addr;
+    grpc_resolved_address wildcard6_addr;
+    grpc_sockaddr_make_wildcards(0, &wildcard4_addr, &wildcard6_addr);
+    grpc_resolved_address* local_address = nullptr;
+    if (address_family_ == AF_INET) {
+      local_address = &wildcard4_addr;
+    } else {
+      local_address = &wildcard6_addr;
+    }
+    if (bind(s, (struct sockaddr*)local_address->addr,
+             (int)local_address->len) != 0) {
       int wsa_last_error = WSAGetLastError();
+      wsa_error_ctx->SetWSAError(wsa_last_error);
       char* msg = gpr_format_message(wsa_last_error);
-      GRPC_CARES_TRACE_LOG("Connect error code:|%d|, msg:|%s|. fd:|%s|",
-                           wsa_last_error, msg, GetName());
+      GRPC_CARES_TRACE_LOG("fd:%s bind error code:%d msg:|%s|", GetName(),
+                           wsa_last_error, msg);
       gpr_free(msg);
-      // c-ares expects a posix-style connect API
+      connect_done_ = true;
+      wsa_connect_error_ = wsa_last_error;
+      return -1;
+    }
+    int out = 0;
+    if (ConnectEx(s, target, target_len, nullptr, 0, nullptr,
+                  &winsocket_->write_info.overlapped) == 0) {
       out = -1;
+      int wsa_last_error = WSAGetLastError();
+      wsa_error_ctx->SetWSAError(wsa_last_error);
+      char* msg = gpr_format_message(wsa_last_error);
+      GRPC_CARES_TRACE_LOG("fd:%s ConnectEx error code:%d msg:|%s|", GetName(),
+                           wsa_last_error, msg);
+      gpr_free(msg);
+      if (wsa_last_error == WSA_IO_PENDING) {
+        // c-ares only understands WSAEINPROGRESS and EWOULDBLOCK error codes on
+        // connect, but an async connect on IOCP socket will give
+        // WSA_IO_PENDING, so we need to convert.
+        wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK);
+      } else {
+        // By returning a non-retryable error to c-ares at this point,
+        // we're aborting the possibility of any future operations on this fd.
+        connect_done_ = true;
+        wsa_connect_error_ = wsa_last_error;
+        return -1;
+      }
     }
+    grpc_socket_notify_on_write(winsocket_, &on_tcp_connect_locked_);
     return out;
   }
 
@@ -319,26 +610,27 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
          * in subsequent c-ares reads. */
         if (winsocket_->read_info.wsa_error != WSAEMSGSIZE) {
           GRPC_ERROR_UNREF(error);
-          char* msg = gpr_format_message(winsocket_->read_info.wsa_error);
+          error = GRPC_WSA_ERROR(winsocket_->read_info.wsa_error,
+                                 "OnIocpReadableInner");
           GRPC_CARES_TRACE_LOG(
-              "OnIocpReadableInner. winsocket error:|%s|. fd:|%s|", msg,
-              GetName());
-          error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
-          gpr_free(msg);
+              "fd:|%s| OnIocpReadableInner winsocket_->read_info.wsa_error "
+              "code:|%d| msg:|%s|",
+              GetName(), winsocket_->read_info.wsa_error,
+              grpc_error_string(error));
         }
       }
     }
     if (error == GRPC_ERROR_NONE) {
-      read_buf_ = grpc_slice_sub_no_ref(read_buf_, 0,
-                                        winsocket_->read_info.bytes_transfered);
+      read_buf_ = grpc_slice_sub_no_ref(
+          read_buf_, 0, winsocket_->read_info.bytes_transferred);
       read_buf_has_data_ = true;
     } else {
       grpc_slice_unref_internal(read_buf_);
       read_buf_ = grpc_empty_slice();
     }
     GRPC_CARES_TRACE_LOG(
-        "OnIocpReadable finishing. read buf length now:|%d|. :fd:|%s|",
-        GRPC_SLICE_LENGTH(read_buf_), GetName());
+        "fd:|%s| OnIocpReadable finishing. read buf length now:|%d|", GetName(),
+        GRPC_SLICE_LENGTH(read_buf_));
     ScheduleAndNullReadClosure(error);
   }
 
@@ -349,22 +641,26 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
 
   void OnIocpWriteableInner(grpc_error* error) {
     GRPC_CARES_TRACE_LOG("OnIocpWriteableInner. fd:|%s|", GetName());
+    GPR_ASSERT(socket_type_ == SOCK_STREAM);
     if (error == GRPC_ERROR_NONE) {
       if (winsocket_->write_info.wsa_error != 0) {
-        char* msg = gpr_format_message(winsocket_->write_info.wsa_error);
-        GRPC_CARES_TRACE_LOG(
-            "OnIocpWriteableInner. winsocket error:|%s|. fd:|%s|", msg,
-            GetName());
         GRPC_ERROR_UNREF(error);
-        error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
-        gpr_free(msg);
+        error = GRPC_WSA_ERROR(winsocket_->write_info.wsa_error,
+                               "OnIocpWriteableInner");
+        GRPC_CARES_TRACE_LOG(
+            "fd:|%s| OnIocpWriteableInner. winsocket_->write_info.wsa_error "
+            "code:|%d| msg:|%s|",
+            GetName(), winsocket_->write_info.wsa_error,
+            grpc_error_string(error));
       }
     }
-    GPR_ASSERT(write_state_ == WRITE_PENDING);
+    GPR_ASSERT(tcp_write_state_ == WRITE_PENDING);
     if (error == GRPC_ERROR_NONE) {
-      write_state_ = WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY;
+      tcp_write_state_ = WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY;
       write_buf_ = grpc_slice_sub_no_ref(
-          write_buf_, 0, winsocket_->write_info.bytes_transfered);
+          write_buf_, 0, winsocket_->write_info.bytes_transferred);
+      GRPC_CARES_TRACE_LOG("fd:|%s| OnIocpWriteableInner. bytes transferred:%d",
+                           GetName(), winsocket_->write_info.bytes_transferred);
     } else {
       grpc_slice_unref_internal(write_buf_);
       write_buf_ = grpc_empty_slice();
@@ -386,9 +682,22 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
   grpc_closure outer_read_closure_;
   grpc_closure outer_write_closure_;
   grpc_winsocket* winsocket_;
-  WriteState write_state_;
+  // tcp_write_state_ is only used on TCP GrpcPolledFds
+  WriteState tcp_write_state_;
   char* name_ = nullptr;
   bool gotten_into_driver_list_;
+  int address_family_;
+  int socket_type_;
+  grpc_closure on_tcp_connect_locked_;
+  bool connect_done_ = false;
+  int wsa_connect_error_ = 0;
+  // We don't run register_for_{readable,writeable} logic until
+  // a socket is connected. In the interim, we queue readable/writeable
+  // registrations with the following state.
+  grpc_closure continue_register_for_on_readable_locked_;
+  grpc_closure continue_register_for_on_writeable_locked_;
+  grpc_closure* pending_continue_register_for_on_readable_locked_ = nullptr;
+  grpc_closure* pending_continue_register_for_on_writeable_locked_ = nullptr;
 };
 
 struct SockToPolledFdEntry {
@@ -454,39 +763,53 @@ class SockToPolledFdMap {
    * objects.
    */
   static ares_socket_t Socket(int af, int type, int protocol, void* user_data) {
+    if (type != SOCK_DGRAM && type != SOCK_STREAM) {
+      GRPC_CARES_TRACE_LOG("Socket called with invalid socket type:%d", type);
+      return INVALID_SOCKET;
+    }
     SockToPolledFdMap* map = static_cast<SockToPolledFdMap*>(user_data);
     SOCKET s = WSASocket(af, type, protocol, nullptr, 0,
                          grpc_get_default_wsa_socket_flags());
     if (s == INVALID_SOCKET) {
+      GRPC_CARES_TRACE_LOG(
+          "WSASocket failed with params af:%d type:%d protocol:%d", af, type,
+          protocol);
       return s;
     }
     grpc_tcp_set_non_block(s);
     GrpcPolledFdWindows* polled_fd =
-        New<GrpcPolledFdWindows>(s, map->combiner_);
+        New<GrpcPolledFdWindows>(s, map->combiner_, af, type);
+    GRPC_CARES_TRACE_LOG(
+        "fd:|%s| created with params af:%d type:%d protocol:%d",
+        polled_fd->GetName(), af, type, protocol);
     map->AddNewSocket(s, polled_fd);
     return s;
   }
 
   static int Connect(ares_socket_t as, const struct sockaddr* target,
                      ares_socklen_t target_len, void* user_data) {
+    WSAErrorContext wsa_error_ctx;
     SockToPolledFdMap* map = static_cast<SockToPolledFdMap*>(user_data);
     GrpcPolledFdWindows* polled_fd = map->LookupPolledFd(as);
-    return polled_fd->Connect(target, target_len);
+    return polled_fd->Connect(&wsa_error_ctx, target, target_len);
   }
 
   static ares_ssize_t SendV(ares_socket_t as, const struct iovec* iov,
                             int iovec_count, void* user_data) {
+    WSAErrorContext wsa_error_ctx;
     SockToPolledFdMap* map = static_cast<SockToPolledFdMap*>(user_data);
     GrpcPolledFdWindows* polled_fd = map->LookupPolledFd(as);
-    return polled_fd->SendV(iov, iovec_count);
+    return polled_fd->SendV(&wsa_error_ctx, iov, iovec_count);
   }
 
   static ares_ssize_t RecvFrom(ares_socket_t as, void* data, size_t data_len,
                                int flags, struct sockaddr* from,
                                ares_socklen_t* from_len, void* user_data) {
+    WSAErrorContext wsa_error_ctx;
     SockToPolledFdMap* map = static_cast<SockToPolledFdMap*>(user_data);
     GrpcPolledFdWindows* polled_fd = map->LookupPolledFd(as);
-    return polled_fd->RecvFrom(data, data_len, flags, from, from_len);
+    return polled_fd->RecvFrom(&wsa_error_ctx, data, data_len, flags, from,
+                               from_len);
   }
 
   static int CloseSocket(SOCKET s, void* user_data) {
index ad0f146..0c1a8ba 100644 (file)
@@ -35,8 +35,8 @@
 #include <address_sorting/address_sorting.h>
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/iomgr/executor.h"
@@ -355,9 +355,9 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
   grpc_ares_hostbyname_request* hr = nullptr;
   ares_channel* channel = nullptr;
   /* parse name, splitting it into host and port parts */
-  char* host;
-  char* port;
-  gpr_split_host_port(name, &host, &port);
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  grpc_core::SplitHostPort(name, &host, &port);
   if (host == nullptr) {
     error = grpc_error_set_str(
         GRPC_ERROR_CREATE_FROM_STATIC_STRING("unparseable host:port"),
@@ -370,7 +370,7 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
           GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
       goto error_cleanup;
     }
-    port = gpr_strdup(default_port);
+    port.reset(gpr_strdup(default_port));
   }
   error = grpc_ares_ev_driver_create_locked(&r->ev_driver, interested_parties,
                                             query_timeout_ms, combiner, r);
@@ -414,20 +414,22 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
   }
   r->pending_queries = 1;
   if (grpc_ares_query_ipv6()) {
-    hr = create_hostbyname_request_locked(r, host, grpc_strhtons(port),
-                                          false /* is_balancer */);
+    hr = create_hostbyname_request_locked(r, host.get(),
+                                          grpc_strhtons(port.get()),
+                                          /*is_balancer=*/false);
     ares_gethostbyname(*channel, hr->host, AF_INET6, on_hostbyname_done_locked,
                        hr);
   }
-  hr = create_hostbyname_request_locked(r, host, grpc_strhtons(port),
-                                        false /* is_balancer */);
+  hr =
+      create_hostbyname_request_locked(r, host.get(), grpc_strhtons(port.get()),
+                                       /*is_balancer=*/false);
   ares_gethostbyname(*channel, hr->host, AF_INET, on_hostbyname_done_locked,
                      hr);
   if (check_grpclb) {
     /* Query the SRV record */
     grpc_ares_request_ref_locked(r);
     char* service_name;
-    gpr_asprintf(&service_name, "_grpclb._tcp.%s", host);
+    gpr_asprintf(&service_name, "_grpclb._tcp.%s", host.get());
     ares_query(*channel, service_name, ns_c_in, ns_t_srv,
                on_srv_query_done_locked, r);
     gpr_free(service_name);
@@ -435,28 +437,25 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
   if (r->service_config_json_out != nullptr) {
     grpc_ares_request_ref_locked(r);
     char* config_name;
-    gpr_asprintf(&config_name, "_grpc_config.%s", host);
+    gpr_asprintf(&config_name, "_grpc_config.%s", host.get());
     ares_search(*channel, config_name, ns_c_in, ns_t_txt, on_txt_done_locked,
                 r);
     gpr_free(config_name);
   }
   grpc_ares_ev_driver_start_locked(r->ev_driver);
   grpc_ares_request_unref_locked(r);
-  gpr_free(host);
-  gpr_free(port);
   return;
 
 error_cleanup:
   GRPC_CLOSURE_SCHED(r->on_done, error);
-  gpr_free(host);
-  gpr_free(port);
 }
 
 static bool inner_resolve_as_ip_literal_locked(
     const char* name, const char* default_port,
-    grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs, char** host,
-    char** port, char** hostport) {
-  gpr_split_host_port(name, host, port);
+    grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
+    grpc_core::UniquePtr<char>* host, grpc_core::UniquePtr<char>* port,
+    grpc_core::UniquePtr<char>* hostport) {
+  grpc_core::SplitHostPort(name, host, port);
   if (*host == nullptr) {
     gpr_log(GPR_ERROR,
             "Failed to parse %s to host:port while attempting to resolve as ip "
@@ -472,12 +471,14 @@ static bool inner_resolve_as_ip_literal_locked(
               name);
       return false;
     }
-    *port = gpr_strdup(default_port);
+    port->reset(gpr_strdup(default_port));
   }
   grpc_resolved_address addr;
-  GPR_ASSERT(gpr_join_host_port(hostport, *host, atoi(*port)));
-  if (grpc_parse_ipv4_hostport(*hostport, &addr, false /* log errors */) ||
-      grpc_parse_ipv6_hostport(*hostport, &addr, false /* log errors */)) {
+  GPR_ASSERT(grpc_core::JoinHostPort(hostport, host->get(), atoi(port->get())));
+  if (grpc_parse_ipv4_hostport(hostport->get(), &addr,
+                               false /* log errors */) ||
+      grpc_parse_ipv6_hostport(hostport->get(), &addr,
+                               false /* log errors */)) {
     GPR_ASSERT(*addrs == nullptr);
     *addrs = grpc_core::MakeUnique<ServerAddressList>();
     (*addrs)->emplace_back(addr.addr, addr.len, nullptr /* args */);
@@ -489,24 +490,22 @@ static bool inner_resolve_as_ip_literal_locked(
 static bool resolve_as_ip_literal_locked(
     const char* name, const char* default_port,
     grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs) {
-  char* host = nullptr;
-  char* port = nullptr;
-  char* hostport = nullptr;
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  grpc_core::UniquePtr<char> hostport;
   bool out = inner_resolve_as_ip_literal_locked(name, default_port, addrs,
                                                 &host, &port, &hostport);
-  gpr_free(host);
-  gpr_free(port);
-  gpr_free(hostport);
   return out;
 }
 
-static bool target_matches_localhost_inner(const char* name, char** host,
-                                           char** port) {
-  if (!gpr_split_host_port(name, host, port)) {
+static bool target_matches_localhost_inner(const char* name,
+                                           grpc_core::UniquePtr<char>* host,
+                                           grpc_core::UniquePtr<char>* port) {
+  if (!grpc_core::SplitHostPort(name, host, port)) {
     gpr_log(GPR_ERROR, "Unable to split host and port for name: %s", name);
     return false;
   }
-  if (gpr_stricmp(*host, "localhost") == 0) {
+  if (gpr_stricmp(host->get(), "localhost") == 0) {
     return true;
   } else {
     return false;
@@ -514,20 +513,17 @@ static bool target_matches_localhost_inner(const char* name, char** host,
 }
 
 static bool target_matches_localhost(const char* name) {
-  char* host = nullptr;
-  char* port = nullptr;
-  bool out = target_matches_localhost_inner(name, &host, &port);
-  gpr_free(host);
-  gpr_free(port);
-  return out;
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  return target_matches_localhost_inner(name, &host, &port);
 }
 
 #ifdef GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY
 static bool inner_maybe_resolve_localhost_manually_locked(
     const char* name, const char* default_port,
-    grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs, char** host,
-    char** port) {
-  gpr_split_host_port(name, host, port);
+    grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs,
+    grpc_core::UniquePtr<char>* host, grpc_core::UniquePtr<char>* port) {
+  grpc_core::SplitHostPort(name, host, port);
   if (*host == nullptr) {
     gpr_log(GPR_ERROR,
             "Failed to parse %s into host:port during manual localhost "
@@ -543,12 +539,12 @@ static bool inner_maybe_resolve_localhost_manually_locked(
               name);
       return false;
     }
-    *port = gpr_strdup(default_port);
+    port->reset(gpr_strdup(default_port));
   }
-  if (gpr_stricmp(*host, "localhost") == 0) {
+  if (gpr_stricmp(host->get(), "localhost") == 0) {
     GPR_ASSERT(*addrs == nullptr);
     *addrs = grpc_core::MakeUnique<grpc_core::ServerAddressList>();
-    uint16_t numeric_port = grpc_strhtons(*port);
+    uint16_t numeric_port = grpc_strhtons(port->get());
     // Append the ipv6 loopback address.
     struct sockaddr_in6 ipv6_loopback_addr;
     memset(&ipv6_loopback_addr, 0, sizeof(ipv6_loopback_addr));
@@ -576,13 +572,10 @@ static bool inner_maybe_resolve_localhost_manually_locked(
 static bool grpc_ares_maybe_resolve_localhost_manually_locked(
     const char* name, const char* default_port,
     grpc_core::UniquePtr<grpc_core::ServerAddressList>* addrs) {
-  char* host = nullptr;
-  char* port = nullptr;
-  bool out = inner_maybe_resolve_localhost_manually_locked(name, default_port,
-                                                           addrs, &host, &port);
-  gpr_free(host);
-  gpr_free(port);
-  return out;
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  return inner_maybe_resolve_localhost_manually_locked(name, default_port,
+                                                       addrs, &host, &port);
 }
 #else  /* GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY */
 static bool grpc_ares_maybe_resolve_localhost_manually_locked(
index f85feb6..d9e3293 100644 (file)
@@ -26,7 +26,6 @@
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
 #include "src/core/ext/filters/client_channel/server_address.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 
 bool grpc_ares_query_ipv6() {
index 06cd572..1749cf7 100644 (file)
@@ -26,7 +26,6 @@
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
 #include "src/core/ext/filters/client_channel/server_address.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/socket_windows.h"
 
index 5ab75d0..629b736 100644 (file)
@@ -31,7 +31,6 @@
 #include "src/core/ext/filters/client_channel/server_address.h"
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/combiner.h"
@@ -111,7 +110,7 @@ NativeDnsResolver::NativeDnsResolver(ResolverArgs args)
   const grpc_arg* arg = grpc_channel_args_find(
       args.args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
   min_time_between_resolutions_ =
-      grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
+      grpc_channel_arg_get_integer(arg, {1000 * 30, 0, INT_MAX});
   interested_parties_ = grpc_pollset_set_create();
   if (args.pollset_set != nullptr) {
     grpc_pollset_set_add_pollset_set(interested_parties_, args.pollset_set);
@@ -230,7 +229,8 @@ void NativeDnsResolver::MaybeStartResolvingLocked() {
       // new closure API is done, find a way to track this ref with the timer
       // callback as part of the type system.
       Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown").release();
-      grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
+      grpc_timer_init(&next_resolution_timer_,
+                      ExecCtx::Get()->Now() + ms_until_next_resolution,
                       &on_next_resolution_);
       return;
     }
@@ -258,11 +258,16 @@ void NativeDnsResolver::StartResolvingLocked() {
 
 class NativeDnsResolverFactory : public ResolverFactory {
  public:
-  OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
-    if (GPR_UNLIKELY(0 != strcmp(args.uri->authority, ""))) {
+  bool IsValidUri(const grpc_uri* uri) const override {
+    if (GPR_UNLIKELY(0 != strcmp(uri->authority, ""))) {
       gpr_log(GPR_ERROR, "authority based dns uri's not supported");
-      return OrphanablePtr<Resolver>(nullptr);
+      return false;
     }
+    return true;
+  }
+
+  OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
+    if (!IsValidUri(args.uri)) return nullptr;
     return OrphanablePtr<Resolver>(New<NativeDnsResolver>(std::move(args)));
   }
 
index 7f613ee..443a709 100644 (file)
@@ -32,7 +32,6 @@
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/ext/filters/client_channel/server_address.h"
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/closure.h"
@@ -61,7 +60,13 @@ class FakeResolver : public Resolver {
 
   virtual ~FakeResolver();
 
-  void ShutdownLocked() override { active_ = false; }
+  void ShutdownLocked() override {
+    shutdown_ = true;
+    if (response_generator_ != nullptr) {
+      response_generator_->SetFakeResolver(nullptr);
+      response_generator_.reset();
+    }
+  }
 
   void MaybeSendResultLocked();
 
@@ -69,6 +74,7 @@ class FakeResolver : public Resolver {
 
   // passed-in parameters
   grpc_channel_args* channel_args_ = nullptr;
+  RefCountedPtr<FakeResolverResponseGenerator> response_generator_;
   // If has_next_result_ is true, next_result_ is the next resolution result
   // to be returned.
   bool has_next_result_ = false;
@@ -77,8 +83,10 @@ class FakeResolver : public Resolver {
   // RequestReresolutionLocked().
   bool has_reresolution_result_ = false;
   Result reresolution_result_;
-  // True between the calls to StartLocked() ShutdownLocked().
-  bool active_ = false;
+  // True after the call to StartLocked().
+  bool started_ = false;
+  // True after the call to ShutdownLocked().
+  bool shutdown_ = false;
   // if true, return failure
   bool return_failure_ = false;
   // pending re-resolution
@@ -87,25 +95,27 @@ class FakeResolver : public Resolver {
 };
 
 FakeResolver::FakeResolver(ResolverArgs args)
-    : Resolver(args.combiner, std::move(args.result_handler)) {
+    : Resolver(args.combiner, std::move(args.result_handler)),
+      response_generator_(
+          FakeResolverResponseGenerator::GetFromArgs(args.args)) {
   GRPC_CLOSURE_INIT(&reresolution_closure_, ReturnReresolutionResult, this,
                     grpc_combiner_scheduler(combiner()));
-  channel_args_ = grpc_channel_args_copy(args.args);
-  FakeResolverResponseGenerator* response_generator =
-      FakeResolverResponseGenerator::GetFromArgs(args.args);
-  if (response_generator != nullptr) {
-    response_generator->resolver_ = this;
-    if (response_generator->has_result_) {
-      response_generator->SetResponse(std::move(response_generator->result_));
-      response_generator->has_result_ = false;
-    }
+  // Channels sharing the same subchannels may have different resolver response
+  // generators. If we don't remove this arg, subchannel pool will create new
+  // subchannels for the same address instead of reusing existing ones because
+  // of different values of this channel arg.
+  const char* args_to_remove[] = {GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR};
+  channel_args_ = grpc_channel_args_copy_and_remove(
+      args.args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove));
+  if (response_generator_ != nullptr) {
+    response_generator_->SetFakeResolver(Ref());
   }
 }
 
 FakeResolver::~FakeResolver() { grpc_channel_args_destroy(channel_args_); }
 
 void FakeResolver::StartLocked() {
-  active_ = true;
+  started_ = true;
   MaybeSendResultLocked();
 }
 
@@ -125,7 +135,7 @@ void FakeResolver::RequestReresolutionLocked() {
 }
 
 void FakeResolver::MaybeSendResultLocked() {
-  if (!active_) return;
+  if (!started_ || shutdown_) return;
   if (return_failure_) {
     // TODO(roth): Change resolver result generator to be able to inject
     // the error to be returned.
@@ -160,9 +170,13 @@ void FakeResolver::ReturnReresolutionResult(void* arg, grpc_error* error) {
 // FakeResolverResponseGenerator
 //
 
+FakeResolverResponseGenerator::FakeResolverResponseGenerator() {}
+
+FakeResolverResponseGenerator::~FakeResolverResponseGenerator() {}
+
 struct SetResponseClosureArg {
   grpc_closure set_response_closure;
-  FakeResolverResponseGenerator* generator;
+  RefCountedPtr<FakeResolver> resolver;
   Resolver::Result result;
   bool has_result = false;
   bool immediate = true;
@@ -171,98 +185,146 @@ struct SetResponseClosureArg {
 void FakeResolverResponseGenerator::SetResponseLocked(void* arg,
                                                       grpc_error* error) {
   SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
-  FakeResolver* resolver = closure_arg->generator->resolver_;
-  resolver->next_result_ = std::move(closure_arg->result);
-  resolver->has_next_result_ = true;
-  resolver->MaybeSendResultLocked();
-  closure_arg->generator->Unref();
+  auto& resolver = closure_arg->resolver;
+  if (!resolver->shutdown_) {
+    resolver->next_result_ = std::move(closure_arg->result);
+    resolver->has_next_result_ = true;
+    resolver->MaybeSendResultLocked();
+  }
   Delete(closure_arg);
 }
 
 void FakeResolverResponseGenerator::SetResponse(Resolver::Result result) {
-  if (resolver_ != nullptr) {
-    Ref().release();  // ref to be held by closure
-    SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
-    closure_arg->generator = this;
-    closure_arg->result = std::move(result);
-    GRPC_CLOSURE_SCHED(
-        GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetResponseLocked,
-                          closure_arg,
-                          grpc_combiner_scheduler(resolver_->combiner())),
-        GRPC_ERROR_NONE);
-  } else {
-    GPR_ASSERT(!has_result_);
-    has_result_ = true;
-    result_ = std::move(result);
+  RefCountedPtr<FakeResolver> resolver;
+  {
+    MutexLock lock(&mu_);
+    if (resolver_ == nullptr) {
+      has_result_ = true;
+      result_ = std::move(result);
+      return;
+    }
+    resolver = resolver_->Ref();
   }
+  SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
+  closure_arg->resolver = std::move(resolver);
+  closure_arg->result = std::move(result);
+  GRPC_CLOSURE_SCHED(
+      GRPC_CLOSURE_INIT(
+          &closure_arg->set_response_closure, SetResponseLocked, closure_arg,
+          grpc_combiner_scheduler(closure_arg->resolver->combiner())),
+      GRPC_ERROR_NONE);
 }
 
 void FakeResolverResponseGenerator::SetReresolutionResponseLocked(
     void* arg, grpc_error* error) {
   SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
-  FakeResolver* resolver = closure_arg->generator->resolver_;
-  resolver->reresolution_result_ = std::move(closure_arg->result);
-  resolver->has_reresolution_result_ = closure_arg->has_result;
+  auto& resolver = closure_arg->resolver;
+  if (!resolver->shutdown_) {
+    resolver->reresolution_result_ = std::move(closure_arg->result);
+    resolver->has_reresolution_result_ = closure_arg->has_result;
+  }
   Delete(closure_arg);
 }
 
 void FakeResolverResponseGenerator::SetReresolutionResponse(
     Resolver::Result result) {
-  GPR_ASSERT(resolver_ != nullptr);
+  RefCountedPtr<FakeResolver> resolver;
+  {
+    MutexLock lock(&mu_);
+    GPR_ASSERT(resolver_ != nullptr);
+    resolver = resolver_->Ref();
+  }
   SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
-  closure_arg->generator = this;
+  closure_arg->resolver = std::move(resolver);
   closure_arg->result = std::move(result);
   closure_arg->has_result = true;
   GRPC_CLOSURE_SCHED(
-      GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
-                        SetReresolutionResponseLocked, closure_arg,
-                        grpc_combiner_scheduler(resolver_->combiner())),
+      GRPC_CLOSURE_INIT(
+          &closure_arg->set_response_closure, SetReresolutionResponseLocked,
+          closure_arg,
+          grpc_combiner_scheduler(closure_arg->resolver->combiner())),
       GRPC_ERROR_NONE);
 }
 
 void FakeResolverResponseGenerator::UnsetReresolutionResponse() {
-  GPR_ASSERT(resolver_ != nullptr);
+  RefCountedPtr<FakeResolver> resolver;
+  {
+    MutexLock lock(&mu_);
+    GPR_ASSERT(resolver_ != nullptr);
+    resolver = resolver_->Ref();
+  }
   SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
-  closure_arg->generator = this;
+  closure_arg->resolver = std::move(resolver);
   GRPC_CLOSURE_SCHED(
-      GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
-                        SetReresolutionResponseLocked, closure_arg,
-                        grpc_combiner_scheduler(resolver_->combiner())),
+      GRPC_CLOSURE_INIT(
+          &closure_arg->set_response_closure, SetReresolutionResponseLocked,
+          closure_arg,
+          grpc_combiner_scheduler(closure_arg->resolver->combiner())),
       GRPC_ERROR_NONE);
 }
 
 void FakeResolverResponseGenerator::SetFailureLocked(void* arg,
                                                      grpc_error* error) {
   SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
-  FakeResolver* resolver = closure_arg->generator->resolver_;
-  resolver->return_failure_ = true;
-  if (closure_arg->immediate) resolver->MaybeSendResultLocked();
+  auto& resolver = closure_arg->resolver;
+  if (!resolver->shutdown_) {
+    resolver->return_failure_ = true;
+    if (closure_arg->immediate) resolver->MaybeSendResultLocked();
+  }
   Delete(closure_arg);
 }
 
 void FakeResolverResponseGenerator::SetFailure() {
-  GPR_ASSERT(resolver_ != nullptr);
+  RefCountedPtr<FakeResolver> resolver;
+  {
+    MutexLock lock(&mu_);
+    GPR_ASSERT(resolver_ != nullptr);
+    resolver = resolver_->Ref();
+  }
   SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
-  closure_arg->generator = this;
+  closure_arg->resolver = std::move(resolver);
   GRPC_CLOSURE_SCHED(
-      GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetFailureLocked,
-                        closure_arg,
-                        grpc_combiner_scheduler(resolver_->combiner())),
+      GRPC_CLOSURE_INIT(
+          &closure_arg->set_response_closure, SetFailureLocked, closure_arg,
+          grpc_combiner_scheduler(closure_arg->resolver->combiner())),
       GRPC_ERROR_NONE);
 }
 
 void FakeResolverResponseGenerator::SetFailureOnReresolution() {
-  GPR_ASSERT(resolver_ != nullptr);
+  RefCountedPtr<FakeResolver> resolver;
+  {
+    MutexLock lock(&mu_);
+    GPR_ASSERT(resolver_ != nullptr);
+    resolver = resolver_->Ref();
+  }
   SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
-  closure_arg->generator = this;
+  closure_arg->resolver = std::move(resolver);
   closure_arg->immediate = false;
   GRPC_CLOSURE_SCHED(
-      GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetFailureLocked,
-                        closure_arg,
-                        grpc_combiner_scheduler(resolver_->combiner())),
+      GRPC_CLOSURE_INIT(
+          &closure_arg->set_response_closure, SetFailureLocked, closure_arg,
+          grpc_combiner_scheduler(closure_arg->resolver->combiner())),
       GRPC_ERROR_NONE);
 }
 
+void FakeResolverResponseGenerator::SetFakeResolver(
+    RefCountedPtr<FakeResolver> resolver) {
+  MutexLock lock(&mu_);
+  resolver_ = std::move(resolver);
+  if (resolver_ == nullptr) return;
+  if (has_result_) {
+    SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
+    closure_arg->resolver = resolver_->Ref();
+    closure_arg->result = std::move(result_);
+    GRPC_CLOSURE_SCHED(
+        GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetResponseLocked,
+                          closure_arg,
+                          grpc_combiner_scheduler(resolver_->combiner())),
+        GRPC_ERROR_NONE);
+    has_result_ = false;
+  }
+}
+
 namespace {
 
 static void* response_generator_arg_copy(void* p) {
@@ -300,12 +362,13 @@ grpc_arg FakeResolverResponseGenerator::MakeChannelArg(
   return arg;
 }
 
-FakeResolverResponseGenerator* FakeResolverResponseGenerator::GetFromArgs(
-    const grpc_channel_args* args) {
+RefCountedPtr<FakeResolverResponseGenerator>
+FakeResolverResponseGenerator::GetFromArgs(const grpc_channel_args* args) {
   const grpc_arg* arg =
       grpc_channel_args_find(args, GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR);
   if (arg == nullptr || arg->type != GRPC_ARG_POINTER) return nullptr;
-  return static_cast<FakeResolverResponseGenerator*>(arg->value.pointer.p);
+  return static_cast<FakeResolverResponseGenerator*>(arg->value.pointer.p)
+      ->Ref();
 }
 
 //
@@ -316,6 +379,8 @@ namespace {
 
 class FakeResolverFactory : public ResolverFactory {
  public:
+  bool IsValidUri(const grpc_uri* uri) const override { return true; }
+
   OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
     return OrphanablePtr<Resolver>(New<FakeResolver>(std::move(args)));
   }
index 3b1ea8e..c04c7c3 100644 (file)
@@ -42,7 +42,8 @@ class FakeResolver;
 class FakeResolverResponseGenerator
     : public RefCounted<FakeResolverResponseGenerator> {
  public:
-  FakeResolverResponseGenerator() {}
+  FakeResolverResponseGenerator();
+  ~FakeResolverResponseGenerator();
 
   // Instructs the fake resolver associated with the response generator
   // instance to trigger a new resolution with the specified result. If the
@@ -71,17 +72,21 @@ class FakeResolverResponseGenerator
   static grpc_arg MakeChannelArg(FakeResolverResponseGenerator* generator);
 
   // Returns the response generator in \a args, or null if not found.
-  static FakeResolverResponseGenerator* GetFromArgs(
+  static RefCountedPtr<FakeResolverResponseGenerator> GetFromArgs(
       const grpc_channel_args* args);
 
  private:
   friend class FakeResolver;
+  // Set the corresponding FakeResolver to this generator.
+  void SetFakeResolver(RefCountedPtr<FakeResolver> resolver);
 
   static void SetResponseLocked(void* arg, grpc_error* error);
   static void SetReresolutionResponseLocked(void* arg, grpc_error* error);
   static void SetFailureLocked(void* arg, grpc_error* error);
 
-  FakeResolver* resolver_ = nullptr;  // Do not own.
+  // Mutex protecting the members below.
+  Mutex mu_;
+  RefCountedPtr<FakeResolver> resolver_;
   Resolver::Result result_;
   bool has_result_ = false;
 };
index 1465b0c..532fd6d 100644 (file)
@@ -30,7 +30,6 @@
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/ext/filters/client_channel/server_address.h"
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/resolve_address.h"
@@ -81,24 +80,23 @@ void SockaddrResolver::StartLocked() {
 
 void DoNothing(void* ignored) {}
 
-OrphanablePtr<Resolver> CreateSockaddrResolver(
-    ResolverArgs args,
-    bool parse(const grpc_uri* uri, grpc_resolved_address* dst)) {
-  if (0 != strcmp(args.uri->authority, "")) {
+bool ParseUri(const grpc_uri* uri,
+              bool parse(const grpc_uri* uri, grpc_resolved_address* dst),
+              ServerAddressList* addresses) {
+  if (0 != strcmp(uri->authority, "")) {
     gpr_log(GPR_ERROR, "authority-based URIs not supported by the %s scheme",
-            args.uri->scheme);
-    return nullptr;
+            uri->scheme);
+    return false;
   }
   // Construct addresses.
   grpc_slice path_slice =
-      grpc_slice_new(args.uri->path, strlen(args.uri->path), DoNothing);
+      grpc_slice_new(uri->path, strlen(uri->path), DoNothing);
   grpc_slice_buffer path_parts;
   grpc_slice_buffer_init(&path_parts);
   grpc_slice_split(path_slice, ",", &path_parts);
-  ServerAddressList addresses;
   bool errors_found = false;
   for (size_t i = 0; i < path_parts.count; i++) {
-    grpc_uri ith_uri = *args.uri;
+    grpc_uri ith_uri = *uri;
     UniquePtr<char> part_str(grpc_slice_to_c_string(path_parts.slices[i]));
     ith_uri.path = part_str.get();
     grpc_resolved_address addr;
@@ -106,13 +104,20 @@ OrphanablePtr<Resolver> CreateSockaddrResolver(
       errors_found = true;
       break;
     }
-    addresses.emplace_back(addr, nullptr /* args */);
+    if (addresses != nullptr) {
+      addresses->emplace_back(addr, nullptr /* args */);
+    }
   }
   grpc_slice_buffer_destroy_internal(&path_parts);
   grpc_slice_unref_internal(path_slice);
-  if (errors_found) {
-    return OrphanablePtr<Resolver>(nullptr);
-  }
+  return !errors_found;
+}
+
+OrphanablePtr<Resolver> CreateSockaddrResolver(
+    ResolverArgs args,
+    bool parse(const grpc_uri* uri, grpc_resolved_address* dst)) {
+  ServerAddressList addresses;
+  if (!ParseUri(args.uri, parse, &addresses)) return nullptr;
   // Instantiate resolver.
   return OrphanablePtr<Resolver>(
       New<SockaddrResolver>(std::move(addresses), std::move(args)));
@@ -120,6 +125,10 @@ OrphanablePtr<Resolver> CreateSockaddrResolver(
 
 class IPv4ResolverFactory : public ResolverFactory {
  public:
+  bool IsValidUri(const grpc_uri* uri) const override {
+    return ParseUri(uri, grpc_parse_ipv4, nullptr);
+  }
+
   OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
     return CreateSockaddrResolver(std::move(args), grpc_parse_ipv4);
   }
@@ -129,6 +138,10 @@ class IPv4ResolverFactory : public ResolverFactory {
 
 class IPv6ResolverFactory : public ResolverFactory {
  public:
+  bool IsValidUri(const grpc_uri* uri) const override {
+    return ParseUri(uri, grpc_parse_ipv6, nullptr);
+  }
+
   OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
     return CreateSockaddrResolver(std::move(args), grpc_parse_ipv6);
   }
@@ -139,6 +152,10 @@ class IPv6ResolverFactory : public ResolverFactory {
 #ifdef GRPC_HAVE_UNIX_SOCKET
 class UnixResolverFactory : public ResolverFactory {
  public:
+  bool IsValidUri(const grpc_uri* uri) const override {
+    return ParseUri(uri, grpc_parse_unix, nullptr);
+  }
+
   OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
     return CreateSockaddrResolver(std::move(args), grpc_parse_unix);
   }
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc
new file mode 100644 (file)
index 0000000..8be1b89
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/ext/filters/client_channel/resolver_registry.h"
+
+namespace grpc_core {
+
+namespace {
+
+class XdsResolver : public Resolver {
+ public:
+  explicit XdsResolver(ResolverArgs args)
+      : Resolver(args.combiner, std::move(args.result_handler)),
+        args_(grpc_channel_args_copy(args.args)) {}
+  ~XdsResolver() override { grpc_channel_args_destroy(args_); }
+
+  void StartLocked() override;
+
+  void ShutdownLocked() override{};
+
+ private:
+  const grpc_channel_args* args_;
+};
+
+void XdsResolver::StartLocked() {
+  static const char* service_config =
+      "{\n"
+      "  \"loadBalancingConfig\":[\n"
+      "    { \"xds_experimental\":{} }\n"
+      "  ]\n"
+      "}";
+  Result result;
+  result.args = args_;
+  args_ = nullptr;
+  grpc_error* error = GRPC_ERROR_NONE;
+  result.service_config = ServiceConfig::Create(service_config, &error);
+  result_handler()->ReturnResult(std::move(result));
+}
+
+//
+// Factory
+//
+
+class XdsResolverFactory : public ResolverFactory {
+ public:
+  bool IsValidUri(const grpc_uri* uri) const override {
+    if (GPR_UNLIKELY(0 != strcmp(uri->authority, ""))) {
+      gpr_log(GPR_ERROR, "URI authority not supported");
+      return false;
+    }
+    return true;
+  }
+
+  OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
+    if (!IsValidUri(args.uri)) return nullptr;
+    return OrphanablePtr<Resolver>(New<XdsResolver>(std::move(args)));
+  }
+
+  const char* scheme() const override { return "xds-experimental"; }
+};
+
+}  // namespace
+
+}  // namespace grpc_core
+
+void grpc_resolver_xds_init() {
+  grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+      grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+          grpc_core::New<grpc_core::XdsResolverFactory>()));
+}
+
+void grpc_resolver_xds_shutdown() {}
index 273fd8d..7fed48b 100644 (file)
@@ -47,6 +47,10 @@ struct ResolverArgs {
 
 class ResolverFactory {
  public:
+  /// Returns a bool indicating whether the input uri is valid to create a
+  /// resolver.
+  virtual bool IsValidUri(const grpc_uri* uri) const GRPC_ABSTRACT;
+
   /// Returns a new resolver instance.
   virtual OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const
       GRPC_ABSTRACT;
index 5b00eab..509c4ef 100644 (file)
@@ -132,6 +132,17 @@ ResolverFactory* ResolverRegistry::LookupResolverFactory(const char* scheme) {
   return g_state->LookupResolverFactory(scheme);
 }
 
+bool ResolverRegistry::IsValidTarget(const char* target) {
+  grpc_uri* uri = nullptr;
+  char* canonical_target = nullptr;
+  ResolverFactory* factory =
+      g_state->FindResolverFactory(target, &uri, &canonical_target);
+  bool result = factory == nullptr ? false : factory->IsValidUri(uri);
+  grpc_uri_destroy(uri);
+  gpr_free(canonical_target);
+  return result;
+}
+
 OrphanablePtr<Resolver> ResolverRegistry::CreateResolver(
     const char* target, const grpc_channel_args* args,
     grpc_pollset_set* pollset_set, grpc_combiner* combiner,
index 0eec678..4248a06 100644 (file)
@@ -50,6 +50,9 @@ class ResolverRegistry {
     static void RegisterResolverFactory(UniquePtr<ResolverFactory> factory);
   };
 
+  /// Checks whether the user input \a target is valid to create a resolver.
+  static bool IsValidTarget(const char* target);
+
   /// Creates a resolver given \a target.
   /// First tries to parse \a target as a URI. If this succeeds, tries
   /// to locate a registered resolver factory based on the URI scheme.
index 180b0fc..f4c0f92 100644 (file)
@@ -113,13 +113,6 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper
     return parent_->channel_control_helper()->CreateSubchannel(args);
   }
 
-  grpc_channel* CreateChannel(const char* target,
-                              const grpc_channel_args& args) override {
-    if (parent_->resolver_ == nullptr) return nullptr;  // Shutting down.
-    if (!CalledByCurrentChild() && !CalledByPendingChild()) return nullptr;
-    return parent_->channel_control_helper()->CreateChannel(target, args);
-  }
-
   void UpdateState(grpc_connectivity_state state,
                    UniquePtr<SubchannelPicker> picker) override {
     if (parent_->resolver_ == nullptr) return;  // Shutting down.
@@ -160,6 +153,8 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper
     }
   }
 
+  void AddTraceEvent(TraceSeverity severity, StringView message) override {}
+
   void set_child(LoadBalancingPolicy* child) { child_ = child; }
 
  private:
@@ -183,50 +178,27 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper
 
 ResolvingLoadBalancingPolicy::ResolvingLoadBalancingPolicy(
     Args args, TraceFlag* tracer, UniquePtr<char> target_uri,
-    UniquePtr<char> child_policy_name,
-    RefCountedPtr<LoadBalancingPolicy::Config> child_lb_config,
-    grpc_error** error)
-    : LoadBalancingPolicy(std::move(args)),
-      tracer_(tracer),
-      target_uri_(std::move(target_uri)),
-      child_policy_name_(std::move(child_policy_name)),
-      child_lb_config_(std::move(child_lb_config)) {
-  GPR_ASSERT(child_policy_name_ != nullptr);
-  // Don't fetch service config, since this ctor is for use in nested LB
-  // policies, not at the top level, and we only fetch the service
-  // config at the top level.
-  grpc_arg arg = grpc_channel_arg_integer_create(
-      const_cast<char*>(GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION), 0);
-  grpc_channel_args* new_args =
-      grpc_channel_args_copy_and_add(args.args, &arg, 1);
-  *error = Init(*new_args);
-  grpc_channel_args_destroy(new_args);
-}
-
-ResolvingLoadBalancingPolicy::ResolvingLoadBalancingPolicy(
-    Args args, TraceFlag* tracer, UniquePtr<char> target_uri,
     ProcessResolverResultCallback process_resolver_result,
-    void* process_resolver_result_user_data, grpc_error** error)
+    void* process_resolver_result_user_data)
     : LoadBalancingPolicy(std::move(args)),
       tracer_(tracer),
       target_uri_(std::move(target_uri)),
       process_resolver_result_(process_resolver_result),
       process_resolver_result_user_data_(process_resolver_result_user_data) {
   GPR_ASSERT(process_resolver_result != nullptr);
-  *error = Init(*args.args);
-}
-
-grpc_error* ResolvingLoadBalancingPolicy::Init(const grpc_channel_args& args) {
   resolver_ = ResolverRegistry::CreateResolver(
-      target_uri_.get(), &args, interested_parties(), combiner(),
+      target_uri_.get(), args.args, interested_parties(), combiner(),
       UniquePtr<Resolver::ResultHandler>(New<ResolverResultHandler>(Ref())));
-  if (resolver_ == nullptr) {
-    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("resolver creation failed");
+  // Since the validity of args has been checked when create the channel,
+  // CreateResolver() must return a non-null result.
+  GPR_ASSERT(resolver_ != nullptr);
+  if (GRPC_TRACE_FLAG_ENABLED(*tracer_)) {
+    gpr_log(GPR_INFO, "resolving_lb=%p: starting name resolution", this);
   }
-  // Return our picker to the channel.
   channel_control_helper()->UpdateState(
-      GRPC_CHANNEL_IDLE, UniquePtr<SubchannelPicker>(New<QueuePicker>(Ref())));
-  return GRPC_ERROR_NONE;
+      GRPC_CHANNEL_CONNECTING,
+      UniquePtr<SubchannelPicker>(New<QueuePicker>(Ref())));
+  resolver_->StartLocked();
 }
 
 ResolvingLoadBalancingPolicy::~ResolvingLoadBalancingPolicy() {
@@ -262,10 +234,6 @@ void ResolvingLoadBalancingPolicy::ExitIdleLocked() {
   if (lb_policy_ != nullptr) {
     lb_policy_->ExitIdleLocked();
     if (pending_lb_policy_ != nullptr) pending_lb_policy_->ExitIdleLocked();
-  } else {
-    if (!started_resolving_ && resolver_ != nullptr) {
-      StartResolvingLocked();
-    }
   }
 }
 
@@ -278,18 +246,6 @@ void ResolvingLoadBalancingPolicy::ResetBackoffLocked() {
   if (pending_lb_policy_ != nullptr) pending_lb_policy_->ResetBackoffLocked();
 }
 
-void ResolvingLoadBalancingPolicy::StartResolvingLocked() {
-  if (GRPC_TRACE_FLAG_ENABLED(*tracer_)) {
-    gpr_log(GPR_INFO, "resolving_lb=%p: starting name resolution", this);
-  }
-  GPR_ASSERT(!started_resolving_);
-  started_resolving_ = true;
-  channel_control_helper()->UpdateState(
-      GRPC_CHANNEL_CONNECTING,
-      UniquePtr<SubchannelPicker>(New<QueuePicker>(Ref())));
-  resolver_->StartLocked();
-}
-
 void ResolvingLoadBalancingPolicy::OnResolverError(grpc_error* error) {
   if (resolver_ == nullptr) {
     GRPC_ERROR_UNREF(error);
@@ -472,7 +428,7 @@ void ResolvingLoadBalancingPolicy::ConcatenateAndAddChannelTraceLocked(
     size_t len = 0;
     UniquePtr<char> message(gpr_strvec_flatten(&v, &len));
     channel_control_helper()->AddTraceEvent(ChannelControlHelper::TRACE_INFO,
-                                            message.get());
+                                            StringView(message.get()));
     gpr_strvec_destroy(&v);
   }
 }
index e91ea83..d8447c1 100644 (file)
@@ -51,16 +51,6 @@ namespace grpc_core {
 // child LB policy and config to use.
 class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy {
  public:
-  // If error is set when this returns, then construction failed, and
-  // the caller may not use the new object.
-  ResolvingLoadBalancingPolicy(
-      Args args, TraceFlag* tracer, UniquePtr<char> target_uri,
-      UniquePtr<char> child_policy_name,
-      RefCountedPtr<LoadBalancingPolicy::Config> child_lb_config,
-      grpc_error** error);
-
-  // Private ctor, to be used by client_channel only!
-  //
   // Synchronous callback that takes the resolver result and sets
   // lb_policy_name and lb_policy_config to point to the right data.
   // Returns true if the service config has changed since the last result.
@@ -77,7 +67,7 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy {
   ResolvingLoadBalancingPolicy(
       Args args, TraceFlag* tracer, UniquePtr<char> target_uri,
       ProcessResolverResultCallback process_resolver_result,
-      void* process_resolver_result_user_data, grpc_error** error);
+      void* process_resolver_result_user_data);
 
   virtual const char* name() const override { return "resolving_lb"; }
 
@@ -98,10 +88,8 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy {
 
   ~ResolvingLoadBalancingPolicy();
 
-  grpc_error* Init(const grpc_channel_args& args);
   void ShutdownLocked() override;
 
-  void StartResolvingLocked();
   void OnResolverError(grpc_error* error);
   void CreateOrUpdateLbPolicyLocked(
       const char* lb_policy_name,
@@ -126,7 +114,6 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy {
 
   // Resolver and associated state.
   OrphanablePtr<Resolver> resolver_;
-  bool started_resolving_ = false;
   bool previous_resolution_contained_addresses_ = false;
 
   // Child LB policy.
index fddafcd..9e2fff5 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/gprpp/ref_counted.h"
 
 namespace grpc_core {
@@ -42,9 +43,7 @@ class ServerRetryThrottleData : public RefCounted<ServerRetryThrottleData> {
   intptr_t milli_token_ratio() const { return milli_token_ratio_; }
 
  private:
-  // So Delete() can call our private dtor.
-  template <typename T>
-  friend void grpc_core::Delete(T*);
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
 
   ~ServerRetryThrottleData();
 
index 31c0eda..d46896b 100644 (file)
@@ -20,8 +20,6 @@
 
 #include "src/core/ext/filters/client_channel/server_address.h"
 
-#include <string.h>
-
 namespace grpc_core {
 
 //
@@ -39,7 +37,7 @@ ServerAddress::ServerAddress(const void* address, size_t address_len,
   address_.len = static_cast<socklen_t>(address_len);
 }
 
-bool ServerAddress::operator==(const grpc_core::ServerAddress& other) const {
+bool ServerAddress::operator==(const ServerAddress& other) const {
   return address_.len == other.address_.len &&
          memcmp(address_.addr, other.address_.addr, address_.len) == 0 &&
          grpc_channel_args_compare(args_, other.args_) == 0;
index 1b68a59..acd7135 100644 (file)
@@ -24,7 +24,6 @@
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gprpp/inlined_vector.h"
 #include "src/core/lib/iomgr/resolve_address.h"
-#include "src/core/lib/uri/uri_parser.h"
 
 // Channel arg key for a bool indicating whether an address is a grpclb
 // load balancer (as opposed to a backend).
@@ -68,6 +67,7 @@ class ServerAddress {
   }
   ServerAddress& operator=(ServerAddress&& other) {
     address_ = other.address_;
+    grpc_channel_args_destroy(args_);
     args_ = other.args_;
     other.args_ = nullptr;
     return *this;
index dd16ede..e30d915 100644 (file)
@@ -84,13 +84,11 @@ DebugOnlyTraceFlag grpc_trace_subchannel_refcount(false, "subchannel_refcount");
 
 ConnectedSubchannel::ConnectedSubchannel(
     grpc_channel_stack* channel_stack, const grpc_channel_args* args,
-    RefCountedPtr<channelz::SubchannelNode> channelz_subchannel,
-    intptr_t socket_uuid)
-    : ConnectedSubchannelInterface(&grpc_trace_subchannel_refcount),
+    RefCountedPtr<channelz::SubchannelNode> channelz_subchannel)
+    : RefCounted<ConnectedSubchannel>(&grpc_trace_subchannel_refcount),
       channel_stack_(channel_stack),
       args_(grpc_channel_args_copy(args)),
-      channelz_subchannel_(std::move(channelz_subchannel)),
-      socket_uuid_(socket_uuid) {}
+      channelz_subchannel_(std::move(channelz_subchannel)) {}
 
 ConnectedSubchannel::~ConnectedSubchannel() {
   grpc_channel_args_destroy(args_);
@@ -119,14 +117,38 @@ void ConnectedSubchannel::Ping(grpc_closure* on_initiate,
   elem->filter->start_transport_op(elem, op);
 }
 
-RefCountedPtr<SubchannelCall> ConnectedSubchannel::CreateCall(
-    const CallArgs& args, grpc_error** error) {
+size_t ConnectedSubchannel::GetInitialCallSizeEstimate(
+    size_t parent_data_size) const {
+  size_t allocation_size =
+      GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(SubchannelCall));
+  if (parent_data_size > 0) {
+    allocation_size +=
+        GPR_ROUND_UP_TO_ALIGNMENT_SIZE(channel_stack_->call_stack_size) +
+        parent_data_size;
+  } else {
+    allocation_size += channel_stack_->call_stack_size;
+  }
+  return allocation_size;
+}
+
+//
+// SubchannelCall
+//
+
+RefCountedPtr<SubchannelCall> SubchannelCall::Create(Args args,
+                                                     grpc_error** error) {
   const size_t allocation_size =
-      GetInitialCallSizeEstimate(args.parent_data_size);
-  RefCountedPtr<SubchannelCall> call(
-      new (args.arena->Alloc(allocation_size))
-          SubchannelCall(Ref(DEBUG_LOCATION, "subchannel_call"), args));
-  grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(call.get());
+      args.connected_subchannel->GetInitialCallSizeEstimate(
+          args.parent_data_size);
+  Arena* arena = args.arena;
+  return RefCountedPtr<SubchannelCall>(new (
+      arena->Alloc(allocation_size)) SubchannelCall(std::move(args), error));
+}
+
+SubchannelCall::SubchannelCall(Args args, grpc_error** error)
+    : connected_subchannel_(std::move(args.connected_subchannel)),
+      deadline_(args.deadline) {
+  grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(this);
   const grpc_call_element_args call_args = {
       callstk,           /* call_stack */
       nullptr,           /* server_transport_data */
@@ -137,38 +159,20 @@ RefCountedPtr<SubchannelCall> ConnectedSubchannel::CreateCall(
       args.arena,        /* arena */
       args.call_combiner /* call_combiner */
   };
-  *error = grpc_call_stack_init(channel_stack_, 1, SubchannelCall::Destroy,
-                                call.get(), &call_args);
+  *error = grpc_call_stack_init(connected_subchannel_->channel_stack(), 1,
+                                SubchannelCall::Destroy, this, &call_args);
   if (GPR_UNLIKELY(*error != GRPC_ERROR_NONE)) {
     const char* error_string = grpc_error_string(*error);
     gpr_log(GPR_ERROR, "error: %s", error_string);
-    return call;
+    return;
   }
   grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);
-  if (channelz_subchannel_ != nullptr) {
-    channelz_subchannel_->RecordCallStarted();
+  auto* channelz_node = connected_subchannel_->channelz_subchannel();
+  if (channelz_node != nullptr) {
+    channelz_node->RecordCallStarted();
   }
-  return call;
 }
 
-size_t ConnectedSubchannel::GetInitialCallSizeEstimate(
-    size_t parent_data_size) const {
-  size_t allocation_size =
-      GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(SubchannelCall));
-  if (parent_data_size > 0) {
-    allocation_size +=
-        GPR_ROUND_UP_TO_ALIGNMENT_SIZE(channel_stack_->call_stack_size) +
-        parent_data_size;
-  } else {
-    allocation_size += channel_stack_->call_stack_size;
-  }
-  return allocation_size;
-}
-
-//
-// SubchannelCall
-//
-
 void SubchannelCall::StartTransportStreamOpBatch(
     grpc_transport_stream_op_batch* batch) {
   GPR_TIMER_SCOPE("subchannel_call_process_op", 0);
@@ -344,6 +348,9 @@ class Subchannel::ConnectedSubchannelStateWatcher {
                           self->pending_connectivity_state_));
             }
             c->connected_subchannel_.reset();
+            if (c->channelz_node() != nullptr) {
+              c->channelz_node()->SetChildSocket(nullptr);
+            }
             c->SetConnectivityStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE);
             c->backoff_begun_ = false;
             c->backoff_.Reset();
@@ -378,12 +385,12 @@ class Subchannel::ConnectedSubchannelStateWatcher {
 //
 
 void Subchannel::ConnectivityStateWatcherList::AddWatcherLocked(
-    UniquePtr<ConnectivityStateWatcher> watcher) {
+    OrphanablePtr<ConnectivityStateWatcherInterface> watcher) {
   watchers_.insert(MakePair(watcher.get(), std::move(watcher)));
 }
 
 void Subchannel::ConnectivityStateWatcherList::RemoveWatcherLocked(
-    ConnectivityStateWatcher* watcher) {
+    ConnectivityStateWatcherInterface* watcher) {
   watchers_.erase(watcher);
 }
 
@@ -438,8 +445,9 @@ class Subchannel::HealthWatcherMap::HealthWatcher
 
   grpc_connectivity_state state() const { return state_; }
 
-  void AddWatcherLocked(grpc_connectivity_state initial_state,
-                        UniquePtr<ConnectivityStateWatcher> watcher) {
+  void AddWatcherLocked(
+      grpc_connectivity_state initial_state,
+      OrphanablePtr<ConnectivityStateWatcherInterface> watcher) {
     if (state_ != initial_state) {
       RefCountedPtr<ConnectedSubchannel> connected_subchannel;
       if (state_ == GRPC_CHANNEL_READY) {
@@ -451,7 +459,7 @@ class Subchannel::HealthWatcherMap::HealthWatcher
     watcher_list_.AddWatcherLocked(std::move(watcher));
   }
 
-  void RemoveWatcherLocked(ConnectivityStateWatcher* watcher) {
+  void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher) {
     watcher_list_.RemoveWatcherLocked(watcher);
   }
 
@@ -527,7 +535,7 @@ class Subchannel::HealthWatcherMap::HealthWatcher
 void Subchannel::HealthWatcherMap::AddWatcherLocked(
     Subchannel* subchannel, grpc_connectivity_state initial_state,
     UniquePtr<char> health_check_service_name,
-    UniquePtr<ConnectivityStateWatcher> watcher) {
+    OrphanablePtr<ConnectivityStateWatcherInterface> watcher) {
   // If the health check service name is not already present in the map,
   // add it.
   auto it = map_.find(health_check_service_name.get());
@@ -546,7 +554,8 @@ void Subchannel::HealthWatcherMap::AddWatcherLocked(
 }
 
 void Subchannel::HealthWatcherMap::RemoveWatcherLocked(
-    const char* health_check_service_name, ConnectivityStateWatcher* watcher) {
+    const char* health_check_service_name,
+    ConnectivityStateWatcherInterface* watcher) {
   auto it = map_.find(health_check_service_name);
   GPR_ASSERT(it != map_.end());
   it->second->RemoveWatcherLocked(watcher);
@@ -676,7 +685,7 @@ Subchannel::Subchannel(SubchannelKey* key, grpc_connector* connector,
       (size_t)grpc_channel_arg_get_integer(arg, options);
   if (channelz_enabled) {
     channelz_node_ = MakeRefCounted<channelz::SubchannelNode>(
-        this, channel_tracer_max_memory);
+        GetTargetAddress(), channel_tracer_max_memory);
     channelz_node_->AddTraceEvent(
         channelz::ChannelTrace::Severity::Info,
         grpc_slice_from_static_string("subchannel created"));
@@ -688,7 +697,7 @@ Subchannel::~Subchannel() {
     channelz_node_->AddTraceEvent(
         channelz::ChannelTrace::Severity::Info,
         grpc_slice_from_static_string("Subchannel destroyed"));
-    channelz_node_->MarkSubchannelDestroyed();
+    channelz_node_->UpdateConnectivityState(GRPC_CHANNEL_SHUTDOWN);
   }
   grpc_channel_args_destroy(args_);
   grpc_connector_unref(connector_);
@@ -778,14 +787,6 @@ Subchannel* Subchannel::RefFromWeakRef(GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
   }
 }
 
-intptr_t Subchannel::GetChildSocketUuid() {
-  if (connected_subchannel_ != nullptr) {
-    return connected_subchannel_->socket_uuid();
-  } else {
-    return 0;
-  }
-}
-
 const char* Subchannel::GetTargetAddress() {
   const grpc_arg* addr_arg =
       grpc_channel_args_find(args_, GRPC_ARG_SUBCHANNEL_ADDRESS);
@@ -818,7 +819,7 @@ grpc_connectivity_state Subchannel::CheckConnectivityState(
 void Subchannel::WatchConnectivityState(
     grpc_connectivity_state initial_state,
     UniquePtr<char> health_check_service_name,
-    UniquePtr<ConnectivityStateWatcher> watcher) {
+    OrphanablePtr<ConnectivityStateWatcherInterface> watcher) {
   MutexLock lock(&mu_);
   grpc_pollset_set* interested_parties = watcher->interested_parties();
   if (interested_parties != nullptr) {
@@ -837,7 +838,8 @@ void Subchannel::WatchConnectivityState(
 }
 
 void Subchannel::CancelConnectivityStateWatch(
-    const char* health_check_service_name, ConnectivityStateWatcher* watcher) {
+    const char* health_check_service_name,
+    ConnectivityStateWatcherInterface* watcher) {
   MutexLock lock(&mu_);
   grpc_pollset_set* interested_parties = watcher->interested_parties();
   if (interested_parties != nullptr) {
@@ -930,6 +932,7 @@ const char* SubchannelConnectivityStateChangeString(
 void Subchannel::SetConnectivityStateLocked(grpc_connectivity_state state) {
   state_ = state;
   if (channelz_node_ != nullptr) {
+    channelz_node_->UpdateConnectivityState(state);
     channelz_node_->AddTraceEvent(
         channelz::ChannelTrace::Severity::Info,
         grpc_slice_from_static_string(
@@ -1069,8 +1072,9 @@ bool Subchannel::PublishTransportLocked() {
     GRPC_ERROR_UNREF(error);
     return false;
   }
-  intptr_t socket_uuid = connecting_result_.socket_uuid;
-  memset(&connecting_result_, 0, sizeof(connecting_result_));
+  RefCountedPtr<channelz::SocketNode> socket =
+      std::move(connecting_result_.socket);
+  connecting_result_.reset();
   if (disconnected_) {
     grpc_channel_stack_destroy(stk);
     gpr_free(stk);
@@ -1078,9 +1082,12 @@ bool Subchannel::PublishTransportLocked() {
   }
   // Publish.
   connected_subchannel_.reset(
-      New<ConnectedSubchannel>(stk, args_, channelz_node_, socket_uuid));
+      New<ConnectedSubchannel>(stk, args_, channelz_node_));
   gpr_log(GPR_INFO, "New connected subchannel at %p for subchannel %p",
           connected_subchannel_.get(), this);
+  if (channelz_node_ != nullptr) {
+    channelz_node_->SetChildSocket(std::move(socket));
+  }
   // Instantiate state watcher.  Will clean itself up.
   New<ConnectedSubchannelStateWatcher>(this);
   // Report initial state.
index 2f05792..c178401 100644 (file)
 
 #include "src/core/ext/filters/client_channel/client_channel_channelz.h"
 #include "src/core/ext/filters/client_channel/connector.h"
-#include "src/core/ext/filters/client_channel/subchannel_interface.h"
 #include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/gpr/time_precise.h"
 #include "src/core/lib/gprpp/arena.h"
 #include "src/core/lib/gprpp/map.h"
 #include "src/core/lib/gprpp/ref_counted.h"
@@ -70,38 +70,23 @@ namespace grpc_core {
 
 class SubchannelCall;
 
-class ConnectedSubchannel : public ConnectedSubchannelInterface {
+class ConnectedSubchannel : public RefCounted<ConnectedSubchannel> {
  public:
-  struct CallArgs {
-    grpc_polling_entity* pollent;
-    grpc_slice path;
-    gpr_timespec start_time;
-    grpc_millis deadline;
-    Arena* arena;
-    grpc_call_context_element* context;
-    CallCombiner* call_combiner;
-    size_t parent_data_size;
-  };
-
   ConnectedSubchannel(
       grpc_channel_stack* channel_stack, const grpc_channel_args* args,
-      RefCountedPtr<channelz::SubchannelNode> channelz_subchannel,
-      intptr_t socket_uuid);
+      RefCountedPtr<channelz::SubchannelNode> channelz_subchannel);
   ~ConnectedSubchannel();
 
   void NotifyOnStateChange(grpc_pollset_set* interested_parties,
                            grpc_connectivity_state* state,
                            grpc_closure* closure);
   void Ping(grpc_closure* on_initiate, grpc_closure* on_ack);
-  RefCountedPtr<SubchannelCall> CreateCall(const CallArgs& args,
-                                           grpc_error** error);
 
   grpc_channel_stack* channel_stack() const { return channel_stack_; }
-  const grpc_channel_args* args() const override { return args_; }
+  const grpc_channel_args* args() const { return args_; }
   channelz::SubchannelNode* channelz_subchannel() const {
     return channelz_subchannel_.get();
   }
-  intptr_t socket_uuid() const { return socket_uuid_; }
 
   size_t GetInitialCallSizeEstimate(size_t parent_data_size) const;
 
@@ -111,17 +96,23 @@ class ConnectedSubchannel : public ConnectedSubchannelInterface {
   // ref counted pointer to the channelz node in this connected subchannel's
   // owning subchannel.
   RefCountedPtr<channelz::SubchannelNode> channelz_subchannel_;
-  // uuid of this subchannel's socket. 0 if this subchannel is not connected.
-  const intptr_t socket_uuid_;
 };
 
 // Implements the interface of RefCounted<>.
 class SubchannelCall {
  public:
-  SubchannelCall(RefCountedPtr<ConnectedSubchannel> connected_subchannel,
-                 const ConnectedSubchannel::CallArgs& args)
-      : connected_subchannel_(std::move(connected_subchannel)),
-        deadline_(args.deadline) {}
+  struct Args {
+    RefCountedPtr<ConnectedSubchannel> connected_subchannel;
+    grpc_polling_entity* pollent;
+    grpc_slice path;
+    gpr_cycle_counter start_time;
+    grpc_millis deadline;
+    Arena* arena;
+    grpc_call_context_element* context;
+    CallCombiner* call_combiner;
+    size_t parent_data_size;
+  };
+  static RefCountedPtr<SubchannelCall> Create(Args args, grpc_error** error);
 
   // Continues processing a transport stream op batch.
   void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
@@ -154,6 +145,8 @@ class SubchannelCall {
   template <typename T>
   friend class RefCountedPtr;
 
+  SubchannelCall(Args args, grpc_error** error);
+
   // If channelz is enabled, intercepts recv_trailing so that we may check the
   // status and associate it to a subchannel.
   void MaybeInterceptRecvTrailingMetadata(
@@ -176,10 +169,35 @@ class SubchannelCall {
 
 // A subchannel that knows how to connect to exactly one target address. It
 // provides a target for load balancing.
+//
+// Note that this is the "real" subchannel implementation, whose API is
+// different from the SubchannelInterface that is exposed to LB policy
+// implementations.  The client channel provides an adaptor class
+// (SubchannelWrapper) that "converts" between the two.
 class Subchannel {
  public:
-  typedef SubchannelInterface::ConnectivityStateWatcher
-      ConnectivityStateWatcher;
+  class ConnectivityStateWatcherInterface
+      : public InternallyRefCounted<ConnectivityStateWatcherInterface> {
+   public:
+    virtual ~ConnectivityStateWatcherInterface() = default;
+
+    // Will be invoked whenever the subchannel's connectivity state
+    // changes.  There will be only one invocation of this method on a
+    // given watcher instance at any given time.
+    //
+    // When the state changes to READY, connected_subchannel will
+    // contain a ref to the connected subchannel.  When it changes from
+    // READY to some other state, the implementation must release its
+    // ref to the connected subchannel.
+    virtual void OnConnectivityStateChange(
+        grpc_connectivity_state new_state,
+        RefCountedPtr<ConnectedSubchannel> connected_subchannel)  // NOLINT
+        GRPC_ABSTRACT;
+
+    virtual grpc_pollset_set* interested_parties() GRPC_ABSTRACT;
+
+    GRPC_ABSTRACT_BASE_CLASS
+  };
 
   // The ctor and dtor are not intended to use directly.
   Subchannel(SubchannelKey* key, grpc_connector* connector,
@@ -200,12 +218,12 @@ class Subchannel {
   // returns null.
   Subchannel* RefFromWeakRef(GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
 
-  intptr_t GetChildSocketUuid();
-
   // Gets the string representing the subchannel address.
   // Caller doesn't take ownership.
   const char* GetTargetAddress();
 
+  const grpc_channel_args* channel_args() const { return args_; }
+
   channelz::SubchannelNode* channelz_node();
 
   // Returns the current connectivity state of the subchannel.
@@ -225,14 +243,15 @@ class Subchannel {
   // changes.
   // The watcher will be destroyed either when the subchannel is
   // destroyed or when CancelConnectivityStateWatch() is called.
-  void WatchConnectivityState(grpc_connectivity_state initial_state,
-                              UniquePtr<char> health_check_service_name,
-                              UniquePtr<ConnectivityStateWatcher> watcher);
+  void WatchConnectivityState(
+      grpc_connectivity_state initial_state,
+      UniquePtr<char> health_check_service_name,
+      OrphanablePtr<ConnectivityStateWatcherInterface> watcher);
 
   // Cancels a connectivity state watch.
   // If the watcher has already been destroyed, this is a no-op.
   void CancelConnectivityStateWatch(const char* health_check_service_name,
-                                    ConnectivityStateWatcher* watcher);
+                                    ConnectivityStateWatcherInterface* watcher);
 
   // Attempt to connect to the backend.  Has no effect if already connected.
   void AttemptToConnect();
@@ -257,14 +276,15 @@ class Subchannel {
                                                  grpc_resolved_address* addr);
 
  private:
-  // A linked list of ConnectivityStateWatchers that are monitoring the
-  // subchannel's state.
+  // A linked list of ConnectivityStateWatcherInterfaces that are monitoring
+  // the subchannel's state.
   class ConnectivityStateWatcherList {
    public:
     ~ConnectivityStateWatcherList() { Clear(); }
 
-    void AddWatcherLocked(UniquePtr<ConnectivityStateWatcher> watcher);
-    void RemoveWatcherLocked(ConnectivityStateWatcher* watcher);
+    void AddWatcherLocked(
+        OrphanablePtr<ConnectivityStateWatcherInterface> watcher);
+    void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher);
 
     // Notifies all watchers in the list about a change to state.
     void NotifyLocked(Subchannel* subchannel, grpc_connectivity_state state);
@@ -276,12 +296,13 @@ class Subchannel {
    private:
     // TODO(roth): This could be a set instead of a map if we had a set
     // implementation.
-    Map<ConnectivityStateWatcher*, UniquePtr<ConnectivityStateWatcher>>
+    Map<ConnectivityStateWatcherInterface*,
+        OrphanablePtr<ConnectivityStateWatcherInterface>>
         watchers_;
   };
 
-  // A map that tracks ConnectivityStateWatchers using a particular health
-  // check service name.
+  // A map that tracks ConnectivityStateWatcherInterfaces using a particular
+  // health check service name.
   //
   // There is one entry in the map for each health check service name.
   // Entries exist only as long as there are watchers using the
@@ -291,12 +312,12 @@ class Subchannel {
   // state READY.
   class HealthWatcherMap {
    public:
-    void AddWatcherLocked(Subchannel* subchannel,
-                          grpc_connectivity_state initial_state,
-                          UniquePtr<char> health_check_service_name,
-                          UniquePtr<ConnectivityStateWatcher> watcher);
+    void AddWatcherLocked(
+        Subchannel* subchannel, grpc_connectivity_state initial_state,
+        UniquePtr<char> health_check_service_name,
+        OrphanablePtr<ConnectivityStateWatcherInterface> watcher);
     void RemoveWatcherLocked(const char* health_check_service_name,
-                             ConnectivityStateWatcher* watcher);
+                             ConnectivityStateWatcherInterface* watcher);
 
     // Notifies the watcher when the subchannel's state changes.
     void NotifyLocked(grpc_connectivity_state state);
index 10b1bf1..2e448dc 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
-#include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gprpp/ref_counted.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 
 namespace grpc_core {
 
-// TODO(roth): In a subsequent PR, remove this from this API.
-class ConnectedSubchannelInterface
-    : public RefCounted<ConnectedSubchannelInterface> {
- public:
-  virtual const grpc_channel_args* args() const GRPC_ABSTRACT;
-
- protected:
-  template <typename TraceFlagT = TraceFlag>
-  explicit ConnectedSubchannelInterface(TraceFlagT* trace_flag = nullptr)
-      : RefCounted<ConnectedSubchannelInterface>(trace_flag) {}
-};
-
+// The interface for subchannels that is exposed to LB policy implementations.
 class SubchannelInterface : public RefCounted<SubchannelInterface> {
  public:
-  class ConnectivityStateWatcher {
+  class ConnectivityStateWatcherInterface {
    public:
-    virtual ~ConnectivityStateWatcher() = default;
+    virtual ~ConnectivityStateWatcherInterface() = default;
 
     // Will be invoked whenever the subchannel's connectivity state
     // changes.  There will be only one invocation of this method on a
     // given watcher instance at any given time.
-    //
-    // When the state changes to READY, connected_subchannel will
-    // contain a ref to the connected subchannel.  When it changes from
-    // READY to some other state, the implementation must release its
-    // ref to the connected subchannel.
-    virtual void OnConnectivityStateChange(
-        grpc_connectivity_state new_state,
-        RefCountedPtr<ConnectedSubchannelInterface>
-            connected_subchannel)  // NOLINT
+    virtual void OnConnectivityStateChange(grpc_connectivity_state new_state)
         GRPC_ABSTRACT;
 
     // TODO(roth): Remove this as soon as we move to EventManager-based
@@ -66,12 +46,14 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
     GRPC_ABSTRACT_BASE_CLASS
   };
 
+  template <typename TraceFlagT = TraceFlag>
+  explicit SubchannelInterface(TraceFlagT* trace_flag = nullptr)
+      : RefCounted<SubchannelInterface>(trace_flag) {}
+
   virtual ~SubchannelInterface() = default;
 
   // Returns the current connectivity state of the subchannel.
-  virtual grpc_connectivity_state CheckConnectivityState(
-      RefCountedPtr<ConnectedSubchannelInterface>* connected_subchannel)
-      GRPC_ABSTRACT;
+  virtual grpc_connectivity_state CheckConnectivityState() GRPC_ABSTRACT;
 
   // Starts watching the subchannel's connectivity state.
   // The first callback to the watcher will be delivered when the
@@ -86,12 +68,12 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
   // the previous watcher using CancelConnectivityStateWatch().
   virtual void WatchConnectivityState(
       grpc_connectivity_state initial_state,
-      UniquePtr<ConnectivityStateWatcher> watcher) GRPC_ABSTRACT;
+      UniquePtr<ConnectivityStateWatcherInterface> watcher) GRPC_ABSTRACT;
 
   // Cancels a connectivity state watch.
   // If the watcher has already been destroyed, this is a no-op.
-  virtual void CancelConnectivityStateWatch(ConnectivityStateWatcher* watcher)
-      GRPC_ABSTRACT;
+  virtual void CancelConnectivityStateWatch(
+      ConnectivityStateWatcherInterface* watcher) GRPC_ABSTRACT;
 
   // Attempt to connect to the backend.  Has no effect if already connected.
   // If the subchannel is currently in backoff delay due to a previously
@@ -105,6 +87,9 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
   // attempt will be started as soon as AttemptToConnect() is called.
   virtual void ResetBackoff() GRPC_ABSTRACT;
 
+  // TODO(roth): Need a better non-grpc-specific abstraction here.
+  virtual const grpc_channel_args* channel_args() GRPC_ABSTRACT;
+
   GRPC_ABSTRACT_BASE_CLASS
 };
 
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_idle/client_idle_filter.cc b/legacy-libs/grpc/deps/grpc/src/core/ext/filters/client_idle/client_idle_filter.cc
new file mode 100644 (file)
index 0000000..afd6d94
--- /dev/null
@@ -0,0 +1,440 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include <limits.h>
+
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/channel_stack_builder.h"
+#include "src/core/lib/gprpp/atomic.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "src/core/lib/transport/http2_errors.h"
+
+// The idle filter is enabled in client channel by default.
+// Set GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS to [1000, INT_MAX) in channel args to
+// configure the idle timeout.
+#define DEFAULT_IDLE_TIMEOUT_MS (30 /*minutes*/ * 60 * 1000)
+// The user input idle timeout smaller than this would be capped to it.
+#define MIN_IDLE_TIMEOUT_MS (1 /*second*/ * 1000)
+
+namespace grpc_core {
+
+TraceFlag grpc_trace_client_idle_filter(false, "client_idle_filter");
+
+#define GRPC_IDLE_FILTER_LOG(format, ...)                               \
+  do {                                                                  \
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_client_idle_filter)) {       \
+      gpr_log(GPR_INFO, "(client idle filter) " format, ##__VA_ARGS__); \
+    }                                                                   \
+  } while (0)
+
+namespace {
+
+/*
+  client_idle_filter maintains a state tracking if there are active calls in the
+  channel and its internal idle_timer_. The states are specified as following:
+
+  +--------------------------------------------+-------------+---------+
+  |               ChannelState                 | idle_timer_ | channel |
+  +--------------------------------------------+-------------+---------+
+  | IDLE                                       | unset       | idle    |
+  | CALLS_ACTIVE                               | unset       | busy    |
+  | TIMER_PENDING                              | set-valid   | idle    |
+  | TIMER_PENDING_CALLS_ACTIVE                 | set-invalid | busy    |
+  | TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START | set-invalid | idle    |
+  +--------------------------------------------+-------------+---------+
+
+  IDLE: The initial state of the client_idle_filter, indicating the channel is
+  in IDLE.
+
+  CALLS_ACTIVE: The channel has 1 or 1+ active calls and the timer is not set.
+
+  TIMER_PENDING: The state after the timer is set and no calls have arrived
+  after the timer is set. The channel must have 0 active call in this state. If
+  the timer is fired in this state, the channel will go into IDLE state.
+
+  TIMER_PENDING_CALLS_ACTIVE: The state after the timer is set and at least one
+  call has arrived after the timer is set. The channel must have 1 or 1+ active
+  calls in this state. If the timer is fired in this state, we won't reschedule
+  it.
+
+  TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START: The state after the timer is set
+  and at least one call has arrived after the timer is set, BUT the channel
+  currently has 0 active call. If the timer is fired in this state, we will
+  reschedule it according to the finish time of the latest call.
+
+  PROCESSING: The state set to block other threads when the setting thread is
+  doing some work to keep state consistency.
+
+  idle_timer_ will not be cancelled (unless the channel is shutting down).
+  If the timer callback is called when the idle_timer_ is valid (i.e. idle_state
+  is TIMER_PENDING), the channel will enter IDLE, otherwise the channel won't be
+  changed.
+
+  State transitions:
+                                            IDLE
+                                            |  ^
+            ---------------------------------  *
+            |                                  *
+            v                                  *
+      CALLS_ACTIVE =================> TIMER_PENDING
+            ^                               |  ^
+            *  ------------------------------  *
+            *  |                               *
+            *  v                               *
+TIMER_PENDING_CALLS_ACTIVE ===> TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START
+            ^                               |
+            |                               |
+            ---------------------------------
+
+  ---> Triggered by IncreaseCallCount()
+  ===> Triggered by DecreaseCallCount()
+  ***> Triggered by IdleTimerCallback()
+*/
+enum ChannelState {
+  IDLE,
+  CALLS_ACTIVE,
+  TIMER_PENDING,
+  TIMER_PENDING_CALLS_ACTIVE,
+  TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START,
+  PROCESSING
+};
+
+grpc_millis GetClientIdleTimeout(const grpc_channel_args* args) {
+  return GPR_MAX(
+      grpc_channel_arg_get_integer(
+          grpc_channel_args_find(args, GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS),
+          {DEFAULT_IDLE_TIMEOUT_MS, 0, INT_MAX}),
+      MIN_IDLE_TIMEOUT_MS);
+}
+
+class ChannelData {
+ public:
+  static grpc_error* Init(grpc_channel_element* elem,
+                          grpc_channel_element_args* args);
+  static void Destroy(grpc_channel_element* elem);
+
+  static void StartTransportOp(grpc_channel_element* elem,
+                               grpc_transport_op* op);
+
+  void IncreaseCallCount();
+
+  void DecreaseCallCount();
+
+ private:
+  ChannelData(grpc_channel_element* elem, grpc_channel_element_args* args,
+              grpc_error** error);
+  ~ChannelData() = default;
+
+  static void IdleTimerCallback(void* arg, grpc_error* error);
+  static void IdleTransportOpCompleteCallback(void* arg, grpc_error* error);
+
+  void StartIdleTimer();
+
+  void EnterIdle();
+
+  grpc_channel_element* elem_;
+  // The channel stack to which we take refs for pending callbacks.
+  grpc_channel_stack* channel_stack_;
+  // Timeout after the last RPC finishes on the client channel at which the
+  // channel goes back into IDLE state.
+  const grpc_millis client_idle_timeout_;
+
+  // Member data used to track the state of channel.
+  grpc_millis last_idle_time_;
+  Atomic<intptr_t> call_count_{0};
+  Atomic<ChannelState> state_{IDLE};
+
+  // Idle timer and its callback closure.
+  grpc_timer idle_timer_;
+  grpc_closure idle_timer_callback_;
+
+  // The transport op telling the client channel to enter IDLE.
+  grpc_transport_op idle_transport_op_;
+  grpc_closure idle_transport_op_complete_callback_;
+};
+
+grpc_error* ChannelData::Init(grpc_channel_element* elem,
+                              grpc_channel_element_args* args) {
+  grpc_error* error = GRPC_ERROR_NONE;
+  new (elem->channel_data) ChannelData(elem, args, &error);
+  return error;
+}
+
+void ChannelData::Destroy(grpc_channel_element* elem) {
+  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
+  chand->~ChannelData();
+}
+
+void ChannelData::StartTransportOp(grpc_channel_element* elem,
+                                   grpc_transport_op* op) {
+  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
+  // Catch the disconnect_with_error transport op.
+  if (op->disconnect_with_error != nullptr) {
+    // IncreaseCallCount() introduces a dummy call and prevent the timer from
+    // being reset by other threads.
+    chand->IncreaseCallCount();
+    // If the timer has been set, cancel the timer.
+    // No synchronization issues here. grpc_timer_cancel() is valid as long as
+    // the timer has been init()ed before.
+    grpc_timer_cancel(&chand->idle_timer_);
+  }
+  // Pass the op to the next filter.
+  grpc_channel_next_op(elem, op);
+}
+
+void ChannelData::IncreaseCallCount() {
+  const intptr_t previous_value = call_count_.FetchAdd(1, MemoryOrder::RELAXED);
+  GRPC_IDLE_FILTER_LOG("call counter has increased to %" PRIuPTR,
+                       previous_value + 1);
+  if (previous_value == 0) {
+    // This call is the one that makes the channel busy.
+    // Loop here to make sure the previous decrease operation has finished.
+    ChannelState state = state_.Load(MemoryOrder::RELAXED);
+    while (true) {
+      switch (state) {
+        // Timer has not been set. Switch to CALLS_ACTIVE.
+        case IDLE:
+          // In this case, no other threads will modify the state, so we can
+          // just store the value.
+          state_.Store(CALLS_ACTIVE, MemoryOrder::RELAXED);
+          return;
+        // Timer has been set. Switch to TIMER_PENDING_CALLS_ACTIVE.
+        case TIMER_PENDING:
+        case TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START:
+          // At this point, the state may have been switched to IDLE by the
+          // idle timer callback. Therefore, use CAS operation to change the
+          // state atomically.
+          // Use MemoryOrder::ACQUIRE on success to ensure last_idle_time_ has
+          // been properly set in DecreaseCallCount().
+          if (state_.CompareExchangeWeak(&state, TIMER_PENDING_CALLS_ACTIVE,
+                                         MemoryOrder::ACQUIRE,
+                                         MemoryOrder::RELAXED)) {
+            return;
+          }
+          break;
+        default:
+          // The state has not been switched to desired value yet, try again.
+          state = state_.Load(MemoryOrder::RELAXED);
+          break;
+      }
+    }
+  }
+}
+
+void ChannelData::DecreaseCallCount() {
+  const intptr_t previous_value = call_count_.FetchSub(1, MemoryOrder::RELAXED);
+  GRPC_IDLE_FILTER_LOG("call counter has decreased to %" PRIuPTR,
+                       previous_value - 1);
+  if (previous_value == 1) {
+    // This call is the one that makes the channel idle.
+    // last_idle_time_ does not need to be Atomic<> because busy-loops in
+    // IncreaseCallCount(), DecreaseCallCount() and IdleTimerCallback() will
+    // prevent multiple threads from simultaneously accessing this variable.
+    last_idle_time_ = ExecCtx::Get()->Now();
+    ChannelState state = state_.Load(MemoryOrder::RELAXED);
+    while (true) {
+      switch (state) {
+        // Timer has not been set. Set the timer and switch to TIMER_PENDING
+        case CALLS_ACTIVE:
+          // Release store here to make other threads see the updated value of
+          // last_idle_time_.
+          StartIdleTimer();
+          state_.Store(TIMER_PENDING, MemoryOrder::RELEASE);
+          return;
+        // Timer has been set. Switch to
+        // TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START
+        case TIMER_PENDING_CALLS_ACTIVE:
+          // At this point, the state may have been switched to CALLS_ACTIVE by
+          // the idle timer callback. Therefore, use CAS operation to change the
+          // state atomically.
+          // Release store here to make the idle timer callback see the updated
+          // value of last_idle_time_ to properly reset the idle timer.
+          if (state_.CompareExchangeWeak(
+                  &state, TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START,
+                  MemoryOrder::RELEASE, MemoryOrder::RELAXED)) {
+            return;
+          }
+          break;
+        default:
+          // The state has not been switched to desired value yet, try again.
+          state = state_.Load(MemoryOrder::RELAXED);
+          break;
+      }
+    }
+  }
+}
+
+ChannelData::ChannelData(grpc_channel_element* elem,
+                         grpc_channel_element_args* args, grpc_error** error)
+    : elem_(elem),
+      channel_stack_(args->channel_stack),
+      client_idle_timeout_(GetClientIdleTimeout(args->channel_args)) {
+  // If the idle filter is explicitly disabled in channel args, this ctor should
+  // not get called.
+  GPR_ASSERT(client_idle_timeout_ != GRPC_MILLIS_INF_FUTURE);
+  GRPC_IDLE_FILTER_LOG("created with max_leisure_time = %" PRId64 " ms",
+                       client_idle_timeout_);
+  // Initialize the idle timer without setting it.
+  grpc_timer_init_unset(&idle_timer_);
+  // Initialize the idle timer callback closure.
+  GRPC_CLOSURE_INIT(&idle_timer_callback_, IdleTimerCallback, this,
+                    grpc_schedule_on_exec_ctx);
+  // Initialize the idle transport op complete callback.
+  GRPC_CLOSURE_INIT(&idle_transport_op_complete_callback_,
+                    IdleTransportOpCompleteCallback, this,
+                    grpc_schedule_on_exec_ctx);
+}
+
+void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) {
+  GRPC_IDLE_FILTER_LOG("timer alarms");
+  ChannelData* chand = static_cast<ChannelData*>(arg);
+  if (error != GRPC_ERROR_NONE) {
+    GRPC_IDLE_FILTER_LOG("timer canceled");
+    GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "max idle timer callback");
+    return;
+  }
+  bool finished = false;
+  ChannelState state = chand->state_.Load(MemoryOrder::RELAXED);
+  while (!finished) {
+    switch (state) {
+      case TIMER_PENDING:
+        // Change the state to PROCESSING to block IncreaseCallCout() until the
+        // EnterIdle() operation finishes, preventing mistakenly entering IDLE
+        // when active RPC exists.
+        finished = chand->state_.CompareExchangeWeak(
+            &state, PROCESSING, MemoryOrder::ACQUIRE, MemoryOrder::RELAXED);
+        if (finished) {
+          chand->EnterIdle();
+          chand->state_.Store(IDLE, MemoryOrder::RELAXED);
+        }
+        break;
+      case TIMER_PENDING_CALLS_ACTIVE:
+        finished = chand->state_.CompareExchangeWeak(
+            &state, CALLS_ACTIVE, MemoryOrder::RELAXED, MemoryOrder::RELAXED);
+        break;
+      case TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START:
+        // Change the state to PROCESSING to block IncreaseCallCount() until the
+        // StartIdleTimer() operation finishes, preventing mistakenly restarting
+        // the timer after grpc_timer_cancel() when shutdown.
+        finished = chand->state_.CompareExchangeWeak(
+            &state, PROCESSING, MemoryOrder::ACQUIRE, MemoryOrder::RELAXED);
+        if (finished) {
+          chand->StartIdleTimer();
+          chand->state_.Store(TIMER_PENDING, MemoryOrder::RELAXED);
+        }
+        break;
+      default:
+        // The state has not been switched to desired value yet, try again.
+        state = chand->state_.Load(MemoryOrder::RELAXED);
+        break;
+    }
+  }
+  GRPC_IDLE_FILTER_LOG("timer finishes");
+  GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "max idle timer callback");
+}
+
+void ChannelData::IdleTransportOpCompleteCallback(void* arg,
+                                                  grpc_error* error) {
+  ChannelData* chand = static_cast<ChannelData*>(arg);
+  GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "idle transport op");
+}
+
+void ChannelData::StartIdleTimer() {
+  GRPC_IDLE_FILTER_LOG("timer has started");
+  // Hold a ref to the channel stack for the timer callback.
+  GRPC_CHANNEL_STACK_REF(channel_stack_, "max idle timer callback");
+  grpc_timer_init(&idle_timer_, last_idle_time_ + client_idle_timeout_,
+                  &idle_timer_callback_);
+}
+
+void ChannelData::EnterIdle() {
+  GRPC_IDLE_FILTER_LOG("the channel will enter IDLE");
+  // Hold a ref to the channel stack for the transport op.
+  GRPC_CHANNEL_STACK_REF(channel_stack_, "idle transport op");
+  // Initialize the transport op.
+  idle_transport_op_ = {};
+  idle_transport_op_.disconnect_with_error = grpc_error_set_int(
+      GRPC_ERROR_CREATE_FROM_STATIC_STRING("enter idle"),
+      GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, GRPC_CHANNEL_IDLE);
+  idle_transport_op_.on_consumed = &idle_transport_op_complete_callback_;
+  // Pass the transport op down to the channel stack.
+  grpc_channel_next_op(elem_, &idle_transport_op_);
+}
+
+class CallData {
+ public:
+  static grpc_error* Init(grpc_call_element* elem,
+                          const grpc_call_element_args* args);
+  static void Destroy(grpc_call_element* elem,
+                      const grpc_call_final_info* final_info,
+                      grpc_closure* then_schedule_closure);
+};
+
+grpc_error* CallData::Init(grpc_call_element* elem,
+                           const grpc_call_element_args* args) {
+  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
+  chand->IncreaseCallCount();
+  return GRPC_ERROR_NONE;
+}
+
+void CallData::Destroy(grpc_call_element* elem,
+                       const grpc_call_final_info* final_info,
+                       grpc_closure* ignored) {
+  ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
+  chand->DecreaseCallCount();
+}
+
+const grpc_channel_filter grpc_client_idle_filter = {
+    grpc_call_next_op,
+    ChannelData::StartTransportOp,
+    sizeof(CallData),
+    CallData::Init,
+    grpc_call_stack_ignore_set_pollset_or_pollset_set,
+    CallData::Destroy,
+    sizeof(ChannelData),
+    ChannelData::Init,
+    ChannelData::Destroy,
+    grpc_channel_next_get_info,
+    "client_idle"};
+
+static bool MaybeAddClientIdleFilter(grpc_channel_stack_builder* builder,
+                                     void* arg) {
+  const grpc_channel_args* channel_args =
+      grpc_channel_stack_builder_get_channel_arguments(builder);
+  if (!grpc_channel_args_want_minimal_stack(channel_args) &&
+      GetClientIdleTimeout(channel_args) != INT_MAX) {
+    return grpc_channel_stack_builder_prepend_filter(
+        builder, &grpc_client_idle_filter, nullptr, nullptr);
+  } else {
+    return true;
+  }
+}
+
+}  // namespace
+}  // namespace grpc_core
+
+void grpc_client_idle_filter_init(void) {
+  grpc_channel_init_register_stage(
+      GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
+      grpc_core::MaybeAddClientIdleFilter, nullptr);
+}
+
+void grpc_client_idle_filter_shutdown(void) {}
index 4ef6c1f..b16d26b 100644 (file)
@@ -109,7 +109,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem,
     if (b->idx.named.grpc_status != nullptr ||
         grpc_mdelem_static_value_eq(b->idx.named.status->md,
                                     GRPC_MDELEM_STATUS_200)) {
-      grpc_metadata_batch_remove(b, b->idx.named.status);
+      grpc_metadata_batch_remove(b, GRPC_BATCH_STATUS);
     } else {
       char* val = grpc_dump_slice(GRPC_MDVALUE(b->idx.named.status->md),
                                   GPR_DUMP_ASCII);
@@ -167,7 +167,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem,
         gpr_free(val);
       }
     }
-    grpc_metadata_batch_remove(b, b->idx.named.content_type);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_TYPE);
   }
 
   return GRPC_ERROR_NONE;
@@ -304,7 +304,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem,
   estimated_len += grpc_base64_estimate_encoded_size(
       batch->payload->send_message.send_message->length(), true /* url_safe */,
       false /* multi_line */);
-  grpc_slice path_with_query_slice = GRPC_SLICE_MALLOC(estimated_len);
+  grpc_core::UnmanagedMemorySlice path_with_query_slice(estimated_len);
   /* memcopy individual pieces into this slice */
   char* write_ptr =
       reinterpret_cast<char*> GRPC_SLICE_START_PTR(path_with_query_slice);
@@ -336,7 +336,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem,
 static void remove_if_present(grpc_metadata_batch* batch,
                               grpc_metadata_batch_callouts_index idx) {
   if (batch->idx.array[idx] != nullptr) {
-    grpc_metadata_batch_remove(batch, batch->idx.array[idx]);
+    grpc_metadata_batch_remove(batch, idx);
   }
 }
 
@@ -433,23 +433,25 @@ static void hc_start_transport_stream_op_batch(
        layer headers. */
     error = grpc_metadata_batch_add_head(
         batch->payload->send_initial_metadata.send_initial_metadata,
-        &calld->method, method);
+        &calld->method, method, GRPC_BATCH_METHOD);
     if (error != GRPC_ERROR_NONE) goto done;
     error = grpc_metadata_batch_add_head(
         batch->payload->send_initial_metadata.send_initial_metadata,
-        &calld->scheme, channeld->static_scheme);
+        &calld->scheme, channeld->static_scheme, GRPC_BATCH_SCHEME);
     if (error != GRPC_ERROR_NONE) goto done;
     error = grpc_metadata_batch_add_tail(
         batch->payload->send_initial_metadata.send_initial_metadata,
-        &calld->te_trailers, GRPC_MDELEM_TE_TRAILERS);
+        &calld->te_trailers, GRPC_MDELEM_TE_TRAILERS, GRPC_BATCH_TE);
     if (error != GRPC_ERROR_NONE) goto done;
     error = grpc_metadata_batch_add_tail(
         batch->payload->send_initial_metadata.send_initial_metadata,
-        &calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC);
+        &calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
+        GRPC_BATCH_CONTENT_TYPE);
     if (error != GRPC_ERROR_NONE) goto done;
     error = grpc_metadata_batch_add_tail(
         batch->payload->send_initial_metadata.send_initial_metadata,
-        &calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent));
+        &calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent),
+        GRPC_BATCH_USER_AGENT);
     if (error != GRPC_ERROR_NONE) goto done;
   }
 
@@ -514,13 +516,12 @@ static size_t max_payload_size_from_args(const grpc_channel_args* args) {
   return kMaxPayloadSizeForGet;
 }
 
-static grpc_slice user_agent_from_args(const grpc_channel_args* args,
-                                       const char* transport_name) {
+static grpc_core::ManagedMemorySlice user_agent_from_args(
+    const grpc_channel_args* args, const char* transport_name) {
   gpr_strvec v;
   size_t i;
   int is_first = 1;
   char* tmp;
-  grpc_slice result;
 
   gpr_strvec_init(&v);
 
@@ -558,7 +559,7 @@ static grpc_slice user_agent_from_args(const grpc_channel_args* args,
 
   tmp = gpr_strvec_flatten(&v, nullptr);
   gpr_strvec_destroy(&v);
-  result = grpc_slice_intern(grpc_slice_from_static_string(tmp));
+  grpc_core::ManagedMemorySlice result(tmp);
   gpr_free(tmp);
 
   return result;
index 85b30bc..dc8beb9 100644 (file)
@@ -44,7 +44,7 @@ struct call_data {
 };
 
 struct channel_data {
-  grpc_slice default_authority;
+  grpc_core::ManagedMemorySlice default_authority;
   grpc_mdelem default_authority_mdelem;
 };
 
@@ -60,7 +60,7 @@ void authority_start_transport_stream_op_batch(
       initial_metadata->idx.named.authority == nullptr) {
     grpc_error* error = grpc_metadata_batch_add_head(
         initial_metadata, &calld->authority_storage,
-        GRPC_MDELEM_REF(chand->default_authority_mdelem));
+        GRPC_MDELEM_REF(chand->default_authority_mdelem), GRPC_BATCH_AUTHORITY);
     if (error != GRPC_ERROR_NONE) {
       grpc_transport_stream_op_batch_finish_with_failure(batch, error,
                                                          calld->call_combiner);
@@ -102,7 +102,7 @@ grpc_error* init_channel_elem(grpc_channel_element* elem,
         "GRPC_ARG_DEFAULT_AUTHORITY channel arg. must be a string");
   }
   chand->default_authority =
-      grpc_slice_intern(grpc_slice_from_static_string(default_authority_str));
+      grpc_core::ManagedMemorySlice(default_authority_str);
   chand->default_authority_mdelem = grpc_mdelem_create(
       GRPC_MDSTR_AUTHORITY, chand->default_authority, nullptr);
   GPR_ASSERT(!args->is_last);
index d2b1f67..9ef8e6a 100644 (file)
@@ -45,46 +45,58 @@ static void send_message_on_complete(void* arg, grpc_error* error);
 static void on_send_message_next_done(void* arg, grpc_error* error);
 
 namespace {
-enum initial_metadata_state {
-  // Initial metadata not yet seen.
-  INITIAL_METADATA_UNSEEN = 0,
-  // Initial metadata seen; compression algorithm set.
-  HAS_COMPRESSION_ALGORITHM,
-  // Initial metadata seen; no compression algorithm set.
-  NO_COMPRESSION_ALGORITHM,
+
+struct channel_data {
+  /** The default, channel-level, compression algorithm */
+  grpc_compression_algorithm default_compression_algorithm;
+  /** Bitset of enabled compression algorithms */
+  uint32_t enabled_compression_algorithms_bitset;
+  /** Bitset of enabled message compression algorithms */
+  uint32_t enabled_message_compression_algorithms_bitset;
+  /** Bitset of enabled stream compression algorithms */
+  uint32_t enabled_stream_compression_algorithms_bitset;
 };
 
 struct call_data {
   call_data(grpc_call_element* elem, const grpc_call_element_args& args)
       : call_combiner(args.call_combiner) {
+    channel_data* channeld = static_cast<channel_data*>(elem->channel_data);
+    // The call's message compression algorithm is set to channel's default
+    // setting. It can be overridden later by initial metadata.
+    if (GPR_LIKELY(GPR_BITGET(channeld->enabled_compression_algorithms_bitset,
+                              channeld->default_compression_algorithm))) {
+      message_compression_algorithm =
+          grpc_compression_algorithm_to_message_compression_algorithm(
+              channeld->default_compression_algorithm);
+    }
     GRPC_CLOSURE_INIT(&start_send_message_batch_in_call_combiner,
                       start_send_message_batch, elem,
                       grpc_schedule_on_exec_ctx);
-    grpc_slice_buffer_init(&slices);
-    GRPC_CLOSURE_INIT(&send_message_on_complete, ::send_message_on_complete,
-                      elem, grpc_schedule_on_exec_ctx);
-    GRPC_CLOSURE_INIT(&on_send_message_next_done, ::on_send_message_next_done,
-                      elem, grpc_schedule_on_exec_ctx);
   }
 
   ~call_data() {
-    grpc_slice_buffer_destroy_internal(&slices);
+    if (state_initialized) {
+      grpc_slice_buffer_destroy_internal(&slices);
+    }
     GRPC_ERROR_UNREF(cancel_error);
   }
 
   grpc_core::CallCombiner* call_combiner;
-  grpc_linked_mdelem compression_algorithm_storage;
-  grpc_linked_mdelem stream_compression_algorithm_storage;
-  grpc_linked_mdelem accept_encoding_storage;
-  grpc_linked_mdelem accept_stream_encoding_storage;
-  /** Compression algorithm we'll try to use. It may be given by incoming
-   * metadata, or by the channel's default compression settings. */
   grpc_message_compression_algorithm message_compression_algorithm =
       GRPC_MESSAGE_COMPRESS_NONE;
-  initial_metadata_state send_initial_metadata_state = INITIAL_METADATA_UNSEEN;
   grpc_error* cancel_error = GRPC_ERROR_NONE;
-  grpc_closure start_send_message_batch_in_call_combiner;
   grpc_transport_stream_op_batch* send_message_batch = nullptr;
+  bool seen_initial_metadata = false;
+  /* Set to true, if the fields below are initialized. */
+  bool state_initialized = false;
+  grpc_closure start_send_message_batch_in_call_combiner;
+  /* The fields below are only initialized when we compress the payload.
+   * Keep them at the bottom of the struct, so they don't pollute the
+   * cache-lines. */
+  grpc_linked_mdelem message_compression_algorithm_storage;
+  grpc_linked_mdelem stream_compression_algorithm_storage;
+  grpc_linked_mdelem accept_encoding_storage;
+  grpc_linked_mdelem accept_stream_encoding_storage;
   grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */
   grpc_core::ManualConstructor<grpc_core::SliceBufferByteStream>
       replacement_stream;
@@ -93,130 +105,121 @@ struct call_data {
   grpc_closure on_send_message_next_done;
 };
 
-struct channel_data {
-  /** The default, channel-level, compression algorithm */
-  grpc_compression_algorithm default_compression_algorithm;
-  /** Bitset of enabled compression algorithms */
-  uint32_t enabled_algorithms_bitset;
-  /** Supported compression algorithms */
-  uint32_t supported_message_compression_algorithms;
-  /** Supported stream compression algorithms */
-  uint32_t supported_stream_compression_algorithms;
-};
 }  // namespace
 
-static bool skip_compression(grpc_call_element* elem, uint32_t flags,
-                             bool has_compression_algorithm) {
+// Returns true if we should skip message compression for the current message.
+static bool skip_message_compression(grpc_call_element* elem) {
   call_data* calld = static_cast<call_data*>(elem->call_data);
-  channel_data* channeld = static_cast<channel_data*>(elem->channel_data);
-
+  // If the flags of this message indicate that it shouldn't be compressed, we
+  // skip message compression.
+  uint32_t flags =
+      calld->send_message_batch->payload->send_message.send_message->flags();
   if (flags & (GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_INTERNAL_COMPRESS)) {
     return true;
   }
-  if (has_compression_algorithm) {
-    if (calld->message_compression_algorithm == GRPC_MESSAGE_COMPRESS_NONE) {
-      return true;
-    }
-    return false; /* we have an actual call-specific algorithm */
+  // If this call doesn't have any message compression algorithm set, skip
+  // message compression.
+  return calld->message_compression_algorithm == GRPC_MESSAGE_COMPRESS_NONE;
+}
+
+// Determines the compression algorithm from the initial metadata and the
+// channel's default setting.
+static grpc_compression_algorithm find_compression_algorithm(
+    grpc_metadata_batch* initial_metadata, channel_data* channeld) {
+  if (initial_metadata->idx.named.grpc_internal_encoding_request == nullptr) {
+    return channeld->default_compression_algorithm;
+  }
+  grpc_compression_algorithm compression_algorithm;
+  // Parse the compression algorithm from the initial metadata.
+  grpc_mdelem md =
+      initial_metadata->idx.named.grpc_internal_encoding_request->md;
+  GPR_ASSERT(grpc_compression_algorithm_parse(GRPC_MDVALUE(md),
+                                              &compression_algorithm));
+  // Remove this metadata since it's an internal one (i.e., it won't be
+  // transmitted out).
+  grpc_metadata_batch_remove(initial_metadata,
+                             GRPC_BATCH_GRPC_INTERNAL_ENCODING_REQUEST);
+  // Check if that algorithm is enabled. Note that GRPC_COMPRESS_NONE is always
+  // enabled.
+  // TODO(juanlishen): Maybe use channel default or abort() if the algorithm
+  // from the initial metadata is disabled.
+  if (GPR_LIKELY(GPR_BITGET(channeld->enabled_compression_algorithms_bitset,
+                            compression_algorithm))) {
+    return compression_algorithm;
   }
-  /* no per-call compression override */
-  return channeld->default_compression_algorithm == GRPC_COMPRESS_NONE;
+  const char* algorithm_name;
+  GPR_ASSERT(
+      grpc_compression_algorithm_name(compression_algorithm, &algorithm_name));
+  gpr_log(GPR_ERROR,
+          "Invalid compression algorithm from initial metadata: '%s' "
+          "(previously disabled). "
+          "Will not compress.",
+          algorithm_name);
+  return GRPC_COMPRESS_NONE;
+}
+
+static void initialize_state(grpc_call_element* elem, call_data* calld) {
+  GPR_DEBUG_ASSERT(!calld->state_initialized);
+  calld->state_initialized = true;
+  grpc_slice_buffer_init(&calld->slices);
+  GRPC_CLOSURE_INIT(&calld->send_message_on_complete,
+                    ::send_message_on_complete, elem,
+                    grpc_schedule_on_exec_ctx);
+  GRPC_CLOSURE_INIT(&calld->on_send_message_next_done,
+                    ::on_send_message_next_done, elem,
+                    grpc_schedule_on_exec_ctx);
 }
 
-/** Filter initial metadata */
 static grpc_error* process_send_initial_metadata(
-    grpc_call_element* elem, grpc_metadata_batch* initial_metadata,
-    bool* has_compression_algorithm) GRPC_MUST_USE_RESULT;
+    grpc_call_element* elem,
+    grpc_metadata_batch* initial_metadata) GRPC_MUST_USE_RESULT;
 static grpc_error* process_send_initial_metadata(
-    grpc_call_element* elem, grpc_metadata_batch* initial_metadata,
-    bool* has_compression_algorithm) {
+    grpc_call_element* elem, grpc_metadata_batch* initial_metadata) {
   call_data* calld = static_cast<call_data*>(elem->call_data);
   channel_data* channeld = static_cast<channel_data*>(elem->channel_data);
-  *has_compression_algorithm = false;
-  grpc_compression_algorithm compression_algorithm;
+  // Find the compression algorithm.
+  grpc_compression_algorithm compression_algorithm =
+      find_compression_algorithm(initial_metadata, channeld);
+  // Note that at most one of the following algorithms can be set.
+  calld->message_compression_algorithm =
+      grpc_compression_algorithm_to_message_compression_algorithm(
+          compression_algorithm);
   grpc_stream_compression_algorithm stream_compression_algorithm =
-      GRPC_STREAM_COMPRESS_NONE;
-  if (initial_metadata->idx.named.grpc_internal_encoding_request != nullptr) {
-    grpc_mdelem md =
-        initial_metadata->idx.named.grpc_internal_encoding_request->md;
-    if (GPR_UNLIKELY(!grpc_compression_algorithm_parse(
-            GRPC_MDVALUE(md), &compression_algorithm))) {
-      char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
-      gpr_log(GPR_ERROR,
-              "Invalid compression algorithm: '%s' (unknown). Ignoring.", val);
-      gpr_free(val);
-      calld->message_compression_algorithm = GRPC_MESSAGE_COMPRESS_NONE;
-      stream_compression_algorithm = GRPC_STREAM_COMPRESS_NONE;
-    }
-    if (GPR_UNLIKELY(!GPR_BITGET(channeld->enabled_algorithms_bitset,
-                                 compression_algorithm))) {
-      char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
-      gpr_log(GPR_ERROR,
-              "Invalid compression algorithm: '%s' (previously disabled). "
-              "Ignoring.",
-              val);
-      gpr_free(val);
-      calld->message_compression_algorithm = GRPC_MESSAGE_COMPRESS_NONE;
-      stream_compression_algorithm = GRPC_STREAM_COMPRESS_NONE;
-    }
-    *has_compression_algorithm = true;
-    grpc_metadata_batch_remove(
-        initial_metadata,
-        initial_metadata->idx.named.grpc_internal_encoding_request);
-    calld->message_compression_algorithm =
-        grpc_compression_algorithm_to_message_compression_algorithm(
-            compression_algorithm);
-    stream_compression_algorithm =
-        grpc_compression_algorithm_to_stream_compression_algorithm(
-            compression_algorithm);
-  } else {
-    /* If no algorithm was found in the metadata and we aren't
-     * exceptionally skipping compression, fall back to the channel
-     * default */
-    if (channeld->default_compression_algorithm != GRPC_COMPRESS_NONE) {
-      calld->message_compression_algorithm =
-          grpc_compression_algorithm_to_message_compression_algorithm(
-              channeld->default_compression_algorithm);
-      stream_compression_algorithm =
-          grpc_compression_algorithm_to_stream_compression_algorithm(
-              channeld->default_compression_algorithm);
-    }
-    *has_compression_algorithm = true;
-  }
-
+      grpc_compression_algorithm_to_stream_compression_algorithm(
+          compression_algorithm);
+  // Hint compression algorithm.
   grpc_error* error = GRPC_ERROR_NONE;
-  /* hint compression algorithm */
-  if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) {
-    error = grpc_metadata_batch_add_tail(
-        initial_metadata, &calld->stream_compression_algorithm_storage,
-        grpc_stream_compression_encoding_mdelem(stream_compression_algorithm));
-  } else if (calld->message_compression_algorithm !=
-             GRPC_MESSAGE_COMPRESS_NONE) {
+  if (calld->message_compression_algorithm != GRPC_MESSAGE_COMPRESS_NONE) {
+    initialize_state(elem, calld);
     error = grpc_metadata_batch_add_tail(
-        initial_metadata, &calld->compression_algorithm_storage,
+        initial_metadata, &calld->message_compression_algorithm_storage,
         grpc_message_compression_encoding_mdelem(
-            calld->message_compression_algorithm));
+            calld->message_compression_algorithm),
+        GRPC_BATCH_GRPC_ENCODING);
+  } else if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) {
+    initialize_state(elem, calld);
+    error = grpc_metadata_batch_add_tail(
+        initial_metadata, &calld->stream_compression_algorithm_storage,
+        grpc_stream_compression_encoding_mdelem(stream_compression_algorithm),
+        GRPC_BATCH_CONTENT_ENCODING);
   }
-
   if (error != GRPC_ERROR_NONE) return error;
-
-  /* convey supported compression algorithms */
+  // Convey supported compression algorithms.
   error = grpc_metadata_batch_add_tail(
       initial_metadata, &calld->accept_encoding_storage,
       GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(
-          channeld->supported_message_compression_algorithms));
-
+          channeld->enabled_message_compression_algorithms_bitset),
+      GRPC_BATCH_GRPC_ACCEPT_ENCODING);
   if (error != GRPC_ERROR_NONE) return error;
-
-  /* Do not overwrite accept-encoding header if it already presents (e.g. added
-   * by some proxy). */
+  // Do not overwrite accept-encoding header if it already presents (e.g., added
+  // by some proxy).
   if (!initial_metadata->idx.named.accept_encoding) {
     error = grpc_metadata_batch_add_tail(
         initial_metadata, &calld->accept_stream_encoding_storage,
         GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(
-            channeld->supported_stream_compression_algorithms));
+            channeld->enabled_stream_compression_algorithms_bitset),
+        GRPC_BATCH_ACCEPT_ENCODING);
   }
-
   return error;
 }
 
@@ -241,6 +244,8 @@ static void send_message_batch_continue(grpc_call_element* elem) {
 
 static void finish_send_message(grpc_call_element* elem) {
   call_data* calld = static_cast<call_data*>(elem->call_data);
+  GPR_DEBUG_ASSERT(calld->message_compression_algorithm !=
+                   GRPC_MESSAGE_COMPRESS_NONE);
   // Compress the data if appropriate.
   grpc_slice_buffer tmp;
   grpc_slice_buffer_init(&tmp);
@@ -358,12 +363,7 @@ static void on_send_message_next_done(void* arg, grpc_error* error) {
 
 static void start_send_message_batch(void* arg, grpc_error* unused) {
   grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
-  call_data* calld = static_cast<call_data*>(elem->call_data);
-  if (skip_compression(
-          elem,
-          calld->send_message_batch->payload->send_message.send_message
-              ->flags(),
-          calld->send_initial_metadata_state == HAS_COMPRESSION_ALGORITHM)) {
+  if (skip_message_compression(elem)) {
     send_message_batch_continue(elem);
   } else {
     continue_reading_send_message(elem);
@@ -380,7 +380,7 @@ static void compress_start_transport_stream_op_batch(
     calld->cancel_error =
         GRPC_ERROR_REF(batch->payload->cancel_stream.cancel_error);
     if (calld->send_message_batch != nullptr) {
-      if (calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN) {
+      if (!calld->seen_initial_metadata) {
         GRPC_CALL_COMBINER_START(
             calld->call_combiner,
             GRPC_CLOSURE_CREATE(fail_send_message_batch_in_call_combiner, calld,
@@ -398,19 +398,15 @@ static void compress_start_transport_stream_op_batch(
   }
   // Handle send_initial_metadata.
   if (batch->send_initial_metadata) {
-    GPR_ASSERT(calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN);
-    bool has_compression_algorithm;
+    GPR_ASSERT(!calld->seen_initial_metadata);
     grpc_error* error = process_send_initial_metadata(
-        elem, batch->payload->send_initial_metadata.send_initial_metadata,
-        &has_compression_algorithm);
+        elem, batch->payload->send_initial_metadata.send_initial_metadata);
     if (error != GRPC_ERROR_NONE) {
       grpc_transport_stream_op_batch_finish_with_failure(batch, error,
                                                          calld->call_combiner);
       return;
     }
-    calld->send_initial_metadata_state = has_compression_algorithm
-                                             ? HAS_COMPRESSION_ALGORITHM
-                                             : NO_COMPRESSION_ALGORITHM;
+    calld->seen_initial_metadata = true;
     // If we had previously received a batch containing a send_message op,
     // handle it now.  Note that we need to re-enter the call combiner
     // for this, since we can't send two batches down while holding the
@@ -431,7 +427,7 @@ static void compress_start_transport_stream_op_batch(
     // wait.  We save the batch in calld and then drop the call
     // combiner, which we'll have to pick up again later when we get
     // send_initial_metadata.
-    if (calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN) {
+    if (!calld->seen_initial_metadata) {
       GRPC_CALL_COMBINER_STOP(
           calld->call_combiner,
           "send_message batch pending send_initial_metadata");
@@ -463,34 +459,29 @@ static void destroy_call_elem(grpc_call_element* elem,
 static grpc_error* init_channel_elem(grpc_channel_element* elem,
                                      grpc_channel_element_args* args) {
   channel_data* channeld = static_cast<channel_data*>(elem->channel_data);
-
-  channeld->enabled_algorithms_bitset =
+  // Get the enabled and the default algorithms from channel args.
+  channeld->enabled_compression_algorithms_bitset =
       grpc_channel_args_compression_algorithm_get_states(args->channel_args);
   channeld->default_compression_algorithm =
-      grpc_channel_args_get_compression_algorithm(args->channel_args);
-
-  /* Make sure the default isn't disabled. */
-  if (!GPR_BITGET(channeld->enabled_algorithms_bitset,
+      grpc_channel_args_get_channel_default_compression_algorithm(
+          args->channel_args);
+  // Make sure the default is enabled.
+  if (!GPR_BITGET(channeld->enabled_compression_algorithms_bitset,
                   channeld->default_compression_algorithm)) {
-    gpr_log(GPR_DEBUG,
-            "compression algorithm %d not enabled: switching to none",
-            channeld->default_compression_algorithm);
+    const char* name;
+    GPR_ASSERT(grpc_compression_algorithm_name(
+                   channeld->default_compression_algorithm, &name) == 1);
+    gpr_log(GPR_ERROR,
+            "default compression algorithm %s not enabled: switching to none",
+            name);
     channeld->default_compression_algorithm = GRPC_COMPRESS_NONE;
   }
-
-  uint32_t supported_compression_algorithms =
-      (((1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1) &
-       channeld->enabled_algorithms_bitset) |
-      1u;
-
-  channeld->supported_message_compression_algorithms =
+  channeld->enabled_message_compression_algorithms_bitset =
       grpc_compression_bitset_to_message_bitset(
-          supported_compression_algorithms);
-
-  channeld->supported_stream_compression_algorithms =
+          channeld->enabled_compression_algorithms_bitset);
+  channeld->enabled_stream_compression_algorithms_bitset =
       grpc_compression_bitset_to_stream_bitset(
-          supported_compression_algorithms);
-
+          channeld->enabled_compression_algorithms_bitset);
   GPR_ASSERT(!args->is_last);
   return GRPC_ERROR_NONE;
 }
index 028d268..99f6b65 100644 (file)
@@ -124,6 +124,32 @@ static void hs_add_error(const char* error_name, grpc_error** cumulative,
   *cumulative = grpc_error_add_child(*cumulative, new_err);
 }
 
+// Metadata equality within this filter leverages the fact that the sender was
+// likely using the gRPC chttp2 transport, in which case the encoder would emit
+// indexed values, in which case the local hpack parser would intern the
+// relevant metadata, allowing a simple pointer comparison.
+//
+// That said, if the header was transmitted sans indexing/encoding, we still
+// need to do the right thing.
+//
+// Assumptions:
+// 1) The keys for a and b_static must match
+// 2) b_static must be a statically allocated metadata object.
+// 3) It is assumed that the remote end is indexing, but not necessary.
+// TODO(arjunroy): Revisit this method when grpc_mdelem is strongly typed.
+static bool md_strict_equal(grpc_mdelem a, grpc_mdelem b_static) {
+  // Hpack encoder on the remote side should emit indexed values, in which case
+  // hpack parser on this end should pick up interned values, in which case the
+  // pointer comparison alone is enough.
+  //
+  if (GPR_LIKELY(GRPC_MDELEM_IS_INTERNED(a))) {
+    return a.payload == b_static.payload;
+  } else {
+    return grpc_slice_eq_static_interned(GRPC_MDVALUE(a),
+                                         GRPC_MDVALUE(b_static));
+  }
+}
+
 static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
                                                grpc_metadata_batch* b) {
   call_data* calld = static_cast<call_data*>(elem->call_data);
@@ -131,19 +157,18 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
   static const char* error_name = "Failed processing incoming headers";
 
   if (b->idx.named.method != nullptr) {
-    if (grpc_mdelem_static_value_eq(b->idx.named.method->md,
-                                    GRPC_MDELEM_METHOD_POST)) {
+    if (md_strict_equal(b->idx.named.method->md, GRPC_MDELEM_METHOD_POST)) {
       *calld->recv_initial_metadata_flags &=
           ~(GRPC_INITIAL_METADATA_CACHEABLE_REQUEST |
             GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST);
-    } else if (grpc_mdelem_static_value_eq(b->idx.named.method->md,
-                                           GRPC_MDELEM_METHOD_PUT)) {
+    } else if (md_strict_equal(b->idx.named.method->md,
+                               GRPC_MDELEM_METHOD_PUT)) {
       *calld->recv_initial_metadata_flags &=
           ~GRPC_INITIAL_METADATA_CACHEABLE_REQUEST;
       *calld->recv_initial_metadata_flags |=
           GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST;
-    } else if (grpc_mdelem_static_value_eq(b->idx.named.method->md,
-                                           GRPC_MDELEM_METHOD_GET)) {
+    } else if (md_strict_equal(b->idx.named.method->md,
+                               GRPC_MDELEM_METHOD_GET)) {
       *calld->recv_initial_metadata_flags |=
           GRPC_INITIAL_METADATA_CACHEABLE_REQUEST;
       *calld->recv_initial_metadata_flags &=
@@ -154,7 +179,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
                        GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
                        b->idx.named.method->md));
     }
-    grpc_metadata_batch_remove(b, b->idx.named.method);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_METHOD);
   } else {
     hs_add_error(
         error_name, &error,
@@ -171,7 +196,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
                        GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
                        b->idx.named.te->md));
     }
-    grpc_metadata_batch_remove(b, b->idx.named.te);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_TE);
   } else {
     hs_add_error(error_name, &error,
                  grpc_error_set_str(
@@ -180,10 +205,8 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
   }
 
   if (b->idx.named.scheme != nullptr) {
-    if (!grpc_mdelem_static_value_eq(b->idx.named.scheme->md,
-                                     GRPC_MDELEM_SCHEME_HTTP) &&
-        !grpc_mdelem_static_value_eq(b->idx.named.scheme->md,
-                                     GRPC_MDELEM_SCHEME_HTTPS) &&
+    if (!md_strict_equal(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTP) &&
+        !md_strict_equal(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTPS) &&
         !grpc_mdelem_static_value_eq(b->idx.named.scheme->md,
                                      GRPC_MDELEM_SCHEME_GRPC)) {
       hs_add_error(error_name, &error,
@@ -191,7 +214,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
                        GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
                        b->idx.named.scheme->md));
     }
-    grpc_metadata_batch_remove(b, b->idx.named.scheme);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_SCHEME);
   } else {
     hs_add_error(
         error_name, &error,
@@ -227,7 +250,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
         gpr_free(val);
       }
     }
-    grpc_metadata_batch_remove(b, b->idx.named.content_type);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_TYPE);
   }
 
   if (b->idx.named.path == nullptr) {
@@ -282,12 +305,13 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
     grpc_linked_mdelem* el = b->idx.named.host;
     grpc_mdelem md = GRPC_MDELEM_REF(el->md);
     grpc_metadata_batch_remove(b, el);
-    hs_add_error(error_name, &error,
-                 grpc_metadata_batch_add_head(
-                     b, el,
-                     grpc_mdelem_from_slices(
-                         GRPC_MDSTR_AUTHORITY,
-                         grpc_slice_ref_internal(GRPC_MDVALUE(md)))));
+    hs_add_error(
+        error_name, &error,
+        grpc_metadata_batch_add_head(
+            b, el,
+            grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
+                                    grpc_slice_ref_internal(GRPC_MDVALUE(md))),
+            GRPC_BATCH_AUTHORITY));
     GRPC_MDELEM_UNREF(md);
   }
 
@@ -301,7 +325,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
 
   channel_data* chand = static_cast<channel_data*>(elem->channel_data);
   if (!chand->surface_user_agent && b->idx.named.user_agent != nullptr) {
-    grpc_metadata_batch_remove(b, b->idx.named.user_agent);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_USER_AGENT);
   }
 
   return error;
@@ -392,15 +416,17 @@ static grpc_error* hs_mutate_op(grpc_call_element* elem,
   if (op->send_initial_metadata) {
     grpc_error* error = GRPC_ERROR_NONE;
     static const char* error_name = "Failed sending initial metadata";
-    hs_add_error(error_name, &error,
-                 grpc_metadata_batch_add_head(
-                     op->payload->send_initial_metadata.send_initial_metadata,
-                     &calld->status, GRPC_MDELEM_STATUS_200));
+    hs_add_error(
+        error_name, &error,
+        grpc_metadata_batch_add_head(
+            op->payload->send_initial_metadata.send_initial_metadata,
+            &calld->status, GRPC_MDELEM_STATUS_200, GRPC_BATCH_STATUS));
     hs_add_error(error_name, &error,
                  grpc_metadata_batch_add_tail(
                      op->payload->send_initial_metadata.send_initial_metadata,
                      &calld->content_type,
-                     GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC));
+                     GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
+                     GRPC_BATCH_CONTENT_TYPE));
     hs_add_error(
         error_name, &error,
         hs_filter_outgoing_metadata(
index 4eacda7..ed11ff4 100644 (file)
@@ -22,6 +22,7 @@
 #include <grpc/support/port_platform.h>
 
 #include "opencensus/stats/stats.h"
+#include "opencensus/tags/tag_key.h"
 
 #include "src/cpp/server/load_reporter/constants.h"
 
@@ -80,33 +81,33 @@ inline ::opencensus::stats::MeasureDouble MeasureOtherCallMetric() {
 
 // Tags.
 
-inline ::opencensus::stats::TagKey TagKeyToken() {
-  static const ::opencensus::stats::TagKey token =
-      opencensus::stats::TagKey::Register(kTagKeyToken);
+inline ::opencensus::tags::TagKey TagKeyToken() {
+  static const ::opencensus::tags::TagKey token =
+      opencensus::tags::TagKey::Register(kTagKeyToken);
   return token;
 }
 
-inline ::opencensus::stats::TagKey TagKeyHost() {
-  static const ::opencensus::stats::TagKey token =
-      opencensus::stats::TagKey::Register(kTagKeyHost);
+inline ::opencensus::tags::TagKey TagKeyHost() {
+  static const ::opencensus::tags::TagKey token =
+      opencensus::tags::TagKey::Register(kTagKeyHost);
   return token;
 }
 
-inline ::opencensus::stats::TagKey TagKeyUserId() {
-  static const ::opencensus::stats::TagKey token =
-      opencensus::stats::TagKey::Register(kTagKeyUserId);
+inline ::opencensus::tags::TagKey TagKeyUserId() {
+  static const ::opencensus::tags::TagKey token =
+      opencensus::tags::TagKey::Register(kTagKeyUserId);
   return token;
 }
 
-inline ::opencensus::stats::TagKey TagKeyStatus() {
-  static const ::opencensus::stats::TagKey token =
-      opencensus::stats::TagKey::Register(kTagKeyStatus);
+inline ::opencensus::tags::TagKey TagKeyStatus() {
+  static const ::opencensus::tags::TagKey token =
+      opencensus::tags::TagKey::Register(kTagKeyStatus);
   return token;
 }
 
-inline ::opencensus::stats::TagKey TagKeyMetricName() {
-  static const ::opencensus::stats::TagKey token =
-      opencensus::stats::TagKey::Register(kTagKeyMetricName);
+inline ::opencensus::tags::TagKey TagKeyMetricName() {
+  static const ::opencensus::tags::TagKey token =
+      opencensus::tags::TagKey::Register(kTagKeyMetricName);
   return token;
 }
 
index 1d373c5..f48b0f4 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include <string.h>
+
 #include <grpc/grpc_security.h>
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
+#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h"
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/load_reporting/registered_opencensus_objects.h"
 #include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h"
@@ -225,7 +228,8 @@ grpc_filtered_mdelem ServerLoadReportingCallData::RecvInitialMetadataFilter(
       calld->target_host_[i] = static_cast<char>(
           tolower(GRPC_SLICE_START_PTR(target_host_slice)[i]));
     }
-  } else if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_LB_TOKEN)) {
+  } else if (grpc_slice_str_cmp(GRPC_MDKEY(md),
+                                grpc_core::kGrpcLbLbTokenMetadataKey) == 0) {
     if (calld->client_ip_and_lr_token_ == nullptr) {
       calld->StoreClientIpAndLrToken(
           reinterpret_cast<const char*> GRPC_SLICE_START_PTR(GRPC_MDVALUE(md)),
index f230858..96f2f02 100644 (file)
@@ -47,7 +47,7 @@
 
 namespace {
 struct channel_data {
-  /* We take a reference to the channel stack for the timer callback */
+  /* The channel stack to which we take refs for pending callbacks. */
   grpc_channel_stack* channel_stack;
   /* Guards access to max_age_timer, max_age_timer_pending, max_age_grace_timer
      and max_age_grace_timer_pending */
@@ -122,8 +122,8 @@ struct channel_data {
 
      MAX_IDLE_STATE_SEEN_ENTER_IDLE: The state after the timer is set and the at
      least one call has arrived after the timer is set, BUT the channel
-     currently has 1 or 1+ active calls. If the timer is fired in this state, we
-     will reschudle it.
+     currently has 0 active calls. If the timer is fired in this state, we will
+     reschudle it.
 
      max_idle_timer will not be cancelled (unless the channel is shutting down).
      If the timer callback is called when the max_idle_timer is valid (i.e.
index c324c2c..6b6d299 100644 (file)
@@ -111,15 +111,14 @@ static void on_handshake_done(void* arg, grpc_error* error) {
     } else {
       error = GRPC_ERROR_REF(error);
     }
-    memset(c->result, 0, sizeof(*c->result));
+    c->result->reset();
   } else {
     grpc_endpoint_delete_from_pollset_set(args->endpoint,
                                           c->args.interested_parties);
     c->result->transport =
         grpc_create_chttp2_transport(args->args, args->endpoint, true);
-    grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node =
+    c->result->socket =
         grpc_chttp2_transport_get_socket_node(c->result->transport);
-    c->result->socket_uuid = socket_node == nullptr ? 0 : socket_node->uuid();
     GPR_ASSERT(c->result->transport);
     // TODO(roth): We ideally want to wait until we receive HTTP/2
     // settings from the server before we consider the connection
@@ -180,7 +179,7 @@ static void connected(void* arg, grpc_error* error) {
     } else {
       error = GRPC_ERROR_REF(error);
     }
-    memset(c->result, 0, sizeof(*c->result));
+    c->result->reset();
     grpc_closure* notify = c->notify;
     c->notify = nullptr;
     GRPC_CLOSURE_SCHED(notify, error);
index 0d61abd..cbd522d 100644 (file)
@@ -46,27 +46,30 @@ class Chttp2InsecureClientChannelFactory : public ClientChannelFactory {
     grpc_channel_args_destroy(new_args);
     return s;
   }
+};
 
-  grpc_channel* CreateChannel(const char* target,
-                              const grpc_channel_args* args) override {
-    if (target == nullptr) {
-      gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
-      return nullptr;
-    }
-    // Add channel arg containing the server URI.
-    UniquePtr<char> canonical_target =
-        ResolverRegistry::AddDefaultPrefixIfNeeded(target);
-    grpc_arg arg = grpc_channel_arg_string_create(
-        const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
-    const char* to_remove[] = {GRPC_ARG_SERVER_URI};
-    grpc_channel_args* new_args =
-        grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
-    grpc_channel* channel =
-        grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
-    grpc_channel_args_destroy(new_args);
-    return channel;
+namespace {
+
+grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args) {
+  if (target == nullptr) {
+    gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
+    return nullptr;
   }
-};
+  // Add channel arg containing the server URI.
+  UniquePtr<char> canonical_target =
+      ResolverRegistry::AddDefaultPrefixIfNeeded(target);
+  grpc_arg arg = grpc_channel_arg_string_create(
+      const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
+  const char* to_remove[] = {GRPC_ARG_SERVER_URI};
+  grpc_channel_args* new_args =
+      grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
+  grpc_channel* channel =
+      grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
+  grpc_channel_args_destroy(new_args);
+  return channel;
+}
+
+}  // namespace
 
 }  // namespace grpc_core
 
@@ -98,7 +101,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
   grpc_arg arg = grpc_core::ClientChannelFactory::CreateChannelArg(g_factory);
   grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
   // Create channel.
-  grpc_channel* channel = g_factory->CreateChannel(target, new_args);
+  grpc_channel* channel = grpc_core::CreateChannel(target, new_args);
   // Clean up.
   grpc_channel_args_destroy(new_args);
   return channel != nullptr ? channel
index bc38ff2..b18d742 100644 (file)
@@ -58,26 +58,6 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
     return s;
   }
 
-  grpc_channel* CreateChannel(const char* target,
-                              const grpc_channel_args* args) override {
-    if (target == nullptr) {
-      gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
-      return nullptr;
-    }
-    // Add channel arg containing the server URI.
-    UniquePtr<char> canonical_target =
-        ResolverRegistry::AddDefaultPrefixIfNeeded(target);
-    grpc_arg arg = grpc_channel_arg_string_create(
-        const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
-    const char* to_remove[] = {GRPC_ARG_SERVER_URI};
-    grpc_channel_args* new_args =
-        grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
-    grpc_channel* channel =
-        grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
-    grpc_channel_args_destroy(new_args);
-    return channel;
-  }
-
  private:
   static grpc_channel_args* GetSecureNamingChannelArgs(
       const grpc_channel_args* args) {
@@ -170,6 +150,29 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
   }
 };
 
+namespace {
+
+grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args) {
+  if (target == nullptr) {
+    gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
+    return nullptr;
+  }
+  // Add channel arg containing the server URI.
+  UniquePtr<char> canonical_target =
+      ResolverRegistry::AddDefaultPrefixIfNeeded(target);
+  grpc_arg arg = grpc_channel_arg_string_create(
+      const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
+  const char* to_remove[] = {GRPC_ARG_SERVER_URI};
+  grpc_channel_args* new_args =
+      grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
+  grpc_channel* channel =
+      grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
+  grpc_channel_args_destroy(new_args);
+  return channel;
+}
+
+}  // namespace
+
 }  // namespace grpc_core
 
 namespace {
@@ -209,7 +212,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
         args, args_to_add, GPR_ARRAY_SIZE(args_to_add));
     new_args = creds->update_arguments(new_args);
     // Create channel.
-    channel = g_factory->CreateChannel(target, new_args);
+    channel = grpc_core::CreateChannel(target, new_args);
     // Clean up.
     grpc_channel_args_destroy(new_args);
   }
index 8285ee7..c0ae64e 100644 (file)
@@ -37,7 +37,6 @@
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/handshaker.h"
 #include "src/core/lib/channel/handshaker_registry.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/endpoint.h"
 #include "src/core/lib/iomgr/resolve_address.h"
 #include "src/core/lib/iomgr/resource_quota.h"
@@ -267,7 +266,7 @@ static void tcp_server_shutdown_complete(void* arg, grpc_error* error) {
   // may do a synchronous unref.
   grpc_core::ExecCtx::Get()->Flush();
   if (destroy_done != nullptr) {
-    destroy_done->cb(destroy_done->cb_arg, GRPC_ERROR_REF(error));
+    GRPC_CLOSURE_SCHED(destroy_done, GRPC_ERROR_REF(error));
     grpc_core::ExecCtx::Get()->Flush();
   }
   grpc_channel_args_destroy(state->args);
@@ -318,7 +317,7 @@ static grpc_error* chttp2_server_add_acceptor(grpc_server* server,
   *arg_val = grpc_tcp_server_create_fd_handler(tcp_server);
 
   grpc_server_add_listener(server, state, server_start_listener,
-                           server_destroy_listener, /* socket_uuid */ 0);
+                           server_destroy_listener, /* node */ nullptr);
   return err;
 
 /* Error path: cleanup and return */
@@ -346,7 +345,6 @@ grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr,
   grpc_error** errors = nullptr;
   size_t naddrs = 0;
   const grpc_arg* arg = nullptr;
-  intptr_t socket_uuid = 0;
 
   *port_num = -1;
 
@@ -414,15 +412,18 @@ grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr,
 
   arg = grpc_channel_args_find(args, GRPC_ARG_ENABLE_CHANNELZ);
   if (grpc_channel_arg_get_bool(arg, GRPC_ENABLE_CHANNELZ_DEFAULT)) {
+    char* socket_name = nullptr;
+    gpr_asprintf(&socket_name, "chttp2 listener %s", addr);
     state->channelz_listen_socket =
         grpc_core::MakeRefCounted<grpc_core::channelz::ListenSocketNode>(
-            grpc_core::UniquePtr<char>(gpr_strdup(addr)));
-    socket_uuid = state->channelz_listen_socket->uuid();
+            grpc_core::UniquePtr<char>(gpr_strdup(addr)),
+            grpc_core::UniquePtr<char>(socket_name));
   }
 
   /* Register with the server only upon success */
   grpc_server_add_listener(server, state, server_start_listener,
-                           server_destroy_listener, socket_uuid);
+                           server_destroy_listener,
+                           state->channelz_listen_socket);
   goto done;
 
 /* Error path: cleanup and return */
index 01e11ec..5f5c480 100644 (file)
@@ -381,10 +381,13 @@ static bool read_channel_args(grpc_chttp2_transport* t,
   if (channelz_enabled) {
     // TODO(ncteisen): add an API to endpoint to query for local addr, and pass
     // it in here, so SocketNode knows its own address.
+    char* socket_name = nullptr;
+    gpr_asprintf(&socket_name, "%s %s", get_vtable()->name, t->peer_string);
     t->channelz_socket =
         grpc_core::MakeRefCounted<grpc_core::channelz::SocketNode>(
             grpc_core::UniquePtr<char>(),
-            grpc_core::UniquePtr<char>(gpr_strdup(t->peer_string)));
+            grpc_core::UniquePtr<char>(gpr_strdup(t->peer_string)),
+            grpc_core::UniquePtr<char>(socket_name));
   }
   return enable_bdp;
 }
@@ -785,12 +788,6 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
       GRPC_ERROR_NONE);
 }
 
-grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
-                                                      uint32_t id) {
-  return static_cast<grpc_chttp2_stream*>(
-      grpc_chttp2_stream_map_find(&t->stream_map, id));
-}
-
 grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
                                                       uint32_t id) {
   if (t->channel_callback.accept_stream == nullptr) {
@@ -1153,6 +1150,7 @@ static void queue_setting_update(grpc_chttp2_transport* t,
 
 void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
                                      uint32_t goaway_error,
+                                     uint32_t last_stream_id,
                                      const grpc_slice& goaway_text) {
   // Discard the error from a previous goaway frame (if any)
   if (t->goaway_error != GRPC_ERROR_NONE) {
@@ -1166,10 +1164,15 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
           GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE),
       GRPC_ERROR_STR_RAW_BYTES, goaway_text);
 
-  /* We want to log this irrespective of whether http tracing is enabled */
-  gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, goaway_error,
-          grpc_error_string(t->goaway_error));
-
+  GRPC_CHTTP2_IF_TRACING(
+      gpr_log(GPR_INFO, "transport %p got goaway with last stream id %d", t,
+              last_stream_id));
+  /* We want to log this irrespective of whether http tracing is enabled if we
+   * received a GOAWAY with a non NO_ERROR code. */
+  if (goaway_error != GRPC_HTTP2_NO_ERROR) {
+    gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string,
+            goaway_error, grpc_error_string(t->goaway_error));
+  }
   /* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
    * data equal to "too_many_pings", it should log the occurrence at a log level
    * that is enabled by default and double the configured KEEPALIVE_TIME used
@@ -1195,6 +1198,17 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
 
 static void maybe_start_some_streams(grpc_chttp2_transport* t) {
   grpc_chttp2_stream* s;
+  /* cancel out streams that haven't yet started if we have received a GOAWAY */
+  if (t->goaway_error != GRPC_ERROR_NONE) {
+    while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
+      grpc_chttp2_cancel_stream(
+          t, s,
+          grpc_error_set_int(
+              GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"),
+              GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
+    }
+    return;
+  }
   /* start streams where we have free grpc_chttp2_stream ids and free
    * concurrency */
   while (t->next_stream_id <= MAX_CLIENT_STREAM_ID &&
@@ -1204,8 +1218,9 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
          grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
     /* safe since we can't (legally) be parsing this stream yet */
     GRPC_CHTTP2_IF_TRACING(gpr_log(
-        GPR_INFO, "HTTP:%s: Allocating new grpc_chttp2_stream %p to id %d",
-        t->is_client ? "CLI" : "SVR", s, t->next_stream_id));
+        GPR_INFO,
+        "HTTP:%s: Transport %p allocating new grpc_chttp2_stream %p to id %d",
+        t->is_client ? "CLI" : "SVR", t, s, t->next_stream_id));
 
     GPR_ASSERT(s->id == 0);
     s->id = t->next_stream_id;
@@ -1222,13 +1237,14 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
     grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
   }
   /* cancel out streams that will never be started */
-  while (t->next_stream_id >= MAX_CLIENT_STREAM_ID &&
-         grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
-    grpc_chttp2_cancel_stream(
-        t, s,
-        grpc_error_set_int(
-            GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
-            GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
+  if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
+    while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
+      grpc_chttp2_cancel_stream(
+          t, s,
+          grpc_error_set_int(
+              GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
+              GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
+    }
   }
 }
 
@@ -1245,10 +1261,10 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
   return closure;
 }
 
-static void null_then_run_closure(grpc_closure** closure, grpc_error* error) {
+static void null_then_sched_closure(grpc_closure** closure) {
   grpc_closure* c = *closure;
   *closure = nullptr;
-  GRPC_CLOSURE_RUN(c, error);
+  GRPC_CLOSURE_SCHED(c, GRPC_ERROR_NONE);
 }
 
 void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
@@ -1543,19 +1559,13 @@ static void perform_stream_op_locked(void* stream_op,
     on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
     s->fetching_send_message_finished = add_closure_barrier(op->on_complete);
     if (s->write_closed) {
-      // Return an error unless the client has already received trailing
-      // metadata from the server, since an application using a
-      // streaming call might send another message before getting a
-      // recv_message failure, breaking out of its loop, and then
-      // starting recv_trailing_metadata.
+      op->payload->send_message.stream_write_closed = true;
+      // We should NOT return an error here, so as to avoid a cancel OP being
+      // started. The surface layer will notice that the stream has been closed
+      // for writes and fail the send message op.
       op->payload->send_message.send_message.reset();
       grpc_chttp2_complete_closure_step(
-          t, s, &s->fetching_send_message_finished,
-          t->is_client && s->received_trailing_metadata
-              ? GRPC_ERROR_NONE
-              : GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
-                    "Attempt to send message after stream was closed",
-                    &s->write_closed_error, 1),
+          t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE,
           "fetching_send_message_finished");
     } else {
       GPR_ASSERT(s->fetching_send_message == nullptr);
@@ -1915,7 +1925,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
     }
     grpc_chttp2_incoming_metadata_buffer_publish(&s->metadata_buffer[0],
                                                  s->recv_initial_metadata);
-    null_then_run_closure(&s->recv_initial_metadata_ready, GRPC_ERROR_NONE);
+    null_then_sched_closure(&s->recv_initial_metadata_ready);
   }
 }
 
@@ -1995,10 +2005,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
     s->unprocessed_incoming_frames_buffer_cached_length =
         s->unprocessed_incoming_frames_buffer.length;
     if (error == GRPC_ERROR_NONE && *s->recv_message != nullptr) {
-      null_then_run_closure(&s->recv_message_ready, GRPC_ERROR_NONE);
+      null_then_sched_closure(&s->recv_message_ready);
     } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
       *s->recv_message = nullptr;
-      null_then_run_closure(&s->recv_message_ready, GRPC_ERROR_NONE);
+      null_then_sched_closure(&s->recv_message_ready);
     }
     GRPC_ERROR_UNREF(error);
   }
@@ -2024,9 +2034,10 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
        * maybe decompress the next 5 bytes in the stream. */
       if (s->stream_decompression_method ==
           GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
-        grpc_slice_buffer_move_first(&s->frame_storage,
-                                     GRPC_HEADER_SIZE_IN_BYTES,
-                                     &s->unprocessed_incoming_frames_buffer);
+        grpc_slice_buffer_move_first(
+            &s->frame_storage,
+            GPR_MIN(s->frame_storage.length, GRPC_HEADER_SIZE_IN_BYTES),
+            &s->unprocessed_incoming_frames_buffer);
         if (s->unprocessed_incoming_frames_buffer.length > 0) {
           s->unprocessed_incoming_frames_decompressed = true;
           pending_data = true;
@@ -2064,8 +2075,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
       s->collecting_stats = nullptr;
       grpc_chttp2_incoming_metadata_buffer_publish(&s->metadata_buffer[1],
                                                    s->recv_trailing_metadata);
-      null_then_run_closure(&s->recv_trailing_metadata_finished,
-                            GRPC_ERROR_NONE);
+      null_then_sched_closure(&s->recv_trailing_metadata_finished);
     }
   }
 }
@@ -2074,7 +2084,7 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
                           grpc_error* error) {
   grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
       grpc_chttp2_stream_map_delete(&t->stream_map, id));
-  GPR_ASSERT(s);
+  GPR_DEBUG_ASSERT(s);
   if (t->incoming_stream == s) {
     t->incoming_stream = nullptr;
     grpc_chttp2_parsing_become_skip_parser(t);
@@ -2158,7 +2168,7 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
                           &s->metadata_buffer[1],
                           grpc_mdelem_from_slices(
                               GRPC_MDSTR_GRPC_STATUS,
-                              grpc_slice_from_copied_string(status_string))));
+                              grpc_core::UnmanagedMemorySlice(status_string))));
     if (!GRPC_SLICE_IS_EMPTY(slice)) {
       GRPC_LOG_IF_ERROR(
           "add_status_message",
@@ -2455,6 +2465,13 @@ static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) {
 }
 
 static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
+  intptr_t http2_error;
+  // If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
+  if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
+      !grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &http2_error)) {
+    error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
+                               GRPC_STATUS_UNAVAILABLE);
+  }
   cancel_stream_cb_args args = {error, t};
   grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args);
   GRPC_ERROR_UNREF(error);
@@ -2599,7 +2616,6 @@ static void read_action_locked(void* tp, grpc_error* error) {
     t->endpoint_reading = 0;
   } else if (t->closed_with_error == GRPC_ERROR_NONE) {
     keep_reading = true;
-    GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading");
     /* Since we have read a byte, reset the keepalive timer */
     if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
       grpc_timer_cancel(&t->keepalive_ping_timer);
@@ -2618,7 +2634,6 @@ static void read_action_locked(void* tp, grpc_error* error) {
     } else {
       continue_read_action_locked(t);
     }
-    GRPC_CHTTP2_UNREF_TRANSPORT(t, "keep_reading");
   } else {
     GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action");
   }
@@ -2847,7 +2862,8 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
 static void connectivity_state_set(grpc_chttp2_transport* t,
                                    grpc_connectivity_state state,
                                    const char* reason) {
-  GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "set connectivity_state=%d", state));
+  GRPC_CHTTP2_IF_TRACING(
+      gpr_log(GPR_INFO, "transport %p set connectivity_state=%d", t, state));
   grpc_connectivity_state_set(&t->channel_callback.state_tracker, state,
                               reason);
 }
index c22cfb0..39574f9 100644 (file)
@@ -29,6 +29,7 @@
 extern grpc_core::TraceFlag grpc_http_trace;
 extern grpc_core::TraceFlag grpc_trace_http2_stream_state;
 extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount;
+extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser;
 
 extern bool g_flow_control_enabled;
 
index df09809..245e813 100644 (file)
@@ -46,7 +46,9 @@ void ContextList::Execute(void* arg, grpc_core::Timestamps* ts,
   ContextList* to_be_freed;
   while (head != nullptr) {
     if (write_timestamps_callback_g) {
-      ts->byte_offset = static_cast<uint32_t>(head->byte_offset_);
+      if (ts) {
+        ts->byte_offset = static_cast<uint32_t>(head->byte_offset_);
+      }
       write_timestamps_callback_g(head->trace_context_, ts, error);
     }
     to_be_freed = head;
index 74c305b..c50d7e4 100644 (file)
@@ -137,10 +137,10 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
             p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID,
                                           static_cast<intptr_t>(s->id));
             gpr_free(msg);
-            p->error =
-                grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES,
-                                   grpc_dump_slice_to_slice(
-                                       *slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
+            p->error = grpc_error_set_str(
+                p->error, GRPC_ERROR_STR_RAW_BYTES,
+                grpc_slice_from_moved_string(grpc_core::UniquePtr<char>(
+                    grpc_dump_slice(*slice, GPR_DUMP_HEX | GPR_DUMP_ASCII))));
             p->error =
                 grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg);
             p->state = GRPC_CHTTP2_DATA_ERROR;
index e901a6b..6dad349 100644 (file)
@@ -139,7 +139,7 @@ grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
       p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
       if (is_last) {
         grpc_chttp2_add_incoming_goaway(
-            t, p->error_code,
+            t, p->error_code, p->last_stream_id,
             grpc_slice_new(p->debug_data, p->debug_length, gpr_free));
         p->debug_data = nullptr;
       }
index 359ad27..f1291a1 100644 (file)
@@ -88,7 +88,19 @@ typedef struct {
  * with a data frame header */
 static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len,
                         uint8_t flags) {
-  GPR_ASSERT(len < 16777316);
+  /* len is the current frame size (i.e. for the frame we're finishing).
+     We finish a frame if:
+     1) We called ensure_space(), (i.e. add_tiny_header_data()) and adding
+        'need_bytes' to the frame would cause us to exceed st->max_frame_size.
+     2) We called add_header_data, and adding the slice would cause us to exceed
+        st->max_frame_size.
+     3) We're done encoding the header.
+
+     Thus, len is always <= st->max_frame_size.
+     st->max_frame_size is derived from GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
+     which has a max allowable value of 16777215 (see chttp_transport.cc).
+     Thus, the following assert can be a debug assert. */
+  GPR_DEBUG_ASSERT(len < 16777316);
   *p++ = static_cast<uint8_t>(len >> 16);
   *p++ = static_cast<uint8_t>(len >> 8);
   *p++ = static_cast<uint8_t>(len);
@@ -100,6 +112,13 @@ static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len,
   *p++ = static_cast<uint8_t>(id);
 }
 
+static size_t current_frame_size(framer_state* st) {
+  const size_t frame_size =
+      st->output->length - st->output_length_at_start_of_frame;
+  GPR_DEBUG_ASSERT(frame_size <= st->max_frame_size);
+  return frame_size;
+}
+
 /* finish a frame - fill in the previously reserved header */
 static void finish_frame(framer_state* st, int is_header_boundary,
                          int is_last_in_stream) {
@@ -108,7 +127,7 @@ static void finish_frame(framer_state* st, int is_header_boundary,
                             : GRPC_CHTTP2_FRAME_CONTINUATION;
   fill_header(
       GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type,
-      st->stream_id, st->output->length - st->output_length_at_start_of_frame,
+      st->stream_id, current_frame_size(st),
       static_cast<uint8_t>(
           (is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) |
           (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0)));
@@ -130,8 +149,7 @@ static void begin_frame(framer_state* st) {
    space to add at least about_to_add bytes -- finishes the current frame if
    needed */
 static void ensure_space(framer_state* st, size_t need_bytes) {
-  if (st->output->length - st->output_length_at_start_of_frame + need_bytes <=
-      st->max_frame_size) {
+  if (GPR_LIKELY(current_frame_size(st) + need_bytes <= st->max_frame_size)) {
     return;
   }
   finish_frame(st, 0, 0);
@@ -157,8 +175,7 @@ static void add_header_data(framer_state* st, grpc_slice slice) {
   size_t len = GRPC_SLICE_LENGTH(slice);
   size_t remaining;
   if (len == 0) return;
-  remaining = st->max_frame_size + st->output_length_at_start_of_frame -
-              st->output->length;
+  remaining = st->max_frame_size - current_frame_size(st);
   if (len <= remaining) {
     st->stats->header_bytes += len;
     grpc_slice_buffer_add(st->output, slice);
@@ -324,128 +341,129 @@ static void emit_indexed(grpc_chttp2_hpack_compressor* c, uint32_t elem_index,
                            len);
 }
 
-typedef struct {
-  grpc_slice data;
-  uint8_t huffman_prefix;
-  bool insert_null_before_wire_value;
-} wire_value;
+struct wire_value {
+  wire_value(uint8_t huffman_prefix, bool insert_null_before_wire_value,
+             const grpc_slice& slice)
+      : data(slice),
+        huffman_prefix(huffman_prefix),
+        insert_null_before_wire_value(insert_null_before_wire_value),
+        length(GRPC_SLICE_LENGTH(slice) +
+               (insert_null_before_wire_value ? 1 : 0)) {}
+  // While wire_value is const from the POV of hpack encoder code, actually
+  // adding it to a slice buffer will possibly split the slice.
+  const grpc_slice data;
+  const uint8_t huffman_prefix;
+  const bool insert_null_before_wire_value;
+  const size_t length;
+};
 
 template <bool mdkey_definitely_interned>
 static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) {
-  wire_value wire_val;
-  bool is_bin_hdr =
+  const bool is_bin_hdr =
       mdkey_definitely_interned
           ? grpc_is_refcounted_slice_binary_header(GRPC_MDKEY(elem))
           : grpc_is_binary_header_internal(GRPC_MDKEY(elem));
+  const grpc_slice& value = GRPC_MDVALUE(elem);
   if (is_bin_hdr) {
     if (true_binary_enabled) {
       GRPC_STATS_INC_HPACK_SEND_BINARY();
-      wire_val.huffman_prefix = 0x00;
-      wire_val.insert_null_before_wire_value = true;
-      wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem));
-
+      return wire_value(0x00, true, grpc_slice_ref_internal(value));
     } else {
       GRPC_STATS_INC_HPACK_SEND_BINARY_BASE64();
-      wire_val.huffman_prefix = 0x80;
-      wire_val.insert_null_before_wire_value = false;
-      wire_val.data =
-          grpc_chttp2_base64_encode_and_huffman_compress(GRPC_MDVALUE(elem));
+      return wire_value(0x80, false,
+                        grpc_chttp2_base64_encode_and_huffman_compress(value));
     }
   } else {
     /* TODO(ctiller): opportunistically compress non-binary headers */
     GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
-    wire_val.huffman_prefix = 0x00;
-    wire_val.insert_null_before_wire_value = false;
-    wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem));
-  }
-  return wire_val;
-}
-
-static size_t wire_value_length(wire_value v) {
-  return GPR_SLICE_LENGTH(v.data) + v.insert_null_before_wire_value;
-}
-
-static void add_wire_value(framer_state* st, wire_value v) {
-  if (v.insert_null_before_wire_value) *add_tiny_header_data(st, 1) = 0;
-  add_header_data(st, v.data);
-}
-
-static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor* c,
-                               uint32_t key_index, grpc_mdelem elem,
-                               framer_state* st) {
-  GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX();
-  uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2);
-  wire_value value = get_wire_value<true>(elem, st->use_true_binary_metadata);
-  size_t len_val = wire_value_length(value);
-  uint32_t len_val_len;
-  GPR_ASSERT(len_val <= UINT32_MAX);
-  len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1);
-  GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40,
-                           add_tiny_header_data(st, len_pfx), len_pfx);
-  GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix,
-                           add_tiny_header_data(st, len_val_len), len_val_len);
-  add_wire_value(st, value);
-}
-
-static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor* c,
-                              uint32_t key_index, grpc_mdelem elem,
-                              framer_state* st) {
-  GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX();
-  uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4);
-  wire_value value = get_wire_value<false>(elem, st->use_true_binary_metadata);
-  size_t len_val = wire_value_length(value);
-  uint32_t len_val_len;
-  GPR_ASSERT(len_val <= UINT32_MAX);
-  len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1);
-  GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00,
-                           add_tiny_header_data(st, len_pfx), len_pfx);
-  GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix,
-                           add_tiny_header_data(st, len_val_len), len_val_len);
-  add_wire_value(st, value);
-}
-
-static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor* c,
-                                 uint32_t unused_index, grpc_mdelem elem,
-                                 framer_state* st) {
-  GPR_ASSERT(unused_index == 0);
-  GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
-  GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
-  uint32_t len_key = static_cast<uint32_t> GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
-  wire_value value = get_wire_value<true>(elem, st->use_true_binary_metadata);
-  uint32_t len_val = static_cast<uint32_t>(wire_value_length(value));
-  uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
-  uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
-  GPR_ASSERT(len_key <= UINT32_MAX);
-  GPR_ASSERT(wire_value_length(value) <= UINT32_MAX);
-  *add_tiny_header_data(st, 1) = 0x40;
-  GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
-                           add_tiny_header_data(st, len_key_len), len_key_len);
-  add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem)));
-  GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix,
-                           add_tiny_header_data(st, len_val_len), len_val_len);
-  add_wire_value(st, value);
+    return wire_value(0x00, false, grpc_slice_ref_internal(value));
+  }
+}
+
+static uint32_t wire_value_length(const wire_value& v) {
+  GPR_DEBUG_ASSERT(v.length <= UINT32_MAX);
+  return static_cast<uint32_t>(v.length);
 }
 
-static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor* c,
-                                uint32_t unused_index, grpc_mdelem elem,
-                                framer_state* st) {
-  GPR_ASSERT(unused_index == 0);
-  GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
+namespace {
+enum class EmitLitHdrType { INC_IDX, NO_IDX };
+
+enum class EmitLitHdrVType { INC_IDX_V, NO_IDX_V };
+}  // namespace
+
+template <EmitLitHdrType type>
+static void emit_lithdr(grpc_chttp2_hpack_compressor* c, uint32_t key_index,
+                        grpc_mdelem elem, framer_state* st) {
+  switch (type) {
+    case EmitLitHdrType::INC_IDX:
+      GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX();
+      break;
+    case EmitLitHdrType::NO_IDX:
+      GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX();
+      break;
+  }
+  const uint32_t len_pfx = type == EmitLitHdrType::INC_IDX
+                               ? GRPC_CHTTP2_VARINT_LENGTH(key_index, 2)
+                               : GRPC_CHTTP2_VARINT_LENGTH(key_index, 4);
+  const wire_value value =
+      get_wire_value<true>(elem, st->use_true_binary_metadata);
+  const uint32_t len_val = wire_value_length(value);
+  const uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
+  GPR_DEBUG_ASSERT(len_pfx + len_val_len < GRPC_SLICE_INLINED_SIZE);
+  uint8_t* data = add_tiny_header_data(
+      st,
+      len_pfx + len_val_len + (value.insert_null_before_wire_value ? 1 : 0));
+  switch (type) {
+    case EmitLitHdrType::INC_IDX:
+      GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40, data, len_pfx);
+      break;
+    case EmitLitHdrType::NO_IDX:
+      GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00, data, len_pfx);
+      break;
+  }
+  GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, &data[len_pfx],
+                           len_val_len);
+  if (value.insert_null_before_wire_value) {
+    data[len_pfx + len_val_len] = 0;
+  }
+  add_header_data(st, value.data);
+}
+
+template <EmitLitHdrVType type>
+static void emit_lithdr_v(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
+                          framer_state* st) {
+  switch (type) {
+    case EmitLitHdrVType::INC_IDX_V:
+      GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
+      break;
+    case EmitLitHdrVType::NO_IDX_V:
+      GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
+      break;
+  }
   GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
-  uint32_t len_key = static_cast<uint32_t> GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
-  wire_value value = get_wire_value<false>(elem, st->use_true_binary_metadata);
-  uint32_t len_val = static_cast<uint32_t>(wire_value_length(value));
-  uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
-  uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
-  GPR_ASSERT(len_key <= UINT32_MAX);
-  GPR_ASSERT(wire_value_length(value) <= UINT32_MAX);
-  *add_tiny_header_data(st, 1) = 0x00;
-  GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
-                           add_tiny_header_data(st, len_key_len), len_key_len);
+  const uint32_t len_key =
+      static_cast<uint32_t>(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)));
+  const wire_value value =
+      type == EmitLitHdrVType::INC_IDX_V
+          ? get_wire_value<true>(elem, st->use_true_binary_metadata)
+          : get_wire_value<false>(elem, st->use_true_binary_metadata);
+  const uint32_t len_val = wire_value_length(value);
+  const uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
+  const uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
+  GPR_DEBUG_ASSERT(len_key <= UINT32_MAX);
+  GPR_DEBUG_ASSERT(1 + len_key_len < GRPC_SLICE_INLINED_SIZE);
+  uint8_t* key_buf = add_tiny_header_data(st, 1 + len_key_len);
+  key_buf[0] = type == EmitLitHdrVType::INC_IDX_V ? 0x40 : 0x00;
+  GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, &key_buf[1], len_key_len);
   add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem)));
-  GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix,
-                           add_tiny_header_data(st, len_val_len), len_val_len);
-  add_wire_value(st, value);
+  uint8_t* value_buf = add_tiny_header_data(
+      st, len_val_len + (value.insert_null_before_wire_value ? 1 : 0));
+  GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, value_buf,
+                           len_val_len);
+  if (value.insert_null_before_wire_value) {
+    value_buf[len_val_len] = 0;
+  }
+  add_header_data(st, value.data);
 }
 
 static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor* c,
@@ -456,113 +474,142 @@ static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor* c,
   c->advertise_table_size_change = 0;
 }
 
+static void GPR_ATTRIBUTE_NOINLINE hpack_enc_log(grpc_mdelem elem) {
+  char* k = grpc_slice_to_c_string(GRPC_MDKEY(elem));
+  char* v = nullptr;
+  if (grpc_is_binary_header_internal(GRPC_MDKEY(elem))) {
+    v = grpc_dump_slice(GRPC_MDVALUE(elem), GPR_DUMP_HEX);
+  } else {
+    v = grpc_slice_to_c_string(GRPC_MDVALUE(elem));
+  }
+  gpr_log(
+      GPR_INFO,
+      "Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
+      k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem),
+      grpc_slice_is_interned(GRPC_MDKEY(elem)),
+      grpc_slice_is_interned(GRPC_MDVALUE(elem)));
+  gpr_free(k);
+  gpr_free(v);
+}
+
 static uint32_t dynidx(grpc_chttp2_hpack_compressor* c, uint32_t elem_index) {
   return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index +
          c->table_elems - elem_index;
 }
 
+struct EmitIndexedStatus {
+  EmitIndexedStatus() = default;
+  EmitIndexedStatus(uint32_t elem_hash, bool emitted, bool can_add)
+      : elem_hash(elem_hash), emitted(emitted), can_add(can_add) {}
+  const uint32_t elem_hash = 0;
+  const bool emitted = false;
+  const bool can_add = false;
+};
+
+static EmitIndexedStatus maybe_emit_indexed(grpc_chttp2_hpack_compressor* c,
+                                            grpc_mdelem elem,
+                                            framer_state* st) {
+  const uint32_t elem_hash =
+      GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED
+          ? reinterpret_cast<grpc_core::InternedMetadata*>(
+                GRPC_MDELEM_DATA(elem))
+                ->hash()
+          : reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(elem))
+                ->hash();
+
+  inc_filter(HASH_FRAGMENT_1(elem_hash), &c->filter_elems_sum, c->filter_elems);
+
+  /* is this elem currently in the decoders table? */
+  if (grpc_mdelem_both_interned_eq(c->entries_elems[HASH_FRAGMENT_2(elem_hash)],
+                                   elem) &&
+      c->indices_elems[HASH_FRAGMENT_2(elem_hash)] > c->tail_remote_index) {
+    /* HIT: complete element (first cuckoo hash) */
+    emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_2(elem_hash)]),
+                 st);
+    return EmitIndexedStatus(elem_hash, true, false);
+  }
+  if (grpc_mdelem_both_interned_eq(c->entries_elems[HASH_FRAGMENT_3(elem_hash)],
+                                   elem) &&
+      c->indices_elems[HASH_FRAGMENT_3(elem_hash)] > c->tail_remote_index) {
+    /* HIT: complete element (second cuckoo hash) */
+    emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_3(elem_hash)]),
+                 st);
+    return EmitIndexedStatus(elem_hash, true, false);
+  }
+
+  const bool can_add = c->filter_elems[HASH_FRAGMENT_1(elem_hash)] >=
+                       c->filter_elems_sum / ONE_ON_ADD_PROBABILITY;
+  return EmitIndexedStatus(elem_hash, false, can_add);
+}
+
+static void emit_maybe_add(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
+                           framer_state* st, uint32_t indices_key,
+                           bool should_add_elem, size_t decoder_space_usage,
+                           uint32_t elem_hash, uint32_t key_hash) {
+  if (should_add_elem) {
+    emit_lithdr<EmitLitHdrType::INC_IDX>(c, dynidx(c, indices_key), elem, st);
+    add_elem(c, elem, decoder_space_usage, elem_hash, key_hash);
+  } else {
+    emit_lithdr<EmitLitHdrType::NO_IDX>(c, dynidx(c, indices_key), elem, st);
+  }
+}
+
 /* encode an mdelem */
 static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
                       framer_state* st) {
-  GPR_ASSERT(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)) > 0);
+  /* User-provided key len validated in grpc_validate_header_key_is_legal(). */
+  GPR_DEBUG_ASSERT(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)) > 0);
+  /* Header ordering: all reserved headers (prefixed with ':') must precede
+   * regular headers. This can be a debug assert, since:
+   * 1) User cannot give us ':' headers (grpc_validate_header_key_is_legal()).
+   * 2) grpc filters/core should be checked during debug builds. */
+#ifndef NDEBUG
   if (GRPC_SLICE_START_PTR(GRPC_MDKEY(elem))[0] != ':') { /* regular header */
     st->seen_regular_header = 1;
   } else {
-    GPR_ASSERT(
+    GPR_DEBUG_ASSERT(
         st->seen_regular_header == 0 &&
         "Reserved header (colon-prefixed) happening after regular ones.");
   }
-
+#endif
   if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
-    char* k = grpc_slice_to_c_string(GRPC_MDKEY(elem));
-    char* v = nullptr;
-    if (grpc_is_binary_header_internal(GRPC_MDKEY(elem))) {
-      v = grpc_dump_slice(GRPC_MDVALUE(elem), GPR_DUMP_HEX);
-    } else {
-      v = grpc_slice_to_c_string(GRPC_MDVALUE(elem));
-    }
-    gpr_log(
-        GPR_INFO,
-        "Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
-        k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem),
-        grpc_slice_is_interned(GRPC_MDKEY(elem)),
-        grpc_slice_is_interned(GRPC_MDVALUE(elem)));
-    gpr_free(k);
-    gpr_free(v);
+    hpack_enc_log(elem);
   }
 
-  bool elem_interned = GRPC_MDELEM_IS_INTERNED(elem);
-  bool key_interned = elem_interned || grpc_slice_is_interned(GRPC_MDKEY(elem));
+  const bool elem_interned = GRPC_MDELEM_IS_INTERNED(elem);
+  const bool key_interned =
+      elem_interned || grpc_slice_is_interned(GRPC_MDKEY(elem));
 
-  // Key is not interned, emit literals.
+  /* Key is not interned, emit literals. */
   if (!key_interned) {
-    emit_lithdr_noidx_v(c, 0, elem, st);
+    emit_lithdr_v<EmitLitHdrVType::NO_IDX_V>(c, elem, st);
     return;
   }
-
-  uint32_t elem_hash = 0;
-
-  if (elem_interned) {
-    if (GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED) {
-      elem_hash =
-          reinterpret_cast<grpc_core::InternedMetadata*>(GRPC_MDELEM_DATA(elem))
-              ->hash();
-    } else {
-      elem_hash =
-          reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(elem))
-              ->hash();
-    }
-
-    inc_filter(HASH_FRAGMENT_1(elem_hash), &c->filter_elems_sum,
-               c->filter_elems);
-
-    /* is this elem currently in the decoders table? */
-    if (grpc_mdelem_both_interned_eq(
-            c->entries_elems[HASH_FRAGMENT_2(elem_hash)], elem) &&
-        c->indices_elems[HASH_FRAGMENT_2(elem_hash)] > c->tail_remote_index) {
-      /* HIT: complete element (first cuckoo hash) */
-      emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_2(elem_hash)]),
-                   st);
-      return;
-    }
-    if (grpc_mdelem_both_interned_eq(
-            c->entries_elems[HASH_FRAGMENT_3(elem_hash)], elem) &&
-        c->indices_elems[HASH_FRAGMENT_3(elem_hash)] > c->tail_remote_index) {
-      /* HIT: complete element (second cuckoo hash) */
-      emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_3(elem_hash)]),
-                   st);
-      return;
-    }
+  /* Interned metadata => maybe already indexed. */
+  const EmitIndexedStatus ret =
+      elem_interned ? maybe_emit_indexed(c, elem, st) : EmitIndexedStatus();
+  if (ret.emitted) {
+    return;
   }
 
-  uint32_t indices_key;
-
   /* should this elem be in the table? */
   const size_t decoder_space_usage =
       grpc_chttp2_get_size_in_hpack_table(elem, st->use_true_binary_metadata);
-  const bool should_add_elem = elem_interned &&
-                               decoder_space_usage < MAX_DECODER_SPACE_USAGE &&
-                               c->filter_elems[HASH_FRAGMENT_1(elem_hash)] >=
-                                   c->filter_elems_sum / ONE_ON_ADD_PROBABILITY;
-
-  uint32_t key_hash = GRPC_MDKEY(elem).refcount->Hash(GRPC_MDKEY(elem));
-  auto emit_maybe_add = [&should_add_elem, &elem, &st, &c, &indices_key,
-                         &decoder_space_usage, &elem_hash, &key_hash] {
-    if (should_add_elem) {
-      emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st);
-      add_elem(c, elem, decoder_space_usage, elem_hash, key_hash);
-    } else {
-      emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st);
-    }
-  };
+  const bool decoder_space_available =
+      decoder_space_usage < MAX_DECODER_SPACE_USAGE;
+  const bool should_add_elem =
+      elem_interned && decoder_space_available && ret.can_add;
+  const uint32_t elem_hash = ret.elem_hash;
 
   /* no hits for the elem... maybe there's a key? */
-  indices_key = c->indices_keys[HASH_FRAGMENT_2(key_hash)];
+  const uint32_t key_hash = GRPC_MDKEY(elem).refcount->Hash(GRPC_MDKEY(elem));
+  uint32_t indices_key = c->indices_keys[HASH_FRAGMENT_2(key_hash)];
   if (grpc_slice_static_interned_equal(
           c->entries_keys[HASH_FRAGMENT_2(key_hash)], GRPC_MDKEY(elem)) &&
       indices_key > c->tail_remote_index) {
     /* HIT: key (first cuckoo hash) */
-    emit_maybe_add();
+    emit_maybe_add(c, elem, st, indices_key, should_add_elem,
+                   decoder_space_usage, elem_hash, key_hash);
     return;
   }
 
@@ -570,18 +617,18 @@ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
   if (grpc_slice_static_interned_equal(
           c->entries_keys[HASH_FRAGMENT_3(key_hash)], GRPC_MDKEY(elem)) &&
       indices_key > c->tail_remote_index) {
-    /* HIT: key (first cuckoo hash) */
-    emit_maybe_add();
+    /* HIT: key (second cuckoo hash) */
+    emit_maybe_add(c, elem, st, indices_key, should_add_elem,
+                   decoder_space_usage, elem_hash, key_hash);
     return;
   }
 
   /* no elem, key in the table... fall back to literal emission */
-  const bool should_add_key =
-      !elem_interned && decoder_space_usage < MAX_DECODER_SPACE_USAGE;
+  const bool should_add_key = !elem_interned && decoder_space_available;
   if (should_add_elem || should_add_key) {
-    emit_lithdr_incidx_v(c, 0, elem, st);
+    emit_lithdr_v<EmitLitHdrVType::INC_IDX_V>(c, elem, st);
   } else {
-    emit_lithdr_noidx_v(c, 0, elem, st);
+    emit_lithdr_v<EmitLitHdrVType::NO_IDX_V>(c, elem, st);
   }
   if (should_add_elem) {
     add_elem(c, elem, decoder_space_usage, elem_hash, key_hash);
@@ -599,8 +646,8 @@ static void deadline_enc(grpc_chttp2_hpack_compressor* c, grpc_millis deadline,
   grpc_mdelem mdelem;
   grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(),
                             timeout_str);
-  mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT,
-                                   grpc_slice_from_copied_string(timeout_str));
+  mdelem = grpc_mdelem_from_slices(
+      GRPC_MDSTR_GRPC_TIMEOUT, grpc_core::UnmanagedMemorySlice(timeout_str));
   hpack_enc(c, mdelem, st);
   GRPC_MDELEM_UNREF(mdelem);
 }
@@ -690,8 +737,12 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
                                grpc_metadata_batch* metadata,
                                const grpc_encode_header_options* options,
                                grpc_slice_buffer* outbuf) {
-  GPR_ASSERT(options->stream_id != 0);
-
+  /* grpc_chttp2_encode_header is called by FlushInitial/TrailingMetadata in
+     writing.cc. Specifically, on streams returned by NextStream(), which
+     returns streams from the list GRPC_CHTTP2_LIST_WRITABLE. The only way to be
+     added to the list is via  grpc_chttp2_list_add_writable_stream(), which
+     validates that stream_id is not 0. So, this can be a debug assert. */
+  GPR_DEBUG_ASSERT(options->stream_id != 0);
   framer_state st;
   st.seen_regular_header = 0;
   st.stream_id = options->stream_id;
@@ -711,18 +762,28 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
   }
   for (size_t i = 0; i < extra_headers_size; ++i) {
     grpc_mdelem md = *extra_headers[i];
-    uintptr_t static_index = grpc_chttp2_get_static_hpack_table_index(md);
-    if (static_index) {
-      emit_indexed(c, static_cast<uint32_t>(static_index), &st);
+    const bool is_static =
+        GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC;
+    uintptr_t static_index;
+    if (is_static &&
+        (static_index =
+             reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md))
+                 ->StaticIndex()) < GRPC_CHTTP2_LAST_STATIC_ENTRY) {
+      emit_indexed(c, static_cast<uint32_t>(static_index + 1), &st);
     } else {
       hpack_enc(c, md, &st);
     }
   }
   grpc_metadata_batch_assert_ok(metadata);
   for (grpc_linked_mdelem* l = metadata->list.head; l; l = l->next) {
-    uintptr_t static_index = grpc_chttp2_get_static_hpack_table_index(l->md);
-    if (static_index) {
-      emit_indexed(c, static_cast<uint32_t>(static_index), &st);
+    const bool is_static =
+        GRPC_MDELEM_STORAGE(l->md) == GRPC_MDELEM_STORAGE_STATIC;
+    uintptr_t static_index;
+    if (is_static &&
+        (static_index = reinterpret_cast<grpc_core::StaticMetadata*>(
+                            GRPC_MDELEM_DATA(l->md))
+                            ->StaticIndex()) < GRPC_CHTTP2_LAST_STATIC_ENTRY) {
+      emit_indexed(c, static_cast<uint32_t>(static_index + 1), &st);
     } else {
       hpack_enc(c, l->md, &st);
     }
index e3fc61f..a5142ff 100644 (file)
@@ -38,6 +38,9 @@
 #include "src/core/lib/surface/validate_metadata.h"
 #include "src/core/lib/transport/http2_errors.h"
 
+grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser(
+    false, "chttp2_hpack_parser");
+
 typedef enum {
   NOT_BINARY,
   BINARY_BEGIN,
@@ -622,58 +625,65 @@ static const uint8_t inverse_base64[256] = {
     255,
 };
 
+static void GPR_ATTRIBUTE_NOINLINE on_hdr_log(grpc_mdelem md) {
+  char* k = grpc_slice_to_c_string(GRPC_MDKEY(md));
+  char* v = nullptr;
+  if (grpc_is_binary_header_internal(GRPC_MDKEY(md))) {
+    v = grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX);
+  } else {
+    v = grpc_slice_to_c_string(GRPC_MDVALUE(md));
+  }
+  gpr_log(
+      GPR_INFO,
+      "Decode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
+      k, v, GRPC_MDELEM_IS_INTERNED(md), GRPC_MDELEM_STORAGE(md),
+      grpc_slice_is_interned(GRPC_MDKEY(md)),
+      grpc_slice_is_interned(GRPC_MDVALUE(md)));
+  gpr_free(k);
+  gpr_free(v);
+}
+
 /* emission helpers */
-static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md,
-                          int add_to_table) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
-    char* k = grpc_slice_to_c_string(GRPC_MDKEY(md));
-    char* v = nullptr;
-    if (grpc_is_binary_header_internal(GRPC_MDKEY(md))) {
-      v = grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX);
-    } else {
-      v = grpc_slice_to_c_string(GRPC_MDVALUE(md));
-    }
-    gpr_log(
-        GPR_INFO,
-        "Decode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
-        k, v, GRPC_MDELEM_IS_INTERNED(md), GRPC_MDELEM_STORAGE(md),
-        grpc_slice_is_interned(GRPC_MDKEY(md)),
-        grpc_slice_is_interned(GRPC_MDVALUE(md)));
-    gpr_free(k);
-    gpr_free(v);
+template <bool do_add>
+static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) {
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) {
+    on_hdr_log(md);
   }
-  if (add_to_table) {
-    GPR_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
-               GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
+  if (do_add) {
+    GPR_DEBUG_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
+                     GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
     grpc_error* err = grpc_chttp2_hptbl_add(&p->table, md);
-    if (err != GRPC_ERROR_NONE) return err;
+    if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) return err;
   }
-  if (p->on_header == nullptr) {
-    GRPC_MDELEM_UNREF(md);
-    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
+  return p->on_header(p->on_header_user_data, md);
+}
+
+static grpc_core::UnmanagedMemorySlice take_string_extern(
+    grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) {
+  grpc_core::UnmanagedMemorySlice s;
+  if (!str->copied) {
+    GPR_DEBUG_ASSERT(!grpc_slice_is_interned(str->data.referenced));
+    s = static_cast<grpc_core::UnmanagedMemorySlice&>(str->data.referenced);
+    str->copied = true;
+    str->data.referenced = grpc_core::UnmanagedMemorySlice();
+  } else {
+    s = grpc_core::UnmanagedMemorySlice(str->data.copied.str,
+                                        str->data.copied.length);
   }
-  p->on_header(p->on_header_user_data, md);
-  return GRPC_ERROR_NONE;
+  str->data.copied.length = 0;
+  return s;
 }
 
-static grpc_slice take_string(grpc_chttp2_hpack_parser* p,
-                              grpc_chttp2_hpack_parser_string* str,
-                              bool intern) {
-  grpc_slice s;
+static grpc_core::ManagedMemorySlice take_string_intern(
+    grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) {
+  grpc_core::ManagedMemorySlice s;
   if (!str->copied) {
-    if (intern) {
-      s = grpc_slice_intern(str->data.referenced);
-      grpc_slice_unref_internal(str->data.referenced);
-    } else {
-      s = str->data.referenced;
-    }
+    s = grpc_core::ManagedMemorySlice(&str->data.referenced);
+    grpc_slice_unref_internal(str->data.referenced);
     str->copied = true;
     str->data.referenced = grpc_empty_slice();
-  } else if (intern) {
-    s = grpc_slice_intern(grpc_slice_from_static_buffer(
-        str->data.copied.str, str->data.copied.length));
   } else {
-    s = grpc_slice_from_copied_buffer(str->data.copied.str,
+    s = grpc_core::ManagedMemorySlice(str->data.copied.str,
                                       str->data.copied.length);
   }
   str->data.copied.length = 0;
@@ -750,23 +760,26 @@ static grpc_error* parse_stream_dep0(grpc_chttp2_hpack_parser* p,
   return parse_stream_dep1(p, cur + 1, end);
 }
 
+static grpc_error* GPR_ATTRIBUTE_NOINLINE
+on_invalid_hpack_idx(grpc_chttp2_hpack_parser* p) {
+  return grpc_error_set_int(
+      grpc_error_set_int(
+          GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid HPACK index received"),
+          GRPC_ERROR_INT_INDEX, static_cast<intptr_t>(p->index)),
+      GRPC_ERROR_INT_SIZE, static_cast<intptr_t>(p->table.num_ents));
+}
+
 /* emit an indexed field; jumps to begin the next field on completion */
 static grpc_error* finish_indexed_field(grpc_chttp2_hpack_parser* p,
                                         const uint8_t* cur,
                                         const uint8_t* end) {
-  grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
-  if (GRPC_MDISNULL(md)) {
-    return grpc_error_set_int(
-        grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                               "Invalid HPACK index received"),
-                           GRPC_ERROR_INT_INDEX,
-                           static_cast<intptr_t>(p->index)),
-        GRPC_ERROR_INT_SIZE, static_cast<intptr_t>(p->table.num_ents));
+  grpc_mdelem md = grpc_chttp2_hptbl_lookup<true>(&p->table, p->index);
+  if (GPR_UNLIKELY(GRPC_MDISNULL(md))) {
+    return on_invalid_hpack_idx(p);
   }
-  GRPC_MDELEM_REF(md);
   GRPC_STATS_INC_HPACK_RECV_INDEXED();
-  grpc_error* err = on_hdr(p, md, 0);
-  if (err != GRPC_ERROR_NONE) return err;
+  grpc_error* err = on_hdr<false>(p, md);
+  if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) return err;
   return parse_begin(p, cur, end);
 }
 
@@ -775,6 +788,7 @@ static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
                                        const uint8_t* cur, const uint8_t* end) {
   p->dynamic_table_update_allowed = 0;
   p->index = (*cur) & 0x7f;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   return finish_indexed_field(p, cur + 1, end);
 }
 
@@ -787,22 +801,41 @@ static grpc_error* parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = 0x7f;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   p->parsing.value = &p->index;
   return parse_value0(p, cur + 1, end);
 }
 
+/* When finishing with a header, get the cached md element for this index.
+   This is set in parse_value_string(). We ensure (in debug mode) that the
+   cached metadata corresponds with the index we are examining. */
+static grpc_mdelem get_precomputed_md_for_idx(grpc_chttp2_hpack_parser* p) {
+  GPR_DEBUG_ASSERT(p->md_for_index.payload != 0);
+  GPR_DEBUG_ASSERT(static_cast<int64_t>(p->index) == p->precomputed_md_index);
+  grpc_mdelem md = p->md_for_index;
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
+#ifndef NDEBUG
+  p->precomputed_md_index = -1;
+#endif
+  return md;
+}
+
+static const grpc_core::ManagedMemorySlice& get_indexed_key(grpc_mdelem md) {
+  GPR_DEBUG_ASSERT(GRPC_MDELEM_IS_INTERNED(md));
+  return static_cast<const grpc_core::ManagedMemorySlice&>(
+      grpc_slice_ref_internal(GRPC_MDKEY(md)));
+}
+
 /* finish a literal header with incremental indexing */
 static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p,
                                         const uint8_t* cur,
                                         const uint8_t* end) {
-  grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
-  GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
   GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX();
-  grpc_error* err =
-      on_hdr(p,
-             grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
-                                     take_string(p, &p->value, true)),
-             1);
+  grpc_mdelem md = get_precomputed_md_for_idx(p);
+  grpc_error* err = on_hdr<true>(
+      p, grpc_mdelem_from_slices(get_indexed_key(md),
+                                 take_string_intern(p, &p->value)));
   if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
   return parse_begin(p, cur, end);
 }
@@ -812,11 +845,9 @@ static grpc_error* finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
                                           const uint8_t* cur,
                                           const uint8_t* end) {
   GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V();
-  grpc_error* err =
-      on_hdr(p,
-             grpc_mdelem_from_slices(take_string(p, &p->key, true),
-                                     take_string(p, &p->value, true)),
-             1);
+  grpc_error* err = on_hdr<true>(
+      p, grpc_mdelem_from_slices(take_string_intern(p, &p->key),
+                                 take_string_intern(p, &p->value)));
   if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
   return parse_begin(p, cur, end);
 }
@@ -829,6 +860,7 @@ static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = (*cur) & 0x3f;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   return parse_string_prefix(p, cur + 1, end);
 }
 
@@ -842,6 +874,7 @@ static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = 0x3f;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   p->parsing.value = &p->index;
   return parse_value0(p, cur + 1, end);
 }
@@ -862,14 +895,11 @@ static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
 static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p,
                                         const uint8_t* cur,
                                         const uint8_t* end) {
-  grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
-  GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
   GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX();
-  grpc_error* err =
-      on_hdr(p,
-             grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
-                                     take_string(p, &p->value, false)),
-             0);
+  grpc_mdelem md = get_precomputed_md_for_idx(p);
+  grpc_error* err = on_hdr<false>(
+      p, grpc_mdelem_from_slices(get_indexed_key(md),
+                                 take_string_extern(p, &p->value)));
   if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
   return parse_begin(p, cur, end);
 }
@@ -879,11 +909,9 @@ static grpc_error* finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
                                           const uint8_t* cur,
                                           const uint8_t* end) {
   GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V();
-  grpc_error* err =
-      on_hdr(p,
-             grpc_mdelem_from_slices(take_string(p, &p->key, true),
-                                     take_string(p, &p->value, false)),
-             0);
+  grpc_error* err = on_hdr<false>(
+      p, grpc_mdelem_from_slices(take_string_intern(p, &p->key),
+                                 take_string_extern(p, &p->value)));
   if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
   return parse_begin(p, cur, end);
 }
@@ -896,6 +924,7 @@ static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = (*cur) & 0xf;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   return parse_string_prefix(p, cur + 1, end);
 }
 
@@ -909,6 +938,7 @@ static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = 0xf;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   p->parsing.value = &p->index;
   return parse_value0(p, cur + 1, end);
 }
@@ -929,14 +959,11 @@ static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
 static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
                                         const uint8_t* cur,
                                         const uint8_t* end) {
-  grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
-  GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
   GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX();
-  grpc_error* err =
-      on_hdr(p,
-             grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
-                                     take_string(p, &p->value, false)),
-             0);
+  grpc_mdelem md = get_precomputed_md_for_idx(p);
+  grpc_error* err = on_hdr<false>(
+      p, grpc_mdelem_from_slices(get_indexed_key(md),
+                                 take_string_extern(p, &p->value)));
   if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
   return parse_begin(p, cur, end);
 }
@@ -946,11 +973,9 @@ static grpc_error* finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
                                           const uint8_t* cur,
                                           const uint8_t* end) {
   GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V();
-  grpc_error* err =
-      on_hdr(p,
-             grpc_mdelem_from_slices(take_string(p, &p->key, true),
-                                     take_string(p, &p->value, false)),
-             0);
+  grpc_error* err = on_hdr<false>(
+      p, grpc_mdelem_from_slices(take_string_intern(p, &p->key),
+                                 take_string_extern(p, &p->value)));
   if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
   return parse_begin(p, cur, end);
 }
@@ -963,6 +988,7 @@ static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = (*cur) & 0xf;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   return parse_string_prefix(p, cur + 1, end);
 }
 
@@ -976,6 +1002,7 @@ static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed = 0;
   p->next_state = and_then;
   p->index = 0xf;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   p->parsing.value = &p->index;
   return parse_value0(p, cur + 1, end);
 }
@@ -995,7 +1022,7 @@ static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
 /* finish parsing a max table size change */
 static grpc_error* finish_max_tbl_size(grpc_chttp2_hpack_parser* p,
                                        const uint8_t* cur, const uint8_t* end) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) {
     gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
   }
   grpc_error* err =
@@ -1015,6 +1042,7 @@ static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
   }
   p->dynamic_table_update_allowed--;
   p->index = (*cur) & 0x1f;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   return finish_max_tbl_size(p, cur + 1, end);
 }
 
@@ -1033,6 +1061,7 @@ static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
   p->dynamic_table_update_allowed--;
   p->next_state = and_then;
   p->index = 0x1f;
+  p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
   p->parsing.value = &p->index;
   return parse_value0(p, cur + 1, end);
 }
@@ -1496,27 +1525,38 @@ static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p,
 
 static bool is_binary_literal_header(grpc_chttp2_hpack_parser* p) {
   /* We know that either argument here is a reference counter slice.
-   * 1. If a result of grpc_slice_from_static_buffer, the refcount is set to
-   *    NoopRefcount.
+   * 1. If it is a grpc_core::StaticSlice, the refcount is set to kNoopRefcount.
    * 2. If it's p->key.data.referenced, then p->key.copied was set to false,
    *    which occurs in begin_parse_string() - where the refcount is set to
    *    p->current_slice_refcount, which is not null. */
   return grpc_is_refcounted_slice_binary_header(
-      p->key.copied ? grpc_slice_from_static_buffer(p->key.data.copied.str,
-                                                    p->key.data.copied.length)
+      p->key.copied ? grpc_core::ExternallyManagedSlice(
+                          p->key.data.copied.str, p->key.data.copied.length)
                     : p->key.data.referenced);
 }
 
+/* Cache the metadata for the given index during initial parsing. This avoids a
+   pointless recomputation of the metadata when finishing a header. We read the
+   cached value in get_precomputed_md_for_idx(). */
+static void set_precomputed_md_idx(grpc_chttp2_hpack_parser* p,
+                                   grpc_mdelem md) {
+  GPR_DEBUG_ASSERT(p->md_for_index.payload == 0);
+  GPR_DEBUG_ASSERT(p->precomputed_md_index == -1);
+  p->md_for_index = md;
+#ifndef NDEBUG
+  p->precomputed_md_index = p->index;
+#endif
+}
+
+/* Determines if a metadata element key associated with the current parser index
+   is a binary indexed header during string parsing. We'll need to revisit this
+   metadata when we're done parsing, so we cache the metadata for this index
+   here using set_precomputed_md_idx(). */
 static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
                                             bool* is) {
   grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
-  if (GRPC_MDISNULL(elem)) {
-    return grpc_error_set_int(
-        grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                               "Invalid HPACK index received"),
-                           GRPC_ERROR_INT_INDEX,
-                           static_cast<intptr_t>(p->index)),
-        GRPC_ERROR_INT_SIZE, static_cast<intptr_t>(p->table.num_ents));
+  if (GPR_UNLIKELY(GRPC_MDISNULL(elem))) {
+    return on_invalid_hpack_idx(p);
   }
   /* We know that GRPC_MDKEY(elem) points to a reference counted slice since:
    * 1. elem was a result of grpc_chttp2_hptbl_lookup
@@ -1527,6 +1567,7 @@ static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
    *    interned.
    * 4. Both static and interned element slices have non-null refcounts. */
   *is = grpc_is_refcounted_slice_binary_header(GRPC_MDKEY(elem));
+  set_precomputed_md_idx(p, elem);
   return GRPC_ERROR_NONE;
 }
 
@@ -1551,10 +1592,16 @@ static grpc_error* parse_value_string_with_literal_key(
   return parse_value_string(p, cur, end, is_binary_literal_header(p));
 }
 
+/* "Uninitialized" header parser to save us a branch in on_hdr().  */
+static grpc_error* on_header_uninitialized(void* user_data, grpc_mdelem md) {
+  GRPC_MDELEM_UNREF(md);
+  return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
+}
+
 /* PUBLIC INTERFACE */
 
 void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p) {
-  p->on_header = nullptr;
+  p->on_header = on_header_uninitialized;
   p->on_header_user_data = nullptr;
   p->state = parse_begin;
   p->key.data.referenced = grpc_empty_slice();
@@ -1565,9 +1612,20 @@ void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p) {
   p->value.data.copied.str = nullptr;
   p->value.data.copied.capacity = 0;
   p->value.data.copied.length = 0;
+  /* Cached metadata for the current index the parser is handling. This is set
+     to 0 initially, invalidated when the index changes, and invalidated when it
+     is read (by get_precomputed_md_for_idx()). It is set during string parsing,
+     by set_precomputed_md_idx() - which is called by parse_value_string().
+     The goal here is to avoid recomputing the metadata for the index when
+     finishing with a header as well as the initial parse. */
+  p->md_for_index.payload = 0;
+#ifndef NDEBUG
+  /* In debug mode, this ensures that the cached metadata we're reading is in
+   * fact correct for the index we are examining. */
+  p->precomputed_md_index = -1;
+#endif
   p->dynamic_table_update_allowed = 2;
   p->last_error = GRPC_ERROR_NONE;
-  grpc_chttp2_hptbl_init(&p->table);
 }
 
 void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p) {
@@ -1691,7 +1749,7 @@ grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
         grpc_chttp2_mark_stream_closed(t, s, true, false, GRPC_ERROR_NONE);
       }
     }
-    parser->on_header = nullptr;
+    parser->on_header = on_header_uninitialized;
     parser->on_header_user_data = nullptr;
     parser->is_boundary = 0xde;
     parser->is_eof = 0xde;
index 3dc8e13..eb90568 100644 (file)
@@ -46,7 +46,7 @@ typedef struct {
 
 struct grpc_chttp2_hpack_parser {
   /* user specified callback for each header output */
-  void (*on_header)(void* user_data, grpc_mdelem md);
+  grpc_error* (*on_header)(void* user_data, grpc_mdelem md);
   void* on_header_user_data;
 
   grpc_error* last_error;
@@ -69,6 +69,14 @@ struct grpc_chttp2_hpack_parser {
   grpc_chttp2_hpack_parser_string value;
   /* parsed index */
   uint32_t index;
+  /* When we parse a value string, we determine the metadata element for a
+     specific index, which we need again when we're finishing up with that
+     header. To avoid calculating the metadata element for that index a second
+     time at that stage, we cache (and invalidate) the element here. */
+  grpc_mdelem md_for_index;
+#ifndef NDEBUG
+  int64_t precomputed_md_index;
+#endif
   /* length of source bytes for the currently parsing string */
   uint32_t strlen;
   /* number of source bytes read for the currently parsing string */
index f9e97cc..be03110 100644 (file)
 
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gpr/murmur_hash.h"
+#include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/surface/validate_metadata.h"
 #include "src/core/lib/transport/static_metadata.h"
 
 extern grpc_core::TraceFlag grpc_http_trace;
 
-static struct {
-  const char* key;
-  const char* value;
-} static_table[] = {
-    /* 0: */
-    {nullptr, nullptr},
-    /* 1: */
-    {":authority", ""},
-    /* 2: */
-    {":method", "GET"},
-    /* 3: */
-    {":method", "POST"},
-    /* 4: */
-    {":path", "/"},
-    /* 5: */
-    {":path", "/index.html"},
-    /* 6: */
-    {":scheme", "http"},
-    /* 7: */
-    {":scheme", "https"},
-    /* 8: */
-    {":status", "200"},
-    /* 9: */
-    {":status", "204"},
-    /* 10: */
-    {":status", "206"},
-    /* 11: */
-    {":status", "304"},
-    /* 12: */
-    {":status", "400"},
-    /* 13: */
-    {":status", "404"},
-    /* 14: */
-    {":status", "500"},
-    /* 15: */
-    {"accept-charset", ""},
-    /* 16: */
-    {"accept-encoding", "gzip, deflate"},
-    /* 17: */
-    {"accept-language", ""},
-    /* 18: */
-    {"accept-ranges", ""},
-    /* 19: */
-    {"accept", ""},
-    /* 20: */
-    {"access-control-allow-origin", ""},
-    /* 21: */
-    {"age", ""},
-    /* 22: */
-    {"allow", ""},
-    /* 23: */
-    {"authorization", ""},
-    /* 24: */
-    {"cache-control", ""},
-    /* 25: */
-    {"content-disposition", ""},
-    /* 26: */
-    {"content-encoding", ""},
-    /* 27: */
-    {"content-language", ""},
-    /* 28: */
-    {"content-length", ""},
-    /* 29: */
-    {"content-location", ""},
-    /* 30: */
-    {"content-range", ""},
-    /* 31: */
-    {"content-type", ""},
-    /* 32: */
-    {"cookie", ""},
-    /* 33: */
-    {"date", ""},
-    /* 34: */
-    {"etag", ""},
-    /* 35: */
-    {"expect", ""},
-    /* 36: */
-    {"expires", ""},
-    /* 37: */
-    {"from", ""},
-    /* 38: */
-    {"host", ""},
-    /* 39: */
-    {"if-match", ""},
-    /* 40: */
-    {"if-modified-since", ""},
-    /* 41: */
-    {"if-none-match", ""},
-    /* 42: */
-    {"if-range", ""},
-    /* 43: */
-    {"if-unmodified-since", ""},
-    /* 44: */
-    {"last-modified", ""},
-    /* 45: */
-    {"link", ""},
-    /* 46: */
-    {"location", ""},
-    /* 47: */
-    {"max-forwards", ""},
-    /* 48: */
-    {"proxy-authenticate", ""},
-    /* 49: */
-    {"proxy-authorization", ""},
-    /* 50: */
-    {"range", ""},
-    /* 51: */
-    {"referer", ""},
-    /* 52: */
-    {"refresh", ""},
-    /* 53: */
-    {"retry-after", ""},
-    /* 54: */
-    {"server", ""},
-    /* 55: */
-    {"set-cookie", ""},
-    /* 56: */
-    {"strict-transport-security", ""},
-    /* 57: */
-    {"transfer-encoding", ""},
-    /* 58: */
-    {"user-agent", ""},
-    /* 59: */
-    {"vary", ""},
-    /* 60: */
-    {"via", ""},
-    /* 61: */
-    {"www-authenticate", ""},
-};
-
-static uint32_t entries_for_bytes(uint32_t bytes) {
-  return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) /
-         GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
-}
-
-void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl) {
-  size_t i;
-
-  memset(tbl, 0, sizeof(*tbl));
-  tbl->current_table_bytes = tbl->max_bytes =
-      GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
-  tbl->max_entries = tbl->cap_entries =
-      entries_for_bytes(tbl->current_table_bytes);
-  tbl->ents = static_cast<grpc_mdelem*>(
-      gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries));
-  memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries);
-  for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
-    tbl->static_ents[i - 1] = grpc_mdelem_from_slices(
-        grpc_slice_intern(grpc_slice_from_static_string(static_table[i].key)),
-        grpc_slice_intern(
-            grpc_slice_from_static_string(static_table[i].value)));
-  }
-}
-
 void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl) {
   size_t i;
-  for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
-    GRPC_MDELEM_UNREF(tbl->static_ents[i]);
-  }
   for (i = 0; i < tbl->num_ents; i++) {
     GRPC_MDELEM_UNREF(tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]);
   }
   gpr_free(tbl->ents);
+  tbl->ents = nullptr;
 }
 
-grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
-                                     uint32_t tbl_index) {
-  /* Static table comes first, just return an entry from it */
-  if (tbl_index <= GRPC_CHTTP2_LAST_STATIC_ENTRY) {
-    return tbl->static_ents[tbl_index - 1];
-  }
-  /* Otherwise, find the value in the list of valid entries */
+template <bool take_ref>
+static grpc_mdelem lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
+                                        uint32_t tbl_index) {
+  /* Not static - find the value in the list of valid entries */
   tbl_index -= (GRPC_CHTTP2_LAST_STATIC_ENTRY + 1);
   if (tbl_index < tbl->num_ents) {
     uint32_t offset =
         (tbl->num_ents - 1u - tbl_index + tbl->first_ent) % tbl->cap_entries;
-    return tbl->ents[offset];
+    grpc_mdelem md = tbl->ents[offset];
+    if (take_ref) {
+      GRPC_MDELEM_REF(md);
+    }
+    return md;
   }
   /* Invalid entry: return error */
   return GRPC_MDNULL;
 }
 
+grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
+                                                   uint32_t tbl_index) {
+  return lookup_dynamic_index<false>(tbl, tbl_index);
+}
+
+grpc_mdelem grpc_chttp2_hptbl_lookup_ref_dynamic_index(
+    const grpc_chttp2_hptbl* tbl, uint32_t tbl_index) {
+  return lookup_dynamic_index<true>(tbl, tbl_index);
+}
+
 /* Evict one element from the table */
 static void evict1(grpc_chttp2_hptbl* tbl) {
   grpc_mdelem first_ent = tbl->ents[tbl->first_ent];
@@ -278,7 +134,7 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
     evict1(tbl);
   }
   tbl->current_table_bytes = bytes;
-  tbl->max_entries = entries_for_bytes(bytes);
+  tbl->max_entries = grpc_chttp2_hptbl::entries_for_bytes(bytes);
   if (tbl->max_entries > tbl->cap_entries) {
     rebuild_ents(tbl, GPR_MAX(tbl->max_entries, 2 * tbl->cap_entries));
   } else if (tbl->max_entries < tbl->cap_entries / 3) {
@@ -348,7 +204,7 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
 
   /* See if the string is in the static table */
   for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
-    grpc_mdelem ent = tbl->static_ents[i];
+    grpc_mdelem ent = grpc_static_mdelem_manifested()[i];
     if (!grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDKEY(ent))) continue;
     r.index = i + 1u;
     r.has_value = grpc_slice_eq(GRPC_MDVALUE(md), GRPC_MDVALUE(ent));
index 38f8bdd..5a6c739 100644 (file)
@@ -22,6 +22,7 @@
 #include <grpc/support/port_platform.h>
 
 #include <grpc/slice.h>
+#include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/transport/metadata.h"
 #include "src/core/lib/transport/static_metadata.h"
 #endif
 
 /* hpack decoder table */
-typedef struct {
+struct grpc_chttp2_hptbl {
+  static uint32_t entries_for_bytes(uint32_t bytes) {
+    return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) /
+           GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
+  }
+  static constexpr uint32_t kInitialCapacity =
+      (GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD -
+       1) /
+      GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
+
+  grpc_chttp2_hptbl() {
+    GPR_DEBUG_ASSERT(!ents);
+    constexpr uint32_t AllocSize = sizeof(*ents) * kInitialCapacity;
+    ents = static_cast<grpc_mdelem*>(gpr_malloc(AllocSize));
+    memset(ents, 0, AllocSize);
+  }
+
   /* the first used entry in ents */
-  uint32_t first_ent;
+  uint32_t first_ent = 0;
   /* how many entries are in the table */
-  uint32_t num_ents;
+  uint32_t num_ents = 0;
   /* the amount of memory used by the table, according to the hpack algorithm */
-  uint32_t mem_used;
+  uint32_t mem_used = 0;
   /* the max memory allowed to be used by the table, according to the hpack
      algorithm */
-  uint32_t max_bytes;
+  uint32_t max_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
   /* the currently agreed size of the table, according to the hpack algorithm */
-  uint32_t current_table_bytes;
+  uint32_t current_table_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
   /* Maximum number of entries we could possibly fit in the table, given defined
      overheads */
-  uint32_t max_entries;
+  uint32_t max_entries = kInitialCapacity;
   /* Number of entries allocated in ents */
-  uint32_t cap_entries;
+  uint32_t cap_entries = kInitialCapacity;
   /* a circular buffer of headers - this is stored in the opposite order to
      what hpack specifies, in order to simplify table management a little...
      meaning lookups need to SUBTRACT from the end position */
-  grpc_mdelem* ents;
-  grpc_mdelem static_ents[GRPC_CHTTP2_LAST_STATIC_ENTRY];
-} grpc_chttp2_hptbl;
+  grpc_mdelem* ents = nullptr;
+};
 
-/* initialize a hpack table */
-void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl);
 void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl);
 void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
                                      uint32_t max_bytes);
@@ -79,8 +93,29 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
                                                      uint32_t bytes);
 
 /* lookup a table entry based on its hpack index */
-grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
-                                     uint32_t index);
+grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
+                                                   uint32_t tbl_index);
+grpc_mdelem grpc_chttp2_hptbl_lookup_ref_dynamic_index(
+    const grpc_chttp2_hptbl* tbl, uint32_t tbl_index);
+template <bool take_ref = false>
+inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
+                                            uint32_t index) {
+  /* Static table comes first, just return an entry from it.
+     NB: This imposes the constraint that the first
+     GRPC_CHTTP2_LAST_STATIC_ENTRY entries in the core static metadata table
+     must follow the hpack standard. If that changes, we *must* not rely on
+     reading the core static metadata table here; at that point we'd need our
+     own singleton static metadata in the correct order. */
+  if (index <= GRPC_CHTTP2_LAST_STATIC_ENTRY) {
+    return grpc_static_mdelem_manifested()[index - 1];
+  } else {
+    if (take_ref) {
+      return grpc_chttp2_hptbl_lookup_ref_dynamic_index(tbl, index);
+    } else {
+      return grpc_chttp2_hptbl_lookup_dynamic_index(tbl, index);
+    }
+  }
+}
 /* add a table entry to the index */
 grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
                                   grpc_mdelem md) GRPC_MUST_USE_RESULT;
@@ -94,7 +129,7 @@ size_t grpc_chttp2_get_size_in_hpack_table(grpc_mdelem elem,
 inline uintptr_t grpc_chttp2_get_static_hpack_table_index(grpc_mdelem md) {
   uintptr_t index =
       reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md)) -
-      grpc_static_mdelem_table;
+      grpc_static_mdelem_table();
   if (index < GRPC_CHTTP2_LAST_STATIC_ENTRY) {
     return index + 1;  // Hpack static metadata element indices start at 1
   }
index 02623c9..d04630d 100644 (file)
@@ -38,7 +38,8 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
     storage = static_cast<grpc_linked_mdelem*>(
         buffer->arena->Alloc(sizeof(grpc_linked_mdelem)));
   }
-  return grpc_metadata_batch_add_tail(&buffer->batch, storage, elem);
+  storage->md = elem;
+  return grpc_metadata_batch_link_tail(&buffer->batch, storage);
 }
 
 grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
index e13366d..6e1db8a 100644 (file)
@@ -571,8 +571,6 @@ struct grpc_chttp2_stream {
   /** Are we buffering writes on this stream? If yes, we won't become writable
       until there's enough queued up in the flow_controlled_buffer */
   bool write_buffering = false;
-  /** Has trailing metadata been received. */
-  bool received_trailing_metadata = false;
 
   /* have we sent or received the EOS bit? */
   bool eos_received = false;
@@ -752,13 +750,17 @@ void grpc_chttp2_act_on_flowctl_action(
 
 /********* End of Flow Control ***************/
 
-grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
-                                                      uint32_t id);
+inline grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(
+    grpc_chttp2_transport* t, uint32_t id) {
+  return static_cast<grpc_chttp2_stream*>(
+      grpc_chttp2_stream_map_find(&t->stream_map, id));
+}
 grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
                                                       uint32_t id);
 
 void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
                                      uint32_t goaway_error,
+                                     uint32_t last_stream_id,
                                      const grpc_slice& goaway_text);
 
 void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport* t);
index 5fd37f5..e789006 100644 (file)
@@ -108,7 +108,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
     /* fallthrough */
     dts_fh_0:
     case GRPC_DTS_FH_0:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_frame_size = (static_cast<uint32_t>(*cur)) << 16;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_1;
@@ -116,7 +116,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_1:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_frame_size |= (static_cast<uint32_t>(*cur)) << 8;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_2;
@@ -124,7 +124,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_2:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_frame_size |= *cur;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_3;
@@ -132,7 +132,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_3:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_frame_type = *cur;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_4;
@@ -140,7 +140,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_4:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_frame_flags = *cur;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_5;
@@ -148,7 +148,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_5:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_stream_id = ((static_cast<uint32_t>(*cur)) & 0x7f) << 24;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_6;
@@ -156,7 +156,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_6:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_stream_id |= (static_cast<uint32_t>(*cur)) << 16;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_7;
@@ -164,7 +164,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_7:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_stream_id |= (static_cast<uint32_t>(*cur)) << 8;
       if (++cur == end) {
         t->deframe_state = GRPC_DTS_FH_8;
@@ -172,7 +172,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FH_8:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       t->incoming_stream_id |= (static_cast<uint32_t>(*cur));
       t->deframe_state = GRPC_DTS_FRAME;
       err = init_frame_parser(t);
@@ -208,7 +208,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
       }
     /* fallthrough */
     case GRPC_DTS_FRAME:
-      GPR_ASSERT(cur < end);
+      GPR_DEBUG_ASSERT(cur < end);
       if (static_cast<uint32_t>(end - cur) == t->incoming_frame_size) {
         err = parse_frame_slice(
             t,
@@ -318,7 +318,10 @@ static grpc_error* skip_parser(void* parser, grpc_chttp2_transport* t,
   return GRPC_ERROR_NONE;
 }
 
-static void skip_header(void* tp, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); }
+static grpc_error* skip_header(void* tp, grpc_mdelem md) {
+  GRPC_MDELEM_UNREF(md);
+  return GRPC_ERROR_NONE;
+}
 
 static grpc_error* init_skip_frame_parser(grpc_chttp2_transport* t,
                                           int is_header) {
@@ -393,97 +396,143 @@ error_handler:
 
 static void free_timeout(void* p) { gpr_free(p); }
 
-static void on_initial_header(void* tp, grpc_mdelem md) {
+static bool md_key_cmp(grpc_mdelem md, const grpc_slice& reference) {
+  GPR_DEBUG_ASSERT(grpc_slice_is_interned(GRPC_MDKEY(md)));
+  return GRPC_MDKEY(md).refcount == reference.refcount;
+}
+
+static bool md_cmp(grpc_mdelem md, grpc_mdelem ref_md,
+                   const grpc_slice& ref_key) {
+  if (GPR_LIKELY(GRPC_MDELEM_IS_INTERNED(md))) {
+    return md.payload == ref_md.payload;
+  }
+  if (md_key_cmp(md, ref_key)) {
+    return grpc_slice_eq_static_interned(GRPC_MDVALUE(md),
+                                         GRPC_MDVALUE(ref_md));
+  }
+  return false;
+}
+
+static bool is_nonzero_status(grpc_mdelem md) {
+  // If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2,
+  // then we have seen an error. In fact, if it is a GRPC_STATUS and it's
+  // not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error.
+  // TODO(ctiller): check for a status like " 0"
+  return md_key_cmp(md, GRPC_MDSTR_GRPC_STATUS) &&
+         !md_cmp(md, GRPC_MDELEM_GRPC_STATUS_0, GRPC_MDSTR_GRPC_STATUS);
+}
+
+static void GPR_ATTRIBUTE_NOINLINE on_initial_header_log(
+    grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_mdelem md) {
+  char* key = grpc_slice_to_c_string(GRPC_MDKEY(md));
+  char* value =
+      grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX | GPR_DUMP_ASCII);
+  gpr_log(GPR_INFO, "HTTP:%d:HDR:%s: %s: %s", s->id,
+          t->is_client ? "CLI" : "SVR", key, value);
+  gpr_free(key);
+  gpr_free(value);
+}
+
+static grpc_error* GPR_ATTRIBUTE_NOINLINE handle_timeout(grpc_chttp2_stream* s,
+                                                         grpc_mdelem md) {
+  grpc_millis* cached_timeout =
+      static_cast<grpc_millis*>(grpc_mdelem_get_user_data(md, free_timeout));
+  grpc_millis timeout;
+  if (cached_timeout != nullptr) {
+    timeout = *cached_timeout;
+  } else {
+    if (GPR_UNLIKELY(!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout))) {
+      char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
+      gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val);
+      gpr_free(val);
+      timeout = GRPC_MILLIS_INF_FUTURE;
+    }
+    if (GRPC_MDELEM_IS_INTERNED(md)) {
+      /* store the result */
+      cached_timeout =
+          static_cast<grpc_millis*>(gpr_malloc(sizeof(grpc_millis)));
+      *cached_timeout = timeout;
+      grpc_mdelem_set_user_data(md, free_timeout, cached_timeout);
+    }
+  }
+  if (timeout != GRPC_MILLIS_INF_FUTURE) {
+    grpc_chttp2_incoming_metadata_buffer_set_deadline(
+        &s->metadata_buffer[0], grpc_core::ExecCtx::Get()->Now() + timeout);
+  }
+  GRPC_MDELEM_UNREF(md);
+  return GRPC_ERROR_NONE;
+}
+
+static grpc_error* GPR_ATTRIBUTE_NOINLINE handle_metadata_size_limit_exceeded(
+    grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_mdelem md,
+    size_t new_size, size_t metadata_size_limit) {
+  gpr_log(GPR_DEBUG,
+          "received initial metadata size exceeds limit (%" PRIuPTR
+          " vs. %" PRIuPTR ")",
+          new_size, metadata_size_limit);
+  grpc_chttp2_cancel_stream(
+      t, s,
+      grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                             "received initial metadata size exceeds limit"),
+                         GRPC_ERROR_INT_GRPC_STATUS,
+                         GRPC_STATUS_RESOURCE_EXHAUSTED));
+  grpc_chttp2_parsing_become_skip_parser(t);
+  s->seen_error = true;
+  GRPC_MDELEM_UNREF(md);
+  return GRPC_ERROR_NONE;
+}
+
+static grpc_error* GPR_ATTRIBUTE_NOINLINE
+handle_metadata_add_failure(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+                            grpc_mdelem md, grpc_error* error) {
+  grpc_chttp2_cancel_stream(t, s, error);
+  grpc_chttp2_parsing_become_skip_parser(t);
+  s->seen_error = true;
+  GRPC_MDELEM_UNREF(md);
+  return GRPC_ERROR_NONE;
+}
+
+static grpc_error* on_initial_header(void* tp, grpc_mdelem md) {
   GPR_TIMER_SCOPE("on_initial_header", 0);
 
   grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
   grpc_chttp2_stream* s = t->incoming_stream;
-  GPR_ASSERT(s != nullptr);
+  GPR_DEBUG_ASSERT(s != nullptr);
 
   if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
-    char* key = grpc_slice_to_c_string(GRPC_MDKEY(md));
-    char* value =
-        grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX | GPR_DUMP_ASCII);
-    gpr_log(GPR_INFO, "HTTP:%d:HDR:%s: %s: %s", s->id,
-            t->is_client ? "CLI" : "SVR", key, value);
-    gpr_free(key);
-    gpr_free(value);
+    on_initial_header_log(t, s, md);
   }
 
-  // If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2,
-  // then we have seen an error. In fact, if it is a GRPC_STATUS and it's
-  // not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error.
-  if (grpc_slice_eq_static_interned(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_STATUS) &&
-      !grpc_mdelem_static_value_eq(md, GRPC_MDELEM_GRPC_STATUS_0)) {
-    /* TODO(ctiller): check for a status like " 0" */
+  if (is_nonzero_status(md)) {  // not GRPC_MDELEM_GRPC_STATUS_0?
     s->seen_error = true;
-  } else if (grpc_slice_eq_static_interned(GRPC_MDKEY(md),
-                                           GRPC_MDSTR_GRPC_TIMEOUT)) {
-    grpc_millis* cached_timeout =
-        static_cast<grpc_millis*>(grpc_mdelem_get_user_data(md, free_timeout));
-    grpc_millis timeout;
-    if (cached_timeout != nullptr) {
-      timeout = *cached_timeout;
-    } else {
-      if (GPR_UNLIKELY(
-              !grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout))) {
-        char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
-        gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val);
-        gpr_free(val);
-        timeout = GRPC_MILLIS_INF_FUTURE;
-      }
-      if (GRPC_MDELEM_IS_INTERNED(md)) {
-        /* store the result */
-        cached_timeout =
-            static_cast<grpc_millis*>(gpr_malloc(sizeof(grpc_millis)));
-        *cached_timeout = timeout;
-        grpc_mdelem_set_user_data(md, free_timeout, cached_timeout);
-      }
-    }
-    if (timeout != GRPC_MILLIS_INF_FUTURE) {
-      grpc_chttp2_incoming_metadata_buffer_set_deadline(
-          &s->metadata_buffer[0], grpc_core::ExecCtx::Get()->Now() + timeout);
-    }
-    GRPC_MDELEM_UNREF(md);
-    return;
+  } else if (md_key_cmp(md, GRPC_MDSTR_GRPC_TIMEOUT)) {
+    return handle_timeout(s, md);
   }
 
   const size_t new_size = s->metadata_buffer[0].size + GRPC_MDELEM_LENGTH(md);
   const size_t metadata_size_limit =
       t->settings[GRPC_ACKED_SETTINGS]
                  [GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
-  if (new_size > metadata_size_limit) {
-    gpr_log(GPR_DEBUG,
-            "received initial metadata size exceeds limit (%" PRIuPTR
-            " vs. %" PRIuPTR ")",
-            new_size, metadata_size_limit);
-    grpc_chttp2_cancel_stream(
-        t, s,
-        grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                               "received initial metadata size exceeds limit"),
-                           GRPC_ERROR_INT_GRPC_STATUS,
-                           GRPC_STATUS_RESOURCE_EXHAUSTED));
-    grpc_chttp2_parsing_become_skip_parser(t);
-    s->seen_error = true;
-    GRPC_MDELEM_UNREF(md);
+  if (GPR_UNLIKELY(new_size > metadata_size_limit)) {
+    return handle_metadata_size_limit_exceeded(t, s, md, new_size,
+                                               metadata_size_limit);
   } else {
     grpc_error* error =
         grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[0], md);
-    if (error != GRPC_ERROR_NONE) {
-      grpc_chttp2_cancel_stream(t, s, error);
-      grpc_chttp2_parsing_become_skip_parser(t);
-      s->seen_error = true;
-      GRPC_MDELEM_UNREF(md);
+    if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
+      return handle_metadata_add_failure(t, s, md, error);
     }
   }
+  // Not timeout-related metadata, and no error occurred.
+  return GRPC_ERROR_NONE;
 }
 
-static void on_trailing_header(void* tp, grpc_mdelem md) {
+static grpc_error* on_trailing_header(void* tp, grpc_mdelem md) {
   GPR_TIMER_SCOPE("on_trailing_header", 0);
 
   grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
   grpc_chttp2_stream* s = t->incoming_stream;
-  GPR_ASSERT(s != nullptr);
+  GPR_DEBUG_ASSERT(s != nullptr);
 
   if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
     char* key = grpc_slice_to_c_string(GRPC_MDKEY(md));
@@ -495,12 +544,7 @@ static void on_trailing_header(void* tp, grpc_mdelem md) {
     gpr_free(value);
   }
 
-  // If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2,
-  // then we have seen an error. In fact, if it is a GRPC_STATUS and it's
-  // not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error.
-  if (grpc_slice_eq_static_interned(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_STATUS) &&
-      !grpc_mdelem_static_value_eq(md, GRPC_MDELEM_GRPC_STATUS_0)) {
-    /* TODO(ctiller): check for a status like " 0" */
+  if (is_nonzero_status(md)) {  // not GRPC_MDELEM_GRPC_STATUS_0?
     s->seen_error = true;
   }
 
@@ -532,6 +576,7 @@ static void on_trailing_header(void* tp, grpc_mdelem md) {
       GRPC_MDELEM_UNREF(md);
     }
   }
+  return GRPC_ERROR_NONE;
 }
 
 static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
@@ -611,7 +656,7 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
   } else {
     t->incoming_stream = s;
   }
-  GPR_ASSERT(s != nullptr);
+  GPR_DEBUG_ASSERT(s != nullptr);
   s->stats.incoming.framing_bytes += 9;
   if (GPR_UNLIKELY(s->read_closed)) {
     GRPC_CHTTP2_IF_TRACING(gpr_log(
@@ -632,7 +677,6 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
           *s->trailing_metadata_available = true;
         }
         t->hpack_parser.on_header = on_trailing_header;
-        s->received_trailing_metadata = true;
       } else {
         GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing initial_metadata"));
         t->hpack_parser.on_header = on_initial_header;
@@ -641,7 +685,6 @@ static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
     case 1:
       GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing trailing_metadata"));
       t->hpack_parser.on_header = on_trailing_header;
-      s->received_trailing_metadata = true;
       break;
     case 2:
       gpr_log(GPR_ERROR, "too many header frames received");
index f300e23..647214b 100644 (file)
@@ -27,7 +27,7 @@
 
 void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map,
                                  size_t initial_capacity) {
-  GPR_ASSERT(initial_capacity > 1);
+  GPR_DEBUG_ASSERT(initial_capacity > 1);
   map->keys =
       static_cast<uint32_t*>(gpr_malloc(sizeof(uint32_t) * initial_capacity));
   map->values =
@@ -63,9 +63,17 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key,
   uint32_t* keys = map->keys;
   void** values = map->values;
 
+  // The first assertion ensures that the table is monotonically increasing.
   GPR_ASSERT(count == 0 || keys[count - 1] < key);
-  GPR_ASSERT(value);
-  GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr);
+  GPR_DEBUG_ASSERT(value);
+  // Asserting that the key is not already in the map can be a debug assertion.
+  // Why: we're already checking that the map elements are monotonically
+  // increasing. If we re-add a key, i.e. if the key is already present, then
+  // either it is the most recently added key in the map (in which case the
+  // first assertion fails due to key == last_key) or there is a more recently
+  // added (larger) key at the end of the map: in which case the first assertion
+  // still fails due to key < last_key.
+  GPR_DEBUG_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr);
 
   if (count == capacity) {
     if (map->free > capacity / 4) {
@@ -74,7 +82,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key,
     } else {
       /* resize when less than 25% of the table is free, because compaction
          won't help much */
-      map->capacity = capacity = 3 * capacity / 2;
+      map->capacity = capacity = 2 * capacity;
       map->keys = keys = static_cast<uint32_t*>(
           gpr_realloc(keys, capacity * sizeof(uint32_t)));
       map->values = values =
@@ -87,6 +95,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key,
   map->count = count + 1;
 }
 
+template <bool strict_find>
 static void** find(grpc_chttp2_stream_map* map, uint32_t key) {
   size_t min_idx = 0;
   size_t max_idx = map->count;
@@ -95,7 +104,8 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) {
   void** values = map->values;
   uint32_t mid_key;
 
-  if (max_idx == 0) return nullptr;
+  GPR_DEBUG_ASSERT(!strict_find || max_idx > 0);
+  if (!strict_find && max_idx == 0) return nullptr;
 
   while (min_idx < max_idx) {
     /* find the midpoint, avoiding overflow */
@@ -112,28 +122,28 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) {
     }
   }
 
+  GPR_DEBUG_ASSERT(!strict_find);
   return nullptr;
 }
 
 void* grpc_chttp2_stream_map_delete(grpc_chttp2_stream_map* map, uint32_t key) {
-  void** pvalue = find(map, key);
-  void* out = nullptr;
-  if (pvalue != nullptr) {
-    out = *pvalue;
-    *pvalue = nullptr;
-    map->free += (out != nullptr);
-    /* recognize complete emptyness and ensure we can skip
-     * defragmentation later */
-    if (map->free == map->count) {
-      map->free = map->count = 0;
-    }
-    GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr);
+  void** pvalue = find<true>(map, key);
+  GPR_DEBUG_ASSERT(pvalue != nullptr);
+  void* out = *pvalue;
+  GPR_DEBUG_ASSERT(out != nullptr);
+  *pvalue = nullptr;
+  map->free++;
+  /* recognize complete emptyness and ensure we can skip
+     defragmentation later */
+  if (map->free == map->count) {
+    map->free = map->count = 0;
   }
+  GPR_DEBUG_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr);
   return out;
 }
 
 void* grpc_chttp2_stream_map_find(grpc_chttp2_stream_map* map, uint32_t key) {
-  void** pvalue = find(map, key);
+  void** pvalue = find<false>(map, key);
   return pvalue != nullptr ? *pvalue : nullptr;
 }
 
index 6e08d27..c3fc256 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include <grpc/grpc_cronet.h>
-
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 
+#include "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h"
 #include "src/core/ext/transport/cronet/transport/cronet_transport.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/transport/transport_impl.h"
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/client/secure/cronet_channel_create.h b/legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/client/secure/cronet_channel_create.h
new file mode 100644 (file)
index 0000000..7427f9f
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ *
+ * Copyright 2016 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_TRANSPORT_CRONET_CLIENT_SECURE_CRONET_CHANNEL_CREATE_H
+#define GRPC_CORE_EXT_TRANSPORT_CRONET_CLIENT_SECURE_CRONET_CHANNEL_CREATE_H
+
+#include <grpc/support/port_platform.h>
+
+#include <grpc/grpc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
+    void* engine, const char* target, const grpc_channel_args* args,
+    void* reserved);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_CORE_EXT_TRANSPORT_CRONET_CLIENT_SECURE_CRONET_CHANNEL_CREATE_H \
+        */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc b/legacy-libs/grpc/deps/grpc/src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc
new file mode 100644 (file)
index 0000000..8df100f
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright 2016 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include <grpc/grpc.h>
+
+void grpc_http_filters_init(void);
+void grpc_http_filters_shutdown(void);
+void grpc_chttp2_plugin_init(void);
+void grpc_chttp2_plugin_shutdown(void);
+void grpc_deadline_filter_init(void);
+void grpc_deadline_filter_shutdown(void);
+void grpc_client_channel_init(void);
+void grpc_client_channel_shutdown(void);
+
+void grpc_register_built_in_plugins(void) {
+  grpc_register_plugin(grpc_http_filters_init, grpc_http_filters_shutdown);
+  grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown);
+  grpc_register_plugin(grpc_deadline_filter_init,
+                       grpc_deadline_filter_shutdown);
+  grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown);
+}
index 3ddda26..19477bf 100644 (file)
@@ -30,7 +30,6 @@
 #include "src/core/ext/transport/chttp2/transport/incoming_metadata.h"
 #include "src/core/ext/transport/cronet/transport/cronet_transport.h"
 #include "src/core/lib/debug/trace.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/endpoint.h"
@@ -41,7 +40,9 @@
 #include "src/core/lib/surface/validate_metadata.h"
 #include "src/core/lib/transport/metadata_batch.h"
 #include "src/core/lib/transport/static_metadata.h"
+#include "src/core/lib/transport/timeout_encoding.h"
 #include "src/core/lib/transport/transport_impl.h"
+
 #include "third_party/objective_c/Cronet/bidirectional_stream_c.h"
 
 #define GRPC_HEADER_SIZE_IN_BYTES 5
@@ -718,16 +719,20 @@ static void create_grpc_frame(grpc_slice_buffer* write_slice_buffer,
  Convert metadata in a format that Cronet can consume
 */
 static void convert_metadata_to_cronet_headers(
-    grpc_linked_mdelem* head, const char* host, char** pp_url,
+    grpc_metadata_batch* metadata, const char* host, char** pp_url,
     bidirectional_stream_header** pp_headers, size_t* p_num_headers,
     const char** method) {
-  grpc_linked_mdelem* curr = head;
+  grpc_linked_mdelem* curr = metadata->list.head;
   /* Walk the linked list and get number of header fields */
   size_t num_headers_available = 0;
   while (curr != nullptr) {
     curr = curr->next;
     num_headers_available++;
   }
+  grpc_millis deadline = metadata->deadline;
+  if (deadline != GRPC_MILLIS_INF_FUTURE) {
+    num_headers_available++;
+  }
   /* Allocate enough memory. It is freed in the on_stream_ready callback
    */
   bidirectional_stream_header* headers =
@@ -740,7 +745,7 @@ static void convert_metadata_to_cronet_headers(
     are not used for cronet.
     TODO (makdharma): Eliminate need to traverse the LL second time for perf.
    */
-  curr = head;
+  curr = metadata->list.head;
   size_t num_headers = 0;
   while (num_headers < num_headers_available) {
     grpc_mdelem mdelem = curr->md;
@@ -788,6 +793,18 @@ static void convert_metadata_to_cronet_headers(
       break;
     }
   }
+  if (deadline != GRPC_MILLIS_INF_FUTURE) {
+    char* key = grpc_slice_to_c_string(GRPC_MDSTR_GRPC_TIMEOUT);
+    char* value =
+        static_cast<char*>(gpr_malloc(GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE));
+    grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(),
+                              value);
+    headers[num_headers].key = key;
+    headers[num_headers].value = value;
+
+    num_headers++;
+  }
+
   *p_num_headers = num_headers;
 }
 
@@ -1028,10 +1045,10 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
     char* url = nullptr;
     const char* method = "POST";
     s->header_array.headers = nullptr;
-    convert_metadata_to_cronet_headers(stream_op->payload->send_initial_metadata
-                                           .send_initial_metadata->list.head,
-                                       t->host, &url, &s->header_array.headers,
-                                       &s->header_array.count, &method);
+    convert_metadata_to_cronet_headers(
+        stream_op->payload->send_initial_metadata.send_initial_metadata,
+        t->host, &url, &s->header_array.headers, &s->header_array.count,
+        &method);
     s->header_array.capacity = s->header_array.count;
     CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url);
     bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false);
index 8da8985..a7f6787 100644 (file)
@@ -1203,7 +1203,7 @@ void inproc_transports_create(grpc_transport** server_transport,
  */
 void grpc_inproc_transport_init(void) {
   grpc_core::ExecCtx exec_ctx;
-  g_empty_slice = grpc_slice_from_static_buffer(nullptr, 0);
+  g_empty_slice = grpc_core::ExternallyManagedSlice();
 
   grpc_slice key_tmp = grpc_slice_from_static_string(":path");
   g_fake_path_key = grpc_slice_intern(key_tmp);
index e8a2fb3..f1deb30 100644 (file)
@@ -11,6 +11,8 @@
 #include "envoy/api/v2/auth/cert.upb.h"
 #include "envoy/api/v2/core/base.upb.h"
 #include "envoy/api/v2/core/config_source.upb.h"
+#include "google/protobuf/any.upb.h"
+#include "google/protobuf/struct.upb.h"
 #include "google/protobuf/wrappers.upb.h"
 #include "validate/validate.upb.h"
 #include "gogoproto/gogo.upb.h"
@@ -30,22 +32,41 @@ const upb_msglayout envoy_api_v2_auth_TlsParameters_msginit = {
   UPB_SIZE(24, 32), 4, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_auth_TlsCertificate_submsgs[5] = {
+static const upb_msglayout *const envoy_api_v2_auth_PrivateKeyProvider_submsgs[2] = {
+  &google_protobuf_Any_msginit,
+  &google_protobuf_Struct_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_auth_PrivateKeyProvider__fields[3] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 1, 11, 1},
+  {3, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 0, 11, 1},
+};
+
+const upb_msglayout envoy_api_v2_auth_PrivateKeyProvider_msginit = {
+  &envoy_api_v2_auth_PrivateKeyProvider_submsgs[0],
+  &envoy_api_v2_auth_PrivateKeyProvider__fields[0],
+  UPB_SIZE(16, 32), 3, false,
+};
+
+static const upb_msglayout *const envoy_api_v2_auth_TlsCertificate_submsgs[6] = {
+  &envoy_api_v2_auth_PrivateKeyProvider_msginit,
   &envoy_api_v2_core_DataSource_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_auth_TlsCertificate__fields[5] = {
-  {1, UPB_SIZE(0, 0), 0, 0, 11, 1},
-  {2, UPB_SIZE(4, 8), 0, 0, 11, 1},
-  {3, UPB_SIZE(8, 16), 0, 0, 11, 1},
-  {4, UPB_SIZE(12, 24), 0, 0, 11, 1},
-  {5, UPB_SIZE(16, 32), 0, 0, 11, 3},
+static const upb_msglayout_field envoy_api_v2_auth_TlsCertificate__fields[6] = {
+  {1, UPB_SIZE(0, 0), 0, 1, 11, 1},
+  {2, UPB_SIZE(4, 8), 0, 1, 11, 1},
+  {3, UPB_SIZE(8, 16), 0, 1, 11, 1},
+  {4, UPB_SIZE(12, 24), 0, 1, 11, 1},
+  {5, UPB_SIZE(20, 40), 0, 1, 11, 3},
+  {6, UPB_SIZE(16, 32), 0, 0, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_auth_TlsCertificate_msginit = {
   &envoy_api_v2_auth_TlsCertificate_submsgs[0],
   &envoy_api_v2_auth_TlsCertificate__fields[0],
-  UPB_SIZE(20, 40), 5, false,
+  UPB_SIZE(24, 48), 6, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_auth_TlsSessionTicketKeys_submsgs[1] = {
@@ -124,20 +145,22 @@ const upb_msglayout envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValida
   UPB_SIZE(8, 16), 2, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_auth_UpstreamTlsContext_submsgs[1] = {
+static const upb_msglayout *const envoy_api_v2_auth_UpstreamTlsContext_submsgs[2] = {
   &envoy_api_v2_auth_CommonTlsContext_msginit,
+  &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_auth_UpstreamTlsContext__fields[3] = {
+static const upb_msglayout_field envoy_api_v2_auth_UpstreamTlsContext__fields[4] = {
   {1, UPB_SIZE(12, 24), 0, 0, 11, 1},
   {2, UPB_SIZE(4, 8), 0, 0, 9, 1},
   {3, UPB_SIZE(0, 0), 0, 0, 8, 1},
+  {4, UPB_SIZE(16, 32), 0, 1, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_auth_UpstreamTlsContext_msginit = {
   &envoy_api_v2_auth_UpstreamTlsContext_submsgs[0],
   &envoy_api_v2_auth_UpstreamTlsContext__fields[0],
-  UPB_SIZE(16, 32), 3, false,
+  UPB_SIZE(24, 48), 4, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_auth_DownstreamTlsContext_submsgs[5] = {
index 2237934..252d9d7 100644 (file)
 #define ENVOY_API_V2_AUTH_CERT_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct envoy_api_v2_auth_TlsParameters;
+struct envoy_api_v2_auth_PrivateKeyProvider;
 struct envoy_api_v2_auth_TlsCertificate;
 struct envoy_api_v2_auth_TlsSessionTicketKeys;
 struct envoy_api_v2_auth_CertificateValidationContext;
@@ -31,6 +32,7 @@ struct envoy_api_v2_auth_DownstreamTlsContext;
 struct envoy_api_v2_auth_SdsSecretConfig;
 struct envoy_api_v2_auth_Secret;
 typedef struct envoy_api_v2_auth_TlsParameters envoy_api_v2_auth_TlsParameters;
+typedef struct envoy_api_v2_auth_PrivateKeyProvider envoy_api_v2_auth_PrivateKeyProvider;
 typedef struct envoy_api_v2_auth_TlsCertificate envoy_api_v2_auth_TlsCertificate;
 typedef struct envoy_api_v2_auth_TlsSessionTicketKeys envoy_api_v2_auth_TlsSessionTicketKeys;
 typedef struct envoy_api_v2_auth_CertificateValidationContext envoy_api_v2_auth_CertificateValidationContext;
@@ -41,6 +43,7 @@ typedef struct envoy_api_v2_auth_DownstreamTlsContext envoy_api_v2_auth_Downstre
 typedef struct envoy_api_v2_auth_SdsSecretConfig envoy_api_v2_auth_SdsSecretConfig;
 typedef struct envoy_api_v2_auth_Secret envoy_api_v2_auth_Secret;
 extern const upb_msglayout envoy_api_v2_auth_TlsParameters_msginit;
+extern const upb_msglayout envoy_api_v2_auth_PrivateKeyProvider_msginit;
 extern const upb_msglayout envoy_api_v2_auth_TlsCertificate_msginit;
 extern const upb_msglayout envoy_api_v2_auth_TlsSessionTicketKeys_msginit;
 extern const upb_msglayout envoy_api_v2_auth_CertificateValidationContext_msginit;
@@ -52,12 +55,16 @@ extern const upb_msglayout envoy_api_v2_auth_SdsSecretConfig_msginit;
 extern const upb_msglayout envoy_api_v2_auth_Secret_msginit;
 struct envoy_api_v2_core_ConfigSource;
 struct envoy_api_v2_core_DataSource;
+struct google_protobuf_Any;
 struct google_protobuf_BoolValue;
+struct google_protobuf_Struct;
+struct google_protobuf_UInt32Value;
 extern const upb_msglayout envoy_api_v2_core_ConfigSource_msginit;
 extern const upb_msglayout envoy_api_v2_core_DataSource_msginit;
+extern const upb_msglayout google_protobuf_Any_msginit;
 extern const upb_msglayout google_protobuf_BoolValue_msginit;
-
-/* Enums */
+extern const upb_msglayout google_protobuf_Struct_msginit;
+extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
 typedef enum {
   envoy_api_v2_auth_TlsParameters_TLS_AUTO = 0,
@@ -73,9 +80,10 @@ typedef enum {
 UPB_INLINE envoy_api_v2_auth_TlsParameters *envoy_api_v2_auth_TlsParameters_new(upb_arena *arena) {
   return (envoy_api_v2_auth_TlsParameters *)upb_msg_new(&envoy_api_v2_auth_TlsParameters_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_TlsParameters *envoy_api_v2_auth_TlsParameters_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_TlsParameters *envoy_api_v2_auth_TlsParameters_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_TlsParameters *ret = envoy_api_v2_auth_TlsParameters_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_TlsParameters_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_TlsParameters_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_TlsParameters_serialize(const envoy_api_v2_auth_TlsParameters *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_TlsParameters_msginit, arena, len);
@@ -113,15 +121,70 @@ UPB_INLINE bool envoy_api_v2_auth_TlsParameters_add_ecdh_curves(envoy_api_v2_aut
       msg, UPB_SIZE(20, 24), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 
+/* envoy.api.v2.auth.PrivateKeyProvider */
+
+UPB_INLINE envoy_api_v2_auth_PrivateKeyProvider *envoy_api_v2_auth_PrivateKeyProvider_new(upb_arena *arena) {
+  return (envoy_api_v2_auth_PrivateKeyProvider *)upb_msg_new(&envoy_api_v2_auth_PrivateKeyProvider_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_auth_PrivateKeyProvider *envoy_api_v2_auth_PrivateKeyProvider_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_auth_PrivateKeyProvider *ret = envoy_api_v2_auth_PrivateKeyProvider_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_PrivateKeyProvider_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_auth_PrivateKeyProvider_serialize(const envoy_api_v2_auth_PrivateKeyProvider *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_auth_PrivateKeyProvider_msginit, arena, len);
+}
+
+typedef enum {
+  envoy_api_v2_auth_PrivateKeyProvider_config_type_config = 2,
+  envoy_api_v2_auth_PrivateKeyProvider_config_type_typed_config = 3,
+  envoy_api_v2_auth_PrivateKeyProvider_config_type_NOT_SET = 0
+} envoy_api_v2_auth_PrivateKeyProvider_config_type_oneofcases;
+UPB_INLINE envoy_api_v2_auth_PrivateKeyProvider_config_type_oneofcases envoy_api_v2_auth_PrivateKeyProvider_config_type_case(const envoy_api_v2_auth_PrivateKeyProvider* msg) { return (envoy_api_v2_auth_PrivateKeyProvider_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
+
+UPB_INLINE upb_strview envoy_api_v2_auth_PrivateKeyProvider_provider_name(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE bool envoy_api_v2_auth_PrivateKeyProvider_has_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
+UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_auth_PrivateKeyProvider_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Struct*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 2, NULL); }
+UPB_INLINE bool envoy_api_v2_auth_PrivateKeyProvider_has_typed_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); }
+UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_auth_PrivateKeyProvider_typed_config(const envoy_api_v2_auth_PrivateKeyProvider *msg) { return UPB_READ_ONEOF(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 3, NULL); }
+
+UPB_INLINE void envoy_api_v2_auth_PrivateKeyProvider_set_provider_name(envoy_api_v2_auth_PrivateKeyProvider *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_auth_PrivateKeyProvider_set_config(envoy_api_v2_auth_PrivateKeyProvider *msg, struct google_protobuf_Struct* value) {
+  UPB_WRITE_ONEOF(msg, struct google_protobuf_Struct*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 2);
+}
+UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_auth_PrivateKeyProvider_mutable_config(envoy_api_v2_auth_PrivateKeyProvider *msg, upb_arena *arena) {
+  struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_auth_PrivateKeyProvider_config(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_auth_PrivateKeyProvider_set_config(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_auth_PrivateKeyProvider_set_typed_config(envoy_api_v2_auth_PrivateKeyProvider *msg, struct google_protobuf_Any* value) {
+  UPB_WRITE_ONEOF(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 3);
+}
+UPB_INLINE struct google_protobuf_Any* envoy_api_v2_auth_PrivateKeyProvider_mutable_typed_config(envoy_api_v2_auth_PrivateKeyProvider *msg, upb_arena *arena) {
+  struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_auth_PrivateKeyProvider_typed_config(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_auth_PrivateKeyProvider_set_typed_config(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.auth.TlsCertificate */
 
 UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_new(upb_arena *arena) {
   return (envoy_api_v2_auth_TlsCertificate *)upb_msg_new(&envoy_api_v2_auth_TlsCertificate_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_TlsCertificate *ret = envoy_api_v2_auth_TlsCertificate_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_TlsCertificate_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_TlsCertificate_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_TlsCertificate_serialize(const envoy_api_v2_auth_TlsCertificate *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_TlsCertificate_msginit, arena, len);
@@ -131,7 +194,8 @@ UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCerti
 UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_private_key(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_DataSource*, UPB_SIZE(4, 8)); }
 UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_password(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_DataSource*, UPB_SIZE(8, 16)); }
 UPB_INLINE const struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_ocsp_staple(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_DataSource*, UPB_SIZE(12, 24)); }
-UPB_INLINE const struct envoy_api_v2_core_DataSource* const* envoy_api_v2_auth_TlsCertificate_signed_certificate_timestamp(const envoy_api_v2_auth_TlsCertificate *msg, size_t *len) { return (const struct envoy_api_v2_core_DataSource* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
+UPB_INLINE const struct envoy_api_v2_core_DataSource* const* envoy_api_v2_auth_TlsCertificate_signed_certificate_timestamp(const envoy_api_v2_auth_TlsCertificate *msg, size_t *len) { return (const struct envoy_api_v2_core_DataSource* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
+UPB_INLINE const envoy_api_v2_auth_PrivateKeyProvider* envoy_api_v2_auth_TlsCertificate_private_key_provider(const envoy_api_v2_auth_TlsCertificate *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_PrivateKeyProvider*, UPB_SIZE(16, 32)); }
 
 UPB_INLINE void envoy_api_v2_auth_TlsCertificate_set_certificate_chain(envoy_api_v2_auth_TlsCertificate *msg, struct envoy_api_v2_core_DataSource* value) {
   UPB_FIELD_AT(msg, struct envoy_api_v2_core_DataSource*, UPB_SIZE(0, 0)) = value;
@@ -182,28 +246,40 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate
   return sub;
 }
 UPB_INLINE struct envoy_api_v2_core_DataSource** envoy_api_v2_auth_TlsCertificate_mutable_signed_certificate_timestamp(envoy_api_v2_auth_TlsCertificate *msg, size_t *len) {
-  return (struct envoy_api_v2_core_DataSource**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
+  return (struct envoy_api_v2_core_DataSource**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
 }
 UPB_INLINE struct envoy_api_v2_core_DataSource** envoy_api_v2_auth_TlsCertificate_resize_signed_certificate_timestamp(envoy_api_v2_auth_TlsCertificate *msg, size_t len, upb_arena *arena) {
-  return (struct envoy_api_v2_core_DataSource**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (struct envoy_api_v2_core_DataSource**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate_add_signed_certificate_timestamp(envoy_api_v2_auth_TlsCertificate *msg, upb_arena *arena) {
   struct envoy_api_v2_core_DataSource* sub = (struct envoy_api_v2_core_DataSource*)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_auth_TlsCertificate_set_private_key_provider(envoy_api_v2_auth_TlsCertificate *msg, envoy_api_v2_auth_PrivateKeyProvider* value) {
+  UPB_FIELD_AT(msg, envoy_api_v2_auth_PrivateKeyProvider*, UPB_SIZE(16, 32)) = value;
+}
+UPB_INLINE struct envoy_api_v2_auth_PrivateKeyProvider* envoy_api_v2_auth_TlsCertificate_mutable_private_key_provider(envoy_api_v2_auth_TlsCertificate *msg, upb_arena *arena) {
+  struct envoy_api_v2_auth_PrivateKeyProvider* sub = (struct envoy_api_v2_auth_PrivateKeyProvider*)envoy_api_v2_auth_TlsCertificate_private_key_provider(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_auth_PrivateKeyProvider*)upb_msg_new(&envoy_api_v2_auth_PrivateKeyProvider_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_auth_TlsCertificate_set_private_key_provider(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.auth.TlsSessionTicketKeys */
 
 UPB_INLINE envoy_api_v2_auth_TlsSessionTicketKeys *envoy_api_v2_auth_TlsSessionTicketKeys_new(upb_arena *arena) {
   return (envoy_api_v2_auth_TlsSessionTicketKeys *)upb_msg_new(&envoy_api_v2_auth_TlsSessionTicketKeys_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_TlsSessionTicketKeys *envoy_api_v2_auth_TlsSessionTicketKeys_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_TlsSessionTicketKeys *envoy_api_v2_auth_TlsSessionTicketKeys_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_TlsSessionTicketKeys *ret = envoy_api_v2_auth_TlsSessionTicketKeys_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_TlsSessionTicketKeys_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_TlsSessionTicketKeys_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_TlsSessionTicketKeys_serialize(const envoy_api_v2_auth_TlsSessionTicketKeys *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_TlsSessionTicketKeys_msginit, arena, len);
@@ -225,15 +301,15 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsSessionTick
   return sub;
 }
 
-
 /* envoy.api.v2.auth.CertificateValidationContext */
 
 UPB_INLINE envoy_api_v2_auth_CertificateValidationContext *envoy_api_v2_auth_CertificateValidationContext_new(upb_arena *arena) {
   return (envoy_api_v2_auth_CertificateValidationContext *)upb_msg_new(&envoy_api_v2_auth_CertificateValidationContext_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_CertificateValidationContext *envoy_api_v2_auth_CertificateValidationContext_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_CertificateValidationContext *envoy_api_v2_auth_CertificateValidationContext_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_CertificateValidationContext *ret = envoy_api_v2_auth_CertificateValidationContext_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_CertificateValidationContext_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_CertificateValidationContext_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_CertificateValidationContext_serialize(const envoy_api_v2_auth_CertificateValidationContext *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_CertificateValidationContext_msginit, arena, len);
@@ -330,15 +406,15 @@ UPB_INLINE void envoy_api_v2_auth_CertificateValidationContext_set_allow_expired
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.auth.CommonTlsContext */
 
 UPB_INLINE envoy_api_v2_auth_CommonTlsContext *envoy_api_v2_auth_CommonTlsContext_new(upb_arena *arena) {
   return (envoy_api_v2_auth_CommonTlsContext *)upb_msg_new(&envoy_api_v2_auth_CommonTlsContext_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_CommonTlsContext *envoy_api_v2_auth_CommonTlsContext_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_CommonTlsContext *envoy_api_v2_auth_CommonTlsContext_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_CommonTlsContext *ret = envoy_api_v2_auth_CommonTlsContext_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_CommonTlsContext_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_CommonTlsContext_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_CommonTlsContext_serialize(const envoy_api_v2_auth_CommonTlsContext *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_CommonTlsContext_msginit, arena, len);
@@ -348,9 +424,9 @@ typedef enum {
   envoy_api_v2_auth_CommonTlsContext_validation_context_type_validation_context = 3,
   envoy_api_v2_auth_CommonTlsContext_validation_context_type_validation_context_sds_secret_config = 7,
   envoy_api_v2_auth_CommonTlsContext_validation_context_type_combined_validation_context = 8,
-  envoy_api_v2_auth_CommonTlsContext_validation_context_type_NOT_SET = 0,
+  envoy_api_v2_auth_CommonTlsContext_validation_context_type_NOT_SET = 0
 } envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases;
-UPB_INLINE envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases envoy_api_v2_auth_CommonTlsContext_validation_context_type_case(const envoy_api_v2_auth_CommonTlsContext* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(20, 40)); }
+UPB_INLINE envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases envoy_api_v2_auth_CommonTlsContext_validation_context_type_case(const envoy_api_v2_auth_CommonTlsContext* msg) { return (envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(20, 40)); }
 
 UPB_INLINE const envoy_api_v2_auth_TlsParameters* envoy_api_v2_auth_CommonTlsContext_tls_params(const envoy_api_v2_auth_CommonTlsContext *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_TlsParameters*, UPB_SIZE(0, 0)); }
 UPB_INLINE const envoy_api_v2_auth_TlsCertificate* const* envoy_api_v2_auth_CommonTlsContext_tls_certificates(const envoy_api_v2_auth_CommonTlsContext *msg, size_t *len) { return (const envoy_api_v2_auth_TlsCertificate* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
@@ -448,15 +524,15 @@ UPB_INLINE struct envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidati
   return sub;
 }
 
-
 /* envoy.api.v2.auth.CommonTlsContext.CombinedCertificateValidationContext */
 
 UPB_INLINE envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_new(upb_arena *arena) {
   return (envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *)upb_msg_new(&envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *ret = envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_serialize(const envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit, arena, len);
@@ -490,15 +566,15 @@ UPB_INLINE struct envoy_api_v2_auth_SdsSecretConfig* envoy_api_v2_auth_CommonTls
   return sub;
 }
 
-
 /* envoy.api.v2.auth.UpstreamTlsContext */
 
 UPB_INLINE envoy_api_v2_auth_UpstreamTlsContext *envoy_api_v2_auth_UpstreamTlsContext_new(upb_arena *arena) {
   return (envoy_api_v2_auth_UpstreamTlsContext *)upb_msg_new(&envoy_api_v2_auth_UpstreamTlsContext_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_UpstreamTlsContext *envoy_api_v2_auth_UpstreamTlsContext_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_UpstreamTlsContext *envoy_api_v2_auth_UpstreamTlsContext_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_UpstreamTlsContext *ret = envoy_api_v2_auth_UpstreamTlsContext_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_UpstreamTlsContext_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_UpstreamTlsContext_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_UpstreamTlsContext_serialize(const envoy_api_v2_auth_UpstreamTlsContext *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_UpstreamTlsContext_msginit, arena, len);
@@ -507,6 +583,7 @@ UPB_INLINE char *envoy_api_v2_auth_UpstreamTlsContext_serialize(const envoy_api_
 UPB_INLINE const envoy_api_v2_auth_CommonTlsContext* envoy_api_v2_auth_UpstreamTlsContext_common_tls_context(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_CommonTlsContext*, UPB_SIZE(12, 24)); }
 UPB_INLINE upb_strview envoy_api_v2_auth_UpstreamTlsContext_sni(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
 UPB_INLINE bool envoy_api_v2_auth_UpstreamTlsContext_allow_renegotiation(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_auth_UpstreamTlsContext_max_session_keys(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); }
 
 UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_common_tls_context(envoy_api_v2_auth_UpstreamTlsContext *msg, envoy_api_v2_auth_CommonTlsContext* value) {
   UPB_FIELD_AT(msg, envoy_api_v2_auth_CommonTlsContext*, UPB_SIZE(12, 24)) = value;
@@ -526,16 +603,28 @@ UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_sni(envoy_api_v2_auth_U
 UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_allow_renegotiation(envoy_api_v2_auth_UpstreamTlsContext *msg, bool value) {
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
-
+UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_max_session_keys(envoy_api_v2_auth_UpstreamTlsContext *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_auth_UpstreamTlsContext_mutable_max_session_keys(envoy_api_v2_auth_UpstreamTlsContext *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_auth_UpstreamTlsContext_max_session_keys(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_auth_UpstreamTlsContext_set_max_session_keys(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.auth.DownstreamTlsContext */
 
 UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext *envoy_api_v2_auth_DownstreamTlsContext_new(upb_arena *arena) {
   return (envoy_api_v2_auth_DownstreamTlsContext *)upb_msg_new(&envoy_api_v2_auth_DownstreamTlsContext_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext *envoy_api_v2_auth_DownstreamTlsContext_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext *envoy_api_v2_auth_DownstreamTlsContext_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_DownstreamTlsContext *ret = envoy_api_v2_auth_DownstreamTlsContext_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_DownstreamTlsContext_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_DownstreamTlsContext_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_DownstreamTlsContext_serialize(const envoy_api_v2_auth_DownstreamTlsContext *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_DownstreamTlsContext_msginit, arena, len);
@@ -544,9 +633,9 @@ UPB_INLINE char *envoy_api_v2_auth_DownstreamTlsContext_serialize(const envoy_ap
 typedef enum {
   envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_session_ticket_keys = 4,
   envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_session_ticket_keys_sds_secret_config = 5,
-  envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_NOT_SET = 0,
+  envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_NOT_SET = 0
 } envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases;
-UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_case(const envoy_api_v2_auth_DownstreamTlsContext* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(16, 32)); }
+UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_case(const envoy_api_v2_auth_DownstreamTlsContext* msg) { return (envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 32)); }
 
 UPB_INLINE const envoy_api_v2_auth_CommonTlsContext* envoy_api_v2_auth_DownstreamTlsContext_common_tls_context(const envoy_api_v2_auth_DownstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_CommonTlsContext*, UPB_SIZE(0, 0)); }
 UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_auth_DownstreamTlsContext_require_client_certificate(const envoy_api_v2_auth_DownstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(4, 8)); }
@@ -617,15 +706,15 @@ UPB_INLINE struct envoy_api_v2_auth_SdsSecretConfig* envoy_api_v2_auth_Downstrea
   return sub;
 }
 
-
 /* envoy.api.v2.auth.SdsSecretConfig */
 
 UPB_INLINE envoy_api_v2_auth_SdsSecretConfig *envoy_api_v2_auth_SdsSecretConfig_new(upb_arena *arena) {
   return (envoy_api_v2_auth_SdsSecretConfig *)upb_msg_new(&envoy_api_v2_auth_SdsSecretConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_SdsSecretConfig *envoy_api_v2_auth_SdsSecretConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_SdsSecretConfig *envoy_api_v2_auth_SdsSecretConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_SdsSecretConfig *ret = envoy_api_v2_auth_SdsSecretConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_SdsSecretConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_SdsSecretConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_SdsSecretConfig_serialize(const envoy_api_v2_auth_SdsSecretConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_SdsSecretConfig_msginit, arena, len);
@@ -650,15 +739,15 @@ UPB_INLINE struct envoy_api_v2_core_ConfigSource* envoy_api_v2_auth_SdsSecretCon
   return sub;
 }
 
-
 /* envoy.api.v2.auth.Secret */
 
 UPB_INLINE envoy_api_v2_auth_Secret *envoy_api_v2_auth_Secret_new(upb_arena *arena) {
   return (envoy_api_v2_auth_Secret *)upb_msg_new(&envoy_api_v2_auth_Secret_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_auth_Secret *envoy_api_v2_auth_Secret_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_auth_Secret *envoy_api_v2_auth_Secret_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_auth_Secret *ret = envoy_api_v2_auth_Secret_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_Secret_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_Secret_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_auth_Secret_serialize(const envoy_api_v2_auth_Secret *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_auth_Secret_msginit, arena, len);
@@ -668,9 +757,9 @@ typedef enum {
   envoy_api_v2_auth_Secret_type_tls_certificate = 2,
   envoy_api_v2_auth_Secret_type_session_ticket_keys = 3,
   envoy_api_v2_auth_Secret_type_validation_context = 4,
-  envoy_api_v2_auth_Secret_type_NOT_SET = 0,
+  envoy_api_v2_auth_Secret_type_NOT_SET = 0
 } envoy_api_v2_auth_Secret_type_oneofcases;
-UPB_INLINE envoy_api_v2_auth_Secret_type_oneofcases envoy_api_v2_auth_Secret_type_case(const envoy_api_v2_auth_Secret* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
+UPB_INLINE envoy_api_v2_auth_Secret_type_oneofcases envoy_api_v2_auth_Secret_type_case(const envoy_api_v2_auth_Secret* msg) { return (envoy_api_v2_auth_Secret_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
 
 UPB_INLINE upb_strview envoy_api_v2_auth_Secret_name(const envoy_api_v2_auth_Secret *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
 UPB_INLINE bool envoy_api_v2_auth_Secret_has_tls_certificate(const envoy_api_v2_auth_Secret *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
@@ -720,7 +809,6 @@ UPB_INLINE struct envoy_api_v2_auth_CertificateValidationContext* envoy_api_v2_a
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 91a25cd..9a0b48a 100644 (file)
@@ -17,6 +17,7 @@
 #include "envoy/api/v2/core/health_check.upb.h"
 #include "envoy/api/v2/core/protocol.upb.h"
 #include "envoy/api/v2/cluster/circuit_breaker.upb.h"
+#include "envoy/api/v2/cluster/filter.upb.h"
 #include "envoy/api/v2/cluster/outlier_detection.upb.h"
 #include "envoy/api/v2/eds.upb.h"
 #include "envoy/type/percent.upb.h"
 
 #include "upb/port_def.inc"
 
-static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[26] = {
+static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[29] = {
   &envoy_api_v2_Cluster_CommonLbConfig_msginit,
+  &envoy_api_v2_Cluster_CustomClusterType_msginit,
   &envoy_api_v2_Cluster_EdsClusterConfig_msginit,
   &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit,
   &envoy_api_v2_Cluster_LbSubsetConfig_msginit,
+  &envoy_api_v2_Cluster_LeastRequestLbConfig_msginit,
   &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit,
   &envoy_api_v2_Cluster_RingHashLbConfig_msginit,
   &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit,
@@ -42,6 +45,7 @@ static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[26] = {
   &envoy_api_v2_UpstreamConnectionOptions_msginit,
   &envoy_api_v2_auth_UpstreamTlsContext_msginit,
   &envoy_api_v2_cluster_CircuitBreakers_msginit,
+  &envoy_api_v2_cluster_Filter_msginit,
   &envoy_api_v2_cluster_OutlierDetection_msginit,
   &envoy_api_v2_core_Address_msginit,
   &envoy_api_v2_core_BindConfig_msginit,
@@ -55,47 +59,66 @@ static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[26] = {
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_Cluster__fields[34] = {
-  {1, UPB_SIZE(36, 40), 0, 0, 9, 1},
-  {2, UPB_SIZE(0, 0), 0, 0, 14, 1},
-  {3, UPB_SIZE(52, 72), 0, 1, 11, 1},
-  {4, UPB_SIZE(56, 80), 0, 20, 11, 1},
-  {5, UPB_SIZE(60, 88), 0, 21, 11, 1},
-  {6, UPB_SIZE(8, 8), 0, 0, 14, 1},
-  {7, UPB_SIZE(128, 224), 0, 12, 11, 3},
-  {8, UPB_SIZE(132, 232), 0, 14, 11, 3},
-  {9, UPB_SIZE(64, 96), 0, 21, 11, 1},
-  {10, UPB_SIZE(68, 104), 0, 10, 11, 1},
-  {11, UPB_SIZE(72, 112), 0, 9, 11, 1},
-  {13, UPB_SIZE(76, 120), 0, 15, 11, 1},
-  {14, UPB_SIZE(80, 128), 0, 16, 11, 1},
-  {16, UPB_SIZE(84, 136), 0, 20, 11, 1},
-  {17, UPB_SIZE(16, 16), 0, 0, 14, 1},
-  {18, UPB_SIZE(136, 240), 0, 12, 11, 3},
-  {19, UPB_SIZE(88, 144), 0, 11, 11, 1},
-  {20, UPB_SIZE(92, 152), 0, 20, 11, 1},
-  {21, UPB_SIZE(96, 160), 0, 13, 11, 1},
-  {22, UPB_SIZE(100, 168), 0, 3, 11, 1},
-  {23, UPB_SIZE(148, 264), UPB_SIZE(-153, -273), 5, 11, 1},
-  {24, UPB_SIZE(104, 176), 0, 19, 11, 1},
-  {25, UPB_SIZE(108, 184), 0, 18, 11, 1},
-  {26, UPB_SIZE(24, 24), 0, 0, 14, 1},
-  {27, UPB_SIZE(112, 192), 0, 0, 11, 1},
-  {28, UPB_SIZE(44, 56), 0, 0, 9, 1},
-  {29, UPB_SIZE(116, 200), 0, 17, 11, 1},
-  {30, UPB_SIZE(120, 208), 0, 8, 11, 1},
-  {31, UPB_SIZE(32, 32), 0, 0, 8, 1},
-  {32, UPB_SIZE(33, 33), 0, 0, 8, 1},
-  {33, UPB_SIZE(124, 216), 0, 7, 11, 1},
-  {34, UPB_SIZE(148, 264), UPB_SIZE(-153, -273), 4, 11, 1},
-  {35, UPB_SIZE(140, 248), 0, 2, 11, 3},
-  {36, UPB_SIZE(144, 256), 0, 6, 11, 3},
+static const upb_msglayout_field envoy_api_v2_Cluster__fields[38] = {
+  {1, UPB_SIZE(28, 32), 0, 0, 9, 1},
+  {2, UPB_SIZE(144, 264), UPB_SIZE(-153, -273), 0, 14, 1},
+  {3, UPB_SIZE(44, 64), 0, 2, 11, 1},
+  {4, UPB_SIZE(48, 72), 0, 23, 11, 1},
+  {5, UPB_SIZE(52, 80), 0, 24, 11, 1},
+  {6, UPB_SIZE(0, 0), 0, 0, 14, 1},
+  {7, UPB_SIZE(120, 216), 0, 15, 11, 3},
+  {8, UPB_SIZE(124, 224), 0, 17, 11, 3},
+  {9, UPB_SIZE(56, 88), 0, 24, 11, 1},
+  {10, UPB_SIZE(60, 96), 0, 12, 11, 1},
+  {11, UPB_SIZE(64, 104), 0, 11, 11, 1},
+  {13, UPB_SIZE(68, 112), 0, 18, 11, 1},
+  {14, UPB_SIZE(72, 120), 0, 19, 11, 1},
+  {16, UPB_SIZE(76, 128), 0, 23, 11, 1},
+  {17, UPB_SIZE(8, 8), 0, 0, 14, 1},
+  {18, UPB_SIZE(128, 232), 0, 15, 11, 3},
+  {19, UPB_SIZE(80, 136), 0, 14, 11, 1},
+  {20, UPB_SIZE(84, 144), 0, 23, 11, 1},
+  {21, UPB_SIZE(88, 152), 0, 16, 11, 1},
+  {22, UPB_SIZE(92, 160), 0, 4, 11, 1},
+  {23, UPB_SIZE(156, 280), UPB_SIZE(-161, -289), 7, 11, 1},
+  {24, UPB_SIZE(96, 168), 0, 22, 11, 1},
+  {25, UPB_SIZE(100, 176), 0, 21, 11, 1},
+  {26, UPB_SIZE(16, 16), 0, 0, 14, 1},
+  {27, UPB_SIZE(104, 184), 0, 0, 11, 1},
+  {28, UPB_SIZE(36, 48), 0, 0, 9, 1},
+  {29, UPB_SIZE(108, 192), 0, 20, 11, 1},
+  {30, UPB_SIZE(112, 200), 0, 10, 11, 1},
+  {31, UPB_SIZE(24, 24), 0, 0, 8, 1},
+  {32, UPB_SIZE(25, 25), 0, 0, 8, 1},
+  {33, UPB_SIZE(116, 208), 0, 9, 11, 1},
+  {34, UPB_SIZE(156, 280), UPB_SIZE(-161, -289), 6, 11, 1},
+  {35, UPB_SIZE(132, 240), 0, 3, 11, 3},
+  {36, UPB_SIZE(136, 248), 0, 8, 11, 3},
+  {37, UPB_SIZE(156, 280), UPB_SIZE(-161, -289), 5, 11, 1},
+  {38, UPB_SIZE(144, 264), UPB_SIZE(-153, -273), 1, 11, 1},
+  {39, UPB_SIZE(26, 26), 0, 0, 8, 1},
+  {40, UPB_SIZE(140, 256), 0, 13, 11, 3},
 };
 
 const upb_msglayout envoy_api_v2_Cluster_msginit = {
   &envoy_api_v2_Cluster_submsgs[0],
   &envoy_api_v2_Cluster__fields[0],
-  UPB_SIZE(160, 288), 34, false,
+  UPB_SIZE(168, 304), 38, false,
+};
+
+static const upb_msglayout *const envoy_api_v2_Cluster_CustomClusterType_submsgs[1] = {
+  &google_protobuf_Any_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_Cluster_CustomClusterType__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
+};
+
+const upb_msglayout envoy_api_v2_Cluster_CustomClusterType_msginit = {
+  &envoy_api_v2_Cluster_CustomClusterType_submsgs[0],
+  &envoy_api_v2_Cluster_CustomClusterType__fields[0],
+  UPB_SIZE(16, 32), 2, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_Cluster_EdsClusterConfig_submsgs[1] = {
@@ -148,57 +171,61 @@ static const upb_msglayout *const envoy_api_v2_Cluster_LbSubsetConfig_submsgs[2]
   &google_protobuf_Struct_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig__fields[4] = {
+static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig__fields[7] = {
   {1, UPB_SIZE(0, 0), 0, 0, 14, 1},
   {2, UPB_SIZE(12, 16), 0, 1, 11, 1},
   {3, UPB_SIZE(16, 24), 0, 0, 11, 3},
   {4, UPB_SIZE(8, 8), 0, 0, 8, 1},
+  {5, UPB_SIZE(9, 9), 0, 0, 8, 1},
+  {6, UPB_SIZE(10, 10), 0, 0, 8, 1},
+  {7, UPB_SIZE(11, 11), 0, 0, 8, 1},
 };
 
 const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_msginit = {
   &envoy_api_v2_Cluster_LbSubsetConfig_submsgs[0],
   &envoy_api_v2_Cluster_LbSubsetConfig__fields[0],
-  UPB_SIZE(24, 32), 4, false,
+  UPB_SIZE(24, 32), 7, false,
 };
 
-static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[1] = {
-  {1, UPB_SIZE(0, 0), 0, 0, 9, 3},
+static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[2] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 9, 3},
+  {2, UPB_SIZE(0, 0), 0, 0, 14, 1},
 };
 
 const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit = {
   NULL,
   &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[0],
-  UPB_SIZE(4, 8), 1, false,
+  UPB_SIZE(16, 16), 2, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_Cluster_RingHashLbConfig_submsgs[2] = {
-  &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit,
-  &google_protobuf_UInt64Value_msginit,
+static const upb_msglayout *const envoy_api_v2_Cluster_LeastRequestLbConfig_submsgs[1] = {
+  &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_Cluster_RingHashLbConfig__fields[2] = {
-  {1, UPB_SIZE(0, 0), 0, 1, 11, 1},
-  {2, UPB_SIZE(4, 8), 0, 0, 11, 1},
+static const upb_msglayout_field envoy_api_v2_Cluster_LeastRequestLbConfig__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 1},
 };
 
-const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_msginit = {
-  &envoy_api_v2_Cluster_RingHashLbConfig_submsgs[0],
-  &envoy_api_v2_Cluster_RingHashLbConfig__fields[0],
-  UPB_SIZE(8, 16), 2, false,
+const upb_msglayout envoy_api_v2_Cluster_LeastRequestLbConfig_msginit = {
+  &envoy_api_v2_Cluster_LeastRequestLbConfig_submsgs[0],
+  &envoy_api_v2_Cluster_LeastRequestLbConfig__fields[0],
+  UPB_SIZE(4, 8), 1, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_submsgs[1] = {
-  &google_protobuf_BoolValue_msginit,
+static const upb_msglayout *const envoy_api_v2_Cluster_RingHashLbConfig_submsgs[2] = {
+  &google_protobuf_UInt64Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1__fields[1] = {
-  {1, UPB_SIZE(0, 0), 0, 0, 11, 1},
+static const upb_msglayout_field envoy_api_v2_Cluster_RingHashLbConfig__fields[3] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 11, 1},
+  {3, UPB_SIZE(0, 0), 0, 0, 14, 1},
+  {4, UPB_SIZE(12, 16), 0, 0, 11, 1},
 };
 
-const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit = {
-  &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_submsgs[0],
-  &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1__fields[0],
-  UPB_SIZE(4, 8), 1, false,
+const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_msginit = {
+  &envoy_api_v2_Cluster_RingHashLbConfig_submsgs[0],
+  &envoy_api_v2_Cluster_RingHashLbConfig__fields[0],
+  UPB_SIZE(16, 24), 3, false,
 };
 
 static const upb_msglayout_field envoy_api_v2_Cluster_OriginalDstLbConfig__fields[1] = {
@@ -218,17 +245,19 @@ static const upb_msglayout *const envoy_api_v2_Cluster_CommonLbConfig_submsgs[4]
   &google_protobuf_Duration_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_Cluster_CommonLbConfig__fields[4] = {
-  {1, UPB_SIZE(0, 0), 0, 2, 11, 1},
-  {2, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 1, 11, 1},
-  {3, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 0, 11, 1},
-  {4, UPB_SIZE(4, 8), 0, 3, 11, 1},
+static const upb_msglayout_field envoy_api_v2_Cluster_CommonLbConfig__fields[6] = {
+  {1, UPB_SIZE(4, 8), 0, 2, 11, 1},
+  {2, UPB_SIZE(12, 24), UPB_SIZE(-17, -33), 1, 11, 1},
+  {3, UPB_SIZE(12, 24), UPB_SIZE(-17, -33), 0, 11, 1},
+  {4, UPB_SIZE(8, 16), 0, 3, 11, 1},
+  {5, UPB_SIZE(0, 0), 0, 0, 8, 1},
+  {6, UPB_SIZE(1, 1), 0, 0, 8, 1},
 };
 
 const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_msginit = {
   &envoy_api_v2_Cluster_CommonLbConfig_submsgs[0],
   &envoy_api_v2_Cluster_CommonLbConfig__fields[0],
-  UPB_SIZE(16, 32), 4, false,
+  UPB_SIZE(20, 40), 6, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_submsgs[2] = {
index e960b82..5bc3319 100644 (file)
 #define ENVOY_API_V2_CDS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct envoy_api_v2_Cluster;
+struct envoy_api_v2_Cluster_CustomClusterType;
 struct envoy_api_v2_Cluster_EdsClusterConfig;
 struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry;
 struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry;
 struct envoy_api_v2_Cluster_LbSubsetConfig;
 struct envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector;
+struct envoy_api_v2_Cluster_LeastRequestLbConfig;
 struct envoy_api_v2_Cluster_RingHashLbConfig;
-struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1;
 struct envoy_api_v2_Cluster_OriginalDstLbConfig;
 struct envoy_api_v2_Cluster_CommonLbConfig;
 struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig;
@@ -35,13 +36,14 @@ struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig;
 struct envoy_api_v2_UpstreamBindConfig;
 struct envoy_api_v2_UpstreamConnectionOptions;
 typedef struct envoy_api_v2_Cluster envoy_api_v2_Cluster;
+typedef struct envoy_api_v2_Cluster_CustomClusterType envoy_api_v2_Cluster_CustomClusterType;
 typedef struct envoy_api_v2_Cluster_EdsClusterConfig envoy_api_v2_Cluster_EdsClusterConfig;
 typedef struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry;
 typedef struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry;
 typedef struct envoy_api_v2_Cluster_LbSubsetConfig envoy_api_v2_Cluster_LbSubsetConfig;
 typedef struct envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector;
+typedef struct envoy_api_v2_Cluster_LeastRequestLbConfig envoy_api_v2_Cluster_LeastRequestLbConfig;
 typedef struct envoy_api_v2_Cluster_RingHashLbConfig envoy_api_v2_Cluster_RingHashLbConfig;
-typedef struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1;
 typedef struct envoy_api_v2_Cluster_OriginalDstLbConfig envoy_api_v2_Cluster_OriginalDstLbConfig;
 typedef struct envoy_api_v2_Cluster_CommonLbConfig envoy_api_v2_Cluster_CommonLbConfig;
 typedef struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig;
@@ -49,13 +51,14 @@ typedef struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig envo
 typedef struct envoy_api_v2_UpstreamBindConfig envoy_api_v2_UpstreamBindConfig;
 typedef struct envoy_api_v2_UpstreamConnectionOptions envoy_api_v2_UpstreamConnectionOptions;
 extern const upb_msglayout envoy_api_v2_Cluster_msginit;
+extern const upb_msglayout envoy_api_v2_Cluster_CustomClusterType_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_EdsClusterConfig_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit;
+extern const upb_msglayout envoy_api_v2_Cluster_LeastRequestLbConfig_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_msginit;
-extern const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_OriginalDstLbConfig_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_msginit;
 extern const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit;
@@ -65,6 +68,7 @@ extern const upb_msglayout envoy_api_v2_UpstreamConnectionOptions_msginit;
 struct envoy_api_v2_ClusterLoadAssignment;
 struct envoy_api_v2_auth_UpstreamTlsContext;
 struct envoy_api_v2_cluster_CircuitBreakers;
+struct envoy_api_v2_cluster_Filter;
 struct envoy_api_v2_cluster_OutlierDetection;
 struct envoy_api_v2_core_Address;
 struct envoy_api_v2_core_BindConfig;
@@ -78,7 +82,6 @@ struct envoy_api_v2_core_TcpKeepalive;
 struct envoy_api_v2_core_TransportSocket;
 struct envoy_type_Percent;
 struct google_protobuf_Any;
-struct google_protobuf_BoolValue;
 struct google_protobuf_Duration;
 struct google_protobuf_Struct;
 struct google_protobuf_UInt32Value;
@@ -86,6 +89,7 @@ struct google_protobuf_UInt64Value;
 extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_msginit;
 extern const upb_msglayout envoy_api_v2_auth_UpstreamTlsContext_msginit;
 extern const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_msginit;
+extern const upb_msglayout envoy_api_v2_cluster_Filter_msginit;
 extern const upb_msglayout envoy_api_v2_cluster_OutlierDetection_msginit;
 extern const upb_msglayout envoy_api_v2_core_Address_msginit;
 extern const upb_msglayout envoy_api_v2_core_BindConfig_msginit;
@@ -99,14 +103,11 @@ extern const upb_msglayout envoy_api_v2_core_TcpKeepalive_msginit;
 extern const upb_msglayout envoy_api_v2_core_TransportSocket_msginit;
 extern const upb_msglayout envoy_type_Percent_msginit;
 extern const upb_msglayout google_protobuf_Any_msginit;
-extern const upb_msglayout google_protobuf_BoolValue_msginit;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_Struct_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 extern const upb_msglayout google_protobuf_UInt64Value_msginit;
 
-/* Enums */
-
 typedef enum {
   envoy_api_v2_Cluster_USE_CONFIGURED_PROTOCOL = 0,
   envoy_api_v2_Cluster_USE_DOWNSTREAM_PROTOCOL = 1
@@ -132,7 +133,8 @@ typedef enum {
   envoy_api_v2_Cluster_RING_HASH = 2,
   envoy_api_v2_Cluster_RANDOM = 3,
   envoy_api_v2_Cluster_ORIGINAL_DST_LB = 4,
-  envoy_api_v2_Cluster_MAGLEV = 5
+  envoy_api_v2_Cluster_MAGLEV = 5,
+  envoy_api_v2_Cluster_CLUSTER_PROVIDED = 6
 } envoy_api_v2_Cluster_LbPolicy;
 
 typedef enum {
@@ -141,72 +143,100 @@ typedef enum {
   envoy_api_v2_Cluster_LbSubsetConfig_DEFAULT_SUBSET = 2
 } envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetFallbackPolicy;
 
+typedef enum {
+  envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_NOT_DEFINED = 0,
+  envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_NO_FALLBACK = 1,
+  envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_ANY_ENDPOINT = 2,
+  envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_DEFAULT_SUBSET = 3
+} envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy;
+
+typedef enum {
+  envoy_api_v2_Cluster_RingHashLbConfig_XX_HASH = 0,
+  envoy_api_v2_Cluster_RingHashLbConfig_MURMUR_HASH_2 = 1
+} envoy_api_v2_Cluster_RingHashLbConfig_HashFunction;
+
 
 /* envoy.api.v2.Cluster */
 
 UPB_INLINE envoy_api_v2_Cluster *envoy_api_v2_Cluster_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster *)upb_msg_new(&envoy_api_v2_Cluster_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster *envoy_api_v2_Cluster_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster *envoy_api_v2_Cluster_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster *ret = envoy_api_v2_Cluster_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_serialize(const envoy_api_v2_Cluster *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_msginit, arena, len);
 }
 
 typedef enum {
+  envoy_api_v2_Cluster_cluster_discovery_type_type = 2,
+  envoy_api_v2_Cluster_cluster_discovery_type_cluster_type = 38,
+  envoy_api_v2_Cluster_cluster_discovery_type_NOT_SET = 0
+} envoy_api_v2_Cluster_cluster_discovery_type_oneofcases;
+UPB_INLINE envoy_api_v2_Cluster_cluster_discovery_type_oneofcases envoy_api_v2_Cluster_cluster_discovery_type_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_cluster_discovery_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(152, 272)); }
+
+typedef enum {
   envoy_api_v2_Cluster_lb_config_ring_hash_lb_config = 23,
   envoy_api_v2_Cluster_lb_config_original_dst_lb_config = 34,
-  envoy_api_v2_Cluster_lb_config_NOT_SET = 0,
+  envoy_api_v2_Cluster_lb_config_least_request_lb_config = 37,
+  envoy_api_v2_Cluster_lb_config_NOT_SET = 0
 } envoy_api_v2_Cluster_lb_config_oneofcases;
-UPB_INLINE envoy_api_v2_Cluster_lb_config_oneofcases envoy_api_v2_Cluster_lb_config_case(const envoy_api_v2_Cluster* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(152, 272)); }
-
-UPB_INLINE upb_strview envoy_api_v2_Cluster_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 40)); }
-UPB_INLINE int32_t envoy_api_v2_Cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
-UPB_INLINE const envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_eds_cluster_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(52, 72)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_connect_timeout(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(56, 80)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(60, 88)); }
-UPB_INLINE int32_t envoy_api_v2_Cluster_lb_policy(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
-UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_hosts(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(128, 224), len); }
-UPB_INLINE const struct envoy_api_v2_core_HealthCheck* const* envoy_api_v2_Cluster_health_checks(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_HealthCheck* const*)_upb_array_accessor(msg, UPB_SIZE(132, 232), len); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_max_requests_per_connection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(64, 96)); }
-UPB_INLINE const struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_circuit_breakers(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(68, 104)); }
-UPB_INLINE const struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_tls_context(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(72, 112)); }
-UPB_INLINE const struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(76, 120)); }
-UPB_INLINE const struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_http2_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(80, 128)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_dns_refresh_rate(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(84, 136)); }
-UPB_INLINE int32_t envoy_api_v2_Cluster_dns_lookup_family(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); }
-UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_dns_resolvers(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(136, 240), len); }
-UPB_INLINE const struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_outlier_detection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(88, 144)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_cleanup_interval(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(92, 152)); }
-UPB_INLINE const struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_upstream_bind_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_BindConfig*, UPB_SIZE(96, 160)); }
-UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_lb_subset_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(100, 168)); }
-UPB_INLINE bool envoy_api_v2_Cluster_has_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 23); }
-UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(148, 264), UPB_SIZE(152, 272), 23, NULL); }
-UPB_INLINE const struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_transport_socket(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(104, 176)); }
-UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_metadata(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(108, 184)); }
-UPB_INLINE int32_t envoy_api_v2_Cluster_protocol_selection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)); }
-UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_common_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(112, 192)); }
-UPB_INLINE upb_strview envoy_api_v2_Cluster_alt_stat_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 56)); }
-UPB_INLINE const struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_common_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(116, 200)); }
-UPB_INLINE const envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_upstream_connection_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(120, 208)); }
-UPB_INLINE bool envoy_api_v2_Cluster_close_connections_on_host_health_failure(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(32, 32)); }
-UPB_INLINE bool envoy_api_v2_Cluster_drain_connections_on_host_removal(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(33, 33)); }
-UPB_INLINE const struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_load_assignment(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(124, 216)); }
-UPB_INLINE bool envoy_api_v2_Cluster_has_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 34); }
-UPB_INLINE const envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(148, 264), UPB_SIZE(152, 272), 34, NULL); }
-UPB_INLINE const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(140, 248), len); }
-UPB_INLINE const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_typed_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(144, 256), len); }
+UPB_INLINE envoy_api_v2_Cluster_lb_config_oneofcases envoy_api_v2_Cluster_lb_config_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_lb_config_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(160, 288)); }
+
+UPB_INLINE upb_strview envoy_api_v2_Cluster_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); }
+UPB_INLINE bool envoy_api_v2_Cluster_has_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 2); }
+UPB_INLINE int32_t envoy_api_v2_Cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(144, 264), UPB_SIZE(152, 272), 2, envoy_api_v2_Cluster_STATIC); }
+UPB_INLINE const envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_eds_cluster_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(44, 64)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_connect_timeout(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 72)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(52, 80)); }
+UPB_INLINE int32_t envoy_api_v2_Cluster_lb_policy(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_hosts(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(120, 216), len); }
+UPB_INLINE const struct envoy_api_v2_core_HealthCheck* const* envoy_api_v2_Cluster_health_checks(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_HealthCheck* const*)_upb_array_accessor(msg, UPB_SIZE(124, 224), len); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_max_requests_per_connection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(56, 88)); }
+UPB_INLINE const struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_circuit_breakers(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(60, 96)); }
+UPB_INLINE const struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_tls_context(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(64, 104)); }
+UPB_INLINE const struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(68, 112)); }
+UPB_INLINE const struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_http2_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(72, 120)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_dns_refresh_rate(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(76, 128)); }
+UPB_INLINE int32_t envoy_api_v2_Cluster_dns_lookup_family(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_dns_resolvers(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(128, 232), len); }
+UPB_INLINE const struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_outlier_detection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(80, 136)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_cleanup_interval(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(84, 144)); }
+UPB_INLINE const struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_upstream_bind_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_BindConfig*, UPB_SIZE(88, 152)); }
+UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_lb_subset_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(92, 160)); }
+UPB_INLINE bool envoy_api_v2_Cluster_has_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 288), 23); }
+UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 280), UPB_SIZE(160, 288), 23, NULL); }
+UPB_INLINE const struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_transport_socket(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(96, 168)); }
+UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_metadata(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(100, 176)); }
+UPB_INLINE int32_t envoy_api_v2_Cluster_protocol_selection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); }
+UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_common_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(104, 184)); }
+UPB_INLINE upb_strview envoy_api_v2_Cluster_alt_stat_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)); }
+UPB_INLINE const struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_common_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(108, 192)); }
+UPB_INLINE const envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_upstream_connection_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(112, 200)); }
+UPB_INLINE bool envoy_api_v2_Cluster_close_connections_on_host_health_failure(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); }
+UPB_INLINE bool envoy_api_v2_Cluster_drain_connections_on_host_removal(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); }
+UPB_INLINE const struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_load_assignment(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(116, 208)); }
+UPB_INLINE bool envoy_api_v2_Cluster_has_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 288), 34); }
+UPB_INLINE const envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 280), UPB_SIZE(160, 288), 34, NULL); }
+UPB_INLINE const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(132, 240), len); }
+UPB_INLINE const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_typed_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(136, 248), len); }
+UPB_INLINE bool envoy_api_v2_Cluster_has_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 288), 37); }
+UPB_INLINE const envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 280), UPB_SIZE(160, 288), 37, NULL); }
+UPB_INLINE bool envoy_api_v2_Cluster_has_cluster_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 38); }
+UPB_INLINE const envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 264), UPB_SIZE(152, 272), 38, NULL); }
+UPB_INLINE bool envoy_api_v2_Cluster_respect_dns_ttl(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)); }
+UPB_INLINE const struct envoy_api_v2_cluster_Filter* const* envoy_api_v2_Cluster_filters(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_cluster_Filter* const*)_upb_array_accessor(msg, UPB_SIZE(140, 256), len); }
 
 UPB_INLINE void envoy_api_v2_Cluster_set_name(envoy_api_v2_Cluster *msg, upb_strview value) {
-  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 40)) = value;
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_type(envoy_api_v2_Cluster *msg, int32_t value) {
-  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+  UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(144, 264), value, UPB_SIZE(152, 272), 2);
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_eds_cluster_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_EdsClusterConfig* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(52, 72)) = value;
+  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(44, 64)) = value;
 }
 UPB_INLINE struct envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_mutable_eds_cluster_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_EdsClusterConfig* sub = (struct envoy_api_v2_Cluster_EdsClusterConfig*)envoy_api_v2_Cluster_eds_cluster_config(msg);
@@ -218,7 +248,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_mu
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_connect_timeout(envoy_api_v2_Cluster *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(56, 80)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 72)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_connect_timeout(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_connect_timeout(msg);
@@ -230,7 +260,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_connect
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_per_connection_buffer_limit_bytes(envoy_api_v2_Cluster *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(60, 88)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(52, 80)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_per_connection_buffer_limit_bytes(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(msg);
@@ -242,36 +272,36 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_per_
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_lb_policy(envoy_api_v2_Cluster *msg, int32_t value) {
-  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_mutable_hosts(envoy_api_v2_Cluster *msg, size_t *len) {
-  return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(128, 224), len);
+  return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(120, 216), len);
 }
 UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_resize_hosts(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) {
-  return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(128, 224), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(120, 216), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_Cluster_add_hosts(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Address* sub = (struct envoy_api_v2_core_Address*)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(128, 224), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(120, 216), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck** envoy_api_v2_Cluster_mutable_health_checks(envoy_api_v2_Cluster *msg, size_t *len) {
-  return (struct envoy_api_v2_core_HealthCheck**)_upb_array_mutable_accessor(msg, UPB_SIZE(132, 232), len);
+  return (struct envoy_api_v2_core_HealthCheck**)_upb_array_mutable_accessor(msg, UPB_SIZE(124, 224), len);
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck** envoy_api_v2_Cluster_resize_health_checks(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) {
-  return (struct envoy_api_v2_core_HealthCheck**)_upb_array_resize_accessor(msg, UPB_SIZE(132, 232), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (struct envoy_api_v2_core_HealthCheck**)_upb_array_resize_accessor(msg, UPB_SIZE(124, 224), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck* envoy_api_v2_Cluster_add_health_checks(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_HealthCheck* sub = (struct envoy_api_v2_core_HealthCheck*)upb_msg_new(&envoy_api_v2_core_HealthCheck_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(132, 232), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(124, 224), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_max_requests_per_connection(envoy_api_v2_Cluster *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(64, 96)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(56, 88)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_max_requests_per_connection(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_Cluster_max_requests_per_connection(msg);
@@ -283,7 +313,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_max_
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_circuit_breakers(envoy_api_v2_Cluster *msg, struct envoy_api_v2_cluster_CircuitBreakers* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(68, 104)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(60, 96)) = value;
 }
 UPB_INLINE struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_mutable_circuit_breakers(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_cluster_CircuitBreakers* sub = (struct envoy_api_v2_cluster_CircuitBreakers*)envoy_api_v2_Cluster_circuit_breakers(msg);
@@ -295,7 +325,7 @@ UPB_INLINE struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_mut
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_tls_context(envoy_api_v2_Cluster *msg, struct envoy_api_v2_auth_UpstreamTlsContext* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(72, 112)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(64, 104)) = value;
 }
 UPB_INLINE struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_mutable_tls_context(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_auth_UpstreamTlsContext* sub = (struct envoy_api_v2_auth_UpstreamTlsContext*)envoy_api_v2_Cluster_tls_context(msg);
@@ -307,7 +337,7 @@ UPB_INLINE struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_mut
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_http_protocol_options(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_Http1ProtocolOptions* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(76, 120)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(68, 112)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_mutable_http_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Http1ProtocolOptions* sub = (struct envoy_api_v2_core_Http1ProtocolOptions*)envoy_api_v2_Cluster_http_protocol_options(msg);
@@ -319,7 +349,7 @@ UPB_INLINE struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_m
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_http2_protocol_options(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_Http2ProtocolOptions* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(80, 128)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(72, 120)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_mutable_http2_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Http2ProtocolOptions* sub = (struct envoy_api_v2_core_Http2ProtocolOptions*)envoy_api_v2_Cluster_http2_protocol_options(msg);
@@ -331,7 +361,7 @@ UPB_INLINE struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_m
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_dns_refresh_rate(envoy_api_v2_Cluster *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(84, 136)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(76, 128)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_dns_refresh_rate(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_dns_refresh_rate(msg);
@@ -343,23 +373,23 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_dns_ref
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_dns_lookup_family(envoy_api_v2_Cluster *msg, int32_t value) {
-  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value;
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_mutable_dns_resolvers(envoy_api_v2_Cluster *msg, size_t *len) {
-  return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(136, 240), len);
+  return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(128, 232), len);
 }
 UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_resize_dns_resolvers(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) {
-  return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(136, 240), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(128, 232), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_Cluster_add_dns_resolvers(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Address* sub = (struct envoy_api_v2_core_Address*)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(136, 240), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(128, 232), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_outlier_detection(envoy_api_v2_Cluster *msg, struct envoy_api_v2_cluster_OutlierDetection* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(88, 144)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(80, 136)) = value;
 }
 UPB_INLINE struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_mutable_outlier_detection(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_cluster_OutlierDetection* sub = (struct envoy_api_v2_cluster_OutlierDetection*)envoy_api_v2_Cluster_outlier_detection(msg);
@@ -371,7 +401,7 @@ UPB_INLINE struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_mu
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_cleanup_interval(envoy_api_v2_Cluster *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(92, 152)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(84, 144)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_cleanup_interval(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_cleanup_interval(msg);
@@ -383,7 +413,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_cleanup
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_upstream_bind_config(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_BindConfig* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_BindConfig*, UPB_SIZE(96, 160)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_BindConfig*, UPB_SIZE(88, 152)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_mutable_upstream_bind_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_BindConfig* sub = (struct envoy_api_v2_core_BindConfig*)envoy_api_v2_Cluster_upstream_bind_config(msg);
@@ -395,7 +425,7 @@ UPB_INLINE struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_mutable_ups
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_lb_subset_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_LbSubsetConfig* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(100, 168)) = value;
+  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(92, 160)) = value;
 }
 UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_mutable_lb_subset_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_LbSubsetConfig* sub = (struct envoy_api_v2_Cluster_LbSubsetConfig*)envoy_api_v2_Cluster_lb_subset_config(msg);
@@ -407,7 +437,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_muta
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_ring_hash_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_RingHashLbConfig* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(148, 264), value, UPB_SIZE(152, 272), 23);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 280), value, UPB_SIZE(160, 288), 23);
 }
 UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_mutable_ring_hash_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_RingHashLbConfig* sub = (struct envoy_api_v2_Cluster_RingHashLbConfig*)envoy_api_v2_Cluster_ring_hash_lb_config(msg);
@@ -419,7 +449,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_mu
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_transport_socket(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_TransportSocket* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(104, 176)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(96, 168)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_mutable_transport_socket(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_TransportSocket* sub = (struct envoy_api_v2_core_TransportSocket*)envoy_api_v2_Cluster_transport_socket(msg);
@@ -431,7 +461,7 @@ UPB_INLINE struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_metadata(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_Metadata* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(108, 184)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(100, 176)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_mutable_metadata(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Metadata* sub = (struct envoy_api_v2_core_Metadata*)envoy_api_v2_Cluster_metadata(msg);
@@ -443,10 +473,10 @@ UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_mutable_metad
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_protocol_selection(envoy_api_v2_Cluster *msg, int32_t value) {
-  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)) = value;
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_common_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_CommonLbConfig* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(112, 192)) = value;
+  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(104, 184)) = value;
 }
 UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_mutable_common_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_CommonLbConfig* sub = (struct envoy_api_v2_Cluster_CommonLbConfig*)envoy_api_v2_Cluster_common_lb_config(msg);
@@ -458,10 +488,10 @@ UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_muta
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_alt_stat_name(envoy_api_v2_Cluster *msg, upb_strview value) {
-  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 56)) = value;
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)) = value;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_common_http_protocol_options(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_HttpProtocolOptions* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(116, 200)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(108, 192)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_mutable_common_http_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_core_HttpProtocolOptions* sub = (struct envoy_api_v2_core_HttpProtocolOptions*)envoy_api_v2_Cluster_common_http_protocol_options(msg);
@@ -473,7 +503,7 @@ UPB_INLINE struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_mu
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_upstream_connection_options(envoy_api_v2_Cluster *msg, envoy_api_v2_UpstreamConnectionOptions* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(120, 208)) = value;
+  UPB_FIELD_AT(msg, envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(112, 200)) = value;
 }
 UPB_INLINE struct envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_mutable_upstream_connection_options(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_UpstreamConnectionOptions* sub = (struct envoy_api_v2_UpstreamConnectionOptions*)envoy_api_v2_Cluster_upstream_connection_options(msg);
@@ -485,13 +515,13 @@ UPB_INLINE struct envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_m
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_close_connections_on_host_health_failure(envoy_api_v2_Cluster *msg, bool value) {
-  UPB_FIELD_AT(msg, bool, UPB_SIZE(32, 32)) = value;
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_drain_connections_on_host_removal(envoy_api_v2_Cluster *msg, bool value) {
-  UPB_FIELD_AT(msg, bool, UPB_SIZE(33, 33)) = value;
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)) = value;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_load_assignment(envoy_api_v2_Cluster *msg, struct envoy_api_v2_ClusterLoadAssignment* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(124, 216)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(116, 208)) = value;
 }
 UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_mutable_load_assignment(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_ClusterLoadAssignment* sub = (struct envoy_api_v2_ClusterLoadAssignment*)envoy_api_v2_Cluster_load_assignment(msg);
@@ -503,7 +533,7 @@ UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_mutab
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_set_original_dst_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_OriginalDstLbConfig* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(148, 264), value, UPB_SIZE(152, 272), 34);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 280), value, UPB_SIZE(160, 288), 34);
 }
 UPB_INLINE struct envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_mutable_original_dst_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_OriginalDstLbConfig* sub = (struct envoy_api_v2_Cluster_OriginalDstLbConfig*)envoy_api_v2_Cluster_original_dst_lb_config(msg);
@@ -515,41 +545,114 @@ UPB_INLINE struct envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster
   return sub;
 }
 UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_mutable_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t *len) {
-  return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(140, 248), len);
+  return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(132, 240), len);
 }
 UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_resize_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(140, 248), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(132, 240), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* envoy_api_v2_Cluster_add_extension_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* sub = (struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry*)upb_msg_new(&envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(140, 248), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(132, 240), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_mutable_typed_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t *len) {
-  return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(144, 256), len);
+  return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(136, 248), len);
 }
 UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_resize_typed_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(144, 256), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(136, 248), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* envoy_api_v2_Cluster_add_typed_extension_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* sub = (struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry*)upb_msg_new(&envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(144, 256), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(136, 248), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_Cluster_set_least_request_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_LeastRequestLbConfig* value) {
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 280), value, UPB_SIZE(160, 288), 37);
+}
+UPB_INLINE struct envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_mutable_least_request_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) {
+  struct envoy_api_v2_Cluster_LeastRequestLbConfig* sub = (struct envoy_api_v2_Cluster_LeastRequestLbConfig*)envoy_api_v2_Cluster_least_request_lb_config(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_Cluster_LeastRequestLbConfig*)upb_msg_new(&envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_Cluster_set_least_request_lb_config(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_Cluster_set_cluster_type(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_CustomClusterType* value) {
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 264), value, UPB_SIZE(152, 272), 38);
+}
+UPB_INLINE struct envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_mutable_cluster_type(envoy_api_v2_Cluster *msg, upb_arena *arena) {
+  struct envoy_api_v2_Cluster_CustomClusterType* sub = (struct envoy_api_v2_Cluster_CustomClusterType*)envoy_api_v2_Cluster_cluster_type(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_Cluster_CustomClusterType*)upb_msg_new(&envoy_api_v2_Cluster_CustomClusterType_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_Cluster_set_cluster_type(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_Cluster_set_respect_dns_ttl(envoy_api_v2_Cluster *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)) = value;
+}
+UPB_INLINE struct envoy_api_v2_cluster_Filter** envoy_api_v2_Cluster_mutable_filters(envoy_api_v2_Cluster *msg, size_t *len) {
+  return (struct envoy_api_v2_cluster_Filter**)_upb_array_mutable_accessor(msg, UPB_SIZE(140, 256), len);
+}
+UPB_INLINE struct envoy_api_v2_cluster_Filter** envoy_api_v2_Cluster_resize_filters(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) {
+  return (struct envoy_api_v2_cluster_Filter**)_upb_array_resize_accessor(msg, UPB_SIZE(140, 256), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct envoy_api_v2_cluster_Filter* envoy_api_v2_Cluster_add_filters(envoy_api_v2_Cluster *msg, upb_arena *arena) {
+  struct envoy_api_v2_cluster_Filter* sub = (struct envoy_api_v2_cluster_Filter*)upb_msg_new(&envoy_api_v2_cluster_Filter_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(140, 256), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 
+/* envoy.api.v2.Cluster.CustomClusterType */
+
+UPB_INLINE envoy_api_v2_Cluster_CustomClusterType *envoy_api_v2_Cluster_CustomClusterType_new(upb_arena *arena) {
+  return (envoy_api_v2_Cluster_CustomClusterType *)upb_msg_new(&envoy_api_v2_Cluster_CustomClusterType_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_Cluster_CustomClusterType *envoy_api_v2_Cluster_CustomClusterType_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_Cluster_CustomClusterType *ret = envoy_api_v2_Cluster_CustomClusterType_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CustomClusterType_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_Cluster_CustomClusterType_serialize(const envoy_api_v2_Cluster_CustomClusterType *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_Cluster_CustomClusterType_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview envoy_api_v2_Cluster_CustomClusterType_name(const envoy_api_v2_Cluster_CustomClusterType *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Cluster_CustomClusterType_typed_config(const envoy_api_v2_Cluster_CustomClusterType *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void envoy_api_v2_Cluster_CustomClusterType_set_name(envoy_api_v2_Cluster_CustomClusterType *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_Cluster_CustomClusterType_set_typed_config(envoy_api_v2_Cluster_CustomClusterType *msg, struct google_protobuf_Any* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Cluster_CustomClusterType_mutable_typed_config(envoy_api_v2_Cluster_CustomClusterType *msg, upb_arena *arena) {
+  struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_Cluster_CustomClusterType_typed_config(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_Cluster_CustomClusterType_set_typed_config(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.Cluster.EdsClusterConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_EdsClusterConfig *envoy_api_v2_Cluster_EdsClusterConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_EdsClusterConfig *)upb_msg_new(&envoy_api_v2_Cluster_EdsClusterConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_EdsClusterConfig *envoy_api_v2_Cluster_EdsClusterConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_EdsClusterConfig *envoy_api_v2_Cluster_EdsClusterConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_EdsClusterConfig *ret = envoy_api_v2_Cluster_EdsClusterConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_EdsClusterConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_EdsClusterConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_EdsClusterConfig_serialize(const envoy_api_v2_Cluster_EdsClusterConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_EdsClusterConfig_msginit, arena, len);
@@ -574,15 +677,15 @@ UPB_INLINE void envoy_api_v2_Cluster_EdsClusterConfig_set_service_name(envoy_api
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.Cluster.ExtensionProtocolOptionsEntry */
 
 UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *)upb_msg_new(&envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *ret = envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_serialize(const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena, len);
@@ -607,15 +710,15 @@ UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_Cluster_ExtensionProtocol
   return sub;
 }
 
-
 /* envoy.api.v2.Cluster.TypedExtensionProtocolOptionsEntry */
 
 UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *)upb_msg_new(&envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *ret = envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_serialize(const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena, len);
@@ -640,15 +743,15 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Cluster_TypedExtensionProtoc
   return sub;
 }
 
-
 /* envoy.api.v2.Cluster.LbSubsetConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig *envoy_api_v2_Cluster_LbSubsetConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_LbSubsetConfig *)upb_msg_new(&envoy_api_v2_Cluster_LbSubsetConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig *envoy_api_v2_Cluster_LbSubsetConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig *envoy_api_v2_Cluster_LbSubsetConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_LbSubsetConfig *ret = envoy_api_v2_Cluster_LbSubsetConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_LbSubsetConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_LbSubsetConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_LbSubsetConfig_serialize(const envoy_api_v2_Cluster_LbSubsetConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_LbSubsetConfig_msginit, arena, len);
@@ -658,6 +761,9 @@ UPB_INLINE int32_t envoy_api_v2_Cluster_LbSubsetConfig_fallback_policy(const env
 UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_Cluster_LbSubsetConfig_default_subset(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Struct*, UPB_SIZE(12, 16)); }
 UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* const* envoy_api_v2_Cluster_LbSubsetConfig_subset_selectors(const envoy_api_v2_Cluster_LbSubsetConfig *msg, size_t *len) { return (const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* const*)_upb_array_accessor(msg, UPB_SIZE(16, 24), len); }
 UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_locality_weight_aware(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); }
+UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_scale_locality_weight(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(9, 9)); }
+UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_panic_mode_any(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(10, 10)); }
+UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_list_as_any(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(11, 11)); }
 
 UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_fallback_policy(envoy_api_v2_Cluster_LbSubsetConfig *msg, int32_t value) {
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
@@ -690,53 +796,96 @@ UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* envoy_ap
 UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_locality_weight_aware(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) {
   UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value;
 }
-
+UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_scale_locality_weight(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(9, 9)) = value;
+}
+UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_panic_mode_any(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(10, 10)) = value;
+}
+UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_list_as_any(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(11, 11)) = value;
+}
 
 /* envoy.api.v2.Cluster.LbSubsetConfig.LbSubsetSelector */
 
 UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *)upb_msg_new(&envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *ret = envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_serialize(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena, len);
 }
 
-UPB_INLINE upb_strview const* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_keys(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+UPB_INLINE upb_strview const* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_keys(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); }
+UPB_INLINE int32_t envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_fallback_policy(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
 
 UPB_INLINE upb_strview* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_mutable_keys(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t *len) {
-  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len);
 }
 UPB_INLINE upb_strview* envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_resize_keys(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, size_t len, upb_arena *arena) {
-  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
 }
 UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_add_keys(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, upb_strview val, upb_arena *arena) {
   return _upb_array_append_accessor(
-      msg, UPB_SIZE(0, 0), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+      msg, UPB_SIZE(8, 8), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_set_fallback_policy(envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 
+/* envoy.api.v2.Cluster.LeastRequestLbConfig */
+
+UPB_INLINE envoy_api_v2_Cluster_LeastRequestLbConfig *envoy_api_v2_Cluster_LeastRequestLbConfig_new(upb_arena *arena) {
+  return (envoy_api_v2_Cluster_LeastRequestLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_Cluster_LeastRequestLbConfig *envoy_api_v2_Cluster_LeastRequestLbConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_Cluster_LeastRequestLbConfig *ret = envoy_api_v2_Cluster_LeastRequestLbConfig_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_Cluster_LeastRequestLbConfig_serialize(const envoy_api_v2_Cluster_LeastRequestLbConfig *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena, len);
+}
+
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_LeastRequestLbConfig_choice_count(const envoy_api_v2_Cluster_LeastRequestLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void envoy_api_v2_Cluster_LeastRequestLbConfig_set_choice_count(envoy_api_v2_Cluster_LeastRequestLbConfig *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_LeastRequestLbConfig_mutable_choice_count(envoy_api_v2_Cluster_LeastRequestLbConfig *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_Cluster_LeastRequestLbConfig_choice_count(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_Cluster_LeastRequestLbConfig_set_choice_count(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.Cluster.RingHashLbConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig *envoy_api_v2_Cluster_RingHashLbConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_RingHashLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_RingHashLbConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig *envoy_api_v2_Cluster_RingHashLbConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig *envoy_api_v2_Cluster_RingHashLbConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_RingHashLbConfig *ret = envoy_api_v2_Cluster_RingHashLbConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_RingHashLbConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_RingHashLbConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_RingHashLbConfig_serialize(const envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_RingHashLbConfig_msginit, arena, len);
 }
 
-UPB_INLINE const struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_minimum_ring_size(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt64Value*, UPB_SIZE(0, 0)); }
-UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* envoy_api_v2_Cluster_RingHashLbConfig_deprecated_v1(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*, UPB_SIZE(4, 8)); }
+UPB_INLINE const struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_minimum_ring_size(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt64Value*, UPB_SIZE(8, 8)); }
+UPB_INLINE int32_t envoy_api_v2_Cluster_RingHashLbConfig_hash_function(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_maximum_ring_size(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt64Value*, UPB_SIZE(12, 16)); }
 
 UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_minimum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, struct google_protobuf_UInt64Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt64Value*, UPB_SIZE(0, 0)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt64Value*, UPB_SIZE(8, 8)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_mutable_minimum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena) {
   struct google_protobuf_UInt64Value* sub = (struct google_protobuf_UInt64Value*)envoy_api_v2_Cluster_RingHashLbConfig_minimum_ring_size(msg);
@@ -747,57 +896,31 @@ UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbCo
   }
   return sub;
 }
-UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_deprecated_v1(envoy_api_v2_Cluster_RingHashLbConfig *msg, envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*, UPB_SIZE(4, 8)) = value;
-}
-UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* envoy_api_v2_Cluster_RingHashLbConfig_mutable_deprecated_v1(envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena) {
-  struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* sub = (struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*)envoy_api_v2_Cluster_RingHashLbConfig_deprecated_v1(msg);
-  if (sub == NULL) {
-    sub = (struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*)upb_msg_new(&envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, arena);
-    if (!sub) return NULL;
-    envoy_api_v2_Cluster_RingHashLbConfig_set_deprecated_v1(msg, sub);
-  }
-  return sub;
-}
-
-
-/* envoy.api.v2.Cluster.RingHashLbConfig.DeprecatedV1 */
-
-UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_new(upb_arena *arena) {
-  return (envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *)upb_msg_new(&envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, arena);
-}
-UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_parsenew(upb_strview buf, upb_arena *arena) {
-  envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *ret = envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit)) ? ret : NULL;
-}
-UPB_INLINE char *envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_serialize(const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg, upb_arena *arena, size_t *len) {
-  return upb_encode(msg, &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, arena, len);
+UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_hash_function(envoy_api_v2_Cluster_RingHashLbConfig *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
-
-UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_use_std_hash(const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(0, 0)); }
-
-UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_set_use_std_hash(envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg, struct google_protobuf_BoolValue* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(0, 0)) = value;
+UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_maximum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, struct google_protobuf_UInt64Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt64Value*, UPB_SIZE(12, 16)) = value;
 }
-UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_mutable_use_std_hash(envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg, upb_arena *arena) {
-  struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_use_std_hash(msg);
+UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_mutable_maximum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena) {
+  struct google_protobuf_UInt64Value* sub = (struct google_protobuf_UInt64Value*)envoy_api_v2_Cluster_RingHashLbConfig_maximum_ring_size(msg);
   if (sub == NULL) {
-    sub = (struct google_protobuf_BoolValue*)upb_msg_new(&google_protobuf_BoolValue_msginit, arena);
+    sub = (struct google_protobuf_UInt64Value*)upb_msg_new(&google_protobuf_UInt64Value_msginit, arena);
     if (!sub) return NULL;
-    envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_set_use_std_hash(msg, sub);
+    envoy_api_v2_Cluster_RingHashLbConfig_set_maximum_ring_size(msg, sub);
   }
   return sub;
 }
 
-
 /* envoy.api.v2.Cluster.OriginalDstLbConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_OriginalDstLbConfig *envoy_api_v2_Cluster_OriginalDstLbConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_OriginalDstLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_OriginalDstLbConfig *envoy_api_v2_Cluster_OriginalDstLbConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_OriginalDstLbConfig *envoy_api_v2_Cluster_OriginalDstLbConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_OriginalDstLbConfig *ret = envoy_api_v2_Cluster_OriginalDstLbConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_OriginalDstLbConfig_serialize(const envoy_api_v2_Cluster_OriginalDstLbConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, arena, len);
@@ -809,15 +932,15 @@ UPB_INLINE void envoy_api_v2_Cluster_OriginalDstLbConfig_set_use_http_header(env
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.Cluster.CommonLbConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig *envoy_api_v2_Cluster_CommonLbConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_CommonLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_CommonLbConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig *envoy_api_v2_Cluster_CommonLbConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig *envoy_api_v2_Cluster_CommonLbConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_CommonLbConfig *ret = envoy_api_v2_Cluster_CommonLbConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_CommonLbConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CommonLbConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_serialize(const envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_CommonLbConfig_msginit, arena, len);
@@ -826,19 +949,21 @@ UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_serialize(const envoy_api_v
 typedef enum {
   envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_zone_aware_lb_config = 2,
   envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_locality_weighted_lb_config = 3,
-  envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_NOT_SET = 0,
+  envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_NOT_SET = 0
 } envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_case(const envoy_api_v2_Cluster_CommonLbConfig* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
+UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_case(const envoy_api_v2_Cluster_CommonLbConfig* msg) { return (envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 32)); }
 
-UPB_INLINE const struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_healthy_panic_threshold(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct envoy_type_Percent*, UPB_SIZE(0, 0)); }
-UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
-UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_api_v2_Cluster_CommonLbConfig_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 2, NULL); }
-UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); }
-UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 3, NULL); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(4, 8)); }
+UPB_INLINE const struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_healthy_panic_threshold(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct envoy_type_Percent*, UPB_SIZE(4, 8)); }
+UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(16, 32), 2); }
+UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_api_v2_Cluster_CommonLbConfig_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(12, 24), UPB_SIZE(16, 32), 2, NULL); }
+UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(16, 32), 3); }
+UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(12, 24), UPB_SIZE(16, 32), 3, NULL); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); }
+UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_ignore_new_hosts_until_first_hc(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
+UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_close_connections_on_host_set_change(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
 
 UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_healthy_panic_threshold(envoy_api_v2_Cluster_CommonLbConfig *msg, struct envoy_type_Percent* value) {
-  UPB_FIELD_AT(msg, struct envoy_type_Percent*, UPB_SIZE(0, 0)) = value;
+  UPB_FIELD_AT(msg, struct envoy_type_Percent*, UPB_SIZE(4, 8)) = value;
 }
 UPB_INLINE struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_mutable_healthy_panic_threshold(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) {
   struct envoy_type_Percent* sub = (struct envoy_type_Percent*)envoy_api_v2_Cluster_CommonLbConfig_healthy_panic_threshold(msg);
@@ -850,7 +975,7 @@ UPB_INLINE struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_zone_aware_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 2);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(12, 24), value, UPB_SIZE(16, 32), 2);
 }
 UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_api_v2_Cluster_CommonLbConfig_mutable_zone_aware_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* sub = (struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*)envoy_api_v2_Cluster_CommonLbConfig_zone_aware_lb_config(msg);
@@ -862,7 +987,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_a
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_locality_weighted_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 3);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(12, 24), value, UPB_SIZE(16, 32), 3);
 }
 UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_mutable_locality_weighted_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) {
   struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* sub = (struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*)envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(msg);
@@ -874,7 +999,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*
   return sub;
 }
 UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_update_merge_window(envoy_api_v2_Cluster_CommonLbConfig *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(4, 8)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_mutable_update_merge_window(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(msg);
@@ -885,16 +1010,22 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_ignore_new_hosts_until_first_hc(envoy_api_v2_Cluster_CommonLbConfig *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_close_connections_on_host_set_change(envoy_api_v2_Cluster_CommonLbConfig *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
 
 /* envoy.api.v2.Cluster.CommonLbConfig.ZoneAwareLbConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *ret = envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_serialize(const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit, arena, len);
@@ -928,15 +1059,15 @@ UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_CommonLbConf
   return sub;
 }
 
-
 /* envoy.api.v2.Cluster.CommonLbConfig.LocalityWeightedLbConfig */
 
 UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_new(upb_arena *arena) {
   return (envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *ret = envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_serialize(const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit, arena, len);
@@ -944,15 +1075,15 @@ UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_se
 
 
 
-
 /* envoy.api.v2.UpstreamBindConfig */
 
 UPB_INLINE envoy_api_v2_UpstreamBindConfig *envoy_api_v2_UpstreamBindConfig_new(upb_arena *arena) {
   return (envoy_api_v2_UpstreamBindConfig *)upb_msg_new(&envoy_api_v2_UpstreamBindConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_UpstreamBindConfig *envoy_api_v2_UpstreamBindConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_UpstreamBindConfig *envoy_api_v2_UpstreamBindConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_UpstreamBindConfig *ret = envoy_api_v2_UpstreamBindConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_UpstreamBindConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_UpstreamBindConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_UpstreamBindConfig_serialize(const envoy_api_v2_UpstreamBindConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_UpstreamBindConfig_msginit, arena, len);
@@ -973,15 +1104,15 @@ UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_UpstreamBindConfig_mut
   return sub;
 }
 
-
 /* envoy.api.v2.UpstreamConnectionOptions */
 
 UPB_INLINE envoy_api_v2_UpstreamConnectionOptions *envoy_api_v2_UpstreamConnectionOptions_new(upb_arena *arena) {
   return (envoy_api_v2_UpstreamConnectionOptions *)upb_msg_new(&envoy_api_v2_UpstreamConnectionOptions_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_UpstreamConnectionOptions *envoy_api_v2_UpstreamConnectionOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_UpstreamConnectionOptions *envoy_api_v2_UpstreamConnectionOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_UpstreamConnectionOptions *ret = envoy_api_v2_UpstreamConnectionOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_UpstreamConnectionOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_UpstreamConnectionOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_UpstreamConnectionOptions_serialize(const envoy_api_v2_UpstreamConnectionOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_UpstreamConnectionOptions_msginit, arena, len);
@@ -1002,7 +1133,6 @@ UPB_INLINE struct envoy_api_v2_core_TcpKeepalive* envoy_api_v2_UpstreamConnectio
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index d16f2ce..12d8cf5 100644 (file)
@@ -29,22 +29,24 @@ const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_msginit = {
   UPB_SIZE(4, 8), 1, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_cluster_CircuitBreakers_Thresholds_submsgs[4] = {
+static const upb_msglayout *const envoy_api_v2_cluster_CircuitBreakers_Thresholds_submsgs[5] = {
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_cluster_CircuitBreakers_Thresholds__fields[5] = {
+static const upb_msglayout_field envoy_api_v2_cluster_CircuitBreakers_Thresholds__fields[7] = {
   {1, UPB_SIZE(0, 0), 0, 0, 14, 1},
-  {2, UPB_SIZE(8, 8), 0, 0, 11, 1},
-  {3, UPB_SIZE(12, 16), 0, 0, 11, 1},
-  {4, UPB_SIZE(16, 24), 0, 0, 11, 1},
-  {5, UPB_SIZE(20, 32), 0, 0, 11, 1},
+  {2, UPB_SIZE(12, 16), 0, 0, 11, 1},
+  {3, UPB_SIZE(16, 24), 0, 0, 11, 1},
+  {4, UPB_SIZE(20, 32), 0, 0, 11, 1},
+  {5, UPB_SIZE(24, 40), 0, 0, 11, 1},
+  {6, UPB_SIZE(8, 8), 0, 0, 8, 1},
+  {7, UPB_SIZE(28, 48), 0, 0, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit = {
   &envoy_api_v2_cluster_CircuitBreakers_Thresholds_submsgs[0],
   &envoy_api_v2_cluster_CircuitBreakers_Thresholds__fields[0],
-  UPB_SIZE(24, 40), 5, false,
+  UPB_SIZE(32, 56), 7, false,
 };
 
 #include "upb/port_undef.inc"
index 45fd072..9a1fa08 100644 (file)
 #define ENVOY_API_V2_CLUSTER_CIRCUIT_BREAKER_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -29,17 +29,16 @@ extern const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_Thresholds_msgin
 struct google_protobuf_UInt32Value;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.cluster.CircuitBreakers */
 
 UPB_INLINE envoy_api_v2_cluster_CircuitBreakers *envoy_api_v2_cluster_CircuitBreakers_new(upb_arena *arena) {
   return (envoy_api_v2_cluster_CircuitBreakers *)upb_msg_new(&envoy_api_v2_cluster_CircuitBreakers_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_cluster_CircuitBreakers *envoy_api_v2_cluster_CircuitBreakers_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_cluster_CircuitBreakers *envoy_api_v2_cluster_CircuitBreakers_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_cluster_CircuitBreakers *ret = envoy_api_v2_cluster_CircuitBreakers_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_cluster_CircuitBreakers_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_CircuitBreakers_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_cluster_CircuitBreakers_serialize(const envoy_api_v2_cluster_CircuitBreakers *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_cluster_CircuitBreakers_msginit, arena, len);
@@ -61,31 +60,33 @@ UPB_INLINE struct envoy_api_v2_cluster_CircuitBreakers_Thresholds* envoy_api_v2_
   return sub;
 }
 
-
 /* envoy.api.v2.cluster.CircuitBreakers.Thresholds */
 
 UPB_INLINE envoy_api_v2_cluster_CircuitBreakers_Thresholds *envoy_api_v2_cluster_CircuitBreakers_Thresholds_new(upb_arena *arena) {
   return (envoy_api_v2_cluster_CircuitBreakers_Thresholds *)upb_msg_new(&envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_cluster_CircuitBreakers_Thresholds *envoy_api_v2_cluster_CircuitBreakers_Thresholds_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_cluster_CircuitBreakers_Thresholds *envoy_api_v2_cluster_CircuitBreakers_Thresholds_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_cluster_CircuitBreakers_Thresholds *ret = envoy_api_v2_cluster_CircuitBreakers_Thresholds_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_cluster_CircuitBreakers_Thresholds_serialize(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit, arena, len);
 }
 
 UPB_INLINE int32_t envoy_api_v2_cluster_CircuitBreakers_Thresholds_priority(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connections(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(8, 8)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_pending_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_retries(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connections(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_pending_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_retries(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 40)); }
+UPB_INLINE bool envoy_api_v2_cluster_CircuitBreakers_Thresholds_track_remaining(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connection_pools(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)); }
 
 UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_priority(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, int32_t value) {
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_connections(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(8, 8)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_connections(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connections(msg);
@@ -97,7 +98,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_pending_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_pending_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_pending_requests(msg);
@@ -109,7 +110,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_requests(msg);
@@ -121,7 +122,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_retries(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 40)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_retries(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_retries(msg);
@@ -132,7 +133,21 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_track_remaining(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_connection_pools(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_connection_pools(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connection_pools(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_connection_pools(msg, sub);
+  }
+  return sub;
+}
 
 #ifdef __cplusplus
 }  /* extern "C" */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c
new file mode 100644 (file)
index 0000000..7cd040e
--- /dev/null
@@ -0,0 +1,34 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     envoy/api/v2/cluster/filter.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "envoy/api/v2/cluster/filter.upb.h"
+#include "google/protobuf/any.upb.h"
+#include "validate/validate.upb.h"
+#include "gogoproto/gogo.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const envoy_api_v2_cluster_Filter_submsgs[1] = {
+  &google_protobuf_Any_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_cluster_Filter__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
+};
+
+const upb_msglayout envoy_api_v2_cluster_Filter_msginit = {
+  &envoy_api_v2_cluster_Filter_submsgs[0],
+  &envoy_api_v2_cluster_Filter__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h
new file mode 100644 (file)
index 0000000..bd8746c
--- /dev/null
@@ -0,0 +1,69 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     envoy/api/v2/cluster/filter.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef ENVOY_API_V2_CLUSTER_FILTER_PROTO_UPB_H_
+#define ENVOY_API_V2_CLUSTER_FILTER_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct envoy_api_v2_cluster_Filter;
+typedef struct envoy_api_v2_cluster_Filter envoy_api_v2_cluster_Filter;
+extern const upb_msglayout envoy_api_v2_cluster_Filter_msginit;
+struct google_protobuf_Any;
+extern const upb_msglayout google_protobuf_Any_msginit;
+
+
+/* envoy.api.v2.cluster.Filter */
+
+UPB_INLINE envoy_api_v2_cluster_Filter *envoy_api_v2_cluster_Filter_new(upb_arena *arena) {
+  return (envoy_api_v2_cluster_Filter *)upb_msg_new(&envoy_api_v2_cluster_Filter_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_cluster_Filter *envoy_api_v2_cluster_Filter_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_cluster_Filter *ret = envoy_api_v2_cluster_Filter_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_Filter_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_cluster_Filter_serialize(const envoy_api_v2_cluster_Filter *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_cluster_Filter_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview envoy_api_v2_cluster_Filter_name(const envoy_api_v2_cluster_Filter *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_cluster_Filter_typed_config(const envoy_api_v2_cluster_Filter *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void envoy_api_v2_cluster_Filter_set_name(envoy_api_v2_cluster_Filter *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_cluster_Filter_set_typed_config(envoy_api_v2_cluster_Filter *msg, struct google_protobuf_Any* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct google_protobuf_Any* envoy_api_v2_cluster_Filter_mutable_typed_config(envoy_api_v2_cluster_Filter *msg, upb_arena *arena) {
+  struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_cluster_Filter_typed_config(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_cluster_Filter_set_typed_config(msg, sub);
+  }
+  return sub;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* ENVOY_API_V2_CLUSTER_FILTER_PROTO_UPB_H_ */
index 7158a8b..cc3a226 100644 (file)
 
 #include "upb/port_def.inc"
 
-static const upb_msglayout *const envoy_api_v2_cluster_OutlierDetection_submsgs[11] = {
+static const upb_msglayout *const envoy_api_v2_cluster_OutlierDetection_submsgs[14] = {
   &google_protobuf_Duration_msginit,
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_cluster_OutlierDetection__fields[11] = {
-  {1, UPB_SIZE(0, 0), 0, 1, 11, 1},
-  {2, UPB_SIZE(4, 8), 0, 0, 11, 1},
-  {3, UPB_SIZE(8, 16), 0, 0, 11, 1},
-  {4, UPB_SIZE(12, 24), 0, 1, 11, 1},
-  {5, UPB_SIZE(16, 32), 0, 1, 11, 1},
-  {6, UPB_SIZE(20, 40), 0, 1, 11, 1},
-  {7, UPB_SIZE(24, 48), 0, 1, 11, 1},
-  {8, UPB_SIZE(28, 56), 0, 1, 11, 1},
-  {9, UPB_SIZE(32, 64), 0, 1, 11, 1},
-  {10, UPB_SIZE(36, 72), 0, 1, 11, 1},
-  {11, UPB_SIZE(40, 80), 0, 1, 11, 1},
+static const upb_msglayout_field envoy_api_v2_cluster_OutlierDetection__fields[15] = {
+  {1, UPB_SIZE(4, 8), 0, 1, 11, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
+  {3, UPB_SIZE(12, 24), 0, 0, 11, 1},
+  {4, UPB_SIZE(16, 32), 0, 1, 11, 1},
+  {5, UPB_SIZE(20, 40), 0, 1, 11, 1},
+  {6, UPB_SIZE(24, 48), 0, 1, 11, 1},
+  {7, UPB_SIZE(28, 56), 0, 1, 11, 1},
+  {8, UPB_SIZE(32, 64), 0, 1, 11, 1},
+  {9, UPB_SIZE(36, 72), 0, 1, 11, 1},
+  {10, UPB_SIZE(40, 80), 0, 1, 11, 1},
+  {11, UPB_SIZE(44, 88), 0, 1, 11, 1},
+  {12, UPB_SIZE(0, 0), 0, 0, 8, 1},
+  {13, UPB_SIZE(48, 96), 0, 1, 11, 1},
+  {14, UPB_SIZE(52, 104), 0, 1, 11, 1},
+  {15, UPB_SIZE(56, 112), 0, 1, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_cluster_OutlierDetection_msginit = {
   &envoy_api_v2_cluster_OutlierDetection_submsgs[0],
   &envoy_api_v2_cluster_OutlierDetection__fields[0],
-  UPB_SIZE(44, 88), 11, false,
+  UPB_SIZE(60, 120), 15, false,
 };
 
 #include "upb/port_undef.inc"
index 06fa49f..ef5592b 100644 (file)
 #define ENVOY_API_V2_CLUSTER_OUTLIER_DETECTION_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -28,36 +28,39 @@ struct google_protobuf_UInt32Value;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.cluster.OutlierDetection */
 
 UPB_INLINE envoy_api_v2_cluster_OutlierDetection *envoy_api_v2_cluster_OutlierDetection_new(upb_arena *arena) {
   return (envoy_api_v2_cluster_OutlierDetection *)upb_msg_new(&envoy_api_v2_cluster_OutlierDetection_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_cluster_OutlierDetection *envoy_api_v2_cluster_OutlierDetection_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_cluster_OutlierDetection *envoy_api_v2_cluster_OutlierDetection_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_cluster_OutlierDetection *ret = envoy_api_v2_cluster_OutlierDetection_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_cluster_OutlierDetection_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_OutlierDetection_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_cluster_OutlierDetection_serialize(const envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_cluster_OutlierDetection_msginit, arena, len);
 }
 
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_interval(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(4, 8)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_base_ejection_time(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_max_ejection_percent(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_success_rate(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_minimum_hosts(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_request_volume(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_stdev_factor(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_interval(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_base_ejection_time(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 24)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_max_ejection_percent(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_5xx(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_success_rate(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_minimum_hosts(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_request_volume(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_success_rate_stdev_factor(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_gateway_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(44, 88)); }
+UPB_INLINE bool envoy_api_v2_cluster_OutlierDetection_split_external_local_origin_errors(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_consecutive_local_origin_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(48, 96)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_local_origin_failure(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(52, 104)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_enforcing_local_origin_success_rate(const envoy_api_v2_cluster_OutlierDetection *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(56, 112)); }
 
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_consecutive_5xx(msg);
@@ -69,7 +72,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_interval(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(4, 8)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_mutable_interval(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_cluster_OutlierDetection_interval(msg);
@@ -81,7 +84,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetectio
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_base_ejection_time(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 24)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetection_mutable_base_ejection_time(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_cluster_OutlierDetection_base_ejection_time(msg);
@@ -93,7 +96,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_cluster_OutlierDetectio
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_max_ejection_percent(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_max_ejection_percent(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_max_ejection_percent(msg);
@@ -105,7 +108,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_consecutive_5xx(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_5xx(msg);
@@ -117,7 +120,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_success_rate(msg);
@@ -129,7 +132,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_success_rate_minimum_hosts(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_success_rate_minimum_hosts(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_success_rate_minimum_hosts(msg);
@@ -141,7 +144,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_success_rate_request_volume(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_success_rate_request_volume(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_success_rate_request_volume(msg);
@@ -153,7 +156,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_success_rate_stdev_factor(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_success_rate_stdev_factor(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_success_rate_stdev_factor(msg);
@@ -165,7 +168,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_consecutive_gateway_failure(msg);
@@ -177,7 +180,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   return sub;
 }
 UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(40, 80)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(44, 88)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_consecutive_gateway_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_gateway_failure(msg);
@@ -188,7 +191,45 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_split_external_local_origin_errors(envoy_api_v2_cluster_OutlierDetection *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(48, 96)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_consecutive_local_origin_failure(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_cluster_OutlierDetection_set_consecutive_local_origin_failure(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(52, 104)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_consecutive_local_origin_failure(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_consecutive_local_origin_failure(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_cluster_OutlierDetection_set_enforcing_consecutive_local_origin_failure(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_cluster_OutlierDetection_set_enforcing_local_origin_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(56, 112)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetection_mutable_enforcing_local_origin_success_rate(envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_OutlierDetection_enforcing_local_origin_success_rate(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_cluster_OutlierDetection_set_enforcing_local_origin_success_rate(msg, sub);
+  }
+  return sub;
+}
 
 #ifdef __cplusplus
 }  /* extern "C" */
index 8e0f8a2..ebf172a 100644 (file)
 #define ENVOY_API_V2_CORE_ADDRESS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -45,8 +45,6 @@ extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit;
 extern const upb_msglayout google_protobuf_BoolValue_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 typedef enum {
   envoy_api_v2_core_SocketAddress_TCP = 0,
   envoy_api_v2_core_SocketAddress_UDP = 1
@@ -58,9 +56,10 @@ typedef enum {
 UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_new(upb_arena *arena) {
   return (envoy_api_v2_core_Pipe *)upb_msg_new(&envoy_api_v2_core_Pipe_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Pipe *ret = envoy_api_v2_core_Pipe_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Pipe_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Pipe_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Pipe_serialize(const envoy_api_v2_core_Pipe *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Pipe_msginit, arena, len);
@@ -72,15 +71,15 @@ UPB_INLINE void envoy_api_v2_core_Pipe_set_path(envoy_api_v2_core_Pipe *msg, upb
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.core.SocketAddress */
 
 UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_new(upb_arena *arena) {
   return (envoy_api_v2_core_SocketAddress *)upb_msg_new(&envoy_api_v2_core_SocketAddress_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_SocketAddress *ret = envoy_api_v2_core_SocketAddress_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_SocketAddress_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_SocketAddress_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_SocketAddress_serialize(const envoy_api_v2_core_SocketAddress *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_SocketAddress_msginit, arena, len);
@@ -89,9 +88,9 @@ UPB_INLINE char *envoy_api_v2_core_SocketAddress_serialize(const envoy_api_v2_co
 typedef enum {
   envoy_api_v2_core_SocketAddress_port_specifier_port_value = 3,
   envoy_api_v2_core_SocketAddress_port_specifier_named_port = 4,
-  envoy_api_v2_core_SocketAddress_port_specifier_NOT_SET = 0,
+  envoy_api_v2_core_SocketAddress_port_specifier_NOT_SET = 0
 } envoy_api_v2_core_SocketAddress_port_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_core_SocketAddress_port_specifier_oneofcases envoy_api_v2_core_SocketAddress_port_specifier_case(const envoy_api_v2_core_SocketAddress* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(36, 64)); }
+UPB_INLINE envoy_api_v2_core_SocketAddress_port_specifier_oneofcases envoy_api_v2_core_SocketAddress_port_specifier_case(const envoy_api_v2_core_SocketAddress* msg) { return (envoy_api_v2_core_SocketAddress_port_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(36, 64)); }
 
 UPB_INLINE int32_t envoy_api_v2_core_SocketAddress_protocol(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
 UPB_INLINE upb_strview envoy_api_v2_core_SocketAddress_address(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); }
@@ -121,15 +120,15 @@ UPB_INLINE void envoy_api_v2_core_SocketAddress_set_ipv4_compat(envoy_api_v2_cor
   UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value;
 }
 
-
 /* envoy.api.v2.core.TcpKeepalive */
 
 UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_new(upb_arena *arena) {
   return (envoy_api_v2_core_TcpKeepalive *)upb_msg_new(&envoy_api_v2_core_TcpKeepalive_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_TcpKeepalive *ret = envoy_api_v2_core_TcpKeepalive_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TcpKeepalive_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_TcpKeepalive_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_TcpKeepalive_serialize(const envoy_api_v2_core_TcpKeepalive *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_TcpKeepalive_msginit, arena, len);
@@ -176,15 +175,15 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_mu
   return sub;
 }
 
-
 /* envoy.api.v2.core.BindConfig */
 
 UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_new(upb_arena *arena) {
   return (envoy_api_v2_core_BindConfig *)upb_msg_new(&envoy_api_v2_core_BindConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_BindConfig *ret = envoy_api_v2_core_BindConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_BindConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_BindConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_BindConfig_serialize(const envoy_api_v2_core_BindConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_BindConfig_msginit, arena, len);
@@ -232,15 +231,15 @@ UPB_INLINE struct envoy_api_v2_core_SocketOption* envoy_api_v2_core_BindConfig_a
   return sub;
 }
 
-
 /* envoy.api.v2.core.Address */
 
 UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_new(upb_arena *arena) {
   return (envoy_api_v2_core_Address *)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Address *ret = envoy_api_v2_core_Address_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Address_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Address_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Address_serialize(const envoy_api_v2_core_Address *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Address_msginit, arena, len);
@@ -249,9 +248,9 @@ UPB_INLINE char *envoy_api_v2_core_Address_serialize(const envoy_api_v2_core_Add
 typedef enum {
   envoy_api_v2_core_Address_address_socket_address = 1,
   envoy_api_v2_core_Address_address_pipe = 2,
-  envoy_api_v2_core_Address_address_NOT_SET = 0,
+  envoy_api_v2_core_Address_address_NOT_SET = 0
 } envoy_api_v2_core_Address_address_oneofcases;
-UPB_INLINE envoy_api_v2_core_Address_address_oneofcases envoy_api_v2_core_Address_address_case(const envoy_api_v2_core_Address* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); }
+UPB_INLINE envoy_api_v2_core_Address_address_oneofcases envoy_api_v2_core_Address_address_case(const envoy_api_v2_core_Address* msg) { return (envoy_api_v2_core_Address_address_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
 
 UPB_INLINE bool envoy_api_v2_core_Address_has_socket_address(const envoy_api_v2_core_Address *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
 UPB_INLINE const envoy_api_v2_core_SocketAddress* envoy_api_v2_core_Address_socket_address(const envoy_api_v2_core_Address *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_SocketAddress*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
@@ -283,15 +282,15 @@ UPB_INLINE struct envoy_api_v2_core_Pipe* envoy_api_v2_core_Address_mutable_pipe
   return sub;
 }
 
-
 /* envoy.api.v2.core.CidrRange */
 
 UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_new(upb_arena *arena) {
   return (envoy_api_v2_core_CidrRange *)upb_msg_new(&envoy_api_v2_core_CidrRange_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_CidrRange *ret = envoy_api_v2_core_CidrRange_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_CidrRange_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_CidrRange_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_CidrRange_serialize(const envoy_api_v2_core_CidrRange *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_CidrRange_msginit, arena, len);
@@ -316,7 +315,6 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_CidrRange_mutab
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 1e5c919..9ecfe10 100644 (file)
@@ -9,6 +9,7 @@
 #include <stddef.h>
 #include "upb/msg.h"
 #include "envoy/api/v2/core/base.upb.h"
+#include "envoy/api/v2/core/http_uri.upb.h"
 #include "google/protobuf/any.upb.h"
 #include "google/protobuf/struct.upb.h"
 #include "google/protobuf/wrappers.upb.h"
@@ -116,6 +117,20 @@ const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit = {
   UPB_SIZE(8, 16), 2, false,
 };
 
+static const upb_msglayout *const envoy_api_v2_core_HeaderMap_submsgs[1] = {
+  &envoy_api_v2_core_HeaderValue_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_core_HeaderMap__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout envoy_api_v2_core_HeaderMap_msginit = {
+  &envoy_api_v2_core_HeaderMap_submsgs[0],
+  &envoy_api_v2_core_HeaderMap__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
 static const upb_msglayout_field envoy_api_v2_core_DataSource__fields[3] = {
   {1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1},
   {2, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 12, 1},
@@ -128,6 +143,37 @@ const upb_msglayout envoy_api_v2_core_DataSource_msginit = {
   UPB_SIZE(16, 32), 3, false,
 };
 
+static const upb_msglayout *const envoy_api_v2_core_RemoteDataSource_submsgs[1] = {
+  &envoy_api_v2_core_HttpUri_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_core_RemoteDataSource__fields[2] = {
+  {1, UPB_SIZE(8, 16), 0, 0, 11, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 9, 1},
+};
+
+const upb_msglayout envoy_api_v2_core_RemoteDataSource_msginit = {
+  &envoy_api_v2_core_RemoteDataSource_submsgs[0],
+  &envoy_api_v2_core_RemoteDataSource__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const envoy_api_v2_core_AsyncDataSource_submsgs[2] = {
+  &envoy_api_v2_core_DataSource_msginit,
+  &envoy_api_v2_core_RemoteDataSource_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_core_AsyncDataSource__fields[2] = {
+  {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1},
+  {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1},
+};
+
+const upb_msglayout envoy_api_v2_core_AsyncDataSource_msginit = {
+  &envoy_api_v2_core_AsyncDataSource_submsgs[0],
+  &envoy_api_v2_core_AsyncDataSource__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
 static const upb_msglayout *const envoy_api_v2_core_TransportSocket_submsgs[2] = {
   &google_protobuf_Any_msginit,
   &google_protobuf_Struct_msginit,
@@ -175,5 +221,15 @@ const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit = {
   UPB_SIZE(16, 32), 2, false,
 };
 
+static const upb_msglayout_field envoy_api_v2_core_ControlPlane__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+};
+
+const upb_msglayout envoy_api_v2_core_ControlPlane_msginit = {
+  NULL,
+  &envoy_api_v2_core_ControlPlane__fields[0],
+  UPB_SIZE(8, 16), 1, false,
+};
+
 #include "upb/port_undef.inc"
 
index 41d0dd0..d4c14b1 100644 (file)
 #define ENVOY_API_V2_CORE_BASE_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -27,10 +27,14 @@ struct envoy_api_v2_core_Metadata_FilterMetadataEntry;
 struct envoy_api_v2_core_RuntimeUInt32;
 struct envoy_api_v2_core_HeaderValue;
 struct envoy_api_v2_core_HeaderValueOption;
+struct envoy_api_v2_core_HeaderMap;
 struct envoy_api_v2_core_DataSource;
+struct envoy_api_v2_core_RemoteDataSource;
+struct envoy_api_v2_core_AsyncDataSource;
 struct envoy_api_v2_core_TransportSocket;
 struct envoy_api_v2_core_SocketOption;
 struct envoy_api_v2_core_RuntimeFractionalPercent;
+struct envoy_api_v2_core_ControlPlane;
 typedef struct envoy_api_v2_core_Locality envoy_api_v2_core_Locality;
 typedef struct envoy_api_v2_core_Node envoy_api_v2_core_Node;
 typedef struct envoy_api_v2_core_Metadata envoy_api_v2_core_Metadata;
@@ -38,10 +42,14 @@ typedef struct envoy_api_v2_core_Metadata_FilterMetadataEntry envoy_api_v2_core_
 typedef struct envoy_api_v2_core_RuntimeUInt32 envoy_api_v2_core_RuntimeUInt32;
 typedef struct envoy_api_v2_core_HeaderValue envoy_api_v2_core_HeaderValue;
 typedef struct envoy_api_v2_core_HeaderValueOption envoy_api_v2_core_HeaderValueOption;
+typedef struct envoy_api_v2_core_HeaderMap envoy_api_v2_core_HeaderMap;
 typedef struct envoy_api_v2_core_DataSource envoy_api_v2_core_DataSource;
+typedef struct envoy_api_v2_core_RemoteDataSource envoy_api_v2_core_RemoteDataSource;
+typedef struct envoy_api_v2_core_AsyncDataSource envoy_api_v2_core_AsyncDataSource;
 typedef struct envoy_api_v2_core_TransportSocket envoy_api_v2_core_TransportSocket;
 typedef struct envoy_api_v2_core_SocketOption envoy_api_v2_core_SocketOption;
 typedef struct envoy_api_v2_core_RuntimeFractionalPercent envoy_api_v2_core_RuntimeFractionalPercent;
+typedef struct envoy_api_v2_core_ControlPlane envoy_api_v2_core_ControlPlane;
 extern const upb_msglayout envoy_api_v2_core_Locality_msginit;
 extern const upb_msglayout envoy_api_v2_core_Node_msginit;
 extern const upb_msglayout envoy_api_v2_core_Metadata_msginit;
@@ -49,21 +57,25 @@ extern const upb_msglayout envoy_api_v2_core_Metadata_FilterMetadataEntry_msgini
 extern const upb_msglayout envoy_api_v2_core_RuntimeUInt32_msginit;
 extern const upb_msglayout envoy_api_v2_core_HeaderValue_msginit;
 extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit;
+extern const upb_msglayout envoy_api_v2_core_HeaderMap_msginit;
 extern const upb_msglayout envoy_api_v2_core_DataSource_msginit;
+extern const upb_msglayout envoy_api_v2_core_RemoteDataSource_msginit;
+extern const upb_msglayout envoy_api_v2_core_AsyncDataSource_msginit;
 extern const upb_msglayout envoy_api_v2_core_TransportSocket_msginit;
 extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit;
 extern const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit;
+extern const upb_msglayout envoy_api_v2_core_ControlPlane_msginit;
+struct envoy_api_v2_core_HttpUri;
 struct envoy_type_FractionalPercent;
 struct google_protobuf_Any;
 struct google_protobuf_BoolValue;
 struct google_protobuf_Struct;
+extern const upb_msglayout envoy_api_v2_core_HttpUri_msginit;
 extern const upb_msglayout envoy_type_FractionalPercent_msginit;
 extern const upb_msglayout google_protobuf_Any_msginit;
 extern const upb_msglayout google_protobuf_BoolValue_msginit;
 extern const upb_msglayout google_protobuf_Struct_msginit;
 
-/* Enums */
-
 typedef enum {
   envoy_api_v2_core_METHOD_UNSPECIFIED = 0,
   envoy_api_v2_core_GET = 1,
@@ -73,7 +85,8 @@ typedef enum {
   envoy_api_v2_core_DELETE = 5,
   envoy_api_v2_core_CONNECT = 6,
   envoy_api_v2_core_OPTIONS = 7,
-  envoy_api_v2_core_TRACE = 8
+  envoy_api_v2_core_TRACE = 8,
+  envoy_api_v2_core_PATCH = 9
 } envoy_api_v2_core_RequestMethod;
 
 typedef enum {
@@ -87,15 +100,22 @@ typedef enum {
   envoy_api_v2_core_SocketOption_STATE_LISTENING = 2
 } envoy_api_v2_core_SocketOption_SocketState;
 
+typedef enum {
+  envoy_api_v2_core_UNSPECIFIED = 0,
+  envoy_api_v2_core_INBOUND = 1,
+  envoy_api_v2_core_OUTBOUND = 2
+} envoy_api_v2_core_TrafficDirection;
+
 
 /* envoy.api.v2.core.Locality */
 
 UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_new(upb_arena *arena) {
   return (envoy_api_v2_core_Locality *)upb_msg_new(&envoy_api_v2_core_Locality_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Locality *ret = envoy_api_v2_core_Locality_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Locality_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Locality_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Locality_serialize(const envoy_api_v2_core_Locality *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Locality_msginit, arena, len);
@@ -115,15 +135,15 @@ UPB_INLINE void envoy_api_v2_core_Locality_set_sub_zone(envoy_api_v2_core_Locali
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
 }
 
-
 /* envoy.api.v2.core.Node */
 
 UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_new(upb_arena *arena) {
   return (envoy_api_v2_core_Node *)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Node *ret = envoy_api_v2_core_Node_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Node_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Node_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Node_serialize(const envoy_api_v2_core_Node *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Node_msginit, arena, len);
@@ -169,15 +189,15 @@ UPB_INLINE void envoy_api_v2_core_Node_set_build_version(envoy_api_v2_core_Node
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
 }
 
-
 /* envoy.api.v2.core.Metadata */
 
 UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_new(upb_arena *arena) {
   return (envoy_api_v2_core_Metadata *)upb_msg_new(&envoy_api_v2_core_Metadata_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Metadata *ret = envoy_api_v2_core_Metadata_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Metadata_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Metadata_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Metadata_serialize(const envoy_api_v2_core_Metadata *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Metadata_msginit, arena, len);
@@ -199,15 +219,15 @@ UPB_INLINE struct envoy_api_v2_core_Metadata_FilterMetadataEntry* envoy_api_v2_c
   return sub;
 }
 
-
 /* envoy.api.v2.core.Metadata.FilterMetadataEntry */
 
 UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_new(upb_arena *arena) {
   return (envoy_api_v2_core_Metadata_FilterMetadataEntry *)upb_msg_new(&envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Metadata_FilterMetadataEntry *ret = envoy_api_v2_core_Metadata_FilterMetadataEntry_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Metadata_FilterMetadataEntry_serialize(const envoy_api_v2_core_Metadata_FilterMetadataEntry *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena, len);
@@ -232,15 +252,15 @@ UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_Metadata_FilterMetad
   return sub;
 }
 
-
 /* envoy.api.v2.core.RuntimeUInt32 */
 
 UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_new(upb_arena *arena) {
   return (envoy_api_v2_core_RuntimeUInt32 *)upb_msg_new(&envoy_api_v2_core_RuntimeUInt32_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_RuntimeUInt32 *ret = envoy_api_v2_core_RuntimeUInt32_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RuntimeUInt32_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RuntimeUInt32_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_RuntimeUInt32_serialize(const envoy_api_v2_core_RuntimeUInt32 *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_RuntimeUInt32_msginit, arena, len);
@@ -256,15 +276,15 @@ UPB_INLINE void envoy_api_v2_core_RuntimeUInt32_set_runtime_key(envoy_api_v2_cor
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
 }
 
-
 /* envoy.api.v2.core.HeaderValue */
 
 UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_new(upb_arena *arena) {
   return (envoy_api_v2_core_HeaderValue *)upb_msg_new(&envoy_api_v2_core_HeaderValue_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HeaderValue *ret = envoy_api_v2_core_HeaderValue_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HeaderValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HeaderValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HeaderValue_serialize(const envoy_api_v2_core_HeaderValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HeaderValue_msginit, arena, len);
@@ -280,15 +300,15 @@ UPB_INLINE void envoy_api_v2_core_HeaderValue_set_value(envoy_api_v2_core_Header
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
 
-
 /* envoy.api.v2.core.HeaderValueOption */
 
 UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_new(upb_arena *arena) {
   return (envoy_api_v2_core_HeaderValueOption *)upb_msg_new(&envoy_api_v2_core_HeaderValueOption_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HeaderValueOption *ret = envoy_api_v2_core_HeaderValueOption_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HeaderValueOption_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HeaderValueOption_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HeaderValueOption_serialize(const envoy_api_v2_core_HeaderValueOption *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HeaderValueOption_msginit, arena, len);
@@ -322,15 +342,45 @@ UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HeaderValueOption
   return sub;
 }
 
+/* envoy.api.v2.core.HeaderMap */
+
+UPB_INLINE envoy_api_v2_core_HeaderMap *envoy_api_v2_core_HeaderMap_new(upb_arena *arena) {
+  return (envoy_api_v2_core_HeaderMap *)upb_msg_new(&envoy_api_v2_core_HeaderMap_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_core_HeaderMap *envoy_api_v2_core_HeaderMap_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_core_HeaderMap *ret = envoy_api_v2_core_HeaderMap_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HeaderMap_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_core_HeaderMap_serialize(const envoy_api_v2_core_HeaderMap *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_core_HeaderMap_msginit, arena, len);
+}
+
+UPB_INLINE const envoy_api_v2_core_HeaderValue* const* envoy_api_v2_core_HeaderMap_headers(const envoy_api_v2_core_HeaderMap *msg, size_t *len) { return (const envoy_api_v2_core_HeaderValue* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE envoy_api_v2_core_HeaderValue** envoy_api_v2_core_HeaderMap_mutable_headers(envoy_api_v2_core_HeaderMap *msg, size_t *len) {
+  return (envoy_api_v2_core_HeaderValue**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE envoy_api_v2_core_HeaderValue** envoy_api_v2_core_HeaderMap_resize_headers(envoy_api_v2_core_HeaderMap *msg, size_t len, upb_arena *arena) {
+  return (envoy_api_v2_core_HeaderValue**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct envoy_api_v2_core_HeaderValue* envoy_api_v2_core_HeaderMap_add_headers(envoy_api_v2_core_HeaderMap *msg, upb_arena *arena) {
+  struct envoy_api_v2_core_HeaderValue* sub = (struct envoy_api_v2_core_HeaderValue*)upb_msg_new(&envoy_api_v2_core_HeaderValue_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
 
 /* envoy.api.v2.core.DataSource */
 
 UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_new(upb_arena *arena) {
   return (envoy_api_v2_core_DataSource *)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_DataSource *ret = envoy_api_v2_core_DataSource_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_DataSource_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_DataSource_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_DataSource_serialize(const envoy_api_v2_core_DataSource *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_DataSource_msginit, arena, len);
@@ -340,9 +390,9 @@ typedef enum {
   envoy_api_v2_core_DataSource_specifier_filename = 1,
   envoy_api_v2_core_DataSource_specifier_inline_bytes = 2,
   envoy_api_v2_core_DataSource_specifier_inline_string = 3,
-  envoy_api_v2_core_DataSource_specifier_NOT_SET = 0,
+  envoy_api_v2_core_DataSource_specifier_NOT_SET = 0
 } envoy_api_v2_core_DataSource_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_core_DataSource_specifier_oneofcases envoy_api_v2_core_DataSource_specifier_case(const envoy_api_v2_core_DataSource* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
+UPB_INLINE envoy_api_v2_core_DataSource_specifier_oneofcases envoy_api_v2_core_DataSource_specifier_case(const envoy_api_v2_core_DataSource* msg) { return (envoy_api_v2_core_DataSource_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); }
 
 UPB_INLINE bool envoy_api_v2_core_DataSource_has_filename(const envoy_api_v2_core_DataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
 UPB_INLINE upb_strview envoy_api_v2_core_DataSource_filename(const envoy_api_v2_core_DataSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); }
@@ -361,15 +411,99 @@ UPB_INLINE void envoy_api_v2_core_DataSource_set_inline_string(envoy_api_v2_core
   UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3);
 }
 
+/* envoy.api.v2.core.RemoteDataSource */
+
+UPB_INLINE envoy_api_v2_core_RemoteDataSource *envoy_api_v2_core_RemoteDataSource_new(upb_arena *arena) {
+  return (envoy_api_v2_core_RemoteDataSource *)upb_msg_new(&envoy_api_v2_core_RemoteDataSource_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_core_RemoteDataSource *envoy_api_v2_core_RemoteDataSource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_core_RemoteDataSource *ret = envoy_api_v2_core_RemoteDataSource_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RemoteDataSource_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_core_RemoteDataSource_serialize(const envoy_api_v2_core_RemoteDataSource *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_core_RemoteDataSource_msginit, arena, len);
+}
+
+UPB_INLINE const struct envoy_api_v2_core_HttpUri* envoy_api_v2_core_RemoteDataSource_http_uri(const envoy_api_v2_core_RemoteDataSource *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_HttpUri*, UPB_SIZE(8, 16)); }
+UPB_INLINE upb_strview envoy_api_v2_core_RemoteDataSource_sha256(const envoy_api_v2_core_RemoteDataSource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void envoy_api_v2_core_RemoteDataSource_set_http_uri(envoy_api_v2_core_RemoteDataSource *msg, struct envoy_api_v2_core_HttpUri* value) {
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_HttpUri*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct envoy_api_v2_core_HttpUri* envoy_api_v2_core_RemoteDataSource_mutable_http_uri(envoy_api_v2_core_RemoteDataSource *msg, upb_arena *arena) {
+  struct envoy_api_v2_core_HttpUri* sub = (struct envoy_api_v2_core_HttpUri*)envoy_api_v2_core_RemoteDataSource_http_uri(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_core_HttpUri*)upb_msg_new(&envoy_api_v2_core_HttpUri_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_RemoteDataSource_set_http_uri(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_RemoteDataSource_set_sha256(envoy_api_v2_core_RemoteDataSource *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+
+/* envoy.api.v2.core.AsyncDataSource */
+
+UPB_INLINE envoy_api_v2_core_AsyncDataSource *envoy_api_v2_core_AsyncDataSource_new(upb_arena *arena) {
+  return (envoy_api_v2_core_AsyncDataSource *)upb_msg_new(&envoy_api_v2_core_AsyncDataSource_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_core_AsyncDataSource *envoy_api_v2_core_AsyncDataSource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_core_AsyncDataSource *ret = envoy_api_v2_core_AsyncDataSource_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_AsyncDataSource_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_core_AsyncDataSource_serialize(const envoy_api_v2_core_AsyncDataSource *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_core_AsyncDataSource_msginit, arena, len);
+}
+
+typedef enum {
+  envoy_api_v2_core_AsyncDataSource_specifier_local = 1,
+  envoy_api_v2_core_AsyncDataSource_specifier_remote = 2,
+  envoy_api_v2_core_AsyncDataSource_specifier_NOT_SET = 0
+} envoy_api_v2_core_AsyncDataSource_specifier_oneofcases;
+UPB_INLINE envoy_api_v2_core_AsyncDataSource_specifier_oneofcases envoy_api_v2_core_AsyncDataSource_specifier_case(const envoy_api_v2_core_AsyncDataSource* msg) { return (envoy_api_v2_core_AsyncDataSource_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
+
+UPB_INLINE bool envoy_api_v2_core_AsyncDataSource_has_local(const envoy_api_v2_core_AsyncDataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
+UPB_INLINE const envoy_api_v2_core_DataSource* envoy_api_v2_core_AsyncDataSource_local(const envoy_api_v2_core_AsyncDataSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_DataSource*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
+UPB_INLINE bool envoy_api_v2_core_AsyncDataSource_has_remote(const envoy_api_v2_core_AsyncDataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); }
+UPB_INLINE const envoy_api_v2_core_RemoteDataSource* envoy_api_v2_core_AsyncDataSource_remote(const envoy_api_v2_core_AsyncDataSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_RemoteDataSource*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); }
+
+UPB_INLINE void envoy_api_v2_core_AsyncDataSource_set_local(envoy_api_v2_core_AsyncDataSource *msg, envoy_api_v2_core_DataSource* value) {
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_DataSource*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1);
+}
+UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_core_AsyncDataSource_mutable_local(envoy_api_v2_core_AsyncDataSource *msg, upb_arena *arena) {
+  struct envoy_api_v2_core_DataSource* sub = (struct envoy_api_v2_core_DataSource*)envoy_api_v2_core_AsyncDataSource_local(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_core_DataSource*)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_AsyncDataSource_set_local(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_AsyncDataSource_set_remote(envoy_api_v2_core_AsyncDataSource *msg, envoy_api_v2_core_RemoteDataSource* value) {
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_RemoteDataSource*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2);
+}
+UPB_INLINE struct envoy_api_v2_core_RemoteDataSource* envoy_api_v2_core_AsyncDataSource_mutable_remote(envoy_api_v2_core_AsyncDataSource *msg, upb_arena *arena) {
+  struct envoy_api_v2_core_RemoteDataSource* sub = (struct envoy_api_v2_core_RemoteDataSource*)envoy_api_v2_core_AsyncDataSource_remote(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_core_RemoteDataSource*)upb_msg_new(&envoy_api_v2_core_RemoteDataSource_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_AsyncDataSource_set_remote(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.core.TransportSocket */
 
 UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_new(upb_arena *arena) {
   return (envoy_api_v2_core_TransportSocket *)upb_msg_new(&envoy_api_v2_core_TransportSocket_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_TransportSocket *ret = envoy_api_v2_core_TransportSocket_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TransportSocket_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_TransportSocket_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_TransportSocket_serialize(const envoy_api_v2_core_TransportSocket *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_TransportSocket_msginit, arena, len);
@@ -378,9 +512,9 @@ UPB_INLINE char *envoy_api_v2_core_TransportSocket_serialize(const envoy_api_v2_
 typedef enum {
   envoy_api_v2_core_TransportSocket_config_type_config = 2,
   envoy_api_v2_core_TransportSocket_config_type_typed_config = 3,
-  envoy_api_v2_core_TransportSocket_config_type_NOT_SET = 0,
+  envoy_api_v2_core_TransportSocket_config_type_NOT_SET = 0
 } envoy_api_v2_core_TransportSocket_config_type_oneofcases;
-UPB_INLINE envoy_api_v2_core_TransportSocket_config_type_oneofcases envoy_api_v2_core_TransportSocket_config_type_case(const envoy_api_v2_core_TransportSocket* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
+UPB_INLINE envoy_api_v2_core_TransportSocket_config_type_oneofcases envoy_api_v2_core_TransportSocket_config_type_case(const envoy_api_v2_core_TransportSocket* msg) { return (envoy_api_v2_core_TransportSocket_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
 
 UPB_INLINE upb_strview envoy_api_v2_core_TransportSocket_name(const envoy_api_v2_core_TransportSocket *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
 UPB_INLINE bool envoy_api_v2_core_TransportSocket_has_config(const envoy_api_v2_core_TransportSocket *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
@@ -416,15 +550,15 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_TransportSocket_mutable
   return sub;
 }
 
-
 /* envoy.api.v2.core.SocketOption */
 
 UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_new(upb_arena *arena) {
   return (envoy_api_v2_core_SocketOption *)upb_msg_new(&envoy_api_v2_core_SocketOption_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_SocketOption *ret = envoy_api_v2_core_SocketOption_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_SocketOption_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_SocketOption_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_SocketOption_serialize(const envoy_api_v2_core_SocketOption *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_SocketOption_msginit, arena, len);
@@ -433,9 +567,9 @@ UPB_INLINE char *envoy_api_v2_core_SocketOption_serialize(const envoy_api_v2_cor
 typedef enum {
   envoy_api_v2_core_SocketOption_value_int_value = 4,
   envoy_api_v2_core_SocketOption_value_buf_value = 5,
-  envoy_api_v2_core_SocketOption_value_NOT_SET = 0,
+  envoy_api_v2_core_SocketOption_value_NOT_SET = 0
 } envoy_api_v2_core_SocketOption_value_oneofcases;
-UPB_INLINE envoy_api_v2_core_SocketOption_value_oneofcases envoy_api_v2_core_SocketOption_value_case(const envoy_api_v2_core_SocketOption* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(40, 56)); }
+UPB_INLINE envoy_api_v2_core_SocketOption_value_oneofcases envoy_api_v2_core_SocketOption_value_case(const envoy_api_v2_core_SocketOption* msg) { return (envoy_api_v2_core_SocketOption_value_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(40, 56)); }
 
 UPB_INLINE upb_strview envoy_api_v2_core_SocketOption_description(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 24)); }
 UPB_INLINE int64_t envoy_api_v2_core_SocketOption_level(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); }
@@ -465,15 +599,15 @@ UPB_INLINE void envoy_api_v2_core_SocketOption_set_state(envoy_api_v2_core_Socke
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value;
 }
 
-
 /* envoy.api.v2.core.RuntimeFractionalPercent */
 
 UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_new(upb_arena *arena) {
   return (envoy_api_v2_core_RuntimeFractionalPercent *)upb_msg_new(&envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_RuntimeFractionalPercent *ret = envoy_api_v2_core_RuntimeFractionalPercent_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RuntimeFractionalPercent_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_RuntimeFractionalPercent_serialize(const envoy_api_v2_core_RuntimeFractionalPercent *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena, len);
@@ -498,6 +632,25 @@ UPB_INLINE void envoy_api_v2_core_RuntimeFractionalPercent_set_runtime_key(envoy
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
+/* envoy.api.v2.core.ControlPlane */
+
+UPB_INLINE envoy_api_v2_core_ControlPlane *envoy_api_v2_core_ControlPlane_new(upb_arena *arena) {
+  return (envoy_api_v2_core_ControlPlane *)upb_msg_new(&envoy_api_v2_core_ControlPlane_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_core_ControlPlane *envoy_api_v2_core_ControlPlane_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_core_ControlPlane *ret = envoy_api_v2_core_ControlPlane_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_ControlPlane_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_core_ControlPlane_serialize(const envoy_api_v2_core_ControlPlane *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_core_ControlPlane_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview envoy_api_v2_core_ControlPlane_identifier(const envoy_api_v2_core_ControlPlane *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void envoy_api_v2_core_ControlPlane_set_identifier(envoy_api_v2_core_ControlPlane *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
 
 #ifdef __cplusplus
 }  /* extern "C" */
index b36d02a..afe9404 100644 (file)
@@ -23,19 +23,20 @@ static const upb_msglayout *const envoy_api_v2_core_ApiConfigSource_submsgs[4] =
   &google_protobuf_Duration_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_core_ApiConfigSource__fields[6] = {
+static const upb_msglayout_field envoy_api_v2_core_ApiConfigSource__fields[7] = {
   {1, UPB_SIZE(0, 0), 0, 0, 14, 1},
-  {2, UPB_SIZE(20, 32), 0, 0, 9, 3},
-  {3, UPB_SIZE(8, 8), 0, 2, 11, 1},
-  {4, UPB_SIZE(24, 40), 0, 0, 11, 3},
-  {5, UPB_SIZE(12, 16), 0, 2, 11, 1},
-  {6, UPB_SIZE(16, 24), 0, 1, 11, 1},
+  {2, UPB_SIZE(24, 40), 0, 0, 9, 3},
+  {3, UPB_SIZE(12, 16), 0, 2, 11, 1},
+  {4, UPB_SIZE(28, 48), 0, 0, 11, 3},
+  {5, UPB_SIZE(16, 24), 0, 2, 11, 1},
+  {6, UPB_SIZE(20, 32), 0, 1, 11, 1},
+  {7, UPB_SIZE(8, 8), 0, 0, 8, 1},
 };
 
 const upb_msglayout envoy_api_v2_core_ApiConfigSource_msginit = {
   &envoy_api_v2_core_ApiConfigSource_submsgs[0],
   &envoy_api_v2_core_ApiConfigSource__fields[0],
-  UPB_SIZE(32, 48), 6, false,
+  UPB_SIZE(32, 56), 7, false,
 };
 
 const upb_msglayout envoy_api_v2_core_AggregatedConfigSource_msginit = {
@@ -60,21 +61,23 @@ const upb_msglayout envoy_api_v2_core_RateLimitSettings_msginit = {
   UPB_SIZE(8, 16), 2, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_core_ConfigSource_submsgs[2] = {
+static const upb_msglayout *const envoy_api_v2_core_ConfigSource_submsgs[3] = {
   &envoy_api_v2_core_AggregatedConfigSource_msginit,
   &envoy_api_v2_core_ApiConfigSource_msginit,
+  &google_protobuf_Duration_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_core_ConfigSource__fields[3] = {
-  {1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1},
-  {2, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 1, 11, 1},
-  {3, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 11, 1},
+static const upb_msglayout_field envoy_api_v2_core_ConfigSource__fields[4] = {
+  {1, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 9, 1},
+  {2, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 1, 11, 1},
+  {3, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 11, 1},
+  {4, UPB_SIZE(0, 0), 0, 2, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_core_ConfigSource_msginit = {
   &envoy_api_v2_core_ConfigSource_submsgs[0],
   &envoy_api_v2_core_ConfigSource__fields[0],
-  UPB_SIZE(16, 32), 3, false,
+  UPB_SIZE(16, 32), 4, false,
 };
 
 #include "upb/port_undef.inc"
index 2b03b13..4c2e832 100644 (file)
 #define ENVOY_API_V2_CORE_CONFIG_SOURCE_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -41,12 +41,11 @@ extern const upb_msglayout google_protobuf_DoubleValue_msginit;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 typedef enum {
-  envoy_api_v2_core_ApiConfigSource_REST_LEGACY = 0,
+  envoy_api_v2_core_ApiConfigSource_UNSUPPORTED_REST_LEGACY = 0,
   envoy_api_v2_core_ApiConfigSource_REST = 1,
-  envoy_api_v2_core_ApiConfigSource_GRPC = 2
+  envoy_api_v2_core_ApiConfigSource_GRPC = 2,
+  envoy_api_v2_core_ApiConfigSource_DELTA_GRPC = 3
 } envoy_api_v2_core_ApiConfigSource_ApiType;
 
 
@@ -55,36 +54,38 @@ typedef enum {
 UPB_INLINE envoy_api_v2_core_ApiConfigSource *envoy_api_v2_core_ApiConfigSource_new(upb_arena *arena) {
   return (envoy_api_v2_core_ApiConfigSource *)upb_msg_new(&envoy_api_v2_core_ApiConfigSource_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_ApiConfigSource *envoy_api_v2_core_ApiConfigSource_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_ApiConfigSource *envoy_api_v2_core_ApiConfigSource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_ApiConfigSource *ret = envoy_api_v2_core_ApiConfigSource_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_ApiConfigSource_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_ApiConfigSource_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_ApiConfigSource_serialize(const envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_ApiConfigSource_msginit, arena, len);
 }
 
 UPB_INLINE int32_t envoy_api_v2_core_ApiConfigSource_api_type(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
-UPB_INLINE upb_strview const* envoy_api_v2_core_ApiConfigSource_cluster_names(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_refresh_delay(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 8)); }
-UPB_INLINE const struct envoy_api_v2_core_GrpcService* const* envoy_api_v2_core_ApiConfigSource_grpc_services(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (const struct envoy_api_v2_core_GrpcService* const*)_upb_array_accessor(msg, UPB_SIZE(24, 40), len); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_request_timeout(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 16)); }
-UPB_INLINE const envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConfigSource_rate_limit_settings(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(16, 24)); }
+UPB_INLINE upb_strview const* envoy_api_v2_core_ApiConfigSource_cluster_names(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 40), len); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_refresh_delay(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 16)); }
+UPB_INLINE const struct envoy_api_v2_core_GrpcService* const* envoy_api_v2_core_ApiConfigSource_grpc_services(const envoy_api_v2_core_ApiConfigSource *msg, size_t *len) { return (const struct envoy_api_v2_core_GrpcService* const*)_upb_array_accessor(msg, UPB_SIZE(28, 48), len); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_request_timeout(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 24)); }
+UPB_INLINE const envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConfigSource_rate_limit_settings(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(20, 32)); }
+UPB_INLINE bool envoy_api_v2_core_ApiConfigSource_set_node_on_first_message_only(const envoy_api_v2_core_ApiConfigSource *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); }
 
 UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_api_type(envoy_api_v2_core_ApiConfigSource *msg, int32_t value) {
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 UPB_INLINE upb_strview* envoy_api_v2_core_ApiConfigSource_mutable_cluster_names(envoy_api_v2_core_ApiConfigSource *msg, size_t *len) {
-  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len);
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 40), len);
 }
 UPB_INLINE upb_strview* envoy_api_v2_core_ApiConfigSource_resize_cluster_names(envoy_api_v2_core_ApiConfigSource *msg, size_t len, upb_arena *arena) {
-  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
 }
 UPB_INLINE bool envoy_api_v2_core_ApiConfigSource_add_cluster_names(envoy_api_v2_core_ApiConfigSource *msg, upb_strview val, upb_arena *arena) {
   return _upb_array_append_accessor(
-      msg, UPB_SIZE(20, 32), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+      msg, UPB_SIZE(24, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_refresh_delay(envoy_api_v2_core_ApiConfigSource *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 8)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 16)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mutable_refresh_delay(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_ApiConfigSource_refresh_delay(msg);
@@ -96,20 +97,20 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mu
   return sub;
 }
 UPB_INLINE struct envoy_api_v2_core_GrpcService** envoy_api_v2_core_ApiConfigSource_mutable_grpc_services(envoy_api_v2_core_ApiConfigSource *msg, size_t *len) {
-  return (struct envoy_api_v2_core_GrpcService**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 40), len);
+  return (struct envoy_api_v2_core_GrpcService**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 48), len);
 }
 UPB_INLINE struct envoy_api_v2_core_GrpcService** envoy_api_v2_core_ApiConfigSource_resize_grpc_services(envoy_api_v2_core_ApiConfigSource *msg, size_t len, upb_arena *arena) {
-  return (struct envoy_api_v2_core_GrpcService**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (struct envoy_api_v2_core_GrpcService**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_core_GrpcService* envoy_api_v2_core_ApiConfigSource_add_grpc_services(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) {
   struct envoy_api_v2_core_GrpcService* sub = (struct envoy_api_v2_core_GrpcService*)upb_msg_new(&envoy_api_v2_core_GrpcService_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(24, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(28, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_request_timeout(envoy_api_v2_core_ApiConfigSource *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 16)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 24)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mutable_request_timeout(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_ApiConfigSource_request_timeout(msg);
@@ -121,7 +122,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ApiConfigSource_mu
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_rate_limit_settings(envoy_api_v2_core_ApiConfigSource *msg, envoy_api_v2_core_RateLimitSettings* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(16, 24)) = value;
+  UPB_FIELD_AT(msg, envoy_api_v2_core_RateLimitSettings*, UPB_SIZE(20, 32)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConfigSource_mutable_rate_limit_settings(envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena) {
   struct envoy_api_v2_core_RateLimitSettings* sub = (struct envoy_api_v2_core_RateLimitSettings*)envoy_api_v2_core_ApiConfigSource_rate_limit_settings(msg);
@@ -132,16 +133,19 @@ UPB_INLINE struct envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConf
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_core_ApiConfigSource_set_set_node_on_first_message_only(envoy_api_v2_core_ApiConfigSource *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value;
+}
 
 /* envoy.api.v2.core.AggregatedConfigSource */
 
 UPB_INLINE envoy_api_v2_core_AggregatedConfigSource *envoy_api_v2_core_AggregatedConfigSource_new(upb_arena *arena) {
   return (envoy_api_v2_core_AggregatedConfigSource *)upb_msg_new(&envoy_api_v2_core_AggregatedConfigSource_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_AggregatedConfigSource *envoy_api_v2_core_AggregatedConfigSource_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_AggregatedConfigSource *envoy_api_v2_core_AggregatedConfigSource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_AggregatedConfigSource *ret = envoy_api_v2_core_AggregatedConfigSource_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_AggregatedConfigSource_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_AggregatedConfigSource_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_AggregatedConfigSource_serialize(const envoy_api_v2_core_AggregatedConfigSource *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_AggregatedConfigSource_msginit, arena, len);
@@ -149,15 +153,15 @@ UPB_INLINE char *envoy_api_v2_core_AggregatedConfigSource_serialize(const envoy_
 
 
 
-
 /* envoy.api.v2.core.RateLimitSettings */
 
 UPB_INLINE envoy_api_v2_core_RateLimitSettings *envoy_api_v2_core_RateLimitSettings_new(upb_arena *arena) {
   return (envoy_api_v2_core_RateLimitSettings *)upb_msg_new(&envoy_api_v2_core_RateLimitSettings_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_RateLimitSettings *envoy_api_v2_core_RateLimitSettings_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_RateLimitSettings *envoy_api_v2_core_RateLimitSettings_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_RateLimitSettings *ret = envoy_api_v2_core_RateLimitSettings_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RateLimitSettings_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RateLimitSettings_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_RateLimitSettings_serialize(const envoy_api_v2_core_RateLimitSettings *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_RateLimitSettings_msginit, arena, len);
@@ -191,15 +195,15 @@ UPB_INLINE struct google_protobuf_DoubleValue* envoy_api_v2_core_RateLimitSettin
   return sub;
 }
 
-
 /* envoy.api.v2.core.ConfigSource */
 
 UPB_INLINE envoy_api_v2_core_ConfigSource *envoy_api_v2_core_ConfigSource_new(upb_arena *arena) {
   return (envoy_api_v2_core_ConfigSource *)upb_msg_new(&envoy_api_v2_core_ConfigSource_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_ConfigSource *envoy_api_v2_core_ConfigSource_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_ConfigSource *envoy_api_v2_core_ConfigSource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_ConfigSource *ret = envoy_api_v2_core_ConfigSource_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_ConfigSource_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_ConfigSource_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_ConfigSource_serialize(const envoy_api_v2_core_ConfigSource *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_ConfigSource_msginit, arena, len);
@@ -209,22 +213,23 @@ typedef enum {
   envoy_api_v2_core_ConfigSource_config_source_specifier_path = 1,
   envoy_api_v2_core_ConfigSource_config_source_specifier_api_config_source = 2,
   envoy_api_v2_core_ConfigSource_config_source_specifier_ads = 3,
-  envoy_api_v2_core_ConfigSource_config_source_specifier_NOT_SET = 0,
+  envoy_api_v2_core_ConfigSource_config_source_specifier_NOT_SET = 0
 } envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases envoy_api_v2_core_ConfigSource_config_source_specifier_case(const envoy_api_v2_core_ConfigSource* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
+UPB_INLINE envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases envoy_api_v2_core_ConfigSource_config_source_specifier_case(const envoy_api_v2_core_ConfigSource* msg) { return (envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
 
-UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_path(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
-UPB_INLINE upb_strview envoy_api_v2_core_ConfigSource_path(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); }
-UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 2); }
-UPB_INLINE const envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSource_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 2, NULL); }
-UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_ads(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 3); }
-UPB_INLINE const envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_ConfigSource_ads(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 3, NULL); }
+UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_path(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 1); }
+UPB_INLINE upb_strview envoy_api_v2_core_ConfigSource_path(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 1, upb_strview_make("", strlen(""))); }
+UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
+UPB_INLINE const envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSource_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 2, NULL); }
+UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_ads(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); }
+UPB_INLINE const envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_ConfigSource_ads(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 3, NULL); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ConfigSource_initial_fetch_timeout(const envoy_api_v2_core_ConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(0, 0)); }
 
 UPB_INLINE void envoy_api_v2_core_ConfigSource_set_path(envoy_api_v2_core_ConfigSource *msg, upb_strview value) {
-  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
+  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 1);
 }
 UPB_INLINE void envoy_api_v2_core_ConfigSource_set_api_config_source(envoy_api_v2_core_ConfigSource *msg, envoy_api_v2_core_ApiConfigSource* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 2);
 }
 UPB_INLINE struct envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSource_mutable_api_config_source(envoy_api_v2_core_ConfigSource *msg, upb_arena *arena) {
   struct envoy_api_v2_core_ApiConfigSource* sub = (struct envoy_api_v2_core_ApiConfigSource*)envoy_api_v2_core_ConfigSource_api_config_source(msg);
@@ -236,7 +241,7 @@ UPB_INLINE struct envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSou
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_ConfigSource_set_ads(envoy_api_v2_core_ConfigSource *msg, envoy_api_v2_core_AggregatedConfigSource* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 3);
 }
 UPB_INLINE struct envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_ConfigSource_mutable_ads(envoy_api_v2_core_ConfigSource *msg, upb_arena *arena) {
   struct envoy_api_v2_core_AggregatedConfigSource* sub = (struct envoy_api_v2_core_AggregatedConfigSource*)envoy_api_v2_core_ConfigSource_ads(msg);
@@ -247,7 +252,18 @@ UPB_INLINE struct envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_Co
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_core_ConfigSource_set_initial_fetch_timeout(envoy_api_v2_core_ConfigSource *msg, struct google_protobuf_Duration* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ConfigSource_mutable_initial_fetch_timeout(envoy_api_v2_core_ConfigSource *msg, upb_arena *arena) {
+  struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_ConfigSource_initial_fetch_timeout(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_ConfigSource_set_initial_fetch_timeout(msg, sub);
+  }
+  return sub;
+}
 
 #ifdef __cplusplus
 }  /* extern "C" */
index 8369c02..bff3c3c 100644 (file)
 #define ENVOY_API_V2_CORE_GRPC_SERVICE_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -63,17 +63,16 @@ extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_Empty_msginit;
 extern const upb_msglayout google_protobuf_Struct_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.core.GrpcService */
 
 UPB_INLINE envoy_api_v2_core_GrpcService *envoy_api_v2_core_GrpcService_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService *)upb_msg_new(&envoy_api_v2_core_GrpcService_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService *envoy_api_v2_core_GrpcService_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService *envoy_api_v2_core_GrpcService_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService *ret = envoy_api_v2_core_GrpcService_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_serialize(const envoy_api_v2_core_GrpcService *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_msginit, arena, len);
@@ -82,9 +81,9 @@ UPB_INLINE char *envoy_api_v2_core_GrpcService_serialize(const envoy_api_v2_core
 typedef enum {
   envoy_api_v2_core_GrpcService_target_specifier_envoy_grpc = 1,
   envoy_api_v2_core_GrpcService_target_specifier_google_grpc = 2,
-  envoy_api_v2_core_GrpcService_target_specifier_NOT_SET = 0,
+  envoy_api_v2_core_GrpcService_target_specifier_NOT_SET = 0
 } envoy_api_v2_core_GrpcService_target_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_core_GrpcService_target_specifier_oneofcases envoy_api_v2_core_GrpcService_target_specifier_case(const envoy_api_v2_core_GrpcService* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
+UPB_INLINE envoy_api_v2_core_GrpcService_target_specifier_oneofcases envoy_api_v2_core_GrpcService_target_specifier_case(const envoy_api_v2_core_GrpcService* msg) { return (envoy_api_v2_core_GrpcService_target_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
 
 UPB_INLINE bool envoy_api_v2_core_GrpcService_has_envoy_grpc(const envoy_api_v2_core_GrpcService *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 1); }
 UPB_INLINE const envoy_api_v2_core_GrpcService_EnvoyGrpc* envoy_api_v2_core_GrpcService_envoy_grpc(const envoy_api_v2_core_GrpcService *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_GrpcService_EnvoyGrpc*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 1, NULL); }
@@ -143,15 +142,15 @@ UPB_INLINE struct envoy_api_v2_core_HeaderValue* envoy_api_v2_core_GrpcService_a
   return sub;
 }
 
-
 /* envoy.api.v2.core.GrpcService.EnvoyGrpc */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_EnvoyGrpc *envoy_api_v2_core_GrpcService_EnvoyGrpc_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_EnvoyGrpc *)upb_msg_new(&envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_EnvoyGrpc *envoy_api_v2_core_GrpcService_EnvoyGrpc_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_EnvoyGrpc *envoy_api_v2_core_GrpcService_EnvoyGrpc_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_EnvoyGrpc *ret = envoy_api_v2_core_GrpcService_EnvoyGrpc_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_EnvoyGrpc_serialize(const envoy_api_v2_core_GrpcService_EnvoyGrpc *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit, arena, len);
@@ -163,15 +162,15 @@ UPB_INLINE void envoy_api_v2_core_GrpcService_EnvoyGrpc_set_cluster_name(envoy_a
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc *envoy_api_v2_core_GrpcService_GoogleGrpc_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc *envoy_api_v2_core_GrpcService_GoogleGrpc_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc *envoy_api_v2_core_GrpcService_GoogleGrpc_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_msginit, arena, len);
@@ -231,15 +230,15 @@ UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_GrpcService_GoogleGr
   return sub;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.SslCredentials */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit, arena, len);
@@ -286,15 +285,15 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_core_GrpcService_Go
   return sub;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.GoogleLocalCredentials */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit, arena, len);
@@ -302,15 +301,15 @@ UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials
 
 
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.ChannelCredentials */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit, arena, len);
@@ -320,9 +319,9 @@ typedef enum {
   envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_ssl_credentials = 1,
   envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_google_default = 2,
   envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_local_credentials = 3,
-  envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_NOT_SET = 0,
+  envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_NOT_SET = 0
 } envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); }
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials* msg) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
 
 UPB_INLINE bool envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_has_ssl_credentials(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
 UPB_INLINE const envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials* envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_ssl_credentials(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
@@ -368,15 +367,15 @@ UPB_INLINE struct envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredential
   return sub;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit, arena, len);
@@ -389,9 +388,9 @@ typedef enum {
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_service_account_jwt_access = 4,
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_google_iam = 5,
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_from_plugin = 6,
-  envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_NOT_SET = 0,
+  envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_NOT_SET = 0
 } envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases;
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials* msg) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); }
 
 UPB_INLINE bool envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_has_access_token(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
 UPB_INLINE upb_strview envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_access_token(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); }
@@ -461,15 +460,15 @@ UPB_INLINE struct envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_Metad
   return sub;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit, arena, len);
@@ -485,15 +484,15 @@ UPB_INLINE void envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_Service
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit, arena, len);
@@ -509,15 +508,15 @@ UPB_INLINE void envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleI
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
 
-
 /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin */
 
 UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit, arena, len);
@@ -526,9 +525,9 @@ UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_Metada
 typedef enum {
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_config = 2,
   envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_typed_config = 3,
-  envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_NOT_SET = 0,
+  envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_NOT_SET = 0
 } envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases;
-UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
+UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin* msg) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
 
 UPB_INLINE upb_strview envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_name(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
 UPB_INLINE bool envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_has_config(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
@@ -564,7 +563,6 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_GrpcService_GoogleGrpc_
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index a6dcd52..9b804ab 100644 (file)
@@ -10,6 +10,7 @@
 #include "upb/msg.h"
 #include "envoy/api/v2/core/health_check.upb.h"
 #include "envoy/api/v2/core/base.upb.h"
+#include "envoy/type/range.upb.h"
 #include "google/protobuf/any.upb.h"
 #include "google/protobuf/duration.upb.h"
 #include "google/protobuf/struct.upb.h"
@@ -19,7 +20,7 @@
 
 #include "upb/port_def.inc"
 
-static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[15] = {
+static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[16] = {
   &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit,
   &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit,
   &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit,
@@ -29,30 +30,32 @@ static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[15] = {
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_core_HealthCheck__fields[17] = {
-  {1, UPB_SIZE(12, 24), 0, 5, 11, 1},
-  {2, UPB_SIZE(16, 32), 0, 5, 11, 1},
-  {3, UPB_SIZE(20, 40), 0, 5, 11, 1},
-  {4, UPB_SIZE(24, 48), 0, 6, 11, 1},
-  {5, UPB_SIZE(28, 56), 0, 6, 11, 1},
-  {6, UPB_SIZE(32, 64), 0, 6, 11, 1},
-  {7, UPB_SIZE(36, 72), 0, 4, 11, 1},
-  {8, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 2, 11, 1},
-  {9, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 3, 11, 1},
-  {11, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 1, 11, 1},
-  {12, UPB_SIZE(40, 80), 0, 5, 11, 1},
-  {13, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 0, 11, 1},
-  {14, UPB_SIZE(44, 88), 0, 5, 11, 1},
-  {15, UPB_SIZE(48, 96), 0, 5, 11, 1},
-  {16, UPB_SIZE(52, 104), 0, 5, 11, 1},
-  {17, UPB_SIZE(4, 8), 0, 0, 9, 1},
+static const upb_msglayout_field envoy_api_v2_core_HealthCheck__fields[19] = {
+  {1, UPB_SIZE(16, 24), 0, 5, 11, 1},
+  {2, UPB_SIZE(20, 32), 0, 5, 11, 1},
+  {3, UPB_SIZE(24, 40), 0, 5, 11, 1},
+  {4, UPB_SIZE(28, 48), 0, 6, 11, 1},
+  {5, UPB_SIZE(32, 56), 0, 6, 11, 1},
+  {6, UPB_SIZE(36, 64), 0, 6, 11, 1},
+  {7, UPB_SIZE(40, 72), 0, 4, 11, 1},
+  {8, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 2, 11, 1},
+  {9, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 3, 11, 1},
+  {11, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 1, 11, 1},
+  {12, UPB_SIZE(44, 80), 0, 5, 11, 1},
+  {13, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 0, 11, 1},
+  {14, UPB_SIZE(48, 88), 0, 5, 11, 1},
+  {15, UPB_SIZE(52, 96), 0, 5, 11, 1},
+  {16, UPB_SIZE(56, 104), 0, 5, 11, 1},
+  {17, UPB_SIZE(8, 8), 0, 0, 9, 1},
   {18, UPB_SIZE(0, 0), 0, 0, 13, 1},
+  {19, UPB_SIZE(4, 4), 0, 0, 8, 1},
+  {20, UPB_SIZE(60, 112), 0, 5, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_core_HealthCheck_msginit = {
   &envoy_api_v2_core_HealthCheck_submsgs[0],
   &envoy_api_v2_core_HealthCheck__fields[0],
-  UPB_SIZE(64, 128), 17, false,
+  UPB_SIZE(72, 144), 19, false,
 };
 
 static const upb_msglayout_field envoy_api_v2_core_HealthCheck_Payload__fields[2] = {
@@ -66,12 +69,13 @@ const upb_msglayout envoy_api_v2_core_HealthCheck_Payload_msginit = {
   UPB_SIZE(16, 32), 2, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[3] = {
+static const upb_msglayout *const envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[4] = {
   &envoy_api_v2_core_HeaderValueOption_msginit,
   &envoy_api_v2_core_HealthCheck_Payload_msginit,
+  &envoy_type_Int64Range_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[8] = {
+static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[9] = {
   {1, UPB_SIZE(4, 8), 0, 0, 9, 1},
   {2, UPB_SIZE(12, 24), 0, 0, 9, 1},
   {3, UPB_SIZE(28, 56), 0, 1, 11, 1},
@@ -80,12 +84,13 @@ static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__
   {6, UPB_SIZE(36, 72), 0, 0, 11, 3},
   {7, UPB_SIZE(0, 0), 0, 0, 8, 1},
   {8, UPB_SIZE(40, 80), 0, 0, 9, 3},
+  {9, UPB_SIZE(44, 88), 0, 2, 11, 3},
 };
 
 const upb_msglayout envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit = {
   &envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[0],
   &envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[0],
-  UPB_SIZE(48, 96), 8, false,
+  UPB_SIZE(48, 96), 9, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_core_HealthCheck_TcpHealthCheck_submsgs[2] = {
@@ -113,14 +118,15 @@ const upb_msglayout envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit = {
   UPB_SIZE(8, 16), 1, false,
 };
 
-static const upb_msglayout_field envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[1] = {
+static const upb_msglayout_field envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[2] = {
   {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 9, 1},
 };
 
 const upb_msglayout envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit = {
   NULL,
   &envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[0],
-  UPB_SIZE(8, 16), 1, false,
+  UPB_SIZE(16, 32), 2, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_core_HealthCheck_CustomHealthCheck_submsgs[2] = {
index 7db04bf..6e7b258 100644 (file)
 #define ENVOY_API_V2_CORE_HEALTH_CHECK_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -42,26 +42,27 @@ extern const upb_msglayout envoy_api_v2_core_HealthCheck_RedisHealthCheck_msgini
 extern const upb_msglayout envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit;
 extern const upb_msglayout envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit;
 struct envoy_api_v2_core_HeaderValueOption;
+struct envoy_type_Int64Range;
 struct google_protobuf_Any;
 struct google_protobuf_BoolValue;
 struct google_protobuf_Duration;
 struct google_protobuf_Struct;
 struct google_protobuf_UInt32Value;
 extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit;
+extern const upb_msglayout envoy_type_Int64Range_msginit;
 extern const upb_msglayout google_protobuf_Any_msginit;
 extern const upb_msglayout google_protobuf_BoolValue_msginit;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_Struct_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 typedef enum {
   envoy_api_v2_core_UNKNOWN = 0,
   envoy_api_v2_core_HEALTHY = 1,
   envoy_api_v2_core_UNHEALTHY = 2,
   envoy_api_v2_core_DRAINING = 3,
-  envoy_api_v2_core_TIMEOUT = 4
+  envoy_api_v2_core_TIMEOUT = 4,
+  envoy_api_v2_core_DEGRADED = 5
 } envoy_api_v2_core_HealthStatus;
 
 
@@ -70,9 +71,10 @@ typedef enum {
 UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck *ret = envoy_api_v2_core_HealthCheck_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_serialize(const envoy_api_v2_core_HealthCheck *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_msginit, arena, len);
@@ -83,34 +85,36 @@ typedef enum {
   envoy_api_v2_core_HealthCheck_health_checker_tcp_health_check = 9,
   envoy_api_v2_core_HealthCheck_health_checker_grpc_health_check = 11,
   envoy_api_v2_core_HealthCheck_health_checker_custom_health_check = 13,
-  envoy_api_v2_core_HealthCheck_health_checker_NOT_SET = 0,
+  envoy_api_v2_core_HealthCheck_health_checker_NOT_SET = 0
 } envoy_api_v2_core_HealthCheck_health_checker_oneofcases;
-UPB_INLINE envoy_api_v2_core_HealthCheck_health_checker_oneofcases envoy_api_v2_core_HealthCheck_health_checker_case(const envoy_api_v2_core_HealthCheck* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(60, 120)); }
-
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_timeout(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 24)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 32)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(20, 40)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_unhealthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_healthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_alt_port(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); }
-UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_reuse_connection(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(36, 72)); }
-UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 8); }
-UPB_INLINE const envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 8, NULL); }
-UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 9); }
-UPB_INLINE const envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 9, NULL); }
-UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 11); }
-UPB_INLINE const envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 11, NULL); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_no_traffic_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(40, 80)); }
-UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 13); }
-UPB_INLINE const envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 13, NULL); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(44, 88)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 96)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_healthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(52, 104)); }
-UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_event_log_path(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE envoy_api_v2_core_HealthCheck_health_checker_oneofcases envoy_api_v2_core_HealthCheck_health_checker_case(const envoy_api_v2_core_HealthCheck* msg) { return (envoy_api_v2_core_HealthCheck_health_checker_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(68, 128)); }
+
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_timeout(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 24)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(20, 32)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(24, 40)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_unhealthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_healthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 56)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_alt_port(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 64)); }
+UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_reuse_connection(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(40, 72)); }
+UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 8); }
+UPB_INLINE const envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 8, NULL); }
+UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 9); }
+UPB_INLINE const envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 9, NULL); }
+UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 11); }
+UPB_INLINE const envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 11, NULL); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_no_traffic_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(44, 80)); }
+UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 13); }
+UPB_INLINE const envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 13, NULL); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 88)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(52, 96)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_healthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(56, 104)); }
+UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_event_log_path(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
 UPB_INLINE uint32_t envoy_api_v2_core_HealthCheck_interval_jitter_percent(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE bool envoy_api_v2_core_HealthCheck_always_log_health_check_failures(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_initial_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(60, 112)); }
 
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_timeout(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 24)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 24)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_timeout(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_timeout(msg);
@@ -122,7 +126,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 32)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(20, 32)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_interval(msg);
@@ -134,7 +138,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval_jitter(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(20, 40)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(24, 40)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_interval_jitter(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_interval_jitter(msg);
@@ -146,7 +150,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_threshold(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_unhealthy_threshold(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_unhealthy_threshold(msg);
@@ -158,7 +162,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mut
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_healthy_threshold(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 56)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_healthy_threshold(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_healthy_threshold(msg);
@@ -170,7 +174,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mut
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_alt_port(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 64)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_alt_port(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_alt_port(msg);
@@ -182,7 +186,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mut
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_reuse_connection(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_BoolValue* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(36, 72)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(40, 72)) = value;
 }
 UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_mutable_reuse_connection(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_core_HealthCheck_reuse_connection(msg);
@@ -194,7 +198,7 @@ UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_mutab
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_http_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 8);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 8);
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_mutable_http_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_HttpHealthCheck*)envoy_api_v2_core_HealthCheck_http_health_check(msg);
@@ -206,7 +210,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_co
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_tcp_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 9);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 9);
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_mutable_tcp_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_TcpHealthCheck*)envoy_api_v2_core_HealthCheck_tcp_health_check(msg);
@@ -218,7 +222,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_cor
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_grpc_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 11);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 11);
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_mutable_grpc_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck*)envoy_api_v2_core_HealthCheck_grpc_health_check(msg);
@@ -230,7 +234,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_co
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_no_traffic_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(40, 80)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(44, 80)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_no_traffic_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_no_traffic_interval(msg);
@@ -242,7 +246,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_custom_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck* value) {
-  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 13);
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 13);
 }
 UPB_INLINE struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_mutable_custom_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_CustomHealthCheck*)envoy_api_v2_core_HealthCheck_custom_health_check(msg);
@@ -254,7 +258,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(44, 88)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 88)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_unhealthy_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_unhealthy_interval(msg);
@@ -266,7 +270,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 96)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(52, 96)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_unhealthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(msg);
@@ -278,7 +282,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_healthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(52, 104)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(56, 104)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_healthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_healthy_edge_interval(msg);
@@ -290,21 +294,36 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl
   return sub;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_event_log_path(envoy_api_v2_core_HealthCheck *msg, upb_strview value) {
-  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
 }
 UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval_jitter_percent(envoy_api_v2_core_HealthCheck *msg, uint32_t value) {
   UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
 }
-
+UPB_INLINE void envoy_api_v2_core_HealthCheck_set_always_log_health_check_failures(envoy_api_v2_core_HealthCheck *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE void envoy_api_v2_core_HealthCheck_set_initial_jitter(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(60, 112)) = value;
+}
+UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_initial_jitter(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) {
+  struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_initial_jitter(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_HealthCheck_set_initial_jitter(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.core.HealthCheck.Payload */
 
 UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck_Payload *)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck_Payload *ret = envoy_api_v2_core_HealthCheck_Payload_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_Payload_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_Payload_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_Payload_serialize(const envoy_api_v2_core_HealthCheck_Payload *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_Payload_msginit, arena, len);
@@ -313,9 +332,9 @@ UPB_INLINE char *envoy_api_v2_core_HealthCheck_Payload_serialize(const envoy_api
 typedef enum {
   envoy_api_v2_core_HealthCheck_Payload_payload_text = 1,
   envoy_api_v2_core_HealthCheck_Payload_payload_binary = 2,
-  envoy_api_v2_core_HealthCheck_Payload_payload_NOT_SET = 0,
+  envoy_api_v2_core_HealthCheck_Payload_payload_NOT_SET = 0
 } envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases;
-UPB_INLINE envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases envoy_api_v2_core_HealthCheck_Payload_payload_case(const envoy_api_v2_core_HealthCheck_Payload* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
+UPB_INLINE envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases envoy_api_v2_core_HealthCheck_Payload_payload_case(const envoy_api_v2_core_HealthCheck_Payload* msg) { return (envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); }
 
 UPB_INLINE bool envoy_api_v2_core_HealthCheck_Payload_has_text(const envoy_api_v2_core_HealthCheck_Payload *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
 UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_Payload_text(const envoy_api_v2_core_HealthCheck_Payload *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); }
@@ -329,15 +348,15 @@ UPB_INLINE void envoy_api_v2_core_HealthCheck_Payload_set_binary(envoy_api_v2_co
   UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
 }
 
-
 /* envoy.api.v2.core.HealthCheck.HttpHealthCheck */
 
 UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck_HttpHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck_HttpHealthCheck *ret = envoy_api_v2_core_HealthCheck_HttpHealthCheck_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_HttpHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena, len);
@@ -351,6 +370,7 @@ UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_HttpHealthCheck_service_nam
 UPB_INLINE const struct envoy_api_v2_core_HeaderValueOption* const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_request_headers_to_add(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (const struct envoy_api_v2_core_HeaderValueOption* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
 UPB_INLINE bool envoy_api_v2_core_HealthCheck_HttpHealthCheck_use_http2(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
 UPB_INLINE upb_strview const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_request_headers_to_remove(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
+UPB_INLINE const struct envoy_type_Int64Range* const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_expected_statuses(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (const struct envoy_type_Int64Range* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
 
 UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_host(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
@@ -411,16 +431,29 @@ UPB_INLINE bool envoy_api_v2_core_HealthCheck_HttpHealthCheck_add_request_header
   return _upb_array_append_accessor(
       msg, UPB_SIZE(40, 80), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
-
+UPB_INLINE struct envoy_type_Int64Range** envoy_api_v2_core_HealthCheck_HttpHealthCheck_mutable_expected_statuses(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) {
+  return (struct envoy_type_Int64Range**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
+}
+UPB_INLINE struct envoy_type_Int64Range** envoy_api_v2_core_HealthCheck_HttpHealthCheck_resize_expected_statuses(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t len, upb_arena *arena) {
+  return (struct envoy_type_Int64Range**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct envoy_type_Int64Range* envoy_api_v2_core_HealthCheck_HttpHealthCheck_add_expected_statuses(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena) {
+  struct envoy_type_Int64Range* sub = (struct envoy_type_Int64Range*)upb_msg_new(&envoy_type_Int64Range_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
 
 /* envoy.api.v2.core.HealthCheck.TcpHealthCheck */
 
 UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck_TcpHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck_TcpHealthCheck *ret = envoy_api_v2_core_HealthCheck_TcpHealthCheck_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_TcpHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena, len);
@@ -455,15 +488,15 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_Healt
   return sub;
 }
 
-
 /* envoy.api.v2.core.HealthCheck.RedisHealthCheck */
 
 UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck_RedisHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck_RedisHealthCheck *ret = envoy_api_v2_core_HealthCheck_RedisHealthCheck_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_RedisHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_RedisHealthCheck *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena, len);
@@ -475,35 +508,39 @@ UPB_INLINE void envoy_api_v2_core_HealthCheck_RedisHealthCheck_set_key(envoy_api
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.core.HealthCheck.GrpcHealthCheck */
 
 UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck_GrpcHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck_GrpcHealthCheck *ret = envoy_api_v2_core_HealthCheck_GrpcHealthCheck_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena, len);
 }
 
 UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_GrpcHealthCheck_service_name(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_GrpcHealthCheck_authority(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
 
 UPB_INLINE void envoy_api_v2_core_HealthCheck_GrpcHealthCheck_set_service_name(envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
-
+UPB_INLINE void envoy_api_v2_core_HealthCheck_GrpcHealthCheck_set_authority(envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
+}
 
 /* envoy.api.v2.core.HealthCheck.CustomHealthCheck */
 
 UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_new(upb_arena *arena) {
   return (envoy_api_v2_core_HealthCheck_CustomHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HealthCheck_CustomHealthCheck *ret = envoy_api_v2_core_HealthCheck_CustomHealthCheck_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HealthCheck_CustomHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena, len);
@@ -512,9 +549,9 @@ UPB_INLINE char *envoy_api_v2_core_HealthCheck_CustomHealthCheck_serialize(const
 typedef enum {
   envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_config = 2,
   envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_typed_config = 3,
-  envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_NOT_SET = 0,
+  envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_NOT_SET = 0
 } envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases;
-UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_case(const envoy_api_v2_core_HealthCheck_CustomHealthCheck* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); }
+UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_case(const envoy_api_v2_core_HealthCheck_CustomHealthCheck* msg) { return (envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
 
 UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_CustomHealthCheck_name(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
 UPB_INLINE bool envoy_api_v2_core_HealthCheck_CustomHealthCheck_has_config(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
@@ -550,7 +587,6 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_HealthCheck_CustomHealt
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c
new file mode 100644 (file)
index 0000000..f7999c7
--- /dev/null
@@ -0,0 +1,35 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     envoy/api/v2/core/http_uri.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "envoy/api/v2/core/http_uri.upb.h"
+#include "google/protobuf/duration.upb.h"
+#include "gogoproto/gogo.upb.h"
+#include "validate/validate.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const envoy_api_v2_core_HttpUri_submsgs[1] = {
+  &google_protobuf_Duration_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_core_HttpUri__fields[3] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(12, 24), UPB_SIZE(-21, -41), 0, 9, 1},
+  {3, UPB_SIZE(8, 16), 0, 0, 11, 1},
+};
+
+const upb_msglayout envoy_api_v2_core_HttpUri_msginit = {
+  &envoy_api_v2_core_HttpUri_submsgs[0],
+  &envoy_api_v2_core_HttpUri__fields[0],
+  UPB_SIZE(24, 48), 3, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h
new file mode 100644 (file)
index 0000000..f0dc22b
--- /dev/null
@@ -0,0 +1,80 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     envoy/api/v2/core/http_uri.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef ENVOY_API_V2_CORE_HTTP_URI_PROTO_UPB_H_
+#define ENVOY_API_V2_CORE_HTTP_URI_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct envoy_api_v2_core_HttpUri;
+typedef struct envoy_api_v2_core_HttpUri envoy_api_v2_core_HttpUri;
+extern const upb_msglayout envoy_api_v2_core_HttpUri_msginit;
+struct google_protobuf_Duration;
+extern const upb_msglayout google_protobuf_Duration_msginit;
+
+
+/* envoy.api.v2.core.HttpUri */
+
+UPB_INLINE envoy_api_v2_core_HttpUri *envoy_api_v2_core_HttpUri_new(upb_arena *arena) {
+  return (envoy_api_v2_core_HttpUri *)upb_msg_new(&envoy_api_v2_core_HttpUri_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_core_HttpUri *envoy_api_v2_core_HttpUri_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_core_HttpUri *ret = envoy_api_v2_core_HttpUri_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HttpUri_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_core_HttpUri_serialize(const envoy_api_v2_core_HttpUri *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_core_HttpUri_msginit, arena, len);
+}
+
+typedef enum {
+  envoy_api_v2_core_HttpUri_http_upstream_type_cluster = 2,
+  envoy_api_v2_core_HttpUri_http_upstream_type_NOT_SET = 0
+} envoy_api_v2_core_HttpUri_http_upstream_type_oneofcases;
+UPB_INLINE envoy_api_v2_core_HttpUri_http_upstream_type_oneofcases envoy_api_v2_core_HttpUri_http_upstream_type_case(const envoy_api_v2_core_HttpUri* msg) { return (envoy_api_v2_core_HttpUri_http_upstream_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(20, 40)); }
+
+UPB_INLINE upb_strview envoy_api_v2_core_HttpUri_uri(const envoy_api_v2_core_HttpUri *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE bool envoy_api_v2_core_HttpUri_has_cluster(const envoy_api_v2_core_HttpUri *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(20, 40), 2); }
+UPB_INLINE upb_strview envoy_api_v2_core_HttpUri_cluster(const envoy_api_v2_core_HttpUri *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(12, 24), UPB_SIZE(20, 40), 2, upb_strview_make("", strlen(""))); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HttpUri_timeout(const envoy_api_v2_core_HttpUri *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void envoy_api_v2_core_HttpUri_set_uri(envoy_api_v2_core_HttpUri *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_core_HttpUri_set_cluster(envoy_api_v2_core_HttpUri *msg, upb_strview value) {
+  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(12, 24), value, UPB_SIZE(20, 40), 2);
+}
+UPB_INLINE void envoy_api_v2_core_HttpUri_set_timeout(envoy_api_v2_core_HttpUri *msg, struct google_protobuf_Duration* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HttpUri_mutable_timeout(envoy_api_v2_core_HttpUri *msg, upb_arena *arena) {
+  struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HttpUri_timeout(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_HttpUri_set_timeout(msg, sub);
+  }
+  return sub;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* ENVOY_API_V2_CORE_HTTP_URI_PROTO_UPB_H_ */
index fa8855d..48878df 100644 (file)
@@ -52,22 +52,29 @@ const upb_msglayout envoy_api_v2_core_Http1ProtocolOptions_msginit = {
   UPB_SIZE(16, 32), 3, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_core_Http2ProtocolOptions_submsgs[4] = {
+static const upb_msglayout *const envoy_api_v2_core_Http2ProtocolOptions_submsgs[9] = {
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_core_Http2ProtocolOptions__fields[5] = {
+static const upb_msglayout_field envoy_api_v2_core_Http2ProtocolOptions__fields[12] = {
   {1, UPB_SIZE(4, 8), 0, 0, 11, 1},
   {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
   {3, UPB_SIZE(12, 24), 0, 0, 11, 1},
   {4, UPB_SIZE(16, 32), 0, 0, 11, 1},
   {5, UPB_SIZE(0, 0), 0, 0, 8, 1},
+  {6, UPB_SIZE(1, 1), 0, 0, 8, 1},
+  {7, UPB_SIZE(20, 40), 0, 0, 11, 1},
+  {8, UPB_SIZE(24, 48), 0, 0, 11, 1},
+  {9, UPB_SIZE(28, 56), 0, 0, 11, 1},
+  {10, UPB_SIZE(32, 64), 0, 0, 11, 1},
+  {11, UPB_SIZE(36, 72), 0, 0, 11, 1},
+  {12, UPB_SIZE(2, 2), 0, 0, 8, 1},
 };
 
 const upb_msglayout envoy_api_v2_core_Http2ProtocolOptions_msginit = {
   &envoy_api_v2_core_Http2ProtocolOptions_submsgs[0],
   &envoy_api_v2_core_Http2ProtocolOptions__fields[0],
-  UPB_SIZE(20, 40), 5, false,
+  UPB_SIZE(40, 80), 12, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_core_GrpcProtocolOptions_submsgs[1] = {
index db352e4..a82cfc1 100644 (file)
 #define ENVOY_API_V2_CORE_PROTOCOL_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -42,17 +42,16 @@ extern const upb_msglayout google_protobuf_BoolValue_msginit;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.core.TcpProtocolOptions */
 
 UPB_INLINE envoy_api_v2_core_TcpProtocolOptions *envoy_api_v2_core_TcpProtocolOptions_new(upb_arena *arena) {
   return (envoy_api_v2_core_TcpProtocolOptions *)upb_msg_new(&envoy_api_v2_core_TcpProtocolOptions_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_TcpProtocolOptions *envoy_api_v2_core_TcpProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_TcpProtocolOptions *envoy_api_v2_core_TcpProtocolOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_TcpProtocolOptions *ret = envoy_api_v2_core_TcpProtocolOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TcpProtocolOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_TcpProtocolOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_TcpProtocolOptions_serialize(const envoy_api_v2_core_TcpProtocolOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_TcpProtocolOptions_msginit, arena, len);
@@ -60,15 +59,15 @@ UPB_INLINE char *envoy_api_v2_core_TcpProtocolOptions_serialize(const envoy_api_
 
 
 
-
 /* envoy.api.v2.core.HttpProtocolOptions */
 
 UPB_INLINE envoy_api_v2_core_HttpProtocolOptions *envoy_api_v2_core_HttpProtocolOptions_new(upb_arena *arena) {
   return (envoy_api_v2_core_HttpProtocolOptions *)upb_msg_new(&envoy_api_v2_core_HttpProtocolOptions_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_HttpProtocolOptions *envoy_api_v2_core_HttpProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_HttpProtocolOptions *envoy_api_v2_core_HttpProtocolOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_HttpProtocolOptions *ret = envoy_api_v2_core_HttpProtocolOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HttpProtocolOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HttpProtocolOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_HttpProtocolOptions_serialize(const envoy_api_v2_core_HttpProtocolOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_HttpProtocolOptions_msginit, arena, len);
@@ -89,15 +88,15 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HttpProtocolOption
   return sub;
 }
 
-
 /* envoy.api.v2.core.Http1ProtocolOptions */
 
 UPB_INLINE envoy_api_v2_core_Http1ProtocolOptions *envoy_api_v2_core_Http1ProtocolOptions_new(upb_arena *arena) {
   return (envoy_api_v2_core_Http1ProtocolOptions *)upb_msg_new(&envoy_api_v2_core_Http1ProtocolOptions_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Http1ProtocolOptions *envoy_api_v2_core_Http1ProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Http1ProtocolOptions *envoy_api_v2_core_Http1ProtocolOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Http1ProtocolOptions *ret = envoy_api_v2_core_Http1ProtocolOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Http1ProtocolOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Http1ProtocolOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Http1ProtocolOptions_serialize(const envoy_api_v2_core_Http1ProtocolOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Http1ProtocolOptions_msginit, arena, len);
@@ -126,15 +125,15 @@ UPB_INLINE void envoy_api_v2_core_Http1ProtocolOptions_set_default_host_for_http
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
 }
 
-
 /* envoy.api.v2.core.Http2ProtocolOptions */
 
 UPB_INLINE envoy_api_v2_core_Http2ProtocolOptions *envoy_api_v2_core_Http2ProtocolOptions_new(upb_arena *arena) {
   return (envoy_api_v2_core_Http2ProtocolOptions *)upb_msg_new(&envoy_api_v2_core_Http2ProtocolOptions_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_Http2ProtocolOptions *envoy_api_v2_core_Http2ProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_Http2ProtocolOptions *envoy_api_v2_core_Http2ProtocolOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_Http2ProtocolOptions *ret = envoy_api_v2_core_Http2ProtocolOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Http2ProtocolOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Http2ProtocolOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_Http2ProtocolOptions_serialize(const envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_Http2ProtocolOptions_msginit, arena, len);
@@ -145,6 +144,13 @@ UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2Prot
 UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_initial_stream_window_size(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)); }
 UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_initial_connection_window_size(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); }
 UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_allow_connect(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
+UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_allow_metadata(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_outbound_frames(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_outbound_control_frames(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_consecutive_inbound_frames_with_empty_payload(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_inbound_priority_frames_per_stream(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_max_inbound_window_update_frames_per_data_frame_sent(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)); }
+UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_stream_error_on_invalid_http_messaging(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
 
 UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_hpack_table_size(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) {
   UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)) = value;
@@ -197,16 +203,82 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOp
 UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_allow_connect(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) {
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
-
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_allow_metadata(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 40)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_outbound_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_outbound_frames(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_frames(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_control_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_outbound_control_frames(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_outbound_control_frames(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_Http2ProtocolOptions_set_max_outbound_control_frames(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_consecutive_inbound_frames_with_empty_payload(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_consecutive_inbound_frames_with_empty_payload(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_consecutive_inbound_frames_with_empty_payload(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_Http2ProtocolOptions_set_max_consecutive_inbound_frames_with_empty_payload(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_priority_frames_per_stream(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_inbound_priority_frames_per_stream(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_inbound_priority_frames_per_stream(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_priority_frames_per_stream(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_window_update_frames_per_data_frame_sent(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 72)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_mutable_max_inbound_window_update_frames_per_data_frame_sent(envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_Http2ProtocolOptions_max_inbound_window_update_frames_per_data_frame_sent(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_core_Http2ProtocolOptions_set_max_inbound_window_update_frames_per_data_frame_sent(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_stream_error_on_invalid_http_messaging(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
+}
 
 /* envoy.api.v2.core.GrpcProtocolOptions */
 
 UPB_INLINE envoy_api_v2_core_GrpcProtocolOptions *envoy_api_v2_core_GrpcProtocolOptions_new(upb_arena *arena) {
   return (envoy_api_v2_core_GrpcProtocolOptions *)upb_msg_new(&envoy_api_v2_core_GrpcProtocolOptions_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_core_GrpcProtocolOptions *envoy_api_v2_core_GrpcProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_core_GrpcProtocolOptions *envoy_api_v2_core_GrpcProtocolOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_core_GrpcProtocolOptions *ret = envoy_api_v2_core_GrpcProtocolOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcProtocolOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcProtocolOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_core_GrpcProtocolOptions_serialize(const envoy_api_v2_core_GrpcProtocolOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_core_GrpcProtocolOptions_msginit, arena, len);
@@ -227,7 +299,6 @@ UPB_INLINE struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_core_Grpc
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 2f67f55..c51a38e 100644 (file)
@@ -36,31 +36,33 @@ const upb_msglayout envoy_api_v2_DiscoveryRequest_msginit = {
   UPB_SIZE(40, 80), 6, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_DiscoveryResponse_submsgs[1] = {
+static const upb_msglayout *const envoy_api_v2_DiscoveryResponse_submsgs[2] = {
+  &envoy_api_v2_core_ControlPlane_msginit,
   &google_protobuf_Any_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_DiscoveryResponse__fields[5] = {
+static const upb_msglayout_field envoy_api_v2_DiscoveryResponse__fields[6] = {
   {1, UPB_SIZE(4, 8), 0, 0, 9, 1},
-  {2, UPB_SIZE(28, 56), 0, 0, 11, 3},
+  {2, UPB_SIZE(32, 64), 0, 1, 11, 3},
   {3, UPB_SIZE(0, 0), 0, 0, 8, 1},
   {4, UPB_SIZE(12, 24), 0, 0, 9, 1},
   {5, UPB_SIZE(20, 40), 0, 0, 9, 1},
+  {6, UPB_SIZE(28, 56), 0, 0, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_DiscoveryResponse_msginit = {
   &envoy_api_v2_DiscoveryResponse_submsgs[0],
   &envoy_api_v2_DiscoveryResponse__fields[0],
-  UPB_SIZE(32, 64), 5, false,
+  UPB_SIZE(40, 80), 6, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_IncrementalDiscoveryRequest_submsgs[3] = {
-  &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit,
+static const upb_msglayout *const envoy_api_v2_DeltaDiscoveryRequest_submsgs[3] = {
+  &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit,
   &envoy_api_v2_core_Node_msginit,
   &google_rpc_Status_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest__fields[7] = {
+static const upb_msglayout_field envoy_api_v2_DeltaDiscoveryRequest__fields[7] = {
   {1, UPB_SIZE(16, 32), 0, 1, 11, 1},
   {2, UPB_SIZE(0, 0), 0, 0, 9, 1},
   {3, UPB_SIZE(24, 48), 0, 0, 9, 3},
@@ -70,53 +72,56 @@ static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest__field
   {7, UPB_SIZE(20, 40), 0, 2, 11, 1},
 };
 
-const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_msginit = {
-  &envoy_api_v2_IncrementalDiscoveryRequest_submsgs[0],
-  &envoy_api_v2_IncrementalDiscoveryRequest__fields[0],
+const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_msginit = {
+  &envoy_api_v2_DeltaDiscoveryRequest_submsgs[0],
+  &envoy_api_v2_DeltaDiscoveryRequest__fields[0],
   UPB_SIZE(40, 80), 7, false,
 };
 
-static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry__fields[2] = {
+static const upb_msglayout_field envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry__fields[2] = {
   {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
   {2, UPB_SIZE(8, 16), 0, 0, 9, 1},
 };
 
-const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit = {
+const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit = {
   NULL,
-  &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry__fields[0],
+  &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry__fields[0],
   UPB_SIZE(16, 32), 2, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_IncrementalDiscoveryResponse_submsgs[1] = {
+static const upb_msglayout *const envoy_api_v2_DeltaDiscoveryResponse_submsgs[1] = {
   &envoy_api_v2_Resource_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryResponse__fields[4] = {
+static const upb_msglayout_field envoy_api_v2_DeltaDiscoveryResponse__fields[5] = {
   {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
-  {2, UPB_SIZE(16, 32), 0, 0, 11, 3},
-  {5, UPB_SIZE(8, 16), 0, 0, 9, 1},
-  {6, UPB_SIZE(20, 40), 0, 0, 9, 3},
+  {2, UPB_SIZE(24, 48), 0, 0, 11, 3},
+  {4, UPB_SIZE(8, 16), 0, 0, 9, 1},
+  {5, UPB_SIZE(16, 32), 0, 0, 9, 1},
+  {6, UPB_SIZE(28, 56), 0, 0, 9, 3},
 };
 
-const upb_msglayout envoy_api_v2_IncrementalDiscoveryResponse_msginit = {
-  &envoy_api_v2_IncrementalDiscoveryResponse_submsgs[0],
-  &envoy_api_v2_IncrementalDiscoveryResponse__fields[0],
-  UPB_SIZE(24, 48), 4, false,
+const upb_msglayout envoy_api_v2_DeltaDiscoveryResponse_msginit = {
+  &envoy_api_v2_DeltaDiscoveryResponse_submsgs[0],
+  &envoy_api_v2_DeltaDiscoveryResponse__fields[0],
+  UPB_SIZE(32, 64), 5, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_Resource_submsgs[1] = {
   &google_protobuf_Any_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_Resource__fields[2] = {
+static const upb_msglayout_field envoy_api_v2_Resource__fields[4] = {
   {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
-  {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
+  {2, UPB_SIZE(16, 32), 0, 0, 11, 1},
+  {3, UPB_SIZE(8, 16), 0, 0, 9, 1},
+  {4, UPB_SIZE(20, 40), 0, 0, 9, 3},
 };
 
 const upb_msglayout envoy_api_v2_Resource_msginit = {
   &envoy_api_v2_Resource_submsgs[0],
   &envoy_api_v2_Resource__fields[0],
-  UPB_SIZE(16, 32), 2, false,
+  UPB_SIZE(24, 48), 4, false,
 };
 
 #include "upb/port_undef.inc"
index 7044ea9..b2475be 100644 (file)
 #define ENVOY_API_V2_DISCOVERY_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct envoy_api_v2_DiscoveryRequest;
 struct envoy_api_v2_DiscoveryResponse;
-struct envoy_api_v2_IncrementalDiscoveryRequest;
-struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry;
-struct envoy_api_v2_IncrementalDiscoveryResponse;
+struct envoy_api_v2_DeltaDiscoveryRequest;
+struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry;
+struct envoy_api_v2_DeltaDiscoveryResponse;
 struct envoy_api_v2_Resource;
 typedef struct envoy_api_v2_DiscoveryRequest envoy_api_v2_DiscoveryRequest;
 typedef struct envoy_api_v2_DiscoveryResponse envoy_api_v2_DiscoveryResponse;
-typedef struct envoy_api_v2_IncrementalDiscoveryRequest envoy_api_v2_IncrementalDiscoveryRequest;
-typedef struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry;
-typedef struct envoy_api_v2_IncrementalDiscoveryResponse envoy_api_v2_IncrementalDiscoveryResponse;
+typedef struct envoy_api_v2_DeltaDiscoveryRequest envoy_api_v2_DeltaDiscoveryRequest;
+typedef struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry;
+typedef struct envoy_api_v2_DeltaDiscoveryResponse envoy_api_v2_DeltaDiscoveryResponse;
 typedef struct envoy_api_v2_Resource envoy_api_v2_Resource;
 extern const upb_msglayout envoy_api_v2_DiscoveryRequest_msginit;
 extern const upb_msglayout envoy_api_v2_DiscoveryResponse_msginit;
-extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_msginit;
-extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit;
-extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryResponse_msginit;
+extern const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_msginit;
+extern const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit;
+extern const upb_msglayout envoy_api_v2_DeltaDiscoveryResponse_msginit;
 extern const upb_msglayout envoy_api_v2_Resource_msginit;
+struct envoy_api_v2_core_ControlPlane;
 struct envoy_api_v2_core_Node;
 struct google_protobuf_Any;
 struct google_rpc_Status;
+extern const upb_msglayout envoy_api_v2_core_ControlPlane_msginit;
 extern const upb_msglayout envoy_api_v2_core_Node_msginit;
 extern const upb_msglayout google_protobuf_Any_msginit;
 extern const upb_msglayout google_rpc_Status_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.DiscoveryRequest */
 
 UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_new(upb_arena *arena) {
   return (envoy_api_v2_DiscoveryRequest *)upb_msg_new(&envoy_api_v2_DiscoveryRequest_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_DiscoveryRequest *ret = envoy_api_v2_DiscoveryRequest_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_DiscoveryRequest_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DiscoveryRequest_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_DiscoveryRequest_serialize(const envoy_api_v2_DiscoveryRequest *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_DiscoveryRequest_msginit, arena, len);
@@ -112,39 +113,40 @@ UPB_INLINE struct google_rpc_Status* envoy_api_v2_DiscoveryRequest_mutable_error
   return sub;
 }
 
-
 /* envoy.api.v2.DiscoveryResponse */
 
 UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_new(upb_arena *arena) {
   return (envoy_api_v2_DiscoveryResponse *)upb_msg_new(&envoy_api_v2_DiscoveryResponse_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_DiscoveryResponse *ret = envoy_api_v2_DiscoveryResponse_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_DiscoveryResponse_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DiscoveryResponse_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_DiscoveryResponse_serialize(const envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_DiscoveryResponse_msginit, arena, len);
 }
 
 UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_version_info(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
-UPB_INLINE const struct google_protobuf_Any* const* envoy_api_v2_DiscoveryResponse_resources(const envoy_api_v2_DiscoveryResponse *msg, size_t *len) { return (const struct google_protobuf_Any* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
+UPB_INLINE const struct google_protobuf_Any* const* envoy_api_v2_DiscoveryResponse_resources(const envoy_api_v2_DiscoveryResponse *msg, size_t *len) { return (const struct google_protobuf_Any* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
 UPB_INLINE bool envoy_api_v2_DiscoveryResponse_canary(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
 UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_type_url(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
 UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_nonce(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
+UPB_INLINE const struct envoy_api_v2_core_ControlPlane* envoy_api_v2_DiscoveryResponse_control_plane(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_ControlPlane*, UPB_SIZE(28, 56)); }
 
 UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_version_info(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
 }
 UPB_INLINE struct google_protobuf_Any** envoy_api_v2_DiscoveryResponse_mutable_resources(envoy_api_v2_DiscoveryResponse *msg, size_t *len) {
-  return (struct google_protobuf_Any**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
+  return (struct google_protobuf_Any**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
 }
 UPB_INLINE struct google_protobuf_Any** envoy_api_v2_DiscoveryResponse_resize_resources(envoy_api_v2_DiscoveryResponse *msg, size_t len, upb_arena *arena) {
-  return (struct google_protobuf_Any**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (struct google_protobuf_Any**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct google_protobuf_Any* envoy_api_v2_DiscoveryResponse_add_resources(envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena) {
   struct google_protobuf_Any* sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
@@ -157,188 +159,206 @@ UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_type_url(envoy_api_v2_Discove
 UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_nonce(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
 }
+UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_control_plane(envoy_api_v2_DiscoveryResponse *msg, struct envoy_api_v2_core_ControlPlane* value) {
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_ControlPlane*, UPB_SIZE(28, 56)) = value;
+}
+UPB_INLINE struct envoy_api_v2_core_ControlPlane* envoy_api_v2_DiscoveryResponse_mutable_control_plane(envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena) {
+  struct envoy_api_v2_core_ControlPlane* sub = (struct envoy_api_v2_core_ControlPlane*)envoy_api_v2_DiscoveryResponse_control_plane(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_core_ControlPlane*)upb_msg_new(&envoy_api_v2_core_ControlPlane_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_DiscoveryResponse_set_control_plane(msg, sub);
+  }
+  return sub;
+}
 
+/* envoy.api.v2.DeltaDiscoveryRequest */
 
-/* envoy.api.v2.IncrementalDiscoveryRequest */
-
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest *envoy_api_v2_IncrementalDiscoveryRequest_new(upb_arena *arena) {
-  return (envoy_api_v2_IncrementalDiscoveryRequest *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_msginit, arena);
+UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest *envoy_api_v2_DeltaDiscoveryRequest_new(upb_arena *arena) {
+  return (envoy_api_v2_DeltaDiscoveryRequest *)upb_msg_new(&envoy_api_v2_DeltaDiscoveryRequest_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest *envoy_api_v2_IncrementalDiscoveryRequest_parsenew(upb_strview buf, upb_arena *arena) {
-  envoy_api_v2_IncrementalDiscoveryRequest *ret = envoy_api_v2_IncrementalDiscoveryRequest_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryRequest_msginit)) ? ret : NULL;
+UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest *envoy_api_v2_DeltaDiscoveryRequest_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_DeltaDiscoveryRequest *ret = envoy_api_v2_DeltaDiscoveryRequest_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DeltaDiscoveryRequest_msginit, arena)) ? ret : NULL;
 }
-UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryRequest_serialize(const envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena, size_t *len) {
-  return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryRequest_msginit, arena, len);
+UPB_INLINE char *envoy_api_v2_DeltaDiscoveryRequest_serialize(const envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_DeltaDiscoveryRequest_msginit, arena, len);
 }
 
-UPB_INLINE const struct envoy_api_v2_core_Node* envoy_api_v2_IncrementalDiscoveryRequest_node(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)); }
-UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_type_url(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
-UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryRequest_resource_names_subscribe(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
-UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryRequest_resource_names_unsubscribe(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
-UPB_INLINE const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* const* envoy_api_v2_IncrementalDiscoveryRequest_initial_resource_versions(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
-UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_response_nonce(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
-UPB_INLINE const struct google_rpc_Status* envoy_api_v2_IncrementalDiscoveryRequest_error_detail(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct google_rpc_Status*, UPB_SIZE(20, 40)); }
+UPB_INLINE const struct envoy_api_v2_core_Node* envoy_api_v2_DeltaDiscoveryRequest_node(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_type_url(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview const* envoy_api_v2_DeltaDiscoveryRequest_resource_names_subscribe(const envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
+UPB_INLINE upb_strview const* envoy_api_v2_DeltaDiscoveryRequest_resource_names_unsubscribe(const envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
+UPB_INLINE const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* const* envoy_api_v2_DeltaDiscoveryRequest_initial_resource_versions(const envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_response_nonce(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
+UPB_INLINE const struct google_rpc_Status* envoy_api_v2_DeltaDiscoveryRequest_error_detail(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct google_rpc_Status*, UPB_SIZE(20, 40)); }
 
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_node(envoy_api_v2_IncrementalDiscoveryRequest *msg, struct envoy_api_v2_core_Node* value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_node(envoy_api_v2_DeltaDiscoveryRequest *msg, struct envoy_api_v2_core_Node* value) {
   UPB_FIELD_AT(msg, struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)) = value;
 }
-UPB_INLINE struct envoy_api_v2_core_Node* envoy_api_v2_IncrementalDiscoveryRequest_mutable_node(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) {
-  struct envoy_api_v2_core_Node* sub = (struct envoy_api_v2_core_Node*)envoy_api_v2_IncrementalDiscoveryRequest_node(msg);
+UPB_INLINE struct envoy_api_v2_core_Node* envoy_api_v2_DeltaDiscoveryRequest_mutable_node(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena) {
+  struct envoy_api_v2_core_Node* sub = (struct envoy_api_v2_core_Node*)envoy_api_v2_DeltaDiscoveryRequest_node(msg);
   if (sub == NULL) {
     sub = (struct envoy_api_v2_core_Node*)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena);
     if (!sub) return NULL;
-    envoy_api_v2_IncrementalDiscoveryRequest_set_node(msg, sub);
+    envoy_api_v2_DeltaDiscoveryRequest_set_node(msg, sub);
   }
   return sub;
 }
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_type_url(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_type_url(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
-UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_mutable_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) {
+UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_mutable_resource_names_subscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) {
   return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
 }
-UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_resize_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) {
+UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_resize_resource_names_subscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t len, upb_arena *arena) {
   return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
 }
-UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryRequest_add_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
+UPB_INLINE bool envoy_api_v2_DeltaDiscoveryRequest_add_resource_names_subscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
   return _upb_array_append_accessor(
       msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
-UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_mutable_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) {
+UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_mutable_resource_names_unsubscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) {
   return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
 }
-UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_resize_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) {
+UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_resize_resource_names_unsubscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t len, upb_arena *arena) {
   return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
 }
-UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryRequest_add_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
+UPB_INLINE bool envoy_api_v2_DeltaDiscoveryRequest_add_resource_names_unsubscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview val, upb_arena *arena) {
   return _upb_array_append_accessor(
       msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_IncrementalDiscoveryRequest_mutable_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) {
-  return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
+UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_DeltaDiscoveryRequest_mutable_initial_resource_versions(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) {
+  return (envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
 }
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_IncrementalDiscoveryRequest_resize_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_DeltaDiscoveryRequest_resize_initial_resource_versions(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t len, upb_arena *arena) {
+  return (envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
-UPB_INLINE struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* envoy_api_v2_IncrementalDiscoveryRequest_add_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) {
-  struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* sub = (struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry*)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena);
+UPB_INLINE struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* envoy_api_v2_DeltaDiscoveryRequest_add_initial_resource_versions(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena) {
+  struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* sub = (struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry*)upb_msg_new(&envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena);
   bool ok = _upb_array_append_accessor(
       msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_response_nonce(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_response_nonce(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_error_detail(envoy_api_v2_IncrementalDiscoveryRequest *msg, struct google_rpc_Status* value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_error_detail(envoy_api_v2_DeltaDiscoveryRequest *msg, struct google_rpc_Status* value) {
   UPB_FIELD_AT(msg, struct google_rpc_Status*, UPB_SIZE(20, 40)) = value;
 }
-UPB_INLINE struct google_rpc_Status* envoy_api_v2_IncrementalDiscoveryRequest_mutable_error_detail(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) {
-  struct google_rpc_Status* sub = (struct google_rpc_Status*)envoy_api_v2_IncrementalDiscoveryRequest_error_detail(msg);
+UPB_INLINE struct google_rpc_Status* envoy_api_v2_DeltaDiscoveryRequest_mutable_error_detail(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena) {
+  struct google_rpc_Status* sub = (struct google_rpc_Status*)envoy_api_v2_DeltaDiscoveryRequest_error_detail(msg);
   if (sub == NULL) {
     sub = (struct google_rpc_Status*)upb_msg_new(&google_rpc_Status_msginit, arena);
     if (!sub) return NULL;
-    envoy_api_v2_IncrementalDiscoveryRequest_set_error_detail(msg, sub);
+    envoy_api_v2_DeltaDiscoveryRequest_set_error_detail(msg, sub);
   }
   return sub;
 }
 
+/* envoy.api.v2.DeltaDiscoveryRequest.InitialResourceVersionsEntry */
 
-/* envoy.api.v2.IncrementalDiscoveryRequest.InitialResourceVersionsEntry */
-
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_new(upb_arena *arena) {
-  return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena);
+UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_new(upb_arena *arena) {
+  return (envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *)upb_msg_new(&envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_parsenew(upb_strview buf, upb_arena *arena) {
-  envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *ret = envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit)) ? ret : NULL;
+UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *ret = envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena)) ? ret : NULL;
 }
-UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_serialize(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_arena *arena, size_t *len) {
-  return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena, len);
+UPB_INLINE char *envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_serialize(const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena, len);
 }
 
-UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_key(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
-UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_value(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_key(const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_value(const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
 
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_set_key(envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_set_key(envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_set_value(envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_set_value(envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
 
+/* envoy.api.v2.DeltaDiscoveryResponse */
 
-/* envoy.api.v2.IncrementalDiscoveryResponse */
-
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryResponse *envoy_api_v2_IncrementalDiscoveryResponse_new(upb_arena *arena) {
-  return (envoy_api_v2_IncrementalDiscoveryResponse *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryResponse_msginit, arena);
+UPB_INLINE envoy_api_v2_DeltaDiscoveryResponse *envoy_api_v2_DeltaDiscoveryResponse_new(upb_arena *arena) {
+  return (envoy_api_v2_DeltaDiscoveryResponse *)upb_msg_new(&envoy_api_v2_DeltaDiscoveryResponse_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_IncrementalDiscoveryResponse *envoy_api_v2_IncrementalDiscoveryResponse_parsenew(upb_strview buf, upb_arena *arena) {
-  envoy_api_v2_IncrementalDiscoveryResponse *ret = envoy_api_v2_IncrementalDiscoveryResponse_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryResponse_msginit)) ? ret : NULL;
+UPB_INLINE envoy_api_v2_DeltaDiscoveryResponse *envoy_api_v2_DeltaDiscoveryResponse_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_DeltaDiscoveryResponse *ret = envoy_api_v2_DeltaDiscoveryResponse_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DeltaDiscoveryResponse_msginit, arena)) ? ret : NULL;
 }
-UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryResponse_serialize(const envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_arena *arena, size_t *len) {
-  return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryResponse_msginit, arena, len);
+UPB_INLINE char *envoy_api_v2_DeltaDiscoveryResponse_serialize(const envoy_api_v2_DeltaDiscoveryResponse *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_DeltaDiscoveryResponse_msginit, arena, len);
 }
 
-UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryResponse_system_version_info(const envoy_api_v2_IncrementalDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
-UPB_INLINE const envoy_api_v2_Resource* const* envoy_api_v2_IncrementalDiscoveryResponse_resources(const envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { return (const envoy_api_v2_Resource* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
-UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryResponse_nonce(const envoy_api_v2_IncrementalDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
-UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryResponse_removed_resources(const envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryResponse_system_version_info(const envoy_api_v2_DeltaDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE const envoy_api_v2_Resource* const* envoy_api_v2_DeltaDiscoveryResponse_resources(const envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) { return (const envoy_api_v2_Resource* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryResponse_type_url(const envoy_api_v2_DeltaDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
+UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryResponse_nonce(const envoy_api_v2_DeltaDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)); }
+UPB_INLINE upb_strview const* envoy_api_v2_DeltaDiscoveryResponse_removed_resources(const envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
 
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryResponse_set_system_version_info(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryResponse_set_system_version_info(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
-UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_IncrementalDiscoveryResponse_mutable_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) {
-  return (envoy_api_v2_Resource**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
+UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_DeltaDiscoveryResponse_mutable_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) {
+  return (envoy_api_v2_Resource**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
 }
-UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_IncrementalDiscoveryResponse_resize_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_Resource**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_DeltaDiscoveryResponse_resize_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t len, upb_arena *arena) {
+  return (envoy_api_v2_Resource**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
-UPB_INLINE struct envoy_api_v2_Resource* envoy_api_v2_IncrementalDiscoveryResponse_add_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_arena *arena) {
+UPB_INLINE struct envoy_api_v2_Resource* envoy_api_v2_DeltaDiscoveryResponse_add_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_arena *arena) {
   struct envoy_api_v2_Resource* sub = (struct envoy_api_v2_Resource*)upb_msg_new(&envoy_api_v2_Resource_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
-UPB_INLINE void envoy_api_v2_IncrementalDiscoveryResponse_set_nonce(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview value) {
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryResponse_set_type_url(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
-UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryResponse_mutable_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) {
-  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
+UPB_INLINE void envoy_api_v2_DeltaDiscoveryResponse_set_nonce(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
 }
-UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryResponse_resize_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t len, upb_arena *arena) {
-  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryResponse_mutable_removed_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
 }
-UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryResponse_add_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview val, upb_arena *arena) {
+UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryResponse_resize_removed_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool envoy_api_v2_DeltaDiscoveryResponse_add_removed_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview val, upb_arena *arena) {
   return _upb_array_append_accessor(
-      msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+      msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 
-
 /* envoy.api.v2.Resource */
 
 UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_new(upb_arena *arena) {
   return (envoy_api_v2_Resource *)upb_msg_new(&envoy_api_v2_Resource_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_Resource *ret = envoy_api_v2_Resource_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_Resource_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Resource_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_Resource_serialize(const envoy_api_v2_Resource *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_Resource_msginit, arena, len);
 }
 
 UPB_INLINE upb_strview envoy_api_v2_Resource_version(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
-UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Resource_resource(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); }
+UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Resource_resource(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(16, 32)); }
+UPB_INLINE upb_strview envoy_api_v2_Resource_name(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
+UPB_INLINE upb_strview const* envoy_api_v2_Resource_aliases(const envoy_api_v2_Resource *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
 
 UPB_INLINE void envoy_api_v2_Resource_set_version(envoy_api_v2_Resource *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 UPB_INLINE void envoy_api_v2_Resource_set_resource(envoy_api_v2_Resource *msg, struct google_protobuf_Any* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(16, 32)) = value;
 }
 UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Resource_mutable_resource(envoy_api_v2_Resource *msg, upb_arena *arena) {
   struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_Resource_resource(msg);
@@ -349,7 +369,19 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Resource_mutable_resource(en
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_Resource_set_name(envoy_api_v2_Resource *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE upb_strview* envoy_api_v2_Resource_mutable_aliases(envoy_api_v2_Resource *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
+}
+UPB_INLINE upb_strview* envoy_api_v2_Resource_resize_aliases(envoy_api_v2_Resource *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool envoy_api_v2_Resource_add_aliases(envoy_api_v2_Resource *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
 
 #ifdef __cplusplus
 }  /* extern "C" */
index d6f074b..b8f5b57 100644 (file)
 #include "validate/validate.upb.h"
 #include "gogoproto/gogo.upb.h"
 #include "google/protobuf/wrappers.upb.h"
+#include "google/protobuf/duration.upb.h"
 
 #include "upb/port_def.inc"
 
-static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_submsgs[2] = {
+static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_submsgs[3] = {
+  &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit,
   &envoy_api_v2_ClusterLoadAssignment_Policy_msginit,
   &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment__fields[3] = {
+static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment__fields[4] = {
   {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
-  {2, UPB_SIZE(12, 24), 0, 1, 11, 3},
-  {4, UPB_SIZE(8, 16), 0, 0, 11, 1},
+  {2, UPB_SIZE(12, 24), 0, 2, 11, 3},
+  {4, UPB_SIZE(8, 16), 0, 1, 11, 1},
+  {5, UPB_SIZE(16, 32), 0, 0, 11, 3},
 };
 
 const upb_msglayout envoy_api_v2_ClusterLoadAssignment_msginit = {
   &envoy_api_v2_ClusterLoadAssignment_submsgs[0],
   &envoy_api_v2_ClusterLoadAssignment__fields[0],
-  UPB_SIZE(16, 32), 3, false,
+  UPB_SIZE(24, 48), 4, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_Policy_submsgs[2] = {
+static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_submsgs[1] = {
+  &envoy_api_v2_endpoint_Endpoint_msginit,
+};
+
+static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
+};
+
+const upb_msglayout envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit = {
+  &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_submsgs[0],
+  &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_Policy_submsgs[3] = {
   &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit,
+  &google_protobuf_Duration_msginit,
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment_Policy__fields[2] = {
-  {2, UPB_SIZE(4, 8), 0, 0, 11, 3},
-  {3, UPB_SIZE(0, 0), 0, 1, 11, 1},
+static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment_Policy__fields[3] = {
+  {2, UPB_SIZE(8, 16), 0, 0, 11, 3},
+  {3, UPB_SIZE(0, 0), 0, 2, 11, 1},
+  {4, UPB_SIZE(4, 8), 0, 1, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_ClusterLoadAssignment_Policy_msginit = {
   &envoy_api_v2_ClusterLoadAssignment_Policy_submsgs[0],
   &envoy_api_v2_ClusterLoadAssignment_Policy__fields[0],
-  UPB_SIZE(8, 16), 2, false,
+  UPB_SIZE(12, 24), 3, false,
 };
 
 static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_submsgs[1] = {
index a9b6f5f..3341470 100644 (file)
 #define ENVOY_API_V2_EDS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct envoy_api_v2_ClusterLoadAssignment;
+struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry;
 struct envoy_api_v2_ClusterLoadAssignment_Policy;
 struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload;
 typedef struct envoy_api_v2_ClusterLoadAssignment envoy_api_v2_ClusterLoadAssignment;
+typedef struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry;
 typedef struct envoy_api_v2_ClusterLoadAssignment_Policy envoy_api_v2_ClusterLoadAssignment_Policy;
 typedef struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload;
 extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_msginit;
+extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit;
 extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_Policy_msginit;
 extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit;
+struct envoy_api_v2_endpoint_Endpoint;
 struct envoy_api_v2_endpoint_LocalityLbEndpoints;
 struct envoy_type_FractionalPercent;
+struct google_protobuf_Duration;
 struct google_protobuf_UInt32Value;
+extern const upb_msglayout envoy_api_v2_endpoint_Endpoint_msginit;
 extern const upb_msglayout envoy_api_v2_endpoint_LocalityLbEndpoints_msginit;
 extern const upb_msglayout envoy_type_FractionalPercent_msginit;
+extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.ClusterLoadAssignment */
 
 UPB_INLINE envoy_api_v2_ClusterLoadAssignment *envoy_api_v2_ClusterLoadAssignment_new(upb_arena *arena) {
   return (envoy_api_v2_ClusterLoadAssignment *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_ClusterLoadAssignment *envoy_api_v2_ClusterLoadAssignment_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment *envoy_api_v2_ClusterLoadAssignment_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_ClusterLoadAssignment *ret = envoy_api_v2_ClusterLoadAssignment_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_ClusterLoadAssignment_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_serialize(const envoy_api_v2_ClusterLoadAssignment *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_msginit, arena, len);
@@ -55,6 +61,7 @@ UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_serialize(const envoy_api_v2
 UPB_INLINE upb_strview envoy_api_v2_ClusterLoadAssignment_cluster_name(const envoy_api_v2_ClusterLoadAssignment *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
 UPB_INLINE const struct envoy_api_v2_endpoint_LocalityLbEndpoints* const* envoy_api_v2_ClusterLoadAssignment_endpoints(const envoy_api_v2_ClusterLoadAssignment *msg, size_t *len) { return (const struct envoy_api_v2_endpoint_LocalityLbEndpoints* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); }
 UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_Policy* envoy_api_v2_ClusterLoadAssignment_policy(const envoy_api_v2_ClusterLoadAssignment *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_ClusterLoadAssignment_Policy*, UPB_SIZE(8, 16)); }
+UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* const* envoy_api_v2_ClusterLoadAssignment_named_endpoints(const envoy_api_v2_ClusterLoadAssignment *msg, size_t *len) { return (const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
 
 UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_set_cluster_name(envoy_api_v2_ClusterLoadAssignment *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
@@ -84,34 +91,81 @@ UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment_Policy* envoy_api_v2_Cluste
   }
   return sub;
 }
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry** envoy_api_v2_ClusterLoadAssignment_mutable_named_endpoints(envoy_api_v2_ClusterLoadAssignment *msg, size_t *len) {
+  return (envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
+}
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry** envoy_api_v2_ClusterLoadAssignment_resize_named_endpoints(envoy_api_v2_ClusterLoadAssignment *msg, size_t len, upb_arena *arena) {
+  return (envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* envoy_api_v2_ClusterLoadAssignment_add_named_endpoints(envoy_api_v2_ClusterLoadAssignment *msg, upb_arena *arena) {
+  struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* sub = (struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry*)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* envoy.api.v2.ClusterLoadAssignment.NamedEndpointsEntry */
+
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_new(upb_arena *arena) {
+  return (envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena);
+}
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *ret = envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_serialize(const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena, len);
+}
 
+UPB_INLINE upb_strview envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_key(const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct envoy_api_v2_endpoint_Endpoint* envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_value(const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_set_key(envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_set_value(envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, struct envoy_api_v2_endpoint_Endpoint* value) {
+  UPB_FIELD_AT(msg, struct envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct envoy_api_v2_endpoint_Endpoint* envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_mutable_value(envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, upb_arena *arena) {
+  struct envoy_api_v2_endpoint_Endpoint* sub = (struct envoy_api_v2_endpoint_Endpoint*)envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_value(msg);
+  if (sub == NULL) {
+    sub = (struct envoy_api_v2_endpoint_Endpoint*)upb_msg_new(&envoy_api_v2_endpoint_Endpoint_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_set_value(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.ClusterLoadAssignment.Policy */
 
 UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy *envoy_api_v2_ClusterLoadAssignment_Policy_new(upb_arena *arena) {
   return (envoy_api_v2_ClusterLoadAssignment_Policy *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_Policy_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy *envoy_api_v2_ClusterLoadAssignment_Policy_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy *envoy_api_v2_ClusterLoadAssignment_Policy_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_ClusterLoadAssignment_Policy *ret = envoy_api_v2_ClusterLoadAssignment_Policy_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_Policy_serialize(const envoy_api_v2_ClusterLoadAssignment_Policy *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit, arena, len);
 }
 
-UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const* envoy_api_v2_ClusterLoadAssignment_Policy_drop_overloads(const envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t *len) { return (const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
+UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const* envoy_api_v2_ClusterLoadAssignment_Policy_drop_overloads(const envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t *len) { return (const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); }
 UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_ClusterLoadAssignment_Policy_overprovisioning_factor(const envoy_api_v2_ClusterLoadAssignment_Policy *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_ClusterLoadAssignment_Policy_endpoint_stale_after(const envoy_api_v2_ClusterLoadAssignment_Policy *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(4, 8)); }
 
 UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload** envoy_api_v2_ClusterLoadAssignment_Policy_mutable_drop_overloads(envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t *len) {
-  return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
+  return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len);
 }
 UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload** envoy_api_v2_ClusterLoadAssignment_Policy_resize_drop_overloads(envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 16), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* envoy_api_v2_ClusterLoadAssignment_Policy_add_drop_overloads(envoy_api_v2_ClusterLoadAssignment_Policy *msg, upb_arena *arena) {
   struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* sub = (struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload*)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(8, 16), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
@@ -127,16 +181,28 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_ClusterLoadAssignmen
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_Policy_set_endpoint_stale_after(envoy_api_v2_ClusterLoadAssignment_Policy *msg, struct google_protobuf_Duration* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_ClusterLoadAssignment_Policy_mutable_endpoint_stale_after(envoy_api_v2_ClusterLoadAssignment_Policy *msg, upb_arena *arena) {
+  struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_ClusterLoadAssignment_Policy_endpoint_stale_after(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_ClusterLoadAssignment_Policy_set_endpoint_stale_after(msg, sub);
+  }
+  return sub;
+}
 
 /* envoy.api.v2.ClusterLoadAssignment.Policy.DropOverload */
 
 UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_new(upb_arena *arena) {
   return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *ret = envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_serialize(const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena, len);
@@ -161,7 +227,6 @@ UPB_INLINE struct envoy_type_FractionalPercent* envoy_api_v2_ClusterLoadAssignme
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 4cc9d7d..527096b 100644 (file)
@@ -50,36 +50,38 @@ static const upb_msglayout *const envoy_api_v2_endpoint_LbEndpoint_submsgs[3] =
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_endpoint_LbEndpoint__fields[4] = {
-  {1, UPB_SIZE(8, 8), 0, 1, 11, 1},
+static const upb_msglayout_field envoy_api_v2_endpoint_LbEndpoint__fields[5] = {
+  {1, UPB_SIZE(16, 24), UPB_SIZE(-25, -41), 1, 11, 1},
   {2, UPB_SIZE(0, 0), 0, 0, 14, 1},
-  {3, UPB_SIZE(12, 16), 0, 0, 11, 1},
-  {4, UPB_SIZE(16, 24), 0, 2, 11, 1},
+  {3, UPB_SIZE(8, 8), 0, 0, 11, 1},
+  {4, UPB_SIZE(12, 16), 0, 2, 11, 1},
+  {5, UPB_SIZE(16, 24), UPB_SIZE(-25, -41), 0, 9, 1},
 };
 
 const upb_msglayout envoy_api_v2_endpoint_LbEndpoint_msginit = {
   &envoy_api_v2_endpoint_LbEndpoint_submsgs[0],
   &envoy_api_v2_endpoint_LbEndpoint__fields[0],
-  UPB_SIZE(24, 32), 4, false,
+  UPB_SIZE(32, 48), 5, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_endpoint_LocalityLbEndpoints_submsgs[3] = {
+static const upb_msglayout *const envoy_api_v2_endpoint_LocalityLbEndpoints_submsgs[4] = {
   &envoy_api_v2_core_Locality_msginit,
   &envoy_api_v2_endpoint_LbEndpoint_msginit,
   &google_protobuf_UInt32Value_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_endpoint_LocalityLbEndpoints__fields[4] = {
+static const upb_msglayout_field envoy_api_v2_endpoint_LocalityLbEndpoints__fields[5] = {
   {1, UPB_SIZE(4, 8), 0, 0, 11, 1},
-  {2, UPB_SIZE(12, 24), 0, 1, 11, 3},
+  {2, UPB_SIZE(16, 32), 0, 1, 11, 3},
   {3, UPB_SIZE(8, 16), 0, 2, 11, 1},
   {5, UPB_SIZE(0, 0), 0, 0, 13, 1},
+  {6, UPB_SIZE(12, 24), 0, 2, 11, 1},
 };
 
 const upb_msglayout envoy_api_v2_endpoint_LocalityLbEndpoints_msginit = {
   &envoy_api_v2_endpoint_LocalityLbEndpoints_submsgs[0],
   &envoy_api_v2_endpoint_LocalityLbEndpoints__fields[0],
-  UPB_SIZE(16, 32), 4, false,
+  UPB_SIZE(20, 40), 5, false,
 };
 
 #include "upb/port_undef.inc"
index 4fd6341..2b3a916 100644 (file)
 #define ENVOY_API_V2_ENDPOINT_ENDPOINT_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -41,17 +41,16 @@ extern const upb_msglayout envoy_api_v2_core_Locality_msginit;
 extern const upb_msglayout envoy_api_v2_core_Metadata_msginit;
 extern const upb_msglayout google_protobuf_UInt32Value_msginit;
 
-/* Enums */
-
 
 /* envoy.api.v2.endpoint.Endpoint */
 
 UPB_INLINE envoy_api_v2_endpoint_Endpoint *envoy_api_v2_endpoint_Endpoint_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_Endpoint *)upb_msg_new(&envoy_api_v2_endpoint_Endpoint_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_Endpoint *envoy_api_v2_endpoint_Endpoint_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_Endpoint *envoy_api_v2_endpoint_Endpoint_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_Endpoint *ret = envoy_api_v2_endpoint_Endpoint_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_Endpoint_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_Endpoint_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_Endpoint_serialize(const envoy_api_v2_endpoint_Endpoint *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_Endpoint_msginit, arena, len);
@@ -85,15 +84,15 @@ UPB_INLINE struct envoy_api_v2_endpoint_Endpoint_HealthCheckConfig* envoy_api_v2
   return sub;
 }
 
-
 /* envoy.api.v2.endpoint.Endpoint.HealthCheckConfig */
 
 UPB_INLINE envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *)upb_msg_new(&envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *ret = envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_serialize(const envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit, arena, len);
@@ -105,27 +104,37 @@ UPB_INLINE void envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_set_port_value(
   UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.api.v2.endpoint.LbEndpoint */
 
 UPB_INLINE envoy_api_v2_endpoint_LbEndpoint *envoy_api_v2_endpoint_LbEndpoint_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_LbEndpoint *)upb_msg_new(&envoy_api_v2_endpoint_LbEndpoint_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_LbEndpoint *envoy_api_v2_endpoint_LbEndpoint_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_LbEndpoint *envoy_api_v2_endpoint_LbEndpoint_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_LbEndpoint *ret = envoy_api_v2_endpoint_LbEndpoint_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_LbEndpoint_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_LbEndpoint_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_LbEndpoint_serialize(const envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_LbEndpoint_msginit, arena, len);
 }
 
-UPB_INLINE const envoy_api_v2_endpoint_Endpoint* envoy_api_v2_endpoint_LbEndpoint_endpoint(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 8)); }
+typedef enum {
+  envoy_api_v2_endpoint_LbEndpoint_host_identifier_endpoint = 1,
+  envoy_api_v2_endpoint_LbEndpoint_host_identifier_endpoint_name = 5,
+  envoy_api_v2_endpoint_LbEndpoint_host_identifier_NOT_SET = 0
+} envoy_api_v2_endpoint_LbEndpoint_host_identifier_oneofcases;
+UPB_INLINE envoy_api_v2_endpoint_LbEndpoint_host_identifier_oneofcases envoy_api_v2_endpoint_LbEndpoint_host_identifier_case(const envoy_api_v2_endpoint_LbEndpoint* msg) { return (envoy_api_v2_endpoint_LbEndpoint_host_identifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 40)); }
+
+UPB_INLINE bool envoy_api_v2_endpoint_LbEndpoint_has_endpoint(const envoy_api_v2_endpoint_LbEndpoint *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(24, 40), 1); }
+UPB_INLINE const envoy_api_v2_endpoint_Endpoint* envoy_api_v2_endpoint_LbEndpoint_endpoint(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(16, 24), UPB_SIZE(24, 40), 1, NULL); }
 UPB_INLINE int32_t envoy_api_v2_endpoint_LbEndpoint_health_status(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
-UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_metadata(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(12, 16)); }
-UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_load_balancing_weight(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)); }
+UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_metadata(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(8, 8)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_load_balancing_weight(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)); }
+UPB_INLINE bool envoy_api_v2_endpoint_LbEndpoint_has_endpoint_name(const envoy_api_v2_endpoint_LbEndpoint *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(24, 40), 5); }
+UPB_INLINE upb_strview envoy_api_v2_endpoint_LbEndpoint_endpoint_name(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(16, 24), UPB_SIZE(24, 40), 5, upb_strview_make("", strlen(""))); }
 
 UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_endpoint(envoy_api_v2_endpoint_LbEndpoint *msg, envoy_api_v2_endpoint_Endpoint* value) {
-  UPB_FIELD_AT(msg, envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 8)) = value;
+  UPB_WRITE_ONEOF(msg, envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(16, 24), value, UPB_SIZE(24, 40), 1);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_Endpoint* envoy_api_v2_endpoint_LbEndpoint_mutable_endpoint(envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_Endpoint* sub = (struct envoy_api_v2_endpoint_Endpoint*)envoy_api_v2_endpoint_LbEndpoint_endpoint(msg);
@@ -140,7 +149,7 @@ UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_health_status(envoy_api_v2_
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_metadata(envoy_api_v2_endpoint_LbEndpoint *msg, struct envoy_api_v2_core_Metadata* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(12, 16)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(8, 8)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_mutable_metadata(envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Metadata* sub = (struct envoy_api_v2_core_Metadata*)envoy_api_v2_endpoint_LbEndpoint_metadata(msg);
@@ -152,7 +161,7 @@ UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_m
   return sub;
 }
 UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_load_balancing_weight(envoy_api_v2_endpoint_LbEndpoint *msg, struct google_protobuf_UInt32Value* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)) = value;
 }
 UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_mutable_load_balancing_weight(envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena) {
   struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_endpoint_LbEndpoint_load_balancing_weight(msg);
@@ -163,25 +172,29 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_
   }
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_endpoint_name(envoy_api_v2_endpoint_LbEndpoint *msg, upb_strview value) {
+  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(16, 24), value, UPB_SIZE(24, 40), 5);
+}
 
 /* envoy.api.v2.endpoint.LocalityLbEndpoints */
 
 UPB_INLINE envoy_api_v2_endpoint_LocalityLbEndpoints *envoy_api_v2_endpoint_LocalityLbEndpoints_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_LocalityLbEndpoints *)upb_msg_new(&envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_LocalityLbEndpoints *envoy_api_v2_endpoint_LocalityLbEndpoints_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_LocalityLbEndpoints *envoy_api_v2_endpoint_LocalityLbEndpoints_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_LocalityLbEndpoints *ret = envoy_api_v2_endpoint_LocalityLbEndpoints_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_LocalityLbEndpoints_serialize(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, arena, len);
 }
 
 UPB_INLINE const struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_LocalityLbEndpoints_locality(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Locality*, UPB_SIZE(4, 8)); }
-UPB_INLINE const envoy_api_v2_endpoint_LbEndpoint* const* envoy_api_v2_endpoint_LocalityLbEndpoints_lb_endpoints(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t *len) { return (const envoy_api_v2_endpoint_LbEndpoint* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); }
+UPB_INLINE const envoy_api_v2_endpoint_LbEndpoint* const* envoy_api_v2_endpoint_LocalityLbEndpoints_lb_endpoints(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t *len) { return (const envoy_api_v2_endpoint_LbEndpoint* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
 UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(8, 16)); }
 UPB_INLINE uint32_t envoy_api_v2_endpoint_LocalityLbEndpoints_priority(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbEndpoints_proximity(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)); }
 
 UPB_INLINE void envoy_api_v2_endpoint_LocalityLbEndpoints_set_locality(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, struct envoy_api_v2_core_Locality* value) {
   UPB_FIELD_AT(msg, struct envoy_api_v2_core_Locality*, UPB_SIZE(4, 8)) = value;
@@ -196,15 +209,15 @@ UPB_INLINE struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_LocalityLbEn
   return sub;
 }
 UPB_INLINE envoy_api_v2_endpoint_LbEndpoint** envoy_api_v2_endpoint_LocalityLbEndpoints_mutable_lb_endpoints(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t *len) {
-  return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 24), len);
+  return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
 }
 UPB_INLINE envoy_api_v2_endpoint_LbEndpoint** envoy_api_v2_endpoint_LocalityLbEndpoints_resize_lb_endpoints(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_resize_accessor(msg, UPB_SIZE(12, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_LbEndpoint* envoy_api_v2_endpoint_LocalityLbEndpoints_add_lb_endpoints(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_LbEndpoint* sub = (struct envoy_api_v2_endpoint_LbEndpoint*)upb_msg_new(&envoy_api_v2_endpoint_LbEndpoint_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(12, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
@@ -223,7 +236,18 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbE
 UPB_INLINE void envoy_api_v2_endpoint_LocalityLbEndpoints_set_priority(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, uint32_t value) {
   UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
 }
-
+UPB_INLINE void envoy_api_v2_endpoint_LocalityLbEndpoints_set_proximity(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, struct google_protobuf_UInt32Value* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbEndpoints_mutable_proximity(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, upb_arena *arena) {
+  struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_endpoint_LocalityLbEndpoints_proximity(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_endpoint_LocalityLbEndpoints_set_proximity(msg, sub);
+  }
+  return sub;
+}
 
 #ifdef __cplusplus
 }  /* extern "C" */
index 2af77c5..ad7c93f 100644 (file)
@@ -12,6 +12,7 @@
 #include "envoy/api/v2/core/address.upb.h"
 #include "envoy/api/v2/core/base.upb.h"
 #include "google/protobuf/duration.upb.h"
+#include "google/protobuf/struct.upb.h"
 #include "validate/validate.upb.h"
 #include "gogoproto/gogo.upb.h"
 
@@ -23,39 +24,43 @@ static const upb_msglayout *const envoy_api_v2_endpoint_UpstreamLocalityStats_su
   &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamLocalityStats__fields[7] = {
-  {1, UPB_SIZE(28, 32), 0, 0, 11, 1},
+static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamLocalityStats__fields[8] = {
+  {1, UPB_SIZE(36, 40), 0, 0, 11, 1},
   {2, UPB_SIZE(0, 0), 0, 0, 4, 1},
   {3, UPB_SIZE(8, 8), 0, 0, 4, 1},
   {4, UPB_SIZE(16, 16), 0, 0, 4, 1},
-  {5, UPB_SIZE(32, 40), 0, 1, 11, 3},
-  {6, UPB_SIZE(24, 24), 0, 0, 13, 1},
-  {7, UPB_SIZE(36, 48), 0, 2, 11, 3},
+  {5, UPB_SIZE(40, 48), 0, 1, 11, 3},
+  {6, UPB_SIZE(32, 32), 0, 0, 13, 1},
+  {7, UPB_SIZE(44, 56), 0, 2, 11, 3},
+  {8, UPB_SIZE(24, 24), 0, 0, 4, 1},
 };
 
 const upb_msglayout envoy_api_v2_endpoint_UpstreamLocalityStats_msginit = {
   &envoy_api_v2_endpoint_UpstreamLocalityStats_submsgs[0],
   &envoy_api_v2_endpoint_UpstreamLocalityStats__fields[0],
-  UPB_SIZE(40, 56), 7, false,
+  UPB_SIZE(48, 64), 8, false,
 };
 
-static const upb_msglayout *const envoy_api_v2_endpoint_UpstreamEndpointStats_submsgs[2] = {
+static const upb_msglayout *const envoy_api_v2_endpoint_UpstreamEndpointStats_submsgs[3] = {
   &envoy_api_v2_core_Address_msginit,
   &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit,
+  &google_protobuf_Struct_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamEndpointStats__fields[5] = {
-  {1, UPB_SIZE(24, 24), 0, 0, 11, 1},
+static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamEndpointStats__fields[7] = {
+  {1, UPB_SIZE(32, 32), 0, 0, 11, 1},
   {2, UPB_SIZE(0, 0), 0, 0, 4, 1},
   {3, UPB_SIZE(8, 8), 0, 0, 4, 1},
   {4, UPB_SIZE(16, 16), 0, 0, 4, 1},
-  {5, UPB_SIZE(28, 32), 0, 1, 11, 3},
+  {5, UPB_SIZE(40, 48), 0, 1, 11, 3},
+  {6, UPB_SIZE(36, 40), 0, 2, 11, 1},
+  {7, UPB_SIZE(24, 24), 0, 0, 4, 1},
 };
 
 const upb_msglayout envoy_api_v2_endpoint_UpstreamEndpointStats_msginit = {
   &envoy_api_v2_endpoint_UpstreamEndpointStats_submsgs[0],
   &envoy_api_v2_endpoint_UpstreamEndpointStats__fields[0],
-  UPB_SIZE(32, 40), 5, false,
+  UPB_SIZE(48, 56), 7, false,
 };
 
 static const upb_msglayout_field envoy_api_v2_endpoint_EndpointLoadMetricStats__fields[3] = {
@@ -76,18 +81,19 @@ static const upb_msglayout *const envoy_api_v2_endpoint_ClusterStats_submsgs[3]
   &google_protobuf_Duration_msginit,
 };
 
-static const upb_msglayout_field envoy_api_v2_endpoint_ClusterStats__fields[5] = {
+static const upb_msglayout_field envoy_api_v2_endpoint_ClusterStats__fields[6] = {
   {1, UPB_SIZE(8, 8), 0, 0, 9, 1},
-  {2, UPB_SIZE(20, 32), 0, 1, 11, 3},
+  {2, UPB_SIZE(28, 48), 0, 1, 11, 3},
   {3, UPB_SIZE(0, 0), 0, 0, 4, 1},
-  {4, UPB_SIZE(16, 24), 0, 2, 11, 1},
-  {5, UPB_SIZE(24, 40), 0, 0, 11, 3},
+  {4, UPB_SIZE(24, 40), 0, 2, 11, 1},
+  {5, UPB_SIZE(32, 56), 0, 0, 11, 3},
+  {6, UPB_SIZE(16, 24), 0, 0, 9, 1},
 };
 
 const upb_msglayout envoy_api_v2_endpoint_ClusterStats_msginit = {
   &envoy_api_v2_endpoint_ClusterStats_submsgs[0],
   &envoy_api_v2_endpoint_ClusterStats__fields[0],
-  UPB_SIZE(32, 48), 5, false,
+  UPB_SIZE(40, 64), 6, false,
 };
 
 static const upb_msglayout_field envoy_api_v2_endpoint_ClusterStats_DroppedRequests__fields[2] = {
index 7ee2129..d37045d 100644 (file)
 #define ENVOY_API_V2_ENDPOINT_LOAD_REPORT_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -38,11 +38,11 @@ extern const upb_msglayout envoy_api_v2_endpoint_ClusterStats_DroppedRequests_ms
 struct envoy_api_v2_core_Address;
 struct envoy_api_v2_core_Locality;
 struct google_protobuf_Duration;
+struct google_protobuf_Struct;
 extern const upb_msglayout envoy_api_v2_core_Address_msginit;
 extern const upb_msglayout envoy_api_v2_core_Locality_msginit;
 extern const upb_msglayout google_protobuf_Duration_msginit;
-
-/* Enums */
+extern const upb_msglayout google_protobuf_Struct_msginit;
 
 
 /* envoy.api.v2.endpoint.UpstreamLocalityStats */
@@ -50,24 +50,26 @@ extern const upb_msglayout google_protobuf_Duration_msginit;
 UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats *envoy_api_v2_endpoint_UpstreamLocalityStats_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_UpstreamLocalityStats *)upb_msg_new(&envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats *envoy_api_v2_endpoint_UpstreamLocalityStats_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats *envoy_api_v2_endpoint_UpstreamLocalityStats_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_UpstreamLocalityStats *ret = envoy_api_v2_endpoint_UpstreamLocalityStats_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_UpstreamLocalityStats_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_UpstreamLocalityStats_serialize(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena, len);
 }
 
-UPB_INLINE const struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_UpstreamLocalityStats_locality(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Locality*, UPB_SIZE(28, 32)); }
+UPB_INLINE const struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_UpstreamLocalityStats_locality(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Locality*, UPB_SIZE(36, 40)); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_successful_requests(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_requests_in_progress(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_error_requests(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)); }
-UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(32, 40), len); }
-UPB_INLINE uint32_t envoy_api_v2_endpoint_UpstreamLocalityStats_priority(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(24, 24)); }
-UPB_INLINE const envoy_api_v2_endpoint_UpstreamEndpointStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_upstream_endpoint_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamEndpointStats* const*)_upb_array_accessor(msg, UPB_SIZE(36, 48), len); }
+UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(40, 48), len); }
+UPB_INLINE uint32_t envoy_api_v2_endpoint_UpstreamLocalityStats_priority(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(32, 32)); }
+UPB_INLINE const envoy_api_v2_endpoint_UpstreamEndpointStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_upstream_endpoint_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamEndpointStats* const*)_upb_array_accessor(msg, UPB_SIZE(44, 56), len); }
+UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_issued_requests(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)); }
 
 UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_locality(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, struct envoy_api_v2_core_Locality* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Locality*, UPB_SIZE(28, 32)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Locality*, UPB_SIZE(36, 40)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_locality(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Locality* sub = (struct envoy_api_v2_core_Locality*)envoy_api_v2_endpoint_UpstreamLocalityStats_locality(msg);
@@ -88,57 +90,62 @@ UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_error_requ
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)) = value;
 }
 UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_load_metric_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) {
-  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 40), len);
+  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 48), len);
 }
 UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamLocalityStats_resize_load_metric_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_EndpointLoadMetricStats* envoy_api_v2_endpoint_UpstreamLocalityStats_add_load_metric_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_EndpointLoadMetricStats* sub = (struct envoy_api_v2_endpoint_EndpointLoadMetricStats*)upb_msg_new(&envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(32, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(40, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
 UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_priority(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, uint32_t value) {
-  UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(24, 24)) = value;
+  UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(32, 32)) = value;
 }
 UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats** envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_upstream_endpoint_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) {
-  return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 48), len);
+  return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 56), len);
 }
 UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats** envoy_api_v2_endpoint_UpstreamLocalityStats_resize_upstream_endpoint_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_UpstreamEndpointStats* envoy_api_v2_endpoint_UpstreamLocalityStats_add_upstream_endpoint_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_UpstreamEndpointStats* sub = (struct envoy_api_v2_endpoint_UpstreamEndpointStats*)upb_msg_new(&envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(36, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(44, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_issued_requests(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, uint64_t value) {
+  UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)) = value;
+}
 
 /* envoy.api.v2.endpoint.UpstreamEndpointStats */
 
 UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats *envoy_api_v2_endpoint_UpstreamEndpointStats_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_UpstreamEndpointStats *)upb_msg_new(&envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats *envoy_api_v2_endpoint_UpstreamEndpointStats_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats *envoy_api_v2_endpoint_UpstreamEndpointStats_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_UpstreamEndpointStats *ret = envoy_api_v2_endpoint_UpstreamEndpointStats_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_UpstreamEndpointStats_serialize(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena, len);
 }
 
-UPB_INLINE const struct envoy_api_v2_core_Address* envoy_api_v2_endpoint_UpstreamEndpointStats_address(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Address*, UPB_SIZE(24, 24)); }
+UPB_INLINE const struct envoy_api_v2_core_Address* envoy_api_v2_endpoint_UpstreamEndpointStats_address(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Address*, UPB_SIZE(32, 32)); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_successful_requests(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_requests_in_progress(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_error_requests(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)); }
-UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamEndpointStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); }
+UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamEndpointStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(40, 48), len); }
+UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_endpoint_UpstreamEndpointStats_metadata(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Struct*, UPB_SIZE(36, 40)); }
+UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_issued_requests(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)); }
 
 UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_address(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, struct envoy_api_v2_core_Address* value) {
-  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Address*, UPB_SIZE(24, 24)) = value;
+  UPB_FIELD_AT(msg, struct envoy_api_v2_core_Address*, UPB_SIZE(32, 32)) = value;
 }
 UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_endpoint_UpstreamEndpointStats_mutable_address(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena) {
   struct envoy_api_v2_core_Address* sub = (struct envoy_api_v2_core_Address*)envoy_api_v2_endpoint_UpstreamEndpointStats_address(msg);
@@ -159,28 +166,43 @@ UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_total_error_requ
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)) = value;
 }
 UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamEndpointStats_mutable_load_metric_stats(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t *len) {
-  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len);
+  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 48), len);
 }
 UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamEndpointStats_resize_load_metric_stats(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_EndpointLoadMetricStats* envoy_api_v2_endpoint_UpstreamEndpointStats_add_load_metric_stats(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_EndpointLoadMetricStats* sub = (struct envoy_api_v2_endpoint_EndpointLoadMetricStats*)upb_msg_new(&envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(40, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_metadata(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, struct google_protobuf_Struct* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Struct*, UPB_SIZE(36, 40)) = value;
+}
+UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_endpoint_UpstreamEndpointStats_mutable_metadata(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena) {
+  struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_endpoint_UpstreamEndpointStats_metadata(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena);
+    if (!sub) return NULL;
+    envoy_api_v2_endpoint_UpstreamEndpointStats_set_metadata(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_total_issued_requests(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, uint64_t value) {
+  UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)) = value;
+}
 
 /* envoy.api.v2.endpoint.EndpointLoadMetricStats */
 
 UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats *envoy_api_v2_endpoint_EndpointLoadMetricStats_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_EndpointLoadMetricStats *)upb_msg_new(&envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats *envoy_api_v2_endpoint_EndpointLoadMetricStats_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats *envoy_api_v2_endpoint_EndpointLoadMetricStats_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_EndpointLoadMetricStats *ret = envoy_api_v2_endpoint_EndpointLoadMetricStats_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_EndpointLoadMetricStats_serialize(const envoy_api_v2_endpoint_EndpointLoadMetricStats *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena, len);
@@ -200,39 +222,40 @@ UPB_INLINE void envoy_api_v2_endpoint_EndpointLoadMetricStats_set_total_metric_v
   UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value;
 }
 
-
 /* envoy.api.v2.endpoint.ClusterStats */
 
 UPB_INLINE envoy_api_v2_endpoint_ClusterStats *envoy_api_v2_endpoint_ClusterStats_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_ClusterStats *)upb_msg_new(&envoy_api_v2_endpoint_ClusterStats_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_ClusterStats *envoy_api_v2_endpoint_ClusterStats_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_ClusterStats *envoy_api_v2_endpoint_ClusterStats_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_ClusterStats *ret = envoy_api_v2_endpoint_ClusterStats_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_ClusterStats_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_ClusterStats_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_ClusterStats_serialize(const envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_ClusterStats_msginit, arena, len);
 }
 
 UPB_INLINE upb_strview envoy_api_v2_endpoint_ClusterStats_cluster_name(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
-UPB_INLINE const envoy_api_v2_endpoint_UpstreamLocalityStats* const* envoy_api_v2_endpoint_ClusterStats_upstream_locality_stats(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamLocalityStats* const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); }
+UPB_INLINE const envoy_api_v2_endpoint_UpstreamLocalityStats* const* envoy_api_v2_endpoint_ClusterStats_upstream_locality_stats(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamLocalityStats* const*)_upb_array_accessor(msg, UPB_SIZE(28, 48), len); }
 UPB_INLINE uint64_t envoy_api_v2_endpoint_ClusterStats_total_dropped_requests(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)); }
-UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_load_report_interval(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 24)); }
-UPB_INLINE const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const* envoy_api_v2_endpoint_ClusterStats_dropped_requests(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const*)_upb_array_accessor(msg, UPB_SIZE(24, 40), len); }
+UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_load_report_interval(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(24, 40)); }
+UPB_INLINE const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const* envoy_api_v2_endpoint_ClusterStats_dropped_requests(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const*)_upb_array_accessor(msg, UPB_SIZE(32, 56), len); }
+UPB_INLINE upb_strview envoy_api_v2_endpoint_ClusterStats_cluster_service_name(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)); }
 
 UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_cluster_name(envoy_api_v2_endpoint_ClusterStats *msg, upb_strview value) {
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
 }
 UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats** envoy_api_v2_endpoint_ClusterStats_mutable_upstream_locality_stats(envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) {
-  return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len);
+  return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 48), len);
 }
 UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats** envoy_api_v2_endpoint_ClusterStats_resize_upstream_locality_stats(envoy_api_v2_endpoint_ClusterStats *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_UpstreamLocalityStats* envoy_api_v2_endpoint_ClusterStats_add_upstream_locality_stats(envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_UpstreamLocalityStats* sub = (struct envoy_api_v2_endpoint_UpstreamLocalityStats*)upb_msg_new(&envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(20, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(28, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
@@ -240,7 +263,7 @@ UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_total_dropped_requests(en
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value;
 }
 UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_load_report_interval(envoy_api_v2_endpoint_ClusterStats *msg, struct google_protobuf_Duration* value) {
-  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 24)) = value;
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(24, 40)) = value;
 }
 UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_mutable_load_report_interval(envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena) {
   struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_endpoint_ClusterStats_load_report_interval(msg);
@@ -252,28 +275,31 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_m
   return sub;
 }
 UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests** envoy_api_v2_endpoint_ClusterStats_mutable_dropped_requests(envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) {
-  return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 40), len);
+  return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 56), len);
 }
 UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests** envoy_api_v2_endpoint_ClusterStats_resize_dropped_requests(envoy_api_v2_endpoint_ClusterStats *msg, size_t len, upb_arena *arena) {
-  return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+  return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
 }
 UPB_INLINE struct envoy_api_v2_endpoint_ClusterStats_DroppedRequests* envoy_api_v2_endpoint_ClusterStats_add_dropped_requests(envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena) {
   struct envoy_api_v2_endpoint_ClusterStats_DroppedRequests* sub = (struct envoy_api_v2_endpoint_ClusterStats_DroppedRequests*)upb_msg_new(&envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena);
   bool ok = _upb_array_append_accessor(
-      msg, UPB_SIZE(24, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+      msg, UPB_SIZE(32, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
   if (!ok) return NULL;
   return sub;
 }
-
+UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_cluster_service_name(envoy_api_v2_endpoint_ClusterStats *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)) = value;
+}
 
 /* envoy.api.v2.endpoint.ClusterStats.DroppedRequests */
 
 UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_new(upb_arena *arena) {
   return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests *)upb_msg_new(&envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena);
 }
-UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_api_v2_endpoint_ClusterStats_DroppedRequests *ret = envoy_api_v2_endpoint_ClusterStats_DroppedRequests_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_serialize(const envoy_api_v2_endpoint_ClusterStats_DroppedRequests *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena, len);
@@ -289,7 +315,6 @@ UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_DroppedRequests_set_dropped_c
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index d5f1b90..05fc730 100644 (file)
 #define ENVOY_SERVICE_DISCOVERY_V2_ADS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,17 +24,16 @@ struct envoy_service_discovery_v2_AdsDummy;
 typedef struct envoy_service_discovery_v2_AdsDummy envoy_service_discovery_v2_AdsDummy;
 extern const upb_msglayout envoy_service_discovery_v2_AdsDummy_msginit;
 
-/* Enums */
-
 
 /* envoy.service.discovery.v2.AdsDummy */
 
 UPB_INLINE envoy_service_discovery_v2_AdsDummy *envoy_service_discovery_v2_AdsDummy_new(upb_arena *arena) {
   return (envoy_service_discovery_v2_AdsDummy *)upb_msg_new(&envoy_service_discovery_v2_AdsDummy_msginit, arena);
 }
-UPB_INLINE envoy_service_discovery_v2_AdsDummy *envoy_service_discovery_v2_AdsDummy_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_service_discovery_v2_AdsDummy *envoy_service_discovery_v2_AdsDummy_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_service_discovery_v2_AdsDummy *ret = envoy_service_discovery_v2_AdsDummy_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_service_discovery_v2_AdsDummy_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_service_discovery_v2_AdsDummy_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_service_discovery_v2_AdsDummy_serialize(const envoy_service_discovery_v2_AdsDummy *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_service_discovery_v2_AdsDummy_msginit, arena, len);
@@ -42,7 +41,6 @@ UPB_INLINE char *envoy_service_discovery_v2_AdsDummy_serialize(const envoy_servi
 
 
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 99db767..457deaf 100644 (file)
 #define ENVOY_SERVICE_LOAD_STATS_V2_LRS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -33,17 +33,16 @@ extern const upb_msglayout envoy_api_v2_core_Node_msginit;
 extern const upb_msglayout envoy_api_v2_endpoint_ClusterStats_msginit;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 
-/* Enums */
-
 
 /* envoy.service.load_stats.v2.LoadStatsRequest */
 
 UPB_INLINE envoy_service_load_stats_v2_LoadStatsRequest *envoy_service_load_stats_v2_LoadStatsRequest_new(upb_arena *arena) {
   return (envoy_service_load_stats_v2_LoadStatsRequest *)upb_msg_new(&envoy_service_load_stats_v2_LoadStatsRequest_msginit, arena);
 }
-UPB_INLINE envoy_service_load_stats_v2_LoadStatsRequest *envoy_service_load_stats_v2_LoadStatsRequest_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_service_load_stats_v2_LoadStatsRequest *envoy_service_load_stats_v2_LoadStatsRequest_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_service_load_stats_v2_LoadStatsRequest *ret = envoy_service_load_stats_v2_LoadStatsRequest_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_service_load_stats_v2_LoadStatsRequest_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_service_load_stats_v2_LoadStatsRequest_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_service_load_stats_v2_LoadStatsRequest_serialize(const envoy_service_load_stats_v2_LoadStatsRequest *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_service_load_stats_v2_LoadStatsRequest_msginit, arena, len);
@@ -78,15 +77,15 @@ UPB_INLINE struct envoy_api_v2_endpoint_ClusterStats* envoy_service_load_stats_v
   return sub;
 }
 
-
 /* envoy.service.load_stats.v2.LoadStatsResponse */
 
 UPB_INLINE envoy_service_load_stats_v2_LoadStatsResponse *envoy_service_load_stats_v2_LoadStatsResponse_new(upb_arena *arena) {
   return (envoy_service_load_stats_v2_LoadStatsResponse *)upb_msg_new(&envoy_service_load_stats_v2_LoadStatsResponse_msginit, arena);
 }
-UPB_INLINE envoy_service_load_stats_v2_LoadStatsResponse *envoy_service_load_stats_v2_LoadStatsResponse_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_service_load_stats_v2_LoadStatsResponse *envoy_service_load_stats_v2_LoadStatsResponse_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_service_load_stats_v2_LoadStatsResponse *ret = envoy_service_load_stats_v2_LoadStatsResponse_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_service_load_stats_v2_LoadStatsResponse_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_service_load_stats_v2_LoadStatsResponse_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_service_load_stats_v2_LoadStatsResponse_serialize(const envoy_service_load_stats_v2_LoadStatsResponse *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_service_load_stats_v2_LoadStatsResponse_msginit, arena, len);
@@ -122,7 +121,6 @@ UPB_INLINE void envoy_service_load_stats_v2_LoadStatsResponse_set_report_endpoin
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 13df96a..e9aa889 100644 (file)
 #define ENVOY_TYPE_PERCENT_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -27,8 +27,6 @@ typedef struct envoy_type_FractionalPercent envoy_type_FractionalPercent;
 extern const upb_msglayout envoy_type_Percent_msginit;
 extern const upb_msglayout envoy_type_FractionalPercent_msginit;
 
-/* Enums */
-
 typedef enum {
   envoy_type_FractionalPercent_HUNDRED = 0,
   envoy_type_FractionalPercent_TEN_THOUSAND = 1,
@@ -41,9 +39,10 @@ typedef enum {
 UPB_INLINE envoy_type_Percent *envoy_type_Percent_new(upb_arena *arena) {
   return (envoy_type_Percent *)upb_msg_new(&envoy_type_Percent_msginit, arena);
 }
-UPB_INLINE envoy_type_Percent *envoy_type_Percent_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_type_Percent *envoy_type_Percent_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_type_Percent *ret = envoy_type_Percent_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_type_Percent_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_type_Percent_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_type_Percent_serialize(const envoy_type_Percent *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_type_Percent_msginit, arena, len);
@@ -55,15 +54,15 @@ UPB_INLINE void envoy_type_Percent_set_value(envoy_type_Percent *msg, double val
   UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* envoy.type.FractionalPercent */
 
 UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_new(upb_arena *arena) {
   return (envoy_type_FractionalPercent *)upb_msg_new(&envoy_type_FractionalPercent_msginit, arena);
 }
-UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_type_FractionalPercent *ret = envoy_type_FractionalPercent_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_type_FractionalPercent_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_type_FractionalPercent_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_type_FractionalPercent_serialize(const envoy_type_FractionalPercent *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_type_FractionalPercent_msginit, arena, len);
@@ -79,7 +78,6 @@ UPB_INLINE void envoy_type_FractionalPercent_set_denominator(envoy_type_Fraction
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index de1846a..3e60774 100644 (file)
 #define ENVOY_TYPE_RANGE_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -27,17 +27,16 @@ typedef struct envoy_type_DoubleRange envoy_type_DoubleRange;
 extern const upb_msglayout envoy_type_Int64Range_msginit;
 extern const upb_msglayout envoy_type_DoubleRange_msginit;
 
-/* Enums */
-
 
 /* envoy.type.Int64Range */
 
 UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_new(upb_arena *arena) {
   return (envoy_type_Int64Range *)upb_msg_new(&envoy_type_Int64Range_msginit, arena);
 }
-UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_type_Int64Range *ret = envoy_type_Int64Range_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_type_Int64Range_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_type_Int64Range_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_type_Int64Range_serialize(const envoy_type_Int64Range *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_type_Int64Range_msginit, arena, len);
@@ -53,15 +52,15 @@ UPB_INLINE void envoy_type_Int64Range_set_end(envoy_type_Int64Range *msg, int64_
   UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)) = value;
 }
 
-
 /* envoy.type.DoubleRange */
 
 UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_new(upb_arena *arena) {
   return (envoy_type_DoubleRange *)upb_msg_new(&envoy_type_DoubleRange_msginit, arena);
 }
-UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   envoy_type_DoubleRange *ret = envoy_type_DoubleRange_new(arena);
-  return (ret && upb_decode(buf, ret, &envoy_type_DoubleRange_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &envoy_type_DoubleRange_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *envoy_type_DoubleRange_serialize(const envoy_type_DoubleRange *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &envoy_type_DoubleRange_msginit, arena, len);
@@ -77,7 +76,6 @@ UPB_INLINE void envoy_type_DoubleRange_set_end(envoy_type_DoubleRange *msg, doub
   UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 6b3dda6..530adbf 100644 (file)
 #define GOGOPROTO_GOGO_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 
-/* Enums */
-
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 5a49fff..d81cd3d 100644 (file)
 #define GOOGLE_API_ANNOTATIONS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 
-/* Enums */
-
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index d8bda89..5e8bffe 100644 (file)
 #define GOOGLE_API_HTTP_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -30,17 +30,16 @@ extern const upb_msglayout google_api_Http_msginit;
 extern const upb_msglayout google_api_HttpRule_msginit;
 extern const upb_msglayout google_api_CustomHttpPattern_msginit;
 
-/* Enums */
-
 
 /* google.api.Http */
 
 UPB_INLINE google_api_Http *google_api_Http_new(upb_arena *arena) {
   return (google_api_Http *)upb_msg_new(&google_api_Http_msginit, arena);
 }
-UPB_INLINE google_api_Http *google_api_Http_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_api_Http *google_api_Http_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_api_Http *ret = google_api_Http_new(arena);
-  return (ret && upb_decode(buf, ret, &google_api_Http_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_api_Http_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_api_Http_serialize(const google_api_Http *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_api_Http_msginit, arena, len);
@@ -66,15 +65,15 @@ UPB_INLINE void google_api_Http_set_fully_decode_reserved_expansion(google_api_H
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.api.HttpRule */
 
 UPB_INLINE google_api_HttpRule *google_api_HttpRule_new(upb_arena *arena) {
   return (google_api_HttpRule *)upb_msg_new(&google_api_HttpRule_msginit, arena);
 }
-UPB_INLINE google_api_HttpRule *google_api_HttpRule_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_api_HttpRule *google_api_HttpRule_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_api_HttpRule *ret = google_api_HttpRule_new(arena);
-  return (ret && upb_decode(buf, ret, &google_api_HttpRule_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_api_HttpRule_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_api_HttpRule_serialize(const google_api_HttpRule *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_api_HttpRule_msginit, arena, len);
@@ -87,9 +86,9 @@ typedef enum {
   google_api_HttpRule_pattern_delete = 5,
   google_api_HttpRule_pattern_patch = 6,
   google_api_HttpRule_pattern_custom = 8,
-  google_api_HttpRule_pattern_NOT_SET = 0,
+  google_api_HttpRule_pattern_NOT_SET = 0
 } google_api_HttpRule_pattern_oneofcases;
-UPB_INLINE google_api_HttpRule_pattern_oneofcases google_api_HttpRule_pattern_case(const google_api_HttpRule* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(36, 72)); }
+UPB_INLINE google_api_HttpRule_pattern_oneofcases google_api_HttpRule_pattern_case(const google_api_HttpRule* msg) { return (google_api_HttpRule_pattern_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(36, 72)); }
 
 UPB_INLINE upb_strview google_api_HttpRule_selector(const google_api_HttpRule *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
 UPB_INLINE bool google_api_HttpRule_has_get(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 2); }
@@ -158,15 +157,15 @@ UPB_INLINE void google_api_HttpRule_set_response_body(google_api_HttpRule *msg,
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value;
 }
 
-
 /* google.api.CustomHttpPattern */
 
 UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_new(upb_arena *arena) {
   return (google_api_CustomHttpPattern *)upb_msg_new(&google_api_CustomHttpPattern_msginit, arena);
 }
-UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_api_CustomHttpPattern *ret = google_api_CustomHttpPattern_new(arena);
-  return (ret && upb_decode(buf, ret, &google_api_CustomHttpPattern_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_api_CustomHttpPattern_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_api_CustomHttpPattern_serialize(const google_api_CustomHttpPattern *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_api_CustomHttpPattern_msginit, arena, len);
@@ -182,7 +181,6 @@ UPB_INLINE void google_api_CustomHttpPattern_set_path(google_api_CustomHttpPatte
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 877e5bd..a591ba8 100644 (file)
 #define GOOGLE_PROTOBUF_ANY_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,17 +24,16 @@ struct google_protobuf_Any;
 typedef struct google_protobuf_Any google_protobuf_Any;
 extern const upb_msglayout google_protobuf_Any_msginit;
 
-/* Enums */
-
 
 /* google.protobuf.Any */
 
 UPB_INLINE google_protobuf_Any *google_protobuf_Any_new(upb_arena *arena) {
   return (google_protobuf_Any *)upb_msg_new(&google_protobuf_Any_msginit, arena);
 }
-UPB_INLINE google_protobuf_Any *google_protobuf_Any_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Any *google_protobuf_Any_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Any *ret = google_protobuf_Any_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Any_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Any_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Any_serialize(const google_protobuf_Any *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Any_msginit, arena, len);
@@ -50,7 +49,6 @@ UPB_INLINE void google_protobuf_Any_set_value(google_protobuf_Any *msg, upb_strv
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 11868b2..6816149 100644 (file)
 #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -102,8 +102,6 @@ extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit;
 extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit;
 extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit;
 
-/* Enums */
-
 typedef enum {
   google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
   google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
@@ -161,9 +159,10 @@ typedef enum {
 UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) {
   return (google_protobuf_FileDescriptorSet *)upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena);
 }
-UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_FileDescriptorSet_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len);
@@ -185,15 +184,15 @@ UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescr
   return sub;
 }
 
-
 /* google.protobuf.FileDescriptorProto */
 
 UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_FileDescriptorProto *)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_FileDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len);
@@ -338,15 +337,15 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_F
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
 }
 
-
 /* google.protobuf.DescriptorProto */
 
 UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_DescriptorProto *)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len);
@@ -484,15 +483,15 @@ UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobu
       msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 
-
 /* google.protobuf.DescriptorProto.ExtensionRange */
 
 UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) {
   return (google_protobuf_DescriptorProto_ExtensionRange *)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
 }
-UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len);
@@ -527,15 +526,15 @@ UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_Descrip
   return sub;
 }
 
-
 /* google.protobuf.DescriptorProto.ReservedRange */
 
 UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) {
   return (google_protobuf_DescriptorProto_ReservedRange *)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
 }
-UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len);
@@ -555,15 +554,15 @@ UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_pro
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
 }
 
-
 /* google.protobuf.ExtensionRangeOptions */
 
 UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) {
   return (google_protobuf_ExtensionRangeOptions *)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_ExtensionRangeOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len);
@@ -585,15 +584,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_Extension
   return sub;
 }
 
-
 /* google.protobuf.FieldDescriptorProto */
 
 UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_FieldDescriptorProto *)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_FieldDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len);
@@ -670,15 +669,15 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protob
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)) = value;
 }
 
-
 /* google.protobuf.OneofDescriptorProto */
 
 UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_OneofDescriptorProto *)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_OneofDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len);
@@ -707,15 +706,15 @@ UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorP
   return sub;
 }
 
-
 /* google.protobuf.EnumDescriptorProto */
 
 UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_EnumDescriptorProto *)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_EnumDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len);
@@ -783,15 +782,15 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_pro
       msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 
-
 /* google.protobuf.EnumDescriptorProto.EnumReservedRange */
 
 UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) {
   return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
 }
-UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len);
@@ -811,15 +810,15 @@ UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(go
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
 }
 
-
 /* google.protobuf.EnumValueDescriptorProto */
 
 UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_EnumValueDescriptorProto *)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_EnumValueDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len);
@@ -854,15 +853,15 @@ UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDes
   return sub;
 }
 
-
 /* google.protobuf.ServiceDescriptorProto */
 
 UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_ServiceDescriptorProto *)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_ServiceDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len);
@@ -905,15 +904,15 @@ UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescrip
   return sub;
 }
 
-
 /* google.protobuf.MethodDescriptorProto */
 
 UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) {
   return (google_protobuf_MethodDescriptorProto *)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
 }
-UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_MethodDescriptorProto_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len);
@@ -966,15 +965,15 @@ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(googl
   UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
 }
 
-
 /* google.protobuf.FileOptions */
 
 UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) {
   return (google_protobuf_FileOptions *)upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_FileOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len);
@@ -1116,15 +1115,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptio
   return sub;
 }
 
-
 /* google.protobuf.MessageOptions */
 
 UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) {
   return (google_protobuf_MessageOptions *)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_MessageOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len);
@@ -1170,15 +1169,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOp
   return sub;
 }
 
-
 /* google.protobuf.FieldOptions */
 
 UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) {
   return (google_protobuf_FieldOptions *)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_FieldOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len);
@@ -1236,15 +1235,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOpti
   return sub;
 }
 
-
 /* google.protobuf.OneofOptions */
 
 UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) {
   return (google_protobuf_OneofOptions *)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_OneofOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len);
@@ -1266,15 +1265,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOpti
   return sub;
 }
 
-
 /* google.protobuf.EnumOptions */
 
 UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) {
   return (google_protobuf_EnumOptions *)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_EnumOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len);
@@ -1308,15 +1307,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptio
   return sub;
 }
 
-
 /* google.protobuf.EnumValueOptions */
 
 UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) {
   return (google_protobuf_EnumValueOptions *)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_EnumValueOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len);
@@ -1344,15 +1343,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValue
   return sub;
 }
 
-
 /* google.protobuf.ServiceOptions */
 
 UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) {
   return (google_protobuf_ServiceOptions *)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_ServiceOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len);
@@ -1380,15 +1379,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOp
   return sub;
 }
 
-
 /* google.protobuf.MethodOptions */
 
 UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) {
   return (google_protobuf_MethodOptions *)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
 }
-UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_MethodOptions_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len);
@@ -1422,15 +1421,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOpt
   return sub;
 }
 
-
 /* google.protobuf.UninterpretedOption */
 
 UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) {
   return (google_protobuf_UninterpretedOption *)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
 }
-UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_UninterpretedOption_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len);
@@ -1488,15 +1487,15 @@ UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_p
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value;
 }
 
-
 /* google.protobuf.UninterpretedOption.NamePart */
 
 UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) {
   return (google_protobuf_UninterpretedOption_NamePart *)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
 }
-UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_UninterpretedOption_NamePart_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len);
@@ -1516,15 +1515,15 @@ UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(go
   UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
 }
 
-
 /* google.protobuf.SourceCodeInfo */
 
 UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) {
   return (google_protobuf_SourceCodeInfo *)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
 }
-UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_SourceCodeInfo_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len);
@@ -1546,15 +1545,15 @@ UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_Sourc
   return sub;
 }
 
-
 /* google.protobuf.SourceCodeInfo.Location */
 
 UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) {
   return (google_protobuf_SourceCodeInfo_Location *)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
 }
-UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_SourceCodeInfo_Location_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len);
@@ -1607,15 +1606,15 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_com
       msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 
-
 /* google.protobuf.GeneratedCodeInfo */
 
 UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) {
   return (google_protobuf_GeneratedCodeInfo *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena);
 }
-UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_GeneratedCodeInfo_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len);
@@ -1637,15 +1636,15 @@ UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_
   return sub;
 }
 
-
 /* google.protobuf.GeneratedCodeInfo.Annotation */
 
 UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) {
   return (google_protobuf_GeneratedCodeInfo_Annotation *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
 }
-UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len);
@@ -1682,7 +1681,6 @@ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_prot
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index bb116dc..f4b3581 100644 (file)
 #define GOOGLE_PROTOBUF_DURATION_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,17 +24,16 @@ struct google_protobuf_Duration;
 typedef struct google_protobuf_Duration google_protobuf_Duration;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 
-/* Enums */
-
 
 /* google.protobuf.Duration */
 
 UPB_INLINE google_protobuf_Duration *google_protobuf_Duration_new(upb_arena *arena) {
   return (google_protobuf_Duration *)upb_msg_new(&google_protobuf_Duration_msginit, arena);
 }
-UPB_INLINE google_protobuf_Duration *google_protobuf_Duration_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Duration *google_protobuf_Duration_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Duration *ret = google_protobuf_Duration_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Duration_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Duration_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Duration_serialize(const google_protobuf_Duration *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Duration_msginit, arena, len);
@@ -50,7 +49,6 @@ UPB_INLINE void google_protobuf_Duration_set_nanos(google_protobuf_Duration *msg
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 43b2edd..6232ecf 100644 (file)
 #define GOOGLE_PROTOBUF_EMPTY_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,17 +24,16 @@ struct google_protobuf_Empty;
 typedef struct google_protobuf_Empty google_protobuf_Empty;
 extern const upb_msglayout google_protobuf_Empty_msginit;
 
-/* Enums */
-
 
 /* google.protobuf.Empty */
 
 UPB_INLINE google_protobuf_Empty *google_protobuf_Empty_new(upb_arena *arena) {
   return (google_protobuf_Empty *)upb_msg_new(&google_protobuf_Empty_msginit, arena);
 }
-UPB_INLINE google_protobuf_Empty *google_protobuf_Empty_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Empty *google_protobuf_Empty_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Empty *ret = google_protobuf_Empty_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Empty_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Empty_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Empty_serialize(const google_protobuf_Empty *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Empty_msginit, arena, len);
@@ -42,7 +41,6 @@ UPB_INLINE char *google_protobuf_Empty_serialize(const google_protobuf_Empty *ms
 
 
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index da5da20..8d036b5 100644 (file)
 #define GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -33,8 +33,6 @@ extern const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit;
 extern const upb_msglayout google_protobuf_Value_msginit;
 extern const upb_msglayout google_protobuf_ListValue_msginit;
 
-/* Enums */
-
 typedef enum {
   google_protobuf_NULL_VALUE = 0
 } google_protobuf_NullValue;
@@ -45,9 +43,10 @@ typedef enum {
 UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_new(upb_arena *arena) {
   return (google_protobuf_Struct *)upb_msg_new(&google_protobuf_Struct_msginit, arena);
 }
-UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Struct *ret = google_protobuf_Struct_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Struct_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Struct_msginit, arena, len);
@@ -69,15 +68,15 @@ UPB_INLINE struct google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_add
   return sub;
 }
 
-
 /* google.protobuf.Struct.FieldsEntry */
 
 UPB_INLINE google_protobuf_Struct_FieldsEntry *google_protobuf_Struct_FieldsEntry_new(upb_arena *arena) {
   return (google_protobuf_Struct_FieldsEntry *)upb_msg_new(&google_protobuf_Struct_FieldsEntry_msginit, arena);
 }
-UPB_INLINE google_protobuf_Struct_FieldsEntry *google_protobuf_Struct_FieldsEntry_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Struct_FieldsEntry *google_protobuf_Struct_FieldsEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Struct_FieldsEntry *ret = google_protobuf_Struct_FieldsEntry_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Struct_FieldsEntry_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_FieldsEntry_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Struct_FieldsEntry_serialize(const google_protobuf_Struct_FieldsEntry *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Struct_FieldsEntry_msginit, arena, len);
@@ -102,15 +101,15 @@ UPB_INLINE struct google_protobuf_Value* google_protobuf_Struct_FieldsEntry_muta
   return sub;
 }
 
-
 /* google.protobuf.Value */
 
 UPB_INLINE google_protobuf_Value *google_protobuf_Value_new(upb_arena *arena) {
   return (google_protobuf_Value *)upb_msg_new(&google_protobuf_Value_msginit, arena);
 }
-UPB_INLINE google_protobuf_Value *google_protobuf_Value_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Value *ret = google_protobuf_Value_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Value_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Value_msginit, arena, len);
@@ -123,9 +122,9 @@ typedef enum {
   google_protobuf_Value_kind_bool_value = 4,
   google_protobuf_Value_kind_struct_value = 5,
   google_protobuf_Value_kind_list_value = 6,
-  google_protobuf_Value_kind_NOT_SET = 0,
+  google_protobuf_Value_kind_NOT_SET = 0
 } google_protobuf_Value_kind_oneofcases;
-UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); }
+UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) { return (google_protobuf_Value_kind_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); }
 
 UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); }
 UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, google_protobuf_NULL_VALUE); }
@@ -177,15 +176,15 @@ UPB_INLINE struct google_protobuf_ListValue* google_protobuf_Value_mutable_list_
   return sub;
 }
 
-
 /* google.protobuf.ListValue */
 
 UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_new(upb_arena *arena) {
   return (google_protobuf_ListValue *)upb_msg_new(&google_protobuf_ListValue_msginit, arena);
 }
-UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_ListValue *ret = google_protobuf_ListValue_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_ListValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_ListValue_msginit, arena, len);
@@ -207,7 +206,6 @@ UPB_INLINE struct google_protobuf_Value* google_protobuf_ListValue_add_values(go
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index 23d39e5..ec4dfe9 100644 (file)
 #define GOOGLE_PROTOBUF_TIMESTAMP_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -24,17 +24,16 @@ struct google_protobuf_Timestamp;
 typedef struct google_protobuf_Timestamp google_protobuf_Timestamp;
 extern const upb_msglayout google_protobuf_Timestamp_msginit;
 
-/* Enums */
-
 
 /* google.protobuf.Timestamp */
 
 UPB_INLINE google_protobuf_Timestamp *google_protobuf_Timestamp_new(upb_arena *arena) {
   return (google_protobuf_Timestamp *)upb_msg_new(&google_protobuf_Timestamp_msginit, arena);
 }
-UPB_INLINE google_protobuf_Timestamp *google_protobuf_Timestamp_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Timestamp *google_protobuf_Timestamp_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Timestamp *ret = google_protobuf_Timestamp_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Timestamp_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Timestamp_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Timestamp_serialize(const google_protobuf_Timestamp *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Timestamp_msginit, arena, len);
@@ -50,7 +49,6 @@ UPB_INLINE void google_protobuf_Timestamp_set_nanos(google_protobuf_Timestamp *m
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index b9897ec..589c213 100644 (file)
 #define GOOGLE_PROTOBUF_WRAPPERS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -48,17 +48,16 @@ extern const upb_msglayout google_protobuf_BoolValue_msginit;
 extern const upb_msglayout google_protobuf_StringValue_msginit;
 extern const upb_msglayout google_protobuf_BytesValue_msginit;
 
-/* Enums */
-
 
 /* google.protobuf.DoubleValue */
 
 UPB_INLINE google_protobuf_DoubleValue *google_protobuf_DoubleValue_new(upb_arena *arena) {
   return (google_protobuf_DoubleValue *)upb_msg_new(&google_protobuf_DoubleValue_msginit, arena);
 }
-UPB_INLINE google_protobuf_DoubleValue *google_protobuf_DoubleValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_DoubleValue *google_protobuf_DoubleValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_DoubleValue *ret = google_protobuf_DoubleValue_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_DoubleValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DoubleValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_DoubleValue_serialize(const google_protobuf_DoubleValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_DoubleValue_msginit, arena, len);
@@ -70,15 +69,15 @@ UPB_INLINE void google_protobuf_DoubleValue_set_value(google_protobuf_DoubleValu
   UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.FloatValue */
 
 UPB_INLINE google_protobuf_FloatValue *google_protobuf_FloatValue_new(upb_arena *arena) {
   return (google_protobuf_FloatValue *)upb_msg_new(&google_protobuf_FloatValue_msginit, arena);
 }
-UPB_INLINE google_protobuf_FloatValue *google_protobuf_FloatValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_FloatValue *google_protobuf_FloatValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_FloatValue *ret = google_protobuf_FloatValue_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_FloatValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FloatValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_FloatValue_serialize(const google_protobuf_FloatValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_FloatValue_msginit, arena, len);
@@ -90,15 +89,15 @@ UPB_INLINE void google_protobuf_FloatValue_set_value(google_protobuf_FloatValue
   UPB_FIELD_AT(msg, float, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.Int64Value */
 
 UPB_INLINE google_protobuf_Int64Value *google_protobuf_Int64Value_new(upb_arena *arena) {
   return (google_protobuf_Int64Value *)upb_msg_new(&google_protobuf_Int64Value_msginit, arena);
 }
-UPB_INLINE google_protobuf_Int64Value *google_protobuf_Int64Value_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Int64Value *google_protobuf_Int64Value_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Int64Value *ret = google_protobuf_Int64Value_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Int64Value_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Int64Value_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Int64Value_serialize(const google_protobuf_Int64Value *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Int64Value_msginit, arena, len);
@@ -110,15 +109,15 @@ UPB_INLINE void google_protobuf_Int64Value_set_value(google_protobuf_Int64Value
   UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.UInt64Value */
 
 UPB_INLINE google_protobuf_UInt64Value *google_protobuf_UInt64Value_new(upb_arena *arena) {
   return (google_protobuf_UInt64Value *)upb_msg_new(&google_protobuf_UInt64Value_msginit, arena);
 }
-UPB_INLINE google_protobuf_UInt64Value *google_protobuf_UInt64Value_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_UInt64Value *google_protobuf_UInt64Value_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_UInt64Value *ret = google_protobuf_UInt64Value_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_UInt64Value_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_UInt64Value_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_UInt64Value_serialize(const google_protobuf_UInt64Value *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_UInt64Value_msginit, arena, len);
@@ -130,15 +129,15 @@ UPB_INLINE void google_protobuf_UInt64Value_set_value(google_protobuf_UInt64Valu
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.Int32Value */
 
 UPB_INLINE google_protobuf_Int32Value *google_protobuf_Int32Value_new(upb_arena *arena) {
   return (google_protobuf_Int32Value *)upb_msg_new(&google_protobuf_Int32Value_msginit, arena);
 }
-UPB_INLINE google_protobuf_Int32Value *google_protobuf_Int32Value_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_Int32Value *google_protobuf_Int32Value_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_Int32Value *ret = google_protobuf_Int32Value_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_Int32Value_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_Int32Value_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_Int32Value_serialize(const google_protobuf_Int32Value *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_Int32Value_msginit, arena, len);
@@ -150,15 +149,15 @@ UPB_INLINE void google_protobuf_Int32Value_set_value(google_protobuf_Int32Value
   UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.UInt32Value */
 
 UPB_INLINE google_protobuf_UInt32Value *google_protobuf_UInt32Value_new(upb_arena *arena) {
   return (google_protobuf_UInt32Value *)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena);
 }
-UPB_INLINE google_protobuf_UInt32Value *google_protobuf_UInt32Value_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_UInt32Value *google_protobuf_UInt32Value_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_UInt32Value *ret = google_protobuf_UInt32Value_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_UInt32Value_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_UInt32Value_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_UInt32Value_serialize(const google_protobuf_UInt32Value *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_UInt32Value_msginit, arena, len);
@@ -170,15 +169,15 @@ UPB_INLINE void google_protobuf_UInt32Value_set_value(google_protobuf_UInt32Valu
   UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.BoolValue */
 
 UPB_INLINE google_protobuf_BoolValue *google_protobuf_BoolValue_new(upb_arena *arena) {
   return (google_protobuf_BoolValue *)upb_msg_new(&google_protobuf_BoolValue_msginit, arena);
 }
-UPB_INLINE google_protobuf_BoolValue *google_protobuf_BoolValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_BoolValue *google_protobuf_BoolValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_BoolValue *ret = google_protobuf_BoolValue_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_BoolValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_BoolValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_BoolValue_serialize(const google_protobuf_BoolValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_BoolValue_msginit, arena, len);
@@ -190,15 +189,15 @@ UPB_INLINE void google_protobuf_BoolValue_set_value(google_protobuf_BoolValue *m
   UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.StringValue */
 
 UPB_INLINE google_protobuf_StringValue *google_protobuf_StringValue_new(upb_arena *arena) {
   return (google_protobuf_StringValue *)upb_msg_new(&google_protobuf_StringValue_msginit, arena);
 }
-UPB_INLINE google_protobuf_StringValue *google_protobuf_StringValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_StringValue *google_protobuf_StringValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_StringValue *ret = google_protobuf_StringValue_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_StringValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_StringValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_StringValue_serialize(const google_protobuf_StringValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_StringValue_msginit, arena, len);
@@ -210,15 +209,15 @@ UPB_INLINE void google_protobuf_StringValue_set_value(google_protobuf_StringValu
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
-
 /* google.protobuf.BytesValue */
 
 UPB_INLINE google_protobuf_BytesValue *google_protobuf_BytesValue_new(upb_arena *arena) {
   return (google_protobuf_BytesValue *)upb_msg_new(&google_protobuf_BytesValue_msginit, arena);
 }
-UPB_INLINE google_protobuf_BytesValue *google_protobuf_BytesValue_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_protobuf_BytesValue *google_protobuf_BytesValue_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_protobuf_BytesValue *ret = google_protobuf_BytesValue_new(arena);
-  return (ret && upb_decode(buf, ret, &google_protobuf_BytesValue_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_BytesValue_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_protobuf_BytesValue_serialize(const google_protobuf_BytesValue *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_protobuf_BytesValue_msginit, arena, len);
@@ -230,7 +229,6 @@ UPB_INLINE void google_protobuf_BytesValue_set_value(google_protobuf_BytesValue
   UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index ccdac65..6c35d83 100644 (file)
 #define GOOGLE_RPC_STATUS_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -26,17 +26,16 @@ extern const upb_msglayout google_rpc_Status_msginit;
 struct google_protobuf_Any;
 extern const upb_msglayout google_protobuf_Any_msginit;
 
-/* Enums */
-
 
 /* google.rpc.Status */
 
 UPB_INLINE google_rpc_Status *google_rpc_Status_new(upb_arena *arena) {
   return (google_rpc_Status *)upb_msg_new(&google_rpc_Status_msginit, arena);
 }
-UPB_INLINE google_rpc_Status *google_rpc_Status_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE google_rpc_Status *google_rpc_Status_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   google_rpc_Status *ret = google_rpc_Status_new(arena);
-  return (ret && upb_decode(buf, ret, &google_rpc_Status_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &google_rpc_Status_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *google_rpc_Status_serialize(const google_rpc_Status *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &google_rpc_Status_msginit, arena, len);
@@ -66,7 +65,6 @@ UPB_INLINE struct google_protobuf_Any* google_rpc_Status_add_details(google_rpc_
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c
new file mode 100644 (file)
index 0000000..9ffd2fb
--- /dev/null
@@ -0,0 +1,49 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/gcp/altscontext.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "src/proto/grpc/gcp/altscontext.upb.h"
+#include "src/proto/grpc/gcp/transport_security_common.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const grpc_gcp_AltsContext_submsgs[2] = {
+  &grpc_gcp_AltsContext_PeerAttributesEntry_msginit,
+  &grpc_gcp_RpcProtocolVersions_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_AltsContext__fields[7] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 9, 1},
+  {2, UPB_SIZE(16, 24), 0, 0, 9, 1},
+  {3, UPB_SIZE(0, 0), 0, 0, 14, 1},
+  {4, UPB_SIZE(24, 40), 0, 0, 9, 1},
+  {5, UPB_SIZE(32, 56), 0, 0, 9, 1},
+  {6, UPB_SIZE(40, 72), 0, 1, 11, 1},
+  {7, UPB_SIZE(44, 80), 0, 0, 11, 3},
+};
+
+const upb_msglayout grpc_gcp_AltsContext_msginit = {
+  &grpc_gcp_AltsContext_submsgs[0],
+  &grpc_gcp_AltsContext__fields[0],
+  UPB_SIZE(48, 96), 7, false,
+};
+
+static const upb_msglayout_field grpc_gcp_AltsContext_PeerAttributesEntry__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 9, 1},
+};
+
+const upb_msglayout grpc_gcp_AltsContext_PeerAttributesEntry_msginit = {
+  NULL,
+  &grpc_gcp_AltsContext_PeerAttributesEntry__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h
new file mode 100644 (file)
index 0000000..ce32864
--- /dev/null
@@ -0,0 +1,126 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/gcp/altscontext.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef SRC_PROTO_GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_
+#define SRC_PROTO_GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct grpc_gcp_AltsContext;
+struct grpc_gcp_AltsContext_PeerAttributesEntry;
+typedef struct grpc_gcp_AltsContext grpc_gcp_AltsContext;
+typedef struct grpc_gcp_AltsContext_PeerAttributesEntry grpc_gcp_AltsContext_PeerAttributesEntry;
+extern const upb_msglayout grpc_gcp_AltsContext_msginit;
+extern const upb_msglayout grpc_gcp_AltsContext_PeerAttributesEntry_msginit;
+struct grpc_gcp_RpcProtocolVersions;
+extern const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit;
+
+
+/* grpc.gcp.AltsContext */
+
+UPB_INLINE grpc_gcp_AltsContext *grpc_gcp_AltsContext_new(upb_arena *arena) {
+  return (grpc_gcp_AltsContext *)upb_msg_new(&grpc_gcp_AltsContext_msginit, arena);
+}
+UPB_INLINE grpc_gcp_AltsContext *grpc_gcp_AltsContext_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_AltsContext *ret = grpc_gcp_AltsContext_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_AltsContext_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_AltsContext_serialize(const grpc_gcp_AltsContext *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_AltsContext_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_AltsContext_application_protocol(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE upb_strview grpc_gcp_AltsContext_record_protocol(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)); }
+UPB_INLINE int32_t grpc_gcp_AltsContext_security_level(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview grpc_gcp_AltsContext_peer_service_account(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 40)); }
+UPB_INLINE upb_strview grpc_gcp_AltsContext_local_service_account(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 56)); }
+UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_AltsContext_peer_rpc_versions(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(40, 72)); }
+UPB_INLINE const grpc_gcp_AltsContext_PeerAttributesEntry* const* grpc_gcp_AltsContext_peer_attributes(const grpc_gcp_AltsContext *msg, size_t *len) { return (const grpc_gcp_AltsContext_PeerAttributesEntry* const*)_upb_array_accessor(msg, UPB_SIZE(44, 80), len); }
+
+UPB_INLINE void grpc_gcp_AltsContext_set_application_protocol(grpc_gcp_AltsContext *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void grpc_gcp_AltsContext_set_record_protocol(grpc_gcp_AltsContext *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)) = value;
+}
+UPB_INLINE void grpc_gcp_AltsContext_set_security_level(grpc_gcp_AltsContext *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_AltsContext_set_peer_service_account(grpc_gcp_AltsContext *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 40)) = value;
+}
+UPB_INLINE void grpc_gcp_AltsContext_set_local_service_account(grpc_gcp_AltsContext *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 56)) = value;
+}
+UPB_INLINE void grpc_gcp_AltsContext_set_peer_rpc_versions(grpc_gcp_AltsContext *msg, struct grpc_gcp_RpcProtocolVersions* value) {
+  UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(40, 72)) = value;
+}
+UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_AltsContext_mutable_peer_rpc_versions(grpc_gcp_AltsContext *msg, upb_arena *arena) {
+  struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_AltsContext_peer_rpc_versions(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_AltsContext_set_peer_rpc_versions(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry** grpc_gcp_AltsContext_mutable_peer_attributes(grpc_gcp_AltsContext *msg, size_t *len) {
+  return (grpc_gcp_AltsContext_PeerAttributesEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 80), len);
+}
+UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry** grpc_gcp_AltsContext_resize_peer_attributes(grpc_gcp_AltsContext *msg, size_t len, upb_arena *arena) {
+  return (grpc_gcp_AltsContext_PeerAttributesEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_gcp_AltsContext_PeerAttributesEntry* grpc_gcp_AltsContext_add_peer_attributes(grpc_gcp_AltsContext *msg, upb_arena *arena) {
+  struct grpc_gcp_AltsContext_PeerAttributesEntry* sub = (struct grpc_gcp_AltsContext_PeerAttributesEntry*)upb_msg_new(&grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(44, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* grpc.gcp.AltsContext.PeerAttributesEntry */
+
+UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry *grpc_gcp_AltsContext_PeerAttributesEntry_new(upb_arena *arena) {
+  return (grpc_gcp_AltsContext_PeerAttributesEntry *)upb_msg_new(&grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena);
+}
+UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry *grpc_gcp_AltsContext_PeerAttributesEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_AltsContext_PeerAttributesEntry *ret = grpc_gcp_AltsContext_PeerAttributesEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_AltsContext_PeerAttributesEntry_serialize(const grpc_gcp_AltsContext_PeerAttributesEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_AltsContext_PeerAttributesEntry_key(const grpc_gcp_AltsContext_PeerAttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview grpc_gcp_AltsContext_PeerAttributesEntry_value(const grpc_gcp_AltsContext_PeerAttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void grpc_gcp_AltsContext_PeerAttributesEntry_set_key(grpc_gcp_AltsContext_PeerAttributesEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_AltsContext_PeerAttributesEntry_set_value(grpc_gcp_AltsContext_PeerAttributesEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* SRC_PROTO_GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c
new file mode 100644 (file)
index 0000000..80f3a0a
--- /dev/null
@@ -0,0 +1,209 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/gcp/handshaker.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "src/proto/grpc/gcp/handshaker.upb.h"
+#include "src/proto/grpc/gcp/transport_security_common.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout_field grpc_gcp_Endpoint__fields[3] = {
+  {1, UPB_SIZE(12, 16), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 8), 0, 0, 5, 1},
+  {3, UPB_SIZE(0, 0), 0, 0, 14, 1},
+};
+
+const upb_msglayout grpc_gcp_Endpoint_msginit = {
+  NULL,
+  &grpc_gcp_Endpoint__fields[0],
+  UPB_SIZE(24, 32), 3, false,
+};
+
+static const upb_msglayout *const grpc_gcp_Identity_submsgs[1] = {
+  &grpc_gcp_Identity_AttributesEntry_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_Identity__fields[3] = {
+  {1, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 9, 1},
+  {2, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 9, 1},
+  {3, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout grpc_gcp_Identity_msginit = {
+  &grpc_gcp_Identity_submsgs[0],
+  &grpc_gcp_Identity__fields[0],
+  UPB_SIZE(16, 32), 3, false,
+};
+
+static const upb_msglayout_field grpc_gcp_Identity_AttributesEntry__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 9, 1},
+};
+
+const upb_msglayout grpc_gcp_Identity_AttributesEntry_msginit = {
+  NULL,
+  &grpc_gcp_Identity_AttributesEntry__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const grpc_gcp_StartClientHandshakeReq_submsgs[5] = {
+  &grpc_gcp_Endpoint_msginit,
+  &grpc_gcp_Identity_msginit,
+  &grpc_gcp_RpcProtocolVersions_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_StartClientHandshakeReq__fields[9] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 14, 1},
+  {2, UPB_SIZE(32, 56), 0, 0, 9, 3},
+  {3, UPB_SIZE(36, 64), 0, 0, 9, 3},
+  {4, UPB_SIZE(40, 72), 0, 1, 11, 3},
+  {5, UPB_SIZE(16, 24), 0, 1, 11, 1},
+  {6, UPB_SIZE(20, 32), 0, 0, 11, 1},
+  {7, UPB_SIZE(24, 40), 0, 0, 11, 1},
+  {8, UPB_SIZE(8, 8), 0, 0, 9, 1},
+  {9, UPB_SIZE(28, 48), 0, 2, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_StartClientHandshakeReq_msginit = {
+  &grpc_gcp_StartClientHandshakeReq_submsgs[0],
+  &grpc_gcp_StartClientHandshakeReq__fields[0],
+  UPB_SIZE(48, 80), 9, false,
+};
+
+static const upb_msglayout *const grpc_gcp_ServerHandshakeParameters_submsgs[1] = {
+  &grpc_gcp_Identity_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_ServerHandshakeParameters__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 3},
+  {2, UPB_SIZE(4, 8), 0, 0, 11, 3},
+};
+
+const upb_msglayout grpc_gcp_ServerHandshakeParameters_msginit = {
+  &grpc_gcp_ServerHandshakeParameters_submsgs[0],
+  &grpc_gcp_ServerHandshakeParameters__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout *const grpc_gcp_StartServerHandshakeReq_submsgs[4] = {
+  &grpc_gcp_Endpoint_msginit,
+  &grpc_gcp_RpcProtocolVersions_msginit,
+  &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_StartServerHandshakeReq__fields[6] = {
+  {1, UPB_SIZE(20, 40), 0, 0, 9, 3},
+  {2, UPB_SIZE(24, 48), 0, 2, 11, 3},
+  {3, UPB_SIZE(0, 0), 0, 0, 12, 1},
+  {4, UPB_SIZE(8, 16), 0, 0, 11, 1},
+  {5, UPB_SIZE(12, 24), 0, 0, 11, 1},
+  {6, UPB_SIZE(16, 32), 0, 1, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_StartServerHandshakeReq_msginit = {
+  &grpc_gcp_StartServerHandshakeReq_submsgs[0],
+  &grpc_gcp_StartServerHandshakeReq__fields[0],
+  UPB_SIZE(32, 64), 6, false,
+};
+
+static const upb_msglayout *const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_submsgs[1] = {
+  &grpc_gcp_ServerHandshakeParameters_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 5, 1},
+  {2, UPB_SIZE(4, 8), 0, 0, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit = {
+  &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_submsgs[0],
+  &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout_field grpc_gcp_NextHandshakeMessageReq__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 12, 1},
+};
+
+const upb_msglayout grpc_gcp_NextHandshakeMessageReq_msginit = {
+  NULL,
+  &grpc_gcp_NextHandshakeMessageReq__fields[0],
+  UPB_SIZE(8, 16), 1, false,
+};
+
+static const upb_msglayout *const grpc_gcp_HandshakerReq_submsgs[3] = {
+  &grpc_gcp_NextHandshakeMessageReq_msginit,
+  &grpc_gcp_StartClientHandshakeReq_msginit,
+  &grpc_gcp_StartServerHandshakeReq_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_HandshakerReq__fields[3] = {
+  {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1},
+  {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 2, 11, 1},
+  {3, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_HandshakerReq_msginit = {
+  &grpc_gcp_HandshakerReq_submsgs[0],
+  &grpc_gcp_HandshakerReq__fields[0],
+  UPB_SIZE(8, 16), 3, false,
+};
+
+static const upb_msglayout *const grpc_gcp_HandshakerResult_submsgs[3] = {
+  &grpc_gcp_Identity_msginit,
+  &grpc_gcp_RpcProtocolVersions_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_HandshakerResult__fields[7] = {
+  {1, UPB_SIZE(4, 8), 0, 0, 9, 1},
+  {2, UPB_SIZE(12, 24), 0, 0, 9, 1},
+  {3, UPB_SIZE(20, 40), 0, 0, 12, 1},
+  {4, UPB_SIZE(28, 56), 0, 0, 11, 1},
+  {5, UPB_SIZE(32, 64), 0, 0, 11, 1},
+  {6, UPB_SIZE(0, 0), 0, 0, 8, 1},
+  {7, UPB_SIZE(36, 72), 0, 1, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_HandshakerResult_msginit = {
+  &grpc_gcp_HandshakerResult_submsgs[0],
+  &grpc_gcp_HandshakerResult__fields[0],
+  UPB_SIZE(40, 80), 7, false,
+};
+
+static const upb_msglayout_field grpc_gcp_HandshakerStatus__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 13, 1},
+  {2, UPB_SIZE(4, 8), 0, 0, 9, 1},
+};
+
+const upb_msglayout grpc_gcp_HandshakerStatus_msginit = {
+  NULL,
+  &grpc_gcp_HandshakerStatus__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const grpc_gcp_HandshakerResp_submsgs[2] = {
+  &grpc_gcp_HandshakerResult_msginit,
+  &grpc_gcp_HandshakerStatus_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_HandshakerResp__fields[4] = {
+  {1, UPB_SIZE(4, 8), 0, 0, 12, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 13, 1},
+  {3, UPB_SIZE(12, 24), 0, 0, 11, 1},
+  {4, UPB_SIZE(16, 32), 0, 1, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_HandshakerResp_msginit = {
+  &grpc_gcp_HandshakerResp_submsgs[0],
+  &grpc_gcp_HandshakerResp__fields[0],
+  UPB_SIZE(24, 48), 4, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h
new file mode 100644 (file)
index 0000000..11a6432
--- /dev/null
@@ -0,0 +1,681 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/gcp/handshaker.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef SRC_PROTO_GRPC_GCP_HANDSHAKER_PROTO_UPB_H_
+#define SRC_PROTO_GRPC_GCP_HANDSHAKER_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct grpc_gcp_Endpoint;
+struct grpc_gcp_Identity;
+struct grpc_gcp_Identity_AttributesEntry;
+struct grpc_gcp_StartClientHandshakeReq;
+struct grpc_gcp_ServerHandshakeParameters;
+struct grpc_gcp_StartServerHandshakeReq;
+struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry;
+struct grpc_gcp_NextHandshakeMessageReq;
+struct grpc_gcp_HandshakerReq;
+struct grpc_gcp_HandshakerResult;
+struct grpc_gcp_HandshakerStatus;
+struct grpc_gcp_HandshakerResp;
+typedef struct grpc_gcp_Endpoint grpc_gcp_Endpoint;
+typedef struct grpc_gcp_Identity grpc_gcp_Identity;
+typedef struct grpc_gcp_Identity_AttributesEntry grpc_gcp_Identity_AttributesEntry;
+typedef struct grpc_gcp_StartClientHandshakeReq grpc_gcp_StartClientHandshakeReq;
+typedef struct grpc_gcp_ServerHandshakeParameters grpc_gcp_ServerHandshakeParameters;
+typedef struct grpc_gcp_StartServerHandshakeReq grpc_gcp_StartServerHandshakeReq;
+typedef struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry;
+typedef struct grpc_gcp_NextHandshakeMessageReq grpc_gcp_NextHandshakeMessageReq;
+typedef struct grpc_gcp_HandshakerReq grpc_gcp_HandshakerReq;
+typedef struct grpc_gcp_HandshakerResult grpc_gcp_HandshakerResult;
+typedef struct grpc_gcp_HandshakerStatus grpc_gcp_HandshakerStatus;
+typedef struct grpc_gcp_HandshakerResp grpc_gcp_HandshakerResp;
+extern const upb_msglayout grpc_gcp_Endpoint_msginit;
+extern const upb_msglayout grpc_gcp_Identity_msginit;
+extern const upb_msglayout grpc_gcp_Identity_AttributesEntry_msginit;
+extern const upb_msglayout grpc_gcp_StartClientHandshakeReq_msginit;
+extern const upb_msglayout grpc_gcp_ServerHandshakeParameters_msginit;
+extern const upb_msglayout grpc_gcp_StartServerHandshakeReq_msginit;
+extern const upb_msglayout grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit;
+extern const upb_msglayout grpc_gcp_NextHandshakeMessageReq_msginit;
+extern const upb_msglayout grpc_gcp_HandshakerReq_msginit;
+extern const upb_msglayout grpc_gcp_HandshakerResult_msginit;
+extern const upb_msglayout grpc_gcp_HandshakerStatus_msginit;
+extern const upb_msglayout grpc_gcp_HandshakerResp_msginit;
+struct grpc_gcp_RpcProtocolVersions;
+extern const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit;
+
+typedef enum {
+  grpc_gcp_HANDSHAKE_PROTOCOL_UNSPECIFIED = 0,
+  grpc_gcp_TLS = 1,
+  grpc_gcp_ALTS = 2
+} grpc_gcp_HandshakeProtocol;
+
+typedef enum {
+  grpc_gcp_NETWORK_PROTOCOL_UNSPECIFIED = 0,
+  grpc_gcp_TCP = 1,
+  grpc_gcp_UDP = 2
+} grpc_gcp_NetworkProtocol;
+
+
+/* grpc.gcp.Endpoint */
+
+UPB_INLINE grpc_gcp_Endpoint *grpc_gcp_Endpoint_new(upb_arena *arena) {
+  return (grpc_gcp_Endpoint *)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena);
+}
+UPB_INLINE grpc_gcp_Endpoint *grpc_gcp_Endpoint_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_Endpoint *ret = grpc_gcp_Endpoint_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_Endpoint_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_Endpoint_serialize(const grpc_gcp_Endpoint *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_Endpoint_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_Endpoint_ip_address(const grpc_gcp_Endpoint *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); }
+UPB_INLINE int32_t grpc_gcp_Endpoint_port(const grpc_gcp_Endpoint *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE int32_t grpc_gcp_Endpoint_protocol(const grpc_gcp_Endpoint *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void grpc_gcp_Endpoint_set_ip_address(grpc_gcp_Endpoint *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value;
+}
+UPB_INLINE void grpc_gcp_Endpoint_set_port(grpc_gcp_Endpoint *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void grpc_gcp_Endpoint_set_protocol(grpc_gcp_Endpoint *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+}
+
+/* grpc.gcp.Identity */
+
+UPB_INLINE grpc_gcp_Identity *grpc_gcp_Identity_new(upb_arena *arena) {
+  return (grpc_gcp_Identity *)upb_msg_new(&grpc_gcp_Identity_msginit, arena);
+}
+UPB_INLINE grpc_gcp_Identity *grpc_gcp_Identity_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_Identity *ret = grpc_gcp_Identity_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_Identity_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_Identity_serialize(const grpc_gcp_Identity *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_Identity_msginit, arena, len);
+}
+
+typedef enum {
+  grpc_gcp_Identity_identity_oneof_service_account = 1,
+  grpc_gcp_Identity_identity_oneof_hostname = 2,
+  grpc_gcp_Identity_identity_oneof_NOT_SET = 0
+} grpc_gcp_Identity_identity_oneof_oneofcases;
+UPB_INLINE grpc_gcp_Identity_identity_oneof_oneofcases grpc_gcp_Identity_identity_oneof_case(const grpc_gcp_Identity* msg) { return (grpc_gcp_Identity_identity_oneof_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); }
+
+UPB_INLINE bool grpc_gcp_Identity_has_service_account(const grpc_gcp_Identity *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 1); }
+UPB_INLINE upb_strview grpc_gcp_Identity_service_account(const grpc_gcp_Identity *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 1, upb_strview_make("", strlen(""))); }
+UPB_INLINE bool grpc_gcp_Identity_has_hostname(const grpc_gcp_Identity *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); }
+UPB_INLINE upb_strview grpc_gcp_Identity_hostname(const grpc_gcp_Identity *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 2, upb_strview_make("", strlen(""))); }
+UPB_INLINE const grpc_gcp_Identity_AttributesEntry* const* grpc_gcp_Identity_attributes(const grpc_gcp_Identity *msg, size_t *len) { return (const grpc_gcp_Identity_AttributesEntry* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE void grpc_gcp_Identity_set_service_account(grpc_gcp_Identity *msg, upb_strview value) {
+  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 1);
+}
+UPB_INLINE void grpc_gcp_Identity_set_hostname(grpc_gcp_Identity *msg, upb_strview value) {
+  UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 2);
+}
+UPB_INLINE grpc_gcp_Identity_AttributesEntry** grpc_gcp_Identity_mutable_attributes(grpc_gcp_Identity *msg, size_t *len) {
+  return (grpc_gcp_Identity_AttributesEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE grpc_gcp_Identity_AttributesEntry** grpc_gcp_Identity_resize_attributes(grpc_gcp_Identity *msg, size_t len, upb_arena *arena) {
+  return (grpc_gcp_Identity_AttributesEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_gcp_Identity_AttributesEntry* grpc_gcp_Identity_add_attributes(grpc_gcp_Identity *msg, upb_arena *arena) {
+  struct grpc_gcp_Identity_AttributesEntry* sub = (struct grpc_gcp_Identity_AttributesEntry*)upb_msg_new(&grpc_gcp_Identity_AttributesEntry_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* grpc.gcp.Identity.AttributesEntry */
+
+UPB_INLINE grpc_gcp_Identity_AttributesEntry *grpc_gcp_Identity_AttributesEntry_new(upb_arena *arena) {
+  return (grpc_gcp_Identity_AttributesEntry *)upb_msg_new(&grpc_gcp_Identity_AttributesEntry_msginit, arena);
+}
+UPB_INLINE grpc_gcp_Identity_AttributesEntry *grpc_gcp_Identity_AttributesEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_Identity_AttributesEntry *ret = grpc_gcp_Identity_AttributesEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_Identity_AttributesEntry_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_Identity_AttributesEntry_serialize(const grpc_gcp_Identity_AttributesEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_Identity_AttributesEntry_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_Identity_AttributesEntry_key(const grpc_gcp_Identity_AttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview grpc_gcp_Identity_AttributesEntry_value(const grpc_gcp_Identity_AttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void grpc_gcp_Identity_AttributesEntry_set_key(grpc_gcp_Identity_AttributesEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_Identity_AttributesEntry_set_value(grpc_gcp_Identity_AttributesEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value;
+}
+
+/* grpc.gcp.StartClientHandshakeReq */
+
+UPB_INLINE grpc_gcp_StartClientHandshakeReq *grpc_gcp_StartClientHandshakeReq_new(upb_arena *arena) {
+  return (grpc_gcp_StartClientHandshakeReq *)upb_msg_new(&grpc_gcp_StartClientHandshakeReq_msginit, arena);
+}
+UPB_INLINE grpc_gcp_StartClientHandshakeReq *grpc_gcp_StartClientHandshakeReq_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_StartClientHandshakeReq *ret = grpc_gcp_StartClientHandshakeReq_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_StartClientHandshakeReq_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_StartClientHandshakeReq_serialize(const grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_StartClientHandshakeReq_msginit, arena, len);
+}
+
+UPB_INLINE int32_t grpc_gcp_StartClientHandshakeReq_handshake_security_protocol(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview const* grpc_gcp_StartClientHandshakeReq_application_protocols(const grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(32, 56), len); }
+UPB_INLINE upb_strview const* grpc_gcp_StartClientHandshakeReq_record_protocols(const grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 64), len); }
+UPB_INLINE const grpc_gcp_Identity* const* grpc_gcp_StartClientHandshakeReq_target_identities(const grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { return (const grpc_gcp_Identity* const*)_upb_array_accessor(msg, UPB_SIZE(40, 72), len); }
+UPB_INLINE const grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_local_identity(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Identity*, UPB_SIZE(16, 24)); }
+UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_local_endpoint(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(20, 32)); }
+UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_remote_endpoint(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(24, 40)); }
+UPB_INLINE upb_strview grpc_gcp_StartClientHandshakeReq_target_name(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartClientHandshakeReq_rpc_versions(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(28, 48)); }
+
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_handshake_security_protocol(grpc_gcp_StartClientHandshakeReq *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_mutable_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 56), len);
+}
+UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_resize_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(32, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(32, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_mutable_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 64), len);
+}
+UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_resize_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 64), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(36, 64), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+UPB_INLINE grpc_gcp_Identity** grpc_gcp_StartClientHandshakeReq_mutable_target_identities(grpc_gcp_StartClientHandshakeReq *msg, size_t *len) {
+  return (grpc_gcp_Identity**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 72), len);
+}
+UPB_INLINE grpc_gcp_Identity** grpc_gcp_StartClientHandshakeReq_resize_target_identities(grpc_gcp_StartClientHandshakeReq *msg, size_t len, upb_arena *arena) {
+  return (grpc_gcp_Identity**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_add_target_identities(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(40, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_local_identity(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Identity* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Identity*, UPB_SIZE(16, 24)) = value;
+}
+UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_mutable_local_identity(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)grpc_gcp_StartClientHandshakeReq_local_identity(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartClientHandshakeReq_set_local_identity(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_local_endpoint(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Endpoint* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(20, 32)) = value;
+}
+UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_mutable_local_endpoint(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartClientHandshakeReq_local_endpoint(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartClientHandshakeReq_set_local_endpoint(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_remote_endpoint(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Endpoint* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(24, 40)) = value;
+}
+UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_mutable_remote_endpoint(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartClientHandshakeReq_remote_endpoint(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartClientHandshakeReq_set_remote_endpoint(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_target_name(grpc_gcp_StartClientHandshakeReq *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_rpc_versions(grpc_gcp_StartClientHandshakeReq *msg, struct grpc_gcp_RpcProtocolVersions* value) {
+  UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(28, 48)) = value;
+}
+UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartClientHandshakeReq_mutable_rpc_versions(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_StartClientHandshakeReq_rpc_versions(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartClientHandshakeReq_set_rpc_versions(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.gcp.ServerHandshakeParameters */
+
+UPB_INLINE grpc_gcp_ServerHandshakeParameters *grpc_gcp_ServerHandshakeParameters_new(upb_arena *arena) {
+  return (grpc_gcp_ServerHandshakeParameters *)upb_msg_new(&grpc_gcp_ServerHandshakeParameters_msginit, arena);
+}
+UPB_INLINE grpc_gcp_ServerHandshakeParameters *grpc_gcp_ServerHandshakeParameters_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_ServerHandshakeParameters *ret = grpc_gcp_ServerHandshakeParameters_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_ServerHandshakeParameters_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_ServerHandshakeParameters_serialize(const grpc_gcp_ServerHandshakeParameters *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_ServerHandshakeParameters_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview const* grpc_gcp_ServerHandshakeParameters_record_protocols(const grpc_gcp_ServerHandshakeParameters *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+UPB_INLINE const grpc_gcp_Identity* const* grpc_gcp_ServerHandshakeParameters_local_identities(const grpc_gcp_ServerHandshakeParameters *msg, size_t *len) { return (const grpc_gcp_Identity* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
+
+UPB_INLINE upb_strview* grpc_gcp_ServerHandshakeParameters_mutable_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE upb_strview* grpc_gcp_ServerHandshakeParameters_resize_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool grpc_gcp_ServerHandshakeParameters_add_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+UPB_INLINE grpc_gcp_Identity** grpc_gcp_ServerHandshakeParameters_mutable_local_identities(grpc_gcp_ServerHandshakeParameters *msg, size_t *len) {
+  return (grpc_gcp_Identity**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
+}
+UPB_INLINE grpc_gcp_Identity** grpc_gcp_ServerHandshakeParameters_resize_local_identities(grpc_gcp_ServerHandshakeParameters *msg, size_t len, upb_arena *arena) {
+  return (grpc_gcp_Identity**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_ServerHandshakeParameters_add_local_identities(grpc_gcp_ServerHandshakeParameters *msg, upb_arena *arena) {
+  struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* grpc.gcp.StartServerHandshakeReq */
+
+UPB_INLINE grpc_gcp_StartServerHandshakeReq *grpc_gcp_StartServerHandshakeReq_new(upb_arena *arena) {
+  return (grpc_gcp_StartServerHandshakeReq *)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_msginit, arena);
+}
+UPB_INLINE grpc_gcp_StartServerHandshakeReq *grpc_gcp_StartServerHandshakeReq_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_StartServerHandshakeReq *ret = grpc_gcp_StartServerHandshakeReq_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_StartServerHandshakeReq_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_StartServerHandshakeReq_serialize(const grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_StartServerHandshakeReq_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview const* grpc_gcp_StartServerHandshakeReq_application_protocols(const grpc_gcp_StartServerHandshakeReq *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
+UPB_INLINE const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* const* grpc_gcp_StartServerHandshakeReq_handshake_parameters(const grpc_gcp_StartServerHandshakeReq *msg, size_t *len) { return (const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
+UPB_INLINE upb_strview grpc_gcp_StartServerHandshakeReq_in_bytes(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_local_endpoint(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(8, 16)); }
+UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_remote_endpoint(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(12, 24)); }
+UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartServerHandshakeReq_rpc_versions(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(16, 32)); }
+
+UPB_INLINE upb_strview* grpc_gcp_StartServerHandshakeReq_mutable_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
+}
+UPB_INLINE upb_strview* grpc_gcp_StartServerHandshakeReq_resize_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool grpc_gcp_StartServerHandshakeReq_add_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry** grpc_gcp_StartServerHandshakeReq_mutable_handshake_parameters(grpc_gcp_StartServerHandshakeReq *msg, size_t *len) {
+  return (grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
+}
+UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry** grpc_gcp_StartServerHandshakeReq_resize_handshake_parameters(grpc_gcp_StartServerHandshakeReq *msg, size_t len, upb_arena *arena) {
+  return (grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* grpc_gcp_StartServerHandshakeReq_add_handshake_parameters(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* sub = (struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry*)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_in_bytes(grpc_gcp_StartServerHandshakeReq *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_local_endpoint(grpc_gcp_StartServerHandshakeReq *msg, grpc_gcp_Endpoint* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_mutable_local_endpoint(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartServerHandshakeReq_local_endpoint(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartServerHandshakeReq_set_local_endpoint(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_remote_endpoint(grpc_gcp_StartServerHandshakeReq *msg, grpc_gcp_Endpoint* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_mutable_remote_endpoint(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartServerHandshakeReq_remote_endpoint(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartServerHandshakeReq_set_remote_endpoint(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_rpc_versions(grpc_gcp_StartServerHandshakeReq *msg, struct grpc_gcp_RpcProtocolVersions* value) {
+  UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(16, 32)) = value;
+}
+UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartServerHandshakeReq_mutable_rpc_versions(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) {
+  struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_StartServerHandshakeReq_rpc_versions(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartServerHandshakeReq_set_rpc_versions(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.gcp.StartServerHandshakeReq.HandshakeParametersEntry */
+
+UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_new(upb_arena *arena) {
+  return (grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena);
+}
+UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *ret = grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_serialize(const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena, len);
+}
+
+UPB_INLINE int32_t grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_key(const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE const grpc_gcp_ServerHandshakeParameters* grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value(const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_ServerHandshakeParameters*, UPB_SIZE(4, 8)); }
+
+UPB_INLINE void grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_key(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_value(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, grpc_gcp_ServerHandshakeParameters* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_ServerHandshakeParameters*, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE struct grpc_gcp_ServerHandshakeParameters* grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_mutable_value(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, upb_arena *arena) {
+  struct grpc_gcp_ServerHandshakeParameters* sub = (struct grpc_gcp_ServerHandshakeParameters*)grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_ServerHandshakeParameters*)upb_msg_new(&grpc_gcp_ServerHandshakeParameters_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_value(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.gcp.NextHandshakeMessageReq */
+
+UPB_INLINE grpc_gcp_NextHandshakeMessageReq *grpc_gcp_NextHandshakeMessageReq_new(upb_arena *arena) {
+  return (grpc_gcp_NextHandshakeMessageReq *)upb_msg_new(&grpc_gcp_NextHandshakeMessageReq_msginit, arena);
+}
+UPB_INLINE grpc_gcp_NextHandshakeMessageReq *grpc_gcp_NextHandshakeMessageReq_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_NextHandshakeMessageReq *ret = grpc_gcp_NextHandshakeMessageReq_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_NextHandshakeMessageReq_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_NextHandshakeMessageReq_serialize(const grpc_gcp_NextHandshakeMessageReq *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_NextHandshakeMessageReq_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_NextHandshakeMessageReq_in_bytes(const grpc_gcp_NextHandshakeMessageReq *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void grpc_gcp_NextHandshakeMessageReq_set_in_bytes(grpc_gcp_NextHandshakeMessageReq *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+
+/* grpc.gcp.HandshakerReq */
+
+UPB_INLINE grpc_gcp_HandshakerReq *grpc_gcp_HandshakerReq_new(upb_arena *arena) {
+  return (grpc_gcp_HandshakerReq *)upb_msg_new(&grpc_gcp_HandshakerReq_msginit, arena);
+}
+UPB_INLINE grpc_gcp_HandshakerReq *grpc_gcp_HandshakerReq_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_HandshakerReq *ret = grpc_gcp_HandshakerReq_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerReq_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_HandshakerReq_serialize(const grpc_gcp_HandshakerReq *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_HandshakerReq_msginit, arena, len);
+}
+
+typedef enum {
+  grpc_gcp_HandshakerReq_req_oneof_client_start = 1,
+  grpc_gcp_HandshakerReq_req_oneof_server_start = 2,
+  grpc_gcp_HandshakerReq_req_oneof_next = 3,
+  grpc_gcp_HandshakerReq_req_oneof_NOT_SET = 0
+} grpc_gcp_HandshakerReq_req_oneof_oneofcases;
+UPB_INLINE grpc_gcp_HandshakerReq_req_oneof_oneofcases grpc_gcp_HandshakerReq_req_oneof_case(const grpc_gcp_HandshakerReq* msg) { return (grpc_gcp_HandshakerReq_req_oneof_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
+
+UPB_INLINE bool grpc_gcp_HandshakerReq_has_client_start(const grpc_gcp_HandshakerReq *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
+UPB_INLINE const grpc_gcp_StartClientHandshakeReq* grpc_gcp_HandshakerReq_client_start(const grpc_gcp_HandshakerReq *msg) { return UPB_READ_ONEOF(msg, const grpc_gcp_StartClientHandshakeReq*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
+UPB_INLINE bool grpc_gcp_HandshakerReq_has_server_start(const grpc_gcp_HandshakerReq *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); }
+UPB_INLINE const grpc_gcp_StartServerHandshakeReq* grpc_gcp_HandshakerReq_server_start(const grpc_gcp_HandshakerReq *msg) { return UPB_READ_ONEOF(msg, const grpc_gcp_StartServerHandshakeReq*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); }
+UPB_INLINE bool grpc_gcp_HandshakerReq_has_next(const grpc_gcp_HandshakerReq *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 3); }
+UPB_INLINE const grpc_gcp_NextHandshakeMessageReq* grpc_gcp_HandshakerReq_next(const grpc_gcp_HandshakerReq *msg) { return UPB_READ_ONEOF(msg, const grpc_gcp_NextHandshakeMessageReq*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 3, NULL); }
+
+UPB_INLINE void grpc_gcp_HandshakerReq_set_client_start(grpc_gcp_HandshakerReq *msg, grpc_gcp_StartClientHandshakeReq* value) {
+  UPB_WRITE_ONEOF(msg, grpc_gcp_StartClientHandshakeReq*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1);
+}
+UPB_INLINE struct grpc_gcp_StartClientHandshakeReq* grpc_gcp_HandshakerReq_mutable_client_start(grpc_gcp_HandshakerReq *msg, upb_arena *arena) {
+  struct grpc_gcp_StartClientHandshakeReq* sub = (struct grpc_gcp_StartClientHandshakeReq*)grpc_gcp_HandshakerReq_client_start(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_StartClientHandshakeReq*)upb_msg_new(&grpc_gcp_StartClientHandshakeReq_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerReq_set_client_start(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_HandshakerReq_set_server_start(grpc_gcp_HandshakerReq *msg, grpc_gcp_StartServerHandshakeReq* value) {
+  UPB_WRITE_ONEOF(msg, grpc_gcp_StartServerHandshakeReq*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2);
+}
+UPB_INLINE struct grpc_gcp_StartServerHandshakeReq* grpc_gcp_HandshakerReq_mutable_server_start(grpc_gcp_HandshakerReq *msg, upb_arena *arena) {
+  struct grpc_gcp_StartServerHandshakeReq* sub = (struct grpc_gcp_StartServerHandshakeReq*)grpc_gcp_HandshakerReq_server_start(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_StartServerHandshakeReq*)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerReq_set_server_start(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_HandshakerReq_set_next(grpc_gcp_HandshakerReq *msg, grpc_gcp_NextHandshakeMessageReq* value) {
+  UPB_WRITE_ONEOF(msg, grpc_gcp_NextHandshakeMessageReq*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 3);
+}
+UPB_INLINE struct grpc_gcp_NextHandshakeMessageReq* grpc_gcp_HandshakerReq_mutable_next(grpc_gcp_HandshakerReq *msg, upb_arena *arena) {
+  struct grpc_gcp_NextHandshakeMessageReq* sub = (struct grpc_gcp_NextHandshakeMessageReq*)grpc_gcp_HandshakerReq_next(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_NextHandshakeMessageReq*)upb_msg_new(&grpc_gcp_NextHandshakeMessageReq_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerReq_set_next(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.gcp.HandshakerResult */
+
+UPB_INLINE grpc_gcp_HandshakerResult *grpc_gcp_HandshakerResult_new(upb_arena *arena) {
+  return (grpc_gcp_HandshakerResult *)upb_msg_new(&grpc_gcp_HandshakerResult_msginit, arena);
+}
+UPB_INLINE grpc_gcp_HandshakerResult *grpc_gcp_HandshakerResult_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_HandshakerResult *ret = grpc_gcp_HandshakerResult_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerResult_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_HandshakerResult_serialize(const grpc_gcp_HandshakerResult *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_HandshakerResult_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_HandshakerResult_application_protocol(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE upb_strview grpc_gcp_HandshakerResult_record_protocol(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
+UPB_INLINE upb_strview grpc_gcp_HandshakerResult_key_data(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
+UPB_INLINE const grpc_gcp_Identity* grpc_gcp_HandshakerResult_peer_identity(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Identity*, UPB_SIZE(28, 56)); }
+UPB_INLINE const grpc_gcp_Identity* grpc_gcp_HandshakerResult_local_identity(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Identity*, UPB_SIZE(32, 64)); }
+UPB_INLINE bool grpc_gcp_HandshakerResult_keep_channel_open(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_HandshakerResult_peer_rpc_versions(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(36, 72)); }
+
+UPB_INLINE void grpc_gcp_HandshakerResult_set_application_protocol(grpc_gcp_HandshakerResult *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerResult_set_record_protocol(grpc_gcp_HandshakerResult *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerResult_set_key_data(grpc_gcp_HandshakerResult *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerResult_set_peer_identity(grpc_gcp_HandshakerResult *msg, grpc_gcp_Identity* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Identity*, UPB_SIZE(28, 56)) = value;
+}
+UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_HandshakerResult_mutable_peer_identity(grpc_gcp_HandshakerResult *msg, upb_arena *arena) {
+  struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)grpc_gcp_HandshakerResult_peer_identity(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerResult_set_peer_identity(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_HandshakerResult_set_local_identity(grpc_gcp_HandshakerResult *msg, grpc_gcp_Identity* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_Identity*, UPB_SIZE(32, 64)) = value;
+}
+UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_HandshakerResult_mutable_local_identity(grpc_gcp_HandshakerResult *msg, upb_arena *arena) {
+  struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)grpc_gcp_HandshakerResult_local_identity(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerResult_set_local_identity(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_HandshakerResult_set_keep_channel_open(grpc_gcp_HandshakerResult *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerResult_set_peer_rpc_versions(grpc_gcp_HandshakerResult *msg, struct grpc_gcp_RpcProtocolVersions* value) {
+  UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(36, 72)) = value;
+}
+UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_HandshakerResult_mutable_peer_rpc_versions(grpc_gcp_HandshakerResult *msg, upb_arena *arena) {
+  struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_HandshakerResult_peer_rpc_versions(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerResult_set_peer_rpc_versions(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.gcp.HandshakerStatus */
+
+UPB_INLINE grpc_gcp_HandshakerStatus *grpc_gcp_HandshakerStatus_new(upb_arena *arena) {
+  return (grpc_gcp_HandshakerStatus *)upb_msg_new(&grpc_gcp_HandshakerStatus_msginit, arena);
+}
+UPB_INLINE grpc_gcp_HandshakerStatus *grpc_gcp_HandshakerStatus_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_HandshakerStatus *ret = grpc_gcp_HandshakerStatus_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerStatus_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_HandshakerStatus_serialize(const grpc_gcp_HandshakerStatus *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_HandshakerStatus_msginit, arena, len);
+}
+
+UPB_INLINE uint32_t grpc_gcp_HandshakerStatus_code(const grpc_gcp_HandshakerStatus *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview grpc_gcp_HandshakerStatus_details(const grpc_gcp_HandshakerStatus *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+
+UPB_INLINE void grpc_gcp_HandshakerStatus_set_code(grpc_gcp_HandshakerStatus *msg, uint32_t value) {
+  UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerStatus_set_details(grpc_gcp_HandshakerStatus *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+
+/* grpc.gcp.HandshakerResp */
+
+UPB_INLINE grpc_gcp_HandshakerResp *grpc_gcp_HandshakerResp_new(upb_arena *arena) {
+  return (grpc_gcp_HandshakerResp *)upb_msg_new(&grpc_gcp_HandshakerResp_msginit, arena);
+}
+UPB_INLINE grpc_gcp_HandshakerResp *grpc_gcp_HandshakerResp_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_HandshakerResp *ret = grpc_gcp_HandshakerResp_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerResp_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_HandshakerResp_serialize(const grpc_gcp_HandshakerResp *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_HandshakerResp_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_gcp_HandshakerResp_out_frames(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE uint32_t grpc_gcp_HandshakerResp_bytes_consumed(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE const grpc_gcp_HandshakerResult* grpc_gcp_HandshakerResp_result(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_HandshakerResult*, UPB_SIZE(12, 24)); }
+UPB_INLINE const grpc_gcp_HandshakerStatus* grpc_gcp_HandshakerResp_status(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_HandshakerStatus*, UPB_SIZE(16, 32)); }
+
+UPB_INLINE void grpc_gcp_HandshakerResp_set_out_frames(grpc_gcp_HandshakerResp *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerResp_set_bytes_consumed(grpc_gcp_HandshakerResp *msg, uint32_t value) {
+  UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_HandshakerResp_set_result(grpc_gcp_HandshakerResp *msg, grpc_gcp_HandshakerResult* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_HandshakerResult*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct grpc_gcp_HandshakerResult* grpc_gcp_HandshakerResp_mutable_result(grpc_gcp_HandshakerResp *msg, upb_arena *arena) {
+  struct grpc_gcp_HandshakerResult* sub = (struct grpc_gcp_HandshakerResult*)grpc_gcp_HandshakerResp_result(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_HandshakerResult*)upb_msg_new(&grpc_gcp_HandshakerResult_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerResp_set_result(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_HandshakerResp_set_status(grpc_gcp_HandshakerResp *msg, grpc_gcp_HandshakerStatus* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_HandshakerStatus*, UPB_SIZE(16, 32)) = value;
+}
+UPB_INLINE struct grpc_gcp_HandshakerStatus* grpc_gcp_HandshakerResp_mutable_status(grpc_gcp_HandshakerResp *msg, upb_arena *arena) {
+  struct grpc_gcp_HandshakerStatus* sub = (struct grpc_gcp_HandshakerStatus*)grpc_gcp_HandshakerResp_status(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_HandshakerStatus*)upb_msg_new(&grpc_gcp_HandshakerStatus_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_HandshakerResp_set_status(msg, sub);
+  }
+  return sub;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* SRC_PROTO_GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c
new file mode 100644 (file)
index 0000000..9b63034
--- /dev/null
@@ -0,0 +1,42 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/gcp/transport_security_common.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "src/proto/grpc/gcp/transport_security_common.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const grpc_gcp_RpcProtocolVersions_submsgs[2] = {
+  &grpc_gcp_RpcProtocolVersions_Version_msginit,
+};
+
+static const upb_msglayout_field grpc_gcp_RpcProtocolVersions__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 1},
+  {2, UPB_SIZE(4, 8), 0, 0, 11, 1},
+};
+
+const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit = {
+  &grpc_gcp_RpcProtocolVersions_submsgs[0],
+  &grpc_gcp_RpcProtocolVersions__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout_field grpc_gcp_RpcProtocolVersions_Version__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 13, 1},
+  {2, UPB_SIZE(4, 4), 0, 0, 13, 1},
+};
+
+const upb_msglayout grpc_gcp_RpcProtocolVersions_Version_msginit = {
+  NULL,
+  &grpc_gcp_RpcProtocolVersions_Version__fields[0],
+  UPB_SIZE(8, 8), 2, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h
new file mode 100644 (file)
index 0000000..0e55e45
--- /dev/null
@@ -0,0 +1,109 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/gcp/transport_security_common.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef SRC_PROTO_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_
+#define SRC_PROTO_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct grpc_gcp_RpcProtocolVersions;
+struct grpc_gcp_RpcProtocolVersions_Version;
+typedef struct grpc_gcp_RpcProtocolVersions grpc_gcp_RpcProtocolVersions;
+typedef struct grpc_gcp_RpcProtocolVersions_Version grpc_gcp_RpcProtocolVersions_Version;
+extern const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit;
+extern const upb_msglayout grpc_gcp_RpcProtocolVersions_Version_msginit;
+
+typedef enum {
+  grpc_gcp_SECURITY_NONE = 0,
+  grpc_gcp_INTEGRITY_ONLY = 1,
+  grpc_gcp_INTEGRITY_AND_PRIVACY = 2
+} grpc_gcp_SecurityLevel;
+
+
+/* grpc.gcp.RpcProtocolVersions */
+
+UPB_INLINE grpc_gcp_RpcProtocolVersions *grpc_gcp_RpcProtocolVersions_new(upb_arena *arena) {
+  return (grpc_gcp_RpcProtocolVersions *)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena);
+}
+UPB_INLINE grpc_gcp_RpcProtocolVersions *grpc_gcp_RpcProtocolVersions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_RpcProtocolVersions *ret = grpc_gcp_RpcProtocolVersions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_RpcProtocolVersions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_RpcProtocolVersions_serialize(const grpc_gcp_RpcProtocolVersions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_RpcProtocolVersions_msginit, arena, len);
+}
+
+UPB_INLINE const grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_max_rpc_version(const grpc_gcp_RpcProtocolVersions *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(0, 0)); }
+UPB_INLINE const grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_min_rpc_version(const grpc_gcp_RpcProtocolVersions *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(4, 8)); }
+
+UPB_INLINE void grpc_gcp_RpcProtocolVersions_set_max_rpc_version(grpc_gcp_RpcProtocolVersions *msg, grpc_gcp_RpcProtocolVersions_Version* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE struct grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_mutable_max_rpc_version(grpc_gcp_RpcProtocolVersions *msg, upb_arena *arena) {
+  struct grpc_gcp_RpcProtocolVersions_Version* sub = (struct grpc_gcp_RpcProtocolVersions_Version*)grpc_gcp_RpcProtocolVersions_max_rpc_version(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_RpcProtocolVersions_Version*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_Version_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_RpcProtocolVersions_set_max_rpc_version(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_gcp_RpcProtocolVersions_set_min_rpc_version(grpc_gcp_RpcProtocolVersions *msg, grpc_gcp_RpcProtocolVersions_Version* value) {
+  UPB_FIELD_AT(msg, grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE struct grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_mutable_min_rpc_version(grpc_gcp_RpcProtocolVersions *msg, upb_arena *arena) {
+  struct grpc_gcp_RpcProtocolVersions_Version* sub = (struct grpc_gcp_RpcProtocolVersions_Version*)grpc_gcp_RpcProtocolVersions_min_rpc_version(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_gcp_RpcProtocolVersions_Version*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_Version_msginit, arena);
+    if (!sub) return NULL;
+    grpc_gcp_RpcProtocolVersions_set_min_rpc_version(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.gcp.RpcProtocolVersions.Version */
+
+UPB_INLINE grpc_gcp_RpcProtocolVersions_Version *grpc_gcp_RpcProtocolVersions_Version_new(upb_arena *arena) {
+  return (grpc_gcp_RpcProtocolVersions_Version *)upb_msg_new(&grpc_gcp_RpcProtocolVersions_Version_msginit, arena);
+}
+UPB_INLINE grpc_gcp_RpcProtocolVersions_Version *grpc_gcp_RpcProtocolVersions_Version_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_gcp_RpcProtocolVersions_Version *ret = grpc_gcp_RpcProtocolVersions_Version_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_gcp_RpcProtocolVersions_Version_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_gcp_RpcProtocolVersions_Version_serialize(const grpc_gcp_RpcProtocolVersions_Version *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_gcp_RpcProtocolVersions_Version_msginit, arena, len);
+}
+
+UPB_INLINE uint32_t grpc_gcp_RpcProtocolVersions_Version_major(const grpc_gcp_RpcProtocolVersions_Version *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE uint32_t grpc_gcp_RpcProtocolVersions_Version_minor(const grpc_gcp_RpcProtocolVersions_Version *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(4, 4)); }
+
+UPB_INLINE void grpc_gcp_RpcProtocolVersions_Version_set_major(grpc_gcp_RpcProtocolVersions_Version *msg, uint32_t value) {
+  UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_gcp_RpcProtocolVersions_Version_set_minor(grpc_gcp_RpcProtocolVersions_Version *msg, uint32_t value) {
+  UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(4, 4)) = value;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* SRC_PROTO_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c
new file mode 100644 (file)
index 0000000..8a3359b
--- /dev/null
@@ -0,0 +1,36 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/health/v1/health.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "src/proto/grpc/health/v1/health.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout_field grpc_health_v1_HealthCheckRequest__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+};
+
+const upb_msglayout grpc_health_v1_HealthCheckRequest_msginit = {
+  NULL,
+  &grpc_health_v1_HealthCheckRequest__fields[0],
+  UPB_SIZE(8, 16), 1, false,
+};
+
+static const upb_msglayout_field grpc_health_v1_HealthCheckResponse__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 14, 1},
+};
+
+const upb_msglayout grpc_health_v1_HealthCheckResponse_msginit = {
+  NULL,
+  &grpc_health_v1_HealthCheckResponse__fields[0],
+  UPB_SIZE(8, 8), 1, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h
new file mode 100644 (file)
index 0000000..103b4dd
--- /dev/null
@@ -0,0 +1,84 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/health/v1/health.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef SRC_PROTO_GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_
+#define SRC_PROTO_GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct grpc_health_v1_HealthCheckRequest;
+struct grpc_health_v1_HealthCheckResponse;
+typedef struct grpc_health_v1_HealthCheckRequest grpc_health_v1_HealthCheckRequest;
+typedef struct grpc_health_v1_HealthCheckResponse grpc_health_v1_HealthCheckResponse;
+extern const upb_msglayout grpc_health_v1_HealthCheckRequest_msginit;
+extern const upb_msglayout grpc_health_v1_HealthCheckResponse_msginit;
+
+typedef enum {
+  grpc_health_v1_HealthCheckResponse_UNKNOWN = 0,
+  grpc_health_v1_HealthCheckResponse_SERVING = 1,
+  grpc_health_v1_HealthCheckResponse_NOT_SERVING = 2,
+  grpc_health_v1_HealthCheckResponse_SERVICE_UNKNOWN = 3
+} grpc_health_v1_HealthCheckResponse_ServingStatus;
+
+
+/* grpc.health.v1.HealthCheckRequest */
+
+UPB_INLINE grpc_health_v1_HealthCheckRequest *grpc_health_v1_HealthCheckRequest_new(upb_arena *arena) {
+  return (grpc_health_v1_HealthCheckRequest *)upb_msg_new(&grpc_health_v1_HealthCheckRequest_msginit, arena);
+}
+UPB_INLINE grpc_health_v1_HealthCheckRequest *grpc_health_v1_HealthCheckRequest_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_health_v1_HealthCheckRequest *ret = grpc_health_v1_HealthCheckRequest_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_health_v1_HealthCheckRequest_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_health_v1_HealthCheckRequest_serialize(const grpc_health_v1_HealthCheckRequest *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_health_v1_HealthCheckRequest_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_health_v1_HealthCheckRequest_service(const grpc_health_v1_HealthCheckRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void grpc_health_v1_HealthCheckRequest_set_service(grpc_health_v1_HealthCheckRequest *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+
+/* grpc.health.v1.HealthCheckResponse */
+
+UPB_INLINE grpc_health_v1_HealthCheckResponse *grpc_health_v1_HealthCheckResponse_new(upb_arena *arena) {
+  return (grpc_health_v1_HealthCheckResponse *)upb_msg_new(&grpc_health_v1_HealthCheckResponse_msginit, arena);
+}
+UPB_INLINE grpc_health_v1_HealthCheckResponse *grpc_health_v1_HealthCheckResponse_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_health_v1_HealthCheckResponse *ret = grpc_health_v1_HealthCheckResponse_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_health_v1_HealthCheckResponse_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_health_v1_HealthCheckResponse_serialize(const grpc_health_v1_HealthCheckResponse *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_health_v1_HealthCheckResponse_msginit, arena, len);
+}
+
+UPB_INLINE int32_t grpc_health_v1_HealthCheckResponse_status(const grpc_health_v1_HealthCheckResponse *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void grpc_health_v1_HealthCheckResponse_set_status(grpc_health_v1_HealthCheckResponse *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* SRC_PROTO_GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c
new file mode 100644 (file)
index 0000000..75f0761
--- /dev/null
@@ -0,0 +1,133 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/lb/v1/load_balancer.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "src/proto/grpc/lb/v1/load_balancer.upb.h"
+#include "google/protobuf/duration.upb.h"
+#include "google/protobuf/timestamp.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const grpc_lb_v1_LoadBalanceRequest_submsgs[2] = {
+  &grpc_lb_v1_ClientStats_msginit,
+  &grpc_lb_v1_InitialLoadBalanceRequest_msginit,
+};
+
+static const upb_msglayout_field grpc_lb_v1_LoadBalanceRequest__fields[2] = {
+  {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1},
+  {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1},
+};
+
+const upb_msglayout grpc_lb_v1_LoadBalanceRequest_msginit = {
+  &grpc_lb_v1_LoadBalanceRequest_submsgs[0],
+  &grpc_lb_v1_LoadBalanceRequest__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout_field grpc_lb_v1_InitialLoadBalanceRequest__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+};
+
+const upb_msglayout grpc_lb_v1_InitialLoadBalanceRequest_msginit = {
+  NULL,
+  &grpc_lb_v1_InitialLoadBalanceRequest__fields[0],
+  UPB_SIZE(8, 16), 1, false,
+};
+
+static const upb_msglayout_field grpc_lb_v1_ClientStatsPerToken__fields[2] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 9, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 3, 1},
+};
+
+const upb_msglayout grpc_lb_v1_ClientStatsPerToken_msginit = {
+  NULL,
+  &grpc_lb_v1_ClientStatsPerToken__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const grpc_lb_v1_ClientStats_submsgs[2] = {
+  &google_protobuf_Timestamp_msginit,
+  &grpc_lb_v1_ClientStatsPerToken_msginit,
+};
+
+static const upb_msglayout_field grpc_lb_v1_ClientStats__fields[6] = {
+  {1, UPB_SIZE(32, 32), 0, 0, 11, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 3, 1},
+  {3, UPB_SIZE(8, 8), 0, 0, 3, 1},
+  {6, UPB_SIZE(16, 16), 0, 0, 3, 1},
+  {7, UPB_SIZE(24, 24), 0, 0, 3, 1},
+  {8, UPB_SIZE(36, 40), 0, 1, 11, 3},
+};
+
+const upb_msglayout grpc_lb_v1_ClientStats_msginit = {
+  &grpc_lb_v1_ClientStats_submsgs[0],
+  &grpc_lb_v1_ClientStats__fields[0],
+  UPB_SIZE(40, 48), 6, false,
+};
+
+static const upb_msglayout *const grpc_lb_v1_LoadBalanceResponse_submsgs[2] = {
+  &grpc_lb_v1_InitialLoadBalanceResponse_msginit,
+  &grpc_lb_v1_ServerList_msginit,
+};
+
+static const upb_msglayout_field grpc_lb_v1_LoadBalanceResponse__fields[2] = {
+  {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1},
+  {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1},
+};
+
+const upb_msglayout grpc_lb_v1_LoadBalanceResponse_msginit = {
+  &grpc_lb_v1_LoadBalanceResponse_submsgs[0],
+  &grpc_lb_v1_LoadBalanceResponse__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout *const grpc_lb_v1_InitialLoadBalanceResponse_submsgs[1] = {
+  &google_protobuf_Duration_msginit,
+};
+
+static const upb_msglayout_field grpc_lb_v1_InitialLoadBalanceResponse__fields[2] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 9, 1},
+  {2, UPB_SIZE(8, 16), 0, 0, 11, 1},
+};
+
+const upb_msglayout grpc_lb_v1_InitialLoadBalanceResponse_msginit = {
+  &grpc_lb_v1_InitialLoadBalanceResponse_submsgs[0],
+  &grpc_lb_v1_InitialLoadBalanceResponse__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const grpc_lb_v1_ServerList_submsgs[1] = {
+  &grpc_lb_v1_Server_msginit,
+};
+
+static const upb_msglayout_field grpc_lb_v1_ServerList__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout grpc_lb_v1_ServerList_msginit = {
+  &grpc_lb_v1_ServerList_submsgs[0],
+  &grpc_lb_v1_ServerList__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
+static const upb_msglayout_field grpc_lb_v1_Server__fields[4] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 12, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 5, 1},
+  {3, UPB_SIZE(16, 24), 0, 0, 9, 1},
+  {4, UPB_SIZE(4, 4), 0, 0, 8, 1},
+};
+
+const upb_msglayout grpc_lb_v1_Server_msginit = {
+  NULL,
+  &grpc_lb_v1_Server__fields[0],
+  UPB_SIZE(24, 48), 4, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h
new file mode 100644 (file)
index 0000000..6484566
--- /dev/null
@@ -0,0 +1,359 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     src/proto/grpc/lb/v1/load_balancer.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef SRC_PROTO_GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_
+#define SRC_PROTO_GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct grpc_lb_v1_LoadBalanceRequest;
+struct grpc_lb_v1_InitialLoadBalanceRequest;
+struct grpc_lb_v1_ClientStatsPerToken;
+struct grpc_lb_v1_ClientStats;
+struct grpc_lb_v1_LoadBalanceResponse;
+struct grpc_lb_v1_InitialLoadBalanceResponse;
+struct grpc_lb_v1_ServerList;
+struct grpc_lb_v1_Server;
+typedef struct grpc_lb_v1_LoadBalanceRequest grpc_lb_v1_LoadBalanceRequest;
+typedef struct grpc_lb_v1_InitialLoadBalanceRequest grpc_lb_v1_InitialLoadBalanceRequest;
+typedef struct grpc_lb_v1_ClientStatsPerToken grpc_lb_v1_ClientStatsPerToken;
+typedef struct grpc_lb_v1_ClientStats grpc_lb_v1_ClientStats;
+typedef struct grpc_lb_v1_LoadBalanceResponse grpc_lb_v1_LoadBalanceResponse;
+typedef struct grpc_lb_v1_InitialLoadBalanceResponse grpc_lb_v1_InitialLoadBalanceResponse;
+typedef struct grpc_lb_v1_ServerList grpc_lb_v1_ServerList;
+typedef struct grpc_lb_v1_Server grpc_lb_v1_Server;
+extern const upb_msglayout grpc_lb_v1_LoadBalanceRequest_msginit;
+extern const upb_msglayout grpc_lb_v1_InitialLoadBalanceRequest_msginit;
+extern const upb_msglayout grpc_lb_v1_ClientStatsPerToken_msginit;
+extern const upb_msglayout grpc_lb_v1_ClientStats_msginit;
+extern const upb_msglayout grpc_lb_v1_LoadBalanceResponse_msginit;
+extern const upb_msglayout grpc_lb_v1_InitialLoadBalanceResponse_msginit;
+extern const upb_msglayout grpc_lb_v1_ServerList_msginit;
+extern const upb_msglayout grpc_lb_v1_Server_msginit;
+struct google_protobuf_Duration;
+struct google_protobuf_Timestamp;
+extern const upb_msglayout google_protobuf_Duration_msginit;
+extern const upb_msglayout google_protobuf_Timestamp_msginit;
+
+
+/* grpc.lb.v1.LoadBalanceRequest */
+
+UPB_INLINE grpc_lb_v1_LoadBalanceRequest *grpc_lb_v1_LoadBalanceRequest_new(upb_arena *arena) {
+  return (grpc_lb_v1_LoadBalanceRequest *)upb_msg_new(&grpc_lb_v1_LoadBalanceRequest_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_LoadBalanceRequest *grpc_lb_v1_LoadBalanceRequest_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_LoadBalanceRequest *ret = grpc_lb_v1_LoadBalanceRequest_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_LoadBalanceRequest_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_LoadBalanceRequest_serialize(const grpc_lb_v1_LoadBalanceRequest *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_LoadBalanceRequest_msginit, arena, len);
+}
+
+typedef enum {
+  grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_initial_request = 1,
+  grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_client_stats = 2,
+  grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_NOT_SET = 0
+} grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_oneofcases;
+UPB_INLINE grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_oneofcases grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_case(const grpc_lb_v1_LoadBalanceRequest* msg) { return (grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
+
+UPB_INLINE bool grpc_lb_v1_LoadBalanceRequest_has_initial_request(const grpc_lb_v1_LoadBalanceRequest *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
+UPB_INLINE const grpc_lb_v1_InitialLoadBalanceRequest* grpc_lb_v1_LoadBalanceRequest_initial_request(const grpc_lb_v1_LoadBalanceRequest *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_InitialLoadBalanceRequest*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
+UPB_INLINE bool grpc_lb_v1_LoadBalanceRequest_has_client_stats(const grpc_lb_v1_LoadBalanceRequest *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); }
+UPB_INLINE const grpc_lb_v1_ClientStats* grpc_lb_v1_LoadBalanceRequest_client_stats(const grpc_lb_v1_LoadBalanceRequest *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_ClientStats*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); }
+
+UPB_INLINE void grpc_lb_v1_LoadBalanceRequest_set_initial_request(grpc_lb_v1_LoadBalanceRequest *msg, grpc_lb_v1_InitialLoadBalanceRequest* value) {
+  UPB_WRITE_ONEOF(msg, grpc_lb_v1_InitialLoadBalanceRequest*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1);
+}
+UPB_INLINE struct grpc_lb_v1_InitialLoadBalanceRequest* grpc_lb_v1_LoadBalanceRequest_mutable_initial_request(grpc_lb_v1_LoadBalanceRequest *msg, upb_arena *arena) {
+  struct grpc_lb_v1_InitialLoadBalanceRequest* sub = (struct grpc_lb_v1_InitialLoadBalanceRequest*)grpc_lb_v1_LoadBalanceRequest_initial_request(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_lb_v1_InitialLoadBalanceRequest*)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena);
+    if (!sub) return NULL;
+    grpc_lb_v1_LoadBalanceRequest_set_initial_request(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_lb_v1_LoadBalanceRequest_set_client_stats(grpc_lb_v1_LoadBalanceRequest *msg, grpc_lb_v1_ClientStats* value) {
+  UPB_WRITE_ONEOF(msg, grpc_lb_v1_ClientStats*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2);
+}
+UPB_INLINE struct grpc_lb_v1_ClientStats* grpc_lb_v1_LoadBalanceRequest_mutable_client_stats(grpc_lb_v1_LoadBalanceRequest *msg, upb_arena *arena) {
+  struct grpc_lb_v1_ClientStats* sub = (struct grpc_lb_v1_ClientStats*)grpc_lb_v1_LoadBalanceRequest_client_stats(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_lb_v1_ClientStats*)upb_msg_new(&grpc_lb_v1_ClientStats_msginit, arena);
+    if (!sub) return NULL;
+    grpc_lb_v1_LoadBalanceRequest_set_client_stats(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.lb.v1.InitialLoadBalanceRequest */
+
+UPB_INLINE grpc_lb_v1_InitialLoadBalanceRequest *grpc_lb_v1_InitialLoadBalanceRequest_new(upb_arena *arena) {
+  return (grpc_lb_v1_InitialLoadBalanceRequest *)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_InitialLoadBalanceRequest *grpc_lb_v1_InitialLoadBalanceRequest_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_InitialLoadBalanceRequest *ret = grpc_lb_v1_InitialLoadBalanceRequest_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_InitialLoadBalanceRequest_serialize(const grpc_lb_v1_InitialLoadBalanceRequest *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_lb_v1_InitialLoadBalanceRequest_name(const grpc_lb_v1_InitialLoadBalanceRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void grpc_lb_v1_InitialLoadBalanceRequest_set_name(grpc_lb_v1_InitialLoadBalanceRequest *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+
+/* grpc.lb.v1.ClientStatsPerToken */
+
+UPB_INLINE grpc_lb_v1_ClientStatsPerToken *grpc_lb_v1_ClientStatsPerToken_new(upb_arena *arena) {
+  return (grpc_lb_v1_ClientStatsPerToken *)upb_msg_new(&grpc_lb_v1_ClientStatsPerToken_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_ClientStatsPerToken *grpc_lb_v1_ClientStatsPerToken_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_ClientStatsPerToken *ret = grpc_lb_v1_ClientStatsPerToken_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_ClientStatsPerToken_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_ClientStatsPerToken_serialize(const grpc_lb_v1_ClientStatsPerToken *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_ClientStatsPerToken_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_lb_v1_ClientStatsPerToken_load_balance_token(const grpc_lb_v1_ClientStatsPerToken *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE int64_t grpc_lb_v1_ClientStatsPerToken_num_calls(const grpc_lb_v1_ClientStatsPerToken *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void grpc_lb_v1_ClientStatsPerToken_set_load_balance_token(grpc_lb_v1_ClientStatsPerToken *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void grpc_lb_v1_ClientStatsPerToken_set_num_calls(grpc_lb_v1_ClientStatsPerToken *msg, int64_t value) {
+  UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value;
+}
+
+/* grpc.lb.v1.ClientStats */
+
+UPB_INLINE grpc_lb_v1_ClientStats *grpc_lb_v1_ClientStats_new(upb_arena *arena) {
+  return (grpc_lb_v1_ClientStats *)upb_msg_new(&grpc_lb_v1_ClientStats_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_ClientStats *grpc_lb_v1_ClientStats_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_ClientStats *ret = grpc_lb_v1_ClientStats_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_ClientStats_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_ClientStats_serialize(const grpc_lb_v1_ClientStats *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_ClientStats_msginit, arena, len);
+}
+
+UPB_INLINE const struct google_protobuf_Timestamp* grpc_lb_v1_ClientStats_timestamp(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Timestamp*, UPB_SIZE(32, 32)); }
+UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_started(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); }
+UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_finished(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)); }
+UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)); }
+UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_finished_known_received(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(24, 24)); }
+UPB_INLINE const grpc_lb_v1_ClientStatsPerToken* const* grpc_lb_v1_ClientStats_calls_finished_with_drop(const grpc_lb_v1_ClientStats *msg, size_t *len) { return (const grpc_lb_v1_ClientStatsPerToken* const*)_upb_array_accessor(msg, UPB_SIZE(36, 40), len); }
+
+UPB_INLINE void grpc_lb_v1_ClientStats_set_timestamp(grpc_lb_v1_ClientStats *msg, struct google_protobuf_Timestamp* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Timestamp*, UPB_SIZE(32, 32)) = value;
+}
+UPB_INLINE struct google_protobuf_Timestamp* grpc_lb_v1_ClientStats_mutable_timestamp(grpc_lb_v1_ClientStats *msg, upb_arena *arena) {
+  struct google_protobuf_Timestamp* sub = (struct google_protobuf_Timestamp*)grpc_lb_v1_ClientStats_timestamp(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Timestamp*)upb_msg_new(&google_protobuf_Timestamp_msginit, arena);
+    if (!sub) return NULL;
+    grpc_lb_v1_ClientStats_set_timestamp(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_started(grpc_lb_v1_ClientStats *msg, int64_t value) {
+  UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_finished(grpc_lb_v1_ClientStats *msg, int64_t value) {
+  UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_finished_with_client_failed_to_send(grpc_lb_v1_ClientStats *msg, int64_t value) {
+  UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_finished_known_received(grpc_lb_v1_ClientStats *msg, int64_t value) {
+  UPB_FIELD_AT(msg, int64_t, UPB_SIZE(24, 24)) = value;
+}
+UPB_INLINE grpc_lb_v1_ClientStatsPerToken** grpc_lb_v1_ClientStats_mutable_calls_finished_with_drop(grpc_lb_v1_ClientStats *msg, size_t *len) {
+  return (grpc_lb_v1_ClientStatsPerToken**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 40), len);
+}
+UPB_INLINE grpc_lb_v1_ClientStatsPerToken** grpc_lb_v1_ClientStats_resize_calls_finished_with_drop(grpc_lb_v1_ClientStats *msg, size_t len, upb_arena *arena) {
+  return (grpc_lb_v1_ClientStatsPerToken**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_lb_v1_ClientStatsPerToken* grpc_lb_v1_ClientStats_add_calls_finished_with_drop(grpc_lb_v1_ClientStats *msg, upb_arena *arena) {
+  struct grpc_lb_v1_ClientStatsPerToken* sub = (struct grpc_lb_v1_ClientStatsPerToken*)upb_msg_new(&grpc_lb_v1_ClientStatsPerToken_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(36, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* grpc.lb.v1.LoadBalanceResponse */
+
+UPB_INLINE grpc_lb_v1_LoadBalanceResponse *grpc_lb_v1_LoadBalanceResponse_new(upb_arena *arena) {
+  return (grpc_lb_v1_LoadBalanceResponse *)upb_msg_new(&grpc_lb_v1_LoadBalanceResponse_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_LoadBalanceResponse *grpc_lb_v1_LoadBalanceResponse_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_LoadBalanceResponse *ret = grpc_lb_v1_LoadBalanceResponse_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_LoadBalanceResponse_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_LoadBalanceResponse_serialize(const grpc_lb_v1_LoadBalanceResponse *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_LoadBalanceResponse_msginit, arena, len);
+}
+
+typedef enum {
+  grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_initial_response = 1,
+  grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_server_list = 2,
+  grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_NOT_SET = 0
+} grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_oneofcases;
+UPB_INLINE grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_oneofcases grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_case(const grpc_lb_v1_LoadBalanceResponse* msg) { return (grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
+
+UPB_INLINE bool grpc_lb_v1_LoadBalanceResponse_has_initial_response(const grpc_lb_v1_LoadBalanceResponse *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
+UPB_INLINE const grpc_lb_v1_InitialLoadBalanceResponse* grpc_lb_v1_LoadBalanceResponse_initial_response(const grpc_lb_v1_LoadBalanceResponse *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_InitialLoadBalanceResponse*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
+UPB_INLINE bool grpc_lb_v1_LoadBalanceResponse_has_server_list(const grpc_lb_v1_LoadBalanceResponse *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); }
+UPB_INLINE const grpc_lb_v1_ServerList* grpc_lb_v1_LoadBalanceResponse_server_list(const grpc_lb_v1_LoadBalanceResponse *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_ServerList*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); }
+
+UPB_INLINE void grpc_lb_v1_LoadBalanceResponse_set_initial_response(grpc_lb_v1_LoadBalanceResponse *msg, grpc_lb_v1_InitialLoadBalanceResponse* value) {
+  UPB_WRITE_ONEOF(msg, grpc_lb_v1_InitialLoadBalanceResponse*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1);
+}
+UPB_INLINE struct grpc_lb_v1_InitialLoadBalanceResponse* grpc_lb_v1_LoadBalanceResponse_mutable_initial_response(grpc_lb_v1_LoadBalanceResponse *msg, upb_arena *arena) {
+  struct grpc_lb_v1_InitialLoadBalanceResponse* sub = (struct grpc_lb_v1_InitialLoadBalanceResponse*)grpc_lb_v1_LoadBalanceResponse_initial_response(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_lb_v1_InitialLoadBalanceResponse*)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena);
+    if (!sub) return NULL;
+    grpc_lb_v1_LoadBalanceResponse_set_initial_response(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void grpc_lb_v1_LoadBalanceResponse_set_server_list(grpc_lb_v1_LoadBalanceResponse *msg, grpc_lb_v1_ServerList* value) {
+  UPB_WRITE_ONEOF(msg, grpc_lb_v1_ServerList*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2);
+}
+UPB_INLINE struct grpc_lb_v1_ServerList* grpc_lb_v1_LoadBalanceResponse_mutable_server_list(grpc_lb_v1_LoadBalanceResponse *msg, upb_arena *arena) {
+  struct grpc_lb_v1_ServerList* sub = (struct grpc_lb_v1_ServerList*)grpc_lb_v1_LoadBalanceResponse_server_list(msg);
+  if (sub == NULL) {
+    sub = (struct grpc_lb_v1_ServerList*)upb_msg_new(&grpc_lb_v1_ServerList_msginit, arena);
+    if (!sub) return NULL;
+    grpc_lb_v1_LoadBalanceResponse_set_server_list(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.lb.v1.InitialLoadBalanceResponse */
+
+UPB_INLINE grpc_lb_v1_InitialLoadBalanceResponse *grpc_lb_v1_InitialLoadBalanceResponse_new(upb_arena *arena) {
+  return (grpc_lb_v1_InitialLoadBalanceResponse *)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_InitialLoadBalanceResponse *grpc_lb_v1_InitialLoadBalanceResponse_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_InitialLoadBalanceResponse *ret = grpc_lb_v1_InitialLoadBalanceResponse_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_InitialLoadBalanceResponse_serialize(const grpc_lb_v1_InitialLoadBalanceResponse *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate(const grpc_lb_v1_InitialLoadBalanceResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); }
+UPB_INLINE const struct google_protobuf_Duration* grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval(const grpc_lb_v1_InitialLoadBalanceResponse *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); }
+
+UPB_INLINE void grpc_lb_v1_InitialLoadBalanceResponse_set_load_balancer_delegate(grpc_lb_v1_InitialLoadBalanceResponse *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_lb_v1_InitialLoadBalanceResponse_set_client_stats_report_interval(grpc_lb_v1_InitialLoadBalanceResponse *msg, struct google_protobuf_Duration* value) {
+  UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value;
+}
+UPB_INLINE struct google_protobuf_Duration* grpc_lb_v1_InitialLoadBalanceResponse_mutable_client_stats_report_interval(grpc_lb_v1_InitialLoadBalanceResponse *msg, upb_arena *arena) {
+  struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena);
+    if (!sub) return NULL;
+    grpc_lb_v1_InitialLoadBalanceResponse_set_client_stats_report_interval(msg, sub);
+  }
+  return sub;
+}
+
+/* grpc.lb.v1.ServerList */
+
+UPB_INLINE grpc_lb_v1_ServerList *grpc_lb_v1_ServerList_new(upb_arena *arena) {
+  return (grpc_lb_v1_ServerList *)upb_msg_new(&grpc_lb_v1_ServerList_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_ServerList *grpc_lb_v1_ServerList_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_ServerList *ret = grpc_lb_v1_ServerList_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_ServerList_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_ServerList_serialize(const grpc_lb_v1_ServerList *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_ServerList_msginit, arena, len);
+}
+
+UPB_INLINE const grpc_lb_v1_Server* const* grpc_lb_v1_ServerList_servers(const grpc_lb_v1_ServerList *msg, size_t *len) { return (const grpc_lb_v1_Server* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE grpc_lb_v1_Server** grpc_lb_v1_ServerList_mutable_servers(grpc_lb_v1_ServerList *msg, size_t *len) {
+  return (grpc_lb_v1_Server**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE grpc_lb_v1_Server** grpc_lb_v1_ServerList_resize_servers(grpc_lb_v1_ServerList *msg, size_t len, upb_arena *arena) {
+  return (grpc_lb_v1_Server**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct grpc_lb_v1_Server* grpc_lb_v1_ServerList_add_servers(grpc_lb_v1_ServerList *msg, upb_arena *arena) {
+  struct grpc_lb_v1_Server* sub = (struct grpc_lb_v1_Server*)upb_msg_new(&grpc_lb_v1_Server_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* grpc.lb.v1.Server */
+
+UPB_INLINE grpc_lb_v1_Server *grpc_lb_v1_Server_new(upb_arena *arena) {
+  return (grpc_lb_v1_Server *)upb_msg_new(&grpc_lb_v1_Server_msginit, arena);
+}
+UPB_INLINE grpc_lb_v1_Server *grpc_lb_v1_Server_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  grpc_lb_v1_Server *ret = grpc_lb_v1_Server_new(arena);
+  return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_Server_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *grpc_lb_v1_Server_serialize(const grpc_lb_v1_Server *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &grpc_lb_v1_Server_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview grpc_lb_v1_Server_ip_address(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE int32_t grpc_lb_v1_Server_port(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); }
+UPB_INLINE upb_strview grpc_lb_v1_Server_load_balance_token(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)); }
+UPB_INLINE bool grpc_lb_v1_Server_drop(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); }
+
+UPB_INLINE void grpc_lb_v1_Server_set_ip_address(grpc_lb_v1_Server *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void grpc_lb_v1_Server_set_port(grpc_lb_v1_Server *msg, int32_t value) {
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void grpc_lb_v1_Server_set_load_balance_token(grpc_lb_v1_Server *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)) = value;
+}
+UPB_INLINE void grpc_lb_v1_Server_set_drop(grpc_lb_v1_Server *msg, bool value) {
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* SRC_PROTO_GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c
new file mode 100644 (file)
index 0000000..05a1c80
--- /dev/null
@@ -0,0 +1,58 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     udpa/data/orca/v1/orca_load_report.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "udpa/data/orca/v1/orca_load_report.upb.h"
+#include "validate/validate.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const udpa_data_orca_v1_OrcaLoadReport_submsgs[2] = {
+  &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit,
+  &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit,
+};
+
+static const upb_msglayout_field udpa_data_orca_v1_OrcaLoadReport__fields[5] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 1, 1},
+  {2, UPB_SIZE(8, 8), 0, 0, 1, 1},
+  {3, UPB_SIZE(16, 16), 0, 0, 4, 1},
+  {4, UPB_SIZE(24, 24), 0, 0, 11, 3},
+  {5, UPB_SIZE(28, 32), 0, 1, 11, 3},
+};
+
+const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_msginit = {
+  &udpa_data_orca_v1_OrcaLoadReport_submsgs[0],
+  &udpa_data_orca_v1_OrcaLoadReport__fields[0],
+  UPB_SIZE(32, 40), 5, false,
+};
+
+static const upb_msglayout_field udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry__fields[2] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 9, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 1, 1},
+};
+
+const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit = {
+  NULL,
+  &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout_field udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry__fields[2] = {
+  {1, UPB_SIZE(8, 8), 0, 0, 9, 1},
+  {2, UPB_SIZE(0, 0), 0, 0, 1, 1},
+};
+
+const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit = {
+  NULL,
+  &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h b/legacy-libs/grpc/deps/grpc/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h
new file mode 100644 (file)
index 0000000..279578b
--- /dev/null
@@ -0,0 +1,144 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     udpa/data/orca/v1/orca_load_report.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef UDPA_DATA_ORCA_V1_ORCA_LOAD_REPORT_PROTO_UPB_H_
+#define UDPA_DATA_ORCA_V1_ORCA_LOAD_REPORT_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct udpa_data_orca_v1_OrcaLoadReport;
+struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry;
+struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry;
+typedef struct udpa_data_orca_v1_OrcaLoadReport udpa_data_orca_v1_OrcaLoadReport;
+typedef struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry;
+typedef struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry;
+extern const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_msginit;
+extern const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit;
+extern const upb_msglayout udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit;
+
+
+/* udpa.data.orca.v1.OrcaLoadReport */
+
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport *udpa_data_orca_v1_OrcaLoadReport_new(upb_arena *arena) {
+  return (udpa_data_orca_v1_OrcaLoadReport *)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_msginit, arena);
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport *udpa_data_orca_v1_OrcaLoadReport_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  udpa_data_orca_v1_OrcaLoadReport *ret = udpa_data_orca_v1_OrcaLoadReport_new(arena);
+  return (ret && upb_decode(buf, size, ret, &udpa_data_orca_v1_OrcaLoadReport_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *udpa_data_orca_v1_OrcaLoadReport_serialize(const udpa_data_orca_v1_OrcaLoadReport *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &udpa_data_orca_v1_OrcaLoadReport_msginit, arena, len);
+}
+
+UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_cpu_utilization(const udpa_data_orca_v1_OrcaLoadReport *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); }
+UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_mem_utilization(const udpa_data_orca_v1_OrcaLoadReport *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)); }
+UPB_INLINE uint64_t udpa_data_orca_v1_OrcaLoadReport_rps(const udpa_data_orca_v1_OrcaLoadReport *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)); }
+UPB_INLINE const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* const* udpa_data_orca_v1_OrcaLoadReport_request_cost(const udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) { return (const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* const*)_upb_array_accessor(msg, UPB_SIZE(24, 24), len); }
+UPB_INLINE const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* const* udpa_data_orca_v1_OrcaLoadReport_utilization(const udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) { return (const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); }
+
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_set_cpu_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, double value) {
+  UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
+}
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_set_mem_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, double value) {
+  UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_set_rps(udpa_data_orca_v1_OrcaLoadReport *msg, uint64_t value) {
+  UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry** udpa_data_orca_v1_OrcaLoadReport_mutable_request_cost(udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) {
+  return (udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 24), len);
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry** udpa_data_orca_v1_OrcaLoadReport_resize_request_cost(udpa_data_orca_v1_OrcaLoadReport *msg, size_t len, upb_arena *arena) {
+  return (udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* udpa_data_orca_v1_OrcaLoadReport_add_request_cost(udpa_data_orca_v1_OrcaLoadReport *msg, upb_arena *arena) {
+  struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry* sub = (struct udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry*)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(24, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry** udpa_data_orca_v1_OrcaLoadReport_mutable_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, size_t *len) {
+  return (udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len);
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry** udpa_data_orca_v1_OrcaLoadReport_resize_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, size_t len, upb_arena *arena) {
+  return (udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* udpa_data_orca_v1_OrcaLoadReport_add_utilization(udpa_data_orca_v1_OrcaLoadReport *msg, upb_arena *arena) {
+  struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry* sub = (struct udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry*)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* udpa.data.orca.v1.OrcaLoadReport.RequestCostEntry */
+
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_new(upb_arena *arena) {
+  return (udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena);
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *ret = udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_serialize(const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_key(const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_value(const udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_set_key(udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_set_value(udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry *msg, double value) {
+  UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
+}
+
+/* udpa.data.orca.v1.OrcaLoadReport.UtilizationEntry */
+
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_new(upb_arena *arena) {
+  return (udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *)upb_msg_new(&udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena);
+}
+UPB_INLINE udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *ret = udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_new(arena);
+  return (ret && upb_decode(buf, size, ret, &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_serialize(const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_msginit, arena, len);
+}
+
+UPB_INLINE upb_strview udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_key(const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE double udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_value(const udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)); }
+
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_set_key(udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg, upb_strview value) {
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_set_value(udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry *msg, double value) {
+  UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* UDPA_DATA_ORCA_V1_ORCA_LOAD_REPORT_PROTO_UPB_H_ */
index c28ac41..cac68a3 100644 (file)
 #define VALIDATE_VALIDATE_PROTO_UPB_H_
 
 #include "upb/generated_util.h"
-
 #include "upb/msg.h"
-
 #include "upb/decode.h"
 #include "upb/encode.h"
+
 #include "upb/port_def.inc"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -94,17 +94,16 @@ struct google_protobuf_Timestamp;
 extern const upb_msglayout google_protobuf_Duration_msginit;
 extern const upb_msglayout google_protobuf_Timestamp_msginit;
 
-/* Enums */
-
 
 /* validate.FieldRules */
 
 UPB_INLINE validate_FieldRules *validate_FieldRules_new(upb_arena *arena) {
   return (validate_FieldRules *)upb_msg_new(&validate_FieldRules_msginit, arena);
 }
-UPB_INLINE validate_FieldRules *validate_FieldRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_FieldRules *validate_FieldRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_FieldRules *ret = validate_FieldRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_FieldRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_FieldRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_FieldRules_serialize(const validate_FieldRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_FieldRules_msginit, arena, len);
@@ -133,9 +132,9 @@ typedef enum {
   validate_FieldRules_type_any = 20,
   validate_FieldRules_type_duration = 21,
   validate_FieldRules_type_timestamp = 22,
-  validate_FieldRules_type_NOT_SET = 0,
+  validate_FieldRules_type_NOT_SET = 0
 } validate_FieldRules_type_oneofcases;
-UPB_INLINE validate_FieldRules_type_oneofcases validate_FieldRules_type_case(const validate_FieldRules* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); }
+UPB_INLINE validate_FieldRules_type_oneofcases validate_FieldRules_type_case(const validate_FieldRules* msg) { return (validate_FieldRules_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); }
 
 UPB_INLINE bool validate_FieldRules_has_float(const validate_FieldRules *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); }
 UPB_INLINE const validate_FloatRules* validate_FieldRules_float(const validate_FieldRules *msg) { return UPB_READ_ONEOF(msg, const validate_FloatRules*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); }
@@ -447,15 +446,15 @@ UPB_INLINE struct validate_TimestampRules* validate_FieldRules_mutable_timestamp
   return sub;
 }
 
-
 /* validate.FloatRules */
 
 UPB_INLINE validate_FloatRules *validate_FloatRules_new(upb_arena *arena) {
   return (validate_FloatRules *)upb_msg_new(&validate_FloatRules_msginit, arena);
 }
-UPB_INLINE validate_FloatRules *validate_FloatRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_FloatRules *validate_FloatRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_FloatRules *ret = validate_FloatRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_FloatRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_FloatRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_FloatRules_serialize(const validate_FloatRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_FloatRules_msginit, arena, len);
@@ -515,15 +514,15 @@ UPB_INLINE bool validate_FloatRules_add_not_in(validate_FloatRules *msg, float v
       msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_FLOAT, &val, arena);
 }
 
-
 /* validate.DoubleRules */
 
 UPB_INLINE validate_DoubleRules *validate_DoubleRules_new(upb_arena *arena) {
   return (validate_DoubleRules *)upb_msg_new(&validate_DoubleRules_msginit, arena);
 }
-UPB_INLINE validate_DoubleRules *validate_DoubleRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_DoubleRules *validate_DoubleRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_DoubleRules *ret = validate_DoubleRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_DoubleRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_DoubleRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_DoubleRules_serialize(const validate_DoubleRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_DoubleRules_msginit, arena, len);
@@ -583,15 +582,15 @@ UPB_INLINE bool validate_DoubleRules_add_not_in(validate_DoubleRules *msg, doubl
       msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_DOUBLE, &val, arena);
 }
 
-
 /* validate.Int32Rules */
 
 UPB_INLINE validate_Int32Rules *validate_Int32Rules_new(upb_arena *arena) {
   return (validate_Int32Rules *)upb_msg_new(&validate_Int32Rules_msginit, arena);
 }
-UPB_INLINE validate_Int32Rules *validate_Int32Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_Int32Rules *validate_Int32Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_Int32Rules *ret = validate_Int32Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_Int32Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_Int32Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_Int32Rules_serialize(const validate_Int32Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_Int32Rules_msginit, arena, len);
@@ -651,15 +650,15 @@ UPB_INLINE bool validate_Int32Rules_add_not_in(validate_Int32Rules *msg, int32_t
       msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
 }
 
-
 /* validate.Int64Rules */
 
 UPB_INLINE validate_Int64Rules *validate_Int64Rules_new(upb_arena *arena) {
   return (validate_Int64Rules *)upb_msg_new(&validate_Int64Rules_msginit, arena);
 }
-UPB_INLINE validate_Int64Rules *validate_Int64Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_Int64Rules *validate_Int64Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_Int64Rules *ret = validate_Int64Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_Int64Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_Int64Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_Int64Rules_serialize(const validate_Int64Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_Int64Rules_msginit, arena, len);
@@ -719,15 +718,15 @@ UPB_INLINE bool validate_Int64Rules_add_not_in(validate_Int64Rules *msg, int64_t
       msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_INT64, &val, arena);
 }
 
-
 /* validate.UInt32Rules */
 
 UPB_INLINE validate_UInt32Rules *validate_UInt32Rules_new(upb_arena *arena) {
   return (validate_UInt32Rules *)upb_msg_new(&validate_UInt32Rules_msginit, arena);
 }
-UPB_INLINE validate_UInt32Rules *validate_UInt32Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_UInt32Rules *validate_UInt32Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_UInt32Rules *ret = validate_UInt32Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_UInt32Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_UInt32Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_UInt32Rules_serialize(const validate_UInt32Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_UInt32Rules_msginit, arena, len);
@@ -787,15 +786,15 @@ UPB_INLINE bool validate_UInt32Rules_add_not_in(validate_UInt32Rules *msg, uint3
       msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_UINT32, &val, arena);
 }
 
-
 /* validate.UInt64Rules */
 
 UPB_INLINE validate_UInt64Rules *validate_UInt64Rules_new(upb_arena *arena) {
   return (validate_UInt64Rules *)upb_msg_new(&validate_UInt64Rules_msginit, arena);
 }
-UPB_INLINE validate_UInt64Rules *validate_UInt64Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_UInt64Rules *validate_UInt64Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_UInt64Rules *ret = validate_UInt64Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_UInt64Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_UInt64Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_UInt64Rules_serialize(const validate_UInt64Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_UInt64Rules_msginit, arena, len);
@@ -855,15 +854,15 @@ UPB_INLINE bool validate_UInt64Rules_add_not_in(validate_UInt64Rules *msg, uint6
       msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_UINT64, &val, arena);
 }
 
-
 /* validate.SInt32Rules */
 
 UPB_INLINE validate_SInt32Rules *validate_SInt32Rules_new(upb_arena *arena) {
   return (validate_SInt32Rules *)upb_msg_new(&validate_SInt32Rules_msginit, arena);
 }
-UPB_INLINE validate_SInt32Rules *validate_SInt32Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_SInt32Rules *validate_SInt32Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_SInt32Rules *ret = validate_SInt32Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_SInt32Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_SInt32Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_SInt32Rules_serialize(const validate_SInt32Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_SInt32Rules_msginit, arena, len);
@@ -923,15 +922,15 @@ UPB_INLINE bool validate_SInt32Rules_add_not_in(validate_SInt32Rules *msg, int32
       msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
 }
 
-
 /* validate.SInt64Rules */
 
 UPB_INLINE validate_SInt64Rules *validate_SInt64Rules_new(upb_arena *arena) {
   return (validate_SInt64Rules *)upb_msg_new(&validate_SInt64Rules_msginit, arena);
 }
-UPB_INLINE validate_SInt64Rules *validate_SInt64Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_SInt64Rules *validate_SInt64Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_SInt64Rules *ret = validate_SInt64Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_SInt64Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_SInt64Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_SInt64Rules_serialize(const validate_SInt64Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_SInt64Rules_msginit, arena, len);
@@ -991,15 +990,15 @@ UPB_INLINE bool validate_SInt64Rules_add_not_in(validate_SInt64Rules *msg, int64
       msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_INT64, &val, arena);
 }
 
-
 /* validate.Fixed32Rules */
 
 UPB_INLINE validate_Fixed32Rules *validate_Fixed32Rules_new(upb_arena *arena) {
   return (validate_Fixed32Rules *)upb_msg_new(&validate_Fixed32Rules_msginit, arena);
 }
-UPB_INLINE validate_Fixed32Rules *validate_Fixed32Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_Fixed32Rules *validate_Fixed32Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_Fixed32Rules *ret = validate_Fixed32Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_Fixed32Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_Fixed32Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_Fixed32Rules_serialize(const validate_Fixed32Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_Fixed32Rules_msginit, arena, len);
@@ -1059,15 +1058,15 @@ UPB_INLINE bool validate_Fixed32Rules_add_not_in(validate_Fixed32Rules *msg, uin
       msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_UINT32, &val, arena);
 }
 
-
 /* validate.Fixed64Rules */
 
 UPB_INLINE validate_Fixed64Rules *validate_Fixed64Rules_new(upb_arena *arena) {
   return (validate_Fixed64Rules *)upb_msg_new(&validate_Fixed64Rules_msginit, arena);
 }
-UPB_INLINE validate_Fixed64Rules *validate_Fixed64Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_Fixed64Rules *validate_Fixed64Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_Fixed64Rules *ret = validate_Fixed64Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_Fixed64Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_Fixed64Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_Fixed64Rules_serialize(const validate_Fixed64Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_Fixed64Rules_msginit, arena, len);
@@ -1127,15 +1126,15 @@ UPB_INLINE bool validate_Fixed64Rules_add_not_in(validate_Fixed64Rules *msg, uin
       msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_UINT64, &val, arena);
 }
 
-
 /* validate.SFixed32Rules */
 
 UPB_INLINE validate_SFixed32Rules *validate_SFixed32Rules_new(upb_arena *arena) {
   return (validate_SFixed32Rules *)upb_msg_new(&validate_SFixed32Rules_msginit, arena);
 }
-UPB_INLINE validate_SFixed32Rules *validate_SFixed32Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_SFixed32Rules *validate_SFixed32Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_SFixed32Rules *ret = validate_SFixed32Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_SFixed32Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_SFixed32Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_SFixed32Rules_serialize(const validate_SFixed32Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_SFixed32Rules_msginit, arena, len);
@@ -1195,15 +1194,15 @@ UPB_INLINE bool validate_SFixed32Rules_add_not_in(validate_SFixed32Rules *msg, i
       msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
 }
 
-
 /* validate.SFixed64Rules */
 
 UPB_INLINE validate_SFixed64Rules *validate_SFixed64Rules_new(upb_arena *arena) {
   return (validate_SFixed64Rules *)upb_msg_new(&validate_SFixed64Rules_msginit, arena);
 }
-UPB_INLINE validate_SFixed64Rules *validate_SFixed64Rules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_SFixed64Rules *validate_SFixed64Rules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_SFixed64Rules *ret = validate_SFixed64Rules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_SFixed64Rules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_SFixed64Rules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_SFixed64Rules_serialize(const validate_SFixed64Rules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_SFixed64Rules_msginit, arena, len);
@@ -1263,15 +1262,15 @@ UPB_INLINE bool validate_SFixed64Rules_add_not_in(validate_SFixed64Rules *msg, i
       msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_INT64, &val, arena);
 }
 
-
 /* validate.BoolRules */
 
 UPB_INLINE validate_BoolRules *validate_BoolRules_new(upb_arena *arena) {
   return (validate_BoolRules *)upb_msg_new(&validate_BoolRules_msginit, arena);
 }
-UPB_INLINE validate_BoolRules *validate_BoolRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_BoolRules *validate_BoolRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_BoolRules *ret = validate_BoolRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_BoolRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_BoolRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_BoolRules_serialize(const validate_BoolRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_BoolRules_msginit, arena, len);
@@ -1285,15 +1284,15 @@ UPB_INLINE void validate_BoolRules_set_const(validate_BoolRules *msg, bool value
   UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
 }
 
-
 /* validate.StringRules */
 
 UPB_INLINE validate_StringRules *validate_StringRules_new(upb_arena *arena) {
   return (validate_StringRules *)upb_msg_new(&validate_StringRules_msginit, arena);
 }
-UPB_INLINE validate_StringRules *validate_StringRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_StringRules *validate_StringRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_StringRules *ret = validate_StringRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_StringRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_StringRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_StringRules_serialize(const validate_StringRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_StringRules_msginit, arena, len);
@@ -1307,9 +1306,9 @@ typedef enum {
   validate_StringRules_well_known_ipv6 = 16,
   validate_StringRules_well_known_uri = 17,
   validate_StringRules_well_known_uri_ref = 18,
-  validate_StringRules_well_known_NOT_SET = 0,
+  validate_StringRules_well_known_NOT_SET = 0
 } validate_StringRules_well_known_oneofcases;
-UPB_INLINE validate_StringRules_well_known_oneofcases validate_StringRules_well_known_case(const validate_StringRules* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(108, 156)); }
+UPB_INLINE validate_StringRules_well_known_oneofcases validate_StringRules_well_known_case(const validate_StringRules* msg) { return (validate_StringRules_well_known_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(108, 156)); }
 
 UPB_INLINE bool validate_StringRules_has_const(const validate_StringRules *msg) { return _upb_has_field(msg, 7); }
 UPB_INLINE upb_strview validate_StringRules_const(const validate_StringRules *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 56)); }
@@ -1436,15 +1435,15 @@ UPB_INLINE void validate_StringRules_set_len_bytes(validate_StringRules *msg, ui
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(48, 48)) = value;
 }
 
-
 /* validate.BytesRules */
 
 UPB_INLINE validate_BytesRules *validate_BytesRules_new(upb_arena *arena) {
   return (validate_BytesRules *)upb_msg_new(&validate_BytesRules_msginit, arena);
 }
-UPB_INLINE validate_BytesRules *validate_BytesRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_BytesRules *validate_BytesRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_BytesRules *ret = validate_BytesRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_BytesRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_BytesRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_BytesRules_serialize(const validate_BytesRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_BytesRules_msginit, arena, len);
@@ -1454,9 +1453,9 @@ typedef enum {
   validate_BytesRules_well_known_ip = 10,
   validate_BytesRules_well_known_ipv4 = 11,
   validate_BytesRules_well_known_ipv6 = 12,
-  validate_BytesRules_well_known_NOT_SET = 0,
+  validate_BytesRules_well_known_NOT_SET = 0
 } validate_BytesRules_well_known_oneofcases;
-UPB_INLINE validate_BytesRules_well_known_oneofcases validate_BytesRules_well_known_case(const validate_BytesRules* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(84, 132)); }
+UPB_INLINE validate_BytesRules_well_known_oneofcases validate_BytesRules_well_known_case(const validate_BytesRules* msg) { return (validate_BytesRules_well_known_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(84, 132)); }
 
 UPB_INLINE bool validate_BytesRules_has_const(const validate_BytesRules *msg) { return _upb_has_field(msg, 4); }
 UPB_INLINE upb_strview validate_BytesRules_const(const validate_BytesRules *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); }
@@ -1545,15 +1544,15 @@ UPB_INLINE void validate_BytesRules_set_len(validate_BytesRules *msg, uint64_t v
   UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)) = value;
 }
 
-
 /* validate.EnumRules */
 
 UPB_INLINE validate_EnumRules *validate_EnumRules_new(upb_arena *arena) {
   return (validate_EnumRules *)upb_msg_new(&validate_EnumRules_msginit, arena);
 }
-UPB_INLINE validate_EnumRules *validate_EnumRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_EnumRules *validate_EnumRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_EnumRules *ret = validate_EnumRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_EnumRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_EnumRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_EnumRules_serialize(const validate_EnumRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_EnumRules_msginit, arena, len);
@@ -1595,15 +1594,15 @@ UPB_INLINE bool validate_EnumRules_add_not_in(validate_EnumRules *msg, int32_t v
       msg, UPB_SIZE(16, 24), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
 }
 
-
 /* validate.MessageRules */
 
 UPB_INLINE validate_MessageRules *validate_MessageRules_new(upb_arena *arena) {
   return (validate_MessageRules *)upb_msg_new(&validate_MessageRules_msginit, arena);
 }
-UPB_INLINE validate_MessageRules *validate_MessageRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_MessageRules *validate_MessageRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_MessageRules *ret = validate_MessageRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_MessageRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_MessageRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_MessageRules_serialize(const validate_MessageRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_MessageRules_msginit, arena, len);
@@ -1623,15 +1622,15 @@ UPB_INLINE void validate_MessageRules_set_required(validate_MessageRules *msg, b
   UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
 }
 
-
 /* validate.RepeatedRules */
 
 UPB_INLINE validate_RepeatedRules *validate_RepeatedRules_new(upb_arena *arena) {
   return (validate_RepeatedRules *)upb_msg_new(&validate_RepeatedRules_msginit, arena);
 }
-UPB_INLINE validate_RepeatedRules *validate_RepeatedRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_RepeatedRules *validate_RepeatedRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_RepeatedRules *ret = validate_RepeatedRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_RepeatedRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_RepeatedRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_RepeatedRules_serialize(const validate_RepeatedRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_RepeatedRules_msginit, arena, len);
@@ -1672,15 +1671,15 @@ UPB_INLINE struct validate_FieldRules* validate_RepeatedRules_mutable_items(vali
   return sub;
 }
 
-
 /* validate.MapRules */
 
 UPB_INLINE validate_MapRules *validate_MapRules_new(upb_arena *arena) {
   return (validate_MapRules *)upb_msg_new(&validate_MapRules_msginit, arena);
 }
-UPB_INLINE validate_MapRules *validate_MapRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_MapRules *validate_MapRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_MapRules *ret = validate_MapRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_MapRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_MapRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_MapRules_serialize(const validate_MapRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_MapRules_msginit, arena, len);
@@ -1736,15 +1735,15 @@ UPB_INLINE struct validate_FieldRules* validate_MapRules_mutable_values(validate
   return sub;
 }
 
-
 /* validate.AnyRules */
 
 UPB_INLINE validate_AnyRules *validate_AnyRules_new(upb_arena *arena) {
   return (validate_AnyRules *)upb_msg_new(&validate_AnyRules_msginit, arena);
 }
-UPB_INLINE validate_AnyRules *validate_AnyRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_AnyRules *validate_AnyRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_AnyRules *ret = validate_AnyRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_AnyRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_AnyRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_AnyRules_serialize(const validate_AnyRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_AnyRules_msginit, arena, len);
@@ -1780,15 +1779,15 @@ UPB_INLINE bool validate_AnyRules_add_not_in(validate_AnyRules *msg, upb_strview
       msg, UPB_SIZE(8, 16), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
 }
 
-
 /* validate.DurationRules */
 
 UPB_INLINE validate_DurationRules *validate_DurationRules_new(upb_arena *arena) {
   return (validate_DurationRules *)upb_msg_new(&validate_DurationRules_msginit, arena);
 }
-UPB_INLINE validate_DurationRules *validate_DurationRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_DurationRules *validate_DurationRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_DurationRules *ret = validate_DurationRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_DurationRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_DurationRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_DurationRules_serialize(const validate_DurationRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_DurationRules_msginit, arena, len);
@@ -1905,15 +1904,15 @@ UPB_INLINE struct google_protobuf_Duration* validate_DurationRules_add_not_in(va
   return sub;
 }
 
-
 /* validate.TimestampRules */
 
 UPB_INLINE validate_TimestampRules *validate_TimestampRules_new(upb_arena *arena) {
   return (validate_TimestampRules *)upb_msg_new(&validate_TimestampRules_msginit, arena);
 }
-UPB_INLINE validate_TimestampRules *validate_TimestampRules_parsenew(upb_strview buf, upb_arena *arena) {
+UPB_INLINE validate_TimestampRules *validate_TimestampRules_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
   validate_TimestampRules *ret = validate_TimestampRules_new(arena);
-  return (ret && upb_decode(buf, ret, &validate_TimestampRules_msginit)) ? ret : NULL;
+  return (ret && upb_decode(buf, size, ret, &validate_TimestampRules_msginit, arena)) ? ret : NULL;
 }
 UPB_INLINE char *validate_TimestampRules_serialize(const validate_TimestampRules *msg, upb_arena *arena, size_t *len) {
   return upb_encode(msg, &validate_TimestampRules_msginit, arena, len);
@@ -2029,7 +2028,6 @@ UPB_INLINE struct google_protobuf_Duration* validate_TimestampRules_mutable_with
   return sub;
 }
 
-
 #ifdef __cplusplus
 }  /* extern "C" */
 #endif
index a35db18..60248f9 100644 (file)
@@ -214,6 +214,8 @@ void grpc_channel_args_destroy(grpc_channel_args* a) {
 
 int grpc_channel_args_compare(const grpc_channel_args* a,
                               const grpc_channel_args* b) {
+  if (a == nullptr && b == nullptr) return 0;
+  if (a == nullptr || b == nullptr) return a == nullptr ? -1 : 1;
   int c = GPR_ICMP(a->num_args, b->num_args);
   if (c != 0) return c;
   for (size_t i = 0; i < a->num_args; i++) {
@@ -255,6 +257,13 @@ int grpc_channel_arg_get_integer(const grpc_arg* arg,
   return arg->value.integer;
 }
 
+int grpc_channel_args_find_integer(const grpc_channel_args* args,
+                                   const char* name,
+                                   const grpc_integer_options options) {
+  const grpc_arg* arg = grpc_channel_args_find(args, name);
+  return grpc_channel_arg_get_integer(arg, options);
+}
+
 char* grpc_channel_arg_get_string(const grpc_arg* arg) {
   if (arg == nullptr) return nullptr;
   if (arg->type != GRPC_ARG_STRING) {
@@ -264,6 +273,12 @@ char* grpc_channel_arg_get_string(const grpc_arg* arg) {
   return arg->value.string;
 }
 
+char* grpc_channel_args_find_string(const grpc_channel_args* args,
+                                    const char* name) {
+  const grpc_arg* arg = grpc_channel_args_find(args, name);
+  return grpc_channel_arg_get_string(arg);
+}
+
 bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) {
   if (arg == nullptr) return default_value;
   if (arg->type != GRPC_ARG_INTEGER) {
@@ -282,6 +297,12 @@ bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) {
   }
 }
 
+bool grpc_channel_args_find_bool(const grpc_channel_args* args,
+                                 const char* name, bool default_value) {
+  const grpc_arg* arg = grpc_channel_args_find(args, name);
+  return grpc_channel_arg_get_bool(arg, default_value);
+}
+
 bool grpc_channel_args_want_minimal_stack(const grpc_channel_args* args) {
   return grpc_channel_arg_get_bool(
       grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK), false);
index 2b698a6..5928802 100644 (file)
@@ -73,16 +73,30 @@ typedef struct grpc_integer_options {
   int max_value;
 } grpc_integer_options;
 
-/** Returns the value of \a arg, subject to the contraints in \a options. */
+/** Returns the value of \a arg, subject to the constraints in \a options. */
 int grpc_channel_arg_get_integer(const grpc_arg* arg,
                                  const grpc_integer_options options);
+/** Similar to the above, but needs to find the arg from \a args by the name
+ * first. */
+int grpc_channel_args_find_integer(const grpc_channel_args* args,
+                                   const char* name,
+                                   const grpc_integer_options options);
 
 /** Returns the value of \a arg if \a arg is of type GRPC_ARG_STRING.
     Otherwise, emits a warning log, and returns nullptr.
     If arg is nullptr, returns nullptr, and does not emit a warning. */
 char* grpc_channel_arg_get_string(const grpc_arg* arg);
-
+/** Similar to the above, but needs to find the arg from \a args by the name
+ * first. */
+char* grpc_channel_args_find_string(const grpc_channel_args* args,
+                                    const char* name);
+/** If \a arg is of type GRPC_ARG_INTEGER, returns true if it's non-zero.
+ * Returns \a default_value if \a arg is of other types. */
 bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value);
+/** Similar to the above, but needs to find the arg from \a args by the name
+ * first. */
+bool grpc_channel_args_find_bool(const grpc_channel_args* args,
+                                 const char* name, bool default_value);
 
 // Helpers for creating channel args.
 grpc_arg grpc_channel_arg_string_create(char* name, char* value);
index a7c28d0..f7be806 100644 (file)
@@ -42,6 +42,7 @@
 #include <grpc/support/time.h>
 
 #include "src/core/lib/debug/trace.h"
+#include "src/core/lib/gpr/time_precise.h"
 #include "src/core/lib/gprpp/arena.h"
 #include "src/core/lib/iomgr/call_combiner.h"
 #include "src/core/lib/iomgr/polling_entity.h"
@@ -67,7 +68,7 @@ typedef struct {
   const void* server_transport_data;
   grpc_call_context_element* context;
   const grpc_slice& path;
-  gpr_timespec start_time;
+  gpr_cycle_counter start_time;
   grpc_millis deadline;
   grpc_core::Arena* arena;
   grpc_core::CallCombiner* call_combiner;
index 4b13037..fb913be 100644 (file)
@@ -30,9 +30,9 @@
 
 #include "src/core/lib/channel/channelz_registry.h"
 #include "src/core/lib/channel/status_util.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
@@ -85,7 +85,8 @@ intptr_t GetParentUuidFromArgs(const grpc_channel_args& args) {
 // BaseNode
 //
 
-BaseNode::BaseNode(EntityType type) : type_(type), uuid_(-1) {
+BaseNode::BaseNode(EntityType type, UniquePtr<char> name)
+    : type_(type), uuid_(-1), name_(std::move(name)) {
   // The registry will set uuid_ under its lock.
   ChannelzRegistry::Register(this);
 }
@@ -106,51 +107,45 @@ char* BaseNode::RenderJsonString() {
 
 CallCountingHelper::CallCountingHelper() {
   num_cores_ = GPR_MAX(1, gpr_cpu_num_cores());
-  per_cpu_counter_data_storage_ = static_cast<AtomicCounterData*>(
-      gpr_zalloc(sizeof(AtomicCounterData) * num_cores_));
-}
-
-CallCountingHelper::~CallCountingHelper() {
-  gpr_free(per_cpu_counter_data_storage_);
+  per_cpu_counter_data_storage_.reserve(num_cores_);
+  for (size_t i = 0; i < num_cores_; ++i) {
+    per_cpu_counter_data_storage_.emplace_back();
+  }
 }
 
 void CallCountingHelper::RecordCallStarted() {
-  gpr_atm_no_barrier_fetch_add(
-      &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
-           .calls_started,
-      static_cast<gpr_atm>(1));
-  gpr_atm_no_barrier_store(
-      &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
-           .last_call_started_millis,
-      (gpr_atm)ExecCtx::Get()->Now());
+  AtomicCounterData& data =
+      per_cpu_counter_data_storage_[ExecCtx::Get()->starting_cpu()];
+  data.calls_started.FetchAdd(1, MemoryOrder::RELAXED);
+  data.last_call_started_cycle.Store(gpr_get_cycle_counter(),
+                                     MemoryOrder::RELAXED);
 }
 
 void CallCountingHelper::RecordCallFailed() {
-  gpr_atm_no_barrier_fetch_add(
-      &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
-           .calls_failed,
-      static_cast<gpr_atm>(1));
+  per_cpu_counter_data_storage_[ExecCtx::Get()->starting_cpu()]
+      .calls_failed.FetchAdd(1, MemoryOrder::RELAXED);
 }
 
 void CallCountingHelper::RecordCallSucceeded() {
-  gpr_atm_no_barrier_fetch_add(
-      &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
-           .calls_succeeded,
-      static_cast<gpr_atm>(1));
+  per_cpu_counter_data_storage_[ExecCtx::Get()->starting_cpu()]
+      .calls_succeeded.FetchAdd(1, MemoryOrder::RELAXED);
 }
 
 void CallCountingHelper::CollectData(CounterData* out) {
   for (size_t core = 0; core < num_cores_; ++core) {
-    out->calls_started += gpr_atm_no_barrier_load(
-        &per_cpu_counter_data_storage_[core].calls_started);
-    out->calls_succeeded += gpr_atm_no_barrier_load(
-        &per_cpu_counter_data_storage_[core].calls_succeeded);
-    out->calls_failed += gpr_atm_no_barrier_load(
-        &per_cpu_counter_data_storage_[core].calls_failed);
-    gpr_atm last_call = gpr_atm_no_barrier_load(
-        &per_cpu_counter_data_storage_[core].last_call_started_millis);
-    if (last_call > out->last_call_started_millis) {
-      out->last_call_started_millis = last_call;
+    AtomicCounterData& data = per_cpu_counter_data_storage_[core];
+
+    out->calls_started += data.calls_started.Load(MemoryOrder::RELAXED);
+    out->calls_succeeded +=
+        per_cpu_counter_data_storage_[core].calls_succeeded.Load(
+            MemoryOrder::RELAXED);
+    out->calls_failed += per_cpu_counter_data_storage_[core].calls_failed.Load(
+        MemoryOrder::RELAXED);
+    const gpr_cycle_counter last_call =
+        per_cpu_counter_data_storage_[core].last_call_started_cycle.Load(
+            MemoryOrder::RELAXED);
+    if (last_call > out->last_call_started_cycle) {
+      out->last_call_started_cycle = last_call;
     }
   }
 }
@@ -172,8 +167,9 @@ void CallCountingHelper::PopulateCallCounts(grpc_json* json) {
         json, json_iterator, "callsFailed", data.calls_failed);
   }
   if (data.calls_started != 0) {
-    gpr_timespec ts = grpc_millis_to_timespec(data.last_call_started_millis,
-                                              GPR_CLOCK_REALTIME);
+    gpr_timespec ts = gpr_convert_clock_type(
+        gpr_cycle_counter_to_time(data.last_call_started_cycle),
+        GPR_CLOCK_REALTIME);
     json_iterator =
         grpc_json_create_child(json_iterator, json, "lastCallStartedTimestamp",
                                gpr_format_timespec(ts), GRPC_JSON_STRING, true);
@@ -187,11 +183,29 @@ void CallCountingHelper::PopulateCallCounts(grpc_json* json) {
 ChannelNode::ChannelNode(UniquePtr<char> target,
                          size_t channel_tracer_max_nodes, intptr_t parent_uuid)
     : BaseNode(parent_uuid == 0 ? EntityType::kTopLevelChannel
-                                : EntityType::kInternalChannel),
+                                : EntityType::kInternalChannel,
+               UniquePtr<char>(gpr_strdup(target.get()))),
       target_(std::move(target)),
       trace_(channel_tracer_max_nodes),
       parent_uuid_(parent_uuid) {}
 
+const char* ChannelNode::GetChannelConnectivityStateChangeString(
+    grpc_connectivity_state state) {
+  switch (state) {
+    case GRPC_CHANNEL_IDLE:
+      return "Channel state change to IDLE";
+    case GRPC_CHANNEL_CONNECTING:
+      return "Channel state change to CONNECTING";
+    case GRPC_CHANNEL_READY:
+      return "Channel state change to READY";
+    case GRPC_CHANNEL_TRANSIENT_FAILURE:
+      return "Channel state change to TRANSIENT_FAILURE";
+    case GRPC_CHANNEL_SHUTDOWN:
+      return "Channel state change to SHUTDOWN";
+  }
+  GPR_UNREACHABLE_CODE(return "UNKNOWN");
+}
+
 grpc_json* ChannelNode::RenderJson() {
   // We need to track these three json objects to build our object
   grpc_json* top_level_json = grpc_json_create(GRPC_JSON_OBJECT);
@@ -303,37 +317,57 @@ void ChannelNode::RemoveChildSubchannel(intptr_t child_uuid) {
 //
 
 ServerNode::ServerNode(grpc_server* server, size_t channel_tracer_max_nodes)
-    : BaseNode(EntityType::kServer),
-      server_(server),
+    : BaseNode(EntityType::kServer, /* name */ nullptr),
       trace_(channel_tracer_max_nodes) {}
 
 ServerNode::~ServerNode() {}
 
+void ServerNode::AddChildSocket(RefCountedPtr<SocketNode> node) {
+  MutexLock lock(&child_mu_);
+  child_sockets_.insert(MakePair(node->uuid(), std::move(node)));
+}
+
+void ServerNode::RemoveChildSocket(intptr_t child_uuid) {
+  MutexLock lock(&child_mu_);
+  child_sockets_.erase(child_uuid);
+}
+
+void ServerNode::AddChildListenSocket(RefCountedPtr<ListenSocketNode> node) {
+  MutexLock lock(&child_mu_);
+  child_listen_sockets_.insert(MakePair(node->uuid(), std::move(node)));
+}
+
+void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) {
+  MutexLock lock(&child_mu_);
+  child_listen_sockets_.erase(child_uuid);
+}
+
 char* ServerNode::RenderServerSockets(intptr_t start_socket_id,
                                       intptr_t max_results) {
-  // if user does not set max_results, we choose 500.
+  // If user does not set max_results, we choose 500.
   size_t pagination_limit = max_results == 0 ? 500 : max_results;
   grpc_json* top_level_json = grpc_json_create(GRPC_JSON_OBJECT);
   grpc_json* json = top_level_json;
   grpc_json* json_iterator = nullptr;
-  ChildSocketsList socket_refs;
-  grpc_server_populate_server_sockets(server_, &socket_refs, start_socket_id);
-  // declared early so it can be used outside of the loop.
-  size_t i = 0;
-  if (!socket_refs.empty()) {
-    // create list of socket refs
+  MutexLock lock(&child_mu_);
+  size_t sockets_rendered = 0;
+  if (!child_sockets_.empty()) {
+    // Create list of socket refs
     grpc_json* array_parent = grpc_json_create_child(
         nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false);
-    for (i = 0; i < GPR_MIN(socket_refs.size(), pagination_limit); ++i) {
+    const size_t limit = GPR_MIN(child_sockets_.size(), pagination_limit);
+    for (auto it = child_sockets_.lower_bound(start_socket_id);
+         it != child_sockets_.end() && sockets_rendered < limit;
+         ++it, ++sockets_rendered) {
       grpc_json* socket_ref_json = grpc_json_create_child(
           nullptr, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false);
       json_iterator = grpc_json_add_number_string_child(
-          socket_ref_json, nullptr, "socketId", socket_refs[i]->uuid());
+          socket_ref_json, nullptr, "socketId", it->first);
       grpc_json_create_child(json_iterator, socket_ref_json, "name",
-                             socket_refs[i]->remote(), GRPC_JSON_STRING, false);
+                             it->second->name(), GRPC_JSON_STRING, false);
     }
   }
-  if (i == socket_refs.size()) {
+  if (sockets_rendered == child_sockets_.size()) {
     json_iterator = grpc_json_create_child(nullptr, json, "end", nullptr,
                                            GRPC_JSON_TRUE, false);
   }
@@ -371,17 +405,19 @@ grpc_json* ServerNode::RenderJson() {
   // ask CallCountingHelper to populate trace and call count data.
   call_counter_.PopulateCallCounts(json);
   json = top_level_json;
-  ChildRefsList listen_sockets;
-  grpc_server_populate_listen_sockets(server_, &listen_sockets);
-  if (!listen_sockets.empty()) {
+  // Render listen sockets
+  MutexLock lock(&child_mu_);
+  if (!child_listen_sockets_.empty()) {
     grpc_json* array_parent = grpc_json_create_child(
         nullptr, json, "listenSocket", nullptr, GRPC_JSON_ARRAY, false);
-    for (size_t i = 0; i < listen_sockets.size(); ++i) {
+    for (const auto& it : child_listen_sockets_) {
       json_iterator =
           grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr,
                                  GRPC_JSON_OBJECT, false);
-      grpc_json_add_number_string_child(json_iterator, nullptr, "socketId",
-                                        listen_sockets[i]);
+      grpc_json* sibling_iterator = grpc_json_add_number_string_child(
+          json_iterator, nullptr, "socketId", it.first);
+      grpc_json_create_child(sibling_iterator, json_iterator, "name",
+                             it.second->name(), GRPC_JSON_STRING, false);
     }
   }
   return top_level_json;
@@ -406,14 +442,15 @@ void PopulateSocketAddressJson(grpc_json* json, const char* name,
                            (strcmp(uri->scheme, "ipv6") == 0))) {
     const char* host_port = uri->path;
     if (*host_port == '/') ++host_port;
-    char* host = nullptr;
-    char* port = nullptr;
-    GPR_ASSERT(gpr_split_host_port(host_port, &host, &port));
+    UniquePtr<char> host;
+    UniquePtr<char> port;
+    GPR_ASSERT(SplitHostPort(host_port, &host, &port));
     int port_num = -1;
     if (port != nullptr) {
-      port_num = atoi(port);
+      port_num = atoi(port.get());
     }
-    char* b64_host = grpc_base64_encode(host, strlen(host), false, false);
+    char* b64_host =
+        grpc_base64_encode(host.get(), strlen(host.get()), false, false);
     json_iterator = grpc_json_create_child(json_iterator, json, "tcpip_address",
                                            nullptr, GRPC_JSON_OBJECT, false);
     json = json_iterator;
@@ -422,8 +459,6 @@ void PopulateSocketAddressJson(grpc_json* json, const char* name,
                                                       "port", port_num);
     json_iterator = grpc_json_create_child(json_iterator, json, "ip_address",
                                            b64_host, GRPC_JSON_STRING, true);
-    gpr_free(host);
-    gpr_free(port);
   } else if (uri != nullptr && strcmp(uri->scheme, "unix") == 0) {
     json_iterator = grpc_json_create_child(json_iterator, json, "uds_address",
                                            nullptr, GRPC_JSON_OBJECT, false);
@@ -445,33 +480,33 @@ void PopulateSocketAddressJson(grpc_json* json, const char* name,
 
 }  // namespace
 
-SocketNode::SocketNode(UniquePtr<char> local, UniquePtr<char> remote)
-    : BaseNode(EntityType::kSocket),
+SocketNode::SocketNode(UniquePtr<char> local, UniquePtr<char> remote,
+                       UniquePtr<char> name)
+    : BaseNode(EntityType::kSocket, std::move(name)),
       local_(std::move(local)),
       remote_(std::move(remote)) {}
 
 void SocketNode::RecordStreamStartedFromLocal() {
   gpr_atm_no_barrier_fetch_add(&streams_started_, static_cast<gpr_atm>(1));
-  gpr_atm_no_barrier_store(&last_local_stream_created_millis_,
-                           (gpr_atm)ExecCtx::Get()->Now());
+  gpr_atm_no_barrier_store(&last_local_stream_created_cycle_,
+                           gpr_get_cycle_counter());
 }
 
 void SocketNode::RecordStreamStartedFromRemote() {
   gpr_atm_no_barrier_fetch_add(&streams_started_, static_cast<gpr_atm>(1));
-  gpr_atm_no_barrier_store(&last_remote_stream_created_millis_,
-                           (gpr_atm)ExecCtx::Get()->Now());
+  gpr_atm_no_barrier_store(&last_remote_stream_created_cycle_,
+                           gpr_get_cycle_counter());
 }
 
 void SocketNode::RecordMessagesSent(uint32_t num_sent) {
   gpr_atm_no_barrier_fetch_add(&messages_sent_, static_cast<gpr_atm>(num_sent));
-  gpr_atm_no_barrier_store(&last_message_sent_millis_,
-                           (gpr_atm)ExecCtx::Get()->Now());
+  gpr_atm_no_barrier_store(&last_message_sent_cycle_, gpr_get_cycle_counter());
 }
 
 void SocketNode::RecordMessageReceived() {
   gpr_atm_no_barrier_fetch_add(&messages_received_, static_cast<gpr_atm>(1));
-  gpr_atm_no_barrier_store(&last_message_received_millis_,
-                           (gpr_atm)ExecCtx::Get()->Now());
+  gpr_atm_no_barrier_store(&last_message_received_cycle_,
+                           gpr_get_cycle_counter());
 }
 
 grpc_json* SocketNode::RenderJson() {
@@ -486,6 +521,8 @@ grpc_json* SocketNode::RenderJson() {
   json_iterator = nullptr;
   json_iterator = grpc_json_add_number_string_child(json, json_iterator,
                                                     "socketId", uuid());
+  json_iterator = grpc_json_create_child(json_iterator, json, "name", name(),
+                                         GRPC_JSON_STRING, false);
   json = top_level_json;
   PopulateSocketAddressJson(json, "remote", remote_.get());
   PopulateSocketAddressJson(json, "local", local_.get());
@@ -502,20 +539,22 @@ grpc_json* SocketNode::RenderJson() {
   if (streams_started != 0) {
     json_iterator = grpc_json_add_number_string_child(
         json, json_iterator, "streamsStarted", streams_started);
-    gpr_atm last_local_stream_created_millis =
-        gpr_atm_no_barrier_load(&last_local_stream_created_millis_);
-    if (last_local_stream_created_millis != 0) {
-      ts = grpc_millis_to_timespec(last_local_stream_created_millis,
-                                   GPR_CLOCK_REALTIME);
+    gpr_cycle_counter last_local_stream_created_cycle =
+        gpr_atm_no_barrier_load(&last_local_stream_created_cycle_);
+    if (last_local_stream_created_cycle != 0) {
+      ts = gpr_convert_clock_type(
+          gpr_cycle_counter_to_time(last_local_stream_created_cycle),
+          GPR_CLOCK_REALTIME);
       json_iterator = grpc_json_create_child(
           json_iterator, json, "lastLocalStreamCreatedTimestamp",
           gpr_format_timespec(ts), GRPC_JSON_STRING, true);
     }
-    gpr_atm last_remote_stream_created_millis =
-        gpr_atm_no_barrier_load(&last_remote_stream_created_millis_);
-    if (last_remote_stream_created_millis != 0) {
-      ts = grpc_millis_to_timespec(last_remote_stream_created_millis,
-                                   GPR_CLOCK_REALTIME);
+    gpr_cycle_counter last_remote_stream_created_cycle =
+        gpr_atm_no_barrier_load(&last_remote_stream_created_cycle_);
+    if (last_remote_stream_created_cycle != 0) {
+      ts = gpr_convert_clock_type(
+          gpr_cycle_counter_to_time(last_remote_stream_created_cycle),
+          GPR_CLOCK_REALTIME);
       json_iterator = grpc_json_create_child(
           json_iterator, json, "lastRemoteStreamCreatedTimestamp",
           gpr_format_timespec(ts), GRPC_JSON_STRING, true);
@@ -535,8 +574,9 @@ grpc_json* SocketNode::RenderJson() {
   if (messages_sent != 0) {
     json_iterator = grpc_json_add_number_string_child(
         json, json_iterator, "messagesSent", messages_sent);
-    ts = grpc_millis_to_timespec(
-        gpr_atm_no_barrier_load(&last_message_sent_millis_),
+    ts = gpr_convert_clock_type(
+        gpr_cycle_counter_to_time(
+            gpr_atm_no_barrier_load(&last_message_sent_cycle_)),
         GPR_CLOCK_REALTIME);
     json_iterator =
         grpc_json_create_child(json_iterator, json, "lastMessageSentTimestamp",
@@ -546,8 +586,9 @@ grpc_json* SocketNode::RenderJson() {
   if (messages_received != 0) {
     json_iterator = grpc_json_add_number_string_child(
         json, json_iterator, "messagesReceived", messages_received);
-    ts = grpc_millis_to_timespec(
-        gpr_atm_no_barrier_load(&last_message_received_millis_),
+    ts = gpr_convert_clock_type(
+        gpr_cycle_counter_to_time(
+            gpr_atm_no_barrier_load(&last_message_received_cycle_)),
         GPR_CLOCK_REALTIME);
     json_iterator = grpc_json_create_child(
         json_iterator, json, "lastMessageReceivedTimestamp",
@@ -565,8 +606,10 @@ grpc_json* SocketNode::RenderJson() {
 // ListenSocketNode
 //
 
-ListenSocketNode::ListenSocketNode(UniquePtr<char> local_addr)
-    : BaseNode(EntityType::kSocket), local_addr_(std::move(local_addr)) {}
+ListenSocketNode::ListenSocketNode(UniquePtr<char> local_addr,
+                                   UniquePtr<char> name)
+    : BaseNode(EntityType::kSocket, std::move(name)),
+      local_addr_(std::move(local_addr)) {}
 
 grpc_json* ListenSocketNode::RenderJson() {
   // We need to track these three json objects to build our object
@@ -580,6 +623,8 @@ grpc_json* ListenSocketNode::RenderJson() {
   json_iterator = nullptr;
   json_iterator = grpc_json_add_number_string_child(json, json_iterator,
                                                     "socketId", uuid());
+  json_iterator = grpc_json_create_child(json_iterator, json, "name", name(),
+                                         GRPC_JSON_STRING, false);
   json = top_level_json;
   PopulateSocketAddressJson(json, "local", local_addr_.get());
 
index f8acb53..b023a52 100644 (file)
@@ -24,6 +24,7 @@
 #include <grpc/grpc.h>
 
 #include "src/core/lib/channel/channel_trace.h"
+#include "src/core/lib/gpr/time_precise.h"
 #include "src/core/lib/gprpp/inlined_vector.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/gprpp/map.h"
@@ -58,13 +59,8 @@ namespace channelz {
 grpc_arg MakeParentUuidArg(intptr_t parent_uuid);
 intptr_t GetParentUuidFromArgs(const grpc_channel_args& args);
 
-// TODO(ncteisen), this only contains the uuids of the children for now,
-// since that is all that is strictly needed. In a future enhancement we will
-// add human readable names as in the channelz.proto
-typedef InlinedVector<intptr_t, 10> ChildRefsList;
-
 class SocketNode;
-typedef InlinedVector<SocketNode*, 10> ChildSocketsList;
+class ListenSocketNode;
 
 namespace testing {
 class CallCountingHelperPeer;
@@ -85,7 +81,10 @@ class BaseNode : public RefCounted<BaseNode> {
     kSocket,
   };
 
-  explicit BaseNode(EntityType type);
+ protected:
+  BaseNode(EntityType type, UniquePtr<char> name);
+
+ public:
   virtual ~BaseNode();
 
   // All children must implement this function.
@@ -97,12 +96,14 @@ class BaseNode : public RefCounted<BaseNode> {
 
   EntityType type() const { return type_; }
   intptr_t uuid() const { return uuid_; }
+  const char* name() const { return name_.get(); }
 
  private:
   // to allow the ChannelzRegistry to set uuid_ under its lock.
   friend class ChannelzRegistry;
   const EntityType type_;
   intptr_t uuid_;
+  UniquePtr<char> name_;
 };
 
 // This class is a helper class for channelz entities that deal with Channels,
@@ -114,7 +115,6 @@ class BaseNode : public RefCounted<BaseNode> {
 class CallCountingHelper {
  public:
   CallCountingHelper();
-  ~CallCountingHelper();
 
   void RecordCallStarted();
   void RecordCallFailed();
@@ -127,24 +127,38 @@ class CallCountingHelper {
   // testing peer friend.
   friend class testing::CallCountingHelperPeer;
 
+  // TODO(soheil): add a proper PerCPU helper and use it here.
   struct AtomicCounterData {
-    gpr_atm calls_started = 0;
-    gpr_atm calls_succeeded = 0;
-    gpr_atm calls_failed = 0;
-    gpr_atm last_call_started_millis = 0;
-  };
+    // Define the ctors so that we can use this structure in InlinedVector.
+    AtomicCounterData() = default;
+    AtomicCounterData(const AtomicCounterData& that)
+        : calls_started(that.calls_started.Load(MemoryOrder::RELAXED)),
+          calls_succeeded(that.calls_succeeded.Load(MemoryOrder::RELAXED)),
+          calls_failed(that.calls_failed.Load(MemoryOrder::RELAXED)),
+          last_call_started_cycle(
+              that.last_call_started_cycle.Load(MemoryOrder::RELAXED)) {}
+
+    Atomic<intptr_t> calls_started{0};
+    Atomic<intptr_t> calls_succeeded{0};
+    Atomic<intptr_t> calls_failed{0};
+    Atomic<gpr_cycle_counter> last_call_started_cycle{0};
+    // Make sure the size is exactly one cache line.
+    uint8_t padding[GPR_CACHELINE_SIZE - 3 * sizeof(Atomic<intptr_t>) -
+                    sizeof(Atomic<gpr_cycle_counter>)];
+  } GPR_ALIGN_STRUCT(GPR_CACHELINE_SIZE);
 
   struct CounterData {
     intptr_t calls_started = 0;
     intptr_t calls_succeeded = 0;
     intptr_t calls_failed = 0;
-    intptr_t last_call_started_millis = 0;
+    gpr_cycle_counter last_call_started_cycle = 0;
   };
 
   // collects the sharded data into one CounterData struct.
   void CollectData(CounterData* out);
 
-  AtomicCounterData* per_cpu_counter_data_storage_ = nullptr;
+  // Really zero-sized, but 0-sized arrays are illegal on MSVC.
+  InlinedVector<AtomicCounterData, 1> per_cpu_counter_data_storage_;
   size_t num_cores_ = 0;
 };
 
@@ -154,6 +168,10 @@ class ChannelNode : public BaseNode {
   ChannelNode(UniquePtr<char> target, size_t channel_tracer_max_nodes,
               intptr_t parent_uuid);
 
+  // Returns the string description of the given connectivity state.
+  static const char* GetChannelConnectivityStateChangeString(
+      grpc_connectivity_state state);
+
   intptr_t parent_uuid() const { return parent_uuid_; }
 
   grpc_json* RenderJson() override;
@@ -174,9 +192,13 @@ class ChannelNode : public BaseNode {
 
   void SetConnectivityState(grpc_connectivity_state state);
 
+  // TODO(roth): take in a RefCountedPtr to the child channel so we can retrieve
+  // the human-readable name.
   void AddChildChannel(intptr_t child_uuid);
   void RemoveChildChannel(intptr_t child_uuid);
 
+  // TODO(roth): take in a RefCountedPtr to the child subchannel so we can
+  // retrieve the human-readable name.
   void AddChildSubchannel(intptr_t child_uuid);
   void RemoveChildSubchannel(intptr_t child_uuid);
 
@@ -207,12 +229,20 @@ class ChannelNode : public BaseNode {
 class ServerNode : public BaseNode {
  public:
   ServerNode(grpc_server* server, size_t channel_tracer_max_nodes);
+
   ~ServerNode() override;
 
   grpc_json* RenderJson() override;
 
-  char* RenderServerSockets(intptr_t start_socket_id,
-                            intptr_t pagination_limit);
+  char* RenderServerSockets(intptr_t start_socket_id, intptr_t max_results);
+
+  void AddChildSocket(RefCountedPtr<SocketNode> node);
+
+  void RemoveChildSocket(intptr_t child_uuid);
+
+  void AddChildListenSocket(RefCountedPtr<ListenSocketNode> node);
+
+  void RemoveChildListenSocket(intptr_t child_uuid);
 
   // proxy methods to composed classes.
   void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) {
@@ -229,15 +259,18 @@ class ServerNode : public BaseNode {
   void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); }
 
  private:
-  grpc_server* server_;
   CallCountingHelper call_counter_;
   ChannelTrace trace_;
+  Mutex child_mu_;  // Guards child maps below.
+  Map<intptr_t, RefCountedPtr<SocketNode>> child_sockets_;
+  Map<intptr_t, RefCountedPtr<ListenSocketNode>> child_listen_sockets_;
 };
 
 // Handles channelz bookkeeping for sockets
 class SocketNode : public BaseNode {
  public:
-  SocketNode(UniquePtr<char> local, UniquePtr<char> remote);
+  SocketNode(UniquePtr<char> local, UniquePtr<char> remote,
+             UniquePtr<char> name);
   ~SocketNode() override {}
 
   grpc_json* RenderJson() override;
@@ -265,10 +298,10 @@ class SocketNode : public BaseNode {
   gpr_atm messages_sent_ = 0;
   gpr_atm messages_received_ = 0;
   gpr_atm keepalives_sent_ = 0;
-  gpr_atm last_local_stream_created_millis_ = 0;
-  gpr_atm last_remote_stream_created_millis_ = 0;
-  gpr_atm last_message_sent_millis_ = 0;
-  gpr_atm last_message_received_millis_ = 0;
+  gpr_atm last_local_stream_created_cycle_ = 0;
+  gpr_atm last_remote_stream_created_cycle_ = 0;
+  gpr_atm last_message_sent_cycle_ = 0;
+  gpr_atm last_message_received_cycle_ = 0;
   UniquePtr<char> local_;
   UniquePtr<char> remote_;
 };
@@ -276,8 +309,7 @@ class SocketNode : public BaseNode {
 // Handles channelz bookkeeping for listen sockets
 class ListenSocketNode : public BaseNode {
  public:
-  // ListenSocketNode takes ownership of host.
-  explicit ListenSocketNode(UniquePtr<char> local_addr);
+  ListenSocketNode(UniquePtr<char> local_addr, UniquePtr<char> name);
   ~ListenSocketNode() override {}
 
   grpc_json* RenderJson() override;
index a3a069d..8a0abca 100644 (file)
@@ -59,12 +59,11 @@ int grpc_compression_algorithm_parse(grpc_slice name,
   } else {
     return 0;
   }
-  return 0;
 }
 
 int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
                                     const char** name) {
-  GRPC_API_TRACE("grpc_compression_algorithm_parse(algorithm=%d, name=%p)", 2,
+  GRPC_API_TRACE("grpc_compression_algorithm_name(algorithm=%d, name=%p)", 2,
                  ((int)algorithm, name));
   switch (algorithm) {
     case GRPC_COMPRESS_NONE:
@@ -128,7 +127,8 @@ void grpc_compression_options_disable_algorithm(
 int grpc_compression_options_is_algorithm_enabled(
     const grpc_compression_options* opts,
     grpc_compression_algorithm algorithm) {
-  return GPR_BITGET(opts->enabled_algorithms_bitset, algorithm);
+  return grpc_compression_options_is_algorithm_enabled_internal(opts,
+                                                                algorithm);
 }
 
 grpc_slice grpc_compression_algorithm_slice(
index 6a8232d..6bbda64 100644 (file)
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/useful.h"
 
-grpc_compression_algorithm grpc_channel_args_get_compression_algorithm(
+grpc_compression_algorithm
+grpc_channel_args_get_channel_default_compression_algorithm(
     const grpc_channel_args* a) {
   size_t i;
   if (a == nullptr) return GRPC_COMPRESS_NONE;
   for (i = 0; i < a->num_args; ++i) {
     if (a->args[i].type == GRPC_ARG_INTEGER &&
         !strcmp(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, a->args[i].key)) {
-      return static_cast<grpc_compression_algorithm>(a->args[i].value.integer);
-      break;
+      grpc_compression_algorithm default_algorithm =
+          static_cast<grpc_compression_algorithm>(a->args[i].value.integer);
+      return default_algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT
+                 ? default_algorithm
+                 : GRPC_COMPRESS_NONE;
     }
   }
   return GRPC_COMPRESS_NONE;
 }
 
-grpc_channel_args* grpc_channel_args_set_compression_algorithm(
+grpc_channel_args* grpc_channel_args_set_channel_default_compression_algorithm(
     grpc_channel_args* a, grpc_compression_algorithm algorithm) {
   GPR_ASSERT(algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT);
   grpc_arg tmp;
@@ -68,7 +72,9 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args* a,
           !strcmp(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET,
                   a->args[i].key)) {
         *states_arg = &a->args[i].value.integer;
-        **states_arg |= 0x1; /* forcefully enable support for no compression */
+        **states_arg =
+            (**states_arg & ((1 << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1)) |
+            0x1; /* forcefully enable support for no compression */
         return 1;
       }
     }
@@ -83,7 +89,8 @@ grpc_channel_args* grpc_channel_args_compression_algorithm_set_state(
   const int states_arg_found =
       find_compression_algorithm_states_bitset(*a, &states_arg);
 
-  if (grpc_channel_args_get_compression_algorithm(*a) == algorithm &&
+  if (grpc_channel_args_get_channel_default_compression_algorithm(*a) ==
+          algorithm &&
       state == 0) {
     const char* algo_name = nullptr;
     GPR_ASSERT(grpc_compression_algorithm_name(algorithm, &algo_name) != 0);
index 407d6e2..f1abc12 100644 (file)
 #include <grpc/impl/codegen/grpc_types.h>
 
 /** Returns the compression algorithm set in \a a. */
-grpc_compression_algorithm grpc_channel_args_get_compression_algorithm(
+grpc_compression_algorithm
+grpc_channel_args_get_channel_default_compression_algorithm(
     const grpc_channel_args* a);
 
 /** Returns a channel arg instance with compression enabled. If \a a is
  * non-NULL, its args are copied. N.B. GRPC_COMPRESS_NONE disables compression
  * for the channel. */
-grpc_channel_args* grpc_channel_args_set_compression_algorithm(
+grpc_channel_args* grpc_channel_args_set_channel_default_compression_algorithm(
     grpc_channel_args* a, grpc_compression_algorithm algorithm);
 
 /** Sets the support for the given compression algorithm. By default, all
index e0d73ef..e0cf6d4 100644 (file)
@@ -171,7 +171,7 @@ int grpc_compression_algorithm_from_message_stream_compression_algorithm(
 int grpc_message_compression_algorithm_name(
     grpc_message_compression_algorithm algorithm, const char** name) {
   GRPC_API_TRACE(
-      "grpc_message_compression_algorithm_parse(algorithm=%d, name=%p)", 2,
+      "grpc_message_compression_algorithm_name(algorithm=%d, name=%p)", 2,
       ((int)algorithm, name));
   switch (algorithm) {
     case GRPC_MESSAGE_COMPRESS_NONE:
index 73947a2..49afb94 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <grpc/impl/codegen/compression_types.h>
 
+#include "src/core/lib/gpr/useful.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -85,4 +87,10 @@ int grpc_stream_compression_algorithm_parse(
 }
 #endif
 
+inline int grpc_compression_options_is_algorithm_enabled_internal(
+    const grpc_compression_options* opts,
+    grpc_compression_algorithm algorithm) {
+  return GPR_BITGET(opts->enabled_algorithms_bitset, algorithm);
+}
+
 #endif /* GRPC_CORE_LIB_COMPRESSION_COMPRESSION_INTERNAL_H */
index 3a3aa54..6a78dc1 100644 (file)
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/useful.h"
 
-static const char* gpr_getenv_silent(const char* name, char** dst) {
-  const char* insecure_func_used = nullptr;
+char* gpr_getenv(const char* name) {
   char* result = nullptr;
 #if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)
   typedef char* (*getenv_type)(const char*);
-  static getenv_type getenv_func = NULL;
+  static getenv_type getenv_func = nullptr;
   /* Check to see which getenv variant is supported (go from most
    * to least secure) */
-  const char* names[] = {"secure_getenv", "__secure_getenv", "getenv"};
-  for (size_t i = 0; getenv_func == NULL && i < GPR_ARRAY_SIZE(names); i++) {
-    getenv_func = (getenv_type)dlsym(RTLD_DEFAULT, names[i]);
-    if (getenv_func != NULL && strstr(names[i], "secure") == NULL) {
-      insecure_func_used = names[i];
+  if (getenv_func == nullptr) {
+    const char* names[] = {"secure_getenv", "__secure_getenv", "getenv"};
+    for (size_t i = 0; i < GPR_ARRAY_SIZE(names); i++) {
+      getenv_func = (getenv_type)dlsym(RTLD_DEFAULT, names[i]);
+      if (getenv_func != nullptr) {
+        break;
+      }
     }
   }
   result = getenv_func(name);
@@ -58,20 +59,8 @@ static const char* gpr_getenv_silent(const char* name, char** dst) {
   result = secure_getenv(name);
 #else
   result = getenv(name);
-  insecure_func_used = "getenv";
 #endif
-  *dst = result == nullptr ? result : gpr_strdup(result);
-  return insecure_func_used;
-}
-
-char* gpr_getenv(const char* name) {
-  char* result = nullptr;
-  const char* insecure_func_used = gpr_getenv_silent(name, &result);
-  if (insecure_func_used != nullptr) {
-    gpr_log(GPR_DEBUG, "Warning: insecure environment read function '%s' used",
-            insecure_func_used);
-  }
-  return result;
+  return result == nullptr ? result : gpr_strdup(result);
 }
 
 void gpr_setenv(const char* name, const char* value) {
index 30ddc50..232095b 100644 (file)
 #include <grpc/support/string_util.h>
 #include "src/core/lib/gpr/string.h"
 
-const char* gpr_getenv_silent(const char* name, char** dst) {
-  *dst = gpr_getenv(name);
-  return nullptr;
-}
-
 char* gpr_getenv(const char* name) {
   char* result = getenv(name);
   return result == nullptr ? result : gpr_strdup(result);
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/gpr/host_port.cc b/legacy-libs/grpc/deps/grpc/src/core/lib/gpr/host_port.cc
deleted file mode 100644 (file)
index a34e01c..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/lib/gpr/host_port.h"
-
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-
-#include "src/core/lib/gpr/string.h"
-
-int gpr_join_host_port(char** out, const char* host, int port) {
-  if (host[0] != '[' && strchr(host, ':') != nullptr) {
-    /* IPv6 literals must be enclosed in brackets. */
-    return gpr_asprintf(out, "[%s]:%d", host, port);
-  } else {
-    /* Ordinary non-bracketed host:port. */
-    return gpr_asprintf(out, "%s:%d", host, port);
-  }
-}
-
-int gpr_split_host_port(const char* name, char** host, char** port) {
-  const char* host_start;
-  size_t host_len;
-  const char* port_start;
-
-  *host = nullptr;
-  *port = nullptr;
-
-  if (name[0] == '[') {
-    /* Parse a bracketed host, typically an IPv6 literal. */
-    const char* rbracket = strchr(name, ']');
-    if (rbracket == nullptr) {
-      /* Unmatched [ */
-      return 0;
-    }
-    if (rbracket[1] == '\0') {
-      /* ]<end> */
-      port_start = nullptr;
-    } else if (rbracket[1] == ':') {
-      /* ]:<port?> */
-      port_start = rbracket + 2;
-    } else {
-      /* ]<invalid> */
-      return 0;
-    }
-    host_start = name + 1;
-    host_len = static_cast<size_t>(rbracket - host_start);
-    if (memchr(host_start, ':', host_len) == nullptr) {
-      /* Require all bracketed hosts to contain a colon, because a hostname or
-         IPv4 address should never use brackets. */
-      return 0;
-    }
-  } else {
-    const char* colon = strchr(name, ':');
-    if (colon != nullptr && strchr(colon + 1, ':') == nullptr) {
-      /* Exactly 1 colon.  Split into host:port. */
-      host_start = name;
-      host_len = static_cast<size_t>(colon - name);
-      port_start = colon + 1;
-    } else {
-      /* 0 or 2+ colons.  Bare hostname or IPv6 litearal. */
-      host_start = name;
-      host_len = strlen(name);
-      port_start = nullptr;
-    }
-  }
-
-  /* Allocate return values. */
-  *host = static_cast<char*>(gpr_malloc(host_len + 1));
-  memcpy(*host, host_start, host_len);
-  (*host)[host_len] = '\0';
-
-  if (port_start != nullptr) {
-    *port = gpr_strdup(port_start);
-  }
-
-  return 1;
-}
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/gpr/host_port.h b/legacy-libs/grpc/deps/grpc/src/core/lib/gpr/host_port.h
deleted file mode 100644 (file)
index 0bf0960..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_CORE_LIB_GPR_HOST_PORT_H
-#define GRPC_CORE_LIB_GPR_HOST_PORT_H
-
-#include <grpc/support/port_platform.h>
-
-/** Given a host and port, creates a newly-allocated string of the form
-   "host:port" or "[ho:st]:port", depending on whether the host contains colons
-   like an IPv6 literal.  If the host is already bracketed, then additional
-   brackets will not be added.
-
-   Usage is similar to gpr_asprintf: returns the number of bytes written
-   (excluding the final '\0'), and *out points to a string which must later be
-   destroyed using gpr_free().
-
-   In the unlikely event of an error, returns -1 and sets *out to NULL. */
-int gpr_join_host_port(char** out, const char* host, int port);
-
-/** Given a name in the form "host:port" or "[ho:st]:port", split into hostname
-   and port number, into newly allocated strings, which must later be
-   destroyed using gpr_free().
-   Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
-   failure. */
-int gpr_split_host_port(const char* name, char** host, char** port);
-
-#endif /* GRPC_CORE_LIB_GPR_HOST_PORT_H */
index 561276f..8b597b4 100644 (file)
@@ -40,7 +40,7 @@
 #include <time.h>
 #include <unistd.h>
 
-static long gettid(void) { return syscall(__NR_gettid); }
+static long sys_gettid(void) { return syscall(__NR_gettid); }
 
 void gpr_log(const char* file, int line, gpr_log_severity severity,
              const char* format, ...) {
@@ -70,7 +70,7 @@ void gpr_default_log(gpr_log_func_args* args) {
   gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
   struct tm tm;
   static __thread long tid = 0;
-  if (tid == 0) tid = gettid();
+  if (tid == 0) tid = sys_gettid();
 
   timer = static_cast<time_t>(now.tv_sec);
   final_slash = strrchr(args->file, '/');
index b6edc14..2f7c6ce 100644 (file)
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <time.h>
 
-static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
+static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); }
 
 void gpr_log(const char* file, int line, gpr_log_severity severity,
              const char* format, ...) {
@@ -86,7 +86,7 @@ void gpr_default_log(gpr_log_func_args* args) {
   char* prefix;
   gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]",
                gpr_log_severity_string(args->severity), time_buffer,
-               (int)(now.tv_nsec), gettid(), display_file, args->line);
+               (int)(now.tv_nsec), sys_gettid(), display_file, args->line);
 
   fprintf(stderr, "%-70s %s\n", prefix, args->message);
   gpr_free(prefix);
index a39f56e..14436ec 100644 (file)
@@ -289,17 +289,22 @@ char* gpr_strvec_flatten(gpr_strvec* sv, size_t* final_length) {
   return gpr_strjoin((const char**)sv->strs, sv->count, final_length);
 }
 
-int gpr_stricmp(const char* a, const char* b) {
+int gpr_strincmp(const char* a, const char* b, size_t n) {
   int ca, cb;
   do {
     ca = tolower(*a);
     cb = tolower(*b);
     ++a;
     ++b;
-  } while (ca == cb && ca && cb);
+    --n;
+  } while (ca == cb && ca != 0 && cb != 0 && n != 0);
   return ca - cb;
 }
 
+int gpr_stricmp(const char* a, const char* b) {
+  return gpr_strincmp(a, b, SIZE_MAX);
+}
+
 static void add_string_to_split(const char* beg, const char* end, char*** strs,
                                 size_t* nstrs, size_t* capstrs) {
   char* out =
index bf59db7..fcccf5e 100644 (file)
@@ -115,6 +115,7 @@ char* gpr_strvec_flatten(gpr_strvec* strs, size_t* total_length);
 /** Case insensitive string comparison... return <0 if lower(a)<lower(b), ==0 if
     lower(a)==lower(b), >0 if lower(a)>lower(b) */
 int gpr_stricmp(const char* a, const char* b);
+int gpr_strincmp(const char* a, const char* b, size_t n);
 
 void* gpr_memrchr(const void* s, int c, size_t n);
 
index a30e36c..fe2d5a9 100644 (file)
 #include <time.h>
 #include "src/core/lib/profiling/timers.h"
 
-// For debug of the timer manager crash only.
-// TODO (mxyan): remove after bug is fixed.
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-#include <string.h>
-void (*g_grpc_debug_timer_manager_stats)(
-    int64_t timer_manager_init_count, int64_t timer_manager_shutdown_count,
-    int64_t fork_count, int64_t timer_wait_err, int64_t timer_cv_value,
-    int64_t timer_mu_value, int64_t abstime_sec_value,
-    int64_t abstime_nsec_value, int64_t abs_deadline_sec_value,
-    int64_t abs_deadline_nsec_value, int64_t now1_sec_value,
-    int64_t now1_nsec_value, int64_t now2_sec_value, int64_t now2_nsec_value,
-    int64_t add_result_sec_value, int64_t add_result_nsec_value,
-    int64_t sub_result_sec_value, int64_t sub_result_nsec_value,
-    int64_t next_value, int64_t start_time_sec,
-    int64_t start_time_nsec) = nullptr;
-int64_t g_timer_manager_init_count = 0;
-int64_t g_timer_manager_shutdown_count = 0;
-int64_t g_fork_count = 0;
-int64_t g_timer_wait_err = 0;
-int64_t g_timer_cv_value = 0;
-int64_t g_timer_mu_value = 0;
-int64_t g_abstime_sec_value = -1;
-int64_t g_abstime_nsec_value = -1;
-int64_t g_abs_deadline_sec_value = -1;
-int64_t g_abs_deadline_nsec_value = -1;
-int64_t g_now1_sec_value = -1;
-int64_t g_now1_nsec_value = -1;
-int64_t g_now2_sec_value = -1;
-int64_t g_now2_nsec_value = -1;
-int64_t g_add_result_sec_value = -1;
-int64_t g_add_result_nsec_value = -1;
-int64_t g_sub_result_sec_value = -1;
-int64_t g_sub_result_nsec_value = -1;
-int64_t g_next_value = -1;
-int64_t g_start_time_sec = -1;
-int64_t g_start_time_nsec = -1;
-#endif  // GRPC_DEBUG_TIMER_MANAGER
-
 #ifdef GPR_LOW_LEVEL_COUNTERS
 gpr_atm gpr_mu_locks = 0;
 gpr_atm gpr_counter_atm_cas = 0;
@@ -152,63 +114,12 @@ void gpr_cv_destroy(gpr_cv* cv) {
 #endif
 }
 
-// For debug of the timer manager crash only.
-// TODO (mxyan): remove after bug is fixed.
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-static gpr_timespec gpr_convert_clock_type_debug_timespec(
-    gpr_timespec t, gpr_clock_type clock_type, gpr_timespec& now1,
-    gpr_timespec& now2, gpr_timespec& add_result, gpr_timespec& sub_result) {
-  if (t.clock_type == clock_type) {
-    return t;
-  }
-
-  if (t.tv_sec == INT64_MAX || t.tv_sec == INT64_MIN) {
-    t.clock_type = clock_type;
-    return t;
-  }
-
-  if (clock_type == GPR_TIMESPAN) {
-    return gpr_time_sub(t, gpr_now(t.clock_type));
-  }
-
-  if (t.clock_type == GPR_TIMESPAN) {
-    return gpr_time_add(gpr_now(clock_type), t);
-  }
-
-  now1 = gpr_now(t.clock_type);
-  sub_result = gpr_time_sub(t, now1);
-  now2 = gpr_now(clock_type);
-  add_result = gpr_time_add(now2, sub_result);
-  return add_result;
-}
-
-#define gpr_convert_clock_type_debug(t, clock_type, now1, now2, add_result, \
-                                     sub_result)                            \
-  gpr_convert_clock_type_debug_timespec((t), (clock_type), (now1), (now2),  \
-                                        (add_result), (sub_result))
-#else
 #define gpr_convert_clock_type_debug(t, clock_type, now1, now2, add_result, \
                                      sub_result)                            \
   gpr_convert_clock_type((t), (clock_type))
-#endif
 
 int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) {
   int err = 0;
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-  // For debug of the timer manager crash only.
-  // TODO (mxyan): remove after bug is fixed.
-  gpr_timespec abs_deadline_copy;
-  abs_deadline_copy.tv_sec = abs_deadline.tv_sec;
-  abs_deadline_copy.tv_nsec = abs_deadline.tv_nsec;
-  gpr_timespec now1;
-  gpr_timespec now2;
-  gpr_timespec add_result;
-  gpr_timespec sub_result;
-  memset(&now1, 0, sizeof(now1));
-  memset(&now2, 0, sizeof(now2));
-  memset(&add_result, 0, sizeof(add_result));
-  memset(&sub_result, 0, sizeof(sub_result));
-#endif
   if (gpr_time_cmp(abs_deadline, gpr_inf_future(abs_deadline.clock_type)) ==
       0) {
 #ifdef GRPC_ASAN_ENABLED
@@ -232,47 +143,7 @@ int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) {
 #else
     err = pthread_cond_timedwait(cv, mu, &abs_deadline_ts);
 #endif
-
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-    // For debug of the timer manager crash only.
-    // TODO (mxyan): remove after bug is fixed.
-    if (GPR_UNLIKELY(!(err == 0 || err == ETIMEDOUT || err == EAGAIN))) {
-      g_abstime_sec_value = abs_deadline_ts.tv_sec;
-      g_abstime_nsec_value = abs_deadline_ts.tv_nsec;
-    }
-#endif
   }
-
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-  // For debug of the timer manager crash only.
-  // TODO (mxyan): remove after bug is fixed.
-  if (GPR_UNLIKELY(!(err == 0 || err == ETIMEDOUT || err == EAGAIN))) {
-    if (g_grpc_debug_timer_manager_stats) {
-      g_timer_wait_err = err;
-      g_timer_cv_value = (int64_t)cv;
-      g_timer_mu_value = (int64_t)mu;
-      g_abs_deadline_sec_value = abs_deadline_copy.tv_sec;
-      g_abs_deadline_nsec_value = abs_deadline_copy.tv_nsec;
-      g_now1_sec_value = now1.tv_sec;
-      g_now1_nsec_value = now1.tv_nsec;
-      g_now2_sec_value = now2.tv_sec;
-      g_now2_nsec_value = now2.tv_nsec;
-      g_add_result_sec_value = add_result.tv_sec;
-      g_add_result_nsec_value = add_result.tv_nsec;
-      g_sub_result_sec_value = sub_result.tv_sec;
-      g_sub_result_nsec_value = sub_result.tv_nsec;
-      g_grpc_debug_timer_manager_stats(
-          g_timer_manager_init_count, g_timer_manager_shutdown_count,
-          g_fork_count, g_timer_wait_err, g_timer_cv_value, g_timer_mu_value,
-          g_abstime_sec_value, g_abstime_nsec_value, g_abs_deadline_sec_value,
-          g_abs_deadline_nsec_value, g_now1_sec_value, g_now1_nsec_value,
-          g_now2_sec_value, g_now2_nsec_value, g_add_result_sec_value,
-          g_add_result_nsec_value, g_sub_result_sec_value,
-          g_sub_result_nsec_value, g_next_value, g_start_time_sec,
-          g_start_time_nsec);
-    }
-  }
-#endif
   GPR_ASSERT(err == 0 || err == ETIMEDOUT || err == EAGAIN);
   return err == ETIMEDOUT;
 }
index 1b34fd7..3223a84 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#if GPR_LINUX
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
+#include <algorithm>
+
+#include <grpc/impl/codegen/gpr_types.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <stdio.h>
 
 #include "src/core/lib/gpr/time_precise.h"
 
-#ifdef GRPC_TIMERS_RDTSC
-#if defined(__i386__)
-static void gpr_get_cycle_counter(int64_t int* clk) {
-  int64_t int ret;
-  __asm__ volatile("rdtsc" : "=A"(ret));
-  *clk = ret;
+#if GPR_CYCLE_COUNTER_RDTSC_32 or GPR_CYCLE_COUNTER_RDTSC_64
+#if GPR_LINUX
+static bool read_freq_from_kernel(double* freq) {
+  // Google production kernel export the frequency for us in kHz.
+  int fd = open("/sys/devices/system/cpu/cpu0/tsc_freq_khz", O_RDONLY);
+  if (fd == -1) {
+    return false;
+  }
+  char line[1024] = {};
+  char* err;
+  bool ret = false;
+  int len = read(fd, line, sizeof(line) - 1);
+  if (len > 0) {
+    const long val = strtol(line, &err, 10);
+    if (line[0] != '\0' && (*err == '\n' || *err == '\0')) {
+      *freq = val * 1e3;  // Value is kHz.
+      ret = true;
+    }
+  }
+  close(fd);
+  return ret;
 }
+#endif /* GPR_LINUX */
 
-// ----------------------------------------------------------------
-#elif defined(__x86_64__) || defined(__amd64__)
-static void gpr_get_cycle_counter(int64_t* clk) {
-  uint64_t low, high;
-  __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
-  *clk = (int64_t)(high << 32) | (int64_t)low;
+static double cycles_per_second = 0;
+static gpr_cycle_counter start_cycle;
+
+static bool is_fake_clock() {
+  gpr_timespec start = gpr_now(GPR_CLOCK_MONOTONIC);
+  int64_t sum = 0;
+  for (int i = 0; i < 8; ++i) {
+    gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
+    gpr_timespec delta = gpr_time_sub(now, start);
+    sum += delta.tv_sec * GPR_NS_PER_SEC + delta.tv_nsec;
+  }
+  // If the clock doesn't move even a nano after 8 tries, it's a fake one.
+  return sum == 0;
 }
-#endif
 
-static double cycles_per_second = 0;
-static int64_t start_cycle;
 void gpr_precise_clock_init(void) {
-  time_t start;
-  int64_t end_cycle;
   gpr_log(GPR_DEBUG, "Calibrating timers");
-  start = time(NULL);
-  while (time(NULL) == start)
-    ;
-  gpr_get_cycle_counter(&start_cycle);
-  while (time(NULL) <= start + 10)
-    ;
-  gpr_get_cycle_counter(&end_cycle);
-  cycles_per_second = (double)(end_cycle - start_cycle) / 10.0;
+
+#if GPR_LINUX
+  if (read_freq_from_kernel(&cycles_per_second)) {
+    start_cycle = gpr_get_cycle_counter();
+    return;
+  }
+#endif /* GPR_LINUX */
+
+  if (is_fake_clock()) {
+    cycles_per_second = 1;
+    start_cycle = 0;
+    return;
+  }
+  // Start from a loop of 1ms, and gradually increase the loop duration
+  // until we either converge or we have passed 255ms (1ms+2ms+...+128ms).
+  int64_t measurement_ns = GPR_NS_PER_MS;
+  double last_freq = -1;
+  bool converged = false;
+  for (int i = 0; i < 8 && !converged; ++i, measurement_ns *= 2) {
+    start_cycle = gpr_get_cycle_counter();
+    int64_t loop_ns;
+    gpr_timespec start = gpr_now(GPR_CLOCK_MONOTONIC);
+    do {
+      // TODO(soheil): Maybe sleep instead of busy polling.
+      gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
+      gpr_timespec delta = gpr_time_sub(now, start);
+      loop_ns = delta.tv_sec * GPR_NS_PER_SEC + delta.tv_nsec;
+    } while (loop_ns < measurement_ns);
+    gpr_cycle_counter end_cycle = gpr_get_cycle_counter();
+    // Frequency should be in Hz.
+    const double freq =
+        static_cast<double>(end_cycle - start_cycle) / loop_ns * GPR_NS_PER_SEC;
+    converged =
+        last_freq != -1 && (freq * 0.99 < last_freq && last_freq < freq * 1.01);
+    last_freq = freq;
+  }
+  cycles_per_second = last_freq;
   gpr_log(GPR_DEBUG, "... cycles_per_second = %f\n", cycles_per_second);
 }
 
-void gpr_precise_clock_now(gpr_timespec* clk) {
-  int64_t counter;
-  double secs;
-  gpr_get_cycle_counter(&counter);
-  secs = (double)(counter - start_cycle) / cycles_per_second;
-  clk->clock_type = GPR_CLOCK_PRECISE;
-  clk->tv_sec = (int64_t)secs;
-  clk->tv_nsec = (int32_t)(1e9 * (secs - (double)clk->tv_sec));
+gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) {
+  const double secs =
+      static_cast<double>(cycles - start_cycle) / cycles_per_second;
+  gpr_timespec ts;
+  ts.tv_sec = static_cast<int64_t>(secs);
+  ts.tv_nsec = static_cast<int32_t>(GPR_NS_PER_SEC *
+                                    (secs - static_cast<double>(ts.tv_sec)));
+  ts.clock_type = GPR_CLOCK_PRECISE;
+  return ts;
 }
 
-#else  /* GRPC_TIMERS_RDTSC */
+gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b) {
+  const double secs = static_cast<double>(a - b) / cycles_per_second;
+  gpr_timespec ts;
+  ts.tv_sec = static_cast<int64_t>(secs);
+  ts.tv_nsec = static_cast<int32_t>(GPR_NS_PER_SEC *
+                                    (secs - static_cast<double>(ts.tv_sec)));
+  ts.clock_type = GPR_TIMESPAN;
+  return ts;
+}
+
+void gpr_precise_clock_now(gpr_timespec* clk) {
+  int64_t counter = gpr_get_cycle_counter();
+  *clk = gpr_cycle_counter_to_time(counter);
+}
+#elif GPR_CYCLE_COUNTER_FALLBACK
 void gpr_precise_clock_init(void) {}
 
+gpr_cycle_counter gpr_get_cycle_counter() {
+  gpr_timespec ts = gpr_now(GPR_CLOCK_REALTIME);
+  return gpr_timespec_to_micros(ts);
+}
+
+gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles) {
+  gpr_timespec ts;
+  ts.tv_sec = cycles / GPR_US_PER_SEC;
+  ts.tv_nsec = (cycles - ts.tv_sec * GPR_US_PER_SEC) * GPR_NS_PER_US;
+  ts.clock_type = GPR_CLOCK_PRECISE;
+  return ts;
+}
+
 void gpr_precise_clock_now(gpr_timespec* clk) {
   *clk = gpr_now(GPR_CLOCK_REALTIME);
   clk->clock_type = GPR_CLOCK_PRECISE;
 }
-#endif /* GRPC_TIMERS_RDTSC */
+
+gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b) {
+  return gpr_time_sub(gpr_cycle_counter_to_time(a),
+                      gpr_cycle_counter_to_time(b));
+}
+#endif /* GPR_CYCLE_COUNTER_FALLBACK */
index a63ea9d..55eceb6 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include <grpc/impl/codegen/gpr_types.h>
 #include <grpc/support/time.h>
 
+// Depending on the platform gpr_get_cycle_counter() can have a resolution as
+// low as a usec. Use other clock sources or gpr_precise_clock_now(),
+// where you need high resolution clocks.
+//
+// Using gpr_get_cycle_counter() is preferred to using ExecCtx::Get()->Now()
+// whenever possible.
+
+#if GPR_CYCLE_COUNTER_RDTSC_32
+typedef int64_t gpr_cycle_counter;
+inline gpr_cycle_counter gpr_get_cycle_counter() {
+  int64_t ret;
+  __asm__ volatile("rdtsc" : "=A"(ret));
+  return ret;
+}
+#elif GPR_CYCLE_COUNTER_RDTSC_64
+typedef int64_t gpr_cycle_counter;
+inline gpr_cycle_counter gpr_get_cycle_counter() {
+  uint64_t low, high;
+  __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
+  return (high << 32) | low;
+}
+#elif GPR_CYCLE_COUNTER_FALLBACK
+// TODO(soheil): add support for mrs on Arm.
+
+// Real time in micros.
+typedef double gpr_cycle_counter;
+gpr_cycle_counter gpr_get_cycle_counter();
+#else
+#error Must define exactly one of \
+    GPR_CYCLE_COUNTER_RDTSC_32, \
+    GPR_CYCLE_COUNTER_RDTSC_64, or \
+    GPR_CYCLE_COUNTER_FALLBACK
+#endif
+
 void gpr_precise_clock_init(void);
 void gpr_precise_clock_now(gpr_timespec* clk);
+gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles);
+gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b);
 
 #endif /* GRPC_CORE_LIB_GPR_TIME_PRECISE_H */
index 5b7018e..ea68e3a 100644 (file)
 #ifndef GRPC_CORE_LIB_GPRPP_ABSTRACT_H
 #define GRPC_CORE_LIB_GPRPP_ABSTRACT_H
 
+#if GRPC_USE_CPP_STD_LIB
+
+#define GRPC_ABSTRACT_BASE_CLASS
+
+#define GRPC_ABSTRACT = 0
+
+#else
+
 // This is needed to support abstract base classes in the c core. Since gRPC
 // doesn't have a c++ runtime, it will hit a linker error on delete unless
 // we define a virtual operator delete. See this blog for more info:
@@ -34,4 +42,6 @@
     GPR_ASSERT(false);                                                       \
   }
 
+#endif  // GRPC_USE_CPP_STD_LIB
+
 #endif /* GRPC_CORE_LIB_GPRPP_ABSTRACT_H */
index 80412ef..095ebf1 100644 (file)
@@ -49,6 +49,10 @@ class Atomic {
     storage_.store(val, static_cast<std::memory_order>(order));
   }
 
+  T Exchange(T desired, MemoryOrder order) {
+    return storage_.exchange(desired, static_cast<std::memory_order>(order));
+  }
+
   bool CompareExchangeWeak(T* expected, T desired, MemoryOrder success,
                            MemoryOrder failure) {
     return GPR_ATM_INC_CAS_THEN(storage_.compare_exchange_weak(
index 287761b..d2384fd 100644 (file)
@@ -25,10 +25,12 @@ namespace grpc_core {
 // No-op for non-debug builds.
 // Callers can use the DEBUG_LOCATION macro in either case.
 #ifndef NDEBUG
+// TODO(roth): See if there's a way to automatically populate this,
+// similarly to how absl::SourceLocation::current() works, so that
+// callers don't need to explicitly pass DEBUG_LOCATION anywhere.
 class DebugLocation {
  public:
   DebugLocation(const char* file, int line) : file_(file), line_(line) {}
-  bool Log() const { return true; }
   const char* file() const { return file_; }
   int line() const { return line_; }
 
@@ -40,7 +42,6 @@ class DebugLocation {
 #else
 class DebugLocation {
  public:
-  bool Log() const { return false; }
   const char* file() const { return nullptr; }
   int line() const { return -1; }
 };
index 3755269..51836d5 100644 (file)
@@ -168,40 +168,33 @@ class ThreadState {
 
 void Fork::GlobalInit() {
   if (!override_enabled_) {
-    support_enabled_ = GPR_GLOBAL_CONFIG_GET(grpc_enable_fork_support);
+    support_enabled_.Store(GPR_GLOBAL_CONFIG_GET(grpc_enable_fork_support),
+                           MemoryOrder::RELAXED);
   }
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     exec_ctx_state_ = grpc_core::New<internal::ExecCtxState>();
     thread_state_ = grpc_core::New<internal::ThreadState>();
   }
 }
 
 void Fork::GlobalShutdown() {
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     grpc_core::Delete(exec_ctx_state_);
     grpc_core::Delete(thread_state_);
   }
 }
 
-bool Fork::Enabled() { return support_enabled_; }
+bool Fork::Enabled() { return support_enabled_.Load(MemoryOrder::RELAXED); }
 
 // Testing Only
 void Fork::Enable(bool enable) {
   override_enabled_ = true;
-  support_enabled_ = enable;
+  support_enabled_.Store(enable, MemoryOrder::RELAXED);
 }
 
-void Fork::IncExecCtxCount() {
-  if (support_enabled_) {
-    exec_ctx_state_->IncExecCtxCount();
-  }
-}
+void Fork::DoIncExecCtxCount() { exec_ctx_state_->IncExecCtxCount(); }
 
-void Fork::DecExecCtxCount() {
-  if (support_enabled_) {
-    exec_ctx_state_->DecExecCtxCount();
-  }
-}
+void Fork::DoDecExecCtxCount() { exec_ctx_state_->DecExecCtxCount(); }
 
 void Fork::SetResetChildPollingEngineFunc(
     Fork::child_postfork_func reset_child_polling_engine) {
@@ -212,38 +205,38 @@ Fork::child_postfork_func Fork::GetResetChildPollingEngineFunc() {
 }
 
 bool Fork::BlockExecCtx() {
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     return exec_ctx_state_->BlockExecCtx();
   }
   return false;
 }
 
 void Fork::AllowExecCtx() {
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     exec_ctx_state_->AllowExecCtx();
   }
 }
 
 void Fork::IncThreadCount() {
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     thread_state_->IncThreadCount();
   }
 }
 
 void Fork::DecThreadCount() {
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     thread_state_->DecThreadCount();
   }
 }
 void Fork::AwaitThreads() {
-  if (support_enabled_) {
+  if (support_enabled_.Load(MemoryOrder::RELAXED)) {
     thread_state_->AwaitThreads();
   }
 }
 
 internal::ExecCtxState* Fork::exec_ctx_state_ = nullptr;
 internal::ThreadState* Fork::thread_state_ = nullptr;
-std::atomic<bool> Fork::support_enabled_;
+Atomic<bool> Fork::support_enabled_(false);
 bool Fork::override_enabled_ = false;
 Fork::child_postfork_func Fork::reset_child_polling_engine_ = nullptr;
 }  // namespace grpc_core
index 73f2fa5..3601d7c 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <grpc/support/port_platform.h>
 
-#include <atomic>
+#include "src/core/lib/gprpp/atomic.h"
 
 /*
  * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK
@@ -47,10 +47,18 @@ class Fork {
 
   // Increment the count of active ExecCtxs.
   // Will block until a pending fork is complete if one is in progress.
-  static void IncExecCtxCount();
+  static void IncExecCtxCount() {
+    if (GPR_UNLIKELY(support_enabled_.Load(MemoryOrder::RELAXED))) {
+      DoIncExecCtxCount();
+    }
+  }
 
   // Decrement the count of active ExecCtxs
-  static void DecExecCtxCount();
+  static void DecExecCtxCount() {
+    if (GPR_UNLIKELY(support_enabled_.Load(MemoryOrder::RELAXED))) {
+      DoDecExecCtxCount();
+    }
+  }
 
   // Provide a function that will be invoked in the child's postfork handler to
   // reset the polling engine's internal state.
@@ -80,9 +88,12 @@ class Fork {
   static void Enable(bool enable);
 
  private:
+  static void DoIncExecCtxCount();
+  static void DoDecExecCtxCount();
+
   static internal::ExecCtxState* exec_ctx_state_;
   static internal::ThreadState* thread_state_;
-  static std::atomic<bool> support_enabled_;
+  static grpc_core::Atomic<bool> support_enabled_;
   static bool override_enabled_;
   static child_postfork_func reset_child_polling_engine_;
 };
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/host_port.cc b/legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/host_port.cc
new file mode 100644 (file)
index 0000000..e7f0e44
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/gprpp/host_port.h"
+
+#include <string.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+
+#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/string_view.h"
+
+namespace grpc_core {
+int JoinHostPort(UniquePtr<char>* out, const char* host, int port) {
+  char* tmp;
+  int ret;
+  if (host[0] != '[' && strchr(host, ':') != nullptr) {
+    /* IPv6 literals must be enclosed in brackets. */
+    ret = gpr_asprintf(&tmp, "[%s]:%d", host, port);
+  } else {
+    /* Ordinary non-bracketed host:port. */
+    ret = gpr_asprintf(&tmp, "%s:%d", host, port);
+  }
+  out->reset(tmp);
+  return ret;
+}
+
+namespace {
+bool DoSplitHostPort(StringView name, StringView* host, StringView* port,
+                     bool* has_port) {
+  *has_port = false;
+  if (name[0] == '[') {
+    /* Parse a bracketed host, typically an IPv6 literal. */
+    const size_t rbracket = name.find(']', 1);
+    if (rbracket == grpc_core::StringView::npos) {
+      /* Unmatched [ */
+      return false;
+    }
+    if (rbracket == name.size() - 1) {
+      /* ]<end> */
+      port->clear();
+    } else if (name[rbracket + 1] == ':') {
+      /* ]:<port?> */
+      *port = name.substr(rbracket + 2, name.size() - rbracket - 2);
+      *has_port = true;
+    } else {
+      /* ]<invalid> */
+      return false;
+    }
+    *host = name.substr(1, rbracket - 1);
+    if (host->find(':') == grpc_core::StringView::npos) {
+      /* Require all bracketed hosts to contain a colon, because a hostname or
+         IPv4 address should never use brackets. */
+      host->clear();
+      return false;
+    }
+  } else {
+    size_t colon = name.find(':');
+    if (colon != grpc_core::StringView::npos &&
+        name.find(':', colon + 1) == grpc_core::StringView::npos) {
+      /* Exactly 1 colon.  Split into host:port. */
+      *host = name.substr(0, colon);
+      *port = name.substr(colon + 1, name.size() - colon - 1);
+      *has_port = true;
+    } else {
+      /* 0 or 2+ colons.  Bare hostname or IPv6 litearal. */
+      *host = name;
+      port->clear();
+    }
+  }
+  return true;
+}
+}  // namespace
+
+bool SplitHostPort(StringView name, StringView* host, StringView* port) {
+  bool unused;
+  return DoSplitHostPort(name, host, port, &unused);
+}
+
+bool SplitHostPort(StringView name, UniquePtr<char>* host,
+                   UniquePtr<char>* port) {
+  GPR_DEBUG_ASSERT(host != nullptr && *host == nullptr);
+  GPR_DEBUG_ASSERT(port != nullptr && *port == nullptr);
+  StringView host_view;
+  StringView port_view;
+  bool has_port;
+  const bool ret = DoSplitHostPort(name, &host_view, &port_view, &has_port);
+  if (ret) {
+    // We always set the host, but port is set only when DoSplitHostPort find a
+    // port in the string, to remain backward compatible with the old
+    // gpr_split_host_port API.
+    *host = host_view.dup();
+    if (has_port) {
+      *port = port_view.dup();
+    }
+  }
+  return ret;
+}
+}  // namespace grpc_core
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/host_port.h b/legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/host_port.h
new file mode 100644 (file)
index 0000000..9a0b492
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_GPRPP_HOST_PORT_H
+#define GRPC_CORE_LIB_GPRPP_HOST_PORT_H
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/gprpp/memory.h"
+#include "src/core/lib/gprpp/string_view.h"
+
+namespace grpc_core {
+
+/** Given a host and port, creates a newly-allocated string of the form
+   "host:port" or "[ho:st]:port", depending on whether the host contains colons
+   like an IPv6 literal.  If the host is already bracketed, then additional
+   brackets will not be added.
+
+   Usage is similar to gpr_asprintf: returns the number of bytes written
+   (excluding the final '\0'), and *out points to a string.
+
+   In the unlikely event of an error, returns -1 and sets *out to NULL. */
+int JoinHostPort(UniquePtr<char>* out, const char* host, int port);
+
+/** Given a name in the form "host:port" or "[ho:st]:port", split into hostname
+   and port number.
+
+   There are two variants of this method:
+   1) StringView output: port and host are returned as views on name.
+   2) char* output: port and host are copied into newly allocated strings.
+
+   Prefer variant (1) over (2), because no allocation or copy is performed in
+   variant (1).  Use (2) only when interacting with C API that mandate
+   null-terminated strings.
+
+   Return true on success, false on failure. Guarantees *host and *port are
+   cleared on failure. */
+bool SplitHostPort(StringView name, StringView* host, StringView* port);
+bool SplitHostPort(StringView name, UniquePtr<char>* host,
+                   UniquePtr<char>* port);
+
+}  // namespace grpc_core
+
+#endif /* GRPC_CORE_LIB_GPRPP_HOST_PORT_H */
index ffc3738..c5ae0e8 100644 (file)
@@ -100,16 +100,22 @@ class InlinedVector {
   bool operator==(const InlinedVector& other) const {
     if (size_ != other.size_) return false;
     for (size_t i = 0; i < size_; ++i) {
-      if (data()[i] != other.data()[i]) return false;
+      // Note that this uses == instead of != so that the data class doesn't
+      // have to implement !=.
+      if (!(data()[i] == other.data()[i])) return false;
     }
     return true;
   }
 
   void reserve(size_t capacity) {
     if (capacity > capacity_) {
-      T* new_dynamic = static_cast<T*>(gpr_malloc(sizeof(T) * capacity));
+      T* new_dynamic =
+          std::alignment_of<T>::value == 0
+              ? static_cast<T*>(gpr_malloc(sizeof(T) * capacity))
+              : static_cast<T*>(gpr_malloc_aligned(
+                    sizeof(T) * capacity, std::alignment_of<T>::value));
       move_elements(data(), new_dynamic, size_);
-      gpr_free(dynamic_);
+      free_dynamic();
       dynamic_ = new_dynamic;
       capacity_ = capacity;
     }
@@ -194,7 +200,17 @@ class InlinedVector {
       T& value = data()[i];
       value.~T();
     }
-    gpr_free(dynamic_);
+    free_dynamic();
+  }
+
+  void free_dynamic() {
+    if (dynamic_ != nullptr) {
+      if (std::alignment_of<T>::value == 0) {
+        gpr_free(dynamic_);
+      } else {
+        gpr_free_aligned(dynamic_);
+      }
+    }
   }
 
   typename std::aligned_storage<sizeof(T)>::type inline_[N];
index 36e32d6..6a41a97 100644 (file)
 #include <functional>
 #include <iterator>
 
+#if GRPC_USE_CPP_STD_LIB
+#include <map>
+#endif
+
 #include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/gprpp/pair.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/gprpp/string_view.h"
 
 namespace grpc_core {
+
 struct StringLess {
   bool operator()(const char* a, const char* b) const {
     return strcmp(a, b) < 0;
   }
-  bool operator()(const UniquePtr<char>& k1, const UniquePtr<char>& k2) {
-    return strcmp(k1.get(), k2.get()) < 0;
+  bool operator()(const UniquePtr<char>& a, const UniquePtr<char>& b) const {
+    return strcmp(a.get(), b.get()) < 0;
+  }
+  bool operator()(const StringView& a, const StringView& b) const {
+    const size_t min_size = std::min(a.size(), b.size());
+    int c = strncmp(a.data(), b.data(), min_size);
+    if (c != 0) return c < 0;
+    return a.size() < b.size();
+  }
+};
+
+template <typename T>
+struct RefCountedPtrLess {
+  bool operator()(const RefCountedPtr<T>& p1,
+                  const RefCountedPtr<T>& p2) const {
+    return p1.get() < p2.get();
   }
 };
 
+#if GRPC_USE_CPP_STD_LIB
+
+template <class Key, class T, class Compare = std::less<Key>>
+using Map = std::map<Key, T, Compare>;
+
+#else  // GRPC_USE_CPP_STD_LIB
+
 namespace testing {
 class MapTest;
 }
@@ -54,9 +82,43 @@ class Map {
   typedef Pair<key_type, mapped_type> value_type;
   typedef Compare key_compare;
   class iterator;
+  class const_iterator;
 
+  Map() = default;
   ~Map() { clear(); }
 
+  // Movable.
+  Map(Map&& other) : root_(other.root_), size_(other.size_) {
+    other.root_ = nullptr;
+    other.size_ = 0;
+  }
+  Map& operator=(Map&& other) {
+    if (this != &other) {
+      clear();
+      root_ = other.root_;
+      size_ = other.size_;
+      other.root_ = nullptr;
+      other.size_ = 0;
+    }
+    return *this;
+  }
+
+  // Copyable.
+  Map(const Map& other) {
+    for (const auto& p : other) {
+      emplace(p);
+    }
+  }
+  Map& operator=(const Map& other) {
+    if (this != &other) {
+      clear();
+      for (const auto& p : other) {
+        emplace(p);
+      }
+    }
+    return *this;
+  }
+
   T& operator[](key_type&& key);
   T& operator[](const key_type& key);
   iterator find(const key_type& k);
@@ -64,7 +126,7 @@ class Map {
   // Removes the current entry and points to the next one
   iterator erase(iterator iter);
 
-  size_t size() { return size_; }
+  size_t size() const { return size_; }
 
   template <class... Args>
   Pair<iterator, bool> emplace(Args&&... args);
@@ -91,8 +153,19 @@ class Map {
 
   iterator end() { return iterator(this, nullptr); }
 
+  const_iterator begin() const {
+    Entry* curr = GetMinEntry(root_);
+    return const_iterator(this, curr);
+  }
+
+  const_iterator end() const { return const_iterator(this, nullptr); }
+
   iterator lower_bound(const Key& k) {
-    key_compare compare;
+    // This is a workaround for "const key_compare compare;"
+    // because some versions of compilers cannot build this by requiring
+    // a user-provided constructor. (ref: https://stackoverflow.com/q/7411515)
+    key_compare compare_tmp;
+    const key_compare& compare = compare_tmp;
     return std::find_if(begin(), end(), [&k, &compare](const value_type& v) {
       return !compare(v.first, k);
     });
@@ -180,6 +253,53 @@ class Map<Key, T, Compare>::iterator
 };
 
 template <class Key, class T, class Compare>
+class Map<Key, T, Compare>::const_iterator
+    : public std::iterator<std::input_iterator_tag, Pair<Key, T>, int32_t,
+                           Pair<Key, T>*, Pair<Key, T>&> {
+ public:
+  const_iterator(const const_iterator& iter)
+      : curr_(iter.curr_), map_(iter.map_) {}
+  bool operator==(const const_iterator& rhs) const {
+    return (curr_ == rhs.curr_);
+  }
+  bool operator!=(const const_iterator& rhs) const {
+    return (curr_ != rhs.curr_);
+  }
+
+  const_iterator& operator++() {
+    curr_ = map_->InOrderSuccessor(curr_);
+    return *this;
+  }
+
+  const_iterator operator++(int) {
+    Entry* prev = curr_;
+    curr_ = map_->InOrderSuccessor(curr_);
+    return const_iterator(map_, prev);
+  }
+
+  const_iterator& operator=(const const_iterator& other) {
+    if (this != &other) {
+      this->curr_ = other.curr_;
+      this->map_ = other.map_;
+    }
+    return *this;
+  }
+
+  // operator*()
+  const value_type& operator*() const { return curr_->pair; }
+
+  // operator->()
+  const value_type* operator->() const { return &curr_->pair; }
+
+ private:
+  friend class Map<key_type, mapped_type, key_compare>;
+  using GrpcMap = typename ::grpc_core::Map<Key, T, Compare>;
+  const_iterator(const GrpcMap* map, Entry* curr) : curr_(curr), map_(map) {}
+  Entry* curr_;
+  const GrpcMap* map_;
+};
+
+template <class Key, class T, class Compare>
 T& Map<Key, T, Compare>::operator[](key_type&& key) {
   auto iter = find(key);
   if (iter == end()) {
@@ -423,7 +543,11 @@ Map<Key, T, Compare>::RemoveRecursive(Entry* root, const key_type& k) {
 template <class Key, class T, class Compare>
 int Map<Key, T, Compare>::CompareKeys(const key_type& lhs,
                                       const key_type& rhs) {
-  key_compare compare;
+  // This is a workaround for "const key_compare compare;"
+  // because some versions of compilers cannot build this by requiring
+  // a user-provided constructor. (ref: https://stackoverflow.com/q/7411515)
+  key_compare compare_tmp;
+  const key_compare& compare = compare_tmp;
   bool left_comparison = compare(lhs, rhs);
   bool right_comparison = compare(rhs, lhs);
   // Both values are equal
@@ -432,5 +556,9 @@ int Map<Key, T, Compare>::CompareKeys(const key_type& lhs,
   }
   return left_comparison ? -1 : 1;
 }
+
+#endif  // GRPC_USE_CPP_STD_LIB
+
 }  // namespace grpc_core
+
 #endif /* GRPC_CORE_LIB_GPRPP_MAP_H */
index 70ad430..be158d1 100644 (file)
@@ -22,6 +22,7 @@
 #include <grpc/support/port_platform.h>
 
 #include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
 
 #include <limits>
 #include <memory>
 
 // Add this to a class that want to use Delete(), but has a private or
 // protected destructor.
-#define GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE \
-  template <typename T>                           \
-  friend void grpc_core::Delete(T*);
+// Should not be used in new code.
+// TODO(juanlishen): Remove this macro, and instead comment that the public dtor
+// should not be used directly.
+#define GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE         \
+  template <typename _Delete_T, bool _Delete_can_be_null> \
+  friend void ::grpc_core::Delete(_Delete_T*);            \
+  template <typename _Delete_T>                           \
+  friend void ::grpc_core::Delete(_Delete_T*);
+
 // Add this to a class that want to use New(), but has a private or
 // protected constructor.
-#define GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW \
-  template <typename T, typename... Args>      \
-  friend T* grpc_core::New(Args&&...);
+// Should not be used in new code.
+// TODO(juanlishen): Remove this macro, and instead comment that the public dtor
+// should not be used directly.
+#define GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW      \
+  template <typename _New_T, typename... _New_Args> \
+  friend _New_T* grpc_core::New(_New_Args&&...);
 
 namespace grpc_core {
 
@@ -48,17 +58,30 @@ inline T* New(Args&&... args) {
 }
 
 // Alternative to delete, since we cannot use it (for fear of libstdc++)
-template <typename T>
+// We cannot add a default value for can_be_null, because they are used as
+// as friend template methods where we cannot define a default value.
+// Instead we simply define two variants, one with and one without the boolean
+// argument.
+template <typename T, bool can_be_null>
 inline void Delete(T* p) {
-  if (p == nullptr) return;
+  GPR_DEBUG_ASSERT(can_be_null || p != nullptr);
+  if (can_be_null && p == nullptr) return;
   p->~T();
   gpr_free(p);
 }
+template <typename T>
+inline void Delete(T* p) {
+  Delete<T, /*can_be_null=*/true>(p);
+}
 
 template <typename T>
 class DefaultDelete {
  public:
-  void operator()(T* p) { Delete(p); }
+  void operator()(T* p) {
+    // std::unique_ptr is gauranteed not to call the deleter
+    // if the pointer is nullptr.
+    Delete<T, /*can_be_null=*/false>(p);
+  }
 };
 
 template <typename T, typename Deleter = DefaultDelete<T>>
index cab1aaa..5c7a5cf 100644 (file)
@@ -89,72 +89,114 @@ class RefCount {
   }
 
   // Increases the ref-count by `n`.
-  void Ref(Value n = 1) { value_.FetchAdd(n, MemoryOrder::RELAXED); }
+  void Ref(Value n = 1) {
+#ifndef NDEBUG
+    const Value prior = value_.FetchAdd(n, MemoryOrder::RELAXED);
+    if (trace_flag_ != nullptr && trace_flag_->enabled()) {
+      gpr_log(GPR_INFO, "%s:%p ref %" PRIdPTR " -> %" PRIdPTR,
+              trace_flag_->name(), this, prior, prior + n);
+    }
+#else
+    value_.FetchAdd(n, MemoryOrder::RELAXED);
+#endif
+  }
   void Ref(const DebugLocation& location, const char* reason, Value n = 1) {
 #ifndef NDEBUG
-    if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
-      const RefCount::Value old_refs = get();
+    const Value prior = value_.FetchAdd(n, MemoryOrder::RELAXED);
+    if (trace_flag_ != nullptr && trace_flag_->enabled()) {
       gpr_log(GPR_INFO, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s",
               trace_flag_->name(), this, location.file(), location.line(),
-              old_refs, old_refs + n, reason);
+              prior, prior + n, reason);
     }
+#else
+    value_.FetchAdd(n, MemoryOrder::RELAXED);
 #endif
-    Ref(n);
   }
 
   // Similar to Ref() with an assert on the ref-count being non-zero.
   void RefNonZero() {
 #ifndef NDEBUG
     const Value prior = value_.FetchAdd(1, MemoryOrder::RELAXED);
+    if (trace_flag_ != nullptr && trace_flag_->enabled()) {
+      gpr_log(GPR_INFO, "%s:%p ref %" PRIdPTR " -> %" PRIdPTR,
+              trace_flag_->name(), this, prior, prior + 1);
+    }
     assert(prior > 0);
 #else
-    Ref();
+    value_.FetchAdd(1, MemoryOrder::RELAXED);
 #endif
   }
   void RefNonZero(const DebugLocation& location, const char* reason) {
 #ifndef NDEBUG
-    if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
-      const RefCount::Value old_refs = get();
+    const Value prior = value_.FetchAdd(1, MemoryOrder::RELAXED);
+    if (trace_flag_ != nullptr && trace_flag_->enabled()) {
       gpr_log(GPR_INFO, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s",
               trace_flag_->name(), this, location.file(), location.line(),
-              old_refs, old_refs + 1, reason);
+              prior, prior + 1, reason);
     }
-#endif
+    assert(prior > 0);
+#else
     RefNonZero();
+#endif
   }
 
-  bool RefIfNonZero() { return value_.IncrementIfNonzero(); }
-
+  bool RefIfNonZero() {
+#ifndef NDEBUG
+    if (trace_flag_ != nullptr && trace_flag_->enabled()) {
+      const Value prior = get();
+      gpr_log(GPR_INFO, "%s:%p ref_if_non_zero %" PRIdPTR " -> %" PRIdPTR,
+              trace_flag_->name(), this, prior, prior + 1);
+    }
+#endif
+    return value_.IncrementIfNonzero();
+  }
   bool RefIfNonZero(const DebugLocation& location, const char* reason) {
 #ifndef NDEBUG
-    if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
-      const RefCount::Value old_refs = get();
+    if (trace_flag_ != nullptr && trace_flag_->enabled()) {
+      const Value prior = get();
       gpr_log(GPR_INFO,
               "%s:%p %s:%d ref_if_non_zero "
               "%" PRIdPTR " -> %" PRIdPTR " %s",
               trace_flag_->name(), this, location.file(), location.line(),
-              old_refs, old_refs + 1, reason);
+              prior, prior + 1, reason);
     }
 #endif
-    return RefIfNonZero();
+    return value_.IncrementIfNonzero();
   }
 
   // Decrements the ref-count and returns true if the ref-count reaches 0.
   bool Unref() {
+#ifndef NDEBUG
+    // Grab a copy of the trace flag before the atomic change, since we
+    // can't safely access it afterwards if we're going to be freed.
+    auto* trace_flag = trace_flag_;
+#endif
     const Value prior = value_.FetchSub(1, MemoryOrder::ACQ_REL);
+#ifndef NDEBUG
+    if (trace_flag != nullptr && trace_flag->enabled()) {
+      gpr_log(GPR_INFO, "%s:%p unref %" PRIdPTR " -> %" PRIdPTR,
+              trace_flag->name(), this, prior, prior - 1);
+    }
     GPR_DEBUG_ASSERT(prior > 0);
+#endif
     return prior == 1;
   }
   bool Unref(const DebugLocation& location, const char* reason) {
 #ifndef NDEBUG
-    if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
-      const RefCount::Value old_refs = get();
+    // Grab a copy of the trace flag before the atomic change, since we
+    // can't safely access it afterwards if we're going to be freed.
+    auto* trace_flag = trace_flag_;
+#endif
+    const Value prior = value_.FetchSub(1, MemoryOrder::ACQ_REL);
+#ifndef NDEBUG
+    if (trace_flag != nullptr && trace_flag->enabled()) {
       gpr_log(GPR_INFO, "%s:%p %s:%d unref %" PRIdPTR " -> %" PRIdPTR " %s",
-              trace_flag_->name(), this, location.file(), location.line(),
-              old_refs, old_refs - 1, reason);
+              trace_flag->name(), this, location.file(), location.line(), prior,
+              prior - 1, reason);
     }
+    GPR_DEBUG_ASSERT(prior > 0);
 #endif
-    return Unref();
+    return prior == 1;
   }
 
  private:
index 19f38d7..2e3f467 100644 (file)
@@ -103,6 +103,8 @@ class RefCountedPtr {
     if (value_ != nullptr) value_->Unref();
   }
 
+  void swap(RefCountedPtr& other) { std::swap(value_, other.value_); }
+
   // If value is non-null, we take ownership of a ref to it.
   void reset(T* value = nullptr) {
     if (value_ != nullptr) value_->Unref();
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/string_view.h b/legacy-libs/grpc/deps/grpc/src/core/lib/gprpp/string_view.h
new file mode 100644 (file)
index 0000000..05a8106
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef GRPC_CORE_LIB_GPRPP_STRING_VIEW_H
+#define GRPC_CORE_LIB_GPRPP_STRING_VIEW_H
+
+#include <grpc/support/port_platform.h>
+
+#include <grpc/impl/codegen/slice.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+
+#include <algorithm>
+#include <cstdint>
+#include <cstring>
+#include <limits>
+
+#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/memory.h"
+
+namespace grpc_core {
+
+// Provides a light-weight view over a char array or a slice, similar but not
+// identical to absl::string_view.
+//
+// Any method that has the same name as absl::string_view MUST HAVE identical
+// semantics to what absl::string_view provides.
+//
+// Methods that are not part of absl::string_view API, must be clearly
+// annotated.
+//
+// StringView does not own the buffers that back the view. Callers must ensure
+// the buffer stays around while the StringView is accessible.
+//
+// Pass StringView by value in functions, since it is exactly two pointers in
+// size.
+//
+// The interface used here is not identical to absl::string_view. Notably, we
+// need to support slices while we cannot support std::string, and gpr string
+// style functions such as strdup() and cmp(). Once we switch to
+// absl::string_view this class will inherit from absl::string_view and add the
+// gRPC-specific APIs.
+class StringView final {
+ public:
+  static constexpr size_t npos = std::numeric_limits<size_t>::max();
+
+  constexpr StringView(const char* ptr, size_t size) : ptr_(ptr), size_(size) {}
+  constexpr StringView(const char* ptr)
+      : StringView(ptr, ptr == nullptr ? 0 : strlen(ptr)) {}
+  // Not part of absl::string_view API.
+  StringView(const grpc_slice& slice)
+      : StringView(reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(slice)),
+                   GRPC_SLICE_LENGTH(slice)) {}
+  constexpr StringView() : StringView(nullptr, 0) {}
+
+  constexpr const char* data() const { return ptr_; }
+  constexpr size_t size() const { return size_; }
+  constexpr bool empty() const { return size_ == 0; }
+
+  StringView substr(size_t start, size_t size = npos) {
+    GPR_DEBUG_ASSERT(start + size <= size_);
+    return StringView(ptr_ + start, std::min(size, size_ - start));
+  }
+
+  constexpr const char& operator[](size_t i) const { return ptr_[i]; }
+
+  const char& front() const { return ptr_[0]; }
+  const char& back() const { return ptr_[size_ - 1]; }
+
+  void remove_prefix(size_t n) {
+    GPR_DEBUG_ASSERT(n <= size_);
+    ptr_ += n;
+    size_ -= n;
+  }
+
+  void remove_suffix(size_t n) {
+    GPR_DEBUG_ASSERT(n <= size_);
+    size_ -= n;
+  }
+
+  size_t find(char c, size_t pos = 0) const {
+    if (empty() || pos >= size_) return npos;
+    const char* result =
+        static_cast<const char*>(memchr(ptr_ + pos, c, size_ - pos));
+    return result != nullptr ? result - ptr_ : npos;
+  }
+
+  void clear() {
+    ptr_ = nullptr;
+    size_ = 0;
+  }
+
+  // Creates a dup of the string viewed by this class.
+  // Return value is null-terminated and never nullptr.
+  //
+  // Not part of absl::string_view API.
+  grpc_core::UniquePtr<char> dup() const {
+    char* str = static_cast<char*>(gpr_malloc(size_ + 1));
+    if (size_ > 0) memcpy(str, ptr_, size_);
+    str[size_] = '\0';
+    return grpc_core::UniquePtr<char>(str);
+  }
+
+  // Not part of absl::string_view API.
+  int cmp(StringView other) const {
+    const size_t len = GPR_MIN(size(), other.size());
+    const int ret = strncmp(data(), other.data(), len);
+    if (ret != 0) return ret;
+    if (size() == other.size()) return 0;
+    if (size() < other.size()) return -1;
+    return 1;
+  }
+
+ private:
+  const char* ptr_;
+  size_t size_;
+};
+
+inline bool operator==(StringView lhs, StringView rhs) {
+  return lhs.size() == rhs.size() &&
+         strncmp(lhs.data(), rhs.data(), lhs.size()) == 0;
+}
+
+inline bool operator!=(StringView lhs, StringView rhs) { return !(lhs == rhs); }
+
+}  // namespace grpc_core
+
+#endif /* GRPC_CORE_LIB_GPRPP_STRING_VIEW_H */
index cae7070..0af33fa 100644 (file)
@@ -49,7 +49,7 @@ class Thread {
  public:
   class Options {
    public:
-    Options() : joinable_(true), tracked_(true) {}
+    Options() : joinable_(true), tracked_(true), stack_size_(0) {}
     /// Set whether the thread is joinable or detached.
     Options& set_joinable(bool joinable) {
       joinable_ = joinable;
@@ -64,9 +64,18 @@ class Thread {
     }
     bool tracked() const { return tracked_; }
 
+    /// Sets thread stack size (in bytes). Sets to 0 will use the default stack
+    /// size which is 64KB for Windows threads and 2MB for Posix(x86) threads.
+    Options& set_stack_size(size_t bytes) {
+      stack_size_ = bytes;
+      return *this;
+    }
+    size_t stack_size() const { return stack_size_; }
+
    private:
     bool joinable_;
     bool tracked_;
+    size_t stack_size_;
   };
   /// Default constructor only to allow use in structs that lack constructors
   /// Does not produce a validly-constructed thread; must later
index 2893208..2c3ae34 100644 (file)
@@ -31,6 +31,7 @@
 #include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/fork.h"
@@ -48,6 +49,25 @@ struct thd_arg {
   bool tracked;
 };
 
+size_t RoundUpToPageSize(size_t size) {
+  // TODO(yunjiaw): Change this variable (page_size) to a function-level static
+  // when possible
+  size_t page_size = static_cast<size_t>(sysconf(_SC_PAGESIZE));
+  return (size + page_size - 1) & ~(page_size - 1);
+}
+
+// Returns the minimum valid stack size that can be passed to
+// pthread_attr_setstacksize.
+size_t MinValidStackSize(size_t request_size) {
+  if (request_size < _SC_THREAD_STACK_MIN) {
+    request_size = _SC_THREAD_STACK_MIN;
+  }
+
+  // On some systems, pthread_attr_setstacksize() can fail if stacksize is
+  // not a multiple of the system page size.
+  return RoundUpToPageSize(request_size);
+}
+
 class ThreadInternalsPosix : public internal::ThreadInternalsInterface {
  public:
   ThreadInternalsPosix(const char* thd_name, void (*thd_body)(void* arg),
@@ -79,6 +99,11 @@ class ThreadInternalsPosix : public internal::ThreadInternalsInterface {
                  0);
     }
 
+    if (options.stack_size() != 0) {
+      size_t stack_size = MinValidStackSize(options.stack_size());
+      GPR_ASSERT(pthread_attr_setstacksize(&attr, stack_size) == 0);
+    }
+
     *success =
         (pthread_create(&pthread_id_, &attr,
                         [](void* v) -> void* {
index bbb48a5..5014444 100644 (file)
@@ -75,7 +75,15 @@ class ThreadInternalsWindows
         return;
       }
     }
-    handle = CreateThread(nullptr, 64 * 1024, thread_body, info_, 0, nullptr);
+
+    if (options.stack_size() != 0) {
+      // Windows will round up the given stack_size value to nearest page.
+      handle = CreateThread(nullptr, options.stack_size(), thread_body, info_,
+                            0, nullptr);
+    } else {
+      handle = CreateThread(nullptr, 64 * 1024, thread_body, info_, 0, nullptr);
+    }
+
     if (handle == nullptr) {
       destroy_thread();
       *success = false;
index 762cbe4..8196019 100644 (file)
@@ -30,6 +30,7 @@
 #include "src/core/lib/channel/handshaker_registry.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/gprpp/string_view.h"
 #include "src/core/lib/iomgr/pollset.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "src/core/lib/security/security_connector/ssl_utils.h"
@@ -108,7 +109,8 @@ class grpc_httpcli_ssl_channel_security_connector final
     return strcmp(secure_peer_name_, other->secure_peer_name_);
   }
 
-  bool check_call_host(const char* host, grpc_auth_context* auth_context,
+  bool check_call_host(grpc_core::StringView host,
+                       grpc_auth_context* auth_context,
                        grpc_closure* on_call_host_checked,
                        grpc_error** error) override {
     *error = GRPC_ERROR_NONE;
index 8d01386..c1e7d67 100644 (file)
@@ -25,6 +25,7 @@
 #import <CoreFoundation/CoreFoundation.h>
 #import "src/core/lib/iomgr/cfstream_handle.h"
 
+#include <grpc/grpc.h>
 #include <grpc/support/atm.h>
 #include <grpc/support/sync.h>
 
 
 extern grpc_core::TraceFlag grpc_tcp_trace;
 
+GrpcLibraryInitHolder::GrpcLibraryInitHolder() { grpc_init(); }
+
+GrpcLibraryInitHolder::~GrpcLibraryInitHolder() { grpc_shutdown(); }
+
 void* CFStreamHandle::Retain(void* info) {
   CFStreamHandle* handle = static_cast<CFStreamHandle*>(info);
   CFSTREAM_HANDLE_REF(handle, "retain");
@@ -184,7 +189,7 @@ void CFStreamHandle::Ref(const char* file, int line, const char* reason) {
 void CFStreamHandle::Unref(const char* file, int line, const char* reason) {
   if (grpc_tcp_trace.enabled()) {
     gpr_atm val = gpr_atm_no_barrier_load(&refcount_.count);
-    gpr_log(GPR_ERROR,
+    gpr_log(GPR_DEBUG,
             "CFStream Handle unref %p : %s %" PRIdPTR " -> %" PRIdPTR, this,
             reason, val, val - 1);
   }
index 05f45ed..5f3a525 100644 (file)
 #include "src/core/lib/iomgr/closure.h"
 #include "src/core/lib/iomgr/lockfree_event.h"
 
-class CFStreamHandle final {
+class GrpcLibraryInitHolder {
+ public:
+  GrpcLibraryInitHolder();
+  virtual ~GrpcLibraryInitHolder();
+};
+
+class CFStreamHandle : public GrpcLibraryInitHolder {
  public:
   static CFStreamHandle* CreateStreamHandle(CFReadStreamRef read_stream,
                                             CFWriteStreamRef write_stream);
-  ~CFStreamHandle();
+  ~CFStreamHandle() override;
   CFStreamHandle(const CFStreamHandle& ref) = delete;
   CFStreamHandle(CFStreamHandle&& ref) = delete;
   CFStreamHandle& operator=(const CFStreamHandle& rhs) = delete;
index 4fc4a9d..9a6290f 100644 (file)
@@ -233,11 +233,11 @@ bool grpc_combiner_continue_exec_ctx() {
   // offload only if all the following conditions are true:
   // 1. the combiner is contended and has more than one closure to execute
   // 2. the current execution context needs to finish as soon as possible
-  // 3. the DEFAULT executor is threaded
-  // 4. the current thread is not a worker for any background poller
+  // 3. the current thread is not a worker for any background poller
+  // 4. the DEFAULT executor is threaded
   if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() &&
-      grpc_core::Executor::IsThreadedDefault() &&
-      !grpc_iomgr_is_any_background_poller_thread()) {
+      !grpc_iomgr_is_any_background_poller_thread() &&
+      grpc_core::Executor::IsThreadedDefault()) {
     GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0);
     // this execution context wants to move on: schedule remaining work to be
     // picked up on the executor
index ebec9dc..dedc837 100644 (file)
@@ -73,6 +73,8 @@ static const char* error_int_name(grpc_error_ints key) {
       return "limit";
     case GRPC_ERROR_INT_OCCURRED_DURING_WRITE:
       return "occurred_during_write";
+    case GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE:
+      return "channel_connectivity_state";
     case GRPC_ERROR_INT_MAX:
       GPR_UNREACHABLE_CODE(return "unknown");
   }
@@ -447,13 +449,17 @@ grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which,
 typedef struct {
   grpc_status_code code;
   const char* msg;
+  size_t len;
 } special_error_status_map;
-static const special_error_status_map error_status_map[] = {
-    {GRPC_STATUS_OK, ""},                               // GRPC_ERROR_NONE
-    {GRPC_STATUS_INVALID_ARGUMENT, ""},                 // GRPC_ERROR_RESERVED_1
-    {GRPC_STATUS_RESOURCE_EXHAUSTED, "Out of memory"},  // GRPC_ERROR_OOM
-    {GRPC_STATUS_INVALID_ARGUMENT, ""},                 // GRPC_ERROR_RESERVED_2
-    {GRPC_STATUS_CANCELLED, "Cancelled"},               // GRPC_ERROR_CANCELLED
+
+const special_error_status_map error_status_map[] = {
+    {GRPC_STATUS_OK, "", 0},                // GRPC_ERROR_NONE
+    {GRPC_STATUS_INVALID_ARGUMENT, "", 0},  // GRPC_ERROR_RESERVED_1
+    {GRPC_STATUS_RESOURCE_EXHAUSTED, "Out of memory",
+     strlen("Out of memory")},              // GRPC_ERROR_OOM
+    {GRPC_STATUS_INVALID_ARGUMENT, "", 0},  // GRPC_ERROR_RESERVED_2
+    {GRPC_STATUS_CANCELLED, "Cancelled",
+     strlen("Cancelled")},  // GRPC_ERROR_CANCELLED
 };
 
 bool grpc_error_get_int(grpc_error* err, grpc_error_ints which, intptr_t* p) {
@@ -483,8 +489,12 @@ bool grpc_error_get_str(grpc_error* err, grpc_error_strs which,
                         grpc_slice* str) {
   if (grpc_error_is_special(err)) {
     if (which != GRPC_ERROR_STR_GRPC_MESSAGE) return false;
-    *str = grpc_slice_from_static_string(
-        error_status_map[reinterpret_cast<size_t>(err)].msg);
+    const special_error_status_map& msg =
+        error_status_map[reinterpret_cast<size_t>(err)];
+    str->refcount = &grpc_core::kNoopRefcount;
+    str->data.refcounted.bytes =
+        reinterpret_cast<uint8_t*>(const_cast<char*>(msg.msg));
+    str->data.refcounted.length = msg.len;
     return true;
   }
   uint8_t slot = err->strs[which];
index 0a72e5c..8c22357 100644 (file)
@@ -73,6 +73,8 @@ typedef enum {
   GRPC_ERROR_INT_LIMIT,
   /// chttp2: did the error occur while a write was in progress
   GRPC_ERROR_INT_OCCURRED_DURING_WRITE,
+  /// channel connectivity state associated with the error
+  GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE,
 
   /// Must always be last
   GRPC_ERROR_INT_MAX,
index 08116b3..4a83cb6 100644 (file)
@@ -47,6 +47,7 @@
 #include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/inlined_vector.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
+#include "src/core/lib/gprpp/ref_counted.h"
 #include "src/core/lib/gprpp/sync.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/iomgr_internal.h"
@@ -89,7 +90,7 @@ typedef struct pollable pollable;
 ///  - PO_MULTI - a pollable containing many fds
 struct pollable {
   pollable_type type;  // immutable
-  gpr_refcount refs;
+  grpc_core::RefCount refs;
 
   int epfd;
   grpc_wakeup_fd wakeup;
@@ -135,17 +136,26 @@ static char* pollable_desc(pollable* p) {
 static pollable* g_empty_pollable;
 
 static grpc_error* pollable_create(pollable_type type, pollable** p);
-#ifdef NDEBUG
-static pollable* pollable_ref(pollable* p);
-static void pollable_unref(pollable* p);
-#define POLLABLE_REF(p, r) pollable_ref(p)
-#define POLLABLE_UNREF(p, r) pollable_unref(p)
-#else
-static pollable* pollable_ref(pollable* p, int line, const char* reason);
-static void pollable_unref(pollable* p, int line, const char* reason);
-#define POLLABLE_REF(p, r) pollable_ref((p), __LINE__, (r))
-#define POLLABLE_UNREF(p, r) pollable_unref((p), __LINE__, (r))
-#endif
+static pollable* pollable_ref(pollable* p,
+                              const grpc_core::DebugLocation& dbg_loc,
+                              const char* reason) {
+  p->refs.Ref(dbg_loc, reason);
+  return p;
+}
+static void pollable_unref(pollable* p, const grpc_core::DebugLocation& dbg_loc,
+                           const char* reason) {
+  if (p == nullptr) return;
+  if (GPR_UNLIKELY(p != nullptr && p->refs.Unref(dbg_loc, reason))) {
+    GRPC_FD_TRACE("pollable_unref: Closing epfd: %d", p->epfd);
+    close(p->epfd);
+    grpc_wakeup_fd_destroy(&p->wakeup);
+    gpr_mu_destroy(&p->owner_orphan_mu);
+    gpr_mu_destroy(&p->mu);
+    gpr_free(p);
+  }
+}
+#define POLLABLE_REF(p, r) pollable_ref((p), DEBUG_LOCATION, (r))
+#define POLLABLE_UNREF(p, r) pollable_unref((p), DEBUG_LOCATION, (r))
 
 /*******************************************************************************
  * Fd Declarations
@@ -283,7 +293,7 @@ struct grpc_pollset {
  */
 
 struct grpc_pollset_set {
-  gpr_refcount refs;
+  grpc_core::RefCount refs;
   gpr_mu mu;
   grpc_pollset_set* parent;
 
@@ -568,7 +578,7 @@ static grpc_error* pollable_create(pollable_type type, pollable** p) {
   }
 
   (*p)->type = type;
-  gpr_ref_init(&(*p)->refs, 1);
+  new (&(*p)->refs) grpc_core::RefCount(1, &grpc_trace_pollable_refcount);
   gpr_mu_init(&(*p)->mu);
   (*p)->epfd = epfd;
   (*p)->owner_fd = nullptr;
@@ -582,41 +592,6 @@ static grpc_error* pollable_create(pollable_type type, pollable** p) {
   return GRPC_ERROR_NONE;
 }
 
-#ifdef NDEBUG
-static pollable* pollable_ref(pollable* p) {
-#else
-static pollable* pollable_ref(pollable* p, int line, const char* reason) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_pollable_refcount)) {
-    int r = static_cast<int> gpr_atm_no_barrier_load(&p->refs.count);
-    gpr_log(__FILE__, line, GPR_LOG_SEVERITY_DEBUG,
-            "POLLABLE:%p   ref %d->%d %s", p, r, r + 1, reason);
-  }
-#endif
-  gpr_ref(&p->refs);
-  return p;
-}
-
-#ifdef NDEBUG
-static void pollable_unref(pollable* p) {
-#else
-static void pollable_unref(pollable* p, int line, const char* reason) {
-  if (p == nullptr) return;
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_pollable_refcount)) {
-    int r = static_cast<int> gpr_atm_no_barrier_load(&p->refs.count);
-    gpr_log(__FILE__, line, GPR_LOG_SEVERITY_DEBUG,
-            "POLLABLE:%p unref %d->%d %s", p, r, r - 1, reason);
-  }
-#endif
-  if (p != nullptr && gpr_unref(&p->refs)) {
-    GRPC_FD_TRACE("pollable_unref: Closing epfd: %d", p->epfd);
-    close(p->epfd);
-    grpc_wakeup_fd_destroy(&p->wakeup);
-    gpr_mu_destroy(&p->owner_orphan_mu);
-    gpr_mu_destroy(&p->mu);
-    gpr_free(p);
-  }
-}
-
 static grpc_error* pollable_add_fd(pollable* p, grpc_fd* fd) {
   grpc_error* error = GRPC_ERROR_NONE;
   static const char* err_desc = "pollable_add_fd";
@@ -1102,7 +1077,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
 }
 
 #ifndef NDEBUG
-static long gettid(void) { return syscall(__NR_gettid); }
+static long sys_gettid(void) { return syscall(__NR_gettid); }
 #endif
 
 /* pollset->mu lock must be held by the caller before calling this.
@@ -1122,7 +1097,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
 #define WORKER_PTR (&worker)
 #endif
 #ifndef NDEBUG
-  WORKER_PTR->originator = gettid();
+  WORKER_PTR->originator = sys_gettid();
 #endif
   if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
     gpr_log(GPR_INFO,
@@ -1331,13 +1306,13 @@ static grpc_pollset_set* pollset_set_create(void) {
   grpc_pollset_set* pss =
       static_cast<grpc_pollset_set*>(gpr_zalloc(sizeof(*pss)));
   gpr_mu_init(&pss->mu);
-  gpr_ref_init(&pss->refs, 1);
+  new (&pss->refs) grpc_core::RefCount();
   return pss;
 }
 
 static void pollset_set_unref(grpc_pollset_set* pss) {
   if (pss == nullptr) return;
-  if (!gpr_unref(&pss->refs)) return;
+  if (GPR_LIKELY(!pss->refs.Unref())) return;
   pollset_set_unref(pss->parent);
   gpr_mu_destroy(&pss->mu);
   for (size_t i = 0; i < pss->pollset_count; i++) {
@@ -1528,7 +1503,7 @@ static void pollset_set_add_pollset_set(grpc_pollset_set* a,
   if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
     gpr_log(GPR_INFO, "PSS: parent %p to %p", b, a);
   }
-  gpr_ref(&a->refs);
+  a->refs.Ref();
   b->parent = a;
   if (a->fd_capacity < a->fd_count + b->fd_count) {
     a->fd_capacity = GPR_MAX(2 * a->fd_capacity, a->fd_count + b->fd_count);
index 92f81c2..02e4da1 100644 (file)
@@ -206,7 +206,8 @@ void grpc_register_event_engine_factory(const char* name,
   GPR_ASSERT(false);
 }
 
-/* Call this only after calling grpc_event_engine_init() */
+/*If grpc_event_engine_init() has been called, returns the poll_strategy_name.
+ * Otherwise, returns nullptr. */
 const char* grpc_get_poll_strategy_name() { return g_poll_strategy_name; }
 
 void grpc_event_engine_init(void) {
@@ -246,7 +247,8 @@ bool grpc_event_engine_can_track_errors(void) {
 }
 
 bool grpc_event_engine_run_in_background(void) {
-  return g_event_engine->run_in_background;
+  // g_event_engine is nullptr when using a custom iomgr.
+  return g_event_engine != nullptr && g_event_engine->run_in_background;
 }
 
 grpc_fd* grpc_fd_create(int fd, const char* name, bool track_err) {
index f45def4..730237a 100644 (file)
@@ -52,16 +52,9 @@ static void exec_ctx_sched(grpc_closure* closure, grpc_error* error) {
 }
 
 static gpr_timespec g_start_time;
+static gpr_cycle_counter g_start_cycle;
 
-// For debug of the timer manager crash only.
-// TODO (mxyan): remove after bug is fixed.
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-extern int64_t g_start_time_sec;
-extern int64_t g_start_time_nsec;
-#endif  // GRPC_DEBUG_TIMER_MANAGER
-
-static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) {
-  ts = gpr_time_sub(ts, g_start_time);
+static grpc_millis timespan_to_millis_round_down(gpr_timespec ts) {
   double x = GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) +
              static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS;
   if (x < 0) return 0;
@@ -69,8 +62,11 @@ static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) {
   return static_cast<grpc_millis>(x);
 }
 
-static grpc_millis timespec_to_millis_round_up(gpr_timespec ts) {
-  ts = gpr_time_sub(ts, g_start_time);
+static grpc_millis timespec_to_millis_round_down(gpr_timespec ts) {
+  return timespan_to_millis_round_down(gpr_time_sub(ts, g_start_time));
+}
+
+static grpc_millis timespan_to_millis_round_up(gpr_timespec ts) {
   double x = GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) +
              static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS +
              static_cast<double>(GPR_NS_PER_SEC - 1) /
@@ -80,6 +76,10 @@ static grpc_millis timespec_to_millis_round_up(gpr_timespec ts) {
   return static_cast<grpc_millis>(x);
 }
 
+static grpc_millis timespec_to_millis_round_up(gpr_timespec ts) {
+  return timespan_to_millis_round_up(gpr_time_sub(ts, g_start_time));
+}
+
 gpr_timespec grpc_millis_to_timespec(grpc_millis millis,
                                      gpr_clock_type clock_type) {
   // special-case infinities as grpc_millis can be 32bit on some platforms
@@ -108,6 +108,16 @@ grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec ts) {
       gpr_convert_clock_type(ts, g_start_time.clock_type));
 }
 
+grpc_millis grpc_cycle_counter_to_millis_round_down(gpr_cycle_counter cycles) {
+  return timespan_to_millis_round_down(
+      gpr_cycle_counter_sub(cycles, g_start_cycle));
+}
+
+grpc_millis grpc_cycle_counter_to_millis_round_up(gpr_cycle_counter cycles) {
+  return timespan_to_millis_round_up(
+      gpr_cycle_counter_sub(cycles, g_start_cycle));
+}
+
 static const grpc_closure_scheduler_vtable exec_ctx_scheduler_vtable = {
     exec_ctx_run, exec_ctx_sched, "exec_ctx"};
 static grpc_closure_scheduler exec_ctx_scheduler = {&exec_ctx_scheduler_vtable};
@@ -124,13 +134,13 @@ void ExecCtx::TestOnlyGlobalInit(gpr_timespec new_val) {
 }
 
 void ExecCtx::GlobalInit(void) {
+  // gpr_now(GPR_CLOCK_MONOTONIC) incurs a syscall. We don't actually know the
+  // exact cycle the time was captured, so we use the average of cycles before
+  // and after the syscall as the starting cycle.
+  const gpr_cycle_counter cycle_before = gpr_get_cycle_counter();
   g_start_time = gpr_now(GPR_CLOCK_MONOTONIC);
-  // For debug of the timer manager crash only.
-  // TODO (mxyan): remove after bug is fixed.
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-  g_start_time_sec = g_start_time.tv_sec;
-  g_start_time_nsec = g_start_time.tv_nsec;
-#endif
+  const gpr_cycle_counter cycle_after = gpr_get_cycle_counter();
+  g_start_cycle = (cycle_before + cycle_after) / 2;
   gpr_tls_init(&exec_ctx_);
 }
 
index daf019c..0ccf2a8 100644 (file)
@@ -26,6 +26,7 @@
 #include <grpc/support/cpu.h>
 #include <grpc/support/log.h>
 
+#include "src/core/lib/gpr/time_precise.h"
 #include "src/core/lib/gpr/tls.h"
 #include "src/core/lib/gprpp/fork.h"
 #include "src/core/lib/iomgr/closure.h"
@@ -58,6 +59,8 @@ extern grpc_closure_scheduler* grpc_schedule_on_exec_ctx;
 gpr_timespec grpc_millis_to_timespec(grpc_millis millis, gpr_clock_type clock);
 grpc_millis grpc_timespec_to_millis_round_down(gpr_timespec timespec);
 grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec timespec);
+grpc_millis grpc_cycle_counter_to_millis_round_down(gpr_cycle_counter cycles);
+grpc_millis grpc_cycle_counter_to_millis_round_up(gpr_cycle_counter cycles);
 
 namespace grpc_core {
 /** Execution context.
index 8adc090..7215425 100644 (file)
@@ -120,7 +120,10 @@ size_t Executor::RunClosures(const char* executor_name,
   // thread itself, but this is the point where we could start seeing
   // application-level callbacks. No need to create a new ExecCtx, though,
   // since there already is one and it is flushed (but not destructed) in this
-  // function itself.
+  // function itself. The ApplicationCallbackExecCtx will have its callbacks
+  // invoked on its destruction, which will be after completing any closures in
+  // the executor's closure list (which were explicitly scheduled onto the
+  // executor).
   grpc_core::ApplicationCallbackExecCtx callback_exec_ctx(
       GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREAD);
 
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.cc b/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.cc
new file mode 100644 (file)
index 0000000..74096a4
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/iomgr/executor/mpmcqueue.h"
+
+namespace grpc_core {
+
+DebugOnlyTraceFlag grpc_thread_pool_trace(false, "thread_pool");
+
+inline void* InfLenFIFOQueue::PopFront() {
+  // Caller should already check queue is not empty and has already held the
+  // mutex. This function will assume that there is at least one element in the
+  // queue (i.e. queue_head_->content is valid).
+  void* result = queue_head_->content;
+  count_.Store(count_.Load(MemoryOrder::RELAXED) - 1, MemoryOrder::RELAXED);
+
+  // Updates Stats when trace flag turned on.
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) {
+    gpr_timespec wait_time =
+        gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), queue_head_->insert_time);
+    stats_.num_completed++;
+    stats_.total_queue_time = gpr_time_add(stats_.total_queue_time, wait_time);
+    stats_.max_queue_time = gpr_time_max(
+        gpr_convert_clock_type(stats_.max_queue_time, GPR_TIMESPAN), wait_time);
+
+    if (count_.Load(MemoryOrder::RELAXED) == 0) {
+      stats_.busy_queue_time =
+          gpr_time_add(stats_.busy_queue_time,
+                       gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), busy_time));
+    }
+
+    gpr_log(GPR_INFO,
+            "[InfLenFIFOQueue PopFront] num_completed:        %" PRIu64
+            " total_queue_time: %f max_queue_time:   %f busy_queue_time:   %f",
+            stats_.num_completed,
+            gpr_timespec_to_micros(stats_.total_queue_time),
+            gpr_timespec_to_micros(stats_.max_queue_time),
+            gpr_timespec_to_micros(stats_.busy_queue_time));
+  }
+
+  queue_head_ = queue_head_->next;
+  // Signal waiting thread
+  if (count_.Load(MemoryOrder::RELAXED) > 0) {
+    TopWaiter()->cv.Signal();
+  }
+
+  return result;
+}
+
+InfLenFIFOQueue::Node* InfLenFIFOQueue::AllocateNodes(int num) {
+  num_nodes_ = num_nodes_ + num;
+  Node* new_chunk = static_cast<Node*>(gpr_zalloc(sizeof(Node) * num));
+  new_chunk[0].next = &new_chunk[1];
+  new_chunk[num - 1].prev = &new_chunk[num - 2];
+  for (int i = 1; i < num - 1; ++i) {
+    new_chunk[i].prev = &new_chunk[i - 1];
+    new_chunk[i].next = &new_chunk[i + 1];
+  }
+  return new_chunk;
+}
+
+InfLenFIFOQueue::InfLenFIFOQueue() {
+  delete_list_size_ = kDeleteListInitSize;
+  delete_list_ =
+      static_cast<Node**>(gpr_zalloc(sizeof(Node*) * delete_list_size_));
+
+  Node* new_chunk = AllocateNodes(kQueueInitNumNodes);
+  delete_list_[delete_list_count_++] = new_chunk;
+  queue_head_ = queue_tail_ = new_chunk;
+  new_chunk[0].prev = &new_chunk[kQueueInitNumNodes - 1];
+  new_chunk[kQueueInitNumNodes - 1].next = &new_chunk[0];
+
+  waiters_.next = &waiters_;
+  waiters_.prev = &waiters_;
+}
+
+InfLenFIFOQueue::~InfLenFIFOQueue() {
+  GPR_ASSERT(count_.Load(MemoryOrder::RELAXED) == 0);
+  for (size_t i = 0; i < delete_list_count_; ++i) {
+    gpr_free(delete_list_[i]);
+  }
+  gpr_free(delete_list_);
+}
+
+void InfLenFIFOQueue::Put(void* elem) {
+  MutexLock l(&mu_);
+
+  int curr_count = count_.Load(MemoryOrder::RELAXED);
+
+  if (queue_tail_ == queue_head_ && curr_count != 0) {
+    // List is full. Expands list to double size by inserting new chunk of nodes
+    Node* new_chunk = AllocateNodes(curr_count);
+    delete_list_[delete_list_count_++] = new_chunk;
+    // Expands delete list on full.
+    if (delete_list_count_ == delete_list_size_) {
+      delete_list_size_ = delete_list_size_ * 2;
+      delete_list_ = static_cast<Node**>(
+          gpr_realloc(delete_list_, sizeof(Node*) * delete_list_size_));
+    }
+    new_chunk[0].prev = queue_tail_->prev;
+    new_chunk[curr_count - 1].next = queue_head_;
+    queue_tail_->prev->next = new_chunk;
+    queue_head_->prev = &new_chunk[curr_count - 1];
+    queue_tail_ = new_chunk;
+  }
+  queue_tail_->content = static_cast<void*>(elem);
+
+  // Updates Stats info
+  if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) {
+    stats_.num_started++;
+    gpr_log(GPR_INFO, "[InfLenFIFOQueue Put] num_started:        %" PRIu64,
+            stats_.num_started);
+    auto current_time = gpr_now(GPR_CLOCK_MONOTONIC);
+    if (curr_count == 0) {
+      busy_time = current_time;
+    }
+    queue_tail_->insert_time = current_time;
+  }
+
+  count_.Store(curr_count + 1, MemoryOrder::RELAXED);
+  queue_tail_ = queue_tail_->next;
+
+  TopWaiter()->cv.Signal();
+}
+
+void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) {
+  MutexLock l(&mu_);
+
+  if (count_.Load(MemoryOrder::RELAXED) == 0) {
+    gpr_timespec start_time;
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace) &&
+        wait_time != nullptr) {
+      start_time = gpr_now(GPR_CLOCK_MONOTONIC);
+    }
+
+    Waiter self;
+    PushWaiter(&self);
+    do {
+      self.cv.Wait(&mu_);
+    } while (count_.Load(MemoryOrder::RELAXED) == 0);
+    RemoveWaiter(&self);
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace) &&
+        wait_time != nullptr) {
+      *wait_time = gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), start_time);
+    }
+  }
+  GPR_DEBUG_ASSERT(count_.Load(MemoryOrder::RELAXED) > 0);
+  return PopFront();
+}
+
+void InfLenFIFOQueue::PushWaiter(Waiter* waiter) {
+  waiter->next = waiters_.next;
+  waiter->prev = &waiters_;
+  waiter->next->prev = waiter;
+  waiter->prev->next = waiter;
+}
+
+void InfLenFIFOQueue::RemoveWaiter(Waiter* waiter) {
+  GPR_DEBUG_ASSERT(waiter != &waiters_);
+  waiter->next->prev = waiter->prev;
+  waiter->prev->next = waiter->next;
+}
+
+InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { return waiters_.next; }
+
+}  // namespace grpc_core
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.h b/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/mpmcqueue.h
new file mode 100644 (file)
index 0000000..ab5c484
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_EXECUTOR_MPMCQUEUE_H
+#define GRPC_CORE_LIB_IOMGR_EXECUTOR_MPMCQUEUE_H
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/debug/stats.h"
+#include "src/core/lib/gprpp/abstract.h"
+#include "src/core/lib/gprpp/atomic.h"
+#include "src/core/lib/gprpp/sync.h"
+
+namespace grpc_core {
+
+extern DebugOnlyTraceFlag grpc_thread_pool_trace;
+
+// Abstract base class of a Multiple-Producer-Multiple-Consumer(MPMC) queue
+// interface
+class MPMCQueueInterface {
+ public:
+  virtual ~MPMCQueueInterface() {}
+
+  // Puts elem into queue immediately at the end of queue.
+  // This might cause to block on full queue depending on implementation.
+  virtual void Put(void* elem) GRPC_ABSTRACT;
+
+  // Removes the oldest element from the queue and return it.
+  // This might cause to block on empty queue depending on implementation.
+  // Optional argument for collecting stats purpose.
+  virtual void* Get(gpr_timespec* wait_time = nullptr) GRPC_ABSTRACT;
+
+  // Returns number of elements in the queue currently
+  virtual int count() const GRPC_ABSTRACT;
+
+  GRPC_ABSTRACT_BASE_CLASS
+};
+
+class InfLenFIFOQueue : public MPMCQueueInterface {
+ public:
+  // Creates a new MPMC Queue. The queue created will have infinite length.
+  InfLenFIFOQueue();
+
+  // Releases all resources held by the queue. The queue must be empty, and no
+  // one waits on conditional variables.
+  ~InfLenFIFOQueue();
+
+  // Puts elem into queue immediately at the end of queue. Since the queue has
+  // infinite length, this routine will never block and should never fail.
+  void Put(void* elem);
+
+  // Removes the oldest element from the queue and returns it.
+  // This routine will cause the thread to block if queue is currently empty.
+  // Argument wait_time should be passed in when trace flag turning on (for
+  // collecting stats info purpose.)
+  void* Get(gpr_timespec* wait_time = nullptr);
+
+  // Returns number of elements in queue currently.
+  // There might be concurrently add/remove on queue, so count might change
+  // quickly.
+  int count() const { return count_.Load(MemoryOrder::RELAXED); }
+
+  struct Node {
+    Node* next;  // Linking
+    Node* prev;
+    void* content;             // Points to actual element
+    gpr_timespec insert_time;  // Time for stats
+
+    Node() {
+      next = prev = nullptr;
+      content = nullptr;
+    }
+  };
+
+  // For test purpose only. Returns number of nodes allocated in queue.
+  // Any allocated node will be alive until the destruction of the queue.
+  int num_nodes() const { return num_nodes_; }
+
+  // For test purpose only. Returns the initial number of nodes in queue.
+  int init_num_nodes() const { return kQueueInitNumNodes; }
+
+ private:
+  // For Internal Use Only.
+  // Removes the oldest element from the queue and returns it. This routine
+  // will NOT check whether queue is empty, and it will NOT acquire mutex.
+  // Caller MUST check that queue is not empty and must acquire mutex before
+  // callling.
+  void* PopFront();
+
+  // Stats of queue. This will only be collect when debug trace mode is on.
+  // All printed stats info will have time measurement in microsecond.
+  struct Stats {
+    uint64_t num_started;    // Number of elements have been added to queue
+    uint64_t num_completed;  // Number of elements have been removed from
+                             // the queue
+    gpr_timespec total_queue_time;  // Total waiting time that all the
+                                    // removed elements have spent in queue
+    gpr_timespec max_queue_time;    // Max waiting time among all removed
+                                    // elements
+    gpr_timespec busy_queue_time;   // Accumulated amount of time that queue
+                                    // was not empty
+
+    Stats() {
+      num_started = 0;
+      num_completed = 0;
+      total_queue_time = gpr_time_0(GPR_TIMESPAN);
+      max_queue_time = gpr_time_0(GPR_TIMESPAN);
+      busy_queue_time = gpr_time_0(GPR_TIMESPAN);
+    }
+  };
+
+  // Node for waiting thread queue. Stands for one waiting thread, should have
+  // exact one thread waiting on its CondVar.
+  // Using a doubly linked list for waiting thread queue to wake up waiting
+  // threads in LIFO order to reduce cache misses.
+  struct Waiter {
+    CondVar cv;
+    Waiter* next;
+    Waiter* prev;
+  };
+
+  // Pushs waiter to the front of queue, require caller held mutex
+  void PushWaiter(Waiter* waiter);
+
+  // Removes waiter from queue, require caller held mutex
+  void RemoveWaiter(Waiter* waiter);
+
+  // Returns pointer to the waiter that should be waken up next, should be the
+  // last added waiter.
+  Waiter* TopWaiter();
+
+  Mutex mu_;        // Protecting lock
+  Waiter waiters_;  // Head of waiting thread queue
+
+  // Initial size for delete list
+  static const int kDeleteListInitSize = 1024;
+  // Initial number of nodes allocated
+  static const int kQueueInitNumNodes = 1024;
+
+  Node** delete_list_ = nullptr;  // Keeps track of all allocated array entries
+                                  // for deleting on destruction
+  size_t delete_list_count_ = 0;  // Number of entries in list
+  size_t delete_list_size_ = 0;   // Size of the list. List will be expanded to
+                                  // double size on full
+
+  Node* queue_head_ = nullptr;  // Head of the queue, remove position
+  Node* queue_tail_ = nullptr;  // End of queue, insert position
+  Atomic<int> count_{0};        // Number of elements in queue
+  int num_nodes_ = 0;           // Number of nodes allocated
+
+  Stats stats_;            // Stats info
+  gpr_timespec busy_time;  // Start time of busy queue
+
+  // Internal Helper.
+  // Allocates an array of nodes of size "num", links all nodes together except
+  // the first node's prev and last node's next. They should be set by caller
+  // manually afterward.
+  Node* AllocateNodes(int num);
+};
+
+}  // namespace grpc_core
+
+#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_MPMCQUEUE_H */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/threadpool.cc b/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/threadpool.cc
new file mode 100644 (file)
index 0000000..e203252
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/iomgr/executor/threadpool.h"
+
+namespace grpc_core {
+
+void ThreadPoolWorker::Run() {
+  while (true) {
+    void* elem;
+
+    if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) {
+      // Updates stats and print
+      gpr_timespec wait_time = gpr_time_0(GPR_TIMESPAN);
+      elem = queue_->Get(&wait_time);
+      stats_.sleep_time = gpr_time_add(stats_.sleep_time, wait_time);
+      gpr_log(GPR_INFO,
+              "ThreadPool Worker [%s %d] Stats:  sleep_time          %f",
+              thd_name_, index_, gpr_timespec_to_micros(stats_.sleep_time));
+    } else {
+      elem = queue_->Get(nullptr);
+    }
+    if (elem == nullptr) {
+      break;
+    }
+    // Runs closure
+    auto* closure =
+        static_cast<grpc_experimental_completion_queue_functor*>(elem);
+    closure->functor_run(closure, closure->internal_success);
+  }
+}
+
+void ThreadPool::SharedThreadPoolConstructor() {
+  // All worker threads in thread pool must be joinable.
+  thread_options_.set_joinable(true);
+
+  // Create at least 1 worker thread.
+  if (num_threads_ <= 0) num_threads_ = 1;
+
+  queue_ = New<InfLenFIFOQueue>();
+  threads_ = static_cast<ThreadPoolWorker**>(
+      gpr_zalloc(num_threads_ * sizeof(ThreadPoolWorker*)));
+  for (int i = 0; i < num_threads_; ++i) {
+    threads_[i] =
+        New<ThreadPoolWorker>(thd_name_, this, queue_, thread_options_, i);
+    threads_[i]->Start();
+  }
+}
+
+size_t ThreadPool::DefaultStackSize() {
+#if defined(__ANDROID__) || defined(__APPLE__)
+  return 1952 * 1024;
+#else
+  return 64 * 1024;
+#endif
+}
+
+void ThreadPool::AssertHasNotBeenShutDown() {
+  // For debug checking purpose, using RELAXED order is sufficient.
+  GPR_DEBUG_ASSERT(!shut_down_.Load(MemoryOrder::RELAXED));
+}
+
+ThreadPool::ThreadPool(int num_threads) : num_threads_(num_threads) {
+  thd_name_ = "ThreadPoolWorker";
+  thread_options_ = Thread::Options();
+  thread_options_.set_stack_size(DefaultStackSize());
+  SharedThreadPoolConstructor();
+}
+
+ThreadPool::ThreadPool(int num_threads, const char* thd_name)
+    : num_threads_(num_threads), thd_name_(thd_name) {
+  thread_options_ = Thread::Options();
+  thread_options_.set_stack_size(DefaultStackSize());
+  SharedThreadPoolConstructor();
+}
+
+ThreadPool::ThreadPool(int num_threads, const char* thd_name,
+                       const Thread::Options& thread_options)
+    : num_threads_(num_threads),
+      thd_name_(thd_name),
+      thread_options_(thread_options) {
+  if (thread_options_.stack_size() == 0) {
+    thread_options_.set_stack_size(DefaultStackSize());
+  }
+  SharedThreadPoolConstructor();
+}
+
+ThreadPool::~ThreadPool() {
+  // For debug checking purpose, using RELAXED order is sufficient.
+  shut_down_.Store(true, MemoryOrder::RELAXED);
+
+  for (int i = 0; i < num_threads_; ++i) {
+    queue_->Put(nullptr);
+  }
+
+  for (int i = 0; i < num_threads_; ++i) {
+    threads_[i]->Join();
+  }
+
+  for (int i = 0; i < num_threads_; ++i) {
+    Delete(threads_[i]);
+  }
+  gpr_free(threads_);
+  Delete(queue_);
+}
+
+void ThreadPool::Add(grpc_experimental_completion_queue_functor* closure) {
+  AssertHasNotBeenShutDown();
+  queue_->Put(static_cast<void*>(closure));
+}
+
+int ThreadPool::num_pending_closures() const { return queue_->count(); }
+
+int ThreadPool::pool_capacity() const { return num_threads_; }
+
+const Thread::Options& ThreadPool::thread_options() const {
+  return thread_options_;
+}
+
+const char* ThreadPool::thread_name() const { return thd_name_; }
+}  // namespace grpc_core
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/threadpool.h b/legacy-libs/grpc/deps/grpc/src/core/lib/iomgr/executor/threadpool.h
new file mode 100644 (file)
index 0000000..7b33fb3
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_EXECUTOR_THREADPOOL_H
+#define GRPC_CORE_LIB_IOMGR_EXECUTOR_THREADPOOL_H
+
+#include <grpc/support/port_platform.h>
+
+#include <grpc/grpc.h>
+
+#include "src/core/lib/gprpp/thd.h"
+#include "src/core/lib/iomgr/executor/mpmcqueue.h"
+
+namespace grpc_core {
+
+// A base abstract base class for threadpool.
+// Threadpool is an executor that maintains a pool of threads sitting around
+// and waiting for closures. A threadpool also maintains a queue of pending
+// closures, when closures appearing in the queue, the threads in pool will
+// pull them out and execute them.
+class ThreadPoolInterface {
+ public:
+  // Waits for all pending closures to complete, then shuts down thread pool.
+  virtual ~ThreadPoolInterface() {}
+
+  // Schedules a given closure for execution later.
+  // Depending on specific subclass implementation, this routine might cause
+  // current thread to be blocked (in case of unable to schedule).
+  // Closure should contain a function pointer and arguments it will take, more
+  // details for closure struct at /grpc/include/grpc/impl/codegen/grpc_types.h
+  virtual void Add(grpc_experimental_completion_queue_functor* closure)
+      GRPC_ABSTRACT;
+
+  // Returns the current number of pending closures
+  virtual int num_pending_closures() const GRPC_ABSTRACT;
+
+  // Returns the capacity of pool (number of worker threads in pool)
+  virtual int pool_capacity() const GRPC_ABSTRACT;
+
+  // Thread option accessor
+  virtual const Thread::Options& thread_options() const GRPC_ABSTRACT;
+
+  // Returns the thread name for threads in this ThreadPool.
+  virtual const char* thread_name() const GRPC_ABSTRACT;
+
+  GRPC_ABSTRACT_BASE_CLASS
+};
+
+// Worker thread for threadpool. Executes closures in the queue, until getting a
+// NULL closure.
+class ThreadPoolWorker {
+ public:
+  ThreadPoolWorker(const char* thd_name, ThreadPoolInterface* pool,
+                   MPMCQueueInterface* queue, Thread::Options& options,
+                   int index)
+      : queue_(queue), thd_name_(thd_name), index_(index) {
+    thd_ = Thread(thd_name,
+                  [](void* th) { static_cast<ThreadPoolWorker*>(th)->Run(); },
+                  this, nullptr, options);
+  }
+
+  ~ThreadPoolWorker() {}
+
+  void Start() { thd_.Start(); }
+  void Join() { thd_.Join(); }
+
+ private:
+  // struct for tracking stats of thread
+  struct Stats {
+    gpr_timespec sleep_time;
+    Stats() { sleep_time = gpr_time_0(GPR_TIMESPAN); }
+  };
+
+  void Run();  // Pulls closures from queue and executes them
+
+  MPMCQueueInterface* queue_;  // Queue in thread pool to pull closures from
+  Thread thd_;                 // Thread wrapped in
+  Stats stats_;                // Stats to be collected in run time
+  const char* thd_name_;       // Name of thread
+  int index_;                  // Index in thread pool
+};
+
+// A fixed size thread pool implementation of abstract thread pool interface.
+// In this implementation, the number of threads in pool is fixed, but the
+// capacity of closure queue is unlimited.
+class ThreadPool : public ThreadPoolInterface {
+ public:
+  // Creates a thread pool with size of "num_threads", with default thread name
+  // "ThreadPoolWorker" and all thread options set to default. If the given size
+  // is 0 or less, there will be 1 worker thread created inside pool.
+  ThreadPool(int num_threads);
+
+  // Same as ThreadPool(int num_threads) constructor, except
+  // that it also sets "thd_name" as the name of all threads in the thread pool.
+  ThreadPool(int num_threads, const char* thd_name);
+
+  // Same as ThreadPool(const char *thd_name, int num_threads) constructor,
+  // except that is also set thread_options for threads.
+  // Notes for stack size:
+  // If the stack size field of the passed in Thread::Options is set to default
+  // value 0, default ThreadPool stack size will be used. The current default
+  // stack size of this implementation is 1952K for mobile platform and 64K for
+  // all others.
+  ThreadPool(int num_threads, const char* thd_name,
+             const Thread::Options& thread_options);
+
+  // Waits for all pending closures to complete, then shuts down thread pool.
+  ~ThreadPool() override;
+
+  // Adds given closure into pending queue immediately. Since closure queue has
+  // infinite length, this routine will not block.
+  void Add(grpc_experimental_completion_queue_functor* closure) override;
+
+  int num_pending_closures() const override;
+  int pool_capacity() const override;
+  const Thread::Options& thread_options() const override;
+  const char* thread_name() const override;
+
+ private:
+  int num_threads_ = 0;
+  const char* thd_name_ = nullptr;
+  Thread::Options thread_options_;
+  ThreadPoolWorker** threads_ = nullptr;  // Array of worker threads
+  MPMCQueueInterface* queue_ = nullptr;   // Closure queue
+
+  Atomic<bool> shut_down_{false};  // Destructor has been called if set to true
+
+  void SharedThreadPoolConstructor();
+  // For ThreadPool, default stack size for mobile platform is 1952K. for other
+  // platforms is 64K.
+  size_t DefaultStackSize();
+  // Internal Use Only for debug checking.
+  void AssertHasNotBeenShutDown();
+};
+
+}  // namespace grpc_core
+
+#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_THREADPOOL_H */
index 629b081..e678b4f 100644 (file)
@@ -59,8 +59,10 @@ void grpc_prefork() {
             "environment variable GRPC_ENABLE_FORK_SUPPORT=1");
     return;
   }
-  if (strcmp(grpc_get_poll_strategy_name(), "epoll1") != 0 &&
-      strcmp(grpc_get_poll_strategy_name(), "poll") != 0) {
+  const char* poll_strategy_name = grpc_get_poll_strategy_name();
+  if (poll_strategy_name == nullptr ||
+      (strcmp(poll_strategy_name, "epoll1") != 0 &&
+       strcmp(poll_strategy_name, "poll") != 0)) {
     gpr_log(GPR_INFO,
             "Fork support is only compatible with the epoll1 and poll polling "
             "strategies");
index ad325fe..29a05ee 100644 (file)
@@ -90,12 +90,12 @@ grpc_iocp_work_status grpc_iocp_work(grpc_millis deadline) {
     abort();
   }
   if (socket->shutdown_called) {
-    info->bytes_transfered = 0;
+    info->bytes_transferred = 0;
     info->wsa_error = WSA_OPERATION_ABORTED;
   } else {
     success = WSAGetOverlappedResult(socket->socket, &info->overlapped, &bytes,
                                      FALSE, &flags);
-    info->bytes_transfered = bytes;
+    info->bytes_transferred = bytes;
     info->wsa_error = success ? 0 : WSAGetLastError();
   }
   GPR_ASSERT(overlapped == &info->overlapped);
index cf4d053..72b2ae5 100644 (file)
@@ -78,9 +78,19 @@ static grpc_iomgr_platform_vtable vtable = {
 void grpc_set_default_iomgr_platform() {
   char* enable_cfstream = getenv(grpc_cfstream_env_var);
   grpc_tcp_client_vtable* client_vtable = &grpc_posix_tcp_client_vtable;
+  // CFStream is enabled by default on iOS, and disabled by default on other
+  // platforms. Defaults can be overriden by setting the grpc_cfstream
+  // environment variable.
+#if TARGET_OS_IPHONE
+  if (enable_cfstream == nullptr || enable_cfstream[0] == '1') {
+    client_vtable = &grpc_cfstream_client_vtable;
+  }
+#else
   if (enable_cfstream != nullptr && enable_cfstream[0] == '1') {
     client_vtable = &grpc_cfstream_client_vtable;
   }
+#endif
+
   grpc_set_tcp_client_impl(client_vtable);
   grpc_set_tcp_server_impl(&grpc_posix_tcp_server_vtable);
   grpc_set_timer_impl(&grpc_generic_timer_vtable);
@@ -90,4 +100,8 @@ void grpc_set_default_iomgr_platform() {
   grpc_set_iomgr_platform_vtable(&vtable);
 }
 
+bool grpc_iomgr_run_in_background() {
+  return grpc_event_engine_run_in_background();
+}
+
 #endif /* GRPC_CFSTREAM_IOMGR */
index 4a98444..a617239 100644 (file)
@@ -37,4 +37,7 @@ void grpc_set_default_iomgr_platform() {
   grpc_custom_iomgr_init(&grpc_uv_socket_vtable, &uv_resolver_vtable,
                          &uv_timer_vtable, &uv_pollset_vtable);
 }
+
+bool grpc_iomgr_run_in_background() { return false; }
+
 #endif
index f33485e..c708234 100644 (file)
@@ -95,7 +95,7 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) {
      * referencing it. */
     gpr_atm curr = gpr_atm_acq_load(&state_);
     if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
-      gpr_log(GPR_ERROR, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this,
+      gpr_log(GPR_DEBUG, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this,
               (void*)curr, closure);
     }
     switch (curr) {
@@ -161,7 +161,7 @@ bool LockfreeEvent::SetShutdown(grpc_error* shutdown_err) {
   while (true) {
     gpr_atm curr = gpr_atm_no_barrier_load(&state_);
     if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
-      gpr_log(GPR_ERROR, "LockfreeEvent::SetShutdown: %p curr=%p err=%s",
+      gpr_log(GPR_DEBUG, "LockfreeEvent::SetShutdown: %p curr=%p err=%s",
               &state_, (void*)curr, grpc_error_string(shutdown_err));
     }
     switch (curr) {
@@ -210,7 +210,7 @@ void LockfreeEvent::SetReady() {
     gpr_atm curr = gpr_atm_no_barrier_load(&state_);
 
     if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
-      gpr_log(GPR_ERROR, "LockfreeEvent::SetReady: %p curr=%p", &state_,
+      gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%p", &state_,
               (void*)curr);
     }
 
index 9cf7817..b5c922b 100644 (file)
@@ -24,9 +24,9 @@
 #include <grpc/support/string_util.h>
 
 #include <grpc/support/log.h>
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/host_port.h"
 
 #include "src/core/lib/iomgr/iomgr_custom.h"
 #include "src/core/lib/iomgr/resolve_address_custom.h"
@@ -71,6 +71,7 @@ void grpc_custom_resolve_callback(grpc_custom_resolver* r,
                                   grpc_resolved_addresses* result,
                                   grpc_error* error) {
   GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   grpc_core::ExecCtx exec_ctx;
   if (error == GRPC_ERROR_NONE) {
     *r->addresses = result;
@@ -86,11 +87,12 @@ void grpc_custom_resolve_callback(grpc_custom_resolver* r,
 }
 
 static grpc_error* try_split_host_port(const char* name,
-                                       const char* default_port, char** host,
-                                       char** port) {
+                                       const char* default_port,
+                                       grpc_core::UniquePtr<char>* host,
+                                       grpc_core::UniquePtr<char>* port) {
   /* parse name, splitting it into host and port parts */
   grpc_error* error;
-  gpr_split_host_port(name, host, port);
+  SplitHostPort(name, host, port);
   if (*host == nullptr) {
     char* msg;
     gpr_asprintf(&msg, "unparseable host:port: '%s'", name);
@@ -107,7 +109,7 @@ static grpc_error* try_split_host_port(const char* name,
       gpr_free(msg);
       return error;
     }
-    *port = gpr_strdup(default_port);
+    port->reset(gpr_strdup(default_port));
   }
   return GRPC_ERROR_NONE;
 }
@@ -115,28 +117,26 @@ static grpc_error* try_split_host_port(const char* name,
 static grpc_error* blocking_resolve_address_impl(
     const char* name, const char* default_port,
     grpc_resolved_addresses** addresses) {
-  char* host;
-  char* port;
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
   grpc_error* err;
 
   GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
 
   err = try_split_host_port(name, default_port, &host, &port);
   if (err != GRPC_ERROR_NONE) {
-    gpr_free(host);
-    gpr_free(port);
     return err;
   }
 
   /* Call getaddrinfo */
   grpc_custom_resolver resolver;
-  resolver.host = host;
-  resolver.port = port;
+  resolver.host = host.get();
+  resolver.port = port.get();
 
   grpc_resolved_addresses* addrs;
   grpc_core::ExecCtx* curr = grpc_core::ExecCtx::Get();
   grpc_core::ExecCtx::Set(nullptr);
-  err = resolve_address_vtable->resolve(host, port, &addrs);
+  err = resolve_address_vtable->resolve(host.get(), port.get(), &addrs);
   if (err != GRPC_ERROR_NONE) {
     if (retry_named_port_failure(&resolver, &addrs)) {
       GRPC_ERROR_UNREF(err);
@@ -147,8 +147,6 @@ static grpc_error* blocking_resolve_address_impl(
   if (err == GRPC_ERROR_NONE) {
     *addresses = addrs;
   }
-  gpr_free(resolver.host);
-  gpr_free(resolver.port);
   return err;
 }
 
@@ -157,22 +155,20 @@ static void resolve_address_impl(const char* name, const char* default_port,
                                  grpc_closure* on_done,
                                  grpc_resolved_addresses** addrs) {
   grpc_custom_resolver* r = nullptr;
-  char* host = nullptr;
-  char* port = nullptr;
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
   grpc_error* err;
   GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
   err = try_split_host_port(name, default_port, &host, &port);
   if (err != GRPC_ERROR_NONE) {
     GRPC_CLOSURE_SCHED(on_done, err);
-    gpr_free(host);
-    gpr_free(port);
     return;
   }
   r = (grpc_custom_resolver*)gpr_malloc(sizeof(grpc_custom_resolver));
   r->on_done = on_done;
   r->addresses = addrs;
-  r->host = host;
-  r->port = port;
+  r->host = host.release();
+  r->port = port.release();
 
   /* Call getaddrinfo */
   resolve_address_vtable->resolve_async(r, r->host, r->port);
index e6dd8f1..e02dc19 100644 (file)
@@ -33,9 +33,9 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
 
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/gprpp/thd.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/executor.h"
@@ -48,8 +48,6 @@ static grpc_error* posix_blocking_resolve_address(
   grpc_core::ExecCtx exec_ctx;
   struct addrinfo hints;
   struct addrinfo *result = nullptr, *resp;
-  char* host;
-  char* port;
   int s;
   size_t i;
   grpc_error* err;
@@ -59,8 +57,10 @@ static grpc_error* posix_blocking_resolve_address(
     return grpc_resolve_unix_domain_address(name + 5, addresses);
   }
 
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
   /* parse name, splitting it into host and port parts */
-  gpr_split_host_port(name, &host, &port);
+  grpc_core::SplitHostPort(name, &host, &port);
   if (host == nullptr) {
     err = grpc_error_set_str(
         GRPC_ERROR_CREATE_FROM_STATIC_STRING("unparseable host:port"),
@@ -74,7 +74,7 @@ static grpc_error* posix_blocking_resolve_address(
           GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
       goto done;
     }
-    port = gpr_strdup(default_port);
+    port.reset(gpr_strdup(default_port));
   }
 
   /* Call getaddrinfo */
@@ -84,16 +84,16 @@ static grpc_error* posix_blocking_resolve_address(
   hints.ai_flags = AI_PASSIVE;     /* for wildcard IP address */
 
   GRPC_SCHEDULING_START_BLOCKING_REGION;
-  s = getaddrinfo(host, port, &hints, &result);
+  s = getaddrinfo(host.get(), port.get(), &hints, &result);
   GRPC_SCHEDULING_END_BLOCKING_REGION;
 
   if (s != 0) {
     /* Retry if well-known service name is recognized */
     const char* svc[][2] = {{"http", "80"}, {"https", "443"}};
     for (i = 0; i < GPR_ARRAY_SIZE(svc); i++) {
-      if (strcmp(port, svc[i][0]) == 0) {
+      if (strcmp(port.get(), svc[i][0]) == 0) {
         GRPC_SCHEDULING_START_BLOCKING_REGION;
-        s = getaddrinfo(host, svc[i][1], &hints, &result);
+        s = getaddrinfo(host.get(), svc[i][1], &hints, &result);
         GRPC_SCHEDULING_END_BLOCKING_REGION;
         break;
       }
@@ -133,8 +133,6 @@ static grpc_error* posix_blocking_resolve_address(
   err = GRPC_ERROR_NONE;
 
 done:
-  gpr_free(host);
-  gpr_free(port);
   if (result) {
     freeaddrinfo(result);
   }
index 64351c3..a06d5ce 100644 (file)
@@ -35,8 +35,8 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
 
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/gprpp/thd.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/executor.h"
@@ -57,14 +57,14 @@ static grpc_error* windows_blocking_resolve_address(
   grpc_core::ExecCtx exec_ctx;
   struct addrinfo hints;
   struct addrinfo *result = NULL, *resp;
-  char* host;
-  char* port;
   int s;
   size_t i;
   grpc_error* error = GRPC_ERROR_NONE;
 
   /* parse name, splitting it into host and port parts */
-  gpr_split_host_port(name, &host, &port);
+  grpc_core::UniquePtr<char> host;
+  grpc_core::UniquePtr<char> port;
+  grpc_core::SplitHostPort(name, &host, &port);
   if (host == NULL) {
     char* msg;
     gpr_asprintf(&msg, "unparseable host:port: '%s'", name);
@@ -80,7 +80,7 @@ static grpc_error* windows_blocking_resolve_address(
       gpr_free(msg);
       goto done;
     }
-    port = gpr_strdup(default_port);
+    port.reset(gpr_strdup(default_port));
   }
 
   /* Call getaddrinfo */
@@ -90,7 +90,7 @@ static grpc_error* windows_blocking_resolve_address(
   hints.ai_flags = AI_PASSIVE;     /* for wildcard IP address */
 
   GRPC_SCHEDULING_START_BLOCKING_REGION;
-  s = getaddrinfo(host, port, &hints, &result);
+  s = getaddrinfo(host.get(), port.get(), &hints, &result);
   GRPC_SCHEDULING_END_BLOCKING_REGION;
   if (s != 0) {
     error = GRPC_WSA_ERROR(WSAGetLastError(), "getaddrinfo");
@@ -122,8 +122,6 @@ static grpc_error* windows_blocking_resolve_address(
   }
 
 done:
-  gpr_free(host);
-  gpr_free(port);
   if (result) {
     freeaddrinfo(result);
   }
index 0839bdf..2f8ed22 100644 (file)
@@ -28,8 +28,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/iomgr/socket_utils.h"
 #include "src/core/lib/iomgr/unix_sockets_posix.h"
@@ -181,15 +181,17 @@ int grpc_sockaddr_to_string(char** out,
   }
   if (ip != nullptr && grpc_inet_ntop(addr->sa_family, ip, ntop_buf,
                                       sizeof(ntop_buf)) != nullptr) {
+    grpc_core::UniquePtr<char> tmp_out;
     if (sin6_scope_id != 0) {
       char* host_with_scope;
       /* Enclose sin6_scope_id with the format defined in RFC 6784 section 2. */
       gpr_asprintf(&host_with_scope, "%s%%25%" PRIu32, ntop_buf, sin6_scope_id);
-      ret = gpr_join_host_port(out, host_with_scope, port);
+      ret = grpc_core::JoinHostPort(&tmp_out, host_with_scope, port);
       gpr_free(host_with_scope);
     } else {
-      ret = gpr_join_host_port(out, ntop_buf, port);
+      ret = grpc_core::JoinHostPort(&tmp_out, ntop_buf, port);
     }
+    *out = tmp_out.release();
   } else {
     ret = gpr_asprintf(out, "(sockaddr family=%d)", addr->sa_family);
   }
@@ -199,13 +201,11 @@ int grpc_sockaddr_to_string(char** out,
 }
 
 void grpc_string_to_sockaddr(grpc_resolved_address* out, char* addr, int port) {
+  memset(out, 0, sizeof(grpc_resolved_address));
   grpc_sockaddr_in6* addr6 = (grpc_sockaddr_in6*)out->addr;
   grpc_sockaddr_in* addr4 = (grpc_sockaddr_in*)out->addr;
-
   if (grpc_inet_pton(GRPC_AF_INET6, addr, &addr6->sin6_addr) == 1) {
     addr6->sin6_family = GRPC_AF_INET6;
-    addr6->sin6_flowinfo = 0;
-    addr6->sin6_scope_id = 0;
     out->len = sizeof(grpc_sockaddr_in6);
   } else if (grpc_inet_pton(GRPC_AF_INET, addr, &addr4->sin_addr) == 1) {
     addr4->sin_family = GRPC_AF_INET;
index 2101651..47d9f51 100644 (file)
@@ -46,7 +46,6 @@
 #include <grpc/support/sync.h>
 
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
index 5fed690..78f7945 100644 (file)
@@ -59,7 +59,7 @@ typedef struct grpc_winsocket_callback_info {
      to hold a mutex for a long amount of time. */
   int has_pending_iocp;
   /* The results of the overlapped operation. */
-  DWORD bytes_transfered;
+  DWORD bytes_transferred;
   int wsa_error;
 } grpc_winsocket_callback_info;
 
index 4b21322..fcad5ed 100644 (file)
@@ -34,7 +34,7 @@
 #include <netinet/in.h>
 
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/iomgr/cfstream_handle.h"
 #include "src/core/lib/iomgr/closure.h"
 #include "src/core/lib/iomgr/endpoint_cfstream.h"
@@ -143,12 +143,13 @@ static void OnOpen(void* arg, grpc_error* error) {
 
 static void ParseResolvedAddress(const grpc_resolved_address* addr,
                                  CFStringRef* host, int* port) {
-  char *host_port, *host_string, *port_string;
+  char* host_port;
   grpc_sockaddr_to_string(&host_port, addr, 1);
-  gpr_split_host_port(host_port, &host_string, &port_string);
-  *host = CFStringCreateWithCString(NULL, host_string, kCFStringEncodingUTF8);
-  gpr_free(host_string);
-  gpr_free(port_string);
+  grpc_core::UniquePtr<char> host_string;
+  grpc_core::UniquePtr<char> port_string;
+  grpc_core::SplitHostPort(host_port, &host_string, &port_string);
+  *host =
+      CFStringCreateWithCString(NULL, host_string.get(), kCFStringEncodingUTF8);
   gpr_free(host_port);
   *port = grpc_sockaddr_get_port(addr);
 }
index 14a8b78..6f236ae 100644 (file)
@@ -101,6 +101,7 @@ static void custom_connect_callback_internal(grpc_custom_socket* socket,
 
 static void custom_connect_callback(grpc_custom_socket* socket,
                                     grpc_error* error) {
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   if (grpc_core::ExecCtx::Get() == nullptr) {
     /* If we are being run on a thread which does not have an exec_ctx created
      * yet, we should create one. */
index 66df508..05cdd1e 100644 (file)
@@ -145,6 +145,7 @@ static void call_read_cb(custom_tcp_endpoint* tcp, grpc_error* error) {
 
 static void custom_read_callback(grpc_custom_socket* socket, size_t nread,
                                  grpc_error* error) {
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   grpc_core::ExecCtx exec_ctx;
   grpc_slice_buffer garbage;
   custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)socket->endpoint;
@@ -207,6 +208,7 @@ static void endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices,
 
 static void custom_write_callback(grpc_custom_socket* socket,
                                   grpc_error* error) {
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   grpc_core::ExecCtx exec_ctx;
   custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)socket->endpoint;
   grpc_closure* cb = tcp->write_cb;
@@ -301,6 +303,7 @@ static void custom_close_callback(grpc_custom_socket* socket) {
     grpc_custom_socket_vtable->destroy(socket);
     gpr_free(socket);
   } else if (socket->endpoint) {
+    grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
     grpc_core::ExecCtx exec_ctx;
     custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)socket->endpoint;
     TCP_UNREF(tcp, "destroy");
@@ -343,6 +346,7 @@ grpc_endpoint* custom_tcp_endpoint_create(grpc_custom_socket* socket,
                                           char* peer_string) {
   custom_tcp_endpoint* tcp =
       (custom_tcp_endpoint*)gpr_malloc(sizeof(custom_tcp_endpoint));
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   grpc_core::ExecCtx exec_ctx;
 
   if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
index 889272f..b6d1381 100644 (file)
@@ -89,7 +89,7 @@ struct grpc_tcp {
   bool is_first_read;
   double target_length;
   double bytes_read_this_round;
-  gpr_refcount refcount;
+  grpc_core::RefCount refcount;
   gpr_atm shutdown_count;
 
   int min_read_chunk_size;
@@ -359,41 +359,29 @@ static void tcp_free(grpc_tcp* tcp) {
 }
 
 #ifndef NDEBUG
-#define TCP_UNREF(tcp, reason) tcp_unref((tcp), (reason), __FILE__, __LINE__)
-#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__)
-static void tcp_unref(grpc_tcp* tcp, const char* reason, const char* file,
-                      int line) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
-    gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count);
-    gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "TCP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val,
-            val - 1);
-  }
-  if (gpr_unref(&tcp->refcount)) {
+#define TCP_UNREF(tcp, reason) tcp_unref((tcp), (reason), DEBUG_LOCATION)
+#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), DEBUG_LOCATION)
+static void tcp_unref(grpc_tcp* tcp, const char* reason,
+                      const grpc_core::DebugLocation& debug_location) {
+  if (GPR_UNLIKELY(tcp->refcount.Unref(debug_location, reason))) {
     tcp_free(tcp);
   }
 }
 
-static void tcp_ref(grpc_tcp* tcp, const char* reason, const char* file,
-                    int line) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) {
-    gpr_atm val = gpr_atm_no_barrier_load(&tcp->refcount.count);
-    gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "TCP   ref %p : %s %" PRIdPTR " -> %" PRIdPTR, tcp, reason, val,
-            val + 1);
-  }
-  gpr_ref(&tcp->refcount);
+static void tcp_ref(grpc_tcp* tcp, const char* reason,
+                    const grpc_core::DebugLocation& debug_location) {
+  tcp->refcount.Ref(debug_location, reason);
 }
 #else
 #define TCP_UNREF(tcp, reason) tcp_unref((tcp))
 #define TCP_REF(tcp, reason) tcp_ref((tcp))
 static void tcp_unref(grpc_tcp* tcp) {
-  if (gpr_unref(&tcp->refcount)) {
+  if (GPR_UNLIKELY(tcp->refcount.Unref())) {
     tcp_free(tcp);
   }
 }
 
-static void tcp_ref(grpc_tcp* tcp) { gpr_ref(&tcp->refcount); }
+static void tcp_ref(grpc_tcp* tcp) { tcp->refcount.Ref(); }
 #endif
 
 static void tcp_destroy(grpc_endpoint* ep) {
@@ -435,12 +423,17 @@ static void tcp_do_read(grpc_tcp* tcp) {
   GPR_TIMER_SCOPE("tcp_do_read", 0);
   struct msghdr msg;
   struct iovec iov[MAX_READ_IOVEC];
-  char cmsgbuf[24 /*CMSG_SPACE(sizeof(int))*/];
   ssize_t read_bytes;
   size_t total_read_bytes = 0;
-
   size_t iov_len =
       std::min<size_t>(MAX_READ_IOVEC, tcp->incoming_buffer->count);
+#ifdef GRPC_LINUX_ERRQUEUE
+  constexpr size_t cmsg_alloc_space =
+      CMSG_SPACE(sizeof(grpc_core::scm_timestamping)) + CMSG_SPACE(sizeof(int));
+#else
+  constexpr size_t cmsg_alloc_space = 24 /* CMSG_SPACE(sizeof(int)) */;
+#endif /* GRPC_LINUX_ERRQUEUE */
+  char cmsgbuf[cmsg_alloc_space];
   for (size_t i = 0; i < iov_len; i++) {
     iov[i].iov_base = GRPC_SLICE_START_PTR(tcp->incoming_buffer->slices[i]);
     iov[i].iov_len = GRPC_SLICE_LENGTH(tcp->incoming_buffer->slices[i]);
@@ -524,6 +517,7 @@ static void tcp_do_read(grpc_tcp* tcp) {
         if (cmsg->cmsg_level == SOL_TCP && cmsg->cmsg_type == TCP_CM_INQ &&
             cmsg->cmsg_len == CMSG_LEN(sizeof(int))) {
           tcp->inq = *reinterpret_cast<int*>(CMSG_DATA(cmsg));
+          break;
         }
       }
     }
@@ -1026,7 +1020,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) {
   if (error != GRPC_ERROR_NONE) {
     cb = tcp->write_cb;
     tcp->write_cb = nullptr;
-    cb->cb(cb->cb_arg, error);
+    GRPC_CLOSURE_SCHED(cb, GRPC_ERROR_REF(error));
     TCP_UNREF(tcp, "write");
     return;
   }
@@ -1036,6 +1030,8 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) {
       gpr_log(GPR_INFO, "write: delayed");
     }
     notify_on_write(tcp);
+    // tcp_flush does not populate error if it has returned false.
+    GPR_DEBUG_ASSERT(error == GRPC_ERROR_NONE);
   } else {
     cb = tcp->write_cb;
     tcp->write_cb = nullptr;
@@ -1043,6 +1039,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) {
       const char* str = grpc_error_string(error);
       gpr_log(GPR_INFO, "write: %s", str);
     }
+    // No need to take a ref on error since tcp_flush provides a ref.
     GRPC_CLOSURE_SCHED(cb, error);
     TCP_UNREF(tcp, "write");
   }
@@ -1224,7 +1221,7 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd,
   tcp->ts_capable = true;
   tcp->outgoing_buffer_arg = nullptr;
   /* paired with unref in grpc_tcp_destroy */
-  gpr_ref_init(&tcp->refcount, 1);
+  new (&tcp->refcount) grpc_core::RefCount(1, &grpc_tcp_trace);
   gpr_atm_no_barrier_store(&tcp->shutdown_count, 0);
   tcp->em_fd = em_fd;
   grpc_slice_buffer_init(&tcp->last_read_buffer);
index 767404b..7107dcc 100644 (file)
@@ -245,6 +245,7 @@ static void custom_accept_callback(grpc_custom_socket* socket,
 static void custom_accept_callback(grpc_custom_socket* socket,
                                    grpc_custom_socket* client,
                                    grpc_error* error) {
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   grpc_core::ExecCtx exec_ctx;
   grpc_tcp_listener* sp = socket->listener;
   if (error != GRPC_ERROR_NONE) {
@@ -391,7 +392,7 @@ static grpc_error* tcp_server_add_port(grpc_tcp_server* s,
   socket->endpoint = nullptr;
   socket->listener = nullptr;
   socket->connector = nullptr;
-  grpc_custom_socket_vtable->init(socket, family);
+  error = grpc_custom_socket_vtable->init(socket, family);
 
   if (error == GRPC_ERROR_NONE) {
     error = add_socket_to_server(s, socket, addr, port_index, &sp);
index abfa3be..0024f80 100644 (file)
@@ -409,7 +409,7 @@ static grpc_error* add_socket_to_server(grpc_tcp_server* s, SOCKET sock,
     gpr_log(GPR_ERROR, "on_connect error: %s", utf8_message);
     gpr_free(utf8_message);
     closesocket(sock);
-    return NULL;
+    return GRPC_ERROR_NONE;
   }
 
   error = prepare_socket(sock, addr, &port);
index ae6b2b6..32d0bb3 100644 (file)
@@ -196,17 +196,17 @@ static void on_read(void* tcpp, grpc_error* error) {
       gpr_free(utf8_message);
       grpc_slice_buffer_reset_and_unref_internal(tcp->read_slices);
     } else {
-      if (info->bytes_transfered != 0 && !tcp->shutting_down) {
-        GPR_ASSERT((size_t)info->bytes_transfered <= tcp->read_slices->length);
-        if (static_cast<size_t>(info->bytes_transfered) !=
+      if (info->bytes_transferred != 0 && !tcp->shutting_down) {
+        GPR_ASSERT((size_t)info->bytes_transferred <= tcp->read_slices->length);
+        if (static_cast<size_t>(info->bytes_transferred) !=
             tcp->read_slices->length) {
           grpc_slice_buffer_trim_end(
               tcp->read_slices,
               tcp->read_slices->length -
-                  static_cast<size_t>(info->bytes_transfered),
+                  static_cast<size_t>(info->bytes_transferred),
               &tcp->last_read_buffer);
         }
-        GPR_ASSERT((size_t)info->bytes_transfered == tcp->read_slices->length);
+        GPR_ASSERT((size_t)info->bytes_transferred == tcp->read_slices->length);
 
         if (grpc_tcp_trace.enabled()) {
           size_t i;
@@ -288,7 +288,7 @@ static void win_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices,
 
   /* Did we get data immediately ? Yay. */
   if (info->wsa_error != WSAEWOULDBLOCK) {
-    info->bytes_transfered = bytes_read;
+    info->bytes_transferred = bytes_read;
     GRPC_CLOSURE_SCHED(&tcp->on_read, GRPC_ERROR_NONE);
     return;
   }
@@ -333,7 +333,7 @@ static void on_write(void* tcpp, grpc_error* error) {
     if (info->wsa_error != 0) {
       error = GRPC_WSA_ERROR(info->wsa_error, "WSASend");
     } else {
-      GPR_ASSERT(info->bytes_transfered == tcp->write_slices->length);
+      GPR_ASSERT(info->bytes_transferred == tcp->write_slices->length);
     }
   }
 
index 71d825f..57675c2 100644 (file)
@@ -32,6 +32,7 @@ static grpc_custom_timer_vtable* custom_timer_impl;
 
 void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* error) {
   GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
+  grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
   grpc_core::ExecCtx exec_ctx;
   grpc_timer* timer = t->original;
   GPR_ASSERT(timer->pending);
index bdf5490..96d502c 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/iomgr/timer_manager.h"
+
 #include <inttypes.h>
 
 #include <grpc/support/alloc.h>
@@ -26,7 +28,6 @@
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gprpp/thd.h"
 #include "src/core/lib/iomgr/timer.h"
-#include "src/core/lib/iomgr/timer_manager.h"
 
 struct completed_thread {
   grpc_core::Thread thd;
@@ -58,18 +59,11 @@ static bool g_has_timed_waiter;
 static grpc_millis g_timed_waiter_deadline;
 // generation counter to track which thread is waiting for the next timer
 static uint64_t g_timed_waiter_generation;
+// number of timer wakeups
+static uint64_t g_wakeups;
 
 static void timer_thread(void* completed_thread_ptr);
 
-// For debug of the timer manager crash only.
-// TODO (mxyan): remove after bug is fixed.
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-extern int64_t g_timer_manager_init_count;
-extern int64_t g_timer_manager_shutdown_count;
-extern int64_t g_fork_count;
-extern int64_t g_next_value;
-#endif  // GRPC_DEBUG_TIMER_MANAGER
-
 static void gc_completed_threads(void) {
   if (g_completed_threads != nullptr) {
     completed_thread* to_gc = g_completed_threads;
@@ -203,11 +197,6 @@ static bool wait_until(grpc_millis next) {
       gpr_log(GPR_INFO, "sleep until kicked");
     }
 
-      // For debug of the timer manager crash only.
-      // TODO (mxyan): remove after bug is fixed.
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-    g_next_value = next;
-#endif
     gpr_cv_wait(&g_cv_wait, &g_mu,
                 grpc_millis_to_timespec(next, GPR_CLOCK_MONOTONIC));
 
@@ -220,6 +209,7 @@ static bool wait_until(grpc_millis next) {
     // that there's now no timed waiter... we'll look for a replacement if
     // there's work to do after checking timers (code above)
     if (my_timed_waiter_generation == g_timed_waiter_generation) {
+      ++g_wakeups;
       g_has_timed_waiter = false;
       g_timed_waiter_deadline = GRPC_MILLIS_INF_FUTURE;
     }
@@ -309,11 +299,6 @@ static void start_threads(void) {
 void grpc_timer_manager_init(void) {
   gpr_mu_init(&g_mu);
   gpr_cv_init(&g_cv_wait);
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-  // For debug of the timer manager crash only.
-  // TODO (mxyan): remove after bug is fixed.
-  g_timer_manager_init_count++;
-#endif
   gpr_cv_init(&g_cv_shutdown);
   g_threaded = false;
   g_thread_count = 0;
@@ -345,15 +330,11 @@ static void stop_threads(void) {
       gc_completed_threads();
     }
   }
+  g_wakeups = 0;
   gpr_mu_unlock(&g_mu);
 }
 
 void grpc_timer_manager_shutdown(void) {
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-  // For debug of the timer manager crash only.
-  // TODO (mxyan): remove after bug is fixed.
-  g_timer_manager_shutdown_count++;
-#endif
   stop_threads();
 
   gpr_mu_destroy(&g_mu);
@@ -362,11 +343,6 @@ void grpc_timer_manager_shutdown(void) {
 }
 
 void grpc_timer_manager_set_threading(bool threaded) {
-#ifdef GRPC_DEBUG_TIMER_MANAGER
-  // For debug of the timer manager crash only.
-  // TODO (mxyan): remove after bug is fixed.
-  g_fork_count++;
-#endif
   if (threaded) {
     start_threads();
   } else {
@@ -383,3 +359,5 @@ void grpc_kick_poller(void) {
   gpr_cv_signal(&g_cv_wait);
   gpr_mu_unlock(&g_mu);
 }
+
+uint64_t grpc_timer_manager_get_wakeups_testonly(void) { return g_wakeups; }
index 00dcdc4..d407cbb 100644 (file)
@@ -35,5 +35,7 @@ void grpc_timer_manager_set_threading(bool enabled);
 /* explicitly perform one tick of the timer system - for when threading is
  * disabled */
 void grpc_timer_manager_tick(void);
+/* get global counter that tracks timer wakeups */
+uint64_t grpc_timer_manager_get_wakeups_testonly(void);
 
 #endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */
index 90452d6..f2ec9b7 100644 (file)
@@ -45,6 +45,90 @@ void grpc_channel_credentials_release(grpc_channel_credentials* creds) {
   if (creds) creds->Unref();
 }
 
+static grpc_core::Map<grpc_core::UniquePtr<char>,
+                      grpc_core::RefCountedPtr<grpc_channel_credentials>,
+                      grpc_core::StringLess>* g_grpc_control_plane_creds;
+static gpr_mu g_control_plane_creds_mu;
+
+static void do_control_plane_creds_init() {
+  gpr_mu_init(&g_control_plane_creds_mu);
+  GPR_ASSERT(g_grpc_control_plane_creds == nullptr);
+  g_grpc_control_plane_creds = grpc_core::New<
+      grpc_core::Map<grpc_core::UniquePtr<char>,
+                     grpc_core::RefCountedPtr<grpc_channel_credentials>,
+                     grpc_core::StringLess>>();
+}
+
+void grpc_control_plane_credentials_init() {
+  static gpr_once once_init_control_plane_creds = GPR_ONCE_INIT;
+  gpr_once_init(&once_init_control_plane_creds, do_control_plane_creds_init);
+}
+
+void grpc_test_only_control_plane_credentials_destroy() {
+  grpc_core::Delete(g_grpc_control_plane_creds);
+  g_grpc_control_plane_creds = nullptr;
+  gpr_mu_destroy(&g_control_plane_creds_mu);
+}
+
+void grpc_test_only_control_plane_credentials_force_init() {
+  if (g_grpc_control_plane_creds == nullptr) {
+    do_control_plane_creds_init();
+  }
+}
+
+bool grpc_channel_credentials_attach_credentials(
+    grpc_channel_credentials* credentials, const char* authority,
+    grpc_channel_credentials* control_plane_creds) {
+  grpc_core::ExecCtx exec_ctx;
+  return credentials->attach_credentials(authority, control_plane_creds->Ref());
+}
+
+bool grpc_control_plane_credentials_register(
+    const char* authority, grpc_channel_credentials* control_plane_creds) {
+  grpc_core::ExecCtx exec_ctx;
+  {
+    grpc_core::MutexLock lock(&g_control_plane_creds_mu);
+    auto key = grpc_core::UniquePtr<char>(gpr_strdup(authority));
+    if (g_grpc_control_plane_creds->find(key) !=
+        g_grpc_control_plane_creds->end()) {
+      return false;
+    }
+    (*g_grpc_control_plane_creds)[std::move(key)] = control_plane_creds->Ref();
+  }
+  return true;
+}
+
+bool grpc_channel_credentials::attach_credentials(
+    const char* authority,
+    grpc_core::RefCountedPtr<grpc_channel_credentials> control_plane_creds) {
+  auto key = grpc_core::UniquePtr<char>(gpr_strdup(authority));
+  if (local_control_plane_creds_.find(key) !=
+      local_control_plane_creds_.end()) {
+    return false;
+  }
+  local_control_plane_creds_[std::move(key)] = std::move(control_plane_creds);
+  return true;
+}
+
+grpc_core::RefCountedPtr<grpc_channel_credentials>
+grpc_channel_credentials::get_control_plane_credentials(const char* authority) {
+  {
+    auto key = grpc_core::UniquePtr<char>(gpr_strdup(authority));
+    auto local_lookup = local_control_plane_creds_.find(key);
+    if (local_lookup != local_control_plane_creds_.end()) {
+      return local_lookup->second;
+    }
+    {
+      grpc_core::MutexLock lock(&g_control_plane_creds_mu);
+      auto global_lookup = g_grpc_control_plane_creds->find(key);
+      if (global_lookup != g_grpc_control_plane_creds->end()) {
+        return global_lookup->second;
+      }
+    }
+  }
+  return duplicate_without_call_credentials();
+}
+
 void grpc_call_credentials_release(grpc_call_credentials* creds) {
   GRPC_API_TRACE("grpc_call_credentials_release(creds=%p)", 1, (creds));
   grpc_core::ExecCtx exec_ctx;
index a9d5812..b43405b 100644 (file)
@@ -26,7 +26,9 @@
 #include <grpc/support/sync.h>
 #include "src/core/lib/transport/metadata_batch.h"
 
+#include "src/core/lib/gprpp/map.h"
 #include "src/core/lib/gprpp/ref_counted.h"
+#include "src/core/lib/gprpp/sync.h"
 #include "src/core/lib/http/httpcli.h"
 #include "src/core/lib/http/parser.h"
 #include "src/core/lib/iomgr/polling_entity.h"
@@ -64,8 +66,8 @@ typedef enum {
 #define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \
   "/computeMetadata/v1/instance/service-accounts/default/token"
 
-#define GRPC_GOOGLE_OAUTH2_SERVICE_HOST "www.googleapis.com"
-#define GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH "/oauth2/v3/token"
+#define GRPC_GOOGLE_OAUTH2_SERVICE_HOST "oauth2.googleapis.com"
+#define GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH "/token"
 
 #define GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX                         \
   "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" \
@@ -108,11 +110,17 @@ struct grpc_channel_credentials
   create_security_connector(
       grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
       const char* target, const grpc_channel_args* args,
-      grpc_channel_args** new_args) {
+      grpc_channel_args** new_args)
+#if GRPC_USE_CPP_STD_LIB
+      = 0;
+#else
+  {
     // Tell clang-tidy that call_creds cannot be passed as const-ref.
     call_creds.reset();
-    GRPC_ABSTRACT;
+    gpr_log(GPR_ERROR, "Function marked GRPC_ABSTRACT was not implemented");
+    GPR_ASSERT(false);
   }
+#endif
 
   // Creates a version of the channel credentials without any attached call
   // credentials. This can be used in order to open a channel to a non-trusted
@@ -131,12 +139,31 @@ struct grpc_channel_credentials
     return args;
   }
 
+  // Attaches control_plane_creds to the local registry, under authority,
+  // if no other creds are currently registered under authority. Returns
+  // true if registered successfully and false if not.
+  bool attach_credentials(
+      const char* authority,
+      grpc_core::RefCountedPtr<grpc_channel_credentials> control_plane_creds);
+
+  // Gets the control plane credentials registered under authority. This
+  // prefers the local control plane creds registry but falls back to the
+  // global registry. Lastly, this returns self but with any attached
+  // call credentials stripped off, in the case that neither the local
+  // registry nor the global registry have an entry for authority.
+  grpc_core::RefCountedPtr<grpc_channel_credentials>
+  get_control_plane_credentials(const char* authority);
+
   const char* type() const { return type_; }
 
   GRPC_ABSTRACT_BASE_CLASS
 
  private:
   const char* type_;
+  grpc_core::Map<grpc_core::UniquePtr<char>,
+                 grpc_core::RefCountedPtr<grpc_channel_credentials>,
+                 grpc_core::StringLess>
+      local_control_plane_creds_;
 };
 
 /* Util to encapsulate the channel credentials in a channel arg. */
@@ -150,6 +177,41 @@ grpc_channel_credentials* grpc_channel_credentials_from_arg(
 grpc_channel_credentials* grpc_channel_credentials_find_in_args(
     const grpc_channel_args* args);
 
+/** EXPERIMENTAL.  API MAY CHANGE IN THE FUTURE.
+    Attaches \a control_plane_creds to \a credentials
+    under the key \a authority. Returns false if \a authority
+    is already present, in which case no changes are made.
+    Note that this API is not thread safe. Only one thread may
+    attach control plane creds to a given credentials object at
+    any one time, and new control plane creds must not be
+    attached after \a credentials has been used to create a channel. */
+bool grpc_channel_credentials_attach_credentials(
+    grpc_channel_credentials* credentials, const char* authority,
+    grpc_channel_credentials* control_plane_creds);
+
+/** EXPERIMENTAL.  API MAY CHANGE IN THE FUTURE.
+    Registers \a control_plane_creds in the global registry
+    under the key \a authority. Returns false if \a authority
+    is already present, in which case no changes are made. */
+bool grpc_control_plane_credentials_register(
+    const char* authority, grpc_channel_credentials* control_plane_creds);
+
+/* Initializes global control plane credentials data. */
+void grpc_control_plane_credentials_init();
+
+/* Test only: destroy global control plane credentials data.
+ * This API is meant for use by a few tests that need to
+ * satisdy grpc_core::LeakDetector. */
+void grpc_test_only_control_plane_credentials_destroy();
+
+/* Test only: force re-initialization of global control
+ * plane credentials data if it was previously destroyed.
+ * This API is meant to be used in
+ * tandem with the
+ * grpc_test_only_control_plane_credentials_destroy, for
+ * the few tests that need it. */
+void grpc_test_only_control_plane_credentials_force_init();
+
 /* --- grpc_credentials_mdelem_array. --- */
 
 typedef struct {
index 113e2b8..12b7c53 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/security/credentials/jwt/json_token.h"
 
 #include <string.h>
@@ -69,6 +70,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const grpc_json* json) {
   BIO* bio = nullptr;
   const char* prop_value;
   int success = 0;
+  grpc_error* error = GRPC_ERROR_NONE;
 
   memset(&result, 0, sizeof(grpc_auth_json_key));
   result.type = GRPC_AUTH_JSON_TYPE_INVALID;
@@ -77,7 +79,8 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const grpc_json* json) {
     goto end;
   }
 
-  prop_value = grpc_json_get_string_property(json, "type");
+  prop_value = grpc_json_get_string_property(json, "type", &error);
+  GRPC_LOG_IF_ERROR("JSON key parsing", error);
   if (prop_value == nullptr ||
       strcmp(prop_value, GRPC_AUTH_JSON_TYPE_SERVICE_ACCOUNT)) {
     goto end;
@@ -92,7 +95,8 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const grpc_json* json) {
     goto end;
   }
 
-  prop_value = grpc_json_get_string_property(json, "private_key");
+  prop_value = grpc_json_get_string_property(json, "private_key", &error);
+  GRPC_LOG_IF_ERROR("JSON key parsing", error);
   if (prop_value == nullptr) {
     goto end;
   }
index 3ed9901..20390f3 100644 (file)
@@ -30,7 +30,7 @@
 
 /* --- Constants. --- */
 
-#define GRPC_JWT_OAUTH2_AUDIENCE "https://www.googleapis.com/oauth2/v3/token"
+#define GRPC_JWT_OAUTH2_AUDIENCE "https://oauth2.googleapis.com/token"
 
 /* --- auth_json_key parsing. --- */
 
index b001868..87aa035 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/json/json.h"
 #include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
 
 #include <string.h>
 
-#include "src/core/lib/gprpp/ref_counted_ptr.h"
-#include "src/core/lib/security/util/json_util.h"
-#include "src/core/lib/surface/api_trace.h"
-
+#include <grpc/grpc_security.h>
+#include <grpc/impl/codegen/slice.h>
+#include <grpc/slice.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
+#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/inlined_vector.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/load_file.h"
+#include "src/core/lib/security/util/json_util.h"
+#include "src/core/lib/slice/slice_internal.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/uri/uri_parser.h"
+
 //
 // Auth Refresh Token.
 //
@@ -45,6 +55,7 @@ grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(
   grpc_auth_refresh_token result;
   const char* prop_value;
   int success = 0;
+  grpc_error* error = GRPC_ERROR_NONE;
 
   memset(&result, 0, sizeof(grpc_auth_refresh_token));
   result.type = GRPC_AUTH_JSON_TYPE_INVALID;
@@ -53,7 +64,8 @@ grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(
     goto end;
   }
 
-  prop_value = grpc_json_get_string_property(json, "type");
+  prop_value = grpc_json_get_string_property(json, "type", &error);
+  GRPC_LOG_IF_ERROR("Parsing refresh token", error);
   if (prop_value == nullptr ||
       strcmp(prop_value, GRPC_AUTH_JSON_TYPE_AUTHORIZED_USER)) {
     goto end;
@@ -187,8 +199,8 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
     *token_lifetime = strtol(expires_in->value, nullptr, 10) * GPR_MS_PER_SEC;
     if (!GRPC_MDISNULL(*token_md)) GRPC_MDELEM_UNREF(*token_md);
     *token_md = grpc_mdelem_from_slices(
-        grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY),
-        grpc_slice_from_copied_string(new_access_token));
+        grpc_core::ExternallyManagedSlice(GRPC_AUTHORIZATION_METADATA_KEY),
+        grpc_core::UnmanagedMemorySlice(new_access_token));
     status = GRPC_CREDENTIALS_OK;
   }
 
@@ -216,10 +228,12 @@ static void on_oauth2_token_fetcher_http_response(void* user_data,
 void grpc_oauth2_token_fetcher_credentials::on_http_response(
     grpc_credentials_metadata_request* r, grpc_error* error) {
   grpc_mdelem access_token_md = GRPC_MDNULL;
-  grpc_millis token_lifetime;
+  grpc_millis token_lifetime = 0;
   grpc_credentials_status status =
-      grpc_oauth2_token_fetcher_credentials_parse_server_response(
-          &r->response, &access_token_md, &token_lifetime);
+      error == GRPC_ERROR_NONE
+          ? grpc_oauth2_token_fetcher_credentials_parse_server_response(
+                &r->response, &access_token_md, &token_lifetime)
+          : GRPC_CREDENTIALS_ERROR;
   // Update cache and grab list of pending requests.
   gpr_mu_lock(&mu_);
   token_fetch_pending_ = false;
@@ -234,14 +248,15 @@ void grpc_oauth2_token_fetcher_credentials::on_http_response(
   gpr_mu_unlock(&mu_);
   // Invoke callbacks for all pending requests.
   while (pending_request != nullptr) {
+    grpc_error* new_error = GRPC_ERROR_NONE;
     if (status == GRPC_CREDENTIALS_OK) {
       grpc_credentials_mdelem_array_add(pending_request->md_array,
                                         access_token_md);
     } else {
-      error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
+      new_error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
           "Error occurred when fetching oauth2 token.", &error, 1);
     }
-    GRPC_CLOSURE_SCHED(pending_request->on_request_metadata, error);
+    GRPC_CLOSURE_SCHED(pending_request->on_request_metadata, new_error);
     grpc_polling_entity_del_from_pollset_set(
         pending_request->pollent, grpc_polling_entity_pollset_set(&pollent_));
     grpc_oauth2_pending_get_request_metadata* prev = pending_request;
@@ -356,7 +371,8 @@ class grpc_compute_engine_token_fetcher_credentials
                     grpc_polling_entity* pollent,
                     grpc_iomgr_cb_func response_cb,
                     grpc_millis deadline) override {
-    grpc_http_header header = {(char*)"Metadata-Flavor", (char*)"Google"};
+    grpc_http_header header = {const_cast<char*>("Metadata-Flavor"),
+                               const_cast<char*>("Google")};
     grpc_httpcli_request request;
     memset(&request, 0, sizeof(grpc_httpcli_request));
     request.host = (char*)GRPC_COMPUTE_ENGINE_METADATA_HOST;
@@ -369,11 +385,14 @@ class grpc_compute_engine_token_fetcher_credentials
     grpc_resource_quota* resource_quota =
         grpc_resource_quota_create("oauth2_credentials");
     grpc_httpcli_get(http_context, pollent, resource_quota, &request, deadline,
-                     GRPC_CLOSURE_CREATE(response_cb, metadata_req,
-                                         grpc_schedule_on_exec_ctx),
+                     GRPC_CLOSURE_INIT(&http_get_cb_closure_, response_cb,
+                                       metadata_req, grpc_schedule_on_exec_ctx),
                      &metadata_req->response);
     grpc_resource_quota_unref_internal(resource_quota);
   }
+
+ private:
+  grpc_closure http_get_cb_closure_;
 };
 
 }  // namespace
@@ -401,8 +420,9 @@ void grpc_google_refresh_token_credentials::fetch_oauth2(
     grpc_credentials_metadata_request* metadata_req,
     grpc_httpcli_context* httpcli_context, grpc_polling_entity* pollent,
     grpc_iomgr_cb_func response_cb, grpc_millis deadline) {
-  grpc_http_header header = {(char*)"Content-Type",
-                             (char*)"application/x-www-form-urlencoded"};
+  grpc_http_header header = {
+      const_cast<char*>("Content-Type"),
+      const_cast<char*>("application/x-www-form-urlencoded")};
   grpc_httpcli_request request;
   char* body = nullptr;
   gpr_asprintf(&body, GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING,
@@ -419,11 +439,11 @@ void grpc_google_refresh_token_credentials::fetch_oauth2(
      extreme memory pressure. */
   grpc_resource_quota* resource_quota =
       grpc_resource_quota_create("oauth2_credentials_refresh");
-  grpc_httpcli_post(
-      httpcli_context, pollent, resource_quota, &request, body, strlen(body),
-      deadline,
-      GRPC_CLOSURE_CREATE(response_cb, metadata_req, grpc_schedule_on_exec_ctx),
-      &metadata_req->response);
+  grpc_httpcli_post(httpcli_context, pollent, resource_quota, &request, body,
+                    strlen(body), deadline,
+                    GRPC_CLOSURE_INIT(&http_post_cb_closure_, response_cb,
+                                      metadata_req, grpc_schedule_on_exec_ctx),
+                    &metadata_req->response);
   grpc_resource_quota_unref_internal(resource_quota);
   gpr_free(body);
 }
@@ -473,6 +493,207 @@ grpc_call_credentials* grpc_google_refresh_token_credentials_create(
 }
 
 //
+// STS credentials.
+//
+
+namespace grpc_core {
+
+namespace {
+
+void MaybeAddToBody(gpr_strvec* body_strvec, const char* field_name,
+                    const char* field) {
+  if (field == nullptr || strlen(field) == 0) return;
+  char* new_query;
+  gpr_asprintf(&new_query, "&%s=%s", field_name, field);
+  gpr_strvec_add(body_strvec, new_query);
+}
+
+grpc_error* LoadTokenFile(const char* path, gpr_slice* token) {
+  grpc_error* err = grpc_load_file(path, 1, token);
+  if (err != GRPC_ERROR_NONE) return err;
+  if (GRPC_SLICE_LENGTH(*token) == 0) {
+    gpr_log(GPR_ERROR, "Token file %s is empty", path);
+    err = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Token file is empty.");
+  }
+  return err;
+}
+
+class StsTokenFetcherCredentials
+    : public grpc_oauth2_token_fetcher_credentials {
+ public:
+  StsTokenFetcherCredentials(grpc_uri* sts_url,  // Ownership transferred.
+                             const grpc_sts_credentials_options* options)
+      : sts_url_(sts_url),
+        resource_(gpr_strdup(options->resource)),
+        audience_(gpr_strdup(options->audience)),
+        scope_(gpr_strdup(options->scope)),
+        requested_token_type_(gpr_strdup(options->requested_token_type)),
+        subject_token_path_(gpr_strdup(options->subject_token_path)),
+        subject_token_type_(gpr_strdup(options->subject_token_type)),
+        actor_token_path_(gpr_strdup(options->actor_token_path)),
+        actor_token_type_(gpr_strdup(options->actor_token_type)) {}
+
+  ~StsTokenFetcherCredentials() override { grpc_uri_destroy(sts_url_); }
+
+ private:
+  void fetch_oauth2(grpc_credentials_metadata_request* metadata_req,
+                    grpc_httpcli_context* http_context,
+                    grpc_polling_entity* pollent,
+                    grpc_iomgr_cb_func response_cb,
+                    grpc_millis deadline) override {
+    char* body = nullptr;
+    size_t body_length = 0;
+    grpc_error* err = FillBody(&body, &body_length);
+    if (err != GRPC_ERROR_NONE) {
+      response_cb(metadata_req, err);
+      GRPC_ERROR_UNREF(err);
+      return;
+    }
+    grpc_http_header header = {
+        const_cast<char*>("Content-Type"),
+        const_cast<char*>("application/x-www-form-urlencoded")};
+    grpc_httpcli_request request;
+    memset(&request, 0, sizeof(grpc_httpcli_request));
+    request.host = (char*)sts_url_->authority;
+    request.http.path = (char*)sts_url_->path;
+    request.http.hdr_count = 1;
+    request.http.hdrs = &header;
+    request.handshaker = (strcmp(sts_url_->scheme, "https") == 0)
+                             ? &grpc_httpcli_ssl
+                             : &grpc_httpcli_plaintext;
+    /* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
+       channel. This would allow us to cancel an authentication query when under
+       extreme memory pressure. */
+    grpc_resource_quota* resource_quota =
+        grpc_resource_quota_create("oauth2_credentials_refresh");
+    grpc_httpcli_post(
+        http_context, pollent, resource_quota, &request, body, body_length,
+        deadline,
+        GRPC_CLOSURE_INIT(&http_post_cb_closure_, response_cb, metadata_req,
+                          grpc_schedule_on_exec_ctx),
+        &metadata_req->response);
+    grpc_resource_quota_unref_internal(resource_quota);
+    gpr_free(body);
+  }
+
+  grpc_error* FillBody(char** body, size_t* body_length) {
+    *body = nullptr;
+    gpr_strvec body_strvec;
+    gpr_strvec_init(&body_strvec);
+    grpc_slice subject_token = grpc_empty_slice();
+    grpc_slice actor_token = grpc_empty_slice();
+    grpc_error* err = GRPC_ERROR_NONE;
+
+    auto cleanup = [&body, &body_length, &body_strvec, &subject_token,
+                    &actor_token, &err]() {
+      if (err == GRPC_ERROR_NONE) {
+        *body = gpr_strvec_flatten(&body_strvec, body_length);
+      } else {
+        gpr_free(*body);
+      }
+      gpr_strvec_destroy(&body_strvec);
+      grpc_slice_unref_internal(subject_token);
+      grpc_slice_unref_internal(actor_token);
+      return err;
+    };
+
+    err = LoadTokenFile(subject_token_path_.get(), &subject_token);
+    if (err != GRPC_ERROR_NONE) return cleanup();
+    gpr_asprintf(
+        body, GRPC_STS_POST_MINIMAL_BODY_FORMAT_STRING,
+        reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(subject_token)),
+        subject_token_type_.get());
+    gpr_strvec_add(&body_strvec, *body);
+    MaybeAddToBody(&body_strvec, "resource", resource_.get());
+    MaybeAddToBody(&body_strvec, "audience", audience_.get());
+    MaybeAddToBody(&body_strvec, "scope", scope_.get());
+    MaybeAddToBody(&body_strvec, "requested_token_type",
+                   requested_token_type_.get());
+    if (actor_token_path_ != nullptr) {
+      err = LoadTokenFile(actor_token_path_.get(), &actor_token);
+      if (err != GRPC_ERROR_NONE) return cleanup();
+      MaybeAddToBody(
+          &body_strvec, "actor_token",
+          reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(subject_token)));
+      MaybeAddToBody(&body_strvec, "actor_token_type", actor_token_type_.get());
+    }
+    return cleanup();
+  }
+
+  grpc_uri* sts_url_;
+  grpc_closure http_post_cb_closure_;
+  grpc_core::UniquePtr<char> resource_;
+  grpc_core::UniquePtr<char> audience_;
+  grpc_core::UniquePtr<char> scope_;
+  grpc_core::UniquePtr<char> requested_token_type_;
+  grpc_core::UniquePtr<char> subject_token_path_;
+  grpc_core::UniquePtr<char> subject_token_type_;
+  grpc_core::UniquePtr<char> actor_token_path_;
+  grpc_core::UniquePtr<char> actor_token_type_;
+};
+
+}  // namespace
+
+grpc_error* ValidateStsCredentialsOptions(
+    const grpc_sts_credentials_options* options, grpc_uri** sts_url_out) {
+  struct GrpcUriDeleter {
+    void operator()(grpc_uri* uri) { grpc_uri_destroy(uri); }
+  };
+  *sts_url_out = nullptr;
+  InlinedVector<grpc_error*, 3> error_list;
+  UniquePtr<grpc_uri, GrpcUriDeleter> sts_url(
+      options->token_exchange_service_uri != nullptr
+          ? grpc_uri_parse(options->token_exchange_service_uri, false)
+          : nullptr);
+  if (sts_url == nullptr) {
+    error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "Invalid or missing STS endpoint URL"));
+  } else {
+    if (strcmp(sts_url->scheme, "https") != 0 &&
+        strcmp(sts_url->scheme, "http") != 0) {
+      error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+          "Invalid URI scheme, must be https to http."));
+    }
+  }
+  if (options->subject_token_path == nullptr ||
+      strlen(options->subject_token_path) == 0) {
+    error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "subject_token needs to be specified"));
+  }
+  if (options->subject_token_type == nullptr ||
+      strlen(options->subject_token_type) == 0) {
+    error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "subject_token_type needs to be specified"));
+  }
+  if (error_list.empty()) {
+    *sts_url_out = sts_url.release();
+    return GRPC_ERROR_NONE;
+  } else {
+    return GRPC_ERROR_CREATE_FROM_VECTOR("Invalid STS Credentials Options",
+                                         &error_list);
+  }
+}
+
+}  // namespace grpc_core
+
+grpc_call_credentials* grpc_sts_credentials_create(
+    const grpc_sts_credentials_options* options, void* reserved) {
+  GPR_ASSERT(reserved == nullptr);
+  grpc_uri* sts_url;
+  grpc_error* error =
+      grpc_core::ValidateStsCredentialsOptions(options, &sts_url);
+  if (error != GRPC_ERROR_NONE) {
+    gpr_log(GPR_ERROR, "STS Credentials creation failed. Error: %s.",
+            grpc_error_string(error));
+    GRPC_ERROR_UNREF(error);
+    return nullptr;
+  }
+  return grpc_core::MakeRefCounted<grpc_core::StsTokenFetcherCredentials>(
+             sts_url, options)
+      .release();
+}
+
+//
 // Oauth2 Access Token credentials.
 //
 
@@ -500,8 +721,8 @@ grpc_access_token_credentials::grpc_access_token_credentials(
   gpr_asprintf(&token_md_value, "Bearer %s", access_token);
   grpc_core::ExecCtx exec_ctx;
   access_token_md_ = grpc_mdelem_from_slices(
-      grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY),
-      grpc_slice_from_copied_string(token_md_value));
+      grpc_core::ExternallyManagedSlice(GRPC_AUTHORIZATION_METADATA_KEY),
+      grpc_core::UnmanagedMemorySlice(token_md_value));
   gpr_free(token_md_value);
 }
 
index 510a78b..c9b2d1d 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include <grpc/grpc_security.h>
 #include "src/core/lib/json/json.h"
 #include "src/core/lib/security/credentials/credentials.h"
+#include "src/core/lib/uri/uri_parser.h"
+
+// Constants.
+#define GRPC_STS_POST_MINIMAL_BODY_FORMAT_STRING                               \
+  "grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=%" \
+  "s&subject_token_type=%s"
 
 // auth_refresh_token parsing.
 typedef struct {
@@ -115,6 +122,7 @@ class grpc_google_refresh_token_credentials final
 
  private:
   grpc_auth_refresh_token refresh_token_;
+  grpc_closure http_post_cb_closure_;
 };
 
 // Access token credentials.
@@ -148,4 +156,12 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
     const struct grpc_http_response* response, grpc_mdelem* token_md,
     grpc_millis* token_lifetime);
 
+namespace grpc_core {
+// Exposed for testing only. This function validates the options, ensuring that
+// the required fields are set, and outputs the parsed URL of the STS token
+// exchanged service.
+grpc_error* ValidateStsCredentialsOptions(
+    const grpc_sts_credentials_options* options, grpc_uri** sts_url);
+}  // namespace grpc_core
+
 #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */
index a6169a1..7e0af3d 100644 (file)
@@ -157,6 +157,29 @@ int grpc_tls_key_materials_config_set_key_materials(
   return 1;
 }
 
+int grpc_tls_key_materials_config_set_version(
+    grpc_tls_key_materials_config* config, int version) {
+  if (config == nullptr) {
+    gpr_log(GPR_ERROR,
+            "Invalid arguments to "
+            "grpc_tls_key_materials_config_set_version()");
+    return 0;
+  }
+  config->set_version(version);
+  return 1;
+}
+
+int grpc_tls_key_materials_config_get_version(
+    grpc_tls_key_materials_config* config) {
+  if (config == nullptr) {
+    gpr_log(GPR_ERROR,
+            "Invalid arguments to "
+            "grpc_tls_key_materials_config_get_version()");
+    return -1;
+  }
+  return config->version();
+}
+
 grpc_tls_credential_reload_config* grpc_tls_credential_reload_config_create(
     const void* config_user_data,
     int (*schedule)(void* config_user_data,
index aee9292..af40741 100644 (file)
@@ -39,12 +39,15 @@ struct grpc_tls_key_materials_config
   const PemKeyCertPairList& pem_key_cert_pair_list() const {
     return pem_key_cert_pair_list_;
   }
+  int version() const { return version_; }
 
   /** Setters for member fields. **/
   void set_key_materials(grpc_core::UniquePtr<char> pem_root_certs,
                          PemKeyCertPairList pem_key_cert_pair_list);
+  void set_version(int version) { version_ = version; }
 
  private:
+  int version_ = 0;
   PemKeyCertPairList pem_key_cert_pair_list_;
   grpc_core::UniquePtr<char> pem_root_certs_;
 };
index da76493..e8433bf 100644 (file)
@@ -84,7 +84,7 @@ SpiffeCredentials::create_security_connector(
           static_cast<tsi_ssl_session_cache*>(arg->value.pointer.p);
     }
   }
-  grpc_core::RefCountedPtr<grpc_channel_security_connector> sc =
+  grpc_core::RefCountedPtr<grpc_channel_security_connector> sc = grpc_core::
       SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector(
           this->Ref(), std::move(call_creds), target_name,
           overridden_target_name, ssl_session_cache);
@@ -106,8 +106,8 @@ SpiffeServerCredentials::~SpiffeServerCredentials() {}
 
 grpc_core::RefCountedPtr<grpc_server_security_connector>
 SpiffeServerCredentials::create_security_connector() {
-  return SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector(
-      this->Ref());
+  return grpc_core::SpiffeServerSecurityConnector::
+      CreateSpiffeServerSecurityConnector(this->Ref());
 }
 
 grpc_channel_credentials* grpc_tls_spiffe_credentials_create(
index 38b1f85..7990860 100644 (file)
@@ -108,10 +108,11 @@ class grpc_alts_channel_security_connector final
     return strcmp(target_name_, other->target_name_);
   }
 
-  bool check_call_host(const char* host, grpc_auth_context* auth_context,
+  bool check_call_host(grpc_core::StringView host,
+                       grpc_auth_context* auth_context,
                        grpc_closure* on_call_host_checked,
                        grpc_error** error) override {
-    if (host == nullptr || strcmp(host, target_name_) != 0) {
+    if (host.empty() || host != target_name_) {
       *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
           "ALTS call host does not match target name");
     }
index c55fd34..940c2ac 100644 (file)
@@ -31,8 +31,8 @@
 #include "src/core/ext/transport/chttp2/alpn/alpn.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/handshaker.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/security/context/security_context.h"
 #include "src/core/lib/security/credentials/credentials.h"
@@ -102,39 +102,35 @@ class grpc_fake_channel_security_connector final
         tsi_create_fake_handshaker(/*is_client=*/true), this));
   }
 
-  bool check_call_host(const char* host, grpc_auth_context* auth_context,
+  bool check_call_host(grpc_core::StringView host,
+                       grpc_auth_context* auth_context,
                        grpc_closure* on_call_host_checked,
                        grpc_error** error) override {
-    char* authority_hostname = nullptr;
-    char* authority_ignored_port = nullptr;
-    char* target_hostname = nullptr;
-    char* target_ignored_port = nullptr;
-    gpr_split_host_port(host, &authority_hostname, &authority_ignored_port);
-    gpr_split_host_port(target_, &target_hostname, &target_ignored_port);
+    grpc_core::StringView authority_hostname;
+    grpc_core::StringView authority_ignored_port;
+    grpc_core::StringView target_hostname;
+    grpc_core::StringView target_ignored_port;
+    grpc_core::SplitHostPort(host, &authority_hostname,
+                             &authority_ignored_port);
+    grpc_core::SplitHostPort(target_, &target_hostname, &target_ignored_port);
     if (target_name_override_ != nullptr) {
-      char* fake_security_target_name_override_hostname = nullptr;
-      char* fake_security_target_name_override_ignored_port = nullptr;
-      gpr_split_host_port(target_name_override_,
-                          &fake_security_target_name_override_hostname,
-                          &fake_security_target_name_override_ignored_port);
-      if (strcmp(authority_hostname,
-                 fake_security_target_name_override_hostname) != 0) {
+      grpc_core::StringView fake_security_target_name_override_hostname;
+      grpc_core::StringView fake_security_target_name_override_ignored_port;
+      grpc_core::SplitHostPort(
+          target_name_override_, &fake_security_target_name_override_hostname,
+          &fake_security_target_name_override_ignored_port);
+      if (authority_hostname != fake_security_target_name_override_hostname) {
         gpr_log(GPR_ERROR,
                 "Authority (host) '%s' != Fake Security Target override '%s'",
-                host, fake_security_target_name_override_hostname);
+                host.data(),
+                fake_security_target_name_override_hostname.data());
         abort();
       }
-      gpr_free(fake_security_target_name_override_hostname);
-      gpr_free(fake_security_target_name_override_ignored_port);
-    } else if (strcmp(authority_hostname, target_hostname) != 0) {
-      gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'",
-              authority_hostname, target_hostname);
+    } else if (authority_hostname != target_hostname) {
+      gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'", host.data(),
+              target_);
       abort();
     }
-    gpr_free(authority_hostname);
-    gpr_free(authority_ignored_port);
-    gpr_free(target_hostname);
-    gpr_free(target_ignored_port);
     return true;
   }
 
index c1a101d..5b77700 100644 (file)
@@ -156,10 +156,11 @@ class grpc_local_channel_security_connector final
                      creds->connect_type());
   }
 
-  bool check_call_host(const char* host, grpc_auth_context* auth_context,
+  bool check_call_host(grpc_core::StringView host,
+                       grpc_auth_context* auth_context,
                        grpc_closure* on_call_host_checked,
                        grpc_error** error) override {
-    if (host == nullptr || strcmp(host, target_name_) != 0) {
+    if (host.empty() || host != target_name_) {
       *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
           "local call host does not match target name");
     }
index 47c0ad5..2c7c982 100644 (file)
@@ -28,8 +28,8 @@
 #include "src/core/ext/transport/chttp2/alpn/alpn.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/handshaker.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/iomgr/load_file.h"
 #include "src/core/lib/security/context/security_context.h"
 #include "src/core/lib/security/credentials/credentials.h"
index f71ee54..e5ced44 100644 (file)
@@ -98,7 +98,7 @@ class grpc_channel_security_connector : public grpc_security_connector {
   /// Returns true if completed synchronously, in which case \a error will
   /// be set to indicate the result.  Otherwise, \a on_call_host_checked
   /// will be invoked when complete.
-  virtual bool check_call_host(const char* host,
+  virtual bool check_call_host(grpc_core::StringView host,
                                grpc_auth_context* auth_context,
                                grpc_closure* on_call_host_checked,
                                grpc_error** error) GRPC_ABSTRACT;
index f920dc6..97c04ca 100644 (file)
@@ -28,8 +28,8 @@
 
 #include "src/core/ext/transport/chttp2/alpn/alpn.h"
 #include "src/core/lib/channel/handshaker.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/security/context/security_context.h"
 #include "src/core/lib/security/credentials/credentials.h"
@@ -75,15 +75,14 @@ class grpc_ssl_channel_security_connector final
                                     ? nullptr
                                     : gpr_strdup(overridden_target_name)),
         verify_options_(&config->verify_options) {
-    char* port;
-    gpr_split_host_port(target_name, &target_name_, &port);
-    gpr_free(port);
+    grpc_core::StringView host;
+    grpc_core::StringView port;
+    grpc_core::SplitHostPort(target_name, &host, &port);
+    target_name_ = host.dup();
   }
 
   ~grpc_ssl_channel_security_connector() override {
     tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
-    if (target_name_ != nullptr) gpr_free(target_name_);
-    if (overridden_target_name_ != nullptr) gpr_free(overridden_target_name_);
   }
 
   grpc_security_status InitializeHandshakerFactory(
@@ -123,8 +122,8 @@ class grpc_ssl_channel_security_connector final
     tsi_handshaker* tsi_hs = nullptr;
     tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
         client_handshaker_factory_,
-        overridden_target_name_ != nullptr ? overridden_target_name_
-                                           : target_name_,
+        overridden_target_name_ != nullptr ? overridden_target_name_.get()
+                                           : target_name_.get(),
         &tsi_hs);
     if (result != TSI_OK) {
       gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.",
@@ -139,8 +138,8 @@ class grpc_ssl_channel_security_connector final
                   grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
                   grpc_closure* on_peer_checked) override {
     const char* target_name = overridden_target_name_ != nullptr
-                                  ? overridden_target_name_
-                                  : target_name_;
+                                  ? overridden_target_name_.get()
+                                  : target_name_.get();
     grpc_error* error = ssl_check_peer(target_name, &peer, auth_context);
     if (error == GRPC_ERROR_NONE &&
         verify_options_->verify_peer_callback != nullptr) {
@@ -175,17 +174,18 @@ class grpc_ssl_channel_security_connector final
         reinterpret_cast<const grpc_ssl_channel_security_connector*>(other_sc);
     int c = channel_security_connector_cmp(other);
     if (c != 0) return c;
-    c = strcmp(target_name_, other->target_name_);
+    c = strcmp(target_name_.get(), other->target_name_.get());
     if (c != 0) return c;
     return (overridden_target_name_ == nullptr ||
             other->overridden_target_name_ == nullptr)
-               ? GPR_ICMP(overridden_target_name_,
-                          other->overridden_target_name_)
-               : strcmp(overridden_target_name_,
-                        other->overridden_target_name_);
+               ? GPR_ICMP(overridden_target_name_.get(),
+                          other->overridden_target_name_.get())
+               : strcmp(overridden_target_name_.get(),
+                        other->overridden_target_name_.get());
   }
 
-  bool check_call_host(const char* host, grpc_auth_context* auth_context,
+  bool check_call_host(grpc_core::StringView host,
+                       grpc_auth_context* auth_context,
                        grpc_closure* on_call_host_checked,
                        grpc_error** error) override {
     grpc_security_status status = GRPC_SECURITY_ERROR;
@@ -194,7 +194,7 @@ class grpc_ssl_channel_security_connector final
     /* If the target name was overridden, then the original target_name was
        'checked' transitively during the previous peer check at the end of the
        handshake. */
-    if (overridden_target_name_ != nullptr && strcmp(host, target_name_) == 0) {
+    if (overridden_target_name_ != nullptr && host == target_name_.get()) {
       status = GRPC_SECURITY_OK;
     }
     if (status != GRPC_SECURITY_OK) {
@@ -212,8 +212,8 @@ class grpc_ssl_channel_security_connector final
 
  private:
   tsi_ssl_client_handshaker_factory* client_handshaker_factory_;
-  char* target_name_;
-  char* overridden_target_name_;
+  grpc_core::UniquePtr<char> target_name_;
+  grpc_core::UniquePtr<char> overridden_target_name_;
   const verify_peer_options* verify_options_;
 };
 
index cb0d543..bacd31a 100644 (file)
 
 #include "src/core/ext/transport/chttp2/alpn/alpn.h"
 #include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
-#include "src/core/lib/gprpp/global_config.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/load_file.h"
 #include "src/core/lib/security/context/security_context.h"
 #include "src/core/lib/security/security_connector/load_system_roots.h"
+#include "src/core/lib/security/security_connector/ssl_utils_config.h"
 #include "src/core/tsi/ssl_transport_security.h"
 
 /* -- Constants. -- */
@@ -45,17 +45,6 @@ static const char* installed_roots_path =
     INSTALL_PREFIX "/share/grpc/roots.pem";
 #endif
 
-/** Config variable that points to the default SSL roots file. This file
-   must be a PEM encoded file with all the roots such as the one that can be
-   downloaded from https://pki.google.com/roots.pem.  */
-GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_default_ssl_roots_file_path, "",
-                                "Path to the default SSL roots file.");
-
-/** Config variable used as a flag to enable/disable loading system root
-    certificates from the OS trust store. */
-GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_not_use_system_ssl_roots, false,
-                              "Disable loading system root certificates.");
-
 #ifndef TSI_OPENSSL_ALPN_SUPPORT
 #define TSI_OPENSSL_ALPN_SUPPORT 1
 #endif
@@ -136,12 +125,13 @@ grpc_error* grpc_ssl_check_alpn(const tsi_peer* peer) {
   return GRPC_ERROR_NONE;
 }
 
-grpc_error* grpc_ssl_check_peer_name(const char* peer_name,
+grpc_error* grpc_ssl_check_peer_name(grpc_core::StringView peer_name,
                                      const tsi_peer* peer) {
   /* Check the peer name if specified. */
-  if (peer_name != nullptr && !grpc_ssl_host_matches_name(peer, peer_name)) {
+  if (!peer_name.empty() && !grpc_ssl_host_matches_name(peer, peer_name)) {
     char* msg;
-    gpr_asprintf(&msg, "Peer name %s is not in peer certificate", peer_name);
+    gpr_asprintf(&msg, "Peer name %s is not in peer certificate",
+                 peer_name.data());
     grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
     gpr_free(msg);
     return error;
@@ -149,15 +139,16 @@ grpc_error* grpc_ssl_check_peer_name(const char* peer_name,
   return GRPC_ERROR_NONE;
 }
 
-bool grpc_ssl_check_call_host(const char* host, const char* target_name,
-                              const char* overridden_target_name,
+bool grpc_ssl_check_call_host(grpc_core::StringView host,
+                              grpc_core::StringView target_name,
+                              grpc_core::StringView overridden_target_name,
                               grpc_auth_context* auth_context,
                               grpc_closure* on_call_host_checked,
                               grpc_error** error) {
   grpc_security_status status = GRPC_SECURITY_ERROR;
   tsi_peer peer = grpc_shallow_peer_from_ssl_auth_context(auth_context);
   if (grpc_ssl_host_matches_name(&peer, host)) status = GRPC_SECURITY_OK;
-  if (overridden_target_name != nullptr && strcmp(host, target_name) == 0) {
+  if (!overridden_target_name.empty() && host == target_name) {
     status = GRPC_SECURITY_OK;
   }
   if (status != GRPC_SECURITY_OK) {
@@ -179,35 +170,28 @@ const char** grpc_fill_alpn_protocol_strings(size_t* num_alpn_protocols) {
   return alpn_protocol_strings;
 }
 
-int grpc_ssl_host_matches_name(const tsi_peer* peer, const char* peer_name) {
-  char* allocated_name = nullptr;
-  int r;
-
-  char* ignored_port;
-  gpr_split_host_port(peer_name, &allocated_name, &ignored_port);
-  gpr_free(ignored_port);
-  peer_name = allocated_name;
-  if (!peer_name) return 0;
+int grpc_ssl_host_matches_name(const tsi_peer* peer,
+                               grpc_core::StringView peer_name) {
+  grpc_core::StringView allocated_name;
+  grpc_core::StringView ignored_port;
+  grpc_core::SplitHostPort(peer_name, &allocated_name, &ignored_port);
+  if (allocated_name.empty()) return 0;
 
   // IPv6 zone-id should not be included in comparisons.
-  char* const zone_id = strchr(allocated_name, '%');
-  if (zone_id != nullptr) *zone_id = '\0';
-
-  r = tsi_ssl_peer_matches_name(peer, peer_name);
-  gpr_free(allocated_name);
-  return r;
+  const size_t zone_id = allocated_name.find('%');
+  if (zone_id != grpc_core::StringView::npos) {
+    allocated_name.remove_suffix(allocated_name.size() - zone_id);
+  }
+  return tsi_ssl_peer_matches_name(peer, allocated_name);
 }
 
-bool grpc_ssl_cmp_target_name(const char* target_name,
-                              const char* other_target_name,
-                              const char* overridden_target_name,
-                              const char* other_overridden_target_name) {
-  int c = strcmp(target_name, other_target_name);
+int grpc_ssl_cmp_target_name(
+    grpc_core::StringView target_name, grpc_core::StringView other_target_name,
+    grpc_core::StringView overridden_target_name,
+    grpc_core::StringView other_overridden_target_name) {
+  int c = target_name.cmp(other_target_name);
   if (c != 0) return c;
-  return (overridden_target_name == nullptr ||
-          other_overridden_target_name == nullptr)
-             ? GPR_ICMP(overridden_target_name, other_overridden_target_name)
-             : strcmp(overridden_target_name, other_overridden_target_name);
+  return overridden_target_name.cmp(other_overridden_target_name);
 }
 
 grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
index 1765a34..c13dd90 100644 (file)
 
 #include "src/core/lib/gprpp/global_config.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/gprpp/string_view.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/security/security_connector/security_connector.h"
+#include "src/core/lib/security/security_connector/ssl_utils_config.h"
 #include "src/core/tsi/ssl_transport_security.h"
 #include "src/core/tsi/transport_security.h"
 #include "src/core/tsi/transport_security_interface.h"
 
-GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_default_ssl_roots_file_path);
-GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots);
-
 /* --- Util --- */
 
 /* --- URL schemes. --- */
@@ -46,16 +45,17 @@ GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots);
 grpc_error* grpc_ssl_check_alpn(const tsi_peer* peer);
 
 /* Check peer name information returned from SSL handshakes. */
-grpc_error* grpc_ssl_check_peer_name(const char* peer_name,
+grpc_error* grpc_ssl_check_peer_name(grpc_core::StringView peer_name,
                                      const tsi_peer* peer);
 /* Compare targer_name information extracted from SSL security connectors. */
-bool grpc_ssl_cmp_target_name(const char* target_name,
-                              const char* other_target_name,
-                              const char* overridden_target_name,
-                              const char* other_overridden_target_name);
+int grpc_ssl_cmp_target_name(
+    grpc_core::StringView target_name, grpc_core::StringView other_target_name,
+    grpc_core::StringView overridden_target_name,
+    grpc_core::StringView other_overridden_target_name);
 /* Check the host that will be set for a call is acceptable.*/
-bool grpc_ssl_check_call_host(const char* host, const char* target_name,
-                              const char* overridden_target_name,
+bool grpc_ssl_check_call_host(grpc_core::StringView host,
+                              grpc_core::StringView target_name,
+                              grpc_core::StringView overridden_target_name,
                               grpc_auth_context* auth_context,
                               grpc_closure* on_call_host_checked,
                               grpc_error** error);
@@ -89,7 +89,8 @@ grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
 tsi_peer grpc_shallow_peer_from_ssl_auth_context(
     const grpc_auth_context* auth_context);
 void grpc_shallow_peer_destruct(tsi_peer* peer);
-int grpc_ssl_host_matches_name(const tsi_peer* peer, const char* peer_name);
+int grpc_ssl_host_matches_name(const tsi_peer* peer,
+                               grpc_core::StringView peer_name);
 
 /* --- Default SSL Root Store. --- */
 namespace grpc_core {
@@ -146,9 +147,15 @@ class PemKeyCertPair {
     return *this;
   }
 
-  // Not copyable.
-  PemKeyCertPair(const PemKeyCertPair&) = delete;
-  PemKeyCertPair& operator=(const PemKeyCertPair&) = delete;
+  // Copyable.
+  PemKeyCertPair(const PemKeyCertPair& other)
+      : private_key_(gpr_strdup(other.private_key())),
+        cert_chain_(gpr_strdup(other.cert_chain())) {}
+  PemKeyCertPair& operator=(const PemKeyCertPair& other) {
+    private_key_ = grpc_core::UniquePtr<char>(gpr_strdup(other.private_key()));
+    cert_chain_ = grpc_core::UniquePtr<char>(gpr_strdup(other.cert_chain()));
+    return *this;
+  }
 
   char* private_key() const { return private_key_.get(); }
   char* cert_chain() const { return cert_chain_.get(); }
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.cc b/legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.cc
new file mode 100644 (file)
index 0000000..2d056a7
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/security/security_connector/ssl_utils_config.h"
+
+/** Config variable that points to the default SSL roots file. This file
+    must be a PEM encoded file with all the roots such as the one that can be
+    downloaded from https://pki.google.com/roots.pem. */
+GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_default_ssl_roots_file_path, "",
+                                "Path to the default SSL roots file.");
+
+/** Config variable used as a flag to enable/disable loading system root
+    certificates from the OS trust store. */
+GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_not_use_system_ssl_roots, false,
+                              "Disable loading system root certificates.");
diff --git a/legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.h b/legacy-libs/grpc/deps/grpc/src/core/lib/security/security_connector/ssl_utils_config.h
new file mode 100644 (file)
index 0000000..efaf497
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright 2019 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H
+#define GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H
+
+#include <grpc/support/port_platform.h>
+
+#include "src/core/lib/gprpp/global_config.h"
+
+GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_default_ssl_roots_file_path);
+GPR_GLOBAL_CONFIG_DECLARE_BOOL(grpc_not_use_system_ssl_roots);
+
+#endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_UTILS_CONFIG_H \
+        */
index ebf9c90..be20b60 100644 (file)
@@ -28,7 +28,7 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
-#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/gprpp/host_port.h"
 #include "src/core/lib/security/credentials/ssl/ssl_credentials.h"
 #include "src/core/lib/security/credentials/tls/spiffe_credentials.h"
 #include "src/core/lib/security/security_connector/ssl_utils.h"
@@ -38,6 +38,8 @@
 #include "src/core/tsi/ssl_transport_security.h"
 #include "src/core/tsi/transport_security.h"
 
+namespace grpc_core {
+
 namespace {
 
 tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair(
@@ -58,42 +60,55 @@ tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair(
   return tsi_pairs;
 }
 
-/** -- Util function to populate SPIFFE server/channel credentials. -- */
-grpc_core::RefCountedPtr<grpc_tls_key_materials_config>
-PopulateSpiffeCredentials(const grpc_tls_credentials_options& options) {
-  GPR_ASSERT(options.credential_reload_config() != nullptr ||
-             options.key_materials_config() != nullptr);
-  grpc_core::RefCountedPtr<grpc_tls_key_materials_config> key_materials_config;
+}  // namespace
+
+/** -- Util function to fetch SPIFFE server/channel credentials. -- */
+grpc_status_code TlsFetchKeyMaterials(
+    const grpc_core::RefCountedPtr<grpc_tls_key_materials_config>&
+        key_materials_config,
+    const grpc_tls_credentials_options& options,
+    grpc_ssl_certificate_config_reload_status* reload_status) {
+  GPR_ASSERT(key_materials_config != nullptr);
+  bool is_key_materials_empty =
+      key_materials_config->pem_key_cert_pair_list().empty();
+  if (options.credential_reload_config() == nullptr && is_key_materials_empty) {
+    gpr_log(GPR_ERROR,
+            "Either credential reload config or key materials should be "
+            "provisioned.");
+    return GRPC_STATUS_FAILED_PRECONDITION;
+  }
+  grpc_status_code status = GRPC_STATUS_OK;
   /* Use credential reload config to fetch credentials. */
   if (options.credential_reload_config() != nullptr) {
     grpc_tls_credential_reload_arg* arg =
         grpc_core::New<grpc_tls_credential_reload_arg>();
-    key_materials_config = grpc_tls_key_materials_config_create()->Ref();
     arg->key_materials_config = key_materials_config.get();
     int result = options.credential_reload_config()->Schedule(arg);
     if (result) {
       /* Do not support async credential reload. */
       gpr_log(GPR_ERROR, "Async credential reload is unsupported now.");
+      status =
+          is_key_materials_empty ? GRPC_STATUS_UNIMPLEMENTED : GRPC_STATUS_OK;
     } else {
-      grpc_ssl_certificate_config_reload_status status = arg->status;
-      if (status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED) {
+      GPR_ASSERT(reload_status != nullptr);
+      *reload_status = arg->status;
+      if (arg->status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED) {
+        /* Key materials is not empty. */
         gpr_log(GPR_DEBUG, "Credential does not change after reload.");
-      } else if (status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL) {
-        gpr_log(GPR_ERROR, "Credential reload failed with an error: %s",
-                arg->error_details);
+      } else if (arg->status == GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL) {
+        gpr_log(GPR_ERROR, "Credential reload failed with an error:");
+        if (arg->error_details != nullptr) {
+          gpr_log(GPR_ERROR, "%s", arg->error_details);
+        }
+        status = is_key_materials_empty ? GRPC_STATUS_INTERNAL : GRPC_STATUS_OK;
       }
     }
     gpr_free((void*)arg->error_details);
     grpc_core::Delete(arg);
-    /* Use existing key materials config. */
-  } else {
-    key_materials_config = options.key_materials_config()->Ref();
   }
-  return key_materials_config;
+  return status;
 }
 
-}  // namespace
-
 SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector(
     grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
     grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
@@ -104,34 +119,37 @@ SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector(
       overridden_target_name_(overridden_target_name == nullptr
                                   ? nullptr
                                   : gpr_strdup(overridden_target_name)) {
+  key_materials_config_ = grpc_tls_key_materials_config_create()->Ref();
   check_arg_ = ServerAuthorizationCheckArgCreate(this);
-  char* port;
-  gpr_split_host_port(target_name, &target_name_, &port);
-  gpr_free(port);
+  grpc_core::StringView host;
+  grpc_core::StringView port;
+  grpc_core::SplitHostPort(target_name, &host, &port);
+  target_name_ = host.dup();
 }
 
 SpiffeChannelSecurityConnector::~SpiffeChannelSecurityConnector() {
-  if (target_name_ != nullptr) {
-    gpr_free(target_name_);
-  }
-  if (overridden_target_name_ != nullptr) {
-    gpr_free(overridden_target_name_);
-  }
   if (client_handshaker_factory_ != nullptr) {
     tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
   }
+  if (key_materials_config_.get() != nullptr) {
+    key_materials_config_.get()->Unref();
+  }
   ServerAuthorizationCheckArgDestroy(check_arg_);
 }
 
 void SpiffeChannelSecurityConnector::add_handshakers(
     grpc_pollset_set* interested_parties,
     grpc_core::HandshakeManager* handshake_mgr) {
+  if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) {
+    gpr_log(GPR_ERROR, "Handshaker factory refresh failed.");
+    return;
+  }
   // Instantiate TSI handshaker.
   tsi_handshaker* tsi_hs = nullptr;
   tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
       client_handshaker_factory_,
-      overridden_target_name_ != nullptr ? overridden_target_name_
-                                         : target_name_,
+      overridden_target_name_ != nullptr ? overridden_target_name_.get()
+                                         : target_name_.get(),
       &tsi_hs);
   if (result != TSI_OK) {
     gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.",
@@ -147,8 +165,8 @@ void SpiffeChannelSecurityConnector::check_peer(
     grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
     grpc_closure* on_peer_checked) {
   const char* target_name = overridden_target_name_ != nullptr
-                                ? overridden_target_name_
-                                : target_name_;
+                                ? overridden_target_name_.get()
+                                : target_name_.get();
   grpc_error* error = grpc_ssl_check_alpn(&peer);
   if (error != GRPC_ERROR_NONE) {
     GRPC_CLOSURE_SCHED(on_peer_checked, error);
@@ -203,16 +221,17 @@ int SpiffeChannelSecurityConnector::cmp(
   if (c != 0) {
     return c;
   }
-  return grpc_ssl_cmp_target_name(target_name_, other->target_name_,
-                                  overridden_target_name_,
-                                  other->overridden_target_name_);
+  return grpc_ssl_cmp_target_name(target_name_.get(), other->target_name_.get(),
+                                  overridden_target_name_.get(),
+                                  other->overridden_target_name_.get());
 }
 
 bool SpiffeChannelSecurityConnector::check_call_host(
-    const char* host, grpc_auth_context* auth_context,
+    grpc_core::StringView host, grpc_auth_context* auth_context,
     grpc_closure* on_call_host_checked, grpc_error** error) {
-  return grpc_ssl_check_call_host(host, target_name_, overridden_target_name_,
-                                  auth_context, on_call_host_checked, error);
+  return grpc_ssl_check_call_host(host, target_name_.get(),
+                                  overridden_target_name_.get(), auth_context,
+                                  on_call_host_checked, error);
 }
 
 void SpiffeChannelSecurityConnector::cancel_check_call_host(
@@ -243,32 +262,75 @@ SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector(
           std::move(channel_creds), std::move(request_metadata_creds),
           target_name, overridden_target_name);
   if (c->InitializeHandshakerFactory(ssl_session_cache) != GRPC_SECURITY_OK) {
+    gpr_log(GPR_ERROR, "Could not initialize client handshaker factory.");
     return nullptr;
   }
   return c;
 }
 
-grpc_security_status
-SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
+grpc_security_status SpiffeChannelSecurityConnector::ReplaceHandshakerFactory(
     tsi_ssl_session_cache* ssl_session_cache) {
-  const SpiffeCredentials* creds =
-      static_cast<const SpiffeCredentials*>(channel_creds());
-  auto key_materials_config = PopulateSpiffeCredentials(creds->options());
-  if (key_materials_config->pem_key_cert_pair_list().empty()) {
-    key_materials_config->Unref();
-    return GRPC_SECURITY_ERROR;
+  /* Free the client handshaker factory if exists. */
+  if (client_handshaker_factory_) {
+    tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
   }
+  GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty());
   tsi_ssl_pem_key_cert_pair* pem_key_cert_pair = ConvertToTsiPemKeyCertPair(
-      key_materials_config->pem_key_cert_pair_list());
+      key_materials_config_->pem_key_cert_pair_list());
   grpc_security_status status = grpc_ssl_tsi_client_handshaker_factory_init(
-      pem_key_cert_pair, key_materials_config->pem_root_certs(),
+      pem_key_cert_pair, key_materials_config_->pem_root_certs(),
       ssl_session_cache, &client_handshaker_factory_);
-  // Free memory.
-  key_materials_config->Unref();
+  /* Free memory. */
   grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pair, 1);
   return status;
 }
 
+grpc_security_status
+SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
+    tsi_ssl_session_cache* ssl_session_cache) {
+  grpc_core::MutexLock lock(&mu_);
+  const SpiffeCredentials* creds =
+      static_cast<const SpiffeCredentials*>(channel_creds());
+  grpc_tls_key_materials_config* key_materials_config =
+      creds->options().key_materials_config();
+  /* Copy key materials config from credential options. */
+  if (key_materials_config != nullptr) {
+    grpc_tls_key_materials_config::PemKeyCertPairList cert_pair_list =
+        key_materials_config->pem_key_cert_pair_list();
+    auto pem_root_certs = grpc_core::UniquePtr<char>(
+        gpr_strdup(key_materials_config->pem_root_certs()));
+    key_materials_config_->set_key_materials(std::move(pem_root_certs),
+                                             std::move(cert_pair_list));
+  }
+  grpc_ssl_certificate_config_reload_status reload_status =
+      GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
+  if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
+                           &reload_status) != GRPC_STATUS_OK) {
+    /* Raise an error if key materials are not populated. */
+    return GRPC_SECURITY_ERROR;
+  }
+  return ReplaceHandshakerFactory(ssl_session_cache);
+}
+
+grpc_security_status
+SpiffeChannelSecurityConnector::RefreshHandshakerFactory() {
+  grpc_core::MutexLock lock(&mu_);
+  const SpiffeCredentials* creds =
+      static_cast<const SpiffeCredentials*>(channel_creds());
+  grpc_ssl_certificate_config_reload_status reload_status =
+      GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
+  if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
+                           &reload_status) != GRPC_STATUS_OK) {
+    return GRPC_SECURITY_ERROR;
+  }
+  if (reload_status != GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) {
+    // Re-use existing handshaker factory.
+    return GRPC_SECURITY_OK;
+  } else {
+    return ReplaceHandshakerFactory(nullptr);
+  }
+}
+
 void SpiffeChannelSecurityConnector::ServerAuthorizationCheckDone(
     grpc_tls_server_authorization_check_arg* arg) {
   GPR_ASSERT(arg != nullptr);
@@ -336,19 +398,28 @@ void SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgDestroy(
 SpiffeServerSecurityConnector::SpiffeServerSecurityConnector(
     grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
     : grpc_server_security_connector(GRPC_SSL_URL_SCHEME,
-                                     std::move(server_creds)) {}
+                                     std::move(server_creds)) {
+  key_materials_config_ = grpc_tls_key_materials_config_create()->Ref();
+}
 
 SpiffeServerSecurityConnector::~SpiffeServerSecurityConnector() {
   if (server_handshaker_factory_ != nullptr) {
     tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
   }
+  if (key_materials_config_.get() != nullptr) {
+    key_materials_config_.get()->Unref();
+  }
 }
 
 void SpiffeServerSecurityConnector::add_handshakers(
     grpc_pollset_set* interested_parties,
     grpc_core::HandshakeManager* handshake_mgr) {
+  /* Refresh handshaker factory if needed. */
+  if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) {
+    gpr_log(GPR_ERROR, "Handshaker factory refresh failed.");
+    return;
+  }
   /* Create a TLS SPIFFE TSI handshaker for server. */
-  RefreshServerHandshakerFactory();
   tsi_handshaker* tsi_hs = nullptr;
   tsi_result result = tsi_ssl_server_handshaker_factory_create_handshaker(
       server_handshaker_factory_, &tsi_hs);
@@ -388,39 +459,76 @@ SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector(
   grpc_core::RefCountedPtr<SpiffeServerSecurityConnector> c =
       grpc_core::MakeRefCounted<SpiffeServerSecurityConnector>(
           std::move(server_creds));
-  if (c->RefreshServerHandshakerFactory() != GRPC_SECURITY_OK) {
+  if (c->InitializeHandshakerFactory() != GRPC_SECURITY_OK) {
+    gpr_log(GPR_ERROR, "Could not initialize server handshaker factory.");
     return nullptr;
   }
   return c;
 }
 
-grpc_security_status
-SpiffeServerSecurityConnector::RefreshServerHandshakerFactory() {
+grpc_security_status SpiffeServerSecurityConnector::ReplaceHandshakerFactory() {
   const SpiffeServerCredentials* creds =
       static_cast<const SpiffeServerCredentials*>(server_creds());
-  auto key_materials_config = PopulateSpiffeCredentials(creds->options());
-  /* Credential reload does NOT take effect and we need to keep using
-   * the existing handshaker factory. */
-  if (key_materials_config->pem_key_cert_pair_list().empty()) {
-    key_materials_config->Unref();
-    return GRPC_SECURITY_ERROR;
-  }
-  /* Credential reload takes effect and we need to free the existing
-   * handshaker library. */
+  /* Free the server handshaker factory if exists. */
   if (server_handshaker_factory_) {
     tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
   }
+  GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty());
   tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = ConvertToTsiPemKeyCertPair(
-      key_materials_config->pem_key_cert_pair_list());
+      key_materials_config_->pem_key_cert_pair_list());
   size_t num_key_cert_pairs =
-      key_materials_config->pem_key_cert_pair_list().size();
+      key_materials_config_->pem_key_cert_pair_list().size();
   grpc_security_status status = grpc_ssl_tsi_server_handshaker_factory_init(
       pem_key_cert_pairs, num_key_cert_pairs,
-      key_materials_config->pem_root_certs(),
+      key_materials_config_->pem_root_certs(),
       creds->options().cert_request_type(), &server_handshaker_factory_);
-  // Free memory.
-  key_materials_config->Unref();
+  /* Free memory. */
   grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pairs,
                                           num_key_cert_pairs);
   return status;
 }
+
+grpc_security_status
+SpiffeServerSecurityConnector::InitializeHandshakerFactory() {
+  grpc_core::MutexLock lock(&mu_);
+  const SpiffeServerCredentials* creds =
+      static_cast<const SpiffeServerCredentials*>(server_creds());
+  grpc_tls_key_materials_config* key_materials_config =
+      creds->options().key_materials_config();
+  if (key_materials_config != nullptr) {
+    grpc_tls_key_materials_config::PemKeyCertPairList cert_pair_list =
+        key_materials_config->pem_key_cert_pair_list();
+    auto pem_root_certs = grpc_core::UniquePtr<char>(
+        gpr_strdup(key_materials_config->pem_root_certs()));
+    key_materials_config_->set_key_materials(std::move(pem_root_certs),
+                                             std::move(cert_pair_list));
+  }
+  grpc_ssl_certificate_config_reload_status reload_status =
+      GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
+  if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
+                           &reload_status) != GRPC_STATUS_OK) {
+    /* Raise an error if key materials are not populated. */
+    return GRPC_SECURITY_ERROR;
+  }
+  return ReplaceHandshakerFactory();
+}
+
+grpc_security_status SpiffeServerSecurityConnector::RefreshHandshakerFactory() {
+  grpc_core::MutexLock lock(&mu_);
+  const SpiffeServerCredentials* creds =
+      static_cast<const SpiffeServerCredentials*>(server_creds());
+  grpc_ssl_certificate_config_reload_status reload_status =
+      GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
+  if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
+                           &reload_status) != GRPC_STATUS_OK) {
+    return GRPC_SECURITY_ERROR;
+  }
+  if (reload_status != GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW) {
+    /* At this point, we should have key materials populated. */
+    return GRPC_SECURITY_OK;
+  } else {
+    return ReplaceHandshakerFactory();
+  }
+}
+
+}  // namespace grpc_core
index 5697215..3739b46 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/gprpp/sync.h"
 #include "src/core/lib/security/context/security_context.h"
 #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
 
 #define GRPC_TLS_SPIFFE_TRANSPORT_SECURITY_TYPE "spiffe"
 
+namespace grpc_core {
+
 // Spiffe channel security connector.
 class SpiffeChannelSecurityConnector final
     : public grpc_channel_security_connector {
@@ -53,7 +56,8 @@ class SpiffeChannelSecurityConnector final
 
   int cmp(const grpc_security_connector* other_sc) const override;
 
-  bool check_call_host(const char* host, grpc_auth_context* auth_context,
+  bool check_call_host(grpc_core::StringView host,
+                       grpc_auth_context* auth_context,
                        grpc_closure* on_call_host_checked,
                        grpc_error** error) override;
 
@@ -65,6 +69,11 @@ class SpiffeChannelSecurityConnector final
   grpc_security_status InitializeHandshakerFactory(
       tsi_ssl_session_cache* ssl_session_cache);
 
+  // A util function to create a new client handshaker factory to replace
+  // the existing one if exists.
+  grpc_security_status ReplaceHandshakerFactory(
+      tsi_ssl_session_cache* ssl_session_cache);
+
   // gRPC-provided callback executed by application, which servers to bring the
   // control back to gRPC core.
   static void ServerAuthorizationCheckDone(
@@ -82,11 +91,17 @@ class SpiffeChannelSecurityConnector final
   static void ServerAuthorizationCheckArgDestroy(
       grpc_tls_server_authorization_check_arg* arg);
 
+  // A util function to refresh SSL TSI client handshaker factory with a valid
+  // credential.
+  grpc_security_status RefreshHandshakerFactory();
+
+  grpc_core::Mutex mu_;
   grpc_closure* on_peer_checked_;
-  char* target_name_;
-  char* overridden_target_name_;
+  grpc_core::UniquePtr<char> target_name_;
+  grpc_core::UniquePtr<char> overridden_target_name_;
   tsi_ssl_client_handshaker_factory* client_handshaker_factory_ = nullptr;
   grpc_tls_server_authorization_check_arg* check_arg_;
+  grpc_core::RefCountedPtr<grpc_tls_key_materials_config> key_materials_config_;
 };
 
 // Spiffe server security connector.
@@ -112,11 +127,30 @@ class SpiffeServerSecurityConnector final
   int cmp(const grpc_security_connector* other) const override;
 
  private:
+  // Initialize SSL TSI server handshaker factory.
+  grpc_security_status InitializeHandshakerFactory();
+
+  // A util function to create a new server handshaker factory to replace the
+  // existing once if exists.
+  grpc_security_status ReplaceHandshakerFactory();
+
   // A util function to refresh SSL TSI server handshaker factory with a valid
   // credential.
-  grpc_security_status RefreshServerHandshakerFactory();
+  grpc_security_status RefreshHandshakerFactory();
+
+  grpc_core::Mutex mu_;
   tsi_ssl_server_handshaker_factory* server_handshaker_factory_ = nullptr;
+  grpc_core::RefCountedPtr<grpc_tls_key_materials_config> key_materials_config_;
 };
 
+// Exposed for testing only.
+grpc_status_code TlsFetchKeyMaterials(
+    const grpc_core::RefCountedPtr<grpc_tls_key_materials_config>&
+        key_materials_config,
+    const grpc_tls_credentials_options& options,
+    grpc_ssl_certificate_config_reload_status* status);
+
+}  // namespace grpc_core
+
 #endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_TLS_SPIFFE_SECURITY_CONNECTOR_H \
         */
index 1062fc2..33343d2 100644 (file)
@@ -346,7 +346,7 @@ static void auth_start_transport_stream_op_batch(
       GRPC_CALL_STACK_REF(calld->owning_call, "check_call_host");
       GRPC_CLOSURE_INIT(&calld->async_result_closure, on_host_checked, batch,
                         grpc_schedule_on_exec_ctx);
-      char* call_host = grpc_slice_to_c_string(calld->host);
+      grpc_core::StringView call_host(calld->host);
       grpc_error* error = GRPC_ERROR_NONE;
       if (chand->security_connector->check_call_host(
               call_host, chand->auth_context.get(),
@@ -360,7 +360,6 @@ static void auth_start_transport_stream_op_batch(
             &calld->check_call_host_cancel_closure, cancel_check_call_host,
             elem, grpc_schedule_on_exec_ctx));
       }
-      gpr_free(call_host);
       return; /* early exit */
     }
   }
index fe9f5fe..8a1db63 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/security/util/json_util.h"
 
 #include <string.h>
 #include <grpc/support/string_util.h>
 
 const char* grpc_json_get_string_property(const grpc_json* json,
-                                          const char* prop_name) {
-  grpc_json* child;
+                                          const char* prop_name,
+                                          grpc_error** error) {
+  grpc_json* child = nullptr;
+  if (error != nullptr) *error = GRPC_ERROR_NONE;
   for (child = json->child; child != nullptr; child = child->next) {
     if (child->key == nullptr) {
-      gpr_log(GPR_ERROR, "Invalid (null) JSON key encountered");
+      if (error != nullptr) {
+        *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+            "Invalid (null) JSON key encountered");
+      }
       return nullptr;
     }
     if (strcmp(child->key, prop_name) == 0) break;
   }
   if (child == nullptr || child->type != GRPC_JSON_STRING) {
-    gpr_log(GPR_ERROR, "Invalid or missing %s property.", prop_name);
+    if (error != nullptr) {
+      char* error_msg;
+      gpr_asprintf(&error_msg, "Invalid or missing %s property.", prop_name);
+      *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg);
+      gpr_free(error_msg);
+    }
     return nullptr;
   }
   return child->value;
@@ -45,7 +56,10 @@ const char* grpc_json_get_string_property(const grpc_json* json,
 bool grpc_copy_json_string_property(const grpc_json* json,
                                     const char* prop_name,
                                     char** copied_value) {
-  const char* prop_value = grpc_json_get_string_property(json, prop_name);
+  grpc_error* error = GRPC_ERROR_NONE;
+  const char* prop_value =
+      grpc_json_get_string_property(json, prop_name, &error);
+  GRPC_LOG_IF_ERROR("Could not copy JSON property", error);
   if (prop_value == nullptr) return false;
   *copied_value = gpr_strdup(prop_value);
   return true;
index 89deffc..44d9ecc 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <stdbool.h>
 
+#include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/json/json.h"
 
 // Constants.
@@ -32,7 +33,8 @@
 
 // Gets a child property from a json node.
 const char* grpc_json_get_string_property(const grpc_json* json,
-                                          const char* prop_name);
+                                          const char* prop_name,
+                                          grpc_error** error);
 
 // Copies the value of the json child property specified by prop_name.
 // Returns false if the property was not found.
index eebf66b..d3480ab 100644 (file)
@@ -37,12 +37,7 @@ char* grpc_slice_to_c_string(grpc_slice slice) {
   return out;
 }
 
-grpc_slice grpc_empty_slice(void) {
-  grpc_slice out;
-  out.refcount = nullptr;
-  out.data.inlined.length = 0;
-  return out;
-}
+grpc_slice grpc_empty_slice(void) { return grpc_core::UnmanagedMemorySlice(); }
 
 grpc_slice grpc_slice_copy(grpc_slice s) {
   grpc_slice out = GRPC_SLICE_MALLOC(GRPC_SLICE_LENGTH(s));
@@ -66,32 +61,13 @@ void grpc_slice_unref(grpc_slice slice) {
   }
 }
 
+namespace grpc_core {
+
 /* grpc_slice_from_static_string support structure - a refcount that does
    nothing */
-static grpc_slice_refcount NoopRefcount =
-    grpc_slice_refcount(grpc_slice_refcount::Type::NOP);
-
-size_t grpc_slice_memory_usage(grpc_slice s) {
-  if (s.refcount == nullptr || s.refcount == &NoopRefcount) {
-    return 0;
-  } else {
-    return s.data.refcounted.length;
-  }
-}
-
-grpc_slice grpc_slice_from_static_buffer(const void* s, size_t len) {
-  grpc_slice slice;
-  slice.refcount = &NoopRefcount;
-  slice.data.refcounted.bytes = (uint8_t*)s;
-  slice.data.refcounted.length = len;
-  return slice;
-}
-
-grpc_slice grpc_slice_from_static_string(const char* s) {
-  return grpc_slice_from_static_buffer(s, strlen(s));
-}
-
-namespace grpc_core {
+grpc_slice_refcount kNoopRefcount(grpc_slice_refcount::Type::NOP);
+static_assert(std::is_trivially_destructible<decltype(kNoopRefcount)>::value,
+              "kNoopRefcount must be trivially destructible.");
 
 /* grpc_slice_new support structures - we create a refcount object extended
    with the user provided data pointer & destroy function */
@@ -122,6 +98,22 @@ class NewSliceRefcount {
 
 }  // namespace grpc_core
 
+size_t grpc_slice_memory_usage(grpc_slice s) {
+  if (s.refcount == nullptr || s.refcount == &grpc_core::kNoopRefcount) {
+    return 0;
+  } else {
+    return s.data.refcounted.length;
+  }
+}
+
+grpc_slice grpc_slice_from_static_buffer(const void* s, size_t len) {
+  return grpc_core::ExternallyManagedSlice(s, len);
+}
+
+grpc_slice grpc_slice_from_static_string(const char* s) {
+  return grpc_core::ExternallyManagedSlice(s, strlen(s));
+}
+
 grpc_slice grpc_slice_new_with_user_data(void* p, size_t len,
                                          void (*destroy)(void*),
                                          void* user_data) {
@@ -205,15 +197,29 @@ grpc_slice grpc_slice_new_with_len(void* p, size_t len,
   return slice;
 }
 
+grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(const char* source,
+                                                      size_t length) {
+  if (length <= sizeof(data.inlined.bytes)) {
+    refcount = nullptr;
+    data.inlined.length = static_cast<uint8_t>(length);
+  } else {
+    HeapInit(length);
+  }
+  if (length > 0) {
+    memcpy(GRPC_SLICE_START_PTR(*this), source, length);
+  }
+}
+
+grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(const char* source)
+    : grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(source,
+                                                            strlen(source)) {}
+
 grpc_slice grpc_slice_from_copied_buffer(const char* source, size_t length) {
-  if (length == 0) return grpc_empty_slice();
-  grpc_slice slice = GRPC_SLICE_MALLOC(length);
-  memcpy(GRPC_SLICE_START_PTR(slice), source, length);
-  return slice;
+  return grpc_core::UnmanagedMemorySlice(source, length);
 }
 
 grpc_slice grpc_slice_from_copied_string(const char* source) {
-  return grpc_slice_from_copied_buffer(source, strlen(source));
+  return grpc_core::UnmanagedMemorySlice(source, strlen(source));
 }
 
 grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
@@ -264,8 +270,11 @@ class MallocRefCount {
 }  // namespace
 
 grpc_slice grpc_slice_malloc_large(size_t length) {
-  grpc_slice slice;
+  return grpc_core::UnmanagedMemorySlice(
+      length, grpc_core::UnmanagedMemorySlice::ForceHeapAllocation());
+}
 
+void grpc_core::UnmanagedMemorySlice::HeapInit(size_t length) {
   /* Memory layout used by the slice created here:
 
      +-----------+----------------------------------------------------------+
@@ -284,29 +293,30 @@ grpc_slice grpc_slice_malloc_large(size_t length) {
 
   /* Build up the slice to be returned. */
   /* The slices refcount points back to the allocated block. */
-  slice.refcount = rc->base_refcount();
+  refcount = rc->base_refcount();
   /* The data bytes are placed immediately after the refcount struct */
-  slice.data.refcounted.bytes = reinterpret_cast<uint8_t*>(rc + 1);
+  data.refcounted.bytes = reinterpret_cast<uint8_t*>(rc + 1);
   /* And the length of the block is set to the requested length */
-  slice.data.refcounted.length = length;
-  return slice;
+  data.refcounted.length = length;
 }
 
 grpc_slice grpc_slice_malloc(size_t length) {
-  grpc_slice slice;
+  return grpc_core::UnmanagedMemorySlice(length);
+}
 
-  if (length > sizeof(slice.data.inlined.bytes)) {
-    return grpc_slice_malloc_large(length);
+grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(size_t length) {
+  if (length > sizeof(data.inlined.bytes)) {
+    HeapInit(length);
   } else {
     /* small slice: just inline the data */
-    slice.refcount = nullptr;
-    slice.data.inlined.length = static_cast<uint8_t>(length);
+    refcount = nullptr;
+    data.inlined.length = static_cast<uint8_t>(length);
   }
-  return slice;
 }
 
-grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) {
-  grpc_slice subset;
+template <typename Slice>
+static Slice sub_no_ref(const Slice& source, size_t begin, size_t end) {
+  Slice subset;
 
   GPR_ASSERT(end >= begin);
 
@@ -330,6 +340,15 @@ grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) {
   return subset;
 }
 
+grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) {
+  return sub_no_ref(source, begin, end);
+}
+
+grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref(
+    const grpc_core::UnmanagedMemorySlice& source, size_t begin, size_t end) {
+  return sub_no_ref(source, begin, end);
+}
+
 grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end) {
   grpc_slice subset;
 
@@ -375,10 +394,10 @@ grpc_slice grpc_slice_split_tail_maybe_ref(grpc_slice* source, size_t split,
       switch (ref_whom) {
         case GRPC_SLICE_REF_TAIL:
           tail.refcount = source->refcount->sub_refcount();
-          source->refcount = &NoopRefcount;
+          source->refcount = &grpc_core::kNoopRefcount;
           break;
         case GRPC_SLICE_REF_HEAD:
-          tail.refcount = &NoopRefcount;
+          tail.refcount = &grpc_core::kNoopRefcount;
           source->refcount = source->refcount->sub_refcount();
           break;
         case GRPC_SLICE_REF_BOTH:
index 2b69f57..2d66694 100644 (file)
@@ -103,7 +103,7 @@ uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t n) {
 
   sb->length += n;
 
-  if (sb->count == 0) goto add_new;
+  if (sb->count == 0) goto add_first;
   back = &sb->slices[sb->count - 1];
   if (back->refcount) goto add_new;
   if ((back->data.inlined.length + n) > sizeof(back->data.inlined.bytes))
@@ -115,6 +115,7 @@ uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t n) {
 
 add_new:
   maybe_embiggen(sb);
+add_first:
   back = &sb->slices[sb->count];
   sb->count++;
   back->refcount = nullptr;
@@ -262,9 +263,9 @@ void grpc_slice_buffer_move_into(grpc_slice_buffer* src,
   src->length = 0;
 }
 
+template <bool incref>
 static void slice_buffer_move_first_maybe_ref(grpc_slice_buffer* src, size_t n,
-                                              grpc_slice_buffer* dst,
-                                              bool incref) {
+                                              grpc_slice_buffer* dst) {
   GPR_ASSERT(src->length >= n);
   if (src->length == n) {
     grpc_slice_buffer_move_into(src, dst);
@@ -304,12 +305,12 @@ static void slice_buffer_move_first_maybe_ref(grpc_slice_buffer* src, size_t n,
 
 void grpc_slice_buffer_move_first(grpc_slice_buffer* src, size_t n,
                                   grpc_slice_buffer* dst) {
-  slice_buffer_move_first_maybe_ref(src, n, dst, true);
+  slice_buffer_move_first_maybe_ref<true>(src, n, dst);
 }
 
 void grpc_slice_buffer_move_first_no_ref(grpc_slice_buffer* src, size_t n,
                                          grpc_slice_buffer* dst) {
-  slice_buffer_move_first_maybe_ref(src, n, dst, false);
+  slice_buffer_move_first_maybe_ref<false>(src, n, dst);
 }
 
 void grpc_slice_buffer_move_first_into_buffer(grpc_slice_buffer* src, size_t n,
index c20eca9..bd003c2 100644 (file)
@@ -25,6 +25,7 @@
 #include <grpc/support/log.h>
 
 #include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/gprpp/ref_counted.h"
 #include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/slice/slice_internal.h"
@@ -77,13 +78,8 @@ class SliceHashTable : public RefCounted<SliceHashTable<T>> {
   static int Cmp(const SliceHashTable& a, const SliceHashTable& b);
 
  private:
-  // So New() can call our private ctor.
-  template <typename T2, typename... Args>
-  friend T2* New(Args&&... args);
-
-  // So Delete() can call our private dtor.
-  template <typename T2>
-  friend void Delete(T2*);
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW
 
   SliceHashTable(size_t num_entries, Entry* entries, ValueCmp value_cmp);
   virtual ~SliceHashTable();
index 81d34dd..369135c 100644 (file)
@@ -107,12 +107,10 @@ static void grow_shard(slice_shard* shard) {
   shard->capacity = capacity;
 }
 
-static grpc_slice materialize(InternedSliceRefcount* s) {
-  grpc_slice slice;
-  slice.refcount = &s->base;
-  slice.data.refcounted.bytes = reinterpret_cast<uint8_t*>(s + 1);
-  slice.data.refcounted.length = s->length;
-  return slice;
+grpc_core::InternedSlice::InternedSlice(InternedSliceRefcount* s) {
+  refcount = &s->base;
+  data.refcounted.bytes = reinterpret_cast<uint8_t*>(s + 1);
+  data.refcounted.length = s->length;
 }
 
 uint32_t grpc_slice_default_hash_impl(grpc_slice s) {
@@ -140,11 +138,12 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
   for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) {
     static_metadata_hash_ent ent =
         static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)];
+    const grpc_core::StaticMetadataSlice* static_slice_table =
+        grpc_static_slice_table();
     if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT &&
-        grpc_slice_eq_static_interned(slice,
-                                      grpc_static_slice_table[ent.idx])) {
+        grpc_slice_eq_static_interned(slice, static_slice_table[ent.idx])) {
       *returned_slice_is_different = true;
-      return grpc_static_slice_table[ent.idx];
+      return static_slice_table[ent.idx];
     }
   }
 
@@ -152,57 +151,155 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
 }
 
 grpc_slice grpc_slice_intern(grpc_slice slice) {
-  GPR_TIMER_SCOPE("grpc_slice_intern", 0);
-  if (GRPC_IS_STATIC_METADATA_STRING(slice)) {
-    return slice;
-  }
-
-  uint32_t hash = grpc_slice_hash_internal(slice);
+  /* TODO(arjunroy): At present, this is capable of returning either a static or
+     an interned slice. This yields weirdness like the constructor for
+     ManagedMemorySlice instantiating itself as an instance of a derived type
+     (StaticMetadataSlice or InternedSlice). Should reexamine. */
+  return grpc_core::ManagedMemorySlice(&slice);
+}
 
+// Attempt to see if the provided slice or string matches a static slice.
+// SliceArgs... is either a const grpc_slice& or a string and length. In either
+// case, hash is the pre-computed hash value.
+//
+// Returns: a matching static slice, or null.
+template <class... SliceArgs>
+static const grpc_core::StaticMetadataSlice* MatchStaticSlice(
+    uint32_t hash, SliceArgs&&... args) {
   for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) {
     static_metadata_hash_ent ent =
         static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)];
+    const grpc_core::StaticMetadataSlice* static_slice_table =
+        grpc_static_slice_table();
     if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT &&
-        grpc_slice_eq_static_interned(slice,
-                                      grpc_static_slice_table[ent.idx])) {
-      return grpc_static_slice_table[ent.idx];
+        static_slice_table[ent.idx].Equals(std::forward<SliceArgs>(args)...)) {
+      return &static_slice_table[ent.idx];
     }
   }
+  return nullptr;
+}
 
-  InternedSliceRefcount* s;
-  slice_shard* shard = &g_shards[SHARD_IDX(hash)];
+// Helper methods to enable us to select appropriately overloaded slice methods
+// whether we're dealing with a slice, or a buffer with length, when interning
+// strings. Helpers for FindOrCreateInternedSlice().
+static const void* GetBuffer(const void* buf, size_t len) { return buf; }
+static size_t GetLength(const void* buf, size_t len) { return len; }
+static const void* GetBuffer(const grpc_slice& slice) {
+  return GRPC_SLICE_START_PTR(slice);
+}
+static size_t GetLength(const grpc_slice& slice) {
+  return GRPC_SLICE_LENGTH(slice);
+}
 
-  gpr_mu_lock(&shard->mu);
+// Creates an interned slice for a string that does not currently exist in the
+// intern table. SliceArgs... is either a const grpc_slice& or a string and
+// length. In either case, hash is the pre-computed hash value. We must already
+// hold the shard lock. Helper for FindOrCreateInternedSlice().
+//
+// Returns: a newly interned slice.
+template <class... SliceArgs>
+static InternedSliceRefcount* InternNewStringLocked(slice_shard* shard,
+                                                    size_t shard_idx,
+                                                    uint32_t hash,
+                                                    SliceArgs&&... args) {
+  /* string data goes after the internal_string header */
+  size_t len = GetLength(std::forward<SliceArgs>(args)...);
+  const void* buffer = GetBuffer(std::forward<SliceArgs>(args)...);
+  InternedSliceRefcount* s =
+      static_cast<InternedSliceRefcount*>(gpr_malloc(sizeof(*s) + len));
+  new (s) grpc_core::InternedSliceRefcount(len, hash, shard->strs[shard_idx]);
+  // TODO(arjunroy): Investigate why hpack tried to intern the nullptr string.
+  // https://github.com/grpc/grpc/pull/20110#issuecomment-526729282
+  if (len > 0) {
+    memcpy(reinterpret_cast<char*>(s + 1), buffer, len);
+  }
+  shard->strs[shard_idx] = s;
+  shard->count++;
+  if (shard->count > shard->capacity * 2) {
+    grow_shard(shard);
+  }
+  return s;
+}
 
+// Attempt to see if the provided slice or string matches an existing interned
+// slice. SliceArgs... is either a const grpc_slice& or a string and length. In
+// either case, hash is the pre-computed hash value.  We must already hold the
+// shard lock. Helper for FindOrCreateInternedSlice().
+//
+// Returns: a pre-existing matching static slice, or null.
+template <class... SliceArgs>
+static InternedSliceRefcount* MatchInternedSliceLocked(uint32_t hash,
+                                                       size_t idx,
+                                                       SliceArgs&&... args) {
+  InternedSliceRefcount* s;
+  slice_shard* shard = &g_shards[SHARD_IDX(hash)];
   /* search for an existing string */
-  size_t idx = TABLE_IDX(hash, shard->capacity);
   for (s = shard->strs[idx]; s; s = s->bucket_next) {
     if (s->hash == hash &&
-        grpc_slice_eq_static_interned(slice, materialize(s))) {
+        grpc_core::InternedSlice(s).Equals(std::forward<SliceArgs>(args)...)) {
       if (s->refcnt.RefIfNonZero()) {
-        gpr_mu_unlock(&shard->mu);
-        return materialize(s);
+        return s;
       }
     }
   }
+  return nullptr;
+}
 
-  /* not found: create a new string */
-  /* string data goes after the internal_string header */
-  s = static_cast<InternedSliceRefcount*>(
-      gpr_malloc(sizeof(*s) + GRPC_SLICE_LENGTH(slice)));
-
-  new (s) grpc_core::InternedSliceRefcount(GRPC_SLICE_LENGTH(slice), hash,
-                                           shard->strs[idx]);
-  memcpy(reinterpret_cast<char*>(s + 1), GRPC_SLICE_START_PTR(slice),
-         GRPC_SLICE_LENGTH(slice));
-  shard->strs[idx] = s;
-  shard->count++;
-  if (shard->count > shard->capacity * 2) {
-    grow_shard(shard);
+// Attempt to see if the provided slice or string matches an existing interned
+// slice, and failing that, create an interned slice with its contents. Returns
+// either the existing matching interned slice or the newly created one.
+// SliceArgs... is either a const grpc_slice& or a string and length. In either
+// case, hash is the pre-computed hash value. We do not hold the shard lock
+// here, but do take it.
+//
+// Returns: an interned slice, either pre-existing/matched or newly created.
+template <class... SliceArgs>
+static InternedSliceRefcount* FindOrCreateInternedSlice(uint32_t hash,
+                                                        SliceArgs&&... args) {
+  slice_shard* shard = &g_shards[SHARD_IDX(hash)];
+  gpr_mu_lock(&shard->mu);
+  const size_t idx = TABLE_IDX(hash, shard->capacity);
+  InternedSliceRefcount* s =
+      MatchInternedSliceLocked(hash, idx, std::forward<SliceArgs>(args)...);
+  if (s == nullptr) {
+    s = InternNewStringLocked(shard, idx, hash,
+                              std::forward<SliceArgs>(args)...);
   }
-
   gpr_mu_unlock(&shard->mu);
-  return materialize(s);
+  return s;
+}
+
+grpc_core::ManagedMemorySlice::ManagedMemorySlice(const char* string)
+    : grpc_core::ManagedMemorySlice::ManagedMemorySlice(string,
+                                                        strlen(string)) {}
+
+grpc_core::ManagedMemorySlice::ManagedMemorySlice(const char* string,
+                                                  size_t len) {
+  GPR_TIMER_SCOPE("grpc_slice_intern", 0);
+  const uint32_t hash = gpr_murmur_hash3(string, len, g_hash_seed);
+  const StaticMetadataSlice* static_slice = MatchStaticSlice(hash, string, len);
+  if (static_slice) {
+    *this = *static_slice;
+  } else {
+    *this =
+        grpc_core::InternedSlice(FindOrCreateInternedSlice(hash, string, len));
+  }
+}
+
+grpc_core::ManagedMemorySlice::ManagedMemorySlice(const grpc_slice* slice_ptr) {
+  GPR_TIMER_SCOPE("grpc_slice_intern", 0);
+  const grpc_slice& slice = *slice_ptr;
+  if (GRPC_IS_STATIC_METADATA_STRING(slice)) {
+    *this = static_cast<const grpc_core::StaticMetadataSlice&>(slice);
+    return;
+  }
+  const uint32_t hash = grpc_slice_hash_internal(slice);
+  const StaticMetadataSlice* static_slice = MatchStaticSlice(hash, slice);
+  if (static_slice) {
+    *this = *static_slice;
+  } else {
+    *this = grpc_core::InternedSlice(FindOrCreateInternedSlice(hash, slice));
+  }
 }
 
 void grpc_test_only_set_slice_hash_seed(uint32_t seed) {
@@ -227,9 +324,11 @@ void grpc_slice_intern_init(void) {
     static_metadata_hash[i].idx = GRPC_STATIC_MDSTR_COUNT;
   }
   max_static_metadata_hash_probe = 0;
+  const grpc_core::StaticMetadataSlice* static_slice_table =
+      grpc_static_slice_table();
   for (size_t i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) {
     grpc_static_metadata_hash_values[i] =
-        grpc_slice_default_hash_internal(grpc_static_slice_table[i]);
+        grpc_slice_default_hash_internal(static_slice_table[i]);
     for (size_t j = 0; j < GPR_ARRAY_SIZE(static_metadata_hash); j++) {
       size_t slot = (grpc_static_metadata_hash_values[i] + j) %
                     GPR_ARRAY_SIZE(static_metadata_hash);
@@ -245,7 +344,7 @@ void grpc_slice_intern_init(void) {
   }
   // Handle KV hash for all static mdelems.
   for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; ++i) {
-    grpc_static_mdelem_table[i].HashInit();
+    grpc_static_mdelem_table()[i].HashInit();
   }
 }
 
@@ -259,8 +358,8 @@ void grpc_slice_intern_shutdown(void) {
               shard->count);
       for (size_t j = 0; j < shard->capacity; j++) {
         for (InternedSliceRefcount* s = shard->strs[j]; s; s = s->bucket_next) {
-          char* text =
-              grpc_dump_slice(materialize(s), GPR_DUMP_HEX | GPR_DUMP_ASCII);
+          char* text = grpc_dump_slice(grpc_core::InternedSlice(s),
+                                       GPR_DUMP_HEX | GPR_DUMP_ASCII);
           gpr_log(GPR_DEBUG, "LEAKED: %s", text);
           gpr_free(text);
         }
index c6943fe..f1939b5 100644 (file)
@@ -30,6 +30,7 @@
 #include "src/core/lib/gpr/murmur_hash.h"
 #include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/gprpp/ref_counted.h"
+#include "src/core/lib/slice/slice_utils.h"
 #include "src/core/lib/transport/static_metadata.h"
 
 // Interned slices have specific fast-path operations for hashing. To inline
@@ -95,6 +96,8 @@ extern uint32_t g_hash_seed;
 // In total, this saves us roughly 1-2% latency for unary calls, with smaller
 // calls benefitting. The effect is present, but not as useful, for larger calls
 // where the cost of sending the data dominates.
+// TODO(arjunroy): Investigate if this can be removed with strongly typed
+// grpc_slices.
 struct grpc_slice_refcount {
  public:
   enum class Type {
@@ -171,6 +174,19 @@ struct grpc_slice_refcount {
 
 namespace grpc_core {
 
+struct StaticSliceRefcount {
+  static grpc_slice_refcount kStaticSubRefcount;
+
+  StaticSliceRefcount(uint32_t index)
+      : base(&kStaticSubRefcount, grpc_slice_refcount::Type::STATIC),
+        index(index) {}
+
+  grpc_slice_refcount base;
+  const uint32_t index;
+};
+
+extern grpc_slice_refcount kNoopRefcount;
+
 struct InternedSliceRefcount {
   static void Destroy(void* arg) {
     auto* rc = static_cast<InternedSliceRefcount*>(arg);
@@ -198,23 +214,39 @@ struct InternedSliceRefcount {
 
 }  // namespace grpc_core
 
+inline size_t grpc_refcounted_slice_length(const grpc_slice& slice) {
+  GPR_DEBUG_ASSERT(slice.refcount != nullptr);
+  return slice.data.refcounted.length;
+}
+
+inline const uint8_t* grpc_refcounted_slice_data(const grpc_slice& slice) {
+  GPR_DEBUG_ASSERT(slice.refcount != nullptr);
+  return slice.data.refcounted.bytes;
+}
+
 inline int grpc_slice_refcount::Eq(const grpc_slice& a, const grpc_slice& b) {
+  GPR_DEBUG_ASSERT(a.refcount != nullptr);
+  GPR_DEBUG_ASSERT(a.refcount == this);
   switch (ref_type_) {
     case Type::STATIC:
-      return GRPC_STATIC_METADATA_INDEX(a) == GRPC_STATIC_METADATA_INDEX(b);
+      GPR_DEBUG_ASSERT(
+          (GRPC_STATIC_METADATA_INDEX(a) == GRPC_STATIC_METADATA_INDEX(b)) ==
+          (a.refcount == b.refcount));
     case Type::INTERNED:
       return a.refcount == b.refcount;
     case Type::NOP:
     case Type::REGULAR:
       break;
   }
-  if (GRPC_SLICE_LENGTH(a) != GRPC_SLICE_LENGTH(b)) return false;
-  if (GRPC_SLICE_LENGTH(a) == 0) return true;
-  return 0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b),
-                     GRPC_SLICE_LENGTH(a));
+  if (grpc_refcounted_slice_length(a) != GRPC_SLICE_LENGTH(b)) return false;
+  if (grpc_refcounted_slice_length(a) == 0) return true;
+  return 0 == memcmp(grpc_refcounted_slice_data(a), GRPC_SLICE_START_PTR(b),
+                     grpc_refcounted_slice_length(a));
 }
 
 inline uint32_t grpc_slice_refcount::Hash(const grpc_slice& slice) {
+  GPR_DEBUG_ASSERT(slice.refcount != nullptr);
+  GPR_DEBUG_ASSERT(slice.refcount == this);
   switch (ref_type_) {
     case Type::STATIC:
       return ::grpc_static_metadata_hash_values[GRPC_STATIC_METADATA_INDEX(
@@ -226,8 +258,8 @@ inline uint32_t grpc_slice_refcount::Hash(const grpc_slice& slice) {
     case Type::REGULAR:
       break;
   }
-  return gpr_murmur_hash3(GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice),
-                          g_hash_seed);
+  return gpr_murmur_hash3(grpc_refcounted_slice_data(slice),
+                          grpc_refcounted_slice_length(slice), g_hash_seed);
 }
 
 inline const grpc_slice& grpc_slice_ref_internal(const grpc_slice& slice) {
@@ -312,4 +344,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p);
 // 0. All other slices will return the size of the allocated chars.
 size_t grpc_slice_memory_usage(grpc_slice s);
 
+grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref(
+    const grpc_core::UnmanagedMemorySlice& source, size_t begin, size_t end);
+
 #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */
index 7589bf8..a4e19a9 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <grpc/support/port_platform.h>
 
+#include <cstring>
+
 #include <grpc/slice.h>
 
 // When we compare two slices, and we know the latter is not inlined, we can
@@ -36,6 +38,7 @@
 // x86-64/clang with differs().
 int grpc_slice_differs_refcounted(const grpc_slice& a,
                                   const grpc_slice& b_not_inline);
+
 // When we compare two slices, and we *know* that one of them is static or
 // interned, we can short circuit our slice equality function. The second slice
 // here must be static or interned; slice a can be any slice, inlined or not.
@@ -47,4 +50,125 @@ inline bool grpc_slice_eq_static_interned(const grpc_slice& a,
   return !grpc_slice_differs_refcounted(a, b_static_interned);
 }
 
+// TODO(arjunroy): These type declarations ought to be in
+// src/core/lib/slice/slice_internal.h instead; they are here due to a circular
+// header depedency between slice_internal.h and
+// src/core/lib/transport/metadata.h. We need to fix this circular reference and
+// when we do, move these type declarations.
+//
+// Internal slice type declarations.
+// Externally, a grpc_slice is a grpc_slice is a grpc_slice.
+// Internally, we may have heap allocated slices, static slices, interned
+// slices, and inlined slices. If we know the specific type of slice
+// we're dealing with, we can save cycles (e.g. fast-paths when we know we don't
+// need to take a reference on a slice). Rather than introducing new methods
+// ad-hoc in these cases, we rely on type-system backed overloads to keep
+// internal APIs clean.
+//
+// For each overload, the definition and layout of the underlying slice does not
+// change; this is purely type-system information.
+namespace grpc_core {
+
+// There are two main types of slices: those that have their memory
+// managed by the slice library and those that do not.
+//
+// The following types of slices are not managed:
+// - inlined slices (i.e., refcount is null)
+// - slices that have a custom refcount type (i.e., not STATIC or INTERNED)
+// - slices where the memory is managed by some external agent. The slice is not
+//   ref-counted by grpc, and the programmer is responsible for ensuring the
+//   data is valid for the duration of the period that grpc may access it.
+//
+// The following types of slices are managed:
+// - static metadata slices (i.e., refcount type is STATIC)
+// - interned slices (i.e., refcount type is INTERNED)
+//
+// This categorization is reflected in the following hierarchy:
+//
+// - grpc_slice
+// > - UnmanagedMemorySlice
+//   > - ExternallyManagedSlice
+//   - ManagedMemorySlice
+//   > - InternedSlice
+//     - StaticMetadataSlice
+//
+struct ManagedMemorySlice : public grpc_slice {
+  ManagedMemorySlice() {
+    refcount = nullptr;
+    data.refcounted.bytes = nullptr;
+    data.refcounted.length = 0;
+  }
+  explicit ManagedMemorySlice(const char* string);
+  ManagedMemorySlice(const char* buf, size_t len);
+  explicit ManagedMemorySlice(const grpc_slice* slice);
+  bool Equals(const grpc_slice& other) const {
+    if (refcount == other.refcount) {
+      return true;
+    }
+    return !grpc_slice_differs_refcounted(other, *this);
+  }
+  bool Equals(const char* buf, const size_t len) const {
+    return data.refcounted.length == len && buf != nullptr &&
+           memcmp(buf, data.refcounted.bytes, len) == 0;
+  }
+};
+struct UnmanagedMemorySlice : public grpc_slice {
+  // TODO(arjunroy): Can we use a default=false param instead of this enum?
+  enum class ForceHeapAllocation {};
+  UnmanagedMemorySlice() {
+    refcount = nullptr;
+    data.inlined.length = 0;
+  }
+  explicit UnmanagedMemorySlice(const char* source);
+  UnmanagedMemorySlice(const char* source, size_t length);
+  // The first constructor creates a slice that may be heap allocated, or
+  // inlined in the slice structure if length is small enough
+  // (< GRPC_SLICE_INLINED_SIZE). The second constructor forces heap alloc.
+  explicit UnmanagedMemorySlice(size_t length);
+  explicit UnmanagedMemorySlice(size_t length, const ForceHeapAllocation&) {
+    HeapInit(length);
+  }
+
+ private:
+  void HeapInit(size_t length);
+};
+
+extern grpc_slice_refcount kNoopRefcount;
+
+struct ExternallyManagedSlice : public UnmanagedMemorySlice {
+  ExternallyManagedSlice()
+      : ExternallyManagedSlice(&kNoopRefcount, 0, nullptr) {}
+  explicit ExternallyManagedSlice(const char* s)
+      : ExternallyManagedSlice(s, strlen(s)) {}
+  ExternallyManagedSlice(const void* s, size_t len)
+      : ExternallyManagedSlice(
+            &kNoopRefcount, len,
+            reinterpret_cast<uint8_t*>(const_cast<void*>(s))) {}
+  ExternallyManagedSlice(grpc_slice_refcount* ref, size_t length,
+                         uint8_t* bytes) {
+    refcount = ref;
+    data.refcounted.length = length;
+    data.refcounted.bytes = bytes;
+  }
+};
+
+struct StaticMetadataSlice : public ManagedMemorySlice {
+  StaticMetadataSlice(grpc_slice_refcount* ref, size_t length,
+                      const uint8_t* bytes) {
+    refcount = ref;
+    data.refcounted.length = length;
+    // NB: grpc_slice may or may not point to a static slice, but we are
+    // definitely pointing to static data here. Since we are not changing
+    // the underlying C-type, we need a const_cast here.
+    data.refcounted.bytes = const_cast<uint8_t*>(bytes);
+  }
+};
+
+struct InternedSliceRefcount;
+struct InternedSlice : public ManagedMemorySlice {
+  explicit InternedSlice(InternedSliceRefcount* s);
+};
+
+}  // namespace grpc_core
+
 #endif /* GRPC_CORE_LIB_SLICE_SLICE_UTILS_H */
index 8c5562b..bd59a4c 100644 (file)
@@ -61,13 +61,8 @@ class SliceWeakHashTable : public RefCounted<SliceWeakHashTable<T, Size>> {
   }
 
  private:
-  // So New() can call our private ctor.
-  template <typename T2, typename... Args>
-  friend T2* New(Args&&... args);
-
-  // So Delete() can call our private dtor.
-  template <typename T2>
-  friend void Delete(T2*);
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
 
   SliceWeakHashTable() = default;
   ~SliceWeakHashTable() = default;
index 2ccd335..3720fad 100644 (file)
@@ -36,6 +36,7 @@
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/alloc.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/time_precise.h"
 #include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/arena.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
@@ -154,7 +155,7 @@ struct grpc_call {
   grpc_completion_queue* cq;
   grpc_polling_entity pollent;
   grpc_channel* channel;
-  gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC);
+  gpr_cycle_counter start_time = gpr_get_cycle_counter();
   /* parent_call* */ gpr_atm parent_call_atm = 0;
   child_call* child = nullptr;
 
@@ -552,8 +553,7 @@ static void destroy_call(void* call, grpc_error* error) {
                         &(c->final_info.error_string));
   GRPC_ERROR_UNREF(status_error);
   c->final_info.stats.latency =
-      gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), c->start_time);
-
+      gpr_cycle_counter_sub(gpr_get_cycle_counter(), c->start_time);
   grpc_call_stack_destroy(CALL_STACK_FROM_CALL(c), &c->final_info,
                           GRPC_CLOSURE_INIT(&c->release_call, release_call, c,
                                             grpc_schedule_on_exec_ctx));
@@ -910,6 +910,9 @@ static int prepare_application_metadata(grpc_call* call, int count,
                    "validate_metadata",
                    grpc_validate_header_nonbin_value_is_legal(md->value))) {
       break;
+    } else if (GRPC_SLICE_LENGTH(md->value) >= UINT32_MAX) {
+      // HTTP2 hpack encoding has a maximum limit.
+      break;
     }
     l->md = grpc_mdelem_from_grpc_metadata(const_cast<grpc_metadata*>(md));
   }
@@ -1007,13 +1010,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) {
     GPR_TIMER_SCOPE("incoming_stream_compression_algorithm", 0);
     set_incoming_stream_compression_algorithm(
         call, decode_stream_compression(b->idx.named.content_encoding->md));
-    grpc_metadata_batch_remove(b, b->idx.named.content_encoding);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_ENCODING);
   }
   if (b->idx.named.grpc_encoding != nullptr) {
     GPR_TIMER_SCOPE("incoming_message_compression_algorithm", 0);
     set_incoming_message_compression_algorithm(
         call, decode_message_compression(b->idx.named.grpc_encoding->md));
-    grpc_metadata_batch_remove(b, b->idx.named.grpc_encoding);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ENCODING);
   }
   uint32_t message_encodings_accepted_by_peer = 1u;
   uint32_t stream_encodings_accepted_by_peer = 1u;
@@ -1021,13 +1024,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) {
     GPR_TIMER_SCOPE("encodings_accepted_by_peer", 0);
     set_encodings_accepted_by_peer(call, b->idx.named.grpc_accept_encoding->md,
                                    &message_encodings_accepted_by_peer, false);
-    grpc_metadata_batch_remove(b, b->idx.named.grpc_accept_encoding);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ACCEPT_ENCODING);
   }
   if (b->idx.named.accept_encoding != nullptr) {
     GPR_TIMER_SCOPE("stream_encodings_accepted_by_peer", 0);
     set_encodings_accepted_by_peer(call, b->idx.named.accept_encoding->md,
                                    &stream_encodings_accepted_by_peer, true);
-    grpc_metadata_batch_remove(b, b->idx.named.accept_encoding);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_ACCEPT_ENCODING);
   }
   call->encodings_accepted_by_peer =
       grpc_compression_bitset_from_message_stream_compression_bitset(
@@ -1059,13 +1062,13 @@ static void recv_trailing_filter(void* args, grpc_metadata_batch* b,
       error = grpc_error_set_str(
           error, GRPC_ERROR_STR_GRPC_MESSAGE,
           grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md)));
-      grpc_metadata_batch_remove(b, b->idx.named.grpc_message);
+      grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_MESSAGE);
     } else if (error != GRPC_ERROR_NONE) {
       error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE,
                                  grpc_empty_slice());
     }
     set_final_status(call, GRPC_ERROR_REF(error));
-    grpc_metadata_batch_remove(b, b->idx.named.grpc_status);
+    grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_STATUS);
     GRPC_ERROR_UNREF(error);
   } else if (!call->is_client) {
     set_final_status(call, GRPC_ERROR_NONE);
@@ -1175,6 +1178,12 @@ static void post_batch_completion(batch_control* bctl) {
         &call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]);
   }
   if (bctl->op.send_message) {
+    if (bctl->op.payload->send_message.stream_write_closed &&
+        error == GRPC_ERROR_NONE) {
+      error = grpc_error_add_child(
+          error, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                     "Attempt to send message after stream was closed."));
+    }
     call->sending_message = false;
   }
   if (bctl->op.send_trailing_metadata) {
@@ -1359,64 +1368,95 @@ static void receiving_stream_ready_in_call_combiner(void* bctlp,
   receiving_stream_ready(bctlp, error);
 }
 
+static void GPR_ATTRIBUTE_NOINLINE
+handle_both_stream_and_msg_compression_set(grpc_call* call) {
+  char* error_msg = nullptr;
+  gpr_asprintf(&error_msg,
+               "Incoming stream has both stream compression (%d) and message "
+               "compression (%d).",
+               call->incoming_stream_compression_algorithm,
+               call->incoming_message_compression_algorithm);
+  gpr_log(GPR_ERROR, "%s", error_msg);
+  cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
+  gpr_free(error_msg);
+}
+
+static void GPR_ATTRIBUTE_NOINLINE
+handle_error_parsing_compression_algorithm(grpc_call* call) {
+  char* error_msg = nullptr;
+  gpr_asprintf(&error_msg,
+               "Error in incoming message compression (%d) or stream "
+               "compression (%d).",
+               call->incoming_stream_compression_algorithm,
+               call->incoming_message_compression_algorithm);
+  cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
+  gpr_free(error_msg);
+}
+
+static void GPR_ATTRIBUTE_NOINLINE handle_invalid_compression(
+    grpc_call* call, grpc_compression_algorithm compression_algorithm) {
+  char* error_msg = nullptr;
+  gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.",
+               compression_algorithm);
+  gpr_log(GPR_ERROR, "%s", error_msg);
+  cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
+  gpr_free(error_msg);
+}
+
+static void GPR_ATTRIBUTE_NOINLINE handle_compression_algorithm_disabled(
+    grpc_call* call, grpc_compression_algorithm compression_algorithm) {
+  char* error_msg = nullptr;
+  const char* algo_name = nullptr;
+  grpc_compression_algorithm_name(compression_algorithm, &algo_name);
+  gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.",
+               algo_name);
+  gpr_log(GPR_ERROR, "%s", error_msg);
+  cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
+  gpr_free(error_msg);
+}
+
+static void GPR_ATTRIBUTE_NOINLINE handle_compression_algorithm_not_accepted(
+    grpc_call* call, grpc_compression_algorithm compression_algorithm) {
+  const char* algo_name = nullptr;
+  grpc_compression_algorithm_name(compression_algorithm, &algo_name);
+  gpr_log(GPR_ERROR,
+          "Compression algorithm ('%s') not present in the bitset of "
+          "accepted encodings ('0x%x')",
+          algo_name, call->encodings_accepted_by_peer);
+}
+
 static void validate_filtered_metadata(batch_control* bctl) {
   grpc_compression_algorithm compression_algorithm;
   grpc_call* call = bctl->call;
-  if (call->incoming_stream_compression_algorithm !=
-          GRPC_STREAM_COMPRESS_NONE &&
-      call->incoming_message_compression_algorithm !=
-          GRPC_MESSAGE_COMPRESS_NONE) {
-    char* error_msg = nullptr;
-    gpr_asprintf(&error_msg,
-                 "Incoming stream has both stream compression (%d) and message "
-                 "compression (%d).",
-                 call->incoming_stream_compression_algorithm,
-                 call->incoming_message_compression_algorithm);
-    gpr_log(GPR_ERROR, "%s", error_msg);
-    cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
-    gpr_free(error_msg);
+  if (GPR_UNLIKELY(call->incoming_stream_compression_algorithm !=
+                       GRPC_STREAM_COMPRESS_NONE &&
+                   call->incoming_message_compression_algorithm !=
+                       GRPC_MESSAGE_COMPRESS_NONE)) {
+    handle_both_stream_and_msg_compression_set(call);
   } else if (
-      grpc_compression_algorithm_from_message_stream_compression_algorithm(
-          &compression_algorithm, call->incoming_message_compression_algorithm,
-          call->incoming_stream_compression_algorithm) == 0) {
-    char* error_msg = nullptr;
-    gpr_asprintf(&error_msg,
-                 "Error in incoming message compression (%d) or stream "
-                 "compression (%d).",
-                 call->incoming_stream_compression_algorithm,
-                 call->incoming_message_compression_algorithm);
-    cancel_with_status(call, GRPC_STATUS_INTERNAL, error_msg);
-    gpr_free(error_msg);
+      GPR_UNLIKELY(
+          grpc_compression_algorithm_from_message_stream_compression_algorithm(
+              &compression_algorithm,
+              call->incoming_message_compression_algorithm,
+              call->incoming_stream_compression_algorithm) == 0)) {
+    handle_error_parsing_compression_algorithm(call);
   } else {
-    char* error_msg = nullptr;
     const grpc_compression_options compression_options =
         grpc_channel_compression_options(call->channel);
-    if (compression_algorithm >= GRPC_COMPRESS_ALGORITHMS_COUNT) {
-      gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.",
-                   compression_algorithm);
-      gpr_log(GPR_ERROR, "%s", error_msg);
-      cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
-    } else if (grpc_compression_options_is_algorithm_enabled(
-                   &compression_options, compression_algorithm) == 0) {
+    if (GPR_UNLIKELY(compression_algorithm >= GRPC_COMPRESS_ALGORITHMS_COUNT)) {
+      handle_invalid_compression(call, compression_algorithm);
+    } else if (GPR_UNLIKELY(
+                   grpc_compression_options_is_algorithm_enabled_internal(
+                       &compression_options, compression_algorithm) == 0)) {
       /* check if algorithm is supported by current channel config */
-      const char* algo_name = nullptr;
-      grpc_compression_algorithm_name(compression_algorithm, &algo_name);
-      gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.",
-                   algo_name);
-      gpr_log(GPR_ERROR, "%s", error_msg);
-      cancel_with_status(call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
+      handle_compression_algorithm_disabled(call, compression_algorithm);
     }
-    gpr_free(error_msg);
-
-    GPR_ASSERT(call->encodings_accepted_by_peer != 0);
-    if (!GPR_BITGET(call->encodings_accepted_by_peer, compression_algorithm)) {
+    /* GRPC_COMPRESS_NONE is always set. */
+    GPR_DEBUG_ASSERT(call->encodings_accepted_by_peer != 0);
+    if (GPR_UNLIKELY(!GPR_BITGET(call->encodings_accepted_by_peer,
+                                 compression_algorithm))) {
       if (GRPC_TRACE_FLAG_ENABLED(grpc_compression_trace)) {
-        const char* algo_name = nullptr;
-        grpc_compression_algorithm_name(compression_algorithm, &algo_name);
-        gpr_log(GPR_ERROR,
-                "Compression algorithm ('%s') not present in the bitset of "
-                "accepted encodings ('0x%x')",
-                algo_name, call->encodings_accepted_by_peer);
+        handle_compression_algorithm_not_accepted(call, compression_algorithm);
       }
     }
   }
@@ -1568,6 +1608,10 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
           error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
           goto done_with_error;
         }
+        // TODO(juanlishen): If the user has already specified a compression
+        // algorithm by setting the initial metadata with key of
+        // GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, we shouldn't override that
+        // with the compression algorithm mapped from compression level.
         /* process compression level */
         grpc_metadata& compression_md = call->compression_md;
         compression_md.key = grpc_empty_slice();
@@ -1589,17 +1633,18 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
             effective_compression_level = copts.default_level.level;
           }
         }
+        // Currently, only server side supports compression level setting.
         if (level_set && !call->is_client) {
           const grpc_compression_algorithm calgo =
               compression_algorithm_for_level_locked(
                   call, effective_compression_level);
-          /* the following will be picked up by the compress filter and used
-           * as the call's compression algorithm. */
+          // The following metadata will be checked and removed by the message
+          // compression filter. It will be used as the call's compression
+          // algorithm.
           compression_md.key = GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST;
           compression_md.value = grpc_compression_algorithm_slice(calgo);
           additional_metadata_count++;
         }
-
         if (op->data.send_initial_metadata.count + additional_metadata_count >
             INT_MAX) {
           error = GRPC_CALL_ERROR_INVALID_METADATA;
index e615507..2481340 100644 (file)
@@ -235,6 +235,23 @@ grpc_channel* grpc_channel_create(const char* target,
                                   grpc_channel_stack_type channel_stack_type,
                                   grpc_transport* optional_transport,
                                   grpc_resource_user* resource_user) {
+  // We need to make sure that grpc_shutdown() does not shut things down
+  // until after the channel is destroyed.  However, the channel may not
+  // actually be destroyed by the time grpc_channel_destroy() returns,
+  // since there may be other existing refs to the channel.  If those
+  // refs are held by things that are visible to the wrapped language
+  // (such as outstanding calls on the channel), then the wrapped
+  // language can be responsible for making sure that grpc_shutdown()
+  // does not run until after those refs are released.  However, the
+  // channel may also have refs to itself held internally for various
+  // things that need to be cleaned up at channel destruction (e.g.,
+  // LB policies, subchannels, etc), and because these refs are not
+  // visible to the wrapped language, it cannot be responsible for
+  // deferring grpc_shutdown() until after they are released.  To
+  // accommodate that, we call grpc_init() here and then call
+  // grpc_shutdown() when the channel is actually destroyed, thus
+  // ensuring that shutdown is deferred until that point.
+  grpc_init();
   grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create();
   const grpc_core::UniquePtr<char> default_authority =
       get_default_authority(input_args);
@@ -250,6 +267,7 @@ grpc_channel* grpc_channel_create(const char* target,
     if (resource_user != nullptr) {
       grpc_resource_user_free(resource_user, GRPC_RESOURCE_QUOTA_CHANNEL_SIZE);
     }
+    grpc_shutdown();  // Since we won't call destroy_channel().
     return nullptr;
   }
   // We only need to do this for clients here. For servers, this will be
@@ -257,7 +275,12 @@ grpc_channel* grpc_channel_create(const char* target,
   if (grpc_channel_stack_type_is_client(channel_stack_type)) {
     CreateChannelzNode(builder);
   }
-  return grpc_channel_create_with_builder(builder, channel_stack_type);
+  grpc_channel* channel =
+      grpc_channel_create_with_builder(builder, channel_stack_type);
+  if (channel == nullptr) {
+    grpc_shutdown();  // Since we won't call destroy_channel().
+  }
+  return channel;
 }
 
 size_t grpc_channel_get_call_size_estimate(grpc_channel* channel) {
@@ -393,13 +416,11 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method,
   GPR_ASSERT(!reserved);
   grpc_core::ExecCtx exec_ctx;
 
-  rc->path = grpc_mdelem_from_slices(
-      GRPC_MDSTR_PATH,
-      grpc_slice_intern(grpc_slice_from_static_string(method)));
+  rc->path = grpc_mdelem_from_slices(GRPC_MDSTR_PATH,
+                                     grpc_core::ExternallyManagedSlice(method));
   rc->authority =
-      host ? grpc_mdelem_from_slices(
-                 GRPC_MDSTR_AUTHORITY,
-                 grpc_slice_intern(grpc_slice_from_static_string(host)))
+      host ? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
+                                     grpc_core::ExternallyManagedSlice(host))
            : GRPC_MDNULL;
   gpr_mu_lock(&channel->registered_call_mu);
   rc->next = channel->registered_calls;
@@ -468,6 +489,8 @@ static void destroy_channel(void* arg, grpc_error* error) {
   gpr_mu_destroy(&channel->registered_call_mu);
   gpr_free(channel->target);
   gpr_free(channel);
+  // See comment in grpc_channel_create() for why we do this.
+  grpc_shutdown();
 }
 
 void grpc_channel_destroy(grpc_channel* channel) {
@@ -488,5 +511,5 @@ grpc_mdelem grpc_channel_get_reffed_status_elem_slowpath(grpc_channel* channel,
   char tmp[GPR_LTOA_MIN_BUFSIZE];
   gpr_ltoa(i, tmp);
   return grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_STATUS,
-                                 grpc_slice_from_copied_string(tmp));
+                                 grpc_core::UnmanagedMemorySlice(tmp));
 }
index 60a7d78..acdf42e 100644 (file)
@@ -320,7 +320,7 @@ struct cq_callback_data {
 /* Completion queue structure */
 struct grpc_completion_queue {
   /** Once owning_refs drops to zero, we will destroy the cq */
-  gpr_refcount owning_refs;
+  grpc_core::RefCount owning_refs;
 
   gpr_mu* mu;
 
@@ -518,7 +518,7 @@ grpc_completion_queue* grpc_completion_queue_create_internal(
   cq->poller_vtable = poller_vtable;
 
   /* One for destroy(), one for pollset_shutdown */
-  gpr_ref_init(&cq->owning_refs, 2);
+  new (&cq->owning_refs) grpc_core::RefCount(2);
 
   poller_vtable->init(POLLSET_FROM_CQ(cq), &cq->mu);
   vtable->init(DATA_FROM_CQ(cq), shutdown_callback);
@@ -573,16 +573,13 @@ int grpc_get_cq_poll_num(grpc_completion_queue* cq) {
 #ifndef NDEBUG
 void grpc_cq_internal_ref(grpc_completion_queue* cq, const char* reason,
                           const char* file, int line) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_cq_refcount)) {
-    gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count);
-    gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "CQ:%p   ref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val + 1,
-            reason);
-  }
+  grpc_core::DebugLocation debug_location(file, line);
 #else
 void grpc_cq_internal_ref(grpc_completion_queue* cq) {
+  grpc_core::DebugLocation debug_location;
+  const char* reason = nullptr;
 #endif
-  gpr_ref(&cq->owning_refs);
+  cq->owning_refs.Ref(debug_location, reason);
 }
 
 static void on_pollset_shutdown_done(void* arg, grpc_error* error) {
@@ -593,16 +590,13 @@ static void on_pollset_shutdown_done(void* arg, grpc_error* error) {
 #ifndef NDEBUG
 void grpc_cq_internal_unref(grpc_completion_queue* cq, const char* reason,
                             const char* file, int line) {
-  if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_cq_refcount)) {
-    gpr_atm val = gpr_atm_no_barrier_load(&cq->owning_refs.count);
-    gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "CQ:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", cq, val, val - 1,
-            reason);
-  }
+  grpc_core::DebugLocation debug_location(file, line);
 #else
 void grpc_cq_internal_unref(grpc_completion_queue* cq) {
+  grpc_core::DebugLocation debug_location;
+  const char* reason = nullptr;
 #endif
-  if (gpr_unref(&cq->owning_refs)) {
+  if (GPR_UNLIKELY(cq->owning_refs.Unref(debug_location, reason))) {
     cq->vtable->destroy(DATA_FROM_CQ(cq));
     cq->poller_vtable->destroy(POLLSET_FROM_CQ(cq));
 #ifndef NDEBUG
@@ -857,17 +851,20 @@ static void cq_end_op_for_callback(
   }
 
   auto* functor = static_cast<grpc_experimental_completion_queue_functor*>(tag);
-  if (internal) {
+  if (internal || grpc_iomgr_is_any_background_poller_thread()) {
     grpc_core::ApplicationCallbackExecCtx::Enqueue(functor,
                                                    (error == GRPC_ERROR_NONE));
     GRPC_ERROR_UNREF(error);
-  } else {
-    GRPC_CLOSURE_SCHED(
-        GRPC_CLOSURE_CREATE(
-            functor_callback, functor,
-            grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT)),
-        error);
+    return;
   }
+
+  // Schedule the callback on a closure if not internal or triggered
+  // from a background poller thread.
+  GRPC_CLOSURE_SCHED(
+      GRPC_CLOSURE_CREATE(
+          functor_callback, functor,
+          grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT)),
+      error);
 }
 
 void grpc_cq_end_op(grpc_completion_queue* cq, void* tag, grpc_error* error,
@@ -1352,6 +1349,13 @@ static void cq_finish_shutdown_callback(grpc_completion_queue* cq) {
   GPR_ASSERT(cqd->shutdown_called);
 
   cq->poller_vtable->shutdown(POLLSET_FROM_CQ(cq), &cq->pollset_shutdown_done);
+  if (grpc_iomgr_is_any_background_poller_thread()) {
+    grpc_core::ApplicationCallbackExecCtx::Enqueue(callback, true);
+    return;
+  }
+
+  // Schedule the callback on a closure if not internal or triggered
+  // from a background poller thread.
   GRPC_CLOSURE_SCHED(
       GRPC_CLOSURE_CREATE(
           functor_callback, callback,
index 2a6d307..c02b402 100644 (file)
@@ -134,6 +134,7 @@ void grpc_init(void) {
     grpc_core::Fork::GlobalInit();
     grpc_fork_handlers_auto_register();
     grpc_stats_init();
+    grpc_init_static_metadata_ctx();
     grpc_slice_intern_init();
     grpc_mdctx_global_init();
     grpc_channel_init_init();
@@ -191,6 +192,8 @@ void grpc_shutdown_internal_locked(void) {
   grpc_core::ApplicationCallbackExecCtx::GlobalShutdown();
   g_shutting_down = false;
   gpr_cv_broadcast(g_shutting_down_cv);
+  // Absolute last action will be to delete static metadata context.
+  grpc_destroy_static_metadata_ctx();
 }
 
 void grpc_shutdown_internal(void* ignored) {
index 0e83a11..2330894 100644 (file)
@@ -78,4 +78,7 @@ void grpc_register_security_filters(void) {
                                    maybe_prepend_server_auth_filter, nullptr);
 }
 
-void grpc_security_init() { grpc_core::SecurityRegisterHandshakerFactories(); }
+void grpc_security_init() {
+  grpc_core::SecurityRegisterHandshakerFactories();
+  grpc_control_plane_credentials_init();
+}
index dde39b8..10a2792 100644 (file)
@@ -61,10 +61,10 @@ static void fill_metadata(grpc_call_element* elem, grpc_metadata_batch* mdb) {
   char tmp[GPR_LTOA_MIN_BUFSIZE];
   gpr_ltoa(chand->error_code, tmp);
   calld->status.md = grpc_mdelem_from_slices(
-      GRPC_MDSTR_GRPC_STATUS, grpc_slice_from_copied_string(tmp));
+      GRPC_MDSTR_GRPC_STATUS, grpc_core::UnmanagedMemorySlice(tmp));
   calld->details.md = grpc_mdelem_from_slices(
       GRPC_MDSTR_GRPC_MESSAGE,
-      grpc_slice_from_copied_string(chand->error_message));
+      grpc_core::UnmanagedMemorySlice(chand->error_message));
   calld->status.prev = calld->details.next = nullptr;
   calld->status.next = &calld->details;
   calld->details.prev = &calld->status;
index 8f6df48..087574f 100644 (file)
@@ -31,6 +31,7 @@
 #include <utility>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/channelz.h"
 #include "src/core/lib/channel/connected_channel.h"
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/mpscq.h"
@@ -111,7 +112,7 @@ struct channel_data {
   uint32_t registered_method_max_probes;
   grpc_closure finish_destroy_channel_closure;
   grpc_closure channel_connectivity_changed;
-  grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node;
+  intptr_t channelz_socket_uuid;
 };
 
 typedef struct shutdown_tag {
@@ -255,7 +256,7 @@ struct grpc_server {
 
   listener* listeners;
   int listeners_destroyed;
-  gpr_refcount internal_refcount;
+  grpc_core::RefCount internal_refcount;
 
   /** when did we print the last shutdown progress message */
   gpr_timespec last_shutdown_message_time;
@@ -399,9 +400,7 @@ static void request_matcher_kill_requests(grpc_server* server,
  * server proper
  */
 
-static void server_ref(grpc_server* server) {
-  gpr_ref(&server->internal_refcount);
-}
+static void server_ref(grpc_server* server) { server->internal_refcount.Ref(); }
 
 static void server_delete(grpc_server* server) {
   registered_method* rm;
@@ -433,7 +432,7 @@ static void server_delete(grpc_server* server) {
 }
 
 static void server_unref(grpc_server* server) {
-  if (gpr_unref(&server->internal_refcount)) {
+  if (GPR_UNLIKELY(server->internal_refcount.Unref())) {
     server_delete(server);
   }
 }
@@ -630,7 +629,7 @@ static void start_new_rpc(grpc_call_element* elem) {
     for (i = 0; i <= chand->registered_method_max_probes; i++) {
       rm = &chand->registered_methods[(hash + i) %
                                       chand->registered_method_slots];
-      if (!rm) break;
+      if (rm->server_registered_method == nullptr) break;
       if (!rm->has_host) continue;
       if (!grpc_slice_eq(rm->host, calld->host)) continue;
       if (!grpc_slice_eq(rm->method, calld->path)) continue;
@@ -648,7 +647,7 @@ static void start_new_rpc(grpc_call_element* elem) {
     for (i = 0; i <= chand->registered_method_max_probes; i++) {
       rm = &chand->registered_methods[(hash + i) %
                                       chand->registered_method_slots];
-      if (!rm) break;
+      if (rm->server_registered_method == nullptr) break;
       if (rm->has_host) continue;
       if (!grpc_slice_eq(rm->method, calld->path)) continue;
       if ((rm->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) &&
@@ -710,8 +709,10 @@ static void maybe_finish_shutdown(grpc_server* server) {
     return;
   }
 
+  gpr_mu_lock(&server->mu_call);
   kill_pending_work_locked(
       server, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
+  gpr_mu_unlock(&server->mu_call);
 
   if (server->root_channel_data.next != &server->root_channel_data ||
       server->listeners_destroyed < num_listeners(server)) {
@@ -743,19 +744,18 @@ static void server_on_recv_initial_metadata(void* ptr, grpc_error* error) {
   grpc_millis op_deadline;
 
   if (error == GRPC_ERROR_NONE) {
-    GPR_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr);
-    GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority != nullptr);
+    GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr);
+    GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.authority !=
+                     nullptr);
     calld->path = grpc_slice_ref_internal(
         GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md));
     calld->host = grpc_slice_ref_internal(
         GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md));
     calld->path_set = true;
     calld->host_set = true;
+    grpc_metadata_batch_remove(calld->recv_initial_metadata, GRPC_BATCH_PATH);
     grpc_metadata_batch_remove(calld->recv_initial_metadata,
-                               calld->recv_initial_metadata->idx.named.path);
-    grpc_metadata_batch_remove(
-        calld->recv_initial_metadata,
-        calld->recv_initial_metadata->idx.named.authority);
+                               GRPC_BATCH_AUTHORITY);
   } else {
     GRPC_ERROR_REF(error);
   }
@@ -941,7 +941,6 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
 static void destroy_channel_elem(grpc_channel_element* elem) {
   size_t i;
   channel_data* chand = static_cast<channel_data*>(elem->channel_data);
-  chand->socket_node.reset();
   if (chand->registered_methods) {
     for (i = 0; i < chand->registered_method_slots; i++) {
       grpc_slice_unref_internal(chand->registered_methods[i].method);
@@ -952,6 +951,11 @@ static void destroy_channel_elem(grpc_channel_element* elem) {
     gpr_free(chand->registered_methods);
   }
   if (chand->server) {
+    if (chand->server->channelz_server != nullptr &&
+        chand->channelz_socket_uuid != 0) {
+      chand->server->channelz_server->RemoveChildSocket(
+          chand->channelz_socket_uuid);
+    }
     gpr_mu_lock(&chand->server->mu_global);
     chand->next->prev = chand->prev;
     chand->prev->next = chand->next;
@@ -1024,7 +1028,7 @@ grpc_server* grpc_server_create(const grpc_channel_args* args, void* reserved) {
   gpr_cv_init(&server->starting_cv);
 
   /* decremented by grpc_server_destroy */
-  gpr_ref_init(&server->internal_refcount, 1);
+  new (&server->internal_refcount) grpc_core::RefCount();
   server->root_channel_data.next = server->root_channel_data.prev =
       &server->root_channel_data;
 
@@ -1144,7 +1148,8 @@ void grpc_server_get_pollsets(grpc_server* server, grpc_pollset*** pollsets,
 void grpc_server_setup_transport(
     grpc_server* s, grpc_transport* transport, grpc_pollset* accepting_pollset,
     const grpc_channel_args* args,
-    grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node,
+    const grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode>&
+        socket_node,
     grpc_resource_user* resource_user) {
   size_t num_registered_methods;
   size_t alloc;
@@ -1166,7 +1171,12 @@ void grpc_server_setup_transport(
   chand->server = s;
   server_ref(s);
   chand->channel = channel;
-  chand->socket_node = std::move(socket_node);
+  if (socket_node != nullptr) {
+    chand->channelz_socket_uuid = socket_node->uuid();
+    s->channelz_server->AddChildSocket(socket_node);
+  } else {
+    chand->channelz_socket_uuid = 0;
+  }
 
   size_t cq_idx;
   for (cq_idx = 0; cq_idx < s->cq_count; cq_idx++) {
@@ -1241,28 +1251,6 @@ void grpc_server_setup_transport(
   grpc_transport_perform_op(transport, op);
 }
 
-void grpc_server_populate_server_sockets(
-    grpc_server* s, grpc_core::channelz::ChildSocketsList* server_sockets,
-    intptr_t start_idx) {
-  gpr_mu_lock(&s->mu_global);
-  channel_data* c = nullptr;
-  for (c = s->root_channel_data.next; c != &s->root_channel_data; c = c->next) {
-    if (c->socket_node != nullptr && c->socket_node->uuid() >= start_idx) {
-      server_sockets->push_back(c->socket_node.get());
-    }
-  }
-  gpr_mu_unlock(&s->mu_global);
-}
-
-void grpc_server_populate_listen_sockets(
-    grpc_server* server, grpc_core::channelz::ChildRefsList* listen_sockets) {
-  gpr_mu_lock(&server->mu_global);
-  for (listener* l = server->listeners; l != nullptr; l = l->next) {
-    listen_sockets->push_back(l->socket_uuid);
-  }
-  gpr_mu_unlock(&server->mu_global);
-}
-
 void done_published_shutdown(void* done_arg, grpc_cq_completion* storage) {
   (void)done_arg;
   gpr_free(storage);
@@ -1350,6 +1338,9 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
     GRPC_CLOSURE_INIT(&l->destroy_done, listener_destroy_done, server,
                       grpc_schedule_on_exec_ctx);
     l->destroy(server, l->arg, &l->destroy_done);
+    if (server->channelz_server != nullptr && l->socket_uuid != 0) {
+      server->channelz_server->RemoveChildListenSocket(l->socket_uuid);
+    }
   }
 
   channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */,
@@ -1401,18 +1392,23 @@ void grpc_server_destroy(grpc_server* server) {
   server_unref(server);
 }
 
-void grpc_server_add_listener(grpc_server* server, void* arg,
-                              void (*start)(grpc_server* server, void* arg,
-                                            grpc_pollset** pollsets,
-                                            size_t pollset_count),
-                              void (*destroy)(grpc_server* server, void* arg,
-                                              grpc_closure* on_done),
-                              intptr_t socket_uuid) {
+void grpc_server_add_listener(
+    grpc_server* server, void* listener_arg,
+    void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets,
+                  size_t pollset_count),
+    void (*destroy)(grpc_server* server, void* arg, grpc_closure* on_done),
+    grpc_core::RefCountedPtr<grpc_core::channelz::ListenSocketNode> node) {
   listener* l = static_cast<listener*>(gpr_malloc(sizeof(listener)));
-  l->arg = arg;
+  l->arg = listener_arg;
   l->start = start;
   l->destroy = destroy;
-  l->socket_uuid = socket_uuid;
+  l->socket_uuid = 0;
+  if (node != nullptr) {
+    l->socket_uuid = node->uuid();
+    if (server->channelz_server != nullptr) {
+      server->channelz_server->AddChildListenSocket(std::move(node));
+    }
+  }
   l->next = server->listeners;
   server->listeners = l;
 }
index 393bb24..2285821 100644 (file)
@@ -34,31 +34,22 @@ extern grpc_core::TraceFlag grpc_server_channel_trace;
 
 /* Add a listener to the server: when the server starts, it will call start,
    and when it shuts down, it will call destroy */
-void grpc_server_add_listener(grpc_server* server, void* listener,
-                              void (*start)(grpc_server* server, void* arg,
-                                            grpc_pollset** pollsets,
-                                            size_t npollsets),
-                              void (*destroy)(grpc_server* server, void* arg,
-                                              grpc_closure* on_done),
-                              intptr_t socket_uuid);
+void grpc_server_add_listener(
+    grpc_server* server, void* listener_arg,
+    void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets,
+                  size_t npollsets),
+    void (*destroy)(grpc_server* server, void* arg, grpc_closure* on_done),
+    grpc_core::RefCountedPtr<grpc_core::channelz::ListenSocketNode> node);
 
 /* Setup a transport - creates a channel stack, binds the transport to the
    server */
 void grpc_server_setup_transport(
     grpc_server* server, grpc_transport* transport,
     grpc_pollset* accepting_pollset, const grpc_channel_args* args,
-    grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node,
+    const grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode>&
+        socket_node,
     grpc_resource_user* resource_user = nullptr);
 
-/* fills in the uuids of all sockets used for connections on this server */
-void grpc_server_populate_server_sockets(
-    grpc_server* server, grpc_core::channelz::ChildSocketsList* server_sockets,
-    intptr_t start_idx);
-
-/* fills in the uuids of all listen sockets on this server */
-void grpc_server_populate_listen_sockets(
-    grpc_server* server, grpc_core::channelz::ChildRefsList* listen_sockets);
-
 grpc_core::channelz::ServerNode* grpc_server_get_channelz_node(
     grpc_server* server);
 
index 0f65091..138f574 100644 (file)
@@ -67,6 +67,10 @@ grpc_error* grpc_validate_header_key_is_legal(const grpc_slice& slice) {
     return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
         "Metadata keys cannot be zero length");
   }
+  if (GRPC_SLICE_LENGTH(slice) > UINT32_MAX) {
+    return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+        "Metadata keys cannot be larger than UINT32_MAX");
+  }
   if (GRPC_SLICE_START_PTR(slice)[0] == ':') {
     return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
         "Metadata keys cannot start with :");
index 7d9d49b..71eb89a 100644 (file)
@@ -23,6 +23,6 @@
 
 #include <grpc/grpc.h>
 
-const char* grpc_version_string(void) { return "7.0.0"; }
+const char* grpc_version_string(void) { return "8.0.0"; }
 
-const char* grpc_g_stands_for(void) { return "gale"; }
+const char* grpc_g_stands_for(void) { return "ganges"; }
index 16b85ca..1dd234c 100644 (file)
@@ -55,17 +55,15 @@ void SliceBufferByteStream::Orphan() {
 
 bool SliceBufferByteStream::Next(size_t max_size_hint,
                                  grpc_closure* on_complete) {
-  GPR_ASSERT(cursor_ < backing_buffer_.count);
+  GPR_DEBUG_ASSERT(backing_buffer_.count > 0);
   return true;
 }
 
 grpc_error* SliceBufferByteStream::Pull(grpc_slice* slice) {
-  if (shutdown_error_ != GRPC_ERROR_NONE) {
+  if (GPR_UNLIKELY(shutdown_error_ != GRPC_ERROR_NONE)) {
     return GRPC_ERROR_REF(shutdown_error_);
   }
-  GPR_ASSERT(cursor_ < backing_buffer_.count);
-  *slice = grpc_slice_ref_internal(backing_buffer_.slices[cursor_]);
-  ++cursor_;
+  *slice = grpc_slice_buffer_take_first(&backing_buffer_);
   return GRPC_ERROR_NONE;
 }
 
index eff8325..0650301 100644 (file)
@@ -99,9 +99,8 @@ class SliceBufferByteStream : public ByteStream {
   void Shutdown(grpc_error* error) override;
 
  private:
-  grpc_slice_buffer backing_buffer_;
-  size_t cursor_ = 0;
   grpc_error* shutdown_error_ = GRPC_ERROR_NONE;
+  grpc_slice_buffer backing_buffer_;
 };
 
 //
index eb4e8c3..78a324b 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <grpc/support/string_util.h>
 #include "src/core/lib/iomgr/error_internal.h"
+#include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/transport/status_conversion.h"
 
 static grpc_error* recursively_find_error_with_field(grpc_error* error,
@@ -52,7 +53,15 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
   if (GPR_LIKELY(error == GRPC_ERROR_NONE)) {
     if (code != nullptr) *code = GRPC_STATUS_OK;
     if (slice != nullptr) {
-      grpc_error_get_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, slice);
+      // Normally, we call grpc_error_get_str(
+      //   error, GRPC_ERROR_STR_GRPC_MESSAGE, slice).
+      // We can fastpath since we know that:
+      // 1) Error is null
+      // 2) which == GRPC_ERROR_STR_GRPC_MESSAGE
+      // 3) The resulting slice is statically known.
+      // 4) Said resulting slice is of length 0 ("").
+      // This means 3 movs, instead of 10s of instructions and a strlen.
+      *slice = grpc_core::ExternallyManagedSlice("");
     }
     if (http_error != nullptr) {
       *http_error = GRPC_HTTP2_NO_ERROR;
index 1523ced..7601720 100644 (file)
@@ -68,8 +68,8 @@ void grpc_mdelem_trace_ref(void* md, const grpc_slice& key,
     char* key_str = grpc_slice_to_c_string(key);
     char* value_str = grpc_slice_to_c_string(value);
     gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "ELM   REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, refcnt,
-            refcnt + 1, key_str, value_str);
+            "mdelem   REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md,
+            refcnt, refcnt + 1, key_str, value_str);
     gpr_free(key_str);
     gpr_free(value_str);
   }
@@ -82,7 +82,7 @@ void grpc_mdelem_trace_unref(void* md, const grpc_slice& key,
     char* key_str = grpc_slice_to_c_string(key);
     char* value_str = grpc_slice_to_c_string(value);
     gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "ELM   UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md,
+            "mdelem   UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md,
             refcnt, refcnt - 1, key_str, value_str);
     gpr_free(key_str);
     gpr_free(value_str);
@@ -112,14 +112,33 @@ AllocatedMetadata::AllocatedMetadata(const grpc_slice& key,
     : RefcountedMdBase(grpc_slice_ref_internal(key),
                        grpc_slice_ref_internal(value)) {
 #ifndef NDEBUG
-  if (grpc_trace_metadata.enabled()) {
-    char* key_str = grpc_slice_to_c_string(key);
-    char* value_str = grpc_slice_to_c_string(value);
-    gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%" PRIdPTR ": '%s' = '%s'", this,
-            RefValue(), key_str, value_str);
-    gpr_free(key_str);
-    gpr_free(value_str);
-  }
+  TraceAtStart("ALLOC_MD");
+#endif
+}
+
+AllocatedMetadata::AllocatedMetadata(const grpc_slice& key,
+                                     const grpc_slice& value, const NoRefKey*)
+    : RefcountedMdBase(key, grpc_slice_ref_internal(value)) {
+#ifndef NDEBUG
+  TraceAtStart("ALLOC_MD_NOREF_KEY");
+#endif
+}
+
+AllocatedMetadata::AllocatedMetadata(
+    const grpc_core::ManagedMemorySlice& key,
+    const grpc_core::UnmanagedMemorySlice& value)
+    : RefcountedMdBase(key, value) {
+#ifndef NDEBUG
+  TraceAtStart("ALLOC_MD_NOREF_KEY_VAL");
+#endif
+}
+
+AllocatedMetadata::AllocatedMetadata(
+    const grpc_core::ExternallyManagedSlice& key,
+    const grpc_core::UnmanagedMemorySlice& value)
+    : RefcountedMdBase(key, value) {
+#ifndef NDEBUG
+  TraceAtStart("ALLOC_MD_NOREF_KEY_VAL");
 #endif
 }
 
@@ -134,6 +153,19 @@ AllocatedMetadata::~AllocatedMetadata() {
   }
 }
 
+#ifndef NDEBUG
+void grpc_core::RefcountedMdBase::TraceAtStart(const char* tag) {
+  if (grpc_trace_metadata.enabled()) {
+    char* key_str = grpc_slice_to_c_string(key());
+    char* value_str = grpc_slice_to_c_string(value());
+    gpr_log(GPR_DEBUG, "mdelem   %s:%p:%" PRIdPTR ": '%s' = '%s'", tag, this,
+            RefValue(), key_str, value_str);
+    gpr_free(key_str);
+    gpr_free(value_str);
+  }
+}
+#endif
+
 InternedMetadata::InternedMetadata(const grpc_slice& key,
                                    const grpc_slice& value, uint32_t hash,
                                    InternedMetadata* next)
@@ -141,14 +173,16 @@ InternedMetadata::InternedMetadata(const grpc_slice& key,
                        grpc_slice_ref_internal(value), hash),
       link_(next) {
 #ifndef NDEBUG
-  if (grpc_trace_metadata.enabled()) {
-    char* key_str = grpc_slice_to_c_string(key);
-    char* value_str = grpc_slice_to_c_string(value);
-    gpr_log(GPR_DEBUG, "ELM   NEW:%p:%" PRIdPTR ": '%s' = '%s'", this,
-            RefValue(), key_str, value_str);
-    gpr_free(key_str);
-    gpr_free(value_str);
-  }
+  TraceAtStart("INTERNED_MD");
+#endif
+}
+
+InternedMetadata::InternedMetadata(const grpc_slice& key,
+                                   const grpc_slice& value, uint32_t hash,
+                                   InternedMetadata* next, const NoRefKey*)
+    : RefcountedMdBase(key, grpc_slice_ref_internal(value), hash), link_(next) {
+#ifndef NDEBUG
+  TraceAtStart("INTERNED_MD_NOREF_KEY");
 #endif
 }
 
@@ -222,7 +256,12 @@ void grpc_mdctx_global_shutdown() {
         abort();
       }
     }
+      // For ASAN builds, we don't want to crash here, because that will
+      // prevent ASAN from providing leak detection information, which is
+      // far more useful than this simple assertion.
+#ifndef GRPC_ASAN_ENABLED
     GPR_DEBUG_ASSERT(shard->count == 0);
+#endif
     gpr_free(shard->elems);
   }
 }
@@ -230,9 +269,9 @@ void grpc_mdctx_global_shutdown() {
 #ifndef NDEBUG
 static int is_mdelem_static(grpc_mdelem e) {
   return reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(e)) >=
-             &grpc_static_mdelem_table[0] &&
+             &grpc_static_mdelem_table()[0] &&
          reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(e)) <
-             &grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
+             &grpc_static_mdelem_table()[GRPC_STATIC_MDELEM_COUNT];
 }
 #endif
 
@@ -243,8 +282,8 @@ void InternedMetadata::RefWithShardLocked(mdtab_shard* shard) {
     char* value_str = grpc_slice_to_c_string(value());
     intptr_t value = RefValue();
     gpr_log(__FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG,
-            "ELM   REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", this, value,
-            value + 1, key_str, value_str);
+            "mdelem   REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", this,
+            value, value + 1, key_str, value_str);
     gpr_free(key_str);
     gpr_free(value_str);
   }
@@ -302,36 +341,100 @@ static void rehash_mdtab(mdtab_shard* shard) {
   }
 }
 
-grpc_mdelem grpc_mdelem_create(
+template <bool key_definitely_static, bool value_definitely_static = false>
+static grpc_mdelem md_create_maybe_static(const grpc_slice& key,
+                                          const grpc_slice& value);
+template <bool key_definitely_static>
+static grpc_mdelem md_create_must_intern(const grpc_slice& key,
+                                         const grpc_slice& value,
+                                         uint32_t hash);
+
+template <bool key_definitely_static, bool value_definitely_static = false>
+static grpc_mdelem md_create(
     const grpc_slice& key, const grpc_slice& value,
     grpc_mdelem_data* compatible_external_backing_store) {
+  // Ensure slices are, in fact, static if we claimed they were.
+  GPR_DEBUG_ASSERT(!key_definitely_static ||
+                   GRPC_IS_STATIC_METADATA_STRING(key));
+  GPR_DEBUG_ASSERT(!value_definitely_static ||
+                   GRPC_IS_STATIC_METADATA_STRING(value));
+  const bool key_is_interned =
+      key_definitely_static || grpc_slice_is_interned(key);
+  const bool value_is_interned =
+      value_definitely_static || grpc_slice_is_interned(value);
   // External storage if either slice is not interned and the caller already
   // created a backing store. If no backing store, we allocate one.
-  if (!grpc_slice_is_interned(key) || !grpc_slice_is_interned(value)) {
+  if (!key_is_interned || !value_is_interned) {
     if (compatible_external_backing_store != nullptr) {
       // Caller provided backing store.
       return GRPC_MAKE_MDELEM(compatible_external_backing_store,
                               GRPC_MDELEM_STORAGE_EXTERNAL);
     } else {
       // We allocate backing store.
-      return GRPC_MAKE_MDELEM(grpc_core::New<AllocatedMetadata>(key, value),
-                              GRPC_MDELEM_STORAGE_ALLOCATED);
+      return key_definitely_static
+                 ? GRPC_MAKE_MDELEM(
+                       grpc_core::New<AllocatedMetadata>(
+                           key, value,
+                           static_cast<const AllocatedMetadata::NoRefKey*>(
+                               nullptr)),
+                       GRPC_MDELEM_STORAGE_ALLOCATED)
+                 : GRPC_MAKE_MDELEM(
+                       grpc_core::New<AllocatedMetadata>(key, value),
+                       GRPC_MDELEM_STORAGE_ALLOCATED);
     }
   }
+  return md_create_maybe_static<key_definitely_static, value_definitely_static>(
+      key, value);
+}
+
+template <bool key_definitely_static, bool value_definitely_static>
+static grpc_mdelem md_create_maybe_static(const grpc_slice& key,
+                                          const grpc_slice& value) {
+  // Ensure slices are, in fact, static if we claimed they were.
+  GPR_DEBUG_ASSERT(!key_definitely_static ||
+                   GRPC_IS_STATIC_METADATA_STRING(key));
+  GPR_DEBUG_ASSERT(!value_definitely_static ||
+                   GRPC_IS_STATIC_METADATA_STRING(value));
+  GPR_DEBUG_ASSERT(key.refcount != nullptr);
+  GPR_DEBUG_ASSERT(value.refcount != nullptr);
+
+  const bool key_is_static_mdstr =
+      key_definitely_static ||
+      key.refcount->GetType() == grpc_slice_refcount::Type::STATIC;
+  const bool value_is_static_mdstr =
+      value_definitely_static ||
+      value.refcount->GetType() == grpc_slice_refcount::Type::STATIC;
+
+  const intptr_t kidx = GRPC_STATIC_METADATA_INDEX(key);
 
   // Not all static slice input yields a statically stored metadata element.
-  // It may be worth documenting why.
-  if (GRPC_IS_STATIC_METADATA_STRING(key) &&
-      GRPC_IS_STATIC_METADATA_STRING(value)) {
+  if (key_is_static_mdstr && value_is_static_mdstr) {
     grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings(
-        GRPC_STATIC_METADATA_INDEX(key), GRPC_STATIC_METADATA_INDEX(value));
+        kidx, GRPC_STATIC_METADATA_INDEX(value));
     if (!GRPC_MDISNULL(static_elem)) {
       return static_elem;
     }
   }
 
-  uint32_t hash = GRPC_MDSTR_KV_HASH(grpc_slice_hash_refcounted(key),
-                                     grpc_slice_hash_refcounted(value));
+  uint32_t khash = key_definitely_static
+                       ? grpc_static_metadata_hash_values[kidx]
+                       : grpc_slice_hash_refcounted(key);
+
+  uint32_t hash = GRPC_MDSTR_KV_HASH(khash, grpc_slice_hash_refcounted(value));
+  return md_create_must_intern<key_definitely_static>(key, value, hash);
+}
+
+template <bool key_definitely_static>
+static grpc_mdelem md_create_must_intern(const grpc_slice& key,
+                                         const grpc_slice& value,
+                                         uint32_t hash) {
+  // Here, we know both key and value are both at least interned, and both
+  // possibly static. We know that anything inside the shared interned table is
+  // also at least interned (and maybe static). Note that equality for a static
+  // and interned slice implies that they are both the same exact slice.
+  // The same applies to a pair of interned slices, or a pair of static slices.
+  // Rather than run the full equality check, we can therefore just do a pointer
+  // comparison of the refcounts.
   InternedMetadata* md;
   mdtab_shard* shard = &g_shards[SHARD_IDX(hash)];
   size_t idx;
@@ -343,7 +446,8 @@ grpc_mdelem grpc_mdelem_create(
   idx = TABLE_IDX(hash, shard->capacity);
   /* search for an existing pair */
   for (md = shard->elems[idx].next; md; md = md->bucket_next()) {
-    if (grpc_slice_eq(key, md->key()) && grpc_slice_eq(value, md->value())) {
+    if (grpc_slice_static_interned_equal(key, md->key()) &&
+        grpc_slice_static_interned_equal(value, md->value())) {
       md->RefWithShardLocked(shard);
       gpr_mu_unlock(&shard->mu);
       return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED);
@@ -351,8 +455,12 @@ grpc_mdelem grpc_mdelem_create(
   }
 
   /* not found: create a new pair */
-  md = grpc_core::New<InternedMetadata>(key, value, hash,
-                                        shard->elems[idx].next);
+  md = key_definitely_static
+           ? grpc_core::New<InternedMetadata>(
+                 key, value, hash, shard->elems[idx].next,
+                 static_cast<const InternedMetadata::NoRefKey*>(nullptr))
+           : grpc_core::New<InternedMetadata>(key, value, hash,
+                                              shard->elems[idx].next);
   shard->elems[idx].next = md;
   shard->count++;
 
@@ -365,9 +473,68 @@ grpc_mdelem grpc_mdelem_create(
   return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED);
 }
 
+grpc_mdelem grpc_mdelem_create(
+    const grpc_slice& key, const grpc_slice& value,
+    grpc_mdelem_data* compatible_external_backing_store) {
+  return md_create<false>(key, value, compatible_external_backing_store);
+}
+
+grpc_mdelem grpc_mdelem_create(
+    const grpc_core::StaticMetadataSlice& key, const grpc_slice& value,
+    grpc_mdelem_data* compatible_external_backing_store) {
+  return md_create<true>(key, value, compatible_external_backing_store);
+}
+
+/* Create grpc_mdelem from provided slices. We specify via template parameter
+   whether we know that the input key is static or not. If it is, we short
+   circuit various comparisons and a no-op unref. */
+template <bool key_definitely_static>
+static grpc_mdelem md_from_slices(const grpc_slice& key,
+                                  const grpc_slice& value) {
+  // Ensure key is, in fact, static if we claimed it was.
+  GPR_DEBUG_ASSERT(!key_definitely_static ||
+                   GRPC_IS_STATIC_METADATA_STRING(key));
+  grpc_mdelem out = md_create<key_definitely_static>(key, value, nullptr);
+  if (!key_definitely_static) {
+    grpc_slice_unref_internal(key);
+  }
+  grpc_slice_unref_internal(value);
+  return out;
+}
+
 grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key,
                                     const grpc_slice& value) {
-  grpc_mdelem out = grpc_mdelem_create(key, value, nullptr);
+  return md_from_slices</*key_definitely_static=*/false>(key, value);
+}
+
+grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key,
+                                    const grpc_slice& value) {
+  return md_from_slices</*key_definitely_static=*/true>(key, value);
+}
+
+grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::StaticMetadataSlice& key,
+    const grpc_core::StaticMetadataSlice& value) {
+  grpc_mdelem out = md_create_maybe_static<true, true>(key, value);
+  return out;
+}
+
+grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::StaticMetadataSlice& key,
+    const grpc_core::ManagedMemorySlice& value) {
+  // TODO(arjunroy): We can save the unref if md_create_maybe_static ended up
+  // creating a new interned metadata. But otherwise - we need this here.
+  grpc_mdelem out = md_create_maybe_static<true>(key, value);
+  grpc_slice_unref_internal(value);
+  return out;
+}
+
+grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::ManagedMemorySlice& key,
+    const grpc_core::ManagedMemorySlice& value) {
+  grpc_mdelem out = md_create_maybe_static<false>(key, value);
+  // TODO(arjunroy): We can save the unref if md_create_maybe_static ended up
+  // creating a new interned metadata. But otherwise - we need this here.
   grpc_slice_unref_internal(key);
   grpc_slice_unref_internal(value);
   return out;
@@ -402,7 +569,7 @@ void* grpc_mdelem_get_user_data(grpc_mdelem md, void (*destroy_func)(void*)) {
           grpc_static_mdelem_user_data
               [reinterpret_cast<grpc_core::StaticMetadata*>(
                    GRPC_MDELEM_DATA(md)) -
-               grpc_static_mdelem_table]);
+               grpc_static_mdelem_table()]);
     case GRPC_MDELEM_STORAGE_ALLOCATED: {
       auto* am = reinterpret_cast<AllocatedMetadata*>(GRPC_MDELEM_DATA(md));
       return get_user_data(am->user_data(), destroy_func);
@@ -444,7 +611,7 @@ void* grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void*),
           grpc_static_mdelem_user_data
               [reinterpret_cast<grpc_core::StaticMetadata*>(
                    GRPC_MDELEM_DATA(md)) -
-               grpc_static_mdelem_table]);
+               grpc_static_mdelem_table()]);
     case GRPC_MDELEM_STORAGE_ALLOCATED: {
       auto* am = reinterpret_cast<AllocatedMetadata*>(GRPC_MDELEM_DATA(md));
       return set_user_data(am->user_data(), destroy_func, data);
index 3cef031..3d3a681 100644 (file)
@@ -118,10 +118,31 @@ struct grpc_mdelem {
   ((grpc_mdelem_data_storage)((md).payload & \
                               (uintptr_t)GRPC_MDELEM_STORAGE_INTERNED_BIT))
 
-/* Unrefs the slices. */
+/* Given arbitrary input slices, create a grpc_mdelem object. The caller refs
+ * the input slices; we unref them. This method is always safe to call; however,
+ * if we know data about the slices in question (e.g. if we knew our key was
+ * static) we can call specializations that save on cycle count. */
 grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key,
                                     const grpc_slice& value);
 
+/* Like grpc_mdelem_from_slices, but we know that key is a static slice. This
+   saves us a few branches and a no-op call to md_unref() for the key. */
+grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key,
+                                    const grpc_slice& value);
+
+/* Like grpc_mdelem_from_slices, but key is static and val is static. */
+grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::StaticMetadataSlice& key,
+    const grpc_core::StaticMetadataSlice& value);
+
+/* Like grpc_mdelem_from_slices, but key is static and val is interned. */
+grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key,
+                                    const grpc_core::ManagedMemorySlice& value);
+
+/* Like grpc_mdelem_from_slices, but key and val are interned. */
+grpc_mdelem grpc_mdelem_from_slices(const grpc_core::ManagedMemorySlice& key,
+                                    const grpc_core::ManagedMemorySlice& value);
+
 /* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata
    object as backing storage (so lifetimes should align) */
 grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata);
@@ -134,6 +155,11 @@ grpc_mdelem grpc_mdelem_create(
     const grpc_slice& key, const grpc_slice& value,
     grpc_mdelem_data* compatible_external_backing_store);
 
+/* Like grpc_mdelem_create, but we know that key is static. */
+grpc_mdelem grpc_mdelem_create(
+    const grpc_core::StaticMetadataSlice& key, const grpc_slice& value,
+    grpc_mdelem_data* compatible_external_backing_store);
+
 #define GRPC_MDKEY(md) (GRPC_MDELEM_DATA(md)->key)
 #define GRPC_MDVALUE(md) (GRPC_MDELEM_DATA(md)->value)
 
@@ -186,19 +212,21 @@ struct UserData {
 
 class StaticMetadata {
  public:
-  StaticMetadata(const grpc_slice& key, const grpc_slice& value)
-      : kv_({key, value}), hash_(0) {}
+  StaticMetadata(const grpc_slice& key, const grpc_slice& value, uintptr_t idx)
+      : kv_({key, value}), hash_(0), static_idx_(idx) {}
 
   const grpc_mdelem_data& data() const { return kv_; }
 
   void HashInit();
   uint32_t hash() { return hash_; }
+  uintptr_t StaticIndex() { return static_idx_; }
 
  private:
   grpc_mdelem_data kv_;
 
   /* private only data */
   uint32_t hash_;
+  uintptr_t static_idx_;
 };
 
 class RefcountedMdBase {
@@ -237,6 +265,10 @@ class RefcountedMdBase {
   }
 
  protected:
+#ifndef NDEBUG
+  void TraceAtStart(const char* tag);
+#endif
+
   intptr_t RefValue() { return refcnt_.Load(MemoryOrder::RELAXED); }
   bool AllRefsDropped() { return refcnt_.Load(MemoryOrder::ACQUIRE) == 0; }
   bool FirstRef() { return refcnt_.FetchAdd(1, MemoryOrder::RELAXED) == 0; }
@@ -251,16 +283,19 @@ class RefcountedMdBase {
 
 class InternedMetadata : public RefcountedMdBase {
  public:
+  // TODO(arjunroy): Change to use strongly typed slices instead.
+  struct NoRefKey {};
   struct BucketLink {
     explicit BucketLink(InternedMetadata* md) : next(md) {}
 
     InternedMetadata* next = nullptr;
   };
-
   InternedMetadata(const grpc_slice& key, const grpc_slice& value,
                    uint32_t hash, InternedMetadata* next);
-  ~InternedMetadata();
+  InternedMetadata(const grpc_slice& key, const grpc_slice& value,
+                   uint32_t hash, InternedMetadata* next, const NoRefKey*);
 
+  ~InternedMetadata();
   void RefWithShardLocked(mdtab_shard* shard);
   UserData* user_data() { return &user_data_; }
   InternedMetadata* bucket_next() { return link_.next; }
@@ -276,7 +311,15 @@ class InternedMetadata : public RefcountedMdBase {
 /* Shadow structure for grpc_mdelem_data for allocated elements */
 class AllocatedMetadata : public RefcountedMdBase {
  public:
+  // TODO(arjunroy): Change to use strongly typed slices instead.
+  struct NoRefKey {};
   AllocatedMetadata(const grpc_slice& key, const grpc_slice& value);
+  AllocatedMetadata(const grpc_core::ManagedMemorySlice& key,
+                    const grpc_core::UnmanagedMemorySlice& value);
+  AllocatedMetadata(const grpc_core::ExternallyManagedSlice& key,
+                    const grpc_core::UnmanagedMemorySlice& value);
+  AllocatedMetadata(const grpc_slice& key, const grpc_slice& value,
+                    const NoRefKey*);
   ~AllocatedMetadata();
 
   UserData* user_data() { return &user_data_; }
@@ -348,10 +391,11 @@ inline void grpc_mdelem_unref(grpc_mdelem gmd) {
          free an interned md at any time: it's unsafe from this point on to
          access it so we read the hash now. */
       uint32_t hash = md->hash();
-      if (GPR_UNLIKELY(md->Unref())) {
 #ifndef NDEBUG
+      if (GPR_UNLIKELY(md->Unref(file, line))) {
         grpc_mdelem_on_final_unref(storage, md, hash, file, line);
 #else
+      if (GPR_UNLIKELY(md->Unref())) {
         grpc_mdelem_on_final_unref(storage, md, hash);
 #endif
       }
@@ -371,4 +415,35 @@ inline void grpc_mdelem_unref(grpc_mdelem gmd) {
 void grpc_mdctx_global_init(void);
 void grpc_mdctx_global_shutdown();
 
+/* Like grpc_mdelem_from_slices, but we know that key is a static or interned
+   slice and value is not static or interned. This gives us an inlinable
+   fastpath - we know we must allocate metadata now, and that we do not need to
+   unref the value (rather, we just transfer the ref). We can avoid a ref since:
+   1) the key slice is passed in already ref'd
+   2) We're guaranteed to create a new Allocated slice, thus meaning the
+      ref can be considered 'transferred'.*/
+inline grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::ManagedMemorySlice& key,
+    const grpc_core::UnmanagedMemorySlice& value) {
+  using grpc_core::AllocatedMetadata;
+  return GRPC_MAKE_MDELEM(grpc_core::New<AllocatedMetadata>(key, value),
+                          GRPC_MDELEM_STORAGE_ALLOCATED);
+}
+
+inline grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::ExternallyManagedSlice& key,
+    const grpc_core::UnmanagedMemorySlice& value) {
+  using grpc_core::AllocatedMetadata;
+  return GRPC_MAKE_MDELEM(grpc_core::New<AllocatedMetadata>(key, value),
+                          GRPC_MDELEM_STORAGE_ALLOCATED);
+}
+
+inline grpc_mdelem grpc_mdelem_from_slices(
+    const grpc_core::StaticMetadataSlice& key,
+    const grpc_core::UnmanagedMemorySlice& value) {
+  using grpc_core::AllocatedMetadata;
+  return GRPC_MAKE_MDELEM(grpc_core::New<AllocatedMetadata>(key, value),
+                          GRPC_MDELEM_STORAGE_ALLOCATED);
+}
+
 #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */
index 49a56e7..560342c 100644 (file)
@@ -93,6 +93,23 @@ grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md) {
   return out;
 }
 
+static grpc_error* GPR_ATTRIBUTE_NOINLINE error_with_md(grpc_mdelem md) {
+  return grpc_attach_md_to_error(
+      GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"), md);
+}
+
+static grpc_error* link_callout(grpc_metadata_batch* batch,
+                                grpc_linked_mdelem* storage,
+                                grpc_metadata_batch_callouts_index idx) {
+  GPR_DEBUG_ASSERT(idx >= 0 && idx < GRPC_BATCH_CALLOUTS_COUNT);
+  if (GPR_LIKELY(batch->idx.array[idx] == nullptr)) {
+    ++batch->list.default_count;
+    batch->idx.array[idx] = storage;
+    return GRPC_ERROR_NONE;
+  }
+  return error_with_md(storage->md);
+}
+
 static grpc_error* maybe_link_callout(grpc_metadata_batch* batch,
                                       grpc_linked_mdelem* storage)
     GRPC_MUST_USE_RESULT;
@@ -104,14 +121,7 @@ static grpc_error* maybe_link_callout(grpc_metadata_batch* batch,
   if (idx == GRPC_BATCH_CALLOUTS_COUNT) {
     return GRPC_ERROR_NONE;
   }
-  if (batch->idx.array[idx] == nullptr) {
-    ++batch->list.default_count;
-    batch->idx.array[idx] = storage;
-    return GRPC_ERROR_NONE;
-  }
-  return grpc_attach_md_to_error(
-      GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"),
-      storage->md);
+  return link_callout(batch, storage, idx);
 }
 
 static void maybe_unlink_callout(grpc_metadata_batch* batch,
@@ -122,21 +132,21 @@ static void maybe_unlink_callout(grpc_metadata_batch* batch,
     return;
   }
   --batch->list.default_count;
-  GPR_ASSERT(batch->idx.array[idx] != nullptr);
+  GPR_DEBUG_ASSERT(batch->idx.array[idx] != nullptr);
   batch->idx.array[idx] = nullptr;
 }
 
 grpc_error* grpc_metadata_batch_add_head(grpc_metadata_batch* batch,
                                          grpc_linked_mdelem* storage,
                                          grpc_mdelem elem_to_add) {
-  GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
   storage->md = elem_to_add;
   return grpc_metadata_batch_link_head(batch, storage);
 }
 
 static void link_head(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
   assert_valid_list(list);
-  GPR_ASSERT(!GRPC_MDISNULL(storage->md));
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md));
   storage->prev = nullptr;
   storage->next = list->head;
   storage->reserved = nullptr;
@@ -163,17 +173,35 @@ grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
   return GRPC_ERROR_NONE;
 }
 
+// TODO(arjunroy): Need to revisit this and see what guarantees exist between
+// C-core and the internal-metadata subsystem. E.g. can we ensure a particular
+// metadata is never added twice, even in the presence of user supplied data?
+grpc_error* grpc_metadata_batch_link_head(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_metadata_batch_callouts_index idx) {
+  GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx);
+  assert_valid_callouts(batch);
+  grpc_error* err = link_callout(batch, storage, idx);
+  if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
+    assert_valid_callouts(batch);
+    return err;
+  }
+  link_head(&batch->list, storage);
+  assert_valid_callouts(batch);
+  return GRPC_ERROR_NONE;
+}
+
 grpc_error* grpc_metadata_batch_add_tail(grpc_metadata_batch* batch,
                                          grpc_linked_mdelem* storage,
                                          grpc_mdelem elem_to_add) {
-  GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
   storage->md = elem_to_add;
   return grpc_metadata_batch_link_tail(batch, storage);
 }
 
 static void link_tail(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
   assert_valid_list(list);
-  GPR_ASSERT(!GRPC_MDISNULL(storage->md));
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md));
   storage->prev = list->tail;
   storage->next = nullptr;
   storage->reserved = nullptr;
@@ -200,6 +228,21 @@ grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
   return GRPC_ERROR_NONE;
 }
 
+grpc_error* grpc_metadata_batch_link_tail(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_metadata_batch_callouts_index idx) {
+  GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx);
+  assert_valid_callouts(batch);
+  grpc_error* err = link_callout(batch, storage, idx);
+  if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
+    assert_valid_callouts(batch);
+    return err;
+  }
+  link_tail(&batch->list, storage);
+  assert_valid_callouts(batch);
+  return GRPC_ERROR_NONE;
+}
+
 static void unlink_storage(grpc_mdelem_list* list,
                            grpc_linked_mdelem* storage) {
   assert_valid_list(list);
@@ -226,6 +269,18 @@ void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
   assert_valid_callouts(batch);
 }
 
+void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
+                                grpc_metadata_batch_callouts_index idx) {
+  assert_valid_callouts(batch);
+  grpc_linked_mdelem* storage = batch->idx.array[idx];
+  GPR_DEBUG_ASSERT(storage != nullptr);
+  --batch->list.default_count;
+  batch->idx.array[idx] = nullptr;
+  unlink_storage(&batch->list, storage);
+  GRPC_MDELEM_UNREF(storage->md);
+  assert_valid_callouts(batch);
+}
+
 void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
                                    const grpc_slice& value) {
   grpc_mdelem old_mdelem = storage->md;
@@ -313,13 +368,14 @@ void grpc_metadata_batch_copy(grpc_metadata_batch* src,
   size_t i = 0;
   for (grpc_linked_mdelem* elem = src->list.head; elem != nullptr;
        elem = elem->next) {
-    grpc_error* error = grpc_metadata_batch_add_tail(dst, &storage[i++],
-                                                     GRPC_MDELEM_REF(elem->md));
+    // Error unused in non-debug builds.
+    grpc_error* GRPC_UNUSED error = grpc_metadata_batch_add_tail(
+        dst, &storage[i++], GRPC_MDELEM_REF(elem->md));
     // The only way that grpc_metadata_batch_add_tail() can fail is if
     // there's a duplicate entry for a callout.  However, that can't be
     // the case here, because we would not have been allowed to create
     // a source batch that had that kind of conflict.
-    GPR_ASSERT(error == GRPC_ERROR_NONE);
+    GPR_DEBUG_ASSERT(error == GRPC_ERROR_NONE);
   }
 }
 
index d87a8b0..46a437e 100644 (file)
@@ -67,6 +67,8 @@ size_t grpc_metadata_batch_size(grpc_metadata_batch* batch);
 /** Remove \a storage from the batch, unreffing the mdelem contained */
 void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
                                 grpc_linked_mdelem* storage);
+void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
+                                grpc_metadata_batch_callouts_index idx);
 
 /** Substitute a new mdelem for an old value */
 grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
@@ -84,6 +86,9 @@ void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
 grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
                                           grpc_linked_mdelem* storage)
     GRPC_MUST_USE_RESULT;
+grpc_error* grpc_metadata_batch_link_head(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT;
 
 /** Add \a storage to the end of \a batch. storage->md is
     assumed to be valid.
@@ -93,6 +98,9 @@ grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
 grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
                                           grpc_linked_mdelem* storage)
     GRPC_MUST_USE_RESULT;
+grpc_error* grpc_metadata_batch_link_tail(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT;
 
 /** Add \a elem_to_add as the first element in \a batch, using
     \a storage as backing storage for the linked list element.
@@ -104,6 +112,22 @@ grpc_error* grpc_metadata_batch_add_head(
     grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
     grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
 
+// TODO(arjunroy, roth): Remove redundant methods.
+// add/link_head/tail are almost identical.
+inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_metadata_batch_callouts_index idx) {
+  return grpc_metadata_batch_link_head(batch, storage, idx);
+}
+
+inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) {
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
+  storage->md = elem_to_add;
+  return grpc_metadata_batch_add_head(batch, storage, idx);
+}
+
 /** Add \a elem_to_add as the last element in \a batch, using
     \a storage as backing storage for the linked list element.
     \a storage is owned by the caller and must survive for the
@@ -114,6 +138,20 @@ grpc_error* grpc_metadata_batch_add_tail(
     grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
     grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
 
+inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_metadata_batch_callouts_index idx) {
+  return grpc_metadata_batch_link_tail(batch, storage, idx);
+}
+
+inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
+    grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
+    grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) {
+  GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
+  storage->md = elem_to_add;
+  return grpc_metadata_batch_add_tail(batch, storage, idx);
+}
+
 grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md);
 
 typedef struct {
index bbf1736..f412edb 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "src/core/lib/slice/slice_internal.h"
 
-static uint8_t g_bytes[] = {
+static constexpr uint8_t g_bytes[] = {
     58,  112, 97,  116, 104, 58,  109, 101, 116, 104, 111, 100, 58,  115, 116,
     97,  116, 117, 115, 58,  97,  117, 116, 104, 111, 114, 105, 116, 121, 58,
     115, 99,  104, 101, 109, 101, 116, 101, 103, 114, 112, 99,  45,  109, 101,
@@ -49,312 +49,1157 @@ static uint8_t g_bytes[] = {
     101, 113, 117, 101, 115, 116, 103, 114, 112, 99,  45,  105, 110, 116, 101,
     114, 110, 97,  108, 45,  115, 116, 114, 101, 97,  109, 45,  101, 110, 99,
     111, 100, 105, 110, 103, 45,  114, 101, 113, 117, 101, 115, 116, 117, 115,
-    101, 114, 45,  97,  103, 101, 110, 116, 104, 111, 115, 116, 108, 98,  45,
-    116, 111, 107, 101, 110, 103, 114, 112, 99,  45,  112, 114, 101, 118, 105,
-    111, 117, 115, 45,  114, 112, 99,  45,  97,  116, 116, 101, 109, 112, 116,
-    115, 103, 114, 112, 99,  45,  114, 101, 116, 114, 121, 45,  112, 117, 115,
-    104, 98,  97,  99,  107, 45,  109, 115, 103, 114, 112, 99,  45,  116, 105,
-    109, 101, 111, 117, 116, 49,  50,  51,  52,  103, 114, 112, 99,  46,  119,
-    97,  105, 116, 95,  102, 111, 114, 95,  114, 101, 97,  100, 121, 103, 114,
-    112, 99,  46,  116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99,  46,
-    109, 97,  120, 95,  114, 101, 113, 117, 101, 115, 116, 95,  109, 101, 115,
-    115, 97,  103, 101, 95,  98,  121, 116, 101, 115, 103, 114, 112, 99,  46,
-    109, 97,  120, 95,  114, 101, 115, 112, 111, 110, 115, 101, 95,  109, 101,
-    115, 115, 97,  103, 101, 95,  98,  121, 116, 101, 115, 47,  103, 114, 112,
-    99,  46,  108, 98,  46,  118, 49,  46,  76,  111, 97,  100, 66,  97,  108,
-    97,  110, 99,  101, 114, 47,  66,  97,  108, 97,  110, 99,  101, 76,  111,
-    97,  100, 47,  103, 114, 112, 99,  46,  104, 101, 97,  108, 116, 104, 46,
-    118, 49,  46,  72,  101, 97,  108, 116, 104, 47,  87,  97,  116, 99,  104,
-    47,  101, 110, 118, 111, 121, 46,  115, 101, 114, 118, 105, 99,  101, 46,
-    100, 105, 115, 99,  111, 118, 101, 114, 121, 46,  118, 50,  46,  65,  103,
-    103, 114, 101, 103, 97,  116, 101, 100, 68,  105, 115, 99,  111, 118, 101,
-    114, 121, 83,  101, 114, 118, 105, 99,  101, 47,  83,  116, 114, 101, 97,
-    109, 65,  103, 103, 114, 101, 103, 97,  116, 101, 100, 82,  101, 115, 111,
-    117, 114, 99,  101, 115, 100, 101, 102, 108, 97,  116, 101, 103, 122, 105,
-    112, 115, 116, 114, 101, 97,  109, 47,  103, 122, 105, 112, 71,  69,  84,
-    80,  79,  83,  84,  47,  47,  105, 110, 100, 101, 120, 46,  104, 116, 109,
-    108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50,  48,  48,  50,  48,
-    52,  50,  48,  54,  51,  48,  52,  52,  48,  48,  52,  48,  52,  53,  48,
-    48,  97,  99,  99,  101, 112, 116, 45,  99,  104, 97,  114, 115, 101, 116,
-    103, 122, 105, 112, 44,  32,  100, 101, 102, 108, 97,  116, 101, 97,  99,
-    99,  101, 112, 116, 45,  108, 97,  110, 103, 117, 97,  103, 101, 97,  99,
-    99,  101, 112, 116, 45,  114, 97,  110, 103, 101, 115, 97,  99,  99,  101,
-    112, 116, 97,  99,  99,  101, 115, 115, 45,  99,  111, 110, 116, 114, 111,
-    108, 45,  97,  108, 108, 111, 119, 45,  111, 114, 105, 103, 105, 110, 97,
-    103, 101, 97,  108, 108, 111, 119, 97,  117, 116, 104, 111, 114, 105, 122,
-    97,  116, 105, 111, 110, 99,  97,  99,  104, 101, 45,  99,  111, 110, 116,
-    114, 111, 108, 99,  111, 110, 116, 101, 110, 116, 45,  100, 105, 115, 112,
-    111, 115, 105, 116, 105, 111, 110, 99,  111, 110, 116, 101, 110, 116, 45,
-    108, 97,  110, 103, 117, 97,  103, 101, 99,  111, 110, 116, 101, 110, 116,
-    45,  108, 101, 110, 103, 116, 104, 99,  111, 110, 116, 101, 110, 116, 45,
-    108, 111, 99,  97,  116, 105, 111, 110, 99,  111, 110, 116, 101, 110, 116,
-    45,  114, 97,  110, 103, 101, 99,  111, 111, 107, 105, 101, 100, 97,  116,
-    101, 101, 116, 97,  103, 101, 120, 112, 101, 99,  116, 101, 120, 112, 105,
-    114, 101, 115, 102, 114, 111, 109, 105, 102, 45,  109, 97,  116, 99,  104,
-    105, 102, 45,  109, 111, 100, 105, 102, 105, 101, 100, 45,  115, 105, 110,
-    99,  101, 105, 102, 45,  110, 111, 110, 101, 45,  109, 97,  116, 99,  104,
-    105, 102, 45,  114, 97,  110, 103, 101, 105, 102, 45,  117, 110, 109, 111,
-    100, 105, 102, 105, 101, 100, 45,  115, 105, 110, 99,  101, 108, 97,  115,
-    116, 45,  109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108,
-    111, 99,  97,  116, 105, 111, 110, 109, 97,  120, 45,  102, 111, 114, 119,
-    97,  114, 100, 115, 112, 114, 111, 120, 121, 45,  97,  117, 116, 104, 101,
-    110, 116, 105, 99,  97,  116, 101, 112, 114, 111, 120, 121, 45,  97,  117,
-    116, 104, 111, 114, 105, 122, 97,  116, 105, 111, 110, 114, 97,  110, 103,
-    101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104,
-    114, 101, 116, 114, 121, 45,  97,  102, 116, 101, 114, 115, 101, 114, 118,
-    101, 114, 115, 101, 116, 45,  99,  111, 111, 107, 105, 101, 115, 116, 114,
-    105, 99,  116, 45,  116, 114, 97,  110, 115, 112, 111, 114, 116, 45,  115,
-    101, 99,  117, 114, 105, 116, 121, 116, 114, 97,  110, 115, 102, 101, 114,
-    45,  101, 110, 99,  111, 100, 105, 110, 103, 118, 97,  114, 121, 118, 105,
-    97,  119, 119, 119, 45,  97,  117, 116, 104, 101, 110, 116, 105, 99,  97,
-    116, 101, 48,  105, 100, 101, 110, 116, 105, 116, 121, 116, 114, 97,  105,
-    108, 101, 114, 115, 97,  112, 112, 108, 105, 99,  97,  116, 105, 111, 110,
-    47,  103, 114, 112, 99,  103, 114, 112, 99,  80,  85,  84,  108, 98,  45,
-    99,  111, 115, 116, 45,  98,  105, 110, 105, 100, 101, 110, 116, 105, 116,
-    121, 44,  100, 101, 102, 108, 97,  116, 101, 105, 100, 101, 110, 116, 105,
-    116, 121, 44,  103, 122, 105, 112, 100, 101, 102, 108, 97,  116, 101, 44,
-    103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44,  100, 101,
-    102, 108, 97,  116, 101, 44,  103, 122, 105, 112};
+    101, 114, 45,  97,  103, 101, 110, 116, 104, 111, 115, 116, 103, 114, 112,
+    99,  45,  112, 114, 101, 118, 105, 111, 117, 115, 45,  114, 112, 99,  45,
+    97,  116, 116, 101, 109, 112, 116, 115, 103, 114, 112, 99,  45,  114, 101,
+    116, 114, 121, 45,  112, 117, 115, 104, 98,  97,  99,  107, 45,  109, 115,
+    120, 45,  101, 110, 100, 112, 111, 105, 110, 116, 45,  108, 111, 97,  100,
+    45,  109, 101, 116, 114, 105, 99,  115, 45,  98,  105, 110, 103, 114, 112,
+    99,  45,  116, 105, 109, 101, 111, 117, 116, 49,  50,  51,  52,  103, 114,
+    112, 99,  46,  119, 97,  105, 116, 95,  102, 111, 114, 95,  114, 101, 97,
+    100, 121, 103, 114, 112, 99,  46,  116, 105, 109, 101, 111, 117, 116, 103,
+    114, 112, 99,  46,  109, 97,  120, 95,  114, 101, 113, 117, 101, 115, 116,
+    95,  109, 101, 115, 115, 97,  103, 101, 95,  98,  121, 116, 101, 115, 103,
+    114, 112, 99,  46,  109, 97,  120, 95,  114, 101, 115, 112, 111, 110, 115,
+    101, 95,  109, 101, 115, 115, 97,  103, 101, 95,  98,  121, 116, 101, 115,
+    47,  103, 114, 112, 99,  46,  108, 98,  46,  118, 49,  46,  76,  111, 97,
+    100, 66,  97,  108, 97,  110, 99,  101, 114, 47,  66,  97,  108, 97,  110,
+    99,  101, 76,  111, 97,  100, 47,  101, 110, 118, 111, 121, 46,  115, 101,
+    114, 118, 105, 99,  101, 46,  108, 111, 97,  100, 95,  115, 116, 97,  116,
+    115, 46,  118, 50,  46,  76,  111, 97,  100, 82,  101, 112, 111, 114, 116,
+    105, 110, 103, 83,  101, 114, 118, 105, 99,  101, 47,  83,  116, 114, 101,
+    97,  109, 76,  111, 97,  100, 83,  116, 97,  116, 115, 47,  101, 110, 118,
+    111, 121, 46,  97,  112, 105, 46,  118, 50,  46,  69,  110, 100, 112, 111,
+    105, 110, 116, 68,  105, 115, 99,  111, 118, 101, 114, 121, 83,  101, 114,
+    118, 105, 99,  101, 47,  83,  116, 114, 101, 97,  109, 69,  110, 100, 112,
+    111, 105, 110, 116, 115, 47,  103, 114, 112, 99,  46,  104, 101, 97,  108,
+    116, 104, 46,  118, 49,  46,  72,  101, 97,  108, 116, 104, 47,  87,  97,
+    116, 99,  104, 47,  101, 110, 118, 111, 121, 46,  115, 101, 114, 118, 105,
+    99,  101, 46,  100, 105, 115, 99,  111, 118, 101, 114, 121, 46,  118, 50,
+    46,  65,  103, 103, 114, 101, 103, 97,  116, 101, 100, 68,  105, 115, 99,
+    111, 118, 101, 114, 121, 83,  101, 114, 118, 105, 99,  101, 47,  83,  116,
+    114, 101, 97,  109, 65,  103, 103, 114, 101, 103, 97,  116, 101, 100, 82,
+    101, 115, 111, 117, 114, 99,  101, 115, 100, 101, 102, 108, 97,  116, 101,
+    103, 122, 105, 112, 115, 116, 114, 101, 97,  109, 47,  103, 122, 105, 112,
+    71,  69,  84,  80,  79,  83,  84,  47,  47,  105, 110, 100, 101, 120, 46,
+    104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50,  48,
+    48,  50,  48,  52,  50,  48,  54,  51,  48,  52,  52,  48,  48,  52,  48,
+    52,  53,  48,  48,  97,  99,  99,  101, 112, 116, 45,  99,  104, 97,  114,
+    115, 101, 116, 103, 122, 105, 112, 44,  32,  100, 101, 102, 108, 97,  116,
+    101, 97,  99,  99,  101, 112, 116, 45,  108, 97,  110, 103, 117, 97,  103,
+    101, 97,  99,  99,  101, 112, 116, 45,  114, 97,  110, 103, 101, 115, 97,
+    99,  99,  101, 112, 116, 97,  99,  99,  101, 115, 115, 45,  99,  111, 110,
+    116, 114, 111, 108, 45,  97,  108, 108, 111, 119, 45,  111, 114, 105, 103,
+    105, 110, 97,  103, 101, 97,  108, 108, 111, 119, 97,  117, 116, 104, 111,
+    114, 105, 122, 97,  116, 105, 111, 110, 99,  97,  99,  104, 101, 45,  99,
+    111, 110, 116, 114, 111, 108, 99,  111, 110, 116, 101, 110, 116, 45,  100,
+    105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99,  111, 110, 116, 101,
+    110, 116, 45,  108, 97,  110, 103, 117, 97,  103, 101, 99,  111, 110, 116,
+    101, 110, 116, 45,  108, 101, 110, 103, 116, 104, 99,  111, 110, 116, 101,
+    110, 116, 45,  108, 111, 99,  97,  116, 105, 111, 110, 99,  111, 110, 116,
+    101, 110, 116, 45,  114, 97,  110, 103, 101, 99,  111, 111, 107, 105, 101,
+    100, 97,  116, 101, 101, 116, 97,  103, 101, 120, 112, 101, 99,  116, 101,
+    120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45,  109, 97,
+    116, 99,  104, 105, 102, 45,  109, 111, 100, 105, 102, 105, 101, 100, 45,
+    115, 105, 110, 99,  101, 105, 102, 45,  110, 111, 110, 101, 45,  109, 97,
+    116, 99,  104, 105, 102, 45,  114, 97,  110, 103, 101, 105, 102, 45,  117,
+    110, 109, 111, 100, 105, 102, 105, 101, 100, 45,  115, 105, 110, 99,  101,
+    108, 97,  115, 116, 45,  109, 111, 100, 105, 102, 105, 101, 100, 108, 105,
+    110, 107, 108, 111, 99,  97,  116, 105, 111, 110, 109, 97,  120, 45,  102,
+    111, 114, 119, 97,  114, 100, 115, 112, 114, 111, 120, 121, 45,  97,  117,
+    116, 104, 101, 110, 116, 105, 99,  97,  116, 101, 112, 114, 111, 120, 121,
+    45,  97,  117, 116, 104, 111, 114, 105, 122, 97,  116, 105, 111, 110, 114,
+    97,  110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114,
+    101, 115, 104, 114, 101, 116, 114, 121, 45,  97,  102, 116, 101, 114, 115,
+    101, 114, 118, 101, 114, 115, 101, 116, 45,  99,  111, 111, 107, 105, 101,
+    115, 116, 114, 105, 99,  116, 45,  116, 114, 97,  110, 115, 112, 111, 114,
+    116, 45,  115, 101, 99,  117, 114, 105, 116, 121, 116, 114, 97,  110, 115,
+    102, 101, 114, 45,  101, 110, 99,  111, 100, 105, 110, 103, 118, 97,  114,
+    121, 118, 105, 97,  119, 119, 119, 45,  97,  117, 116, 104, 101, 110, 116,
+    105, 99,  97,  116, 101, 48,  105, 100, 101, 110, 116, 105, 116, 121, 116,
+    114, 97,  105, 108, 101, 114, 115, 97,  112, 112, 108, 105, 99,  97,  116,
+    105, 111, 110, 47,  103, 114, 112, 99,  103, 114, 112, 99,  80,  85,  84,
+    108, 98,  45,  99,  111, 115, 116, 45,  98,  105, 110, 105, 100, 101, 110,
+    116, 105, 116, 121, 44,  100, 101, 102, 108, 97,  116, 101, 105, 100, 101,
+    110, 116, 105, 116, 121, 44,  103, 122, 105, 112, 100, 101, 102, 108, 97,
+    116, 101, 44,  103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121,
+    44,  100, 101, 102, 108, 97,  116, 101, 44,  103, 122, 105, 112};
 
-static grpc_slice_refcount static_sub_refcnt;
-grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-    grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC),
-};
+grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount;
+
+namespace grpc_core {
+struct StaticMetadataCtx {
+#ifndef NDEBUG
+  const uint64_t init_canary = kGrpcStaticMetadataInitCanary;
+#endif
+  StaticSliceRefcount refcounts[GRPC_STATIC_MDSTR_COUNT] = {
+
+      StaticSliceRefcount(0),   StaticSliceRefcount(1),
+      StaticSliceRefcount(2),   StaticSliceRefcount(3),
+      StaticSliceRefcount(4),   StaticSliceRefcount(5),
+      StaticSliceRefcount(6),   StaticSliceRefcount(7),
+      StaticSliceRefcount(8),   StaticSliceRefcount(9),
+      StaticSliceRefcount(10),  StaticSliceRefcount(11),
+      StaticSliceRefcount(12),  StaticSliceRefcount(13),
+      StaticSliceRefcount(14),  StaticSliceRefcount(15),
+      StaticSliceRefcount(16),  StaticSliceRefcount(17),
+      StaticSliceRefcount(18),  StaticSliceRefcount(19),
+      StaticSliceRefcount(20),  StaticSliceRefcount(21),
+      StaticSliceRefcount(22),  StaticSliceRefcount(23),
+      StaticSliceRefcount(24),  StaticSliceRefcount(25),
+      StaticSliceRefcount(26),  StaticSliceRefcount(27),
+      StaticSliceRefcount(28),  StaticSliceRefcount(29),
+      StaticSliceRefcount(30),  StaticSliceRefcount(31),
+      StaticSliceRefcount(32),  StaticSliceRefcount(33),
+      StaticSliceRefcount(34),  StaticSliceRefcount(35),
+      StaticSliceRefcount(36),  StaticSliceRefcount(37),
+      StaticSliceRefcount(38),  StaticSliceRefcount(39),
+      StaticSliceRefcount(40),  StaticSliceRefcount(41),
+      StaticSliceRefcount(42),  StaticSliceRefcount(43),
+      StaticSliceRefcount(44),  StaticSliceRefcount(45),
+      StaticSliceRefcount(46),  StaticSliceRefcount(47),
+      StaticSliceRefcount(48),  StaticSliceRefcount(49),
+      StaticSliceRefcount(50),  StaticSliceRefcount(51),
+      StaticSliceRefcount(52),  StaticSliceRefcount(53),
+      StaticSliceRefcount(54),  StaticSliceRefcount(55),
+      StaticSliceRefcount(56),  StaticSliceRefcount(57),
+      StaticSliceRefcount(58),  StaticSliceRefcount(59),
+      StaticSliceRefcount(60),  StaticSliceRefcount(61),
+      StaticSliceRefcount(62),  StaticSliceRefcount(63),
+      StaticSliceRefcount(64),  StaticSliceRefcount(65),
+      StaticSliceRefcount(66),  StaticSliceRefcount(67),
+      StaticSliceRefcount(68),  StaticSliceRefcount(69),
+      StaticSliceRefcount(70),  StaticSliceRefcount(71),
+      StaticSliceRefcount(72),  StaticSliceRefcount(73),
+      StaticSliceRefcount(74),  StaticSliceRefcount(75),
+      StaticSliceRefcount(76),  StaticSliceRefcount(77),
+      StaticSliceRefcount(78),  StaticSliceRefcount(79),
+      StaticSliceRefcount(80),  StaticSliceRefcount(81),
+      StaticSliceRefcount(82),  StaticSliceRefcount(83),
+      StaticSliceRefcount(84),  StaticSliceRefcount(85),
+      StaticSliceRefcount(86),  StaticSliceRefcount(87),
+      StaticSliceRefcount(88),  StaticSliceRefcount(89),
+      StaticSliceRefcount(90),  StaticSliceRefcount(91),
+      StaticSliceRefcount(92),  StaticSliceRefcount(93),
+      StaticSliceRefcount(94),  StaticSliceRefcount(95),
+      StaticSliceRefcount(96),  StaticSliceRefcount(97),
+      StaticSliceRefcount(98),  StaticSliceRefcount(99),
+      StaticSliceRefcount(100), StaticSliceRefcount(101),
+      StaticSliceRefcount(102), StaticSliceRefcount(103),
+      StaticSliceRefcount(104), StaticSliceRefcount(105),
+      StaticSliceRefcount(106), StaticSliceRefcount(107),
+      StaticSliceRefcount(108),
+  };
+
+  const StaticMetadataSlice slices[GRPC_STATIC_MDSTR_COUNT] = {
 
-const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
-    {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}},
-    {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}},
-    {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-    {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}},
-    {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}},
-    {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}},
-    {&grpc_static_metadata_refcounts[6], {{12, g_bytes + 38}}},
-    {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}},
-    {&grpc_static_metadata_refcounts[8], {{16, g_bytes + 61}}},
-    {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}},
-    {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-    {&grpc_static_metadata_refcounts[11], {{21, g_bytes + 110}}},
-    {&grpc_static_metadata_refcounts[12], {{13, g_bytes + 131}}},
-    {&grpc_static_metadata_refcounts[13], {{14, g_bytes + 144}}},
-    {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}},
-    {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}},
-    {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}},
-    {&grpc_static_metadata_refcounts[17], {{30, g_bytes + 201}}},
-    {&grpc_static_metadata_refcounts[18], {{37, g_bytes + 231}}},
-    {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}},
-    {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}},
-    {&grpc_static_metadata_refcounts[21], {{8, g_bytes + 282}}},
-    {&grpc_static_metadata_refcounts[22], {{26, g_bytes + 290}}},
-    {&grpc_static_metadata_refcounts[23], {{22, g_bytes + 316}}},
-    {&grpc_static_metadata_refcounts[24], {{12, g_bytes + 338}}},
-    {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 350}}},
-    {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 351}}},
-    {&grpc_static_metadata_refcounts[27], {{1, g_bytes + 352}}},
-    {&grpc_static_metadata_refcounts[28], {{1, g_bytes + 353}}},
-    {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}},
-    {&grpc_static_metadata_refcounts[30], {{19, g_bytes + 354}}},
-    {&grpc_static_metadata_refcounts[31], {{12, g_bytes + 373}}},
-    {&grpc_static_metadata_refcounts[32], {{30, g_bytes + 385}}},
-    {&grpc_static_metadata_refcounts[33], {{31, g_bytes + 415}}},
-    {&grpc_static_metadata_refcounts[34], {{36, g_bytes + 446}}},
-    {&grpc_static_metadata_refcounts[35], {{28, g_bytes + 482}}},
-    {&grpc_static_metadata_refcounts[36], {{80, g_bytes + 510}}},
-    {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}},
-    {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}},
-    {&grpc_static_metadata_refcounts[39], {{11, g_bytes + 601}}},
-    {&grpc_static_metadata_refcounts[40], {{3, g_bytes + 612}}},
-    {&grpc_static_metadata_refcounts[41], {{4, g_bytes + 615}}},
-    {&grpc_static_metadata_refcounts[42], {{1, g_bytes + 619}}},
-    {&grpc_static_metadata_refcounts[43], {{11, g_bytes + 620}}},
-    {&grpc_static_metadata_refcounts[44], {{4, g_bytes + 631}}},
-    {&grpc_static_metadata_refcounts[45], {{5, g_bytes + 635}}},
-    {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 640}}},
-    {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 643}}},
-    {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 646}}},
-    {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 649}}},
-    {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 652}}},
-    {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 655}}},
-    {&grpc_static_metadata_refcounts[52], {{3, g_bytes + 658}}},
-    {&grpc_static_metadata_refcounts[53], {{14, g_bytes + 661}}},
-    {&grpc_static_metadata_refcounts[54], {{13, g_bytes + 675}}},
-    {&grpc_static_metadata_refcounts[55], {{15, g_bytes + 688}}},
-    {&grpc_static_metadata_refcounts[56], {{13, g_bytes + 703}}},
-    {&grpc_static_metadata_refcounts[57], {{6, g_bytes + 716}}},
-    {&grpc_static_metadata_refcounts[58], {{27, g_bytes + 722}}},
-    {&grpc_static_metadata_refcounts[59], {{3, g_bytes + 749}}},
-    {&grpc_static_metadata_refcounts[60], {{5, g_bytes + 752}}},
-    {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 757}}},
-    {&grpc_static_metadata_refcounts[62], {{13, g_bytes + 770}}},
-    {&grpc_static_metadata_refcounts[63], {{19, g_bytes + 783}}},
-    {&grpc_static_metadata_refcounts[64], {{16, g_bytes + 802}}},
-    {&grpc_static_metadata_refcounts[65], {{14, g_bytes + 818}}},
-    {&grpc_static_metadata_refcounts[66], {{16, g_bytes + 832}}},
-    {&grpc_static_metadata_refcounts[67], {{13, g_bytes + 848}}},
-    {&grpc_static_metadata_refcounts[68], {{6, g_bytes + 861}}},
-    {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 867}}},
-    {&grpc_static_metadata_refcounts[70], {{4, g_bytes + 871}}},
-    {&grpc_static_metadata_refcounts[71], {{6, g_bytes + 875}}},
-    {&grpc_static_metadata_refcounts[72], {{7, g_bytes + 881}}},
-    {&grpc_static_metadata_refcounts[73], {{4, g_bytes + 888}}},
-    {&grpc_static_metadata_refcounts[74], {{8, g_bytes + 892}}},
-    {&grpc_static_metadata_refcounts[75], {{17, g_bytes + 900}}},
-    {&grpc_static_metadata_refcounts[76], {{13, g_bytes + 917}}},
-    {&grpc_static_metadata_refcounts[77], {{8, g_bytes + 930}}},
-    {&grpc_static_metadata_refcounts[78], {{19, g_bytes + 938}}},
-    {&grpc_static_metadata_refcounts[79], {{13, g_bytes + 957}}},
-    {&grpc_static_metadata_refcounts[80], {{4, g_bytes + 970}}},
-    {&grpc_static_metadata_refcounts[81], {{8, g_bytes + 974}}},
-    {&grpc_static_metadata_refcounts[82], {{12, g_bytes + 982}}},
-    {&grpc_static_metadata_refcounts[83], {{18, g_bytes + 994}}},
-    {&grpc_static_metadata_refcounts[84], {{19, g_bytes + 1012}}},
-    {&grpc_static_metadata_refcounts[85], {{5, g_bytes + 1031}}},
-    {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1036}}},
-    {&grpc_static_metadata_refcounts[87], {{7, g_bytes + 1043}}},
-    {&grpc_static_metadata_refcounts[88], {{11, g_bytes + 1050}}},
-    {&grpc_static_metadata_refcounts[89], {{6, g_bytes + 1061}}},
-    {&grpc_static_metadata_refcounts[90], {{10, g_bytes + 1067}}},
-    {&grpc_static_metadata_refcounts[91], {{25, g_bytes + 1077}}},
-    {&grpc_static_metadata_refcounts[92], {{17, g_bytes + 1102}}},
-    {&grpc_static_metadata_refcounts[93], {{4, g_bytes + 1119}}},
-    {&grpc_static_metadata_refcounts[94], {{3, g_bytes + 1123}}},
-    {&grpc_static_metadata_refcounts[95], {{16, g_bytes + 1126}}},
-    {&grpc_static_metadata_refcounts[96], {{1, g_bytes + 1142}}},
-    {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}},
-    {&grpc_static_metadata_refcounts[98], {{8, g_bytes + 1151}}},
-    {&grpc_static_metadata_refcounts[99], {{16, g_bytes + 1159}}},
-    {&grpc_static_metadata_refcounts[100], {{4, g_bytes + 1175}}},
-    {&grpc_static_metadata_refcounts[101], {{3, g_bytes + 1179}}},
-    {&grpc_static_metadata_refcounts[102], {{11, g_bytes + 1182}}},
-    {&grpc_static_metadata_refcounts[103], {{16, g_bytes + 1193}}},
-    {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}},
-    {&grpc_static_metadata_refcounts[105], {{12, g_bytes + 1222}}},
-    {&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}},
+      grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0),
+      grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5),
+      grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+      grpc_core::StaticMetadataSlice(&refcounts[3].base, 10, g_bytes + 19),
+      grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29),
+      grpc_core::StaticMetadataSlice(&refcounts[5].base, 2, g_bytes + 36),
+      grpc_core::StaticMetadataSlice(&refcounts[6].base, 12, g_bytes + 38),
+      grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50),
+      grpc_core::StaticMetadataSlice(&refcounts[8].base, 16, g_bytes + 61),
+      grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77),
+      grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+      grpc_core::StaticMetadataSlice(&refcounts[11].base, 21, g_bytes + 110),
+      grpc_core::StaticMetadataSlice(&refcounts[12].base, 13, g_bytes + 131),
+      grpc_core::StaticMetadataSlice(&refcounts[13].base, 14, g_bytes + 144),
+      grpc_core::StaticMetadataSlice(&refcounts[14].base, 12, g_bytes + 158),
+      grpc_core::StaticMetadataSlice(&refcounts[15].base, 16, g_bytes + 170),
+      grpc_core::StaticMetadataSlice(&refcounts[16].base, 15, g_bytes + 186),
+      grpc_core::StaticMetadataSlice(&refcounts[17].base, 30, g_bytes + 201),
+      grpc_core::StaticMetadataSlice(&refcounts[18].base, 37, g_bytes + 231),
+      grpc_core::StaticMetadataSlice(&refcounts[19].base, 10, g_bytes + 268),
+      grpc_core::StaticMetadataSlice(&refcounts[20].base, 4, g_bytes + 278),
+      grpc_core::StaticMetadataSlice(&refcounts[21].base, 26, g_bytes + 282),
+      grpc_core::StaticMetadataSlice(&refcounts[22].base, 22, g_bytes + 308),
+      grpc_core::StaticMetadataSlice(&refcounts[23].base, 27, g_bytes + 330),
+      grpc_core::StaticMetadataSlice(&refcounts[24].base, 12, g_bytes + 357),
+      grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 369),
+      grpc_core::StaticMetadataSlice(&refcounts[26].base, 1, g_bytes + 370),
+      grpc_core::StaticMetadataSlice(&refcounts[27].base, 1, g_bytes + 371),
+      grpc_core::StaticMetadataSlice(&refcounts[28].base, 1, g_bytes + 372),
+      grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+      grpc_core::StaticMetadataSlice(&refcounts[30].base, 19, g_bytes + 373),
+      grpc_core::StaticMetadataSlice(&refcounts[31].base, 12, g_bytes + 392),
+      grpc_core::StaticMetadataSlice(&refcounts[32].base, 30, g_bytes + 404),
+      grpc_core::StaticMetadataSlice(&refcounts[33].base, 31, g_bytes + 434),
+      grpc_core::StaticMetadataSlice(&refcounts[34].base, 36, g_bytes + 465),
+      grpc_core::StaticMetadataSlice(&refcounts[35].base, 65, g_bytes + 501),
+      grpc_core::StaticMetadataSlice(&refcounts[36].base, 54, g_bytes + 566),
+      grpc_core::StaticMetadataSlice(&refcounts[37].base, 28, g_bytes + 620),
+      grpc_core::StaticMetadataSlice(&refcounts[38].base, 80, g_bytes + 648),
+      grpc_core::StaticMetadataSlice(&refcounts[39].base, 7, g_bytes + 728),
+      grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735),
+      grpc_core::StaticMetadataSlice(&refcounts[41].base, 11, g_bytes + 739),
+      grpc_core::StaticMetadataSlice(&refcounts[42].base, 3, g_bytes + 750),
+      grpc_core::StaticMetadataSlice(&refcounts[43].base, 4, g_bytes + 753),
+      grpc_core::StaticMetadataSlice(&refcounts[44].base, 1, g_bytes + 757),
+      grpc_core::StaticMetadataSlice(&refcounts[45].base, 11, g_bytes + 758),
+      grpc_core::StaticMetadataSlice(&refcounts[46].base, 4, g_bytes + 769),
+      grpc_core::StaticMetadataSlice(&refcounts[47].base, 5, g_bytes + 773),
+      grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 778),
+      grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 781),
+      grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 784),
+      grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 787),
+      grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 790),
+      grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 793),
+      grpc_core::StaticMetadataSlice(&refcounts[54].base, 3, g_bytes + 796),
+      grpc_core::StaticMetadataSlice(&refcounts[55].base, 14, g_bytes + 799),
+      grpc_core::StaticMetadataSlice(&refcounts[56].base, 13, g_bytes + 813),
+      grpc_core::StaticMetadataSlice(&refcounts[57].base, 15, g_bytes + 826),
+      grpc_core::StaticMetadataSlice(&refcounts[58].base, 13, g_bytes + 841),
+      grpc_core::StaticMetadataSlice(&refcounts[59].base, 6, g_bytes + 854),
+      grpc_core::StaticMetadataSlice(&refcounts[60].base, 27, g_bytes + 860),
+      grpc_core::StaticMetadataSlice(&refcounts[61].base, 3, g_bytes + 887),
+      grpc_core::StaticMetadataSlice(&refcounts[62].base, 5, g_bytes + 890),
+      grpc_core::StaticMetadataSlice(&refcounts[63].base, 13, g_bytes + 895),
+      grpc_core::StaticMetadataSlice(&refcounts[64].base, 13, g_bytes + 908),
+      grpc_core::StaticMetadataSlice(&refcounts[65].base, 19, g_bytes + 921),
+      grpc_core::StaticMetadataSlice(&refcounts[66].base, 16, g_bytes + 940),
+      grpc_core::StaticMetadataSlice(&refcounts[67].base, 14, g_bytes + 956),
+      grpc_core::StaticMetadataSlice(&refcounts[68].base, 16, g_bytes + 970),
+      grpc_core::StaticMetadataSlice(&refcounts[69].base, 13, g_bytes + 986),
+      grpc_core::StaticMetadataSlice(&refcounts[70].base, 6, g_bytes + 999),
+      grpc_core::StaticMetadataSlice(&refcounts[71].base, 4, g_bytes + 1005),
+      grpc_core::StaticMetadataSlice(&refcounts[72].base, 4, g_bytes + 1009),
+      grpc_core::StaticMetadataSlice(&refcounts[73].base, 6, g_bytes + 1013),
+      grpc_core::StaticMetadataSlice(&refcounts[74].base, 7, g_bytes + 1019),
+      grpc_core::StaticMetadataSlice(&refcounts[75].base, 4, g_bytes + 1026),
+      grpc_core::StaticMetadataSlice(&refcounts[76].base, 8, g_bytes + 1030),
+      grpc_core::StaticMetadataSlice(&refcounts[77].base, 17, g_bytes + 1038),
+      grpc_core::StaticMetadataSlice(&refcounts[78].base, 13, g_bytes + 1055),
+      grpc_core::StaticMetadataSlice(&refcounts[79].base, 8, g_bytes + 1068),
+      grpc_core::StaticMetadataSlice(&refcounts[80].base, 19, g_bytes + 1076),
+      grpc_core::StaticMetadataSlice(&refcounts[81].base, 13, g_bytes + 1095),
+      grpc_core::StaticMetadataSlice(&refcounts[82].base, 4, g_bytes + 1108),
+      grpc_core::StaticMetadataSlice(&refcounts[83].base, 8, g_bytes + 1112),
+      grpc_core::StaticMetadataSlice(&refcounts[84].base, 12, g_bytes + 1120),
+      grpc_core::StaticMetadataSlice(&refcounts[85].base, 18, g_bytes + 1132),
+      grpc_core::StaticMetadataSlice(&refcounts[86].base, 19, g_bytes + 1150),
+      grpc_core::StaticMetadataSlice(&refcounts[87].base, 5, g_bytes + 1169),
+      grpc_core::StaticMetadataSlice(&refcounts[88].base, 7, g_bytes + 1174),
+      grpc_core::StaticMetadataSlice(&refcounts[89].base, 7, g_bytes + 1181),
+      grpc_core::StaticMetadataSlice(&refcounts[90].base, 11, g_bytes + 1188),
+      grpc_core::StaticMetadataSlice(&refcounts[91].base, 6, g_bytes + 1199),
+      grpc_core::StaticMetadataSlice(&refcounts[92].base, 10, g_bytes + 1205),
+      grpc_core::StaticMetadataSlice(&refcounts[93].base, 25, g_bytes + 1215),
+      grpc_core::StaticMetadataSlice(&refcounts[94].base, 17, g_bytes + 1240),
+      grpc_core::StaticMetadataSlice(&refcounts[95].base, 4, g_bytes + 1257),
+      grpc_core::StaticMetadataSlice(&refcounts[96].base, 3, g_bytes + 1261),
+      grpc_core::StaticMetadataSlice(&refcounts[97].base, 16, g_bytes + 1264),
+      grpc_core::StaticMetadataSlice(&refcounts[98].base, 1, g_bytes + 1280),
+      grpc_core::StaticMetadataSlice(&refcounts[99].base, 8, g_bytes + 1281),
+      grpc_core::StaticMetadataSlice(&refcounts[100].base, 8, g_bytes + 1289),
+      grpc_core::StaticMetadataSlice(&refcounts[101].base, 16, g_bytes + 1297),
+      grpc_core::StaticMetadataSlice(&refcounts[102].base, 4, g_bytes + 1313),
+      grpc_core::StaticMetadataSlice(&refcounts[103].base, 3, g_bytes + 1317),
+      grpc_core::StaticMetadataSlice(&refcounts[104].base, 11, g_bytes + 1320),
+      grpc_core::StaticMetadataSlice(&refcounts[105].base, 16, g_bytes + 1331),
+      grpc_core::StaticMetadataSlice(&refcounts[106].base, 13, g_bytes + 1347),
+      grpc_core::StaticMetadataSlice(&refcounts[107].base, 12, g_bytes + 1360),
+      grpc_core::StaticMetadataSlice(&refcounts[108].base, 21, g_bytes + 1372),
+  };
+  StaticMetadata static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[3].base, 10, g_bytes + 19),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          0),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5),
+          grpc_core::StaticMetadataSlice(&refcounts[42].base, 3, g_bytes + 750),
+          1),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5),
+          grpc_core::StaticMetadataSlice(&refcounts[43].base, 4, g_bytes + 753),
+          2),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0),
+          grpc_core::StaticMetadataSlice(&refcounts[44].base, 1, g_bytes + 757),
+          3),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[0].base, 5, g_bytes + 0),
+          grpc_core::StaticMetadataSlice(&refcounts[45].base, 11,
+                                         g_bytes + 758),
+          4),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29),
+          grpc_core::StaticMetadataSlice(&refcounts[46].base, 4, g_bytes + 769),
+          5),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29),
+          grpc_core::StaticMetadataSlice(&refcounts[47].base, 5, g_bytes + 773),
+          6),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[48].base, 3, g_bytes + 778),
+          7),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[49].base, 3, g_bytes + 781),
+          8),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[50].base, 3, g_bytes + 784),
+          9),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[51].base, 3, g_bytes + 787),
+          10),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[52].base, 3, g_bytes + 790),
+          11),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[53].base, 3, g_bytes + 793),
+          12),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[2].base, 7, g_bytes + 12),
+          grpc_core::StaticMetadataSlice(&refcounts[54].base, 3, g_bytes + 796),
+          13),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[55].base, 14,
+                                         g_bytes + 799),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          14),
+      StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15,
+                                                    g_bytes + 186),
+                     grpc_core::StaticMetadataSlice(&refcounts[56].base, 13,
+                                                    g_bytes + 813),
+                     15),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[57].base, 15,
+                                         g_bytes + 826),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          16),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[58].base, 13,
+                                         g_bytes + 841),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          17),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[59].base, 6, g_bytes + 854),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          18),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[60].base, 27,
+                                         g_bytes + 860),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          19),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[61].base, 3, g_bytes + 887),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          20),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[62].base, 5, g_bytes + 890),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          21),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[63].base, 13,
+                                         g_bytes + 895),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          22),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[64].base, 13,
+                                         g_bytes + 908),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          23),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[65].base, 19,
+                                         g_bytes + 921),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          24),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[15].base, 16,
+                                         g_bytes + 170),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          25),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[66].base, 16,
+                                         g_bytes + 940),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          26),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[67].base, 14,
+                                         g_bytes + 956),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          27),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[68].base, 16,
+                                         g_bytes + 970),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          28),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[69].base, 13,
+                                         g_bytes + 986),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          29),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[14].base, 12,
+                                         g_bytes + 158),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          30),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[70].base, 6, g_bytes + 999),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          31),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[71].base, 4,
+                                         g_bytes + 1005),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          32),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[72].base, 4,
+                                         g_bytes + 1009),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          33),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[73].base, 6,
+                                         g_bytes + 1013),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          34),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[74].base, 7,
+                                         g_bytes + 1019),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          35),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[75].base, 4,
+                                         g_bytes + 1026),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          36),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[20].base, 4, g_bytes + 278),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          37),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[76].base, 8,
+                                         g_bytes + 1030),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          38),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[77].base, 17,
+                                         g_bytes + 1038),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          39),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[78].base, 13,
+                                         g_bytes + 1055),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          40),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[79].base, 8,
+                                         g_bytes + 1068),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          41),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[80].base, 19,
+                                         g_bytes + 1076),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          42),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[81].base, 13,
+                                         g_bytes + 1095),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          43),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[82].base, 4,
+                                         g_bytes + 1108),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          44),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[83].base, 8,
+                                         g_bytes + 1112),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          45),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[84].base, 12,
+                                         g_bytes + 1120),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          46),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[85].base, 18,
+                                         g_bytes + 1132),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          47),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[86].base, 19,
+                                         g_bytes + 1150),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          48),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[87].base, 5,
+                                         g_bytes + 1169),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          49),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[88].base, 7,
+                                         g_bytes + 1174),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          50),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[89].base, 7,
+                                         g_bytes + 1181),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          51),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[90].base, 11,
+                                         g_bytes + 1188),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          52),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[91].base, 6,
+                                         g_bytes + 1199),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          53),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[92].base, 10,
+                                         g_bytes + 1205),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          54),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[93].base, 25,
+                                         g_bytes + 1215),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          55),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[94].base, 17,
+                                         g_bytes + 1240),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          56),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[19].base, 10,
+                                         g_bytes + 268),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          57),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[95].base, 4,
+                                         g_bytes + 1257),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          58),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[96].base, 3,
+                                         g_bytes + 1261),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          59),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[97].base, 16,
+                                         g_bytes + 1264),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          60),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50),
+          grpc_core::StaticMetadataSlice(&refcounts[98].base, 1,
+                                         g_bytes + 1280),
+          61),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50),
+          grpc_core::StaticMetadataSlice(&refcounts[25].base, 1, g_bytes + 369),
+          62),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[7].base, 11, g_bytes + 50),
+          grpc_core::StaticMetadataSlice(&refcounts[26].base, 1, g_bytes + 370),
+          63),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77),
+          grpc_core::StaticMetadataSlice(&refcounts[99].base, 8,
+                                         g_bytes + 1281),
+          64),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77),
+          grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735),
+          65),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[9].base, 13, g_bytes + 77),
+          grpc_core::StaticMetadataSlice(&refcounts[39].base, 7, g_bytes + 728),
+          66),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[5].base, 2, g_bytes + 36),
+          grpc_core::StaticMetadataSlice(&refcounts[100].base, 8,
+                                         g_bytes + 1289),
+          67),
+      StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[14].base, 12,
+                                                    g_bytes + 158),
+                     grpc_core::StaticMetadataSlice(&refcounts[101].base, 16,
+                                                    g_bytes + 1297),
+                     68),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[4].base, 7, g_bytes + 29),
+          grpc_core::StaticMetadataSlice(&refcounts[102].base, 4,
+                                         g_bytes + 1313),
+          69),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[1].base, 7, g_bytes + 5),
+          grpc_core::StaticMetadataSlice(&refcounts[103].base, 3,
+                                         g_bytes + 1317),
+          70),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[16].base, 15,
+                                         g_bytes + 186),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          71),
+      StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[15].base, 16,
+                                                    g_bytes + 170),
+                     grpc_core::StaticMetadataSlice(&refcounts[99].base, 8,
+                                                    g_bytes + 1281),
+                     72),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[15].base, 16,
+                                         g_bytes + 170),
+          grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735),
+          73),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[104].base, 11,
+                                         g_bytes + 1320),
+          grpc_core::StaticMetadataSlice(&refcounts[29].base, 0, g_bytes + 373),
+          74),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[99].base, 8,
+                                         g_bytes + 1281),
+          75),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[39].base, 7, g_bytes + 728),
+          76),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[105].base, 16,
+                                         g_bytes + 1331),
+          77),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735),
+          78),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[106].base, 13,
+                                         g_bytes + 1347),
+          79),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[107].base, 12,
+                                         g_bytes + 1360),
+          80),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[10].base, 20, g_bytes + 90),
+          grpc_core::StaticMetadataSlice(&refcounts[108].base, 21,
+                                         g_bytes + 1372),
+          81),
+      StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15,
+                                                    g_bytes + 186),
+                     grpc_core::StaticMetadataSlice(&refcounts[99].base, 8,
+                                                    g_bytes + 1281),
+                     82),
+      StaticMetadata(
+          grpc_core::StaticMetadataSlice(&refcounts[16].base, 15,
+                                         g_bytes + 186),
+          grpc_core::StaticMetadataSlice(&refcounts[40].base, 4, g_bytes + 735),
+          83),
+      StaticMetadata(grpc_core::StaticMetadataSlice(&refcounts[16].base, 15,
+                                                    g_bytes + 186),
+                     grpc_core::StaticMetadataSlice(&refcounts[106].base, 13,
+                                                    g_bytes + 1347),
+                     84),
+  };
+
+  /* Warning: the core static metadata currently operates under the soft
+  constraint that the first GRPC_CHTTP2_LAST_STATIC_ENTRY (61) entries must
+  contain metadata specified by the http2 hpack standard. The CHTTP2 transport
+  reads the core metadata with this assumption in mind. If the order of the core
+  static metadata is to be changed, then the CHTTP2 transport must be changed as
+  well to stop relying on the core metadata. */
+
+  grpc_mdelem static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = {
+      // clang-format off
+    /* GRPC_MDELEM_AUTHORITY_EMPTY: 
+     ":authority": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[0].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_METHOD_GET: 
+     ":method": "GET" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[1].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_METHOD_POST: 
+     ":method": "POST" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[2].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_PATH_SLASH: 
+     ":path": "/" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[3].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML: 
+     ":path": "/index.html" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[4].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_SCHEME_HTTP: 
+     ":scheme": "http" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[5].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_SCHEME_HTTPS: 
+     ":scheme": "https" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[6].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_200: 
+     ":status": "200" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[7].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_204: 
+     ":status": "204" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[8].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_206: 
+     ":status": "206" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[9].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_304: 
+     ":status": "304" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[10].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_400: 
+     ":status": "400" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[11].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_404: 
+     ":status": "404" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[12].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STATUS_500: 
+     ":status": "500" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[13].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_CHARSET_EMPTY: 
+     "accept-charset": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[14].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE: 
+     "accept-encoding": "gzip, deflate" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[15].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY: 
+     "accept-language": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[16].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_RANGES_EMPTY: 
+     "accept-ranges": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[17].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_EMPTY: 
+     "accept": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[18].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY: 
+     "access-control-allow-origin": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[19].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_AGE_EMPTY: 
+     "age": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[20].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ALLOW_EMPTY: 
+     "allow": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[21].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_AUTHORIZATION_EMPTY: 
+     "authorization": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[22].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CACHE_CONTROL_EMPTY: 
+     "cache-control": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[23].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY: 
+     "content-disposition": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[24].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_ENCODING_EMPTY: 
+     "content-encoding": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[25].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY: 
+     "content-language": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[26].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_LENGTH_EMPTY: 
+     "content-length": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[27].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_LOCATION_EMPTY: 
+     "content-location": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[28].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_RANGE_EMPTY: 
+     "content-range": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[29].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_TYPE_EMPTY: 
+     "content-type": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[30].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_COOKIE_EMPTY: 
+     "cookie": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[31].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_DATE_EMPTY: 
+     "date": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[32].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ETAG_EMPTY: 
+     "etag": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[33].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_EXPECT_EMPTY: 
+     "expect": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[34].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_EXPIRES_EMPTY: 
+     "expires": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[35].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_FROM_EMPTY: 
+     "from": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[36].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_HOST_EMPTY: 
+     "host": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[37].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_IF_MATCH_EMPTY: 
+     "if-match": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[38].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY: 
+     "if-modified-since": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[39].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_IF_NONE_MATCH_EMPTY: 
+     "if-none-match": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[40].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_IF_RANGE_EMPTY: 
+     "if-range": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[41].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY: 
+     "if-unmodified-since": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[42].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_LAST_MODIFIED_EMPTY: 
+     "last-modified": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[43].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_LINK_EMPTY: 
+     "link": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[44].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_LOCATION_EMPTY: 
+     "location": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[45].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_MAX_FORWARDS_EMPTY: 
+     "max-forwards": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[46].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY: 
+     "proxy-authenticate": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[47].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY: 
+     "proxy-authorization": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[48].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_RANGE_EMPTY: 
+     "range": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[49].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_REFERER_EMPTY: 
+     "referer": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[50].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_REFRESH_EMPTY: 
+     "refresh": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[51].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_RETRY_AFTER_EMPTY: 
+     "retry-after": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[52].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_SERVER_EMPTY: 
+     "server": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[53].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_SET_COOKIE_EMPTY: 
+     "set-cookie": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[54].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY: 
+     "strict-transport-security": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[55].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_TRANSFER_ENCODING_EMPTY: 
+     "transfer-encoding": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[56].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_USER_AGENT_EMPTY: 
+     "user-agent": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[57].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_VARY_EMPTY: 
+     "vary": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[58].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_VIA_EMPTY: 
+     "via": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[59].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY: 
+     "www-authenticate": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[60].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_STATUS_0: 
+     "grpc-status": "0" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[61].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_STATUS_1: 
+     "grpc-status": "1" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[62].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_STATUS_2: 
+     "grpc-status": "2" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[63].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ENCODING_IDENTITY: 
+     "grpc-encoding": "identity" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[64].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ENCODING_GZIP: 
+     "grpc-encoding": "gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[65].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ENCODING_DEFLATE: 
+     "grpc-encoding": "deflate" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[66].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_TE_TRAILERS: 
+     "te": "trailers" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[67].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC: 
+     "content-type": "application/grpc" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[68].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_SCHEME_GRPC: 
+     ":scheme": "grpc" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[69].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_METHOD_PUT: 
+     ":method": "PUT" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[70].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_ENCODING_EMPTY: 
+     "accept-encoding": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[71].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_ENCODING_IDENTITY: 
+     "content-encoding": "identity" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[72].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_CONTENT_ENCODING_GZIP: 
+     "content-encoding": "gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[73].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_LB_COST_BIN_EMPTY: 
+     "lb-cost-bin": "" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[74].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY: 
+     "grpc-accept-encoding": "identity" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[75].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE: 
+     "grpc-accept-encoding": "deflate" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[76].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE: 
+     "grpc-accept-encoding": "identity,deflate" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[77].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP: 
+     "grpc-accept-encoding": "gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[78].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: 
+     "grpc-accept-encoding": "identity,gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[79].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP: 
+     "grpc-accept-encoding": "deflate,gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[80].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP: 
+     "grpc-accept-encoding": "identity,deflate,gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[81].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY: 
+     "accept-encoding": "identity" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[82].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_ENCODING_GZIP: 
+     "accept-encoding": "gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[83].data(),
+        GRPC_MDELEM_STORAGE_STATIC),
+    /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: 
+     "accept-encoding": "identity,gzip" */
+    GRPC_MAKE_MDELEM(
+        &static_mdelem_table[84].data(),
+        GRPC_MDELEM_STORAGE_STATIC)
+      // clang-format on
+  };
 };
+}  // namespace grpc_core
+
+namespace grpc_core {
+static StaticMetadataCtx* g_static_metadata_slice_ctx = nullptr;
+const StaticMetadataSlice* g_static_metadata_slice_table = nullptr;
+StaticSliceRefcount* g_static_metadata_slice_refcounts = nullptr;
+StaticMetadata* g_static_mdelem_table = nullptr;
+grpc_mdelem* g_static_mdelem_manifested = nullptr;
+#ifndef NDEBUG
+uint64_t StaticMetadataInitCanary() {
+  return g_static_metadata_slice_ctx->init_canary;
+}
+#endif
+}  // namespace grpc_core
+
+void grpc_init_static_metadata_ctx(void) {
+  grpc_core::g_static_metadata_slice_ctx =
+      grpc_core::New<grpc_core::StaticMetadataCtx>();
+  grpc_core::g_static_metadata_slice_table =
+      grpc_core::g_static_metadata_slice_ctx->slices;
+  grpc_core::g_static_metadata_slice_refcounts =
+      grpc_core::g_static_metadata_slice_ctx->refcounts;
+  grpc_core::g_static_mdelem_table =
+      grpc_core::g_static_metadata_slice_ctx->static_mdelem_table;
+  grpc_core::g_static_mdelem_manifested =
+      grpc_core::g_static_metadata_slice_ctx->static_mdelem_manifested;
+}
+
+void grpc_destroy_static_metadata_ctx(void) {
+  grpc_core::Delete<grpc_core::StaticMetadataCtx>(
+      grpc_core::g_static_metadata_slice_ctx);
+  grpc_core::g_static_metadata_slice_ctx = nullptr;
+  grpc_core::g_static_metadata_slice_table = nullptr;
+  grpc_core::g_static_metadata_slice_refcounts = nullptr;
+  grpc_core::g_static_mdelem_table = nullptr;
+  grpc_core::g_static_mdelem_manifested = nullptr;
+}
 
 uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4};
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4};
 
 static const int8_t elems_r[] = {
-    15, 10,  -8, 0,  2,  -42, -81, -43, 0,   6,  -8,  0,   0,   0,   2,
-    -3, -10, 0,  0,  1,  0,   -1,  0,   0,   0,  0,   0,   0,   0,   0,
-    0,  0,   0,  0,  0,  0,   0,   0,   0,   0,  0,   0,   0,   0,   0,
-    0,  0,   0,  0,  0,  0,   0,   0,   -64, 0,  -67, -68, -69, -70, 0,
-    35, 34,  33, 32, 31, 30,  29,  28,  27,  26, 25,  24,  23,  22,  21,
-    20, 19,  18, 17, 16, 15,  14,  13,  12,  11, 10,  9,   8,   7,   6,
-    5,  4,   5,  4,  4,  8,   8,   0,   0,   0,  0,   0,   0,   -5,  0};
+    15, 10, -8, 0,  2,  -43, -81, -44, 0,  4,   -8,  0,   0,   0,  6,  -1,
+    -8, 0,  0,  3,  2,  0,   0,   0,   0,  0,   0,   0,   0,   0,  0,  0,
+    0,  0,  0,  0,  0,  0,   0,   0,   0,  0,   0,   0,   0,   0,  0,  0,
+    0,  0,  0,  0,  0,  0,   0,   -67, 0,  -38, -50, -56, -76, 0,  46, 28,
+    27, 26, 25, 24, 23, 23,  22,  21,  20, 19,  24,  16,  15,  14, 13, 15,
+    14, 14, 13, 12, 11, 10,  9,   8,   7,  6,   6,   5,   4,   3,  2,  3,
+    2,  2,  6,  0,  0,  0,   0,   0,   0,  -6,  0};
 static uint32_t elems_phash(uint32_t i) {
-  i -= 42;
-  uint32_t x = i % 105;
-  uint32_t y = i / 105;
+  i -= 44;
+  uint32_t x = i % 107;
+  uint32_t y = i / 107;
   uint32_t h = x;
   if (y < GPR_ARRAY_SIZE(elems_r)) {
     uint32_t delta = (uint32_t)elems_r[y];
@@ -364,298 +1209,36 @@ static uint32_t elems_phash(uint32_t i) {
 }
 
 static const uint16_t elem_keys[] = {
-    260,  261,  262,  263,  264,  265,  266,   1107, 1108,  1741,  147,  148,
-    472,  473,  1634, 42,   43,   1527, 1750,  1000, 1001,  774,   775,  1643,
-    633,  845,  2062, 2169, 2276, 5700, 5914,  6021, 6128,  6235,  1766, 6342,
-    6449, 6556, 6663, 6770, 6877, 6984, 7091,  7198, 7305,  7412,  7519, 7626,
-    7733, 7840, 7947, 8054, 8161, 8268, 8375,  8482, 8589,  8696,  8803, 8910,
-    9017, 9124, 9231, 9338, 9445, 9552, 9659,  1167, 528,   9766,  9873, 208,
-    9980, 1173, 1174, 1175, 1176, 1809, 10087, 1060, 10194, 10943, 1702, 0,
-    1816, 0,    0,    1597, 0,    0,    350,   0,    0,     0,     0,    0,
-    0,    0,    0,    0,    0,    0,    0,     0,    0,     0,     0,    0,
-    0,    0,    0,    0,    0,    0,    0,     0,    0,     0,     0,    0,
-    0,    0,    0,    0,    0,    0,    0,     0,    0,     0,     0,    0,
-    0,    0,    0,    0,    0,    0,    0};
+    266,   267,   268,  269,   270,   271,  272,   1129, 1130, 1773, 151,
+    152,   482,   483,  1664,  44,    45,   1020,  1021, 1555, 1784, 788,
+    789,   645,   861,  1675,  2100,  2209, 6024,  6569, 6787, 6896, 7005,
+    7114,  7223,  7332, 1800,  7441,  7550, 7659,  7768, 7877, 8095, 8204,
+    8313,  8422,  6678, 6460,  7986,  8531, 8640,  6351, 8749, 8858, 8967,
+    9076,  9185,  9294, 9403,  9512,  9621, 6242,  9730, 9839, 9948, 10057,
+    10166, 1189,  538,  10275, 10384, 212,  10493, 1195, 1196, 1197, 1198,
+    1080,  10602, 1843, 11365, 0,     0,    0,     1734, 0,    1850, 0,
+    0,     0,     356,  1627};
 static const uint8_t elem_idxs[] = {
-    7,  8,  9,  10,  11, 12,  13,  77, 79,  71,  1,  2,  5,  6,  25, 3,
-    4,  30, 84, 66,  65, 62,  63,  73, 67,  61,  57, 37, 74, 14, 16, 17,
-    18, 19, 15, 20,  21, 22,  23,  24, 26,  27,  28, 29, 31, 32, 33, 34,
-    35, 36, 38, 39,  40, 41,  42,  43, 44,  45,  46, 47, 48, 49, 50, 51,
-    52, 53, 54, 76,  69, 55,  56,  70, 58,  78,  80, 81, 82, 83, 59, 64,
-    60, 75, 72, 255, 85, 255, 255, 68, 255, 255, 0};
+    7,  8,   9,   10,  11, 12,  13, 76,  78,  71,  1,  2,  5,  6,  25, 3,
+    4,  66,  65,  30,  83, 62,  63, 67,  61,  73,  57, 37, 14, 19, 21, 22,
+    23, 24,  26,  27,  15, 28,  29, 31,  32,  33,  35, 36, 38, 39, 20, 18,
+    34, 40,  41,  17,  42, 43,  44, 45,  46,  47,  48, 49, 50, 16, 51, 52,
+    53, 54,  55,  75,  69, 56,  58, 70,  59,  77,  79, 80, 81, 64, 60, 82,
+    74, 255, 255, 255, 72, 255, 84, 255, 255, 255, 0,  68};
 
 grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) {
   if (a == -1 || b == -1) return GRPC_MDNULL;
-  uint32_t k = static_cast<uint32_t>(a * 107 + b);
+  uint32_t k = static_cast<uint32_t>(a * 109 + b);
   uint32_t h = elems_phash(k);
   return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k &&
                  elem_idxs[h] != 255
-             ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]].data(),
-                                GRPC_MDELEM_STORAGE_STATIC)
+             ? GRPC_MAKE_MDELEM(
+                   &grpc_static_mdelem_table()[elem_idxs[h]].data(),
+                   GRPC_MDELEM_STORAGE_STATIC)
              : GRPC_MDNULL;
 }
 
-grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}},
-        {&grpc_static_metadata_refcounts[40], {{3, g_bytes + 612}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}},
-        {&grpc_static_metadata_refcounts[41], {{4, g_bytes + 615}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}},
-        {&grpc_static_metadata_refcounts[42], {{1, g_bytes + 619}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}},
-        {&grpc_static_metadata_refcounts[43], {{11, g_bytes + 620}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}},
-        {&grpc_static_metadata_refcounts[44], {{4, g_bytes + 631}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}},
-        {&grpc_static_metadata_refcounts[45], {{5, g_bytes + 635}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 640}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 643}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 646}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 649}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 652}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 655}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}},
-        {&grpc_static_metadata_refcounts[52], {{3, g_bytes + 658}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[53], {{14, g_bytes + 661}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}},
-        {&grpc_static_metadata_refcounts[54], {{13, g_bytes + 675}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[55], {{15, g_bytes + 688}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[56], {{13, g_bytes + 703}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[57], {{6, g_bytes + 716}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[58], {{27, g_bytes + 722}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[59], {{3, g_bytes + 749}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[60], {{5, g_bytes + 752}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 757}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[62], {{13, g_bytes + 770}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[63], {{19, g_bytes + 783}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[64], {{16, g_bytes + 802}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[65], {{14, g_bytes + 818}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[66], {{16, g_bytes + 832}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[67], {{13, g_bytes + 848}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[68], {{6, g_bytes + 861}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 867}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[70], {{4, g_bytes + 871}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[71], {{6, g_bytes + 875}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[72], {{7, g_bytes + 881}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[73], {{4, g_bytes + 888}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[74], {{8, g_bytes + 892}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[75], {{17, g_bytes + 900}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[76], {{13, g_bytes + 917}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[77], {{8, g_bytes + 930}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[78], {{19, g_bytes + 938}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[79], {{13, g_bytes + 957}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[80], {{4, g_bytes + 970}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[81], {{8, g_bytes + 974}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[82], {{12, g_bytes + 982}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[83], {{18, g_bytes + 994}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[84], {{19, g_bytes + 1012}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[85], {{5, g_bytes + 1031}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1036}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[87], {{7, g_bytes + 1043}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[88], {{11, g_bytes + 1050}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[89], {{6, g_bytes + 1061}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[90], {{10, g_bytes + 1067}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[91], {{25, g_bytes + 1077}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[92], {{17, g_bytes + 1102}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[93], {{4, g_bytes + 1119}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[94], {{3, g_bytes + 1123}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[95], {{16, g_bytes + 1126}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}},
-        {&grpc_static_metadata_refcounts[96], {{1, g_bytes + 1142}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}},
-        {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 350}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}},
-        {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 351}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}},
-        {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}},
-        {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}},
-        {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}},
-        {&grpc_static_metadata_refcounts[98], {{8, g_bytes + 1151}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}},
-        {&grpc_static_metadata_refcounts[99], {{16, g_bytes + 1159}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}},
-        {&grpc_static_metadata_refcounts[100], {{4, g_bytes + 1175}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}},
-        {&grpc_static_metadata_refcounts[101], {{3, g_bytes + 1179}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}},
-        {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}},
-        {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[21], {{8, g_bytes + 282}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[102], {{11, g_bytes + 1182}}},
-        {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[103], {{16, g_bytes + 1193}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[105], {{12, g_bytes + 1222}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}},
-        {&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}},
-        {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}},
-        {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}),
-    grpc_core::StaticMetadata(
-        {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}},
-        {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}),
-};
-const uint8_t grpc_static_accept_encoding_metadata[8] = {0,  76, 77, 78,
-                                                         79, 80, 81, 82};
+const uint8_t grpc_static_accept_encoding_metadata[8] = {0,  75, 76, 77,
+                                                         78, 79, 80, 81};
 
-const uint8_t grpc_static_accept_stream_encoding_metadata[4] = {0, 83, 84, 85};
+const uint8_t grpc_static_accept_stream_encoding_metadata[4] = {0, 82, 83, 84};
index 800ee04..391c6a7 100644 (file)
 
 #include "src/core/lib/transport/metadata.h"
 
-#define GRPC_STATIC_MDSTR_COUNT 107
-extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
+static_assert(
+    std::is_trivially_destructible<grpc_core::StaticMetadataSlice>::value,
+    "grpc_core::StaticMetadataSlice must be trivially destructible.");
+#define GRPC_STATIC_MDSTR_COUNT 109
+
+void grpc_init_static_metadata_ctx(void);
+void grpc_destroy_static_metadata_ctx(void);
+namespace grpc_core {
+#ifndef NDEBUG
+constexpr uint64_t kGrpcStaticMetadataInitCanary = 0xCAFEF00DC0FFEE11L;
+uint64_t StaticMetadataInitCanary();
+#endif
+extern const StaticMetadataSlice* g_static_metadata_slice_table;
+}
+inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
+  GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
+                   grpc_core::kGrpcStaticMetadataInitCanary);
+  GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_table != nullptr);
+  return grpc_core::g_static_metadata_slice_table;
+}
+
 /* ":path" */
-#define GRPC_MDSTR_PATH (grpc_static_slice_table[0])
+#define GRPC_MDSTR_PATH (grpc_static_slice_table()[0])
 /* ":method" */
-#define GRPC_MDSTR_METHOD (grpc_static_slice_table[1])
+#define GRPC_MDSTR_METHOD (grpc_static_slice_table()[1])
 /* ":status" */
-#define GRPC_MDSTR_STATUS (grpc_static_slice_table[2])
+#define GRPC_MDSTR_STATUS (grpc_static_slice_table()[2])
 /* ":authority" */
-#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table[3])
+#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table()[3])
 /* ":scheme" */
-#define GRPC_MDSTR_SCHEME (grpc_static_slice_table[4])
+#define GRPC_MDSTR_SCHEME (grpc_static_slice_table()[4])
 /* "te" */
-#define GRPC_MDSTR_TE (grpc_static_slice_table[5])
+#define GRPC_MDSTR_TE (grpc_static_slice_table()[5])
 /* "grpc-message" */
-#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table[6])
+#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table()[6])
 /* "grpc-status" */
-#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table[7])
+#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table()[7])
 /* "grpc-payload-bin" */
-#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table[8])
+#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table()[8])
 /* "grpc-encoding" */
-#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table[9])
+#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table()[9])
 /* "grpc-accept-encoding" */
-#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table[10])
+#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table()[10])
 /* "grpc-server-stats-bin" */
-#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table[11])
+#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table()[11])
 /* "grpc-tags-bin" */
-#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table[12])
+#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table()[12])
 /* "grpc-trace-bin" */
-#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table[13])
+#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table()[13])
 /* "content-type" */
-#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[14])
+#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table()[14])
 /* "content-encoding" */
-#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[15])
+#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table()[15])
 /* "accept-encoding" */
-#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[16])
+#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table()[16])
 /* "grpc-internal-encoding-request" */
-#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[17])
+#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST \
+  (grpc_static_slice_table()[17])
 /* "grpc-internal-stream-encoding-request" */
 #define GRPC_MDSTR_GRPC_INTERNAL_STREAM_ENCODING_REQUEST \
-  (grpc_static_slice_table[18])
+  (grpc_static_slice_table()[18])
 /* "user-agent" */
-#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[19])
+#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table()[19])
 /* "host" */
-#define GRPC_MDSTR_HOST (grpc_static_slice_table[20])
-/* "lb-token" */
-#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[21])
+#define GRPC_MDSTR_HOST (grpc_static_slice_table()[20])
 /* "grpc-previous-rpc-attempts" */
-#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[22])
+#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table()[21])
 /* "grpc-retry-pushback-ms" */
-#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[23])
+#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table()[22])
+/* "x-endpoint-load-metrics-bin" */
+#define GRPC_MDSTR_X_ENDPOINT_LOAD_METRICS_BIN (grpc_static_slice_table()[23])
 /* "grpc-timeout" */
-#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[24])
+#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table()[24])
 /* "1" */
-#define GRPC_MDSTR_1 (grpc_static_slice_table[25])
+#define GRPC_MDSTR_1 (grpc_static_slice_table()[25])
 /* "2" */
-#define GRPC_MDSTR_2 (grpc_static_slice_table[26])
+#define GRPC_MDSTR_2 (grpc_static_slice_table()[26])
 /* "3" */
-#define GRPC_MDSTR_3 (grpc_static_slice_table[27])
+#define GRPC_MDSTR_3 (grpc_static_slice_table()[27])
 /* "4" */
-#define GRPC_MDSTR_4 (grpc_static_slice_table[28])
+#define GRPC_MDSTR_4 (grpc_static_slice_table()[28])
 /* "" */
-#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[29])
+#define GRPC_MDSTR_EMPTY (grpc_static_slice_table()[29])
 /* "grpc.wait_for_ready" */
-#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[30])
+#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table()[30])
 /* "grpc.timeout" */
-#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[31])
+#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table()[31])
 /* "grpc.max_request_message_bytes" */
 #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \
-  (grpc_static_slice_table[32])
+  (grpc_static_slice_table()[32])
 /* "grpc.max_response_message_bytes" */
 #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \
-  (grpc_static_slice_table[33])
+  (grpc_static_slice_table()[33])
 /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */
 #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \
-  (grpc_static_slice_table[34])
+  (grpc_static_slice_table()[34])
+/* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */
+#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \
+  (grpc_static_slice_table()[35])
+/* "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" */
+#define GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS \
+  (grpc_static_slice_table()[36])
 /* "/grpc.health.v1.Health/Watch" */
 #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \
-  (grpc_static_slice_table[35])
+  (grpc_static_slice_table()[37])
 /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources"
  */
 #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
-  (grpc_static_slice_table[36])
+  (grpc_static_slice_table()[38])
 /* "deflate" */
-#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37])
+#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table()[39])
 /* "gzip" */
-#define GRPC_MDSTR_GZIP (grpc_static_slice_table[38])
+#define GRPC_MDSTR_GZIP (grpc_static_slice_table()[40])
 /* "stream/gzip" */
-#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[39])
+#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table()[41])
 /* "GET" */
-#define GRPC_MDSTR_GET (grpc_static_slice_table[40])
+#define GRPC_MDSTR_GET (grpc_static_slice_table()[42])
 /* "POST" */
-#define GRPC_MDSTR_POST (grpc_static_slice_table[41])
+#define GRPC_MDSTR_POST (grpc_static_slice_table()[43])
 /* "/" */
-#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42])
+#define GRPC_MDSTR_SLASH (grpc_static_slice_table()[44])
 /* "/index.html" */
-#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43])
+#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table()[45])
 /* "http" */
-#define GRPC_MDSTR_HTTP (grpc_static_slice_table[44])
+#define GRPC_MDSTR_HTTP (grpc_static_slice_table()[46])
 /* "https" */
-#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[45])
+#define GRPC_MDSTR_HTTPS (grpc_static_slice_table()[47])
 /* "200" */
-#define GRPC_MDSTR_200 (grpc_static_slice_table[46])
+#define GRPC_MDSTR_200 (grpc_static_slice_table()[48])
 /* "204" */
-#define GRPC_MDSTR_204 (grpc_static_slice_table[47])
+#define GRPC_MDSTR_204 (grpc_static_slice_table()[49])
 /* "206" */
-#define GRPC_MDSTR_206 (grpc_static_slice_table[48])
+#define GRPC_MDSTR_206 (grpc_static_slice_table()[50])
 /* "304" */
-#define GRPC_MDSTR_304 (grpc_static_slice_table[49])
+#define GRPC_MDSTR_304 (grpc_static_slice_table()[51])
 /* "400" */
-#define GRPC_MDSTR_400 (grpc_static_slice_table[50])
+#define GRPC_MDSTR_400 (grpc_static_slice_table()[52])
 /* "404" */
-#define GRPC_MDSTR_404 (grpc_static_slice_table[51])
+#define GRPC_MDSTR_404 (grpc_static_slice_table()[53])
 /* "500" */
-#define GRPC_MDSTR_500 (grpc_static_slice_table[52])
+#define GRPC_MDSTR_500 (grpc_static_slice_table()[54])
 /* "accept-charset" */
-#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53])
+#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table()[55])
 /* "gzip, deflate" */
-#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54])
+#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table()[56])
 /* "accept-language" */
-#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55])
+#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table()[57])
 /* "accept-ranges" */
-#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56])
+#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table()[58])
 /* "accept" */
-#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57])
+#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table()[59])
 /* "access-control-allow-origin" */
-#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58])
+#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table()[60])
 /* "age" */
-#define GRPC_MDSTR_AGE (grpc_static_slice_table[59])
+#define GRPC_MDSTR_AGE (grpc_static_slice_table()[61])
 /* "allow" */
-#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60])
+#define GRPC_MDSTR_ALLOW (grpc_static_slice_table()[62])
 /* "authorization" */
-#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61])
+#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table()[63])
 /* "cache-control" */
-#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62])
+#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table()[64])
 /* "content-disposition" */
-#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63])
+#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table()[65])
 /* "content-language" */
-#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64])
+#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table()[66])
 /* "content-length" */
-#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65])
+#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table()[67])
 /* "content-location" */
-#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66])
+#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table()[68])
 /* "content-range" */
-#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67])
+#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table()[69])
 /* "cookie" */
-#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68])
+#define GRPC_MDSTR_COOKIE (grpc_static_slice_table()[70])
 /* "date" */
-#define GRPC_MDSTR_DATE (grpc_static_slice_table[69])
+#define GRPC_MDSTR_DATE (grpc_static_slice_table()[71])
 /* "etag" */
-#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70])
+#define GRPC_MDSTR_ETAG (grpc_static_slice_table()[72])
 /* "expect" */
-#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71])
+#define GRPC_MDSTR_EXPECT (grpc_static_slice_table()[73])
 /* "expires" */
-#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72])
+#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table()[74])
 /* "from" */
-#define GRPC_MDSTR_FROM (grpc_static_slice_table[73])
+#define GRPC_MDSTR_FROM (grpc_static_slice_table()[75])
 /* "if-match" */
-#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74])
+#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table()[76])
 /* "if-modified-since" */
-#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75])
+#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table()[77])
 /* "if-none-match" */
-#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76])
+#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table()[78])
 /* "if-range" */
-#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77])
+#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table()[79])
 /* "if-unmodified-since" */
-#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78])
+#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table()[80])
 /* "last-modified" */
-#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79])
+#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table()[81])
 /* "link" */
-#define GRPC_MDSTR_LINK (grpc_static_slice_table[80])
+#define GRPC_MDSTR_LINK (grpc_static_slice_table()[82])
 /* "location" */
-#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[81])
+#define GRPC_MDSTR_LOCATION (grpc_static_slice_table()[83])
 /* "max-forwards" */
-#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[82])
+#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table()[84])
 /* "proxy-authenticate" */
-#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[83])
+#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table()[85])
 /* "proxy-authorization" */
-#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[84])
+#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table()[86])
 /* "range" */
-#define GRPC_MDSTR_RANGE (grpc_static_slice_table[85])
+#define GRPC_MDSTR_RANGE (grpc_static_slice_table()[87])
 /* "referer" */
-#define GRPC_MDSTR_REFERER (grpc_static_slice_table[86])
+#define GRPC_MDSTR_REFERER (grpc_static_slice_table()[88])
 /* "refresh" */
-#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[87])
+#define GRPC_MDSTR_REFRESH (grpc_static_slice_table()[89])
 /* "retry-after" */
-#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[88])
+#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table()[90])
 /* "server" */
-#define GRPC_MDSTR_SERVER (grpc_static_slice_table[89])
+#define GRPC_MDSTR_SERVER (grpc_static_slice_table()[91])
 /* "set-cookie" */
-#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[90])
+#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table()[92])
 /* "strict-transport-security" */
-#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[91])
+#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table()[93])
 /* "transfer-encoding" */
-#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[92])
+#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table()[94])
 /* "vary" */
-#define GRPC_MDSTR_VARY (grpc_static_slice_table[93])
+#define GRPC_MDSTR_VARY (grpc_static_slice_table()[95])
 /* "via" */
-#define GRPC_MDSTR_VIA (grpc_static_slice_table[94])
+#define GRPC_MDSTR_VIA (grpc_static_slice_table()[96])
 /* "www-authenticate" */
-#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[95])
+#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table()[97])
 /* "0" */
-#define GRPC_MDSTR_0 (grpc_static_slice_table[96])
+#define GRPC_MDSTR_0 (grpc_static_slice_table()[98])
 /* "identity" */
-#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[97])
+#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table()[99])
 /* "trailers" */
-#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[98])
+#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table()[100])
 /* "application/grpc" */
-#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[99])
+#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table()[101])
 /* "grpc" */
-#define GRPC_MDSTR_GRPC (grpc_static_slice_table[100])
+#define GRPC_MDSTR_GRPC (grpc_static_slice_table()[102])
 /* "PUT" */
-#define GRPC_MDSTR_PUT (grpc_static_slice_table[101])
+#define GRPC_MDSTR_PUT (grpc_static_slice_table()[103])
 /* "lb-cost-bin" */
-#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[102])
+#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table()[104])
 /* "identity,deflate" */
-#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[103])
+#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table()[105])
 /* "identity,gzip" */
-#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[104])
+#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table()[106])
 /* "deflate,gzip" */
-#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[105])
+#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table()[107])
 /* "identity,deflate,gzip" */
 #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
-  (grpc_static_slice_table[106])
+  (grpc_static_slice_table()[108])
+
+namespace grpc_core {
+struct StaticSliceRefcount;
+extern StaticSliceRefcount* g_static_metadata_slice_refcounts;
+}  // namespace grpc_core
+inline grpc_core::StaticSliceRefcount* grpc_static_metadata_refcounts() {
+  GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
+                   grpc_core::kGrpcStaticMetadataInitCanary);
+  GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_refcounts != nullptr);
+  return grpc_core::g_static_metadata_slice_refcounts;
+}
 
-extern grpc_slice_refcount
-    grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];
 #define GRPC_IS_STATIC_METADATA_STRING(slice) \
   ((slice).refcount != NULL &&                \
    (slice).refcount->GetType() == grpc_slice_refcount::Type::STATIC)
 
-#define GRPC_STATIC_METADATA_INDEX(static_slice) \
-  (static_cast<intptr_t>(                        \
-      ((static_slice).refcount - grpc_static_metadata_refcounts)))
+#define GRPC_STATIC_METADATA_INDEX(static_slice)                              \
+  (reinterpret_cast<grpc_core::StaticSliceRefcount*>((static_slice).refcount) \
+       ->index)
+
+#define GRPC_STATIC_MDELEM_COUNT 85
+
+namespace grpc_core {
+extern StaticMetadata* g_static_mdelem_table;
+extern grpc_mdelem* g_static_mdelem_manifested;
+}  // namespace grpc_core
+inline grpc_core::StaticMetadata* grpc_static_mdelem_table() {
+  GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
+                   grpc_core::kGrpcStaticMetadataInitCanary);
+  GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_table != nullptr);
+  return grpc_core::g_static_mdelem_table;
+}
+inline grpc_mdelem* grpc_static_mdelem_manifested() {
+  GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
+                   grpc_core::kGrpcStaticMetadataInitCanary);
+  GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_manifested != nullptr);
+  return grpc_core::g_static_mdelem_manifested;
+}
 
-#define GRPC_STATIC_MDELEM_COUNT 86
-extern grpc_core::StaticMetadata
-    grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
 extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
 /* ":authority": "" */
-#define GRPC_MDELEM_AUTHORITY_EMPTY                      \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[0].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_AUTHORITY_EMPTY (grpc_static_mdelem_manifested()[0])
 /* ":method": "GET" */
-#define GRPC_MDELEM_METHOD_GET                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[1].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_METHOD_GET (grpc_static_mdelem_manifested()[1])
 /* ":method": "POST" */
-#define GRPC_MDELEM_METHOD_POST                          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[2].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_METHOD_POST (grpc_static_mdelem_manifested()[2])
 /* ":path": "/" */
-#define GRPC_MDELEM_PATH_SLASH                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[3].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_PATH_SLASH (grpc_static_mdelem_manifested()[3])
 /* ":path": "/index.html" */
-#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[4].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML \
+  (grpc_static_mdelem_manifested()[4])
 /* ":scheme": "http" */
-#define GRPC_MDELEM_SCHEME_HTTP                          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[5].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_SCHEME_HTTP (grpc_static_mdelem_manifested()[5])
 /* ":scheme": "https" */
-#define GRPC_MDELEM_SCHEME_HTTPS                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[6].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_SCHEME_HTTPS (grpc_static_mdelem_manifested()[6])
 /* ":status": "200" */
-#define GRPC_MDELEM_STATUS_200                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[7].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_200 (grpc_static_mdelem_manifested()[7])
 /* ":status": "204" */
-#define GRPC_MDELEM_STATUS_204                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[8].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_204 (grpc_static_mdelem_manifested()[8])
 /* ":status": "206" */
-#define GRPC_MDELEM_STATUS_206                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[9].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_206 (grpc_static_mdelem_manifested()[9])
 /* ":status": "304" */
-#define GRPC_MDELEM_STATUS_304                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[10].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_304 (grpc_static_mdelem_manifested()[10])
 /* ":status": "400" */
-#define GRPC_MDELEM_STATUS_400                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[11].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_400 (grpc_static_mdelem_manifested()[11])
 /* ":status": "404" */
-#define GRPC_MDELEM_STATUS_404                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[12].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested()[12])
 /* ":status": "500" */
-#define GRPC_MDELEM_STATUS_500                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[13].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested()[13])
 /* "accept-charset": "" */
-#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY                  \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[14].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested()[14])
 /* "accept-encoding": "gzip, deflate" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE    \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[15].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
+  (grpc_static_mdelem_manifested()[15])
 /* "accept-language": "" */
-#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY                 \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[16].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[16])
 /* "accept-ranges": "" */
-#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY                   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[17].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested()[17])
 /* "accept": "" */
-#define GRPC_MDELEM_ACCEPT_EMPTY                          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[18].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested()[18])
 /* "access-control-allow-origin": "" */
-#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY     \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[19].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
+  (grpc_static_mdelem_manifested()[19])
 /* "age": "" */
-#define GRPC_MDELEM_AGE_EMPTY                             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[20].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested()[20])
 /* "allow": "" */
-#define GRPC_MDELEM_ALLOW_EMPTY                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[21].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested()[21])
 /* "authorization": "" */
-#define GRPC_MDELEM_AUTHORIZATION_EMPTY                   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[22].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested()[22])
 /* "cache-control": "" */
-#define GRPC_MDELEM_CACHE_CONTROL_EMPTY                   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[23].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested()[23])
 /* "content-disposition": "" */
-#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[24].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \
+  (grpc_static_mdelem_manifested()[24])
 /* "content-encoding": "" */
-#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY                \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[25].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[25])
 /* "content-language": "" */
-#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY                \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[26].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[26])
 /* "content-length": "" */
-#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY                  \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[27].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested()[27])
 /* "content-location": "" */
-#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY                \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[28].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested()[28])
 /* "content-range": "" */
-#define GRPC_MDELEM_CONTENT_RANGE_EMPTY                   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[29].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested()[29])
 /* "content-type": "" */
-#define GRPC_MDELEM_CONTENT_TYPE_EMPTY                    \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[30].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested()[30])
 /* "cookie": "" */
-#define GRPC_MDELEM_COOKIE_EMPTY                          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[31].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested()[31])
 /* "date": "" */
-#define GRPC_MDELEM_DATE_EMPTY                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[32].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested()[32])
 /* "etag": "" */
-#define GRPC_MDELEM_ETAG_EMPTY                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[33].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested()[33])
 /* "expect": "" */
-#define GRPC_MDELEM_EXPECT_EMPTY                          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[34].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested()[34])
 /* "expires": "" */
-#define GRPC_MDELEM_EXPIRES_EMPTY                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[35].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested()[35])
 /* "from": "" */
-#define GRPC_MDELEM_FROM_EMPTY                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[36].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested()[36])
 /* "host": "" */
-#define GRPC_MDELEM_HOST_EMPTY                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[37].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested()[37])
 /* "if-match": "" */
-#define GRPC_MDELEM_IF_MATCH_EMPTY                        \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[38].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested()[38])
 /* "if-modified-since": "" */
-#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY               \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[39].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \
+  (grpc_static_mdelem_manifested()[39])
 /* "if-none-match": "" */
-#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY                   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[40].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested()[40])
 /* "if-range": "" */
-#define GRPC_MDELEM_IF_RANGE_EMPTY                        \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[41].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested()[41])
 /* "if-unmodified-since": "" */
-#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[42].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \
+  (grpc_static_mdelem_manifested()[42])
 /* "last-modified": "" */
-#define GRPC_MDELEM_LAST_MODIFIED_EMPTY                   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[43].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested()[43])
 /* "link": "" */
-#define GRPC_MDELEM_LINK_EMPTY                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[44].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested()[44])
 /* "location": "" */
-#define GRPC_MDELEM_LOCATION_EMPTY                        \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[45].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested()[45])
 /* "max-forwards": "" */
-#define GRPC_MDELEM_MAX_FORWARDS_EMPTY                    \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[46].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested()[46])
 /* "proxy-authenticate": "" */
-#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY              \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[47].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \
+  (grpc_static_mdelem_manifested()[47])
 /* "proxy-authorization": "" */
-#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[48].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
+  (grpc_static_mdelem_manifested()[48])
 /* "range": "" */
-#define GRPC_MDELEM_RANGE_EMPTY                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[49].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested()[49])
 /* "referer": "" */
-#define GRPC_MDELEM_REFERER_EMPTY                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[50].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested()[50])
 /* "refresh": "" */
-#define GRPC_MDELEM_REFRESH_EMPTY                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[51].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested()[51])
 /* "retry-after": "" */
-#define GRPC_MDELEM_RETRY_AFTER_EMPTY                     \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[52].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested()[52])
 /* "server": "" */
-#define GRPC_MDELEM_SERVER_EMPTY                          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[53].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested()[53])
 /* "set-cookie": "" */
-#define GRPC_MDELEM_SET_COOKIE_EMPTY                      \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[54].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested()[54])
 /* "strict-transport-security": "" */
-#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY       \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[55].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
+  (grpc_static_mdelem_manifested()[55])
 /* "transfer-encoding": "" */
-#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY               \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \
+  (grpc_static_mdelem_manifested()[56])
 /* "user-agent": "" */
-#define GRPC_MDELEM_USER_AGENT_EMPTY                      \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested()[57])
 /* "vary": "" */
-#define GRPC_MDELEM_VARY_EMPTY                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested()[58])
 /* "via": "" */
-#define GRPC_MDELEM_VIA_EMPTY                             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested()[59])
 /* "www-authenticate": "" */
-#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY                \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested()[60])
 /* "grpc-status": "0" */
-#define GRPC_MDELEM_GRPC_STATUS_0                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested()[61])
 /* "grpc-status": "1" */
-#define GRPC_MDELEM_GRPC_STATUS_1                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_STATUS_1 (grpc_static_mdelem_manifested()[62])
 /* "grpc-status": "2" */
-#define GRPC_MDELEM_GRPC_STATUS_2                         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_STATUS_2 (grpc_static_mdelem_manifested()[63])
 /* "grpc-encoding": "identity" */
-#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY                \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (grpc_static_mdelem_manifested()[64])
 /* "grpc-encoding": "gzip" */
-#define GRPC_MDELEM_GRPC_ENCODING_GZIP                    \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_ENCODING_GZIP (grpc_static_mdelem_manifested()[65])
 /* "grpc-encoding": "deflate" */
-#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE                 \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (grpc_static_mdelem_manifested()[66])
 /* "te": "trailers" */
-#define GRPC_MDELEM_TE_TRAILERS                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_TE_TRAILERS (grpc_static_mdelem_manifested()[67])
 /* "content-type": "application/grpc" */
-#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \
+  (grpc_static_mdelem_manifested()[68])
 /* ":scheme": "grpc" */
-#define GRPC_MDELEM_SCHEME_GRPC                           \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_SCHEME_GRPC (grpc_static_mdelem_manifested()[69])
 /* ":method": "PUT" */
-#define GRPC_MDELEM_METHOD_PUT                            \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_METHOD_PUT (grpc_static_mdelem_manifested()[70])
 /* "accept-encoding": "" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY                 \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[71])
 /* "content-encoding": "identity" */
-#define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY \
+  (grpc_static_mdelem_manifested()[72])
 /* "content-encoding": "gzip" */
-#define GRPC_MDELEM_CONTENT_ENCODING_GZIP                 \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
-/* "lb-token": "" */
-#define GRPC_MDELEM_LB_TOKEN_EMPTY                        \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested()[73])
 /* "lb-cost-bin": "" */
-#define GRPC_MDELEM_LB_COST_BIN_EMPTY                     \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested()[74])
 /* "grpc-accept-encoding": "identity" */
-#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY         \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
+  (grpc_static_mdelem_manifested()[75])
 /* "grpc-accept-encoding": "deflate" */
-#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE          \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
+  (grpc_static_mdelem_manifested()[76])
 /* "grpc-accept-encoding": "identity,deflate" */
 #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78].data(),       \
-                    GRPC_MDELEM_STORAGE_STATIC))
+  (grpc_static_mdelem_manifested()[77])
 /* "grpc-accept-encoding": "gzip" */
-#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP             \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
+  (grpc_static_mdelem_manifested()[78])
 /* "grpc-accept-encoding": "identity,gzip" */
 #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[80].data(),    \
-                    GRPC_MDELEM_STORAGE_STATIC))
+  (grpc_static_mdelem_manifested()[79])
 /* "grpc-accept-encoding": "deflate,gzip" */
 #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[81].data(),   \
-                    GRPC_MDELEM_STORAGE_STATIC))
+  (grpc_static_mdelem_manifested()[80])
 /* "grpc-accept-encoding": "identity,deflate,gzip" */
 #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[82].data(),                  \
-                    GRPC_MDELEM_STORAGE_STATIC))
+  (grpc_static_mdelem_manifested()[81])
 /* "accept-encoding": "identity" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY              \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[83].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY \
+  (grpc_static_mdelem_manifested()[82])
 /* "accept-encoding": "gzip" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP                  \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[84].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested()[83])
 /* "accept-encoding": "identity,gzip" */
-#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP   \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[85].data(), \
-                    GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
+  (grpc_static_mdelem_manifested()[84])
 
 grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b);
 typedef enum {
@@ -640,9 +538,9 @@ typedef enum {
   GRPC_BATCH_GRPC_INTERNAL_STREAM_ENCODING_REQUEST,
   GRPC_BATCH_USER_AGENT,
   GRPC_BATCH_HOST,
-  GRPC_BATCH_LB_TOKEN,
   GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS,
   GRPC_BATCH_GRPC_RETRY_PUSHBACK_MS,
+  GRPC_BATCH_X_ENDPOINT_LOAD_METRICS_BIN,
   GRPC_BATCH_CALLOUTS_COUNT
 } grpc_metadata_batch_callouts_index;
 
@@ -670,29 +568,32 @@ typedef union {
     struct grpc_linked_mdelem* grpc_internal_stream_encoding_request;
     struct grpc_linked_mdelem* user_agent;
     struct grpc_linked_mdelem* host;
-    struct grpc_linked_mdelem* lb_token;
     struct grpc_linked_mdelem* grpc_previous_rpc_attempts;
     struct grpc_linked_mdelem* grpc_retry_pushback_ms;
+    struct grpc_linked_mdelem* x_endpoint_load_metrics_bin;
   } named;
 } grpc_metadata_batch_callouts;
 
-#define GRPC_BATCH_INDEX_OF(slice)                                        \
-  (GRPC_IS_STATIC_METADATA_STRING((slice))                                \
-       ? static_cast<grpc_metadata_batch_callouts_index>(                 \
-             GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0,            \
-                       static_cast<intptr_t>(GRPC_BATCH_CALLOUTS_COUNT))) \
+#define GRPC_BATCH_INDEX_OF(slice)                                             \
+  (GRPC_IS_STATIC_METADATA_STRING((slice)) &&                                  \
+           reinterpret_cast<grpc_core::StaticSliceRefcount*>((slice).refcount) \
+                   ->index <= static_cast<uint32_t>(GRPC_BATCH_CALLOUTS_COUNT) \
+       ? static_cast<grpc_metadata_batch_callouts_index>(                      \
+             reinterpret_cast<grpc_core::StaticSliceRefcount*>(                \
+                 (slice).refcount)                                             \
+                 ->index)                                                      \
        : GRPC_BATCH_CALLOUTS_COUNT)
 
 extern const uint8_t grpc_static_accept_encoding_metadata[8];
-#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs)                      \
-  (GRPC_MAKE_MDELEM(                                                          \
-      &grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]] \
-           .data(),                                                           \
-      GRPC_MDELEM_STORAGE_STATIC))
+#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs)                \
+  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table()                         \
+                         [grpc_static_accept_encoding_metadata[(algs)]] \
+                             .data(),                                   \
+                    GRPC_MDELEM_STORAGE_STATIC))
 
 extern const uint8_t grpc_static_accept_stream_encoding_metadata[4];
 #define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs)                \
-  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table                                  \
+  (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table()                                \
                          [grpc_static_accept_stream_encoding_metadata[(algs)]] \
                              .data(),                                          \
                     GRPC_MDELEM_STORAGE_STATIC))
index fe22c15..26d4b4a 100644 (file)
@@ -44,6 +44,9 @@ static int64_t round_up_to_three_sig_figs(int64_t x) {
 /* encode our minimum viable timeout value */
 static void enc_tiny(char* buffer) { memcpy(buffer, "1n", 3); }
 
+/* encode our maximum timeout value, about 1157 days */
+static void enc_huge(char* buffer) { memcpy(buffer, "99999999S", 10); }
+
 static void enc_ext(char* buffer, int64_t value, char ext) {
   int n = int64_ttoa(value, buffer);
   buffer[n] = ext;
@@ -51,6 +54,7 @@ static void enc_ext(char* buffer, int64_t value, char ext) {
 }
 
 static void enc_seconds(char* buffer, int64_t sec) {
+  sec = round_up_to_three_sig_figs(sec);
   if (sec % 3600 == 0) {
     enc_ext(buffer, sec / 3600, 'H');
   } else if (sec % 60 == 0) {
@@ -74,10 +78,13 @@ static void enc_millis(char* buffer, int64_t x) {
 }
 
 void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer) {
+  const grpc_millis kMaxTimeout = 99999999000;
   if (timeout <= 0) {
     enc_tiny(buffer);
   } else if (timeout < 1000 * GPR_MS_PER_SEC) {
     enc_millis(buffer, timeout);
+  } else if (timeout >= kMaxTimeout) {
+    enc_huge(buffer);
   } else {
     enc_seconds(buffer,
                 timeout / GPR_MS_PER_SEC + (timeout % GPR_MS_PER_SEC != 0));
index cc0d374..c87ff39 100644 (file)
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 
-#define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1)
+#define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE 10
 
 /* Encode/decode timeouts to the GRPC over HTTP/2 format;
-   encoding may round up arbitrarily */
+   encoding may round up arbitrarily. If the timeout is larger than about 1157
+   days, it will be capped and "99999999S" will be sent on the wire. */
 void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer);
 int grpc_http2_decode_timeout(const grpc_slice& text, grpc_millis* timeout);
 
index 17608f4..c40b290 100644 (file)
@@ -245,6 +245,18 @@ struct grpc_transport_stream_op_batch_payload {
     // The batch's on_complete will not be called until after the byte
     // stream is orphaned.
     grpc_core::OrphanablePtr<grpc_core::ByteStream> send_message;
+    // Set by the transport if the stream has been closed for writes. If this
+    // is set and send message op is present, we set the operation to be a
+    // failure without sending a cancel OP down the stack. This is so that the
+    // status of the call does not get overwritten by the Cancel OP, which would
+    // be especially problematic if we had received a valid status from the
+    // server.
+    // For send_initial_metadata, it is fine for the status to be overwritten
+    // because at that point, the client will not have received a status.
+    // For send_trailing_metadata, we might overwrite the status if we have
+    // non-zero metadata to send. This is fine because the API does not allow
+    // the client to send trailing metadata.
+    bool stream_write_closed = false;
   } send_message;
 
   struct {
diff --git a/legacy-libs/grpc/deps/grpc/src/core/plugin_registry/grpc_cronet_plugin_registry.cc b/legacy-libs/grpc/deps/grpc/src/core/plugin_registry/grpc_cronet_plugin_registry.cc
deleted file mode 100644 (file)
index 92085d3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/support/port_platform.h>
-
-#include <grpc/grpc.h>
-
-void grpc_http_filters_init(void);
-void grpc_http_filters_shutdown(void);
-void grpc_chttp2_plugin_init(void);
-void grpc_chttp2_plugin_shutdown(void);
-void grpc_deadline_filter_init(void);
-void grpc_deadline_filter_shutdown(void);
-void grpc_client_channel_init(void);
-void grpc_client_channel_shutdown(void);
-
-void grpc_register_built_in_plugins(void) {
-  grpc_register_plugin(grpc_http_filters_init,
-                       grpc_http_filters_shutdown);
-  grpc_register_plugin(grpc_chttp2_plugin_init,
-                       grpc_chttp2_plugin_shutdown);
-  grpc_register_plugin(grpc_deadline_filter_init,
-                       grpc_deadline_filter_shutdown);
-  grpc_register_plugin(grpc_client_channel_init,
-                       grpc_client_channel_shutdown);
-}
index cde40ef..ebe3def 100644 (file)
@@ -46,6 +46,10 @@ void grpc_resolver_dns_native_init(void);
 void grpc_resolver_dns_native_shutdown(void);
 void grpc_resolver_sockaddr_init(void);
 void grpc_resolver_sockaddr_shutdown(void);
+void grpc_resolver_xds_init(void);
+void grpc_resolver_xds_shutdown(void);
+void grpc_client_idle_filter_init(void);
+void grpc_client_idle_filter_shutdown(void);
 void grpc_max_age_filter_init(void);
 void grpc_max_age_filter_shutdown(void);
 void grpc_message_size_filter_init(void);
@@ -82,6 +86,10 @@ void grpc_register_built_in_plugins(void) {
                        grpc_resolver_dns_native_shutdown);
   grpc_register_plugin(grpc_resolver_sockaddr_init,
                        grpc_resolver_sockaddr_shutdown);
+  grpc_register_plugin(grpc_resolver_xds_init,
+                       grpc_resolver_xds_shutdown);
+  grpc_register_plugin(grpc_client_idle_filter_init,
+                       grpc_client_idle_filter_shutdown);
   grpc_register_plugin(grpc_max_age_filter_init,
                        grpc_max_age_filter_shutdown);
   grpc_register_plugin(grpc_message_size_filter_init,
index 5749ab6..6668836 100644 (file)
@@ -38,6 +38,8 @@ void grpc_resolver_sockaddr_init(void);
 void grpc_resolver_sockaddr_shutdown(void);
 void grpc_resolver_fake_init(void);
 void grpc_resolver_fake_shutdown(void);
+void grpc_resolver_xds_init(void);
+void grpc_resolver_xds_shutdown(void);
 void grpc_lb_policy_grpclb_init(void);
 void grpc_lb_policy_grpclb_shutdown(void);
 void grpc_lb_policy_xds_init(void);
@@ -46,6 +48,8 @@ void grpc_lb_policy_pick_first_init(void);
 void grpc_lb_policy_pick_first_shutdown(void);
 void grpc_lb_policy_round_robin_init(void);
 void grpc_lb_policy_round_robin_shutdown(void);
+void grpc_client_idle_filter_init(void);
+void grpc_client_idle_filter_shutdown(void);
 void grpc_max_age_filter_init(void);
 void grpc_max_age_filter_shutdown(void);
 void grpc_message_size_filter_init(void);
@@ -74,6 +78,8 @@ void grpc_register_built_in_plugins(void) {
                        grpc_resolver_sockaddr_shutdown);
   grpc_register_plugin(grpc_resolver_fake_init,
                        grpc_resolver_fake_shutdown);
+  grpc_register_plugin(grpc_resolver_xds_init,
+                       grpc_resolver_xds_shutdown);
   grpc_register_plugin(grpc_lb_policy_grpclb_init,
                        grpc_lb_policy_grpclb_shutdown);
   grpc_register_plugin(grpc_lb_policy_xds_init,
@@ -82,6 +88,8 @@ void grpc_register_built_in_plugins(void) {
                        grpc_lb_policy_pick_first_shutdown);
   grpc_register_plugin(grpc_lb_policy_round_robin_init,
                        grpc_lb_policy_round_robin_shutdown);
+  grpc_register_plugin(grpc_client_idle_filter_init,
+                       grpc_client_idle_filter_shutdown);
   grpc_register_plugin(grpc_max_age_filter_init,
                        grpc_max_age_filter_shutdown);
   grpc_register_plugin(grpc_message_size_filter_init,
index 464de9e..55fd066 100644 (file)
@@ -27,7 +27,6 @@
 #include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/surface/call.h"
 #include "src/core/lib/surface/channel.h"
-#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h"
 #include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
 #include "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h"
 #include "src/core/tsi/alts/handshaker/alts_tsi_utils.h"
@@ -91,9 +90,9 @@ static void handshaker_client_send_buffer_destroy(
   client->send_buffer = nullptr;
 }
 
-static bool is_handshake_finished_properly(grpc_gcp_handshaker_resp* resp) {
+static bool is_handshake_finished_properly(grpc_gcp_HandshakerResp* resp) {
   GPR_ASSERT(resp != nullptr);
-  if (resp->has_result) {
+  if (grpc_gcp_HandshakerResp_result(resp)) {
     return true;
   }
   return false;
@@ -140,8 +139,9 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
     cb(TSI_INTERNAL_ERROR, user_data, nullptr, 0, nullptr);
     return;
   }
-  grpc_gcp_handshaker_resp* resp =
-      alts_tsi_utils_deserialize_response(recv_buffer);
+  upb::Arena arena;
+  grpc_gcp_HandshakerResp* resp =
+      alts_tsi_utils_deserialize_response(recv_buffer, arena.ptr());
   grpc_byte_buffer_destroy(client->recv_buffer);
   client->recv_buffer = nullptr;
   /* Invalid handshaker response check. */
@@ -150,35 +150,44 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
     cb(TSI_DATA_CORRUPTED, user_data, nullptr, 0, nullptr);
     return;
   }
-  grpc_slice* slice = static_cast<grpc_slice*>(resp->out_frames.arg);
+  const grpc_gcp_HandshakerStatus* resp_status =
+      grpc_gcp_HandshakerResp_status(resp);
+  if (resp_status == nullptr) {
+    gpr_log(GPR_ERROR, "No status in HandshakerResp");
+    cb(TSI_DATA_CORRUPTED, user_data, nullptr, 0, nullptr);
+    return;
+  }
+  upb_strview out_frames = grpc_gcp_HandshakerResp_out_frames(resp);
   unsigned char* bytes_to_send = nullptr;
   size_t bytes_to_send_size = 0;
-  if (slice != nullptr) {
-    bytes_to_send_size = GRPC_SLICE_LENGTH(*slice);
+  if (out_frames.size > 0) {
+    bytes_to_send_size = out_frames.size;
     while (bytes_to_send_size > client->buffer_size) {
       client->buffer_size *= 2;
       client->buffer = static_cast<unsigned char*>(
           gpr_realloc(client->buffer, client->buffer_size));
     }
-    memcpy(client->buffer, GRPC_SLICE_START_PTR(*slice), bytes_to_send_size);
+    memcpy(client->buffer, out_frames.data, bytes_to_send_size);
     bytes_to_send = client->buffer;
   }
   tsi_handshaker_result* result = nullptr;
   if (is_handshake_finished_properly(resp)) {
     alts_tsi_handshaker_result_create(resp, client->is_client, &result);
-    alts_tsi_handshaker_result_set_unused_bytes(result, &client->recv_bytes,
-                                                resp->bytes_consumed);
+    alts_tsi_handshaker_result_set_unused_bytes(
+        result, &client->recv_bytes,
+        grpc_gcp_HandshakerResp_bytes_consumed(resp));
   }
-  grpc_status_code code = static_cast<grpc_status_code>(resp->status.code);
+  grpc_status_code code = static_cast<grpc_status_code>(
+      grpc_gcp_HandshakerStatus_code(resp_status));
   if (code != GRPC_STATUS_OK) {
-    grpc_slice* details = static_cast<grpc_slice*>(resp->status.details.arg);
-    if (details != nullptr) {
-      char* error_details = grpc_slice_to_c_string(*details);
+    upb_strview details = grpc_gcp_HandshakerStatus_details(resp_status);
+    if (details.size > 0) {
+      char* error_details = (char*)gpr_zalloc(details.size + 1);
+      memcpy(error_details, details.data, details.size);
       gpr_log(GPR_ERROR, "Error from handshaker service:%s", error_details);
       gpr_free(error_details);
     }
   }
-  grpc_gcp_handshaker_resp_destroy(resp);
   cb(alts_tsi_utils_convert_to_tsi_result(code), user_data, bytes_to_send,
      bytes_to_send_size, result);
 }
@@ -223,43 +232,59 @@ static tsi_result make_grpc_call(alts_handshaker_client* c, bool is_start) {
   return TSI_OK;
 }
 
+/* Serializes a grpc_gcp_HandshakerReq message into a buffer and returns newly
+ * grpc_byte_buffer holding it. */
+static grpc_byte_buffer* get_serialized_handshaker_req(
+    grpc_gcp_HandshakerReq* req, upb_arena* arena) {
+  size_t buf_length;
+  char* buf = grpc_gcp_HandshakerReq_serialize(req, arena, &buf_length);
+  if (buf == nullptr) {
+    return nullptr;
+  }
+  grpc_slice slice = grpc_slice_from_copied_buffer(buf, buf_length);
+  grpc_byte_buffer* byte_buffer = grpc_raw_byte_buffer_create(&slice, 1);
+  grpc_slice_unref_internal(slice);
+  return byte_buffer;
+}
+
 /* Create and populate a client_start handshaker request, then serialize it. */
 static grpc_byte_buffer* get_serialized_start_client(
     alts_handshaker_client* c) {
   GPR_ASSERT(c != nullptr);
   alts_grpc_handshaker_client* client =
       reinterpret_cast<alts_grpc_handshaker_client*>(c);
-  bool ok = true;
-  grpc_gcp_handshaker_req* req =
-      grpc_gcp_handshaker_req_create(CLIENT_START_REQ);
-  ok &= grpc_gcp_handshaker_req_set_handshake_protocol(
-      req, grpc_gcp_HandshakeProtocol_ALTS);
-  ok &= grpc_gcp_handshaker_req_add_application_protocol(
-      req, ALTS_APPLICATION_PROTOCOL);
-  ok &= grpc_gcp_handshaker_req_add_record_protocol(req, ALTS_RECORD_PROTOCOL);
-  grpc_gcp_rpc_protocol_versions* versions = &client->options->rpc_versions;
-  ok &= grpc_gcp_handshaker_req_set_rpc_versions(
-      req, versions->max_rpc_version.major, versions->max_rpc_version.minor,
-      versions->min_rpc_version.major, versions->min_rpc_version.minor);
-  char* target_name = grpc_slice_to_c_string(client->target_name);
-  ok &= grpc_gcp_handshaker_req_set_target_name(req, target_name);
+  upb::Arena arena;
+  grpc_gcp_HandshakerReq* req = grpc_gcp_HandshakerReq_new(arena.ptr());
+  grpc_gcp_StartClientHandshakeReq* start_client =
+      grpc_gcp_HandshakerReq_mutable_client_start(req, arena.ptr());
+  grpc_gcp_StartClientHandshakeReq_set_handshake_security_protocol(
+      start_client, grpc_gcp_ALTS);
+  grpc_gcp_StartClientHandshakeReq_add_application_protocols(
+      start_client, upb_strview_makez(ALTS_APPLICATION_PROTOCOL), arena.ptr());
+  grpc_gcp_StartClientHandshakeReq_add_record_protocols(
+      start_client, upb_strview_makez(ALTS_RECORD_PROTOCOL), arena.ptr());
+  grpc_gcp_RpcProtocolVersions* client_version =
+      grpc_gcp_StartClientHandshakeReq_mutable_rpc_versions(start_client,
+                                                            arena.ptr());
+  grpc_gcp_RpcProtocolVersions_assign_from_struct(
+      client_version, arena.ptr(), &client->options->rpc_versions);
+  grpc_gcp_StartClientHandshakeReq_set_target_name(
+      start_client,
+      upb_strview_make(reinterpret_cast<const char*>(
+                           GRPC_SLICE_START_PTR(client->target_name)),
+                       GRPC_SLICE_LENGTH(client->target_name)));
   target_service_account* ptr =
       (reinterpret_cast<grpc_alts_credentials_client_options*>(client->options))
           ->target_account_list_head;
   while (ptr != nullptr) {
-    grpc_gcp_handshaker_req_add_target_identity_service_account(req, ptr->data);
+    grpc_gcp_Identity* target_identity =
+        grpc_gcp_StartClientHandshakeReq_add_target_identities(start_client,
+                                                               arena.ptr());
+    grpc_gcp_Identity_set_service_account(target_identity,
+                                          upb_strview_makez(ptr->data));
     ptr = ptr->next;
   }
-  grpc_slice slice;
-  ok &= grpc_gcp_handshaker_req_encode(req, &slice);
-  grpc_byte_buffer* buffer = nullptr;
-  if (ok) {
-    buffer = grpc_raw_byte_buffer_create(&slice, 1 /* number of slices */);
-  }
-  grpc_slice_unref_internal(slice);
-  gpr_free(target_name);
-  grpc_gcp_handshaker_req_destroy(req);
-  return buffer;
+  return get_serialized_handshaker_req(req, arena.ptr());
 }
 
 static tsi_result handshaker_client_start_client(alts_handshaker_client* c) {
@@ -290,28 +315,35 @@ static grpc_byte_buffer* get_serialized_start_server(
   GPR_ASSERT(bytes_received != nullptr);
   alts_grpc_handshaker_client* client =
       reinterpret_cast<alts_grpc_handshaker_client*>(c);
-  grpc_gcp_handshaker_req* req =
-      grpc_gcp_handshaker_req_create(SERVER_START_REQ);
-  bool ok = grpc_gcp_handshaker_req_add_application_protocol(
-      req, ALTS_APPLICATION_PROTOCOL);
-  ok &= grpc_gcp_handshaker_req_param_add_record_protocol(
-      req, grpc_gcp_HandshakeProtocol_ALTS, ALTS_RECORD_PROTOCOL);
-  ok &= grpc_gcp_handshaker_req_set_in_bytes(
-      req, reinterpret_cast<const char*> GRPC_SLICE_START_PTR(*bytes_received),
-      GRPC_SLICE_LENGTH(*bytes_received));
-  grpc_gcp_rpc_protocol_versions* versions = &client->options->rpc_versions;
-  ok &= grpc_gcp_handshaker_req_set_rpc_versions(
-      req, versions->max_rpc_version.major, versions->max_rpc_version.minor,
-      versions->min_rpc_version.major, versions->min_rpc_version.minor);
-  grpc_slice req_slice;
-  ok &= grpc_gcp_handshaker_req_encode(req, &req_slice);
-  grpc_byte_buffer* buffer = nullptr;
-  if (ok) {
-    buffer = grpc_raw_byte_buffer_create(&req_slice, 1 /* number of slices */);
-  }
-  grpc_slice_unref_internal(req_slice);
-  grpc_gcp_handshaker_req_destroy(req);
-  return buffer;
+
+  upb::Arena arena;
+  grpc_gcp_HandshakerReq* req = grpc_gcp_HandshakerReq_new(arena.ptr());
+
+  grpc_gcp_StartServerHandshakeReq* start_server =
+      grpc_gcp_HandshakerReq_mutable_server_start(req, arena.ptr());
+  grpc_gcp_StartServerHandshakeReq_add_application_protocols(
+      start_server, upb_strview_makez(ALTS_APPLICATION_PROTOCOL), arena.ptr());
+  grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* param =
+      grpc_gcp_StartServerHandshakeReq_add_handshake_parameters(start_server,
+                                                                arena.ptr());
+  grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_key(
+      param, grpc_gcp_ALTS);
+  grpc_gcp_ServerHandshakeParameters* value =
+      grpc_gcp_ServerHandshakeParameters_new(arena.ptr());
+  grpc_gcp_ServerHandshakeParameters_add_record_protocols(
+      value, upb_strview_makez(ALTS_RECORD_PROTOCOL), arena.ptr());
+  grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_value(param,
+                                                                      value);
+  grpc_gcp_StartServerHandshakeReq_set_in_bytes(
+      start_server, upb_strview_make(reinterpret_cast<const char*>(
+                                         GRPC_SLICE_START_PTR(*bytes_received)),
+                                     GRPC_SLICE_LENGTH(*bytes_received)));
+  grpc_gcp_RpcProtocolVersions* server_version =
+      grpc_gcp_StartServerHandshakeReq_mutable_rpc_versions(start_server,
+                                                            arena.ptr());
+  grpc_gcp_RpcProtocolVersions_assign_from_struct(
+      server_version, arena.ptr(), &client->options->rpc_versions);
+  return get_serialized_handshaker_req(req, arena.ptr());
 }
 
 static tsi_result handshaker_client_start_server(alts_handshaker_client* c,
@@ -339,19 +371,15 @@ static tsi_result handshaker_client_start_server(alts_handshaker_client* c,
 /* Create and populate a next handshaker request, then serialize it. */
 static grpc_byte_buffer* get_serialized_next(grpc_slice* bytes_received) {
   GPR_ASSERT(bytes_received != nullptr);
-  grpc_gcp_handshaker_req* req = grpc_gcp_handshaker_req_create(NEXT_REQ);
-  bool ok = grpc_gcp_handshaker_req_set_in_bytes(
-      req, reinterpret_cast<const char*> GRPC_SLICE_START_PTR(*bytes_received),
-      GRPC_SLICE_LENGTH(*bytes_received));
-  grpc_slice req_slice;
-  ok &= grpc_gcp_handshaker_req_encode(req, &req_slice);
-  grpc_byte_buffer* buffer = nullptr;
-  if (ok) {
-    buffer = grpc_raw_byte_buffer_create(&req_slice, 1 /* number of slices */);
-  }
-  grpc_slice_unref_internal(req_slice);
-  grpc_gcp_handshaker_req_destroy(req);
-  return buffer;
+  upb::Arena arena;
+  grpc_gcp_HandshakerReq* req = grpc_gcp_HandshakerReq_new(arena.ptr());
+  grpc_gcp_NextHandshakeMessageReq* next =
+      grpc_gcp_HandshakerReq_mutable_next(req, arena.ptr());
+  grpc_gcp_NextHandshakeMessageReq_set_in_bytes(
+      next, upb_strview_make(reinterpret_cast<const char*> GRPC_SLICE_START_PTR(
+                                 *bytes_received),
+                             GRPC_SLICE_LENGTH(*bytes_received)));
+  return get_serialized_handshaker_req(req, arena.ptr());
 }
 
 static tsi_result handshaker_client_next(alts_handshaker_client* c,
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc
deleted file mode 100644 (file)
index 256e414..0000000
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
-
-/* HandshakerReq */
-grpc_gcp_handshaker_req* grpc_gcp_handshaker_req_create(
-    grpc_gcp_handshaker_req_type type) {
-  grpc_gcp_handshaker_req* req =
-      static_cast<grpc_gcp_handshaker_req*>(gpr_zalloc(sizeof(*req)));
-  switch (type) {
-    case CLIENT_START_REQ:
-      req->has_client_start = true;
-      break;
-    case SERVER_START_REQ:
-      req->has_server_start = true;
-      break;
-    case NEXT_REQ:
-      req->has_next = true;
-      break;
-  }
-  return req;
-}
-
-void grpc_gcp_handshaker_req_destroy(grpc_gcp_handshaker_req* req) {
-  if (req == nullptr) {
-    return;
-  }
-  if (req->has_client_start) {
-    /* Destroy client_start request. */
-    destroy_repeated_field_list_identity(
-        static_cast<repeated_field*>(req->client_start.target_identities.arg));
-    destroy_repeated_field_list_string(static_cast<repeated_field*>(
-        req->client_start.application_protocols.arg));
-    destroy_repeated_field_list_string(
-        static_cast<repeated_field*>(req->client_start.record_protocols.arg));
-    if (req->client_start.has_local_identity) {
-      destroy_slice(static_cast<grpc_slice*>(
-          req->client_start.local_identity.hostname.arg));
-      destroy_slice(static_cast<grpc_slice*>(
-          req->client_start.local_identity.service_account.arg));
-    }
-    if (req->client_start.has_local_endpoint) {
-      destroy_slice(static_cast<grpc_slice*>(
-          req->client_start.local_endpoint.ip_address.arg));
-    }
-    if (req->client_start.has_remote_endpoint) {
-      destroy_slice(static_cast<grpc_slice*>(
-          req->client_start.remote_endpoint.ip_address.arg));
-    }
-    destroy_slice(static_cast<grpc_slice*>(req->client_start.target_name.arg));
-  } else if (req->has_server_start) {
-    /* Destroy server_start request. */
-    size_t i = 0;
-    for (i = 0; i < req->server_start.handshake_parameters_count; i++) {
-      destroy_repeated_field_list_identity(
-          static_cast<repeated_field*>(req->server_start.handshake_parameters[i]
-                                           .value.local_identities.arg));
-      destroy_repeated_field_list_string(
-          static_cast<repeated_field*>(req->server_start.handshake_parameters[i]
-                                           .value.record_protocols.arg));
-    }
-    destroy_repeated_field_list_string(static_cast<repeated_field*>(
-        req->server_start.application_protocols.arg));
-    if (req->server_start.has_local_endpoint) {
-      destroy_slice(static_cast<grpc_slice*>(
-          req->server_start.local_endpoint.ip_address.arg));
-    }
-    if (req->server_start.has_remote_endpoint) {
-      destroy_slice(static_cast<grpc_slice*>(
-          req->server_start.remote_endpoint.ip_address.arg));
-    }
-    destroy_slice(static_cast<grpc_slice*>(req->server_start.in_bytes.arg));
-  } else {
-    /* Destroy next request. */
-    destroy_slice(static_cast<grpc_slice*>(req->next.in_bytes.arg));
-  }
-  gpr_free(req);
-}
-
-bool grpc_gcp_handshaker_req_set_handshake_protocol(
-    grpc_gcp_handshaker_req* req,
-    grpc_gcp_handshake_protocol handshake_protocol) {
-  if (req == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_set_handshake_protocol().");
-    return false;
-  }
-  req->client_start.has_handshake_security_protocol = true;
-  req->client_start.handshake_security_protocol = handshake_protocol;
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_set_target_name(grpc_gcp_handshaker_req* req,
-                                             const char* target_name) {
-  if (req == nullptr || target_name == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_set_target_name().");
-    return false;
-  }
-  grpc_slice* slice = create_slice(target_name, strlen(target_name));
-  req->client_start.target_name.arg = slice;
-  req->client_start.target_name.funcs.encode = encode_string_or_bytes_cb;
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_add_application_protocol(
-    grpc_gcp_handshaker_req* req, const char* application_protocol) {
-  if (req == nullptr || application_protocol == nullptr || req->has_next) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_add_application_protocol().");
-    return false;
-  }
-  grpc_slice* slice =
-      create_slice(application_protocol, strlen(application_protocol));
-  if (req->has_client_start) {
-    add_repeated_field(reinterpret_cast<repeated_field**>(
-                           &req->client_start.application_protocols.arg),
-                       slice);
-    req->client_start.application_protocols.funcs.encode =
-        encode_repeated_string_cb;
-  } else {
-    add_repeated_field(reinterpret_cast<repeated_field**>(
-                           &req->server_start.application_protocols.arg),
-                       slice);
-    req->server_start.application_protocols.funcs.encode =
-        encode_repeated_string_cb;
-  }
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_add_record_protocol(grpc_gcp_handshaker_req* req,
-                                                 const char* record_protocol) {
-  if (req == nullptr || record_protocol == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_add_record_protocol().");
-    return false;
-  }
-  grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol));
-  add_repeated_field(reinterpret_cast<repeated_field**>(
-                         &req->client_start.record_protocols.arg),
-                     slice);
-  req->client_start.record_protocols.funcs.encode = encode_repeated_string_cb;
-  return true;
-}
-
-static void set_identity_hostname(grpc_gcp_identity* identity,
-                                  const char* hostname) {
-  grpc_slice* slice = create_slice(hostname, strlen(hostname));
-  identity->hostname.arg = slice;
-  identity->hostname.funcs.encode = encode_string_or_bytes_cb;
-}
-
-static void set_identity_service_account(grpc_gcp_identity* identity,
-                                         const char* service_account) {
-  grpc_slice* slice = create_slice(service_account, strlen(service_account));
-  identity->service_account.arg = slice;
-  identity->service_account.funcs.encode = encode_string_or_bytes_cb;
-}
-
-bool grpc_gcp_handshaker_req_add_target_identity_hostname(
-    grpc_gcp_handshaker_req* req, const char* hostname) {
-  if (req == nullptr || hostname == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr arguments to "
-            "grpc_gcp_handshaker_req_add_target_identity_hostname().");
-    return false;
-  }
-  grpc_gcp_identity* target_identity =
-      static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*target_identity)));
-  set_identity_hostname(target_identity, hostname);
-  req->client_start.target_identities.funcs.encode =
-      encode_repeated_identity_cb;
-  add_repeated_field(reinterpret_cast<repeated_field**>(
-                         &req->client_start.target_identities.arg),
-                     target_identity);
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_add_target_identity_service_account(
-    grpc_gcp_handshaker_req* req, const char* service_account) {
-  if (req == nullptr || service_account == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr arguments to "
-            "grpc_gcp_handshaker_req_add_target_identity_service_account().");
-    return false;
-  }
-  grpc_gcp_identity* target_identity =
-      static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*target_identity)));
-  set_identity_service_account(target_identity, service_account);
-  req->client_start.target_identities.funcs.encode =
-      encode_repeated_identity_cb;
-  add_repeated_field(reinterpret_cast<repeated_field**>(
-                         &req->client_start.target_identities.arg),
-                     target_identity);
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_set_local_identity_hostname(
-    grpc_gcp_handshaker_req* req, const char* hostname) {
-  if (req == nullptr || hostname == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr arguments to "
-            "grpc_gcp_handshaker_req_set_local_identity_hostname().");
-    return false;
-  }
-  req->client_start.has_local_identity = true;
-  set_identity_hostname(&req->client_start.local_identity, hostname);
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_set_local_identity_service_account(
-    grpc_gcp_handshaker_req* req, const char* service_account) {
-  if (req == nullptr || service_account == nullptr || !req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr arguments to "
-            "grpc_gcp_handshaker_req_set_local_identity_service_account().");
-    return false;
-  }
-  req->client_start.has_local_identity = true;
-  set_identity_service_account(&req->client_start.local_identity,
-                               service_account);
-  return true;
-}
-
-static void set_endpoint(grpc_gcp_endpoint* endpoint, const char* ip_address,
-                         size_t port, grpc_gcp_network_protocol protocol) {
-  grpc_slice* slice = create_slice(ip_address, strlen(ip_address));
-  endpoint->ip_address.arg = slice;
-  endpoint->ip_address.funcs.encode = encode_string_or_bytes_cb;
-  endpoint->has_port = true;
-  endpoint->port = static_cast<int32_t>(port);
-  endpoint->has_protocol = true;
-  endpoint->protocol = protocol;
-}
-
-bool grpc_gcp_handshaker_req_set_rpc_versions(grpc_gcp_handshaker_req* req,
-                                              uint32_t max_major,
-                                              uint32_t max_minor,
-                                              uint32_t min_major,
-                                              uint32_t min_minor) {
-  if (req == nullptr || req->has_next) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_set_rpc_versions().");
-    return false;
-  }
-  if (req->has_client_start) {
-    req->client_start.has_rpc_versions = true;
-    grpc_gcp_rpc_protocol_versions_set_max(&req->client_start.rpc_versions,
-                                           max_major, max_minor);
-    grpc_gcp_rpc_protocol_versions_set_min(&req->client_start.rpc_versions,
-                                           min_major, min_minor);
-  } else {
-    req->server_start.has_rpc_versions = true;
-    grpc_gcp_rpc_protocol_versions_set_max(&req->server_start.rpc_versions,
-                                           max_major, max_minor);
-    grpc_gcp_rpc_protocol_versions_set_min(&req->server_start.rpc_versions,
-                                           min_major, min_minor);
-  }
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_set_local_endpoint(
-    grpc_gcp_handshaker_req* req, const char* ip_address, size_t port,
-    grpc_gcp_network_protocol protocol) {
-  if (req == nullptr || ip_address == nullptr || port > 65535 ||
-      req->has_next) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_set_local_endpoint().");
-    return false;
-  }
-  if (req->has_client_start) {
-    req->client_start.has_local_endpoint = true;
-    set_endpoint(&req->client_start.local_endpoint, ip_address, port, protocol);
-  } else {
-    req->server_start.has_local_endpoint = true;
-    set_endpoint(&req->server_start.local_endpoint, ip_address, port, protocol);
-  }
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_set_remote_endpoint(
-    grpc_gcp_handshaker_req* req, const char* ip_address, size_t port,
-    grpc_gcp_network_protocol protocol) {
-  if (req == nullptr || ip_address == nullptr || port > 65535 ||
-      req->has_next) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_set_remote_endpoint().");
-    return false;
-  }
-  if (req->has_client_start) {
-    req->client_start.has_remote_endpoint = true;
-    set_endpoint(&req->client_start.remote_endpoint, ip_address, port,
-                 protocol);
-  } else {
-    req->server_start.has_remote_endpoint = true;
-    set_endpoint(&req->server_start.remote_endpoint, ip_address, port,
-                 protocol);
-  }
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_set_in_bytes(grpc_gcp_handshaker_req* req,
-                                          const char* in_bytes, size_t size) {
-  if (req == nullptr || in_bytes == nullptr || req->has_client_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_set_in_bytes().");
-    return false;
-  }
-  grpc_slice* slice = create_slice(in_bytes, size);
-  if (req->has_next) {
-    req->next.in_bytes.arg = slice;
-    req->next.in_bytes.funcs.encode = &encode_string_or_bytes_cb;
-  } else {
-    req->server_start.in_bytes.arg = slice;
-    req->server_start.in_bytes.funcs.encode = &encode_string_or_bytes_cb;
-  }
-  return true;
-}
-
-static grpc_gcp_server_handshake_parameters* server_start_find_param(
-    grpc_gcp_handshaker_req* req, int32_t key) {
-  size_t i = 0;
-  for (i = 0; i < req->server_start.handshake_parameters_count; i++) {
-    if (req->server_start.handshake_parameters[i].key == key) {
-      return &req->server_start.handshake_parameters[i].value;
-    }
-  }
-  req->server_start
-      .handshake_parameters[req->server_start.handshake_parameters_count]
-      .has_key = true;
-  req->server_start
-      .handshake_parameters[req->server_start.handshake_parameters_count]
-      .has_value = true;
-  req->server_start
-      .handshake_parameters[req->server_start.handshake_parameters_count++]
-      .key = key;
-  return &req->server_start
-              .handshake_parameters
-                  [req->server_start.handshake_parameters_count - 1]
-              .value;
-}
-
-bool grpc_gcp_handshaker_req_param_add_record_protocol(
-    grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
-    const char* record_protocol) {
-  if (req == nullptr || record_protocol == nullptr || !req->has_server_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_param_add_record_protocol().");
-    return false;
-  }
-  grpc_gcp_server_handshake_parameters* param =
-      server_start_find_param(req, key);
-  grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol));
-  add_repeated_field(
-      reinterpret_cast<repeated_field**>(&param->record_protocols.arg), slice);
-  param->record_protocols.funcs.encode = &encode_repeated_string_cb;
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_param_add_local_identity_hostname(
-    grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
-    const char* hostname) {
-  if (req == nullptr || hostname == nullptr || !req->has_server_start) {
-    gpr_log(GPR_ERROR,
-            "Invalid arguments to "
-            "grpc_gcp_handshaker_req_param_add_local_identity_hostname().");
-    return false;
-  }
-  grpc_gcp_server_handshake_parameters* param =
-      server_start_find_param(req, key);
-  grpc_gcp_identity* local_identity =
-      static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*local_identity)));
-  set_identity_hostname(local_identity, hostname);
-  add_repeated_field(
-      reinterpret_cast<repeated_field**>(&param->local_identities.arg),
-      local_identity);
-  param->local_identities.funcs.encode = &encode_repeated_identity_cb;
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_param_add_local_identity_service_account(
-    grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
-    const char* service_account) {
-  if (req == nullptr || service_account == nullptr || !req->has_server_start) {
-    gpr_log(
-        GPR_ERROR,
-        "Invalid arguments to "
-        "grpc_gcp_handshaker_req_param_add_local_identity_service_account().");
-    return false;
-  }
-  grpc_gcp_server_handshake_parameters* param =
-      server_start_find_param(req, key);
-  grpc_gcp_identity* local_identity =
-      static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*local_identity)));
-  set_identity_service_account(local_identity, service_account);
-  add_repeated_field(
-      reinterpret_cast<repeated_field**>(&param->local_identities.arg),
-      local_identity);
-  param->local_identities.funcs.encode = &encode_repeated_identity_cb;
-  return true;
-}
-
-bool grpc_gcp_handshaker_req_encode(grpc_gcp_handshaker_req* req,
-                                    grpc_slice* slice) {
-  if (req == nullptr || slice == nullptr) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr arguments to grpc_gcp_handshaker_req_encode().");
-    return false;
-  }
-  pb_ostream_t size_stream;
-  memset(&size_stream, 0, sizeof(pb_ostream_t));
-  if (!pb_encode(&size_stream, grpc_gcp_HandshakerReq_fields, req)) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream));
-    return false;
-  }
-  size_t encoded_length = size_stream.bytes_written;
-  *slice = grpc_slice_malloc(encoded_length);
-  pb_ostream_t output_stream =
-      pb_ostream_from_buffer(GRPC_SLICE_START_PTR(*slice), encoded_length);
-  if (!pb_encode(&output_stream, grpc_gcp_HandshakerReq_fields, req) != 0) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&output_stream));
-    return false;
-  }
-  return true;
-}
-
-/* HandshakerResp. */
-grpc_gcp_handshaker_resp* grpc_gcp_handshaker_resp_create(void) {
-  grpc_gcp_handshaker_resp* resp =
-      static_cast<grpc_gcp_handshaker_resp*>(gpr_zalloc(sizeof(*resp)));
-  return resp;
-}
-
-void grpc_gcp_handshaker_resp_destroy(grpc_gcp_handshaker_resp* resp) {
-  if (resp != nullptr) {
-    destroy_slice(static_cast<grpc_slice*>(resp->out_frames.arg));
-    if (resp->has_status) {
-      destroy_slice(static_cast<grpc_slice*>(resp->status.details.arg));
-    }
-    if (resp->has_result) {
-      destroy_slice(
-          static_cast<grpc_slice*>(resp->result.application_protocol.arg));
-      destroy_slice(static_cast<grpc_slice*>(resp->result.record_protocol.arg));
-      destroy_slice(static_cast<grpc_slice*>(resp->result.key_data.arg));
-      if (resp->result.has_local_identity) {
-        destroy_slice(
-            static_cast<grpc_slice*>(resp->result.local_identity.hostname.arg));
-        destroy_slice(static_cast<grpc_slice*>(
-            resp->result.local_identity.service_account.arg));
-      }
-      if (resp->result.has_peer_identity) {
-        destroy_slice(
-            static_cast<grpc_slice*>(resp->result.peer_identity.hostname.arg));
-        destroy_slice(static_cast<grpc_slice*>(
-            resp->result.peer_identity.service_account.arg));
-      }
-    }
-    gpr_free(resp);
-  }
-}
-
-bool grpc_gcp_handshaker_resp_decode(grpc_slice encoded_handshaker_resp,
-                                     grpc_gcp_handshaker_resp* resp) {
-  if (resp == nullptr) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr argument to grpc_gcp_handshaker_resp_decode().");
-    return false;
-  }
-  pb_istream_t stream =
-      pb_istream_from_buffer(GRPC_SLICE_START_PTR(encoded_handshaker_resp),
-                             GRPC_SLICE_LENGTH(encoded_handshaker_resp));
-  resp->out_frames.funcs.decode = decode_string_or_bytes_cb;
-  resp->status.details.funcs.decode = decode_string_or_bytes_cb;
-  resp->result.application_protocol.funcs.decode = decode_string_or_bytes_cb;
-  resp->result.record_protocol.funcs.decode = decode_string_or_bytes_cb;
-  resp->result.key_data.funcs.decode = decode_string_or_bytes_cb;
-  resp->result.peer_identity.hostname.funcs.decode = decode_string_or_bytes_cb;
-  resp->result.peer_identity.service_account.funcs.decode =
-      decode_string_or_bytes_cb;
-  resp->result.local_identity.hostname.funcs.decode = decode_string_or_bytes_cb;
-  resp->result.local_identity.service_account.funcs.decode =
-      decode_string_or_bytes_cb;
-  if (!pb_decode(&stream, grpc_gcp_HandshakerResp_fields, resp)) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
-    return false;
-  }
-  return true;
-}
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h
deleted file mode 100644 (file)
index 5df56a8..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_H
-#define GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_H
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h"
-
-/**
- * An implementation of nanopb thin wrapper used to set/get and
- * serialize/de-serialize of ALTS handshake requests and responses.
- *
- * All APIs in the header are thread-compatible. A typical usage of this API at
- * the client side is as follows:
- *
- * -----------------------------------------------------------------------------
- * // Create, populate, and serialize an ALTS client_start handshake request to
- * // send to the server.
- * grpc_gcp_handshaker_req* req =
- *     grpc_gcp_handshaker_req_create(CLIENT_START_REQ);
- * grpc_gcp_handshaker_req_set_handshake_protocol(
-       req, grpc_gcp_HandshakeProtocol_ALTS);
- * grpc_gcp_handshaker_req_add_application_protocol(req, "grpc");
- * grpc_gcp_handshaker_req_add_record_protocol(req, "ALTSRP_GCM_AES128");
- * grpc_slice client_slice;
- * if (!grpc_gcp_handshaker_req_encode(req, &client_slice)) {
- *   fprintf(stderr, "ALTS handshake request encoding failed.";
- * }
- *
- * // De-serialize a data stream received from the server, and store the result
- * // at ALTS handshake response.
- * grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create();
- * if (!grpc_gcp_handshaker_resp_decode(server_slice, resp)) {
- *    fprintf(stderr, "ALTS handshake response decoding failed.");
- * }
- * // To access a variable-length datatype field (i.e., pb_callback_t),
- * // access its "arg" subfield (if it has been set).
- * if (resp->out_frames.arg != nullptr) {
- *   grpc_slice* slice = resp->out_frames.arg;
- * }
- * // To access a fixed-length datatype field (i.e., not pb_calback_t),
- * // access the field directly (if it has been set).
- * if (resp->has_status && resp->status->has_code) {
- *   uint32_t code = resp->status->code;
- * }
- *------------------------------------------------------------------------------
- */
-
-/**
- * This method creates an ALTS handshake request.
- *
- * - type: an enum type value that can be either CLIENT_START_REQ,
- *   SERVER_START_REQ, or NEXT_REQ to indicate the created instance will be
- *   client_start, server_start, and next handshake request message
- * respectively.
- *
- * The method returns a pointer to the created instance.
- */
-grpc_gcp_handshaker_req* grpc_gcp_handshaker_req_create(
-    grpc_gcp_handshaker_req_type type);
-
-/**
- * This method sets the value for handshake_security_protocol field of ALTS
- * client_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - handshake_protocol: a enum type value representing the handshake security
- *   protocol.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_handshake_protocol(
-    grpc_gcp_handshaker_req* req,
-    grpc_gcp_handshake_protocol handshake_protocol);
-
-/**
- * This method sets the value for target_name field of ALTS client_start
- * handshake request.
- *
- * - req: an ALTS handshake request.
- * - target_name: a target name to be set.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_target_name(grpc_gcp_handshaker_req* req,
-                                             const char* target_name);
-
-/**
- * This method adds an application protocol supported by the server (or
- * client) to ALTS server_start (or client_start) handshake request.
- *
- * - req: an ALTS handshake request.
- * - application_protocol: an application protocol (e.g., grpc) to be added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_add_application_protocol(
-    grpc_gcp_handshaker_req* req, const char* application_protocol);
-
-/**
- * This method adds a record protocol supported by the client to ALTS
- * client_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - record_protocol: a record protocol (e.g., ALTSRP_GCM_AES128) to be
- *   added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_add_record_protocol(grpc_gcp_handshaker_req* req,
-                                                 const char* record_protocol);
-
-/**
- * This method adds a target server identity represented as hostname and
- * acceptable by a client to ALTS client_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - hostname: a string representation of hostname at the connection
- *   endpoint to be added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_add_target_identity_hostname(
-    grpc_gcp_handshaker_req* req, const char* hostname);
-
-/**
- * This method adds a target server identity represented as service account and
- * acceptable by a client to ALTS client_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - service_account: a string representation of service account at the
- *   connection endpoint to be added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_add_target_identity_service_account(
-    grpc_gcp_handshaker_req* req, const char* service_account);
-
-/**
- * This method sets the hostname for local_identity field of ALTS client_start
- * handshake request.
- *
- * - req: an ALTS handshake request.
- * - hostname: a string representation of hostname.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_local_identity_hostname(
-    grpc_gcp_handshaker_req* req, const char* hostname);
-
-/**
- * This method sets the service account for local_identity field of ALTS
- * client_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - service_account: a string representation of service account.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_local_identity_service_account(
-    grpc_gcp_handshaker_req* req, const char* service_account);
-
-/**
- * This method sets the value for local_endpoint field of either ALTS
- * client_start or server_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - ip_address: a string representation of ip address associated with the
- *   local endpoint, that could be either IPv4 or IPv6.
- * - port: a port number associated with the local endpoint.
- * - protocol: a network protocol (e.g., TCP or UDP) associated with the
- *   local endpoint.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_local_endpoint(
-    grpc_gcp_handshaker_req* req, const char* ip_address, size_t port,
-    grpc_gcp_network_protocol protocol);
-
-/**
- * This method sets the value for remote_endpoint field of either ALTS
- * client_start or server_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - ip_address: a string representation of ip address associated with the
- *   remote endpoint, that could be either IPv4 or IPv6.
- * - port: a port number associated with the remote endpoint.
- * - protocol: a network protocol (e.g., TCP or UDP) associated with the
- *   remote endpoint.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_remote_endpoint(
-    grpc_gcp_handshaker_req* req, const char* ip_address, size_t port,
-    grpc_gcp_network_protocol protocol);
-
-/**
- * This method sets the value for in_bytes field of either ALTS server_start or
- * next handshake request.
- *
- * - req: an ALTS handshake request.
- * - in_bytes: a buffer containing bytes taken from out_frames of the peer's
- *   ALTS handshake response. It is possible that the peer's out_frames are
- * split into multiple handshake request messages.
- * - size: size of in_bytes buffer.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_in_bytes(grpc_gcp_handshaker_req* req,
-                                          const char* in_bytes, size_t size);
-
-/**
- * This method adds a record protocol to handshake parameters mapped by the
- * handshake protocol for ALTS server_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - key: an enum type value representing a handshake security protocol.
- * - record_protocol: a record protocol to be added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_param_add_record_protocol(
-    grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
-    const char* record_protocol);
-
-/**
- * This method adds a local identity represented as hostname to handshake
- * parameters mapped by the handshake protocol for ALTS server_start handshake
- * request.
- *
- * - req: an ALTS handshake request.
- * - key: an enum type value representing a handshake security protocol.
- * - hostname: a string representation of hostname to be added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_param_add_local_identity_hostname(
-    grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
-    const char* hostname);
-
-/**
- * This method adds a local identity represented as service account to handshake
- * parameters mapped by the handshake protocol for ALTS server_start handshake
- * request.
- *
- * - req: an ALTS handshake request.
- * - key: an enum type value representing a handshake security protocol.
- * - service_account: a string representation of service account to be added.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_param_add_local_identity_service_account(
-    grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
-    const char* service_account);
-
-/**
- * This method sets the value for rpc_versions field of either ALTS
- * client_start or server_start handshake request.
- *
- * - req: an ALTS handshake request.
- * - max_major: a major version of maximum supported RPC version.
- * - max_minor: a minor version of maximum supported RPC version.
- * - min_major: a major version of minimum supported RPC version.
- * - min_minor: a minor version of minimum supported RPC version.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_set_rpc_versions(grpc_gcp_handshaker_req* req,
-                                              uint32_t max_major,
-                                              uint32_t max_minor,
-                                              uint32_t min_major,
-                                              uint32_t min_minor);
-
-/**
- * This method serializes an ALTS handshake request and returns a data stream.
- *
- * - req: an ALTS handshake request.
- * - slice: a data stream where the serialized result will be written.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_req_encode(grpc_gcp_handshaker_req* req,
-                                    grpc_slice* slice);
-
-/* This method destroys an ALTS handshake request. */
-void grpc_gcp_handshaker_req_destroy(grpc_gcp_handshaker_req* req);
-
-/* This method creates an ALTS handshake response. */
-grpc_gcp_handshaker_resp* grpc_gcp_handshaker_resp_create(void);
-
-/**
- * This method de-serializes a data stream and stores the result
- * in an ALTS handshake response.
- *
- * - slice: a data stream containing a serialized ALTS handshake response.
- * - resp: an ALTS handshake response used to hold de-serialized result.
- *
- * The method returns true on success and false otherwise.
- */
-bool grpc_gcp_handshaker_resp_decode(grpc_slice slice,
-                                     grpc_gcp_handshaker_resp* resp);
-
-/* This method destroys an ALTS handshake response. */
-void grpc_gcp_handshaker_resp_destroy(grpc_gcp_handshaker_resp* resp);
-
-#endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_H */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc
deleted file mode 100644 (file)
index d63d353..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h"
-
-#include "src/core/lib/slice/slice_internal.h"
-
-void add_repeated_field(repeated_field** head, const void* data) {
-  repeated_field* field =
-      static_cast<repeated_field*>(gpr_zalloc(sizeof(*field)));
-  field->data = data;
-  if (*head == nullptr) {
-    *head = field;
-    (*head)->next = nullptr;
-  } else {
-    field->next = *head;
-    *head = field;
-  }
-}
-
-void destroy_repeated_field_list_identity(repeated_field* head) {
-  repeated_field* field = head;
-  while (field != nullptr) {
-    repeated_field* next_field = field->next;
-    const grpc_gcp_identity* identity =
-        static_cast<const grpc_gcp_identity*>(field->data);
-    destroy_slice(static_cast<grpc_slice*>(identity->hostname.arg));
-    destroy_slice(static_cast<grpc_slice*>(identity->service_account.arg));
-    gpr_free((void*)identity);
-    gpr_free(field);
-    field = next_field;
-  }
-}
-
-void destroy_repeated_field_list_string(repeated_field* head) {
-  repeated_field* field = head;
-  while (field != nullptr) {
-    repeated_field* next_field = field->next;
-    destroy_slice((grpc_slice*)field->data);
-    gpr_free(field);
-    field = next_field;
-  }
-}
-
-grpc_slice* create_slice(const char* data, size_t size) {
-  grpc_slice slice = grpc_slice_from_copied_buffer(data, size);
-  grpc_slice* cb_slice =
-      static_cast<grpc_slice*>(gpr_zalloc(sizeof(*cb_slice)));
-  memcpy(cb_slice, &slice, sizeof(*cb_slice));
-  return cb_slice;
-}
-
-void destroy_slice(grpc_slice* slice) {
-  if (slice != nullptr) {
-    grpc_slice_unref_internal(*slice);
-    gpr_free(slice);
-  }
-}
-
-bool encode_string_or_bytes_cb(pb_ostream_t* stream, const pb_field_t* field,
-                               void* const* arg) {
-  grpc_slice* slice = static_cast<grpc_slice*>(*arg);
-  if (!pb_encode_tag_for_field(stream, field)) return false;
-  return pb_encode_string(stream, GRPC_SLICE_START_PTR(*slice),
-                          GRPC_SLICE_LENGTH(*slice));
-}
-
-bool encode_repeated_identity_cb(pb_ostream_t* stream, const pb_field_t* field,
-                                 void* const* arg) {
-  repeated_field* var = static_cast<repeated_field*>(*arg);
-  while (var != nullptr) {
-    if (!pb_encode_tag_for_field(stream, field)) return false;
-    if (!pb_encode_submessage(stream, grpc_gcp_Identity_fields,
-                              (grpc_gcp_identity*)var->data))
-      return false;
-    var = var->next;
-  }
-  return true;
-}
-
-bool encode_repeated_string_cb(pb_ostream_t* stream, const pb_field_t* field,
-                               void* const* arg) {
-  repeated_field* var = static_cast<repeated_field*>(*arg);
-  while (var != nullptr) {
-    if (!pb_encode_tag_for_field(stream, field)) return false;
-    const grpc_slice* slice = static_cast<const grpc_slice*>(var->data);
-    if (!pb_encode_string(stream, GRPC_SLICE_START_PTR(*slice),
-                          GRPC_SLICE_LENGTH(*slice)))
-      return false;
-    var = var->next;
-  }
-  return true;
-}
-
-bool decode_string_or_bytes_cb(pb_istream_t* stream, const pb_field_t* field,
-                               void** arg) {
-  grpc_slice slice = grpc_slice_malloc(stream->bytes_left);
-  grpc_slice* cb_slice =
-      static_cast<grpc_slice*>(gpr_zalloc(sizeof(*cb_slice)));
-  memcpy(cb_slice, &slice, sizeof(*cb_slice));
-  if (!pb_read(stream, GRPC_SLICE_START_PTR(*cb_slice), stream->bytes_left))
-    return false;
-  *arg = cb_slice;
-  return true;
-}
-
-bool decode_repeated_identity_cb(pb_istream_t* stream, const pb_field_t* field,
-                                 void** arg) {
-  grpc_gcp_identity* identity =
-      static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*identity)));
-  identity->hostname.funcs.decode = decode_string_or_bytes_cb;
-  identity->service_account.funcs.decode = decode_string_or_bytes_cb;
-  add_repeated_field(reinterpret_cast<repeated_field**>(arg), identity);
-  if (!pb_decode(stream, grpc_gcp_Identity_fields, identity)) return false;
-  return true;
-}
-
-bool decode_repeated_string_cb(pb_istream_t* stream, const pb_field_t* field,
-                               void** arg) {
-  grpc_slice slice = grpc_slice_malloc(stream->bytes_left);
-  grpc_slice* cb_slice =
-      static_cast<grpc_slice*>(gpr_zalloc(sizeof(*cb_slice)));
-  memcpy(cb_slice, &slice, sizeof(grpc_slice));
-  if (!pb_read(stream, GRPC_SLICE_START_PTR(*cb_slice), stream->bytes_left))
-    return false;
-  add_repeated_field(reinterpret_cast<repeated_field**>(arg), cb_slice);
-  return true;
-}
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h
deleted file mode 100644 (file)
index 966ea45..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_UTIL_H
-#define GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_UTIL_H
-
-#include <grpc/support/port_platform.h>
-
-#include "pb_decode.h"
-#include "pb_encode.h"
-
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-
-#include "src/core/tsi/alts/handshaker/handshaker.pb.h"
-
-/**
- * An implementation of utility functions used to serialize/
- * de-serialize ALTS handshake requests/responses. All APIs in the header
- * are thread-compatible.
- */
-
-/* Renaming of message/field structs generated by nanopb compiler. */
-typedef grpc_gcp_HandshakeProtocol grpc_gcp_handshake_protocol;
-typedef grpc_gcp_NetworkProtocol grpc_gcp_network_protocol;
-typedef grpc_gcp_Identity grpc_gcp_identity;
-typedef grpc_gcp_NextHandshakeMessageReq grpc_gcp_next_handshake_message_req;
-typedef grpc_gcp_ServerHandshakeParameters grpc_gcp_server_handshake_parameters;
-typedef grpc_gcp_Endpoint grpc_gcp_endpoint;
-typedef grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry
-    grpc_gcp_handshake_parameters_entry;
-typedef grpc_gcp_StartClientHandshakeReq grpc_gcp_start_client_handshake_req;
-typedef grpc_gcp_StartServerHandshakeReq grpc_gcp_start_server_handshake_req;
-typedef grpc_gcp_HandshakerReq grpc_gcp_handshaker_req;
-typedef grpc_gcp_HandshakerResult grpc_gcp_handshaker_result;
-typedef grpc_gcp_HandshakerStatus grpc_gcp_handshaker_status;
-typedef grpc_gcp_HandshakerResp grpc_gcp_handshaker_resp;
-
-typedef enum {
-  CLIENT_START_REQ = 0, /* StartClientHandshakeReq. */
-  SERVER_START_REQ = 1, /* StartServerHandshakeReq. */
-  NEXT_REQ = 2,         /* NextHandshakeMessageReq. */
-} grpc_gcp_handshaker_req_type;
-
-/**
- *  A struct representing a repeated field. The struct is used to organize all
- *  instances of a specific repeated field into a linked list, which then will
- *  be used at encode/decode phase. For instance at the encode phase, the encode
- *  function will iterate through the list, encode each field, and then output
- *  the result to the stream.
- */
-typedef struct repeated_field_ {
-  struct repeated_field_* next;
-  const void* data;
-} repeated_field;
-
-/**
- * This method adds a repeated field to the head of repeated field list.
- *
- * - head: a head of repeated field list.
- * - field: a repeated field to be added to the list.
- */
-void add_repeated_field(repeated_field** head, const void* field);
-
-/**
- * This method destroys a repeated field list that consists of string type
- * fields.
- *
- * - head: a head of repeated field list.
- */
-void destroy_repeated_field_list_string(repeated_field* head);
-
-/**
- * This method destroys a repeated field list that consists of
- * grpc_gcp_identity type fields.
- *
- * - head: a head of repeated field list.
- */
-void destroy_repeated_field_list_identity(repeated_field* head);
-
-/**
- * This method creates a grpc_slice instance by copying a data buffer. It is
- * similar to grpc_slice_from_copied_buffer() except that it returns an instance
- * allocated from the heap.
- *
- * - data: a data buffer to be copied to grpc_slice instance.
- * - size: size of data buffer.
- */
-grpc_slice* create_slice(const char* data, size_t size);
-
-/* This method destroys a grpc_slice instance. */
-void destroy_slice(grpc_slice* slice);
-
-/**
- * The following encode/decode functions will be assigned to encode/decode
- * function pointers of pb_callback_t struct (defined in
- * //third_party/nanopb/pb.h), that represent a repeated field with a dynamic
- * length (e.g., a string type or repeated field).
- */
-
-/* This method is an encode callback function for a string or byte array. */
-bool encode_string_or_bytes_cb(pb_ostream_t* stream, const pb_field_t* field,
-                               void* const* arg);
-
-/**
- * This method is an encode callback function for a repeated grpc_gcp_identity
- * field.
- */
-bool encode_repeated_identity_cb(pb_ostream_t* stream, const pb_field_t* field,
-                                 void* const* arg);
-
-/* This method is an encode callback function for a repeated string field. */
-bool encode_repeated_string_cb(pb_ostream_t* stream, const pb_field_t* field,
-                               void* const* arg);
-
-/**
- * This method is a decode callback function for a string or byte array field.
- */
-bool decode_string_or_bytes_cb(pb_istream_t* stream, const pb_field_t* field,
-                               void** arg);
-/**
- * This method is a decode callback function for a repeated grpc_gcp_identity
- * field.
- */
-bool decode_repeated_identity_cb(pb_istream_t* stream, const pb_field_t* field,
-                                 void** arg);
-
-/* This method is a decode callback function for a repeated string field. */
-bool decode_repeated_string_cb(pb_istream_t* stream, const pb_field_t* field,
-                               void** arg);
-
-#endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_SERVICE_API_UTIL_H */
index 1b7e58d..c5383b3 100644 (file)
@@ -30,7 +30,6 @@
 #include <grpc/support/sync.h>
 #include <grpc/support/thd_id.h>
 
-#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gprpp/thd.h"
 #include "src/core/lib/iomgr/closure.h"
 #include "src/core/lib/slice/slice_internal.h"
@@ -193,38 +192,49 @@ static const tsi_handshaker_result_vtable result_vtable = {
     handshaker_result_create_frame_protector,
     handshaker_result_get_unused_bytes, handshaker_result_destroy};
 
-tsi_result alts_tsi_handshaker_result_create(grpc_gcp_handshaker_resp* resp,
+tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp,
                                              bool is_client,
                                              tsi_handshaker_result** self) {
   if (self == nullptr || resp == nullptr) {
     gpr_log(GPR_ERROR, "Invalid arguments to create_handshaker_result()");
     return TSI_INVALID_ARGUMENT;
   }
-  grpc_slice* key = static_cast<grpc_slice*>(resp->result.key_data.arg);
-  GPR_ASSERT(key != nullptr);
-  grpc_slice* identity =
-      static_cast<grpc_slice*>(resp->result.peer_identity.service_account.arg);
+  const grpc_gcp_HandshakerResult* hresult =
+      grpc_gcp_HandshakerResp_result(resp);
+  const grpc_gcp_Identity* identity =
+      grpc_gcp_HandshakerResult_peer_identity(hresult);
   if (identity == nullptr) {
+    gpr_log(GPR_ERROR, "Invalid identity");
+    return TSI_FAILED_PRECONDITION;
+  }
+  upb_strview service_account = grpc_gcp_Identity_service_account(identity);
+  if (service_account.size == 0) {
     gpr_log(GPR_ERROR, "Invalid service account");
     return TSI_FAILED_PRECONDITION;
   }
-  if (GRPC_SLICE_LENGTH(*key) < kAltsAes128GcmRekeyKeyLength) {
+  upb_strview key_data = grpc_gcp_HandshakerResult_key_data(hresult);
+  if (key_data.size < kAltsAes128GcmRekeyKeyLength) {
     gpr_log(GPR_ERROR, "Bad key length");
     return TSI_FAILED_PRECONDITION;
   }
+  const grpc_gcp_RpcProtocolVersions* peer_rpc_version =
+      grpc_gcp_HandshakerResult_peer_rpc_versions(hresult);
+  if (peer_rpc_version == nullptr) {
+    gpr_log(GPR_ERROR, "Peer does not set RPC protocol versions.");
+    return TSI_FAILED_PRECONDITION;
+  }
   alts_tsi_handshaker_result* result =
       static_cast<alts_tsi_handshaker_result*>(gpr_zalloc(sizeof(*result)));
   result->key_data =
       static_cast<char*>(gpr_zalloc(kAltsAes128GcmRekeyKeyLength));
-  memcpy(result->key_data, GRPC_SLICE_START_PTR(*key),
-         kAltsAes128GcmRekeyKeyLength);
-  result->peer_identity = grpc_slice_to_c_string(*identity);
-  if (!resp->result.has_peer_rpc_versions) {
-    gpr_log(GPR_ERROR, "Peer does not set RPC protocol versions.");
-    return TSI_FAILED_PRECONDITION;
-  }
-  if (!grpc_gcp_rpc_protocol_versions_encode(&resp->result.peer_rpc_versions,
-                                             &result->rpc_versions)) {
+  memcpy(result->key_data, key_data.data, kAltsAes128GcmRekeyKeyLength);
+  result->peer_identity =
+      static_cast<char*>(gpr_zalloc(service_account.size + 1));
+  memcpy(result->peer_identity, service_account.data, service_account.size);
+  upb::Arena arena;
+  bool serialized = grpc_gcp_rpc_protocol_versions_encode(
+      peer_rpc_version, arena.ptr(), &result->rpc_versions);
+  if (!serialized) {
     gpr_log(GPR_ERROR, "Failed to serialize peer's RPC protocol versions.");
     return TSI_FAILED_PRECONDITION;
   }
@@ -241,7 +251,14 @@ static void on_handshaker_service_resp_recv(void* arg, grpc_error* error) {
     gpr_log(GPR_ERROR, "ALTS handshaker client is nullptr");
     return;
   }
-  alts_handshaker_client_handle_response(client, true);
+  bool success = true;
+  if (error != GRPC_ERROR_NONE) {
+    gpr_log(GPR_ERROR,
+            "ALTS handshaker on_handshaker_service_resp_recv error: %s",
+            grpc_error_string(error));
+    success = false;
+  }
+  alts_handshaker_client_handle_response(client, success);
 }
 
 /* gRPC provided callback used when dedicatd CQ and thread are used.
index 32f94bc..6be45d7 100644 (file)
@@ -26,9 +26,9 @@
 #include "src/core/lib/iomgr/pollset_set.h"
 #include "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h"
 #include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
-#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h"
 #include "src/core/tsi/transport_security.h"
 #include "src/core/tsi/transport_security_interface.h"
+#include "src/proto/grpc/gcp/handshaker.upb.h"
 
 #define TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY "service_accont"
 #define TSI_ALTS_CERTIFICATE_TYPE "ALTS"
@@ -70,7 +70,7 @@ tsi_result alts_tsi_handshaker_create(
  *   client or not.
  * - result: address of ALTS TSI handshaker result instance.
  */
-tsi_result alts_tsi_handshaker_result_create(grpc_gcp_handshaker_resp* resp,
+tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp,
                                              bool is_client,
                                              tsi_handshaker_result** result);
 
index 1747f1a..f80498d 100644 (file)
@@ -41,18 +41,22 @@ tsi_result alts_tsi_utils_convert_to_tsi_result(grpc_status_code code) {
   }
 }
 
-grpc_gcp_handshaker_resp* alts_tsi_utils_deserialize_response(
-    grpc_byte_buffer* resp_buffer) {
+grpc_gcp_HandshakerResp* alts_tsi_utils_deserialize_response(
+    grpc_byte_buffer* resp_buffer, upb_arena* arena) {
   GPR_ASSERT(resp_buffer != nullptr);
+  GPR_ASSERT(arena != nullptr);
   grpc_byte_buffer_reader bbr;
   grpc_byte_buffer_reader_init(&bbr, resp_buffer);
   grpc_slice slice = grpc_byte_buffer_reader_readall(&bbr);
-  grpc_gcp_handshaker_resp* resp = grpc_gcp_handshaker_resp_create();
-  bool ok = grpc_gcp_handshaker_resp_decode(slice, resp);
+  size_t buf_size = GPR_SLICE_LENGTH(slice);
+  void* buf = upb_arena_malloc(arena, buf_size);
+  memcpy(buf, reinterpret_cast<const char*>(GPR_SLICE_START_PTR(slice)),
+         buf_size);
+  grpc_gcp_HandshakerResp* resp = grpc_gcp_HandshakerResp_parse(
+      reinterpret_cast<char*>(buf), buf_size, arena);
   grpc_slice_unref_internal(slice);
   grpc_byte_buffer_reader_destroy(&bbr);
-  if (!ok) {
-    grpc_gcp_handshaker_resp_destroy(resp);
+  if (resp == nullptr) {
     gpr_log(GPR_ERROR, "grpc_gcp_handshaker_resp_decode() failed");
     return nullptr;
   }
index 9ef649d..a20e5e9 100644 (file)
@@ -24,8 +24,8 @@
 #include <grpc/byte_buffer.h>
 #include <grpc/grpc.h>
 
-#include "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h"
 #include "src/core/tsi/transport_security_interface.h"
+#include "src/proto/grpc/gcp/handshaker.upb.h"
 
 /**
  * This method converts grpc_status_code code to the corresponding tsi_result
@@ -42,11 +42,12 @@ tsi_result alts_tsi_utils_convert_to_tsi_result(grpc_status_code code);
  * service.
  *
  * - bytes_received: data returned from ALTS handshaker service.
+ * - arena: upb arena.
  *
  * It returns a deserialized handshaker response on success and nullptr on
  * failure.
  */
-grpc_gcp_handshaker_resp* alts_tsi_utils_deserialize_response(
-    grpc_byte_buffer* resp_buffer);
+grpc_gcp_HandshakerResp* alts_tsi_utils_deserialize_response(
+    grpc_byte_buffer* resp_buffer, upb_arena* arena);
 
 #endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_TSI_UTILS_H */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.c b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.c
deleted file mode 100644 (file)
index 5fb152a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/tsi/alts/handshaker/altscontext.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t grpc_gcp_AltsContext_fields[7] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, CALLBACK, FIRST, grpc_gcp_AltsContext, application_protocol, application_protocol, 0),
-    PB_FIELD(  2, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_AltsContext, record_protocol, application_protocol, 0),
-    PB_FIELD(  3, UENUM   , OPTIONAL, STATIC  , OTHER, grpc_gcp_AltsContext, security_level, record_protocol, 0),
-    PB_FIELD(  4, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_AltsContext, peer_service_account, security_level, 0),
-    PB_FIELD(  5, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_AltsContext, local_service_account, peer_service_account, 0),
-    PB_FIELD(  6, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_AltsContext, peer_rpc_versions, local_service_account, &grpc_gcp_RpcProtocolVersions_fields),
-    PB_LAST_FIELD
-};
-
-
-/* Check that field information fits in pb_field_t */
-#if !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_32BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in 8 or 16 bit
- * field descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_gcp_AltsContext, peer_rpc_versions) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_AltsContext)
-#endif
-
-#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_16BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in the default
- * 8 bit descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_gcp_AltsContext, peer_rpc_versions) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_AltsContext)
-#endif
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.h b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/altscontext.pb.h
deleted file mode 100644 (file)
index 632b20c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GRPC_GCP_ALTSCONTEXT_PB_H_INCLUDED
-#define PB_GRPC_GCP_ALTSCONTEXT_PB_H_INCLUDED
-#include "pb.h"
-#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Struct definitions */
-typedef struct _grpc_gcp_AltsContext {
-    pb_callback_t application_protocol;
-    pb_callback_t record_protocol;
-    bool has_security_level;
-    grpc_gcp_SecurityLevel security_level;
-    pb_callback_t peer_service_account;
-    pb_callback_t local_service_account;
-    bool has_peer_rpc_versions;
-    grpc_gcp_RpcProtocolVersions peer_rpc_versions;
-/* @@protoc_insertion_point(struct:grpc_gcp_AltsContext) */
-} grpc_gcp_AltsContext;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define grpc_gcp_AltsContext_init_default        {{{NULL}, NULL}, {{NULL}, NULL}, false, (grpc_gcp_SecurityLevel)0, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_default}
-#define grpc_gcp_AltsContext_init_zero           {{{NULL}, NULL}, {{NULL}, NULL}, false, (grpc_gcp_SecurityLevel)0, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_zero}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define grpc_gcp_AltsContext_application_protocol_tag 1
-#define grpc_gcp_AltsContext_record_protocol_tag 2
-#define grpc_gcp_AltsContext_security_level_tag  3
-#define grpc_gcp_AltsContext_peer_service_account_tag 4
-#define grpc_gcp_AltsContext_local_service_account_tag 5
-#define grpc_gcp_AltsContext_peer_rpc_versions_tag 6
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t grpc_gcp_AltsContext_fields[7];
-
-/* Maximum encoded size of messages (where known) */
-/* grpc_gcp_AltsContext_size depends on runtime parameters */
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define ALTSCONTEXT_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.c b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.c
deleted file mode 100644 (file)
index 5450b16..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/tsi/alts/handshaker/handshaker.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t grpc_gcp_Endpoint_fields[4] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, CALLBACK, FIRST, grpc_gcp_Endpoint, ip_address, ip_address, 0),
-    PB_FIELD(  2, INT32   , OPTIONAL, STATIC  , OTHER, grpc_gcp_Endpoint, port, ip_address, 0),
-    PB_FIELD(  3, UENUM   , OPTIONAL, STATIC  , OTHER, grpc_gcp_Endpoint, protocol, port, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_Identity_fields[3] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, CALLBACK, FIRST, grpc_gcp_Identity, service_account, service_account, 0),
-    PB_FIELD(  2, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_Identity, hostname, service_account, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_StartClientHandshakeReq_fields[10] = {
-    PB_FIELD(  1, UENUM   , OPTIONAL, STATIC  , FIRST, grpc_gcp_StartClientHandshakeReq, handshake_security_protocol, handshake_security_protocol, 0),
-    PB_FIELD(  2, STRING  , REPEATED, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, application_protocols, handshake_security_protocol, 0),
-    PB_FIELD(  3, STRING  , REPEATED, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, record_protocols, application_protocols, 0),
-    PB_FIELD(  4, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, target_identities, record_protocols, &grpc_gcp_Identity_fields),
-    PB_FIELD(  5, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartClientHandshakeReq, local_identity, target_identities, &grpc_gcp_Identity_fields),
-    PB_FIELD(  6, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartClientHandshakeReq, local_endpoint, local_identity, &grpc_gcp_Endpoint_fields),
-    PB_FIELD(  7, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartClientHandshakeReq, remote_endpoint, local_endpoint, &grpc_gcp_Endpoint_fields),
-    PB_FIELD(  8, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_StartClientHandshakeReq, target_name, remote_endpoint, 0),
-    PB_FIELD(  9, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartClientHandshakeReq, rpc_versions, target_name, &grpc_gcp_RpcProtocolVersions_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_ServerHandshakeParameters_fields[3] = {
-    PB_FIELD(  1, STRING  , REPEATED, CALLBACK, FIRST, grpc_gcp_ServerHandshakeParameters, record_protocols, record_protocols, 0),
-    PB_FIELD(  2, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_gcp_ServerHandshakeParameters, local_identities, record_protocols, &grpc_gcp_Identity_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_StartServerHandshakeReq_fields[7] = {
-    PB_FIELD(  1, STRING  , REPEATED, CALLBACK, FIRST, grpc_gcp_StartServerHandshakeReq, application_protocols, application_protocols, 0),
-    PB_FIELD(  2, MESSAGE , REPEATED, STATIC  , OTHER, grpc_gcp_StartServerHandshakeReq, handshake_parameters, application_protocols, &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_fields),
-    PB_FIELD(  3, BYTES   , OPTIONAL, CALLBACK, OTHER, grpc_gcp_StartServerHandshakeReq, in_bytes, handshake_parameters, 0),
-    PB_FIELD(  4, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartServerHandshakeReq, local_endpoint, in_bytes, &grpc_gcp_Endpoint_fields),
-    PB_FIELD(  5, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartServerHandshakeReq, remote_endpoint, local_endpoint, &grpc_gcp_Endpoint_fields),
-    PB_FIELD(  6, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartServerHandshakeReq, rpc_versions, remote_endpoint, &grpc_gcp_RpcProtocolVersions_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_fields[3] = {
-    PB_FIELD(  1, INT32   , OPTIONAL, STATIC  , FIRST, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, key, key, 0),
-    PB_FIELD(  2, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, value, key, &grpc_gcp_ServerHandshakeParameters_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_NextHandshakeMessageReq_fields[2] = {
-    PB_FIELD(  1, BYTES   , OPTIONAL, CALLBACK, FIRST, grpc_gcp_NextHandshakeMessageReq, in_bytes, in_bytes, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_HandshakerReq_fields[4] = {
-    PB_FIELD(  1, MESSAGE , OPTIONAL, STATIC  , FIRST, grpc_gcp_HandshakerReq, client_start, client_start, &grpc_gcp_StartClientHandshakeReq_fields),
-    PB_FIELD(  2, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerReq, server_start, client_start, &grpc_gcp_StartServerHandshakeReq_fields),
-    PB_FIELD(  3, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerReq, next, server_start, &grpc_gcp_NextHandshakeMessageReq_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_HandshakerResult_fields[8] = {
-    PB_FIELD(  1, STRING  , OPTIONAL, CALLBACK, FIRST, grpc_gcp_HandshakerResult, application_protocol, application_protocol, 0),
-    PB_FIELD(  2, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_HandshakerResult, record_protocol, application_protocol, 0),
-    PB_FIELD(  3, BYTES   , OPTIONAL, CALLBACK, OTHER, grpc_gcp_HandshakerResult, key_data, record_protocol, 0),
-    PB_FIELD(  4, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResult, peer_identity, key_data, &grpc_gcp_Identity_fields),
-    PB_FIELD(  5, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResult, local_identity, peer_identity, &grpc_gcp_Identity_fields),
-    PB_FIELD(  6, BOOL    , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResult, keep_channel_open, local_identity, 0),
-    PB_FIELD(  7, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResult, peer_rpc_versions, keep_channel_open, &grpc_gcp_RpcProtocolVersions_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_HandshakerStatus_fields[3] = {
-    PB_FIELD(  1, UINT32  , OPTIONAL, STATIC  , FIRST, grpc_gcp_HandshakerStatus, code, code, 0),
-    PB_FIELD(  2, STRING  , OPTIONAL, CALLBACK, OTHER, grpc_gcp_HandshakerStatus, details, code, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_HandshakerResp_fields[5] = {
-    PB_FIELD(  1, BYTES   , OPTIONAL, CALLBACK, FIRST, grpc_gcp_HandshakerResp, out_frames, out_frames, 0),
-    PB_FIELD(  2, UINT32  , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResp, bytes_consumed, out_frames, 0),
-    PB_FIELD(  3, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResp, result, bytes_consumed, &grpc_gcp_HandshakerResult_fields),
-    PB_FIELD(  4, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_HandshakerResp, status, result, &grpc_gcp_HandshakerStatus_fields),
-    PB_LAST_FIELD
-};
-
-
-/* Check that field information fits in pb_field_t */
-#if !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_32BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in 8 or 16 bit
- * field descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_gcp_StartClientHandshakeReq, target_identities) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_identity) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_endpoint) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, remote_endpoint) < 65536 && pb_membersize(grpc_gcp_StartClientHandshakeReq, rpc_versions) < 65536 && pb_membersize(grpc_gcp_ServerHandshakeParameters, local_identities) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, handshake_parameters[0]) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, local_endpoint) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, remote_endpoint) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq, rpc_versions) < 65536 && pb_membersize(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, value) < 65536 && pb_membersize(grpc_gcp_HandshakerReq, client_start) < 65536 && pb_membersize(grpc_gcp_HandshakerReq, server_start) < 65536 && pb_membersize(grpc_gcp_HandshakerReq, next) < 65536 && pb_membersize(grpc_gcp_HandshakerResult, peer_identity) < 65536 && pb_membersize(grpc_gcp_HandshakerResult, local_identity) < 65536 && pb_membersize(grpc_gcp_HandshakerResult, peer_rpc_versions) < 65536 && pb_membersize(grpc_gcp_HandshakerResp, result) < 65536 && pb_membersize(grpc_gcp_HandshakerResp, status) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_Endpoint_grpc_gcp_Identity_grpc_gcp_StartClientHandshakeReq_grpc_gcp_ServerHandshakeParameters_grpc_gcp_StartServerHandshakeReq_grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_grpc_gcp_NextHandshakeMessageReq_grpc_gcp_HandshakerReq_grpc_gcp_HandshakerResult_grpc_gcp_HandshakerStatus_grpc_gcp_HandshakerResp)
-#endif
-
-#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_16BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in the default
- * 8 bit descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_gcp_StartClientHandshakeReq, target_identities) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_identity) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, local_endpoint) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, remote_endpoint) < 256 && pb_membersize(grpc_gcp_StartClientHandshakeReq, rpc_versions) < 256 && pb_membersize(grpc_gcp_ServerHandshakeParameters, local_identities) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, handshake_parameters[0]) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, local_endpoint) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, remote_endpoint) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq, rpc_versions) < 256 && pb_membersize(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry, value) < 256 && pb_membersize(grpc_gcp_HandshakerReq, client_start) < 256 && pb_membersize(grpc_gcp_HandshakerReq, server_start) < 256 && pb_membersize(grpc_gcp_HandshakerReq, next) < 256 && pb_membersize(grpc_gcp_HandshakerResult, peer_identity) < 256 && pb_membersize(grpc_gcp_HandshakerResult, local_identity) < 256 && pb_membersize(grpc_gcp_HandshakerResult, peer_rpc_versions) < 256 && pb_membersize(grpc_gcp_HandshakerResp, result) < 256 && pb_membersize(grpc_gcp_HandshakerResp, status) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_Endpoint_grpc_gcp_Identity_grpc_gcp_StartClientHandshakeReq_grpc_gcp_ServerHandshakeParameters_grpc_gcp_StartServerHandshakeReq_grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_grpc_gcp_NextHandshakeMessageReq_grpc_gcp_HandshakerReq_grpc_gcp_HandshakerResult_grpc_gcp_HandshakerStatus_grpc_gcp_HandshakerResp)
-#endif
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.h b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/handshaker.pb.h
deleted file mode 100644 (file)
index 5ee42a3..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GRPC_GCP_HANDSHAKER_PB_H_INCLUDED
-#define PB_GRPC_GCP_HANDSHAKER_PB_H_INCLUDED
-#include "pb.h"
-#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enum definitions */
-typedef enum _grpc_gcp_HandshakeProtocol {
-    grpc_gcp_HandshakeProtocol_HANDSHAKE_PROTOCOL_UNSPECIFIED = 0,
-    grpc_gcp_HandshakeProtocol_TLS = 1,
-    grpc_gcp_HandshakeProtocol_ALTS = 2
-} grpc_gcp_HandshakeProtocol;
-#define _grpc_gcp_HandshakeProtocol_MIN grpc_gcp_HandshakeProtocol_HANDSHAKE_PROTOCOL_UNSPECIFIED
-#define _grpc_gcp_HandshakeProtocol_MAX grpc_gcp_HandshakeProtocol_ALTS
-#define _grpc_gcp_HandshakeProtocol_ARRAYSIZE ((grpc_gcp_HandshakeProtocol)(grpc_gcp_HandshakeProtocol_ALTS+1))
-
-typedef enum _grpc_gcp_NetworkProtocol {
-    grpc_gcp_NetworkProtocol_NETWORK_PROTOCOL_UNSPECIFIED = 0,
-    grpc_gcp_NetworkProtocol_TCP = 1,
-    grpc_gcp_NetworkProtocol_UDP = 2
-} grpc_gcp_NetworkProtocol;
-#define _grpc_gcp_NetworkProtocol_MIN grpc_gcp_NetworkProtocol_NETWORK_PROTOCOL_UNSPECIFIED
-#define _grpc_gcp_NetworkProtocol_MAX grpc_gcp_NetworkProtocol_UDP
-#define _grpc_gcp_NetworkProtocol_ARRAYSIZE ((grpc_gcp_NetworkProtocol)(grpc_gcp_NetworkProtocol_UDP+1))
-
-/* Struct definitions */
-typedef struct _grpc_gcp_Identity {
-    pb_callback_t service_account;
-    pb_callback_t hostname;
-/* @@protoc_insertion_point(struct:grpc_gcp_Identity) */
-} grpc_gcp_Identity;
-
-typedef struct _grpc_gcp_NextHandshakeMessageReq {
-    pb_callback_t in_bytes;
-/* @@protoc_insertion_point(struct:grpc_gcp_NextHandshakeMessageReq) */
-} grpc_gcp_NextHandshakeMessageReq;
-
-typedef struct _grpc_gcp_ServerHandshakeParameters {
-    pb_callback_t record_protocols;
-    pb_callback_t local_identities;
-/* @@protoc_insertion_point(struct:grpc_gcp_ServerHandshakeParameters) */
-} grpc_gcp_ServerHandshakeParameters;
-
-typedef struct _grpc_gcp_Endpoint {
-    pb_callback_t ip_address;
-    bool has_port;
-    int32_t port;
-    bool has_protocol;
-    grpc_gcp_NetworkProtocol protocol;
-/* @@protoc_insertion_point(struct:grpc_gcp_Endpoint) */
-} grpc_gcp_Endpoint;
-
-typedef struct _grpc_gcp_HandshakerResult {
-    pb_callback_t application_protocol;
-    pb_callback_t record_protocol;
-    pb_callback_t key_data;
-    bool has_peer_identity;
-    grpc_gcp_Identity peer_identity;
-    bool has_local_identity;
-    grpc_gcp_Identity local_identity;
-    bool has_keep_channel_open;
-    bool keep_channel_open;
-    bool has_peer_rpc_versions;
-    grpc_gcp_RpcProtocolVersions peer_rpc_versions;
-/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerResult) */
-} grpc_gcp_HandshakerResult;
-
-typedef struct _grpc_gcp_HandshakerStatus {
-    bool has_code;
-    uint32_t code;
-    pb_callback_t details;
-/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerStatus) */
-} grpc_gcp_HandshakerStatus;
-
-typedef struct _grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry {
-    bool has_key;
-    int32_t key;
-    bool has_value;
-    grpc_gcp_ServerHandshakeParameters value;
-/* @@protoc_insertion_point(struct:grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry) */
-} grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry;
-
-typedef struct _grpc_gcp_HandshakerResp {
-    pb_callback_t out_frames;
-    bool has_bytes_consumed;
-    uint32_t bytes_consumed;
-    bool has_result;
-    grpc_gcp_HandshakerResult result;
-    bool has_status;
-    grpc_gcp_HandshakerStatus status;
-/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerResp) */
-} grpc_gcp_HandshakerResp;
-
-typedef struct _grpc_gcp_StartClientHandshakeReq {
-    bool has_handshake_security_protocol;
-    grpc_gcp_HandshakeProtocol handshake_security_protocol;
-    pb_callback_t application_protocols;
-    pb_callback_t record_protocols;
-    pb_callback_t target_identities;
-    bool has_local_identity;
-    grpc_gcp_Identity local_identity;
-    bool has_local_endpoint;
-    grpc_gcp_Endpoint local_endpoint;
-    bool has_remote_endpoint;
-    grpc_gcp_Endpoint remote_endpoint;
-    pb_callback_t target_name;
-    bool has_rpc_versions;
-    grpc_gcp_RpcProtocolVersions rpc_versions;
-/* @@protoc_insertion_point(struct:grpc_gcp_StartClientHandshakeReq) */
-} grpc_gcp_StartClientHandshakeReq;
-
-typedef struct _grpc_gcp_StartServerHandshakeReq {
-    pb_callback_t application_protocols;
-    pb_size_t handshake_parameters_count;
-    grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry handshake_parameters[3];
-    pb_callback_t in_bytes;
-    bool has_local_endpoint;
-    grpc_gcp_Endpoint local_endpoint;
-    bool has_remote_endpoint;
-    grpc_gcp_Endpoint remote_endpoint;
-    bool has_rpc_versions;
-    grpc_gcp_RpcProtocolVersions rpc_versions;
-/* @@protoc_insertion_point(struct:grpc_gcp_StartServerHandshakeReq) */
-} grpc_gcp_StartServerHandshakeReq;
-
-typedef struct _grpc_gcp_HandshakerReq {
-    bool has_client_start;
-    grpc_gcp_StartClientHandshakeReq client_start;
-    bool has_server_start;
-    grpc_gcp_StartServerHandshakeReq server_start;
-    bool has_next;
-    grpc_gcp_NextHandshakeMessageReq next;
-/* @@protoc_insertion_point(struct:grpc_gcp_HandshakerReq) */
-} grpc_gcp_HandshakerReq;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define grpc_gcp_Endpoint_init_default           {{{NULL}, NULL}, false, 0, false, (grpc_gcp_NetworkProtocol)0}
-#define grpc_gcp_Identity_init_default           {{{NULL}, NULL}, {{NULL}, NULL}}
-#define grpc_gcp_StartClientHandshakeReq_init_default {false, (grpc_gcp_HandshakeProtocol)0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_default, false, grpc_gcp_Endpoint_init_default, false, grpc_gcp_Endpoint_init_default, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_default}
-#define grpc_gcp_ServerHandshakeParameters_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
-#define grpc_gcp_StartServerHandshakeReq_init_default {{{NULL}, NULL}, 0, {grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default}, {{NULL}, NULL}, false, grpc_gcp_Endpoint_init_default, false, grpc_gcp_Endpoint_init_default, false, grpc_gcp_RpcProtocolVersions_init_default}
-#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_default {false, 0, false, grpc_gcp_ServerHandshakeParameters_init_default}
-#define grpc_gcp_NextHandshakeMessageReq_init_default {{{NULL}, NULL}}
-#define grpc_gcp_HandshakerReq_init_default      {false, grpc_gcp_StartClientHandshakeReq_init_default, false, grpc_gcp_StartServerHandshakeReq_init_default, false, grpc_gcp_NextHandshakeMessageReq_init_default}
-#define grpc_gcp_HandshakerResult_init_default   {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_default, false, grpc_gcp_Identity_init_default, false, 0, false, grpc_gcp_RpcProtocolVersions_init_default}
-#define grpc_gcp_HandshakerStatus_init_default   {false, 0, {{NULL}, NULL}}
-#define grpc_gcp_HandshakerResp_init_default     {{{NULL}, NULL}, false, 0, false, grpc_gcp_HandshakerResult_init_default, false, grpc_gcp_HandshakerStatus_init_default}
-#define grpc_gcp_Endpoint_init_zero              {{{NULL}, NULL}, false, 0, false, (grpc_gcp_NetworkProtocol)0}
-#define grpc_gcp_Identity_init_zero              {{{NULL}, NULL}, {{NULL}, NULL}}
-#define grpc_gcp_StartClientHandshakeReq_init_zero {false, (grpc_gcp_HandshakeProtocol)0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_zero, false, grpc_gcp_Endpoint_init_zero, false, grpc_gcp_Endpoint_init_zero, {{NULL}, NULL}, false, grpc_gcp_RpcProtocolVersions_init_zero}
-#define grpc_gcp_ServerHandshakeParameters_init_zero {{{NULL}, NULL}, {{NULL}, NULL}}
-#define grpc_gcp_StartServerHandshakeReq_init_zero {{{NULL}, NULL}, 0, {grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero, grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero}, {{NULL}, NULL}, false, grpc_gcp_Endpoint_init_zero, false, grpc_gcp_Endpoint_init_zero, false, grpc_gcp_RpcProtocolVersions_init_zero}
-#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_init_zero {false, 0, false, grpc_gcp_ServerHandshakeParameters_init_zero}
-#define grpc_gcp_NextHandshakeMessageReq_init_zero {{{NULL}, NULL}}
-#define grpc_gcp_HandshakerReq_init_zero         {false, grpc_gcp_StartClientHandshakeReq_init_zero, false, grpc_gcp_StartServerHandshakeReq_init_zero, false, grpc_gcp_NextHandshakeMessageReq_init_zero}
-#define grpc_gcp_HandshakerResult_init_zero      {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, false, grpc_gcp_Identity_init_zero, false, grpc_gcp_Identity_init_zero, false, 0, false, grpc_gcp_RpcProtocolVersions_init_zero}
-#define grpc_gcp_HandshakerStatus_init_zero      {false, 0, {{NULL}, NULL}}
-#define grpc_gcp_HandshakerResp_init_zero        {{{NULL}, NULL}, false, 0, false, grpc_gcp_HandshakerResult_init_zero, false, grpc_gcp_HandshakerStatus_init_zero}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define grpc_gcp_Identity_service_account_tag    1
-#define grpc_gcp_Identity_hostname_tag           2
-#define grpc_gcp_NextHandshakeMessageReq_in_bytes_tag 1
-#define grpc_gcp_ServerHandshakeParameters_record_protocols_tag 1
-#define grpc_gcp_ServerHandshakeParameters_local_identities_tag 2
-#define grpc_gcp_Endpoint_ip_address_tag         1
-#define grpc_gcp_Endpoint_port_tag               2
-#define grpc_gcp_Endpoint_protocol_tag           3
-#define grpc_gcp_HandshakerResult_application_protocol_tag 1
-#define grpc_gcp_HandshakerResult_record_protocol_tag 2
-#define grpc_gcp_HandshakerResult_key_data_tag   3
-#define grpc_gcp_HandshakerResult_peer_identity_tag 4
-#define grpc_gcp_HandshakerResult_local_identity_tag 5
-#define grpc_gcp_HandshakerResult_keep_channel_open_tag 6
-#define grpc_gcp_HandshakerResult_peer_rpc_versions_tag 7
-#define grpc_gcp_HandshakerStatus_code_tag       1
-#define grpc_gcp_HandshakerStatus_details_tag    2
-#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_key_tag 1
-#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value_tag 2
-#define grpc_gcp_HandshakerResp_out_frames_tag   1
-#define grpc_gcp_HandshakerResp_bytes_consumed_tag 2
-#define grpc_gcp_HandshakerResp_result_tag       3
-#define grpc_gcp_HandshakerResp_status_tag       4
-#define grpc_gcp_StartClientHandshakeReq_handshake_security_protocol_tag 1
-#define grpc_gcp_StartClientHandshakeReq_application_protocols_tag 2
-#define grpc_gcp_StartClientHandshakeReq_record_protocols_tag 3
-#define grpc_gcp_StartClientHandshakeReq_target_identities_tag 4
-#define grpc_gcp_StartClientHandshakeReq_local_identity_tag 5
-#define grpc_gcp_StartClientHandshakeReq_local_endpoint_tag 6
-#define grpc_gcp_StartClientHandshakeReq_remote_endpoint_tag 7
-#define grpc_gcp_StartClientHandshakeReq_target_name_tag 8
-#define grpc_gcp_StartClientHandshakeReq_rpc_versions_tag 9
-#define grpc_gcp_StartServerHandshakeReq_application_protocols_tag 1
-#define grpc_gcp_StartServerHandshakeReq_handshake_parameters_tag 2
-#define grpc_gcp_StartServerHandshakeReq_in_bytes_tag 3
-#define grpc_gcp_StartServerHandshakeReq_local_endpoint_tag 4
-#define grpc_gcp_StartServerHandshakeReq_remote_endpoint_tag 5
-#define grpc_gcp_StartServerHandshakeReq_rpc_versions_tag 6
-#define grpc_gcp_HandshakerReq_client_start_tag  1
-#define grpc_gcp_HandshakerReq_server_start_tag  2
-#define grpc_gcp_HandshakerReq_next_tag          3
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t grpc_gcp_Endpoint_fields[4];
-extern const pb_field_t grpc_gcp_Identity_fields[3];
-extern const pb_field_t grpc_gcp_StartClientHandshakeReq_fields[10];
-extern const pb_field_t grpc_gcp_ServerHandshakeParameters_fields[3];
-extern const pb_field_t grpc_gcp_StartServerHandshakeReq_fields[7];
-extern const pb_field_t grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_fields[3];
-extern const pb_field_t grpc_gcp_NextHandshakeMessageReq_fields[2];
-extern const pb_field_t grpc_gcp_HandshakerReq_fields[4];
-extern const pb_field_t grpc_gcp_HandshakerResult_fields[8];
-extern const pb_field_t grpc_gcp_HandshakerStatus_fields[3];
-extern const pb_field_t grpc_gcp_HandshakerResp_fields[5];
-
-/* Maximum encoded size of messages (where known) */
-/* grpc_gcp_Endpoint_size depends on runtime parameters */
-/* grpc_gcp_Identity_size depends on runtime parameters */
-/* grpc_gcp_StartClientHandshakeReq_size depends on runtime parameters */
-/* grpc_gcp_ServerHandshakeParameters_size depends on runtime parameters */
-/* grpc_gcp_StartServerHandshakeReq_size depends on runtime parameters */
-#define grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_size (17 + grpc_gcp_ServerHandshakeParameters_size)
-/* grpc_gcp_NextHandshakeMessageReq_size depends on runtime parameters */
-#define grpc_gcp_HandshakerReq_size              (18 + grpc_gcp_StartClientHandshakeReq_size + grpc_gcp_StartServerHandshakeReq_size + grpc_gcp_NextHandshakeMessageReq_size)
-/* grpc_gcp_HandshakerResult_size depends on runtime parameters */
-/* grpc_gcp_HandshakerStatus_size depends on runtime parameters */
-/* grpc_gcp_HandshakerResp_size depends on runtime parameters */
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define HANDSHAKER_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.c b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.c
deleted file mode 100644 (file)
index 326b1b1..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.7-dev */
-
-#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t grpc_gcp_RpcProtocolVersions_fields[3] = {
-    PB_FIELD(  1, MESSAGE , OPTIONAL, STATIC  , FIRST, grpc_gcp_RpcProtocolVersions, max_rpc_version, max_rpc_version, &grpc_gcp_RpcProtocolVersions_Version_fields),
-    PB_FIELD(  2, MESSAGE , OPTIONAL, STATIC  , OTHER, grpc_gcp_RpcProtocolVersions, min_rpc_version, max_rpc_version, &grpc_gcp_RpcProtocolVersions_Version_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t grpc_gcp_RpcProtocolVersions_Version_fields[3] = {
-    PB_FIELD(  1, UINT32  , OPTIONAL, STATIC  , FIRST, grpc_gcp_RpcProtocolVersions_Version, major, major, 0),
-    PB_FIELD(  2, UINT32  , OPTIONAL, STATIC  , OTHER, grpc_gcp_RpcProtocolVersions_Version, minor, major, 0),
-    PB_LAST_FIELD
-};
-
-
-/* Check that field information fits in pb_field_t */
-#if !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_32BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in 8 or 16 bit
- * field descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_gcp_RpcProtocolVersions, max_rpc_version) < 65536 && pb_membersize(grpc_gcp_RpcProtocolVersions, min_rpc_version) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_RpcProtocolVersions_grpc_gcp_RpcProtocolVersions_Version)
-#endif
-
-#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_16BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in the default
- * 8 bit descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(grpc_gcp_RpcProtocolVersions, max_rpc_version) < 256 && pb_membersize(grpc_gcp_RpcProtocolVersions, min_rpc_version) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_RpcProtocolVersions_grpc_gcp_RpcProtocolVersions_Version)
-#endif
-
-
-/* @@protoc_insertion_point(eof) */
diff --git a/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.h b/legacy-libs/grpc/deps/grpc/src/core/tsi/alts/handshaker/transport_security_common.pb.h
deleted file mode 100644 (file)
index 87d9abf..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.7-dev */
-
-#ifndef PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED
-#define PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED
-#include "pb.h"
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enum definitions */
-typedef enum _grpc_gcp_SecurityLevel {
-    grpc_gcp_SecurityLevel_SECURITY_NONE = 0,
-    grpc_gcp_SecurityLevel_INTEGRITY_ONLY = 1,
-    grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY = 2
-} grpc_gcp_SecurityLevel;
-#define _grpc_gcp_SecurityLevel_MIN grpc_gcp_SecurityLevel_SECURITY_NONE
-#define _grpc_gcp_SecurityLevel_MAX grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY
-#define _grpc_gcp_SecurityLevel_ARRAYSIZE ((grpc_gcp_SecurityLevel)(grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY+1))
-
-/* Struct definitions */
-typedef struct _grpc_gcp_RpcProtocolVersions_Version {
-    bool has_major;
-    uint32_t major;
-    bool has_minor;
-    uint32_t minor;
-/* @@protoc_insertion_point(struct:grpc_gcp_RpcProtocolVersions_Version) */
-} grpc_gcp_RpcProtocolVersions_Version;
-
-typedef struct _grpc_gcp_RpcProtocolVersions {
-    bool has_max_rpc_version;
-    grpc_gcp_RpcProtocolVersions_Version max_rpc_version;
-    bool has_min_rpc_version;
-    grpc_gcp_RpcProtocolVersions_Version min_rpc_version;
-/* @@protoc_insertion_point(struct:grpc_gcp_RpcProtocolVersions) */
-} grpc_gcp_RpcProtocolVersions;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define grpc_gcp_RpcProtocolVersions_init_default {false, grpc_gcp_RpcProtocolVersions_Version_init_default, false, grpc_gcp_RpcProtocolVersions_Version_init_default}
-#define grpc_gcp_RpcProtocolVersions_Version_init_default {false, 0, false, 0}
-#define grpc_gcp_RpcProtocolVersions_init_zero   {false, grpc_gcp_RpcProtocolVersions_Version_init_zero, false, grpc_gcp_RpcProtocolVersions_Version_init_zero}
-#define grpc_gcp_RpcProtocolVersions_Version_init_zero {false, 0, false, 0}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define grpc_gcp_RpcProtocolVersions_Version_major_tag 1
-#define grpc_gcp_RpcProtocolVersions_Version_minor_tag 2
-#define grpc_gcp_RpcProtocolVersions_max_rpc_version_tag 1
-#define grpc_gcp_RpcProtocolVersions_min_rpc_version_tag 2
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t grpc_gcp_RpcProtocolVersions_fields[3];
-extern const pb_field_t grpc_gcp_RpcProtocolVersions_Version_fields[3];
-
-/* Maximum encoded size of messages (where known) */
-#define grpc_gcp_RpcProtocolVersions_size        28
-#define grpc_gcp_RpcProtocolVersions_Version_size 12
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define TRANSPORT_SECURITY_COMMON_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif
index 6c518c1..c7b9faf 100644 (file)
@@ -29,9 +29,6 @@ bool grpc_gcp_rpc_protocol_versions_set_max(
             "grpc_gcp_rpc_protocol_versions_set_max().");
     return false;
   }
-  versions->has_max_rpc_version = true;
-  versions->max_rpc_version.has_major = true;
-  versions->max_rpc_version.has_minor = true;
   versions->max_rpc_version.major = max_major;
   versions->max_rpc_version.minor = max_minor;
   return true;
@@ -46,63 +43,45 @@ bool grpc_gcp_rpc_protocol_versions_set_min(
             "grpc_gcp_rpc_protocol_versions_set_min().");
     return false;
   }
-  versions->has_min_rpc_version = true;
-  versions->min_rpc_version.has_major = true;
-  versions->min_rpc_version.has_minor = true;
   versions->min_rpc_version.major = min_major;
   versions->min_rpc_version.minor = min_minor;
   return true;
 }
 
-size_t grpc_gcp_rpc_protocol_versions_encode_length(
-    const grpc_gcp_rpc_protocol_versions* versions) {
-  if (versions == nullptr) {
-    gpr_log(GPR_ERROR,
-            "Invalid nullptr arguments to "
-            "grpc_gcp_rpc_protocol_versions_encode_length().");
-    return 0;
-  }
-  pb_ostream_t size_stream;
-  memset(&size_stream, 0, sizeof(pb_ostream_t));
-  if (!pb_encode(&size_stream, grpc_gcp_RpcProtocolVersions_fields, versions)) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream));
-    return 0;
-  }
-  return size_stream.bytes_written;
-}
-
-bool grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes(
-    const grpc_gcp_rpc_protocol_versions* versions, uint8_t* bytes,
-    size_t bytes_length) {
-  if (versions == nullptr || bytes == nullptr || bytes_length == 0) {
+bool grpc_gcp_rpc_protocol_versions_encode(
+    const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice) {
+  if (versions == nullptr || slice == nullptr) {
     gpr_log(GPR_ERROR,
             "Invalid nullptr arguments to "
-            "grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes().");
-    return false;
-  }
-  pb_ostream_t output_stream = pb_ostream_from_buffer(bytes, bytes_length);
-  if (!pb_encode(&output_stream, grpc_gcp_RpcProtocolVersions_fields,
-                 versions)) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&output_stream));
+            "grpc_gcp_rpc_protocol_versions_encode().");
     return false;
   }
-  return true;
+  upb::Arena arena;
+  grpc_gcp_RpcProtocolVersions* versions_msg =
+      grpc_gcp_RpcProtocolVersions_new(arena.ptr());
+  grpc_gcp_RpcProtocolVersions_assign_from_struct(versions_msg, arena.ptr(),
+                                                  versions);
+  return grpc_gcp_rpc_protocol_versions_encode(versions_msg, arena.ptr(),
+                                               slice);
 }
 
 bool grpc_gcp_rpc_protocol_versions_encode(
-    const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice) {
-  if (versions == nullptr || slice == nullptr) {
+    const grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena,
+    grpc_slice* slice) {
+  if (versions == nullptr || arena == nullptr || slice == nullptr) {
     gpr_log(GPR_ERROR,
             "Invalid nullptr arguments to "
             "grpc_gcp_rpc_protocol_versions_encode().");
     return false;
   }
-  size_t encoded_length =
-      grpc_gcp_rpc_protocol_versions_encode_length(versions);
-  if (encoded_length == 0) return false;
-  *slice = grpc_slice_malloc(encoded_length);
-  return grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes(
-      versions, GRPC_SLICE_START_PTR(*slice), encoded_length);
+  size_t buf_length;
+  char* buf =
+      grpc_gcp_RpcProtocolVersions_serialize(versions, arena, &buf_length);
+  if (buf == nullptr) {
+    return false;
+  }
+  *slice = grpc_slice_from_copied_buffer(buf, buf_length);
+  return true;
 }
 
 bool grpc_gcp_rpc_protocol_versions_decode(
@@ -113,16 +92,63 @@ bool grpc_gcp_rpc_protocol_versions_decode(
             "grpc_gcp_rpc_protocol_versions_decode().");
     return false;
   }
-  pb_istream_t stream =
-      pb_istream_from_buffer(const_cast<uint8_t*>(GRPC_SLICE_START_PTR(slice)),
-                             GRPC_SLICE_LENGTH(slice));
-  if (!pb_decode(&stream, grpc_gcp_RpcProtocolVersions_fields, versions)) {
-    gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
+  upb::Arena arena;
+  grpc_gcp_RpcProtocolVersions* versions_msg =
+      grpc_gcp_RpcProtocolVersions_parse(
+          reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(slice)),
+          GRPC_SLICE_LENGTH(slice), arena.ptr());
+  if (versions_msg == nullptr) {
+    gpr_log(GPR_ERROR, "cannot deserialize RpcProtocolVersions message");
     return false;
   }
+  grpc_gcp_rpc_protocol_versions_assign_from_upb(versions, versions_msg);
   return true;
 }
 
+void grpc_gcp_rpc_protocol_versions_assign_from_upb(
+    grpc_gcp_rpc_protocol_versions* versions,
+    const grpc_gcp_RpcProtocolVersions* value) {
+  const grpc_gcp_RpcProtocolVersions_Version* max_version_msg =
+      grpc_gcp_RpcProtocolVersions_max_rpc_version(value);
+  if (max_version_msg != nullptr) {
+    versions->max_rpc_version.major =
+        grpc_gcp_RpcProtocolVersions_Version_major(max_version_msg);
+    versions->max_rpc_version.minor =
+        grpc_gcp_RpcProtocolVersions_Version_minor(max_version_msg);
+  } else {
+    versions->max_rpc_version.major = 0;
+    versions->max_rpc_version.minor = 0;
+  }
+  const grpc_gcp_RpcProtocolVersions_Version* min_version_msg =
+      grpc_gcp_RpcProtocolVersions_min_rpc_version(value);
+  if (min_version_msg != nullptr) {
+    versions->min_rpc_version.major =
+        grpc_gcp_RpcProtocolVersions_Version_major(min_version_msg);
+    versions->min_rpc_version.minor =
+        grpc_gcp_RpcProtocolVersions_Version_minor(min_version_msg);
+  } else {
+    versions->min_rpc_version.major = 0;
+    versions->min_rpc_version.minor = 0;
+  }
+}
+
+void grpc_gcp_RpcProtocolVersions_assign_from_struct(
+    grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena,
+    const grpc_gcp_rpc_protocol_versions* value) {
+  grpc_gcp_RpcProtocolVersions_Version* max_version_msg =
+      grpc_gcp_RpcProtocolVersions_mutable_max_rpc_version(versions, arena);
+  grpc_gcp_RpcProtocolVersions_Version_set_major(max_version_msg,
+                                                 value->max_rpc_version.major);
+  grpc_gcp_RpcProtocolVersions_Version_set_minor(max_version_msg,
+                                                 value->max_rpc_version.minor);
+  grpc_gcp_RpcProtocolVersions_Version* min_version_msg =
+      grpc_gcp_RpcProtocolVersions_mutable_min_rpc_version(versions, arena);
+  grpc_gcp_RpcProtocolVersions_Version_set_major(min_version_msg,
+                                                 value->min_rpc_version.major);
+  grpc_gcp_RpcProtocolVersions_Version_set_minor(min_version_msg,
+                                                 value->min_rpc_version.minor);
+}
+
 bool grpc_gcp_rpc_protocol_versions_copy(
     const grpc_gcp_rpc_protocol_versions* src,
     grpc_gcp_rpc_protocol_versions* dst) {
index 27942c8..75739e4 100644 (file)
 
 #include <grpc/support/port_platform.h>
 
-#include "pb_decode.h"
-#include "pb_encode.h"
-
 #include <grpc/slice.h>
 #include <grpc/slice_buffer.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 
-#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
+#include "src/proto/grpc/gcp/transport_security_common.upb.h"
 
-typedef grpc_gcp_RpcProtocolVersions grpc_gcp_rpc_protocol_versions;
+// C struct coresponding to protobuf message RpcProtocolVersions.Version
+typedef struct _grpc_gcp_RpcProtocolVersions_Version {
+  uint32_t major;
+  uint32_t minor;
+} grpc_gcp_rpc_protocol_versions_version;
 
-typedef grpc_gcp_RpcProtocolVersions_Version
-    grpc_gcp_rpc_protocol_versions_version;
+// C struct coresponding to protobuf message RpcProtocolVersions
+typedef struct _grpc_gcp_RpcProtocolVersions {
+  grpc_gcp_rpc_protocol_versions_version max_rpc_version;
+  grpc_gcp_rpc_protocol_versions_version min_rpc_version;
+} grpc_gcp_rpc_protocol_versions;
 
 /**
  * This method sets the value for max_rpc_versions field of rpc protocol
@@ -65,41 +69,30 @@ bool grpc_gcp_rpc_protocol_versions_set_min(
     uint32_t min_minor);
 
 /**
- * This method computes serialized byte length of rpc protocol versions.
- *
- * - versions: an rpc protocol versions instance.
- *
- * The method returns serialized byte length. It returns 0 on failure.
- */
-size_t grpc_gcp_rpc_protocol_versions_encode_length(
-    const grpc_gcp_rpc_protocol_versions* versions);
-
-/**
- * This method serializes rpc protocol versions and writes the result to
- * the memory buffer provided by the caller. Caller is responsible for
- * allocating sufficient memory to store the serialized data.
+ * This method serializes an rpc protocol version and returns serialized rpc
+ * versions in grpc slice.
  *
  * - versions: an rpc protocol versions instance.
- * - bytes: bytes buffer where the result will be written to.
- * - bytes_length: length of the bytes buffer.
+ * - slice: grpc slice where the serialized result will be written.
  *
  * The method returns true on success and false otherwise.
  */
-bool grpc_gcp_rpc_protocol_versions_encode_to_raw_bytes(
-    const grpc_gcp_rpc_protocol_versions* versions, uint8_t* bytes,
-    size_t bytes_length);
+bool grpc_gcp_rpc_protocol_versions_encode(
+    const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice);
 
 /**
  * This method serializes an rpc protocol version and returns serialized rpc
  * versions in grpc slice.
  *
  * - versions: an rpc protocol versions instance.
+ * - arena: upb arena.
  * - slice: grpc slice where the serialized result will be written.
  *
  * The method returns true on success and false otherwise.
  */
 bool grpc_gcp_rpc_protocol_versions_encode(
-    const grpc_gcp_rpc_protocol_versions* versions, grpc_slice* slice);
+    const grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena,
+    grpc_slice* slice);
 
 /**
  * This method de-serializes input in grpc slice form and stores the result
@@ -115,6 +108,21 @@ bool grpc_gcp_rpc_protocol_versions_decode(
     const grpc_slice& slice, grpc_gcp_rpc_protocol_versions* versions);
 
 /**
+ * Assigns value of upb RpcProtocolVersions to grpc_gcp_rpc_protocol_versions.
+ */
+void grpc_gcp_rpc_protocol_versions_assign_from_upb(
+    grpc_gcp_rpc_protocol_versions* versions,
+    const grpc_gcp_RpcProtocolVersions* value);
+
+/**
+ * Assigns value of struct grpc_gcp_rpc_protocol_versions to
+ * RpcProtocolVersions.
+ */
+void grpc_gcp_RpcProtocolVersions_assign_from_struct(
+    grpc_gcp_RpcProtocolVersions* versions, upb_arena* arena,
+    const grpc_gcp_rpc_protocol_versions* value);
+
+/**
  * This method performs a deep copy operation on rpc protocol versions
  * instance.
  *
index 37fa2d1..16ab977 100644 (file)
@@ -67,13 +67,8 @@ class SslSessionLRUCache : public grpc_core::RefCounted<SslSessionLRUCache> {
   SslSessionPtr Get(const char* key);
 
  private:
-  // So New() can call our private ctor.
-  template <typename T, typename... Args>
-  friend T* grpc_core::New(Args&&... args);
-
-  // So Delete() can call our private dtor.
-  template <typename T>
-  friend void grpc_core::Delete(T*);
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW
+  GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
 
   class Node;
 
index 25ae2ce..32a96b2 100644 (file)
@@ -233,11 +233,10 @@ static void ssl_info_callback(const SSL* ssl, int where, int ret) {
 
 /* Returns 1 if name looks like an IP address, 0 otherwise.
    This is a very rough heuristic, and only handles IPv6 in hexadecimal form. */
-static int looks_like_ip_address(const char* name) {
-  size_t i;
+static int looks_like_ip_address(grpc_core::StringView name) {
   size_t dot_count = 0;
   size_t num_size = 0;
-  for (i = 0; i < strlen(name); i++) {
+  for (size_t i = 0; i < name.size(); ++i) {
     if (name[i] == ':') {
       /* IPv6 Address in hexadecimal form, : is not allowed in DNS names. */
       return 1;
@@ -351,11 +350,19 @@ static tsi_result add_subject_alt_names_properties_to_peer(
   for (i = 0; i < subject_alt_name_count; i++) {
     GENERAL_NAME* subject_alt_name =
         sk_GENERAL_NAME_value(subject_alt_names, TSI_SIZE_AS_SIZE(i));
-    /* Filter out the non-dns entries names. */
-    if (subject_alt_name->type == GEN_DNS) {
+    if (subject_alt_name->type == GEN_DNS ||
+        subject_alt_name->type == GEN_EMAIL ||
+        subject_alt_name->type == GEN_URI) {
       unsigned char* name = nullptr;
       int name_size;
-      name_size = ASN1_STRING_to_UTF8(&name, subject_alt_name->d.dNSName);
+      if (subject_alt_name->type == GEN_DNS) {
+        name_size = ASN1_STRING_to_UTF8(&name, subject_alt_name->d.dNSName);
+      } else if (subject_alt_name->type == GEN_EMAIL) {
+        name_size = ASN1_STRING_to_UTF8(&name, subject_alt_name->d.rfc822Name);
+      } else {
+        name_size = ASN1_STRING_to_UTF8(
+            &name, subject_alt_name->d.uniformResourceIdentifier);
+      }
       if (name_size < 0) {
         gpr_log(GPR_ERROR, "Could not get utf8 from asn1 string.");
         result = TSI_INTERNAL_ERROR;
@@ -704,8 +711,8 @@ static tsi_result populate_ssl_context(
 }
 
 /* Extracts the CN and the SANs from an X509 cert as a peer object. */
-static tsi_result extract_x509_subject_names_from_pem_cert(const char* pem_cert,
-                                                           tsi_peer* peer) {
+tsi_result tsi_ssl_extract_x509_subject_names_from_pem_cert(
+    const char* pem_cert, tsi_peer* peer) {
   tsi_result result = TSI_OK;
   X509* cert = nullptr;
   BIO* pem;
@@ -1506,52 +1513,46 @@ static void tsi_ssl_server_handshaker_factory_destroy(
   gpr_free(self);
 }
 
-static int does_entry_match_name(const char* entry, size_t entry_length,
-                                 const char* name) {
-  const char* dot;
-  const char* name_subdomain = nullptr;
-  size_t name_length = strlen(name);
-  size_t name_subdomain_length;
-  if (entry_length == 0) return 0;
+static int does_entry_match_name(grpc_core::StringView entry,
+                                 grpc_core::StringView name) {
+  if (entry.empty()) return 0;
 
   /* Take care of '.' terminations. */
-  if (name[name_length - 1] == '.') {
-    name_length--;
+  if (name.back() == '.') {
+    name.remove_suffix(1);
   }
-  if (entry[entry_length - 1] == '.') {
-    entry_length--;
-    if (entry_length == 0) return 0;
+  if (entry.back() == '.') {
+    entry.remove_suffix(1);
+    if (entry.empty()) return 0;
   }
 
-  if ((name_length == entry_length) &&
-      strncmp(name, entry, entry_length) == 0) {
+  if (name == entry) {
     return 1; /* Perfect match. */
   }
-  if (entry[0] != '*') return 0;
+  if (entry.front() != '*') return 0;
 
   /* Wildchar subdomain matching. */
-  if (entry_length < 3 || entry[1] != '.') { /* At least *.x */
+  if (entry.size() < 3 || entry[1] != '.') { /* At least *.x */
     gpr_log(GPR_ERROR, "Invalid wildchar entry.");
     return 0;
   }
-  name_subdomain = strchr(name, '.');
-  if (name_subdomain == nullptr) return 0;
-  name_subdomain_length = strlen(name_subdomain);
-  if (name_subdomain_length < 2) return 0;
-  name_subdomain++; /* Starts after the dot. */
-  name_subdomain_length--;
-  entry += 2; /* Remove *. */
-  entry_length -= 2;
-  dot = strchr(name_subdomain, '.');
-  if ((dot == nullptr) || (dot == &name_subdomain[name_subdomain_length - 1])) {
-    gpr_log(GPR_ERROR, "Invalid toplevel subdomain: %s", name_subdomain);
+  size_t name_subdomain_pos = name.find('.');
+  if (name_subdomain_pos == grpc_core::StringView::npos) return 0;
+  if (name_subdomain_pos >= name.size() - 2) return 0;
+  grpc_core::StringView name_subdomain =
+      name.substr(name_subdomain_pos + 1); /* Starts after the dot. */
+  entry.remove_prefix(2);                  /* Remove *. */
+  size_t dot = name_subdomain.find('.');
+  if (dot == grpc_core::StringView::npos || dot == name_subdomain.size() - 1) {
+    grpc_core::UniquePtr<char> name_subdomain_cstr(name_subdomain.dup());
+    gpr_log(GPR_ERROR, "Invalid toplevel subdomain: %s",
+            name_subdomain_cstr.get());
     return 0;
   }
-  if (name_subdomain[name_subdomain_length - 1] == '.') {
-    name_subdomain_length--;
+  if (name_subdomain.back() == '.') {
+    name_subdomain.remove_suffix(1);
   }
-  return ((entry_length > 0) && (name_subdomain_length == entry_length) &&
-          strncmp(entry, name_subdomain, entry_length) == 0);
+  return !entry.empty() && name_subdomain == entry;
 }
 
 static int ssl_server_handshaker_factory_servername_callback(SSL* ssl, int* ap,
@@ -1889,7 +1890,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
       }
       /* TODO(jboeuf): Add revocation verification. */
 
-      result = extract_x509_subject_names_from_pem_cert(
+      result = tsi_ssl_extract_x509_subject_names_from_pem_cert(
           options->pem_key_cert_pairs[i].cert_chain,
           &impl->ssl_context_x509_subject_names[i]);
       if (result != TSI_OK) break;
@@ -1919,7 +1920,8 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
 
 /* --- tsi_ssl utils. --- */
 
-int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) {
+int tsi_ssl_peer_matches_name(const tsi_peer* peer,
+                              grpc_core::StringView name) {
   size_t i = 0;
   size_t san_count = 0;
   const tsi_peer_property* cn_property = nullptr;
@@ -1933,13 +1935,10 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) {
                TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY) == 0) {
       san_count++;
 
-      if (!like_ip && does_entry_match_name(property->value.data,
-                                            property->value.length, name)) {
+      grpc_core::StringView entry(property->value.data, property->value.length);
+      if (!like_ip && does_entry_match_name(entry, name)) {
         return 1;
-      } else if (like_ip &&
-                 strncmp(name, property->value.data, property->value.length) ==
-                     0 &&
-                 strlen(name) == property->value.length) {
+      } else if (like_ip && name == entry) {
         /* IP Addresses are exact matches only. */
         return 1;
       }
@@ -1951,8 +1950,9 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) {
 
   /* If there's no SAN, try the CN, but only if its not like an IP Address */
   if (san_count == 0 && cn_property != nullptr && !like_ip) {
-    if (does_entry_match_name(cn_property->value.data,
-                              cn_property->value.length, name)) {
+    if (does_entry_match_name(grpc_core::StringView(cn_property->value.data,
+                                                    cn_property->value.length),
+                              name)) {
       return 1;
     }
   }
index 769949e..04f038a 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <grpc/support/port_platform.h>
 
+#include "src/core/lib/gprpp/string_view.h"
 #include "src/core/tsi/transport_security_interface.h"
 
 /* Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for X509 certs. */
@@ -306,7 +307,7 @@ void tsi_ssl_server_handshaker_factory_unref(
    - handle mixed case.
    - handle %encoded chars.
    - handle public suffix wildchar more strictly (e.g. *.co.uk) */
-int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name);
+int tsi_ssl_peer_matches_name(const tsi_peer* peer, grpc_core::StringView name);
 
 /* --- Testing support. ---
 
@@ -331,4 +332,8 @@ const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable(
     tsi_ssl_handshaker_factory* factory,
     tsi_ssl_handshaker_factory_vtable* new_vtable);
 
+/* Exposed for testing only. */
+tsi_result tsi_ssl_extract_x509_subject_names_from_pem_cert(
+    const char* pem_cert, tsi_peer* peer);
+
 #endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */
index fef7d96..ccd61dc 100644 (file)
@@ -1,7 +1,7 @@
 
                                  Apache License
                            Version 2.0, January 2004
-                        http://www.apache.org/licenses/
+                        https://www.apache.org/licenses/
 
    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
-       http://www.apache.org/licenses/LICENSE-2.0
+       https://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-   
-   
\ No newline at end of file
+
index 2d78e46..2c513ea 100644 (file)
@@ -7,6 +7,8 @@ standard library.
 ## Table of Contents
 
 - [About Abseil](#about)
+- [Quickstart](#quickstart)
+- [Building Abseil](#build)
 - [Codemap](#codemap)
 - [License](#license)
 - [Links](#links)
@@ -29,6 +31,26 @@ just found that many of these utilities serve a purpose within our code
 base, and we now want to provide those resources to the C++ community as
 a whole.
 
+<a name="quickstart"></a>
+## Quickstart
+
+If you want to just get started, make sure you at least run through the
+[Abseil Quickstart](https://abseil.io/docs/cpp/quickstart). The Quickstart
+contains information about setting up your development environment, downloading
+the Abseil code, running tests, and getting a simple binary working.
+
+<a name="build"></a>
+## Building Abseil
+
+[Bazel](https://bazel.build) is the official build system for Abseil,
+which is supported on most major platforms (Linux, Windows, MacOS, for example)
+and compilers. See the [quickstart](https://abseil.io/docs/cpp/quickstart) for
+more information on building Abseil using the Bazel build system.
+
+<a name="cmake"></a>
+If you require CMake support, please check the
+[CMake build instructions](CMake/README.md).
+
 ## Codemap
 
 Abseil contains the following C++ library components:
@@ -41,10 +63,14 @@ Abseil contains the following C++ library components:
   <br /> The `algorithm` library contains additions to the C++ `<algorithm>`
   library and container-based versions of such algorithms.
 * [`container`](absl/container/)
-  <br /> The `container` library contains additional STL-style containers.
+  <br /> The `container` library contains additional STL-style containers,
+  including Abseil's unordered "Swiss table" containers.
 * [`debugging`](absl/debugging/)
   <br /> The `debugging` library contains code useful for enabling leak
-  checks. Future updates will add stacktrace and symbolization utilities.
+  checks, and stacktrace and symbolization utilities.
+* [`hash`](absl/hash/)
+  <br /> The `hash` library contains the hashing framework and default hash
+  functor implementations for hashable types in Abseil.
 * [`memory`](absl/memory/)
   <br /> The `memory` library contains C++11-compatible versions of
   `std::make_unique()` and related memory management facilities.
@@ -67,7 +93,9 @@ Abseil contains the following C++ library components:
   time zones.
 * [`types`](absl/types/)
   <br /> The `types` library contains non-container utility types, like a
-  C++11-compatible version of `absl::optional`.
+  C++11-compatible version of the C++17 `std::optional` type.
+* [`utility`](absl/utility/)
+  <br /> The `utility` library contains utility and helper code.
 
 ## License
 
@@ -78,13 +106,9 @@ license. See [LICENSE](LICENSE) for more information.
 
 For more information about Abseil:
 
-* Consult our [Abseil Introduction](http://abseil.io/about/intro)
-* Read [Why Adopt Abseil](http://abseil.io/about/philosophy) to understand our
+* Consult our [Abseil Introduction](https://abseil.io/about/intro)
+* Read [Why Adopt Abseil](https://abseil.io/about/philosophy) to understand our
   design philosophy.
 * Peruse our
-  [Abseil Compatibility Guarantees](http://abseil.io/about/compatibility) to
+  [Abseil Compatibility Guarantees](https://abseil.io/about/compatibility) to
   understand both what we promise to you, and what we expect of you in return.
-
-## Disclaimer
-
-*   This is not an official Google product.
index 341b68b..bb90215 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -59,6 +59,18 @@ bool EqualImpl(InputIter1 first1, InputIter1 last1, InputIter2 first2,
          std::equal(first1, last1, first2, std::forward<Pred>(pred));
 }
 
+// When we are using our own internal predicate that just applies operator==, we
+// forward to the non-predicate form of std::equal. This enables an optimization
+// in libstdc++ that can result in std::memcmp being used for integer types.
+template <typename InputIter1, typename InputIter2>
+bool EqualImpl(InputIter1 first1, InputIter1 last1, InputIter2 first2,
+               InputIter2 last2, algorithm_internal::EqualTo /* unused */,
+               std::random_access_iterator_tag,
+               std::random_access_iterator_tag) {
+  return (last1 - first1 == last2 - first2) &&
+         std::equal(first1, last1, first2);
+}
+
 template <typename It>
 It RotateImpl(It first, It middle, It last, std::true_type) {
   return std::rotate(first, middle, last);
@@ -82,7 +94,7 @@ It RotateImpl(It first, It middle, It last, std::false_type) {
 // then the predicate is never invoked and the function returns false.
 //
 // This is a C++11-compatible implementation of C++14 `std::equal`.  See
-// http://en.cppreference.com/w/cpp/algorithm/equal for more information.
+// https://en.cppreference.com/w/cpp/algorithm/equal for more information.
 template <typename InputIter1, typename InputIter2, typename Pred>
 bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2,
            InputIter2 last2, Pred&& pred) {
index 740e207..c84de46 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -36,7 +36,6 @@
 // For template parameter and variable naming, `C` indicates the container type
 // to which the function is applied, `Pred` indicates the predicate object type
 // to be used by the function and `T` indicates the applicable element type.
-//
 
 #ifndef ABSL_ALGORITHM_CONTAINER_H_
 #define ABSL_ALGORITHM_CONTAINER_H_
@@ -46,6 +45,8 @@
 #include <iterator>
 #include <numeric>
 #include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
 #include <utility>
 #include <vector>
 
@@ -54,7 +55,6 @@
 #include "absl/meta/type_traits.h"
 
 namespace absl {
-
 namespace container_algorithm_internal {
 
 // NOTE: it is important to defer to ADL lookup for building with C++ modules,
@@ -69,6 +69,12 @@ using std::end;
 template <typename C>
 using ContainerIter = decltype(begin(std::declval<C&>()));
 
+// An MSVC bug involving template parameter substitution requires us to use
+// decltype() here instead of just std::pair.
+template <typename C1, typename C2>
+using ContainerIterPairType =
+    decltype(std::make_pair(ContainerIter<C1>(), ContainerIter<C2>()));
+
 template <typename C>
 using ContainerDifferenceType =
     decltype(std::distance(std::declval<ContainerIter<C>>(),
@@ -95,6 +101,17 @@ ContainerIter<C> c_begin(C& c) { return begin(c); }
 template <typename C>
 ContainerIter<C> c_end(C& c) { return end(c); }
 
+template <typename T>
+struct IsUnorderedContainer : std::false_type {};
+
+template <class Key, class T, class Hash, class KeyEqual, class Allocator>
+struct IsUnorderedContainer<
+    std::unordered_map<Key, T, Hash, KeyEqual, Allocator>> : std::true_type {};
+
+template <class Key, class Hash, class KeyEqual, class Allocator>
+struct IsUnorderedContainer<std::unordered_set<Key, Hash, KeyEqual, Allocator>>
+    : std::true_type {};
+
 }  // namespace container_algorithm_internal
 
 // PUBLIC API
@@ -308,11 +325,10 @@ container_algorithm_internal::ContainerDifferenceType<const C> c_count_if(
 
 // c_mismatch()
 //
-// Container-based version of the <algorithm> `std::mismatchf()` function to
+// Container-based version of the <algorithm> `std::mismatch()` function to
 // return the first element where two ordered containers differ.
 template <typename C1, typename C2>
-std::pair<container_algorithm_internal::ContainerIter<C1>,
-          container_algorithm_internal::ContainerIter<C2>>
+container_algorithm_internal::ContainerIterPairType<C1, C2>
 c_mismatch(C1& c1, C2& c2) {
   return std::mismatch(container_algorithm_internal::c_begin(c1),
                        container_algorithm_internal::c_end(c1),
@@ -322,8 +338,7 @@ c_mismatch(C1& c1, C2& c2) {
 // Overload of c_mismatch() for using a predicate evaluation other than `==` as
 // the function's test condition.
 template <typename C1, typename C2, typename BinaryPredicate>
-std::pair<container_algorithm_internal::ContainerIter<C1>,
-          container_algorithm_internal::ContainerIter<C2>>
+container_algorithm_internal::ContainerIterPairType<C1, C2>
 c_mismatch(C1& c1, C2& c2, BinaryPredicate&& pred) {
   return std::mismatch(container_algorithm_internal::c_begin(c1),
                        container_algorithm_internal::c_end(c1),
@@ -490,7 +505,7 @@ BidirectionalIterator c_copy_backward(const C& src,
 // Container-based version of the <algorithm> `std::move()` function to move
 // a container's elements into an iterator.
 template <typename C, typename OutputIterator>
-OutputIterator c_move(C& src, OutputIterator dest) {
+OutputIterator c_move(C&& src, OutputIterator dest) {
   return std::move(container_algorithm_internal::c_begin(src),
                    container_algorithm_internal::c_end(src), dest);
 }
@@ -500,7 +515,7 @@ OutputIterator c_move(C& src, OutputIterator dest) {
 // Container-based version of the <algorithm> `std::move_backward()` function to
 // move a container's elements into an iterator in reverse order.
 template <typename C, typename BidirectionalIterator>
-BidirectionalIterator c_move_backward(C& src, BidirectionalIterator dest) {
+BidirectionalIterator c_move_backward(C&& src, BidirectionalIterator dest) {
   return std::move_backward(container_algorithm_internal::c_begin(src),
                             container_algorithm_internal::c_end(src), dest);
 }
@@ -640,9 +655,8 @@ container_algorithm_internal::ContainerIter<C> c_generate_n(C& c, Size n,
 
 // Note: `c_xx()` <algorithm> container versions for `remove()`, `remove_if()`,
 // and `unique()` are omitted, because it's not clear whether or not such
-// functions should call erase their supplied sequences afterwards. Either
+// functions should call erase on their supplied sequences afterwards. Either
 // behavior would be surprising for a different set of users.
-//
 
 // c_remove_copy()
 //
@@ -869,7 +883,7 @@ void c_stable_sort(C& c, Compare&& comp) {
 // c_is_sorted()
 //
 // Container-based version of the <algorithm> `std::is_sorted()` function
-// to evaluate whether the given containter is sorted in ascending order.
+// to evaluate whether the given container is sorted in ascending order.
 template <typename C>
 bool c_is_sorted(const C& c) {
   return std::is_sorted(container_algorithm_internal::c_begin(c),
@@ -1042,8 +1056,7 @@ container_algorithm_internal::ContainerIter<Sequence> c_upper_bound(
 // to return an iterator pair pointing to the first and last elements in a
 // sorted container which compare equal to `value`.
 template <typename Sequence, typename T>
-std::pair<container_algorithm_internal::ContainerIter<Sequence>,
-          container_algorithm_internal::ContainerIter<Sequence>>
+container_algorithm_internal::ContainerIterPairType<Sequence, Sequence>
 c_equal_range(Sequence& sequence, T&& value) {
   return std::equal_range(container_algorithm_internal::c_begin(sequence),
                           container_algorithm_internal::c_end(sequence),
@@ -1053,8 +1066,7 @@ c_equal_range(Sequence& sequence, T&& value) {
 // Overload of c_equal_range() for performing a `comp` comparison other than
 // the default `operator<`.
 template <typename Sequence, typename T, typename Compare>
-std::pair<container_algorithm_internal::ContainerIter<Sequence>,
-          container_algorithm_internal::ContainerIter<Sequence>>
+container_algorithm_internal::ContainerIterPairType<Sequence, Sequence>
 c_equal_range(Sequence& sequence, T&& value, Compare&& comp) {
   return std::equal_range(container_algorithm_internal::c_begin(sequence),
                           container_algorithm_internal::c_end(sequence),
@@ -1162,7 +1174,13 @@ bool c_includes(const C1& c1, const C2& c2, Compare&& comp) {
 // Container-based version of the <algorithm> `std::set_union()` function
 // to return an iterator containing the union of two containers; duplicate
 // values are not copied into the output.
-template <typename C1, typename C2, typename OutputIterator>
+template <typename C1, typename C2, typename OutputIterator,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_union(const C1& c1, const C2& c2, OutputIterator output) {
   return std::set_union(container_algorithm_internal::c_begin(c1),
                         container_algorithm_internal::c_end(c1),
@@ -1172,7 +1190,13 @@ OutputIterator c_set_union(const C1& c1, const C2& c2, OutputIterator output) {
 
 // Overload of c_set_union() for performing a merge using a `comp` other than
 // `operator<`.
-template <typename C1, typename C2, typename OutputIterator, typename Compare>
+template <typename C1, typename C2, typename OutputIterator, typename Compare,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_union(const C1& c1, const C2& c2, OutputIterator output,
                            Compare&& comp) {
   return std::set_union(container_algorithm_internal::c_begin(c1),
@@ -1186,7 +1210,13 @@ OutputIterator c_set_union(const C1& c1, const C2& c2, OutputIterator output,
 //
 // Container-based version of the <algorithm> `std::set_intersection()` function
 // to return an iterator containing the intersection of two containers.
-template <typename C1, typename C2, typename OutputIterator>
+template <typename C1, typename C2, typename OutputIterator,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_intersection(const C1& c1, const C2& c2,
                                   OutputIterator output) {
   return std::set_intersection(container_algorithm_internal::c_begin(c1),
@@ -1197,7 +1227,13 @@ OutputIterator c_set_intersection(const C1& c1, const C2& c2,
 
 // Overload of c_set_intersection() for performing a merge using a `comp` other
 // than `operator<`.
-template <typename C1, typename C2, typename OutputIterator, typename Compare>
+template <typename C1, typename C2, typename OutputIterator, typename Compare,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_intersection(const C1& c1, const C2& c2,
                                   OutputIterator output, Compare&& comp) {
   return std::set_intersection(container_algorithm_internal::c_begin(c1),
@@ -1212,7 +1248,13 @@ OutputIterator c_set_intersection(const C1& c1, const C2& c2,
 // Container-based version of the <algorithm> `std::set_difference()` function
 // to return an iterator containing elements present in the first container but
 // not in the second.
-template <typename C1, typename C2, typename OutputIterator>
+template <typename C1, typename C2, typename OutputIterator,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_difference(const C1& c1, const C2& c2,
                                 OutputIterator output) {
   return std::set_difference(container_algorithm_internal::c_begin(c1),
@@ -1223,7 +1265,13 @@ OutputIterator c_set_difference(const C1& c1, const C2& c2,
 
 // Overload of c_set_difference() for performing a merge using a `comp` other
 // than `operator<`.
-template <typename C1, typename C2, typename OutputIterator, typename Compare>
+template <typename C1, typename C2, typename OutputIterator, typename Compare,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_difference(const C1& c1, const C2& c2,
                                 OutputIterator output, Compare&& comp) {
   return std::set_difference(container_algorithm_internal::c_begin(c1),
@@ -1238,7 +1286,13 @@ OutputIterator c_set_difference(const C1& c1, const C2& c2,
 // Container-based version of the <algorithm> `std::set_symmetric_difference()`
 // function to return an iterator containing elements present in either one
 // container or the other, but not both.
-template <typename C1, typename C2, typename OutputIterator>
+template <typename C1, typename C2, typename OutputIterator,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_symmetric_difference(const C1& c1, const C2& c2,
                                           OutputIterator output) {
   return std::set_symmetric_difference(
@@ -1250,7 +1304,13 @@ OutputIterator c_set_symmetric_difference(const C1& c1, const C2& c2,
 
 // Overload of c_set_symmetric_difference() for performing a merge using a
 // `comp` other than `operator<`.
-template <typename C1, typename C2, typename OutputIterator, typename Compare>
+template <typename C1, typename C2, typename OutputIterator, typename Compare,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C1>::value,
+              void>::type,
+          typename = typename std::enable_if<
+              !container_algorithm_internal::IsUnorderedContainer<C2>::value,
+              void>::type>
 OutputIterator c_set_symmetric_difference(const C1& c1, const C2& c2,
                                           OutputIterator output,
                                           Compare&& comp) {
@@ -1437,8 +1497,7 @@ container_algorithm_internal::ContainerIter<Sequence> c_max_element(
 // smallest and largest values, respectively, using `operator<` to make the
 // comparisons.
 template <typename C>
-std::pair<container_algorithm_internal::ContainerIter<C>,
-          container_algorithm_internal::ContainerIter<C>>
+container_algorithm_internal::ContainerIterPairType<C, C>
 c_minmax_element(C& c) {
   return std::minmax_element(container_algorithm_internal::c_begin(c),
                              container_algorithm_internal::c_end(c));
@@ -1447,8 +1506,7 @@ c_minmax_element(C& c) {
 // Overload of c_minmax_element() for performing `comp` comparisons other than
 // `operator<`.
 template <typename C, typename Compare>
-std::pair<container_algorithm_internal::ContainerIter<C>,
-          container_algorithm_internal::ContainerIter<C>>
+container_algorithm_internal::ContainerIterPairType<C, C>
 c_minmax_element(C& c, Compare&& comp) {
   return std::minmax_element(container_algorithm_internal::c_begin(c),
                              container_algorithm_internal::c_end(c),
@@ -1588,7 +1646,7 @@ decay_t<T> c_inner_product(const Sequence1& factors1, const Sequence2& factors2,
 }
 
 // Overload of c_inner_product() for using binary operations other than
-// `operator+` (for computing the accumlation) and `operator*` (for computing
+// `operator+` (for computing the accumulation) and `operator*` (for computing
 // the product between the two container's element pair).
 template <typename Sequence1, typename Sequence2, typename T,
           typename BinaryOp1, typename BinaryOp2>
index ddf4458..a7da62a 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -52,7 +52,8 @@
 // Example:
 //
 //   // Enable branches in the Abseil code that are tagged for ASan:
-//   $ bazel -D ADDRESS_SANITIZER -fsanitize=address *target*
+//   $ bazel build --copt=-DADDRESS_SANITIZER --copt=-fsanitize=address
+//     --linkopt=-fsanitize=address *target*
 //
 // Since these macro names are only supported by GCC and Clang, we only check
 // for `__GNUC__` (GCC or Clang) and the above macros.
@@ -79,7 +80,7 @@
 //
 // A function-like feature checking macro that accepts C++11 style attributes.
 // It's a wrapper around `__has_cpp_attribute`, defined by ISO C++ SD-6
-// (http://en.cppreference.com/w/cpp/experimental/feature_test). If we don't
+// (https://en.cppreference.com/w/cpp/experimental/feature_test). If we don't
 // find `__has_cpp_attribute`, will evaluate to 0.
 #if defined(__cplusplus) && defined(__has_cpp_attribute)
 // NOTE: requiring __cplusplus above should not be necessary, but
 // ABSL_PRINTF_ATTRIBUTE
 // ABSL_SCANF_ATTRIBUTE
 //
-// Tells the compiler to perform `printf` format std::string checking if the
+// Tells the compiler to perform `printf` format string checking if the
 // compiler supports it; see the 'format' attribute in
-// <http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html>.
+// <https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html>.
 //
 // Note: As the GCC manual states, "[s]ince non-static C++ methods
 // have an implicit 'this' argument, the arguments of such methods
 // ABSL_ATTRIBUTE_WEAK
 //
 // Tags a function as weak for the purposes of compilation and linking.
-#if ABSL_HAVE_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__))
+// Weak attributes currently do not work properly in LLVM's Windows backend,
+// so disable them there. See https://bugs.llvm.org/show_bug.cgi?id=37598
+// for futher information.
+#if (ABSL_HAVE_ATTRIBUTE(weak) || \
+     (defined(__GNUC__) && !defined(__clang__))) && \
+    !(defined(__llvm__) && defined(_WIN32))
 #undef ABSL_ATTRIBUTE_WEAK
 #define ABSL_ATTRIBUTE_WEAK __attribute__((weak))
 #define ABSL_HAVE_ATTRIBUTE_WEAK 1
 // out of bounds or does other scary things with memory.
 // NOTE: GCC supports AddressSanitizer(asan) since 4.8.
 // https://gcc.gnu.org/gcc-4.8/changes.html
-#if defined(__GNUC__) && defined(ADDRESS_SANITIZER)
+#if defined(__GNUC__)
 #define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
 #else
 #define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS
 // This attribute is similar to the ADDRESS_SANITIZER attribute above, but deals
 // with initialized-ness rather than addressability issues.
 // NOTE: MemorySanitizer(msan) is supported by Clang but not GCC.
-#if defined(__GNUC__) && defined(MEMORY_SANITIZER)
+#if defined(__clang__)
 #define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
 #else
 #define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY
 // Tells the ThreadSanitizer to not instrument a given function.
 // NOTE: GCC supports ThreadSanitizer(tsan) since 4.8.
 // https://gcc.gnu.org/gcc-4.8/changes.html
-#if defined(__GNUC__) && defined(THREAD_SANITIZER)
+#if defined(__GNUC__)
 #define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
 #else
 #define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD
 // ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED
 //
 // Tells the UndefinedSanitizer to ignore a given function. Useful for cases
-// where certain behavior (eg. devision by zero) is being used intentionally.
+// where certain behavior (eg. division by zero) is being used intentionally.
 // NOTE: GCC supports UndefinedBehaviorSanitizer(ubsan) since 4.9.
 // https://gcc.gnu.org/gcc-4.9/changes.html
 #if defined(__GNUC__) && \
 #define ABSL_ATTRIBUTE_NO_SANITIZE_CFI
 #endif
 
+// ABSL_ATTRIBUTE_NO_SANITIZE_SAFESTACK
+//
+// Tells the SafeStack to not instrument a given function.
+// See https://clang.llvm.org/docs/SafeStack.html for details.
+#if defined(__GNUC__) && defined(SAFESTACK_SANITIZER)
+#define ABSL_ATTRIBUTE_NO_SANITIZE_SAFESTACK \
+  __attribute__((no_sanitize("safe-stack")))
+#else
+#define ABSL_ATTRIBUTE_NO_SANITIZE_SAFESTACK
+#endif
+
+// ABSL_ATTRIBUTE_RETURNS_NONNULL
+//
+// Tells the compiler that a particular function never returns a null pointer.
+#if ABSL_HAVE_ATTRIBUTE(returns_nonnull) || \
+    (defined(__GNUC__) && \
+     (__GNUC__ > 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && \
+     !defined(__clang__))
+#define ABSL_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
+#else
+#define ABSL_ATTRIBUTE_RETURNS_NONNULL
+#endif
+
 // ABSL_HAVE_ATTRIBUTE_SECTION
 //
-// Indicates whether labeled sections are supported. Labeled sections are not
-// supported on Darwin/iOS.
+// Indicates whether labeled sections are supported. Weak symbol support is
+// a prerequisite. Labeled sections are not supported on Darwin/iOS.
 #ifdef ABSL_HAVE_ATTRIBUTE_SECTION
 #error ABSL_HAVE_ATTRIBUTE_SECTION cannot be directly set
 #elif (ABSL_HAVE_ATTRIBUTE(section) ||                \
        (defined(__GNUC__) && !defined(__clang__))) && \
-    !defined(__APPLE__)
+    !defined(__APPLE__) && ABSL_HAVE_ATTRIBUTE_WEAK
 #define ABSL_HAVE_ATTRIBUTE_SECTION 1
 
 // ABSL_ATTRIBUTE_SECTION
   __attribute__((section(#name))) __attribute__((noinline))
 #endif
 
+
 // ABSL_ATTRIBUTE_SECTION_VARIABLE
 //
 // Tells the compiler/linker to put a given variable into a section and define
   (reinterpret_cast<void *>(__start_##name))
 #define ABSL_ATTRIBUTE_SECTION_STOP(name) \
   (reinterpret_cast<void *>(__stop_##name))
+
 #else  // !ABSL_HAVE_ATTRIBUTE_SECTION
 
 #define ABSL_HAVE_ATTRIBUTE_SECTION 0
 #define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name)
 #define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast<void *>(0))
 #define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(0))
+
 #endif  // ABSL_ATTRIBUTE_SECTION
 
 // ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC
 
 // ABSL_MUST_USE_RESULT
 //
-// Tells the compiler to warn about unused return values for functions declared
-// with this macro. The macro must appear as the very first part of a function
-// declaration or definition:
+// Tells the compiler to warn about unused results.
 //
-// Example:
+// When annotating a function, it must appear as the first part of the
+// declaration or definition. The compiler will warn if the return value from
+// such a function is unused:
 //
 //   ABSL_MUST_USE_RESULT Sprocket* AllocateSprocket();
+//   AllocateSprocket();  // Triggers a warning.
+//
+// When annotating a class, it is equivalent to annotating every function which
+// returns an instance.
+//
+//   class ABSL_MUST_USE_RESULT Sprocket {};
+//   Sprocket();  // Triggers a warning.
 //
-// This placement has the broadest compatibility with GCC, Clang, and MSVC, with
-// both defs and decls, and with GCC-style attributes, MSVC declspec, C++11
-// and C++17 attributes.
+//   Sprocket MakeSprocket();
+//   MakeSprocket();  // Triggers a warning.
+//
+// Note that references and pointers are not instances:
+//
+//   Sprocket* SprocketPointer();
+//   SprocketPointer();  // Does *not* trigger a warning.
 //
 // ABSL_MUST_USE_RESULT allows using cast-to-void to suppress the unused result
 // warning. For that, warn_unused_result is used only for clang but not for gcc.
 #define ABSL_XRAY_LOG_ARGS(N)
 #endif
 
+// ABSL_ATTRIBUTE_REINITIALIZES
+//
+// Indicates that a member function reinitializes the entire object to a known
+// state, independent of the previous state of the object.
+//
+// The clang-tidy check bugprone-use-after-move allows member functions marked
+// with this attribute to be called on objects that have been moved from;
+// without the attribute, this would result in a use-after-move warning.
+#if ABSL_HAVE_CPP_ATTRIBUTE(clang::reinitializes)
+#define ABSL_ATTRIBUTE_REINITIALIZES [[clang::reinitializes]]
+#else
+#define ABSL_ATTRIBUTE_REINITIALIZES
+#endif
+
 // -----------------------------------------------------------------------------
 // Variable Attributes
 // -----------------------------------------------------------------------------
 
 // ABSL_ATTRIBUTE_UNUSED
 //
-// Prevents the compiler from complaining about or optimizing away variables
-// that appear unused.
+// Prevents the compiler from complaining about variables that appear unused.
 #if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__))
 #undef ABSL_ATTRIBUTE_UNUSED
 #define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__))
 #define ABSL_ATTRIBUTE_PACKED
 #endif
 
+// ABSL_ATTRIBUTE_FUNC_ALIGN
+//
+// Tells the compiler to align the function start at least to certain
+// alignment boundary
+#if ABSL_HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
+#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
+#else
+#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes)
+#endif
+
 // ABSL_CONST_INIT
 //
 // A variable declaration annotated with the `ABSL_CONST_INIT` attribute will
 // not compile (on supported platforms) unless the variable has a constant
 // initializer. This is useful for variables with static and thread storage
 // duration, because it guarantees that they will not suffer from the so-called
-// "static init order fiasco".
+// "static init order fiasco".  Prefer to put this attribute on the most visible
+// declaration of the variable, if there's more than one, because code that
+// accesses the variable can then use the attribute for optimization.
 //
 // Example:
 //
-//   ABSL_CONST_INIT static MyType my_var = MakeMyType(...);
+//   class MyClass {
+//    public:
+//     ABSL_CONST_INIT static MyType my_var;
+//   };
+//
+//   MyType MyClass::my_var = MakeMyType(...);
 //
 // Note that this attribute is redundant if the variable is declared constexpr.
 #if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization)
index 5d823a1..e7fc230 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -29,6 +29,7 @@
 #include <atomic>
 #include <cstdint>
 #include <type_traits>
+#include <utility>
 
 #include "absl/base/internal/invoke.h"
 #include "absl/base/internal/low_level_scheduling.h"
@@ -36,6 +37,7 @@
 #include "absl/base/internal/scheduling_mode.h"
 #include "absl/base/internal/spinlock_wait.h"
 #include "absl/base/macros.h"
+#include "absl/base/optimization.h"
 #include "absl/base/port.h"
 
 namespace absl {
@@ -43,7 +45,6 @@ namespace absl {
 class once_flag;
 
 namespace base_internal {
-// Implementation detail.
 std::atomic<uint32_t>* ControlWord(absl::once_flag* flag);
 }  // namespace base_internal
 
@@ -134,7 +135,10 @@ enum {
   kOnceInit = 0,
   kOnceRunning = 0x65C2937B,
   kOnceWaiter = 0x05A308D2,
-  kOnceDone = 0x3F2D8AB0,
+  // A very small constant is chosen for kOnceDone so that it fit in a single
+  // compare with immediate instruction for most common ISAs.  This is verified
+  // for x86, POWER and ARM.
+  kOnceDone = 221,    // Random Number
 };
 
 template <typename Callable, typename... Args>
@@ -148,12 +152,8 @@ void CallOnceImpl(std::atomic<uint32_t>* control,
         old_control != kOnceRunning &&
         old_control != kOnceWaiter &&
         old_control != kOnceDone) {
-      ABSL_RAW_LOG(
-          FATAL,
-          "Unexpected value for control word: %d. Either the control word "
-          "has non-static storage duration (where GoogleOnceDynamic might "
-          "be appropriate), or there's been a memory corruption.",
-          old_control);
+      ABSL_RAW_LOG(FATAL, "Unexpected value for control word: 0x%lx",
+                   static_cast<unsigned long>(old_control));  // NOLINT
     }
   }
 #endif  // NDEBUG
index 266c4a0..aba0178 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // This header file defines casting templates to fit use cases not covered by
 // the standard casts provided in the C++ standard. As with all cast operations,
 // use these with caution and only if alternatives do not exist.
-//
 
 #ifndef ABSL_BASE_CASTS_H_
 #define ABSL_BASE_CASTS_H_
 
 #include <cstring>
+#include <memory>
 #include <type_traits>
+#include <utility>
 
 #include "absl/base/internal/identity.h"
+#include "absl/base/macros.h"
+#include "absl/meta/type_traits.h"
 
 namespace absl {
 
+namespace internal_casts {
+
+template <class Dest, class Source>
+struct is_bitcastable
+    : std::integral_constant<
+          bool,
+          sizeof(Dest) == sizeof(Source) &&
+              type_traits_internal::is_trivially_copyable<Source>::value &&
+              type_traits_internal::is_trivially_copyable<Dest>::value &&
+              std::is_default_constructible<Dest>::value> {};
+
+}  // namespace internal_casts
+
 // implicit_cast()
 //
 // Performs an implicit conversion between types following the language
@@ -82,7 +98,7 @@ namespace absl {
 //
 // Such implicit cast chaining may be useful within template logic.
 template <typename To>
-inline To implicit_cast(typename absl::internal::identity_t<To> to) {
+constexpr To implicit_cast(typename absl::internal::identity_t<To> to) {
   return to;
 }
 
@@ -122,11 +138,36 @@ inline To implicit_cast(typename absl::internal::identity_t<To> to) {
 // object in memory has one type, and a program accesses it with a different
 // type, the result is undefined behavior for most values of "different type".
 //
-// Such casting results is type punning: holding an object in memory of one type
+// Such casting results in type punning: holding an object in memory of one type
 // and reading its bits back using a different type. A `bit_cast()` avoids this
-// issue by implementating its casts using `memcpy()`, which avoids introducing
+// issue by implementing its casts using `memcpy()`, which avoids introducing
 // this undefined behavior.
-template <typename Dest, typename Source>
+//
+// NOTE: The requirements here are more strict than the bit_cast of standard
+// proposal p0476 due to the need for workarounds and lack of intrinsics.
+// Specifically, this implementation also requires `Dest` to be
+// default-constructible.
+template <
+    typename Dest, typename Source,
+    typename std::enable_if<internal_casts::is_bitcastable<Dest, Source>::value,
+                            int>::type = 0>
+inline Dest bit_cast(const Source& source) {
+  Dest dest;
+  memcpy(static_cast<void*>(std::addressof(dest)),
+         static_cast<const void*>(std::addressof(source)), sizeof(dest));
+  return dest;
+}
+
+// NOTE: This overload is only picked if the requirements of bit_cast are not
+// met. It is therefore UB, but is provided temporarily as previous versions of
+// this function template were unchecked. Do not use this in new code.
+template <
+    typename Dest, typename Source,
+    typename std::enable_if<
+        !internal_casts::is_bitcastable<Dest, Source>::value, int>::type = 0>
+ABSL_DEPRECATED(
+    "absl::bit_cast type requirements were violated. Update the types being "
+    "used such that they are the same size and are both TriviallyCopyable.")
 inline Dest bit_cast(const Source& source) {
   static_assert(sizeof(Dest) == sizeof(Source),
                 "Source and destination types should have equal sizes.");
index 4aff492..f12f84f 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #define ABSL_HAVE_TLS 1
 #endif
 
-// There are platforms for which TLS should not be used even though the compiler
-// makes it seem like it's supported (Android NDK < r12b for example).
-// This is primarily because of linker problems and toolchain misconfiguration:
-// Abseil does not intend to support this indefinitely. Currently, the newest
-// toolchain that we intend to support that requires this behavior is the
-// r11 NDK - allowing for a 5 year support window on that means this option
-// is likely to be removed around June of 2021.
-#if defined(__ANDROID__) && defined(__clang__)
-#if __has_include(<android/ndk-version.h>)
-#include <android/ndk-version.h>
-#endif
-// TLS isn't supported until NDK r12b per
-// https://developer.android.com/ndk/downloads/revision_history.html
-// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
-// <android/ndk-version.h>. For NDK < r16, users should define these macros,
-// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
-#if defined(__NDK_MAJOR__) && defined(__NDK_MINOR__) && \
-    ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
-#undef ABSL_HAVE_TLS
-#endif
-#endif  // defined(__ANDROID__) && defined(__clang__)
-
 // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
 //
 // Checks whether `std::is_trivially_destructible<T>` is supported.
 // Checks whether `std::is_trivially_copy_assignable<T>` is supported.
 
 // Notes: Clang with libc++ supports these features, as does gcc >= 5.1 with
-// either libc++ or libstdc++, and Visual Studio.
+// either libc++ or libstdc++, and Visual Studio (but not NVCC).
 #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
 #error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set
 #elif defined(ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE)
     (!defined(__clang__) && defined(__GNUC__) &&                 \
      (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)) && \
      (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) ||      \
-    defined(_MSC_VER)
+    (defined(_MSC_VER) && !defined(__NVCC__))
 #define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
 #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
 #endif
 // supported.
 #ifdef ABSL_HAVE_THREAD_LOCAL
 #error ABSL_HAVE_THREAD_LOCAL cannot be directly set
-#elif !defined(__apple_build_version__) ||   \
-    ((__apple_build_version__ >= 8000042) && \
-     !(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0))
-// Notes: Xcode's clang did not support `thread_local` until version
-// 8, and even then not for all iOS < 9.0.
+#elif defined(__APPLE__)
+// Notes:
+// * Xcode's clang did not support `thread_local` until version 8, and
+//   even then not for all iOS < 9.0.
+// * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
+//   targeting iOS 9.x.
+// * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
+//   making __has_feature unreliable there.
+//
+// Otherwise, `__has_feature` is only supported by Clang so it has be inside
+// `defined(__APPLE__)` check.
+#if __has_feature(cxx_thread_local) && \
+    !(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
+#define ABSL_HAVE_THREAD_LOCAL 1
+#endif
+#else  // !defined(__APPLE__)
 #define ABSL_HAVE_THREAD_LOCAL 1
 #endif
 
+// There are platforms for which TLS should not be used even though the compiler
+// makes it seem like it's supported (Android NDK < r12b for example).
+// This is primarily because of linker problems and toolchain misconfiguration:
+// Abseil does not intend to support this indefinitely. Currently, the newest
+// toolchain that we intend to support that requires this behavior is the
+// r11 NDK - allowing for a 5 year support window on that means this option
+// is likely to be removed around June of 2021.
+// TLS isn't supported until NDK r12b per
+// https://developer.android.com/ndk/downloads/revision_history.html
+// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
+// <android/ndk-version.h>. For NDK < r16, users should define these macros,
+// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
+#if defined(__ANDROID__) && defined(__clang__)
+#if __has_include(<android/ndk-version.h>)
+#include <android/ndk-version.h>
+#endif  // __has_include(<android/ndk-version.h>)
+#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
+    defined(__NDK_MINOR__) &&                                               \
+    ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
+#undef ABSL_HAVE_TLS
+#undef ABSL_HAVE_THREAD_LOCAL
+#endif
+#endif  // defined(__ANDROID__) && defined(__clang__)
+
+// Emscripten doesn't yet support `thread_local` or `__thread`.
+// https://github.com/emscripten-core/emscripten/issues/3502
+#if defined(__EMSCRIPTEN__)
+#undef ABSL_HAVE_TLS
+#undef ABSL_HAVE_THREAD_LOCAL
+#endif  // defined(__EMSCRIPTEN__)
+
 // ABSL_HAVE_INTRINSIC_INT128
 //
 // Checks whether the __int128 compiler extension for a 128-bit integral type is
 // supported.
 //
-// Notes: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
-// supported, except on ppc64 and aarch64 where __int128 exists but has exhibits
-// a sporadic compiler crashing bug. Nvidia's nvcc also defines __GNUC__ and
-// __SIZEOF_INT128__ but not all versions actually support __int128.
+// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
+// supported, but we avoid using it in certain cases:
+// * On Clang:
+//   * Building using Clang for Windows, where the Clang runtime library has
+//     128-bit support only on LP64 architectures, but Windows is LLP64.
+// * On Nvidia's nvcc:
+//   * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
+//     actually support __int128.
 #ifdef ABSL_HAVE_INTRINSIC_INT128
 #error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
-#elif (defined(__clang__) && defined(__SIZEOF_INT128__) &&               \
-       !defined(__ppc64__) && !defined(__aarch64__)) ||                  \
-    (defined(__CUDACC__) && defined(__SIZEOF_INT128__) &&                \
-     __CUDACC_VER__ >= 70000) ||                                         \
-    (!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \
-     defined(__SIZEOF_INT128__))
+#elif defined(__SIZEOF_INT128__)
+#if (defined(__clang__) && !defined(_WIN32)) || \
+    (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) ||                \
+    (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
 #define ABSL_HAVE_INTRINSIC_INT128 1
-#endif
+#elif defined(__CUDACC__)
+// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
+// string explaining that it has been removed starting with CUDA 9. We use
+// nested #ifs because there is no short-circuiting in the preprocessor.
+// NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
+#if __CUDACC_VER__ >= 70000
+#define ABSL_HAVE_INTRINSIC_INT128 1
+#endif  // __CUDACC_VER__ >= 70000
+#endif  // defined(__CUDACC__)
+#endif  // ABSL_HAVE_INTRINSIC_INT128
 
 // ABSL_HAVE_EXCEPTIONS
 //
 //   Windows                           _WIN32
 //   NaCL                              __native_client__
 //   AsmJS                             __asmjs__
-//   Fuschia                           __Fuchsia__
+//   WebAssembly                       __wasm__
+//   Fuchsia                           __Fuchsia__
 //
 // Note that since Android defines both __ANDROID__ and __linux__, one
 // may probe for either Linux or Android by simply testing for __linux__.
 // POSIX.1-2001.
 #ifdef ABSL_HAVE_MMAP
 #error ABSL_HAVE_MMAP cannot be directly set
-#elif defined(__linux__) || defined(__APPLE__) || defined(__ros__) || \
-    defined(__native_client__) || defined(__asmjs__) || defined(__Fuchsia__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||   \
+    defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
+    defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \
+    defined(__ASYLO__)
 #define ABSL_HAVE_MMAP 1
 #endif
 
 // functions as defined in POSIX.1-2001.
 #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
 #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
-#elif defined(__linux__) || defined(__APPLE__) || defined(__ros__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
+    defined(__ros__)
 #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
 #endif
 
 // family of functions as standardized in POSIX.1-2001.
 //
 // Note: While Apple provides <semaphore.h> for both iOS and macOS, it is
-// explicity deprecated and will cause build failures if enabled for those
+// explicitly deprecated and will cause build failures if enabled for those
 // platforms.  We side-step the issue by not defining it here for Apple
 // platforms.
 #ifdef ABSL_HAVE_SEMAPHORE_H
 #define ABSL_HAVE_ALARM 1
 #elif defined(_MSC_VER)
 // feature tests for Microsoft's library
+#elif defined(__EMSCRIPTEN__)
+// emscripten doesn't support signals
 #elif defined(__native_client__)
 #else
 // other standard libraries
 #error "absl endian detection needs to be set up for your compiler"
 #endif
 
+// MacOS 10.13 doesn't let you use <any>, <optional>, or <variant> even though
+// the headers exist and are publicly noted to work.  See
+// https://github.com/abseil/abseil-cpp/issues/207 and
+// https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
+#if defined(__APPLE__) && defined(_LIBCPP_VERSION) && \
+    defined(__MAC_OS_X_VERSION_MIN_REQUIRED__) &&     \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101400
+#define ABSL_INTERNAL_MACOS_CXX17_TYPES_UNAVAILABLE 1
+#else
+#define ABSL_INTERNAL_MACOS_CXX17_TYPES_UNAVAILABLE 0
+#endif
+
 // ABSL_HAVE_STD_ANY
 //
 // Checks whether C++17 std::any is available by checking whether <any> exists.
 #endif
 
 #ifdef __has_include
-#if __has_include(<any>) && __cplusplus >= 201703L
+#if __has_include(<any>) && __cplusplus >= 201703L && \
+    !ABSL_INTERNAL_MACOS_CXX17_TYPES_UNAVAILABLE
 #define ABSL_HAVE_STD_ANY 1
 #endif
 #endif
 #endif
 
 #ifdef __has_include
-#if __has_include(<optional>) && __cplusplus >= 201703L
+#if __has_include(<optional>) && __cplusplus >= 201703L && \
+    !ABSL_INTERNAL_MACOS_CXX17_TYPES_UNAVAILABLE
 #define ABSL_HAVE_STD_OPTIONAL 1
 #endif
 #endif
 
+// ABSL_HAVE_STD_VARIANT
+//
+// Checks whether C++17 std::variant is available.
+#ifdef ABSL_HAVE_STD_VARIANT
+#error "ABSL_HAVE_STD_VARIANT cannot be directly set."
+#endif
+
+#ifdef __has_include
+#if __has_include(<variant>) && __cplusplus >= 201703L && \
+    !ABSL_INTERNAL_MACOS_CXX17_TYPES_UNAVAILABLE
+#define ABSL_HAVE_STD_VARIANT 1
+#endif
+#endif
+
 // ABSL_HAVE_STD_STRING_VIEW
 //
 // Checks whether C++17 std::string_view is available.
 #endif
 #endif
 
+// For MSVC, `__has_include` is supported in VS 2017 15.3, which is later than
+// the support for <optional>, <any>, <string_view>, <variant>. So we use
+// _MSC_VER to check whether we have VS 2017 RTM (when <optional>, <any>,
+// <string_view>, <variant> is implemented) or higher. Also, `__cplusplus` is
+// not correctly set by MSVC, so we use `_MSVC_LANG` to check the language
+// version.
+// TODO(zhangxy): fix tests before enabling aliasing for `std::any`.
+#if defined(_MSC_VER) && _MSC_VER >= 1910 && \
+    ((defined(_MSVC_LANG) && _MSVC_LANG > 201402) || __cplusplus > 201402)
+// #define ABSL_HAVE_STD_ANY 1
+#define ABSL_HAVE_STD_OPTIONAL 1
+#define ABSL_HAVE_STD_VARIANT 1
+#define ABSL_HAVE_STD_STRING_VIEW 1
+#endif
+
+// In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION
+// SEH exception from emplace for variant<SomeStruct> when constructing the
+// struct can throw. This defeats some of variant_test and
+// variant_exception_safety_test.
+#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG)
+#define ABSL_INTERNAL_MSVC_2017_DBG_MODE
+#endif
+
 #endif  // ABSL_BASE_CONFIG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/const_init.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/const_init.h
new file mode 100644 (file)
index 0000000..17858a7
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// kConstInit
+// -----------------------------------------------------------------------------
+//
+// A constructor tag used to mark an object as safe for use as a global
+// variable, avoiding the usual lifetime issues that can affect globals.
+
+#ifndef ABSL_BASE_CONST_INIT_H_
+#define ABSL_BASE_CONST_INIT_H_
+
+// In general, objects with static storage duration (such as global variables)
+// can trigger tricky object lifetime situations.  Attempting to access them
+// from the constructors or destructors of other global objects can result in
+// undefined behavior, unless their constructors and destructors are designed
+// with this issue in mind.
+//
+// The normal way to deal with this issue in C++11 is to use constant
+// initialization and trivial destructors.
+//
+// Constant initialization is guaranteed to occur before any other code
+// executes.  Constructors that are declared 'constexpr' are eligible for
+// constant initialization.  You can annotate a variable declaration with the
+// ABSL_CONST_INIT macro to express this intent.  For compilers that support
+// it, this annotation will cause a compilation error for declarations that
+// aren't subject to constant initialization (perhaps because a runtime value
+// was passed as a constructor argument).
+//
+// On program shutdown, lifetime issues can be avoided on global objects by
+// ensuring that they contain  trivial destructors.  A class has a trivial
+// destructor unless it has a user-defined destructor, a virtual method or base
+// class, or a data member or base class with a non-trivial destructor of its
+// own.  Objects with static storage duration and a trivial destructor are not
+// cleaned up on program shutdown, and are thus safe to access from other code
+// running during shutdown.
+//
+// For a few core Abseil classes, we make a best effort to allow for safe global
+// instances, even though these classes have non-trivial destructors.  These
+// objects can be created with the absl::kConstInit tag.  For example:
+//   ABSL_CONST_INIT absl::Mutex global_mutex(absl::kConstInit);
+//
+// The line above declares a global variable of type absl::Mutex which can be
+// accessed at any point during startup or shutdown.  global_mutex's destructor
+// will still run, but will not invalidate the object.  Note that C++ specifies
+// that accessing an object after its destructor has run results in undefined
+// behavior, but this pattern works on the toolchains we support.
+//
+// The absl::kConstInit tag should only be used to define objects with static
+// or thread_local storage duration.
+
+namespace absl {
+
+enum ConstInitType {
+  kConstInit,
+};
+
+}  // namespace absl
+
+#endif  // ABSL_BASE_CONST_INIT_H_
index 3b6d6ef..65a54b4 100644 (file)
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      https://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 # define DYNAMIC_ANNOTATIONS_ENABLED 0
 #endif
 
-#if defined(__native_client__)
-  #include "nacl/dynamic_annotations.h"
-
-  // Stub out the macros missing from the NaCl version.
-  #ifndef ANNOTATE_CONTIGUOUS_CONTAINER
-    #define ANNOTATE_CONTIGUOUS_CONTAINER(beg, end, old_mid, new_mid)
-  #endif
-  #ifndef ANNOTATE_RWLOCK_CREATE_STATIC
-    #define ANNOTATE_RWLOCK_CREATE_STATIC(lock)
-  #endif
-  #ifndef ADDRESS_SANITIZER_REDZONE
-    #define ADDRESS_SANITIZER_REDZONE(name)
-  #endif
-  #ifndef ANNOTATE_MEMORY_IS_UNINITIALIZED
-    #define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size)
-  #endif
-
-#else /* !__native_client__ */
-
 #if DYNAMIC_ANNOTATIONS_ENABLED != 0
 
   /* -------------------------------------------------------------
   #define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) /* empty */
   #define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) /* empty */
 #endif  /* DYNAMIC_ANNOTATIONS_ENABLED || MEMORY_SANITIZER */
+
 /* TODO(delesley) -- Replace __CLANG_SUPPORT_DYN_ANNOTATION__ with the
    appropriate feature ID. */
 #if defined(__clang__) && (!defined(SWIG)) \
@@ -395,7 +377,7 @@ inline T ANNOTATE_UNPROTECTED_READ(const volatile T &x) { /* NOLINT */
   struct { char x[8] __attribute__ ((aligned (8))); } name
 #else
 #define ANNOTATE_CONTIGUOUS_CONTAINER(beg, end, old_mid, new_mid)
-#define ADDRESS_SANITIZER_REDZONE(name)
+#define ADDRESS_SANITIZER_REDZONE(name) static_assert(true, "")
 #endif  // ADDRESS_SANITIZER
 
 /* Undefine the macros intended only in this file. */
@@ -404,6 +386,4 @@ inline T ANNOTATE_UNPROTECTED_READ(const volatile T &x) { /* NOLINT */
 #undef ATTRIBUTE_IGNORE_READS_BEGIN
 #undef ATTRIBUTE_IGNORE_READS_END
 
-#endif /* !__native_client__ */
-
 #endif  /* ABSL_BASE_DYNAMIC_ANNOTATIONS_H_ */
index 47d4013..803e905 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #include <cstdint>
 #include <utility>
 
+#ifdef _MSC_FULL_VER
+#define ABSL_HAVE_WORKING_ATOMIC_POINTER 0
+#else
+#define ABSL_HAVE_WORKING_ATOMIC_POINTER 1
+#endif
+
 namespace absl {
 namespace base_internal {
 
@@ -29,9 +35,15 @@ class AtomicHook;
 
 // AtomicHook is a helper class, templatized on a raw function pointer type, for
 // implementing Abseil customization hooks.  It is a callable object that
-// dispatches to the registered hook, or performs a no-op (and returns a default
+// dispatches to the registered hook.
+//
+// A default constructed object performs a no-op (and returns a default
 // constructed object) if no hook has been registered.
 //
+// Hooks can be pre-registered via constant initialization, for example,
+// ABSL_CONST_INIT static AtomicHook<void(*)()> my_hook(DefaultAction);
+// and then changed at runtime via a call to Store().
+//
 // Reads and writes guarantee memory_order_acquire/memory_order_release
 // semantics.
 template <typename ReturnType, typename... Args>
@@ -39,7 +51,19 @@ class AtomicHook<ReturnType (*)(Args...)> {
  public:
   using FnPtr = ReturnType (*)(Args...);
 
-  constexpr AtomicHook() : hook_(kInitialValue) {}
+  // Constructs an object that by default performs a no-op (and
+  // returns a default constructed object) when no hook as been registered.
+  constexpr AtomicHook() : AtomicHook(DummyFunction) {}
+
+  // Constructs an object that by default dispatches to/returns the
+  // pre-registered default_fn when no hook has been registered at runtime.
+#if ABSL_HAVE_WORKING_ATOMIC_POINTER
+  explicit constexpr AtomicHook(FnPtr default_fn)
+      : hook_(default_fn), default_fn_(default_fn) {}
+#else
+  explicit constexpr AtomicHook(FnPtr default_fn)
+      : hook_(kUninitialized), default_fn_(default_fn) {}
+#endif
 
   // Stores the provided function pointer as the value for this hook.
   //
@@ -86,16 +110,7 @@ class AtomicHook<ReturnType (*)(Args...)> {
   //
   // This causes an issue when building with LLVM under Windows.  To avoid this,
   // we use a less-efficient, intptr_t-based implementation on Windows.
-
-#ifdef _MSC_FULL_VER
-#define ABSL_HAVE_WORKING_ATOMIC_POINTER 0
-#else
-#define ABSL_HAVE_WORKING_ATOMIC_POINTER 1
-#endif
-
 #if ABSL_HAVE_WORKING_ATOMIC_POINTER
-  static constexpr FnPtr kInitialValue = &DummyFunction;
-
   // Return the stored value, or DummyFunction if no value has been stored.
   FnPtr DoLoad() const { return hook_.load(std::memory_order_acquire); }
 
@@ -103,10 +118,9 @@ class AtomicHook<ReturnType (*)(Args...)> {
   // stored to this object.
   bool DoStore(FnPtr fn) {
     assert(fn);
-    FnPtr expected = DummyFunction;
-    hook_.compare_exchange_strong(expected, fn, std::memory_order_acq_rel,
-                                  std::memory_order_acquire);
-    const bool store_succeeded = (expected == DummyFunction);
+    FnPtr expected = default_fn_;
+    const bool store_succeeded = hook_.compare_exchange_strong(
+        expected, fn, std::memory_order_acq_rel, std::memory_order_acquire);
     const bool same_value_already_stored = (expected == fn);
     return store_succeeded || same_value_already_stored;
   }
@@ -114,15 +128,15 @@ class AtomicHook<ReturnType (*)(Args...)> {
   std::atomic<FnPtr> hook_;
 #else  // !ABSL_HAVE_WORKING_ATOMIC_POINTER
   // Use a sentinel value unlikely to be the address of an actual function.
-  static constexpr intptr_t kInitialValue = 0;
+  static constexpr intptr_t kUninitialized = 0;
 
   static_assert(sizeof(intptr_t) >= sizeof(FnPtr),
                 "intptr_t can't contain a function pointer");
 
   FnPtr DoLoad() const {
     const intptr_t value = hook_.load(std::memory_order_acquire);
-    if (value == 0) {
-      return DummyFunction;
+    if (value == kUninitialized) {
+      return default_fn_;
     }
     return reinterpret_cast<FnPtr>(value);
   }
@@ -130,16 +144,17 @@ class AtomicHook<ReturnType (*)(Args...)> {
   bool DoStore(FnPtr fn) {
     assert(fn);
     const auto value = reinterpret_cast<intptr_t>(fn);
-    intptr_t expected = 0;
-    hook_.compare_exchange_strong(expected, value, std::memory_order_acq_rel,
-                                  std::memory_order_acquire);
-    const bool store_succeeded = (expected == 0);
+    intptr_t expected = kUninitialized;
+    const bool store_succeeded = hook_.compare_exchange_strong(
+        expected, value, std::memory_order_acq_rel, std::memory_order_acquire);
     const bool same_value_already_stored = (expected == value);
     return store_succeeded || same_value_already_stored;
   }
 
   std::atomic<intptr_t> hook_;
 #endif
+
+  const FnPtr default_fn_;
 };
 
 #undef ABSL_HAVE_WORKING_ATOMIC_POINTER
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/bits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/bits.h
new file mode 100644 (file)
index 0000000..b0780f2
--- /dev/null
@@ -0,0 +1,193 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_BASE_INTERNAL_BITS_H_
+#define ABSL_BASE_INTERNAL_BITS_H_
+
+// This file contains bitwise ops which are implementation details of various
+// absl libraries.
+
+#include <cstdint>
+
+// Clang on Windows has __builtin_clzll; otherwise we need to use the
+// windows intrinsic functions.
+#if defined(_MSC_VER)
+#include <intrin.h>
+#if defined(_M_X64)
+#pragma intrinsic(_BitScanReverse64)
+#pragma intrinsic(_BitScanForward64)
+#endif
+#pragma intrinsic(_BitScanReverse)
+#pragma intrinsic(_BitScanForward)
+#endif
+
+#include "absl/base/attributes.h"
+
+#if defined(_MSC_VER)
+// We can achieve something similar to attribute((always_inline)) with MSVC by
+// using the __forceinline keyword, however this is not perfect. MSVC is
+// much less aggressive about inlining, and even with the __forceinline keyword.
+#define ABSL_BASE_INTERNAL_FORCEINLINE __forceinline
+#else
+// Use default attribute inline.
+#define ABSL_BASE_INTERNAL_FORCEINLINE inline ABSL_ATTRIBUTE_ALWAYS_INLINE
+#endif
+
+
+namespace absl {
+namespace base_internal {
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
+  int zeroes = 60;
+  if (n >> 32) zeroes -= 32, n >>= 32;
+  if (n >> 16) zeroes -= 16, n >>= 16;
+  if (n >> 8) zeroes -= 8, n >>= 8;
+  if (n >> 4) zeroes -= 4, n >>= 4;
+  return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64(uint64_t n) {
+#if defined(_MSC_VER) && defined(_M_X64)
+  // MSVC does not have __buitin_clzll. Use _BitScanReverse64.
+  unsigned long result = 0;  // NOLINT(runtime/int)
+  if (_BitScanReverse64(&result, n)) {
+    return 63 - result;
+  }
+  return 64;
+#elif defined(_MSC_VER)
+  // MSVC does not have __buitin_clzll. Compose two calls to _BitScanReverse
+  unsigned long result = 0;  // NOLINT(runtime/int)
+  if ((n >> 32) && _BitScanReverse(&result, n >> 32)) {
+    return 31 - result;
+  }
+  if (_BitScanReverse(&result, n)) {
+    return 63 - result;
+  }
+  return 64;
+#elif defined(__GNUC__)
+  // Use __builtin_clzll, which uses the following instructions:
+  //  x86: bsr
+  //  ARM64: clz
+  //  PPC: cntlzd
+  static_assert(sizeof(unsigned long long) == sizeof(n),  // NOLINT(runtime/int)
+                "__builtin_clzll does not take 64-bit arg");
+
+  // Handle 0 as a special case because __builtin_clzll(0) is undefined.
+  if (n == 0) {
+    return 64;
+  }
+  return __builtin_clzll(n);
+#else
+  return CountLeadingZeros64Slow(n);
+#endif
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros32Slow(uint64_t n) {
+  int zeroes = 28;
+  if (n >> 16) zeroes -= 16, n >>= 16;
+  if (n >> 8) zeroes -= 8, n >>= 8;
+  if (n >> 4) zeroes -= 4, n >>= 4;
+  return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros32(uint32_t n) {
+#if defined(_MSC_VER)
+  unsigned long result = 0;  // NOLINT(runtime/int)
+  if (_BitScanReverse(&result, n)) {
+    return 31 - result;
+  }
+  return 32;
+#elif defined(__GNUC__)
+  // Use __builtin_clz, which uses the following instructions:
+  //  x86: bsr
+  //  ARM64: clz
+  //  PPC: cntlzd
+  static_assert(sizeof(int) == sizeof(n),
+                "__builtin_clz does not take 32-bit arg");
+
+  // Handle 0 as a special case because __builtin_clz(0) is undefined.
+  if (n == 0) {
+    return 32;
+  }
+  return __builtin_clz(n);
+#else
+  return CountLeadingZeros32Slow(n);
+#endif
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero64Slow(uint64_t n) {
+  int c = 63;
+  n &= ~n + 1;
+  if (n & 0x00000000FFFFFFFF) c -= 32;
+  if (n & 0x0000FFFF0000FFFF) c -= 16;
+  if (n & 0x00FF00FF00FF00FF) c -= 8;
+  if (n & 0x0F0F0F0F0F0F0F0F) c -= 4;
+  if (n & 0x3333333333333333) c -= 2;
+  if (n & 0x5555555555555555) c -= 1;
+  return c;
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero64(uint64_t n) {
+#if defined(_MSC_VER) && defined(_M_X64)
+  unsigned long result = 0;  // NOLINT(runtime/int)
+  _BitScanForward64(&result, n);
+  return result;
+#elif defined(_MSC_VER)
+  unsigned long result = 0;  // NOLINT(runtime/int)
+  if (static_cast<uint32_t>(n) == 0) {
+    _BitScanForward(&result, n >> 32);
+    return result + 32;
+  }
+  _BitScanForward(&result, n);
+  return result;
+#elif defined(__GNUC__)
+  static_assert(sizeof(unsigned long long) == sizeof(n),  // NOLINT(runtime/int)
+                "__builtin_ctzll does not take 64-bit arg");
+  return __builtin_ctzll(n);
+#else
+  return CountTrailingZerosNonZero64Slow(n);
+#endif
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero32Slow(uint32_t n) {
+  int c = 31;
+  n &= ~n + 1;
+  if (n & 0x0000FFFF) c -= 16;
+  if (n & 0x00FF00FF) c -= 8;
+  if (n & 0x0F0F0F0F) c -= 4;
+  if (n & 0x33333333) c -= 2;
+  if (n & 0x55555555) c -= 1;
+  return c;
+}
+
+ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero32(uint32_t n) {
+#if defined(_MSC_VER)
+  unsigned long result = 0;  // NOLINT(runtime/int)
+  _BitScanForward(&result, n);
+  return result;
+#elif defined(__GNUC__)
+  static_assert(sizeof(int) == sizeof(n),
+                "__builtin_ctz does not take 32-bit arg");
+  return __builtin_ctz(n);
+#else
+  return CountTrailingZerosNonZero32Slow(n);
+#endif
+}
+
+#undef ABSL_BASE_INTERNAL_FORCEINLINE
+
+}  // namespace base_internal
+}  // namespace absl
+
+#endif  // ABSL_BASE_INTERNAL_BITS_H_
index 60e9715..794564e 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -28,7 +28,6 @@
 // not necessarily "CPU cycles" and code should not rely on that behavior, even
 // if experimentally observed.
 //
-//
 // An arbitrary offset may have been added to the counter at power on.
 //
 // On some platforms, the rate and offset of the counter may differ
@@ -71,6 +70,20 @@ class CycleClock {
   CycleClock& operator=(const CycleClock&) = delete;
 };
 
+using CycleClockSourceFunc = int64_t (*)();
+
+class CycleClockSource {
+ private:
+  // CycleClockSource::Register()
+  //
+  // Register a function that provides an alternate source for the unscaled CPU
+  // cycle count value. The source function must be async signal safe, must not
+  // call CycleClock::Now(), and must have a frequency that matches that of the
+  // unscaled clock used by CycleClock. A nullptr value resets CycleClock to use
+  // the default source.
+  static void Register(CycleClockSourceFunc source);
+};
+
 }  // namespace base_internal
 }  // namespace absl
 
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/direct_mmap.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/direct_mmap.h
new file mode 100644 (file)
index 0000000..0401ddf
--- /dev/null
@@ -0,0 +1,157 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Functions for directly invoking mmap() via syscall, avoiding the case where
+// mmap() has been locally overridden.
+
+#ifndef ABSL_BASE_INTERNAL_DIRECT_MMAP_H_
+#define ABSL_BASE_INTERNAL_DIRECT_MMAP_H_
+
+#include "absl/base/config.h"
+
+#if ABSL_HAVE_MMAP
+
+#include <sys/mman.h>
+
+#ifdef __linux__
+
+#include <sys/types.h>
+#ifdef __BIONIC__
+#include <sys/syscall.h>
+#else
+#include <syscall.h>
+#endif
+
+#include <linux/unistd.h>
+#include <unistd.h>
+#include <cerrno>
+#include <cstdarg>
+#include <cstdint>
+
+#ifdef __mips__
+// Include definitions of the ABI currently in use.
+#ifdef __BIONIC__
+// Android doesn't have sgidefs.h, but does have asm/sgidefs.h, which has the
+// definitions we need.
+#include <asm/sgidefs.h>
+#else
+#include <sgidefs.h>
+#endif  // __BIONIC__
+#endif  // __mips__
+
+// SYS_mmap and SYS_munmap are not defined in Android.
+#ifdef __BIONIC__
+extern "C" void* __mmap2(void*, size_t, int, int, int, size_t);
+#if defined(__NR_mmap) && !defined(SYS_mmap)
+#define SYS_mmap __NR_mmap
+#endif
+#ifndef SYS_munmap
+#define SYS_munmap __NR_munmap
+#endif
+#endif  // __BIONIC__
+
+namespace absl {
+namespace base_internal {
+
+// Platform specific logic extracted from
+// https://chromium.googlesource.com/linux-syscall-support/+/master/linux_syscall_support.h
+inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
+                        off64_t offset) noexcept {
+#if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
+    (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) ||                   \
+    (defined(__PPC__) && !defined(__PPC64__)) ||                             \
+    (defined(__s390__) && !defined(__s390x__))
+  // On these architectures, implement mmap with mmap2.
+  static int pagesize = 0;
+  if (pagesize == 0) {
+#if defined(__wasm__) || defined(__asmjs__)
+    pagesize = getpagesize();
+#else
+    pagesize = sysconf(_SC_PAGESIZE);
+#endif
+  }
+  if (offset < 0 || offset % pagesize != 0) {
+    errno = EINVAL;
+    return MAP_FAILED;
+  }
+#ifdef __BIONIC__
+  // SYS_mmap2 has problems on Android API level <= 16.
+  // Workaround by invoking __mmap2() instead.
+  return __mmap2(start, length, prot, flags, fd, offset / pagesize);
+#else
+  return reinterpret_cast<void*>(
+      syscall(SYS_mmap2, start, length, prot, flags, fd,
+              static_cast<off_t>(offset / pagesize)));
+#endif
+#elif defined(__s390x__)
+  // On s390x, mmap() arguments are passed in memory.
+  unsigned long buf[6] = {reinterpret_cast<unsigned long>(start),  // NOLINT
+                          static_cast<unsigned long>(length),      // NOLINT
+                          static_cast<unsigned long>(prot),        // NOLINT
+                          static_cast<unsigned long>(flags),       // NOLINT
+                          static_cast<unsigned long>(fd),          // NOLINT
+                          static_cast<unsigned long>(offset)};     // NOLINT
+  return reinterpret_cast<void*>(syscall(SYS_mmap, buf));
+#elif defined(__x86_64__)
+// The x32 ABI has 32 bit longs, but the syscall interface is 64 bit.
+// We need to explicitly cast to an unsigned 64 bit type to avoid implicit
+// sign extension.  We can't cast pointers directly because those are
+// 32 bits, and gcc will dump ugly warnings about casting from a pointer
+// to an integer of a different size. We also need to make sure __off64_t
+// isn't truncated to 32-bits under x32.
+#define MMAP_SYSCALL_ARG(x) ((uint64_t)(uintptr_t)(x))
+  return reinterpret_cast<void*>(
+      syscall(SYS_mmap, MMAP_SYSCALL_ARG(start), MMAP_SYSCALL_ARG(length),
+              MMAP_SYSCALL_ARG(prot), MMAP_SYSCALL_ARG(flags),
+              MMAP_SYSCALL_ARG(fd), static_cast<uint64_t>(offset)));
+#undef MMAP_SYSCALL_ARG
+#else  // Remaining 64-bit aritectures.
+  static_assert(sizeof(unsigned long) == 8, "Platform is not 64-bit");
+  return reinterpret_cast<void*>(
+      syscall(SYS_mmap, start, length, prot, flags, fd, offset));
+#endif
+}
+
+inline int DirectMunmap(void* start, size_t length) {
+  return static_cast<int>(syscall(SYS_munmap, start, length));
+}
+
+}  // namespace base_internal
+}  // namespace absl
+
+#else  // !__linux__
+
+// For non-linux platforms where we have mmap, just dispatch directly to the
+// actual mmap()/munmap() methods.
+
+namespace absl {
+namespace base_internal {
+
+inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
+                        off_t offset) {
+  return mmap(start, length, prot, flags, fd, offset);
+}
+
+inline int DirectMunmap(void* start, size_t length) {
+  return munmap(start, length);
+}
+
+}  // namespace base_internal
+}  // namespace absl
+
+#endif  // __linux__
+
+#endif  // ABSL_HAVE_MMAP
+
+#endif  // ABSL_BASE_INTERNAL_DIRECT_MMAP_H_
index 602129e..6b828b6 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,6 +22,8 @@
 #elif defined(__APPLE__)
 // Mac OS X / Darwin features
 #include <libkern/OSByteOrder.h>
+#elif defined(__FreeBSD__)
+#include <sys/endian.h>
 #elif defined(__GLIBC__)
 #include <byteswap.h>  // IWYU pragma: export
 #endif
@@ -73,21 +75,21 @@ inline uint64_t gbswap_64(uint64_t host_int) {
   if (__builtin_constant_p(host_int)) {
     return __bswap_constant_64(host_int);
   } else {
-    register uint64_t result;
+    uint64_t result;
     __asm__("bswap %0" : "=r"(result) : "0"(host_int));
     return result;
   }
 #elif defined(__GLIBC__)
   return bswap_64(host_int);
 #else
-  return (((x & uint64_t{(0xFF}) << 56) |
-          ((x & uint64_t{(0xFF00}) << 40) |
-          ((x & uint64_t{(0xFF0000}) << 24) |
-          ((x & uint64_t{(0xFF000000}) << 8) |
-          ((x & uint64_t{(0xFF00000000}) >> 8) |
-          ((x & uint64_t{(0xFF0000000000}) >> 24) |
-          ((x & uint64_t{(0xFF000000000000}) >> 40) |
-          ((x & uint64_t{(0xFF00000000000000}) >> 56));
+  return (((host_int & uint64_t{0xFF}) << 56) |
+          ((host_int & uint64_t{0xFF00}) << 40) |
+          ((host_int & uint64_t{0xFF0000}) << 24) |
+          ((host_int & uint64_t{0xFF000000}) << 8) |
+          ((host_int & uint64_t{0xFF00000000}) >> 8) |
+          ((host_int & uint64_t{0xFF0000000000}) >> 24) |
+          ((host_int & uint64_t{0xFF000000000000}) >> 40) |
+          ((host_int & uint64_t{0xFF00000000000000}) >> 56));
 #endif  // bswap_64
 }
 
@@ -95,8 +97,10 @@ inline uint32_t gbswap_32(uint32_t host_int) {
 #if defined(__GLIBC__)
   return bswap_32(host_int);
 #else
-  return (((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) |
-          ((x & 0xFF000000) >> 24));
+  return (((host_int & uint32_t{0xFF}) << 24) |
+          ((host_int & uint32_t{0xFF00}) << 8) |
+          ((host_int & uint32_t{0xFF0000}) >> 8) |
+          ((host_int & uint32_t{0xFF000000}) >> 24));
 #endif
 }
 
@@ -104,7 +108,8 @@ inline uint16_t gbswap_16(uint16_t host_int) {
 #if defined(__GLIBC__)
   return bswap_16(host_int);
 #else
-  return uint16_t{((x & 0xFF) << 8) | ((x & 0xFF00) >> 8)};
+  return (((host_int & uint16_t{0xFF}) << 8) |
+          ((host_int & uint16_t{0xFF00}) >> 8));
 #endif
 }
 
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/exception_safety_testing.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/exception_safety_testing.h
new file mode 100644 (file)
index 0000000..be38ba5
--- /dev/null
@@ -0,0 +1,1096 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Utilities for testing exception-safety
+
+#ifndef ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_
+#define ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <functional>
+#include <initializer_list>
+#include <iosfwd>
+#include <string>
+#include <tuple>
+#include <unordered_map>
+
+#include "gtest/gtest.h"
+#include "absl/base/config.h"
+#include "absl/base/internal/pretty_function.h"
+#include "absl/memory/memory.h"
+#include "absl/meta/type_traits.h"
+#include "absl/strings/string_view.h"
+#include "absl/strings/substitute.h"
+#include "absl/utility/utility.h"
+
+namespace testing {
+
+enum class TypeSpec;
+enum class AllocSpec;
+
+constexpr TypeSpec operator|(TypeSpec a, TypeSpec b) {
+  using T = absl::underlying_type_t<TypeSpec>;
+  return static_cast<TypeSpec>(static_cast<T>(a) | static_cast<T>(b));
+}
+
+constexpr TypeSpec operator&(TypeSpec a, TypeSpec b) {
+  using T = absl::underlying_type_t<TypeSpec>;
+  return static_cast<TypeSpec>(static_cast<T>(a) & static_cast<T>(b));
+}
+
+constexpr AllocSpec operator|(AllocSpec a, AllocSpec b) {
+  using T = absl::underlying_type_t<AllocSpec>;
+  return static_cast<AllocSpec>(static_cast<T>(a) | static_cast<T>(b));
+}
+
+constexpr AllocSpec operator&(AllocSpec a, AllocSpec b) {
+  using T = absl::underlying_type_t<AllocSpec>;
+  return static_cast<AllocSpec>(static_cast<T>(a) & static_cast<T>(b));
+}
+
+namespace exceptions_internal {
+
+std::string GetSpecString(TypeSpec);
+std::string GetSpecString(AllocSpec);
+
+struct NoThrowTag {};
+struct StrongGuaranteeTagType {};
+
+// A simple exception class.  We throw this so that test code can catch
+// exceptions specifically thrown by ThrowingValue.
+class TestException {
+ public:
+  explicit TestException(absl::string_view msg) : msg_(msg) {}
+  virtual ~TestException() {}
+  virtual const char* what() const noexcept { return msg_.c_str(); }
+
+ private:
+  std::string msg_;
+};
+
+// TestBadAllocException exists because allocation functions must throw an
+// exception which can be caught by a handler of std::bad_alloc.  We use a child
+// class of std::bad_alloc so we can customise the error message, and also
+// derive from TestException so we don't accidentally end up catching an actual
+// bad_alloc exception in TestExceptionSafety.
+class TestBadAllocException : public std::bad_alloc, public TestException {
+ public:
+  explicit TestBadAllocException(absl::string_view msg) : TestException(msg) {}
+  using TestException::what;
+};
+
+extern int countdown;
+
+// Allows the countdown variable to be set manually (defaulting to the initial
+// value of 0)
+inline void SetCountdown(int i = 0) { countdown = i; }
+// Sets the countdown to the terminal value -1
+inline void UnsetCountdown() { SetCountdown(-1); }
+
+void MaybeThrow(absl::string_view msg, bool throw_bad_alloc = false);
+
+testing::AssertionResult FailureMessage(const TestException& e,
+                                        int countdown) noexcept;
+
+struct TrackedAddress {
+  bool is_alive;
+  std::string description;
+};
+
+// Inspects the constructions and destructions of anything inheriting from
+// TrackedObject. This allows us to safely "leak" TrackedObjects, as
+// ConstructorTracker will destroy everything left over in its destructor.
+class ConstructorTracker {
+ public:
+  explicit ConstructorTracker(int count) : countdown_(count) {
+    assert(current_tracker_instance_ == nullptr);
+    current_tracker_instance_ = this;
+  }
+
+  ~ConstructorTracker() {
+    assert(current_tracker_instance_ == this);
+    current_tracker_instance_ = nullptr;
+
+    for (auto& it : address_map_) {
+      void* address = it.first;
+      TrackedAddress& tracked_address = it.second;
+      if (tracked_address.is_alive) {
+        ADD_FAILURE() << ErrorMessage(address, tracked_address.description,
+                                      countdown_, "Object was not destroyed.");
+      }
+    }
+  }
+
+  static void ObjectConstructed(void* address, std::string description) {
+    if (!CurrentlyTracking()) return;
+
+    TrackedAddress& tracked_address =
+        current_tracker_instance_->address_map_[address];
+    if (tracked_address.is_alive) {
+      ADD_FAILURE() << ErrorMessage(
+          address, tracked_address.description,
+          current_tracker_instance_->countdown_,
+          "Object was re-constructed. Current object was constructed by " +
+              description);
+    }
+    tracked_address = {true, std::move(description)};
+  }
+
+  static void ObjectDestructed(void* address) {
+    if (!CurrentlyTracking()) return;
+
+    auto it = current_tracker_instance_->address_map_.find(address);
+    // Not tracked. Ignore.
+    if (it == current_tracker_instance_->address_map_.end()) return;
+
+    TrackedAddress& tracked_address = it->second;
+    if (!tracked_address.is_alive) {
+      ADD_FAILURE() << ErrorMessage(address, tracked_address.description,
+                                    current_tracker_instance_->countdown_,
+                                    "Object was re-destroyed.");
+    }
+    tracked_address.is_alive = false;
+  }
+
+ private:
+  static bool CurrentlyTracking() {
+    return current_tracker_instance_ != nullptr;
+  }
+
+  static std::string ErrorMessage(void* address,
+                                  const std::string& address_description,
+                                  int countdown,
+                                  const std::string& error_description) {
+    return absl::Substitute(
+        "With coundtown at $0:\n"
+        "  $1\n"
+        "  Object originally constructed by $2\n"
+        "  Object address: $3\n",
+        countdown, error_description, address_description, address);
+  }
+
+  std::unordered_map<void*, TrackedAddress> address_map_;
+  int countdown_;
+
+  static ConstructorTracker* current_tracker_instance_;
+};
+
+class TrackedObject {
+ public:
+  TrackedObject(const TrackedObject&) = delete;
+  TrackedObject(TrackedObject&&) = delete;
+
+ protected:
+  explicit TrackedObject(std::string description) {
+    ConstructorTracker::ObjectConstructed(this, std::move(description));
+  }
+
+  ~TrackedObject() noexcept { ConstructorTracker::ObjectDestructed(this); }
+};
+}  // namespace exceptions_internal
+
+extern exceptions_internal::NoThrowTag nothrow_ctor;
+
+extern exceptions_internal::StrongGuaranteeTagType strong_guarantee;
+
+// A test class which is convertible to bool.  The conversion can be
+// instrumented to throw at a controlled time.
+class ThrowingBool {
+ public:
+  ThrowingBool(bool b) noexcept : b_(b) {}  // NOLINT(runtime/explicit)
+  operator bool() const {                   // NOLINT
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return b_;
+  }
+
+ private:
+  bool b_;
+};
+
+/*
+ * Configuration enum for the ThrowingValue type that defines behavior for the
+ * lifetime of the instance. Use testing::nothrow_ctor to prevent the integer
+ * constructor from throwing.
+ *
+ * kEverythingThrows: Every operation can throw an exception
+ * kNoThrowCopy: Copy construction and copy assignment will not throw
+ * kNoThrowMove: Move construction and move assignment will not throw
+ * kNoThrowNew: Overloaded operators new and new[] will not throw
+ */
+enum class TypeSpec {
+  kEverythingThrows = 0,
+  kNoThrowCopy = 1,
+  kNoThrowMove = 1 << 1,
+  kNoThrowNew = 1 << 2,
+};
+
+/*
+ * A testing class instrumented to throw an exception at a controlled time.
+ *
+ * ThrowingValue implements a slightly relaxed version of the Regular concept --
+ * that is it's a value type with the expected semantics.  It also implements
+ * arithmetic operations.  It doesn't implement member and pointer operators
+ * like operator-> or operator[].
+ *
+ * ThrowingValue can be instrumented to have certain operations be noexcept by
+ * using compile-time bitfield template arguments.  That is, to make an
+ * ThrowingValue which has noexcept move construction/assignment and noexcept
+ * copy construction/assignment, use the following:
+ *   ThrowingValue<testing::kNoThrowMove | testing::kNoThrowCopy> my_thrwr{val};
+ */
+template <TypeSpec Spec = TypeSpec::kEverythingThrows>
+class ThrowingValue : private exceptions_internal::TrackedObject {
+  static constexpr bool IsSpecified(TypeSpec spec) {
+    return static_cast<bool>(Spec & spec);
+  }
+
+  static constexpr int kDefaultValue = 0;
+  static constexpr int kBadValue = 938550620;
+
+ public:
+  ThrowingValue() : TrackedObject(GetInstanceString(kDefaultValue)) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ = kDefaultValue;
+  }
+
+  ThrowingValue(const ThrowingValue& other) noexcept(
+      IsSpecified(TypeSpec::kNoThrowCopy))
+      : TrackedObject(GetInstanceString(other.dummy_)) {
+    if (!IsSpecified(TypeSpec::kNoThrowCopy)) {
+      exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    }
+    dummy_ = other.dummy_;
+  }
+
+  ThrowingValue(ThrowingValue&& other) noexcept(
+      IsSpecified(TypeSpec::kNoThrowMove))
+      : TrackedObject(GetInstanceString(other.dummy_)) {
+    if (!IsSpecified(TypeSpec::kNoThrowMove)) {
+      exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    }
+    dummy_ = other.dummy_;
+  }
+
+  explicit ThrowingValue(int i) : TrackedObject(GetInstanceString(i)) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ = i;
+  }
+
+  ThrowingValue(int i, exceptions_internal::NoThrowTag) noexcept
+      : TrackedObject(GetInstanceString(i)), dummy_(i) {}
+
+  // absl expects nothrow destructors
+  ~ThrowingValue() noexcept = default;
+
+  ThrowingValue& operator=(const ThrowingValue& other) noexcept(
+      IsSpecified(TypeSpec::kNoThrowCopy)) {
+    dummy_ = kBadValue;
+    if (!IsSpecified(TypeSpec::kNoThrowCopy)) {
+      exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    }
+    dummy_ = other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator=(ThrowingValue&& other) noexcept(
+      IsSpecified(TypeSpec::kNoThrowMove)) {
+    dummy_ = kBadValue;
+    if (!IsSpecified(TypeSpec::kNoThrowMove)) {
+      exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    }
+    dummy_ = other.dummy_;
+    return *this;
+  }
+
+  // Arithmetic Operators
+  ThrowingValue operator+(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ + other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator+() const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator-(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ - other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator-() const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(-dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue& operator++() {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    ++dummy_;
+    return *this;
+  }
+
+  ThrowingValue operator++(int) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    auto out = ThrowingValue(dummy_, nothrow_ctor);
+    ++dummy_;
+    return out;
+  }
+
+  ThrowingValue& operator--() {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    --dummy_;
+    return *this;
+  }
+
+  ThrowingValue operator--(int) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    auto out = ThrowingValue(dummy_, nothrow_ctor);
+    --dummy_;
+    return out;
+  }
+
+  ThrowingValue operator*(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ * other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator/(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ / other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator%(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ % other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator<<(int shift) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ << shift, nothrow_ctor);
+  }
+
+  ThrowingValue operator>>(int shift) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ >> shift, nothrow_ctor);
+  }
+
+  // Comparison Operators
+  // NOTE: We use `ThrowingBool` instead of `bool` because most STL
+  // types/containers requires T to be convertible to bool.
+  friend ThrowingBool operator==(const ThrowingValue& a,
+                                 const ThrowingValue& b) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return a.dummy_ == b.dummy_;
+  }
+  friend ThrowingBool operator!=(const ThrowingValue& a,
+                                 const ThrowingValue& b) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return a.dummy_ != b.dummy_;
+  }
+  friend ThrowingBool operator<(const ThrowingValue& a,
+                                const ThrowingValue& b) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return a.dummy_ < b.dummy_;
+  }
+  friend ThrowingBool operator<=(const ThrowingValue& a,
+                                 const ThrowingValue& b) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return a.dummy_ <= b.dummy_;
+  }
+  friend ThrowingBool operator>(const ThrowingValue& a,
+                                const ThrowingValue& b) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return a.dummy_ > b.dummy_;
+  }
+  friend ThrowingBool operator>=(const ThrowingValue& a,
+                                 const ThrowingValue& b) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return a.dummy_ >= b.dummy_;
+  }
+
+  // Logical Operators
+  ThrowingBool operator!() const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return !dummy_;
+  }
+
+  ThrowingBool operator&&(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return dummy_ && other.dummy_;
+  }
+
+  ThrowingBool operator||(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return dummy_ || other.dummy_;
+  }
+
+  // Bitwise Logical Operators
+  ThrowingValue operator~() const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(~dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator&(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ & other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator|(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ | other.dummy_, nothrow_ctor);
+  }
+
+  ThrowingValue operator^(const ThrowingValue& other) const {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return ThrowingValue(dummy_ ^ other.dummy_, nothrow_ctor);
+  }
+
+  // Compound Assignment operators
+  ThrowingValue& operator+=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ += other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator-=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ -= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator*=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ *= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator/=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ /= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator%=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ %= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator&=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ &= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator|=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ |= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator^=(const ThrowingValue& other) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ ^= other.dummy_;
+    return *this;
+  }
+
+  ThrowingValue& operator<<=(int shift) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ <<= shift;
+    return *this;
+  }
+
+  ThrowingValue& operator>>=(int shift) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ >>= shift;
+    return *this;
+  }
+
+  // Pointer operators
+  void operator&() const = delete;  // NOLINT(runtime/operator)
+
+  // Stream operators
+  friend std::ostream& operator<<(std::ostream& os, const ThrowingValue& tv) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return os << GetInstanceString(tv.dummy_);
+  }
+
+  friend std::istream& operator>>(std::istream& is, const ThrowingValue&) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    return is;
+  }
+
+  // Memory management operators
+  // Args.. allows us to overload regular and placement new in one shot
+  template <typename... Args>
+  static void* operator new(size_t s, Args&&... args) noexcept(
+      IsSpecified(TypeSpec::kNoThrowNew)) {
+    if (!IsSpecified(TypeSpec::kNoThrowNew)) {
+      exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION, true);
+    }
+    return ::operator new(s, std::forward<Args>(args)...);
+  }
+
+  template <typename... Args>
+  static void* operator new[](size_t s, Args&&... args) noexcept(
+      IsSpecified(TypeSpec::kNoThrowNew)) {
+    if (!IsSpecified(TypeSpec::kNoThrowNew)) {
+      exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION, true);
+    }
+    return ::operator new[](s, std::forward<Args>(args)...);
+  }
+
+  // Abseil doesn't support throwing overloaded operator delete.  These are
+  // provided so a throwing operator-new can clean up after itself.
+  //
+  // We provide both regular and templated operator delete because if only the
+  // templated version is provided as we did with operator new, the compiler has
+  // no way of knowing which overload of operator delete to call. See
+  // https://en.cppreference.com/w/cpp/memory/new/operator_delete and
+  // https://en.cppreference.com/w/cpp/language/delete for the gory details.
+  void operator delete(void* p) noexcept { ::operator delete(p); }
+
+  template <typename... Args>
+  void operator delete(void* p, Args&&... args) noexcept {
+    ::operator delete(p, std::forward<Args>(args)...);
+  }
+
+  void operator delete[](void* p) noexcept { return ::operator delete[](p); }
+
+  template <typename... Args>
+  void operator delete[](void* p, Args&&... args) noexcept {
+    return ::operator delete[](p, std::forward<Args>(args)...);
+  }
+
+  // Non-standard access to the actual contained value.  No need for this to
+  // throw.
+  int& Get() noexcept { return dummy_; }
+  const int& Get() const noexcept { return dummy_; }
+
+ private:
+  static std::string GetInstanceString(int dummy) {
+    return absl::StrCat("ThrowingValue<",
+                        exceptions_internal::GetSpecString(Spec), ">(", dummy,
+                        ")");
+  }
+
+  int dummy_;
+};
+// While not having to do with exceptions, explicitly delete comma operator, to
+// make sure we don't use it on user-supplied types.
+template <TypeSpec Spec, typename T>
+void operator,(const ThrowingValue<Spec>&, T&&) = delete;
+template <TypeSpec Spec, typename T>
+void operator,(T&&, const ThrowingValue<Spec>&) = delete;
+
+/*
+ * Configuration enum for the ThrowingAllocator type that defines behavior for
+ * the lifetime of the instance.
+ *
+ * kEverythingThrows: Calls to the member functions may throw
+ * kNoThrowAllocate: Calls to the member functions will not throw
+ */
+enum class AllocSpec {
+  kEverythingThrows = 0,
+  kNoThrowAllocate = 1,
+};
+
+/*
+ * An allocator type which is instrumented to throw at a controlled time, or not
+ * to throw, using AllocSpec. The supported settings are the default of every
+ * function which is allowed to throw in a conforming allocator possibly
+ * throwing, or nothing throws, in line with the ABSL_ALLOCATOR_THROWS
+ * configuration macro.
+ */
+template <typename T, AllocSpec Spec = AllocSpec::kEverythingThrows>
+class ThrowingAllocator : private exceptions_internal::TrackedObject {
+  static constexpr bool IsSpecified(AllocSpec spec) {
+    return static_cast<bool>(Spec & spec);
+  }
+
+ public:
+  using pointer = T*;
+  using const_pointer = const T*;
+  using reference = T&;
+  using const_reference = const T&;
+  using void_pointer = void*;
+  using const_void_pointer = const void*;
+  using value_type = T;
+  using size_type = size_t;
+  using difference_type = ptrdiff_t;
+
+  using is_nothrow =
+      std::integral_constant<bool, Spec == AllocSpec::kNoThrowAllocate>;
+  using propagate_on_container_copy_assignment = std::true_type;
+  using propagate_on_container_move_assignment = std::true_type;
+  using propagate_on_container_swap = std::true_type;
+  using is_always_equal = std::false_type;
+
+  ThrowingAllocator() : TrackedObject(GetInstanceString(next_id_)) {
+    exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
+    dummy_ = std::make_shared<const int>(next_id_++);
+  }
+
+  template <typename U>
+  ThrowingAllocator(const ThrowingAllocator<U, Spec>& other) noexcept  // NOLINT
+      : TrackedObject(GetInstanceString(*other.State())),
+        dummy_(other.State()) {}
+
+  // According to C++11 standard [17.6.3.5], Table 28, the move/copy ctors of
+  // allocator shall not exit via an exception, thus they are marked noexcept.
+  ThrowingAllocator(const ThrowingAllocator& other) noexcept
+      : TrackedObject(GetInstanceString(*other.State())),
+        dummy_(other.State()) {}
+
+  template <typename U>
+  ThrowingAllocator(ThrowingAllocator<U, Spec>&& other) noexcept  // NOLINT
+      : TrackedObject(GetInstanceString(*other.State())),
+        dummy_(std::move(other.State())) {}
+
+  ThrowingAllocator(ThrowingAllocator&& other) noexcept
+      : TrackedObject(GetInstanceString(*other.State())),
+        dummy_(std::move(other.State())) {}
+
+  ~ThrowingAllocator() noexcept = default;
+
+  ThrowingAllocator& operator=(const ThrowingAllocator& other) noexcept {
+    dummy_ = other.State();
+    return *this;
+  }
+
+  template <typename U>
+  ThrowingAllocator& operator=(
+      const ThrowingAllocator<U, Spec>& other) noexcept {
+    dummy_ = other.State();
+    return *this;
+  }
+
+  template <typename U>
+  ThrowingAllocator& operator=(ThrowingAllocator<U, Spec>&& other) noexcept {
+    dummy_ = std::move(other.State());
+    return *this;
+  }
+
+  template <typename U>
+  struct rebind {
+    using other = ThrowingAllocator<U, Spec>;
+  };
+
+  pointer allocate(size_type n) noexcept(
+      IsSpecified(AllocSpec::kNoThrowAllocate)) {
+    ReadStateAndMaybeThrow(ABSL_PRETTY_FUNCTION);
+    return static_cast<pointer>(::operator new(n * sizeof(T)));
+  }
+
+  pointer allocate(size_type n, const_void_pointer) noexcept(
+      IsSpecified(AllocSpec::kNoThrowAllocate)) {
+    return allocate(n);
+  }
+
+  void deallocate(pointer ptr, size_type) noexcept {
+    ReadState();
+    ::operator delete(static_cast<void*>(ptr));
+  }
+
+  template <typename U, typename... Args>
+  void construct(U* ptr, Args&&... args) noexcept(
+      IsSpecified(AllocSpec::kNoThrowAllocate)) {
+    ReadStateAndMaybeThrow(ABSL_PRETTY_FUNCTION);
+    ::new (static_cast<void*>(ptr)) U(std::forward<Args>(args)...);
+  }
+
+  template <typename U>
+  void destroy(U* p) noexcept {
+    ReadState();
+    p->~U();
+  }
+
+  size_type max_size() const noexcept {
+    return (std::numeric_limits<difference_type>::max)() / sizeof(value_type);
+  }
+
+  ThrowingAllocator select_on_container_copy_construction() noexcept(
+      IsSpecified(AllocSpec::kNoThrowAllocate)) {
+    auto& out = *this;
+    ReadStateAndMaybeThrow(ABSL_PRETTY_FUNCTION);
+    return out;
+  }
+
+  template <typename U>
+  bool operator==(const ThrowingAllocator<U, Spec>& other) const noexcept {
+    return dummy_ == other.dummy_;
+  }
+
+  template <typename U>
+  bool operator!=(const ThrowingAllocator<U, Spec>& other) const noexcept {
+    return dummy_ != other.dummy_;
+  }
+
+  template <typename, AllocSpec>
+  friend class ThrowingAllocator;
+
+ private:
+  static std::string GetInstanceString(int dummy) {
+    return absl::StrCat("ThrowingAllocator<",
+                        exceptions_internal::GetSpecString(Spec), ">(", dummy,
+                        ")");
+  }
+
+  const std::shared_ptr<const int>& State() const { return dummy_; }
+  std::shared_ptr<const int>& State() { return dummy_; }
+
+  void ReadState() {
+    // we know that this will never be true, but the compiler doesn't, so this
+    // should safely force a read of the value.
+    if (*dummy_ < 0) std::abort();
+  }
+
+  void ReadStateAndMaybeThrow(absl::string_view msg) const {
+    if (!IsSpecified(AllocSpec::kNoThrowAllocate)) {
+      exceptions_internal::MaybeThrow(
+          absl::Substitute("Allocator id $0 threw from $1", *dummy_, msg));
+    }
+  }
+
+  static int next_id_;
+  std::shared_ptr<const int> dummy_;
+};
+
+template <typename T, AllocSpec Spec>
+int ThrowingAllocator<T, Spec>::next_id_ = 0;
+
+// Tests for resource leaks by attempting to construct a T using args repeatedly
+// until successful, using the countdown method.  Side effects can then be
+// tested for resource leaks.
+template <typename T, typename... Args>
+void TestThrowingCtor(Args&&... args) {
+  struct Cleanup {
+    ~Cleanup() { exceptions_internal::UnsetCountdown(); }
+  } c;
+  for (int count = 0;; ++count) {
+    exceptions_internal::ConstructorTracker ct(count);
+    exceptions_internal::SetCountdown(count);
+    try {
+      T temp(std::forward<Args>(args)...);
+      static_cast<void>(temp);
+      break;
+    } catch (const exceptions_internal::TestException&) {
+    }
+  }
+}
+
+// Tests the nothrow guarantee of the provided nullary operation. If the an
+// exception is thrown, the result will be AssertionFailure(). Otherwise, it
+// will be AssertionSuccess().
+template <typename Operation>
+testing::AssertionResult TestNothrowOp(const Operation& operation) {
+  struct Cleanup {
+    Cleanup() { exceptions_internal::SetCountdown(); }
+    ~Cleanup() { exceptions_internal::UnsetCountdown(); }
+  } c;
+  try {
+    operation();
+    return testing::AssertionSuccess();
+  } catch (const exceptions_internal::TestException&) {
+    return testing::AssertionFailure()
+           << "TestException thrown during call to operation() when nothrow "
+              "guarantee was expected.";
+  } catch (...) {
+    return testing::AssertionFailure()
+           << "Unknown exception thrown during call to operation() when "
+              "nothrow guarantee was expected.";
+  }
+}
+
+namespace exceptions_internal {
+
+// Dummy struct for ExceptionSafetyTestBuilder<> partial state.
+struct UninitializedT {};
+
+template <typename T>
+class DefaultFactory {
+ public:
+  explicit DefaultFactory(const T& t) : t_(t) {}
+  std::unique_ptr<T> operator()() const { return absl::make_unique<T>(t_); }
+
+ private:
+  T t_;
+};
+
+template <size_t LazyContractsCount, typename LazyFactory,
+          typename LazyOperation>
+using EnableIfTestable = typename absl::enable_if_t<
+    LazyContractsCount != 0 &&
+    !std::is_same<LazyFactory, UninitializedT>::value &&
+    !std::is_same<LazyOperation, UninitializedT>::value>;
+
+template <typename Factory = UninitializedT,
+          typename Operation = UninitializedT, typename... Contracts>
+class ExceptionSafetyTestBuilder;
+
+}  // namespace exceptions_internal
+
+/*
+ * Constructs an empty ExceptionSafetyTestBuilder. All
+ * ExceptionSafetyTestBuilder objects are immutable and all With[thing] mutation
+ * methods return new instances of ExceptionSafetyTestBuilder.
+ *
+ * In order to test a T for exception safety, a factory for that T, a testable
+ * operation, and at least one contract callback returning an assertion
+ * result must be applied using the respective methods.
+ */
+exceptions_internal::ExceptionSafetyTestBuilder<> MakeExceptionSafetyTester();
+
+namespace exceptions_internal {
+template <typename T>
+struct IsUniquePtr : std::false_type {};
+
+template <typename T, typename D>
+struct IsUniquePtr<std::unique_ptr<T, D>> : std::true_type {};
+
+template <typename Factory>
+struct FactoryPtrTypeHelper {
+  using type = decltype(std::declval<const Factory&>()());
+
+  static_assert(IsUniquePtr<type>::value, "Factories must return a unique_ptr");
+};
+
+template <typename Factory>
+using FactoryPtrType = typename FactoryPtrTypeHelper<Factory>::type;
+
+template <typename Factory>
+using FactoryElementType = typename FactoryPtrType<Factory>::element_type;
+
+template <typename T>
+class ExceptionSafetyTest {
+  using Factory = std::function<std::unique_ptr<T>()>;
+  using Operation = std::function<void(T*)>;
+  using Contract = std::function<AssertionResult(T*)>;
+
+ public:
+  template <typename... Contracts>
+  explicit ExceptionSafetyTest(const Factory& f, const Operation& op,
+                               const Contracts&... contracts)
+      : factory_(f), operation_(op), contracts_{WrapContract(contracts)...} {}
+
+  AssertionResult Test() const {
+    for (int count = 0;; ++count) {
+      exceptions_internal::ConstructorTracker ct(count);
+
+      for (const auto& contract : contracts_) {
+        auto t_ptr = factory_();
+        try {
+          SetCountdown(count);
+          operation_(t_ptr.get());
+          // Unset for the case that the operation throws no exceptions, which
+          // would leave the countdown set and break the *next* exception safety
+          // test after this one.
+          UnsetCountdown();
+          return AssertionSuccess();
+        } catch (const exceptions_internal::TestException& e) {
+          if (!contract(t_ptr.get())) {
+            return AssertionFailure() << e.what() << " failed contract check";
+          }
+        }
+      }
+    }
+  }
+
+ private:
+  template <typename ContractFn>
+  Contract WrapContract(const ContractFn& contract) {
+    return [contract](T* t_ptr) { return AssertionResult(contract(t_ptr)); };
+  }
+
+  Contract WrapContract(StrongGuaranteeTagType) {
+    return [this](T* t_ptr) { return AssertionResult(*factory_() == *t_ptr); };
+  }
+
+  Factory factory_;
+  Operation operation_;
+  std::vector<Contract> contracts_;
+};
+
+/*
+ * Builds a tester object that tests if performing a operation on a T follows
+ * exception safety guarantees. Verification is done via contract assertion
+ * callbacks applied to T instances post-throw.
+ *
+ * Template parameters for ExceptionSafetyTestBuilder:
+ *
+ * - Factory: The factory object (passed in via tester.WithFactory(...) or
+ *   tester.WithInitialValue(...)) must be invocable with the signature
+ *   `std::unique_ptr<T> operator()() const` where T is the type being tested.
+ *   It is used for reliably creating identical T instances to test on.
+ *
+ * - Operation: The operation object (passsed in via tester.WithOperation(...)
+ *   or tester.Test(...)) must be invocable with the signature
+ *   `void operator()(T*) const` where T is the type being tested. It is used
+ *   for performing steps on a T instance that may throw and that need to be
+ *   checked for exception safety. Each call to the operation will receive a
+ *   fresh T instance so it's free to modify and destroy the T instances as it
+ *   pleases.
+ *
+ * - Contracts...: The contract assertion callback objects (passed in via
+ *   tester.WithContracts(...)) must be invocable with the signature
+ *   `testing::AssertionResult operator()(T*) const` where T is the type being
+ *   tested. Contract assertion callbacks are provided T instances post-throw.
+ *   They must return testing::AssertionSuccess when the type contracts of the
+ *   provided T instance hold. If the type contracts of the T instance do not
+ *   hold, they must return testing::AssertionFailure. Execution order of
+ *   Contracts... is unspecified. They will each individually get a fresh T
+ *   instance so they are free to modify and destroy the T instances as they
+ *   please.
+ */
+template <typename Factory, typename Operation, typename... Contracts>
+class ExceptionSafetyTestBuilder {
+ public:
+  /*
+   * Returns a new ExceptionSafetyTestBuilder with an included T factory based
+   * on the provided T instance. The existing factory will not be included in
+   * the newly created tester instance. The created factory returns a new T
+   * instance by copy-constructing the provided const T& t.
+   *
+   * Preconditions for tester.WithInitialValue(const T& t):
+   *
+   * - The const T& t object must be copy-constructible where T is the type
+   *   being tested. For non-copy-constructible objects, use the method
+   *   tester.WithFactory(...).
+   */
+  template <typename T>
+  ExceptionSafetyTestBuilder<DefaultFactory<T>, Operation, Contracts...>
+  WithInitialValue(const T& t) const {
+    return WithFactory(DefaultFactory<T>(t));
+  }
+
+  /*
+   * Returns a new ExceptionSafetyTestBuilder with the provided T factory
+   * included. The existing factory will not be included in the newly-created
+   * tester instance. This method is intended for use with types lacking a copy
+   * constructor. Types that can be copy-constructed should instead use the
+   * method tester.WithInitialValue(...).
+   */
+  template <typename NewFactory>
+  ExceptionSafetyTestBuilder<absl::decay_t<NewFactory>, Operation, Contracts...>
+  WithFactory(const NewFactory& new_factory) const {
+    return {new_factory, operation_, contracts_};
+  }
+
+  /*
+   * Returns a new ExceptionSafetyTestBuilder with the provided testable
+   * operation included. The existing operation will not be included in the
+   * newly created tester.
+   */
+  template <typename NewOperation>
+  ExceptionSafetyTestBuilder<Factory, absl::decay_t<NewOperation>, Contracts...>
+  WithOperation(const NewOperation& new_operation) const {
+    return {factory_, new_operation, contracts_};
+  }
+
+  /*
+   * Returns a new ExceptionSafetyTestBuilder with the provided MoreContracts...
+   * combined with the Contracts... that were already included in the instance
+   * on which the method was called. Contracts... cannot be removed or replaced
+   * once added to an ExceptionSafetyTestBuilder instance. A fresh object must
+   * be created in order to get an empty Contracts... list.
+   *
+   * In addition to passing in custom contract assertion callbacks, this method
+   * accepts `testing::strong_guarantee` as an argument which checks T instances
+   * post-throw against freshly created T instances via operator== to verify
+   * that any state changes made during the execution of the operation were
+   * properly rolled back.
+   */
+  template <typename... MoreContracts>
+  ExceptionSafetyTestBuilder<Factory, Operation, Contracts...,
+                             absl::decay_t<MoreContracts>...>
+  WithContracts(const MoreContracts&... more_contracts) const {
+    return {
+        factory_, operation_,
+        std::tuple_cat(contracts_, std::tuple<absl::decay_t<MoreContracts>...>(
+                                       more_contracts...))};
+  }
+
+  /*
+   * Returns a testing::AssertionResult that is the reduced result of the
+   * exception safety algorithm. The algorithm short circuits and returns
+   * AssertionFailure after the first contract callback returns an
+   * AssertionFailure. Otherwise, if all contract callbacks return an
+   * AssertionSuccess, the reduced result is AssertionSuccess.
+   *
+   * The passed-in testable operation will not be saved in a new tester instance
+   * nor will it modify/replace the existing tester instance. This is useful
+   * when each operation being tested is unique and does not need to be reused.
+   *
+   * Preconditions for tester.Test(const NewOperation& new_operation):
+   *
+   * - May only be called after at least one contract assertion callback and a
+   *   factory or initial value have been provided.
+   */
+  template <
+      typename NewOperation,
+      typename = EnableIfTestable<sizeof...(Contracts), Factory, NewOperation>>
+  testing::AssertionResult Test(const NewOperation& new_operation) const {
+    return TestImpl(new_operation, absl::index_sequence_for<Contracts...>());
+  }
+
+  /*
+   * Returns a testing::AssertionResult that is the reduced result of the
+   * exception safety algorithm. The algorithm short circuits and returns
+   * AssertionFailure after the first contract callback returns an
+   * AssertionFailure. Otherwise, if all contract callbacks return an
+   * AssertionSuccess, the reduced result is AssertionSuccess.
+   *
+   * Preconditions for tester.Test():
+   *
+   * - May only be called after at least one contract assertion callback, a
+   *   factory or initial value and a testable operation have been provided.
+   */
+  template <
+      typename LazyOperation = Operation,
+      typename = EnableIfTestable<sizeof...(Contracts), Factory, LazyOperation>>
+  testing::AssertionResult Test() const {
+    return Test(operation_);
+  }
+
+ private:
+  template <typename, typename, typename...>
+  friend class ExceptionSafetyTestBuilder;
+
+  friend ExceptionSafetyTestBuilder<> testing::MakeExceptionSafetyTester();
+
+  ExceptionSafetyTestBuilder() {}
+
+  ExceptionSafetyTestBuilder(const Factory& f, const Operation& o,
+                             const std::tuple<Contracts...>& i)
+      : factory_(f), operation_(o), contracts_(i) {}
+
+  template <typename SelectedOperation, size_t... Indices>
+  testing::AssertionResult TestImpl(SelectedOperation selected_operation,
+                                    absl::index_sequence<Indices...>) const {
+    return ExceptionSafetyTest<FactoryElementType<Factory>>(
+               factory_, selected_operation, std::get<Indices>(contracts_)...)
+        .Test();
+  }
+
+  Factory factory_;
+  Operation operation_;
+  std::tuple<Contracts...> contracts_;
+};
+
+}  // namespace exceptions_internal
+
+}  // namespace testing
+
+#endif  // ABSL_BASE_INTERNAL_EXCEPTION_SAFETY_TESTING_H_
index 99a1073..01b5465 100644 (file)
@@ -1,3 +1,17 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 // Testing utilities for ABSL types which throw exceptions.
 
 #ifndef ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_
 #define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \
   EXPECT_THROW(expr, exception_t)
 
+#elif defined(__ANDROID__)
+// Android asserts do not log anywhere that gtest can currently inspect.
+// So we expect exit, but cannot match the message.
+#define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \
+  EXPECT_DEATH(expr, ".*")
 #else
-
 #define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \
-  EXPECT_DEATH(expr, text)
+  EXPECT_DEATH_IF_SUPPORTED(expr, text)
 
 #endif
 
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/hide_ptr.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/hide_ptr.h
new file mode 100644 (file)
index 0000000..cf8f408
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_BASE_INTERNAL_HIDE_PTR_H_
+#define ABSL_BASE_INTERNAL_HIDE_PTR_H_
+
+#include <cstdint>
+
+namespace absl {
+namespace base_internal {
+
+// Arbitrary value with high bits set. Xor'ing with it is unlikely
+// to map one valid pointer to another valid pointer.
+constexpr uintptr_t HideMask() {
+  return (uintptr_t{0xF03A5F7BU} << (sizeof(uintptr_t) - 4) * 8) | 0xF03A5F7BU;
+}
+
+// Hide a pointer from the leak checker. For internal use only.
+// Differs from absl::IgnoreLeak(ptr) in that absl::IgnoreLeak(ptr) causes ptr
+// and all objects reachable from ptr to be ignored by the leak checker.
+template <class T>
+inline uintptr_t HidePtr(T* ptr) {
+  return reinterpret_cast<uintptr_t>(ptr) ^ HideMask();
+}
+
+// Return a pointer that has been hidden from the leak checker.
+// For internal use only.
+template <class T>
+inline T* UnhidePtr(uintptr_t hidden) {
+  return reinterpret_cast<T*>(hidden ^ HideMask());
+}
+
+}  // namespace base_internal
+}  // namespace absl
+
+#endif  // ABSL_BASE_INTERNAL_HIDE_PTR_H_
index a6734b4..086447c 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,7 +27,7 @@ struct identity {
 template <typename T>
 using identity_t = typename identity<T>::type;
 
-}  //  namespace internal
-}  //  namespace absl
+}  // namespace internal
+}  // namespace absl
 
 #endif  // ABSL_BASE_INTERNAL_IDENTITY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/inline_variable.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/inline_variable.h
new file mode 100644 (file)
index 0000000..130d8c2
--- /dev/null
@@ -0,0 +1,107 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
+#define ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
+
+#include <type_traits>
+
+#include "absl/base/internal/identity.h"
+
+// File:
+//   This file define a macro that allows the creation of or emulation of C++17
+//   inline variables based on whether or not the feature is supported.
+
+////////////////////////////////////////////////////////////////////////////////
+// Macro: ABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init)
+//
+// Description:
+//   Expands to the equivalent of an inline constexpr instance of the specified
+//   `type` and `name`, initialized to the value `init`. If the compiler being
+//   used is detected as supporting actual inline variables as a language
+//   feature, then the macro expands to an actual inline variable definition.
+//
+// Requires:
+//   `type` is a type that is usable in an extern variable declaration.
+//
+// Requires: `name` is a valid identifier
+//
+// Requires:
+//   `init` is an expression that can be used in the following definition:
+//     constexpr type name = init;
+//
+// Usage:
+//
+//   // Equivalent to: `inline constexpr size_t variant_npos = -1;`
+//   ABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, -1);
+//
+// Differences in implementation:
+//   For a direct, language-level inline variable, decltype(name) will be the
+//   type that was specified along with const qualification, whereas for
+//   emulated inline variables, decltype(name) may be different (in practice
+//   it will likely be a reference type).
+////////////////////////////////////////////////////////////////////////////////
+
+#ifdef __cpp_inline_variables
+
+// Clang's -Wmissing-variable-declarations option erroneously warned that
+// inline constexpr objects need to be pre-declared. This has now been fixed,
+// but we will need to support this workaround for people building with older
+// versions of clang.
+//
+// Bug: https://bugs.llvm.org/show_bug.cgi?id=35862
+//
+// Note:
+//   identity_t is used here so that the const and name are in the
+//   appropriate place for pointer types, reference types, function pointer
+//   types, etc..
+#if defined(__clang__)
+#define ABSL_INTERNAL_EXTERN_DECL(type, name) \
+  extern const ::absl::internal::identity_t<type> name;
+#else  // Otherwise, just define the macro to do nothing.
+#define ABSL_INTERNAL_EXTERN_DECL(type, name)
+#endif  // defined(__clang__)
+
+// See above comment at top of file for details.
+#define ABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init) \
+  ABSL_INTERNAL_EXTERN_DECL(type, name)                  \
+  inline constexpr ::absl::internal::identity_t<type> name = init
+
+#else
+
+// See above comment at top of file for details.
+//
+// Note:
+//   identity_t is used here so that the const and name are in the
+//   appropriate place for pointer types, reference types, function pointer
+//   types, etc..
+#define ABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init)                  \
+  template <class /*AbslInternalDummy*/ = void>                               \
+  struct AbslInternalInlineVariableHolder##name {                             \
+    static constexpr ::absl::internal::identity_t<var_type> kInstance = init; \
+  };                                                                          \
+                                                                              \
+  template <class AbslInternalDummy>                                          \
+  constexpr ::absl::internal::identity_t<var_type>                            \
+      AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance;   \
+                                                                              \
+  static constexpr const ::absl::internal::identity_t<var_type>&              \
+      name = /* NOLINT */                                                     \
+      AbslInternalInlineVariableHolder##name<>::kInstance;                    \
+  static_assert(sizeof(void (*)(decltype(name))) != 0,                        \
+                "Silence unused variable warnings.")
+
+#endif  // __cpp_inline_variables
+
+#endif  // ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/inline_variable_testing.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/inline_variable_testing.h
new file mode 100644 (file)
index 0000000..15dc481
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_BASE_INLINE_VARIABLE_TESTING_H_
+#define ABSL_BASE_INLINE_VARIABLE_TESTING_H_
+
+#include "absl/base/internal/inline_variable.h"
+
+namespace absl {
+namespace inline_variable_testing_internal {
+
+struct Foo {
+  int value = 5;
+};
+
+ABSL_INTERNAL_INLINE_CONSTEXPR(Foo, inline_variable_foo, {});
+ABSL_INTERNAL_INLINE_CONSTEXPR(Foo, other_inline_variable_foo, {});
+
+ABSL_INTERNAL_INLINE_CONSTEXPR(int, inline_variable_int, 5);
+ABSL_INTERNAL_INLINE_CONSTEXPR(int, other_inline_variable_int, 5);
+
+ABSL_INTERNAL_INLINE_CONSTEXPR(void(*)(), inline_variable_fun_ptr, nullptr);
+
+const Foo& get_foo_a();
+const Foo& get_foo_b();
+
+const int& get_int_a();
+const int& get_int_b();
+
+}  // namespace inline_variable_testing_internal
+}  // namespace absl
+
+#endif  // ABSL_BASE_INLINE_VARIABLE_TESTING_H_
index 8c3f4f6..8da2869 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/log_severity.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/log_severity.h
deleted file mode 100644 (file)
index deaf6a5..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2017 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
-#define ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
-
-#include "absl/base/attributes.h"
-
-namespace absl {
-
-enum class LogSeverity : int {
-  kInfo = 0,
-  kWarning = 1,
-  kError = 2,
-  kFatal = 3,
-};
-
-constexpr const char* LogSeverityName(absl::LogSeverity s) {
-  return s == absl::LogSeverity::kInfo
-             ? "INFO"
-             : s == absl::LogSeverity::kWarning
-                   ? "WARNING"
-                   : s == absl::LogSeverity::kError
-                         ? "ERROR"
-                         : s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
-}
-
-// Note that out-of-range large severities normalize to kError, not kFatal.
-constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
-  return s < absl::LogSeverity::kInfo
-             ? absl::LogSeverity::kInfo
-             : s > absl::LogSeverity::kFatal ? absl::LogSeverity::kError : s;
-}
-constexpr absl::LogSeverity NormalizeLogSeverity(int s) {
-  return NormalizeLogSeverity(static_cast<absl::LogSeverity>(s));
-}
-
-}  // namespace absl
-
-#endif  // ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
index f3e8aa5..c98cdb3 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -25,6 +25,7 @@
 // IWYU pragma: private, include "base/low_level_alloc.h"
 
 #include <sys/types.h>
+
 #include <cstdint>
 
 #include "absl/base/attributes.h"
 #define ABSL_LOW_LEVEL_ALLOC_MISSING 1
 #endif
 
-// Using LowLevelAlloc with kAsyncSignalSafe isn't supported on Windows.
+// Using LowLevelAlloc with kAsyncSignalSafe isn't supported on Windows or
+// asm.js / WebAssembly.
+// See https://kripken.github.io/emscripten-site/docs/porting/pthreads.html
+// for more information.
 #ifdef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
 #error ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING cannot be directly set
-#elif defined(_WIN32)
+#elif defined(_WIN32) || defined(__asmjs__) || defined(__wasm__)
 #define ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING 1
 #endif
 
@@ -93,15 +97,12 @@ class LowLevelAlloc {
     // DefaultArena(). Not supported on all platforms.
     kAsyncSignalSafe = 0x0002,
 #endif
-
-    // When used with DefaultArena(), the NewArena() and DeleteArena() calls
-    // obey the flags given explicitly in the NewArena() call, even if those
-    // flags differ from the settings in DefaultArena().  So the call
-    // NewArena(kAsyncSignalSafe, DefaultArena()) is itself async-signal-safe,
-    // as well as generatating an arena that provides async-signal-safe
-    // Alloc/Free.
   };
-  static Arena *NewArena(int32_t flags, Arena *meta_data_arena);
+  // Construct a new arena.  The allocation of the underlying metadata honors
+  // the provided flags.  For example, the call NewArena(kAsyncSignalSafe)
+  // is itself async-signal-safe, as well as generatating an arena that provides
+  // async-signal-safe Alloc/Free.
+  static Arena *NewArena(int32_t flags);
 
   // Destroys an arena allocated by NewArena and returns true,
   // provided no allocated blocks remain in the arena.
@@ -119,4 +120,5 @@ class LowLevelAlloc {
 
 }  // namespace base_internal
 }  // namespace absl
+
 #endif  // ABSL_BASE_INTERNAL_LOW_LEVEL_ALLOC_H_
index e716f2b..0fcc8d3 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -86,6 +86,7 @@ class SchedulingGuard {
 //------------------------------------------------------------------------------
 // End of public interfaces.
 //------------------------------------------------------------------------------
+
 inline bool SchedulingGuard::ReschedulingIsAllowed() {
   return false;
 }
@@ -98,7 +99,7 @@ inline void SchedulingGuard::EnableRescheduling(bool /* disable_result */) {
   return;
 }
 
-
 }  // namespace base_internal
 }  // namespace absl
+
 #endif  // ABSL_BASE_INTERNAL_LOW_LEVEL_SCHEDULING_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_extension.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_extension.h
deleted file mode 100644 (file)
index 46b767f..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-//
-// Copyright 2017 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// Extra extensions exported by some malloc implementations.  These
-// extensions are accessed through a virtual base class so an
-// application can link against a malloc that does not implement these
-// extensions, and it will get default versions that do nothing.
-//
-// NOTE FOR C USERS: If you wish to use this functionality from within
-// a C program, see malloc_extension_c.h.
-
-#ifndef ABSL_BASE_INTERNAL_MALLOC_EXTENSION_H_
-#define ABSL_BASE_INTERNAL_MALLOC_EXTENSION_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <atomic>
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "absl/base/attributes.h"
-#include "absl/base/macros.h"
-#include "absl/base/port.h"
-namespace absl {
-namespace base_internal {
-
-class MallocExtensionWriter;
-
-// Interface to a pluggable system allocator.
-class SysAllocator {
- public:
-  SysAllocator() {
-  }
-  virtual ~SysAllocator();
-
-  // Allocates "size"-byte of memory from system aligned with "alignment".
-  // Returns null if failed. Otherwise, the returned pointer p up to and
-  // including (p + actual_size -1) have been allocated.
-  virtual void* Alloc(size_t size, size_t *actual_size, size_t alignment) = 0;
-
-  // Get a human-readable description of the current state of the
-  // allocator.  The state is stored as a null-terminated std::string in
-  // a prefix of buffer.
-  virtual void GetStats(char* buffer, int length);
-};
-
-// The default implementations of the following routines do nothing.
-// All implementations should be thread-safe; the current ones
-// (DebugMallocImplementation and TCMallocImplementation) are.
-class MallocExtension {
- public:
-  virtual ~MallocExtension();
-
-  // Verifies that all blocks are valid.  Returns true if all are; dumps
-  // core otherwise.  A no-op except in debug mode.  Even in debug mode,
-  // they may not do any checking except with certain malloc
-  // implementations.  Thread-safe.
-  virtual bool VerifyAllMemory();
-
-  // Verifies that p was returned by new, has not been deleted, and is
-  // valid.  Returns true if p is good; dumps core otherwise.  A no-op
-  // except in debug mode.  Even in debug mode, may not do any checking
-  // except with certain malloc implementations.  Thread-safe.
-  virtual bool VerifyNewMemory(const void* p);
-
-  // Verifies that p was returned by new[], has not been deleted, and is
-  // valid.  Returns true if p is good; dumps core otherwise.  A no-op
-  // except in debug mode.  Even in debug mode, may not do any checking
-  // except with certain malloc implementations.  Thread-safe.
-  virtual bool VerifyArrayNewMemory(const void* p);
-
-  // Verifies that p was returned by malloc, has not been freed, and is
-  // valid.  Returns true if p is good; dumps core otherwise.  A no-op
-  // except in debug mode.  Even in debug mode, may not do any checking
-  // except with certain malloc implementations.  Thread-safe.
-  virtual bool VerifyMallocMemory(const void* p);
-
-  // If statistics collection is enabled, sets *blocks to be the number of
-  // currently allocated blocks, sets *total to be the total size allocated
-  // over all blocks, sets histogram[n] to be the number of blocks with
-  // size between 2^n-1 and 2^(n+1), and returns true.  Returns false, and
-  // does not change *blocks, *total, or *histogram, if statistics
-  // collection is disabled.
-  //
-  // Note that these statistics reflect memory allocated by new, new[],
-  // malloc(), and realloc(), but not mmap().  They may be larger (if not
-  // all pages have been written to) or smaller (if pages have been
-  // allocated by mmap()) than the total RSS size.  They will always be
-  // smaller than the total virtual memory size.
-  static constexpr int kMallocHistogramSize = 64;
-  virtual bool MallocMemoryStats(int* blocks, size_t* total,
-                                 int histogram[kMallocHistogramSize]);
-
-  // Get a human readable description of the current state of the malloc
-  // data structures.  The state is stored as a null-terminated std::string
-  // in a prefix of "buffer[0,buffer_length-1]".
-  // REQUIRES: buffer_length > 0.
-  virtual void GetStats(char* buffer, int buffer_length);
-
-  // Outputs to "writer" a sample of live objects and the stack traces
-  // that allocated these objects. The output can be passed to pprof.
-  virtual void GetHeapSample(MallocExtensionWriter* writer);
-
-  // Outputs to "writer" the stack traces that caused growth in the
-  // address space size. The output can be passed to "pprof".
-  virtual void GetHeapGrowthStacks(MallocExtensionWriter* writer);
-
-  // Outputs to "writer" a fragmentation profile. The output can be
-  // passed to "pprof".  In particular, the result is a list of
-  // <n,total,stacktrace> tuples that says that "total" bytes in "n"
-  // objects are currently unusable because of fragmentation caused by
-  // an allocation with the specified "stacktrace".
-  virtual void GetFragmentationProfile(MallocExtensionWriter* writer);
-
-  // -------------------------------------------------------------------
-  // Control operations for getting and setting malloc implementation
-  // specific parameters.  Some currently useful properties:
-  //
-  // generic
-  // -------
-  // "generic.current_allocated_bytes"
-  //      Number of bytes currently allocated by application
-  //      This property is not writable.
-  //
-  // "generic.heap_size"
-  //      Number of bytes in the heap ==
-  //            current_allocated_bytes +
-  //            fragmentation +
-  //            freed memory regions
-  //      This property is not writable.
-  //
-  // tcmalloc
-  // --------
-  // "tcmalloc.max_total_thread_cache_bytes"
-  //      Upper limit on total number of bytes stored across all
-  //      per-thread caches.  Default: 16MB.
-  //
-  // "tcmalloc.current_total_thread_cache_bytes"
-  //      Number of bytes used across all thread caches.
-  //      This property is not writable.
-  //
-  // "tcmalloc.pageheap_free_bytes"
-  //      Number of bytes in free, mapped pages in page heap.  These
-  //      bytes can be used to fulfill allocation requests.  They
-  //      always count towards virtual memory usage, and unless the
-  //      underlying memory is swapped out by the OS, they also count
-  //      towards physical memory usage.  This property is not writable.
-  //
-  // "tcmalloc.pageheap_unmapped_bytes"
-  //      Number of bytes in free, unmapped pages in page heap.
-  //      These are bytes that have been released back to the OS,
-  //      possibly by one of the MallocExtension "Release" calls.
-  //      They can be used to fulfill allocation requests, but
-  //      typically incur a page fault.  They always count towards
-  //      virtual memory usage, and depending on the OS, typically
-  //      do not count towards physical memory usage.  This property
-  //      is not writable.
-  //
-  //  "tcmalloc.per_cpu_caches_active"
-  //      Whether tcmalloc is using per-CPU caches (1 or 0 respectively).
-  //      This property is not writable.
-  // -------------------------------------------------------------------
-
-  // Get the named "property"'s value.  Returns true if the property
-  // is known.  Returns false if the property is not a valid property
-  // name for the current malloc implementation.
-  // REQUIRES: property != null; value != null
-  virtual bool GetNumericProperty(const char* property, size_t* value);
-
-  // Set the named "property"'s value.  Returns true if the property
-  // is known and writable.  Returns false if the property is not a
-  // valid property name for the current malloc implementation, or
-  // is not writable.
-  // REQUIRES: property != null
-  virtual bool SetNumericProperty(const char* property, size_t value);
-
-  // Mark the current thread as "idle".  This routine may optionally
-  // be called by threads as a hint to the malloc implementation that
-  // any thread-specific resources should be released.  Note: this may
-  // be an expensive routine, so it should not be called too often.
-  //
-  // Also, if the code that calls this routine will go to sleep for
-  // a while, it should take care to not allocate anything between
-  // the call to this routine and the beginning of the sleep.
-  //
-  // Most malloc implementations ignore this routine.
-  virtual void MarkThreadIdle();
-
-  // Mark the current thread as "busy".  This routine should be
-  // called after MarkThreadIdle() if the thread will now do more
-  // work.  If this method is not called, performance may suffer.
-  //
-  // Most malloc implementations ignore this routine.
-  virtual void MarkThreadBusy();
-
-  // Attempt to free any resources associated with cpu <cpu> (in the sense
-  // of only being usable from that CPU.)  Returns the number of bytes
-  // previously assigned to "cpu" that were freed.  Safe to call from
-  // any processor, not just <cpu>.
-  //
-  // Most malloc implementations ignore this routine (known exceptions:
-  // tcmalloc with --tcmalloc_per_cpu_caches=true.)
-  virtual size_t ReleaseCPUMemory(int cpu);
-
-  // Gets the system allocator used by the malloc extension instance. Returns
-  // null for malloc implementations that do not support pluggable system
-  // allocators.
-  virtual SysAllocator* GetSystemAllocator();
-
-  // Sets the system allocator to the specified.
-  //
-  // Users could register their own system allocators for malloc implementation
-  // that supports pluggable system allocators, such as TCMalloc, by doing:
-  //   alloc = new MyOwnSysAllocator();
-  //   MallocExtension::instance()->SetSystemAllocator(alloc);
-  // It's up to users whether to fall back (recommended) to the default
-  // system allocator (use GetSystemAllocator() above) or not. The caller is
-  // responsible to any necessary locking.
-  // See tcmalloc/system-alloc.h for the interface and
-  //     tcmalloc/memfs_malloc.cc for the examples.
-  //
-  // It's a no-op for malloc implementations that do not support pluggable
-  // system allocators.
-  virtual void SetSystemAllocator(SysAllocator *a);
-
-  // Try to release num_bytes of free memory back to the operating
-  // system for reuse.  Use this extension with caution -- to get this
-  // memory back may require faulting pages back in by the OS, and
-  // that may be slow.  (Currently only implemented in tcmalloc.)
-  virtual void ReleaseToSystem(size_t num_bytes);
-
-  // Same as ReleaseToSystem() but release as much memory as possible.
-  virtual void ReleaseFreeMemory();
-
-  // Sets the rate at which we release unused memory to the system.
-  // Zero means we never release memory back to the system.  Increase
-  // this flag to return memory faster; decrease it to return memory
-  // slower.  Reasonable rates are in the range [0,10].  (Currently
-  // only implemented in tcmalloc).
-  virtual void SetMemoryReleaseRate(double rate);
-
-  // Gets the release rate.  Returns a value < 0 if unknown.
-  virtual double GetMemoryReleaseRate();
-
-  // Returns the estimated number of bytes that will be allocated for
-  // a request of "size" bytes.  This is an estimate: an allocation of
-  // SIZE bytes may reserve more bytes, but will never reserve less.
-  // (Currently only implemented in tcmalloc, other implementations
-  // always return SIZE.)
-  // This is equivalent to malloc_good_size() in OS X.
-  virtual size_t GetEstimatedAllocatedSize(size_t size);
-
-  // Returns the actual number N of bytes reserved by tcmalloc for the
-  // pointer p.  This number may be equal to or greater than the
-  // number of bytes requested when p was allocated.
-  //
-  // This routine is just useful for statistics collection.  The
-  // client must *not* read or write from the extra bytes that are
-  // indicated by this call.
-  //
-  // Example, suppose the client gets memory by calling
-  //    p = malloc(10)
-  // and GetAllocatedSize(p) returns 16.  The client must only use the
-  // first 10 bytes p[0..9], and not attempt to read or write p[10..15].
-  //
-  // p must have been allocated by this malloc implementation, must
-  // not be an interior pointer -- that is, must be exactly the
-  // pointer returned to by malloc() et al., not some offset from that
-  // -- and should not have been freed yet.  p may be null.
-  // (Currently only implemented in tcmalloc; other implementations
-  // will return 0.)
-  virtual size_t GetAllocatedSize(const void* p);
-
-  // Returns kOwned if this malloc implementation allocated the memory
-  // pointed to by p, or kNotOwned if some other malloc implementation
-  // allocated it or p is null.  May also return kUnknownOwnership if
-  // the malloc implementation does not keep track of ownership.
-  // REQUIRES: p must be a value returned from a previous call to
-  // malloc(), calloc(), realloc(), memalign(), posix_memalign(),
-  // valloc(), pvalloc(), new, or new[], and must refer to memory that
-  // is currently allocated (so, for instance, you should not pass in
-  // a pointer after having called free() on it).
-  enum Ownership {
-    // NOTE: Enum values MUST be kept in sync with the version in
-    // malloc_extension_c.h
-    kUnknownOwnership = 0,
-    kOwned,
-    kNotOwned
-  };
-  virtual Ownership GetOwnership(const void* p);
-
-  // The current malloc implementation.  Always non-null.
-  static MallocExtension* instance() {
-    InitModuleOnce();
-    return current_instance_.load(std::memory_order_acquire);
-  }
-
-  // Change the malloc implementation.  Typically called by the
-  // malloc implementation during initialization.
-  static void Register(MallocExtension* implementation);
-
-  // Type used by GetProperties.  See comment on GetProperties.
-  struct Property {
-    size_t value;
-    // Stores breakdown of the property value bucketed by object size.
-    struct Bucket {
-      size_t min_object_size;
-      size_t max_object_size;
-      size_t size;
-    };
-    // Empty unless detailed info was asked for and this type has buckets
-    std::vector<Bucket> buckets;
-  };
-
-  // Type used by GetProperties.  See comment on GetProperties.
-  enum StatLevel { kSummary, kDetailed };
-
-  // Stores in *result detailed statistics about the malloc
-  // implementation. *result will be a map keyed by the name of
-  // the statistic. Each statistic has at least a "value" field.
-  //
-  // Some statistics may also contain an array of buckets if
-  // level==kDetailed and the "value" can be subdivided
-  // into different buckets for different object sizes.  If
-  // such detailed statistics are not available, Property::buckets
-  // will be empty.  Otherwise Property::buckets will contain
-  // potentially many entries.  For each bucket b, b.value
-  // will count the value contributed by objects in the range
-  // [b.min_object_size, b.max_object_size].
-  //
-  // Common across malloc implementations:
-  //  generic.bytes_in_use_by_app  -- Bytes currently in use by application
-  //  generic.physical_memory_used -- Overall (including malloc internals)
-  //  generic.virtual_memory_used  -- Overall (including malloc internals)
-  //
-  // Tcmalloc specific properties
-  //  tcmalloc.cpu_free            -- Bytes in per-cpu free-lists
-  //  tcmalloc.thread_cache_free   -- Bytes in per-thread free-lists
-  //  tcmalloc.transfer_cache      -- Bytes in cross-thread transfer caches
-  //  tcmalloc.central_cache_free  -- Bytes in central cache
-  //  tcmalloc.page_heap_free      -- Bytes in page heap
-  //  tcmalloc.page_heap_unmapped  -- Bytes in page heap (no backing phys. mem)
-  //  tcmalloc.metadata_bytes      -- Used by internal data structures
-  //  tcmalloc.thread_cache_count  -- Number of thread caches in use
-  //
-  // Debug allocator
-  //  debug.free_queue             -- Recently freed objects
-  virtual void GetProperties(StatLevel level,
-                             std::map<std::string, Property>* result);
- private:
-  static MallocExtension* InitModule();
-
-  static void InitModuleOnce() {
-    // Pointer stored here so heap leak checker will consider the default
-    // instance reachable, even if current_instance_ is later overridden by
-    // MallocExtension::Register().
-    ABSL_ATTRIBUTE_UNUSED static MallocExtension* default_instance =
-        InitModule();
-  }
-
-  static std::atomic<MallocExtension*> current_instance_;
-};
-
-// Base class than can handle output generated by GetHeapSample() and
-// GetHeapGrowthStacks().  Use the available subclass or roll your
-// own.  Useful if you want explicit control over the type of output
-// buffer used (e.g. IOBuffer, Cord, etc.)
-class MallocExtensionWriter {
- public:
-  virtual ~MallocExtensionWriter() {}
-  virtual void Write(const char* buf, int len) = 0;
- protected:
-  MallocExtensionWriter() {}
-  MallocExtensionWriter(const MallocExtensionWriter&) = delete;
-  MallocExtensionWriter& operator=(const MallocExtensionWriter&) = delete;
-};
-
-// A subclass that writes to the std::string "out".  NOTE: The generated
-// data is *appended* to "*out".  I.e., the old contents of "*out" are
-// preserved.
-class StringMallocExtensionWriter : public MallocExtensionWriter {
- public:
-  explicit StringMallocExtensionWriter(std::string* out) : out_(out) {}
-  virtual void Write(const char* buf, int len) {
-    out_->append(buf, len);
-  }
-
- private:
-  std::string* const out_;
-  StringMallocExtensionWriter(const StringMallocExtensionWriter&) = delete;
-  StringMallocExtensionWriter& operator=(const StringMallocExtensionWriter&) =
-      delete;
-};
-
-}  // namespace base_internal
-}  // namespace absl
-
-// The nallocx function allocates no memory, but it performs the same size
-// computation as the malloc function, and returns the real size of the
-// allocation that would result from the equivalent malloc function call.
-// Default weak implementation returns size unchanged, but tcmalloc overrides it
-// and returns rounded up size. See the following link for details:
-// http://www.unix.com/man-page/freebsd/3/nallocx/
-extern "C" size_t nallocx(size_t size, int flags);
-
-#ifndef MALLOCX_LG_ALIGN
-#define MALLOCX_LG_ALIGN(la) (la)
-#endif
-
-#endif  // ABSL_BASE_INTERNAL_MALLOC_EXTENSION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_extension_c.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_extension_c.h
deleted file mode 100644 (file)
index 5afc84a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2017 The Abseil Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-
- * C shims for the C++ malloc_extension.h.  See malloc_extension.h for
- * details.  Note these C shims always work on
- * MallocExtension::instance(); it is not possible to have more than
- * one MallocExtension object in C applications.
- */
-
-#ifndef ABSL_BASE_INTERNAL_MALLOC_EXTENSION_C_H_
-#define ABSL_BASE_INTERNAL_MALLOC_EXTENSION_C_H_
-
-#include <stddef.h>
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define kMallocExtensionHistogramSize 64
-
-int MallocExtension_VerifyAllMemory(void);
-int MallocExtension_VerifyNewMemory(const void* p);
-int MallocExtension_VerifyArrayNewMemory(const void* p);
-int MallocExtension_VerifyMallocMemory(const void* p);
-int MallocExtension_MallocMemoryStats(int* blocks, size_t* total,
-                                      int histogram[kMallocExtensionHistogramSize]);
-
-void MallocExtension_GetStats(char* buffer, int buffer_length);
-
-/* TODO(csilvers): write a C version of these routines, that perhaps
- * takes a function ptr and a void *.
- */
-/* void MallocExtension_GetHeapSample(MallocExtensionWriter* result); */
-/* void MallocExtension_GetHeapGrowthStacks(MallocExtensionWriter* result); */
-
-int MallocExtension_GetNumericProperty(const char* property, size_t* value);
-int MallocExtension_SetNumericProperty(const char* property, size_t value);
-void MallocExtension_MarkThreadIdle(void);
-void MallocExtension_MarkThreadBusy(void);
-void MallocExtension_ReleaseToSystem(size_t num_bytes);
-void MallocExtension_ReleaseFreeMemory(void);
-size_t MallocExtension_GetEstimatedAllocatedSize(size_t size);
-size_t MallocExtension_GetAllocatedSize(const void* p);
-
-/*
- * NOTE: These enum values MUST be kept in sync with the version in
- *       malloc_extension.h
- */
-typedef enum {
-  MallocExtension_kUnknownOwnership = 0,
-  MallocExtension_kOwned,
-  MallocExtension_kNotOwned
-} MallocExtension_Ownership;
-
-MallocExtension_Ownership MallocExtension_GetOwnership(const void* p);
-
-
-#ifdef __cplusplus
-}   // extern "C"
-#endif
-
-#endif  /* ABSL_BASE_INTERNAL_MALLOC_EXTENSION_C_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook.h
deleted file mode 100644 (file)
index ed5cf2e..0000000
+++ /dev/null
@@ -1,333 +0,0 @@
-//
-// Copyright 2017 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// Some of our malloc implementations can invoke the following hooks whenever
-// memory is allocated or deallocated.  MallocHook is thread-safe, and things
-// you do before calling AddFooHook(MyHook) are visible to any resulting calls
-// to MyHook.  Hooks must be thread-safe.  If you write:
-//
-//   CHECK(MallocHook::AddNewHook(&MyNewHook));
-//
-// MyNewHook will be invoked in subsequent calls in the current thread, but
-// there are no guarantees on when it might be invoked in other threads.
-//
-// There are a limited number of slots available for each hook type.  Add*Hook
-// will return false if there are no slots available.  Remove*Hook will return
-// false if the given hook was not already installed.
-//
-// The order in which individual hooks are called in Invoke*Hook is undefined.
-//
-// It is safe for a hook to remove itself within Invoke*Hook and add other
-// hooks.  Any hooks added inside a hook invocation (for the same hook type)
-// will not be invoked for the current invocation.
-//
-// One important user of these hooks is the heap profiler.
-//
-// CAVEAT: If you add new MallocHook::Invoke* calls then those calls must be
-// directly in the code of the (de)allocation function that is provided to the
-// user and that function must have an ABSL_ATTRIBUTE_SECTION(malloc_hook)
-// attribute.
-//
-// Note: the Invoke*Hook() functions are defined in malloc_hook-inl.h.  If you
-// need to invoke a hook (which you shouldn't unless you're part of tcmalloc),
-// be sure to #include malloc_hook-inl.h in addition to malloc_hook.h.
-//
-// NOTE FOR C USERS: If you want to use malloc_hook functionality from
-// a C program, #include malloc_hook_c.h instead of this file.
-//
-// IWYU pragma: private, include "base/malloc_hook.h"
-
-#ifndef ABSL_BASE_INTERNAL_MALLOC_HOOK_H_
-#define ABSL_BASE_INTERNAL_MALLOC_HOOK_H_
-
-#include <sys/types.h>
-#include <cstddef>
-
-#include "absl/base/config.h"
-#include "absl/base/internal/malloc_hook_c.h"
-#include "absl/base/port.h"
-
-namespace absl {
-namespace base_internal {
-
-// Note: malloc_hook_c.h defines MallocHook_*Hook and
-// MallocHook_{Add,Remove}*Hook.  The version of these inside the MallocHook
-// class are defined in terms of the malloc_hook_c version.  See malloc_hook_c.h
-// for details of these types/functions.
-
-class MallocHook {
- public:
-  // The NewHook is invoked whenever an object is being allocated.
-  // Object pointer and size are passed in.
-  // It may be passed null pointer if the allocator returned null.
-  typedef MallocHook_NewHook NewHook;
-  inline static bool AddNewHook(NewHook hook) {
-    return MallocHook_AddNewHook(hook);
-  }
-  inline static bool RemoveNewHook(NewHook hook) {
-    return MallocHook_RemoveNewHook(hook);
-  }
-  inline static void InvokeNewHook(const void* ptr, size_t size);
-
-  // The DeleteHook is invoked whenever an object is being deallocated.
-  // Object pointer is passed in.
-  // It may be passed null pointer if the caller is trying to delete null.
-  typedef MallocHook_DeleteHook DeleteHook;
-  inline static bool AddDeleteHook(DeleteHook hook) {
-    return MallocHook_AddDeleteHook(hook);
-  }
-  inline static bool RemoveDeleteHook(DeleteHook hook) {
-    return MallocHook_RemoveDeleteHook(hook);
-  }
-  inline static void InvokeDeleteHook(const void* ptr);
-
-  // The SampledNewHook is invoked for some subset of object allocations
-  // according to the sampling policy of an allocator such as tcmalloc.
-  // SampledAlloc has the following fields:
-  //  * AllocHandle handle: to be set to an effectively unique value (in this
-  //    process) by allocator.
-  //  * size_t allocated_size: space actually used by allocator to host
-  //    the object.
-  //  * int stack_depth and const void* stack: invocation stack for
-  //    the allocation.
-  // The allocator invoking the hook should record the handle value and later
-  // call InvokeSampledDeleteHook() with that value.
-  typedef MallocHook_SampledNewHook SampledNewHook;
-  typedef MallocHook_SampledAlloc SampledAlloc;
-  inline static bool AddSampledNewHook(SampledNewHook hook) {
-    return MallocHook_AddSampledNewHook(hook);
-  }
-  inline static bool RemoveSampledNewHook(SampledNewHook hook) {
-    return MallocHook_RemoveSampledNewHook(hook);
-  }
-  inline static void InvokeSampledNewHook(const SampledAlloc* sampled_alloc);
-
-  // The SampledDeleteHook is invoked whenever an object previously chosen
-  // by an allocator for sampling is being deallocated.
-  // The handle identifying the object --as previously chosen by
-  // InvokeSampledNewHook()-- is passed in.
-  typedef MallocHook_SampledDeleteHook SampledDeleteHook;
-  typedef MallocHook_AllocHandle AllocHandle;
-  inline static bool AddSampledDeleteHook(SampledDeleteHook hook) {
-    return MallocHook_AddSampledDeleteHook(hook);
-  }
-  inline static bool RemoveSampledDeleteHook(SampledDeleteHook hook) {
-    return MallocHook_RemoveSampledDeleteHook(hook);
-  }
-  inline static void InvokeSampledDeleteHook(AllocHandle handle);
-
-  // The PreMmapHook is invoked with mmap's or mmap64's arguments just
-  // before the mmap/mmap64 call is actually made.  Such a hook may be useful
-  // in memory limited contexts, to catch allocations that will exceed
-  // a memory limit, and take outside actions to increase that limit.
-  typedef MallocHook_PreMmapHook PreMmapHook;
-  inline static bool AddPreMmapHook(PreMmapHook hook) {
-    return MallocHook_AddPreMmapHook(hook);
-  }
-  inline static bool RemovePreMmapHook(PreMmapHook hook) {
-    return MallocHook_RemovePreMmapHook(hook);
-  }
-  inline static void InvokePreMmapHook(const void* start,
-                                       size_t size,
-                                       int protection,
-                                       int flags,
-                                       int fd,
-                                       off_t offset);
-
-  // The MmapReplacement is invoked with mmap's arguments and place to put the
-  // result into after the PreMmapHook but before the mmap/mmap64 call is
-  // actually made.
-  // The MmapReplacement should return true if it handled the call, or false
-  // if it is still necessary to call mmap/mmap64.
-  // This should be used only by experts, and users must be be
-  // extremely careful to avoid recursive calls to mmap. The replacement
-  // should be async signal safe.
-  // Only one MmapReplacement is supported. After setting an MmapReplacement
-  // you must call RemoveMmapReplacement before calling SetMmapReplacement
-  // again.
-  typedef MallocHook_MmapReplacement MmapReplacement;
-  inline static bool SetMmapReplacement(MmapReplacement hook) {
-    return MallocHook_SetMmapReplacement(hook);
-  }
-  inline static bool RemoveMmapReplacement(MmapReplacement hook) {
-    return MallocHook_RemoveMmapReplacement(hook);
-  }
-  inline static bool InvokeMmapReplacement(const void* start,
-                                           size_t size,
-                                           int protection,
-                                           int flags,
-                                           int fd,
-                                           off_t offset,
-                                           void** result);
-
-
-  // The MmapHook is invoked with mmap's return value and arguments whenever
-  // a region of memory has been just mapped.
-  // It may be passed MAP_FAILED if the mmap failed.
-  typedef MallocHook_MmapHook MmapHook;
-  inline static bool AddMmapHook(MmapHook hook) {
-    return MallocHook_AddMmapHook(hook);
-  }
-  inline static bool RemoveMmapHook(MmapHook hook) {
-    return MallocHook_RemoveMmapHook(hook);
-  }
-  inline static void InvokeMmapHook(const void* result,
-                                    const void* start,
-                                    size_t size,
-                                    int protection,
-                                    int flags,
-                                    int fd,
-                                    off_t offset);
-
-  // The MunmapReplacement is invoked with munmap's arguments and place to put
-  // the result into just before the munmap call is actually made.
-  // The MunmapReplacement should return true if it handled the call, or false
-  // if it is still necessary to call munmap.
-  // This should be used only by experts. The replacement should be
-  // async signal safe.
-  // Only one MunmapReplacement is supported. After setting an
-  // MunmapReplacement you must call RemoveMunmapReplacement before
-  // calling SetMunmapReplacement again.
-  typedef MallocHook_MunmapReplacement MunmapReplacement;
-  inline static bool SetMunmapReplacement(MunmapReplacement hook) {
-    return MallocHook_SetMunmapReplacement(hook);
-  }
-  inline static bool RemoveMunmapReplacement(MunmapReplacement hook) {
-    return MallocHook_RemoveMunmapReplacement(hook);
-  }
-  inline static bool InvokeMunmapReplacement(const void* start,
-                                             size_t size,
-                                             int* result);
-
-  // The MunmapHook is invoked with munmap's arguments just before the munmap
-  // call is actually made.
-  // TODO(maxim): Rename this to PreMunmapHook for consistency with PreMmapHook
-  // and PreSbrkHook.
-  typedef MallocHook_MunmapHook MunmapHook;
-  inline static bool AddMunmapHook(MunmapHook hook) {
-    return MallocHook_AddMunmapHook(hook);
-  }
-  inline static bool RemoveMunmapHook(MunmapHook hook) {
-    return MallocHook_RemoveMunmapHook(hook);
-  }
-  inline static void InvokeMunmapHook(const void* start, size_t size);
-
-  // The MremapHook is invoked with mremap's return value and arguments
-  // whenever a region of memory has been just remapped.
-  typedef MallocHook_MremapHook MremapHook;
-  inline static bool AddMremapHook(MremapHook hook) {
-    return MallocHook_AddMremapHook(hook);
-  }
-  inline static bool RemoveMremapHook(MremapHook hook) {
-    return MallocHook_RemoveMremapHook(hook);
-  }
-  inline static void InvokeMremapHook(const void* result,
-                                      const void* old_addr,
-                                      size_t old_size,
-                                      size_t new_size,
-                                      int flags,
-                                      const void* new_addr);
-
-  // The PreSbrkHook is invoked with sbrk's argument just before sbrk is called
-  // -- except when the increment is 0.  This is because sbrk(0) is often called
-  // to get the top of the memory stack, and is not actually a
-  // memory-allocation call.  It may be useful in memory-limited contexts,
-  // to catch allocations that will exceed the limit and take outside
-  // actions to increase such a limit.
-  typedef MallocHook_PreSbrkHook PreSbrkHook;
-  inline static bool AddPreSbrkHook(PreSbrkHook hook) {
-    return MallocHook_AddPreSbrkHook(hook);
-  }
-  inline static bool RemovePreSbrkHook(PreSbrkHook hook) {
-    return MallocHook_RemovePreSbrkHook(hook);
-  }
-  inline static void InvokePreSbrkHook(ptrdiff_t increment);
-
-  // The SbrkHook is invoked with sbrk's result and argument whenever sbrk
-  // has just executed -- except when the increment is 0.
-  // This is because sbrk(0) is often called to get the top of the memory stack,
-  // and is not actually a memory-allocation call.
-  typedef MallocHook_SbrkHook SbrkHook;
-  inline static bool AddSbrkHook(SbrkHook hook) {
-    return MallocHook_AddSbrkHook(hook);
-  }
-  inline static bool RemoveSbrkHook(SbrkHook hook) {
-    return MallocHook_RemoveSbrkHook(hook);
-  }
-  inline static void InvokeSbrkHook(const void* result, ptrdiff_t increment);
-
-  // Pointer to a absl::GetStackTrace implementation, following the API in
-  // base/stacktrace.h.
-  using GetStackTraceFn = int (*)(void**, int, int);
-
-  // Get the current stack trace.  Try to skip all routines up to and
-  // including the caller of MallocHook::Invoke*.
-  // Use "skip_count" (similarly to absl::GetStackTrace from stacktrace.h)
-  // as a hint about how many routines to skip if better information
-  // is not available.
-  // Stack trace is filled into *result up to the size of max_depth.
-  // The actual number of stack frames filled is returned.
-  inline static int GetCallerStackTrace(void** result, int max_depth,
-                                        int skip_count,
-                                        GetStackTraceFn get_stack_trace_fn) {
-    return MallocHook_GetCallerStackTrace(result, max_depth, skip_count,
-                                          get_stack_trace_fn);
-  }
-
-#if ABSL_HAVE_MMAP
-  // Unhooked versions of mmap() and munmap().   These should be used
-  // only by experts, since they bypass heapchecking, etc.
-  // Note: These do not run hooks, but they still use the MmapReplacement
-  // and MunmapReplacement.
-  static void* UnhookedMMap(void* start, size_t size, int protection, int flags,
-                            int fd, off_t offset);
-  static int UnhookedMUnmap(void* start, size_t size);
-#endif
-
- private:
-  // Slow path versions of Invoke*Hook.
-  static void InvokeNewHookSlow(const void* ptr,
-                                size_t size) ABSL_ATTRIBUTE_COLD;
-  static void InvokeDeleteHookSlow(const void* ptr) ABSL_ATTRIBUTE_COLD;
-  static void InvokeSampledNewHookSlow(const SampledAlloc* sampled_alloc)
-      ABSL_ATTRIBUTE_COLD;
-  static void InvokeSampledDeleteHookSlow(AllocHandle handle)
-      ABSL_ATTRIBUTE_COLD;
-  static void InvokePreMmapHookSlow(const void* start, size_t size,
-                                    int protection, int flags, int fd,
-                                    off_t offset) ABSL_ATTRIBUTE_COLD;
-  static void InvokeMmapHookSlow(const void* result, const void* start,
-                                 size_t size, int protection, int flags, int fd,
-                                 off_t offset) ABSL_ATTRIBUTE_COLD;
-  static bool InvokeMmapReplacementSlow(const void* start, size_t size,
-                                        int protection, int flags, int fd,
-                                        off_t offset,
-                                        void** result) ABSL_ATTRIBUTE_COLD;
-  static void InvokeMunmapHookSlow(const void* ptr,
-                                   size_t size) ABSL_ATTRIBUTE_COLD;
-  static bool InvokeMunmapReplacementSlow(const void* ptr, size_t size,
-                                          int* result) ABSL_ATTRIBUTE_COLD;
-  static void InvokeMremapHookSlow(const void* result, const void* old_addr,
-                                   size_t old_size, size_t new_size, int flags,
-                                   const void* new_addr) ABSL_ATTRIBUTE_COLD;
-  static void InvokePreSbrkHookSlow(ptrdiff_t increment) ABSL_ATTRIBUTE_COLD;
-  static void InvokeSbrkHookSlow(const void* result,
-                                 ptrdiff_t increment) ABSL_ATTRIBUTE_COLD;
-};
-
-}  // namespace base_internal
-}  // namespace absl
-#endif  // ABSL_BASE_INTERNAL_MALLOC_HOOK_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook_c.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook_c.h
deleted file mode 100644 (file)
index 03b84ca..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2017 The Abseil Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * C shims for the C++ malloc_hook.h.  See malloc_hook.h for details
- * on how to use these.
- */
-#ifndef ABSL_BASE_INTERNAL_MALLOC_HOOK_C_H_
-#define ABSL_BASE_INTERNAL_MALLOC_HOOK_C_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  /* __cplusplus */
-
-/* Get the current stack trace.  Try to skip all routines up to and
- * including the caller of MallocHook::Invoke*.
- * Use "skip_count" (similarly to absl::GetStackTrace from stacktrace.h)
- * as a hint about how many routines to skip if better information
- * is not available.
- */
-typedef int (*MallocHook_GetStackTraceFn)(void**, int, int);
-int MallocHook_GetCallerStackTrace(void** result, int max_depth, int skip_count,
-                                   MallocHook_GetStackTraceFn fn);
-
-/* All the MallocHook_{Add,Remove}*Hook functions below return 1 on success
- * and 0 on failure.
- */
-
-typedef void (*MallocHook_NewHook)(const void* ptr, size_t size);
-int MallocHook_AddNewHook(MallocHook_NewHook hook);
-int MallocHook_RemoveNewHook(MallocHook_NewHook hook);
-
-typedef void (*MallocHook_DeleteHook)(const void* ptr);
-int MallocHook_AddDeleteHook(MallocHook_DeleteHook hook);
-int MallocHook_RemoveDeleteHook(MallocHook_DeleteHook hook);
-
-typedef int64_t MallocHook_AllocHandle;
-typedef struct {
-  /* See malloc_hook.h  for documentation for this struct. */
-  MallocHook_AllocHandle handle;
-  size_t allocated_size;
-  int stack_depth;
-  const void* stack;
-} MallocHook_SampledAlloc;
-typedef void (*MallocHook_SampledNewHook)(
-    const MallocHook_SampledAlloc* sampled_alloc);
-int MallocHook_AddSampledNewHook(MallocHook_SampledNewHook hook);
-int MallocHook_RemoveSampledNewHook(MallocHook_SampledNewHook hook);
-
-typedef void (*MallocHook_SampledDeleteHook)(MallocHook_AllocHandle handle);
-int MallocHook_AddSampledDeleteHook(MallocHook_SampledDeleteHook hook);
-int MallocHook_RemoveSampledDeleteHook(MallocHook_SampledDeleteHook hook);
-
-typedef void (*MallocHook_PreMmapHook)(const void *start,
-                                       size_t size,
-                                       int protection,
-                                       int flags,
-                                       int fd,
-                                       off_t offset);
-int MallocHook_AddPreMmapHook(MallocHook_PreMmapHook hook);
-int MallocHook_RemovePreMmapHook(MallocHook_PreMmapHook hook);
-
-typedef void (*MallocHook_MmapHook)(const void* result,
-                                    const void* start,
-                                    size_t size,
-                                    int protection,
-                                    int flags,
-                                    int fd,
-                                    off_t offset);
-int MallocHook_AddMmapHook(MallocHook_MmapHook hook);
-int MallocHook_RemoveMmapHook(MallocHook_MmapHook hook);
-
-typedef int (*MallocHook_MmapReplacement)(const void* start,
-                                          size_t size,
-                                          int protection,
-                                          int flags,
-                                          int fd,
-                                          off_t offset,
-                                          void** result);
-int MallocHook_SetMmapReplacement(MallocHook_MmapReplacement hook);
-int MallocHook_RemoveMmapReplacement(MallocHook_MmapReplacement hook);
-
-typedef void (*MallocHook_MunmapHook)(const void* start, size_t size);
-int MallocHook_AddMunmapHook(MallocHook_MunmapHook hook);
-int MallocHook_RemoveMunmapHook(MallocHook_MunmapHook hook);
-
-typedef int (*MallocHook_MunmapReplacement)(const void* start,
-                                            size_t size,
-                                            int* result);
-int MallocHook_SetMunmapReplacement(MallocHook_MunmapReplacement hook);
-int MallocHook_RemoveMunmapReplacement(MallocHook_MunmapReplacement hook);
-
-typedef void (*MallocHook_MremapHook)(const void* result,
-                                      const void* old_addr,
-                                      size_t old_size,
-                                      size_t new_size,
-                                      int flags,
-                                      const void* new_addr);
-int MallocHook_AddMremapHook(MallocHook_MremapHook hook);
-int MallocHook_RemoveMremapHook(MallocHook_MremapHook hook);
-
-typedef void (*MallocHook_PreSbrkHook)(ptrdiff_t increment);
-int MallocHook_AddPreSbrkHook(MallocHook_PreSbrkHook hook);
-int MallocHook_RemovePreSbrkHook(MallocHook_PreSbrkHook hook);
-
-typedef void (*MallocHook_SbrkHook)(const void* result, ptrdiff_t increment);
-int MallocHook_AddSbrkHook(MallocHook_SbrkHook hook);
-int MallocHook_RemoveSbrkHook(MallocHook_SbrkHook hook);
-
-#ifdef __cplusplus
-}  /* extern "C" */
-#endif  /* __cplusplus */
-
-#endif  /* ABSL_BASE_INTERNAL_MALLOC_HOOK_C_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook_invoke.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/malloc_hook_invoke.h
deleted file mode 100644 (file)
index c08220c..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-//
-// Copyright 2017 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-///
-
-// This has the implementation details of malloc_hook that are needed
-// to use malloc-hook inside the tcmalloc system.  It does not hold
-// any of the client-facing calls that are used to add new hooks.
-//
-// IWYU pragma: private, include "base/malloc_hook-inl.h"
-
-#ifndef ABSL_BASE_INTERNAL_MALLOC_HOOK_INVOKE_H_
-#define ABSL_BASE_INTERNAL_MALLOC_HOOK_INVOKE_H_
-
-#include <sys/types.h>
-#include <atomic>
-#include <cstddef>
-
-#include "absl/base/internal/malloc_hook.h"
-
-namespace absl {
-namespace base_internal {
-
-// Maximum of 7 hooks means that HookList is 8 words.
-static constexpr int kHookListMaxValues = 7;
-
-// HookList: a class that provides synchronized insertions and removals and
-// lockless traversal.  Most of the implementation is in malloc_hook.cc.
-template <typename T>
-struct HookList {
-  static_assert(sizeof(T) <= sizeof(intptr_t), "T_should_fit_in_intptr_t");
-
-  // Adds value to the list.  Note that duplicates are allowed.  Thread-safe and
-  // blocking (acquires hooklist_spinlock).  Returns true on success; false
-  // otherwise (failures include invalid value and no space left).
-  bool Add(T value);
-
-  // Removes the first entry matching value from the list.  Thread-safe and
-  // blocking (acquires hooklist_spinlock).  Returns true on success; false
-  // otherwise (failures include invalid value and no value found).
-  bool Remove(T value);
-
-  // Store up to n values of the list in output_array, and return the number of
-  // elements stored.  Thread-safe and non-blocking.  This is fast (one memory
-  // access) if the list is empty.
-  int Traverse(T* output_array, int n) const;
-
-  // Fast inline implementation for fast path of Invoke*Hook.
-  bool empty() const {
-    // empty() is only used as an optimization to determine if we should call
-    // Traverse which has proper acquire loads.  Memory reordering around a
-    // call to empty will either lead to an unnecessary Traverse call, or will
-    // miss invoking hooks, neither of which is a problem.
-    return priv_end.load(std::memory_order_relaxed) == 0;
-  }
-
-  // This internal data is not private so that the class is an aggregate and can
-  // be initialized by the linker.  Don't access this directly.  Use the
-  // INIT_HOOK_LIST macro in malloc_hook.cc.
-
-  // One more than the index of the last valid element in priv_data.  During
-  // 'Remove' this may be past the last valid element in priv_data, but
-  // subsequent values will be 0.
-  std::atomic<int> priv_end;
-  std::atomic<intptr_t> priv_data[kHookListMaxValues];
-};
-
-extern template struct HookList<MallocHook::NewHook>;
-
-extern HookList<MallocHook::NewHook> new_hooks_;
-extern HookList<MallocHook::DeleteHook> delete_hooks_;
-extern HookList<MallocHook::SampledNewHook> sampled_new_hooks_;
-extern HookList<MallocHook::SampledDeleteHook> sampled_delete_hooks_;
-extern HookList<MallocHook::PreMmapHook> premmap_hooks_;
-extern HookList<MallocHook::MmapHook> mmap_hooks_;
-extern HookList<MallocHook::MmapReplacement> mmap_replacement_;
-extern HookList<MallocHook::MunmapHook> munmap_hooks_;
-extern HookList<MallocHook::MunmapReplacement> munmap_replacement_;
-extern HookList<MallocHook::MremapHook> mremap_hooks_;
-extern HookList<MallocHook::PreSbrkHook> presbrk_hooks_;
-extern HookList<MallocHook::SbrkHook> sbrk_hooks_;
-
-inline void MallocHook::InvokeNewHook(const void* ptr, size_t size) {
-  if (!absl::base_internal::new_hooks_.empty()) {
-    InvokeNewHookSlow(ptr, size);
-  }
-}
-
-inline void MallocHook::InvokeDeleteHook(const void* ptr) {
-  if (!absl::base_internal::delete_hooks_.empty()) {
-    InvokeDeleteHookSlow(ptr);
-  }
-}
-
-inline void MallocHook::InvokeSampledNewHook(
-    const SampledAlloc* sampled_alloc) {
-  if (!absl::base_internal::sampled_new_hooks_.empty()) {
-    InvokeSampledNewHookSlow(sampled_alloc);
-  }
-}
-
-inline void MallocHook::InvokeSampledDeleteHook(AllocHandle handle) {
-  if (!absl::base_internal::sampled_delete_hooks_.empty()) {
-    InvokeSampledDeleteHookSlow(handle);
-  }
-}
-
-inline void MallocHook::InvokePreMmapHook(const void* start,
-                                          size_t size,
-                                          int protection,
-                                          int flags,
-                                          int fd,
-                                          off_t offset) {
-  if (!absl::base_internal::premmap_hooks_.empty()) {
-    InvokePreMmapHookSlow(start, size, protection, flags, fd, offset);
-  }
-}
-
-inline void MallocHook::InvokeMmapHook(const void* result,
-                                       const void* start,
-                                       size_t size,
-                                       int protection,
-                                       int flags,
-                                       int fd,
-                                       off_t offset) {
-  if (!absl::base_internal::mmap_hooks_.empty()) {
-    InvokeMmapHookSlow(result, start, size, protection, flags, fd, offset);
-  }
-}
-
-inline bool MallocHook::InvokeMmapReplacement(const void* start,
-                                              size_t size,
-                                              int protection,
-                                              int flags,
-                                              int fd,
-                                              off_t offset,
-                                              void** result) {
-  if (!absl::base_internal::mmap_replacement_.empty()) {
-    return InvokeMmapReplacementSlow(start, size,
-                                     protection, flags,
-                                     fd, offset,
-                                     result);
-  }
-  return false;
-}
-
-inline void MallocHook::InvokeMunmapHook(const void* start, size_t size) {
-  if (!absl::base_internal::munmap_hooks_.empty()) {
-    InvokeMunmapHookSlow(start, size);
-  }
-}
-
-inline bool MallocHook::InvokeMunmapReplacement(
-    const void* start, size_t size, int* result) {
-  if (!absl::base_internal::mmap_replacement_.empty()) {
-    return InvokeMunmapReplacementSlow(start, size, result);
-  }
-  return false;
-}
-
-inline void MallocHook::InvokeMremapHook(const void* result,
-                                         const void* old_addr,
-                                         size_t old_size,
-                                         size_t new_size,
-                                         int flags,
-                                         const void* new_addr) {
-  if (!absl::base_internal::mremap_hooks_.empty()) {
-    InvokeMremapHookSlow(result, old_addr, old_size, new_size, flags, new_addr);
-  }
-}
-
-inline void MallocHook::InvokePreSbrkHook(ptrdiff_t increment) {
-  if (!absl::base_internal::presbrk_hooks_.empty() && increment != 0) {
-    InvokePreSbrkHookSlow(increment);
-  }
-}
-
-inline void MallocHook::InvokeSbrkHook(const void* result,
-                                       ptrdiff_t increment) {
-  if (!absl::base_internal::sbrk_hooks_.empty() && increment != 0) {
-    InvokeSbrkHookSlow(result, increment);
-  }
-}
-
-}  // namespace base_internal
-}  // namespace absl
-#endif  // ABSL_BASE_INTERNAL_MALLOC_HOOK_INVOKE_H_
index 7397451..cf5e97a 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #define ABSL_BASE_INTERNAL_PER_THREAD_TLS_H_
 
 // This header defines two macros:
+//
 // If the platform supports thread-local storage:
-//   ABSL_PER_THREAD_TLS_KEYWORD is the C keyword needed to declare a
-//   thread-local variable ABSL_PER_THREAD_TLS is 1
+//
+// * ABSL_PER_THREAD_TLS_KEYWORD is the C keyword needed to declare a
+//   thread-local variable
+// * ABSL_PER_THREAD_TLS is 1
 //
 // Otherwise:
-//   ABSL_PER_THREAD_TLS_KEYWORD is empty
-//   ABSL_PER_THREAD_TLS is 0
+//
+// * ABSL_PER_THREAD_TLS_KEYWORD is empty
+// * ABSL_PER_THREAD_TLS is 0
 //
 // Microsoft C supports thread-local storage.
 // GCC supports it if the appropriate version of glibc is available,
-// which the programme can indicate by defining ABSL_HAVE_TLS
+// which the programmer can indicate by defining ABSL_HAVE_TLS
 
 #include "absl/base/port.h"  // For ABSL_HAVE_TLS
 
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/pretty_function.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/pretty_function.h
new file mode 100644 (file)
index 0000000..35d5167
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_
+#define ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_
+
+// ABSL_PRETTY_FUNCTION
+//
+// In C++11, __func__ gives the undecorated name of the current function.  That
+// is, "main", not "int main()".  Various compilers give extra macros to get the
+// decorated function name, including return type and arguments, to
+// differentiate between overload sets.  ABSL_PRETTY_FUNCTION is a portable
+// version of these macros which forwards to the correct macro on each compiler.
+#if defined(_MSC_VER)
+#define ABSL_PRETTY_FUNCTION __FUNCSIG__
+#elif defined(__GNUC__)
+#define ABSL_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else
+#error "Unsupported compiler"
+#endif
+
+#endif  // ABSL_BASE_INTERNAL_PRETTY_FUNCTION_H_
index 568d2af..6a4c093 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #ifndef ABSL_BASE_INTERNAL_RAW_LOGGING_H_
 #define ABSL_BASE_INTERNAL_RAW_LOGGING_H_
 
+#include <string>
+
 #include "absl/base/attributes.h"
-#include "absl/base/internal/log_severity.h"
+#include "absl/base/internal/atomic_hook.h"
+#include "absl/base/log_severity.h"
 #include "absl/base/macros.h"
 #include "absl/base/port.h"
 
@@ -35,6 +38,7 @@
 //   ABSL_RAW_LOG(ERROR, "Failed foo with %i: %s", status, error);
 // This will print an almost standard log line like this to stderr only:
 //   E0821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
+
 #define ABSL_RAW_LOG(severity, ...)                                            \
   do {                                                                         \
     constexpr const char* absl_raw_logging_internal_basename =                 \
     }                                                                  \
   } while (0)
 
+// ABSL_INTERNAL_LOG and ABSL_INTERNAL_CHECK work like the RAW variants above,
+// except that if the richer log library is linked into the binary, we dispatch
+// to that instead.  This is potentially useful for internal logging and
+// assertions, where we are using RAW_LOG neither for its async-signal-safety
+// nor for its non-allocating nature, but rather because raw logging has very
+// few other dependencies.
+//
+// The API is a subset of the above: each macro only takes two arguments.  Use
+// StrCat if you need to build a richer message.
+#define ABSL_INTERNAL_LOG(severity, message)                          \
+  do {                                                                \
+    constexpr const char* absl_raw_logging_internal_basename =        \
+        ::absl::raw_logging_internal::Basename(__FILE__,              \
+                                               sizeof(__FILE__) - 1); \
+    ::absl::raw_logging_internal::internal_log_function(              \
+        ABSL_RAW_LOGGING_INTERNAL_##severity,                         \
+        absl_raw_logging_internal_basename, __LINE__, message);       \
+  } while (0)
+
+#define ABSL_INTERNAL_CHECK(condition, message)                    \
+  do {                                                             \
+    if (ABSL_PREDICT_FALSE(!(condition))) {                        \
+      std::string death_message = "Check " #condition " failed: "; \
+      death_message += std::string(message);                       \
+      ABSL_INTERNAL_LOG(FATAL, death_message);                     \
+    }                                                              \
+  } while (0)
+
 #define ABSL_RAW_LOGGING_INTERNAL_INFO ::absl::LogSeverity::kInfo
 #define ABSL_RAW_LOGGING_INTERNAL_WARNING ::absl::LogSeverity::kWarning
 #define ABSL_RAW_LOGGING_INTERNAL_ERROR ::absl::LogSeverity::kError
@@ -74,9 +106,16 @@ namespace raw_logging_internal {
 void RawLog(absl::LogSeverity severity, const char* file, int line,
             const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
 
+// Writes the provided buffer directly to stderr, in a safe, low-level manner.
+//
+// In POSIX this means calling write(), which is async-signal safe and does
+// not malloc.  If the platform supports the SYS_write syscall, we invoke that
+// directly to side-step any libc interception.
+void SafeWriteToStderr(const char *s, size_t len);
+
 // compile-time function to get the "base" filename, that is, the part of
 // a filename after the last "/" or "\" path separator.  The search starts at
-// the end of the std::string; the second parameter is the length of the std::string.
+// the end of the string; the second parameter is the length of the string.
 constexpr const char* Basename(const char* fname, int offset) {
   return offset == 0 || fname[offset - 1] == '/' || fname[offset - 1] == '\\'
              ? fname + offset
@@ -124,6 +163,18 @@ using LogPrefixHook = bool (*)(absl::LogSeverity severity, const char* file,
 using AbortHook = void (*)(const char* file, int line, const char* buf_start,
                            const char* prefix_end, const char* buf_end);
 
+// Internal logging function for ABSL_INTERNAL_LOG to dispatch to.
+//
+// TODO(gfalcon): When string_view no longer depends on base, change this
+// interface to take its message as a string_view instead.
+using InternalLogFunction = void (*)(absl::LogSeverity severity,
+                                     const char* file, int line,
+                                     const std::string& message);
+
+extern base_internal::AtomicHook<InternalLogFunction> internal_log_function;
+
+void RegisterInternalLogFunction(InternalLogFunction func);
+
 }  // namespace raw_logging_internal
 }  // namespace absl
 
index 1b6497a..d5b4b7f 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/scoped_set_env.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/scoped_set_env.h
new file mode 100644 (file)
index 0000000..855b22f
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef ABSL_BASE_INTERNAL_SCOPED_SET_ENV_H_
+#define ABSL_BASE_INTERNAL_SCOPED_SET_ENV_H_
+
+#include <string>
+
+namespace absl {
+namespace base_internal {
+
+class ScopedSetEnv {
+ public:
+  ScopedSetEnv(const char* var_name, const char* new_value);
+  ~ScopedSetEnv();
+
+ private:
+  std::string var_name_;
+  std::string old_value_;
+
+  // True if the environment variable was initially not set.
+  bool was_unset_;
+};
+
+}  // namespace base_internal
+}  // namespace absl
+
+#endif  // ABSL_BASE_INTERNAL_SCOPED_SET_ENV_H_
index 1f50d74..a55aa20 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -32,6 +32,7 @@
 
 #include <stdint.h>
 #include <sys/types.h>
+
 #include <atomic>
 
 #include "absl/base/attributes.h"
@@ -50,21 +51,23 @@ namespace base_internal {
 class LOCKABLE SpinLock {
  public:
   SpinLock() : lockword_(kSpinLockCooperative) {
-    ABSL_TSAN_MUTEX_CREATE(this, 0);
+    ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
   }
 
   // Special constructor for use with static SpinLock objects.  E.g.,
   //
   //    static SpinLock lock(base_internal::kLinkerInitialized);
   //
-  // When intialized using this constructor, we depend on the fact
-  // that the linker has already initialized the memory appropriately.
+  // When initialized using this constructor, we depend on the fact
+  // that the linker has already initialized the memory appropriately. The lock
+  // is initialized in non-cooperative mode.
+  //
   // A SpinLock constructed like this can be freely used from global
   // initializers without worrying about the order in which global
   // initializers run.
   explicit SpinLock(base_internal::LinkerInitialized) {
     // Does nothing; lockword_ is already initialized
-    ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_linker_init);
+    ABSL_TSAN_MUTEX_CREATE(this, 0);
   }
 
   // Constructors that allow non-cooperative spinlocks to be created for use
@@ -73,7 +76,7 @@ class LOCKABLE SpinLock {
   SpinLock(base_internal::LinkerInitialized,
            base_internal::SchedulingMode mode);
 
-  ~SpinLock() { ABSL_TSAN_MUTEX_DESTROY(this, 0); }
+  ~SpinLock() { ABSL_TSAN_MUTEX_DESTROY(this, __tsan_mutex_not_static); }
 
   // Acquire this SpinLock.
   inline void Lock() EXCLUSIVE_LOCK_FUNCTION() {
@@ -101,8 +104,8 @@ class LOCKABLE SpinLock {
   inline void Unlock() UNLOCK_FUNCTION() {
     ABSL_TSAN_MUTEX_PRE_UNLOCK(this, 0);
     uint32_t lock_value = lockword_.load(std::memory_order_relaxed);
-    lockword_.store(lock_value & kSpinLockCooperative,
-                    std::memory_order_release);
+    lock_value = lockword_.exchange(lock_value & kSpinLockCooperative,
+                                    std::memory_order_release);
 
     if ((lock_value & kSpinLockDisabledScheduling) != 0) {
       base_internal::SchedulingGuard::EnableRescheduling(true);
@@ -151,11 +154,17 @@ class LOCKABLE SpinLock {
   enum { kWaitTimeMask =                      // Includes kSpinLockSleeper.
     ~(kSpinLockHeld | kSpinLockCooperative | kSpinLockDisabledScheduling) };
 
+  // Returns true if the provided scheduling mode is cooperative.
+  static constexpr bool IsCooperative(
+      base_internal::SchedulingMode scheduling_mode) {
+    return scheduling_mode == base_internal::SCHEDULE_COOPERATIVE_AND_KERNEL;
+  }
+
   uint32_t TryLockInternal(uint32_t lock_value, uint32_t wait_cycles);
   void InitLinkerInitializedAndCooperative();
   void SlowLock() ABSL_ATTRIBUTE_COLD;
   void SlowUnlock(uint32_t lock_value) ABSL_ATTRIBUTE_COLD;
-  uint32_t SpinLoop(int64_t initial_wait_timestamp, uint32_t* wait_cycles);
+  uint32_t SpinLoop();
 
   inline bool TryLockImpl() {
     uint32_t lock_value = lockword_.load(std::memory_order_relaxed);
@@ -221,7 +230,7 @@ inline uint32_t SpinLock::TryLockInternal(uint32_t lock_value,
           kSpinLockHeld | lock_value | wait_cycles | sched_disabled_bit,
           std::memory_order_acquire, std::memory_order_relaxed)) {
   } else {
-    base_internal::SchedulingGuard::EnableRescheduling(sched_disabled_bit);
+    base_internal::SchedulingGuard::EnableRescheduling(sched_disabled_bit != 0);
   }
 
   return lock_value;
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc
new file mode 100644 (file)
index 0000000..bc46894
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file is an Akaros-specific part of spinlock_wait.cc
+
+#include <atomic>
+
+#include "absl/base/internal/scheduling_mode.h"
+
+extern "C" {
+
+ABSL_ATTRIBUTE_WEAK void AbslInternalSpinLockDelay(
+    std::atomic<uint32_t>* /* lock_word */, uint32_t /* value */,
+    int /* loop */, absl::base_internal::SchedulingMode /* mode */) {
+  // In Akaros, one must take care not to call anything that could cause a
+  // malloc(), a blocking system call, or a uthread_yield() while holding a
+  // spinlock. Our callers assume will not call into libraries or other
+  // arbitrary code.
+}
+
+ABSL_ATTRIBUTE_WEAK void AbslInternalSpinLockWake(
+    std::atomic<uint32_t>* /* lock_word */, bool /* all */) {}
+
+}  // extern "C"
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc
new file mode 100644 (file)
index 0000000..28e29d1
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file is a Linux-specific part of spinlock_wait.cc
+
+#include <linux/futex.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#include <atomic>
+#include <cerrno>
+#include <climits>
+#include <cstdint>
+#include <ctime>
+
+#include "absl/base/attributes.h"
+
+// The SpinLock lockword is `std::atomic<uint32_t>`. Here we assert that
+// `std::atomic<uint32_t>` is bitwise equivalent of the `int` expected
+// by SYS_futex. We also assume that reads/writes done to the lockword
+// by SYS_futex have rational semantics with regard to the
+// std::atomic<> API. C++ provides no guarantees of these assumptions,
+// but they are believed to hold in practice.
+static_assert(sizeof(std::atomic<uint32_t>) == sizeof(int),
+              "SpinLock lockword has the wrong size for a futex");
+
+// Some Android headers are missing these definitions even though they
+// support these futex operations.
+#ifdef __BIONIC__
+#ifndef SYS_futex
+#define SYS_futex __NR_futex
+#endif
+#ifndef FUTEX_PRIVATE_FLAG
+#define FUTEX_PRIVATE_FLAG 128
+#endif
+#endif
+
+extern "C" {
+
+ABSL_ATTRIBUTE_WEAK void AbslInternalSpinLockDelay(
+    std::atomic<uint32_t> *w, uint32_t value, int loop,
+    absl::base_internal::SchedulingMode) {
+  int save_errno = errno;
+  struct timespec tm;
+  tm.tv_sec = 0;
+  tm.tv_nsec = absl::base_internal::SpinLockSuggestedDelayNS(loop);
+  syscall(SYS_futex, w, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, value, &tm);
+  errno = save_errno;
+}
+
+ABSL_ATTRIBUTE_WEAK void AbslInternalSpinLockWake(std::atomic<uint32_t> *w,
+                                                  bool all) {
+  syscall(SYS_futex, w, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, all ? INT_MAX : 1, 0);
+}
+
+}  // extern "C"
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc
new file mode 100644 (file)
index 0000000..f025b5f
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file is a Posix-specific part of spinlock_wait.cc
+
+#include <sched.h>
+#include <atomic>
+#include <ctime>
+#include <cerrno>
+
+#include "absl/base/internal/scheduling_mode.h"
+#include "absl/base/port.h"
+
+extern "C" {
+
+ABSL_ATTRIBUTE_WEAK void AbslInternalSpinLockDelay(
+    std::atomic<uint32_t>* /* lock_word */, uint32_t /* value */, int loop,
+    absl::base_internal::SchedulingMode /* mode */) {
+  int save_errno = errno;
+  if (loop == 0) {
+  } else if (loop == 1) {
+    sched_yield();
+  } else {
+    struct timespec tm;
+    tm.tv_sec = 0;
+    tm.tv_nsec = absl::base_internal::SpinLockSuggestedDelayNS(loop);
+    nanosleep(&tm, nullptr);
+  }
+  errno = save_errno;
+}
+
+ABSL_ATTRIBUTE_WEAK void AbslInternalSpinLockWake(
+    std::atomic<uint32_t>* /* lock_word */, bool /* all */) {}
+
+}  // extern "C"
index 5f65821..6642ce1 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -84,7 +84,7 @@ inline void absl::base_internal::SpinLockWake(std::atomic<uint32_t> *w,
 
 inline void absl::base_internal::SpinLockDelay(
     std::atomic<uint32_t> *w, uint32_t value, int loop,
-    base_internal::SchedulingMode scheduling_mode) {
+    absl::base_internal::SchedulingMode scheduling_mode) {
   AbslInternalSpinLockDelay(w, value, loop, scheduling_mode);
 }
 
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc
new file mode 100644 (file)
index 0000000..78654b5
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file is a Win32-specific part of spinlock_wait.cc
+
+#include <windows.h>
+#include <atomic>
+#include "absl/base/internal/scheduling_mode.h"
+
+extern "C" {
+
+void AbslInternalSpinLockDelay(std::atomic<uint32_t>* /* lock_word */,
+                               uint32_t /* value */, int loop,
+                               absl::base_internal::SchedulingMode /* mode */) {
+  if (loop == 0) {
+  } else if (loop == 1) {
+    Sleep(0);
+  } else {
+    Sleep(absl::base_internal::SpinLockSuggestedDelayNS(loop) / 1000000);
+  }
+}
+
+void AbslInternalSpinLockWake(std::atomic<uint32_t>* /* lock_word */,
+                              bool /* all */) {}
+
+}  // extern "C"
index 5bd1c50..b864a59 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/thread_annotations.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/internal/thread_annotations.h
new file mode 100644 (file)
index 0000000..4dab6a9
--- /dev/null
@@ -0,0 +1,271 @@
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: thread_annotations.h
+// -----------------------------------------------------------------------------
+//
+// WARNING: This is a backwards compatible header and it will be removed after
+// the migration to prefixed thread annotations is finished; please include
+// "absl/base/thread_annotations.h".
+//
+// This header file contains macro definitions for thread safety annotations
+// that allow developers to document the locking policies of multi-threaded
+// code. The annotations can also help program analysis tools to identify
+// potential thread safety issues.
+//
+// These annotations are implemented using compiler attributes. Using the macros
+// defined here instead of raw attributes allow for portability and future
+// compatibility.
+//
+// When referring to mutexes in the arguments of the attributes, you should
+// use variable names or more complex expressions (e.g. my_object->mutex_)
+// that evaluate to a concrete mutex object whenever possible. If the mutex
+// you want to refer to is not in scope, you may use a member pointer
+// (e.g. &MyClass::mutex_) to refer to a mutex in some (unknown) object.
+
+#ifndef ABSL_BASE_INTERNAL_THREAD_ANNOTATIONS_H_
+#define ABSL_BASE_INTERNAL_THREAD_ANNOTATIONS_H_
+
+#if defined(__clang__)
+#define THREAD_ANNOTATION_ATTRIBUTE__(x)   __attribute__((x))
+#else
+#define THREAD_ANNOTATION_ATTRIBUTE__(x)   // no-op
+#endif
+
+// GUARDED_BY()
+//
+// Documents if a shared field or global variable needs to be protected by a
+// mutex. GUARDED_BY() allows the user to specify a particular mutex that
+// should be held when accessing the annotated variable.
+//
+// Although this annotation (and PT_GUARDED_BY, below) cannot be applied to
+// local variables, a local variable and its associated mutex can often be
+// combined into a small class or struct, thereby allowing the annotation.
+//
+// Example:
+//
+//   class Foo {
+//     Mutex mu_;
+//     int p1_ GUARDED_BY(mu_);
+//     ...
+//   };
+#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
+
+// PT_GUARDED_BY()
+//
+// Documents if the memory location pointed to by a pointer should be guarded
+// by a mutex when dereferencing the pointer.
+//
+// Example:
+//   class Foo {
+//     Mutex mu_;
+//     int *p1_ PT_GUARDED_BY(mu_);
+//     ...
+//   };
+//
+// Note that a pointer variable to a shared memory location could itself be a
+// shared variable.
+//
+// Example:
+//
+//   // `q_`, guarded by `mu1_`, points to a shared memory location that is
+//   // guarded by `mu2_`:
+//   int *q_ GUARDED_BY(mu1_) PT_GUARDED_BY(mu2_);
+#define PT_GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
+
+// ACQUIRED_AFTER() / ACQUIRED_BEFORE()
+//
+// Documents the acquisition order between locks that can be held
+// simultaneously by a thread. For any two locks that need to be annotated
+// to establish an acquisition order, only one of them needs the annotation.
+// (i.e. You don't have to annotate both locks with both ACQUIRED_AFTER
+// and ACQUIRED_BEFORE.)
+//
+// As with GUARDED_BY, this is only applicable to mutexes that are shared
+// fields or global variables.
+//
+// Example:
+//
+//   Mutex m1_;
+//   Mutex m2_ ACQUIRED_AFTER(m1_);
+#define ACQUIRED_AFTER(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
+
+#define ACQUIRED_BEFORE(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
+
+// EXCLUSIVE_LOCKS_REQUIRED() / SHARED_LOCKS_REQUIRED()
+//
+// Documents a function that expects a mutex to be held prior to entry.
+// The mutex is expected to be held both on entry to, and exit from, the
+// function.
+//
+// An exclusive lock allows read-write access to the guarded data member(s), and
+// only one thread can acquire a lock exclusively at any one time. A shared lock
+// allows read-only access, and any number of threads can acquire a shared lock
+// concurrently.
+//
+// Generally, non-const methods should be annotated with
+// EXCLUSIVE_LOCKS_REQUIRED, while const methods should be annotated with
+// SHARED_LOCKS_REQUIRED.
+//
+// Example:
+//
+//   Mutex mu1, mu2;
+//   int a GUARDED_BY(mu1);
+//   int b GUARDED_BY(mu2);
+//
+//   void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... }
+//   void bar() const SHARED_LOCKS_REQUIRED(mu1, mu2) { ... }
+#define EXCLUSIVE_LOCKS_REQUIRED(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
+
+#define SHARED_LOCKS_REQUIRED(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
+
+// LOCKS_EXCLUDED()
+//
+// Documents the locks acquired in the body of the function. These locks
+// cannot be held when calling this function (as Abseil's `Mutex` locks are
+// non-reentrant).
+#define LOCKS_EXCLUDED(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__))
+
+// LOCK_RETURNED()
+//
+// Documents a function that returns a mutex without acquiring it.  For example,
+// a public getter method that returns a pointer to a private mutex should
+// be annotated with LOCK_RETURNED.
+#define LOCK_RETURNED(x) \
+  THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
+
+// LOCKABLE
+//
+// Documents if a class/type is a lockable type (such as the `Mutex` class).
+#define LOCKABLE \
+  THREAD_ANNOTATION_ATTRIBUTE__(lockable)
+
+// SCOPED_LOCKABLE
+//
+// Documents if a class does RAII locking (such as the `MutexLock` class).
+// The constructor should use `LOCK_FUNCTION()` to specify the mutex that is
+// acquired, and the destructor should use `UNLOCK_FUNCTION()` with no
+// arguments; the analysis will assume that the destructor unlocks whatever the
+// constructor locked.
+#define SCOPED_LOCKABLE \
+  THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
+
+// EXCLUSIVE_LOCK_FUNCTION()
+//
+// Documents functions that acquire a lock in the body of a function, and do
+// not release it.
+#define EXCLUSIVE_LOCK_FUNCTION(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__))
+
+// SHARED_LOCK_FUNCTION()
+//
+// Documents functions that acquire a shared (reader) lock in the body of a
+// function, and do not release it.
+#define SHARED_LOCK_FUNCTION(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__))
+
+// UNLOCK_FUNCTION()
+//
+// Documents functions that expect a lock to be held on entry to the function,
+// and release it in the body of the function.
+#define UNLOCK_FUNCTION(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__))
+
+// EXCLUSIVE_TRYLOCK_FUNCTION() / SHARED_TRYLOCK_FUNCTION()
+//
+// Documents functions that try to acquire a lock, and return success or failure
+// (or a non-boolean value that can be interpreted as a boolean).
+// The first argument should be `true` for functions that return `true` on
+// success, or `false` for functions that return `false` on success. The second
+// argument specifies the mutex that is locked on success. If unspecified, this
+// mutex is assumed to be `this`.
+#define EXCLUSIVE_TRYLOCK_FUNCTION(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__))
+
+#define SHARED_TRYLOCK_FUNCTION(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__))
+
+// ASSERT_EXCLUSIVE_LOCK() / ASSERT_SHARED_LOCK()
+//
+// Documents functions that dynamically check to see if a lock is held, and fail
+// if it is not held.
+#define ASSERT_EXCLUSIVE_LOCK(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(assert_exclusive_lock(__VA_ARGS__))
+
+#define ASSERT_SHARED_LOCK(...) \
+  THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_lock(__VA_ARGS__))
+
+// NO_THREAD_SAFETY_ANALYSIS
+//
+// Turns off thread safety checking within the body of a particular function.
+// This annotation is used to mark functions that are known to be correct, but
+// the locking behavior is more complicated than the analyzer can handle.
+#define NO_THREAD_SAFETY_ANALYSIS \
+  THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
+
+//------------------------------------------------------------------------------
+// Tool-Supplied Annotations
+//------------------------------------------------------------------------------
+
+// TS_UNCHECKED should be placed around lock expressions that are not valid
+// C++ syntax, but which are present for documentation purposes.  These
+// annotations will be ignored by the analysis.
+#define TS_UNCHECKED(x) ""
+
+// TS_FIXME is used to mark lock expressions that are not valid C++ syntax.
+// It is used by automated tools to mark and disable invalid expressions.
+// The annotation should either be fixed, or changed to TS_UNCHECKED.
+#define TS_FIXME(x) ""
+
+// Like NO_THREAD_SAFETY_ANALYSIS, this turns off checking within the body of
+// a particular function.  However, this attribute is used to mark functions
+// that are incorrect and need to be fixed.  It is used by automated tools to
+// avoid breaking the build when the analysis is updated.
+// Code owners are expected to eventually fix the routine.
+#define NO_THREAD_SAFETY_ANALYSIS_FIXME  NO_THREAD_SAFETY_ANALYSIS
+
+// Similar to NO_THREAD_SAFETY_ANALYSIS_FIXME, this macro marks a GUARDED_BY
+// annotation that needs to be fixed, because it is producing thread safety
+// warning.  It disables the GUARDED_BY.
+#define GUARDED_BY_FIXME(x)
+
+// Disables warnings for a single read operation.  This can be used to avoid
+// warnings when it is known that the read is not actually involved in a race,
+// but the compiler cannot confirm that.
+#define TS_UNCHECKED_READ(x) thread_safety_analysis::ts_unchecked_read(x)
+
+
+namespace thread_safety_analysis {
+
+// Takes a reference to a guarded data member, and returns an unguarded
+// reference.
+template <typename T>
+inline const T& ts_unchecked_read(const T& v) NO_THREAD_SAFETY_ANALYSIS {
+  return v;
+}
+
+template <typename T>
+inline T& ts_unchecked_read(T& v) NO_THREAD_SAFETY_ANALYSIS {
+  return v;
+}
+
+}  // namespace thread_safety_analysis
+
+#endif  // ABSL_BASE_INTERNAL_THREAD_ANNOTATIONS_H_
index 914d5da..b34674a 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -42,9 +42,9 @@ namespace base_internal {
 class SpinLock;
 struct ThreadIdentity;
 
-// Used by the implementation of base::Mutex and base::CondVar.
+// Used by the implementation of absl::Mutex and absl::CondVar.
 struct PerThreadSynch {
-  // The internal representation of base::Mutex and base::CondVar rely
+  // The internal representation of absl::Mutex and absl::CondVar rely
   // on the alignment of PerThreadSynch. Both store the address of the
   // PerThreadSynch in the high-order bits of their internal state,
   // which means the low kLowZeroBits of the address of PerThreadSynch
@@ -61,7 +61,7 @@ struct PerThreadSynch {
 
   PerThreadSynch *next;  // Circular waiter queue; initialized to 0.
   PerThreadSynch *skip;  // If non-zero, all entries in Mutex queue
-                         // upto and including "skip" have same
+                         // up to and including "skip" have same
                          // condition as this, and will be woken later
   bool may_skip;         // if false while on mutex queue, a mutex unlocker
                          // is using this PerThreadSynch as a terminator.  Its
@@ -237,4 +237,5 @@ inline ThreadIdentity* CurrentThreadIdentityIfPresent() {
 
 }  // namespace base_internal
 }  // namespace absl
+
 #endif  // ABSL_BASE_INTERNAL_THREAD_IDENTITY_H_
index 70e2d77..03c700b 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
index a1303e6..2a51060 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #ifndef ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
 #define ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
 
-#ifdef THREAD_SANITIZER
+// ABSL_INTERNAL_HAVE_TSAN_INTERFACE
+// Macro intended only for internal use.
+//
+// Checks whether LLVM Thread Sanitizer interfaces are available.
+// First made available in LLVM 5.0 (Sep 2017).
+#ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
+#error "ABSL_INTERNAL_HAVE_TSAN_INTERFACE cannot be directly set."
+#endif
+
+#if defined(THREAD_SANITIZER) && defined(__has_include)
+#if __has_include(<sanitizer/tsan_interface.h>)
+#define ABSL_INTERNAL_HAVE_TSAN_INTERFACE 1
+#endif
+#endif
+
+#ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
 #include <sanitizer/tsan_interface.h>
 
 #define ABSL_TSAN_MUTEX_CREATE __tsan_mutex_create
index ea30829..2cf7c1d 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // unaligned APIs
 
 // Portable handling of unaligned loads, stores, and copies.
-// On some platforms, like ARM, the copy functions can be more efficient
-// then a load and a store.
-//
-// It is possible to implement all of these these using constant-length memcpy
-// calls, which is portable and will usually be inlined into simple loads and
-// stores if the architecture supports it. However, such inlining usually
-// happens in a pass that's quite late in compilation, which means the resulting
-// loads and stores cannot participate in many other optimizations, leading to
-// overall worse code.
 
 // The unaligned API is C++ only.  The declarations use C++ features
 // (namespaces, inline) which are absent or incompatible in C.
@@ -65,6 +56,7 @@ void __sanitizer_unaligned_store64(void *p, uint64_t v);
 }  // extern "C"
 
 namespace absl {
+namespace base_internal {
 
 inline uint16_t UnalignedLoad16(const void *p) {
   return __sanitizer_unaligned_load16(p);
@@ -90,127 +82,27 @@ inline void UnalignedStore64(void *p, uint64_t v) {
   __sanitizer_unaligned_store64(p, v);
 }
 
+}  // namespace base_internal
 }  // namespace absl
 
-#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) (absl::UnalignedLoad16(_p))
-#define ABSL_INTERNAL_UNALIGNED_LOAD32(_p) (absl::UnalignedLoad32(_p))
-#define ABSL_INTERNAL_UNALIGNED_LOAD64(_p) (absl::UnalignedLoad64(_p))
-
-#define ABSL_INTERNAL_UNALIGNED_STORE16(_p, _val) \
-  (absl::UnalignedStore16(_p, _val))
-#define ABSL_INTERNAL_UNALIGNED_STORE32(_p, _val) \
-  (absl::UnalignedStore32(_p, _val))
-#define ABSL_INTERNAL_UNALIGNED_STORE64(_p, _val) \
-  (absl::UnalignedStore64(_p, _val))
-
-#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386) || \
-    defined(_M_IX86) || defined(__ppc__) || defined(__PPC__) ||    \
-    defined(__ppc64__) || defined(__PPC64__)
-
-// x86 and x86-64 can perform unaligned loads/stores directly;
-// modern PowerPC hardware can also do unaligned integer loads and stores;
-// but note: the FPU still sends unaligned loads and stores to a trap handler!
-
 #define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) \
-  (*reinterpret_cast<const uint16_t *>(_p))
+  (absl::base_internal::UnalignedLoad16(_p))
 #define ABSL_INTERNAL_UNALIGNED_LOAD32(_p) \
-  (*reinterpret_cast<const uint32_t *>(_p))
+  (absl::base_internal::UnalignedLoad32(_p))
 #define ABSL_INTERNAL_UNALIGNED_LOAD64(_p) \
-  (*reinterpret_cast<const uint64_t *>(_p))
+  (absl::base_internal::UnalignedLoad64(_p))
 
 #define ABSL_INTERNAL_UNALIGNED_STORE16(_p, _val) \
-  (*reinterpret_cast<uint16_t *>(_p) = (_val))
+  (absl::base_internal::UnalignedStore16(_p, _val))
 #define ABSL_INTERNAL_UNALIGNED_STORE32(_p, _val) \
-  (*reinterpret_cast<uint32_t *>(_p) = (_val))
+  (absl::base_internal::UnalignedStore32(_p, _val))
 #define ABSL_INTERNAL_UNALIGNED_STORE64(_p, _val) \
-  (*reinterpret_cast<uint64_t *>(_p) = (_val))
-
-#elif defined(__arm__) && \
-      !defined(__ARM_ARCH_5__) && \
-      !defined(__ARM_ARCH_5T__) && \
-      !defined(__ARM_ARCH_5TE__) && \
-      !defined(__ARM_ARCH_5TEJ__) && \
-      !defined(__ARM_ARCH_6__) && \
-      !defined(__ARM_ARCH_6J__) && \
-      !defined(__ARM_ARCH_6K__) && \
-      !defined(__ARM_ARCH_6Z__) && \
-      !defined(__ARM_ARCH_6ZK__) && \
-      !defined(__ARM_ARCH_6T2__)
-
-
-// ARMv7 and newer support native unaligned accesses, but only of 16-bit
-// and 32-bit values (not 64-bit); older versions either raise a fatal signal,
-// do an unaligned read and rotate the words around a bit, or do the reads very
-// slowly (trip through kernel mode). There's no simple #define that says just
-// “ARMv7 or higher”, so we have to filter away all ARMv5 and ARMv6
-// sub-architectures. Newer gcc (>= 4.6) set an __ARM_FEATURE_ALIGNED #define,
-// so in time, maybe we can move on to that.
-//
-// This is a mess, but there's not much we can do about it.
-//
-// To further complicate matters, only LDR instructions (single reads) are
-// allowed to be unaligned, not LDRD (two reads) or LDM (many reads). Unless we
-// explicitly tell the compiler that these accesses can be unaligned, it can and
-// will combine accesses. On armcc, the way to signal this is done by accessing
-// through the type (uint32_t __packed *), but GCC has no such attribute
-// (it ignores __attribute__((packed)) on individual variables). However,
-// we can tell it that a _struct_ is unaligned, which has the same effect,
-// so we do that.
-
-namespace absl {
-namespace internal {
-
-struct Unaligned16Struct {
-  uint16_t value;
-  uint8_t dummy;  // To make the size non-power-of-two.
-} ABSL_ATTRIBUTE_PACKED;
-
-struct Unaligned32Struct {
-  uint32_t value;
-  uint8_t dummy;  // To make the size non-power-of-two.
-} ABSL_ATTRIBUTE_PACKED;
-
-}  // namespace internal
-}  // namespace absl
-
-#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) \
-  ((reinterpret_cast<const ::absl::internal::Unaligned16Struct *>(_p))->value)
-#define ABSL_INTERNAL_UNALIGNED_LOAD32(_p) \
-  ((reinterpret_cast<const ::absl::internal::Unaligned32Struct *>(_p))->value)
-
-#define ABSL_INTERNAL_UNALIGNED_STORE16(_p, _val)                          \
-  ((reinterpret_cast< ::absl::internal::Unaligned16Struct *>(_p))->value = \
-       (_val))
-#define ABSL_INTERNAL_UNALIGNED_STORE32(_p, _val)                          \
-  ((reinterpret_cast< ::absl::internal::Unaligned32Struct *>(_p))->value = \
-       (_val))
-
-namespace absl {
-
-inline uint64_t UnalignedLoad64(const void *p) {
-  uint64_t t;
-  memcpy(&t, p, sizeof t);
-  return t;
-}
-
-inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
-
-}  // namespace absl
-
-#define ABSL_INTERNAL_UNALIGNED_LOAD64(_p) (absl::UnalignedLoad64(_p))
-#define ABSL_INTERNAL_UNALIGNED_STORE64(_p, _val) \
-  (absl::UnalignedStore64(_p, _val))
+  (absl::base_internal::UnalignedStore64(_p, _val))
 
 #else
 
-// ABSL_INTERNAL_NEED_ALIGNED_LOADS is defined when the underlying platform
-// doesn't support unaligned access.
-#define ABSL_INTERNAL_NEED_ALIGNED_LOADS
-
-// These functions are provided for architectures that don't support
-// unaligned loads and stores.
-
 namespace absl {
+namespace base_internal {
 
 inline uint16_t UnalignedLoad16(const void *p) {
   uint16_t t;
@@ -236,18 +128,22 @@ inline void UnalignedStore32(void *p, uint32_t v) { memcpy(p, &v, sizeof v); }
 
 inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
 
+}  // namespace base_internal
 }  // namespace absl
 
-#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) (absl::UnalignedLoad16(_p))
-#define ABSL_INTERNAL_UNALIGNED_LOAD32(_p) (absl::UnalignedLoad32(_p))
-#define ABSL_INTERNAL_UNALIGNED_LOAD64(_p) (absl::UnalignedLoad64(_p))
+#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) \
+  (absl::base_internal::UnalignedLoad16(_p))
+#define ABSL_INTERNAL_UNALIGNED_LOAD32(_p) \
+  (absl::base_internal::UnalignedLoad32(_p))
+#define ABSL_INTERNAL_UNALIGNED_LOAD64(_p) \
+  (absl::base_internal::UnalignedLoad64(_p))
 
 #define ABSL_INTERNAL_UNALIGNED_STORE16(_p, _val) \
-  (absl::UnalignedStore16(_p, _val))
+  (absl::base_internal::UnalignedStore16(_p, _val))
 #define ABSL_INTERNAL_UNALIGNED_STORE32(_p, _val) \
-  (absl::UnalignedStore32(_p, _val))
+  (absl::base_internal::UnalignedStore32(_p, _val))
 #define ABSL_INTERNAL_UNALIGNED_STORE64(_p, _val) \
-  (absl::UnalignedStore64(_p, _val))
+  (absl::base_internal::UnalignedStore64(_p, _val))
 
 #endif
 
index 049f1ca..2d361e9 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -59,7 +59,8 @@
 // CycleClock that runs at atleast 1 MHz. We've found some Android
 // ARM64 devices where this is not the case, so we disable it by
 // default on Android ARM64.
-#if defined(__native_client__) || TARGET_OS_IPHONE || \
+#if defined(__native_client__) ||                      \
+    (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \
     (defined(__ANDROID__) && defined(__aarch64__))
 #define ABSL_USE_UNSCALED_CYCLECLOCK_DEFAULT 0
 #else
@@ -83,6 +84,7 @@
       defined(_M_IX86) || defined(_M_X64))
 #define ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY
 #endif
+
 namespace absl {
 namespace time_internal {
 class UnscaledCycleClockWrapperForGetCurrentTime;
@@ -114,6 +116,7 @@ class UnscaledCycleClock {
 
 }  // namespace base_internal
 }  // namespace absl
+
 #endif  // ABSL_USE_UNSCALED_CYCLECLOCK
 
 #endif  // ABSL_BASE_INTERNAL_UNSCALEDCYCLECLOCK_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/log_severity.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/base/log_severity.h
new file mode 100644 (file)
index 0000000..5a1d557
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
+#define ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
+
+#include <array>
+#include <ostream>
+
+#include "absl/base/attributes.h"
+
+namespace absl {
+
+// Four severity levels are defined.  Logging APIs should terminate the program
+// when a message is logged at severity `kFatal`; the other levels have no
+// special semantics.
+enum class LogSeverity : int {
+  kInfo = 0,
+  kWarning = 1,
+  kError = 2,
+  kFatal = 3,
+};
+
+// Returns an iterable of all standard `absl::LogSeverity` values, ordered from
+// least to most severe.
+constexpr std::array<absl::LogSeverity, 4> LogSeverities() {
+  return {{absl::LogSeverity::kInfo, absl::LogSeverity::kWarning,
+           absl::LogSeverity::kError, absl::LogSeverity::kFatal}};
+}
+
+// Returns the all-caps string representation (e.g. "INFO") of the specified
+// severity level if it is one of the normal levels and "UNKNOWN" otherwise.
+constexpr const char* LogSeverityName(absl::LogSeverity s) {
+  return s == absl::LogSeverity::kInfo
+             ? "INFO"
+             : s == absl::LogSeverity::kWarning
+                   ? "WARNING"
+                   : s == absl::LogSeverity::kError
+                         ? "ERROR"
+                         : s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
+}
+
+// Values less than `kInfo` normalize to `kInfo`; values greater than `kFatal`
+// normalize to `kError` (**NOT** `kFatal`).
+constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
+  return s < absl::LogSeverity::kInfo
+             ? absl::LogSeverity::kInfo
+             : s > absl::LogSeverity::kFatal ? absl::LogSeverity::kError : s;
+}
+constexpr absl::LogSeverity NormalizeLogSeverity(int s) {
+  return NormalizeLogSeverity(static_cast<absl::LogSeverity>(s));
+}
+
+// The exact representation of a streamed `absl::LogSeverity` is deliberately
+// unspecified; do not rely on it.
+std::ostream& operator<<(std::ostream& os, absl::LogSeverity s);
+
+}  // namespace absl
+
+#endif  // ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
index 31d1c02..606a90a 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // This code is compiled directly on many platforms, including client
 // platforms like Windows, Mac, and embedded systems.  Before making
 // any changes here, make sure that you're not breaking any platforms.
-//
 
 #ifndef ABSL_BASE_MACROS_H_
 #define ABSL_BASE_MACROS_H_
 
+#include <cassert>
 #include <cstddef>
 
+#include "absl/base/optimization.h"
 #include "absl/base/port.h"
 
 // ABSL_ARRAYSIZE()
 //
-// Returns the # of elements in an array as a compile-time constant, which can
-// be used in defining new arrays. If you use this macro on a pointer by
+// Returns the number of elements in an array as a compile-time constant, which
+// can be used in defining new arrays. If you use this macro on a pointer by
 // mistake, you will get a compile-time error.
-//
-// Note: this template function declaration is used in defining arraysize.
-// Note that the function doesn't need an implementation, as we only
-// use its type.
+#define ABSL_ARRAYSIZE(array) \
+  (sizeof(::absl::macros_internal::ArraySizeHelper(array)))
+
 namespace absl {
 namespace macros_internal {
+// Note: this internal template function declaration is used by ABSL_ARRAYSIZE.
+// The function doesn't need a definition, as we only use its type.
 template <typename T, size_t N>
-char (&ArraySizeHelper(T (&array)[N]))[N];
+auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
 }  // namespace macros_internal
 }  // namespace absl
-#define ABSL_ARRAYSIZE(array) \
-  (sizeof(::absl::macros_internal::ArraySizeHelper(array)))
 
 // kLinkerInitialized
 //
@@ -145,7 +145,7 @@ enum LinkerInitialized {
 // Every usage of a deprecated entity will trigger a warning when compiled with
 // clang's `-Wdeprecated-declarations` option. This option is turned off by
 // default, but the warnings will be reported by clang-tidy.
-#if defined(__clang__) && __cplusplus >= 201103L && defined(__has_warning)
+#if defined(__clang__) && __cplusplus >= 201103L
 #define ABSL_DEPRECATED(message) __attribute__((deprecated(message)))
 #endif
 
@@ -192,10 +192,22 @@ enum LinkerInitialized {
 // This macro is inspired by
 // https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/
 #if defined(NDEBUG)
-#define ABSL_ASSERT(expr) (false ? (void)(expr) : (void)0)
-#else
 #define ABSL_ASSERT(expr) \
-  (ABSL_PREDICT_TRUE((expr)) ? (void)0 : [] { assert(false && #expr); }())
+  (false ? static_cast<void>(expr) : static_cast<void>(0))
+#else
+#define ABSL_ASSERT(expr)                           \
+  (ABSL_PREDICT_TRUE((expr)) ? static_cast<void>(0) \
+                             : [] { assert(false && #expr); }())  // NOLINT
 #endif
 
+#ifdef ABSL_HAVE_EXCEPTIONS
+#define ABSL_INTERNAL_TRY try
+#define ABSL_INTERNAL_CATCH_ANY catch (...)
+#define ABSL_INTERNAL_RETHROW do { throw; } while (false)
+#else  // ABSL_HAVE_EXCEPTIONS
+#define ABSL_INTERNAL_TRY if (true)
+#define ABSL_INTERNAL_CATCH_ANY else if (false)
+#define ABSL_INTERNAL_RETHROW do {} while (false)
+#endif  // ABSL_HAVE_EXCEPTIONS
+
 #endif  // ABSL_BASE_MACROS_H_
index aaaffa4..0dcbef3 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html
 // for more information.
 //
-// On some compilers, `ABSL_CACHELINE_ALIGNED` expands to
-// `__attribute__((aligned(ABSL_CACHELINE_SIZE)))`. For compilers where this is
-// not known to work, the macro expands to nothing.
+// On some compilers, `ABSL_CACHELINE_ALIGNED` expands to an `__attribute__`
+// or `__declspec` attribute. For compilers where this is not known to work,
+// the macro expands to nothing.
 //
 // No further guarantees are made here. The result of applying the macro
 // to variables and types is always implementation-defined.
 // of causing bugs that are difficult to diagnose, crash, etc. It does not
 // of itself guarantee that objects are aligned to a cache line.
 //
+// NOTE: Some compilers are picky about the locations of annotations such as
+// this attribute, so prefer to put it at the beginning of your declaration.
+// For example,
+//
+//   ABSL_CACHELINE_ALIGNED static Foo* foo = ...
+//
+//   class ABSL_CACHELINE_ALIGNED Bar { ...
+//
 // Recommendations:
 //
 // 1) Consult compiler documentation; this comment is not kept in sync as
 // 3) Prefer applying this attribute to individual variables. Avoid
 //    applying it to types. This tends to localize the effect.
 #define ABSL_CACHELINE_ALIGNED __attribute__((aligned(ABSL_CACHELINE_SIZE)))
-
-#else  // not GCC
+#elif defined(_MSC_VER)
+#define ABSL_CACHELINE_SIZE 64
+#define ABSL_CACHELINE_ALIGNED __declspec(align(ABSL_CACHELINE_SIZE))
+#else
 #define ABSL_CACHELINE_SIZE 64
 #define ABSL_CACHELINE_ALIGNED
 #endif
 // Compilers can use the information that a certain branch is not likely to be
 // taken (for instance, a CHECK failure) to optimize for the common case in
 // the absence of better information (ie. compiling gcc with `-fprofile-arcs`).
+//
+// Recommendation: Modern CPUs dynamically predict branch execution paths,
+// typically with accuracy greater than 97%. As a result, annotating every
+// branch in a codebase is likely counterproductive; however, annotating
+// specific branches that are both hot and consistently mispredicted is likely
+// to yield performance improvements.
 #if ABSL_HAVE_BUILTIN(__builtin_expect) || \
     (defined(__GNUC__) && !defined(__clang__))
 #define ABSL_PREDICT_FALSE(x) (__builtin_expect(x, 0))
 #define ABSL_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
 #else
-#define ABSL_PREDICT_FALSE(x) x
-#define ABSL_PREDICT_TRUE(x) x
+#define ABSL_PREDICT_FALSE(x) (x)
+#define ABSL_PREDICT_TRUE(x) (x)
 #endif
 
 #endif  // ABSL_BASE_OPTIMIZATION_H_
index 17c05c1..699fb1a 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 
 // We support MSVC++ 14.0 update 2 and later.
 // This minimum will go up.
-#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918
-#error "This package requires Visual Studio 2015 Update 2 or higher"
+#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918 && !defined(__clang__)
+#error "This package requires Visual Studio 2015 Update 2 or higher."
 #endif
 
 // We support gcc 4.7 and later.
 // This minimum will go up.
 #if defined(__GNUC__) && !defined(__clang__)
 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
-#error "This package requires gcc 4.7 or higher"
+#error "This package requires gcc 4.7 or higher."
 #endif
 #endif
 
@@ -62,7 +62,7 @@
 // This corresponds to Apple Xcode version 4.5.
 // This minimum will go up.
 #if defined(__apple_build_version__) && __apple_build_version__ < 4211165
-#error "This package requires __apple_build_version__ of 4211165 or higher"
+#error "This package requires __apple_build_version__ of 4211165 or higher."
 #endif
 
 // -----------------------------------------------------------------------------
@@ -86,7 +86,7 @@
 // in May, 2010 and includes some functionality used in Google software
 // (for instance pthread_setname_np):
 // https://sourceware.org/ml/libc-alpha/2010-05/msg00000.html
-#ifdef __GLIBC_PREREQ
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
 #if !__GLIBC_PREREQ(2, 12)
 #error "Minimum required version of glibc is 2.12."
 #endif
 #error "STLPort is not supported."
 #endif
 
+// -----------------------------------------------------------------------------
+// `char` Size Check
+// -----------------------------------------------------------------------------
+
+// Abseil currently assumes CHAR_BIT == 8. If you would like to use Abseil on a
+// platform where this is not the case, please provide us with the details about
+// your platform so we can consider relaxing this requirement.
+#if CHAR_BIT != 8
+#error "Abseil assumes CHAR_BIT == 8."
+#endif
+
+// -----------------------------------------------------------------------------
+// `int` Size Check
+// -----------------------------------------------------------------------------
+
+// Abseil currently assumes that an int is 4 bytes. If you would like to use
+// Abseil on a platform where this is not the case, please provide us with the
+// details about your platform so we can consider relaxing this requirement.
+#if INT_MAX < 2147483647
+#error "Abseil assumes that int is at least 4 bytes. "
+#endif
+
 #endif  // ABSL_BASE_POLICY_CHECKS_H_
index 1c67257..6c28068 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
index 025a854..f98af9f 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,7 +21,6 @@
 // code. The annotations can also help program analysis tools to identify
 // potential thread safety issues.
 //
-//
 // These annotations are implemented using compiler attributes. Using the macros
 // defined here instead of raw attributes allow for portability and future
 // compatibility.
 // that evaluate to a concrete mutex object whenever possible. If the mutex
 // you want to refer to is not in scope, you may use a member pointer
 // (e.g. &MyClass::mutex_) to refer to a mutex in some (unknown) object.
-//
 
 #ifndef ABSL_BASE_THREAD_ANNOTATIONS_H_
 #define ABSL_BASE_THREAD_ANNOTATIONS_H_
+
+// TODO(mbonadei): Remove after the backward compatibility period.
+#include "absl/base/internal/thread_annotations.h"  // IWYU pragma: export
+
 #if defined(__clang__)
-#define THREAD_ANNOTATION_ATTRIBUTE__(x)   __attribute__((x))
+#define ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(x) __attribute__((x))
 #else
-#define THREAD_ANNOTATION_ATTRIBUTE__(x)   // no-op
+#define ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(x)  // no-op
 #endif
 
-// GUARDED_BY()
+// ABSL_GUARDED_BY()
+//
+// Documents if a shared field or global variable needs to be protected by a
+// mutex. ABSL_GUARDED_BY() allows the user to specify a particular mutex that
+// should be held when accessing the annotated variable.
 //
-// Documents if a shared variable/field needs to be protected by a mutex.
-// GUARDED_BY() allows the user to specify a particular mutex that should be
-// held when accessing the annotated variable.
+// Although this annotation (and ABSL_PT_GUARDED_BY, below) cannot be applied to
+// local variables, a local variable and its associated mutex can often be
+// combined into a small class or struct, thereby allowing the annotation.
 //
 // Example:
 //
-//   Mutex mu;
-//   int p1 GUARDED_BY(mu);
-#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
-#define GUARDED_VAR   THREAD_ANNOTATION_ATTRIBUTE__(guarded)
+//   class Foo {
+//     Mutex mu_;
+//     int p1_ ABSL_GUARDED_BY(mu_);
+//     ...
+//   };
+#define ABSL_GUARDED_BY(x) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(guarded_by(x))
 
-// PT_GUARDED_BY()
+// ABSL_PT_GUARDED_BY()
 //
 // Documents if the memory location pointed to by a pointer should be guarded
 // by a mutex when dereferencing the pointer.
 //
 // Example:
-//   Mutex mu;
-//   int *p1 PT_GUARDED_BY(mu);
+//   class Foo {
+//     Mutex mu_;
+//     int *p1_ ABSL_PT_GUARDED_BY(mu_);
+//     ...
+//   };
 //
 // Note that a pointer variable to a shared memory location could itself be a
 // shared variable.
 //
 // Example:
 //
-//     // `q`, guarded by `mu1`, points to a shared memory location that is
-//     // guarded by `mu2`:
-//     int *q GUARDED_BY(mu1) PT_GUARDED_BY(mu2);
-#define PT_GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
-#define PT_GUARDED_VAR   THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded)
+//   // `q_`, guarded by `mu1_`, points to a shared memory location that is
+//   // guarded by `mu2_`:
+//   int *q_ ABSL_GUARDED_BY(mu1_) ABSL_PT_GUARDED_BY(mu2_);
+#define ABSL_PT_GUARDED_BY(x) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(pt_guarded_by(x))
 
-// ACQUIRED_AFTER() / ACQUIRED_BEFORE()
+// ABSL_ACQUIRED_AFTER() / ABSL_ACQUIRED_BEFORE()
 //
 // Documents the acquisition order between locks that can be held
 // simultaneously by a thread. For any two locks that need to be annotated
 // to establish an acquisition order, only one of them needs the annotation.
-// (i.e. You don't have to annotate both locks with both ACQUIRED_AFTER
-// and ACQUIRED_BEFORE.)
+// (i.e. You don't have to annotate both locks with both ABSL_ACQUIRED_AFTER
+// and ABSL_ACQUIRED_BEFORE.)
+//
+// As with ABSL_GUARDED_BY, this is only applicable to mutexes that are shared
+// fields or global variables.
 //
 // Example:
 //
-//   Mutex m1;
-//   Mutex m2 ACQUIRED_AFTER(m1);
-#define ACQUIRED_AFTER(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
+//   Mutex m1_;
+//   Mutex m2_ ABSL_ACQUIRED_AFTER(m1_);
+#define ABSL_ACQUIRED_AFTER(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(acquired_after(__VA_ARGS__))
 
-#define ACQUIRED_BEFORE(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
+#define ABSL_ACQUIRED_BEFORE(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(acquired_before(__VA_ARGS__))
 
-// EXCLUSIVE_LOCKS_REQUIRED() / SHARED_LOCKS_REQUIRED()
+// ABSL_EXCLUSIVE_LOCKS_REQUIRED() / ABSL_SHARED_LOCKS_REQUIRED()
 //
 // Documents a function that expects a mutex to be held prior to entry.
 // The mutex is expected to be held both on entry to, and exit from, the
 // function.
 //
+// An exclusive lock allows read-write access to the guarded data member(s), and
+// only one thread can acquire a lock exclusively at any one time. A shared lock
+// allows read-only access, and any number of threads can acquire a shared lock
+// concurrently.
+//
+// Generally, non-const methods should be annotated with
+// ABSL_EXCLUSIVE_LOCKS_REQUIRED, while const methods should be annotated with
+// ABSL_SHARED_LOCKS_REQUIRED.
+//
 // Example:
 //
 //   Mutex mu1, mu2;
-//   int a GUARDED_BY(mu1);
-//   int b GUARDED_BY(mu2);
-//
-//   void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... };
-#define EXCLUSIVE_LOCKS_REQUIRED(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
+//   int a ABSL_GUARDED_BY(mu1);
+//   int b ABSL_GUARDED_BY(mu2);
+//
+//   void foo() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... }
+//   void bar() const ABSL_SHARED_LOCKS_REQUIRED(mu1, mu2) { ... }
+#define ABSL_EXCLUSIVE_LOCKS_REQUIRED(...)   \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE( \
+      exclusive_locks_required(__VA_ARGS__))
 
-#define SHARED_LOCKS_REQUIRED(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
+#define ABSL_SHARED_LOCKS_REQUIRED(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(shared_locks_required(__VA_ARGS__))
 
-// LOCKS_EXCLUDED()
+// ABSL_LOCKS_EXCLUDED()
 //
 // Documents the locks acquired in the body of the function. These locks
 // cannot be held when calling this function (as Abseil's `Mutex` locks are
 // non-reentrant).
-#define LOCKS_EXCLUDED(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__))
+#define ABSL_LOCKS_EXCLUDED(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(locks_excluded(__VA_ARGS__))
 
-// LOCK_RETURNED()
+// ABSL_LOCK_RETURNED()
 //
 // Documents a function that returns a mutex without acquiring it.  For example,
 // a public getter method that returns a pointer to a private mutex should
-// be annotated with LOCK_RETURNED.
-#define LOCK_RETURNED(x) \
-  THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
+// be annotated with ABSL_LOCK_RETURNED.
+#define ABSL_LOCK_RETURNED(x) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(lock_returned(x))
 
-// LOCKABLE
+// ABSL_LOCKABLE
 //
 // Documents if a class/type is a lockable type (such as the `Mutex` class).
-#define LOCKABLE \
-  THREAD_ANNOTATION_ATTRIBUTE__(lockable)
+#define ABSL_LOCKABLE ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(lockable)
 
-// SCOPED_LOCKABLE
+// ABSL_SCOPED_LOCKABLE
 //
 // Documents if a class does RAII locking (such as the `MutexLock` class).
 // The constructor should use `LOCK_FUNCTION()` to specify the mutex that is
 // acquired, and the destructor should use `UNLOCK_FUNCTION()` with no
 // arguments; the analysis will assume that the destructor unlocks whatever the
 // constructor locked.
-#define SCOPED_LOCKABLE \
-  THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
+#define ABSL_SCOPED_LOCKABLE \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(scoped_lockable)
 
-// EXCLUSIVE_LOCK_FUNCTION()
+// ABSL_EXCLUSIVE_LOCK_FUNCTION()
 //
 // Documents functions that acquire a lock in the body of a function, and do
 // not release it.
-#define EXCLUSIVE_LOCK_FUNCTION(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__))
+#define ABSL_EXCLUSIVE_LOCK_FUNCTION(...)    \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE( \
+      exclusive_lock_function(__VA_ARGS__))
 
-// SHARED_LOCK_FUNCTION()
+// ABSL_SHARED_LOCK_FUNCTION()
 //
 // Documents functions that acquire a shared (reader) lock in the body of a
 // function, and do not release it.
-#define SHARED_LOCK_FUNCTION(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__))
+#define ABSL_SHARED_LOCK_FUNCTION(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(shared_lock_function(__VA_ARGS__))
 
-// UNLOCK_FUNCTION()
+// ABSL_UNLOCK_FUNCTION()
 //
 // Documents functions that expect a lock to be held on entry to the function,
 // and release it in the body of the function.
-#define UNLOCK_FUNCTION(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__))
+#define ABSL_UNLOCK_FUNCTION(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(unlock_function(__VA_ARGS__))
 
-// EXCLUSIVE_TRYLOCK_FUNCTION() / SHARED_TRYLOCK_FUNCTION()
+// ABSL_EXCLUSIVE_TRYLOCK_FUNCTION() / ABSL_SHARED_TRYLOCK_FUNCTION()
 //
 // Documents functions that try to acquire a lock, and return success or failure
 // (or a non-boolean value that can be interpreted as a boolean).
 // success, or `false` for functions that return `false` on success. The second
 // argument specifies the mutex that is locked on success. If unspecified, this
 // mutex is assumed to be `this`.
-#define EXCLUSIVE_TRYLOCK_FUNCTION(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__))
+#define ABSL_EXCLUSIVE_TRYLOCK_FUNCTION(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE( \
+      exclusive_trylock_function(__VA_ARGS__))
 
-#define SHARED_TRYLOCK_FUNCTION(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__))
+#define ABSL_SHARED_TRYLOCK_FUNCTION(...)    \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE( \
+      shared_trylock_function(__VA_ARGS__))
 
-// ASSERT_EXCLUSIVE_LOCK() / ASSERT_SHARED_LOCK()
+// ABSL_ASSERT_EXCLUSIVE_LOCK() / ABSL_ASSERT_SHARED_LOCK()
 //
 // Documents functions that dynamically check to see if a lock is held, and fail
 // if it is not held.
-#define ASSERT_EXCLUSIVE_LOCK(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(assert_exclusive_lock(__VA_ARGS__))
+#define ABSL_ASSERT_EXCLUSIVE_LOCK(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(assert_exclusive_lock(__VA_ARGS__))
 
-#define ASSERT_SHARED_LOCK(...) \
-  THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_lock(__VA_ARGS__))
+#define ABSL_ASSERT_SHARED_LOCK(...) \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(assert_shared_lock(__VA_ARGS__))
 
-// NO_THREAD_SAFETY_ANALYSIS
+// ABSL_NO_THREAD_SAFETY_ANALYSIS
 //
 // Turns off thread safety checking within the body of a particular function.
 // This annotation is used to mark functions that are known to be correct, but
 // the locking behavior is more complicated than the analyzer can handle.
-#define NO_THREAD_SAFETY_ANALYSIS \
-  THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
+#define ABSL_NO_THREAD_SAFETY_ANALYSIS \
+  ABSL_INTERNAL_THREAD_ANNOTATION_ATTRIBUTE(no_thread_safety_analysis)
 
 //------------------------------------------------------------------------------
 // Tool-Supplied Annotations
 //------------------------------------------------------------------------------
 
-// TS_UNCHECKED should be placed around lock expressions that are not valid
+// ABSL_TS_UNCHECKED should be placed around lock expressions that are not valid
 // C++ syntax, but which are present for documentation purposes.  These
 // annotations will be ignored by the analysis.
-#define TS_UNCHECKED(x) ""
+#define ABSL_TS_UNCHECKED(x) ""
 
-// TS_FIXME is used to mark lock expressions that are not valid C++ syntax.
+// ABSL_TS_FIXME is used to mark lock expressions that are not valid C++ syntax.
 // It is used by automated tools to mark and disable invalid expressions.
-// The annotation should either be fixed, or changed to TS_UNCHECKED.
-#define TS_FIXME(x) ""
+// The annotation should either be fixed, or changed to ABSL_TS_UNCHECKED.
+#define ABSL_TS_FIXME(x) ""
 
-// Like NO_THREAD_SAFETY_ANALYSIS, this turns off checking within the body of
-// a particular function.  However, this attribute is used to mark functions
+// Like ABSL_NO_THREAD_SAFETY_ANALYSIS, this turns off checking within the body
+// of a particular function.  However, this attribute is used to mark functions
 // that are incorrect and need to be fixed.  It is used by automated tools to
 // avoid breaking the build when the analysis is updated.
 // Code owners are expected to eventually fix the routine.
-#define NO_THREAD_SAFETY_ANALYSIS_FIXME  NO_THREAD_SAFETY_ANALYSIS
+#define ABSL_NO_THREAD_SAFETY_ANALYSIS_FIXME ABSL_NO_THREAD_SAFETY_ANALYSIS
 
-// Similar to NO_THREAD_SAFETY_ANALYSIS_FIXME, this macro marks a GUARDED_BY
-// annotation that needs to be fixed, because it is producing thread safety
-// warning.  It disables the GUARDED_BY.
-#define GUARDED_BY_FIXME(x)
+// Similar to ABSL_NO_THREAD_SAFETY_ANALYSIS_FIXME, this macro marks a
+// ABSL_GUARDED_BY annotation that needs to be fixed, because it is producing
+// thread safety warning. It disables the ABSL_GUARDED_BY.
+#define ABSL_GUARDED_BY_FIXME(x)
 
 // Disables warnings for a single read operation.  This can be used to avoid
 // warnings when it is known that the read is not actually involved in a race,
 // but the compiler cannot confirm that.
-#define TS_UNCHECKED_READ(x) thread_safety_analysis::ts_unchecked_read(x)
-
+#define ABSL_TS_UNCHECKED_READ(x) absl::base_internal::ts_unchecked_read(x)
 
-namespace thread_safety_analysis {
+namespace absl {
+namespace base_internal {
 
 // Takes a reference to a guarded data member, and returns an unguarded
 // reference.
+// Do not used this function directly, use ABSL_TS_UNCHECKED_READ instead.
 template <typename T>
-inline const T& ts_unchecked_read(const T& v) NO_THREAD_SAFETY_ANALYSIS {
+inline const T& ts_unchecked_read(const T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
   return v;
 }
 
 template <typename T>
-inline T& ts_unchecked_read(T& v) NO_THREAD_SAFETY_ANALYSIS {
+inline T& ts_unchecked_read(T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
   return v;
 }
 
-}  // namespace thread_safety_analysis
+}  // namespace base_internal
+}  // namespace absl
 
 #endif  // ABSL_BASE_THREAD_ANNOTATIONS_H_
index 58240b4..2a8240a 100644 (file)
@@ -1,10 +1,10 @@
-// Copyright 2017 The Abseil Authors.
+// Copyright 2018 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -47,6 +47,8 @@
 #include "absl/base/macros.h"
 #include "absl/base/optimization.h"
 #include "absl/base/port.h"
+#include "absl/container/internal/compressed_tuple.h"
+#include "absl/memory/memory.h"
 
 namespace absl {
 
@@ -56,13 +58,13 @@ constexpr static auto kFixedArrayUseDefault = static_cast<size_t>(-1);
 // FixedArray
 // -----------------------------------------------------------------------------
 //
-// A `FixedArray` provides a run-time fixed-size array, allocating small arrays
-// inline for efficiency and correctness.
+// A `FixedArray` provides a run-time fixed-size array, allocating a small array
+// inline for efficiency.
 //
 // Most users should not specify an `inline_elements` argument and let
-// `FixedArray<>` automatically determine the number of elements
+// `FixedArray` automatically determine the number of elements
 // to store inline based on `sizeof(T)`. If `inline_elements` is specified, the
-// `FixedArray<>` implementation will inline arrays of
+// `FixedArray` implementation will use inline storage for arrays with a
 // length <= `inline_elements`.
 //
 // Note that a `FixedArray` constructed with a `size_type` argument will
@@ -75,68 +77,110 @@ constexpr static auto kFixedArrayUseDefault = static_cast<size_t>(-1);
 // heap allocation, it will do so with global `::operator new[]()` and
 // `::operator delete[]()`, even if T provides class-scope overrides for these
 // operators.
-template <typename T, size_t inlined = kFixedArrayUseDefault>
+template <typename T, size_t N = kFixedArrayUseDefault,
+          typename A = std::allocator<T>>
 class FixedArray {
+  static_assert(!std::is_array<T>::value || std::extent<T>::value > 0,
+                "Arrays with unknown bounds cannot be used with FixedArray.");
+
   static constexpr size_t kInlineBytesDefault = 256;
 
+  using AllocatorTraits = std::allocator_traits<A>;
   // std::iterator_traits isn't guaranteed to be SFINAE-friendly until C++17,
   // but this seems to be mostly pedantic.
-  template <typename Iter>
-  using EnableIfForwardIterator = typename std::enable_if<
-      std::is_convertible<
-          typename std::iterator_traits<Iter>::iterator_category,
-          std::forward_iterator_tag>::value,
-      int>::type;
+  template <typename Iterator>
+  using EnableIfForwardIterator = absl::enable_if_t<std::is_convertible<
+      typename std::iterator_traits<Iterator>::iterator_category,
+      std::forward_iterator_tag>::value>;
+  static constexpr bool NoexceptCopyable() {
+    return std::is_nothrow_copy_constructible<StorageElement>::value &&
+           absl::allocator_is_nothrow<allocator_type>::value;
+  }
+  static constexpr bool NoexceptMovable() {
+    return std::is_nothrow_move_constructible<StorageElement>::value &&
+           absl::allocator_is_nothrow<allocator_type>::value;
+  }
+  static constexpr bool DefaultConstructorIsNonTrivial() {
+    return !absl::is_trivially_default_constructible<StorageElement>::value;
+  }
 
  public:
-  // For playing nicely with stl:
-  using value_type = T;
-  using iterator = T*;
-  using const_iterator = const T*;
+  using allocator_type = typename AllocatorTraits::allocator_type;
+  using value_type = typename allocator_type::value_type;
+  using pointer = typename allocator_type::pointer;
+  using const_pointer = typename allocator_type::const_pointer;
+  using reference = typename allocator_type::reference;
+  using const_reference = typename allocator_type::const_reference;
+  using size_type = typename allocator_type::size_type;
+  using difference_type = typename allocator_type::difference_type;
+  using iterator = pointer;
+  using const_iterator = const_pointer;
   using reverse_iterator = std::reverse_iterator<iterator>;
   using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-  using reference = T&;
-  using const_reference = const T&;
-  using pointer = T*;
-  using const_pointer = const T*;
-  using difference_type = ptrdiff_t;
-  using size_type = size_t;
 
   static constexpr size_type inline_elements =
-      inlined == kFixedArrayUseDefault
-          ? kInlineBytesDefault / sizeof(value_type)
-          : inlined;
+      (N == kFixedArrayUseDefault ? kInlineBytesDefault / sizeof(value_type)
+                                  : static_cast<size_type>(N));
+
+  FixedArray(
+      const FixedArray& other,
+      const allocator_type& a = allocator_type()) noexcept(NoexceptCopyable())
+      : FixedArray(other.begin(), other.end(), a) {}
+
+  FixedArray(
+      FixedArray&& other,
+      const allocator_type& a = allocator_type()) noexcept(NoexceptMovable())
+      : FixedArray(std::make_move_iterator(other.begin()),
+                   std::make_move_iterator(other.end()), a) {}
 
   // Creates an array object that can store `n` elements.
   // Note that trivially constructible elements will be uninitialized.
-  explicit FixedArray(size_type n) : rep_(n) {}
+  explicit FixedArray(size_type n, const allocator_type& a = allocator_type())
+      : storage_(n, a) {
+    if (DefaultConstructorIsNonTrivial()) {
+      memory_internal::ConstructRange(storage_.alloc(), storage_.begin(),
+                                      storage_.end());
+    }
+  }
 
   // Creates an array initialized with `n` copies of `val`.
-  FixedArray(size_type n, const value_type& val) : rep_(n, val) {}
+  FixedArray(size_type n, const value_type& val,
+             const allocator_type& a = allocator_type())
+      : storage_(n, a) {
+    memory_internal::ConstructRange(storage_.alloc(), storage_.begin(),
+                                    storage_.end(), val);
+  }
+
+  // Creates an array initialized with the size and contents of `init_list`.
+  FixedArray(std::initializer_list<value_type> init_list,
+             const allocator_type& a = allocator_type())
+      : FixedArray(init_list.begin(), init_list.end(), a) {}
 
   // Creates an array initialized with the elements from the input
   // range. The array's size will always be `std::distance(first, last)`.
-  // REQUIRES: Iter must be a forward_iterator or better.
-  template <typename Iter, EnableIfForwardIterator<Iter> = 0>
-  FixedArray(Iter first, Iter last) : rep_(first, last) {}
-
-  // Creates the array from an initializer_list.
-  FixedArray(std::initializer_list<T> init_list)
-      : FixedArray(init_list.begin(), init_list.end()) {}
+  // REQUIRES: Iterator must be a forward_iterator or better.
+  template <typename Iterator, EnableIfForwardIterator<Iterator>* = nullptr>
+  FixedArray(Iterator first, Iterator last,
+             const allocator_type& a = allocator_type())
+      : storage_(std::distance(first, last), a) {
+    memory_internal::CopyRange(storage_.alloc(), storage_.begin(), first, last);
+  }
 
-  ~FixedArray() {}
+  ~FixedArray() noexcept {
+    for (auto* cur = storage_.begin(); cur != storage_.end(); ++cur) {
+      AllocatorTraits::destroy(storage_.alloc(), cur);
+    }
+  }
 
-  // Copy and move construction and assignment are deleted because (1) you can't
-  // copy or move an array, (2) assignment breaks the invariant that the size of
-  // a `FixedArray` never changes, and (3) there's no clear answer as to what
-  // should happen to a moved-from `FixedArray`.
-  FixedArray(const FixedArray&) = delete;
+  // Assignments are deleted because they break the invariant that the size of a
+  // `FixedArray` never changes.
+  void operator=(FixedArray&&) = delete;
   void operator=(const FixedArray&) = delete;
 
   // FixedArray::size()
   //
   // Returns the length of the fixed array.
-  size_type size() const { return rep_.size(); }
+  size_type size() const { return storage_.size(); }
 
   // FixedArray::max_size()
   //
@@ -144,7 +188,7 @@ class FixedArray {
   // `FixedArray<T>`. This is equivalent to the most possible addressable bytes
   // over the number of bytes taken by T.
   constexpr size_type max_size() const {
-    return std::numeric_limits<difference_type>::max() / sizeof(value_type);
+    return (std::numeric_limits<difference_type>::max)() / sizeof(value_type);
   }
 
   // FixedArray::empty()
@@ -161,12 +205,13 @@ class FixedArray {
   //
   // Returns a const T* pointer to elements of the `FixedArray`. This pointer
   // can be used to access (but not modify) the contained elements.
-  const_pointer data() const { return AsValue(rep_.begin()); }
+  const_pointer data() const { return AsValueType(storage_.begin()); }
 
   // Overload of FixedArray::data() to return a T* pointer to elements of the
   // fixed array. This pointer can be used to access and modify the contained
   // elements.
-  pointer data() { return AsValue(rep_.begin()); }
+  pointer data() { return AsValueType(storage_.begin()); }
+
   // FixedArray::operator[]
   //
   // Returns a reference the ith element of the fixed array.
@@ -198,7 +243,7 @@ class FixedArray {
   // Overload of FixedArray::at() to return a const reference to the ith element
   // of the fixed array.
   const_reference at(size_type i) const {
-    if (i >= size()) {
+    if (ABSL_PREDICT_FALSE(i >= size())) {
       base_internal::ThrowStdOutOfRange("FixedArray::at failed bounds check");
     }
     return data()[i];
@@ -285,7 +330,7 @@ class FixedArray {
   // FixedArray::fill()
   //
   // Assigns the given `value` to all elements in the fixed array.
-  void fill(const T& value) { std::fill(begin(), end(), value); }
+  void fill(const value_type& val) { std::fill(begin(), end(), val); }
 
   // Relational operators. Equality operators are elementwise using
   // `operator==`, while order operators order FixedArrays lexicographically.
@@ -314,18 +359,25 @@ class FixedArray {
     return !(lhs < rhs);
   }
 
+  template <typename H>
+  friend H AbslHashValue(H h, const FixedArray& v) {
+    return H::combine(H::combine_contiguous(std::move(h), v.data(), v.size()),
+                      v.size());
+  }
+
  private:
-  // HolderTraits
+  // StorageElement
   //
-  // Wrapper to hold elements of type T for the case where T is an array type.
-  // If 'T' is an array type, HolderTraits::type is a struct with a 'T v;'.
-  // Otherwise, HolderTraits::type is simply 'T'.
+  // For FixedArrays with a C-style-array value_type, StorageElement is a POD
+  // wrapper struct called StorageElementWrapper that holds the value_type
+  // instance inside. This is needed for construction and destruction of the
+  // entire array regardless of how many dimensions it has. For all other cases,
+  // StorageElement is just an alias of value_type.
   //
-  // Maintainer's Note: The simpler solution would be to simply wrap T in a
-  // struct whether it's an array or not: 'struct Holder { T v; };', but
-  // that causes some paranoid diagnostics to misfire about uses of data(),
-  // believing that 'data()' (aka '&rep_.begin().v') is a pointer to a single
-  // element, rather than the packed array that it really is.
+  // Maintainer's Note: The simpler solution would be to simply wrap value_type
+  // in a struct whether it's an array or not. That causes some paranoid
+  // diagnostics to misfire, believing that 'data()' returns a pointer to a
+  // single element, rather than the packed array that it really is.
   // e.g.:
   //
   //     FixedArray<char> buf(1);
@@ -334,160 +386,134 @@ class FixedArray {
   //     error: call to int __builtin___sprintf_chk(etc...)
   //     will always overflow destination buffer [-Werror]
   //
-  class HolderTraits {
-    template <typename U>
-    struct SelectImpl {
-      using type = U;
-      static pointer AsValue(type* p) { return p; }
-    };
-
-    // Partial specialization for elements of array type.
-    template <typename U, size_t N>
-    struct SelectImpl<U[N]> {
-      struct Holder { U v[N]; };
-      using type = Holder;
-      static pointer AsValue(type* p) { return &p->v; }
-    };
-    using Impl = SelectImpl<value_type>;
-
-   public:
-    using type = typename Impl::type;
-
-    static pointer AsValue(type *p) { return Impl::AsValue(p); }
-
-    // TODO(billydonahue): fix the type aliasing violation
-    // this assertion hints at.
-    static_assert(sizeof(type) == sizeof(value_type),
-                  "Holder must be same size as value_type");
+  template <typename OuterT = value_type,
+            typename InnerT = absl::remove_extent_t<OuterT>,
+            size_t InnerN = std::extent<OuterT>::value>
+  struct StorageElementWrapper {
+    InnerT array[InnerN];
   };
 
-  using Holder = typename HolderTraits::type;
-  static pointer AsValue(Holder *p) { return HolderTraits::AsValue(p); }
+  using StorageElement =
+      absl::conditional_t<std::is_array<value_type>::value,
+                          StorageElementWrapper<value_type>, value_type>;
+  using StorageElementBuffer =
+      absl::aligned_storage_t<sizeof(StorageElement), alignof(StorageElement)>;
 
-  // InlineSpace
-  //
-  // Allocate some space, not an array of elements of type T, so that we can
-  // skip calling the T constructors and destructors for space we never use.
-  // How many elements should we store inline?
-  //   a. If not specified, use a default of kInlineBytesDefault bytes (This is
-  //   currently 256 bytes, which seems small enough to not cause stack overflow
-  //   or unnecessary stack pollution, while still allowing stack allocation for
-  //   reasonably long character arrays).
-  //   b. Never use 0 length arrays (not ISO C++)
-  //
-  template <size_type N, typename = void>
-  class InlineSpace {
-   public:
-    Holder* data() { return reinterpret_cast<Holder*>(space_.data()); }
-    void AnnotateConstruct(size_t n) const { Annotate(n, true); }
-    void AnnotateDestruct(size_t n) const { Annotate(n, false); }
+  static pointer AsValueType(pointer ptr) { return ptr; }
+  static pointer AsValueType(StorageElementWrapper<value_type>* ptr) {
+    return std::addressof(ptr->array);
+  }
 
-   private:
-#ifndef ADDRESS_SANITIZER
-    void Annotate(size_t, bool) const { }
-#else
-    void Annotate(size_t n, bool creating) const {
-      if (!n) return;
-      const void* bot = &left_redzone_;
-      const void* beg = space_.data();
-      const void* end = space_.data() + n;
-      const void* top = &right_redzone_ + 1;
-      // args: (beg, end, old_mid, new_mid)
-      if (creating) {
-        ANNOTATE_CONTIGUOUS_CONTAINER(beg, top, top, end);
-        ANNOTATE_CONTIGUOUS_CONTAINER(bot, beg, beg, bot);
-      } else {
-        ANNOTATE_CONTIGUOUS_CONTAINER(beg, top, end, top);
-        ANNOTATE_CONTIGUOUS_CONTAINER(bot, beg, bot, beg);
-      }
+  static_assert(sizeof(StorageElement) == sizeof(value_type), "");
+  static_assert(alignof(StorageElement) == alignof(value_type), "");
+
+  struct NonEmptyInlinedStorage {
+    StorageElement* data() {
+      return reinterpret_cast<StorageElement*>(inlined_storage_.data());
     }
+
+#ifdef ADDRESS_SANITIZER
+    void* RedzoneBegin() { return &redzone_begin_; }
+    void* RedzoneEnd() { return &redzone_end_ + 1; }
 #endif  // ADDRESS_SANITIZER
 
-    using Buffer =
-        typename std::aligned_storage<sizeof(Holder), alignof(Holder)>::type;
+    void AnnotateConstruct(size_type);
+    void AnnotateDestruct(size_type);
 
-    ADDRESS_SANITIZER_REDZONE(left_redzone_);
-    std::array<Buffer, N> space_;
-    ADDRESS_SANITIZER_REDZONE(right_redzone_);
+    ADDRESS_SANITIZER_REDZONE(redzone_begin_);
+    std::array<StorageElementBuffer, inline_elements> inlined_storage_;
+    ADDRESS_SANITIZER_REDZONE(redzone_end_);
   };
 
-  // specialization when N = 0.
-  template <typename U>
-  class InlineSpace<0, U> {
-   public:
-    Holder* data() { return nullptr; }
-    void AnnotateConstruct(size_t) const {}
-    void AnnotateDestruct(size_t) const {}
+  struct EmptyInlinedStorage {
+    StorageElement* data() { return nullptr; }
+    void AnnotateConstruct(size_type) {}
+    void AnnotateDestruct(size_type) {}
   };
 
-  // Rep
+  using InlinedStorage =
+      absl::conditional_t<inline_elements == 0, EmptyInlinedStorage,
+                          NonEmptyInlinedStorage>;
+
+  // Storage
   //
-  // A const Rep object holds FixedArray's size and data pointer.
+  // An instance of Storage manages the inline and out-of-line memory for
+  // instances of FixedArray. This guarantees that even when construction of
+  // individual elements fails in the FixedArray constructor body, the
+  // destructor for Storage will still be called and out-of-line memory will be
+  // properly deallocated.
   //
-  class Rep : public InlineSpace<inline_elements> {
+  class Storage : public InlinedStorage {
    public:
-    Rep(size_type n, const value_type& val) : n_(n), p_(MakeHolder(n)) {
-      std::uninitialized_fill_n(p_, n, val);
-    }
+    Storage(size_type n, const allocator_type& a)
+        : size_alloc_(n, a), data_(InitializeData()) {}
 
-    explicit Rep(size_type n) : n_(n), p_(MakeHolder(n)) {
-      // Loop optimizes to nothing for trivially constructible T.
-      for (Holder* p = p_; p != p_ + n; ++p)
-        // Note: no parens: default init only.
-        // Also note '::' to avoid Holder class placement new operator.
-        ::new (static_cast<void*>(p)) Holder;
+    ~Storage() noexcept {
+      if (UsingInlinedStorage(size())) {
+        InlinedStorage::AnnotateDestruct(size());
+      } else {
+        AllocatorTraits::deallocate(alloc(), AsValueType(begin()), size());
+      }
     }
 
-    template <typename Iter>
-    Rep(Iter first, Iter last)
-        : n_(std::distance(first, last)), p_(MakeHolder(n_)) {
-      std::uninitialized_copy(first, last, AsValue(p_));
+    size_type size() const { return size_alloc_.template get<0>(); }
+    StorageElement* begin() const { return data_; }
+    StorageElement* end() const { return begin() + size(); }
+    allocator_type& alloc() {
+      return size_alloc_.template get<1>();
     }
 
-    ~Rep() {
-      // Destruction must be in reverse order.
-      // Loop optimizes to nothing for trivially destructible T.
-      for (Holder* p = end(); p != begin();) (--p)->~Holder();
-      if (IsAllocated(size())) {
-        ::operator delete[](begin());
-      } else {
-        this->AnnotateDestruct(size());
-      }
+   private:
+    static bool UsingInlinedStorage(size_type n) {
+      return n <= inline_elements;
     }
-    Holder* begin() const { return p_; }
-    Holder* end() const { return p_ + n_; }
-    size_type size() const { return n_; }
 
-   private:
-    Holder* MakeHolder(size_type n) {
-      if (IsAllocated(n)) {
-        return Allocate(n);
+    StorageElement* InitializeData() {
+      if (UsingInlinedStorage(size())) {
+        InlinedStorage::AnnotateConstruct(size());
+        return InlinedStorage::data();
       } else {
-        this->AnnotateConstruct(n);
-        return this->data();
+        return reinterpret_cast<StorageElement*>(
+            AllocatorTraits::allocate(alloc(), size()));
       }
     }
 
-    Holder* Allocate(size_type n) {
-      return static_cast<Holder*>(::operator new[](n * sizeof(Holder)));
-    }
-
-    bool IsAllocated(size_type n) const { return n > inline_elements; }
-
-    const size_type n_;
-    Holder* const p_;
+    // `CompressedTuple` takes advantage of EBCO for stateless `allocator_type`s
+    container_internal::CompressedTuple<size_type, allocator_type> size_alloc_;
+    StorageElement* data_;
   };
 
-
-  // Data members
-  Rep rep_;
+  Storage storage_;
 };
 
-template <typename T, size_t N>
-constexpr size_t FixedArray<T, N>::inline_elements;
-
-template <typename T, size_t N>
-constexpr size_t FixedArray<T, N>::kInlineBytesDefault;
-
+template <typename T, size_t N, typename A>
+constexpr size_t FixedArray<T, N, A>::kInlineBytesDefault;
+
+template <typename T, size_t N, typename A>
+constexpr typename FixedArray<T, N, A>::size_type
+    FixedArray<T, N, A>::inline_elements;
+
+template <typename T, size_t N, typename A>
+void FixedArray<T, N, A>::NonEmptyInlinedStorage::AnnotateConstruct(
+    typename FixedArray<T, N, A>::size_type n) {
+#ifdef ADDRESS_SANITIZER
+  if (!n) return;
+  ANNOTATE_CONTIGUOUS_CONTAINER(data(), RedzoneEnd(), RedzoneEnd(), data() + n);
+  ANNOTATE_CONTIGUOUS_CONTAINER(RedzoneBegin(), data(), data(), RedzoneBegin());
+#endif                   // ADDRESS_SANITIZER
+  static_cast<void>(n);  // Mark used when not in asan mode
+}
+
+template <typename T, size_t N, typename A>
+void FixedArray<T, N, A>::NonEmptyInlinedStorage::AnnotateDestruct(
+    typename FixedArray<T, N, A>::size_type n) {
+#ifdef ADDRESS_SANITIZER
+  if (!n) return;
+  ANNOTATE_CONTIGUOUS_CONTAINER(data(), RedzoneEnd(), data() + n, RedzoneEnd());
+  ANNOTATE_CONTIGUOUS_CONTAINER(RedzoneBegin(), data(), RedzoneBegin(), data());
+#endif                   // ADDRESS_SANITIZER
+  static_cast<void>(n);  // Mark used when not in asan mode
+}
 }  // namespace absl
+
 #endif  // ABSL_CONTAINER_FIXED_ARRAY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/flat_hash_map.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/flat_hash_map.h
new file mode 100644 (file)
index 0000000..0bc501b
--- /dev/null
@@ -0,0 +1,585 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: flat_hash_map.h
+// -----------------------------------------------------------------------------
+//
+// An `absl::flat_hash_map<K, V>` is an unordered associative container of
+// unique keys and associated values designed to be a more efficient replacement
+// for `std::unordered_map`. Like `unordered_map`, search, insertion, and
+// deletion of map elements can be done as an `O(1)` operation. However,
+// `flat_hash_map` (and other unordered associative containers known as the
+// collection of Abseil "Swiss tables") contain other optimizations that result
+// in both memory and computation advantages.
+//
+// In most cases, your default choice for a hash map should be a map of type
+// `flat_hash_map`.
+
+#ifndef ABSL_CONTAINER_FLAT_HASH_MAP_H_
+#define ABSL_CONTAINER_FLAT_HASH_MAP_H_
+
+#include <cstddef>
+#include <new>
+#include <type_traits>
+#include <utility>
+
+#include "absl/algorithm/container.h"
+#include "absl/container/internal/container_memory.h"
+#include "absl/container/internal/hash_function_defaults.h"  // IWYU pragma: export
+#include "absl/container/internal/raw_hash_map.h"  // IWYU pragma: export
+#include "absl/memory/memory.h"
+
+namespace absl {
+namespace container_internal {
+template <class K, class V>
+struct FlatHashMapPolicy;
+}  // namespace container_internal
+
+// -----------------------------------------------------------------------------
+// absl::flat_hash_map
+// -----------------------------------------------------------------------------
+//
+// An `absl::flat_hash_map<K, V>` is an unordered associative container which
+// has been optimized for both speed and memory footprint in most common use
+// cases. Its interface is similar to that of `std::unordered_map<K, V>` with
+// the following notable differences:
+//
+// * Requires keys that are CopyConstructible
+// * Requires values that are MoveConstructible
+// * Supports heterogeneous lookup, through `find()`, `operator[]()` and
+//   `insert()`, provided that the map is provided a compatible heterogeneous
+//   hashing function and equality operator.
+// * Invalidates any references and pointers to elements within the table after
+//   `rehash()`.
+// * Contains a `capacity()` member function indicating the number of element
+//   slots (open, deleted, and empty) within the hash map.
+// * Returns `void` from the `erase(iterator)` overload.
+//
+// By default, `flat_hash_map` uses the `absl::Hash` hashing framework.
+// All fundamental and Abseil types that support the `absl::Hash` framework have
+// a compatible equality operator for comparing insertions into `flat_hash_map`.
+// If your type is not yet supported by the `absl::Hash` framework, see
+// absl/hash/hash.h for information on extending Abseil hashing to user-defined
+// types.
+//
+// NOTE: A `flat_hash_map` stores its value types directly inside its
+// implementation array to avoid memory indirection. Because a `flat_hash_map`
+// is designed to move data when rehashed, map values will not retain pointer
+// stability. If you require pointer stability, or if your values are large,
+// consider using `absl::flat_hash_map<Key, std::unique_ptr<Value>>` instead.
+// If your types are not moveable or you require pointer stability for keys,
+// consider `absl::node_hash_map`.
+//
+// Example:
+//
+//   // Create a flat hash map of three strings (that map to strings)
+//   absl::flat_hash_map<std::string, std::string> ducks =
+//     {{"a", "huey"}, {"b", "dewey"}, {"c", "louie"}};
+//
+//  // Insert a new element into the flat hash map
+//  ducks.insert({"d", "donald"});
+//
+//  // Force a rehash of the flat hash map
+//  ducks.rehash(0);
+//
+//  // Find the element with the key "b"
+//  std::string search_key = "b";
+//  auto result = ducks.find(search_key);
+//  if (result != ducks.end()) {
+//    std::cout << "Result: " << result->second << std::endl;
+//  }
+template <class K, class V,
+          class Hash = absl::container_internal::hash_default_hash<K>,
+          class Eq = absl::container_internal::hash_default_eq<K>,
+          class Allocator = std::allocator<std::pair<const K, V>>>
+class flat_hash_map : public absl::container_internal::raw_hash_map<
+                          absl::container_internal::FlatHashMapPolicy<K, V>,
+                          Hash, Eq, Allocator> {
+  using Base = typename flat_hash_map::raw_hash_map;
+
+ public:
+  // Constructors and Assignment Operators
+  //
+  // A flat_hash_map supports the same overload set as `std::unordered_map`
+  // for construction and assignment:
+  //
+  // *  Default constructor
+  //
+  //    // No allocation for the table's elements is made.
+  //    absl::flat_hash_map<int, std::string> map1;
+  //
+  // * Initializer List constructor
+  //
+  //   absl::flat_hash_map<int, std::string> map2 =
+  //       {{1, "huey"}, {2, "dewey"}, {3, "louie"},};
+  //
+  // * Copy constructor
+  //
+  //   absl::flat_hash_map<int, std::string> map3(map2);
+  //
+  // * Copy assignment operator
+  //
+  //  // Hash functor and Comparator are copied as well
+  //  absl::flat_hash_map<int, std::string> map4;
+  //  map4 = map3;
+  //
+  // * Move constructor
+  //
+  //   // Move is guaranteed efficient
+  //   absl::flat_hash_map<int, std::string> map5(std::move(map4));
+  //
+  // * Move assignment operator
+  //
+  //   // May be efficient if allocators are compatible
+  //   absl::flat_hash_map<int, std::string> map6;
+  //   map6 = std::move(map5);
+  //
+  // * Range constructor
+  //
+  //   std::vector<std::pair<int, std::string>> v = {{1, "a"}, {2, "b"}};
+  //   absl::flat_hash_map<int, std::string> map7(v.begin(), v.end());
+  flat_hash_map() {}
+  using Base::Base;
+
+  // flat_hash_map::begin()
+  //
+  // Returns an iterator to the beginning of the `flat_hash_map`.
+  using Base::begin;
+
+  // flat_hash_map::cbegin()
+  //
+  // Returns a const iterator to the beginning of the `flat_hash_map`.
+  using Base::cbegin;
+
+  // flat_hash_map::cend()
+  //
+  // Returns a const iterator to the end of the `flat_hash_map`.
+  using Base::cend;
+
+  // flat_hash_map::end()
+  //
+  // Returns an iterator to the end of the `flat_hash_map`.
+  using Base::end;
+
+  // flat_hash_map::capacity()
+  //
+  // Returns the number of element slots (assigned, deleted, and empty)
+  // available within the `flat_hash_map`.
+  //
+  // NOTE: this member function is particular to `absl::flat_hash_map` and is
+  // not provided in the `std::unordered_map` API.
+  using Base::capacity;
+
+  // flat_hash_map::empty()
+  //
+  // Returns whether or not the `flat_hash_map` is empty.
+  using Base::empty;
+
+  // flat_hash_map::max_size()
+  //
+  // Returns the largest theoretical possible number of elements within a
+  // `flat_hash_map` under current memory constraints. This value can be thought
+  // of the largest value of `std::distance(begin(), end())` for a
+  // `flat_hash_map<K, V>`.
+  using Base::max_size;
+
+  // flat_hash_map::size()
+  //
+  // Returns the number of elements currently within the `flat_hash_map`.
+  using Base::size;
+
+  // flat_hash_map::clear()
+  //
+  // Removes all elements from the `flat_hash_map`. Invalidates any references,
+  // pointers, or iterators referring to contained elements.
+  //
+  // NOTE: this operation may shrink the underlying buffer. To avoid shrinking
+  // the underlying buffer call `erase(begin(), end())`.
+  using Base::clear;
+
+  // flat_hash_map::erase()
+  //
+  // Erases elements within the `flat_hash_map`. Erasing does not trigger a
+  // rehash. Overloads are listed below.
+  //
+  // void erase(const_iterator pos):
+  //
+  //   Erases the element at `position` of the `flat_hash_map`, returning
+  //   `void`.
+  //
+  //   NOTE: returning `void` in this case is different than that of STL
+  //   containers in general and `std::unordered_map` in particular (which
+  //   return an iterator to the element following the erased element). If that
+  //   iterator is needed, simply post increment the iterator:
+  //
+  //     map.erase(it++);
+  //
+  // iterator erase(const_iterator first, const_iterator last):
+  //
+  //   Erases the elements in the open interval [`first`, `last`), returning an
+  //   iterator pointing to `last`.
+  //
+  // size_type erase(const key_type& key):
+  //
+  //   Erases the element with the matching key, if it exists.
+  using Base::erase;
+
+  // flat_hash_map::insert()
+  //
+  // Inserts an element of the specified value into the `flat_hash_map`,
+  // returning an iterator pointing to the newly inserted element, provided that
+  // an element with the given key does not already exist. If rehashing occurs
+  // due to the insertion, all iterators are invalidated. Overloads are listed
+  // below.
+  //
+  // std::pair<iterator,bool> insert(const init_type& value):
+  //
+  //   Inserts a value into the `flat_hash_map`. Returns a pair consisting of an
+  //   iterator to the inserted element (or to the element that prevented the
+  //   insertion) and a bool denoting whether the insertion took place.
+  //
+  // std::pair<iterator,bool> insert(T&& value):
+  // std::pair<iterator,bool> insert(init_type&& value):
+  //
+  //   Inserts a moveable value into the `flat_hash_map`. Returns a pair
+  //   consisting of an iterator to the inserted element (or to the element that
+  //   prevented the insertion) and a bool denoting whether the insertion took
+  //   place.
+  //
+  // iterator insert(const_iterator hint, const init_type& value):
+  // iterator insert(const_iterator hint, T&& value):
+  // iterator insert(const_iterator hint, init_type&& value);
+  //
+  //   Inserts a value, using the position of `hint` as a non-binding suggestion
+  //   for where to begin the insertion search. Returns an iterator to the
+  //   inserted element, or to the existing element that prevented the
+  //   insertion.
+  //
+  // void insert(InputIterator first, InputIterator last):
+  //
+  //   Inserts a range of values [`first`, `last`).
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently, for `flat_hash_map` we guarantee the
+  //   first match is inserted.
+  //
+  // void insert(std::initializer_list<init_type> ilist):
+  //
+  //   Inserts the elements within the initializer list `ilist`.
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently within the initializer list, for
+  //   `flat_hash_map` we guarantee the first match is inserted.
+  using Base::insert;
+
+  // flat_hash_map::insert_or_assign()
+  //
+  // Inserts an element of the specified value into the `flat_hash_map` provided
+  // that a value with the given key does not already exist, or replaces it with
+  // the element value if a key for that value already exists, returning an
+  // iterator pointing to the newly inserted element.  If rehashing occurs due
+  // to the insertion, all existing iterators are invalidated. Overloads are
+  // listed below.
+  //
+  // pair<iterator, bool> insert_or_assign(const init_type& k, T&& obj):
+  // pair<iterator, bool> insert_or_assign(init_type&& k, T&& obj):
+  //
+  //   Inserts/Assigns (or moves) the element of the specified key into the
+  //   `flat_hash_map`.
+  //
+  // iterator insert_or_assign(const_iterator hint,
+  //                           const init_type& k, T&& obj):
+  // iterator insert_or_assign(const_iterator hint, init_type&& k, T&& obj):
+  //
+  //   Inserts/Assigns (or moves) the element of the specified key into the
+  //   `flat_hash_map` using the position of `hint` as a non-binding suggestion
+  //   for where to begin the insertion search.
+  using Base::insert_or_assign;
+
+  // flat_hash_map::emplace()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `flat_hash_map`, provided that no element with the given key
+  // already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately. Prefer `try_emplace()` unless your key is not
+  // copyable or moveable.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace;
+
+  // flat_hash_map::emplace_hint()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `flat_hash_map`, using the position of `hint` as a non-binding
+  // suggestion for where to begin the insertion search, and only inserts
+  // provided that no element with the given key already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately. Prefer `try_emplace()` unless your key is not
+  // copyable or moveable.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace_hint;
+
+  // flat_hash_map::try_emplace()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `flat_hash_map`, provided that no element with the given key
+  // already exists. Unlike `emplace()`, if an element with the given key
+  // already exists, we guarantee that no element is constructed.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  // Overloads are listed below.
+  //
+  //   pair<iterator, bool> try_emplace(const key_type& k, Args&&... args):
+  //   pair<iterator, bool> try_emplace(key_type&& k, Args&&... args):
+  //
+  // Inserts (via copy or move) the element of the specified key into the
+  // `flat_hash_map`.
+  //
+  //   iterator try_emplace(const_iterator hint,
+  //                        const init_type& k, Args&&... args):
+  //   iterator try_emplace(const_iterator hint, init_type&& k, Args&&... args):
+  //
+  // Inserts (via copy or move) the element of the specified key into the
+  // `flat_hash_map` using the position of `hint` as a non-binding suggestion
+  // for where to begin the insertion search.
+  using Base::try_emplace;
+
+  // flat_hash_map::extract()
+  //
+  // Extracts the indicated element, erasing it in the process, and returns it
+  // as a C++17-compatible node handle. Overloads are listed below.
+  //
+  // node_type extract(const_iterator position):
+  //
+  //   Extracts the key,value pair of the element at the indicated position and
+  //   returns a node handle owning that extracted data.
+  //
+  // node_type extract(const key_type& x):
+  //
+  //   Extracts the key,value pair of the element with a key matching the passed
+  //   key value and returns a node handle owning that extracted data. If the
+  //   `flat_hash_map` does not contain an element with a matching key, this
+  //   function returns an empty node handle.
+  using Base::extract;
+
+  // flat_hash_map::merge()
+  //
+  // Extracts elements from a given `source` flat hash map into this
+  // `flat_hash_map`. If the destination `flat_hash_map` already contains an
+  // element with an equivalent key, that element is not extracted.
+  using Base::merge;
+
+  // flat_hash_map::swap(flat_hash_map& other)
+  //
+  // Exchanges the contents of this `flat_hash_map` with those of the `other`
+  // flat hash map, avoiding invocation of any move, copy, or swap operations on
+  // individual elements.
+  //
+  // All iterators and references on the `flat_hash_map` remain valid, excepting
+  // for the past-the-end iterator, which is invalidated.
+  //
+  // `swap()` requires that the flat hash map's hashing and key equivalence
+  // functions be Swappable, and are exchaged using unqualified calls to
+  // non-member `swap()`. If the map's allocator has
+  // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value`
+  // set to `true`, the allocators are also exchanged using an unqualified call
+  // to non-member `swap()`; otherwise, the allocators are not swapped.
+  using Base::swap;
+
+  // flat_hash_map::rehash(count)
+  //
+  // Rehashes the `flat_hash_map`, setting the number of slots to be at least
+  // the passed value. If the new number of slots increases the load factor more
+  // than the current maximum load factor
+  // (`count` < `size()` / `max_load_factor()`), then the new number of slots
+  // will be at least `size()` / `max_load_factor()`.
+  //
+  // To force a rehash, pass rehash(0).
+  //
+  // NOTE: unlike behavior in `std::unordered_map`, references are also
+  // invalidated upon a `rehash()`.
+  using Base::rehash;
+
+  // flat_hash_map::reserve(count)
+  //
+  // Sets the number of slots in the `flat_hash_map` to the number needed to
+  // accommodate at least `count` total elements without exceeding the current
+  // maximum load factor, and may rehash the container if needed.
+  using Base::reserve;
+
+  // flat_hash_map::at()
+  //
+  // Returns a reference to the mapped value of the element with key equivalent
+  // to the passed key.
+  using Base::at;
+
+  // flat_hash_map::contains()
+  //
+  // Determines whether an element with a key comparing equal to the given `key`
+  // exists within the `flat_hash_map`, returning `true` if so or `false`
+  // otherwise.
+  using Base::contains;
+
+  // flat_hash_map::count(const Key& key) const
+  //
+  // Returns the number of elements with a key comparing equal to the given
+  // `key` within the `flat_hash_map`. note that this function will return
+  // either `1` or `0` since duplicate keys are not allowed within a
+  // `flat_hash_map`.
+  using Base::count;
+
+  // flat_hash_map::equal_range()
+  //
+  // Returns a closed range [first, last], defined by a `std::pair` of two
+  // iterators, containing all elements with the passed key in the
+  // `flat_hash_map`.
+  using Base::equal_range;
+
+  // flat_hash_map::find()
+  //
+  // Finds an element with the passed `key` within the `flat_hash_map`.
+  using Base::find;
+
+  // flat_hash_map::operator[]()
+  //
+  // Returns a reference to the value mapped to the passed key within the
+  // `flat_hash_map`, performing an `insert()` if the key does not already
+  // exist.
+  //
+  // If an insertion occurs and results in a rehashing of the container, all
+  // iterators are invalidated. Otherwise iterators are not affected and
+  // references are not invalidated. Overloads are listed below.
+  //
+  // T& operator[](const Key& key):
+  //
+  //   Inserts an init_type object constructed in-place if the element with the
+  //   given key does not exist.
+  //
+  // T& operator[](Key&& key):
+  //
+  //   Inserts an init_type object constructed in-place provided that an element
+  //   with the given key does not exist.
+  using Base::operator[];
+
+  // flat_hash_map::bucket_count()
+  //
+  // Returns the number of "buckets" within the `flat_hash_map`. Note that
+  // because a flat hash map contains all elements within its internal storage,
+  // this value simply equals the current capacity of the `flat_hash_map`.
+  using Base::bucket_count;
+
+  // flat_hash_map::load_factor()
+  //
+  // Returns the current load factor of the `flat_hash_map` (the average number
+  // of slots occupied with a value within the hash map).
+  using Base::load_factor;
+
+  // flat_hash_map::max_load_factor()
+  //
+  // Manages the maximum load factor of the `flat_hash_map`. Overloads are
+  // listed below.
+  //
+  // float flat_hash_map::max_load_factor()
+  //
+  //   Returns the current maximum load factor of the `flat_hash_map`.
+  //
+  // void flat_hash_map::max_load_factor(float ml)
+  //
+  //   Sets the maximum load factor of the `flat_hash_map` to the passed value.
+  //
+  //   NOTE: This overload is provided only for API compatibility with the STL;
+  //   `flat_hash_map` will ignore any set load factor and manage its rehashing
+  //   internally as an implementation detail.
+  using Base::max_load_factor;
+
+  // flat_hash_map::get_allocator()
+  //
+  // Returns the allocator function associated with this `flat_hash_map`.
+  using Base::get_allocator;
+
+  // flat_hash_map::hash_function()
+  //
+  // Returns the hashing function used to hash the keys within this
+  // `flat_hash_map`.
+  using Base::hash_function;
+
+  // flat_hash_map::key_eq()
+  //
+  // Returns the function used for comparing keys equality.
+  using Base::key_eq;
+};
+
+namespace container_internal {
+
+template <class K, class V>
+struct FlatHashMapPolicy {
+  using slot_policy = container_internal::map_slot_policy<K, V>;
+  using slot_type = typename slot_policy::slot_type;
+  using key_type = K;
+  using mapped_type = V;
+  using init_type = std::pair</*non const*/ key_type, mapped_type>;
+
+  template <class Allocator, class... Args>
+  static void construct(Allocator* alloc, slot_type* slot, Args&&... args) {
+    slot_policy::construct(alloc, slot, std::forward<Args>(args)...);
+  }
+
+  template <class Allocator>
+  static void destroy(Allocator* alloc, slot_type* slot) {
+    slot_policy::destroy(alloc, slot);
+  }
+
+  template <class Allocator>
+  static void transfer(Allocator* alloc, slot_type* new_slot,
+                       slot_type* old_slot) {
+    slot_policy::transfer(alloc, new_slot, old_slot);
+  }
+
+  template <class F, class... Args>
+  static decltype(absl::container_internal::DecomposePair(
+      std::declval<F>(), std::declval<Args>()...))
+  apply(F&& f, Args&&... args) {
+    return absl::container_internal::DecomposePair(std::forward<F>(f),
+                                                   std::forward<Args>(args)...);
+  }
+
+  static size_t space_used(const slot_type*) { return 0; }
+
+  static std::pair<const K, V>& element(slot_type* slot) { return slot->value; }
+
+  static V& value(std::pair<const K, V>* kv) { return kv->second; }
+  static const V& value(const std::pair<const K, V>* kv) { return kv->second; }
+};
+
+}  // namespace container_internal
+
+namespace container_algorithm_internal {
+
+// Specialization of trait in absl/algorithm/container.h
+template <class Key, class T, class Hash, class KeyEqual, class Allocator>
+struct IsUnorderedContainer<
+    absl::flat_hash_map<Key, T, Hash, KeyEqual, Allocator>> : std::true_type {};
+
+}  // namespace container_algorithm_internal
+
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_FLAT_HASH_MAP_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/flat_hash_set.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/flat_hash_set.h
new file mode 100644 (file)
index 0000000..6bf5183
--- /dev/null
@@ -0,0 +1,493 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: flat_hash_set.h
+// -----------------------------------------------------------------------------
+//
+// An `absl::flat_hash_set<T>` is an unordered associative container designed to
+// be a more efficient replacement for `std::unordered_set`. Like
+// `unordered_set`, search, insertion, and deletion of set elements can be done
+// as an `O(1)` operation. However, `flat_hash_set` (and other unordered
+// associative containers known as the collection of Abseil "Swiss tables")
+// contain other optimizations that result in both memory and computation
+// advantages.
+//
+// In most cases, your default choice for a hash set should be a set of type
+// `flat_hash_set`.
+#ifndef ABSL_CONTAINER_FLAT_HASH_SET_H_
+#define ABSL_CONTAINER_FLAT_HASH_SET_H_
+
+#include <type_traits>
+#include <utility>
+
+#include "absl/algorithm/container.h"
+#include "absl/base/macros.h"
+#include "absl/container/internal/container_memory.h"
+#include "absl/container/internal/hash_function_defaults.h"  // IWYU pragma: export
+#include "absl/container/internal/raw_hash_set.h"  // IWYU pragma: export
+#include "absl/memory/memory.h"
+
+namespace absl {
+namespace container_internal {
+template <typename T>
+struct FlatHashSetPolicy;
+}  // namespace container_internal
+
+// -----------------------------------------------------------------------------
+// absl::flat_hash_set
+// -----------------------------------------------------------------------------
+//
+// An `absl::flat_hash_set<T>` is an unordered associative container which has
+// been optimized for both speed and memory footprint in most common use cases.
+// Its interface is similar to that of `std::unordered_set<T>` with the
+// following notable differences:
+//
+// * Requires keys that are CopyConstructible
+// * Supports heterogeneous lookup, through `find()`, `operator[]()` and
+//   `insert()`, provided that the set is provided a compatible heterogeneous
+//   hashing function and equality operator.
+// * Invalidates any references and pointers to elements within the table after
+//   `rehash()`.
+// * Contains a `capacity()` member function indicating the number of element
+//   slots (open, deleted, and empty) within the hash set.
+// * Returns `void` from the `erase(iterator)` overload.
+//
+// By default, `flat_hash_set` uses the `absl::Hash` hashing framework. All
+// fundamental and Abseil types that support the `absl::Hash` framework have a
+// compatible equality operator for comparing insertions into `flat_hash_map`.
+// If your type is not yet supported by the `absl::Hash` framework, see
+// absl/hash/hash.h for information on extending Abseil hashing to user-defined
+// types.
+//
+// NOTE: A `flat_hash_set` stores its keys directly inside its implementation
+// array to avoid memory indirection. Because a `flat_hash_set` is designed to
+// move data when rehashed, set keys will not retain pointer stability. If you
+// require pointer stability, consider using
+// `absl::flat_hash_set<std::unique_ptr<T>>`. If your type is not moveable and
+// you require pointer stability, consider `absl::node_hash_set` instead.
+//
+// Example:
+//
+//   // Create a flat hash set of three strings
+//   absl::flat_hash_set<std::string> ducks =
+//     {"huey", "dewey", "louie"};
+//
+//  // Insert a new element into the flat hash set
+//  ducks.insert("donald");
+//
+//  // Force a rehash of the flat hash set
+//  ducks.rehash(0);
+//
+//  // See if "dewey" is present
+//  if (ducks.contains("dewey")) {
+//    std::cout << "We found dewey!" << std::endl;
+//  }
+template <class T, class Hash = absl::container_internal::hash_default_hash<T>,
+          class Eq = absl::container_internal::hash_default_eq<T>,
+          class Allocator = std::allocator<T>>
+class flat_hash_set
+    : public absl::container_internal::raw_hash_set<
+          absl::container_internal::FlatHashSetPolicy<T>, Hash, Eq, Allocator> {
+  using Base = typename flat_hash_set::raw_hash_set;
+
+ public:
+  // Constructors and Assignment Operators
+  //
+  // A flat_hash_set supports the same overload set as `std::unordered_map`
+  // for construction and assignment:
+  //
+  // *  Default constructor
+  //
+  //    // No allocation for the table's elements is made.
+  //    absl::flat_hash_set<std::string> set1;
+  //
+  // * Initializer List constructor
+  //
+  //   absl::flat_hash_set<std::string> set2 =
+  //       {{"huey"}, {"dewey"}, {"louie"},};
+  //
+  // * Copy constructor
+  //
+  //   absl::flat_hash_set<std::string> set3(set2);
+  //
+  // * Copy assignment operator
+  //
+  //  // Hash functor and Comparator are copied as well
+  //  absl::flat_hash_set<std::string> set4;
+  //  set4 = set3;
+  //
+  // * Move constructor
+  //
+  //   // Move is guaranteed efficient
+  //   absl::flat_hash_set<std::string> set5(std::move(set4));
+  //
+  // * Move assignment operator
+  //
+  //   // May be efficient if allocators are compatible
+  //   absl::flat_hash_set<std::string> set6;
+  //   set6 = std::move(set5);
+  //
+  // * Range constructor
+  //
+  //   std::vector<std::string> v = {"a", "b"};
+  //   absl::flat_hash_set<std::string> set7(v.begin(), v.end());
+  flat_hash_set() {}
+  using Base::Base;
+
+  // flat_hash_set::begin()
+  //
+  // Returns an iterator to the beginning of the `flat_hash_set`.
+  using Base::begin;
+
+  // flat_hash_set::cbegin()
+  //
+  // Returns a const iterator to the beginning of the `flat_hash_set`.
+  using Base::cbegin;
+
+  // flat_hash_set::cend()
+  //
+  // Returns a const iterator to the end of the `flat_hash_set`.
+  using Base::cend;
+
+  // flat_hash_set::end()
+  //
+  // Returns an iterator to the end of the `flat_hash_set`.
+  using Base::end;
+
+  // flat_hash_set::capacity()
+  //
+  // Returns the number of element slots (assigned, deleted, and empty)
+  // available within the `flat_hash_set`.
+  //
+  // NOTE: this member function is particular to `absl::flat_hash_set` and is
+  // not provided in the `std::unordered_map` API.
+  using Base::capacity;
+
+  // flat_hash_set::empty()
+  //
+  // Returns whether or not the `flat_hash_set` is empty.
+  using Base::empty;
+
+  // flat_hash_set::max_size()
+  //
+  // Returns the largest theoretical possible number of elements within a
+  // `flat_hash_set` under current memory constraints. This value can be thought
+  // of the largest value of `std::distance(begin(), end())` for a
+  // `flat_hash_set<T>`.
+  using Base::max_size;
+
+  // flat_hash_set::size()
+  //
+  // Returns the number of elements currently within the `flat_hash_set`.
+  using Base::size;
+
+  // flat_hash_set::clear()
+  //
+  // Removes all elements from the `flat_hash_set`. Invalidates any references,
+  // pointers, or iterators referring to contained elements.
+  //
+  // NOTE: this operation may shrink the underlying buffer. To avoid shrinking
+  // the underlying buffer call `erase(begin(), end())`.
+  using Base::clear;
+
+  // flat_hash_set::erase()
+  //
+  // Erases elements within the `flat_hash_set`. Erasing does not trigger a
+  // rehash. Overloads are listed below.
+  //
+  // void erase(const_iterator pos):
+  //
+  //   Erases the element at `position` of the `flat_hash_set`, returning
+  //   `void`.
+  //
+  //   NOTE: returning `void` in this case is different than that of STL
+  //   containers in general and `std::unordered_set` in particular (which
+  //   return an iterator to the element following the erased element). If that
+  //   iterator is needed, simply post increment the iterator:
+  //
+  //     set.erase(it++);
+  //
+  // iterator erase(const_iterator first, const_iterator last):
+  //
+  //   Erases the elements in the open interval [`first`, `last`), returning an
+  //   iterator pointing to `last`.
+  //
+  // size_type erase(const key_type& key):
+  //
+  //   Erases the element with the matching key, if it exists.
+  using Base::erase;
+
+  // flat_hash_set::insert()
+  //
+  // Inserts an element of the specified value into the `flat_hash_set`,
+  // returning an iterator pointing to the newly inserted element, provided that
+  // an element with the given key does not already exist. If rehashing occurs
+  // due to the insertion, all iterators are invalidated. Overloads are listed
+  // below.
+  //
+  // std::pair<iterator,bool> insert(const T& value):
+  //
+  //   Inserts a value into the `flat_hash_set`. Returns a pair consisting of an
+  //   iterator to the inserted element (or to the element that prevented the
+  //   insertion) and a bool denoting whether the insertion took place.
+  //
+  // std::pair<iterator,bool> insert(T&& value):
+  //
+  //   Inserts a moveable value into the `flat_hash_set`. Returns a pair
+  //   consisting of an iterator to the inserted element (or to the element that
+  //   prevented the insertion) and a bool denoting whether the insertion took
+  //   place.
+  //
+  // iterator insert(const_iterator hint, const T& value):
+  // iterator insert(const_iterator hint, T&& value):
+  //
+  //   Inserts a value, using the position of `hint` as a non-binding suggestion
+  //   for where to begin the insertion search. Returns an iterator to the
+  //   inserted element, or to the existing element that prevented the
+  //   insertion.
+  //
+  // void insert(InputIterator first, InputIterator last):
+  //
+  //   Inserts a range of values [`first`, `last`).
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently, for `flat_hash_set` we guarantee the
+  //   first match is inserted.
+  //
+  // void insert(std::initializer_list<T> ilist):
+  //
+  //   Inserts the elements within the initializer list `ilist`.
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently within the initializer list, for
+  //   `flat_hash_set` we guarantee the first match is inserted.
+  using Base::insert;
+
+  // flat_hash_set::emplace()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `flat_hash_set`, provided that no element with the given key
+  // already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace;
+
+  // flat_hash_set::emplace_hint()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `flat_hash_set`, using the position of `hint` as a non-binding
+  // suggestion for where to begin the insertion search, and only inserts
+  // provided that no element with the given key already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace_hint;
+
+  // flat_hash_set::extract()
+  //
+  // Extracts the indicated element, erasing it in the process, and returns it
+  // as a C++17-compatible node handle. Overloads are listed below.
+  //
+  // node_type extract(const_iterator position):
+  //
+  //   Extracts the element at the indicated position and returns a node handle
+  //   owning that extracted data.
+  //
+  // node_type extract(const key_type& x):
+  //
+  //   Extracts the element with the key matching the passed key value and
+  //   returns a node handle owning that extracted data. If the `flat_hash_set`
+  //   does not contain an element with a matching key, this function returns an
+  //   empty node handle.
+  using Base::extract;
+
+  // flat_hash_set::merge()
+  //
+  // Extracts elements from a given `source` flat hash map into this
+  // `flat_hash_set`. If the destination `flat_hash_set` already contains an
+  // element with an equivalent key, that element is not extracted.
+  using Base::merge;
+
+  // flat_hash_set::swap(flat_hash_set& other)
+  //
+  // Exchanges the contents of this `flat_hash_set` with those of the `other`
+  // flat hash map, avoiding invocation of any move, copy, or swap operations on
+  // individual elements.
+  //
+  // All iterators and references on the `flat_hash_set` remain valid, excepting
+  // for the past-the-end iterator, which is invalidated.
+  //
+  // `swap()` requires that the flat hash set's hashing and key equivalence
+  // functions be Swappable, and are exchaged using unqualified calls to
+  // non-member `swap()`. If the map's allocator has
+  // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value`
+  // set to `true`, the allocators are also exchanged using an unqualified call
+  // to non-member `swap()`; otherwise, the allocators are not swapped.
+  using Base::swap;
+
+  // flat_hash_set::rehash(count)
+  //
+  // Rehashes the `flat_hash_set`, setting the number of slots to be at least
+  // the passed value. If the new number of slots increases the load factor more
+  // than the current maximum load factor
+  // (`count` < `size()` / `max_load_factor()`), then the new number of slots
+  // will be at least `size()` / `max_load_factor()`.
+  //
+  // To force a rehash, pass rehash(0).
+  //
+  // NOTE: unlike behavior in `std::unordered_set`, references are also
+  // invalidated upon a `rehash()`.
+  using Base::rehash;
+
+  // flat_hash_set::reserve(count)
+  //
+  // Sets the number of slots in the `flat_hash_set` to the number needed to
+  // accommodate at least `count` total elements without exceeding the current
+  // maximum load factor, and may rehash the container if needed.
+  using Base::reserve;
+
+  // flat_hash_set::contains()
+  //
+  // Determines whether an element comparing equal to the given `key` exists
+  // within the `flat_hash_set`, returning `true` if so or `false` otherwise.
+  using Base::contains;
+
+  // flat_hash_set::count(const Key& key) const
+  //
+  // Returns the number of elements comparing equal to the given `key` within
+  // the `flat_hash_set`. note that this function will return either `1` or `0`
+  // since duplicate elements are not allowed within a `flat_hash_set`.
+  using Base::count;
+
+  // flat_hash_set::equal_range()
+  //
+  // Returns a closed range [first, last], defined by a `std::pair` of two
+  // iterators, containing all elements with the passed key in the
+  // `flat_hash_set`.
+  using Base::equal_range;
+
+  // flat_hash_set::find()
+  //
+  // Finds an element with the passed `key` within the `flat_hash_set`.
+  using Base::find;
+
+  // flat_hash_set::bucket_count()
+  //
+  // Returns the number of "buckets" within the `flat_hash_set`. Note that
+  // because a flat hash map contains all elements within its internal storage,
+  // this value simply equals the current capacity of the `flat_hash_set`.
+  using Base::bucket_count;
+
+  // flat_hash_set::load_factor()
+  //
+  // Returns the current load factor of the `flat_hash_set` (the average number
+  // of slots occupied with a value within the hash map).
+  using Base::load_factor;
+
+  // flat_hash_set::max_load_factor()
+  //
+  // Manages the maximum load factor of the `flat_hash_set`. Overloads are
+  // listed below.
+  //
+  // float flat_hash_set::max_load_factor()
+  //
+  //   Returns the current maximum load factor of the `flat_hash_set`.
+  //
+  // void flat_hash_set::max_load_factor(float ml)
+  //
+  //   Sets the maximum load factor of the `flat_hash_set` to the passed value.
+  //
+  //   NOTE: This overload is provided only for API compatibility with the STL;
+  //   `flat_hash_set` will ignore any set load factor and manage its rehashing
+  //   internally as an implementation detail.
+  using Base::max_load_factor;
+
+  // flat_hash_set::get_allocator()
+  //
+  // Returns the allocator function associated with this `flat_hash_set`.
+  using Base::get_allocator;
+
+  // flat_hash_set::hash_function()
+  //
+  // Returns the hashing function used to hash the keys within this
+  // `flat_hash_set`.
+  using Base::hash_function;
+
+  // flat_hash_set::key_eq()
+  //
+  // Returns the function used for comparing keys equality.
+  using Base::key_eq;
+};
+
+namespace container_internal {
+
+template <class T>
+struct FlatHashSetPolicy {
+  using slot_type = T;
+  using key_type = T;
+  using init_type = T;
+  using constant_iterators = std::true_type;
+
+  template <class Allocator, class... Args>
+  static void construct(Allocator* alloc, slot_type* slot, Args&&... args) {
+    absl::allocator_traits<Allocator>::construct(*alloc, slot,
+                                                 std::forward<Args>(args)...);
+  }
+
+  template <class Allocator>
+  static void destroy(Allocator* alloc, slot_type* slot) {
+    absl::allocator_traits<Allocator>::destroy(*alloc, slot);
+  }
+
+  template <class Allocator>
+  static void transfer(Allocator* alloc, slot_type* new_slot,
+                       slot_type* old_slot) {
+    construct(alloc, new_slot, std::move(*old_slot));
+    destroy(alloc, old_slot);
+  }
+
+  static T& element(slot_type* slot) { return *slot; }
+
+  template <class F, class... Args>
+  static decltype(absl::container_internal::DecomposeValue(
+      std::declval<F>(), std::declval<Args>()...))
+  apply(F&& f, Args&&... args) {
+    return absl::container_internal::DecomposeValue(
+        std::forward<F>(f), std::forward<Args>(args)...);
+  }
+
+  static size_t space_used(const T*) { return 0; }
+};
+}  // namespace container_internal
+
+namespace container_algorithm_internal {
+
+// Specialization of trait in absl/algorithm/container.h
+template <class Key, class Hash, class KeyEqual, class Allocator>
+struct IsUnorderedContainer<absl::flat_hash_set<Key, Hash, KeyEqual, Allocator>>
+    : std::true_type {};
+
+}  // namespace container_algorithm_internal
+
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_FLAT_HASH_SET_H_
index f060f5c..7552723 100644 (file)
@@ -1,10 +1,10 @@
-// Copyright 2017 The Abseil Authors.
+// Copyright 2019 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // vector" which behaves in an equivalent fashion to a `std::vector`, except
 // that storage for small sequences of the vector are provided inline without
 // requiring any heap allocation.
-
-// An `absl::InlinedVector<T,N>` specifies the size N at which to inline as one
-// of its template parameters. Vectors of length <= N are provided inline.
-// Typically N is very small (e.g., 4) so that sequences that are expected to be
-// short do not require allocations.
-
-// An `absl::InlinedVector` does not usually require a specific allocator; if
+//
+// An `absl::InlinedVector<T, N>` specifies the default capacity `N` as one of
+// its template parameters. Instances where `size() <= N` hold contained
+// elements in inline space. Typically `N` is very small so that sequences that
+// are expected to be short do not require allocations.
+//
+// An `absl::InlinedVector` does not usually require a specific allocator. If
 // the inlined vector grows beyond its initial constraints, it will need to
-// allocate (as any normal `std::vector` would) and it will generally use the
-// default allocator in that case; optionally, a custom allocator may be
-// specified using an `absl::InlinedVector<T,N,A>` construction.
+// allocate (as any normal `std::vector` would). This is usually performed with
+// the default allocator (defined as `std::allocator<T>`). Optionally, a custom
+// allocator type may be specified as `A` in `absl::InlinedVector<T, N, A>`.
 
 #ifndef ABSL_CONTAINER_INLINED_VECTOR_H_
 #define ABSL_CONTAINER_INLINED_VECTOR_H_
 #include "absl/base/internal/throw_delegate.h"
 #include "absl/base/optimization.h"
 #include "absl/base/port.h"
+#include "absl/container/internal/inlined_vector.h"
 #include "absl/memory/memory.h"
 
 namespace absl {
-
 // -----------------------------------------------------------------------------
 // InlinedVector
 // -----------------------------------------------------------------------------
@@ -61,1268 +61,902 @@ namespace absl {
 // An `absl::InlinedVector` is designed to be a drop-in replacement for
 // `std::vector` for use cases where the vector's size is sufficiently small
 // that it can be inlined. If the inlined vector does grow beyond its estimated
-// size, it will trigger an initial allocation on the heap, and will behave as a
-// `std:vector`. The API of the `absl::InlinedVector` within this file is
+// capacity, it will trigger an initial allocation on the heap, and will behave
+// as a `std:vector`. The API of the `absl::InlinedVector` within this file is
 // designed to cover the same API footprint as covered by `std::vector`.
-template <typename T, size_t N, typename A = std::allocator<T> >
+template <typename T, size_t N, typename A = std::allocator<T>>
 class InlinedVector {
-  using AllocatorTraits = std::allocator_traits<A>;
+  static_assert(
+      N > 0, "InlinedVector cannot be instantiated with `0` inlined elements.");
 
- public:
-  using allocator_type = A;
-  using value_type = typename allocator_type::value_type;
-  using pointer = typename allocator_type::pointer;
-  using const_pointer = typename allocator_type::const_pointer;
-  using reference = typename allocator_type::reference;
-  using const_reference = typename allocator_type::const_reference;
-  using size_type = typename allocator_type::size_type;
-  using difference_type = typename allocator_type::difference_type;
-  using iterator = pointer;
-  using const_iterator = const_pointer;
-  using reverse_iterator = std::reverse_iterator<iterator>;
-  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-  InlinedVector() noexcept(noexcept(allocator_type()))
-      : allocator_and_tag_(allocator_type()) {}
+  using Storage = inlined_vector_internal::Storage<T, N, A>;
+  using rvalue_reference = typename Storage::rvalue_reference;
+  using MoveIterator = typename Storage::MoveIterator;
+  using AllocatorTraits = typename Storage::AllocatorTraits;
+  using IsMemcpyOk = typename Storage::IsMemcpyOk;
+
+  template <typename Iterator>
+  using IteratorValueAdapter =
+      typename Storage::template IteratorValueAdapter<Iterator>;
+  using CopyValueAdapter = typename Storage::CopyValueAdapter;
+  using DefaultValueAdapter = typename Storage::DefaultValueAdapter;
+
+  template <typename Iterator>
+  using EnableIfAtLeastForwardIterator = absl::enable_if_t<
+      inlined_vector_internal::IsAtLeastForwardIterator<Iterator>::value>;
 
+  template <typename Iterator>
+  using DisableIfAtLeastForwardIterator = absl::enable_if_t<
+      !inlined_vector_internal::IsAtLeastForwardIterator<Iterator>::value>;
+
+ public:
+  using allocator_type = typename Storage::allocator_type;
+  using value_type = typename Storage::value_type;
+  using pointer = typename Storage::pointer;
+  using const_pointer = typename Storage::const_pointer;
+  using reference = typename Storage::reference;
+  using const_reference = typename Storage::const_reference;
+  using size_type = typename Storage::size_type;
+  using difference_type = typename Storage::difference_type;
+  using iterator = typename Storage::iterator;
+  using const_iterator = typename Storage::const_iterator;
+  using reverse_iterator = typename Storage::reverse_iterator;
+  using const_reverse_iterator = typename Storage::const_reverse_iterator;
+
+  // ---------------------------------------------------------------------------
+  // InlinedVector Constructors and Destructor
+  // ---------------------------------------------------------------------------
+
+  // Creates an empty inlined vector with a value-initialized allocator.
+  InlinedVector() noexcept(noexcept(allocator_type())) : storage_() {}
+
+  // Creates an empty inlined vector with a specified allocator.
   explicit InlinedVector(const allocator_type& alloc) noexcept
-      : allocator_and_tag_(alloc) {}
+      : storage_(alloc) {}
 
-  // Create a vector with n copies of value_type().
-  explicit InlinedVector(size_type n) : allocator_and_tag_(allocator_type()) {
-    InitAssign(n);
+  // Creates an inlined vector with `n` copies of `value_type()`.
+  explicit InlinedVector(size_type n,
+                         const allocator_type& alloc = allocator_type())
+      : storage_(alloc) {
+    storage_.Initialize(DefaultValueAdapter(), n);
   }
 
-  // Create a vector with n copies of elem
-  InlinedVector(size_type n, const value_type& elem,
+  // Creates an inlined vector with `n` copies of `v`.
+  InlinedVector(size_type n, const_reference v,
                 const allocator_type& alloc = allocator_type())
-      : allocator_and_tag_(alloc) {
-    InitAssign(n, elem);
+      : storage_(alloc) {
+    storage_.Initialize(CopyValueAdapter(v), n);
   }
 
-  // Create and initialize with the elements [first .. last).
-  // The unused enable_if argument restricts this constructor so that it is
-  // elided when value_type is an integral type.  This prevents ambiguous
-  // interpretation between a call to this constructor with two integral
-  // arguments and a call to the preceding (n, elem) constructor.
-  template <typename InputIterator>
-  InlinedVector(
-      InputIterator first, InputIterator last,
-      const allocator_type& alloc = allocator_type(),
-      typename std::enable_if<!std::is_integral<InputIterator>::value>::type* =
-          nullptr)
-      : allocator_and_tag_(alloc) {
-    AppendRange(first, last);
+  // Creates an inlined vector of copies of the values in `list`.
+  InlinedVector(std::initializer_list<value_type> list,
+                const allocator_type& alloc = allocator_type())
+      : InlinedVector(list.begin(), list.end(), alloc) {}
+
+  // Creates an inlined vector with elements constructed from the provided
+  // forward iterator range [`first`, `last`).
+  //
+  // NOTE: The `enable_if` prevents ambiguous interpretation between a call to
+  // this constructor with two integral arguments and a call to the above
+  // `InlinedVector(size_type, const_reference)` constructor.
+  template <typename ForwardIterator,
+            EnableIfAtLeastForwardIterator<ForwardIterator>* = nullptr>
+  InlinedVector(ForwardIterator first, ForwardIterator last,
+                const allocator_type& alloc = allocator_type())
+      : storage_(alloc) {
+    storage_.Initialize(IteratorValueAdapter<ForwardIterator>(first),
+                        std::distance(first, last));
   }
 
-  InlinedVector(std::initializer_list<value_type> init,
+  // Creates an inlined vector with elements constructed from the provided input
+  // iterator range [`first`, `last`).
+  template <typename InputIterator,
+            DisableIfAtLeastForwardIterator<InputIterator>* = nullptr>
+  InlinedVector(InputIterator first, InputIterator last,
                 const allocator_type& alloc = allocator_type())
-      : allocator_and_tag_(alloc) {
-    AppendRange(init.begin(), init.end());
+      : storage_(alloc) {
+    std::copy(first, last, std::back_inserter(*this));
   }
 
-  InlinedVector(const InlinedVector& v);
-  InlinedVector(const InlinedVector& v, const allocator_type& alloc);
+  // Creates a copy of an `other` inlined vector using `other`'s allocator.
+  InlinedVector(const InlinedVector& other)
+      : InlinedVector(other, *other.storage_.GetAllocPtr()) {}
 
-  InlinedVector(InlinedVector&& v) noexcept(
-      absl::allocator_is_nothrow<allocator_type>::value ||
-      std::is_nothrow_move_constructible<value_type>::value);
-  InlinedVector(InlinedVector&& v, const allocator_type& alloc) noexcept(
-      absl::allocator_is_nothrow<allocator_type>::value);
-
-  ~InlinedVector() { clear(); }
-
-  InlinedVector& operator=(const InlinedVector& v) {
-    // Optimized to avoid reallocation.
-    // Prefer reassignment to copy construction for elements.
-    if (size() < v.size()) {  // grow
-      reserve(v.size());
-      std::copy(v.begin(), v.begin() + size(), begin());
-      std::copy(v.begin() + size(), v.end(), std::back_inserter(*this));
-    } else {  // maybe shrink
-      erase(begin() + v.size(), end());
-      std::copy(v.begin(), v.end(), begin());
+  // Creates a copy of an `other` inlined vector using a specified allocator.
+  InlinedVector(const InlinedVector& other, const allocator_type& alloc)
+      : storage_(alloc) {
+    if (IsMemcpyOk::value && !other.storage_.GetIsAllocated()) {
+      storage_.MemcpyFrom(other.storage_);
+    } else {
+      storage_.Initialize(IteratorValueAdapter<const_pointer>(other.data()),
+                          other.size());
     }
-    return *this;
   }
 
-  InlinedVector& operator=(InlinedVector&& v) {
-    if (this == &v) {
-      return *this;
-    }
-    if (v.allocated()) {
-      clear();
-      tag().set_allocated_size(v.size());
-      init_allocation(v.allocation());
-      v.tag() = Tag();
+  // Creates an inlined vector by moving in the contents of an `other` inlined
+  // vector without performing any allocations. If `other` contains allocated
+  // memory, the newly-created instance will take ownership of that memory
+  // (leaving `other` empty). However, if `other` does not contain allocated
+  // memory (i.e. is inlined), the new inlined vector will perform element-wise
+  // move construction of `other`'s elements.
+  //
+  // NOTE: since no allocation is performed for the inlined vector in either
+  // case, the `noexcept(...)` specification depends on whether moving the
+  // underlying objects can throw. We assume:
+  //  a) Move constructors should only throw due to allocation failure.
+  //  b) If `value_type`'s move constructor allocates, it uses the same
+  //     allocation function as the `InlinedVector`'s allocator. Thus, the move
+  //     constructor is non-throwing if the allocator is non-throwing or
+  //     `value_type`'s move constructor is specified as `noexcept`.
+  InlinedVector(InlinedVector&& other) noexcept(
+      absl::allocator_is_nothrow<allocator_type>::value ||
+      std::is_nothrow_move_constructible<value_type>::value)
+      : storage_(*other.storage_.GetAllocPtr()) {
+    if (IsMemcpyOk::value) {
+      storage_.MemcpyFrom(other.storage_);
+      other.storage_.SetInlinedSize(0);
+    } else if (other.storage_.GetIsAllocated()) {
+      storage_.SetAllocatedData(other.storage_.GetAllocatedData(),
+                                other.storage_.GetAllocatedCapacity());
+      storage_.SetAllocatedSize(other.storage_.GetSize());
+      other.storage_.SetInlinedSize(0);
     } else {
-      if (allocated()) clear();
-      // Both are inlined now.
-      if (size() < v.size()) {
-        auto mid = std::make_move_iterator(v.begin() + size());
-        std::copy(std::make_move_iterator(v.begin()), mid, begin());
-        UninitializedCopy(mid, std::make_move_iterator(v.end()), end());
-      } else {
-        auto new_end = std::copy(std::make_move_iterator(v.begin()),
-                                 std::make_move_iterator(v.end()), begin());
-        Destroy(new_end, end());
-      }
-      tag().set_inline_size(v.size());
+      IteratorValueAdapter<MoveIterator> other_values(
+          MoveIterator(other.storage_.GetInlinedData()));
+      inlined_vector_internal::ConstructElements(
+          storage_.GetAllocPtr(), storage_.GetInlinedData(), &other_values,
+          other.storage_.GetSize());
+      storage_.SetInlinedSize(other.storage_.GetSize());
     }
-    return *this;
-  }
-
-  InlinedVector& operator=(std::initializer_list<value_type> init) {
-    AssignRange(init.begin(), init.end());
-    return *this;
   }
 
-  // InlinedVector::assign()
+  // Creates an inlined vector by moving in the contents of an `other` inlined
+  // vector, performing allocations with the specified `alloc` allocator. If
+  // `other`'s allocator is not equal to `alloc` and `other` contains allocated
+  // memory, this move constructor will create a new allocation.
   //
-  // Replaces the contents of the inlined vector with copies of those in the
-  // iterator range [first, last).
-  template <typename InputIterator>
-  void assign(
-      InputIterator first, InputIterator last,
-      typename std::enable_if<!std::is_integral<InputIterator>::value>::type* =
-          nullptr) {
-    AssignRange(first, last);
-  }
-
-  // Overload of `InlinedVector::assign()` to take values from elements of an
-  // initializer list
-  void assign(std::initializer_list<value_type> init) {
-    AssignRange(init.begin(), init.end());
-  }
-
-  // Overload of `InlinedVector::assign()` to replace the first `n` elements of
-  // the inlined vector with `elem` values.
-  void assign(size_type n, const value_type& elem) {
-    if (n <= size()) {  // Possibly shrink
-      std::fill_n(begin(), n, elem);
-      erase(begin() + n, end());
-      return;
-    }
-    // Grow
-    reserve(n);
-    std::fill_n(begin(), size(), elem);
-    if (allocated()) {
-      UninitializedFill(allocated_space() + size(), allocated_space() + n,
-                        elem);
-      tag().set_allocated_size(n);
+  // NOTE: since allocation is performed in this case, this constructor can
+  // only be `noexcept` if the specified allocator is also `noexcept`. If this
+  // is the case, or if `other` contains allocated memory, this constructor
+  // performs element-wise move construction of its contents.
+  //
+  // Only in the case where `other`'s allocator is equal to `alloc` and `other`
+  // contains allocated memory will the newly created inlined vector take
+  // ownership of `other`'s allocated memory.
+  InlinedVector(InlinedVector&& other, const allocator_type& alloc) noexcept(
+      absl::allocator_is_nothrow<allocator_type>::value)
+      : storage_(alloc) {
+    if (IsMemcpyOk::value) {
+      storage_.MemcpyFrom(other.storage_);
+      other.storage_.SetInlinedSize(0);
+    } else if ((*storage_.GetAllocPtr() == *other.storage_.GetAllocPtr()) &&
+               other.storage_.GetIsAllocated()) {
+      storage_.SetAllocatedData(other.storage_.GetAllocatedData(),
+                                other.storage_.GetAllocatedCapacity());
+      storage_.SetAllocatedSize(other.storage_.GetSize());
+      other.storage_.SetInlinedSize(0);
     } else {
-      UninitializedFill(inlined_space() + size(), inlined_space() + n, elem);
-      tag().set_inline_size(n);
+      storage_.Initialize(
+          IteratorValueAdapter<MoveIterator>(MoveIterator(other.data())),
+          other.size());
     }
   }
 
-  // InlinedVector::size()
-  //
-  // Returns the number of elements in the inlined vector.
-  size_type size() const noexcept { return tag().size(); }
+  ~InlinedVector() {}
 
-  // InlinedVector::empty()
+  // ---------------------------------------------------------------------------
+  // InlinedVector Member Accessors
+  // ---------------------------------------------------------------------------
+
+  // `InlinedVector::empty()`
   //
   // Checks if the inlined vector has no elements.
-  bool empty() const noexcept { return (size() == 0); }
+  bool empty() const noexcept { return !size(); }
 
-  // InlinedVector::capacity()
+  // `InlinedVector::size()`
   //
-  // Returns the number of elements that can be stored in an inlined vector
-  // without requiring a reallocation of underlying memory. Note that for
-  // most inlined vectors, `capacity()` should equal its initial size `N`; for
-  // inlined vectors which exceed this capacity, they will no longer be inlined,
-  // and `capacity()` will equal its capacity on the allocated heap.
-  size_type capacity() const noexcept {
-    return allocated() ? allocation().capacity() : N;
-  }
+  // Returns the number of elements in the inlined vector.
+  size_type size() const noexcept { return storage_.GetSize(); }
 
-  // InlinedVector::max_size()
+  // `InlinedVector::max_size()`
   //
   // Returns the maximum number of elements the vector can hold.
   size_type max_size() const noexcept {
     // One bit of the size storage is used to indicate whether the inlined
-    // vector is allocated; as a result, the maximum size of the container that
-    // we can express is half of the max for our size type.
-    return std::numeric_limits<size_type>::max() / 2;
+    // vector is allocated. As a result, the maximum size of the container that
+    // we can express is half of the max for `size_type`.
+    return (std::numeric_limits<size_type>::max)() / 2;
   }
 
-  // InlinedVector::data()
+  // `InlinedVector::capacity()`
   //
-  // Returns a const T* pointer to elements of the inlined vector. This pointer
-  // can be used to access (but not modify) the contained elements.
-  // Only results within the range `[0,size())` are defined.
-  const_pointer data() const noexcept {
-    return allocated() ? allocated_space() : inlined_space();
+  // Returns the number of elements that can be stored in the inlined vector
+  // without requiring a reallocation of underlying memory.
+  //
+  // NOTE: For most inlined vectors, `capacity()` should equal the template
+  // parameter `N`. For inlined vectors which exceed this capacity, they
+  // will no longer be inlined and `capacity()` will equal its capacity on the
+  // allocated heap.
+  size_type capacity() const noexcept {
+    return storage_.GetIsAllocated() ? storage_.GetAllocatedCapacity()
+                                     : static_cast<size_type>(N);
   }
 
-  // Overload of InlinedVector::data() to return a T* pointer to elements of the
-  // inlined vector. This pointer can be used to access and modify the contained
-  // elements.
+  // `InlinedVector::data()`
+  //
+  // Returns a `pointer` to elements of the inlined vector. This pointer can be
+  // used to access and modify the contained elements.
+  // Only results within the range [`0`, `size()`) are defined.
   pointer data() noexcept {
-    return allocated() ? allocated_space() : inlined_space();
+    return storage_.GetIsAllocated() ? storage_.GetAllocatedData()
+                                     : storage_.GetInlinedData();
   }
 
-  // InlinedVector::clear()
-  //
-  // Removes all elements from the inlined vector.
-  void clear() noexcept {
-    size_type s = size();
-    if (allocated()) {
-      Destroy(allocated_space(), allocated_space() + s);
-      allocation().Dealloc(allocator());
-    } else if (s != 0) {  // do nothing for empty vectors
-      Destroy(inlined_space(), inlined_space() + s);
-    }
-    tag() = Tag();
+  // Overload of `InlinedVector::data()` to return a `const_pointer` to elements
+  // of the inlined vector. This pointer can be used to access (but not modify)
+  // the contained elements.
+  const_pointer data() const noexcept {
+    return storage_.GetIsAllocated() ? storage_.GetAllocatedData()
+                                     : storage_.GetInlinedData();
   }
 
-  // InlinedVector::at()
+  // `InlinedVector::operator[]()`
   //
-  // Returns the ith element of an inlined vector.
-  const value_type& at(size_type i) const {
-    if (ABSL_PREDICT_FALSE(i >= size())) {
-      base_internal::ThrowStdOutOfRange(
-          "InlinedVector::at failed bounds check");
-    }
+  // Returns a `reference` to the `i`th element of the inlined vector using the
+  // array operator.
+  reference operator[](size_type i) {
+    assert(i < size());
     return data()[i];
   }
 
-  // InlinedVector::operator[]
-  //
-  // Returns the ith element of an inlined vector using the array operator.
-  const value_type& operator[](size_type i) const {
+  // Overload of `InlinedVector::operator[]()` to return a `const_reference` to
+  // the `i`th element of the inlined vector.
+  const_reference operator[](size_type i) const {
     assert(i < size());
     return data()[i];
   }
 
-  // Overload of InlinedVector::at() to return the ith element of an inlined
-  // vector.
-  value_type& at(size_type i) {
-    if (i >= size()) {
+  // `InlinedVector::at()`
+  //
+  // Returns a `reference` to the `i`th element of the inlined vector.
+  reference at(size_type i) {
+    if (ABSL_PREDICT_FALSE(i >= size())) {
       base_internal::ThrowStdOutOfRange(
-          "InlinedVector::at failed bounds check");
+          "`InlinedVector::at(size_type)` failed bounds check");
     }
     return data()[i];
   }
 
-  // Overload of InlinedVector::operator[] to return the ith element of an
-  // inlined vector.
-  value_type& operator[](size_type i) {
-    assert(i < size());
+  // Overload of `InlinedVector::at()` to return a `const_reference` to the
+  // `i`th element of the inlined vector.
+  const_reference at(size_type i) const {
+    if (ABSL_PREDICT_FALSE(i >= size())) {
+      base_internal::ThrowStdOutOfRange(
+          "`InlinedVector::at(size_type) const` failed bounds check");
+    }
     return data()[i];
   }
 
-  // InlinedVector::back()
+  // `InlinedVector::front()`
   //
-  // Returns a reference to the last element of an inlined vector.
-  value_type& back() {
-    assert(!empty());
-    return at(size() - 1);
-  }
-
-  // Overload of InlinedVector::back() returns a reference to the last element
-  // of an inlined vector of const values.
-  const value_type& back() const {
-    assert(!empty());
-    return at(size() - 1);
-  }
-
-  // InlinedVector::front()
-  //
-  // Returns a reference to the first element of an inlined vector.
-  value_type& front() {
+  // Returns a `reference` to the first element of the inlined vector.
+  reference front() {
     assert(!empty());
     return at(0);
   }
 
-  // Overload of InlinedVector::front() returns a reference to the first element
-  // of an inlined vector of const values.
-  const value_type& front() const {
+  // Overload of `InlinedVector::front()` returns a `const_reference` to the
+  // first element of the inlined vector.
+  const_reference front() const {
     assert(!empty());
     return at(0);
   }
 
-  // InlinedVector::emplace_back()
+  // `InlinedVector::back()`
   //
-  // Constructs and appends an object to the inlined vector.
-  template <typename... Args>
-  void emplace_back(Args&&... args) {
-    size_type s = size();
-    assert(s <= capacity());
-    if (ABSL_PREDICT_FALSE(s == capacity())) {
-      GrowAndEmplaceBack(std::forward<Args>(args)...);
-      return;
-    }
-    assert(s < capacity());
-
-    value_type* space;
-    if (allocated()) {
-      tag().set_allocated_size(s + 1);
-      space = allocated_space();
-    } else {
-      tag().set_inline_size(s + 1);
-      space = inlined_space();
-    }
-    Construct(space + s, std::forward<Args>(args)...);
+  // Returns a `reference` to the last element of the inlined vector.
+  reference back() {
+    assert(!empty());
+    return at(size() - 1);
   }
 
-  // InlinedVector::push_back()
-  //
-  // Appends a const element to the inlined vector.
-  void push_back(const value_type& t) { emplace_back(t); }
-
-  // Overload of InlinedVector::push_back() to append a move-only element to the
-  // inlined vector.
-  void push_back(value_type&& t) { emplace_back(std::move(t)); }
-
-  // InlinedVector::pop_back()
-  //
-  // Removes the last element (which is destroyed) in the inlined vector.
-  void pop_back() {
+  // Overload of `InlinedVector::back()` to return a `const_reference` to the
+  // last element of the inlined vector.
+  const_reference back() const {
     assert(!empty());
-    size_type s = size();
-    if (allocated()) {
-      Destroy(allocated_space() + s - 1, allocated_space() + s);
-      tag().set_allocated_size(s - 1);
-    } else {
-      Destroy(inlined_space() + s - 1, inlined_space() + s);
-      tag().set_inline_size(s - 1);
-    }
+    return at(size() - 1);
   }
 
-  // InlinedVector::resize()
-  //
-  // Resizes the inlined vector to contain `n` elements. If `n` is smaller than
-  // the inlined vector's current size, extra elements are destroyed. If `n` is
-  // larger than the initial size, new elements are value-initialized.
-  void resize(size_type n);
-
-  // Overload of InlinedVector::resize() to resize the inlined vector to contain
-  // `n` elements. If `n` is larger than the current size, enough copies of
-  // `elem` are appended to increase its size to `n`.
-  void resize(size_type n, const value_type& elem);
-
-  // InlinedVector::begin()
+  // `InlinedVector::begin()`
   //
-  // Returns an iterator to the beginning of the inlined vector.
+  // Returns an `iterator` to the beginning of the inlined vector.
   iterator begin() noexcept { return data(); }
 
-  // Overload of InlinedVector::begin() for returning a const iterator to the
-  // beginning of the inlined vector.
+  // Overload of `InlinedVector::begin()` to return a `const_iterator` to
+  // the beginning of the inlined vector.
   const_iterator begin() const noexcept { return data(); }
 
-  // InlinedVector::cbegin()
-  //
-  // Returns a const iterator to the beginning of the inlined vector.
-  const_iterator cbegin() const noexcept { return begin(); }
-
-  // InlinedVector::end()
+  // `InlinedVector::end()`
   //
-  // Returns an iterator to the end of the inlined vector.
+  // Returns an `iterator` to the end of the inlined vector.
   iterator end() noexcept { return data() + size(); }
 
-  // Overload of InlinedVector::end() for returning a const iterator to the end
-  // of the inlined vector.
+  // Overload of `InlinedVector::end()` to return a `const_iterator` to the
+  // end of the inlined vector.
   const_iterator end() const noexcept { return data() + size(); }
 
-  // InlinedVector::cend()
+  // `InlinedVector::cbegin()`
   //
-  // Returns a const iterator to the end of the inlined vector.
+  // Returns a `const_iterator` to the beginning of the inlined vector.
+  const_iterator cbegin() const noexcept { return begin(); }
+
+  // `InlinedVector::cend()`
+  //
+  // Returns a `const_iterator` to the end of the inlined vector.
   const_iterator cend() const noexcept { return end(); }
 
-  // InlinedVector::rbegin()
+  // `InlinedVector::rbegin()`
   //
-  // Returns a reverse iterator from the end of the inlined vector.
+  // Returns a `reverse_iterator` from the end of the inlined vector.
   reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
 
-  // Overload of InlinedVector::rbegin() for returning a const reverse iterator
-  // from the end of the inlined vector.
+  // Overload of `InlinedVector::rbegin()` to return a
+  // `const_reverse_iterator` from the end of the inlined vector.
   const_reverse_iterator rbegin() const noexcept {
     return const_reverse_iterator(end());
   }
 
-  // InlinedVector::crbegin()
+  // `InlinedVector::rend()`
   //
-  // Returns a const reverse iterator from the end of the inlined vector.
-  const_reverse_iterator crbegin() const noexcept { return rbegin(); }
-
-  // InlinedVector::rend()
-  //
-  // Returns a reverse iterator from the beginning of the inlined vector.
+  // Returns a `reverse_iterator` from the beginning of the inlined vector.
   reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
 
-  // Overload of InlinedVector::rend() for returning a const reverse iterator
+  // Overload of `InlinedVector::rend()` to return a `const_reverse_iterator`
   // from the beginning of the inlined vector.
   const_reverse_iterator rend() const noexcept {
     return const_reverse_iterator(begin());
   }
 
-  // InlinedVector::crend()
+  // `InlinedVector::crbegin()`
   //
-  // Returns a reverse iterator from the beginning of the inlined vector.
+  // Returns a `const_reverse_iterator` from the end of the inlined vector.
+  const_reverse_iterator crbegin() const noexcept { return rbegin(); }
+
+  // `InlinedVector::crend()`
+  //
+  // Returns a `const_reverse_iterator` from the beginning of the inlined
+  // vector.
   const_reverse_iterator crend() const noexcept { return rend(); }
 
-  // InlinedVector::emplace()
+  // `InlinedVector::get_allocator()`
   //
-  // Constructs and inserts an object to the inlined vector at the given
-  // `position`, returning an iterator pointing to the newly emplaced element.
-  template <typename... Args>
-  iterator emplace(const_iterator position, Args&&... args);
+  // Returns a copy of the allocator of the inlined vector.
+  allocator_type get_allocator() const { return *storage_.GetAllocPtr(); }
+
+  // ---------------------------------------------------------------------------
+  // InlinedVector Member Mutators
+  // ---------------------------------------------------------------------------
 
-  // InlinedVector::insert()
+  // `InlinedVector::operator=()`
   //
-  // Inserts an element of the specified value at `position`, returning an
-  // iterator pointing to the newly inserted element.
-  iterator insert(const_iterator position, const value_type& v) {
-    return emplace(position, v);
+  // Replaces the contents of the inlined vector with copies of the elements in
+  // the provided `std::initializer_list`.
+  InlinedVector& operator=(std::initializer_list<value_type> list) {
+    assign(list.begin(), list.end());
+    return *this;
   }
 
-  // Overload of InlinedVector::insert() for inserting an element of the
-  // specified rvalue, returning an iterator pointing to the newly inserted
-  // element.
-  iterator insert(const_iterator position, value_type&& v) {
-    return emplace(position, std::move(v));
+  // Overload of `InlinedVector::operator=()` to replace the contents of the
+  // inlined vector with the contents of `other`.
+  InlinedVector& operator=(const InlinedVector& other) {
+    if (ABSL_PREDICT_TRUE(this != std::addressof(other))) {
+      const_pointer other_data = other.data();
+      assign(other_data, other_data + other.size());
+    }
+    return *this;
   }
 
-  // Overload of InlinedVector::insert() for inserting `n` elements of the
-  // specified value at `position`, returning an iterator pointing to the first
-  // of the newly inserted elements.
-  iterator insert(const_iterator position, size_type n, const value_type& v) {
-    return InsertWithCount(position, n, v);
+  // Overload of `InlinedVector::operator=()` to replace the contents of the
+  // inlined vector with the contents of `other`.
+  //
+  // NOTE: As a result of calling this overload, `other` may be empty or it's
+  // contents may be left in a moved-from state.
+  InlinedVector& operator=(InlinedVector&& other) {
+    if (ABSL_PREDICT_FALSE(this == std::addressof(other))) return *this;
+
+    if (IsMemcpyOk::value || other.storage_.GetIsAllocated()) {
+      inlined_vector_internal::DestroyElements(storage_.GetAllocPtr(), data(),
+                                               size());
+      storage_.DeallocateIfAllocated();
+      storage_.MemcpyFrom(other.storage_);
+      other.storage_.SetInlinedSize(0);
+    } else {
+      storage_.Assign(IteratorValueAdapter<MoveIterator>(
+                          MoveIterator(other.storage_.GetInlinedData())),
+                      other.size());
+    }
+
+    return *this;
   }
 
-  // Overload of `InlinedVector::insert()` to disambiguate the two
-  // three-argument overloads of `insert()`, returning an iterator pointing to
-  // the first of the newly inserted elements.
-  template <typename InputIterator,
-            typename = typename std::enable_if<std::is_convertible<
-                typename std::iterator_traits<InputIterator>::iterator_category,
-                std::input_iterator_tag>::value>::type>
-  iterator insert(const_iterator position, InputIterator first,
-                  InputIterator last) {
-    using IterType =
-        typename std::iterator_traits<InputIterator>::iterator_category;
-    return InsertWithRange(position, first, last, IterType());
+  // `InlinedVector::assign()`
+  //
+  // Replaces the contents of the inlined vector with `n` copies of `v`.
+  void assign(size_type n, const_reference v) {
+    storage_.Assign(CopyValueAdapter(v), n);
   }
 
-  // Overload of InlinedVector::insert() for inserting a list of elements at
-  // `position`, returning an iterator pointing to the first of the newly
-  // inserted elements.
-  iterator insert(const_iterator position,
-                  std::initializer_list<value_type> init) {
-    return insert(position, init.begin(), init.end());
+  // Overload of `InlinedVector::assign()` to replace the contents of the
+  // inlined vector with copies of the values in the provided
+  // `std::initializer_list`.
+  void assign(std::initializer_list<value_type> list) {
+    assign(list.begin(), list.end());
   }
 
-  // InlinedVector::erase()
-  //
-  // Erases the element at `position` of the inlined vector, returning an
-  // iterator pointing to the following element or the container's end if the
-  // last element was erased.
-  iterator erase(const_iterator position) {
-    assert(position >= begin());
-    assert(position < end());
-
-    iterator pos = const_cast<iterator>(position);
-    std::move(pos + 1, end(), pos);
-    pop_back();
-    return pos;
+  // Overload of `InlinedVector::assign()` to replace the contents of the
+  // inlined vector with the forward iterator range [`first`, `last`).
+  template <typename ForwardIterator,
+            EnableIfAtLeastForwardIterator<ForwardIterator>* = nullptr>
+  void assign(ForwardIterator first, ForwardIterator last) {
+    storage_.Assign(IteratorValueAdapter<ForwardIterator>(first),
+                    std::distance(first, last));
   }
 
-  // Overload of InlinedVector::erase() for erasing all elements in the
-  // iteraror range [first, last) in the inlined vector, returning an iterator
-  // pointing to the first element following the range erased, or the
-  // container's end if range included the container's last element.
-  iterator erase(const_iterator first, const_iterator last);
+  // Overload of `InlinedVector::assign()` to replace the contents of the
+  // inlined vector with the input iterator range [`first`, `last`).
+  template <typename InputIterator,
+            DisableIfAtLeastForwardIterator<InputIterator>* = nullptr>
+  void assign(InputIterator first, InputIterator last) {
+    size_type i = 0;
+    for (; i < size() && first != last; ++i, static_cast<void>(++first)) {
+      at(i) = *first;
+    }
+
+    erase(data() + i, data() + size());
+
+    std::copy(first, last, std::back_inserter(*this));
+  }
 
-  // InlinedVector::reserve()
+  // `InlinedVector::resize()`
   //
-  // Enlarges the underlying representation of the inlined vector so it can hold
-  // at least `n` elements. This method does not change `size()` or the actual
-  // contents of the vector.
+  // Resizes the inlined vector to contain `n` elements. If `n` is smaller than
+  // the inlined vector's current size, extra elements are destroyed. If `n` is
+  // larger than the initial size, new elements are value-initialized.
+  void resize(size_type n) { storage_.Resize(DefaultValueAdapter(), n); }
+
+  // Overload of `InlinedVector::resize()` to resize the inlined vector to
+  // contain `n` elements where, if `n` is larger than `size()`, the new values
+  // will be copy-constructed from `v`.
+  void resize(size_type n, const_reference v) {
+    storage_.Resize(CopyValueAdapter(v), n);
+  }
+
+  // `InlinedVector::insert()`
   //
-  // Note that if `n` does not exceed the inlined vector's initial size `N`,
-  // `reserve()` will have no effect; if it does exceed its initial size,
-  // `reserve()` will trigger an initial allocation and move the inlined vector
-  // onto the heap. If the vector already exists on the heap and the requested
-  // size exceeds it, a reallocation will be performed.
-  void reserve(size_type n) {
-    if (n > capacity()) {
-      // Make room for new elements
-      EnlargeBy(n - size());
+  // Copies `v` into `pos`, returning an `iterator` pointing to the newly
+  // inserted element.
+  iterator insert(const_iterator pos, const_reference v) {
+    return emplace(pos, v);
+  }
+
+  // Overload of `InlinedVector::insert()` for moving `v` into `pos`, returning
+  // an iterator pointing to the newly inserted element.
+  iterator insert(const_iterator pos, rvalue_reference v) {
+    return emplace(pos, std::move(v));
+  }
+
+  // Overload of `InlinedVector::insert()` for inserting `n` contiguous copies
+  // of `v` starting at `pos`. Returns an `iterator` pointing to the first of
+  // the newly inserted elements.
+  iterator insert(const_iterator pos, size_type n, const_reference v) {
+    assert(pos >= begin() && pos <= end());
+    if (ABSL_PREDICT_FALSE(n == 0)) {
+      return const_cast<iterator>(pos);
     }
+    value_type copy = v;
+    std::pair<iterator, iterator> it_pair = ShiftRight(pos, n);
+    std::fill(it_pair.first, it_pair.second, copy);
+    UninitializedFill(it_pair.second, it_pair.first + n, copy);
+    return it_pair.first;
   }
 
-  // InlinedVector::swap()
-  //
-  // Swaps the contents of this inlined vector with the contents of `other`.
-  void swap(InlinedVector& other);
+  // Overload of `InlinedVector::insert()` for copying the contents of the
+  // `std::initializer_list` into the vector starting at `pos`. Returns an
+  // `iterator` pointing to the first of the newly inserted elements.
+  iterator insert(const_iterator pos, std::initializer_list<value_type> list) {
+    return insert(pos, list.begin(), list.end());
+  }
 
-  // InlinedVector::get_allocator()
+  // Overload of `InlinedVector::insert()` for inserting elements constructed
+  // from the forward iterator range [`first`, `last`). Returns an `iterator`
+  // pointing to the first of the newly inserted elements.
   //
-  // Returns the allocator of this inlined vector.
-  allocator_type get_allocator() const { return allocator(); }
-
- private:
-  static_assert(N > 0, "inlined vector with nonpositive size");
-
-  // It holds whether the vector is allocated or not in the lowest bit.
-  // The size is held in the high bits:
-  //   size_ = (size << 1) | is_allocated;
-  class Tag {
-   public:
-    Tag() : size_(0) {}
-    size_type size() const { return size_ >> 1; }
-    void add_size(size_type n) { size_ += n << 1; }
-    void set_inline_size(size_type n) { size_ = n << 1; }
-    void set_allocated_size(size_type n) { size_ = (n << 1) | 1; }
-    bool allocated() const { return size_ & 1; }
-
-   private:
-    size_type size_;
-  };
-
-  // Derives from allocator_type to use the empty base class optimization.
-  // If the allocator_type is stateless, we can 'store'
-  // our instance of it for free.
-  class AllocatorAndTag : private allocator_type {
-   public:
-    explicit AllocatorAndTag(const allocator_type& a, Tag t = Tag())
-        : allocator_type(a), tag_(t) {
+  // NOTE: The `enable_if` is intended to disambiguate the two three-argument
+  // overloads of `insert()`.
+  template <typename ForwardIterator,
+            EnableIfAtLeastForwardIterator<ForwardIterator>* = nullptr>
+  iterator insert(const_iterator pos, ForwardIterator first,
+                  ForwardIterator last) {
+    assert(pos >= begin() && pos <= end());
+    if (ABSL_PREDICT_FALSE(first == last)) {
+      return const_cast<iterator>(pos);
     }
-    Tag& tag() { return tag_; }
-    const Tag& tag() const { return tag_; }
-    allocator_type& allocator() { return *this; }
-    const allocator_type& allocator() const { return *this; }
-   private:
-    Tag tag_;
-  };
-
-  class Allocation {
-   public:
-    Allocation(allocator_type& a,  // NOLINT(runtime/references)
-               size_type capacity)
-        : capacity_(capacity),
-          buffer_(AllocatorTraits::allocate(a, capacity_)) {}
-
-    void Dealloc(allocator_type& a) {  // NOLINT(runtime/references)
-      AllocatorTraits::deallocate(a, buffer(), capacity());
+    auto n = std::distance(first, last);
+    std::pair<iterator, iterator> it_pair = ShiftRight(pos, n);
+    size_type used_spots = it_pair.second - it_pair.first;
+    auto open_spot = std::next(first, used_spots);
+    std::copy(first, open_spot, it_pair.first);
+    UninitializedCopy(open_spot, last, it_pair.second);
+    return it_pair.first;
+  }
+
+  // Overload of `InlinedVector::insert()` for inserting elements constructed
+  // from the input iterator range [`first`, `last`). Returns an `iterator`
+  // pointing to the first of the newly inserted elements.
+  template <typename InputIterator,
+            DisableIfAtLeastForwardIterator<InputIterator>* = nullptr>
+  iterator insert(const_iterator pos, InputIterator first, InputIterator last) {
+    assert(pos >= begin());
+    assert(pos <= end());
+
+    size_type index = std::distance(cbegin(), pos);
+    for (size_type i = index; first != last; ++i, static_cast<void>(++first)) {
+      insert(data() + i, *first);
     }
 
-    size_type capacity() const { return capacity_; }
-    const value_type* buffer() const { return buffer_; }
-    value_type* buffer() { return buffer_; }
+    return iterator(data() + index);
+  }
 
-   private:
-    size_type capacity_;
-    value_type* buffer_;
-  };
+  // `InlinedVector::emplace()`
+  //
+  // Constructs and inserts an object in the inlined vector at the given `pos`,
+  // returning an `iterator` pointing to the newly emplaced element.
+  template <typename... Args>
+  iterator emplace(const_iterator pos, Args&&... args) {
+    assert(pos >= begin());
+    assert(pos <= end());
+    if (ABSL_PREDICT_FALSE(pos == end())) {
+      emplace_back(std::forward<Args>(args)...);
+      return end() - 1;
+    }
 
-  const Tag& tag() const { return allocator_and_tag_.tag(); }
-  Tag& tag() { return allocator_and_tag_.tag(); }
+    T new_t = T(std::forward<Args>(args)...);
 
-  Allocation& allocation() {
-    return reinterpret_cast<Allocation&>(rep_.allocation_storage.allocation);
-  }
-  const Allocation& allocation() const {
-    return reinterpret_cast<const Allocation&>(
-        rep_.allocation_storage.allocation);
-  }
-  void init_allocation(const Allocation& allocation) {
-    new (&rep_.allocation_storage.allocation) Allocation(allocation);
-  }
+    auto range = ShiftRight(pos, 1);
+    if (range.first == range.second) {
+      // constructing into uninitialized memory
+      Construct(range.first, std::move(new_t));
+    } else {
+      // assigning into moved-from object
+      *range.first = T(std::move(new_t));
+    }
 
-  value_type* inlined_space() {
-    return reinterpret_cast<value_type*>(&rep_.inlined_storage.inlined);
-  }
-  const value_type* inlined_space() const {
-    return reinterpret_cast<const value_type*>(&rep_.inlined_storage.inlined);
+    return range.first;
   }
 
-  value_type* allocated_space() {
-    return allocation().buffer();
-  }
-  const value_type* allocated_space() const {
-    return allocation().buffer();
+  // `InlinedVector::emplace_back()`
+  //
+  // Constructs and appends a new element to the end of the inlined vector,
+  // returning a `reference` to the emplaced element.
+  template <typename... Args>
+  reference emplace_back(Args&&... args) {
+    return storage_.EmplaceBack(std::forward<Args>(args)...);
   }
 
-  const allocator_type& allocator() const {
-    return allocator_and_tag_.allocator();
+  // `InlinedVector::push_back()`
+  //
+  // Appends a copy of `v` to the end of the inlined vector.
+  void push_back(const_reference v) { static_cast<void>(emplace_back(v)); }
+
+  // Overload of `InlinedVector::push_back()` for moving `v` into a newly
+  // appended element.
+  void push_back(rvalue_reference v) {
+    static_cast<void>(emplace_back(std::move(v)));
   }
-  allocator_type& allocator() {
-    return allocator_and_tag_.allocator();
+
+  // `InlinedVector::pop_back()`
+  //
+  // Destroys the element at the end of the inlined vector and shrinks the size
+  // by `1` (unless the inlined vector is empty, in which case this is a no-op).
+  void pop_back() noexcept {
+    assert(!empty());
+
+    AllocatorTraits::destroy(*storage_.GetAllocPtr(), data() + (size() - 1));
+    storage_.SubtractSize(1);
   }
 
-  bool allocated() const { return tag().allocated(); }
+  // `InlinedVector::erase()`
+  //
+  // Erases the element at `pos` of the inlined vector, returning an `iterator`
+  // pointing to the first element following the erased element.
+  //
+  // NOTE: May return the end iterator, which is not dereferencable.
+  iterator erase(const_iterator pos) {
+    assert(pos >= begin());
+    assert(pos < end());
 
-  // Enlarge the underlying representation so we can store size_ + delta elems.
-  // The size is not changed, and any newly added memory is not initialized.
-  void EnlargeBy(size_type delta);
+    return storage_.Erase(pos, pos + 1);
+  }
 
-  // Shift all elements from position to end() n places to the right.
-  // If the vector needs to be enlarged, memory will be allocated.
-  // Returns iterators pointing to the start of the previously-initialized
-  // portion and the start of the uninitialized portion of the created gap.
-  // The number of initialized spots is pair.second - pair.first;
-  // the number of raw spots is n - (pair.second - pair.first).
-  std::pair<iterator, iterator> ShiftRight(const_iterator position,
-                                           size_type n);
-
-  void ResetAllocation(Allocation new_allocation, size_type new_size) {
-    if (allocated()) {
-      Destroy(allocated_space(), allocated_space() + size());
-      assert(begin() == allocated_space());
-      allocation().Dealloc(allocator());
-      allocation() = new_allocation;
+  // Overload of `InlinedVector::erase()` for erasing all elements in the
+  // range [`from`, `to`) in the inlined vector. Returns an `iterator` pointing
+  // to the first element following the range erased or the end iterator if `to`
+  // was the end iterator.
+  iterator erase(const_iterator from, const_iterator to) {
+    assert(from >= begin());
+    assert(from <= to);
+    assert(to <= end());
+
+    if (ABSL_PREDICT_TRUE(from != to)) {
+      return storage_.Erase(from, to);
     } else {
-      Destroy(inlined_space(), inlined_space() + size());
-      init_allocation(new_allocation);  // bug: only init once
+      return const_cast<iterator>(from);
     }
-    tag().set_allocated_size(new_size);
   }
 
-  template <typename... Args>
-  void GrowAndEmplaceBack(Args&&... args) {
-    assert(size() == capacity());
-    const size_type s = size();
+  // `InlinedVector::clear()`
+  //
+  // Destroys all elements in the inlined vector, sets the size of `0` and
+  // deallocates the heap allocation if the inlined vector was allocated.
+  void clear() noexcept {
+    inlined_vector_internal::DestroyElements(storage_.GetAllocPtr(), data(),
+                                             size());
+    storage_.DeallocateIfAllocated();
+    storage_.SetInlinedSize(0);
+  }
 
-    Allocation new_allocation(allocator(), 2 * capacity());
+  // `InlinedVector::reserve()`
+  //
+  // Enlarges the underlying representation of the inlined vector so it can hold
+  // at least `n` elements. This method does not change `size()` or the actual
+  // contents of the vector.
+  //
+  // NOTE: If `n` does not exceed `capacity()`, `reserve()` will have no
+  // effects. Otherwise, `reserve()` will reallocate, performing an n-time
+  // element-wise move of everything contained.
+  void reserve(size_type n) { storage_.Reserve(n); }
 
-    Construct(new_allocation.buffer() + s, std::forward<Args>(args)...);
-    UninitializedCopy(std::make_move_iterator(data()),
-                      std::make_move_iterator(data() + s),
-                      new_allocation.buffer());
+  // `InlinedVector::shrink_to_fit()`
+  //
+  // Reduces memory usage by freeing unused memory. After this call, calls to
+  // `capacity()` will be equal to `max(N, size())`.
+  //
+  // If `size() <= N` and the elements are currently stored on the heap, they
+  // will be moved to the inlined storage and the heap memory will be
+  // deallocated.
+  //
+  // If `size() > N` and `size() < capacity()` the elements will be moved to a
+  // smaller heap allocation.
+  void shrink_to_fit() {
+    if (storage_.GetIsAllocated()) {
+      storage_.ShrinkToFit();
+    }
+  }
 
-    ResetAllocation(new_allocation, s + 1);
+  // `InlinedVector::swap()`
+  //
+  // Swaps the contents of this inlined vector with the contents of `other`.
+  void swap(InlinedVector& other) {
+    if (ABSL_PREDICT_TRUE(this != std::addressof(other))) {
+      storage_.Swap(std::addressof(other.storage_));
+    }
   }
 
-  void InitAssign(size_type n);
-  void InitAssign(size_type n, const value_type& t);
+ private:
+  template <typename H, typename TheT, size_t TheN, typename TheA>
+  friend H AbslHashValue(H h, const absl::InlinedVector<TheT, TheN, TheA>& a);
+
+  void ResetAllocation(pointer new_data, size_type new_capacity,
+                       size_type new_size) {
+    if (storage_.GetIsAllocated()) {
+      Destroy(storage_.GetAllocatedData(),
+              storage_.GetAllocatedData() + size());
+      assert(begin() == storage_.GetAllocatedData());
+      AllocatorTraits::deallocate(*storage_.GetAllocPtr(),
+                                  storage_.GetAllocatedData(),
+                                  storage_.GetAllocatedCapacity());
+    } else {
+      Destroy(storage_.GetInlinedData(), storage_.GetInlinedData() + size());
+    }
+
+    storage_.SetAllocatedData(new_data, new_capacity);
+    storage_.SetAllocatedSize(new_size);
+  }
 
   template <typename... Args>
-  void Construct(pointer p, Args&&... args) {
-    AllocatorTraits::construct(allocator(), p, std::forward<Args>(args)...);
+  reference Construct(pointer p, Args&&... args) {
+    absl::allocator_traits<allocator_type>::construct(
+        *storage_.GetAllocPtr(), p, std::forward<Args>(args)...);
+    return *p;
   }
 
-  template <typename Iter>
-  void UninitializedCopy(Iter src, Iter src_last, value_type* dst) {
+  template <typename Iterator>
+  void UninitializedCopy(Iterator src, Iterator src_last, pointer dst) {
     for (; src != src_last; ++dst, ++src) Construct(dst, *src);
   }
 
   template <typename... Args>
-  void UninitializedFill(value_type* dst, value_type* dst_last,
-                         const Args&... args) {
+  void UninitializedFill(pointer dst, pointer dst_last, const Args&... args) {
     for (; dst != dst_last; ++dst) Construct(dst, args...);
   }
 
-  // Destroy [ptr, ptr_last) in place.
-  void Destroy(value_type* ptr, value_type* ptr_last);
-
-  template <typename Iter>
-  void AppendRange(Iter first, Iter last, std::input_iterator_tag) {
-    std::copy(first, last, std::back_inserter(*this));
-  }
-
-  // Faster path for forward iterators.
-  template <typename Iter>
-  void AppendRange(Iter first, Iter last, std::forward_iterator_tag);
-
-  template <typename Iter>
-  void AppendRange(Iter first, Iter last) {
-    using IterTag = typename std::iterator_traits<Iter>::iterator_category;
-    AppendRange(first, last, IterTag());
+  // Destroy [`from`, `to`) in place.
+  void Destroy(pointer from, pointer to) {
+    for (pointer cur = from; cur != to; ++cur) {
+      absl::allocator_traits<allocator_type>::destroy(*storage_.GetAllocPtr(),
+                                                      cur);
+    }
+#if !defined(NDEBUG)
+    // Overwrite unused memory with `0xab` so we can catch uninitialized usage.
+    // Cast to `void*` to tell the compiler that we don't care that we might be
+    // scribbling on a vtable pointer.
+    if (from != to) {
+      auto len = sizeof(value_type) * std::distance(from, to);
+      std::memset(reinterpret_cast<void*>(from), 0xab, len);
+    }
+#endif  // !defined(NDEBUG)
   }
 
-  template <typename Iter>
-  void AssignRange(Iter first, Iter last, std::input_iterator_tag);
-
-  // Faster path for forward iterators.
-  template <typename Iter>
-  void AssignRange(Iter first, Iter last, std::forward_iterator_tag);
+  // Shift all elements from `position` to `end()` by `n` places to the right.
+  // If the vector needs to be enlarged, memory will be allocated.
+  // Returns `iterator`s pointing to the start of the previously-initialized
+  // portion and the start of the uninitialized portion of the created gap.
+  // The number of initialized spots is `pair.second - pair.first`. The number
+  // of raw spots is `n - (pair.second - pair.first)`.
+  //
+  // Updates the size of the InlinedVector internally.
+  std::pair<iterator, iterator> ShiftRight(const_iterator position,
+                                           size_type n) {
+    iterator start_used = const_cast<iterator>(position);
+    iterator start_raw = const_cast<iterator>(position);
+    size_type s = size();
+    size_type required_size = s + n;
 
-  template <typename Iter>
-  void AssignRange(Iter first, Iter last) {
-    using IterTag = typename std::iterator_traits<Iter>::iterator_category;
-    AssignRange(first, last, IterTag());
+    if (required_size > capacity()) {
+      // Compute new capacity by repeatedly doubling current capacity
+      size_type new_capacity = capacity();
+      while (new_capacity < required_size) {
+        new_capacity <<= 1;
+      }
+      // Move everyone into the new allocation, leaving a gap of `n` for the
+      // requested shift.
+      pointer new_data =
+          AllocatorTraits::allocate(*storage_.GetAllocPtr(), new_capacity);
+      size_type index = position - begin();
+      UninitializedCopy(std::make_move_iterator(data()),
+                        std::make_move_iterator(data() + index), new_data);
+      UninitializedCopy(std::make_move_iterator(data() + index),
+                        std::make_move_iterator(data() + s),
+                        new_data + index + n);
+      ResetAllocation(new_data, new_capacity, s);
+
+      // New allocation means our iterator is invalid, so we'll recalculate.
+      // Since the entire gap is in new space, there's no used space to reuse.
+      start_raw = begin() + index;
+      start_used = start_raw;
+    } else {
+      // If we had enough space, it's a two-part move. Elements going into
+      // previously-unoccupied space need an `UninitializedCopy()`. Elements
+      // going into a previously-occupied space are just a `std::move()`.
+      iterator pos = const_cast<iterator>(position);
+      iterator raw_space = end();
+      size_type slots_in_used_space = raw_space - pos;
+      size_type new_elements_in_used_space = (std::min)(n, slots_in_used_space);
+      size_type new_elements_in_raw_space = n - new_elements_in_used_space;
+      size_type old_elements_in_used_space =
+          slots_in_used_space - new_elements_in_used_space;
+
+      UninitializedCopy(
+          std::make_move_iterator(pos + old_elements_in_used_space),
+          std::make_move_iterator(raw_space),
+          raw_space + new_elements_in_raw_space);
+      std::move_backward(pos, pos + old_elements_in_used_space, raw_space);
+
+      // If the gap is entirely in raw space, the used space starts where the
+      // raw space starts, leaving no elements in used space. If the gap is
+      // entirely in used space, the raw space starts at the end of the gap,
+      // leaving all elements accounted for within the used space.
+      start_used = pos;
+      start_raw = pos + new_elements_in_used_space;
+    }
+    storage_.AddSize(n);
+    return std::make_pair(start_used, start_raw);
   }
 
-  iterator InsertWithCount(const_iterator position, size_type n,
-                           const value_type& v);
-
-  template <typename InputIter>
-  iterator InsertWithRange(const_iterator position, InputIter first,
-                           InputIter last, std::input_iterator_tag);
-  template <typename ForwardIter>
-  iterator InsertWithRange(const_iterator position, ForwardIter first,
-                           ForwardIter last, std::forward_iterator_tag);
-
-  AllocatorAndTag allocator_and_tag_;
-
-  // Either the inlined or allocated representation
-  union Rep {
-    // Use struct to perform indirection that solves a bizarre compilation
-    // error on Visual Studio (all known versions).
-    struct {
-      typename std::aligned_storage<sizeof(value_type),
-                                    alignof(value_type)>::type inlined[N];
-    } inlined_storage;
-    struct {
-      typename std::aligned_storage<sizeof(Allocation),
-                                    alignof(Allocation)>::type allocation;
-    } allocation_storage;
-  } rep_;
+  Storage storage_;
 };
 
 // -----------------------------------------------------------------------------
 // InlinedVector Non-Member Functions
 // -----------------------------------------------------------------------------
 
-// swap()
+// `swap()`
 //
 // Swaps the contents of two inlined vectors. This convenience function
-// simply calls InlinedVector::swap(other_inlined_vector).
+// simply calls `InlinedVector::swap()`.
 template <typename T, size_t N, typename A>
-void swap(InlinedVector<T, N, A>& a,
-          InlinedVector<T, N, A>& b) noexcept(noexcept(a.swap(b))) {
+void swap(absl::InlinedVector<T, N, A>& a,
+          absl::InlinedVector<T, N, A>& b) noexcept(noexcept(a.swap(b))) {
   a.swap(b);
 }
 
-// operator==()
+// `operator==()`
 //
 // Tests the equivalency of the contents of two inlined vectors.
 template <typename T, size_t N, typename A>
-bool operator==(const InlinedVector<T, N, A>& a,
-                const InlinedVector<T, N, A>& b) {
-  return absl::equal(a.begin(), a.end(), b.begin(), b.end());
+bool operator==(const absl::InlinedVector<T, N, A>& a,
+                const absl::InlinedVector<T, N, A>& b) {
+  auto a_data = a.data();
+  auto a_size = a.size();
+  auto b_data = b.data();
+  auto b_size = b.size();
+  return absl::equal(a_data, a_data + a_size, b_data, b_data + b_size);
 }
 
-// operator!=()
+// `operator!=()`
 //
 // Tests the inequality of the contents of two inlined vectors.
 template <typename T, size_t N, typename A>
-bool operator!=(const InlinedVector<T, N, A>& a,
-                const InlinedVector<T, N, A>& b) {
+bool operator!=(const absl::InlinedVector<T, N, A>& a,
+                const absl::InlinedVector<T, N, A>& b) {
   return !(a == b);
 }
 
-// operator<()
+// `operator<()`
 //
 // Tests whether the contents of one inlined vector are less than the contents
 // of another through a lexicographical comparison operation.
 template <typename T, size_t N, typename A>
-bool operator<(const InlinedVector<T, N, A>& a,
-               const InlinedVector<T, N, A>& b) {
-  return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
+bool operator<(const absl::InlinedVector<T, N, A>& a,
+               const absl::InlinedVector<T, N, A>& b) {
+  auto a_data = a.data();
+  auto a_size = a.size();
+  auto b_data = b.data();
+  auto b_size = b.size();
+  return std::lexicographical_compare(a_data, a_data + a_size, b_data,
+                                      b_data + b_size);
 }
 
-// operator>()
+// `operator>()`
 //
 // Tests whether the contents of one inlined vector are greater than the
 // contents of another through a lexicographical comparison operation.
 template <typename T, size_t N, typename A>
-bool operator>(const InlinedVector<T, N, A>& a,
-               const InlinedVector<T, N, A>& b) {
+bool operator>(const absl::InlinedVector<T, N, A>& a,
+               const absl::InlinedVector<T, N, A>& b) {
   return b < a;
 }
 
-// operator<=()
+// `operator<=()`
 //
 // Tests whether the contents of one inlined vector are less than or equal to
 // the contents of another through a lexicographical comparison operation.
 template <typename T, size_t N, typename A>
-bool operator<=(const InlinedVector<T, N, A>& a,
-                const InlinedVector<T, N, A>& b) {
+bool operator<=(const absl::InlinedVector<T, N, A>& a,
+                const absl::InlinedVector<T, N, A>& b) {
   return !(b < a);
 }
 
-// operator>=()
+// `operator>=()`
 //
 // Tests whether the contents of one inlined vector are greater than or equal to
 // the contents of another through a lexicographical comparison operation.
 template <typename T, size_t N, typename A>
-bool operator>=(const InlinedVector<T, N, A>& a,
-                const InlinedVector<T, N, A>& b) {
+bool operator>=(const absl::InlinedVector<T, N, A>& a,
+                const absl::InlinedVector<T, N, A>& b) {
   return !(a < b);
 }
 
-// -----------------------------------------------------------------------------
-// Implementation of InlinedVector
-// -----------------------------------------------------------------------------
+// `AbslHashValue()`
 //
-// Do not depend on any implementation details below this line.
-
-template <typename T, size_t N, typename A>
-InlinedVector<T, N, A>::InlinedVector(const InlinedVector& v)
-    : allocator_and_tag_(v.allocator()) {
-  reserve(v.size());
-  if (allocated()) {
-    UninitializedCopy(v.begin(), v.end(), allocated_space());
-    tag().set_allocated_size(v.size());
-  } else {
-    UninitializedCopy(v.begin(), v.end(), inlined_space());
-    tag().set_inline_size(v.size());
-  }
-}
-
-template <typename T, size_t N, typename A>
-InlinedVector<T, N, A>::InlinedVector(const InlinedVector& v,
-                                      const allocator_type& alloc)
-    : allocator_and_tag_(alloc) {
-  reserve(v.size());
-  if (allocated()) {
-    UninitializedCopy(v.begin(), v.end(), allocated_space());
-    tag().set_allocated_size(v.size());
-  } else {
-    UninitializedCopy(v.begin(), v.end(), inlined_space());
-    tag().set_inline_size(v.size());
-  }
-}
-
-template <typename T, size_t N, typename A>
-InlinedVector<T, N, A>::InlinedVector(InlinedVector&& v) noexcept(
-    absl::allocator_is_nothrow<allocator_type>::value ||
-    std::is_nothrow_move_constructible<value_type>::value)
-    : allocator_and_tag_(v.allocator_and_tag_) {
-  if (v.allocated()) {
-    // We can just steal the underlying buffer from the source.
-    // That leaves the source empty, so we clear its size.
-    init_allocation(v.allocation());
-    v.tag() = Tag();
-  } else {
-    UninitializedCopy(std::make_move_iterator(v.inlined_space()),
-                      std::make_move_iterator(v.inlined_space() + v.size()),
-                      inlined_space());
-  }
-}
-
-template <typename T, size_t N, typename A>
-InlinedVector<T, N, A>::InlinedVector(
-    InlinedVector&& v,
-    const allocator_type&
-        alloc) noexcept(absl::allocator_is_nothrow<allocator_type>::value)
-    : allocator_and_tag_(alloc) {
-  if (v.allocated()) {
-    if (alloc == v.allocator()) {
-      // We can just steal the allocation from the source.
-      tag() = v.tag();
-      init_allocation(v.allocation());
-      v.tag() = Tag();
-    } else {
-      // We need to use our own allocator
-      reserve(v.size());
-      UninitializedCopy(std::make_move_iterator(v.begin()),
-                        std::make_move_iterator(v.end()), allocated_space());
-      tag().set_allocated_size(v.size());
-    }
-  } else {
-    UninitializedCopy(std::make_move_iterator(v.inlined_space()),
-                      std::make_move_iterator(v.inlined_space() + v.size()),
-                      inlined_space());
-    tag().set_inline_size(v.size());
-  }
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::InitAssign(size_type n, const value_type& t) {
-  if (n > static_cast<size_type>(N)) {
-    Allocation new_allocation(allocator(), n);
-    init_allocation(new_allocation);
-    UninitializedFill(allocated_space(), allocated_space() + n, t);
-    tag().set_allocated_size(n);
-  } else {
-    UninitializedFill(inlined_space(), inlined_space() + n, t);
-    tag().set_inline_size(n);
-  }
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::InitAssign(size_type n) {
-  if (n > static_cast<size_type>(N)) {
-    Allocation new_allocation(allocator(), n);
-    init_allocation(new_allocation);
-    UninitializedFill(allocated_space(), allocated_space() + n);
-    tag().set_allocated_size(n);
-  } else {
-    UninitializedFill(inlined_space(), inlined_space() + n);
-    tag().set_inline_size(n);
-  }
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::resize(size_type n) {
-  size_type s = size();
-  if (n < s) {
-    erase(begin() + n, end());
-    return;
-  }
-  reserve(n);
-  assert(capacity() >= n);
-
-  // Fill new space with elements constructed in-place.
-  if (allocated()) {
-    UninitializedFill(allocated_space() + s, allocated_space() + n);
-    tag().set_allocated_size(n);
-  } else {
-    UninitializedFill(inlined_space() + s, inlined_space() + n);
-    tag().set_inline_size(n);
-  }
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::resize(size_type n, const value_type& elem) {
-  size_type s = size();
-  if (n < s) {
-    erase(begin() + n, end());
-    return;
-  }
-  reserve(n);
-  assert(capacity() >= n);
-
-  // Fill new space with copies of 'elem'.
-  if (allocated()) {
-    UninitializedFill(allocated_space() + s, allocated_space() + n, elem);
-    tag().set_allocated_size(n);
-  } else {
-    UninitializedFill(inlined_space() + s, inlined_space() + n, elem);
-    tag().set_inline_size(n);
-  }
-}
-
-template <typename T, size_t N, typename A>
-template <typename... Args>
-typename InlinedVector<T, N, A>::iterator InlinedVector<T, N, A>::emplace(
-    const_iterator position, Args&&... args) {
-  assert(position >= begin());
-  assert(position <= end());
-  if (position == end()) {
-    emplace_back(std::forward<Args>(args)...);
-    return end() - 1;
-  }
-  size_type s = size();
-  size_type idx = std::distance(cbegin(), position);
-  if (s == capacity()) {
-    EnlargeBy(1);
-  }
-  assert(s < capacity());
-  iterator pos = begin() + idx;  // Set 'pos' to a post-enlarge iterator.
-
-  pointer space;
-  if (allocated()) {
-    tag().set_allocated_size(s + 1);
-    space = allocated_space();
-  } else {
-    tag().set_inline_size(s + 1);
-    space = inlined_space();
-  }
-  Construct(space + s, std::move(space[s - 1]));
-  std::move_backward(pos, space + s - 1, space + s);
-  Destroy(pos, pos + 1);
-  Construct(pos, std::forward<Args>(args)...);
-
-  return pos;
-}
-
-template <typename T, size_t N, typename A>
-typename InlinedVector<T, N, A>::iterator InlinedVector<T, N, A>::erase(
-    const_iterator first, const_iterator last) {
-  assert(begin() <= first);
-  assert(first <= last);
-  assert(last <= end());
-
-  iterator range_start = const_cast<iterator>(first);
-  iterator range_end = const_cast<iterator>(last);
-
-  size_type s = size();
-  ptrdiff_t erase_gap = std::distance(range_start, range_end);
-  if (erase_gap > 0) {
-    pointer space;
-    if (allocated()) {
-      space = allocated_space();
-      tag().set_allocated_size(s - erase_gap);
-    } else {
-      space = inlined_space();
-      tag().set_inline_size(s - erase_gap);
-    }
-    std::move(range_end, space + s, range_start);
-    Destroy(space + s - erase_gap, space + s);
-  }
-  return range_start;
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::swap(InlinedVector& other) {
-  using std::swap;  // Augment ADL with std::swap.
-  if (&other == this) {
-    return;
-  }
-  if (allocated() && other.allocated()) {
-    // Both out of line, so just swap the tag, allocation, and allocator.
-    swap(tag(), other.tag());
-    swap(allocation(), other.allocation());
-    swap(allocator(), other.allocator());
-    return;
-  }
-  if (!allocated() && !other.allocated()) {
-    // Both inlined: swap up to smaller size, then move remaining elements.
-    InlinedVector* a = this;
-    InlinedVector* b = &other;
-    if (size() < other.size()) {
-      swap(a, b);
-    }
-
-    const size_type a_size = a->size();
-    const size_type b_size = b->size();
-    assert(a_size >= b_size);
-    // 'a' is larger. Swap the elements up to the smaller array size.
-    std::swap_ranges(a->inlined_space(),
-                     a->inlined_space() + b_size,
-                     b->inlined_space());
-
-    // Move the remaining elements: A[b_size,a_size) -> B[b_size,a_size)
-    b->UninitializedCopy(a->inlined_space() + b_size,
-                         a->inlined_space() + a_size,
-                         b->inlined_space() + b_size);
-    a->Destroy(a->inlined_space() + b_size, a->inlined_space() + a_size);
-
-    swap(a->tag(), b->tag());
-    swap(a->allocator(), b->allocator());
-    assert(b->size() == a_size);
-    assert(a->size() == b_size);
-    return;
-  }
-  // One is out of line, one is inline.
-  // We first move the elements from the inlined vector into the
-  // inlined space in the other vector.  We then put the other vector's
-  // pointer/capacity into the originally inlined vector and swap
-  // the tags.
-  InlinedVector* a = this;
-  InlinedVector* b = &other;
-  if (a->allocated()) {
-    swap(a, b);
-  }
-  assert(!a->allocated());
-  assert(b->allocated());
-  const size_type a_size = a->size();
-  const size_type b_size = b->size();
-  // In an optimized build, b_size would be unused.
-  (void)b_size;
-
-  // Made Local copies of size(), don't need tag() accurate anymore
-  swap(a->tag(), b->tag());
-
-  // Copy b_allocation out before b's union gets clobbered by inline_space.
-  Allocation b_allocation = b->allocation();
-
-  b->UninitializedCopy(a->inlined_space(), a->inlined_space() + a_size,
-                       b->inlined_space());
-  a->Destroy(a->inlined_space(), a->inlined_space() + a_size);
-
-  a->allocation() = b_allocation;
-
-  if (a->allocator() != b->allocator()) {
-    swap(a->allocator(), b->allocator());
-  }
-
-  assert(b->size() == a_size);
-  assert(a->size() == b_size);
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::EnlargeBy(size_type delta) {
-  const size_type s = size();
-  assert(s <= capacity());
-
-  size_type target = std::max(static_cast<size_type>(N), s + delta);
-
-  // Compute new capacity by repeatedly doubling current capacity
-  // TODO(psrc): Check and avoid overflow?
-  size_type new_capacity = capacity();
-  while (new_capacity < target) {
-    new_capacity <<= 1;
-  }
-
-  Allocation new_allocation(allocator(), new_capacity);
-
-  UninitializedCopy(std::make_move_iterator(data()),
-                    std::make_move_iterator(data() + s),
-                    new_allocation.buffer());
-
-  ResetAllocation(new_allocation, s);
-}
-
-template <typename T, size_t N, typename A>
-auto InlinedVector<T, N, A>::ShiftRight(const_iterator position, size_type n)
-    -> std::pair<iterator, iterator> {
-  iterator start_used = const_cast<iterator>(position);
-  iterator start_raw = const_cast<iterator>(position);
-  size_type s = size();
-  size_type required_size = s + n;
-
-  if (required_size > capacity()) {
-    // Compute new capacity by repeatedly doubling current capacity
-    size_type new_capacity = capacity();
-    while (new_capacity < required_size) {
-      new_capacity <<= 1;
-    }
-    // Move everyone into the new allocation, leaving a gap of n for the
-    // requested shift.
-    Allocation new_allocation(allocator(), new_capacity);
-    size_type index = position - begin();
-    UninitializedCopy(std::make_move_iterator(data()),
-                      std::make_move_iterator(data() + index),
-                      new_allocation.buffer());
-    UninitializedCopy(std::make_move_iterator(data() + index),
-                      std::make_move_iterator(data() + s),
-                      new_allocation.buffer() + index + n);
-    ResetAllocation(new_allocation, s);
-
-    // New allocation means our iterator is invalid, so we'll recalculate.
-    // Since the entire gap is in new space, there's no used space to reuse.
-    start_raw = begin() + index;
-    start_used = start_raw;
-  } else {
-    // If we had enough space, it's a two-part move. Elements going into
-    // previously-unoccupied space need an UninitializedCopy. Elements
-    // going into a previously-occupied space are just a move.
-    iterator pos = const_cast<iterator>(position);
-    iterator raw_space = end();
-    size_type slots_in_used_space = raw_space - pos;
-    size_type new_elements_in_used_space = std::min(n, slots_in_used_space);
-    size_type new_elements_in_raw_space = n - new_elements_in_used_space;
-    size_type old_elements_in_used_space =
-        slots_in_used_space - new_elements_in_used_space;
-
-    UninitializedCopy(std::make_move_iterator(pos + old_elements_in_used_space),
-                      std::make_move_iterator(raw_space),
-                      raw_space + new_elements_in_raw_space);
-    std::move_backward(pos, pos + old_elements_in_used_space, raw_space);
-
-    // If the gap is entirely in raw space, the used space starts where the raw
-    // space starts, leaving no elements in used space. If the gap is entirely
-    // in used space, the raw space starts at the end of the gap, leaving all
-    // elements accounted for within the used space.
-    start_used = pos;
-    start_raw = pos + new_elements_in_used_space;
-  }
-  return std::make_pair(start_used, start_raw);
-}
-
-template <typename T, size_t N, typename A>
-void InlinedVector<T, N, A>::Destroy(value_type* ptr, value_type* ptr_last) {
-  for (value_type* p = ptr; p != ptr_last; ++p) {
-    AllocatorTraits::destroy(allocator(), p);
-  }
-
-  // Overwrite unused memory with 0xab so we can catch uninitialized usage.
-  // Cast to void* to tell the compiler that we don't care that we might be
-  // scribbling on a vtable pointer.
-#ifndef NDEBUG
-  if (ptr != ptr_last) {
-    memset(reinterpret_cast<void*>(ptr), 0xab,
-           sizeof(*ptr) * (ptr_last - ptr));
-  }
-#endif
-}
-
-template <typename T, size_t N, typename A>
-template <typename Iter>
-void InlinedVector<T, N, A>::AppendRange(Iter first, Iter last,
-                                         std::forward_iterator_tag) {
-  using Length = typename std::iterator_traits<Iter>::difference_type;
-  Length length = std::distance(first, last);
-  reserve(size() + length);
-  if (allocated()) {
-    UninitializedCopy(first, last, allocated_space() + size());
-    tag().set_allocated_size(size() + length);
-  } else {
-    UninitializedCopy(first, last, inlined_space() + size());
-    tag().set_inline_size(size() + length);
-  }
-}
-
-template <typename T, size_t N, typename A>
-template <typename Iter>
-void InlinedVector<T, N, A>::AssignRange(Iter first, Iter last,
-                                         std::input_iterator_tag) {
-  // Optimized to avoid reallocation.
-  // Prefer reassignment to copy construction for elements.
-  iterator out = begin();
-  for ( ; first != last && out != end(); ++first, ++out)
-    *out = *first;
-  erase(out, end());
-  std::copy(first, last, std::back_inserter(*this));
-}
-
-template <typename T, size_t N, typename A>
-template <typename Iter>
-void InlinedVector<T, N, A>::AssignRange(Iter first, Iter last,
-                                         std::forward_iterator_tag) {
-  using Length = typename std::iterator_traits<Iter>::difference_type;
-  Length length = std::distance(first, last);
-  // Prefer reassignment to copy construction for elements.
-  if (static_cast<size_type>(length) <= size()) {
-    erase(std::copy(first, last, begin()), end());
-    return;
-  }
-  reserve(length);
-  iterator out = begin();
-  for (; out != end(); ++first, ++out) *out = *first;
-  if (allocated()) {
-    UninitializedCopy(first, last, out);
-    tag().set_allocated_size(length);
-  } else {
-    UninitializedCopy(first, last, out);
-    tag().set_inline_size(length);
-  }
-}
-
-template <typename T, size_t N, typename A>
-auto InlinedVector<T, N, A>::InsertWithCount(const_iterator position,
-                                             size_type n, const value_type& v)
-    -> iterator {
-  assert(position >= begin() && position <= end());
-  if (n == 0) return const_cast<iterator>(position);
-  std::pair<iterator, iterator> it_pair = ShiftRight(position, n);
-  std::fill(it_pair.first, it_pair.second, v);
-  UninitializedFill(it_pair.second, it_pair.first + n, v);
-  tag().add_size(n);
-  return it_pair.first;
-}
-
-template <typename T, size_t N, typename A>
-template <typename InputIter>
-auto InlinedVector<T, N, A>::InsertWithRange(const_iterator position,
-                                             InputIter first, InputIter last,
-                                             std::input_iterator_tag)
-    -> iterator {
-  assert(position >= begin() && position <= end());
-  size_type index = position - cbegin();
-  size_type i = index;
-  while (first != last) insert(begin() + i++, *first++);
-  return begin() + index;
-}
-
-// Overload of InlinedVector::InsertWithRange()
-template <typename T, size_t N, typename A>
-template <typename ForwardIter>
-auto InlinedVector<T, N, A>::InsertWithRange(const_iterator position,
-                                             ForwardIter first,
-                                             ForwardIter last,
-                                             std::forward_iterator_tag)
-    -> iterator {
-  assert(position >= begin() && position <= end());
-  if (first == last) {
-    return const_cast<iterator>(position);
-  }
-  using Length = typename std::iterator_traits<ForwardIter>::difference_type;
-  Length n = std::distance(first, last);
-  std::pair<iterator, iterator> it_pair = ShiftRight(position, n);
-  size_type used_spots = it_pair.second - it_pair.first;
-  ForwardIter open_spot = std::next(first, used_spots);
-  std::copy(first, open_spot, it_pair.first);
-  UninitializedCopy(open_spot, last, it_pair.second);
-  tag().add_size(n);
-  return it_pair.first;
+// Provides `absl::Hash` support for `absl::InlinedVector`. You do not normally
+// call this function directly.
+template <typename H, typename TheT, size_t TheN, typename TheA>
+H AbslHashValue(H h, const absl::InlinedVector<TheT, TheN, TheA>& a) {
+  auto a_data = a.data();
+  auto a_size = a.size();
+  return H::combine(H::combine_contiguous(std::move(h), a_data, a_size),
+                    a_size);
 }
 
 }  // namespace absl
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/common.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/common.h
new file mode 100644 (file)
index 0000000..b06e711
--- /dev/null
@@ -0,0 +1,183 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_CONTAINER_H_
+#define ABSL_CONTAINER_INTERNAL_CONTAINER_H_
+
+#include <cassert>
+#include <type_traits>
+
+#include "absl/meta/type_traits.h"
+#include "absl/types/optional.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class, class = void>
+struct IsTransparent : std::false_type {};
+template <class T>
+struct IsTransparent<T, absl::void_t<typename T::is_transparent>>
+    : std::true_type {};
+
+template <bool is_transparent>
+struct KeyArg {
+  // Transparent. Forward `K`.
+  template <typename K, typename key_type>
+  using type = K;
+};
+
+template <>
+struct KeyArg<false> {
+  // Not transparent. Always use `key_type`.
+  template <typename K, typename key_type>
+  using type = key_type;
+};
+
+// The node_handle concept from C++17.
+// We specialize node_handle for sets and maps. node_handle_base holds the
+// common API of both.
+template <typename PolicyTraits, typename Alloc>
+class node_handle_base {
+ protected:
+  using slot_type = typename PolicyTraits::slot_type;
+
+ public:
+  using allocator_type = Alloc;
+
+  constexpr node_handle_base() {}
+  node_handle_base(node_handle_base&& other) noexcept {
+    *this = std::move(other);
+  }
+  ~node_handle_base() { destroy(); }
+  node_handle_base& operator=(node_handle_base&& other) noexcept {
+    destroy();
+    if (!other.empty()) {
+      alloc_ = other.alloc_;
+      PolicyTraits::transfer(alloc(), slot(), other.slot());
+      other.reset();
+    }
+    return *this;
+  }
+
+  bool empty() const noexcept { return !alloc_; }
+  explicit operator bool() const noexcept { return !empty(); }
+  allocator_type get_allocator() const { return *alloc_; }
+
+ protected:
+  friend struct CommonAccess;
+
+  node_handle_base(const allocator_type& a, slot_type* s) : alloc_(a) {
+    PolicyTraits::transfer(alloc(), slot(), s);
+  }
+
+  void destroy() {
+    if (!empty()) {
+      PolicyTraits::destroy(alloc(), slot());
+      reset();
+    }
+  }
+
+  void reset() {
+    assert(alloc_.has_value());
+    alloc_ = absl::nullopt;
+  }
+
+  slot_type* slot() const {
+    assert(!empty());
+    return reinterpret_cast<slot_type*>(std::addressof(slot_space_));
+  }
+  allocator_type* alloc() { return std::addressof(*alloc_); }
+
+ private:
+  absl::optional<allocator_type> alloc_;
+  mutable absl::aligned_storage_t<sizeof(slot_type), alignof(slot_type)>
+      slot_space_;
+};
+
+// For sets.
+template <typename Policy, typename PolicyTraits, typename Alloc,
+          typename = void>
+class node_handle : public node_handle_base<PolicyTraits, Alloc> {
+  using Base = typename node_handle::node_handle_base;
+
+ public:
+  using value_type = typename PolicyTraits::value_type;
+
+  constexpr node_handle() {}
+
+  value_type& value() const { return PolicyTraits::element(this->slot()); }
+
+ private:
+  friend struct CommonAccess;
+
+  node_handle(const Alloc& a, typename Base::slot_type* s) : Base(a, s) {}
+};
+
+// For maps.
+template <typename Policy, typename PolicyTraits, typename Alloc>
+class node_handle<Policy, PolicyTraits, Alloc,
+                  absl::void_t<typename Policy::mapped_type>>
+    : public node_handle_base<PolicyTraits, Alloc> {
+  using Base = typename node_handle::node_handle_base;
+
+ public:
+  using key_type = typename Policy::key_type;
+  using mapped_type = typename Policy::mapped_type;
+
+  constexpr node_handle() {}
+
+  auto key() const -> decltype(PolicyTraits::key(this->slot())) {
+    return PolicyTraits::key(this->slot());
+  }
+
+  mapped_type& mapped() const {
+    return PolicyTraits::value(&PolicyTraits::element(this->slot()));
+  }
+
+ private:
+  friend struct CommonAccess;
+
+  node_handle(const Alloc& a, typename Base::slot_type* s) : Base(a, s) {}
+};
+
+// Provide access to non-public node-handle functions.
+struct CommonAccess {
+  template <typename Node>
+  static auto GetSlot(const Node& node) -> decltype(node.slot()) {
+    return node.slot();
+  }
+
+  template <typename Node>
+  static void Reset(Node* node) {
+    node->reset();
+  }
+
+  template <typename T, typename... Args>
+  static T Make(Args&&... args) {
+    return T(std::forward<Args>(args)...);
+  }
+};
+
+// Implement the insert_return_type<> concept of C++17.
+template <class Iterator, class NodeType>
+struct InsertReturnType {
+  Iterator position;
+  bool inserted;
+  NodeType node;
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_CONTAINER_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h
new file mode 100644 (file)
index 0000000..c29ab41
--- /dev/null
@@ -0,0 +1,230 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Helper class to perform the Empty Base Optimization.
+// Ts can contain classes and non-classes, empty or not. For the ones that
+// are empty classes, we perform the optimization. If all types in Ts are empty
+// classes, then CompressedTuple<Ts...> is itself an empty class.
+//
+// To access the members, use member get<N>() function.
+//
+// Eg:
+//   absl::container_internal::CompressedTuple<int, T1, T2, T3> value(7, t1, t2,
+//                                                                    t3);
+//   assert(value.get<0>() == 7);
+//   T1& t1 = value.get<1>();
+//   const T2& t2 = value.get<2>();
+//   ...
+//
+// https://en.cppreference.com/w/cpp/language/ebo
+
+#ifndef ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_
+#define ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_
+
+#include <initializer_list>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "absl/utility/utility.h"
+
+#if defined(_MSC_VER) && !defined(__NVCC__)
+// We need to mark these classes with this declspec to ensure that
+// CompressedTuple happens.
+#define ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC __declspec(empty_bases)
+#else
+#define ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC
+#endif
+
+namespace absl {
+namespace container_internal {
+
+template <typename... Ts>
+class CompressedTuple;
+
+namespace internal_compressed_tuple {
+
+template <typename D, size_t I>
+struct Elem;
+template <typename... B, size_t I>
+struct Elem<CompressedTuple<B...>, I>
+    : std::tuple_element<I, std::tuple<B...>> {};
+template <typename D, size_t I>
+using ElemT = typename Elem<D, I>::type;
+
+// Use the __is_final intrinsic if available. Where it's not available, classes
+// declared with the 'final' specifier cannot be used as CompressedTuple
+// elements.
+// TODO(sbenza): Replace this with std::is_final in C++14.
+template <typename T>
+constexpr bool IsFinal() {
+#if defined(__clang__) || defined(__GNUC__)
+  return __is_final(T);
+#else
+  return false;
+#endif
+}
+
+// We can't use EBCO on other CompressedTuples because that would mean that we
+// derive from multiple Storage<> instantiations with the same I parameter,
+// and potentially from multiple identical Storage<> instantiations.  So anytime
+// we use type inheritance rather than encapsulation, we mark
+// CompressedTupleImpl, to make this easy to detect.
+struct uses_inheritance {};
+
+template <typename T>
+constexpr bool ShouldUseBase() {
+  return std::is_class<T>::value && std::is_empty<T>::value && !IsFinal<T>() &&
+         !std::is_base_of<uses_inheritance, T>::value;
+}
+
+// The storage class provides two specializations:
+//  - For empty classes, it stores T as a base class.
+//  - For everything else, it stores T as a member.
+template <typename T, size_t I,
+#if defined(_MSC_VER)
+          bool UseBase =
+              ShouldUseBase<typename std::enable_if<true, T>::type>()>
+#else
+          bool UseBase = ShouldUseBase<T>()>
+#endif
+struct Storage {
+  T value;
+  constexpr Storage() = default;
+  explicit constexpr Storage(T&& v) : value(absl::forward<T>(v)) {}
+  constexpr const T& get() const& { return value; }
+  T& get() & { return value; }
+  constexpr const T&& get() const&& { return absl::move(*this).value; }
+  T&& get() && { return std::move(*this).value; }
+};
+
+template <typename T, size_t I>
+struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage<T, I, true> : T {
+  constexpr Storage() = default;
+  explicit constexpr Storage(T&& v) : T(absl::forward<T>(v)) {}
+  constexpr const T& get() const& { return *this; }
+  T& get() & { return *this; }
+  constexpr const T&& get() const&& { return absl::move(*this); }
+  T&& get() && { return std::move(*this); }
+};
+
+template <typename D, typename I, bool ShouldAnyUseBase>
+struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl;
+
+template <typename... Ts, size_t... I, bool ShouldAnyUseBase>
+struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl<
+    CompressedTuple<Ts...>, absl::index_sequence<I...>, ShouldAnyUseBase>
+    // We use the dummy identity function through std::integral_constant to
+    // convince MSVC of accepting and expanding I in that context. Without it
+    // you would get:
+    //   error C3548: 'I': parameter pack cannot be used in this context
+    : uses_inheritance,
+      Storage<Ts, std::integral_constant<size_t, I>::value>... {
+  constexpr CompressedTupleImpl() = default;
+  explicit constexpr CompressedTupleImpl(Ts&&... args)
+      : Storage<Ts, I>(absl::forward<Ts>(args))... {}
+  friend CompressedTuple<Ts...>;
+};
+
+template <typename... Ts, size_t... I>
+struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl<
+    CompressedTuple<Ts...>, absl::index_sequence<I...>, false>
+    // We use the dummy identity function as above...
+    : Storage<Ts, std::integral_constant<size_t, I>::value, false>... {
+  constexpr CompressedTupleImpl() = default;
+  explicit constexpr CompressedTupleImpl(Ts&&... args)
+      : Storage<Ts, I, false>(absl::forward<Ts>(args))... {}
+  friend CompressedTuple<Ts...>;
+};
+
+std::false_type Or(std::initializer_list<std::false_type>);
+std::true_type Or(std::initializer_list<bool>);
+
+// MSVC requires this to be done separately rather than within the declaration
+// of CompressedTuple below.
+template <typename... Ts>
+constexpr bool ShouldAnyUseBase() {
+  return decltype(
+      Or({std::integral_constant<bool, ShouldUseBase<Ts>()>()...})){};
+}
+
+}  // namespace internal_compressed_tuple
+
+// Helper class to perform the Empty Base Class Optimization.
+// Ts can contain classes and non-classes, empty or not. For the ones that
+// are empty classes, we perform the CompressedTuple. If all types in Ts are
+// empty classes, then CompressedTuple<Ts...> is itself an empty class.  (This
+// does not apply when one or more of those empty classes is itself an empty
+// CompressedTuple.)
+//
+// To access the members, use member .get<N>() function.
+//
+// Eg:
+//   absl::container_internal::CompressedTuple<int, T1, T2, T3> value(7, t1, t2,
+//                                                                    t3);
+//   assert(value.get<0>() == 7);
+//   T1& t1 = value.get<1>();
+//   const T2& t2 = value.get<2>();
+//   ...
+//
+// https://en.cppreference.com/w/cpp/language/ebo
+template <typename... Ts>
+class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
+    : private internal_compressed_tuple::CompressedTupleImpl<
+          CompressedTuple<Ts...>, absl::index_sequence_for<Ts...>,
+          internal_compressed_tuple::ShouldAnyUseBase<Ts...>()> {
+ private:
+  template <int I>
+  using ElemT = internal_compressed_tuple::ElemT<CompressedTuple, I>;
+
+  template <int I>
+  using StorageT = internal_compressed_tuple::Storage<ElemT<I>, I>;
+
+ public:
+  constexpr CompressedTuple() = default;
+  explicit constexpr CompressedTuple(Ts... base)
+      : CompressedTuple::CompressedTupleImpl(absl::forward<Ts>(base)...) {}
+
+  template <int I>
+  ElemT<I>& get() & {
+    return internal_compressed_tuple::Storage<ElemT<I>, I>::get();
+  }
+
+  template <int I>
+  constexpr const ElemT<I>& get() const& {
+    return StorageT<I>::get();
+  }
+
+  template <int I>
+  ElemT<I>&& get() && {
+    return std::move(*this).StorageT<I>::get();
+  }
+
+  template <int I>
+  constexpr const ElemT<I>&& get() const&& {
+    return absl::move(*this).StorageT<I>::get();
+  }
+};
+
+// Explicit specialization for a zero-element tuple
+// (needed to avoid ambiguous overloads for the default constructor).
+template <>
+class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple<> {};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#undef ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC
+
+#endif  // ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/container_memory.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/container_memory.h
new file mode 100644 (file)
index 0000000..e5bb977
--- /dev/null
@@ -0,0 +1,438 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_CONTAINER_MEMORY_H_
+#define ABSL_CONTAINER_INTERNAL_CONTAINER_MEMORY_H_
+
+#ifdef ADDRESS_SANITIZER
+#include <sanitizer/asan_interface.h>
+#endif
+
+#ifdef MEMORY_SANITIZER
+#include <sanitizer/msan_interface.h>
+#endif
+
+#include <cassert>
+#include <cstddef>
+#include <memory>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "absl/memory/memory.h"
+#include "absl/utility/utility.h"
+
+namespace absl {
+namespace container_internal {
+
+// Allocates at least n bytes aligned to the specified alignment.
+// Alignment must be a power of 2. It must be positive.
+//
+// Note that many allocators don't honor alignment requirements above certain
+// threshold (usually either alignof(std::max_align_t) or alignof(void*)).
+// Allocate() doesn't apply alignment corrections. If the underlying allocator
+// returns insufficiently alignment pointer, that's what you are going to get.
+template <size_t Alignment, class Alloc>
+void* Allocate(Alloc* alloc, size_t n) {
+  static_assert(Alignment > 0, "");
+  assert(n && "n must be positive");
+  struct alignas(Alignment) M {};
+  using A = typename absl::allocator_traits<Alloc>::template rebind_alloc<M>;
+  using AT = typename absl::allocator_traits<Alloc>::template rebind_traits<M>;
+  A mem_alloc(*alloc);
+  void* p = AT::allocate(mem_alloc, (n + sizeof(M) - 1) / sizeof(M));
+  assert(reinterpret_cast<uintptr_t>(p) % Alignment == 0 &&
+         "allocator does not respect alignment");
+  return p;
+}
+
+// The pointer must have been previously obtained by calling
+// Allocate<Alignment>(alloc, n).
+template <size_t Alignment, class Alloc>
+void Deallocate(Alloc* alloc, void* p, size_t n) {
+  static_assert(Alignment > 0, "");
+  assert(n && "n must be positive");
+  struct alignas(Alignment) M {};
+  using A = typename absl::allocator_traits<Alloc>::template rebind_alloc<M>;
+  using AT = typename absl::allocator_traits<Alloc>::template rebind_traits<M>;
+  A mem_alloc(*alloc);
+  AT::deallocate(mem_alloc, static_cast<M*>(p),
+                 (n + sizeof(M) - 1) / sizeof(M));
+}
+
+namespace memory_internal {
+
+// Constructs T into uninitialized storage pointed by `ptr` using the args
+// specified in the tuple.
+template <class Alloc, class T, class Tuple, size_t... I>
+void ConstructFromTupleImpl(Alloc* alloc, T* ptr, Tuple&& t,
+                            absl::index_sequence<I...>) {
+  absl::allocator_traits<Alloc>::construct(
+      *alloc, ptr, std::get<I>(std::forward<Tuple>(t))...);
+}
+
+template <class T, class F>
+struct WithConstructedImplF {
+  template <class... Args>
+  decltype(std::declval<F>()(std::declval<T>())) operator()(
+      Args&&... args) const {
+    return std::forward<F>(f)(T(std::forward<Args>(args)...));
+  }
+  F&& f;
+};
+
+template <class T, class Tuple, size_t... Is, class F>
+decltype(std::declval<F>()(std::declval<T>())) WithConstructedImpl(
+    Tuple&& t, absl::index_sequence<Is...>, F&& f) {
+  return WithConstructedImplF<T, F>{std::forward<F>(f)}(
+      std::get<Is>(std::forward<Tuple>(t))...);
+}
+
+template <class T, size_t... Is>
+auto TupleRefImpl(T&& t, absl::index_sequence<Is...>)
+    -> decltype(std::forward_as_tuple(std::get<Is>(std::forward<T>(t))...)) {
+  return std::forward_as_tuple(std::get<Is>(std::forward<T>(t))...);
+}
+
+// Returns a tuple of references to the elements of the input tuple. T must be a
+// tuple.
+template <class T>
+auto TupleRef(T&& t) -> decltype(
+    TupleRefImpl(std::forward<T>(t),
+                 absl::make_index_sequence<
+                     std::tuple_size<typename std::decay<T>::type>::value>())) {
+  return TupleRefImpl(
+      std::forward<T>(t),
+      absl::make_index_sequence<
+          std::tuple_size<typename std::decay<T>::type>::value>());
+}
+
+template <class F, class K, class V>
+decltype(std::declval<F>()(std::declval<const K&>(), std::piecewise_construct,
+                           std::declval<std::tuple<K>>(), std::declval<V>()))
+DecomposePairImpl(F&& f, std::pair<std::tuple<K>, V> p) {
+  const auto& key = std::get<0>(p.first);
+  return std::forward<F>(f)(key, std::piecewise_construct, std::move(p.first),
+                            std::move(p.second));
+}
+
+}  // namespace memory_internal
+
+// Constructs T into uninitialized storage pointed by `ptr` using the args
+// specified in the tuple.
+template <class Alloc, class T, class Tuple>
+void ConstructFromTuple(Alloc* alloc, T* ptr, Tuple&& t) {
+  memory_internal::ConstructFromTupleImpl(
+      alloc, ptr, std::forward<Tuple>(t),
+      absl::make_index_sequence<
+          std::tuple_size<typename std::decay<Tuple>::type>::value>());
+}
+
+// Constructs T using the args specified in the tuple and calls F with the
+// constructed value.
+template <class T, class Tuple, class F>
+decltype(std::declval<F>()(std::declval<T>())) WithConstructed(
+    Tuple&& t, F&& f) {
+  return memory_internal::WithConstructedImpl<T>(
+      std::forward<Tuple>(t),
+      absl::make_index_sequence<
+          std::tuple_size<typename std::decay<Tuple>::type>::value>(),
+      std::forward<F>(f));
+}
+
+// Given arguments of an std::pair's consructor, PairArgs() returns a pair of
+// tuples with references to the passed arguments. The tuples contain
+// constructor arguments for the first and the second elements of the pair.
+//
+// The following two snippets are equivalent.
+//
+// 1. std::pair<F, S> p(args...);
+//
+// 2. auto a = PairArgs(args...);
+//    std::pair<F, S> p(std::piecewise_construct,
+//                      std::move(p.first), std::move(p.second));
+inline std::pair<std::tuple<>, std::tuple<>> PairArgs() { return {}; }
+template <class F, class S>
+std::pair<std::tuple<F&&>, std::tuple<S&&>> PairArgs(F&& f, S&& s) {
+  return {std::piecewise_construct, std::forward_as_tuple(std::forward<F>(f)),
+          std::forward_as_tuple(std::forward<S>(s))};
+}
+template <class F, class S>
+std::pair<std::tuple<const F&>, std::tuple<const S&>> PairArgs(
+    const std::pair<F, S>& p) {
+  return PairArgs(p.first, p.second);
+}
+template <class F, class S>
+std::pair<std::tuple<F&&>, std::tuple<S&&>> PairArgs(std::pair<F, S>&& p) {
+  return PairArgs(std::forward<F>(p.first), std::forward<S>(p.second));
+}
+template <class F, class S>
+auto PairArgs(std::piecewise_construct_t, F&& f, S&& s)
+    -> decltype(std::make_pair(memory_internal::TupleRef(std::forward<F>(f)),
+                               memory_internal::TupleRef(std::forward<S>(s)))) {
+  return std::make_pair(memory_internal::TupleRef(std::forward<F>(f)),
+                        memory_internal::TupleRef(std::forward<S>(s)));
+}
+
+// A helper function for implementing apply() in map policies.
+template <class F, class... Args>
+auto DecomposePair(F&& f, Args&&... args)
+    -> decltype(memory_internal::DecomposePairImpl(
+        std::forward<F>(f), PairArgs(std::forward<Args>(args)...))) {
+  return memory_internal::DecomposePairImpl(
+      std::forward<F>(f), PairArgs(std::forward<Args>(args)...));
+}
+
+// A helper function for implementing apply() in set policies.
+template <class F, class Arg>
+decltype(std::declval<F>()(std::declval<const Arg&>(), std::declval<Arg>()))
+DecomposeValue(F&& f, Arg&& arg) {
+  const auto& key = arg;
+  return std::forward<F>(f)(key, std::forward<Arg>(arg));
+}
+
+// Helper functions for asan and msan.
+inline void SanitizerPoisonMemoryRegion(const void* m, size_t s) {
+#ifdef ADDRESS_SANITIZER
+  ASAN_POISON_MEMORY_REGION(m, s);
+#endif
+#ifdef MEMORY_SANITIZER
+  __msan_poison(m, s);
+#endif
+  (void)m;
+  (void)s;
+}
+
+inline void SanitizerUnpoisonMemoryRegion(const void* m, size_t s) {
+#ifdef ADDRESS_SANITIZER
+  ASAN_UNPOISON_MEMORY_REGION(m, s);
+#endif
+#ifdef MEMORY_SANITIZER
+  __msan_unpoison(m, s);
+#endif
+  (void)m;
+  (void)s;
+}
+
+template <typename T>
+inline void SanitizerPoisonObject(const T* object) {
+  SanitizerPoisonMemoryRegion(object, sizeof(T));
+}
+
+template <typename T>
+inline void SanitizerUnpoisonObject(const T* object) {
+  SanitizerUnpoisonMemoryRegion(object, sizeof(T));
+}
+
+namespace memory_internal {
+
+// If Pair is a standard-layout type, OffsetOf<Pair>::kFirst and
+// OffsetOf<Pair>::kSecond are equivalent to offsetof(Pair, first) and
+// offsetof(Pair, second) respectively. Otherwise they are -1.
+//
+// The purpose of OffsetOf is to avoid calling offsetof() on non-standard-layout
+// type, which is non-portable.
+template <class Pair, class = std::true_type>
+struct OffsetOf {
+  static constexpr size_t kFirst = -1;
+  static constexpr size_t kSecond = -1;
+};
+
+template <class Pair>
+struct OffsetOf<Pair, typename std::is_standard_layout<Pair>::type> {
+  static constexpr size_t kFirst = offsetof(Pair, first);
+  static constexpr size_t kSecond = offsetof(Pair, second);
+};
+
+template <class K, class V>
+struct IsLayoutCompatible {
+ private:
+  struct Pair {
+    K first;
+    V second;
+  };
+
+  // Is P layout-compatible with Pair?
+  template <class P>
+  static constexpr bool LayoutCompatible() {
+    return std::is_standard_layout<P>() && sizeof(P) == sizeof(Pair) &&
+           alignof(P) == alignof(Pair) &&
+           memory_internal::OffsetOf<P>::kFirst ==
+               memory_internal::OffsetOf<Pair>::kFirst &&
+           memory_internal::OffsetOf<P>::kSecond ==
+               memory_internal::OffsetOf<Pair>::kSecond;
+  }
+
+ public:
+  // Whether pair<const K, V> and pair<K, V> are layout-compatible. If they are,
+  // then it is safe to store them in a union and read from either.
+  static constexpr bool value = std::is_standard_layout<K>() &&
+                                std::is_standard_layout<Pair>() &&
+                                memory_internal::OffsetOf<Pair>::kFirst == 0 &&
+                                LayoutCompatible<std::pair<K, V>>() &&
+                                LayoutCompatible<std::pair<const K, V>>();
+};
+
+}  // namespace memory_internal
+
+// The internal storage type for key-value containers like flat_hash_map.
+//
+// It is convenient for the value_type of a flat_hash_map<K, V> to be
+// pair<const K, V>; the "const K" prevents accidental modification of the key
+// when dealing with the reference returned from find() and similar methods.
+// However, this creates other problems; we want to be able to emplace(K, V)
+// efficiently with move operations, and similarly be able to move a
+// pair<K, V> in insert().
+//
+// The solution is this union, which aliases the const and non-const versions
+// of the pair. This also allows flat_hash_map<const K, V> to work, even though
+// that has the same efficiency issues with move in emplace() and insert() -
+// but people do it anyway.
+//
+// If kMutableKeys is false, only the value member can be accessed.
+//
+// If kMutableKeys is true, key can be accessed through all slots while value
+// and mutable_value must be accessed only via INITIALIZED slots. Slots are
+// created and destroyed via mutable_value so that the key can be moved later.
+//
+// Accessing one of the union fields while the other is active is safe as
+// long as they are layout-compatible, which is guaranteed by the definition of
+// kMutableKeys. For C++11, the relevant section of the standard is
+// https://timsong-cpp.github.io/cppwp/n3337/class.mem#19 (9.2.19)
+template <class K, class V>
+union map_slot_type {
+  map_slot_type() {}
+  ~map_slot_type() = delete;
+  using value_type = std::pair<const K, V>;
+  using mutable_value_type = std::pair<K, V>;
+
+  value_type value;
+  mutable_value_type mutable_value;
+  K key;
+};
+
+template <class K, class V>
+struct map_slot_policy {
+  using slot_type = map_slot_type<K, V>;
+  using value_type = std::pair<const K, V>;
+  using mutable_value_type = std::pair<K, V>;
+
+ private:
+  static void emplace(slot_type* slot) {
+    // The construction of union doesn't do anything at runtime but it allows us
+    // to access its members without violating aliasing rules.
+    new (slot) slot_type;
+  }
+  // If pair<const K, V> and pair<K, V> are layout-compatible, we can accept one
+  // or the other via slot_type. We are also free to access the key via
+  // slot_type::key in this case.
+  using kMutableKeys = memory_internal::IsLayoutCompatible<K, V>;
+
+ public:
+  static value_type& element(slot_type* slot) { return slot->value; }
+  static const value_type& element(const slot_type* slot) {
+    return slot->value;
+  }
+
+  static const K& key(const slot_type* slot) {
+    return kMutableKeys::value ? slot->key : slot->value.first;
+  }
+
+  template <class Allocator, class... Args>
+  static void construct(Allocator* alloc, slot_type* slot, Args&&... args) {
+    emplace(slot);
+    if (kMutableKeys::value) {
+      absl::allocator_traits<Allocator>::construct(*alloc, &slot->mutable_value,
+                                                   std::forward<Args>(args)...);
+    } else {
+      absl::allocator_traits<Allocator>::construct(*alloc, &slot->value,
+                                                   std::forward<Args>(args)...);
+    }
+  }
+
+  // Construct this slot by moving from another slot.
+  template <class Allocator>
+  static void construct(Allocator* alloc, slot_type* slot, slot_type* other) {
+    emplace(slot);
+    if (kMutableKeys::value) {
+      absl::allocator_traits<Allocator>::construct(
+          *alloc, &slot->mutable_value, std::move(other->mutable_value));
+    } else {
+      absl::allocator_traits<Allocator>::construct(*alloc, &slot->value,
+                                                   std::move(other->value));
+    }
+  }
+
+  template <class Allocator>
+  static void destroy(Allocator* alloc, slot_type* slot) {
+    if (kMutableKeys::value) {
+      absl::allocator_traits<Allocator>::destroy(*alloc, &slot->mutable_value);
+    } else {
+      absl::allocator_traits<Allocator>::destroy(*alloc, &slot->value);
+    }
+  }
+
+  template <class Allocator>
+  static void transfer(Allocator* alloc, slot_type* new_slot,
+                       slot_type* old_slot) {
+    emplace(new_slot);
+    if (kMutableKeys::value) {
+      absl::allocator_traits<Allocator>::construct(
+          *alloc, &new_slot->mutable_value, std::move(old_slot->mutable_value));
+    } else {
+      absl::allocator_traits<Allocator>::construct(*alloc, &new_slot->value,
+                                                   std::move(old_slot->value));
+    }
+    destroy(alloc, old_slot);
+  }
+
+  template <class Allocator>
+  static void swap(Allocator* alloc, slot_type* a, slot_type* b) {
+    if (kMutableKeys::value) {
+      using std::swap;
+      swap(a->mutable_value, b->mutable_value);
+    } else {
+      value_type tmp = std::move(a->value);
+      absl::allocator_traits<Allocator>::destroy(*alloc, &a->value);
+      absl::allocator_traits<Allocator>::construct(*alloc, &a->value,
+                                                   std::move(b->value));
+      absl::allocator_traits<Allocator>::destroy(*alloc, &b->value);
+      absl::allocator_traits<Allocator>::construct(*alloc, &b->value,
+                                                   std::move(tmp));
+    }
+  }
+
+  template <class Allocator>
+  static void move(Allocator* alloc, slot_type* src, slot_type* dest) {
+    if (kMutableKeys::value) {
+      dest->mutable_value = std::move(src->mutable_value);
+    } else {
+      absl::allocator_traits<Allocator>::destroy(*alloc, &dest->value);
+      absl::allocator_traits<Allocator>::construct(*alloc, &dest->value,
+                                                   std::move(src->value));
+    }
+  }
+
+  template <class Allocator>
+  static void move(Allocator* alloc, slot_type* first, slot_type* last,
+                   slot_type* result) {
+    for (slot_type *src = first, *dest = result; src != last; ++src, ++dest)
+      move(alloc, src, dest);
+  }
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_CONTAINER_MEMORY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/counting_allocator.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/counting_allocator.h
new file mode 100644 (file)
index 0000000..4e717be
--- /dev/null
@@ -0,0 +1,79 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_COUNTING_ALLOCATOR_H_
+#define ABSL_CONTAINER_INTERNAL_COUNTING_ALLOCATOR_H_
+
+#include <cassert>
+#include <cstdint>
+#include <memory>
+
+namespace absl {
+namespace container_internal {
+
+// This is a stateful allocator, but the state lives outside of the
+// allocator (in whatever test is using the allocator). This is odd
+// but helps in tests where the allocator is propagated into nested
+// containers - that chain of allocators uses the same state and is
+// thus easier to query for aggregate allocation information.
+template <typename T>
+class CountingAllocator : public std::allocator<T> {
+ public:
+  using Alloc = std::allocator<T>;
+  using pointer = typename Alloc::pointer;
+  using size_type = typename Alloc::size_type;
+
+  CountingAllocator() : bytes_used_(nullptr) {}
+  explicit CountingAllocator(int64_t* b) : bytes_used_(b) {}
+
+  template <typename U>
+  CountingAllocator(const CountingAllocator<U>& x)
+      : Alloc(x), bytes_used_(x.bytes_used_) {}
+
+  pointer allocate(size_type n,
+                   std::allocator<void>::const_pointer hint = nullptr) {
+    assert(bytes_used_ != nullptr);
+    *bytes_used_ += n * sizeof(T);
+    return Alloc::allocate(n, hint);
+  }
+
+  void deallocate(pointer p, size_type n) {
+    Alloc::deallocate(p, n);
+    assert(bytes_used_ != nullptr);
+    *bytes_used_ -= n * sizeof(T);
+  }
+
+  template<typename U>
+  class rebind {
+   public:
+    using other = CountingAllocator<U>;
+  };
+
+  friend bool operator==(const CountingAllocator& a,
+                         const CountingAllocator& b) {
+    return a.bytes_used_ == b.bytes_used_;
+  }
+
+  friend bool operator!=(const CountingAllocator& a,
+                         const CountingAllocator& b) {
+    return !(a == b);
+  }
+
+  int64_t* bytes_used_;
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_COUNTING_ALLOCATOR_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h
new file mode 100644 (file)
index 0000000..cb8f03c
--- /dev/null
@@ -0,0 +1,144 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Define the default Hash and Eq functions for SwissTable containers.
+//
+// std::hash<T> and std::equal_to<T> are not appropriate hash and equal
+// functions for SwissTable containers. There are two reasons for this.
+//
+// SwissTable containers are power of 2 sized containers:
+//
+// This means they use the lower bits of the hash value to find the slot for
+// each entry. The typical hash function for integral types is the identity.
+// This is a very weak hash function for SwissTable and any power of 2 sized
+// hashtable implementation which will lead to excessive collisions. For
+// SwissTable we use murmur3 style mixing to reduce collisions to a minimum.
+//
+// SwissTable containers support heterogeneous lookup:
+//
+// In order to make heterogeneous lookup work, hash and equal functions must be
+// polymorphic. At the same time they have to satisfy the same requirements the
+// C++ standard imposes on hash functions and equality operators. That is:
+//
+//   if hash_default_eq<T>(a, b) returns true for any a and b of type T, then
+//   hash_default_hash<T>(a) must equal hash_default_hash<T>(b)
+//
+// For SwissTable containers this requirement is relaxed to allow a and b of
+// any and possibly different types. Note that like the standard the hash and
+// equal functions are still bound to T. This is important because some type U
+// can be hashed by/tested for equality differently depending on T. A notable
+// example is `const char*`. `const char*` is treated as a c-style string when
+// the hash function is hash<std::string> but as a pointer when the hash
+// function is hash<void*>.
+//
+#ifndef ABSL_CONTAINER_INTERNAL_HASH_FUNCTION_DEFAULTS_H_
+#define ABSL_CONTAINER_INTERNAL_HASH_FUNCTION_DEFAULTS_H_
+
+#include <stdint.h>
+#include <cstddef>
+#include <memory>
+#include <string>
+#include <type_traits>
+
+#include "absl/base/config.h"
+#include "absl/hash/hash.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace container_internal {
+
+// The hash of an object of type T is computed by using absl::Hash.
+template <class T, class E = void>
+struct HashEq {
+  using Hash = absl::Hash<T>;
+  using Eq = std::equal_to<T>;
+};
+
+struct StringHash {
+  using is_transparent = void;
+
+  size_t operator()(absl::string_view v) const {
+    return absl::Hash<absl::string_view>{}(v);
+  }
+};
+
+// Supports heterogeneous lookup for string-like elements.
+struct StringHashEq {
+  using Hash = StringHash;
+  struct Eq {
+    using is_transparent = void;
+    bool operator()(absl::string_view lhs, absl::string_view rhs) const {
+      return lhs == rhs;
+    }
+  };
+};
+
+template <>
+struct HashEq<std::string> : StringHashEq {};
+template <>
+struct HashEq<absl::string_view> : StringHashEq {};
+
+// Supports heterogeneous lookup for pointers and smart pointers.
+template <class T>
+struct HashEq<T*> {
+  struct Hash {
+    using is_transparent = void;
+    template <class U>
+    size_t operator()(const U& ptr) const {
+      return absl::Hash<const T*>{}(HashEq::ToPtr(ptr));
+    }
+  };
+  struct Eq {
+    using is_transparent = void;
+    template <class A, class B>
+    bool operator()(const A& a, const B& b) const {
+      return HashEq::ToPtr(a) == HashEq::ToPtr(b);
+    }
+  };
+
+ private:
+  static const T* ToPtr(const T* ptr) { return ptr; }
+  template <class U, class D>
+  static const T* ToPtr(const std::unique_ptr<U, D>& ptr) {
+    return ptr.get();
+  }
+  template <class U>
+  static const T* ToPtr(const std::shared_ptr<U>& ptr) {
+    return ptr.get();
+  }
+};
+
+template <class T, class D>
+struct HashEq<std::unique_ptr<T, D>> : HashEq<T*> {};
+template <class T>
+struct HashEq<std::shared_ptr<T>> : HashEq<T*> {};
+
+// This header's visibility is restricted.  If you need to access the default
+// hasher please use the container's ::hasher alias instead.
+//
+// Example: typename Hash = typename absl::flat_hash_map<K, V>::hasher
+template <class T>
+using hash_default_hash = typename container_internal::HashEq<T>::Hash;
+
+// This header's visibility is restricted.  If you need to access the default
+// key equal please use the container's ::key_equal alias instead.
+//
+// Example: typename Eq = typename absl::flat_hash_map<K, V, Hash>::key_equal
+template <class T>
+using hash_default_eq = typename container_internal::HashEq<T>::Eq;
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASH_FUNCTION_DEFAULTS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_generator_testing.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_generator_testing.h
new file mode 100644 (file)
index 0000000..27fb84f
--- /dev/null
@@ -0,0 +1,150 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Generates random values for testing. Specialized only for the few types we
+// care about.
+
+#ifndef ABSL_CONTAINER_INTERNAL_HASH_GENERATOR_TESTING_H_
+#define ABSL_CONTAINER_INTERNAL_HASH_GENERATOR_TESTING_H_
+
+#include <stdint.h>
+#include <algorithm>
+#include <iosfwd>
+#include <random>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "absl/container/internal/hash_policy_testing.h"
+#include "absl/meta/type_traits.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace container_internal {
+namespace hash_internal {
+namespace generator_internal {
+
+template <class Container, class = void>
+struct IsMap : std::false_type {};
+
+template <class Map>
+struct IsMap<Map, absl::void_t<typename Map::mapped_type>> : std::true_type {};
+
+}  // namespace generator_internal
+
+std::mt19937_64* GetSharedRng();
+
+enum Enum {
+  kEnumEmpty,
+  kEnumDeleted,
+};
+
+enum class EnumClass : uint64_t {
+  kEmpty,
+  kDeleted,
+};
+
+inline std::ostream& operator<<(std::ostream& o, const EnumClass& ec) {
+  return o << static_cast<uint64_t>(ec);
+}
+
+template <class T, class E = void>
+struct Generator;
+
+template <class T>
+struct Generator<T, typename std::enable_if<std::is_integral<T>::value>::type> {
+  T operator()() const {
+    std::uniform_int_distribution<T> dist;
+    return dist(*GetSharedRng());
+  }
+};
+
+template <>
+struct Generator<Enum> {
+  Enum operator()() const {
+    std::uniform_int_distribution<typename std::underlying_type<Enum>::type>
+        dist;
+    while (true) {
+      auto variate = dist(*GetSharedRng());
+      if (variate != kEnumEmpty && variate != kEnumDeleted)
+        return static_cast<Enum>(variate);
+    }
+  }
+};
+
+template <>
+struct Generator<EnumClass> {
+  EnumClass operator()() const {
+    std::uniform_int_distribution<
+        typename std::underlying_type<EnumClass>::type>
+        dist;
+    while (true) {
+      EnumClass variate = static_cast<EnumClass>(dist(*GetSharedRng()));
+      if (variate != EnumClass::kEmpty && variate != EnumClass::kDeleted)
+        return static_cast<EnumClass>(variate);
+    }
+  }
+};
+
+template <>
+struct Generator<std::string> {
+  std::string operator()() const;
+};
+
+template <>
+struct Generator<absl::string_view> {
+  absl::string_view operator()() const;
+};
+
+template <>
+struct Generator<NonStandardLayout> {
+  NonStandardLayout operator()() const {
+    return NonStandardLayout(Generator<std::string>()());
+  }
+};
+
+template <class K, class V>
+struct Generator<std::pair<K, V>> {
+  std::pair<K, V> operator()() const {
+    return std::pair<K, V>(Generator<typename std::decay<K>::type>()(),
+                           Generator<typename std::decay<V>::type>()());
+  }
+};
+
+template <class... Ts>
+struct Generator<std::tuple<Ts...>> {
+  std::tuple<Ts...> operator()() const {
+    return std::tuple<Ts...>(Generator<typename std::decay<Ts>::type>()()...);
+  }
+};
+
+template <class U>
+struct Generator<U, absl::void_t<decltype(std::declval<U&>().key()),
+                                decltype(std::declval<U&>().value())>>
+    : Generator<std::pair<
+          typename std::decay<decltype(std::declval<U&>().key())>::type,
+          typename std::decay<decltype(std::declval<U&>().value())>::type>> {};
+
+template <class Container>
+using GeneratedType = decltype(
+    std::declval<const Generator<
+        typename std::conditional<generator_internal::IsMap<Container>::value,
+                                  typename Container::value_type,
+                                  typename Container::key_type>::type>&>()());
+
+}  // namespace hash_internal
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASH_GENERATOR_TESTING_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_policy_testing.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_policy_testing.h
new file mode 100644 (file)
index 0000000..c57407a
--- /dev/null
@@ -0,0 +1,182 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Utilities to help tests verify that hash tables properly handle stateful
+// allocators and hash functions.
+
+#ifndef ABSL_CONTAINER_INTERNAL_HASH_POLICY_TESTING_H_
+#define ABSL_CONTAINER_INTERNAL_HASH_POLICY_TESTING_H_
+
+#include <cstdlib>
+#include <limits>
+#include <memory>
+#include <ostream>
+#include <type_traits>
+#include <utility>
+#include <vector>
+
+#include "absl/hash/hash.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace container_internal {
+namespace hash_testing_internal {
+
+template <class Derived>
+struct WithId {
+  WithId() : id_(next_id<Derived>()) {}
+  WithId(const WithId& that) : id_(that.id_) {}
+  WithId(WithId&& that) : id_(that.id_) { that.id_ = 0; }
+  WithId& operator=(const WithId& that) {
+    id_ = that.id_;
+    return *this;
+  }
+  WithId& operator=(WithId&& that) {
+    id_ = that.id_;
+    that.id_ = 0;
+    return *this;
+  }
+
+  size_t id() const { return id_; }
+
+  friend bool operator==(const WithId& a, const WithId& b) {
+    return a.id_ == b.id_;
+  }
+  friend bool operator!=(const WithId& a, const WithId& b) { return !(a == b); }
+
+ protected:
+  explicit WithId(size_t id) : id_(id) {}
+
+ private:
+  size_t id_;
+
+  template <class T>
+  static size_t next_id() {
+    // 0 is reserved for moved from state.
+    static size_t gId = 1;
+    return gId++;
+  }
+};
+
+}  // namespace hash_testing_internal
+
+struct NonStandardLayout {
+  NonStandardLayout() {}
+  explicit NonStandardLayout(std::string s) : value(std::move(s)) {}
+  virtual ~NonStandardLayout() {}
+
+  friend bool operator==(const NonStandardLayout& a,
+                         const NonStandardLayout& b) {
+    return a.value == b.value;
+  }
+  friend bool operator!=(const NonStandardLayout& a,
+                         const NonStandardLayout& b) {
+    return a.value != b.value;
+  }
+
+  template <typename H>
+  friend H AbslHashValue(H h, const NonStandardLayout& v) {
+    return H::combine(std::move(h), v.value);
+  }
+
+  std::string value;
+};
+
+struct StatefulTestingHash
+    : absl::container_internal::hash_testing_internal::WithId<
+          StatefulTestingHash> {
+  template <class T>
+  size_t operator()(const T& t) const {
+    return absl::Hash<T>{}(t);
+  }
+};
+
+struct StatefulTestingEqual
+    : absl::container_internal::hash_testing_internal::WithId<
+          StatefulTestingEqual> {
+  template <class T, class U>
+  bool operator()(const T& t, const U& u) const {
+    return t == u;
+  }
+};
+
+// It is expected that Alloc() == Alloc() for all allocators so we cannot use
+// WithId base. We need to explicitly assign ids.
+template <class T = int>
+struct Alloc : std::allocator<T> {
+  using propagate_on_container_swap = std::true_type;
+
+  // Using old paradigm for this to ensure compatibility.
+  explicit Alloc(size_t id = 0) : id_(id) {}
+
+  Alloc(const Alloc&) = default;
+  Alloc& operator=(const Alloc&) = default;
+
+  template <class U>
+  Alloc(const Alloc<U>& that) : std::allocator<T>(that), id_(that.id()) {}
+
+  template <class U>
+  struct rebind {
+    using other = Alloc<U>;
+  };
+
+  size_t id() const { return id_; }
+
+  friend bool operator==(const Alloc& a, const Alloc& b) {
+    return a.id_ == b.id_;
+  }
+  friend bool operator!=(const Alloc& a, const Alloc& b) { return !(a == b); }
+
+ private:
+  size_t id_ = (std::numeric_limits<size_t>::max)();
+};
+
+template <class Map>
+auto items(const Map& m) -> std::vector<
+    std::pair<typename Map::key_type, typename Map::mapped_type>> {
+  using std::get;
+  std::vector<std::pair<typename Map::key_type, typename Map::mapped_type>> res;
+  res.reserve(m.size());
+  for (const auto& v : m) res.emplace_back(get<0>(v), get<1>(v));
+  return res;
+}
+
+template <class Set>
+auto keys(const Set& s)
+    -> std::vector<typename std::decay<typename Set::key_type>::type> {
+  std::vector<typename std::decay<typename Set::key_type>::type> res;
+  res.reserve(s.size());
+  for (const auto& v : s) res.emplace_back(v);
+  return res;
+}
+
+}  // namespace container_internal
+}  // namespace absl
+
+// ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS is false for glibcxx versions
+// where the unordered containers are missing certain constructors that
+// take allocator arguments. This test is defined ad-hoc for the platforms
+// we care about (notably Crosstool 17) because libstdcxx's useless
+// versioning scheme precludes a more principled solution.
+// From GCC-4.9 Changelog: (src: https://gcc.gnu.org/gcc-4.9/changes.html)
+// "the unordered associative containers in <unordered_map> and <unordered_set>
+// meet the allocator-aware container requirements;"
+#if (defined(__GLIBCXX__) && __GLIBCXX__ <= 20140425 ) || \
+( __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9 ))
+#define ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS 0
+#else
+#define ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS 1
+#endif
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASH_POLICY_TESTING_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h
new file mode 100644 (file)
index 0000000..fd007de
--- /dev/null
@@ -0,0 +1,189 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_HASH_POLICY_TRAITS_H_
+#define ABSL_CONTAINER_INTERNAL_HASH_POLICY_TRAITS_H_
+
+#include <cstddef>
+#include <memory>
+#include <type_traits>
+#include <utility>
+
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+namespace container_internal {
+
+// Defines how slots are initialized/destroyed/moved.
+template <class Policy, class = void>
+struct hash_policy_traits {
+ private:
+  struct ReturnKey {
+    // We return `Key` here.
+    // When Key=T&, we forward the lvalue reference.
+    // When Key=T, we return by value to avoid a dangling reference.
+    // eg, for string_hash_map.
+    template <class Key, class... Args>
+    Key operator()(Key&& k, const Args&...) const {
+      return std::forward<Key>(k);
+    }
+  };
+
+  template <class P = Policy, class = void>
+  struct ConstantIteratorsImpl : std::false_type {};
+
+  template <class P>
+  struct ConstantIteratorsImpl<P, absl::void_t<typename P::constant_iterators>>
+      : P::constant_iterators {};
+
+ public:
+  // The actual object stored in the hash table.
+  using slot_type = typename Policy::slot_type;
+
+  // The type of the keys stored in the hashtable.
+  using key_type = typename Policy::key_type;
+
+  // The argument type for insertions into the hashtable. This is different
+  // from value_type for increased performance. See initializer_list constructor
+  // and insert() member functions for more details.
+  using init_type = typename Policy::init_type;
+
+  using reference = decltype(Policy::element(std::declval<slot_type*>()));
+  using pointer = typename std::remove_reference<reference>::type*;
+  using value_type = typename std::remove_reference<reference>::type;
+
+  // Policies can set this variable to tell raw_hash_set that all iterators
+  // should be constant, even `iterator`. This is useful for set-like
+  // containers.
+  // Defaults to false if not provided by the policy.
+  using constant_iterators = ConstantIteratorsImpl<>;
+
+  // PRECONDITION: `slot` is UNINITIALIZED
+  // POSTCONDITION: `slot` is INITIALIZED
+  template <class Alloc, class... Args>
+  static void construct(Alloc* alloc, slot_type* slot, Args&&... args) {
+    Policy::construct(alloc, slot, std::forward<Args>(args)...);
+  }
+
+  // PRECONDITION: `slot` is INITIALIZED
+  // POSTCONDITION: `slot` is UNINITIALIZED
+  template <class Alloc>
+  static void destroy(Alloc* alloc, slot_type* slot) {
+    Policy::destroy(alloc, slot);
+  }
+
+  // Transfers the `old_slot` to `new_slot`. Any memory allocated by the
+  // allocator inside `old_slot` to `new_slot` can be transferred.
+  //
+  // OPTIONAL: defaults to:
+  //
+  //     clone(new_slot, std::move(*old_slot));
+  //     destroy(old_slot);
+  //
+  // PRECONDITION: `new_slot` is UNINITIALIZED and `old_slot` is INITIALIZED
+  // POSTCONDITION: `new_slot` is INITIALIZED and `old_slot` is
+  //                UNINITIALIZED
+  template <class Alloc>
+  static void transfer(Alloc* alloc, slot_type* new_slot, slot_type* old_slot) {
+    transfer_impl(alloc, new_slot, old_slot, 0);
+  }
+
+  // PRECONDITION: `slot` is INITIALIZED
+  // POSTCONDITION: `slot` is INITIALIZED
+  template <class P = Policy>
+  static auto element(slot_type* slot) -> decltype(P::element(slot)) {
+    return P::element(slot);
+  }
+
+  // Returns the amount of memory owned by `slot`, exclusive of `sizeof(*slot)`.
+  //
+  // If `slot` is nullptr, returns the constant amount of memory owned by any
+  // full slot or -1 if slots own variable amounts of memory.
+  //
+  // PRECONDITION: `slot` is INITIALIZED or nullptr
+  template <class P = Policy>
+  static size_t space_used(const slot_type* slot) {
+    return P::space_used(slot);
+  }
+
+  // Provides generalized access to the key for elements, both for elements in
+  // the table and for elements that have not yet been inserted (or even
+  // constructed).  We would like an API that allows us to say: `key(args...)`
+  // but we cannot do that for all cases, so we use this more general API that
+  // can be used for many things, including the following:
+  //
+  //   - Given an element in a table, get its key.
+  //   - Given an element initializer, get its key.
+  //   - Given `emplace()` arguments, get the element key.
+  //
+  // Implementations of this must adhere to a very strict technical
+  // specification around aliasing and consuming arguments:
+  //
+  // Let `value_type` be the result type of `element()` without ref- and
+  // cv-qualifiers. The first argument is a functor, the rest are constructor
+  // arguments for `value_type`. Returns `std::forward<F>(f)(k, xs...)`, where
+  // `k` is the element key, and `xs...` are the new constructor arguments for
+  // `value_type`. It's allowed for `k` to alias `xs...`, and for both to alias
+  // `ts...`. The key won't be touched once `xs...` are used to construct an
+  // element; `ts...` won't be touched at all, which allows `apply()` to consume
+  // any rvalues among them.
+  //
+  // If `value_type` is constructible from `Ts&&...`, `Policy::apply()` must not
+  // trigger a hard compile error unless it originates from `f`. In other words,
+  // `Policy::apply()` must be SFINAE-friendly. If `value_type` is not
+  // constructible from `Ts&&...`, either SFINAE or a hard compile error is OK.
+  //
+  // If `Ts...` is `[cv] value_type[&]` or `[cv] init_type[&]`,
+  // `Policy::apply()` must work. A compile error is not allowed, SFINAE or not.
+  template <class F, class... Ts, class P = Policy>
+  static auto apply(F&& f, Ts&&... ts)
+      -> decltype(P::apply(std::forward<F>(f), std::forward<Ts>(ts)...)) {
+    return P::apply(std::forward<F>(f), std::forward<Ts>(ts)...);
+  }
+
+  // Returns the "key" portion of the slot.
+  // Used for node handle manipulation.
+  template <class P = Policy>
+  static auto key(slot_type* slot)
+      -> decltype(P::apply(ReturnKey(), element(slot))) {
+    return P::apply(ReturnKey(), element(slot));
+  }
+
+  // Returns the "value" (as opposed to the "key") portion of the element. Used
+  // by maps to implement `operator[]`, `at()` and `insert_or_assign()`.
+  template <class T, class P = Policy>
+  static auto value(T* elem) -> decltype(P::value(elem)) {
+    return P::value(elem);
+  }
+
+ private:
+  // Use auto -> decltype as an enabler.
+  template <class Alloc, class P = Policy>
+  static auto transfer_impl(Alloc* alloc, slot_type* new_slot,
+                            slot_type* old_slot, int)
+      -> decltype((void)P::transfer(alloc, new_slot, old_slot)) {
+    P::transfer(alloc, new_slot, old_slot);
+  }
+  template <class Alloc>
+  static void transfer_impl(Alloc* alloc, slot_type* new_slot,
+                            slot_type* old_slot, char) {
+    construct(alloc, new_slot, std::move(element(old_slot)));
+    destroy(alloc, old_slot);
+  }
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASH_POLICY_TRAITS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtable_debug.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtable_debug.h
new file mode 100644 (file)
index 0000000..7193000
--- /dev/null
@@ -0,0 +1,108 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This library provides APIs to debug the probing behavior of hash tables.
+//
+// In general, the probing behavior is a black box for users and only the
+// side effects can be measured in the form of performance differences.
+// These APIs give a glimpse on the actual behavior of the probing algorithms in
+// these hashtables given a specified hash function and a set of elements.
+//
+// The probe count distribution can be used to assess the quality of the hash
+// function for that particular hash table. Note that a hash function that
+// performs well in one hash table implementation does not necessarily performs
+// well in a different one.
+//
+// This library supports std::unordered_{set,map}, dense_hash_{set,map} and
+// absl::{flat,node,string}_hash_{set,map}.
+
+#ifndef ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_H_
+#define ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_H_
+
+#include <cstddef>
+#include <algorithm>
+#include <type_traits>
+#include <vector>
+
+#include "absl/container/internal/hashtable_debug_hooks.h"
+
+namespace absl {
+namespace container_internal {
+
+// Returns the number of probes required to lookup `key`.  Returns 0 for a
+// search with no collisions.  Higher values mean more hash collisions occurred;
+// however, the exact meaning of this number varies according to the container
+// type.
+template <typename C>
+size_t GetHashtableDebugNumProbes(
+    const C& c, const typename C::key_type& key) {
+  return absl::container_internal::hashtable_debug_internal::
+      HashtableDebugAccess<C>::GetNumProbes(c, key);
+}
+
+// Gets a histogram of the number of probes for each elements in the container.
+// The sum of all the values in the vector is equal to container.size().
+template <typename C>
+std::vector<size_t> GetHashtableDebugNumProbesHistogram(const C& container) {
+  std::vector<size_t> v;
+  for (auto it = container.begin(); it != container.end(); ++it) {
+    size_t num_probes = GetHashtableDebugNumProbes(
+        container,
+        absl::container_internal::hashtable_debug_internal::GetKey<C>(*it, 0));
+    v.resize((std::max)(v.size(), num_probes + 1));
+    v[num_probes]++;
+  }
+  return v;
+}
+
+struct HashtableDebugProbeSummary {
+  size_t total_elements;
+  size_t total_num_probes;
+  double mean;
+};
+
+// Gets a summary of the probe count distribution for the elements in the
+// container.
+template <typename C>
+HashtableDebugProbeSummary GetHashtableDebugProbeSummary(const C& container) {
+  auto probes = GetHashtableDebugNumProbesHistogram(container);
+  HashtableDebugProbeSummary summary = {};
+  for (size_t i = 0; i < probes.size(); ++i) {
+    summary.total_elements += probes[i];
+    summary.total_num_probes += probes[i] * i;
+  }
+  summary.mean = 1.0 * summary.total_num_probes / summary.total_elements;
+  return summary;
+}
+
+// Returns the number of bytes requested from the allocator by the container
+// and not freed.
+template <typename C>
+size_t AllocatedByteSize(const C& c) {
+  return absl::container_internal::hashtable_debug_internal::
+      HashtableDebugAccess<C>::AllocatedByteSize(c);
+}
+
+// Returns a tight lower bound for AllocatedByteSize(c) where `c` is of type `C`
+// and `c.size()` is equal to `num_elements`.
+template <typename C>
+size_t LowerBoundAllocatedByteSize(size_t num_elements) {
+  return absl::container_internal::hashtable_debug_internal::
+      HashtableDebugAccess<C>::LowerBoundAllocatedByteSize(num_elements);
+}
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h
new file mode 100644 (file)
index 0000000..371ce81
--- /dev/null
@@ -0,0 +1,81 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Provides the internal API for hashtable_debug.h.
+
+#ifndef ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_HOOKS_H_
+#define ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_HOOKS_H_
+
+#include <cstddef>
+
+#include <algorithm>
+#include <type_traits>
+#include <vector>
+
+namespace absl {
+namespace container_internal {
+namespace hashtable_debug_internal {
+
+// If it is a map, call get<0>().
+using std::get;
+template <typename T, typename = typename T::mapped_type>
+auto GetKey(const typename T::value_type& pair, int) -> decltype(get<0>(pair)) {
+  return get<0>(pair);
+}
+
+// If it is not a map, return the value directly.
+template <typename T>
+const typename T::key_type& GetKey(const typename T::key_type& key, char) {
+  return key;
+}
+
+// Containers should specialize this to provide debug information for that
+// container.
+template <class Container, typename Enabler = void>
+struct HashtableDebugAccess {
+  // Returns the number of probes required to find `key` in `c`.  The "number of
+  // probes" is a concept that can vary by container.  Implementations should
+  // return 0 when `key` was found in the minimum number of operations and
+  // should increment the result for each non-trivial operation required to find
+  // `key`.
+  //
+  // The default implementation uses the bucket api from the standard and thus
+  // works for `std::unordered_*` containers.
+  static size_t GetNumProbes(const Container& c,
+                             const typename Container::key_type& key) {
+    if (!c.bucket_count()) return {};
+    size_t num_probes = 0;
+    size_t bucket = c.bucket(key);
+    for (auto it = c.begin(bucket), e = c.end(bucket);; ++it, ++num_probes) {
+      if (it == e) return num_probes;
+      if (c.key_eq()(key, GetKey<Container>(*it, 0))) return num_probes;
+    }
+  }
+
+  // Returns the number of bytes requested from the allocator by the container
+  // and not freed.
+  //
+  // static size_t AllocatedByteSize(const Container& c);
+
+  // Returns a tight lower bound for AllocatedByteSize(c) where `c` is of type
+  // `Container` and `c.size()` is equal to `num_elements`.
+  //
+  // static size_t LowerBoundAllocatedByteSize(size_t num_elements);
+};
+
+}  // namespace hashtable_debug_internal
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASHTABLE_DEBUG_HOOKS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h
new file mode 100644 (file)
index 0000000..a308e78
--- /dev/null
@@ -0,0 +1,288 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: hashtablez_sampler.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the API for a low level library to sample hashtables
+// and collect runtime statistics about them.
+//
+// `HashtablezSampler` controls the lifecycle of `HashtablezInfo` objects which
+// store information about a single sample.
+//
+// `Record*` methods store information into samples.
+// `Sample()` and `Unsample()` make use of a single global sampler with
+// properties controlled by the flags hashtablez_enabled,
+// hashtablez_sample_rate, and hashtablez_max_samples.
+//
+// WARNING
+//
+// Using this sampling API may cause sampled Swiss tables to use the global
+// allocator (operator `new`) in addition to any custom allocator.  If you
+// are using a table in an unusual circumstance where allocation or calling a
+// linux syscall is unacceptable, this could interfere.
+//
+// This utility is internal-only. Use at your own risk.
+
+#ifndef ABSL_CONTAINER_INTERNAL_HASHTABLEZ_SAMPLER_H_
+#define ABSL_CONTAINER_INTERNAL_HASHTABLEZ_SAMPLER_H_
+
+#include <atomic>
+#include <functional>
+#include <memory>
+#include <vector>
+
+#include "absl/base/internal/per_thread_tls.h"
+#include "absl/base/optimization.h"
+#include "absl/container/internal/have_sse.h"
+#include "absl/synchronization/mutex.h"
+#include "absl/utility/utility.h"
+
+namespace absl {
+namespace container_internal {
+
+// Stores information about a sampled hashtable.  All mutations to this *must*
+// be made through `Record*` functions below.  All reads from this *must* only
+// occur in the callback to `HashtablezSampler::Iterate`.
+struct HashtablezInfo {
+  // Constructs the object but does not fill in any fields.
+  HashtablezInfo();
+  ~HashtablezInfo();
+  HashtablezInfo(const HashtablezInfo&) = delete;
+  HashtablezInfo& operator=(const HashtablezInfo&) = delete;
+
+  // Puts the object into a clean state, fills in the logically `const` members,
+  // blocking for any readers that are currently sampling the object.
+  void PrepareForSampling() EXCLUSIVE_LOCKS_REQUIRED(init_mu);
+
+  // These fields are mutated by the various Record* APIs and need to be
+  // thread-safe.
+  std::atomic<size_t> capacity;
+  std::atomic<size_t> size;
+  std::atomic<size_t> num_erases;
+  std::atomic<size_t> max_probe_length;
+  std::atomic<size_t> total_probe_length;
+  std::atomic<size_t> hashes_bitwise_or;
+  std::atomic<size_t> hashes_bitwise_and;
+
+  // `HashtablezSampler` maintains intrusive linked lists for all samples.  See
+  // comments on `HashtablezSampler::all_` for details on these.  `init_mu`
+  // guards the ability to restore the sample to a pristine state.  This
+  // prevents races with sampling and resurrecting an object.
+  absl::Mutex init_mu;
+  HashtablezInfo* next;
+  HashtablezInfo* dead GUARDED_BY(init_mu);
+
+  // All of the fields below are set by `PrepareForSampling`, they must not be
+  // mutated in `Record*` functions.  They are logically `const` in that sense.
+  // These are guarded by init_mu, but that is not externalized to clients, who
+  // can only read them during `HashtablezSampler::Iterate` which will hold the
+  // lock.
+  static constexpr int kMaxStackDepth = 64;
+  absl::Time create_time;
+  int32_t depth;
+  void* stack[kMaxStackDepth];
+};
+
+inline void RecordRehashSlow(HashtablezInfo* info, size_t total_probe_length) {
+#if SWISSTABLE_HAVE_SSE2
+  total_probe_length /= 16;
+#else
+  total_probe_length /= 8;
+#endif
+  info->total_probe_length.store(total_probe_length, std::memory_order_relaxed);
+  info->num_erases.store(0, std::memory_order_relaxed);
+}
+
+inline void RecordStorageChangedSlow(HashtablezInfo* info, size_t size,
+                                     size_t capacity) {
+  info->size.store(size, std::memory_order_relaxed);
+  info->capacity.store(capacity, std::memory_order_relaxed);
+  if (size == 0) {
+    // This is a clear, reset the total/num_erases too.
+    RecordRehashSlow(info, 0);
+  }
+}
+
+void RecordInsertSlow(HashtablezInfo* info, size_t hash,
+                      size_t distance_from_desired);
+
+inline void RecordEraseSlow(HashtablezInfo* info) {
+  info->size.fetch_sub(1, std::memory_order_relaxed);
+  info->num_erases.fetch_add(1, std::memory_order_relaxed);
+}
+
+HashtablezInfo* SampleSlow(int64_t* next_sample);
+void UnsampleSlow(HashtablezInfo* info);
+
+class HashtablezInfoHandle {
+ public:
+  explicit HashtablezInfoHandle() : info_(nullptr) {}
+  explicit HashtablezInfoHandle(HashtablezInfo* info) : info_(info) {}
+  ~HashtablezInfoHandle() {
+    if (ABSL_PREDICT_TRUE(info_ == nullptr)) return;
+    UnsampleSlow(info_);
+  }
+
+  HashtablezInfoHandle(const HashtablezInfoHandle&) = delete;
+  HashtablezInfoHandle& operator=(const HashtablezInfoHandle&) = delete;
+
+  HashtablezInfoHandle(HashtablezInfoHandle&& o) noexcept
+      : info_(absl::exchange(o.info_, nullptr)) {}
+  HashtablezInfoHandle& operator=(HashtablezInfoHandle&& o) noexcept {
+    if (ABSL_PREDICT_FALSE(info_ != nullptr)) {
+      UnsampleSlow(info_);
+    }
+    info_ = absl::exchange(o.info_, nullptr);
+    return *this;
+  }
+
+  inline void RecordStorageChanged(size_t size, size_t capacity) {
+    if (ABSL_PREDICT_TRUE(info_ == nullptr)) return;
+    RecordStorageChangedSlow(info_, size, capacity);
+  }
+
+  inline void RecordRehash(size_t total_probe_length) {
+    if (ABSL_PREDICT_TRUE(info_ == nullptr)) return;
+    RecordRehashSlow(info_, total_probe_length);
+  }
+
+  inline void RecordInsert(size_t hash, size_t distance_from_desired) {
+    if (ABSL_PREDICT_TRUE(info_ == nullptr)) return;
+    RecordInsertSlow(info_, hash, distance_from_desired);
+  }
+
+  inline void RecordErase() {
+    if (ABSL_PREDICT_TRUE(info_ == nullptr)) return;
+    RecordEraseSlow(info_);
+  }
+
+  friend inline void swap(HashtablezInfoHandle& lhs,
+                          HashtablezInfoHandle& rhs) {
+    std::swap(lhs.info_, rhs.info_);
+  }
+
+ private:
+  friend class HashtablezInfoHandlePeer;
+  HashtablezInfo* info_;
+};
+
+#if ABSL_PER_THREAD_TLS == 1
+extern ABSL_PER_THREAD_TLS_KEYWORD int64_t global_next_sample;
+#endif  // ABSL_PER_THREAD_TLS
+
+// Returns an RAII sampling handle that manages registration and unregistation
+// with the global sampler.
+inline HashtablezInfoHandle Sample() {
+#if ABSL_PER_THREAD_TLS == 0
+  static auto* mu = new absl::Mutex;
+  static int64_t global_next_sample = 0;
+  absl::MutexLock l(mu);
+#endif  // !ABSL_HAVE_THREAD_LOCAL
+
+  if (ABSL_PREDICT_TRUE(--global_next_sample > 0)) {
+    return HashtablezInfoHandle(nullptr);
+  }
+  return HashtablezInfoHandle(SampleSlow(&global_next_sample));
+}
+
+// Holds samples and their associated stack traces with a soft limit of
+// `SetHashtablezMaxSamples()`.
+//
+// Thread safe.
+class HashtablezSampler {
+ public:
+  // Returns a global Sampler.
+  static HashtablezSampler& Global();
+
+  HashtablezSampler();
+  ~HashtablezSampler();
+
+  // Registers for sampling.  Returns an opaque registration info.
+  HashtablezInfo* Register();
+
+  // Unregisters the sample.
+  void Unregister(HashtablezInfo* sample);
+
+  // The dispose callback will be called on all samples the moment they are
+  // being unregistered. Only affects samples that are unregistered after the
+  // callback has been set.
+  // Returns the previous callback.
+  using DisposeCallback = void (*)(const HashtablezInfo&);
+  DisposeCallback SetDisposeCallback(DisposeCallback f);
+
+  // Iterates over all the registered `StackInfo`s.  Returning the number of
+  // samples that have been dropped.
+  int64_t Iterate(const std::function<void(const HashtablezInfo& stack)>& f);
+
+ private:
+  void PushNew(HashtablezInfo* sample);
+  void PushDead(HashtablezInfo* sample);
+  HashtablezInfo* PopDead();
+
+  std::atomic<size_t> dropped_samples_;
+  std::atomic<size_t> size_estimate_;
+
+  // Intrusive lock free linked lists for tracking samples.
+  //
+  // `all_` records all samples (they are never removed from this list) and is
+  // terminated with a `nullptr`.
+  //
+  // `graveyard_.dead` is a circular linked list.  When it is empty,
+  // `graveyard_.dead == &graveyard`.  The list is circular so that
+  // every item on it (even the last) has a non-null dead pointer.  This allows
+  // `Iterate` to determine if a given sample is live or dead using only
+  // information on the sample itself.
+  //
+  // For example, nodes [A, B, C, D, E] with [A, C, E] alive and [B, D] dead
+  // looks like this (G is the Graveyard):
+  //
+  //           +---+    +---+    +---+    +---+    +---+
+  //    all -->| A |--->| B |--->| C |--->| D |--->| E |
+  //           |   |    |   |    |   |    |   |    |   |
+  //   +---+   |   | +->|   |-+  |   | +->|   |-+  |   |
+  //   | G |   +---+ |  +---+ |  +---+ |  +---+ |  +---+
+  //   |   |         |        |        |        |
+  //   |   | --------+        +--------+        |
+  //   +---+                                    |
+  //     ^                                      |
+  //     +--------------------------------------+
+  //
+  std::atomic<HashtablezInfo*> all_;
+  HashtablezInfo graveyard_;
+
+  std::atomic<DisposeCallback> dispose_;
+};
+
+// Enables or disables sampling for Swiss tables.
+void SetHashtablezEnabled(bool enabled);
+
+// Sets the rate at which Swiss tables will be sampled.
+void SetHashtablezSampleParameter(int32_t rate);
+
+// Sets a soft max for the number of samples that will be kept.
+void SetHashtablezMaxSamples(int32_t max);
+
+// Configuration override.
+// This allows process-wide sampling without depending on order of
+// initialization of static storage duration objects.
+// The definition of this constant is weak, which allows us to inject a
+// different value for it at link time.
+extern "C" const bool kAbslContainerInternalSampleEverything;
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_HASHTABLEZ_SAMPLER_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/have_sse.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/have_sse.h
new file mode 100644 (file)
index 0000000..4341441
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Shared config probing for SSE instructions used in Swiss tables.
+#ifndef ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
+#define ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
+
+#ifndef SWISSTABLE_HAVE_SSE2
+#if defined(__SSE2__) ||  \
+    (defined(_MSC_VER) && \
+     (defined(_M_X64) || (defined(_M_IX86) && _M_IX86_FP >= 2)))
+#define SWISSTABLE_HAVE_SSE2 1
+#else
+#define SWISSTABLE_HAVE_SSE2 0
+#endif
+#endif
+
+#ifndef SWISSTABLE_HAVE_SSSE3
+#ifdef __SSSE3__
+#define SWISSTABLE_HAVE_SSSE3 1
+#else
+#define SWISSTABLE_HAVE_SSSE3 0
+#endif
+#endif
+
+#if SWISSTABLE_HAVE_SSSE3 && !SWISSTABLE_HAVE_SSE2
+#error "Bad configuration!"
+#endif
+
+#if SWISSTABLE_HAVE_SSE2
+#include <emmintrin.h>
+#endif
+
+#if SWISSTABLE_HAVE_SSSE3
+#include <tmmintrin.h>
+#endif
+
+#endif  // ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/inlined_vector.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/inlined_vector.h
new file mode 100644 (file)
index 0000000..0ab2d7d
--- /dev/null
@@ -0,0 +1,786 @@
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_INLINED_VECTOR_INTERNAL_H_
+#define ABSL_CONTAINER_INTERNAL_INLINED_VECTOR_INTERNAL_H_
+
+#include <cstddef>
+#include <cstring>
+#include <iterator>
+#include <memory>
+#include <utility>
+
+#include "absl/base/macros.h"
+#include "absl/container/internal/compressed_tuple.h"
+#include "absl/memory/memory.h"
+#include "absl/meta/type_traits.h"
+#include "absl/types/span.h"
+
+namespace absl {
+namespace inlined_vector_internal {
+
+template <typename Iterator>
+using IsAtLeastForwardIterator = std::is_convertible<
+    typename std::iterator_traits<Iterator>::iterator_category,
+    std::forward_iterator_tag>;
+
+template <typename AllocatorType>
+using IsMemcpyOk = absl::conjunction<
+    std::is_same<std::allocator<typename AllocatorType::value_type>,
+                 AllocatorType>,
+    absl::is_trivially_copy_constructible<typename AllocatorType::value_type>,
+    absl::is_trivially_copy_assignable<typename AllocatorType::value_type>,
+    absl::is_trivially_destructible<typename AllocatorType::value_type>>;
+
+template <typename AllocatorType, typename ValueType, typename SizeType>
+void DestroyElements(AllocatorType* alloc_ptr, ValueType* destroy_first,
+                     SizeType destroy_size) {
+  using AllocatorTraits = absl::allocator_traits<AllocatorType>;
+
+  if (destroy_first != nullptr) {
+    for (auto i = destroy_size; i != 0;) {
+      --i;
+      AllocatorTraits::destroy(*alloc_ptr, destroy_first + i);
+    }
+
+#ifndef NDEBUG
+    // Overwrite unused memory with `0xab` so we can catch uninitialized usage.
+    //
+    // Cast to `void*` to tell the compiler that we don't care that we might be
+    // scribbling on a vtable pointer.
+    auto* memory_ptr = static_cast<void*>(destroy_first);
+    auto memory_size = sizeof(ValueType) * destroy_size;
+    std::memset(memory_ptr, 0xab, memory_size);
+#endif  // NDEBUG
+  }
+}
+
+template <typename AllocatorType, typename ValueType, typename ValueAdapter,
+          typename SizeType>
+void ConstructElements(AllocatorType* alloc_ptr, ValueType* construct_first,
+                       ValueAdapter* values_ptr, SizeType construct_size) {
+  // If any construction fails, all completed constructions are rolled back.
+  for (SizeType i = 0; i < construct_size; ++i) {
+    ABSL_INTERNAL_TRY {
+      values_ptr->ConstructNext(alloc_ptr, construct_first + i);
+    }
+    ABSL_INTERNAL_CATCH_ANY {
+      inlined_vector_internal::DestroyElements(alloc_ptr, construct_first, i);
+
+      ABSL_INTERNAL_RETHROW;
+    }
+  }
+}
+
+template <typename ValueType, typename ValueAdapter, typename SizeType>
+void AssignElements(ValueType* assign_first, ValueAdapter* values_ptr,
+                    SizeType assign_size) {
+  for (SizeType i = 0; i < assign_size; ++i) {
+    values_ptr->AssignNext(assign_first + i);
+  }
+}
+
+template <typename AllocatorType>
+struct StorageView {
+  using pointer = typename AllocatorType::pointer;
+  using size_type = typename AllocatorType::size_type;
+
+  pointer data;
+  size_type size;
+  size_type capacity;
+};
+
+template <typename AllocatorType, typename Iterator>
+class IteratorValueAdapter {
+  using pointer = typename AllocatorType::pointer;
+  using AllocatorTraits = absl::allocator_traits<AllocatorType>;
+
+ public:
+  explicit IteratorValueAdapter(const Iterator& it) : it_(it) {}
+
+  void ConstructNext(AllocatorType* alloc_ptr, pointer construct_at) {
+    AllocatorTraits::construct(*alloc_ptr, construct_at, *it_);
+    ++it_;
+  }
+
+  void AssignNext(pointer assign_at) {
+    *assign_at = *it_;
+    ++it_;
+  }
+
+ private:
+  Iterator it_;
+};
+
+template <typename AllocatorType>
+class CopyValueAdapter {
+  using pointer = typename AllocatorType::pointer;
+  using const_pointer = typename AllocatorType::const_pointer;
+  using const_reference = typename AllocatorType::const_reference;
+  using AllocatorTraits = absl::allocator_traits<AllocatorType>;
+
+ public:
+  explicit CopyValueAdapter(const_reference v) : ptr_(std::addressof(v)) {}
+
+  void ConstructNext(AllocatorType* alloc_ptr, pointer construct_at) {
+    AllocatorTraits::construct(*alloc_ptr, construct_at, *ptr_);
+  }
+
+  void AssignNext(pointer assign_at) { *assign_at = *ptr_; }
+
+ private:
+  const_pointer ptr_;
+};
+
+template <typename AllocatorType>
+class DefaultValueAdapter {
+  using pointer = typename AllocatorType::pointer;
+  using value_type = typename AllocatorType::value_type;
+  using AllocatorTraits = absl::allocator_traits<AllocatorType>;
+
+ public:
+  explicit DefaultValueAdapter() {}
+
+  void ConstructNext(AllocatorType* alloc_ptr, pointer construct_at) {
+    AllocatorTraits::construct(*alloc_ptr, construct_at);
+  }
+
+  void AssignNext(pointer assign_at) { *assign_at = value_type(); }
+};
+
+template <typename AllocatorType>
+class AllocationTransaction {
+  using value_type = typename AllocatorType::value_type;
+  using pointer = typename AllocatorType::pointer;
+  using size_type = typename AllocatorType::size_type;
+  using AllocatorTraits = absl::allocator_traits<AllocatorType>;
+
+ public:
+  explicit AllocationTransaction(AllocatorType* alloc_ptr)
+      : alloc_data_(*alloc_ptr, nullptr) {}
+
+  AllocationTransaction(const AllocationTransaction&) = delete;
+  void operator=(const AllocationTransaction&) = delete;
+
+  AllocatorType& GetAllocator() { return alloc_data_.template get<0>(); }
+  pointer& GetData() { return alloc_data_.template get<1>(); }
+  size_type& GetCapacity() { return capacity_; }
+
+  bool DidAllocate() { return GetData() != nullptr; }
+  pointer Allocate(size_type capacity) {
+    GetData() = AllocatorTraits::allocate(GetAllocator(), capacity);
+    GetCapacity() = capacity;
+    return GetData();
+  }
+
+  ~AllocationTransaction() {
+    if (DidAllocate()) {
+      AllocatorTraits::deallocate(GetAllocator(), GetData(), GetCapacity());
+    }
+  }
+
+ private:
+  container_internal::CompressedTuple<AllocatorType, pointer> alloc_data_;
+  size_type capacity_ = 0;
+};
+
+template <typename AllocatorType>
+class ConstructionTransaction {
+  using pointer = typename AllocatorType::pointer;
+  using size_type = typename AllocatorType::size_type;
+
+ public:
+  explicit ConstructionTransaction(AllocatorType* alloc_ptr)
+      : alloc_data_(*alloc_ptr, nullptr) {}
+
+  ConstructionTransaction(const ConstructionTransaction&) = delete;
+  void operator=(const ConstructionTransaction&) = delete;
+
+  template <typename ValueAdapter>
+  void Construct(pointer data, ValueAdapter* values_ptr, size_type size) {
+    inlined_vector_internal::ConstructElements(std::addressof(GetAllocator()),
+                                               data, values_ptr, size);
+    GetData() = data;
+    GetSize() = size;
+  }
+  void Commit() {
+    GetData() = nullptr;
+    GetSize() = 0;
+  }
+
+  ~ConstructionTransaction() {
+    if (GetData() != nullptr) {
+      inlined_vector_internal::DestroyElements(std::addressof(GetAllocator()),
+                                               GetData(), GetSize());
+    }
+  }
+
+ private:
+  AllocatorType& GetAllocator() { return alloc_data_.template get<0>(); }
+  pointer& GetData() { return alloc_data_.template get<1>(); }
+  size_type& GetSize() { return size_; }
+
+  container_internal::CompressedTuple<AllocatorType, pointer> alloc_data_;
+  size_type size_ = 0;
+};
+
+template <typename T, size_t N, typename A>
+class Storage {
+ public:
+  using allocator_type = A;
+  using value_type = typename allocator_type::value_type;
+  using pointer = typename allocator_type::pointer;
+  using const_pointer = typename allocator_type::const_pointer;
+  using reference = typename allocator_type::reference;
+  using const_reference = typename allocator_type::const_reference;
+  using rvalue_reference = typename allocator_type::value_type&&;
+  using size_type = typename allocator_type::size_type;
+  using difference_type = typename allocator_type::difference_type;
+  using iterator = pointer;
+  using const_iterator = const_pointer;
+  using reverse_iterator = std::reverse_iterator<iterator>;
+  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+  using MoveIterator = std::move_iterator<iterator>;
+  using AllocatorTraits = absl::allocator_traits<allocator_type>;
+  using IsMemcpyOk = inlined_vector_internal::IsMemcpyOk<allocator_type>;
+
+  using StorageView = inlined_vector_internal::StorageView<allocator_type>;
+
+  template <typename Iterator>
+  using IteratorValueAdapter =
+      inlined_vector_internal::IteratorValueAdapter<allocator_type, Iterator>;
+  using CopyValueAdapter =
+      inlined_vector_internal::CopyValueAdapter<allocator_type>;
+  using DefaultValueAdapter =
+      inlined_vector_internal::DefaultValueAdapter<allocator_type>;
+
+  using AllocationTransaction =
+      inlined_vector_internal::AllocationTransaction<allocator_type>;
+  using ConstructionTransaction =
+      inlined_vector_internal::ConstructionTransaction<allocator_type>;
+
+  Storage() : metadata_() {}
+
+  explicit Storage(const allocator_type& alloc)
+      : metadata_(alloc, /* empty and inlined */ 0) {}
+
+  ~Storage() {
+    pointer data = GetIsAllocated() ? GetAllocatedData() : GetInlinedData();
+    inlined_vector_internal::DestroyElements(GetAllocPtr(), data, GetSize());
+    DeallocateIfAllocated();
+  }
+
+  size_type GetSize() const { return GetSizeAndIsAllocated() >> 1; }
+
+  bool GetIsAllocated() const { return GetSizeAndIsAllocated() & 1; }
+
+  pointer GetInlinedData() {
+    return reinterpret_cast<pointer>(
+        std::addressof(data_.inlined.inlined_data[0]));
+  }
+
+  const_pointer GetInlinedData() const {
+    return reinterpret_cast<const_pointer>(
+        std::addressof(data_.inlined.inlined_data[0]));
+  }
+
+  pointer GetAllocatedData() { return data_.allocated.allocated_data; }
+
+  const_pointer GetAllocatedData() const {
+    return data_.allocated.allocated_data;
+  }
+
+  size_type GetAllocatedCapacity() const {
+    return data_.allocated.allocated_capacity;
+  }
+
+  StorageView MakeStorageView() {
+    return GetIsAllocated() ? StorageView{GetAllocatedData(), GetSize(),
+                                          GetAllocatedCapacity()}
+                            : StorageView{GetInlinedData(), GetSize(),
+                                          static_cast<size_type>(N)};
+  }
+
+  allocator_type* GetAllocPtr() {
+    return std::addressof(metadata_.template get<0>());
+  }
+
+  const allocator_type* GetAllocPtr() const {
+    return std::addressof(metadata_.template get<0>());
+  }
+
+  void SetIsAllocated() { GetSizeAndIsAllocated() |= 1; }
+
+  void UnsetIsAllocated() {
+    SetIsAllocated();
+    GetSizeAndIsAllocated() -= 1;
+  }
+
+  void SetAllocatedSize(size_type size) {
+    GetSizeAndIsAllocated() = (size << 1) | static_cast<size_type>(1);
+  }
+
+  void SetInlinedSize(size_type size) { GetSizeAndIsAllocated() = size << 1; }
+
+  void SetSize(size_type size) {
+    GetSizeAndIsAllocated() =
+        (size << 1) | static_cast<size_type>(GetIsAllocated());
+  }
+
+  void AddSize(size_type count) { GetSizeAndIsAllocated() += count << 1; }
+
+  void SubtractSize(size_type count) {
+    assert(count <= GetSize());
+    GetSizeAndIsAllocated() -= count << 1;
+  }
+
+  void SetAllocatedData(pointer data, size_type capacity) {
+    data_.allocated.allocated_data = data;
+    data_.allocated.allocated_capacity = capacity;
+  }
+
+  void DeallocateIfAllocated() {
+    if (GetIsAllocated()) {
+      AllocatorTraits::deallocate(*GetAllocPtr(), GetAllocatedData(),
+                                  GetAllocatedCapacity());
+    }
+  }
+
+  void AcquireAllocation(AllocationTransaction* allocation_tx_ptr) {
+    SetAllocatedData(allocation_tx_ptr->GetData(),
+                     allocation_tx_ptr->GetCapacity());
+    allocation_tx_ptr->GetData() = nullptr;
+    allocation_tx_ptr->GetCapacity() = 0;
+  }
+
+  void MemcpyFrom(const Storage& other_storage) {
+    assert(IsMemcpyOk::value || other_storage.GetIsAllocated());
+
+    GetSizeAndIsAllocated() = other_storage.GetSizeAndIsAllocated();
+    data_ = other_storage.data_;
+  }
+
+  template <typename ValueAdapter>
+  void Initialize(ValueAdapter values, size_type new_size);
+
+  template <typename ValueAdapter>
+  void Assign(ValueAdapter values, size_type new_size);
+
+  template <typename ValueAdapter>
+  void Resize(ValueAdapter values, size_type new_size);
+
+  template <typename... Args>
+  reference EmplaceBack(Args&&... args);
+
+  iterator Erase(const_iterator from, const_iterator to);
+
+  void Reserve(size_type requested_capacity);
+
+  void ShrinkToFit();
+
+  void Swap(Storage* other_storage_ptr);
+
+ private:
+  size_type& GetSizeAndIsAllocated() { return metadata_.template get<1>(); }
+
+  const size_type& GetSizeAndIsAllocated() const {
+    return metadata_.template get<1>();
+  }
+
+  static size_type NextCapacityFrom(size_type current_capacity) {
+    return current_capacity * 2;
+  }
+
+  static size_type LegacyNextCapacityFrom(size_type current_capacity,
+                                          size_type requested_capacity) {
+    // TODO(johnsoncj): Get rid of this old behavior.
+    size_type new_capacity = current_capacity;
+    while (new_capacity < requested_capacity) {
+      new_capacity *= 2;
+    }
+    return new_capacity;
+  }
+
+  using Metadata =
+      container_internal::CompressedTuple<allocator_type, size_type>;
+
+  struct Allocated {
+    pointer allocated_data;
+    size_type allocated_capacity;
+  };
+
+  struct Inlined {
+    using InlinedDataElement =
+        absl::aligned_storage_t<sizeof(value_type), alignof(value_type)>;
+    InlinedDataElement inlined_data[N];
+  };
+
+  union Data {
+    Allocated allocated;
+    Inlined inlined;
+  };
+
+  Metadata metadata_;
+  Data data_;
+};
+
+template <typename T, size_t N, typename A>
+template <typename ValueAdapter>
+auto Storage<T, N, A>::Initialize(ValueAdapter values, size_type new_size)
+    -> void {
+  // Only callable from constructors!
+  assert(!GetIsAllocated());
+  assert(GetSize() == 0);
+
+  pointer construct_data;
+
+  if (new_size > static_cast<size_type>(N)) {
+    // Because this is only called from the `InlinedVector` constructors, it's
+    // safe to take on the allocation with size `0`. If `ConstructElements(...)`
+    // throws, deallocation will be automatically handled by `~Storage()`.
+    construct_data = AllocatorTraits::allocate(*GetAllocPtr(), new_size);
+    SetAllocatedData(construct_data, new_size);
+    SetIsAllocated();
+  } else {
+    construct_data = GetInlinedData();
+  }
+
+  inlined_vector_internal::ConstructElements(GetAllocPtr(), construct_data,
+                                             &values, new_size);
+
+  // Since the initial size was guaranteed to be `0` and the allocated bit is
+  // already correct for either case, *adding* `new_size` gives us the correct
+  // result faster than setting it directly.
+  AddSize(new_size);
+}
+
+template <typename T, size_t N, typename A>
+template <typename ValueAdapter>
+auto Storage<T, N, A>::Assign(ValueAdapter values, size_type new_size) -> void {
+  StorageView storage_view = MakeStorageView();
+
+  AllocationTransaction allocation_tx(GetAllocPtr());
+
+  absl::Span<value_type> assign_loop;
+  absl::Span<value_type> construct_loop;
+  absl::Span<value_type> destroy_loop;
+
+  if (new_size > storage_view.capacity) {
+    construct_loop = {allocation_tx.Allocate(new_size), new_size};
+    destroy_loop = {storage_view.data, storage_view.size};
+  } else if (new_size > storage_view.size) {
+    assign_loop = {storage_view.data, storage_view.size};
+    construct_loop = {storage_view.data + storage_view.size,
+                      new_size - storage_view.size};
+  } else {
+    assign_loop = {storage_view.data, new_size};
+    destroy_loop = {storage_view.data + new_size, storage_view.size - new_size};
+  }
+
+  inlined_vector_internal::AssignElements(assign_loop.data(), &values,
+                                          assign_loop.size());
+
+  inlined_vector_internal::ConstructElements(
+      GetAllocPtr(), construct_loop.data(), &values, construct_loop.size());
+
+  inlined_vector_internal::DestroyElements(GetAllocPtr(), destroy_loop.data(),
+                                           destroy_loop.size());
+
+  if (allocation_tx.DidAllocate()) {
+    DeallocateIfAllocated();
+    AcquireAllocation(&allocation_tx);
+    SetIsAllocated();
+  }
+
+  SetSize(new_size);
+}
+
+template <typename T, size_t N, typename A>
+template <typename ValueAdapter>
+auto Storage<T, N, A>::Resize(ValueAdapter values, size_type new_size) -> void {
+  StorageView storage_view = MakeStorageView();
+
+  AllocationTransaction allocation_tx(GetAllocPtr());
+  ConstructionTransaction construction_tx(GetAllocPtr());
+
+  IteratorValueAdapter<MoveIterator> move_values(
+      MoveIterator(storage_view.data));
+
+  absl::Span<value_type> construct_loop;
+  absl::Span<value_type> move_construct_loop;
+  absl::Span<value_type> destroy_loop;
+
+  if (new_size > storage_view.capacity) {
+    pointer new_data = allocation_tx.Allocate(
+        LegacyNextCapacityFrom(storage_view.capacity, new_size));
+
+    // Construct new objects in `new_data`
+    construct_loop = {new_data + storage_view.size,
+                      new_size - storage_view.size};
+
+    // Move all existing objects into `new_data`
+    move_construct_loop = {new_data, storage_view.size};
+
+    // Destroy all existing objects in `storage_view.data`
+    destroy_loop = {storage_view.data, storage_view.size};
+  } else if (new_size > storage_view.size) {
+    // Construct new objects in `storage_view.data`
+    construct_loop = {storage_view.data + storage_view.size,
+                      new_size - storage_view.size};
+  } else {
+    // Destroy end `storage_view.size - new_size` objects in `storage_view.data`
+    destroy_loop = {storage_view.data + new_size, storage_view.size - new_size};
+  }
+
+  construction_tx.Construct(construct_loop.data(), &values,
+                            construct_loop.size());
+
+  inlined_vector_internal::ConstructElements(
+      GetAllocPtr(), move_construct_loop.data(), &move_values,
+      move_construct_loop.size());
+
+  inlined_vector_internal::DestroyElements(GetAllocPtr(), destroy_loop.data(),
+                                           destroy_loop.size());
+
+  construction_tx.Commit();
+  if (allocation_tx.DidAllocate()) {
+    DeallocateIfAllocated();
+    AcquireAllocation(&allocation_tx);
+    SetIsAllocated();
+  }
+
+  SetSize(new_size);
+}
+
+template <typename T, size_t N, typename A>
+template <typename... Args>
+auto Storage<T, N, A>::EmplaceBack(Args&&... args) -> reference {
+  StorageView storage_view = MakeStorageView();
+
+  AllocationTransaction allocation_tx(GetAllocPtr());
+
+  IteratorValueAdapter<MoveIterator> move_values(
+      MoveIterator(storage_view.data));
+
+  pointer construct_data =
+      (storage_view.size == storage_view.capacity
+           ? allocation_tx.Allocate(NextCapacityFrom(storage_view.capacity))
+           : storage_view.data);
+
+  pointer last_ptr = construct_data + storage_view.size;
+  AllocatorTraits::construct(*GetAllocPtr(), last_ptr,
+                             std::forward<Args>(args)...);
+
+  if (allocation_tx.DidAllocate()) {
+    ABSL_INTERNAL_TRY {
+      inlined_vector_internal::ConstructElements(
+          GetAllocPtr(), allocation_tx.GetData(), &move_values,
+          storage_view.size);
+    }
+    ABSL_INTERNAL_CATCH_ANY {
+      AllocatorTraits::destroy(*GetAllocPtr(), last_ptr);
+      ABSL_INTERNAL_RETHROW;
+    }
+
+    inlined_vector_internal::DestroyElements(GetAllocPtr(), storage_view.data,
+                                             storage_view.size);
+
+    DeallocateIfAllocated();
+    AcquireAllocation(&allocation_tx);
+    SetIsAllocated();
+  }
+
+  AddSize(1);
+  return *last_ptr;
+}
+
+template <typename T, size_t N, typename A>
+auto Storage<T, N, A>::Erase(const_iterator from, const_iterator to)
+    -> iterator {
+  assert(from != to);
+
+  StorageView storage_view = MakeStorageView();
+
+  size_type erase_size = std::distance(from, to);
+  size_type erase_index =
+      std::distance(const_iterator(storage_view.data), from);
+  size_type erase_end_index = erase_index + erase_size;
+
+  IteratorValueAdapter<MoveIterator> move_values(
+      MoveIterator(storage_view.data + erase_end_index));
+
+  inlined_vector_internal::AssignElements(storage_view.data + erase_index,
+                                          &move_values,
+                                          storage_view.size - erase_end_index);
+
+  inlined_vector_internal::DestroyElements(
+      GetAllocPtr(), storage_view.data + (storage_view.size - erase_size),
+      erase_size);
+
+  SubtractSize(erase_size);
+  return iterator(storage_view.data + erase_index);
+}
+
+template <typename T, size_t N, typename A>
+auto Storage<T, N, A>::Reserve(size_type requested_capacity) -> void {
+  StorageView storage_view = MakeStorageView();
+
+  if (ABSL_PREDICT_FALSE(requested_capacity <= storage_view.capacity)) return;
+
+  AllocationTransaction allocation_tx(GetAllocPtr());
+
+  IteratorValueAdapter<MoveIterator> move_values(
+      MoveIterator(storage_view.data));
+
+  pointer new_data = allocation_tx.Allocate(
+      LegacyNextCapacityFrom(storage_view.capacity, requested_capacity));
+
+  inlined_vector_internal::ConstructElements(GetAllocPtr(), new_data,
+                                             &move_values, storage_view.size);
+
+  inlined_vector_internal::DestroyElements(GetAllocPtr(), storage_view.data,
+                                           storage_view.size);
+
+  DeallocateIfAllocated();
+  AcquireAllocation(&allocation_tx);
+  SetIsAllocated();
+}
+
+template <typename T, size_t N, typename A>
+auto Storage<T, N, A>::ShrinkToFit() -> void {
+  // May only be called on allocated instances!
+  assert(GetIsAllocated());
+
+  StorageView storage_view{GetAllocatedData(), GetSize(),
+                           GetAllocatedCapacity()};
+
+  AllocationTransaction allocation_tx(GetAllocPtr());
+
+  IteratorValueAdapter<MoveIterator> move_values(
+      MoveIterator(storage_view.data));
+
+  pointer construct_data;
+
+  if (storage_view.size <= static_cast<size_type>(N)) {
+    construct_data = GetInlinedData();
+  } else if (storage_view.size < GetAllocatedCapacity()) {
+    construct_data = allocation_tx.Allocate(storage_view.size);
+  } else {
+    return;
+  }
+
+  ABSL_INTERNAL_TRY {
+    inlined_vector_internal::ConstructElements(GetAllocPtr(), construct_data,
+                                               &move_values, storage_view.size);
+  }
+  ABSL_INTERNAL_CATCH_ANY {
+    // Writing to inlined data will trample on the existing state, thus it needs
+    // to be restored when a construction fails.
+    SetAllocatedData(storage_view.data, storage_view.capacity);
+    ABSL_INTERNAL_RETHROW;
+  }
+
+  inlined_vector_internal::DestroyElements(GetAllocPtr(), storage_view.data,
+                                           storage_view.size);
+
+  AllocatorTraits::deallocate(*GetAllocPtr(), storage_view.data,
+                              storage_view.capacity);
+
+  if (allocation_tx.DidAllocate()) {
+    AcquireAllocation(&allocation_tx);
+  } else {
+    UnsetIsAllocated();
+  }
+}
+
+template <typename T, size_t N, typename A>
+auto Storage<T, N, A>::Swap(Storage* other_storage_ptr) -> void {
+  using std::swap;
+  assert(this != other_storage_ptr);
+
+  if (GetIsAllocated() && other_storage_ptr->GetIsAllocated()) {
+    // Both are allocated, thus we can swap the allocations at the top level.
+
+    swap(data_.allocated, other_storage_ptr->data_.allocated);
+  } else if (!GetIsAllocated() && !other_storage_ptr->GetIsAllocated()) {
+    // Both are inlined, thus element-wise swap up to smaller size, then move
+    // the remaining elements.
+
+    Storage* small_ptr = this;
+    Storage* large_ptr = other_storage_ptr;
+    if (small_ptr->GetSize() > large_ptr->GetSize()) swap(small_ptr, large_ptr);
+
+    for (size_type i = 0; i < small_ptr->GetSize(); ++i) {
+      swap(small_ptr->GetInlinedData()[i], large_ptr->GetInlinedData()[i]);
+    }
+
+    IteratorValueAdapter<MoveIterator> move_values(
+        MoveIterator(large_ptr->GetInlinedData() + small_ptr->GetSize()));
+
+    inlined_vector_internal::ConstructElements(
+        large_ptr->GetAllocPtr(),
+        small_ptr->GetInlinedData() + small_ptr->GetSize(), &move_values,
+        large_ptr->GetSize() - small_ptr->GetSize());
+
+    inlined_vector_internal::DestroyElements(
+        large_ptr->GetAllocPtr(),
+        large_ptr->GetInlinedData() + small_ptr->GetSize(),
+        large_ptr->GetSize() - small_ptr->GetSize());
+  } else {
+    // One is allocated and the other is inlined, thus we first move the
+    // elements from the inlined instance to the inlined space in the allocated
+    // instance and then we can finish by having the other vector take on the
+    // allocation.
+
+    Storage* allocated_ptr = this;
+    Storage* inlined_ptr = other_storage_ptr;
+    if (!allocated_ptr->GetIsAllocated()) swap(allocated_ptr, inlined_ptr);
+
+    StorageView allocated_storage_view{allocated_ptr->GetAllocatedData(),
+                                       allocated_ptr->GetSize(),
+                                       allocated_ptr->GetAllocatedCapacity()};
+
+    IteratorValueAdapter<MoveIterator> move_values(
+        MoveIterator(inlined_ptr->GetInlinedData()));
+
+    ABSL_INTERNAL_TRY {
+      inlined_vector_internal::ConstructElements(
+          inlined_ptr->GetAllocPtr(), allocated_ptr->GetInlinedData(),
+          &move_values, inlined_ptr->GetSize());
+    }
+    ABSL_INTERNAL_CATCH_ANY {
+      // Writing to inlined data will trample on the existing state, thus it
+      // needs to be restored when a construction fails.
+      allocated_ptr->SetAllocatedData(allocated_storage_view.data,
+                                      allocated_storage_view.capacity);
+      ABSL_INTERNAL_RETHROW;
+    }
+
+    inlined_vector_internal::DestroyElements(inlined_ptr->GetAllocPtr(),
+                                             inlined_ptr->GetInlinedData(),
+                                             inlined_ptr->GetSize());
+
+    inlined_ptr->SetAllocatedData(allocated_storage_view.data,
+                                  allocated_storage_view.capacity);
+  }
+
+  // All cases swap the size, `is_allocated` boolean and the allocator.
+  swap(GetSizeAndIsAllocated(), other_storage_ptr->GetSizeAndIsAllocated());
+  swap(*GetAllocPtr(), *other_storage_ptr->GetAllocPtr());
+}
+
+}  // namespace inlined_vector_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_INLINED_VECTOR_INTERNAL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/layout.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/layout.h
new file mode 100644 (file)
index 0000000..bbdde50
--- /dev/null
@@ -0,0 +1,739 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//                           MOTIVATION AND TUTORIAL
+//
+// If you want to put in a single heap allocation N doubles followed by M ints,
+// it's easy if N and M are known at compile time.
+//
+//   struct S {
+//     double a[N];
+//     int b[M];
+//   };
+//
+//   S* p = new S;
+//
+// But what if N and M are known only in run time? Class template Layout to the
+// rescue! It's a portable generalization of the technique known as struct hack.
+//
+//   // This object will tell us everything we need to know about the memory
+//   // layout of double[N] followed by int[M]. It's structurally identical to
+//   // size_t[2] that stores N and M. It's very cheap to create.
+//   const Layout<double, int> layout(N, M);
+//
+//   // Allocate enough memory for both arrays. `AllocSize()` tells us how much
+//   // memory is needed. We are free to use any allocation function we want as
+//   // long as it returns aligned memory.
+//   std::unique_ptr<unsigned char[]> p(new unsigned char[layout.AllocSize()]);
+//
+//   // Obtain the pointer to the array of doubles.
+//   // Equivalent to `reinterpret_cast<double*>(p.get())`.
+//   //
+//   // We could have written layout.Pointer<0>(p) instead. If all the types are
+//   // unique you can use either form, but if some types are repeated you must
+//   // use the index form.
+//   double* a = layout.Pointer<double>(p.get());
+//
+//   // Obtain the pointer to the array of ints.
+//   // Equivalent to `reinterpret_cast<int*>(p.get() + N * 8)`.
+//   int* b = layout.Pointer<int>(p);
+//
+// If we are unable to specify sizes of all fields, we can pass as many sizes as
+// we can to `Partial()`. In return, it'll allow us to access the fields whose
+// locations and sizes can be computed from the provided information.
+// `Partial()` comes in handy when the array sizes are embedded into the
+// allocation.
+//
+//   // size_t[1] containing N, size_t[1] containing M, double[N], int[M].
+//   using L = Layout<size_t, size_t, double, int>;
+//
+//   unsigned char* Allocate(size_t n, size_t m) {
+//     const L layout(1, 1, n, m);
+//     unsigned char* p = new unsigned char[layout.AllocSize()];
+//     *layout.Pointer<0>(p) = n;
+//     *layout.Pointer<1>(p) = m;
+//     return p;
+//   }
+//
+//   void Use(unsigned char* p) {
+//     // First, extract N and M.
+//     // Specify that the first array has only one element. Using `prefix` we
+//     // can access the first two arrays but not more.
+//     constexpr auto prefix = L::Partial(1);
+//     size_t n = *prefix.Pointer<0>(p);
+//     size_t m = *prefix.Pointer<1>(p);
+//
+//     // Now we can get pointers to the payload.
+//     const L layout(1, 1, n, m);
+//     double* a = layout.Pointer<double>(p);
+//     int* b = layout.Pointer<int>(p);
+//   }
+//
+// The layout we used above combines fixed-size with dynamically-sized fields.
+// This is quite common. Layout is optimized for this use case and generates
+// optimal code. All computations that can be performed at compile time are
+// indeed performed at compile time.
+//
+// Efficiency tip: The order of fields matters. In `Layout<T1, ..., TN>` try to
+// ensure that `alignof(T1) >= ... >= alignof(TN)`. This way you'll have no
+// padding in between arrays.
+//
+// You can manually override the alignment of an array by wrapping the type in
+// `Aligned<T, N>`. `Layout<..., Aligned<T, N>, ...>` has exactly the same API
+// and behavior as `Layout<..., T, ...>` except that the first element of the
+// array of `T` is aligned to `N` (the rest of the elements follow without
+// padding). `N` cannot be less than `alignof(T)`.
+//
+// `AllocSize()` and `Pointer()` are the most basic methods for dealing with
+// memory layouts. Check out the reference or code below to discover more.
+//
+//                            EXAMPLE
+//
+//   // Immutable move-only string with sizeof equal to sizeof(void*). The
+//   // string size and the characters are kept in the same heap allocation.
+//   class CompactString {
+//    public:
+//     CompactString(const char* s = "") {
+//       const size_t size = strlen(s);
+//       // size_t[1] followed by char[size + 1].
+//       const L layout(1, size + 1);
+//       p_.reset(new unsigned char[layout.AllocSize()]);
+//       // If running under ASAN, mark the padding bytes, if any, to catch
+//       // memory errors.
+//       layout.PoisonPadding(p_.get());
+//       // Store the size in the allocation.
+//       *layout.Pointer<size_t>(p_.get()) = size;
+//       // Store the characters in the allocation.
+//       memcpy(layout.Pointer<char>(p_.get()), s, size + 1);
+//     }
+//
+//     size_t size() const {
+//       // Equivalent to reinterpret_cast<size_t&>(*p).
+//       return *L::Partial().Pointer<size_t>(p_.get());
+//     }
+//
+//     const char* c_str() const {
+//       // Equivalent to reinterpret_cast<char*>(p.get() + sizeof(size_t)).
+//       // The argument in Partial(1) specifies that we have size_t[1] in front
+//       // of the characters.
+//       return L::Partial(1).Pointer<char>(p_.get());
+//     }
+//
+//    private:
+//     // Our heap allocation contains a size_t followed by an array of chars.
+//     using L = Layout<size_t, char>;
+//     std::unique_ptr<unsigned char[]> p_;
+//   };
+//
+//   int main() {
+//     CompactString s = "hello";
+//     assert(s.size() == 5);
+//     assert(strcmp(s.c_str(), "hello") == 0);
+//   }
+//
+//                               DOCUMENTATION
+//
+// The interface exported by this file consists of:
+// - class `Layout<>` and its public members.
+// - The public members of class `internal_layout::LayoutImpl<>`. That class
+//   isn't intended to be used directly, and its name and template parameter
+//   list are internal implementation details, but the class itself provides
+//   most of the functionality in this file. See comments on its members for
+//   detailed documentation.
+//
+// `Layout<T1,... Tn>::Partial(count1,..., countm)` (where `m` <= `n`) returns a
+// `LayoutImpl<>` object. `Layout<T1,..., Tn> layout(count1,..., countn)`
+// creates a `Layout` object, which exposes the same functionality by inheriting
+// from `LayoutImpl<>`.
+
+#ifndef ABSL_CONTAINER_INTERNAL_LAYOUT_H_
+#define ABSL_CONTAINER_INTERNAL_LAYOUT_H_
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <ostream>
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <typeinfo>
+#include <utility>
+
+#ifdef ADDRESS_SANITIZER
+#include <sanitizer/asan_interface.h>
+#endif
+
+#include "absl/meta/type_traits.h"
+#include "absl/strings/str_cat.h"
+#include "absl/types/span.h"
+#include "absl/utility/utility.h"
+
+#if defined(__GXX_RTTI)
+#define ABSL_INTERNAL_HAS_CXA_DEMANGLE
+#endif
+
+#ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
+#include <cxxabi.h>
+#endif
+
+namespace absl {
+namespace container_internal {
+
+// A type wrapper that instructs `Layout` to use the specific alignment for the
+// array. `Layout<..., Aligned<T, N>, ...>` has exactly the same API
+// and behavior as `Layout<..., T, ...>` except that the first element of the
+// array of `T` is aligned to `N` (the rest of the elements follow without
+// padding).
+//
+// Requires: `N >= alignof(T)` and `N` is a power of 2.
+template <class T, size_t N>
+struct Aligned;
+
+namespace internal_layout {
+
+template <class T>
+struct NotAligned {};
+
+template <class T, size_t N>
+struct NotAligned<const Aligned<T, N>> {
+  static_assert(sizeof(T) == 0, "Aligned<T, N> cannot be const-qualified");
+};
+
+template <size_t>
+using IntToSize = size_t;
+
+template <class>
+using TypeToSize = size_t;
+
+template <class T>
+struct Type : NotAligned<T> {
+  using type = T;
+};
+
+template <class T, size_t N>
+struct Type<Aligned<T, N>> {
+  using type = T;
+};
+
+template <class T>
+struct SizeOf : NotAligned<T>, std::integral_constant<size_t, sizeof(T)> {};
+
+template <class T, size_t N>
+struct SizeOf<Aligned<T, N>> : std::integral_constant<size_t, sizeof(T)> {};
+
+// Note: workaround for https://gcc.gnu.org/PR88115
+template <class T>
+struct AlignOf : NotAligned<T> {
+  static constexpr size_t value = alignof(T);
+};
+
+template <class T, size_t N>
+struct AlignOf<Aligned<T, N>> {
+  static_assert(N % alignof(T) == 0,
+                "Custom alignment can't be lower than the type's alignment");
+  static constexpr size_t value = N;
+};
+
+// Does `Ts...` contain `T`?
+template <class T, class... Ts>
+using Contains = absl::disjunction<std::is_same<T, Ts>...>;
+
+template <class From, class To>
+using CopyConst =
+    typename std::conditional<std::is_const<From>::value, const To, To>::type;
+
+// Note: We're not qualifying this with absl:: because it doesn't compile under
+// MSVC.
+template <class T>
+using SliceType = Span<T>;
+
+// This namespace contains no types. It prevents functions defined in it from
+// being found by ADL.
+namespace adl_barrier {
+
+template <class Needle, class... Ts>
+constexpr size_t Find(Needle, Needle, Ts...) {
+  static_assert(!Contains<Needle, Ts...>(), "Duplicate element type");
+  return 0;
+}
+
+template <class Needle, class T, class... Ts>
+constexpr size_t Find(Needle, T, Ts...) {
+  return adl_barrier::Find(Needle(), Ts()...) + 1;
+}
+
+constexpr bool IsPow2(size_t n) { return !(n & (n - 1)); }
+
+// Returns `q * m` for the smallest `q` such that `q * m >= n`.
+// Requires: `m` is a power of two. It's enforced by IsLegalElementType below.
+constexpr size_t Align(size_t n, size_t m) { return (n + m - 1) & ~(m - 1); }
+
+constexpr size_t Min(size_t a, size_t b) { return b < a ? b : a; }
+
+constexpr size_t Max(size_t a) { return a; }
+
+template <class... Ts>
+constexpr size_t Max(size_t a, size_t b, Ts... rest) {
+  return adl_barrier::Max(b < a ? a : b, rest...);
+}
+
+template <class T>
+std::string TypeName() {
+  std::string out;
+  int status = 0;
+  char* demangled = nullptr;
+#ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
+  demangled = abi::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
+#endif
+  if (status == 0 && demangled != nullptr) {  // Demangling succeeded.
+    absl::StrAppend(&out, "<", demangled, ">");
+    free(demangled);
+  } else {
+#if defined(__GXX_RTTI) || defined(_CPPRTTI)
+    absl::StrAppend(&out, "<", typeid(T).name(), ">");
+#endif
+  }
+  return out;
+}
+
+}  // namespace adl_barrier
+
+template <bool C>
+using EnableIf = typename std::enable_if<C, int>::type;
+
+// Can `T` be a template argument of `Layout`?
+template <class T>
+using IsLegalElementType = std::integral_constant<
+    bool, !std::is_reference<T>::value && !std::is_volatile<T>::value &&
+              !std::is_reference<typename Type<T>::type>::value &&
+              !std::is_volatile<typename Type<T>::type>::value &&
+              adl_barrier::IsPow2(AlignOf<T>::value)>;
+
+template <class Elements, class SizeSeq, class OffsetSeq>
+class LayoutImpl;
+
+// Public base class of `Layout` and the result type of `Layout::Partial()`.
+//
+// `Elements...` contains all template arguments of `Layout` that created this
+// instance.
+//
+// `SizeSeq...` is `[0, NumSizes)` where `NumSizes` is the number of arguments
+// passed to `Layout::Partial()` or `Layout::Layout()`.
+//
+// `OffsetSeq...` is `[0, NumOffsets)` where `NumOffsets` is
+// `Min(sizeof...(Elements), NumSizes + 1)` (the number of arrays for which we
+// can compute offsets).
+template <class... Elements, size_t... SizeSeq, size_t... OffsetSeq>
+class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>,
+                 absl::index_sequence<OffsetSeq...>> {
+ private:
+  static_assert(sizeof...(Elements) > 0, "At least one field is required");
+  static_assert(absl::conjunction<IsLegalElementType<Elements>...>::value,
+                "Invalid element type (see IsLegalElementType)");
+
+  enum {
+    NumTypes = sizeof...(Elements),
+    NumSizes = sizeof...(SizeSeq),
+    NumOffsets = sizeof...(OffsetSeq),
+  };
+
+  // These are guaranteed by `Layout`.
+  static_assert(NumOffsets == adl_barrier::Min(NumTypes, NumSizes + 1),
+                "Internal error");
+  static_assert(NumTypes > 0, "Internal error");
+
+  // Returns the index of `T` in `Elements...`. Results in a compilation error
+  // if `Elements...` doesn't contain exactly one instance of `T`.
+  template <class T>
+  static constexpr size_t ElementIndex() {
+    static_assert(Contains<Type<T>, Type<typename Type<Elements>::type>...>(),
+                  "Type not found");
+    return adl_barrier::Find(Type<T>(),
+                             Type<typename Type<Elements>::type>()...);
+  }
+
+  template <size_t N>
+  using ElementAlignment =
+      AlignOf<typename std::tuple_element<N, std::tuple<Elements...>>::type>;
+
+ public:
+  // Element types of all arrays packed in a tuple.
+  using ElementTypes = std::tuple<typename Type<Elements>::type...>;
+
+  // Element type of the Nth array.
+  template <size_t N>
+  using ElementType = typename std::tuple_element<N, ElementTypes>::type;
+
+  constexpr explicit LayoutImpl(IntToSize<SizeSeq>... sizes)
+      : size_{sizes...} {}
+
+  // Alignment of the layout, equal to the strictest alignment of all elements.
+  // All pointers passed to the methods of layout must be aligned to this value.
+  static constexpr size_t Alignment() {
+    return adl_barrier::Max(AlignOf<Elements>::value...);
+  }
+
+  // Offset in bytes of the Nth array.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   assert(x.Offset<0>() == 0);   // The ints starts from 0.
+  //   assert(x.Offset<1>() == 16);  // The doubles starts from 16.
+  //
+  // Requires: `N <= NumSizes && N < sizeof...(Ts)`.
+  template <size_t N, EnableIf<N == 0> = 0>
+  constexpr size_t Offset() const {
+    return 0;
+  }
+
+  template <size_t N, EnableIf<N != 0> = 0>
+  constexpr size_t Offset() const {
+    static_assert(N < NumOffsets, "Index out of bounds");
+    return adl_barrier::Align(
+        Offset<N - 1>() + SizeOf<ElementType<N - 1>>() * size_[N - 1],
+        ElementAlignment<N>::value);
+  }
+
+  // Offset in bytes of the array with the specified element type. There must
+  // be exactly one such array and its zero-based index must be at most
+  // `NumSizes`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   assert(x.Offset<int>() == 0);      // The ints starts from 0.
+  //   assert(x.Offset<double>() == 16);  // The doubles starts from 16.
+  template <class T>
+  constexpr size_t Offset() const {
+    return Offset<ElementIndex<T>()>();
+  }
+
+  // Offsets in bytes of all arrays for which the offsets are known.
+  constexpr std::array<size_t, NumOffsets> Offsets() const {
+    return {{Offset<OffsetSeq>()...}};
+  }
+
+  // The number of elements in the Nth array. This is the Nth argument of
+  // `Layout::Partial()` or `Layout::Layout()` (zero-based).
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   assert(x.Size<0>() == 3);
+  //   assert(x.Size<1>() == 4);
+  //
+  // Requires: `N < NumSizes`.
+  template <size_t N>
+  constexpr size_t Size() const {
+    static_assert(N < NumSizes, "Index out of bounds");
+    return size_[N];
+  }
+
+  // The number of elements in the array with the specified element type.
+  // There must be exactly one such array and its zero-based index must be
+  // at most `NumSizes`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   assert(x.Size<int>() == 3);
+  //   assert(x.Size<double>() == 4);
+  template <class T>
+  constexpr size_t Size() const {
+    return Size<ElementIndex<T>()>();
+  }
+
+  // The number of elements of all arrays for which they are known.
+  constexpr std::array<size_t, NumSizes> Sizes() const {
+    return {{Size<SizeSeq>()...}};
+  }
+
+  // Pointer to the beginning of the Nth array.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];
+  //   int* ints = x.Pointer<0>(p);
+  //   double* doubles = x.Pointer<1>(p);
+  //
+  // Requires: `N <= NumSizes && N < sizeof...(Ts)`.
+  // Requires: `p` is aligned to `Alignment()`.
+  template <size_t N, class Char>
+  CopyConst<Char, ElementType<N>>* Pointer(Char* p) const {
+    using C = typename std::remove_const<Char>::type;
+    static_assert(
+        std::is_same<C, char>() || std::is_same<C, unsigned char>() ||
+            std::is_same<C, signed char>(),
+        "The argument must be a pointer to [const] [signed|unsigned] char");
+    constexpr size_t alignment = Alignment();
+    (void)alignment;
+    assert(reinterpret_cast<uintptr_t>(p) % alignment == 0);
+    return reinterpret_cast<CopyConst<Char, ElementType<N>>*>(p + Offset<N>());
+  }
+
+  // Pointer to the beginning of the array with the specified element type.
+  // There must be exactly one such array and its zero-based index must be at
+  // most `NumSizes`.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];
+  //   int* ints = x.Pointer<int>(p);
+  //   double* doubles = x.Pointer<double>(p);
+  //
+  // Requires: `p` is aligned to `Alignment()`.
+  template <class T, class Char>
+  CopyConst<Char, T>* Pointer(Char* p) const {
+    return Pointer<ElementIndex<T>()>(p);
+  }
+
+  // Pointers to all arrays for which pointers are known.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];
+  //
+  //   int* ints;
+  //   double* doubles;
+  //   std::tie(ints, doubles) = x.Pointers(p);
+  //
+  // Requires: `p` is aligned to `Alignment()`.
+  //
+  // Note: We're not using ElementType alias here because it does not compile
+  // under MSVC.
+  template <class Char>
+  std::tuple<CopyConst<
+      Char, typename std::tuple_element<OffsetSeq, ElementTypes>::type>*...>
+  Pointers(Char* p) const {
+    return std::tuple<CopyConst<Char, ElementType<OffsetSeq>>*...>(
+        Pointer<OffsetSeq>(p)...);
+  }
+
+  // The Nth array.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];
+  //   Span<int> ints = x.Slice<0>(p);
+  //   Span<double> doubles = x.Slice<1>(p);
+  //
+  // Requires: `N < NumSizes`.
+  // Requires: `p` is aligned to `Alignment()`.
+  template <size_t N, class Char>
+  SliceType<CopyConst<Char, ElementType<N>>> Slice(Char* p) const {
+    return SliceType<CopyConst<Char, ElementType<N>>>(Pointer<N>(p), Size<N>());
+  }
+
+  // The array with the specified element type. There must be exactly one
+  // such array and its zero-based index must be less than `NumSizes`.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];
+  //   Span<int> ints = x.Slice<int>(p);
+  //   Span<double> doubles = x.Slice<double>(p);
+  //
+  // Requires: `p` is aligned to `Alignment()`.
+  template <class T, class Char>
+  SliceType<CopyConst<Char, T>> Slice(Char* p) const {
+    return Slice<ElementIndex<T>()>(p);
+  }
+
+  // All arrays with known sizes.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];
+  //
+  //   Span<int> ints;
+  //   Span<double> doubles;
+  //   std::tie(ints, doubles) = x.Slices(p);
+  //
+  // Requires: `p` is aligned to `Alignment()`.
+  //
+  // Note: We're not using ElementType alias here because it does not compile
+  // under MSVC.
+  template <class Char>
+  std::tuple<SliceType<CopyConst<
+      Char, typename std::tuple_element<SizeSeq, ElementTypes>::type>>...>
+  Slices(Char* p) const {
+    // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63875 (fixed
+    // in 6.1).
+    (void)p;
+    return std::tuple<SliceType<CopyConst<Char, ElementType<SizeSeq>>>...>(
+        Slice<SizeSeq>(p)...);
+  }
+
+  // The size of the allocation that fits all arrays.
+  //
+  //   // int[3], 4 bytes of padding, double[4].
+  //   Layout<int, double> x(3, 4);
+  //   unsigned char* p = new unsigned char[x.AllocSize()];  // 48 bytes
+  //
+  // Requires: `NumSizes == sizeof...(Ts)`.
+  constexpr size_t AllocSize() const {
+    static_assert(NumTypes == NumSizes, "You must specify sizes of all fields");
+    return Offset<NumTypes - 1>() +
+           SizeOf<ElementType<NumTypes - 1>>() * size_[NumTypes - 1];
+  }
+
+  // If built with --config=asan, poisons padding bytes (if any) in the
+  // allocation. The pointer must point to a memory block at least
+  // `AllocSize()` bytes in length.
+  //
+  // `Char` must be `[const] [signed|unsigned] char`.
+  //
+  // Requires: `p` is aligned to `Alignment()`.
+  template <class Char, size_t N = NumOffsets - 1, EnableIf<N == 0> = 0>
+  void PoisonPadding(const Char* p) const {
+    Pointer<0>(p);  // verify the requirements on `Char` and `p`
+  }
+
+  template <class Char, size_t N = NumOffsets - 1, EnableIf<N != 0> = 0>
+  void PoisonPadding(const Char* p) const {
+    static_assert(N < NumOffsets, "Index out of bounds");
+    (void)p;
+#ifdef ADDRESS_SANITIZER
+    PoisonPadding<Char, N - 1>(p);
+    // The `if` is an optimization. It doesn't affect the observable behaviour.
+    if (ElementAlignment<N - 1>::value % ElementAlignment<N>::value) {
+      size_t start =
+          Offset<N - 1>() + SizeOf<ElementType<N - 1>>() * size_[N - 1];
+      ASAN_POISON_MEMORY_REGION(p + start, Offset<N>() - start);
+    }
+#endif
+  }
+
+  // Human-readable description of the memory layout. Useful for debugging.
+  // Slow.
+  //
+  //   // char[5], 3 bytes of padding, int[3], 4 bytes of padding, followed
+  //   // by an unknown number of doubles.
+  //   auto x = Layout<char, int, double>::Partial(5, 3);
+  //   assert(x.DebugString() ==
+  //          "@0<char>(1)[5]; @8<int>(4)[3]; @24<double>(8)");
+  //
+  // Each field is in the following format: @offset<type>(sizeof)[size] (<type>
+  // may be missing depending on the target platform). For example,
+  // @8<int>(4)[3] means that at offset 8 we have an array of ints, where each
+  // int is 4 bytes, and we have 3 of those ints. The size of the last field may
+  // be missing (as in the example above). Only fields with known offsets are
+  // described. Type names may differ across platforms: one compiler might
+  // produce "unsigned*" where another produces "unsigned int *".
+  std::string DebugString() const {
+    const auto offsets = Offsets();
+    const size_t sizes[] = {SizeOf<ElementType<OffsetSeq>>()...};
+    const std::string types[] = {
+        adl_barrier::TypeName<ElementType<OffsetSeq>>()...};
+    std::string res = absl::StrCat("@0", types[0], "(", sizes[0], ")");
+    for (size_t i = 0; i != NumOffsets - 1; ++i) {
+      absl::StrAppend(&res, "[", size_[i], "]; @", offsets[i + 1], types[i + 1],
+                      "(", sizes[i + 1], ")");
+    }
+    // NumSizes is a constant that may be zero. Some compilers cannot see that
+    // inside the if statement "size_[NumSizes - 1]" must be valid.
+    int last = static_cast<int>(NumSizes) - 1;
+    if (NumTypes == NumSizes && last >= 0) {
+      absl::StrAppend(&res, "[", size_[last], "]");
+    }
+    return res;
+  }
+
+ private:
+  // Arguments of `Layout::Partial()` or `Layout::Layout()`.
+  size_t size_[NumSizes > 0 ? NumSizes : 1];
+};
+
+template <size_t NumSizes, class... Ts>
+using LayoutType = LayoutImpl<
+    std::tuple<Ts...>, absl::make_index_sequence<NumSizes>,
+    absl::make_index_sequence<adl_barrier::Min(sizeof...(Ts), NumSizes + 1)>>;
+
+}  // namespace internal_layout
+
+// Descriptor of arrays of various types and sizes laid out in memory one after
+// another. See the top of the file for documentation.
+//
+// Check out the public API of internal_layout::LayoutImpl above. The type is
+// internal to the library but its methods are public, and they are inherited
+// by `Layout`.
+template <class... Ts>
+class Layout : public internal_layout::LayoutType<sizeof...(Ts), Ts...> {
+ public:
+  static_assert(sizeof...(Ts) > 0, "At least one field is required");
+  static_assert(
+      absl::conjunction<internal_layout::IsLegalElementType<Ts>...>::value,
+      "Invalid element type (see IsLegalElementType)");
+
+  // The result type of `Partial()` with `NumSizes` arguments.
+  template <size_t NumSizes>
+  using PartialType = internal_layout::LayoutType<NumSizes, Ts...>;
+
+  // `Layout` knows the element types of the arrays we want to lay out in
+  // memory but not the number of elements in each array.
+  // `Partial(size1, ..., sizeN)` allows us to specify the latter. The
+  // resulting immutable object can be used to obtain pointers to the
+  // individual arrays.
+  //
+  // It's allowed to pass fewer array sizes than the number of arrays. E.g.,
+  // if all you need is to the offset of the second array, you only need to
+  // pass one argument -- the number of elements in the first array.
+  //
+  //   // int[3] followed by 4 bytes of padding and an unknown number of
+  //   // doubles.
+  //   auto x = Layout<int, double>::Partial(3);
+  //   // doubles start at byte 16.
+  //   assert(x.Offset<1>() == 16);
+  //
+  // If you know the number of elements in all arrays, you can still call
+  // `Partial()` but it's more convenient to use the constructor of `Layout`.
+  //
+  //   Layout<int, double> x(3, 5);
+  //
+  // Note: The sizes of the arrays must be specified in number of elements,
+  // not in bytes.
+  //
+  // Requires: `sizeof...(Sizes) <= sizeof...(Ts)`.
+  // Requires: all arguments are convertible to `size_t`.
+  template <class... Sizes>
+  static constexpr PartialType<sizeof...(Sizes)> Partial(Sizes&&... sizes) {
+    static_assert(sizeof...(Sizes) <= sizeof...(Ts), "");
+    return PartialType<sizeof...(Sizes)>(absl::forward<Sizes>(sizes)...);
+  }
+
+  // Creates a layout with the sizes of all arrays specified. If you know
+  // only the sizes of the first N arrays (where N can be zero), you can use
+  // `Partial()` defined above. The constructor is essentially equivalent to
+  // calling `Partial()` and passing in all array sizes; the constructor is
+  // provided as a convenient abbreviation.
+  //
+  // Note: The sizes of the arrays must be specified in number of elements,
+  // not in bytes.
+  constexpr explicit Layout(internal_layout::TypeToSize<Ts>... sizes)
+      : internal_layout::LayoutType<sizeof...(Ts), Ts...>(sizes...) {}
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_LAYOUT_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/node_hash_policy.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/node_hash_policy.h
new file mode 100644 (file)
index 0000000..19b4fc0
--- /dev/null
@@ -0,0 +1,88 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Adapts a policy for nodes.
+//
+// The node policy should model:
+//
+// struct Policy {
+//   // Returns a new node allocated and constructed using the allocator, using
+//   // the specified arguments.
+//   template <class Alloc, class... Args>
+//   value_type* new_element(Alloc* alloc, Args&&... args) const;
+//
+//   // Destroys and deallocates node using the allocator.
+//   template <class Alloc>
+//   void delete_element(Alloc* alloc, value_type* node) const;
+// };
+//
+// It may also optionally define `value()` and `apply()`. For documentation on
+// these, see hash_policy_traits.h.
+
+#ifndef ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_
+#define ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_
+
+#include <cassert>
+#include <cstddef>
+#include <memory>
+#include <type_traits>
+#include <utility>
+
+namespace absl {
+namespace container_internal {
+
+template <class Reference, class Policy>
+struct node_hash_policy {
+  static_assert(std::is_lvalue_reference<Reference>::value, "");
+
+  using slot_type = typename std::remove_cv<
+      typename std::remove_reference<Reference>::type>::type*;
+
+  template <class Alloc, class... Args>
+  static void construct(Alloc* alloc, slot_type* slot, Args&&... args) {
+    *slot = Policy::new_element(alloc, std::forward<Args>(args)...);
+  }
+
+  template <class Alloc>
+  static void destroy(Alloc* alloc, slot_type* slot) {
+    Policy::delete_element(alloc, *slot);
+  }
+
+  template <class Alloc>
+  static void transfer(Alloc*, slot_type* new_slot, slot_type* old_slot) {
+    *new_slot = *old_slot;
+  }
+
+  static size_t space_used(const slot_type* slot) {
+    if (slot == nullptr) return Policy::element_space_used(nullptr);
+    return Policy::element_space_used(*slot);
+  }
+
+  static Reference element(slot_type* slot) { return **slot; }
+
+  template <class T, class P = Policy>
+  static auto value(T* elem) -> decltype(P::value(elem)) {
+    return P::value(elem);
+  }
+
+  template <class... Ts, class P = Policy>
+  static auto apply(Ts&&... ts) -> decltype(P::apply(std::forward<Ts>(ts)...)) {
+    return P::apply(std::forward<Ts>(ts)...);
+  }
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_NODE_HASH_POLICY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h
new file mode 100644 (file)
index 0000000..0014cf8
--- /dev/null
@@ -0,0 +1,185 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_RAW_HASH_MAP_H_
+#define ABSL_CONTAINER_INTERNAL_RAW_HASH_MAP_H_
+
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "absl/container/internal/container_memory.h"
+#include "absl/container/internal/raw_hash_set.h"  // IWYU pragma: export
+
+namespace absl {
+namespace container_internal {
+
+template <class Policy, class Hash, class Eq, class Alloc>
+class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
+  // P is Policy. It's passed as a template argument to support maps that have
+  // incomplete types as values, as in unordered_map<K, IncompleteType>.
+  // MappedReference<> may be a non-reference type.
+  template <class P>
+  using MappedReference = decltype(P::value(
+      std::addressof(std::declval<typename raw_hash_map::reference>())));
+
+  // MappedConstReference<> may be a non-reference type.
+  template <class P>
+  using MappedConstReference = decltype(P::value(
+      std::addressof(std::declval<typename raw_hash_map::const_reference>())));
+
+  using KeyArgImpl =
+      KeyArg<IsTransparent<Eq>::value && IsTransparent<Hash>::value>;
+
+ public:
+  using key_type = typename Policy::key_type;
+  using mapped_type = typename Policy::mapped_type;
+  template <class K>
+  using key_arg = typename KeyArgImpl::template type<K, key_type>;
+
+  static_assert(!std::is_reference<key_type>::value, "");
+  // TODO(alkis): remove this assertion and verify that reference mapped_type is
+  // supported.
+  static_assert(!std::is_reference<mapped_type>::value, "");
+
+  using iterator = typename raw_hash_map::raw_hash_set::iterator;
+  using const_iterator = typename raw_hash_map::raw_hash_set::const_iterator;
+
+  raw_hash_map() {}
+  using raw_hash_map::raw_hash_set::raw_hash_set;
+
+  // The last two template parameters ensure that both arguments are rvalues
+  // (lvalue arguments are handled by the overloads below). This is necessary
+  // for supporting bitfield arguments.
+  //
+  //   union { int n : 1; };
+  //   flat_hash_map<int, int> m;
+  //   m.insert_or_assign(n, n);
+  template <class K = key_type, class V = mapped_type, K* = nullptr,
+            V* = nullptr>
+  std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, V&& v) {
+    return insert_or_assign_impl(std::forward<K>(k), std::forward<V>(v));
+  }
+
+  template <class K = key_type, class V = mapped_type, K* = nullptr>
+  std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, const V& v) {
+    return insert_or_assign_impl(std::forward<K>(k), v);
+  }
+
+  template <class K = key_type, class V = mapped_type, V* = nullptr>
+  std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, V&& v) {
+    return insert_or_assign_impl(k, std::forward<V>(v));
+  }
+
+  template <class K = key_type, class V = mapped_type>
+  std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, const V& v) {
+    return insert_or_assign_impl(k, v);
+  }
+
+  template <class K = key_type, class V = mapped_type, K* = nullptr,
+            V* = nullptr>
+  iterator insert_or_assign(const_iterator, key_arg<K>&& k, V&& v) {
+    return insert_or_assign(std::forward<K>(k), std::forward<V>(v)).first;
+  }
+
+  template <class K = key_type, class V = mapped_type, K* = nullptr>
+  iterator insert_or_assign(const_iterator, key_arg<K>&& k, const V& v) {
+    return insert_or_assign(std::forward<K>(k), v).first;
+  }
+
+  template <class K = key_type, class V = mapped_type, V* = nullptr>
+  iterator insert_or_assign(const_iterator, const key_arg<K>& k, V&& v) {
+    return insert_or_assign(k, std::forward<V>(v)).first;
+  }
+
+  template <class K = key_type, class V = mapped_type>
+  iterator insert_or_assign(const_iterator, const key_arg<K>& k, const V& v) {
+    return insert_or_assign(k, v).first;
+  }
+
+  template <class K = key_type, class... Args,
+            typename std::enable_if<
+                !std::is_convertible<K, const_iterator>::value, int>::type = 0,
+            K* = nullptr>
+  std::pair<iterator, bool> try_emplace(key_arg<K>&& k, Args&&... args) {
+    return try_emplace_impl(std::forward<K>(k), std::forward<Args>(args)...);
+  }
+
+  template <class K = key_type, class... Args,
+            typename std::enable_if<
+                !std::is_convertible<K, const_iterator>::value, int>::type = 0>
+  std::pair<iterator, bool> try_emplace(const key_arg<K>& k, Args&&... args) {
+    return try_emplace_impl(k, std::forward<Args>(args)...);
+  }
+
+  template <class K = key_type, class... Args, K* = nullptr>
+  iterator try_emplace(const_iterator, key_arg<K>&& k, Args&&... args) {
+    return try_emplace(std::forward<K>(k), std::forward<Args>(args)...).first;
+  }
+
+  template <class K = key_type, class... Args>
+  iterator try_emplace(const_iterator, const key_arg<K>& k, Args&&... args) {
+    return try_emplace(k, std::forward<Args>(args)...).first;
+  }
+
+  template <class K = key_type, class P = Policy>
+  MappedReference<P> at(const key_arg<K>& key) {
+    auto it = this->find(key);
+    if (it == this->end()) std::abort();
+    return Policy::value(&*it);
+  }
+
+  template <class K = key_type, class P = Policy>
+  MappedConstReference<P> at(const key_arg<K>& key) const {
+    auto it = this->find(key);
+    if (it == this->end()) std::abort();
+    return Policy::value(&*it);
+  }
+
+  template <class K = key_type, class P = Policy, K* = nullptr>
+  MappedReference<P> operator[](key_arg<K>&& key) {
+    return Policy::value(&*try_emplace(std::forward<K>(key)).first);
+  }
+
+  template <class K = key_type, class P = Policy>
+  MappedReference<P> operator[](const key_arg<K>& key) {
+    return Policy::value(&*try_emplace(key).first);
+  }
+
+ private:
+  template <class K, class V>
+  std::pair<iterator, bool> insert_or_assign_impl(K&& k, V&& v) {
+    auto res = this->find_or_prepare_insert(k);
+    if (res.second)
+      this->emplace_at(res.first, std::forward<K>(k), std::forward<V>(v));
+    else
+      Policy::value(&*this->iterator_at(res.first)) = std::forward<V>(v);
+    return {this->iterator_at(res.first), res.second};
+  }
+
+  template <class K = key_type, class... Args>
+  std::pair<iterator, bool> try_emplace_impl(K&& k, Args&&... args) {
+    auto res = this->find_or_prepare_insert(k);
+    if (res.second)
+      this->emplace_at(res.first, std::piecewise_construct,
+                       std::forward_as_tuple(std::forward<K>(k)),
+                       std::forward_as_tuple(std::forward<Args>(args)...));
+    return {this->iterator_at(res.first), res.second};
+  }
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_RAW_HASH_MAP_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
new file mode 100644 (file)
index 0000000..c4889cd
--- /dev/null
@@ -0,0 +1,1846 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// An open-addressing
+// hashtable with quadratic probing.
+//
+// This is a low level hashtable on top of which different interfaces can be
+// implemented, like flat_hash_set, node_hash_set, string_hash_set, etc.
+//
+// The table interface is similar to that of std::unordered_set. Notable
+// differences are that most member functions support heterogeneous keys when
+// BOTH the hash and eq functions are marked as transparent. They do so by
+// providing a typedef called `is_transparent`.
+//
+// When heterogeneous lookup is enabled, functions that take key_type act as if
+// they have an overload set like:
+//
+//   iterator find(const key_type& key);
+//   template <class K>
+//   iterator find(const K& key);
+//
+//   size_type erase(const key_type& key);
+//   template <class K>
+//   size_type erase(const K& key);
+//
+//   std::pair<iterator, iterator> equal_range(const key_type& key);
+//   template <class K>
+//   std::pair<iterator, iterator> equal_range(const K& key);
+//
+// When heterogeneous lookup is disabled, only the explicit `key_type` overloads
+// exist.
+//
+// find() also supports passing the hash explicitly:
+//
+//   iterator find(const key_type& key, size_t hash);
+//   template <class U>
+//   iterator find(const U& key, size_t hash);
+//
+// In addition the pointer to element and iterator stability guarantees are
+// weaker: all iterators and pointers are invalidated after a new element is
+// inserted.
+//
+// IMPLEMENTATION DETAILS
+//
+// The table stores elements inline in a slot array. In addition to the slot
+// array the table maintains some control state per slot. The extra state is one
+// byte per slot and stores empty or deleted marks, or alternatively 7 bits from
+// the hash of an occupied slot. The table is split into logical groups of
+// slots, like so:
+//
+//      Group 1         Group 2        Group 3
+// +---------------+---------------+---------------+
+// | | | | | | | | | | | | | | | | | | | | | | | | |
+// +---------------+---------------+---------------+
+//
+// On lookup the hash is split into two parts:
+// - H2: 7 bits (those stored in the control bytes)
+// - H1: the rest of the bits
+// The groups are probed using H1. For each group the slots are matched to H2 in
+// parallel. Because H2 is 7 bits (128 states) and the number of slots per group
+// is low (8 or 16) in almost all cases a match in H2 is also a lookup hit.
+//
+// On insert, once the right group is found (as in lookup), its slots are
+// filled in order.
+//
+// On erase a slot is cleared. In case the group did not have any empty slots
+// before the erase, the erased slot is marked as deleted.
+//
+// Groups without empty slots (but maybe with deleted slots) extend the probe
+// sequence. The probing algorithm is quadratic. Given N the number of groups,
+// the probing function for the i'th probe is:
+//
+//   P(0) = H1 % N
+//
+//   P(i) = (P(i - 1) + i) % N
+//
+// This probing function guarantees that after N probes, all the groups of the
+// table will be probed exactly once.
+
+#ifndef ABSL_CONTAINER_INTERNAL_RAW_HASH_SET_H_
+#define ABSL_CONTAINER_INTERNAL_RAW_HASH_SET_H_
+
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <cstring>
+#include <iterator>
+#include <limits>
+#include <memory>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "absl/base/internal/bits.h"
+#include "absl/base/internal/endian.h"
+#include "absl/base/port.h"
+#include "absl/container/internal/common.h"
+#include "absl/container/internal/compressed_tuple.h"
+#include "absl/container/internal/container_memory.h"
+#include "absl/container/internal/hash_policy_traits.h"
+#include "absl/container/internal/hashtable_debug_hooks.h"
+#include "absl/container/internal/hashtablez_sampler.h"
+#include "absl/container/internal/have_sse.h"
+#include "absl/container/internal/layout.h"
+#include "absl/memory/memory.h"
+#include "absl/meta/type_traits.h"
+#include "absl/utility/utility.h"
+
+namespace absl {
+namespace container_internal {
+
+template <size_t Width>
+class probe_seq {
+ public:
+  probe_seq(size_t hash, size_t mask) {
+    assert(((mask + 1) & mask) == 0 && "not a mask");
+    mask_ = mask;
+    offset_ = hash & mask_;
+  }
+  size_t offset() const { return offset_; }
+  size_t offset(size_t i) const { return (offset_ + i) & mask_; }
+
+  void next() {
+    index_ += Width;
+    offset_ += index_;
+    offset_ &= mask_;
+  }
+  // 0-based probe index. The i-th probe in the probe sequence.
+  size_t index() const { return index_; }
+
+ private:
+  size_t mask_;
+  size_t offset_;
+  size_t index_ = 0;
+};
+
+template <class ContainerKey, class Hash, class Eq>
+struct RequireUsableKey {
+  template <class PassedKey, class... Args>
+  std::pair<
+      decltype(std::declval<const Hash&>()(std::declval<const PassedKey&>())),
+      decltype(std::declval<const Eq&>()(std::declval<const ContainerKey&>(),
+                                         std::declval<const PassedKey&>()))>*
+  operator()(const PassedKey&, const Args&...) const;
+};
+
+template <class E, class Policy, class Hash, class Eq, class... Ts>
+struct IsDecomposable : std::false_type {};
+
+template <class Policy, class Hash, class Eq, class... Ts>
+struct IsDecomposable<
+    absl::void_t<decltype(
+        Policy::apply(RequireUsableKey<typename Policy::key_type, Hash, Eq>(),
+                      std::declval<Ts>()...))>,
+    Policy, Hash, Eq, Ts...> : std::true_type {};
+
+// TODO(alkis): Switch to std::is_nothrow_swappable when gcc/clang supports it.
+template <class T>
+constexpr bool IsNoThrowSwappable() {
+  using std::swap;
+  return noexcept(swap(std::declval<T&>(), std::declval<T&>()));
+}
+
+template <typename T>
+int TrailingZeros(T x) {
+  return sizeof(T) == 8 ? base_internal::CountTrailingZerosNonZero64(
+                              static_cast<uint64_t>(x))
+                        : base_internal::CountTrailingZerosNonZero32(
+                              static_cast<uint32_t>(x));
+}
+
+template <typename T>
+int LeadingZeros(T x) {
+  return sizeof(T) == 8
+             ? base_internal::CountLeadingZeros64(static_cast<uint64_t>(x))
+             : base_internal::CountLeadingZeros32(static_cast<uint32_t>(x));
+}
+
+// An abstraction over a bitmask. It provides an easy way to iterate through the
+// indexes of the set bits of a bitmask.  When Shift=0 (platforms with SSE),
+// this is a true bitmask.  On non-SSE, platforms the arithematic used to
+// emulate the SSE behavior works in bytes (Shift=3) and leaves each bytes as
+// either 0x00 or 0x80.
+//
+// For example:
+//   for (int i : BitMask<uint32_t, 16>(0x5)) -> yields 0, 2
+//   for (int i : BitMask<uint64_t, 8, 3>(0x0000000080800000)) -> yields 2, 3
+template <class T, int SignificantBits, int Shift = 0>
+class BitMask {
+  static_assert(std::is_unsigned<T>::value, "");
+  static_assert(Shift == 0 || Shift == 3, "");
+
+ public:
+  // These are useful for unit tests (gunit).
+  using value_type = int;
+  using iterator = BitMask;
+  using const_iterator = BitMask;
+
+  explicit BitMask(T mask) : mask_(mask) {}
+  BitMask& operator++() {
+    mask_ &= (mask_ - 1);
+    return *this;
+  }
+  explicit operator bool() const { return mask_ != 0; }
+  int operator*() const { return LowestBitSet(); }
+  int LowestBitSet() const {
+    return container_internal::TrailingZeros(mask_) >> Shift;
+  }
+  int HighestBitSet() const {
+    return (sizeof(T) * CHAR_BIT - container_internal::LeadingZeros(mask_) -
+            1) >>
+           Shift;
+  }
+
+  BitMask begin() const { return *this; }
+  BitMask end() const { return BitMask(0); }
+
+  int TrailingZeros() const {
+    return container_internal::TrailingZeros(mask_) >> Shift;
+  }
+
+  int LeadingZeros() const {
+    constexpr int total_significant_bits = SignificantBits << Shift;
+    constexpr int extra_bits = sizeof(T) * 8 - total_significant_bits;
+    return container_internal::LeadingZeros(mask_ << extra_bits) >> Shift;
+  }
+
+ private:
+  friend bool operator==(const BitMask& a, const BitMask& b) {
+    return a.mask_ == b.mask_;
+  }
+  friend bool operator!=(const BitMask& a, const BitMask& b) {
+    return a.mask_ != b.mask_;
+  }
+
+  T mask_;
+};
+
+using ctrl_t = signed char;
+using h2_t = uint8_t;
+
+// The values here are selected for maximum performance. See the static asserts
+// below for details.
+enum Ctrl : ctrl_t {
+  kEmpty = -128,   // 0b10000000
+  kDeleted = -2,   // 0b11111110
+  kSentinel = -1,  // 0b11111111
+};
+static_assert(
+    kEmpty & kDeleted & kSentinel & 0x80,
+    "Special markers need to have the MSB to make checking for them efficient");
+static_assert(kEmpty < kSentinel && kDeleted < kSentinel,
+              "kEmpty and kDeleted must be smaller than kSentinel to make the "
+              "SIMD test of IsEmptyOrDeleted() efficient");
+static_assert(kSentinel == -1,
+              "kSentinel must be -1 to elide loading it from memory into SIMD "
+              "registers (pcmpeqd xmm, xmm)");
+static_assert(kEmpty == -128,
+              "kEmpty must be -128 to make the SIMD check for its "
+              "existence efficient (psignb xmm, xmm)");
+static_assert(~kEmpty & ~kDeleted & kSentinel & 0x7F,
+              "kEmpty and kDeleted must share an unset bit that is not shared "
+              "by kSentinel to make the scalar test for MatchEmptyOrDeleted() "
+              "efficient");
+static_assert(kDeleted == -2,
+              "kDeleted must be -2 to make the implementation of "
+              "ConvertSpecialToEmptyAndFullToDeleted efficient");
+
+// A single block of empty control bytes for tables without any slots allocated.
+// This enables removing a branch in the hot path of find().
+inline ctrl_t* EmptyGroup() {
+  alignas(16) static constexpr ctrl_t empty_group[] = {
+      kSentinel, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty,
+      kEmpty,    kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty};
+  return const_cast<ctrl_t*>(empty_group);
+}
+
+// Mixes a randomly generated per-process seed with `hash` and `ctrl` to
+// randomize insertion order within groups.
+bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl);
+
+// Returns a hash seed.
+//
+// The seed consists of the ctrl_ pointer, which adds enough entropy to ensure
+// non-determinism of iteration order in most cases.
+inline size_t HashSeed(const ctrl_t* ctrl) {
+  // The low bits of the pointer have little or no entropy because of
+  // alignment. We shift the pointer to try to use higher entropy bits. A
+  // good number seems to be 12 bits, because that aligns with page size.
+  return reinterpret_cast<uintptr_t>(ctrl) >> 12;
+}
+
+inline size_t H1(size_t hash, const ctrl_t* ctrl) {
+  return (hash >> 7) ^ HashSeed(ctrl);
+}
+inline ctrl_t H2(size_t hash) { return hash & 0x7F; }
+
+inline bool IsEmpty(ctrl_t c) { return c == kEmpty; }
+inline bool IsFull(ctrl_t c) { return c >= 0; }
+inline bool IsDeleted(ctrl_t c) { return c == kDeleted; }
+inline bool IsEmptyOrDeleted(ctrl_t c) { return c < kSentinel; }
+
+#if SWISSTABLE_HAVE_SSE2
+
+// https://github.com/abseil/abseil-cpp/issues/209
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87853
+// _mm_cmpgt_epi8 is broken under GCC with -funsigned-char
+// Work around this by using the portable implementation of Group
+// when using -funsigned-char under GCC.
+inline __m128i _mm_cmpgt_epi8_fixed(__m128i a, __m128i b) {
+#if defined(__GNUC__) && !defined(__clang__)
+  if (std::is_unsigned<char>::value) {
+    const __m128i mask = _mm_set1_epi8(0x80);
+    const __m128i diff = _mm_subs_epi8(b, a);
+    return _mm_cmpeq_epi8(_mm_and_si128(diff, mask), mask);
+  }
+#endif
+  return _mm_cmpgt_epi8(a, b);
+}
+
+struct GroupSse2Impl {
+  static constexpr size_t kWidth = 16;  // the number of slots per group
+
+  explicit GroupSse2Impl(const ctrl_t* pos) {
+    ctrl = _mm_loadu_si128(reinterpret_cast<const __m128i*>(pos));
+  }
+
+  // Returns a bitmask representing the positions of slots that match hash.
+  BitMask<uint32_t, kWidth> Match(h2_t hash) const {
+    auto match = _mm_set1_epi8(hash);
+    return BitMask<uint32_t, kWidth>(
+        _mm_movemask_epi8(_mm_cmpeq_epi8(match, ctrl)));
+  }
+
+  // Returns a bitmask representing the positions of empty slots.
+  BitMask<uint32_t, kWidth> MatchEmpty() const {
+#if SWISSTABLE_HAVE_SSSE3
+    // This only works because kEmpty is -128.
+    return BitMask<uint32_t, kWidth>(
+        _mm_movemask_epi8(_mm_sign_epi8(ctrl, ctrl)));
+#else
+    return Match(static_cast<h2_t>(kEmpty));
+#endif
+  }
+
+  // Returns a bitmask representing the positions of empty or deleted slots.
+  BitMask<uint32_t, kWidth> MatchEmptyOrDeleted() const {
+    auto special = _mm_set1_epi8(kSentinel);
+    return BitMask<uint32_t, kWidth>(
+        _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)));
+  }
+
+  // Returns the number of trailing empty or deleted elements in the group.
+  uint32_t CountLeadingEmptyOrDeleted() const {
+    auto special = _mm_set1_epi8(kSentinel);
+    return TrailingZeros(
+        _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1);
+  }
+
+  void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
+    auto msbs = _mm_set1_epi8(static_cast<char>(-128));
+    auto x126 = _mm_set1_epi8(126);
+#if SWISSTABLE_HAVE_SSSE3
+    auto res = _mm_or_si128(_mm_shuffle_epi8(x126, ctrl), msbs);
+#else
+    auto zero = _mm_setzero_si128();
+    auto special_mask = _mm_cmpgt_epi8_fixed(zero, ctrl);
+    auto res = _mm_or_si128(msbs, _mm_andnot_si128(special_mask, x126));
+#endif
+    _mm_storeu_si128(reinterpret_cast<__m128i*>(dst), res);
+  }
+
+  __m128i ctrl;
+};
+#endif  // SWISSTABLE_HAVE_SSE2
+
+struct GroupPortableImpl {
+  static constexpr size_t kWidth = 8;
+
+  explicit GroupPortableImpl(const ctrl_t* pos)
+      : ctrl(little_endian::Load64(pos)) {}
+
+  BitMask<uint64_t, kWidth, 3> Match(h2_t hash) const {
+    // For the technique, see:
+    // http://graphics.stanford.edu/~seander/bithacks.html##ValueInWord
+    // (Determine if a word has a byte equal to n).
+    //
+    // Caveat: there are false positives but:
+    // - they only occur if there is a real match
+    // - they never occur on kEmpty, kDeleted, kSentinel
+    // - they will be handled gracefully by subsequent checks in code
+    //
+    // Example:
+    //   v = 0x1716151413121110
+    //   hash = 0x12
+    //   retval = (v - lsbs) & ~v & msbs = 0x0000000080800000
+    constexpr uint64_t msbs = 0x8080808080808080ULL;
+    constexpr uint64_t lsbs = 0x0101010101010101ULL;
+    auto x = ctrl ^ (lsbs * hash);
+    return BitMask<uint64_t, kWidth, 3>((x - lsbs) & ~x & msbs);
+  }
+
+  BitMask<uint64_t, kWidth, 3> MatchEmpty() const {
+    constexpr uint64_t msbs = 0x8080808080808080ULL;
+    return BitMask<uint64_t, kWidth, 3>((ctrl & (~ctrl << 6)) & msbs);
+  }
+
+  BitMask<uint64_t, kWidth, 3> MatchEmptyOrDeleted() const {
+    constexpr uint64_t msbs = 0x8080808080808080ULL;
+    return BitMask<uint64_t, kWidth, 3>((ctrl & (~ctrl << 7)) & msbs);
+  }
+
+  uint32_t CountLeadingEmptyOrDeleted() const {
+    constexpr uint64_t gaps = 0x00FEFEFEFEFEFEFEULL;
+    return (TrailingZeros(((~ctrl & (ctrl >> 7)) | gaps) + 1) + 7) >> 3;
+  }
+
+  void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
+    constexpr uint64_t msbs = 0x8080808080808080ULL;
+    constexpr uint64_t lsbs = 0x0101010101010101ULL;
+    auto x = ctrl & msbs;
+    auto res = (~x + (x >> 7)) & ~lsbs;
+    little_endian::Store64(dst, res);
+  }
+
+  uint64_t ctrl;
+};
+
+#if SWISSTABLE_HAVE_SSE2
+using Group = GroupSse2Impl;
+#else
+using Group = GroupPortableImpl;
+#endif
+
+template <class Policy, class Hash, class Eq, class Alloc>
+class raw_hash_set;
+
+inline bool IsValidCapacity(size_t n) { return ((n + 1) & n) == 0 && n > 0; }
+
+// PRECONDITION:
+//   IsValidCapacity(capacity)
+//   ctrl[capacity] == kSentinel
+//   ctrl[i] != kSentinel for all i < capacity
+// Applies mapping for every byte in ctrl:
+//   DELETED -> EMPTY
+//   EMPTY -> EMPTY
+//   FULL -> DELETED
+inline void ConvertDeletedToEmptyAndFullToDeleted(
+    ctrl_t* ctrl, size_t capacity) {
+  assert(ctrl[capacity] == kSentinel);
+  assert(IsValidCapacity(capacity));
+  for (ctrl_t* pos = ctrl; pos != ctrl + capacity + 1; pos += Group::kWidth) {
+    Group{pos}.ConvertSpecialToEmptyAndFullToDeleted(pos);
+  }
+  // Copy the cloned ctrl bytes.
+  std::memcpy(ctrl + capacity + 1, ctrl, Group::kWidth);
+  ctrl[capacity] = kSentinel;
+}
+
+// Rounds up the capacity to the next power of 2 minus 1, with a minimum of 1.
+inline size_t NormalizeCapacity(size_t n) {
+  return n ? ~size_t{} >> LeadingZeros(n) : 1;
+}
+
+// We use 7/8th as maximum load factor.
+// For 16-wide groups, that gives an average of two empty slots per group.
+inline size_t CapacityToGrowth(size_t capacity) {
+  assert(IsValidCapacity(capacity));
+  // `capacity*7/8`
+  if (Group::kWidth == 8 && capacity == 7) {
+    // x-x/8 does not work when x==7.
+    return 6;
+  }
+  return capacity - capacity / 8;
+}
+// From desired "growth" to a lowerbound of the necessary capacity.
+// Might not be a valid one and required NormalizeCapacity().
+inline size_t GrowthToLowerboundCapacity(size_t growth) {
+  // `growth*8/7`
+  if (Group::kWidth == 8 && growth == 7) {
+    // x+(x-1)/7 does not work when x==7.
+    return 8;
+  }
+  return growth + static_cast<size_t>((static_cast<int64_t>(growth) - 1) / 7);
+}
+
+// Policy: a policy defines how to perform different operations on
+// the slots of the hashtable (see hash_policy_traits.h for the full interface
+// of policy).
+//
+// Hash: a (possibly polymorphic) functor that hashes keys of the hashtable. The
+// functor should accept a key and return size_t as hash. For best performance
+// it is important that the hash function provides high entropy across all bits
+// of the hash.
+//
+// Eq: a (possibly polymorphic) functor that compares two keys for equality. It
+// should accept two (of possibly different type) keys and return a bool: true
+// if they are equal, false if they are not. If two keys compare equal, then
+// their hash values as defined by Hash MUST be equal.
+//
+// Allocator: an Allocator [https://devdocs.io/cpp/concept/allocator] with which
+// the storage of the hashtable will be allocated and the elements will be
+// constructed and destroyed.
+template <class Policy, class Hash, class Eq, class Alloc>
+class raw_hash_set {
+  using PolicyTraits = hash_policy_traits<Policy>;
+  using KeyArgImpl =
+      KeyArg<IsTransparent<Eq>::value && IsTransparent<Hash>::value>;
+
+ public:
+  using init_type = typename PolicyTraits::init_type;
+  using key_type = typename PolicyTraits::key_type;
+  // TODO(sbenza): Hide slot_type as it is an implementation detail. Needs user
+  // code fixes!
+  using slot_type = typename PolicyTraits::slot_type;
+  using allocator_type = Alloc;
+  using size_type = size_t;
+  using difference_type = ptrdiff_t;
+  using hasher = Hash;
+  using key_equal = Eq;
+  using policy_type = Policy;
+  using value_type = typename PolicyTraits::value_type;
+  using reference = value_type&;
+  using const_reference = const value_type&;
+  using pointer = typename absl::allocator_traits<
+      allocator_type>::template rebind_traits<value_type>::pointer;
+  using const_pointer = typename absl::allocator_traits<
+      allocator_type>::template rebind_traits<value_type>::const_pointer;
+
+  // Alias used for heterogeneous lookup functions.
+  // `key_arg<K>` evaluates to `K` when the functors are transparent and to
+  // `key_type` otherwise. It permits template argument deduction on `K` for the
+  // transparent case.
+  template <class K>
+  using key_arg = typename KeyArgImpl::template type<K, key_type>;
+
+ private:
+  // Give an early error when key_type is not hashable/eq.
+  auto KeyTypeCanBeHashed(const Hash& h, const key_type& k) -> decltype(h(k));
+  auto KeyTypeCanBeEq(const Eq& eq, const key_type& k) -> decltype(eq(k, k));
+
+  using Layout = absl::container_internal::Layout<ctrl_t, slot_type>;
+
+  static Layout MakeLayout(size_t capacity) {
+    assert(IsValidCapacity(capacity));
+    return Layout(capacity + Group::kWidth + 1, capacity);
+  }
+
+  using AllocTraits = absl::allocator_traits<allocator_type>;
+  using SlotAlloc = typename absl::allocator_traits<
+      allocator_type>::template rebind_alloc<slot_type>;
+  using SlotAllocTraits = typename absl::allocator_traits<
+      allocator_type>::template rebind_traits<slot_type>;
+
+  static_assert(std::is_lvalue_reference<reference>::value,
+                "Policy::element() must return a reference");
+
+  template <typename T>
+  struct SameAsElementReference
+      : std::is_same<typename std::remove_cv<
+                         typename std::remove_reference<reference>::type>::type,
+                     typename std::remove_cv<
+                         typename std::remove_reference<T>::type>::type> {};
+
+  // An enabler for insert(T&&): T must be convertible to init_type or be the
+  // same as [cv] value_type [ref].
+  // Note: we separate SameAsElementReference into its own type to avoid using
+  // reference unless we need to. MSVC doesn't seem to like it in some
+  // cases.
+  template <class T>
+  using RequiresInsertable = typename std::enable_if<
+      absl::disjunction<std::is_convertible<T, init_type>,
+                        SameAsElementReference<T>>::value,
+      int>::type;
+
+  // RequiresNotInit is a workaround for gcc prior to 7.1.
+  // See https://godbolt.org/g/Y4xsUh.
+  template <class T>
+  using RequiresNotInit =
+      typename std::enable_if<!std::is_same<T, init_type>::value, int>::type;
+
+  template <class... Ts>
+  using IsDecomposable = IsDecomposable<void, PolicyTraits, Hash, Eq, Ts...>;
+
+ public:
+  static_assert(std::is_same<pointer, value_type*>::value,
+                "Allocators with custom pointer types are not supported");
+  static_assert(std::is_same<const_pointer, const value_type*>::value,
+                "Allocators with custom pointer types are not supported");
+
+  class iterator {
+    friend class raw_hash_set;
+
+   public:
+    using iterator_category = std::forward_iterator_tag;
+    using value_type = typename raw_hash_set::value_type;
+    using reference =
+        absl::conditional_t<PolicyTraits::constant_iterators::value,
+                            const value_type&, value_type&>;
+    using pointer = absl::remove_reference_t<reference>*;
+    using difference_type = typename raw_hash_set::difference_type;
+
+    iterator() {}
+
+    // PRECONDITION: not an end() iterator.
+    reference operator*() const { return PolicyTraits::element(slot_); }
+
+    // PRECONDITION: not an end() iterator.
+    pointer operator->() const { return &operator*(); }
+
+    // PRECONDITION: not an end() iterator.
+    iterator& operator++() {
+      ++ctrl_;
+      ++slot_;
+      skip_empty_or_deleted();
+      return *this;
+    }
+    // PRECONDITION: not an end() iterator.
+    iterator operator++(int) {
+      auto tmp = *this;
+      ++*this;
+      return tmp;
+    }
+
+    friend bool operator==(const iterator& a, const iterator& b) {
+      return a.ctrl_ == b.ctrl_;
+    }
+    friend bool operator!=(const iterator& a, const iterator& b) {
+      return !(a == b);
+    }
+
+   private:
+    iterator(ctrl_t* ctrl) : ctrl_(ctrl) {}  // for end()
+    iterator(ctrl_t* ctrl, slot_type* slot) : ctrl_(ctrl), slot_(slot) {}
+
+    void skip_empty_or_deleted() {
+      while (IsEmptyOrDeleted(*ctrl_)) {
+        // ctrl is not necessarily aligned to Group::kWidth. It is also likely
+        // to read past the space for ctrl bytes and into slots. This is ok
+        // because ctrl has sizeof() == 1 and slot has sizeof() >= 1 so there
+        // is no way to read outside the combined slot array.
+        uint32_t shift = Group{ctrl_}.CountLeadingEmptyOrDeleted();
+        ctrl_ += shift;
+        slot_ += shift;
+      }
+    }
+
+    ctrl_t* ctrl_ = nullptr;
+    // To avoid uninitialized member warnigs, put slot_ in an anonymous union.
+    // The member is not initialized on singleton and end iterators.
+    union {
+      slot_type* slot_;
+    };
+  };
+
+  class const_iterator {
+    friend class raw_hash_set;
+
+   public:
+    using iterator_category = typename iterator::iterator_category;
+    using value_type = typename raw_hash_set::value_type;
+    using reference = typename raw_hash_set::const_reference;
+    using pointer = typename raw_hash_set::const_pointer;
+    using difference_type = typename raw_hash_set::difference_type;
+
+    const_iterator() {}
+    // Implicit construction from iterator.
+    const_iterator(iterator i) : inner_(std::move(i)) {}
+
+    reference operator*() const { return *inner_; }
+    pointer operator->() const { return inner_.operator->(); }
+
+    const_iterator& operator++() {
+      ++inner_;
+      return *this;
+    }
+    const_iterator operator++(int) { return inner_++; }
+
+    friend bool operator==(const const_iterator& a, const const_iterator& b) {
+      return a.inner_ == b.inner_;
+    }
+    friend bool operator!=(const const_iterator& a, const const_iterator& b) {
+      return !(a == b);
+    }
+
+   private:
+    const_iterator(const ctrl_t* ctrl, const slot_type* slot)
+        : inner_(const_cast<ctrl_t*>(ctrl), const_cast<slot_type*>(slot)) {}
+
+    iterator inner_;
+  };
+
+  using node_type = node_handle<Policy, hash_policy_traits<Policy>, Alloc>;
+  using insert_return_type = InsertReturnType<iterator, node_type>;
+
+  raw_hash_set() noexcept(
+      std::is_nothrow_default_constructible<hasher>::value&&
+          std::is_nothrow_default_constructible<key_equal>::value&&
+              std::is_nothrow_default_constructible<allocator_type>::value) {}
+
+  explicit raw_hash_set(size_t bucket_count, const hasher& hash = hasher(),
+                        const key_equal& eq = key_equal(),
+                        const allocator_type& alloc = allocator_type())
+      : ctrl_(EmptyGroup()), settings_(0, hash, eq, alloc) {
+    if (bucket_count) {
+      capacity_ = NormalizeCapacity(bucket_count);
+      reset_growth_left();
+      initialize_slots();
+    }
+  }
+
+  raw_hash_set(size_t bucket_count, const hasher& hash,
+               const allocator_type& alloc)
+      : raw_hash_set(bucket_count, hash, key_equal(), alloc) {}
+
+  raw_hash_set(size_t bucket_count, const allocator_type& alloc)
+      : raw_hash_set(bucket_count, hasher(), key_equal(), alloc) {}
+
+  explicit raw_hash_set(const allocator_type& alloc)
+      : raw_hash_set(0, hasher(), key_equal(), alloc) {}
+
+  template <class InputIter>
+  raw_hash_set(InputIter first, InputIter last, size_t bucket_count = 0,
+               const hasher& hash = hasher(), const key_equal& eq = key_equal(),
+               const allocator_type& alloc = allocator_type())
+      : raw_hash_set(bucket_count, hash, eq, alloc) {
+    insert(first, last);
+  }
+
+  template <class InputIter>
+  raw_hash_set(InputIter first, InputIter last, size_t bucket_count,
+               const hasher& hash, const allocator_type& alloc)
+      : raw_hash_set(first, last, bucket_count, hash, key_equal(), alloc) {}
+
+  template <class InputIter>
+  raw_hash_set(InputIter first, InputIter last, size_t bucket_count,
+               const allocator_type& alloc)
+      : raw_hash_set(first, last, bucket_count, hasher(), key_equal(), alloc) {}
+
+  template <class InputIter>
+  raw_hash_set(InputIter first, InputIter last, const allocator_type& alloc)
+      : raw_hash_set(first, last, 0, hasher(), key_equal(), alloc) {}
+
+  // Instead of accepting std::initializer_list<value_type> as the first
+  // argument like std::unordered_set<value_type> does, we have two overloads
+  // that accept std::initializer_list<T> and std::initializer_list<init_type>.
+  // This is advantageous for performance.
+  //
+  //   // Turns {"abc", "def"} into std::initializer_list<std::string>, then
+  //   // copies the strings into the set.
+  //   std::unordered_set<std::string> s = {"abc", "def"};
+  //
+  //   // Turns {"abc", "def"} into std::initializer_list<const char*>, then
+  //   // copies the strings into the set.
+  //   absl::flat_hash_set<std::string> s = {"abc", "def"};
+  //
+  // The same trick is used in insert().
+  //
+  // The enabler is necessary to prevent this constructor from triggering where
+  // the copy constructor is meant to be called.
+  //
+  //   absl::flat_hash_set<int> a, b{a};
+  //
+  // RequiresNotInit<T> is a workaround for gcc prior to 7.1.
+  template <class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
+  raw_hash_set(std::initializer_list<T> init, size_t bucket_count = 0,
+               const hasher& hash = hasher(), const key_equal& eq = key_equal(),
+               const allocator_type& alloc = allocator_type())
+      : raw_hash_set(init.begin(), init.end(), bucket_count, hash, eq, alloc) {}
+
+  raw_hash_set(std::initializer_list<init_type> init, size_t bucket_count = 0,
+               const hasher& hash = hasher(), const key_equal& eq = key_equal(),
+               const allocator_type& alloc = allocator_type())
+      : raw_hash_set(init.begin(), init.end(), bucket_count, hash, eq, alloc) {}
+
+  template <class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
+  raw_hash_set(std::initializer_list<T> init, size_t bucket_count,
+               const hasher& hash, const allocator_type& alloc)
+      : raw_hash_set(init, bucket_count, hash, key_equal(), alloc) {}
+
+  raw_hash_set(std::initializer_list<init_type> init, size_t bucket_count,
+               const hasher& hash, const allocator_type& alloc)
+      : raw_hash_set(init, bucket_count, hash, key_equal(), alloc) {}
+
+  template <class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
+  raw_hash_set(std::initializer_list<T> init, size_t bucket_count,
+               const allocator_type& alloc)
+      : raw_hash_set(init, bucket_count, hasher(), key_equal(), alloc) {}
+
+  raw_hash_set(std::initializer_list<init_type> init, size_t bucket_count,
+               const allocator_type& alloc)
+      : raw_hash_set(init, bucket_count, hasher(), key_equal(), alloc) {}
+
+  template <class T, RequiresNotInit<T> = 0, RequiresInsertable<T> = 0>
+  raw_hash_set(std::initializer_list<T> init, const allocator_type& alloc)
+      : raw_hash_set(init, 0, hasher(), key_equal(), alloc) {}
+
+  raw_hash_set(std::initializer_list<init_type> init,
+               const allocator_type& alloc)
+      : raw_hash_set(init, 0, hasher(), key_equal(), alloc) {}
+
+  raw_hash_set(const raw_hash_set& that)
+      : raw_hash_set(that, AllocTraits::select_on_container_copy_construction(
+                               that.alloc_ref())) {}
+
+  raw_hash_set(const raw_hash_set& that, const allocator_type& a)
+      : raw_hash_set(0, that.hash_ref(), that.eq_ref(), a) {
+    reserve(that.size());
+    // Because the table is guaranteed to be empty, we can do something faster
+    // than a full `insert`.
+    for (const auto& v : that) {
+      const size_t hash = PolicyTraits::apply(HashElement{hash_ref()}, v);
+      auto target = find_first_non_full(hash);
+      set_ctrl(target.offset, H2(hash));
+      emplace_at(target.offset, v);
+      infoz_.RecordInsert(hash, target.probe_length);
+    }
+    size_ = that.size();
+    growth_left() -= that.size();
+  }
+
+  raw_hash_set(raw_hash_set&& that) noexcept(
+      std::is_nothrow_copy_constructible<hasher>::value&&
+          std::is_nothrow_copy_constructible<key_equal>::value&&
+              std::is_nothrow_copy_constructible<allocator_type>::value)
+      : ctrl_(absl::exchange(that.ctrl_, EmptyGroup())),
+        slots_(absl::exchange(that.slots_, nullptr)),
+        size_(absl::exchange(that.size_, 0)),
+        capacity_(absl::exchange(that.capacity_, 0)),
+        infoz_(absl::exchange(that.infoz_, HashtablezInfoHandle())),
+        // Hash, equality and allocator are copied instead of moved because
+        // `that` must be left valid. If Hash is std::function<Key>, moving it
+        // would create a nullptr functor that cannot be called.
+        settings_(that.settings_) {
+    // growth_left was copied above, reset the one from `that`.
+    that.growth_left() = 0;
+  }
+
+  raw_hash_set(raw_hash_set&& that, const allocator_type& a)
+      : ctrl_(EmptyGroup()),
+        slots_(nullptr),
+        size_(0),
+        capacity_(0),
+        settings_(0, that.hash_ref(), that.eq_ref(), a) {
+    if (a == that.alloc_ref()) {
+      std::swap(ctrl_, that.ctrl_);
+      std::swap(slots_, that.slots_);
+      std::swap(size_, that.size_);
+      std::swap(capacity_, that.capacity_);
+      std::swap(growth_left(), that.growth_left());
+      std::swap(infoz_, that.infoz_);
+    } else {
+      reserve(that.size());
+      // Note: this will copy elements of dense_set and unordered_set instead of
+      // moving them. This can be fixed if it ever becomes an issue.
+      for (auto& elem : that) insert(std::move(elem));
+    }
+  }
+
+  raw_hash_set& operator=(const raw_hash_set& that) {
+    raw_hash_set tmp(that,
+                     AllocTraits::propagate_on_container_copy_assignment::value
+                         ? that.alloc_ref()
+                         : alloc_ref());
+    swap(tmp);
+    return *this;
+  }
+
+  raw_hash_set& operator=(raw_hash_set&& that) noexcept(
+      absl::allocator_traits<allocator_type>::is_always_equal::value&&
+          std::is_nothrow_move_assignable<hasher>::value&&
+              std::is_nothrow_move_assignable<key_equal>::value) {
+    // TODO(sbenza): We should only use the operations from the noexcept clause
+    // to make sure we actually adhere to that contract.
+    return move_assign(
+        std::move(that),
+        typename AllocTraits::propagate_on_container_move_assignment());
+  }
+
+  ~raw_hash_set() { destroy_slots(); }
+
+  iterator begin() {
+    auto it = iterator_at(0);
+    it.skip_empty_or_deleted();
+    return it;
+  }
+  iterator end() { return {ctrl_ + capacity_}; }
+
+  const_iterator begin() const {
+    return const_cast<raw_hash_set*>(this)->begin();
+  }
+  const_iterator end() const { return const_cast<raw_hash_set*>(this)->end(); }
+  const_iterator cbegin() const { return begin(); }
+  const_iterator cend() const { return end(); }
+
+  bool empty() const { return !size(); }
+  size_t size() const { return size_; }
+  size_t capacity() const { return capacity_; }
+  size_t max_size() const { return (std::numeric_limits<size_t>::max)(); }
+
+  ABSL_ATTRIBUTE_REINITIALIZES void clear() {
+    // Iterating over this container is O(bucket_count()). When bucket_count()
+    // is much greater than size(), iteration becomes prohibitively expensive.
+    // For clear() it is more important to reuse the allocated array when the
+    // container is small because allocation takes comparatively long time
+    // compared to destruction of the elements of the container. So we pick the
+    // largest bucket_count() threshold for which iteration is still fast and
+    // past that we simply deallocate the array.
+    if (capacity_ > 127) {
+      destroy_slots();
+    } else if (capacity_) {
+      for (size_t i = 0; i != capacity_; ++i) {
+        if (IsFull(ctrl_[i])) {
+          PolicyTraits::destroy(&alloc_ref(), slots_ + i);
+        }
+      }
+      size_ = 0;
+      reset_ctrl();
+      reset_growth_left();
+    }
+    assert(empty());
+    infoz_.RecordStorageChanged(0, capacity_);
+  }
+
+  // This overload kicks in when the argument is an rvalue of insertable and
+  // decomposable type other than init_type.
+  //
+  //   flat_hash_map<std::string, int> m;
+  //   m.insert(std::make_pair("abc", 42));
+  template <class T, RequiresInsertable<T> = 0,
+            typename std::enable_if<IsDecomposable<T>::value, int>::type = 0,
+            T* = nullptr>
+  std::pair<iterator, bool> insert(T&& value) {
+    return emplace(std::forward<T>(value));
+  }
+
+  // This overload kicks in when the argument is a bitfield or an lvalue of
+  // insertable and decomposable type.
+  //
+  //   union { int n : 1; };
+  //   flat_hash_set<int> s;
+  //   s.insert(n);
+  //
+  //   flat_hash_set<std::string> s;
+  //   const char* p = "hello";
+  //   s.insert(p);
+  //
+  // TODO(romanp): Once we stop supporting gcc 5.1 and below, replace
+  // RequiresInsertable<T> with RequiresInsertable<const T&>.
+  // We are hitting this bug: https://godbolt.org/g/1Vht4f.
+  template <
+      class T, RequiresInsertable<T> = 0,
+      typename std::enable_if<IsDecomposable<const T&>::value, int>::type = 0>
+  std::pair<iterator, bool> insert(const T& value) {
+    return emplace(value);
+  }
+
+  // This overload kicks in when the argument is an rvalue of init_type. Its
+  // purpose is to handle brace-init-list arguments.
+  //
+  //   flat_hash_map<std::string, int> s;
+  //   s.insert({"abc", 42});
+  std::pair<iterator, bool> insert(init_type&& value) {
+    return emplace(std::move(value));
+  }
+
+  template <class T, RequiresInsertable<T> = 0,
+            typename std::enable_if<IsDecomposable<T>::value, int>::type = 0,
+            T* = nullptr>
+  iterator insert(const_iterator, T&& value) {
+    return insert(std::forward<T>(value)).first;
+  }
+
+  // TODO(romanp): Once we stop supporting gcc 5.1 and below, replace
+  // RequiresInsertable<T> with RequiresInsertable<const T&>.
+  // We are hitting this bug: https://godbolt.org/g/1Vht4f.
+  template <
+      class T, RequiresInsertable<T> = 0,
+      typename std::enable_if<IsDecomposable<const T&>::value, int>::type = 0>
+  iterator insert(const_iterator, const T& value) {
+    return insert(value).first;
+  }
+
+  iterator insert(const_iterator, init_type&& value) {
+    return insert(std::move(value)).first;
+  }
+
+  template <class InputIt>
+  void insert(InputIt first, InputIt last) {
+    for (; first != last; ++first) insert(*first);
+  }
+
+  template <class T, RequiresNotInit<T> = 0, RequiresInsertable<const T&> = 0>
+  void insert(std::initializer_list<T> ilist) {
+    insert(ilist.begin(), ilist.end());
+  }
+
+  void insert(std::initializer_list<init_type> ilist) {
+    insert(ilist.begin(), ilist.end());
+  }
+
+  insert_return_type insert(node_type&& node) {
+    if (!node) return {end(), false, node_type()};
+    const auto& elem = PolicyTraits::element(CommonAccess::GetSlot(node));
+    auto res = PolicyTraits::apply(
+        InsertSlot<false>{*this, std::move(*CommonAccess::GetSlot(node))},
+        elem);
+    if (res.second) {
+      CommonAccess::Reset(&node);
+      return {res.first, true, node_type()};
+    } else {
+      return {res.first, false, std::move(node)};
+    }
+  }
+
+  iterator insert(const_iterator, node_type&& node) {
+    return insert(std::move(node)).first;
+  }
+
+  // This overload kicks in if we can deduce the key from args. This enables us
+  // to avoid constructing value_type if an entry with the same key already
+  // exists.
+  //
+  // For example:
+  //
+  //   flat_hash_map<std::string, std::string> m = {{"abc", "def"}};
+  //   // Creates no std::string copies and makes no heap allocations.
+  //   m.emplace("abc", "xyz");
+  template <class... Args, typename std::enable_if<
+                               IsDecomposable<Args...>::value, int>::type = 0>
+  std::pair<iterator, bool> emplace(Args&&... args) {
+    return PolicyTraits::apply(EmplaceDecomposable{*this},
+                               std::forward<Args>(args)...);
+  }
+
+  // This overload kicks in if we cannot deduce the key from args. It constructs
+  // value_type unconditionally and then either moves it into the table or
+  // destroys.
+  template <class... Args, typename std::enable_if<
+                               !IsDecomposable<Args...>::value, int>::type = 0>
+  std::pair<iterator, bool> emplace(Args&&... args) {
+    typename std::aligned_storage<sizeof(slot_type), alignof(slot_type)>::type
+        raw;
+    slot_type* slot = reinterpret_cast<slot_type*>(&raw);
+
+    PolicyTraits::construct(&alloc_ref(), slot, std::forward<Args>(args)...);
+    const auto& elem = PolicyTraits::element(slot);
+    return PolicyTraits::apply(InsertSlot<true>{*this, std::move(*slot)}, elem);
+  }
+
+  template <class... Args>
+  iterator emplace_hint(const_iterator, Args&&... args) {
+    return emplace(std::forward<Args>(args)...).first;
+  }
+
+  // Extension API: support for lazy emplace.
+  //
+  // Looks up key in the table. If found, returns the iterator to the element.
+  // Otherwise calls f with one argument of type raw_hash_set::constructor. f
+  // MUST call raw_hash_set::constructor with arguments as if a
+  // raw_hash_set::value_type is constructed, otherwise the behavior is
+  // undefined.
+  //
+  // For example:
+  //
+  //   std::unordered_set<ArenaString> s;
+  //   // Makes ArenaStr even if "abc" is in the map.
+  //   s.insert(ArenaString(&arena, "abc"));
+  //
+  //   flat_hash_set<ArenaStr> s;
+  //   // Makes ArenaStr only if "abc" is not in the map.
+  //   s.lazy_emplace("abc", [&](const constructor& ctor) {
+  //     ctor(&arena, "abc");
+  //   });
+  //
+  // WARNING: This API is currently experimental. If there is a way to implement
+  // the same thing with the rest of the API, prefer that.
+  class constructor {
+    friend class raw_hash_set;
+
+   public:
+    template <class... Args>
+    void operator()(Args&&... args) const {
+      assert(*slot_);
+      PolicyTraits::construct(alloc_, *slot_, std::forward<Args>(args)...);
+      *slot_ = nullptr;
+    }
+
+   private:
+    constructor(allocator_type* a, slot_type** slot) : alloc_(a), slot_(slot) {}
+
+    allocator_type* alloc_;
+    slot_type** slot_;
+  };
+
+  template <class K = key_type, class F>
+  iterator lazy_emplace(const key_arg<K>& key, F&& f) {
+    auto res = find_or_prepare_insert(key);
+    if (res.second) {
+      slot_type* slot = slots_ + res.first;
+      std::forward<F>(f)(constructor(&alloc_ref(), &slot));
+      assert(!slot);
+    }
+    return iterator_at(res.first);
+  }
+
+  // Extension API: support for heterogeneous keys.
+  //
+  //   std::unordered_set<std::string> s;
+  //   // Turns "abc" into std::string.
+  //   s.erase("abc");
+  //
+  //   flat_hash_set<std::string> s;
+  //   // Uses "abc" directly without copying it into std::string.
+  //   s.erase("abc");
+  template <class K = key_type>
+  size_type erase(const key_arg<K>& key) {
+    auto it = find(key);
+    if (it == end()) return 0;
+    erase(it);
+    return 1;
+  }
+
+  // Erases the element pointed to by `it`.  Unlike `std::unordered_set::erase`,
+  // this method returns void to reduce algorithmic complexity to O(1).  In
+  // order to erase while iterating across a map, use the following idiom (which
+  // also works for standard containers):
+  //
+  // for (auto it = m.begin(), end = m.end(); it != end;) {
+  //   if (<pred>) {
+  //     m.erase(it++);
+  //   } else {
+  //     ++it;
+  //   }
+  // }
+  void erase(const_iterator cit) { erase(cit.inner_); }
+
+  // This overload is necessary because otherwise erase<K>(const K&) would be
+  // a better match if non-const iterator is passed as an argument.
+  void erase(iterator it) {
+    assert(it != end());
+    PolicyTraits::destroy(&alloc_ref(), it.slot_);
+    erase_meta_only(it);
+  }
+
+  iterator erase(const_iterator first, const_iterator last) {
+    while (first != last) {
+      erase(first++);
+    }
+    return last.inner_;
+  }
+
+  // Moves elements from `src` into `this`.
+  // If the element already exists in `this`, it is left unmodified in `src`.
+  template <typename H, typename E>
+  void merge(raw_hash_set<Policy, H, E, Alloc>& src) {  // NOLINT
+    assert(this != &src);
+    for (auto it = src.begin(), e = src.end(); it != e; ++it) {
+      if (PolicyTraits::apply(InsertSlot<false>{*this, std::move(*it.slot_)},
+                              PolicyTraits::element(it.slot_))
+              .second) {
+        src.erase_meta_only(it);
+      }
+    }
+  }
+
+  template <typename H, typename E>
+  void merge(raw_hash_set<Policy, H, E, Alloc>&& src) {
+    merge(src);
+  }
+
+  node_type extract(const_iterator position) {
+    auto node =
+        CommonAccess::Make<node_type>(alloc_ref(), position.inner_.slot_);
+    erase_meta_only(position);
+    return node;
+  }
+
+  template <
+      class K = key_type,
+      typename std::enable_if<!std::is_same<K, iterator>::value, int>::type = 0>
+  node_type extract(const key_arg<K>& key) {
+    auto it = find(key);
+    return it == end() ? node_type() : extract(const_iterator{it});
+  }
+
+  void swap(raw_hash_set& that) noexcept(
+      IsNoThrowSwappable<hasher>() && IsNoThrowSwappable<key_equal>() &&
+      (!AllocTraits::propagate_on_container_swap::value ||
+       IsNoThrowSwappable<allocator_type>())) {
+    using std::swap;
+    swap(ctrl_, that.ctrl_);
+    swap(slots_, that.slots_);
+    swap(size_, that.size_);
+    swap(capacity_, that.capacity_);
+    swap(growth_left(), that.growth_left());
+    swap(hash_ref(), that.hash_ref());
+    swap(eq_ref(), that.eq_ref());
+    swap(infoz_, that.infoz_);
+    if (AllocTraits::propagate_on_container_swap::value) {
+      swap(alloc_ref(), that.alloc_ref());
+    } else {
+      // If the allocators do not compare equal it is officially undefined
+      // behavior. We choose to do nothing.
+    }
+  }
+
+  void rehash(size_t n) {
+    if (n == 0 && capacity_ == 0) return;
+    if (n == 0 && size_ == 0) {
+      destroy_slots();
+      infoz_.RecordStorageChanged(0, 0);
+      return;
+    }
+    // bitor is a faster way of doing `max` here. We will round up to the next
+    // power-of-2-minus-1, so bitor is good enough.
+    auto m = NormalizeCapacity(n | GrowthToLowerboundCapacity(size()));
+    // n == 0 unconditionally rehashes as per the standard.
+    if (n == 0 || m > capacity_) {
+      resize(m);
+    }
+  }
+
+  void reserve(size_t n) { rehash(GrowthToLowerboundCapacity(n)); }
+
+  // Extension API: support for heterogeneous keys.
+  //
+  //   std::unordered_set<std::string> s;
+  //   // Turns "abc" into std::string.
+  //   s.count("abc");
+  //
+  //   ch_set<std::string> s;
+  //   // Uses "abc" directly without copying it into std::string.
+  //   s.count("abc");
+  template <class K = key_type>
+  size_t count(const key_arg<K>& key) const {
+    return find(key) == end() ? 0 : 1;
+  }
+
+  // Issues CPU prefetch instructions for the memory needed to find or insert
+  // a key.  Like all lookup functions, this support heterogeneous keys.
+  //
+  // NOTE: This is a very low level operation and should not be used without
+  // specific benchmarks indicating its importance.
+  template <class K = key_type>
+  void prefetch(const key_arg<K>& key) const {
+    (void)key;
+#if defined(__GNUC__)
+    auto seq = probe(hash_ref()(key));
+    __builtin_prefetch(static_cast<const void*>(ctrl_ + seq.offset()));
+    __builtin_prefetch(static_cast<const void*>(slots_ + seq.offset()));
+#endif  // __GNUC__
+  }
+
+  // The API of find() has two extensions.
+  //
+  // 1. The hash can be passed by the user. It must be equal to the hash of the
+  // key.
+  //
+  // 2. The type of the key argument doesn't have to be key_type. This is so
+  // called heterogeneous key support.
+  template <class K = key_type>
+  iterator find(const key_arg<K>& key, size_t hash) {
+    auto seq = probe(hash);
+    while (true) {
+      Group g{ctrl_ + seq.offset()};
+      for (int i : g.Match(H2(hash))) {
+        if (ABSL_PREDICT_TRUE(PolicyTraits::apply(
+                EqualElement<K>{key, eq_ref()},
+                PolicyTraits::element(slots_ + seq.offset(i)))))
+          return iterator_at(seq.offset(i));
+      }
+      if (ABSL_PREDICT_TRUE(g.MatchEmpty())) return end();
+      seq.next();
+    }
+  }
+  template <class K = key_type>
+  iterator find(const key_arg<K>& key) {
+    return find(key, hash_ref()(key));
+  }
+
+  template <class K = key_type>
+  const_iterator find(const key_arg<K>& key, size_t hash) const {
+    return const_cast<raw_hash_set*>(this)->find(key, hash);
+  }
+  template <class K = key_type>
+  const_iterator find(const key_arg<K>& key) const {
+    return find(key, hash_ref()(key));
+  }
+
+  template <class K = key_type>
+  bool contains(const key_arg<K>& key) const {
+    return find(key) != end();
+  }
+
+  template <class K = key_type>
+  std::pair<iterator, iterator> equal_range(const key_arg<K>& key) {
+    auto it = find(key);
+    if (it != end()) return {it, std::next(it)};
+    return {it, it};
+  }
+  template <class K = key_type>
+  std::pair<const_iterator, const_iterator> equal_range(
+      const key_arg<K>& key) const {
+    auto it = find(key);
+    if (it != end()) return {it, std::next(it)};
+    return {it, it};
+  }
+
+  size_t bucket_count() const { return capacity_; }
+  float load_factor() const {
+    return capacity_ ? static_cast<double>(size()) / capacity_ : 0.0;
+  }
+  float max_load_factor() const { return 1.0f; }
+  void max_load_factor(float) {
+    // Does nothing.
+  }
+
+  hasher hash_function() const { return hash_ref(); }
+  key_equal key_eq() const { return eq_ref(); }
+  allocator_type get_allocator() const { return alloc_ref(); }
+
+  friend bool operator==(const raw_hash_set& a, const raw_hash_set& b) {
+    if (a.size() != b.size()) return false;
+    const raw_hash_set* outer = &a;
+    const raw_hash_set* inner = &b;
+    if (outer->capacity() > inner->capacity()) std::swap(outer, inner);
+    for (const value_type& elem : *outer)
+      if (!inner->has_element(elem)) return false;
+    return true;
+  }
+
+  friend bool operator!=(const raw_hash_set& a, const raw_hash_set& b) {
+    return !(a == b);
+  }
+
+  friend void swap(raw_hash_set& a,
+                   raw_hash_set& b) noexcept(noexcept(a.swap(b))) {
+    a.swap(b);
+  }
+
+ private:
+  template <class Container, typename Enabler>
+  friend struct absl::container_internal::hashtable_debug_internal::
+      HashtableDebugAccess;
+
+  struct FindElement {
+    template <class K, class... Args>
+    const_iterator operator()(const K& key, Args&&...) const {
+      return s.find(key);
+    }
+    const raw_hash_set& s;
+  };
+
+  struct HashElement {
+    template <class K, class... Args>
+    size_t operator()(const K& key, Args&&...) const {
+      return h(key);
+    }
+    const hasher& h;
+  };
+
+  template <class K1>
+  struct EqualElement {
+    template <class K2, class... Args>
+    bool operator()(const K2& lhs, Args&&...) const {
+      return eq(lhs, rhs);
+    }
+    const K1& rhs;
+    const key_equal& eq;
+  };
+
+  struct EmplaceDecomposable {
+    template <class K, class... Args>
+    std::pair<iterator, bool> operator()(const K& key, Args&&... args) const {
+      auto res = s.find_or_prepare_insert(key);
+      if (res.second) {
+        s.emplace_at(res.first, std::forward<Args>(args)...);
+      }
+      return {s.iterator_at(res.first), res.second};
+    }
+    raw_hash_set& s;
+  };
+
+  template <bool do_destroy>
+  struct InsertSlot {
+    template <class K, class... Args>
+    std::pair<iterator, bool> operator()(const K& key, Args&&...) && {
+      auto res = s.find_or_prepare_insert(key);
+      if (res.second) {
+        PolicyTraits::transfer(&s.alloc_ref(), s.slots_ + res.first, &slot);
+      } else if (do_destroy) {
+        PolicyTraits::destroy(&s.alloc_ref(), &slot);
+      }
+      return {s.iterator_at(res.first), res.second};
+    }
+    raw_hash_set& s;
+    // Constructed slot. Either moved into place or destroyed.
+    slot_type&& slot;
+  };
+
+  // "erases" the object from the container, except that it doesn't actually
+  // destroy the object. It only updates all the metadata of the class.
+  // This can be used in conjunction with Policy::transfer to move the object to
+  // another place.
+  void erase_meta_only(const_iterator it) {
+    assert(IsFull(*it.inner_.ctrl_) && "erasing a dangling iterator");
+    --size_;
+    const size_t index = it.inner_.ctrl_ - ctrl_;
+    const size_t index_before = (index - Group::kWidth) & capacity_;
+    const auto empty_after = Group(it.inner_.ctrl_).MatchEmpty();
+    const auto empty_before = Group(ctrl_ + index_before).MatchEmpty();
+
+    // We count how many consecutive non empties we have to the right and to the
+    // left of `it`. If the sum is >= kWidth then there is at least one probe
+    // window that might have seen a full group.
+    bool was_never_full =
+        empty_before && empty_after &&
+        static_cast<size_t>(empty_after.TrailingZeros() +
+                            empty_before.LeadingZeros()) < Group::kWidth;
+
+    set_ctrl(index, was_never_full ? kEmpty : kDeleted);
+    growth_left() += was_never_full;
+    infoz_.RecordErase();
+  }
+
+  void initialize_slots() {
+    assert(capacity_);
+    // Folks with custom allocators often make unwarranted assumptions about the
+    // behavior of their classes vis-a-vis trivial destructability and what
+    // calls they will or wont make.  Avoid sampling for people with custom
+    // allocators to get us out of this mess.  This is not a hard guarantee but
+    // a workaround while we plan the exact guarantee we want to provide.
+    //
+    // People are often sloppy with the exact type of their allocator (sometimes
+    // it has an extra const or is missing the pair, but rebinds made it work
+    // anyway).  To avoid the ambiguity, we work off SlotAlloc which we have
+    // bound more carefully.
+    if (std::is_same<SlotAlloc, std::allocator<slot_type>>::value &&
+        slots_ == nullptr) {
+      infoz_ = Sample();
+    }
+
+    auto layout = MakeLayout(capacity_);
+    char* mem = static_cast<char*>(
+        Allocate<Layout::Alignment()>(&alloc_ref(), layout.AllocSize()));
+    ctrl_ = reinterpret_cast<ctrl_t*>(layout.template Pointer<0>(mem));
+    slots_ = layout.template Pointer<1>(mem);
+    reset_ctrl();
+    reset_growth_left();
+    infoz_.RecordStorageChanged(size_, capacity_);
+  }
+
+  void destroy_slots() {
+    if (!capacity_) return;
+    for (size_t i = 0; i != capacity_; ++i) {
+      if (IsFull(ctrl_[i])) {
+        PolicyTraits::destroy(&alloc_ref(), slots_ + i);
+      }
+    }
+    auto layout = MakeLayout(capacity_);
+    // Unpoison before returning the memory to the allocator.
+    SanitizerUnpoisonMemoryRegion(slots_, sizeof(slot_type) * capacity_);
+    Deallocate<Layout::Alignment()>(&alloc_ref(), ctrl_, layout.AllocSize());
+    ctrl_ = EmptyGroup();
+    slots_ = nullptr;
+    size_ = 0;
+    capacity_ = 0;
+    growth_left() = 0;
+  }
+
+  void resize(size_t new_capacity) {
+    assert(IsValidCapacity(new_capacity));
+    auto* old_ctrl = ctrl_;
+    auto* old_slots = slots_;
+    const size_t old_capacity = capacity_;
+    capacity_ = new_capacity;
+    initialize_slots();
+
+    size_t total_probe_length = 0;
+    for (size_t i = 0; i != old_capacity; ++i) {
+      if (IsFull(old_ctrl[i])) {
+        size_t hash = PolicyTraits::apply(HashElement{hash_ref()},
+                                          PolicyTraits::element(old_slots + i));
+        auto target = find_first_non_full(hash);
+        size_t new_i = target.offset;
+        total_probe_length += target.probe_length;
+        set_ctrl(new_i, H2(hash));
+        PolicyTraits::transfer(&alloc_ref(), slots_ + new_i, old_slots + i);
+      }
+    }
+    if (old_capacity) {
+      SanitizerUnpoisonMemoryRegion(old_slots,
+                                    sizeof(slot_type) * old_capacity);
+      auto layout = MakeLayout(old_capacity);
+      Deallocate<Layout::Alignment()>(&alloc_ref(), old_ctrl,
+                                      layout.AllocSize());
+    }
+    infoz_.RecordRehash(total_probe_length);
+  }
+
+  void drop_deletes_without_resize() ABSL_ATTRIBUTE_NOINLINE {
+    assert(IsValidCapacity(capacity_));
+    assert(!is_small());
+    // Algorithm:
+    // - mark all DELETED slots as EMPTY
+    // - mark all FULL slots as DELETED
+    // - for each slot marked as DELETED
+    //     hash = Hash(element)
+    //     target = find_first_non_full(hash)
+    //     if target is in the same group
+    //       mark slot as FULL
+    //     else if target is EMPTY
+    //       transfer element to target
+    //       mark slot as EMPTY
+    //       mark target as FULL
+    //     else if target is DELETED
+    //       swap current element with target element
+    //       mark target as FULL
+    //       repeat procedure for current slot with moved from element (target)
+    ConvertDeletedToEmptyAndFullToDeleted(ctrl_, capacity_);
+    typename std::aligned_storage<sizeof(slot_type), alignof(slot_type)>::type
+        raw;
+    size_t total_probe_length = 0;
+    slot_type* slot = reinterpret_cast<slot_type*>(&raw);
+    for (size_t i = 0; i != capacity_; ++i) {
+      if (!IsDeleted(ctrl_[i])) continue;
+      size_t hash = PolicyTraits::apply(HashElement{hash_ref()},
+                                        PolicyTraits::element(slots_ + i));
+      auto target = find_first_non_full(hash);
+      size_t new_i = target.offset;
+      total_probe_length += target.probe_length;
+
+      // Verify if the old and new i fall within the same group wrt the hash.
+      // If they do, we don't need to move the object as it falls already in the
+      // best probe we can.
+      const auto probe_index = [&](size_t pos) {
+        return ((pos - probe(hash).offset()) & capacity_) / Group::kWidth;
+      };
+
+      // Element doesn't move.
+      if (ABSL_PREDICT_TRUE(probe_index(new_i) == probe_index(i))) {
+        set_ctrl(i, H2(hash));
+        continue;
+      }
+      if (IsEmpty(ctrl_[new_i])) {
+        // Transfer element to the empty spot.
+        // set_ctrl poisons/unpoisons the slots so we have to call it at the
+        // right time.
+        set_ctrl(new_i, H2(hash));
+        PolicyTraits::transfer(&alloc_ref(), slots_ + new_i, slots_ + i);
+        set_ctrl(i, kEmpty);
+      } else {
+        assert(IsDeleted(ctrl_[new_i]));
+        set_ctrl(new_i, H2(hash));
+        // Until we are done rehashing, DELETED marks previously FULL slots.
+        // Swap i and new_i elements.
+        PolicyTraits::transfer(&alloc_ref(), slot, slots_ + i);
+        PolicyTraits::transfer(&alloc_ref(), slots_ + i, slots_ + new_i);
+        PolicyTraits::transfer(&alloc_ref(), slots_ + new_i, slot);
+        --i;  // repeat
+      }
+    }
+    reset_growth_left();
+    infoz_.RecordRehash(total_probe_length);
+  }
+
+  void rehash_and_grow_if_necessary() {
+    if (capacity_ == 0) {
+      resize(1);
+    } else if (size() <= CapacityToGrowth(capacity()) / 2) {
+      // Squash DELETED without growing if there is enough capacity.
+      drop_deletes_without_resize();
+    } else {
+      // Otherwise grow the container.
+      resize(capacity_ * 2 + 1);
+    }
+  }
+
+  bool has_element(const value_type& elem) const {
+    size_t hash = PolicyTraits::apply(HashElement{hash_ref()}, elem);
+    auto seq = probe(hash);
+    while (true) {
+      Group g{ctrl_ + seq.offset()};
+      for (int i : g.Match(H2(hash))) {
+        if (ABSL_PREDICT_TRUE(PolicyTraits::element(slots_ + seq.offset(i)) ==
+                              elem))
+          return true;
+      }
+      if (ABSL_PREDICT_TRUE(g.MatchEmpty())) return false;
+      seq.next();
+      assert(seq.index() < capacity_ && "full table!");
+    }
+    return false;
+  }
+
+  // Probes the raw_hash_set with the probe sequence for hash and returns the
+  // pointer to the first empty or deleted slot.
+  // NOTE: this function must work with tables having both kEmpty and kDelete
+  // in one group. Such tables appears during drop_deletes_without_resize.
+  //
+  // This function is very useful when insertions happen and:
+  // - the input is already a set
+  // - there are enough slots
+  // - the element with the hash is not in the table
+  struct FindInfo {
+    size_t offset;
+    size_t probe_length;
+  };
+  FindInfo find_first_non_full(size_t hash) {
+    auto seq = probe(hash);
+    while (true) {
+      Group g{ctrl_ + seq.offset()};
+      auto mask = g.MatchEmptyOrDeleted();
+      if (mask) {
+#if !defined(NDEBUG)
+        // We want to add entropy even when ASLR is not enabled.
+        // In debug build we will randomly insert in either the front or back of
+        // the group.
+        // TODO(kfm,sbenza): revisit after we do unconditional mixing
+        if (!is_small() && ShouldInsertBackwards(hash, ctrl_)) {
+          return {seq.offset(mask.HighestBitSet()), seq.index()};
+        }
+#endif
+        return {seq.offset(mask.LowestBitSet()), seq.index()};
+      }
+      assert(seq.index() < capacity_ && "full table!");
+      seq.next();
+    }
+  }
+
+  // TODO(alkis): Optimize this assuming *this and that don't overlap.
+  raw_hash_set& move_assign(raw_hash_set&& that, std::true_type) {
+    raw_hash_set tmp(std::move(that));
+    swap(tmp);
+    return *this;
+  }
+  raw_hash_set& move_assign(raw_hash_set&& that, std::false_type) {
+    raw_hash_set tmp(std::move(that), alloc_ref());
+    swap(tmp);
+    return *this;
+  }
+
+ protected:
+  template <class K>
+  std::pair<size_t, bool> find_or_prepare_insert(const K& key) {
+    auto hash = hash_ref()(key);
+    auto seq = probe(hash);
+    while (true) {
+      Group g{ctrl_ + seq.offset()};
+      for (int i : g.Match(H2(hash))) {
+        if (ABSL_PREDICT_TRUE(PolicyTraits::apply(
+                EqualElement<K>{key, eq_ref()},
+                PolicyTraits::element(slots_ + seq.offset(i)))))
+          return {seq.offset(i), false};
+      }
+      if (ABSL_PREDICT_TRUE(g.MatchEmpty())) break;
+      seq.next();
+    }
+    return {prepare_insert(hash), true};
+  }
+
+  size_t prepare_insert(size_t hash) ABSL_ATTRIBUTE_NOINLINE {
+    auto target = find_first_non_full(hash);
+    if (ABSL_PREDICT_FALSE(growth_left() == 0 &&
+                           !IsDeleted(ctrl_[target.offset]))) {
+      rehash_and_grow_if_necessary();
+      target = find_first_non_full(hash);
+    }
+    ++size_;
+    growth_left() -= IsEmpty(ctrl_[target.offset]);
+    set_ctrl(target.offset, H2(hash));
+    infoz_.RecordInsert(hash, target.probe_length);
+    return target.offset;
+  }
+
+  // Constructs the value in the space pointed by the iterator. This only works
+  // after an unsuccessful find_or_prepare_insert() and before any other
+  // modifications happen in the raw_hash_set.
+  //
+  // PRECONDITION: i is an index returned from find_or_prepare_insert(k), where
+  // k is the key decomposed from `forward<Args>(args)...`, and the bool
+  // returned by find_or_prepare_insert(k) was true.
+  // POSTCONDITION: *m.iterator_at(i) == value_type(forward<Args>(args)...).
+  template <class... Args>
+  void emplace_at(size_t i, Args&&... args) {
+    PolicyTraits::construct(&alloc_ref(), slots_ + i,
+                            std::forward<Args>(args)...);
+
+    assert(PolicyTraits::apply(FindElement{*this}, *iterator_at(i)) ==
+               iterator_at(i) &&
+           "constructed value does not match the lookup key");
+  }
+
+  iterator iterator_at(size_t i) { return {ctrl_ + i, slots_ + i}; }
+  const_iterator iterator_at(size_t i) const { return {ctrl_ + i, slots_ + i}; }
+
+ private:
+  friend struct RawHashSetTestOnlyAccess;
+
+  probe_seq<Group::kWidth> probe(size_t hash) const {
+    return probe_seq<Group::kWidth>(H1(hash, ctrl_), capacity_);
+  }
+
+  // Reset all ctrl bytes back to kEmpty, except the sentinel.
+  void reset_ctrl() {
+    std::memset(ctrl_, kEmpty, capacity_ + Group::kWidth);
+    ctrl_[capacity_] = kSentinel;
+    SanitizerPoisonMemoryRegion(slots_, sizeof(slot_type) * capacity_);
+  }
+
+  void reset_growth_left() {
+    growth_left() = CapacityToGrowth(capacity()) - size_;
+  }
+
+  // Sets the control byte, and if `i < Group::kWidth`, set the cloned byte at
+  // the end too.
+  void set_ctrl(size_t i, ctrl_t h) {
+    assert(i < capacity_);
+
+    if (IsFull(h)) {
+      SanitizerUnpoisonObject(slots_ + i);
+    } else {
+      SanitizerPoisonObject(slots_ + i);
+    }
+
+    ctrl_[i] = h;
+    ctrl_[((i - Group::kWidth) & capacity_) + 1 +
+          ((Group::kWidth - 1) & capacity_)] = h;
+  }
+
+  size_t& growth_left() { return settings_.template get<0>(); }
+
+  // The representation of the object has two modes:
+  //  - small: For capacities < kWidth-1
+  //  - large: For the rest.
+  //
+  // Differences:
+  //  - In small mode we are able to use the whole capacity. The extra control
+  //  bytes give us at least one "empty" control byte to stop the iteration.
+  //  This is important to make 1 a valid capacity.
+  //
+  //  - In small mode only the first `capacity()` control bytes after the
+  //  sentinel are valid. The rest contain dummy kEmpty values that do not
+  //  represent a real slot. This is important to take into account on
+  //  find_first_non_full(), where we never try ShouldInsertBackwards() for
+  //  small tables.
+  bool is_small() const { return capacity_ < Group::kWidth - 1; }
+
+  hasher& hash_ref() { return settings_.template get<1>(); }
+  const hasher& hash_ref() const { return settings_.template get<1>(); }
+  key_equal& eq_ref() { return settings_.template get<2>(); }
+  const key_equal& eq_ref() const { return settings_.template get<2>(); }
+  allocator_type& alloc_ref() { return settings_.template get<3>(); }
+  const allocator_type& alloc_ref() const {
+    return settings_.template get<3>();
+  }
+
+  // TODO(alkis): Investigate removing some of these fields:
+  // - ctrl/slots can be derived from each other
+  // - size can be moved into the slot array
+  ctrl_t* ctrl_ = EmptyGroup();    // [(capacity + 1) * ctrl_t]
+  slot_type* slots_ = nullptr;     // [capacity * slot_type]
+  size_t size_ = 0;                // number of full slots
+  size_t capacity_ = 0;            // total number of slots
+  HashtablezInfoHandle infoz_;
+  absl::container_internal::CompressedTuple<size_t /* growth_left */, hasher,
+                                            key_equal, allocator_type>
+      settings_{0, hasher{}, key_equal{}, allocator_type{}};
+};
+
+namespace hashtable_debug_internal {
+template <typename Set>
+struct HashtableDebugAccess<Set, absl::void_t<typename Set::raw_hash_set>> {
+  using Traits = typename Set::PolicyTraits;
+  using Slot = typename Traits::slot_type;
+
+  static size_t GetNumProbes(const Set& set,
+                             const typename Set::key_type& key) {
+    size_t num_probes = 0;
+    size_t hash = set.hash_ref()(key);
+    auto seq = set.probe(hash);
+    while (true) {
+      container_internal::Group g{set.ctrl_ + seq.offset()};
+      for (int i : g.Match(container_internal::H2(hash))) {
+        if (Traits::apply(
+                typename Set::template EqualElement<typename Set::key_type>{
+                    key, set.eq_ref()},
+                Traits::element(set.slots_ + seq.offset(i))))
+          return num_probes;
+        ++num_probes;
+      }
+      if (g.MatchEmpty()) return num_probes;
+      seq.next();
+      ++num_probes;
+    }
+  }
+
+  static size_t AllocatedByteSize(const Set& c) {
+    size_t capacity = c.capacity_;
+    if (capacity == 0) return 0;
+    auto layout = Set::MakeLayout(capacity);
+    size_t m = layout.AllocSize();
+
+    size_t per_slot = Traits::space_used(static_cast<const Slot*>(nullptr));
+    if (per_slot != ~size_t{}) {
+      m += per_slot * c.size();
+    } else {
+      for (size_t i = 0; i != capacity; ++i) {
+        if (container_internal::IsFull(c.ctrl_[i])) {
+          m += Traits::space_used(c.slots_ + i);
+        }
+      }
+    }
+    return m;
+  }
+
+  static size_t LowerBoundAllocatedByteSize(size_t size) {
+    size_t capacity = GrowthToLowerboundCapacity(size);
+    if (capacity == 0) return 0;
+    auto layout = Set::MakeLayout(NormalizeCapacity(capacity));
+    size_t m = layout.AllocSize();
+    size_t per_slot = Traits::space_used(static_cast<const Slot*>(nullptr));
+    if (per_slot != ~size_t{}) {
+      m += per_slot * size;
+    }
+    return m;
+  }
+};
+
+}  // namespace hashtable_debug_internal
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_RAW_HASH_SET_H_
index cf8f3a5..3d4b298 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #include <cstdlib>
 #include <ostream>
 
+#include "absl/types/compare.h"
+
 namespace absl {
 namespace test_internal {
 
 // A type that counts number of occurences of the type, the live occurrences of
-// the type, as well as the number of copies, moves, and swaps that have
-// occurred on the type. This is used as a base class for the copyable,
+// the type, as well as the number of copies, moves, swaps, and comparisons that
+// have occurred on the type. This is used as a base class for the copyable,
 // copyable+movable, and movable types below that are used in actual tests. Use
 // InstanceTracker in tests to track the number of instances.
 class BaseCountedInstance {
@@ -66,6 +68,44 @@ class BaseCountedInstance {
     return *this;
   }
 
+  bool operator==(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ == x.value_;
+  }
+
+  bool operator!=(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ != x.value_;
+  }
+
+  bool operator<(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ < x.value_;
+  }
+
+  bool operator>(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ > x.value_;
+  }
+
+  bool operator<=(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ <= x.value_;
+  }
+
+  bool operator>=(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ >= x.value_;
+  }
+
+  absl::weak_ordering compare(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ < x.value_
+               ? absl::weak_ordering::less
+               : value_ == x.value_ ? absl::weak_ordering::equivalent
+                                    : absl::weak_ordering::greater;
+  }
+
   int value() const {
     if (!is_live_) std::abort();
     return value_;
@@ -108,6 +148,9 @@ class BaseCountedInstance {
 
   // Number of times that BaseCountedInstance objects were swapped.
   static int num_swaps_;
+
+  // Number of times that BaseCountedInstance objects were compared.
+  static int num_comparisons_;
 };
 
 // Helper to track the BaseCountedInstance instance counters. Expects that the
@@ -152,13 +195,21 @@ class InstanceTracker {
   // construction or the last call to ResetCopiesMovesSwaps().
   int swaps() const { return BaseCountedInstance::num_swaps_ - start_swaps_; }
 
-  // Resets the base values for moves, copies and swaps to the current values,
-  // so that subsequent Get*() calls for moves, copies and swaps will compare to
-  // the situation at the point of this call.
+  // Returns the number of comparisons on BaseCountedInstance objects since
+  // construction or the last call to ResetCopiesMovesSwaps().
+  int comparisons() const {
+    return BaseCountedInstance::num_comparisons_ - start_comparisons_;
+  }
+
+  // Resets the base values for moves, copies, comparisons, and swaps to the
+  // current values, so that subsequent Get*() calls for moves, copies,
+  // comparisons, and swaps will compare to the situation at the point of this
+  // call.
   void ResetCopiesMovesSwaps() {
     start_moves_ = BaseCountedInstance::num_moves_;
     start_copies_ = BaseCountedInstance::num_copies_;
     start_swaps_ = BaseCountedInstance::num_swaps_;
+    start_comparisons_ = BaseCountedInstance::num_comparisons_;
   }
 
  private:
@@ -167,6 +218,7 @@ class InstanceTracker {
   int start_moves_;
   int start_copies_;
   int start_swaps_;
+  int start_comparisons_;
 };
 
 // Copyable, not movable.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/tracked.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/tracked.h
new file mode 100644 (file)
index 0000000..75173ab
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_TRACKED_H_
+#define ABSL_CONTAINER_INTERNAL_TRACKED_H_
+
+#include <stddef.h>
+#include <memory>
+#include <utility>
+
+namespace absl {
+namespace container_internal {
+
+// A class that tracks its copies and moves so that it can be queried in tests.
+template <class T>
+class Tracked {
+ public:
+  Tracked() {}
+  // NOLINTNEXTLINE(runtime/explicit)
+  Tracked(const T& val) : val_(val) {}
+  Tracked(const Tracked& that)
+      : val_(that.val_),
+        num_moves_(that.num_moves_),
+        num_copies_(that.num_copies_) {
+    ++(*num_copies_);
+  }
+  Tracked(Tracked&& that)
+      : val_(std::move(that.val_)),
+        num_moves_(std::move(that.num_moves_)),
+        num_copies_(std::move(that.num_copies_)) {
+    ++(*num_moves_);
+  }
+  Tracked& operator=(const Tracked& that) {
+    val_ = that.val_;
+    num_moves_ = that.num_moves_;
+    num_copies_ = that.num_copies_;
+    ++(*num_copies_);
+  }
+  Tracked& operator=(Tracked&& that) {
+    val_ = std::move(that.val_);
+    num_moves_ = std::move(that.num_moves_);
+    num_copies_ = std::move(that.num_copies_);
+    ++(*num_moves_);
+  }
+
+  const T& val() const { return val_; }
+
+  friend bool operator==(const Tracked& a, const Tracked& b) {
+    return a.val_ == b.val_;
+  }
+  friend bool operator!=(const Tracked& a, const Tracked& b) {
+    return !(a == b);
+  }
+
+  size_t num_copies() { return *num_copies_; }
+  size_t num_moves() { return *num_moves_; }
+
+ private:
+  T val_;
+  std::shared_ptr<size_t> num_moves_ = std::make_shared<size_t>(0);
+  std::shared_ptr<size_t> num_copies_ = std::make_shared<size_t>(0);
+};
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_TRACKED_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h
new file mode 100644 (file)
index 0000000..68817e4
--- /dev/null
@@ -0,0 +1,487 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_CONSTRUCTOR_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_CONSTRUCTOR_TEST_H_
+
+#include <algorithm>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/container/internal/hash_generator_testing.h"
+#include "absl/container/internal/hash_policy_testing.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordMap>
+class ConstructorTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(ConstructorTest);
+
+TYPED_TEST_P(ConstructorTest, NoArgs) {
+  TypeParam m;
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCount) {
+  TypeParam m(123);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHash) {
+  using H = typename TypeParam::hasher;
+  H hasher;
+  TypeParam m(123, hasher);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHashEqual) {
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  H hasher;
+  E equal;
+  TypeParam m(123, hasher, equal);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHashEqualAlloc) {
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+template <typename T>
+struct is_std_unordered_map : std::false_type {};
+
+template <typename... T>
+struct is_std_unordered_map<std::unordered_map<T...>> : std::true_type {};
+
+#if defined(UNORDERED_MAP_CXX14) || defined(UNORDERED_MAP_CXX17)
+using has_cxx14_std_apis = std::true_type;
+#else
+using has_cxx14_std_apis = std::false_type;
+#endif
+
+template <typename T>
+using expect_cxx14_apis =
+    absl::disjunction<absl::negation<is_std_unordered_map<T>>,
+                      has_cxx14_std_apis>;
+
+template <typename TypeParam>
+void BucketCountAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void BucketCountAllocTest(std::true_type) {
+  using A = typename TypeParam::allocator_type;
+  A alloc(0);
+  TypeParam m(123, alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountAlloc) {
+  BucketCountAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+template <typename TypeParam>
+void BucketCountHashAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void BucketCountHashAllocTest(std::true_type) {
+  using H = typename TypeParam::hasher;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  A alloc(0);
+  TypeParam m(123, hasher, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHashAlloc) {
+  BucketCountHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+#if ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS
+using has_alloc_std_constructors = std::true_type;
+#else
+using has_alloc_std_constructors = std::false_type;
+#endif
+
+template <typename T>
+using expect_alloc_constructors =
+    absl::disjunction<absl::negation<is_std_unordered_map<T>>,
+                      has_alloc_std_constructors>;
+
+template <typename TypeParam>
+void AllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void AllocTest(std::true_type) {
+  using A = typename TypeParam::allocator_type;
+  A alloc(0);
+  TypeParam m(alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(m, ::testing::UnorderedElementsAre());
+}
+
+TYPED_TEST_P(ConstructorTest, Alloc) {
+  AllocTest<TypeParam>(expect_alloc_constructors<TypeParam>());
+}
+
+TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashEqualAlloc) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+template <typename TypeParam>
+void InputIteratorBucketAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InputIteratorBucketAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using A = typename TypeParam::allocator_type;
+  A alloc(0);
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end(), 123, alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InputIteratorBucketAlloc) {
+  InputIteratorBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+template <typename TypeParam>
+void InputIteratorBucketHashAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InputIteratorBucketHashAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  A alloc(0);
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end(), 123, hasher, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashAlloc) {
+  InputIteratorBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+TYPED_TEST_P(ConstructorTest, CopyConstructor) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam n(m);
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+template <typename TypeParam>
+void CopyConstructorAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void CopyConstructorAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam n(m, A(11));
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_NE(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, CopyConstructorAlloc) {
+  CopyConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>());
+}
+
+// TODO(alkis): Test non-propagating allocators on copy constructors.
+
+TYPED_TEST_P(ConstructorTest, MoveConstructor) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam t(m);
+  TypeParam n(std::move(t));
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+template <typename TypeParam>
+void MoveConstructorAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void MoveConstructorAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam t(m);
+  TypeParam n(std::move(t), A(1));
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_NE(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, MoveConstructorAlloc) {
+  MoveConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>());
+}
+
+// TODO(alkis): Test non-propagating allocators on move constructors.
+
+TYPED_TEST_P(ConstructorTest, InitializerListBucketHashEqualAlloc) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(values, 123, hasher, equal, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+template <typename TypeParam>
+void InitializerListBucketAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InitializerListBucketAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using A = typename TypeParam::allocator_type;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  A alloc(0);
+  TypeParam m(values, 123, alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InitializerListBucketAlloc) {
+  InitializerListBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+template <typename TypeParam>
+void InitializerListBucketHashAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InitializerListBucketHashAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  A alloc(0);
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m(values, 123, hasher, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InitializerListBucketHashAlloc) {
+  InitializerListBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+TYPED_TEST_P(ConstructorTest, Assignment) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc);
+  TypeParam n;
+  n = m;
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m, n);
+}
+
+// TODO(alkis): Test [non-]propagating allocators on move/copy assignments
+// (it depends on traits).
+
+TYPED_TEST_P(ConstructorTest, MoveAssignment) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc);
+  TypeParam t(m);
+  TypeParam n;
+  n = std::move(t);
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerList) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m;
+  m = values;
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentOverwritesExisting) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()});
+  TypeParam n({gen()});
+  n = m;
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, MoveAssignmentOverwritesExisting) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()});
+  TypeParam t(m);
+  TypeParam n({gen()});
+  n = std::move(t);
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerListOverwritesExisting) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m;
+  m = values;
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentOnSelf) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m(values);
+  m = *&m;  // Avoid -Wself-assign
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+// We cannot test self move as standard states that it leaves standard
+// containers in unspecified state (and in practice in causes memory-leak
+// according to heap-checker!).
+
+REGISTER_TYPED_TEST_CASE_P(
+    ConstructorTest, NoArgs, BucketCount, BucketCountHash, BucketCountHashEqual,
+    BucketCountHashEqualAlloc, BucketCountAlloc, BucketCountHashAlloc, Alloc,
+    InputIteratorBucketHashEqualAlloc, InputIteratorBucketAlloc,
+    InputIteratorBucketHashAlloc, CopyConstructor, CopyConstructorAlloc,
+    MoveConstructor, MoveConstructorAlloc, InitializerListBucketHashEqualAlloc,
+    InitializerListBucketAlloc, InitializerListBucketHashAlloc, Assignment,
+    MoveAssignment, AssignmentFromInitializerList, AssignmentOverwritesExisting,
+    MoveAssignmentOverwritesExisting,
+    AssignmentFromInitializerListOverwritesExisting, AssignmentOnSelf);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_CONSTRUCTOR_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h
new file mode 100644 (file)
index 0000000..ebd3612
--- /dev/null
@@ -0,0 +1,115 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_LOOKUP_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_LOOKUP_TEST_H_
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/container/internal/hash_generator_testing.h"
+#include "absl/container/internal/hash_policy_testing.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordMap>
+class LookupTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(LookupTest);
+
+TYPED_TEST_P(LookupTest, At) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  for (const auto& p : values) {
+    const auto& val = m.at(p.first);
+    EXPECT_EQ(p.second, val) << ::testing::PrintToString(p.first);
+  }
+}
+
+TYPED_TEST_P(LookupTest, OperatorBracket) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& p : values) {
+    auto& val = m[p.first];
+    EXPECT_EQ(V(), val) << ::testing::PrintToString(p.first);
+    val = p.second;
+  }
+  for (const auto& p : values)
+    EXPECT_EQ(p.second, m[p.first]) << ::testing::PrintToString(p.first);
+}
+
+TYPED_TEST_P(LookupTest, Count) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& p : values)
+    EXPECT_EQ(0, m.count(p.first)) << ::testing::PrintToString(p.first);
+  m.insert(values.begin(), values.end());
+  for (const auto& p : values)
+    EXPECT_EQ(1, m.count(p.first)) << ::testing::PrintToString(p.first);
+}
+
+TYPED_TEST_P(LookupTest, Find) {
+  using std::get;
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& p : values)
+    EXPECT_TRUE(m.end() == m.find(p.first))
+        << ::testing::PrintToString(p.first);
+  m.insert(values.begin(), values.end());
+  for (const auto& p : values) {
+    auto it = m.find(p.first);
+    EXPECT_TRUE(m.end() != it) << ::testing::PrintToString(p.first);
+    EXPECT_EQ(p.second, get<1>(*it)) << ::testing::PrintToString(p.first);
+  }
+}
+
+TYPED_TEST_P(LookupTest, EqualRange) {
+  using std::get;
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& p : values) {
+    auto r = m.equal_range(p.first);
+    ASSERT_EQ(0, std::distance(r.first, r.second));
+  }
+  m.insert(values.begin(), values.end());
+  for (const auto& p : values) {
+    auto r = m.equal_range(p.first);
+    ASSERT_EQ(1, std::distance(r.first, r.second));
+    EXPECT_EQ(p.second, get<1>(*r.first)) << ::testing::PrintToString(p.first);
+  }
+}
+
+REGISTER_TYPED_TEST_CASE_P(LookupTest, At, OperatorBracket, Count, Find,
+                           EqualRange);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_LOOKUP_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_members_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_members_test.h
new file mode 100644 (file)
index 0000000..1bf31ab
--- /dev/null
@@ -0,0 +1,85 @@
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_
+
+#include <type_traits>
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordMap>
+class MembersTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(MembersTest);
+
+template <typename T>
+void UseType() {}
+
+TYPED_TEST_P(MembersTest, Typedefs) {
+  EXPECT_TRUE((std::is_same<std::pair<const typename TypeParam::key_type,
+                                      typename TypeParam::mapped_type>,
+                            typename TypeParam::value_type>()));
+  EXPECT_TRUE((absl::conjunction<
+               absl::negation<std::is_signed<typename TypeParam::size_type>>,
+               std::is_integral<typename TypeParam::size_type>>()));
+  EXPECT_TRUE((absl::conjunction<
+               std::is_signed<typename TypeParam::difference_type>,
+               std::is_integral<typename TypeParam::difference_type>>()));
+  EXPECT_TRUE((std::is_convertible<
+               decltype(std::declval<const typename TypeParam::hasher&>()(
+                   std::declval<const typename TypeParam::key_type&>())),
+               size_t>()));
+  EXPECT_TRUE((std::is_convertible<
+               decltype(std::declval<const typename TypeParam::key_equal&>()(
+                   std::declval<const typename TypeParam::key_type&>(),
+                   std::declval<const typename TypeParam::key_type&>())),
+               bool>()));
+  EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type,
+                            typename TypeParam::value_type>()));
+  EXPECT_TRUE((std::is_same<typename TypeParam::value_type&,
+                            typename TypeParam::reference>()));
+  EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&,
+                            typename TypeParam::const_reference>()));
+  EXPECT_TRUE((std::is_same<typename std::allocator_traits<
+                                typename TypeParam::allocator_type>::pointer,
+                            typename TypeParam::pointer>()));
+  EXPECT_TRUE(
+      (std::is_same<typename std::allocator_traits<
+                        typename TypeParam::allocator_type>::const_pointer,
+                    typename TypeParam::const_pointer>()));
+}
+
+TYPED_TEST_P(MembersTest, SimpleFunctions) {
+  EXPECT_GT(TypeParam().max_size(), 0);
+}
+
+TYPED_TEST_P(MembersTest, BeginEnd) {
+  TypeParam t = {typename TypeParam::value_type{}};
+  EXPECT_EQ(t.begin(), t.cbegin());
+  EXPECT_EQ(t.end(), t.cend());
+  EXPECT_NE(t.begin(), t.end());
+  EXPECT_NE(t.cbegin(), t.cend());
+}
+
+REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MEMBERS_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h
new file mode 100644 (file)
index 0000000..52a1092
--- /dev/null
@@ -0,0 +1,273 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/container/internal/hash_generator_testing.h"
+#include "absl/container/internal/hash_policy_testing.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordMap>
+class ModifiersTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(ModifiersTest);
+
+TYPED_TEST_P(ModifiersTest, Clear) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  m.clear();
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAre());
+  EXPECT_TRUE(m.empty());
+}
+
+TYPED_TEST_P(ModifiersTest, Insert) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  auto p = m.insert(val);
+  EXPECT_TRUE(p.second);
+  EXPECT_EQ(val, *p.first);
+  T val2 = {val.first, hash_internal::Generator<V>()()};
+  p = m.insert(val2);
+  EXPECT_FALSE(p.second);
+  EXPECT_EQ(val, *p.first);
+}
+
+TYPED_TEST_P(ModifiersTest, InsertHint) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  auto it = m.insert(m.end(), val);
+  EXPECT_TRUE(it != m.end());
+  EXPECT_EQ(val, *it);
+  T val2 = {val.first, hash_internal::Generator<V>()()};
+  it = m.insert(it, val2);
+  EXPECT_TRUE(it != m.end());
+  EXPECT_EQ(val, *it);
+}
+
+TYPED_TEST_P(ModifiersTest, InsertRange) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  m.insert(values.begin(), values.end());
+  ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+TYPED_TEST_P(ModifiersTest, InsertOrAssign) {
+#ifdef UNORDERED_MAP_CXX17
+  using std::get;
+  using K = typename TypeParam::key_type;
+  using V = typename TypeParam::mapped_type;
+  K k = hash_internal::Generator<K>()();
+  V val = hash_internal::Generator<V>()();
+  TypeParam m;
+  auto p = m.insert_or_assign(k, val);
+  EXPECT_TRUE(p.second);
+  EXPECT_EQ(k, get<0>(*p.first));
+  EXPECT_EQ(val, get<1>(*p.first));
+  V val2 = hash_internal::Generator<V>()();
+  p = m.insert_or_assign(k, val2);
+  EXPECT_FALSE(p.second);
+  EXPECT_EQ(k, get<0>(*p.first));
+  EXPECT_EQ(val2, get<1>(*p.first));
+#endif
+}
+
+TYPED_TEST_P(ModifiersTest, InsertOrAssignHint) {
+#ifdef UNORDERED_MAP_CXX17
+  using std::get;
+  using K = typename TypeParam::key_type;
+  using V = typename TypeParam::mapped_type;
+  K k = hash_internal::Generator<K>()();
+  V val = hash_internal::Generator<V>()();
+  TypeParam m;
+  auto it = m.insert_or_assign(m.end(), k, val);
+  EXPECT_TRUE(it != m.end());
+  EXPECT_EQ(k, get<0>(*it));
+  EXPECT_EQ(val, get<1>(*it));
+  V val2 = hash_internal::Generator<V>()();
+  it = m.insert_or_assign(it, k, val2);
+  EXPECT_EQ(k, get<0>(*it));
+  EXPECT_EQ(val2, get<1>(*it));
+#endif
+}
+
+TYPED_TEST_P(ModifiersTest, Emplace) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps
+  // with test traits/policy.
+  auto p = m.emplace(val);
+  EXPECT_TRUE(p.second);
+  EXPECT_EQ(val, *p.first);
+  T val2 = {val.first, hash_internal::Generator<V>()()};
+  p = m.emplace(val2);
+  EXPECT_FALSE(p.second);
+  EXPECT_EQ(val, *p.first);
+}
+
+TYPED_TEST_P(ModifiersTest, EmplaceHint) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps
+  // with test traits/policy.
+  auto it = m.emplace_hint(m.end(), val);
+  EXPECT_EQ(val, *it);
+  T val2 = {val.first, hash_internal::Generator<V>()()};
+  it = m.emplace_hint(it, val2);
+  EXPECT_EQ(val, *it);
+}
+
+TYPED_TEST_P(ModifiersTest, TryEmplace) {
+#ifdef UNORDERED_MAP_CXX17
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps
+  // with test traits/policy.
+  auto p = m.try_emplace(val.first, val.second);
+  EXPECT_TRUE(p.second);
+  EXPECT_EQ(val, *p.first);
+  T val2 = {val.first, hash_internal::Generator<V>()()};
+  p = m.try_emplace(val2.first, val2.second);
+  EXPECT_FALSE(p.second);
+  EXPECT_EQ(val, *p.first);
+#endif
+}
+
+TYPED_TEST_P(ModifiersTest, TryEmplaceHint) {
+#ifdef UNORDERED_MAP_CXX17
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using V = typename TypeParam::mapped_type;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps
+  // with test traits/policy.
+  auto it = m.try_emplace(m.end(), val.first, val.second);
+  EXPECT_EQ(val, *it);
+  T val2 = {val.first, hash_internal::Generator<V>()()};
+  it = m.try_emplace(it, val2.first, val2.second);
+  EXPECT_EQ(val, *it);
+#endif
+}
+
+template <class V>
+using IfNotVoid = typename std::enable_if<!std::is_void<V>::value, V>::type;
+
+// In openmap we chose not to return the iterator from erase because that's
+// more expensive. As such we adapt erase to return an iterator here.
+struct EraseFirst {
+  template <class Map>
+  auto operator()(Map* m, int) const
+      -> IfNotVoid<decltype(m->erase(m->begin()))> {
+    return m->erase(m->begin());
+  }
+  template <class Map>
+  typename Map::iterator operator()(Map* m, ...) const {
+    auto it = m->begin();
+    m->erase(it++);
+    return it;
+  }
+};
+
+TYPED_TEST_P(ModifiersTest, Erase) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using std::get;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  auto& first = *m.begin();
+  std::vector<T> values2;
+  for (const auto& val : values)
+    if (get<0>(val) != get<0>(first)) values2.push_back(val);
+  auto it = EraseFirst()(&m, 0);
+  ASSERT_TRUE(it != m.end());
+  EXPECT_EQ(1, std::count(values2.begin(), values2.end(), *it));
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values2.begin(),
+                                                             values2.end()));
+}
+
+TYPED_TEST_P(ModifiersTest, EraseRange) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  auto it = m.erase(m.begin(), m.end());
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAre());
+  EXPECT_TRUE(it == m.end());
+}
+
+TYPED_TEST_P(ModifiersTest, EraseKey) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(items(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_EQ(1, m.erase(values[0].first));
+  EXPECT_EQ(0, std::count(m.begin(), m.end(), values[0]));
+  EXPECT_THAT(items(m), ::testing::UnorderedElementsAreArray(values.begin() + 1,
+                                                             values.end()));
+}
+
+TYPED_TEST_P(ModifiersTest, Swap) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> v1;
+  std::vector<T> v2;
+  std::generate_n(std::back_inserter(v1), 5, hash_internal::Generator<T>());
+  std::generate_n(std::back_inserter(v2), 5, hash_internal::Generator<T>());
+  TypeParam m1(v1.begin(), v1.end());
+  TypeParam m2(v2.begin(), v2.end());
+  EXPECT_THAT(items(m1), ::testing::UnorderedElementsAreArray(v1));
+  EXPECT_THAT(items(m2), ::testing::UnorderedElementsAreArray(v2));
+  m1.swap(m2);
+  EXPECT_THAT(items(m1), ::testing::UnorderedElementsAreArray(v2));
+  EXPECT_THAT(items(m2), ::testing::UnorderedElementsAreArray(v1));
+}
+
+// TODO(alkis): Write tests for extract.
+// TODO(alkis): Write tests for merge.
+
+REGISTER_TYPED_TEST_CASE_P(ModifiersTest, Clear, Insert, InsertHint,
+                           InsertRange, InsertOrAssign, InsertOrAssignHint,
+                           Emplace, EmplaceHint, TryEmplace, TryEmplaceHint,
+                           Erase, EraseRange, EraseKey, Swap);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_MAP_MODIFIERS_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h
new file mode 100644 (file)
index 0000000..f484468
--- /dev/null
@@ -0,0 +1,494 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_CONSTRUCTOR_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_CONSTRUCTOR_TEST_H_
+
+#include <algorithm>
+#include <unordered_set>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/container/internal/hash_generator_testing.h"
+#include "absl/container/internal/hash_policy_testing.h"
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordMap>
+class ConstructorTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(ConstructorTest);
+
+TYPED_TEST_P(ConstructorTest, NoArgs) {
+  TypeParam m;
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCount) {
+  TypeParam m(123);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHash) {
+  using H = typename TypeParam::hasher;
+  H hasher;
+  TypeParam m(123, hasher);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHashEqual) {
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  H hasher;
+  E equal;
+  TypeParam m(123, hasher, equal);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHashEqualAlloc) {
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+
+  const auto& cm = m;
+  EXPECT_EQ(cm.hash_function(), hasher);
+  EXPECT_EQ(cm.key_eq(), equal);
+  EXPECT_EQ(cm.get_allocator(), alloc);
+  EXPECT_TRUE(cm.empty());
+  EXPECT_THAT(keys(cm), ::testing::UnorderedElementsAre());
+  EXPECT_GE(cm.bucket_count(), 123);
+}
+
+template <typename T>
+struct is_std_unordered_set : std::false_type {};
+
+template <typename... T>
+struct is_std_unordered_set<std::unordered_set<T...>> : std::true_type {};
+
+#if defined(UNORDERED_SET_CXX14) || defined(UNORDERED_SET_CXX17)
+using has_cxx14_std_apis = std::true_type;
+#else
+using has_cxx14_std_apis = std::false_type;
+#endif
+
+template <typename T>
+using expect_cxx14_apis =
+    absl::disjunction<absl::negation<is_std_unordered_set<T>>,
+                      has_cxx14_std_apis>;
+
+template <typename TypeParam>
+void BucketCountAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void BucketCountAllocTest(std::true_type) {
+  using A = typename TypeParam::allocator_type;
+  A alloc(0);
+  TypeParam m(123, alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountAlloc) {
+  BucketCountAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+template <typename TypeParam>
+void BucketCountHashAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void BucketCountHashAllocTest(std::true_type) {
+  using H = typename TypeParam::hasher;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  A alloc(0);
+  TypeParam m(123, hasher, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, BucketCountHashAlloc) {
+  BucketCountHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+#if ABSL_UNORDERED_SUPPORTS_ALLOC_CTORS
+using has_alloc_std_constructors = std::true_type;
+#else
+using has_alloc_std_constructors = std::false_type;
+#endif
+
+template <typename T>
+using expect_alloc_constructors =
+    absl::disjunction<absl::negation<is_std_unordered_set<T>>,
+                      has_alloc_std_constructors>;
+
+template <typename TypeParam>
+void AllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void AllocTest(std::true_type) {
+  using A = typename TypeParam::allocator_type;
+  A alloc(0);
+  TypeParam m(alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_TRUE(m.empty());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+}
+
+TYPED_TEST_P(ConstructorTest, Alloc) {
+  AllocTest<TypeParam>(expect_alloc_constructors<TypeParam>());
+}
+
+TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashEqualAlloc) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  std::vector<T> values;
+  for (size_t i = 0; i != 10; ++i)
+    values.push_back(hash_internal::Generator<T>()());
+  TypeParam m(values.begin(), values.end(), 123, hasher, equal, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+template <typename TypeParam>
+void InputIteratorBucketAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InputIteratorBucketAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using A = typename TypeParam::allocator_type;
+  A alloc(0);
+  std::vector<T> values;
+  for (size_t i = 0; i != 10; ++i)
+    values.push_back(hash_internal::Generator<T>()());
+  TypeParam m(values.begin(), values.end(), 123, alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InputIteratorBucketAlloc) {
+  InputIteratorBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+template <typename TypeParam>
+void InputIteratorBucketHashAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InputIteratorBucketHashAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  A alloc(0);
+  std::vector<T> values;
+  for (size_t i = 0; i != 10; ++i)
+    values.push_back(hash_internal::Generator<T>()());
+  TypeParam m(values.begin(), values.end(), 123, hasher, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InputIteratorBucketHashAlloc) {
+  InputIteratorBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+TYPED_TEST_P(ConstructorTest, CopyConstructor) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam n(m);
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+  EXPECT_NE(TypeParam(0, hasher, equal, alloc), n);
+}
+
+template <typename TypeParam>
+void CopyConstructorAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void CopyConstructorAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam n(m, A(11));
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_NE(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, CopyConstructorAlloc) {
+  CopyConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>());
+}
+
+// TODO(alkis): Test non-propagating allocators on copy constructors.
+
+TYPED_TEST_P(ConstructorTest, MoveConstructor) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam t(m);
+  TypeParam n(std::move(t));
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+template <typename TypeParam>
+void MoveConstructorAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void MoveConstructorAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(123, hasher, equal, alloc);
+  for (size_t i = 0; i != 10; ++i) m.insert(hash_internal::Generator<T>()());
+  TypeParam t(m);
+  TypeParam n(std::move(t), A(1));
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_NE(m.get_allocator(), n.get_allocator());
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, MoveConstructorAlloc) {
+  MoveConstructorAllocTest<TypeParam>(expect_alloc_constructors<TypeParam>());
+}
+
+// TODO(alkis): Test non-propagating allocators on move constructors.
+
+TYPED_TEST_P(ConstructorTest, InitializerListBucketHashEqualAlloc) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  TypeParam m(values, 123, hasher, equal, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.key_eq(), equal);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+template <typename TypeParam>
+void InitializerListBucketAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InitializerListBucketAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using A = typename TypeParam::allocator_type;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  A alloc(0);
+  TypeParam m(values, 123, alloc);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InitializerListBucketAlloc) {
+  InitializerListBucketAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+template <typename TypeParam>
+void InitializerListBucketHashAllocTest(std::false_type) {}
+
+template <typename TypeParam>
+void InitializerListBucketHashAllocTest(std::true_type) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  A alloc(0);
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m(values, 123, hasher, alloc);
+  EXPECT_EQ(m.hash_function(), hasher);
+  EXPECT_EQ(m.get_allocator(), alloc);
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_GE(m.bucket_count(), 123);
+}
+
+TYPED_TEST_P(ConstructorTest, InitializerListBucketHashAlloc) {
+  InitializerListBucketHashAllocTest<TypeParam>(expect_cxx14_apis<TypeParam>());
+}
+
+TYPED_TEST_P(ConstructorTest, CopyAssignment) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc);
+  TypeParam n;
+  n = m;
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m, n);
+}
+
+// TODO(alkis): Test [non-]propagating allocators on move/copy assignments
+// (it depends on traits).
+
+TYPED_TEST_P(ConstructorTest, MoveAssignment) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  using H = typename TypeParam::hasher;
+  using E = typename TypeParam::key_equal;
+  using A = typename TypeParam::allocator_type;
+  H hasher;
+  E equal;
+  A alloc(0);
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()}, 123, hasher, equal, alloc);
+  TypeParam t(m);
+  TypeParam n;
+  n = std::move(t);
+  EXPECT_EQ(m.hash_function(), n.hash_function());
+  EXPECT_EQ(m.key_eq(), n.key_eq());
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerList) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m;
+  m = values;
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentOverwritesExisting) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()});
+  TypeParam n({gen()});
+  n = m;
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, MoveAssignmentOverwritesExisting) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  TypeParam m({gen(), gen(), gen()});
+  TypeParam t(m);
+  TypeParam n({gen()});
+  n = std::move(t);
+  EXPECT_EQ(m, n);
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentFromInitializerListOverwritesExisting) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m;
+  m = values;
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+TYPED_TEST_P(ConstructorTest, AssignmentOnSelf) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  hash_internal::Generator<T> gen;
+  std::initializer_list<T> values = {gen(), gen(), gen(), gen(), gen()};
+  TypeParam m(values);
+  m = *&m;  // Avoid -Wself-assign.
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+REGISTER_TYPED_TEST_CASE_P(
+    ConstructorTest, NoArgs, BucketCount, BucketCountHash, BucketCountHashEqual,
+    BucketCountHashEqualAlloc, BucketCountAlloc, BucketCountHashAlloc, Alloc,
+    InputIteratorBucketHashEqualAlloc, InputIteratorBucketAlloc,
+    InputIteratorBucketHashAlloc, CopyConstructor, CopyConstructorAlloc,
+    MoveConstructor, MoveConstructorAlloc, InitializerListBucketHashEqualAlloc,
+    InitializerListBucketAlloc, InitializerListBucketHashAlloc, CopyAssignment,
+    MoveAssignment, AssignmentFromInitializerList, AssignmentOverwritesExisting,
+    MoveAssignmentOverwritesExisting,
+    AssignmentFromInitializerListOverwritesExisting, AssignmentOnSelf);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_CONSTRUCTOR_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h
new file mode 100644 (file)
index 0000000..05b32b5
--- /dev/null
@@ -0,0 +1,89 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/container/internal/hash_generator_testing.h"
+#include "absl/container/internal/hash_policy_testing.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordSet>
+class LookupTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(LookupTest);
+
+TYPED_TEST_P(LookupTest, Count) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& v : values)
+    EXPECT_EQ(0, m.count(v)) << ::testing::PrintToString(v);
+  m.insert(values.begin(), values.end());
+  for (const auto& v : values)
+    EXPECT_EQ(1, m.count(v)) << ::testing::PrintToString(v);
+}
+
+TYPED_TEST_P(LookupTest, Find) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& v : values)
+    EXPECT_TRUE(m.end() == m.find(v)) << ::testing::PrintToString(v);
+  m.insert(values.begin(), values.end());
+  for (const auto& v : values) {
+    typename TypeParam::iterator it = m.find(v);
+    static_assert(std::is_same<const typename TypeParam::value_type&,
+                               decltype(*it)>::value,
+                  "");
+    static_assert(std::is_same<const typename TypeParam::value_type*,
+                               decltype(it.operator->())>::value,
+                  "");
+    EXPECT_TRUE(m.end() != it) << ::testing::PrintToString(v);
+    EXPECT_EQ(v, *it) << ::testing::PrintToString(v);
+  }
+}
+
+TYPED_TEST_P(LookupTest, EqualRange) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  for (const auto& v : values) {
+    auto r = m.equal_range(v);
+    ASSERT_EQ(0, std::distance(r.first, r.second));
+  }
+  m.insert(values.begin(), values.end());
+  for (const auto& v : values) {
+    auto r = m.equal_range(v);
+    ASSERT_EQ(1, std::distance(r.first, r.second));
+    EXPECT_EQ(v, *r.first);
+  }
+}
+
+REGISTER_TYPED_TEST_CASE_P(LookupTest, Count, Find, EqualRange);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_LOOKUP_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_members_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_members_test.h
new file mode 100644 (file)
index 0000000..b96c945
--- /dev/null
@@ -0,0 +1,84 @@
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_
+
+#include <type_traits>
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordSet>
+class MembersTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(MembersTest);
+
+template <typename T>
+void UseType() {}
+
+TYPED_TEST_P(MembersTest, Typedefs) {
+  EXPECT_TRUE((std::is_same<typename TypeParam::key_type,
+                            typename TypeParam::value_type>()));
+  EXPECT_TRUE((absl::conjunction<
+               absl::negation<std::is_signed<typename TypeParam::size_type>>,
+               std::is_integral<typename TypeParam::size_type>>()));
+  EXPECT_TRUE((absl::conjunction<
+               std::is_signed<typename TypeParam::difference_type>,
+               std::is_integral<typename TypeParam::difference_type>>()));
+  EXPECT_TRUE((std::is_convertible<
+               decltype(std::declval<const typename TypeParam::hasher&>()(
+                   std::declval<const typename TypeParam::key_type&>())),
+               size_t>()));
+  EXPECT_TRUE((std::is_convertible<
+               decltype(std::declval<const typename TypeParam::key_equal&>()(
+                   std::declval<const typename TypeParam::key_type&>(),
+                   std::declval<const typename TypeParam::key_type&>())),
+               bool>()));
+  EXPECT_TRUE((std::is_same<typename TypeParam::allocator_type::value_type,
+                            typename TypeParam::value_type>()));
+  EXPECT_TRUE((std::is_same<typename TypeParam::value_type&,
+                            typename TypeParam::reference>()));
+  EXPECT_TRUE((std::is_same<const typename TypeParam::value_type&,
+                            typename TypeParam::const_reference>()));
+  EXPECT_TRUE((std::is_same<typename std::allocator_traits<
+                                typename TypeParam::allocator_type>::pointer,
+                            typename TypeParam::pointer>()));
+  EXPECT_TRUE(
+      (std::is_same<typename std::allocator_traits<
+                        typename TypeParam::allocator_type>::const_pointer,
+                    typename TypeParam::const_pointer>()));
+}
+
+TYPED_TEST_P(MembersTest, SimpleFunctions) {
+  EXPECT_GT(TypeParam().max_size(), 0);
+}
+
+TYPED_TEST_P(MembersTest, BeginEnd) {
+  TypeParam t = {typename TypeParam::value_type{}};
+  EXPECT_EQ(t.begin(), t.cbegin());
+  EXPECT_EQ(t.end(), t.cend());
+  EXPECT_NE(t.begin(), t.end());
+  EXPECT_NE(t.cbegin(), t.cend());
+}
+
+REGISTER_TYPED_TEST_SUITE_P(MembersTest, Typedefs, SimpleFunctions, BeginEnd);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MEMBERS_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h
new file mode 100644 (file)
index 0000000..79a8d42
--- /dev/null
@@ -0,0 +1,188 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MODIFIERS_TEST_H_
+#define ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MODIFIERS_TEST_H_
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/container/internal/hash_generator_testing.h"
+#include "absl/container/internal/hash_policy_testing.h"
+
+namespace absl {
+namespace container_internal {
+
+template <class UnordSet>
+class ModifiersTest : public ::testing::Test {};
+
+TYPED_TEST_SUITE_P(ModifiersTest);
+
+TYPED_TEST_P(ModifiersTest, Clear) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  m.clear();
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_TRUE(m.empty());
+}
+
+TYPED_TEST_P(ModifiersTest, Insert) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  auto p = m.insert(val);
+  EXPECT_TRUE(p.second);
+  EXPECT_EQ(val, *p.first);
+  p = m.insert(val);
+  EXPECT_FALSE(p.second);
+}
+
+TYPED_TEST_P(ModifiersTest, InsertHint) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  auto it = m.insert(m.end(), val);
+  EXPECT_TRUE(it != m.end());
+  EXPECT_EQ(val, *it);
+  it = m.insert(it, val);
+  EXPECT_TRUE(it != m.end());
+  EXPECT_EQ(val, *it);
+}
+
+TYPED_TEST_P(ModifiersTest, InsertRange) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m;
+  m.insert(values.begin(), values.end());
+  ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+}
+
+TYPED_TEST_P(ModifiersTest, Emplace) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps
+  // with test traits/policy.
+  auto p = m.emplace(val);
+  EXPECT_TRUE(p.second);
+  EXPECT_EQ(val, *p.first);
+  p = m.emplace(val);
+  EXPECT_FALSE(p.second);
+  EXPECT_EQ(val, *p.first);
+}
+
+TYPED_TEST_P(ModifiersTest, EmplaceHint) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  T val = hash_internal::Generator<T>()();
+  TypeParam m;
+  // TODO(alkis): We need a way to run emplace in a more meaningful way. Perhaps
+  // with test traits/policy.
+  auto it = m.emplace_hint(m.end(), val);
+  EXPECT_EQ(val, *it);
+  it = m.emplace_hint(it, val);
+  EXPECT_EQ(val, *it);
+}
+
+template <class V>
+using IfNotVoid = typename std::enable_if<!std::is_void<V>::value, V>::type;
+
+// In openmap we chose not to return the iterator from erase because that's
+// more expensive. As such we adapt erase to return an iterator here.
+struct EraseFirst {
+  template <class Map>
+  auto operator()(Map* m, int) const
+      -> IfNotVoid<decltype(m->erase(m->begin()))> {
+    return m->erase(m->begin());
+  }
+  template <class Map>
+  typename Map::iterator operator()(Map* m, ...) const {
+    auto it = m->begin();
+    m->erase(it++);
+    return it;
+  }
+};
+
+TYPED_TEST_P(ModifiersTest, Erase) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  std::vector<T> values2;
+  for (const auto& val : values)
+    if (val != *m.begin()) values2.push_back(val);
+  auto it = EraseFirst()(&m, 0);
+  ASSERT_TRUE(it != m.end());
+  EXPECT_EQ(1, std::count(values2.begin(), values2.end(), *it));
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values2.begin(),
+                                                            values2.end()));
+}
+
+TYPED_TEST_P(ModifiersTest, EraseRange) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  auto it = m.erase(m.begin(), m.end());
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAre());
+  EXPECT_TRUE(it == m.end());
+}
+
+TYPED_TEST_P(ModifiersTest, EraseKey) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> values;
+  std::generate_n(std::back_inserter(values), 10,
+                  hash_internal::Generator<T>());
+  TypeParam m(values.begin(), values.end());
+  ASSERT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values));
+  EXPECT_EQ(1, m.erase(values[0]));
+  EXPECT_EQ(0, std::count(m.begin(), m.end(), values[0]));
+  EXPECT_THAT(keys(m), ::testing::UnorderedElementsAreArray(values.begin() + 1,
+                                                            values.end()));
+}
+
+TYPED_TEST_P(ModifiersTest, Swap) {
+  using T = hash_internal::GeneratedType<TypeParam>;
+  std::vector<T> v1;
+  std::vector<T> v2;
+  std::generate_n(std::back_inserter(v1), 5, hash_internal::Generator<T>());
+  std::generate_n(std::back_inserter(v2), 5, hash_internal::Generator<T>());
+  TypeParam m1(v1.begin(), v1.end());
+  TypeParam m2(v2.begin(), v2.end());
+  EXPECT_THAT(keys(m1), ::testing::UnorderedElementsAreArray(v1));
+  EXPECT_THAT(keys(m2), ::testing::UnorderedElementsAreArray(v2));
+  m1.swap(m2);
+  EXPECT_THAT(keys(m1), ::testing::UnorderedElementsAreArray(v2));
+  EXPECT_THAT(keys(m2), ::testing::UnorderedElementsAreArray(v1));
+}
+
+// TODO(alkis): Write tests for extract.
+// TODO(alkis): Write tests for merge.
+
+REGISTER_TYPED_TEST_CASE_P(ModifiersTest, Clear, Insert, InsertHint,
+                           InsertRange, Emplace, EmplaceHint, Erase, EraseRange,
+                           EraseKey, Swap);
+
+}  // namespace container_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_INTERNAL_UNORDERED_SET_MODIFIERS_TEST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/node_hash_map.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/node_hash_map.h
new file mode 100644 (file)
index 0000000..a841f5a
--- /dev/null
@@ -0,0 +1,582 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: node_hash_map.h
+// -----------------------------------------------------------------------------
+//
+// An `absl::node_hash_map<K, V>` is an unordered associative container of
+// unique keys and associated values designed to be a more efficient replacement
+// for `std::unordered_map`. Like `unordered_map`, search, insertion, and
+// deletion of map elements can be done as an `O(1)` operation. However,
+// `node_hash_map` (and other unordered associative containers known as the
+// collection of Abseil "Swiss tables") contain other optimizations that result
+// in both memory and computation advantages.
+//
+// In most cases, your default choice for a hash map should be a map of type
+// `flat_hash_map`. However, if you need pointer stability and cannot store
+// a `flat_hash_map` with `unique_ptr` elements, a `node_hash_map` may be a
+// valid alternative. As well, if you are migrating your code from using
+// `std::unordered_map`, a `node_hash_map` provides a more straightforward
+// migration, because it guarantees pointer stability. Consider migrating to
+// `node_hash_map` and perhaps converting to a more efficient `flat_hash_map`
+// upon further review.
+
+#ifndef ABSL_CONTAINER_NODE_HASH_MAP_H_
+#define ABSL_CONTAINER_NODE_HASH_MAP_H_
+
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "absl/algorithm/container.h"
+#include "absl/container/internal/container_memory.h"
+#include "absl/container/internal/hash_function_defaults.h"  // IWYU pragma: export
+#include "absl/container/internal/node_hash_policy.h"
+#include "absl/container/internal/raw_hash_map.h"  // IWYU pragma: export
+#include "absl/memory/memory.h"
+
+namespace absl {
+namespace container_internal {
+template <class Key, class Value>
+class NodeHashMapPolicy;
+}  // namespace container_internal
+
+// -----------------------------------------------------------------------------
+// absl::node_hash_map
+// -----------------------------------------------------------------------------
+//
+// An `absl::node_hash_map<K, V>` is an unordered associative container which
+// has been optimized for both speed and memory footprint in most common use
+// cases. Its interface is similar to that of `std::unordered_map<K, V>` with
+// the following notable differences:
+//
+// * Supports heterogeneous lookup, through `find()`, `operator[]()` and
+//   `insert()`, provided that the map is provided a compatible heterogeneous
+//   hashing function and equality operator.
+// * Contains a `capacity()` member function indicating the number of element
+//   slots (open, deleted, and empty) within the hash map.
+// * Returns `void` from the `erase(iterator)` overload.
+//
+// By default, `node_hash_map` uses the `absl::Hash` hashing framework.
+// All fundamental and Abseil types that support the `absl::Hash` framework have
+// a compatible equality operator for comparing insertions into `node_hash_map`.
+// If your type is not yet supported by the `absl::Hash` framework, see
+// absl/hash/hash.h for information on extending Abseil hashing to user-defined
+// types.
+//
+// Example:
+//
+//   // Create a node hash map of three strings (that map to strings)
+//   absl::node_hash_map<std::string, std::string> ducks =
+//     {{"a", "huey"}, {"b", "dewey"}, {"c", "louie"}};
+//
+//  // Insert a new element into the node hash map
+//  ducks.insert({"d", "donald"}};
+//
+//  // Force a rehash of the node hash map
+//  ducks.rehash(0);
+//
+//  // Find the element with the key "b"
+//  std::string search_key = "b";
+//  auto result = ducks.find(search_key);
+//  if (result != ducks.end()) {
+//    std::cout << "Result: " << result->second << std::endl;
+//  }
+template <class Key, class Value,
+          class Hash = absl::container_internal::hash_default_hash<Key>,
+          class Eq = absl::container_internal::hash_default_eq<Key>,
+          class Alloc = std::allocator<std::pair<const Key, Value>>>
+class node_hash_map
+    : public absl::container_internal::raw_hash_map<
+          absl::container_internal::NodeHashMapPolicy<Key, Value>, Hash, Eq,
+          Alloc> {
+  using Base = typename node_hash_map::raw_hash_map;
+
+ public:
+  // Constructors and Assignment Operators
+  //
+  // A node_hash_map supports the same overload set as `std::unordered_map`
+  // for construction and assignment:
+  //
+  // *  Default constructor
+  //
+  //    // No allocation for the table's elements is made.
+  //    absl::node_hash_map<int, std::string> map1;
+  //
+  // * Initializer List constructor
+  //
+  //   absl::node_hash_map<int, std::string> map2 =
+  //       {{1, "huey"}, {2, "dewey"}, {3, "louie"},};
+  //
+  // * Copy constructor
+  //
+  //   absl::node_hash_map<int, std::string> map3(map2);
+  //
+  // * Copy assignment operator
+  //
+  //  // Hash functor and Comparator are copied as well
+  //  absl::node_hash_map<int, std::string> map4;
+  //  map4 = map3;
+  //
+  // * Move constructor
+  //
+  //   // Move is guaranteed efficient
+  //   absl::node_hash_map<int, std::string> map5(std::move(map4));
+  //
+  // * Move assignment operator
+  //
+  //   // May be efficient if allocators are compatible
+  //   absl::node_hash_map<int, std::string> map6;
+  //   map6 = std::move(map5);
+  //
+  // * Range constructor
+  //
+  //   std::vector<std::pair<int, std::string>> v = {{1, "a"}, {2, "b"}};
+  //   absl::node_hash_map<int, std::string> map7(v.begin(), v.end());
+  node_hash_map() {}
+  using Base::Base;
+
+  // node_hash_map::begin()
+  //
+  // Returns an iterator to the beginning of the `node_hash_map`.
+  using Base::begin;
+
+  // node_hash_map::cbegin()
+  //
+  // Returns a const iterator to the beginning of the `node_hash_map`.
+  using Base::cbegin;
+
+  // node_hash_map::cend()
+  //
+  // Returns a const iterator to the end of the `node_hash_map`.
+  using Base::cend;
+
+  // node_hash_map::end()
+  //
+  // Returns an iterator to the end of the `node_hash_map`.
+  using Base::end;
+
+  // node_hash_map::capacity()
+  //
+  // Returns the number of element slots (assigned, deleted, and empty)
+  // available within the `node_hash_map`.
+  //
+  // NOTE: this member function is particular to `absl::node_hash_map` and is
+  // not provided in the `std::unordered_map` API.
+  using Base::capacity;
+
+  // node_hash_map::empty()
+  //
+  // Returns whether or not the `node_hash_map` is empty.
+  using Base::empty;
+
+  // node_hash_map::max_size()
+  //
+  // Returns the largest theoretical possible number of elements within a
+  // `node_hash_map` under current memory constraints. This value can be thought
+  // of as the largest value of `std::distance(begin(), end())` for a
+  // `node_hash_map<K, V>`.
+  using Base::max_size;
+
+  // node_hash_map::size()
+  //
+  // Returns the number of elements currently within the `node_hash_map`.
+  using Base::size;
+
+  // node_hash_map::clear()
+  //
+  // Removes all elements from the `node_hash_map`. Invalidates any references,
+  // pointers, or iterators referring to contained elements.
+  //
+  // NOTE: this operation may shrink the underlying buffer. To avoid shrinking
+  // the underlying buffer call `erase(begin(), end())`.
+  using Base::clear;
+
+  // node_hash_map::erase()
+  //
+  // Erases elements within the `node_hash_map`. Erasing does not trigger a
+  // rehash. Overloads are listed below.
+  //
+  // void erase(const_iterator pos):
+  //
+  //   Erases the element at `position` of the `node_hash_map`, returning
+  //   `void`.
+  //
+  //   NOTE: this return behavior is different than that of STL containers in
+  //   general and `std::unordered_map` in particular.
+  //
+  // iterator erase(const_iterator first, const_iterator last):
+  //
+  //   Erases the elements in the open interval [`first`, `last`), returning an
+  //   iterator pointing to `last`.
+  //
+  // size_type erase(const key_type& key):
+  //
+  //   Erases the element with the matching key, if it exists.
+  using Base::erase;
+
+  // node_hash_map::insert()
+  //
+  // Inserts an element of the specified value into the `node_hash_map`,
+  // returning an iterator pointing to the newly inserted element, provided that
+  // an element with the given key does not already exist. If rehashing occurs
+  // due to the insertion, all iterators are invalidated. Overloads are listed
+  // below.
+  //
+  // std::pair<iterator,bool> insert(const init_type& value):
+  //
+  //   Inserts a value into the `node_hash_map`. Returns a pair consisting of an
+  //   iterator to the inserted element (or to the element that prevented the
+  //   insertion) and a `bool` denoting whether the insertion took place.
+  //
+  // std::pair<iterator,bool> insert(T&& value):
+  // std::pair<iterator,bool> insert(init_type&& value):
+  //
+  //   Inserts a moveable value into the `node_hash_map`. Returns a `std::pair`
+  //   consisting of an iterator to the inserted element (or to the element that
+  //   prevented the insertion) and a `bool` denoting whether the insertion took
+  //   place.
+  //
+  // iterator insert(const_iterator hint, const init_type& value):
+  // iterator insert(const_iterator hint, T&& value):
+  // iterator insert(const_iterator hint, init_type&& value);
+  //
+  //   Inserts a value, using the position of `hint` as a non-binding suggestion
+  //   for where to begin the insertion search. Returns an iterator to the
+  //   inserted element, or to the existing element that prevented the
+  //   insertion.
+  //
+  // void insert(InputIterator first, InputIterator last):
+  //
+  //   Inserts a range of values [`first`, `last`).
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently, for `node_hash_map` we guarantee the
+  //   first match is inserted.
+  //
+  // void insert(std::initializer_list<init_type> ilist):
+  //
+  //   Inserts the elements within the initializer list `ilist`.
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently within the initializer list, for
+  //   `node_hash_map` we guarantee the first match is inserted.
+  using Base::insert;
+
+  // node_hash_map::insert_or_assign()
+  //
+  // Inserts an element of the specified value into the `node_hash_map` provided
+  // that a value with the given key does not already exist, or replaces it with
+  // the element value if a key for that value already exists, returning an
+  // iterator pointing to the newly inserted element. If rehashing occurs due to
+  // the insertion, all iterators are invalidated. Overloads are listed
+  // below.
+  //
+  // std::pair<iterator, bool> insert_or_assign(const init_type& k, T&& obj):
+  // std::pair<iterator, bool> insert_or_assign(init_type&& k, T&& obj):
+  //
+  //   Inserts/Assigns (or moves) the element of the specified key into the
+  //   `node_hash_map`.
+  //
+  // iterator insert_or_assign(const_iterator hint,
+  //                           const init_type& k, T&& obj):
+  // iterator insert_or_assign(const_iterator hint, init_type&& k, T&& obj):
+  //
+  //   Inserts/Assigns (or moves) the element of the specified key into the
+  //   `node_hash_map` using the position of `hint` as a non-binding suggestion
+  //   for where to begin the insertion search.
+  using Base::insert_or_assign;
+
+  // node_hash_map::emplace()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `node_hash_map`, provided that no element with the given key
+  // already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately. Prefer `try_emplace()` unless your key is not
+  // copyable or moveable.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace;
+
+  // node_hash_map::emplace_hint()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `node_hash_map`, using the position of `hint` as a non-binding
+  // suggestion for where to begin the insertion search, and only inserts
+  // provided that no element with the given key already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately. Prefer `try_emplace()` unless your key is not
+  // copyable or moveable.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace_hint;
+
+  // node_hash_map::try_emplace()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `node_hash_map`, provided that no element with the given key
+  // already exists. Unlike `emplace()`, if an element with the given key
+  // already exists, we guarantee that no element is constructed.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  // Overloads are listed below.
+  //
+  //   std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args):
+  //   std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args):
+  //
+  // Inserts (via copy or move) the element of the specified key into the
+  // `node_hash_map`.
+  //
+  //   iterator try_emplace(const_iterator hint,
+  //                        const init_type& k, Args&&... args):
+  //   iterator try_emplace(const_iterator hint, init_type&& k, Args&&... args):
+  //
+  // Inserts (via copy or move) the element of the specified key into the
+  // `node_hash_map` using the position of `hint` as a non-binding suggestion
+  // for where to begin the insertion search.
+  using Base::try_emplace;
+
+  // node_hash_map::extract()
+  //
+  // Extracts the indicated element, erasing it in the process, and returns it
+  // as a C++17-compatible node handle. Overloads are listed below.
+  //
+  // node_type extract(const_iterator position):
+  //
+  //   Extracts the key,value pair of the element at the indicated position and
+  //   returns a node handle owning that extracted data.
+  //
+  // node_type extract(const key_type& x):
+  //
+  //   Extracts the key,value pair of the element with a key matching the passed
+  //   key value and returns a node handle owning that extracted data. If the
+  //   `node_hash_map` does not contain an element with a matching key, this
+  //   function returns an empty node handle.
+  using Base::extract;
+
+  // node_hash_map::merge()
+  //
+  // Extracts elements from a given `source` node hash map into this
+  // `node_hash_map`. If the destination `node_hash_map` already contains an
+  // element with an equivalent key, that element is not extracted.
+  using Base::merge;
+
+  // node_hash_map::swap(node_hash_map& other)
+  //
+  // Exchanges the contents of this `node_hash_map` with those of the `other`
+  // node hash map, avoiding invocation of any move, copy, or swap operations on
+  // individual elements.
+  //
+  // All iterators and references on the `node_hash_map` remain valid, excepting
+  // for the past-the-end iterator, which is invalidated.
+  //
+  // `swap()` requires that the node hash map's hashing and key equivalence
+  // functions be Swappable, and are exchaged using unqualified calls to
+  // non-member `swap()`. If the map's allocator has
+  // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value`
+  // set to `true`, the allocators are also exchanged using an unqualified call
+  // to non-member `swap()`; otherwise, the allocators are not swapped.
+  using Base::swap;
+
+  // node_hash_map::rehash(count)
+  //
+  // Rehashes the `node_hash_map`, setting the number of slots to be at least
+  // the passed value. If the new number of slots increases the load factor more
+  // than the current maximum load factor
+  // (`count` < `size()` / `max_load_factor()`), then the new number of slots
+  // will be at least `size()` / `max_load_factor()`.
+  //
+  // To force a rehash, pass rehash(0).
+  using Base::rehash;
+
+  // node_hash_map::reserve(count)
+  //
+  // Sets the number of slots in the `node_hash_map` to the number needed to
+  // accommodate at least `count` total elements without exceeding the current
+  // maximum load factor, and may rehash the container if needed.
+  using Base::reserve;
+
+  // node_hash_map::at()
+  //
+  // Returns a reference to the mapped value of the element with key equivalent
+  // to the passed key.
+  using Base::at;
+
+  // node_hash_map::contains()
+  //
+  // Determines whether an element with a key comparing equal to the given `key`
+  // exists within the `node_hash_map`, returning `true` if so or `false`
+  // otherwise.
+  using Base::contains;
+
+  // node_hash_map::count(const Key& key) const
+  //
+  // Returns the number of elements with a key comparing equal to the given
+  // `key` within the `node_hash_map`. note that this function will return
+  // either `1` or `0` since duplicate keys are not allowed within a
+  // `node_hash_map`.
+  using Base::count;
+
+  // node_hash_map::equal_range()
+  //
+  // Returns a closed range [first, last], defined by a `std::pair` of two
+  // iterators, containing all elements with the passed key in the
+  // `node_hash_map`.
+  using Base::equal_range;
+
+  // node_hash_map::find()
+  //
+  // Finds an element with the passed `key` within the `node_hash_map`.
+  using Base::find;
+
+  // node_hash_map::operator[]()
+  //
+  // Returns a reference to the value mapped to the passed key within the
+  // `node_hash_map`, performing an `insert()` if the key does not already
+  // exist. If an insertion occurs and results in a rehashing of the container,
+  // all iterators are invalidated. Otherwise iterators are not affected and
+  // references are not invalidated. Overloads are listed below.
+  //
+  // T& operator[](const Key& key):
+  //
+  //   Inserts an init_type object constructed in-place if the element with the
+  //   given key does not exist.
+  //
+  // T& operator[](Key&& key):
+  //
+  //   Inserts an init_type object constructed in-place provided that an element
+  //   with the given key does not exist.
+  using Base::operator[];
+
+  // node_hash_map::bucket_count()
+  //
+  // Returns the number of "buckets" within the `node_hash_map`.
+  using Base::bucket_count;
+
+  // node_hash_map::load_factor()
+  //
+  // Returns the current load factor of the `node_hash_map` (the average number
+  // of slots occupied with a value within the hash map).
+  using Base::load_factor;
+
+  // node_hash_map::max_load_factor()
+  //
+  // Manages the maximum load factor of the `node_hash_map`. Overloads are
+  // listed below.
+  //
+  // float node_hash_map::max_load_factor()
+  //
+  //   Returns the current maximum load factor of the `node_hash_map`.
+  //
+  // void node_hash_map::max_load_factor(float ml)
+  //
+  //   Sets the maximum load factor of the `node_hash_map` to the passed value.
+  //
+  //   NOTE: This overload is provided only for API compatibility with the STL;
+  //   `node_hash_map` will ignore any set load factor and manage its rehashing
+  //   internally as an implementation detail.
+  using Base::max_load_factor;
+
+  // node_hash_map::get_allocator()
+  //
+  // Returns the allocator function associated with this `node_hash_map`.
+  using Base::get_allocator;
+
+  // node_hash_map::hash_function()
+  //
+  // Returns the hashing function used to hash the keys within this
+  // `node_hash_map`.
+  using Base::hash_function;
+
+  // node_hash_map::key_eq()
+  //
+  // Returns the function used for comparing keys equality.
+  using Base::key_eq;
+
+  ABSL_DEPRECATED("Call `hash_function()` instead.")
+  typename Base::hasher hash_funct() { return this->hash_function(); }
+
+  ABSL_DEPRECATED("Call `rehash()` instead.")
+  void resize(typename Base::size_type hint) { this->rehash(hint); }
+};
+
+namespace container_internal {
+
+template <class Key, class Value>
+class NodeHashMapPolicy
+    : public absl::container_internal::node_hash_policy<
+          std::pair<const Key, Value>&, NodeHashMapPolicy<Key, Value>> {
+  using value_type = std::pair<const Key, Value>;
+
+ public:
+  using key_type = Key;
+  using mapped_type = Value;
+  using init_type = std::pair</*non const*/ key_type, mapped_type>;
+
+  template <class Allocator, class... Args>
+  static value_type* new_element(Allocator* alloc, Args&&... args) {
+    using PairAlloc = typename absl::allocator_traits<
+        Allocator>::template rebind_alloc<value_type>;
+    PairAlloc pair_alloc(*alloc);
+    value_type* res =
+        absl::allocator_traits<PairAlloc>::allocate(pair_alloc, 1);
+    absl::allocator_traits<PairAlloc>::construct(pair_alloc, res,
+                                                 std::forward<Args>(args)...);
+    return res;
+  }
+
+  template <class Allocator>
+  static void delete_element(Allocator* alloc, value_type* pair) {
+    using PairAlloc = typename absl::allocator_traits<
+        Allocator>::template rebind_alloc<value_type>;
+    PairAlloc pair_alloc(*alloc);
+    absl::allocator_traits<PairAlloc>::destroy(pair_alloc, pair);
+    absl::allocator_traits<PairAlloc>::deallocate(pair_alloc, pair, 1);
+  }
+
+  template <class F, class... Args>
+  static decltype(absl::container_internal::DecomposePair(
+      std::declval<F>(), std::declval<Args>()...))
+  apply(F&& f, Args&&... args) {
+    return absl::container_internal::DecomposePair(std::forward<F>(f),
+                                                   std::forward<Args>(args)...);
+  }
+
+  static size_t element_space_used(const value_type*) {
+    return sizeof(value_type);
+  }
+
+  static Value& value(value_type* elem) { return elem->second; }
+  static const Value& value(const value_type* elem) { return elem->second; }
+};
+}  // namespace container_internal
+
+namespace container_algorithm_internal {
+
+// Specialization of trait in absl/algorithm/container.h
+template <class Key, class T, class Hash, class KeyEqual, class Allocator>
+struct IsUnorderedContainer<
+    absl::node_hash_map<Key, T, Hash, KeyEqual, Allocator>> : std::true_type {};
+
+}  // namespace container_algorithm_internal
+
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_NODE_HASH_MAP_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/node_hash_set.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/container/node_hash_set.h
new file mode 100644 (file)
index 0000000..0cd1fe5
--- /dev/null
@@ -0,0 +1,488 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: node_hash_set.h
+// -----------------------------------------------------------------------------
+//
+// An `absl::node_hash_set<T>` is an unordered associative container designed to
+// be a more efficient replacement for `std::unordered_set`. Like
+// `unordered_set`, search, insertion, and deletion of map elements can be done
+// as an `O(1)` operation. However, `node_hash_set` (and other unordered
+// associative containers known as the collection of Abseil "Swiss tables")
+// contain other optimizations that result in both memory and computation
+// advantages.
+//
+// In most cases, your default choice for a hash table should be a map of type
+// `flat_hash_map` or a set of type `flat_hash_set`. However, if you need
+// pointer stability, a `node_hash_set` should be your preferred choice. As
+// well, if you are migrating your code from using `std::unordered_set`, a
+// `node_hash_set` should be an easy migration. Consider migrating to
+// `node_hash_set` and perhaps converting to a more efficient `flat_hash_set`
+// upon further review.
+
+#ifndef ABSL_CONTAINER_NODE_HASH_SET_H_
+#define ABSL_CONTAINER_NODE_HASH_SET_H_
+
+#include <type_traits>
+
+#include "absl/algorithm/container.h"
+#include "absl/container/internal/hash_function_defaults.h"  // IWYU pragma: export
+#include "absl/container/internal/node_hash_policy.h"
+#include "absl/container/internal/raw_hash_set.h"  // IWYU pragma: export
+#include "absl/memory/memory.h"
+
+namespace absl {
+namespace container_internal {
+template <typename T>
+struct NodeHashSetPolicy;
+}  // namespace container_internal
+
+// -----------------------------------------------------------------------------
+// absl::node_hash_set
+// -----------------------------------------------------------------------------
+//
+// An `absl::node_hash_set<T>` is an unordered associative container which
+// has been optimized for both speed and memory footprint in most common use
+// cases. Its interface is similar to that of `std::unordered_set<T>` with the
+// following notable differences:
+//
+// * Supports heterogeneous lookup, through `find()`, `operator[]()` and
+//   `insert()`, provided that the map is provided a compatible heterogeneous
+//   hashing function and equality operator.
+// * Contains a `capacity()` member function indicating the number of element
+//   slots (open, deleted, and empty) within the hash set.
+// * Returns `void` from the `erase(iterator)` overload.
+//
+// By default, `node_hash_set` uses the `absl::Hash` hashing framework.
+// All fundamental and Abseil types that support the `absl::Hash` framework have
+// a compatible equality operator for comparing insertions into `node_hash_set`.
+// If your type is not yet supported by the `absl::Hash` framework, see
+// absl/hash/hash.h for information on extending Abseil hashing to user-defined
+// types.
+//
+// Example:
+//
+//   // Create a node hash set of three strings
+//   absl::node_hash_map<std::string, std::string> ducks =
+//     {"huey", "dewey"}, "louie"};
+//
+//  // Insert a new element into the node hash map
+//  ducks.insert("donald"};
+//
+//  // Force a rehash of the node hash map
+//  ducks.rehash(0);
+//
+//  // See if "dewey" is present
+//  if (ducks.contains("dewey")) {
+//    std::cout << "We found dewey!" << std::endl;
+//  }
+template <class T, class Hash = absl::container_internal::hash_default_hash<T>,
+          class Eq = absl::container_internal::hash_default_eq<T>,
+          class Alloc = std::allocator<T>>
+class node_hash_set
+    : public absl::container_internal::raw_hash_set<
+          absl::container_internal::NodeHashSetPolicy<T>, Hash, Eq, Alloc> {
+  using Base = typename node_hash_set::raw_hash_set;
+
+ public:
+  // Constructors and Assignment Operators
+  //
+  // A node_hash_set supports the same overload set as `std::unordered_map`
+  // for construction and assignment:
+  //
+  // *  Default constructor
+  //
+  //    // No allocation for the table's elements is made.
+  //    absl::node_hash_set<std::string> set1;
+  //
+  // * Initializer List constructor
+  //
+  //   absl::node_hash_set<std::string> set2 =
+  //       {{"huey"}, {"dewey"}, {"louie"},};
+  //
+  // * Copy constructor
+  //
+  //   absl::node_hash_set<std::string> set3(set2);
+  //
+  // * Copy assignment operator
+  //
+  //  // Hash functor and Comparator are copied as well
+  //  absl::node_hash_set<std::string> set4;
+  //  set4 = set3;
+  //
+  // * Move constructor
+  //
+  //   // Move is guaranteed efficient
+  //   absl::node_hash_set<std::string> set5(std::move(set4));
+  //
+  // * Move assignment operator
+  //
+  //   // May be efficient if allocators are compatible
+  //   absl::node_hash_set<std::string> set6;
+  //   set6 = std::move(set5);
+  //
+  // * Range constructor
+  //
+  //   std::vector<std::string> v = {"a", "b"};
+  //   absl::node_hash_set<std::string> set7(v.begin(), v.end());
+  node_hash_set() {}
+  using Base::Base;
+
+  // node_hash_set::begin()
+  //
+  // Returns an iterator to the beginning of the `node_hash_set`.
+  using Base::begin;
+
+  // node_hash_set::cbegin()
+  //
+  // Returns a const iterator to the beginning of the `node_hash_set`.
+  using Base::cbegin;
+
+  // node_hash_set::cend()
+  //
+  // Returns a const iterator to the end of the `node_hash_set`.
+  using Base::cend;
+
+  // node_hash_set::end()
+  //
+  // Returns an iterator to the end of the `node_hash_set`.
+  using Base::end;
+
+  // node_hash_set::capacity()
+  //
+  // Returns the number of element slots (assigned, deleted, and empty)
+  // available within the `node_hash_set`.
+  //
+  // NOTE: this member function is particular to `absl::node_hash_set` and is
+  // not provided in the `std::unordered_map` API.
+  using Base::capacity;
+
+  // node_hash_set::empty()
+  //
+  // Returns whether or not the `node_hash_set` is empty.
+  using Base::empty;
+
+  // node_hash_set::max_size()
+  //
+  // Returns the largest theoretical possible number of elements within a
+  // `node_hash_set` under current memory constraints. This value can be thought
+  // of the largest value of `std::distance(begin(), end())` for a
+  // `node_hash_set<T>`.
+  using Base::max_size;
+
+  // node_hash_set::size()
+  //
+  // Returns the number of elements currently within the `node_hash_set`.
+  using Base::size;
+
+  // node_hash_set::clear()
+  //
+  // Removes all elements from the `node_hash_set`. Invalidates any references,
+  // pointers, or iterators referring to contained elements.
+  //
+  // NOTE: this operation may shrink the underlying buffer. To avoid shrinking
+  // the underlying buffer call `erase(begin(), end())`.
+  using Base::clear;
+
+  // node_hash_set::erase()
+  //
+  // Erases elements within the `node_hash_set`. Erasing does not trigger a
+  // rehash. Overloads are listed below.
+  //
+  // void erase(const_iterator pos):
+  //
+  //   Erases the element at `position` of the `node_hash_set`, returning
+  //   `void`.
+  //
+  //   NOTE: this return behavior is different than that of STL containers in
+  //   general and `std::unordered_map` in particular.
+  //
+  // iterator erase(const_iterator first, const_iterator last):
+  //
+  //   Erases the elements in the open interval [`first`, `last`), returning an
+  //   iterator pointing to `last`.
+  //
+  // size_type erase(const key_type& key):
+  //
+  //   Erases the element with the matching key, if it exists.
+  using Base::erase;
+
+  // node_hash_set::insert()
+  //
+  // Inserts an element of the specified value into the `node_hash_set`,
+  // returning an iterator pointing to the newly inserted element, provided that
+  // an element with the given key does not already exist. If rehashing occurs
+  // due to the insertion, all iterators are invalidated. Overloads are listed
+  // below.
+  //
+  // std::pair<iterator,bool> insert(const T& value):
+  //
+  //   Inserts a value into the `node_hash_set`. Returns a pair consisting of an
+  //   iterator to the inserted element (or to the element that prevented the
+  //   insertion) and a bool denoting whether the insertion took place.
+  //
+  // std::pair<iterator,bool> insert(T&& value):
+  //
+  //   Inserts a moveable value into the `node_hash_set`. Returns a pair
+  //   consisting of an iterator to the inserted element (or to the element that
+  //   prevented the insertion) and a bool denoting whether the insertion took
+  //   place.
+  //
+  // iterator insert(const_iterator hint, const T& value):
+  // iterator insert(const_iterator hint, T&& value):
+  //
+  //   Inserts a value, using the position of `hint` as a non-binding suggestion
+  //   for where to begin the insertion search. Returns an iterator to the
+  //   inserted element, or to the existing element that prevented the
+  //   insertion.
+  //
+  // void insert(InputIterator first, InputIterator last):
+  //
+  //   Inserts a range of values [`first`, `last`).
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently, for `node_hash_set` we guarantee the
+  //   first match is inserted.
+  //
+  // void insert(std::initializer_list<T> ilist):
+  //
+  //   Inserts the elements within the initializer list `ilist`.
+  //
+  //   NOTE: Although the STL does not specify which element may be inserted if
+  //   multiple keys compare equivalently within the initializer list, for
+  //   `node_hash_set` we guarantee the first match is inserted.
+  using Base::insert;
+
+  // node_hash_set::emplace()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `node_hash_set`, provided that no element with the given key
+  // already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace;
+
+  // node_hash_set::emplace_hint()
+  //
+  // Inserts an element of the specified value by constructing it in-place
+  // within the `node_hash_set`, using the position of `hint` as a non-binding
+  // suggestion for where to begin the insertion search, and only inserts
+  // provided that no element with the given key already exists.
+  //
+  // The element may be constructed even if there already is an element with the
+  // key in the container, in which case the newly constructed element will be
+  // destroyed immediately.
+  //
+  // If rehashing occurs due to the insertion, all iterators are invalidated.
+  using Base::emplace_hint;
+
+  // node_hash_set::extract()
+  //
+  // Extracts the indicated element, erasing it in the process, and returns it
+  // as a C++17-compatible node handle. Overloads are listed below.
+  //
+  // node_type extract(const_iterator position):
+  //
+  //   Extracts the element at the indicated position and returns a node handle
+  //   owning that extracted data.
+  //
+  // node_type extract(const key_type& x):
+  //
+  //   Extracts the element with the key matching the passed key value and
+  //   returns a node handle owning that extracted data. If the `node_hash_set`
+  //   does not contain an element with a matching key, this function returns an
+  // empty node handle.
+  using Base::extract;
+
+  // node_hash_set::merge()
+  //
+  // Extracts elements from a given `source` flat hash map into this
+  // `node_hash_set`. If the destination `node_hash_set` already contains an
+  // element with an equivalent key, that element is not extracted.
+  using Base::merge;
+
+  // node_hash_set::swap(node_hash_set& other)
+  //
+  // Exchanges the contents of this `node_hash_set` with those of the `other`
+  // flat hash map, avoiding invocation of any move, copy, or swap operations on
+  // individual elements.
+  //
+  // All iterators and references on the `node_hash_set` remain valid, excepting
+  // for the past-the-end iterator, which is invalidated.
+  //
+  // `swap()` requires that the flat hash set's hashing and key equivalence
+  // functions be Swappable, and are exchaged using unqualified calls to
+  // non-member `swap()`. If the map's allocator has
+  // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value`
+  // set to `true`, the allocators are also exchanged using an unqualified call
+  // to non-member `swap()`; otherwise, the allocators are not swapped.
+  using Base::swap;
+
+  // node_hash_set::rehash(count)
+  //
+  // Rehashes the `node_hash_set`, setting the number of slots to be at least
+  // the passed value. If the new number of slots increases the load factor more
+  // than the current maximum load factor
+  // (`count` < `size()` / `max_load_factor()`), then the new number of slots
+  // will be at least `size()` / `max_load_factor()`.
+  //
+  // To force a rehash, pass rehash(0).
+  //
+  // NOTE: unlike behavior in `std::unordered_set`, references are also
+  // invalidated upon a `rehash()`.
+  using Base::rehash;
+
+  // node_hash_set::reserve(count)
+  //
+  // Sets the number of slots in the `node_hash_set` to the number needed to
+  // accommodate at least `count` total elements without exceeding the current
+  // maximum load factor, and may rehash the container if needed.
+  using Base::reserve;
+
+  // node_hash_set::contains()
+  //
+  // Determines whether an element comparing equal to the given `key` exists
+  // within the `node_hash_set`, returning `true` if so or `false` otherwise.
+  using Base::contains;
+
+  // node_hash_set::count(const Key& key) const
+  //
+  // Returns the number of elements comparing equal to the given `key` within
+  // the `node_hash_set`. note that this function will return either `1` or `0`
+  // since duplicate elements are not allowed within a `node_hash_set`.
+  using Base::count;
+
+  // node_hash_set::equal_range()
+  //
+  // Returns a closed range [first, last], defined by a `std::pair` of two
+  // iterators, containing all elements with the passed key in the
+  // `node_hash_set`.
+  using Base::equal_range;
+
+  // node_hash_set::find()
+  //
+  // Finds an element with the passed `key` within the `node_hash_set`.
+  using Base::find;
+
+  // node_hash_set::bucket_count()
+  //
+  // Returns the number of "buckets" within the `node_hash_set`. Note that
+  // because a flat hash map contains all elements within its internal storage,
+  // this value simply equals the current capacity of the `node_hash_set`.
+  using Base::bucket_count;
+
+  // node_hash_set::load_factor()
+  //
+  // Returns the current load factor of the `node_hash_set` (the average number
+  // of slots occupied with a value within the hash map).
+  using Base::load_factor;
+
+  // node_hash_set::max_load_factor()
+  //
+  // Manages the maximum load factor of the `node_hash_set`. Overloads are
+  // listed below.
+  //
+  // float node_hash_set::max_load_factor()
+  //
+  //   Returns the current maximum load factor of the `node_hash_set`.
+  //
+  // void node_hash_set::max_load_factor(float ml)
+  //
+  //   Sets the maximum load factor of the `node_hash_set` to the passed value.
+  //
+  //   NOTE: This overload is provided only for API compatibility with the STL;
+  //   `node_hash_set` will ignore any set load factor and manage its rehashing
+  //   internally as an implementation detail.
+  using Base::max_load_factor;
+
+  // node_hash_set::get_allocator()
+  //
+  // Returns the allocator function associated with this `node_hash_set`.
+  using Base::get_allocator;
+
+  // node_hash_set::hash_function()
+  //
+  // Returns the hashing function used to hash the keys within this
+  // `node_hash_set`.
+  using Base::hash_function;
+
+  // node_hash_set::key_eq()
+  //
+  // Returns the function used for comparing keys equality.
+  using Base::key_eq;
+
+  ABSL_DEPRECATED("Call `hash_function()` instead.")
+  typename Base::hasher hash_funct() { return this->hash_function(); }
+
+  ABSL_DEPRECATED("Call `rehash()` instead.")
+  void resize(typename Base::size_type hint) { this->rehash(hint); }
+};
+
+namespace container_internal {
+
+template <class T>
+struct NodeHashSetPolicy
+    : absl::container_internal::node_hash_policy<T&, NodeHashSetPolicy<T>> {
+  using key_type = T;
+  using init_type = T;
+  using constant_iterators = std::true_type;
+
+  template <class Allocator, class... Args>
+  static T* new_element(Allocator* alloc, Args&&... args) {
+    using ValueAlloc =
+        typename absl::allocator_traits<Allocator>::template rebind_alloc<T>;
+    ValueAlloc value_alloc(*alloc);
+    T* res = absl::allocator_traits<ValueAlloc>::allocate(value_alloc, 1);
+    absl::allocator_traits<ValueAlloc>::construct(value_alloc, res,
+                                                  std::forward<Args>(args)...);
+    return res;
+  }
+
+  template <class Allocator>
+  static void delete_element(Allocator* alloc, T* elem) {
+    using ValueAlloc =
+        typename absl::allocator_traits<Allocator>::template rebind_alloc<T>;
+    ValueAlloc value_alloc(*alloc);
+    absl::allocator_traits<ValueAlloc>::destroy(value_alloc, elem);
+    absl::allocator_traits<ValueAlloc>::deallocate(value_alloc, elem, 1);
+  }
+
+  template <class F, class... Args>
+  static decltype(absl::container_internal::DecomposeValue(
+      std::declval<F>(), std::declval<Args>()...))
+  apply(F&& f, Args&&... args) {
+    return absl::container_internal::DecomposeValue(
+        std::forward<F>(f), std::forward<Args>(args)...);
+  }
+
+  static size_t element_space_used(const T*) { return sizeof(T); }
+};
+}  // namespace container_internal
+
+namespace container_algorithm_internal {
+
+// Specialization of trait in absl/algorithm/container.h
+template <class Key, class Hash, class KeyEqual, class Allocator>
+struct IsUnorderedContainer<absl::node_hash_set<Key, Hash, KeyEqual, Allocator>>
+    : std::true_type {};
+
+}  // namespace container_algorithm_internal
+}  // namespace absl
+
+#endif  // ABSL_CONTAINER_NODE_HASH_SET_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/failure_signal_handler.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/failure_signal_handler.h
new file mode 100644 (file)
index 0000000..1beb78b
--- /dev/null
@@ -0,0 +1,117 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: failure_signal_handler.h
+// -----------------------------------------------------------------------------
+//
+// This file configures the Abseil *failure signal handler* to capture and dump
+// useful debugging information (such as a stacktrace) upon program failure.
+//
+// To use the failure signal handler, call `absl::InstallFailureSignalHandler()`
+// very early in your program, usually in the first few lines of main():
+//
+// int main(int argc, char** argv) {
+//   // Initialize the symbolizer to get a human-readable stack trace
+//   absl::InitializeSymbolizer(argv[0]);
+//
+//   absl::FailureSignalHandlerOptions options;
+//   absl::InstallFailureSignalHandler(options);
+//   DoSomethingInteresting();
+//   return 0;
+// }
+//
+// Any program that raises a fatal signal (such as `SIGSEGV`, `SIGILL`,
+// `SIGFPE`, `SIGABRT`, `SIGTERM`, `SIGBUG`, and `SIGTRAP`) will call the
+// installed failure signal handler and provide debugging information to stderr.
+//
+// Note that you should *not* install the Abseil failure signal handler more
+// than once. You may, of course, have another (non-Abseil) failure signal
+// handler installed (which would be triggered if Abseil's failure signal
+// handler sets `call_previous_handler` to `true`).
+
+#ifndef ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_
+#define ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_
+
+namespace absl {
+
+// FailureSignalHandlerOptions
+//
+// Struct for holding `absl::InstallFailureSignalHandler()` configuration
+// options.
+struct FailureSignalHandlerOptions {
+  // If true, try to symbolize the stacktrace emitted on failure, provided that
+  // you have initialized a symbolizer for that purpose. (See symbolize.h for
+  // more information.)
+  bool symbolize_stacktrace = true;
+
+  // If true, try to run signal handlers on an alternate stack (if supported on
+  // the given platform). An alternate stack is useful for program crashes due
+  // to a stack overflow; by running on a alternate stack, the signal handler
+  // may run even when normal stack space has been exausted. The downside of
+  // using an alternate stack is that extra memory for the alternate stack needs
+  // to be pre-allocated.
+  bool use_alternate_stack = true;
+
+  // If positive, indicates the number of seconds after which the failure signal
+  // handler is invoked to abort the program. Setting such an alarm is useful in
+  // cases where the failure signal handler itself may become hung or
+  // deadlocked.
+  int alarm_on_failure_secs = 3;
+
+  // If true, call the previously registered signal handler for the signal that
+  // was received (if one was registered) after the existing signal handler
+  // runs. This mechanism can be used to chain signal handlers together.
+  //
+  // If false, the signal is raised to the default handler for that signal
+  // (which normally terminates the program).
+  //
+  // IMPORTANT: If true, the chained fatal signal handlers must not try to
+  // recover from the fatal signal. Instead, they should terminate the program
+  // via some mechanism, like raising the default handler for the signal, or by
+  // calling `_exit()`. Note that the failure signal handler may put parts of
+  // the Abseil library into a state from which they cannot recover.
+  bool call_previous_handler = false;
+
+  // If non-null, indicates a pointer to a callback function that will be called
+  // upon failure, with a std::string argument containing failure data. This function
+  // may be used as a hook to write failure data to a secondary location, such
+  // as a log file. This function may also be called with null data, as a hint
+  // to flush any buffered data before the program may be terminated. Consider
+  // flushing any buffered data in all calls to this function.
+  //
+  // Since this function runs within a signal handler, it should be
+  // async-signal-safe if possible.
+  // See http://man7.org/linux/man-pages/man7/signal-safety.7.html
+  void (*writerfn)(const char*) = nullptr;
+};
+
+// InstallFailureSignalHandler()
+//
+// Installs a signal handler for the common failure signals `SIGSEGV`, `SIGILL`,
+// `SIGFPE`, `SIGABRT`, `SIGTERM`, `SIGBUG`, and `SIGTRAP` (provided they exist
+// on the given platform). The failure signal handler dumps program failure data
+// useful for debugging in an unspecified format to stderr. This data may
+// include the program counter, a stacktrace, and register information on some
+// systems; do not rely on an exact format for the output, as it is subject to
+// change.
+void InstallFailureSignalHandler(const FailureSignalHandlerOptions& options);
+
+namespace debugging_internal {
+const char* FailureSignalToString(int signo);
+}  // namespace debugging_internal
+
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_FAILURE_SIGNAL_HANDLER_H_
index a8b3292..ca8003e 100644 (file)
@@ -4,26 +4,25 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-//
 
 #ifndef ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_
 #define ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_
 
 namespace absl {
-namespace debug_internal {
+namespace debugging_internal {
 
 // Return whether the byte at *addr is readable, without faulting.
 // Save and restores errno.
 bool AddressIsReadable(const void *addr);
 
-}  // namespace debug_internal
+}  // namespace debugging_internal
 }  // namespace absl
 
 #endif  // ABSL_DEBUGGING_INTERNAL_ADDRESS_IS_READABLE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/demangle.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/demangle.h
new file mode 100644 (file)
index 0000000..81bb0df
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// An async-signal-safe and thread-safe demangler for Itanium C++ ABI
+// (aka G++ V3 ABI).
+//
+// The demangler is implemented to be used in async signal handlers to
+// symbolize stack traces.  We cannot use libstdc++'s
+// abi::__cxa_demangle() in such signal handlers since it's not async
+// signal safe (it uses malloc() internally).
+//
+// Note that this demangler doesn't support full demangling.  More
+// specifically, it doesn't print types of function parameters and
+// types of template arguments.  It just skips them.  However, it's
+// still very useful to extract basic information such as class,
+// function, constructor, destructor, and operator names.
+//
+// See the implementation note in demangle.cc if you are interested.
+//
+// Example:
+//
+// | Mangled Name  | The Demangler | abi::__cxa_demangle()
+// |---------------|---------------|-----------------------
+// | _Z1fv         | f()           | f()
+// | _Z1fi         | f()           | f(int)
+// | _Z3foo3bar    | foo()         | foo(bar)
+// | _Z1fIiEvi     | f<>()         | void f<int>(int)
+// | _ZN1N1fE      | N::f          | N::f
+// | _ZN3Foo3BarEv | Foo::Bar()    | Foo::Bar()
+// | _Zrm1XS_"     | operator%()   | operator%(X, X)
+// | _ZN3FooC1Ev   | Foo::Foo()    | Foo::Foo()
+// | _Z1fSs        | f()           | f(std::basic_string<char,
+// |               |               |   std::char_traits<char>,
+// |               |               |   std::allocator<char> >)
+//
+// See the unit test for more examples.
+//
+// Note: we might want to write demanglers for ABIs other than Itanium
+// C++ ABI in the future.
+//
+
+#ifndef ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
+#define ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
+
+namespace absl {
+namespace debugging_internal {
+
+// Demangle `mangled`.  On success, return true and write the
+// demangled symbol name to `out`.  Otherwise, return false.
+// `out` is modified even if demangling is unsuccessful.
+bool Demangle(const char *mangled, char *out, int out_size);
+
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_DEMANGLE_H_
index 7f3dbb9..d84200d 100644 (file)
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      https://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 #endif
 
 #if defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) && \
-    !defined(__asmjs__)
+    !defined(__asmjs__) && !defined(__wasm__)
 #define ABSL_HAVE_ELF_MEM_IMAGE 1
 #endif
 
-#if ABSL_HAVE_ELF_MEM_IMAGE
+#ifdef ABSL_HAVE_ELF_MEM_IMAGE
 
 #include <link.h>  // for ElfW
 
 namespace absl {
-namespace debug_internal {
+namespace debugging_internal {
 
 // An in-memory ELF image (may not exist on disk).
 class ElfMemImage {
+ private:
+  // Sentinel: there could never be an elf image at &kInvalidBaseSentinel.
+  static const int kInvalidBaseSentinel;
+
  public:
   // Sentinel: there could never be an elf image at this address.
-  static const void *const kInvalidBase;
+  static constexpr const void *const kInvalidBase =
+    static_cast<const void*>(&kInvalidBaseSentinel);
 
   // Information about a single vdso symbol.
   // All pointers are into .dynsym, .dynstr, or .text of the VDSO.
@@ -117,7 +122,7 @@ class ElfMemImage {
   ElfW(Addr) link_base_;     // Link-time base (p_vaddr of first PT_LOAD).
 };
 
-}  // namespace debug_internal
+}  // namespace debugging_internal
 }  // namespace absl
 
 #endif  // ABSL_HAVE_ELF_MEM_IMAGE
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/examine_stack.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/examine_stack.h
new file mode 100644 (file)
index 0000000..56c9763
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
+#define ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
+
+namespace absl {
+namespace debugging_internal {
+
+// Returns the program counter from signal context, or nullptr if
+// unknown. `vuc` is a ucontext_t*. We use void* to avoid the use of
+// ucontext_t on non-POSIX systems.
+void* GetProgramCounter(void* vuc);
+
+// Uses `writerfn` to dump the program counter, stack trace, and stack
+// frame sizes.
+void DumpPCAndFrameSizesAndStackTrace(
+    void* pc, void* const stack[], int frame_sizes[], int depth,
+    int min_dropped_frames, bool symbolize_stacktrace,
+    void (*writerfn)(const char*, void*), void* writerfn_arg);
+
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_EXAMINE_STACK_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stack_consumption.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stack_consumption.h
new file mode 100644 (file)
index 0000000..b860a3c
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Helper function for measuring stack consumption of signal handlers.
+
+#ifndef ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_
+#define ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_
+
+// The code in this module is not portable.
+// Use this feature test macro to detect its availability.
+#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION
+#error ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION cannot be set directly
+#elif !defined(__APPLE__) && !defined(_WIN32) && \
+    (defined(__i386__) || defined(__x86_64__) || defined(__ppc__))
+#define ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION 1
+
+namespace absl {
+namespace debugging_internal {
+
+// Returns the stack consumption in bytes for the code exercised by
+// signal_handler.  To measure stack consumption, signal_handler is registered
+// as a signal handler, so the code that it exercises must be async-signal
+// safe.  The argument of signal_handler is an implementation detail of signal
+// handlers and should ignored by the code for signal_handler.  Use global
+// variables to pass information between your test code and signal_handler.
+int GetSignalHandlerStackConsumption(void (*signal_handler)(int));
+
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACK_CONSUMPTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc
new file mode 100644 (file)
index 0000000..7ed6b3e
--- /dev/null
@@ -0,0 +1,190 @@
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_AARCH64_INL_H_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_AARCH64_INL_H_
+
+// Generate stack tracer for aarch64
+
+#if defined(__linux__)
+#include <sys/mman.h>
+#include <ucontext.h>
+#include <unistd.h>
+#endif
+
+#include <atomic>
+#include <cassert>
+#include <cstdint>
+#include <iostream>
+
+#include "absl/base/attributes.h"
+#include "absl/debugging/internal/address_is_readable.h"
+#include "absl/debugging/internal/vdso_support.h"  // a no-op on non-elf or non-glibc systems
+#include "absl/debugging/stacktrace.h"
+
+static const uintptr_t kUnknownFrameSize = 0;
+
+#if defined(__linux__)
+// Returns the address of the VDSO __kernel_rt_sigreturn function, if present.
+static const unsigned char* GetKernelRtSigreturnAddress() {
+  constexpr uintptr_t kImpossibleAddress = 1;
+  ABSL_CONST_INIT static std::atomic<uintptr_t> memoized{kImpossibleAddress};
+  uintptr_t address = memoized.load(std::memory_order_relaxed);
+  if (address != kImpossibleAddress) {
+    return reinterpret_cast<const unsigned char*>(address);
+  }
+
+  address = reinterpret_cast<uintptr_t>(nullptr);
+
+#ifdef ABSL_HAVE_VDSO_SUPPORT
+  absl::debugging_internal::VDSOSupport vdso;
+  if (vdso.IsPresent()) {
+    absl::debugging_internal::VDSOSupport::SymbolInfo symbol_info;
+    if (!vdso.LookupSymbol("__kernel_rt_sigreturn", "LINUX_2.6.39", STT_FUNC,
+                           &symbol_info) ||
+        symbol_info.address == nullptr) {
+      // Unexpected: VDSO is present, yet the expected symbol is missing
+      // or null.
+      assert(false && "VDSO is present, but doesn't have expected symbol");
+    } else {
+      if (reinterpret_cast<uintptr_t>(symbol_info.address) !=
+          kImpossibleAddress) {
+        address = reinterpret_cast<uintptr_t>(symbol_info.address);
+      } else {
+        assert(false && "VDSO returned invalid address");
+      }
+    }
+  }
+#endif
+
+  memoized.store(address, std::memory_order_relaxed);
+  return reinterpret_cast<const unsigned char*>(address);
+}
+#endif  // __linux__
+
+// Compute the size of a stack frame in [low..high).  We assume that
+// low < high.  Return size of kUnknownFrameSize.
+template<typename T>
+static inline uintptr_t ComputeStackFrameSize(const T* low,
+                                              const T* high) {
+  const char* low_char_ptr = reinterpret_cast<const char *>(low);
+  const char* high_char_ptr = reinterpret_cast<const char *>(high);
+  return low < high ? high_char_ptr - low_char_ptr : kUnknownFrameSize;
+}
+
+// Given a pointer to a stack frame, locate and return the calling
+// stackframe, or return null if no stackframe can be found. Perform sanity
+// checks (the strictness of which is controlled by the boolean parameter
+// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned.
+template<bool STRICT_UNWINDING, bool WITH_CONTEXT>
+static void **NextStackFrame(void **old_frame_pointer, const void *uc) {
+  void **new_frame_pointer = reinterpret_cast<void**>(*old_frame_pointer);
+  bool check_frame_size = true;
+
+#if defined(__linux__)
+  if (WITH_CONTEXT && uc != nullptr) {
+    // Check to see if next frame's return address is __kernel_rt_sigreturn.
+    if (old_frame_pointer[1] == GetKernelRtSigreturnAddress()) {
+      const ucontext_t *ucv = static_cast<const ucontext_t *>(uc);
+      // old_frame_pointer[0] is not suitable for unwinding, look at
+      // ucontext to discover frame pointer before signal.
+      void **const pre_signal_frame_pointer =
+          reinterpret_cast<void **>(ucv->uc_mcontext.regs[29]);
+
+      // Check that alleged frame pointer is actually readable. This is to
+      // prevent "double fault" in case we hit the first fault due to e.g.
+      // stack corruption.
+      if (!absl::debugging_internal::AddressIsReadable(
+              pre_signal_frame_pointer))
+        return nullptr;
+
+      // Alleged frame pointer is readable, use it for further unwinding.
+      new_frame_pointer = pre_signal_frame_pointer;
+
+      // Skip frame size check if we return from a signal. We may be using a
+      // an alternate stack for signals.
+      check_frame_size = false;
+    }
+  }
+#endif
+
+  // aarch64 ABI requires stack pointer to be 16-byte-aligned.
+  if ((reinterpret_cast<uintptr_t>(new_frame_pointer) & 15) != 0)
+    return nullptr;
+
+  // Check frame size.  In strict mode, we assume frames to be under
+  // 100,000 bytes.  In non-strict mode, we relax the limit to 1MB.
+  if (check_frame_size) {
+    const uintptr_t max_size = STRICT_UNWINDING ? 100000 : 1000000;
+    const uintptr_t frame_size =
+        ComputeStackFrameSize(old_frame_pointer, new_frame_pointer);
+    if (frame_size == kUnknownFrameSize || frame_size > max_size)
+      return nullptr;
+  }
+
+  return new_frame_pointer;
+}
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
+                      const void *ucp, int *min_dropped_frames) {
+#ifdef __GNUC__
+  void **frame_pointer = reinterpret_cast<void**>(__builtin_frame_address(0));
+#else
+# error reading stack point not yet supported on this platform.
+#endif
+
+  skip_count++;    // Skip the frame for this function.
+  int n = 0;
+
+  // The frame pointer points to low address of a frame.  The first 64-bit
+  // word of a frame points to the next frame up the call chain, which normally
+  // is just after the high address of the current frame.  The second word of
+  // a frame contains return adress of to the caller.   To find a pc value
+  // associated with the current frame, we need to go down a level in the call
+  // chain.  So we remember return the address of the last frame seen.  This
+  // does not work for the first stack frame, which belongs to UnwindImp() but
+  // we skip the frame for UnwindImp() anyway.
+  void* prev_return_address = nullptr;
+
+  while (frame_pointer && n < max_depth) {
+    // The absl::GetStackFrames routine is called when we are in some
+    // informational context (the failure signal handler for example).
+    // Use the non-strict unwinding rules to produce a stack trace
+    // that is as complete as possible (even if it contains a few bogus
+    // entries in some rare cases).
+    void **next_frame_pointer =
+        NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(frame_pointer, ucp);
+
+    if (skip_count > 0) {
+      skip_count--;
+    } else {
+      result[n] = prev_return_address;
+      if (IS_STACK_FRAMES) {
+        sizes[n] = ComputeStackFrameSize(frame_pointer, next_frame_pointer);
+      }
+      n++;
+    }
+    prev_return_address = frame_pointer[1];
+    frame_pointer = next_frame_pointer;
+  }
+  if (min_dropped_frames != nullptr) {
+    // Implementation detail: we clamp the max of frames we are willing to
+    // count, so as not to spend too much time in the loop below.
+    const int kMaxUnwind = 200;
+    int j = 0;
+    for (; frame_pointer != nullptr && j < kMaxUnwind; j++) {
+      frame_pointer =
+          NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(frame_pointer, ucp);
+    }
+    *min_dropped_frames = j;
+  }
+  return n;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return true;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_AARCH64_INL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc
new file mode 100644 (file)
index 0000000..c840833
--- /dev/null
@@ -0,0 +1,123 @@
+// Copyright 2011 and onwards Google Inc.
+// All rights reserved.
+//
+// Author: Doug Kwan
+// This is inspired by Craig Silverstein's PowerPC stacktrace code.
+//
+
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_
+
+#include <cstdint>
+
+#include "absl/debugging/stacktrace.h"
+
+// WARNING:
+// This only works if all your code is in either ARM or THUMB mode.  With
+// interworking, the frame pointer of the caller can either be in r11 (ARM
+// mode) or r7 (THUMB mode).  A callee only saves the frame pointer of its
+// mode in a fixed location on its stack frame.  If the caller is a different
+// mode, there is no easy way to find the frame pointer.  It can either be
+// still in the designated register or saved on stack along with other callee
+// saved registers.
+
+// Given a pointer to a stack frame, locate and return the calling
+// stackframe, or return nullptr if no stackframe can be found. Perform sanity
+// checks (the strictness of which is controlled by the boolean parameter
+// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned.
+template<bool STRICT_UNWINDING>
+static void **NextStackFrame(void **old_sp) {
+  void **new_sp = (void**) old_sp[-1];
+
+  // Check that the transition from frame pointer old_sp to frame
+  // pointer new_sp isn't clearly bogus
+  if (STRICT_UNWINDING) {
+    // With the stack growing downwards, older stack frame must be
+    // at a greater address that the current one.
+    if (new_sp <= old_sp) return nullptr;
+    // Assume stack frames larger than 100,000 bytes are bogus.
+    if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return nullptr;
+  } else {
+    // In the non-strict mode, allow discontiguous stack frames.
+    // (alternate-signal-stacks for example).
+    if (new_sp == old_sp) return nullptr;
+    // And allow frames upto about 1MB.
+    if ((new_sp > old_sp)
+        && ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) return nullptr;
+  }
+  if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return nullptr;
+  return new_sp;
+}
+
+// This ensures that absl::GetStackTrace sets up the Link Register properly.
+#ifdef __GNUC__
+void StacktraceArmDummyFunction() __attribute__((noinline));
+void StacktraceArmDummyFunction() { __asm__ volatile(""); }
+#else
+# error StacktraceArmDummyFunction() needs to be ported to this platform.
+#endif
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
+                      const void * /* ucp */, int *min_dropped_frames) {
+#ifdef __GNUC__
+  void **sp = reinterpret_cast<void**>(__builtin_frame_address(0));
+#else
+# error reading stack point not yet supported on this platform.
+#endif
+
+  // On ARM, the return address is stored in the link register (r14).
+  // This is not saved on the stack frame of a leaf function.  To
+  // simplify code that reads return addresses, we call a dummy
+  // function so that the return address of this function is also
+  // stored in the stack frame.  This works at least for gcc.
+  StacktraceArmDummyFunction();
+
+  int n = 0;
+  while (sp && n < max_depth) {
+    // The absl::GetStackFrames routine is called when we are in some
+    // informational context (the failure signal handler for example).
+    // Use the non-strict unwinding rules to produce a stack trace
+    // that is as complete as possible (even if it contains a few bogus
+    // entries in some rare cases).
+    void **next_sp = NextStackFrame<!IS_STACK_FRAMES>(sp);
+
+    if (skip_count > 0) {
+      skip_count--;
+    } else {
+      result[n] = *sp;
+
+      if (IS_STACK_FRAMES) {
+        if (next_sp > sp) {
+          sizes[n] = (uintptr_t)next_sp - (uintptr_t)sp;
+        } else {
+          // A frame-size of 0 is used to indicate unknown frame size.
+          sizes[n] = 0;
+        }
+      }
+      n++;
+    }
+    sp = next_sp;
+  }
+  if (min_dropped_frames != nullptr) {
+    // Implementation detail: we clamp the max of frames we are willing to
+    // count, so as not to spend too much time in the loop below.
+    const int kMaxUnwind = 200;
+    int j = 0;
+    for (; sp != nullptr && j < kMaxUnwind; j++) {
+      sp = NextStackFrame<!IS_STACK_FRAMES>(sp);
+    }
+    *min_dropped_frames = j;
+  }
+  return n;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return false;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_
index 57f0b0f..d4e8480 100644 (file)
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      https://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 #ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_
 #define ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_
 
-// First, test platforms which only support a stub.
-#if ABSL_STACKTRACE_INL_HEADER
+#if defined(ABSL_STACKTRACE_INL_HEADER)
 #error ABSL_STACKTRACE_INL_HEADER cannot be directly set
-#elif defined(__native_client__) || defined(__APPLE__) || \
-    defined(__ANDROID__) || defined(__myriad2__) || defined(asmjs__) || \
-    defined(__Fuchsia__)
-#define ABSL_STACKTRACE_INL_HEADER \
-    "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
 
-// Next, test for Mips and Windows.
-// TODO(marmstrong): Mips case, remove the check for ABSL_STACKTRACE_INL_HEADER
-#elif defined(__mips__) && !defined(ABSL_STACKTRACE_INL_HEADER)
-#define ABSL_STACKTRACE_INL_HEADER \
-    "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
-#elif defined(_WIN32)  // windows
+#elif defined(_WIN32)
 #define ABSL_STACKTRACE_INL_HEADER \
     "absl/debugging/internal/stacktrace_win32-inl.inc"
 
-// Finally, test NO_FRAME_POINTER.
-#elif !defined(NO_FRAME_POINTER)
+#elif defined(__linux__) && !defined(__ANDROID__)
+
+#if !defined(NO_FRAME_POINTER)
 # if defined(__i386__) || defined(__x86_64__)
 #define ABSL_STACKTRACE_INL_HEADER \
     "absl/debugging/internal/stacktrace_x86-inl.inc"
 #define ABSL_STACKTRACE_INL_HEADER \
     "absl/debugging/internal/stacktrace_aarch64-inl.inc"
 # elif defined(__arm__)
+// Note: When using glibc this may require -funwind-tables to function properly.
 #define ABSL_STACKTRACE_INL_HEADER \
-    "absl/debugging/internal/stacktrace_arm-inl.inc"
+  "absl/debugging/internal/stacktrace_generic-inl.inc"
+# else
+#define ABSL_STACKTRACE_INL_HEADER \
+   "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
 # endif
 #else  // defined(NO_FRAME_POINTER)
 # if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
 #define ABSL_STACKTRACE_INL_HEADER \
-    "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
+    "absl/debugging/internal/stacktrace_generic-inl.inc"
 # elif defined(__ppc__) || defined(__PPC__)
-//  Use glibc's backtrace.
 #define ABSL_STACKTRACE_INL_HEADER \
     "absl/debugging/internal/stacktrace_generic-inl.inc"
-# elif defined(__arm__)
-#   error stacktrace without frame pointer is not supported on ARM
+# else
+#define ABSL_STACKTRACE_INL_HEADER \
+   "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
 # endif
 #endif  // NO_FRAME_POINTER
 
-#if !defined(ABSL_STACKTRACE_INL_HEADER)
-#error Not supported yet
+#else
+#define ABSL_STACKTRACE_INL_HEADER \
+  "absl/debugging/internal/stacktrace_unimplemented-inl.inc"
+
 #endif
 
 #endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_CONFIG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc
new file mode 100644 (file)
index 0000000..2e876fe
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright 2000 - 2007 Google Inc.
+// All rights reserved.
+//
+// Author: Sanjay Ghemawat
+//
+// Portable implementation - just use glibc
+//
+// Note:  The glibc implementation may cause a call to malloc.
+// This can cause a deadlock in HeapProfiler.
+
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_GENERIC_INL_H_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_GENERIC_INL_H_
+
+#include <execinfo.h>
+#include <atomic>
+#include <cstring>
+
+#include "absl/debugging/stacktrace.h"
+
+// Sometimes, we can try to get a stack trace from within a stack
+// trace, because we don't block signals inside this code (which would be too
+// expensive: the two extra system calls per stack trace do matter here).
+// That can cause a self-deadlock.
+// Protect against such reentrant call by failing to get a stack trace.
+//
+// We use __thread here because the code here is extremely low level -- it is
+// called while collecting stack traces from within malloc and mmap, and thus
+// can not call anything which might call malloc or mmap itself.
+static __thread int recursive = 0;
+
+// The stack trace function might be invoked very early in the program's
+// execution (e.g. from the very first malloc if using tcmalloc). Also, the
+// glibc implementation itself will trigger malloc the first time it is called.
+// As such, we suppress usage of backtrace during this early stage of execution.
+static std::atomic<bool> disable_stacktraces(true);  // Disabled until healthy.
+// Waiting until static initializers run seems to be late enough.
+// This file is included into stacktrace.cc so this will only run once.
+static int stacktraces_enabler = []() {
+  void* unused_stack[1];
+  // Force the first backtrace to happen early to get the one-time shared lib
+  // loading (allocation) out of the way. After the first call it is much safer
+  // to use backtrace from a signal handler if we crash somewhere later.
+  backtrace(unused_stack, 1);
+  disable_stacktraces.store(false, std::memory_order_relaxed);
+  return 0;
+}();
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
+                      const void *ucp, int *min_dropped_frames) {
+  if (recursive || disable_stacktraces.load(std::memory_order_relaxed)) {
+    return 0;
+  }
+  ++recursive;
+
+  static_cast<void>(ucp);  // Unused.
+  static const int kStackLength = 64;
+  void * stack[kStackLength];
+  int size;
+
+  size = backtrace(stack, kStackLength);
+  skip_count++;  // we want to skip the current frame as well
+  int result_count = size - skip_count;
+  if (result_count < 0)
+    result_count = 0;
+  if (result_count > max_depth)
+    result_count = max_depth;
+  for (int i = 0; i < result_count; i++)
+    result[i] = stack[i + skip_count];
+
+  if (IS_STACK_FRAMES) {
+    // No implementation for finding out the stack frame sizes yet.
+    memset(sizes, 0, sizeof(*sizes) * result_count);
+  }
+  if (min_dropped_frames != nullptr) {
+    if (size - skip_count - max_depth > 0) {
+      *min_dropped_frames = size - skip_count - max_depth;
+    } else {
+      *min_dropped_frames = 0;
+    }
+  }
+
+  --recursive;
+
+  return result_count;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return true;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_GENERIC_INL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
new file mode 100644 (file)
index 0000000..9e0f2aa
--- /dev/null
@@ -0,0 +1,246 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Produce stack trace.  I'm guessing (hoping!) the code is much like
+// for x86.  For apple machines, at least, it seems to be; see
+//    https://developer.apple.com/documentation/mac/runtimehtml/RTArch-59.html
+//    https://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
+// Linux has similar code: http://patchwork.ozlabs.org/linuxppc/patch?id=8882
+
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_POWERPC_INL_H_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_POWERPC_INL_H_
+
+#if defined(__linux__)
+#include <asm/ptrace.h>   // for PT_NIP.
+#include <ucontext.h>     // for ucontext_t
+#endif
+
+#include <unistd.h>
+#include <cassert>
+#include <cstdint>
+#include <cstdio>
+
+#include "absl/base/attributes.h"
+#include "absl/base/optimization.h"
+#include "absl/base/port.h"
+#include "absl/debugging/stacktrace.h"
+#include "absl/debugging/internal/address_is_readable.h"
+#include "absl/debugging/internal/vdso_support.h"  // a no-op on non-elf or non-glibc systems
+
+// Given a stack pointer, return the saved link register value.
+// Note that this is the link register for a callee.
+static inline void *StacktracePowerPCGetLR(void **sp) {
+  // PowerPC has 3 main ABIs, which say where in the stack the
+  // Link Register is.  For DARWIN and AIX (used by apple and
+  // linux ppc64), it's in sp[2].  For SYSV (used by linux ppc),
+  // it's in sp[1].
+#if defined(_CALL_AIX) || defined(_CALL_DARWIN)
+  return *(sp+2);
+#elif defined(_CALL_SYSV)
+  return *(sp+1);
+#elif defined(__APPLE__) || defined(__FreeBSD__) || \
+    (defined(__linux__) && defined(__PPC64__))
+  // This check is in case the compiler doesn't define _CALL_AIX/etc.
+  return *(sp+2);
+#elif defined(__linux)
+  // This check is in case the compiler doesn't define _CALL_SYSV.
+  return *(sp+1);
+#else
+#error Need to specify the PPC ABI for your archiecture.
+#endif
+}
+
+// Given a pointer to a stack frame, locate and return the calling
+// stackframe, or return null if no stackframe can be found. Perform sanity
+// checks (the strictness of which is controlled by the boolean parameter
+// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned.
+template<bool STRICT_UNWINDING, bool IS_WITH_CONTEXT>
+ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS  // May read random elements from stack.
+ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY   // May read random elements from stack.
+static void **NextStackFrame(void **old_sp, const void *uc) {
+  void **new_sp = (void **) *old_sp;
+  enum { kStackAlignment = 16 };
+
+  // Check that the transition from frame pointer old_sp to frame
+  // pointer new_sp isn't clearly bogus
+  if (STRICT_UNWINDING) {
+    // With the stack growing downwards, older stack frame must be
+    // at a greater address that the current one.
+    if (new_sp <= old_sp) return nullptr;
+    // Assume stack frames larger than 100,000 bytes are bogus.
+    if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return nullptr;
+  } else {
+    // In the non-strict mode, allow discontiguous stack frames.
+    // (alternate-signal-stacks for example).
+    if (new_sp == old_sp) return nullptr;
+    // And allow frames upto about 1MB.
+    if ((new_sp > old_sp)
+        && ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) return nullptr;
+  }
+  if ((uintptr_t)new_sp % kStackAlignment != 0) return nullptr;
+
+#if defined(__linux__)
+  enum StackTraceKernelSymbolStatus {
+      kNotInitialized = 0, kAddressValid, kAddressInvalid };
+
+  if (IS_WITH_CONTEXT && uc != nullptr) {
+    static StackTraceKernelSymbolStatus kernel_symbol_status =
+        kNotInitialized;  // Sentinel: not computed yet.
+    // Initialize with sentinel value: __kernel_rt_sigtramp_rt64 can not
+    // possibly be there.
+    static const unsigned char *kernel_sigtramp_rt64_address = nullptr;
+    if (kernel_symbol_status == kNotInitialized) {
+      absl::debugging_internal::VDSOSupport vdso;
+      if (vdso.IsPresent()) {
+        absl::debugging_internal::VDSOSupport::SymbolInfo
+            sigtramp_rt64_symbol_info;
+        if (!vdso.LookupSymbol(
+                "__kernel_sigtramp_rt64", "LINUX_2.6.15",
+                absl::debugging_internal::VDSOSupport::kVDSOSymbolType,
+                &sigtramp_rt64_symbol_info) ||
+            sigtramp_rt64_symbol_info.address == nullptr) {
+          // Unexpected: VDSO is present, yet the expected symbol is missing
+          // or null.
+          assert(false && "VDSO is present, but doesn't have expected symbol");
+          kernel_symbol_status = kAddressInvalid;
+        } else {
+          kernel_sigtramp_rt64_address =
+              reinterpret_cast<const unsigned char *>(
+                  sigtramp_rt64_symbol_info.address);
+          kernel_symbol_status = kAddressValid;
+        }
+      } else {
+        kernel_symbol_status = kAddressInvalid;
+      }
+    }
+
+    if (new_sp != nullptr &&
+        kernel_symbol_status == kAddressValid &&
+        StacktracePowerPCGetLR(new_sp) == kernel_sigtramp_rt64_address) {
+      const ucontext_t* signal_context =
+          reinterpret_cast<const ucontext_t*>(uc);
+      void **const sp_before_signal =
+          reinterpret_cast<void**>(signal_context->uc_mcontext.gp_regs[PT_R1]);
+      // Check that alleged sp before signal is nonnull and is reasonably
+      // aligned.
+      if (sp_before_signal != nullptr &&
+          ((uintptr_t)sp_before_signal % kStackAlignment) == 0) {
+        // Check that alleged stack pointer is actually readable. This is to
+        // prevent a "double fault" in case we hit the first fault due to e.g.
+        // a stack corruption.
+        if (absl::debugging_internal::AddressIsReadable(sp_before_signal)) {
+          // Alleged stack pointer is readable, use it for further unwinding.
+          new_sp = sp_before_signal;
+        }
+      }
+    }
+  }
+#endif
+
+  return new_sp;
+}
+
+// This ensures that absl::GetStackTrace sets up the Link Register properly.
+ABSL_ATTRIBUTE_NOINLINE static void AbslStacktracePowerPCDummyFunction() {
+  ABSL_BLOCK_TAIL_CALL_OPTIMIZATION();
+}
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS  // May read random elements from stack.
+ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY   // May read random elements from stack.
+static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
+                      const void *ucp, int *min_dropped_frames) {
+  void **sp;
+  // Apple OS X uses an old version of gnu as -- both Darwin 7.9.0 (Panther)
+  // and Darwin 8.8.1 (Tiger) use as 1.38.  This means we have to use a
+  // different asm syntax.  I don't know quite the best way to discriminate
+  // systems using the old as from the new one; I've gone with __APPLE__.
+#ifdef __APPLE__
+  __asm__ volatile ("mr %0,r1" : "=r" (sp));
+#else
+  __asm__ volatile ("mr %0,1" : "=r" (sp));
+#endif
+
+  // On PowerPC, the "Link Register" or "Link Record" (LR), is a stack
+  // entry that holds the return address of the subroutine call (what
+  // instruction we run after our function finishes).  This is the
+  // same as the stack-pointer of our parent routine, which is what we
+  // want here.  While the compiler will always(?) set up LR for
+  // subroutine calls, it may not for leaf functions (such as this one).
+  // This routine forces the compiler (at least gcc) to push it anyway.
+  AbslStacktracePowerPCDummyFunction();
+
+  // The LR save area is used by the callee, so the top entry is bogus.
+  skip_count++;
+
+  int n = 0;
+
+  // Unlike ABIs of X86 and ARM, PowerPC ABIs say that return address (in
+  // the link register) of a function call is stored in the caller's stack
+  // frame instead of the callee's.  When we look for the return address
+  // associated with a stack frame, we need to make sure that there is a
+  // caller frame before it.  So we call NextStackFrame before entering the
+  // loop below and check next_sp instead of sp for loop termination.
+  // The outermost frame is set up by runtimes and it does not have a
+  // caller frame, so it is skipped.
+
+  // The absl::GetStackFrames routine is called when we are in some
+  // informational context (the failure signal handler for example).
+  // Use the non-strict unwinding rules to produce a stack trace
+  // that is as complete as possible (even if it contains a few
+  // bogus entries in some rare cases).
+  void **next_sp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(sp, ucp);
+
+  while (next_sp && n < max_depth) {
+    if (skip_count > 0) {
+      skip_count--;
+    } else {
+      result[n] = StacktracePowerPCGetLR(sp);
+      if (IS_STACK_FRAMES) {
+        if (next_sp > sp) {
+          sizes[n] = (uintptr_t)next_sp - (uintptr_t)sp;
+        } else {
+          // A frame-size of 0 is used to indicate unknown frame size.
+          sizes[n] = 0;
+        }
+      }
+      n++;
+    }
+
+    sp = next_sp;
+    next_sp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(sp, ucp);
+  }
+
+  if (min_dropped_frames != nullptr) {
+    // Implementation detail: we clamp the max of frames we are willing to
+    // count, so as not to spend too much time in the loop below.
+    const int kMaxUnwind = 1000;
+    int j = 0;
+    for (; next_sp != nullptr && j < kMaxUnwind; j++) {
+      next_sp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(next_sp, ucp);
+    }
+    *min_dropped_frames = j;
+  }
+  return n;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return true;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_POWERPC_INL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc
new file mode 100644 (file)
index 0000000..e256fdd
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_UNIMPLEMENTED_INL_H_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_UNIMPLEMENTED_INL_H_
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+static int UnwindImpl(void** /* result */, int* /* sizes */,
+                      int /* max_depth */, int /* skip_count */,
+                      const void* /* ucp */, int *min_dropped_frames) {
+  if (min_dropped_frames != nullptr) {
+    *min_dropped_frames = 0;
+  }
+  return 0;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return false;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_UNIMPLEMENTED_INL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc
new file mode 100644 (file)
index 0000000..b46491f
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Produces a stack trace for Windows.  Normally, one could use
+// stacktrace_x86-inl.h or stacktrace_x86_64-inl.h -- and indeed, that
+// should work for binaries compiled using MSVC in "debug" mode.
+// However, in "release" mode, Windows uses frame-pointer
+// optimization, which makes getting a stack trace very difficult.
+//
+// There are several approaches one can take.  One is to use Windows
+// intrinsics like StackWalk64.  These can work, but have restrictions
+// on how successful they can be.  Another attempt is to write a
+// version of stacktrace_x86-inl.h that has heuristic support for
+// dealing with FPO, similar to what WinDbg does (see
+// http://www.nynaeve.net/?p=97).  There are (non-working) examples of
+// these approaches, complete with TODOs, in stacktrace_win32-inl.h#1
+//
+// The solution we've ended up doing is to call the undocumented
+// windows function RtlCaptureStackBackTrace, which probably doesn't
+// work with FPO but at least is fast, and doesn't require a symbol
+// server.
+//
+// This code is inspired by a patch from David Vitek:
+//   https://code.google.com/p/google-perftools/issues/detail?id=83
+
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_WIN32_INL_H_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_WIN32_INL_H_
+
+#include <windows.h>    // for GetProcAddress and GetModuleHandle
+#include <cassert>
+
+typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
+    IN ULONG frames_to_skip,
+    IN ULONG frames_to_capture,
+    OUT PVOID *backtrace,
+    OUT PULONG backtrace_hash);
+
+// Load the function we need at static init time, where we don't have
+// to worry about someone else holding the loader's lock.
+static RtlCaptureStackBackTrace_Function* const RtlCaptureStackBackTrace_fn =
+   (RtlCaptureStackBackTrace_Function*)
+   GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlCaptureStackBackTrace");
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
+                      const void *ucp, int *min_dropped_frames) {
+  int n = 0;
+  if (!RtlCaptureStackBackTrace_fn) {
+    // can't find a stacktrace with no function to call
+  } else {
+    n = (int)RtlCaptureStackBackTrace_fn(skip_count + 2, max_depth, result, 0);
+  }
+  if (IS_STACK_FRAMES) {
+    // No implementation for finding out the stack frame sizes yet.
+    memset(sizes, 0, sizeof(*sizes) * n);
+  }
+  if (min_dropped_frames != nullptr) {
+    // Not implemented.
+    *min_dropped_frames = 0;
+  }
+  return n;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return false;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_WIN32_INL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc
new file mode 100644 (file)
index 0000000..25aa8bd
--- /dev/null
@@ -0,0 +1,338 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Produce stack trace
+
+#ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_X86_INL_INC_
+#define ABSL_DEBUGGING_INTERNAL_STACKTRACE_X86_INL_INC_
+
+#if defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
+#include <ucontext.h>  // for ucontext_t
+#endif
+
+#if !defined(_WIN32)
+#include <unistd.h>
+#endif
+
+#include <cassert>
+#include <cstdint>
+
+#include "absl/base/macros.h"
+#include "absl/base/port.h"
+#include "absl/debugging/internal/address_is_readable.h"
+#include "absl/debugging/internal/vdso_support.h"  // a no-op on non-elf or non-glibc systems
+#include "absl/debugging/stacktrace.h"
+
+#include "absl/base/internal/raw_logging.h"
+
+#if defined(__linux__) && defined(__i386__)
+// Count "push %reg" instructions in VDSO __kernel_vsyscall(),
+// preceeding "syscall" or "sysenter".
+// If __kernel_vsyscall uses frame pointer, answer 0.
+//
+// kMaxBytes tells how many instruction bytes of __kernel_vsyscall
+// to analyze before giving up. Up to kMaxBytes+1 bytes of
+// instructions could be accessed.
+//
+// Here are known __kernel_vsyscall instruction sequences:
+//
+// SYSENTER (linux-2.6.26/arch/x86/vdso/vdso32/sysenter.S).
+// Used on Intel.
+//  0xffffe400 <__kernel_vsyscall+0>:       push   %ecx
+//  0xffffe401 <__kernel_vsyscall+1>:       push   %edx
+//  0xffffe402 <__kernel_vsyscall+2>:       push   %ebp
+//  0xffffe403 <__kernel_vsyscall+3>:       mov    %esp,%ebp
+//  0xffffe405 <__kernel_vsyscall+5>:       sysenter
+//
+// SYSCALL (see linux-2.6.26/arch/x86/vdso/vdso32/syscall.S).
+// Used on AMD.
+//  0xffffe400 <__kernel_vsyscall+0>:       push   %ebp
+//  0xffffe401 <__kernel_vsyscall+1>:       mov    %ecx,%ebp
+//  0xffffe403 <__kernel_vsyscall+3>:       syscall
+//
+
+// The sequence below isn't actually expected in Google fleet,
+// here only for completeness. Remove this comment from OSS release.
+
+// i386 (see linux-2.6.26/arch/x86/vdso/vdso32/int80.S)
+//  0xffffe400 <__kernel_vsyscall+0>:       int $0x80
+//  0xffffe401 <__kernel_vsyscall+1>:       ret
+//
+static const int kMaxBytes = 10;
+
+// We use assert()s instead of DCHECK()s -- this is too low level
+// for DCHECK().
+
+static int CountPushInstructions(const unsigned char *const addr) {
+  int result = 0;
+  for (int i = 0; i < kMaxBytes; ++i) {
+    if (addr[i] == 0x89) {
+      // "mov reg,reg"
+      if (addr[i + 1] == 0xE5) {
+        // Found "mov %esp,%ebp".
+        return 0;  
+      }
+      ++i;  // Skip register encoding byte.
+    } else if (addr[i] == 0x0F &&
+               (addr[i + 1] == 0x34 || addr[i + 1] == 0x05)) {
+      // Found "sysenter" or "syscall".
+      return result;
+    } else if ((addr[i] & 0xF0) == 0x50) {
+      // Found "push %reg".
+      ++result;
+    } else if (addr[i] == 0xCD && addr[i + 1] == 0x80) {
+      // Found "int $0x80"
+      assert(result == 0);
+      return 0;
+    } else {
+      // Unexpected instruction.
+      assert(false && "unexpected instruction in __kernel_vsyscall");
+      return 0;
+    }
+  }
+  // Unexpected: didn't find SYSENTER or SYSCALL in
+  // [__kernel_vsyscall, __kernel_vsyscall + kMaxBytes) interval.
+  assert(false && "did not find SYSENTER or SYSCALL in __kernel_vsyscall");
+  return 0;
+}
+#endif
+
+// Assume stack frames larger than 100,000 bytes are bogus.
+static const int kMaxFrameBytes = 100000;
+
+// Returns the stack frame pointer from signal context, 0 if unknown.
+// vuc is a ucontext_t *.  We use void* to avoid the use
+// of ucontext_t on non-POSIX systems.
+static uintptr_t GetFP(const void *vuc) {
+#if !defined(__linux__)
+  static_cast<void>(vuc);  // Avoid an unused argument compiler warning.
+#else
+  if (vuc != nullptr) {
+    auto *uc = reinterpret_cast<const ucontext_t *>(vuc);
+#if defined(__i386__)
+    const auto bp = uc->uc_mcontext.gregs[REG_EBP];
+    const auto sp = uc->uc_mcontext.gregs[REG_ESP];
+#elif defined(__x86_64__)
+    const auto bp = uc->uc_mcontext.gregs[REG_RBP];
+    const auto sp = uc->uc_mcontext.gregs[REG_RSP];
+#else
+    const uintptr_t bp = 0;
+    const uintptr_t sp = 0;
+#endif
+    // Sanity-check that the base pointer is valid.  It should be as long as
+    // SHRINK_WRAP_FRAME_POINTER is not set, but it's possible that some code in
+    // the process is compiled with --copt=-fomit-frame-pointer or
+    // --copt=-momit-leaf-frame-pointer.
+    //
+    // TODO(bcmills): -momit-leaf-frame-pointer is currently the default
+    // behavior when building with clang.  Talk to the C++ toolchain team about
+    // fixing that.
+    if (bp >= sp && bp - sp <= kMaxFrameBytes) return bp;
+
+    // If bp isn't a plausible frame pointer, return the stack pointer instead.
+    // If we're lucky, it points to the start of a stack frame; otherwise, we'll
+    // get one frame of garbage in the stack trace and fail the sanity check on
+    // the next iteration.
+    return sp;
+  }
+#endif
+  return 0;
+}
+
+// Given a pointer to a stack frame, locate and return the calling
+// stackframe, or return null if no stackframe can be found. Perform sanity
+// checks (the strictness of which is controlled by the boolean parameter
+// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned.
+template <bool STRICT_UNWINDING, bool WITH_CONTEXT>
+ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS  // May read random elements from stack.
+ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY   // May read random elements from stack.
+static void **NextStackFrame(void **old_fp, const void *uc) {
+  void **new_fp = (void **)*old_fp;
+
+#if defined(__linux__) && defined(__i386__)
+  if (WITH_CONTEXT && uc != nullptr) {
+    // How many "push %reg" instructions are there at __kernel_vsyscall?
+    // This is constant for a given kernel and processor, so compute
+    // it only once.
+    static int num_push_instructions = -1;  // Sentinel: not computed yet.
+    // Initialize with sentinel value: __kernel_rt_sigreturn can not possibly
+    // be there.
+    static const unsigned char *kernel_rt_sigreturn_address = nullptr;
+    static const unsigned char *kernel_vsyscall_address = nullptr;
+    if (num_push_instructions == -1) {
+      absl::debugging_internal::VDSOSupport vdso;
+      if (vdso.IsPresent()) {
+        absl::debugging_internal::VDSOSupport::SymbolInfo
+            rt_sigreturn_symbol_info;
+        absl::debugging_internal::VDSOSupport::SymbolInfo vsyscall_symbol_info;
+        if (!vdso.LookupSymbol("__kernel_rt_sigreturn", "LINUX_2.5", STT_FUNC,
+                               &rt_sigreturn_symbol_info) ||
+            !vdso.LookupSymbol("__kernel_vsyscall", "LINUX_2.5", STT_FUNC,
+                               &vsyscall_symbol_info) ||
+            rt_sigreturn_symbol_info.address == nullptr ||
+            vsyscall_symbol_info.address == nullptr) {
+          // Unexpected: 32-bit VDSO is present, yet one of the expected
+          // symbols is missing or null.
+          assert(false && "VDSO is present, but doesn't have expected symbols");
+          num_push_instructions = 0;
+        } else {
+          kernel_rt_sigreturn_address =
+              reinterpret_cast<const unsigned char *>(
+                  rt_sigreturn_symbol_info.address);
+          kernel_vsyscall_address =
+              reinterpret_cast<const unsigned char *>(
+                  vsyscall_symbol_info.address);
+          num_push_instructions =
+              CountPushInstructions(kernel_vsyscall_address);
+        }
+      } else {
+        num_push_instructions = 0;
+      }
+    }
+    if (num_push_instructions != 0 && kernel_rt_sigreturn_address != nullptr &&
+        old_fp[1] == kernel_rt_sigreturn_address) {
+      const ucontext_t *ucv = static_cast<const ucontext_t *>(uc);
+      // This kernel does not use frame pointer in its VDSO code,
+      // and so %ebp is not suitable for unwinding.
+      void **const reg_ebp =
+          reinterpret_cast<void **>(ucv->uc_mcontext.gregs[REG_EBP]);
+      const unsigned char *const reg_eip =
+          reinterpret_cast<unsigned char *>(ucv->uc_mcontext.gregs[REG_EIP]);
+      if (new_fp == reg_ebp && kernel_vsyscall_address <= reg_eip &&
+          reg_eip - kernel_vsyscall_address < kMaxBytes) {
+        // We "stepped up" to __kernel_vsyscall, but %ebp is not usable.
+        // Restore from 'ucv' instead.
+        void **const reg_esp =
+            reinterpret_cast<void **>(ucv->uc_mcontext.gregs[REG_ESP]);
+        // Check that alleged %esp is not null and is reasonably aligned.
+        if (reg_esp &&
+            ((uintptr_t)reg_esp & (sizeof(reg_esp) - 1)) == 0) {
+          // Check that alleged %esp is actually readable. This is to prevent
+          // "double fault" in case we hit the first fault due to e.g. stack
+          // corruption.
+          void *const reg_esp2 = reg_esp[num_push_instructions - 1];
+          if (absl::debugging_internal::AddressIsReadable(reg_esp2)) {
+            // Alleged %esp is readable, use it for further unwinding.
+            new_fp = reinterpret_cast<void **>(reg_esp2);
+          }
+        }
+      }
+    }
+  }
+#endif
+
+  const uintptr_t old_fp_u = reinterpret_cast<uintptr_t>(old_fp);
+  const uintptr_t new_fp_u = reinterpret_cast<uintptr_t>(new_fp);
+
+  // Check that the transition from frame pointer old_fp to frame
+  // pointer new_fp isn't clearly bogus.  Skip the checks if new_fp
+  // matches the signal context, so that we don't skip out early when
+  // using an alternate signal stack.
+  //
+  // TODO(bcmills): The GetFP call should be completely unnecessary when
+  // SHRINK_WRAP_FRAME_POINTER is set (because we should be back in the thread's
+  // stack by this point), but it is empirically still needed (e.g. when the
+  // stack includes a call to abort).  unw_get_reg returns UNW_EBADREG for some
+  // frames.  Figure out why GetValidFrameAddr and/or libunwind isn't doing what
+  // it's supposed to.
+  if (STRICT_UNWINDING &&
+      (!WITH_CONTEXT || uc == nullptr || new_fp_u != GetFP(uc))) {
+    // With the stack growing downwards, older stack frame must be
+    // at a greater address that the current one.
+    if (new_fp_u <= old_fp_u) return nullptr;
+    if (new_fp_u - old_fp_u > kMaxFrameBytes) return nullptr;
+  } else {
+    if (new_fp == nullptr) return nullptr;  // skip AddressIsReadable() below
+    // In the non-strict mode, allow discontiguous stack frames.
+    // (alternate-signal-stacks for example).
+    if (new_fp == old_fp) return nullptr;
+  }
+
+  if (new_fp_u & (sizeof(void *) - 1)) return nullptr;
+#ifdef __i386__
+  // On 32-bit machines, the stack pointer can be very close to
+  // 0xffffffff, so we explicitly check for a pointer into the
+  // last two pages in the address space
+  if (new_fp_u >= 0xffffe000) return nullptr;
+#endif
+#if !defined(_WIN32)
+  if (!STRICT_UNWINDING) {
+    // Lax sanity checks cause a crash in 32-bit tcmalloc/crash_reason_test
+    // on AMD-based machines with VDSO-enabled kernels.
+    // Make an extra sanity check to insure new_fp is readable.
+    // Note: NextStackFrame<false>() is only called while the program
+    //       is already on its last leg, so it's ok to be slow here.
+
+    if (!absl::debugging_internal::AddressIsReadable(new_fp)) {
+      return nullptr;
+    }
+  }
+#endif
+  return new_fp;
+}
+
+template <bool IS_STACK_FRAMES, bool IS_WITH_CONTEXT>
+ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS  // May read random elements from stack.
+ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY   // May read random elements from stack.
+ABSL_ATTRIBUTE_NOINLINE
+static int UnwindImpl(void **result, int *sizes, int max_depth, int skip_count,
+                      const void *ucp, int *min_dropped_frames) {
+  int n = 0;
+  void **fp = reinterpret_cast<void **>(__builtin_frame_address(0));
+
+  while (fp && n < max_depth) {
+    if (*(fp + 1) == reinterpret_cast<void *>(0)) {
+      // In 64-bit code, we often see a frame that
+      // points to itself and has a return address of 0.
+      break;
+    }
+    void **next_fp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(fp, ucp);
+    if (skip_count > 0) {
+      skip_count--;
+    } else {
+      result[n] = *(fp + 1);
+      if (IS_STACK_FRAMES) {
+        if (next_fp > fp) {
+          sizes[n] = (uintptr_t)next_fp - (uintptr_t)fp;
+        } else {
+          // A frame-size of 0 is used to indicate unknown frame size.
+          sizes[n] = 0;
+        }
+      }
+      n++;
+    }
+    fp = next_fp;
+  }
+  if (min_dropped_frames != nullptr) {
+    // Implementation detail: we clamp the max of frames we are willing to
+    // count, so as not to spend too much time in the loop below.
+    const int kMaxUnwind = 1000;
+    int j = 0;
+    for (; fp != nullptr && j < kMaxUnwind; j++) {
+      fp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(fp, ucp);
+    }
+    *min_dropped_frames = j;
+  }
+  return n;
+}
+
+namespace absl {
+namespace debugging_internal {
+bool StackTraceWorksForTest() {
+  return true;
+}
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_STACKTRACE_X86_INL_INC_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/symbolize.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/internal/symbolize.h
new file mode 100644 (file)
index 0000000..3e53789
--- /dev/null
@@ -0,0 +1,122 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file contains internal parts of the Abseil symbolizer.
+// Do not depend on the anything in this file, it may change at anytime.
+
+#ifndef ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_
+#define ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_
+
+#include <cstddef>
+#include <cstdint>
+
+#ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
+#error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set
+#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) && \
+    !defined(__asmjs__) && !defined(__wasm__)
+#define ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE 1
+
+#include <elf.h>
+#include <link.h>  // For ElfW() macro.
+#include <functional>
+#include <string>
+
+namespace absl {
+namespace debugging_internal {
+
+// Iterates over all sections, invoking callback on each with the section name
+// and the section header.
+//
+// Returns true on success; otherwise returns false in case of errors.
+//
+// This is not async-signal-safe.
+bool ForEachSection(int fd,
+                    const std::function<bool(const std::string& name,
+                                             const ElfW(Shdr) &)>& callback);
+
+// Gets the section header for the given name, if it exists. Returns true on
+// success. Otherwise, returns false.
+bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
+                            ElfW(Shdr) *out);
+
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
+
+namespace absl {
+namespace debugging_internal {
+
+struct SymbolDecoratorArgs {
+  // The program counter we are getting symbolic name for.
+  const void *pc;
+  // 0 for main executable, load address for shared libraries.
+  ptrdiff_t relocation;
+  // Read-only file descriptor for ELF image covering "pc",
+  // or -1 if no such ELF image exists in /proc/self/maps.
+  int fd;
+  // Output buffer, size.
+  // Note: the buffer may not be empty -- default symbolizer may have already
+  // produced some output, and earlier decorators may have adorned it in
+  // some way. You are free to replace or augment the contents (within the
+  // symbol_buf_size limit).
+  char *const symbol_buf;
+  size_t symbol_buf_size;
+  // Temporary scratch space, size.
+  // Use that space in preference to allocating your own stack buffer to
+  // conserve stack.
+  char *const tmp_buf;
+  size_t tmp_buf_size;
+  // User-provided argument
+  void* arg;
+};
+using SymbolDecorator = void (*)(const SymbolDecoratorArgs *);
+
+// Installs a function-pointer as a decorator. Returns a value less than zero
+// if the system cannot install the decorator. Otherwise, returns a unique
+// identifier corresponding to the decorator. This identifier can be used to
+// uninstall the decorator - See RemoveSymbolDecorator() below.
+int InstallSymbolDecorator(SymbolDecorator decorator, void* arg);
+
+// Removes a previously installed function-pointer decorator. Parameter "ticket"
+// is the return-value from calling InstallSymbolDecorator().
+bool RemoveSymbolDecorator(int ticket);
+
+// Remove all installed decorators.  Returns true if successful, false if
+// symbolization is currently in progress.
+bool RemoveAllSymbolDecorators(void);
+
+// Registers an address range to a file mapping.
+//
+// Preconditions:
+//   start <= end
+//   filename != nullptr
+//
+// Returns true if the file was successfully registered.
+bool RegisterFileMappingHint(
+    const void* start, const void* end, uint64_t offset, const char* filename);
+
+// Looks up the file mapping registered by RegisterFileMappingHint for an
+// address range. If there is one, the file name is stored in *filename and
+// *start and *end are modified to reflect the registered mapping. Returns
+// whether any hint was found.
+bool GetFileMappingHint(const void** start,
+                        const void** end,
+                        uint64_t    *  offset,
+                        const char** filename);
+
+}  // namespace debugging_internal
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_INTERNAL_SYMBOLIZE_H_
index a6a7a17..9895b48 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,6 +41,7 @@
 
 #include <atomic>
 
+#include "absl/base/attributes.h"
 #include "absl/debugging/internal/elf_mem_image.h"
 
 #ifdef ABSL_HAVE_ELF_MEM_IMAGE
@@ -52,7 +53,7 @@
 #endif
 
 namespace absl {
-namespace debug_internal {
+namespace debugging_internal {
 
 // NOTE: this class may be used from within tcmalloc, and can not
 // use any memory allocation routines.
@@ -132,7 +133,7 @@ class VDSOSupport {
 
   // This function pointer may point to InitAndGetCPU,
   // GetCPUViaSyscall, or __vdso_getcpu at different stages of initialization.
-  static std::atomic<GetCpuFn> getcpu_fn_;
+  ABSL_CONST_INIT static std::atomic<GetCpuFn> getcpu_fn_;
 
   friend int GetCPU(void);  // Needs access to getcpu_fn_.
 
@@ -147,7 +148,7 @@ class VDSOSupport {
 // support SYS_getcpu.
 int GetCPU();
 
-}  // namespace debug_internal
+}  // namespace debugging_internal
 }  // namespace absl
 
 #endif  // ABSL_HAVE_ELF_MEM_IMAGE
index f67fe88..4d489c5 100644 (file)
@@ -1,11 +1,10 @@
-//
-// Copyright 2017 The Abseil Authors.
+// Copyright 2018 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // See the License for the specific language governing permissions and
 // limitations under the License.
 //
-
 // -----------------------------------------------------------------------------
 // File: leak_check.h
 // -----------------------------------------------------------------------------
 //
-// This package contains functions that affect leak checking behavior within
+// This file contains functions that affect leak checking behavior within
 // targets built with the LeakSanitizer (LSan), a memory leak detector that is
 // integrated within the AddressSanitizer (ASan) as an additional component, or
-// which can be used standalone. LSan and ASan are included or can be provided
+// which can be used standalone. LSan and ASan are included (or can be provided)
 // as additional components for most compilers such as Clang, gcc and MSVC.
 // Note: this leak checking API is not yet supported in MSVC.
 // Leak checking is enabled by default in all ASan builds.
index 0aab574..3fc1c03 100644 (file)
@@ -1,11 +1,10 @@
-//
-// Copyright 2017 The Abseil Authors.
+// Copyright 2018 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // See the License for the specific language governing permissions and
 // limitations under the License.
 //
-
-// Routines to extract the current stack trace. These functions are
-// thread-safe and async-signal-safe.
+// -----------------------------------------------------------------------------
+// File: stacktrace.h
+// -----------------------------------------------------------------------------
+//
+// This file contains routines to extract the current stack trace and associated
+// stack frames. These functions are thread-safe and async-signal-safe.
+//
 // Note that stack trace functionality is platform dependent and requires
-// additional support from the compiler/build system in many cases. (That is,
-// this generally only works on platforms/builds that have been specifically
-// configured to support it.)
+// additional support from the compiler/build system in most cases. (That is,
+// this functionality generally only works on platforms/builds that have been
+// specifically configured to support it.)
+//
+// Note: stack traces in Abseil that do not utilize a symbolizer will result in
+// frames consisting of function addresses rather than human-readable function
+// names. (See symbolize.h for information on symbolizing these values.)
 
 #ifndef ABSL_DEBUGGING_STACKTRACE_H_
 #define ABSL_DEBUGGING_STACKTRACE_H_
 
 namespace absl {
 
-// Skips the most recent "skip_count" stack frames (also skips the
-// frame generated for the "absl::GetStackFrames" routine itself), and then
-// records the pc values for up to the next "max_depth" frames in
-// "result", and the corresponding stack frame sizes in "sizes".
-// Returns the number of values recorded in "result"/"sizes".
+// GetStackFrames()
+//
+// Records program counter values for up to `max_depth` frames, skipping the
+// most recent `skip_count` stack frames, and stores their corresponding values
+// and sizes in `results` and `sizes` buffers. (Note that the frame generated
+// for the `absl::GetStackFrames()` routine itself is also skipped.)
+// routine itself.
 //
 // Example:
+//
 //      main() { foo(); }
 //      foo() { bar(); }
 //      bar() {
@@ -41,41 +51,66 @@ namespace absl {
 //        int depth = absl::GetStackFrames(result, sizes, 10, 1);
 //      }
 //
-// The absl::GetStackFrames call will skip the frame for "bar".  It will
-// return 2 and will produce pc values that map to the following
-// procedures:
-//      result[0]       foo
-//      result[1]       main
-// (Actually, there may be a few more entries after "main" to account for
-// startup procedures.)
-// And corresponding stack frame sizes will also be recorded:
+// The current stack frame would consist of three function calls: `bar()`,
+// `foo()`, and then `main()`; however, since the `GetStackFrames()` call sets
+// `skip_count` to `1`, it will skip the frame for `bar()`, the most recently
+// invoked function call. It will therefore return two program counters and will
+// produce values that map to the following function calls:
+//
+//      result[0]       foo()
+//      result[1]       main()
+//
+// (Note: in practice, a few more entries after `main()` may be added to account
+// for startup processes.)
+//
+// Corresponding stack frame sizes will also be recorded:
+//
 //    sizes[0]       16
 //    sizes[1]       16
-// (Stack frame sizes of 16 above are just for illustration purposes.)
+//
+// (Stack frame sizes of `16` above are just for illustration purposes.)
+//
 // Stack frame sizes of 0 or less indicate that those frame sizes couldn't
 // be identified.
 //
 // This routine may return fewer stack frame entries than are
-// available. Also note that "result" and "sizes" must both be non-null.
+// available. Also note that `result` and `sizes` must both be non-null.
 extern int GetStackFrames(void** result, int* sizes, int max_depth,
                           int skip_count);
 
-// Same as above, but to be used from a signal handler. The "uc" parameter
-// should be the pointer to ucontext_t which was passed as the 3rd parameter
-// to sa_sigaction signal handler. It may help the unwinder to get a
-// better stack trace under certain conditions. The "uc" may safely be null.
-//
-// If min_dropped_frames is not null, stores in *min_dropped_frames a
-// lower bound on the number of dropped stack frames. The stored value is
-// guaranteed to be >= 0. The number of real stack frames is guaranteed to
-// be >= skip_count + max_depth + *min_dropped_frames.
+// GetStackFramesWithContext()
+//
+// Records program counter values obtained from a signal handler. Records
+// program counter values for up to `max_depth` frames, skipping the most recent
+// `skip_count` stack frames, and stores their corresponding values and sizes in
+// `results` and `sizes` buffers. (Note that the frame generated for the
+// `absl::GetStackFramesWithContext()` routine itself is also skipped.)
+//
+// The `uc` parameter, if non-null, should be a pointer to a `ucontext_t` value
+// passed to a signal handler registered via the `sa_sigaction` field of a
+// `sigaction` struct. (See
+// http://man7.org/linux/man-pages/man2/sigaction.2.html.) The `uc` value may
+// help a stack unwinder to provide a better stack trace under certain
+// conditions. `uc` may safely be null.
+//
+// The `min_dropped_frames` output parameter, if non-null, points to the
+// location to note any dropped stack frames, if any, due to buffer limitations
+// or other reasons. (This value will be set to `0` if no frames were dropped.)
+// The number of total stack frames is guaranteed to be >= skip_count +
+// max_depth + *min_dropped_frames.
 extern int GetStackFramesWithContext(void** result, int* sizes, int max_depth,
                                      int skip_count, const void* uc,
                                      int* min_dropped_frames);
 
-// This is similar to the absl::GetStackFrames routine, except that it returns
-// the stack trace only, and not the stack frame sizes as well.
+// GetStackTrace()
+//
+// Records program counter values for up to `max_depth` frames, skipping the
+// most recent `skip_count` stack frames, and stores their corresponding values
+// in `results`. Note that this function is similar to `absl::GetStackFrames()`
+// except that it returns the stack trace only, and not stack frame sizes.
+//
 // Example:
+//
 //      main() { foo(); }
 //      foo() { bar(); }
 //      bar() {
@@ -84,42 +119,57 @@ extern int GetStackFramesWithContext(void** result, int* sizes, int max_depth,
 //      }
 //
 // This produces:
+//
 //      result[0]       foo
 //      result[1]       main
 //           ....       ...
 //
-// "result" must not be null.
+// `result` must not be null.
 extern int GetStackTrace(void** result, int max_depth, int skip_count);
 
-// Same as above, but to be used from a signal handler. The "uc" parameter
-// should be the pointer to ucontext_t which was passed as the 3rd parameter
-// to sa_sigaction signal handler. It may help the unwinder to get a
-// better stack trace under certain conditions. The "uc" may safely be null.
-//
-// If min_dropped_frames is not null, stores in *min_dropped_frames a
-// lower bound on the number of dropped stack frames. The stored value is
-// guaranteed to be >= 0. The number of real stack frames is guaranteed to
-// be >= skip_count + max_depth + *min_dropped_frames.
+// GetStackTraceWithContext()
+//
+// Records program counter values obtained from a signal handler. Records
+// program counter values for up to `max_depth` frames, skipping the most recent
+// `skip_count` stack frames, and stores their corresponding values in
+// `results`. (Note that the frame generated for the
+// `absl::GetStackFramesWithContext()` routine itself is also skipped.)
+//
+// The `uc` parameter, if non-null, should be a pointer to a `ucontext_t` value
+// passed to a signal handler registered via the `sa_sigaction` field of a
+// `sigaction` struct. (See
+// http://man7.org/linux/man-pages/man2/sigaction.2.html.) The `uc` value may
+// help a stack unwinder to provide a better stack trace under certain
+// conditions. `uc` may safely be null.
+//
+// The `min_dropped_frames` output parameter, if non-null, points to the
+// location to note any dropped stack frames, if any, due to buffer limitations
+// or other reasons. (This value will be set to `0` if no frames were dropped.)
+// The number of total stack frames is guaranteed to be >= skip_count +
+// max_depth + *min_dropped_frames.
 extern int GetStackTraceWithContext(void** result, int max_depth,
                                     int skip_count, const void* uc,
                                     int* min_dropped_frames);
 
-// Call this to provide a custom function for unwinding stack frames
-// that will be used every time someone invokes one of the static
+// SetStackUnwinder()
+//
+// Provides a custom function for unwinding stack frames that will be used in
+// place of the default stack unwinder when invoking the static
 // GetStack{Frames,Trace}{,WithContext}() functions above.
 //
 // The arguments passed to the unwinder function will match the
-// arguments passed to absl::GetStackFramesWithContext() except that sizes
+// arguments passed to `absl::GetStackFramesWithContext()` except that sizes
 // will be non-null iff the caller is interested in frame sizes.
 //
-// If unwinder is null, we revert to the default stack-tracing behavior.
+// If unwinder is set to null, we revert to the default stack-tracing behavior.
 //
-// ****************************************************************
-// WARNINGS
+// *****************************************************************************
+// WARNING
+// *****************************************************************************
 //
 // absl::SetStackUnwinder is not suitable for general purpose use.  It is
 // provided for custom runtimes.
-// Some things to watch out for when calling absl::SetStackUnwinder:
+// Some things to watch out for when calling `absl::SetStackUnwinder()`:
 //
 // (a) The unwinder may be called from within signal handlers and
 // therefore must be async-signal-safe.
@@ -128,23 +178,31 @@ extern int GetStackTraceWithContext(void** result, int max_depth,
 // threads may still be in the process of using that unwinder.
 // Therefore do not clean up any state that may be needed by an old
 // unwinder.
-// ****************************************************************
+// *****************************************************************************
 extern void SetStackUnwinder(int (*unwinder)(void** pcs, int* sizes,
                                              int max_depth, int skip_count,
                                              const void* uc,
                                              int* min_dropped_frames));
 
-// Function that exposes built-in stack-unwinding behavior, ignoring
-// any calls to absl::SetStackUnwinder().
+// DefaultStackUnwinder()
+//
+// Records program counter values of up to `max_depth` frames, skipping the most
+// recent `skip_count` stack frames, and stores their corresponding values in
+// `pcs`. (Note that the frame generated for this call itself is also skipped.)
+// This function acts as a generic stack-unwinder; prefer usage of the more
+// specific `GetStack{Trace,Frames}{,WithContext}()` functions above.
 //
-// pcs must NOT be null.
+// If you have set your own stack unwinder (with the `SetStackUnwinder()`
+// function above, you can still get the default stack unwinder by calling
+// `DefaultStackUnwinder()`, which will ignore any previously set stack unwinder
+// and use the default one instead.
 //
-// sizes may be null.
-// uc may be null.
-// min_dropped_frames may be null.
+// Because this function is generic, only `pcs` is guaranteed to be non-null
+// upon return. It is legal for `sizes`, `uc`, and `min_dropped_frames` to all
+// be null when called.
 //
-// The semantics are the same as the corresponding GetStack*() function in the
-// case where absl::SetStackUnwinder() was never called.  Equivalents are:
+// The semantics are the same as the corresponding `GetStack*()` function in the
+// case where `absl::SetStackUnwinder()` was never called. Equivalents are:
 //
 //                       null sizes         |        non-nullptr sizes
 //             |==========================================================|
@@ -155,6 +213,13 @@ extern int DefaultStackUnwinder(void** pcs, int* sizes, int max_depth,
                                 int skip_count, const void* uc,
                                 int* min_dropped_frames);
 
+namespace debugging_internal {
+// Returns true for platforms which are expected to have functioning stack trace
+// implementations. Intended to be used for tests which want to exclude
+// verification of logic known to be broken because stack traces are not
+// working.
+extern bool StackTraceWorksForTest();
+}  // namespace debugging_internal
 }  // namespace absl
 
 #endif  // ABSL_DEBUGGING_STACKTRACE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize.h
new file mode 100644 (file)
index 0000000..a73dbd9
--- /dev/null
@@ -0,0 +1,97 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: symbolize.h
+// -----------------------------------------------------------------------------
+//
+// This file configures the Abseil symbolizer for use in converting instruction
+// pointer addresses (program counters) into human-readable names (function
+// calls, etc.) within Abseil code.
+//
+// The symbolizer may be invoked from several sources:
+//
+//   * Implicitly, through the installation of an Abseil failure signal handler.
+//     (See failure_signal_handler.h for more information.)
+//   * By calling `Symbolize()` directly on a program counter you obtain through
+//     `absl::GetStackTrace()` or `absl::GetStackFrames()`. (See stacktrace.h
+//     for more information.
+//   * By calling `Symbolize()` directly on a program counter you obtain through
+//     other means (which would be platform-dependent).
+//
+// In all of the above cases, the symbolizer must first be initialized before
+// any program counter values can be symbolized. If you are installing a failure
+// signal handler, initialize the symbolizer before you do so.
+//
+// Example:
+//
+//   int main(int argc, char** argv) {
+//     // Initialize the Symbolizer before installing the failure signal handler
+//     absl::InitializeSymbolizer(argv[0]);
+//
+//     // Now you may install the failure signal handler
+//     absl::FailureSignalHandlerOptions options;
+//     absl::InstallFailureSignalHandler(options);
+//
+//     // Start running your main program
+//     ...
+//     return 0;
+//  }
+//
+#ifndef ABSL_DEBUGGING_SYMBOLIZE_H_
+#define ABSL_DEBUGGING_SYMBOLIZE_H_
+
+#include "absl/debugging/internal/symbolize.h"
+
+namespace absl {
+
+// InitializeSymbolizer()
+//
+// Initializes the program counter symbolizer, given the path of the program
+// (typically obtained through `main()`s `argv[0]`). The Abseil symbolizer
+// allows you to read program counters (instruction pointer values) using their
+// human-readable names within output such as stack traces.
+//
+// Example:
+//
+// int main(int argc, char *argv[]) {
+//   absl::InitializeSymbolizer(argv[0]);
+//   // Now you can use the symbolizer
+// }
+void InitializeSymbolizer(const char* argv0);
+
+// Symbolize()
+//
+// Symbolizes a program counter (instruction pointer value) `pc` and, on
+// success, writes the name to `out`. The symbol name is demangled, if possible.
+// Note that the symbolized name may be truncated and will be NUL-terminated.
+// Demangling is supported for symbols generated by GCC 3.x or newer). Returns
+// `false` on failure.
+//
+// Example:
+//
+//   // Print a program counter and its symbol name.
+//   static void DumpPCAndSymbol(void *pc) {
+//     char tmp[1024];
+//     const char *symbol = "(unknown)";
+//     if (absl::Symbolize(pc, tmp, sizeof(tmp))) {
+//       symbol = tmp;
+//     }
+//     absl::PrintF("%*p  %s\n", pc, symbol);
+//  }
+bool Symbolize(const void *pc, char *out, int out_size);
+
+}  // namespace absl
+
+#endif  // ABSL_DEBUGGING_SYMBOLIZE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc
new file mode 100644 (file)
index 0000000..e730521
--- /dev/null
@@ -0,0 +1,1471 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This library provides Symbolize() function that symbolizes program
+// counters to their corresponding symbol names on linux platforms.
+// This library has a minimal implementation of an ELF symbol table
+// reader (i.e. it doesn't depend on libelf, etc.).
+//
+// The algorithm used in Symbolize() is as follows.
+//
+//   1. Go through a list of maps in /proc/self/maps and find the map
+//   containing the program counter.
+//
+//   2. Open the mapped file and find a regular symbol table inside.
+//   Iterate over symbols in the symbol table and look for the symbol
+//   containing the program counter.  If such a symbol is found,
+//   obtain the symbol name, and demangle the symbol if possible.
+//   If the symbol isn't found in the regular symbol table (binary is
+//   stripped), try the same thing with a dynamic symbol table.
+//
+// Note that Symbolize() is originally implemented to be used in
+// signal handlers, hence it doesn't use malloc() and other unsafe
+// operations.  It should be both thread-safe and async-signal-safe.
+//
+// Implementation note:
+//
+// We don't use heaps but only use stacks.  We want to reduce the
+// stack consumption so that the symbolizer can run on small stacks.
+//
+// Here are some numbers collected with GCC 4.1.0 on x86:
+// - sizeof(Elf32_Sym)  = 16
+// - sizeof(Elf32_Shdr) = 40
+// - sizeof(Elf64_Sym)  = 24
+// - sizeof(Elf64_Shdr) = 64
+//
+// This implementation is intended to be async-signal-safe but uses some
+// functions which are not guaranteed to be so, such as memchr() and
+// memmove().  We assume they are async-signal-safe.
+
+#include <dlfcn.h>
+#include <elf.h>
+#include <fcntl.h>
+#include <link.h>  // For ElfW() macro.
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <atomic>
+#include <cerrno>
+#include <cinttypes>
+#include <climits>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+#include "absl/base/casts.h"
+#include "absl/base/dynamic_annotations.h"
+#include "absl/base/internal/low_level_alloc.h"
+#include "absl/base/internal/raw_logging.h"
+#include "absl/base/internal/spinlock.h"
+#include "absl/base/port.h"
+#include "absl/debugging/internal/demangle.h"
+#include "absl/debugging/internal/vdso_support.h"
+
+namespace absl {
+
+// Value of argv[0]. Used by MaybeInitializeObjFile().
+static char *argv0_value = nullptr;
+
+void InitializeSymbolizer(const char *argv0) {
+  if (argv0_value != nullptr) {
+    free(argv0_value);
+    argv0_value = nullptr;
+  }
+  if (argv0 != nullptr && argv0[0] != '\0') {
+    argv0_value = strdup(argv0);
+  }
+}
+
+namespace debugging_internal {
+namespace {
+
+// Re-runs fn until it doesn't cause EINTR.
+#define NO_INTR(fn) \
+  do {              \
+  } while ((fn) < 0 && errno == EINTR)
+
+// On Linux, ELF_ST_* are defined in <linux/elf.h>.  To make this portable
+// we define our own ELF_ST_BIND and ELF_ST_TYPE if not available.
+#ifndef ELF_ST_BIND
+#define ELF_ST_BIND(info) (((unsigned char)(info)) >> 4)
+#endif
+
+#ifndef ELF_ST_TYPE
+#define ELF_ST_TYPE(info) (((unsigned char)(info)) & 0xF)
+#endif
+
+// Some platforms use a special .opd section to store function pointers.
+const char kOpdSectionName[] = ".opd";
+
+#if (defined(__powerpc__) && !(_CALL_ELF > 1)) || defined(__ia64)
+// Use opd section for function descriptors on these platforms, the function
+// address is the first word of the descriptor.
+enum { kPlatformUsesOPDSections = 1 };
+#else  // not PPC or IA64
+enum { kPlatformUsesOPDSections = 0 };
+#endif
+
+// This works for PowerPC & IA64 only.  A function descriptor consist of two
+// pointers and the first one is the function's entry.
+const size_t kFunctionDescriptorSize = sizeof(void *) * 2;
+
+const int kMaxDecorators = 10;  // Seems like a reasonable upper limit.
+
+struct InstalledSymbolDecorator {
+  SymbolDecorator fn;
+  void *arg;
+  int ticket;
+};
+
+int g_num_decorators;
+InstalledSymbolDecorator g_decorators[kMaxDecorators];
+
+struct FileMappingHint {
+  const void *start;
+  const void *end;
+  uint64_t offset;
+  const char *filename;
+};
+
+// Protects g_decorators.
+// We are using SpinLock and not a Mutex here, because we may be called
+// from inside Mutex::Lock itself, and it prohibits recursive calls.
+// This happens in e.g. base/stacktrace_syscall_unittest.
+// Moreover, we are using only TryLock(), if the decorator list
+// is being modified (is busy), we skip all decorators, and possibly
+// loose some info. Sorry, that's the best we could do.
+base_internal::SpinLock g_decorators_mu(base_internal::kLinkerInitialized);
+
+const int kMaxFileMappingHints = 8;
+int g_num_file_mapping_hints;
+FileMappingHint g_file_mapping_hints[kMaxFileMappingHints];
+// Protects g_file_mapping_hints.
+base_internal::SpinLock g_file_mapping_mu(base_internal::kLinkerInitialized);
+
+// Async-signal-safe function to zero a buffer.
+// memset() is not guaranteed to be async-signal-safe.
+static void SafeMemZero(void* p, size_t size) {
+  unsigned char *c = static_cast<unsigned char *>(p);
+  while (size--) {
+    *c++ = 0;
+  }
+}
+
+struct ObjFile {
+  ObjFile()
+      : filename(nullptr),
+        start_addr(nullptr),
+        end_addr(nullptr),
+        offset(0),
+        fd(-1),
+        elf_type(-1) {
+    SafeMemZero(&elf_header, sizeof(elf_header));
+  }
+
+  char *filename;
+  const void *start_addr;
+  const void *end_addr;
+  uint64_t offset;
+
+  // The following fields are initialized on the first access to the
+  // object file.
+  int fd;
+  int elf_type;
+  ElfW(Ehdr) elf_header;
+};
+
+// Build 4-way associative cache for symbols. Within each cache line, symbols
+// are replaced in LRU order.
+enum {
+  ASSOCIATIVITY = 4,
+};
+struct SymbolCacheLine {
+  const void *pc[ASSOCIATIVITY];
+  char *name[ASSOCIATIVITY];
+
+  // age[i] is incremented when a line is accessed. it's reset to zero if the
+  // i'th entry is read.
+  uint32_t age[ASSOCIATIVITY];
+};
+
+// ---------------------------------------------------------------
+// An async-signal-safe arena for LowLevelAlloc
+static std::atomic<base_internal::LowLevelAlloc::Arena *> g_sig_safe_arena;
+
+static base_internal::LowLevelAlloc::Arena *SigSafeArena() {
+  return g_sig_safe_arena.load(std::memory_order_acquire);
+}
+
+static void InitSigSafeArena() {
+  if (SigSafeArena() == nullptr) {
+    base_internal::LowLevelAlloc::Arena *new_arena =
+        base_internal::LowLevelAlloc::NewArena(
+            base_internal::LowLevelAlloc::kAsyncSignalSafe);
+    base_internal::LowLevelAlloc::Arena *old_value = nullptr;
+    if (!g_sig_safe_arena.compare_exchange_strong(old_value, new_arena,
+                                                  std::memory_order_release,
+                                                  std::memory_order_relaxed)) {
+      // We lost a race to allocate an arena; deallocate.
+      base_internal::LowLevelAlloc::DeleteArena(new_arena);
+    }
+  }
+}
+
+// ---------------------------------------------------------------
+// An AddrMap is a vector of ObjFile, using SigSafeArena() for allocation.
+
+class AddrMap {
+ public:
+  AddrMap() : size_(0), allocated_(0), obj_(nullptr) {}
+  ~AddrMap() { base_internal::LowLevelAlloc::Free(obj_); }
+  int Size() const { return size_; }
+  ObjFile *At(int i) { return &obj_[i]; }
+  ObjFile *Add();
+  void Clear();
+
+ private:
+  int size_;       // count of valid elements (<= allocated_)
+  int allocated_;  // count of allocated elements
+  ObjFile *obj_;   // array of allocated_ elements
+  AddrMap(const AddrMap &) = delete;
+  AddrMap &operator=(const AddrMap &) = delete;
+};
+
+void AddrMap::Clear() {
+  for (int i = 0; i != size_; i++) {
+    At(i)->~ObjFile();
+  }
+  size_ = 0;
+}
+
+ObjFile *AddrMap::Add() {
+  if (size_ == allocated_) {
+    int new_allocated = allocated_ * 2 + 50;
+    ObjFile *new_obj_ =
+        static_cast<ObjFile *>(base_internal::LowLevelAlloc::AllocWithArena(
+            new_allocated * sizeof(*new_obj_), SigSafeArena()));
+    if (obj_) {
+      memcpy(new_obj_, obj_, allocated_ * sizeof(*new_obj_));
+      base_internal::LowLevelAlloc::Free(obj_);
+    }
+    obj_ = new_obj_;
+    allocated_ = new_allocated;
+  }
+  return new (&obj_[size_++]) ObjFile;
+}
+
+// ---------------------------------------------------------------
+
+enum FindSymbolResult { SYMBOL_NOT_FOUND = 1, SYMBOL_TRUNCATED, SYMBOL_FOUND };
+
+class Symbolizer {
+ public:
+  Symbolizer();
+  ~Symbolizer();
+  const char *GetSymbol(const void *const pc);
+
+ private:
+  char *CopyString(const char *s) {
+    int len = strlen(s);
+    char *dst = static_cast<char *>(
+        base_internal::LowLevelAlloc::AllocWithArena(len + 1, SigSafeArena()));
+    ABSL_RAW_CHECK(dst != nullptr, "out of memory");
+    memcpy(dst, s, len + 1);
+    return dst;
+  }
+  ObjFile *FindObjFile(const void *const start,
+                       size_t size) ABSL_ATTRIBUTE_NOINLINE;
+  static bool RegisterObjFile(const char *filename,
+                              const void *const start_addr,
+                              const void *const end_addr, uint64_t offset,
+                              void *arg);
+  SymbolCacheLine *GetCacheLine(const void *const pc);
+  const char *FindSymbolInCache(const void *const pc);
+  const char *InsertSymbolInCache(const void *const pc, const char *name);
+  void AgeSymbols(SymbolCacheLine *line);
+  void ClearAddrMap();
+  FindSymbolResult GetSymbolFromObjectFile(const ObjFile &obj,
+                                           const void *const pc,
+                                           const ptrdiff_t relocation,
+                                           char *out, int out_size,
+                                           char *tmp_buf, int tmp_buf_size);
+
+  enum {
+    SYMBOL_BUF_SIZE = 3072,
+    TMP_BUF_SIZE = 1024,
+    SYMBOL_CACHE_LINES = 128,
+  };
+
+  AddrMap addr_map_;
+
+  bool ok_;
+  bool addr_map_read_;
+
+  char symbol_buf_[SYMBOL_BUF_SIZE];
+
+  // tmp_buf_ will be used to store arrays of ElfW(Shdr) and ElfW(Sym)
+  // so we ensure that tmp_buf_ is properly aligned to store either.
+  alignas(16) char tmp_buf_[TMP_BUF_SIZE];
+  static_assert(alignof(ElfW(Shdr)) <= 16,
+                "alignment of tmp buf too small for Shdr");
+  static_assert(alignof(ElfW(Sym)) <= 16,
+                "alignment of tmp buf too small for Sym");
+
+  SymbolCacheLine symbol_cache_[SYMBOL_CACHE_LINES];
+};
+
+static std::atomic<Symbolizer *> g_cached_symbolizer;
+
+}  // namespace
+
+static int SymbolizerSize() {
+#if defined(__wasm__) || defined(__asmjs__)
+  int pagesize = getpagesize();
+#else
+  int pagesize = sysconf(_SC_PAGESIZE);
+#endif
+  return ((sizeof(Symbolizer) - 1) / pagesize + 1) * pagesize;
+}
+
+// Return (and set null) g_cached_symbolized_state if it is not null.
+// Otherwise return a new symbolizer.
+static Symbolizer *AllocateSymbolizer() {
+  InitSigSafeArena();
+  Symbolizer *symbolizer =
+      g_cached_symbolizer.exchange(nullptr, std::memory_order_acquire);
+  if (symbolizer != nullptr) {
+    return symbolizer;
+  }
+  return new (base_internal::LowLevelAlloc::AllocWithArena(
+      SymbolizerSize(), SigSafeArena())) Symbolizer();
+}
+
+// Set g_cached_symbolize_state to s if it is null, otherwise
+// delete s.
+static void FreeSymbolizer(Symbolizer *s) {
+  Symbolizer *old_cached_symbolizer = nullptr;
+  if (!g_cached_symbolizer.compare_exchange_strong(old_cached_symbolizer, s,
+                                                   std::memory_order_release,
+                                                   std::memory_order_relaxed)) {
+    s->~Symbolizer();
+    base_internal::LowLevelAlloc::Free(s);
+  }
+}
+
+Symbolizer::Symbolizer() : ok_(true), addr_map_read_(false) {
+  for (SymbolCacheLine &symbol_cache_line : symbol_cache_) {
+    for (size_t j = 0; j < ABSL_ARRAYSIZE(symbol_cache_line.name); ++j) {
+      symbol_cache_line.pc[j] = nullptr;
+      symbol_cache_line.name[j] = nullptr;
+      symbol_cache_line.age[j] = 0;
+    }
+  }
+}
+
+Symbolizer::~Symbolizer() {
+  for (SymbolCacheLine &symbol_cache_line : symbol_cache_) {
+    for (char *s : symbol_cache_line.name) {
+      base_internal::LowLevelAlloc::Free(s);
+    }
+  }
+  ClearAddrMap();
+}
+
+// We don't use assert() since it's not guaranteed to be
+// async-signal-safe.  Instead we define a minimal assertion
+// macro. So far, we don't need pretty printing for __FILE__, etc.
+#define SAFE_ASSERT(expr) ((expr) ? static_cast<void>(0) : abort())
+
+// Read up to "count" bytes from file descriptor "fd" into the buffer
+// starting at "buf" while handling short reads and EINTR.  On
+// success, return the number of bytes read.  Otherwise, return -1.
+static ssize_t ReadPersistent(int fd, void *buf, size_t count) {
+  SAFE_ASSERT(fd >= 0);
+  SAFE_ASSERT(count <= SSIZE_MAX);
+  char *buf0 = reinterpret_cast<char *>(buf);
+  size_t num_bytes = 0;
+  while (num_bytes < count) {
+    ssize_t len;
+    NO_INTR(len = read(fd, buf0 + num_bytes, count - num_bytes));
+    if (len < 0) {  // There was an error other than EINTR.
+      ABSL_RAW_LOG(WARNING, "read failed: errno=%d", errno);
+      return -1;
+    }
+    if (len == 0) {  // Reached EOF.
+      break;
+    }
+    num_bytes += len;
+  }
+  SAFE_ASSERT(num_bytes <= count);
+  return static_cast<ssize_t>(num_bytes);
+}
+
+// Read up to "count" bytes from "offset" in the file pointed by file
+// descriptor "fd" into the buffer starting at "buf".  On success,
+// return the number of bytes read.  Otherwise, return -1.
+static ssize_t ReadFromOffset(const int fd, void *buf, const size_t count,
+                              const off_t offset) {
+  off_t off = lseek(fd, offset, SEEK_SET);
+  if (off == (off_t)-1) {
+    ABSL_RAW_LOG(WARNING, "lseek(%d, %ju, SEEK_SET) failed: errno=%d", fd,
+                 static_cast<uintmax_t>(offset), errno);
+    return -1;
+  }
+  return ReadPersistent(fd, buf, count);
+}
+
+// Try reading exactly "count" bytes from "offset" bytes in a file
+// pointed by "fd" into the buffer starting at "buf" while handling
+// short reads and EINTR.  On success, return true. Otherwise, return
+// false.
+static bool ReadFromOffsetExact(const int fd, void *buf, const size_t count,
+                                const off_t offset) {
+  ssize_t len = ReadFromOffset(fd, buf, count, offset);
+  return len >= 0 && static_cast<size_t>(len) == count;
+}
+
+// Returns elf_header.e_type if the file pointed by fd is an ELF binary.
+static int FileGetElfType(const int fd) {
+  ElfW(Ehdr) elf_header;
+  if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
+    return -1;
+  }
+  if (memcmp(elf_header.e_ident, ELFMAG, SELFMAG) != 0) {
+    return -1;
+  }
+  return elf_header.e_type;
+}
+
+// Read the section headers in the given ELF binary, and if a section
+// of the specified type is found, set the output to this section header
+// and return true.  Otherwise, return false.
+// To keep stack consumption low, we would like this function to not get
+// inlined.
+static ABSL_ATTRIBUTE_NOINLINE bool GetSectionHeaderByType(
+    const int fd, ElfW(Half) sh_num, const off_t sh_offset, ElfW(Word) type,
+    ElfW(Shdr) * out, char *tmp_buf, int tmp_buf_size) {
+  ElfW(Shdr) *buf = reinterpret_cast<ElfW(Shdr) *>(tmp_buf);
+  const int buf_entries = tmp_buf_size / sizeof(buf[0]);
+  const int buf_bytes = buf_entries * sizeof(buf[0]);
+
+  for (int i = 0; i < sh_num;) {
+    const ssize_t num_bytes_left = (sh_num - i) * sizeof(buf[0]);
+    const ssize_t num_bytes_to_read =
+        (buf_bytes > num_bytes_left) ? num_bytes_left : buf_bytes;
+    const off_t offset = sh_offset + i * sizeof(buf[0]);
+    const ssize_t len = ReadFromOffset(fd, buf, num_bytes_to_read, offset);
+    if (len % sizeof(buf[0]) != 0) {
+      ABSL_RAW_LOG(
+          WARNING,
+          "Reading %zd bytes from offset %ju returned %zd which is not a "
+          "multiple of %zu.",
+          num_bytes_to_read, static_cast<uintmax_t>(offset), len,
+          sizeof(buf[0]));
+      return false;
+    }
+    const ssize_t num_headers_in_buf = len / sizeof(buf[0]);
+    SAFE_ASSERT(num_headers_in_buf <= buf_entries);
+    for (int j = 0; j < num_headers_in_buf; ++j) {
+      if (buf[j].sh_type == type) {
+        *out = buf[j];
+        return true;
+      }
+    }
+    i += num_headers_in_buf;
+  }
+  return false;
+}
+
+// There is no particular reason to limit section name to 63 characters,
+// but there has (as yet) been no need for anything longer either.
+const int kMaxSectionNameLen = 64;
+
+bool ForEachSection(int fd,
+                    const std::function<bool(const std::string &name,
+                                             const ElfW(Shdr) &)> &callback) {
+  ElfW(Ehdr) elf_header;
+  if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
+    return false;
+  }
+
+  ElfW(Shdr) shstrtab;
+  off_t shstrtab_offset =
+      (elf_header.e_shoff + elf_header.e_shentsize * elf_header.e_shstrndx);
+  if (!ReadFromOffsetExact(fd, &shstrtab, sizeof(shstrtab), shstrtab_offset)) {
+    return false;
+  }
+
+  for (int i = 0; i < elf_header.e_shnum; ++i) {
+    ElfW(Shdr) out;
+    off_t section_header_offset =
+        (elf_header.e_shoff + elf_header.e_shentsize * i);
+    if (!ReadFromOffsetExact(fd, &out, sizeof(out), section_header_offset)) {
+      return false;
+    }
+    off_t name_offset = shstrtab.sh_offset + out.sh_name;
+    char header_name[kMaxSectionNameLen + 1];
+    ssize_t n_read =
+        ReadFromOffset(fd, &header_name, kMaxSectionNameLen, name_offset);
+    if (n_read == -1) {
+      return false;
+    } else if (n_read > kMaxSectionNameLen) {
+      // Long read?
+      return false;
+    }
+    header_name[n_read] = '\0';
+
+    std::string name(header_name);
+    if (!callback(name, out)) {
+      break;
+    }
+  }
+  return true;
+}
+
+// name_len should include terminating '\0'.
+bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
+                            ElfW(Shdr) * out) {
+  char header_name[kMaxSectionNameLen];
+  if (sizeof(header_name) < name_len) {
+    ABSL_RAW_LOG(WARNING,
+                 "Section name '%s' is too long (%zu); "
+                 "section will not be found (even if present).",
+                 name, name_len);
+    // No point in even trying.
+    return false;
+  }
+
+  ElfW(Ehdr) elf_header;
+  if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
+    return false;
+  }
+
+  ElfW(Shdr) shstrtab;
+  off_t shstrtab_offset =
+      (elf_header.e_shoff + elf_header.e_shentsize * elf_header.e_shstrndx);
+  if (!ReadFromOffsetExact(fd, &shstrtab, sizeof(shstrtab), shstrtab_offset)) {
+    return false;
+  }
+
+  for (int i = 0; i < elf_header.e_shnum; ++i) {
+    off_t section_header_offset =
+        (elf_header.e_shoff + elf_header.e_shentsize * i);
+    if (!ReadFromOffsetExact(fd, out, sizeof(*out), section_header_offset)) {
+      return false;
+    }
+    off_t name_offset = shstrtab.sh_offset + out->sh_name;
+    ssize_t n_read = ReadFromOffset(fd, &header_name, name_len, name_offset);
+    if (n_read < 0) {
+      return false;
+    } else if (static_cast<size_t>(n_read) != name_len) {
+      // Short read -- name could be at end of file.
+      continue;
+    }
+    if (memcmp(header_name, name, name_len) == 0) {
+      return true;
+    }
+  }
+  return false;
+}
+
+// Compare symbols at in the same address.
+// Return true if we should pick symbol1.
+static bool ShouldPickFirstSymbol(const ElfW(Sym) & symbol1,
+                                  const ElfW(Sym) & symbol2) {
+  // If one of the symbols is weak and the other is not, pick the one
+  // this is not a weak symbol.
+  char bind1 = ELF_ST_BIND(symbol1.st_info);
+  char bind2 = ELF_ST_BIND(symbol1.st_info);
+  if (bind1 == STB_WEAK && bind2 != STB_WEAK) return false;
+  if (bind2 == STB_WEAK && bind1 != STB_WEAK) return true;
+
+  // If one of the symbols has zero size and the other is not, pick the
+  // one that has non-zero size.
+  if (symbol1.st_size != 0 && symbol2.st_size == 0) {
+    return true;
+  }
+  if (symbol1.st_size == 0 && symbol2.st_size != 0) {
+    return false;
+  }
+
+  // If one of the symbols has no type and the other is not, pick the
+  // one that has a type.
+  char type1 = ELF_ST_TYPE(symbol1.st_info);
+  char type2 = ELF_ST_TYPE(symbol1.st_info);
+  if (type1 != STT_NOTYPE && type2 == STT_NOTYPE) {
+    return true;
+  }
+  if (type1 == STT_NOTYPE && type2 != STT_NOTYPE) {
+    return false;
+  }
+
+  // Pick the first one, if we still cannot decide.
+  return true;
+}
+
+// Return true if an address is inside a section.
+static bool InSection(const void *address, const ElfW(Shdr) * section) {
+  const char *start = reinterpret_cast<const char *>(section->sh_addr);
+  size_t size = static_cast<size_t>(section->sh_size);
+  return start <= address && address < (start + size);
+}
+
+// Read a symbol table and look for the symbol containing the
+// pc. Iterate over symbols in a symbol table and look for the symbol
+// containing "pc".  If the symbol is found, and its name fits in
+// out_size, the name is written into out and SYMBOL_FOUND is returned.
+// If the name does not fit, truncated name is written into out,
+// and SYMBOL_TRUNCATED is returned. Out is NUL-terminated.
+// If the symbol is not found, SYMBOL_NOT_FOUND is returned;
+// To keep stack consumption low, we would like this function to not get
+// inlined.
+static ABSL_ATTRIBUTE_NOINLINE FindSymbolResult FindSymbol(
+    const void *const pc, const int fd, char *out, int out_size,
+    ptrdiff_t relocation, const ElfW(Shdr) * strtab, const ElfW(Shdr) * symtab,
+    const ElfW(Shdr) * opd, char *tmp_buf, int tmp_buf_size) {
+  if (symtab == nullptr) {
+    return SYMBOL_NOT_FOUND;
+  }
+
+  // Read multiple symbols at once to save read() calls.
+  ElfW(Sym) *buf = reinterpret_cast<ElfW(Sym) *>(tmp_buf);
+  const int buf_entries = tmp_buf_size / sizeof(buf[0]);
+
+  const int num_symbols = symtab->sh_size / symtab->sh_entsize;
+
+  // On platforms using an .opd section (PowerPC & IA64), a function symbol
+  // has the address of a function descriptor, which contains the real
+  // starting address.  However, we do not always want to use the real
+  // starting address because we sometimes want to symbolize a function
+  // pointer into the .opd section, e.g. FindSymbol(&foo,...).
+  const bool pc_in_opd =
+      kPlatformUsesOPDSections && opd != nullptr && InSection(pc, opd);
+  const bool deref_function_descriptor_pointer =
+      kPlatformUsesOPDSections && opd != nullptr && !pc_in_opd;
+
+  ElfW(Sym) best_match;
+  SafeMemZero(&best_match, sizeof(best_match));
+  bool found_match = false;
+  for (int i = 0; i < num_symbols;) {
+    off_t offset = symtab->sh_offset + i * symtab->sh_entsize;
+    const int num_remaining_symbols = num_symbols - i;
+    const int entries_in_chunk = std::min(num_remaining_symbols, buf_entries);
+    const int bytes_in_chunk = entries_in_chunk * sizeof(buf[0]);
+    const ssize_t len = ReadFromOffset(fd, buf, bytes_in_chunk, offset);
+    SAFE_ASSERT(len % sizeof(buf[0]) == 0);
+    const ssize_t num_symbols_in_buf = len / sizeof(buf[0]);
+    SAFE_ASSERT(num_symbols_in_buf <= entries_in_chunk);
+    for (int j = 0; j < num_symbols_in_buf; ++j) {
+      const ElfW(Sym) &symbol = buf[j];
+
+      // For a DSO, a symbol address is relocated by the loading address.
+      // We keep the original address for opd redirection below.
+      const char *const original_start_address =
+          reinterpret_cast<const char *>(symbol.st_value);
+      const char *start_address = original_start_address + relocation;
+
+      if (deref_function_descriptor_pointer &&
+          InSection(original_start_address, opd)) {
+        // The opd section is mapped into memory.  Just dereference
+        // start_address to get the first double word, which points to the
+        // function entry.
+        start_address = *reinterpret_cast<const char *const *>(start_address);
+      }
+
+      // If pc is inside the .opd section, it points to a function descriptor.
+      const size_t size = pc_in_opd ? kFunctionDescriptorSize : symbol.st_size;
+      const void *const end_address =
+          reinterpret_cast<const char *>(start_address) + size;
+      if (symbol.st_value != 0 &&  // Skip null value symbols.
+          symbol.st_shndx != 0 &&  // Skip undefined symbols.
+#ifdef STT_TLS
+          ELF_ST_TYPE(symbol.st_info) != STT_TLS &&  // Skip thread-local data.
+#endif                                               // STT_TLS
+          ((start_address <= pc && pc < end_address) ||
+           (start_address == pc && pc == end_address))) {
+        if (!found_match || ShouldPickFirstSymbol(symbol, best_match)) {
+          found_match = true;
+          best_match = symbol;
+        }
+      }
+    }
+    i += num_symbols_in_buf;
+  }
+
+  if (found_match) {
+    const size_t off = strtab->sh_offset + best_match.st_name;
+    const ssize_t n_read = ReadFromOffset(fd, out, out_size, off);
+    if (n_read <= 0) {
+      // This should never happen.
+      ABSL_RAW_LOG(WARNING,
+                   "Unable to read from fd %d at offset %zu: n_read = %zd", fd,
+                   off, n_read);
+      return SYMBOL_NOT_FOUND;
+    }
+    ABSL_RAW_CHECK(n_read <= out_size, "ReadFromOffset read too much data.");
+
+    // strtab->sh_offset points into .strtab-like section that contains
+    // NUL-terminated strings: '\0foo\0barbaz\0...".
+    //
+    // sh_offset+st_name points to the start of symbol name, but we don't know
+    // how long the symbol is, so we try to read as much as we have space for,
+    // and usually over-read (i.e. there is a NUL somewhere before n_read).
+    if (memchr(out, '\0', n_read) == nullptr) {
+      // Either out_size was too small (n_read == out_size and no NUL), or
+      // we tried to read past the EOF (n_read < out_size) and .strtab is
+      // corrupt (missing terminating NUL; should never happen for valid ELF).
+      out[n_read - 1] = '\0';
+      return SYMBOL_TRUNCATED;
+    }
+    return SYMBOL_FOUND;
+  }
+
+  return SYMBOL_NOT_FOUND;
+}
+
+// Get the symbol name of "pc" from the file pointed by "fd".  Process
+// both regular and dynamic symbol tables if necessary.
+// See FindSymbol() comment for description of return value.
+FindSymbolResult Symbolizer::GetSymbolFromObjectFile(
+    const ObjFile &obj, const void *const pc, const ptrdiff_t relocation,
+    char *out, int out_size, char *tmp_buf, int tmp_buf_size) {
+  ElfW(Shdr) symtab;
+  ElfW(Shdr) strtab;
+  ElfW(Shdr) opd;
+  ElfW(Shdr) *opd_ptr = nullptr;
+
+  // On platforms using an .opd sections for function descriptor, read
+  // the section header.  The .opd section is in data segment and should be
+  // loaded but we check that it is mapped just to be extra careful.
+  if (kPlatformUsesOPDSections) {
+    if (GetSectionHeaderByName(obj.fd, kOpdSectionName,
+                               sizeof(kOpdSectionName) - 1, &opd) &&
+        FindObjFile(reinterpret_cast<const char *>(opd.sh_addr) + relocation,
+                    opd.sh_size) != nullptr) {
+      opd_ptr = &opd;
+    } else {
+      return SYMBOL_NOT_FOUND;
+    }
+  }
+
+  // Consult a regular symbol table, then fall back to the dynamic symbol table.
+  for (const auto symbol_table_type : {SHT_SYMTAB, SHT_DYNSYM}) {
+    if (!GetSectionHeaderByType(obj.fd, obj.elf_header.e_shnum,
+                                obj.elf_header.e_shoff, symbol_table_type,
+                                &symtab, tmp_buf, tmp_buf_size)) {
+      continue;
+    }
+    if (!ReadFromOffsetExact(
+            obj.fd, &strtab, sizeof(strtab),
+            obj.elf_header.e_shoff + symtab.sh_link * sizeof(symtab))) {
+      continue;
+    }
+    const FindSymbolResult rc =
+        FindSymbol(pc, obj.fd, out, out_size, relocation, &strtab, &symtab,
+                   opd_ptr, tmp_buf, tmp_buf_size);
+    if (rc != SYMBOL_NOT_FOUND) {
+      return rc;
+    }
+  }
+
+  return SYMBOL_NOT_FOUND;
+}
+
+namespace {
+// Thin wrapper around a file descriptor so that the file descriptor
+// gets closed for sure.
+class FileDescriptor {
+ public:
+  explicit FileDescriptor(int fd) : fd_(fd) {}
+  FileDescriptor(const FileDescriptor &) = delete;
+  FileDescriptor &operator=(const FileDescriptor &) = delete;
+
+  ~FileDescriptor() {
+    if (fd_ >= 0) {
+      NO_INTR(close(fd_));
+    }
+  }
+
+  int get() const { return fd_; }
+
+ private:
+  const int fd_;
+};
+
+// Helper class for reading lines from file.
+//
+// Note: we don't use ProcMapsIterator since the object is big (it has
+// a 5k array member) and uses async-unsafe functions such as sscanf()
+// and snprintf().
+class LineReader {
+ public:
+  explicit LineReader(int fd, char *buf, int buf_len)
+      : fd_(fd),
+        buf_len_(buf_len),
+        buf_(buf),
+        bol_(buf),
+        eol_(buf),
+        eod_(buf) {}
+
+  LineReader(const LineReader &) = delete;
+  LineReader &operator=(const LineReader &) = delete;
+
+  // Read '\n'-terminated line from file.  On success, modify "bol"
+  // and "eol", then return true.  Otherwise, return false.
+  //
+  // Note: if the last line doesn't end with '\n', the line will be
+  // dropped.  It's an intentional behavior to make the code simple.
+  bool ReadLine(const char **bol, const char **eol) {
+    if (BufferIsEmpty()) {  // First time.
+      const ssize_t num_bytes = ReadPersistent(fd_, buf_, buf_len_);
+      if (num_bytes <= 0) {  // EOF or error.
+        return false;
+      }
+      eod_ = buf_ + num_bytes;
+      bol_ = buf_;
+    } else {
+      bol_ = eol_ + 1;            // Advance to the next line in the buffer.
+      SAFE_ASSERT(bol_ <= eod_);  // "bol_" can point to "eod_".
+      if (!HasCompleteLine()) {
+        const int incomplete_line_length = eod_ - bol_;
+        // Move the trailing incomplete line to the beginning.
+        memmove(buf_, bol_, incomplete_line_length);
+        // Read text from file and append it.
+        char *const append_pos = buf_ + incomplete_line_length;
+        const int capacity_left = buf_len_ - incomplete_line_length;
+        const ssize_t num_bytes =
+            ReadPersistent(fd_, append_pos, capacity_left);
+        if (num_bytes <= 0) {  // EOF or error.
+          return false;
+        }
+        eod_ = append_pos + num_bytes;
+        bol_ = buf_;
+      }
+    }
+    eol_ = FindLineFeed();
+    if (eol_ == nullptr) {  // '\n' not found.  Malformed line.
+      return false;
+    }
+    *eol_ = '\0';  // Replace '\n' with '\0'.
+
+    *bol = bol_;
+    *eol = eol_;
+    return true;
+  }
+
+ private:
+  char *FindLineFeed() const {
+    return reinterpret_cast<char *>(memchr(bol_, '\n', eod_ - bol_));
+  }
+
+  bool BufferIsEmpty() const { return buf_ == eod_; }
+
+  bool HasCompleteLine() const {
+    return !BufferIsEmpty() && FindLineFeed() != nullptr;
+  }
+
+  const int fd_;
+  const int buf_len_;
+  char *const buf_;
+  char *bol_;
+  char *eol_;
+  const char *eod_;  // End of data in "buf_".
+};
+}  // namespace
+
+// Place the hex number read from "start" into "*hex".  The pointer to
+// the first non-hex character or "end" is returned.
+static const char *GetHex(const char *start, const char *end,
+                          uint64_t *const value) {
+  uint64_t hex = 0;
+  const char *p;
+  for (p = start; p < end; ++p) {
+    int ch = *p;
+    if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') ||
+        (ch >= 'a' && ch <= 'f')) {
+      hex = (hex << 4) | (ch < 'A' ? ch - '0' : (ch & 0xF) + 9);
+    } else {  // Encountered the first non-hex character.
+      break;
+    }
+  }
+  SAFE_ASSERT(p <= end);
+  *value = hex;
+  return p;
+}
+
+static const char *GetHex(const char *start, const char *end,
+                          const void **const addr) {
+  uint64_t hex = 0;
+  const char *p = GetHex(start, end, &hex);
+  *addr = reinterpret_cast<void *>(hex);
+  return p;
+}
+
+// Normally we are only interested in "r?x" maps.
+// On the PowerPC, function pointers point to descriptors in the .opd
+// section.  The descriptors themselves are not executable code, so
+// we need to relax the check below to "r??".
+static bool ShouldUseMapping(const char *const flags) {
+  return flags[0] == 'r' && (kPlatformUsesOPDSections || flags[2] == 'x');
+}
+
+// Read /proc/self/maps and run "callback" for each mmapped file found.  If
+// "callback" returns false, stop scanning and return true. Else continue
+// scanning /proc/self/maps. Return true if no parse error is found.
+static ABSL_ATTRIBUTE_NOINLINE bool ReadAddrMap(
+    bool (*callback)(const char *filename, const void *const start_addr,
+                     const void *const end_addr, uint64_t offset, void *arg),
+    void *arg, void *tmp_buf, int tmp_buf_size) {
+  // Use /proc/self/task/<pid>/maps instead of /proc/self/maps. The latter
+  // requires kernel to stop all threads, and is significantly slower when there
+  // are 1000s of threads.
+  char maps_path[80];
+  snprintf(maps_path, sizeof(maps_path), "/proc/self/task/%d/maps", getpid());
+
+  int maps_fd;
+  NO_INTR(maps_fd = open(maps_path, O_RDONLY));
+  FileDescriptor wrapped_maps_fd(maps_fd);
+  if (wrapped_maps_fd.get() < 0) {
+    ABSL_RAW_LOG(WARNING, "%s: errno=%d", maps_path, errno);
+    return false;
+  }
+
+  // Iterate over maps and look for the map containing the pc.  Then
+  // look into the symbol tables inside.
+  LineReader reader(wrapped_maps_fd.get(), static_cast<char *>(tmp_buf),
+                    tmp_buf_size);
+  while (true) {
+    const char *cursor;
+    const char *eol;
+    if (!reader.ReadLine(&cursor, &eol)) {  // EOF or malformed line.
+      break;
+    }
+
+    const char *line = cursor;
+    const void *start_address;
+    // Start parsing line in /proc/self/maps.  Here is an example:
+    //
+    // 08048000-0804c000 r-xp 00000000 08:01 2142121    /bin/cat
+    //
+    // We want start address (08048000), end address (0804c000), flags
+    // (r-xp) and file name (/bin/cat).
+
+    // Read start address.
+    cursor = GetHex(cursor, eol, &start_address);
+    if (cursor == eol || *cursor != '-') {
+      ABSL_RAW_LOG(WARNING, "Corrupt /proc/self/maps line: %s", line);
+      return false;
+    }
+    ++cursor;  // Skip '-'.
+
+    // Read end address.
+    const void *end_address;
+    cursor = GetHex(cursor, eol, &end_address);
+    if (cursor == eol || *cursor != ' ') {
+      ABSL_RAW_LOG(WARNING, "Corrupt /proc/self/maps line: %s", line);
+      return false;
+    }
+    ++cursor;  // Skip ' '.
+
+    // Read flags.  Skip flags until we encounter a space or eol.
+    const char *const flags_start = cursor;
+    while (cursor < eol && *cursor != ' ') {
+      ++cursor;
+    }
+    // We expect at least four letters for flags (ex. "r-xp").
+    if (cursor == eol || cursor < flags_start + 4) {
+      ABSL_RAW_LOG(WARNING, "Corrupt /proc/self/maps: %s", line);
+      return false;
+    }
+
+    // Check flags.
+    if (!ShouldUseMapping(flags_start)) {
+      continue;  // We skip this map.
+    }
+    ++cursor;  // Skip ' '.
+
+    // Read file offset.
+    uint64_t offset;
+    cursor = GetHex(cursor, eol, &offset);
+    ++cursor;  // Skip ' '.
+
+    // Skip to file name.  "cursor" now points to dev.  We need to skip at least
+    // two spaces for dev and inode.
+    int num_spaces = 0;
+    while (cursor < eol) {
+      if (*cursor == ' ') {
+        ++num_spaces;
+      } else if (num_spaces >= 2) {
+        // The first non-space character after  skipping two spaces
+        // is the beginning of the file name.
+        break;
+      }
+      ++cursor;
+    }
+
+    // Check whether this entry corresponds to our hint table for the true
+    // filename.
+    bool hinted =
+        GetFileMappingHint(&start_address, &end_address, &offset, &cursor);
+    if (!hinted && (cursor == eol || cursor[0] == '[')) {
+      // not an object file, typically [vdso] or [vsyscall]
+      continue;
+    }
+    if (!callback(cursor, start_address, end_address, offset, arg)) break;
+  }
+  return true;
+}
+
+// Find the objfile mapped in address region containing [addr, addr + len).
+ObjFile *Symbolizer::FindObjFile(const void *const addr, size_t len) {
+  for (int i = 0; i < 2; ++i) {
+    if (!ok_) return nullptr;
+
+    // Read /proc/self/maps if necessary
+    if (!addr_map_read_) {
+      addr_map_read_ = true;
+      if (!ReadAddrMap(RegisterObjFile, this, tmp_buf_, TMP_BUF_SIZE)) {
+        ok_ = false;
+        return nullptr;
+      }
+    }
+
+    int lo = 0;
+    int hi = addr_map_.Size();
+    while (lo < hi) {
+      int mid = (lo + hi) / 2;
+      if (addr < addr_map_.At(mid)->end_addr) {
+        hi = mid;
+      } else {
+        lo = mid + 1;
+      }
+    }
+    if (lo != addr_map_.Size()) {
+      ObjFile *obj = addr_map_.At(lo);
+      SAFE_ASSERT(obj->end_addr > addr);
+      if (addr >= obj->start_addr &&
+          reinterpret_cast<const char *>(addr) + len <= obj->end_addr)
+        return obj;
+    }
+
+    // The address mapping may have changed since it was last read.  Retry.
+    ClearAddrMap();
+  }
+  return nullptr;
+}
+
+void Symbolizer::ClearAddrMap() {
+  for (int i = 0; i != addr_map_.Size(); i++) {
+    ObjFile *o = addr_map_.At(i);
+    base_internal::LowLevelAlloc::Free(o->filename);
+    if (o->fd >= 0) {
+      NO_INTR(close(o->fd));
+    }
+  }
+  addr_map_.Clear();
+  addr_map_read_ = false;
+}
+
+// Callback for ReadAddrMap to register objfiles in an in-memory table.
+bool Symbolizer::RegisterObjFile(const char *filename,
+                                 const void *const start_addr,
+                                 const void *const end_addr, uint64_t offset,
+                                 void *arg) {
+  Symbolizer *impl = static_cast<Symbolizer *>(arg);
+
+  // Files are supposed to be added in the increasing address order.  Make
+  // sure that's the case.
+  int addr_map_size = impl->addr_map_.Size();
+  if (addr_map_size != 0) {
+    ObjFile *old = impl->addr_map_.At(addr_map_size - 1);
+    if (old->end_addr > end_addr) {
+      ABSL_RAW_LOG(ERROR,
+                   "Unsorted addr map entry: 0x%" PRIxPTR ": %s <-> 0x%" PRIxPTR
+                   ": %s",
+                   reinterpret_cast<uintptr_t>(end_addr), filename,
+                   reinterpret_cast<uintptr_t>(old->end_addr), old->filename);
+      return true;
+    } else if (old->end_addr == end_addr) {
+      // The same entry appears twice. This sometimes happens for [vdso].
+      if (old->start_addr != start_addr ||
+          strcmp(old->filename, filename) != 0) {
+        ABSL_RAW_LOG(ERROR,
+                     "Duplicate addr 0x%" PRIxPTR ": %s <-> 0x%" PRIxPTR ": %s",
+                     reinterpret_cast<uintptr_t>(end_addr), filename,
+                     reinterpret_cast<uintptr_t>(old->end_addr), old->filename);
+      }
+      return true;
+    }
+  }
+  ObjFile *obj = impl->addr_map_.Add();
+  obj->filename = impl->CopyString(filename);
+  obj->start_addr = start_addr;
+  obj->end_addr = end_addr;
+  obj->offset = offset;
+  obj->elf_type = -1;  // filled on demand
+  obj->fd = -1;        // opened on demand
+  return true;
+}
+
+// This function wraps the Demangle function to provide an interface
+// where the input symbol is demangled in-place.
+// To keep stack consumption low, we would like this function to not
+// get inlined.
+static ABSL_ATTRIBUTE_NOINLINE void DemangleInplace(char *out, int out_size,
+                                                    char *tmp_buf,
+                                                    int tmp_buf_size) {
+  if (Demangle(out, tmp_buf, tmp_buf_size)) {
+    // Demangling succeeded. Copy to out if the space allows.
+    int len = strlen(tmp_buf);
+    if (len + 1 <= out_size) {  // +1 for '\0'.
+      SAFE_ASSERT(len < tmp_buf_size);
+      memmove(out, tmp_buf, len + 1);
+    }
+  }
+}
+
+SymbolCacheLine *Symbolizer::GetCacheLine(const void *const pc) {
+  uintptr_t pc0 = reinterpret_cast<uintptr_t>(pc);
+  pc0 >>= 3;  // drop the low 3 bits
+
+  // Shuffle bits.
+  pc0 ^= (pc0 >> 6) ^ (pc0 >> 12) ^ (pc0 >> 18);
+  return &symbol_cache_[pc0 % SYMBOL_CACHE_LINES];
+}
+
+void Symbolizer::AgeSymbols(SymbolCacheLine *line) {
+  for (uint32_t &age : line->age) {
+    ++age;
+  }
+}
+
+const char *Symbolizer::FindSymbolInCache(const void *const pc) {
+  if (pc == nullptr) return nullptr;
+
+  SymbolCacheLine *line = GetCacheLine(pc);
+  for (size_t i = 0; i < ABSL_ARRAYSIZE(line->pc); ++i) {
+    if (line->pc[i] == pc) {
+      AgeSymbols(line);
+      line->age[i] = 0;
+      return line->name[i];
+    }
+  }
+  return nullptr;
+}
+
+const char *Symbolizer::InsertSymbolInCache(const void *const pc,
+                                            const char *name) {
+  SAFE_ASSERT(pc != nullptr);
+
+  SymbolCacheLine *line = GetCacheLine(pc);
+  uint32_t max_age = 0;
+  int oldest_index = -1;
+  for (size_t i = 0; i < ABSL_ARRAYSIZE(line->pc); ++i) {
+    if (line->pc[i] == nullptr) {
+      AgeSymbols(line);
+      line->pc[i] = pc;
+      line->name[i] = CopyString(name);
+      line->age[i] = 0;
+      return line->name[i];
+    }
+    if (line->age[i] >= max_age) {
+      max_age = line->age[i];
+      oldest_index = i;
+    }
+  }
+
+  AgeSymbols(line);
+  ABSL_RAW_CHECK(oldest_index >= 0, "Corrupt cache");
+  base_internal::LowLevelAlloc::Free(line->name[oldest_index]);
+  line->pc[oldest_index] = pc;
+  line->name[oldest_index] = CopyString(name);
+  line->age[oldest_index] = 0;
+  return line->name[oldest_index];
+}
+
+static void MaybeOpenFdFromSelfExe(ObjFile *obj) {
+  if (memcmp(obj->start_addr, ELFMAG, SELFMAG) != 0) {
+    return;
+  }
+  int fd = open("/proc/self/exe", O_RDONLY);
+  if (fd == -1) {
+    return;
+  }
+  // Verify that contents of /proc/self/exe matches in-memory image of
+  // the binary. This can fail if the "deleted" binary is in fact not
+  // the main executable, or for binaries that have the first PT_LOAD
+  // segment smaller than 4K. We do it in four steps so that the
+  // buffer is smaller and we don't consume too much stack space.
+  const char *mem = reinterpret_cast<const char *>(obj->start_addr);
+  for (int i = 0; i < 4; ++i) {
+    char buf[1024];
+    ssize_t n = read(fd, buf, sizeof(buf));
+    if (n != sizeof(buf) || memcmp(buf, mem, sizeof(buf)) != 0) {
+      close(fd);
+      return;
+    }
+    mem += sizeof(buf);
+  }
+  obj->fd = fd;
+}
+
+static bool MaybeInitializeObjFile(ObjFile *obj) {
+  if (obj->fd < 0) {
+    obj->fd = open(obj->filename, O_RDONLY);
+
+    if (obj->fd < 0) {
+      // Getting /proc/self/exe here means that we were hinted.
+      if (strcmp(obj->filename, "/proc/self/exe") == 0) {
+        // /proc/self/exe may be inaccessible (due to setuid, etc.), so try
+        // accessing the binary via argv0.
+        if (argv0_value != nullptr) {
+          obj->fd = open(argv0_value, O_RDONLY);
+        }
+      } else {
+        MaybeOpenFdFromSelfExe(obj);
+      }
+    }
+
+    if (obj->fd < 0) {
+      ABSL_RAW_LOG(WARNING, "%s: open failed: errno=%d", obj->filename, errno);
+      return false;
+    }
+    obj->elf_type = FileGetElfType(obj->fd);
+    if (obj->elf_type < 0) {
+      ABSL_RAW_LOG(WARNING, "%s: wrong elf type: %d", obj->filename,
+                   obj->elf_type);
+      return false;
+    }
+
+    if (!ReadFromOffsetExact(obj->fd, &obj->elf_header, sizeof(obj->elf_header),
+                             0)) {
+      ABSL_RAW_LOG(WARNING, "%s: failed to read elf header", obj->filename);
+      return false;
+    }
+  }
+  return true;
+}
+
+// The implementation of our symbolization routine.  If it
+// successfully finds the symbol containing "pc" and obtains the
+// symbol name, returns pointer to that symbol. Otherwise, returns nullptr.
+// If any symbol decorators have been installed via InstallSymbolDecorator(),
+// they are called here as well.
+// To keep stack consumption low, we would like this function to not
+// get inlined.
+const char *Symbolizer::GetSymbol(const void *const pc) {
+  const char *entry = FindSymbolInCache(pc);
+  if (entry != nullptr) {
+    return entry;
+  }
+  symbol_buf_[0] = '\0';
+
+  ObjFile *const obj = FindObjFile(pc, 1);
+  ptrdiff_t relocation = 0;
+  int fd = -1;
+  if (obj != nullptr) {
+    if (MaybeInitializeObjFile(obj)) {
+      if (obj->elf_type == ET_DYN &&
+          reinterpret_cast<uint64_t>(obj->start_addr) >= obj->offset) {
+        // This object was relocated.
+        //
+        // For obj->offset > 0, adjust the relocation since a mapping at offset
+        // X in the file will have a start address of [true relocation]+X.
+        relocation = reinterpret_cast<ptrdiff_t>(obj->start_addr) - obj->offset;
+      }
+
+      fd = obj->fd;
+    }
+    if (GetSymbolFromObjectFile(*obj, pc, relocation, symbol_buf_,
+                                sizeof(symbol_buf_), tmp_buf_,
+                                sizeof(tmp_buf_)) == SYMBOL_FOUND) {
+      // Only try to demangle the symbol name if it fit into symbol_buf_.
+      DemangleInplace(symbol_buf_, sizeof(symbol_buf_), tmp_buf_,
+                      sizeof(tmp_buf_));
+    }
+  } else {
+#if ABSL_HAVE_VDSO_SUPPORT
+    VDSOSupport vdso;
+    if (vdso.IsPresent()) {
+      VDSOSupport::SymbolInfo symbol_info;
+      if (vdso.LookupSymbolByAddress(pc, &symbol_info)) {
+        // All VDSO symbols are known to be short.
+        size_t len = strlen(symbol_info.name);
+        ABSL_RAW_CHECK(len + 1 < sizeof(symbol_buf_),
+                       "VDSO symbol unexpectedly long");
+        memcpy(symbol_buf_, symbol_info.name, len + 1);
+      }
+    }
+#endif
+  }
+
+  if (g_decorators_mu.TryLock()) {
+    if (g_num_decorators > 0) {
+      SymbolDecoratorArgs decorator_args = {
+          pc,       relocation,       fd,     symbol_buf_, sizeof(symbol_buf_),
+          tmp_buf_, sizeof(tmp_buf_), nullptr};
+      for (int i = 0; i < g_num_decorators; ++i) {
+        decorator_args.arg = g_decorators[i].arg;
+        g_decorators[i].fn(&decorator_args);
+      }
+    }
+    g_decorators_mu.Unlock();
+  }
+  if (symbol_buf_[0] == '\0') {
+    return nullptr;
+  }
+  symbol_buf_[sizeof(symbol_buf_) - 1] = '\0';  // Paranoia.
+  return InsertSymbolInCache(pc, symbol_buf_);
+}
+
+bool RemoveAllSymbolDecorators(void) {
+  if (!g_decorators_mu.TryLock()) {
+    // Someone else is using decorators. Get out.
+    return false;
+  }
+  g_num_decorators = 0;
+  g_decorators_mu.Unlock();
+  return true;
+}
+
+bool RemoveSymbolDecorator(int ticket) {
+  if (!g_decorators_mu.TryLock()) {
+    // Someone else is using decorators. Get out.
+    return false;
+  }
+  for (int i = 0; i < g_num_decorators; ++i) {
+    if (g_decorators[i].ticket == ticket) {
+      while (i < g_num_decorators - 1) {
+        g_decorators[i] = g_decorators[i + 1];
+        ++i;
+      }
+      g_num_decorators = i;
+      break;
+    }
+  }
+  g_decorators_mu.Unlock();
+  return true;  // Decorator is known to be removed.
+}
+
+int InstallSymbolDecorator(SymbolDecorator decorator, void *arg) {
+  static int ticket = 0;
+
+  if (!g_decorators_mu.TryLock()) {
+    // Someone else is using decorators. Get out.
+    return false;
+  }
+  int ret = ticket;
+  if (g_num_decorators >= kMaxDecorators) {
+    ret = -1;
+  } else {
+    g_decorators[g_num_decorators] = {decorator, arg, ticket++};
+    ++g_num_decorators;
+  }
+  g_decorators_mu.Unlock();
+  return ret;
+}
+
+bool RegisterFileMappingHint(const void *start, const void *end, uint64_t offset,
+                             const char *filename) {
+  SAFE_ASSERT(start <= end);
+  SAFE_ASSERT(filename != nullptr);
+
+  InitSigSafeArena();
+
+  if (!g_file_mapping_mu.TryLock()) {
+    return false;
+  }
+
+  bool ret = true;
+  if (g_num_file_mapping_hints >= kMaxFileMappingHints) {
+    ret = false;
+  } else {
+    // TODO(ckennelly): Move this into a std::string copy routine.
+    int len = strlen(filename);
+    char *dst = static_cast<char *>(
+        base_internal::LowLevelAlloc::AllocWithArena(len + 1, SigSafeArena()));
+    ABSL_RAW_CHECK(dst != nullptr, "out of memory");
+    memcpy(dst, filename, len + 1);
+
+    auto &hint = g_file_mapping_hints[g_num_file_mapping_hints++];
+    hint.start = start;
+    hint.end = end;
+    hint.offset = offset;
+    hint.filename = dst;
+  }
+
+  g_file_mapping_mu.Unlock();
+  return ret;
+}
+
+bool GetFileMappingHint(const void **start, const void **end, uint64_t *offset,
+                        const char **filename) {
+  if (!g_file_mapping_mu.TryLock()) {
+    return false;
+  }
+  bool found = false;
+  for (int i = 0; i < g_num_file_mapping_hints; i++) {
+    if (g_file_mapping_hints[i].start <= *start &&
+        *end <= g_file_mapping_hints[i].end) {
+      // We assume that the start_address for the mapping is the base
+      // address of the ELF section, but when [start_address,end_address) is
+      // not strictly equal to [hint.start, hint.end), that assumption is
+      // invalid.
+      //
+      // This uses the hint's start address (even though hint.start is not
+      // necessarily equal to start_address) to ensure the correct
+      // relocation is computed later.
+      *start = g_file_mapping_hints[i].start;
+      *end = g_file_mapping_hints[i].end;
+      *offset = g_file_mapping_hints[i].offset;
+      *filename = g_file_mapping_hints[i].filename;
+      found = true;
+      break;
+    }
+  }
+  g_file_mapping_mu.Unlock();
+  return found;
+}
+
+}  // namespace debugging_internal
+
+bool Symbolize(const void *pc, char *out, int out_size) {
+  // Symbolization is very slow under tsan.
+  ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN();
+  SAFE_ASSERT(out_size >= 0);
+  debugging_internal::Symbolizer *s = debugging_internal::AllocateSymbolizer();
+  const char *name = s->GetSymbol(pc);
+  bool ok = false;
+  if (name != nullptr && out_size > 0) {
+    strncpy(out, name, out_size);
+    ok = true;
+    if (out[out_size - 1] != '\0') {
+      // strncpy() does not '\0' terminate when it truncates.  Do so, with
+      // trailing ellipsis.
+      static constexpr char kEllipsis[] = "...";
+      int ellipsis_size =
+          std::min(implicit_cast<int>(strlen(kEllipsis)), out_size - 1);
+      memcpy(out + out_size - ellipsis_size - 1, kEllipsis, ellipsis_size);
+      out[out_size - 1] = '\0';
+    }
+  }
+  debugging_internal::FreeSymbolizer(s);
+  ANNOTATE_IGNORE_READS_AND_WRITES_END();
+  return ok;
+}
+
+}  // namespace absl
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc
new file mode 100644 (file)
index 0000000..7c580fe
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <cstdint>
+
+#include "absl/base/internal/raw_logging.h"
+
+namespace absl {
+
+namespace debugging_internal {
+
+int InstallSymbolDecorator(SymbolDecorator, void*) { return -1; }
+bool RemoveSymbolDecorator(int) { return false; }
+bool RemoveAllSymbolDecorators(void) { return false; }
+bool RegisterFileMappingHint(const void *, const void *, uint64_t, const char *) {
+  return false;
+}
+bool GetFileMappingHint(const void **, const void **, uint64_t *, const char **) {
+  return false;
+}
+
+}  // namespace debugging_internal
+
+void InitializeSymbolizer(const char*) {}
+bool Symbolize(const void *, char *, int) { return false; }
+
+}  // namespace absl
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc
new file mode 100644 (file)
index 0000000..5a55f29
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// See "Retrieving Symbol Information by Address":
+// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680578(v=vs.85).aspx
+
+#include <windows.h>
+
+// MSVC header DbgHelp.h has a warning for an ignored typedef.
+#pragma warning(push)
+#pragma warning(disable:4091)
+#include <DbgHelp.h>
+#pragma warning(pop)
+
+#pragma comment(lib, "dbghelp.lib")
+
+#include <algorithm>
+#include <cstring>
+
+#include "absl/base/internal/raw_logging.h"
+
+namespace absl {
+
+static HANDLE process = NULL;
+
+void InitializeSymbolizer(const char *argv0) {
+  if (process != nullptr) {
+    return;
+  }
+  process = GetCurrentProcess();
+
+  // Symbols are not loaded until a reference is made requiring the
+  // symbols be loaded. This is the fastest, most efficient way to use
+  // the symbol handler.
+  SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME);
+  if (!SymInitialize(process, nullptr, true)) {
+    // GetLastError() returns a Win32 DWORD, but we assign to
+    // unsigned long long to simplify the ABSL_RAW_LOG case below.  The uniform
+    // initialization guarantees this is not a narrowing conversion.
+    const unsigned long long error{GetLastError()};  // NOLINT(runtime/int)
+    ABSL_RAW_LOG(FATAL, "SymInitialize() failed: %llu", error);
+  }
+}
+
+bool Symbolize(const void *pc, char *out, int out_size) {
+  if (out_size <= 0) {
+    return false;
+  }
+  std::aligned_storage<sizeof(SYMBOL_INFO) + MAX_SYM_NAME,
+                       alignof(SYMBOL_INFO)>::type buf;
+  SYMBOL_INFO *symbol = reinterpret_cast<SYMBOL_INFO *>(&buf);
+  symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
+  symbol->MaxNameLen = MAX_SYM_NAME;
+  if (!SymFromAddr(process, reinterpret_cast<DWORD64>(pc), nullptr, symbol)) {
+    return false;
+  }
+  strncpy(out, symbol->Name, out_size);
+  if (out[out_size - 1] != '\0') {
+    // strncpy() does not '\0' terminate when it truncates.
+    static constexpr char kEllipsis[] = "...";
+    int ellipsis_size =
+        std::min<int>(sizeof(kEllipsis) - 1, out_size - 1);
+    memcpy(out + out_size - ellipsis_size - 1, kEllipsis, ellipsis_size);
+    out[out_size - 1] = '\0';
+  }
+  return true;
+}
+
+}  // namespace absl
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/config.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/config.h
new file mode 100644 (file)
index 0000000..a9fd97a
--- /dev/null
@@ -0,0 +1,48 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_CONFIG_H_
+#define ABSL_FLAGS_CONFIG_H_
+
+// Determine if we should strip string literals from the Flag objects.
+// By default we strip string literals on mobile platforms.
+#if !defined(ABSL_FLAGS_STRIP_NAMES)
+
+#if defined(__ANDROID__)
+#define ABSL_FLAGS_STRIP_NAMES 1
+
+#elif defined(__APPLE__)
+#include <TargetConditionals.h>
+#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+#define ABSL_FLAGS_STRIP_NAMES 1
+#elif defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED
+#define ABSL_FLAGS_STRIP_NAMES 1
+#endif  // TARGET_OS_*
+#endif
+
+#endif  // !defined(ABSL_FLAGS_STRIP_NAMES)
+
+#if !defined(ABSL_FLAGS_STRIP_NAMES)
+// If ABSL_FLAGS_STRIP_NAMES wasn't set on the command line or above,
+// the default is not to strip.
+#define ABSL_FLAGS_STRIP_NAMES 0
+#endif
+
+#if !defined(ABSL_FLAGS_STRIP_HELP)
+// By default, if we strip names, we also strip help.
+#define ABSL_FLAGS_STRIP_HELP ABSL_FLAGS_STRIP_NAMES
+#endif
+
+#endif  // ABSL_FLAGS_CONFIG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/declare.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/declare.h
new file mode 100644 (file)
index 0000000..556ec5e
--- /dev/null
@@ -0,0 +1,58 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: declare.h
+// -----------------------------------------------------------------------------
+//
+// This file defines the ABSL_DECLARE_FLAG macro, allowing you to declare an
+// `absl::Flag` for use within a translation unit. You should place this
+// declaration within the header file associated with the .cc file that defines
+// and owns the `Flag`.
+
+#ifndef ABSL_FLAGS_DECLARE_H_
+#define ABSL_FLAGS_DECLARE_H_
+
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace flags_internal {
+
+// absl::Flag<T> represents a flag of type 'T' created by ABSL_FLAG.
+template <typename T>
+class Flag;
+
+}  // namespace flags_internal
+
+// Flag
+//
+// Forward declaration of the `absl::Flag` type for use in defining the macro.
+template <typename T>
+using Flag = flags_internal::Flag<T>;
+
+}  // namespace absl
+
+// ABSL_DECLARE_FLAG()
+//
+// This macro is a convenience for declaring use of an `absl::Flag` within a
+// translation unit. This macro should be used within a header file to
+// declare usage of the flag within any .cc file including that header file.
+//
+// The ABSL_DECLARE_FLAG(type, name) macro expands to:
+//
+//   extern absl::Flag<type> FLAGS_name;
+#define ABSL_DECLARE_FLAG(type, name) extern ::absl::Flag<type> FLAGS_##name
+
+#endif  // ABSL_FLAGS_DECLARE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/flag.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/flag.h
new file mode 100644 (file)
index 0000000..193755e
--- /dev/null
@@ -0,0 +1,281 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: flag.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the `absl::Flag<T>` type for holding command-line
+// flag data, and abstractions to create, get and set such flag data.
+//
+// It is important to note that this type is **unspecified** (an implementation
+// detail) and you do not construct or manipulate actual `absl::Flag<T>`
+// instances. Instead, you define and declare flags using the
+// `ABSL_FLAG()` and `ABSL_DECLARE_FLAG()` macros, and get and set flag values
+// using the `absl::GetFlag()` and `absl::SetFlag()` functions.
+
+#ifndef ABSL_FLAGS_FLAG_H_
+#define ABSL_FLAGS_FLAG_H_
+
+#include "absl/base/attributes.h"
+#include "absl/base/casts.h"
+#include "absl/flags/config.h"
+#include "absl/flags/declare.h"
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/flags/internal/flag.h"
+#include "absl/flags/marshalling.h"
+
+namespace absl {
+
+// Flag
+//
+// An `absl::Flag` holds a command-line flag value, providing a runtime
+// parameter to a binary. Such flags should be defined in the global namespace
+// and (preferably) in the module containing the binary's `main()` function.
+//
+// You should not construct and cannot use the `absl::Flag` type directly;
+// instead, you should declare flags using the `ABSL_DECLARE_FLAG()` macro
+// within a header file, and define your flag using `ABSL_FLAG()` within your
+// header's associated `.cc` file. Such flags will be named `FLAGS_name`.
+//
+// Example:
+//
+//    .h file
+//
+//      // Declares usage of a flag named "FLAGS_count"
+//      ABSL_DECLARE_FLAG(int, count);
+//
+//    .cc file
+//
+//      // Defines a flag named "FLAGS_count" with a default `int` value of 0.
+//      ABSL_FLAG(int, count, 0, "Count of items to process");
+//
+// No public methods of `absl::Flag<T>` are part of the Abseil Flags API.
+template <typename T>
+using Flag = flags_internal::Flag<T>;
+
+// GetFlag()
+//
+// Returns the value (of type `T`) of an `absl::Flag<T>` instance, by value. Do
+// not construct an `absl::Flag<T>` directly and call `absl::GetFlag()`;
+// instead, refer to flag's constructed variable name (e.g. `FLAGS_name`).
+// Because this function returns by value and not by reference, it is
+// thread-safe, but note that the operation may be expensive; as a result, avoid
+// `absl::GetFlag()` within any tight loops.
+//
+// Example:
+//
+//   // FLAGS_count is a Flag of type `int`
+//   int my_count = absl::GetFlag(FLAGS_count);
+//
+//   // FLAGS_firstname is a Flag of type `std::string`
+//   std::string first_name = absl::GetFlag(FLAGS_firstname);
+template <typename T>
+T GetFlag(const absl::Flag<T>& flag) {
+#define ABSL_FLAGS_INTERNAL_LOCK_FREE_VALIDATE(BIT) \
+  static_assert(                                    \
+      !std::is_same<T, BIT>::value,                 \
+      "Do not specify explicit template parameters to absl::GetFlag");
+  ABSL_FLAGS_INTERNAL_FOR_EACH_LOCK_FREE(ABSL_FLAGS_INTERNAL_LOCK_FREE_VALIDATE)
+#undef ABSL_FLAGS_INTERNAL_LOCK_FREE_VALIDATE
+
+  // Implementation notes:
+  //
+  // We are wrapping a union around the value of `T` to serve three purposes:
+  //
+  //  1. `U.value` has correct size and alignment for a value of type `T`
+  //  2. The `U.value` constructor is not invoked since U's constructor does not
+  //     do it explicitly.
+  //  3. The `U.value` destructor is invoked since U's destructor does it
+  //     explicitly. This makes `U` a kind of RAII wrapper around non default
+  //     constructible value of T, which is destructed when we leave the scope.
+  //     We do need to destroy U.value, which is constructed by
+  //     CommandLineFlag::Read even though we left it in a moved-from state
+  //     after std::move.
+  //
+  // All of this serves to avoid requiring `T` being default constructible.
+  union U {
+    T value;
+    U() {}
+    ~U() { value.~T(); }
+  };
+  U u;
+
+  flag.internal.Read(&u.value, &flags_internal::FlagOps<T>);
+  return std::move(u.value);
+}
+
+// Overload for `GetFlag()` for types that support lock-free reads.
+#define ABSL_FLAGS_INTERNAL_LOCK_FREE_EXPORT(T) \
+  extern T GetFlag(const absl::Flag<T>& flag);
+ABSL_FLAGS_INTERNAL_FOR_EACH_LOCK_FREE(ABSL_FLAGS_INTERNAL_LOCK_FREE_EXPORT)
+#undef ABSL_FLAGS_INTERNAL_LOCK_FREE_EXPORT
+
+// SetFlag()
+//
+// Sets the value of an `absl::Flag` to the value `v`. Do not construct an
+// `absl::Flag<T>` directly and call `absl::SetFlag()`; instead, use the
+// flag's variable name (e.g. `FLAGS_name`). This function is
+// thread-safe, but is potentially expensive. Avoid setting flags in general,
+// but especially within performance-critical code.
+template <typename T>
+void SetFlag(absl::Flag<T>* flag, const T& v) {
+  flag->internal.Write(&v, &flags_internal::FlagOps<T>);
+}
+
+// Overload of `SetFlag()` to allow callers to pass in a value that is
+// convertible to `T`. E.g., use this overload to pass a "const char*" when `T`
+// is `std::string`.
+template <typename T, typename V>
+void SetFlag(absl::Flag<T>* flag, const V& v) {
+  T value(v);
+  SetFlag<T>(flag, value);
+}
+
+}  // namespace absl
+
+
+// ABSL_FLAG()
+//
+// This macro defines an `absl::Flag<T>` instance of a specified type `T`:
+//
+//   ABSL_FLAG(T, name, default_value, help);
+//
+// where:
+//
+//   * `T` is a supported flag type (see the list of types in `marshalling.h`),
+//   * `name` designates the name of the flag (as a global variable
+//     `FLAGS_name`),
+//   * `default_value` is an expression holding the default value for this flag
+//     (which must be implicitly convertible to `T`),
+//   * `help` is the help text, which can also be an expression.
+//
+// This macro expands to a flag named 'FLAGS_name' of type 'T':
+//
+//   absl::Flag<T> FLAGS_name = ...;
+//
+// Note that all such instances are created as global variables.
+//
+// For `ABSL_FLAG()` values that you wish to expose to other translation units,
+// it is recommended to define those flags within the `.cc` file associated with
+// the header where the flag is declared.
+//
+// Note: do not construct objects of type `absl::Flag<T>` directly. Only use the
+// `ABSL_FLAG()` macro for such construction.
+#define ABSL_FLAG(Type, name, default_value, help) \
+  ABSL_FLAG_IMPL(Type, name, default_value, help)
+
+// ABSL_FLAG().OnUpdate()
+//
+// Defines a flag of type `T` with a callback attached:
+//
+//   ABSL_FLAG(T, name, default_value, help).OnUpdate(callback);
+//
+// After any setting of the flag value, the callback will be called at least
+// once. A rapid sequence of changes may be merged together into the same
+// callback. No concurrent calls to the callback will be made for the same
+// flag. Callbacks are allowed to read the current value of the flag but must
+// not mutate that flag.
+//
+// The update mechanism guarantees "eventual consistency"; if the callback
+// derives an auxiliary data structure from the flag value, it is guaranteed
+// that eventually the flag value and the derived data structure will be
+// consistent.
+//
+// Note: ABSL_FLAG.OnUpdate() does not have a public definition. Hence, this
+// comment serves as its API documentation.
+
+
+// -----------------------------------------------------------------------------
+// Implementation details below this section
+// -----------------------------------------------------------------------------
+
+// ABSL_FLAG_IMPL macro definition conditional on ABSL_FLAGS_STRIP_NAMES
+
+#if ABSL_FLAGS_STRIP_NAMES
+#define ABSL_FLAG_IMPL_FLAGNAME(txt) ""
+#define ABSL_FLAG_IMPL_FILENAME() ""
+#define ABSL_FLAG_IMPL_REGISTRAR(T, flag) \
+  absl::flags_internal::FlagRegistrar<T, false>(&flag)
+#else
+#define ABSL_FLAG_IMPL_FLAGNAME(txt) txt
+#define ABSL_FLAG_IMPL_FILENAME() __FILE__
+#define ABSL_FLAG_IMPL_REGISTRAR(T, flag) \
+  absl::flags_internal::FlagRegistrar<T, true>(&flag)
+#endif
+
+// ABSL_FLAG_IMPL macro definition conditional on ABSL_FLAGS_STRIP_HELP
+
+#if ABSL_FLAGS_STRIP_HELP
+#define ABSL_FLAG_IMPL_FLAGHELP(txt) absl::flags_internal::kStrippedFlagHelp
+#else
+#define ABSL_FLAG_IMPL_FLAGHELP(txt) txt
+#endif
+
+#define ABSL_FLAG_IMPL_DECLARE_HELP_WRAPPER(name, txt) \
+  static std::string AbslFlagsWrapHelp##name() {       \
+    return ABSL_FLAG_IMPL_FLAGHELP(txt);               \
+  }
+
+#define ABSL_FLAG_IMPL_DECLARE_DEF_VAL_WRAPPER(name, Type, default_value)   \
+  static void* AbslFlagsInitFlag##name() {                                  \
+    return absl::flags_internal::MakeFromDefaultValue<Type>(default_value); \
+  }
+
+// ABSL_FLAG_IMPL
+//
+// Note: Name of registrar object is not arbitrary. It is used to "grab"
+// global name for FLAGS_no<flag_name> symbol, thus preventing the possibility
+// of defining two flags with names foo and nofoo.
+#define ABSL_FLAG_IMPL(Type, name, default_value, help)                   \
+  namespace absl {}                                                       \
+  ABSL_FLAG_IMPL_DECLARE_DEF_VAL_WRAPPER(name, Type, default_value)       \
+  ABSL_FLAG_IMPL_DECLARE_HELP_WRAPPER(name, help)                         \
+  absl::Flag<Type> FLAGS_##name(                                          \
+      ABSL_FLAG_IMPL_FLAGNAME(#name),                                     \
+      &AbslFlagsWrapHelp##name,                                           \
+      ABSL_FLAG_IMPL_FILENAME(),                                          \
+      &absl::flags_internal::FlagMarshallingOps<Type>,                    \
+      &AbslFlagsInitFlag##name);                                          \
+  extern bool FLAGS_no##name;                                             \
+  bool FLAGS_no##name = ABSL_FLAG_IMPL_REGISTRAR(Type, FLAGS_##name)
+
+// ABSL_RETIRED_FLAG
+//
+// Designates the flag (which is usually pre-existing) as "retired." A retired
+// flag is a flag that is now unused by the program, but may still be passed on
+// the command line, usually by production scripts. A retired flag is ignored
+// and code can't access it at runtime.
+//
+// This macro registers a retired flag with given name and type, with a name
+// identical to the name of the original flag you are retiring. The retired
+// flag's type can change over time, so that you can retire code to support a
+// custom flag type.
+//
+// This macro has the same signature as `ABSL_FLAG`. To retire a flag, simply
+// replace an `ABSL_FLAG` definition with `ABSL_RETIRED_FLAG`, leaving the
+// arguments unchanged (unless of course you actually want to retire the flag
+// type at this time as well).
+//
+// `default_value` is only used as a double check on the type. `explanation` is
+// unused.
+// TODO(rogeeff): Return an anonymous struct instead of bool, and place it into
+// the unnamed namespace.
+#define ABSL_RETIRED_FLAG(type, flagname, default_value, explanation) \
+  ABSL_ATTRIBUTE_UNUSED static const bool ignored_##flagname =        \
+      ([] { return type(default_value); },                            \
+       absl::flags_internal::RetiredFlag<type>(#flagname))
+
+#endif  // ABSL_FLAGS_FLAG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h
new file mode 100644 (file)
index 0000000..4815cdc
--- /dev/null
@@ -0,0 +1,365 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
+#define ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
+
+#include <atomic>
+
+#include "absl/base/macros.h"
+#include "absl/flags/marshalling.h"
+#include "absl/synchronization/mutex.h"
+#include "absl/types/optional.h"
+
+namespace absl {
+namespace flags_internal {
+
+// Type-specific operations, eg., parsing, copying, etc. are provided
+// by function specific to that type with a signature matching FlagOpFn.
+enum FlagOp {
+  kDelete,
+  kClone,
+  kCopy,
+  kCopyConstruct,
+  kSizeof,
+  kParse,
+  kUnparse
+};
+using FlagOpFn = void* (*)(FlagOp, const void*, void*);
+using FlagMarshallingOpFn = void* (*)(FlagOp, const void*, void*, void*);
+
+// Options that control SetCommandLineOptionWithMode.
+enum FlagSettingMode {
+  // update the flag's value unconditionally (can call this multiple times).
+  SET_FLAGS_VALUE,
+  // update the flag's value, but *only if* it has not yet been updated
+  // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef".
+  SET_FLAG_IF_DEFAULT,
+  // set the flag's default value to this.  If the flag has not been updated
+  // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef")
+  // change the flag's current value to the new default value as well.
+  SET_FLAGS_DEFAULT
+};
+
+// Options that control SetFromString: Source of a value.
+enum ValueSource {
+  // Flag is being set by value specified on a command line.
+  kCommandLine,
+  // Flag is being set by value specified in the code.
+  kProgrammaticChange,
+};
+
+// Signature for the help generation function used as an argument for the
+// absl::Flag constructor.
+using HelpGenFunc = std::string (*)();
+
+// Signature for the function generating the initial flag value based (usually
+// based on default value supplied in flag's definition)
+using InitialValGenFunc = void* (*)();
+
+// Signature for the mutation callback used by watched Flags
+// The callback is noexcept.
+// TODO(rogeeff): add noexcept after C++17 support is added.
+using FlagCallback = void (*)();
+
+extern const char kStrippedFlagHelp[];
+
+// The per-type function
+template <typename T>
+void* FlagOps(FlagOp op, const void* v1, void* v2) {
+  switch (op) {
+    case kDelete:
+      delete static_cast<const T*>(v1);
+      return nullptr;
+    case kClone:
+      return new T(*static_cast<const T*>(v1));
+    case kCopy:
+      *static_cast<T*>(v2) = *static_cast<const T*>(v1);
+      return nullptr;
+    case kCopyConstruct:
+      new (v2) T(*static_cast<const T*>(v1));
+      return nullptr;
+    case kSizeof:
+      return reinterpret_cast<void*>(sizeof(T));
+    default:
+      return nullptr;
+  }
+}
+
+template <typename T>
+void* FlagMarshallingOps(FlagOp op, const void* v1, void* v2, void* v3) {
+  switch (op) {
+    case kParse: {
+      // initialize the temporary instance of type T based on current value in
+      // destination (which is going to be flag's default value).
+      T temp(*static_cast<T*>(v2));
+      if (!absl::ParseFlag<T>(*static_cast<const absl::string_view*>(v1), &temp,
+                              static_cast<std::string*>(v3))) {
+        return nullptr;
+      }
+      *static_cast<T*>(v2) = std::move(temp);
+      return v2;
+    }
+    case kUnparse:
+      *static_cast<std::string*>(v2) =
+          absl::UnparseFlag<T>(*static_cast<const T*>(v1));
+      return nullptr;
+    default:
+      return nullptr;
+  }
+}
+
+// Functions that invoke flag-type-specific operations.
+inline void Delete(FlagOpFn op, const void* obj) {
+  op(flags_internal::kDelete, obj, nullptr);
+}
+
+inline void* Clone(FlagOpFn op, const void* obj) {
+  return op(flags_internal::kClone, obj, nullptr);
+}
+
+inline void Copy(FlagOpFn op, const void* src, void* dst) {
+  op(flags_internal::kCopy, src, dst);
+}
+
+inline void CopyConstruct(FlagOpFn op, const void* src, void* dst) {
+  op(flags_internal::kCopyConstruct, src, dst);
+}
+
+inline bool Parse(FlagMarshallingOpFn op, absl::string_view text, void* dst,
+                  std::string* error) {
+  return op(flags_internal::kParse, &text, dst, error) != nullptr;
+}
+
+inline std::string Unparse(FlagMarshallingOpFn op, const void* val) {
+  std::string result;
+  op(flags_internal::kUnparse, val, &result, nullptr);
+  return result;
+}
+
+inline size_t Sizeof(FlagOpFn op) {
+  // This sequence of casts reverses the sequence from base::internal::FlagOps()
+  return static_cast<size_t>(reinterpret_cast<intptr_t>(
+      op(flags_internal::kSizeof, nullptr, nullptr)));
+}
+
+// The following struct contains the locks in a CommandLineFlag struct.
+// They are in a separate struct that is lazily allocated to avoid problems
+// with static initialization and to avoid multiple allocations.
+struct CommandLineFlagLocks {
+  absl::Mutex primary_mu;   // protects several fields in CommandLineFlag
+  absl::Mutex callback_mu;  // used to serialize callbacks
+};
+
+// Holds either a pointer to help text or a function which produces it.  This is
+// needed for supporting both static initialization of Flags while supporting
+// the legacy registration framework.  We can't use absl::variant<const char*,
+// const char*(*)()> since anybody passing 0 or nullptr in to a CommandLineFlag
+// would find an ambiguity.
+class HelpText {
+ public:
+  static constexpr HelpText FromFunctionPointer(const HelpGenFunc fn) {
+    return HelpText(fn, nullptr);
+  }
+  static constexpr HelpText FromStaticCString(const char* msg) {
+    return HelpText(nullptr, msg);
+  }
+
+  std::string GetHelpText() const;
+
+  HelpText() = delete;
+  HelpText(const HelpText&) = default;
+  HelpText(HelpText&&) = default;
+
+ private:
+  explicit constexpr HelpText(const HelpGenFunc fn, const char* msg)
+      : help_function_(fn), help_message_(msg) {}
+
+  HelpGenFunc help_function_;
+  const char* help_message_;
+};
+
+// Holds all information for a flag.
+struct CommandLineFlag {
+  constexpr CommandLineFlag(
+      const char* name_arg, HelpText help_text, const char* filename_arg,
+      const flags_internal::FlagOpFn op_arg,
+      const flags_internal::FlagMarshallingOpFn marshalling_op_arg,
+      const flags_internal::InitialValGenFunc initial_value_gen,
+      const bool retired_arg, void* def_arg, void* cur_arg)
+      : name(name_arg),
+        help(help_text),
+        filename(filename_arg),
+        op(op_arg),
+        marshalling_op(marshalling_op_arg),
+        make_init_value(initial_value_gen),
+        retired(retired_arg),
+        inited(false),
+        modified(false),
+        on_command_line(false),
+        validator(nullptr),
+        callback(nullptr),
+        def(def_arg),
+        cur(cur_arg),
+        counter(0),
+        atomic(kAtomicInit),
+        locks(nullptr) {}
+
+  // Not copyable/assignable.
+  CommandLineFlag(const CommandLineFlag&) = delete;
+  CommandLineFlag& operator=(const CommandLineFlag&) = delete;
+
+  absl::string_view Name() const { return name; }
+  std::string Help() const { return help.GetHelpText(); }
+  bool IsRetired() const { return this->retired; }
+  bool IsSpecifiedOnCommandLine() const { return on_command_line; }
+  // Returns true iff this is a handle to an Abseil Flag.
+  bool IsAbseilFlag() const {
+    // Set to null for V1 flags
+    return this->make_init_value != nullptr;
+  }
+
+  absl::string_view Typename() const;
+  std::string Filename() const;
+  std::string DefaultValue() const;
+  std::string CurrentValue() const;
+
+  // Return true iff flag has type T.
+  template <typename T>
+  inline bool IsOfType() const {
+    return this->op == &flags_internal::FlagOps<T>;
+  }
+
+  // Attempts to retrieve the flag value. Returns value on success,
+  // absl::nullopt otherwise.
+  template <typename T>
+  absl::optional<T> Get() {
+    if (IsRetired() || flags_internal::FlagOps<T> != this->op)
+      return absl::nullopt;
+
+    T res;
+    Read(&res, flags_internal::FlagOps<T>);
+
+    return res;
+  }
+
+  void SetCallback(const flags_internal::FlagCallback mutation_callback);
+
+  // Sets the value of the flag based on specified std::string `value`. If the flag
+  // was successfully set to new value, it returns true. Otherwise, sets `error`
+  // to indicate the error, leaves the flag unchanged, and returns false. There
+  // are three ways to set the flag's value:
+  //  * Update the current flag value
+  //  * Update the flag's default value
+  //  * Update the current flag value if it was never set before
+  // The mode is selected based on `set_mode` parameter.
+  bool SetFromString(absl::string_view value,
+                     flags_internal::FlagSettingMode set_mode,
+                     flags_internal::ValueSource source, std::string* error);
+
+  // Constant configuration for a particular flag.
+ private:
+  const char* const name;
+  const HelpText help;
+  const char* const filename;
+
+ public:
+  const FlagOpFn op;                  // Type-specific handler
+  const FlagMarshallingOpFn marshalling_op;  // Marshalling ops handler
+  const InitialValGenFunc make_init_value;   // Makes initial value for the flag
+  const bool retired;                 // Is the flag retired?
+  std::atomic<bool> inited;           // fields have been lazily initialized
+
+  // Mutable state (guarded by locks->primary_mu).
+  bool modified;          // Has flag value been modified?
+  bool on_command_line;   // Specified on command line.
+  bool (*validator)();    // Validator function, or nullptr
+  FlagCallback callback;  // Mutation callback, or nullptr
+  void* def;              // Lazily initialized pointer to default value
+  void* cur;              // Lazily initialized pointer to current value
+  int64_t counter;          // Mutation counter
+
+  // For some types, a copy of the current value is kept in an atomically
+  // accessible field.
+  static const int64_t kAtomicInit = 0xababababababababll;
+  std::atomic<int64_t> atomic;
+
+  // Lazily initialized mutexes for this flag value.  We cannot inline a
+  // SpinLock or Mutex here because those have non-constexpr constructors and
+  // so would prevent constant initialization of this type.
+  // TODO(rogeeff): fix it once Mutex has constexpr constructor
+  struct CommandLineFlagLocks* locks;  // locks, laziliy allocated.
+
+  // copy construct new value of flag's type in a memory referenced by dst
+  // based on current flag's value
+  void Read(void* dst, const flags_internal::FlagOpFn dst_op) const;
+  // updates flag's value to *src (locked)
+  void Write(const void* src, const flags_internal::FlagOpFn src_op);
+
+  ABSL_DEPRECATED(
+      "temporary until FlagName call sites are migrated and validator API is "
+      "changed")
+  const char* NameAsCString() const { return name; }
+
+ private:
+  friend class FlagRegistry;
+};
+
+// Ensure that the lazily initialized fields of *flag have been initialized,
+// and return &flag->locks->primary_mu.
+absl::Mutex* InitFlagIfNecessary(CommandLineFlag* flag);
+// Update any copy of the flag value that is stored in an atomic word.
+// In addition if flag has a mutation callback this function invokes it. While
+// callback is being invoked the primary flag's mutex is unlocked and it is
+// re-locked back after call to callback is completed. Callback invocation is
+// guarded by flag's secondary mutex instead which prevents concurrent callback
+// invocation. Note that it is possible for other thread to grab the primary
+// lock and update flag's value at any time during the callback invocation.
+// This is by design. Callback can get a value of the flag if necessary, but it
+// might be different from the value initiated the callback and it also can be
+// different by the time the callback invocation is completed.
+// Requires that *primary_lock be held in exclusive mode; it may be released
+// and reacquired by the implementation.
+void UpdateCopy(CommandLineFlag* flag, absl::Mutex* primary_lock);
+// Return true iff flag value was changed via direct-access.
+bool ChangedDirectly(CommandLineFlag* flag, const void* a, const void* b);
+// Direct-access flags can be modified without going through the
+// flag API.  Detect such changes and updated the modified bit.
+void UpdateModifiedBit(CommandLineFlag* flag);
+// Invoke the flag validators for old flags.
+// TODO(rogeeff): implement proper validators for Abseil Flags
+bool Validate(CommandLineFlag* flag, const void* value);
+
+// This macro is the "source of truth" for the list of supported flag types we
+// expect to perform lock free operations on. Specifically it generates code,
+// a one argument macro operating on a type, supplied as a macro argument, for
+// each type in the list.
+#define ABSL_FLAGS_INTERNAL_FOR_EACH_LOCK_FREE(A) \
+  A(bool)                                         \
+  A(short)                                        \
+  A(unsigned short)                               \
+  A(int)                                          \
+  A(unsigned int)                                 \
+  A(long)                                         \
+  A(unsigned long)                                \
+  A(long long)                                    \
+  A(unsigned long long)                           \
+  A(double)                                       \
+  A(float)
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/flag.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/flag.h
new file mode 100644 (file)
index 0000000..9b32f46
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_FLAG_H_
+#define ABSL_FLAGS_INTERNAL_FLAG_H_
+
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/flags/internal/registry.h"
+
+namespace absl {
+namespace flags_internal {
+
+// This is "unspecified" implementation of absl::Flag<T> type.
+template <typename T>
+class Flag {
+ public:
+  constexpr Flag(const char* name, const flags_internal::HelpGenFunc help_gen,
+                 const char* filename,
+                 const flags_internal::FlagMarshallingOpFn marshalling_op,
+                 const flags_internal::InitialValGenFunc initial_value_gen)
+      : internal(name, flags_internal::HelpText::FromFunctionPointer(help_gen),
+                 filename, &flags_internal::FlagOps<T>, marshalling_op,
+                 initial_value_gen,
+                 /*retired_arg=*/false, /*def_arg=*/nullptr,
+                 /*cur_arg=*/nullptr) {}
+
+  // Not copyable/assignable.
+  Flag(const Flag<T>&) = delete;
+  Flag<T>& operator=(const Flag<T>&) = delete;
+
+  absl::string_view Name() const { return internal.Name(); }
+  std::string Help() const { return internal.Help(); }
+  std::string Filename() const { return internal.Filename(); }
+
+  absl::flags_internal::CommandLineFlag internal;
+
+  void SetCallback(const flags_internal::FlagCallback mutation_callback) {
+    internal.SetCallback(mutation_callback);
+  }
+
+ private:
+  // TODO(rogeeff): add these validations once UnparseFlag invocation is fixed
+  // for built-in types and when we cleanup existing code from operating on
+  // forward declared types.
+  //  auto IsCopyConstructible(const T& v) -> decltype(T(v));
+  //  auto HasAbslParseFlag(absl::string_view in, T* dst, std::string* err)
+  //      -> decltype(AbslParseFlag(in, dst, err));
+  //  auto HasAbslUnparseFlag(const T& v) -> decltype(AbslUnparseFlag(v));
+};
+
+// This class facilitates Flag object registration and tail expression-based
+// flag definition, for example:
+// ABSL_FLAG(int, foo, 42, "Foo help").OnUpdate(NotifyFooWatcher);
+template <typename T, bool do_register>
+class FlagRegistrar {
+ public:
+  explicit FlagRegistrar(Flag<T>* flag) : flag_(flag) {
+    if (do_register) flags_internal::RegisterCommandLineFlag(&flag_->internal);
+  }
+
+  FlagRegistrar& OnUpdate(flags_internal::FlagCallback cb) && {
+    flag_->SetCallback(cb);
+    return *this;
+  }
+
+  // Make the registrar "die" gracefully as a bool on a line where registration
+  // happens. Registrar objects are intended to live only as temporary.
+  operator bool() const { return true; }  // NOLINT
+
+ private:
+  Flag<T>* flag_;  // Flag being registered (not owned).
+};
+
+// This struct and corresponding overload to MakeDefaultValue are used to
+// facilitate usage of {} as default value in ABSL_FLAG macro.
+struct EmptyBraces {};
+
+template <typename T>
+T* MakeFromDefaultValue(T t) {
+  return new T(std::move(t));
+}
+
+template <typename T>
+T* MakeFromDefaultValue(EmptyBraces) {
+  return new T;
+}
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_FLAG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/parse.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/parse.h
new file mode 100644 (file)
index 0000000..fd3aca6
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_PARSE_H_
+#define ABSL_FLAGS_INTERNAL_PARSE_H_
+
+#include <string>
+#include <vector>
+
+#include "absl/flags/declare.h"
+
+ABSL_DECLARE_FLAG(std::vector<std::string>, flagfile);
+ABSL_DECLARE_FLAG(std::vector<std::string>, fromenv);
+ABSL_DECLARE_FLAG(std::vector<std::string>, tryfromenv);
+ABSL_DECLARE_FLAG(std::vector<std::string>, undefok);
+
+namespace absl {
+namespace flags_internal {
+
+enum class ArgvListAction { kRemoveParsedArgs, kKeepParsedArgs };
+enum class UsageFlagsAction { kHandleUsage, kIgnoreUsage };
+enum class OnUndefinedFlag {
+  kIgnoreUndefined,
+  kReportUndefined,
+  kAbortIfUndefined
+};
+
+std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
+                                        ArgvListAction arg_list_act,
+                                        UsageFlagsAction usage_flag_act,
+                                        OnUndefinedFlag on_undef_flag);
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_PARSE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/path_util.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/path_util.h
new file mode 100644 (file)
index 0000000..5615c0e
--- /dev/null
@@ -0,0 +1,60 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_PATH_UTIL_H_
+#define ABSL_FLAGS_INTERNAL_PATH_UTIL_H_
+
+#include "absl/strings/match.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace flags_internal {
+
+// A portable interface that returns the basename of the filename passed as an
+// argument. It is similar to basename(3)
+// <https://linux.die.net/man/3/basename>.
+// For example:
+//     flags_internal::Basename("a/b/prog/file.cc")
+// returns "file.cc"
+//     flags_internal::Basename("file.cc")
+// returns "file.cc"
+inline absl::string_view Basename(absl::string_view filename) {
+  auto last_slash_pos = filename.find_last_of("/\\");
+
+  return last_slash_pos == absl::string_view::npos
+             ? filename
+             : filename.substr(last_slash_pos + 1);
+}
+
+// A portable interface that returns the directory name of the filename
+// passed as an argument, including the trailing slash.
+// Returns the empty string if a slash is not found in the input file name.
+// For example:
+//      flags_internal::Package("a/b/prog/file.cc")
+// returns "a/b/prog/"
+//      flags_internal::Package("file.cc")
+// returns ""
+inline absl::string_view Package(absl::string_view filename) {
+  auto last_slash_pos = filename.find_last_of("/\\");
+
+  return last_slash_pos == absl::string_view::npos
+             ? absl::string_view()
+             : filename.substr(0, last_slash_pos + 1);
+}
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_PATH_UTIL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/program_name.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/program_name.h
new file mode 100644 (file)
index 0000000..326f24b
--- /dev/null
@@ -0,0 +1,47 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_
+#define ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_
+
+#include <string>
+
+#include "absl/strings/string_view.h"
+
+// --------------------------------------------------------------------
+// Program name
+
+namespace absl {
+namespace flags_internal {
+
+// Returns program invocation name or "UNKNOWN" if `SetProgramInvocationName()`
+// is never called. At the moment this is always set to argv[0] as part of
+// library initialization.
+std::string ProgramInvocationName();
+
+// Returns base name for program invocation name. For example, if
+//   ProgramInvocationName() == "a/b/mybinary"
+// then
+//   ShortProgramInvocationName() == "mybinary"
+std::string ShortProgramInvocationName();
+
+// Sets program invocation name to a new value. Should only be called once
+// during program initialization, before any threads are spawned.
+void SetProgramInvocationName(absl::string_view prog_name_str);
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/registry.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/registry.h
new file mode 100644 (file)
index 0000000..bd141e1
--- /dev/null
@@ -0,0 +1,168 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_REGISTRY_H_
+#define ABSL_FLAGS_INTERNAL_REGISTRY_H_
+
+#include <functional>
+#include <map>
+#include <string>
+
+#include "absl/base/macros.h"
+#include "absl/flags/internal/commandlineflag.h"
+
+// --------------------------------------------------------------------
+// Global flags registry API.
+
+namespace absl {
+namespace flags_internal {
+
+// CommandLineFlagInfo holds all information for a flag.
+struct CommandLineFlagInfo {
+  std::string name;           // the name of the flag
+  std::string type;           // DO NOT use. Use flag->IsOfType<T>() instead.
+  std::string description;    // the "help text" associated with the flag
+  std::string current_value;  // the current value, as a std::string
+  std::string default_value;  // the default value, as a std::string
+  std::string filename;       // 'cleaned' version of filename holding the flag
+  bool has_validator_fn;  // true if RegisterFlagValidator called on this flag
+
+  bool is_default;  // true if the flag has the default value and
+                    // has not been set explicitly from the cmdline
+                    // or via SetCommandLineOption.
+
+  // nullptr for ABSL_FLAG.  A pointer to the flag's current value
+  // otherwise.  E.g., for DEFINE_int32(foo, ...), flag_ptr will be
+  // &FLAGS_foo.
+  const void* flag_ptr;
+};
+
+//-----------------------------------------------------------------------------
+
+void FillCommandLineFlagInfo(CommandLineFlag* flag,
+                             CommandLineFlagInfo* result);
+
+//-----------------------------------------------------------------------------
+
+CommandLineFlag* FindCommandLineFlag(absl::string_view name);
+CommandLineFlag* FindCommandLineV1Flag(const void* flag_ptr);
+CommandLineFlag* FindRetiredFlag(absl::string_view name);
+
+// Executes specified visitor for each non-retired flag in the registry.
+// Requires the caller hold the registry lock.
+void ForEachFlagUnlocked(std::function<void(CommandLineFlag*)> visitor);
+// Executes specified visitor for each non-retired flag in the registry. While
+// callback are executed, the registry is locked and can't be changed.
+void ForEachFlag(std::function<void(CommandLineFlag*)> visitor);
+
+//-----------------------------------------------------------------------------
+
+// Store the list of all flags in *OUTPUT, sorted by file.
+void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
+
+//-----------------------------------------------------------------------------
+
+bool RegisterCommandLineFlag(CommandLineFlag*, const void* ptr = nullptr);
+
+//-----------------------------------------------------------------------------
+// Retired registrations:
+//
+// Retired flag registrations are treated specially. A 'retired' flag is
+// provided only for compatibility with automated invocations that still
+// name it.  A 'retired' flag:
+//   - is not bound to a C++ FLAGS_ reference.
+//   - has a type and a value, but that value is intentionally inaccessible.
+//   - does not appear in --help messages.
+//   - is fully supported by _all_ flag parsing routines.
+//   - consumes args normally, and complains about type mismatches in its
+//     argument.
+//   - emits a complaint but does not die (e.g. LOG(ERROR)) if it is
+//     accessed by name through the flags API for parsing or otherwise.
+//
+// The registrations for a flag happen in an unspecified order as the
+// initializers for the namespace-scope objects of a program are run.
+// Any number of weak registrations for a flag can weakly define the flag.
+// One non-weak registration will upgrade the flag from weak to non-weak.
+// Further weak registrations of a non-weak flag are ignored.
+//
+// This mechanism is designed to support moving dead flags into a
+// 'graveyard' library.  An example migration:
+//
+//   0: Remove references to this FLAGS_flagname in the C++ codebase.
+//   1: Register as 'retired' in old_lib.
+//   2: Make old_lib depend on graveyard.
+//   3: Add a redundant 'retired' registration to graveyard.
+//   4: Remove the old_lib 'retired' registration.
+//   5: Eventually delete the graveyard registration entirely.
+//
+// Returns bool to enable use in namespace-scope initializers.
+// For example:
+//
+//   static const bool dummy = base::RetiredFlag<int32_t>("myflag");
+//
+// Or to declare several at once:
+//
+//   static bool dummies[] = {
+//       base::RetiredFlag<std::string>("some_string_flag"),
+//       base::RetiredFlag<double>("some_double_flag"),
+//       base::RetiredFlag<int32_t>("some_int32_flag")
+//   };
+
+// Retire flag with name "name" and type indicated by ops.
+bool Retire(FlagOpFn ops, FlagMarshallingOpFn marshalling_ops,
+            const char* name);
+
+// Registered a retired flag with name 'flag_name' and type 'T'.
+template <typename T>
+inline bool RetiredFlag(const char* flag_name) {
+  return flags_internal::Retire(flags_internal::FlagOps<T>,
+                                flags_internal::FlagMarshallingOps<T>,
+                                flag_name);
+}
+
+// If the flag is retired, returns true and indicates in |*type_is_bool|
+// whether the type of the retired flag is a bool.
+// Only to be called by code that needs to explicitly ignore retired flags.
+bool IsRetiredFlag(absl::string_view name, bool* type_is_bool);
+
+//-----------------------------------------------------------------------------
+// Saves the states (value, default value, whether the user has set
+// the flag, registered validators, etc) of all flags, and restores
+// them when the FlagSaver is destroyed.
+//
+// This class is thread-safe.  However, its destructor writes to
+// exactly the set of flags that have changed value during its
+// lifetime, so concurrent _direct_ access to those flags
+// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe.
+
+class FlagSaver {
+ public:
+  FlagSaver();
+  ~FlagSaver();
+
+  FlagSaver(const FlagSaver&) = delete;
+  void operator=(const FlagSaver&) = delete;
+
+  // Prevents saver from restoring the saved state of flags.
+  void Ignore();
+
+ private:
+  class FlagSaverImpl* impl_;  // we use pimpl here to keep API steady
+};
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_REGISTRY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/type_erased.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/type_erased.h
new file mode 100644 (file)
index 0000000..249d36b
--- /dev/null
@@ -0,0 +1,97 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_TYPE_ERASED_H_
+#define ABSL_FLAGS_INTERNAL_TYPE_ERASED_H_
+
+#include <string>
+
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/flags/internal/registry.h"
+
+// --------------------------------------------------------------------
+// Registry interfaces operating on type erased handles.
+
+namespace absl {
+namespace flags_internal {
+
+// If a flag named "name" exists, store its current value in *OUTPUT
+// and return true.  Else return false without changing *OUTPUT.
+// Thread-safe.
+bool GetCommandLineOption(absl::string_view name, std::string* value);
+
+// If a flag named "name" exists, store its information in *OUTPUT
+// and return true.  Else return false without changing *OUTPUT.
+// Thread-safe.
+bool GetCommandLineFlagInfo(absl::string_view name,
+                            CommandLineFlagInfo* OUTPUT);
+
+// Returns the CommandLineFlagInfo of the flagname.  exit() with an
+// error code if name not found.
+// Thread-safe.
+CommandLineFlagInfo GetCommandLineFlagInfoOrDie(absl::string_view name);
+
+// Set the value of the flag named "name" to value.  If successful,
+// returns true.  If not successful (e.g., the flag was not found or
+// the value is not a valid value), returns false.
+// Thread-safe.
+bool SetCommandLineOption(absl::string_view name, absl::string_view value);
+
+bool SetCommandLineOptionWithMode(absl::string_view name,
+                                  absl::string_view value,
+                                  FlagSettingMode set_mode);
+
+//-----------------------------------------------------------------------------
+
+// Returns true iff all of the following conditions are true:
+// (a) "name" names a registered flag
+// (b) "value" can be parsed succesfully according to the type of the flag
+// (c) parsed value passes any validator associated with the flag
+bool IsValidFlagValue(absl::string_view name, absl::string_view value);
+
+//-----------------------------------------------------------------------------
+
+// Returns true iff a flag named "name" was specified on the command line
+// (either directly, or via one of --flagfile or --fromenv or --tryfromenv).
+//
+// Any non-command-line modification of the flag does not affect the
+// result of this function.  So for example, if a flag was passed on
+// the command line but then reset via SET_FLAGS_DEFAULT, this
+// function will still return true.
+bool SpecifiedOnCommandLine(absl::string_view name);
+
+//-----------------------------------------------------------------------------
+
+// If a flag with specified "name" exists and has type T, store
+// its current value in *dst and return true.  Else return false
+// without touching *dst.  T must obey all of the requirements for
+// types passed to DEFINE_FLAG.
+template <typename T>
+inline bool GetByName(absl::string_view name, T* dst) {
+  CommandLineFlag* flag = flags_internal::FindCommandLineFlag(name);
+  if (!flag) return false;
+
+  if (auto val = flag->Get<T>()) {
+    *dst = *val;
+    return true;
+  }
+
+  return false;
+}
+
+}  // namespace flags_internal
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_INTERNAL_TYPE_ERASED_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/usage.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/internal/usage.h
new file mode 100644 (file)
index 0000000..33f3f96
--- /dev/null
@@ -0,0 +1,77 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_USAGE_H_
+#define ABSL_FLAGS_INTERNAL_USAGE_H_
+
+#include <iosfwd>
+#include <string>
+
+#include "absl/flags/declare.h"
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/strings/string_view.h"
+
+// --------------------------------------------------------------------
+// Usage reporting interfaces
+
+namespace absl {
+namespace flags_internal {
+
+// The format to report the help messages in.
+enum class HelpFormat {
+  kHumanReadable,
+};
+
+// Outputs the help message describing specific flag.
+void FlagHelp(std::ostream& out, const flags_internal::CommandLineFlag& flag,
+              HelpFormat format = HelpFormat::kHumanReadable);
+
+// Produces the help messages for all flags matching the filter. A flag matches
+// the filter if it is defined in a file with a filename which includes
+// filter string as a substring. You can use '/' and '.' to restrict the
+// matching to a specific file names. For example:
+//   FlagsHelp(out, "/path/to/file.");
+// restricts help to only flags which resides in files named like:
+//  .../path/to/file.<ext>
+// for any extension 'ext'. If the filter is empty this function produces help
+// messages for all flags.
+void FlagsHelp(std::ostream& out, absl::string_view filter = {},
+               HelpFormat format = HelpFormat::kHumanReadable);
+
+// --------------------------------------------------------------------
+
+// If any of the 'usage' related command line flags (listed on the bottom of
+// this file) has been set this routine produces corresponding help message in
+// the specified output stream and returns:
+//  0 - if "version" or "only_check_flags" flags were set and handled.
+//  1 - if some other 'usage' related flag was set and handled.
+// -1 - if no usage flags were set on a commmand line.
+// Non negative return values are expected to be used as an exit code for a
+// binary.
+int HandleUsageFlags(std::ostream& out);
+
+}  // namespace flags_internal
+}  // namespace absl
+
+ABSL_DECLARE_FLAG(bool, help);
+ABSL_DECLARE_FLAG(bool, helpfull);
+ABSL_DECLARE_FLAG(bool, helpshort);
+ABSL_DECLARE_FLAG(bool, helppackage);
+ABSL_DECLARE_FLAG(bool, version);
+ABSL_DECLARE_FLAG(bool, only_check_args);
+ABSL_DECLARE_FLAG(std::string, helpon);
+ABSL_DECLARE_FLAG(std::string, helpmatch);
+
+#endif  // ABSL_FLAGS_INTERNAL_USAGE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/marshalling.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/marshalling.h
new file mode 100644 (file)
index 0000000..f9e2959
--- /dev/null
@@ -0,0 +1,253 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: marshalling.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the API for extending Abseil flag support to
+// custom types, and defines the set of overloads for fundamental types.
+//
+// Out of the box, the Abseil flags library supports the following types:
+//
+// * `bool`
+// * `int16_t`
+// * `uint16_t`
+// * `int32_t`
+// * `uint32_t`
+// * `int64_t`
+// * `uint64_t`
+// * `float`
+// * `double`
+// * `std::string`
+// * `std::vector<std::string>`
+//
+// Note that support for integral types is implemented using overloads for
+// variable-width fundamental types (`short`, `int`, `long`, etc.). However,
+// you should prefer the fixed-width integral types (`int32_t`, `uint64_t`,
+// etc.) we've noted above within flag definitions.
+
+//
+// In addition, several Abseil libraries provide their own custom support for
+// Abseil flags.
+//
+// The Abseil time library provides the following support for civil time values:
+//
+// * `absl::CivilSecond`
+// * `absl::CivilMinute`
+// * `absl::CivilHour`
+// * `absl::CivilDay`
+// * `absl::CivilMonth`
+// * `absl::CivilYear`
+//
+// and also provides support for the following absolute time values:
+//
+// * `absl::Duration`
+// * `absl::Time`
+//
+// Additional support for Abseil types will be noted here as it is added.
+//
+// You can also provide your own custom flags by adding overloads for
+// `AbslParseFlag()` and `AbslUnparseFlag()` to your type definitions. (See
+// below.)
+//
+// -----------------------------------------------------------------------------
+// Adding Type Support for Abseil Flags
+// -----------------------------------------------------------------------------
+//
+// To add support for your user-defined type, add overloads of `AbslParseFlag()`
+// and `AbslUnparseFlag()` as free (non-member) functions to your type. If `T`
+// is a class type, these functions can be friend function definitions. These
+// overloads must be added to the same namespace where the type is defined, so
+// that they can be discovered by Argument-Dependent Lookup (ADL).
+//
+// Example:
+//
+//   namespace foo {
+//
+//   enum OutputMode { kPlainText, kHtml };
+//
+//   // AbslParseFlag converts from a string to OutputMode.
+//   // Must be in same namespace as OutputMode.
+//
+//   // Parses an OutputMode from the command line flag value `text. Returns
+//   // `true` and sets `*mode` on success; returns `false` and sets `*error`
+//   // on failure.
+//   bool AbslParseFlag(absl::string_view text,
+//                      OutputMode* mode,
+//                      std::string* error) {
+//     if (text == "plaintext") {
+//       *mode = kPlainText;
+//       return true;
+//     }
+//     if (text == "html") {
+//       *mode = kHtml;
+//      return true;
+//     }
+//     *error = "unknown value for enumeration";
+//     return false;
+//  }
+//
+//  // AbslUnparseFlag converts from an OutputMode to a string.
+//  // Must be in same namespace as OutputMode.
+//
+//  // Returns a textual flag value corresponding to the OutputMode `mode`.
+//  std::string AbslUnparseFlag(OutputMode mode) {
+//    switch (mode) {
+//      case kPlainText: return "plaintext";
+//      case kHtml: return "html";
+//    }
+//    return absl::StrCat(mode);
+//  }
+//
+// Notice that neither `AbslParseFlag()` nor `AbslUnparseFlag()` are class
+// members, but free functions. `AbslParseFlag/AbslUnparseFlag()` overloads
+// for a type should only be declared in the same file and namespace as said
+// type. The proper `AbslParseFlag/AbslUnparseFlag()` implementations for a
+// given type will be discovered via Argument-Dependent Lookup (ADL).
+//
+// `AbslParseFlag()` may need, in turn, to parse simpler constituent types
+// using `absl::ParseFlag()`. For example, a custom struct `MyFlagType`
+// consisting of a `std::pair<int, std::string>` would add an `AbslParseFlag()`
+// overload for its `MyFlagType` like so:
+//
+// Example:
+//
+//   namespace my_flag_type {
+//
+//   struct MyFlagType {
+//     std::pair<int, std::string> my_flag_data;
+//   };
+//
+//   bool AbslParseFlag(absl::string_view text, MyFlagType* flag,
+//                      std::string* err);
+//
+//   std::string AbslUnparseFlag(const MyFlagType&);
+//
+//   // Within the implementation, `AbslParseFlag()` will, in turn invoke
+//   // `absl::ParseFlag()` on its constituent `int` and `std::string` types
+//   // (which have built-in Abseil flag support.
+//
+//   bool AbslParseFlag(absl::string_view text, MyFlagType* flag,
+//                      std::string* err) {
+//     std::pair<absl::string_view, absl::string_view> tokens =
+//         absl::StrSplit(text, ',');
+//     if (!absl::ParseFlag(tokens.first, &flag->my_flag_data.first, err))
+//         return false;
+//     if (!absl::ParseFlag(tokens.second, &flag->my_flag_data.second, err))
+//         return false;
+//     return true;
+//   }
+//
+//   // Similarly, for unparsing, we can simply invoke `absl::UnparseFlag()` on
+//   // the constituent types.
+//   std::string AbslUnparseFlag(const MyFlagType& flag) {
+//     return absl::StrCat(absl::UnparseFlag(flag.my_flag_data.first),
+//                         ",",
+//                         absl::UnparseFlag(flag.my_flag_data.second));
+//   }
+#ifndef ABSL_FLAGS_MARSHALLING_H_
+#define ABSL_FLAGS_MARSHALLING_H_
+
+#include <string>
+#include <vector>
+
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace flags_internal {
+
+// Overloads of `AbslParseFlag()` and `AbslUnparseFlag()` for fundamental types.
+bool AbslParseFlag(absl::string_view, bool*, std::string*);
+bool AbslParseFlag(absl::string_view, short*, std::string*);           // NOLINT
+bool AbslParseFlag(absl::string_view, unsigned short*, std::string*);  // NOLINT
+bool AbslParseFlag(absl::string_view, int*, std::string*);             // NOLINT
+bool AbslParseFlag(absl::string_view, unsigned int*, std::string*);    // NOLINT
+bool AbslParseFlag(absl::string_view, long*, std::string*);            // NOLINT
+bool AbslParseFlag(absl::string_view, unsigned long*, std::string*);   // NOLINT
+bool AbslParseFlag(absl::string_view, long long*, std::string*);       // NOLINT
+bool AbslParseFlag(absl::string_view, unsigned long long*,
+                   std::string*);  // NOLINT
+bool AbslParseFlag(absl::string_view, float*, std::string*);
+bool AbslParseFlag(absl::string_view, double*, std::string*);
+bool AbslParseFlag(absl::string_view, std::string*, std::string*);
+bool AbslParseFlag(absl::string_view, std::vector<std::string>*, std::string*);
+
+template <typename T>
+bool InvokeParseFlag(absl::string_view input, T* dst, std::string* err) {
+  // Comment on next line provides a good compiler error message if T
+  // does not have AbslParseFlag(absl::string_view, T*, std::string*).
+  return AbslParseFlag(input, dst, err);  // Is T missing AbslParseFlag?
+}
+
+// Strings and std:: containers do not have the same overload resolution
+// considerations as fundamental types. Naming these 'AbslUnparseFlag' means we
+// can avoid the need for additional specializations of Unparse (below).
+std::string AbslUnparseFlag(absl::string_view v);
+std::string AbslUnparseFlag(const std::vector<std::string>&);
+
+template <typename T>
+std::string Unparse(const T& v) {
+  // Comment on next line provides a good compiler error message if T does not
+  // have UnparseFlag.
+  return AbslUnparseFlag(v);  // Is T missing AbslUnparseFlag?
+}
+
+// Overloads for builtin types.
+std::string Unparse(bool v);
+std::string Unparse(short v);               // NOLINT
+std::string Unparse(unsigned short v);      // NOLINT
+std::string Unparse(int v);                 // NOLINT
+std::string Unparse(unsigned int v);        // NOLINT
+std::string Unparse(long v);                // NOLINT
+std::string Unparse(unsigned long v);       // NOLINT
+std::string Unparse(long long v);           // NOLINT
+std::string Unparse(unsigned long long v);  // NOLINT
+std::string Unparse(float v);
+std::string Unparse(double v);
+
+}  // namespace flags_internal
+
+// ParseFlag()
+//
+// Parses a string value into a flag value of type `T`. Do not add overloads of
+// this function for your type directly; instead, add an `AbslParseFlag()`
+// free function as documented above.
+//
+// Some implementations of `AbslParseFlag()` for types which consist of other,
+// constituent types which already have Abseil flag support, may need to call
+// `absl::ParseFlag()` on those consituent string values. (See above.)
+template <typename T>
+inline bool ParseFlag(absl::string_view input, T* dst, std::string* error) {
+  return flags_internal::InvokeParseFlag(input, dst, error);
+}
+
+// UnparseFlag()
+//
+// Unparses a flag value of type `T` into a string value. Do not add overloads
+// of this function for your type directly; instead, add an `AbslUnparseFlag()`
+// free function as documented above.
+//
+// Some implementations of `AbslUnparseFlag()` for types which consist of other,
+// constituent types which already have Abseil flag support, may want to call
+// `absl::UnparseFlag()` on those constituent types. (See above.)
+template <typename T>
+inline std::string UnparseFlag(const T& v) {
+  return flags_internal::Unparse(v);
+}
+
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_MARSHALLING_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/parse.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/parse.h
new file mode 100644 (file)
index 0000000..dbb7510
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: parse.h
+// -----------------------------------------------------------------------------
+//
+// This file defines the main parsing function for Abseil flags:
+// `absl::ParseCommandLine()`.
+
+#ifndef ABSL_FLAGS_PARSE_H_
+#define ABSL_FLAGS_PARSE_H_
+
+#include <string>
+#include <vector>
+
+#include "absl/flags/internal/parse.h"
+
+namespace absl {
+
+// ParseCommandLine()
+//
+// Parses the set of command-line arguments passed in the `argc` (argument
+// count) and `argv[]` (argument vector) parameters from `main()`, assigning
+// values to any defined Abseil flags. (Any arguments passed after the
+// flag-terminating delimiter (`--`) are treated as positional arguments and
+// ignored.)
+//
+// Any command-line flags (and arguments to those flags) are parsed into Abseil
+// Flag values, if those flags are defined. Any undefined flags will either
+// return an error, or be ignored if that flag is designated using `undefok` to
+// indicate "undefined is OK."
+//
+// Any command-line positional arguments not part of any command-line flag (or
+// arguments to a flag) are returned in a vector, with the program invocation
+// name at position 0 of that vector. (Note that this includes positional
+// arguments after the flag-terminating delimiter `--`.)
+//
+// After all flags and flag arguments are parsed, this function looks for any
+// built-in usage flags (e.g. `--help`), and if any were specified, it reports
+// help messages and then exits the program.
+std::vector<char*> ParseCommandLine(int argc, char* argv[]);
+
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_PARSE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/usage.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/usage.h
new file mode 100644 (file)
index 0000000..3a12107
--- /dev/null
@@ -0,0 +1,40 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_USAGE_H_
+#define ABSL_FLAGS_USAGE_H_
+
+#include "absl/strings/string_view.h"
+
+// --------------------------------------------------------------------
+// Usage reporting interfaces
+
+namespace absl {
+
+// Sets the "usage" message to be used by help reporting routines.
+// For example:
+//  absl::SetProgramUsageMessage(
+//      absl::StrCat("This program does nothing.  Sample usage:\n", argv[0],
+//                   " <uselessarg1> <uselessarg2>"));
+// Do not include commandline flags in the usage: we do that for you!
+// Note: Calling SetProgramUsageMessage twice will trigger a call to std::exit.
+void SetProgramUsageMessage(absl::string_view new_usage_message);
+
+// Returns the usage message set by SetProgramUsageMessage().
+absl::string_view ProgramUsageMessage();
+
+}  // namespace absl
+
+#endif  // ABSL_FLAGS_USAGE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/usage_config.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/flags/usage_config.h
new file mode 100644 (file)
index 0000000..ee5016a
--- /dev/null
@@ -0,0 +1,131 @@
+//
+//  Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: usage_config.h
+// -----------------------------------------------------------------------------
+//
+// This file defines the main usage reporting configuration interfaces and
+// documents Abseil's supported built-in usage flags. If these flags are found
+// when parsing a command-line, Abseil will exit the program and display
+// appropriate help messages.
+#ifndef ABSL_FLAGS_USAGE_CONFIG_H_
+#define ABSL_FLAGS_USAGE_CONFIG_H_
+
+#include <functional>
+#include <string>
+
+#include "absl/strings/string_view.h"
+
+// -----------------------------------------------------------------------------
+// Built-in Usage Flags
+// -----------------------------------------------------------------------------
+//
+// Abseil supports the following built-in usage flags. When passed, these flags
+// exit the program and :
+//
+// * --help
+//     Shows help on important flags for this binary
+// * --helpfull
+//     Shows help on all flags
+// * --helpshort
+//     Shows help on only the main module for this program
+// * --helppackage
+//     Shows help on all modules in the main package
+// * --version
+//     Shows the version and build info for this binary and exits
+// * --only_check_args
+//     Exits after checking all flags
+// * --helpon
+//     Shows help on the modules named by this flag value
+// * --helpmatch
+//     Shows help on modules whose name contains the specified substring
+
+namespace absl {
+
+namespace flags_internal {
+using FlagKindFilter = std::function<bool (absl::string_view)>;
+}  // namespace flags_internal
+
+// FlagsUsageConfig
+//
+// This structure contains the collection of callbacks for changing the behavior
+// of the usage reporting routines in Abseil Flags.
+struct FlagsUsageConfig {
+  // Returns true if flags defined in the given source code file should be
+  // reported with --helpshort flag. For example, if the file
+  // "path/to/my/code.cc" defines the flag "--my_flag", and
+  // contains_helpshort_flags("path/to/my/code.cc") returns true, invoking the
+  // program with --helpshort will include information about --my_flag in the
+  // program output.
+  flags_internal::FlagKindFilter contains_helpshort_flags;
+
+  // Returns true if flags defined in the filename should be reported with
+  // --help flag. For example, if the file
+  // "path/to/my/code.cc" defines the flag "--my_flag", and
+  // contains_help_flags("path/to/my/code.cc") returns true, invoking the
+  // program with --help will include information about --my_flag in the
+  // program output.
+  flags_internal::FlagKindFilter contains_help_flags;
+
+  // Returns true if flags defined in the filename should be reported with
+  // --helppackage flag. For example, if the file
+  // "path/to/my/code.cc" defines the flag "--my_flag", and
+  // contains_helppackage_flags("path/to/my/code.cc") returns true, invoking the
+  // program with --helppackage will include information about --my_flag in the
+  // program output.
+  flags_internal::FlagKindFilter contains_helppackage_flags;
+
+  // Generates std::string containing program version. This is the std::string reported
+  // when user specifies --version in a command line.
+  std::function<std::string()> version_string;
+
+  // Normalizes the filename specific to the build system/filesystem used. This
+  // routine is used when we report the information about the flag definition
+  // location. For instance, if your build resides at some location you do not
+  // want to expose in the usage output, you can trim it to show only relevant
+  // part.
+  // For example:
+  //   normalize_filename("/my_company/some_long_path/src/project/file.cc")
+  // might produce
+  //   "project/file.cc".
+  std::function<std::string (absl::string_view)> normalize_filename;
+};
+
+// SetFlagsUsageConfig()
+//
+// Sets the usage reporting configuration callbacks. If any of the callbacks are
+// not set in usage_config instance, then the default value of the callback is
+// used.
+void SetFlagsUsageConfig(FlagsUsageConfig usage_config);
+
+namespace flags_internal {
+
+FlagsUsageConfig GetUsageConfig();
+
+void ReportUsageError(absl::string_view msg, bool is_fatal);
+
+}  // namespace flags_internal
+}  // namespace absl
+
+extern "C" {
+
+// Additional report of fatal usage error message before we std::exit. Error is
+// fatal if is_fatal argument to ReportUsageError is true.
+void AbslInternalReportFatalUsageError(absl::string_view);
+
+}  // extern "C"
+
+#endif  // ABSL_FLAGS_USAGE_CONFIG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/hash.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/hash.h
new file mode 100644 (file)
index 0000000..297dc9c
--- /dev/null
@@ -0,0 +1,322 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: hash.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the Abseil `hash` library and the Abseil hashing
+// framework. This framework consists of the following:
+//
+//   * The `absl::Hash` functor, which is used to invoke the hasher within the
+//     Abseil hashing framework. `absl::Hash<T>` supports most basic types and
+//     a number of Abseil types out of the box.
+//   * `AbslHashValue`, an extension point that allows you to extend types to
+//     support Abseil hashing without requiring you to define a hashing
+//     algorithm.
+//   * `HashState`, a type-erased class which implements the manipulation of the
+//     hash state (H) itself, contains member functions `combine()` and
+//     `combine_contiguous()`, which you can use to contribute to an existing
+//     hash state when hashing your types.
+//
+// Unlike `std::hash` or other hashing frameworks, the Abseil hashing framework
+// provides most of its utility by abstracting away the hash algorithm (and its
+// implementation) entirely. Instead, a type invokes the Abseil hashing
+// framework by simply combining its state with the state of known, hashable
+// types. Hashing of that combined state is separately done by `absl::Hash`.
+//
+// One should assume that a hash algorithm is chosen randomly at the start of
+// each process.  E.g., absl::Hash<int>()(9) in one process and
+// absl::Hash<int>()(9) in another process are likely to differ.
+//
+// Example:
+//
+//   // Suppose we have a class `Circle` for which we want to add hashing:
+//   class Circle {
+//    public:
+//     ...
+//    private:
+//     std::pair<int, int> center_;
+//     int radius_;
+//   };
+//
+//   // To add hashing support to `Circle`, we simply need to add a free
+//   // (non-member) function `AbslHashValue()`, and return the combined hash
+//   // state of the existing hash state and the class state. You can add such a
+//   // free function using a friend declaration within the body of the class:
+//   class Circle {
+//    public:
+//     ...
+//     template <typename H>
+//     friend H AbslHashValue(H h, const Circle& c) {
+//       return H::combine(std::move(h), c.center_, c.radius_);
+//     }
+//     ...
+//   };
+//
+// For more information, see Adding Type Support to `absl::Hash` below.
+//
+#ifndef ABSL_HASH_HASH_H_
+#define ABSL_HASH_HASH_H_
+
+#include "absl/hash/internal/hash.h"
+
+namespace absl {
+
+// -----------------------------------------------------------------------------
+// `absl::Hash`
+// -----------------------------------------------------------------------------
+//
+// `absl::Hash<T>` is a convenient general-purpose hash functor for any type `T`
+// satisfying any of the following conditions (in order):
+//
+//  * T is an arithmetic or pointer type
+//  * T defines an overload for `AbslHashValue(H, const T&)` for an arbitrary
+//    hash state `H`.
+//  - T defines a specialization of `HASH_NAMESPACE::hash<T>`
+//  - T defines a specialization of `std::hash<T>`
+//
+// `absl::Hash` intrinsically supports the following types:
+//
+//   * All integral types (including bool)
+//   * All enum types
+//   * All floating-point types (although hashing them is discouraged)
+//   * All pointer types, including nullptr_t
+//   * std::pair<T1, T2>, if T1 and T2 are hashable
+//   * std::tuple<Ts...>, if all the Ts... are hashable
+//   * std::unique_ptr and std::shared_ptr
+//   * All string-like types including:
+//     * std::string
+//     * std::string_view (as well as any instance of std::basic_string that
+//       uses char and std::char_traits)
+//  * All the standard sequence containers (provided the elements are hashable)
+//  * All the standard ordered associative containers (provided the elements are
+//    hashable)
+//  * absl types such as the following:
+//    * absl::string_view
+//    * absl::InlinedVector
+//    * absl::FixedArray
+//    * absl::uint128
+//    * absl::Time, absl::Duration, and absl::TimeZone
+//
+// Note: the list above is not meant to be exhaustive. Additional type support
+// may be added, in which case the above list will be updated.
+//
+// -----------------------------------------------------------------------------
+// absl::Hash Invocation Evaluation
+// -----------------------------------------------------------------------------
+//
+// When invoked, `absl::Hash<T>` searches for supplied hash functions in the
+// following order:
+//
+//   * Natively supported types out of the box (see above)
+//   * Types for which an `AbslHashValue()` overload is provided (such as
+//     user-defined types). See "Adding Type Support to `absl::Hash`" below.
+//   * Types which define a `HASH_NAMESPACE::hash<T>` specialization (aka
+//     `__gnu_cxx::hash<T>` for gcc/Clang or `stdext::hash<T>` for MSVC)
+//   * Types which define a `std::hash<T>` specialization
+//
+// The fallback to legacy hash functions exists mainly for backwards
+// compatibility. If you have a choice, prefer defining an `AbslHashValue`
+// overload instead of specializing any legacy hash functors.
+//
+// -----------------------------------------------------------------------------
+// The Hash State Concept, and using `HashState` for Type Erasure
+// -----------------------------------------------------------------------------
+//
+// The `absl::Hash` framework relies on the Concept of a "hash state." Such a
+// hash state is used in several places:
+//
+// * Within existing implementations of `absl::Hash<T>` to store the hashed
+//   state of an object. Note that it is up to the implementation how it stores
+//   such state. A hash table, for example, may mix the state to produce an
+//   integer value; a testing framework may simply hold a vector of that state.
+// * Within implementations of `AbslHashValue()` used to extend user-defined
+//   types. (See "Adding Type Support to absl::Hash" below.)
+// * Inside a `HashState`, providing type erasure for the concept of a hash
+//   state, which you can use to extend the `absl::Hash` framework for types
+//   that are otherwise difficult to extend using `AbslHashValue()`. (See the
+//   `HashState` class below.)
+//
+// The "hash state" concept contains two member functions for mixing hash state:
+//
+// * `H::combine(state, values...)`
+//
+//   Combines an arbitrary number of values into a hash state, returning the
+//   updated state. Note that the existing hash state is move-only and must be
+//   passed by value.
+//
+//   Each of the value types T must be hashable by H.
+//
+//   NOTE:
+//
+//     state = H::combine(std::move(state), value1, value2, value3);
+//
+//   must be guaranteed to produce the same hash expansion as
+//
+//     state = H::combine(std::move(state), value1);
+//     state = H::combine(std::move(state), value2);
+//     state = H::combine(std::move(state), value3);
+//
+// * `H::combine_contiguous(state, data, size)`
+//
+//    Combines a contiguous array of `size` elements into a hash state,
+//    returning the updated state. Note that the existing hash state is
+//    move-only and must be passed by value.
+//
+//    NOTE:
+//
+//      state = H::combine_contiguous(std::move(state), data, size);
+//
+//    need NOT be guaranteed to produce the same hash expansion as a loop
+//    (it may perform internal optimizations). If you need this guarantee, use a
+//    loop instead.
+//
+// -----------------------------------------------------------------------------
+// Adding Type Support to `absl::Hash`
+// -----------------------------------------------------------------------------
+//
+// To add support for your user-defined type, add a proper `AbslHashValue()`
+// overload as a free (non-member) function. The overload will take an
+// existing hash state and should combine that state with state from the type.
+//
+// Example:
+//
+//   template <typename H>
+//   H AbslHashValue(H state, const MyType& v) {
+//     return H::combine(std::move(state), v.field1, ..., v.fieldN);
+//   }
+//
+// where `(field1, ..., fieldN)` are the members you would use on your
+// `operator==` to define equality.
+//
+// Notice that `AbslHashValue` is not a class member, but an ordinary function.
+// An `AbslHashValue` overload for a type should only be declared in the same
+// file and namespace as said type. The proper `AbslHashValue` implementation
+// for a given type will be discovered via ADL.
+//
+// Note: unlike `std::hash', `absl::Hash` should never be specialized. It must
+// only be extended by adding `AbslHashValue()` overloads.
+//
+template <typename T>
+using Hash = absl::hash_internal::Hash<T>;
+
+// HashState
+//
+// A type erased version of the hash state concept, for use in user-defined
+// `AbslHashValue` implementations that can't use templates (such as PImpl
+// classes, virtual functions, etc.). The type erasure adds overhead so it
+// should be avoided unless necessary.
+//
+// Note: This wrapper will only erase calls to:
+//     combine_contiguous(H, const unsigned char*, size_t)
+//
+// All other calls will be handled internally and will not invoke overloads
+// provided by the wrapped class.
+//
+// Users of this class should still define a template `AbslHashValue` function,
+// but can use `absl::HashState::Create(&state)` to erase the type of the hash
+// state and dispatch to their private hashing logic.
+//
+// This state can be used like any other hash state. In particular, you can call
+// `HashState::combine()` and `HashState::combine_contiguous()` on it.
+//
+// Example:
+//
+//   class Interface {
+//    public:
+//     template <typename H>
+//     friend H AbslHashValue(H state, const Interface& value) {
+//       state = H::combine(std::move(state), std::type_index(typeid(*this)));
+//       value.HashValue(absl::HashState::Create(&state));
+//       return state;
+//     }
+//    private:
+//     virtual void HashValue(absl::HashState state) const = 0;
+//   };
+//
+//   class Impl : Interface {
+//    private:
+//     void HashValue(absl::HashState state) const override {
+//       absl::HashState::combine(std::move(state), v1_, v2_);
+//     }
+//     int v1_;
+//     std::string v2_;
+//   };
+class HashState : public hash_internal::HashStateBase<HashState> {
+ public:
+  // HashState::Create()
+  //
+  // Create a new `HashState` instance that wraps `state`. All calls to
+  // `combine()` and `combine_contiguous()` on the new instance will be
+  // redirected to the original `state` object. The `state` object must outlive
+  // the `HashState` instance.
+  template <typename T>
+  static HashState Create(T* state) {
+    HashState s;
+    s.Init(state);
+    return s;
+  }
+
+  HashState(const HashState&) = delete;
+  HashState& operator=(const HashState&) = delete;
+  HashState(HashState&&) = default;
+  HashState& operator=(HashState&&) = default;
+
+  // HashState::combine()
+  //
+  // Combines an arbitrary number of values into a hash state, returning the
+  // updated state.
+  using HashState::HashStateBase::combine;
+
+  // HashState::combine_contiguous()
+  //
+  // Combines a contiguous array of `size` elements into a hash state, returning
+  // the updated state.
+  static HashState combine_contiguous(HashState hash_state,
+                                      const unsigned char* first, size_t size) {
+    hash_state.combine_contiguous_(hash_state.state_, first, size);
+    return hash_state;
+  }
+  using HashState::HashStateBase::combine_contiguous;
+
+ private:
+  HashState() = default;
+
+  template <typename T>
+  static void CombineContiguousImpl(void* p, const unsigned char* first,
+                                    size_t size) {
+    T& state = *static_cast<T*>(p);
+    state = T::combine_contiguous(std::move(state), first, size);
+  }
+
+  template <typename T>
+  void Init(T* state) {
+    state_ = state;
+    combine_contiguous_ = &CombineContiguousImpl<T>;
+  }
+
+  // Do not erase an already erased state.
+  void Init(HashState* state) {
+    state_ = state->state_;
+    combine_contiguous_ = state->combine_contiguous_;
+  }
+
+  void* state_;
+  void (*combine_contiguous_)(void*, const unsigned char*, size_t);
+};
+
+}  // namespace absl
+
+#endif  // ABSL_HASH_HASH_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/hash_testing.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/hash_testing.h
new file mode 100644 (file)
index 0000000..c45bc15
--- /dev/null
@@ -0,0 +1,376 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_HASH_HASH_TESTING_H_
+#define ABSL_HASH_HASH_TESTING_H_
+
+#include <initializer_list>
+#include <tuple>
+#include <type_traits>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "absl/hash/internal/spy_hash_state.h"
+#include "absl/meta/type_traits.h"
+#include "absl/strings/str_cat.h"
+#include "absl/types/variant.h"
+
+namespace absl {
+
+// Run the absl::Hash algorithm over all the elements passed in and verify that
+// their hash expansion is congruent with their `==` operator.
+//
+// It is used in conjunction with EXPECT_TRUE. Failures will output information
+// on what requirement failed and on which objects.
+//
+// Users should pass a collection of types as either an initializer list or a
+// container of cases.
+//
+//   EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(
+//       {v1, v2, ..., vN}));
+//
+//   std::vector<MyType> cases;
+//   // Fill cases...
+//   EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(cases));
+//
+// Users can pass a variety of types for testing heterogeneous lookup with
+// `std::make_tuple`:
+//
+//   EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(
+//       std::make_tuple(v1, v2, ..., vN)));
+//
+//
+// Ideally, the values passed should provide enough coverage of the `==`
+// operator and the AbslHashValue implementations.
+// For dynamically sized types, the empty state should usually be included in
+// the values.
+//
+// The function accepts an optional comparator function, in case that `==` is
+// not enough for the values provided.
+//
+// Usage:
+//
+//   EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(
+//       std::make_tuple(v1, v2, ..., vN), MyCustomEq{}));
+//
+// It checks the following requirements:
+//   1. The expansion for a value is deterministic.
+//   2. For any two objects `a` and `b` in the sequence, if `a == b` evaluates
+//      to true, then their hash expansion must be equal.
+//   3. If `a == b` evaluates to false their hash expansion must be unequal.
+//   4. If `a == b` evaluates to false neither hash expansion can be a
+//      suffix of the other.
+//   5. AbslHashValue overloads should not be called by the user. They are only
+//      meant to be called by the framework. Users should call H::combine() and
+//      H::combine_contiguous().
+//   6. No moved-from instance of the hash state is used in the implementation
+//      of AbslHashValue.
+//
+// The values do not have to have the same type. This can be useful for
+// equivalent types that support heterogeneous lookup.
+//
+// A possible reason for breaking (2) is combining state in the hash expansion
+// that was not used in `==`.
+// For example:
+//
+// struct Bad2 {
+//   int a, b;
+//   template <typename H>
+//   friend H AbslHashValue(H state, Bad2 x) {
+//     // Uses a and b.
+//     return H::combine(std::move(state), x.a, x.b);
+//   }
+//   friend bool operator==(Bad2 x, Bad2 y) {
+//     // Only uses a.
+//     return x.a == y.a;
+//   }
+// };
+//
+// As for (3), breaking this usually means that there is state being passed to
+// the `==` operator that is not used in the hash expansion.
+// For example:
+//
+// struct Bad3 {
+//   int a, b;
+//   template <typename H>
+//   friend H AbslHashValue(H state, Bad3 x) {
+//     // Only uses a.
+//     return H::combine(std::move(state), x.a);
+//   }
+//   friend bool operator==(Bad3 x, Bad3 y) {
+//     // Uses a and b.
+//     return x.a == y.a && x.b == y.b;
+//   }
+// };
+//
+// Finally, a common way to break 4 is by combining dynamic ranges without
+// combining the size of the range.
+// For example:
+//
+// struct Bad4 {
+//   int *p, size;
+//   template <typename H>
+//   friend H AbslHashValue(H state, Bad4 x) {
+//     return H::combine_contiguous(std::move(state), x.p, x.p + x.size);
+//   }
+//   friend bool operator==(Bad4 x, Bad4 y) {
+//    // Compare two ranges for equality. C++14 code can instead use std::equal.
+//     return absl::equal(x.p, x.p + x.size, y.p, y.p + y.size);
+//   }
+// };
+//
+// An easy solution to this is to combine the size after combining the range,
+// like so:
+// template <typename H>
+// friend H AbslHashValue(H state, Bad4 x) {
+//   return H::combine(
+//       H::combine_contiguous(std::move(state), x.p, x.p + x.size), x.size);
+// }
+//
+template <int&... ExplicitBarrier, typename Container>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(const Container& values);
+
+template <int&... ExplicitBarrier, typename Container, typename Eq>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals);
+
+template <int&..., typename T>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values);
+
+template <int&..., typename T, typename Eq>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values,
+                                      Eq equals);
+
+namespace hash_internal {
+
+struct PrintVisitor {
+  size_t index;
+  template <typename T>
+  std::string operator()(const T* value) const {
+    return absl::StrCat("#", index, "(", testing::PrintToString(*value), ")");
+  }
+};
+
+template <typename Eq>
+struct EqVisitor {
+  Eq eq;
+  template <typename T, typename U>
+  bool operator()(const T* t, const U* u) const {
+    return eq(*t, *u);
+  }
+};
+
+struct ExpandVisitor {
+  template <typename T>
+  SpyHashState operator()(const T* value) const {
+    return SpyHashState::combine(SpyHashState(), *value);
+  }
+};
+
+template <typename Container, typename Eq>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals) {
+  using V = typename Container::value_type;
+
+  struct Info {
+    const V& value;
+    size_t index;
+    std::string ToString() const {
+      return absl::visit(PrintVisitor{index}, value);
+    }
+    SpyHashState expand() const { return absl::visit(ExpandVisitor{}, value); }
+  };
+
+  using EqClass = std::vector<Info>;
+  std::vector<EqClass> classes;
+
+  // Gather the values in equivalence classes.
+  size_t i = 0;
+  for (const auto& value : values) {
+    EqClass* c = nullptr;
+    for (auto& eqclass : classes) {
+      if (absl::visit(EqVisitor<Eq>{equals}, value, eqclass[0].value)) {
+        c = &eqclass;
+        break;
+      }
+    }
+    if (c == nullptr) {
+      classes.emplace_back();
+      c = &classes.back();
+    }
+    c->push_back({value, i});
+    ++i;
+
+    // Verify potential errors captured by SpyHashState.
+    if (auto error = c->back().expand().error()) {
+      return testing::AssertionFailure() << *error;
+    }
+  }
+
+  if (classes.size() < 2) {
+    return testing::AssertionFailure()
+           << "At least two equivalence classes are expected.";
+  }
+
+  // We assume that equality is correctly implemented.
+  // Now we verify that AbslHashValue is also correctly implemented.
+
+  for (const auto& c : classes) {
+    // All elements of the equivalence class must have the same hash
+    // expansion.
+    const SpyHashState expected = c[0].expand();
+    for (const Info& v : c) {
+      if (v.expand() != v.expand()) {
+        return testing::AssertionFailure()
+               << "Hash expansion for " << v.ToString()
+               << " is non-deterministic.";
+      }
+      if (v.expand() != expected) {
+        return testing::AssertionFailure()
+               << "Values " << c[0].ToString() << " and " << v.ToString()
+               << " evaluate as equal but have an unequal hash expansion.";
+      }
+    }
+
+    // Elements from other classes must have different hash expansion.
+    for (const auto& c2 : classes) {
+      if (&c == &c2) continue;
+      const SpyHashState c2_hash = c2[0].expand();
+      switch (SpyHashState::Compare(expected, c2_hash)) {
+        case SpyHashState::CompareResult::kEqual:
+          return testing::AssertionFailure()
+                 << "Values " << c[0].ToString() << " and " << c2[0].ToString()
+                 << " evaluate as unequal but have an equal hash expansion.";
+        case SpyHashState::CompareResult::kBSuffixA:
+          return testing::AssertionFailure()
+                 << "Hash expansion of " << c2[0].ToString()
+                 << " is a suffix of the hash expansion of " << c[0].ToString()
+                 << ".";
+        case SpyHashState::CompareResult::kASuffixB:
+          return testing::AssertionFailure()
+                 << "Hash expansion of " << c[0].ToString()
+                 << " is a suffix of the hash expansion of " << c2[0].ToString()
+                 << ".";
+        case SpyHashState::CompareResult::kUnequal:
+          break;
+      }
+    }
+  }
+  return testing::AssertionSuccess();
+}
+
+template <typename... T>
+struct TypeSet {
+  template <typename U, bool = disjunction<std::is_same<T, U>...>::value>
+  struct Insert {
+    using type = TypeSet<U, T...>;
+  };
+  template <typename U>
+  struct Insert<U, true> {
+    using type = TypeSet;
+  };
+
+  template <template <typename...> class C>
+  using apply = C<T...>;
+};
+
+template <typename... T>
+struct MakeTypeSet : TypeSet<> {};
+template <typename T, typename... Ts>
+struct MakeTypeSet<T, Ts...> : MakeTypeSet<Ts...>::template Insert<T>::type {};
+
+template <typename... T>
+using VariantForTypes = typename MakeTypeSet<
+    const typename std::decay<T>::type*...>::template apply<absl::variant>;
+
+template <typename Container>
+struct ContainerAsVector {
+  using V = absl::variant<const typename Container::value_type*>;
+  using Out = std::vector<V>;
+
+  static Out Do(const Container& values) {
+    Out out;
+    for (const auto& v : values) out.push_back(&v);
+    return out;
+  }
+};
+
+template <typename... T>
+struct ContainerAsVector<std::tuple<T...>> {
+  using V = VariantForTypes<T...>;
+  using Out = std::vector<V>;
+
+  template <size_t... I>
+  static Out DoImpl(const std::tuple<T...>& tuple, absl::index_sequence<I...>) {
+    return Out{&std::get<I>(tuple)...};
+  }
+
+  static Out Do(const std::tuple<T...>& values) {
+    return DoImpl(values, absl::index_sequence_for<T...>());
+  }
+};
+
+template <>
+struct ContainerAsVector<std::tuple<>> {
+  static std::vector<VariantForTypes<int>> Do(std::tuple<>) { return {}; }
+};
+
+struct DefaultEquals {
+  template <typename T, typename U>
+  bool operator()(const T& t, const U& u) const {
+    return t == u;
+  }
+};
+
+}  // namespace hash_internal
+
+template <int&..., typename Container>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(const Container& values) {
+  return hash_internal::VerifyTypeImplementsAbslHashCorrectly(
+      hash_internal::ContainerAsVector<Container>::Do(values),
+      hash_internal::DefaultEquals{});
+}
+
+template <int&..., typename Container, typename Eq>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals) {
+  return hash_internal::VerifyTypeImplementsAbslHashCorrectly(
+      hash_internal::ContainerAsVector<Container>::Do(values), equals);
+}
+
+template <int&..., typename T>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values) {
+  return hash_internal::VerifyTypeImplementsAbslHashCorrectly(
+      hash_internal::ContainerAsVector<std::initializer_list<T>>::Do(values),
+      hash_internal::DefaultEquals{});
+}
+
+template <int&..., typename T, typename Eq>
+ABSL_MUST_USE_RESULT testing::AssertionResult
+VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values,
+                                      Eq equals) {
+  return hash_internal::VerifyTypeImplementsAbslHashCorrectly(
+      hash_internal::ContainerAsVector<std::initializer_list<T>>::Do(values),
+      equals);
+}
+
+}  // namespace absl
+
+#endif  // ABSL_HASH_HASH_TESTING_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/city.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/city.h
new file mode 100644 (file)
index 0000000..b43d340
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// https://code.google.com/p/cityhash/
+//
+// This file provides a few functions for hashing strings.  All of them are
+// high-quality functions in the sense that they pass standard tests such
+// as Austin Appleby's SMHasher.  They are also fast.
+//
+// For 64-bit x86 code, on short strings, we don't know of anything faster than
+// CityHash64 that is of comparable quality.  We believe our nearest competitor
+// is Murmur3.  For 64-bit x86 code, CityHash64 is an excellent choice for hash
+// tables and most other hashing (excluding cryptography).
+//
+// For 32-bit x86 code, we don't know of anything faster than CityHash32 that
+// is of comparable quality.  We believe our nearest competitor is Murmur3A.
+// (On 64-bit CPUs, it is typically faster to use the other CityHash variants.)
+//
+// Functions in the CityHash family are not suitable for cryptography.
+//
+// Please see CityHash's README file for more details on our performance
+// measurements and so on.
+//
+// WARNING: This code has been only lightly tested on big-endian platforms!
+// It is known to work well on little-endian platforms that have a small penalty
+// for unaligned reads, such as current Intel and AMD moderate-to-high-end CPUs.
+// It should work on all 32-bit and 64-bit platforms that allow unaligned reads;
+// bug reports are welcome.
+//
+// By the way, for some hash functions, given strings a and b, the hash
+// of a+b is easily derived from the hashes of a and b.  This property
+// doesn't hold for any hash functions in this file.
+
+#ifndef ABSL_HASH_INTERNAL_CITY_H_
+#define ABSL_HASH_INTERNAL_CITY_H_
+
+#include <stdint.h>
+#include <stdlib.h>  // for size_t.
+#include <utility>
+
+namespace absl {
+namespace hash_internal {
+
+typedef std::pair<uint64_t, uint64_t> uint128;
+
+inline uint64_t Uint128Low64(const uint128 &x) { return x.first; }
+inline uint64_t Uint128High64(const uint128 &x) { return x.second; }
+
+// Hash function for a byte array.
+uint64_t CityHash64(const char *s, size_t len);
+
+// Hash function for a byte array.  For convenience, a 64-bit seed is also
+// hashed into the result.
+uint64_t CityHash64WithSeed(const char *s, size_t len, uint64_t seed);
+
+// Hash function for a byte array.  For convenience, two seeds are also
+// hashed into the result.
+uint64_t CityHash64WithSeeds(const char *s, size_t len, uint64_t seed0,
+                           uint64_t seed1);
+
+// Hash function for a byte array.  Most useful in 32-bit binaries.
+uint32_t CityHash32(const char *s, size_t len);
+
+// Hash 128 input bits down to 64 bits of output.
+// This is intended to be a reasonably good hash function.
+inline uint64_t Hash128to64(const uint128 &x) {
+  // Murmur-inspired hashing.
+  const uint64_t kMul = 0x9ddfea08eb382d69ULL;
+  uint64_t a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul;
+  a ^= (a >> 47);
+  uint64_t b = (Uint128High64(x) ^ a) * kMul;
+  b ^= (b >> 47);
+  b *= kMul;
+  return b;
+}
+
+}  // namespace hash_internal
+}  // namespace absl
+
+#endif  // ABSL_HASH_INTERNAL_CITY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/hash.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/hash.h
new file mode 100644 (file)
index 0000000..1866517
--- /dev/null
@@ -0,0 +1,854 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: hash.h
+// -----------------------------------------------------------------------------
+//
+#ifndef ABSL_HASH_INTERNAL_HASH_H_
+#define ABSL_HASH_INTERNAL_HASH_H_
+
+#include <algorithm>
+#include <array>
+#include <cmath>
+#include <cstring>
+#include <deque>
+#include <forward_list>
+#include <functional>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+#include <vector>
+
+#include "absl/base/internal/endian.h"
+#include "absl/base/port.h"
+#include "absl/container/fixed_array.h"
+#include "absl/meta/type_traits.h"
+#include "absl/numeric/int128.h"
+#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
+#include "absl/types/variant.h"
+#include "absl/utility/utility.h"
+#include "absl/hash/internal/city.h"
+
+namespace absl {
+namespace hash_internal {
+
+// HashStateBase
+//
+// A hash state object represents an intermediate state in the computation
+// of an unspecified hash algorithm. `HashStateBase` provides a CRTP style
+// base class for hash state implementations. Developers adding type support
+// for `absl::Hash` should not rely on any parts of the state object other than
+// the following member functions:
+//
+//   * HashStateBase::combine()
+//   * HashStateBase::combine_contiguous()
+//
+// A derived hash state class of type `H` must provide a static member function
+// with a signature similar to the following:
+//
+//    `static H combine_contiguous(H state, const unsigned char*, size_t)`.
+//
+// `HashStateBase` will provide a complete implementations for a hash state
+// object in terms of this method.
+//
+// Example:
+//
+//   // Use CRTP to define your derived class.
+//   struct MyHashState : HashStateBase<MyHashState> {
+//       static H combine_contiguous(H state, const unsigned char*, size_t);
+//       using MyHashState::HashStateBase::combine;
+//       using MyHashState::HashStateBase::combine_contiguous;
+//   };
+template <typename H>
+class HashStateBase {
+ public:
+  // HashStateBase::combine()
+  //
+  // Combines an arbitrary number of values into a hash state, returning the
+  // updated state.
+  //
+  // Each of the value types `T` must be separately hashable by the Abseil
+  // hashing framework.
+  //
+  // NOTE:
+  //
+  //   state = H::combine(std::move(state), value1, value2, value3);
+  //
+  // is guaranteed to produce the same hash expansion as:
+  //
+  //   state = H::combine(std::move(state), value1);
+  //   state = H::combine(std::move(state), value2);
+  //   state = H::combine(std::move(state), value3);
+  template <typename T, typename... Ts>
+  static H combine(H state, const T& value, const Ts&... values);
+  static H combine(H state) { return state; }
+
+  // HashStateBase::combine_contiguous()
+  //
+  // Combines a contiguous array of `size` elements into a hash state, returning
+  // the updated state.
+  //
+  // NOTE:
+  //
+  //   state = H::combine_contiguous(std::move(state), data, size);
+  //
+  // is NOT guaranteed to produce the same hash expansion as a for-loop (it may
+  // perform internal optimizations).  If you need this guarantee, use the
+  // for-loop instead.
+  template <typename T>
+  static H combine_contiguous(H state, const T* data, size_t size);
+};
+
+// is_uniquely_represented
+//
+// `is_uniquely_represented<T>` is a trait class that indicates whether `T`
+// is uniquely represented.
+//
+// A type is "uniquely represented" if two equal values of that type are
+// guaranteed to have the same bytes in their underlying storage. In other
+// words, if `a == b`, then `memcmp(&a, &b, sizeof(T))` is guaranteed to be
+// zero. This property cannot be detected automatically, so this trait is false
+// by default, but can be specialized by types that wish to assert that they are
+// uniquely represented. This makes them eligible for certain optimizations.
+//
+// If you have any doubt whatsoever, do not specialize this template.
+// The default is completely safe, and merely disables some optimizations
+// that will not matter for most types. Specializing this template,
+// on the other hand, can be very hazardous.
+//
+// To be uniquely represented, a type must not have multiple ways of
+// representing the same value; for example, float and double are not
+// uniquely represented, because they have distinct representations for
+// +0 and -0. Furthermore, the type's byte representation must consist
+// solely of user-controlled data, with no padding bits and no compiler-
+// controlled data such as vptrs or sanitizer metadata. This is usually
+// very difficult to guarantee, because in most cases the compiler can
+// insert data and padding bits at its own discretion.
+//
+// If you specialize this template for a type `T`, you must do so in the file
+// that defines that type (or in this file). If you define that specialization
+// anywhere else, `is_uniquely_represented<T>` could have different meanings
+// in different places.
+//
+// The Enable parameter is meaningless; it is provided as a convenience,
+// to support certain SFINAE techniques when defining specializations.
+template <typename T, typename Enable = void>
+struct is_uniquely_represented : std::false_type {};
+
+// is_uniquely_represented<unsigned char>
+//
+// unsigned char is a synonym for "byte", so it is guaranteed to be
+// uniquely represented.
+template <>
+struct is_uniquely_represented<unsigned char> : std::true_type {};
+
+// is_uniquely_represented for non-standard integral types
+//
+// Integral types other than bool should be uniquely represented on any
+// platform that this will plausibly be ported to.
+template <typename Integral>
+struct is_uniquely_represented<
+    Integral, typename std::enable_if<std::is_integral<Integral>::value>::type>
+    : std::true_type {};
+
+// is_uniquely_represented<bool>
+//
+//
+template <>
+struct is_uniquely_represented<bool> : std::false_type {};
+
+// hash_bytes()
+//
+// Convenience function that combines `hash_state` with the byte representation
+// of `value`.
+template <typename H, typename T>
+H hash_bytes(H hash_state, const T& value) {
+  const unsigned char* start = reinterpret_cast<const unsigned char*>(&value);
+  return H::combine_contiguous(std::move(hash_state), start, sizeof(value));
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Basic Types
+// -----------------------------------------------------------------------------
+
+// Note: Default `AbslHashValue` implementations live in `hash_internal`. This
+// allows us to block lexical scope lookup when doing an unqualified call to
+// `AbslHashValue` below. User-defined implementations of `AbslHashValue` can
+// only be found via ADL.
+
+// AbslHashValue() for hashing bool values
+//
+// We use SFINAE to ensure that this overload only accepts bool, not types that
+// are convertible to bool.
+template <typename H, typename B>
+typename std::enable_if<std::is_same<B, bool>::value, H>::type AbslHashValue(
+    H hash_state, B value) {
+  return H::combine(std::move(hash_state),
+                    static_cast<unsigned char>(value ? 1 : 0));
+}
+
+// AbslHashValue() for hashing enum values
+template <typename H, typename Enum>
+typename std::enable_if<std::is_enum<Enum>::value, H>::type AbslHashValue(
+    H hash_state, Enum e) {
+  // In practice, we could almost certainly just invoke hash_bytes directly,
+  // but it's possible that a sanitizer might one day want to
+  // store data in the unused bits of an enum. To avoid that risk, we
+  // convert to the underlying type before hashing. Hopefully this will get
+  // optimized away; if not, we can reopen discussion with c-toolchain-team.
+  return H::combine(std::move(hash_state),
+                    static_cast<typename std::underlying_type<Enum>::type>(e));
+}
+// AbslHashValue() for hashing floating-point values
+template <typename H, typename Float>
+typename std::enable_if<std::is_same<Float, float>::value ||
+                            std::is_same<Float, double>::value,
+                        H>::type
+AbslHashValue(H hash_state, Float value) {
+  return hash_internal::hash_bytes(std::move(hash_state),
+                                   value == 0 ? 0 : value);
+}
+
+// Long double has the property that it might have extra unused bytes in it.
+// For example, in x86 sizeof(long double)==16 but it only really uses 80-bits
+// of it. This means we can't use hash_bytes on a long double and have to
+// convert it to something else first.
+template <typename H, typename LongDouble>
+typename std::enable_if<std::is_same<LongDouble, long double>::value, H>::type
+AbslHashValue(H hash_state, LongDouble value) {
+  const int category = std::fpclassify(value);
+  switch (category) {
+    case FP_INFINITE:
+      // Add the sign bit to differentiate between +Inf and -Inf
+      hash_state = H::combine(std::move(hash_state), std::signbit(value));
+      break;
+
+    case FP_NAN:
+    case FP_ZERO:
+    default:
+      // Category is enough for these.
+      break;
+
+    case FP_NORMAL:
+    case FP_SUBNORMAL:
+      // We can't convert `value` directly to double because this would have
+      // undefined behavior if the value is out of range.
+      // std::frexp gives us a value in the range (-1, -.5] or [.5, 1) that is
+      // guaranteed to be in range for `double`. The truncation is
+      // implementation defined, but that works as long as it is deterministic.
+      int exp;
+      auto mantissa = static_cast<double>(std::frexp(value, &exp));
+      hash_state = H::combine(std::move(hash_state), mantissa, exp);
+  }
+
+  return H::combine(std::move(hash_state), category);
+}
+
+// AbslHashValue() for hashing pointers
+template <typename H, typename T>
+H AbslHashValue(H hash_state, T* ptr) {
+  auto v = reinterpret_cast<uintptr_t>(ptr);
+  // Due to alignment, pointers tend to have low bits as zero, and the next few
+  // bits follow a pattern since they are also multiples of some base value.
+  // Mixing the pointer twice helps prevent stuck low bits for certain alignment
+  // values.
+  return H::combine(std::move(hash_state), v, v);
+}
+
+// AbslHashValue() for hashing nullptr_t
+template <typename H>
+H AbslHashValue(H hash_state, std::nullptr_t) {
+  return H::combine(std::move(hash_state), static_cast<void*>(nullptr));
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Composite Types
+// -----------------------------------------------------------------------------
+
+// is_hashable()
+//
+// Trait class which returns true if T is hashable by the absl::Hash framework.
+// Used for the AbslHashValue implementations for composite types below.
+template <typename T>
+struct is_hashable;
+
+// AbslHashValue() for hashing pairs
+template <typename H, typename T1, typename T2>
+typename std::enable_if<is_hashable<T1>::value && is_hashable<T2>::value,
+                        H>::type
+AbslHashValue(H hash_state, const std::pair<T1, T2>& p) {
+  return H::combine(std::move(hash_state), p.first, p.second);
+}
+
+// hash_tuple()
+//
+// Helper function for hashing a tuple. The third argument should
+// be an index_sequence running from 0 to tuple_size<Tuple> - 1.
+template <typename H, typename Tuple, size_t... Is>
+H hash_tuple(H hash_state, const Tuple& t, absl::index_sequence<Is...>) {
+  return H::combine(std::move(hash_state), std::get<Is>(t)...);
+}
+
+// AbslHashValue for hashing tuples
+template <typename H, typename... Ts>
+#if defined(_MSC_VER)
+// This SFINAE gets MSVC confused under some conditions. Let's just disable it
+// for now.
+H
+#else  // _MSC_VER
+typename std::enable_if<absl::conjunction<is_hashable<Ts>...>::value, H>::type
+#endif  // _MSC_VER
+AbslHashValue(H hash_state, const std::tuple<Ts...>& t) {
+  return hash_internal::hash_tuple(std::move(hash_state), t,
+                                   absl::make_index_sequence<sizeof...(Ts)>());
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Pointers
+// -----------------------------------------------------------------------------
+
+// AbslHashValue for hashing unique_ptr
+template <typename H, typename T, typename D>
+H AbslHashValue(H hash_state, const std::unique_ptr<T, D>& ptr) {
+  return H::combine(std::move(hash_state), ptr.get());
+}
+
+// AbslHashValue for hashing shared_ptr
+template <typename H, typename T>
+H AbslHashValue(H hash_state, const std::shared_ptr<T>& ptr) {
+  return H::combine(std::move(hash_state), ptr.get());
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for String-Like Types
+// -----------------------------------------------------------------------------
+
+// AbslHashValue for hashing strings
+//
+// All the string-like types supported here provide the same hash expansion for
+// the same character sequence. These types are:
+//
+//  - `std::string` (and std::basic_string<char, std::char_traits<char>, A> for
+//      any allocator A)
+//  - `absl::string_view` and `std::string_view`
+//
+// For simplicity, we currently support only `char` strings. This support may
+// be broadened, if necessary, but with some caution - this overload would
+// misbehave in cases where the traits' `eq()` member isn't equivalent to `==`
+// on the underlying character type.
+template <typename H>
+H AbslHashValue(H hash_state, absl::string_view str) {
+  return H::combine(
+      H::combine_contiguous(std::move(hash_state), str.data(), str.size()),
+      str.size());
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Sequence Containers
+// -----------------------------------------------------------------------------
+
+// AbslHashValue for hashing std::array
+template <typename H, typename T, size_t N>
+typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(
+    H hash_state, const std::array<T, N>& array) {
+  return H::combine_contiguous(std::move(hash_state), array.data(),
+                               array.size());
+}
+
+// AbslHashValue for hashing std::deque
+template <typename H, typename T, typename Allocator>
+typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(
+    H hash_state, const std::deque<T, Allocator>& deque) {
+  // TODO(gromer): investigate a more efficient implementation taking
+  // advantage of the chunk structure.
+  for (const auto& t : deque) {
+    hash_state = H::combine(std::move(hash_state), t);
+  }
+  return H::combine(std::move(hash_state), deque.size());
+}
+
+// AbslHashValue for hashing std::forward_list
+template <typename H, typename T, typename Allocator>
+typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(
+    H hash_state, const std::forward_list<T, Allocator>& list) {
+  size_t size = 0;
+  for (const T& t : list) {
+    hash_state = H::combine(std::move(hash_state), t);
+    ++size;
+  }
+  return H::combine(std::move(hash_state), size);
+}
+
+// AbslHashValue for hashing std::list
+template <typename H, typename T, typename Allocator>
+typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(
+    H hash_state, const std::list<T, Allocator>& list) {
+  for (const auto& t : list) {
+    hash_state = H::combine(std::move(hash_state), t);
+  }
+  return H::combine(std::move(hash_state), list.size());
+}
+
+// AbslHashValue for hashing std::vector
+//
+// Do not use this for vector<bool>. It does not have a .data(), and a fallback
+// for std::hash<> is most likely faster.
+template <typename H, typename T, typename Allocator>
+typename std::enable_if<is_hashable<T>::value && !std::is_same<T, bool>::value,
+                        H>::type
+AbslHashValue(H hash_state, const std::vector<T, Allocator>& vector) {
+  return H::combine(H::combine_contiguous(std::move(hash_state), vector.data(),
+                                          vector.size()),
+                    vector.size());
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Ordered Associative Containers
+// -----------------------------------------------------------------------------
+
+// AbslHashValue for hashing std::map
+template <typename H, typename Key, typename T, typename Compare,
+          typename Allocator>
+typename std::enable_if<is_hashable<Key>::value && is_hashable<T>::value,
+                        H>::type
+AbslHashValue(H hash_state, const std::map<Key, T, Compare, Allocator>& map) {
+  for (const auto& t : map) {
+    hash_state = H::combine(std::move(hash_state), t);
+  }
+  return H::combine(std::move(hash_state), map.size());
+}
+
+// AbslHashValue for hashing std::multimap
+template <typename H, typename Key, typename T, typename Compare,
+          typename Allocator>
+typename std::enable_if<is_hashable<Key>::value && is_hashable<T>::value,
+                        H>::type
+AbslHashValue(H hash_state,
+              const std::multimap<Key, T, Compare, Allocator>& map) {
+  for (const auto& t : map) {
+    hash_state = H::combine(std::move(hash_state), t);
+  }
+  return H::combine(std::move(hash_state), map.size());
+}
+
+// AbslHashValue for hashing std::set
+template <typename H, typename Key, typename Compare, typename Allocator>
+typename std::enable_if<is_hashable<Key>::value, H>::type AbslHashValue(
+    H hash_state, const std::set<Key, Compare, Allocator>& set) {
+  for (const auto& t : set) {
+    hash_state = H::combine(std::move(hash_state), t);
+  }
+  return H::combine(std::move(hash_state), set.size());
+}
+
+// AbslHashValue for hashing std::multiset
+template <typename H, typename Key, typename Compare, typename Allocator>
+typename std::enable_if<is_hashable<Key>::value, H>::type AbslHashValue(
+    H hash_state, const std::multiset<Key, Compare, Allocator>& set) {
+  for (const auto& t : set) {
+    hash_state = H::combine(std::move(hash_state), t);
+  }
+  return H::combine(std::move(hash_state), set.size());
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Wrapper Types
+// -----------------------------------------------------------------------------
+
+// AbslHashValue for hashing absl::optional
+template <typename H, typename T>
+typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(
+    H hash_state, const absl::optional<T>& opt) {
+  if (opt) hash_state = H::combine(std::move(hash_state), *opt);
+  return H::combine(std::move(hash_state), opt.has_value());
+}
+
+// VariantVisitor
+template <typename H>
+struct VariantVisitor {
+  H&& hash_state;
+  template <typename T>
+  H operator()(const T& t) const {
+    return H::combine(std::move(hash_state), t);
+  }
+};
+
+// AbslHashValue for hashing absl::variant
+template <typename H, typename... T>
+typename std::enable_if<conjunction<is_hashable<T>...>::value, H>::type
+AbslHashValue(H hash_state, const absl::variant<T...>& v) {
+  if (!v.valueless_by_exception()) {
+    hash_state = absl::visit(VariantVisitor<H>{std::move(hash_state)}, v);
+  }
+  return H::combine(std::move(hash_state), v.index());
+}
+
+// -----------------------------------------------------------------------------
+// AbslHashValue for Other Types
+// -----------------------------------------------------------------------------
+
+// AbslHashValue for hashing std::bitset is not defined, for the same reason as
+// for vector<bool> (see std::vector above): It does not expose the raw bytes,
+// and a fallback to std::hash<> is most likely faster.
+
+// -----------------------------------------------------------------------------
+
+// hash_range_or_bytes()
+//
+// Mixes all values in the range [data, data+size) into the hash state.
+// This overload accepts only uniquely-represented types, and hashes them by
+// hashing the entire range of bytes.
+template <typename H, typename T>
+typename std::enable_if<is_uniquely_represented<T>::value, H>::type
+hash_range_or_bytes(H hash_state, const T* data, size_t size) {
+  const auto* bytes = reinterpret_cast<const unsigned char*>(data);
+  return H::combine_contiguous(std::move(hash_state), bytes, sizeof(T) * size);
+}
+
+// hash_range_or_bytes()
+template <typename H, typename T>
+typename std::enable_if<!is_uniquely_represented<T>::value, H>::type
+hash_range_or_bytes(H hash_state, const T* data, size_t size) {
+  for (const auto end = data + size; data < end; ++data) {
+    hash_state = H::combine(std::move(hash_state), *data);
+  }
+  return hash_state;
+}
+
+#if defined(ABSL_INTERNAL_LEGACY_HASH_NAMESPACE) && \
+    ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
+#define ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_ 1
+#else
+#define ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_ 0
+#endif
+
+// HashSelect
+//
+// Type trait to select the appropriate hash implementation to use.
+// HashSelect::type<T> will give the proper hash implementation, to be invoked
+// as:
+//   HashSelect::type<T>::Invoke(state, value)
+// Also, HashSelect::type<T>::value is a boolean equal to `true` if there is a
+// valid `Invoke` function. Types that are not hashable will have a ::value of
+// `false`.
+struct HashSelect {
+ private:
+  struct State : HashStateBase<State> {
+    static State combine_contiguous(State hash_state, const unsigned char*,
+                                    size_t);
+    using State::HashStateBase::combine_contiguous;
+  };
+
+  struct UniquelyRepresentedProbe {
+    template <typename H, typename T>
+    static auto Invoke(H state, const T& value)
+        -> absl::enable_if_t<is_uniquely_represented<T>::value, H> {
+      return hash_internal::hash_bytes(std::move(state), value);
+    }
+  };
+
+  struct HashValueProbe {
+    template <typename H, typename T>
+    static auto Invoke(H state, const T& value) -> absl::enable_if_t<
+        std::is_same<H,
+                     decltype(AbslHashValue(std::move(state), value))>::value,
+        H> {
+      return AbslHashValue(std::move(state), value);
+    }
+  };
+
+  struct LegacyHashProbe {
+#if ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_
+    template <typename H, typename T>
+    static auto Invoke(H state, const T& value) -> absl::enable_if_t<
+        std::is_convertible<
+            decltype(ABSL_INTERNAL_LEGACY_HASH_NAMESPACE::hash<T>()(value)),
+            size_t>::value,
+        H> {
+      return hash_internal::hash_bytes(
+          std::move(state),
+          ABSL_INTERNAL_LEGACY_HASH_NAMESPACE::hash<T>{}(value));
+    }
+#endif  // ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_
+  };
+
+  struct StdHashProbe {
+    template <typename H, typename T>
+    static auto Invoke(H state, const T& value)
+        -> absl::enable_if_t<type_traits_internal::IsHashable<T>::value, H> {
+      return hash_internal::hash_bytes(std::move(state), std::hash<T>{}(value));
+    }
+  };
+
+  template <typename Hash, typename T>
+  struct Probe : Hash {
+   private:
+    template <typename H, typename = decltype(H::Invoke(
+                              std::declval<State>(), std::declval<const T&>()))>
+    static std::true_type Test(int);
+    template <typename U>
+    static std::false_type Test(char);
+
+   public:
+    static constexpr bool value = decltype(Test<Hash>(0))::value;
+  };
+
+ public:
+  // Probe each implementation in order.
+  // disjunction provides short circuiting wrt instantiation.
+  template <typename T>
+  using Apply = absl::disjunction<         //
+      Probe<UniquelyRepresentedProbe, T>,  //
+      Probe<HashValueProbe, T>,            //
+      Probe<LegacyHashProbe, T>,           //
+      Probe<StdHashProbe, T>,              //
+      std::false_type>;
+};
+
+template <typename T>
+struct is_hashable
+    : std::integral_constant<bool, HashSelect::template Apply<T>::value> {};
+
+// CityHashState
+class CityHashState : public HashStateBase<CityHashState> {
+  // absl::uint128 is not an alias or a thin wrapper around the intrinsic.
+  // We use the intrinsic when available to improve performance.
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+  using uint128 = __uint128_t;
+#else   // ABSL_HAVE_INTRINSIC_INT128
+  using uint128 = absl::uint128;
+#endif  // ABSL_HAVE_INTRINSIC_INT128
+
+  static constexpr uint64_t kMul =
+      sizeof(size_t) == 4 ? uint64_t{0xcc9e2d51} : uint64_t{0x9ddfea08eb382d69};
+
+  template <typename T>
+  using IntegralFastPath =
+      conjunction<std::is_integral<T>, is_uniquely_represented<T>>;
+
+ public:
+  // Move only
+  CityHashState(CityHashState&&) = default;
+  CityHashState& operator=(CityHashState&&) = default;
+
+  // CityHashState::combine_contiguous()
+  //
+  // Fundamental base case for hash recursion: mixes the given range of bytes
+  // into the hash state.
+  static CityHashState combine_contiguous(CityHashState hash_state,
+                                          const unsigned char* first,
+                                          size_t size) {
+    return CityHashState(
+        CombineContiguousImpl(hash_state.state_, first, size,
+                              std::integral_constant<int, sizeof(size_t)>{}));
+  }
+  using CityHashState::HashStateBase::combine_contiguous;
+
+  // CityHashState::hash()
+  //
+  // For performance reasons in non-opt mode, we specialize this for
+  // integral types.
+  // Otherwise we would be instantiating and calling dozens of functions for
+  // something that is just one multiplication and a couple xor's.
+  // The result should be the same as running the whole algorithm, but faster.
+  template <typename T, absl::enable_if_t<IntegralFastPath<T>::value, int> = 0>
+  static size_t hash(T value) {
+    return static_cast<size_t>(Mix(Seed(), static_cast<uint64_t>(value)));
+  }
+
+  // Overload of CityHashState::hash()
+  template <typename T, absl::enable_if_t<!IntegralFastPath<T>::value, int> = 0>
+  static size_t hash(const T& value) {
+    return static_cast<size_t>(combine(CityHashState{}, value).state_);
+  }
+
+ private:
+  // Invoked only once for a given argument; that plus the fact that this is
+  // move-only ensures that there is only one non-moved-from object.
+  CityHashState() : state_(Seed()) {}
+
+  // Workaround for MSVC bug.
+  // We make the type copyable to fix the calling convention, even though we
+  // never actually copy it. Keep it private to not affect the public API of the
+  // type.
+  CityHashState(const CityHashState&) = default;
+
+  explicit CityHashState(uint64_t state) : state_(state) {}
+
+  // Implementation of the base case for combine_contiguous where we actually
+  // mix the bytes into the state.
+  // Dispatch to different implementations of the combine_contiguous depending
+  // on the value of `sizeof(size_t)`.
+  static uint64_t CombineContiguousImpl(uint64_t state,
+                                        const unsigned char* first, size_t len,
+                                        std::integral_constant<int, 4>
+                                        /* sizeof_size_t */);
+  static uint64_t CombineContiguousImpl(uint64_t state,
+                                        const unsigned char* first, size_t len,
+                                        std::integral_constant<int, 8>
+                                        /* sizeof_size_t*/);
+
+  // Reads 9 to 16 bytes from p.
+  // The first 8 bytes are in .first, the rest (zero padded) bytes are in
+  // .second.
+  static std::pair<uint64_t, uint64_t> Read9To16(const unsigned char* p,
+                                                 size_t len) {
+    uint64_t high = little_endian::Load64(p + len - 8);
+    return {little_endian::Load64(p), high >> (128 - len * 8)};
+  }
+
+  // Reads 4 to 8 bytes from p. Zero pads to fill uint64_t.
+  static uint64_t Read4To8(const unsigned char* p, size_t len) {
+    return (static_cast<uint64_t>(little_endian::Load32(p + len - 4))
+            << (len - 4) * 8) |
+           little_endian::Load32(p);
+  }
+
+  // Reads 1 to 3 bytes from p. Zero pads to fill uint32_t.
+  static uint32_t Read1To3(const unsigned char* p, size_t len) {
+    return static_cast<uint32_t>((p[0]) |                         //
+                                 (p[len / 2] << (len / 2 * 8)) |  //
+                                 (p[len - 1] << ((len - 1) * 8)));
+  }
+
+  ABSL_ATTRIBUTE_ALWAYS_INLINE static uint64_t Mix(uint64_t state, uint64_t v) {
+    using MultType =
+        absl::conditional_t<sizeof(size_t) == 4, uint64_t, uint128>;
+    // We do the addition in 64-bit space to make sure the 128-bit
+    // multiplication is fast. If we were to do it as MultType the compiler has
+    // to assume that the high word is non-zero and needs to perform 2
+    // multiplications instead of one.
+    MultType m = state + v;
+    m *= kMul;
+    return static_cast<uint64_t>(m ^ (m >> (sizeof(m) * 8 / 2)));
+  }
+
+  // Seed()
+  //
+  // A non-deterministic seed.
+  //
+  // The current purpose of this seed is to generate non-deterministic results
+  // and prevent having users depend on the particular hash values.
+  // It is not meant as a security feature right now, but it leaves the door
+  // open to upgrade it to a true per-process random seed. A true random seed
+  // costs more and we don't need to pay for that right now.
+  //
+  // On platforms with ASLR, we take advantage of it to make a per-process
+  // random value.
+  // See https://en.wikipedia.org/wiki/Address_space_layout_randomization
+  //
+  // On other platforms this is still going to be non-deterministic but most
+  // probably per-build and not per-process.
+  ABSL_ATTRIBUTE_ALWAYS_INLINE static uint64_t Seed() {
+    return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(kSeed));
+  }
+  static const void* const kSeed;
+
+  uint64_t state_;
+};
+
+// CityHashState::CombineContiguousImpl()
+inline uint64_t CityHashState::CombineContiguousImpl(
+    uint64_t state, const unsigned char* first, size_t len,
+    std::integral_constant<int, 4> /* sizeof_size_t */) {
+  // For large values we use CityHash, for small ones we just use a
+  // multiplicative hash.
+  uint64_t v;
+  if (len > 8) {
+    v = absl::hash_internal::CityHash32(reinterpret_cast<const char*>(first), len);
+  } else if (len >= 4) {
+    v = Read4To8(first, len);
+  } else if (len > 0) {
+    v = Read1To3(first, len);
+  } else {
+    // Empty ranges have no effect.
+    return state;
+  }
+  return Mix(state, v);
+}
+
+// Overload of CityHashState::CombineContiguousImpl()
+inline uint64_t CityHashState::CombineContiguousImpl(
+    uint64_t state, const unsigned char* first, size_t len,
+    std::integral_constant<int, 8> /* sizeof_size_t */) {
+  // For large values we use CityHash, for small ones we just use a
+  // multiplicative hash.
+  uint64_t v;
+  if (len > 16) {
+    v = absl::hash_internal::CityHash64(reinterpret_cast<const char*>(first), len);
+  } else if (len > 8) {
+    auto p = Read9To16(first, len);
+    state = Mix(state, p.first);
+    v = p.second;
+  } else if (len >= 4) {
+    v = Read4To8(first, len);
+  } else if (len > 0) {
+    v = Read1To3(first, len);
+  } else {
+    // Empty ranges have no effect.
+    return state;
+  }
+  return Mix(state, v);
+}
+
+
+struct AggregateBarrier {};
+
+// HashImpl
+
+// Add a private base class to make sure this type is not an aggregate.
+// Aggregates can be aggregate initialized even if the default constructor is
+// deleted.
+struct PoisonedHash : private AggregateBarrier {
+  PoisonedHash() = delete;
+  PoisonedHash(const PoisonedHash&) = delete;
+  PoisonedHash& operator=(const PoisonedHash&) = delete;
+};
+
+template <typename T>
+struct HashImpl {
+  size_t operator()(const T& value) const { return CityHashState::hash(value); }
+};
+
+template <typename T>
+struct Hash
+    : absl::conditional_t<is_hashable<T>::value, HashImpl<T>, PoisonedHash> {};
+
+template <typename H>
+template <typename T, typename... Ts>
+H HashStateBase<H>::combine(H state, const T& value, const Ts&... values) {
+  return H::combine(hash_internal::HashSelect::template Apply<T>::Invoke(
+                        std::move(state), value),
+                    values...);
+}
+
+// HashStateBase::combine_contiguous()
+template <typename H>
+template <typename T>
+H HashStateBase<H>::combine_contiguous(H state, const T* data, size_t size) {
+  return hash_internal::hash_range_or_bytes(std::move(state), data, size);
+}
+}  // namespace hash_internal
+}  // namespace absl
+
+#endif  // ABSL_HASH_INTERNAL_HASH_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h
new file mode 100644 (file)
index 0000000..c4cc8d0
--- /dev/null
@@ -0,0 +1,216 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_
+#define ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_
+
+#include <ostream>
+#include <string>
+#include <vector>
+
+#include "absl/hash/hash.h"
+#include "absl/strings/match.h"
+#include "absl/strings/str_format.h"
+#include "absl/strings/str_join.h"
+
+namespace absl {
+namespace hash_internal {
+
+// SpyHashState is an implementation of the HashState API that simply
+// accumulates all input bytes in an internal buffer. This makes it useful
+// for testing AbslHashValue overloads (so long as they are templated on the
+// HashState parameter), since it can report the exact hash representation
+// that the AbslHashValue overload produces.
+//
+// Sample usage:
+// EXPECT_EQ(SpyHashState::combine(SpyHashState(), foo),
+//           SpyHashState::combine(SpyHashState(), bar));
+template <typename T>
+class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> {
+ public:
+  SpyHashStateImpl() : error_(std::make_shared<absl::optional<std::string>>()) {
+    static_assert(std::is_void<T>::value, "");
+  }
+
+  // Move-only
+  SpyHashStateImpl(const SpyHashStateImpl&) = delete;
+  SpyHashStateImpl& operator=(const SpyHashStateImpl&) = delete;
+
+  SpyHashStateImpl(SpyHashStateImpl&& other) noexcept {
+    *this = std::move(other);
+  }
+
+  SpyHashStateImpl& operator=(SpyHashStateImpl&& other) noexcept {
+    hash_representation_ = std::move(other.hash_representation_);
+    error_ = other.error_;
+    moved_from_ = other.moved_from_;
+    other.moved_from_ = true;
+    return *this;
+  }
+
+  template <typename U>
+  SpyHashStateImpl(SpyHashStateImpl<U>&& other) {  // NOLINT
+    hash_representation_ = std::move(other.hash_representation_);
+    error_ = other.error_;
+    moved_from_ = other.moved_from_;
+    other.moved_from_ = true;
+  }
+
+  template <typename A, typename... Args>
+  static SpyHashStateImpl combine(SpyHashStateImpl s, const A& a,
+                                  const Args&... args) {
+    // Pass an instance of SpyHashStateImpl<A> when trying to combine `A`. This
+    // allows us to test that the user only uses this instance for combine calls
+    // and does not call AbslHashValue directly.
+    // See AbslHashValue implementation at the bottom.
+    s = SpyHashStateImpl<A>::HashStateBase::combine(std::move(s), a);
+    return SpyHashStateImpl::combine(std::move(s), args...);
+  }
+  static SpyHashStateImpl combine(SpyHashStateImpl s) {
+    if (direct_absl_hash_value_error_) {
+      *s.error_ = "AbslHashValue should not be invoked directly.";
+    } else if (s.moved_from_) {
+      *s.error_ = "Used moved-from instance of the hash state object.";
+    }
+    return s;
+  }
+
+  static void SetDirectAbslHashValueError() {
+    direct_absl_hash_value_error_ = true;
+  }
+
+  // Two SpyHashStateImpl objects are equal if they hold equal hash
+  // representations.
+  friend bool operator==(const SpyHashStateImpl& lhs,
+                         const SpyHashStateImpl& rhs) {
+    return lhs.hash_representation_ == rhs.hash_representation_;
+  }
+
+  friend bool operator!=(const SpyHashStateImpl& lhs,
+                         const SpyHashStateImpl& rhs) {
+    return !(lhs == rhs);
+  }
+
+  enum class CompareResult {
+    kEqual,
+    kASuffixB,
+    kBSuffixA,
+    kUnequal,
+  };
+
+  static CompareResult Compare(const SpyHashStateImpl& a,
+                               const SpyHashStateImpl& b) {
+    const std::string a_flat = absl::StrJoin(a.hash_representation_, "");
+    const std::string b_flat = absl::StrJoin(b.hash_representation_, "");
+    if (a_flat == b_flat) return CompareResult::kEqual;
+    if (absl::EndsWith(a_flat, b_flat)) return CompareResult::kBSuffixA;
+    if (absl::EndsWith(b_flat, a_flat)) return CompareResult::kASuffixB;
+    return CompareResult::kUnequal;
+  }
+
+  // operator<< prints the hash representation as a hex and ASCII dump, to
+  // facilitate debugging.
+  friend std::ostream& operator<<(std::ostream& out,
+                                  const SpyHashStateImpl& hash_state) {
+    out << "[\n";
+    for (auto& s : hash_state.hash_representation_) {
+      size_t offset = 0;
+      for (char c : s) {
+        if (offset % 16 == 0) {
+          out << absl::StreamFormat("\n0x%04x: ", offset);
+        }
+        if (offset % 2 == 0) {
+          out << " ";
+        }
+        out << absl::StreamFormat("%02x", c);
+        ++offset;
+      }
+      out << "\n";
+    }
+    return out << "]";
+  }
+
+  // The base case of the combine recursion, which writes raw bytes into the
+  // internal buffer.
+  static SpyHashStateImpl combine_contiguous(SpyHashStateImpl hash_state,
+                                             const unsigned char* begin,
+                                             size_t size) {
+    hash_state.hash_representation_.emplace_back(
+        reinterpret_cast<const char*>(begin), size);
+    return hash_state;
+  }
+
+  using SpyHashStateImpl::HashStateBase::combine_contiguous;
+
+  absl::optional<std::string> error() const {
+    if (moved_from_) {
+      return "Returned a moved-from instance of the hash state object.";
+    }
+    return *error_;
+  }
+
+ private:
+  template <typename U>
+  friend class SpyHashStateImpl;
+
+  // This is true if SpyHashStateImpl<T> has been passed to a call of
+  // AbslHashValue with the wrong type. This detects that the user called
+  // AbslHashValue directly (because the hash state type does not match).
+  static bool direct_absl_hash_value_error_;
+
+  std::vector<std::string> hash_representation_;
+  // This is a shared_ptr because we want all instances of the particular
+  // SpyHashState run to share the field. This way we can set the error for
+  // use-after-move and all the copies will see it.
+  std::shared_ptr<absl::optional<std::string>> error_;
+  bool moved_from_ = false;
+};
+
+template <typename T>
+bool SpyHashStateImpl<T>::direct_absl_hash_value_error_;
+
+template <bool& B>
+struct OdrUse {
+  constexpr OdrUse() {}
+  bool& b = B;
+};
+
+template <void (*)()>
+struct RunOnStartup {
+  static bool run;
+  static constexpr OdrUse<run> kOdrUse{};
+};
+
+template <void (*f)()>
+bool RunOnStartup<f>::run = (f(), true);
+
+template <
+    typename T, typename U,
+    // Only trigger for when (T != U),
+    typename = absl::enable_if_t<!std::is_same<T, U>::value>,
+    // This statement works in two ways:
+    //  - First, it instantiates RunOnStartup and forces the initialization of
+    //    `run`, which set the global variable.
+    //  - Second, it triggers a SFINAE error disabling the overload to prevent
+    //    compile time errors. If we didn't disable the overload we would get
+    //    ambiguous overload errors, which we don't want.
+    int = RunOnStartup<SpyHashStateImpl<T>::SetDirectAbslHashValueError>::run>
+void AbslHashValue(SpyHashStateImpl<T>, const U&);
+
+using SpyHashState = SpyHashStateImpl<void>;
+
+}  // namespace hash_internal
+}  // namespace absl
+
+#endif  // ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_
index c679960..5a4a1a1 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,6 +30,7 @@
 #include <type_traits>
 #include <utility>
 
+#include "absl/base/macros.h"
 #include "absl/meta/type_traits.h"
 
 namespace absl {
@@ -38,15 +39,25 @@ namespace absl {
 // Function Template: WrapUnique()
 // -----------------------------------------------------------------------------
 //
-// Transfers ownership of a raw pointer to a `std::unique_ptr`. The returned
-// value is a `std::unique_ptr` of deduced type.
+// Adopts ownership from a raw pointer and transfers it to the returned
+// `std::unique_ptr`, whose type is deduced. Because of this deduction, *do not*
+// specify the template type `T` when calling `WrapUnique`.
 //
 // Example:
 //   X* NewX(int, int);
 //   auto x = WrapUnique(NewX(1, 2));  // 'x' is std::unique_ptr<X>.
 //
-// `absl::WrapUnique` is useful for capturing the output of a raw pointer
-// factory. However, prefer 'absl::make_unique<T>(args...) over
+// Do not call WrapUnique with an explicit type, as in
+// `WrapUnique<X>(NewX(1, 2))`.  The purpose of WrapUnique is to automatically
+// deduce the pointer type. If you wish to make the type explicit, just use
+// `std::unique_ptr` directly.
+//
+//   auto x = std::unique_ptr<X>(NewX(1, 2));
+//                  - or -
+//   std::unique_ptr<X> x(NewX(1, 2));
+//
+// While `absl::WrapUnique` is useful for capturing the output of a raw
+// pointer factory, prefer 'absl::make_unique<T>(args...)' over
 // 'absl::WrapUnique(new T(args...))'.
 //
 //   auto x = WrapUnique(new X(1, 2));  // works, but nonideal.
@@ -81,6 +92,13 @@ struct MakeUniqueResult<T[N]> {
 
 }  // namespace memory_internal
 
+// gcc 4.8 has __cplusplus at 201301 but doesn't define make_unique.  Other
+// supported compilers either just define __cplusplus as 201103 but have
+// make_unique (msvc), or have make_unique whenever __cplusplus > 201103 (clang)
+#if (__cplusplus > 201103L || defined(_MSC_VER)) && \
+    !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
+using std::make_unique;
+#else
 // -----------------------------------------------------------------------------
 // Function Template: make_unique<T>()
 // -----------------------------------------------------------------------------
@@ -97,7 +115,7 @@ struct MakeUniqueResult<T[N]> {
 //
 // For more background on why `std::unique_ptr<T>(new T(a,b))` is problematic,
 // see Herb Sutter's explanation on
-// (Exception-Safe Function Calls)[http://herbsutter.com/gotw/_102/].
+// (Exception-Safe Function Calls)[https://herbsutter.com/gotw/_102/].
 // (In general, reviewers should treat `new T(a,b)` with scrutiny.)
 //
 // Example usage:
@@ -164,18 +182,19 @@ typename memory_internal::MakeUniqueResult<T>::array make_unique(size_t n) {
 template <typename T, typename... Args>
 typename memory_internal::MakeUniqueResult<T>::invalid make_unique(
     Args&&... /* args */) = delete;
+#endif
 
 // -----------------------------------------------------------------------------
 // Function Template: RawPtr()
 // -----------------------------------------------------------------------------
 //
-// Extracts the raw pointer from a pointer-like 'ptr'. `absl::RawPtr` is useful
-// within templates that need to handle a complement of raw pointers,
+// Extracts the raw pointer from a pointer-like value `ptr`. `absl::RawPtr` is
+// useful within templates that need to handle a complement of raw pointers,
 // `std::nullptr_t`, and smart pointers.
 template <typename T>
-auto RawPtr(T&& ptr) -> decltype(&*ptr) {
+auto RawPtr(T&& ptr) -> decltype(std::addressof(*ptr)) {
   // ptr is a forwarding reference to support Ts with non-const operators.
-  return (ptr != nullptr) ? &*ptr : nullptr;
+  return (ptr != nullptr) ? std::addressof(*ptr) : nullptr;
 }
 inline std::nullptr_t RawPtr(std::nullptr_t) { return nullptr; }
 
@@ -183,9 +202,9 @@ inline std::nullptr_t RawPtr(std::nullptr_t) { return nullptr; }
 // Function Template: ShareUniquePtr()
 // -----------------------------------------------------------------------------
 //
-// Transforms a `std::unique_ptr` rvalue into a `std::shared_ptr`. The returned
-// value is a `std::shared_ptr` of deduced type and ownership is transferred to
-// the shared pointer.
+// Adopts a `std::unique_ptr` rvalue and returns a `std::shared_ptr` of deduced
+// type. Ownership (if any) of the held value is transferred to the returned
+// shared pointer.
 //
 // Example:
 //
@@ -194,8 +213,11 @@ inline std::nullptr_t RawPtr(std::nullptr_t) { return nullptr; }
 //     CHECK_EQ(*sp, 10);
 //     CHECK(up == nullptr);
 //
-// Note that this conversion is correct even when T is an array type, although
-// the resulting shared pointer may not be very useful.
+// Note that this conversion is correct even when T is an array type, and more
+// generally it works for *any* deleter of the `unique_ptr` (single-object
+// deleter, array deleter, or any custom deleter), since the deleter is adopted
+// by the shared pointer as well. The deleter is copied (unless it is a
+// reference).
 //
 // Implements the resolution of [LWG 2415](http://wg21.link/lwg2415), by which a
 // null shared pointer does not attempt to call the deleter.
@@ -311,13 +333,23 @@ struct RebindPtr<T, U, void_t<typename T::template rebind<U>>> {
   using type = typename T::template rebind<U>;
 };
 
-template <typename T, typename U, typename = void>
+template <typename T, typename U>
+constexpr bool HasRebindAlloc(...) {
+  return false;
+}
+
+template <typename T, typename U>
+constexpr bool HasRebindAlloc(typename T::template rebind<U>::other*) {
+  return true;
+}
+
+template <typename T, typename U, bool = HasRebindAlloc<T, U>(nullptr)>
 struct RebindAlloc {
   using type = typename RebindFirstArg<T, U>::type;
 };
 
 template <typename T, typename U>
-struct RebindAlloc<T, U, void_t<typename T::template rebind<U>::other>> {
+struct RebindAlloc<T, U, true> {
   using type = typename T::template rebind<U>::other;
 };
 
@@ -562,7 +594,7 @@ struct allocator_traits {
     return a.max_size();
   }
   static size_type max_size_impl(char, const Alloc&) {
-    return std::numeric_limits<size_type>::max() / sizeof(value_type);
+    return (std::numeric_limits<size_type>::max)() / sizeof(value_type);
   }
 
   template <typename A>
@@ -609,7 +641,7 @@ struct allocator_is_nothrow
     : memory_internal::ExtractOrT<memory_internal::GetIsNothrow, Alloc,
                                   std::false_type> {};
 
-#if ABSL_ALLOCATOR_NOTHROW
+#if defined(ABSL_ALLOCATOR_NOTHROW) && ABSL_ALLOCATOR_NOTHROW
 template <typename T>
 struct allocator_is_nothrow<std::allocator<T>> : std::true_type {};
 struct default_allocator_is_nothrow : std::true_type {};
@@ -617,6 +649,44 @@ struct default_allocator_is_nothrow : std::true_type {};
 struct default_allocator_is_nothrow : std::false_type {};
 #endif
 
+namespace memory_internal {
+template <typename Allocator, typename Iterator, typename... Args>
+void ConstructRange(Allocator& alloc, Iterator first, Iterator last,
+                    const Args&... args) {
+  for (Iterator cur = first; cur != last; ++cur) {
+    ABSL_INTERNAL_TRY {
+      std::allocator_traits<Allocator>::construct(alloc, std::addressof(*cur),
+                                                  args...);
+    }
+    ABSL_INTERNAL_CATCH_ANY {
+      while (cur != first) {
+        --cur;
+        std::allocator_traits<Allocator>::destroy(alloc, std::addressof(*cur));
+      }
+      ABSL_INTERNAL_RETHROW;
+    }
+  }
+}
+
+template <typename Allocator, typename Iterator, typename InputIterator>
+void CopyRange(Allocator& alloc, Iterator destination, InputIterator first,
+               InputIterator last) {
+  for (Iterator cur = destination; first != last;
+       static_cast<void>(++cur), static_cast<void>(++first)) {
+    ABSL_INTERNAL_TRY {
+      std::allocator_traits<Allocator>::construct(alloc, std::addressof(*cur),
+                                                  *first);
+    }
+    ABSL_INTERNAL_CATCH_ANY {
+      while (cur != destination) {
+        --cur;
+        std::allocator_traits<Allocator>::destroy(alloc, std::addressof(*cur));
+      }
+      ABSL_INTERNAL_RETHROW;
+    }
+  }
+}
+}  // namespace memory_internal
 }  // namespace absl
 
 #endif  // ABSL_MEMORY_MEMORY_H_
index ced6626..c08e375 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,7 +22,7 @@
 // support type inference, classification, and transformation, as well as
 // make it easier to write templates based on generic type behavior.
 //
-// See http://en.cppreference.com/w/cpp/header/type_traits
+// See https://en.cppreference.com/w/cpp/header/type_traits
 //
 // WARNING: use of many of the constructs in this header will count as "complex
 // template metaprogramming", so before proceeding, please carefully consider
 #define ABSL_META_TYPE_TRAITS_H_
 
 #include <stddef.h>
+#include <functional>
 #include <type_traits>
 
 #include "absl/base/config.h"
 
 namespace absl {
 
+// Defined and documented later on in this file.
+template <typename T>
+struct is_trivially_move_assignable;
+
 namespace type_traits_internal {
+
+// Silence MSVC warnings about the destructor being defined as deleted.
+#if defined(_MSC_VER) && !defined(__GNUC__)
+#pragma warning(push)
+#pragma warning(disable : 4624)
+#endif  // defined(_MSC_VER) && !defined(__GNUC__)
+
+template <class T>
+union SingleMemberUnion {
+  T t;
+};
+
+// Restore the state of the destructor warning that was silenced above.
+#if defined(_MSC_VER) && !defined(__GNUC__)
+#pragma warning(pop)
+#endif  // defined(_MSC_VER) && !defined(__GNUC__)
+
+template <class T>
+struct IsTriviallyMoveAssignableReference : std::false_type {};
+
+template <class T>
+struct IsTriviallyMoveAssignableReference<T&>
+    : absl::is_trivially_move_assignable<T>::type {};
+
+template <class T>
+struct IsTriviallyMoveAssignableReference<T&&>
+    : absl::is_trivially_move_assignable<T>::type {};
+
 template <typename... Ts>
 struct VoidTImpl {
   using type = void;
@@ -60,8 +93,68 @@ struct default_alignment_of_aligned_storage<Len,
   static constexpr size_t value = Align;
 };
 
+////////////////////////////////
+// Library Fundamentals V2 TS //
+////////////////////////////////
+
+// NOTE: The `is_detected` family of templates here differ from the library
+// fundamentals specification in that for library fundamentals, `Op<Args...>` is
+// evaluated as soon as the type `is_detected<Op, Args...>` undergoes
+// substitution, regardless of whether or not the `::value` is accessed. That
+// is inconsistent with all other standard traits and prevents lazy evaluation
+// in larger contexts (such as if the `is_detected` check is a trailing argument
+// of a `conjunction`. This implementation opts to instead be lazy in the same
+// way that the standard traits are (this "defect" of the detection idiom
+// specifications has been reported).
+
+template <class Enabler, template <class...> class Op, class... Args>
+struct is_detected_impl {
+  using type = std::false_type;
+};
+
+template <template <class...> class Op, class... Args>
+struct is_detected_impl<typename VoidTImpl<Op<Args...>>::type, Op, Args...> {
+  using type = std::true_type;
+};
+
+template <template <class...> class Op, class... Args>
+struct is_detected : is_detected_impl<void, Op, Args...>::type {};
+
+template <class Enabler, class To, template <class...> class Op, class... Args>
+struct is_detected_convertible_impl {
+  using type = std::false_type;
+};
+
+template <class To, template <class...> class Op, class... Args>
+struct is_detected_convertible_impl<
+    typename std::enable_if<std::is_convertible<Op<Args...>, To>::value>::type,
+    To, Op, Args...> {
+  using type = std::true_type;
+};
+
+template <class To, template <class...> class Op, class... Args>
+struct is_detected_convertible
+    : is_detected_convertible_impl<void, To, Op, Args...>::type {};
+
+template <typename T>
+using IsCopyAssignableImpl =
+    decltype(std::declval<T&>() = std::declval<const T&>());
+
+template <typename T>
+using IsMoveAssignableImpl = decltype(std::declval<T&>() = std::declval<T&&>());
+
 }  // namespace type_traits_internal
 
+template <typename T>
+struct is_copy_assignable : type_traits_internal::is_detected<
+                                type_traits_internal::IsCopyAssignableImpl, T> {
+};
+
+template <typename T>
+struct is_move_assignable : type_traits_internal::is_detected<
+                                type_traits_internal::IsMoveAssignableImpl, T> {
+};
+
 // void_t()
 //
 // Ignores the type of any its arguments and returns `void`. In general, this
@@ -72,7 +165,7 @@ struct default_alignment_of_aligned_storage<Len,
 // `std::void_t` metafunction.
 //
 // NOTE: `absl::void_t` does not use the standard-specified implementation so
-// that it can remain compatibile with gcc < 5.1. This can introduce slightly
+// that it can remain compatible with gcc < 5.1. This can introduce slightly
 // different behavior, such as when ordering partial specializations.
 template <typename... Ts>
 using void_t = typename type_traits_internal::VoidTImpl<Ts...>::type;
@@ -135,8 +228,11 @@ struct negation : std::integral_constant<bool, !T::value> {};
 //
 // Determines whether the passed type `T` is trivially destructable.
 //
-// This metafunction is designed to be a drop-in replacement for the C++17
-// `std::is_trivially_destructible()` metafunction.
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_destructible()` metafunction for platforms that have
+// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
+// fully support C++11, we check whether this yields the same result as the std
+// implementation.
 //
 // NOTE: the extensions (__has_trivial_xxx) are implemented in gcc (version >=
 // 4.3) and clang. Since we are supporting libstdc++ > 4.7, they should always
@@ -145,11 +241,17 @@ struct negation : std::integral_constant<bool, !T::value> {};
 template <typename T>
 struct is_trivially_destructible
     : std::integral_constant<bool, __has_trivial_destructor(T) &&
-                                       std::is_destructible<T>::value> {
+                                   std::is_destructible<T>::value> {
 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
-  static_assert(std::is_trivially_destructible<T>::value ==
-                    is_trivially_destructible::value,
-                "Not compliant with std::is_trivially_destructible");
+ private:
+  static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
+                                    is_trivially_destructible::value;
+  static_assert(compliant || std::is_trivially_destructible<T>::value,
+                "Not compliant with std::is_trivially_destructible; "
+                "Standard: false, Implementation: true");
+  static_assert(compliant || !std::is_trivially_destructible<T>::value,
+                "Not compliant with std::is_trivially_destructible; "
+                "Standard: true, Implementation: false");
 #endif  // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
 };
 
@@ -157,8 +259,11 @@ struct is_trivially_destructible
 //
 // Determines whether the passed type `T` is trivially default constructible.
 //
-// This metafunction is designed to be a drop-in replacement for the C++17
-// `std::is_trivially_default_constructible()` metafunction.
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_default_constructible()` metafunction for platforms that
+// have incomplete C++11 support (such as libstdc++ 4.x). On any platforms that
+// do fully support C++11, we check whether this yields the same result as the
+// std implementation.
 //
 // NOTE: according to the C++ standard, Section: 20.15.4.3 [meta.unary.prop]
 // "The predicate condition for a template specialization is_constructible<T,
@@ -172,7 +277,7 @@ struct is_trivially_destructible
 // For the purposes of this check, the call to std::declval is considered
 // trivial."
 //
-// Notes from http://en.cppreference.com/w/cpp/types/is_constructible:
+// Notes from https://en.cppreference.com/w/cpp/types/is_constructible:
 // In many implementations, is_nothrow_constructible also checks if the
 // destructor throws because it is effectively noexcept(T(arg)). Same
 // applies to is_trivially_constructible, which, in these implementations, also
@@ -180,18 +285,58 @@ struct is_trivially_destructible
 // GCC bug 51452: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452
 // LWG issue 2116: http://cplusplus.github.io/LWG/lwg-active.html#2116.
 //
-// "T obj();" need to be well-formed and not call any non-trivial operation.
-// Nontrivally destructible types will cause the expression to be nontrivial.
+// "T obj();" need to be well-formed and not call any nontrivial operation.
+// Nontrivially destructible types will cause the expression to be nontrivial.
 template <typename T>
 struct is_trivially_default_constructible
-    : std::integral_constant<bool,
-                             __has_trivial_constructor(T) &&
-                                 std::is_default_constructible<T>::value &&
-                                 is_trivially_destructible<T>::value> {
+    : std::integral_constant<bool, __has_trivial_constructor(T) &&
+                                   std::is_default_constructible<T>::value &&
+                                   is_trivially_destructible<T>::value> {
 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
-  static_assert(std::is_trivially_default_constructible<T>::value ==
-                    is_trivially_default_constructible::value,
-                "Not compliant with std::is_trivially_default_constructible");
+ private:
+  static constexpr bool compliant =
+      std::is_trivially_default_constructible<T>::value ==
+      is_trivially_default_constructible::value;
+  static_assert(compliant || std::is_trivially_default_constructible<T>::value,
+                "Not compliant with std::is_trivially_default_constructible; "
+                "Standard: false, Implementation: true");
+  static_assert(compliant || !std::is_trivially_default_constructible<T>::value,
+                "Not compliant with std::is_trivially_default_constructible; "
+                "Standard: true, Implementation: false");
+#endif  // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
+};
+
+// is_trivially_move_constructible()
+//
+// Determines whether the passed type `T` is trivially move constructible.
+//
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_move_constructible()` metafunction for platforms that have
+// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
+// fully support C++11, we check whether this yields the same result as the std
+// implementation.
+//
+// NOTE: `T obj(declval<T>());` needs to be well-formed and not call any
+// nontrivial operation.  Nontrivially destructible types will cause the
+// expression to be nontrivial.
+template <typename T>
+struct is_trivially_move_constructible
+    : std::conditional<
+          std::is_object<T>::value && !std::is_array<T>::value,
+          std::is_move_constructible<
+              type_traits_internal::SingleMemberUnion<T>>,
+          std::is_reference<T>>::type::type {
+#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
+ private:
+  static constexpr bool compliant =
+      std::is_trivially_move_constructible<T>::value ==
+      is_trivially_move_constructible::value;
+  static_assert(compliant || std::is_trivially_move_constructible<T>::value,
+                "Not compliant with std::is_trivially_move_constructible; "
+                "Standard: false, Implementation: true");
+  static_assert(compliant || !std::is_trivially_move_constructible<T>::value,
+                "Not compliant with std::is_trivially_move_constructible; "
+                "Standard: true, Implementation: false");
 #endif  // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
 };
 
@@ -199,47 +344,149 @@ struct is_trivially_default_constructible
 //
 // Determines whether the passed type `T` is trivially copy constructible.
 //
-// This metafunction is designed to be a drop-in replacement for the C++17
-// `std::is_trivially_copy_constructible()` metafunction.
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_copy_constructible()` metafunction for platforms that have
+// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
+// fully support C++11, we check whether this yields the same result as the std
+// implementation.
 //
 // NOTE: `T obj(declval<const T&>());` needs to be well-formed and not call any
-// nontrivial operation.  Nontrivally destructible types will cause the
+// nontrivial operation.  Nontrivially destructible types will cause the
 // expression to be nontrivial.
 template <typename T>
 struct is_trivially_copy_constructible
-    : std::integral_constant<bool, __has_trivial_copy(T) &&
-                                       std::is_copy_constructible<T>::value &&
-                                       is_trivially_destructible<T>::value> {
+    : std::conditional<
+          std::is_object<T>::value && !std::is_array<T>::value,
+          std::is_copy_constructible<
+              type_traits_internal::SingleMemberUnion<T>>,
+          std::is_lvalue_reference<T>>::type::type {
 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
-  static_assert(std::is_trivially_copy_constructible<T>::value ==
-                    is_trivially_copy_constructible::value,
-                "Not compliant with std::is_trivially_copy_constructible");
+ private:
+  static constexpr bool compliant =
+      std::is_trivially_copy_constructible<T>::value ==
+      is_trivially_copy_constructible::value;
+  static_assert(compliant || std::is_trivially_copy_constructible<T>::value,
+                "Not compliant with std::is_trivially_copy_constructible; "
+                "Standard: false, Implementation: true");
+  static_assert(compliant || !std::is_trivially_copy_constructible<T>::value,
+                "Not compliant with std::is_trivially_copy_constructible; "
+                "Standard: true, Implementation: false");
 #endif  // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
 };
 
+// is_trivially_move_assignable()
+//
+// Determines whether the passed type `T` is trivially move assignable.
+//
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_move_assignable()` metafunction for platforms that have
+// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
+// fully support C++11, we check whether this yields the same result as the std
+// implementation.
+//
+// NOTE: `is_assignable<T, U>::value` is `true` if the expression
+// `declval<T>() = declval<U>()` is well-formed when treated as an unevaluated
+// operand. `is_trivially_assignable<T, U>` requires the assignment to call no
+// operation that is not trivial. `is_trivially_copy_assignable<T>` is simply
+// `is_trivially_assignable<T&, T>`.
+template <typename T>
+struct is_trivially_move_assignable
+    : std::conditional<
+          std::is_object<T>::value && !std::is_array<T>::value,
+          std::is_move_assignable<type_traits_internal::SingleMemberUnion<T>>,
+          type_traits_internal::IsTriviallyMoveAssignableReference<T>>::type::
+          type {
+#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
+ private:
+  static constexpr bool compliant =
+      std::is_trivially_move_assignable<T>::value ==
+      is_trivially_move_assignable::value;
+  static_assert(compliant || std::is_trivially_move_assignable<T>::value,
+                "Not compliant with std::is_trivially_move_assignable; "
+                "Standard: false, Implementation: true");
+  static_assert(compliant || !std::is_trivially_move_assignable<T>::value,
+                "Not compliant with std::is_trivially_move_assignable; "
+                "Standard: true, Implementation: false");
+#endif  // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
+};
+
 // is_trivially_copy_assignable()
 //
 // Determines whether the passed type `T` is trivially copy assignable.
 //
-// This metafunction is designed to be a drop-in replacement for the C++17
-// `std::is_trivially_copy_assignable()` metafunction.
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_copy_assignable()` metafunction for platforms that have
+// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
+// fully support C++11, we check whether this yields the same result as the std
+// implementation.
 //
 // NOTE: `is_assignable<T, U>::value` is `true` if the expression
 // `declval<T>() = declval<U>()` is well-formed when treated as an unevaluated
 // operand. `is_trivially_assignable<T, U>` requires the assignment to call no
 // operation that is not trivial. `is_trivially_copy_assignable<T>` is simply
-// `is_trivially_assignable<T, const T&>`.
+// `is_trivially_assignable<T&, const T&>`.
 template <typename T>
 struct is_trivially_copy_assignable
-    : std::integral_constant<bool, __has_trivial_assign(T) &&
-                                       std::is_copy_assignable<T>::value> {
+    : std::integral_constant<
+          bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
+                    absl::is_copy_assignable<T>::value> {
 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
-  static_assert(std::is_trivially_copy_assignable<T>::value ==
-                    is_trivially_copy_assignable::value,
-                "Not compliant with std::is_trivially_copy_assignable");
+ private:
+  static constexpr bool compliant =
+      std::is_trivially_copy_assignable<T>::value ==
+      is_trivially_copy_assignable::value;
+  static_assert(compliant || std::is_trivially_copy_assignable<T>::value,
+                "Not compliant with std::is_trivially_copy_assignable; "
+                "Standard: false, Implementation: true");
+  static_assert(compliant || !std::is_trivially_copy_assignable<T>::value,
+                "Not compliant with std::is_trivially_copy_assignable; "
+                "Standard: true, Implementation: false");
 #endif  // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
 };
 
+namespace type_traits_internal {
+// is_trivially_copyable()
+//
+// Determines whether the passed type `T` is trivially copyable.
+//
+// This metafunction is designed to be a drop-in replacement for the C++11
+// `std::is_trivially_copyable()` metafunction for platforms that have
+// incomplete C++11 support (such as libstdc++ 4.x). We use the C++17 definition
+// of TriviallyCopyable.
+//
+// NOTE: `is_trivially_copyable<T>::value` is `true` if all of T's copy/move
+// constructors/assignment operators are trivial or deleted, T has at least
+// one non-deleted copy/move constructor/assignment operator, and T is trivially
+// destructible. Arrays of trivially copyable types are trivially copyable.
+//
+// We expose this metafunction only for internal use within absl.
+template <typename T>
+class is_trivially_copyable_impl {
+  using ExtentsRemoved = typename std::remove_all_extents<T>::type;
+  static constexpr bool kIsCopyOrMoveConstructible =
+      std::is_copy_constructible<ExtentsRemoved>::value ||
+      std::is_move_constructible<ExtentsRemoved>::value;
+  static constexpr bool kIsCopyOrMoveAssignable =
+      absl::is_copy_assignable<ExtentsRemoved>::value ||
+      absl::is_move_assignable<ExtentsRemoved>::value;
+
+ public:
+  static constexpr bool kValue =
+      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
+      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
+      (kIsCopyOrMoveConstructible || kIsCopyOrMoveAssignable) &&
+      is_trivially_destructible<ExtentsRemoved>::value &&
+      // We need to check for this explicitly because otherwise we'll say
+      // references are trivial copyable when compiled by MSVC.
+      !std::is_reference<ExtentsRemoved>::value;
+};
+
+template <typename T>
+struct is_trivially_copyable
+    : std::integral_constant<
+          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
+}  // namespace type_traits_internal
+
 // -----------------------------------------------------------------------------
 // C++14 "_t" trait aliases
 // -----------------------------------------------------------------------------
@@ -311,5 +558,140 @@ using underlying_type_t = typename std::underlying_type<T>::type;
 template <typename T>
 using result_of_t = typename std::result_of<T>::type;
 
+namespace type_traits_internal {
+// In MSVC we can't probe std::hash or stdext::hash because it triggers a
+// static_assert instead of failing substitution. Libc++ prior to 4.0
+// also used a static_assert.
+//
+#if defined(_MSC_VER) || (defined(_LIBCPP_VERSION) && \
+                          _LIBCPP_VERSION < 4000 && _LIBCPP_STD_VER > 11)
+#define ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ 0
+#else
+#define ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ 1
+#endif
+
+#if !ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
+template <typename Key, typename = size_t>
+struct IsHashable : std::true_type {};
+#else   // ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
+template <typename Key, typename = void>
+struct IsHashable : std::false_type {};
+
+template <typename Key>
+struct IsHashable<
+    Key,
+    absl::enable_if_t<std::is_convertible<
+        decltype(std::declval<std::hash<Key>&>()(std::declval<Key const&>())),
+        std::size_t>::value>> : std::true_type {};
+#endif  // !ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
+
+struct AssertHashEnabledHelper {
+ private:
+  static void Sink(...) {}
+  struct NAT {};
+
+  template <class Key>
+  static auto GetReturnType(int)
+      -> decltype(std::declval<std::hash<Key>>()(std::declval<Key const&>()));
+  template <class Key>
+  static NAT GetReturnType(...);
+
+  template <class Key>
+  static std::nullptr_t DoIt() {
+    static_assert(IsHashable<Key>::value,
+                  "std::hash<Key> does not provide a call operator");
+    static_assert(
+        std::is_default_constructible<std::hash<Key>>::value,
+        "std::hash<Key> must be default constructible when it is enabled");
+    static_assert(
+        std::is_copy_constructible<std::hash<Key>>::value,
+        "std::hash<Key> must be copy constructible when it is enabled");
+    static_assert(absl::is_copy_assignable<std::hash<Key>>::value,
+                  "std::hash<Key> must be copy assignable when it is enabled");
+    // is_destructible is unchecked as it's implied by each of the
+    // is_constructible checks.
+    using ReturnType = decltype(GetReturnType<Key>(0));
+    static_assert(std::is_same<ReturnType, NAT>::value ||
+                      std::is_same<ReturnType, size_t>::value,
+                  "std::hash<Key> must return size_t");
+    return nullptr;
+  }
+
+  template <class... Ts>
+  friend void AssertHashEnabled();
+};
+
+template <class... Ts>
+inline void AssertHashEnabled() {
+  using Helper = AssertHashEnabledHelper;
+  Helper::Sink(Helper::DoIt<Ts>()...);
+}
+
+}  // namespace type_traits_internal
+
+// An internal namespace that is required to implement the C++17 swap traits.
+// It is not further nested in type_traits_internal to avoid long symbol names.
+namespace swap_internal {
+
+// Necessary for the traits.
+using std::swap;
+
+// This declaration prevents global `swap` and `absl::swap` overloads from being
+// considered unless ADL picks them up.
+void swap();
+
+template <class T>
+using IsSwappableImpl = decltype(swap(std::declval<T&>(), std::declval<T&>()));
+
+// NOTE: This dance with the default template parameter is for MSVC.
+template <class T,
+          class IsNoexcept = std::integral_constant<
+              bool, noexcept(swap(std::declval<T&>(), std::declval<T&>()))>>
+using IsNothrowSwappableImpl = typename std::enable_if<IsNoexcept::value>::type;
+
+// IsSwappable
+//
+// Determines whether the standard swap idiom is a valid expression for
+// arguments of type `T`.
+template <class T>
+struct IsSwappable
+    : absl::type_traits_internal::is_detected<IsSwappableImpl, T> {};
+
+// IsNothrowSwappable
+//
+// Determines whether the standard swap idiom is a valid expression for
+// arguments of type `T` and is noexcept.
+template <class T>
+struct IsNothrowSwappable
+    : absl::type_traits_internal::is_detected<IsNothrowSwappableImpl, T> {};
+
+// Swap()
+//
+// Performs the swap idiom from a namespace where valid candidates may only be
+// found in `std` or via ADL.
+template <class T, absl::enable_if_t<IsSwappable<T>::value, int> = 0>
+void Swap(T& lhs, T& rhs) noexcept(IsNothrowSwappable<T>::value) {
+  swap(lhs, rhs);
+}
+
+// StdSwapIsUnconstrained
+//
+// Some standard library implementations are broken in that they do not
+// constrain `std::swap`. This will effectively tell us if we are dealing with
+// one of those implementations.
+using StdSwapIsUnconstrained = IsSwappable<void()>;
+
+}  // namespace swap_internal
+
+namespace type_traits_internal {
+
+// Make the swap-related traits/function accessible from this namespace.
+using swap_internal::IsNothrowSwappable;
+using swap_internal::IsSwappable;
+using swap_internal::Swap;
+using swap_internal::StdSwapIsUnconstrained;
+
+}  // namespace type_traits_internal
 }  // namespace absl
+
 #endif  // ABSL_META_TYPE_TRAITS_H_
index afb8bcf..2f5b8ad 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // File: int128.h
 // -----------------------------------------------------------------------------
 //
-// This header file defines 128-bit integer types. Currently, this file defines
-// `uint128`, an unsigned 128-bit integer; a signed 128-bit integer is
-// forthcoming.
+// This header file defines 128-bit integer types.
+//
+// Currently, this file defines `uint128`, an unsigned 128-bit integer; a signed
+// 128-bit integer is forthcoming.
 
 #ifndef ABSL_NUMERIC_INT128_H_
 #define ABSL_NUMERIC_INT128_H_
 #include <cstring>
 #include <iosfwd>
 #include <limits>
+#include <utility>
 
 #include "absl/base/config.h"
 #include "absl/base/macros.h"
 #include "absl/base/port.h"
 
+#if defined(_MSC_VER)
+// In very old versions of MSVC and when the /Zc:wchar_t flag is off, wchar_t is
+// a typedef for unsigned short.  Otherwise wchar_t is mapped to the __wchar_t
+// builtin type.  We need to make sure not to define operator wchar_t()
+// alongside operator unsigned short() in these instances.
+#define ABSL_INTERNAL_WCHAR_T __wchar_t
+#if defined(_M_X64)
+#include <intrin.h>
+#pragma intrinsic(_umul128)
+#endif  // defined(_M_X64)
+#else   // defined(_MSC_VER)
+#define ABSL_INTERNAL_WCHAR_T wchar_t
+#endif  // defined(_MSC_VER)
+
 namespace absl {
 
 // uint128
@@ -43,8 +59,8 @@ namespace absl {
 // as closely as is practical, including exhibiting undefined behavior in
 // analogous cases (e.g. division by zero). This type is intended to be a
 // drop-in replacement once C++ supports an intrinsic `uint128_t` type; when
-// that occurs, existing uses of `uint128` will continue to work using that new
-// type.
+// that occurs, existing well-behaved uses of `uint128` will continue to work
+// using that new type.
 //
 // Note: code written with this type will continue to compile once `uint128_t`
 // is introduced, provided the replacement helper functions
@@ -62,23 +78,30 @@ namespace absl {
 // However, a `uint128` differs from intrinsic integral types in the following
 // ways:
 //
-//   * Errors on implicit conversions that does not preserve value (such as
+//   * Errors on implicit conversions that do not preserve value (such as
 //     loss of precision when converting to float values).
 //   * Requires explicit construction from and conversion to floating point
 //     types.
 //   * Conversion to integral types requires an explicit static_cast() to
 //     mimic use of the `-Wnarrowing` compiler flag.
+//   * The alignment requirement of `uint128` may differ from that of an
+//     intrinsic 128-bit integer type depending on platform and build
+//     configuration.
 //
 // Example:
 //
-//     float y = kuint128max; // Error. uint128 cannot be implicitly converted
-//                            // to float.
+//     float y = absl::Uint128Max();  // Error. uint128 cannot be implicitly
+//                                    // converted to float.
 //
-//     uint128 v;
-//     uint64_t i = v                          // Error
-//     uint64_t i = static_cast<uint64_t>(v)   // OK
+//     absl::uint128 v;
+//     uint64_t i = v;                         // Error
+//     uint64_t i = static_cast<uint64_t>(v);  // OK
 //
-class alignas(16) uint128 {
+class
+#if defined(ABSL_HAVE_INTRINSIC_INT128)
+    alignas(unsigned __int128)
+#endif  // ABSL_HAVE_INTRINSIC_INT128
+        uint128 {
  public:
   uint128() = default;
 
@@ -93,9 +116,9 @@ class alignas(16) uint128 {
   constexpr uint128(__int128 v);           // NOLINT(runtime/explicit)
   constexpr uint128(unsigned __int128 v);  // NOLINT(runtime/explicit)
 #endif  // ABSL_HAVE_INTRINSIC_INT128
-  explicit uint128(float v);        // NOLINT(runtime/explicit)
-  explicit uint128(double v);       // NOLINT(runtime/explicit)
-  explicit uint128(long double v);  // NOLINT(runtime/explicit)
+  explicit uint128(float v);
+  explicit uint128(double v);
+  explicit uint128(long double v);
 
   // Assignment operators from arithmetic types
   uint128& operator=(int v);
@@ -116,7 +139,7 @@ class alignas(16) uint128 {
   constexpr explicit operator unsigned char() const;
   constexpr explicit operator char16_t() const;
   constexpr explicit operator char32_t() const;
-  constexpr explicit operator wchar_t() const;
+  constexpr explicit operator ABSL_INTERNAL_WCHAR_T() const;
   constexpr explicit operator short() const;  // NOLINT(runtime/int)
   // NOLINTNEXTLINE(runtime/int)
   constexpr explicit operator unsigned short() const;
@@ -140,31 +163,31 @@ class alignas(16) uint128 {
   // Trivial copy constructor, assignment operator and destructor.
 
   // Arithmetic operators.
-  uint128& operator+=(const uint128& other);
-  uint128& operator-=(const uint128& other);
-  uint128& operator*=(const uint128& other);
+  uint128& operator+=(uint128 other);
+  uint128& operator-=(uint128 other);
+  uint128& operator*=(uint128 other);
   // Long division/modulo for uint128.
-  uint128& operator/=(const uint128& other);
-  uint128& operator%=(const uint128& other);
+  uint128& operator/=(uint128 other);
+  uint128& operator%=(uint128 other);
   uint128 operator++(int);
   uint128 operator--(int);
   uint128& operator<<=(int);
   uint128& operator>>=(int);
-  uint128& operator&=(const uint128& other);
-  uint128& operator|=(const uint128& other);
-  uint128& operator^=(const uint128& other);
+  uint128& operator&=(uint128 other);
+  uint128& operator|=(uint128 other);
+  uint128& operator^=(uint128 other);
   uint128& operator++();
   uint128& operator--();
 
   // Uint128Low64()
   //
   // Returns the lower 64-bit value of a `uint128` value.
-  friend uint64_t Uint128Low64(const uint128& v);
+  friend constexpr uint64_t Uint128Low64(uint128 v);
 
   // Uint128High64()
   //
   // Returns the higher 64-bit value of a `uint128` value.
-  friend uint64_t Uint128High64(const uint128& v);
+  friend constexpr uint64_t Uint128High64(uint128 v);
 
   // MakeUInt128()
   //
@@ -175,10 +198,21 @@ class alignas(16) uint128 {
   // Example:
   //
   //   absl::uint128 big = absl::MakeUint128(1, 0);
-  friend constexpr uint128 MakeUint128(uint64_t top, uint64_t bottom);
+  friend constexpr uint128 MakeUint128(uint64_t high, uint64_t low);
+
+  // Uint128Max()
+  //
+  // Returns the highest value for a 128-bit unsigned integer.
+  friend constexpr uint128 Uint128Max();
+
+  // Support for absl::Hash.
+  template <typename H>
+  friend H AbslHashValue(H h, uint128 v) {
+    return H::combine(std::move(h), Uint128High64(v), Uint128Low64(v));
+  }
 
  private:
-  constexpr uint128(uint64_t top, uint64_t bottom);
+  constexpr uint128(uint64_t high, uint64_t low);
 
   // TODO(strel) Update implementation to use __int128 once all users of
   // uint128 are fixed to not depend on alignof(uint128) == 8. Also add
@@ -195,32 +229,82 @@ class alignas(16) uint128 {
 #endif  // byte order
 };
 
+// Prefer to use the constexpr `Uint128Max()`.
+//
+// TODO(absl-team) deprecate kuint128max once migration tool is released.
 extern const uint128 kuint128max;
 
 // allow uint128 to be logged
-extern std::ostream& operator<<(std::ostream& o, const uint128& b);
+std::ostream& operator<<(std::ostream& os, uint128 v);
 
-// TODO(strel) add operator>>(std::istream&, uint128&)
+// TODO(strel) add operator>>(std::istream&, uint128)
+
+constexpr uint128 Uint128Max() {
+  return uint128((std::numeric_limits<uint64_t>::max)(),
+                 (std::numeric_limits<uint64_t>::max)());
+}
 
-// Methods to access low and high pieces of 128-bit value.
-uint64_t Uint128Low64(const uint128& v);
-uint64_t Uint128High64(const uint128& v);
+}  // namespace absl
+
+// Specialized numeric_limits for uint128.
+namespace std {
+template <>
+class numeric_limits<absl::uint128> {
+ public:
+  static constexpr bool is_specialized = true;
+  static constexpr bool is_signed = false;
+  static constexpr bool is_integer = true;
+  static constexpr bool is_exact = true;
+  static constexpr bool has_infinity = false;
+  static constexpr bool has_quiet_NaN = false;
+  static constexpr bool has_signaling_NaN = false;
+  static constexpr float_denorm_style has_denorm = denorm_absent;
+  static constexpr bool has_denorm_loss = false;
+  static constexpr float_round_style round_style = round_toward_zero;
+  static constexpr bool is_iec559 = false;
+  static constexpr bool is_bounded = true;
+  static constexpr bool is_modulo = true;
+  static constexpr int digits = 128;
+  static constexpr int digits10 = 38;
+  static constexpr int max_digits10 = 0;
+  static constexpr int radix = 2;
+  static constexpr int min_exponent = 0;
+  static constexpr int min_exponent10 = 0;
+  static constexpr int max_exponent = 0;
+  static constexpr int max_exponent10 = 0;
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+  static constexpr bool traps = numeric_limits<unsigned __int128>::traps;
+#else   // ABSL_HAVE_INTRINSIC_INT128
+  static constexpr bool traps = numeric_limits<uint64_t>::traps;
+#endif  // ABSL_HAVE_INTRINSIC_INT128
+  static constexpr bool tinyness_before = false;
+
+  static constexpr absl::uint128 (min)() { return 0; }
+  static constexpr absl::uint128 lowest() { return 0; }
+  static constexpr absl::uint128 (max)() { return absl::Uint128Max(); }
+  static constexpr absl::uint128 epsilon() { return 0; }
+  static constexpr absl::uint128 round_error() { return 0; }
+  static constexpr absl::uint128 infinity() { return 0; }
+  static constexpr absl::uint128 quiet_NaN() { return 0; }
+  static constexpr absl::uint128 signaling_NaN() { return 0; }
+  static constexpr absl::uint128 denorm_min() { return 0; }
+};
+}  // namespace std
 
 // TODO(absl-team): Implement signed 128-bit type
 
 // --------------------------------------------------------------------------
 //                      Implementation details follow
 // --------------------------------------------------------------------------
+namespace absl {
 
-inline constexpr uint128 MakeUint128(uint64_t top, uint64_t bottom) {
-  return uint128(top, bottom);
+constexpr uint128 MakeUint128(uint64_t high, uint64_t low) {
+  return uint128(high, low);
 }
 
 // Assignment from integer types.
 
-inline uint128& uint128::operator=(int v) {
-  return *this = uint128(v);
-}
+inline uint128& uint128::operator=(int v) { return *this = uint128(v); }
 
 inline uint128& uint128::operator=(unsigned int v) {
   return *this = uint128(v);
@@ -255,96 +339,115 @@ inline uint128& uint128::operator=(unsigned __int128 v) {
 }
 #endif  // ABSL_HAVE_INTRINSIC_INT128
 
-// Shift and arithmetic operators.
+// Arithmetic operators.
+
+uint128 operator<<(uint128 lhs, int amount);
+uint128 operator>>(uint128 lhs, int amount);
+uint128 operator+(uint128 lhs, uint128 rhs);
+uint128 operator-(uint128 lhs, uint128 rhs);
+uint128 operator*(uint128 lhs, uint128 rhs);
+uint128 operator/(uint128 lhs, uint128 rhs);
+uint128 operator%(uint128 lhs, uint128 rhs);
 
-inline uint128 operator<<(const uint128& lhs, int amount) {
-  return uint128(lhs) <<= amount;
+inline uint128& uint128::operator<<=(int amount) {
+  *this = *this << amount;
+  return *this;
 }
 
-inline uint128 operator>>(const uint128& lhs, int amount) {
-  return uint128(lhs) >>= amount;
+inline uint128& uint128::operator>>=(int amount) {
+  *this = *this >> amount;
+  return *this;
 }
 
-inline uint128 operator+(const uint128& lhs, const uint128& rhs) {
-  return uint128(lhs) += rhs;
+inline uint128& uint128::operator+=(uint128 other) {
+  *this = *this + other;
+  return *this;
 }
 
-inline uint128 operator-(const uint128& lhs, const uint128& rhs) {
-  return uint128(lhs) -= rhs;
+inline uint128& uint128::operator-=(uint128 other) {
+  *this = *this - other;
+  return *this;
 }
 
-inline uint128 operator*(const uint128& lhs, const uint128& rhs) {
-  return uint128(lhs) *= rhs;
+inline uint128& uint128::operator*=(uint128 other) {
+  *this = *this * other;
+  return *this;
 }
 
-inline uint128 operator/(const uint128& lhs, const uint128& rhs) {
-  return uint128(lhs) /= rhs;
+inline uint128& uint128::operator/=(uint128 other) {
+  *this = *this / other;
+  return *this;
 }
 
-inline uint128 operator%(const uint128& lhs, const uint128& rhs) {
-  return uint128(lhs) %= rhs;
+inline uint128& uint128::operator%=(uint128 other) {
+  *this = *this % other;
+  return *this;
 }
 
-inline uint64_t Uint128Low64(const uint128& v) { return v.lo_; }
+constexpr uint64_t Uint128Low64(uint128 v) { return v.lo_; }
 
-inline uint64_t Uint128High64(const uint128& v) { return v.hi_; }
+constexpr uint64_t Uint128High64(uint128 v) { return v.hi_; }
 
 // Constructors from integer types.
 
 #if defined(ABSL_IS_LITTLE_ENDIAN)
 
-inline constexpr uint128::uint128(uint64_t top, uint64_t bottom)
-    : lo_(bottom), hi_(top) {}
+constexpr uint128::uint128(uint64_t high, uint64_t low)
+    : lo_{low}, hi_{high} {}
 
-inline constexpr uint128::uint128(int v)
-    : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
-inline constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
-    : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
-inline constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
-    : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
+constexpr uint128::uint128(int v)
+    : lo_{static_cast<uint64_t>(v)},
+      hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0} {}
+constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
+    : lo_{static_cast<uint64_t>(v)},
+      hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0} {}
+constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
+    : lo_{static_cast<uint64_t>(v)},
+      hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0} {}
 
-inline constexpr uint128::uint128(unsigned int v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned int v) : lo_{v}, hi_{0} {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned long v) : lo_{v}, hi_{0} {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long long v)
-    : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned long long v) : lo_{v}, hi_{0} {}
 
 #ifdef ABSL_HAVE_INTRINSIC_INT128
-inline constexpr uint128::uint128(__int128 v)
-    : lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
-      hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)) {}
-inline constexpr uint128::uint128(unsigned __int128 v)
-    : lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
-      hi_(static_cast<uint64_t>(v >> 64)) {}
+constexpr uint128::uint128(__int128 v)
+    : lo_{static_cast<uint64_t>(v & ~uint64_t{0})},
+      hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)} {}
+constexpr uint128::uint128(unsigned __int128 v)
+    : lo_{static_cast<uint64_t>(v & ~uint64_t{0})},
+      hi_{static_cast<uint64_t>(v >> 64)} {}
 #endif  // ABSL_HAVE_INTRINSIC_INT128
 
 #elif defined(ABSL_IS_BIG_ENDIAN)
 
-inline constexpr uint128::uint128(uint64_t top, uint64_t bottom)
-    : hi_(top), lo_(bottom) {}
+constexpr uint128::uint128(uint64_t high, uint64_t low)
+    : hi_{high}, lo_{low} {}
 
-inline constexpr uint128::uint128(int v)
-    : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
-inline constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
-    : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
-inline constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
-    : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
+constexpr uint128::uint128(int v)
+    : hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0},
+      lo_{static_cast<uint64_t>(v)} {}
+constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
+    : hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0},
+      lo_{static_cast<uint64_t>(v)} {}
+constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
+    : hi_{v < 0 ? (std::numeric_limits<uint64_t>::max)() : 0},
+      lo_{static_cast<uint64_t>(v)} {}
 
-inline constexpr uint128::uint128(unsigned int v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned int v) : hi_{0}, lo_{v} {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned long v) : hi_{0}, lo_{v} {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long long v)
-    : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned long long v) : hi_{0}, lo_{v} {}
 
 #ifdef ABSL_HAVE_INTRINSIC_INT128
-inline constexpr uint128::uint128(__int128 v)
-    : hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)),
-      lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
-inline constexpr uint128::uint128(unsigned __int128 v)
-    : hi_(static_cast<uint64_t>(v >> 64)),
-      lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
+constexpr uint128::uint128(__int128 v)
+    : hi_{static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)},
+      lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {}
+constexpr uint128::uint128(unsigned __int128 v)
+    : hi_{static_cast<uint64_t>(v >> 64)},
+      lo_{static_cast<uint64_t>(v & ~uint64_t{0})} {}
 #endif  // ABSL_HAVE_INTRINSIC_INT128
 
 #else  // byte order
@@ -353,78 +456,64 @@ inline constexpr uint128::uint128(unsigned __int128 v)
 
 // Conversion operators to integer types.
 
-inline constexpr uint128::operator bool() const {
-  return lo_ || hi_;
-}
+constexpr uint128::operator bool() const { return lo_ || hi_; }
 
-inline constexpr uint128::operator char() const {
-  return static_cast<char>(lo_);
-}
+constexpr uint128::operator char() const { return static_cast<char>(lo_); }
 
-inline constexpr uint128::operator signed char() const {
+constexpr uint128::operator signed char() const {
   return static_cast<signed char>(lo_);
 }
 
-inline constexpr uint128::operator unsigned char() const {
+constexpr uint128::operator unsigned char() const {
   return static_cast<unsigned char>(lo_);
 }
 
-inline constexpr uint128::operator char16_t() const {
+constexpr uint128::operator char16_t() const {
   return static_cast<char16_t>(lo_);
 }
 
-inline constexpr uint128::operator char32_t() const {
+constexpr uint128::operator char32_t() const {
   return static_cast<char32_t>(lo_);
 }
 
-inline constexpr uint128::operator wchar_t() const {
-  return static_cast<wchar_t>(lo_);
+constexpr uint128::operator ABSL_INTERNAL_WCHAR_T() const {
+  return static_cast<ABSL_INTERNAL_WCHAR_T>(lo_);
 }
 
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator short() const {
-  return static_cast<short>(lo_);  // NOLINT(runtime/int)
-}
+constexpr uint128::operator short() const { return static_cast<short>(lo_); }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator unsigned short() const {
-  return static_cast<unsigned short>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator unsigned short() const {  // NOLINT(runtime/int)
+  return static_cast<unsigned short>(lo_);            // NOLINT(runtime/int)
 }
 
-inline constexpr uint128::operator int() const {
-  return static_cast<int>(lo_);
-}
+constexpr uint128::operator int() const { return static_cast<int>(lo_); }
 
-inline constexpr uint128::operator unsigned int() const {
+constexpr uint128::operator unsigned int() const {
   return static_cast<unsigned int>(lo_);
 }
 
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator long() const {
-  return static_cast<long>(lo_);  // NOLINT(runtime/int)
-}
+constexpr uint128::operator long() const { return static_cast<long>(lo_); }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator unsigned long() const {
-  return static_cast<unsigned long>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator unsigned long() const {  // NOLINT(runtime/int)
+  return static_cast<unsigned long>(lo_);            // NOLINT(runtime/int)
 }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator long long() const {
-  return static_cast<long long>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator long long() const {  // NOLINT(runtime/int)
+  return static_cast<long long>(lo_);            // NOLINT(runtime/int)
 }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator unsigned long long() const {
-  return static_cast<unsigned long long>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator unsigned long long() const {  // NOLINT(runtime/int)
+  return static_cast<unsigned long long>(lo_);            // NOLINT(runtime/int)
 }
 
 #ifdef ABSL_HAVE_INTRINSIC_INT128
-inline constexpr uint128::operator __int128() const {
+constexpr uint128::operator __int128() const {
   return (static_cast<__int128>(hi_) << 64) + lo_;
 }
 
-inline constexpr uint128::operator unsigned __int128() const {
+constexpr uint128::operator unsigned __int128() const {
   return (static_cast<unsigned __int128>(hi_) << 64) + lo_;
 }
 #endif  // ABSL_HAVE_INTRINSIC_INT128
@@ -446,34 +535,34 @@ inline uint128::operator long double() const {
 
 // Comparison operators.
 
-inline bool operator==(const uint128& lhs, const uint128& rhs) {
+inline bool operator==(uint128 lhs, uint128 rhs) {
   return (Uint128Low64(lhs) == Uint128Low64(rhs) &&
           Uint128High64(lhs) == Uint128High64(rhs));
 }
 
-inline bool operator!=(const uint128& lhs, const uint128& rhs) {
+inline bool operator!=(uint128 lhs, uint128 rhs) {
   return !(lhs == rhs);
 }
 
-inline bool operator<(const uint128& lhs, const uint128& rhs) {
+inline bool operator<(uint128 lhs, uint128 rhs) {
   return (Uint128High64(lhs) == Uint128High64(rhs))
              ? (Uint128Low64(lhs) < Uint128Low64(rhs))
              : (Uint128High64(lhs) < Uint128High64(rhs));
 }
 
-inline bool operator>(const uint128& lhs, const uint128& rhs) {
+inline bool operator>(uint128 lhs, uint128 rhs) {
   return (Uint128High64(lhs) == Uint128High64(rhs))
              ? (Uint128Low64(lhs) > Uint128Low64(rhs))
              : (Uint128High64(lhs) > Uint128High64(rhs));
 }
 
-inline bool operator<=(const uint128& lhs, const uint128& rhs) {
+inline bool operator<=(uint128 lhs, uint128 rhs) {
   return (Uint128High64(lhs) == Uint128High64(rhs))
              ? (Uint128Low64(lhs) <= Uint128Low64(rhs))
              : (Uint128High64(lhs) <= Uint128High64(rhs));
 }
 
-inline bool operator>=(const uint128& lhs, const uint128& rhs) {
+inline bool operator>=(uint128 lhs, uint128 rhs) {
   return (Uint128High64(lhs) == Uint128High64(rhs))
              ? (Uint128Low64(lhs) >= Uint128Low64(rhs))
              : (Uint128High64(lhs) >= Uint128High64(rhs));
@@ -481,141 +570,128 @@ inline bool operator>=(const uint128& lhs, const uint128& rhs) {
 
 // Unary operators.
 
-inline uint128 operator-(const uint128& val) {
-  const uint64_t hi_flip = ~Uint128High64(val);
-  const uint64_t lo_flip = ~Uint128Low64(val);
-  const uint64_t lo_add = lo_flip + 1;
-  if (lo_add < lo_flip) {
-    return MakeUint128(hi_flip + 1, lo_add);
-  }
-  return MakeUint128(hi_flip, lo_add);
+inline uint128 operator-(uint128 val) {
+  uint64_t hi = ~Uint128High64(val);
+  uint64_t lo = ~Uint128Low64(val) + 1;
+  if (lo == 0) ++hi;  // carry
+  return MakeUint128(hi, lo);
 }
 
-inline bool operator!(const uint128& val) {
+inline bool operator!(uint128 val) {
   return !Uint128High64(val) && !Uint128Low64(val);
 }
 
 // Logical operators.
 
-inline uint128 operator~(const uint128& val) {
+inline uint128 operator~(uint128 val) {
   return MakeUint128(~Uint128High64(val), ~Uint128Low64(val));
 }
 
-inline uint128 operator|(const uint128& lhs, const uint128& rhs) {
+inline uint128 operator|(uint128 lhs, uint128 rhs) {
   return MakeUint128(Uint128High64(lhs) | Uint128High64(rhs),
                            Uint128Low64(lhs) | Uint128Low64(rhs));
 }
 
-inline uint128 operator&(const uint128& lhs, const uint128& rhs) {
+inline uint128 operator&(uint128 lhs, uint128 rhs) {
   return MakeUint128(Uint128High64(lhs) & Uint128High64(rhs),
                            Uint128Low64(lhs) & Uint128Low64(rhs));
 }
 
-inline uint128 operator^(const uint128& lhs, const uint128& rhs) {
+inline uint128 operator^(uint128 lhs, uint128 rhs) {
   return MakeUint128(Uint128High64(lhs) ^ Uint128High64(rhs),
                            Uint128Low64(lhs) ^ Uint128Low64(rhs));
 }
 
-inline uint128& uint128::operator|=(const uint128& other) {
+inline uint128& uint128::operator|=(uint128 other) {
   hi_ |= other.hi_;
   lo_ |= other.lo_;
   return *this;
 }
 
-inline uint128& uint128::operator&=(const uint128& other) {
+inline uint128& uint128::operator&=(uint128 other) {
   hi_ &= other.hi_;
   lo_ &= other.lo_;
   return *this;
 }
 
-inline uint128& uint128::operator^=(const uint128& other) {
+inline uint128& uint128::operator^=(uint128 other) {
   hi_ ^= other.hi_;
   lo_ ^= other.lo_;
   return *this;
 }
 
-// Shift and arithmetic assign operators.
-
-inline uint128& uint128::operator<<=(int amount) {
-  // Shifts of >= 128 are undefined.
-  assert(amount < 128);
+// Arithmetic operators.
 
+inline uint128 operator<<(uint128 lhs, int amount) {
   // uint64_t shifts of >= 64 are undefined, so we will need some
   // special-casing.
   if (amount < 64) {
     if (amount != 0) {
-      hi_ = (hi_ << amount) | (lo_ >> (64 - amount));
-      lo_ = lo_ << amount;
+      return MakeUint128(
+          (Uint128High64(lhs) << amount) | (Uint128Low64(lhs) >> (64 - amount)),
+          Uint128Low64(lhs) << amount);
     }
-  } else {
-    hi_ = lo_ << (amount - 64);
-    lo_ = 0;
+    return lhs;
   }
-  return *this;
+  return MakeUint128(Uint128Low64(lhs) << (amount - 64), 0);
 }
 
-inline uint128& uint128::operator>>=(int amount) {
-  // Shifts of >= 128 are undefined.
-  assert(amount < 128);
-
+inline uint128 operator>>(uint128 lhs, int amount) {
   // uint64_t shifts of >= 64 are undefined, so we will need some
   // special-casing.
   if (amount < 64) {
     if (amount != 0) {
-      lo_ = (lo_ >> amount) | (hi_ << (64 - amount));
-      hi_ = hi_ >> amount;
+      return MakeUint128(Uint128High64(lhs) >> amount,
+                         (Uint128Low64(lhs) >> amount) |
+                             (Uint128High64(lhs) << (64 - amount)));
     }
-  } else {
-    lo_ = hi_ >> (amount - 64);
-    hi_ = 0;
+    return lhs;
   }
-  return *this;
+  return MakeUint128(0, Uint128High64(lhs) >> (amount - 64));
 }
 
-inline uint128& uint128::operator+=(const uint128& other) {
-  hi_ += other.hi_;
-  uint64_t lolo = lo_ + other.lo_;
-  if (lolo < lo_)
-    ++hi_;
-  lo_ = lolo;
-  return *this;
+inline uint128 operator+(uint128 lhs, uint128 rhs) {
+  uint128 result = MakeUint128(Uint128High64(lhs) + Uint128High64(rhs),
+                               Uint128Low64(lhs) + Uint128Low64(rhs));
+  if (Uint128Low64(result) < Uint128Low64(lhs)) {  // check for carry
+    return MakeUint128(Uint128High64(result) + 1, Uint128Low64(result));
+  }
+  return result;
 }
 
-inline uint128& uint128::operator-=(const uint128& other) {
-  hi_ -= other.hi_;
-  if (other.lo_ > lo_) --hi_;
-  lo_ -= other.lo_;
-  return *this;
+inline uint128 operator-(uint128 lhs, uint128 rhs) {
+  uint128 result = MakeUint128(Uint128High64(lhs) - Uint128High64(rhs),
+                               Uint128Low64(lhs) - Uint128Low64(rhs));
+  if (Uint128Low64(lhs) < Uint128Low64(rhs)) {  // check for carry
+    return MakeUint128(Uint128High64(result) - 1, Uint128Low64(result));
+  }
+  return result;
 }
 
-inline uint128& uint128::operator*=(const uint128& other) {
+inline uint128 operator*(uint128 lhs, uint128 rhs) {
 #if defined(ABSL_HAVE_INTRINSIC_INT128)
   // TODO(strel) Remove once alignment issues are resolved and unsigned __int128
   // can be used for uint128 storage.
-  *this = static_cast<unsigned __int128>(*this) *
-          static_cast<unsigned __int128>(other);
-  return *this;
+  return static_cast<unsigned __int128>(lhs) *
+         static_cast<unsigned __int128>(rhs);
+#elif defined(_MSC_VER) && defined(_M_X64)
+  uint64_t carry;
+  uint64_t low = _umul128(Uint128Low64(lhs), Uint128Low64(rhs), &carry);
+  return MakeUint128(Uint128Low64(lhs) * Uint128High64(rhs) +
+                         Uint128High64(lhs) * Uint128Low64(rhs) + carry,
+                     low);
 #else   // ABSL_HAVE_INTRINSIC128
-  uint64_t a96 = hi_ >> 32;
-  uint64_t a64 = hi_ & 0xffffffff;
-  uint64_t a32 = lo_ >> 32;
-  uint64_t a00 = lo_ & 0xffffffff;
-  uint64_t b96 = other.hi_ >> 32;
-  uint64_t b64 = other.hi_ & 0xffffffff;
-  uint64_t b32 = other.lo_ >> 32;
-  uint64_t b00 = other.lo_ & 0xffffffff;
-  // multiply [a96 .. a00] x [b96 .. b00]
-  // terms higher than c96 disappear off the high side
-  // terms c96 and c64 are safe to ignore carry bit
-  uint64_t c96 = a96 * b00 + a64 * b32 + a32 * b64 + a00 * b96;
-  uint64_t c64 = a64 * b00 + a32 * b32 + a00 * b64;
-  this->hi_ = (c96 << 32) + c64;
-  this->lo_ = 0;
-  // add terms after this one at a time to capture carry
-  *this += uint128(a32 * b00) << 32;
-  *this += uint128(a00 * b32) << 32;
-  *this += a00 * b00;
-  return *this;
+  uint64_t a32 = Uint128Low64(lhs) >> 32;
+  uint64_t a00 = Uint128Low64(lhs) & 0xffffffff;
+  uint64_t b32 = Uint128Low64(rhs) >> 32;
+  uint64_t b00 = Uint128Low64(rhs) & 0xffffffff;
+  uint128 result =
+      MakeUint128(Uint128High64(lhs) * Uint128Low64(rhs) +
+                      Uint128Low64(lhs) * Uint128High64(rhs) + a32 * b32,
+                  a00 * b00);
+  result += uint128(a32 * b00) << 32;
+  result += uint128(a00 * b32) << 32;
+  return result;
 #endif  // ABSL_HAVE_INTRINSIC128
 }
 
@@ -643,6 +719,14 @@ inline uint128& uint128::operator--() {
   return *this;
 }
 
+#if defined(ABSL_HAVE_INTRINSIC_INT128)
+#include "absl/numeric/int128_have_intrinsic.inc"
+#else  // ABSL_HAVE_INTRINSIC_INT128
+#include "absl/numeric/int128_no_intrinsic.inc"
+#endif  // ABSL_HAVE_INTRINSIC_INT128
+
 }  // namespace absl
 
+#undef ABSL_INTERNAL_WCHAR_T
+
 #endif  // ABSL_NUMERIC_INT128_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc
new file mode 100644 (file)
index 0000000..c7ea683
--- /dev/null
@@ -0,0 +1,18 @@
+//
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file contains :int128 implementation details that depend on internal
+// representation when ABSL_HAVE_INTRINSIC_INT128 is defined. This file is
+// included by int128.h and relies on ABSL_INTERNAL_WCHAR_T being defined.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc
new file mode 100644 (file)
index 0000000..046cb9b
--- /dev/null
@@ -0,0 +1,18 @@
+//
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file contains :int128 implementation details that depend on internal
+// representation when ABSL_HAVE_INTRINSIC_INT128 is *not* defined. This file
+// is included by int128.h and relies on ABSL_INTERNAL_WCHAR_T being defined.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/bernoulli_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/bernoulli_distribution.h
new file mode 100644 (file)
index 0000000..326fcb6
--- /dev/null
@@ -0,0 +1,198 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_BERNOULLI_DISTRIBUTION_H_
+#define ABSL_RANDOM_BERNOULLI_DISTRIBUTION_H_
+
+#include <cstdint>
+#include <istream>
+#include <limits>
+
+#include "absl/base/optimization.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+
+// absl::bernoulli_distribution is a drop in replacement for
+// std::bernoulli_distribution. It guarantees that (given a perfect
+// UniformRandomBitGenerator) the acceptance probability is *exactly* equal to
+// the given double.
+//
+// The implementation assumes that double is IEEE754
+class bernoulli_distribution {
+ public:
+  using result_type = bool;
+
+  class param_type {
+   public:
+    using distribution_type = bernoulli_distribution;
+
+    explicit param_type(double p = 0.5) : prob_(p) {
+      assert(p >= 0.0 && p <= 1.0);
+    }
+
+    double p() const { return prob_; }
+
+    friend bool operator==(const param_type& p1, const param_type& p2) {
+      return p1.p() == p2.p();
+    }
+    friend bool operator!=(const param_type& p1, const param_type& p2) {
+      return p1.p() != p2.p();
+    }
+
+   private:
+    double prob_;
+  };
+
+  bernoulli_distribution() : bernoulli_distribution(0.5) {}
+
+  explicit bernoulli_distribution(double p) : param_(p) {}
+
+  explicit bernoulli_distribution(param_type p) : param_(p) {}
+
+  // no-op
+  void reset() {}
+
+  template <typename URBG>
+  bool operator()(URBG& g) {  // NOLINT(runtime/references)
+    return Generate(param_.p(), g);
+  }
+
+  template <typename URBG>
+  bool operator()(URBG& g,  // NOLINT(runtime/references)
+                  const param_type& param) {
+    return Generate(param.p(), g);
+  }
+
+  param_type param() const { return param_; }
+  void param(const param_type& param) { param_ = param; }
+
+  double p() const { return param_.p(); }
+
+  result_type(min)() const { return false; }
+  result_type(max)() const { return true; }
+
+  friend bool operator==(const bernoulli_distribution& d1,
+                         const bernoulli_distribution& d2) {
+    return d1.param_ == d2.param_;
+  }
+
+  friend bool operator!=(const bernoulli_distribution& d1,
+                         const bernoulli_distribution& d2) {
+    return d1.param_ != d2.param_;
+  }
+
+ private:
+  static constexpr uint64_t kP32 = static_cast<uint64_t>(1) << 32;
+
+  template <typename URBG>
+  static bool Generate(double p, URBG& g);  // NOLINT(runtime/references)
+
+  param_type param_;
+};
+
+template <typename CharT, typename Traits>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const bernoulli_distribution& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<double>::kPrecision);
+  os << x.p();
+  return os;
+}
+
+template <typename CharT, typename Traits>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    bernoulli_distribution& x) {            // NOLINT(runtime/references)
+  auto saver = random_internal::make_istream_state_saver(is);
+  auto p = random_internal::read_floating_point<double>(is);
+  if (!is.fail()) {
+    x.param(bernoulli_distribution::param_type(p));
+  }
+  return is;
+}
+
+template <typename URBG>
+bool bernoulli_distribution::Generate(double p,
+                                      URBG& g) {  // NOLINT(runtime/references)
+  random_internal::FastUniformBits<uint32_t> fast_u32;
+
+  while (true) {
+    // There are two aspects of the definition of `c` below that are worth
+    // commenting on.  First, because `p` is in the range [0, 1], `c` is in the
+    // range [0, 2^32] which does not fit in a uint32_t and therefore requires
+    // 64 bits.
+    //
+    // Second, `c` is constructed by first casting explicitly to a signed
+    // integer and then converting implicitly to an unsigned integer of the same
+    // size.  This is done because the hardware conversion instructions produce
+    // signed integers from double; if taken as a uint64_t the conversion would
+    // be wrong for doubles greater than 2^63 (not relevant in this use-case).
+    // If converted directly to an unsigned integer, the compiler would end up
+    // emitting code to handle such large values that are not relevant due to
+    // the known bounds on `c`.  To avoid these extra instructions this
+    // implementation converts first to the signed type and then use the
+    // implicit conversion to unsigned (which is a no-op).
+    const uint64_t c = static_cast<int64_t>(p * kP32);
+    const uint32_t v = fast_u32(g);
+    // FAST PATH: this path fails with probability 1/2^32.  Note that simply
+    // returning v <= c would approximate P very well (up to an absolute error
+    // of 1/2^32); the slow path (taken in that range of possible error, in the
+    // case of equality) eliminates the remaining error.
+    if (ABSL_PREDICT_TRUE(v != c)) return v < c;
+
+    // It is guaranteed that `q` is strictly less than 1, because if `q` were
+    // greater than or equal to 1, the same would be true for `p`. Certainly `p`
+    // cannot be greater than 1, and if `p == 1`, then the fast path would
+    // necessary have been taken already.
+    const double q = static_cast<double>(c) / kP32;
+
+    // The probability of acceptance on the fast path is `q` and so the
+    // probability of acceptance here should be `p - q`.
+    //
+    // Note that `q` is obtained from `p` via some shifts and conversions, the
+    // upshot of which is that `q` is simply `p` with some of the
+    // least-significant bits of its mantissa set to zero. This means that the
+    // difference `p - q` will not have any rounding errors. To see why, pretend
+    // that double has 10 bits of resolution and q is obtained from `p` in such
+    // a way that the 4 least-significant bits of its mantissa are set to zero.
+    // For example:
+    //   p   = 1.1100111011 * 2^-1
+    //   q   = 1.1100110000 * 2^-1
+    // p - q = 1.011        * 2^-8
+    // The difference `p - q` has exactly the nonzero mantissa bits that were
+    // "lost" in `q` producing a number which is certainly representable in a
+    // double.
+    const double left = p - q;
+
+    // By construction, the probability of being on this slow path is 1/2^32, so
+    // P(accept in slow path) = P(accept| in slow path) * P(slow path),
+    // which means the probability of acceptance here is `1 / (left * kP32)`:
+    const double here = left * kP32;
+
+    // The simplest way to compute the result of this trial is to repeat the
+    // whole algorithm with the new probability. This terminates because even
+    // given  arbitrarily unfriendly "random" bits, each iteration either
+    // multiplies a tiny probability by 2^32 (if c == 0) or strips off some
+    // number of nonzero mantissa bits. That process is bounded.
+    if (here == 0) return false;
+    p = here;
+  }
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_BERNOULLI_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/beta_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/beta_distribution.h
new file mode 100644 (file)
index 0000000..d7afd61
--- /dev/null
@@ -0,0 +1,414 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_BETA_DISTRIBUTION_H_
+#define ABSL_RANDOM_BETA_DISTRIBUTION_H_
+
+#include <cassert>
+#include <cmath>
+#include <istream>
+#include <limits>
+#include <ostream>
+#include <type_traits>
+
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/fastmath.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+
+// absl::beta_distribution:
+// Generate a floating-point variate conforming to a Beta distribution:
+//   pdf(x) \propto x^(alpha-1) * (1-x)^(beta-1),
+// where the params alpha and beta are both strictly positive real values.
+//
+// The support is the open interval (0, 1), but the return value might be equal
+// to 0 or 1, due to numerical errors when alpha and beta are very different.
+//
+// Usage note: One usage is that alpha and beta are counts of number of
+// successes and failures. When the total number of trials are large, consider
+// approximating a beta distribution with a Gaussian distribution with the same
+// mean and variance. One could use the skewness, which depends only on the
+// smaller of alpha and beta when the number of trials are sufficiently large,
+// to quantify how far a beta distribution is from the normal distribution.
+template <typename RealType = double>
+class beta_distribution {
+ public:
+  using result_type = RealType;
+
+  class param_type {
+   public:
+    using distribution_type = beta_distribution;
+
+    explicit param_type(result_type alpha, result_type beta)
+        : alpha_(alpha), beta_(beta) {
+      assert(alpha >= 0);
+      assert(beta >= 0);
+      assert(alpha <= (std::numeric_limits<result_type>::max)());
+      assert(beta <= (std::numeric_limits<result_type>::max)());
+      if (alpha == 0 || beta == 0) {
+        method_ = DEGENERATE_SMALL;
+        x_ = (alpha >= beta) ? 1 : 0;
+        return;
+      }
+      // a_ = min(beta, alpha), b_ = max(beta, alpha).
+      if (beta < alpha) {
+        inverted_ = true;
+        a_ = beta;
+        b_ = alpha;
+      } else {
+        inverted_ = false;
+        a_ = alpha;
+        b_ = beta;
+      }
+      if (a_ <= 1 && b_ >= ThresholdForLargeA()) {
+        method_ = DEGENERATE_SMALL;
+        x_ = inverted_ ? result_type(1) : result_type(0);
+        return;
+      }
+      // For threshold values, see also:
+      // Evaluation of Beta Generation Algorithms, Ying-Chao Hung, et. al.
+      // February, 2009.
+      if ((b_ < 1.0 && a_ + b_ <= 1.2) || a_ <= ThresholdForSmallA()) {
+        // Choose Joehnk over Cheng when it's faster or when Cheng encounters
+        // numerical issues.
+        method_ = JOEHNK;
+        a_ = result_type(1) / alpha_;
+        b_ = result_type(1) / beta_;
+        if (std::isinf(a_) || std::isinf(b_)) {
+          method_ = DEGENERATE_SMALL;
+          x_ = inverted_ ? result_type(1) : result_type(0);
+        }
+        return;
+      }
+      if (a_ >= ThresholdForLargeA()) {
+        method_ = DEGENERATE_LARGE;
+        // Note: on PPC for long double, evaluating
+        // `std::numeric_limits::max() / ThresholdForLargeA` results in NaN.
+        result_type r = a_ / b_;
+        x_ = (inverted_ ? result_type(1) : r) / (1 + r);
+        return;
+      }
+      x_ = a_ + b_;
+      log_x_ = std::log(x_);
+      if (a_ <= 1) {
+        method_ = CHENG_BA;
+        y_ = result_type(1) / a_;
+        gamma_ = a_ + a_;
+        return;
+      }
+      method_ = CHENG_BB;
+      result_type r = (a_ - 1) / (b_ - 1);
+      y_ = std::sqrt((1 + r) / (b_ * r * 2 - r + 1));
+      gamma_ = a_ + result_type(1) / y_;
+    }
+
+    result_type alpha() const { return alpha_; }
+    result_type beta() const { return beta_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.alpha_ == b.alpha_ && a.beta_ == b.beta_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class beta_distribution;
+
+#ifdef COMPILER_MSVC
+    // MSVC does not have constexpr implementations for std::log and std::exp
+    // so they are computed at runtime.
+#define ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR
+#else
+#define ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR constexpr
+#endif
+
+    // The threshold for whether std::exp(1/a) is finite.
+    // Note that this value is quite large, and a smaller a_ is NOT abnormal.
+    static ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR result_type
+    ThresholdForSmallA() {
+      return result_type(1) /
+             std::log((std::numeric_limits<result_type>::max)());
+    }
+
+    // The threshold for whether a * std::log(a) is finite.
+    static ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR result_type
+    ThresholdForLargeA() {
+      return std::exp(
+          std::log((std::numeric_limits<result_type>::max)()) -
+          std::log(std::log((std::numeric_limits<result_type>::max)())) -
+          ThresholdPadding());
+    }
+
+#undef ABSL_RANDOM_INTERNAL_LOG_EXP_CONSTEXPR
+
+    // Pad the threshold for large A for long double on PPC. This is done via a
+    // template specialization below.
+    static constexpr result_type ThresholdPadding() { return 0; }
+
+    enum Method {
+      JOEHNK,    // Uses algorithm Joehnk
+      CHENG_BA,  // Uses algorithm BA in Cheng
+      CHENG_BB,  // Uses algorithm BB in Cheng
+
+      // Note: See also:
+      //   Hung et al. Evaluation of beta generation algorithms. Communications
+      //   in Statistics-Simulation and Computation 38.4 (2009): 750-770.
+      // especially:
+      //   Zechner, Heinz, and Ernst Stadlober. Generating beta variates via
+      //   patchwork rejection. Computing 50.1 (1993): 1-18.
+
+      DEGENERATE_SMALL,  // a_ is abnormally small.
+      DEGENERATE_LARGE,  // a_ is abnormally large.
+    };
+
+    result_type alpha_;
+    result_type beta_;
+
+    result_type a_;  // the smaller of {alpha, beta}, or 1.0/alpha_ in JOEHNK
+    result_type b_;  // the larger of {alpha, beta}, or 1.0/beta_ in JOEHNK
+    result_type x_;  // alpha + beta, or the result in degenerate cases
+    result_type log_x_;  // log(x_)
+    result_type y_;      // "beta" in Cheng
+    result_type gamma_;  // "gamma" in Cheng
+
+    Method method_;
+
+    // Placing this last for optimal alignment.
+    // Whether alpha_ != a_, i.e. true iff alpha_ > beta_.
+    bool inverted_;
+
+    static_assert(std::is_floating_point<RealType>::value,
+                  "Class-template absl::beta_distribution<> must be "
+                  "parameterized using a floating-point type.");
+  };
+
+  beta_distribution() : beta_distribution(1) {}
+
+  explicit beta_distribution(result_type alpha, result_type beta = 1)
+      : param_(alpha, beta) {}
+
+  explicit beta_distribution(const param_type& p) : param_(p) {}
+
+  void reset() {}
+
+  // Generating functions
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  param_type param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  result_type(min)() const { return 0; }
+  result_type(max)() const { return 1; }
+
+  result_type alpha() const { return param_.alpha(); }
+  result_type beta() const { return param_.beta(); }
+
+  friend bool operator==(const beta_distribution& a,
+                         const beta_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const beta_distribution& a,
+                         const beta_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  template <typename URBG>
+  result_type AlgorithmJoehnk(URBG& g,  // NOLINT(runtime/references)
+                              const param_type& p);
+
+  template <typename URBG>
+  result_type AlgorithmCheng(URBG& g,  // NOLINT(runtime/references)
+                             const param_type& p);
+
+  template <typename URBG>
+  result_type DegenerateCase(URBG& g,  // NOLINT(runtime/references)
+                             const param_type& p) {
+    if (p.method_ == param_type::DEGENERATE_SMALL && p.alpha_ == p.beta_) {
+      // Returns 0 or 1 with equal probability.
+      random_internal::FastUniformBits<uint8_t> fast_u8;
+      return static_cast<result_type>((fast_u8(g) & 0x10) !=
+                                      0);  // pick any single bit.
+    }
+    return p.x_;
+  }
+
+  param_type param_;
+  random_internal::FastUniformBits<uint64_t> fast_u64_;
+};
+
+#if defined(__powerpc64__) || defined(__PPC64__) || defined(__powerpc__) || \
+    defined(__ppc__) || defined(__PPC__)
+// PPC needs a more stringent boundary for long double.
+template <>
+constexpr long double
+beta_distribution<long double>::param_type::ThresholdPadding() {
+  return 10;
+}
+#endif
+
+template <typename RealType>
+template <typename URBG>
+typename beta_distribution<RealType>::result_type
+beta_distribution<RealType>::AlgorithmJoehnk(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  // Based on Joehnk, M. D. Erzeugung von betaverteilten und gammaverteilten
+  // Zufallszahlen. Metrika 8.1 (1964): 5-15.
+  // This method is described in Knuth, Vol 2 (Third Edition), pp 134.
+  using RandU64ToReal = typename random_internal::RandU64ToReal<result_type>;
+  using random_internal::PositiveValueT;
+  result_type u, v, x, y, z;
+  for (;;) {
+    u = RandU64ToReal::template Value<PositiveValueT, false>(fast_u64_(g));
+    v = RandU64ToReal::template Value<PositiveValueT, false>(fast_u64_(g));
+
+    // Direct method. std::pow is slow for float, so rely on the optimizer to
+    // remove the std::pow() path for that case.
+    if (!std::is_same<float, result_type>::value) {
+      x = std::pow(u, p.a_);
+      y = std::pow(v, p.b_);
+      z = x + y;
+      if (z > 1) {
+        // Reject if and only if `x + y > 1.0`
+        continue;
+      }
+      if (z > 0) {
+        // When both alpha and beta are small, x and y are both close to 0, so
+        // divide by (x+y) directly may result in nan.
+        return x / z;
+      }
+    }
+
+    // Log transform.
+    // x = log( pow(u, p.a_) ), y = log( pow(v, p.b_) )
+    // since u, v <= 1.0,  x, y < 0.
+    x = std::log(u) * p.a_;
+    y = std::log(v) * p.b_;
+    if (!std::isfinite(x) || !std::isfinite(y)) {
+      continue;
+    }
+    // z = log( pow(u, a) + pow(v, b) )
+    z = x > y ? (x + std::log(1 + std::exp(y - x)))
+              : (y + std::log(1 + std::exp(x - y)));
+    // Reject iff log(x+y) > 0.
+    if (z > 0) {
+      continue;
+    }
+    return std::exp(x - z);
+  }
+}
+
+template <typename RealType>
+template <typename URBG>
+typename beta_distribution<RealType>::result_type
+beta_distribution<RealType>::AlgorithmCheng(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  // Based on Cheng, Russell CH. Generating beta variates with nonintegral
+  // shape parameters. Communications of the ACM 21.4 (1978): 317-322.
+  // (https://dl.acm.org/citation.cfm?id=359482).
+  using RandU64ToReal = typename random_internal::RandU64ToReal<result_type>;
+  using random_internal::PositiveValueT;
+
+  static constexpr result_type kLogFour =
+      result_type(1.3862943611198906188344642429163531361);  // log(4)
+  static constexpr result_type kS =
+      result_type(2.6094379124341003746007593332261876);  // 1+log(5)
+
+  const bool use_algorithm_ba = (p.method_ == param_type::CHENG_BA);
+  result_type u1, u2, v, w, z, r, s, t, bw_inv, lhs;
+  for (;;) {
+    u1 = RandU64ToReal::template Value<PositiveValueT, false>(fast_u64_(g));
+    u2 = RandU64ToReal::template Value<PositiveValueT, false>(fast_u64_(g));
+    v = p.y_ * std::log(u1 / (1 - u1));
+    w = p.a_ * std::exp(v);
+    bw_inv = result_type(1) / (p.b_ + w);
+    r = p.gamma_ * v - kLogFour;
+    s = p.a_ + r - w;
+    z = u1 * u1 * u2;
+    if (!use_algorithm_ba && s + kS >= 5 * z) {
+      break;
+    }
+    t = std::log(z);
+    if (!use_algorithm_ba && s >= t) {
+      break;
+    }
+    lhs = p.x_ * (p.log_x_ + std::log(bw_inv)) + r;
+    if (lhs >= t) {
+      break;
+    }
+  }
+  return p.inverted_ ? (1 - w * bw_inv) : w * bw_inv;
+}
+
+template <typename RealType>
+template <typename URBG>
+typename beta_distribution<RealType>::result_type
+beta_distribution<RealType>::operator()(URBG& g,  // NOLINT(runtime/references)
+                                        const param_type& p) {
+  switch (p.method_) {
+    case param_type::JOEHNK:
+      return AlgorithmJoehnk(g, p);
+    case param_type::CHENG_BA:
+      ABSL_FALLTHROUGH_INTENDED;
+    case param_type::CHENG_BB:
+      return AlgorithmCheng(g, p);
+    default:
+      return DegenerateCase(g, p);
+  }
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const beta_distribution<RealType>& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<RealType>::kPrecision);
+  os << x.alpha() << os.fill() << x.beta();
+  return os;
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    beta_distribution<RealType>& x) {       // NOLINT(runtime/references)
+  using result_type = typename beta_distribution<RealType>::result_type;
+  using param_type = typename beta_distribution<RealType>::param_type;
+  result_type alpha, beta;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  alpha = random_internal::read_floating_point<result_type>(is);
+  if (is.fail()) return is;
+  beta = random_internal::read_floating_point<result_type>(is);
+  if (!is.fail()) {
+    x.param(param_type(alpha, beta));
+  }
+  return is;
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_BETA_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/discrete_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/discrete_distribution.h
new file mode 100644 (file)
index 0000000..1560f03
--- /dev/null
@@ -0,0 +1,245 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_DISCRETE_DISTRIBUTION_H_
+#define ABSL_RANDOM_DISCRETE_DISTRIBUTION_H_
+
+#include <cassert>
+#include <cmath>
+#include <istream>
+#include <limits>
+#include <numeric>
+#include <type_traits>
+#include <utility>
+#include <vector>
+
+#include "absl/random/bernoulli_distribution.h"
+#include "absl/random/internal/iostream_state_saver.h"
+#include "absl/random/uniform_int_distribution.h"
+
+namespace absl {
+
+// absl::discrete_distribution
+//
+// A discrete distribution produces random integers i, where 0 <= i < n
+// distributed according to the discrete probability function:
+//
+//     P(i|p0,...,pn−1)=pi
+//
+// This class is an implementation of discrete_distribution (see
+// [rand.dist.samp.discrete]).
+//
+// The algorithm used is Walker's Aliasing algorithm, described in Knuth, Vol 2.
+// absl::discrete_distribution takes O(N) time to precompute the probabilities
+// (where N is the number of possible outcomes in the distribution) at
+// construction, and then takes O(1) time for each variate generation.  Many
+// other implementations also take O(N) time to construct an ordered sequence of
+// partial sums, plus O(log N) time per variate to binary search.
+//
+template <typename IntType = int>
+class discrete_distribution {
+ public:
+  using result_type = IntType;
+
+  class param_type {
+   public:
+    using distribution_type = discrete_distribution;
+
+    param_type() { init(); }
+
+    template <typename InputIterator>
+    explicit param_type(InputIterator begin, InputIterator end)
+        : p_(begin, end) {
+      init();
+    }
+
+    explicit param_type(std::initializer_list<double> weights) : p_(weights) {
+      init();
+    }
+
+    template <class UnaryOperation>
+    explicit param_type(size_t nw, double xmin, double xmax,
+                        UnaryOperation fw) {
+      if (nw > 0) {
+        p_.reserve(nw);
+        double delta = (xmax - xmin) / static_cast<double>(nw);
+        assert(delta > 0);
+        double t = delta * 0.5;
+        for (size_t i = 0; i < nw; ++i) {
+          p_.push_back(fw(xmin + i * delta + t));
+        }
+      }
+      init();
+    }
+
+    const std::vector<double>& probabilities() const { return p_; }
+    size_t n() const { return p_.size() - 1; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.probabilities() == b.probabilities();
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class discrete_distribution;
+
+    void init();
+
+    std::vector<double> p_;                     // normalized probabilities
+    std::vector<std::pair<double, size_t>> q_;  // (acceptance, alternate) pairs
+
+    static_assert(std::is_integral<result_type>::value,
+                  "Class-template absl::discrete_distribution<> must be "
+                  "parameterized using an integral type.");
+  };
+
+  discrete_distribution() : param_() {}
+
+  explicit discrete_distribution(const param_type& p) : param_(p) {}
+
+  template <typename InputIterator>
+  explicit discrete_distribution(InputIterator begin, InputIterator end)
+      : param_(begin, end) {}
+
+  explicit discrete_distribution(std::initializer_list<double> weights)
+      : param_(weights) {}
+
+  template <class UnaryOperation>
+  explicit discrete_distribution(size_t nw, double xmin, double xmax,
+                                 UnaryOperation fw)
+      : param_(nw, xmin, xmax, std::move(fw)) {}
+
+  void reset() {}
+
+  // generating functions
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  const param_type& param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  result_type(min)() const { return 0; }
+  result_type(max)() const {
+    return static_cast<result_type>(param_.n());
+  }  // inclusive
+
+  // NOTE [rand.dist.sample.discrete] returns a std::vector<double> not a
+  // const std::vector<double>&.
+  const std::vector<double>& probabilities() const {
+    return param_.probabilities();
+  }
+
+  friend bool operator==(const discrete_distribution& a,
+                         const discrete_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const discrete_distribution& a,
+                         const discrete_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  param_type param_;
+};
+
+// --------------------------------------------------------------------------
+// Implementation details only below
+// --------------------------------------------------------------------------
+
+namespace random_internal {
+
+// Using the vector `*probabilities`, whose values are the weights or
+// probabilities of an element being selected, constructs the proportional
+// probabilities used by the discrete distribution.  `*probabilities` will be
+// scaled, if necessary, so that its entries sum to a value sufficiently close
+// to 1.0.
+std::vector<std::pair<double, size_t>> InitDiscreteDistribution(
+    std::vector<double>* probabilities);
+
+}  // namespace random_internal
+
+template <typename IntType>
+void discrete_distribution<IntType>::param_type::init() {
+  if (p_.empty()) {
+    p_.push_back(1.0);
+    q_.emplace_back(1.0, 0);
+  } else {
+    assert(n() <= (std::numeric_limits<IntType>::max)());
+    q_ = random_internal::InitDiscreteDistribution(&p_);
+  }
+}
+
+template <typename IntType>
+template <typename URBG>
+typename discrete_distribution<IntType>::result_type
+discrete_distribution<IntType>::operator()(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  const auto idx = absl::uniform_int_distribution<result_type>(0, p.n())(g);
+  const auto& q = p.q_[idx];
+  const bool selected = absl::bernoulli_distribution(q.first)(g);
+  return selected ? idx : static_cast<result_type>(q.second);
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const discrete_distribution<IntType>& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  const auto& probabilities = x.param().probabilities();
+  os << probabilities.size();
+
+  os.precision(random_internal::stream_precision_helper<double>::kPrecision);
+  for (const auto& p : probabilities) {
+    os << os.fill() << p;
+  }
+  return os;
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    discrete_distribution<IntType>& x) {    // NOLINT(runtime/references)
+  using param_type = typename discrete_distribution<IntType>::param_type;
+  auto saver = random_internal::make_istream_state_saver(is);
+
+  size_t n;
+  std::vector<double> p;
+
+  is >> n;
+  if (is.fail()) return is;
+  if (n > 0) {
+    p.reserve(n);
+    for (IntType i = 0; i < n && !is.fail(); ++i) {
+      auto tmp = random_internal::read_floating_point<double>(is);
+      if (is.fail()) return is;
+      p.push_back(tmp);
+    }
+  }
+  x.param(param_type(p.begin(), p.end()));
+  return is;
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_DISCRETE_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/distribution_format_traits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/distribution_format_traits.h
new file mode 100644 (file)
index 0000000..3f28c90
--- /dev/null
@@ -0,0 +1,249 @@
+//
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef ABSL_RANDOM_DISTRIBUTION_FORMAT_TRAITS_H_
+#define ABSL_RANDOM_DISTRIBUTION_FORMAT_TRAITS_H_
+
+#include <string>
+#include <tuple>
+#include <typeinfo>
+
+#include "absl/meta/type_traits.h"
+#include "absl/random/bernoulli_distribution.h"
+#include "absl/random/beta_distribution.h"
+#include "absl/random/exponential_distribution.h"
+#include "absl/random/gaussian_distribution.h"
+#include "absl/random/log_uniform_int_distribution.h"
+#include "absl/random/poisson_distribution.h"
+#include "absl/random/uniform_int_distribution.h"
+#include "absl/random/uniform_real_distribution.h"
+#include "absl/random/zipf_distribution.h"
+#include "absl/strings/str_cat.h"
+#include "absl/strings/str_join.h"
+#include "absl/strings/string_view.h"
+#include "absl/types/span.h"
+
+namespace absl {
+namespace random_internal {
+
+// ScalarTypeName defines a preferred hierarchy of preferred type names for
+// scalars, and is evaluated at compile time for the specific type
+// specialization.
+template <typename T>
+constexpr const char* ScalarTypeName() {
+  static_assert(std::is_integral<T>() || std::is_floating_point<T>(), "");
+  // clang-format off
+    return
+        std::is_same<T, float>::value ? "float" :
+        std::is_same<T, double>::value ? "double" :
+        std::is_same<T, long double>::value ? "long double" :
+        std::is_same<T, bool>::value ? "bool" :
+        std::is_signed<T>::value && sizeof(T) == 1 ? "int8_t" :
+        std::is_signed<T>::value && sizeof(T) == 2 ? "int16_t" :
+        std::is_signed<T>::value && sizeof(T) == 4 ? "int32_t" :
+        std::is_signed<T>::value && sizeof(T) == 8 ? "int64_t" :
+        std::is_unsigned<T>::value && sizeof(T) == 1 ? "uint8_t" :
+        std::is_unsigned<T>::value && sizeof(T) == 2 ? "uint16_t" :
+        std::is_unsigned<T>::value && sizeof(T) == 4 ? "uint32_t" :
+        std::is_unsigned<T>::value && sizeof(T) == 8 ? "uint64_t" :
+            "undefined";
+  // clang-format on
+
+  // NOTE: It would be nice to use typeid(T).name(), but that's an
+  // implementation-defined attribute which does not necessarily
+  // correspond to a name. We could potentially demangle it
+  // using, e.g. abi::__cxa_demangle.
+}
+
+// Distribution traits used by DistributionCaller and internal implementation
+// details of the mocking framework.
+/*
+struct DistributionFormatTraits {
+   // Returns the parameterized name of the distribution function.
+   static constexpr const char* FunctionName()
+   // Format DistrT parameters.
+   static std::string FormatArgs(DistrT& dist);
+   // Format DistrT::result_type results.
+   static std::string FormatResults(DistrT& dist);
+};
+*/
+template <typename DistrT>
+struct DistributionFormatTraits;
+
+template <typename R>
+struct DistributionFormatTraits<absl::uniform_int_distribution<R>> {
+  using distribution_t = absl::uniform_int_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Uniform"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat("absl::IntervalClosedClosed, ", (d.min)(), ", ",
+                        (d.max)());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::uniform_real_distribution<R>> {
+  using distribution_t = absl::uniform_real_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Uniform"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat((d.min)(), ", ", (d.max)());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::exponential_distribution<R>> {
+  using distribution_t = absl::exponential_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Exponential"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat(d.lambda());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::poisson_distribution<R>> {
+  using distribution_t = absl::poisson_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Poisson"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat(d.mean());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <>
+struct DistributionFormatTraits<absl::bernoulli_distribution> {
+  using distribution_t = absl::bernoulli_distribution;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Bernoulli"; }
+
+  static constexpr const char* FunctionName() { return Name(); }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat(d.p());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::beta_distribution<R>> {
+  using distribution_t = absl::beta_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Beta"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat(d.alpha(), ", ", d.beta());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::zipf_distribution<R>> {
+  using distribution_t = absl::zipf_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Zipf"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrCat(d.k(), ", ", d.v(), ", ", d.q());
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::gaussian_distribution<R>> {
+  using distribution_t = absl::gaussian_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "Gaussian"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrJoin(std::make_tuple(d.mean(), d.stddev()), ", ");
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+template <typename R>
+struct DistributionFormatTraits<absl::log_uniform_int_distribution<R>> {
+  using distribution_t = absl::log_uniform_int_distribution<R>;
+  using result_t = typename distribution_t::result_type;
+
+  static constexpr const char* Name() { return "LogUniform"; }
+
+  static std::string FunctionName() {
+    return absl::StrCat(Name(), "<", ScalarTypeName<R>(), ">");
+  }
+  static std::string FormatArgs(const distribution_t& d) {
+    return absl::StrJoin(std::make_tuple((d.min)(), (d.max)(), d.base()), ", ");
+  }
+  static std::string FormatResults(absl::Span<const result_t> results) {
+    return absl::StrJoin(results, ", ");
+  }
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_DISTRIBUTION_FORMAT_TRAITS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/distributions.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/distributions.h
new file mode 100644 (file)
index 0000000..c37b734
--- /dev/null
@@ -0,0 +1,442 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: distributions.h
+// -----------------------------------------------------------------------------
+//
+// This header defines functions representing distributions, which you use in
+// combination with an Abseil random bit generator to produce random values
+// according to the rules of that distribution.
+//
+// The Abseil random library defines the following distributions within this
+// file:
+//
+//   * `absl::Uniform` for uniform (constant) distributions having constant
+//     probability
+//   * `absl::Bernoulli` for discrete distributions having exactly two outcomes
+//   * `absl::Beta` for continuous distributions parameterized through two
+//     free parameters
+//   * `absl::Exponential` for discrete distributions of events occurring
+//     continuously and independently at a constant average rate
+//   * `absl::Gaussian` (also known as "normal distributions") for continuous
+//     distributions using an associated quadratic function
+//   * `absl::LogUniform` for continuous uniform distributions where the log
+//     to the given base of all values is uniform
+//   * `absl::Poisson` for discrete probability distributions that express the
+//     probability of a given number of events occurring within a fixed interval
+//   * `absl::Zipf` for discrete probability distributions commonly used for
+//     modelling of rare events
+//
+// Prefer use of these distribution function classes over manual construction of
+// your own distribution classes, as it allows library maintainers greater
+// flexibility to change the underlying implementation in the future.
+
+#ifndef ABSL_RANDOM_DISTRIBUTIONS_H_
+#define ABSL_RANDOM_DISTRIBUTIONS_H_
+
+#include <algorithm>
+#include <cmath>
+#include <limits>
+#include <random>
+#include <type_traits>
+
+#include "absl/base/internal/inline_variable.h"
+#include "absl/random/bernoulli_distribution.h"
+#include "absl/random/beta_distribution.h"
+#include "absl/random/distribution_format_traits.h"
+#include "absl/random/exponential_distribution.h"
+#include "absl/random/gaussian_distribution.h"
+#include "absl/random/internal/distributions.h"  // IWYU pragma: export
+#include "absl/random/internal/uniform_helper.h"  // IWYU pragma: export
+#include "absl/random/log_uniform_int_distribution.h"
+#include "absl/random/poisson_distribution.h"
+#include "absl/random/uniform_int_distribution.h"
+#include "absl/random/uniform_real_distribution.h"
+#include "absl/random/zipf_distribution.h"
+
+namespace absl {
+
+ABSL_INTERNAL_INLINE_CONSTEXPR(random_internal::IntervalClosedClosedT,
+                               IntervalClosedClosed, {});
+ABSL_INTERNAL_INLINE_CONSTEXPR(random_internal::IntervalClosedClosedT,
+                               IntervalClosed, {});
+ABSL_INTERNAL_INLINE_CONSTEXPR(random_internal::IntervalClosedOpenT,
+                               IntervalClosedOpen, {});
+ABSL_INTERNAL_INLINE_CONSTEXPR(random_internal::IntervalOpenOpenT,
+                               IntervalOpenOpen, {});
+ABSL_INTERNAL_INLINE_CONSTEXPR(random_internal::IntervalOpenOpenT,
+                               IntervalOpen, {});
+ABSL_INTERNAL_INLINE_CONSTEXPR(random_internal::IntervalOpenClosedT,
+                               IntervalOpenClosed, {});
+
+// -----------------------------------------------------------------------------
+// absl::Uniform<T>(tag, bitgen, lo, hi)
+// -----------------------------------------------------------------------------
+//
+// `absl::Uniform()` produces random values of type `T` uniformly distributed in
+// a defined interval {lo, hi}. The interval `tag` defines the type of interval
+// which should be one of the following possible values:
+//
+//   * `absl::IntervalOpenOpen`
+//   * `absl::IntervalOpenClosed`
+//   * `absl::IntervalClosedOpen`
+//   * `absl::IntervalClosedClosed`
+//
+// where "open" refers to an exclusive value (excluded) from the output, while
+// "closed" refers to an inclusive value (included) from the output.
+//
+// In the absence of an explicit return type `T`, `absl::Uniform()` will deduce
+// the return type based on the provided endpoint arguments {A lo, B hi}.
+// Given these endpoints, one of {A, B} will be chosen as the return type, if
+// a type can be implicitly converted into the other in a lossless way. The
+// lack of any such implcit conversion between {A, B} will produce a
+// compile-time error
+//
+// See https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//
+//   // Produce a random float value between 0.0 and 1.0, inclusive
+//   auto x = absl::Uniform(absl::IntervalClosedClosed, bitgen, 0.0f, 1.0f);
+//
+//   // The most common interval of `absl::IntervalClosedOpen` is available by
+//   // default:
+//
+//   auto x = absl::Uniform(bitgen, 0.0f, 1.0f);
+//
+//   // Return-types are typically inferred from the arguments, however callers
+//   // can optionally provide an explicit return-type to the template.
+//
+//   auto x = absl::Uniform<float>(bitgen, 0, 1);
+//
+template <typename R = void, typename TagType, typename URBG>
+typename absl::enable_if_t<!std::is_same<R, void>::value, R>  //
+Uniform(TagType tag,
+        URBG&& urbg,  // NOLINT(runtime/references)
+        R lo, R hi) {
+  using gen_t = absl::decay_t<URBG>;
+  return random_internal::UniformImpl<R, TagType, gen_t>(tag, urbg, lo, hi);
+}
+
+// absl::Uniform<T>(bitgen, lo, hi)
+//
+// Overload of `Uniform()` using the default closed-open interval of [lo, hi),
+// and returning values of type `T`
+template <typename R = void, typename URBG>
+typename absl::enable_if_t<!std::is_same<R, void>::value, R>  //
+Uniform(URBG&& urbg,  // NOLINT(runtime/references)
+        R lo, R hi) {
+  constexpr auto tag = absl::IntervalClosedOpen;
+  using tag_t = decltype(tag);
+  using gen_t = absl::decay_t<URBG>;
+
+  return random_internal::UniformImpl<R, tag_t, gen_t>(tag, urbg, lo, hi);
+}
+
+// absl::Uniform(tag, bitgen, lo, hi)
+//
+// Overload of `Uniform()` using different (but compatible) lo, hi types. Note
+// that a compile-error will result if the return type cannot be deduced
+// correctly from the passed types.
+template <typename R = void, typename TagType, typename URBG, typename A,
+          typename B>
+typename absl::enable_if_t<std::is_same<R, void>::value,
+                           random_internal::uniform_inferred_return_t<A, B>>
+Uniform(TagType tag,
+        URBG&& urbg,  // NOLINT(runtime/references)
+        A lo, B hi) {
+  using gen_t = absl::decay_t<URBG>;
+  using return_t = typename random_internal::uniform_inferred_return_t<A, B>;
+
+  return random_internal::UniformImpl<return_t, TagType, gen_t>(tag, urbg, lo,
+                                                                hi);
+}
+
+// absl::Uniform(bitgen, lo, hi)
+//
+// Overload of `Uniform()` using different (but compatible) lo, hi types and the
+// default closed-open interval of [lo, hi). Note that a compile-error will
+// result if the return type cannot be deduced correctly from the passed types.
+template <typename R = void, typename URBG, typename A, typename B>
+typename absl::enable_if_t<std::is_same<R, void>::value,
+                           random_internal::uniform_inferred_return_t<A, B>>
+Uniform(URBG&& urbg,  // NOLINT(runtime/references)
+        A lo, B hi) {
+  constexpr auto tag = absl::IntervalClosedOpen;
+  using tag_t = decltype(tag);
+  using gen_t = absl::decay_t<URBG>;
+  using return_t = typename random_internal::uniform_inferred_return_t<A, B>;
+
+  return random_internal::UniformImpl<return_t, tag_t, gen_t>(tag, urbg, lo,
+                                                              hi);
+}
+
+// absl::Uniform<unsigned T>(bitgen)
+//
+// Overload of Uniform() using the minimum and maximum values of a given type
+// `T` (which must be unsigned), returning a value of type `unsigned T`
+template <typename R, typename URBG>
+typename absl::enable_if_t<!std::is_signed<R>::value, R>  //
+Uniform(URBG&& urbg) {  // NOLINT(runtime/references)
+  constexpr auto tag = absl::IntervalClosedClosed;
+  constexpr auto lo = std::numeric_limits<R>::lowest();
+  constexpr auto hi = (std::numeric_limits<R>::max)();
+  using tag_t = decltype(tag);
+  using gen_t = absl::decay_t<URBG>;
+
+  return random_internal::UniformImpl<R, tag_t, gen_t>(tag, urbg, lo, hi);
+}
+
+// -----------------------------------------------------------------------------
+// absl::Bernoulli(bitgen, p)
+// -----------------------------------------------------------------------------
+//
+// `absl::Bernoulli` produces a random boolean value, with probability `p`
+// (where 0.0 <= p <= 1.0) equaling `true`.
+//
+// Prefer `absl::Bernoulli` to produce boolean values over other alternatives
+// such as comparing an `absl::Uniform()` value to a specific output.
+//
+// See https://en.wikipedia.org/wiki/Bernoulli_distribution
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   if (absl::Bernoulli(bitgen, 1.0/3721.0)) {
+//     std::cout << "Asteroid field navigation successful.";
+//   }
+//
+template <typename URBG>
+bool Bernoulli(URBG&& urbg,  // NOLINT(runtime/references)
+               double p) {
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = absl::bernoulli_distribution;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, p);
+}
+
+// -----------------------------------------------------------------------------
+// absl::Beta<T>(bitgen, alpha, beta)
+// -----------------------------------------------------------------------------
+//
+// `absl::Beta` produces a floating point number distributed in the closed
+// interval [0,1] and parameterized by two values `alpha` and `beta` as per a
+// Beta distribution. `T` must be a floating point type, but may be inferred
+// from the types of `alpha` and `beta`.
+//
+// See https://en.wikipedia.org/wiki/Beta_distribution.
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   double sample = absl::Beta(bitgen, 3.0, 2.0);
+//
+template <typename RealType, typename URBG>
+RealType Beta(URBG&& urbg,  // NOLINT(runtime/references)
+              RealType alpha, RealType beta) {
+  static_assert(
+      std::is_floating_point<RealType>::value,
+      "Template-argument 'RealType' must be a floating-point type, in "
+      "absl::Beta<RealType, URBG>(...)");
+
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = typename absl::beta_distribution<RealType>;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, alpha, beta);
+}
+
+// -----------------------------------------------------------------------------
+// absl::Exponential<T>(bitgen, lambda = 1)
+// -----------------------------------------------------------------------------
+//
+// `absl::Exponential` produces a floating point number for discrete
+// distributions of events occurring continuously and independently at a
+// constant average rate. `T` must be a floating point type, but may be inferred
+// from the type of `lambda`.
+//
+// See https://en.wikipedia.org/wiki/Exponential_distribution.
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   double call_length = absl::Exponential(bitgen, 7.0);
+//
+template <typename RealType, typename URBG>
+RealType Exponential(URBG&& urbg,  // NOLINT(runtime/references)
+                     RealType lambda = 1) {
+  static_assert(
+      std::is_floating_point<RealType>::value,
+      "Template-argument 'RealType' must be a floating-point type, in "
+      "absl::Exponential<RealType, URBG>(...)");
+
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = typename absl::exponential_distribution<RealType>;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, lambda);
+}
+
+// -----------------------------------------------------------------------------
+// absl::Gaussian<T>(bitgen, mean = 0, stddev = 1)
+// -----------------------------------------------------------------------------
+//
+// `absl::Gaussian` produces a floating point number selected from the Gaussian
+// (ie. "Normal") distribution. `T` must be a floating point type, but may be
+// inferred from the types of `mean` and `stddev`.
+//
+// See https://en.wikipedia.org/wiki/Normal_distribution
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   double giraffe_height = absl::Gaussian(bitgen, 16.3, 3.3);
+//
+template <typename RealType, typename URBG>
+RealType Gaussian(URBG&& urbg,  // NOLINT(runtime/references)
+                  RealType mean = 0, RealType stddev = 1) {
+  static_assert(
+      std::is_floating_point<RealType>::value,
+      "Template-argument 'RealType' must be a floating-point type, in "
+      "absl::Gaussian<RealType, URBG>(...)");
+
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = typename absl::gaussian_distribution<RealType>;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, mean, stddev);
+}
+
+// -----------------------------------------------------------------------------
+// absl::LogUniform<T>(bitgen, lo, hi, base = 2)
+// -----------------------------------------------------------------------------
+//
+// `absl::LogUniform` produces random values distributed where the log to a
+// given base of all values is uniform in a closed interval [lo, hi]. `T` must
+// be an integral type, but may be inferred from the types of `lo` and `hi`.
+//
+// I.e., `LogUniform(0, n, b)` is uniformly distributed across buckets
+// [0], [1, b-1], [b, b^2-1] .. [b^(k-1), (b^k)-1] .. [b^floor(log(n, b)), n]
+// and is uniformly distributed within each bucket.
+//
+// The resulting probability density is inversely related to bucket size, though
+// values in the final bucket may be more likely than previous values. (In the
+// extreme case where n = b^i the final value will be tied with zero as the most
+// probable result.
+//
+// If `lo` is nonzero then this distribution is shifted to the desired interval,
+// so LogUniform(lo, hi, b) is equivalent to LogUniform(0, hi-lo, b)+lo.
+//
+// See http://ecolego.facilia.se/ecolego/show/Log-Uniform%20Distribution
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   int v = absl::LogUniform(bitgen, 0, 1000);
+//
+template <typename IntType, typename URBG>
+IntType LogUniform(URBG&& urbg,  // NOLINT(runtime/references)
+                   IntType lo, IntType hi, IntType base = 2) {
+  static_assert(std::is_integral<IntType>::value,
+                "Template-argument 'IntType' must be an integral type, in "
+                "absl::LogUniform<IntType, URBG>(...)");
+
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = typename absl::log_uniform_int_distribution<IntType>;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, lo, hi, base);
+}
+
+// -----------------------------------------------------------------------------
+// absl::Poisson<T>(bitgen, mean = 1)
+// -----------------------------------------------------------------------------
+//
+// `absl::Poisson` produces discrete probabilities for a given number of events
+// occurring within a fixed interval within the closed interval [0, max]. `T`
+// must be an integral type.
+//
+// See https://en.wikipedia.org/wiki/Poisson_distribution
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   int requests_per_minute = absl::Poisson<int>(bitgen, 3.2);
+//
+template <typename IntType, typename URBG>
+IntType Poisson(URBG&& urbg,  // NOLINT(runtime/references)
+                double mean = 1.0) {
+  static_assert(std::is_integral<IntType>::value,
+                "Template-argument 'IntType' must be an integral type, in "
+                "absl::Poisson<IntType, URBG>(...)");
+
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = typename absl::poisson_distribution<IntType>;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, mean);
+}
+
+// -----------------------------------------------------------------------------
+// absl::Zipf<T>(bitgen, hi = max, q = 2, v = 1)
+// -----------------------------------------------------------------------------
+//
+// `absl::Zipf` produces discrete probabilities commonly used for modelling of
+// rare events over the closed interval [0, hi]. The parameters `v` and `q`
+// determine the skew of the distribution. `T`  must be an integral type, but
+// may be inferred from the type of `hi`.
+//
+// See http://mathworld.wolfram.com/ZipfDistribution.html
+//
+// Example:
+//
+//   absl::BitGen bitgen;
+//   ...
+//   int term_rank = absl::Zipf<int>(bitgen);
+//
+template <typename IntType, typename URBG>
+IntType Zipf(URBG&& urbg,  // NOLINT(runtime/references)
+             IntType hi = (std::numeric_limits<IntType>::max)(), double q = 2.0,
+             double v = 1.0) {
+  static_assert(std::is_integral<IntType>::value,
+                "Template-argument 'IntType' must be an integral type, in "
+                "absl::Zipf<IntType, URBG>(...)");
+
+  using gen_t = absl::decay_t<URBG>;
+  using distribution_t = typename absl::zipf_distribution<IntType>;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  return random_internal::DistributionCaller<gen_t>::template Call<
+      distribution_t, format_t>(&urbg, hi, q, v);
+}
+
+}  // namespace absl.
+
+#endif  // ABSL_RANDOM_DISTRIBUTIONS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/exponential_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/exponential_distribution.h
new file mode 100644 (file)
index 0000000..c8af197
--- /dev/null
@@ -0,0 +1,157 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_
+#define ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_
+
+#include <cassert>
+#include <cmath>
+#include <istream>
+#include <limits>
+#include <type_traits>
+
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+
+// absl::exponential_distribution:
+// Generates a number conforming to an exponential distribution and is
+// equivalent to the standard [rand.dist.pois.exp] distribution.
+template <typename RealType = double>
+class exponential_distribution {
+ public:
+  using result_type = RealType;
+
+  class param_type {
+   public:
+    using distribution_type = exponential_distribution;
+
+    explicit param_type(result_type lambda = 1) : lambda_(lambda) {
+      assert(lambda > 0);
+      neg_inv_lambda_ = -result_type(1) / lambda_;
+    }
+
+    result_type lambda() const { return lambda_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.lambda_ == b.lambda_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class exponential_distribution;
+
+    result_type lambda_;
+    result_type neg_inv_lambda_;
+
+    static_assert(
+        std::is_floating_point<RealType>::value,
+        "Class-template absl::exponential_distribution<> must be parameterized "
+        "using a floating-point type.");
+  };
+
+  exponential_distribution() : exponential_distribution(1) {}
+
+  explicit exponential_distribution(result_type lambda) : param_(lambda) {}
+
+  explicit exponential_distribution(const param_type& p) : param_(p) {}
+
+  void reset() {}
+
+  // Generating functions
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  param_type param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  result_type(min)() const { return 0; }
+  result_type(max)() const {
+    return std::numeric_limits<result_type>::infinity();
+  }
+
+  result_type lambda() const { return param_.lambda(); }
+
+  friend bool operator==(const exponential_distribution& a,
+                         const exponential_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const exponential_distribution& a,
+                         const exponential_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  param_type param_;
+  random_internal::FastUniformBits<uint64_t> fast_u64_;
+};
+
+// --------------------------------------------------------------------------
+// Implementation details follow
+// --------------------------------------------------------------------------
+
+template <typename RealType>
+template <typename URBG>
+typename exponential_distribution<RealType>::result_type
+exponential_distribution<RealType>::operator()(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  using random_internal::NegativeValueT;
+  const result_type u = random_internal::RandU64ToReal<
+      result_type>::template Value<NegativeValueT, false>(fast_u64_(g));
+  // log1p(-x) is mathematically equivalent to log(1 - x) but has more
+  // accuracy for x near zero.
+  return p.neg_inv_lambda_ * std::log1p(u);
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const exponential_distribution<RealType>& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<RealType>::kPrecision);
+  os << x.lambda();
+  return os;
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,    // NOLINT(runtime/references)
+    exponential_distribution<RealType>& x) {  // NOLINT(runtime/references)
+  using result_type = typename exponential_distribution<RealType>::result_type;
+  using param_type = typename exponential_distribution<RealType>::param_type;
+  result_type lambda;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  lambda = random_internal::read_floating_point<result_type>(is);
+  if (!is.fail()) {
+    x.param(param_type(lambda));
+  }
+  return is;
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/gaussian_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/gaussian_distribution.h
new file mode 100644 (file)
index 0000000..1d1347b
--- /dev/null
@@ -0,0 +1,260 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_GAUSSIAN_DISTRIBUTION_H_
+#define ABSL_RANDOM_GAUSSIAN_DISTRIBUTION_H_
+
+// absl::gaussian_distribution implements the Ziggurat algorithm
+// for generating random gaussian numbers.
+//
+// Implementation based on "The Ziggurat Method for Generating Random Variables"
+// by George Marsaglia and Wai Wan Tsang: http://www.jstatsoft.org/v05/i08/
+//
+
+#include <cmath>
+#include <cstdint>
+#include <istream>
+#include <limits>
+#include <type_traits>
+
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+namespace random_internal {
+
+// absl::gaussian_distribution_base implements the underlying ziggurat algorithm
+// using the ziggurat tables generated by the gaussian_distribution_gentables
+// binary.
+//
+// The specific algorithm has some of the improvements suggested by the
+// 2005 paper, "An Improved Ziggurat Method to Generate Normal Random Samples",
+// Jurgen A Doornik.  (https://www.doornik.com/research/ziggurat.pdf)
+class gaussian_distribution_base {
+ public:
+  template <typename URBG>
+  inline double zignor(URBG& g);  // NOLINT(runtime/references)
+
+ private:
+  friend class TableGenerator;
+
+  template <typename URBG>
+  inline double zignor_fallback(URBG& g,  // NOLINT(runtime/references)
+                                bool neg);
+
+  // Constants used for the gaussian distribution.
+  static constexpr double kR = 3.442619855899;  // Start of the tail.
+  static constexpr double kRInv = 0.29047645161474317;  // ~= (1.0 / kR) .
+  static constexpr double kV = 9.91256303526217e-3;
+  static constexpr uint64_t kMask = 0x07f;
+
+  // The ziggurat tables store the pdf(f) and inverse-pdf(x) for equal-area
+  // points on one-half of the normal distribution, where the pdf function,
+  // pdf = e ^ (-1/2 *x^2), assumes that the mean = 0 & stddev = 1.
+  //
+  // These tables are just over 2kb in size; larger tables might improve the
+  // distributions, but also lead to more cache pollution.
+  //
+  // x = {3.71308, 3.44261, 3.22308, ..., 0}
+  // f = {0.00101, 0.00266, 0.00554, ..., 1}
+  struct Tables {
+    double x[kMask + 2];
+    double f[kMask + 2];
+  };
+  static const Tables zg_;
+  random_internal::FastUniformBits<uint64_t> fast_u64_;
+};
+
+}  // namespace random_internal
+
+// absl::gaussian_distribution:
+// Generates a number conforming to a Gaussian distribution.
+template <typename RealType = double>
+class gaussian_distribution : random_internal::gaussian_distribution_base {
+ public:
+  using result_type = RealType;
+
+  class param_type {
+   public:
+    using distribution_type = gaussian_distribution;
+
+    explicit param_type(result_type mean = 0, result_type stddev = 1)
+        : mean_(mean), stddev_(stddev) {}
+
+    // Returns the mean distribution parameter.  The mean specifies the location
+    // of the peak.  The default value is 0.0.
+    result_type mean() const { return mean_; }
+
+    // Returns the deviation distribution parameter.  The default value is 1.0.
+    result_type stddev() const { return stddev_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.mean_ == b.mean_ && a.stddev_ == b.stddev_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    result_type mean_;
+    result_type stddev_;
+
+    static_assert(
+        std::is_floating_point<RealType>::value,
+        "Class-template absl::gaussian_distribution<> must be parameterized "
+        "using a floating-point type.");
+  };
+
+  gaussian_distribution() : gaussian_distribution(0) {}
+
+  explicit gaussian_distribution(result_type mean, result_type stddev = 1)
+      : param_(mean, stddev) {}
+
+  explicit gaussian_distribution(const param_type& p) : param_(p) {}
+
+  void reset() {}
+
+  // Generating functions
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  param_type param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  result_type(min)() const {
+    return -std::numeric_limits<result_type>::infinity();
+  }
+  result_type(max)() const {
+    return std::numeric_limits<result_type>::infinity();
+  }
+
+  result_type mean() const { return param_.mean(); }
+  result_type stddev() const { return param_.stddev(); }
+
+  friend bool operator==(const gaussian_distribution& a,
+                         const gaussian_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const gaussian_distribution& a,
+                         const gaussian_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  param_type param_;
+};
+
+// --------------------------------------------------------------------------
+// Implementation details only below
+// --------------------------------------------------------------------------
+
+template <typename RealType>
+template <typename URBG>
+typename gaussian_distribution<RealType>::result_type
+gaussian_distribution<RealType>::operator()(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  return p.mean() + p.stddev() * static_cast<result_type>(zignor(g));
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const gaussian_distribution<RealType>& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<RealType>::kPrecision);
+  os << x.mean() << os.fill() << x.stddev();
+  return os;
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    gaussian_distribution<RealType>& x) {   // NOLINT(runtime/references)
+  using result_type = typename gaussian_distribution<RealType>::result_type;
+  using param_type = typename gaussian_distribution<RealType>::param_type;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  auto mean = random_internal::read_floating_point<result_type>(is);
+  if (is.fail()) return is;
+  auto stddev = random_internal::read_floating_point<result_type>(is);
+  if (!is.fail()) {
+    x.param(param_type(mean, stddev));
+  }
+  return is;
+}
+
+namespace random_internal {
+
+template <typename URBG>
+inline double gaussian_distribution_base::zignor_fallback(URBG& g, bool neg) {
+  // This fallback path happens approximately 0.05% of the time.
+  double x, y;
+  do {
+    // kRInv = 1/r, U(0, 1)
+    x = kRInv * std::log(RandU64ToDouble<PositiveValueT, false>(fast_u64_(g)));
+    y = -std::log(RandU64ToDouble<PositiveValueT, false>(fast_u64_(g)));
+  } while ((y + y) < (x * x));
+  return neg ? (x - kR) : (kR - x);
+}
+
+template <typename URBG>
+inline double gaussian_distribution_base::zignor(
+    URBG& g) {  // NOLINT(runtime/references)
+  while (true) {
+    // We use a single uint64_t to generate both a double and a strip.
+    // These bits are unused when the generated double is > 1/2^5.
+    // This may introduce some bias from the duplicated low bits of small
+    // values (those smaller than 1/2^5, which all end up on the left tail).
+    uint64_t bits = fast_u64_(g);
+    int i = static_cast<int>(bits & kMask);  // pick a random strip
+    double j = RandU64ToDouble<SignedValueT, false>(bits);  // U(-1, 1)
+    const double x = j * zg_.x[i];
+
+    // Retangular box. Handles >97% of all cases.
+    // For any given box, this handles between 75% and 99% of values.
+    // Equivalent to U(01) < (x[i+1] / x[i]), and when i == 0, ~93.5%
+    if (std::abs(x) < zg_.x[i + 1]) {
+      return x;
+    }
+
+    // i == 0: Base box. Sample using a ratio of uniforms.
+    if (i == 0) {
+      // This path happens about 0.05% of the time.
+      return zignor_fallback(g, j < 0);
+    }
+
+    // i > 0: Wedge samples using precomputed values.
+    double v = RandU64ToDouble<PositiveValueT, false>(fast_u64_(g));  // U(0, 1)
+    if ((zg_.f[i + 1] + v * (zg_.f[i] - zg_.f[i + 1])) <
+        std::exp(-0.5 * x * x)) {
+      return x;
+    }
+
+    // The wedge was missed; reject the value and try again.
+  }
+}
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_GAUSSIAN_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/chi_square.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/chi_square.h
new file mode 100644 (file)
index 0000000..fa8646f
--- /dev/null
@@ -0,0 +1,85 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_CHI_SQUARE_H_
+#define ABSL_RANDOM_INTERNAL_CHI_SQUARE_H_
+
+// The chi-square statistic.
+//
+// Useful for evaluating if `D` independent random variables are behaving as
+// expected, or if two distributions are similar.  (`D` is the degrees of
+// freedom).
+//
+// Each bucket should have an expected count of 10 or more for the chi square to
+// be meaningful.
+
+#include <cassert>
+
+namespace absl {
+namespace random_internal {
+
+constexpr const char kChiSquared[] = "chi-squared";
+
+// Returns the measured chi square value, using a single expected value.  This
+// assumes that the values in [begin, end) are uniformly distributed.
+template <typename Iterator>
+double ChiSquareWithExpected(Iterator begin, Iterator end, double expected) {
+  // Compute the sum and the number of buckets.
+  assert(expected >= 10);  // require at least 10 samples per bucket.
+  double chi_square = 0;
+  for (auto it = begin; it != end; it++) {
+    double d = static_cast<double>(*it) - expected;
+    chi_square += d * d;
+  }
+  chi_square = chi_square / expected;
+  return chi_square;
+}
+
+// Returns the measured chi square value, taking the actual value of each bucket
+// from the first set of iterators, and the expected value of each bucket from
+// the second set of iterators.
+template <typename Iterator, typename Expected>
+double ChiSquare(Iterator it, Iterator end, Expected eit, Expected eend) {
+  double chi_square = 0;
+  for (; it != end && eit != eend; ++it, ++eit) {
+    if (*it > 0) {
+      assert(*eit > 0);
+    }
+    double e = static_cast<double>(*eit);
+    double d = static_cast<double>(*it - *eit);
+    if (d != 0) {
+      assert(e > 0);
+      chi_square += (d * d) / e;
+    }
+  }
+  assert(it == end && eit == eend);
+  return chi_square;
+}
+
+// ======================================================================
+// The following methods can be used for an arbitrary significance level.
+//
+
+// Calculates critical chi-square values to produce the given p-value using a
+// bisection search for a value within epsilon, relying on the monotonicity of
+// ChiSquarePValue().
+double ChiSquareValue(int dof, double p);
+
+// Calculates the p-value (probability) of a given chi-square value.
+double ChiSquarePValue(double chi_square, int dof);
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_CHI_SQUARE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_caller.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_caller.h
new file mode 100644 (file)
index 0000000..0318e1f
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_
+#define ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_
+
+#include <utility>
+
+namespace absl {
+namespace random_internal {
+
+// DistributionCaller provides an opportunity to overload the general
+// mechanism for calling a distribution, allowing for mock-RNG classes
+// to intercept such calls.
+template <typename URBG>
+struct DistributionCaller {
+  // Call the provided distribution type. The parameters are expected
+  // to be explicitly specified.
+  // DistrT is the distribution type.
+  // FormatT is the formatter type:
+  //
+  // struct FormatT {
+  //   using result_type = distribution_t::result_type;
+  //   static std::string FormatCall(
+  //       const distribution_t& distr,
+  //       absl::Span<const result_type>);
+  //
+  //   static std::string FormatExpectation(
+  //       absl::string_view match_args,
+  //       absl::Span<const result_t> results);
+  // }
+  //
+  template <typename DistrT, typename FormatT, typename... Args>
+  static typename DistrT::result_type Call(URBG* urbg, Args&&... args) {
+    DistrT dist(std::forward<Args>(args)...);
+    return dist(*urbg);
+  }
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_impl.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_impl.h
new file mode 100644 (file)
index 0000000..9b6ffb0
--- /dev/null
@@ -0,0 +1,260 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_DISTRIBUTION_IMPL_H_
+#define ABSL_RANDOM_INTERNAL_DISTRIBUTION_IMPL_H_
+
+// This file contains some implementation details which are used by one or more
+// of the absl random number distributions.
+
+#include <cfloat>
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
+#include <limits>
+#include <type_traits>
+
+#if (defined(_WIN32) || defined(_WIN64)) && defined(_M_IA64)
+#include <intrin.h>  // NOLINT(build/include_order)
+#pragma intrinsic(_umul128)
+#define ABSL_INTERNAL_USE_UMUL128 1
+#endif
+
+#include "absl/base/config.h"
+#include "absl/base/internal/bits.h"
+#include "absl/numeric/int128.h"
+#include "absl/random/internal/fastmath.h"
+#include "absl/random/internal/traits.h"
+
+namespace absl {
+namespace random_internal {
+
+// Creates a double from `bits`, with the template fields controlling the
+// output.
+//
+// RandU64To is both more efficient and generates more unique values in the
+// result interval than known implementations of std::generate_canonical().
+//
+// The `Signed` parameter controls whether positive, negative, or both are
+// returned (thus affecting the output interval).
+//   When Signed == SignedValueT, range is U(-1, 1)
+//   When Signed == NegativeValueT, range is U(-1, 0)
+//   When Signed == PositiveValueT, range is U(0, 1)
+//
+// When the `IncludeZero` parameter is true, the function may return 0 for some
+// inputs, otherwise it never returns 0.
+//
+// The `ExponentBias` parameter determines the scale of the output range by
+// adjusting the exponent.
+//
+// When a value in U(0,1) is required, use:
+//   RandU64ToDouble<PositiveValueT, true, 0>();
+//
+// When a value in U(-1,1) is required, use:
+//   RandU64ToDouble<SignedValueT, false, 0>() => U(-1, 1)
+// This generates more distinct values than the mathematically equivalent
+// expression `U(0, 1) * 2.0 - 1.0`, and is preferable.
+//
+// Scaling the result by powers of 2 (and avoiding a multiply) is also possible:
+//   RandU64ToDouble<PositiveValueT, false, 1>();  => U(0, 2)
+//   RandU64ToDouble<PositiveValueT, false, -1>();  => U(0, 0.5)
+//
+
+// Tristate types controlling the output.
+struct PositiveValueT {};
+struct NegativeValueT {};
+struct SignedValueT {};
+
+// RandU64ToDouble is the double-result variant of RandU64To, described above.
+template <typename Signed, bool IncludeZero, int ExponentBias = 0>
+inline double RandU64ToDouble(uint64_t bits) {
+  static_assert(std::is_same<Signed, PositiveValueT>::value ||
+                    std::is_same<Signed, NegativeValueT>::value ||
+                    std::is_same<Signed, SignedValueT>::value,
+                "");
+
+  // Maybe use the left-most bit for a sign bit.
+  uint64_t sign = std::is_same<Signed, NegativeValueT>::value
+                      ? 0x8000000000000000ull
+                      : 0;  // Sign bits.
+
+  if (std::is_same<Signed, SignedValueT>::value) {
+    sign = bits & 0x8000000000000000ull;
+    bits = bits & 0x7FFFFFFFFFFFFFFFull;
+  }
+  if (IncludeZero) {
+    if (bits == 0u) return 0;
+  }
+
+  // Number of leading zeros is mapped to the exponent: 2^-clz
+  int clz = base_internal::CountLeadingZeros64(bits);
+  // Shift number left to erase leading zeros.
+  bits <<= IncludeZero ? clz : (clz & 63);
+
+  // Shift number right to remove bits that overflow double mantissa.  The
+  // direction of the shift depends on `clz`.
+  bits >>= (64 - DBL_MANT_DIG);
+
+  // Compute IEEE 754 double exponent.
+  // In the Signed case, bits is a 63-bit number with a 0 msb.  Adjust the
+  // exponent to account for that.
+  const uint64_t exp =
+      (std::is_same<Signed, SignedValueT>::value ? 1023U : 1022U) +
+      static_cast<uint64_t>(ExponentBias - clz);
+  constexpr int kExp = DBL_MANT_DIG - 1;
+  // Construct IEEE 754 double from exponent and mantissa.
+  const uint64_t val = sign | (exp << kExp) | (bits & ((1ULL << kExp) - 1U));
+
+  double res;
+  static_assert(sizeof(res) == sizeof(val), "double is not 64 bit");
+  // Memcpy value from "val" to "res" to avoid aliasing problems.  Assumes that
+  // endian-ness is same for double and uint64_t.
+  std::memcpy(&res, &val, sizeof(res));
+
+  return res;
+}
+
+// RandU64ToFloat is the float-result variant of RandU64To, described above.
+template <typename Signed, bool IncludeZero, int ExponentBias = 0>
+inline float RandU64ToFloat(uint64_t bits) {
+  static_assert(std::is_same<Signed, PositiveValueT>::value ||
+                    std::is_same<Signed, NegativeValueT>::value ||
+                    std::is_same<Signed, SignedValueT>::value,
+                "");
+
+  // Maybe use the left-most bit for a sign bit.
+  uint64_t sign = std::is_same<Signed, NegativeValueT>::value
+                      ? 0x80000000ul
+                      : 0;  // Sign bits.
+
+  if (std::is_same<Signed, SignedValueT>::value) {
+    uint64_t a = bits & 0x8000000000000000ull;
+    sign = static_cast<uint32_t>(a >> 32);
+    bits = bits & 0x7FFFFFFFFFFFFFFFull;
+  }
+  if (IncludeZero) {
+    if (bits == 0u) return 0;
+  }
+
+  // Number of leading zeros is mapped to the exponent: 2^-clz
+  int clz = base_internal::CountLeadingZeros64(bits);
+  // Shift number left to erase leading zeros.
+  bits <<= IncludeZero ? clz : (clz & 63);
+  // Shift number right to remove bits that overflow double mantissa.  The
+  // direction of the shift depends on `clz`.
+  bits >>= (64 - FLT_MANT_DIG);
+
+  // Construct IEEE 754 float exponent.
+  // In the Signed case, bits is a 63-bit number with a 0 msb.  Adjust the
+  // exponent to account for that.
+  const uint32_t exp =
+      (std::is_same<Signed, SignedValueT>::value ? 127U : 126U) +
+      static_cast<uint32_t>(ExponentBias - clz);
+  constexpr int kExp = FLT_MANT_DIG - 1;
+  const uint32_t val = sign | (exp << kExp) | (bits & ((1U << kExp) - 1U));
+
+  float res;
+  static_assert(sizeof(res) == sizeof(val), "float is not 32 bit");
+  // Assumes that endian-ness is same for float and uint32_t.
+  std::memcpy(&res, &val, sizeof(res));
+
+  return res;
+}
+
+template <typename Result>
+struct RandU64ToReal {
+  template <typename Signed, bool IncludeZero, int ExponentBias = 0>
+  static inline Result Value(uint64_t bits) {
+    return RandU64ToDouble<Signed, IncludeZero, ExponentBias>(bits);
+  }
+};
+
+template <>
+struct RandU64ToReal<float> {
+  template <typename Signed, bool IncludeZero, int ExponentBias = 0>
+  static inline float Value(uint64_t bits) {
+    return RandU64ToFloat<Signed, IncludeZero, ExponentBias>(bits);
+  }
+};
+
+inline uint128 MultiplyU64ToU128(uint64_t a, uint64_t b) {
+#if defined(ABSL_HAVE_INTRINSIC_INT128)
+  return uint128(static_cast<__uint128_t>(a) * b);
+#elif defined(ABSL_INTERNAL_USE_UMUL128)
+  // uint64_t * uint64_t => uint128 multiply using imul intrinsic on MSVC.
+  uint64_t high = 0;
+  const uint64_t low = _umul128(a, b, &high);
+  return absl::MakeUint128(high, low);
+#else
+  // uint128(a) * uint128(b) in emulated mode computes a full 128-bit x 128-bit
+  // multiply.  However there are many cases where that is not necessary, and it
+  // is only necessary to support a 64-bit x 64-bit = 128-bit multiply.  This is
+  // for those cases.
+  const uint64_t a00 = static_cast<uint32_t>(a);
+  const uint64_t a32 = a >> 32;
+  const uint64_t b00 = static_cast<uint32_t>(b);
+  const uint64_t b32 = b >> 32;
+
+  const uint64_t c00 = a00 * b00;
+  const uint64_t c32a = a00 * b32;
+  const uint64_t c32b = a32 * b00;
+  const uint64_t c64 = a32 * b32;
+
+  const uint32_t carry =
+      static_cast<uint32_t>(((c00 >> 32) + static_cast<uint32_t>(c32a) +
+                             static_cast<uint32_t>(c32b)) >>
+                            32);
+
+  return absl::MakeUint128(c64 + (c32a >> 32) + (c32b >> 32) + carry,
+                           c00 + (c32a << 32) + (c32b << 32));
+#endif
+}
+
+// wide_multiply<T> multiplies two N-bit values to a 2N-bit result.
+template <typename UIntType>
+struct wide_multiply {
+  static constexpr size_t kN = std::numeric_limits<UIntType>::digits;
+  using input_type = UIntType;
+  using result_type = typename random_internal::unsigned_bits<kN * 2>::type;
+
+  static result_type multiply(input_type a, input_type b) {
+    return static_cast<result_type>(a) * b;
+  }
+
+  static input_type hi(result_type r) { return r >> kN; }
+  static input_type lo(result_type r) { return r; }
+
+  static_assert(std::is_unsigned<UIntType>::value,
+                "Class-template wide_multiply<> argument must be unsigned.");
+};
+
+#ifndef ABSL_HAVE_INTRINSIC_INT128
+template <>
+struct wide_multiply<uint64_t> {
+  using input_type = uint64_t;
+  using result_type = uint128;
+
+  static result_type multiply(uint64_t a, uint64_t b) {
+    return MultiplyU64ToU128(a, b);
+  }
+
+  static uint64_t hi(result_type r) { return Uint128High64(r); }
+  static uint64_t lo(result_type r) { return Uint128Low64(r); }
+};
+#endif
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTION_IMPL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_test_util.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distribution_test_util.h
new file mode 100644 (file)
index 0000000..b5ba49f
--- /dev/null
@@ -0,0 +1,111 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_DISTRIBUTION_TEST_UTIL_H_
+#define ABSL_RANDOM_INTERNAL_DISTRIBUTION_TEST_UTIL_H_
+
+#include <cstddef>
+#include <iostream>
+#include <vector>
+
+#include "absl/strings/string_view.h"
+#include "absl/types/span.h"
+
+// NOTE: The functions in this file are test only, and are should not be used in
+// non-test code.
+
+namespace absl {
+namespace random_internal {
+
+// http://webspace.ship.edu/pgmarr/Geo441/Lectures/Lec%205%20-%20Normality%20Testing.pdf
+
+// Compute the 1st to 4th standard moments:
+// mean, variance, skewness, and kurtosis.
+// http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm
+struct DistributionMoments {
+  size_t n = 0;
+  double mean = 0.0;
+  double variance = 0.0;
+  double skewness = 0.0;
+  double kurtosis = 0.0;
+};
+DistributionMoments ComputeDistributionMoments(
+    absl::Span<const double> data_points);
+
+std::ostream& operator<<(std::ostream& os, const DistributionMoments& moments);
+
+// Computes the Z-score for a set of data with the given distribution moments
+// compared against `expected_mean`.
+double ZScore(double expected_mean, const DistributionMoments& moments);
+
+// Returns the probability of success required for a single trial to ensure that
+// after `num_trials` trials, the probability of at least one failure is no more
+// than `p_fail`.
+double RequiredSuccessProbability(double p_fail, int num_trials);
+
+// Computes the maximum distance from the mean tolerable, for Z-Tests that are
+// expected to pass with `acceptance_probability`. Will terminate if the
+// resulting tolerance is zero (due to passing in 0.0 for
+// `acceptance_probability` or rounding errors).
+//
+// For example,
+// MaxErrorTolerance(0.001) = 0.0
+// MaxErrorTolerance(0.5) = ~0.47
+// MaxErrorTolerance(1.0) = inf
+double MaxErrorTolerance(double acceptance_probability);
+
+// Approximation to inverse of the Error Function in double precision.
+// (http://people.maths.ox.ac.uk/gilesm/files/gems_erfinv.pdf)
+double erfinv(double x);
+
+// Beta(p, q) = Gamma(p) * Gamma(q) / Gamma(p+q)
+double beta(double p, double q);
+
+// The inverse of the normal survival function.
+double InverseNormalSurvival(double x);
+
+// Returns whether actual is "near" expected, based on the bound.
+bool Near(absl::string_view msg, double actual, double expected, double bound);
+
+// Implements the incomplete regularized beta function, AS63, BETAIN.
+//    https://www.jstor.org/stable/2346797
+//
+// BetaIncomplete(x, p, q), where
+//   `x` is the value of the upper limit
+//   `p` is beta parameter p, `q` is beta parameter q.
+//
+// NOTE: This is a test-only function which is only accurate to within, at most,
+// 1e-13 of the actual value.
+//
+double BetaIncomplete(double x, double p, double q);
+
+// Implements the inverse of the incomplete regularized beta function, AS109,
+// XINBTA.
+//   https://www.jstor.org/stable/2346798
+//   https://www.jstor.org/stable/2346887
+//
+// BetaIncompleteInv(p, q, beta, alhpa)
+//   `p` is beta parameter p, `q` is beta parameter q.
+//   `alpha` is the value of the lower tail area.
+//
+// NOTE: This is a test-only function and, when successful, is only accurate to
+// within ~1e-6 of the actual value; there are some cases where it diverges from
+// the actual value by much more than that.  The function uses Newton's method,
+// and thus the runtime is highly variable.
+double BetaIncompleteInv(double p, double q, double alpha);
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTION_TEST_UTIL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distributions.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/distributions.h
new file mode 100644 (file)
index 0000000..34db3b3
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_DISTRIBUTIONS_H_
+#define ABSL_RANDOM_INTERNAL_DISTRIBUTIONS_H_
+
+#include <type_traits>
+
+#include "absl/meta/type_traits.h"
+#include "absl/random/internal/distribution_caller.h"
+#include "absl/random/internal/traits.h"
+#include "absl/random/internal/uniform_helper.h"
+
+namespace absl {
+namespace random_internal {
+template <typename D>
+struct DistributionFormatTraits;
+
+// UniformImpl implements the core logic of the Uniform<T> call, which is to
+// select the correct distribution type, compute the bounds based on the
+// interval tag, and then generate a value.
+template <typename NumType, typename TagType, typename URBG>
+NumType UniformImpl(TagType tag,
+                    URBG& urbg,  // NOLINT(runtime/references)
+                    NumType lo, NumType hi) {
+  static_assert(
+      std::is_arithmetic<NumType>::value,
+      "absl::Uniform<T>() must use an integer or real parameter type.");
+
+  using distribution_t =
+      typename std::conditional<std::is_integral<NumType>::value,
+                                absl::uniform_int_distribution<NumType>,
+                                absl::uniform_real_distribution<NumType>>::type;
+  using format_t = random_internal::DistributionFormatTraits<distribution_t>;
+
+  auto a = random_internal::uniform_lower_bound<NumType>(tag, lo, hi);
+  auto b = random_internal::uniform_upper_bound<NumType>(tag, lo, hi);
+  // TODO(lar): it doesn't make a lot of sense to ask for a random number in an
+  // empty range.  Right now we just return a boundary--even though that
+  // boundary is not an acceptable value!  Is there something better we can do
+  // here?
+
+  using gen_t = absl::decay_t<URBG>;
+  if (a > b) return a;
+  return DistributionCaller<gen_t>::template Call<distribution_t, format_t>(
+      &urbg, a, b);
+}
+
+// In the absence of an explicitly provided return-type, the template
+// "uniform_inferred_return_t<A, B>" is used to derive a suitable type, based on
+// the data-types of the endpoint-arguments {A lo, B hi}.
+//
+// Given endpoints {A lo, B hi}, one of {A, B} will be chosen as the
+// return-type, if one type can be implicitly converted into the other, in a
+// lossless way. The template "is_widening_convertible" implements the
+// compile-time logic for deciding if such a conversion is possible.
+//
+// If no such conversion between {A, B} exists, then the overload for
+// absl::Uniform() will be discarded, and the call will be ill-formed.
+// Return-type for absl::Uniform() when the return-type is inferred.
+template <typename A, typename B>
+using uniform_inferred_return_t =
+    absl::enable_if_t<absl::disjunction<is_widening_convertible<A, B>,
+                                        is_widening_convertible<B, A>>::value,
+                      typename std::conditional<
+                          is_widening_convertible<A, B>::value, B, A>::type>;
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTIONS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/explicit_seed_seq.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/explicit_seed_seq.h
new file mode 100644 (file)
index 0000000..b660ece
--- /dev/null
@@ -0,0 +1,87 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_
+#define ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_
+
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <initializer_list>
+#include <iterator>
+#include <vector>
+
+namespace absl {
+namespace random_internal {
+
+// This class conforms to the C++ Standard "Seed Sequence" concept
+// [rand.req.seedseq].
+//
+// An "ExplicitSeedSeq" is meant to provide a conformant interface for
+// forwarding pre-computed seed material to the constructor of a class
+// conforming to the "Uniform Random Bit Generator" concept. This class makes no
+// attempt to mutate the state provided by its constructor, and returns it
+// directly via ExplicitSeedSeq::generate().
+//
+// If this class is asked to generate more seed material than was provided to
+// the constructor, then the remaining bytes will be filled with deterministic,
+// nonrandom data.
+class ExplicitSeedSeq {
+ public:
+  using result_type = uint32_t;
+
+  ExplicitSeedSeq() : state_() {}
+
+  // Copy and move both allowed.
+  ExplicitSeedSeq(const ExplicitSeedSeq& other) = default;
+  ExplicitSeedSeq& operator=(const ExplicitSeedSeq& other) = default;
+  ExplicitSeedSeq(ExplicitSeedSeq&& other) = default;
+  ExplicitSeedSeq& operator=(ExplicitSeedSeq&& other) = default;
+
+  template <typename Iterator>
+  ExplicitSeedSeq(Iterator begin, Iterator end) {
+    for (auto it = begin; it != end; it++) {
+      state_.push_back(*it & 0xffffffff);
+    }
+  }
+
+  template <typename T>
+  ExplicitSeedSeq(std::initializer_list<T> il)
+      : ExplicitSeedSeq(il.begin(), il.end()) {}
+
+  size_t size() const { return state_.size(); }
+
+  template <typename OutIterator>
+  void param(OutIterator out) const {
+    std::copy(std::begin(state_), std::end(state_), out);
+  }
+
+  template <typename OutIterator>
+  void generate(OutIterator begin, OutIterator end) {
+    for (size_t index = 0; begin != end; begin++) {
+      *begin = state_.empty() ? 0 : state_[index++];
+      if (index >= state_.size()) {
+        index = 0;
+      }
+    }
+  }
+
+ protected:
+  std::vector<uint32_t> state_;
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h
new file mode 100644 (file)
index 0000000..23eabbc
--- /dev/null
@@ -0,0 +1,299 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_FAST_UNIFORM_BITS_H_
+#define ABSL_RANDOM_INTERNAL_FAST_UNIFORM_BITS_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <limits>
+#include <type_traits>
+
+namespace absl {
+namespace random_internal {
+// Computes the length of the range of values producible by the URBG, or returns
+// zero if that would encompass the entire range of representable values in
+// URBG::result_type.
+template <typename URBG>
+constexpr typename URBG::result_type constexpr_range() {
+  using result_type = typename URBG::result_type;
+  return ((URBG::max)() == (std::numeric_limits<result_type>::max)() &&
+          (URBG::min)() == std::numeric_limits<result_type>::lowest())
+             ? result_type{0}
+             : (URBG::max)() - (URBG::min)() + result_type{1};
+}
+
+// FastUniformBits implements a fast path to acquire uniform independent bits
+// from a type which conforms to the [rand.req.urbg] concept.
+// Parameterized by:
+//  `UIntType`: the result (output) type
+//  `Width`: binary output width
+//
+// The std::independent_bits_engine [rand.adapt.ibits] adaptor can be
+// instantiated from an existing generator through a copy or a move. It does
+// not, however, facilitate the production of pseudorandom bits from an un-owned
+// generator that will outlive the std::independent_bits_engine instance.
+template <typename UIntType = uint64_t,
+          size_t Width = std::numeric_limits<UIntType>::digits>
+class FastUniformBits {
+  static_assert(std::is_unsigned<UIntType>::value,
+                "Class-template FastUniformBits<> must be parameterized using "
+                "an unsigned type.");
+
+  // `kWidth` is the width, in binary digits, of the output. By default it is
+  // the number of binary digits in the `result_type`.
+  static constexpr size_t kWidth = Width;
+  static_assert(kWidth > 0,
+                "Class-template FastUniformBits<> Width argument must be > 0");
+
+  static_assert(kWidth <= std::numeric_limits<UIntType>::digits,
+                "Class-template FastUniformBits<> Width argument must be <= "
+                "width of UIntType.");
+
+  static constexpr bool kIsMaxWidth =
+      (kWidth >= std::numeric_limits<UIntType>::digits);
+
+  // Computes a mask of `n` bits for the `UIntType`.
+  static constexpr UIntType constexpr_mask(size_t n) {
+    return (UIntType(1) << n) - 1;
+  }
+
+ public:
+  using result_type = UIntType;
+
+  static constexpr result_type(min)() { return 0; }
+  static constexpr result_type(max)() {
+    return kIsMaxWidth ? (std::numeric_limits<result_type>::max)()
+                       : constexpr_mask(kWidth);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g);  // NOLINT(runtime/references)
+
+ private:
+  // Variate() generates a single random variate, always returning a value
+  // in the closed interval [0 ... FastUniformBitsURBGConstants::kRangeMask]
+  // (kRangeMask+1 is a power of 2).
+  template <typename URBG>
+  typename URBG::result_type Variate(URBG& g);  // NOLINT(runtime/references)
+
+  // generate() generates a random value, dispatched on whether
+  // the underlying URNG must loop over multiple calls or not.
+  template <typename URBG>
+  result_type Generate(URBG& g,  // NOLINT(runtime/references)
+                       std::true_type /* avoid_looping */);
+
+  template <typename URBG>
+  result_type Generate(URBG& g,  // NOLINT(runtime/references)
+                       std::false_type /* avoid_looping */);
+};
+
+// FastUniformBitsURBGConstants computes the URBG-derived constants used
+// by FastUniformBits::Generate and FastUniformBits::Variate.
+// Parameterized by the FastUniformBits parameter:
+//   `URBG`: The underlying UniformRandomNumberGenerator.
+//
+// The values here indicate the URBG range as well as providing an indicator
+// whether the URBG output is a power of 2, and kRangeMask, which allows masking
+// the generated output to kRangeBits.
+template <typename URBG>
+class FastUniformBitsURBGConstants {
+  // Computes the floor of the log. (i.e., std::floor(std::log2(N));
+  static constexpr size_t constexpr_log2(size_t n) {
+    return (n <= 1) ? 0 : 1 + constexpr_log2(n / 2);
+  }
+
+  // Computes a mask of n bits for the URBG::result_type.
+  static constexpr typename URBG::result_type constexpr_mask(size_t n) {
+    return (typename URBG::result_type(1) << n) - 1;
+  }
+
+ public:
+  using result_type = typename URBG::result_type;
+
+  // The range of the URNG, max - min + 1, or zero if that result would cause
+  // overflow.
+  static constexpr result_type kRange = constexpr_range<URBG>();
+
+  static constexpr bool kPowerOfTwo =
+      (kRange == 0) || ((kRange & (kRange - 1)) == 0);
+
+  // kRangeBits describes the number number of bits suitable to mask off of URNG
+  // variate, which is:
+  // kRangeBits = floor(log2(kRange))
+  static constexpr size_t kRangeBits =
+      kRange == 0 ? std::numeric_limits<result_type>::digits
+                  : constexpr_log2(kRange);
+
+  // kRangeMask is the mask used when sampling variates from the URNG when the
+  // width of the URNG range is not a power of 2.
+  // Y = (2 ^ kRange) - 1
+  static constexpr result_type kRangeMask =
+      kRange == 0 ? (std::numeric_limits<result_type>::max)()
+                  : constexpr_mask(kRangeBits);
+
+  static_assert((URBG::max)() != (URBG::min)(),
+                "Class-template FastUniformBitsURBGConstants<> "
+                "URBG::max and URBG::min may not be equal.");
+
+  static_assert(std::is_unsigned<result_type>::value,
+                "Class-template FastUniformBitsURBGConstants<> "
+                "URBG::result_type must be unsigned.");
+
+  static_assert(kRangeMask > 0,
+                "Class-template FastUniformBitsURBGConstants<> "
+                "URBG does not generate sufficient random bits.");
+
+  static_assert(kRange == 0 ||
+                    kRangeBits < std::numeric_limits<result_type>::digits,
+                "Class-template FastUniformBitsURBGConstants<> "
+                "URBG range computation error.");
+};
+
+// FastUniformBitsLoopingConstants computes the looping constants used
+// by FastUniformBits::Generate. These constants indicate how multiple
+// URBG::result_type values are combined into an output_value.
+// Parameterized by the FastUniformBits parameters:
+//  `UIntType`: output type.
+//  `Width`: binary output width,
+//  `URNG`: The underlying UniformRandomNumberGenerator.
+//
+// The looping constants describe the sets of loop counters and mask values
+// which control how individual variates are combined the final output.  The
+// algorithm ensures that the number of bits used by any individual call differs
+// by at-most one bit from any other call. This is simplified into constants
+// which describe two loops, with the second loop parameters providing one extra
+// bit per variate.
+//
+// See [rand.adapt.ibits] for more details on the use of these constants.
+template <typename UIntType, size_t Width, typename URBG>
+class FastUniformBitsLoopingConstants {
+ private:
+  static constexpr size_t kWidth = Width;
+  using urbg_result_type = typename URBG::result_type;
+  using uint_result_type = UIntType;
+
+ public:
+  using result_type =
+      typename std::conditional<(sizeof(urbg_result_type) <=
+                                 sizeof(uint_result_type)),
+                                uint_result_type, urbg_result_type>::type;
+
+ private:
+  // Estimate N as ceil(width / urng width), and W0 as (width / N).
+  static constexpr size_t kRangeBits =
+      FastUniformBitsURBGConstants<URBG>::kRangeBits;
+
+  // The range of the URNG, max - min + 1, or zero if that result would cause
+  // overflow.
+  static constexpr result_type kRange = constexpr_range<URBG>();
+  static constexpr size_t kEstimateN =
+      kWidth / kRangeBits + (kWidth % kRangeBits != 0);
+  static constexpr size_t kEstimateW0 = kWidth / kEstimateN;
+  static constexpr result_type kEstimateY0 = (kRange >> kEstimateW0)
+                                             << kEstimateW0;
+
+ public:
+  // Parameters for the two loops:
+  // kN0, kN1 are the number of underlying calls required for each loop.
+  // KW0, kW1 are shift widths for each loop.
+  //
+  static constexpr size_t kN1 = (kRange - kEstimateY0) >
+                                        (kEstimateY0 / kEstimateN)
+                                    ? kEstimateN + 1
+                                    : kEstimateN;
+  static constexpr size_t kN0 = kN1 - (kWidth % kN1);
+  static constexpr size_t kW0 = kWidth / kN1;
+  static constexpr size_t kW1 = kW0 + 1;
+
+  static constexpr result_type kM0 = (result_type(1) << kW0) - 1;
+  static constexpr result_type kM1 = (result_type(1) << kW1) - 1;
+
+  static_assert(
+      kW0 <= kRangeBits,
+      "Class-template FastUniformBitsLoopingConstants::kW0 too large.");
+
+  static_assert(
+      kW0 > 0,
+      "Class-template FastUniformBitsLoopingConstants::kW0 too small.");
+};
+
+template <typename UIntType, size_t Width>
+template <typename URBG>
+typename FastUniformBits<UIntType, Width>::result_type
+FastUniformBits<UIntType, Width>::operator()(
+    URBG& g) {  // NOLINT(runtime/references)
+  using constants = FastUniformBitsURBGConstants<URBG>;
+  return Generate(
+      g, std::integral_constant<bool, constants::kRangeMask >= (max)()>{});
+}
+
+template <typename UIntType, size_t Width>
+template <typename URBG>
+typename URBG::result_type FastUniformBits<UIntType, Width>::Variate(
+    URBG& g) {  // NOLINT(runtime/references)
+  using constants = FastUniformBitsURBGConstants<URBG>;
+  if (constants::kPowerOfTwo) {
+    return g() - (URBG::min)();
+  }
+
+  // Use rejection sampling to ensure uniformity across the range.
+  typename URBG::result_type u;
+  do {
+    u = g() - (URBG::min)();
+  } while (u > constants::kRangeMask);
+  return u;
+}
+
+template <typename UIntType, size_t Width>
+template <typename URBG>
+typename FastUniformBits<UIntType, Width>::result_type
+FastUniformBits<UIntType, Width>::Generate(
+    URBG& g,  // NOLINT(runtime/references)
+    std::true_type /* avoid_looping */) {
+  // The width of the result_type is less than than the width of the random bits
+  // provided by URNG.  Thus, generate a single value and then simply mask off
+  // the required bits.
+  return Variate(g) & (max)();
+}
+
+template <typename UIntType, size_t Width>
+template <typename URBG>
+typename FastUniformBits<UIntType, Width>::result_type
+FastUniformBits<UIntType, Width>::Generate(
+    URBG& g,  // NOLINT(runtime/references)
+    std::false_type /* avoid_looping */) {
+  // The width of the result_type is wider than the number of random bits
+  // provided by URNG. Thus we merge several variates of URNG into the result
+  // using a shift and mask.  The constants type generates the parameters used
+  // ensure that the bits are distributed across all the invocations of the
+  // underlying URNG.
+  using constants = FastUniformBitsLoopingConstants<UIntType, Width, URBG>;
+
+  result_type s = 0;
+  for (size_t n = 0; n < constants::kN0; ++n) {
+    auto u = Variate(g);
+    s = (s << constants::kW0) + (u & constants::kM0);
+  }
+  for (size_t n = constants::kN0; n < constants::kN1; ++n) {
+    auto u = Variate(g);
+    s = (s << constants::kW1) + (u & constants::kM1);
+  }
+  return s;
+}
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_FAST_UNIFORM_BITS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/fastmath.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/fastmath.h
new file mode 100644 (file)
index 0000000..4bd1841
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_FASTMATH_H_
+#define ABSL_RANDOM_INTERNAL_FASTMATH_H_
+
+// This file contains fast math functions (bitwise ops as well as some others)
+// which are implementation details of various absl random number distributions.
+
+#include <cassert>
+#include <cmath>
+#include <cstdint>
+
+#include "absl/base/internal/bits.h"
+
+namespace absl {
+namespace random_internal {
+
+// Returns the position of the first bit set.
+inline int LeadingSetBit(uint64_t n) {
+  return 64 - base_internal::CountLeadingZeros64(n);
+}
+
+// Compute log2(n) using integer operations.
+// While std::log2 is more accurate than std::log(n) / std::log(2), for
+// very large numbers--those close to std::numeric_limits<uint64_t>::max() - 2,
+// for instance--std::log2 rounds up rather than down, which introduces
+// definite skew in the results.
+inline int IntLog2Floor(uint64_t n) {
+  return (n <= 1) ? 0 : (63 - base_internal::CountLeadingZeros64(n));
+}
+inline int IntLog2Ceil(uint64_t n) {
+  return (n <= 1) ? 0 : (64 - base_internal::CountLeadingZeros64(n - 1));
+}
+
+inline double StirlingLogFactorial(double n) {
+  assert(n >= 1);
+  // Using Stirling's approximation.
+  constexpr double kLog2PI = 1.83787706640934548356;
+  const double logn = std::log(n);
+  const double ninv = 1.0 / static_cast<double>(n);
+  return n * logn - n + 0.5 * (kLog2PI + logn) + (1.0 / 12.0) * ninv -
+         (1.0 / 360.0) * ninv * ninv * ninv;
+}
+
+// Rotate value right.
+//
+// We only implement the uint32_t / uint64_t versions because
+// 1) those are the only ones we use, and
+// 2) those are the only ones where clang detects the rotate idiom correctly.
+inline constexpr uint32_t rotr(uint32_t value, uint8_t bits) {
+  return (value >> (bits & 31)) | (value << ((-bits) & 31));
+}
+inline constexpr uint64_t rotr(uint64_t value, uint8_t bits) {
+  return (value >> (bits & 63)) | (value << ((-bits) & 63));
+}
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_FASTMATH_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h
new file mode 100644 (file)
index 0000000..df88fa7
--- /dev/null
@@ -0,0 +1,243 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_
+#define ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_
+
+#include <cmath>
+#include <iostream>
+#include <limits>
+#include <type_traits>
+
+#include "absl/meta/type_traits.h"
+#include "absl/numeric/int128.h"
+
+namespace absl {
+namespace random_internal {
+
+// The null_state_saver does nothing.
+template <typename T>
+class null_state_saver {
+ public:
+  using stream_type = T;
+  using flags_type = std::ios_base::fmtflags;
+
+  null_state_saver(T&, flags_type) {}
+  ~null_state_saver() {}
+};
+
+// ostream_state_saver is a RAII object to save and restore the common
+// basic_ostream flags used when implementing `operator <<()` on any of
+// the absl random distributions.
+template <typename OStream>
+class ostream_state_saver {
+ public:
+  using ostream_type = OStream;
+  using flags_type = std::ios_base::fmtflags;
+  using fill_type = typename ostream_type::char_type;
+  using precision_type = std::streamsize;
+
+  ostream_state_saver(ostream_type& os,  // NOLINT(runtime/references)
+                      flags_type flags, fill_type fill)
+      : os_(os),
+        flags_(os.flags(flags)),
+        fill_(os.fill(fill)),
+        precision_(os.precision()) {
+    // Save state in initialized variables.
+  }
+
+  ~ostream_state_saver() {
+    // Restore saved state.
+    os_.precision(precision_);
+    os_.fill(fill_);
+    os_.flags(flags_);
+  }
+
+ private:
+  ostream_type& os_;
+  const flags_type flags_;
+  const fill_type fill_;
+  const precision_type precision_;
+};
+
+#if defined(__NDK_MAJOR__) && __NDK_MAJOR__ < 16
+#define ABSL_RANDOM_INTERNAL_IOSTREAM_HEXFLOAT 1
+#else
+#define ABSL_RANDOM_INTERNAL_IOSTREAM_HEXFLOAT 0
+#endif
+
+template <typename CharT, typename Traits>
+ostream_state_saver<std::basic_ostream<CharT, Traits>> make_ostream_state_saver(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    std::ios_base::fmtflags flags = std::ios_base::dec | std::ios_base::left |
+#if ABSL_RANDOM_INTERNAL_IOSTREAM_HEXFLOAT
+                                    std::ios_base::fixed |
+#endif
+                                    std::ios_base::scientific) {
+  using result_type = ostream_state_saver<std::basic_ostream<CharT, Traits>>;
+  return result_type(os, flags, os.widen(' '));
+}
+
+template <typename T>
+typename absl::enable_if_t<!std::is_base_of<std::ios_base, T>::value,
+                           null_state_saver<T>>
+make_ostream_state_saver(T& is,  // NOLINT(runtime/references)
+                         std::ios_base::fmtflags flags = std::ios_base::dec) {
+  std::cerr << "null_state_saver";
+  using result_type = null_state_saver<T>;
+  return result_type(is, flags);
+}
+
+// stream_precision_helper<type>::kPrecision returns the base 10 precision
+// required to stream and reconstruct a real type exact binary value through
+// a binary->decimal->binary transition.
+template <typename T>
+struct stream_precision_helper {
+  // max_digits10 may be 0 on MSVC; if so, use digits10 + 3.
+  static constexpr int kPrecision =
+      (std::numeric_limits<T>::max_digits10 > std::numeric_limits<T>::digits10)
+          ? std::numeric_limits<T>::max_digits10
+          : (std::numeric_limits<T>::digits10 + 3);
+};
+
+template <>
+struct stream_precision_helper<float> {
+  static constexpr int kPrecision = 9;
+};
+template <>
+struct stream_precision_helper<double> {
+  static constexpr int kPrecision = 17;
+};
+template <>
+struct stream_precision_helper<long double> {
+  static constexpr int kPrecision = 36;  // assuming fp128
+};
+
+// istream_state_saver is a RAII object to save and restore the common
+// std::basic_istream<> flags used when implementing `operator >>()` on any of
+// the absl random distributions.
+template <typename IStream>
+class istream_state_saver {
+ public:
+  using istream_type = IStream;
+  using flags_type = std::ios_base::fmtflags;
+
+  istream_state_saver(istream_type& is,  // NOLINT(runtime/references)
+                      flags_type flags)
+      : is_(is), flags_(is.flags(flags)) {}
+
+  ~istream_state_saver() { is_.flags(flags_); }
+
+ private:
+  istream_type& is_;
+  flags_type flags_;
+};
+
+template <typename CharT, typename Traits>
+istream_state_saver<std::basic_istream<CharT, Traits>> make_istream_state_saver(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    std::ios_base::fmtflags flags = std::ios_base::dec |
+                                    std::ios_base::scientific |
+                                    std::ios_base::skipws) {
+  using result_type = istream_state_saver<std::basic_istream<CharT, Traits>>;
+  return result_type(is, flags);
+}
+
+template <typename T>
+typename absl::enable_if_t<!std::is_base_of<std::ios_base, T>::value,
+                           null_state_saver<T>>
+make_istream_state_saver(T& is,  // NOLINT(runtime/references)
+                         std::ios_base::fmtflags flags = std::ios_base::dec) {
+  using result_type = null_state_saver<T>;
+  return result_type(is, flags);
+}
+
+// stream_format_type<T> is a helper struct to convert types which
+// basic_iostream cannot output as decimal numbers into types which
+// basic_iostream can output as decimal numbers. Specifically:
+// * signed/unsigned char-width types are converted to int.
+// * TODO(lar): __int128 => uint128, except there is no operator << yet.
+//
+template <typename T>
+struct stream_format_type
+    : public std::conditional<(sizeof(T) == sizeof(char)), int, T> {};
+
+// stream_u128_helper allows us to write out either absl::uint128 or
+// __uint128_t types in the same way, which enables their use as internal
+// state of PRNG engines.
+template <typename T>
+struct stream_u128_helper;
+
+template <>
+struct stream_u128_helper<absl::uint128> {
+  template <typename IStream>
+  inline absl::uint128 read(IStream& in) {
+    uint64_t h = 0;
+    uint64_t l = 0;
+    in >> h >> l;
+    return absl::MakeUint128(h, l);
+  }
+
+  template <typename OStream>
+  inline void write(absl::uint128 val, OStream& out) {
+    uint64_t h = Uint128High64(val);
+    uint64_t l = Uint128Low64(val);
+    out << h << out.fill() << l;
+  }
+};
+
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+template <>
+struct stream_u128_helper<__uint128_t> {
+  template <typename IStream>
+  inline __uint128_t read(IStream& in) {
+    uint64_t h = 0;
+    uint64_t l = 0;
+    in >> h >> l;
+    return (static_cast<__uint128_t>(h) << 64) | l;
+  }
+
+  template <typename OStream>
+  inline void write(__uint128_t val, OStream& out) {
+    uint64_t h = static_cast<uint64_t>(val >> 64u);
+    uint64_t l = static_cast<uint64_t>(val);
+    out << h << out.fill() << l;
+  }
+};
+#endif
+
+template <typename FloatType, typename IStream>
+inline FloatType read_floating_point(IStream& is) {
+  static_assert(std::is_floating_point<FloatType>::value, "");
+  FloatType dest;
+  is >> dest;
+  // Parsing a double value may report a subnormal value as an error
+  // despite being able to represent it.
+  // See https://stackoverflow.com/q/52410931/3286653
+  // It may also report an underflow when parsing DOUBLE_MIN as an
+  // ERANGE error, as the parsed value may be smaller than DOUBLE_MIN
+  // and rounded up.
+  // See: https://stackoverflow.com/q/42005462
+  if (is.fail() &&
+      (std::fabs(dest) == (std::numeric_limits<FloatType>::min)() ||
+       std::fpclassify(dest) == FP_SUBNORMAL)) {
+    is.clear(is.rdstate() & (~std::ios_base::failbit));
+  }
+  return dest;
+}
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/nanobenchmark.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/nanobenchmark.h
new file mode 100644 (file)
index 0000000..c2b650d
--- /dev/null
@@ -0,0 +1,168 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_
+#define ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_
+
+// Benchmarks functions of a single integer argument with realistic branch
+// prediction hit rates. Uses a robust estimator to summarize the measurements.
+// The precision is about 0.2%.
+//
+// Examples: see nanobenchmark_test.cc.
+//
+// Background: Microbenchmarks such as http://github.com/google/benchmark
+// can measure elapsed times on the order of a microsecond. Shorter functions
+// are typically measured by repeating them thousands of times and dividing
+// the total elapsed time by this count. Unfortunately, repetition (especially
+// with the same input parameter!) influences the runtime. In time-critical
+// code, it is reasonable to expect warm instruction/data caches and TLBs,
+// but a perfect record of which branches will be taken is unrealistic.
+// Unless the application also repeatedly invokes the measured function with
+// the same parameter, the benchmark is measuring something very different -
+// a best-case result, almost as if the parameter were made a compile-time
+// constant. This may lead to erroneous conclusions about branch-heavy
+// algorithms outperforming branch-free alternatives.
+//
+// Our approach differs in three ways. Adding fences to the timer functions
+// reduces variability due to instruction reordering, improving the timer
+// resolution to about 40 CPU cycles. However, shorter functions must still
+// be invoked repeatedly. For more realistic branch prediction performance,
+// we vary the input parameter according to a user-specified distribution.
+// Thus, instead of VaryInputs(Measure(Repeat(func))), we change the
+// loop nesting to Measure(Repeat(VaryInputs(func))). We also estimate the
+// central tendency of the measurement samples with the "half sample mode",
+// which is more robust to outliers and skewed data than the mean or median.
+
+// NOTE: for compatibility with multiple translation units compiled with
+// distinct flags, avoid #including headers that define functions.
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace absl {
+namespace random_internal_nanobenchmark {
+
+// Input influencing the function being measured (e.g. number of bytes to copy).
+using FuncInput = size_t;
+
+// "Proof of work" returned by Func to ensure the compiler does not elide it.
+using FuncOutput = uint64_t;
+
+// Function to measure: either 1) a captureless lambda or function with two
+// arguments or 2) a lambda with capture, in which case the first argument
+// is reserved for use by MeasureClosure.
+using Func = FuncOutput (*)(const void*, FuncInput);
+
+// Internal parameters that determine precision/resolution/measuring time.
+struct Params {
+  // For measuring timer overhead/resolution. Used in a nested loop =>
+  // quadratic time, acceptable because we know timer overhead is "low".
+  // constexpr because this is used to define array bounds.
+  static constexpr size_t kTimerSamples = 256;
+
+  // Best-case precision, expressed as a divisor of the timer resolution.
+  // Larger => more calls to Func and higher precision.
+  size_t precision_divisor = 1024;
+
+  // Ratio between full and subset input distribution sizes. Cannot be less
+  // than 2; larger values increase measurement time but more faithfully
+  // model the given input distribution.
+  size_t subset_ratio = 2;
+
+  // Together with the estimated Func duration, determines how many times to
+  // call Func before checking the sample variability. Larger values increase
+  // measurement time, memory/cache use and precision.
+  double seconds_per_eval = 4E-3;
+
+  // The minimum number of samples before estimating the central tendency.
+  size_t min_samples_per_eval = 7;
+
+  // The mode is better than median for estimating the central tendency of
+  // skewed/fat-tailed distributions, but it requires sufficient samples
+  // relative to the width of half-ranges.
+  size_t min_mode_samples = 64;
+
+  // Maximum permissible variability (= median absolute deviation / center).
+  double target_rel_mad = 0.002;
+
+  // Abort after this many evals without reaching target_rel_mad. This
+  // prevents infinite loops.
+  size_t max_evals = 9;
+
+  // Retry the measure loop up to this many times.
+  size_t max_measure_retries = 2;
+
+  // Whether to print additional statistics to stdout.
+  bool verbose = true;
+};
+
+// Measurement result for each unique input.
+struct Result {
+  FuncInput input;
+
+  // Robust estimate (mode or median) of duration.
+  float ticks;
+
+  // Measure of variability (median absolute deviation relative to "ticks").
+  float variability;
+};
+
+// Ensures the thread is running on the specified cpu, and no others.
+// Reduces noise due to desynchronized socket RDTSC and context switches.
+// If "cpu" is negative, pin to the currently running core.
+void PinThreadToCPU(const int cpu = -1);
+
+// Returns tick rate, useful for converting measurements to seconds. Invariant
+// means the tick counter frequency is independent of CPU throttling or sleep.
+// This call may be expensive, callers should cache the result.
+double InvariantTicksPerSecond();
+
+// Precisely measures the number of ticks elapsed when calling "func" with the
+// given inputs, shuffled to ensure realistic branch prediction hit rates.
+//
+// "func" returns a 'proof of work' to ensure its computations are not elided.
+// "arg" is passed to Func, or reserved for internal use by MeasureClosure.
+// "inputs" is an array of "num_inputs" (not necessarily unique) arguments to
+//   "func". The values should be chosen to maximize coverage of "func". This
+//   represents a distribution, so a value's frequency should reflect its
+//   probability in the real application. Order does not matter; for example, a
+//   uniform distribution over [0, 4) could be represented as {3,0,2,1}.
+// Returns how many Result were written to "results": one per unique input, or
+//   zero if the measurement failed (an error message goes to stderr).
+size_t Measure(const Func func, const void* arg, const FuncInput* inputs,
+               const size_t num_inputs, Result* results,
+               const Params& p = Params());
+
+// Calls operator() of the given closure (lambda function).
+template <class Closure>
+static FuncOutput CallClosure(const void* f, const FuncInput input) {
+  return (*reinterpret_cast<const Closure*>(f))(input);
+}
+
+// Same as Measure, except "closure" is typically a lambda function of
+// FuncInput -> FuncOutput with a capture list.
+template <class Closure>
+static inline size_t MeasureClosure(const Closure& closure,
+                                    const FuncInput* inputs,
+                                    const size_t num_inputs, Result* results,
+                                    const Params& p = Params()) {
+  return Measure(reinterpret_cast<Func>(&CallClosure<Closure>),
+                 reinterpret_cast<const void*>(&closure), inputs, num_inputs,
+                 results, p);
+}
+
+}  // namespace random_internal_nanobenchmark
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h
new file mode 100644 (file)
index 0000000..8847e74
--- /dev/null
@@ -0,0 +1,148 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_
+#define ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_
+
+#include <algorithm>
+#include <cstdint>
+#include <iostream>
+#include <iterator>
+#include <random>
+#include <string>
+#include <type_traits>
+#include <vector>
+
+#include "absl/base/macros.h"
+#include "absl/meta/type_traits.h"
+#include "absl/random/internal/pool_urbg.h"
+#include "absl/random/internal/salted_seed_seq.h"
+#include "absl/random/internal/seed_material.h"
+#include "absl/types/optional.h"
+#include "absl/types/span.h"
+
+namespace absl {
+namespace random_internal {
+
+// Each instance of NonsecureURBGBase<URBG> will be seeded by variates produced
+// by a thread-unique URBG-instance.
+template <typename URBG>
+class NonsecureURBGBase {
+ public:
+  using result_type = typename URBG::result_type;
+
+  // Default constructor
+  NonsecureURBGBase() : urbg_(ConstructURBG()) {}
+
+  // Copy disallowed, move allowed.
+  NonsecureURBGBase(const NonsecureURBGBase&) = delete;
+  NonsecureURBGBase& operator=(const NonsecureURBGBase&) = delete;
+  NonsecureURBGBase(NonsecureURBGBase&&) = default;
+  NonsecureURBGBase& operator=(NonsecureURBGBase&&) = default;
+
+  // Constructor using a seed
+  template <class SSeq, typename = typename absl::enable_if_t<
+                            !std::is_same<SSeq, NonsecureURBGBase>::value>>
+  explicit NonsecureURBGBase(SSeq&& seq)
+      : urbg_(ConstructURBG(std::forward<SSeq>(seq))) {}
+
+  // Note: on MSVC, min() or max() can be interpreted as MIN() or MAX(), so we
+  // enclose min() or max() in parens as (min)() and (max)().
+  // Additionally, clang-format requires no space before this construction.
+
+  // NonsecureURBGBase::min()
+  static constexpr result_type(min)() { return (URBG::min)(); }
+
+  // NonsecureURBGBase::max()
+  static constexpr result_type(max)() { return (URBG::max)(); }
+
+  // NonsecureURBGBase::operator()()
+  result_type operator()() { return urbg_(); }
+
+  // NonsecureURBGBase::discard()
+  void discard(unsigned long long values) {  // NOLINT(runtime/int)
+    urbg_.discard(values);
+  }
+
+  bool operator==(const NonsecureURBGBase& other) const {
+    return urbg_ == other.urbg_;
+  }
+
+  bool operator!=(const NonsecureURBGBase& other) const {
+    return !(urbg_ == other.urbg_);
+  }
+
+ private:
+  // Seeder is a custom seed sequence type where generate() fills the provided
+  // buffer via the RandenPool entropy source.
+  struct Seeder {
+    using result_type = uint32_t;
+
+    size_t size() { return 0; }
+
+    template <typename OutIterator>
+    void param(OutIterator) const {}
+
+    template <typename RandomAccessIterator>
+    void generate(RandomAccessIterator begin, RandomAccessIterator end) {
+      if (begin != end) {
+        // begin, end must be random access iterators assignable from uint32_t.
+        generate_impl(
+            std::integral_constant<bool, sizeof(*begin) == sizeof(uint32_t)>{},
+            begin, end);
+      }
+    }
+
+    // Commonly, generate is invoked with a pointer to a buffer which
+    // can be cast to a uint32_t.
+    template <typename RandomAccessIterator>
+    void generate_impl(std::integral_constant<bool, true>,
+                       RandomAccessIterator begin, RandomAccessIterator end) {
+      auto buffer = absl::MakeSpan(begin, end);
+      auto target = absl::MakeSpan(reinterpret_cast<uint32_t*>(buffer.data()),
+                                   buffer.size());
+      RandenPool<uint32_t>::Fill(target);
+    }
+
+    // The non-uint32_t case should be uncommon, and involves an extra copy,
+    // filling the uint32_t buffer and then mixing into the output.
+    template <typename RandomAccessIterator>
+    void generate_impl(std::integral_constant<bool, false>,
+                       RandomAccessIterator begin, RandomAccessIterator end) {
+      const size_t n = std::distance(begin, end);
+      absl::InlinedVector<uint32_t, 8> data(n, 0);
+      RandenPool<uint32_t>::Fill(absl::MakeSpan(data.begin(), data.end()));
+      std::copy(std::begin(data), std::end(data), begin);
+    }
+  };
+
+  static URBG ConstructURBG() {
+    Seeder seeder;
+    return URBG(seeder);
+  }
+
+  template <typename SSeq>
+  static URBG ConstructURBG(SSeq&& seq) {  // NOLINT(runtime/references)
+    auto salted_seq =
+        random_internal::MakeSaltedSeedSeq(std::forward<SSeq>(seq));
+    return URBG(salted_seq);
+  }
+
+  URBG urbg_;
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/pcg_engine.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/pcg_engine.h
new file mode 100644 (file)
index 0000000..33fea0b
--- /dev/null
@@ -0,0 +1,305 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_PCG_ENGINE_H_
+#define ABSL_RANDOM_PCG_ENGINE_H_
+
+#include <type_traits>
+
+#include "absl/base/config.h"
+#include "absl/meta/type_traits.h"
+#include "absl/numeric/int128.h"
+#include "absl/random/internal/fastmath.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+namespace random_internal {
+
+// pcg_engine is a simplified implementation of Melissa O'Neil's PCG engine in
+// C++.  PCG combines a linear congruential generator (LCG) with output state
+// mixing functions to generate each random variate.  pcg_engine supports only a
+// single sequence (oneseq), and does not support streams.
+//
+// pcg_engine is parameterized by two types:
+//   Params, which provides the multiplier and increment values;
+//   Mix, which mixes the state into the result.
+//
+template <typename Params, typename Mix>
+class pcg_engine {
+  static_assert(std::is_same<typename Params::state_type,
+                             typename Mix::state_type>::value,
+                "Class-template absl::pcg_engine must be parameterized by "
+                "Params and Mix with identical state_type");
+
+  static_assert(std::is_unsigned<typename Mix::result_type>::value,
+                "Class-template absl::pcg_engine must be parameterized by "
+                "an unsigned Mix::result_type");
+
+  using params_type = Params;
+  using mix_type = Mix;
+  using state_type = typename Mix::state_type;
+
+ public:
+  // C++11 URBG interface:
+  using result_type = typename Mix::result_type;
+
+  static constexpr result_type(min)() {
+    return (std::numeric_limits<result_type>::min)();
+  }
+
+  static constexpr result_type(max)() {
+    return (std::numeric_limits<result_type>::max)();
+  }
+
+  explicit pcg_engine(uint64_t seed_value = 0) { seed(seed_value); }
+
+  template <class SeedSequence,
+            typename = typename absl::enable_if_t<
+                !std::is_same<SeedSequence, pcg_engine>::value>>
+  explicit pcg_engine(SeedSequence&& seq) {
+    seed(seq);
+  }
+
+  pcg_engine(const pcg_engine&) = default;
+  pcg_engine& operator=(const pcg_engine&) = default;
+  pcg_engine(pcg_engine&&) = default;
+  pcg_engine& operator=(pcg_engine&&) = default;
+
+  result_type operator()() {
+    // Advance the LCG state, always using the new value to generate the output.
+    state_ = lcg(state_);
+    return Mix{}(state_);
+  }
+
+  void seed(uint64_t seed_value = 0) {
+    state_type tmp = seed_value;
+    state_ = lcg(tmp + Params::increment());
+  }
+
+  template <class SeedSequence>
+  typename absl::enable_if_t<
+      !std::is_convertible<SeedSequence, uint64_t>::value, void>
+  seed(SeedSequence&& seq) {
+    reseed(seq);
+  }
+
+  void discard(uint64_t count) { state_ = advance(state_, count); }
+
+  bool operator==(const pcg_engine& other) const {
+    return state_ == other.state_;
+  }
+
+  bool operator!=(const pcg_engine& other) const { return !(*this == other); }
+
+  template <class CharT, class Traits>
+  friend typename absl::enable_if_t<(sizeof(state_type) == 16),
+                                    std::basic_ostream<CharT, Traits>&>
+  operator<<(
+      std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+      const pcg_engine& engine) {
+    auto saver = random_internal::make_ostream_state_saver(os);
+    random_internal::stream_u128_helper<state_type> helper;
+    helper.write(pcg_engine::params_type::multiplier(), os);
+    os << os.fill();
+    helper.write(pcg_engine::params_type::increment(), os);
+    os << os.fill();
+    helper.write(engine.state_, os);
+    return os;
+  }
+
+  template <class CharT, class Traits>
+  friend typename absl::enable_if_t<(sizeof(state_type) <= 8),
+                                    std::basic_ostream<CharT, Traits>&>
+  operator<<(
+      std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+      const pcg_engine& engine) {
+    auto saver = random_internal::make_ostream_state_saver(os);
+    os << pcg_engine::params_type::multiplier() << os.fill();
+    os << pcg_engine::params_type::increment() << os.fill();
+    os << engine.state_;
+    return os;
+  }
+
+  template <class CharT, class Traits>
+  friend typename absl::enable_if_t<(sizeof(state_type) == 16),
+                                    std::basic_istream<CharT, Traits>&>
+  operator>>(
+      std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+      pcg_engine& engine) {                   // NOLINT(runtime/references)
+    random_internal::stream_u128_helper<state_type> helper;
+    auto mult = helper.read(is);
+    auto inc = helper.read(is);
+    auto tmp = helper.read(is);
+    if (mult != pcg_engine::params_type::multiplier() ||
+        inc != pcg_engine::params_type::increment()) {
+      // signal failure by setting the failbit.
+      is.setstate(is.rdstate() | std::ios_base::failbit);
+    }
+    if (!is.fail()) {
+      engine.state_ = tmp;
+    }
+    return is;
+  }
+
+  template <class CharT, class Traits>
+  friend typename absl::enable_if_t<(sizeof(state_type) <= 8),
+                                    std::basic_istream<CharT, Traits>&>
+  operator>>(
+      std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+      pcg_engine& engine) {                   // NOLINT(runtime/references)
+    state_type mult{}, inc{}, tmp{};
+    is >> mult >> inc >> tmp;
+    if (mult != pcg_engine::params_type::multiplier() ||
+        inc != pcg_engine::params_type::increment()) {
+      // signal failure by setting the failbit.
+      is.setstate(is.rdstate() | std::ios_base::failbit);
+    }
+    if (!is.fail()) {
+      engine.state_ = tmp;
+    }
+    return is;
+  }
+
+ private:
+  state_type state_;
+
+  // Returns the linear-congruential generator next state.
+  static inline constexpr state_type lcg(state_type s) {
+    return s * Params::multiplier() + Params::increment();
+  }
+
+  // Returns the linear-congruential arbitrary seek state.
+  inline state_type advance(state_type s, uint64_t n) const {
+    state_type mult = Params::multiplier();
+    state_type inc = Params::increment();
+    state_type m = 1;
+    state_type i = 0;
+    while (n > 0) {
+      if (n & 1) {
+        m *= mult;
+        i = i * mult + inc;
+      }
+      inc = (mult + 1) * inc;
+      mult *= mult;
+      n >>= 1;
+    }
+    return m * s + i;
+  }
+
+  template <class SeedSequence>
+  void reseed(SeedSequence& seq) {
+    using sequence_result_type = typename SeedSequence::result_type;
+    constexpr size_t kBufferSize =
+        sizeof(state_type) / sizeof(sequence_result_type);
+    sequence_result_type buffer[kBufferSize];
+    seq.generate(std::begin(buffer), std::end(buffer));
+    // Convert the seed output to a single state value.
+    state_type tmp = buffer[0];
+    for (size_t i = 1; i < kBufferSize; i++) {
+      tmp <<= (sizeof(sequence_result_type) * 8);
+      tmp |= buffer[i];
+    }
+    state_ = lcg(tmp + params_type::increment());
+  }
+};
+
+// Parameterized implementation of the PCG 128-bit oneseq state.
+// This provides state_type, multiplier, and increment for pcg_engine.
+template <uint64_t kMultA, uint64_t kMultB, uint64_t kIncA, uint64_t kIncB>
+class pcg128_params {
+ public:
+#if ABSL_HAVE_INTRINSIC_INT128
+  using state_type = __uint128_t;
+  static inline constexpr state_type make_u128(uint64_t a, uint64_t b) {
+    return (static_cast<__uint128_t>(a) << 64) | b;
+  }
+#else
+  using state_type = absl::uint128;
+  static inline constexpr state_type make_u128(uint64_t a, uint64_t b) {
+    return absl::MakeUint128(a, b);
+  }
+#endif
+
+  static inline constexpr state_type multiplier() {
+    return make_u128(kMultA, kMultB);
+  }
+  static inline constexpr state_type increment() {
+    return make_u128(kIncA, kIncB);
+  }
+};
+
+// Implementation of the PCG xsl_rr_128_64 128-bit mixing function, which
+// accepts an input of state_type and mixes it into an output of result_type.
+struct pcg_xsl_rr_128_64 {
+#if ABSL_HAVE_INTRINSIC_INT128
+  using state_type = __uint128_t;
+#else
+  using state_type = absl::uint128;
+#endif
+  using result_type = uint64_t;
+
+  inline uint64_t operator()(state_type state) {
+    // This is equivalent to the xsl_rr_128_64 mixing function.
+#if ABSL_HAVE_INTRINSIC_INT128
+    uint64_t rotate = static_cast<uint64_t>(state >> 122u);
+    state ^= state >> 64;
+    uint64_t s = static_cast<uint64_t>(state);
+#else
+    uint64_t h = Uint128High64(state);
+    uint64_t rotate = h >> 58u;
+    uint64_t s = Uint128Low64(state) ^ h;
+#endif
+    return random_internal::rotr(s, rotate);
+  }
+};
+
+// Parameterized implementation of the PCG 64-bit oneseq state.
+// This provides state_type, multiplier, and increment for pcg_engine.
+template <uint64_t kMult, uint64_t kInc>
+class pcg64_params {
+ public:
+  using state_type = uint64_t;
+  static inline constexpr state_type multiplier() { return kMult; }
+  static inline constexpr state_type increment() { return kInc; }
+};
+
+// Implementation of the PCG xsh_rr_64_32 64-bit mixing function, which accepts
+// an input of state_type and mixes it into an output of result_type.
+struct pcg_xsh_rr_64_32 {
+  using state_type = uint64_t;
+  using result_type = uint32_t;
+  inline uint32_t operator()(uint64_t state) {
+    return random_internal::rotr(
+        static_cast<uint32_t>(((state >> 18) ^ state) >> 27), state >> 59);
+  }
+};
+
+// Stable pcg_engine implementations:
+// This is a 64-bit generator using 128-bits of state.
+// The output sequence is equivalent to Melissa O'Neil's pcg64_oneseq.
+using pcg64_2018_engine = pcg_engine<
+    random_internal::pcg128_params<0x2360ed051fc65da4ull, 0x4385df649fccf645ull,
+                                   0x5851f42d4c957f2d, 0x14057b7ef767814f>,
+    random_internal::pcg_xsl_rr_128_64>;
+
+// This is a 32-bit generator using 64-bits of state.
+// This is equivalent to Melissa O'Neil's pcg32_oneseq.
+using pcg32_2018_engine = pcg_engine<
+    random_internal::pcg64_params<0x5851f42d4c957f2dull, 0x14057b7ef767814full>,
+    random_internal::pcg_xsh_rr_64_32>;
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_PCG2018_ENGINE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/platform.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/platform.h
new file mode 100644 (file)
index 0000000..d1ef5c2
--- /dev/null
@@ -0,0 +1,170 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_PLATFORM_H_
+#define ABSL_RANDOM_INTERNAL_PLATFORM_H_
+
+// HERMETIC NOTE: The randen_hwaes target must not introduce duplicate
+// symbols from arbitrary system and other headers, since it may be built
+// with different flags from other targets, using different levels of
+// optimization, potentially introducing ODR violations.
+
+// -----------------------------------------------------------------------------
+// Platform Feature Checks
+// -----------------------------------------------------------------------------
+
+// Currently supported operating systems and associated preprocessor
+// symbols:
+//
+//   Linux and Linux-derived           __linux__
+//   Android                           __ANDROID__ (implies __linux__)
+//   Linux (non-Android)               __linux__ && !__ANDROID__
+//   Darwin (Mac OS X and iOS)         __APPLE__
+//   Akaros (http://akaros.org)        __ros__
+//   Windows                           _WIN32
+//   NaCL                              __native_client__
+//   AsmJS                             __asmjs__
+//   WebAssembly                       __wasm__
+//   Fuchsia                           __Fuchsia__
+//
+// Note that since Android defines both __ANDROID__ and __linux__, one
+// may probe for either Linux or Android by simply testing for __linux__.
+//
+// NOTE: For __APPLE__ platforms, we use #include <TargetConditionals.h>
+// to distinguish os variants.
+//
+// http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
+
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#endif
+
+// -----------------------------------------------------------------------------
+// Architecture Checks
+// -----------------------------------------------------------------------------
+
+// These preprocessor directives are trying to determine CPU architecture,
+// including necessary headers to support hardware AES.
+//
+// ABSL_ARCH_{X86/PPC/ARM} macros determine the platform.
+#if defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64) || \
+    defined(_M_X64)
+#define ABSL_ARCH_X86_64
+#elif defined(__i386) || defined(_M_IX86)
+#define ABSL_ARCH_X86_32
+#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
+#define ABSL_ARCH_AARCH64
+#elif defined(__arm__) || defined(__ARMEL__) || defined(_M_ARM)
+#define ABSL_ARCH_ARM
+#elif defined(__powerpc64__) || defined(__PPC64__) || defined(__powerpc__) || \
+    defined(__ppc__) || defined(__PPC__)
+#define ABSL_ARCH_PPC
+#else
+// Unsupported architecture.
+//  * https://sourceforge.net/p/predef/wiki/Architectures/
+//  * https://msdn.microsoft.com/en-us/library/b0084kay.aspx
+//  * for gcc, clang: "echo | gcc -E -dM -"
+#endif
+
+// -----------------------------------------------------------------------------
+// Attribute Checks
+// -----------------------------------------------------------------------------
+
+// ABSL_RANDOM_INTERNAL_RESTRICT annotates whether pointers may be considered
+// to be unaliased.
+#if defined(__clang__) || defined(__GNUC__)
+#define ABSL_RANDOM_INTERNAL_RESTRICT __restrict__
+#elif defined(_MSC_VER)
+#define ABSL_RANDOM_INTERNAL_RESTRICT __restrict
+#else
+#define ABSL_RANDOM_INTERNAL_RESTRICT
+#endif
+
+// ABSL_HAVE_ACCELERATED_AES indicates whether the currently active compiler
+// flags (e.g. -maes) allow using hardware accelerated AES instructions, which
+// implies us assuming that the target platform supports them.
+#define ABSL_HAVE_ACCELERATED_AES 0
+
+#if defined(ABSL_ARCH_X86_64)
+
+#if defined(__AES__) || defined(__AVX__)
+#undef ABSL_HAVE_ACCELERATED_AES
+#define ABSL_HAVE_ACCELERATED_AES 1
+#endif
+
+#elif defined(ABSL_ARCH_PPC)
+
+// Rely on VSX and CRYPTO extensions for vcipher on PowerPC.
+#if (defined(__VEC__) || defined(__ALTIVEC__)) && defined(__VSX__) && \
+    defined(__CRYPTO__)
+#undef ABSL_HAVE_ACCELERATED_AES
+#define ABSL_HAVE_ACCELERATED_AES 1
+#endif
+
+#elif defined(ABSL_ARCH_ARM) || defined(ABSL_ARCH_AARCH64)
+
+// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0.pdf
+// Rely on NEON+CRYPTO extensions for ARM.
+#if defined(__ARM_NEON) && defined(__ARM_FEATURE_CRYPTO)
+#undef ABSL_HAVE_ACCELERATED_AES
+#define ABSL_HAVE_ACCELERATED_AES 1
+#endif
+
+#endif
+
+// NaCl does not allow AES.
+#if defined(__native_client__)
+#undef ABSL_HAVE_ACCELERATED_AES
+#define ABSL_HAVE_ACCELERATED_AES 0
+#endif
+
+// ABSL_RANDOM_INTERNAL_AES_DISPATCH indicates whether the currently active
+// platform has, or should use run-time dispatch for selecting the
+// acclerated Randen implementation.
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 0
+
+#if defined(ABSL_ARCH_X86_64)
+// Dispatch is available on x86_64
+#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 1
+#elif defined(__linux__) && defined(ABSL_ARCH_PPC)
+// Or when running linux PPC
+#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 1
+#elif defined(__linux__) && defined(ABSL_ARCH_AARCH64)
+// Or when running linux AArch64
+#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 1
+#elif defined(__linux__) && defined(ABSL_ARCH_ARM) && (__ARM_ARCH >= 8)
+// Or when running linux ARM v8 or higher.
+// (This captures a lot of Android configurations.)
+#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 1
+#endif
+
+// NaCl does not allow dispatch.
+#if defined(__native_client__)
+#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 0
+#endif
+
+// iOS does not support dispatch, even on x86, since applications
+// should be bundled as fat binaries, with a different build tailored for
+// each specific supported platform/architecture.
+#if defined(__APPLE__) && (TARGET_OS_IPHONE || TARGET_OS_IPHONE_SIMULATOR)
+#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
+#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 0
+#endif
+
+#endif  // ABSL_RANDOM_INTERNAL_PLATFORM_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/pool_urbg.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/pool_urbg.h
new file mode 100644 (file)
index 0000000..9b2dd4b
--- /dev/null
@@ -0,0 +1,129 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_POOL_URBG_H_
+#define ABSL_RANDOM_INTERNAL_POOL_URBG_H_
+
+#include <cinttypes>
+#include <limits>
+
+#include "absl/random/internal/traits.h"
+#include "absl/types/span.h"
+
+namespace absl {
+namespace random_internal {
+
+// RandenPool is a thread-safe random number generator [random.req.urbg] that
+// uses an underlying pool of Randen generators to generate values.  Each thread
+// has affinity to one instance of the underlying pool generators.  Concurrent
+// access is guarded by a spin-lock.
+template <typename T>
+class RandenPool {
+ public:
+  using result_type = T;
+  static_assert(std::is_unsigned<result_type>::value,
+                "RandenPool template argument must be a built-in unsigned "
+                "integer type");
+
+  static constexpr result_type(min)() {
+    return (std::numeric_limits<result_type>::min)();
+  }
+
+  static constexpr result_type(max)() {
+    return (std::numeric_limits<result_type>::max)();
+  }
+
+  RandenPool() {}
+
+  // Returns a single value.
+  inline result_type operator()() { return Generate(); }
+
+  // Fill data with random values.
+  static void Fill(absl::Span<result_type> data);
+
+ protected:
+  // Generate returns a single value.
+  static result_type Generate();
+};
+
+extern template class RandenPool<uint8_t>;
+extern template class RandenPool<uint16_t>;
+extern template class RandenPool<uint32_t>;
+extern template class RandenPool<uint64_t>;
+
+// PoolURBG uses an underlying pool of random generators to implement a
+// thread-compatible [random.req.urbg] interface with an internal cache of
+// values.
+template <typename T, size_t kBufferSize>
+class PoolURBG {
+  // Inheritance to access the protected static members of RandenPool.
+  using unsigned_type = typename make_unsigned_bits<T>::type;
+  using PoolType = RandenPool<unsigned_type>;
+  using SpanType = absl::Span<unsigned_type>;
+
+  static constexpr size_t kInitialBuffer = kBufferSize + 1;
+  static constexpr size_t kHalfBuffer = kBufferSize / 2;
+
+ public:
+  using result_type = T;
+
+  static_assert(std::is_unsigned<result_type>::value,
+                "PoolURBG must be parameterized by an unsigned integer type");
+
+  static_assert(kBufferSize > 1,
+                "PoolURBG must be parameterized by a buffer-size > 1");
+
+  static_assert(kBufferSize <= 256,
+                "PoolURBG must be parameterized by a buffer-size <= 256");
+
+  static constexpr result_type(min)() {
+    return (std::numeric_limits<result_type>::min)();
+  }
+
+  static constexpr result_type(max)() {
+    return (std::numeric_limits<result_type>::max)();
+  }
+
+  PoolURBG() : next_(kInitialBuffer) {}
+
+  // copy-constructor does not copy cache.
+  PoolURBG(const PoolURBG&) : next_(kInitialBuffer) {}
+  const PoolURBG& operator=(const PoolURBG&) {
+    next_ = kInitialBuffer;
+    return *this;
+  }
+
+  // move-constructor does move cache.
+  PoolURBG(PoolURBG&&) = default;
+  PoolURBG& operator=(PoolURBG&&) = default;
+
+  inline result_type operator()() {
+    if (next_ >= kBufferSize) {
+      next_ = (kBufferSize > 2 && next_ > kBufferSize) ? kHalfBuffer : 0;
+      PoolType::Fill(SpanType(reinterpret_cast<unsigned_type*>(state_ + next_),
+                              kBufferSize - next_));
+    }
+    return state_[next_++];
+  }
+
+ private:
+  // Buffer size.
+  size_t next_;  // index within state_
+  result_type state_[kBufferSize];
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_POOL_URBG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen-keys.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen-keys.inc
new file mode 100644 (file)
index 0000000..fa4b166
--- /dev/null
@@ -0,0 +1,207 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_KEYS_INC_
+#define ABSL_RANDOM_INTERNAL_RANDEN_KEYS_INC_
+
+// Textual header to include the randen_keys where necessary.
+// REQUIRES: struct u64x2{}
+//
+// PROVIDES: kKeys
+// PROVIDES: round_keys[]
+
+// "Nothing up my sleeve" numbers from the first hex digits of Pi, obtained
+// from http://hexpi.sourceforge.net/. The array was generated by following
+// Python script:
+/*
+python << EOF
+"""Generates Randen round keys array from pi-hex.62500.txt file."""
+import binascii
+
+KEYS = 136
+
+def chunks(l, n):
+    """Yield successive n-sized chunks from l."""
+    for i in range(0, len(l), n):
+        yield l[i:i + n]
+
+def pairwise(t):
+    """Transforms sequence into sequence of pairs."""
+    it = iter(t)
+    return zip(it,it)
+
+def digits_from_pi():
+  """Reads digits from hexpi.sourceforge.net file."""
+  with open("pi-hex.62500.txt") as file:
+    return file.read()
+
+def digits_from_urandom():
+  """Reads digits from /dev/urandom."""
+  with open("/dev/urandom") as file:
+    return binascii.hexlify(file.read(KEYS * 16))
+
+digits = digits_from_pi()
+print("static constexpr const size_t kRoundKeys = {0};\n".format(KEYS))
+print("alignas(16) constexpr const u64x2 round_keys[kRoundKeys] = {")
+
+for i, (hi, lo) in zip(range(KEYS), pairwise(chunks(digits, 16))):
+  hi = "0x{0}ull".format(hi)
+  lo = "0x{0}ull".format(lo)
+  print("  u64x2({0}, {1}){2}".format(hi, lo, ',' if i+1 < KEYS else ''))
+
+print("};")
+EOF
+*/
+
+static constexpr const size_t kRoundKeys = 136;
+
+alignas(16) constexpr u64x2 round_keys[kRoundKeys] = {
+    u64x2(0x243F6A8885A308D3ull, 0x13198A2E03707344ull),
+    u64x2(0xA4093822299F31D0ull, 0x082EFA98EC4E6C89ull),
+    u64x2(0x452821E638D01377ull, 0xBE5466CF34E90C6Cull),
+    u64x2(0xC0AC29B7C97C50DDull, 0x3F84D5B5B5470917ull),
+    u64x2(0x9216D5D98979FB1Bull, 0xD1310BA698DFB5ACull),
+    u64x2(0x2FFD72DBD01ADFB7ull, 0xB8E1AFED6A267E96ull),
+    u64x2(0xBA7C9045F12C7F99ull, 0x24A19947B3916CF7ull),
+    u64x2(0x0801F2E2858EFC16ull, 0x636920D871574E69ull),
+    u64x2(0xA458FEA3F4933D7Eull, 0x0D95748F728EB658ull),
+    u64x2(0x718BCD5882154AEEull, 0x7B54A41DC25A59B5ull),
+    u64x2(0x9C30D5392AF26013ull, 0xC5D1B023286085F0ull),
+    u64x2(0xCA417918B8DB38EFull, 0x8E79DCB0603A180Eull),
+    u64x2(0x6C9E0E8BB01E8A3Eull, 0xD71577C1BD314B27ull),
+    u64x2(0x78AF2FDA55605C60ull, 0xE65525F3AA55AB94ull),
+    u64x2(0x5748986263E81440ull, 0x55CA396A2AAB10B6ull),
+    u64x2(0xB4CC5C341141E8CEull, 0xA15486AF7C72E993ull),
+    u64x2(0xB3EE1411636FBC2Aull, 0x2BA9C55D741831F6ull),
+    u64x2(0xCE5C3E169B87931Eull, 0xAFD6BA336C24CF5Cull),
+    u64x2(0x7A32538128958677ull, 0x3B8F48986B4BB9AFull),
+    u64x2(0xC4BFE81B66282193ull, 0x61D809CCFB21A991ull),
+    u64x2(0x487CAC605DEC8032ull, 0xEF845D5DE98575B1ull),
+    u64x2(0xDC262302EB651B88ull, 0x23893E81D396ACC5ull),
+    u64x2(0x0F6D6FF383F44239ull, 0x2E0B4482A4842004ull),
+    u64x2(0x69C8F04A9E1F9B5Eull, 0x21C66842F6E96C9Aull),
+    u64x2(0x670C9C61ABD388F0ull, 0x6A51A0D2D8542F68ull),
+    u64x2(0x960FA728AB5133A3ull, 0x6EEF0B6C137A3BE4ull),
+    u64x2(0xBA3BF0507EFB2A98ull, 0xA1F1651D39AF0176ull),
+    u64x2(0x66CA593E82430E88ull, 0x8CEE8619456F9FB4ull),
+    u64x2(0x7D84A5C33B8B5EBEull, 0xE06F75D885C12073ull),
+    u64x2(0x401A449F56C16AA6ull, 0x4ED3AA62363F7706ull),
+    u64x2(0x1BFEDF72429B023Dull, 0x37D0D724D00A1248ull),
+    u64x2(0xDB0FEAD349F1C09Bull, 0x075372C980991B7Bull),
+    u64x2(0x25D479D8F6E8DEF7ull, 0xE3FE501AB6794C3Bull),
+    u64x2(0x976CE0BD04C006BAull, 0xC1A94FB6409F60C4ull),
+    u64x2(0x5E5C9EC2196A2463ull, 0x68FB6FAF3E6C53B5ull),
+    u64x2(0x1339B2EB3B52EC6Full, 0x6DFC511F9B30952Cull),
+    u64x2(0xCC814544AF5EBD09ull, 0xBEE3D004DE334AFDull),
+    u64x2(0x660F2807192E4BB3ull, 0xC0CBA85745C8740Full),
+    u64x2(0xD20B5F39B9D3FBDBull, 0x5579C0BD1A60320Aull),
+    u64x2(0xD6A100C6402C7279ull, 0x679F25FEFB1FA3CCull),
+    u64x2(0x8EA5E9F8DB3222F8ull, 0x3C7516DFFD616B15ull),
+    u64x2(0x2F501EC8AD0552ABull, 0x323DB5FAFD238760ull),
+    u64x2(0x53317B483E00DF82ull, 0x9E5C57BBCA6F8CA0ull),
+    u64x2(0x1A87562EDF1769DBull, 0xD542A8F6287EFFC3ull),
+    u64x2(0xAC6732C68C4F5573ull, 0x695B27B0BBCA58C8ull),
+    u64x2(0xE1FFA35DB8F011A0ull, 0x10FA3D98FD2183B8ull),
+    u64x2(0x4AFCB56C2DD1D35Bull, 0x9A53E479B6F84565ull),
+    u64x2(0xD28E49BC4BFB9790ull, 0xE1DDF2DAA4CB7E33ull),
+    u64x2(0x62FB1341CEE4C6E8ull, 0xEF20CADA36774C01ull),
+    u64x2(0xD07E9EFE2BF11FB4ull, 0x95DBDA4DAE909198ull),
+    u64x2(0xEAAD8E716B93D5A0ull, 0xD08ED1D0AFC725E0ull),
+    u64x2(0x8E3C5B2F8E7594B7ull, 0x8FF6E2FBF2122B64ull),
+    u64x2(0x8888B812900DF01Cull, 0x4FAD5EA0688FC31Cull),
+    u64x2(0xD1CFF191B3A8C1ADull, 0x2F2F2218BE0E1777ull),
+    u64x2(0xEA752DFE8B021FA1ull, 0xE5A0CC0FB56F74E8ull),
+    u64x2(0x18ACF3D6CE89E299ull, 0xB4A84FE0FD13E0B7ull),
+    u64x2(0x7CC43B81D2ADA8D9ull, 0x165FA26680957705ull),
+    u64x2(0x93CC7314211A1477ull, 0xE6AD206577B5FA86ull),
+    u64x2(0xC75442F5FB9D35CFull, 0xEBCDAF0C7B3E89A0ull),
+    u64x2(0xD6411BD3AE1E7E49ull, 0x00250E2D2071B35Eull),
+    u64x2(0x226800BB57B8E0AFull, 0x2464369BF009B91Eull),
+    u64x2(0x5563911D59DFA6AAull, 0x78C14389D95A537Full),
+    u64x2(0x207D5BA202E5B9C5ull, 0x832603766295CFA9ull),
+    u64x2(0x11C819684E734A41ull, 0xB3472DCA7B14A94Aull),
+    u64x2(0x1B5100529A532915ull, 0xD60F573FBC9BC6E4ull),
+    u64x2(0x2B60A47681E67400ull, 0x08BA6FB5571BE91Full),
+    u64x2(0xF296EC6B2A0DD915ull, 0xB6636521E7B9F9B6ull),
+    u64x2(0xFF34052EC5855664ull, 0x53B02D5DA99F8FA1ull),
+    u64x2(0x08BA47996E85076Aull, 0x4B7A70E9B5B32944ull),
+    u64x2(0xDB75092EC4192623ull, 0xAD6EA6B049A7DF7Dull),
+    u64x2(0x9CEE60B88FEDB266ull, 0xECAA8C71699A18FFull),
+    u64x2(0x5664526CC2B19EE1ull, 0x193602A575094C29ull),
+    u64x2(0xA0591340E4183A3Eull, 0x3F54989A5B429D65ull),
+    u64x2(0x6B8FE4D699F73FD6ull, 0xA1D29C07EFE830F5ull),
+    u64x2(0x4D2D38E6F0255DC1ull, 0x4CDD20868470EB26ull),
+    u64x2(0x6382E9C6021ECC5Eull, 0x09686B3F3EBAEFC9ull),
+    u64x2(0x3C9718146B6A70A1ull, 0x687F358452A0E286ull),
+    u64x2(0xB79C5305AA500737ull, 0x3E07841C7FDEAE5Cull),
+    u64x2(0x8E7D44EC5716F2B8ull, 0xB03ADA37F0500C0Dull),
+    u64x2(0xF01C1F040200B3FFull, 0xAE0CF51A3CB574B2ull),
+    u64x2(0x25837A58DC0921BDull, 0xD19113F97CA92FF6ull),
+    u64x2(0x9432477322F54701ull, 0x3AE5E58137C2DADCull),
+    u64x2(0xC8B576349AF3DDA7ull, 0xA94461460FD0030Eull),
+    u64x2(0xECC8C73EA4751E41ull, 0xE238CD993BEA0E2Full),
+    u64x2(0x3280BBA1183EB331ull, 0x4E548B384F6DB908ull),
+    u64x2(0x6F420D03F60A04BFull, 0x2CB8129024977C79ull),
+    u64x2(0x5679B072BCAF89AFull, 0xDE9A771FD9930810ull),
+    u64x2(0xB38BAE12DCCF3F2Eull, 0x5512721F2E6B7124ull),
+    u64x2(0x501ADDE69F84CD87ull, 0x7A5847187408DA17ull),
+    u64x2(0xBC9F9ABCE94B7D8Cull, 0xEC7AEC3ADB851DFAull),
+    u64x2(0x63094366C464C3D2ull, 0xEF1C18473215D808ull),
+    u64x2(0xDD433B3724C2BA16ull, 0x12A14D432A65C451ull),
+    u64x2(0x50940002133AE4DDull, 0x71DFF89E10314E55ull),
+    u64x2(0x81AC77D65F11199Bull, 0x043556F1D7A3C76Bull),
+    u64x2(0x3C11183B5924A509ull, 0xF28FE6ED97F1FBFAull),
+    u64x2(0x9EBABF2C1E153C6Eull, 0x86E34570EAE96FB1ull),
+    u64x2(0x860E5E0A5A3E2AB3ull, 0x771FE71C4E3D06FAull),
+    u64x2(0x2965DCB999E71D0Full, 0x803E89D65266C825ull),
+    u64x2(0x2E4CC9789C10B36Aull, 0xC6150EBA94E2EA78ull),
+    u64x2(0xA6FC3C531E0A2DF4ull, 0xF2F74EA7361D2B3Dull),
+    u64x2(0x1939260F19C27960ull, 0x5223A708F71312B6ull),
+    u64x2(0xEBADFE6EEAC31F66ull, 0xE3BC4595A67BC883ull),
+    u64x2(0xB17F37D1018CFF28ull, 0xC332DDEFBE6C5AA5ull),
+    u64x2(0x6558218568AB9702ull, 0xEECEA50FDB2F953Bull),
+    u64x2(0x2AEF7DAD5B6E2F84ull, 0x1521B62829076170ull),
+    u64x2(0xECDD4775619F1510ull, 0x13CCA830EB61BD96ull),
+    u64x2(0x0334FE1EAA0363CFull, 0xB5735C904C70A239ull),
+    u64x2(0xD59E9E0BCBAADE14ull, 0xEECC86BC60622CA7ull),
+    u64x2(0x9CAB5CABB2F3846Eull, 0x648B1EAF19BDF0CAull),
+    u64x2(0xA02369B9655ABB50ull, 0x40685A323C2AB4B3ull),
+    u64x2(0x319EE9D5C021B8F7ull, 0x9B540B19875FA099ull),
+    u64x2(0x95F7997E623D7DA8ull, 0xF837889A97E32D77ull),
+    u64x2(0x11ED935F16681281ull, 0x0E358829C7E61FD6ull),
+    u64x2(0x96DEDFA17858BA99ull, 0x57F584A51B227263ull),
+    u64x2(0x9B83C3FF1AC24696ull, 0xCDB30AEB532E3054ull),
+    u64x2(0x8FD948E46DBC3128ull, 0x58EBF2EF34C6FFEAull),
+    u64x2(0xFE28ED61EE7C3C73ull, 0x5D4A14D9E864B7E3ull),
+    u64x2(0x42105D14203E13E0ull, 0x45EEE2B6A3AAABEAull),
+    u64x2(0xDB6C4F15FACB4FD0ull, 0xC742F442EF6ABBB5ull),
+    u64x2(0x654F3B1D41CD2105ull, 0xD81E799E86854DC7ull),
+    u64x2(0xE44B476A3D816250ull, 0xCF62A1F25B8D2646ull),
+    u64x2(0xFC8883A0C1C7B6A3ull, 0x7F1524C369CB7492ull),
+    u64x2(0x47848A0B5692B285ull, 0x095BBF00AD19489Dull),
+    u64x2(0x1462B17423820D00ull, 0x58428D2A0C55F5EAull),
+    u64x2(0x1DADF43E233F7061ull, 0x3372F0928D937E41ull),
+    u64x2(0xD65FECF16C223BDBull, 0x7CDE3759CBEE7460ull),
+    u64x2(0x4085F2A7CE77326Eull, 0xA607808419F8509Eull),
+    u64x2(0xE8EFD85561D99735ull, 0xA969A7AAC50C06C2ull),
+    u64x2(0x5A04ABFC800BCADCull, 0x9E447A2EC3453484ull),
+    u64x2(0xFDD567050E1E9EC9ull, 0xDB73DBD3105588CDull),
+    u64x2(0x675FDA79E3674340ull, 0xC5C43465713E38D8ull),
+    u64x2(0x3D28F89EF16DFF20ull, 0x153E21E78FB03D4Aull),
+    u64x2(0xE6E39F2BDB83ADF7ull, 0xE93D5A68948140F7ull),
+    u64x2(0xF64C261C94692934ull, 0x411520F77602D4F7ull),
+    u64x2(0xBCF46B2ED4A10068ull, 0xD40824713320F46Aull),
+    u64x2(0x43B7D4B7500061AFull, 0x1E39F62E97244546ull)};
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_KEYS_INC_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen.h
new file mode 100644 (file)
index 0000000..a4ff254
--- /dev/null
@@ -0,0 +1,100 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_H_
+#define ABSL_RANDOM_INTERNAL_RANDEN_H_
+
+#include <cstddef>
+
+#include "absl/random/internal/platform.h"
+#include "absl/random/internal/randen_hwaes.h"
+#include "absl/random/internal/randen_slow.h"
+#include "absl/random/internal/randen_traits.h"
+
+namespace absl {
+namespace random_internal {
+
+// RANDen = RANDom generator or beetroots in Swiss German.
+// 'Strong' (well-distributed, unpredictable, backtracking-resistant) random
+// generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32.
+//
+// Randen implements the basic state manipulation methods.
+class Randen {
+ public:
+  static constexpr size_t kStateBytes = RandenTraits::kStateBytes;
+  static constexpr size_t kCapacityBytes = RandenTraits::kCapacityBytes;
+  static constexpr size_t kSeedBytes = RandenTraits::kSeedBytes;
+
+  ~Randen() = default;
+
+  Randen();
+
+  // Generate updates the randen sponge. The outer portion of the sponge
+  // (kCapacityBytes .. kStateBytes) may be consumed as PRNG state.
+  template <typename T, size_t N>
+  void Generate(T (&state)[N]) const {
+    static_assert(N * sizeof(T) == kStateBytes,
+                  "Randen::Generate() requires kStateBytes of state");
+#if ABSL_RANDOM_INTERNAL_AES_DISPATCH
+    // HW AES Dispatch.
+    if (has_crypto_) {
+      RandenHwAes::Generate(keys_, state);
+    } else {
+      RandenSlow::Generate(keys_, state);
+    }
+#elif ABSL_HAVE_ACCELERATED_AES
+    // HW AES is enabled.
+    RandenHwAes::Generate(keys_, state);
+#else
+    // HW AES is disabled.
+    RandenSlow::Generate(keys_, state);
+#endif
+  }
+
+  // Absorb incorporates additional seed material into the randen sponge.  After
+  // absorb returns, Generate must be called before the state may be consumed.
+  template <typename S, size_t M, typename T, size_t N>
+  void Absorb(const S (&seed)[M], T (&state)[N]) const {
+    static_assert(M * sizeof(S) == RandenTraits::kSeedBytes,
+                  "Randen::Absorb() requires kSeedBytes of seed");
+
+    static_assert(N * sizeof(T) == RandenTraits::kStateBytes,
+                  "Randen::Absorb() requires kStateBytes of state");
+#if ABSL_RANDOM_INTERNAL_AES_DISPATCH
+    // HW AES Dispatch.
+    if (has_crypto_) {
+      RandenHwAes::Absorb(seed, state);
+    } else {
+      RandenSlow::Absorb(seed, state);
+    }
+#elif ABSL_HAVE_ACCELERATED_AES
+    // HW AES is enabled.
+    RandenHwAes::Absorb(seed, state);
+#else
+    // HW AES is disabled.
+    RandenSlow::Absorb(seed, state);
+#endif
+  }
+
+ private:
+  const void* keys_;
+#if ABSL_RANDOM_INTERNAL_AES_DISPATCH
+  bool has_crypto_;
+#endif
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_detect.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_detect.h
new file mode 100644 (file)
index 0000000..ab45f34
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
+#define ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
+
+namespace absl {
+namespace random_internal {
+
+// Returns whether the current CPU supports RandenHwAes implementation.
+// This typically involves supporting cryptographic extensions on whichever
+// platform is currently running.
+bool CPUSupportsRandenHwAes();
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_FAST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_engine.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_engine.h
new file mode 100644 (file)
index 0000000..02212a1
--- /dev/null
@@ -0,0 +1,228 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_
+#define ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_
+
+#include <algorithm>
+#include <cinttypes>
+#include <cstdlib>
+#include <iostream>
+#include <iterator>
+#include <limits>
+#include <type_traits>
+
+#include "absl/meta/type_traits.h"
+#include "absl/random/internal/iostream_state_saver.h"
+#include "absl/random/internal/randen.h"
+
+namespace absl {
+namespace random_internal {
+
+// Deterministic pseudorandom byte generator with backtracking resistance
+// (leaking the state does not compromise prior outputs). Based on Reverie
+// (see "A Robust and Sponge-Like PRNG with Improved Efficiency") instantiated
+// with an improved Simpira-like permutation.
+// Returns values of type "T" (must be a built-in unsigned integer type).
+//
+// RANDen = RANDom generator or beetroots in Swiss High German.
+// 'Strong' (well-distributed, unpredictable, backtracking-resistant) random
+// generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32.
+template <typename T>
+class alignas(16) randen_engine {
+ public:
+  // C++11 URBG interface:
+  using result_type = T;
+  static_assert(std::is_unsigned<result_type>::value,
+                "randen_engine template argument must be a built-in unsigned "
+                "integer type");
+
+  static constexpr result_type(min)() {
+    return (std::numeric_limits<result_type>::min)();
+  }
+
+  static constexpr result_type(max)() {
+    return (std::numeric_limits<result_type>::max)();
+  }
+
+  explicit randen_engine(result_type seed_value = 0) { seed(seed_value); }
+
+  template <class SeedSequence,
+            typename = typename absl::enable_if_t<
+                !std::is_same<SeedSequence, randen_engine>::value>>
+  explicit randen_engine(SeedSequence&& seq) {
+    seed(seq);
+  }
+
+  randen_engine(const randen_engine&) = default;
+
+  // Returns random bits from the buffer in units of result_type.
+  result_type operator()() {
+    // Refill the buffer if needed (unlikely).
+    if (next_ >= kStateSizeT) {
+      next_ = kCapacityT;
+      impl_.Generate(state_);
+    }
+
+    return state_[next_++];
+  }
+
+  template <class SeedSequence>
+  typename absl::enable_if_t<
+      !std::is_convertible<SeedSequence, result_type>::value>
+  seed(SeedSequence&& seq) {
+    // Zeroes the state.
+    seed();
+    reseed(seq);
+  }
+
+  void seed(result_type seed_value = 0) {
+    next_ = kStateSizeT;
+    // Zeroes the inner state and fills the outer state with seed_value to
+    // mimics behaviour of reseed
+    std::fill(std::begin(state_), std::begin(state_) + kCapacityT, 0);
+    std::fill(std::begin(state_) + kCapacityT, std::end(state_), seed_value);
+  }
+
+  // Inserts entropy into (part of) the state. Calling this periodically with
+  // sufficient entropy ensures prediction resistance (attackers cannot predict
+  // future outputs even if state is compromised).
+  template <class SeedSequence>
+  void reseed(SeedSequence& seq) {
+    using sequence_result_type = typename SeedSequence::result_type;
+    static_assert(sizeof(sequence_result_type) == 4,
+                  "SeedSequence::result_type must be 32-bit");
+
+    constexpr size_t kBufferSize =
+        Randen::kSeedBytes / sizeof(sequence_result_type);
+    alignas(16) sequence_result_type buffer[kBufferSize];
+
+    // Randen::Absorb XORs the seed into state, which is then mixed by a call
+    // to Randen::Generate. Seeding with only the provided entropy is preferred
+    // to using an arbitrary generate() call, so use [rand.req.seed_seq]
+    // size as a proxy for the number of entropy units that can be generated
+    // without relying on seed sequence mixing...
+    const size_t entropy_size = seq.size();
+    if (entropy_size < kBufferSize) {
+      // ... and only request that many values, or 256-bits, when unspecified.
+      const size_t requested_entropy = (entropy_size == 0) ? 8u : entropy_size;
+      std::fill(std::begin(buffer) + requested_entropy, std::end(buffer), 0);
+      seq.generate(std::begin(buffer), std::begin(buffer) + requested_entropy);
+      // The Randen paper suggests preferentially initializing even-numbered
+      // 128-bit vectors of the randen state (there are 16 such vectors).
+      // The seed data is merged into the state offset by 128-bits, which
+      // implies prefering seed bytes [16..31, ..., 208..223]. Since the
+      // buffer is 32-bit values, we swap the corresponding buffer positions in
+      // 128-bit chunks.
+      size_t dst = kBufferSize;
+      while (dst > 7) {
+        // leave the odd bucket as-is.
+        dst -= 4;
+        size_t src = dst >> 1;
+        // swap 128-bits into the even bucket
+        std::swap(buffer[--dst], buffer[--src]);
+        std::swap(buffer[--dst], buffer[--src]);
+        std::swap(buffer[--dst], buffer[--src]);
+        std::swap(buffer[--dst], buffer[--src]);
+      }
+    } else {
+      seq.generate(std::begin(buffer), std::end(buffer));
+    }
+    impl_.Absorb(buffer, state_);
+
+    // Generate will be called when operator() is called
+    next_ = kStateSizeT;
+  }
+
+  void discard(uint64_t count) {
+    uint64_t step = std::min<uint64_t>(kStateSizeT - next_, count);
+    count -= step;
+
+    constexpr uint64_t kRateT = kStateSizeT - kCapacityT;
+    while (count > 0) {
+      next_ = kCapacityT;
+      impl_.Generate(state_);
+      step = std::min<uint64_t>(kRateT, count);
+      count -= step;
+    }
+    next_ += step;
+  }
+
+  bool operator==(const randen_engine& other) const {
+    return next_ == other.next_ &&
+           std::equal(std::begin(state_), std::end(state_),
+                      std::begin(other.state_));
+  }
+
+  bool operator!=(const randen_engine& other) const {
+    return !(*this == other);
+  }
+
+  template <class CharT, class Traits>
+  friend std::basic_ostream<CharT, Traits>& operator<<(
+      std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+      const randen_engine<T>& engine) {       // NOLINT(runtime/references)
+    using numeric_type =
+        typename random_internal::stream_format_type<result_type>::type;
+    auto saver = random_internal::make_ostream_state_saver(os);
+    for (const auto& elem : engine.state_) {
+      // In the case that `elem` is `uint8_t`, it must be cast to something
+      // larger so that it prints as an integer rather than a character. For
+      // simplicity, apply the cast all circumstances.
+      os << static_cast<numeric_type>(elem) << os.fill();
+    }
+    os << engine.next_;
+    return os;
+  }
+
+  template <class CharT, class Traits>
+  friend std::basic_istream<CharT, Traits>& operator>>(
+      std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+      randen_engine<T>& engine) {             // NOLINT(runtime/references)
+    using numeric_type =
+        typename random_internal::stream_format_type<result_type>::type;
+    result_type state[kStateSizeT];
+    size_t next;
+    for (auto& elem : state) {
+      // It is not possible to read uint8_t from wide streams, so it is
+      // necessary to read a wider type and then cast it to uint8_t.
+      numeric_type value;
+      is >> value;
+      elem = static_cast<result_type>(value);
+    }
+    is >> next;
+    if (is.fail()) {
+      return is;
+    }
+    std::memcpy(engine.state_, state, sizeof(engine.state_));
+    engine.next_ = next;
+    return is;
+  }
+
+ private:
+  static constexpr size_t kStateSizeT =
+      Randen::kStateBytes / sizeof(result_type);
+  static constexpr size_t kCapacityT =
+      Randen::kCapacityBytes / sizeof(result_type);
+
+  // First kCapacityT are `inner', the others are accessible random bits.
+  alignas(16) result_type state_[kStateSizeT];
+  size_t next_;  // index within state_
+  Randen impl_;
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h
new file mode 100644 (file)
index 0000000..0acec4b
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
+#define ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
+
+// HERMETIC NOTE: The randen_hwaes target must not introduce duplicate
+// symbols from arbitrary system and other headers, since it may be built
+// with different flags from other targets, using different levels of
+// optimization, potentially introducing ODR violations.
+
+namespace absl {
+namespace random_internal {
+
+// RANDen = RANDom generator or beetroots in Swiss German.
+// 'Strong' (well-distributed, unpredictable, backtracking-resistant) random
+// generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32.
+//
+// RandenHwAes implements the basic state manipulation methods.
+class RandenHwAes {
+ public:
+  static void Generate(const void* keys, void* state_void);
+  static void Absorb(const void* seed_void, void* state_void);
+  static const void* GetKeys();
+};
+
+// HasRandenHwAesImplementation returns true when there is an accelerated
+// implementation, and false otherwise.  If there is no implementation,
+// then attempting to use it will abort the program.
+bool HasRandenHwAesImplementation();
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_FAST_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_slow.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_slow.h
new file mode 100644 (file)
index 0000000..3058613
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_SLOW_H_
+#define ABSL_RANDOM_INTERNAL_RANDEN_SLOW_H_
+
+#include <cstddef>
+
+namespace absl {
+namespace random_internal {
+
+// RANDen = RANDom generator or beetroots in Swiss German.
+// RandenSlow implements the basic state manipulation methods for
+// architectures lacking AES hardware acceleration intrinsics.
+class RandenSlow {
+ public:
+  // Size of the entire sponge / state for the randen PRNG.
+  static constexpr size_t kStateBytes = 256;  // 2048-bit
+
+  // Size of the 'inner' (inaccessible) part of the sponge. Larger values would
+  // require more frequent calls to RandenGenerate.
+  static constexpr size_t kCapacityBytes = 16;  // 128-bit
+
+  static void Generate(const void* keys, void* state_void);
+  static void Absorb(const void* seed_void, void* state_void);
+  static const void* GetKeys();
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_SLOW_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_traits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/randen_traits.h
new file mode 100644 (file)
index 0000000..4f1f408
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_RANDEN_TRAITS_H_
+#define ABSL_RANDOM_INTERNAL_RANDEN_TRAITS_H_
+
+// HERMETIC NOTE: The randen_hwaes target must not introduce duplicate
+// symbols from arbitrary system and other headers, since it may be built
+// with different flags from other targets, using different levels of
+// optimization, potentially introducing ODR violations.
+
+#include <cstddef>
+
+namespace absl {
+namespace random_internal {
+
+// RANDen = RANDom generator or beetroots in Swiss German.
+// 'Strong' (well-distributed, unpredictable, backtracking-resistant) random
+// generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32.
+//
+// RandenTraits contains the basic algorithm traits, such as the size of the
+// state, seed, sponge, etc.
+struct RandenTraits {
+  // Size of the entire sponge / state for the randen PRNG.
+  static constexpr size_t kStateBytes = 256;  // 2048-bit
+
+  // Size of the 'inner' (inaccessible) part of the sponge. Larger values would
+  // require more frequent calls to RandenGenerate.
+  static constexpr size_t kCapacityBytes = 16;  // 128-bit
+
+  // Size of the default seed consumed by the sponge.
+  static constexpr size_t kSeedBytes = kStateBytes - kCapacityBytes;
+
+  // Largest size for which security proofs are known.
+  static constexpr size_t kFeistelBlocks = 16;
+
+  // Type-2 generalized Feistel => one round function for every two blocks.
+  static constexpr size_t kFeistelFunctions = kFeistelBlocks / 2;  // = 8
+
+  // Ensures SPRP security and two full subblock diffusions.
+  // Must be > 4 * log2(kFeistelBlocks).
+  static constexpr size_t kFeistelRounds = 16 + 1;
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_RANDEN_TRAITS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h
new file mode 100644 (file)
index 0000000..3d16cf9
--- /dev/null
@@ -0,0 +1,152 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_SALTED_SEED_SEQ_H_
+#define ABSL_RANDOM_INTERNAL_SALTED_SEED_SEQ_H_
+
+#include <cstdint>
+#include <cstdlib>
+#include <initializer_list>
+#include <iterator>
+#include <memory>
+#include <type_traits>
+#include <utility>
+
+#include "absl/container/inlined_vector.h"
+#include "absl/meta/type_traits.h"
+#include "absl/random/internal/seed_material.h"
+#include "absl/types/optional.h"
+#include "absl/types/span.h"
+
+namespace absl {
+namespace random_internal {
+
+// This class conforms to the C++ Standard "Seed Sequence" concept
+// [rand.req.seedseq].
+//
+// A `SaltedSeedSeq` is meant to wrap an existing seed sequence and modify
+// generated sequence by mixing with extra entropy. This entropy may be
+// build-dependent or process-dependent. The implementation may change to be
+// have either or both kinds of entropy. If salt is not available sequence is
+// not modified.
+template <typename SSeq>
+class SaltedSeedSeq {
+ public:
+  using inner_sequence_type = SSeq;
+  using result_type = typename SSeq::result_type;
+
+  SaltedSeedSeq() : seq_(absl::make_unique<SSeq>()) {}
+
+  template <typename Iterator>
+  SaltedSeedSeq(Iterator begin, Iterator end)
+      : seq_(absl::make_unique<SSeq>(begin, end)) {}
+
+  template <typename T>
+  SaltedSeedSeq(std::initializer_list<T> il)
+      : SaltedSeedSeq(il.begin(), il.end()) {}
+
+  SaltedSeedSeq(const SaltedSeedSeq& other) = delete;
+  SaltedSeedSeq& operator=(const SaltedSeedSeq& other) = delete;
+
+  SaltedSeedSeq(SaltedSeedSeq&& other) = default;
+  SaltedSeedSeq& operator=(SaltedSeedSeq&& other) = default;
+
+  template <typename RandomAccessIterator>
+  void generate(RandomAccessIterator begin, RandomAccessIterator end) {
+    if (begin != end) {
+      generate_impl(
+          std::integral_constant<bool, sizeof(*begin) == sizeof(uint32_t)>{},
+          begin, end);
+    }
+  }
+
+  template <typename OutIterator>
+  void param(OutIterator out) const {
+    seq_->param(out);
+  }
+
+  size_t size() const { return seq_->size(); }
+
+ private:
+  // The common case for generate is that it is called with iterators over a
+  // 32-bit value buffer. These can be reinterpreted to a uint32_t and we can
+  // operate on them as such.
+  template <typename RandomAccessIterator>
+  void generate_impl(std::integral_constant<bool, true> /*is_32bit*/,
+                     RandomAccessIterator begin, RandomAccessIterator end) {
+    seq_->generate(begin, end);
+    const uint32_t salt = absl::random_internal::GetSaltMaterial().value_or(0);
+    auto buffer = absl::MakeSpan(begin, end);
+    MixIntoSeedMaterial(
+        absl::MakeConstSpan(&salt, 1),
+        absl::MakeSpan(reinterpret_cast<uint32_t*>(buffer.data()),
+                       buffer.size()));
+  }
+
+  // The uncommon case for generate is that it is called with iterators over
+  // some other buffer type which is assignable from a 32-bit value. In this
+  // case we allocate a temporary 32-bit buffer and then copy-assign back
+  // to the initial inputs.
+  template <typename RandomAccessIterator>
+  void generate_impl(std::integral_constant<bool, false> /*is_32bit*/,
+                     RandomAccessIterator begin, RandomAccessIterator end) {
+    // Allocate a temporary buffer, seed, and then copy.
+    absl::InlinedVector<uint32_t, 8> data(std::distance(begin, end), 0);
+    generate_impl(std::integral_constant<bool, true>{}, data.begin(),
+                  data.end());
+    std::copy(data.begin(), data.end(), begin);
+  }
+
+  // Because [rand.req.seedseq] is not copy-constructible, copy-assignable nor
+  // movable so we wrap it with unique pointer to be able to move SaltedSeedSeq.
+  std::unique_ptr<SSeq> seq_;
+};
+
+// is_salted_seed_seq indicates whether the type is a SaltedSeedSeq.
+template <typename T, typename = void>
+struct is_salted_seed_seq : public std::false_type {};
+
+template <typename T>
+struct is_salted_seed_seq<
+    T, typename std::enable_if<std::is_same<
+           T, SaltedSeedSeq<typename T::inner_sequence_type>>::value>::type>
+    : public std::true_type {};
+
+// MakeSaltedSeedSeq returns a salted variant of the seed sequence.
+// When provided with an existing SaltedSeedSeq, returns the input parameter,
+// otherwise constructs a new SaltedSeedSeq which embodies the original
+// non-salted seed parameters.
+template <
+    typename SSeq,  //
+    typename EnableIf = absl::enable_if_t<is_salted_seed_seq<SSeq>::value>>
+SSeq MakeSaltedSeedSeq(SSeq&& seq) {
+  return SSeq(std::forward<SSeq>(seq));
+}
+
+template <
+    typename SSeq,  //
+    typename EnableIf = absl::enable_if_t<!is_salted_seed_seq<SSeq>::value>>
+SaltedSeedSeq<typename std::decay<SSeq>::type> MakeSaltedSeedSeq(SSeq&& seq) {
+  using sseq_type = typename std::decay<SSeq>::type;
+  using result_type = typename sseq_type::result_type;
+
+  absl::InlinedVector<result_type, 8> data;
+  seq.param(std::back_inserter(data));
+  return SaltedSeedSeq<sseq_type>(data.begin(), data.end());
+}
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_SALTED_SEED_SEQ_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/seed_material.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/seed_material.h
new file mode 100644 (file)
index 0000000..57de8a2
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_SEED_MATERIAL_H_
+#define ABSL_RANDOM_INTERNAL_SEED_MATERIAL_H_
+
+#include <cassert>
+#include <cstdint>
+#include <cstdlib>
+#include <string>
+#include <vector>
+
+#include "absl/base/attributes.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/types/optional.h"
+#include "absl/types/span.h"
+
+namespace absl {
+namespace random_internal {
+
+// Returns the number of 32-bit blocks needed to contain the given number of
+// bits.
+constexpr size_t SeedBitsToBlocks(size_t seed_size) {
+  return (seed_size + 31) / 32;
+}
+
+// Amount of entropy (measured in bits) used to instantiate a Seed Sequence,
+// with which to create a URBG.
+constexpr size_t kEntropyBitsNeeded = 256;
+
+// Amount of entropy (measured in 32-bit blocks) used to instantiate a Seed
+// Sequence, with which to create a URBG.
+constexpr size_t kEntropyBlocksNeeded =
+    random_internal::SeedBitsToBlocks(kEntropyBitsNeeded);
+
+static_assert(kEntropyBlocksNeeded > 0,
+              "Entropy used to seed URBGs must be nonzero.");
+
+// Attempts to fill a span of uint32_t-values using an OS-provided source of
+// true entropy (eg. /dev/urandom) into an array of uint32_t blocks of data. The
+// resulting array may be used to initialize an instance of a class conforming
+// to the C++ Standard "Seed Sequence" concept [rand.req.seedseq].
+//
+// If values.data() == nullptr, the behavior is undefined.
+ABSL_MUST_USE_RESULT
+bool ReadSeedMaterialFromOSEntropy(absl::Span<uint32_t> values);
+
+// Attempts to fill a span of uint32_t-values using variates generated by an
+// existing instance of a class conforming to the C++ Standard "Uniform Random
+// Bit Generator" concept [rand.req.urng]. The resulting data may be used to
+// initialize an instance of a class conforming to the C++ Standard
+// "Seed Sequence" concept [rand.req.seedseq].
+//
+// If urbg == nullptr or values.data() == nullptr, the behavior is undefined.
+template <typename URBG>
+ABSL_MUST_USE_RESULT bool ReadSeedMaterialFromURBG(
+    URBG* urbg, absl::Span<uint32_t> values) {
+  random_internal::FastUniformBits<uint32_t> distr;
+
+  assert(urbg != nullptr && values.data() != nullptr);
+  if (urbg == nullptr || values.data() == nullptr) {
+    return false;
+  }
+
+  for (uint32_t& seed_value : values) {
+    seed_value = distr(*urbg);
+  }
+  return true;
+}
+
+// Mixes given sequence of values with into given sequence of seed material.
+// Time complexity of this function is O(sequence.size() *
+// seed_material.size()).
+//
+// Algorithm is based on code available at
+// https://gist.github.com/imneme/540829265469e673d045
+// by Melissa O'Neill.
+void MixIntoSeedMaterial(absl::Span<const uint32_t> sequence,
+                         absl::Span<uint32_t> seed_material);
+
+// Returns salt value.
+//
+// Salt is obtained only once and stored in static variable.
+//
+// May return empty value if optaining the salt was not possible.
+absl::optional<uint32_t> GetSaltMaterial();
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_SEED_MATERIAL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/sequence_urbg.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/sequence_urbg.h
new file mode 100644 (file)
index 0000000..9a9b577
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
+#define ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
+
+#include <cstdint>
+#include <cstring>
+#include <limits>
+#include <type_traits>
+#include <vector>
+
+namespace absl {
+namespace random_internal {
+
+// `sequence_urbg` is a simple random number generator which meets the
+// requirements of [rand.req.urbg], and is solely for testing absl
+// distributions.
+class sequence_urbg {
+ public:
+  using result_type = uint64_t;
+
+  static constexpr result_type(min)() {
+    return (std::numeric_limits<result_type>::min)();
+  }
+  static constexpr result_type(max)() {
+    return (std::numeric_limits<result_type>::max)();
+  }
+
+  sequence_urbg(std::initializer_list<result_type> data) : i_(0), data_(data) {}
+  void reset() { i_ = 0; }
+
+  result_type operator()() { return data_[i_++ % data_.size()]; }
+
+  size_t invocations() const { return i_; }
+
+ private:
+  size_t i_;
+  std::vector<result_type> data_;
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/traits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/traits.h
new file mode 100644 (file)
index 0000000..40eb011
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_INTERNAL_TRAITS_H_
+#define ABSL_RANDOM_INTERNAL_TRAITS_H_
+
+#include <cstdint>
+#include <limits>
+#include <type_traits>
+
+#include "absl/base/config.h"
+
+namespace absl {
+namespace random_internal {
+
+// random_internal::is_widening_convertible<A, B>
+//
+// Returns whether a type A is widening-convertible to a type B.
+//
+// A is widening-convertible to B means:
+//   A a = <any number>;
+//   B b = a;
+//   A c = b;
+//   EXPECT_EQ(a, c);
+template <typename A, typename B>
+class is_widening_convertible {
+  // As long as there are enough bits in the exact part of a number:
+  // - unsigned can fit in float, signed, unsigned
+  // - signed can fit in float, signed
+  // - float can fit in float
+  // So we define rank to be:
+  // - rank(float) -> 2
+  // - rank(signed) -> 1
+  // - rank(unsigned) -> 0
+  template <class T>
+  static constexpr int rank() {
+    return !std::numeric_limits<T>::is_integer +
+           std::numeric_limits<T>::is_signed;
+  }
+
+ public:
+  // If an arithmetic-type B can represent at least as many digits as a type A,
+  // and B belongs to a rank no lower than A, then A can be safely represented
+  // by B through a widening-conversion.
+  static constexpr bool value =
+      std::numeric_limits<A>::digits <= std::numeric_limits<B>::digits &&
+      rank<A>() <= rank<B>();
+};
+
+// unsigned_bits<N>::type returns the unsigned int type with the indicated
+// number of bits.
+template <size_t N>
+struct unsigned_bits;
+
+template <>
+struct unsigned_bits<8> {
+  using type = uint8_t;
+};
+template <>
+struct unsigned_bits<16> {
+  using type = uint16_t;
+};
+template <>
+struct unsigned_bits<32> {
+  using type = uint32_t;
+};
+template <>
+struct unsigned_bits<64> {
+  using type = uint64_t;
+};
+
+#ifdef ABSL_HAVE_INTRINSIC_INT128
+template <>
+struct unsigned_bits<128> {
+  using type = __uint128_t;
+};
+#endif
+
+template <typename IntType>
+struct make_unsigned_bits {
+  using type = typename unsigned_bits<std::numeric_limits<
+      typename std::make_unsigned<IntType>::type>::digits>::type;
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_INTERNAL_TRAITS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/uniform_helper.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/internal/uniform_helper.h
new file mode 100644 (file)
index 0000000..b6e2a4a
--- /dev/null
@@ -0,0 +1,150 @@
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef ABSL_RANDOM_UNIFORM_HELPER_H_
+#define ABSL_RANDOM_UNIFORM_HELPER_H_
+
+#include <cmath>
+#include <limits>
+#include <type_traits>
+
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+template <typename IntType>
+class uniform_int_distribution;
+
+template <typename RealType>
+class uniform_real_distribution;
+
+// Interval tag types which specify whether the interval is open or closed
+// on either boundary.
+namespace random_internal {
+struct IntervalClosedClosedT {};
+struct IntervalClosedOpenT {};
+struct IntervalOpenClosedT {};
+struct IntervalOpenOpenT {};
+}  // namespace random_internal
+
+namespace random_internal {
+
+// The functions
+//    uniform_lower_bound(tag, a, b)
+// and
+//    uniform_upper_bound(tag, a, b)
+// are used as implementation-details for absl::Uniform().
+//
+// Conceptually,
+//    [a, b] == [uniform_lower_bound(IntervalClosedClosed, a, b),
+//               uniform_upper_bound(IntervalClosedClosed, a, b)]
+//    (a, b) == [uniform_lower_bound(IntervalOpenOpen, a, b),
+//               uniform_upper_bound(IntervalOpenOpen, a, b)]
+//    [a, b) == [uniform_lower_bound(IntervalClosedOpen, a, b),
+//               uniform_upper_bound(IntervalClosedOpen, a, b)]
+//    (a, b] == [uniform_lower_bound(IntervalOpenClosed, a, b),
+//               uniform_upper_bound(IntervalOpenClosed, a, b)]
+//
+template <typename IntType, typename Tag>
+typename absl::enable_if_t<
+    absl::conjunction<
+        std::is_integral<IntType>,
+        absl::disjunction<std::is_same<Tag, IntervalOpenClosedT>,
+                          std::is_same<Tag, IntervalOpenOpenT>>>::value,
+    IntType>
+uniform_lower_bound(Tag, IntType a, IntType) {
+  return a + 1;
+}
+
+template <typename FloatType, typename Tag>
+typename absl::enable_if_t<
+    absl::conjunction<
+        std::is_floating_point<FloatType>,
+        absl::disjunction<std::is_same<Tag, IntervalOpenClosedT>,
+                          std::is_same<Tag, IntervalOpenOpenT>>>::value,
+    FloatType>
+uniform_lower_bound(Tag, FloatType a, FloatType b) {
+  return std::nextafter(a, b);
+}
+
+template <typename NumType, typename Tag>
+typename absl::enable_if_t<
+    absl::disjunction<std::is_same<Tag, IntervalClosedClosedT>,
+                      std::is_same<Tag, IntervalClosedOpenT>>::value,
+    NumType>
+uniform_lower_bound(Tag, NumType a, NumType) {
+  return a;
+}
+
+template <typename IntType, typename Tag>
+typename absl::enable_if_t<
+    absl::conjunction<
+        std::is_integral<IntType>,
+        absl::disjunction<std::is_same<Tag, IntervalClosedOpenT>,
+                          std::is_same<Tag, IntervalOpenOpenT>>>::value,
+    IntType>
+uniform_upper_bound(Tag, IntType, IntType b) {
+  return b - 1;
+}
+
+template <typename FloatType, typename Tag>
+typename absl::enable_if_t<
+    absl::conjunction<
+        std::is_floating_point<FloatType>,
+        absl::disjunction<std::is_same<Tag, IntervalClosedOpenT>,
+                          std::is_same<Tag, IntervalOpenOpenT>>>::value,
+    FloatType>
+uniform_upper_bound(Tag, FloatType, FloatType b) {
+  return b;
+}
+
+template <typename IntType, typename Tag>
+typename absl::enable_if_t<
+    absl::conjunction<
+        std::is_integral<IntType>,
+        absl::disjunction<std::is_same<Tag, IntervalClosedClosedT>,
+                          std::is_same<Tag, IntervalOpenClosedT>>>::value,
+    IntType>
+uniform_upper_bound(Tag, IntType, IntType b) {
+  return b;
+}
+
+template <typename FloatType, typename Tag>
+typename absl::enable_if_t<
+    absl::conjunction<
+        std::is_floating_point<FloatType>,
+        absl::disjunction<std::is_same<Tag, IntervalClosedClosedT>,
+                          std::is_same<Tag, IntervalOpenClosedT>>>::value,
+    FloatType>
+uniform_upper_bound(Tag, FloatType, FloatType b) {
+  return std::nextafter(b, (std::numeric_limits<FloatType>::max)());
+}
+
+template <typename NumType>
+using UniformDistribution =
+    typename std::conditional<std::is_integral<NumType>::value,
+                              absl::uniform_int_distribution<NumType>,
+                              absl::uniform_real_distribution<NumType>>::type;
+
+template <typename TagType, typename NumType>
+struct UniformDistributionWrapper : public UniformDistribution<NumType> {
+  explicit UniformDistributionWrapper(NumType lo, NumType hi)
+      : UniformDistribution<NumType>(
+            uniform_lower_bound<NumType>(TagType{}, lo, hi),
+            uniform_upper_bound<NumType>(TagType{}, lo, hi)) {}
+};
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_UNIFORM_HELPER_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h
new file mode 100644 (file)
index 0000000..ac43416
--- /dev/null
@@ -0,0 +1,250 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_
+#define ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_
+
+#include <algorithm>
+#include <cassert>
+#include <cmath>
+#include <istream>
+#include <limits>
+#include <ostream>
+#include <type_traits>
+
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fastmath.h"
+#include "absl/random/internal/iostream_state_saver.h"
+#include "absl/random/internal/traits.h"
+#include "absl/random/uniform_int_distribution.h"
+
+namespace absl {
+
+// log_uniform_int_distribution:
+//
+// Returns a random variate R in range [min, max] such that
+// floor(log(R-min, base)) is uniformly distributed.
+// We ensure uniformity by discretization using the
+// boundary sets [0, 1, base, base * base, ... min(base*n, max)]
+//
+template <typename IntType = int>
+class log_uniform_int_distribution {
+ private:
+  using unsigned_type =
+      typename random_internal::make_unsigned_bits<IntType>::type;
+
+ public:
+  using result_type = IntType;
+
+  class param_type {
+   public:
+    using distribution_type = log_uniform_int_distribution;
+
+    explicit param_type(
+        result_type min = 0,
+        result_type max = (std::numeric_limits<result_type>::max)(),
+        result_type base = 2)
+        : min_(min),
+          max_(max),
+          base_(base),
+          range_(static_cast<unsigned_type>(max_) -
+                 static_cast<unsigned_type>(min_)),
+          log_range_(0) {
+      assert(max_ >= min_);
+      assert(base_ > 1);
+
+      if (base_ == 2) {
+        // Determine where the first set bit is on range(), giving a log2(range)
+        // value which can be used to construct bounds.
+        log_range_ = (std::min)(random_internal::LeadingSetBit(range()),
+                                std::numeric_limits<unsigned_type>::digits);
+      } else {
+        // NOTE: Computing the logN(x) introduces error from 2 sources:
+        // 1. Conversion of int to double loses precision for values >=
+        // 2^53, which may cause some log() computations to operate on
+        // different values.
+        // 2. The error introduced by the division will cause the result
+        // to differ from the expected value.
+        //
+        // Thus a result which should equal K may equal K +/- epsilon,
+        // which can eliminate some values depending on where the bounds fall.
+        const double inv_log_base = 1.0 / std::log(base_);
+        const double log_range = std::log(static_cast<double>(range()) + 0.5);
+        log_range_ = static_cast<int>(std::ceil(inv_log_base * log_range));
+      }
+    }
+
+    result_type(min)() const { return min_; }
+    result_type(max)() const { return max_; }
+    result_type base() const { return base_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.min_ == b.min_ && a.max_ == b.max_ && a.base_ == b.base_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class log_uniform_int_distribution;
+
+    int log_range() const { return log_range_; }
+    unsigned_type range() const { return range_; }
+
+    result_type min_;
+    result_type max_;
+    result_type base_;
+    unsigned_type range_;  // max - min
+    int log_range_;        // ceil(logN(range_))
+
+    static_assert(std::is_integral<IntType>::value,
+                  "Class-template absl::log_uniform_int_distribution<> must be "
+                  "parameterized using an integral type.");
+  };
+
+  log_uniform_int_distribution() : log_uniform_int_distribution(0) {}
+
+  explicit log_uniform_int_distribution(
+      result_type min,
+      result_type max = (std::numeric_limits<result_type>::max)(),
+      result_type base = 2)
+      : param_(min, max, base) {}
+
+  explicit log_uniform_int_distribution(const param_type& p) : param_(p) {}
+
+  void reset() {}
+
+  // generating functions
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p) {
+    return (p.min)() + Generate(g, p);
+  }
+
+  result_type(min)() const { return (param_.min)(); }
+  result_type(max)() const { return (param_.max)(); }
+  result_type base() const { return param_.base(); }
+
+  param_type param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  friend bool operator==(const log_uniform_int_distribution& a,
+                         const log_uniform_int_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const log_uniform_int_distribution& a,
+                         const log_uniform_int_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  // Returns a log-uniform variate in the range [0, p.range()]. The caller
+  // should add min() to shift the result to the correct range.
+  template <typename URNG>
+  unsigned_type Generate(URNG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  param_type param_;
+};
+
+template <typename IntType>
+template <typename URBG>
+typename log_uniform_int_distribution<IntType>::unsigned_type
+log_uniform_int_distribution<IntType>::Generate(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  // sample e over [0, log_range]. Map the results of e to this:
+  // 0 => 0
+  // 1 => [1, b-1]
+  // 2 => [b, (b^2)-1]
+  // n => [b^(n-1)..(b^n)-1]
+  const int e = absl::uniform_int_distribution<int>(0, p.log_range())(g);
+  if (e == 0) {
+    return 0;
+  }
+  const int d = e - 1;
+
+  unsigned_type base_e, top_e;
+  if (p.base() == 2) {
+    base_e = static_cast<unsigned_type>(1) << d;
+
+    top_e = (e >= std::numeric_limits<unsigned_type>::digits)
+                ? (std::numeric_limits<unsigned_type>::max)()
+                : (static_cast<unsigned_type>(1) << e) - 1;
+  } else {
+    const double r = std::pow(p.base(), d);
+    const double s = (r * p.base()) - 1.0;
+
+    base_e = (r > (std::numeric_limits<unsigned_type>::max)())
+                 ? (std::numeric_limits<unsigned_type>::max)()
+                 : static_cast<unsigned_type>(r);
+
+    top_e = (s > (std::numeric_limits<unsigned_type>::max)())
+                ? (std::numeric_limits<unsigned_type>::max)()
+                : static_cast<unsigned_type>(s);
+  }
+
+  const unsigned_type lo = (base_e >= p.range()) ? p.range() : base_e;
+  const unsigned_type hi = (top_e >= p.range()) ? p.range() : top_e;
+
+  // choose uniformly over [lo, hi]
+  return absl::uniform_int_distribution<result_type>(lo, hi)(g);
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const log_uniform_int_distribution<IntType>& x) {
+  using stream_type =
+      typename random_internal::stream_format_type<IntType>::type;
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os << static_cast<stream_type>((x.min)()) << os.fill()
+     << static_cast<stream_type>((x.max)()) << os.fill()
+     << static_cast<stream_type>(x.base());
+  return os;
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,       // NOLINT(runtime/references)
+    log_uniform_int_distribution<IntType>& x) {  // NOLINT(runtime/references)
+  using param_type = typename log_uniform_int_distribution<IntType>::param_type;
+  using result_type =
+      typename log_uniform_int_distribution<IntType>::result_type;
+  using stream_type =
+      typename random_internal::stream_format_type<IntType>::type;
+
+  stream_type min;
+  stream_type max;
+  stream_type base;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  is >> min >> max >> base;
+  if (!is.fail()) {
+    x.param(param_type(static_cast<result_type>(min),
+                       static_cast<result_type>(max),
+                       static_cast<result_type>(base)));
+  }
+  return is;
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/poisson_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/poisson_distribution.h
new file mode 100644 (file)
index 0000000..7750b1c
--- /dev/null
@@ -0,0 +1,254 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_POISSON_DISTRIBUTION_H_
+#define ABSL_RANDOM_POISSON_DISTRIBUTION_H_
+
+#include <cassert>
+#include <cmath>
+#include <istream>
+#include <limits>
+#include <ostream>
+#include <type_traits>
+
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/fastmath.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+
+// absl::poisson_distribution:
+// Generates discrete variates conforming to a Poisson distribution.
+//   p(n) = (mean^n / n!) exp(-mean)
+//
+// Depending on the parameter, the distribution selects one of the following
+// algorithms:
+// * The standard algorithm, attributed to Knuth, extended using a split method
+// for larger values
+// * The "Ratio of Uniforms as a convenient method for sampling from classical
+// discrete distributions", Stadlober, 1989.
+// http://www.sciencedirect.com/science/article/pii/0377042790903495
+//
+// NOTE: param_type.mean() is a double, which permits values larger than
+// poisson_distribution<IntType>::max(), however this should be avoided and
+// the distribution results are limited to the max() value.
+//
+// The goals of this implementation are to provide good performance while still
+// beig thread-safe: This limits the implementation to not using lgamma provided
+// by <math.h>.
+//
+template <typename IntType = int>
+class poisson_distribution {
+ public:
+  using result_type = IntType;
+
+  class param_type {
+   public:
+    using distribution_type = poisson_distribution;
+    explicit param_type(double mean = 1.0);
+
+    double mean() const { return mean_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.mean_ == b.mean_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class poisson_distribution;
+
+    double mean_;
+    double emu_;  // e ^ -mean_
+    double lmu_;  // ln(mean_)
+    double s_;
+    double log_k_;
+    int split_;
+
+    static_assert(std::is_integral<IntType>::value,
+                  "Class-template absl::poisson_distribution<> must be "
+                  "parameterized using an integral type.");
+  };
+
+  poisson_distribution() : poisson_distribution(1.0) {}
+
+  explicit poisson_distribution(double mean) : param_(mean) {}
+
+  explicit poisson_distribution(const param_type& p) : param_(p) {}
+
+  void reset() {}
+
+  // generating functions
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  param_type param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  result_type(min)() const { return 0; }
+  result_type(max)() const { return (std::numeric_limits<result_type>::max)(); }
+
+  double mean() const { return param_.mean(); }
+
+  friend bool operator==(const poisson_distribution& a,
+                         const poisson_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const poisson_distribution& a,
+                         const poisson_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  param_type param_;
+  random_internal::FastUniformBits<uint64_t> fast_u64_;
+};
+
+// -----------------------------------------------------------------------------
+// Implementation details follow
+// -----------------------------------------------------------------------------
+
+template <typename IntType>
+poisson_distribution<IntType>::param_type::param_type(double mean)
+    : mean_(mean), split_(0) {
+  assert(mean >= 0);
+  assert(mean <= (std::numeric_limits<result_type>::max)());
+  // As a defensive measure, avoid large values of the mean.  The rejection
+  // algorithm used does not support very large values well.  It my be worth
+  // changing algorithms to better deal with these cases.
+  assert(mean <= 1e10);
+  if (mean_ < 10) {
+    // For small lambda, use the knuth method.
+    split_ = 1;
+    emu_ = std::exp(-mean_);
+  } else if (mean_ <= 50) {
+    // Use split-knuth method.
+    split_ = 1 + static_cast<int>(mean_ / 10.0);
+    emu_ = std::exp(-mean_ / static_cast<double>(split_));
+  } else {
+    // Use ratio of uniforms method.
+    constexpr double k2E = 0.7357588823428846;
+    constexpr double kSA = 0.4494580810294493;
+
+    lmu_ = std::log(mean_);
+    double a = mean_ + 0.5;
+    s_ = kSA + std::sqrt(k2E * a);
+    const double mode = std::ceil(mean_) - 1;
+    log_k_ = lmu_ * mode - absl::random_internal::StirlingLogFactorial(mode);
+  }
+}
+
+template <typename IntType>
+template <typename URBG>
+typename poisson_distribution<IntType>::result_type
+poisson_distribution<IntType>::operator()(
+    URBG& g,  // NOLINT(runtime/references)
+    const param_type& p) {
+  using random_internal::PositiveValueT;
+  using random_internal::RandU64ToDouble;
+  using random_internal::SignedValueT;
+
+  if (p.split_ != 0) {
+    // Use Knuth's algorithm with range splitting to avoid floating-point
+    // errors. Knuth's algorithm is: Ui is a sequence of uniform variates on
+    // (0,1); return the number of variates required for product(Ui) <
+    // exp(-lambda).
+    //
+    // The expected number of variates required for Knuth's method can be
+    // computed as follows:
+    // The expected value of U is 0.5, so solving for 0.5^n < exp(-lambda) gives
+    // the expected number of uniform variates
+    // required for a given lambda, which is:
+    //  lambda = [2, 5,  9, 10, 11, 12, 13, 14, 15, 16, 17]
+    //  n      = [3, 8, 13, 15, 16, 18, 19, 21, 22, 24, 25]
+    //
+    result_type n = 0;
+    for (int split = p.split_; split > 0; --split) {
+      double r = 1.0;
+      do {
+        r *= RandU64ToDouble<PositiveValueT, true>(fast_u64_(g));
+        ++n;
+      } while (r > p.emu_);
+      --n;
+    }
+    return n;
+  }
+
+  // Use ratio of uniforms method.
+  //
+  // Let u ~ Uniform(0, 1), v ~ Uniform(-1, 1),
+  //     a = lambda + 1/2,
+  //     s = 1.5 - sqrt(3/e) + sqrt(2(lambda + 1/2)/e),
+  //     x = s * v/u + a.
+  // P(floor(x) = k | u^2 < f(floor(x))/k), where
+  // f(m) = lambda^m exp(-lambda)/ m!, for 0 <= m, and f(m) = 0 otherwise,
+  // and k = max(f).
+  const double a = p.mean_ + 0.5;
+  for (;;) {
+    const double u =
+        RandU64ToDouble<PositiveValueT, false>(fast_u64_(g));  // (0, 1)
+    const double v =
+        RandU64ToDouble<SignedValueT, false>(fast_u64_(g));  // (-1, 1)
+    const double x = std::floor(p.s_ * v / u + a);
+    if (x < 0) continue;  // f(negative) = 0
+    const double rhs = x * p.lmu_;
+    // clang-format off
+    double s = (x <= 1.0) ? 0.0
+             : (x == 2.0) ? 0.693147180559945
+             : absl::random_internal::StirlingLogFactorial(x);
+    // clang-format on
+    const double lhs = 2.0 * std::log(u) + p.log_k_ + s;
+    if (lhs < rhs) {
+      return x > (max)() ? (max)()
+                         : static_cast<result_type>(x);  // f(x)/k >= u^2
+    }
+  }
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const poisson_distribution<IntType>& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<double>::kPrecision);
+  os << x.mean();
+  return os;
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    poisson_distribution<IntType>& x) {     // NOLINT(runtime/references)
+  using param_type = typename poisson_distribution<IntType>::param_type;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  double mean = random_internal::read_floating_point<double>(is);
+  if (!is.fail()) {
+    x.param(param_type(mean));
+  }
+  return is;
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_POISSON_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/random.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/random.h
new file mode 100644 (file)
index 0000000..dc6852f
--- /dev/null
@@ -0,0 +1,187 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: random.h
+// -----------------------------------------------------------------------------
+//
+// This header defines the recommended Uniform Random Bit Generator (URBG)
+// types for use within the Abseil Random library. These types are not
+// suitable for security-related use-cases, but should suffice for most other
+// uses of generating random values.
+//
+// The Abseil random library provides the following URBG types:
+//
+//   * BitGen, a good general-purpose bit generator, optimized for generating
+//     random (but not cryptographically secure) values
+//   * InsecureBitGen, a slightly faster, though less random, bit generator, for
+//     cases where the existing BitGen is a drag on performance.
+
+#ifndef ABSL_RANDOM_RANDOM_H_
+#define ABSL_RANDOM_RANDOM_H_
+
+#include <random>
+
+#include "absl/random/distributions.h"  // IWYU pragma: export
+#include "absl/random/internal/nonsecure_base.h"  // IWYU pragma: export
+#include "absl/random/internal/pcg_engine.h"  // IWYU pragma: export
+#include "absl/random/internal/pool_urbg.h"
+#include "absl/random/internal/randen_engine.h"
+#include "absl/random/seed_sequences.h"  // IWYU pragma: export
+
+namespace absl {
+
+// -----------------------------------------------------------------------------
+// absl::BitGen
+// -----------------------------------------------------------------------------
+//
+// `absl::BitGen` is a general-purpose random bit generator for generating
+// random values for use within the Abseil random library. Typically, you use a
+// bit generator in combination with a distribution to provide random values.
+//
+// Example:
+//
+//   // Create an absl::BitGen. There is no need to seed this bit generator.
+//   absl::BitGen gen;
+//
+//   // Generate an integer value in the closed interval [1,6]
+//   int die_roll = absl::uniform_int_distribution<int>(1, 6)(gen);
+//
+// `absl::BitGen` is seeded by default with non-deterministic data to produce
+// different sequences of random values across different instances, including
+// different binary invocations. This behavior is different than the standard
+// library bit generators, which use golden values as their seeds. Default
+// construction intentionally provides no stability guarantees, to avoid
+// accidental dependence on such a property.
+//
+// `absl::BitGen` may be constructed with an optional seed sequence type,
+// conforming to [rand.req.seed_seq], which will be mixed with additional
+// non-deterministic data.
+//
+// Example:
+//
+//  // Create an absl::BitGen using an std::seed_seq seed sequence
+//  std::seed_seq seq{1,2,3};
+//  absl::BitGen gen_with_seed(seq);
+//
+//  // Generate an integer value in the closed interval [1,6]
+//  int die_roll2 = absl::uniform_int_distribution<int>(1, 6)(gen_with_seed);
+//
+// `absl::BitGen` meets the requirements of the Uniform Random Bit Generator
+// (URBG) concept as per the C++17 standard [rand.req.urng] though differs
+// slightly with [rand.req.eng]. Like its standard library equivalents (e.g.
+// `std::mersenne_twister_engine`) `absl::BitGen` is not cryptographically
+// secure.
+//
+// Constructing two `absl::BitGen`s with the same seed sequence in the same
+// binary will produce the same sequence of variates within the same binary, but
+// need not do so across multiple binary invocations.
+//
+// This type has been optimized to perform better than Mersenne Twister
+// (https://en.wikipedia.org/wiki/Mersenne_Twister) and many other complex URBG
+// types on modern x86, ARM, and PPC architectures.
+//
+// This type is thread-compatible, but not thread-safe.
+
+// ---------------------------------------------------------------------------
+// absl::BitGen member functions
+// ---------------------------------------------------------------------------
+
+// absl::BitGen::operator()()
+//
+// Calls the BitGen, returning a generated value.
+
+// absl::BitGen::min()
+//
+// Returns the smallest possible value from this bit generator.
+
+// absl::BitGen::max()
+//
+// Returns the largest possible value from this bit generator., and
+
+// absl::BitGen::discard(num)
+//
+// Advances the internal state of this bit generator by `num` times, and
+// discards the intermediate results.
+// ---------------------------------------------------------------------------
+
+using BitGen = random_internal::NonsecureURBGBase<
+    random_internal::randen_engine<uint64_t>>;
+
+// -----------------------------------------------------------------------------
+// absl::InsecureBitGen
+// -----------------------------------------------------------------------------
+//
+// `absl::InsecureBitGen` is an efficient random bit generator for generating
+// random values, recommended only for performance-sensitive use cases where
+// `absl::BitGen` is not satisfactory when compute-bounded by bit generation
+// costs.
+//
+// Example:
+//
+//   // Create an absl::InsecureBitGen
+//   absl::InsecureBitGen gen;
+//   for (size_t i = 0; i < 1000000; i++) {
+//
+//     // Generate a bunch of random values from some complex distribution
+//     auto my_rnd = some_distribution(gen, 1, 1000);
+//   }
+//
+// Like `absl::BitGen`, `absl::InsecureBitGen` is seeded by default with
+// non-deterministic data to produce different sequences of random values across
+// different instances, including different binary invocations. (This behavior
+// is different than the standard library bit generators, which use golden
+// values as their seeds.)
+//
+// `absl::InsecureBitGen` may be constructed with an optional seed sequence
+// type, conforming to [rand.req.seed_seq], which will be mixed with additional
+// non-deterministic data. (See std_seed_seq.h for more information.)
+//
+// `absl::InsecureBitGen` meets the requirements of the Uniform Random Bit
+// Generator (URBG) concept as per the C++17 standard [rand.req.urng] though
+// its implementation differs slightly with [rand.req.eng]. Like its standard
+// library equivalents (e.g. `std::mersenne_twister_engine`)
+// `absl::InsecureBitGen` is not cryptographically secure.
+//
+// Prefer `absl::BitGen` over `absl::InsecureBitGen` as the general type is
+// often fast enough for the vast majority of applications.
+
+using InsecureBitGen =
+    random_internal::NonsecureURBGBase<random_internal::pcg64_2018_engine>;
+
+// ---------------------------------------------------------------------------
+// absl::InsecureBitGen member functions
+// ---------------------------------------------------------------------------
+
+// absl::InsecureBitGen::operator()()
+//
+// Calls the InsecureBitGen, returning a generated value.
+
+// absl::InsecureBitGen::min()
+//
+// Returns the smallest possible value from this bit generator.
+
+// absl::InsecureBitGen::max()
+//
+// Returns the largest possible value from this bit generator.
+
+// absl::InsecureBitGen::discard(num)
+//
+// Advances the internal state of this bit generator by `num` times, and
+// discards the intermediate results.
+// ---------------------------------------------------------------------------
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_RANDOM_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/seed_gen_exception.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/seed_gen_exception.h
new file mode 100644 (file)
index 0000000..b464d52
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: seed_gen_exception.h
+// -----------------------------------------------------------------------------
+//
+// This header defines an exception class which may be thrown if unpredictable
+// events prevent the derivation of suitable seed-material for constructing a
+// bit generator conforming to [rand.req.urng] (eg. entropy cannot be read from
+// /dev/urandom on a Unix-based system).
+//
+// Note: if exceptions are disabled, `std::terminate()` is called instead.
+
+#ifndef ABSL_RANDOM_SEED_GEN_EXCEPTION_H_
+#define ABSL_RANDOM_SEED_GEN_EXCEPTION_H_
+
+#include <exception>
+
+namespace absl {
+
+//------------------------------------------------------------------------------
+// SeedGenException
+//------------------------------------------------------------------------------
+class SeedGenException : public std::exception {
+ public:
+  SeedGenException() = default;
+  ~SeedGenException() override;
+  const char* what() const noexcept override;
+};
+
+namespace random_internal {
+
+// throw delegator
+[[noreturn]] void ThrowSeedGenException();
+
+}  // namespace random_internal
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_SEED_GEN_EXCEPTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/seed_sequences.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/seed_sequences.h
new file mode 100644 (file)
index 0000000..631d1ec
--- /dev/null
@@ -0,0 +1,108 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: seed_sequences.h
+// -----------------------------------------------------------------------------
+//
+// This header contains utilities for creating and working with seed sequences
+// conforming to [rand.req.seedseq]. In general, direct construction of seed
+// sequences is discouraged, but use-cases for construction of identical bit
+// generators (using the same seed sequence) may be helpful (e.g. replaying a
+// simulation whose state is derived from variates of a bit generator).
+
+#ifndef ABSL_RANDOM_SEED_SEQUENCES_H_
+#define ABSL_RANDOM_SEED_SEQUENCES_H_
+
+#include <iterator>
+#include <random>
+
+#include "absl/random/internal/salted_seed_seq.h"
+#include "absl/random/internal/seed_material.h"
+#include "absl/random/seed_gen_exception.h"
+#include "absl/types/span.h"
+
+namespace absl {
+
+// -----------------------------------------------------------------------------
+// absl::SeedSeq
+// -----------------------------------------------------------------------------
+//
+// `absl::SeedSeq` constructs a seed sequence according to [rand.req.seedseq]
+// for use within bit generators. `absl::SeedSeq`, unlike `std::seed_seq`
+// additionally salts the generated seeds with extra implementation-defined
+// entropy. For that reason, you can use `absl::SeedSeq` in combination with
+// standard library bit generators (e.g. `std::mt19937`) to introduce
+// non-determinism in your seeds.
+//
+// Example:
+//
+//   absl::SeedSeq my_seed_seq({a, b, c});
+//   std::mt19937 my_bitgen(my_seed_seq);
+//
+using SeedSeq = random_internal::SaltedSeedSeq<std::seed_seq>;
+
+// -----------------------------------------------------------------------------
+// absl::CreateSeedSeqFrom(bitgen*)
+// -----------------------------------------------------------------------------
+//
+// Constructs a seed sequence conforming to [rand.req.seedseq] using variates
+// produced by a provided bit generator.
+//
+// You should generally avoid direct construction of seed sequences, but
+// use-cases for reuse of a seed sequence to construct identical bit generators
+// may be helpful (eg. replaying a simulation whose state is derived from bit
+// generator values).
+//
+// If bitgen == nullptr, then behavior is undefined.
+//
+// Example:
+//
+//   absl::BitGen my_bitgen;
+//   auto seed_seq = absl::CreateSeedSeqFrom(&my_bitgen);
+//   absl::BitGen new_engine(seed_seq); // derived from my_bitgen, but not
+//                                      // correlated.
+//
+template <typename URBG>
+SeedSeq CreateSeedSeqFrom(URBG* urbg) {
+  SeedSeq::result_type
+      seed_material[random_internal::kEntropyBlocksNeeded];
+
+  if (!random_internal::ReadSeedMaterialFromURBG(
+          urbg, absl::MakeSpan(seed_material))) {
+    random_internal::ThrowSeedGenException();
+  }
+  return SeedSeq(std::begin(seed_material), std::end(seed_material));
+}
+
+// -----------------------------------------------------------------------------
+// absl::MakeSeedSeq()
+// -----------------------------------------------------------------------------
+//
+// Constructs an `absl::SeedSeq` salting the generated values using
+// implementation-defined entropy. The returned sequence can be used to create
+// equivalent bit generators correlated using this sequence.
+//
+// Example:
+//
+//   auto my_seed_seq = absl::MakeSeedSeq();
+//   std::mt19937 rng1(my_seed_seq);
+//   std::mt19937 rng2(my_seed_seq);
+//   EXPECT_EQ(rng1(), rng2());
+//
+SeedSeq MakeSeedSeq();
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_SEED_SEQUENCES_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/uniform_int_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/uniform_int_distribution.h
new file mode 100644 (file)
index 0000000..4970486
--- /dev/null
@@ -0,0 +1,273 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: uniform_int_distribution.h
+// -----------------------------------------------------------------------------
+//
+// This header defines a class for representing a uniform integer distribution
+// over the closed (inclusive) interval [a,b]. You use this distribution in
+// combination with an Abseil random bit generator to produce random values
+// according to the rules of the distribution.
+//
+// `absl::uniform_int_distribution` is a drop-in replacement for the C++11
+// `std::uniform_int_distribution` [rand.dist.uni.int] but is considerably
+// faster than the libstdc++ implementation.
+
+#ifndef ABSL_RANDOM_UNIFORM_INT_DISTRIBUTION_H_
+#define ABSL_RANDOM_UNIFORM_INT_DISTRIBUTION_H_
+
+#include <cassert>
+#include <istream>
+#include <limits>
+#include <type_traits>
+
+#include "absl/base/optimization.h"
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/iostream_state_saver.h"
+#include "absl/random/internal/traits.h"
+
+namespace absl {
+
+// absl::uniform_int_distribution<T>
+//
+// This distribution produces random integer values uniformly distributed in the
+// closed (inclusive) interval [a, b].
+//
+// Example:
+//
+//   absl::BitGen gen;
+//
+//   // Use the distribution to produce a value between 1 and 6, inclusive.
+//   int die_roll = absl::uniform_int_distribution<int>(1, 6)(gen);
+//
+template <typename IntType = int>
+class uniform_int_distribution {
+ private:
+  using unsigned_type =
+      typename random_internal::make_unsigned_bits<IntType>::type;
+
+ public:
+  using result_type = IntType;
+
+  class param_type {
+   public:
+    using distribution_type = uniform_int_distribution;
+
+    explicit param_type(
+        result_type lo = 0,
+        result_type hi = (std::numeric_limits<result_type>::max)())
+        : lo_(lo),
+          range_(static_cast<unsigned_type>(hi) -
+                 static_cast<unsigned_type>(lo)) {
+      // [rand.dist.uni.int] precondition 2
+      assert(lo <= hi);
+    }
+
+    result_type a() const { return lo_; }
+    result_type b() const {
+      return static_cast<result_type>(static_cast<unsigned_type>(lo_) + range_);
+    }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.lo_ == b.lo_ && a.range_ == b.range_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class uniform_int_distribution;
+    unsigned_type range() const { return range_; }
+
+    result_type lo_;
+    unsigned_type range_;
+
+    static_assert(std::is_integral<result_type>::value,
+                  "Class-template absl::uniform_int_distribution<> must be "
+                  "parameterized using an integral type.");
+  };  // param_type
+
+  uniform_int_distribution() : uniform_int_distribution(0) {}
+
+  explicit uniform_int_distribution(
+      result_type lo,
+      result_type hi = (std::numeric_limits<result_type>::max)())
+      : param_(lo, hi) {}
+
+  explicit uniform_int_distribution(const param_type& param) : param_(param) {}
+
+  // uniform_int_distribution<T>::reset()
+  //
+  // Resets the uniform int distribution. Note that this function has no effect
+  // because the distribution already produces independent values.
+  void reset() {}
+
+  template <typename URBG>
+  result_type operator()(URBG& gen) {  // NOLINT(runtime/references)
+    return (*this)(gen, param());
+  }
+
+  template <typename URBG>
+  result_type operator()(
+      URBG& gen, const param_type& param) {  // NOLINT(runtime/references)
+    return param.a() + Generate(gen, param.range());
+  }
+
+  result_type a() const { return param_.a(); }
+  result_type b() const { return param_.b(); }
+
+  param_type param() const { return param_; }
+  void param(const param_type& params) { param_ = params; }
+
+  result_type(min)() const { return a(); }
+  result_type(max)() const { return b(); }
+
+  friend bool operator==(const uniform_int_distribution& a,
+                         const uniform_int_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const uniform_int_distribution& a,
+                         const uniform_int_distribution& b) {
+    return !(a == b);
+  }
+
+ private:
+  // Generates a value in the *closed* interval [0, R]
+  template <typename URBG>
+  unsigned_type Generate(URBG& g,  // NOLINT(runtime/references)
+                         unsigned_type R);
+  param_type param_;
+};
+
+// -----------------------------------------------------------------------------
+// Implementation details follow
+// -----------------------------------------------------------------------------
+template <typename CharT, typename Traits, typename IntType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,
+    const uniform_int_distribution<IntType>& x) {
+  using stream_type =
+      typename random_internal::stream_format_type<IntType>::type;
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os << static_cast<stream_type>(x.a()) << os.fill()
+     << static_cast<stream_type>(x.b());
+  return os;
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,
+    uniform_int_distribution<IntType>& x) {
+  using param_type = typename uniform_int_distribution<IntType>::param_type;
+  using result_type = typename uniform_int_distribution<IntType>::result_type;
+  using stream_type =
+      typename random_internal::stream_format_type<IntType>::type;
+
+  stream_type a;
+  stream_type b;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  is >> a >> b;
+  if (!is.fail()) {
+    x.param(
+        param_type(static_cast<result_type>(a), static_cast<result_type>(b)));
+  }
+  return is;
+}
+
+template <typename IntType>
+template <typename URBG>
+typename random_internal::make_unsigned_bits<IntType>::type
+uniform_int_distribution<IntType>::Generate(
+    URBG& g,  // NOLINT(runtime/references)
+    typename random_internal::make_unsigned_bits<IntType>::type R) {
+    random_internal::FastUniformBits<unsigned_type> fast_bits;
+  unsigned_type bits = fast_bits(g);
+  const unsigned_type Lim = R + 1;
+  if ((R & Lim) == 0) {
+    // If the interval's length is a power of two range, just take the low bits.
+    return bits & R;
+  }
+
+  // Generates a uniform variate on [0, Lim) using fixed-point multiplication.
+  // The above fast-path guarantees that Lim is representable in unsigned_type.
+  //
+  // Algorithm adapted from
+  // http://lemire.me/blog/2016/06/30/fast-random-shuffling/, with added
+  // explanation.
+  //
+  // The algorithm creates a uniform variate `bits` in the interval [0, 2^N),
+  // and treats it as the fractional part of a fixed-point real value in [0, 1),
+  // multiplied by 2^N.  For example, 0.25 would be represented as 2^(N - 2),
+  // because 2^N * 0.25 == 2^(N - 2).
+  //
+  // Next, `bits` and `Lim` are multiplied with a wide-multiply to bring the
+  // value into the range [0, Lim).  The integral part (the high word of the
+  // multiplication result) is then very nearly the desired result.  However,
+  // this is not quite accurate; viewing the multiplication result as one
+  // double-width integer, the resulting values for the sample are mapped as
+  // follows:
+  //
+  // If the result lies in this interval:       Return this value:
+  //        [0, 2^N)                                    0
+  //        [2^N, 2 * 2^N)                              1
+  //        ...                                         ...
+  //        [K * 2^N, (K + 1) * 2^N)                    K
+  //        ...                                         ...
+  //        [(Lim - 1) * 2^N, Lim * 2^N)                Lim - 1
+  //
+  // While all of these intervals have the same size, the result of `bits * Lim`
+  // must be a multiple of `Lim`, and not all of these intervals contain the
+  // same number of multiples of `Lim`.  In particular, some contain
+  // `F = floor(2^N / Lim)` and some contain `F + 1 = ceil(2^N / Lim)`.  This
+  // difference produces a small nonuniformity, which is corrected by applying
+  // rejection sampling to one of the values in the "larger intervals" (i.e.,
+  // the intervals containing `F + 1` multiples of `Lim`.
+  //
+  // An interval contains `F + 1` multiples of `Lim` if and only if its smallest
+  // value modulo 2^N is less than `2^N % Lim`.  The unique value satisfying
+  // this property is used as the one for rejection.  That is, a value of
+  // `bits * Lim` is rejected if `(bit * Lim) % 2^N < (2^N % Lim)`.
+
+  using helper = random_internal::wide_multiply<unsigned_type>;
+  auto product = helper::multiply(bits, Lim);
+
+  // Two optimizations here:
+  // * Rejection occurs with some probability less than 1/2, and for reasonable
+  //   ranges considerably less (in particular, less than 1/(F+1)), so
+  //   ABSL_PREDICT_FALSE is apt.
+  // * `Lim` is an overestimate of `threshold`, and doesn't require a divide.
+  if (ABSL_PREDICT_FALSE(helper::lo(product) < Lim)) {
+    // This quantity is exactly equal to `2^N % Lim`, but does not require high
+    // precision calculations: `2^N % Lim` is congruent to `(2^N - Lim) % Lim`.
+    // Ideally this could be expressed simply as `-X` rather than `2^N - X`, but
+    // for types smaller than int, this calculation is incorrect due to integer
+    // promotion rules.
+    const unsigned_type threshold =
+        ((std::numeric_limits<unsigned_type>::max)() - Lim + 1) % Lim;
+    while (helper::lo(product) < threshold) {
+      bits = fast_bits(g);
+      product = helper::multiply(bits, Lim);
+    }
+  }
+
+  return helper::hi(product);
+}
+
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_UNIFORM_INT_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/uniform_real_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/uniform_real_distribution.h
new file mode 100644 (file)
index 0000000..600f915
--- /dev/null
@@ -0,0 +1,193 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: uniform_real_distribution.h
+// -----------------------------------------------------------------------------
+//
+// This header defines a class for representing a uniform floating-point
+// distribution over a half-open interval [a,b). You use this distribution in
+// combination with an Abseil random bit generator to produce random values
+// according to the rules of the distribution.
+//
+// `absl::uniform_real_distribution` is a drop-in replacement for the C++11
+// `std::uniform_real_distribution` [rand.dist.uni.real] but is considerably
+// faster than the libstdc++ implementation.
+//
+// Note: the standard-library version may occasionally return `1.0` when
+// default-initialized. See https://bugs.llvm.org//show_bug.cgi?id=18767
+// `absl::uniform_real_distribution` does not exhibit this behavior.
+
+#ifndef ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_
+#define ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_
+
+#include <cassert>
+#include <cmath>
+#include <cstdint>
+#include <istream>
+#include <limits>
+#include <type_traits>
+
+#include "absl/random/internal/distribution_impl.h"
+#include "absl/random/internal/fast_uniform_bits.h"
+#include "absl/random/internal/iostream_state_saver.h"
+
+namespace absl {
+
+// absl::uniform_real_distribution<T>
+//
+// This distribution produces random floating-point values uniformly distributed
+// over the half-open interval [a, b).
+//
+// Example:
+//
+//   absl::BitGen gen;
+//
+//   // Use the distribution to produce a value between 0.0 (inclusive)
+//   // and 1.0 (exclusive).
+//   int value = absl::uniform_real_distribution<double>(0, 1)(gen);
+//
+template <typename RealType = double>
+class uniform_real_distribution {
+ public:
+  using result_type = RealType;
+
+  class param_type {
+   public:
+    using distribution_type = uniform_real_distribution;
+
+    explicit param_type(result_type lo = 0, result_type hi = 1)
+        : lo_(lo), hi_(hi), range_(hi - lo) {
+      // [rand.dist.uni.real] preconditions 2 & 3
+      assert(lo <= hi);
+      // NOTE: For integral types, we can promote the range to an unsigned type,
+      // which gives full width of the range. However for real (fp) types, this
+      // is not possible, so value generation cannot use the full range of the
+      // real type.
+      assert(range_ <= (std::numeric_limits<result_type>::max)());
+    }
+
+    result_type a() const { return lo_; }
+    result_type b() const { return hi_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.lo_ == b.lo_ && a.hi_ == b.hi_;
+    }
+
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class uniform_real_distribution;
+    result_type lo_, hi_, range_;
+
+    static_assert(std::is_floating_point<RealType>::value,
+                  "Class-template absl::uniform_real_distribution<> must be "
+                  "parameterized using a floating-point type.");
+  };
+
+  uniform_real_distribution() : uniform_real_distribution(0) {}
+
+  explicit uniform_real_distribution(result_type lo, result_type hi = 1)
+      : param_(lo, hi) {}
+
+  explicit uniform_real_distribution(const param_type& param) : param_(param) {}
+
+  // uniform_real_distribution<T>::reset()
+  //
+  // Resets the uniform real distribution. Note that this function has no effect
+  // because the distribution already produces independent values.
+  void reset() {}
+
+  template <typename URBG>
+  result_type operator()(URBG& gen) {  // NOLINT(runtime/references)
+    return operator()(gen, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& gen,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  result_type a() const { return param_.a(); }
+  result_type b() const { return param_.b(); }
+
+  param_type param() const { return param_; }
+  void param(const param_type& params) { param_ = params; }
+
+  result_type(min)() const { return a(); }
+  result_type(max)() const { return b(); }
+
+  friend bool operator==(const uniform_real_distribution& a,
+                         const uniform_real_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const uniform_real_distribution& a,
+                         const uniform_real_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  param_type param_;
+  random_internal::FastUniformBits<uint64_t> fast_u64_;
+};
+
+// -----------------------------------------------------------------------------
+// Implementation details follow
+// -----------------------------------------------------------------------------
+template <typename RealType>
+template <typename URBG>
+typename uniform_real_distribution<RealType>::result_type
+uniform_real_distribution<RealType>::operator()(
+    URBG& gen, const param_type& p) {  // NOLINT(runtime/references)
+  using random_internal::PositiveValueT;
+  while (true) {
+    const result_type sample = random_internal::RandU64ToReal<
+        result_type>::template Value<PositiveValueT, true>(fast_u64_(gen));
+    const result_type res = p.a() + (sample * p.range_);
+    if (res < p.b() || p.range_ <= 0 || !std::isfinite(p.range_)) {
+      return res;
+    }
+    // else sample rejected, try again.
+  }
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const uniform_real_distribution<RealType>& x) {
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<RealType>::kPrecision);
+  os << x.a() << os.fill() << x.b();
+  return os;
+}
+
+template <typename CharT, typename Traits, typename RealType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,     // NOLINT(runtime/references)
+    uniform_real_distribution<RealType>& x) {  // NOLINT(runtime/references)
+  using param_type = typename uniform_real_distribution<RealType>::param_type;
+  using result_type = typename uniform_real_distribution<RealType>::result_type;
+  auto saver = random_internal::make_istream_state_saver(is);
+  auto a = random_internal::read_floating_point<result_type>(is);
+  if (is.fail()) return is;
+  auto b = random_internal::read_floating_point<result_type>(is);
+  if (!is.fail()) {
+    x.param(param_type(a, b));
+  }
+  return is;
+}
+}  // namespace absl
+
+#endif  // ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/zipf_distribution.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/random/zipf_distribution.h
new file mode 100644 (file)
index 0000000..1e4dba8
--- /dev/null
@@ -0,0 +1,269 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_RANDOM_ZIPF_DISTRIBUTION_H_
+#define ABSL_RANDOM_ZIPF_DISTRIBUTION_H_
+
+#include <cassert>
+#include <cmath>
+#include <istream>
+#include <limits>
+#include <ostream>
+#include <type_traits>
+
+#include "absl/random/internal/iostream_state_saver.h"
+#include "absl/random/uniform_real_distribution.h"
+
+namespace absl {
+
+// absl::zipf_distribution produces random integer-values in the range [0, k],
+// distributed according to the discrete probability function:
+//
+//  P(x) = (v + x) ^ -q
+//
+// The parameter `v` must be greater than 0 and the parameter `q` must be
+// greater than 1. If either of these parameters take invalid values then the
+// behavior is undefined.
+//
+// IntType is the result_type generated by the generator. It must be of integral
+// type; a static_assert ensures this is the case.
+//
+// The implementation is based on W.Hormann, G.Derflinger:
+//
+// "Rejection-Inversion to Generate Variates from Monotone Discrete
+// Distributions"
+//
+// http://eeyore.wu-wien.ac.at/papers/96-04-04.wh-der.ps.gz
+//
+template <typename IntType = int>
+class zipf_distribution {
+ public:
+  using result_type = IntType;
+
+  class param_type {
+   public:
+    using distribution_type = zipf_distribution;
+
+    // Preconditions: k > 0, v > 0, q > 1
+    // The precondidtions are validated when NDEBUG is not defined via
+    // a pair of assert() directives.
+    // If NDEBUG is defined and either or both of these parameters take invalid
+    // values, the behavior of the class is undefined.
+    explicit param_type(result_type k = (std::numeric_limits<IntType>::max)(),
+                        double q = 2.0, double v = 1.0);
+
+    result_type k() const { return k_; }
+    double q() const { return q_; }
+    double v() const { return v_; }
+
+    friend bool operator==(const param_type& a, const param_type& b) {
+      return a.k_ == b.k_ && a.q_ == b.q_ && a.v_ == b.v_;
+    }
+    friend bool operator!=(const param_type& a, const param_type& b) {
+      return !(a == b);
+    }
+
+   private:
+    friend class zipf_distribution;
+    inline double h(double x) const;
+    inline double hinv(double x) const;
+    inline double compute_s() const;
+    inline double pow_negative_q(double x) const;
+
+    // Parameters here are exactly the same as the parameters of Algorithm ZRI
+    // in the paper.
+    IntType k_;
+    double q_;
+    double v_;
+
+    double one_minus_q_;  // 1-q
+    double s_;
+    double one_minus_q_inv_;  // 1 / 1-q
+    double hxm_;              // h(k + 0.5)
+    double hx0_minus_hxm_;    // h(x0) - h(k + 0.5)
+
+    static_assert(std::is_integral<IntType>::value,
+                  "Class-template absl::zipf_distribution<> must be "
+                  "parameterized using an integral type.");
+  };
+
+  zipf_distribution()
+      : zipf_distribution((std::numeric_limits<IntType>::max)()) {}
+
+  explicit zipf_distribution(result_type k, double q = 2.0, double v = 1.0)
+      : param_(k, q, v) {}
+
+  explicit zipf_distribution(const param_type& p) : param_(p) {}
+
+  void reset() {}
+
+  template <typename URBG>
+  result_type operator()(URBG& g) {  // NOLINT(runtime/references)
+    return (*this)(g, param_);
+  }
+
+  template <typename URBG>
+  result_type operator()(URBG& g,  // NOLINT(runtime/references)
+                         const param_type& p);
+
+  result_type k() const { return param_.k(); }
+  double q() const { return param_.q(); }
+  double v() const { return param_.v(); }
+
+  param_type param() const { return param_; }
+  void param(const param_type& p) { param_ = p; }
+
+  result_type(min)() const { return 0; }
+  result_type(max)() const { return k(); }
+
+  friend bool operator==(const zipf_distribution& a,
+                         const zipf_distribution& b) {
+    return a.param_ == b.param_;
+  }
+  friend bool operator!=(const zipf_distribution& a,
+                         const zipf_distribution& b) {
+    return a.param_ != b.param_;
+  }
+
+ private:
+  param_type param_;
+};
+
+// --------------------------------------------------------------------------
+// Implementation details follow
+// --------------------------------------------------------------------------
+
+template <typename IntType>
+zipf_distribution<IntType>::param_type::param_type(
+    typename zipf_distribution<IntType>::result_type k, double q, double v)
+    : k_(k), q_(q), v_(v), one_minus_q_(1 - q) {
+  assert(q > 1);
+  assert(v > 0);
+  assert(k > 0);
+  one_minus_q_inv_ = 1 / one_minus_q_;
+
+  // Setup for the ZRI algorithm (pg 17 of the paper).
+  // Compute: h(i max) => h(k + 0.5)
+  constexpr double kMax = 18446744073709549568.0;
+  double kd = static_cast<double>(k);
+  // TODO(absl-team): Determine if this check is needed, and if so, add a test
+  // that fails for k > kMax
+  if (kd > kMax) {
+    // Ensure that our maximum value is capped to a value which will
+    // round-trip back through double.
+    kd = kMax;
+  }
+  hxm_ = h(kd + 0.5);
+
+  // Compute: h(0)
+  const bool use_precomputed = (v == 1.0 && q == 2.0);
+  const double h0x5 = use_precomputed ? (-1.0 / 1.5)  // exp(-log(1.5))
+                                      : h(0.5);
+  const double elogv_q = (v_ == 1.0) ? 1 : pow_negative_q(v_);
+
+  // h(0) = h(0.5) - exp(log(v) * -q)
+  hx0_minus_hxm_ = (h0x5 - elogv_q) - hxm_;
+
+  // And s
+  s_ = use_precomputed ? 0.46153846153846123 : compute_s();
+}
+
+template <typename IntType>
+double zipf_distribution<IntType>::param_type::h(double x) const {
+  // std::exp(one_minus_q_ * std::log(v_ + x)) * one_minus_q_inv_;
+  x += v_;
+  return (one_minus_q_ == -1.0)
+             ? (-1.0 / x)  // -exp(-log(x))
+             : (std::exp(std::log(x) * one_minus_q_) * one_minus_q_inv_);
+}
+
+template <typename IntType>
+double zipf_distribution<IntType>::param_type::hinv(double x) const {
+  // std::exp(one_minus_q_inv_ * std::log(one_minus_q_ * x)) - v_;
+  return -v_ + ((one_minus_q_ == -1.0)
+                    ? (-1.0 / x)  // exp(-log(-x))
+                    : std::exp(one_minus_q_inv_ * std::log(one_minus_q_ * x)));
+}
+
+template <typename IntType>
+double zipf_distribution<IntType>::param_type::compute_s() const {
+  // 1 - hinv(h(1.5) - std::exp(std::log(v_ + 1) * -q_));
+  return 1.0 - hinv(h(1.5) - pow_negative_q(v_ + 1.0));
+}
+
+template <typename IntType>
+double zipf_distribution<IntType>::param_type::pow_negative_q(double x) const {
+  // std::exp(std::log(x) * -q_);
+  return q_ == 2.0 ? (1.0 / (x * x)) : std::exp(std::log(x) * -q_);
+}
+
+template <typename IntType>
+template <typename URBG>
+typename zipf_distribution<IntType>::result_type
+zipf_distribution<IntType>::operator()(
+    URBG& g, const param_type& p) {  // NOLINT(runtime/references)
+  absl::uniform_real_distribution<double> uniform_double;
+  double k;
+  for (;;) {
+    const double v = uniform_double(g);
+    const double u = p.hxm_ + v * p.hx0_minus_hxm_;
+    const double x = p.hinv(u);
+    k = rint(x);              // std::floor(x + 0.5);
+    if (k > p.k()) continue;  // reject k > max_k
+    if (k - x <= p.s_) break;
+    const double h = p.h(k + 0.5);
+    const double r = p.pow_negative_q(p.v_ + k);
+    if (u >= h - r) break;
+  }
+  IntType ki = static_cast<IntType>(k);
+  assert(ki <= p.k_);
+  return ki;
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_ostream<CharT, Traits>& operator<<(
+    std::basic_ostream<CharT, Traits>& os,  // NOLINT(runtime/references)
+    const zipf_distribution<IntType>& x) {
+  using stream_type =
+      typename random_internal::stream_format_type<IntType>::type;
+  auto saver = random_internal::make_ostream_state_saver(os);
+  os.precision(random_internal::stream_precision_helper<double>::kPrecision);
+  os << static_cast<stream_type>(x.k()) << os.fill() << x.q() << os.fill()
+     << x.v();
+  return os;
+}
+
+template <typename CharT, typename Traits, typename IntType>
+std::basic_istream<CharT, Traits>& operator>>(
+    std::basic_istream<CharT, Traits>& is,  // NOLINT(runtime/references)
+    zipf_distribution<IntType>& x) {        // NOLINT(runtime/references)
+  using result_type = typename zipf_distribution<IntType>::result_type;
+  using param_type = typename zipf_distribution<IntType>::param_type;
+  using stream_type =
+      typename random_internal::stream_format_type<IntType>::type;
+  stream_type k;
+  double q;
+  double v;
+
+  auto saver = random_internal::make_istream_state_saver(is);
+  is >> k >> q >> v;
+  if (!is.fail()) {
+    x.param(param_type(static_cast<result_type>(k), q, v));
+  }
+  return is;
+}
+
+}  // namespace absl.
+
+#endif  // ABSL_RANDOM_ZIPF_DISTRIBUTION_H_
index fc2bb33..f9e4fd1 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -34,7 +34,7 @@
 // `ascii_iscntrl()`, `ascii_isdigit()`, `ascii_isgraph()`, `ascii_islower()`,
 // `ascii_isprint()`, `ascii_ispunct()`, `ascii_isspace()`, `ascii_isupper()`,
 // `ascii_isxdigit()`
-//   Analagous to the <ctype.h> functions with similar names, these
+//   Analogous to the <ctype.h> functions with similar names, these
 //   functions take an unsigned char and return a bool, based on whether the
 //   character matches the condition specified.
 //
@@ -42,7 +42,7 @@
 //   functions return `false`.
 //
 // `ascii_tolower()`, `ascii_toupper()`
-//   Analagous to the <ctype.h> functions with similar names, these functions
+//   Analogous to the <ctype.h> functions with similar names, these functions
 //   take an unsigned char and return a char.
 //
 //   If the input character is not an ASCII {lower,upper}-case letter (including
@@ -165,7 +165,7 @@ inline char ascii_tolower(unsigned char c) {
 // Converts the characters in `s` to lowercase, changing the contents of `s`.
 void AsciiStrToLower(std::string* s);
 
-// Creates a lowercase std::string from a given absl::string_view.
+// Creates a lowercase string from a given absl::string_view.
 ABSL_MUST_USE_RESULT inline std::string AsciiStrToLower(absl::string_view s) {
   std::string result(s);
   absl::AsciiStrToLower(&result);
@@ -183,7 +183,7 @@ inline char ascii_toupper(unsigned char c) {
 // Converts the characters in `s` to uppercase, changing the contents of `s`.
 void AsciiStrToUpper(std::string* s);
 
-// Creates an uppercase std::string from a given absl::string_view.
+// Creates an uppercase string from a given absl::string_view.
 ABSL_MUST_USE_RESULT inline std::string AsciiStrToUpper(absl::string_view s) {
   std::string result(s);
   absl::AsciiStrToUpper(&result);
@@ -195,10 +195,10 @@ ABSL_MUST_USE_RESULT inline std::string AsciiStrToUpper(absl::string_view s) {
 ABSL_MUST_USE_RESULT inline absl::string_view StripLeadingAsciiWhitespace(
     absl::string_view str) {
   auto it = std::find_if_not(str.begin(), str.end(), absl::ascii_isspace);
-  return absl::string_view(it, str.end() - it);
+  return str.substr(it - str.begin());
 }
 
-// Strips in place whitespace from the beginning of the given std::string.
+// Strips in place whitespace from the beginning of the given string.
 inline void StripLeadingAsciiWhitespace(std::string* str) {
   auto it = std::find_if_not(str->begin(), str->end(), absl::ascii_isspace);
   str->erase(str->begin(), it);
@@ -209,10 +209,10 @@ inline void StripLeadingAsciiWhitespace(std::string* str) {
 ABSL_MUST_USE_RESULT inline absl::string_view StripTrailingAsciiWhitespace(
     absl::string_view str) {
   auto it = std::find_if_not(str.rbegin(), str.rend(), absl::ascii_isspace);
-  return absl::string_view(str.begin(), str.rend() - it);
+  return str.substr(0, str.rend() - it);
 }
 
-// Strips in place whitespace from the end of the given std::string
+// Strips in place whitespace from the end of the given string
 inline void StripTrailingAsciiWhitespace(std::string* str) {
   auto it = std::find_if_not(str->rbegin(), str->rend(), absl::ascii_isspace);
   str->erase(str->rend() - it);
@@ -225,7 +225,7 @@ ABSL_MUST_USE_RESULT inline absl::string_view StripAsciiWhitespace(
   return StripTrailingAsciiWhitespace(StripLeadingAsciiWhitespace(str));
 }
 
-// Strips in place whitespace from both ends of the given std::string
+// Strips in place whitespace from both ends of the given string
 inline void StripAsciiWhitespace(std::string* str) {
   StripTrailingAsciiWhitespace(str);
   StripLeadingAsciiWhitespace(str);
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/ascii_ctype.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/ascii_ctype.h
deleted file mode 100644 (file)
index e1ba9e2..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2017 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef ABSL_STRINGS_ASCII_CTYPE_H_
-#define ABSL_STRINGS_ASCII_CTYPE_H_
-
-#include "absl/strings/ascii.h"
-
-inline bool ascii_isalpha(unsigned char c) {
-  return absl::ascii_isalpha(c);
-}
-inline bool ascii_isalnum(unsigned char c) {
-  return absl::ascii_isalnum(c);
-}
-inline bool ascii_isspace(unsigned char c) {
-  return absl::ascii_isspace(c);
-}
-inline bool ascii_ispunct(unsigned char c) {
-  return absl::ascii_ispunct(c);
-}
-inline bool ascii_isblank(unsigned char c) {
-  return absl::ascii_isblank(c);
-}
-inline bool ascii_iscntrl(unsigned char c) {
-  return absl::ascii_iscntrl(c);
-}
-inline bool ascii_isxdigit(unsigned char c) {
-  return absl::ascii_isxdigit(c);
-}
-inline bool ascii_isdigit(unsigned char c) {
-  return absl::ascii_isdigit(c);
-}
-inline bool ascii_isprint(unsigned char c) {
-  return absl::ascii_isprint(c);
-}
-inline bool ascii_isgraph(unsigned char c) {
-  return absl::ascii_isgraph(c);
-}
-inline bool ascii_isupper(unsigned char c) {
-  return absl::ascii_isupper(c);
-}
-inline bool ascii_islower(unsigned char c) {
-  return absl::ascii_islower(c);
-}
-inline bool ascii_isascii(unsigned char c) {
-  return absl::ascii_isascii(c);
-}
-inline char ascii_tolower(unsigned char c) {
-  return absl::ascii_tolower(c);
-}
-inline char ascii_toupper(unsigned char c) {
-  return absl::ascii_toupper(c);
-}
-
-#endif  // ABSL_STRINGS_ASCII_CTYPE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/charconv.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/charconv.h
new file mode 100644 (file)
index 0000000..3f5891b
--- /dev/null
@@ -0,0 +1,115 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_STRINGS_CHARCONV_H_
+#define ABSL_STRINGS_CHARCONV_H_
+
+#include <system_error>  // NOLINT(build/c++11)
+
+namespace absl {
+
+// Workalike compatibilty version of std::chars_format from C++17.
+//
+// This is an bitfield enumerator which can be passed to absl::from_chars to
+// configure the string-to-float conversion.
+enum class chars_format {
+  scientific = 1,
+  fixed = 2,
+  hex = 4,
+  general = fixed | scientific,
+};
+
+// The return result of a string-to-number conversion.
+//
+// `ec` will be set to `invalid_argument` if a well-formed number was not found
+// at the start of the input range, `result_out_of_range` if a well-formed
+// number was found, but it was out of the representable range of the requested
+// type, or to std::errc() otherwise.
+//
+// If a well-formed number was found, `ptr` is set to one past the sequence of
+// characters that were successfully parsed.  If none was found, `ptr` is set
+// to the `first` argument to from_chars.
+struct from_chars_result {
+  const char* ptr;
+  std::errc ec;
+};
+
+// Workalike compatibilty version of std::from_chars from C++17.  Currently
+// this only supports the `double` and `float` types.
+//
+// This interface incorporates the proposed resolutions for library issues
+// DR 3080 and DR 3081.  If these are adopted with different wording,
+// Abseil's behavior will change to match the standard.  (The behavior most
+// likely to change is for DR 3081, which says what `value` will be set to in
+// the case of overflow and underflow.  Code that wants to avoid possible
+// breaking changes in this area should not depend on `value` when the returned
+// from_chars_result indicates a range error.)
+//
+// Searches the range [first, last) for the longest matching pattern beginning
+// at `first` that represents a floating point number.  If one is found, store
+// the result in `value`.
+//
+// The matching pattern format is almost the same as that of strtod(), except
+// that C locale is not respected, and an initial '+' character in the input
+// range will never be matched.
+//
+// If `fmt` is set, it must be one of the enumerator values of the chars_format.
+// (This is despite the fact that chars_format is a bitmask type.)  If set to
+// `scientific`, a matching number must contain an exponent.  If set to `fixed`,
+// then an exponent will never match.  (For example, the string "1e5" will be
+// parsed as "1".)  If set to `hex`, then a hexadecimal float is parsed in the
+// format that strtod() accepts, except that a "0x" prefix is NOT matched.
+// (In particular, in `hex` mode, the input "0xff" results in the largest
+// matching pattern "0".)
+absl::from_chars_result from_chars(const char* first, const char* last,
+                                   double& value,  // NOLINT
+                                   chars_format fmt = chars_format::general);
+
+absl::from_chars_result from_chars(const char* first, const char* last,
+                                   float& value,  // NOLINT
+                                   chars_format fmt = chars_format::general);
+
+// std::chars_format is specified as a bitmask type, which means the following
+// operations must be provided:
+inline constexpr chars_format operator&(chars_format lhs, chars_format rhs) {
+  return static_cast<chars_format>(static_cast<int>(lhs) &
+                                   static_cast<int>(rhs));
+}
+inline constexpr chars_format operator|(chars_format lhs, chars_format rhs) {
+  return static_cast<chars_format>(static_cast<int>(lhs) |
+                                   static_cast<int>(rhs));
+}
+inline constexpr chars_format operator^(chars_format lhs, chars_format rhs) {
+  return static_cast<chars_format>(static_cast<int>(lhs) ^
+                                   static_cast<int>(rhs));
+}
+inline constexpr chars_format operator~(chars_format arg) {
+  return static_cast<chars_format>(~static_cast<int>(arg));
+}
+inline chars_format& operator&=(chars_format& lhs, chars_format rhs) {
+  lhs = lhs & rhs;
+  return lhs;
+}
+inline chars_format& operator|=(chars_format& lhs, chars_format rhs) {
+  lhs = lhs | rhs;
+  return lhs;
+}
+inline chars_format& operator^=(chars_format& lhs, chars_format rhs) {
+  lhs = lhs ^ rhs;
+  return lhs;
+}
+
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_CHARCONV_H_
index 05327e7..198b934 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,9 +17,8 @@
 // File: escaping.h
 // -----------------------------------------------------------------------------
 //
-// This header file contains std::string utilities involved in escaping and
+// This header file contains string utilities involved in escaping and
 // unescaping strings in various ways.
-//
 
 #ifndef ABSL_STRINGS_ESCAPING_H_
 #define ABSL_STRINGS_ESCAPING_H_
@@ -37,8 +36,8 @@ namespace absl {
 
 // CUnescape()
 //
-// Unescapes a `source` std::string and copies it into `dest`, rewriting C-style
-// escape sequences (http://en.cppreference.com/w/cpp/language/escape) into
+// Unescapes a `source` string and copies it into `dest`, rewriting C-style
+// escape sequences (https://en.cppreference.com/w/cpp/language/escape) into
 // their proper code point equivalents, returning `true` if successful.
 //
 // The following unescape sequences can be handled:
@@ -56,15 +55,18 @@ namespace absl {
 //     UTF-8. (E.g., `\u2019` unescapes to the three bytes 0xE2, 0x80, and
 //     0x99).
 //
-//
-// If any errors are encountered, this function returns `false` and stores the
-// first encountered error in `error`. To disable error reporting, set `error`
-// to `nullptr` or use the overload with no error reporting below.
+// If any errors are encountered, this function returns `false`, leaving the
+// `dest` output parameter in an unspecified state, and stores the first
+// encountered error in `error`. To disable error reporting, set `error` to
+// `nullptr` or use the overload with no error reporting below.
 //
 // Example:
 //
 //   std::string s = "foo\\rbar\\nbaz\\t";
-//   std::string unescaped_s = absl::CUnescape(s);
+//   std::string unescaped_s;
+//   if (!absl::CUnescape(s, &unescaped_s) {
+//     ...
+//   }
 //   EXPECT_EQ(unescaped_s, "foo\rbar\nbaz\t");
 bool CUnescape(absl::string_view source, std::string* dest, std::string* error);
 
@@ -75,8 +77,8 @@ inline bool CUnescape(absl::string_view source, std::string* dest) {
 
 // CEscape()
 //
-// Escapes a 'src' std::string using C-style escapes sequences
-// (http://en.cppreference.com/w/cpp/language/escape), escaping other
+// Escapes a 'src' string using C-style escapes sequences
+// (https://en.cppreference.com/w/cpp/language/escape), escaping other
 // non-printable/non-whitespace bytes as octal sequences (e.g. "\377").
 //
 // Example:
@@ -88,7 +90,7 @@ std::string CEscape(absl::string_view src);
 
 // CHexEscape()
 //
-// Escapes a 'src' std::string using C-style escape sequences, escaping
+// Escapes a 'src' string using C-style escape sequences, escaping
 // other non-printable/non-whitespace bytes as hexadecimal sequences (e.g.
 // "\xFF").
 //
@@ -101,7 +103,7 @@ std::string CHexEscape(absl::string_view src);
 
 // Utf8SafeCEscape()
 //
-// Escapes a 'src' std::string using C-style escape sequences, escaping bytes as
+// Escapes a 'src' string using C-style escape sequences, escaping bytes as
 // octal sequences, and passing through UTF-8 characters without conversion.
 // I.e., when encountering any bytes with their high bit set, this function
 // will not escape those values, whether or not they are valid UTF-8.
@@ -109,47 +111,49 @@ std::string Utf8SafeCEscape(absl::string_view src);
 
 // Utf8SafeCHexEscape()
 //
-// Escapes a 'src' std::string using C-style escape sequences, escaping bytes as
-// hexidecimal sequences, and passing through UTF-8 characters without
+// Escapes a 'src' string using C-style escape sequences, escaping bytes as
+// hexadecimal sequences, and passing through UTF-8 characters without
 // conversion.
 std::string Utf8SafeCHexEscape(absl::string_view src);
 
 // Base64Unescape()
 //
-// Converts a `src` std::string encoded in Base64 to its binary equivalent, writing
+// Converts a `src` string encoded in Base64 to its binary equivalent, writing
 // it to a `dest` buffer, returning `true` on success. If `src` contains invalid
 // characters, `dest` is cleared and returns `false`.
 bool Base64Unescape(absl::string_view src, std::string* dest);
 
-// WebSafeBase64Unescape(absl::string_view, std::string*)
+// WebSafeBase64Unescape()
 //
-// Converts a `src` std::string encoded in Base64 to its binary equivalent, writing
+// Converts a `src` string encoded in Base64 to its binary equivalent, writing
 // it to a `dest` buffer, but using '-' instead of '+', and '_' instead of '/'.
 // If `src` contains invalid characters, `dest` is cleared and returns `false`.
 bool WebSafeBase64Unescape(absl::string_view src, std::string* dest);
 
 // Base64Escape()
 //
-// Encodes a `src` std::string into a `dest` buffer using base64 encoding, with
-// padding characters. This function conforms with RFC 4648 section 4 (base64).
+// Encodes a `src` string into a base64-encoded string, with padding characters.
+// This function conforms with RFC 4648 section 4 (base64).
 void Base64Escape(absl::string_view src, std::string* dest);
+std::string Base64Escape(absl::string_view src);
 
 // WebSafeBase64Escape()
 //
-// Encodes a `src` std::string into a `dest` buffer using uses '-' instead of '+' and
-// '_' instead of '/', and without padding. This function conforms with RFC 4648
-// section 5 (base64url).
+// Encodes a `src` string into a base64-like string, using '-' instead of '+'
+// and '_' instead of '/', and without padding. This function conforms with RFC
+// 4648 section 5 (base64url).
 void WebSafeBase64Escape(absl::string_view src, std::string* dest);
+std::string WebSafeBase64Escape(absl::string_view src);
 
 // HexStringToBytes()
 //
-// Converts an ASCII hex std::string into bytes, returning binary data of length
+// Converts an ASCII hex string into bytes, returning binary data of length
 // `from.size()/2`.
 std::string HexStringToBytes(absl::string_view from);
 
 // BytesToHexString()
 //
-// Converts binary data into an ASCII text std::string, returing a std::string of size
+// Converts binary data into an ASCII text string, returning a string of size
 // `2*from.size()`.
 std::string BytesToHexString(absl::string_view from);
 
index 8d92963..b9108b8 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h
new file mode 100644 (file)
index 0000000..7da9a7e
--- /dev/null
@@ -0,0 +1,419 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_
+#define ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_
+
+#include <algorithm>
+#include <cstdint>
+#include <iostream>
+#include <string>
+
+#include "absl/strings/ascii.h"
+#include "absl/strings/internal/charconv_parse.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace strings_internal {
+
+// The largest power that 5 that can be raised to, and still fit in a uint32_t.
+constexpr int kMaxSmallPowerOfFive = 13;
+// The largest power that 10 that can be raised to, and still fit in a uint32_t.
+constexpr int kMaxSmallPowerOfTen = 9;
+
+extern const uint32_t kFiveToNth[kMaxSmallPowerOfFive + 1];
+extern const uint32_t kTenToNth[kMaxSmallPowerOfTen + 1];
+
+// Large, fixed-width unsigned integer.
+//
+// Exact rounding for decimal-to-binary floating point conversion requires very
+// large integer math, but a design goal of absl::from_chars is to avoid
+// allocating memory.  The integer precision needed for decimal-to-binary
+// conversions is large but bounded, so a huge fixed-width integer class
+// suffices.
+//
+// This is an intentionally limited big integer class.  Only needed operations
+// are implemented.  All storage lives in an array data member, and all
+// arithmetic is done in-place, to avoid requiring separate storage for operand
+// and result.
+//
+// This is an internal class.  Some methods live in the .cc file, and are
+// instantiated only for the values of max_words we need.
+template <int max_words>
+class BigUnsigned {
+ public:
+  static_assert(max_words == 4 || max_words == 84,
+                "unsupported max_words value");
+
+  BigUnsigned() : size_(0), words_{} {}
+  explicit constexpr BigUnsigned(uint64_t v)
+      : size_((v >> 32) ? 2 : v ? 1 : 0),
+        words_{static_cast<uint32_t>(v & 0xffffffffu),
+               static_cast<uint32_t>(v >> 32)} {}
+
+  // Constructs a BigUnsigned from the given string_view containing a decimal
+  // value.  If the input std::string is not a decimal integer, constructs a 0
+  // instead.
+  explicit BigUnsigned(absl::string_view sv) : size_(0), words_{} {
+    // Check for valid input, returning a 0 otherwise.  This is reasonable
+    // behavior only because this constructor is for unit tests.
+    if (std::find_if_not(sv.begin(), sv.end(), ascii_isdigit) != sv.end() ||
+        sv.empty()) {
+      return;
+    }
+    int exponent_adjust =
+        ReadDigits(sv.data(), sv.data() + sv.size(), Digits10() + 1);
+    if (exponent_adjust > 0) {
+      MultiplyByTenToTheNth(exponent_adjust);
+    }
+  }
+
+  // Loads the mantissa value of a previously-parsed float.
+  //
+  // Returns the associated decimal exponent.  The value of the parsed float is
+  // exactly *this * 10**exponent.
+  int ReadFloatMantissa(const ParsedFloat& fp, int significant_digits);
+
+  // Returns the number of decimal digits of precision this type provides.  All
+  // numbers with this many decimal digits or fewer are representable by this
+  // type.
+  //
+  // Analagous to std::numeric_limits<BigUnsigned>::digits10.
+  static constexpr int Digits10() {
+    // 9975007/1035508 is very slightly less than log10(2**32).
+    return static_cast<uint64_t>(max_words) * 9975007 / 1035508;
+  }
+
+  // Shifts left by the given number of bits.
+  void ShiftLeft(int count) {
+    if (count > 0) {
+      const int word_shift = count / 32;
+      if (word_shift >= max_words) {
+        SetToZero();
+        return;
+      }
+      size_ = (std::min)(size_ + word_shift, max_words);
+      count %= 32;
+      if (count == 0) {
+        std::copy_backward(words_, words_ + size_ - word_shift, words_ + size_);
+      } else {
+        for (int i = (std::min)(size_, max_words - 1); i > word_shift; --i) {
+          words_[i] = (words_[i - word_shift] << count) |
+                      (words_[i - word_shift - 1] >> (32 - count));
+        }
+        words_[word_shift] = words_[0] << count;
+        // Grow size_ if necessary.
+        if (size_ < max_words && words_[size_]) {
+          ++size_;
+        }
+      }
+      std::fill(words_, words_ + word_shift, 0u);
+    }
+  }
+
+
+  // Multiplies by v in-place.
+  void MultiplyBy(uint32_t v) {
+    if (size_ == 0 || v == 1) {
+      return;
+    }
+    if (v == 0) {
+      SetToZero();
+      return;
+    }
+    const uint64_t factor = v;
+    uint64_t window = 0;
+    for (int i = 0; i < size_; ++i) {
+      window += factor * words_[i];
+      words_[i] = window & 0xffffffff;
+      window >>= 32;
+    }
+    // If carry bits remain and there's space for them, grow size_.
+    if (window && size_ < max_words) {
+      words_[size_] = window & 0xffffffff;
+      ++size_;
+    }
+  }
+
+  void MultiplyBy(uint64_t v) {
+    uint32_t words[2];
+    words[0] = static_cast<uint32_t>(v);
+    words[1] = static_cast<uint32_t>(v >> 32);
+    if (words[1] == 0) {
+      MultiplyBy(words[0]);
+    } else {
+      MultiplyBy(2, words);
+    }
+  }
+
+  // Multiplies in place by 5 to the power of n.  n must be non-negative.
+  void MultiplyByFiveToTheNth(int n) {
+    while (n >= kMaxSmallPowerOfFive) {
+      MultiplyBy(kFiveToNth[kMaxSmallPowerOfFive]);
+      n -= kMaxSmallPowerOfFive;
+    }
+    if (n > 0) {
+      MultiplyBy(kFiveToNth[n]);
+    }
+  }
+
+  // Multiplies in place by 10 to the power of n.  n must be non-negative.
+  void MultiplyByTenToTheNth(int n) {
+    if (n > kMaxSmallPowerOfTen) {
+      // For large n, raise to a power of 5, then shift left by the same amount.
+      // (10**n == 5**n * 2**n.)  This requires fewer multiplications overall.
+      MultiplyByFiveToTheNth(n);
+      ShiftLeft(n);
+    } else if (n > 0) {
+      // We can do this more quickly for very small N by using a single
+      // multiplication.
+      MultiplyBy(kTenToNth[n]);
+    }
+  }
+
+  // Returns the value of 5**n, for non-negative n.  This implementation uses
+  // a lookup table, and is faster then seeding a BigUnsigned with 1 and calling
+  // MultiplyByFiveToTheNth().
+  static BigUnsigned FiveToTheNth(int n);
+
+  // Multiplies by another BigUnsigned, in-place.
+  template <int M>
+  void MultiplyBy(const BigUnsigned<M>& other) {
+    MultiplyBy(other.size(), other.words());
+  }
+
+  void SetToZero() {
+    std::fill(words_, words_ + size_, 0u);
+    size_ = 0;
+  }
+
+  // Returns the value of the nth word of this BigUnsigned.  This is
+  // range-checked, and returns 0 on out-of-bounds accesses.
+  uint32_t GetWord(int index) const {
+    if (index < 0 || index >= size_) {
+      return 0;
+    }
+    return words_[index];
+  }
+
+  // Returns this integer as a decimal std::string.  This is not used in the decimal-
+  // to-binary conversion; it is intended to aid in testing.
+  std::string ToString() const;
+
+  int size() const { return size_; }
+  const uint32_t* words() const { return words_; }
+
+ private:
+  // Reads the number between [begin, end), possibly containing a decimal point,
+  // into this BigUnsigned.
+  //
+  // Callers are required to ensure [begin, end) contains a valid number, with
+  // one or more decimal digits and at most one decimal point.  This routine
+  // will behave unpredictably if these preconditions are not met.
+  //
+  // Only the first `significant_digits` digits are read.  Digits beyond this
+  // limit are "sticky": If the final significant digit is 0 or 5, and if any
+  // dropped digit is nonzero, then that final significant digit is adjusted up
+  // to 1 or 6.  This adjustment allows for precise rounding.
+  //
+  // Returns `exponent_adjustment`, a power-of-ten exponent adjustment to
+  // account for the decimal point and for dropped significant digits.  After
+  // this function returns,
+  //   actual_value_of_parsed_string ~= *this * 10**exponent_adjustment.
+  int ReadDigits(const char* begin, const char* end, int significant_digits);
+
+  // Performs a step of big integer multiplication.  This computes the full
+  // (64-bit-wide) values that should be added at the given index (step), and
+  // adds to that location in-place.
+  //
+  // Because our math all occurs in place, we must multiply starting from the
+  // highest word working downward.  (This is a bit more expensive due to the
+  // extra carries involved.)
+  //
+  // This must be called in steps, for each word to be calculated, starting from
+  // the high end and working down to 0.  The first value of `step` should be
+  //   `std::min(original_size + other.size_ - 2, max_words - 1)`.
+  // The reason for this expression is that multiplying the i'th word from one
+  // multiplicand and the j'th word of another multiplicand creates a
+  // two-word-wide value to be stored at the (i+j)'th element.  The highest
+  // word indices we will access are `original_size - 1` from this object, and
+  // `other.size_ - 1` from our operand.  Therefore,
+  // `original_size + other.size_ - 2` is the first step we should calculate,
+  // but limited on an upper bound by max_words.
+
+  // Working from high-to-low ensures that we do not overwrite the portions of
+  // the initial value of *this which are still needed for later steps.
+  //
+  // Once called with step == 0, *this contains the result of the
+  // multiplication.
+  //
+  // `original_size` is the size_ of *this before the first call to
+  // MultiplyStep().  `other_words` and `other_size` are the contents of our
+  // operand.  `step` is the step to perform, as described above.
+  void MultiplyStep(int original_size, const uint32_t* other_words,
+                    int other_size, int step);
+
+  void MultiplyBy(int other_size, const uint32_t* other_words) {
+    const int original_size = size_;
+    const int first_step =
+        (std::min)(original_size + other_size - 2, max_words - 1);
+    for (int step = first_step; step >= 0; --step) {
+      MultiplyStep(original_size, other_words, other_size, step);
+    }
+  }
+
+  // Adds a 32-bit value to the index'th word, with carry.
+  void AddWithCarry(int index, uint32_t value) {
+    if (value) {
+      while (index < max_words && value > 0) {
+        words_[index] += value;
+        // carry if we overflowed in this word:
+        if (value > words_[index]) {
+          value = 1;
+          ++index;
+        } else {
+          value = 0;
+        }
+      }
+      size_ = (std::min)(max_words, (std::max)(index + 1, size_));
+    }
+  }
+
+  void AddWithCarry(int index, uint64_t value) {
+    if (value && index < max_words) {
+      uint32_t high = value >> 32;
+      uint32_t low = value & 0xffffffff;
+      words_[index] += low;
+      if (words_[index] < low) {
+        ++high;
+        if (high == 0) {
+          // Carry from the low word caused our high word to overflow.
+          // Short circuit here to do the right thing.
+          AddWithCarry(index + 2, static_cast<uint32_t>(1));
+          return;
+        }
+      }
+      if (high > 0) {
+        AddWithCarry(index + 1, high);
+      } else {
+        // Normally 32-bit AddWithCarry() sets size_, but since we don't call
+        // it when `high` is 0, do it ourselves here.
+        size_ = (std::min)(max_words, (std::max)(index + 1, size_));
+      }
+    }
+  }
+
+  // Divide this in place by a constant divisor.  Returns the remainder of the
+  // division.
+  template <uint32_t divisor>
+  uint32_t DivMod() {
+    uint64_t accumulator = 0;
+    for (int i = size_ - 1; i >= 0; --i) {
+      accumulator <<= 32;
+      accumulator += words_[i];
+      // accumulator / divisor will never overflow an int32_t in this loop
+      words_[i] = static_cast<uint32_t>(accumulator / divisor);
+      accumulator = accumulator % divisor;
+    }
+    while (size_ > 0 && words_[size_ - 1] == 0) {
+      --size_;
+    }
+    return static_cast<uint32_t>(accumulator);
+  }
+
+  // The number of elements in words_ that may carry significant values.
+  // All elements beyond this point are 0.
+  //
+  // When size_ is 0, this BigUnsigned stores the value 0.
+  // When size_ is nonzero, is *not* guaranteed that words_[size_ - 1] is
+  // nonzero.  This can occur due to overflow truncation.
+  // In particular, x.size_ != y.size_ does *not* imply x != y.
+  int size_;
+  uint32_t words_[max_words];
+};
+
+// Compares two big integer instances.
+//
+// Returns -1 if lhs < rhs, 0 if lhs == rhs, and 1 if lhs > rhs.
+template <int N, int M>
+int Compare(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  int limit = (std::max)(lhs.size(), rhs.size());
+  for (int i = limit - 1; i >= 0; --i) {
+    const uint32_t lhs_word = lhs.GetWord(i);
+    const uint32_t rhs_word = rhs.GetWord(i);
+    if (lhs_word < rhs_word) {
+      return -1;
+    } else if (lhs_word > rhs_word) {
+      return 1;
+    }
+  }
+  return 0;
+}
+
+template <int N, int M>
+bool operator==(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  int limit = (std::max)(lhs.size(), rhs.size());
+  for (int i = 0; i < limit; ++i) {
+    if (lhs.GetWord(i) != rhs.GetWord(i)) {
+      return false;
+    }
+  }
+  return true;
+}
+
+template <int N, int M>
+bool operator!=(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  return !(lhs == rhs);
+}
+
+template <int N, int M>
+bool operator<(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  return Compare(lhs, rhs) == -1;
+}
+
+template <int N, int M>
+bool operator>(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  return rhs < lhs;
+}
+template <int N, int M>
+bool operator<=(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  return !(rhs < lhs);
+}
+template <int N, int M>
+bool operator>=(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
+  return !(lhs < rhs);
+}
+
+// Output operator for BigUnsigned, for testing purposes only.
+template <int N>
+std::ostream& operator<<(std::ostream& os, const BigUnsigned<N>& num) {
+  return os << num.ToString();
+}
+
+// Explicit instantiation declarations for the sizes of BigUnsigned that we
+// are using.
+//
+// For now, the choices of 4 and 84 are arbitrary; 4 is a small value that is
+// still bigger than an int128, and 84 is a large value we will want to use
+// in the from_chars implementation.
+//
+// Comments justifying the use of 84 belong in the from_chars implementation,
+// and will be added in a follow-up CL.
+extern template class BigUnsigned<4>;
+extern template class BigUnsigned<84>;
+
+}  // namespace strings_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/charconv_parse.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/charconv_parse.h
new file mode 100644 (file)
index 0000000..44d06b2
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_STRINGS_INTERNAL_CHARCONV_PARSE_H_
+#define ABSL_STRINGS_INTERNAL_CHARCONV_PARSE_H_
+
+#include <cstdint>
+
+#include "absl/strings/charconv.h"
+
+namespace absl {
+namespace strings_internal {
+
+// Enum indicating whether a parsed float is a number or special value.
+enum class FloatType { kNumber, kInfinity, kNan };
+
+// The decomposed parts of a parsed `float` or `double`.
+struct ParsedFloat {
+  // Representation of the parsed mantissa, with the decimal point adjusted to
+  // make it an integer.
+  //
+  // During decimal scanning, this contains 19 significant digits worth of
+  // mantissa value.  If digits beyond this point are found, they
+  // are truncated, and if any of these dropped digits are nonzero, then
+  // `mantissa` is inexact, and the full mantissa is stored in [subrange_begin,
+  // subrange_end).
+  //
+  // During hexadecimal scanning, this contains 15 significant hex digits worth
+  // of mantissa value.  Digits beyond this point are sticky -- they are
+  // truncated, but if any dropped digits are nonzero, the low bit of mantissa
+  // will be set.  (This allows for precise rounding, and avoids the need
+  // to store the full mantissa in [subrange_begin, subrange_end).)
+  uint64_t mantissa = 0;
+
+  // Floating point expontent.  This reflects any decimal point adjustments and
+  // any truncated digits from the mantissa.  The absolute value of the parsed
+  // number is represented by mantissa * (base ** exponent), where base==10 for
+  // decimal floats, and base==2 for hexadecimal floats.
+  int exponent = 0;
+
+  // The literal exponent value scanned from the input, or 0 if none was
+  // present.  This does not reflect any adjustments applied to mantissa.
+  int literal_exponent = 0;
+
+  // The type of number scanned.
+  FloatType type = FloatType::kNumber;
+
+  // When non-null, [subrange_begin, subrange_end) marks a range of characters
+  // that require further processing.  The meaning is dependent on float type.
+  // If type == kNumber and this is set, this is a "wide input": the input
+  // mantissa contained more than 19 digits.  The range contains the full
+  // mantissa.  It plus `literal_exponent` need to be examined to find the best
+  // floating point match.
+  // If type == kNan and this is set, the range marks the contents of a
+  // matched parenthesized character region after the NaN.
+  const char* subrange_begin = nullptr;
+  const char* subrange_end = nullptr;
+
+  // One-past-the-end of the successfully parsed region, or nullptr if no
+  // matching pattern was found.
+  const char* end = nullptr;
+};
+
+// Read the floating point number in the provided range, and populate
+// ParsedFloat accordingly.
+//
+// format_flags is a bitmask value specifying what patterns this API will match.
+// `scientific` and `fixed`  are honored per std::from_chars rules
+// ([utility.from.chars], C++17): if exactly one of these bits is set, then an
+// exponent is required, or dislallowed, respectively.
+//
+// Template parameter `base` must be either 10 or 16.  For base 16, a "0x" is
+// *not* consumed.  The `hex` bit from format_flags is ignored by ParseFloat.
+template <int base>
+ParsedFloat ParseFloat(const char* begin, const char* end,
+                       absl::chars_format format_flags);
+
+extern template ParsedFloat ParseFloat<10>(const char* begin, const char* end,
+                                           absl::chars_format format_flags);
+extern template ParsedFloat ParseFloat<16>(const char* begin, const char* end,
+                                           absl::chars_format format_flags);
+
+}  // namespace strings_internal
+}  // namespace absl
+#endif  // ABSL_STRINGS_INTERNAL_CHARCONV_PARSE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/escaping_test_common.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/escaping_test_common.h
new file mode 100644 (file)
index 0000000..bd80303
--- /dev/null
@@ -0,0 +1,131 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This test contains common things needed by both escaping_test.cc and
+// escaping_benchmark.cc.
+
+#ifndef ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
+#define ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
+
+#include <array>
+#include "absl/strings/string_view.h"
+
+namespace absl {
+namespace strings_internal {
+
+struct base64_testcase {
+  absl::string_view plaintext;
+  absl::string_view cyphertext;
+};
+
+inline const std::array<base64_testcase, 5>& base64_strings() {
+  static const std::array<base64_testcase, 5> testcase{{
+      // Some google quotes
+      // Cyphertext created with "uuencode (GNU sharutils) 4.6.3"
+      // (Note that we're testing the websafe encoding, though, so if
+      // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
+      { "I was always good at math and science, and I never realized "
+        "that was unusual or somehow undesirable. So one of the things "
+        "I care a lot about is helping to remove that stigma, "
+        "to show girls that you can be feminine, you can like the things "
+        "that girls like, but you can also be really good at technology. "
+        "You can be really good at building things."
+        " - Marissa Meyer, Newsweek, 2010-12-22" "\n",
+
+        "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
+        "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
+        "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
+        "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
+        "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
+        "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
+        "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
+        "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
+        "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK" },
+
+      { "Typical first year for a new cluster: "
+        "~0.5 overheating "
+        "~1 PDU failure "
+        "~1 rack-move "
+        "~1 network rewiring "
+        "~20 rack failures "
+        "~5 racks go wonky "
+        "~8 network maintenances "
+        "~12 router reloads "
+        "~3 router failures "
+        "~dozens of minor 30-second blips for dns "
+        "~1000 individual machine failures "
+        "~thousands of hard drive failures "
+        "slow disks, bad memory, misconfigured machines, flaky machines, etc."
+        " - Jeff Dean, The Joys of Real Hardware" "\n",
+
+        "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
+        "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
+        "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
+        "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
+        "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
+        "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
+        "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
+        "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
+        "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
+        "ZWFsIEhhcmR3YXJlCg" },
+
+      { "I'm the head of the webspam team at Google.  "
+        "That means that if you type your name into Google and get porn back, "
+        "it's my fault. Unless you're a porn star, in which case porn is a "
+        "completely reasonable response."
+        " - Matt Cutts, Google Plus" "\n",
+
+        "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
+        "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
+        "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
+        "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
+        "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
+        "IEdvb2dsZSBQbHVzCg" },
+
+      { "It will still be a long time before machines approach human "
+        "intelligence. "
+        "But luckily, machines don't actually have to be intelligent; "
+        "they just have to fake it. Access to a wealth of information, "
+        "combined with a rudimentary decision-making capacity, "
+        "can often be almost as useful. Of course, the results are better yet "
+        "when coupled with intelligence. A reference librarian with access to "
+        "a good search engine is a formidable tool."
+        " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004"
+        "\n",
+
+        "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
+        "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
+        "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
+        "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
+        "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
+        "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
+        "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
+        "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
+        "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
+        "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
+        "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
+        "NAo" },
+
+      // Degenerate edge case
+      { "",
+        "" },
+  }};
+
+  return testcase;
+}
+
+}  // namespace strings_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
index a6f1c69..7c071a8 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 
-// These routines provide mem versions of standard C std::string routines,
+// These routines provide mem versions of standard C string routines,
 // such as strpbrk.  They function exactly the same as the str versions,
 // so if you wonder what they are, replace the word "mem" by
 // "str" and check out the man page.  I could return void*, as the
 // since this is by far the most common way these functions are called.
 //
 // The difference between the mem and str versions is the mem version
-// takes a pointer and a length, rather than a '\0'-terminated std::string.
+// takes a pointer and a length, rather than a '\0'-terminated string.
 // The memcase* routines defined here assume the locale is "C"
 // (they use absl::ascii_tolower instead of tolower).
 //
 // These routines are based on the BSD library.
 //
-// Here's a list of routines from std::string.h, and their mem analogues.
-// Functions in lowercase are defined in std::string.h; those in UPPERCASE
+// Here's a list of routines from string.h, and their mem analogues.
+// Functions in lowercase are defined in string.h; those in UPPERCASE
 // are defined here:
 //
 // strlen                  --
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/numbers_test_common.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/numbers_test_common.h
new file mode 100644 (file)
index 0000000..2824720
--- /dev/null
@@ -0,0 +1,179 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file contains common things needed by numbers_test.cc,
+// numbers_legacy_test.cc and numbers_benchmark.cc.
+
+#ifndef ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_
+#define ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_
+
+#include <array>
+#include <cstdint>
+#include <limits>
+#include <string>
+
+namespace absl {
+namespace strings_internal {
+
+template <typename IntType>
+inline bool Itoa(IntType value, int base, std::string* destination) {
+  destination->clear();
+  if (base <= 1 || base > 36) {
+    return false;
+  }
+
+  if (value == 0) {
+    destination->push_back('0');
+    return true;
+  }
+
+  bool negative = value < 0;
+  while (value != 0) {
+    const IntType next_value = value / base;
+    // Can't use std::abs here because of problems when IntType is unsigned.
+    int remainder = value > next_value * base ? value - next_value * base
+                                              : next_value * base - value;
+    char c = remainder < 10 ? '0' + remainder : 'A' + remainder - 10;
+    destination->insert(0, 1, c);
+    value = next_value;
+  }
+
+  if (negative) {
+    destination->insert(0, 1, '-');
+  }
+  return true;
+}
+
+struct uint32_test_case {
+  const char* str;
+  bool expect_ok;
+  int base;  // base to pass to the conversion function
+  uint32_t expected;
+};
+
+inline const std::array<uint32_test_case, 27>& strtouint32_test_cases() {
+  static const std::array<uint32_test_case, 27> test_cases{{
+      {"0xffffffff", true, 16, (std::numeric_limits<uint32_t>::max)()},
+      {"0x34234324", true, 16, 0x34234324},
+      {"34234324", true, 16, 0x34234324},
+      {"0", true, 16, 0},
+      {" \t\n 0xffffffff", true, 16, (std::numeric_limits<uint32_t>::max)()},
+      {" \f\v 46", true, 10, 46},  // must accept weird whitespace
+      {" \t\n 72717222", true, 8, 072717222},
+      {" \t\n 072717222", true, 8, 072717222},
+      {" \t\n 072717228", false, 8, 07271722},
+      {"0", true, 0, 0},
+
+      // Base-10 version.
+      {"34234324", true, 0, 34234324},
+      {"4294967295", true, 0, (std::numeric_limits<uint32_t>::max)()},
+      {"34234324 \n\t", true, 10, 34234324},
+
+      // Unusual base
+      {"0", true, 3, 0},
+      {"2", true, 3, 2},
+      {"11", true, 3, 4},
+
+      // Invalid uints.
+      {"", false, 0, 0},
+      {"  ", false, 0, 0},
+      {"abc", false, 0, 0},  // would be valid hex, but prefix is missing
+      {"34234324a", false, 0, 34234324},
+      {"34234.3", false, 0, 34234},
+      {"-1", false, 0, 0},
+      {"   -123", false, 0, 0},
+      {" \t\n -123", false, 0, 0},
+
+      // Out of bounds.
+      {"4294967296", false, 0, (std::numeric_limits<uint32_t>::max)()},
+      {"0x100000000", false, 0, (std::numeric_limits<uint32_t>::max)()},
+      {nullptr, false, 0, 0},
+  }};
+  return test_cases;
+}
+
+struct uint64_test_case {
+  const char* str;
+  bool expect_ok;
+  int base;
+  uint64_t expected;
+};
+
+inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() {
+  static const std::array<uint64_test_case, 34> test_cases{{
+      {"0x3423432448783446", true, 16, int64_t{0x3423432448783446}},
+      {"3423432448783446", true, 16, int64_t{0x3423432448783446}},
+
+      {"0", true, 16, 0},
+      {"000", true, 0, 0},
+      {"0", true, 0, 0},
+      {" \t\n 0xffffffffffffffff", true, 16,
+       (std::numeric_limits<uint64_t>::max)()},
+
+      {"012345670123456701234", true, 8, int64_t{012345670123456701234}},
+      {"12345670123456701234", true, 8, int64_t{012345670123456701234}},
+
+      {"12845670123456701234", false, 8, 0},
+
+      // Base-10 version.
+      {"34234324487834466", true, 0, int64_t{34234324487834466}},
+
+      {" \t\n 18446744073709551615", true, 0,
+       (std::numeric_limits<uint64_t>::max)()},
+
+      {"34234324487834466 \n\t ", true, 0, int64_t{34234324487834466}},
+
+      {" \f\v 46", true, 10, 46},  // must accept weird whitespace
+
+      // Unusual base
+      {"0", true, 3, 0},
+      {"2", true, 3, 2},
+      {"11", true, 3, 4},
+
+      {"0", true, 0, 0},
+
+      // Invalid uints.
+      {"", false, 0, 0},
+      {"  ", false, 0, 0},
+      {"abc", false, 0, 0},
+      {"34234324487834466a", false, 0, 0},
+      {"34234487834466.3", false, 0, 0},
+      {"-1", false, 0, 0},
+      {"   -123", false, 0, 0},
+      {" \t\n -123", false, 0, 0},
+
+      // Out of bounds.
+      {"18446744073709551616", false, 10, 0},
+      {"18446744073709551616", false, 0, 0},
+      {"0x10000000000000000", false, 16,
+       (std::numeric_limits<uint64_t>::max)()},
+      {"0X10000000000000000", false, 16,
+       (std::numeric_limits<uint64_t>::max)()},  // 0X versus 0x.
+      {"0x10000000000000000", false, 0, (std::numeric_limits<uint64_t>::max)()},
+      {"0X10000000000000000", false, 0,
+       (std::numeric_limits<uint64_t>::max)()},  // 0X versus 0x.
+
+      {"0x1234", true, 16, 0x1234},
+
+      // Base-10 std::string version.
+      {"1234", true, 0, 1234},
+      {nullptr, false, 0, 0},
+  }};
+  return test_cases;
+}
+
+}  // namespace strings_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_NUMBERS_TEST_COMMON_H_
index 017632a..2079201 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -64,8 +64,8 @@ class OStringStream : private std::basic_streambuf<char>, public std::ostream {
   // The argument can be null, in which case you'll need to call str(p) with a
   // non-null argument before you can write to the stream.
   //
-  // The destructor of OStringStream doesn't use the std::string. It's OK to destroy
-  // the std::string before the stream.
+  // The destructor of OStringStream doesn't use the std::string. It's OK to
+  // destroy the std::string before the stream.
   explicit OStringStream(std::string* s) : std::ostream(this), s_(s) {}
 
   std::string* str() { return s_; }
@@ -75,18 +75,8 @@ class OStringStream : private std::basic_streambuf<char>, public std::ostream {
  private:
   using Buf = std::basic_streambuf<char>;
 
-  Buf::int_type overflow(int c = Buf::traits_type::eof()) override {
-    assert(s_);
-    if (!Buf::traits_type::eq_int_type(c, Buf::traits_type::eof()))
-      s_->push_back(static_cast<char>(c));
-    return 1;
-  }
-
-  std::streamsize xsputn(const char* s, std::streamsize n) override {
-    assert(s_);
-    s_->append(s, n);
-    return n;
-  }
+  Buf::int_type overflow(int c) override;
+  std::streamsize xsputn(const char* s, std::streamsize n) override;
 
   std::string* s_;
 };
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/pow10_helper.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/pow10_helper.h
new file mode 100644 (file)
index 0000000..9d1aa71
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This test helper library contains a table of powers of 10, to guarantee
+// precise values are computed across the full range of doubles. We can't rely
+// on the pow() function, because not all standard libraries ship a version
+// that is precise.
+#ifndef ABSL_STRINGS_INTERNAL_POW10_HELPER_H_
+#define ABSL_STRINGS_INTERNAL_POW10_HELPER_H_
+
+#include <vector>
+
+namespace absl {
+namespace strings_internal {
+
+// Computes the precise value of 10^exp. (I.e. the nearest representable
+// double to the exact value, rounding to nearest-even in the (single) case of
+// being exactly halfway between.)
+double Pow10(int exp);
+
+}  // namespace strings_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_POW10_HELPER_H_
index 0157ca0..469962b 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,6 +18,7 @@
 #define ABSL_STRINGS_INTERNAL_RESIZE_UNINITIALIZED_H_
 
 #include <string>
+#include <type_traits>
 #include <utility>
 
 #include "absl/base/port.h"
@@ -27,22 +28,24 @@ namespace absl {
 namespace strings_internal {
 
 // Is a subclass of true_type or false_type, depending on whether or not
-// T has a resize_uninitialized member.
-template <typename T, typename = void>
-struct HasResizeUninitialized : std::false_type {};
-template <typename T>
-struct HasResizeUninitialized<
-    T, absl::void_t<decltype(std::declval<T>().resize_uninitialized(237))>>
-    : std::true_type {};
+// T has a __resize_default_init member.
+template <typename string_type, typename = void>
+struct ResizeUninitializedTraits {
+  using HasMember = std::false_type;
+  static void Resize(string_type* s, size_t new_size) { s->resize(new_size); }
+};
 
+// __resize_default_init is provided by libc++ >= 8.0 and by Google's internal
+// ::string implementation.
 template <typename string_type>
-void ResizeUninit(string_type* s, size_t new_size, std::true_type) {
-  s->resize_uninitialized(new_size);
-}
-template <typename string_type>
-void ResizeUninit(string_type* s, size_t new_size, std::false_type) {
-  s->resize(new_size);
-}
+struct ResizeUninitializedTraits<
+    string_type, absl::void_t<decltype(std::declval<string_type&>()
+                                           .__resize_default_init(237))> > {
+  using HasMember = std::true_type;
+  static void Resize(string_type* s, size_t new_size) {
+    s->__resize_default_init(new_size);
+  }
+};
 
 // Returns true if the std::string implementation supports a resize where
 // the new characters added to the std::string are left untouched.
@@ -51,16 +54,16 @@ void ResizeUninit(string_type* s, size_t new_size, std::false_type) {
 // the previous function.)
 template <typename string_type>
 inline constexpr bool STLStringSupportsNontrashingResize(string_type*) {
-  return HasResizeUninitialized<string_type>();
+  return ResizeUninitializedTraits<string_type>::HasMember::value;
 }
 
 // Like str->resize(new_size), except any new characters added to "*str" as a
 // result of resizing may be left uninitialized, rather than being filled with
 // '0' bytes. Typically used when code is then going to overwrite the backing
-// store of the std::string with known data. Uses a Google extension to std::string.
+// store of the std::string with known data.
 template <typename string_type, typename = void>
 inline void STLStringResizeUninitialized(string_type* s, size_t new_size) {
-  ResizeUninit(s, new_size, HasResizeUninitialized<string_type>());
+  ResizeUninitializedTraits<string_type>::Resize(s, new_size);
 }
 
 }  // namespace strings_internal
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h
new file mode 100644 (file)
index 0000000..202ab37
--- /dev/null
@@ -0,0 +1,246 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Thie file provides the IsStrictlyBaseOfAndConvertibleToSTLContainer type
+// trait metafunction to assist in working with the _GLIBCXX_DEBUG debug
+// wrappers of STL containers.
+//
+// DO NOT INCLUDE THIS FILE DIRECTLY. Use this file by including
+// absl/strings/str_split.h.
+//
+// IWYU pragma: private, include "absl/strings/str_split.h"
+
+#ifndef ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_
+#define ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_
+
+#include <array>
+#include <bitset>
+#include <deque>
+#include <forward_list>
+#include <list>
+#include <map>
+#include <set>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+namespace strings_internal {
+
+template <typename C, template <typename...> class T>
+struct IsSpecializationImpl : std::false_type {};
+template <template <typename...> class T, typename... Args>
+struct IsSpecializationImpl<T<Args...>, T> : std::true_type {};
+template <typename C, template <typename...> class T>
+using IsSpecialization = IsSpecializationImpl<absl::decay_t<C>, T>;
+
+template <typename C>
+struct IsArrayImpl : std::false_type {};
+template <template <typename, size_t> class A, typename T, size_t N>
+struct IsArrayImpl<A<T, N>> : std::is_same<A<T, N>, std::array<T, N>> {};
+template <typename C>
+using IsArray = IsArrayImpl<absl::decay_t<C>>;
+
+template <typename C>
+struct IsBitsetImpl : std::false_type {};
+template <template <size_t> class B, size_t N>
+struct IsBitsetImpl<B<N>> : std::is_same<B<N>, std::bitset<N>> {};
+template <typename C>
+using IsBitset = IsBitsetImpl<absl::decay_t<C>>;
+
+template <typename C>
+struct IsSTLContainer
+    : absl::disjunction<
+          IsArray<C>, IsBitset<C>, IsSpecialization<C, std::deque>,
+          IsSpecialization<C, std::forward_list>,
+          IsSpecialization<C, std::list>, IsSpecialization<C, std::map>,
+          IsSpecialization<C, std::multimap>, IsSpecialization<C, std::set>,
+          IsSpecialization<C, std::multiset>,
+          IsSpecialization<C, std::unordered_map>,
+          IsSpecialization<C, std::unordered_multimap>,
+          IsSpecialization<C, std::unordered_set>,
+          IsSpecialization<C, std::unordered_multiset>,
+          IsSpecialization<C, std::vector>> {};
+
+template <typename C, template <typename...> class T, typename = void>
+struct IsBaseOfSpecializationImpl : std::false_type {};
+// IsBaseOfSpecializationImpl needs multiple partial specializations to SFINAE
+// on the existence of container dependent types and plug them into the STL
+// template.
+template <typename C, template <typename, typename> class T>
+struct IsBaseOfSpecializationImpl<
+    C, T, absl::void_t<typename C::value_type, typename C::allocator_type>>
+    : std::is_base_of<C,
+                      T<typename C::value_type, typename C::allocator_type>> {};
+template <typename C, template <typename, typename, typename> class T>
+struct IsBaseOfSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::key_compare,
+                 typename C::allocator_type>>
+    : std::is_base_of<C, T<typename C::key_type, typename C::key_compare,
+                           typename C::allocator_type>> {};
+template <typename C, template <typename, typename, typename, typename> class T>
+struct IsBaseOfSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::mapped_type,
+                 typename C::key_compare, typename C::allocator_type>>
+    : std::is_base_of<C,
+                      T<typename C::key_type, typename C::mapped_type,
+                        typename C::key_compare, typename C::allocator_type>> {
+};
+template <typename C, template <typename, typename, typename, typename> class T>
+struct IsBaseOfSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::hasher,
+                 typename C::key_equal, typename C::allocator_type>>
+    : std::is_base_of<C, T<typename C::key_type, typename C::hasher,
+                           typename C::key_equal, typename C::allocator_type>> {
+};
+template <typename C,
+          template <typename, typename, typename, typename, typename> class T>
+struct IsBaseOfSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::mapped_type,
+                 typename C::hasher, typename C::key_equal,
+                 typename C::allocator_type>>
+    : std::is_base_of<C, T<typename C::key_type, typename C::mapped_type,
+                           typename C::hasher, typename C::key_equal,
+                           typename C::allocator_type>> {};
+template <typename C, template <typename...> class T>
+using IsBaseOfSpecialization = IsBaseOfSpecializationImpl<absl::decay_t<C>, T>;
+
+template <typename C>
+struct IsBaseOfArrayImpl : std::false_type {};
+template <template <typename, size_t> class A, typename T, size_t N>
+struct IsBaseOfArrayImpl<A<T, N>> : std::is_base_of<A<T, N>, std::array<T, N>> {
+};
+template <typename C>
+using IsBaseOfArray = IsBaseOfArrayImpl<absl::decay_t<C>>;
+
+template <typename C>
+struct IsBaseOfBitsetImpl : std::false_type {};
+template <template <size_t> class B, size_t N>
+struct IsBaseOfBitsetImpl<B<N>> : std::is_base_of<B<N>, std::bitset<N>> {};
+template <typename C>
+using IsBaseOfBitset = IsBaseOfBitsetImpl<absl::decay_t<C>>;
+
+template <typename C>
+struct IsBaseOfSTLContainer
+    : absl::disjunction<IsBaseOfArray<C>, IsBaseOfBitset<C>,
+                        IsBaseOfSpecialization<C, std::deque>,
+                        IsBaseOfSpecialization<C, std::forward_list>,
+                        IsBaseOfSpecialization<C, std::list>,
+                        IsBaseOfSpecialization<C, std::map>,
+                        IsBaseOfSpecialization<C, std::multimap>,
+                        IsBaseOfSpecialization<C, std::set>,
+                        IsBaseOfSpecialization<C, std::multiset>,
+                        IsBaseOfSpecialization<C, std::unordered_map>,
+                        IsBaseOfSpecialization<C, std::unordered_multimap>,
+                        IsBaseOfSpecialization<C, std::unordered_set>,
+                        IsBaseOfSpecialization<C, std::unordered_multiset>,
+                        IsBaseOfSpecialization<C, std::vector>> {};
+
+template <typename C, template <typename...> class T, typename = void>
+struct IsConvertibleToSpecializationImpl : std::false_type {};
+// IsConvertibleToSpecializationImpl needs multiple partial specializations to
+// SFINAE on the existence of container dependent types and plug them into the
+// STL template.
+template <typename C, template <typename, typename> class T>
+struct IsConvertibleToSpecializationImpl<
+    C, T, absl::void_t<typename C::value_type, typename C::allocator_type>>
+    : std::is_convertible<
+          C, T<typename C::value_type, typename C::allocator_type>> {};
+template <typename C, template <typename, typename, typename> class T>
+struct IsConvertibleToSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::key_compare,
+                 typename C::allocator_type>>
+    : std::is_convertible<C, T<typename C::key_type, typename C::key_compare,
+                               typename C::allocator_type>> {};
+template <typename C, template <typename, typename, typename, typename> class T>
+struct IsConvertibleToSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::mapped_type,
+                 typename C::key_compare, typename C::allocator_type>>
+    : std::is_convertible<
+          C, T<typename C::key_type, typename C::mapped_type,
+               typename C::key_compare, typename C::allocator_type>> {};
+template <typename C, template <typename, typename, typename, typename> class T>
+struct IsConvertibleToSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::hasher,
+                 typename C::key_equal, typename C::allocator_type>>
+    : std::is_convertible<
+          C, T<typename C::key_type, typename C::hasher, typename C::key_equal,
+               typename C::allocator_type>> {};
+template <typename C,
+          template <typename, typename, typename, typename, typename> class T>
+struct IsConvertibleToSpecializationImpl<
+    C, T,
+    absl::void_t<typename C::key_type, typename C::mapped_type,
+                 typename C::hasher, typename C::key_equal,
+                 typename C::allocator_type>>
+    : std::is_convertible<C, T<typename C::key_type, typename C::mapped_type,
+                               typename C::hasher, typename C::key_equal,
+                               typename C::allocator_type>> {};
+template <typename C, template <typename...> class T>
+using IsConvertibleToSpecialization =
+    IsConvertibleToSpecializationImpl<absl::decay_t<C>, T>;
+
+template <typename C>
+struct IsConvertibleToArrayImpl : std::false_type {};
+template <template <typename, size_t> class A, typename T, size_t N>
+struct IsConvertibleToArrayImpl<A<T, N>>
+    : std::is_convertible<A<T, N>, std::array<T, N>> {};
+template <typename C>
+using IsConvertibleToArray = IsConvertibleToArrayImpl<absl::decay_t<C>>;
+
+template <typename C>
+struct IsConvertibleToBitsetImpl : std::false_type {};
+template <template <size_t> class B, size_t N>
+struct IsConvertibleToBitsetImpl<B<N>>
+    : std::is_convertible<B<N>, std::bitset<N>> {};
+template <typename C>
+using IsConvertibleToBitset = IsConvertibleToBitsetImpl<absl::decay_t<C>>;
+
+template <typename C>
+struct IsConvertibleToSTLContainer
+    : absl::disjunction<
+          IsConvertibleToArray<C>, IsConvertibleToBitset<C>,
+          IsConvertibleToSpecialization<C, std::deque>,
+          IsConvertibleToSpecialization<C, std::forward_list>,
+          IsConvertibleToSpecialization<C, std::list>,
+          IsConvertibleToSpecialization<C, std::map>,
+          IsConvertibleToSpecialization<C, std::multimap>,
+          IsConvertibleToSpecialization<C, std::set>,
+          IsConvertibleToSpecialization<C, std::multiset>,
+          IsConvertibleToSpecialization<C, std::unordered_map>,
+          IsConvertibleToSpecialization<C, std::unordered_multimap>,
+          IsConvertibleToSpecialization<C, std::unordered_set>,
+          IsConvertibleToSpecialization<C, std::unordered_multiset>,
+          IsConvertibleToSpecialization<C, std::vector>> {};
+
+template <typename C>
+struct IsStrictlyBaseOfAndConvertibleToSTLContainer
+    : absl::conjunction<absl::negation<IsSTLContainer<C>>,
+                        IsBaseOfSTLContainer<C>,
+                        IsConvertibleToSTLContainer<C>> {};
+
+}  // namespace strings_internal
+}  // namespace absl
+#endif  // ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h
new file mode 100644 (file)
index 0000000..5cb3a14
--- /dev/null
@@ -0,0 +1,424 @@
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_ARG_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_ARG_H_
+
+#include <string.h>
+#include <wchar.h>
+
+#include <cstdio>
+#include <iomanip>
+#include <limits>
+#include <memory>
+#include <sstream>
+#include <string>
+#include <type_traits>
+
+#include "absl/base/port.h"
+#include "absl/meta/type_traits.h"
+#include "absl/numeric/int128.h"
+#include "absl/strings/internal/str_format/extension.h"
+#include "absl/strings/string_view.h"
+
+class Cord;
+class CordReader;
+
+namespace absl {
+
+class FormatCountCapture;
+class FormatSink;
+
+namespace str_format_internal {
+
+template <typename T, typename = void>
+struct HasUserDefinedConvert : std::false_type {};
+
+template <typename T>
+struct HasUserDefinedConvert<
+    T, void_t<decltype(AbslFormatConvert(
+           std::declval<const T&>(), std::declval<ConversionSpec>(),
+           std::declval<FormatSink*>()))>> : std::true_type {};
+
+template <typename T>
+class StreamedWrapper;
+
+// If 'v' can be converted (in the printf sense) according to 'conv',
+// then convert it, appending to `sink` and return `true`.
+// Otherwise fail and return `false`.
+
+// Raw pointers.
+struct VoidPtr {
+  VoidPtr() = default;
+  template <typename T,
+            decltype(reinterpret_cast<uintptr_t>(std::declval<T*>())) = 0>
+  VoidPtr(T* ptr)  // NOLINT
+      : value(ptr ? reinterpret_cast<uintptr_t>(ptr) : 0) {}
+  uintptr_t value;
+};
+ConvertResult<Conv::p> FormatConvertImpl(VoidPtr v, ConversionSpec conv,
+                                         FormatSinkImpl* sink);
+
+// Strings.
+ConvertResult<Conv::s> FormatConvertImpl(const std::string& v,
+                                         ConversionSpec conv,
+                                         FormatSinkImpl* sink);
+ConvertResult<Conv::s> FormatConvertImpl(string_view v, ConversionSpec conv,
+                                         FormatSinkImpl* sink);
+ConvertResult<Conv::s | Conv::p> FormatConvertImpl(const char* v,
+                                                   ConversionSpec conv,
+                                                   FormatSinkImpl* sink);
+template <class AbslCord,
+          typename std::enable_if<
+              std::is_same<AbslCord, ::Cord>::value>::type* = nullptr,
+          class AbslCordReader = ::CordReader>
+ConvertResult<Conv::s> FormatConvertImpl(const AbslCord& value,
+                                         ConversionSpec conv,
+                                         FormatSinkImpl* sink) {
+  if (conv.conv().id() != ConversionChar::s) return {false};
+
+  bool is_left = conv.flags().left;
+  size_t space_remaining = 0;
+
+  int width = conv.width();
+  if (width >= 0) space_remaining = width;
+
+  size_t to_write = value.size();
+
+  int precision = conv.precision();
+  if (precision >= 0)
+    to_write = (std::min)(to_write, static_cast<size_t>(precision));
+
+  space_remaining = Excess(to_write, space_remaining);
+
+  if (space_remaining > 0 && !is_left) sink->Append(space_remaining, ' ');
+
+  string_view piece;
+  for (AbslCordReader reader(value);
+       to_write > 0 && reader.ReadFragment(&piece); to_write -= piece.size()) {
+    if (piece.size() > to_write) piece.remove_suffix(piece.size() - to_write);
+    sink->Append(piece);
+  }
+
+  if (space_remaining > 0 && is_left) sink->Append(space_remaining, ' ');
+  return {true};
+}
+
+using IntegralConvertResult =
+    ConvertResult<Conv::c | Conv::numeric | Conv::star>;
+using FloatingConvertResult = ConvertResult<Conv::floating>;
+
+// Floats.
+FloatingConvertResult FormatConvertImpl(float v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+FloatingConvertResult FormatConvertImpl(double v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+FloatingConvertResult FormatConvertImpl(long double v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+
+// Chars.
+IntegralConvertResult FormatConvertImpl(char v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(signed char v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(unsigned char v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+
+// Ints.
+IntegralConvertResult FormatConvertImpl(short v,  // NOLINT
+                                        ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(unsigned short v,  // NOLINT
+                                        ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(int v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(unsigned v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(long v,  // NOLINT
+                                        ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(unsigned long v,  // NOLINT
+                                        ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(long long v,  // NOLINT
+                                        ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(unsigned long long v,  // NOLINT
+                                        ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+IntegralConvertResult FormatConvertImpl(uint128 v, ConversionSpec conv,
+                                        FormatSinkImpl* sink);
+template <typename T, enable_if_t<std::is_same<T, bool>::value, int> = 0>
+IntegralConvertResult FormatConvertImpl(T v, ConversionSpec conv,
+                                        FormatSinkImpl* sink) {
+  return FormatConvertImpl(static_cast<int>(v), conv, sink);
+}
+
+// We provide this function to help the checker, but it is never defined.
+// FormatArgImpl will use the underlying Convert functions instead.
+template <typename T>
+typename std::enable_if<std::is_enum<T>::value &&
+                            !HasUserDefinedConvert<T>::value,
+                        IntegralConvertResult>::type
+FormatConvertImpl(T v, ConversionSpec conv, FormatSinkImpl* sink);
+
+template <typename T>
+ConvertResult<Conv::s> FormatConvertImpl(const StreamedWrapper<T>& v,
+                                         ConversionSpec conv,
+                                         FormatSinkImpl* out) {
+  std::ostringstream oss;
+  oss << v.v_;
+  if (!oss) return {false};
+  return str_format_internal::FormatConvertImpl(oss.str(), conv, out);
+}
+
+// Use templates and dependent types to delay evaluation of the function
+// until after FormatCountCapture is fully defined.
+struct FormatCountCaptureHelper {
+  template <class T = int>
+  static ConvertResult<Conv::n> ConvertHelper(const FormatCountCapture& v,
+                                              ConversionSpec conv,
+                                              FormatSinkImpl* sink) {
+    const absl::enable_if_t<sizeof(T) != 0, FormatCountCapture>& v2 = v;
+
+    if (conv.conv().id() != str_format_internal::ConversionChar::n)
+      return {false};
+    *v2.p_ = static_cast<int>(sink->size());
+    return {true};
+  }
+};
+
+template <class T = int>
+ConvertResult<Conv::n> FormatConvertImpl(const FormatCountCapture& v,
+                                         ConversionSpec conv,
+                                         FormatSinkImpl* sink) {
+  return FormatCountCaptureHelper::ConvertHelper(v, conv, sink);
+}
+
+// Helper friend struct to hide implementation details from the public API of
+// FormatArgImpl.
+struct FormatArgImplFriend {
+  template <typename Arg>
+  static bool ToInt(Arg arg, int* out) {
+    // A value initialized ConversionSpec has a `none` conv, which tells the
+    // dispatcher to run the `int` conversion.
+    return arg.dispatcher_(arg.data_, {}, out);
+  }
+
+  template <typename Arg>
+  static bool Convert(Arg arg, str_format_internal::ConversionSpec conv,
+                      FormatSinkImpl* out) {
+    return arg.dispatcher_(arg.data_, conv, out);
+  }
+
+  template <typename Arg>
+  static typename Arg::Dispatcher GetVTablePtrForTest(Arg arg) {
+    return arg.dispatcher_;
+  }
+};
+
+// A type-erased handle to a format argument.
+class FormatArgImpl {
+ private:
+  enum { kInlinedSpace = 8 };
+
+  using VoidPtr = str_format_internal::VoidPtr;
+
+  union Data {
+    const void* ptr;
+    const volatile void* volatile_ptr;
+    char buf[kInlinedSpace];
+  };
+
+  using Dispatcher = bool (*)(Data, ConversionSpec, void* out);
+
+  template <typename T>
+  struct store_by_value
+      : std::integral_constant<bool, (sizeof(T) <= kInlinedSpace) &&
+                                         (std::is_integral<T>::value ||
+                                          std::is_floating_point<T>::value ||
+                                          std::is_pointer<T>::value ||
+                                          std::is_same<VoidPtr, T>::value)> {};
+
+  enum StoragePolicy { ByPointer, ByVolatilePointer, ByValue };
+  template <typename T>
+  struct storage_policy
+      : std::integral_constant<StoragePolicy,
+                               (std::is_volatile<T>::value
+                                    ? ByVolatilePointer
+                                    : (store_by_value<T>::value ? ByValue
+                                                                : ByPointer))> {
+  };
+
+  // To reduce the number of vtables we will decay values before hand.
+  // Anything with a user-defined Convert will get its own vtable.
+  // For everything else:
+  //   - Decay char* and char arrays into `const char*`
+  //   - Decay any other pointer to `const void*`
+  //   - Decay all enums to their underlying type.
+  //   - Decay function pointers to void*.
+  template <typename T, typename = void>
+  struct DecayType {
+    static constexpr bool kHasUserDefined =
+        str_format_internal::HasUserDefinedConvert<T>::value;
+    using type = typename std::conditional<
+        !kHasUserDefined && std::is_convertible<T, const char*>::value,
+        const char*,
+        typename std::conditional<!kHasUserDefined &&
+                                      std::is_convertible<T, VoidPtr>::value,
+                                  VoidPtr, const T&>::type>::type;
+  };
+  template <typename T>
+  struct DecayType<T,
+                   typename std::enable_if<
+                       !str_format_internal::HasUserDefinedConvert<T>::value &&
+                       std::is_enum<T>::value>::type> {
+    using type = typename std::underlying_type<T>::type;
+  };
+
+ public:
+  template <typename T>
+  explicit FormatArgImpl(const T& value) {
+    using D = typename DecayType<T>::type;
+    static_assert(
+        std::is_same<D, const T&>::value || storage_policy<D>::value == ByValue,
+        "Decayed types must be stored by value");
+    Init(static_cast<D>(value));
+  }
+
+ private:
+  friend struct str_format_internal::FormatArgImplFriend;
+  template <typename T, StoragePolicy = storage_policy<T>::value>
+  struct Manager;
+
+  template <typename T>
+  struct Manager<T, ByPointer> {
+    static Data SetValue(const T& value) {
+      Data data;
+      data.ptr = std::addressof(value);
+      return data;
+    }
+
+    static const T& Value(Data arg) { return *static_cast<const T*>(arg.ptr); }
+  };
+
+  template <typename T>
+  struct Manager<T, ByVolatilePointer> {
+    static Data SetValue(const T& value) {
+      Data data;
+      data.volatile_ptr = &value;
+      return data;
+    }
+
+    static const T& Value(Data arg) {
+      return *static_cast<const T*>(arg.volatile_ptr);
+    }
+  };
+
+  template <typename T>
+  struct Manager<T, ByValue> {
+    static Data SetValue(const T& value) {
+      Data data;
+      memcpy(data.buf, &value, sizeof(value));
+      return data;
+    }
+
+    static T Value(Data arg) {
+      T value;
+      memcpy(&value, arg.buf, sizeof(T));
+      return value;
+    }
+  };
+
+  template <typename T>
+  void Init(const T& value) {
+    data_ = Manager<T>::SetValue(value);
+    dispatcher_ = &Dispatch<T>;
+  }
+
+  template <typename T>
+  static int ToIntVal(const T& val) {
+    using CommonType = typename std::conditional<std::is_signed<T>::value,
+                                                 int64_t, uint64_t>::type;
+    if (static_cast<CommonType>(val) >
+        static_cast<CommonType>((std::numeric_limits<int>::max)())) {
+      return (std::numeric_limits<int>::max)();
+    } else if (std::is_signed<T>::value &&
+               static_cast<CommonType>(val) <
+                   static_cast<CommonType>((std::numeric_limits<int>::min)())) {
+      return (std::numeric_limits<int>::min)();
+    }
+    return static_cast<int>(val);
+  }
+
+  template <typename T>
+  static bool ToInt(Data arg, int* out, std::true_type /* is_integral */,
+                    std::false_type) {
+    *out = ToIntVal(Manager<T>::Value(arg));
+    return true;
+  }
+
+  template <typename T>
+  static bool ToInt(Data arg, int* out, std::false_type,
+                    std::true_type /* is_enum */) {
+    *out = ToIntVal(static_cast<typename std::underlying_type<T>::type>(
+        Manager<T>::Value(arg)));
+    return true;
+  }
+
+  template <typename T>
+  static bool ToInt(Data, int*, std::false_type, std::false_type) {
+    return false;
+  }
+
+  template <typename T>
+  static bool Dispatch(Data arg, ConversionSpec spec, void* out) {
+    // A `none` conv indicates that we want the `int` conversion.
+    if (ABSL_PREDICT_FALSE(spec.conv().id() == ConversionChar::none)) {
+      return ToInt<T>(arg, static_cast<int*>(out), std::is_integral<T>(),
+                      std::is_enum<T>());
+    }
+
+    return str_format_internal::FormatConvertImpl(
+               Manager<T>::Value(arg), spec, static_cast<FormatSinkImpl*>(out))
+        .value;
+  }
+
+  Data data_;
+  Dispatcher dispatcher_;
+};
+
+#define ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(T, E) \
+  E template bool FormatArgImpl::Dispatch<T>(Data, ConversionSpec, void*)
+
+#define ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_(...)                   \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(str_format_internal::VoidPtr,     \
+                                             __VA_ARGS__);                     \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(bool, __VA_ARGS__);               \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(char, __VA_ARGS__);               \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(signed char, __VA_ARGS__);        \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(unsigned char, __VA_ARGS__);      \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(short, __VA_ARGS__); /* NOLINT */ \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(unsigned short,      /* NOLINT */ \
+                                             __VA_ARGS__);                     \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(int, __VA_ARGS__);                \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(unsigned int, __VA_ARGS__);       \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(long, __VA_ARGS__); /* NOLINT */  \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(unsigned long,      /* NOLINT */  \
+                                             __VA_ARGS__);                     \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(long long, /* NOLINT */           \
+                                             __VA_ARGS__);                     \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(unsigned long long, /* NOLINT */  \
+                                             __VA_ARGS__);                     \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(uint128, __VA_ARGS__);            \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(float, __VA_ARGS__);              \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(double, __VA_ARGS__);             \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(long double, __VA_ARGS__);        \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(const char*, __VA_ARGS__);        \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(std::string, __VA_ARGS__);        \
+  ABSL_INTERNAL_FORMAT_DISPATCH_INSTANTIATE_(string_view, __VA_ARGS__)
+
+ABSL_INTERNAL_FORMAT_DISPATCH_OVERLOADS_EXPAND_(extern);
+
+}  // namespace str_format_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_ARG_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h
new file mode 100644 (file)
index 0000000..7df140a
--- /dev/null
@@ -0,0 +1,211 @@
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_BIND_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_BIND_H_
+
+#include <array>
+#include <cstdio>
+#include <sstream>
+#include <string>
+
+#include "absl/base/port.h"
+#include "absl/strings/internal/str_format/arg.h"
+#include "absl/strings/internal/str_format/checker.h"
+#include "absl/strings/internal/str_format/parser.h"
+#include "absl/types/span.h"
+
+namespace absl {
+
+class UntypedFormatSpec;
+
+namespace str_format_internal {
+
+class BoundConversion : public ConversionSpec {
+ public:
+  const FormatArgImpl* arg() const { return arg_; }
+  void set_arg(const FormatArgImpl* a) { arg_ = a; }
+
+ private:
+  const FormatArgImpl* arg_;
+};
+
+// This is the type-erased class that the implementation uses.
+class UntypedFormatSpecImpl {
+ public:
+  UntypedFormatSpecImpl() = delete;
+
+  explicit UntypedFormatSpecImpl(string_view s)
+      : data_(s.data()), size_(s.size()) {}
+  explicit UntypedFormatSpecImpl(
+      const str_format_internal::ParsedFormatBase* pc)
+      : data_(pc), size_(~size_t{}) {}
+
+  bool has_parsed_conversion() const { return size_ == ~size_t{}; }
+
+  string_view str() const {
+    assert(!has_parsed_conversion());
+    return string_view(static_cast<const char*>(data_), size_);
+  }
+  const str_format_internal::ParsedFormatBase* parsed_conversion() const {
+    assert(has_parsed_conversion());
+    return static_cast<const str_format_internal::ParsedFormatBase*>(data_);
+  }
+
+  template <typename T>
+  static const UntypedFormatSpecImpl& Extract(const T& s) {
+    return s.spec_;
+  }
+
+ private:
+  const void* data_;
+  size_t size_;
+};
+
+template <typename T, typename...>
+struct MakeDependent {
+  using type = T;
+};
+
+// Implicitly convertible from `const char*`, `string_view`, and the
+// `ExtendedParsedFormat` type. This abstraction allows all format functions to
+// operate on any without providing too many overloads.
+template <typename... Args>
+class FormatSpecTemplate
+    : public MakeDependent<UntypedFormatSpec, Args...>::type {
+  using Base = typename MakeDependent<UntypedFormatSpec, Args...>::type;
+
+ public:
+#if ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+
+  // Honeypot overload for when the std::string is not constexpr.
+  // We use the 'unavailable' attribute to give a better compiler error than
+  // just 'method is deleted'.
+  FormatSpecTemplate(...)  // NOLINT
+      __attribute__((unavailable("Format std::string is not constexpr.")));
+
+  // Honeypot overload for when the format is constexpr and invalid.
+  // We use the 'unavailable' attribute to give a better compiler error than
+  // just 'method is deleted'.
+  // To avoid checking the format twice, we just check that the format is
+  // constexpr. If is it valid, then the overload below will kick in.
+  // We add the template here to make this overload have lower priority.
+  template <typename = void>
+  FormatSpecTemplate(const char* s)  // NOLINT
+      __attribute__((
+          enable_if(str_format_internal::EnsureConstexpr(s), "constexpr trap"),
+          unavailable(
+              "Format specified does not match the arguments passed.")));
+
+  template <typename T = void>
+  FormatSpecTemplate(string_view s)  // NOLINT
+      __attribute__((enable_if(str_format_internal::EnsureConstexpr(s),
+                               "constexpr trap"))) {
+    static_assert(sizeof(T*) == 0,
+                  "Format specified does not match the arguments passed.");
+  }
+
+  // Good format overload.
+  FormatSpecTemplate(const char* s)  // NOLINT
+      __attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s),
+                               "bad format trap")))
+      : Base(s) {}
+
+  FormatSpecTemplate(string_view s)  // NOLINT
+      __attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s),
+                               "bad format trap")))
+      : Base(s) {}
+
+#else  // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+
+  FormatSpecTemplate(const char* s) : Base(s) {}  // NOLINT
+  FormatSpecTemplate(string_view s) : Base(s) {}  // NOLINT
+
+#endif  // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+
+  template <Conv... C, typename = typename std::enable_if<
+                           sizeof...(C) == sizeof...(Args) &&
+                           AllOf(Contains(ArgumentToConv<Args>(),
+                                          C)...)>::type>
+  FormatSpecTemplate(const ExtendedParsedFormat<C...>& pc)  // NOLINT
+      : Base(&pc) {}
+};
+
+template <typename... Args>
+struct FormatSpecDeductionBarrier {
+  using type = FormatSpecTemplate<Args...>;
+};
+
+class Streamable {
+ public:
+  Streamable(const UntypedFormatSpecImpl& format,
+             absl::Span<const FormatArgImpl> args)
+      : format_(format) {
+    if (args.size() <= ABSL_ARRAYSIZE(few_args_)) {
+      for (size_t i = 0; i < args.size(); ++i) {
+        few_args_[i] = args[i];
+      }
+      args_ = absl::MakeSpan(few_args_, args.size());
+    } else {
+      many_args_.assign(args.begin(), args.end());
+      args_ = many_args_;
+    }
+  }
+
+  std::ostream& Print(std::ostream& os) const;
+
+  friend std::ostream& operator<<(std::ostream& os, const Streamable& l) {
+    return l.Print(os);
+  }
+
+ private:
+  const UntypedFormatSpecImpl& format_;
+  absl::Span<const FormatArgImpl> args_;
+  // if args_.size() is 4 or less:
+  FormatArgImpl few_args_[4] = {FormatArgImpl(0), FormatArgImpl(0),
+                                FormatArgImpl(0), FormatArgImpl(0)};
+  // if args_.size() is more than 4:
+  std::vector<FormatArgImpl> many_args_;
+};
+
+// for testing
+std::string Summarize(UntypedFormatSpecImpl format,
+                      absl::Span<const FormatArgImpl> args);
+bool BindWithPack(const UnboundConversion* props,
+                  absl::Span<const FormatArgImpl> pack, BoundConversion* bound);
+
+bool FormatUntyped(FormatRawSinkImpl raw_sink,
+                   UntypedFormatSpecImpl format,
+                   absl::Span<const FormatArgImpl> args);
+
+std::string& AppendPack(std::string* out, UntypedFormatSpecImpl format,
+                        absl::Span<const FormatArgImpl> args);
+
+inline std::string FormatPack(const UntypedFormatSpecImpl format,
+                              absl::Span<const FormatArgImpl> args) {
+  std::string out;
+  AppendPack(&out, format, args);
+  return out;
+}
+
+int FprintF(std::FILE* output, UntypedFormatSpecImpl format,
+            absl::Span<const FormatArgImpl> args);
+int SnprintF(char* output, size_t size, UntypedFormatSpecImpl format,
+             absl::Span<const FormatArgImpl> args);
+
+// Returned by Streamed(v). Converts via '%s' to the std::string created
+// by std::ostream << v.
+template <typename T>
+class StreamedWrapper {
+ public:
+  explicit StreamedWrapper(const T& v) : v_(v) { }
+
+ private:
+  template <typename S>
+  friend ConvertResult<Conv::s> FormatConvertImpl(const StreamedWrapper<S>& v,
+                                                  ConversionSpec conv,
+                                                  FormatSinkImpl* out);
+  const T& v_;
+};
+
+}  // namespace str_format_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_BIND_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h
new file mode 100644 (file)
index 0000000..8b594f2
--- /dev/null
@@ -0,0 +1,325 @@
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_CHECKER_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_CHECKER_H_
+
+#include "absl/strings/internal/str_format/arg.h"
+#include "absl/strings/internal/str_format/extension.h"
+
+// Compile time check support for entry points.
+
+#ifndef ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+#if defined(__clang__) && !defined(__native_client__)
+#if __has_attribute(enable_if)
+#define ABSL_INTERNAL_ENABLE_FORMAT_CHECKER 1
+#endif  // __has_attribute(enable_if)
+#endif  // defined(__clang__) && !defined(__native_client__)
+#endif  // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+
+namespace absl {
+namespace str_format_internal {
+
+constexpr bool AllOf() { return true; }
+
+template <typename... T>
+constexpr bool AllOf(bool b, T... t) {
+  return b && AllOf(t...);
+}
+
+template <typename Arg>
+constexpr Conv ArgumentToConv() {
+  return decltype(str_format_internal::FormatConvertImpl(
+      std::declval<const Arg&>(), std::declval<const ConversionSpec&>(),
+      std::declval<FormatSinkImpl*>()))::kConv;
+}
+
+#if ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+
+constexpr bool ContainsChar(const char* chars, char c) {
+  return *chars == c || (*chars && ContainsChar(chars + 1, c));
+}
+
+// A constexpr compatible list of Convs.
+struct ConvList {
+  const Conv* array;
+  int count;
+
+  // We do the bound check here to avoid having to do it on the callers.
+  // Returning an empty Conv has the same effect as short circuiting because it
+  // will never match any conversion.
+  constexpr Conv operator[](int i) const {
+    return i < count ? array[i] : Conv{};
+  }
+
+  constexpr ConvList without_front() const {
+    return count != 0 ? ConvList{array + 1, count - 1} : *this;
+  }
+};
+
+template <size_t count>
+struct ConvListT {
+  // Make sure the array has size > 0.
+  Conv list[count ? count : 1];
+};
+
+constexpr char GetChar(string_view str, size_t index) {
+  return index < str.size() ? str[index] : char{};
+}
+
+constexpr string_view ConsumeFront(string_view str, size_t len = 1) {
+  return len <= str.size() ? string_view(str.data() + len, str.size() - len)
+                           : string_view();
+}
+
+constexpr string_view ConsumeAnyOf(string_view format, const char* chars) {
+  return ContainsChar(chars, GetChar(format, 0))
+             ? ConsumeAnyOf(ConsumeFront(format), chars)
+             : format;
+}
+
+constexpr bool IsDigit(char c) { return c >= '0' && c <= '9'; }
+
+// Helper class for the ParseDigits function.
+// It encapsulates the two return values we need there.
+struct Integer {
+  string_view format;
+  int value;
+
+  // If the next character is a '$', consume it.
+  // Otherwise, make `this` an invalid positional argument.
+  constexpr Integer ConsumePositionalDollar() const {
+    return GetChar(format, 0) == '$' ? Integer{ConsumeFront(format), value}
+                                     : Integer{format, 0};
+  }
+};
+
+constexpr Integer ParseDigits(string_view format, int value = 0) {
+  return IsDigit(GetChar(format, 0))
+             ? ParseDigits(ConsumeFront(format),
+                           10 * value + GetChar(format, 0) - '0')
+             : Integer{format, value};
+}
+
+// Parse digits for a positional argument.
+// The parsing also consumes the '$'.
+constexpr Integer ParsePositional(string_view format) {
+  return ParseDigits(format).ConsumePositionalDollar();
+}
+
+// Parses a single conversion specifier.
+// See ConvParser::Run() for post conditions.
+class ConvParser {
+  constexpr ConvParser SetFormat(string_view format) const {
+    return ConvParser(format, args_, error_, arg_position_, is_positional_);
+  }
+
+  constexpr ConvParser SetArgs(ConvList args) const {
+    return ConvParser(format_, args, error_, arg_position_, is_positional_);
+  }
+
+  constexpr ConvParser SetError(bool error) const {
+    return ConvParser(format_, args_, error_ || error, arg_position_,
+                      is_positional_);
+  }
+
+  constexpr ConvParser SetArgPosition(int arg_position) const {
+    return ConvParser(format_, args_, error_, arg_position, is_positional_);
+  }
+
+  // Consumes the next arg and verifies that it matches `conv`.
+  // `error_` is set if there is no next arg or if it doesn't match `conv`.
+  constexpr ConvParser ConsumeNextArg(char conv) const {
+    return SetArgs(args_.without_front()).SetError(!Contains(args_[0], conv));
+  }
+
+  // Verify that positional argument `i.value` matches `conv`.
+  // `error_` is set if `i.value` is not a valid argument or if it doesn't
+  // match.
+  constexpr ConvParser VerifyPositional(Integer i, char conv) const {
+    return SetFormat(i.format).SetError(!Contains(args_[i.value - 1], conv));
+  }
+
+  // Parse the position of the arg and store it in `arg_position_`.
+  constexpr ConvParser ParseArgPosition(Integer arg) const {
+    return SetFormat(arg.format).SetArgPosition(arg.value);
+  }
+
+  // Consume the flags.
+  constexpr ConvParser ParseFlags() const {
+    return SetFormat(ConsumeAnyOf(format_, "-+ #0"));
+  }
+
+  // Consume the width.
+  // If it is '*', we verify that it matches `args_`. `error_` is set if it
+  // doesn't match.
+  constexpr ConvParser ParseWidth() const {
+    return IsDigit(GetChar(format_, 0))
+               ? SetFormat(ParseDigits(format_).format)
+               : GetChar(format_, 0) == '*'
+                     ? is_positional_
+                           ? VerifyPositional(
+                                 ParsePositional(ConsumeFront(format_)), '*')
+                           : SetFormat(ConsumeFront(format_))
+                                 .ConsumeNextArg('*')
+                     : *this;
+  }
+
+  // Consume the precision.
+  // If it is '*', we verify that it matches `args_`. `error_` is set if it
+  // doesn't match.
+  constexpr ConvParser ParsePrecision() const {
+    return GetChar(format_, 0) != '.'
+               ? *this
+               : GetChar(format_, 1) == '*'
+                     ? is_positional_
+                           ? VerifyPositional(
+                                 ParsePositional(ConsumeFront(format_, 2)), '*')
+                           : SetFormat(ConsumeFront(format_, 2))
+                                 .ConsumeNextArg('*')
+                     : SetFormat(ParseDigits(ConsumeFront(format_)).format);
+  }
+
+  // Consume the length characters.
+  constexpr ConvParser ParseLength() const {
+    return SetFormat(ConsumeAnyOf(format_, "lLhjztq"));
+  }
+
+  // Consume the conversion character and verify that it matches `args_`.
+  // `error_` is set if it doesn't match.
+  constexpr ConvParser ParseConversion() const {
+    return is_positional_
+               ? VerifyPositional({ConsumeFront(format_), arg_position_},
+                                  GetChar(format_, 0))
+               : ConsumeNextArg(GetChar(format_, 0))
+                     .SetFormat(ConsumeFront(format_));
+  }
+
+  constexpr ConvParser(string_view format, ConvList args, bool error,
+                       int arg_position, bool is_positional)
+      : format_(format),
+        args_(args),
+        error_(error),
+        arg_position_(arg_position),
+        is_positional_(is_positional) {}
+
+ public:
+  constexpr ConvParser(string_view format, ConvList args, bool is_positional)
+      : format_(format),
+        args_(args),
+        error_(false),
+        arg_position_(0),
+        is_positional_(is_positional) {}
+
+  // Consume the whole conversion specifier.
+  // `format()` will be set to the character after the conversion character.
+  // `error()` will be set if any of the arguments do not match.
+  constexpr ConvParser Run() const {
+    return (is_positional_ ? ParseArgPosition(ParsePositional(format_)) : *this)
+        .ParseFlags()
+        .ParseWidth()
+        .ParsePrecision()
+        .ParseLength()
+        .ParseConversion();
+  }
+
+  constexpr string_view format() const { return format_; }
+  constexpr ConvList args() const { return args_; }
+  constexpr bool error() const { return error_; }
+  constexpr bool is_positional() const { return is_positional_; }
+
+ private:
+  string_view format_;
+  // Current list of arguments. If we are not in positional mode we will consume
+  // from the front.
+  ConvList args_;
+  bool error_;
+  // Holds the argument position of the conversion character, if we are in
+  // positional mode. Otherwise, it is unspecified.
+  int arg_position_;
+  // Whether we are in positional mode.
+  // It changes the behavior of '*' and where to find the converted argument.
+  bool is_positional_;
+};
+
+// Parses a whole format expression.
+// See FormatParser::Run().
+class FormatParser {
+  static constexpr bool FoundPercent(string_view format) {
+    return format.empty() ||
+           (GetChar(format, 0) == '%' && GetChar(format, 1) != '%');
+  }
+
+  // We use an inner function to increase the recursion limit.
+  // The inner function consumes up to `limit` characters on every run.
+  // This increases the limit from 512 to ~512*limit.
+  static constexpr string_view ConsumeNonPercentInner(string_view format,
+                                                      int limit = 20) {
+    return FoundPercent(format) || !limit
+               ? format
+               : ConsumeNonPercentInner(
+                     ConsumeFront(format, GetChar(format, 0) == '%' &&
+                                                  GetChar(format, 1) == '%'
+                                              ? 2
+                                              : 1),
+                     limit - 1);
+  }
+
+  // Consume characters until the next conversion spec %.
+  // It skips %%.
+  static constexpr string_view ConsumeNonPercent(string_view format) {
+    return FoundPercent(format)
+               ? format
+               : ConsumeNonPercent(ConsumeNonPercentInner(format));
+  }
+
+  static constexpr bool IsPositional(string_view format) {
+    return IsDigit(GetChar(format, 0)) ? IsPositional(ConsumeFront(format))
+                                       : GetChar(format, 0) == '$';
+  }
+
+  constexpr bool RunImpl(bool is_positional) const {
+    // In non-positional mode we require all arguments to be consumed.
+    // In positional mode just reaching the end of the format without errors is
+    // enough.
+    return (format_.empty() && (is_positional || args_.count == 0)) ||
+           (!format_.empty() &&
+            ValidateArg(
+                ConvParser(ConsumeFront(format_), args_, is_positional).Run()));
+  }
+
+  constexpr bool ValidateArg(ConvParser conv) const {
+    return !conv.error() && FormatParser(conv.format(), conv.args())
+                                .RunImpl(conv.is_positional());
+  }
+
+ public:
+  constexpr FormatParser(string_view format, ConvList args)
+      : format_(ConsumeNonPercent(format)), args_(args) {}
+
+  // Runs the parser for `format` and `args`.
+  // It verifies that the format is valid and that all conversion specifiers
+  // match the arguments passed.
+  // In non-positional mode it also verfies that all arguments are consumed.
+  constexpr bool Run() const {
+    return RunImpl(!format_.empty() && IsPositional(ConsumeFront(format_)));
+  }
+
+ private:
+  string_view format_;
+  // Current list of arguments.
+  // If we are not in positional mode we will consume from the front and will
+  // have to be empty in the end.
+  ConvList args_;
+};
+
+template <Conv... C>
+constexpr bool ValidFormatImpl(string_view format) {
+  return FormatParser(format,
+                      {ConvListT<sizeof...(C)>{{C...}}.list, sizeof...(C)})
+      .Run();
+}
+
+#endif  // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+
+}  // namespace str_format_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_CHECKER_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h
new file mode 100644 (file)
index 0000000..eb81f8a
--- /dev/null
@@ -0,0 +1,411 @@
+//
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_
+
+#include <limits.h>
+#include <cstddef>
+#include <cstring>
+#include <ostream>
+
+#include "absl/base/port.h"
+#include "absl/strings/internal/str_format/output.h"
+#include "absl/strings/string_view.h"
+
+class Cord;
+
+namespace absl {
+
+namespace str_format_internal {
+
+class FormatRawSinkImpl {
+ public:
+  // Implicitly convert from any type that provides the hook function as
+  // described above.
+  template <typename T, decltype(str_format_internal::InvokeFlush(
+                            std::declval<T*>(), string_view()))* = nullptr>
+  FormatRawSinkImpl(T* raw)  // NOLINT
+      : sink_(raw), write_(&FormatRawSinkImpl::Flush<T>) {}
+
+  void Write(string_view s) { write_(sink_, s); }
+
+  template <typename T>
+  static FormatRawSinkImpl Extract(T s) {
+    return s.sink_;
+  }
+
+ private:
+  template <typename T>
+  static void Flush(void* r, string_view s) {
+    str_format_internal::InvokeFlush(static_cast<T*>(r), s);
+  }
+
+  void* sink_;
+  void (*write_)(void*, string_view);
+};
+
+// An abstraction to which conversions write their string data.
+class FormatSinkImpl {
+ public:
+  explicit FormatSinkImpl(FormatRawSinkImpl raw) : raw_(raw) {}
+
+  ~FormatSinkImpl() { Flush(); }
+
+  void Flush() {
+    raw_.Write(string_view(buf_, pos_ - buf_));
+    pos_ = buf_;
+  }
+
+  void Append(size_t n, char c) {
+    if (n == 0) return;
+    size_ += n;
+    auto raw_append = [&](size_t count) {
+      memset(pos_, c, count);
+      pos_ += count;
+    };
+    while (n > Avail()) {
+      n -= Avail();
+      if (Avail() > 0) {
+        raw_append(Avail());
+      }
+      Flush();
+    }
+    raw_append(n);
+  }
+
+  void Append(string_view v) {
+    size_t n = v.size();
+    if (n == 0) return;
+    size_ += n;
+    if (n >= Avail()) {
+      Flush();
+      raw_.Write(v);
+      return;
+    }
+    memcpy(pos_, v.data(), n);
+    pos_ += n;
+  }
+
+  size_t size() const { return size_; }
+
+  // Put 'v' to 'sink' with specified width, precision, and left flag.
+  bool PutPaddedString(string_view v, int w, int p, bool l);
+
+  template <typename T>
+  T Wrap() {
+    return T(this);
+  }
+
+  template <typename T>
+  static FormatSinkImpl* Extract(T* s) {
+    return s->sink_;
+  }
+
+ private:
+  size_t Avail() const { return buf_ + sizeof(buf_) - pos_; }
+
+  FormatRawSinkImpl raw_;
+  size_t size_ = 0;
+  char* pos_ = buf_;
+  char buf_[1024];
+};
+
+struct Flags {
+  bool basic : 1;     // fastest conversion: no flags, width, or precision
+  bool left : 1;      // "-"
+  bool show_pos : 1;  // "+"
+  bool sign_col : 1;  // " "
+  bool alt : 1;       // "#"
+  bool zero : 1;      // "0"
+  std::string ToString() const;
+  friend std::ostream& operator<<(std::ostream& os, const Flags& v) {
+    return os << v.ToString();
+  }
+};
+
+struct LengthMod {
+ public:
+  enum Id : uint8_t {
+    h, hh, l, ll, L, j, z, t, q, none
+  };
+  static const size_t kNumValues = none + 1;
+
+  LengthMod() : id_(none) {}
+
+  // Index into the opaque array of LengthMod enums.
+  // Requires: i < kNumValues
+  static LengthMod FromIndex(size_t i) {
+    return LengthMod(kSpecs[i].value);
+  }
+
+  static LengthMod FromId(Id id) { return LengthMod(id); }
+
+  // The length modifier std::string associated with a specified LengthMod.
+  string_view name() const {
+    const Spec& spec = kSpecs[id_];
+    return {spec.name, spec.name_length};
+  }
+
+  Id id() const { return id_; }
+
+  friend bool operator==(const LengthMod& a, const LengthMod& b) {
+    return a.id() == b.id();
+  }
+  friend bool operator!=(const LengthMod& a, const LengthMod& b) {
+    return !(a == b);
+  }
+  friend std::ostream& operator<<(std::ostream& os, const LengthMod& v) {
+    return os << v.name();
+  }
+
+ private:
+  struct Spec {
+    Id value;
+    const char *name;
+    size_t name_length;
+  };
+  static const Spec kSpecs[];
+
+  explicit LengthMod(Id id) : id_(id) {}
+
+  Id id_;
+};
+
+// clang-format off
+#define ABSL_CONVERSION_CHARS_EXPAND_(X_VAL, X_SEP) \
+  /* text */ \
+  X_VAL(c) X_SEP X_VAL(C) X_SEP X_VAL(s) X_SEP X_VAL(S) X_SEP \
+  /* ints */ \
+  X_VAL(d) X_SEP X_VAL(i) X_SEP X_VAL(o) X_SEP \
+  X_VAL(u) X_SEP X_VAL(x) X_SEP X_VAL(X) X_SEP \
+  /* floats */ \
+  X_VAL(f) X_SEP X_VAL(F) X_SEP X_VAL(e) X_SEP X_VAL(E) X_SEP \
+  X_VAL(g) X_SEP X_VAL(G) X_SEP X_VAL(a) X_SEP X_VAL(A) X_SEP \
+  /* misc */ \
+  X_VAL(n) X_SEP X_VAL(p)
+// clang-format on
+
+struct ConversionChar {
+ public:
+  enum Id : uint8_t {
+    c, C, s, S,              // text
+    d, i, o, u, x, X,        // int
+    f, F, e, E, g, G, a, A,  // float
+    n, p,                    // misc
+    none
+  };
+  static const size_t kNumValues = none + 1;
+
+  ConversionChar() : id_(none) {}
+
+ public:
+  // Index into the opaque array of ConversionChar enums.
+  // Requires: i < kNumValues
+  static ConversionChar FromIndex(size_t i) {
+    return ConversionChar(kSpecs[i].value);
+  }
+
+  static ConversionChar FromChar(char c) {
+    ConversionChar::Id out_id = ConversionChar::none;
+    switch (c) {
+#define X_VAL(id)                \
+  case #id[0]:                   \
+    out_id = ConversionChar::id; \
+    break;
+      ABSL_CONVERSION_CHARS_EXPAND_(X_VAL, )
+#undef X_VAL
+      default:
+        break;
+    }
+    return ConversionChar(out_id);
+  }
+
+  static ConversionChar FromId(Id id) { return ConversionChar(id); }
+  Id id() const { return id_; }
+
+  int radix() const {
+    switch (id()) {
+      case x: case X: case a: case A: case p: return 16;
+      case o: return 8;
+      default: return 10;
+    }
+  }
+
+  bool upper() const {
+    switch (id()) {
+      case X: case F: case E: case G: case A: return true;
+      default: return false;
+    }
+  }
+
+  bool is_signed() const {
+    switch (id()) {
+      case d: case i: return true;
+      default: return false;
+    }
+  }
+
+  bool is_integral() const {
+    switch (id()) {
+      case d: case i: case u: case o: case x: case X:
+        return true;
+      default: return false;
+    }
+  }
+
+  bool is_float() const {
+    switch (id()) {
+      case a: case e: case f: case g: case A: case E: case F: case G:
+        return true;
+      default: return false;
+    }
+  }
+
+  bool IsValid() const { return id() != none; }
+
+  // The associated char.
+  char Char() const { return kSpecs[id_].name; }
+
+  friend bool operator==(const ConversionChar& a, const ConversionChar& b) {
+    return a.id() == b.id();
+  }
+  friend bool operator!=(const ConversionChar& a, const ConversionChar& b) {
+    return !(a == b);
+  }
+  friend std::ostream& operator<<(std::ostream& os, const ConversionChar& v) {
+    char c = v.Char();
+    if (!c) c = '?';
+    return os << c;
+  }
+
+ private:
+  struct Spec {
+    Id value;
+    char name;
+  };
+  static const Spec kSpecs[];
+
+  explicit ConversionChar(Id id) : id_(id) {}
+
+  Id id_;
+};
+
+class ConversionSpec {
+ public:
+  Flags flags() const { return flags_; }
+  LengthMod length_mod() const { return length_mod_; }
+  ConversionChar conv() const {
+    // Keep this field first in the struct . It generates better code when
+    // accessing it when ConversionSpec is passed by value in registers.
+    static_assert(offsetof(ConversionSpec, conv_) == 0, "");
+    return conv_;
+  }
+
+  // Returns the specified width. If width is unspecfied, it returns a negative
+  // value.
+  int width() const { return width_; }
+  // Returns the specified precision. If precision is unspecfied, it returns a
+  // negative value.
+  int precision() const { return precision_; }
+
+  void set_flags(Flags f) { flags_ = f; }
+  void set_length_mod(LengthMod lm) { length_mod_ = lm; }
+  void set_conv(ConversionChar c) { conv_ = c; }
+  void set_width(int w) { width_ = w; }
+  void set_precision(int p) { precision_ = p; }
+  void set_left(bool b) { flags_.left = b; }
+
+ private:
+  ConversionChar conv_;
+  Flags flags_;
+  LengthMod length_mod_;
+  int width_;
+  int precision_;
+};
+
+constexpr uint64_t ConversionCharToConvValue(char conv) {
+  return
+#define CONV_SET_CASE(c) \
+  conv == #c[0] ? (uint64_t{1} << (1 + ConversionChar::Id::c)):
+      ABSL_CONVERSION_CHARS_EXPAND_(CONV_SET_CASE, )
+#undef CONV_SET_CASE
+                  conv == '*'
+          ? 1
+          : 0;
+}
+
+enum class Conv : uint64_t {
+#define CONV_SET_CASE(c) c = ConversionCharToConvValue(#c[0]),
+  ABSL_CONVERSION_CHARS_EXPAND_(CONV_SET_CASE, )
+#undef CONV_SET_CASE
+
+  // Used for width/precision '*' specification.
+  star = ConversionCharToConvValue('*'),
+
+  // Some predefined values:
+  integral = d | i | u | o | x | X,
+  floating = a | e | f | g | A | E | F | G,
+  numeric = integral | floating,
+  string = s,
+  pointer = p
+};
+
+// Type safe OR operator.
+// We need this for two reasons:
+//  1. operator| on enums makes them decay to integers and the result is an
+//     integer. We need the result to stay as an enum.
+//  2. We use "enum class" which would not work even if we accepted the decay.
+constexpr Conv operator|(Conv a, Conv b) {
+  return Conv(static_cast<uint64_t>(a) | static_cast<uint64_t>(b));
+}
+
+// Get a conversion with a single character in it.
+constexpr Conv ConversionCharToConv(char c) {
+  return Conv(ConversionCharToConvValue(c));
+}
+
+// Checks whether `c` exists in `set`.
+constexpr bool Contains(Conv set, char c) {
+  return (static_cast<uint64_t>(set) & ConversionCharToConvValue(c)) != 0;
+}
+
+// Checks whether all the characters in `c` are contained in `set`
+constexpr bool Contains(Conv set, Conv c) {
+  return (static_cast<uint64_t>(set) & static_cast<uint64_t>(c)) ==
+         static_cast<uint64_t>(c);
+}
+
+// Return type of the AbslFormatConvert() functions.
+// The Conv template parameter is used to inform the framework of what
+// conversion characters are supported by that AbslFormatConvert routine.
+template <Conv C>
+struct ConvertResult {
+  static constexpr Conv kConv = C;
+  bool value;
+};
+template <Conv C>
+constexpr Conv ConvertResult<C>::kConv;
+
+// Return capacity - used, clipped to a minimum of 0.
+inline size_t Excess(size_t used, size_t capacity) {
+  return used < capacity ? capacity - used : 0;
+}
+
+}  // namespace str_format_internal
+
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h
new file mode 100644 (file)
index 0000000..8ba5566
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_
+
+#include "absl/strings/internal/str_format/extension.h"
+
+namespace absl {
+namespace str_format_internal {
+
+bool ConvertFloatImpl(float v, const ConversionSpec &conv,
+                      FormatSinkImpl *sink);
+
+bool ConvertFloatImpl(double v, const ConversionSpec &conv,
+                      FormatSinkImpl *sink);
+
+bool ConvertFloatImpl(long double v, const ConversionSpec &conv,
+                      FormatSinkImpl *sink);
+
+}  // namespace str_format_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_FLOAT_CONVERSION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/output.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/output.h
new file mode 100644 (file)
index 0000000..42da641
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Output extension hooks for the Format library.
+// `internal::InvokeFlush` calls the appropriate flush function for the
+// specified output argument.
+// `BufferRawSink` is a simple output sink for a char buffer. Used by SnprintF.
+// `FILERawSink` is a std::FILE* based sink. Used by PrintF and FprintF.
+
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_
+
+#include <cstdio>
+#include <ostream>
+#include <string>
+
+#include "absl/base/port.h"
+#include "absl/strings/string_view.h"
+
+class Cord;
+
+namespace absl {
+namespace str_format_internal {
+
+// RawSink implementation that writes into a char* buffer.
+// It will not overflow the buffer, but will keep the total count of chars
+// that would have been written.
+class BufferRawSink {
+ public:
+  BufferRawSink(char* buffer, size_t size) : buffer_(buffer), size_(size) {}
+
+  size_t total_written() const { return total_written_; }
+  void Write(string_view v);
+
+ private:
+  char* buffer_;
+  size_t size_;
+  size_t total_written_ = 0;
+};
+
+// RawSink implementation that writes into a FILE*.
+// It keeps track of the total number of bytes written and any error encountered
+// during the writes.
+class FILERawSink {
+ public:
+  explicit FILERawSink(std::FILE* output) : output_(output) {}
+
+  void Write(string_view v);
+
+  size_t count() const { return count_; }
+  int error() const { return error_; }
+
+ private:
+  std::FILE* output_;
+  int error_ = 0;
+  size_t count_ = 0;
+};
+
+// Provide RawSink integration with common types from the STL.
+inline void AbslFormatFlush(std::string* out, string_view s) {
+  out->append(s.data(), s.size());
+}
+inline void AbslFormatFlush(std::ostream* out, string_view s) {
+  out->write(s.data(), s.size());
+}
+
+template <class AbslCord, typename = typename std::enable_if<
+                              std::is_same<AbslCord, ::Cord>::value>::type>
+inline void AbslFormatFlush(AbslCord* out, string_view s) {
+  out->Append(s);
+}
+
+inline void AbslFormatFlush(FILERawSink* sink, string_view v) {
+  sink->Write(v);
+}
+
+inline void AbslFormatFlush(BufferRawSink* sink, string_view v) {
+  sink->Write(v);
+}
+
+template <typename T>
+auto InvokeFlush(T* out, string_view s)
+    -> decltype(str_format_internal::AbslFormatFlush(out, s)) {
+  str_format_internal::AbslFormatFlush(out, s);
+}
+
+}  // namespace str_format_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_OUTPUT_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h
new file mode 100644 (file)
index 0000000..b7614a0
--- /dev/null
@@ -0,0 +1,322 @@
+#ifndef ABSL_STRINGS_INTERNAL_STR_FORMAT_PARSER_H_
+#define ABSL_STRINGS_INTERNAL_STR_FORMAT_PARSER_H_
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <cassert>
+#include <initializer_list>
+#include <iosfwd>
+#include <iterator>
+#include <memory>
+#include <vector>
+
+#include "absl/strings/internal/str_format/checker.h"
+#include "absl/strings/internal/str_format/extension.h"
+
+namespace absl {
+namespace str_format_internal {
+
+// The analyzed properties of a single specified conversion.
+struct UnboundConversion {
+  UnboundConversion()
+      : flags() /* This is required to zero all the fields of flags. */ {
+    flags.basic = true;
+  }
+
+  class InputValue {
+   public:
+    void set_value(int value) {
+      assert(value >= 0);
+      value_ = value;
+    }
+    int value() const { return value_; }
+
+    // Marks the value as "from arg". aka the '*' format.
+    // Requires `value >= 1`.
+    // When set, is_from_arg() return true and get_from_arg() returns the
+    // original value.
+    // `value()`'s return value is unspecfied in this state.
+    void set_from_arg(int value) {
+      assert(value > 0);
+      value_ = -value - 1;
+    }
+    bool is_from_arg() const { return value_ < -1; }
+    int get_from_arg() const {
+      assert(is_from_arg());
+      return -value_ - 1;
+    }
+
+   private:
+    int value_ = -1;
+  };
+
+  // No need to initialize. It will always be set in the parser.
+  int arg_position;
+
+  InputValue width;
+  InputValue precision;
+
+  Flags flags;
+  LengthMod length_mod;
+  ConversionChar conv;
+};
+
+// Consume conversion spec prefix (not including '%') of [p, end) if valid.
+// Examples of valid specs would be e.g.: "s", "d", "-12.6f".
+// If valid, it returns the first character following the conversion spec,
+// and the spec part is broken down and returned in 'conv'.
+// If invalid, returns nullptr.
+const char* ConsumeUnboundConversion(const char* p, const char* end,
+                                     UnboundConversion* conv, int* next_arg);
+
+// Helper tag class for the table below.
+// It allows fast `char -> ConversionChar/LengthMod` checking and conversions.
+class ConvTag {
+ public:
+  constexpr ConvTag(ConversionChar::Id id) : tag_(id) {}  // NOLINT
+  // We invert the length modifiers to make them negative so that we can easily
+  // test for them.
+  constexpr ConvTag(LengthMod::Id id) : tag_(~id) {}  // NOLINT
+  // Everything else is -128, which is negative to make is_conv() simpler.
+  constexpr ConvTag() : tag_(-128) {}
+
+  bool is_conv() const { return tag_ >= 0; }
+  bool is_length() const { return tag_ < 0 && tag_ != -128; }
+  ConversionChar as_conv() const {
+    assert(is_conv());
+    return ConversionChar::FromId(static_cast<ConversionChar::Id>(tag_));
+  }
+  LengthMod as_length() const {
+    assert(is_length());
+    return LengthMod::FromId(static_cast<LengthMod::Id>(~tag_));
+  }
+
+ private:
+  std::int8_t tag_;
+};
+
+extern const ConvTag kTags[256];
+// Keep a single table for all the conversion chars and length modifiers.
+inline ConvTag GetTagForChar(char c) {
+  return kTags[static_cast<unsigned char>(c)];
+}
+
+// Parse the format string provided in 'src' and pass the identified items into
+// 'consumer'.
+// Text runs will be passed by calling
+//   Consumer::Append(string_view);
+// ConversionItems will be passed by calling
+//   Consumer::ConvertOne(UnboundConversion, string_view);
+// In the case of ConvertOne, the string_view that is passed is the
+// portion of the format string corresponding to the conversion, not including
+// the leading %. On success, it returns true. On failure, it stops and returns
+// false.
+template <typename Consumer>
+bool ParseFormatString(string_view src, Consumer consumer) {
+  int next_arg = 0;
+  const char* p = src.data();
+  const char* const end = p + src.size();
+  while (p != end) {
+    const char* percent = static_cast<const char*>(memchr(p, '%', end - p));
+    if (!percent) {
+      // We found the last substring.
+      return consumer.Append(string_view(p, end - p));
+    }
+    // We found a percent, so push the text run then process the percent.
+    if (ABSL_PREDICT_FALSE(!consumer.Append(string_view(p, percent - p)))) {
+      return false;
+    }
+    if (ABSL_PREDICT_FALSE(percent + 1 >= end)) return false;
+
+    auto tag = GetTagForChar(percent[1]);
+    if (tag.is_conv()) {
+      if (ABSL_PREDICT_FALSE(next_arg < 0)) {
+        // This indicates an error in the format std::string.
+        // The only way to get `next_arg < 0` here is to have a positional
+        // argument first which sets next_arg to -1 and then a non-positional
+        // argument.
+        return false;
+      }
+      p = percent + 2;
+
+      // Keep this case separate from the one below.
+      // ConvertOne is more efficient when the compiler can see that the `basic`
+      // flag is set.
+      UnboundConversion conv;
+      conv.conv = tag.as_conv();
+      conv.arg_position = ++next_arg;
+      if (ABSL_PREDICT_FALSE(
+              !consumer.ConvertOne(conv, string_view(percent + 1, 1)))) {
+        return false;
+      }
+    } else if (percent[1] != '%') {
+      UnboundConversion conv;
+      p = ConsumeUnboundConversion(percent + 1, end, &conv, &next_arg);
+      if (ABSL_PREDICT_FALSE(p == nullptr)) return false;
+      if (ABSL_PREDICT_FALSE(!consumer.ConvertOne(
+          conv, string_view(percent + 1, p - (percent + 1))))) {
+        return false;
+      }
+    } else {
+      if (ABSL_PREDICT_FALSE(!consumer.Append("%"))) return false;
+      p = percent + 2;
+      continue;
+    }
+  }
+  return true;
+}
+
+// Always returns true, or fails to compile in a constexpr context if s does not
+// point to a constexpr char array.
+constexpr bool EnsureConstexpr(string_view s) {
+  return s.empty() || s[0] == s[0];
+}
+
+class ParsedFormatBase {
+ public:
+  explicit ParsedFormatBase(string_view format, bool allow_ignored,
+                            std::initializer_list<Conv> convs);
+
+  ParsedFormatBase(const ParsedFormatBase& other) { *this = other; }
+
+  ParsedFormatBase(ParsedFormatBase&& other) { *this = std::move(other); }
+
+  ParsedFormatBase& operator=(const ParsedFormatBase& other) {
+    if (this == &other) return *this;
+    has_error_ = other.has_error_;
+    items_ = other.items_;
+    size_t text_size = items_.empty() ? 0 : items_.back().text_end;
+    data_.reset(new char[text_size]);
+    memcpy(data_.get(), other.data_.get(), text_size);
+    return *this;
+  }
+
+  ParsedFormatBase& operator=(ParsedFormatBase&& other) {
+    if (this == &other) return *this;
+    has_error_ = other.has_error_;
+    data_ = std::move(other.data_);
+    items_ = std::move(other.items_);
+    // Reset the vector to make sure the invariants hold.
+    other.items_.clear();
+    return *this;
+  }
+
+  template <typename Consumer>
+  bool ProcessFormat(Consumer consumer) const {
+    const char* const base = data_.get();
+    string_view text(base, 0);
+    for (const auto& item : items_) {
+      const char* const end = text.data() + text.size();
+      text = string_view(end, (base + item.text_end) - end);
+      if (item.is_conversion) {
+        if (!consumer.ConvertOne(item.conv, text)) return false;
+      } else {
+        if (!consumer.Append(text)) return false;
+      }
+    }
+    return !has_error_;
+  }
+
+  bool has_error() const { return has_error_; }
+
+ private:
+  // Returns whether the conversions match and if !allow_ignored it verifies
+  // that all conversions are used by the format.
+  bool MatchesConversions(bool allow_ignored,
+                          std::initializer_list<Conv> convs) const;
+
+  struct ParsedFormatConsumer;
+
+  struct ConversionItem {
+    bool is_conversion;
+    // Points to the past-the-end location of this element in the data_ array.
+    size_t text_end;
+    UnboundConversion conv;
+  };
+
+  bool has_error_;
+  std::unique_ptr<char[]> data_;
+  std::vector<ConversionItem> items_;
+};
+
+
+// A value type representing a preparsed format.  These can be created, copied
+// around, and reused to speed up formatting loops.
+// The user must specify through the template arguments the conversion
+// characters used in the format. This will be checked at compile time.
+//
+// This class uses Conv enum values to specify each argument.
+// This allows for more flexibility as you can specify multiple possible
+// conversion characters for each argument.
+// ParsedFormat<char...> is a simplified alias for when the user only
+// needs to specify a single conversion character for each argument.
+//
+// Example:
+//   // Extended format supports multiple characters per argument:
+//   using MyFormat = ExtendedParsedFormat<Conv::d | Conv::x>;
+//   MyFormat GetFormat(bool use_hex) {
+//     if (use_hex) return MyFormat("foo %x bar");
+//     return MyFormat("foo %d bar");
+//   }
+//   // 'format' can be used with any value that supports 'd' and 'x',
+//   // like `int`.
+//   auto format = GetFormat(use_hex);
+//   value = StringF(format, i);
+//
+// This class also supports runtime format checking with the ::New() and
+// ::NewAllowIgnored() factory functions.
+// This is the only API that allows the user to pass a runtime specified format
+// string. These factory functions will return NULL if the format does not match
+// the conversions requested by the user.
+template <str_format_internal::Conv... C>
+class ExtendedParsedFormat : public str_format_internal::ParsedFormatBase {
+ public:
+  explicit ExtendedParsedFormat(string_view format)
+#if ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+      __attribute__((
+          enable_if(str_format_internal::EnsureConstexpr(format),
+                    "Format std::string is not constexpr."),
+          enable_if(str_format_internal::ValidFormatImpl<C...>(format),
+                    "Format specified does not match the template arguments.")))
+#endif  // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
+      : ExtendedParsedFormat(format, false) {
+  }
+
+  // ExtendedParsedFormat factory function.
+  // The user still has to specify the conversion characters, but they will not
+  // be checked at compile time. Instead, it will be checked at runtime.
+  // This delays the checking to runtime, but allows the user to pass
+  // dynamically sourced formats.
+  // It returns NULL if the format does not match the conversion characters.
+  // The user is responsible for checking the return value before using it.
+  //
+  // The 'New' variant will check that all the specified arguments are being
+  // consumed by the format and return NULL if any argument is being ignored.
+  // The 'NewAllowIgnored' variant will not verify this and will allow formats
+  // that ignore arguments.
+  static std::unique_ptr<ExtendedParsedFormat> New(string_view format) {
+    return New(format, false);
+  }
+  static std::unique_ptr<ExtendedParsedFormat> NewAllowIgnored(
+      string_view format) {
+    return New(format, true);
+  }
+
+ private:
+  static std::unique_ptr<ExtendedParsedFormat> New(string_view format,
+                                                   bool allow_ignored) {
+    std::unique_ptr<ExtendedParsedFormat> conv(
+        new ExtendedParsedFormat(format, allow_ignored));
+    if (conv->has_error()) return nullptr;
+    return conv;
+  }
+
+  ExtendedParsedFormat(string_view s, bool allow_ignored)
+      : ParsedFormatBase(s, allow_ignored, {C...}) {}
+};
+}  // namespace str_format_internal
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_INTERNAL_STR_FORMAT_PARSER_H_
index e73f1dd..7c35f4d 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #ifndef ABSL_STRINGS_INTERNAL_STR_JOIN_INTERNAL_H_
 #define ABSL_STRINGS_INTERNAL_STR_JOIN_INTERNAL_H_
 
-#include <cassert>
+#include <cstring>
 #include <iterator>
 #include <memory>
 #include <string>
+#include <type_traits>
 #include <utility>
 
 #include "absl/strings/internal/ostringstream.h"
+#include "absl/strings/internal/resize_uninitialized.h"
 #include "absl/strings/str_cat.h"
 
 namespace absl {
@@ -187,11 +189,11 @@ struct DefaultFormatter<std::unique_ptr<ValueType>>
 //
 
 // The main joining algorithm. This simply joins the elements in the given
-// iterator range, each separated by the given separator, into an output std::string,
+// iterator range, each separated by the given separator, into an output string,
 // and formats each element using the provided Formatter object.
 template <typename Iterator, typename Formatter>
 std::string JoinAlgorithm(Iterator start, Iterator end, absl::string_view s,
-                     Formatter&& f) {
+                          Formatter&& f) {
   std::string result;
   absl::string_view sep("");
   for (Iterator it = start; it != end; ++it) {
@@ -202,54 +204,49 @@ std::string JoinAlgorithm(Iterator start, Iterator end, absl::string_view s,
   return result;
 }
 
-// No-op placeholder for input iterators which can not be iterated over.
-template <typename Iterator>
-size_t GetResultSize(Iterator, Iterator, size_t, std::input_iterator_tag) {
-  return 0;
-}
-
-// Calculates space to reserve, if the iterator supports multiple passes.
-template <typename Iterator>
-size_t GetResultSize(Iterator it, Iterator end, size_t separator_size,
-                     std::forward_iterator_tag) {
-  assert(it != end);
-  size_t length = it->size();
-  while (++it != end) {
-    length += separator_size;
-    length += it->size();
-  }
-  return length;
-}
-
-// A joining algorithm that's optimized for an iterator range of std::string-like
-// objects that do not need any additional formatting. This is to optimize the
-// common case of joining, say, a std::vector<std::string> or a
+// A joining algorithm that's optimized for a forward iterator range of
+// string-like objects that do not need any additional formatting. This is to
+// optimize the common case of joining, say, a std::vector<string> or a
 // std::vector<absl::string_view>.
 //
 // This is an overload of the previous JoinAlgorithm() function. Here the
 // Formatter argument is of type NoFormatter. Since NoFormatter is an internal
 // type, this overload is only invoked when strings::Join() is called with a
-// range of std::string-like objects (e.g., std::string, absl::string_view), and an
+// range of string-like objects (e.g., std::string, absl::string_view), and an
 // explicit Formatter argument was NOT specified.
 //
 // The optimization is that the needed space will be reserved in the output
-// std::string to avoid the need to resize while appending. To do this, the iterator
+// string to avoid the need to resize while appending. To do this, the iterator
 // range will be traversed twice: once to calculate the total needed size, and
-// then again to copy the elements and delimiters to the output std::string.
-template <typename Iterator>
+// then again to copy the elements and delimiters to the output string.
+template <typename Iterator,
+          typename = typename std::enable_if<std::is_convertible<
+              typename std::iterator_traits<Iterator>::iterator_category,
+              std::forward_iterator_tag>::value>::type>
 std::string JoinAlgorithm(Iterator start, Iterator end, absl::string_view s,
-                     NoFormatter) {
+                          NoFormatter) {
   std::string result;
   if (start != end) {
-    typename std::iterator_traits<Iterator>::iterator_category iterator_tag;
-    result.reserve(GetResultSize(start, end, s.size(), iterator_tag));
-
-    // Joins strings
-    absl::string_view sep("", 0);
-    for (Iterator it = start; it != end; ++it) {
-      result.append(sep.data(), sep.size());
-      result.append(it->data(), it->size());
-      sep = s;
+    // Sums size
+    size_t result_size = start->size();
+    for (Iterator it = start; ++it != end;) {
+      result_size += s.size();
+      result_size += it->size();
+    }
+
+    if (result_size > 0) {
+      STLStringResizeUninitialized(&result, result_size);
+
+      // Joins strings
+      char* result_buf = &*result.begin();
+      memcpy(result_buf, start->data(), start->size());
+      result_buf += start->size();
+      for (Iterator it = start; ++it != end;) {
+        memcpy(result_buf, s.data(), s.size());
+        result_buf += s.size();
+        memcpy(result_buf, it->data(), it->size());
+        result_buf += it->size();
+      }
     }
   }
 
@@ -279,14 +276,15 @@ struct JoinTupleLoop<N, N> {
 
 template <typename... T, typename Formatter>
 std::string JoinAlgorithm(const std::tuple<T...>& tup, absl::string_view sep,
-                     Formatter&& fmt) {
+                          Formatter&& fmt) {
   std::string result;
   JoinTupleLoop<0, sizeof...(T)>()(&result, tup, sep, fmt);
   return result;
 }
 
 template <typename Iterator>
-std::string JoinRange(Iterator first, Iterator last, absl::string_view separator) {
+std::string JoinRange(Iterator first, Iterator last,
+                      absl::string_view separator) {
   // No formatter was explicitly given, so a default must be chosen.
   typedef typename std::iterator_traits<Iterator>::value_type ValueType;
   typedef typename DefaultFormatter<ValueType>::Type Formatter;
@@ -295,7 +293,7 @@ std::string JoinRange(Iterator first, Iterator last, absl::string_view separator
 
 template <typename Range, typename Formatter>
 std::string JoinRange(const Range& range, absl::string_view separator,
-                 Formatter&& fmt) {
+                      Formatter&& fmt) {
   using std::begin;
   using std::end;
   return JoinAlgorithm(begin(range), end(range), separator, fmt);
index dc31a8e..52f6222 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #ifndef ABSL_STRINGS_INTERNAL_STR_SPLIT_INTERNAL_H_
 #define ABSL_STRINGS_INTERNAL_STR_SPLIT_INTERNAL_H_
 
-#ifdef _GLIBCXX_DEBUG
-#include <glibcxx_debug_traits.h>
-#endif  // _GLIBCXX_DEBUG
-
 #include <array>
 #include <initializer_list>
 #include <iterator>
 #include "absl/meta/type_traits.h"
 #include "absl/strings/string_view.h"
 
-namespace absl {
-namespace strings_internal {
-
 #ifdef _GLIBCXX_DEBUG
-using ::glibcxx_debug_traits::IsStrictlyDebugWrapperBase;
-#else  // _GLIBCXX_DEBUG
-template <typename T> struct IsStrictlyDebugWrapperBase : std::false_type {};
+#include "absl/strings/internal/stl_type_traits.h"
 #endif  // _GLIBCXX_DEBUG
 
+namespace absl {
+namespace strings_internal {
+
 // This class is implicitly constructible from everything that absl::string_view
 // is implicitly constructible from. If it's constructed from a temporary
-// std::string, the data is moved into a data member so its lifetime matches that of
+// string, the data is moved into a data member so its lifetime matches that of
 // the ConvertibleToStringView instance.
 class ConvertibleToStringView {
  public:
@@ -102,13 +96,13 @@ ConvertibleToStringView(std::string&& s)  // NOLINT(runtime/explicit)
     }
   }
 
-  // Holds the data moved from temporary std::string arguments. Declared first so
-  // that 'value' can refer to 'copy_'.
+  // Holds the data moved from temporary std::string arguments. Declared first
+  // so that 'value' can refer to 'copy_'.
   std::string copy_;
   absl::string_view value_;
 };
 
-// An iterator that enumerates the parts of a std::string from a Splitter. The text
+// An iterator that enumerates the parts of a string from a Splitter. The text
 // to be split, the Delimiter, and the Predicate are all taken from the given
 // Splitter object. Iterators may only be compared if they refer to the same
 // Splitter instance.
@@ -165,7 +159,7 @@ class SplitIterator {
       }
       const absl::string_view text = splitter_->text();
       const absl::string_view d = delimiter_.Find(text, pos_);
-      if (d.data() == text.end()) state_ = kLastState;
+      if (d.data() == text.data() + text.size()) state_ = kLastState;
       curr_ = text.substr(pos_, d.data() - (text.data() + pos_));
       pos_ += curr_.size() + d.size();
     } while (!predicate_(curr_));
@@ -234,13 +228,32 @@ struct IsInitializerList
 // compiled in C++11 will get an error due to ambiguous conversion paths (in
 // C++11 std::vector<T>::operator= is overloaded to take either a std::vector<T>
 // or an std::initializer_list<T>).
+
+template <typename C, bool has_value_type, bool has_mapped_type>
+struct SplitterIsConvertibleToImpl : std::false_type {};
+
+template <typename C>
+struct SplitterIsConvertibleToImpl<C, true, false>
+    : std::is_constructible<typename C::value_type, absl::string_view> {};
+
+template <typename C>
+struct SplitterIsConvertibleToImpl<C, true, true>
+    : absl::conjunction<
+          std::is_constructible<typename C::key_type, absl::string_view>,
+          std::is_constructible<typename C::mapped_type, absl::string_view>> {};
+
 template <typename C>
 struct SplitterIsConvertibleTo
-    : std::enable_if<
-          !IsStrictlyDebugWrapperBase<C>::value &&
-          !IsInitializerList<C>::value &&
-          HasValueType<C>::value &&
-          HasConstIterator<C>::value> {};
+    : SplitterIsConvertibleToImpl<
+          C,
+#ifdef _GLIBCXX_DEBUG
+          !IsStrictlyBaseOfAndConvertibleToSTLContainer<C>::value &&
+#endif  // _GLIBCXX_DEBUG
+              !IsInitializerList<
+                  typename std::remove_reference<C>::type>::value &&
+              HasValueType<C>::value && HasConstIterator<C>::value,
+          HasMappedType<C>::value> {
+};
 
 // This class implements the range that is returned by absl::StrSplit(). This
 // class has templated conversion operators that allow it to be implicitly
@@ -285,7 +298,8 @@ class Splitter {
   // An implicit conversion operator that is restricted to only those containers
   // that the splitter is convertible to.
   template <typename Container,
-            typename OnlyIf = typename SplitterIsConvertibleTo<Container>::type>
+            typename = typename std::enable_if<
+                SplitterIsConvertibleTo<Container>::value>::type>
   operator Container() const {  // NOLINT(runtime/explicit)
     return ConvertToContainer<Container, typename Container::value_type,
                               HasMappedType<Container>::value>()(*this);
@@ -362,10 +376,10 @@ class Splitter {
 
   // Partial specialization for a std::vector<std::string>.
   //
-  // Optimized for the common case of splitting to a std::vector<std::string>. In
-  // this case we first split the results to a std::vector<absl::string_view> so
-  // the returned std::vector<std::string> can have space reserved to avoid std::string
-  // moves.
+  // Optimized for the common case of splitting to a std::vector<std::string>.
+  // In this case we first split the results to a std::vector<absl::string_view>
+  // so the returned std::vector<std::string> can have space reserved to avoid
+  // std::string moves.
   template <typename A>
   struct ConvertToContainer<std::vector<std::string, A>, std::string, false> {
     std::vector<std::string, A> operator()(const Splitter& splitter) const {
index 705eea7..0423630 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // limitations under the License.
 //
 // UTF8 utilities, implemented to reduce dependencies.
-//
-// If you need Unicode specific processing (for example being aware of
-// Unicode character boundaries, or knowledge of Unicode casing rules,
-// or various forms of equivalence and normalization), take a look at
-// files in i18n/utf8.
 
 #ifndef ABSL_STRINGS_INTERNAL_UTF8_H_
 #define ABSL_STRINGS_INTERNAL_UTF8_H_
@@ -25,7 +20,6 @@
 #include <cstddef>
 #include <cstdint>
 
-
 namespace absl {
 namespace strings_internal {
 
index 4ac35f1..762f359 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,7 +17,7 @@
 // File: match.h
 // -----------------------------------------------------------------------------
 //
-// This file contains simple utilities for performing std::string matching checks.
+// This file contains simple utilities for performing string matching checks.
 // All of these function parameters are specified as `absl::string_view`,
 // meaning that these functions can accept `std::string`, `absl::string_view` or
 // nul-terminated C-style strings.
@@ -25,7 +25,7 @@
 // Examples:
 //   std::string s = "foo";
 //   absl::string_view sv = "f";
-//   EXPECT_TRUE(absl::StrContains(s, sv));
+//   assert(absl::StrContains(s, sv));
 //
 // Note: The order of parameters in these functions is designed to mimic the
 // order an equivalent member function would exhibit;
@@ -41,41 +41,46 @@ namespace absl {
 
 // StrContains()
 //
-// Returns whether a given std::string `haystack` contains the substring `needle`.
+// Returns whether a given string `haystack` contains the substring `needle`.
 inline bool StrContains(absl::string_view haystack, absl::string_view needle) {
-  return static_cast<absl::string_view::size_type>(haystack.find(needle, 0)) !=
-         haystack.npos;
+  return haystack.find(needle, 0) != haystack.npos;
 }
 
 // StartsWith()
 //
-// Returns whether a given std::string `text` begins with `prefix`.
+// Returns whether a given string `text` begins with `prefix`.
 inline bool StartsWith(absl::string_view text, absl::string_view prefix) {
   return prefix.empty() ||
          (text.size() >= prefix.size() &&
-         memcmp(text.data(), prefix.data(), prefix.size()) == 0);
+          memcmp(text.data(), prefix.data(), prefix.size()) == 0);
 }
 
 // EndsWith()
 //
-// Returns whether a given std::string `text` ends with `suffix`.
+// Returns whether a given string `text` ends with `suffix`.
 inline bool EndsWith(absl::string_view text, absl::string_view suffix) {
   return suffix.empty() ||
          (text.size() >= suffix.size() &&
           memcmp(text.data() + (text.size() - suffix.size()), suffix.data(),
-  suffix.size()) == 0);
+                 suffix.size()) == 0);
 }
 
-// StartsWithIgnoreCase()
+// EqualsIgnoreCase()
 //
-// Returns whether a given std::string `text` starts with `starts_with`, ignoring
+// Returns whether given ASCII strings `piece1` and `piece2` are equal, ignoring
 // case in the comparison.
+bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2);
+
+// StartsWithIgnoreCase()
+//
+// Returns whether a given ASCII string `text` starts with `prefix`,
+// ignoring case in the comparison.
 bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix);
 
 // EndsWithIgnoreCase()
 //
-// Returns whether a given std::string `text` ends with `ends_with`, ignoring case
-// in the comparison.
+// Returns whether a given ASCII string `text` ends with `suffix`, ignoring
+// case in the comparison.
 bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix);
 
 }  // namespace absl
index 74aebc8..e0f96df 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,32 +41,41 @@ namespace absl {
 
 // SimpleAtoi()
 //
-// Converts the given std::string into an integer value, returning `true` if
-// successful. The std::string must reflect a base-10 integer (optionally followed or
+// Converts the given string into an integer value, returning `true` if
+// successful. The string must reflect a base-10 integer (optionally followed or
 // preceded by ASCII whitespace) whose value falls within the range of the
-// integer type,
+// integer type. If any errors are encountered, this function returns `false`,
+// leaving `out` in an unspecified state.
 template <typename int_type>
 ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view s, int_type* out);
 
 // SimpleAtof()
 //
-// Converts the given std::string (optionally followed or preceded by ASCII
+// Converts the given string (optionally followed or preceded by ASCII
 // whitespace) into a float, which may be rounded on overflow or underflow.
-ABSL_MUST_USE_RESULT bool SimpleAtof(absl::string_view str, float* value);
+// See https://en.cppreference.com/w/c/string/byte/strtof for details about the
+// allowed formats for `str`. If any errors are encountered, this function
+// returns `false`, leaving `out` in an unspecified state.
+ABSL_MUST_USE_RESULT bool SimpleAtof(absl::string_view str, float* out);
 
 // SimpleAtod()
 //
-// Converts the given std::string (optionally followed or preceded by ASCII
+// Converts the given string (optionally followed or preceded by ASCII
 // whitespace) into a double, which may be rounded on overflow or underflow.
-ABSL_MUST_USE_RESULT bool SimpleAtod(absl::string_view str, double* value);
+// See https://en.cppreference.com/w/c/string/byte/strtof for details about the
+// allowed formats for `str`. If any errors are encountered, this function
+// returns `false`, leaving `out` in an unspecified state.
+ABSL_MUST_USE_RESULT bool SimpleAtod(absl::string_view str, double* out);
 
 // SimpleAtob()
 //
-// Converts the given std::string into into a boolean, returning `true` if
-// successful. The following case-insensitive strings are interpreted as boolean
-// `true`: "true", "t", "yes", "y", "1". The following case-insensitive strings
-// are interpreted as boolean `false`: "false", "f", "no", "n", "0".
-ABSL_MUST_USE_RESULT bool SimpleAtob(absl::string_view str, bool* value);
+// Converts the given string into a boolean, returning `true` if successful.
+// The following case-insensitive strings are interpreted as boolean `true`:
+// "true", "t", "yes", "y", "1". The following case-insensitive strings
+// are interpreted as boolean `false`: "false", "f", "no", "n", "0". If any
+// errors are encountered, this function returns `false`, leaving `out` in an
+// unspecified state.
+ABSL_MUST_USE_RESULT bool SimpleAtob(absl::string_view str, bool* out);
 
 }  // namespace absl
 
@@ -81,14 +90,6 @@ bool safe_strto64_base(absl::string_view text, int64_t* value, int base);
 bool safe_strtou32_base(absl::string_view text, uint32_t* value, int base);
 bool safe_strtou64_base(absl::string_view text, uint64_t* value, int base);
 
-// These functions are intended for speed. All functions take an output buffer
-// as an argument and return a pointer to the last byte they wrote, which is the
-// terminating '\0'. At most `kFastToBufferSize` bytes are written.
-char* FastInt32ToBuffer(int32_t i, char* buffer);
-char* FastUInt32ToBuffer(uint32_t i, char* buffer);
-char* FastInt64ToBuffer(int64_t i, char* buffer);
-char* FastUInt64ToBuffer(uint64_t i, char* buffer);
-
 static const int kFastToBufferSize = 32;
 static const int kSixDigitsToBufferSize = 16;
 
@@ -100,6 +101,16 @@ static const int kSixDigitsToBufferSize = 16;
 // Required buffer size is `kSixDigitsToBufferSize`.
 size_t SixDigitsToBuffer(double d, char* buffer);
 
+// These functions are intended for speed. All functions take an output buffer
+// as an argument and return a pointer to the last byte they wrote, which is the
+// terminating '\0'. At most `kFastToBufferSize` bytes are written.
+char* FastIntToBuffer(int32_t, char*);
+char* FastIntToBuffer(uint32_t, char*);
+char* FastIntToBuffer(int64_t, char*);
+char* FastIntToBuffer(uint64_t, char*);
+
+// For enums and integer types that are not an exact match for the types above,
+// use templates to call the appropriate one of the four overloads above.
 template <typename int_type>
 char* FastIntToBuffer(int_type i, char* buffer) {
   static_assert(sizeof(i) <= 64 / 8,
@@ -109,30 +120,24 @@ char* FastIntToBuffer(int_type i, char* buffer) {
   // If one day something like std::is_signed<enum E> works, switch to it.
   if (static_cast<int_type>(1) - 2 < 0) {  // Signed
     if (sizeof(i) > 32 / 8) {           // 33-bit to 64-bit
-      return numbers_internal::FastInt64ToBuffer(i, buffer);
+      return FastIntToBuffer(static_cast<int64_t>(i), buffer);
     } else {  // 32-bit or less
-      return numbers_internal::FastInt32ToBuffer(i, buffer);
+      return FastIntToBuffer(static_cast<int32_t>(i), buffer);
     }
   } else {                     // Unsigned
     if (sizeof(i) > 32 / 8) {  // 33-bit to 64-bit
-      return numbers_internal::FastUInt64ToBuffer(i, buffer);
+      return FastIntToBuffer(static_cast<uint64_t>(i), buffer);
     } else {  // 32-bit or less
-      return numbers_internal::FastUInt32ToBuffer(i, buffer);
+      return FastIntToBuffer(static_cast<uint32_t>(i), buffer);
     }
   }
 }
 
-}  // namespace numbers_internal
-
-// SimpleAtoi()
-//
-// Converts a std::string to an integer, using `safe_strto?()` functions for actual
-// parsing, returning `true` if successful. The `safe_strto?()` functions apply
-// strict checking; the std::string must be a base-10 integer, optionally followed or
-// preceded by ASCII whitespace, with a value in the range of the corresponding
-// integer type.
+// Implementation of SimpleAtoi, generalized to support arbitrary base (used
+// with base different from 10 elsewhere in Abseil implementation).
 template <typename int_type>
-ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view s, int_type* out) {
+ABSL_MUST_USE_RESULT bool safe_strtoi_base(absl::string_view s, int_type* out,
+                                           int base) {
   static_assert(sizeof(*out) == 4 || sizeof(*out) == 8,
                 "SimpleAtoi works only with 32-bit or 64-bit integers.");
   static_assert(!std::is_floating_point<int_type>::value,
@@ -144,27 +149,41 @@ ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view s, int_type* out) {
   if (static_cast<int_type>(1) - 2 < 0) {  // Signed
     if (sizeof(*out) == 64 / 8) {       // 64-bit
       int64_t val;
-      parsed = numbers_internal::safe_strto64_base(s, &val, 10);
+      parsed = numbers_internal::safe_strto64_base(s, &val, base);
       *out = static_cast<int_type>(val);
     } else {  // 32-bit
       int32_t val;
-      parsed = numbers_internal::safe_strto32_base(s, &val, 10);
+      parsed = numbers_internal::safe_strto32_base(s, &val, base);
       *out = static_cast<int_type>(val);
     }
   } else {                         // Unsigned
     if (sizeof(*out) == 64 / 8) {  // 64-bit
       uint64_t val;
-      parsed = numbers_internal::safe_strtou64_base(s, &val, 10);
+      parsed = numbers_internal::safe_strtou64_base(s, &val, base);
       *out = static_cast<int_type>(val);
     } else {  // 32-bit
       uint32_t val;
-      parsed = numbers_internal::safe_strtou32_base(s, &val, 10);
+      parsed = numbers_internal::safe_strtou32_base(s, &val, base);
       *out = static_cast<int_type>(val);
     }
   }
   return parsed;
 }
 
+}  // namespace numbers_internal
+
+// SimpleAtoi()
+//
+// Converts a string to an integer, using `safe_strto?()` functions for actual
+// parsing, returning `true` if successful. The `safe_strto?()` functions apply
+// strict checking; the string must be a base-10 integer, optionally followed or
+// preceded by ASCII whitespace, with a value in the range of the corresponding
+// integer type.
+template <typename int_type>
+ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view s, int_type* out) {
+  return numbers_internal::safe_strtoi_base(s, out, 10);
+}
+
 }  // namespace absl
 
 #endif  // ABSL_STRINGS_NUMBERS_H_
index 5b4c9ba..a99aac0 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,7 +23,7 @@
 // designed to be used as a parameter type that efficiently manages conversion
 // to strings and avoids copies in the above operations.
 //
-// Any routine accepting either a std::string or a number may accept `AlphaNum`.
+// Any routine accepting either a string or a number may accept `AlphaNum`.
 // The basic idea is that by accepting a `const AlphaNum &` as an argument
 // to your function, your callers will automagically convert bools, integers,
 // and floating point values to strings for you.
 // attempt to pass ':' instead of ":" might result in a 58 ending up in your
 // result.
 //
-// Bools convert to "0" or "1".
+// Bools convert to "0" or "1". Pointers to types other than `char *` are not
+// valid inputs. No output is generated for null `char *` pointers.
 //
 // Floating point numbers are formatted with six-digit precision, which is
 // the default for "std::cout <<" or printf "%g" (the same as "%.6g").
 //
-//
 // You can convert to hexadecimal output rather than decimal output using the
 // `Hex` type contained here. To do so, pass `Hex(my_int)` as a parameter to
 // `StrCat()` or `StrAppend()`. You may specify a minimum hex field width using
-// a `PadSpec` enum, so the equivalent of `StringPrintf("%04x", my_int)` is
-// `absl::StrCat(absl::Hex(my_int, absl::kZeroPad4))`.
+// a `PadSpec` enum.
 //
 // -----------------------------------------------------------------------------
 
@@ -58,6 +57,7 @@
 #include <cstdint>
 #include <string>
 #include <type_traits>
+#include <vector>
 
 #include "absl/base/port.h"
 #include "absl/strings/numbers.h"
@@ -66,7 +66,7 @@
 namespace absl {
 
 namespace strings_internal {
-// AlphaNumBuffer allows a way to pass a std::string to StrCat without having to do
+// AlphaNumBuffer allows a way to pass a string to StrCat without having to do
 // memory allocation.  It is simply a pair of a fixed-size character array, and
 // a size.  Please don't use outside of absl, yet.
 template <size_t max_size>
@@ -77,11 +77,11 @@ struct AlphaNumBuffer {
 
 }  // namespace strings_internal
 
-// Enum that specifies the number of significant digits to return in a `Hex`
-// conversion and fill character to use. A `kZeroPad2` value, for example, would
-// produce hexadecimal strings such as "0A","0F" and 'kSpacePad5' value would
-// produce hexadecimal strings such as "    A","    F".
-enum PadSpec {
+// Enum that specifies the number of significant digits to return in a `Hex` or
+// `Dec` conversion and fill character to use. A `kZeroPad2` value, for example,
+// would produce hexadecimal strings such as "0a","0f" and a 'kSpacePad5' value
+// would produce hexadecimal strings such as "    a","    f".
+enum PadSpec : uint8_t {
   kNoPad = 1,
   kZeroPad2,
   kZeroPad3,
@@ -98,6 +98,10 @@ enum PadSpec {
   kZeroPad14,
   kZeroPad15,
   kZeroPad16,
+  kZeroPad17,
+  kZeroPad18,
+  kZeroPad19,
+  kZeroPad20,
 
   kSpacePad2 = kZeroPad2 + 64,
   kSpacePad3,
@@ -114,35 +118,50 @@ enum PadSpec {
   kSpacePad14,
   kSpacePad15,
   kSpacePad16,
+  kSpacePad17,
+  kSpacePad18,
+  kSpacePad19,
+  kSpacePad20,
 };
 
 // -----------------------------------------------------------------------------
 // Hex
 // -----------------------------------------------------------------------------
 //
-// `Hex` stores a set of hexadecimal std::string conversion parameters for use
-// within `AlphaNum` std::string conversions.
+// `Hex` stores a set of hexadecimal string conversion parameters for use
+// within `AlphaNum` string conversions.
 struct Hex {
   uint64_t value;
   uint8_t width;
   char fill;
 
   template <typename Int>
-  explicit Hex(Int v, PadSpec spec = absl::kNoPad,
-               typename std::enable_if<sizeof(Int) == 1>::type* = nullptr)
+  explicit Hex(
+      Int v, PadSpec spec = absl::kNoPad,
+      typename std::enable_if<sizeof(Int) == 1 &&
+                              !std::is_pointer<Int>::value>::type* = nullptr)
       : Hex(spec, static_cast<uint8_t>(v)) {}
   template <typename Int>
-  explicit Hex(Int v, PadSpec spec = absl::kNoPad,
-               typename std::enable_if<sizeof(Int) == 2>::type* = nullptr)
+  explicit Hex(
+      Int v, PadSpec spec = absl::kNoPad,
+      typename std::enable_if<sizeof(Int) == 2 &&
+                              !std::is_pointer<Int>::value>::type* = nullptr)
       : Hex(spec, static_cast<uint16_t>(v)) {}
   template <typename Int>
-  explicit Hex(Int v, PadSpec spec = absl::kNoPad,
-               typename std::enable_if<sizeof(Int) == 4>::type* = nullptr)
+  explicit Hex(
+      Int v, PadSpec spec = absl::kNoPad,
+      typename std::enable_if<sizeof(Int) == 4 &&
+                              !std::is_pointer<Int>::value>::type* = nullptr)
       : Hex(spec, static_cast<uint32_t>(v)) {}
   template <typename Int>
-  explicit Hex(Int v, PadSpec spec = absl::kNoPad,
-               typename std::enable_if<sizeof(Int) == 8>::type* = nullptr)
+  explicit Hex(
+      Int v, PadSpec spec = absl::kNoPad,
+      typename std::enable_if<sizeof(Int) == 8 &&
+                              !std::is_pointer<Int>::value>::type* = nullptr)
       : Hex(spec, static_cast<uint64_t>(v)) {}
+  template <typename Pointee>
+  explicit Hex(Pointee* v, PadSpec spec = absl::kNoPad)
+      : Hex(spec, reinterpret_cast<uintptr_t>(v)) {}
 
  private:
   Hex(PadSpec spec, uint64_t v)
@@ -155,6 +174,32 @@ struct Hex {
 };
 
 // -----------------------------------------------------------------------------
+// Dec
+// -----------------------------------------------------------------------------
+//
+// `Dec` stores a set of decimal string conversion parameters for use
+// within `AlphaNum` string conversions.  Dec is slower than the default
+// integer conversion, so use it only if you need padding.
+struct Dec {
+  uint64_t value;
+  uint8_t width;
+  char fill;
+  bool neg;
+
+  template <typename Int>
+  explicit Dec(Int v, PadSpec spec = absl::kNoPad,
+               typename std::enable_if<(sizeof(Int) <= 8)>::type* = nullptr)
+      : value(v >= 0 ? static_cast<uint64_t>(v)
+                     : uint64_t{0} - static_cast<uint64_t>(v)),
+        width(spec == absl::kNoPad
+                  ? 1
+                  : spec >= absl::kSpacePad2 ? spec - absl::kSpacePad2 + 2
+                                             : spec - absl::kZeroPad2 + 2),
+        fill(spec >= absl::kSpacePad2 ? ' ' : '0'),
+        neg(v < 0) {}
+};
+
+// -----------------------------------------------------------------------------
 // AlphaNum
 // -----------------------------------------------------------------------------
 //
@@ -192,6 +237,7 @@ class AlphaNum {
       : piece_(digits_, numbers_internal::SixDigitsToBuffer(f, digits_)) {}
 
   AlphaNum(Hex hex);  // NOLINT(runtime/explicit)
+  AlphaNum(Dec dec);  // NOLINT(runtime/explicit)
 
   template <size_t size>
   AlphaNum(  // NOLINT(runtime/explicit)
@@ -200,6 +246,7 @@ class AlphaNum {
 
   AlphaNum(const char* c_str) : piece_(c_str) {}  // NOLINT(runtime/explicit)
   AlphaNum(absl::string_view pc) : piece_(pc) {}  // NOLINT(runtime/explicit)
+
   template <typename Allocator>
   AlphaNum(  // NOLINT(runtime/explicit)
       const std::basic_string<char, std::char_traits<char>, Allocator>& str)
@@ -223,6 +270,17 @@ class AlphaNum {
   AlphaNum(T e)  // NOLINT(runtime/explicit)
       : AlphaNum(static_cast<typename std::underlying_type<T>::type>(e)) {}
 
+  // vector<bool>::reference and const_reference require special help to
+  // convert to `AlphaNum` because it requires two user defined conversions.
+  template <
+      typename T,
+      typename std::enable_if<
+          std::is_class<T>::value &&
+          (std::is_same<T, std::vector<bool>::reference>::value ||
+           std::is_same<T, std::vector<bool>::const_reference>::value)>::type* =
+          nullptr>
+  AlphaNum(T e) : AlphaNum(static_cast<bool>(e)) {}  // NOLINT(runtime/explicit)
+
  private:
   absl::string_view piece_;
   char digits_[numbers_internal::kFastToBufferSize];
@@ -234,7 +292,7 @@ class AlphaNum {
 //
 // Merges given strings or numbers, using no delimiter(s).
 //
-// `StrCat()` is designed to be the fastest possible way to construct a std::string
+// `StrCat()` is designed to be the fastest possible way to construct a string
 // out of a mix of raw C strings, string_views, strings, bool values,
 // and numeric values.
 //
@@ -242,7 +300,7 @@ class AlphaNum {
 // works poorly on strings built up out of fragments.
 //
 // For clarity and performance, don't use `StrCat()` when appending to a
-// std::string. Use `StrAppend()` instead. In particular, avoid using any of these
+// string. Use `StrAppend()` instead. In particular, avoid using any of these
 // (anti-)patterns:
 //
 //   str.append(StrCat(...))
@@ -272,16 +330,15 @@ ABSL_MUST_USE_RESULT inline std::string StrCat(const AlphaNum& a) {
 
 ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b);
 ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
-                                   const AlphaNum& c);
+                                        const AlphaNum& c);
 ABSL_MUST_USE_RESULT std::string StrCat(const AlphaNum& a, const AlphaNum& b,
-                                   const AlphaNum& c, const AlphaNum& d);
+                                        const AlphaNum& c, const AlphaNum& d);
 
 // Support 5 or more arguments
 template <typename... AV>
-ABSL_MUST_USE_RESULT inline std::string StrCat(const AlphaNum& a, const AlphaNum& b,
-                                          const AlphaNum& c, const AlphaNum& d,
-                                          const AlphaNum& e,
-                                          const AV&... args) {
+ABSL_MUST_USE_RESULT inline std::string StrCat(
+    const AlphaNum& a, const AlphaNum& b, const AlphaNum& c, const AlphaNum& d,
+    const AlphaNum& e, const AV&... args) {
   return strings_internal::CatPieces(
       {a.Piece(), b.Piece(), c.Piece(), d.Piece(), e.Piece(),
        static_cast<const AlphaNum&>(args).Piece()...});
@@ -291,13 +348,13 @@ ABSL_MUST_USE_RESULT inline std::string StrCat(const AlphaNum& a, const AlphaNum
 // StrAppend()
 // -----------------------------------------------------------------------------
 //
-// Appends a std::string or set of strings to an existing std::string, in a similar
+// Appends a string or set of strings to an existing string, in a similar
 // fashion to `StrCat()`.
 //
 // WARNING: `StrAppend(&str, a, b, c, ...)` requires that none of the
 // a, b, c, parameters be a reference into str. For speed, `StrAppend()` does
 // not try to check each of its input arguments to be sure that they are not
-// a subset of the std::string being appended to. That is, while this will work:
+// a subset of the string being appended to. That is, while this will work:
 //
 //   std::string s = "foo";
 //   s += s;
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_format.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/strings/str_format.h
new file mode 100644 (file)
index 0000000..0b93c28
--- /dev/null
@@ -0,0 +1,529 @@
+//
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: str_format.h
+// -----------------------------------------------------------------------------
+//
+// The `str_format` library is a typesafe replacement for the family of
+// `printf()` string formatting routines within the `<cstdio>` standard library
+// header. Like the `printf` family, the `str_format` uses a "format string" to
+// perform argument substitutions based on types. See the `FormatSpec` section
+// below for format string documentation.
+//
+// Example:
+//
+//   std::string s = absl::StrFormat(
+//                      "%s %s You have $%d!", "Hello", name, dollars);
+//
+// The library consists of the following basic utilities:
+//
+//   * `absl::StrFormat()`, a type-safe replacement for `std::sprintf()`, to
+//     write a format string to a `string` value.
+//   * `absl::StrAppendFormat()` to append a format string to a `string`
+//   * `absl::StreamFormat()` to more efficiently write a format string to a
+//     stream, such as`std::cout`.
+//   * `absl::PrintF()`, `absl::FPrintF()` and `absl::SNPrintF()` as
+//     replacements for `std::printf()`, `std::fprintf()` and `std::snprintf()`.
+//
+//     Note: a version of `std::sprintf()` is not supported as it is
+//     generally unsafe due to buffer overflows.
+//
+// Additionally, you can provide a format string (and its associated arguments)
+// using one of the following abstractions:
+//
+//   * A `FormatSpec` class template fully encapsulates a format string and its
+//     type arguments and is usually provided to `str_format` functions as a
+//     variadic argument of type `FormatSpec<Arg...>`. The `FormatSpec<Args...>`
+//     template is evaluated at compile-time, providing type safety.
+//   * A `ParsedFormat` instance, which encapsulates a specific, pre-compiled
+//     format string for a specific set of type(s), and which can be passed
+//     between API boundaries. (The `FormatSpec` type should not be used
+//     directly except as an argument type for wrapper functions.)
+//
+// The `str_format` library provides the ability to output its format strings to
+// arbitrary sink types:
+//
+//   * A generic `Format()` function to write outputs to arbitrary sink types,
+//     which must implement a `RawSinkFormat` interface. (See
+//     `str_format_sink.h` for more information.)
+//
+//   * A `FormatUntyped()` function that is similar to `Format()` except it is
+//     loosely typed. `FormatUntyped()` is not a template and does not perform
+//     any compile-time checking of the format string; instead, it returns a
+//     boolean from a runtime check.
+//
+// In addition, the `str_format` library provides extension points for
+// augmenting formatting to new types. These extensions are fully documented
+// within the `str_format_extension.h` header file.
+
+#ifndef ABSL_STRINGS_STR_FORMAT_H_
+#define ABSL_STRINGS_STR_FORMAT_H_
+
+#include <cstdio>
+#include <string>
+
+#include "absl/strings/internal/str_format/arg.h"  // IWYU pragma: export
+#include "absl/strings/internal/str_format/bind.h"  // IWYU pragma: export
+#include "absl/strings/internal/str_format/checker.h"  // IWYU pragma: export
+#include "absl/strings/internal/str_format/extension.h"  // IWYU pragma: export
+#include "absl/strings/internal/str_format/parser.h"  // IWYU pragma: export
+
+namespace absl {
+
+// UntypedFormatSpec
+//
+// A type-erased class that can be used directly within untyped API entry
+// points. An `UntypedFormatSpec` is specifically used as an argument to
+// `FormatUntyped()`.
+//
+// Example:
+//
+//   absl::UntypedFormatSpec format("%d");
+//   std::string out;
+//   CHECK(absl::FormatUntyped(&out, format, {absl::FormatArg(1)}));
+class UntypedFormatSpec {
+ public:
+  UntypedFormatSpec() = delete;
+  UntypedFormatSpec(const UntypedFormatSpec&) = delete;
+  UntypedFormatSpec& operator=(const UntypedFormatSpec&) = delete;
+
+  explicit UntypedFormatSpec(string_view s) : spec_(s) {}
+
+ protected:
+  explicit UntypedFormatSpec(const str_format_internal::ParsedFormatBase* pc)
+      : spec_(pc) {}
+
+ private:
+  friend str_format_internal::UntypedFormatSpecImpl;
+  str_format_internal::UntypedFormatSpecImpl spec_;
+};
+
+// FormatStreamed()
+//
+// Takes a streamable argument and returns an object that can print it
+// with '%s'. Allows printing of types that have an `operator<<` but no
+// intrinsic type support within `StrFormat()` itself.
+//
+// Example:
+//
+//   absl::StrFormat("%s", absl::FormatStreamed(obj));
+template <typename T>
+str_format_internal::StreamedWrapper<T> FormatStreamed(const T& v) {
+  return str_format_internal::StreamedWrapper<T>(v);
+}
+
+// FormatCountCapture
+//
+// This class provides a way to safely wrap `StrFormat()` captures of `%n`
+// conversions, which denote the number of characters written by a formatting
+// operation to this point, into an integer value.
+//
+// This wrapper is designed to allow safe usage of `%n` within `StrFormat(); in
+// the `printf()` family of functions, `%n` is not safe to use, as the `int *`
+// buffer can be used to capture arbitrary data.
+//
+// Example:
+//
+//   int n = 0;
+//   std::string s = absl::StrFormat("%s%d%n", "hello", 123,
+//                       absl::FormatCountCapture(&n));
+//   EXPECT_EQ(8, n);
+class FormatCountCapture {
+ public:
+  explicit FormatCountCapture(int* p) : p_(p) {}
+
+ private:
+  // FormatCountCaptureHelper is used to define FormatConvertImpl() for this
+  // class.
+  friend struct str_format_internal::FormatCountCaptureHelper;
+  // Unused() is here because of the false positive from -Wunused-private-field
+  // p_ is used in the templated function of the friend FormatCountCaptureHelper
+  // class.
+  int* Unused() { return p_; }
+  int* p_;
+};
+
+// FormatSpec
+//
+// The `FormatSpec` type defines the makeup of a format string within the
+// `str_format` library. It is a variadic class template that is evaluated at
+// compile-time, according to the format string and arguments that are passed to
+// it.
+//
+// You should not need to manipulate this type directly. You should only name it
+// if you are writing wrapper functions which accept format arguments that will
+// be provided unmodified to functions in this library. Such a wrapper function
+// might be a class method that provides format arguments and/or internally uses
+// the result of formatting.
+//
+// For a `FormatSpec` to be valid at compile-time, it must be provided as
+// either:
+//
+// * A `constexpr` literal or `absl::string_view`, which is how it most often
+//   used.
+// * A `ParsedFormat` instantiation, which ensures the format string is
+//   valid before use. (See below.)
+//
+// Example:
+//
+//   // Provided as a string literal.
+//   absl::StrFormat("Welcome to %s, Number %d!", "The Village", 6);
+//
+//   // Provided as a constexpr absl::string_view.
+//   constexpr absl::string_view formatString = "Welcome to %s, Number %d!";
+//   absl::StrFormat(formatString, "The Village", 6);
+//
+//   // Provided as a pre-compiled ParsedFormat object.
+//   // Note that this example is useful only for illustration purposes.
+//   absl::ParsedFormat<'s', 'd'> formatString("Welcome to %s, Number %d!");
+//   absl::StrFormat(formatString, "TheVillage", 6);
+//
+// A format string generally follows the POSIX syntax as used within the POSIX
+// `printf` specification.
+//
+// (See http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html.)
+//
+// In specific, the `FormatSpec` supports the following type specifiers:
+//   * `c` for characters
+//   * `s` for strings
+//   * `d` or `i` for integers
+//   * `o` for unsigned integer conversions into octal
+//   * `x` or `X` for unsigned integer conversions into hex
+//   * `u` for unsigned integers
+//   * `f` or `F` for floating point values into decimal notation
+//   * `e` or `E` for floating point values into exponential notation
+//   * `a` or `A` for floating point values into hex exponential notation
+//   * `g` or `G` for floating point values into decimal or exponential
+//     notation based on their precision
+//   * `p` for pointer address values
+//   * `n` for the special case of writing out the number of characters
+//     written to this point. The resulting value must be captured within an
+//     `absl::FormatCountCapture` type.
+//
+// Implementation-defined behavior:
+//   * A null pointer provided to "%s" or "%p" is output as "(nil)".
+//   * A non-null pointer provided to "%p" is output in hex as if by %#x or
+//     %#lx.
+//
+// NOTE: `o`, `x\X` and `u` will convert signed values to their unsigned
+// counterpart before formatting.
+//
+// Examples:
+//     "%c", 'a'                -> "a"
+//     "%c", 32                 -> " "
+//     "%s", "C"                -> "C"
+//     "%s", std::string("C++") -> "C++"
+//     "%d", -10                -> "-10"
+//     "%o", 10                 -> "12"
+//     "%x", 16                 -> "10"
+//     "%f", 123456789          -> "123456789.000000"
+//     "%e", .01                -> "1.00000e-2"
+//     "%a", -3.0               -> "-0x1.8p+1"
+//     "%g", .01                -> "1e-2"
+//     "%p", (void*)&value      -> "0x7ffdeb6ad2a4"
+//
+//     int n = 0;
+//     std::string s = absl::StrFormat(
+//         "%s%d%n", "hello", 123, absl::FormatCountCapture(&n));
+//     EXPECT_EQ(8, n);
+//
+// The `FormatSpec` intrinsically supports all of these fundamental C++ types:
+//
+// *   Characters: `char`, `signed char`, `unsigned char`
+// *   Integers: `int`, `short`, `unsigned short`, `unsigned`, `long`,
+//         `unsigned long`, `long long`, `unsigned long long`
+// *   Floating-point: `float`, `double`, `long double`
+//
+// However, in the `str_format` library, a format conversion specifies a broader
+// C++ conceptual category instead of an exact type. For example, `%s` binds to
+// any string-like argument, so `std::string`, `absl::string_view`, and
+// `const char*` are all accepted. Likewise, `%d` accepts any integer-like
+// argument, etc.
+
+template <typename... Args>
+using FormatSpec =
+    typename str_format_internal::FormatSpecDeductionBarrier<Args...>::type;
+
+// ParsedFormat
+//
+// A `ParsedFormat` is a class template representing a preparsed `FormatSpec`,
+// with template arguments specifying the conversion characters used within the
+// format string. Such characters must be valid format type specifiers, and
+// these type specifiers are checked at compile-time.
+//
+// Instances of `ParsedFormat` can be created, copied, and reused to speed up
+// formatting loops. A `ParsedFormat` may either be constructed statically, or
+// dynamically through its `New()` factory function, which only constructs a
+// runtime object if the format is valid at that time.
+//
+// Example:
+//
+//   // Verified at compile time.
+//   absl::ParsedFormat<'s', 'd'> formatString("Welcome to %s, Number %d!");
+//   absl::StrFormat(formatString, "TheVillage", 6);
+//
+//   // Verified at runtime.
+//   auto format_runtime = absl::ParsedFormat<'d'>::New(format_string);
+//   if (format_runtime) {
+//     value = absl::StrFormat(*format_runtime, i);
+//   } else {
+//     ... error case ...
+//   }
+template <char... Conv>
+using ParsedFormat = str_format_internal::ExtendedParsedFormat<
+    str_format_internal::ConversionCharToConv(Conv)...>;
+
+// StrFormat()
+//
+// Returns a `string` given a `printf()`-style format string and zero or more
+// additional arguments. Use it as you would `sprintf()`. `StrFormat()` is the
+// primary formatting function within the `str_format` library, and should be
+// used in most cases where you need type-safe conversion of types into
+// formatted strings.
+//
+// The format string generally consists of ordinary character data along with
+// one or more format conversion specifiers (denoted by the `%` character).
+// Ordinary character data is returned unchanged into the result string, while
+// each conversion specification performs a type substitution from
+// `StrFormat()`'s other arguments. See the comments for `FormatSpec` for full
+// information on the makeup of this format string.
+//
+// Example:
+//
+//   std::string s = absl::StrFormat(
+//       "Welcome to %s, Number %d!", "The Village", 6);
+//   EXPECT_EQ("Welcome to The Village, Number 6!", s);
+//
+// Returns an empty string in case of error.
+template <typename... Args>
+ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec<Args...>& format,
+                                           const Args&... args) {
+  return str_format_internal::FormatPack(
+      str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// StrAppendFormat()
+//
+// Appends to a `dst` string given a format string, and zero or more additional
+// arguments, returning `*dst` as a convenience for chaining purposes. Appends
+// nothing in case of error (but possibly alters its capacity).
+//
+// Example:
+//
+//   std::string orig("For example PI is approximately ");
+//   std::cout << StrAppendFormat(&orig, "%12.6f", 3.14);
+template <typename... Args>
+std::string& StrAppendFormat(std::string* dst,
+                             const FormatSpec<Args...>& format,
+                             const Args&... args) {
+  return str_format_internal::AppendPack(
+      dst, str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// StreamFormat()
+//
+// Writes to an output stream given a format string and zero or more arguments,
+// generally in a manner that is more efficient than streaming the result of
+// `absl:: StrFormat()`. The returned object must be streamed before the full
+// expression ends.
+//
+// Example:
+//
+//   std::cout << StreamFormat("%12.6f", 3.14);
+template <typename... Args>
+ABSL_MUST_USE_RESULT str_format_internal::Streamable StreamFormat(
+    const FormatSpec<Args...>& format, const Args&... args) {
+  return str_format_internal::Streamable(
+      str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// PrintF()
+//
+// Writes to stdout given a format string and zero or more arguments. This
+// function is functionally equivalent to `std::printf()` (and type-safe);
+// prefer `absl::PrintF()` over `std::printf()`.
+//
+// Example:
+//
+//   std::string_view s = "Ulaanbaatar";
+//   absl::PrintF("The capital of Mongolia is %s", s);
+//
+//   Outputs: "The capital of Mongolia is Ulaanbaatar"
+//
+template <typename... Args>
+int PrintF(const FormatSpec<Args...>& format, const Args&... args) {
+  return str_format_internal::FprintF(
+      stdout, str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// FPrintF()
+//
+// Writes to a file given a format string and zero or more arguments. This
+// function is functionally equivalent to `std::fprintf()` (and type-safe);
+// prefer `absl::FPrintF()` over `std::fprintf()`.
+//
+// Example:
+//
+//   std::string_view s = "Ulaanbaatar";
+//   absl::FPrintF(stdout, "The capital of Mongolia is %s", s);
+//
+//   Outputs: "The capital of Mongolia is Ulaanbaatar"
+//
+template <typename... Args>
+int FPrintF(std::FILE* output, const FormatSpec<Args...>& format,
+            const Args&... args) {
+  return str_format_internal::FprintF(
+      output, str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// SNPrintF()
+//
+// Writes to a sized buffer given a format string and zero or more arguments.
+// This function is functionally equivalent to `std::snprintf()` (and
+// type-safe); prefer `absl::SNPrintF()` over `std::snprintf()`.
+//
+// Example:
+//
+//   std::string_view s = "Ulaanbaatar";
+//   char output[128];
+//   absl::SNPrintF(output, sizeof(output),
+//                  "The capital of Mongolia is %s", s);
+//
+//   Post-condition: output == "The capital of Mongolia is Ulaanbaatar"
+//
+template <typename... Args>
+int SNPrintF(char* output, std::size_t size, const FormatSpec<Args...>& format,
+             const Args&... args) {
+  return str_format_internal::SnprintF(
+      output, size, str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// -----------------------------------------------------------------------------
+// Custom Output Formatting Functions
+// -----------------------------------------------------------------------------
+
+// FormatRawSink
+//
+// FormatRawSink is a type erased wrapper around arbitrary sink objects
+// specifically used as an argument to `Format()`.
+// FormatRawSink does not own the passed sink object. The passed object must
+// outlive the FormatRawSink.
+class FormatRawSink {
+ public:
+  // Implicitly convert from any type that provides the hook function as
+  // described above.
+  template <typename T,
+            typename = typename std::enable_if<std::is_constructible<
+                str_format_internal::FormatRawSinkImpl, T*>::value>::type>
+  FormatRawSink(T* raw)  // NOLINT
+      : sink_(raw) {}
+
+ private:
+  friend str_format_internal::FormatRawSinkImpl;
+  str_format_internal::FormatRawSinkImpl sink_;
+};
+
+// Format()
+//
+// Writes a formatted string to an arbitrary sink object (implementing the
+// `absl::FormatRawSink` interface), using a format string and zero or more
+// additional arguments.
+//
+// By default, `std::string` and `std::ostream` are supported as destination
+// objects.
+//
+// `absl::Format()` is a generic version of `absl::StrFormat(), for custom
+// sinks. The format string, like format strings for `StrFormat()`, is checked
+// at compile-time.
+//
+// On failure, this function returns `false` and the state of the sink is
+// unspecified.
+template <typename... Args>
+bool Format(FormatRawSink raw_sink, const FormatSpec<Args...>& format,
+            const Args&... args) {
+  return str_format_internal::FormatUntyped(
+      str_format_internal::FormatRawSinkImpl::Extract(raw_sink),
+      str_format_internal::UntypedFormatSpecImpl::Extract(format),
+      {str_format_internal::FormatArgImpl(args)...});
+}
+
+// FormatArg
+//
+// A type-erased handle to a format argument specifically used as an argument to
+// `FormatUntyped()`. You may construct `FormatArg` by passing
+// reference-to-const of any printable type. `FormatArg` is both copyable and
+// assignable. The source data must outlive the `FormatArg` instance. See
+// example below.
+//
+using FormatArg = str_format_internal::FormatArgImpl;
+
+// FormatUntyped()
+//
+// Writes a formatted string to an arbitrary sink object (implementing the
+// `absl::FormatRawSink` interface), using an `UntypedFormatSpec` and zero or
+// more additional arguments.
+//
+// This function acts as the most generic formatting function in the
+// `str_format` library. The caller provides a raw sink, an unchecked format
+// string, and (usually) a runtime specified list of arguments; no compile-time
+// checking of formatting is performed within this function. As a result, a
+// caller should check the return value to verify that no error occurred.
+// On failure, this function returns `false` and the state of the sink is
+// unspecified.
+//
+// The arguments are provided in an `absl::Span<const absl::FormatArg>`.
+// Each `absl::FormatArg` object binds to a single argument and keeps a
+// reference to it. The values used to create the `FormatArg` objects must
+// outlive this function call. (See `str_format_arg.h` for information on
+// the `FormatArg` class.)_
+//
+// Example:
+//
+//   std::optional<std::string> FormatDynamic(
+//       const std::string& in_format,
+//       const vector<std::string>& in_args) {
+//     std::string out;
+//     std::vector<absl::FormatArg> args;
+//     for (const auto& v : in_args) {
+//       // It is important that 'v' is a reference to the objects in in_args.
+//       // The values we pass to FormatArg must outlive the call to
+//       // FormatUntyped.
+//       args.emplace_back(v);
+//     }
+//     absl::UntypedFormatSpec format(in_format);
+//     if (!absl::FormatUntyped(&out, format, args)) {
+//       return std::nullopt;
+//     }
+//     return std::move(out);
+//   }
+//
+ABSL_MUST_USE_RESULT inline bool FormatUntyped(
+    FormatRawSink raw_sink, const UntypedFormatSpec& format,
+    absl::Span<const FormatArg> args) {
+  return str_format_internal::FormatUntyped(
+      str_format_internal::FormatRawSinkImpl::Extract(raw_sink),
+      str_format_internal::UntypedFormatSpecImpl::Extract(format), args);
+}
+
+}  // namespace absl
+
+#endif  // ABSL_STRINGS_STR_FORMAT_H_
index 82a3cac..7345b96 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // -----------------------------------------------------------------------------
 //
 // This header file contains functions for joining a range of elements and
-// returning the result as a std::string. StrJoin operations are specified by passing
-// a range, a separator std::string to use between the elements joined, and an
-// optional Formatter responsible for converting each argument in the range to a
-// std::string. If omitted, a default `AlphaNumFormatter()` is called on the elements
-// to be joined, using the same formatting that `absl::StrCat()` uses. This
-// package defines a number of default formatters, and you can define your own
-// implementations.
+// returning the result as a std::string. StrJoin operations are specified by
+// passing a range, a separator string to use between the elements joined, and
+// an optional Formatter responsible for converting each argument in the range
+// to a string. If omitted, a default `AlphaNumFormatter()` is called on the
+// elements to be joined, using the same formatting that `absl::StrCat()` uses.
+// This package defines a number of default formatters, and you can define your
+// own implementations.
 //
 // Ranges are specified by passing a container with `std::begin()` and
 // `std::end()` iterators, container-specific `begin()` and `end()` iterators, a
 // brace-initialized `std::initializer_list`, or a `std::tuple` of heterogeneous
-// objects. The separator std::string is specified as an `absl::string_view`.
+// objects. The separator string is specified as an `absl::string_view`.
 //
 // Because the default formatter uses the `absl::AlphaNum` class,
 // `absl::StrJoin()`, like `absl::StrCat()`, will work out-of-the-box on
@@ -52,6 +52,7 @@
 #include <iterator>
 #include <string>
 #include <tuple>
+#include <type_traits>
 #include <utility>
 
 #include "absl/base/macros.h"
@@ -65,10 +66,10 @@ namespace absl {
 // -----------------------------------------------------------------------------
 //
 // A Formatter is a function object that is responsible for formatting its
-// argument as a std::string and appending it to a given output std::string. Formatters
-// may be implemented as function objects, lambdas, or normal functions. You may
-// provide your own Formatter to enable `absl::StrJoin()` to work with arbitrary
-// types.
+// argument as a string and appending it to a given output std::string.
+// Formatters may be implemented as function objects, lambdas, or normal
+// functions. You may provide your own Formatter to enable `absl::StrJoin()` to
+// work with arbitrary types.
 //
 // The following is an example of a custom Formatter that simply uses
 // `std::to_string()` to format an integer as a std::string.
@@ -156,16 +157,16 @@ DereferenceFormatter() {
 // -----------------------------------------------------------------------------
 //
 // Joins a range of elements and returns the result as a std::string.
-// `absl::StrJoin()` takes a range, a separator std::string to use between the
+// `absl::StrJoin()` takes a range, a separator string to use between the
 // elements joined, and an optional Formatter responsible for converting each
-// argument in the range to a std::string.
+// argument in the range to a string.
 //
 // If omitted, the default `AlphaNumFormatter()` is called on the elements to be
 // joined.
 //
 // Example 1:
 //   // Joins a collection of strings. This pattern also works with a collection
-//   // of `asbl::string_view` or even `const char*`.
+//   // of `absl::string_view` or even `const char*`.
 //   std::vector<std::string> v = {"foo", "bar", "baz"};
 //   std::string s = absl::StrJoin(v, "-");
 //   EXPECT_EQ("foo-bar-baz", s);
@@ -208,11 +209,11 @@ DereferenceFormatter() {
 //   // Joins a `std::map`, with each key-value pair separated by an equals
 //   // sign. This pattern would also work with, say, a
 //   // `std::vector<std::pair<>>`.
-//    std::map<std::string, int> m = {
-//        std::make_pair("a", 1),
-//        std::make_pair("b", 2),
-//        std::make_pair("c", 3)};
-//   std::string s = absl::StrJoin(m, ",", strings::PairFormatter("="));
+//   std::map<std::string, int> m = {
+//       std::make_pair("a", 1),
+//       std::make_pair("b", 2),
+//       std::make_pair("c", 3)};
+//   std::string s = absl::StrJoin(m, ",", absl::PairFormatter("="));
 //   EXPECT_EQ("a=1,b=2,c=3", s);
 //
 // Example 7:
@@ -241,13 +242,13 @@ DereferenceFormatter() {
 
 template <typename Iterator, typename Formatter>
 std::string StrJoin(Iterator start, Iterator end, absl::string_view sep,
-               Formatter&& fmt) {
+                    Formatter&& fmt) {
   return strings_internal::JoinAlgorithm(start, end, sep, fmt);
 }
 
 template <typename Range, typename Formatter>
 std::string StrJoin(const Range& range, absl::string_view separator,
-               Formatter&& fmt) {
+                    Formatter&& fmt) {
   return strings_internal::JoinRange(range, separator, fmt);
 }
 
@@ -259,7 +260,7 @@ std::string StrJoin(std::initializer_list<T> il, absl::string_view separator,
 
 template <typename... T, typename Formatter>
 std::string StrJoin(const std::tuple<T...>& value, absl::string_view separator,
-               Formatter&& fmt) {
+                    Formatter&& fmt) {
   return strings_internal::JoinAlgorithm(value, separator, fmt);
 }
 
@@ -279,7 +280,8 @@ std::string StrJoin(std::initializer_list<T> il, absl::string_view separator) {
 }
 
 template <typename... T>
-std::string StrJoin(const std::tuple<T...>& value, absl::string_view separator) {
+std::string StrJoin(const std::tuple<T...>& value,
+                    absl::string_view separator) {
   return strings_internal::JoinAlgorithm(value, separator, AlphaNumFormatter());
 }
 
index f4d9bb9..30540d0 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // File: str_replace.h
 // -----------------------------------------------------------------------------
 //
-// This file defines `absl::StrReplaceAll()`, a general-purpose std::string
+// This file defines `absl::StrReplaceAll()`, a general-purpose string
 // replacement function designed for large, arbitrary text substitutions,
 // especially on strings which you are receiving from some other system for
 // further processing (e.g. processing regular expressions, escaping HTML
-// entities, etc. `StrReplaceAll` is designed to be efficient even when only
+// entities, etc.). `StrReplaceAll` is designed to be efficient even when only
 // one substitution is being performed, or when substitution is rare.
 //
-// If the std::string being modified is known at compile-time, and the substitutions
+// If the string being modified is known at compile-time, and the substitutions
 // vary, `absl::Substitute()` may be a better choice.
 //
 // Example:
 //
 // std::string html_escaped = absl::StrReplaceAll(user_input, {
-//                                           {"&", "&amp;"},
-//                                           {"<", "&lt;"},
-//                                           {">", "&gt;"},
-//                                           {"\"", "&quot;"},
-//                                           {"'", "&#39;"}});
+//                                                {"&", "&amp;"},
+//                                                {"<", "&lt;"},
+//                                                {">", "&gt;"},
+//                                                {"\"", "&quot;"},
+//                                                {"'", "&#39;"}});
 #ifndef ABSL_STRINGS_STR_REPLACE_H_
 #define ABSL_STRINGS_STR_REPLACE_H_
 
@@ -49,19 +49,20 @@ namespace absl {
 
 // StrReplaceAll()
 //
-// Replaces character sequences within a given std::string with replacements provided
+// Replaces character sequences within a given string with replacements provided
 // within an initializer list of key/value pairs. Candidate replacements are
-// considered in order as they occur within the std::string, with earlier matches
+// considered in order as they occur within the string, with earlier matches
 // taking precedence, and longer matches taking precedence for candidates
-// starting at the same position in the std::string. Once a substitution is made, the
+// starting at the same position in the string. Once a substitution is made, the
 // replaced text is not considered for any further substitutions.
 //
 // Example:
 //
-//   std::string s = absl::StrReplaceAll("$who bought $count #Noun. Thanks $who!",
-//                                  {{"$count", absl::StrCat(5)},
-//                                   {"$who", "Bob"},
-//                                   {"#Noun", "Apples"}});
+//   std::string s = absl::StrReplaceAll(
+//       "$who bought $count #Noun. Thanks $who!",
+//       {{"$count", absl::StrCat(5)},
+//        {"$who", "Bob"},
+//        {"#Noun", "Apples"}});
 //   EXPECT_EQ("Bob bought 5 Apples. Thanks Bob!", s);
 ABSL_MUST_USE_RESULT std::string StrReplaceAll(
     absl::string_view s,
@@ -78,8 +79,9 @@ ABSL_MUST_USE_RESULT std::string StrReplaceAll(
 //   replacements["$who"] = "Bob";
 //   replacements["$count"] = "5";
 //   replacements["#Noun"] = "Apples";
-//   std::string s = absl::StrReplaceAll("$who bought $count #Noun. Thanks $who!",
-//                                  replacements);
+//   std::string s = absl::StrReplaceAll(
+//       "$who bought $count #Noun. Thanks $who!",
+//       replacements);
 //   EXPECT_EQ("Bob bought 5 Apples. Thanks Bob!", s);
 //
 //   // A std::vector of std::pair elements can be more efficient.
@@ -91,10 +93,11 @@ ABSL_MUST_USE_RESULT std::string StrReplaceAll(
 //                                  replacements);
 //   EXPECT_EQ("if (ptr &lt; &amp;foo)", s);
 template <typename StrToStrMapping>
-std::string StrReplaceAll(absl::string_view s, const StrToStrMapping& replacements);
+std::string StrReplaceAll(absl::string_view s,
+                          const StrToStrMapping& replacements);
 
 // Overload of `StrReplaceAll()` to replace character sequences within a given
-// output std::string *in place* with replacements provided within an initializer
+// output string *in place* with replacements provided within an initializer
 // list of key/value pairs, returning the number of substitutions that occurred.
 //
 // Example:
@@ -112,7 +115,7 @@ int StrReplaceAll(
     std::string* target);
 
 // Overload of `StrReplaceAll()` to replace patterns within a given output
-// std::string *in place* with replacements provided within a container of key/value
+// string *in place* with replacements provided within a container of key/value
 // pairs.
 //
 // Example:
@@ -187,7 +190,8 @@ int ApplySubstitutions(absl::string_view s,
 }  // namespace strings_internal
 
 template <typename StrToStrMapping>
-std::string StrReplaceAll(absl::string_view s, const StrToStrMapping& replacements) {
+std::string StrReplaceAll(absl::string_view s,
+                          const StrToStrMapping& replacements) {
   auto subs = strings_internal::FindSubstitutions(s, replacements);
   std::string result;
   result.reserve(s.size());
index 5b3d6a8..7333078 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 //
 // This file contains functions for splitting strings. It defines the main
 // `StrSplit()` function, several delimiters for determining the boundaries on
-// which to split the std::string, and predicates for filtering delimited results.
+// which to split the string, and predicates for filtering delimited results.
 // `StrSplit()` adapts the returned collection to the type specified by the
 // caller.
 //
 // Example:
 //
-//   // Splits the given std::string on commas. Returns the results in a
+//   // Splits the given string on commas. Returns the results in a
 //   // vector of strings.
 //   std::vector<std::string> v = absl::StrSplit("a,b,c", ',');
 //   // Can also use ","
@@ -55,7 +55,7 @@ namespace absl {
 //------------------------------------------------------------------------------
 //
 // `StrSplit()` uses delimiters to define the boundaries between elements in the
-// provided input. Several `Delimiter` types are defined below. If a std::string
+// provided input. Several `Delimiter` types are defined below. If a string
 // (`const char*`, `std::string`, or `absl::string_view`) is passed in place of
 // an explicit `Delimiter` object, `StrSplit()` treats it the same way as if it
 // were passed a `ByString` delimiter.
@@ -65,29 +65,29 @@ namespace absl {
 //
 // The following `Delimiter` types are available for use within `StrSplit()`:
 //
-//   - `ByString` (default for std::string arguments)
+//   - `ByString` (default for string arguments)
 //   - `ByChar` (default for a char argument)
 //   - `ByAnyChar`
 //   - `ByLength`
 //   - `MaxSplits`
 //
-//
-// A Delimiter's Find() member function will be passed the input text that is to
-// be split and the position to begin searching for the next delimiter in the
-// input text. The returned absl::string_view should refer to the next
-// occurrence (after pos) of the represented delimiter; this returned
-// absl::string_view represents the next location where the input std::string should
-// be broken. The returned absl::string_view may be zero-length if the Delimiter
-// does not represent a part of the std::string (e.g., a fixed-length delimiter). If
-// no delimiter is found in the given text, a zero-length absl::string_view
-// referring to text.end() should be returned (e.g.,
-// absl::string_view(text.end(), 0)). It is important that the returned
-// absl::string_view always be within the bounds of input text given as an
-// argument--it must not refer to a std::string that is physically located outside of
-// the given std::string.
+// A Delimiter's `Find()` member function will be passed an input `text` that is
+// to be split and a position (`pos`) to begin searching for the next delimiter
+// in `text`. The returned absl::string_view should refer to the next occurrence
+// (after `pos`) of the represented delimiter; this returned absl::string_view
+// represents the next location where the input `text` should be broken.
+//
+// The returned absl::string_view may be zero-length if the Delimiter does not
+// represent a part of the string (e.g., a fixed-length delimiter). If no
+// delimiter is found in the input `text`, a zero-length absl::string_view
+// referring to `text.end()` should be returned (e.g.,
+// `text.substr(text.size())`). It is important that the returned
+// absl::string_view always be within the bounds of the input `text` given as an
+// argument--it must not refer to a string that is physically located outside of
+// the given string.
 //
 // The following example is a simple Delimiter object that is created with a
-// single char and will look for that char in the text passed to the Find()
+// single char and will look for that char in the text passed to the `Find()`
 // function:
 //
 //   struct SimpleDelimiter {
@@ -96,21 +96,21 @@ namespace absl {
 //     absl::string_view Find(absl::string_view text, size_t pos) {
 //       auto found = text.find(c_, pos);
 //       if (found == absl::string_view::npos)
-//         return absl::string_view(text.end(), 0);
+//         return text.substr(text.size());
 //
-//       return absl::string_view(text, found, 1);
+//       return text.substr(found, 1);
 //     }
 //   };
 
 // ByString
 //
-// A sub-std::string delimiter. If `StrSplit()` is passed a std::string in place of a
-// `Delimiter` object, the std::string will be implicitly converted into a
+// A sub-string delimiter. If `StrSplit()` is passed a string in place of a
+// `Delimiter` object, the string will be implicitly converted into a
 // `ByString` delimiter.
 //
 // Example:
 //
-//   // Because a std::string literal is converted to an `absl::ByString`,
+//   // Because a string literal is converted to an `absl::ByString`,
 //   // the following two splits are equivalent.
 //
 //   std::vector<std::string> v1 = absl::StrSplit("a, b, c", ", ");
@@ -131,8 +131,7 @@ class ByString {
 // ByChar
 //
 // A single character delimiter. `ByChar` is functionally equivalent to a
-// 1-char std::string within a `ByString` delimiter, but slightly more
-// efficient.
+// 1-char string within a `ByString` delimiter, but slightly more efficient.
 //
 // Example:
 //
@@ -164,9 +163,9 @@ class ByChar {
 // ByAnyChar
 //
 // A delimiter that will match any of the given byte-sized characters within
-// its provided std::string.
+// its provided string.
 //
-// Note: this delimiter works with single-byte std::string data, but does not work
+// Note: this delimiter works with single-byte string data, but does not work
 // with variable-width encodings, such as UTF-8.
 //
 // Example:
@@ -175,8 +174,8 @@ class ByChar {
 //   std::vector<std::string> v = absl::StrSplit("a,b=c", ByAnyChar(",="));
 //   // v[0] == "a", v[1] == "b", v[2] == "c"
 //
-// If `ByAnyChar` is given the empty std::string, it behaves exactly like
-// `ByString` and matches each individual character in the input std::string.
+// If `ByAnyChar` is given the empty string, it behaves exactly like
+// `ByString` and matches each individual character in the input string.
 //
 class ByAnyChar {
  public:
@@ -192,7 +191,7 @@ class ByAnyChar {
 // A delimiter for splitting into equal-length strings. The length argument to
 // the constructor must be greater than 0.
 //
-// Note: this delimiter works with single-byte std::string data, but does not work
+// Note: this delimiter works with single-byte string data, but does not work
 // with variable-width encodings, such as UTF-8.
 //
 // Example:
@@ -202,13 +201,13 @@ class ByAnyChar {
 
 //   // v[0] == "123", v[1] == "456", v[2] == "789"
 //
-// Note that the std::string does not have to be a multiple of the fixed split
+// Note that the string does not have to be a multiple of the fixed split
 // length. In such a case, the last substring will be shorter.
 //
 //   using absl::ByLength;
 //   std::vector<std::string> v = absl::StrSplit("12345", ByLength(2));
 //
-//   // v[0] == "12", v[1] == "35", v[2] == "5"
+//   // v[0] == "12", v[1] == "34", v[2] == "5"
 class ByLength {
  public:
   explicit ByLength(ptrdiff_t length);
@@ -223,9 +222,9 @@ namespace strings_internal {
 // A traits-like metafunction for selecting the default Delimiter object type
 // for a particular Delimiter type. The base case simply exposes type Delimiter
 // itself as the delimiter's Type. However, there are specializations for
-// std::string-like objects that map them to the ByString delimiter object.
+// string-like objects that map them to the ByString delimiter object.
 // This allows functions like absl::StrSplit() and absl::MaxSplits() to accept
-// std::string-like objects (e.g., ',') as delimiter arguments but they will be
+// string-like objects (e.g., ',') as delimiter arguments but they will be
 // treated as if a ByString delimiter was given.
 template <typename Delimiter>
 struct SelectDelimiter {
@@ -261,7 +260,8 @@ class MaxSplitsImpl {
       : delimiter_(delimiter), limit_(limit), count_(0) {}
   absl::string_view Find(absl::string_view text, size_t pos) {
     if (count_++ == limit_) {
-      return absl::string_view(text.end(), 0);  // No more matches.
+      return absl::string_view(text.data() + text.size(),
+                               0);  // No more matches.
     }
     return delimiter_.Find(text, pos);
   }
@@ -331,7 +331,7 @@ struct AllowEmpty {
 // SkipEmpty()
 //
 // Returns `false` if the given `absl::string_view` is empty, indicating that
-// `StrSplit()` should omit the empty std::string.
+// `StrSplit()` should omit the empty string.
 //
 // Example:
 //
@@ -339,7 +339,7 @@ struct AllowEmpty {
 //
 //   // v[0] == "a", v[1] == "b"
 //
-// Note: `SkipEmpty()` does not consider a std::string containing only whitespace
+// Note: `SkipEmpty()` does not consider a string containing only whitespace
 // to be empty. To skip such whitespace as well, use the `SkipWhitespace()`
 // predicate.
 struct SkipEmpty {
@@ -349,7 +349,7 @@ struct SkipEmpty {
 // SkipWhitespace()
 //
 // Returns `false` if the given `absl::string_view` is empty *or* contains only
-// whitespace, indicating that `StrSplit()` should omit the std::string.
+// whitespace, indicating that `StrSplit()` should omit the string.
 //
 // Example:
 //
@@ -373,11 +373,11 @@ struct SkipWhitespace {
 
 // StrSplit()
 //
-// Splits a given `std::string` based on the provided `Delimiter` object,
-// returning the elements within the type specified by the caller. Optionally,
-// you may also pass a `Predicate` to `StrSplit()` indicating whether to include
-// or exclude the resulting element within the final result set. (See the
-// overviews for Delimiters and Predicates above.)
+// Splits a given string based on the provided `Delimiter` object, returning the
+// elements within the type specified by the caller. Optionally, you may pass a
+// `Predicate` to `StrSplit()` indicating whether to include or exclude the
+// resulting element within the final result set. (See the overviews for
+// Delimiters and Predicates above.)
 //
 // Example:
 //
@@ -402,7 +402,7 @@ struct SkipWhitespace {
 //
 //   std::vector<std::string> v = absl::StrSplit(" a , ,,b,",
 //                                               ',', SkipWhitespace());
-//   // v[0] == "a", v[1] == "b"
+//   // v[0] == " a ", v[1] == "b"
 //
 // See above for more information on predicates.
 //
@@ -412,10 +412,10 @@ struct SkipWhitespace {
 //
 // The `StrSplit()` function adapts the returned collection to the collection
 // specified by the caller (e.g. `std::vector` above). The returned collections
-// may contain `string`, `absl::string_view` (in which case the original std::string
-// being split must ensure that it outlives the collection), or any object that
-// can be explicitly created from an `absl::string_view`. This behavior works
-// for:
+// may contain `std::string`, `absl::string_view` (in which case the original
+// string being split must ensure that it outlives the collection), or any
+// object that can be explicitly created from an `absl::string_view`. This
+// behavior works for:
 //
 // 1) All standard STL containers including `std::vector`, `std::list`,
 //    `std::deque`, `std::set`,`std::multiset`, 'std::map`, and `std::multimap`
@@ -424,7 +424,7 @@ struct SkipWhitespace {
 // Example:
 //
 //   // The results are returned as `absl::string_view` objects. Note that we
-//   // have to ensure that the input std::string outlives any results.
+//   // have to ensure that the input string outlives any results.
 //   std::vector<absl::string_view> v = absl::StrSplit("a,b,c", ',');
 //
 //   // Stores results in a std::set<std::string>, which also performs
@@ -444,7 +444,7 @@ struct SkipWhitespace {
 //   // is provided as a series of key/value pairs. For example, the 0th element
 //   // resulting from the split will be stored as a key to the 1st element. If
 //   // an odd number of elements are resolved, the last element is paired with
-//   // a default-constructed value (e.g., empty std::string).
+//   // a default-constructed value (e.g., empty string).
 //   std::map<std::string, std::string> m = absl::StrSplit("a,b,c", ',');
 //   // m["a"] == "b", m["c"] == ""     // last component value equals ""
 //
@@ -452,7 +452,7 @@ struct SkipWhitespace {
 // elements and is not a collection type. When splitting to a `std::pair` the
 // first two split strings become the `std::pair` `.first` and `.second`
 // members, respectively. The remaining split substrings are discarded. If there
-// are less than two split substrings, the empty std::string is used for the
+// are less than two split substrings, the empty string is used for the
 // corresponding
 // `std::pair` member.
 //
@@ -467,7 +467,7 @@ struct SkipWhitespace {
 //
 // Example:
 //
-//   // The input std::string "a=b=c,d=e,f=,g" becomes
+//   // The input string "a=b=c,d=e,f=,g" becomes
 //   // { "a" => "b=c", "d" => "e", "f" => "", "g" => "" }
 //   std::map<std::string, std::string> m;
 //   for (absl::string_view sp : absl::StrSplit("a=b=c,d=e,f=,g", ',')) {
index 951e9cb..f8b2001 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,7 +19,7 @@
 //
 // This file contains the definition of the `absl::string_view` class. A
 // `string_view` points to a contiguous span of characters, often part or all of
-// another `std::string`, double-quoted std::string literal, character array, or even
+// another `std::string`, double-quoted string literal, character array, or even
 // another `string_view`.
 //
 // This `absl::string_view` abstraction is designed to be a drop-in
 
 #ifdef ABSL_HAVE_STD_STRING_VIEW
 
-#include <string_view>
+#include <string_view>  // IWYU pragma: export
 
 namespace absl {
 using std::string_view;
-};
+}  // namespace absl
 
 #else  // ABSL_HAVE_STD_STRING_VIEW
 
@@ -56,15 +56,15 @@ namespace absl {
 
 // absl::string_view
 //
-// A `string_view` provides a lightweight view into the std::string data provided by
-// a `std::string`, double-quoted std::string literal, character array, or even
-// another `string_view`. A `string_view` does *not* own the std::string to which it
+// A `string_view` provides a lightweight view into the string data provided by
+// a `std::string`, double-quoted string literal, character array, or even
+// another `string_view`. A `string_view` does *not* own the string to which it
 // points, and that data cannot be modified through the view.
 //
 // You can use `string_view` as a function or method parameter anywhere a
-// parameter can receive a double-quoted std::string literal, `const char*`,
+// parameter can receive a double-quoted string literal, `const char*`,
 // `std::string`, or another `absl::string_view` argument with no need to copy
-// the std::string data. Systematic use of `string_view` within function arguments
+// the string data. Systematic use of `string_view` within function arguments
 // reduces data copies and `strlen()` calls.
 //
 // Because of its small size, prefer passing `string_view` by value:
@@ -97,11 +97,10 @@ namespace absl {
 // `string_view` this way, it is your responsibility to ensure that the object
 // pointed to by the `string_view` outlives the `string_view`.
 //
-// A `string_view` may represent a whole std::string or just part of a std::string. For
-// example, when splitting a std::string, `std::vector<absl::string_view>` is a
+// A `string_view` may represent a whole string or just part of a string. For
+// example, when splitting a string, `std::vector<absl::string_view>` is a
 // natural data type for the output.
 //
-//
 // When constructed from a source which is nul-terminated, the `string_view`
 // itself will not include the nul-terminator unless a specific size (including
 // the nul) is passed to the constructor. As a result, common idioms that work
@@ -141,7 +140,7 @@ namespace absl {
 // All empty `string_view` objects whether null or not, are equal:
 //
 //   absl::string_view() == absl::string_view("", 0)
-//   absl::string_view(nullptr, 0) == absl:: string_view("abcdef"+6, 0)
+//   absl::string_view(nullptr, 0) == absl::string_view("abcdef"+6, 0)
 class string_view {
  public:
   using traits_type = std::char_traits<char>;
@@ -168,13 +167,24 @@ class string_view {
   string_view(  // NOLINT(runtime/explicit)
       const std::basic_string<char, std::char_traits<char>, Allocator>&
           str) noexcept
-      : ptr_(str.data()), length_(str.size()) {}
+      : ptr_(str.data()), length_(CheckLengthInternal(str.size())) {}
 
   // Implicit constructor of a `string_view` from nul-terminated `str`. When
   // accepting possibly null strings, use `absl::NullSafeStringView(str)`
   // instead (see below).
+#if ABSL_HAVE_BUILTIN(__builtin_strlen) || \
+    (defined(__GNUC__) && !defined(__clang__))
+  // GCC has __builtin_strlen according to
+  // https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Other-Builtins.html, but
+  // ABSL_HAVE_BUILTIN doesn't detect that, so we use the extra checks above.
+  // __builtin_strlen is constexpr.
   constexpr string_view(const char* str)  // NOLINT(runtime/explicit)
-      : ptr_(str), length_(StrLenInternal(str)) {}
+      : ptr_(str),
+        length_(CheckLengthInternal(str ? __builtin_strlen(str) : 0)) {}
+#else
+  constexpr string_view(const char* str)  // NOLINT(runtime/explicit)
+      : ptr_(str), length_(CheckLengthInternal(str ? strlen(str) : 0)) {}
+#endif
 
   // Implicit constructor of a `string_view` from a `const char*` and length.
   constexpr string_view(const char* data, size_type len)
@@ -266,7 +276,7 @@ class string_view {
   // Checks if the `string_view` is empty (refers to no characters).
   constexpr bool empty() const noexcept { return length_ == 0; }
 
-  // std::string:view::operator[]
+  // string_view::operator[]
   //
   // Returns the ith element of an `string_view` using the array operator.
   // Note that this operator does not perform any bounds checking.
@@ -295,9 +305,8 @@ class string_view {
 
   // string_view::remove_prefix()
   //
-  // Removes the first `n` characters from the `string_view`, returning a
-  // pointer to the new first character. Note that the underlying std::string is not
-  // changed, only the view.
+  // Removes the first `n` characters from the `string_view`. Note that the
+  // underlying std::string is not changed, only the view.
   void remove_prefix(size_type n) {
     assert(n <= length_);
     ptr_ += n;
@@ -341,24 +350,24 @@ class string_view {
   //
   // Returns a "substring" of the `string_view` (at offset `pos` and length
   // `n`) as another string_view. This function throws `std::out_of_bounds` if
-  // `pos > size'.
+  // `pos > size`.
   string_view substr(size_type pos, size_type n = npos) const {
     if (ABSL_PREDICT_FALSE(pos > length_))
       base_internal::ThrowStdOutOfRange("absl::string_view::substr");
-    n = std::min(n, length_ - pos);
+    n = (std::min)(n, length_ - pos);
     return string_view(ptr_ + pos, n);
   }
 
   // string_view::compare()
   //
   // Performs a lexicographical comparison between the `string_view` and
-  // another `absl::string_view), returning -1 if `this` is less than, 0 if
+  // another `absl::string_view`, returning -1 if `this` is less than, 0 if
   // `this` is equal to, and 1 if `this` is greater than the passed std::string
   // view. Note that in the case of data equality, a further comparison is made
   // on the respective sizes of the two `string_view`s to determine which is
   // smaller, equal, or greater.
   int compare(string_view x) const noexcept {
-    auto min_length = std::min(length_, x.length_);
+    auto min_length = (std::min)(length_, x.length_);
     if (min_length > 0) {
       int r = memcmp(ptr_, x.ptr_, min_length);
       if (r < 0) return -1;
@@ -420,7 +429,7 @@ class string_view {
   size_type rfind(string_view s, size_type pos = npos) const
       noexcept;
 
-  // Overload of `string_view::rfind()` for finding the given character `c`
+  // Overload of `string_view::rfind()` for finding the last given character `c`
   // within the `string_view`.
   size_type rfind(char c, size_type pos = npos) const noexcept;
 
@@ -480,23 +489,7 @@ class string_view {
 
  private:
   static constexpr size_type kMaxSize =
-      std::numeric_limits<size_type>::max() / 2 + 1;
-
-  // check whether __builtin_strlen is provided by the compiler.
-  // GCC doesn't have __has_builtin()
-  // (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970),
-  // but has __builtin_strlen according to
-  // https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Other-Builtins.html.
-#if ABSL_HAVE_BUILTIN(__builtin_strlen) || \
-    (defined(__GNUC__) && !defined(__clang__))
-  static constexpr size_type StrLenInternal(const char* str) {
-    return str ? __builtin_strlen(str) : 0;
-  }
-#else
-  static constexpr size_type StrLenInternal(const char* str) {
-    return str ? strlen(str) : 0;
-  }
-#endif
+      (std::numeric_limits<difference_type>::max)();
 
   static constexpr size_type CheckLengthInternal(size_type len) {
     return ABSL_ASSERT(len <= kMaxSize), len;
@@ -514,6 +507,7 @@ inline bool operator==(string_view x, string_view y) noexcept {
   if (len != y.size()) {
     return false;
   }
+
   return x.data() == y.data() || len <= 0 ||
          memcmp(x.data(), y.data(), len) == 0;
 }
@@ -523,7 +517,7 @@ inline bool operator!=(string_view x, string_view y) noexcept {
 }
 
 inline bool operator<(string_view x, string_view y) noexcept {
-  auto min_size = std::min(x.size(), y.size());
+  auto min_size = (std::min)(x.size(), y.size());
   const int r = min_size == 0 ? 0 : memcmp(x.data(), y.data(), min_size);
   return (r < 0) || (r == 0 && x.size() < y.size());
 }
@@ -553,7 +547,7 @@ namespace absl {
 // Provided because std::string_view::substr throws if `pos > size()`
 inline string_view ClippedSubstr(string_view s, size_t pos,
                                  size_t n = string_view::npos) {
-  pos = std::min(pos, static_cast<size_t>(s.size()));
+  pos = (std::min)(pos, static_cast<size_t>(s.size()));
   return s.substr(pos, n);
 }
 
index 370f9e8..e1341e0 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,7 +17,7 @@
 // File: strip.h
 // -----------------------------------------------------------------------------
 //
-// This file contains various functions for stripping substrings from a std::string.
+// This file contains various functions for stripping substrings from a string.
 #ifndef ABSL_STRINGS_STRIP_H_
 #define ABSL_STRINGS_STRIP_H_
 
@@ -33,7 +33,7 @@ namespace absl {
 
 // ConsumePrefix()
 //
-// Strips the `expected` prefix from the start of the given std::string, returning
+// Strips the `expected` prefix from the start of the given string, returning
 // `true` if the strip operation succeeded or false otherwise.
 //
 // Example:
@@ -48,7 +48,7 @@ inline bool ConsumePrefix(absl::string_view* str, absl::string_view expected) {
 }
 // ConsumeSuffix()
 //
-// Strips the `expected` suffix from the end of the given std::string, returning
+// Strips the `expected` suffix from the end of the given string, returning
 // `true` if the strip operation succeeded or false otherwise.
 //
 // Example:
@@ -64,22 +64,22 @@ inline bool ConsumeSuffix(absl::string_view* str, absl::string_view expected) {
 
 // StripPrefix()
 //
-// Returns a view into the input std::string 'str' with the given 'prefix' removed,
-// but leaving the original std::string intact. If the prefix does not match at the
-// start of the std::string, returns the original std::string instead.
-inline absl::string_view StripPrefix(absl::string_view str,
-                                     absl::string_view prefix) {
+// Returns a view into the input string 'str' with the given 'prefix' removed,
+// but leaving the original string intact. If the prefix does not match at the
+// start of the string, returns the original string instead.
+ABSL_MUST_USE_RESULT inline absl::string_view StripPrefix(
+    absl::string_view str, absl::string_view prefix) {
   if (absl::StartsWith(str, prefix)) str.remove_prefix(prefix.size());
   return str;
 }
 
 // StripSuffix()
 //
-// Returns a view into the input std::string 'str' with the given 'suffix' removed,
-// but leaving the original std::string intact. If the suffix does not match at the
-// end of the std::string, returns the original std::string instead.
-inline absl::string_view StripSuffix(absl::string_view str,
-                                     absl::string_view suffix) {
+// Returns a view into the input string 'str' with the given 'suffix' removed,
+// but leaving the original string intact. If the suffix does not match at the
+// end of the string, returns the original string instead.
+ABSL_MUST_USE_RESULT inline absl::string_view StripSuffix(
+    absl::string_view str, absl::string_view suffix) {
   if (absl::EndsWith(str, suffix)) str.remove_suffix(suffix.size());
   return str;
 }
index 3fc4ac4..233e9dc 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // File: substitute.h
 // -----------------------------------------------------------------------------
 //
-// This package contains functions for efficiently performing std::string
-// substitutions using a format std::string with positional notation:
+// This package contains functions for efficiently performing string
+// substitutions using a format string with positional notation:
 // `Substitute()` and `SubstituteAndAppend()`.
 //
 // Unlike printf-style format specifiers, `Substitute()` functions do not need
 // to specify the type of the substitution arguments. Supported arguments
-// following the format std::string, such as strings, string_views, ints,
+// following the format string, such as strings, string_views, ints,
 // floats, and bools, are automatically converted to strings during the
 // substitution process. (See below for a full list of supported types.)
 //
 // `Substitute()` does not allow you to specify *how* to format a value, beyond
-// the default conversion to std::string. For example, you cannot format an integer
+// the default conversion to string. For example, you cannot format an integer
 // in hex.
 //
-// The format std::string uses positional identifiers indicated by a dollar sign ($)
+// The format string uses positional identifiers indicated by a dollar sign ($)
 // and single digit positional ids to indicate which substitution arguments to
-// use at that location within the format std::string.
+// use at that location within the format string.
+//
+// A '$$' sequence in the format string causes a literal '$' character to be
+// output.
 //
 // Example 1:
-//   std::string s = Substitute("$1 purchased $0 $2. Thanks $1!",
-//                         5, "Bob", "Apples");
-//   EXPECT_EQ("Bob purchased 5 Apples. Thanks Bob!", s);
+//   std::string s = Substitute("$1 purchased $0 $2 for $$10. Thanks $1!",
+//                              5, "Bob", "Apples");
+//   EXPECT_EQ("Bob purchased 5 Apples for $10. Thanks Bob!", s);
 //
 // Example 2:
 //   std::string s = "Hi. ";
 //   SubstituteAndAppend(&s, "My name is $0 and I am $1 years old.", "Bob", 5);
 //   EXPECT_EQ("Hi. My name is Bob and I am 5 years old.", s);
 //
-// Differences from `StringPrintf()`:
-//   * The format std::string does not identify the types of arguments. Instead, the
-//     arguments are implicitly converted to strings. See below for a list of
-//     accepted types.
-//   * Substitutions in the format std::string are identified by a '$' followed by a
-//     single digit. You can use arguments out-of-order and use the same
-//     argument multiple times.
-//   * A '$$' sequence in the format std::string means output a literal '$'
-//     character.
-//   * `Substitute()` is significantly faster than `StringPrintf()`. For very
-//     large strings, it may be orders of magnitude faster.
-//
 // Supported types:
 //   * absl::string_view, std::string, const char* (null is equivalent to "")
 //   * int32_t, int64_t, uint32_t, uint64
 //   * float, double
 //   * bool (Printed as "true" or "false")
-//   * pointer types other than char* (Printed as "0x<lower case hex std::string>",
+//   * pointer types other than char* (Printed as "0x<lower case hex string>",
 //     except that null is printed as "NULL")
 //
-// If an invalid format std::string is provided, Substitute returns an empty std::string
-// and SubstituteAndAppend does not change the provided output std::string.
-// A format std::string is invalid if it:
+// If an invalid format string is provided, Substitute returns an empty string
+// and SubstituteAndAppend does not change the provided output string.
+// A format string is invalid if it:
 //   * ends in an unescaped $ character,
 //     e.g. "Hello $", or
 //   * calls for a position argument which is not provided,
 
 #include <cstring>
 #include <string>
+#include <type_traits>
+#include <vector>
 
 #include "absl/base/macros.h"
 #include "absl/base/port.h"
 #include "absl/strings/ascii.h"
 #include "absl/strings/escaping.h"
 #include "absl/strings/numbers.h"
-#include "absl/strings/str_join.h"
+#include "absl/strings/str_cat.h"
 #include "absl/strings/str_split.h"
 #include "absl/strings/string_view.h"
 #include "absl/strings/strip.h"
@@ -99,7 +92,7 @@ namespace substitute_internal {
 //
 // This class provides an argument type for `absl::Substitute()` and
 // `absl::SubstituteAndAppend()`. `Arg` handles implicit conversion of various
-// types to a std::string. (`Arg` is very similar to the `AlphaNum` class in
+// types to a string. (`Arg` is very similar to the `AlphaNum` class in
 // `StrCat()`.)
 //
 // This class has implicit constructors.
@@ -109,8 +102,11 @@ class Arg {
   //
   // Explicitly overload `const char*` so the compiler doesn't cast to `bool`.
   Arg(const char* value)  // NOLINT(runtime/explicit)
-      : piece_(value) {}
-  Arg(const std::string& value)  // NOLINT(runtime/explicit)
+      : piece_(absl::NullSafeStringView(value)) {}
+  template <typename Allocator>
+  Arg(  // NOLINT
+      const std::basic_string<char, std::char_traits<char>, Allocator>&
+          value) noexcept
       : piece_(value) {}
   Arg(absl::string_view value)  // NOLINT(runtime/explicit)
       : piece_(value) {}
@@ -124,10 +120,10 @@ class Arg {
   // what to do.
   Arg(char value)  // NOLINT(runtime/explicit)
       : piece_(scratch_, 1) { scratch_[0] = value; }
-  Arg(short value)  // NOLINT(runtime/explicit)
+  Arg(short value)  // NOLINT(*)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
-  Arg(unsigned short value)  // NOLINT(runtime/explicit)
+  Arg(unsigned short value)  // NOLINT(*)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
   Arg(int value)  // NOLINT(runtime/explicit)
@@ -136,16 +132,16 @@ class Arg {
   Arg(unsigned int value)  // NOLINT(runtime/explicit)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
-  Arg(long value)  // NOLINT(runtime/explicit)
+  Arg(long value)  // NOLINT(*)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
-  Arg(unsigned long value)  // NOLINT(runtime/explicit)
+  Arg(unsigned long value)  // NOLINT(*)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
-  Arg(long long value)  // NOLINT(runtime/explicit)
+  Arg(long long value)  // NOLINT(*)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
-  Arg(unsigned long long value)  // NOLINT(runtime/explicit)
+  Arg(unsigned long long value)  // NOLINT(*)
       : piece_(scratch_,
                numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
   Arg(float value)  // NOLINT(runtime/explicit)
@@ -156,9 +152,23 @@ class Arg {
   }
   Arg(bool value)  // NOLINT(runtime/explicit)
       : piece_(value ? "true" : "false") {}
+
+  Arg(Hex hex);  // NOLINT(runtime/explicit)
+  Arg(Dec dec);  // NOLINT(runtime/explicit)
+
+  // vector<bool>::reference and const_reference require special help to
+  // convert to `AlphaNum` because it requires two user defined conversions.
+  template <typename T,
+            absl::enable_if_t<
+                std::is_class<T>::value &&
+                (std::is_same<T, std::vector<bool>::reference>::value ||
+                 std::is_same<T, std::vector<bool>::const_reference>::value)>* =
+                nullptr>
+  Arg(T value)  // NOLINT(google-explicit-constructor)
+      : Arg(static_cast<bool>(value)) {}
+
   // `void*` values, with the exception of `char*`, are printed as
-  // `StringPrintf()` with format "%p": e.g. ("0x<hex value>").
-  // However, in the case of `nullptr`, "NULL" is printed.
+  // "0x<hex value>". However, in the case of `nullptr`, "NULL" is printed.
   Arg(const void* value);  // NOLINT(runtime/explicit)
 
   Arg(const Arg&) = delete;
@@ -202,8 +212,8 @@ constexpr int PlaceholderBitmask(const char* format) {
 
 // SubstituteAndAppend()
 //
-// Substitutes variables into a given format std::string and appends to a given
-// output std::string. See file comments above for usage.
+// Substitutes variables into a given format string and appends to a given
+// output string. See file comments above for usage.
 //
 // The declarations of `SubstituteAndAppend()` below consist of overloads
 // for passing 0 to 10 arguments, respectively.
@@ -449,7 +459,7 @@ void SubstituteAndAppend(
 
 // Substitute()
 //
-// Substitutes variables into a given format std::string. See file comments above
+// Substitutes variables into a given format string. See file comments above
 // for usage.
 //
 // The declarations of `Substitute()` below consist of overloads for passing 0
@@ -579,70 +589,70 @@ std::string Substitute(const char* format, const substitute_internal::Arg& a0)
                      "contains one of $1-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1)
+                       const substitute_internal::Arg& a1)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 3,
                      "There were 2 substitution arguments given, but "
                      "this format std::string is either missing its $0/$1, or "
                      "contains one of $2-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1,
-                  const substitute_internal::Arg& a2)
+                       const substitute_internal::Arg& a1,
+                       const substitute_internal::Arg& a2)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 7,
                      "There were 3 substitution arguments given, but "
                      "this format std::string is either missing its $0/$1/$2, or "
                      "contains one of $3-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1,
-                  const substitute_internal::Arg& a2,
-                  const substitute_internal::Arg& a3)
+                       const substitute_internal::Arg& a1,
+                       const substitute_internal::Arg& a2,
+                       const substitute_internal::Arg& a3)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 15,
                      "There were 4 substitution arguments given, but "
                      "this format std::string is either missing its $0-$3, or "
                      "contains one of $4-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1,
-                  const substitute_internal::Arg& a2,
-                  const substitute_internal::Arg& a3,
-                  const substitute_internal::Arg& a4)
+                       const substitute_internal::Arg& a1,
+                       const substitute_internal::Arg& a2,
+                       const substitute_internal::Arg& a3,
+                       const substitute_internal::Arg& a4)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 31,
                      "There were 5 substitution arguments given, but "
                      "this format std::string is either missing its $0-$4, or "
                      "contains one of $5-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1,
-                  const substitute_internal::Arg& a2,
-                  const substitute_internal::Arg& a3,
-                  const substitute_internal::Arg& a4,
-                  const substitute_internal::Arg& a5)
+                       const substitute_internal::Arg& a1,
+                       const substitute_internal::Arg& a2,
+                       const substitute_internal::Arg& a3,
+                       const substitute_internal::Arg& a4,
+                       const substitute_internal::Arg& a5)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 63,
                      "There were 6 substitution arguments given, but "
                      "this format std::string is either missing its $0-$5, or "
                      "contains one of $6-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1,
-                  const substitute_internal::Arg& a2,
-                  const substitute_internal::Arg& a3,
-                  const substitute_internal::Arg& a4,
-                  const substitute_internal::Arg& a5,
-                  const substitute_internal::Arg& a6)
+                       const substitute_internal::Arg& a1,
+                       const substitute_internal::Arg& a2,
+                       const substitute_internal::Arg& a3,
+                       const substitute_internal::Arg& a4,
+                       const substitute_internal::Arg& a5,
+                       const substitute_internal::Arg& a6)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 127,
                      "There were 7 substitution arguments given, but "
                      "this format std::string is either missing its $0-$6, or "
                      "contains one of $7-$9");
 
 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
-                  const substitute_internal::Arg& a1,
-                  const substitute_internal::Arg& a2,
-                  const substitute_internal::Arg& a3,
-                  const substitute_internal::Arg& a4,
-                  const substitute_internal::Arg& a5,
-                  const substitute_internal::Arg& a6,
-                  const substitute_internal::Arg& a7)
+                       const substitute_internal::Arg& a1,
+                       const substitute_internal::Arg& a2,
+                       const substitute_internal::Arg& a3,
+                       const substitute_internal::Arg& a4,
+                       const substitute_internal::Arg& a5,
+                       const substitute_internal::Arg& a6,
+                       const substitute_internal::Arg& a7)
     ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 255,
                      "There were 8 substitution arguments given, but "
                      "this format std::string is either missing its $0-$7, or "
index f834fee..23bb2f5 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
index 476d5f8..4c66e0a 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -93,4 +93,5 @@ class BlockingCounter {
 };
 
 }  // namespace absl
+
 #endif  // ABSL_SYNCHRONIZATION_BLOCKING_COUNTER_H_
index 1bb87de..ebb16c5 100644 (file)
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      https://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -50,4 +50,5 @@ inline base_internal::ThreadIdentity* GetOrCreateCurrentThreadIdentity() {
 
 }  // namespace synchronization_internal
 }  // namespace absl
+
 #endif  // ABSL_SYNCHRONIZATION_INTERNAL_CREATE_THREAD_IDENTITY_H_
index 53474b7..e5bde00 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -133,4 +133,5 @@ class GraphCycles {
 
 }  // namespace synchronization_internal
 }  // namespace absl
+
 #endif
index a83c427..61c72e7 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -25,9 +25,6 @@
 #ifndef ABSL_SYNCHRONIZATION_INTERNAL_KERNEL_TIMEOUT_H_
 #define ABSL_SYNCHRONIZATION_INTERNAL_KERNEL_TIMEOUT_H_
 
-#ifdef _WIN32
-#include <intsafe.h>
-#endif
 #include <time.h>
 #include <algorithm>
 #include <limits>
@@ -39,6 +36,7 @@
 namespace absl {
 namespace synchronization_internal {
 
+class Futex;
 class Waiter;
 
 class KernelTimeout {
@@ -55,6 +53,7 @@ class KernelTimeout {
 
   // We explicitly do not support other custom formats: timespec, int64_t nanos.
   // Unify on this and absl::Time, please.
+
   bool has_timeout() const { return ns_ != 0; }
 
  private:
@@ -78,7 +77,7 @@ class KernelTimeout {
     if (x <= 0) x = 1;
     // A time larger than what can be represented to the kernel is treated
     // as no timeout.
-    if (x == std::numeric_limits<int64_t>::max()) x = 0;
+    if (x == (std::numeric_limits<int64_t>::max)()) x = 0;
     return x;
   }
 
@@ -92,7 +91,7 @@ class KernelTimeout {
           ERROR,
           "Tried to create a timespec from a non-timeout; never do this.");
       // But we'll try to continue sanely.  no-timeout ~= saturated timeout.
-      n = std::numeric_limits<int64_t>::max();
+      n = (std::numeric_limits<int64_t>::max)();
     }
 
     // Kernel APIs validate timespecs as being at or after the epoch,
@@ -102,8 +101,8 @@ class KernelTimeout {
     if (n < 0) n = 0;
 
     struct timespec abstime;
-    int64_t seconds = std::min(n / kNanosPerSecond,
-                             int64_t{std::numeric_limits<time_t>::max()});
+    int64_t seconds = (std::min)(n / kNanosPerSecond,
+                               int64_t{(std::numeric_limits<time_t>::max)()});
     abstime.tv_sec = static_cast<time_t>(seconds);
     abstime.tv_nsec =
         static_cast<decltype(abstime.tv_nsec)>(n % kNanosPerSecond);
@@ -116,9 +115,14 @@ class KernelTimeout {
   // Windows. Callers should recognize that the return value is a
   // relative duration (it should be recomputed by calling this method
   // in the case of a spurious wakeup).
-  DWORD InMillisecondsFromNow() const {
+  // This header file may be included transitively by public header files,
+  // so we define our own DWORD and INFINITE instead of getting them from
+  // <intsafe.h> and <WinBase.h>.
+  typedef unsigned long DWord;  // NOLINT
+  DWord InMillisecondsFromNow() const {
+    constexpr DWord kInfinite = (std::numeric_limits<DWord>::max)();
     if (!has_timeout()) {
-      return INFINITE;
+      return kInfinite;
     }
     // The use of absl::Now() to convert from absolute time to
     // relative time means that absl::Now() cannot use anything that
@@ -127,21 +131,23 @@ class KernelTimeout {
     if (ns_ >= now) {
       // Round up so that Now() + ms_from_now >= ns_.
       constexpr uint64_t max_nanos =
-          std::numeric_limits<int64_t>::max() - 999999u;
+          (std::numeric_limits<int64_t>::max)() - 999999u;
       uint64_t ms_from_now =
           (std::min<uint64_t>(max_nanos, ns_ - now) + 999999u) / 1000000u;
-      if (ms_from_now > std::numeric_limits<DWORD>::max()) {
-        return INFINITE;
+      if (ms_from_now > kInfinite) {
+        return kInfinite;
       }
-      return static_cast<DWORD>(ms_from_now);
+      return static_cast<DWord>(ms_from_now);
     }
     return 0;
   }
 #endif
 
+  friend class Futex;
   friend class Waiter;
 };
 
 }  // namespace synchronization_internal
 }  // namespace absl
+
 #endif  // ABSL_SYNCHRONIZATION_INTERNAL_KERNEL_TIMEOUT_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc
new file mode 100644 (file)
index 0000000..b8d5af7
--- /dev/null
@@ -0,0 +1,259 @@
+// Do not include.  This is an implementation detail of base/mutex.h.
+//
+// Declares three classes:
+//
+// base::internal::MutexImpl - implementation helper for Mutex
+// base::internal::CondVarImpl - implementation helper for CondVar
+// base::internal::SynchronizationStorage<T> - implementation helper for
+//                                             Mutex, CondVar
+
+#include <type_traits>
+
+#if defined(_WIN32)
+#include <condition_variable>
+#include <mutex>
+#else
+#include <pthread.h>
+#endif
+
+#include "absl/base/call_once.h"
+#include "absl/time/time.h"
+
+// Declare that Mutex::ReaderLock is actually Lock().  Intended primarily
+// for tests, and even then as a last resort.
+#ifdef ABSL_MUTEX_READER_LOCK_IS_EXCLUSIVE
+#error ABSL_MUTEX_READER_LOCK_IS_EXCLUSIVE cannot be directly set
+#else
+#define ABSL_MUTEX_READER_LOCK_IS_EXCLUSIVE 1
+#endif
+
+// Declare that Mutex::EnableInvariantDebugging is not implemented.
+// Intended primarily for tests, and even then as a last resort.
+#ifdef ABSL_MUTEX_ENABLE_INVARIANT_DEBUGGING_NOT_IMPLEMENTED
+#error ABSL_MUTEX_ENABLE_INVARIANT_DEBUGGING_NOT_IMPLEMENTED cannot be directly set
+#else
+#define ABSL_MUTEX_ENABLE_INVARIANT_DEBUGGING_NOT_IMPLEMENTED 1
+#endif
+
+namespace absl {
+class Condition;
+
+namespace synchronization_internal {
+
+class MutexImpl;
+
+// Do not use this implementation detail of CondVar. Provides most of the
+// implementation, but should not be placed directly in static storage
+// because it will not linker initialize properly. See
+// SynchronizationStorage<T> below for what we mean by linker
+// initialization.
+class CondVarImpl {
+ public:
+  CondVarImpl();
+  CondVarImpl(const CondVarImpl&) = delete;
+  CondVarImpl& operator=(const CondVarImpl&) = delete;
+  ~CondVarImpl();
+
+  void Signal();
+  void SignalAll();
+  void Wait(MutexImpl* mutex);
+  bool WaitWithDeadline(MutexImpl* mutex, absl::Time deadline);
+
+ private:
+#if defined(_WIN32)
+  std::condition_variable_any std_cv_;
+#else
+  pthread_cond_t pthread_cv_;
+#endif
+};
+
+// Do not use this implementation detail of Mutex. Provides most of the
+// implementation, but should not be placed directly in static storage
+// because it will not linker initialize properly. See
+// SynchronizationStorage<T> below for what we mean by linker
+// initialization.
+class MutexImpl {
+ public:
+  MutexImpl();
+  MutexImpl(const MutexImpl&) = delete;
+  MutexImpl& operator=(const MutexImpl&) = delete;
+  ~MutexImpl();
+
+  void Lock();
+  bool TryLock();
+  void Unlock();
+  void Await(const Condition& cond);
+  bool AwaitWithDeadline(const Condition& cond, absl::Time deadline);
+
+ private:
+  friend class CondVarImpl;
+
+#if defined(_WIN32)
+  std::mutex std_mutex_;
+#else
+  pthread_mutex_t pthread_mutex_;
+#endif
+
+  // True if the underlying mutex is locked.  If the destructor is entered
+  // while locked_, the underlying mutex is unlocked.  Mutex supports
+  // destruction while locked, but the same is undefined behavior for both
+  // pthread_mutex_t and std::mutex.
+  bool locked_ = false;
+
+  // Signaled before releasing the lock, in support of Await.
+  CondVarImpl released_;
+};
+
+// Do not use this implementation detail of CondVar and Mutex.  A storage
+// space for T that supports a LinkerInitialized constructor. T must
+// have a default constructor, which is called by the first call to
+// get(). T's destructor is never called if the LinkerInitialized
+// constructor is called.
+//
+// Objects constructed with the default constructor are constructed and
+// destructed like any other object, and should never be allocated in
+// static storage.
+//
+// Objects constructed with the LinkerInitialized constructor should
+// always be in static storage. For such objects, calls to get() are always
+// valid, except from signal handlers.
+//
+// Note that this implementation relies on undefined language behavior that
+// are known to hold for the set of supported compilers. An analysis
+// follows.
+//
+// From the C++11 standard:
+//
+// [basic.life] says an object has non-trivial initialization if it is of
+// class type and it is initialized by a constructor other than a trivial
+// default constructor.  (the LinkerInitialized constructor is
+// non-trivial)
+//
+// [basic.life] says the lifetime of an object with a non-trivial
+// constructor begins when the call to the constructor is complete.
+//
+// [basic.life] says the lifetime of an object with non-trivial destructor
+// ends when the call to the destructor begins.
+//
+// [basic.life] p5 specifies undefined behavior when accessing non-static
+// members of an instance outside its
+// lifetime. (SynchronizationStorage::get() access non-static members)
+//
+// So, LinkerInitialized object of SynchronizationStorage uses a
+// non-trivial constructor, which is called at some point during dynamic
+// initialization, and is therefore subject to order of dynamic
+// initialization bugs, where get() is called before the object's
+// constructor is, resulting in undefined behavior.
+//
+// Similarly, a LinkerInitialized SynchronizationStorage object has a
+// non-trivial destructor, and so its lifetime ends at some point during
+// destruction of objects with static storage duration [basic.start.term]
+// p4. There is a window where other exit code could call get() after this
+// occurs, resulting in undefined behavior.
+//
+// Combined, these statements imply that LinkerInitialized instances
+// of SynchronizationStorage<T> rely on undefined behavior.
+//
+// However, in practice, the implementation works on all supported
+// compilers. Specifically, we rely on:
+//
+// a) zero-initialization being sufficient to initialize
+// LinkerInitialized instances for the purposes of calling
+// get(), regardless of when the constructor is called. This is
+// because the is_dynamic_ boolean is correctly zero-initialized to
+// false.
+//
+// b) the LinkerInitialized constructor is a NOP, and immaterial to
+// even to concurrent calls to get().
+//
+// c) the destructor being a NOP for LinkerInitialized objects
+// (guaranteed by a check for !is_dynamic_), and so any concurrent and
+// subsequent calls to get() functioning as if the destructor were not
+// called, by virtue of the instances' storage remaining valid after the
+// destructor runs.
+//
+// d) That a-c apply transitively when SynchronizationStorage<T> is the
+// only member of a class allocated in static storage.
+//
+// Nothing in the language standard guarantees that a-d hold.  In practice,
+// these hold in all supported compilers.
+//
+// Future direction:
+//
+// Ideally, we would simply use std::mutex or a similar class, which when
+// allocated statically would support use immediately after static
+// initialization up until static storage is reclaimed (i.e. the properties
+// we require of all "linker initialized" instances).
+//
+// Regarding construction in static storage, std::mutex is required to
+// provide a constexpr default constructor [thread.mutex.class], which
+// ensures the instance's lifetime begins with static initialization
+// [basic.start.init], and so is immune to any problems caused by the order
+// of dynamic initialization. However, as of this writing Microsoft's
+// Visual Studio does not provide a constexpr constructor for std::mutex.
+// See
+// https://blogs.msdn.microsoft.com/vcblog/2015/06/02/constexpr-complete-for-vs-2015-rtm-c11-compiler-c17-stl/
+//
+// Regarding destruction of instances in static storage, [basic.life] does
+// say an object ends when storage in which the occupies is released, in
+// the case of non-trivial destructor. However, std::mutex is not specified
+// to have a trivial destructor.
+//
+// So, we would need a class with a constexpr default constructor and a
+// trivial destructor. Today, we can achieve neither desired property using
+// std::mutex directly.
+template <typename T>
+class SynchronizationStorage {
+ public:
+  // Instances allocated on the heap or on the stack should use the default
+  // constructor.
+  SynchronizationStorage()
+      : is_dynamic_(true), once_() {}
+
+  // Instances allocated in static storage (not on the heap, not on the
+  // stack) should use this constructor.
+  explicit SynchronizationStorage(base_internal::LinkerInitialized) {}
+
+  constexpr explicit SynchronizationStorage(absl::ConstInitType)
+      : is_dynamic_(false), once_(), space_{{0}} {}
+
+  SynchronizationStorage(SynchronizationStorage&) = delete;
+  SynchronizationStorage& operator=(SynchronizationStorage&) = delete;
+
+  ~SynchronizationStorage() {
+    if (is_dynamic_) {
+      get()->~T();
+    }
+  }
+
+  // Retrieve the object in storage. This is fast and thread safe, but does
+  // incur the cost of absl::call_once().
+  //
+  // For instances in static storage constructed with the
+  // LinkerInitialized constructor, may be called at any time without
+  // regard for order of dynamic initialization or destruction of objects
+  // in static storage. See the class comment for caveats.
+  T* get() {
+    absl::call_once(once_, SynchronizationStorage::Construct, this);
+    return reinterpret_cast<T*>(&space_);
+  }
+
+ private:
+  static void Construct(SynchronizationStorage<T>* self) {
+    new (&self->space_) T();
+  }
+
+  // When true, T's destructor is run when this is destructed.
+  //
+  // The LinkerInitialized constructor assumes this value will be set
+  // false by static initialization.
+  bool is_dynamic_;
+
+  absl::once_flag once_;
+
+  // An aligned space for T.
+  typename std::aligned_storage<sizeof(T), alignof(T)>::type space_;
+};
+
+}  // namespace synchronization_internal
+}  // namespace absl
index 678b69e..e7da070 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -104,4 +104,5 @@ bool absl::synchronization_internal::PerThreadSem::Wait(
     absl::synchronization_internal::KernelTimeout t) {
   return AbslInternalPerThreadSemWait(t);
 }
+
 #endif  // ABSL_SYNCHRONIZATION_INTERNAL_PER_THREAD_SEM_H_
index 8464042..7f458f5 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,7 @@
 #define ABSL_SYNCHRONIZATION_INTERNAL_THREAD_POOL_H_
 
 #include <cassert>
+#include <cstddef>
 #include <functional>
 #include <queue>
 #include <thread>  // NOLINT(build/c++11)
@@ -42,7 +43,7 @@ class ThreadPool {
   ~ThreadPool() {
     {
       absl::MutexLock l(&mu_);
-      for (int i = 0; i < threads_.size(); ++i) {
+      for (size_t i = 0; i < threads_.size(); i++) {
         queue_.push(nullptr);  // Shutdown signal.
       }
     }
index 025ace4..a3e3124 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,9 +18,7 @@
 
 #include "absl/base/config.h"
 
-#ifdef _WIN32
-#include <windows.h>
-#else
+#ifndef _WIN32
 #include <pthread.h>
 #endif
 
@@ -29,6 +27,7 @@
 #endif
 
 #include <atomic>
+#include <cstdint>
 
 #include "absl/base/internal/thread_identity.h"
 #include "absl/synchronization/internal/kernel_timeout.h"
@@ -99,10 +98,10 @@ class Waiter {
 
  private:
 #if ABSL_WAITER_MODE == ABSL_WAITER_MODE_FUTEX
-  // Futexes are defined by specification to be ints.
-  // Thus std::atomic<int> must be just an int with lockfree methods.
-  std::atomic<int> futex_;
-  static_assert(sizeof(int) == sizeof(futex_), "Wrong size for futex");
+  // Futexes are defined by specification to be 32-bits.
+  // Thus std::atomic<int32_t> must be just an int32_t with lockfree methods.
+  std::atomic<int32_t> futex_;
+  static_assert(sizeof(int32_t) == sizeof(futex_), "Wrong size for futex");
 
 #elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_CONDVAR
   pthread_mutex_t mu_;
@@ -122,8 +121,20 @@ class Waiter {
   // primivitives.  We are using SRWLOCK and CONDITION_VARIABLE
   // because they don't require a destructor to release system
   // resources.
-  SRWLOCK mu_;
-  CONDITION_VARIABLE cv_;
+  //
+  // However, we can't include Windows.h in our headers, so we use aligned
+  // storage buffers to define the storage.
+  using SRWLockStorage =
+      typename std::aligned_storage<sizeof(void*), alignof(void*)>::type;
+  using ConditionVariableStorage =
+      typename std::aligned_storage<sizeof(void*), alignof(void*)>::type;
+
+  // WinHelper - Used to define utilities for accessing the lock and
+  // condition variable storage once the types are complete.
+  class WinHelper;
+
+  SRWLockStorage mu_storage_;
+  ConditionVariableStorage cv_storage_;
   std::atomic<int> waiter_count_;
   std::atomic<int> wakeup_count_;
 
index 8343c9c..c38e356 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -24,7 +24,7 @@
 // Unlike a `std::mutex`, the Abseil `Mutex` provides the following additional
 // features:
 //   * Conditional predicates intrinsic to the `Mutex` object
-//   * Reader/writer locks, in addition to standard exclusive/writer locks
+//   * Shared/reader locks, in addition to standard exclusive/writer locks
 //   * Deadlock detection and debug support.
 //
 // The following helper classes are also defined within this file:
 #include <cstdint>
 #include <string>
 
+#include "absl/base/const_init.h"
 #include "absl/base/internal/identity.h"
 #include "absl/base/internal/low_level_alloc.h"
 #include "absl/base/internal/thread_identity.h"
+#include "absl/base/internal/tsan_mutex_interface.h"
 #include "absl/base/port.h"
 #include "absl/base/thread_annotations.h"
 #include "absl/synchronization/internal/kernel_timeout.h"
@@ -135,7 +137,27 @@ struct SynchWaitParams;
 
 class LOCKABLE Mutex {
  public:
+  // Creates a `Mutex` that is not held by anyone. This constructor is
+  // typically used for Mutexes allocated on the heap or the stack.
+  //
+  // To create `Mutex` instances with static storage duration
+  // (e.g. a namespace-scoped or global variable), see
+  // `Mutex::Mutex(absl::kConstInit)` below instead.
   Mutex();
+
+  // Creates a mutex with static storage duration.  A global variable
+  // constructed this way avoids the lifetime issues that can occur on program
+  // startup and shutdown.  (See absl/base/const_init.h.)
+  //
+  // For Mutexes allocated on the heap and stack, instead use the default
+  // constructor, which can interact more fully with the thread sanitizer.
+  //
+  // Example usage:
+  //   namespace foo {
+  //   ABSL_CONST_INIT Mutex mu(absl::kConstInit);
+  //   }
+  explicit constexpr Mutex(absl::ConstInitType);
+
   ~Mutex();
 
   // Mutex::Lock()
@@ -232,8 +254,8 @@ class LOCKABLE Mutex {
   //
   // Aliases for `Mutex::Lock()`, `Mutex::Unlock()`, and `Mutex::TryLock()`.
   //
-  // Use the `Writer*()` versions of these method names when using complementary
-  // `Reader*()` methods to distingish simple exclusive `Mutex` usage (`Lock()`,
+  // These methods may be used (along with the complementary `Reader*()`
+  // methods) to distingish simple exclusive `Mutex` usage (`Lock()`,
   // etc.) from reader/writer lock usage.
   void WriterLock() EXCLUSIVE_LOCK_FUNCTION() { this->Lock(); }
 
@@ -289,7 +311,7 @@ class LOCKABLE Mutex {
   // Mutex::ReaderLockWhen()
   // Mutex::WriterLockWhen()
   //
-  // Blocks until simultaneously both `cond` is `true` and this` Mutex` can
+  // Blocks until simultaneously both `cond` is `true` and this `Mutex` can
   // be acquired, then atomically acquires this `Mutex`. `LockWhen()` is
   // logically equivalent to `*Lock(); Await();` though they may have different
   // performance characteristics.
@@ -518,11 +540,16 @@ class SCOPED_LOCKABLE MutexLock {
   explicit MutexLock(Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu) : mu_(mu) {
     this->mu_->Lock();
   }
+
+  MutexLock(const MutexLock &) = delete;  // NOLINT(runtime/mutex)
+  MutexLock(MutexLock&&) = delete;  // NOLINT(runtime/mutex)
+  MutexLock& operator=(const MutexLock&) = delete;
+  MutexLock& operator=(MutexLock&&) = delete;
+
   ~MutexLock() UNLOCK_FUNCTION() { this->mu_->Unlock(); }
+
  private:
   Mutex *const mu_;
-  MutexLock(const MutexLock &) = delete;  // NOLINT(runtime/mutex)
-  MutexLock& operator=(const MutexLock&) = delete;
 };
 
 // ReaderMutexLock
@@ -535,32 +562,42 @@ class SCOPED_LOCKABLE ReaderMutexLock {
       :  mu_(mu) {
     mu->ReaderLock();
   }
+
+  ReaderMutexLock(const ReaderMutexLock&) = delete;
+  ReaderMutexLock(ReaderMutexLock&&) = delete;
+  ReaderMutexLock& operator=(const ReaderMutexLock&) = delete;
+  ReaderMutexLock& operator=(ReaderMutexLock&&) = delete;
+
   ~ReaderMutexLock() UNLOCK_FUNCTION() {
     this->mu_->ReaderUnlock();
   }
+
  private:
   Mutex *const mu_;
-  ReaderMutexLock(const ReaderMutexLock&) = delete;
-  ReaderMutexLock& operator=(const ReaderMutexLock&) = delete;
 };
 
 // WriterMutexLock
 //
 // The `WriterMutexLock` is a helper class, like `MutexLock`, which acquires and
-// releases a write (exclusive) lock on a `Mutex` va RAII.
+// releases a write (exclusive) lock on a `Mutex` via RAII.
 class SCOPED_LOCKABLE WriterMutexLock {
  public:
   explicit WriterMutexLock(Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu)
       : mu_(mu) {
     mu->WriterLock();
   }
+
+  WriterMutexLock(const WriterMutexLock&) = delete;
+  WriterMutexLock(WriterMutexLock&&) = delete;
+  WriterMutexLock& operator=(const WriterMutexLock&) = delete;
+  WriterMutexLock& operator=(WriterMutexLock&&) = delete;
+
   ~WriterMutexLock() UNLOCK_FUNCTION() {
     this->mu_->WriterUnlock();
   }
+
  private:
   Mutex *const mu_;
-  WriterMutexLock(const WriterMutexLock&) = delete;
-  WriterMutexLock& operator=(const WriterMutexLock&) = delete;
 };
 
 // -----------------------------------------------------------------------------
@@ -568,7 +605,7 @@ class SCOPED_LOCKABLE WriterMutexLock {
 // -----------------------------------------------------------------------------
 //
 // As noted above, `Mutex` contains a number of member functions which take a
-// `Condition` as a argument; clients can wait for conditions to become `true`
+// `Condition` as an argument; clients can wait for conditions to become `true`
 // before attempting to acquire the mutex. These sections are known as
 // "condition critical" sections. To use a `Condition`, you simply need to
 // construct it, and use within an appropriate `Mutex` member function;
@@ -598,7 +635,7 @@ class SCOPED_LOCKABLE WriterMutexLock {
 //   // assume count_ is not internal reference count
 //   int count_ GUARDED_BY(mu_);
 //
-//   mu_.LockWhen(Condition(+[](const int* count) { return *count == 0; },
+//   mu_.LockWhen(Condition(+[](int* count) { return *count == 0; },
 //         &count_));
 //
 // When multiple threads are waiting on exactly the same condition, make sure
@@ -713,7 +750,7 @@ class Condition {
 // The implementation may deliver signals to any condition variable at
 // any time, even when no call to `Signal()` or `SignalAll()` is made; as a
 // result, upon being awoken, you must check the logical condition you have
-// been waiting upon. The implementation wakes waiters in the FIFO order.
+// been waiting upon.
 //
 // Examples:
 //
@@ -742,29 +779,19 @@ class CondVar {
 
   // CondVar::Wait()
   //
-  // Atomically releases a `Mutex` and blocks on this condition variable. After
-  // blocking, the thread will unblock, reacquire the `Mutex`, and return if
-  // either:
-  //  - this condition variable is signalled with `SignalAll()`, or
-  //  - this condition variable is signalled in any manner and this thread
-  //    was the most recently blocked thread that has not yet woken.
+  // Atomically releases a `Mutex` and blocks on this condition variable.
+  // Waits until awakened by a call to `Signal()` or `SignalAll()` (or a
+  // spurious wakeup), then reacquires the `Mutex` and returns.
+  //
   // Requires and ensures that the current thread holds the `Mutex`.
   void Wait(Mutex *mu);
 
   // CondVar::WaitWithTimeout()
   //
-  // Atomically releases a `Mutex`, blocks on this condition variable, and
-  // attempts to reacquire the mutex upon being signalled, or upon reaching the
-  // timeout.
-  //
-  // After blocking, the thread will unblock, reacquire the `Mutex`, and return
-  // for any of the following:
-  //  - this condition variable is signalled with `SignalAll()`
-  //  - the timeout has expired
-  //  - this condition variable is signalled in any manner and this thread
-  //    was the most recently blocked thread that has not yet woken.
-  //
-  // Negative timeouts are equivalent to a zero timeout.
+  // Atomically releases a `Mutex` and blocks on this condition variable.
+  // Waits until awakened by a call to `Signal()` or `SignalAll()` (or a
+  // spurious wakeup), or until the timeout has expired, then reacquires
+  // the `Mutex` and returns.
   //
   // Returns true if the timeout has expired without this `CondVar`
   // being signalled in any manner. If both the timeout has expired
@@ -776,15 +803,10 @@ class CondVar {
 
   // CondVar::WaitWithDeadline()
   //
-  // Atomically releases a `Mutex`, blocks on this condition variable, and
-  // attempts to reacquire the mutex within the provided deadline.
-  //
-  // After blocking, the thread will unblock, reacquire the `Mutex`, and return
-  // for any of the following:
-  //  - this condition variable is signalled with `SignalAll()`
-  //  - the deadline has passed
-  //  - this condition variable is signalled in any manner and this thread
-  //    was the most recently blocked thread that has not yet woken.
+  // Atomically releases a `Mutex` and blocks on this condition variable.
+  // Waits until awakened by a call to `Signal()` or `SignalAll()` (or a
+  // spurious wakeup), or until the deadline has passed, then reacquires
+  // the `Mutex` and returns.
   //
   // Deadlines in the past are equivalent to an immediate deadline.
   //
@@ -848,10 +870,12 @@ class SCOPED_LOCKABLE MutexLockMaybe {
  private:
   Mutex *const mu_;
   MutexLockMaybe(const MutexLockMaybe&) = delete;
+  MutexLockMaybe(MutexLockMaybe&&) = delete;
   MutexLockMaybe& operator=(const MutexLockMaybe&) = delete;
+  MutexLockMaybe& operator=(MutexLockMaybe&&) = delete;
 };
 
-// ReleaseableMutexLock
+// ReleasableMutexLock
 //
 // ReleasableMutexLock is like MutexLock, but permits `Release()` of its
 // mutex before destruction. `Release()` may be called at most once.
@@ -870,11 +894,21 @@ class SCOPED_LOCKABLE ReleasableMutexLock {
  private:
   Mutex *mu_;
   ReleasableMutexLock(const ReleasableMutexLock&) = delete;
+  ReleasableMutexLock(ReleasableMutexLock&&) = delete;
   ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete;
+  ReleasableMutexLock& operator=(ReleasableMutexLock&&) = delete;
 };
 
 #ifdef ABSL_INTERNAL_USE_NONPROD_MUTEX
+inline constexpr Mutex::Mutex(absl::ConstInitType) : impl_(absl::kConstInit) {}
+
 #else
+inline Mutex::Mutex() : mu_(0) {
+  ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
+}
+
+inline constexpr Mutex::Mutex(absl::ConstInitType) : mu_(0) {}
+
 inline CondVar::CondVar() : cv_(0) {}
 #endif
 
@@ -953,7 +987,7 @@ void RegisterMutexTracer(void (*fn)(const char *msg, const void *obj,
 //
 // The function pointer registered here will be called here on various CondVar
 // events.  The callback is given an opaque handle to the CondVar object and
-// a std::string identifying the event.  This is thread-safe, but only a single
+// a string identifying the event.  This is thread-safe, but only a single
 // tracer can be registered.
 //
 // Events that can be sent are "Wait", "Unwait", "Signal wakeup", and
@@ -970,6 +1004,12 @@ void RegisterCondVarTracer(void (*fn)(const char *msg, const void *cv));
 // to 'out.'
 //
 // This has the same memory ordering concerns as RegisterMutexProfiler() above.
+//
+// DEPRECATED: The default symbolizer function is absl::Symbolize() and the
+// ability to register a different hook for symbolizing stack traces will be
+// removed on or after 2023-05-01.
+ABSL_DEPRECATED("absl::RegisterSymbolizer() is deprecated and will be removed "
+                "on or after 2023-05-01")
 void RegisterSymbolizer(bool (*fn)(const void *pc, char *out, int out_size));
 
 // EnableMutexInvariantDebugging()
@@ -1010,4 +1050,5 @@ void SetMutexDeadlockDetectionMode(OnDeadlockCycle mode);
 extern "C" {
 void AbslInternalMutexYield();
 }  // extern "C"
+
 #endif  // ABSL_SYNCHRONIZATION_MUTEX_H_
index 107932f..82d111a 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -52,6 +52,7 @@
 
 #include <atomic>
 
+#include "absl/base/macros.h"
 #include "absl/synchronization/mutex.h"
 #include "absl/time/time.h"
 
@@ -109,4 +110,5 @@ class Notification {
 };
 
 }  // namespace absl
+
 #endif  // ABSL_SYNCHRONIZATION_NOTIFICATION_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/civil_time.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/civil_time.h
new file mode 100644 (file)
index 0000000..beaf7d8
--- /dev/null
@@ -0,0 +1,485 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// File: civil_time.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines abstractions for computing with "civil time".
+// The term "civil time" refers to the legally recognized human-scale time
+// that is represented by the six fields `YYYY-MM-DD hh:mm:ss`. A "date"
+// is perhaps the most common example of a civil time (represented here as
+// an `absl::CivilDay`).
+//
+// Modern-day civil time follows the Gregorian Calendar and is a
+// time-zone-independent concept: a civil time of "2015-06-01 12:00:00", for
+// example, is not tied to a time zone. Put another way, a civil time does not
+// map to a unique point in time; a civil time must be mapped to an absolute
+// time *through* a time zone.
+//
+// Because a civil time is what most people think of as "time," it is common to
+// map absolute times to civil times to present to users.
+//
+// Time zones define the relationship between absolute and civil times. Given an
+// absolute or civil time and a time zone, you can compute the other time:
+//
+//   Civil Time = F(Absolute Time, Time Zone)
+//   Absolute Time = G(Civil Time, Time Zone)
+//
+// The Abseil time library allows you to construct such civil times from
+// absolute times; consult time.h for such functionality.
+//
+// This library provides six classes for constructing civil-time objects, and
+// provides several helper functions for rounding, iterating, and performing
+// arithmetic on civil-time objects, while avoiding complications like
+// daylight-saving time (DST):
+//
+//   * `absl::CivilSecond`
+//   * `absl::CivilMinute`
+//   * `absl::CivilHour`
+//   * `absl::CivilDay`
+//   * `absl::CivilMonth`
+//   * `absl::CivilYear`
+//
+// Example:
+//
+//   // Construct a civil-time object for a specific day
+//   const absl::CivilDay cd(1969, 07, 20);
+//
+//   // Construct a civil-time object for a specific second
+//   const absl::CivilSecond cd(2018, 8, 1, 12, 0, 1);
+//
+// Note: In C++14 and later, this library is usable in a constexpr context.
+//
+// Example:
+//
+//   // Valid in C++14
+//   constexpr absl::CivilDay cd(1969, 07, 20);
+
+#ifndef ABSL_TIME_CIVIL_TIME_H_
+#define ABSL_TIME_CIVIL_TIME_H_
+
+#include <string>
+
+#include "absl/strings/string_view.h"
+#include "absl/time/internal/cctz/include/cctz/civil_time.h"
+
+namespace absl {
+
+namespace time_internal {
+struct second_tag : cctz::detail::second_tag {};
+struct minute_tag : second_tag, cctz::detail::minute_tag {};
+struct hour_tag : minute_tag, cctz::detail::hour_tag {};
+struct day_tag : hour_tag, cctz::detail::day_tag {};
+struct month_tag : day_tag, cctz::detail::month_tag {};
+struct year_tag : month_tag, cctz::detail::year_tag {};
+}  // namespace time_internal
+
+// -----------------------------------------------------------------------------
+// CivilSecond, CivilMinute, CivilHour, CivilDay, CivilMonth, CivilYear
+// -----------------------------------------------------------------------------
+//
+// Each of these civil-time types is a simple value type with the same
+// interface for construction and the same six accessors for each of the civil
+// time fields (year, month, day, hour, minute, and second, aka YMDHMS). These
+// classes differ only in their alignment, which is indicated by the type name
+// and specifies the field on which arithmetic operates.
+//
+// CONSTRUCTION
+//
+// Each of the civil-time types can be constructed in two ways: by directly
+// passing to the constructor up to six integers representing the YMDHMS fields,
+// or by copying the YMDHMS fields from a differently aligned civil-time type.
+// Omitted fields are assigned their minimum valid value. Hours, minutes, and
+// seconds will be set to 0, month and day will be set to 1. Since there is no
+// minimum year, the default is 1970.
+//
+// Examples:
+//
+//   absl::CivilDay default_value;               // 1970-01-01 00:00:00
+//
+//   absl::CivilDay a(2015, 2, 3);               // 2015-02-03 00:00:00
+//   absl::CivilDay b(2015, 2, 3, 4, 5, 6);      // 2015-02-03 00:00:00
+//   absl::CivilDay c(2015);                     // 2015-01-01 00:00:00
+//
+//   absl::CivilSecond ss(2015, 2, 3, 4, 5, 6);  // 2015-02-03 04:05:06
+//   absl::CivilMinute mm(ss);                   // 2015-02-03 04:05:00
+//   absl::CivilHour hh(mm);                     // 2015-02-03 04:00:00
+//   absl::CivilDay d(hh);                       // 2015-02-03 00:00:00
+//   absl::CivilMonth m(d);                      // 2015-02-01 00:00:00
+//   absl::CivilYear y(m);                       // 2015-01-01 00:00:00
+//
+//   m = absl::CivilMonth(y);                    // 2015-01-01 00:00:00
+//   d = absl::CivilDay(m);                      // 2015-01-01 00:00:00
+//   hh = absl::CivilHour(d);                    // 2015-01-01 00:00:00
+//   mm = absl::CivilMinute(hh);                 // 2015-01-01 00:00:00
+//   ss = absl::CivilSecond(mm);                 // 2015-01-01 00:00:00
+//
+// Each civil-time class is aligned to the civil-time field indicated in the
+// class's name after normalization. Alignment is performed by setting all the
+// inferior fields to their minimum valid value (as described above). The
+// following are examples of how each of the six types would align the fields
+// representing November 22, 2015 at 12:34:56 in the afternoon. (Note: the
+// string format used here is not important; it's just a shorthand way of
+// showing the six YMDHMS fields.)
+//
+//   absl::CivilSecond   : 2015-11-22 12:34:56
+//   absl::CivilMinute   : 2015-11-22 12:34:00
+//   absl::CivilHour     : 2015-11-22 12:00:00
+//   absl::CivilDay      : 2015-11-22 00:00:00
+//   absl::CivilMonth    : 2015-11-01 00:00:00
+//   absl::CivilYear     : 2015-01-01 00:00:00
+//
+// Each civil-time type performs arithmetic on the field to which it is
+// aligned. This means that adding 1 to an absl::CivilDay increments the day
+// field (normalizing as necessary), and subtracting 7 from an absl::CivilMonth
+// operates on the month field (normalizing as necessary). All arithmetic
+// produces a valid civil time. Difference requires two similarly aligned
+// civil-time objects and returns the scalar answer in units of the objects'
+// alignment. For example, the difference between two absl::CivilHour objects
+// will give an answer in units of civil hours.
+//
+// ALIGNMENT CONVERSION
+//
+// The alignment of a civil-time object cannot change, but the object may be
+// used to construct a new object with a different alignment. This is referred
+// to as "realigning". When realigning to a type with the same or more
+// precision (e.g., absl::CivilDay -> absl::CivilSecond), the conversion may be
+// performed implicitly since no information is lost. However, if information
+// could be discarded (e.g., CivilSecond -> CivilDay), the conversion must
+// be explicit at the call site.
+//
+// Examples:
+//
+//   void UseDay(absl::CivilDay day);
+//
+//   absl::CivilSecond cs;
+//   UseDay(cs);                  // Won't compile because data may be discarded
+//   UseDay(absl::CivilDay(cs));  // OK: explicit conversion
+//
+//   absl::CivilDay cd;
+//   UseDay(cd);                  // OK: no conversion needed
+//
+//   absl::CivilMonth cm;
+//   UseDay(cm);                  // OK: implicit conversion to absl::CivilDay
+//
+// NORMALIZATION
+//
+// Normalization takes invalid values and adjusts them to produce valid values.
+// Within the civil-time library, integer arguments passed to the Civil*
+// constructors may be out-of-range, in which case they are normalized by
+// carrying overflow into a field of courser granularity to produce valid
+// civil-time objects. This normalization enables natural arithmetic on
+// constructor arguments without worrying about the field's range.
+//
+// Examples:
+//
+//   // Out-of-range; normalized to 2016-11-01
+//   absl::CivilDay d(2016, 10, 32);
+//   // Out-of-range, negative: normalized to 2016-10-30T23
+//   absl::CivilHour h1(2016, 10, 31, -1);
+//   // Normalization is cumulative: normalized to 2016-10-30T23
+//   absl::CivilHour h2(2016, 10, 32, -25);
+//
+// Note: If normalization is undesired, you can signal an error by comparing
+// the constructor arguments to the normalized values returned by the YMDHMS
+// properties.
+//
+// COMPARISON
+//
+// Comparison between civil-time objects considers all six YMDHMS fields,
+// regardless of the type's alignment. Comparison between differently aligned
+// civil-time types is allowed.
+//
+// Examples:
+//
+//   absl::CivilDay feb_3(2015, 2, 3);  // 2015-02-03 00:00:00
+//   absl::CivilDay mar_4(2015, 3, 4);  // 2015-03-04 00:00:00
+//   // feb_3 < mar_4
+//   // absl::CivilYear(feb_3) == absl::CivilYear(mar_4)
+//
+//   absl::CivilSecond feb_3_noon(2015, 2, 3, 12, 0, 0);  // 2015-02-03 12:00:00
+//   // feb_3 < feb_3_noon
+//   // feb_3 == absl::CivilDay(feb_3_noon)
+//
+//   // Iterates all the days of February 2015.
+//   for (absl::CivilDay d(2015, 2, 1); d < absl::CivilMonth(2015, 3); ++d) {
+//     // ...
+//   }
+//
+// ARITHMETIC
+//
+// Civil-time types support natural arithmetic operators such as addition,
+// subtraction, and difference. Arithmetic operates on the civil-time field
+// indicated in the type's name. Difference operators require arguments with
+// the same alignment and return the answer in units of the alignment.
+//
+// Example:
+//
+//   absl::CivilDay a(2015, 2, 3);
+//   ++a;                              // 2015-02-04 00:00:00
+//   --a;                              // 2015-02-03 00:00:00
+//   absl::CivilDay b = a + 1;         // 2015-02-04 00:00:00
+//   absl::CivilDay c = 1 + b;         // 2015-02-05 00:00:00
+//   int n = c - a;                    // n = 2 (civil days)
+//   int m = c - absl::CivilMonth(c);  // Won't compile: different types.
+//
+// ACCESSORS
+//
+// Each civil-time type has accessors for all six of the civil-time fields:
+// year, month, day, hour, minute, and second.
+//
+// civil_year_t year()
+// int          month()
+// int          day()
+// int          hour()
+// int          minute()
+// int          second()
+//
+// Recall that fields inferior to the type's aligment will be set to their
+// minimum valid value.
+//
+// Example:
+//
+//   absl::CivilDay d(2015, 6, 28);
+//   // d.year() == 2015
+//   // d.month() == 6
+//   // d.day() == 28
+//   // d.hour() == 0
+//   // d.minute() == 0
+//   // d.second() == 0
+//
+// CASE STUDY: Adding a month to January 31.
+//
+// One of the classic questions that arises when considering a civil time
+// library (or a date library or a date/time library) is this:
+//   "What is the result of adding a month to January 31?"
+// This is an interesting question because it is unclear what is meant by a
+// "month", and several different answers are possible, depending on context:
+//
+//   1. March 3 (or 2 if a leap year), if "add a month" means to add a month to
+//      the current month, and adjust the date to overflow the extra days into
+//      March. In this case the result of "February 31" would be normalized as
+//      within the civil-time library.
+//   2. February 28 (or 29 if a leap year), if "add a month" means to add a
+//      month, and adjust the date while holding the resulting month constant.
+//      In this case, the result of "February 31" would be truncated to the last
+//      day in February.
+//   3. An error. The caller may get some error, an exception, an invalid date
+//      object, or perhaps return `false`. This may make sense because there is
+//      no single unambiguously correct answer to the question.
+//
+// Practically speaking, any answer that is not what the programmer intended
+// is the wrong answer.
+//
+// The Abseil time library avoids this problem by making it impossible to
+// ask ambiguous questions. All civil-time objects are aligned to a particular
+// civil-field boundary (such as aligned to a year, month, day, hour, minute,
+// or second), and arithmetic operates on the field to which the object is
+// aligned. This means that in order to "add a month" the object must first be
+// aligned to a month boundary, which is equivalent to the first day of that
+// month.
+//
+// Of course, there are ways to compute an answer the question at hand using
+// this Abseil time library, but they require the programmer to be explicit
+// about the answer they expect. To illustrate, let's see how to compute all
+// three of the above possible answers to the question of "Jan 31 plus 1
+// month":
+//
+// Example:
+//
+//   const absl::CivilDay d(2015, 1, 31);
+//
+//   // Answer 1:
+//   // Add 1 to the month field in the constructor, and rely on normalization.
+//   const auto normalized = absl::CivilDay(d.year(), d.month() + 1, d.day());
+//   // normalized == 2015-03-03 (aka Feb 31)
+//
+//   // Answer 2:
+//   // Add 1 to month field, capping to the end of next month.
+//   const auto next_month = absl::CivilMonth(d) + 1;
+//   const auto last_day_of_next_month = absl::CivilDay(next_month + 1) - 1;
+//   const auto capped = std::min(normalized, last_day_of_next_month);
+//   // capped == 2015-02-28
+//
+//   // Answer 3:
+//   // Signal an error if the normalized answer is not in next month.
+//   if (absl::CivilMonth(normalized) != next_month) {
+//     // error, month overflow
+//   }
+//
+using CivilSecond =
+    time_internal::cctz::detail::civil_time<time_internal::second_tag>;
+using CivilMinute =
+    time_internal::cctz::detail::civil_time<time_internal::minute_tag>;
+using CivilHour =
+    time_internal::cctz::detail::civil_time<time_internal::hour_tag>;
+using CivilDay =
+    time_internal::cctz::detail::civil_time<time_internal::day_tag>;
+using CivilMonth =
+    time_internal::cctz::detail::civil_time<time_internal::month_tag>;
+using CivilYear =
+    time_internal::cctz::detail::civil_time<time_internal::year_tag>;
+
+// civil_year_t
+//
+// Type alias of a civil-time year value. This type is guaranteed to (at least)
+// support any year value supported by `time_t`.
+//
+// Example:
+//
+//   absl::CivilSecond cs = ...;
+//   absl::civil_year_t y = cs.year();
+//   cs = absl::CivilSecond(y, 1, 1, 0, 0, 0);  // CivilSecond(CivilYear(cs))
+//
+using civil_year_t = time_internal::cctz::year_t;
+
+// civil_diff_t
+//
+// Type alias of the difference between two civil-time values.
+// This type is used to indicate arguments that are not
+// normalized (such as parameters to the civil-time constructors), the results
+// of civil-time subtraction, or the operand to civil-time addition.
+//
+// Example:
+//
+//   absl::civil_diff_t n_sec = cs1 - cs2;             // cs1 == cs2 + n_sec;
+//
+using civil_diff_t = time_internal::cctz::diff_t;
+
+// Weekday::monday, Weekday::tuesday, Weekday::wednesday, Weekday::thursday,
+// Weekday::friday, Weekday::saturday, Weekday::sunday
+//
+// The Weekday enum class represents the civil-time concept of a "weekday" with
+// members for all days of the week.
+//
+//   absl::Weekday wd = absl::Weekday::thursday;
+//
+using Weekday = time_internal::cctz::weekday;
+
+// GetWeekday()
+//
+// Returns the absl::Weekday for the given (realigned) civil-time value.
+//
+// Example:
+//
+//   absl::CivilDay a(2015, 8, 13);
+//   absl::Weekday wd = absl::GetWeekday(a);  // wd == absl::Weekday::thursday
+//
+inline Weekday GetWeekday(CivilSecond cs) {
+  return time_internal::cctz::get_weekday(cs);
+}
+
+// NextWeekday()
+// PrevWeekday()
+//
+// Returns the absl::CivilDay that strictly follows or precedes a given
+// absl::CivilDay, and that falls on the given absl::Weekday.
+//
+// Example, given the following month:
+//
+//       August 2015
+//   Su Mo Tu We Th Fr Sa
+//                      1
+//    2  3  4  5  6  7  8
+//    9 10 11 12 13 14 15
+//   16 17 18 19 20 21 22
+//   23 24 25 26 27 28 29
+//   30 31
+//
+//   absl::CivilDay a(2015, 8, 13);
+//   // absl::GetWeekday(a) == absl::Weekday::thursday
+//   absl::CivilDay b = absl::NextWeekday(a, absl::Weekday::thursday);
+//   // b = 2015-08-20
+//   absl::CivilDay c = absl::PrevWeekday(a, absl::Weekday::thursday);
+//   // c = 2015-08-06
+//
+//   absl::CivilDay d = ...
+//   // Gets the following Thursday if d is not already Thursday
+//   absl::CivilDay thurs1 = absl::NextWeekday(d - 1, absl::Weekday::thursday);
+//   // Gets the previous Thursday if d is not already Thursday
+//   absl::CivilDay thurs2 = absl::PrevWeekday(d + 1, absl::Weekday::thursday);
+//
+inline CivilDay NextWeekday(CivilDay cd, Weekday wd) {
+  return CivilDay(time_internal::cctz::next_weekday(cd, wd));
+}
+inline CivilDay PrevWeekday(CivilDay cd, Weekday wd) {
+  return CivilDay(time_internal::cctz::prev_weekday(cd, wd));
+}
+
+// GetYearDay()
+//
+// Returns the day-of-year for the given (realigned) civil-time value.
+//
+// Example:
+//
+//   absl::CivilDay a(2015, 1, 1);
+//   int yd_jan_1 = absl::GetYearDay(a);   // yd_jan_1 = 1
+//   absl::CivilDay b(2015, 12, 31);
+//   int yd_dec_31 = absl::GetYearDay(b);  // yd_dec_31 = 365
+//
+inline int GetYearDay(CivilSecond cs) {
+  return time_internal::cctz::get_yearday(cs);
+}
+
+// FormatCivilTime()
+//
+// Formats the given civil-time value into a string value of the following
+// format:
+//
+//  Type        | Format
+//  ---------------------------------
+//  CivilSecond | YYYY-MM-DDTHH:MM:SS
+//  CivilMinute | YYYY-MM-DDTHH:MM
+//  CivilHour   | YYYY-MM-DDTHH
+//  CivilDay    | YYYY-MM-DD
+//  CivilMonth  | YYYY-MM
+//  CivilYear   | YYYY
+//
+// Example:
+//
+//   absl::CivilDay d = absl::CivilDay(1969, 7, 20);
+//   std::string day_string = absl::FormatCivilTime(d);  // "1969-07-20"
+//
+std::string FormatCivilTime(CivilSecond c);
+std::string FormatCivilTime(CivilMinute c);
+std::string FormatCivilTime(CivilHour c);
+std::string FormatCivilTime(CivilDay c);
+std::string FormatCivilTime(CivilMonth c);
+std::string FormatCivilTime(CivilYear c);
+
+namespace time_internal {  // For functions found via ADL on civil-time tags.
+
+// Streaming Operators
+//
+// Each civil-time type may be sent to an output stream using operator<<().
+// The result matches the string produced by `FormatCivilTime()`.
+//
+// Example:
+//
+//   absl::CivilDay d = absl::CivilDay("1969-07-20");
+//   std::cout << "Date is: " << d << "\n";
+//
+std::ostream& operator<<(std::ostream& os, CivilYear y);
+std::ostream& operator<<(std::ostream& os, CivilMonth m);
+std::ostream& operator<<(std::ostream& os, CivilDay d);
+std::ostream& operator<<(std::ostream& os, CivilHour h);
+std::ostream& operator<<(std::ostream& os, CivilMinute m);
+std::ostream& operator<<(std::ostream& os, CivilSecond s);
+
+}  // namespace time_internal
+
+}  // namespace absl
+
+#endif  // ABSL_TIME_CIVIL_TIME_H_
index 3753d4e..bb52e4f 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h
new file mode 100644 (file)
index 0000000..85d0d3f
--- /dev/null
@@ -0,0 +1,329 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_CIVIL_TIME_H_
+#define ABSL_TIME_INTERNAL_CCTZ_CIVIL_TIME_H_
+
+#include "absl/time/internal/cctz/include/cctz/civil_time_detail.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// The term "civil time" refers to the legally recognized human-scale time
+// that is represented by the six fields YYYY-MM-DD hh:mm:ss. Modern-day civil
+// time follows the Gregorian Calendar and is a time-zone-independent concept.
+// A "date" is perhaps the most common example of a civil time (represented in
+// this library as cctz::civil_day). This library provides six classes and a
+// handful of functions that help with rounding, iterating, and arithmetic on
+// civil times while avoiding complications like daylight-saving time (DST).
+//
+// The following six classes form the core of this civil-time library:
+//
+//   * civil_second
+//   * civil_minute
+//   * civil_hour
+//   * civil_day
+//   * civil_month
+//   * civil_year
+//
+// Each class is a simple value type with the same interface for construction
+// and the same six accessors for each of the civil fields (year, month, day,
+// hour, minute, and second, aka YMDHMS). These classes differ only in their
+// alignment, which is indicated by the type name and specifies the field on
+// which arithmetic operates.
+//
+// Each class can be constructed by passing up to six optional integer
+// arguments representing the YMDHMS fields (in that order) to the
+// constructor. Omitted fields are assigned their minimum valid value. Hours,
+// minutes, and seconds will be set to 0, month and day will be set to 1, and
+// since there is no minimum valid year, it will be set to 1970. So, a
+// default-constructed civil-time object will have YMDHMS fields representing
+// "1970-01-01 00:00:00". Fields that are out-of-range are normalized (e.g.,
+// October 32 -> November 1) so that all civil-time objects represent valid
+// values.
+//
+// Each civil-time class is aligned to the civil-time field indicated in the
+// class's name after normalization. Alignment is performed by setting all the
+// inferior fields to their minimum valid value (as described above). The
+// following are examples of how each of the six types would align the fields
+// representing November 22, 2015 at 12:34:56 in the afternoon. (Note: the
+// string format used here is not important; it's just a shorthand way of
+// showing the six YMDHMS fields.)
+//
+//   civil_second  2015-11-22 12:34:56
+//   civil_minute  2015-11-22 12:34:00
+//   civil_hour    2015-11-22 12:00:00
+//   civil_day     2015-11-22 00:00:00
+//   civil_month   2015-11-01 00:00:00
+//   civil_year    2015-01-01 00:00:00
+//
+// Each civil-time type performs arithmetic on the field to which it is
+// aligned. This means that adding 1 to a civil_day increments the day field
+// (normalizing as necessary), and subtracting 7 from a civil_month operates
+// on the month field (normalizing as necessary). All arithmetic produces a
+// valid civil time. Difference requires two similarly aligned civil-time
+// objects and returns the scalar answer in units of the objects' alignment.
+// For example, the difference between two civil_hour objects will give an
+// answer in units of civil hours.
+//
+// In addition to the six civil-time types just described, there are
+// a handful of helper functions and algorithms for performing common
+// calculations. These are described below.
+//
+// Note: In C++14 and later, this library is usable in a constexpr context.
+//
+// CONSTRUCTION:
+//
+// Each of the civil-time types can be constructed in two ways: by directly
+// passing to the constructor up to six (optional) integers representing the
+// YMDHMS fields, or by copying the YMDHMS fields from a differently aligned
+// civil-time type.
+//
+//   civil_day default_value;  // 1970-01-01 00:00:00
+//
+//   civil_day a(2015, 2, 3);           // 2015-02-03 00:00:00
+//   civil_day b(2015, 2, 3, 4, 5, 6);  // 2015-02-03 00:00:00
+//   civil_day c(2015);                 // 2015-01-01 00:00:00
+//
+//   civil_second ss(2015, 2, 3, 4, 5, 6);  // 2015-02-03 04:05:06
+//   civil_minute mm(ss);                   // 2015-02-03 04:05:00
+//   civil_hour hh(mm);                     // 2015-02-03 04:00:00
+//   civil_day d(hh);                       // 2015-02-03 00:00:00
+//   civil_month m(d);                      // 2015-02-01 00:00:00
+//   civil_year y(m);                       // 2015-01-01 00:00:00
+//
+//   m = civil_month(y);     // 2015-01-01 00:00:00
+//   d = civil_day(m);       // 2015-01-01 00:00:00
+//   hh = civil_hour(d);     // 2015-01-01 00:00:00
+//   mm = civil_minute(hh);  // 2015-01-01 00:00:00
+//   ss = civil_second(mm);  // 2015-01-01 00:00:00
+//
+// ALIGNMENT CONVERSION:
+//
+// The alignment of a civil-time object cannot change, but the object may be
+// used to construct a new object with a different alignment. This is referred
+// to as "realigning". When realigning to a type with the same or more
+// precision (e.g., civil_day -> civil_second), the conversion may be
+// performed implicitly since no information is lost. However, if information
+// could be discarded (e.g., civil_second -> civil_day), the conversion must
+// be explicit at the call site.
+//
+//   void fun(const civil_day& day);
+//
+//   civil_second cs;
+//   fun(cs);  // Won't compile because data may be discarded
+//   fun(civil_day(cs));  // OK: explicit conversion
+//
+//   civil_day cd;
+//   fun(cd);  // OK: no conversion needed
+//
+//   civil_month cm;
+//   fun(cm);  // OK: implicit conversion to civil_day
+//
+// NORMALIZATION:
+//
+// Integer arguments passed to the constructor may be out-of-range, in which
+// case they are normalized to produce a valid civil-time object. This enables
+// natural arithmetic on constructor arguments without worrying about the
+// field's range. Normalization guarantees that there are no invalid
+// civil-time objects.
+//
+//   civil_day d(2016, 10, 32);  // Out-of-range day; normalized to 2016-11-01
+//
+// Note: If normalization is undesired, you can signal an error by comparing
+// the constructor arguments to the normalized values returned by the YMDHMS
+// properties.
+//
+// PROPERTIES:
+//
+// All civil-time types have accessors for all six of the civil-time fields:
+// year, month, day, hour, minute, and second. Recall that fields inferior to
+// the type's aligment will be set to their minimum valid value.
+//
+//   civil_day d(2015, 6, 28);
+//   // d.year() == 2015
+//   // d.month() == 6
+//   // d.day() == 28
+//   // d.hour() == 0
+//   // d.minute() == 0
+//   // d.second() == 0
+//
+// COMPARISON:
+//
+// Comparison always considers all six YMDHMS fields, regardless of the type's
+// alignment. Comparison between differently aligned civil-time types is
+// allowed.
+//
+//   civil_day feb_3(2015, 2, 3);  // 2015-02-03 00:00:00
+//   civil_day mar_4(2015, 3, 4);  // 2015-03-04 00:00:00
+//   // feb_3 < mar_4
+//   // civil_year(feb_3) == civil_year(mar_4)
+//
+//   civil_second feb_3_noon(2015, 2, 3, 12, 0, 0);  // 2015-02-03 12:00:00
+//   // feb_3 < feb_3_noon
+//   // feb_3 == civil_day(feb_3_noon)
+//
+//   // Iterates all the days of February 2015.
+//   for (civil_day d(2015, 2, 1); d < civil_month(2015, 3); ++d) {
+//     // ...
+//   }
+//
+// STREAMING:
+//
+// Each civil-time type may be sent to an output stream using operator<<().
+// The output format follows the pattern "YYYY-MM-DDThh:mm:ss" where fields
+// inferior to the type's alignment are omitted.
+//
+//   civil_second cs(2015, 2, 3, 4, 5, 6);
+//   std::cout << cs << "\n";  // Outputs: 2015-02-03T04:05:06
+//
+//   civil_day cd(cs);
+//   std::cout << cd << "\n";  // Outputs: 2015-02-03
+//
+//   civil_year cy(cs);
+//   std::cout << cy << "\n";  // Outputs: 2015
+//
+// ARITHMETIC:
+//
+// Civil-time types support natural arithmetic operators such as addition,
+// subtraction, and difference. Arithmetic operates on the civil-time field
+// indicated in the type's name. Difference requires arguments with the same
+// alignment and returns the answer in units of the alignment.
+//
+//   civil_day a(2015, 2, 3);
+//   ++a;                         // 2015-02-04 00:00:00
+//   --a;                         // 2015-02-03 00:00:00
+//   civil_day b = a + 1;         // 2015-02-04 00:00:00
+//   civil_day c = 1 + b;         // 2015-02-05 00:00:00
+//   int n = c - a;               // n = 2 (civil days)
+//   int m = c - civil_month(c);  // Won't compile: different types.
+//
+// EXAMPLE: Adding a month to January 31.
+//
+// One of the classic questions that arises when considering a civil-time
+// library (or a date library or a date/time library) is this: "What happens
+// when you add a month to January 31?" This is an interesting question
+// because there could be a number of possible answers:
+//
+//   1. March 3 (or 2 if a leap year). This may make sense if the operation
+//      wants the equivalent of February 31.
+//   2. February 28 (or 29 if a leap year). This may make sense if the operation
+//      wants the last day of January to go to the last day of February.
+//   3. Error. The caller may get some error, an exception, an invalid date
+//      object, or maybe false is returned. This may make sense because there is
+//      no single unambiguously correct answer to the question.
+//
+// Practically speaking, any answer that is not what the programmer intended
+// is the wrong answer.
+//
+// This civil-time library avoids the problem by making it impossible to ask
+// ambiguous questions. All civil-time objects are aligned to a particular
+// civil-field boundary (such as aligned to a year, month, day, hour, minute,
+// or second), and arithmetic operates on the field to which the object is
+// aligned. This means that in order to "add a month" the object must first be
+// aligned to a month boundary, which is equivalent to the first day of that
+// month.
+//
+// Of course, there are ways to compute an answer the question at hand using
+// this civil-time library, but they require the programmer to be explicit
+// about the answer they expect. To illustrate, let's see how to compute all
+// three of the above possible answers to the question of "Jan 31 plus 1
+// month":
+//
+//   const civil_day d(2015, 1, 31);
+//
+//   // Answer 1:
+//   // Add 1 to the month field in the constructor, and rely on normalization.
+//   const auto ans_normalized = civil_day(d.year(), d.month() + 1, d.day());
+//   // ans_normalized == 2015-03-03 (aka Feb 31)
+//
+//   // Answer 2:
+//   // Add 1 to month field, capping to the end of next month.
+//   const auto next_month = civil_month(d) + 1;
+//   const auto last_day_of_next_month = civil_day(next_month + 1) - 1;
+//   const auto ans_capped = std::min(ans_normalized, last_day_of_next_month);
+//   // ans_capped == 2015-02-28
+//
+//   // Answer 3:
+//   // Signal an error if the normalized answer is not in next month.
+//   if (civil_month(ans_normalized) != next_month) {
+//     // error, month overflow
+//   }
+//
+using civil_year = detail::civil_year;
+using civil_month = detail::civil_month;
+using civil_day = detail::civil_day;
+using civil_hour = detail::civil_hour;
+using civil_minute = detail::civil_minute;
+using civil_second = detail::civil_second;
+
+// An enum class with members monday, tuesday, wednesday, thursday, friday,
+// saturday, and sunday. These enum values may be sent to an output stream
+// using operator<<(). The result is the full weekday name in English with a
+// leading capital letter.
+//
+//   weekday wd = weekday::thursday;
+//   std::cout << wd << "\n";  // Outputs: Thursday
+//
+using detail::weekday;
+
+// Returns the weekday for the given civil-time value.
+//
+//   civil_day a(2015, 8, 13);
+//   weekday wd = get_weekday(a);  // wd == weekday::thursday
+//
+using detail::get_weekday;
+
+// Returns the civil_day that strictly follows or precedes the given
+// civil_day, and that falls on the given weekday.
+//
+// For example, given:
+//
+//     August 2015
+// Su Mo Tu We Th Fr Sa
+//                    1
+//  2  3  4  5  6  7  8
+//  9 10 11 12 13 14 15
+// 16 17 18 19 20 21 22
+// 23 24 25 26 27 28 29
+// 30 31
+//
+//   civil_day a(2015, 8, 13);  // get_weekday(a) == weekday::thursday
+//   civil_day b = next_weekday(a, weekday::thursday);  // b = 2015-08-20
+//   civil_day c = prev_weekday(a, weekday::thursday);  // c = 2015-08-06
+//
+//   civil_day d = ...
+//   // Gets the following Thursday if d is not already Thursday
+//   civil_day thurs1 = next_weekday(d - 1, weekday::thursday);
+//   // Gets the previous Thursday if d is not already Thursday
+//   civil_day thurs2 = prev_weekday(d + 1, weekday::thursday);
+//
+using detail::next_weekday;
+using detail::prev_weekday;
+
+// Returns the day-of-year for the given civil-time value.
+//
+//   civil_day a(2015, 1, 1);
+//   int yd_jan_1 = get_yearday(a);   // yd_jan_1 = 1
+//   civil_day b(2015, 12, 31);
+//   int yd_dec_31 = get_yearday(b);  // yd_dec_31 = 365
+//
+using detail::get_yearday;
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_CIVIL_TIME_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h
new file mode 100644 (file)
index 0000000..433078a
--- /dev/null
@@ -0,0 +1,624 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_CIVIL_TIME_DETAIL_H_
+#define ABSL_TIME_INTERNAL_CCTZ_CIVIL_TIME_DETAIL_H_
+
+#include <cstdint>
+#include <limits>
+#include <ostream>
+#include <type_traits>
+
+// Disable constexpr support unless we are in C++14 mode.
+#if __cpp_constexpr >= 201304 || (defined(_MSC_VER) && _MSC_VER >= 1910)
+#define CONSTEXPR_D constexpr  // data
+#define CONSTEXPR_F constexpr  // function
+#define CONSTEXPR_M constexpr  // member
+#else
+#define CONSTEXPR_D const
+#define CONSTEXPR_F inline
+#define CONSTEXPR_M
+#endif
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// Support years that at least span the range of 64-bit time_t values.
+using year_t = std::int_fast64_t;
+
+// Type alias that indicates an argument is not normalized (e.g., the
+// constructor parameters and operands/results of addition/subtraction).
+using diff_t = std::int_fast64_t;
+
+namespace detail {
+
+// Type aliases that indicate normalized argument values.
+using month_t = std::int_fast8_t;   // [1:12]
+using day_t = std::int_fast8_t;     // [1:31]
+using hour_t = std::int_fast8_t;    // [0:23]
+using minute_t = std::int_fast8_t;  // [0:59]
+using second_t = std::int_fast8_t;  // [0:59]
+
+// Normalized civil-time fields: Y-M-D HH:MM:SS.
+struct fields {
+  CONSTEXPR_M fields(year_t year, month_t month, day_t day,
+                     hour_t hour, minute_t minute, second_t second)
+      : y(year), m(month), d(day), hh(hour), mm(minute), ss(second) {}
+  std::int_least64_t y;
+  std::int_least8_t m;
+  std::int_least8_t d;
+  std::int_least8_t hh;
+  std::int_least8_t mm;
+  std::int_least8_t ss;
+};
+
+struct second_tag {};
+struct minute_tag : second_tag {};
+struct hour_tag : minute_tag {};
+struct day_tag : hour_tag {};
+struct month_tag : day_tag {};
+struct year_tag : month_tag {};
+
+////////////////////////////////////////////////////////////////////////
+
+// Field normalization (without avoidable overflow).
+
+namespace impl {
+
+CONSTEXPR_F bool is_leap_year(year_t y) noexcept {
+  return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
+}
+CONSTEXPR_F int year_index(year_t y, month_t m) noexcept {
+  return (static_cast<int>((y + (m > 2)) % 400) + 400) % 400;
+}
+CONSTEXPR_F int days_per_century(year_t y, month_t m) noexcept {
+  const int yi = year_index(y, m);
+  return 36524 + (yi == 0 || yi > 300);
+}
+CONSTEXPR_F int days_per_4years(year_t y, month_t m) noexcept {
+  const int yi = year_index(y, m);
+  return 1460 + (yi == 0 || yi > 300 || (yi - 1) % 100 < 96);
+}
+CONSTEXPR_F int days_per_year(year_t y, month_t m) noexcept {
+  return is_leap_year(y + (m > 2)) ? 366 : 365;
+}
+CONSTEXPR_F int days_per_month(year_t y, month_t m) noexcept {
+  CONSTEXPR_D int k_days_per_month[1 + 12] = {
+      -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31  // non leap year
+  };
+  return k_days_per_month[m] + (m == 2 && is_leap_year(y));
+}
+
+CONSTEXPR_F fields n_day(year_t y, month_t m, diff_t d, diff_t cd,
+                         hour_t hh, minute_t mm, second_t ss) noexcept {
+  y += (cd / 146097) * 400;
+  cd %= 146097;
+  if (cd < 0) {
+    y -= 400;
+    cd += 146097;
+  }
+  y += (d / 146097) * 400;
+  d = d % 146097 + cd;
+  if (d > 0) {
+    if (d > 146097) {
+      y += 400;
+      d -= 146097;
+    }
+  } else {
+    if (d > -365) {
+      // We often hit the previous year when stepping a civil time backwards,
+      // so special case it to avoid counting up by 100/4/1-year chunks.
+      y -= 1;
+      d += days_per_year(y, m);
+    } else {
+      y -= 400;
+      d += 146097;
+    }
+  }
+  if (d > 365) {
+    for (int n = days_per_century(y, m); d > n; n = days_per_century(y, m)) {
+      d -= n;
+      y += 100;
+    }
+    for (int n = days_per_4years(y, m); d > n; n = days_per_4years(y, m)) {
+      d -= n;
+      y += 4;
+    }
+    for (int n = days_per_year(y, m); d > n; n = days_per_year(y, m)) {
+      d -= n;
+      ++y;
+    }
+  }
+  if (d > 28) {
+    for (int n = days_per_month(y, m); d > n; n = days_per_month(y, m)) {
+      d -= n;
+      if (++m > 12) {
+        ++y;
+        m = 1;
+      }
+    }
+  }
+  return fields(y, m, static_cast<day_t>(d), hh, mm, ss);
+}
+CONSTEXPR_F fields n_mon(year_t y, diff_t m, diff_t d, diff_t cd,
+                         hour_t hh, minute_t mm, second_t ss) noexcept {
+  if (m != 12) {
+    y += m / 12;
+    m %= 12;
+    if (m <= 0) {
+      y -= 1;
+      m += 12;
+    }
+  }
+  return n_day(y, static_cast<month_t>(m), d, cd, hh, mm, ss);
+}
+CONSTEXPR_F fields n_hour(year_t y, diff_t m, diff_t d, diff_t cd,
+                          diff_t hh, minute_t mm, second_t ss) noexcept {
+  cd += hh / 24;
+  hh %= 24;
+  if (hh < 0) {
+    cd -= 1;
+    hh += 24;
+  }
+  return n_mon(y, m, d, cd, static_cast<hour_t>(hh), mm, ss);
+}
+CONSTEXPR_F fields n_min(year_t y, diff_t m, diff_t d, diff_t hh, diff_t ch,
+                         diff_t mm, second_t ss) noexcept {
+  ch += mm / 60;
+  mm %= 60;
+  if (mm < 0) {
+    ch -= 1;
+    mm += 60;
+  }
+  return n_hour(y, m, d, hh / 24 + ch / 24, hh % 24 + ch % 24,
+                static_cast<minute_t>(mm), ss);
+}
+CONSTEXPR_F fields n_sec(year_t y, diff_t m, diff_t d, diff_t hh, diff_t mm,
+                         diff_t ss) noexcept {
+  // Optimization for when (non-constexpr) fields are already normalized.
+  if (0 <= ss && ss < 60) {
+    const second_t nss = static_cast<second_t>(ss);
+    if (0 <= mm && mm < 60) {
+      const minute_t nmm = static_cast<minute_t>(mm);
+      if (0 <= hh && hh < 24) {
+        const hour_t nhh = static_cast<hour_t>(hh);
+        if (1 <= d && d <= 28 && 1 <= m && m <= 12) {
+          const day_t nd = static_cast<day_t>(d);
+          const month_t nm = static_cast<month_t>(m);
+          return fields(y, nm, nd, nhh, nmm, nss);
+        }
+        return n_mon(y, m, d, 0, nhh, nmm, nss);
+      }
+      return n_hour(y, m, d, hh / 24, hh % 24, nmm, nss);
+    }
+    return n_min(y, m, d, hh, mm / 60, mm % 60, nss);
+  }
+  diff_t cm = ss / 60;
+  ss %= 60;
+  if (ss < 0) {
+    cm -= 1;
+    ss += 60;
+  }
+  return n_min(y, m, d, hh, mm / 60 + cm / 60, mm % 60 + cm % 60,
+               static_cast<second_t>(ss));
+}
+
+}  // namespace impl
+
+////////////////////////////////////////////////////////////////////////
+
+// Increments the indicated (normalized) field by "n".
+CONSTEXPR_F fields step(second_tag, fields f, diff_t n) noexcept {
+  return impl::n_sec(f.y, f.m, f.d, f.hh, f.mm + n / 60, f.ss + n % 60);
+}
+CONSTEXPR_F fields step(minute_tag, fields f, diff_t n) noexcept {
+  return impl::n_min(f.y, f.m, f.d, f.hh + n / 60, 0, f.mm + n % 60, f.ss);
+}
+CONSTEXPR_F fields step(hour_tag, fields f, diff_t n) noexcept {
+  return impl::n_hour(f.y, f.m, f.d + n / 24, 0, f.hh + n % 24, f.mm, f.ss);
+}
+CONSTEXPR_F fields step(day_tag, fields f, diff_t n) noexcept {
+  return impl::n_day(f.y, f.m, f.d, n, f.hh, f.mm, f.ss);
+}
+CONSTEXPR_F fields step(month_tag, fields f, diff_t n) noexcept {
+  return impl::n_mon(f.y + n / 12, f.m + n % 12, f.d, 0, f.hh, f.mm, f.ss);
+}
+CONSTEXPR_F fields step(year_tag, fields f, diff_t n) noexcept {
+  return fields(f.y + n, f.m, f.d, f.hh, f.mm, f.ss);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+namespace impl {
+
+// Returns (v * f + a) but avoiding intermediate overflow when possible.
+CONSTEXPR_F diff_t scale_add(diff_t v, diff_t f, diff_t a) noexcept {
+  return (v < 0) ? ((v + 1) * f + a) - f : ((v - 1) * f + a) + f;
+}
+
+// Map a (normalized) Y/M/D to the number of days before/after 1970-01-01.
+// Probably overflows for years outside [-292277022656:292277026595].
+CONSTEXPR_F diff_t ymd_ord(year_t y, month_t m, day_t d) noexcept {
+  const diff_t eyear = (m <= 2) ? y - 1 : y;
+  const diff_t era = (eyear >= 0 ? eyear : eyear - 399) / 400;
+  const diff_t yoe = eyear - era * 400;
+  const diff_t doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + d - 1;
+  const diff_t doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
+  return era * 146097 + doe - 719468;
+}
+
+// Returns the difference in days between two normalized Y-M-D tuples.
+// ymd_ord() will encounter integer overflow given extreme year values,
+// yet the difference between two such extreme values may actually be
+// small, so we take a little care to avoid overflow when possible by
+// exploiting the 146097-day cycle.
+CONSTEXPR_F diff_t day_difference(year_t y1, month_t m1, day_t d1,
+                                  year_t y2, month_t m2, day_t d2) noexcept {
+  const diff_t a_c4_off = y1 % 400;
+  const diff_t b_c4_off = y2 % 400;
+  diff_t c4_diff = (y1 - a_c4_off) - (y2 - b_c4_off);
+  diff_t delta = ymd_ord(a_c4_off, m1, d1) - ymd_ord(b_c4_off, m2, d2);
+  if (c4_diff > 0 && delta < 0) {
+    delta += 2 * 146097;
+    c4_diff -= 2 * 400;
+  } else if (c4_diff < 0 && delta > 0) {
+    delta -= 2 * 146097;
+    c4_diff += 2 * 400;
+  }
+  return (c4_diff / 400 * 146097) + delta;
+}
+
+}  // namespace impl
+
+// Returns the difference between fields structs using the indicated unit.
+CONSTEXPR_F diff_t difference(year_tag, fields f1, fields f2) noexcept {
+  return f1.y - f2.y;
+}
+CONSTEXPR_F diff_t difference(month_tag, fields f1, fields f2) noexcept {
+  return impl::scale_add(difference(year_tag{}, f1, f2), 12, (f1.m - f2.m));
+}
+CONSTEXPR_F diff_t difference(day_tag, fields f1, fields f2) noexcept {
+  return impl::day_difference(f1.y, f1.m, f1.d, f2.y, f2.m, f2.d);
+}
+CONSTEXPR_F diff_t difference(hour_tag, fields f1, fields f2) noexcept {
+  return impl::scale_add(difference(day_tag{}, f1, f2), 24, (f1.hh - f2.hh));
+}
+CONSTEXPR_F diff_t difference(minute_tag, fields f1, fields f2) noexcept {
+  return impl::scale_add(difference(hour_tag{}, f1, f2), 60, (f1.mm - f2.mm));
+}
+CONSTEXPR_F diff_t difference(second_tag, fields f1, fields f2) noexcept {
+  return impl::scale_add(difference(minute_tag{}, f1, f2), 60, f1.ss - f2.ss);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+// Aligns the (normalized) fields struct to the indicated field.
+CONSTEXPR_F fields align(second_tag, fields f) noexcept {
+  return f;
+}
+CONSTEXPR_F fields align(minute_tag, fields f) noexcept {
+  return fields{f.y, f.m, f.d, f.hh, f.mm, 0};
+}
+CONSTEXPR_F fields align(hour_tag, fields f) noexcept {
+  return fields{f.y, f.m, f.d, f.hh, 0, 0};
+}
+CONSTEXPR_F fields align(day_tag, fields f) noexcept {
+  return fields{f.y, f.m, f.d, 0, 0, 0};
+}
+CONSTEXPR_F fields align(month_tag, fields f) noexcept {
+  return fields{f.y, f.m, 1, 0, 0, 0};
+}
+CONSTEXPR_F fields align(year_tag, fields f) noexcept {
+  return fields{f.y, 1, 1, 0, 0, 0};
+}
+
+////////////////////////////////////////////////////////////////////////
+
+namespace impl {
+
+template <typename H>
+H AbslHashValueImpl(second_tag, H h, fields f) {
+  return H::combine(std::move(h), f.y, f.m, f.d, f.hh, f.mm, f.ss);
+}
+template <typename H>
+H AbslHashValueImpl(minute_tag, H h, fields f) {
+  return H::combine(std::move(h), f.y, f.m, f.d, f.hh, f.mm);
+}
+template <typename H>
+H AbslHashValueImpl(hour_tag, H h, fields f) {
+  return H::combine(std::move(h), f.y, f.m, f.d, f.hh);
+}
+template <typename H>
+H AbslHashValueImpl(day_tag, H h, fields f) {
+  return H::combine(std::move(h), f.y, f.m, f.d);
+}
+template <typename H>
+H AbslHashValueImpl(month_tag, H h, fields f) {
+  return H::combine(std::move(h), f.y, f.m);
+}
+template <typename H>
+H AbslHashValueImpl(year_tag, H h, fields f) {
+  return H::combine(std::move(h), f.y);
+}
+
+}  // namespace impl
+
+////////////////////////////////////////////////////////////////////////
+
+template <typename T>
+class civil_time {
+ public:
+  explicit CONSTEXPR_M civil_time(year_t y, diff_t m = 1, diff_t d = 1,
+                                  diff_t hh = 0, diff_t mm = 0,
+                                  diff_t ss = 0) noexcept
+      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
+
+  CONSTEXPR_M civil_time() noexcept : f_{1970, 1, 1, 0, 0, 0} {}
+  civil_time(const civil_time&) = default;
+  civil_time& operator=(const civil_time&) = default;
+
+  // Conversion between civil times of different alignment. Conversion to
+  // a more precise alignment is allowed implicitly (e.g., day -> hour),
+  // but conversion where information is discarded must be explicit
+  // (e.g., second -> minute).
+  template <typename U, typename S>
+  using preserves_data =
+      typename std::enable_if<std::is_base_of<U, S>::value>::type;
+  template <typename U>
+  CONSTEXPR_M civil_time(const civil_time<U>& ct,
+                         preserves_data<T, U>* = nullptr) noexcept
+      : civil_time(ct.f_) {}
+  template <typename U>
+  explicit CONSTEXPR_M civil_time(const civil_time<U>& ct,
+                                  preserves_data<U, T>* = nullptr) noexcept
+      : civil_time(ct.f_) {}
+
+  // Factories for the maximum/minimum representable civil_time.
+  static CONSTEXPR_F civil_time (max)() {
+    const auto max_year = (std::numeric_limits<std::int_least64_t>::max)();
+    return civil_time(max_year, 12, 31, 23, 59, 59);
+  }
+  static CONSTEXPR_F civil_time (min)() {
+    const auto min_year = (std::numeric_limits<std::int_least64_t>::min)();
+    return civil_time(min_year, 1, 1, 0, 0, 0);
+  }
+
+  // Field accessors.  Note: All but year() return an int.
+  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
+  CONSTEXPR_M int month() const noexcept { return f_.m; }
+  CONSTEXPR_M int day() const noexcept { return f_.d; }
+  CONSTEXPR_M int hour() const noexcept { return f_.hh; }
+  CONSTEXPR_M int minute() const noexcept { return f_.mm; }
+  CONSTEXPR_M int second() const noexcept { return f_.ss; }
+
+  // Assigning arithmetic.
+  CONSTEXPR_M civil_time& operator+=(diff_t n) noexcept {
+    f_ = step(T{}, f_, n);
+    return *this;
+  }
+  CONSTEXPR_M civil_time& operator-=(diff_t n) noexcept {
+    if (n != (std::numeric_limits<diff_t>::min)()) {
+      f_ = step(T{}, f_, -n);
+    } else {
+      f_ = step(T{}, step(T{}, f_, -(n + 1)), 1);
+    }
+    return *this;
+  }
+  CONSTEXPR_M civil_time& operator++() noexcept {
+    return *this += 1;
+  }
+  CONSTEXPR_M civil_time operator++(int) noexcept {
+    const civil_time a = *this;
+    ++*this;
+    return a;
+  }
+  CONSTEXPR_M civil_time& operator--() noexcept {
+    return *this -= 1;
+  }
+  CONSTEXPR_M civil_time operator--(int) noexcept {
+    const civil_time a = *this;
+    --*this;
+    return a;
+  }
+
+  // Binary arithmetic operators.
+  friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept {
+    return a += n;
+  }
+  friend CONSTEXPR_F civil_time operator+(diff_t n, civil_time a) noexcept {
+    return a += n;
+  }
+  friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept {
+    return a -= n;
+  }
+  friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept {
+    return difference(T{}, lhs.f_, rhs.f_);
+  }
+
+  template <typename H>
+  friend H AbslHashValue(H h, civil_time a) {
+    return impl::AbslHashValueImpl(T{}, std::move(h), a.f_);
+  }
+
+ private:
+  // All instantiations of this template are allowed to call the following
+  // private constructor and access the private fields member.
+  template <typename U>
+  friend class civil_time;
+
+  // The designated constructor that all others eventually call.
+  explicit CONSTEXPR_M civil_time(fields f) noexcept : f_(align(T{}, f)) {}
+
+  fields f_;
+};
+
+// Disallows difference between differently aligned types.
+// auto n = civil_day(...) - civil_hour(...);  // would be confusing.
+template <typename T, typename U>
+CONSTEXPR_F diff_t operator-(civil_time<T>, civil_time<U>) = delete;
+
+using civil_year = civil_time<year_tag>;
+using civil_month = civil_time<month_tag>;
+using civil_day = civil_time<day_tag>;
+using civil_hour = civil_time<hour_tag>;
+using civil_minute = civil_time<minute_tag>;
+using civil_second = civil_time<second_tag>;
+
+////////////////////////////////////////////////////////////////////////
+
+// Relational operators that work with differently aligned objects.
+// Always compares all six fields.
+template <typename T1, typename T2>
+CONSTEXPR_F bool operator<(const civil_time<T1>& lhs,
+                           const civil_time<T2>& rhs) noexcept {
+  return (lhs.year() < rhs.year() ||
+          (lhs.year() == rhs.year() &&
+           (lhs.month() < rhs.month() ||
+            (lhs.month() == rhs.month() &&
+             (lhs.day() < rhs.day() ||
+              (lhs.day() == rhs.day() &&
+               (lhs.hour() < rhs.hour() ||
+                (lhs.hour() == rhs.hour() &&
+                 (lhs.minute() < rhs.minute() ||
+                  (lhs.minute() == rhs.minute() &&
+                   (lhs.second() < rhs.second())))))))))));
+}
+template <typename T1, typename T2>
+CONSTEXPR_F bool operator<=(const civil_time<T1>& lhs,
+                            const civil_time<T2>& rhs) noexcept {
+  return !(rhs < lhs);
+}
+template <typename T1, typename T2>
+CONSTEXPR_F bool operator>=(const civil_time<T1>& lhs,
+                            const civil_time<T2>& rhs) noexcept {
+  return !(lhs < rhs);
+}
+template <typename T1, typename T2>
+CONSTEXPR_F bool operator>(const civil_time<T1>& lhs,
+                           const civil_time<T2>& rhs) noexcept {
+  return rhs < lhs;
+}
+template <typename T1, typename T2>
+CONSTEXPR_F bool operator==(const civil_time<T1>& lhs,
+                            const civil_time<T2>& rhs) noexcept {
+  return lhs.year() == rhs.year() && lhs.month() == rhs.month() &&
+         lhs.day() == rhs.day() && lhs.hour() == rhs.hour() &&
+         lhs.minute() == rhs.minute() && lhs.second() == rhs.second();
+}
+template <typename T1, typename T2>
+CONSTEXPR_F bool operator!=(const civil_time<T1>& lhs,
+                            const civil_time<T2>& rhs) noexcept {
+  return !(lhs == rhs);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+enum class weekday {
+  monday,
+  tuesday,
+  wednesday,
+  thursday,
+  friday,
+  saturday,
+  sunday,
+};
+
+CONSTEXPR_F weekday get_weekday(const civil_second& cs) noexcept {
+  CONSTEXPR_D weekday k_weekday_by_mon_off[13] = {
+      weekday::monday,    weekday::tuesday,  weekday::wednesday,
+      weekday::thursday,  weekday::friday,   weekday::saturday,
+      weekday::sunday,    weekday::monday,   weekday::tuesday,
+      weekday::wednesday, weekday::thursday, weekday::friday,
+      weekday::saturday,
+  };
+  CONSTEXPR_D int k_weekday_offsets[1 + 12] = {
+      -1, 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4,
+  };
+  year_t wd = 2400 + (cs.year() % 400) - (cs.month() < 3);
+  wd += wd / 4 - wd / 100 + wd / 400;
+  wd += k_weekday_offsets[cs.month()] + cs.day();
+  return k_weekday_by_mon_off[wd % 7 + 6];
+}
+
+////////////////////////////////////////////////////////////////////////
+
+CONSTEXPR_F civil_day next_weekday(civil_day cd, weekday wd) noexcept {
+  CONSTEXPR_D weekday k_weekdays_forw[14] = {
+      weekday::monday,    weekday::tuesday,  weekday::wednesday,
+      weekday::thursday,  weekday::friday,   weekday::saturday,
+      weekday::sunday,    weekday::monday,   weekday::tuesday,
+      weekday::wednesday, weekday::thursday, weekday::friday,
+      weekday::saturday,  weekday::sunday,
+  };
+  weekday base = get_weekday(cd);
+  for (int i = 0;; ++i) {
+    if (base == k_weekdays_forw[i]) {
+      for (int j = i + 1;; ++j) {
+        if (wd == k_weekdays_forw[j]) {
+          return cd + (j - i);
+        }
+      }
+    }
+  }
+}
+
+CONSTEXPR_F civil_day prev_weekday(civil_day cd, weekday wd) noexcept {
+  CONSTEXPR_D weekday k_weekdays_back[14] = {
+      weekday::sunday,   weekday::saturday,  weekday::friday,
+      weekday::thursday, weekday::wednesday, weekday::tuesday,
+      weekday::monday,   weekday::sunday,    weekday::saturday,
+      weekday::friday,   weekday::thursday,  weekday::wednesday,
+      weekday::tuesday,  weekday::monday,
+  };
+  weekday base = get_weekday(cd);
+  for (int i = 0;; ++i) {
+    if (base == k_weekdays_back[i]) {
+      for (int j = i + 1;; ++j) {
+        if (wd == k_weekdays_back[j]) {
+          return cd - (j - i);
+        }
+      }
+    }
+  }
+}
+
+CONSTEXPR_F int get_yearday(const civil_second& cs) noexcept {
+  CONSTEXPR_D int k_month_offsets[1 + 12] = {
+      -1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
+  };
+  const int feb29 = (cs.month() > 2 && impl::is_leap_year(cs.year()));
+  return k_month_offsets[cs.month()] + feb29 + cs.day();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+std::ostream& operator<<(std::ostream& os, const civil_year& y);
+std::ostream& operator<<(std::ostream& os, const civil_month& m);
+std::ostream& operator<<(std::ostream& os, const civil_day& d);
+std::ostream& operator<<(std::ostream& os, const civil_hour& h);
+std::ostream& operator<<(std::ostream& os, const civil_minute& m);
+std::ostream& operator<<(std::ostream& os, const civil_second& s);
+std::ostream& operator<<(std::ostream& os, weekday wd);
+
+}  // namespace detail
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#undef CONSTEXPR_M
+#undef CONSTEXPR_F
+#undef CONSTEXPR_D
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_CIVIL_TIME_DETAIL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h
new file mode 100644 (file)
index 0000000..ef6c4ba
--- /dev/null
@@ -0,0 +1,385 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+// A library for translating between absolute times (represented by
+// std::chrono::time_points of the std::chrono::system_clock) and civil
+// times (represented by cctz::civil_second) using the rules defined by
+// a time zone (cctz::time_zone).
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_H_
+
+#include <chrono>
+#include <cstdint>
+#include <string>
+#include <utility>
+
+#include "absl/time/internal/cctz/include/cctz/civil_time.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// Convenience aliases. Not intended as public API points.
+template <typename D>
+using time_point = std::chrono::time_point<std::chrono::system_clock, D>;
+using seconds = std::chrono::duration<std::int_fast64_t>;
+using sys_seconds = seconds;  // Deprecated.  Use cctz::seconds instead.
+
+namespace detail {
+template <typename D>
+inline std::pair<time_point<seconds>, D>
+split_seconds(const time_point<D>& tp) {
+  auto sec = std::chrono::time_point_cast<seconds>(tp);
+  auto sub = tp - sec;
+  if (sub.count() < 0) {
+    sec -= seconds(1);
+    sub += seconds(1);
+  }
+  return {sec, std::chrono::duration_cast<D>(sub)};
+}
+inline std::pair<time_point<seconds>, seconds>
+split_seconds(const time_point<seconds>& tp) {
+  return {tp, seconds::zero()};
+}
+}  // namespace detail
+
+// cctz::time_zone is an opaque, small, value-type class representing a
+// geo-political region within which particular rules are used for mapping
+// between absolute and civil times. Time zones are named using the TZ
+// identifiers from the IANA Time Zone Database, such as "America/Los_Angeles"
+// or "Australia/Sydney". Time zones are created from factory functions such
+// as load_time_zone(). Note: strings like "PST" and "EDT" are not valid TZ
+// identifiers.
+//
+// Example:
+//   cctz::time_zone utc = cctz::utc_time_zone();
+//   cctz::time_zone pst = cctz::fixed_time_zone(std::chrono::hours(-8));
+//   cctz::time_zone loc = cctz::local_time_zone();
+//   cctz::time_zone lax;
+//   if (!cctz::load_time_zone("America/Los_Angeles", &lax)) { ... }
+//
+// See also:
+// - http://www.iana.org/time-zones
+// - https://en.wikipedia.org/wiki/Zoneinfo
+class time_zone {
+ public:
+  time_zone() : time_zone(nullptr) {}  // Equivalent to UTC
+  time_zone(const time_zone&) = default;
+  time_zone& operator=(const time_zone&) = default;
+
+  std::string name() const;
+
+  // An absolute_lookup represents the civil time (cctz::civil_second) within
+  // this time_zone at the given absolute time (time_point). There are
+  // additionally a few other fields that may be useful when working with
+  // older APIs, such as std::tm.
+  //
+  // Example:
+  //   const cctz::time_zone tz = ...
+  //   const auto tp = std::chrono::system_clock::now();
+  //   const cctz::time_zone::absolute_lookup al = tz.lookup(tp);
+  struct absolute_lookup {
+    civil_second cs;
+    // Note: The following fields exist for backward compatibility with older
+    // APIs. Accessing these fields directly is a sign of imprudent logic in
+    // the calling code. Modern time-related code should only access this data
+    // indirectly by way of cctz::format().
+    int offset;        // civil seconds east of UTC
+    bool is_dst;       // is offset non-standard?
+    const char* abbr;  // time-zone abbreviation (e.g., "PST")
+  };
+  absolute_lookup lookup(const time_point<seconds>& tp) const;
+  template <typename D>
+  absolute_lookup lookup(const time_point<D>& tp) const {
+    return lookup(detail::split_seconds(tp).first);
+  }
+
+  // A civil_lookup represents the absolute time(s) (time_point) that
+  // correspond to the given civil time (cctz::civil_second) within this
+  // time_zone. Usually the given civil time represents a unique instant
+  // in time, in which case the conversion is unambiguous. However,
+  // within this time zone, the given civil time may be skipped (e.g.,
+  // during a positive UTC offset shift), or repeated (e.g., during a
+  // negative UTC offset shift). To account for these possibilities,
+  // civil_lookup is richer than just a single time_point.
+  //
+  // In all cases the civil_lookup::kind enum will indicate the nature
+  // of the given civil-time argument, and the pre, trans, and post
+  // members will give the absolute time answers using the pre-transition
+  // offset, the transition point itself, and the post-transition offset,
+  // respectively (all three times are equal if kind == UNIQUE). If any
+  // of these three absolute times is outside the representable range of a
+  // time_point<seconds> the field is set to its maximum/minimum value.
+  //
+  // Example:
+  //   cctz::time_zone lax;
+  //   if (!cctz::load_time_zone("America/Los_Angeles", &lax)) { ... }
+  //
+  //   // A unique civil time.
+  //   auto jan01 = lax.lookup(cctz::civil_second(2011, 1, 1, 0, 0, 0));
+  //   // jan01.kind == cctz::time_zone::civil_lookup::UNIQUE
+  //   // jan01.pre    is 2011/01/01 00:00:00 -0800
+  //   // jan01.trans  is 2011/01/01 00:00:00 -0800
+  //   // jan01.post   is 2011/01/01 00:00:00 -0800
+  //
+  //   // A Spring DST transition, when there is a gap in civil time.
+  //   auto mar13 = lax.lookup(cctz::civil_second(2011, 3, 13, 2, 15, 0));
+  //   // mar13.kind == cctz::time_zone::civil_lookup::SKIPPED
+  //   // mar13.pre   is 2011/03/13 03:15:00 -0700
+  //   // mar13.trans is 2011/03/13 03:00:00 -0700
+  //   // mar13.post  is 2011/03/13 01:15:00 -0800
+  //
+  //   // A Fall DST transition, when civil times are repeated.
+  //   auto nov06 = lax.lookup(cctz::civil_second(2011, 11, 6, 1, 15, 0));
+  //   // nov06.kind == cctz::time_zone::civil_lookup::REPEATED
+  //   // nov06.pre   is 2011/11/06 01:15:00 -0700
+  //   // nov06.trans is 2011/11/06 01:00:00 -0800
+  //   // nov06.post  is 2011/11/06 01:15:00 -0800
+  struct civil_lookup {
+    enum civil_kind {
+      UNIQUE,    // the civil time was singular (pre == trans == post)
+      SKIPPED,   // the civil time did not exist (pre >= trans > post)
+      REPEATED,  // the civil time was ambiguous (pre < trans <= post)
+    } kind;
+    time_point<seconds> pre;    // uses the pre-transition offset
+    time_point<seconds> trans;  // instant of civil-offset change
+    time_point<seconds> post;   // uses the post-transition offset
+  };
+  civil_lookup lookup(const civil_second& cs) const;
+
+  // Finds the time of the next/previous offset change in this time zone.
+  //
+  // By definition, next_transition(tp, &trans) returns false when tp has
+  // its maximum value, and prev_transition(tp, &trans) returns false
+  // when tp has its minimum value. If the zone has no transitions, the
+  // result will also be false no matter what the argument.
+  //
+  // Otherwise, when tp has its minimum value, next_transition(tp, &trans)
+  // returns true and sets trans to the first recorded transition. Chains
+  // of calls to next_transition()/prev_transition() will eventually return
+  // false, but it is unspecified exactly when next_transition(tp, &trans)
+  // jumps to false, or what time is set by prev_transition(tp, &trans) for
+  // a very distant tp.
+  //
+  // Note: Enumeration of time-zone transitions is for informational purposes
+  // only. Modern time-related code should not care about when offset changes
+  // occur.
+  //
+  // Example:
+  //   cctz::time_zone nyc;
+  //   if (!cctz::load_time_zone("America/New_York", &nyc)) { ... }
+  //   const auto now = std::chrono::system_clock::now();
+  //   auto tp = cctz::time_point<cctz::seconds>::min();
+  //   cctz::time_zone::civil_transition trans;
+  //   while (tp <= now && nyc.next_transition(tp, &trans)) {
+  //     // transition: trans.from -> trans.to
+  //     tp = nyc.lookup(trans.to).trans;
+  //   }
+  struct civil_transition {
+    civil_second from;  // the civil time we jump from
+    civil_second to;    // the civil time we jump to
+  };
+  bool next_transition(const time_point<seconds>& tp,
+                       civil_transition* trans) const;
+  template <typename D>
+  bool next_transition(const time_point<D>& tp,
+                       civil_transition* trans) const {
+    return next_transition(detail::split_seconds(tp).first, trans);
+  }
+  bool prev_transition(const time_point<seconds>& tp,
+                       civil_transition* trans) const;
+  template <typename D>
+  bool prev_transition(const time_point<D>& tp,
+                       civil_transition* trans) const {
+    return prev_transition(detail::split_seconds(tp).first, trans);
+  }
+
+  // version() and description() provide additional information about the
+  // time zone. The content of each of the returned strings is unspecified,
+  // however, when the IANA Time Zone Database is the underlying data source
+  // the version() std::string will be in the familar form (e.g, "2018e") or
+  // empty when unavailable.
+  //
+  // Note: These functions are for informational or testing purposes only.
+  std::string version() const;  // empty when unknown
+  std::string description() const;
+
+  // Relational operators.
+  friend bool operator==(time_zone lhs, time_zone rhs) {
+    return &lhs.effective_impl() == &rhs.effective_impl();
+  }
+  friend bool operator!=(time_zone lhs, time_zone rhs) {
+    return !(lhs == rhs);
+  }
+
+  template <typename H>
+  friend H AbslHashValue(H h, time_zone tz) {
+    return H::combine(std::move(h), &tz.effective_impl());
+  }
+
+  class Impl;
+
+ private:
+  explicit time_zone(const Impl* impl) : impl_(impl) {}
+  const Impl& effective_impl() const;  // handles implicit UTC
+  const Impl* impl_;
+};
+
+// Loads the named time zone. May perform I/O on the initial load.
+// If the name is invalid, or some other kind of error occurs, returns
+// false and "*tz" is set to the UTC time zone.
+bool load_time_zone(const std::string& name, time_zone* tz);
+
+// Returns a time_zone representing UTC. Cannot fail.
+time_zone utc_time_zone();
+
+// Returns a time zone that is a fixed offset (seconds east) from UTC.
+// Note: If the absolute value of the offset is greater than 24 hours
+// you'll get UTC (i.e., zero offset) instead.
+time_zone fixed_time_zone(const seconds& offset);
+
+// Returns a time zone representing the local time zone. Falls back to UTC.
+// Note: local_time_zone.name() may only be something like "localtime".
+time_zone local_time_zone();
+
+// Returns the civil time (cctz::civil_second) within the given time zone at
+// the given absolute time (time_point). Since the additional fields provided
+// by the time_zone::absolute_lookup struct should rarely be needed in modern
+// code, this convert() function is simpler and should be preferred.
+template <typename D>
+inline civil_second convert(const time_point<D>& tp, const time_zone& tz) {
+  return tz.lookup(tp).cs;
+}
+
+// Returns the absolute time (time_point) that corresponds to the given civil
+// time within the given time zone. If the civil time is not unique (i.e., if
+// it was either repeated or non-existent), then the returned time_point is
+// the best estimate that preserves relative order. That is, this function
+// guarantees that if cs1 < cs2, then convert(cs1, tz) <= convert(cs2, tz).
+inline time_point<seconds> convert(const civil_second& cs,
+                                   const time_zone& tz) {
+  const time_zone::civil_lookup cl = tz.lookup(cs);
+  if (cl.kind == time_zone::civil_lookup::SKIPPED) return cl.trans;
+  return cl.pre;
+}
+
+namespace detail {
+using femtoseconds = std::chrono::duration<std::int_fast64_t, std::femto>;
+std::string format(const std::string&, const time_point<seconds>&,
+                   const femtoseconds&, const time_zone&);
+bool parse(const std::string&, const std::string&, const time_zone&,
+           time_point<seconds>*, femtoseconds*, std::string* err = nullptr);
+}  // namespace detail
+
+// Formats the given time_point in the given cctz::time_zone according to
+// the provided format string. Uses strftime()-like formatting options,
+// with the following extensions:
+//
+//   - %Ez  - RFC3339-compatible numeric UTC offset (+hh:mm or -hh:mm)
+//   - %E*z - Full-resolution numeric UTC offset (+hh:mm:ss or -hh:mm:ss)
+//   - %E#S - Seconds with # digits of fractional precision
+//   - %E*S - Seconds with full fractional precision (a literal '*')
+//   - %E#f - Fractional seconds with # digits of precision
+//   - %E*f - Fractional seconds with full precision (a literal '*')
+//   - %E4Y - Four-character years (-999 ... -001, 0000, 0001 ... 9999)
+//
+// Note that %E0S behaves like %S, and %E0f produces no characters. In
+// contrast %E*f always produces at least one digit, which may be '0'.
+//
+// Note that %Y produces as many characters as it takes to fully render the
+// year. A year outside of [-999:9999] when formatted with %E4Y will produce
+// more than four characters, just like %Y.
+//
+// Tip: Format strings should include the UTC offset (e.g., %z, %Ez, or %E*z)
+// so that the resulting string uniquely identifies an absolute time.
+//
+// Example:
+//   cctz::time_zone lax;
+//   if (!cctz::load_time_zone("America/Los_Angeles", &lax)) { ... }
+//   auto tp = cctz::convert(cctz::civil_second(2013, 1, 2, 3, 4, 5), lax);
+//   std::string f = cctz::format("%H:%M:%S", tp, lax);  // "03:04:05"
+//   f = cctz::format("%H:%M:%E3S", tp, lax);            // "03:04:05.000"
+template <typename D>
+inline std::string format(const std::string& fmt, const time_point<D>& tp,
+                          const time_zone& tz) {
+  const auto p = detail::split_seconds(tp);
+  const auto n = std::chrono::duration_cast<detail::femtoseconds>(p.second);
+  return detail::format(fmt, p.first, n, tz);
+}
+
+// Parses an input string according to the provided format string and
+// returns the corresponding time_point. Uses strftime()-like formatting
+// options, with the same extensions as cctz::format(), but with the
+// exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f. %Ez
+// and %E*z also accept the same inputs.
+//
+// %Y consumes as many numeric characters as it can, so the matching data
+// should always be terminated with a non-numeric. %E4Y always consumes
+// exactly four characters, including any sign.
+//
+// Unspecified fields are taken from the default date and time of ...
+//
+//   "1970-01-01 00:00:00.0 +0000"
+//
+// For example, parsing a string of "15:45" (%H:%M) will return a time_point
+// that represents "1970-01-01 15:45:00.0 +0000".
+//
+// Note that parse() returns time instants, so it makes most sense to parse
+// fully-specified date/time strings that include a UTC offset (%z, %Ez, or
+// %E*z).
+//
+// Note also that parse() only heeds the fields year, month, day, hour,
+// minute, (fractional) second, and UTC offset. Other fields, like weekday (%a
+// or %A), while parsed for syntactic validity, are ignored in the conversion.
+//
+// Date and time fields that are out-of-range will be treated as errors rather
+// than normalizing them like cctz::civil_second() would do. For example, it
+// is an error to parse the date "Oct 32, 2013" because 32 is out of range.
+//
+// A second of ":60" is normalized to ":00" of the following minute with
+// fractional seconds discarded. The following table shows how the given
+// seconds and subseconds will be parsed:
+//
+//   "59.x" -> 59.x  // exact
+//   "60.x" -> 00.0  // normalized
+//   "00.x" -> 00.x  // exact
+//
+// Errors are indicated by returning false.
+//
+// Example:
+//   const cctz::time_zone tz = ...
+//   std::chrono::system_clock::time_point tp;
+//   if (cctz::parse("%Y-%m-%d", "2015-10-09", tz, &tp)) {
+//     ...
+//   }
+template <typename D>
+inline bool parse(const std::string& fmt, const std::string& input,
+                  const time_zone& tz, time_point<D>* tpp) {
+  time_point<seconds> sec;
+  detail::femtoseconds fs;
+  const bool b = detail::parse(fmt, input, tz, &sec, &fs);
+  if (b) {
+    // TODO: Return false if unrepresentable as a time_point<D>.
+    *tpp = std::chrono::time_point_cast<D>(sec);
+    *tpp += std::chrono::duration_cast<D>(fs);
+  }
+  return b;
+}
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h
new file mode 100644 (file)
index 0000000..2b898d1
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_ZONE_INFO_SOURCE_H_
+#define ABSL_TIME_INTERNAL_CCTZ_ZONE_INFO_SOURCE_H_
+
+#include <cstddef>
+#include <functional>
+#include <memory>
+#include <string>
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// A stdio-like interface for providing zoneinfo data for a particular zone.
+class ZoneInfoSource {
+ public:
+  virtual ~ZoneInfoSource();
+
+  virtual std::size_t Read(void* ptr, std::size_t size) = 0;  // like fread()
+  virtual int Skip(std::size_t offset) = 0;  // like fseek()
+
+  // Until the zoneinfo data supports versioning information, we provide
+  // a way for a ZoneInfoSource to indicate it out-of-band.  The default
+  // implementation returns an empty std::string.
+  virtual std::string Version() const;
+};
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+namespace absl {
+namespace time_internal {
+namespace cctz_extension {
+
+// A function-pointer type for a factory that returns a ZoneInfoSource
+// given the name of a time zone and a fallback factory.  Returns null
+// when the data for the named zone cannot be found.
+using ZoneInfoSourceFactory =
+    std::unique_ptr<absl::time_internal::cctz::ZoneInfoSource> (*)(
+        const std::string&,
+        const std::function<std::unique_ptr<absl::time_internal::cctz::ZoneInfoSource>(
+            const std::string&)>&);
+
+// The user can control the mapping of zone names to zoneinfo data by
+// providing a definition for cctz_extension::zone_info_source_factory.
+// For example, given functions my_factory() and my_other_factory() that
+// can return a ZoneInfoSource for a named zone, we could inject them into
+// cctz::load_time_zone() with:
+//
+//   namespace cctz_extension {
+//   namespace {
+//   std::unique_ptr<cctz::ZoneInfoSource> CustomFactory(
+//       const std::string& name,
+//       const std::function<std::unique_ptr<cctz::ZoneInfoSource>(
+//           const std::string& name)>& fallback_factory) {
+//     if (auto zip = my_factory(name)) return zip;
+//     if (auto zip = fallback_factory(name)) return zip;
+//     if (auto zip = my_other_factory(name)) return zip;
+//     return nullptr;
+//   }
+//   }  // namespace
+//   ZoneInfoSourceFactory zone_info_source_factory = CustomFactory;
+//   }  // namespace cctz_extension
+//
+// This might be used, say, to use zoneinfo data embedded in the program,
+// or read from a (possibly compressed) file archive, or both.
+//
+// cctz_extension::zone_info_source_factory() will be called:
+//   (1) from the same thread as the cctz::load_time_zone() call,
+//   (2) only once for any zone name, and
+//   (3) serially (i.e., no concurrent execution).
+//
+// The fallback factory obtains zoneinfo data by reading files in ${TZDIR},
+// and it is used automatically when no zone_info_source_factory definition
+// is linked into the program.
+extern ZoneInfoSourceFactory zone_info_source_factory;
+
+}  // namespace cctz_extension
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_ZONE_INFO_SOURCE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h
new file mode 100644 (file)
index 0000000..9c1f5e7
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_
+
+#include <string>
+
+#include "absl/time/internal/cctz/include/cctz/time_zone.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// Helper functions for dealing with the names and abbreviations
+// of time zones that are a fixed offset (seconds east) from UTC.
+// FixedOffsetFromName() extracts the offset from a valid fixed-offset
+// name, while FixedOffsetToName() and FixedOffsetToAbbr() generate
+// the canonical zone name and abbreviation respectively for the given
+// offset.
+//
+// A fixed-offset name looks like "Fixed/UTC<+-><hours>:<mins>:<secs>".
+// Its abbreviation is of the form "UTC(<+->H?H(MM(SS)?)?)?" where the
+// optional pieces are omitted when their values are zero.  (Note that
+// the sign is the opposite of that used in a POSIX TZ specification.)
+//
+// Note: FixedOffsetFromName() fails on syntax errors or when the parsed
+// offset exceeds 24 hours.  FixedOffsetToName() and FixedOffsetToAbbr()
+// both produce "UTC" when the argument offset exceeds 24 hours.
+bool FixedOffsetFromName(const std::string& name, seconds* offset);
+std::string FixedOffsetToName(const seconds& offset);
+std::string FixedOffsetToAbbr(const seconds& offset);
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h
new file mode 100644 (file)
index 0000000..d000b7a
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_IF_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_IF_H_
+
+#include <chrono>
+#include <cstdint>
+#include <memory>
+#include <string>
+
+#include "absl/time/internal/cctz/include/cctz/civil_time.h"
+#include "absl/time/internal/cctz/include/cctz/time_zone.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// A simple interface used to hide time-zone complexities from time_zone::Impl.
+// Subclasses implement the functions for civil-time conversions in the zone.
+class TimeZoneIf {
+ public:
+  // A factory function for TimeZoneIf implementations.
+  static std::unique_ptr<TimeZoneIf> Load(const std::string& name);
+
+  virtual ~TimeZoneIf();
+
+  virtual time_zone::absolute_lookup BreakTime(
+      const time_point<seconds>& tp) const = 0;
+  virtual time_zone::civil_lookup MakeTime(
+      const civil_second& cs) const = 0;
+
+  virtual bool NextTransition(const time_point<seconds>& tp,
+                              time_zone::civil_transition* trans) const = 0;
+  virtual bool PrevTransition(const time_point<seconds>& tp,
+                              time_zone::civil_transition* trans) const = 0;
+
+  virtual std::string Version() const = 0;
+  virtual std::string Description() const = 0;
+
+ protected:
+  TimeZoneIf() {}
+};
+
+// Convert between time_point<seconds> and a count of seconds since the
+// Unix epoch.  We assume that the std::chrono::system_clock and the
+// Unix clock are second aligned, but not that they share an epoch.
+inline std::int_fast64_t ToUnixSeconds(const time_point<seconds>& tp) {
+  return (tp - std::chrono::time_point_cast<seconds>(
+                   std::chrono::system_clock::from_time_t(0))).count();
+}
+inline time_point<seconds> FromUnixSeconds(std::int_fast64_t t) {
+  return std::chrono::time_point_cast<seconds>(
+             std::chrono::system_clock::from_time_t(0)) + seconds(t);
+}
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_IF_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h
new file mode 100644 (file)
index 0000000..b73fad9
--- /dev/null
@@ -0,0 +1,90 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_IMPL_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_IMPL_H_
+
+#include <memory>
+#include <string>
+
+#include "absl/time/internal/cctz/include/cctz/civil_time.h"
+#include "absl/time/internal/cctz/include/cctz/time_zone.h"
+#include "time_zone_if.h"
+#include "time_zone_info.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// time_zone::Impl is the internal object referenced by a cctz::time_zone.
+class time_zone::Impl {
+ public:
+  // The UTC time zone. Also used for other time zones that fail to load.
+  static time_zone UTC();
+
+  // Load a named time zone. Returns false if the name is invalid, or if
+  // some other kind of error occurs. Note that loading "UTC" never fails.
+  static bool LoadTimeZone(const std::string& name, time_zone* tz);
+
+  // Clears the map of cached time zones.  Primarily for use in benchmarks
+  // that gauge the performance of loading/parsing the time-zone data.
+  static void ClearTimeZoneMapTestOnly();
+
+  // The primary key is the time-zone ID (e.g., "America/New_York").
+  const std::string& Name() const {
+    // TODO: It would nice if the zoneinfo data included the zone name.
+    return name_;
+  }
+
+  // Breaks a time_point down to civil-time components in this time zone.
+  time_zone::absolute_lookup BreakTime(const time_point<seconds>& tp) const {
+    return zone_->BreakTime(tp);
+  }
+
+  // Converts the civil-time components in this time zone into a time_point.
+  // That is, the opposite of BreakTime(). The requested civil time may be
+  // ambiguous or illegal due to a change of UTC offset.
+  time_zone::civil_lookup MakeTime(const civil_second& cs) const {
+    return zone_->MakeTime(cs);
+  }
+
+  // Finds the time of the next/previous offset change in this time zone.
+  bool NextTransition(const time_point<seconds>& tp,
+                      time_zone::civil_transition* trans) const {
+    return zone_->NextTransition(tp, trans);
+  }
+  bool PrevTransition(const time_point<seconds>& tp,
+                      time_zone::civil_transition* trans) const {
+    return zone_->PrevTransition(tp, trans);
+  }
+
+  // Returns an implementation-defined version std::string for this time zone.
+  std::string Version() const { return zone_->Version(); }
+
+  // Returns an implementation-defined description of this time zone.
+  std::string Description() const { return zone_->Description(); }
+
+ private:
+  explicit Impl(const std::string& name);
+  static const Impl* UTCImpl();
+
+  const std::string name_;
+  std::unique_ptr<TimeZoneIf> zone_;
+};
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_IMPL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h
new file mode 100644 (file)
index 0000000..81cd402
--- /dev/null
@@ -0,0 +1,136 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_INFO_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_INFO_H_
+
+#include <atomic>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+#include "absl/time/internal/cctz/include/cctz/civil_time.h"
+#include "absl/time/internal/cctz/include/cctz/time_zone.h"
+#include "absl/time/internal/cctz/include/cctz/zone_info_source.h"
+#include "time_zone_if.h"
+#include "tzfile.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// A transition to a new UTC offset.
+struct Transition {
+  std::int_least64_t unix_time;   // the instant of this transition
+  std::uint_least8_t type_index;  // index of the transition type
+  civil_second civil_sec;         // local civil time of transition
+  civil_second prev_civil_sec;    // local civil time one second earlier
+
+  struct ByUnixTime {
+    inline bool operator()(const Transition& lhs, const Transition& rhs) const {
+      return lhs.unix_time < rhs.unix_time;
+    }
+  };
+  struct ByCivilTime {
+    inline bool operator()(const Transition& lhs, const Transition& rhs) const {
+      return lhs.civil_sec < rhs.civil_sec;
+    }
+  };
+};
+
+// The characteristics of a particular transition.
+struct TransitionType {
+  std::int_least32_t utc_offset;  // the new prevailing UTC offset
+  civil_second civil_max;         // max convertible civil time for offset
+  civil_second civil_min;         // min convertible civil time for offset
+  bool is_dst;                    // did we move into daylight-saving time
+  std::uint_least8_t abbr_index;  // index of the new abbreviation
+};
+
+// A time zone backed by the IANA Time Zone Database (zoneinfo).
+class TimeZoneInfo : public TimeZoneIf {
+ public:
+  TimeZoneInfo() = default;
+  TimeZoneInfo(const TimeZoneInfo&) = delete;
+  TimeZoneInfo& operator=(const TimeZoneInfo&) = delete;
+
+  // Loads the zoneinfo for the given name, returning true if successful.
+  bool Load(const std::string& name);
+
+  // TimeZoneIf implementations.
+  time_zone::absolute_lookup BreakTime(
+      const time_point<seconds>& tp) const override;
+  time_zone::civil_lookup MakeTime(
+      const civil_second& cs) const override;
+  bool NextTransition(const time_point<seconds>& tp,
+                      time_zone::civil_transition* trans) const override;
+  bool PrevTransition(const time_point<seconds>& tp,
+                      time_zone::civil_transition* trans) const override;
+  std::string Version() const override;
+  std::string Description() const override;
+
+ private:
+  struct Header {  // counts of:
+    std::size_t timecnt;     // transition times
+    std::size_t typecnt;     // transition types
+    std::size_t charcnt;     // zone abbreviation characters
+    std::size_t leapcnt;     // leap seconds (we expect none)
+    std::size_t ttisstdcnt;  // UTC/local indicators (unused)
+    std::size_t ttisutcnt;   // standard/wall indicators (unused)
+
+    bool Build(const tzhead& tzh);
+    std::size_t DataLength(std::size_t time_len) const;
+  };
+
+  void CheckTransition(const std::string& name, const TransitionType& tt,
+                       std::int_fast32_t offset, bool is_dst,
+                       const std::string& abbr) const;
+  bool EquivTransitions(std::uint_fast8_t tt1_index,
+                        std::uint_fast8_t tt2_index) const;
+  void ExtendTransitions(const std::string& name, const Header& hdr);
+
+  bool ResetToBuiltinUTC(const seconds& offset);
+  bool Load(const std::string& name, ZoneInfoSource* zip);
+
+  // Helpers for BreakTime() and MakeTime().
+  time_zone::absolute_lookup LocalTime(std::int_fast64_t unix_time,
+                                       const TransitionType& tt) const;
+  time_zone::absolute_lookup LocalTime(std::int_fast64_t unix_time,
+                                       const Transition& tr) const;
+  time_zone::civil_lookup TimeLocal(const civil_second& cs,
+                                    year_t c4_shift) const;
+
+  std::vector<Transition> transitions_;  // ordered by unix_time and civil_sec
+  std::vector<TransitionType> transition_types_;  // distinct transition types
+  std::uint_fast8_t default_transition_type_;  // for before first transition
+  std::string abbreviations_;  // all the NUL-terminated abbreviations
+
+  std::string version_;      // the tzdata version if available
+  std::string future_spec_;  // for after the last zic transition
+  bool extended_;            // future_spec_ was used to generate transitions
+  year_t last_year_;         // the final year of the generated transitions
+
+  // We remember the transitions found during the last BreakTime() and
+  // MakeTime() calls. If the next request is for the same transition we
+  // will avoid re-searching.
+  mutable std::atomic<std::size_t> local_time_hint_ = {};  // BreakTime() hint
+  mutable std::atomic<std::size_t> time_local_hint_ = {};  // MakeTime() hint
+};
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_INFO_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h
new file mode 100644 (file)
index 0000000..0d18e9a
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
+
+#include <string>
+
+#include "time_zone_if.h"
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// A time zone backed by gmtime_r(3), localtime_r(3), and mktime(3),
+// and which therefore only supports UTC and the local time zone.
+// TODO: Add support for fixed offsets from UTC.
+class TimeZoneLibC : public TimeZoneIf {
+ public:
+  explicit TimeZoneLibC(const std::string& name);
+
+  // TimeZoneIf implementations.
+  time_zone::absolute_lookup BreakTime(
+      const time_point<seconds>& tp) const override;
+  time_zone::civil_lookup MakeTime(
+      const civil_second& cs) const override;
+  bool NextTransition(const time_point<seconds>& tp,
+                      time_zone::civil_transition* trans) const override;
+  bool PrevTransition(const time_point<seconds>& tp,
+                      time_zone::civil_transition* trans) const override;
+  std::string Version() const override;
+  std::string Description() const override;
+
+ private:
+  const bool local_;  // localtime or UTC
+};
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h
new file mode 100644 (file)
index 0000000..6a60022
--- /dev/null
@@ -0,0 +1,128 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//   https://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+// Parsing of a POSIX zone spec as described in the TZ part of section 8.3 in
+// http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html.
+//
+// The current POSIX spec for America/Los_Angeles is "PST8PDT,M3.2.0,M11.1.0",
+// which would be broken down as ...
+//
+//   PosixTimeZone {
+//     std_abbr = "PST"
+//     std_offset = -28800
+//     dst_abbr = "PDT"
+//     dst_offset = -25200
+//     dst_start = PosixTransition {
+//       date {
+//         m {
+//           month = 3
+//           week = 2
+//           weekday = 0
+//         }
+//       }
+//       time {
+//         offset = 7200
+//       }
+//     }
+//     dst_end = PosixTransition {
+//       date {
+//         m {
+//           month = 11
+//           week = 1
+//           weekday = 0
+//         }
+//       }
+//       time {
+//         offset = 7200
+//       }
+//     }
+//   }
+
+#ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_POSIX_H_
+#define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_POSIX_H_
+
+#include <cstdint>
+#include <string>
+
+namespace absl {
+namespace time_internal {
+namespace cctz {
+
+// The date/time of the transition. The date is specified as either:
+// (J) the Nth day of the year (1 <= N <= 365), excluding leap days, or
+// (N) the Nth day of the year (0 <= N <= 365), including leap days, or
+// (M) the Nth weekday of a month (e.g., the 2nd Sunday in March).
+// The time, specified as a day offset, identifies the particular moment
+// of the transition, and may be negative or >= 24h, and in which case
+// it would take us to another day, and perhaps week, or even month.
+struct PosixTransition {
+  enum DateFormat { J, N, M };
+
+  struct Date {
+    struct NonLeapDay {
+      std::int_fast16_t day;  // day of non-leap year [1:365]
+    };
+    struct Day {
+      std::int_fast16_t day;  // day of year [0:365]
+    };
+    struct MonthWeekWeekday {
+      std::int_fast8_t month;    // month of year [1:12]
+      std::int_fast8_t week;     // week of month [1:5] (5==last)
+      std::int_fast8_t weekday;  // 0==Sun, ..., 6=Sat
+    };
+
+    DateFormat fmt;
+
+    union {
+      NonLeapDay j;
+      Day n;
+      MonthWeekWeekday m;
+    };
+  };
+
+  struct Time {
+    std::int_fast32_t offset;  // seconds before/after 00:00:00
+  };
+
+  Date date;
+  Time time;
+};
+
+// The entirety of a POSIX-string specified time-zone rule. The standard
+// abbreviation and offset are always given. If the time zone includes
+// daylight saving, then the daylight abbrevation is non-empty and the
+// remaining fields are also valid. Note that the start/end transitions
+// are not ordered---in the southern hemisphere the transition to end
+// daylight time occurs first in any particular year.
+struct PosixTimeZone {
+  std::string std_abbr;
+  std::int_fast32_t std_offset;
+
+  std::string dst_abbr;
+  std::int_fast32_t dst_offset;
+  PosixTransition dst_start;
+  PosixTransition dst_end;
+};
+
+// Breaks down a POSIX time-zone specification into its constituent pieces,
+// filling in any missing values (DST offset, or start/end transition times)
+// with the standard-defined defaults. Returns false if the specification
+// could not be parsed (although some fields of *res may have been altered).
+bool ParsePosixSpec(const std::string& spec, PosixTimeZone* res);
+
+}  // namespace cctz
+}  // namespace time_internal
+}  // namespace absl
+
+#endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_POSIX_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h
new file mode 100644 (file)
index 0000000..51b1f1f
--- /dev/null
@@ -0,0 +1,123 @@
+/* Layout and location of TZif files.  */
+
+#ifndef TZFILE_H
+
+#define TZFILE_H
+
+/*
+** This file is in the public domain, so clarified as of
+** 1996-06-05 by Arthur David Olson.
+*/
+
+/*
+** This header is for use ONLY with the time conversion code.
+** There is no guarantee that it will remain unchanged,
+** or that it will remain at all.
+** Do NOT copy it to any system include directory.
+** Thank you!
+*/
+
+/*
+** Information about time zone files.
+*/
+
+#ifndef TZDIR
+#define TZDIR  "/usr/share/zoneinfo" /* Time zone object file directory */
+#endif /* !defined TZDIR */
+
+#ifndef TZDEFAULT
+#define TZDEFAULT      "/etc/localtime"
+#endif /* !defined TZDEFAULT */
+
+#ifndef TZDEFRULES
+#define TZDEFRULES     "posixrules"
+#endif /* !defined TZDEFRULES */
+
+
+/* See Internet RFC 8536 for more details about the following format.  */
+
+/*
+** Each file begins with. . .
+*/
+
+#define        TZ_MAGIC        "TZif"
+
+struct tzhead {
+       char    tzh_magic[4];           /* TZ_MAGIC */
+       char    tzh_version[1];         /* '\0' or '2' or '3' as of 2013 */
+       char    tzh_reserved[15];       /* reserved; must be zero */
+       char    tzh_ttisutcnt[4];       /* coded number of trans. time flags */
+       char    tzh_ttisstdcnt[4];      /* coded number of trans. time flags */
+       char    tzh_leapcnt[4];         /* coded number of leap seconds */
+       char    tzh_timecnt[4];         /* coded number of transition times */
+       char    tzh_typecnt[4];         /* coded number of local time types */
+       char    tzh_charcnt[4];         /* coded number of abbr. chars */
+};
+
+/*
+** . . .followed by. . .
+**
+**     tzh_timecnt (char [4])s         coded transition times a la time(2)
+**     tzh_timecnt (unsigned char)s    types of local time starting at above
+**     tzh_typecnt repetitions of
+**             one (char [4])          coded UT offset in seconds
+**             one (unsigned char)     used to set tm_isdst
+**             one (unsigned char)     that's an abbreviation list index
+**     tzh_charcnt (char)s             '\0'-terminated zone abbreviations
+**     tzh_leapcnt repetitions of
+**             one (char [4])          coded leap second transition times
+**             one (char [4])          total correction after above
+**     tzh_ttisstdcnt (char)s          indexed by type; if 1, transition
+**                                     time is standard time, if 0,
+**                                     transition time is local (wall clock)
+**                                     time; if absent, transition times are
+**                                     assumed to be local time
+**     tzh_ttisutcnt (char)s           indexed by type; if 1, transition
+**                                     time is UT, if 0, transition time is
+**                                     local time; if absent, transition
+**                                     times are assumed to be local time.
+**                                     When this is 1, the corresponding
+**                                     std/wall indicator must also be 1.
+*/
+
+/*
+** If tzh_version is '2' or greater, the above is followed by a second instance
+** of tzhead and a second instance of the data in which each coded transition
+** time uses 8 rather than 4 chars,
+** then a POSIX-TZ-environment-variable-style std::string for use in handling
+** instants after the last transition time stored in the file
+** (with nothing between the newlines if there is no POSIX representation for
+** such instants).
+**
+** If tz_version is '3' or greater, the above is extended as follows.
+** First, the POSIX TZ std::string's hour offset may range from -167
+** through 167 as compared to the POSIX-required 0 through 24.
+** Second, its DST start time may be January 1 at 00:00 and its stop
+** time December 31 at 24:00 plus the difference between DST and
+** standard time, indicating DST all year.
+*/
+
+/*
+** In the current implementation, "tzset()" refuses to deal with files that
+** exceed any of the limits below.
+*/
+
+#ifndef TZ_MAX_TIMES
+#define TZ_MAX_TIMES   2000
+#endif /* !defined TZ_MAX_TIMES */
+
+#ifndef TZ_MAX_TYPES
+/* This must be at least 17 for Europe/Samara and Europe/Vilnius.  */
+#define TZ_MAX_TYPES   256 /* Limited by what (unsigned char)'s can hold */
+#endif /* !defined TZ_MAX_TYPES */
+
+#ifndef TZ_MAX_CHARS
+#define TZ_MAX_CHARS   50      /* Maximum number of abbreviation characters */
+                               /* (limited by what unsigned chars can hold) */
+#endif /* !defined TZ_MAX_CHARS */
+
+#ifndef TZ_MAX_LEAPS
+#define TZ_MAX_LEAPS   50      /* Maximum number of leap second corrections */
+#endif /* !defined TZ_MAX_LEAPS */
+
+#endif /* !defined TZFILE_H */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/testdata/README.zoneinfo b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/cctz/testdata/README.zoneinfo
new file mode 100644 (file)
index 0000000..95fb4a9
--- /dev/null
@@ -0,0 +1,37 @@
+testdata/zoneinfo contains time-zone data files that may be used with CCTZ.
+Install them in a location referenced by the ${TZDIR} environment variable.
+Symbolic and hard links have been eliminated for portability.
+
+On Linux systems the distribution's versions of these files can probably
+already be found in the default ${TZDIR} location, /usr/share/zoneinfo.
+
+New versions can be generated using the following shell script.
+
+  #!/bin/sh -
+  set -e
+  DESTDIR=$(mktemp -d)
+  trap "rm -fr ${DESTDIR}" 0 2 15
+  (
+    cd ${DESTDIR}
+    git clone https://github.com/eggert/tz.git
+    make --directory=tz \
+        install DESTDIR=${DESTDIR} \
+                DATAFORM=vanguard \
+                TZDIR=/zoneinfo \
+                REDO=posix_only \
+                LOCALTIME=Factory \
+                TZDATA_TEXT= \
+                ZONETABLES=zone1970.tab
+    tar --create --dereference --hard-dereference --file tzfile.tar \
+        --directory=tz tzfile.h
+    tar --create --dereference --hard-dereference --file zoneinfo.tar \
+        --exclude=zoneinfo/posixrules zoneinfo \
+        --directory=tz version
+  )
+  tar --extract --directory src --file ${DESTDIR}/tzfile.tar
+  tar --extract --directory testdata --file ${DESTDIR}/zoneinfo.tar
+  exit 0
+
+To run the CCTZ tests using the testdata/zoneinfo files, execute:
+
+  bazel test --test_env=TZDIR=${PWD}/testdata/zoneinfo ...
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc
new file mode 100644 (file)
index 0000000..5180230
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <chrono>
+#include <cstdint>
+
+namespace absl {
+namespace time_internal {
+
+static int64_t GetCurrentTimeNanosFromSystem() {
+  return std::chrono::duration_cast<std::chrono::nanoseconds>(
+             std::chrono::system_clock::now() -
+             std::chrono::system_clock::from_time_t(0))
+      .count();
+}
+
+}  // namespace time_internal
+}  // namespace absl
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc
new file mode 100644 (file)
index 0000000..65474ca
--- /dev/null
@@ -0,0 +1,22 @@
+#include "absl/time/clock.h"
+
+#include <sys/time.h>
+#include <ctime>
+#include <cstdint>
+
+#include "absl/base/internal/raw_logging.h"
+
+namespace absl {
+namespace time_internal {
+
+static int64_t GetCurrentTimeNanosFromSystem() {
+  const int64_t kNanosPerSecond = 1000 * 1000 * 1000;
+  struct timespec ts;
+  ABSL_RAW_CHECK(clock_gettime(CLOCK_REALTIME, &ts) == 0,
+                 "Failed to read real-time clock.");
+  return (int64_t{ts.tv_sec} * kNanosPerSecond +
+          int64_t{ts.tv_nsec});
+}
+
+}  // namespace time_internal
+}  // namespace absl
index 81a2d29..d7319ea 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 
 #include "absl/time/time.h"
 
-// This helper is a macro so that failed expectations show up with the
-// correct line numbers.
-//
-// This is for internal testing of the Base Time library itself. This is not
-// part of a public API.
-#define ABSL_INTERNAL_EXPECT_TIME(bd, y, m, d, h, min, s, off, isdst, zone) \
-  do {                                                                      \
-    EXPECT_EQ(y, bd.year);                                                  \
-    EXPECT_EQ(m, bd.month);                                                 \
-    EXPECT_EQ(d, bd.day);                                                   \
-    EXPECT_EQ(h, bd.hour);                                                  \
-    EXPECT_EQ(min, bd.minute);                                              \
-    EXPECT_EQ(s, bd.second);                                                \
-    EXPECT_EQ(off, bd.offset);                                              \
-    EXPECT_EQ(isdst, bd.is_dst);                                            \
-    EXPECT_STREQ(zone, bd.zone_abbr);                                       \
-  } while (0)
-
 namespace absl {
 namespace time_internal {
 
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/zoneinfo.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/zoneinfo.inc
new file mode 100644 (file)
index 0000000..bfed829
--- /dev/null
@@ -0,0 +1,729 @@
+unsigned char America_Los_Angeles[] = {
+  0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x80, 0x00, 0x00, 0x00,
+  0x9e, 0xa6, 0x48, 0xa0, 0x9f, 0xbb, 0x15, 0x90, 0xa0, 0x86, 0x2a, 0xa0,
+  0xa1, 0x9a, 0xf7, 0x90, 0xcb, 0x89, 0x1a, 0xa0, 0xd2, 0x23, 0xf4, 0x70,
+  0xd2, 0x61, 0x26, 0x10, 0xd6, 0xfe, 0x74, 0x5c, 0xd8, 0x80, 0xad, 0x90,
+  0xda, 0xfe, 0xc3, 0x90, 0xdb, 0xc0, 0x90, 0x10, 0xdc, 0xde, 0xa5, 0x90,
+  0xdd, 0xa9, 0xac, 0x90, 0xde, 0xbe, 0x87, 0x90, 0xdf, 0x89, 0x8e, 0x90,
+  0xe0, 0x9e, 0x69, 0x90, 0xe1, 0x69, 0x70, 0x90, 0xe2, 0x7e, 0x4b, 0x90,
+  0xe3, 0x49, 0x52, 0x90, 0xe4, 0x5e, 0x2d, 0x90, 0xe5, 0x29, 0x34, 0x90,
+  0xe6, 0x47, 0x4a, 0x10, 0xe7, 0x12, 0x51, 0x10, 0xe8, 0x27, 0x2c, 0x10,
+  0xe8, 0xf2, 0x33, 0x10, 0xea, 0x07, 0x0e, 0x10, 0xea, 0xd2, 0x15, 0x10,
+  0xeb, 0xe6, 0xf0, 0x10, 0xec, 0xb1, 0xf7, 0x10, 0xed, 0xc6, 0xd2, 0x10,
+  0xee, 0x91, 0xd9, 0x10, 0xef, 0xaf, 0xee, 0x90, 0xf0, 0x71, 0xbb, 0x10,
+  0xf1, 0x8f, 0xd0, 0x90, 0xf2, 0x7f, 0xc1, 0x90, 0xf3, 0x6f, 0xb2, 0x90,
+  0xf4, 0x5f, 0xa3, 0x90, 0xf5, 0x4f, 0x94, 0x90, 0xf6, 0x3f, 0x85, 0x90,
+  0xf7, 0x2f, 0x76, 0x90, 0xf8, 0x28, 0xa2, 0x10, 0xf9, 0x0f, 0x58, 0x90,
+  0xfa, 0x08, 0x84, 0x10, 0xfa, 0xf8, 0x83, 0x20, 0xfb, 0xe8, 0x66, 0x10,
+  0xfc, 0xd8, 0x65, 0x20, 0xfd, 0xc8, 0x48, 0x10, 0xfe, 0xb8, 0x47, 0x20,
+  0xff, 0xa8, 0x2a, 0x10, 0x00, 0x98, 0x29, 0x20, 0x01, 0x88, 0x0c, 0x10,
+  0x02, 0x78, 0x0b, 0x20, 0x03, 0x71, 0x28, 0x90, 0x04, 0x61, 0x27, 0xa0,
+  0x05, 0x51, 0x0a, 0x90, 0x06, 0x41, 0x09, 0xa0, 0x07, 0x30, 0xec, 0x90,
+  0x07, 0x8d, 0x43, 0xa0, 0x09, 0x10, 0xce, 0x90, 0x09, 0xad, 0xbf, 0x20,
+  0x0a, 0xf0, 0xb0, 0x90, 0x0b, 0xe0, 0xaf, 0xa0, 0x0c, 0xd9, 0xcd, 0x10,
+  0x0d, 0xc0, 0x91, 0xa0, 0x0e, 0xb9, 0xaf, 0x10, 0x0f, 0xa9, 0xae, 0x20,
+  0x10, 0x99, 0x91, 0x10, 0x11, 0x89, 0x90, 0x20, 0x12, 0x79, 0x73, 0x10,
+  0x13, 0x69, 0x72, 0x20, 0x14, 0x59, 0x55, 0x10, 0x15, 0x49, 0x54, 0x20,
+  0x16, 0x39, 0x37, 0x10, 0x17, 0x29, 0x36, 0x20, 0x18, 0x22, 0x53, 0x90,
+  0x19, 0x09, 0x18, 0x20, 0x1a, 0x02, 0x35, 0x90, 0x1a, 0xf2, 0x34, 0xa0,
+  0x1b, 0xe2, 0x17, 0x90, 0x1c, 0xd2, 0x16, 0xa0, 0x1d, 0xc1, 0xf9, 0x90,
+  0x1e, 0xb1, 0xf8, 0xa0, 0x1f, 0xa1, 0xdb, 0x90, 0x20, 0x76, 0x2b, 0x20,
+  0x21, 0x81, 0xbd, 0x90, 0x22, 0x56, 0x0d, 0x20, 0x23, 0x6a, 0xda, 0x10,
+  0x24, 0x35, 0xef, 0x20, 0x25, 0x4a, 0xbc, 0x10, 0x26, 0x15, 0xd1, 0x20,
+  0x27, 0x2a, 0x9e, 0x10, 0x27, 0xfe, 0xed, 0xa0, 0x29, 0x0a, 0x80, 0x10,
+  0x29, 0xde, 0xcf, 0xa0, 0x2a, 0xea, 0x62, 0x10, 0x2b, 0xbe, 0xb1, 0xa0,
+  0x2c, 0xd3, 0x7e, 0x90, 0x2d, 0x9e, 0x93, 0xa0, 0x2e, 0xb3, 0x60, 0x90,
+  0x2f, 0x7e, 0x75, 0xa0, 0x30, 0x93, 0x42, 0x90, 0x31, 0x67, 0x92, 0x20,
+  0x32, 0x73, 0x24, 0x90, 0x33, 0x47, 0x74, 0x20, 0x34, 0x53, 0x06, 0x90,
+  0x35, 0x27, 0x56, 0x20, 0x36, 0x32, 0xe8, 0x90, 0x37, 0x07, 0x38, 0x20,
+  0x38, 0x1c, 0x05, 0x10, 0x38, 0xe7, 0x1a, 0x20, 0x39, 0xfb, 0xe7, 0x10,
+  0x3a, 0xc6, 0xfc, 0x20, 0x3b, 0xdb, 0xc9, 0x10, 0x3c, 0xb0, 0x18, 0xa0,
+  0x3d, 0xbb, 0xab, 0x10, 0x3e, 0x8f, 0xfa, 0xa0, 0x3f, 0x9b, 0x8d, 0x10,
+  0x40, 0x6f, 0xdc, 0xa0, 0x41, 0x84, 0xa9, 0x90, 0x42, 0x4f, 0xbe, 0xa0,
+  0x43, 0x64, 0x8b, 0x90, 0x44, 0x2f, 0xa0, 0xa0, 0x45, 0x44, 0x6d, 0x90,
+  0x45, 0xf3, 0xd3, 0x20, 0x47, 0x2d, 0x8a, 0x10, 0x47, 0xd3, 0xb5, 0x20,
+  0x49, 0x0d, 0x6c, 0x10, 0x49, 0xb3, 0x97, 0x20, 0x4a, 0xed, 0x4e, 0x10,
+  0x4b, 0x9c, 0xb3, 0xa0, 0x4c, 0xd6, 0x6a, 0x90, 0x4d, 0x7c, 0x95, 0xa0,
+  0x4e, 0xb6, 0x4c, 0x90, 0x4f, 0x5c, 0x77, 0xa0, 0x50, 0x96, 0x2e, 0x90,
+  0x51, 0x3c, 0x59, 0xa0, 0x52, 0x76, 0x10, 0x90, 0x53, 0x1c, 0x3b, 0xa0,
+  0x54, 0x55, 0xf2, 0x90, 0x54, 0xfc, 0x1d, 0xa0, 0x56, 0x35, 0xd4, 0x90,
+  0x56, 0xe5, 0x3a, 0x20, 0x58, 0x1e, 0xf1, 0x10, 0x58, 0xc5, 0x1c, 0x20,
+  0x59, 0xfe, 0xd3, 0x10, 0x5a, 0xa4, 0xfe, 0x20, 0x5b, 0xde, 0xb5, 0x10,
+  0x5c, 0x84, 0xe0, 0x20, 0x5d, 0xbe, 0x97, 0x10, 0x5e, 0x64, 0xc2, 0x20,
+  0x5f, 0x9e, 0x79, 0x10, 0x60, 0x4d, 0xde, 0xa0, 0x61, 0x87, 0x95, 0x90,
+  0x62, 0x2d, 0xc0, 0xa0, 0x63, 0x67, 0x77, 0x90, 0x64, 0x0d, 0xa2, 0xa0,
+  0x65, 0x47, 0x59, 0x90, 0x65, 0xed, 0x84, 0xa0, 0x67, 0x27, 0x3b, 0x90,
+  0x67, 0xcd, 0x66, 0xa0, 0x69, 0x07, 0x1d, 0x90, 0x69, 0xad, 0x48, 0xa0,
+  0x6a, 0xe6, 0xff, 0x90, 0x6b, 0x96, 0x65, 0x20, 0x6c, 0xd0, 0x1c, 0x10,
+  0x6d, 0x76, 0x47, 0x20, 0x6e, 0xaf, 0xfe, 0x10, 0x6f, 0x56, 0x29, 0x20,
+  0x70, 0x8f, 0xe0, 0x10, 0x71, 0x36, 0x0b, 0x20, 0x72, 0x6f, 0xc2, 0x10,
+  0x73, 0x15, 0xed, 0x20, 0x74, 0x4f, 0xa4, 0x10, 0x74, 0xff, 0x09, 0xa0,
+  0x76, 0x38, 0xc0, 0x90, 0x76, 0xde, 0xeb, 0xa0, 0x78, 0x18, 0xa2, 0x90,
+  0x78, 0xbe, 0xcd, 0xa0, 0x79, 0xf8, 0x84, 0x90, 0x7a, 0x9e, 0xaf, 0xa0,
+  0x7b, 0xd8, 0x66, 0x90, 0x7c, 0x7e, 0x91, 0xa0, 0x7d, 0xb8, 0x48, 0x90,
+  0x7e, 0x5e, 0x73, 0xa0, 0x7f, 0x98, 0x2a, 0x90, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x03, 0x04, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0xff, 0xff, 0x91, 0x26, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x90,
+  0x01, 0x04, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x08, 0xff, 0xff, 0x9d, 0x90,
+  0x01, 0x0c, 0xff, 0xff, 0x9d, 0x90, 0x01, 0x10, 0x4c, 0x4d, 0x54, 0x00,
+  0x50, 0x44, 0x54, 0x00, 0x50, 0x53, 0x54, 0x00, 0x50, 0x57, 0x54, 0x00,
+  0x50, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+  0x00, 0x01, 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0xbb, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0xf8, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x5e, 0x04,
+  0x1a, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x9e, 0xa6, 0x48, 0xa0, 0xff, 0xff,
+  0xff, 0xff, 0x9f, 0xbb, 0x15, 0x90, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x86,
+  0x2a, 0xa0, 0xff, 0xff, 0xff, 0xff, 0xa1, 0x9a, 0xf7, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xcb, 0x89, 0x1a, 0xa0, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x23,
+  0xf4, 0x70, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x61, 0x26, 0x10, 0xff, 0xff,
+  0xff, 0xff, 0xd6, 0xfe, 0x74, 0x5c, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x80,
+  0xad, 0x90, 0xff, 0xff, 0xff, 0xff, 0xda, 0xfe, 0xc3, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xdb, 0xc0, 0x90, 0x10, 0xff, 0xff, 0xff, 0xff, 0xdc, 0xde,
+  0xa5, 0x90, 0xff, 0xff, 0xff, 0xff, 0xdd, 0xa9, 0xac, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xde, 0xbe, 0x87, 0x90, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x89,
+  0x8e, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x9e, 0x69, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xe1, 0x69, 0x70, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe2, 0x7e,
+  0x4b, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x49, 0x52, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xe4, 0x5e, 0x2d, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe5, 0x29,
+  0x34, 0x90, 0xff, 0xff, 0xff, 0xff, 0xe6, 0x47, 0x4a, 0x10, 0xff, 0xff,
+  0xff, 0xff, 0xe7, 0x12, 0x51, 0x10, 0xff, 0xff, 0xff, 0xff, 0xe8, 0x27,
+  0x2c, 0x10, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xf2, 0x33, 0x10, 0xff, 0xff,
+  0xff, 0xff, 0xea, 0x07, 0x0e, 0x10, 0xff, 0xff, 0xff, 0xff, 0xea, 0xd2,
+  0x15, 0x10, 0xff, 0xff, 0xff, 0xff, 0xeb, 0xe6, 0xf0, 0x10, 0xff, 0xff,
+  0xff, 0xff, 0xec, 0xb1, 0xf7, 0x10, 0xff, 0xff, 0xff, 0xff, 0xed, 0xc6,
+  0xd2, 0x10, 0xff, 0xff, 0xff, 0xff, 0xee, 0x91, 0xd9, 0x10, 0xff, 0xff,
+  0xff, 0xff, 0xef, 0xaf, 0xee, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x71,
+  0xbb, 0x10, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x8f, 0xd0, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xf2, 0x7f, 0xc1, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x6f,
+  0xb2, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x5f, 0xa3, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xf5, 0x4f, 0x94, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf6, 0x3f,
+  0x85, 0x90, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x2f, 0x76, 0x90, 0xff, 0xff,
+  0xff, 0xff, 0xf8, 0x28, 0xa2, 0x10, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x0f,
+  0x58, 0x90, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x08, 0x84, 0x10, 0xff, 0xff,
+  0xff, 0xff, 0xfa, 0xf8, 0x83, 0x20, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xe8,
+  0x66, 0x10, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xd8, 0x65, 0x20, 0xff, 0xff,
+  0xff, 0xff, 0xfd, 0xc8, 0x48, 0x10, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xb8,
+  0x47, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0x2a, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x98, 0x29, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x88,
+  0x0c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x02, 0x78, 0x0b, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x03, 0x71, 0x28, 0x90, 0x00, 0x00, 0x00, 0x00, 0x04, 0x61,
+  0x27, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x05, 0x51, 0x0a, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x06, 0x41, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x30,
+  0xec, 0x90, 0x00, 0x00, 0x00, 0x00, 0x07, 0x8d, 0x43, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x09, 0x10, 0xce, 0x90, 0x00, 0x00, 0x00, 0x00, 0x09, 0xad,
+  0xbf, 0x20, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0, 0xb0, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x0b, 0xe0, 0xaf, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd9,
+  0xcd, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xc0, 0x91, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x0e, 0xb9, 0xaf, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xa9,
+  0xae, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x99, 0x91, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x11, 0x89, 0x90, 0x20, 0x00, 0x00, 0x00, 0x00, 0x12, 0x79,
+  0x73, 0x10, 0x00, 0x00, 0x00, 0x00, 0x13, 0x69, 0x72, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x14, 0x59, 0x55, 0x10, 0x00, 0x00, 0x00, 0x00, 0x15, 0x49,
+  0x54, 0x20, 0x00, 0x00, 0x00, 0x00, 0x16, 0x39, 0x37, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x17, 0x29, 0x36, 0x20, 0x00, 0x00, 0x00, 0x00, 0x18, 0x22,
+  0x53, 0x90, 0x00, 0x00, 0x00, 0x00, 0x19, 0x09, 0x18, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x1a, 0x02, 0x35, 0x90, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xf2,
+  0x34, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe2, 0x17, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x1c, 0xd2, 0x16, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xc1,
+  0xf9, 0x90, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xb1, 0xf8, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x1f, 0xa1, 0xdb, 0x90, 0x00, 0x00, 0x00, 0x00, 0x20, 0x76,
+  0x2b, 0x20, 0x00, 0x00, 0x00, 0x00, 0x21, 0x81, 0xbd, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x22, 0x56, 0x0d, 0x20, 0x00, 0x00, 0x00, 0x00, 0x23, 0x6a,
+  0xda, 0x10, 0x00, 0x00, 0x00, 0x00, 0x24, 0x35, 0xef, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x25, 0x4a, 0xbc, 0x10, 0x00, 0x00, 0x00, 0x00, 0x26, 0x15,
+  0xd1, 0x20, 0x00, 0x00, 0x00, 0x00, 0x27, 0x2a, 0x9e, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x27, 0xfe, 0xed, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x29, 0x0a,
+  0x80, 0x10, 0x00, 0x00, 0x00, 0x00, 0x29, 0xde, 0xcf, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x2a, 0xea, 0x62, 0x10, 0x00, 0x00, 0x00, 0x00, 0x2b, 0xbe,
+  0xb1, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xd3, 0x7e, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x2d, 0x9e, 0x93, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xb3,
+  0x60, 0x90, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x7e, 0x75, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x30, 0x93, 0x42, 0x90, 0x00, 0x00, 0x00, 0x00, 0x31, 0x67,
+  0x92, 0x20, 0x00, 0x00, 0x00, 0x00, 0x32, 0x73, 0x24, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x33, 0x47, 0x74, 0x20, 0x00, 0x00, 0x00, 0x00, 0x34, 0x53,
+  0x06, 0x90, 0x00, 0x00, 0x00, 0x00, 0x35, 0x27, 0x56, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x36, 0x32, 0xe8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x37, 0x07,
+  0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x05, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x38, 0xe7, 0x1a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x39, 0xfb,
+  0xe7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xc6, 0xfc, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x3b, 0xdb, 0xc9, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0,
+  0x18, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xbb, 0xab, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x3e, 0x8f, 0xfa, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x9b,
+  0x8d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6f, 0xdc, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x41, 0x84, 0xa9, 0x90, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4f,
+  0xbe, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x43, 0x64, 0x8b, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x44, 0x2f, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x45, 0x44,
+  0x6d, 0x90, 0x00, 0x00, 0x00, 0x00, 0x45, 0xf3, 0xd3, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x47, 0x2d, 0x8a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x47, 0xd3,
+  0xb5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x49, 0x0d, 0x6c, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x49, 0xb3, 0x97, 0x20, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xed,
+  0x4e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x9c, 0xb3, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x4c, 0xd6, 0x6a, 0x90, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x7c,
+  0x95, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x4e, 0xb6, 0x4c, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x4f, 0x5c, 0x77, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x50, 0x96,
+  0x2e, 0x90, 0x00, 0x00, 0x00, 0x00, 0x51, 0x3c, 0x59, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x52, 0x76, 0x10, 0x90, 0x00, 0x00, 0x00, 0x00, 0x53, 0x1c,
+  0x3b, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0xf2, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x54, 0xfc, 0x1d, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x56, 0x35,
+  0xd4, 0x90, 0x00, 0x00, 0x00, 0x00, 0x56, 0xe5, 0x3a, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x58, 0x1e, 0xf1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x58, 0xc5,
+  0x1c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x59, 0xfe, 0xd3, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x5a, 0xa4, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x5b, 0xde,
+  0xb5, 0x10, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x84, 0xe0, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x5d, 0xbe, 0x97, 0x10, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x64,
+  0xc2, 0x20, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x9e, 0x79, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x60, 0x4d, 0xde, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x61, 0x87,
+  0x95, 0x90, 0x00, 0x00, 0x00, 0x00, 0x62, 0x2d, 0xc0, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x63, 0x67, 0x77, 0x90, 0x00, 0x00, 0x00, 0x00, 0x64, 0x0d,
+  0xa2, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x65, 0x47, 0x59, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x65, 0xed, 0x84, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x67, 0x27,
+  0x3b, 0x90, 0x00, 0x00, 0x00, 0x00, 0x67, 0xcd, 0x66, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x69, 0x07, 0x1d, 0x90, 0x00, 0x00, 0x00, 0x00, 0x69, 0xad,
+  0x48, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xe6, 0xff, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x6b, 0x96, 0x65, 0x20, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd0,
+  0x1c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x76, 0x47, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x6e, 0xaf, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x56,
+  0x29, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0xe0, 0x10, 0x00, 0x00,
+  0x00, 0x00, 0x71, 0x36, 0x0b, 0x20, 0x00, 0x00, 0x00, 0x00, 0x72, 0x6f,
+  0xc2, 0x10, 0x00, 0x00, 0x00, 0x00, 0x73, 0x15, 0xed, 0x20, 0x00, 0x00,
+  0x00, 0x00, 0x74, 0x4f, 0xa4, 0x10, 0x00, 0x00, 0x00, 0x00, 0x74, 0xff,
+  0x09, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x76, 0x38, 0xc0, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x76, 0xde, 0xeb, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x18,
+  0xa2, 0x90, 0x00, 0x00, 0x00, 0x00, 0x78, 0xbe, 0xcd, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x79, 0xf8, 0x84, 0x90, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x9e,
+  0xaf, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x7b, 0xd8, 0x66, 0x90, 0x00, 0x00,
+  0x00, 0x00, 0x7c, 0x7e, 0x91, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xb8,
+  0x48, 0x90, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5e, 0x73, 0xa0, 0x00, 0x00,
+  0x00, 0x00, 0x7f, 0x98, 0x2a, 0x90, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x03, 0x04, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0xff, 0xff, 0x91, 0x26, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x90, 0x01,
+  0x04, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x08, 0xff, 0xff, 0x9d, 0x90, 0x01,
+  0x0c, 0xff, 0xff, 0x9d, 0x90, 0x01, 0x10, 0x4c, 0x4d, 0x54, 0x00, 0x50,
+  0x44, 0x54, 0x00, 0x50, 0x53, 0x54, 0x00, 0x50, 0x57, 0x54, 0x00, 0x50,
+  0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+  0x01, 0x0a, 0x50, 0x53, 0x54, 0x38, 0x50, 0x44, 0x54, 0x2c, 0x4d, 0x33,
+  0x2e, 0x32, 0x2e, 0x30, 0x2c, 0x4d, 0x31, 0x31, 0x2e, 0x31, 0x2e, 0x30,
+  0x0a
+};
+unsigned int America_Los_Angeles_len = 2845;
+unsigned char America_New_York[] = {
+  0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x80, 0x00, 0x00, 0x00,
+  0x9e, 0xa6, 0x1e, 0x70, 0x9f, 0xba, 0xeb, 0x60, 0xa0, 0x86, 0x00, 0x70,
+  0xa1, 0x9a, 0xcd, 0x60, 0xa2, 0x65, 0xe2, 0x70, 0xa3, 0x83, 0xe9, 0xe0,
+  0xa4, 0x6a, 0xae, 0x70, 0xa5, 0x35, 0xa7, 0x60, 0xa6, 0x53, 0xca, 0xf0,
+  0xa7, 0x15, 0x89, 0x60, 0xa8, 0x33, 0xac, 0xf0, 0xa8, 0xfe, 0xa5, 0xe0,
+  0xaa, 0x13, 0x8e, 0xf0, 0xaa, 0xde, 0x87, 0xe0, 0xab, 0xf3, 0x70, 0xf0,
+  0xac, 0xbe, 0x69, 0xe0, 0xad, 0xd3, 0x52, 0xf0, 0xae, 0x9e, 0x4b, 0xe0,
+  0xaf, 0xb3, 0x34, 0xf0, 0xb0, 0x7e, 0x2d, 0xe0, 0xb1, 0x9c, 0x51, 0x70,
+  0xb2, 0x67, 0x4a, 0x60, 0xb3, 0x7c, 0x33, 0x70, 0xb4, 0x47, 0x2c, 0x60,
+  0xb5, 0x5c, 0x15, 0x70, 0xb6, 0x27, 0x0e, 0x60, 0xb7, 0x3b, 0xf7, 0x70,
+  0xb8, 0x06, 0xf0, 0x60, 0xb9, 0x1b, 0xd9, 0x70, 0xb9, 0xe6, 0xd2, 0x60,
+  0xbb, 0x04, 0xf5, 0xf0, 0xbb, 0xc6, 0xb4, 0x60, 0xbc, 0xe4, 0xd7, 0xf0,
+  0xbd, 0xaf, 0xd0, 0xe0, 0xbe, 0xc4, 0xb9, 0xf0, 0xbf, 0x8f, 0xb2, 0xe0,
+  0xc0, 0xa4, 0x9b, 0xf0, 0xc1, 0x6f, 0x94, 0xe0, 0xc2, 0x84, 0x7d, 0xf0,
+  0xc3, 0x4f, 0x76, 0xe0, 0xc4, 0x64, 0x5f, 0xf0, 0xc5, 0x2f, 0x58, 0xe0,
+  0xc6, 0x4d, 0x7c, 0x70, 0xc7, 0x0f, 0x3a, 0xe0, 0xc8, 0x2d, 0x5e, 0x70,
+  0xc8, 0xf8, 0x57, 0x60, 0xca, 0x0d, 0x40, 0x70, 0xca, 0xd8, 0x39, 0x60,
+  0xcb, 0x88, 0xf0, 0x70, 0xd2, 0x23, 0xf4, 0x70, 0xd2, 0x60, 0xfb, 0xe0,
+  0xd3, 0x75, 0xe4, 0xf0, 0xd4, 0x40, 0xdd, 0xe0, 0xd5, 0x55, 0xc6, 0xf0,
+  0xd6, 0x20, 0xbf, 0xe0, 0xd7, 0x35, 0xa8, 0xf0, 0xd8, 0x00, 0xa1, 0xe0,
+  0xd9, 0x15, 0x8a, 0xf0, 0xd9, 0xe0, 0x83, 0xe0, 0xda, 0xfe, 0xa7, 0x70,
+  0xdb, 0xc0, 0x65, 0xe0, 0xdc, 0xde, 0x89, 0x70, 0xdd, 0xa9, 0x82, 0x60,
+  0xde, 0xbe, 0x6b, 0x70, 0xdf, 0x89, 0x64, 0x60, 0xe0, 0x9e, 0x4d, 0x70,
+  0xe1, 0x69, 0x46, 0x60, 0xe2, 0x7e, 0x2f, 0x70, 0xe3, 0x49, 0x28, 0x60,
+  0xe4, 0x5e, 0x11, 0x70, 0xe5, 0x57, 0x2e, 0xe0, 0xe6, 0x47, 0x2d, 0xf0,
+  0xe7, 0x37, 0x10, 0xe0, 0xe8, 0x27, 0x0f, 0xf0, 0xe9, 0x16, 0xf2, 0xe0,
+  0xea, 0x06, 0xf1, 0xf0, 0xea, 0xf6, 0xd4, 0xe0, 0xeb, 0xe6, 0xd3, 0xf0,
+  0xec, 0xd6, 0xb6, 0xe0, 0xed, 0xc6, 0xb5, 0xf0, 0xee, 0xbf, 0xd3, 0x60,
+  0xef, 0xaf, 0xd2, 0x70, 0xf0, 0x9f, 0xb5, 0x60, 0xf1, 0x8f, 0xb4, 0x70,
+  0xf2, 0x7f, 0x97, 0x60, 0xf3, 0x6f, 0x96, 0x70, 0xf4, 0x5f, 0x79, 0x60,
+  0xf5, 0x4f, 0x78, 0x70, 0xf6, 0x3f, 0x5b, 0x60, 0xf7, 0x2f, 0x5a, 0x70,
+  0xf8, 0x28, 0x77, 0xe0, 0xf9, 0x0f, 0x3c, 0x70, 0xfa, 0x08, 0x59, 0xe0,
+  0xfa, 0xf8, 0x58, 0xf0, 0xfb, 0xe8, 0x3b, 0xe0, 0xfc, 0xd8, 0x3a, 0xf0,
+  0xfd, 0xc8, 0x1d, 0xe0, 0xfe, 0xb8, 0x1c, 0xf0, 0xff, 0xa7, 0xff, 0xe0,
+  0x00, 0x97, 0xfe, 0xf0, 0x01, 0x87, 0xe1, 0xe0, 0x02, 0x77, 0xe0, 0xf0,
+  0x03, 0x70, 0xfe, 0x60, 0x04, 0x60, 0xfd, 0x70, 0x05, 0x50, 0xe0, 0x60,
+  0x06, 0x40, 0xdf, 0x70, 0x07, 0x30, 0xc2, 0x60, 0x07, 0x8d, 0x19, 0x70,
+  0x09, 0x10, 0xa4, 0x60, 0x09, 0xad, 0x94, 0xf0, 0x0a, 0xf0, 0x86, 0x60,
+  0x0b, 0xe0, 0x85, 0x70, 0x0c, 0xd9, 0xa2, 0xe0, 0x0d, 0xc0, 0x67, 0x70,
+  0x0e, 0xb9, 0x84, 0xe0, 0x0f, 0xa9, 0x83, 0xf0, 0x10, 0x99, 0x66, 0xe0,
+  0x11, 0x89, 0x65, 0xf0, 0x12, 0x79, 0x48, 0xe0, 0x13, 0x69, 0x47, 0xf0,
+  0x14, 0x59, 0x2a, 0xe0, 0x15, 0x49, 0x29, 0xf0, 0x16, 0x39, 0x0c, 0xe0,
+  0x17, 0x29, 0x0b, 0xf0, 0x18, 0x22, 0x29, 0x60, 0x19, 0x08, 0xed, 0xf0,
+  0x1a, 0x02, 0x0b, 0x60, 0x1a, 0xf2, 0x0a, 0x70, 0x1b, 0xe1, 0xed, 0x60,
+  0x1c, 0xd1, 0xec, 0x70, 0x1d, 0xc1, 0xcf, 0x60, 0x1e, 0xb1, 0xce, 0x70,
+  0x1f, 0xa1, 0xb1, 0x60, 0x20, 0x76, 0x00, 0xf0, 0x21, 0x81, 0x93, 0x60,
+  0x22, 0x55, 0xe2, 0xf0, 0x23, 0x6a, 0xaf, 0xe0, 0x24, 0x35, 0xc4, 0xf0,
+  0x25, 0x4a, 0x91, 0xe0, 0x26, 0x15, 0xa6, 0xf0, 0x27, 0x2a, 0x73, 0xe0,
+  0x27, 0xfe, 0xc3, 0x70, 0x29, 0x0a, 0x55, 0xe0, 0x29, 0xde, 0xa5, 0x70,
+  0x2a, 0xea, 0x37, 0xe0, 0x2b, 0xbe, 0x87, 0x70, 0x2c, 0xd3, 0x54, 0x60,
+  0x2d, 0x9e, 0x69, 0x70, 0x2e, 0xb3, 0x36, 0x60, 0x2f, 0x7e, 0x4b, 0x70,
+  0x30, 0x93, 0x18, 0x60, 0x31, 0x67, 0x67, 0xf0, 0x32, 0x72, 0xfa, 0x60,
+  0x33, 0x47, 0x49, 0xf0, 0x34, 0x52, 0xdc, 0x60, 0x35, 0x27, 0x2b, 0xf0,
+  0x36, 0x32, 0xbe, 0x60, 0x37, 0x07, 0x0d, 0xf0, 0x38, 0x1b, 0xda, 0xe0,
+  0x38, 0xe6, 0xef, 0xf0, 0x39, 0xfb, 0xbc, 0xe0, 0x3a, 0xc6, 0xd1, 0xf0,
+  0x3b, 0xdb, 0x9e, 0xe0, 0x3c, 0xaf, 0xee, 0x70, 0x3d, 0xbb, 0x80, 0xe0,
+  0x3e, 0x8f, 0xd0, 0x70, 0x3f, 0x9b, 0x62, 0xe0, 0x40, 0x6f, 0xb2, 0x70,
+  0x41, 0x84, 0x7f, 0x60, 0x42, 0x4f, 0x94, 0x70, 0x43, 0x64, 0x61, 0x60,
+  0x44, 0x2f, 0x76, 0x70, 0x45, 0x44, 0x43, 0x60, 0x45, 0xf3, 0xa8, 0xf0,
+  0x47, 0x2d, 0x5f, 0xe0, 0x47, 0xd3, 0x8a, 0xf0, 0x49, 0x0d, 0x41, 0xe0,
+  0x49, 0xb3, 0x6c, 0xf0, 0x4a, 0xed, 0x23, 0xe0, 0x4b, 0x9c, 0x89, 0x70,
+  0x4c, 0xd6, 0x40, 0x60, 0x4d, 0x7c, 0x6b, 0x70, 0x4e, 0xb6, 0x22, 0x60,
+  0x4f, 0x5c, 0x4d, 0x70, 0x50, 0x96, 0x04, 0x60, 0x51, 0x3c, 0x2f, 0x70,
+  0x52, 0x75, 0xe6, 0x60, 0x53, 0x1c, 0x11, 0x70, 0x54, 0x55, 0xc8, 0x60,
+  0x54, 0xfb, 0xf3, 0x70, 0x56, 0x35, 0xaa, 0x60, 0x56, 0xe5, 0x0f, 0xf0,
+  0x58, 0x1e, 0xc6, 0xe0, 0x58, 0xc4, 0xf1, 0xf0, 0x59, 0xfe, 0xa8, 0xe0,
+  0x5a, 0xa4, 0xd3, 0xf0, 0x5b, 0xde, 0x8a, 0xe0, 0x5c, 0x84, 0xb5, 0xf0,
+  0x5d, 0xbe, 0x6c, 0xe0, 0x5e, 0x64, 0x97, 0xf0, 0x5f, 0x9e, 0x4e, 0xe0,
+  0x60, 0x4d, 0xb4, 0x70, 0x61, 0x87, 0x6b, 0x60, 0x62, 0x2d, 0x96, 0x70,
+  0x63, 0x67, 0x4d, 0x60, 0x64, 0x0d, 0x78, 0x70, 0x65, 0x47, 0x2f, 0x60,
+  0x65, 0xed, 0x5a, 0x70, 0x67, 0x27, 0x11, 0x60, 0x67, 0xcd, 0x3c, 0x70,
+  0x69, 0x06, 0xf3, 0x60, 0x69, 0xad, 0x1e, 0x70, 0x6a, 0xe6, 0xd5, 0x60,
+  0x6b, 0x96, 0x3a, 0xf0, 0x6c, 0xcf, 0xf1, 0xe0, 0x6d, 0x76, 0x1c, 0xf0,
+  0x6e, 0xaf, 0xd3, 0xe0, 0x6f, 0x55, 0xfe, 0xf0, 0x70, 0x8f, 0xb5, 0xe0,
+  0x71, 0x35, 0xe0, 0xf0, 0x72, 0x6f, 0x97, 0xe0, 0x73, 0x15, 0xc2, 0xf0,
+  0x74, 0x4f, 0x79, 0xe0, 0x74, 0xfe, 0xdf, 0x70, 0x76, 0x38, 0x96, 0x60,
+  0x76, 0xde, 0xc1, 0x70, 0x78, 0x18, 0x78, 0x60, 0x78, 0xbe, 0xa3, 0x70,
+  0x79, 0xf8, 0x5a, 0x60, 0x7a, 0x9e, 0x85, 0x70, 0x7b, 0xd8, 0x3c, 0x60,
+  0x7c, 0x7e, 0x67, 0x70, 0x7d, 0xb8, 0x1e, 0x60, 0x7e, 0x5e, 0x49, 0x70,
+  0x7f, 0x98, 0x00, 0x60, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0xff, 0xff, 0xba, 0x9e, 0x00, 0x00, 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x04,
+  0xff, 0xff, 0xb9, 0xb0, 0x00, 0x08, 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x0c,
+  0xff, 0xff, 0xc7, 0xc0, 0x01, 0x10, 0x4c, 0x4d, 0x54, 0x00, 0x45, 0x44,
+  0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x57, 0x54, 0x00, 0x45, 0x50,
+  0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
+  0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xed,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0xf8, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x5e, 0x03, 0xf0, 0x90,
+  0xff, 0xff, 0xff, 0xff, 0x9e, 0xa6, 0x1e, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0x9f, 0xba, 0xeb, 0x60, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x86, 0x00, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xa1, 0x9a, 0xcd, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xa2, 0x65, 0xe2, 0x70, 0xff, 0xff, 0xff, 0xff, 0xa3, 0x83, 0xe9, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xa4, 0x6a, 0xae, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xa5, 0x35, 0xa7, 0x60, 0xff, 0xff, 0xff, 0xff, 0xa6, 0x53, 0xca, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xa7, 0x15, 0x89, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xa8, 0x33, 0xac, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xfe, 0xa5, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xaa, 0x13, 0x8e, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xaa, 0xde, 0x87, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xab, 0xf3, 0x70, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xac, 0xbe, 0x69, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xad, 0xd3, 0x52, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xae, 0x9e, 0x4b, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xaf, 0xb3, 0x34, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xb0, 0x7e, 0x2d, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xb1, 0x9c, 0x51, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xb2, 0x67, 0x4a, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xb3, 0x7c, 0x33, 0x70, 0xff, 0xff, 0xff, 0xff, 0xb4, 0x47, 0x2c, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xb5, 0x5c, 0x15, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xb6, 0x27, 0x0e, 0x60, 0xff, 0xff, 0xff, 0xff, 0xb7, 0x3b, 0xf7, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xb8, 0x06, 0xf0, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xb9, 0x1b, 0xd9, 0x70, 0xff, 0xff, 0xff, 0xff, 0xb9, 0xe6, 0xd2, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xbb, 0x04, 0xf5, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xbb, 0xc6, 0xb4, 0x60, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe4, 0xd7, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xbd, 0xaf, 0xd0, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xbe, 0xc4, 0xb9, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xbf, 0x8f, 0xb2, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xc0, 0xa4, 0x9b, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xc1, 0x6f, 0x94, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xc2, 0x84, 0x7d, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xc3, 0x4f, 0x76, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xc4, 0x64, 0x5f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xc5, 0x2f, 0x58, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xc6, 0x4d, 0x7c, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xc7, 0x0f, 0x3a, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xc8, 0x2d, 0x5e, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xc8, 0xf8, 0x57, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xca, 0x0d, 0x40, 0x70, 0xff, 0xff, 0xff, 0xff, 0xca, 0xd8, 0x39, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xcb, 0x88, 0xf0, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xd2, 0x23, 0xf4, 0x70, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x60, 0xfb, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xd3, 0x75, 0xe4, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xd4, 0x40, 0xdd, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xd5, 0x55, 0xc6, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xd6, 0x20, 0xbf, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xd7, 0x35, 0xa8, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x00, 0xa1, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xd9, 0x15, 0x8a, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xd9, 0xe0, 0x83, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xda, 0xfe, 0xa7, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xdb, 0xc0, 0x65, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xdc, 0xde, 0x89, 0x70, 0xff, 0xff, 0xff, 0xff, 0xdd, 0xa9, 0x82, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xde, 0xbe, 0x6b, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xdf, 0x89, 0x64, 0x60, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x9e, 0x4d, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xe1, 0x69, 0x46, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xe2, 0x7e, 0x2f, 0x70, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x49, 0x28, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xe4, 0x5e, 0x11, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xe5, 0x57, 0x2e, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xe6, 0x47, 0x2d, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xe7, 0x37, 0x10, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xe8, 0x27, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x16, 0xf2, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xea, 0x06, 0xf1, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xea, 0xf6, 0xd4, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xeb, 0xe6, 0xd3, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xec, 0xd6, 0xb6, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xed, 0xc6, 0xb5, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xee, 0xbf, 0xd3, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xef, 0xaf, 0xd2, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xf0, 0x9f, 0xb5, 0x60, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x8f, 0xb4, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xf2, 0x7f, 0x97, 0x60, 0xff, 0xff, 0xff, 0xff,
+  0xf3, 0x6f, 0x96, 0x70, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x5f, 0x79, 0x60,
+  0xff, 0xff, 0xff, 0xff, 0xf5, 0x4f, 0x78, 0x70, 0xff, 0xff, 0xff, 0xff,
+  0xf6, 0x3f, 0x5b, 0x60, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x2f, 0x5a, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xf8, 0x28, 0x77, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xf9, 0x0f, 0x3c, 0x70, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x08, 0x59, 0xe0,
+  0xff, 0xff, 0xff, 0xff, 0xfa, 0xf8, 0x58, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xfb, 0xe8, 0x3b, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xd8, 0x3a, 0xf0,
+  0xff, 0xff, 0xff, 0xff, 0xfd, 0xc8, 0x1d, 0xe0, 0xff, 0xff, 0xff, 0xff,
+  0xfe, 0xb8, 0x1c, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa7, 0xff, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0xfe, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x01, 0x87, 0xe1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x77, 0xe0, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x03, 0x70, 0xfe, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x04, 0x60, 0xfd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x05, 0x50, 0xe0, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0xdf, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x07, 0x30, 0xc2, 0x60, 0x00, 0x00, 0x00, 0x00, 0x07, 0x8d, 0x19, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x09, 0x10, 0xa4, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x09, 0xad, 0x94, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0, 0x86, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x0b, 0xe0, 0x85, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x0c, 0xd9, 0xa2, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xc0, 0x67, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x0e, 0xb9, 0x84, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x0f, 0xa9, 0x83, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x99, 0x66, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x11, 0x89, 0x65, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x12, 0x79, 0x48, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x13, 0x69, 0x47, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x14, 0x59, 0x2a, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x15, 0x49, 0x29, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x16, 0x39, 0x0c, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x17, 0x29, 0x0b, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x18, 0x22, 0x29, 0x60, 0x00, 0x00, 0x00, 0x00, 0x19, 0x08, 0xed, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x1a, 0x02, 0x0b, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x1a, 0xf2, 0x0a, 0x70, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xe1, 0xed, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x1c, 0xd1, 0xec, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x1d, 0xc1, 0xcf, 0x60, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xb1, 0xce, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x1f, 0xa1, 0xb1, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x20, 0x76, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x21, 0x81, 0x93, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x22, 0x55, 0xe2, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x23, 0x6a, 0xaf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x24, 0x35, 0xc4, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x25, 0x4a, 0x91, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x26, 0x15, 0xa6, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x27, 0x2a, 0x73, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x27, 0xfe, 0xc3, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x29, 0x0a, 0x55, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x29, 0xde, 0xa5, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x2a, 0xea, 0x37, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x2b, 0xbe, 0x87, 0x70, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xd3, 0x54, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x2d, 0x9e, 0x69, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x2e, 0xb3, 0x36, 0x60, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x7e, 0x4b, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x30, 0x93, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x31, 0x67, 0x67, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x32, 0x72, 0xfa, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x33, 0x47, 0x49, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x34, 0x52, 0xdc, 0x60, 0x00, 0x00, 0x00, 0x00, 0x35, 0x27, 0x2b, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x36, 0x32, 0xbe, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x37, 0x07, 0x0d, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1b, 0xda, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x38, 0xe6, 0xef, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x39, 0xfb, 0xbc, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xc6, 0xd1, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x3b, 0xdb, 0x9e, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x3c, 0xaf, 0xee, 0x70, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xbb, 0x80, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x3e, 0x8f, 0xd0, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x3f, 0x9b, 0x62, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6f, 0xb2, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x41, 0x84, 0x7f, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x42, 0x4f, 0x94, 0x70, 0x00, 0x00, 0x00, 0x00, 0x43, 0x64, 0x61, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x44, 0x2f, 0x76, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x45, 0x44, 0x43, 0x60, 0x00, 0x00, 0x00, 0x00, 0x45, 0xf3, 0xa8, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x47, 0x2d, 0x5f, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x47, 0xd3, 0x8a, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x49, 0x0d, 0x41, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x49, 0xb3, 0x6c, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x4a, 0xed, 0x23, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x9c, 0x89, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x4c, 0xd6, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x4d, 0x7c, 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x4e, 0xb6, 0x22, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x4f, 0x5c, 0x4d, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x50, 0x96, 0x04, 0x60, 0x00, 0x00, 0x00, 0x00, 0x51, 0x3c, 0x2f, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x52, 0x75, 0xe6, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x53, 0x1c, 0x11, 0x70, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0xc8, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x54, 0xfb, 0xf3, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x56, 0x35, 0xaa, 0x60, 0x00, 0x00, 0x00, 0x00, 0x56, 0xe5, 0x0f, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x58, 0x1e, 0xc6, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x58, 0xc4, 0xf1, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x59, 0xfe, 0xa8, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x5a, 0xa4, 0xd3, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x5b, 0xde, 0x8a, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x84, 0xb5, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x5d, 0xbe, 0x6c, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x5e, 0x64, 0x97, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x9e, 0x4e, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x60, 0x4d, 0xb4, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x61, 0x87, 0x6b, 0x60, 0x00, 0x00, 0x00, 0x00, 0x62, 0x2d, 0x96, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x63, 0x67, 0x4d, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x64, 0x0d, 0x78, 0x70, 0x00, 0x00, 0x00, 0x00, 0x65, 0x47, 0x2f, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x65, 0xed, 0x5a, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x67, 0x27, 0x11, 0x60, 0x00, 0x00, 0x00, 0x00, 0x67, 0xcd, 0x3c, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x69, 0x06, 0xf3, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x69, 0xad, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xe6, 0xd5, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x6b, 0x96, 0x3a, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x6c, 0xcf, 0xf1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x76, 0x1c, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x6e, 0xaf, 0xd3, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x6f, 0x55, 0xfe, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0xb5, 0xe0,
+  0x00, 0x00, 0x00, 0x00, 0x71, 0x35, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00,
+  0x72, 0x6f, 0x97, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x73, 0x15, 0xc2, 0xf0,
+  0x00, 0x00, 0x00, 0x00, 0x74, 0x4f, 0x79, 0xe0, 0x00, 0x00, 0x00, 0x00,
+  0x74, 0xfe, 0xdf, 0x70, 0x00, 0x00, 0x00, 0x00, 0x76, 0x38, 0x96, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x76, 0xde, 0xc1, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x78, 0x18, 0x78, 0x60, 0x00, 0x00, 0x00, 0x00, 0x78, 0xbe, 0xa3, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x79, 0xf8, 0x5a, 0x60, 0x00, 0x00, 0x00, 0x00,
+  0x7a, 0x9e, 0x85, 0x70, 0x00, 0x00, 0x00, 0x00, 0x7b, 0xd8, 0x3c, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x7c, 0x7e, 0x67, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x7d, 0xb8, 0x1e, 0x60, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5e, 0x49, 0x70,
+  0x00, 0x00, 0x00, 0x00, 0x7f, 0x98, 0x00, 0x60, 0x00, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0xff, 0xff, 0xba, 0x9e, 0x00, 0x00, 0xff,
+  0xff, 0xc7, 0xc0, 0x01, 0x04, 0xff, 0xff, 0xb9, 0xb0, 0x00, 0x08, 0xff,
+  0xff, 0xc7, 0xc0, 0x01, 0x0c, 0xff, 0xff, 0xc7, 0xc0, 0x01, 0x10, 0x4c,
+  0x4d, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45,
+  0x57, 0x54, 0x00, 0x45, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x45, 0x53, 0x54, 0x35, 0x45, 0x44,
+  0x54, 0x2c, 0x4d, 0x33, 0x2e, 0x32, 0x2e, 0x30, 0x2c, 0x4d, 0x31, 0x31,
+  0x2e, 0x31, 0x2e, 0x30, 0x0a
+};
+unsigned int America_New_York_len = 3545;
+unsigned char Australia_Sydney[] = {
+  0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x00,
+  0x9c, 0x4e, 0xa6, 0x9c, 0x9c, 0xbc, 0x20, 0xf0, 0xcb, 0x54, 0xb3, 0x00,
+  0xcb, 0xc7, 0x57, 0x70, 0xcc, 0xb7, 0x56, 0x80, 0xcd, 0xa7, 0x39, 0x70,
+  0xce, 0xa0, 0x73, 0x00, 0xcf, 0x87, 0x1b, 0x70, 0x03, 0x70, 0x39, 0x80,
+  0x04, 0x0d, 0x1c, 0x00, 0x05, 0x50, 0x1b, 0x80, 0x05, 0xf6, 0x38, 0x80,
+  0x07, 0x2f, 0xfd, 0x80, 0x07, 0xd6, 0x1a, 0x80, 0x09, 0x0f, 0xdf, 0x80,
+  0x09, 0xb5, 0xfc, 0x80, 0x0a, 0xef, 0xc1, 0x80, 0x0b, 0x9f, 0x19, 0x00,
+  0x0c, 0xd8, 0xde, 0x00, 0x0d, 0x7e, 0xfb, 0x00, 0x0e, 0xb8, 0xc0, 0x00,
+  0x0f, 0x5e, 0xdd, 0x00, 0x10, 0x98, 0xa2, 0x00, 0x11, 0x3e, 0xbf, 0x00,
+  0x12, 0x78, 0x84, 0x00, 0x13, 0x1e, 0xa1, 0x00, 0x14, 0x58, 0x66, 0x00,
+  0x14, 0xfe, 0x83, 0x00, 0x16, 0x38, 0x48, 0x00, 0x17, 0x0c, 0x89, 0x80,
+  0x18, 0x21, 0x64, 0x80, 0x18, 0xc7, 0x81, 0x80, 0x1a, 0x01, 0x46, 0x80,
+  0x1a, 0xa7, 0x63, 0x80, 0x1b, 0xe1, 0x28, 0x80, 0x1c, 0x87, 0x45, 0x80,
+  0x1d, 0xc1, 0x0a, 0x80, 0x1e, 0x79, 0x9c, 0x80, 0x1f, 0x97, 0xb2, 0x00,
+  0x20, 0x59, 0x7e, 0x80, 0x21, 0x80, 0xce, 0x80, 0x22, 0x42, 0x9b, 0x00,
+  0x23, 0x69, 0xeb, 0x00, 0x24, 0x22, 0x7d, 0x00, 0x25, 0x49, 0xcd, 0x00,
+  0x25, 0xef, 0xea, 0x00, 0x27, 0x29, 0xaf, 0x00, 0x27, 0xcf, 0xcc, 0x00,
+  0x29, 0x09, 0x91, 0x00, 0x29, 0xaf, 0xae, 0x00, 0x2a, 0xe9, 0x73, 0x00,
+  0x2b, 0x98, 0xca, 0x80, 0x2c, 0xd2, 0x8f, 0x80, 0x2d, 0x78, 0xac, 0x80,
+  0x2e, 0xb2, 0x71, 0x80, 0x2f, 0x58, 0x8e, 0x80, 0x30, 0x92, 0x53, 0x80,
+  0x31, 0x5d, 0x5a, 0x80, 0x32, 0x72, 0x35, 0x80, 0x33, 0x3d, 0x3c, 0x80,
+  0x34, 0x52, 0x17, 0x80, 0x35, 0x1d, 0x1e, 0x80, 0x36, 0x31, 0xf9, 0x80,
+  0x36, 0xfd, 0x00, 0x80, 0x38, 0x1b, 0x16, 0x00, 0x38, 0xdc, 0xe2, 0x80,
+  0x39, 0xa7, 0xe9, 0x80, 0x3a, 0xbc, 0xc4, 0x80, 0x3b, 0xda, 0xda, 0x00,
+  0x3c, 0xa5, 0xe1, 0x00, 0x3d, 0xba, 0xbc, 0x00, 0x3e, 0x85, 0xc3, 0x00,
+  0x3f, 0x9a, 0x9e, 0x00, 0x40, 0x65, 0xa5, 0x00, 0x41, 0x83, 0xba, 0x80,
+  0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9c, 0x80, 0x44, 0x2e, 0xa3, 0x80,
+  0x45, 0x43, 0x7e, 0x80, 0x46, 0x05, 0x4b, 0x00, 0x47, 0x23, 0x60, 0x80,
+  0x47, 0xf7, 0xa2, 0x00, 0x48, 0xe7, 0x93, 0x00, 0x49, 0xd7, 0x84, 0x00,
+  0x4a, 0xc7, 0x75, 0x00, 0x4b, 0xb7, 0x66, 0x00, 0x4c, 0xa7, 0x57, 0x00,
+  0x4d, 0x97, 0x48, 0x00, 0x4e, 0x87, 0x39, 0x00, 0x4f, 0x77, 0x2a, 0x00,
+  0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+  0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0a, 0x80,
+  0x56, 0x0f, 0xfb, 0x80, 0x56, 0xff, 0xec, 0x80, 0x57, 0xef, 0xdd, 0x80,
+  0x58, 0xdf, 0xce, 0x80, 0x59, 0xcf, 0xbf, 0x80, 0x5a, 0xbf, 0xb0, 0x80,
+  0x5b, 0xb8, 0xdc, 0x00, 0x5c, 0xa8, 0xcd, 0x00, 0x5d, 0x98, 0xbe, 0x00,
+  0x5e, 0x88, 0xaf, 0x00, 0x5f, 0x78, 0xa0, 0x00, 0x60, 0x68, 0x91, 0x00,
+  0x61, 0x58, 0x82, 0x00, 0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00,
+  0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00, 0x66, 0x11, 0x71, 0x80,
+  0x67, 0x01, 0x62, 0x80, 0x67, 0xf1, 0x53, 0x80, 0x68, 0xe1, 0x44, 0x80,
+  0x69, 0xd1, 0x35, 0x80, 0x6a, 0xc1, 0x26, 0x80, 0x6b, 0xb1, 0x17, 0x80,
+  0x6c, 0xa1, 0x08, 0x80, 0x6d, 0x90, 0xf9, 0x80, 0x6e, 0x80, 0xea, 0x80,
+  0x6f, 0x70, 0xdb, 0x80, 0x70, 0x6a, 0x07, 0x00, 0x71, 0x59, 0xf8, 0x00,
+  0x72, 0x49, 0xe9, 0x00, 0x73, 0x39, 0xda, 0x00, 0x74, 0x29, 0xcb, 0x00,
+  0x75, 0x19, 0xbc, 0x00, 0x76, 0x09, 0xad, 0x00, 0x76, 0xf9, 0x9e, 0x00,
+  0x77, 0xe9, 0x8f, 0x00, 0x78, 0xd9, 0x80, 0x00, 0x79, 0xc9, 0x71, 0x00,
+  0x7a, 0xb9, 0x62, 0x00, 0x7b, 0xb2, 0x8d, 0x80, 0x7c, 0xa2, 0x7e, 0x80,
+  0x7d, 0x92, 0x6f, 0x80, 0x7e, 0x82, 0x60, 0x80, 0x7f, 0x72, 0x51, 0x80,
+  0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+  0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x00, 0x00,
+  0x8d, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x9a, 0xb0, 0x01, 0x04, 0x00, 0x00,
+  0x8c, 0xa0, 0x00, 0x09, 0x00, 0x00, 0x9a, 0xb0, 0x01, 0x04, 0x00, 0x00,
+  0x8c, 0xa0, 0x00, 0x09, 0x4c, 0x4d, 0x54, 0x00, 0x41, 0x45, 0x44, 0x54,
+  0x00, 0x41, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e,
+  0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+  0x73, 0x16, 0x7f, 0x3c, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x4e, 0xa6, 0x9c,
+  0xff, 0xff, 0xff, 0xff, 0x9c, 0xbc, 0x20, 0xf0, 0xff, 0xff, 0xff, 0xff,
+  0xcb, 0x54, 0xb3, 0x00, 0xff, 0xff, 0xff, 0xff, 0xcb, 0xc7, 0x57, 0x70,
+  0xff, 0xff, 0xff, 0xff, 0xcc, 0xb7, 0x56, 0x80, 0xff, 0xff, 0xff, 0xff,
+  0xcd, 0xa7, 0x39, 0x70, 0xff, 0xff, 0xff, 0xff, 0xce, 0xa0, 0x73, 0x00,
+  0xff, 0xff, 0xff, 0xff, 0xcf, 0x87, 0x1b, 0x70, 0x00, 0x00, 0x00, 0x00,
+  0x03, 0x70, 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0d, 0x1c, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x05, 0x50, 0x1b, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x05, 0xf6, 0x38, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, 0x2f, 0xfd, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x07, 0xd6, 0x1a, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x09, 0x0f, 0xdf, 0x80, 0x00, 0x00, 0x00, 0x00, 0x09, 0xb5, 0xfc, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x0a, 0xef, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x0b, 0x9f, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xd8, 0xde, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x0d, 0x7e, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x0e, 0xb8, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x5e, 0xdd, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x10, 0x98, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x11, 0x3e, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x78, 0x84, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x13, 0x1e, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x14, 0x58, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xfe, 0x83, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x16, 0x38, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x17, 0x0c, 0x89, 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x21, 0x64, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x18, 0xc7, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x1a, 0x01, 0x46, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xa7, 0x63, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x1b, 0xe1, 0x28, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x1c, 0x87, 0x45, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xc1, 0x0a, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x1e, 0x79, 0x9c, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x1f, 0x97, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x59, 0x7e, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x21, 0x80, 0xce, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x22, 0x42, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x69, 0xeb, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x24, 0x22, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x25, 0x49, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0xef, 0xea, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x27, 0x29, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x27, 0xcf, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x09, 0x91, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x29, 0xaf, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x2a, 0xe9, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x98, 0xca, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x2c, 0xd2, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x2d, 0x78, 0xac, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xb2, 0x71, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x2f, 0x58, 0x8e, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x30, 0x92, 0x53, 0x80, 0x00, 0x00, 0x00, 0x00, 0x31, 0x5d, 0x5a, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x32, 0x72, 0x35, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x33, 0x3d, 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x34, 0x52, 0x17, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x35, 0x1d, 0x1e, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x36, 0x31, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x00, 0x36, 0xfd, 0x00, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x38, 0x1b, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x38, 0xdc, 0xe2, 0x80, 0x00, 0x00, 0x00, 0x00, 0x39, 0xa7, 0xe9, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x3a, 0xbc, 0xc4, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x3b, 0xda, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xa5, 0xe1, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x3d, 0xba, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x3e, 0x85, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x9a, 0x9e, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x40, 0x65, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x41, 0x83, 0xba, 0x80, 0x00, 0x00, 0x00, 0x00, 0x42, 0x45, 0x87, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x43, 0x63, 0x9c, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x44, 0x2e, 0xa3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x45, 0x43, 0x7e, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x46, 0x05, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x47, 0x23, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x47, 0xf7, 0xa2, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x48, 0xe7, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x49, 0xd7, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xc7, 0x75, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x4b, 0xb7, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x4c, 0xa7, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x97, 0x48, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x4e, 0x87, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x4f, 0x77, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x70, 0x55, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x51, 0x60, 0x46, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x52, 0x50, 0x37, 0x80, 0x00, 0x00, 0x00, 0x00, 0x53, 0x40, 0x28, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x54, 0x30, 0x19, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x55, 0x20, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x56, 0x0f, 0xfb, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x56, 0xff, 0xec, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x57, 0xef, 0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x58, 0xdf, 0xce, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x59, 0xcf, 0xbf, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x5a, 0xbf, 0xb0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x5b, 0xb8, 0xdc, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x5c, 0xa8, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x5d, 0x98, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x88, 0xaf, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x5f, 0x78, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x60, 0x68, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x58, 0x82, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x62, 0x48, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x63, 0x38, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x28, 0x55, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x65, 0x18, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x66, 0x11, 0x71, 0x80, 0x00, 0x00, 0x00, 0x00, 0x67, 0x01, 0x62, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x67, 0xf1, 0x53, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x68, 0xe1, 0x44, 0x80, 0x00, 0x00, 0x00, 0x00, 0x69, 0xd1, 0x35, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x6a, 0xc1, 0x26, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x6b, 0xb1, 0x17, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xa1, 0x08, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x6d, 0x90, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x6e, 0x80, 0xea, 0x80, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x70, 0xdb, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x70, 0x6a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x71, 0x59, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x49, 0xe9, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x73, 0x39, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x74, 0x29, 0xcb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x19, 0xbc, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x76, 0x09, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x76, 0xf9, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xe9, 0x8f, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x78, 0xd9, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x79, 0xc9, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xb9, 0x62, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x7b, 0xb2, 0x8d, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x7c, 0xa2, 0x7e, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x92, 0x6f, 0x80,
+  0x00, 0x00, 0x00, 0x00, 0x7e, 0x82, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x7f, 0x72, 0x51, 0x80, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+  0x01, 0x02, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+  0x03, 0x04, 0x03, 0x00, 0x00, 0x8d, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x9a,
+  0xb0, 0x01, 0x04, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x09, 0x00, 0x00, 0x9a,
+  0xb0, 0x01, 0x04, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x09, 0x4c, 0x4d, 0x54,
+  0x00, 0x41, 0x45, 0x44, 0x54, 0x00, 0x41, 0x45, 0x53, 0x54, 0x00, 0x00,
+  0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x41, 0x45,
+  0x53, 0x54, 0x2d, 0x31, 0x30, 0x41, 0x45, 0x44, 0x54, 0x2c, 0x4d, 0x31,
+  0x30, 0x2e, 0x31, 0x2e, 0x30, 0x2c, 0x4d, 0x34, 0x2e, 0x31, 0x2e, 0x30,
+  0x2f, 0x33, 0x0a
+};
+unsigned int Australia_Sydney_len = 2223;
index 093f168..0534780 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 //  * `absl::TimeZone` defines geopolitical time zone regions (as collected
 //     within the IANA Time Zone database (https://www.iana.org/time-zones)).
 //
+// Note: Absolute times are distinct from civil times, which refer to the
+// human-scale time commonly represented by `YYYY-MM-DD hh:mm:ss`. The mapping
+// between absolute and civil times can be specified by use of time zones
+// (`absl::TimeZone` within this API). That is:
+//
+//   Civil Time = F(Absolute Time, Time Zone)
+//   Absolute Time = G(Civil Time, Time Zone)
+//
+// See civil_time.h for abstractions related to constructing and manipulating
+// civil time.
+//
 // Example:
 //
 //   absl::TimeZone nyc;
-//
-//   // LoadTimeZone may fail so it's always better to check for success.
+//   // LoadTimeZone() may fail so it's always better to check for success.
 //   if (!absl::LoadTimeZone("America/New_York", &nyc)) {
 //      // handle error case
 //   }
 //
 //   // My flight leaves NYC on Jan 2, 2017 at 03:04:05
-//   absl::Time takeoff = absl::FromDateTime(2017, 1, 2, 3, 4, 5, nyc);
+//   absl::CivilSecond cs(2017, 1, 2, 3, 4, 5);
+//   absl::Time takeoff = absl::FromCivil(cs, nyc);
+//
 //   absl::Duration flight_duration = absl::Hours(21) + absl::Minutes(35);
 //   absl::Time landing = takeoff + flight_duration;
 //
 //   std::string s = absl::FormatTime(
 //       "My flight will land in Sydney on %Y-%m-%d at %H:%M:%S",
 //       landing, syd);
-//
+
 #ifndef ABSL_TIME_TIME_H_
 #define ABSL_TIME_TIME_H_
 
-#if !defined(_WIN32)
+#if !defined(_MSC_VER)
 #include <sys/time.h>
 #else
-#include <winsock2.h>
+// We don't include `winsock2.h` because it drags in `windows.h` and friends,
+// and they define conflicting macros like OPAQUE, ERROR, and more. This has the
+// potential to break Abseil users.
+//
+// Instead we only forward declare `timeval` and require Windows users include
+// `winsock2.h` themselves. This is both inconsistent and troublesome, but so is
+// including 'windows.h' so we are picking the lesser of two evils here.
+struct timeval;
 #endif
 #include <chrono>  // NOLINT(build/c++11)
+#include <cmath>
 #include <cstdint>
 #include <ctime>
 #include <ostream>
@@ -63,8 +83,9 @@
 #include <type_traits>
 #include <utility>
 
-#include "absl/base/port.h"  // Needed for string vs std::string
-#include "cctz/time_zone.h"
+#include "absl/strings/string_view.h"
+#include "absl/time/civil_time.h"
+#include "absl/time/internal/cctz/include/cctz/time_zone.h"
 
 namespace absl {
 
@@ -80,10 +101,18 @@ constexpr int64_t GetRepHi(Duration d);
 constexpr uint32_t GetRepLo(Duration d);
 constexpr Duration MakeDuration(int64_t hi, uint32_t lo);
 constexpr Duration MakeDuration(int64_t hi, int64_t lo);
+inline Duration MakePosDoubleDuration(double n);
 constexpr int64_t kTicksPerNanosecond = 4;
 constexpr int64_t kTicksPerSecond = 1000 * 1000 * 1000 * kTicksPerNanosecond;
+template <std::intmax_t N>
+constexpr Duration FromInt64(int64_t v, std::ratio<1, N>);
+constexpr Duration FromInt64(int64_t v, std::ratio<60>);
+constexpr Duration FromInt64(int64_t v, std::ratio<3600>);
 template <typename T>
-using IsFloatingPoint =
+using EnableIfIntegral = typename std::enable_if<
+    std::is_integral<T>::value || std::is_enum<T>::value, int>::type;
+template <typename T>
+using EnableIfFloat =
     typename std::enable_if<std::is_floating_point<T>::value, int>::type;
 }  // namespace time_internal
 
@@ -130,6 +159,16 @@ class Duration {
   // Value semantics.
   constexpr Duration() : rep_hi_(0), rep_lo_(0) {}  // zero-length duration
 
+  // Copyable.
+#if !defined(__clang__) && defined(_MSC_VER) && _MSC_VER < 1910
+  // Explicitly defining the constexpr copy constructor avoids an MSVC bug.
+  constexpr Duration(const Duration& d)
+      : rep_hi_(d.rep_hi_), rep_lo_(d.rep_lo_) {}
+#else
+  constexpr Duration(const Duration& d) = default;
+#endif
+  Duration& operator=(const Duration& d) = default;
+
   // Compound assignment operators.
   Duration& operator+=(Duration d);
   Duration& operator-=(Duration d);
@@ -153,6 +192,11 @@ class Duration {
   Duration& operator*=(float r) { return *this *= static_cast<double>(r); }
   Duration& operator/=(float r) { return *this /= static_cast<double>(r); }
 
+  template <typename H>
+  friend H AbslHashValue(H h, Duration d) {
+    return H::combine(std::move(h), d.rep_hi_, d.rep_lo_);
+  }
+
  private:
   friend constexpr int64_t time_internal::GetRepHi(Duration d);
   friend constexpr uint32_t time_internal::GetRepLo(Duration d);
@@ -178,15 +222,15 @@ inline Duration operator-(Duration lhs, Duration rhs) { return lhs -= rhs; }
 
 // Multiplicative Operators
 template <typename T>
-inline Duration operator*(Duration lhs, T rhs) {
+Duration operator*(Duration lhs, T rhs) {
   return lhs *= rhs;
 }
 template <typename T>
-inline Duration operator*(T lhs, Duration rhs) {
+Duration operator*(T lhs, Duration rhs) {
   return rhs *= lhs;
 }
 template <typename T>
-inline Duration operator/(Duration lhs, T rhs) {
+Duration operator/(Duration lhs, T rhs) {
   return lhs /= rhs;
 }
 inline int64_t operator/(Duration lhs, Duration rhs) {
@@ -287,21 +331,57 @@ Duration Floor(Duration d, Duration unit);
 //   absl::Duration c = absl::Ceil(d, absl::Microseconds(1));   // 123457us
 Duration Ceil(Duration d, Duration unit);
 
+// InfiniteDuration()
+//
+// Returns an infinite `Duration`.  To get a `Duration` representing negative
+// infinity, use `-InfiniteDuration()`.
+//
+// Duration arithmetic overflows to +/- infinity and saturates. In general,
+// arithmetic with `Duration` infinities is similar to IEEE 754 infinities
+// except where IEEE 754 NaN would be involved, in which case +/-
+// `InfiniteDuration()` is used in place of a "nan" Duration.
+//
+// Examples:
+//
+//   constexpr absl::Duration inf = absl::InfiniteDuration();
+//   const absl::Duration d = ... any finite duration ...
+//
+//   inf == inf + inf
+//   inf == inf + d
+//   inf == inf - inf
+//   -inf == d - inf
+//
+//   inf == d * 1e100
+//   inf == inf / 2
+//   0 == d / inf
+//   INT64_MAX == inf / d
+//
+//   d < inf
+//   -inf < d
+//
+//   // Division by zero returns infinity, or INT64_MIN/MAX where appropriate.
+//   inf == d / 0
+//   INT64_MAX == d / absl::ZeroDuration()
+//
+// The examples involving the `/` operator above also apply to `IDivDuration()`
+// and `FDivDuration()`.
+constexpr Duration InfiniteDuration();
+
 // Nanoseconds()
 // Microseconds()
 // Milliseconds()
 // Seconds()
-// Minutes
+// Minutes()
 // Hours()
 //
 // Factory functions for constructing `Duration` values from an integral number
 // of the unit indicated by the factory function's name.
 //
-// Note: no "Days()" factory function exists because "a day" is ambiguous. Civil
-// days are not always 24 hours long, and a 24-hour duration often does not
-// correspond with a civil day. If a 24-hour duration is needed, use
-// `absl::Hours(24)`.
-//
+// Note: no "Days()" factory function exists because "a day" is ambiguous.
+// Civil days are not always 24 hours long, and a 24-hour duration often does
+// not correspond with a civil day. If a 24-hour duration is needed, use
+// `absl::Hours(24)`. (If you actually want a civil day, use absl::CivilDay
+// from civil_time.h.)
 //
 // Example:
 //
@@ -320,29 +400,38 @@ constexpr Duration Hours(int64_t n);
 // factories, which should be preferred.
 //
 // Example:
+//
 //   auto a = absl::Seconds(1.5);        // OK
 //   auto b = absl::Milliseconds(1500);  // BETTER
-template <typename T, time_internal::IsFloatingPoint<T> = 0>
+template <typename T, time_internal::EnableIfFloat<T> = 0>
 Duration Nanoseconds(T n) {
   return n * Nanoseconds(1);
 }
-template <typename T, time_internal::IsFloatingPoint<T> = 0>
+template <typename T, time_internal::EnableIfFloat<T> = 0>
 Duration Microseconds(T n) {
   return n * Microseconds(1);
 }
-template <typename T, time_internal::IsFloatingPoint<T> = 0>
+template <typename T, time_internal::EnableIfFloat<T> = 0>
 Duration Milliseconds(T n) {
   return n * Milliseconds(1);
 }
-template <typename T, time_internal::IsFloatingPoint<T> = 0>
+template <typename T, time_internal::EnableIfFloat<T> = 0>
 Duration Seconds(T n) {
-  return n * Seconds(1);
+  if (n >= 0) {  // Note: `NaN >= 0` is false.
+    if (n >= (std::numeric_limits<int64_t>::max)()) return InfiniteDuration();
+    return time_internal::MakePosDoubleDuration(n);
+  } else {
+    if (std::isnan(n))
+      return std::signbit(n) ? -InfiniteDuration() : InfiniteDuration();
+    if (n <= (std::numeric_limits<int64_t>::min)()) return -InfiniteDuration();
+    return -time_internal::MakePosDoubleDuration(-n);
+  }
 }
-template <typename T, time_internal::IsFloatingPoint<T> = 0>
+template <typename T, time_internal::EnableIfFloat<T> = 0>
 Duration Minutes(T n) {
   return n * Minutes(1);
 }
-template <typename T, time_internal::IsFloatingPoint<T> = 0>
+template <typename T, time_internal::EnableIfFloat<T> = 0>
 Duration Hours(T n) {
   return n * Hours(1);
 }
@@ -361,7 +450,7 @@ Duration Hours(T n) {
 // Example:
 //
 //   absl::Duration d = absl::Milliseconds(1500);
-//   int64_t isec = ToInt64Seconds(d);  // isec == 1
+//   int64_t isec = absl::ToInt64Seconds(d);  // isec == 1
 int64_t ToInt64Nanoseconds(Duration d);
 int64_t ToInt64Microseconds(Duration d);
 int64_t ToInt64Milliseconds(Duration d);
@@ -374,7 +463,7 @@ int64_t ToInt64Hours(Duration d);
 // ToDoubleMilliseconds()
 // ToDoubleSeconds()
 // ToDoubleMinutes()
-// ToDoubleHours
+// ToDoubleHours()
 //
 // Helper functions that convert a Duration to a floating point count of the
 // indicated unit. These functions are shorthand for the `FDivDuration()`
@@ -383,7 +472,7 @@ int64_t ToInt64Hours(Duration d);
 // Example:
 //
 //   absl::Duration d = absl::Milliseconds(1500);
-//   double dsec = ToDoubleSeconds(d);  // dsec == 1.5
+//   double dsec = absl::ToDoubleSeconds(d);  // dsec == 1.5
 double ToDoubleNanoseconds(Duration d);
 double ToDoubleMicroseconds(Duration d);
 double ToDoubleMilliseconds(Duration d);
@@ -431,42 +520,9 @@ std::chrono::seconds ToChronoSeconds(Duration d);
 std::chrono::minutes ToChronoMinutes(Duration d);
 std::chrono::hours ToChronoHours(Duration d);
 
-// InfiniteDuration()
-//
-// Returns an infinite `Duration`.  To get a `Duration` representing negative
-// infinity, use `-InfiniteDuration()`.
-//
-// Duration arithmetic overflows to +/- infinity and saturates. In general,
-// arithmetic with `Duration` infinities is similar to IEEE 754 infinities
-// except where IEEE 754 NaN would be involved, in which case +/-
-// `InfiniteDuration()` is used in place of a "nan" Duration.
-//
-// Examples:
-//
-//   constexpr absl::Duration inf = absl::InfiniteDuration();
-//   const absl::Duration d = ... any finite duration ...
-//
-//   inf == inf + inf
-//   inf == inf + d
-//   inf == inf - inf
-//   -inf == d - inf
-//
-//   inf == d * 1e100
-//   inf == inf / 2
-//   0 == d / inf
-//   INT64_MAX == inf / d
-//
-//   // Division by zero returns infinity, or INT64_MIN/MAX where appropriate.
-//   inf == d / 0
-//   INT64_MAX == d / absl::ZeroDuration()
-//
-// The examples involving the `/` operator above also apply to `IDivDuration()`
-// and `FDivDuration()`.
-constexpr Duration InfiniteDuration();
-
 // FormatDuration()
 //
-// Returns a std::string representing the duration in the form "72h3m0.5s".
+// Returns a string representing the duration in the form "72h3m0.5s".
 // Returns "inf" or "-inf" for +/- `InfiniteDuration()`.
 std::string FormatDuration(Duration d);
 
@@ -477,22 +533,16 @@ inline std::ostream& operator<<(std::ostream& os, Duration d) {
 
 // ParseDuration()
 //
-// Parses a duration std::string consisting of a possibly signed sequence of
+// Parses a duration string consisting of a possibly signed sequence of
 // decimal numbers, each with an optional fractional part and a unit
 // suffix.  The valid suffixes are "ns", "us" "ms", "s", "m", and "h".
 // Simple examples include "300ms", "-1.5h", and "2h45m".  Parses "0" as
-// `ZeroDuration()`.  Parses "inf" and "-inf" as +/- `InfiniteDuration()`.
+// `ZeroDuration()`. Parses "inf" and "-inf" as +/- `InfiniteDuration()`.
 bool ParseDuration(const std::string& dur_string, Duration* d);
 
-// Flag Support
-// TODO(absl-team): Remove once dependencies are removed.
-
-// ParseFlag()
-//
+// Support for flag values of type Duration. Duration flags must be specified
+// in a format that is valid input for absl::ParseDuration().
 bool ParseFlag(const std::string& text, Duration* dst, std::string* error);
-
-// UnparseFlag()
-//
 std::string UnparseFlag(Duration d);
 
 // Time
@@ -506,9 +556,7 @@ std::string UnparseFlag(Duration d);
 //
 // `absl::Time` assumes there are 60 seconds in a minute, which means the
 // underlying time scales must be "smeared" to eliminate leap seconds.
-// POSIX, for example, legislates that a `time_t` value of `536457599` shall
-// correspond to "1986-12-31 23:59:59 +0000".
-//
+// See https://developers.google.com/time/smear.
 //
 // Even though `absl::Time` supports a wide range of timestamps, exercise
 // caution when using values in the distant past. `absl::Time` uses the
@@ -527,10 +575,9 @@ std::string UnparseFlag(Duration d);
 // The `absl::Time` class represents an instant in time as a count of clock
 // ticks of some granularity (resolution) from some starting point (epoch).
 //
-//
 // `absl::Time` uses a resolution that is high enough to avoid loss in
 // precision, and a range that is wide enough to avoid overflow, when
-// converting between tick counts in most Google time scales (i.e., precision
+// converting between tick counts in most Google time scales (i.e., resolution
 // of at least one nanosecond, and range +/-100 billion years).  Conversions
 // between the time scales are performed by truncating (towards negative
 // infinity) to the nearest representable point.
@@ -540,7 +587,6 @@ std::string UnparseFlag(Duration d);
 //   absl::Time t1 = ...;
 //   absl::Time t2 = t1 + absl::Minutes(2);
 //   absl::Duration d = t2 - t1;  // == absl::Minutes(2)
-//   absl::Time::Breakdown bd = t1.In(absl::LocalTimeZone());
 //
 class Time {
  public:
@@ -555,7 +601,11 @@ class Time {
   //   absl::Time t = absl::Now();
   //   absl::Time t = absl::TimeFromTimeval(tv);
   //   absl::Time t = absl::InfinitePast();
-  constexpr Time() {}
+  constexpr Time() = default;
+
+  // Copyable.
+  constexpr Time(const Time& t) = default;
+  Time& operator=(const Time& t) = default;
 
   // Assignment operators.
   Time& operator+=(Duration d) {
@@ -574,7 +624,10 @@ class Time {
   // intended to represent an instant in time. So, rather than passing
   // a `Time::Breakdown` to a function, pass an `absl::Time` and an
   // `absl::TimeZone`.
-  struct Breakdown {
+  //
+  // Deprecated. Use `absl::TimeZone::CivilInfo`.
+  struct
+      Breakdown {
     int64_t year;          // year (e.g., 2013)
     int month;           // month of year [1:12]
     int day;             // day of month [1:31]
@@ -598,8 +651,15 @@ class Time {
   // Time::In()
   //
   // Returns the breakdown of this instant in the given TimeZone.
+  //
+  // Deprecated. Use `absl::TimeZone::At(Time)`.
   Breakdown In(TimeZone tz) const;
 
+  template <typename H>
+  friend H AbslHashValue(H h, Time t) {
+    return H::combine(std::move(h), t.rep_);
+  }
+
  private:
   friend constexpr Time time_internal::FromUnixDuration(Duration d);
   friend constexpr Duration time_internal::ToUnixDuration(Time t);
@@ -647,7 +707,7 @@ constexpr Time UniversalEpoch() {
 // Returns an `absl::Time` that is infinitely far in the future.
 constexpr Time InfiniteFuture() {
   return Time(
-      time_internal::MakeDuration(std::numeric_limits<int64_t>::max(), ~0U));
+      time_internal::MakeDuration((std::numeric_limits<int64_t>::max)(), ~0U));
 }
 
 // InfinitePast()
@@ -655,125 +715,9 @@ constexpr Time InfiniteFuture() {
 // Returns an `absl::Time` that is infinitely far in the past.
 constexpr Time InfinitePast() {
   return Time(
-      time_internal::MakeDuration(std::numeric_limits<int64_t>::min(), ~0U));
+      time_internal::MakeDuration((std::numeric_limits<int64_t>::min)(), ~0U));
 }
 
-// TimeConversion
-//
-// An `absl::TimeConversion` represents the conversion of year, month, day,
-// hour, minute, and second values (i.e., a civil time), in a particular
-// `absl::TimeZone`, to a time instant (an absolute time), as returned by
-// `absl::ConvertDateTime()`. (Subseconds must be handled separately.)
-//
-// It is possible, though, for a caller to try to convert values that
-// do not represent an actual or unique instant in time (due to a shift
-// in UTC offset in the `absl::TimeZone`, which results in a discontinuity in
-// the civil-time components). For example, a daylight-saving-time
-// transition skips or repeats civil times---in the United States, March
-// 13, 2011 02:15 never occurred, while November 6, 2011 01:15 occurred
-// twice---so requests for such times are not well-defined.
-//
-// To account for these possibilities, `absl::TimeConversion` is richer
-// than just a single `absl::Time`. When the civil time is skipped or
-// repeated, `absl::ConvertDateTime()` returns times calculated using the
-// pre-transition and post-transition UTC offsets, plus the transition
-// time itself.
-//
-// Examples:
-//
-//   absl::TimeZone lax;
-//   if (!absl::LoadTimeZone("America/Los_Angeles", &lax)) { ... }
-//
-//   // A unique civil time
-//   absl::TimeConversion jan01 =
-//       absl::ConvertDateTime(2011, 1, 1, 0, 0, 0, lax);
-//   // jan01.kind == TimeConversion::UNIQUE
-//   // jan01.pre    is 2011/01/01 00:00:00 -0800
-//   // jan01.trans  is 2011/01/01 00:00:00 -0800
-//   // jan01.post   is 2011/01/01 00:00:00 -0800
-//
-//   // A Spring DST transition, when there is a gap in civil time
-//   absl::TimeConversion mar13 =
-//       absl::ConvertDateTime(2011, 3, 13, 2, 15, 0, lax);
-//   // mar13.kind == TimeConversion::SKIPPED
-//   // mar13.pre   is 2011/03/13 03:15:00 -0700
-//   // mar13.trans is 2011/03/13 03:00:00 -0700
-//   // mar13.post  is 2011/03/13 01:15:00 -0800
-//
-//   // A Fall DST transition, when civil times are repeated
-//   absl::TimeConversion nov06 =
-//       absl::ConvertDateTime(2011, 11, 6, 1, 15, 0, lax);
-//   // nov06.kind == TimeConversion::REPEATED
-//   // nov06.pre   is 2011/11/06 01:15:00 -0700
-//   // nov06.trans is 2011/11/06 01:00:00 -0800
-//   // nov06.post  is 2011/11/06 01:15:00 -0800
-//
-// The input month, day, hour, minute, and second values can also be
-// outside of their valid ranges, in which case they will be "normalized"
-// during the conversion.
-//
-// Example:
-//
-//   // "October 32" normalizes to "November 1".
-//   absl::TimeZone tz = absl::LocalTimeZone();
-//   absl::TimeConversion tc =
-//       absl::ConvertDateTime(2013, 10, 32, 8, 30, 0, tz);
-//   // tc.kind == TimeConversion::UNIQUE && tc.normalized == true
-//   // tc.pre.In(tz).month == 11 && tc.pre.In(tz).day == 1
-struct TimeConversion {
-  Time pre;    // time calculated using the pre-transition offset
-  Time trans;  // when the civil-time discontinuity occurred
-  Time post;   // time calculated using the post-transition offset
-
-  enum Kind {
-    UNIQUE,    // the civil time was singular (pre == trans == post)
-    SKIPPED,   // the civil time did not exist
-    REPEATED,  // the civil time was ambiguous
-  };
-  Kind kind;
-
-  bool normalized;  // input values were outside their valid ranges
-};
-
-// ConvertDateTime()
-//
-// The full generality of a civil time to absl::Time conversion.
-TimeConversion ConvertDateTime(int64_t year, int mon, int day, int hour,
-                               int min, int sec, TimeZone tz);
-
-// FromDateTime()
-//
-// A convenience wrapper for `absl::ConvertDateTime()` that simply returns the
-// "pre" `absl::Time`.  That is, the unique result, or the instant that
-// is correct using the pre-transition offset (as if the transition
-// never happened). This is typically the answer that humans expected when
-// faced with non-unique times, such as near daylight-saving time transitions.
-//
-// Example:
-//
-//   absl::TimeZone seattle;
-//   if (!absl::LoadTimeZone("America/Los_Angeles", &seattle)) { ... }
-//   absl::Time t =  absl::FromDateTime(2017, 9, 26, 9, 30, 0, seattle);
-Time FromDateTime(int64_t year, int mon, int day, int hour, int min, int sec,
-                  TimeZone tz);
-
-// FromTM()
-//
-// Converts the `tm_year`, `tm_mon`, `tm_mday`, `tm_hour`, `tm_min`, and
-// `tm_sec` fields to an `absl::Time` using the given time zone. See ctime(3)
-// for a description of the expected values of the tm fields. IFF the indicated
-// time instant is not unique (see `absl::ConvertDateTime()` above), the
-// `tm_isdst` field is consulted to select the desired instant (`tm_isdst` > 0
-// means DST, `tm_isdst` == 0 means no DST, `tm_isdst` < 0 means use the default
-// like `absl::FromDateTime()`).
-Time FromTM(const struct tm& tm, TimeZone tz);
-
-// ToTM()
-//
-// Converts the given `absl::Time` to a struct tm using the given time zone.
-// See ctime(3) for a description of the values of the tm fields.
-struct tm ToTM(Time t, TimeZone tz);
-
 // FromUnixNanos()
 // FromUnixMicros()
 // FromUnixMillis()
@@ -856,7 +800,383 @@ Time FromChrono(const std::chrono::system_clock::time_point& tp);
 //   absl::Time t = absl::FromTimeT(123);
 //   auto tp = absl::ToChronoTime(t);
 //   // tp == std::chrono::system_clock::from_time_t(123);
-std::chrono::system_clock::time_point ToChronoTime(absl::Time);
+std::chrono::system_clock::time_point ToChronoTime(Time);
+
+// Support for flag values of type Time. Time flags must be specified in a
+// format that matches absl::RFC3339_full. For example:
+//
+//   --start_time=2016-01-02T03:04:05.678+08:00
+//
+// Note: A UTC offset (or 'Z' indicating a zero-offset from UTC) is required.
+//
+// Additionally, if you'd like to specify a time as a count of
+// seconds/milliseconds/etc from the Unix epoch, use an absl::Duration flag
+// and add that duration to absl::UnixEpoch() to get an absl::Time.
+bool ParseFlag(const std::string& text, Time* t, std::string* error);
+std::string UnparseFlag(Time t);
+
+// TimeZone
+//
+// The `absl::TimeZone` is an opaque, small, value-type class representing a
+// geo-political region within which particular rules are used for converting
+// between absolute and civil times (see https://git.io/v59Ly). `absl::TimeZone`
+// values are named using the TZ identifiers from the IANA Time Zone Database,
+// such as "America/Los_Angeles" or "Australia/Sydney". `absl::TimeZone` values
+// are created from factory functions such as `absl::LoadTimeZone()`. Note:
+// strings like "PST" and "EDT" are not valid TZ identifiers. Prefer to pass by
+// value rather than const reference.
+//
+// For more on the fundamental concepts of time zones, absolute times, and civil
+// times, see https://github.com/google/cctz#fundamental-concepts
+//
+// Examples:
+//
+//   absl::TimeZone utc = absl::UTCTimeZone();
+//   absl::TimeZone pst = absl::FixedTimeZone(-8 * 60 * 60);
+//   absl::TimeZone loc = absl::LocalTimeZone();
+//   absl::TimeZone lax;
+//   if (!absl::LoadTimeZone("America/Los_Angeles", &lax)) {
+//     // handle error case
+//   }
+//
+// See also:
+// - https://github.com/google/cctz
+// - https://www.iana.org/time-zones
+// - https://en.wikipedia.org/wiki/Zoneinfo
+class TimeZone {
+ public:
+  explicit TimeZone(time_internal::cctz::time_zone tz) : cz_(tz) {}
+  TimeZone() = default;  // UTC, but prefer UTCTimeZone() to be explicit.
+
+  // Copyable.
+  TimeZone(const TimeZone&) = default;
+  TimeZone& operator=(const TimeZone&) = default;
+
+  explicit operator time_internal::cctz::time_zone() const { return cz_; }
+
+  std::string name() const { return cz_.name(); }
+
+  // TimeZone::CivilInfo
+  //
+  // Information about the civil time corresponding to an absolute time.
+  // This struct is not intended to represent an instant in time. So, rather
+  // than passing a `TimeZone::CivilInfo` to a function, pass an `absl::Time`
+  // and an `absl::TimeZone`.
+  struct CivilInfo {
+    CivilSecond cs;
+    Duration subsecond;
+
+    // Note: The following fields exist for backward compatibility
+    // with older APIs.  Accessing these fields directly is a sign of
+    // imprudent logic in the calling code.  Modern time-related code
+    // should only access this data indirectly by way of FormatTime().
+    // These fields are undefined for InfiniteFuture() and InfinitePast().
+    int offset;             // seconds east of UTC
+    bool is_dst;            // is offset non-standard?
+    const char* zone_abbr;  // time-zone abbreviation (e.g., "PST")
+  };
+
+  // TimeZone::At(Time)
+  //
+  // Returns the civil time for this TimeZone at a certain `absl::Time`.
+  // If the input time is infinite, the output civil second will be set to
+  // CivilSecond::max() or min(), and the subsecond will be infinite.
+  //
+  // Example:
+  //
+  //   const auto epoch = lax.At(absl::UnixEpoch());
+  //   // epoch.cs == 1969-12-31 16:00:00
+  //   // epoch.subsecond == absl::ZeroDuration()
+  //   // epoch.offset == -28800
+  //   // epoch.is_dst == false
+  //   // epoch.abbr == "PST"
+  CivilInfo At(Time t) const;
+
+  // TimeZone::TimeInfo
+  //
+  // Information about the absolute times corresponding to a civil time.
+  // (Subseconds must be handled separately.)
+  //
+  // It is possible for a caller to pass a civil-time value that does
+  // not represent an actual or unique instant in time (due to a shift
+  // in UTC offset in the TimeZone, which results in a discontinuity in
+  // the civil-time components). For example, a daylight-saving-time
+  // transition skips or repeats civil times---in the United States,
+  // March 13, 2011 02:15 never occurred, while November 6, 2011 01:15
+  // occurred twice---so requests for such times are not well-defined.
+  // To account for these possibilities, `absl::TimeZone::TimeInfo` is
+  // richer than just a single `absl::Time`.
+  struct TimeInfo {
+    enum CivilKind {
+      UNIQUE,    // the civil time was singular (pre == trans == post)
+      SKIPPED,   // the civil time did not exist (pre >= trans > post)
+      REPEATED,  // the civil time was ambiguous (pre < trans <= post)
+    } kind;
+    Time pre;    // time calculated using the pre-transition offset
+    Time trans;  // when the civil-time discontinuity occurred
+    Time post;   // time calculated using the post-transition offset
+  };
+
+  // TimeZone::At(CivilSecond)
+  //
+  // Returns an `absl::TimeInfo` containing the absolute time(s) for this
+  // TimeZone at an `absl::CivilSecond`. When the civil time is skipped or
+  // repeated, returns times calculated using the pre-transition and post-
+  // transition UTC offsets, plus the transition time itself.
+  //
+  // Examples:
+  //
+  //   // A unique civil time
+  //   const auto jan01 = lax.At(absl::CivilSecond(2011, 1, 1, 0, 0, 0));
+  //   // jan01.kind == TimeZone::TimeInfo::UNIQUE
+  //   // jan01.pre    is 2011-01-01 00:00:00 -0800
+  //   // jan01.trans  is 2011-01-01 00:00:00 -0800
+  //   // jan01.post   is 2011-01-01 00:00:00 -0800
+  //
+  //   // A Spring DST transition, when there is a gap in civil time
+  //   const auto mar13 = lax.At(absl::CivilSecond(2011, 3, 13, 2, 15, 0));
+  //   // mar13.kind == TimeZone::TimeInfo::SKIPPED
+  //   // mar13.pre   is 2011-03-13 03:15:00 -0700
+  //   // mar13.trans is 2011-03-13 03:00:00 -0700
+  //   // mar13.post  is 2011-03-13 01:15:00 -0800
+  //
+  //   // A Fall DST transition, when civil times are repeated
+  //   const auto nov06 = lax.At(absl::CivilSecond(2011, 11, 6, 1, 15, 0));
+  //   // nov06.kind == TimeZone::TimeInfo::REPEATED
+  //   // nov06.pre   is 2011-11-06 01:15:00 -0700
+  //   // nov06.trans is 2011-11-06 01:00:00 -0800
+  //   // nov06.post  is 2011-11-06 01:15:00 -0800
+  TimeInfo At(CivilSecond ct) const;
+
+  // TimeZone::NextTransition()
+  // TimeZone::PrevTransition()
+  //
+  // Finds the time of the next/previous offset change in this time zone.
+  //
+  // By definition, `NextTransition(t, &trans)` returns false when `t` is
+  // `InfiniteFuture()`, and `PrevTransition(t, &trans)` returns false
+  // when `t` is `InfinitePast()`. If the zone has no transitions, the
+  // result will also be false no matter what the argument.
+  //
+  // Otherwise, when `t` is `InfinitePast()`, `NextTransition(t, &trans)`
+  // returns true and sets `trans` to the first recorded transition. Chains
+  // of calls to `NextTransition()/PrevTransition()` will eventually return
+  // false, but it is unspecified exactly when `NextTransition(t, &trans)`
+  // jumps to false, or what time is set by `PrevTransition(t, &trans)` for
+  // a very distant `t`.
+  //
+  // Note: Enumeration of time-zone transitions is for informational purposes
+  // only. Modern time-related code should not care about when offset changes
+  // occur.
+  //
+  // Example:
+  //   absl::TimeZone nyc;
+  //   if (!absl::LoadTimeZone("America/New_York", &nyc)) { ... }
+  //   const auto now = absl::Now();
+  //   auto t = absl::InfinitePast();
+  //   absl::TimeZone::CivilTransition trans;
+  //   while (t <= now && nyc.NextTransition(t, &trans)) {
+  //     // transition: trans.from -> trans.to
+  //     t = nyc.At(trans.to).trans;
+  //   }
+  struct CivilTransition {
+    CivilSecond from;  // the civil time we jump from
+    CivilSecond to;    // the civil time we jump to
+  };
+  bool NextTransition(Time t, CivilTransition* trans) const;
+  bool PrevTransition(Time t, CivilTransition* trans) const;
+
+  template <typename H>
+  friend H AbslHashValue(H h, TimeZone tz) {
+    return H::combine(std::move(h), tz.cz_);
+  }
+
+ private:
+  friend bool operator==(TimeZone a, TimeZone b) { return a.cz_ == b.cz_; }
+  friend bool operator!=(TimeZone a, TimeZone b) { return a.cz_ != b.cz_; }
+  friend std::ostream& operator<<(std::ostream& os, TimeZone tz) {
+    return os << tz.name();
+  }
+
+  time_internal::cctz::time_zone cz_;
+};
+
+// LoadTimeZone()
+//
+// Loads the named zone. May perform I/O on the initial load of the named
+// zone. If the name is invalid, or some other kind of error occurs, returns
+// `false` and `*tz` is set to the UTC time zone.
+inline bool LoadTimeZone(const std::string& name, TimeZone* tz) {
+  if (name == "localtime") {
+    *tz = TimeZone(time_internal::cctz::local_time_zone());
+    return true;
+  }
+  time_internal::cctz::time_zone cz;
+  const bool b = time_internal::cctz::load_time_zone(name, &cz);
+  *tz = TimeZone(cz);
+  return b;
+}
+
+// FixedTimeZone()
+//
+// Returns a TimeZone that is a fixed offset (seconds east) from UTC.
+// Note: If the absolute value of the offset is greater than 24 hours
+// you'll get UTC (i.e., no offset) instead.
+inline TimeZone FixedTimeZone(int seconds) {
+  return TimeZone(
+      time_internal::cctz::fixed_time_zone(std::chrono::seconds(seconds)));
+}
+
+// UTCTimeZone()
+//
+// Convenience method returning the UTC time zone.
+inline TimeZone UTCTimeZone() {
+  return TimeZone(time_internal::cctz::utc_time_zone());
+}
+
+// LocalTimeZone()
+//
+// Convenience method returning the local time zone, or UTC if there is
+// no configured local zone.  Warning: Be wary of using LocalTimeZone(),
+// and particularly so in a server process, as the zone configured for the
+// local machine should be irrelevant.  Prefer an explicit zone name.
+inline TimeZone LocalTimeZone() {
+  return TimeZone(time_internal::cctz::local_time_zone());
+}
+
+// ToCivilSecond()
+// ToCivilMinute()
+// ToCivilHour()
+// ToCivilDay()
+// ToCivilMonth()
+// ToCivilYear()
+//
+// Helpers for TimeZone::At(Time) to return particularly aligned civil times.
+//
+// Example:
+//
+//   absl::Time t = ...;
+//   absl::TimeZone tz = ...;
+//   const auto cd = absl::ToCivilDay(t, tz);
+inline CivilSecond ToCivilSecond(Time t, TimeZone tz) {
+  return tz.At(t).cs;  // already a CivilSecond
+}
+inline CivilMinute ToCivilMinute(Time t, TimeZone tz) {
+  return CivilMinute(tz.At(t).cs);
+}
+inline CivilHour ToCivilHour(Time t, TimeZone tz) {
+  return CivilHour(tz.At(t).cs);
+}
+inline CivilDay ToCivilDay(Time t, TimeZone tz) {
+  return CivilDay(tz.At(t).cs);
+}
+inline CivilMonth ToCivilMonth(Time t, TimeZone tz) {
+  return CivilMonth(tz.At(t).cs);
+}
+inline CivilYear ToCivilYear(Time t, TimeZone tz) {
+  return CivilYear(tz.At(t).cs);
+}
+
+// FromCivil()
+//
+// Helper for TimeZone::At(CivilSecond) that provides "order-preserving
+// semantics." If the civil time maps to a unique time, that time is
+// returned. If the civil time is repeated in the given time zone, the
+// time using the pre-transition offset is returned. Otherwise, the
+// civil time is skipped in the given time zone, and the transition time
+// is returned. This means that for any two civil times, ct1 and ct2,
+// (ct1 < ct2) => (FromCivil(ct1) <= FromCivil(ct2)), the equal case
+// being when two non-existent civil times map to the same transition time.
+//
+// Note: Accepts civil times of any alignment.
+inline Time FromCivil(CivilSecond ct, TimeZone tz) {
+  const auto ti = tz.At(ct);
+  if (ti.kind == TimeZone::TimeInfo::SKIPPED) return ti.trans;
+  return ti.pre;
+}
+
+// TimeConversion
+//
+// An `absl::TimeConversion` represents the conversion of year, month, day,
+// hour, minute, and second values (i.e., a civil time), in a particular
+// `absl::TimeZone`, to a time instant (an absolute time), as returned by
+// `absl::ConvertDateTime()`. Lecacy version of `absl::TimeZone::TimeInfo`.
+//
+// Deprecated. Use `absl::TimeZone::TimeInfo`.
+struct
+    TimeConversion {
+  Time pre;    // time calculated using the pre-transition offset
+  Time trans;  // when the civil-time discontinuity occurred
+  Time post;   // time calculated using the post-transition offset
+
+  enum Kind {
+    UNIQUE,    // the civil time was singular (pre == trans == post)
+    SKIPPED,   // the civil time did not exist
+    REPEATED,  // the civil time was ambiguous
+  };
+  Kind kind;
+
+  bool normalized;  // input values were outside their valid ranges
+};
+
+// ConvertDateTime()
+//
+// Legacy version of `absl::TimeZone::At(absl::CivilSecond)` that takes
+// the civil time as six, separate values (YMDHMS).
+//
+// The input month, day, hour, minute, and second values can be outside
+// of their valid ranges, in which case they will be "normalized" during
+// the conversion.
+//
+// Example:
+//
+//   // "October 32" normalizes to "November 1".
+//   absl::TimeConversion tc =
+//       absl::ConvertDateTime(2013, 10, 32, 8, 30, 0, lax);
+//   // tc.kind == TimeConversion::UNIQUE && tc.normalized == true
+//   // absl::ToCivilDay(tc.pre, tz).month() == 11
+//   // absl::ToCivilDay(tc.pre, tz).day() == 1
+//
+// Deprecated. Use `absl::TimeZone::At(CivilSecond)`.
+TimeConversion ConvertDateTime(int64_t year, int mon, int day, int hour,
+                               int min, int sec, TimeZone tz);
+
+// FromDateTime()
+//
+// A convenience wrapper for `absl::ConvertDateTime()` that simply returns
+// the "pre" `absl::Time`.  That is, the unique result, or the instant that
+// is correct using the pre-transition offset (as if the transition never
+// happened).
+//
+// Example:
+//
+//   absl::Time t = absl::FromDateTime(2017, 9, 26, 9, 30, 0, lax);
+//   // t = 2017-09-26 09:30:00 -0700
+//
+// Deprecated. Use `absl::FromCivil(CivilSecond, TimeZone)`. Note that the
+// behavior of `FromCivil()` differs from `FromDateTime()` for skipped civil
+// times. If you care about that see `absl::TimeZone::At(absl::CivilSecond)`.
+inline Time FromDateTime(int64_t year, int mon, int day, int hour,
+                         int min, int sec, TimeZone tz) {
+  return ConvertDateTime(year, mon, day, hour, min, sec, tz).pre;
+}
+
+// FromTM()
+//
+// Converts the `tm_year`, `tm_mon`, `tm_mday`, `tm_hour`, `tm_min`, and
+// `tm_sec` fields to an `absl::Time` using the given time zone. See ctime(3)
+// for a description of the expected values of the tm fields. If the indicated
+// time instant is not unique (see `absl::TimeZone::At(absl::CivilSecond)`
+// above), the `tm_isdst` field is consulted to select the desired instant
+// (`tm_isdst` > 0 means DST, `tm_isdst` == 0 means no DST, `tm_isdst` < 0
+// means use the post-transition offset).
+Time FromTM(const struct tm& tm, TimeZone tz);
+
+// ToTM()
+//
+// Converts the given `absl::Time` to a struct tm using the given time zone.
+// See ctime(3) for a description of the values of the tm fields.
+struct tm ToTM(Time t, TimeZone tz);
 
 // RFC3339_full
 // RFC3339_sec
@@ -864,8 +1184,10 @@ std::chrono::system_clock::time_point ToChronoTime(absl::Time);
 // FormatTime()/ParseTime() format specifiers for RFC3339 date/time strings,
 // with trailing zeros trimmed or with fractional seconds omitted altogether.
 //
-// Note that RFC3339_sec[] matches an ISO 8601 extended format for date
-// and time with UTC offset.
+// Note that RFC3339_sec[] matches an ISO 8601 extended format for date and
+// time with UTC offset.  Also note the use of "%Y": RFC3339 mandates that
+// years have exactly four digits, but we allow them to take their natural
+// width.
 extern const char RFC3339_full[];  // %Y-%m-%dT%H:%M:%E*S%Ez
 extern const char RFC3339_sec[];   // %Y-%m-%dT%H:%M:%S%Ez
 
@@ -879,10 +1201,11 @@ extern const char RFC1123_no_wday[];  // %d %b %E4Y %H:%M:%S %z
 // FormatTime()
 //
 // Formats the given `absl::Time` in the `absl::TimeZone` according to the
-// provided format std::string. Uses strftime()-like formatting options, with
+// provided format string. Uses strftime()-like formatting options, with
 // the following extensions:
 //
-//   - %Ez  - RFC3339-compatible numeric time zone (+hh:mm or -hh:mm)
+//   - %Ez  - RFC3339-compatible numeric UTC offset (+hh:mm or -hh:mm)
+//   - %E*z - Full-resolution numeric UTC offset (+hh:mm:ss or -hh:mm:ss)
 //   - %E#S - Seconds with # digits of fractional precision
 //   - %E*S - Seconds with full fractional precision (a literal '*')
 //   - %E#f - Fractional seconds with # digits of precision
@@ -896,22 +1219,20 @@ extern const char RFC1123_no_wday[];  // %d %b %E4Y %H:%M:%S %z
 // year.  A year outside of [-999:9999] when formatted with %E4Y will produce
 // more than four characters, just like %Y.
 //
-// We recommend that format strings include %Ez so that the result uniquely
-// identifies a time instant.
+// We recommend that format strings include the UTC offset (%z, %Ez, or %E*z)
+// so that the result uniquely identifies a time instant.
 //
 // Example:
 //
-//   absl::TimeZone lax;
-//   if (!absl::LoadTimeZone("America/Los_Angeles", &lax)) { ... }
-//   absl::Time t = absl::FromDateTime(2013, 1, 2, 3, 4, 5, lax);
-//
+//   absl::CivilSecond cs(2013, 1, 2, 3, 4, 5);
+//   absl::Time t = absl::FromCivil(cs, lax);
 //   std::string f = absl::FormatTime("%H:%M:%S", t, lax);  // "03:04:05"
 //   f = absl::FormatTime("%H:%M:%E3S", t, lax);  // "03:04:05.000"
 //
 // Note: If the given `absl::Time` is `absl::InfiniteFuture()`, the returned
-// std::string will be exactly "infinite-future". If the given `absl::Time` is
-// `absl::InfinitePast()`, the returned std::string will be exactly "infinite-past".
-// In both cases the given format std::string and `absl::TimeZone` are ignored.
+// string will be exactly "infinite-future". If the given `absl::Time` is
+// `absl::InfinitePast()`, the returned string will be exactly "infinite-past".
+// In both cases the given format string and `absl::TimeZone` are ignored.
 //
 std::string FormatTime(const std::string& format, Time t, TimeZone tz);
 
@@ -928,10 +1249,11 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
 
 // ParseTime()
 //
-// Parses an input std::string according to the provided format std::string and
+// Parses an input string according to the provided format string and
 // returns the corresponding `absl::Time`. Uses strftime()-like formatting
 // options, with the same extensions as FormatTime(), but with the
-// exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f.
+// exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f.  %Ez
+// and %E*z also accept the same inputs.
 //
 // %Y consumes as many numeric characters as it can, so the matching data
 // should always be terminated with a non-numeric.  %E4Y always consumes
@@ -941,11 +1263,12 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
 //
 //   "1970-01-01 00:00:00.0 +0000"
 //
-// For example, parsing a std::string of "15:45" (%H:%M) will return an absl::Time
-// that represents "1970-01-01 15:45:00.0 +0000".  Note: Since ParseTime()
-// returns time instants, it makes the most sense to parse fully-specified
-// date/time strings that include a UTC offset (%z/%Ez), such as those
-// matching RFC3339_full above.
+// For example, parsing a string of "15:45" (%H:%M) will return an absl::Time
+// that represents "1970-01-01 15:45:00.0 +0000".
+//
+// Note that since ParseTime() returns time instants, it makes the most sense
+// to parse fully-specified date/time strings that include a UTC offset (%z,
+// %Ez, or %E*z).
 //
 // Note also that `absl::ParseTime()` only heeds the fields year, month, day,
 // hour, minute, (fractional) second, and UTC offset.  Other fields, like
@@ -953,7 +1276,7 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
 // in the conversion.
 //
 // Date and time fields that are out-of-range will be treated as errors
-// rather than normalizing them like `absl::FromDateTime()` does.  For example,
+// rather than normalizing them like `absl::CivilSecond` does.  For example,
 // it is an error to parse the date "Oct 32, 2013" because 32 is out of range.
 //
 // A leap second of ":60" is normalized to ":00" of the following minute
@@ -967,127 +1290,24 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
 // Errors are indicated by returning false and assigning an error message
 // to the "err" out param if it is non-null.
 //
-// Note: If the input std::string is exactly "infinite-future", the returned
+// Note: If the input string is exactly "infinite-future", the returned
 // `absl::Time` will be `absl::InfiniteFuture()` and `true` will be returned.
-// If the input std::string is "infinite-past", the returned `absl::Time` will be
+// If the input string is "infinite-past", the returned `absl::Time` will be
 // `absl::InfinitePast()` and `true` will be returned.
 //
 bool ParseTime(const std::string& format, const std::string& input, Time* time,
                std::string* err);
 
-// Like ParseTime() above, but if the format std::string does not contain a UTC
-// offset specification (%z/%Ez) then the input is interpreted in the given
-// TimeZone.  This means that the input, by itself, does not identify a
+// Like ParseTime() above, but if the format string does not contain a UTC
+// offset specification (%z/%Ez/%E*z) then the input is interpreted in the
+// given TimeZone.  This means that the input, by itself, does not identify a
 // unique instant.  Being time-zone dependent, it also admits the possibility
 // of ambiguity or non-existence, in which case the "pre" time (as defined
-// for ConvertDateTime()) is returned.  For these reasons we recommend that
+// by TimeZone::TimeInfo) is returned.  For these reasons we recommend that
 // all date/time strings include a UTC offset so they're context independent.
 bool ParseTime(const std::string& format, const std::string& input, TimeZone tz,
                Time* time, std::string* err);
 
-// TODO(absl-team): Remove once dependencies are removed.
-
-// ParseFlag()
-// UnparseFlag()
-//
-// Support for flag values of type Time. Time flags must be specified in a
-// format that matches absl::RFC3339_full. For example:
-//
-//   --start_time=2016-01-02T03:04:05.678+08:00
-//
-// Note: A UTC offset (or 'Z' indicating a zero-offset from UTC) is required.
-//
-// Additionally, if you'd like to specify a time as a count of
-// seconds/milliseconds/etc from the Unix epoch, use an absl::Duration flag
-// and add that duration to absl::UnixEpoch() to get an absl::Time.
-bool ParseFlag(const std::string& text, Time* t, std::string* error);
-std::string UnparseFlag(Time t);
-
-// TimeZone
-//
-// The `absl::TimeZone` is an opaque, small, value-type class representing a
-// geo-political region within which particular rules are used for converting
-// between absolute and civil times (see https://git.io/v59Ly). `absl::TimeZone`
-// values are named using the TZ identifiers from the IANA Time Zone Database,
-// such as "America/Los_Angeles" or "Australia/Sydney". `absl::TimeZone` values
-// are created from factory functions such as `absl::LoadTimeZone()`. Note:
-// strings like "PST" and "EDT" are not valid TZ identifiers. Prefer to pass by
-// value rather than const reference.
-//
-// For more on the fundamental concepts of time zones, absolute times, and civil
-// times, see https://github.com/google/cctz#fundamental-concepts
-//
-// Examples:
-//
-//   absl::TimeZone utc = absl::UTCTimeZone();
-//   absl::TimeZone pst = absl::FixedTimeZone(-8 * 60 * 60);
-//   absl::TimeZone loc = absl::LocalTimeZone();
-//   absl::TimeZone lax;
-//   if (!absl::LoadTimeZone("America/Los_Angeles", &lax)) { ... }
-//
-// See also:
-// - https://github.com/google/cctz
-// - http://www.iana.org/time-zones
-// - http://en.wikipedia.org/wiki/Zoneinfo
-class TimeZone {
- public:
-  explicit TimeZone(cctz::time_zone tz) : cz_(tz) {}
-  TimeZone() = default;  // UTC, but prefer UTCTimeZone() to be explicit.
-  TimeZone(const TimeZone&) = default;
-  TimeZone& operator=(const TimeZone&) = default;
-
-  explicit operator cctz::time_zone() const { return cz_; }
-
-  std::string name() const { return cz_.name(); }
-
- private:
-  friend bool operator==(TimeZone a, TimeZone b) { return a.cz_ == b.cz_; }
-  friend bool operator!=(TimeZone a, TimeZone b) { return a.cz_ != b.cz_; }
-  friend std::ostream& operator<<(std::ostream& os, TimeZone tz) {
-    return os << tz.name();
-  }
-
-  cctz::time_zone cz_;
-};
-
-// LoadTimeZone()
-//
-// Loads the named zone. May perform I/O on the initial load of the named
-// zone. If the name is invalid, or some other kind of error occurs, returns
-// `false` and `*tz` is set to the UTC time zone.
-inline bool LoadTimeZone(const std::string& name, TimeZone* tz) {
-  if (name == "localtime") {
-    *tz = TimeZone(cctz::local_time_zone());
-    return true;
-  }
-  cctz::time_zone cz;
-  const bool b = cctz::load_time_zone(name, &cz);
-  *tz = TimeZone(cz);
-  return b;
-}
-
-// FixedTimeZone()
-//
-// Returns a TimeZone that is a fixed offset (seconds east) from UTC.
-// Note: If the absolute value of the offset is greater than 24 hours
-// you'll get UTC (i.e., no offset) instead.
-inline TimeZone FixedTimeZone(int seconds) {
-  return TimeZone(cctz::fixed_time_zone(std::chrono::seconds(seconds)));
-}
-
-// UTCTimeZone()
-//
-// Convenience method returning the UTC time zone.
-inline TimeZone UTCTimeZone() { return TimeZone(cctz::utc_time_zone()); }
-
-// LocalTimeZone()
-//
-// Convenience method returning the local time zone, or UTC if there is
-// no configured local zone.  Warning: Be wary of using LocalTimeZone(),
-// and particularly so in a server process, as the zone configured for the
-// local machine should be irrelevant.  Prefer an explicit zone name.
-inline TimeZone LocalTimeZone() { return TimeZone(cctz::local_time_zone()); }
-
 // ============================================================================
 // Implementation Details Follow
 // ============================================================================
@@ -1105,6 +1325,18 @@ constexpr Duration MakeDuration(int64_t hi, int64_t lo) {
   return MakeDuration(hi, static_cast<uint32_t>(lo));
 }
 
+// Make a Duration value from a floating-point number, as long as that number
+// is in the range [ 0 .. numeric_limits<int64_t>::max ), that is, as long as
+// it's positive and can be converted to int64_t without risk of UB.
+inline Duration MakePosDoubleDuration(double n) {
+  const int64_t int_secs = static_cast<int64_t>(n);
+  const uint32_t ticks =
+      static_cast<uint32_t>((n - int_secs) * kTicksPerSecond + 0.5);
+  return ticks < kTicksPerSecond
+             ? MakeDuration(int_secs, ticks)
+             : MakeDuration(int_secs + 1, ticks - kTicksPerSecond);
+}
+
 // Creates a normalized Duration from an almost-normalized (sec,ticks)
 // pair. sec may be positive or negative.  ticks must be in the range
 // -kTicksPerSecond < *ticks < kTicksPerSecond.  If ticks is negative it
@@ -1113,21 +1345,26 @@ constexpr Duration MakeNormalizedDuration(int64_t sec, int64_t ticks) {
   return (ticks < 0) ? MakeDuration(sec - 1, ticks + kTicksPerSecond)
                      : MakeDuration(sec, ticks);
 }
+
 // Provide access to the Duration representation.
 constexpr int64_t GetRepHi(Duration d) { return d.rep_hi_; }
 constexpr uint32_t GetRepLo(Duration d) { return d.rep_lo_; }
+
+// Returns true iff d is positive or negative infinity.
 constexpr bool IsInfiniteDuration(Duration d) { return GetRepLo(d) == ~0U; }
 
 // Returns an infinite Duration with the opposite sign.
 // REQUIRES: IsInfiniteDuration(d)
 constexpr Duration OppositeInfinity(Duration d) {
   return GetRepHi(d) < 0
-             ? MakeDuration(std::numeric_limits<int64_t>::max(), ~0U)
-             : MakeDuration(std::numeric_limits<int64_t>::min(), ~0U);
+             ? MakeDuration((std::numeric_limits<int64_t>::max)(), ~0U)
+             : MakeDuration((std::numeric_limits<int64_t>::min)(), ~0U);
 }
 
-// Returns (-n)-1 (equivalently -(n+1)) without overflowing on any input value.
+// Returns (-n)-1 (equivalently -(n+1)) without avoidable overflow.
 constexpr int64_t NegateAndSubtractOne(int64_t n) {
+  // Note: Good compilers will optimize this expression to ~n when using
+  // a two's-complement representation (which is required for int64_t).
   return (n < 0) ? -(n + 1) : (-n) - 1;
 }
 
@@ -1139,17 +1376,23 @@ constexpr Time FromUnixDuration(Duration d) { return Time(d); }
 constexpr Duration ToUnixDuration(Time t) { return t.rep_; }
 
 template <std::intmax_t N>
-constexpr absl::Duration FromInt64(int64_t v, std::ratio<1, N>) {
+constexpr Duration FromInt64(int64_t v, std::ratio<1, N>) {
   static_assert(0 < N && N <= 1000 * 1000 * 1000, "Unsupported ratio");
   // Subsecond ratios cannot overflow.
   return MakeNormalizedDuration(
       v / N, v % N * kTicksPerNanosecond * 1000 * 1000 * 1000 / N);
 }
-constexpr absl::Duration FromInt64(int64_t v, std::ratio<60>) {
-  return Minutes(v);
+constexpr Duration FromInt64(int64_t v, std::ratio<60>) {
+  return (v <= (std::numeric_limits<int64_t>::max)() / 60 &&
+          v >= (std::numeric_limits<int64_t>::min)() / 60)
+             ? MakeDuration(v * 60)
+             : v > 0 ? InfiniteDuration() : -InfiniteDuration();
 }
-constexpr absl::Duration FromInt64(int64_t v, std::ratio<3600>) {
-  return Hours(v);
+constexpr Duration FromInt64(int64_t v, std::ratio<3600>) {
+  return (v <= (std::numeric_limits<int64_t>::max)() / 3600 &&
+          v >= (std::numeric_limits<int64_t>::min)() / 3600)
+             ? MakeDuration(v * 3600)
+             : v > 0 ? InfiniteDuration() : -InfiniteDuration();
 }
 
 // IsValidRep64<T>(0) is true if the expression `int64_t{std::declval<T>()}` is
@@ -1166,58 +1409,77 @@ constexpr auto IsValidRep64(char) -> bool {
 
 // Converts a std::chrono::duration to an absl::Duration.
 template <typename Rep, typename Period>
-constexpr absl::Duration FromChrono(
-    const std::chrono::duration<Rep, Period>& d) {
+constexpr Duration FromChrono(const std::chrono::duration<Rep, Period>& d) {
   static_assert(IsValidRep64<Rep>(0), "duration::rep is invalid");
   return FromInt64(int64_t{d.count()}, Period{});
 }
 
 template <typename Ratio>
-int64_t ToInt64(absl::Duration d, Ratio) {
+int64_t ToInt64(Duration d, Ratio) {
   // Note: This may be used on MSVC, which may have a system_clock period of
   // std::ratio<1, 10 * 1000 * 1000>
   return ToInt64Seconds(d * Ratio::den / Ratio::num);
 }
 // Fastpath implementations for the 6 common duration units.
-inline int64_t ToInt64(absl::Duration d, std::nano) {
+inline int64_t ToInt64(Duration d, std::nano) {
   return ToInt64Nanoseconds(d);
 }
-inline int64_t ToInt64(absl::Duration d, std::micro) {
+inline int64_t ToInt64(Duration d, std::micro) {
   return ToInt64Microseconds(d);
 }
-inline int64_t ToInt64(absl::Duration d, std::milli) {
+inline int64_t ToInt64(Duration d, std::milli) {
   return ToInt64Milliseconds(d);
 }
-inline int64_t ToInt64(absl::Duration d, std::ratio<1>) {
+inline int64_t ToInt64(Duration d, std::ratio<1>) {
   return ToInt64Seconds(d);
 }
-inline int64_t ToInt64(absl::Duration d, std::ratio<60>) {
+inline int64_t ToInt64(Duration d, std::ratio<60>) {
   return ToInt64Minutes(d);
 }
-inline int64_t ToInt64(absl::Duration d, std::ratio<3600>) {
+inline int64_t ToInt64(Duration d, std::ratio<3600>) {
   return ToInt64Hours(d);
 }
 
 // Converts an absl::Duration to a chrono duration of type T.
 template <typename T>
-T ToChronoDuration(absl::Duration d) {
+T ToChronoDuration(Duration d) {
   using Rep = typename T::rep;
   using Period = typename T::period;
   static_assert(IsValidRep64<Rep>(0), "duration::rep is invalid");
   if (time_internal::IsInfiniteDuration(d))
-    return d < ZeroDuration() ? T::min() : T::max();
+    return d < ZeroDuration() ? (T::min)() : (T::max)();
   const auto v = ToInt64(d, Period{});
-  if (v > std::numeric_limits<Rep>::max()) return T::max();
-  if (v < std::numeric_limits<Rep>::min()) return T::min();
+  if (v > (std::numeric_limits<Rep>::max)()) return (T::max)();
+  if (v < (std::numeric_limits<Rep>::min)()) return (T::min)();
   return T{v};
 }
 
 }  // namespace time_internal
 
+constexpr Duration Nanoseconds(int64_t n) {
+  return time_internal::FromInt64(n, std::nano{});
+}
+constexpr Duration Microseconds(int64_t n) {
+  return time_internal::FromInt64(n, std::micro{});
+}
+constexpr Duration Milliseconds(int64_t n) {
+  return time_internal::FromInt64(n, std::milli{});
+}
+constexpr Duration Seconds(int64_t n) {
+  return time_internal::FromInt64(n, std::ratio<1>{});
+}
+constexpr Duration Minutes(int64_t n) {
+  return time_internal::FromInt64(n, std::ratio<60>{});
+}
+constexpr Duration Hours(int64_t n) {
+  return time_internal::FromInt64(n, std::ratio<3600>{});
+}
+
 constexpr bool operator<(Duration lhs, Duration rhs) {
   return time_internal::GetRepHi(lhs) != time_internal::GetRepHi(rhs)
              ? time_internal::GetRepHi(lhs) < time_internal::GetRepHi(rhs)
-             : time_internal::GetRepHi(lhs) == std::numeric_limits<int64_t>::min()
+             : time_internal::GetRepHi(lhs) ==
+                       (std::numeric_limits<int64_t>::min)()
                    ? time_internal::GetRepLo(lhs) + 1 <
                          time_internal::GetRepLo(rhs) + 1
                    : time_internal::GetRepLo(lhs) <
@@ -1232,68 +1494,32 @@ constexpr bool operator==(Duration lhs, Duration rhs) {
 constexpr Duration operator-(Duration d) {
   // This is a little interesting because of the special cases.
   //
-  // Infinities stay infinite, and just change direction.
+  // If rep_lo_ is zero, we have it easy; it's safe to negate rep_hi_, we're
+  // dealing with an integral number of seconds, and the only special case is
+  // the maximum negative finite duration, which can't be negated.
   //
-  // The maximum negative finite duration can't be negated (at least, not
-  // on a two's complement machine), so we return infinity for that case.
-  // Next we dispatch the case where rep_lo_ is zero, observing that it's
-  // safe to negate rep_hi_ in this case because it's not int64_t-min (or
-  // else we'd have handled it above, returning InfiniteDuration()).
+  // Infinities stay infinite, and just change direction.
   //
   // Finally we're in the case where rep_lo_ is non-zero, and we can borrow
   // a second's worth of ticks and avoid overflow (as negating int64_t-min + 1
   // is safe).
-  return time_internal::IsInfiniteDuration(d)
-             ? time_internal::OppositeInfinity(d)
-             : (time_internal::GetRepHi(d) ==
-                    std::numeric_limits<int64_t>::min() &&
-                time_internal::GetRepLo(d) == 0)
+  return time_internal::GetRepLo(d) == 0
+             ? time_internal::GetRepHi(d) ==
+                       (std::numeric_limits<int64_t>::min)()
                    ? InfiniteDuration()
-                   : (time_internal::GetRepLo(d) == 0)
-                         ? time_internal::MakeDuration(
-                               -time_internal::GetRepHi(d))
-                         : time_internal::MakeDuration(
-                               time_internal::NegateAndSubtractOne(
-                                   time_internal::GetRepHi(d)),
-                               time_internal::kTicksPerSecond -
-                                   time_internal::GetRepLo(d));
-}
-
-constexpr Duration Nanoseconds(int64_t n) {
-  return time_internal::MakeNormalizedDuration(
-      n / (1000 * 1000 * 1000),
-      n % (1000 * 1000 * 1000) * time_internal::kTicksPerNanosecond);
-}
-
-constexpr Duration Microseconds(int64_t n) {
-  return time_internal::MakeNormalizedDuration(
-      n / (1000 * 1000),
-      n % (1000 * 1000) * (1000 * time_internal::kTicksPerNanosecond));
-}
-
-constexpr Duration Milliseconds(int64_t n) {
-  return time_internal::MakeNormalizedDuration(
-      n / 1000, n % 1000 * (1000 * 1000 * time_internal::kTicksPerNanosecond));
-}
-
-constexpr Duration Seconds(int64_t n) { return time_internal::MakeDuration(n); }
-
-constexpr Duration Minutes(int64_t n) {
-  return (n <= std::numeric_limits<int64_t>::max() / 60 &&
-          n >= std::numeric_limits<int64_t>::min() / 60)
-             ? time_internal::MakeDuration(n * 60)
-             : n > 0 ? InfiniteDuration() : -InfiniteDuration();
-}
-
-constexpr Duration Hours(int64_t n) {
-  return (n <= std::numeric_limits<int64_t>::max() / 3600 &&
-          n >= std::numeric_limits<int64_t>::min() / 3600)
-             ? time_internal::MakeDuration(n * 3600)
-             : n > 0 ? InfiniteDuration() : -InfiniteDuration();
+                   : time_internal::MakeDuration(-time_internal::GetRepHi(d))
+             : time_internal::IsInfiniteDuration(d)
+                   ? time_internal::OppositeInfinity(d)
+                   : time_internal::MakeDuration(
+                         time_internal::NegateAndSubtractOne(
+                             time_internal::GetRepHi(d)),
+                         time_internal::kTicksPerSecond -
+                             time_internal::GetRepLo(d));
 }
 
 constexpr Duration InfiniteDuration() {
-  return time_internal::MakeDuration(std::numeric_limits<int64_t>::max(), ~0U);
+  return time_internal::MakeDuration((std::numeric_limits<int64_t>::max)(),
+                                     ~0U);
 }
 
 constexpr Duration FromChrono(const std::chrono::nanoseconds& d) {
index a51dea1..f3a3281 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -58,7 +58,7 @@
 
 #ifdef ABSL_HAVE_STD_ANY
 
-#include <any>
+#include <any>  // IWYU pragma: export
 
 namespace absl {
 using std::any;
@@ -94,23 +94,20 @@ namespace absl {
 
 namespace any_internal {
 
-// FastTypeId<Type>() evaluates at compile/link-time to a unique integer for the
-// passed in type. Their values are neither contiguous nor small, making them
-// unfit for using as an index into a vector, but a good match for keys into
-// maps or straight up comparisons.
-// Note that on 64-bit (unix) systems size_t is 64-bit while int is 32-bit and
-// the compiler will happily and quietly assign such a 64-bit value to a
-// 32-bit integer. While a client should never do that it SHOULD still be safe,
-// assuming the BSS segment doesn't span more than 4GiB.
+template <typename Type>
+struct TypeTag {
+  constexpr static char dummy_var = 0;
+};
+
+template <typename Type>
+constexpr char TypeTag<Type>::dummy_var;
+
+// FastTypeId<Type>() evaluates at compile/link-time to a unique pointer for the
+// passed in type. These are meant to be good match for keys into maps or
+// straight up comparisons.
 template<typename Type>
-inline size_t FastTypeId() {
-  static_assert(sizeof(char*) <= sizeof(size_t),
-                "ptr size too large for size_t");
-
-  // This static variable isn't actually used, only its address, so there are
-  // no concurrency issues.
-  static char dummy_var;
-  return reinterpret_cast<size_t>(&dummy_var);
+constexpr inline const void* FastTypeId() {
+  return &TypeTag<Type>::dummy_var;
 }
 
 }  // namespace any_internal
@@ -175,7 +172,9 @@ const ValueType* any_cast(const any* operand) noexcept;
 template <typename ValueType>
 ValueType* any_cast(any* operand) noexcept;
 
-// any
+// -----------------------------------------------------------------------------
+// absl::any
+// -----------------------------------------------------------------------------
 //
 // An `absl::any` object provides the facility to either store an instance of a
 // type, known as the "contained object", or no value. An `absl::any` is used to
@@ -194,13 +193,13 @@ ValueType* any_cast(any* operand) noexcept;
 //   auto c = absl::any(std::move(my_foo));  // Error, not copy-constructable
 //
 // Note that `absl::any` makes use of decayed types (`absl::decay_t` in this
-// context) to remove const-volative qualifiers (known as "cv qualifiers"),
+// context) to remove const-volatile qualifiers (known as "cv qualifiers"),
 // decay functions to function pointers, etc. We essentially "decay" a given
 // type into its essential type.
 //
-// `absl::any` makes use of decayed types when determing the basic type `T` of
+// `absl::any` makes use of decayed types when determining the basic type `T` of
 // the value to store in the any's contained object. In the documentation below,
-// we explcitly denote this by using the phrase "a decayed type of `T`".
+// we explicitly denote this by using the phrase "a decayed type of `T`".
 //
 // Example:
 //
@@ -307,7 +306,7 @@ class any {
   // object of type `VT` with the arguments `std::forward<Args>(args)...`, and
   // returning a reference to the new contained value.
   //
-  // Note: If an exception is thrown during the call to `VT`’s constructor,
+  // Note: If an exception is thrown during the call to `VT`'s constructor,
   // `*this` does not contain a value, and any previously contained value has
   // been destroyed.
   template <
@@ -325,10 +324,10 @@ class any {
   // Overload of `any::emplace()` to emplace a value within an `absl::any`
   // object by calling `any::reset()`, initializing the contained value as if
   // direct-non-list-initializing an object of type `VT` with the arguments
-  // `initilizer_list, std::forward<Args>(args)...`, and returning a reference
+  // `initializer_list, std::forward<Args>(args)...`, and returning a reference
   // to the new contained value.
   //
-  // Note: If an exception is thrown during the call to `VT`’s constructor,
+  // Note: If an exception is thrown during the call to `VT`'s constructor,
   // `*this` does not contain a value, and any previously contained value has
   // been destroyed. The function shall not participate in overload resolution
   // unless `is_copy_constructible_v<VT>` is `true` and
@@ -357,7 +356,7 @@ class any {
   // Swaps the passed value and the value of this `absl::any` object.
   void swap(any& other) noexcept { obj_.swap(other.obj_); }
 
-  // Observors
+  // Observers
 
   // any::has_value()
   //
@@ -376,13 +375,14 @@ class any {
     return typeid(void);
   }
 #endif  // ABSL_ANY_DETAIL_HAS_RTTI
+
  private:
   // Tagged type-erased abstraction for holding a cloneable object.
   class ObjInterface {
    public:
     virtual ~ObjInterface() = default;
     virtual std::unique_ptr<ObjInterface> Clone() const = 0;
-    virtual size_t type_id() const noexcept = 0;
+    virtual const void* ObjTypeId() const noexcept = 0;
 #if ABSL_ANY_DETAIL_HAS_RTTI
     virtual const std::type_info& Type() const noexcept = 0;
 #endif  // ABSL_ANY_DETAIL_HAS_RTTI
@@ -400,7 +400,7 @@ class any {
       return std::unique_ptr<ObjInterface>(new Obj(in_place, value));
     }
 
-    size_t type_id() const noexcept final { return IdForType<T>(); }
+    const void* ObjTypeId() const noexcept final { return IdForType<T>(); }
 
 #if ABSL_ANY_DETAIL_HAS_RTTI
     const std::type_info& Type() const noexcept final { return typeid(T); }
@@ -415,7 +415,7 @@ class any {
   }
 
   template <typename T>
-  static size_t IdForType() {
+  constexpr static const void* IdForType() {
     // Note: This type dance is to make the behavior consistent with typeid.
     using NormalizedType =
         typename std::remove_cv<typename std::remove_reference<T>::type>::type;
@@ -423,8 +423,8 @@ class any {
     return any_internal::FastTypeId<NormalizedType>();
   }
 
-  size_t GetObjTypeId() const {
-    return obj_ == nullptr ? any_internal::FastTypeId<void>() : obj_->type_id();
+  const void* GetObjTypeId() const {
+    return obj_ ? obj_->ObjTypeId() : any_internal::FastTypeId<void>();
   }
 
   // `absl::any` nonmember functions //
index 8ffbe4b..8d020ed 100644 (file)
@@ -1,39 +1,64 @@
-// Copyright 2017 The Abseil Authors.
+// Copyright 2018 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// bad_any_cast.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the `absl::bad_any_cast` type.
 
 #ifndef ABSL_TYPES_BAD_ANY_CAST_H_
 #define ABSL_TYPES_BAD_ANY_CAST_H_
 
 #include <typeinfo>
 
+#include "absl/base/config.h"
+
+#ifdef ABSL_HAVE_STD_ANY
+
+#include <any>
+
 namespace absl {
+using std::bad_any_cast;
+}  // namespace absl
 
-////////////////////////
-// [any.bad_any_cast] //
-////////////////////////
+#else  // ABSL_HAVE_STD_ANY
 
-// Objects of type bad_any_cast are thrown by a failed any_cast.
+namespace absl {
+
+// -----------------------------------------------------------------------------
+// bad_any_cast
+// -----------------------------------------------------------------------------
+//
+// An `absl::bad_any_cast` type is an exception type that is thrown when
+// failing to successfully cast the return value of an `absl::any` object.
+//
+// Example:
+//
+//   auto a = absl::any(65);
+//   absl::any_cast<int>(a);         // 65
+//   try {
+//     absl::any_cast<char>(a);
+//   } catch(const absl::bad_any_cast& e) {
+//     std::cout << "Bad any cast: " << e.what() << '\n';
+//   }
 class bad_any_cast : public std::bad_cast {
  public:
   ~bad_any_cast() override;
   const char* what() const noexcept override;
 };
 
-//////////////////////////////////////////////
-// Implementation-details beyond this point //
-//////////////////////////////////////////////
-
 namespace any_internal {
 
 [[noreturn]] void ThrowBadAnyCast();
@@ -41,4 +66,6 @@ namespace any_internal {
 }  // namespace any_internal
 }  // namespace absl
 
+#endif  // ABSL_HAVE_STD_ANY
+
 #endif  // ABSL_TYPES_BAD_ANY_CAST_H_
index c4c7444..add5c45 100644 (file)
@@ -1,24 +1,59 @@
-// Copyright 2017 The Abseil Authors.
+// Copyright 2018 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// bad_optional_access.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the `absl::bad_optional_access` type.
 
 #ifndef ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_
 #define ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_
 
 #include <stdexcept>
 
+#include "absl/base/config.h"
+
+#ifdef ABSL_HAVE_STD_OPTIONAL
+
+#include <optional>
+
+namespace absl {
+using std::bad_optional_access;
+}  // namespace absl
+
+#else  // ABSL_HAVE_STD_OPTIONAL
+
 namespace absl {
 
+// -----------------------------------------------------------------------------
+// bad_optional_access
+// -----------------------------------------------------------------------------
+//
+// An `absl::bad_optional_access` type is an exception type that is thrown when
+// attempting to access an `absl::optional` object that does not contain a
+// value.
+//
+// Example:
+//
+//   absl::optional<int> o;
+//
+//   try {
+//     int n = o.value();
+//   } catch(const absl::bad_optional_access& e) {
+//     std::cout << "Bad optional access: " << e.what() << '\n';
+//   }
 class bad_optional_access : public std::exception {
  public:
   bad_optional_access() = default;
@@ -34,4 +69,6 @@ namespace optional_internal {
 }  // namespace optional_internal
 }  // namespace absl
 
+#endif  // ABSL_HAVE_STD_OPTIONAL
+
 #endif  // ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/bad_variant_access.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/bad_variant_access.h
new file mode 100644 (file)
index 0000000..637db43
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// bad_variant_access.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the `absl::bad_variant_access` type.
+
+#ifndef ABSL_TYPES_BAD_VARIANT_ACCESS_H_
+#define ABSL_TYPES_BAD_VARIANT_ACCESS_H_
+
+#include <stdexcept>
+
+#include "absl/base/config.h"
+
+#ifdef ABSL_HAVE_STD_VARIANT
+
+#include <variant>
+
+namespace absl {
+using std::bad_variant_access;
+}  // namespace absl
+
+#else  // ABSL_HAVE_STD_VARIANT
+
+namespace absl {
+
+// -----------------------------------------------------------------------------
+// bad_variant_access
+// -----------------------------------------------------------------------------
+//
+// An `absl::bad_variant_access` type is an exception type that is thrown in
+// the following cases:
+//
+//   * Calling `absl::get(absl::variant) with an index or type that does not
+//     match the currently selected alternative type
+//   * Calling `absl::visit on an `absl::variant` that is in the
+//     `variant::valueless_by_exception` state.
+//
+// Example:
+//
+//   absl::variant<int, std::string> v;
+//   v = 1;
+//   try {
+//     absl::get<std::string>(v);
+//   } catch(const absl::bad_variant_access& e) {
+//     std::cout << "Bad variant access: " << e.what() << '\n';
+//   }
+class bad_variant_access : public std::exception {
+ public:
+  bad_variant_access() noexcept = default;
+  ~bad_variant_access() override;
+  const char* what() const noexcept override;
+};
+
+namespace variant_internal {
+
+[[noreturn]] void ThrowBadVariantAccess();
+[[noreturn]] void Rethrow();
+
+}  // namespace variant_internal
+}  // namespace absl
+
+#endif  // ABSL_HAVE_STD_VARIANT
+
+#endif  // ABSL_TYPES_BAD_VARIANT_ACCESS_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/compare.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/compare.h
new file mode 100644 (file)
index 0000000..50361d6
--- /dev/null
@@ -0,0 +1,508 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// compare.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines the `absl::weak_equality`, `absl::strong_equality`,
+// `absl::partial_ordering`, `absl::weak_ordering`, and `absl::strong_ordering`
+// types for storing the results of three way comparisons.
+//
+// Example:
+//   absl::weak_ordering compare(const std::string& a, const std::string& b);
+//
+// These are C++11 compatible versions of the C++20 corresponding types
+// (`std::weak_equality`, etc.) and are designed to be drop-in replacements
+// for code compliant with C++20.
+
+#ifndef ABSL_TYPES_COMPARE_H_
+#define ABSL_TYPES_COMPARE_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <cstdlib>
+#include <type_traits>
+
+#include "absl/base/attributes.h"
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+namespace compare_internal {
+
+using value_type = int8_t;
+
+template <typename T>
+struct Fail {
+  static_assert(sizeof(T) < 0, "Only literal `0` is allowed.");
+};
+
+// We need the NullPtrT template to avoid triggering the modernize-use-nullptr
+// ClangTidy warning in user code.
+template <typename NullPtrT = std::nullptr_t>
+struct OnlyLiteralZero {
+  constexpr OnlyLiteralZero(NullPtrT) noexcept {}  // NOLINT
+
+  // Fails compilation when `nullptr` or integral type arguments other than
+  // `int` are passed. This constructor doesn't accept `int` because literal `0`
+  // has type `int`. Literal `0` arguments will be implicitly converted to
+  // `std::nullptr_t` and accepted by the above constructor, while other `int`
+  // arguments will fail to be converted and cause compilation failure.
+  template <
+      typename T,
+      typename = typename std::enable_if<
+          std::is_same<T, std::nullptr_t>::value ||
+          (std::is_integral<T>::value && !std::is_same<T, int>::value)>::type,
+      typename = typename Fail<T>::type>
+  OnlyLiteralZero(T);  // NOLINT
+};
+
+enum class eq : value_type {
+  equal = 0,
+  equivalent = equal,
+  nonequal = 1,
+  nonequivalent = nonequal,
+};
+
+enum class ord : value_type { less = -1, greater = 1 };
+
+enum class ncmp : value_type { unordered = -127 };
+
+// These template base classes allow for defining the values of the constants
+// in the header file (for performance) without using inline variables (which
+// aren't available in C++11).
+template <typename T>
+struct weak_equality_base {
+  ABSL_CONST_INIT static const T equivalent;
+  ABSL_CONST_INIT static const T nonequivalent;
+};
+template <typename T>
+const T weak_equality_base<T>::equivalent(eq::equivalent);
+template <typename T>
+const T weak_equality_base<T>::nonequivalent(eq::nonequivalent);
+
+template <typename T>
+struct strong_equality_base {
+  ABSL_CONST_INIT static const T equal;
+  ABSL_CONST_INIT static const T nonequal;
+  ABSL_CONST_INIT static const T equivalent;
+  ABSL_CONST_INIT static const T nonequivalent;
+};
+template <typename T>
+const T strong_equality_base<T>::equal(eq::equal);
+template <typename T>
+const T strong_equality_base<T>::nonequal(eq::nonequal);
+template <typename T>
+const T strong_equality_base<T>::equivalent(eq::equivalent);
+template <typename T>
+const T strong_equality_base<T>::nonequivalent(eq::nonequivalent);
+
+template <typename T>
+struct partial_ordering_base {
+  ABSL_CONST_INIT static const T less;
+  ABSL_CONST_INIT static const T equivalent;
+  ABSL_CONST_INIT static const T greater;
+  ABSL_CONST_INIT static const T unordered;
+};
+template <typename T>
+const T partial_ordering_base<T>::less(ord::less);
+template <typename T>
+const T partial_ordering_base<T>::equivalent(eq::equivalent);
+template <typename T>
+const T partial_ordering_base<T>::greater(ord::greater);
+template <typename T>
+const T partial_ordering_base<T>::unordered(ncmp::unordered);
+
+template <typename T>
+struct weak_ordering_base {
+  ABSL_CONST_INIT static const T less;
+  ABSL_CONST_INIT static const T equivalent;
+  ABSL_CONST_INIT static const T greater;
+};
+template <typename T>
+const T weak_ordering_base<T>::less(ord::less);
+template <typename T>
+const T weak_ordering_base<T>::equivalent(eq::equivalent);
+template <typename T>
+const T weak_ordering_base<T>::greater(ord::greater);
+
+template <typename T>
+struct strong_ordering_base {
+  ABSL_CONST_INIT static const T less;
+  ABSL_CONST_INIT static const T equal;
+  ABSL_CONST_INIT static const T equivalent;
+  ABSL_CONST_INIT static const T greater;
+};
+template <typename T>
+const T strong_ordering_base<T>::less(ord::less);
+template <typename T>
+const T strong_ordering_base<T>::equal(eq::equal);
+template <typename T>
+const T strong_ordering_base<T>::equivalent(eq::equivalent);
+template <typename T>
+const T strong_ordering_base<T>::greater(ord::greater);
+
+}  // namespace compare_internal
+
+class weak_equality
+    : public compare_internal::weak_equality_base<weak_equality> {
+  explicit constexpr weak_equality(compare_internal::eq v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  friend struct compare_internal::weak_equality_base<weak_equality>;
+
+ public:
+  // Comparisons
+  friend constexpr bool operator==(
+      weak_equality v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ == 0;
+  }
+  friend constexpr bool operator!=(
+      weak_equality v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ != 0;
+  }
+  friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>,
+                                   weak_equality v) noexcept {
+    return 0 == v.value_;
+  }
+  friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>,
+                                   weak_equality v) noexcept {
+    return 0 != v.value_;
+  }
+
+ private:
+  compare_internal::value_type value_;
+};
+
+class strong_equality
+    : public compare_internal::strong_equality_base<strong_equality> {
+  explicit constexpr strong_equality(compare_internal::eq v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  friend struct compare_internal::strong_equality_base<strong_equality>;
+
+ public:
+  // Conversion
+  constexpr operator weak_equality() const noexcept {  // NOLINT
+    return value_ == 0 ? weak_equality::equivalent
+                       : weak_equality::nonequivalent;
+  }
+  // Comparisons
+  friend constexpr bool operator==(
+      strong_equality v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ == 0;
+  }
+  friend constexpr bool operator!=(
+      strong_equality v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ != 0;
+  }
+  friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>,
+                                   strong_equality v) noexcept {
+    return 0 == v.value_;
+  }
+  friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>,
+                                   strong_equality v) noexcept {
+    return 0 != v.value_;
+  }
+
+ private:
+  compare_internal::value_type value_;
+};
+
+class partial_ordering
+    : public compare_internal::partial_ordering_base<partial_ordering> {
+  explicit constexpr partial_ordering(compare_internal::eq v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  explicit constexpr partial_ordering(compare_internal::ord v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  explicit constexpr partial_ordering(compare_internal::ncmp v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  friend struct compare_internal::partial_ordering_base<partial_ordering>;
+
+  constexpr bool is_ordered() const noexcept {
+    return value_ !=
+           compare_internal::value_type(compare_internal::ncmp::unordered);
+  }
+
+ public:
+  // Conversion
+  constexpr operator weak_equality() const noexcept {  // NOLINT
+    return value_ == 0 ? weak_equality::equivalent
+                       : weak_equality::nonequivalent;
+  }
+  // Comparisons
+  friend constexpr bool operator==(
+      partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.is_ordered() && v.value_ == 0;
+  }
+  friend constexpr bool operator!=(
+      partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return !v.is_ordered() || v.value_ != 0;
+  }
+  friend constexpr bool operator<(
+      partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.is_ordered() && v.value_ < 0;
+  }
+  friend constexpr bool operator<=(
+      partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.is_ordered() && v.value_ <= 0;
+  }
+  friend constexpr bool operator>(
+      partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.is_ordered() && v.value_ > 0;
+  }
+  friend constexpr bool operator>=(
+      partial_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.is_ordered() && v.value_ >= 0;
+  }
+  friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>,
+                                   partial_ordering v) noexcept {
+    return v.is_ordered() && 0 == v.value_;
+  }
+  friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>,
+                                   partial_ordering v) noexcept {
+    return !v.is_ordered() || 0 != v.value_;
+  }
+  friend constexpr bool operator<(compare_internal::OnlyLiteralZero<>,
+                                  partial_ordering v) noexcept {
+    return v.is_ordered() && 0 < v.value_;
+  }
+  friend constexpr bool operator<=(compare_internal::OnlyLiteralZero<>,
+                                   partial_ordering v) noexcept {
+    return v.is_ordered() && 0 <= v.value_;
+  }
+  friend constexpr bool operator>(compare_internal::OnlyLiteralZero<>,
+                                  partial_ordering v) noexcept {
+    return v.is_ordered() && 0 > v.value_;
+  }
+  friend constexpr bool operator>=(compare_internal::OnlyLiteralZero<>,
+                                   partial_ordering v) noexcept {
+    return v.is_ordered() && 0 >= v.value_;
+  }
+
+ private:
+  compare_internal::value_type value_;
+};
+
+class weak_ordering
+    : public compare_internal::weak_ordering_base<weak_ordering> {
+  explicit constexpr weak_ordering(compare_internal::eq v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  explicit constexpr weak_ordering(compare_internal::ord v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  friend struct compare_internal::weak_ordering_base<weak_ordering>;
+
+ public:
+  // Conversions
+  constexpr operator weak_equality() const noexcept {  // NOLINT
+    return value_ == 0 ? weak_equality::equivalent
+                       : weak_equality::nonequivalent;
+  }
+  constexpr operator partial_ordering() const noexcept {  // NOLINT
+    return value_ == 0 ? partial_ordering::equivalent
+                       : (value_ < 0 ? partial_ordering::less
+                                     : partial_ordering::greater);
+  }
+  // Comparisons
+  friend constexpr bool operator==(
+      weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ == 0;
+  }
+  friend constexpr bool operator!=(
+      weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ != 0;
+  }
+  friend constexpr bool operator<(
+      weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ < 0;
+  }
+  friend constexpr bool operator<=(
+      weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ <= 0;
+  }
+  friend constexpr bool operator>(
+      weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ > 0;
+  }
+  friend constexpr bool operator>=(
+      weak_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ >= 0;
+  }
+  friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>,
+                                   weak_ordering v) noexcept {
+    return 0 == v.value_;
+  }
+  friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>,
+                                   weak_ordering v) noexcept {
+    return 0 != v.value_;
+  }
+  friend constexpr bool operator<(compare_internal::OnlyLiteralZero<>,
+                                  weak_ordering v) noexcept {
+    return 0 < v.value_;
+  }
+  friend constexpr bool operator<=(compare_internal::OnlyLiteralZero<>,
+                                   weak_ordering v) noexcept {
+    return 0 <= v.value_;
+  }
+  friend constexpr bool operator>(compare_internal::OnlyLiteralZero<>,
+                                  weak_ordering v) noexcept {
+    return 0 > v.value_;
+  }
+  friend constexpr bool operator>=(compare_internal::OnlyLiteralZero<>,
+                                   weak_ordering v) noexcept {
+    return 0 >= v.value_;
+  }
+
+ private:
+  compare_internal::value_type value_;
+};
+
+class strong_ordering
+    : public compare_internal::strong_ordering_base<strong_ordering> {
+  explicit constexpr strong_ordering(compare_internal::eq v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  explicit constexpr strong_ordering(compare_internal::ord v) noexcept
+      : value_(static_cast<compare_internal::value_type>(v)) {}
+  friend struct compare_internal::strong_ordering_base<strong_ordering>;
+
+ public:
+  // Conversions
+  constexpr operator weak_equality() const noexcept {  // NOLINT
+    return value_ == 0 ? weak_equality::equivalent
+                       : weak_equality::nonequivalent;
+  }
+  constexpr operator strong_equality() const noexcept {  // NOLINT
+    return value_ == 0 ? strong_equality::equal : strong_equality::nonequal;
+  }
+  constexpr operator partial_ordering() const noexcept {  // NOLINT
+    return value_ == 0 ? partial_ordering::equivalent
+                       : (value_ < 0 ? partial_ordering::less
+                                     : partial_ordering::greater);
+  }
+  constexpr operator weak_ordering() const noexcept {  // NOLINT
+    return value_ == 0
+               ? weak_ordering::equivalent
+               : (value_ < 0 ? weak_ordering::less : weak_ordering::greater);
+  }
+  // Comparisons
+  friend constexpr bool operator==(
+      strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ == 0;
+  }
+  friend constexpr bool operator!=(
+      strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ != 0;
+  }
+  friend constexpr bool operator<(
+      strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ < 0;
+  }
+  friend constexpr bool operator<=(
+      strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ <= 0;
+  }
+  friend constexpr bool operator>(
+      strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ > 0;
+  }
+  friend constexpr bool operator>=(
+      strong_ordering v, compare_internal::OnlyLiteralZero<>) noexcept {
+    return v.value_ >= 0;
+  }
+  friend constexpr bool operator==(compare_internal::OnlyLiteralZero<>,
+                                   strong_ordering v) noexcept {
+    return 0 == v.value_;
+  }
+  friend constexpr bool operator!=(compare_internal::OnlyLiteralZero<>,
+                                   strong_ordering v) noexcept {
+    return 0 != v.value_;
+  }
+  friend constexpr bool operator<(compare_internal::OnlyLiteralZero<>,
+                                  strong_ordering v) noexcept {
+    return 0 < v.value_;
+  }
+  friend constexpr bool operator<=(compare_internal::OnlyLiteralZero<>,
+                                   strong_ordering v) noexcept {
+    return 0 <= v.value_;
+  }
+  friend constexpr bool operator>(compare_internal::OnlyLiteralZero<>,
+                                  strong_ordering v) noexcept {
+    return 0 > v.value_;
+  }
+  friend constexpr bool operator>=(compare_internal::OnlyLiteralZero<>,
+                                   strong_ordering v) noexcept {
+    return 0 >= v.value_;
+  }
+
+ private:
+  compare_internal::value_type value_;
+};
+
+namespace compare_internal {
+// We also provide these comparator adapter functions for internal absl use.
+
+// Helper functions to do a boolean comparison of two keys given a boolean
+// or three-way comparator.
+// SFINAE prevents implicit conversions to bool (such as from int).
+template <typename Bool,
+          absl::enable_if_t<std::is_same<bool, Bool>::value, int> = 0>
+constexpr bool compare_result_as_less_than(const Bool r) { return r; }
+constexpr bool compare_result_as_less_than(const absl::weak_ordering r) {
+  return r < 0;
+}
+
+template <typename Compare, typename K, typename LK>
+constexpr bool do_less_than_comparison(const Compare &compare, const K &x,
+                                       const LK &y) {
+  return compare_result_as_less_than(compare(x, y));
+}
+
+// Helper functions to do a three-way comparison of two keys given a boolean or
+// three-way comparator.
+// SFINAE prevents implicit conversions to int (such as from bool).
+template <typename Int,
+          absl::enable_if_t<std::is_same<int, Int>::value, int> = 0>
+constexpr absl::weak_ordering compare_result_as_ordering(const Int c) {
+  return c < 0 ? absl::weak_ordering::less
+               : c == 0 ? absl::weak_ordering::equivalent
+                        : absl::weak_ordering::greater;
+}
+constexpr absl::weak_ordering compare_result_as_ordering(
+    const absl::weak_ordering c) {
+  return c;
+}
+
+template <
+    typename Compare, typename K, typename LK,
+    absl::enable_if_t<!std::is_same<bool, absl::result_of_t<Compare(
+                                              const K &, const LK &)>>::value,
+                      int> = 0>
+constexpr absl::weak_ordering do_three_way_comparison(const Compare &compare,
+                                                      const K &x, const LK &y) {
+  return compare_result_as_ordering(compare(x, y));
+}
+template <
+    typename Compare, typename K, typename LK,
+    absl::enable_if_t<std::is_same<bool, absl::result_of_t<Compare(
+                                             const K &, const LK &)>>::value,
+                      int> = 0>
+constexpr absl::weak_ordering do_three_way_comparison(const Compare &compare,
+                                                      const K &x, const LK &y) {
+  return compare(x, y) ? absl::weak_ordering::less
+                       : compare(y, x) ? absl::weak_ordering::greater
+                                       : absl::weak_ordering::equivalent;
+}
+
+}  // namespace compare_internal
+}  // namespace absl
+
+#endif  // ABSL_TYPES_COMPARE_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/optional.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/optional.h
new file mode 100644 (file)
index 0000000..8acbda2
--- /dev/null
@@ -0,0 +1,394 @@
+// Copyright 2017 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef ABSL_TYPES_INTERNAL_OPTIONAL_H_
+#define ABSL_TYPES_INTERNAL_OPTIONAL_H_
+
+#include <functional>
+#include <new>
+#include <type_traits>
+#include <utility>
+
+#include "absl/base/internal/inline_variable.h"
+#include "absl/memory/memory.h"
+#include "absl/meta/type_traits.h"
+#include "absl/utility/utility.h"
+
+// ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
+//
+// Inheriting constructors is supported in GCC 4.8+, Clang 3.3+ and MSVC 2015.
+// __cpp_inheriting_constructors is a predefined macro and a recommended way to
+// check for this language feature, but GCC doesn't support it until 5.0 and
+// Clang doesn't support it until 3.6.
+// Also, MSVC 2015 has a bug: it doesn't inherit the constexpr template
+// constructor. For example, the following code won't work on MSVC 2015 Update3:
+// struct Base {
+//   int t;
+//   template <typename T>
+//   constexpr Base(T t_) : t(t_) {}
+// };
+// struct Foo : Base {
+//   using Base::Base;
+// }
+// constexpr Foo foo(0);  // doesn't work on MSVC 2015
+#if defined(__clang__)
+#if __has_feature(cxx_inheriting_constructors)
+#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
+#endif
+#elif (defined(__GNUC__) &&                                       \
+       (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \
+    (__cpp_inheriting_constructors >= 200802) ||                  \
+    (defined(_MSC_VER) && _MSC_VER >= 1910)
+#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
+#endif
+
+namespace absl {
+
+// Forward declaration
+template <typename T>
+class optional;
+
+namespace optional_internal {
+
+// This tag type is used as a constructor parameter type for `nullopt_t`.
+struct init_t {
+  explicit init_t() = default;
+};
+
+struct empty_struct {};
+
+// This class stores the data in optional<T>.
+// It is specialized based on whether T is trivially destructible.
+// This is the specialization for non trivially destructible type.
+template <typename T, bool unused = std::is_trivially_destructible<T>::value>
+class optional_data_dtor_base {
+  struct dummy_type {
+    static_assert(sizeof(T) % sizeof(empty_struct) == 0, "");
+    // Use an array to avoid GCC 6 placement-new warning.
+    empty_struct data[sizeof(T) / sizeof(empty_struct)];
+  };
+
+ protected:
+  // Whether there is data or not.
+  bool engaged_;
+  // Data storage
+  union {
+    dummy_type dummy_;
+    T data_;
+  };
+
+  void destruct() noexcept {
+    if (engaged_) {
+      data_.~T();
+      engaged_ = false;
+    }
+  }
+
+  // dummy_ must be initialized for constexpr constructor.
+  constexpr optional_data_dtor_base() noexcept : engaged_(false), dummy_{{}} {}
+
+  template <typename... Args>
+  constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args)
+      : engaged_(true), data_(absl::forward<Args>(args)...) {}
+
+  ~optional_data_dtor_base() { destruct(); }
+};
+
+// Specialization for trivially destructible type.
+template <typename T>
+class optional_data_dtor_base<T, true> {
+  struct dummy_type {
+    static_assert(sizeof(T) % sizeof(empty_struct) == 0, "");
+    // Use array to avoid GCC 6 placement-new warning.
+    empty_struct data[sizeof(T) / sizeof(empty_struct)];
+  };
+
+ protected:
+  // Whether there is data or not.
+  bool engaged_;
+  // Data storage
+  union {
+    dummy_type dummy_;
+    T data_;
+  };
+  void destruct() noexcept { engaged_ = false; }
+
+  // dummy_ must be initialized for constexpr constructor.
+  constexpr optional_data_dtor_base() noexcept : engaged_(false), dummy_{{}} {}
+
+  template <typename... Args>
+  constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args)
+      : engaged_(true), data_(absl::forward<Args>(args)...) {}
+};
+
+template <typename T>
+class optional_data_base : public optional_data_dtor_base<T> {
+ protected:
+  using base = optional_data_dtor_base<T>;
+#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
+  using base::base;
+#else
+  optional_data_base() = default;
+
+  template <typename... Args>
+  constexpr explicit optional_data_base(in_place_t t, Args&&... args)
+      : base(t, absl::forward<Args>(args)...) {}
+#endif
+
+  template <typename... Args>
+  void construct(Args&&... args) {
+    // Use dummy_'s address to work around casting cv-qualified T* to void*.
+    ::new (static_cast<void*>(&this->dummy_)) T(std::forward<Args>(args)...);
+    this->engaged_ = true;
+  }
+
+  template <typename U>
+  void assign(U&& u) {
+    if (this->engaged_) {
+      this->data_ = std::forward<U>(u);
+    } else {
+      construct(std::forward<U>(u));
+    }
+  }
+};
+
+// TODO(absl-team): Add another class using
+// std::is_trivially_move_constructible trait when available to match
+// http://cplusplus.github.io/LWG/lwg-defects.html#2900, for types that
+// have trivial move but nontrivial copy.
+// Also, we should be checking is_trivially_copyable here, which is not
+// supported now, so we use is_trivially_* traits instead.
+template <typename T,
+          bool unused = absl::is_trivially_copy_constructible<T>::value&&
+              absl::is_trivially_copy_assignable<typename std::remove_cv<
+                  T>::type>::value&& std::is_trivially_destructible<T>::value>
+class optional_data;
+
+// Trivially copyable types
+template <typename T>
+class optional_data<T, true> : public optional_data_base<T> {
+ protected:
+#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
+  using optional_data_base<T>::optional_data_base;
+#else
+  optional_data() = default;
+
+  template <typename... Args>
+  constexpr explicit optional_data(in_place_t t, Args&&... args)
+      : optional_data_base<T>(t, absl::forward<Args>(args)...) {}
+#endif
+};
+
+template <typename T>
+class optional_data<T, false> : public optional_data_base<T> {
+ protected:
+#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
+  using optional_data_base<T>::optional_data_base;
+#else
+  template <typename... Args>
+  constexpr explicit optional_data(in_place_t t, Args&&... args)
+      : optional_data_base<T>(t, absl::forward<Args>(args)...) {}
+#endif
+
+  optional_data() = default;
+
+  optional_data(const optional_data& rhs) : optional_data_base<T>() {
+    if (rhs.engaged_) {
+      this->construct(rhs.data_);
+    }
+  }
+
+  optional_data(optional_data&& rhs) noexcept(
+      absl::default_allocator_is_nothrow::value ||
+      std::is_nothrow_move_constructible<T>::value)
+      : optional_data_base<T>() {
+    if (rhs.engaged_) {
+      this->construct(std::move(rhs.data_));
+    }
+  }
+
+  optional_data& operator=(const optional_data& rhs) {
+    if (rhs.engaged_) {
+      this->assign(rhs.data_);
+    } else {
+      this->destruct();
+    }
+    return *this;
+  }
+
+  optional_data& operator=(optional_data&& rhs) noexcept(
+      std::is_nothrow_move_assignable<T>::value&&
+          std::is_nothrow_move_constructible<T>::value) {
+    if (rhs.engaged_) {
+      this->assign(std::move(rhs.data_));
+    } else {
+      this->destruct();
+    }
+    return *this;
+  }
+};
+
+// Ordered by level of restriction, from low to high.
+// Copyable implies movable.
+enum class copy_traits { copyable = 0, movable = 1, non_movable = 2 };
+
+// Base class for enabling/disabling copy/move constructor.
+template <copy_traits>
+class optional_ctor_base;
+
+template <>
+class optional_ctor_base<copy_traits::copyable> {
+ public:
+  constexpr optional_ctor_base() = default;
+  optional_ctor_base(const optional_ctor_base&) = default;
+  optional_ctor_base(optional_ctor_base&&) = default;
+  optional_ctor_base& operator=(const optional_ctor_base&) = default;
+  optional_ctor_base& operator=(optional_ctor_base&&) = default;
+};
+
+template <>
+class optional_ctor_base<copy_traits::movable> {
+ public:
+  constexpr optional_ctor_base() = default;
+  optional_ctor_base(const optional_ctor_base&) = delete;
+  optional_ctor_base(optional_ctor_base&&) = default;
+  optional_ctor_base& operator=(const optional_ctor_base&) = default;
+  optional_ctor_base& operator=(optional_ctor_base&&) = default;
+};
+
+template <>
+class optional_ctor_base<copy_traits::non_movable> {
+ public:
+  constexpr optional_ctor_base() = default;
+  optional_ctor_base(const optional_ctor_base&) = delete;
+  optional_ctor_base(optional_ctor_base&&) = delete;
+  optional_ctor_base& operator=(const optional_ctor_base&) = default;
+  optional_ctor_base& operator=(optional_ctor_base&&) = default;
+};
+
+// Base class for enabling/disabling copy/move assignment.
+template <copy_traits>
+class optional_assign_base;
+
+template <>
+class optional_assign_base<copy_traits::copyable> {
+ public:
+  constexpr optional_assign_base() = default;
+  optional_assign_base(const optional_assign_base&) = default;
+  optional_assign_base(optional_assign_base&&) = default;
+  optional_assign_base& operator=(const optional_assign_base&) = default;
+  optional_assign_base& operator=(optional_assign_base&&) = default;
+};
+
+template <>
+class optional_assign_base<copy_traits::movable> {
+ public:
+  constexpr optional_assign_base() = default;
+  optional_assign_base(const optional_assign_base&) = default;
+  optional_assign_base(optional_assign_base&&) = default;
+  optional_assign_base& operator=(const optional_assign_base&) = delete;
+  optional_assign_base& operator=(optional_assign_base&&) = default;
+};
+
+template <>
+class optional_assign_base<copy_traits::non_movable> {
+ public:
+  constexpr optional_assign_base() = default;
+  optional_assign_base(const optional_assign_base&) = default;
+  optional_assign_base(optional_assign_base&&) = default;
+  optional_assign_base& operator=(const optional_assign_base&) = delete;
+  optional_assign_base& operator=(optional_assign_base&&) = delete;
+};
+
+template <typename T>
+struct ctor_copy_traits {
+  static constexpr copy_traits traits =
+      std::is_copy_constructible<T>::value
+          ? copy_traits::copyable
+          : std::is_move_constructible<T>::value ? copy_traits::movable
+                                                 : copy_traits::non_movable;
+};
+
+template <typename T>
+struct assign_copy_traits {
+  static constexpr copy_traits traits =
+      absl::is_copy_assignable<T>::value && std::is_copy_constructible<T>::value
+          ? copy_traits::copyable
+          : absl::is_move_assignable<T>::value &&
+                    std::is_move_constructible<T>::value
+                ? copy_traits::movable
+                : copy_traits::non_movable;
+};
+
+// Whether T is constructible or convertible from optional<U>.
+template <typename T, typename U>
+struct is_constructible_convertible_from_optional
+    : std::integral_constant<
+          bool, std::is_constructible<T, optional<U>&>::value ||
+                    std::is_constructible<T, optional<U>&&>::value ||
+                    std::is_constructible<T, const optional<U>&>::value ||
+                    std::is_constructible<T, const optional<U>&&>::value ||
+                    std::is_convertible<optional<U>&, T>::value ||
+                    std::is_convertible<optional<U>&&, T>::value ||
+                    std::is_convertible<const optional<U>&, T>::value ||
+                    std::is_convertible<const optional<U>&&, T>::value> {};
+
+// Whether T is constructible or convertible or assignable from optional<U>.
+template <typename T, typename U>
+struct is_constructible_convertible_assignable_from_optional
+    : std::integral_constant<
+          bool, is_constructible_convertible_from_optional<T, U>::value ||
+                    std::is_assignable<T&, optional<U>&>::value ||
+                    std::is_assignable<T&, optional<U>&&>::value ||
+                    std::is_assignable<T&, const optional<U>&>::value ||
+                    std::is_assignable<T&, const optional<U>&&>::value> {};
+
+// Helper function used by [optional.relops], [optional.comp_with_t],
+// for checking whether an expression is convertible to bool.
+bool convertible_to_bool(bool);
+
+// Base class for std::hash<absl::optional<T>>:
+// If std::hash<std::remove_const_t<T>> is enabled, it provides operator() to
+// compute the hash; Otherwise, it is disabled.
+// Reference N4659 23.14.15 [unord.hash].
+template <typename T, typename = size_t>
+struct optional_hash_base {
+  optional_hash_base() = delete;
+  optional_hash_base(const optional_hash_base&) = delete;
+  optional_hash_base(optional_hash_base&&) = delete;
+  optional_hash_base& operator=(const optional_hash_base&) = delete;
+  optional_hash_base& operator=(optional_hash_base&&) = delete;
+};
+
+template <typename T>
+struct optional_hash_base<T, decltype(std::hash<absl::remove_const_t<T> >()(
+                                 std::declval<absl::remove_const_t<T> >()))> {
+  using argument_type = absl::optional<T>;
+  using result_type = size_t;
+  size_t operator()(const absl::optional<T>& opt) const {
+    absl::type_traits_internal::AssertHashEnabled<absl::remove_const_t<T>>();
+    if (opt) {
+      return std::hash<absl::remove_const_t<T> >()(*opt);
+    } else {
+      return static_cast<size_t>(0x297814aaad196e6dULL);
+    }
+  }
+};
+
+}  // namespace optional_internal
+}  // namespace absl
+
+#undef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
+
+#endif  // ABSL_TYPES_INTERNAL_OPTIONAL_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/span.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/span.h
new file mode 100644 (file)
index 0000000..d203aad
--- /dev/null
@@ -0,0 +1,126 @@
+//
+// Copyright 2019 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef ABSL_TYPES_INTERNAL_SPAN_H_
+#define ABSL_TYPES_INTERNAL_SPAN_H_
+
+#include <algorithm>
+#include <cstddef>
+#include <string>
+#include <type_traits>
+
+#include "absl/algorithm/algorithm.h"
+#include "absl/base/internal/throw_delegate.h"
+#include "absl/meta/type_traits.h"
+
+namespace absl {
+
+namespace span_internal {
+// A constexpr min function
+constexpr size_t Min(size_t a, size_t b) noexcept { return a < b ? a : b; }
+
+// Wrappers for access to container data pointers.
+template <typename C>
+constexpr auto GetDataImpl(C& c, char) noexcept  // NOLINT(runtime/references)
+    -> decltype(c.data()) {
+  return c.data();
+}
+
+// Before C++17, std::string::data returns a const char* in all cases.
+inline char* GetDataImpl(std::string& s,  // NOLINT(runtime/references)
+                         int) noexcept {
+  return &s[0];
+}
+
+template <typename C>
+constexpr auto GetData(C& c) noexcept  // NOLINT(runtime/references)
+    -> decltype(GetDataImpl(c, 0)) {
+  return GetDataImpl(c, 0);
+}
+
+// Detection idioms for size() and data().
+template <typename C>
+using HasSize =
+    std::is_integral<absl::decay_t<decltype(std::declval<C&>().size())>>;
+
+// We want to enable conversion from vector<T*> to Span<const T* const> but
+// disable conversion from vector<Derived> to Span<Base>. Here we use
+// the fact that U** is convertible to Q* const* if and only if Q is the same
+// type or a more cv-qualified version of U.  We also decay the result type of
+// data() to avoid problems with classes which have a member function data()
+// which returns a reference.
+template <typename T, typename C>
+using HasData =
+    std::is_convertible<absl::decay_t<decltype(GetData(std::declval<C&>()))>*,
+                        T* const*>;
+
+// Extracts value type from a Container
+template <typename C>
+struct ElementType {
+  using type = typename absl::remove_reference_t<C>::value_type;
+};
+
+template <typename T, size_t N>
+struct ElementType<T (&)[N]> {
+  using type = T;
+};
+
+template <typename C>
+using ElementT = typename ElementType<C>::type;
+
+template <typename T>
+using EnableIfMutable =
+    typename std::enable_if<!std::is_const<T>::value, int>::type;
+
+template <template <typename> class SpanT, typename T>
+bool EqualImpl(SpanT<T> a, SpanT<T> b) {
+  static_assert(std::is_const<T>::value, "");
+  return absl::equal(a.begin(), a.end(), b.begin(), b.end());
+}
+
+template <template <typename> class SpanT, typename T>
+bool LessThanImpl(SpanT<T> a, SpanT<T> b) {
+  // We can't use value_type since that is remove_cv_t<T>, so we go the long way
+  // around.
+  static_assert(std::is_const<T>::value, "");
+  return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
+}
+
+// The `IsConvertible` classes here are needed because of the
+// `std::is_convertible` bug in libcxx when compiled with GCC. This build
+// configuration is used by Android NDK toolchain. Reference link:
+// https://bugs.llvm.org/show_bug.cgi?id=27538.
+template <typename From, typename To>
+struct IsConvertibleHelper {
+ private:
+  static std::true_type testval(To);
+  static std::false_type testval(...);
+
+ public:
+  using type = decltype(testval(std::declval<From>()));
+};
+
+template <typename From, typename To>
+struct IsConvertible : IsConvertibleHelper<From, To>::type {};
+
+// TODO(zhangxy): replace `IsConvertible` with `std::is_convertible` once the
+// older version of libcxx is not supported.
+template <typename From, typename To>
+using EnableIfConvertibleTo =
+    typename std::enable_if<IsConvertible<From, To>::value>::type;
+}  // namespace span_internal
+}  // namespace absl
+
+#endif  // ABSL_TYPES_INTERNAL_SPAN_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/variant.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/internal/variant.h
new file mode 100644 (file)
index 0000000..85201b4
--- /dev/null
@@ -0,0 +1,1632 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Implementation details of absl/types/variant.h, pulled into a
+// separate file to avoid cluttering the top of the API header with
+// implementation details.
+
+#ifndef ABSL_TYPES_variant_internal_H_
+#define ABSL_TYPES_variant_internal_H_
+
+#include <cassert>
+#include <cstddef>
+#include <cstdlib>
+#include <memory>
+#include <stdexcept>
+#include <tuple>
+#include <type_traits>
+
+#include "absl/base/config.h"
+#include "absl/base/internal/identity.h"
+#include "absl/base/internal/inline_variable.h"
+#include "absl/base/internal/invoke.h"
+#include "absl/base/macros.h"
+#include "absl/base/optimization.h"
+#include "absl/meta/type_traits.h"
+#include "absl/types/bad_variant_access.h"
+#include "absl/utility/utility.h"
+
+#if !defined(ABSL_HAVE_STD_VARIANT)
+
+namespace absl {
+
+template <class... Types>
+class variant;
+
+ABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, -1);
+
+template <class T>
+struct variant_size;
+
+template <std::size_t I, class T>
+struct variant_alternative;
+
+namespace variant_internal {
+
+// NOTE: See specializations below for details.
+template <std::size_t I, class T>
+struct VariantAlternativeSfinae {};
+
+// Requires: I < variant_size_v<T>.
+//
+// Value: The Ith type of Types...
+template <std::size_t I, class T0, class... Tn>
+struct VariantAlternativeSfinae<I, variant<T0, Tn...>>
+    : VariantAlternativeSfinae<I - 1, variant<Tn...>> {};
+
+// Value: T0
+template <class T0, class... Ts>
+struct VariantAlternativeSfinae<0, variant<T0, Ts...>> {
+  using type = T0;
+};
+
+template <std::size_t I, class T>
+using VariantAlternativeSfinaeT = typename VariantAlternativeSfinae<I, T>::type;
+
+// NOTE: Requires T to be a reference type.
+template <class T, class U>
+struct GiveQualsTo;
+
+template <class T, class U>
+struct GiveQualsTo<T&, U> {
+  using type = U&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<T&&, U> {
+  using type = U&&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<const T&, U> {
+  using type = const U&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<const T&&, U> {
+  using type = const U&&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<volatile T&, U> {
+  using type = volatile U&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<volatile T&&, U> {
+  using type = volatile U&&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<volatile const T&, U> {
+  using type = volatile const U&;
+};
+
+template <class T, class U>
+struct GiveQualsTo<volatile const T&&, U> {
+  using type = volatile const U&&;
+};
+
+template <class T, class U>
+using GiveQualsToT = typename GiveQualsTo<T, U>::type;
+
+// Convenience alias, since size_t integral_constant is used a lot in this file.
+template <std::size_t I>
+using SizeT = std::integral_constant<std::size_t, I>;
+
+using NPos = SizeT<variant_npos>;
+
+template <class Variant, class T, class = void>
+struct IndexOfConstructedType {};
+
+template <std::size_t I, class Variant>
+struct VariantAccessResultImpl;
+
+template <std::size_t I, template <class...> class Variantemplate, class... T>
+struct VariantAccessResultImpl<I, Variantemplate<T...>&> {
+  using type = typename absl::variant_alternative<I, variant<T...>>::type&;
+};
+
+template <std::size_t I, template <class...> class Variantemplate, class... T>
+struct VariantAccessResultImpl<I, const Variantemplate<T...>&> {
+  using type =
+      const typename absl::variant_alternative<I, variant<T...>>::type&;
+};
+
+template <std::size_t I, template <class...> class Variantemplate, class... T>
+struct VariantAccessResultImpl<I, Variantemplate<T...>&&> {
+  using type = typename absl::variant_alternative<I, variant<T...>>::type&&;
+};
+
+template <std::size_t I, template <class...> class Variantemplate, class... T>
+struct VariantAccessResultImpl<I, const Variantemplate<T...>&&> {
+  using type =
+      const typename absl::variant_alternative<I, variant<T...>>::type&&;
+};
+
+template <std::size_t I, class Variant>
+using VariantAccessResult =
+    typename VariantAccessResultImpl<I, Variant&&>::type;
+
+// NOTE: This is used instead of std::array to reduce instantiation overhead.
+template <class T, std::size_t Size>
+struct SimpleArray {
+  static_assert(Size != 0, "");
+  T value[Size];
+};
+
+template <class T>
+struct AccessedType {
+  using type = T;
+};
+
+template <class T>
+using AccessedTypeT = typename AccessedType<T>::type;
+
+template <class T, std::size_t Size>
+struct AccessedType<SimpleArray<T, Size>> {
+  using type = AccessedTypeT<T>;
+};
+
+template <class T>
+constexpr T AccessSimpleArray(const T& value) {
+  return value;
+}
+
+template <class T, std::size_t Size, class... SizeT>
+constexpr AccessedTypeT<T> AccessSimpleArray(const SimpleArray<T, Size>& table,
+                                             std::size_t head_index,
+                                             SizeT... tail_indices) {
+  return AccessSimpleArray(table.value[head_index], tail_indices...);
+}
+
+// Note: Intentionally is an alias.
+template <class T>
+using AlwaysZero = SizeT<0>;
+
+template <class Op, class... Vs>
+struct VisitIndicesResultImpl {
+  using type = absl::result_of_t<Op(AlwaysZero<Vs>...)>;
+};
+
+template <class Op, class... Vs>
+using VisitIndicesResultT = typename VisitIndicesResultImpl<Op, Vs...>::type;
+
+template <class ReturnType, class FunctionObject, class EndIndices,
+          std::size_t... BoundIndices>
+struct MakeVisitationMatrix;
+
+template <class ReturnType, class FunctionObject, std::size_t... Indices>
+constexpr ReturnType call_with_indices(FunctionObject&& function) {
+  static_assert(
+      std::is_same<ReturnType, decltype(std::declval<FunctionObject>()(
+                                   SizeT<Indices>()...))>::value,
+      "Not all visitation overloads have the same return type.");
+  return absl::forward<FunctionObject>(function)(SizeT<Indices>()...);
+}
+
+template <class ReturnType, class FunctionObject, std::size_t... BoundIndices>
+struct MakeVisitationMatrix<ReturnType, FunctionObject, index_sequence<>,
+                            BoundIndices...> {
+  using ResultType = ReturnType (*)(FunctionObject&&);
+  static constexpr ResultType Run() {
+    return &call_with_indices<ReturnType, FunctionObject,
+                              (BoundIndices - 1)...>;
+  }
+};
+
+template <class ReturnType, class FunctionObject, class EndIndices,
+          class CurrIndices, std::size_t... BoundIndices>
+struct MakeVisitationMatrixImpl;
+
+template <class ReturnType, class FunctionObject, std::size_t... EndIndices,
+          std::size_t... CurrIndices, std::size_t... BoundIndices>
+struct MakeVisitationMatrixImpl<
+    ReturnType, FunctionObject, index_sequence<EndIndices...>,
+    index_sequence<CurrIndices...>, BoundIndices...> {
+  using ResultType = SimpleArray<
+      typename MakeVisitationMatrix<ReturnType, FunctionObject,
+                                    index_sequence<EndIndices...>>::ResultType,
+      sizeof...(CurrIndices)>;
+
+  static constexpr ResultType Run() {
+    return {{MakeVisitationMatrix<ReturnType, FunctionObject,
+                                  index_sequence<EndIndices...>,
+                                  BoundIndices..., CurrIndices>::Run()...}};
+  }
+};
+
+template <class ReturnType, class FunctionObject, std::size_t HeadEndIndex,
+          std::size_t... TailEndIndices, std::size_t... BoundIndices>
+struct MakeVisitationMatrix<ReturnType, FunctionObject,
+                            index_sequence<HeadEndIndex, TailEndIndices...>,
+                            BoundIndices...>
+    : MakeVisitationMatrixImpl<
+          ReturnType, FunctionObject, index_sequence<TailEndIndices...>,
+          absl::make_index_sequence<HeadEndIndex>, BoundIndices...> {};
+
+struct UnreachableSwitchCase {
+  template <class Op>
+  [[noreturn]] static VisitIndicesResultT<Op, std::size_t> Run(
+      Op&& /*ignored*/) {
+#if ABSL_HAVE_BUILTIN(__builtin_unreachable) || \
+    (defined(__GNUC__) && !defined(__clang__))
+    __builtin_unreachable();
+#elif defined(_MSC_VER)
+    __assume(false);
+#else
+    // Try to use assert of false being identified as an unreachable intrinsic.
+    // NOTE: We use assert directly to increase chances of exploiting an assume
+    //       intrinsic.
+    assert(false);  // NOLINT
+
+    // Hack to silence potential no return warning -- cause an infinite loop.
+    return Run(absl::forward<Op>(op));
+#endif  // Checks for __builtin_unreachable
+  }
+};
+
+template <class Op, std::size_t I>
+struct ReachableSwitchCase {
+  static VisitIndicesResultT<Op, std::size_t> Run(Op&& op) {
+    return absl::base_internal::Invoke(absl::forward<Op>(op), SizeT<I>());
+  }
+};
+
+// The number 33 is just a guess at a reasonable maximum to our switch. It is
+// not based on any analysis. The reason it is a power of 2 plus 1 instead of a
+// power of 2 is because the number was picked to correspond to a power of 2
+// amount of "normal" alternatives, plus one for the possibility of the user
+// providing "monostate" in addition to the more natural alternatives.
+ABSL_INTERNAL_INLINE_CONSTEXPR(std::size_t, MaxUnrolledVisitCases, 33);
+
+// Note: The default-definition is for unreachable cases.
+template <bool IsReachable>
+struct PickCaseImpl {
+  template <class Op, std::size_t I>
+  using Apply = UnreachableSwitchCase;
+};
+
+template <>
+struct PickCaseImpl</*IsReachable =*/true> {
+  template <class Op, std::size_t I>
+  using Apply = ReachableSwitchCase<Op, I>;
+};
+
+// Note: This form of dance with template aliases is to make sure that we
+//       instantiate a number of templates proportional to the number of variant
+//       alternatives rather than a number of templates proportional to our
+//       maximum unrolled amount of visitation cases (aliases are effectively
+//       "free" whereas other template instantiations are costly).
+template <class Op, std::size_t I, std::size_t EndIndex>
+using PickCase = typename PickCaseImpl<(I < EndIndex)>::template Apply<Op, I>;
+
+template <class ReturnType>
+[[noreturn]] ReturnType TypedThrowBadVariantAccess() {
+  absl::variant_internal::ThrowBadVariantAccess();
+}
+
+// Given N variant sizes, determine the number of cases there would need to be
+// in a single switch-statement that would cover every possibility in the
+// corresponding N-ary visit operation.
+template <std::size_t... NumAlternatives>
+struct NumCasesOfSwitch;
+
+template <std::size_t HeadNumAlternatives, std::size_t... TailNumAlternatives>
+struct NumCasesOfSwitch<HeadNumAlternatives, TailNumAlternatives...> {
+  static constexpr std::size_t value =
+      (HeadNumAlternatives + 1) *
+      NumCasesOfSwitch<TailNumAlternatives...>::value;
+};
+
+template <>
+struct NumCasesOfSwitch<> {
+  static constexpr std::size_t value = 1;
+};
+
+// A switch statement optimizes better than the table of function pointers.
+template <std::size_t EndIndex>
+struct VisitIndicesSwitch {
+  static_assert(EndIndex <= MaxUnrolledVisitCases,
+                "Maximum unrolled switch size exceeded.");
+
+  template <class Op>
+  static VisitIndicesResultT<Op, std::size_t> Run(Op&& op, std::size_t i) {
+    switch (i) {
+      case 0:
+        return PickCase<Op, 0, EndIndex>::Run(absl::forward<Op>(op));
+      case 1:
+        return PickCase<Op, 1, EndIndex>::Run(absl::forward<Op>(op));
+      case 2:
+        return PickCase<Op, 2, EndIndex>::Run(absl::forward<Op>(op));
+      case 3:
+        return PickCase<Op, 3, EndIndex>::Run(absl::forward<Op>(op));
+      case 4:
+        return PickCase<Op, 4, EndIndex>::Run(absl::forward<Op>(op));
+      case 5:
+        return PickCase<Op, 5, EndIndex>::Run(absl::forward<Op>(op));
+      case 6:
+        return PickCase<Op, 6, EndIndex>::Run(absl::forward<Op>(op));
+      case 7:
+        return PickCase<Op, 7, EndIndex>::Run(absl::forward<Op>(op));
+      case 8:
+        return PickCase<Op, 8, EndIndex>::Run(absl::forward<Op>(op));
+      case 9:
+        return PickCase<Op, 9, EndIndex>::Run(absl::forward<Op>(op));
+      case 10:
+        return PickCase<Op, 10, EndIndex>::Run(absl::forward<Op>(op));
+      case 11:
+        return PickCase<Op, 11, EndIndex>::Run(absl::forward<Op>(op));
+      case 12:
+        return PickCase<Op, 12, EndIndex>::Run(absl::forward<Op>(op));
+      case 13:
+        return PickCase<Op, 13, EndIndex>::Run(absl::forward<Op>(op));
+      case 14:
+        return PickCase<Op, 14, EndIndex>::Run(absl::forward<Op>(op));
+      case 15:
+        return PickCase<Op, 15, EndIndex>::Run(absl::forward<Op>(op));
+      case 16:
+        return PickCase<Op, 16, EndIndex>::Run(absl::forward<Op>(op));
+      case 17:
+        return PickCase<Op, 17, EndIndex>::Run(absl::forward<Op>(op));
+      case 18:
+        return PickCase<Op, 18, EndIndex>::Run(absl::forward<Op>(op));
+      case 19:
+        return PickCase<Op, 19, EndIndex>::Run(absl::forward<Op>(op));
+      case 20:
+        return PickCase<Op, 20, EndIndex>::Run(absl::forward<Op>(op));
+      case 21:
+        return PickCase<Op, 21, EndIndex>::Run(absl::forward<Op>(op));
+      case 22:
+        return PickCase<Op, 22, EndIndex>::Run(absl::forward<Op>(op));
+      case 23:
+        return PickCase<Op, 23, EndIndex>::Run(absl::forward<Op>(op));
+      case 24:
+        return PickCase<Op, 24, EndIndex>::Run(absl::forward<Op>(op));
+      case 25:
+        return PickCase<Op, 25, EndIndex>::Run(absl::forward<Op>(op));
+      case 26:
+        return PickCase<Op, 26, EndIndex>::Run(absl::forward<Op>(op));
+      case 27:
+        return PickCase<Op, 27, EndIndex>::Run(absl::forward<Op>(op));
+      case 28:
+        return PickCase<Op, 28, EndIndex>::Run(absl::forward<Op>(op));
+      case 29:
+        return PickCase<Op, 29, EndIndex>::Run(absl::forward<Op>(op));
+      case 30:
+        return PickCase<Op, 30, EndIndex>::Run(absl::forward<Op>(op));
+      case 31:
+        return PickCase<Op, 31, EndIndex>::Run(absl::forward<Op>(op));
+      case 32:
+        return PickCase<Op, 32, EndIndex>::Run(absl::forward<Op>(op));
+      default:
+        ABSL_ASSERT(i == variant_npos);
+        return absl::base_internal::Invoke(absl::forward<Op>(op), NPos());
+    }
+  }
+};
+
+template <std::size_t... EndIndices>
+struct VisitIndicesFallback {
+  template <class Op, class... SizeT>
+  static VisitIndicesResultT<Op, SizeT...> Run(Op&& op, SizeT... indices) {
+    return AccessSimpleArray(
+        MakeVisitationMatrix<VisitIndicesResultT<Op, SizeT...>, Op,
+                             index_sequence<(EndIndices + 1)...>>::Run(),
+        (indices + 1)...)(absl::forward<Op>(op));
+  }
+};
+
+// Take an N-dimensional series of indices and convert them into a single index
+// without loss of information. The purpose of this is to be able to convert an
+// N-ary visit operation into a single switch statement.
+template <std::size_t...>
+struct FlattenIndices;
+
+template <std::size_t HeadSize, std::size_t... TailSize>
+struct FlattenIndices<HeadSize, TailSize...> {
+  template<class... SizeType>
+  static constexpr std::size_t Run(std::size_t head, SizeType... tail) {
+    return head + HeadSize * FlattenIndices<TailSize...>::Run(tail...);
+  }
+};
+
+template <>
+struct FlattenIndices<> {
+  static constexpr std::size_t Run() { return 0; }
+};
+
+// Take a single "flattened" index (flattened by FlattenIndices) and determine
+// the value of the index of one of the logically represented dimensions.
+template <std::size_t I, std::size_t IndexToGet, std::size_t HeadSize,
+          std::size_t... TailSize>
+struct UnflattenIndex {
+  static constexpr std::size_t value =
+      UnflattenIndex<I / HeadSize, IndexToGet - 1, TailSize...>::value;
+};
+
+template <std::size_t I, std::size_t HeadSize, std::size_t... TailSize>
+struct UnflattenIndex<I, 0, HeadSize, TailSize...> {
+  static constexpr std::size_t value = (I % HeadSize);
+};
+
+// The backend for converting an N-ary visit operation into a unary visit.
+template <class IndexSequence, std::size_t... EndIndices>
+struct VisitIndicesVariadicImpl;
+
+template <std::size_t... N, std::size_t... EndIndices>
+struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
+  // A type that can take an N-ary function object and converts it to a unary
+  // function object that takes a single, flattened index, and "unflattens" it
+  // into its individual dimensions when forwarding to the wrapped object.
+  template <class Op>
+  struct FlattenedOp {
+    template <std::size_t I>
+    VisitIndicesResultT<Op, decltype(EndIndices)...> operator()(
+        SizeT<I> /*index*/) && {
+      return base_internal::Invoke(
+          absl::forward<Op>(op),
+          SizeT<UnflattenIndex<I, N, (EndIndices + 1)...>::value -
+                std::size_t{1}>()...);
+    }
+
+    Op&& op;
+  };
+
+  template <class Op, class... SizeType>
+  static VisitIndicesResultT<Op, decltype(EndIndices)...> Run(
+      Op&& op, SizeType... i) {
+    return VisitIndicesSwitch<NumCasesOfSwitch<EndIndices...>::value>::Run(
+        FlattenedOp<Op>{absl::forward<Op>(op)},
+        FlattenIndices<(EndIndices + std::size_t{1})...>::Run(
+            (i + std::size_t{1})...));
+  }
+};
+
+template <std::size_t... EndIndices>
+struct VisitIndicesVariadic
+    : VisitIndicesVariadicImpl<absl::make_index_sequence<sizeof...(EndIndices)>,
+                               EndIndices...> {};
+
+// This implementation will flatten N-ary visit operations into a single switch
+// statement when the number of cases would be less than our maximum specified
+// switch-statement size.
+// TODO(calabrese)
+//   Based on benchmarks, determine whether the function table approach actually
+//   does optimize better than a chain of switch statements and possibly update
+//   the implementation accordingly. Also consider increasing the maximum switch
+//   size.
+template <std::size_t... EndIndices>
+struct VisitIndices
+    : absl::conditional_t<(NumCasesOfSwitch<EndIndices...>::value <=
+                           MaxUnrolledVisitCases),
+                          VisitIndicesVariadic<EndIndices...>,
+                          VisitIndicesFallback<EndIndices...>> {};
+
+template <std::size_t EndIndex>
+struct VisitIndices<EndIndex>
+    : absl::conditional_t<(EndIndex <= MaxUnrolledVisitCases),
+                          VisitIndicesSwitch<EndIndex>,
+                          VisitIndicesFallback<EndIndex>> {};
+
+// Suppress bogus warning on MSVC: MSVC complains that the `reinterpret_cast`
+// below is returning the address of a temporary or local object.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4172)
+#endif  // _MSC_VER
+
+// TODO(calabrese) std::launder
+// TODO(calabrese) constexpr
+// NOTE: DO NOT REMOVE the `inline` keyword as it is necessary to work around a
+// MSVC bug. See https://github.com/abseil/abseil-cpp/issues/129 for details.
+template <class Self, std::size_t I>
+inline VariantAccessResult<I, Self> AccessUnion(Self&& self, SizeT<I> /*i*/) {
+  return reinterpret_cast<VariantAccessResult<I, Self>>(self);
+}
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif  // _MSC_VER
+
+template <class T>
+void DeducedDestroy(T& self) {  // NOLINT
+  self.~T();
+}
+
+// NOTE: This type exists as a single entity for variant and its bases to
+// befriend. It contains helper functionality that manipulates the state of the
+// variant, such as the implementation of things like assignment and emplace
+// operations.
+struct VariantCoreAccess {
+  template <class VariantType>
+  static typename VariantType::Variant& Derived(VariantType& self) {  // NOLINT
+    return static_cast<typename VariantType::Variant&>(self);
+  }
+
+  template <class VariantType>
+  static const typename VariantType::Variant& Derived(
+      const VariantType& self) {  // NOLINT
+    return static_cast<const typename VariantType::Variant&>(self);
+  }
+
+  template <class VariantType>
+  static void Destroy(VariantType& self) {  // NOLINT
+    Derived(self).destroy();
+    self.index_ = absl::variant_npos;
+  }
+
+  template <class Variant>
+  static void SetIndex(Variant& self, std::size_t i) {  // NOLINT
+    self.index_ = i;
+  }
+
+  template <class Variant>
+  static void InitFrom(Variant& self, Variant&& other) {  // NOLINT
+    VisitIndices<absl::variant_size<Variant>::value>::Run(
+        InitFromVisitor<Variant, Variant&&>{&self,
+                                            std::forward<Variant>(other)},
+        other.index());
+    self.index_ = other.index();
+  }
+
+  // Access a variant alternative, assuming the index is correct.
+  template <std::size_t I, class Variant>
+  static VariantAccessResult<I, Variant> Access(Variant&& self) {
+    // This cast instead of invocation of AccessUnion with an rvalue is a
+    // workaround for msvc. Without this there is a runtime failure when dealing
+    // with rvalues.
+    // TODO(calabrese) Reduce test case and find a simpler workaround.
+    return static_cast<VariantAccessResult<I, Variant>>(
+        variant_internal::AccessUnion(self.state_, SizeT<I>()));
+  }
+
+  // Access a variant alternative, throwing if the index is incorrect.
+  template <std::size_t I, class Variant>
+  static VariantAccessResult<I, Variant> CheckedAccess(Variant&& self) {
+    if (ABSL_PREDICT_FALSE(self.index_ != I)) {
+      TypedThrowBadVariantAccess<VariantAccessResult<I, Variant>>();
+    }
+
+    return Access<I>(absl::forward<Variant>(self));
+  }
+
+  // The implementation of the move-assignment operation for a variant.
+  template <class VType>
+  struct MoveAssignVisitor {
+    using DerivedType = typename VType::Variant;
+    template <std::size_t NewIndex>
+    void operator()(SizeT<NewIndex> /*new_i*/) const {
+      if (left->index_ == NewIndex) {
+        Access<NewIndex>(*left) = std::move(Access<NewIndex>(*right));
+      } else {
+        Derived(*left).template emplace<NewIndex>(
+            std::move(Access<NewIndex>(*right)));
+      }
+    }
+
+    void operator()(SizeT<absl::variant_npos> /*new_i*/) const {
+      Destroy(*left);
+    }
+
+    VType* left;
+    VType* right;
+  };
+
+  template <class VType>
+  static MoveAssignVisitor<VType> MakeMoveAssignVisitor(VType* left,
+                                                        VType* other) {
+    return {left, other};
+  }
+
+  // The implementation of the assignment operation for a variant.
+  template <class VType>
+  struct CopyAssignVisitor {
+    using DerivedType = typename VType::Variant;
+    template <std::size_t NewIndex>
+    void operator()(SizeT<NewIndex> /*new_i*/) const {
+      using New =
+          typename absl::variant_alternative<NewIndex, DerivedType>::type;
+
+      if (left->index_ == NewIndex) {
+        Access<NewIndex>(*left) = Access<NewIndex>(*right);
+      } else if (std::is_nothrow_copy_constructible<New>::value ||
+                 !std::is_nothrow_move_constructible<New>::value) {
+        Derived(*left).template emplace<NewIndex>(Access<NewIndex>(*right));
+      } else {
+        Derived(*left) = DerivedType(Derived(*right));
+      }
+    }
+
+    void operator()(SizeT<absl::variant_npos> /*new_i*/) const {
+      Destroy(*left);
+    }
+
+    VType* left;
+    const VType* right;
+  };
+
+  template <class VType>
+  static CopyAssignVisitor<VType> MakeCopyAssignVisitor(VType* left,
+                                                        const VType& other) {
+    return {left, &other};
+  }
+
+  // The implementation of conversion-assignment operations for variant.
+  template <class Left, class QualifiedNew>
+  struct ConversionAssignVisitor {
+    using NewIndex =
+        variant_internal::IndexOfConstructedType<Left, QualifiedNew>;
+
+    void operator()(SizeT<NewIndex::value> /*old_i*/
+                    ) const {
+      Access<NewIndex::value>(*left) = absl::forward<QualifiedNew>(other);
+    }
+
+    template <std::size_t OldIndex>
+    void operator()(SizeT<OldIndex> /*old_i*/
+                    ) const {
+      using New =
+          typename absl::variant_alternative<NewIndex::value, Left>::type;
+      if (std::is_nothrow_constructible<New, QualifiedNew>::value ||
+          !std::is_nothrow_move_constructible<New>::value) {
+        left->template emplace<NewIndex::value>(
+            absl::forward<QualifiedNew>(other));
+      } else {
+        // the standard says "equivalent to
+        // operator=(variant(std::forward<T>(t)))", but we use `emplace` here
+        // because the variant's move assignment operator could be deleted.
+        left->template emplace<NewIndex::value>(
+            New(absl::forward<QualifiedNew>(other)));
+      }
+    }
+
+    Left* left;
+    QualifiedNew&& other;
+  };
+
+  template <class Left, class QualifiedNew>
+  static ConversionAssignVisitor<Left, QualifiedNew>
+  MakeConversionAssignVisitor(Left* left, QualifiedNew&& qual) {
+    return {left, absl::forward<QualifiedNew>(qual)};
+  }
+
+  // Backend for operations for `emplace()` which destructs `*self` then
+  // construct a new alternative with `Args...`.
+  template <std::size_t NewIndex, class Self, class... Args>
+  static typename absl::variant_alternative<NewIndex, Self>::type& Replace(
+      Self* self, Args&&... args) {
+    Destroy(*self);
+    using New = typename absl::variant_alternative<NewIndex, Self>::type;
+    New* const result = ::new (static_cast<void*>(&self->state_))
+        New(absl::forward<Args>(args)...);
+    self->index_ = NewIndex;
+    return *result;
+  }
+
+  template <class LeftVariant, class QualifiedRightVariant>
+  struct InitFromVisitor {
+    template <std::size_t NewIndex>
+    void operator()(SizeT<NewIndex> /*new_i*/) const {
+      using Alternative =
+          typename variant_alternative<NewIndex, LeftVariant>::type;
+      ::new (static_cast<void*>(&left->state_)) Alternative(
+          Access<NewIndex>(std::forward<QualifiedRightVariant>(right)));
+    }
+
+    void operator()(SizeT<absl::variant_npos> /*new_i*/) const {
+      // This space intentionally left blank.
+    }
+    LeftVariant* left;
+    QualifiedRightVariant&& right;
+  };
+};
+
+template <class Expected, class... T>
+struct IndexOfImpl;
+
+template <class Expected>
+struct IndexOfImpl<Expected> {
+  using IndexFromEnd = SizeT<0>;
+  using MatchedIndexFromEnd = IndexFromEnd;
+  using MultipleMatches = std::false_type;
+};
+
+template <class Expected, class Head, class... Tail>
+struct IndexOfImpl<Expected, Head, Tail...> : IndexOfImpl<Expected, Tail...> {
+  using IndexFromEnd =
+      SizeT<IndexOfImpl<Expected, Tail...>::IndexFromEnd::value + 1>;
+};
+
+template <class Expected, class... Tail>
+struct IndexOfImpl<Expected, Expected, Tail...>
+    : IndexOfImpl<Expected, Tail...> {
+  using IndexFromEnd =
+      SizeT<IndexOfImpl<Expected, Tail...>::IndexFromEnd::value + 1>;
+  using MatchedIndexFromEnd = IndexFromEnd;
+  using MultipleMatches = std::integral_constant<
+      bool, IndexOfImpl<Expected, Tail...>::MatchedIndexFromEnd::value != 0>;
+};
+
+template <class Expected, class... Types>
+struct IndexOfMeta {
+  using Results = IndexOfImpl<Expected, Types...>;
+  static_assert(!Results::MultipleMatches::value,
+                "Attempted to access a variant by specifying a type that "
+                "matches more than one alternative.");
+  static_assert(Results::MatchedIndexFromEnd::value != 0,
+                "Attempted to access a variant by specifying a type that does "
+                "not match any alternative.");
+  using type = SizeT<sizeof...(Types) - Results::MatchedIndexFromEnd::value>;
+};
+
+template <class Expected, class... Types>
+using IndexOf = typename IndexOfMeta<Expected, Types...>::type;
+
+template <class Variant, class T, std::size_t CurrIndex>
+struct UnambiguousIndexOfImpl;
+
+// Terminating case encountered once we've checked all of the alternatives
+template <class T, std::size_t CurrIndex>
+struct UnambiguousIndexOfImpl<variant<>, T, CurrIndex> : SizeT<CurrIndex> {};
+
+// Case where T is not Head
+template <class Head, class... Tail, class T, std::size_t CurrIndex>
+struct UnambiguousIndexOfImpl<variant<Head, Tail...>, T, CurrIndex>
+    : UnambiguousIndexOfImpl<variant<Tail...>, T, CurrIndex + 1>::type {};
+
+// Case where T is Head
+template <class Head, class... Tail, std::size_t CurrIndex>
+struct UnambiguousIndexOfImpl<variant<Head, Tail...>, Head, CurrIndex>
+    : SizeT<UnambiguousIndexOfImpl<variant<Tail...>, Head, 0>::value ==
+                    sizeof...(Tail)
+                ? CurrIndex
+                : CurrIndex + sizeof...(Tail) + 1> {};
+
+template <class Variant, class T>
+struct UnambiguousIndexOf;
+
+struct NoMatch {
+  struct type {};
+};
+
+template <class... Alts, class T>
+struct UnambiguousIndexOf<variant<Alts...>, T>
+    : std::conditional<UnambiguousIndexOfImpl<variant<Alts...>, T, 0>::value !=
+                           sizeof...(Alts),
+                       UnambiguousIndexOfImpl<variant<Alts...>, T, 0>,
+                       NoMatch>::type::type {};
+
+template <class T, std::size_t /*Dummy*/>
+using UnambiguousTypeOfImpl = T;
+
+template <class Variant, class T>
+using UnambiguousTypeOfT =
+    UnambiguousTypeOfImpl<T, UnambiguousIndexOf<Variant, T>::value>;
+
+template <class H, class... T>
+class VariantStateBase;
+
+// This is an implementation of the "imaginary function" that is described in
+// [variant.ctor]
+// It is used in order to determine which alternative to construct during
+// initialization from some type T.
+template <class Variant, std::size_t I = 0>
+struct ImaginaryFun;
+
+template <std::size_t I>
+struct ImaginaryFun<variant<>, I> {
+  static void Run() = delete;
+};
+
+template <class H, class... T, std::size_t I>
+struct ImaginaryFun<variant<H, T...>, I> : ImaginaryFun<variant<T...>, I + 1> {
+  using ImaginaryFun<variant<T...>, I + 1>::Run;
+
+  // NOTE: const& and && are used instead of by-value due to lack of guaranteed
+  // move elision of C++17. This may have other minor differences, but tests
+  // pass.
+  static SizeT<I> Run(const H&, SizeT<I>);
+  static SizeT<I> Run(H&&, SizeT<I>);
+};
+
+// The following metafunctions are used in constructor and assignment
+// constraints.
+template <class Self, class T>
+struct IsNeitherSelfNorInPlace : std::true_type {};
+
+template <class Self>
+struct IsNeitherSelfNorInPlace<Self, Self> : std::false_type {};
+
+template <class Self, class T>
+struct IsNeitherSelfNorInPlace<Self, in_place_type_t<T>> : std::false_type {};
+
+template <class Self, std::size_t I>
+struct IsNeitherSelfNorInPlace<Self, in_place_index_t<I>> : std::false_type {};
+
+template <class Variant, class T, class = void>
+struct ConversionIsPossibleImpl : std::false_type {};
+
+template <class Variant, class T>
+struct ConversionIsPossibleImpl<
+    Variant, T,
+    void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
+    : std::true_type {};
+
+template <class Variant, class T>
+struct ConversionIsPossible : ConversionIsPossibleImpl<Variant, T>::type {};
+
+template <class Variant, class T>
+struct IndexOfConstructedType<
+    Variant, T,
+    void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
+    : decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {})) {};
+
+template <std::size_t... Is>
+struct ContainsVariantNPos
+    : absl::negation<std::is_same<  // NOLINT
+          absl::integer_sequence<bool, 0 <= Is...>,
+          absl::integer_sequence<bool, Is != absl::variant_npos...>>> {};
+
+template <class Op, class... QualifiedVariants>
+using RawVisitResult =
+    absl::result_of_t<Op(VariantAccessResult<0, QualifiedVariants>...)>;
+
+// NOTE: The spec requires that all return-paths yield the same type and is not
+// SFINAE-friendly, so we can deduce the return type by examining the first
+// result. If it's not callable, then we get an error, but are compliant and
+// fast to compile.
+// TODO(calabrese) Possibly rewrite in a way that yields better compile errors
+// at the cost of longer compile-times.
+template <class Op, class... QualifiedVariants>
+struct VisitResultImpl {
+  using type =
+      absl::result_of_t<Op(VariantAccessResult<0, QualifiedVariants>...)>;
+};
+
+// Done in two steps intentionally so that we don't cause substitution to fail.
+template <class Op, class... QualifiedVariants>
+using VisitResult = typename VisitResultImpl<Op, QualifiedVariants...>::type;
+
+template <class Op, class... QualifiedVariants>
+struct PerformVisitation {
+  using ReturnType = VisitResult<Op, QualifiedVariants...>;
+
+  template <std::size_t... Is>
+  constexpr ReturnType operator()(SizeT<Is>... indices) const {
+    return Run(typename ContainsVariantNPos<Is...>::type{},
+               absl::index_sequence_for<QualifiedVariants...>(), indices...);
+  }
+
+  template <std::size_t... TupIs, std::size_t... Is>
+  constexpr ReturnType Run(std::false_type /*has_valueless*/,
+                           index_sequence<TupIs...>, SizeT<Is>...) const {
+    static_assert(
+        std::is_same<ReturnType,
+                     absl::result_of_t<Op(VariantAccessResult<
+                                          Is, QualifiedVariants>...)>>::value,
+        "All visitation overloads must have the same return type.");
+    return absl::base_internal::Invoke(
+        absl::forward<Op>(op),
+        VariantCoreAccess::Access<Is>(
+            absl::forward<QualifiedVariants>(std::get<TupIs>(variant_tup)))...);
+  }
+
+  template <std::size_t... TupIs, std::size_t... Is>
+  [[noreturn]] ReturnType Run(std::true_type /*has_valueless*/,
+                              index_sequence<TupIs...>, SizeT<Is>...) const {
+    absl::variant_internal::ThrowBadVariantAccess();
+  }
+
+  // TODO(calabrese) Avoid using a tuple, which causes lots of instantiations
+  // Attempts using lambda variadic captures fail on current GCC.
+  std::tuple<QualifiedVariants&&...> variant_tup;
+  Op&& op;
+};
+
+template <class... T>
+union Union;
+
+// We want to allow for variant<> to be trivial. For that, we need the default
+// constructor to be trivial, which means we can't define it ourselves.
+// Instead, we use a non-default constructor that takes NoopConstructorTag
+// that doesn't affect the triviality of the types.
+struct NoopConstructorTag {};
+
+template <std::size_t I>
+struct EmplaceTag {};
+
+template <>
+union Union<> {
+  constexpr explicit Union(NoopConstructorTag) noexcept {}
+};
+
+// Suppress bogus warning on MSVC: MSVC complains that Union<T...> has a defined
+// deleted destructor from the `std::is_destructible` check below.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4624)
+#endif  // _MSC_VER
+
+template <class Head, class... Tail>
+union Union<Head, Tail...> {
+  using TailUnion = Union<Tail...>;
+
+  explicit constexpr Union(NoopConstructorTag /*tag*/) noexcept
+      : tail(NoopConstructorTag()) {}
+
+  template <class... P>
+  explicit constexpr Union(EmplaceTag<0>, P&&... args)
+      : head(absl::forward<P>(args)...) {}
+
+  template <std::size_t I, class... P>
+  explicit constexpr Union(EmplaceTag<I>, P&&... args)
+      : tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {}
+
+  Head head;
+  TailUnion tail;
+};
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif  // _MSC_VER
+
+// TODO(calabrese) Just contain a Union in this union (certain configs fail).
+template <class... T>
+union DestructibleUnionImpl;
+
+template <>
+union DestructibleUnionImpl<> {
+  constexpr explicit DestructibleUnionImpl(NoopConstructorTag) noexcept {}
+};
+
+template <class Head, class... Tail>
+union DestructibleUnionImpl<Head, Tail...> {
+  using TailUnion = DestructibleUnionImpl<Tail...>;
+
+  explicit constexpr DestructibleUnionImpl(NoopConstructorTag /*tag*/) noexcept
+      : tail(NoopConstructorTag()) {}
+
+  template <class... P>
+  explicit constexpr DestructibleUnionImpl(EmplaceTag<0>, P&&... args)
+      : head(absl::forward<P>(args)...) {}
+
+  template <std::size_t I, class... P>
+  explicit constexpr DestructibleUnionImpl(EmplaceTag<I>, P&&... args)
+      : tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {}
+
+  ~DestructibleUnionImpl() {}
+
+  Head head;
+  TailUnion tail;
+};
+
+// This union type is destructible even if one or more T are not trivially
+// destructible. In the case that all T are trivially destructible, then so is
+// this resultant type.
+template <class... T>
+using DestructibleUnion =
+    absl::conditional_t<std::is_destructible<Union<T...>>::value, Union<T...>,
+                        DestructibleUnionImpl<T...>>;
+
+// Deepest base, containing the actual union and the discriminator
+template <class H, class... T>
+class VariantStateBase {
+ protected:
+  using Variant = variant<H, T...>;
+
+  template <class LazyH = H,
+            class ConstructibleH = absl::enable_if_t<
+                std::is_default_constructible<LazyH>::value, LazyH>>
+  constexpr VariantStateBase() noexcept(
+      std::is_nothrow_default_constructible<ConstructibleH>::value)
+      : state_(EmplaceTag<0>()), index_(0) {}
+
+  template <std::size_t I, class... P>
+  explicit constexpr VariantStateBase(EmplaceTag<I> tag, P&&... args)
+      : state_(tag, absl::forward<P>(args)...), index_(I) {}
+
+  explicit constexpr VariantStateBase(NoopConstructorTag)
+      : state_(NoopConstructorTag()), index_(variant_npos) {}
+
+  void destroy() {}  // Does nothing (shadowed in child if non-trivial)
+
+  DestructibleUnion<H, T...> state_;
+  std::size_t index_;
+};
+
+using absl::internal::identity;
+
+// OverloadSet::Overload() is a unary function which is overloaded to
+// take any of the element types of the variant, by reference-to-const.
+// The return type of the overload on T is identity<T>, so that you
+// can statically determine which overload was called.
+//
+// Overload() is not defined, so it can only be called in unevaluated
+// contexts.
+template <typename... Ts>
+struct OverloadSet;
+
+template <typename T, typename... Ts>
+struct OverloadSet<T, Ts...> : OverloadSet<Ts...> {
+  using Base = OverloadSet<Ts...>;
+  static identity<T> Overload(const T&);
+  using Base::Overload;
+};
+
+template <>
+struct OverloadSet<> {
+  // For any case not handled above.
+  static void Overload(...);
+};
+
+template <class T>
+using LessThanResult = decltype(std::declval<T>() < std::declval<T>());
+
+template <class T>
+using GreaterThanResult = decltype(std::declval<T>() > std::declval<T>());
+
+template <class T>
+using LessThanOrEqualResult = decltype(std::declval<T>() <= std::declval<T>());
+
+template <class T>
+using GreaterThanOrEqualResult =
+    decltype(std::declval<T>() >= std::declval<T>());
+
+template <class T>
+using EqualResult = decltype(std::declval<T>() == std::declval<T>());
+
+template <class T>
+using NotEqualResult = decltype(std::declval<T>() != std::declval<T>());
+
+using type_traits_internal::is_detected_convertible;
+
+template <class... T>
+using RequireAllHaveEqualT = absl::enable_if_t<
+    absl::conjunction<is_detected_convertible<bool, EqualResult, T>...>::value,
+    bool>;
+
+template <class... T>
+using RequireAllHaveNotEqualT =
+    absl::enable_if_t<absl::conjunction<is_detected_convertible<
+                          bool, NotEqualResult, T>...>::value,
+                      bool>;
+
+template <class... T>
+using RequireAllHaveLessThanT =
+    absl::enable_if_t<absl::conjunction<is_detected_convertible<
+                          bool, LessThanResult, T>...>::value,
+                      bool>;
+
+template <class... T>
+using RequireAllHaveLessThanOrEqualT =
+    absl::enable_if_t<absl::conjunction<is_detected_convertible<
+                          bool, LessThanOrEqualResult, T>...>::value,
+                      bool>;
+
+template <class... T>
+using RequireAllHaveGreaterThanOrEqualT =
+    absl::enable_if_t<absl::conjunction<is_detected_convertible<
+                          bool, GreaterThanOrEqualResult, T>...>::value,
+                      bool>;
+
+template <class... T>
+using RequireAllHaveGreaterThanT =
+    absl::enable_if_t<absl::conjunction<is_detected_convertible<
+                          bool, GreaterThanResult, T>...>::value,
+                      bool>;
+
+// Helper template containing implementations details of variant that can't go
+// in the private section. For convenience, this takes the variant type as a
+// single template parameter.
+template <typename T>
+struct VariantHelper;
+
+template <typename... Ts>
+struct VariantHelper<variant<Ts...>> {
+  // Type metafunction which returns the element type selected if
+  // OverloadSet::Overload() is well-formed when called with argument type U.
+  template <typename U>
+  using BestMatch = decltype(
+      variant_internal::OverloadSet<Ts...>::Overload(std::declval<U>()));
+
+  // Type metafunction which returns true if OverloadSet::Overload() is
+  // well-formed when called with argument type U.
+  // CanAccept can't be just an alias because there is a MSVC bug on parameter
+  // pack expansion involving decltype.
+  template <typename U>
+  struct CanAccept :
+      std::integral_constant<bool, !std::is_void<BestMatch<U>>::value> {};
+
+  // Type metafunction which returns true if Other is an instantiation of
+  // variant, and variants's converting constructor from Other will be
+  // well-formed. We will use this to remove constructors that would be
+  // ill-formed from the overload set.
+  template <typename Other>
+  struct CanConvertFrom;
+
+  template <typename... Us>
+  struct CanConvertFrom<variant<Us...>>
+      : public absl::conjunction<CanAccept<Us>...> {};
+};
+
+// A type with nontrivial copy ctor and trivial move ctor.
+struct TrivialMoveOnly {
+  TrivialMoveOnly(TrivialMoveOnly&&) = default;
+};
+
+// Trait class to detect whether a type is trivially move constructible.
+// A union's defaulted copy/move constructor is deleted if any variant member's
+// copy/move constructor is nontrivial.
+template <typename T>
+struct IsTriviallyMoveConstructible:
+  std::is_move_constructible<Union<T, TrivialMoveOnly>> {};
+
+// To guarantee triviality of all special-member functions that can be trivial,
+// we use a chain of conditional bases for each one.
+// The order of inheritance of bases from child to base are logically:
+//
+// variant
+// VariantCopyAssignBase
+// VariantMoveAssignBase
+// VariantCopyBase
+// VariantMoveBase
+// VariantStateBaseDestructor
+// VariantStateBase
+//
+// Note that there is a separate branch at each base that is dependent on
+// whether or not that corresponding special-member-function can be trivial in
+// the resultant variant type.
+
+template <class... T>
+class VariantStateBaseDestructorNontrivial;
+
+template <class... T>
+class VariantMoveBaseNontrivial;
+
+template <class... T>
+class VariantCopyBaseNontrivial;
+
+template <class... T>
+class VariantMoveAssignBaseNontrivial;
+
+template <class... T>
+class VariantCopyAssignBaseNontrivial;
+
+// Base that is dependent on whether or not the destructor can be trivial.
+template <class... T>
+using VariantStateBaseDestructor =
+    absl::conditional_t<std::is_destructible<Union<T...>>::value,
+                        VariantStateBase<T...>,
+                        VariantStateBaseDestructorNontrivial<T...>>;
+
+// Base that is dependent on whether or not the move-constructor can be
+// implicitly generated by the compiler (trivial or deleted).
+// Previously we were using `std::is_move_constructible<Union<T...>>` to check
+// whether all Ts have trivial move constructor, but it ran into a GCC bug:
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84866
+// So we have to use a different approach (i.e. `HasTrivialMoveConstructor`) to
+// work around the bug.
+template <class... T>
+using VariantMoveBase = absl::conditional_t<
+    absl::disjunction<
+        absl::negation<absl::conjunction<std::is_move_constructible<T>...>>,
+        absl::conjunction<IsTriviallyMoveConstructible<T>...>>::value,
+    VariantStateBaseDestructor<T...>, VariantMoveBaseNontrivial<T...>>;
+
+// Base that is dependent on whether or not the copy-constructor can be trivial.
+template <class... T>
+using VariantCopyBase = absl::conditional_t<
+    absl::disjunction<
+        absl::negation<absl::conjunction<std::is_copy_constructible<T>...>>,
+        std::is_copy_constructible<Union<T...>>>::value,
+    VariantMoveBase<T...>, VariantCopyBaseNontrivial<T...>>;
+
+// Base that is dependent on whether or not the move-assign can be trivial.
+template <class... T>
+using VariantMoveAssignBase = absl::conditional_t<
+    absl::disjunction<
+        absl::conjunction<absl::is_move_assignable<Union<T...>>,
+                          std::is_move_constructible<Union<T...>>,
+                          std::is_destructible<Union<T...>>>,
+        absl::negation<absl::conjunction<std::is_move_constructible<T>...,
+                                         // Note: We're not qualifying this with
+                                         // absl:: because it doesn't compile
+                                         // under MSVC.
+                                         is_move_assignable<T>...>>>::value,
+    VariantCopyBase<T...>, VariantMoveAssignBaseNontrivial<T...>>;
+
+// Base that is dependent on whether or not the copy-assign can be trivial.
+template <class... T>
+using VariantCopyAssignBase = absl::conditional_t<
+    absl::disjunction<
+        absl::conjunction<absl::is_copy_assignable<Union<T...>>,
+                          std::is_copy_constructible<Union<T...>>,
+                          std::is_destructible<Union<T...>>>,
+        absl::negation<absl::conjunction<std::is_copy_constructible<T>...,
+                                         // Note: We're not qualifying this with
+                                         // absl:: because it doesn't compile
+                                         // under MSVC.
+                                         is_copy_assignable<T>...>>>::value,
+    VariantMoveAssignBase<T...>, VariantCopyAssignBaseNontrivial<T...>>;
+
+template <class... T>
+using VariantBase = VariantCopyAssignBase<T...>;
+
+template <class... T>
+class VariantStateBaseDestructorNontrivial : protected VariantStateBase<T...> {
+ private:
+  using Base = VariantStateBase<T...>;
+
+ protected:
+  using Base::Base;
+
+  VariantStateBaseDestructorNontrivial() = default;
+  VariantStateBaseDestructorNontrivial(VariantStateBaseDestructorNontrivial&&) =
+      default;
+  VariantStateBaseDestructorNontrivial(
+      const VariantStateBaseDestructorNontrivial&) = default;
+  VariantStateBaseDestructorNontrivial& operator=(
+      VariantStateBaseDestructorNontrivial&&) = default;
+  VariantStateBaseDestructorNontrivial& operator=(
+      const VariantStateBaseDestructorNontrivial&) = default;
+
+  struct Destroyer {
+    template <std::size_t I>
+    void operator()(SizeT<I> i) const {
+      using Alternative =
+          typename absl::variant_alternative<I, variant<T...>>::type;
+      variant_internal::AccessUnion(self->state_, i).~Alternative();
+    }
+
+    void operator()(SizeT<absl::variant_npos> /*i*/) const {
+      // This space intentionally left blank
+    }
+
+    VariantStateBaseDestructorNontrivial* self;
+  };
+
+  void destroy() { VisitIndices<sizeof...(T)>::Run(Destroyer{this}, index_); }
+
+  ~VariantStateBaseDestructorNontrivial() { destroy(); }
+
+ protected:
+  using Base::index_;
+  using Base::state_;
+};
+
+template <class... T>
+class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor<T...> {
+ private:
+  using Base = VariantStateBaseDestructor<T...>;
+
+ protected:
+  using Base::Base;
+
+  struct Construct {
+    template <std::size_t I>
+    void operator()(SizeT<I> i) const {
+      using Alternative =
+          typename absl::variant_alternative<I, variant<T...>>::type;
+      ::new (static_cast<void*>(&self->state_)) Alternative(
+          variant_internal::AccessUnion(absl::move(other->state_), i));
+    }
+
+    void operator()(SizeT<absl::variant_npos> /*i*/) const {}
+
+    VariantMoveBaseNontrivial* self;
+    VariantMoveBaseNontrivial* other;
+  };
+
+  VariantMoveBaseNontrivial() = default;
+  VariantMoveBaseNontrivial(VariantMoveBaseNontrivial&& other) noexcept(
+      absl::conjunction<std::is_nothrow_move_constructible<T>...>::value)
+      : Base(NoopConstructorTag()) {
+    VisitIndices<sizeof...(T)>::Run(Construct{this, &other}, other.index_);
+    index_ = other.index_;
+  }
+
+  VariantMoveBaseNontrivial(VariantMoveBaseNontrivial const&) = default;
+
+  VariantMoveBaseNontrivial& operator=(VariantMoveBaseNontrivial&&) = default;
+  VariantMoveBaseNontrivial& operator=(VariantMoveBaseNontrivial const&) =
+      default;
+
+ protected:
+  using Base::index_;
+  using Base::state_;
+};
+
+template <class... T>
+class VariantCopyBaseNontrivial : protected VariantMoveBase<T...> {
+ private:
+  using Base = VariantMoveBase<T...>;
+
+ protected:
+  using Base::Base;
+
+  VariantCopyBaseNontrivial() = default;
+  VariantCopyBaseNontrivial(VariantCopyBaseNontrivial&&) = default;
+
+  struct Construct {
+    template <std::size_t I>
+    void operator()(SizeT<I> i) const {
+      using Alternative =
+          typename absl::variant_alternative<I, variant<T...>>::type;
+      ::new (static_cast<void*>(&self->state_))
+          Alternative(variant_internal::AccessUnion(other->state_, i));
+    }
+
+    void operator()(SizeT<absl::variant_npos> /*i*/) const {}
+
+    VariantCopyBaseNontrivial* self;
+    const VariantCopyBaseNontrivial* other;
+  };
+
+  VariantCopyBaseNontrivial(VariantCopyBaseNontrivial const& other)
+      : Base(NoopConstructorTag()) {
+    VisitIndices<sizeof...(T)>::Run(Construct{this, &other}, other.index_);
+    index_ = other.index_;
+  }
+
+  VariantCopyBaseNontrivial& operator=(VariantCopyBaseNontrivial&&) = default;
+  VariantCopyBaseNontrivial& operator=(VariantCopyBaseNontrivial const&) =
+      default;
+
+ protected:
+  using Base::index_;
+  using Base::state_;
+};
+
+template <class... T>
+class VariantMoveAssignBaseNontrivial : protected VariantCopyBase<T...> {
+  friend struct VariantCoreAccess;
+
+ private:
+  using Base = VariantCopyBase<T...>;
+
+ protected:
+  using Base::Base;
+
+  VariantMoveAssignBaseNontrivial() = default;
+  VariantMoveAssignBaseNontrivial(VariantMoveAssignBaseNontrivial&&) = default;
+  VariantMoveAssignBaseNontrivial(const VariantMoveAssignBaseNontrivial&) =
+      default;
+  VariantMoveAssignBaseNontrivial& operator=(
+      VariantMoveAssignBaseNontrivial const&) = default;
+
+    VariantMoveAssignBaseNontrivial&
+    operator=(VariantMoveAssignBaseNontrivial&& other) noexcept(
+        absl::conjunction<std::is_nothrow_move_constructible<T>...,
+                          std::is_nothrow_move_assignable<T>...>::value) {
+      VisitIndices<sizeof...(T)>::Run(
+          VariantCoreAccess::MakeMoveAssignVisitor(this, &other), other.index_);
+      return *this;
+    }
+
+ protected:
+  using Base::index_;
+  using Base::state_;
+};
+
+template <class... T>
+class VariantCopyAssignBaseNontrivial : protected VariantMoveAssignBase<T...> {
+  friend struct VariantCoreAccess;
+
+ private:
+  using Base = VariantMoveAssignBase<T...>;
+
+ protected:
+  using Base::Base;
+
+  VariantCopyAssignBaseNontrivial() = default;
+  VariantCopyAssignBaseNontrivial(VariantCopyAssignBaseNontrivial&&) = default;
+  VariantCopyAssignBaseNontrivial(const VariantCopyAssignBaseNontrivial&) =
+      default;
+  VariantCopyAssignBaseNontrivial& operator=(
+      VariantCopyAssignBaseNontrivial&&) = default;
+
+    VariantCopyAssignBaseNontrivial& operator=(
+        const VariantCopyAssignBaseNontrivial& other) {
+      VisitIndices<sizeof...(T)>::Run(
+          VariantCoreAccess::MakeCopyAssignVisitor(this, other), other.index_);
+      return *this;
+    }
+
+ protected:
+  using Base::index_;
+  using Base::state_;
+};
+
+////////////////////////////////////////
+// Visitors for Comparison Operations //
+////////////////////////////////////////
+
+template <class... Types>
+struct EqualsOp {
+  const variant<Types...>* v;
+  const variant<Types...>* w;
+
+  constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
+    return true;
+  }
+
+  template <std::size_t I>
+  constexpr bool operator()(SizeT<I> /*v_i*/) const {
+    return VariantCoreAccess::Access<I>(*v) == VariantCoreAccess::Access<I>(*w);
+  }
+};
+
+template <class... Types>
+struct NotEqualsOp {
+  const variant<Types...>* v;
+  const variant<Types...>* w;
+
+  constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
+    return false;
+  }
+
+  template <std::size_t I>
+  constexpr bool operator()(SizeT<I> /*v_i*/) const {
+    return VariantCoreAccess::Access<I>(*v) != VariantCoreAccess::Access<I>(*w);
+  }
+};
+
+template <class... Types>
+struct LessThanOp {
+  const variant<Types...>* v;
+  const variant<Types...>* w;
+
+  constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
+    return false;
+  }
+
+  template <std::size_t I>
+  constexpr bool operator()(SizeT<I> /*v_i*/) const {
+    return VariantCoreAccess::Access<I>(*v) < VariantCoreAccess::Access<I>(*w);
+  }
+};
+
+template <class... Types>
+struct GreaterThanOp {
+  const variant<Types...>* v;
+  const variant<Types...>* w;
+
+  constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
+    return false;
+  }
+
+  template <std::size_t I>
+  constexpr bool operator()(SizeT<I> /*v_i*/) const {
+    return VariantCoreAccess::Access<I>(*v) > VariantCoreAccess::Access<I>(*w);
+  }
+};
+
+template <class... Types>
+struct LessThanOrEqualsOp {
+  const variant<Types...>* v;
+  const variant<Types...>* w;
+
+  constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
+    return true;
+  }
+
+  template <std::size_t I>
+  constexpr bool operator()(SizeT<I> /*v_i*/) const {
+    return VariantCoreAccess::Access<I>(*v) <= VariantCoreAccess::Access<I>(*w);
+  }
+};
+
+template <class... Types>
+struct GreaterThanOrEqualsOp {
+  const variant<Types...>* v;
+  const variant<Types...>* w;
+
+  constexpr bool operator()(SizeT<absl::variant_npos> /*v_i*/) const {
+    return true;
+  }
+
+  template <std::size_t I>
+  constexpr bool operator()(SizeT<I> /*v_i*/) const {
+    return VariantCoreAccess::Access<I>(*v) >= VariantCoreAccess::Access<I>(*w);
+  }
+};
+
+// Precondition: v.index() == w.index();
+template <class... Types>
+struct SwapSameIndex {
+  variant<Types...>* v;
+  variant<Types...>* w;
+  template <std::size_t I>
+  void operator()(SizeT<I>) const {
+    type_traits_internal::Swap(VariantCoreAccess::Access<I>(*v),
+                               VariantCoreAccess::Access<I>(*w));
+  }
+
+  void operator()(SizeT<variant_npos>) const {}
+};
+
+// TODO(calabrese) do this from a different namespace for proper adl usage
+template <class... Types>
+struct Swap {
+  variant<Types...>* v;
+  variant<Types...>* w;
+
+  void generic_swap() const {
+    variant<Types...> tmp(std::move(*w));
+    VariantCoreAccess::Destroy(*w);
+    VariantCoreAccess::InitFrom(*w, std::move(*v));
+    VariantCoreAccess::Destroy(*v);
+    VariantCoreAccess::InitFrom(*v, std::move(tmp));
+  }
+
+  void operator()(SizeT<absl::variant_npos> /*w_i*/) const {
+    if (!v->valueless_by_exception()) {
+      generic_swap();
+    }
+  }
+
+  template <std::size_t Wi>
+  void operator()(SizeT<Wi> /*w_i*/) {
+    if (v->index() == Wi) {
+      VisitIndices<sizeof...(Types)>::Run(SwapSameIndex<Types...>{v, w}, Wi);
+    } else {
+      generic_swap();
+    }
+  }
+};
+
+template <typename Variant, typename = void, typename... Ts>
+struct VariantHashBase {
+  VariantHashBase() = delete;
+  VariantHashBase(const VariantHashBase&) = delete;
+  VariantHashBase(VariantHashBase&&) = delete;
+  VariantHashBase& operator=(const VariantHashBase&) = delete;
+  VariantHashBase& operator=(VariantHashBase&&) = delete;
+};
+
+struct VariantHashVisitor {
+  template <typename T>
+  size_t operator()(const T& t) {
+    return std::hash<T>{}(t);
+  }
+};
+
+template <typename Variant, typename... Ts>
+struct VariantHashBase<Variant,
+                       absl::enable_if_t<absl::conjunction<
+                           type_traits_internal::IsHashable<Ts>...>::value>,
+                       Ts...> {
+  using argument_type = Variant;
+  using result_type = size_t;
+  size_t operator()(const Variant& var) const {
+    type_traits_internal::AssertHashEnabled<Ts...>();
+    if (var.valueless_by_exception()) {
+      return 239799884;
+    }
+    size_t result = VisitIndices<variant_size<Variant>::value>::Run(
+        PerformVisitation<VariantHashVisitor, const Variant&>{
+            std::forward_as_tuple(var), VariantHashVisitor{}},
+        var.index());
+    // Combine the index and the hash result in order to distinguish
+    // std::variant<int, int> holding the same value as different alternative.
+    return result ^ var.index();
+  }
+};
+
+}  // namespace variant_internal
+}  // namespace absl
+
+#endif  // !defined(ABSL_HAVE_STD_VARIANT)
+#endif  // ABSL_TYPES_variant_internal_H_
index f1b41ac..142dc83 100644 (file)
@@ -1,11 +1,10 @@
-//
 // Copyright 2017 The Abseil Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #ifndef ABSL_TYPES_OPTIONAL_H_
 #define ABSL_TYPES_OPTIONAL_H_
 
-#include "absl/base/config.h"
+#include "absl/base/config.h"   // TODO(calabrese) IWYU removal?
 #include "absl/utility/utility.h"
 
 #ifdef ABSL_HAVE_STD_OPTIONAL
 
-#include <optional>
+#include <optional>  // IWYU pragma: export
 
 namespace absl {
 using std::bad_optional_access;
@@ -49,52 +48,43 @@ using std::optional;
 using std::make_optional;
 using std::nullopt_t;
 using std::nullopt;
-}
+}  // namespace absl
 
 #else  // ABSL_HAVE_STD_OPTIONAL
 
 #include <cassert>
 #include <functional>
 #include <initializer_list>
-#include <new>
 #include <type_traits>
 #include <utility>
 
-#include "absl/memory/memory.h"
+#include "absl/base/attributes.h"
+#include "absl/base/internal/inline_variable.h"
 #include "absl/meta/type_traits.h"
 #include "absl/types/bad_optional_access.h"
+#include "absl/types/internal/optional.h"
+
+namespace absl {
 
-// ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
+// nullopt_t
 //
-// Inheriting constructors is supported in GCC 4.8+, Clang 3.3+ and MSVC 2015.
-// __cpp_inheriting_constructors is a predefined macro and a recommended way to
-// check for this language feature, but GCC doesn't support it until 5.0 and
-// Clang doesn't support it until 3.6.
-// Also, MSVC 2015 has a bug: it doesn't inherit the constexpr template
-// constructor. For example, the following code won't work on MSVC 2015 Update3:
-// struct Base {
-//   int t;
-//   template <typename T>
-//   constexpr Base(T t_) : t(t_) {}
-// };
-// struct Foo : Base {
-//   using Base::Base;
-// }
-// constexpr Foo foo(0);  // doesn't work on MSVC 2015
-#if defined(__clang__)
-#if __has_feature(cxx_inheriting_constructors)
-#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
-#endif
-#elif (defined(__GNUC__) &&                                       \
-       (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \
-    (__cpp_inheriting_constructors >= 200802) ||                  \
-    (defined(_MSC_VER) && _MSC_VER >= 1910)
-#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
-#endif
+// Class type for `absl::nullopt` used to indicate an `absl::optional<T>` type
+// that does not contain a value.
+struct nullopt_t {
+  // It must not be default-constructible to avoid ambiguity for opt = {}.
+  explicit constexpr nullopt_t(optional_internal::init_t) noexcept {}
+};
 
-namespace absl {
+// nullopt
+//
+// A tag constant of type `absl::nullopt_t` used to indicate an empty
+// `absl::optional` in certain functions, such as construction or assignment.
+ABSL_INTERNAL_INLINE_CONSTEXPR(nullopt_t, nullopt,
+                               nullopt_t(optional_internal::init_t()));
 
-// optional
+// -----------------------------------------------------------------------------
+// absl::optional
+// -----------------------------------------------------------------------------
 //
 // A value of type `absl::optional<T>` holds either a value of `T` or an
 // "empty" value.  When it holds a value of `T`, it stores it as a direct
@@ -112,372 +102,22 @@ namespace absl {
 //      need the inline variable support in C++17 for external linkage.
 //    * Throws `absl::bad_optional_access` instead of
 //      `std::bad_optional_access`.
-//    * `optional::swap()` and `absl::swap()` relies on
-//      `std::is_(nothrow_)swappable()`, which has been introduced in C++17.
-//      As a workaround, we assume `is_swappable()` is always `true`
-//      and `is_nothrow_swappable()` is the same as `std::is_trivial()`.
 //    * `make_optional()` cannot be declared `constexpr` due to the absence of
 //      guaranteed copy elision.
-template <typename T>
-class optional;
-
-// nullopt_t
-//
-// Class type for `absl::nullopt` used to indicate an `absl::optional<T>` type
-// that does not contain a value.
-struct nullopt_t {
-  struct init_t {};
-  static init_t init;
-
-  // It must not be default-constructible to avoid ambiguity for opt = {}.
-  // Note the non-const reference, which is to eliminate ambiguity for code
-  // like:
-  //
-  // struct S { int value; };
-  //
-  // void Test() {
-  //   optional<S> opt;
-  //   opt = {{}};
-  // }
-  explicit constexpr nullopt_t(init_t& /*unused*/) {}
-};
-
-// nullopt
+//    * The move constructor's `noexcept` specification is stronger, i.e. if the
+//      default allocator is non-throwing (via setting
+//      `ABSL_ALLOCATOR_NOTHROW`), it evaluates to `noexcept(true)`, because
+//      we assume
+//       a) move constructors should only throw due to allocation failure and
+//       b) if T's move constructor allocates, it uses the same allocation
+//          function as the default allocator.
 //
-// A tag constant of type `absl::nullopt_t` used to indicate an empty
-// `absl::optional` in certain functions, such as construction or assignment.
-extern const nullopt_t nullopt;
-
-namespace optional_internal {
-
-struct empty_struct {};
-// This class stores the data in optional<T>.
-// It is specialized based on whether T is trivially destructible.
-// This is the specialization for non trivially destructible type.
-template <typename T, bool = std::is_trivially_destructible<T>::value>
-class optional_data_dtor_base {
-  struct dummy_type {
-    static_assert(sizeof(T) % sizeof(empty_struct) == 0, "");
-    // Use an array to avoid GCC 6 placement-new warning.
-    empty_struct data[sizeof(T) / sizeof(empty_struct)];
-  };
-
- protected:
-  // Whether there is data or not.
-  bool engaged_;
-  // Data storage
-  union {
-    dummy_type dummy_;
-    T data_;
-  };
-
-  void destruct() noexcept {
-    if (engaged_) {
-      data_.~T();
-      engaged_ = false;
-    }
-  }
-
-  // dummy_ must be initialized for constexpr constructor.
-  constexpr optional_data_dtor_base() noexcept : engaged_(false), dummy_{{}} {}
-
-  template <typename... Args>
-  constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args)
-      : engaged_(true), data_(absl::forward<Args>(args)...) {}
-
-  ~optional_data_dtor_base() { destruct(); }
-};
-
-// Specialization for trivially destructible type.
-template <typename T>
-class optional_data_dtor_base<T, true> {
-  struct dummy_type {
-    static_assert(sizeof(T) % sizeof(empty_struct) == 0, "");
-    // Use array to avoid GCC 6 placement-new warning.
-    empty_struct data[sizeof(T) / sizeof(empty_struct)];
-  };
-
- protected:
-  // Whether there is data or not.
-  bool engaged_;
-  // Data storage
-  union {
-    dummy_type dummy_;
-    T data_;
-  };
-  void destruct() noexcept { engaged_ = false; }
-
-  // dummy_ must be initialized for constexpr constructor.
-  constexpr optional_data_dtor_base() noexcept : engaged_(false), dummy_{{}} {}
-
-  template <typename... Args>
-  constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args)
-      : engaged_(true), data_(absl::forward<Args>(args)...) {}
-};
-
-template <typename T>
-class optional_data_base : public optional_data_dtor_base<T> {
- protected:
-  using base = optional_data_dtor_base<T>;
-#if ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
-  using base::base;
-#else
-  optional_data_base() = default;
-
-  template <typename... Args>
-  constexpr explicit optional_data_base(in_place_t t, Args&&... args)
-      : base(t, absl::forward<Args>(args)...) {}
-#endif
-
-  template <typename... Args>
-  void construct(Args&&... args) {
-    // Use dummy_'s address to work around casting cv-qualified T* to void*.
-    ::new (static_cast<void*>(&this->dummy_)) T(std::forward<Args>(args)...);
-    this->engaged_ = true;
-  }
-
-  template <typename U>
-  void assign(U&& u) {
-    if (this->engaged_) {
-      this->data_ = std::forward<U>(u);
-    } else {
-      construct(std::forward<U>(u));
-    }
-  }
-};
-
-// TODO(absl-team): Add another class using
-// std::is_trivially_move_constructible trait when available to match
-// http://cplusplus.github.io/LWG/lwg-defects.html#2900, for types that
-// have trivial move but nontrivial copy.
-// Also, we should be checking is_trivially_copyable here, which is not
-// supported now, so we use is_trivially_* traits instead.
-template <typename T, bool = absl::is_trivially_copy_constructible<T>::value&&
-                          absl::is_trivially_copy_assignable<
-                              typename std::remove_cv<T>::type>::value&&
-                              std::is_trivially_destructible<T>::value>
-class optional_data;
-
-// Trivially copyable types
-template <typename T>
-class optional_data<T, true> : public optional_data_base<T> {
- protected:
-#if ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
-  using optional_data_base<T>::optional_data_base;
-#else
-  optional_data() = default;
-
-  template <typename... Args>
-  constexpr explicit optional_data(in_place_t t, Args&&... args)
-      : optional_data_base<T>(t, absl::forward<Args>(args)...) {}
-#endif
-};
-
-template <typename T>
-class optional_data<T, false> : public optional_data_base<T> {
- protected:
-#if ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
-  using optional_data_base<T>::optional_data_base;
-#else
-  template <typename... Args>
-  constexpr explicit optional_data(in_place_t t, Args&&... args)
-      : optional_data_base<T>(t, absl::forward<Args>(args)...) {}
-#endif
-
-  optional_data() = default;
-
-  optional_data(const optional_data& rhs) {
-    if (rhs.engaged_) {
-      this->construct(rhs.data_);
-    }
-  }
-
-  optional_data(optional_data&& rhs) noexcept(
-      absl::default_allocator_is_nothrow::value ||
-      std::is_nothrow_move_constructible<T>::value) {
-    if (rhs.engaged_) {
-      this->construct(std::move(rhs.data_));
-    }
-  }
-
-  optional_data& operator=(const optional_data& rhs) {
-    if (rhs.engaged_) {
-      this->assign(rhs.data_);
-    } else {
-      this->destruct();
-    }
-    return *this;
-  }
-
-  optional_data& operator=(optional_data&& rhs) noexcept(
-      std::is_nothrow_move_assignable<T>::value&&
-          std::is_nothrow_move_constructible<T>::value) {
-    if (rhs.engaged_) {
-      this->assign(std::move(rhs.data_));
-    } else {
-      this->destruct();
-    }
-    return *this;
-  }
-};
-
-// Ordered by level of restriction, from low to high.
-// Copyable implies movable.
-enum class copy_traits { copyable = 0, movable = 1, non_movable = 2 };
-
-// Base class for enabling/disabling copy/move constructor.
-template <copy_traits>
-class optional_ctor_base;
-
-template <>
-class optional_ctor_base<copy_traits::copyable> {
- public:
-  constexpr optional_ctor_base() = default;
-  optional_ctor_base(const optional_ctor_base&) = default;
-  optional_ctor_base(optional_ctor_base&&) = default;
-  optional_ctor_base& operator=(const optional_ctor_base&) = default;
-  optional_ctor_base& operator=(optional_ctor_base&&) = default;
-};
-
-template <>
-class optional_ctor_base<copy_traits::movable> {
- public:
-  constexpr optional_ctor_base() = default;
-  optional_ctor_base(const optional_ctor_base&) = delete;
-  optional_ctor_base(optional_ctor_base&&) = default;
-  optional_ctor_base& operator=(const optional_ctor_base&) = default;
-  optional_ctor_base& operator=(optional_ctor_base&&) = default;
-};
-
-template <>
-class optional_ctor_base<copy_traits::non_movable> {
- public:
-  constexpr optional_ctor_base() = default;
-  optional_ctor_base(const optional_ctor_base&) = delete;
-  optional_ctor_base(optional_ctor_base&&) = delete;
-  optional_ctor_base& operator=(const optional_ctor_base&) = default;
-  optional_ctor_base& operator=(optional_ctor_base&&) = default;
-};
-
-// Base class for enabling/disabling copy/move assignment.
-template <copy_traits>
-class optional_assign_base;
-
-template <>
-class optional_assign_base<copy_traits::copyable> {
- public:
-  constexpr optional_assign_base() = default;
-  optional_assign_base(const optional_assign_base&) = default;
-  optional_assign_base(optional_assign_base&&) = default;
-  optional_assign_base& operator=(const optional_assign_base&) = default;
-  optional_assign_base& operator=(optional_assign_base&&) = default;
-};
-
-template <>
-class optional_assign_base<copy_traits::movable> {
- public:
-  constexpr optional_assign_base() = default;
-  optional_assign_base(const optional_assign_base&) = default;
-  optional_assign_base(optional_assign_base&&) = default;
-  optional_assign_base& operator=(const optional_assign_base&) = delete;
-  optional_assign_base& operator=(optional_assign_base&&) = default;
-};
-
-template <>
-class optional_assign_base<copy_traits::non_movable> {
- public:
-  constexpr optional_assign_base() = default;
-  optional_assign_base(const optional_assign_base&) = default;
-  optional_assign_base(optional_assign_base&&) = default;
-  optional_assign_base& operator=(const optional_assign_base&) = delete;
-  optional_assign_base& operator=(optional_assign_base&&) = delete;
-};
-
-template <typename T>
-constexpr copy_traits get_ctor_copy_traits() {
-  return std::is_copy_constructible<T>::value
-             ? copy_traits::copyable
-             : std::is_move_constructible<T>::value ? copy_traits::movable
-                                                    : copy_traits::non_movable;
-}
-
-template <typename T>
-constexpr copy_traits get_assign_copy_traits() {
-  return std::is_copy_assignable<T>::value &&
-                 std::is_copy_constructible<T>::value
-             ? copy_traits::copyable
-             : std::is_move_assignable<T>::value &&
-                       std::is_move_constructible<T>::value
-                   ? copy_traits::movable
-                   : copy_traits::non_movable;
-}
-
-// Whether T is constructible or convertible from optional<U>.
-template <typename T, typename U>
-struct is_constructible_convertible_from_optional
-    : std::integral_constant<
-          bool, std::is_constructible<T, optional<U>&>::value ||
-                    std::is_constructible<T, optional<U>&&>::value ||
-                    std::is_constructible<T, const optional<U>&>::value ||
-                    std::is_constructible<T, const optional<U>&&>::value ||
-                    std::is_convertible<optional<U>&, T>::value ||
-                    std::is_convertible<optional<U>&&, T>::value ||
-                    std::is_convertible<const optional<U>&, T>::value ||
-                    std::is_convertible<const optional<U>&&, T>::value> {};
-
-// Whether T is constructible or convertible or assignable from optional<U>.
-template <typename T, typename U>
-struct is_constructible_convertible_assignable_from_optional
-    : std::integral_constant<
-          bool, is_constructible_convertible_from_optional<T, U>::value ||
-                    std::is_assignable<T&, optional<U>&>::value ||
-                    std::is_assignable<T&, optional<U>&&>::value ||
-                    std::is_assignable<T&, const optional<U>&>::value ||
-                    std::is_assignable<T&, const optional<U>&&>::value> {};
-
-// Helper function used by [optional.relops], [optional.comp_with_t],
-// for checking whether an expression is convertible to bool.
-bool convertible_to_bool(bool);
-
-// Base class for std::hash<absl::optional<T>>:
-// If std::hash<std::remove_const_t<T>> is enabled, it provides operator() to
-// compute the hash; Otherwise, it is disabled.
-// Reference N4659 23.14.15 [unord.hash].
-template <typename T, typename = size_t>
-struct optional_hash_base {
-  optional_hash_base() = delete;
-  optional_hash_base(const optional_hash_base&) = delete;
-  optional_hash_base(optional_hash_base&&) = delete;
-  optional_hash_base& operator=(const optional_hash_base&) = delete;
-  optional_hash_base& operator=(optional_hash_base&&) = delete;
-};
-
-template <typename T>
-struct optional_hash_base<T, decltype(std::hash<absl::remove_const_t<T> >()(
-                                 std::declval<absl::remove_const_t<T> >()))> {
-  using argument_type = absl::optional<T>;
-  using result_type = size_t;
-  size_t operator()(const absl::optional<T>& opt) const {
-    if (opt) {
-      return std::hash<absl::remove_const_t<T> >()(*opt);
-    } else {
-      return static_cast<size_t>(0x297814aaad196e6dULL);
-    }
-  }
-};
-
-}  // namespace optional_internal
-
-// -----------------------------------------------------------------------------
-// absl::optional class definition
-// -----------------------------------------------------------------------------
-
 template <typename T>
 class optional : private optional_internal::optional_data<T>,
                  private optional_internal::optional_ctor_base<
-                     optional_internal::get_ctor_copy_traits<T>()>,
+                     optional_internal::ctor_copy_traits<T>::traits>,
                  private optional_internal::optional_assign_base<
-                     optional_internal::get_assign_copy_traits<T>()> {
+                     optional_internal::assign_copy_traits<T>::traits> {
   using data_base = optional_internal::optional_data<T>;
 
  public:
@@ -485,11 +125,11 @@ class optional : private optional_internal::optional_data<T>,
 
   // Constructors
 
-  // Constructs a default-constructed `optional` holding the empty value, NOT a
-  // default constructed `T`.
+  // Constructs an `optional` holding an empty value, NOT a default constructed
+  // `T`.
   constexpr optional() noexcept {}
 
-  // Construct an` optional` initialized with `nullopt` to hold an empty value.
+  // Constructs an `optional` initialized with `nullopt` to hold an empty value.
   constexpr optional(nullopt_t) noexcept {}  // NOLINT(runtime/explicit)
 
   // Copy constructor, standard semantics
@@ -502,13 +142,14 @@ class optional : private optional_internal::optional_data<T>,
   // the arguments `std::forward<Args>(args)...`  within the `optional`.
   // (The `in_place_t` is a tag used to indicate that the contained object
   // should be constructed in-place.)
-  //
-  // TODO(absl-team): Add std::is_constructible<T, Args&&...> SFINAE.
-  template <typename... Args>
-  constexpr explicit optional(in_place_t, Args&&... args)
+  template <typename InPlaceT, typename... Args,
+            absl::enable_if_t<absl::conjunction<
+                std::is_same<InPlaceT, in_place_t>,
+                std::is_constructible<T, Args&&...> >::value>* = nullptr>
+  constexpr explicit optional(InPlaceT, Args&&... args)
       : data_base(in_place_t(), absl::forward<Args>(args)...) {}
 
-  // Constructs a non-empty `optional' direct-initialized value of type `T` from
+  // Constructs a non-empty `optional` direct-initialized value of type `T` from
   // the arguments of an initializer_list and `std::forward<Args>(args)...`.
   // (The `in_place_t` is a tag used to indicate that the contained object
   // should be constructed in-place.)
@@ -692,7 +333,7 @@ class optional : private optional_internal::optional_data<T>,
   // optional::reset()
   //
   // Destroys the inner `T` value of an `absl::optional` if one is present.
-  void reset() noexcept { this->destruct(); }
+  ABSL_ATTRIBUTE_REINITIALIZES void reset() noexcept { this->destruct(); }
 
   // optional::emplace()
   //
@@ -741,11 +382,10 @@ class optional : private optional_internal::optional_data<T>,
   // Swap, standard semantics
   void swap(optional& rhs) noexcept(
       std::is_nothrow_move_constructible<T>::value&&
-          std::is_trivial<T>::value) {
+          type_traits_internal::IsNothrowSwappable<T>::value) {
     if (*this) {
       if (rhs) {
-        using std::swap;
-        swap(**this, *rhs);
+        type_traits_internal::Swap(**this, *rhs);
       } else {
         rhs.construct(std::move(**this));
         this->destruct();
@@ -766,17 +406,24 @@ class optional : private optional_internal::optional_data<T>,
   //
   // Accesses the underlying `T` value's member `m` of an `optional`. If the
   // `optional` is empty, behavior is undefined.
-  constexpr const T* operator->() const { return this->pointer(); }
+  //
+  // If you need myOpt->foo in constexpr, use (*myOpt).foo instead.
+  const T* operator->() const {
+    assert(this->engaged_);
+    return std::addressof(this->data_);
+  }
   T* operator->() {
     assert(this->engaged_);
-    return this->pointer();
+    return std::addressof(this->data_);
   }
 
   // optional::operator*()
   //
-  // Accesses the underlying `T `value of an `optional`. If the `optional` is
+  // Accesses the underlying `T` value of an `optional`. If the `optional` is
   // empty, behavior is undefined.
-  constexpr const T& operator*() const & { return reference(); }
+  constexpr const T& operator*() const& {
+    return ABSL_ASSERT(this->engaged_), reference();
+  }
   T& operator*() & {
     assert(this->engaged_);
     return reference();
@@ -807,6 +454,12 @@ class optional : private optional_internal::optional_data<T>,
   // only if `*this` is empty.
   constexpr bool has_value() const noexcept { return this->engaged_; }
 
+// Suppress bogus warning on MSVC: MSVC complains call to reference() after
+// throw_bad_optional_access() is unreachable.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4702)
+#endif  // _MSC_VER
   // optional::value()
   //
   // Returns a reference to an `optional`s underlying value. The constness
@@ -835,31 +488,38 @@ class optional : private optional_internal::optional_data<T>,
             ? reference()
             : (optional_internal::throw_bad_optional_access(), reference()));
   }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif  // _MSC_VER
 
   // optional::value_or()
   //
-  // Returns either the value of `T` or a passed default `val` if the `optional`
+  // Returns either the value of `T` or a passed default `v` if the `optional`
   // is empty.
   template <typename U>
   constexpr T value_or(U&& v) const& {
+    static_assert(std::is_copy_constructible<value_type>::value,
+                  "optional<T>::value_or: T must by copy constructible");
+    static_assert(std::is_convertible<U&&, value_type>::value,
+                  "optional<T>::value_or: U must be convertible to T");
     return static_cast<bool>(*this)
                ? **this
                : static_cast<T>(absl::forward<U>(v));
   }
   template <typename U>
   T value_or(U&& v) && {  // NOLINT(build/c++11)
+    static_assert(std::is_move_constructible<value_type>::value,
+                  "optional<T>::value_or: T must by move constructible");
+    static_assert(std::is_convertible<U&&, value_type>::value,
+                  "optional<T>::value_or: U must be convertible to T");
     return static_cast<bool>(*this) ? std::move(**this)
                                     : static_cast<T>(std::forward<U>(v));
   }
 
  private:
-  // Private accessors for internal storage viewed as pointer to T.
-  constexpr const T* pointer() const { return &this->data_; }
-  T* pointer() { return &this->data_; }
-
   // Private accessors for internal storage viewed as reference to T.
-  constexpr const T& reference() const { return *this->pointer(); }
-  T& reference() { return *(this->pointer()); }
+  constexpr const T& reference() const { return this->data_; }
+  T& reference() { return this->data_; }
 
   // T constraint checks.  You can't have an optional of nullopt_t, in_place_t
   // or a reference.
@@ -879,12 +539,10 @@ class optional : private optional_internal::optional_data<T>,
 //
 // Performs a swap between two `absl::optional` objects, using standard
 // semantics.
-//
-// NOTE: we assume `is_swappable()` is always `true`. A compile error will
-// result if this is not the case.
-template <typename T,
-          typename std::enable_if<std::is_move_constructible<T>::value,
-                                  bool>::type = false>
+template <typename T, typename std::enable_if<
+                          std::is_move_constructible<T>::value &&
+                              type_traits_internal::IsSwappable<T>::value,
+                          bool>::type = false>
 void swap(optional<T>& a, optional<T>& b) noexcept(noexcept(a.swap(b))) {
   a.swap(b);
 }
@@ -940,7 +598,8 @@ constexpr auto operator==(const optional<T>& x, const optional<U>& y)
     -> decltype(optional_internal::convertible_to_bool(*x == *y)) {
   return static_cast<bool>(x) != static_cast<bool>(y)
              ? false
-             : static_cast<bool>(x) == false ? true : *x == *y;
+             : static_cast<bool>(x) == false ? true
+                                             : static_cast<bool>(*x == *y);
 }
 
 // Returns: If bool(x) != bool(y), true; otherwise, if bool(x) == false, false;
@@ -950,31 +609,32 @@ constexpr auto operator!=(const optional<T>& x, const optional<U>& y)
     -> decltype(optional_internal::convertible_to_bool(*x != *y)) {
   return static_cast<bool>(x) != static_cast<bool>(y)
              ? true
-             : static_cast<bool>(x) == false ? false : *x != *y;
+             : static_cast<bool>(x) == false ? false
+                                             : static_cast<bool>(*x != *y);
 }
 // Returns: If !y, false; otherwise, if !x, true; otherwise *x < *y.
 template <typename T, typename U>
 constexpr auto operator<(const optional<T>& x, const optional<U>& y)
     -> decltype(optional_internal::convertible_to_bool(*x < *y)) {
-  return !y ? false : !x ? true : *x < *y;
+  return !y ? false : !x ? true : static_cast<bool>(*x < *y);
 }
 // Returns: If !x, false; otherwise, if !y, true; otherwise *x > *y.
 template <typename T, typename U>
 constexpr auto operator>(const optional<T>& x, const optional<U>& y)
     -> decltype(optional_internal::convertible_to_bool(*x > *y)) {
-  return !x ? false : !y ? true : *x > *y;
+  return !x ? false : !y ? true : static_cast<bool>(*x > *y);
 }
 // Returns: If !x, true; otherwise, if !y, false; otherwise *x <= *y.
 template <typename T, typename U>
 constexpr auto operator<=(const optional<T>& x, const optional<U>& y)
     -> decltype(optional_internal::convertible_to_bool(*x <= *y)) {
-  return !x ? true : !y ? false : *x <= *y;
+  return !x ? true : !y ? false : static_cast<bool>(*x <= *y);
 }
 // Returns: If !y, true; otherwise, if !x, false; otherwise *x >= *y.
 template <typename T, typename U>
 constexpr auto operator>=(const optional<T>& x, const optional<U>& y)
     -> decltype(optional_internal::convertible_to_bool(*x >= *y)) {
-  return !y ? true : !x ? false : *x >= *y;
+  return !y ? true : !x ? false : static_cast<bool>(*x >= *y);
 }
 
 // Comparison with nullopt [optional.nullops]
@@ -1036,62 +696,62 @@ constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept {
 template <typename T, typename U>
 constexpr auto operator==(const optional<T>& x, const U& v)
     -> decltype(optional_internal::convertible_to_bool(*x == v)) {
-  return static_cast<bool>(x) ? *x == v : false;
+  return static_cast<bool>(x) ? static_cast<bool>(*x == v) : false;
 }
 template <typename T, typename U>
 constexpr auto operator==(const U& v, const optional<T>& x)
     -> decltype(optional_internal::convertible_to_bool(v == *x)) {
-  return static_cast<bool>(x) ? v == *x : false;
+  return static_cast<bool>(x) ? static_cast<bool>(v == *x) : false;
 }
 template <typename T, typename U>
 constexpr auto operator!=(const optional<T>& x, const U& v)
     -> decltype(optional_internal::convertible_to_bool(*x != v)) {
-  return static_cast<bool>(x) ? *x != v : true;
+  return static_cast<bool>(x) ? static_cast<bool>(*x != v) : true;
 }
 template <typename T, typename U>
 constexpr auto operator!=(const U& v, const optional<T>& x)
     -> decltype(optional_internal::convertible_to_bool(v != *x)) {
-  return static_cast<bool>(x) ? v != *x : true;
+  return static_cast<bool>(x) ? static_cast<bool>(v != *x) : true;
 }
 template <typename T, typename U>
 constexpr auto operator<(const optional<T>& x, const U& v)
     -> decltype(optional_internal::convertible_to_bool(*x < v)) {
-  return static_cast<bool>(x) ? *x < v : true;
+  return static_cast<bool>(x) ? static_cast<bool>(*x < v) : true;
 }
 template <typename T, typename U>
 constexpr auto operator<(const U& v, const optional<T>& x)
     -> decltype(optional_internal::convertible_to_bool(v < *x)) {
-  return static_cast<bool>(x) ? v < *x : false;
+  return static_cast<bool>(x) ? static_cast<bool>(v < *x) : false;
 }
 template <typename T, typename U>
 constexpr auto operator<=(const optional<T>& x, const U& v)
     -> decltype(optional_internal::convertible_to_bool(*x <= v)) {
-  return static_cast<bool>(x) ? *x <= v : true;
+  return static_cast<bool>(x) ? static_cast<bool>(*x <= v) : true;
 }
 template <typename T, typename U>
 constexpr auto operator<=(const U& v, const optional<T>& x)
     -> decltype(optional_internal::convertible_to_bool(v <= *x)) {
-  return static_cast<bool>(x) ? v <= *x : false;
+  return static_cast<bool>(x) ? static_cast<bool>(v <= *x) : false;
 }
 template <typename T, typename U>
 constexpr auto operator>(const optional<T>& x, const U& v)
     -> decltype(optional_internal::convertible_to_bool(*x > v)) {
-  return static_cast<bool>(x) ? *x > v : false;
+  return static_cast<bool>(x) ? static_cast<bool>(*x > v) : false;
 }
 template <typename T, typename U>
 constexpr auto operator>(const U& v, const optional<T>& x)
     -> decltype(optional_internal::convertible_to_bool(v > *x)) {
-  return static_cast<bool>(x) ? v > *x : true;
+  return static_cast<bool>(x) ? static_cast<bool>(v > *x) : true;
 }
 template <typename T, typename U>
 constexpr auto operator>=(const optional<T>& x, const U& v)
     -> decltype(optional_internal::convertible_to_bool(*x >= v)) {
-  return static_cast<bool>(x) ? *x >= v : false;
+  return static_cast<bool>(x) ? static_cast<bool>(*x >= v) : false;
 }
 template <typename T, typename U>
 constexpr auto operator>=(const U& v, const optional<T>& x)
     -> decltype(optional_internal::convertible_to_bool(v >= *x)) {
-  return static_cast<bool>(x) ? v >= *x : true;
+  return static_cast<bool>(x) ? static_cast<bool>(v >= *x) : true;
 }
 
 }  // namespace absl
@@ -1105,7 +765,6 @@ struct hash<absl::optional<T> >
 
 }  // namespace std
 
-#undef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
 #undef ABSL_MSVC_CONSTEXPR_BUG_IN_UNION_LIKE_CLASS
 
 #endif  // ABSL_HAVE_STD_OPTIONAL
index e1f006a..b007fc1 100644 (file)
@@ -5,7 +5,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 #include <cstddef>
 #include <initializer_list>
 #include <iterator>
-#include <string>
 #include <type_traits>
 #include <utility>
 
-#include "absl/algorithm/algorithm.h"
 #include "absl/base/internal/throw_delegate.h"
 #include "absl/base/macros.h"
 #include "absl/base/optimization.h"
-#include "absl/base/port.h"
+#include "absl/base/port.h"    // TODO(strel): remove this include
 #include "absl/meta/type_traits.h"
+#include "absl/types/internal/span.h"
 
 namespace absl {
 
-template <typename T>
-class Span;
-
-namespace span_internal {
-// A constexpr min function
-constexpr size_t Min(size_t a, size_t b) noexcept { return a < b ? a : b; }
-
-// Wrappers for access to container data pointers.
-template <typename C>
-constexpr auto GetDataImpl(C& c, char) noexcept  // NOLINT(runtime/references)
-    -> decltype(c.data()) {
-  return c.data();
-}
-
-// Before C++17, std::string::data returns a const char* in all cases.
-inline char* GetDataImpl(std::string& s,  // NOLINT(runtime/references)
-                         int) noexcept {
-  return &s[0];
-}
-
-template <typename C>
-constexpr auto GetData(C& c) noexcept  // NOLINT(runtime/references)
-    -> decltype(GetDataImpl(c, 0)) {
-  return GetDataImpl(c, 0);
-}
-
-// Detection idioms for size() and data().
-template <typename C>
-using HasSize =
-    std::is_integral<absl::decay_t<decltype(std::declval<C&>().size())>>;
-
-// We want to enable conversion from vector<T*> to Span<const T* const> but
-// disable conversion from vector<Derived> to Span<Base>. Here we use
-// the fact that U** is convertible to Q* const* if and only if Q is the same
-// type or a more cv-qualified version of U.  We also decay the result type of
-// data() to avoid problems with classes which have a member function data()
-// which returns a reference.
-template <typename T, typename C>
-using HasData =
-    std::is_convertible<absl::decay_t<decltype(GetData(std::declval<C&>()))>*,
-                        T* const*>;
-
-// Extracts value type from a Container
-template <typename C>
-struct ElementType {
-  using type = typename absl::remove_reference_t<C>::value_type;
-};
-
-template <typename T, size_t N>
-struct ElementType<T (&)[N]> {
-  using type = T;
-};
-
-template <typename C>
-using ElementT = typename ElementType<C>::type;
-
-template <typename T>
-using EnableIfMutable =
-    typename std::enable_if<!std::is_const<T>::value, int>::type;
-
-template <typename T>
-bool EqualImpl(Span<T> a, Span<T> b) {
-  static_assert(std::is_const<T>::value, "");
-  return absl::equal(a.begin(), a.end(), b.begin(), b.end());
-}
-
-template <typename T>
-bool LessThanImpl(Span<T> a, Span<T> b) {
-  static_assert(std::is_const<T>::value, "");
-  return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
-}
-
-// The `IsConvertible` classes here are needed because of the
-// `std::is_convertible` bug in libcxx when compiled with GCC. This build
-// configuration is used by Android NDK toolchain. Reference link:
-// https://bugs.llvm.org/show_bug.cgi?id=27538.
-template <typename From, typename To>
-struct IsConvertibleHelper {
- private:
-  static std::true_type test(To);
-  static std::false_type test(...);
-
- public:
-  using type = decltype(test(std::declval<From>()));
-};
-
-template <typename From, typename To>
-struct IsConvertible : IsConvertibleHelper<From, To>::type {};
-
-// TODO(zhangxy): replace `IsConvertible` with `std::is_convertible` once the
-// older version of libcxx is not supported.
-template <typename From, typename To>
-using EnableIfConvertibleToSpanConst =
-    typename std::enable_if<IsConvertible<From, Span<const To>>::value>::type;
-}  // namespace span_internal
-
 //------------------------------------------------------------------------------
 // Span
 //------------------------------------------------------------------------------
@@ -216,7 +119,7 @@ using EnableIfConvertibleToSpanConst =
 //   // Construct a Span implicitly from a container
 //   void MyRoutine(absl::Span<const int> a) {
 //     ...
-//   };
+//   }
 //   std::vector v = {1,2,3,4,5};
 //   MyRoutine(v)                     // convert to Span<const T>
 //
@@ -224,7 +127,7 @@ using EnableIfConvertibleToSpanConst =
 // point to remains alive, must also ensure that such memory does not get
 // reallocated. Therefore, to avoid undefined behavior, containers with
 // associated span views should not invoke operations that may reallocate memory
-// (such as resizing) or invalidate iterarors into the container.
+// (such as resizing) or invalidate iterators into the container.
 //
 // One common use for a `Span` is when passing arguments to a routine that can
 // accept a variety of array types (e.g. a `std::vector`, `absl::InlinedVector`,
@@ -235,7 +138,7 @@ using EnableIfConvertibleToSpanConst =
 //
 //   void MyRoutine(absl::Span<const int> a) {
 //     ...
-//   };
+//   }
 //
 //   std::vector v = {1,2,3,4,5};
 //   MyRoutine(v);
@@ -279,7 +182,7 @@ class Span {
   using size_type = size_t;
   using difference_type = ptrdiff_t;
 
-  static const size_type npos = -1;
+  static const size_type npos = ~(size_type(0));
 
   constexpr Span() noexcept : Span(nullptr, 0) {}
   constexpr Span(pointer array, size_type length) noexcept
@@ -290,7 +193,8 @@ class Span {
   constexpr Span(T (&a)[N]) noexcept  // NOLINT(runtime/explicit)
       : Span(a, N) {}
 
-  // Explicit reference constructor for a mutable `Span<T>` type
+  // Explicit reference constructor for a mutable `Span<T>` type. Can be
+  // replaced with MakeSpan() to infer the type parameter.
   template <typename V, typename = EnableIfConvertibleFrom<V>,
             typename = EnableIfMutableView<V>>
   explicit Span(V& v) noexcept  // NOLINT(runtime/references)
@@ -378,64 +282,70 @@ class Span {
   //
   // Returns a reference to the i'th element of this span.
   constexpr reference at(size_type i) const {
-    return ABSL_PREDICT_FALSE(i < size())
-               ? ptr_[i]
+    return ABSL_PREDICT_TRUE(i < size())  //
+               ? *(data() + i)
                : (base_internal::ThrowStdOutOfRange(
                       "Span::at failed bounds check"),
-                  ptr_[i]);
+                  *(data() + i));
   }
 
   // Span::front()
   //
   // Returns a reference to the first element of this span.
-  reference front() const noexcept { return ABSL_ASSERT(size() > 0), ptr_[0]; }
+  constexpr reference front() const noexcept {
+    return ABSL_ASSERT(size() > 0), *data();
+  }
 
   // Span::back()
   //
   // Returns a reference to the last element of this span.
-  reference back() const noexcept {
-    return ABSL_ASSERT(size() > 0), ptr_[size() - 1];
+  constexpr reference back() const noexcept {
+    return ABSL_ASSERT(size() > 0), *(data() + size() - 1);
   }
 
   // Span::begin()
   //
   // Returns an iterator to the first element of this span.
-  constexpr iterator begin() const noexcept { return ptr_; }
+  constexpr iterator begin() const noexcept { return data(); }
 
   // Span::cbegin()
   //
   // Returns a const iterator to the first element of this span.
-  constexpr const_iterator cbegin() const noexcept { return ptr_; }
+  constexpr const_iterator cbegin() const noexcept { return begin(); }
 
   // Span::end()
   //
   // Returns an iterator to the last element of this span.
-  iterator end() const noexcept { return ptr_ + len_; }
+  constexpr iterator end() const noexcept { return data() + size(); }
 
   // Span::cend()
   //
   // Returns a const iterator to the last element of this span.
-  const_iterator cend() const noexcept { return end(); }
+  constexpr const_iterator cend() const noexcept { return end(); }
 
   // Span::rbegin()
   //
   // Returns a reverse iterator starting at the last element of this span.
-  reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
+  constexpr reverse_iterator rbegin() const noexcept {
+    return reverse_iterator(end());
+  }
 
   // Span::crbegin()
   //
   // Returns a reverse const iterator starting at the last element of this span.
-  const_reverse_iterator crbegin() const noexcept { return rbegin(); }
+  constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); }
 
   // Span::rend()
   //
   // Returns a reverse iterator starting at the first element of this span.
-  reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
+  constexpr reverse_iterator rend() const noexcept {
+    return reverse_iterator(begin());
+  }
 
   // Span::crend()
   //
   // Returns a reverse iterator starting at the first element of this span.
-  const_reverse_iterator crend() const noexcept { return rend(); }
+  constexpr const_reverse_iterator crend() const noexcept { return rend(); }
 
   // Span mutations
 
@@ -443,7 +353,7 @@ class Span {
   //
   // Removes the first `n` elements from the span.
   void remove_prefix(size_type n) noexcept {
-    assert(len_ >= n);
+    assert(size() >= n);
     ptr_ += n;
     len_ -= n;
   }
@@ -452,22 +362,73 @@ class Span {
   //
   // Removes the last `n` elements from the span.
   void remove_suffix(size_type n) noexcept {
-    assert(len_ >= n);
+    assert(size() >= n);
     len_ -= n;
   }
 
   // Span::subspan()
   //
-  // Returns a `Span` starting at element `pos` and of length `len`, with
-  // proper bounds checking to ensure `len` does not exceed the ptr+size of the
-  // original array. (Spans whose `len` would point past the end of the array
-  // will throw a `std::out_of_range`.)
+  // Returns a `Span` starting at element `pos` and of length `len`. Both `pos`
+  // and `len` are of type `size_type` and thus non-negative. Parameter `pos`
+  // must be <= size(). Any `len` value that points past the end of the span
+  // will be trimmed to at most size() - `pos`. A default `len` value of `npos`
+  // ensures the returned subspan continues until the end of the span.
+  //
+  // Examples:
+  //
+  //   std::vector<int> vec = {10, 11, 12, 13};
+  //   absl::MakeSpan(vec).subspan(1, 2);  // {11, 12}
+  //   absl::MakeSpan(vec).subspan(2, 8);  // {12, 13}
+  //   absl::MakeSpan(vec).subspan(1);     // {11, 12, 13}
+  //   absl::MakeSpan(vec).subspan(4);     // {}
+  //   absl::MakeSpan(vec).subspan(5);     // throws std::out_of_range
   constexpr Span subspan(size_type pos = 0, size_type len = npos) const {
-    return (pos <= len_)
-               ? Span(ptr_ + pos, span_internal::Min(len_ - pos, len))
+    return (pos <= size())
+               ? Span(data() + pos, span_internal::Min(size() - pos, len))
                : (base_internal::ThrowStdOutOfRange("pos > size()"), Span());
   }
 
+  // Span::first()
+  //
+  // Returns a `Span` containing first `len` elements. Parameter `len` is of
+  // type `size_type` and thus non-negative. `len` value must be <= size().
+  //
+  // Examples:
+  //
+  //   std::vector<int> vec = {10, 11, 12, 13};
+  //   absl::MakeSpan(vec).first(1);  // {10}
+  //   absl::MakeSpan(vec).first(3);  // {10, 11, 12}
+  //   absl::MakeSpan(vec).first(5);  // throws std::out_of_range
+  constexpr Span first(size_type len) const {
+    return (len <= size())
+               ? Span(data(), len)
+               : (base_internal::ThrowStdOutOfRange("len > size()"), Span());
+  }
+
+  // Span::last()
+  //
+  // Returns a `Span` containing last `len` elements. Parameter `len` is of
+  // type `size_type` and thus non-negative. `len` value must be <= size().
+  //
+  // Examples:
+  //
+  //   std::vector<int> vec = {10, 11, 12, 13};
+  //   absl::MakeSpan(vec).last(1);  // {13}
+  //   absl::MakeSpan(vec).last(3);  // {11, 12, 13}
+  //   absl::MakeSpan(vec).last(5);  // throws std::out_of_range
+  constexpr Span last(size_type len) const {
+    return (len <= size())
+               ? Span(size() - len + data(), len)
+               : (base_internal::ThrowStdOutOfRange("len > size()"), Span());
+  }
+
+  // Support for absl::Hash.
+  template <typename H>
+  friend H AbslHashValue(H h, Span v) {
+    return H::combine(H::combine_contiguous(std::move(h), v.data(), v.size()),
+                      v.size());
+  }
+
  private:
   pointer ptr_;
   size_type len_;
@@ -493,25 +454,27 @@ const typename Span<T>::size_type Span<T>::npos;
 // operator==
 template <typename T>
 bool operator==(Span<T> a, Span<T> b) {
-  return span_internal::EqualImpl<const T>(a, b);
+  return span_internal::EqualImpl<Span, const T>(a, b);
 }
 template <typename T>
 bool operator==(Span<const T> a, Span<T> b) {
-  return span_internal::EqualImpl<const T>(a, b);
+  return span_internal::EqualImpl<Span, const T>(a, b);
 }
 template <typename T>
 bool operator==(Span<T> a, Span<const T> b) {
-  return span_internal::EqualImpl<const T>(a, b);
+  return span_internal::EqualImpl<Span, const T>(a, b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator==(const U& a, Span<T> b) {
-  return span_internal::EqualImpl<const T>(a, b);
+  return span_internal::EqualImpl<Span, const T>(a, b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator==(Span<T> a, const U& b) {
-  return span_internal::EqualImpl<const T>(a, b);
+  return span_internal::EqualImpl<Span, const T>(a, b);
 }
 
 // operator!=
@@ -527,13 +490,15 @@ template <typename T>
 bool operator!=(Span<T> a, Span<const T> b) {
   return !(a == b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator!=(const U& a, Span<T> b) {
   return !(a == b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator!=(Span<T> a, const U& b) {
   return !(a == b);
 }
@@ -541,25 +506,27 @@ bool operator!=(Span<T> a, const U& b) {
 // operator<
 template <typename T>
 bool operator<(Span<T> a, Span<T> b) {
-  return span_internal::LessThanImpl<const T>(a, b);
+  return span_internal::LessThanImpl<Span, const T>(a, b);
 }
 template <typename T>
 bool operator<(Span<const T> a, Span<T> b) {
-  return span_internal::LessThanImpl<const T>(a, b);
+  return span_internal::LessThanImpl<Span, const T>(a, b);
 }
 template <typename T>
 bool operator<(Span<T> a, Span<const T> b) {
-  return span_internal::LessThanImpl<const T>(a, b);
+  return span_internal::LessThanImpl<Span, const T>(a, b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator<(const U& a, Span<T> b) {
-  return span_internal::LessThanImpl<const T>(a, b);
+  return span_internal::LessThanImpl<Span, const T>(a, b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator<(Span<T> a, const U& b) {
-  return span_internal::LessThanImpl<const T>(a, b);
+  return span_internal::LessThanImpl<Span, const T>(a, b);
 }
 
 // operator>
@@ -575,13 +542,15 @@ template <typename T>
 bool operator>(Span<T> a, Span<const T> b) {
   return b < a;
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator>(const U& a, Span<T> b) {
   return b < a;
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator>(Span<T> a, const U& b) {
   return b < a;
 }
@@ -599,13 +568,15 @@ template <typename T>
 bool operator<=(Span<T> a, Span<const T> b) {
   return !(b < a);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator<=(const U& a, Span<T> b) {
   return !(b < a);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator<=(Span<T> a, const U& b) {
   return !(b < a);
 }
@@ -623,13 +594,15 @@ template <typename T>
 bool operator>=(Span<T> a, Span<const T> b) {
   return !(a < b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator>=(const U& a, Span<T> b) {
   return !(a < b);
 }
-template <typename T, typename U,
-          typename = span_internal::EnableIfConvertibleToSpanConst<U, T>>
+template <
+    typename T, typename U,
+    typename = span_internal::EnableIfConvertibleTo<U, absl::Span<const T>>>
 bool operator>=(Span<T> a, const U& b) {
   return !(a < b);
 }
@@ -660,7 +633,7 @@ bool operator>=(Span<T> a, const U& b) {
 //   MyRoutine(my_vector);                // error, type mismatch
 //
 //   // Explicitly constructing the Span is verbose
-//   MyRoutine(absl::Span<MyComplicatedType>(my_vector);
+//   MyRoutine(absl::Span<MyComplicatedType>(my_vector));
 //
 //   // Use MakeSpan() to make an absl::Span<T>
 //   MyRoutine(absl::MakeSpan(my_vector));
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/variant.h b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/types/variant.h
new file mode 100644 (file)
index 0000000..ebd52d2
--- /dev/null
@@ -0,0 +1,855 @@
+// Copyright 2018 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// -----------------------------------------------------------------------------
+// variant.h
+// -----------------------------------------------------------------------------
+//
+// This header file defines an `absl::variant` type for holding a type-safe
+// value of some prescribed set of types (noted as alternative types), and
+// associated functions for managing variants.
+//
+// The `absl::variant` type is a form of type-safe union. An `absl::variant`
+// should always hold a value of one of its alternative types (except in the
+// "valueless by exception state" -- see below). A default-constructed
+// `absl::variant` will hold the value of its first alternative type, provided
+// it is default-constructable.
+//
+// In exceptional cases due to error, an `absl::variant` can hold no
+// value (known as a "valueless by exception" state), though this is not the
+// norm.
+//
+// As with `absl::optional`, an `absl::variant` -- when it holds a value --
+// allocates a value of that type directly within the `variant` itself; it
+// cannot hold a reference, array, or the type `void`; it can, however, hold a
+// pointer to externally managed memory.
+//
+// `absl::variant` is a C++11 compatible version of the C++17 `std::variant`
+// abstraction and is designed to be a drop-in replacement for code compliant
+// with C++17.
+
+#ifndef ABSL_TYPES_VARIANT_H_
+#define ABSL_TYPES_VARIANT_H_
+
+#include "absl/base/config.h"
+#include "absl/utility/utility.h"
+
+#ifdef ABSL_HAVE_STD_VARIANT
+
+#include <variant>  // IWYU pragma: export
+
+namespace absl {
+using std::bad_variant_access;
+using std::get;
+using std::get_if;
+using std::holds_alternative;
+using std::monostate;
+using std::variant;
+using std::variant_alternative;
+using std::variant_alternative_t;
+using std::variant_npos;
+using std::variant_size;
+using std::variant_size_v;
+using std::visit;
+}  // namespace absl
+
+#else  // ABSL_HAVE_STD_VARIANT
+
+#include <functional>
+#include <new>
+#include <type_traits>
+#include <utility>
+
+#include "absl/base/macros.h"
+#include "absl/base/port.h"
+#include "absl/meta/type_traits.h"
+#include "absl/types/internal/variant.h"
+
+namespace absl {
+
+// -----------------------------------------------------------------------------
+// absl::variant
+// -----------------------------------------------------------------------------
+//
+// An `absl::variant` type is a form of type-safe union. An `absl::variant` --
+// except in exceptional cases -- always holds a value of one of its alternative
+// types.
+//
+// Example:
+//
+//   // Construct a variant that holds either an integer or a std::string and
+//   // assign it to a std::string.
+//   absl::variant<int, std::string> v = std::string("abc");
+//
+//   // A default-contructed variant will hold a value-initialized value of
+//   // the first alternative type.
+//   auto a = absl::variant<int, std::string>();   // Holds an int of value '0'.
+//
+//   // variants are assignable.
+//
+//   // copy assignment
+//   auto v1 = absl::variant<int, std::string>("abc");
+//   auto v2 = absl::variant<int, std::string>(10);
+//   v2 = v1;  // copy assign
+//
+//   // move assignment
+//   auto v1 = absl::variant<int, std::string>("abc");
+//   v1 = absl::variant<int, std::string>(10);
+//
+//   // assignment through type conversion
+//   a = 128;         // variant contains int
+//   a = "128";       // variant contains std::string
+//
+// An `absl::variant` holding a value of one of its alternative types `T` holds
+// an allocation of `T` directly within the variant itself. An `absl::variant`
+// is not allowed to allocate additional storage, such as dynamic memory, to
+// allocate the contained value. The contained value shall be allocated in a
+// region of the variant storage suitably aligned for all alternative types.
+template <typename... Ts>
+class variant;
+
+// swap()
+//
+// Swaps two `absl::variant` values. This function is equivalent to `v.swap(w)`
+// where `v` and `w` are `absl::variant` types.
+//
+// Note that this function requires all alternative types to be both swappable
+// and move-constructible, because any two variants may refer to either the same
+// type (in which case, they will be swapped) or to two different types (in
+// which case the values will need to be moved).
+//
+template <
+    typename... Ts,
+    absl::enable_if_t<
+        absl::conjunction<std::is_move_constructible<Ts>...,
+                          type_traits_internal::IsSwappable<Ts>...>::value,
+        int> = 0>
+void swap(variant<Ts...>& v, variant<Ts...>& w) noexcept(noexcept(v.swap(w))) {
+  v.swap(w);
+}
+
+// variant_size
+//
+// Returns the number of alternative types available for a given `absl::variant`
+// type as a compile-time constant expression. As this is a class template, it
+// is not generally useful for accessing the number of alternative types of
+// any given `absl::variant` instance.
+//
+// Example:
+//
+//   auto a = absl::variant<int, std::string>;
+//   constexpr int num_types =
+//       absl::variant_size<absl::variant<int, std::string>>();
+//
+//   // You can also use the member constant `value`.
+//   constexpr int num_types =
+//       absl::variant_size<absl::variant<int, std::string>>::value;
+//
+//   // `absl::variant_size` is more valuable for use in generic code:
+//   template <typename Variant>
+//   constexpr bool IsVariantMultivalue() {
+//       return absl::variant_size<Variant>() > 1;
+//   }
+//
+// Note that the set of cv-qualified specializations of `variant_size` are
+// provided to ensure that those specializations compile (especially when passed
+// within template logic).
+template <class T>
+struct variant_size;
+
+template <class... Ts>
+struct variant_size<variant<Ts...>>
+    : std::integral_constant<std::size_t, sizeof...(Ts)> {};
+
+// Specialization of `variant_size` for const qualified variants.
+template <class T>
+struct variant_size<const T> : variant_size<T>::type {};
+
+// Specialization of `variant_size` for volatile qualified variants.
+template <class T>
+struct variant_size<volatile T> : variant_size<T>::type {};
+
+// Specialization of `variant_size` for const volatile qualified variants.
+template <class T>
+struct variant_size<const volatile T> : variant_size<T>::type {};
+
+// variant_alternative
+//
+// Returns the alternative type for a given `absl::variant` at the passed
+// index value as a compile-time constant expression. As this is a class
+// template resulting in a type, it is not useful for access of the run-time
+// value of any given `absl::variant` variable.
+//
+// Example:
+//
+//   // The type of the 0th alternative is "int".
+//   using alternative_type_0
+//     = absl::variant_alternative<0, absl::variant<int, std::string>>::type;
+//
+//   static_assert(std::is_same<alternative_type_0, int>::value, "");
+//
+//   // `absl::variant_alternative` is more valuable for use in generic code:
+//   template <typename Variant>
+//   constexpr bool IsFirstElementTrivial() {
+//       return std::is_trivial_v<variant_alternative<0, Variant>::type>;
+//   }
+//
+// Note that the set of cv-qualified specializations of `variant_alternative`
+// are provided to ensure that those specializations compile (especially when
+// passed within template logic).
+template <std::size_t I, class T>
+struct variant_alternative;
+
+template <std::size_t I, class... Types>
+struct variant_alternative<I, variant<Types...>> {
+  using type =
+      variant_internal::VariantAlternativeSfinaeT<I, variant<Types...>>;
+};
+
+// Specialization of `variant_alternative` for const qualified variants.
+template <std::size_t I, class T>
+struct variant_alternative<I, const T> {
+  using type = const typename variant_alternative<I, T>::type;
+};
+
+// Specialization of `variant_alternative` for volatile qualified variants.
+template <std::size_t I, class T>
+struct variant_alternative<I, volatile T> {
+  using type = volatile typename variant_alternative<I, T>::type;
+};
+
+// Specialization of `variant_alternative` for const volatile qualified
+// variants.
+template <std::size_t I, class T>
+struct variant_alternative<I, const volatile T> {
+  using type = const volatile typename variant_alternative<I, T>::type;
+};
+
+// Template type alias for variant_alternative<I, T>::type.
+//
+// Example:
+//
+//   using alternative_type_0
+//     = absl::variant_alternative_t<0, absl::variant<int, std::string>>;
+//   static_assert(std::is_same<alternative_type_0, int>::value, "");
+template <std::size_t I, class T>
+using variant_alternative_t = typename variant_alternative<I, T>::type;
+
+// holds_alternative()
+//
+// Checks whether the given variant currently holds a given alternative type,
+// returning `true` if so.
+//
+// Example:
+//
+//   absl::variant<int, std::string> foo = 42;
+//   if (absl::holds_alternative<int>(foo)) {
+//       std::cout << "The variant holds an integer";
+//   }
+template <class T, class... Types>
+constexpr bool holds_alternative(const variant<Types...>& v) noexcept {
+  static_assert(
+      variant_internal::UnambiguousIndexOfImpl<variant<Types...>, T,
+                                               0>::value != sizeof...(Types),
+      "The type T must occur exactly once in Types...");
+  return v.index() ==
+         variant_internal::UnambiguousIndexOf<variant<Types...>, T>::value;
+}
+
+// get()
+//
+// Returns a reference to the value currently within a given variant, using
+// either a unique alternative type amongst the variant's set of alternative
+// types, or the variant's index value. Attempting to get a variant's value
+// using a type that is not unique within the variant's set of alternative types
+// is a compile-time error. If the index of the alternative being specified is
+// different from the index of the alternative that is currently stored, throws
+// `absl::bad_variant_access`.
+//
+// Example:
+//
+//   auto a = absl::variant<int, std::string>;
+//
+//   // Get the value by type (if unique).
+//   int i = absl::get<int>(a);
+//
+//   auto b = absl::variant<int, int>;
+//
+//   // Getting the value by a type that is not unique is ill-formed.
+//   int j = absl::get<int>(b);     // Compile Error!
+//
+//   // Getting value by index not ambiguous and allowed.
+//   int k = absl::get<1>(b);
+
+// Overload for getting a variant's lvalue by type.
+template <class T, class... Types>
+constexpr T& get(variant<Types...>& v) {  // NOLINT
+  return variant_internal::VariantCoreAccess::CheckedAccess<
+      variant_internal::IndexOf<T, Types...>::value>(v);
+}
+
+// Overload for getting a variant's rvalue by type.
+// Note: `absl::move()` is required to allow use of constexpr in C++11.
+template <class T, class... Types>
+constexpr T&& get(variant<Types...>&& v) {
+  return variant_internal::VariantCoreAccess::CheckedAccess<
+      variant_internal::IndexOf<T, Types...>::value>(absl::move(v));
+}
+
+// Overload for getting a variant's const lvalue by type.
+template <class T, class... Types>
+constexpr const T& get(const variant<Types...>& v) {
+  return variant_internal::VariantCoreAccess::CheckedAccess<
+      variant_internal::IndexOf<T, Types...>::value>(v);
+}
+
+// Overload for getting a variant's const rvalue by type.
+// Note: `absl::move()` is required to allow use of constexpr in C++11.
+template <class T, class... Types>
+constexpr const T&& get(const variant<Types...>&& v) {
+  return variant_internal::VariantCoreAccess::CheckedAccess<
+      variant_internal::IndexOf<T, Types...>::value>(absl::move(v));
+}
+
+// Overload for getting a variant's lvalue by index.
+template <std::size_t I, class... Types>
+constexpr variant_alternative_t<I, variant<Types...>>& get(
+    variant<Types...>& v) {  // NOLINT
+  return variant_internal::VariantCoreAccess::CheckedAccess<I>(v);
+}
+
+// Overload for getting a variant's rvalue by index.
+// Note: `absl::move()` is required to allow use of constexpr in C++11.
+template <std::size_t I, class... Types>
+constexpr variant_alternative_t<I, variant<Types...>>&& get(
+    variant<Types...>&& v) {
+  return variant_internal::VariantCoreAccess::CheckedAccess<I>(absl::move(v));
+}
+
+// Overload for getting a variant's const lvalue by index.
+template <std::size_t I, class... Types>
+constexpr const variant_alternative_t<I, variant<Types...>>& get(
+    const variant<Types...>& v) {
+  return variant_internal::VariantCoreAccess::CheckedAccess<I>(v);
+}
+
+// Overload for getting a variant's const rvalue by index.
+// Note: `absl::move()` is required to allow use of constexpr in C++11.
+template <std::size_t I, class... Types>
+constexpr const variant_alternative_t<I, variant<Types...>>&& get(
+    const variant<Types...>&& v) {
+  return variant_internal::VariantCoreAccess::CheckedAccess<I>(absl::move(v));
+}
+
+// get_if()
+//
+// Returns a pointer to the value currently stored within a given variant, if
+// present, using either a unique alternative type amongst the variant's set of
+// alternative types, or the variant's index value. If such a value does not
+// exist, returns `nullptr`.
+//
+// As with `get`, attempting to get a variant's value using a type that is not
+// unique within the variant's set of alternative types is a compile-time error.
+
+// Overload for getting a pointer to the value stored in the given variant by
+// index.
+template <std::size_t I, class... Types>
+constexpr absl::add_pointer_t<variant_alternative_t<I, variant<Types...>>>
+get_if(variant<Types...>* v) noexcept {
+  return (v != nullptr && v->index() == I)
+             ? std::addressof(
+                   variant_internal::VariantCoreAccess::Access<I>(*v))
+             : nullptr;
+}
+
+// Overload for getting a pointer to the const value stored in the given
+// variant by index.
+template <std::size_t I, class... Types>
+constexpr absl::add_pointer_t<const variant_alternative_t<I, variant<Types...>>>
+get_if(const variant<Types...>* v) noexcept {
+  return (v != nullptr && v->index() == I)
+             ? std::addressof(
+                   variant_internal::VariantCoreAccess::Access<I>(*v))
+             : nullptr;
+}
+
+// Overload for getting a pointer to the value stored in the given variant by
+// type.
+template <class T, class... Types>
+constexpr absl::add_pointer_t<T> get_if(variant<Types...>* v) noexcept {
+  return absl::get_if<variant_internal::IndexOf<T, Types...>::value>(v);
+}
+
+// Overload for getting a pointer to the const value stored in the given variant
+// by type.
+template <class T, class... Types>
+constexpr absl::add_pointer_t<const T> get_if(
+    const variant<Types...>* v) noexcept {
+  return absl::get_if<variant_internal::IndexOf<T, Types...>::value>(v);
+}
+
+// visit()
+//
+// Calls a provided functor on a given set of variants. `absl::visit()` is
+// commonly used to conditionally inspect the state of a given variant (or set
+// of variants).
+//
+// The functor must return the same type when called with any of the variants'
+// alternatives.
+//
+// Example:
+//
+//   // Define a visitor functor
+//   struct GetVariant {
+//       template<typename T>
+//       void operator()(const T& i) const {
+//         std::cout << "The variant's value is: " << i;
+//       }
+//   };
+//
+//   // Declare our variant, and call `absl::visit()` on it.
+//   // Note that `GetVariant()` returns void in either case.
+//   absl::variant<int, std::string> foo = std::string("foo");
+//   GetVariant visitor;
+//   absl::visit(visitor, foo);  // Prints `The variant's value is: foo'
+template <typename Visitor, typename... Variants>
+variant_internal::VisitResult<Visitor, Variants...> visit(Visitor&& vis,
+                                                          Variants&&... vars) {
+  return variant_internal::
+      VisitIndices<variant_size<absl::decay_t<Variants> >::value...>::Run(
+          variant_internal::PerformVisitation<Visitor, Variants...>{
+              std::forward_as_tuple(absl::forward<Variants>(vars)...),
+              absl::forward<Visitor>(vis)},
+          vars.index()...);
+}
+
+// monostate
+//
+// The monostate class serves as a first alternative type for a variant for
+// which the first variant type is otherwise not default-constructible.
+struct monostate {};
+
+// `absl::monostate` Relational Operators
+
+constexpr bool operator<(monostate, monostate) noexcept { return false; }
+constexpr bool operator>(monostate, monostate) noexcept { return false; }
+constexpr bool operator<=(monostate, monostate) noexcept { return true; }
+constexpr bool operator>=(monostate, monostate) noexcept { return true; }
+constexpr bool operator==(monostate, monostate) noexcept { return true; }
+constexpr bool operator!=(monostate, monostate) noexcept { return false; }
+
+
+//------------------------------------------------------------------------------
+// `absl::variant` Template Definition
+//------------------------------------------------------------------------------
+template <typename T0, typename... Tn>
+class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
+  static_assert(absl::conjunction<std::is_object<T0>,
+                                  std::is_object<Tn>...>::value,
+                "Attempted to instantiate a variant containing a non-object "
+                "type.");
+  // Intentionally not qualifying `negation` with `absl::` to work around a bug
+  // in MSVC 2015 with inline namespace and variadic template.
+  static_assert(absl::conjunction<negation<std::is_array<T0> >,
+                                  negation<std::is_array<Tn> >...>::value,
+                "Attempted to instantiate a variant containing an array type.");
+  static_assert(absl::conjunction<std::is_nothrow_destructible<T0>,
+                                  std::is_nothrow_destructible<Tn>...>::value,
+                "Attempted to instantiate a variant containing a non-nothrow "
+                "destructible type.");
+
+  friend struct variant_internal::VariantCoreAccess;
+
+ private:
+  using Base = variant_internal::VariantBase<T0, Tn...>;
+
+ public:
+  // Constructors
+
+  // Constructs a variant holding a default-initialized value of the first
+  // alternative type.
+  constexpr variant() /*noexcept(see 111above)*/ = default;
+
+  // Copy constructor, standard semantics
+  variant(const variant& other) = default;
+
+  // Move constructor, standard semantics
+  variant(variant&& other) /*noexcept(see above)*/ = default;
+
+  // Constructs a variant of an alternative type specified by overload
+  // resolution of the provided forwarding arguments through
+  // direct-initialization.
+  //
+  // Note: If the selected constructor is a constexpr constructor, this
+  // constructor shall be a constexpr constructor.
+  //
+  // NOTE: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0608r1.html
+  // has been voted passed the design phase in the C++ standard meeting in Mar
+  // 2018. It will be implemented and integrated into `absl::variant`.
+  template <
+      class T,
+      std::size_t I = std::enable_if<
+          variant_internal::IsNeitherSelfNorInPlace<variant,
+                                                    absl::decay_t<T>>::value,
+          variant_internal::IndexOfConstructedType<variant, T>>::type::value,
+      class Tj = absl::variant_alternative_t<I, variant>,
+      absl::enable_if_t<std::is_constructible<Tj, T>::value>* =
+          nullptr>
+  constexpr variant(T&& t) noexcept(std::is_nothrow_constructible<Tj, T>::value)
+      : Base(variant_internal::EmplaceTag<I>(), absl::forward<T>(t)) {}
+
+  // Constructs a variant of an alternative type from the arguments through
+  // direct-initialization.
+  //
+  // Note: If the selected constructor is a constexpr constructor, this
+  // constructor shall be a constexpr constructor.
+  template <class T, class... Args,
+            typename std::enable_if<std::is_constructible<
+                variant_internal::UnambiguousTypeOfT<variant, T>,
+                Args...>::value>::type* = nullptr>
+  constexpr explicit variant(in_place_type_t<T>, Args&&... args)
+      : Base(variant_internal::EmplaceTag<
+                 variant_internal::UnambiguousIndexOf<variant, T>::value>(),
+             absl::forward<Args>(args)...) {}
+
+  // Constructs a variant of an alternative type from an initializer list
+  // and other arguments through direct-initialization.
+  //
+  // Note: If the selected constructor is a constexpr constructor, this
+  // constructor shall be a constexpr constructor.
+  template <class T, class U, class... Args,
+            typename std::enable_if<std::is_constructible<
+                variant_internal::UnambiguousTypeOfT<variant, T>,
+                std::initializer_list<U>&, Args...>::value>::type* = nullptr>
+  constexpr explicit variant(in_place_type_t<T>, std::initializer_list<U> il,
+                             Args&&... args)
+      : Base(variant_internal::EmplaceTag<
+                 variant_internal::UnambiguousIndexOf<variant, T>::value>(),
+             il, absl::forward<Args>(args)...) {}
+
+  // Constructs a variant of an alternative type from a provided index,
+  // through value-initialization using the provided forwarded arguments.
+  template <std::size_t I, class... Args,
+            typename std::enable_if<std::is_constructible<
+                variant_internal::VariantAlternativeSfinaeT<I, variant>,
+                Args...>::value>::type* = nullptr>
+  constexpr explicit variant(in_place_index_t<I>, Args&&... args)
+      : Base(variant_internal::EmplaceTag<I>(), absl::forward<Args>(args)...) {}
+
+  // Constructs a variant of an alternative type from a provided index,
+  // through value-initialization of an initializer list and the provided
+  // forwarded arguments.
+  template <std::size_t I, class U, class... Args,
+            typename std::enable_if<std::is_constructible<
+                variant_internal::VariantAlternativeSfinaeT<I, variant>,
+                std::initializer_list<U>&, Args...>::value>::type* = nullptr>
+  constexpr explicit variant(in_place_index_t<I>, std::initializer_list<U> il,
+                             Args&&... args)
+      : Base(variant_internal::EmplaceTag<I>(), il,
+             absl::forward<Args>(args)...) {}
+
+  // Destructors
+
+  // Destroys the variant's currently contained value, provided that
+  // `absl::valueless_by_exception()` is false.
+  ~variant() = default;
+
+  // Assignment Operators
+
+  // Copy assignment operator
+  variant& operator=(const variant& other) = default;
+
+  // Move assignment operator
+  variant& operator=(variant&& other) /*noexcept(see above)*/ = default;
+
+  // Converting assignment operator
+  //
+  // NOTE: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0608r1.html
+  // has been voted passed the design phase in the C++ standard meeting in Mar
+  // 2018. It will be implemented and integrated into `absl::variant`.
+  template <
+      class T,
+      std::size_t I = std::enable_if<
+          !std::is_same<absl::decay_t<T>, variant>::value,
+          variant_internal::IndexOfConstructedType<variant, T>>::type::value,
+      class Tj = absl::variant_alternative_t<I, variant>,
+      typename std::enable_if<std::is_assignable<Tj&, T>::value &&
+                              std::is_constructible<Tj, T>::value>::type* =
+          nullptr>
+  variant& operator=(T&& t) noexcept(
+      std::is_nothrow_assignable<Tj&, T>::value&&
+          std::is_nothrow_constructible<Tj, T>::value) {
+    variant_internal::VisitIndices<sizeof...(Tn) + 1>::Run(
+        variant_internal::VariantCoreAccess::MakeConversionAssignVisitor(
+            this, absl::forward<T>(t)),
+        index());
+
+    return *this;
+  }
+
+
+  // emplace() Functions
+
+  // Constructs a value of the given alternative type T within the variant.
+  //
+  // Example:
+  //
+  //   absl::variant<std::vector<int>, int, std::string> v;
+  //   v.emplace<int>(99);
+  //   v.emplace<std::string>("abc");
+  template <
+      class T, class... Args,
+      typename std::enable_if<std::is_constructible<
+          absl::variant_alternative_t<
+              variant_internal::UnambiguousIndexOf<variant, T>::value, variant>,
+          Args...>::value>::type* = nullptr>
+  T& emplace(Args&&... args) {
+    return variant_internal::VariantCoreAccess::Replace<
+        variant_internal::UnambiguousIndexOf<variant, T>::value>(
+        this, absl::forward<Args>(args)...);
+  }
+
+  // Constructs a value of the given alternative type T within the variant using
+  // an initializer list.
+  //
+  // Example:
+  //
+  //   absl::variant<std::vector<int>, int, std::string> v;
+  //   v.emplace<std::vector<int>>({0, 1, 2});
+  template <
+      class T, class U, class... Args,
+      typename std::enable_if<std::is_constructible<
+          absl::variant_alternative_t<
+              variant_internal::UnambiguousIndexOf<variant, T>::value, variant>,
+          std::initializer_list<U>&, Args...>::value>::type* = nullptr>
+  T& emplace(std::initializer_list<U> il, Args&&... args) {
+    return variant_internal::VariantCoreAccess::Replace<
+        variant_internal::UnambiguousIndexOf<variant, T>::value>(
+        this, il, absl::forward<Args>(args)...);
+  }
+
+  // Destroys the current value of the variant (provided that
+  // `absl::valueless_by_exception()` is false, and constructs a new value at
+  // the given index.
+  //
+  // Example:
+  //
+  //   absl::variant<std::vector<int>, int, int> v;
+  //   v.emplace<1>(99);
+  //   v.emplace<2>(98);
+  //   v.emplace<int>(99);  // Won't compile. 'int' isn't a unique type.
+  template <std::size_t I, class... Args,
+            typename std::enable_if<
+                std::is_constructible<absl::variant_alternative_t<I, variant>,
+                                      Args...>::value>::type* = nullptr>
+  absl::variant_alternative_t<I, variant>& emplace(Args&&... args) {
+    return variant_internal::VariantCoreAccess::Replace<I>(
+        this, absl::forward<Args>(args)...);
+  }
+
+  // Destroys the current value of the variant (provided that
+  // `absl::valueless_by_exception()` is false, and constructs a new value at
+  // the given index using an initializer list and the provided arguments.
+  //
+  // Example:
+  //
+  //   absl::variant<std::vector<int>, int, int> v;
+  //   v.emplace<0>({0, 1, 2});
+  template <std::size_t I, class U, class... Args,
+            typename std::enable_if<std::is_constructible<
+                absl::variant_alternative_t<I, variant>,
+                std::initializer_list<U>&, Args...>::value>::type* = nullptr>
+  absl::variant_alternative_t<I, variant>& emplace(std::initializer_list<U> il,
+                                                   Args&&... args) {
+    return variant_internal::VariantCoreAccess::Replace<I>(
+        this, il, absl::forward<Args>(args)...);
+  }
+
+  // variant::valueless_by_exception()
+  //
+  // Returns false if and only if the variant currently holds a valid value.
+  constexpr bool valueless_by_exception() const noexcept {
+    return this->index_ == absl::variant_npos;
+  }
+
+  // variant::index()
+  //
+  // Returns the index value of the variant's currently selected alternative
+  // type.
+  constexpr std::size_t index() const noexcept { return this->index_; }
+
+  // variant::swap()
+  //
+  // Swaps the values of two variant objects.
+  //
+  void swap(variant& rhs) noexcept(
+      absl::conjunction<
+          std::is_nothrow_move_constructible<T0>,
+          std::is_nothrow_move_constructible<Tn>...,
+          type_traits_internal::IsNothrowSwappable<T0>,
+          type_traits_internal::IsNothrowSwappable<Tn>...>::value) {
+    return variant_internal::VisitIndices<sizeof...(Tn) + 1>::Run(
+        variant_internal::Swap<T0, Tn...>{this, &rhs}, rhs.index());
+  }
+};
+
+// We need a valid declaration of variant<> for SFINAE and overload resolution
+// to work properly above, but we don't need a full declaration since this type
+// will never be constructed. This declaration, though incomplete, suffices.
+template <>
+class variant<>;
+
+//------------------------------------------------------------------------------
+// Relational Operators
+//------------------------------------------------------------------------------
+//
+// If neither operand is in the `variant::valueless_by_exception` state:
+//
+//   * If the index of both variants is the same, the relational operator
+//     returns the result of the corresponding relational operator for the
+//     corresponding alternative type.
+//   * If the index of both variants is not the same, the relational operator
+//     returns the result of that operation applied to the value of the left
+//     operand's index and the value of the right operand's index.
+//   * If at least one operand is in the valueless_by_exception state:
+//     - A variant in the valueless_by_exception state is only considered equal
+//       to another variant in the valueless_by_exception state.
+//     - If exactly one operand is in the valueless_by_exception state, the
+//       variant in the valueless_by_exception state is less than the variant
+//       that is not in the valueless_by_exception state.
+//
+// Note: The value 1 is added to each index in the relational comparisons such
+// that the index corresponding to the valueless_by_exception state wraps around
+// to 0 (the lowest value for the index type), and the remaining indices stay in
+// the same relative order.
+
+// Equal-to operator
+template <typename... Types>
+constexpr variant_internal::RequireAllHaveEqualT<Types...> operator==(
+    const variant<Types...>& a, const variant<Types...>& b) {
+  return (a.index() == b.index()) &&
+         variant_internal::VisitIndices<sizeof...(Types)>::Run(
+             variant_internal::EqualsOp<Types...>{&a, &b}, a.index());
+}
+
+// Not equal operator
+template <typename... Types>
+constexpr variant_internal::RequireAllHaveNotEqualT<Types...> operator!=(
+    const variant<Types...>& a, const variant<Types...>& b) {
+  return (a.index() != b.index()) ||
+         variant_internal::VisitIndices<sizeof...(Types)>::Run(
+             variant_internal::NotEqualsOp<Types...>{&a, &b}, a.index());
+}
+
+// Less-than operator
+template <typename... Types>
+constexpr variant_internal::RequireAllHaveLessThanT<Types...> operator<(
+    const variant<Types...>& a, const variant<Types...>& b) {
+  return (a.index() != b.index())
+             ? (a.index() + 1) < (b.index() + 1)
+             : variant_internal::VisitIndices<sizeof...(Types)>::Run(
+                   variant_internal::LessThanOp<Types...>{&a, &b}, a.index());
+}
+
+// Greater-than operator
+template <typename... Types>
+constexpr variant_internal::RequireAllHaveGreaterThanT<Types...> operator>(
+    const variant<Types...>& a, const variant<Types...>& b) {
+  return (a.index() != b.index())
+             ? (a.index() + 1) > (b.index() + 1)
+             : variant_internal::VisitIndices<sizeof...(Types)>::Run(
+                   variant_internal::GreaterThanOp<Types...>{&a, &b},
+                   a.index());
+}
+
+// Less-than or equal-to operator
+template <typename... Types>
+constexpr variant_internal::RequireAllHaveLessThanOrEqualT<Types...> operator<=(
+    const variant<Types...>& a, const variant<Types...>& b) {
+  return (a.index() != b.index())
+             ? (a.index() + 1) < (b.index() + 1)
+             : variant_internal::VisitIndices<sizeof...(Types)>::Run(
+                   variant_internal::LessThanOrEqualsOp<Types...>{&a, &b},
+                   a.index());
+}
+
+// Greater-than or equal-to operator
+template <typename... Types>
+constexpr variant_internal::RequireAllHaveGreaterThanOrEqualT<Types...>
+operator>=(const variant<Types...>& a, const variant<Types...>& b) {
+  return (a.index() != b.index())
+             ? (a.index() + 1) > (b.index() + 1)
+             : variant_internal::VisitIndices<sizeof...(Types)>::Run(
+                   variant_internal::GreaterThanOrEqualsOp<Types...>{&a, &b},
+                   a.index());
+}
+
+}  // namespace absl
+
+namespace std {
+
+// hash()
+template <>  // NOLINT
+struct hash<absl::monostate> {
+  std::size_t operator()(absl::monostate) const { return 0; }
+};
+
+template <class... T>  // NOLINT
+struct hash<absl::variant<T...>>
+    : absl::variant_internal::VariantHashBase<absl::variant<T...>, void,
+                                              absl::remove_const_t<T>...> {};
+
+}  // namespace std
+
+#endif  // ABSL_HAVE_STD_VARIANT
+
+namespace absl {
+namespace variant_internal {
+
+// Helper visitor for converting a variant<Ts...>` into another type (mostly
+// variant) that can be constructed from any type.
+template <typename To>
+struct ConversionVisitor {
+  template <typename T>
+  To operator()(T&& v) const {
+    return To(std::forward<T>(v));
+  }
+};
+
+}  // namespace variant_internal
+
+// ConvertVariantTo()
+//
+// Helper functions to convert an `absl::variant` to a variant of another set of
+// types, provided that the alternative type of the new variant type can be
+// converted from any type in the source variant.
+//
+// Example:
+//
+//   absl::variant<name1, name2, float> InternalReq(const Req&);
+//
+//   // name1 and name2 are convertible to name
+//   absl::variant<name, float> ExternalReq(const Req& req) {
+//     return absl::ConvertVariantTo<absl::variant<name, float>>(
+//              InternalReq(req));
+//   }
+template <typename To, typename Variant>
+To ConvertVariantTo(Variant&& variant) {
+  return absl::visit(variant_internal::ConversionVisitor<To>{},
+                     std::forward<Variant>(variant));
+}
+
+}  // namespace absl
+
+#endif  // ABSL_TYPES_VARIANT_H_
index 732cd4c..eef8fb4 100644 (file)
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//      http://www.apache.org/licenses/LICENSE-2.0
+//      https://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,6 +23,9 @@
 //   * make_integer_sequence<T, N>   == std::make_integer_sequence<T, N>
 //   * make_index_sequence<N>        == std::make_index_sequence<N>
 //   * index_sequence_for<Ts...>     == std::index_sequence_for<Ts...>
+//   * apply<Functor, Tuple>         == std::apply<Functor, Tuple>
+//   * exchange<T>                   == std::exchange<T>
+//   * make_from_tuple<T>            == std::make_from_tuple<T>
 //
 // This header file also provides the tag types `in_place_t`, `in_place_type_t`,
 // and `in_place_index_t`, as well as the constant `in_place`, and
 //
 // References:
 //
-//  http://en.cppreference.com/w/cpp/utility/integer_sequence
+//  https://en.cppreference.com/w/cpp/utility/integer_sequence
+//  https://en.cppreference.com/w/cpp/utility/apply
 //  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3658.html
-//
-//
-// Example:
-//   // Unpack a tuple for use as a function call's argument list.
-//
-//   template <typename F, typename Tup, size_t... Is>
-//   auto Impl(F f, const Tup& tup, absl::index_sequence<Is...>)
-//       -> decltype(f(std::get<Is>(tup) ...)) {
-//     return f(std::get<Is>(tup) ...);
-//   }
-//
-//   template <typename Tup>
-//   using TupIdxSeq = absl::make_index_sequence<std::tuple_size<Tup>::value>;
-//
-//   template <typename F, typename Tup>
-//   auto ApplyFromTuple(F f, const Tup& tup)
-//       -> decltype(Impl(f, tup, TupIdxSeq<Tup>{})) {
-//     return Impl(f, tup, TupIdxSeq<Tup>{});
-//   }
+
 #ifndef ABSL_UTILITY_UTILITY_H_
 #define ABSL_UTILITY_UTILITY_H_
 
 #include <cstddef>
 #include <cstdlib>
+#include <tuple>
 #include <utility>
 
 #include "absl/base/config.h"
+#include "absl/base/internal/inline_variable.h"
+#include "absl/base/internal/invoke.h"
 #include "absl/meta/type_traits.h"
 
 namespace absl {
@@ -125,6 +114,20 @@ struct Gen<T, 0> {
   using type = integer_sequence<T>;
 };
 
+template <typename T>
+struct InPlaceTypeTag {
+  explicit InPlaceTypeTag() = delete;
+  InPlaceTypeTag(const InPlaceTypeTag&) = delete;
+  InPlaceTypeTag& operator=(const InPlaceTypeTag&) = delete;
+};
+
+template <size_t I>
+struct InPlaceIndexTag {
+  explicit InPlaceIndexTag() = delete;
+  InPlaceIndexTag(const InPlaceIndexTag&) = delete;
+  InPlaceIndexTag& operator=(const InPlaceIndexTag&) = delete;
+};
+
 }  // namespace utility_internal
 
 // Compile-time sequences of integers
@@ -168,11 +171,13 @@ using std::in_place;
 // `absl::optional`, designed to be a drop-in replacement for C++17's
 // `std::in_place_t`.
 struct in_place_t {};
-extern const in_place_t in_place;
+
+ABSL_INTERNAL_INLINE_CONSTEXPR(in_place_t, in_place, {});
 
 #endif  // ABSL_HAVE_STD_OPTIONAL
 
-#ifdef ABSL_HAVE_STD_ANY
+#if defined(ABSL_HAVE_STD_ANY) || defined(ABSL_HAVE_STD_VARIANT)
+using std::in_place_type;
 using std::in_place_type_t;
 #else
 
@@ -182,8 +187,16 @@ using std::in_place_type_t;
 // be specified, such as with `absl::any`, designed to be a drop-in replacement
 // for C++17's `std::in_place_type_t`.
 template <typename T>
-struct in_place_type_t {};
-#endif  // ABSL_HAVE_STD_ANY
+using in_place_type_t = void (*)(utility_internal::InPlaceTypeTag<T>);
+
+template <typename T>
+void in_place_type(utility_internal::InPlaceTypeTag<T>) {}
+#endif  // ABSL_HAVE_STD_ANY || ABSL_HAVE_STD_VARIANT
+
+#ifdef ABSL_HAVE_STD_VARIANT
+using std::in_place_index;
+using std::in_place_index_t;
+#else
 
 // in_place_index_t
 //
@@ -191,7 +204,11 @@ struct in_place_type_t {};
 // be specified, such as with `absl::any`, designed to be a drop-in replacement
 // for C++17's `std::in_place_index_t`.
 template <size_t I>
-struct in_place_index_t {};
+using in_place_index_t = void (*)(utility_internal::InPlaceIndexTag<I>);
+
+template <size_t I>
+void in_place_index(utility_internal::InPlaceIndexTag<I>) {}
+#endif  // ABSL_HAVE_STD_VARIANT
 
 // Constexpr move and forward
 
@@ -214,6 +231,118 @@ constexpr T&& forward(
   return static_cast<T&&>(t);
 }
 
+namespace utility_internal {
+// Helper method for expanding tuple into a called method.
+template <typename Functor, typename Tuple, std::size_t... Indexes>
+auto apply_helper(Functor&& functor, Tuple&& t, index_sequence<Indexes...>)
+    -> decltype(absl::base_internal::Invoke(
+        absl::forward<Functor>(functor),
+        std::get<Indexes>(absl::forward<Tuple>(t))...)) {
+  return absl::base_internal::Invoke(
+      absl::forward<Functor>(functor),
+      std::get<Indexes>(absl::forward<Tuple>(t))...);
+}
+
+}  // namespace utility_internal
+
+// apply
+//
+// Invokes a Callable using elements of a tuple as its arguments.
+// Each element of the tuple corresponds to an argument of the call (in order).
+// Both the Callable argument and the tuple argument are perfect-forwarded.
+// For member-function Callables, the first tuple element acts as the `this`
+// pointer. `absl::apply` is designed to be a drop-in replacement for C++17's
+// `std::apply`. Unlike C++17's `std::apply`, this is not currently `constexpr`.
+//
+// Example:
+//
+//   class Foo {
+//    public:
+//     void Bar(int);
+//   };
+//   void user_function1(int, std::string);
+//   void user_function2(std::unique_ptr<Foo>);
+//   auto user_lambda = [](int, int) {};
+//
+//   int main()
+//   {
+//       std::tuple<int, std::string> tuple1(42, "bar");
+//       // Invokes the first user function on int, std::string.
+//       absl::apply(&user_function1, tuple1);
+//
+//       std::tuple<std::unique_ptr<Foo>> tuple2(absl::make_unique<Foo>());
+//       // Invokes the user function that takes ownership of the unique
+//       // pointer.
+//       absl::apply(&user_function2, std::move(tuple2));
+//
+//       auto foo = absl::make_unique<Foo>();
+//       std::tuple<Foo*, int> tuple3(foo.get(), 42);
+//       // Invokes the method Bar on foo with one argument, 42.
+//       absl::apply(&Foo::Bar, tuple3);
+//
+//       std::tuple<int, int> tuple4(8, 9);
+//       // Invokes a lambda.
+//       absl::apply(user_lambda, tuple4);
+//   }
+template <typename Functor, typename Tuple>
+auto apply(Functor&& functor, Tuple&& t)
+    -> decltype(utility_internal::apply_helper(
+        absl::forward<Functor>(functor), absl::forward<Tuple>(t),
+        absl::make_index_sequence<std::tuple_size<
+            typename std::remove_reference<Tuple>::type>::value>{})) {
+  return utility_internal::apply_helper(
+      absl::forward<Functor>(functor), absl::forward<Tuple>(t),
+      absl::make_index_sequence<std::tuple_size<
+          typename std::remove_reference<Tuple>::type>::value>{});
+}
+
+// exchange
+//
+// Replaces the value of `obj` with `new_value` and returns the old value of
+// `obj`.  `absl::exchange` is designed to be a drop-in replacement for C++14's
+// `std::exchange`.
+//
+// Example:
+//
+//   Foo& operator=(Foo&& other) {
+//     ptr1_ = absl::exchange(other.ptr1_, nullptr);
+//     int1_ = absl::exchange(other.int1_, -1);
+//     return *this;
+//   }
+template <typename T, typename U = T>
+T exchange(T& obj, U&& new_value) {
+  T old_value = absl::move(obj);
+  obj = absl::forward<U>(new_value);
+  return old_value;
+}
+
+namespace utility_internal {
+template <typename T, typename Tuple, size_t... I>
+T make_from_tuple_impl(Tuple&& tup, absl::index_sequence<I...>) {
+  return T(std::get<I>(std::forward<Tuple>(tup))...);
+}
+}  // namespace utility_internal
+
+// make_from_tuple
+//
+// Given the template parameter type `T` and a tuple of arguments
+// `std::tuple(arg0, arg1, ..., argN)` constructs an object of type `T` as if by
+// calling `T(arg0, arg1, ..., argN)`.
+//
+// Example:
+//
+//   std::tuple<const char*, size_t> args("hello world", 5);
+//   auto s = absl::make_from_tuple<std::string>(args);
+//   assert(s == "hello");
+//
+template <typename T, typename Tuple>
+constexpr T make_from_tuple(Tuple&& tup) {
+  return utility_internal::make_from_tuple_impl<T>(
+      std::forward<Tuple>(tup),
+      absl::make_index_sequence<
+          std::tuple_size<absl::decay_t<Tuple>>::value>{});
+}
+
 }  // namespace absl
 
 #endif  // ABSL_UTILITY_UTILITY_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/CHANGELOG.txt b/legacy-libs/grpc/deps/grpc/third_party/nanopb/CHANGELOG.txt
deleted file mode 100644 (file)
index 8437688..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-nanopb-0.3.6 (2016-06-19)
- Protect against corrupted _count fields in pb_release (#205)
- Fix error in STATIC_ASSERT with multiple files (#203)
- Add -D option to specify output directory (#193)
- Generate MIN/MAX/ARRAYSIZE defines for enums (#194)
- Generate comments about uncalculable message sizes (#195)
- Documentation updates (#196, #201)
- Improvements to test cases.
-
-nanopb-0.3.5 (2016-02-13)
- NOTE: If you are using pb_syshdr.h, you will need to add uint_least8_t
- definition. See docs/migration.rst for details.
-
- Fix generator crash with Enum inside Oneof (#188)
- Fix some generator regressions related to .options file path (#172)
- Add support for platforms without uint8_t (#191)
- Allow const parameter to pb_istream_from_buffer (#152)
- Ignore null pointers in pb_release() (#183)
- Add support for anonymous unions (#184)
- Add Python3 support to the generator (#169)
- Add code generator insertion points to generated files (#178)
- Improvements to CMake script (#181)
- Improvements to test cases.
-
-nanopb-0.3.4 (2015-09-26)
- Fix handling of unsigned 8- and 16-bit enums (issue 164)
- Fix generator on systems where python = python3. (issue 155)
- Fix compiler warning on GCC 5.x (issue 171)
- Make the generator better handle imported .protos (issue 165)
- Add packed_enum option to generator.
- Add syntax= line to .proto files (issue 167)
- Add PlatformIO registry manifest file. (pr 156)
-
-nanopb-0.3.3 (2015-04-10)
- Fix missing files in Linux binary package (issue 146)
- Fix generator bug when oneof is first field in a message. (issue 142)
- Fix generator error when long_names:false is combined with Oneofs. (issue 147)
- Fix oneof submessage initialization bug. (issue 149)
- Fix problem with plugin options on Python 2.7.2 and older. (issue 153)
- Fix crash when callback is inside oneof field. (issue 148)
- Switch to .tar.gz format for Mac OS X packages. (issue 154)
- Always define enum long names so that cross-file references work. (issue 118)
- Add msgid generator option. (issue 151)
- Improve comment support in .options files. (issue 145)
- Updates for the CMake rule file, add cmake example.
- Better error messages for syntax errors in .options file
-
-nanopb-0.3.2 (2015-01-24)
- Fix memory leaks with PB_ENABLE_MALLOC with some submessage hierarchies (issue 138)
- Implement support for oneofs (C unions). (issues 131, 141)
- Add int_size option for generator (issue 139)
- Add compilation option to disable struct packing. (issue 136)
- Change PB_RETURN_ERROR() macro to avoid compiler warnings (issue 140)
- Fix build problems with protoc 3.0.0
- Add support for POINTER type in extensions
- Initialize also extension fields to defaults in pb_decode().
- Detect too large varint values when decoding.
-
-nanopb-0.3.1 (2014-09-11)
- Fix security issue due to size_t overflows. (issue 132)
- Fix memory leak with duplicated fields and PB_ENABLE_MALLOC
- Fix crash if pb_release() is called twice.
- Fix cyclic message support (issue 130)
- Fix error in generated initializers for repeated pointer fields.
- Improve tests (issues 113, 126)
-
-nanopb-0.3.0 (2014-08-26)
- NOTE: See docs/migration.html or online at
- http://koti.kapsi.fi/~jpa/nanopb/docs/migration.html
- for changes in this version. Most importantly, you need to add
- pb_common.c to the list of files to compile.
-
- Separated field iterator logic to pb_common.c (issue 128)
- Change the _count fields to use pb_size_t datatype (issue 82)
- Added PB_ prefix to macro names (issue 106)
- Added #if version guard to generated files (issue 129)
- Added migration document
-
-nanopb-0.2.9 (2014-08-09)
- NOTE: If you are using the -e option with the generator, you have
- to prepend . to the argument to get the same behaviour as before.
-
- Do not automatically add a dot with generator -e option. (issue 122)
- Fix problem with .options file and extension fields. (issue 125)
- Don't use SIZE_MAX macro, as it is not in C89. (issue 120)
- Generate #defines for initializing message structures. (issue 79)
- Add skip_message option to generator. (issue 121)
- Add PB_PACKED_STRUCT support for Keil MDK-ARM toolchain (issue 119)
- Give better messages about the .options file path. (issue 124)
- Improved tests
-
-nanopb-0.2.8 (2014-05-20)
- Fix security issue with PB_ENABLE_MALLOC. (issue 117)
- Add option to not add timestamps to .pb.h and .pb.c preambles. (issue 115)
- Documentation updates
- Improved tests
-
-nanopb-0.2.7 (2014-04-07)
- Fix bug with default values for extension fields (issue 111)
- Fix some MISRA-C warnings (issue 91)
- Implemented optional malloc() support (issue 80)
- Changed pointer-type bytes field datatype
- Add a "found" field to pb_extension_t (issue 112)
- Add convenience function pb_get_encoded_size() (issue 16)
-
-nanopb-0.2.6 (2014-02-15)
- Fix generator error with bytes callback fields (issue 99)
- Fix warnings about large integer constants (issue 102)
- Add comments to where STATIC_ASSERT is used (issue 96)
- Add warning about unknown field names on .options (issue 105)
- Move descriptor.proto to google/protobuf subdirectory (issue 104)
- Improved tests
-
-nanopb-0.2.5 (2014-01-01)
- Fix a bug with encoding negative values in int32 fields (issue 97)
- Create binary packages of the generator + dependencies (issue 47)
- Add support for pointer-type fields to the encoder (part of issue 80)
- Fixed path in FindNanopb.cmake (issue 94)
- Improved tests
-
-nanopb-0.2.4 (2013-11-07)
- Remove the deprecated NANOPB_INTERNALS functions from public API.
- Document the security model.
- Check array and bytes max sizes when encoding (issue 90)
- Add #defines for maximum encoded message size (issue 89)
- Add #define tags for extension fields (issue 93)
- Fix MISRA C violations (issue 91)
- Clean up pb_field_t definition with typedefs.
-
-nanopb-0.2.3 (2013-09-18)
- Improve compatibility by removing ternary operator from initializations (issue 88)
- Fix build error on Visual C++ (issue 84, patch by Markus Schwarzenberg)
- Don't stop on unsupported extension fields (issue 83)
- Add an example pb_syshdr.h file for non-C99 compilers
- Reorganize tests and examples into subfolders (issue 63)
- Switch from Makefiles to scons for building the tests
- Make the tests buildable on Windows
-
-nanopb-0.2.2 (2013-08-18)
- Add support for extension fields (issue 17)
- Fix unknown fields in empty message (issue 78)
- Include the field tags in the generated .pb.h file.
- Add pb_decode_delimited and pb_encode_delimited wrapper functions (issue 74)
- Add a section in top of pb.h for changing compilation settings (issue 76)
- Documentation improvements (issues 12, 77 and others)
- Improved tests
-
-nanopb-0.2.1 (2013-04-14)
- NOTE: The default callback function signature has changed.
-       If you don't want to update your code, define PB_OLD_CALLBACK_STYLE.
- Change the callback function to use void** (issue 69)
- Add support for defining the nanopb options in a separate file (issue 12)
- Add support for packed structs in IAR and MSVC (in addition to GCC) (issue 66)
- Implement error message support for the encoder side (issue 7)
- Handle unterminated strings when encoding (issue 68)
- Fix bug with empty strings in repeated string callbacks (issue 73)
- Fix regression in 0.2.0 with optional callback fields (issue 70)
- Fix bugs with empty message types (issues 64, 65)
- Fix some compiler warnings on clang (issue 67)
- Some portability improvements (issues 60, 62)
- Various new generator options
- Improved tests
-
-nanopb-0.2.0 (2013-03-02)
- NOTE: This release requires you to regenerate all .pb.c
-       files. Files generated by older versions will not
-       compile anymore.
-
- Reformat generated .pb.c files using macros (issue 58)
- Rename PB_HTYPE_ARRAY -> PB_HTYPE_REPEATED
- Separate PB_HTYPE to PB_ATYPE and PB_HTYPE
- Move STATIC_ASSERTs to .pb.c file
- Added CMake file (by Pavel Ilin)
- Add option to give file extension to generator (by Michael Haberler)
- Documentation updates
-
-nanopb-0.1.9 (2013-02-13)
- Fixed error message bugs (issues 52, 56)
- Sanitize #ifndef filename (issue 50)
- Performance improvements
- Add compile-time option PB_BUFFER_ONLY
- Add Java package name to nanopb.proto
- Check for sizeof(double) == 8 (issue 54)
- Added generator option to ignore some fields. (issue 51)
- Added generator option to make message structs packed. (issue 49)
- Add more test cases.
-
-nanopb-0.1.8 (2012-12-13)
- Fix bugs in the enum short names introduced in 0.1.7 (issues 42, 43)
- Fix STATIC_ASSERT macro when using multiple .proto files. (issue 41)
- Fix missing initialization of istream.errmsg
- Make tests/Makefile work for non-gcc compilers (issue 40)
-
-nanopb-0.1.7 (2012-11-11)
- Remove "skip" mode from pb_istream_t callbacks. Example implementation had a bug. (issue 37)
- Add option to use shorter names for enum values (issue 38)
- Improve options support in generator (issues 12, 30)
- Add nanopb version number to generated files (issue 36)
- Add extern "C" to generated headers (issue 35)
- Add names for structs to allow forward declaration (issue 39)
- Add buffer size check in example (issue 34)
- Fix build warnings on MS compilers (issue 33)
-
-nanopb-0.1.6 (2012-09-02)
- Reorganize the field decoder interface (issue 2)
- Improve performance in submessage decoding (issue 28)
- Implement error messages in the decoder side (issue 7)
- Extended testcases (alltypes test is now complete).
- Fix some compiler warnings (issues 25, 26, 27, 32).
-
-nanopb-0.1.5 (2012-08-04)
- Fix bug in decoder with packed arrays (issue 23).
- Extended testcases.
- Fix some compiler warnings.
-
-nanopb-0.1.4 (2012-07-05)
- Add compile-time options for easy-to-use >255 field support.
- Improve the detection of missing required fields.
- Added example on how to handle union messages.
- Fix generator error with .proto without messages.
- Fix problems that stopped the code from compiling with some compilers.
- Fix some compiler warnings.
-
-nanopb-0.1.3 (2012-06-12)
- Refactor the field encoder interface.
- Improve generator error messages (issue 5)
- Add descriptor.proto into the #include exclusion list
- Fix some compiler warnings.
-
-nanopb-0.1.2 (2012-02-15)
- Make the generator to generate include for other .proto files (issue 4).
- Fixed generator not working on Windows (issue 3)
-
-nanopb-0.1.1 (2012-01-14)
- Fixed bug in encoder with 'bytes' fields (issue 1).
- Fixed a bug in the generator that caused a compiler error on sfixed32 and sfixed64 fields.
- Extended testcases.
-
-nanopb-0.1.0 (2012-01-06)
- First stable release.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/LICENSE.txt b/legacy-libs/grpc/deps/grpc/third_party/nanopb/LICENSE.txt
deleted file mode 100644 (file)
index d11c9af..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2011 Petteri Aimonen <jpa at nanopb.mail.kapsi.fi>
-
-This software is provided 'as-is', without any express or 
-implied warranty. In no event will the authors be held liable 
-for any damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any 
-purpose, including commercial applications, and to alter it and 
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you 
-   must not claim that you wrote the original software. If you use 
-   this software in a product, an acknowledgment in the product 
-   documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and 
-   must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source 
-   distribution.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/README.md b/legacy-libs/grpc/deps/grpc/third_party/nanopb/README.md
deleted file mode 100644 (file)
index 2d35e85..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-Nanopb - Protocol Buffers for Embedded Systems
-==============================================
-
-[![Build Status](https://travis-ci.org/nanopb/nanopb.svg?branch=master)](https://travis-ci.org/nanopb/nanopb)
-
-Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is
-especially suitable for use in microcontrollers, but fits any memory
-restricted system.
-
-* **Homepage:** http://kapsi.fi/~jpa/nanopb/
-* **Documentation:** http://kapsi.fi/~jpa/nanopb/docs/
-* **Downloads:** http://kapsi.fi/~jpa/nanopb/download/
-* **Forum:** https://groups.google.com/forum/#!forum/nanopb
-
-
-
-Using the nanopb library
-------------------------
-To use the nanopb library, you need to do two things:
-
-1. Compile your .proto files for nanopb, using protoc.
-2. Include pb_encode.c and pb_decode.c in your project.
-
-The easiest way to get started is to study the project in "examples/simple".
-It contains a Makefile, which should work directly under most Linux systems.
-However, for any other kind of build system, see the manual steps in
-README.txt in that folder.
-
-
-
-Using the Protocol Buffers compiler (protoc)
---------------------------------------------
-The nanopb generator is implemented as a plugin for the Google's own protoc
-compiler. This has the advantage that there is no need to reimplement the
-basic parsing of .proto files. However, it does mean that you need the
-Google's protobuf library in order to run the generator.
-
-If you have downloaded a binary package for nanopb (either Windows, Linux or
-Mac OS X version), the 'protoc' binary is included in the 'generator-bin'
-folder. In this case, you are ready to go. Simply run this command:
-
-    generator-bin/protoc --nanopb_out=. myprotocol.proto
-
-However, if you are using a git checkout or a plain source distribution, you
-need to provide your own version of protoc and the Google's protobuf library.
-On Linux, the necessary packages are protobuf-compiler and python-protobuf.
-On Windows, you can either build Google's protobuf library from source or use
-one of the binary distributions of it. In either case, if you use a separate
-protoc, you need to manually give the path to nanopb generator:
-
-    protoc --plugin=protoc-gen-nanopb=nanopb/generator/protoc-gen-nanopb ...
-
-
-
-Running the tests
------------------
-If you want to perform further development of the nanopb core, or to verify
-its functionality using your compiler and platform, you'll want to run the
-test suite. The build rules for the test suite are implemented using Scons,
-so you need to have that installed. To run the tests:
-
-    cd tests
-    scons
-
-This will show the progress of various test cases. If the output does not
-end in an error, the test cases were successful.
-
-Note: Mac OS X by default aliases 'clang' as 'gcc', while not actually
-supporting the same command line options as gcc does. To run tests on
-Mac OS X, use: "scons CC=clang CXX=clang". Same way can be used to run
-tests with different compilers on any platform.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb.h b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb.h
deleted file mode 100644 (file)
index 62dca73..0000000
+++ /dev/null
@@ -1,579 +0,0 @@
-/* Common parts of the nanopb library. Most of these are quite low-level
- * stuff. For the high-level interface, see pb_encode.h and pb_decode.h.
- */
-
-#ifndef PB_H_INCLUDED
-#define PB_H_INCLUDED
-
-/*****************************************************************
- * Nanopb compilation time options. You can change these here by *
- * uncommenting the lines, or on the compiler command line.      *
- *****************************************************************/
-
-/* Enable support for dynamically allocated fields */
-/* #define PB_ENABLE_MALLOC 1 */
-
-/* Define this if your CPU / compiler combination does not support
- * unaligned memory access to packed structures. */
-/* #define PB_NO_PACKED_STRUCTS 1 */
-
-/* Increase the number of required fields that are tracked.
- * A compiler warning will tell if you need this. */
-/* #define PB_MAX_REQUIRED_FIELDS 256 */
-
-/* Add support for tag numbers > 255 and fields larger than 255 bytes. */
-/* #define PB_FIELD_16BIT 1 */
-
-/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */
-/* #define PB_FIELD_32BIT 1 */ 
-
-/* Disable support for error messages in order to save some code space. */
-/* #define PB_NO_ERRMSG 1 */
-
-/* Disable support for custom streams (support only memory buffers). */
-/* #define PB_BUFFER_ONLY 1 */
-
-/* Switch back to the old-style callback function signature.
- * This was the default until nanopb-0.2.1. */
-/* #define PB_OLD_CALLBACK_STYLE */
-
-
-/******************************************************************
- * You usually don't need to change anything below this line.     *
- * Feel free to look around and use the defined macros, though.   *
- ******************************************************************/
-
-
-/* Version of the nanopb library. Just in case you want to check it in
- * your own program. */
-#define NANOPB_VERSION nanopb-0.3.7-dev
-
-/* Include all the system headers needed by nanopb. You will need the
- * definitions of the following:
- * - strlen, memcpy, memset functions
- * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t
- * - size_t
- * - bool
- *
- * If you don't have the standard header files, you can instead provide
- * a custom header that defines or includes all this. In that case,
- * define PB_SYSTEM_HEADER to the path of this file.
- */
-#ifdef PB_SYSTEM_HEADER
-#include PB_SYSTEM_HEADER
-#else
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <string.h>
-
-#ifdef PB_ENABLE_MALLOC
-#include <stdlib.h>
-#endif
-#endif
-
-/* Macro for defining packed structures (compiler dependent).
- * This just reduces memory requirements, but is not required.
- */
-#if defined(PB_NO_PACKED_STRUCTS)
-    /* Disable struct packing */
-#   define PB_PACKED_STRUCT_START
-#   define PB_PACKED_STRUCT_END
-#   define pb_packed
-#elif defined(__GNUC__) || defined(__clang__)
-    /* For GCC and clang */
-#   define PB_PACKED_STRUCT_START
-#   define PB_PACKED_STRUCT_END
-#   define pb_packed __attribute__((packed))
-#elif defined(__ICCARM__) || defined(__CC_ARM)
-    /* For IAR ARM and Keil MDK-ARM compilers */
-#   define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)")
-#   define PB_PACKED_STRUCT_END _Pragma("pack(pop)")
-#   define pb_packed
-#elif defined(_MSC_VER) && (_MSC_VER >= 1500)
-    /* For Microsoft Visual C++ */
-#   define PB_PACKED_STRUCT_START __pragma(pack(push, 1))
-#   define PB_PACKED_STRUCT_END __pragma(pack(pop))
-#   define pb_packed
-#else
-    /* Unknown compiler */
-#   define PB_PACKED_STRUCT_START
-#   define PB_PACKED_STRUCT_END
-#   define pb_packed
-#endif
-
-/* Handly macro for suppressing unreferenced-parameter compiler warnings. */
-#ifndef PB_UNUSED
-#define PB_UNUSED(x) (void)(x)
-#endif
-
-/* Compile-time assertion, used for checking compatible compilation options.
- * If this does not work properly on your compiler, use
- * #define PB_NO_STATIC_ASSERT to disable it.
- *
- * But before doing that, check carefully the error message / place where it
- * comes from to see if the error has a real cause. Unfortunately the error
- * message is not always very clear to read, but you can see the reason better
- * in the place where the PB_STATIC_ASSERT macro was called.
- */
-#ifndef PB_NO_STATIC_ASSERT
-#ifndef PB_STATIC_ASSERT
-#define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1];
-#define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER)
-#define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER
-#endif
-#else
-#define PB_STATIC_ASSERT(COND,MSG)
-#endif
-
-/* Number of required fields to keep track of. */
-#ifndef PB_MAX_REQUIRED_FIELDS
-#define PB_MAX_REQUIRED_FIELDS 64
-#endif
-
-#if PB_MAX_REQUIRED_FIELDS < 64
-#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64).
-#endif
-
-/* List of possible field types. These are used in the autogenerated code.
- * Least-significant 4 bits tell the scalar type
- * Most-significant 4 bits specify repeated/required/packed etc.
- */
-
-typedef uint_least8_t pb_type_t;
-
-/**** Field data types ****/
-
-/* Numeric types */
-#define PB_LTYPE_VARINT  0x00 /* int32, int64, enum, bool */
-#define PB_LTYPE_UVARINT 0x01 /* uint32, uint64 */
-#define PB_LTYPE_SVARINT 0x02 /* sint32, sint64 */
-#define PB_LTYPE_FIXED32 0x03 /* fixed32, sfixed32, float */
-#define PB_LTYPE_FIXED64 0x04 /* fixed64, sfixed64, double */
-
-/* Marker for last packable field type. */
-#define PB_LTYPE_LAST_PACKABLE 0x04
-
-/* Byte array with pre-allocated buffer.
- * data_size is the length of the allocated PB_BYTES_ARRAY structure. */
-#define PB_LTYPE_BYTES 0x05
-
-/* String with pre-allocated buffer.
- * data_size is the maximum length. */
-#define PB_LTYPE_STRING 0x06
-
-/* Submessage
- * submsg_fields is pointer to field descriptions */
-#define PB_LTYPE_SUBMESSAGE 0x07
-
-/* Extension pseudo-field
- * The field contains a pointer to pb_extension_t */
-#define PB_LTYPE_EXTENSION 0x08
-
-/* Byte array with inline, pre-allocated byffer.
- * data_size is the length of the inline, allocated buffer.
- * This differs from PB_LTYPE_BYTES by defining the element as
- * pb_byte_t[data_size] rather than pb_bytes_array_t. */
-#define PB_LTYPE_FIXED_LENGTH_BYTES 0x09
-
-/* Number of declared LTYPES */
-#define PB_LTYPES_COUNT 0x0A
-#define PB_LTYPE_MASK 0x0F
-
-/**** Field repetition rules ****/
-
-#define PB_HTYPE_REQUIRED 0x00
-#define PB_HTYPE_OPTIONAL 0x10
-#define PB_HTYPE_REPEATED 0x20
-#define PB_HTYPE_ONEOF    0x30
-#define PB_HTYPE_MASK     0x30
-
-/**** Field allocation types ****/
-#define PB_ATYPE_STATIC   0x00
-#define PB_ATYPE_POINTER  0x80
-#define PB_ATYPE_CALLBACK 0x40
-#define PB_ATYPE_MASK     0xC0
-
-#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
-#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
-#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
-
-/* Data type used for storing sizes of struct fields
- * and array counts.
- */
-#if defined(PB_FIELD_32BIT)
-    typedef uint32_t pb_size_t;
-    typedef int32_t pb_ssize_t;
-#elif defined(PB_FIELD_16BIT)
-    typedef uint_least16_t pb_size_t;
-    typedef int_least16_t pb_ssize_t;
-#else
-    typedef uint_least8_t pb_size_t;
-    typedef int_least8_t pb_ssize_t;
-#endif
-#define PB_SIZE_MAX ((pb_size_t)-1)
-
-/* Data type for storing encoded data and other byte streams.
- * This typedef exists to support platforms where uint8_t does not exist.
- * You can regard it as equivalent on uint8_t on other platforms.
- */
-typedef uint_least8_t pb_byte_t;
-
-/* This structure is used in auto-generated constants
- * to specify struct fields.
- * You can change field sizes if you need structures
- * larger than 256 bytes or field tags larger than 256.
- * The compiler should complain if your .proto has such
- * structures. Fix that by defining PB_FIELD_16BIT or
- * PB_FIELD_32BIT.
- */
-PB_PACKED_STRUCT_START
-typedef struct pb_field_s pb_field_t;
-struct pb_field_s {
-    pb_size_t tag;
-    pb_type_t type;
-    pb_size_t data_offset; /* Offset of field data, relative to previous field. */
-    pb_ssize_t size_offset; /* Offset of array size or has-boolean, relative to data */
-    pb_size_t data_size; /* Data size in bytes for a single item */
-    pb_size_t array_size; /* Maximum number of entries in array */
-    
-    /* Field definitions for submessage
-     * OR default value for all other non-array, non-callback types
-     * If null, then field will zeroed. */
-    const void *ptr;
-} pb_packed;
-PB_PACKED_STRUCT_END
-
-/* Make sure that the standard integer types are of the expected sizes.
- * Otherwise fixed32/fixed64 fields can break.
- *
- * If you get errors here, it probably means that your stdint.h is not
- * correct for your platform.
- */
-PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE)
-PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE)
-
-/* This structure is used for 'bytes' arrays.
- * It has the number of bytes in the beginning, and after that an array.
- * Note that actual structs used will have a different length of bytes array.
- */
-#define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; }
-#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes))
-
-struct pb_bytes_array_s {
-    pb_size_t size;
-    pb_byte_t bytes[1];
-};
-typedef struct pb_bytes_array_s pb_bytes_array_t;
-
-/* This structure is used for giving the callback function.
- * It is stored in the message structure and filled in by the method that
- * calls pb_decode.
- *
- * The decoding callback will be given a limited-length stream
- * If the wire type was string, the length is the length of the string.
- * If the wire type was a varint/fixed32/fixed64, the length is the length
- * of the actual value.
- * The function may be called multiple times (especially for repeated types,
- * but also otherwise if the message happens to contain the field multiple
- * times.)
- *
- * The encoding callback will receive the actual output stream.
- * It should write all the data in one call, including the field tag and
- * wire type. It can write multiple fields.
- *
- * The callback can be null if you want to skip a field.
- */
-typedef struct pb_istream_s pb_istream_t;
-typedef struct pb_ostream_s pb_ostream_t;
-typedef struct pb_callback_s pb_callback_t;
-struct pb_callback_s {
-#ifdef PB_OLD_CALLBACK_STYLE
-    /* Deprecated since nanopb-0.2.1 */
-    union {
-        bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void *arg);
-        bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, const void *arg);
-    } funcs;
-#else
-    /* New function signature, which allows modifying arg contents in callback. */
-    union {
-        bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg);
-        bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg);
-    } funcs;
-#endif    
-    
-    /* Free arg for use by callback */
-    void *arg;
-};
-
-/* Wire types. Library user needs these only in encoder callbacks. */
-typedef enum {
-    PB_WT_VARINT = 0,
-    PB_WT_64BIT  = 1,
-    PB_WT_STRING = 2,
-    PB_WT_32BIT  = 5
-} pb_wire_type_t;
-
-/* Structure for defining the handling of unknown/extension fields.
- * Usually the pb_extension_type_t structure is automatically generated,
- * while the pb_extension_t structure is created by the user. However,
- * if you want to catch all unknown fields, you can also create a custom
- * pb_extension_type_t with your own callback.
- */
-typedef struct pb_extension_type_s pb_extension_type_t;
-typedef struct pb_extension_s pb_extension_t;
-struct pb_extension_type_s {
-    /* Called for each unknown field in the message.
-     * If you handle the field, read off all of its data and return true.
-     * If you do not handle the field, do not read anything and return true.
-     * If you run into an error, return false.
-     * Set to NULL for default handler.
-     */
-    bool (*decode)(pb_istream_t *stream, pb_extension_t *extension,
-                   uint32_t tag, pb_wire_type_t wire_type);
-    
-    /* Called once after all regular fields have been encoded.
-     * If you have something to write, do so and return true.
-     * If you do not have anything to write, just return true.
-     * If you run into an error, return false.
-     * Set to NULL for default handler.
-     */
-    bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension);
-    
-    /* Free field for use by the callback. */
-    const void *arg;
-};
-
-struct pb_extension_s {
-    /* Type describing the extension field. Usually you'll initialize
-     * this to a pointer to the automatically generated structure. */
-    const pb_extension_type_t *type;
-    
-    /* Destination for the decoded data. This must match the datatype
-     * of the extension field. */
-    void *dest;
-    
-    /* Pointer to the next extension handler, or NULL.
-     * If this extension does not match a field, the next handler is
-     * automatically called. */
-    pb_extension_t *next;
-
-    /* The decoder sets this to true if the extension was found.
-     * Ignored for encoding. */
-    bool found;
-};
-
-/* Memory allocation functions to use. You can define pb_realloc and
- * pb_free to custom functions if you want. */
-#ifdef PB_ENABLE_MALLOC
-#   ifndef pb_realloc
-#       define pb_realloc(ptr, size) realloc(ptr, size)
-#   endif
-#   ifndef pb_free
-#       define pb_free(ptr) free(ptr)
-#   endif
-#endif
-
-/* This is used to inform about need to regenerate .pb.h/.pb.c files. */
-#define PB_PROTO_HEADER_VERSION 30
-
-/* These macros are used to declare pb_field_t's in the constant array. */
-/* Size of a structure member, in bytes. */
-#define pb_membersize(st, m) (sizeof ((st*)0)->m)
-/* Number of entries in an array. */
-#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0]))
-/* Delta from start of one member to the start of another member. */
-#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2))
-/* Marks the end of the field list */
-#define PB_LAST_FIELD {0,(pb_type_t) 0,0,0,0,0,0}
-
-/* Macros for filling in the data_offset field */
-/* data_offset for first field in a message */
-#define PB_DATAOFFSET_FIRST(st, m1, m2) (offsetof(st, m1))
-/* data_offset for subsequent fields */
-#define PB_DATAOFFSET_OTHER(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2))
-/* Choose first/other based on m1 == m2 (deprecated, remains for backwards compatibility) */
-#define PB_DATAOFFSET_CHOOSE(st, m1, m2) (int)(offsetof(st, m1) == offsetof(st, m2) \
-                                  ? PB_DATAOFFSET_FIRST(st, m1, m2) \
-                                  : PB_DATAOFFSET_OTHER(st, m1, m2))
-
-/* Required fields are the simplest. They just have delta (padding) from
- * previous field end, and the size of the field. Pointer is used for
- * submessages and default values.
- */
-#define PB_REQUIRED_STATIC(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \
-    fd, 0, pb_membersize(st, m), 0, ptr}
-
-/* Optional fields add the delta to the has_ variable. */
-#define PB_OPTIONAL_STATIC(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \
-    fd, \
-    pb_delta(st, has_ ## m, m), \
-    pb_membersize(st, m), 0, ptr}
-
-/* Repeated fields have a _count field and also the maximum number of entries. */
-#define PB_REPEATED_STATIC(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | ltype, \
-    fd, \
-    pb_delta(st, m ## _count, m), \
-    pb_membersize(st, m[0]), \
-    pb_arraysize(st, m), ptr}
-
-#define PB_REQUIRED_INLINE(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | PB_LTYPE_FIXED_LENGTH_BYTES, \
-    fd, 0, pb_membersize(st, m), 0, ptr}
-
-/* Optional fields add the delta to the has_ variable. */
-#define PB_OPTIONAL_INLINE(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | PB_LTYPE_FIXED_LENGTH_BYTES, \
-    fd, \
-    pb_delta(st, has_ ## m, m), \
-    pb_membersize(st, m), 0, ptr}
-
-/* INLINE does not support REPEATED fields. */
-
-/* Allocated fields carry the size of the actual data, not the pointer */
-#define PB_REQUIRED_POINTER(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_POINTER | PB_HTYPE_REQUIRED | ltype, \
-    fd, 0, pb_membersize(st, m[0]), 0, ptr}
-
-/* Optional fields don't need a has_ variable, as information would be redundant */
-#define PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \
-    fd, 0, pb_membersize(st, m[0]), 0, ptr}
-
-/* Repeated fields have a _count field and a pointer to array of pointers */
-#define PB_REPEATED_POINTER(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_POINTER | PB_HTYPE_REPEATED | ltype, \
-    fd, pb_delta(st, m ## _count, m), \
-    pb_membersize(st, m[0]), 0, ptr}
-
-/* Callbacks are much like required fields except with special datatype. */
-#define PB_REQUIRED_CALLBACK(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REQUIRED | ltype, \
-    fd, 0, pb_membersize(st, m), 0, ptr}
-
-#define PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \
-    fd, 0, pb_membersize(st, m), 0, ptr}
-    
-#define PB_REPEATED_CALLBACK(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \
-    fd, 0, pb_membersize(st, m), 0, ptr}
-
-/* Optional extensions don't have the has_ field, as that would be redundant. */
-#define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \
-    0, \
-    0, \
-    pb_membersize(st, m), 0, ptr}
-
-#define PB_OPTEXT_POINTER(tag, st, m, fd, ltype, ptr) \
-    PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr)
-
-/* INLINE does not support OPTEXT. */
-
-#define PB_OPTEXT_CALLBACK(tag, st, m, fd, ltype, ptr) \
-    PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr)
-
-/* The mapping from protobuf types to LTYPEs is done using these macros. */
-#define PB_LTYPE_MAP_BOOL       PB_LTYPE_VARINT
-#define PB_LTYPE_MAP_BYTES      PB_LTYPE_BYTES
-#define PB_LTYPE_MAP_DOUBLE     PB_LTYPE_FIXED64
-#define PB_LTYPE_MAP_ENUM       PB_LTYPE_VARINT
-#define PB_LTYPE_MAP_UENUM      PB_LTYPE_UVARINT
-#define PB_LTYPE_MAP_FIXED32    PB_LTYPE_FIXED32
-#define PB_LTYPE_MAP_FIXED64    PB_LTYPE_FIXED64
-#define PB_LTYPE_MAP_FLOAT      PB_LTYPE_FIXED32
-#define PB_LTYPE_MAP_INT32      PB_LTYPE_VARINT
-#define PB_LTYPE_MAP_INT64      PB_LTYPE_VARINT
-#define PB_LTYPE_MAP_MESSAGE    PB_LTYPE_SUBMESSAGE
-#define PB_LTYPE_MAP_SFIXED32   PB_LTYPE_FIXED32
-#define PB_LTYPE_MAP_SFIXED64   PB_LTYPE_FIXED64
-#define PB_LTYPE_MAP_SINT32     PB_LTYPE_SVARINT
-#define PB_LTYPE_MAP_SINT64     PB_LTYPE_SVARINT
-#define PB_LTYPE_MAP_STRING     PB_LTYPE_STRING
-#define PB_LTYPE_MAP_UINT32     PB_LTYPE_UVARINT
-#define PB_LTYPE_MAP_UINT64     PB_LTYPE_UVARINT
-#define PB_LTYPE_MAP_EXTENSION  PB_LTYPE_EXTENSION
-
-/* This is the actual macro used in field descriptions.
- * It takes these arguments:
- * - Field tag number
- * - Field type:   BOOL, BYTES, DOUBLE, ENUM, UENUM, FIXED32, FIXED64,
- *                 FLOAT, INT32, INT64, MESSAGE, SFIXED32, SFIXED64
- *                 SINT32, SINT64, STRING, UINT32, UINT64 or EXTENSION
- * - Field rules:  REQUIRED, OPTIONAL or REPEATED
- * - Allocation:   STATIC, INLINE, or CALLBACK
- * - Placement: FIRST or OTHER, depending on if this is the first field in structure.
- * - Message name
- * - Field name
- * - Previous field name (or field name again for first field)
- * - Pointer to default value or submsg fields.
- */
-
-#define PB_FIELD(tag, type, rules, allocation, placement, message, field, prevfield, ptr) \
-        PB_ ## rules ## _ ## allocation(tag, message, field, \
-        PB_DATAOFFSET_ ## placement(message, field, prevfield), \
-        PB_LTYPE_MAP_ ## type, ptr)
-
-/* Field description for oneof fields. This requires taking into account the
- * union name also, that's why a separate set of macros is needed.
- */
-#define PB_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \
-    fd, pb_delta(st, which_ ## u, u.m), \
-    pb_membersize(st, u.m), 0, ptr}
-
-#define PB_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \
-    fd, pb_delta(st, which_ ## u, u.m), \
-    pb_membersize(st, u.m[0]), 0, ptr}
-
-/* INLINE does not support ONEOF. */
-
-#define PB_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \
-        PB_ONEOF_ ## allocation(union_name, tag, message, field, \
-        PB_DATAOFFSET_ ## placement(message, union_name.field, prevfield), \
-        PB_LTYPE_MAP_ ## type, ptr)
-
-#define PB_ANONYMOUS_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \
-    fd, pb_delta(st, which_ ## u, m), \
-    pb_membersize(st, m), 0, ptr}
-
-#define PB_ANONYMOUS_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \
-    {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \
-    fd, pb_delta(st, which_ ## u, m), \
-    pb_membersize(st, m[0]), 0, ptr}
-
-#define PB_ANONYMOUS_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \
-        PB_ANONYMOUS_ONEOF_ ## allocation(union_name, tag, message, field, \
-        PB_DATAOFFSET_ ## placement(message, field, prevfield), \
-        PB_LTYPE_MAP_ ## type, ptr)
-
-/* These macros are used for giving out error messages.
- * They are mostly a debugging aid; the main error information
- * is the true/false return value from functions.
- * Some code space can be saved by disabling the error
- * messages if not used.
- *
- * PB_SET_ERROR() sets the error message if none has been set yet.
- *                msg must be a constant string literal.
- * PB_GET_ERROR() always returns a pointer to a string.
- * PB_RETURN_ERROR() sets the error and returns false from current
- *                   function.
- */
-#ifdef PB_NO_ERRMSG
-#define PB_SET_ERROR(stream, msg) PB_UNUSED(stream)
-#define PB_GET_ERROR(stream) "(errmsg disabled)"
-#else
-#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
-#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
-#endif
-
-#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_common.c b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_common.c
deleted file mode 100644 (file)
index 385c019..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/* pb_common.c: Common support functions for pb_encode.c and pb_decode.c.
- *
- * 2014 Petteri Aimonen <jpa@kapsi.fi>
- */
-
-#include "pb_common.h"
-
-bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct)
-{
-    iter->start = fields;
-    iter->pos = fields;
-    iter->required_field_index = 0;
-    iter->dest_struct = dest_struct;
-    iter->pData = (char*)dest_struct + iter->pos->data_offset;
-    iter->pSize = (char*)iter->pData + iter->pos->size_offset;
-    
-    return (iter->pos->tag != 0);
-}
-
-bool pb_field_iter_next(pb_field_iter_t *iter)
-{
-    const pb_field_t *prev_field = iter->pos;
-
-    if (prev_field->tag == 0)
-    {
-        /* Handle empty message types, where the first field is already the terminator.
-         * In other cases, the iter->pos never points to the terminator. */
-        return false;
-    }
-    
-    iter->pos++;
-    
-    if (iter->pos->tag == 0)
-    {
-        /* Wrapped back to beginning, reinitialize */
-        (void)pb_field_iter_begin(iter, iter->start, iter->dest_struct);
-        return false;
-    }
-    else
-    {
-        /* Increment the pointers based on previous field size */
-        size_t prev_size = prev_field->data_size;
-    
-        if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF &&
-            PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF)
-        {
-            /* Don't advance pointers inside unions */
-            prev_size = 0;
-            iter->pData = (char*)iter->pData - prev_field->data_offset;
-        }
-        else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC &&
-                 PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED)
-        {
-            /* In static arrays, the data_size tells the size of a single entry and
-             * array_size is the number of entries */
-            prev_size *= prev_field->array_size;
-        }
-        else if (PB_ATYPE(prev_field->type) == PB_ATYPE_POINTER)
-        {
-            /* Pointer fields always have a constant size in the main structure.
-             * The data_size only applies to the dynamically allocated area. */
-            prev_size = sizeof(void*);
-        }
-
-        if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED)
-        {
-            /* Count the required fields, in order to check their presence in the
-             * decoder. */
-            iter->required_field_index++;
-        }
-    
-        iter->pData = (char*)iter->pData + prev_size + iter->pos->data_offset;
-        iter->pSize = (char*)iter->pData + iter->pos->size_offset;
-        return true;
-    }
-}
-
-bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
-{
-    const pb_field_t *start = iter->pos;
-    
-    do {
-        if (iter->pos->tag == tag &&
-            PB_LTYPE(iter->pos->type) != PB_LTYPE_EXTENSION)
-        {
-            /* Found the wanted field */
-            return true;
-        }
-        
-        (void)pb_field_iter_next(iter);
-    } while (iter->pos != start);
-    
-    /* Searched all the way back to start, and found nothing. */
-    return false;
-}
-
-
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_common.h b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_common.h
deleted file mode 100644 (file)
index 60b3d37..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
- * These functions are rarely needed by applications directly.
- */
-
-#ifndef PB_COMMON_H_INCLUDED
-#define PB_COMMON_H_INCLUDED
-
-#include "pb.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Iterator for pb_field_t list */
-struct pb_field_iter_s {
-    const pb_field_t *start;       /* Start of the pb_field_t array */
-    const pb_field_t *pos;         /* Current position of the iterator */
-    unsigned required_field_index; /* Zero-based index that counts only the required fields */
-    void *dest_struct;             /* Pointer to start of the structure */
-    void *pData;                   /* Pointer to current field value */
-    void *pSize;                   /* Pointer to count/has field */
-};
-typedef struct pb_field_iter_s pb_field_iter_t;
-
-/* Initialize the field iterator structure to beginning.
- * Returns false if the message type is empty. */
-bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct);
-
-/* Advance the iterator to the next field.
- * Returns false when the iterator wraps back to the first field. */
-bool pb_field_iter_next(pb_field_iter_t *iter);
-
-/* Advance the iterator until it points at a field with the given tag.
- * Returns false if no such field exists. */
-bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif
-
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_decode.c b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_decode.c
deleted file mode 100644 (file)
index 7a4e29a..0000000
+++ /dev/null
@@ -1,1347 +0,0 @@
-/* pb_decode.c -- decode a protobuf using minimal resources
- *
- * 2011 Petteri Aimonen <jpa@kapsi.fi>
- */
-
-/* Use the GCC warn_unused_result attribute to check that all return values
- * are propagated correctly. On other compilers and gcc before 3.4.0 just
- * ignore the annotation.
- */
-#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-    #define checkreturn
-#else
-    #define checkreturn __attribute__((warn_unused_result))
-#endif
-
-#include "pb.h"
-#include "pb_decode.h"
-#include "pb_common.h"
-
-/**************************************
- * Declarations internal to this file *
- **************************************/
-
-typedef bool (*pb_decoder_t)(pb_istream_t *stream, const pb_field_t *field, void *dest) checkreturn;
-
-static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
-static bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest);
-static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size);
-static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter);
-static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter);
-static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter);
-static void iter_from_extension(pb_field_iter_t *iter, pb_extension_t *extension);
-static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type);
-static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter);
-static bool checkreturn find_extension_field(pb_field_iter_t *iter);
-static void pb_field_set_to_default(pb_field_iter_t *iter);
-static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_struct);
-static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_uvarint(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_t *field, void *dest);
-static bool checkreturn pb_skip_varint(pb_istream_t *stream);
-static bool checkreturn pb_skip_string(pb_istream_t *stream);
-
-#ifdef PB_ENABLE_MALLOC
-static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size);
-static bool checkreturn pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *iter);
-static void pb_release_single_field(const pb_field_iter_t *iter);
-#endif
-
-/* --- Function pointers to field decoders ---
- * Order in the array must match pb_action_t LTYPE numbering.
- */
-static const pb_decoder_t PB_DECODERS[PB_LTYPES_COUNT] = {
-    &pb_dec_varint,
-    &pb_dec_uvarint,
-    &pb_dec_svarint,
-    &pb_dec_fixed32,
-    &pb_dec_fixed64,
-    
-    &pb_dec_bytes,
-    &pb_dec_string,
-    &pb_dec_submessage,
-    NULL, /* extensions */
-    &pb_dec_bytes /* PB_LTYPE_FIXED_LENGTH_BYTES */
-};
-
-/*******************************
- * pb_istream_t implementation *
- *******************************/
-
-static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count)
-{
-    const pb_byte_t *source = (const pb_byte_t*)stream->state;
-    stream->state = (pb_byte_t*)stream->state + count;
-    
-    if (buf != NULL)
-    {
-        while (count--)
-            *buf++ = *source++;
-    }
-    
-    return true;
-}
-
-bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count)
-{
-#ifndef PB_BUFFER_ONLY
-       if (buf == NULL && stream->callback != buf_read)
-       {
-               /* Skip input bytes */
-               pb_byte_t tmp[16];
-               while (count > 16)
-               {
-                       if (!pb_read(stream, tmp, 16))
-                               return false;
-                       
-                       count -= 16;
-               }
-               
-               return pb_read(stream, tmp, count);
-       }
-#endif
-
-    if (stream->bytes_left < count)
-        PB_RETURN_ERROR(stream, "end-of-stream");
-    
-#ifndef PB_BUFFER_ONLY
-    if (!stream->callback(stream, buf, count))
-        PB_RETURN_ERROR(stream, "io error");
-#else
-    if (!buf_read(stream, buf, count))
-        return false;
-#endif
-    
-    stream->bytes_left -= count;
-    return true;
-}
-
-/* Read a single byte from input stream. buf may not be NULL.
- * This is an optimization for the varint decoding. */
-static bool checkreturn pb_readbyte(pb_istream_t *stream, pb_byte_t *buf)
-{
-    if (stream->bytes_left == 0)
-        PB_RETURN_ERROR(stream, "end-of-stream");
-
-#ifndef PB_BUFFER_ONLY
-    if (!stream->callback(stream, buf, 1))
-        PB_RETURN_ERROR(stream, "io error");
-#else
-    *buf = *(const pb_byte_t*)stream->state;
-    stream->state = (pb_byte_t*)stream->state + 1;
-#endif
-
-    stream->bytes_left--;
-    
-    return true;    
-}
-
-pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize)
-{
-    pb_istream_t stream;
-    /* Cast away the const from buf without a compiler error.  We are
-     * careful to use it only in a const manner in the callbacks.
-     */
-    union {
-        void *state;
-        const void *c_state;
-    } state;
-#ifdef PB_BUFFER_ONLY
-    stream.callback = NULL;
-#else
-    stream.callback = &buf_read;
-#endif
-    state.c_state = buf;
-    stream.state = state.state;
-    stream.bytes_left = bufsize;
-#ifndef PB_NO_ERRMSG
-    stream.errmsg = NULL;
-#endif
-    return stream;
-}
-
-/********************
- * Helper functions *
- ********************/
-
-static bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest)
-{
-    pb_byte_t byte;
-    uint32_t result;
-    
-    if (!pb_readbyte(stream, &byte))
-        return false;
-    
-    if ((byte & 0x80) == 0)
-    {
-        /* Quick case, 1 byte value */
-        result = byte;
-    }
-    else
-    {
-        /* Multibyte case */
-        uint_fast8_t bitpos = 7;
-        result = byte & 0x7F;
-        
-        do
-        {
-            if (bitpos >= 32)
-                PB_RETURN_ERROR(stream, "varint overflow");
-            
-            if (!pb_readbyte(stream, &byte))
-                return false;
-            
-            result |= (uint32_t)(byte & 0x7F) << bitpos;
-            bitpos = (uint_fast8_t)(bitpos + 7);
-        } while (byte & 0x80);
-   }
-   
-   *dest = result;
-   return true;
-}
-
-bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest)
-{
-    pb_byte_t byte;
-    uint_fast8_t bitpos = 0;
-    uint64_t result = 0;
-    
-    do
-    {
-        if (bitpos >= 64)
-            PB_RETURN_ERROR(stream, "varint overflow");
-        
-        if (!pb_readbyte(stream, &byte))
-            return false;
-
-        result |= (uint64_t)(byte & 0x7F) << bitpos;
-        bitpos = (uint_fast8_t)(bitpos + 7);
-    } while (byte & 0x80);
-    
-    *dest = result;
-    return true;
-}
-
-bool checkreturn pb_skip_varint(pb_istream_t *stream)
-{
-    pb_byte_t byte;
-    do
-    {
-        if (!pb_read(stream, &byte, 1))
-            return false;
-    } while (byte & 0x80);
-    return true;
-}
-
-bool checkreturn pb_skip_string(pb_istream_t *stream)
-{
-    uint32_t length;
-    if (!pb_decode_varint32(stream, &length))
-        return false;
-    
-    return pb_read(stream, NULL, length);
-}
-
-bool checkreturn pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof)
-{
-    uint32_t temp;
-    *eof = false;
-    *wire_type = (pb_wire_type_t) 0;
-    *tag = 0;
-    
-    if (!pb_decode_varint32(stream, &temp))
-    {
-        if (stream->bytes_left == 0)
-            *eof = true;
-
-        return false;
-    }
-    
-    if (temp == 0)
-    {
-        *eof = true; /* Special feature: allow 0-terminated messages. */
-        return false;
-    }
-    
-    *tag = temp >> 3;
-    *wire_type = (pb_wire_type_t)(temp & 7);
-    return true;
-}
-
-bool checkreturn pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type)
-{
-    switch (wire_type)
-    {
-        case PB_WT_VARINT: return pb_skip_varint(stream);
-        case PB_WT_64BIT: return pb_read(stream, NULL, 8);
-        case PB_WT_STRING: return pb_skip_string(stream);
-        case PB_WT_32BIT: return pb_read(stream, NULL, 4);
-        default: PB_RETURN_ERROR(stream, "invalid wire_type");
-    }
-}
-
-/* Read a raw value to buffer, for the purpose of passing it to callback as
- * a substream. Size is maximum size on call, and actual size on return.
- */
-static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size)
-{
-    size_t max_size = *size;
-    switch (wire_type)
-    {
-        case PB_WT_VARINT:
-            *size = 0;
-            do
-            {
-                (*size)++;
-                if (*size > max_size) return false;
-                if (!pb_read(stream, buf, 1)) return false;
-            } while (*buf++ & 0x80);
-            return true;
-            
-        case PB_WT_64BIT:
-            *size = 8;
-            return pb_read(stream, buf, 8);
-        
-        case PB_WT_32BIT:
-            *size = 4;
-            return pb_read(stream, buf, 4);
-        
-        default: PB_RETURN_ERROR(stream, "invalid wire_type");
-    }
-}
-
-/* Decode string length from stream and return a substream with limited length.
- * Remember to close the substream using pb_close_string_substream().
- */
-bool checkreturn pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream)
-{
-    uint32_t size;
-    if (!pb_decode_varint32(stream, &size))
-        return false;
-    
-    *substream = *stream;
-    if (substream->bytes_left < size)
-        PB_RETURN_ERROR(stream, "parent stream too short");
-    
-    substream->bytes_left = size;
-    stream->bytes_left -= size;
-    return true;
-}
-
-void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream)
-{
-    stream->state = substream->state;
-
-#ifndef PB_NO_ERRMSG
-    stream->errmsg = substream->errmsg;
-#endif
-}
-
-/*************************
- * Decode a single field *
- *************************/
-
-static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter)
-{
-    pb_type_t type;
-    pb_decoder_t func;
-    
-    type = iter->pos->type;
-    func = PB_DECODERS[PB_LTYPE(type)];
-
-    switch (PB_HTYPE(type))
-    {
-        case PB_HTYPE_REQUIRED:
-            return func(stream, iter->pos, iter->pData);
-            
-        case PB_HTYPE_OPTIONAL:
-            *(bool*)iter->pSize = true;
-            return func(stream, iter->pos, iter->pData);
-    
-        case PB_HTYPE_REPEATED:
-            if (wire_type == PB_WT_STRING
-                && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
-            {
-                /* Packed array */
-                bool status = true;
-                pb_size_t *size = (pb_size_t*)iter->pSize;
-                pb_istream_t substream;
-                if (!pb_make_string_substream(stream, &substream))
-                    return false;
-                
-                while (substream.bytes_left > 0 && *size < iter->pos->array_size)
-                {
-                    void *pItem = (char*)iter->pData + iter->pos->data_size * (*size);
-                    if (!func(&substream, iter->pos, pItem))
-                    {
-                        status = false;
-                        break;
-                    }
-                    (*size)++;
-                }
-                pb_close_string_substream(stream, &substream);
-                
-                if (substream.bytes_left != 0)
-                    PB_RETURN_ERROR(stream, "array overflow");
-                
-                return status;
-            }
-            else
-            {
-                /* Repeated field */
-                pb_size_t *size = (pb_size_t*)iter->pSize;
-                void *pItem = (char*)iter->pData + iter->pos->data_size * (*size);
-                if (*size >= iter->pos->array_size)
-                    PB_RETURN_ERROR(stream, "array overflow");
-                
-                (*size)++;
-                return func(stream, iter->pos, pItem);
-            }
-
-        case PB_HTYPE_ONEOF:
-            *(pb_size_t*)iter->pSize = iter->pos->tag;
-            if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE)
-            {
-                /* We memset to zero so that any callbacks are set to NULL.
-                 * Then set any default values. */
-                memset(iter->pData, 0, iter->pos->data_size);
-                pb_message_set_to_defaults((const pb_field_t*)iter->pos->ptr, iter->pData);
-            }
-            return func(stream, iter->pos, iter->pData);
-
-        default:
-            PB_RETURN_ERROR(stream, "invalid field type");
-    }
-}
-
-#ifdef PB_ENABLE_MALLOC
-/* Allocate storage for the field and store the pointer at iter->pData.
- * array_size is the number of entries to reserve in an array.
- * Zero size is not allowed, use pb_free() for releasing.
- */
-static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size)
-{    
-    void *ptr = *(void**)pData;
-    
-    if (data_size == 0 || array_size == 0)
-        PB_RETURN_ERROR(stream, "invalid size");
-    
-    /* Check for multiplication overflows.
-     * This code avoids the costly division if the sizes are small enough.
-     * Multiplication is safe as long as only half of bits are set
-     * in either multiplicand.
-     */
-    {
-        const size_t check_limit = (size_t)1 << (sizeof(size_t) * 4);
-        if (data_size >= check_limit || array_size >= check_limit)
-        {
-            const size_t size_max = (size_t)-1;
-            if (size_max / array_size < data_size)
-            {
-                PB_RETURN_ERROR(stream, "size too large");
-            }
-        }
-    }
-    
-    /* Allocate new or expand previous allocation */
-    /* Note: on failure the old pointer will remain in the structure,
-     * the message must be freed by caller also on error return. */
-    ptr = pb_realloc(ptr, array_size * data_size);
-    if (ptr == NULL)
-        PB_RETURN_ERROR(stream, "realloc failed");
-    
-    *(void**)pData = ptr;
-    return true;
-}
-
-/* Clear a newly allocated item in case it contains a pointer, or is a submessage. */
-static void initialize_pointer_field(void *pItem, pb_field_iter_t *iter)
-{
-    if (PB_LTYPE(iter->pos->type) == PB_LTYPE_STRING ||
-        PB_LTYPE(iter->pos->type) == PB_LTYPE_BYTES)
-    {
-        *(void**)pItem = NULL;
-    }
-    else if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE)
-    {
-        pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, pItem);
-    }
-}
-#endif
-
-static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter)
-{
-#ifndef PB_ENABLE_MALLOC
-    PB_UNUSED(wire_type);
-    PB_UNUSED(iter);
-    PB_RETURN_ERROR(stream, "no malloc support");
-#else
-    pb_type_t type;
-    pb_decoder_t func;
-    
-    type = iter->pos->type;
-    func = PB_DECODERS[PB_LTYPE(type)];
-    
-    switch (PB_HTYPE(type))
-    {
-        case PB_HTYPE_REQUIRED:
-        case PB_HTYPE_OPTIONAL:
-        case PB_HTYPE_ONEOF:
-            if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE &&
-                *(void**)iter->pData != NULL)
-            {
-                /* Duplicate field, have to release the old allocation first. */
-                pb_release_single_field(iter);
-            }
-        
-            if (PB_HTYPE(type) == PB_HTYPE_ONEOF)
-            {
-                *(pb_size_t*)iter->pSize = iter->pos->tag;
-            }
-
-            if (PB_LTYPE(type) == PB_LTYPE_STRING ||
-                PB_LTYPE(type) == PB_LTYPE_BYTES)
-            {
-                return func(stream, iter->pos, iter->pData);
-            }
-            else
-            {
-                if (!allocate_field(stream, iter->pData, iter->pos->data_size, 1))
-                    return false;
-                
-                initialize_pointer_field(*(void**)iter->pData, iter);
-                return func(stream, iter->pos, *(void**)iter->pData);
-            }
-    
-        case PB_HTYPE_REPEATED:
-            if (wire_type == PB_WT_STRING
-                && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
-            {
-                /* Packed array, multiple items come in at once. */
-                bool status = true;
-                pb_size_t *size = (pb_size_t*)iter->pSize;
-                size_t allocated_size = *size;
-                void *pItem;
-                pb_istream_t substream;
-                
-                if (!pb_make_string_substream(stream, &substream))
-                    return false;
-                
-                while (substream.bytes_left)
-                {
-                    if ((size_t)*size + 1 > allocated_size)
-                    {
-                        /* Allocate more storage. This tries to guess the
-                         * number of remaining entries. Round the division
-                         * upwards. */
-                        allocated_size += (substream.bytes_left - 1) / iter->pos->data_size + 1;
-                        
-                        if (!allocate_field(&substream, iter->pData, iter->pos->data_size, allocated_size))
-                        {
-                            status = false;
-                            break;
-                        }
-                    }
-
-                    /* Decode the array entry */
-                    pItem = *(char**)iter->pData + iter->pos->data_size * (*size);
-                    initialize_pointer_field(pItem, iter);
-                    if (!func(&substream, iter->pos, pItem))
-                    {
-                        status = false;
-                        break;
-                    }
-                    
-                    if (*size == PB_SIZE_MAX)
-                    {
-#ifndef PB_NO_ERRMSG
-                        stream->errmsg = "too many array entries";
-#endif
-                        status = false;
-                        break;
-                    }
-                    
-                    (*size)++;
-                }
-                pb_close_string_substream(stream, &substream);
-                
-                return status;
-            }
-            else
-            {
-                /* Normal repeated field, i.e. only one item at a time. */
-                pb_size_t *size = (pb_size_t*)iter->pSize;
-                void *pItem;
-                
-                if (*size == PB_SIZE_MAX)
-                    PB_RETURN_ERROR(stream, "too many array entries");
-                
-                (*size)++;
-                if (!allocate_field(stream, iter->pData, iter->pos->data_size, *size))
-                    return false;
-            
-                pItem = *(char**)iter->pData + iter->pos->data_size * (*size - 1);
-                initialize_pointer_field(pItem, iter);
-                return func(stream, iter->pos, pItem);
-            }
-
-        default:
-            PB_RETURN_ERROR(stream, "invalid field type");
-    }
-#endif
-}
-
-static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter)
-{
-    pb_callback_t *pCallback = (pb_callback_t*)iter->pData;
-    
-#ifdef PB_OLD_CALLBACK_STYLE
-    void *arg = pCallback->arg;
-#else
-    void **arg = &(pCallback->arg);
-#endif
-    
-    if (pCallback->funcs.decode == NULL)
-        return pb_skip_field(stream, wire_type);
-    
-    if (wire_type == PB_WT_STRING)
-    {
-        pb_istream_t substream;
-        
-        if (!pb_make_string_substream(stream, &substream))
-            return false;
-        
-        do
-        {
-            if (!pCallback->funcs.decode(&substream, iter->pos, arg))
-                PB_RETURN_ERROR(stream, "callback failed");
-        } while (substream.bytes_left);
-        
-        pb_close_string_substream(stream, &substream);
-        return true;
-    }
-    else
-    {
-        /* Copy the single scalar value to stack.
-         * This is required so that we can limit the stream length,
-         * which in turn allows to use same callback for packed and
-         * not-packed fields. */
-        pb_istream_t substream;
-        pb_byte_t buffer[10];
-        size_t size = sizeof(buffer);
-        
-        if (!read_raw_value(stream, wire_type, buffer, &size))
-            return false;
-        substream = pb_istream_from_buffer(buffer, size);
-        
-        return pCallback->funcs.decode(&substream, iter->pos, arg);
-    }
-}
-
-static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter)
-{
-#ifdef PB_ENABLE_MALLOC
-    /* When decoding an oneof field, check if there is old data that must be
-     * released first. */
-    if (PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF)
-    {
-        if (!pb_release_union_field(stream, iter))
-            return false;
-    }
-#endif
-
-    switch (PB_ATYPE(iter->pos->type))
-    {
-        case PB_ATYPE_STATIC:
-            return decode_static_field(stream, wire_type, iter);
-        
-        case PB_ATYPE_POINTER:
-            return decode_pointer_field(stream, wire_type, iter);
-        
-        case PB_ATYPE_CALLBACK:
-            return decode_callback_field(stream, wire_type, iter);
-        
-        default:
-            PB_RETURN_ERROR(stream, "invalid field type");
-    }
-}
-
-static void iter_from_extension(pb_field_iter_t *iter, pb_extension_t *extension)
-{
-    /* Fake a field iterator for the extension field.
-     * It is not actually safe to advance this iterator, but decode_field
-     * will not even try to. */
-    const pb_field_t *field = (const pb_field_t*)extension->type->arg;
-    (void)pb_field_iter_begin(iter, field, extension->dest);
-    iter->pData = extension->dest;
-    iter->pSize = &extension->found;
-    
-    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
-    {
-        /* For pointer extensions, the pointer is stored directly
-         * in the extension structure. This avoids having an extra
-         * indirection. */
-        iter->pData = &extension->dest;
-    }
-}
-
-/* Default handler for extension fields. Expects a pb_field_t structure
- * in extension->type->arg. */
-static bool checkreturn default_extension_decoder(pb_istream_t *stream,
-    pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type)
-{
-    const pb_field_t *field = (const pb_field_t*)extension->type->arg;
-    pb_field_iter_t iter;
-    
-    if (field->tag != tag)
-        return true;
-    
-    iter_from_extension(&iter, extension);
-    extension->found = true;
-    return decode_field(stream, wire_type, &iter);
-}
-
-/* Try to decode an unknown field as an extension field. Tries each extension
- * decoder in turn, until one of them handles the field or loop ends. */
-static bool checkreturn decode_extension(pb_istream_t *stream,
-    uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter)
-{
-    pb_extension_t *extension = *(pb_extension_t* const *)iter->pData;
-    size_t pos = stream->bytes_left;
-    
-    while (extension != NULL && pos == stream->bytes_left)
-    {
-        bool status;
-        if (extension->type->decode)
-            status = extension->type->decode(stream, extension, tag, wire_type);
-        else
-            status = default_extension_decoder(stream, extension, tag, wire_type);
-
-        if (!status)
-            return false;
-        
-        extension = extension->next;
-    }
-    
-    return true;
-}
-
-/* Step through the iterator until an extension field is found or until all
- * entries have been checked. There can be only one extension field per
- * message. Returns false if no extension field is found. */
-static bool checkreturn find_extension_field(pb_field_iter_t *iter)
-{
-    const pb_field_t *start = iter->pos;
-    
-    do {
-        if (PB_LTYPE(iter->pos->type) == PB_LTYPE_EXTENSION)
-            return true;
-        (void)pb_field_iter_next(iter);
-    } while (iter->pos != start);
-    
-    return false;
-}
-
-/* Initialize message fields to default values, recursively */
-static void pb_field_set_to_default(pb_field_iter_t *iter)
-{
-    pb_type_t type;
-    type = iter->pos->type;
-    
-    if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
-    {
-        pb_extension_t *ext = *(pb_extension_t* const *)iter->pData;
-        while (ext != NULL)
-        {
-            pb_field_iter_t ext_iter;
-            ext->found = false;
-            iter_from_extension(&ext_iter, ext);
-            pb_field_set_to_default(&ext_iter);
-            ext = ext->next;
-        }
-    }
-    else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
-    {
-        bool init_data = true;
-        if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL)
-        {
-            /* Set has_field to false. Still initialize the optional field
-             * itself also. */
-            *(bool*)iter->pSize = false;
-        }
-        else if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
-                 PB_HTYPE(type) == PB_HTYPE_ONEOF)
-        {
-            /* REPEATED: Set array count to 0, no need to initialize contents.
-               ONEOF: Set which_field to 0. */
-            *(pb_size_t*)iter->pSize = 0;
-            init_data = false;
-        }
-
-        if (init_data)
-        {
-            if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE)
-            {
-                /* Initialize submessage to defaults */
-                pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, iter->pData);
-            }
-            else if (iter->pos->ptr != NULL)
-            {
-                /* Initialize to default value */
-                memcpy(iter->pData, iter->pos->ptr, iter->pos->data_size);
-            }
-            else
-            {
-                /* Initialize to zeros */
-                memset(iter->pData, 0, iter->pos->data_size);
-            }
-        }
-    }
-    else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
-    {
-        /* Initialize the pointer to NULL. */
-        *(void**)iter->pData = NULL;
-        
-        /* Initialize array count to 0. */
-        if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
-            PB_HTYPE(type) == PB_HTYPE_ONEOF)
-        {
-            *(pb_size_t*)iter->pSize = 0;
-        }
-    }
-    else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
-    {
-        /* Don't overwrite callback */
-    }
-}
-
-static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_struct)
-{
-    pb_field_iter_t iter;
-
-    if (!pb_field_iter_begin(&iter, fields, dest_struct))
-        return; /* Empty message type */
-    
-    do
-    {
-        pb_field_set_to_default(&iter);
-    } while (pb_field_iter_next(&iter));
-}
-
-/*********************
- * Decode all fields *
- *********************/
-
-bool checkreturn pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
-{
-    uint32_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 31) / 32] = {0, 0};
-    const uint32_t allbits = ~(uint32_t)0;
-    uint32_t extension_range_start = 0;
-    pb_field_iter_t iter;
-    
-    /* Return value ignored, as empty message types will be correctly handled by
-     * pb_field_iter_find() anyway. */
-    (void)pb_field_iter_begin(&iter, fields, dest_struct);
-    
-    while (stream->bytes_left)
-    {
-        uint32_t tag;
-        pb_wire_type_t wire_type;
-        bool eof;
-        
-        if (!pb_decode_tag(stream, &wire_type, &tag, &eof))
-        {
-            if (eof)
-                break;
-            else
-                return false;
-        }
-        
-        if (!pb_field_iter_find(&iter, tag))
-        {
-            /* No match found, check if it matches an extension. */
-            if (tag >= extension_range_start)
-            {
-                if (!find_extension_field(&iter))
-                    extension_range_start = (uint32_t)-1;
-                else
-                    extension_range_start = iter.pos->tag;
-                
-                if (tag >= extension_range_start)
-                {
-                    size_t pos = stream->bytes_left;
-                
-                    if (!decode_extension(stream, tag, wire_type, &iter))
-                        return false;
-                    
-                    if (pos != stream->bytes_left)
-                    {
-                        /* The field was handled */
-                        continue;                    
-                    }
-                }
-            }
-        
-            /* No match found, skip data */
-            if (!pb_skip_field(stream, wire_type))
-                return false;
-            continue;
-        }
-        
-        if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REQUIRED
-            && iter.required_field_index < PB_MAX_REQUIRED_FIELDS)
-        {
-            uint32_t tmp = ((uint32_t)1 << (iter.required_field_index & 31));
-            fields_seen[iter.required_field_index >> 5] |= tmp;
-        }
-            
-        if (!decode_field(stream, wire_type, &iter))
-            return false;
-    }
-    
-    /* Check that all required fields were present. */
-    {
-        /* First figure out the number of required fields by
-         * seeking to the end of the field array. Usually we
-         * are already close to end after decoding.
-         */
-        unsigned req_field_count;
-        pb_type_t last_type;
-        unsigned i;
-        do {
-            req_field_count = iter.required_field_index;
-            last_type = iter.pos->type;
-        } while (pb_field_iter_next(&iter));
-        
-        /* Fixup if last field was also required. */
-        if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.pos->tag != 0)
-            req_field_count++;
-        
-        if (req_field_count > 0)
-        {
-            /* Check the whole words */
-            for (i = 0; i < (req_field_count >> 5); i++)
-            {
-                if (fields_seen[i] != allbits)
-                    PB_RETURN_ERROR(stream, "missing required field");
-            }
-            
-            /* Check the remaining bits */
-            if (fields_seen[req_field_count >> 5] != (allbits >> (32 - (req_field_count & 31))))
-                PB_RETURN_ERROR(stream, "missing required field");
-        }
-    }
-    
-    return true;
-}
-
-bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
-{
-    bool status;
-    pb_message_set_to_defaults(fields, dest_struct);
-    status = pb_decode_noinit(stream, fields, dest_struct);
-    
-#ifdef PB_ENABLE_MALLOC
-    if (!status)
-        pb_release(fields, dest_struct);
-#endif
-    
-    return status;
-}
-
-bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
-{
-    pb_istream_t substream;
-    bool status;
-    
-    if (!pb_make_string_substream(stream, &substream))
-        return false;
-    
-    status = pb_decode(&substream, fields, dest_struct);
-    pb_close_string_substream(stream, &substream);
-    return status;
-}
-
-#ifdef PB_ENABLE_MALLOC
-/* Given an oneof field, if there has already been a field inside this oneof,
- * release it before overwriting with a different one. */
-static bool pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *iter)
-{
-    pb_size_t old_tag = *(pb_size_t*)iter->pSize; /* Previous which_ value */
-    pb_size_t new_tag = iter->pos->tag; /* New which_ value */
-
-    if (old_tag == 0)
-        return true; /* Ok, no old data in union */
-
-    if (old_tag == new_tag)
-        return true; /* Ok, old data is of same type => merge */
-
-    /* Release old data. The find can fail if the message struct contains
-     * invalid data. */
-    if (!pb_field_iter_find(iter, old_tag))
-        PB_RETURN_ERROR(stream, "invalid union tag");
-
-    pb_release_single_field(iter);
-
-    /* Restore iterator to where it should be.
-     * This shouldn't fail unless the pb_field_t structure is corrupted. */
-    if (!pb_field_iter_find(iter, new_tag))
-        PB_RETURN_ERROR(stream, "iterator error");
-    
-    return true;
-}
-
-static void pb_release_single_field(const pb_field_iter_t *iter)
-{
-    pb_type_t type;
-    type = iter->pos->type;
-
-    if (PB_HTYPE(type) == PB_HTYPE_ONEOF)
-    {
-        if (*(pb_size_t*)iter->pSize != iter->pos->tag)
-            return; /* This is not the current field in the union */
-    }
-
-    /* Release anything contained inside an extension or submsg.
-     * This has to be done even if the submsg itself is statically
-     * allocated. */
-    if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
-    {
-        /* Release fields from all extensions in the linked list */
-        pb_extension_t *ext = *(pb_extension_t**)iter->pData;
-        while (ext != NULL)
-        {
-            pb_field_iter_t ext_iter;
-            iter_from_extension(&ext_iter, ext);
-            pb_release_single_field(&ext_iter);
-            ext = ext->next;
-        }
-    }
-    else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE)
-    {
-        /* Release fields in submessage or submsg array */
-        void *pItem = iter->pData;
-        pb_size_t count = 1;
-        
-        if (PB_ATYPE(type) == PB_ATYPE_POINTER)
-        {
-            pItem = *(void**)iter->pData;
-        }
-        
-        if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
-        {
-            count = *(pb_size_t*)iter->pSize;
-
-            if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > iter->pos->array_size)
-            {
-                /* Protect against corrupted _count fields */
-                count = iter->pos->array_size;
-            }
-        }
-        
-        if (pItem)
-        {
-            while (count--)
-            {
-                pb_release((const pb_field_t*)iter->pos->ptr, pItem);
-                pItem = (char*)pItem + iter->pos->data_size;
-            }
-        }
-    }
-    
-    if (PB_ATYPE(type) == PB_ATYPE_POINTER)
-    {
-        if (PB_HTYPE(type) == PB_HTYPE_REPEATED &&
-            (PB_LTYPE(type) == PB_LTYPE_STRING ||
-             PB_LTYPE(type) == PB_LTYPE_BYTES))
-        {
-            /* Release entries in repeated string or bytes array */
-            void **pItem = *(void***)iter->pData;
-            pb_size_t count = *(pb_size_t*)iter->pSize;
-            while (count--)
-            {
-                pb_free(*pItem);
-                *pItem++ = NULL;
-            }
-        }
-        
-        if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
-        {
-            /* We are going to release the array, so set the size to 0 */
-            *(pb_size_t*)iter->pSize = 0;
-        }
-        
-        /* Release main item */
-        pb_free(*(void**)iter->pData);
-        *(void**)iter->pData = NULL;
-    }
-}
-
-void pb_release(const pb_field_t fields[], void *dest_struct)
-{
-    pb_field_iter_t iter;
-    
-    if (!dest_struct)
-        return; /* Ignore NULL pointers, similar to free() */
-
-    if (!pb_field_iter_begin(&iter, fields, dest_struct))
-        return; /* Empty message type */
-    
-    do
-    {
-        pb_release_single_field(&iter);
-    } while (pb_field_iter_next(&iter));
-}
-#endif
-
-/* Field decoders */
-
-bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest)
-{
-    uint64_t value;
-    if (!pb_decode_varint(stream, &value))
-        return false;
-    
-    if (value & 1)
-        *dest = (int64_t)(~(value >> 1));
-    else
-        *dest = (int64_t)(value >> 1);
-    
-    return true;
-}
-
-bool pb_decode_fixed32(pb_istream_t *stream, void *dest)
-{
-    pb_byte_t bytes[4];
-
-    if (!pb_read(stream, bytes, 4))
-        return false;
-    
-    *(uint32_t*)dest = ((uint32_t)bytes[0] << 0) |
-                       ((uint32_t)bytes[1] << 8) |
-                       ((uint32_t)bytes[2] << 16) |
-                       ((uint32_t)bytes[3] << 24);
-    return true;
-}
-
-bool pb_decode_fixed64(pb_istream_t *stream, void *dest)
-{
-    pb_byte_t bytes[8];
-
-    if (!pb_read(stream, bytes, 8))
-        return false;
-    
-    *(uint64_t*)dest = ((uint64_t)bytes[0] << 0) |
-                       ((uint64_t)bytes[1] << 8) |
-                       ((uint64_t)bytes[2] << 16) |
-                       ((uint64_t)bytes[3] << 24) |
-                       ((uint64_t)bytes[4] << 32) |
-                       ((uint64_t)bytes[5] << 40) |
-                       ((uint64_t)bytes[6] << 48) |
-                       ((uint64_t)bytes[7] << 56);
-    
-    return true;
-}
-
-static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    uint64_t value;
-    int64_t svalue;
-    int64_t clamped;
-    if (!pb_decode_varint(stream, &value))
-        return false;
-    
-    /* See issue 97: Google's C++ protobuf allows negative varint values to
-     * be cast as int32_t, instead of the int64_t that should be used when
-     * encoding. Previous nanopb versions had a bug in encoding. In order to
-     * not break decoding of such messages, we cast <=32 bit fields to
-     * int32_t first to get the sign correct.
-     */
-    if (field->data_size == sizeof(int64_t))
-        svalue = (int64_t)value;
-    else
-        svalue = (int32_t)value;
-
-    /* Cast to the proper field size, while checking for overflows */
-    if (field->data_size == sizeof(int64_t))
-        clamped = *(int64_t*)dest = svalue;
-    else if (field->data_size == sizeof(int32_t))
-        clamped = *(int32_t*)dest = (int32_t)svalue;
-    else if (field->data_size == sizeof(int_least16_t))
-        clamped = *(int_least16_t*)dest = (int_least16_t)svalue;
-    else if (field->data_size == sizeof(int_least8_t))
-        clamped = *(int_least8_t*)dest = (int_least8_t)svalue;
-    else
-        PB_RETURN_ERROR(stream, "invalid data_size");
-
-    if (clamped != svalue)
-        PB_RETURN_ERROR(stream, "integer too large");
-    
-    return true;
-}
-
-static bool checkreturn pb_dec_uvarint(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    uint64_t value, clamped;
-    if (!pb_decode_varint(stream, &value))
-        return false;
-    
-    /* Cast to the proper field size, while checking for overflows */
-    if (field->data_size == sizeof(uint64_t))
-        clamped = *(uint64_t*)dest = value;
-    else if (field->data_size == sizeof(uint32_t))
-        clamped = *(uint32_t*)dest = (uint32_t)value;
-    else if (field->data_size == sizeof(uint_least16_t))
-        clamped = *(uint_least16_t*)dest = (uint_least16_t)value;
-    else if (field->data_size == sizeof(uint_least8_t))
-        clamped = *(uint_least8_t*)dest = (uint_least8_t)value;
-    else
-        PB_RETURN_ERROR(stream, "invalid data_size");
-    
-    if (clamped != value)
-        PB_RETURN_ERROR(stream, "integer too large");
-
-    return true;
-}
-
-static bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    int64_t value, clamped;
-    if (!pb_decode_svarint(stream, &value))
-        return false;
-    
-    /* Cast to the proper field size, while checking for overflows */
-    if (field->data_size == sizeof(int64_t))
-        clamped = *(int64_t*)dest = value;
-    else if (field->data_size == sizeof(int32_t))
-        clamped = *(int32_t*)dest = (int32_t)value;
-    else if (field->data_size == sizeof(int_least16_t))
-        clamped = *(int_least16_t*)dest = (int_least16_t)value;
-    else if (field->data_size == sizeof(int_least8_t))
-        clamped = *(int_least8_t*)dest = (int_least8_t)value;
-    else
-        PB_RETURN_ERROR(stream, "invalid data_size");
-
-    if (clamped != value)
-        PB_RETURN_ERROR(stream, "integer too large");
-    
-    return true;
-}
-
-static bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    PB_UNUSED(field);
-    return pb_decode_fixed32(stream, dest);
-}
-
-static bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    PB_UNUSED(field);
-    return pb_decode_fixed64(stream, dest);
-}
-
-static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    uint32_t size;
-    size_t alloc_size;
-    pb_bytes_array_t *bdest;
-    
-    if (!pb_decode_varint32(stream, &size))
-        return false;
-    
-    if (size > PB_SIZE_MAX)
-        PB_RETURN_ERROR(stream, "bytes overflow");
-    
-    alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size);
-    if (size > alloc_size)
-        PB_RETURN_ERROR(stream, "size too large");
-    
-    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
-    {
-#ifndef PB_ENABLE_MALLOC
-        PB_RETURN_ERROR(stream, "no malloc support");
-#else
-        if (!allocate_field(stream, dest, alloc_size, 1))
-            return false;
-        bdest = *(pb_bytes_array_t**)dest;
-#endif
-    }
-    else
-    {
-        if (PB_LTYPE(field->type) == PB_LTYPE_FIXED_LENGTH_BYTES) {
-            if (size != field->data_size)
-                PB_RETURN_ERROR(stream, "incorrect inline bytes size");
-            return pb_read(stream, (pb_byte_t*)dest, field->data_size);
-        }
-
-        if (alloc_size > field->data_size)
-            PB_RETURN_ERROR(stream, "bytes overflow");
-        bdest = (pb_bytes_array_t*)dest;
-    }
-
-    bdest->size = (pb_size_t)size;
-    return pb_read(stream, bdest->bytes, size);
-}
-
-static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    uint32_t size;
-    size_t alloc_size;
-    bool status;
-    if (!pb_decode_varint32(stream, &size))
-        return false;
-    
-    /* Space for null terminator */
-    alloc_size = size + 1;
-    
-    if (alloc_size < size)
-        PB_RETURN_ERROR(stream, "size too large");
-    
-    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
-    {
-#ifndef PB_ENABLE_MALLOC
-        PB_RETURN_ERROR(stream, "no malloc support");
-#else
-        if (!allocate_field(stream, dest, alloc_size, 1))
-            return false;
-        dest = *(void**)dest;
-#endif
-    }
-    else
-    {
-        if (alloc_size > field->data_size)
-            PB_RETURN_ERROR(stream, "string overflow");
-    }
-    
-    status = pb_read(stream, (pb_byte_t*)dest, size);
-    *((pb_byte_t*)dest + size) = 0;
-    return status;
-}
-
-static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_t *field, void *dest)
-{
-    bool status;
-    pb_istream_t substream;
-    const pb_field_t* submsg_fields = (const pb_field_t*)field->ptr;
-    
-    if (!pb_make_string_substream(stream, &substream))
-        return false;
-    
-    if (field->ptr == NULL)
-        PB_RETURN_ERROR(stream, "invalid field descriptor");
-    
-    /* New array entries need to be initialized, while required and optional
-     * submessages have already been initialized in the top-level pb_decode. */
-    if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED)
-        status = pb_decode(&substream, submsg_fields, dest);
-    else
-        status = pb_decode_noinit(&substream, submsg_fields, dest);
-    
-    pb_close_string_substream(stream, &substream);
-    return status;
-}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_decode.h b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_decode.h
deleted file mode 100644 (file)
index 1d9bb19..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c.
- * The main function is pb_decode. You also need an input stream, and the
- * field descriptions created by nanopb_generator.py.
- */
-
-#ifndef PB_DECODE_H_INCLUDED
-#define PB_DECODE_H_INCLUDED
-
-#include "pb.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Structure for defining custom input streams. You will need to provide
- * a callback function to read the bytes from your storage, which can be
- * for example a file or a network socket.
- * 
- * The callback must conform to these rules:
- *
- * 1) Return false on IO errors. This will cause decoding to abort.
- * 2) You can use state to store your own data (e.g. buffer pointer),
- *    and rely on pb_read to verify that no-body reads past bytes_left.
- * 3) Your callback may be used with substreams, in which case bytes_left
- *    is different than from the main stream. Don't use bytes_left to compute
- *    any pointers.
- */
-struct pb_istream_s
-{
-#ifdef PB_BUFFER_ONLY
-    /* Callback pointer is not used in buffer-only configuration.
-     * Having an int pointer here allows binary compatibility but
-     * gives an error if someone tries to assign callback function.
-     */
-    int *callback;
-#else
-    bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count);
-#endif
-
-    void *state; /* Free field for use by callback implementation */
-    size_t bytes_left;
-    
-#ifndef PB_NO_ERRMSG
-    const char *errmsg;
-#endif
-};
-
-/***************************
- * Main decoding functions *
- ***************************/
-/* Decode a single protocol buffers message from input stream into a C structure.
- * Returns true on success, false on any failure.
- * The actual struct pointed to by dest must match the description in fields.
- * Callback fields of the destination structure must be initialized by caller.
- * All other fields will be initialized by this function.
- *
- * Example usage:
- *    MyMessage msg = {};
- *    uint8_t buffer[64];
- *    pb_istream_t stream;
- *    
- *    // ... read some data into buffer ...
- *
- *    stream = pb_istream_from_buffer(buffer, count);
- *    pb_decode(&stream, MyMessage_fields, &msg);
- */
-bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
-
-/* Same as pb_decode, except does not initialize the destination structure
- * to default values. This is slightly faster if you need no default values
- * and just do memset(struct, 0, sizeof(struct)) yourself.
- *
- * This can also be used for 'merging' two messages, i.e. update only the
- * fields that exist in the new message.
- *
- * Note: If this function returns with an error, it will not release any
- * dynamically allocated fields. You will need to call pb_release() yourself.
- */
-bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
-
-/* Same as pb_decode, except expects the stream to start with the message size
- * encoded as varint. Corresponds to parseDelimitedFrom() in Google's
- * protobuf API.
- */
-bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
-
-#ifdef PB_ENABLE_MALLOC
-/* Release any allocated pointer fields. If you use dynamic allocation, you should
- * call this for any successfully decoded message when you are done with it. If
- * pb_decode() returns with an error, the message is already released.
- */
-void pb_release(const pb_field_t fields[], void *dest_struct);
-#endif
-
-
-/**************************************
- * Functions for manipulating streams *
- **************************************/
-
-/* Create an input stream for reading from a memory buffer.
- *
- * Alternatively, you can use a custom stream that reads directly from e.g.
- * a file or a network socket.
- */
-pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize);
-
-/* Function to read from a pb_istream_t. You can use this if you need to
- * read some custom header data, or to read data in field callbacks.
- */
-bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
-
-
-/************************************************
- * Helper functions for writing field callbacks *
- ************************************************/
-
-/* Decode the tag for the next field in the stream. Gives the wire type and
- * field tag. At end of the message, returns false and sets eof to true. */
-bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof);
-
-/* Skip the field payload data, given the wire type. */
-bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type);
-
-/* Decode an integer in the varint format. This works for bool, enum, int32,
- * int64, uint32 and uint64 field types. */
-bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest);
-
-/* Decode an integer in the zig-zagged svarint format. This works for sint32
- * and sint64. */
-bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest);
-
-/* Decode a fixed32, sfixed32 or float value. You need to pass a pointer to
- * a 4-byte wide C variable. */
-bool pb_decode_fixed32(pb_istream_t *stream, void *dest);
-
-/* Decode a fixed64, sfixed64 or double value. You need to pass a pointer to
- * a 8-byte wide C variable. */
-bool pb_decode_fixed64(pb_istream_t *stream, void *dest);
-
-/* Make a limited-length substream for reading a PB_WT_STRING field. */
-bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream);
-void pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_encode.c b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_encode.c
deleted file mode 100644 (file)
index 4685614..0000000
+++ /dev/null
@@ -1,696 +0,0 @@
-/* pb_encode.c -- encode a protobuf using minimal resources
- *
- * 2011 Petteri Aimonen <jpa@kapsi.fi>
- */
-
-#include "pb.h"
-#include "pb_encode.h"
-#include "pb_common.h"
-
-/* Use the GCC warn_unused_result attribute to check that all return values
- * are propagated correctly. On other compilers and gcc before 3.4.0 just
- * ignore the annotation.
- */
-#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-    #define checkreturn
-#else
-    #define checkreturn __attribute__((warn_unused_result))
-#endif
-
-/**************************************
- * Declarations internal to this file *
- **************************************/
-typedef bool (*pb_encoder_t)(pb_ostream_t *stream, const pb_field_t *field, const void *src) checkreturn;
-
-static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
-static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *field, const void *pData, size_t count, pb_encoder_t func);
-static bool checkreturn encode_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData);
-static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *extension);
-static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData);
-static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_t *field, const void *src);
-
-/* --- Function pointers to field encoders ---
- * Order in the array must match pb_action_t LTYPE numbering.
- */
-static const pb_encoder_t PB_ENCODERS[PB_LTYPES_COUNT] = {
-    &pb_enc_varint,
-    &pb_enc_uvarint,
-    &pb_enc_svarint,
-    &pb_enc_fixed32,
-    &pb_enc_fixed64,
-    
-    &pb_enc_bytes,
-    &pb_enc_string,
-    &pb_enc_submessage,
-    NULL, /* extensions */
-    &pb_enc_bytes /* PB_LTYPE_FIXED_LENGTH_BYTES */
-};
-
-/*******************************
- * pb_ostream_t implementation *
- *******************************/
-
-static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
-{
-    pb_byte_t *dest = (pb_byte_t*)stream->state;
-    stream->state = dest + count;
-    
-    while (count--)
-        *dest++ = *buf++;
-    
-    return true;
-}
-
-pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize)
-{
-    pb_ostream_t stream;
-#ifdef PB_BUFFER_ONLY
-    stream.callback = (void*)1; /* Just a marker value */
-#else
-    stream.callback = &buf_write;
-#endif
-    stream.state = buf;
-    stream.max_size = bufsize;
-    stream.bytes_written = 0;
-#ifndef PB_NO_ERRMSG
-    stream.errmsg = NULL;
-#endif
-    return stream;
-}
-
-bool checkreturn pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
-{
-    if (stream->callback != NULL)
-    {
-        if (stream->bytes_written + count > stream->max_size)
-            PB_RETURN_ERROR(stream, "stream full");
-
-#ifdef PB_BUFFER_ONLY
-        if (!buf_write(stream, buf, count))
-            PB_RETURN_ERROR(stream, "io error");
-#else        
-        if (!stream->callback(stream, buf, count))
-            PB_RETURN_ERROR(stream, "io error");
-#endif
-    }
-    
-    stream->bytes_written += count;
-    return true;
-}
-
-/*************************
- * Encode a single field *
- *************************/
-
-/* Encode a static array. Handles the size calculations and possible packing. */
-static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *field,
-                         const void *pData, size_t count, pb_encoder_t func)
-{
-    size_t i;
-    const void *p;
-    size_t size;
-    
-    if (count == 0)
-        return true;
-
-    if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size)
-        PB_RETURN_ERROR(stream, "array max size exceeded");
-    
-    /* We always pack arrays if the datatype allows it. */
-    if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
-    {
-        if (!pb_encode_tag(stream, PB_WT_STRING, field->tag))
-            return false;
-        
-        /* Determine the total size of packed array. */
-        if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32)
-        {
-            size = 4 * count;
-        }
-        else if (PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
-        {
-            size = 8 * count;
-        }
-        else
-        { 
-            pb_ostream_t sizestream = PB_OSTREAM_SIZING;
-            p = pData;
-            for (i = 0; i < count; i++)
-            {
-                if (!func(&sizestream, field, p))
-                    return false;
-                p = (const char*)p + field->data_size;
-            }
-            size = sizestream.bytes_written;
-        }
-        
-        if (!pb_encode_varint(stream, (uint64_t)size))
-            return false;
-        
-        if (stream->callback == NULL)
-            return pb_write(stream, NULL, size); /* Just sizing.. */
-        
-        /* Write the data */
-        p = pData;
-        for (i = 0; i < count; i++)
-        {
-            if (!func(stream, field, p))
-                return false;
-            p = (const char*)p + field->data_size;
-        }
-    }
-    else
-    {
-        p = pData;
-        for (i = 0; i < count; i++)
-        {
-            if (!pb_encode_tag_for_field(stream, field))
-                return false;
-
-            /* Normally the data is stored directly in the array entries, but
-             * for pointer-type string and bytes fields, the array entries are
-             * actually pointers themselves also. So we have to dereference once
-             * more to get to the actual data. */
-            if (PB_ATYPE(field->type) == PB_ATYPE_POINTER &&
-                (PB_LTYPE(field->type) == PB_LTYPE_STRING ||
-                 PB_LTYPE(field->type) == PB_LTYPE_BYTES))
-            {
-                if (!func(stream, field, *(const void* const*)p))
-                    return false;      
-            }
-            else
-            {
-                if (!func(stream, field, p))
-                    return false;
-            }
-            p = (const char*)p + field->data_size;
-        }
-    }
-    
-    return true;
-}
-
-/* Encode a field with static or pointer allocation, i.e. one whose data
- * is available to the encoder directly. */
-static bool checkreturn encode_basic_field(pb_ostream_t *stream,
-    const pb_field_t *field, const void *pData)
-{
-    pb_encoder_t func;
-    const void *pSize;
-    bool implicit_has = true;
-    
-    func = PB_ENCODERS[PB_LTYPE(field->type)];
-    
-    if (field->size_offset)
-        pSize = (const char*)pData + field->size_offset;
-    else
-        pSize = &implicit_has;
-
-    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
-    {
-        /* pData is a pointer to the field, which contains pointer to
-         * the data. If the 2nd pointer is NULL, it is interpreted as if
-         * the has_field was false.
-         */
-        
-        pData = *(const void* const*)pData;
-        implicit_has = (pData != NULL);
-    }
-
-    switch (PB_HTYPE(field->type))
-    {
-        case PB_HTYPE_REQUIRED:
-            if (!pData)
-                PB_RETURN_ERROR(stream, "missing required field");
-            if (!pb_encode_tag_for_field(stream, field))
-                return false;
-            if (!func(stream, field, pData))
-                return false;
-            break;
-        
-        case PB_HTYPE_OPTIONAL:
-            if (*(const bool*)pSize)
-            {
-                if (!pb_encode_tag_for_field(stream, field))
-                    return false;
-            
-                if (!func(stream, field, pData))
-                    return false;
-            }
-            break;
-        
-        case PB_HTYPE_REPEATED:
-            if (!encode_array(stream, field, pData, *(const pb_size_t*)pSize, func))
-                return false;
-            break;
-        
-        case PB_HTYPE_ONEOF:
-            if (*(const pb_size_t*)pSize == field->tag)
-            {
-                if (!pb_encode_tag_for_field(stream, field))
-                    return false;
-
-                if (!func(stream, field, pData))
-                    return false;
-            }
-            break;
-            
-        default:
-            PB_RETURN_ERROR(stream, "invalid field type");
-    }
-    
-    return true;
-}
-
-/* Encode a field with callback semantics. This means that a user function is
- * called to provide and encode the actual data. */
-static bool checkreturn encode_callback_field(pb_ostream_t *stream,
-    const pb_field_t *field, const void *pData)
-{
-    const pb_callback_t *callback = (const pb_callback_t*)pData;
-    
-#ifdef PB_OLD_CALLBACK_STYLE
-    const void *arg = callback->arg;
-#else
-    void * const *arg = &(callback->arg);
-#endif    
-    
-    if (callback->funcs.encode != NULL)
-    {
-        if (!callback->funcs.encode(stream, field, arg))
-            PB_RETURN_ERROR(stream, "callback error");
-    }
-    return true;
-}
-
-/* Encode a single field of any callback or static type. */
-static bool checkreturn encode_field(pb_ostream_t *stream,
-    const pb_field_t *field, const void *pData)
-{
-    switch (PB_ATYPE(field->type))
-    {
-        case PB_ATYPE_STATIC:
-        case PB_ATYPE_POINTER:
-            return encode_basic_field(stream, field, pData);
-        
-        case PB_ATYPE_CALLBACK:
-            return encode_callback_field(stream, field, pData);
-        
-        default:
-            PB_RETURN_ERROR(stream, "invalid field type");
-    }
-}
-
-/* Default handler for extension fields. Expects to have a pb_field_t
- * pointer in the extension->type->arg field. */
-static bool checkreturn default_extension_encoder(pb_ostream_t *stream,
-    const pb_extension_t *extension)
-{
-    const pb_field_t *field = (const pb_field_t*)extension->type->arg;
-    
-    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
-    {
-        /* For pointer extensions, the pointer is stored directly
-         * in the extension structure. This avoids having an extra
-         * indirection. */
-        return encode_field(stream, field, &extension->dest);
-    }
-    else
-    {
-        return encode_field(stream, field, extension->dest);
-    }
-}
-
-/* Walk through all the registered extensions and give them a chance
- * to encode themselves. */
-static bool checkreturn encode_extension_field(pb_ostream_t *stream,
-    const pb_field_t *field, const void *pData)
-{
-    const pb_extension_t *extension = *(const pb_extension_t* const *)pData;
-    PB_UNUSED(field);
-    
-    while (extension)
-    {
-        bool status;
-        if (extension->type->encode)
-            status = extension->type->encode(stream, extension);
-        else
-            status = default_extension_encoder(stream, extension);
-
-        if (!status)
-            return false;
-        
-        extension = extension->next;
-    }
-    
-    return true;
-}
-
-/*********************
- * Encode all fields *
- *********************/
-
-static void *remove_const(const void *p)
-{
-    /* Note: this casts away const, in order to use the common field iterator
-     * logic for both encoding and decoding. */
-    union {
-        void *p1;
-        const void *p2;
-    } t;
-    t.p2 = p;
-    return t.p1;
-}
-
-bool checkreturn pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct)
-{
-    pb_field_iter_t iter;
-    if (!pb_field_iter_begin(&iter, fields, remove_const(src_struct)))
-        return true; /* Empty message type */
-    
-    do {
-        if (PB_LTYPE(iter.pos->type) == PB_LTYPE_EXTENSION)
-        {
-            /* Special case for the extension field placeholder */
-            if (!encode_extension_field(stream, iter.pos, iter.pData))
-                return false;
-        }
-        else
-        {
-            /* Regular field */
-            if (!encode_field(stream, iter.pos, iter.pData))
-                return false;
-        }
-    } while (pb_field_iter_next(&iter));
-    
-    return true;
-}
-
-bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct)
-{
-    return pb_encode_submessage(stream, fields, src_struct);
-}
-
-bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct)
-{
-    pb_ostream_t stream = PB_OSTREAM_SIZING;
-    
-    if (!pb_encode(&stream, fields, src_struct))
-        return false;
-    
-    *size = stream.bytes_written;
-    return true;
-}
-
-/********************
- * Helper functions *
- ********************/
-bool checkreturn pb_encode_varint(pb_ostream_t *stream, uint64_t value)
-{
-    pb_byte_t buffer[10];
-    size_t i = 0;
-    
-    if (value <= 0x7F)
-    {
-        pb_byte_t v = (pb_byte_t)value;
-        return pb_write(stream, &v, 1);
-    }
-    
-    while (value)
-    {
-        buffer[i] = (pb_byte_t)((value & 0x7F) | 0x80);
-        value >>= 7;
-        i++;
-    }
-    buffer[i-1] &= 0x7F; /* Unset top bit on last byte */
-    
-    return pb_write(stream, buffer, i);
-}
-
-bool checkreturn pb_encode_svarint(pb_ostream_t *stream, int64_t value)
-{
-    uint64_t zigzagged;
-    if (value < 0)
-        zigzagged = ~((uint64_t)value << 1);
-    else
-        zigzagged = (uint64_t)value << 1;
-    
-    return pb_encode_varint(stream, zigzagged);
-}
-
-bool checkreturn pb_encode_fixed32(pb_ostream_t *stream, const void *value)
-{
-    uint32_t val = *(const uint32_t*)value;
-    pb_byte_t bytes[4];
-    bytes[0] = (pb_byte_t)(val & 0xFF);
-    bytes[1] = (pb_byte_t)((val >> 8) & 0xFF);
-    bytes[2] = (pb_byte_t)((val >> 16) & 0xFF);
-    bytes[3] = (pb_byte_t)((val >> 24) & 0xFF);
-    return pb_write(stream, bytes, 4);
-}
-
-bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value)
-{
-    uint64_t val = *(const uint64_t*)value;
-    pb_byte_t bytes[8];
-    bytes[0] = (pb_byte_t)(val & 0xFF);
-    bytes[1] = (pb_byte_t)((val >> 8) & 0xFF);
-    bytes[2] = (pb_byte_t)((val >> 16) & 0xFF);
-    bytes[3] = (pb_byte_t)((val >> 24) & 0xFF);
-    bytes[4] = (pb_byte_t)((val >> 32) & 0xFF);
-    bytes[5] = (pb_byte_t)((val >> 40) & 0xFF);
-    bytes[6] = (pb_byte_t)((val >> 48) & 0xFF);
-    bytes[7] = (pb_byte_t)((val >> 56) & 0xFF);
-    return pb_write(stream, bytes, 8);
-}
-
-bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number)
-{
-    uint64_t tag = ((uint64_t)field_number << 3) | wiretype;
-    return pb_encode_varint(stream, tag);
-}
-
-bool checkreturn pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field)
-{
-    pb_wire_type_t wiretype;
-    switch (PB_LTYPE(field->type))
-    {
-        case PB_LTYPE_VARINT:
-        case PB_LTYPE_UVARINT:
-        case PB_LTYPE_SVARINT:
-            wiretype = PB_WT_VARINT;
-            break;
-        
-        case PB_LTYPE_FIXED32:
-            wiretype = PB_WT_32BIT;
-            break;
-        
-        case PB_LTYPE_FIXED64:
-            wiretype = PB_WT_64BIT;
-            break;
-        
-        case PB_LTYPE_BYTES:
-        case PB_LTYPE_STRING:
-        case PB_LTYPE_SUBMESSAGE:
-        case PB_LTYPE_FIXED_LENGTH_BYTES:
-            wiretype = PB_WT_STRING;
-            break;
-        
-        default:
-            PB_RETURN_ERROR(stream, "invalid field type");
-    }
-    
-    return pb_encode_tag(stream, wiretype, field->tag);
-}
-
-bool checkreturn pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size)
-{
-    if (!pb_encode_varint(stream, (uint64_t)size))
-        return false;
-    
-    return pb_write(stream, buffer, size);
-}
-
-bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct)
-{
-    /* First calculate the message size using a non-writing substream. */
-    pb_ostream_t substream = PB_OSTREAM_SIZING;
-    size_t size;
-    bool status;
-    
-    if (!pb_encode(&substream, fields, src_struct))
-    {
-#ifndef PB_NO_ERRMSG
-        stream->errmsg = substream.errmsg;
-#endif
-        return false;
-    }
-    
-    size = substream.bytes_written;
-    
-    if (!pb_encode_varint(stream, (uint64_t)size))
-        return false;
-    
-    if (stream->callback == NULL)
-        return pb_write(stream, NULL, size); /* Just sizing */
-    
-    if (stream->bytes_written + size > stream->max_size)
-        PB_RETURN_ERROR(stream, "stream full");
-        
-    /* Use a substream to verify that a callback doesn't write more than
-     * what it did the first time. */
-    substream.callback = stream->callback;
-    substream.state = stream->state;
-    substream.max_size = size;
-    substream.bytes_written = 0;
-#ifndef PB_NO_ERRMSG
-    substream.errmsg = NULL;
-#endif
-    
-    status = pb_encode(&substream, fields, src_struct);
-    
-    stream->bytes_written += substream.bytes_written;
-    stream->state = substream.state;
-#ifndef PB_NO_ERRMSG
-    stream->errmsg = substream.errmsg;
-#endif
-    
-    if (substream.bytes_written != size)
-        PB_RETURN_ERROR(stream, "submsg size changed");
-    
-    return status;
-}
-
-/* Field encoders */
-
-static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    int64_t value = 0;
-    
-    if (field->data_size == sizeof(int_least8_t))
-        value = *(const int_least8_t*)src;
-    else if (field->data_size == sizeof(int_least16_t))
-        value = *(const int_least16_t*)src;
-    else if (field->data_size == sizeof(int32_t))
-        value = *(const int32_t*)src;
-    else if (field->data_size == sizeof(int64_t))
-        value = *(const int64_t*)src;
-    else
-        PB_RETURN_ERROR(stream, "invalid data_size");
-    
-    return pb_encode_varint(stream, (uint64_t)value);
-}
-
-static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    uint64_t value = 0;
-    
-    if (field->data_size == sizeof(uint_least8_t))
-        value = *(const uint_least8_t*)src;
-    else if (field->data_size == sizeof(uint_least16_t))
-        value = *(const uint_least16_t*)src;
-    else if (field->data_size == sizeof(uint32_t))
-        value = *(const uint32_t*)src;
-    else if (field->data_size == sizeof(uint64_t))
-        value = *(const uint64_t*)src;
-    else
-        PB_RETURN_ERROR(stream, "invalid data_size");
-    
-    return pb_encode_varint(stream, value);
-}
-
-static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    int64_t value = 0;
-    
-    if (field->data_size == sizeof(int_least8_t))
-        value = *(const int_least8_t*)src;
-    else if (field->data_size == sizeof(int_least16_t))
-        value = *(const int_least16_t*)src;
-    else if (field->data_size == sizeof(int32_t))
-        value = *(const int32_t*)src;
-    else if (field->data_size == sizeof(int64_t))
-        value = *(const int64_t*)src;
-    else
-        PB_RETURN_ERROR(stream, "invalid data_size");
-    
-    return pb_encode_svarint(stream, value);
-}
-
-static bool checkreturn pb_enc_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    PB_UNUSED(field);
-    return pb_encode_fixed64(stream, src);
-}
-
-static bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    PB_UNUSED(field);
-    return pb_encode_fixed32(stream, src);
-}
-
-static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    const pb_bytes_array_t *bytes = NULL;
-
-    if (PB_LTYPE(field->type) == PB_LTYPE_FIXED_LENGTH_BYTES)
-        return pb_encode_string(stream, (const pb_byte_t*)src, field->data_size);
-
-    bytes = (const pb_bytes_array_t*)src;
-    
-    if (src == NULL)
-    {
-        /* Treat null pointer as an empty bytes field */
-        return pb_encode_string(stream, NULL, 0);
-    }
-    
-    if (PB_ATYPE(field->type) == PB_ATYPE_STATIC &&
-        PB_BYTES_ARRAY_T_ALLOCSIZE(bytes->size) > field->data_size)
-    {
-        PB_RETURN_ERROR(stream, "bytes size exceeded");
-    }
-    
-    return pb_encode_string(stream, bytes->bytes, bytes->size);
-}
-
-static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    size_t size = 0;
-    size_t max_size = field->data_size;
-    const char *p = (const char*)src;
-    
-    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
-        max_size = (size_t)-1;
-
-    if (src == NULL)
-    {
-        size = 0; /* Treat null pointer as an empty string */
-    }
-    else
-    {
-        /* strnlen() is not always available, so just use a loop */
-        while (size < max_size && *p != '\0')
-        {
-            size++;
-            p++;
-        }
-    }
-
-    return pb_encode_string(stream, (const pb_byte_t*)src, size);
-}
-
-static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_t *field, const void *src)
-{
-    if (field->ptr == NULL)
-        PB_RETURN_ERROR(stream, "invalid field descriptor");
-    
-    return pb_encode_submessage(stream, (const pb_field_t*)field->ptr, src);
-}
-
diff --git a/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_encode.h b/legacy-libs/grpc/deps/grpc/third_party/nanopb/pb_encode.h
deleted file mode 100644 (file)
index d9909fb..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c.
- * The main function is pb_encode. You also need an output stream, and the
- * field descriptions created by nanopb_generator.py.
- */
-
-#ifndef PB_ENCODE_H_INCLUDED
-#define PB_ENCODE_H_INCLUDED
-
-#include "pb.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Structure for defining custom output streams. You will need to provide
- * a callback function to write the bytes to your storage, which can be
- * for example a file or a network socket.
- *
- * The callback must conform to these rules:
- *
- * 1) Return false on IO errors. This will cause encoding to abort.
- * 2) You can use state to store your own data (e.g. buffer pointer).
- * 3) pb_write will update bytes_written after your callback runs.
- * 4) Substreams will modify max_size and bytes_written. Don't use them
- *    to calculate any pointers.
- */
-struct pb_ostream_s
-{
-#ifdef PB_BUFFER_ONLY
-    /* Callback pointer is not used in buffer-only configuration.
-     * Having an int pointer here allows binary compatibility but
-     * gives an error if someone tries to assign callback function.
-     * Also, NULL pointer marks a 'sizing stream' that does not
-     * write anything.
-     */
-    int *callback;
-#else
-    bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
-#endif
-    void *state;          /* Free field for use by callback implementation. */
-    size_t max_size;      /* Limit number of output bytes written (or use SIZE_MAX). */
-    size_t bytes_written; /* Number of bytes written so far. */
-    
-#ifndef PB_NO_ERRMSG
-    const char *errmsg;
-#endif
-};
-
-/***************************
- * Main encoding functions *
- ***************************/
-
-/* Encode a single protocol buffers message from C structure into a stream.
- * Returns true on success, false on any failure.
- * The actual struct pointed to by src_struct must match the description in fields.
- * All required fields in the struct are assumed to have been filled in.
- *
- * Example usage:
- *    MyMessage msg = {};
- *    uint8_t buffer[64];
- *    pb_ostream_t stream;
- *
- *    msg.field1 = 42;
- *    stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
- *    pb_encode(&stream, MyMessage_fields, &msg);
- */
-bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct);
-
-/* Same as pb_encode, but prepends the length of the message as a varint.
- * Corresponds to writeDelimitedTo() in Google's protobuf API.
- */
-bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct);
-
-/* Encode the message to get the size of the encoded data, but do not store
- * the data. */
-bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct);
-
-/**************************************
- * Functions for manipulating streams *
- **************************************/
-
-/* Create an output stream for writing into a memory buffer.
- * The number of bytes written can be found in stream.bytes_written after
- * encoding the message.
- *
- * Alternatively, you can use a custom stream that writes directly to e.g.
- * a file or a network socket.
- */
-pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize);
-
-/* Pseudo-stream for measuring the size of a message without actually storing
- * the encoded data.
- * 
- * Example usage:
- *    MyMessage msg = {};
- *    pb_ostream_t stream = PB_OSTREAM_SIZING;
- *    pb_encode(&stream, MyMessage_fields, &msg);
- *    printf("Message size is %d\n", stream.bytes_written);
- */
-#ifndef PB_NO_ERRMSG
-#define PB_OSTREAM_SIZING {0,0,0,0,0}
-#else
-#define PB_OSTREAM_SIZING {0,0,0,0}
-#endif
-
-/* Function to write into a pb_ostream_t stream. You can use this if you need
- * to append or prepend some custom headers to the message.
- */
-bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
-
-
-/************************************************
- * Helper functions for writing field callbacks *
- ************************************************/
-
-/* Encode field header based on type and field number defined in the field
- * structure. Call this from the callback before writing out field contents. */
-bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field);
-
-/* Encode field header by manually specifing wire type. You need to use this
- * if you want to write out packed arrays from a callback field. */
-bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number);
-
-/* Encode an integer in the varint format.
- * This works for bool, enum, int32, int64, uint32 and uint64 field types. */
-bool pb_encode_varint(pb_ostream_t *stream, uint64_t value);
-
-/* Encode an integer in the zig-zagged svarint format.
- * This works for sint32 and sint64. */
-bool pb_encode_svarint(pb_ostream_t *stream, int64_t value);
-
-/* Encode a string or bytes type field. For strings, pass strlen(s) as size. */
-bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size);
-
-/* Encode a fixed32, sfixed32 or float value.
- * You need to pass a pointer to a 4-byte wide C variable. */
-bool pb_encode_fixed32(pb_ostream_t *stream, const void *value);
-
-/* Encode a fixed64, sfixed64 or double value.
- * You need to pass a pointer to a 8-byte wide C variable. */
-bool pb_encode_fixed64(pb_ostream_t *stream, const void *value);
-
-/* Encode a submessage field.
- * You need to pass the pb_field_t array and pointer to struct, just like
- * with pb_encode(). This internally encodes the submessage twice, first to
- * calculate message size and then to actually write it out.
- */
-bool pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/LICENSE b/legacy-libs/grpc/deps/grpc/third_party/upb/LICENSE
new file mode 100644 (file)
index 0000000..da93984
--- /dev/null
@@ -0,0 +1,26 @@
+
+Copyright (c) 2009-2011, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Google Inc. nor the names of any other
+      contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL GOOGLE INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/README.md b/legacy-libs/grpc/deps/grpc/third_party/upb/README.md
new file mode 100644 (file)
index 0000000..a08aa0e
--- /dev/null
@@ -0,0 +1,134 @@
+
+# μpb - a small protobuf implementation in C
+
+|Platform|Build Status|
+|--------|------------|
+|macOS|[![Build Status](https://storage.googleapis.com/upb-kokoro-results/status-badge/macos.png)](https://fusion.corp.google.com/projectanalysis/summary/KOKORO/prod%3Aupb%2Fmacos%2Fcontinuous)|
+|ubuntu|[![Build Status](https://storage.googleapis.com/upb-kokoro-results/status-badge/ubuntu.png)](https://fusion.corp.google.com/projectanalysis/summary/KOKORO/prod%3Aupb%2Fubuntu%2Fcontinuous)|
+
+μpb (often written 'upb') is a small protobuf implementation written in C.
+
+upb generates a C API for creating, parsing, and serializing messages
+as declared in `.proto` files.  upb is heavily arena-based: all
+messages always live in an arena (note: the arena can live in stack or
+static memory if desired).  Here is a simple example:
+
+```c
+#include "conformance/conformance.upb.h"
+
+void foo(const char* data, size_t size) {
+  upb_arena *arena;
+
+  /* Generated message type. */
+  conformance_ConformanceRequest *request;
+  conformance_ConformanceResponse *response;
+
+  arena = upb_arena_new();
+  request = conformance_ConformanceRequest_parse(data, size, arena);
+  response = conformance_ConformanceResponse_new(arena);
+
+  switch (conformance_ConformanceRequest_payload_case(request)) {
+    case conformance_ConformanceRequest_payload_protobuf_payload: {
+      upb_strview payload = conformance_ConformanceRequest_protobuf_payload(request);
+      // ...
+      break;
+    }
+
+    case conformance_ConformanceRequest_payload_NOT_SET:
+      fprintf(stderr, "conformance_upb: Request didn't have payload.\n");
+      break;
+
+    default: {
+      static const char msg[] = "Unsupported input format.";
+      conformance_ConformanceResponse_set_skipped(
+          response, upb_strview_make(msg, sizeof(msg)));
+      break;
+    }
+  }
+
+  /* Frees all messages on the arena. */
+  upb_arena_free(arena);
+}
+```
+
+API and ABI are both subject to change!  Please do not distribute
+as a shared library for this reason (for now at least).
+
+## Using upb in your project
+
+Currently only Bazel is supported (CMake support is partial and incomplete
+but full CMake support is an eventual goal).
+
+To use upb in your Bazel project, first add upb to your `WORKSPACE` file,
+either as a `git_repository()` or as a `new_local_repository()` with a
+Git Submodule.  (For an example, see `examples/bazel/ in this repo).
+
+```python
+# Add this to your WORKSPACE file.
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
+git_repository(
+    name = "upb",
+    remote = "https://github.com/protocolbuffers/upb.git",
+    commit = "d16bf99ac4658793748cda3251226059892b3b7b",
+)
+
+load("@upb//bazel:workspace_deps.bzl", "upb_deps")
+
+upb_deps()
+```
+
+Then in your BUILD file you can add `upb_proto_library()` rules that
+generate code for a corresponding `proto_library()` rule.  For
+example:
+
+```python
+# Add this to your BUILD file.
+load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
+
+proto_library(
+    name = "foo_proto",
+    srcs = ["foo.proto"],
+)
+
+upb_proto_library(
+    name = "foo_upbproto",
+    deps = [":foo_proto"],
+)
+
+cc_binary(
+    name = "test_binary",
+    srcs = ["test_binary.c"],
+    deps = [":foo_upbproto"],
+)
+```
+
+Then in your `.c` file you can #include the generated header:
+
+```c
+#include "foo.upb.h"
+
+/* Insert code that uses generated types. */
+```
+
+## Old "handlers" interfaces
+
+This library contains several semi-deprecated interfaces (see BUILD
+file for more info about which interfaces are deprecated).  These
+deprecated interfaces are still used in some significant projects,
+such as the Ruby and PHP C bindings for protobuf in the [main protobuf
+repo](https://github.com/protocolbuffers/protobuf).  The goal is to
+migrate the Ruby/PHP bindings to use the newer, simpler interfaces
+instead.  Please do not use the old interfaces in new code.
+
+## Lua bindings
+
+This repo has some Lua bindings for the core library.  These are
+experimental and very incomplete.  These are currently included in
+order to validate that the C API is suitable for wrapping.  As the
+project matures these Lua bindings may become publicly available.
+
+## Contact
+
+Author: Josh Haberman ([jhaberman@gmail.com](mailto:jhaberman@gmail.com),
+[haberman@google.com](mailto:haberman@google.com))
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/examples/bazel/test_binary.c b/legacy-libs/grpc/deps/grpc/third_party/upb/examples/bazel/test_binary.c
new file mode 100644 (file)
index 0000000..78f367a
--- /dev/null
@@ -0,0 +1,17 @@
+
+#include <time.h>
+
+#include "foo.upb.h"
+
+int main() {
+  upb_arena *arena = upb_arena_new();
+  Foo* foo = Foo_new(arena);
+  const char greeting[] = "Hello, World!\n";
+
+  Foo_set_time(foo, time(NULL));
+  /* Warning: the proto will not copy this, the string data must outlive
+   * the proto. */
+  Foo_set_greeting(foo, upb_strview_makez(greeting));
+
+  upb_arena_free(arena);
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c b/legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c
new file mode 100644 (file)
index 0000000..61b9299
--- /dev/null
@@ -0,0 +1,485 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     google/protobuf/descriptor.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#include <stddef.h>
+#include "upb/msg.h"
+#include "google/protobuf/descriptor.upb.h"
+
+#include "upb/port_def.inc"
+
+static const upb_msglayout *const google_protobuf_FileDescriptorSet_submsgs[1] = {
+  &google_protobuf_FileDescriptorProto_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_FileDescriptorSet_msginit = {
+  &google_protobuf_FileDescriptorSet_submsgs[0],
+  &google_protobuf_FileDescriptorSet__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
+static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6] = {
+  &google_protobuf_DescriptorProto_msginit,
+  &google_protobuf_EnumDescriptorProto_msginit,
+  &google_protobuf_FieldDescriptorProto_msginit,
+  &google_protobuf_FileOptions_msginit,
+  &google_protobuf_ServiceDescriptorProto_msginit,
+  &google_protobuf_SourceCodeInfo_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] = {
+  {1, UPB_SIZE(4, 8), 1, 0, 9, 1},
+  {2, UPB_SIZE(12, 24), 2, 0, 9, 1},
+  {3, UPB_SIZE(36, 72), 0, 0, 9, 3},
+  {4, UPB_SIZE(40, 80), 0, 0, 11, 3},
+  {5, UPB_SIZE(44, 88), 0, 1, 11, 3},
+  {6, UPB_SIZE(48, 96), 0, 4, 11, 3},
+  {7, UPB_SIZE(52, 104), 0, 2, 11, 3},
+  {8, UPB_SIZE(28, 56), 4, 3, 11, 1},
+  {9, UPB_SIZE(32, 64), 5, 5, 11, 1},
+  {10, UPB_SIZE(56, 112), 0, 0, 5, 3},
+  {11, UPB_SIZE(60, 120), 0, 0, 5, 3},
+  {12, UPB_SIZE(20, 40), 3, 0, 9, 1},
+};
+
+const upb_msglayout google_protobuf_FileDescriptorProto_msginit = {
+  &google_protobuf_FileDescriptorProto_submsgs[0],
+  &google_protobuf_FileDescriptorProto__fields[0],
+  UPB_SIZE(64, 128), 12, false,
+};
+
+static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[8] = {
+  &google_protobuf_DescriptorProto_msginit,
+  &google_protobuf_DescriptorProto_ExtensionRange_msginit,
+  &google_protobuf_DescriptorProto_ReservedRange_msginit,
+  &google_protobuf_EnumDescriptorProto_msginit,
+  &google_protobuf_FieldDescriptorProto_msginit,
+  &google_protobuf_MessageOptions_msginit,
+  &google_protobuf_OneofDescriptorProto_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = {
+  {1, UPB_SIZE(4, 8), 1, 0, 9, 1},
+  {2, UPB_SIZE(16, 32), 0, 4, 11, 3},
+  {3, UPB_SIZE(20, 40), 0, 0, 11, 3},
+  {4, UPB_SIZE(24, 48), 0, 3, 11, 3},
+  {5, UPB_SIZE(28, 56), 0, 1, 11, 3},
+  {6, UPB_SIZE(32, 64), 0, 4, 11, 3},
+  {7, UPB_SIZE(12, 24), 2, 5, 11, 1},
+  {8, UPB_SIZE(36, 72), 0, 6, 11, 3},
+  {9, UPB_SIZE(40, 80), 0, 2, 11, 3},
+  {10, UPB_SIZE(44, 88), 0, 0, 9, 3},
+};
+
+const upb_msglayout google_protobuf_DescriptorProto_msginit = {
+  &google_protobuf_DescriptorProto_submsgs[0],
+  &google_protobuf_DescriptorProto__fields[0],
+  UPB_SIZE(48, 96), 10, false,
+};
+
+static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = {
+  &google_protobuf_ExtensionRangeOptions_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange__fields[3] = {
+  {1, UPB_SIZE(4, 4), 1, 0, 5, 1},
+  {2, UPB_SIZE(8, 8), 2, 0, 5, 1},
+  {3, UPB_SIZE(12, 16), 3, 0, 11, 1},
+};
+
+const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = {
+  &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0],
+  &google_protobuf_DescriptorProto_ExtensionRange__fields[0],
+  UPB_SIZE(16, 24), 3, false,
+};
+
+static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2] = {
+  {1, UPB_SIZE(4, 4), 1, 0, 5, 1},
+  {2, UPB_SIZE(8, 8), 2, 0, 5, 1},
+};
+
+const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = {
+  NULL,
+  &google_protobuf_DescriptorProto_ReservedRange__fields[0],
+  UPB_SIZE(12, 12), 2, false,
+};
+
+static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1] = {
+  {999, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = {
+  &google_protobuf_ExtensionRangeOptions_submsgs[0],
+  &google_protobuf_ExtensionRangeOptions__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
+static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1] = {
+  &google_protobuf_FieldOptions_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[10] = {
+  {1, UPB_SIZE(32, 32), 5, 0, 9, 1},
+  {2, UPB_SIZE(40, 48), 6, 0, 9, 1},
+  {3, UPB_SIZE(24, 24), 3, 0, 5, 1},
+  {4, UPB_SIZE(8, 8), 1, 0, 14, 1},
+  {5, UPB_SIZE(16, 16), 2, 0, 14, 1},
+  {6, UPB_SIZE(48, 64), 7, 0, 9, 1},
+  {7, UPB_SIZE(56, 80), 8, 0, 9, 1},
+  {8, UPB_SIZE(72, 112), 10, 0, 11, 1},
+  {9, UPB_SIZE(28, 28), 4, 0, 5, 1},
+  {10, UPB_SIZE(64, 96), 9, 0, 9, 1},
+};
+
+const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = {
+  &google_protobuf_FieldDescriptorProto_submsgs[0],
+  &google_protobuf_FieldDescriptorProto__fields[0],
+  UPB_SIZE(80, 128), 10, false,
+};
+
+static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1] = {
+  &google_protobuf_OneofOptions_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] = {
+  {1, UPB_SIZE(4, 8), 1, 0, 9, 1},
+  {2, UPB_SIZE(12, 24), 2, 0, 11, 1},
+};
+
+const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = {
+  &google_protobuf_OneofDescriptorProto_submsgs[0],
+  &google_protobuf_OneofDescriptorProto__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] = {
+  &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit,
+  &google_protobuf_EnumOptions_msginit,
+  &google_protobuf_EnumValueDescriptorProto_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] = {
+  {1, UPB_SIZE(4, 8), 1, 0, 9, 1},
+  {2, UPB_SIZE(16, 32), 0, 2, 11, 3},
+  {3, UPB_SIZE(12, 24), 2, 1, 11, 1},
+  {4, UPB_SIZE(20, 40), 0, 0, 11, 3},
+  {5, UPB_SIZE(24, 48), 0, 0, 9, 3},
+};
+
+const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = {
+  &google_protobuf_EnumDescriptorProto_submsgs[0],
+  &google_protobuf_EnumDescriptorProto__fields[0],
+  UPB_SIZE(32, 64), 5, false,
+};
+
+static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = {
+  {1, UPB_SIZE(4, 4), 1, 0, 5, 1},
+  {2, UPB_SIZE(8, 8), 2, 0, 5, 1},
+};
+
+const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = {
+  NULL,
+  &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0],
+  UPB_SIZE(12, 12), 2, false,
+};
+
+static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = {
+  &google_protobuf_EnumValueOptions_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3] = {
+  {1, UPB_SIZE(8, 8), 2, 0, 9, 1},
+  {2, UPB_SIZE(4, 4), 1, 0, 5, 1},
+  {3, UPB_SIZE(16, 24), 3, 0, 11, 1},
+};
+
+const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = {
+  &google_protobuf_EnumValueDescriptorProto_submsgs[0],
+  &google_protobuf_EnumValueDescriptorProto__fields[0],
+  UPB_SIZE(24, 32), 3, false,
+};
+
+static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs[2] = {
+  &google_protobuf_MethodDescriptorProto_msginit,
+  &google_protobuf_ServiceOptions_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[3] = {
+  {1, UPB_SIZE(4, 8), 1, 0, 9, 1},
+  {2, UPB_SIZE(16, 32), 0, 0, 11, 3},
+  {3, UPB_SIZE(12, 24), 2, 1, 11, 1},
+};
+
+const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = {
+  &google_protobuf_ServiceDescriptorProto_submsgs[0],
+  &google_protobuf_ServiceDescriptorProto__fields[0],
+  UPB_SIZE(24, 48), 3, false,
+};
+
+static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[1] = {
+  &google_protobuf_MethodOptions_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6] = {
+  {1, UPB_SIZE(4, 8), 3, 0, 9, 1},
+  {2, UPB_SIZE(12, 24), 4, 0, 9, 1},
+  {3, UPB_SIZE(20, 40), 5, 0, 9, 1},
+  {4, UPB_SIZE(28, 56), 6, 0, 11, 1},
+  {5, UPB_SIZE(1, 1), 1, 0, 8, 1},
+  {6, UPB_SIZE(2, 2), 2, 0, 8, 1},
+};
+
+const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = {
+  &google_protobuf_MethodDescriptorProto_submsgs[0],
+  &google_protobuf_MethodDescriptorProto__fields[0],
+  UPB_SIZE(32, 64), 6, false,
+};
+
+static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = {
+  {1, UPB_SIZE(28, 32), 11, 0, 9, 1},
+  {8, UPB_SIZE(36, 48), 12, 0, 9, 1},
+  {9, UPB_SIZE(8, 8), 1, 0, 14, 1},
+  {10, UPB_SIZE(16, 16), 2, 0, 8, 1},
+  {11, UPB_SIZE(44, 64), 13, 0, 9, 1},
+  {16, UPB_SIZE(17, 17), 3, 0, 8, 1},
+  {17, UPB_SIZE(18, 18), 4, 0, 8, 1},
+  {18, UPB_SIZE(19, 19), 5, 0, 8, 1},
+  {20, UPB_SIZE(20, 20), 6, 0, 8, 1},
+  {23, UPB_SIZE(21, 21), 7, 0, 8, 1},
+  {27, UPB_SIZE(22, 22), 8, 0, 8, 1},
+  {31, UPB_SIZE(23, 23), 9, 0, 8, 1},
+  {36, UPB_SIZE(52, 80), 14, 0, 9, 1},
+  {37, UPB_SIZE(60, 96), 15, 0, 9, 1},
+  {39, UPB_SIZE(68, 112), 16, 0, 9, 1},
+  {40, UPB_SIZE(76, 128), 17, 0, 9, 1},
+  {41, UPB_SIZE(84, 144), 18, 0, 9, 1},
+  {42, UPB_SIZE(24, 24), 10, 0, 8, 1},
+  {44, UPB_SIZE(92, 160), 19, 0, 9, 1},
+  {45, UPB_SIZE(100, 176), 20, 0, 9, 1},
+  {999, UPB_SIZE(108, 192), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_FileOptions_msginit = {
+  &google_protobuf_FileOptions_submsgs[0],
+  &google_protobuf_FileOptions__fields[0],
+  UPB_SIZE(112, 208), 21, false,
+};
+
+static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = {
+  {1, UPB_SIZE(1, 1), 1, 0, 8, 1},
+  {2, UPB_SIZE(2, 2), 2, 0, 8, 1},
+  {3, UPB_SIZE(3, 3), 3, 0, 8, 1},
+  {7, UPB_SIZE(4, 4), 4, 0, 8, 1},
+  {999, UPB_SIZE(8, 8), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_MessageOptions_msginit = {
+  &google_protobuf_MessageOptions_submsgs[0],
+  &google_protobuf_MessageOptions__fields[0],
+  UPB_SIZE(12, 16), 5, false,
+};
+
+static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = {
+  {1, UPB_SIZE(8, 8), 1, 0, 14, 1},
+  {2, UPB_SIZE(24, 24), 3, 0, 8, 1},
+  {3, UPB_SIZE(25, 25), 4, 0, 8, 1},
+  {5, UPB_SIZE(26, 26), 5, 0, 8, 1},
+  {6, UPB_SIZE(16, 16), 2, 0, 14, 1},
+  {10, UPB_SIZE(27, 27), 6, 0, 8, 1},
+  {999, UPB_SIZE(28, 32), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_FieldOptions_msginit = {
+  &google_protobuf_FieldOptions_submsgs[0],
+  &google_protobuf_FieldOptions__fields[0],
+  UPB_SIZE(32, 40), 7, false,
+};
+
+static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = {
+  {999, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_OneofOptions_msginit = {
+  &google_protobuf_OneofOptions_submsgs[0],
+  &google_protobuf_OneofOptions__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
+static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = {
+  {2, UPB_SIZE(1, 1), 1, 0, 8, 1},
+  {3, UPB_SIZE(2, 2), 2, 0, 8, 1},
+  {999, UPB_SIZE(4, 8), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_EnumOptions_msginit = {
+  &google_protobuf_EnumOptions_submsgs[0],
+  &google_protobuf_EnumOptions__fields[0],
+  UPB_SIZE(8, 16), 3, false,
+};
+
+static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = {
+  {1, UPB_SIZE(1, 1), 1, 0, 8, 1},
+  {999, UPB_SIZE(4, 8), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_EnumValueOptions_msginit = {
+  &google_protobuf_EnumValueOptions_submsgs[0],
+  &google_protobuf_EnumValueOptions__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = {
+  {33, UPB_SIZE(1, 1), 1, 0, 8, 1},
+  {999, UPB_SIZE(4, 8), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_ServiceOptions_msginit = {
+  &google_protobuf_ServiceOptions_submsgs[0],
+  &google_protobuf_ServiceOptions__fields[0],
+  UPB_SIZE(8, 16), 2, false,
+};
+
+static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = {
+  {33, UPB_SIZE(16, 16), 2, 0, 8, 1},
+  {34, UPB_SIZE(8, 8), 1, 0, 14, 1},
+  {999, UPB_SIZE(20, 24), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_MethodOptions_msginit = {
+  &google_protobuf_MethodOptions_submsgs[0],
+  &google_protobuf_MethodOptions__fields[0],
+  UPB_SIZE(24, 32), 3, false,
+};
+
+static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1] = {
+  &google_protobuf_UninterpretedOption_NamePart_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] = {
+  {2, UPB_SIZE(56, 80), 0, 0, 11, 3},
+  {3, UPB_SIZE(32, 32), 4, 0, 9, 1},
+  {4, UPB_SIZE(8, 8), 1, 0, 4, 1},
+  {5, UPB_SIZE(16, 16), 2, 0, 3, 1},
+  {6, UPB_SIZE(24, 24), 3, 0, 1, 1},
+  {7, UPB_SIZE(40, 48), 5, 0, 12, 1},
+  {8, UPB_SIZE(48, 64), 6, 0, 9, 1},
+};
+
+const upb_msglayout google_protobuf_UninterpretedOption_msginit = {
+  &google_protobuf_UninterpretedOption_submsgs[0],
+  &google_protobuf_UninterpretedOption__fields[0],
+  UPB_SIZE(64, 96), 7, false,
+};
+
+static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2] = {
+  {1, UPB_SIZE(4, 8), 2, 0, 9, 2},
+  {2, UPB_SIZE(1, 1), 1, 0, 8, 2},
+};
+
+const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = {
+  NULL,
+  &google_protobuf_UninterpretedOption_NamePart__fields[0],
+  UPB_SIZE(16, 32), 2, false,
+};
+
+static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1] = {
+  &google_protobuf_SourceCodeInfo_Location_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_SourceCodeInfo_msginit = {
+  &google_protobuf_SourceCodeInfo_submsgs[0],
+  &google_protobuf_SourceCodeInfo__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
+static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5] = {
+  {1, UPB_SIZE(20, 40), 0, 0, 5, 3},
+  {2, UPB_SIZE(24, 48), 0, 0, 5, 3},
+  {3, UPB_SIZE(4, 8), 1, 0, 9, 1},
+  {4, UPB_SIZE(12, 24), 2, 0, 9, 1},
+  {6, UPB_SIZE(28, 56), 0, 0, 9, 3},
+};
+
+const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = {
+  NULL,
+  &google_protobuf_SourceCodeInfo_Location__fields[0],
+  UPB_SIZE(32, 64), 5, false,
+};
+
+static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1] = {
+  &google_protobuf_GeneratedCodeInfo_Annotation_msginit,
+};
+
+static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = {
+  {1, UPB_SIZE(0, 0), 0, 0, 11, 3},
+};
+
+const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = {
+  &google_protobuf_GeneratedCodeInfo_submsgs[0],
+  &google_protobuf_GeneratedCodeInfo__fields[0],
+  UPB_SIZE(4, 8), 1, false,
+};
+
+static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = {
+  {1, UPB_SIZE(20, 32), 0, 0, 5, 3},
+  {2, UPB_SIZE(12, 16), 3, 0, 9, 1},
+  {3, UPB_SIZE(4, 4), 1, 0, 5, 1},
+  {4, UPB_SIZE(8, 8), 2, 0, 5, 1},
+};
+
+const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = {
+  NULL,
+  &google_protobuf_GeneratedCodeInfo_Annotation__fields[0],
+  UPB_SIZE(24, 48), 4, false,
+};
+
+#include "upb/port_undef.inc"
+
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h b/legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h
new file mode 100644 (file)
index 0000000..6816149
--- /dev/null
@@ -0,0 +1,1690 @@
+/* This file was generated by upbc (the upb compiler) from the input
+ * file:
+ *
+ *     google/protobuf/descriptor.proto
+ *
+ * Do not edit -- your changes will be discarded when the file is
+ * regenerated. */
+
+#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
+#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_
+
+#include "upb/generated_util.h"
+#include "upb/msg.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct google_protobuf_FileDescriptorSet;
+struct google_protobuf_FileDescriptorProto;
+struct google_protobuf_DescriptorProto;
+struct google_protobuf_DescriptorProto_ExtensionRange;
+struct google_protobuf_DescriptorProto_ReservedRange;
+struct google_protobuf_ExtensionRangeOptions;
+struct google_protobuf_FieldDescriptorProto;
+struct google_protobuf_OneofDescriptorProto;
+struct google_protobuf_EnumDescriptorProto;
+struct google_protobuf_EnumDescriptorProto_EnumReservedRange;
+struct google_protobuf_EnumValueDescriptorProto;
+struct google_protobuf_ServiceDescriptorProto;
+struct google_protobuf_MethodDescriptorProto;
+struct google_protobuf_FileOptions;
+struct google_protobuf_MessageOptions;
+struct google_protobuf_FieldOptions;
+struct google_protobuf_OneofOptions;
+struct google_protobuf_EnumOptions;
+struct google_protobuf_EnumValueOptions;
+struct google_protobuf_ServiceOptions;
+struct google_protobuf_MethodOptions;
+struct google_protobuf_UninterpretedOption;
+struct google_protobuf_UninterpretedOption_NamePart;
+struct google_protobuf_SourceCodeInfo;
+struct google_protobuf_SourceCodeInfo_Location;
+struct google_protobuf_GeneratedCodeInfo;
+struct google_protobuf_GeneratedCodeInfo_Annotation;
+typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet;
+typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto;
+typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto;
+typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange;
+typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange;
+typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions;
+typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto;
+typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto;
+typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto;
+typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange;
+typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto;
+typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto;
+typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto;
+typedef struct google_protobuf_FileOptions google_protobuf_FileOptions;
+typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions;
+typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions;
+typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions;
+typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions;
+typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions;
+typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions;
+typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions;
+typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption;
+typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart;
+typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo;
+typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location;
+typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo;
+typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation;
+extern const upb_msglayout google_protobuf_FileDescriptorSet_msginit;
+extern const upb_msglayout google_protobuf_FileDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_DescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit;
+extern const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit;
+extern const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit;
+extern const upb_msglayout google_protobuf_FieldDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_OneofDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_EnumDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit;
+extern const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_MethodDescriptorProto_msginit;
+extern const upb_msglayout google_protobuf_FileOptions_msginit;
+extern const upb_msglayout google_protobuf_MessageOptions_msginit;
+extern const upb_msglayout google_protobuf_FieldOptions_msginit;
+extern const upb_msglayout google_protobuf_OneofOptions_msginit;
+extern const upb_msglayout google_protobuf_EnumOptions_msginit;
+extern const upb_msglayout google_protobuf_EnumValueOptions_msginit;
+extern const upb_msglayout google_protobuf_ServiceOptions_msginit;
+extern const upb_msglayout google_protobuf_MethodOptions_msginit;
+extern const upb_msglayout google_protobuf_UninterpretedOption_msginit;
+extern const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit;
+extern const upb_msglayout google_protobuf_SourceCodeInfo_msginit;
+extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit;
+extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit;
+extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit;
+
+typedef enum {
+  google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1,
+  google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2,
+  google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3
+} google_protobuf_FieldDescriptorProto_Label;
+
+typedef enum {
+  google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1,
+  google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2,
+  google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3,
+  google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4,
+  google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5,
+  google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6,
+  google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7,
+  google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8,
+  google_protobuf_FieldDescriptorProto_TYPE_STRING = 9,
+  google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10,
+  google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11,
+  google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12,
+  google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13,
+  google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14,
+  google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15,
+  google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16,
+  google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17,
+  google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18
+} google_protobuf_FieldDescriptorProto_Type;
+
+typedef enum {
+  google_protobuf_FieldOptions_STRING = 0,
+  google_protobuf_FieldOptions_CORD = 1,
+  google_protobuf_FieldOptions_STRING_PIECE = 2
+} google_protobuf_FieldOptions_CType;
+
+typedef enum {
+  google_protobuf_FieldOptions_JS_NORMAL = 0,
+  google_protobuf_FieldOptions_JS_STRING = 1,
+  google_protobuf_FieldOptions_JS_NUMBER = 2
+} google_protobuf_FieldOptions_JSType;
+
+typedef enum {
+  google_protobuf_FileOptions_SPEED = 1,
+  google_protobuf_FileOptions_CODE_SIZE = 2,
+  google_protobuf_FileOptions_LITE_RUNTIME = 3
+} google_protobuf_FileOptions_OptimizeMode;
+
+typedef enum {
+  google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0,
+  google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1,
+  google_protobuf_MethodOptions_IDEMPOTENT = 2
+} google_protobuf_MethodOptions_IdempotencyLevel;
+
+
+/* google.protobuf.FileDescriptorSet */
+
+UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) {
+  return (google_protobuf_FileDescriptorSet *)upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena);
+}
+UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len);
+}
+
+UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg, size_t *len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_mutable_file(google_protobuf_FileDescriptorSet *msg, size_t *len) {
+  return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) {
+  struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.FileDescriptorProto */
+
+UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_FileDescriptorProto *)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
+UPB_INLINE upb_strview const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
+UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
+UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
+UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); }
+UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); }
+UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FileOptions*, UPB_SIZE(28, 56)); }
+UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 5); }
+UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)); }
+UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); }
+UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); }
+UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
+
+UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
+}
+UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(36, 72), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
+}
+UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len);
+}
+UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(48, 96), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(48, 96), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len);
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(52, 104), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(52, 104), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, google_protobuf_FileOptions*, UPB_SIZE(28, 56)) = value;
+}
+UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_FileOptions*)upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_FileDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) {
+  _upb_sethas(msg, 5);
+  UPB_FIELD_AT(msg, google_protobuf_SourceCodeInfo*, UPB_SIZE(32, 64)) = value;
+}
+UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_SourceCodeInfo*)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_FileDescriptorProto_set_source_code_info(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len);
+}
+UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(56, 112), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
+}
+UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(56, 112), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
+}
+UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) {
+  return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len);
+}
+UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(60, 120), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
+}
+UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(60, 120), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
+}
+UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
+}
+
+/* google.protobuf.DescriptorProto */
+
+UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_DescriptorProto *)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
+UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
+UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
+UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
+UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); }
+UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MessageOptions*, UPB_SIZE(12, 24)); }
+UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); }
+UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg, size_t *len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); }
+UPB_INLINE upb_strview const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); }
+
+UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mutable_nested_type(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
+}
+UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_mutable_enum_type(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_mutable_extension_range(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
+}
+UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_extension(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len);
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, google_protobuf_MessageOptions*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_MessageOptions*)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_DescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_mutable_oneof_decl(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len);
+}
+UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_mutable_reserved_range(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len);
+}
+UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(google_protobuf_DescriptorProto *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len);
+}
+UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+
+/* google.protobuf.DescriptorProto.ExtensionRange */
+
+UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) {
+  return (google_protobuf_DescriptorProto_ExtensionRange *)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena);
+}
+UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
+UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)); }
+
+UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, google_protobuf_ExtensionRangeOptions*, UPB_SIZE(12, 16)) = value;
+}
+UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena) {
+  struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_ExtensionRangeOptions*)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_DescriptorProto_ExtensionRange_set_options(msg, sub);
+  }
+  return sub;
+}
+
+/* google.protobuf.DescriptorProto.ReservedRange */
+
+UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) {
+  return (google_protobuf_DescriptorProto_ReservedRange *)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena);
+}
+UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
+UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+
+UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+
+/* google.protobuf.ExtensionRangeOptions */
+
+UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) {
+  return (google_protobuf_ExtensionRangeOptions *)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len);
+}
+
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_mutable_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.FieldDescriptorProto */
+
+UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_FieldDescriptorProto *)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 5); }
+UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 6); }
+UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 7); }
+UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 8); }
+UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 10); }
+UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_FieldOptions*, UPB_SIZE(72, 112)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)); }
+UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_has_field(msg, 9); }
+UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)); }
+
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 5);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 6);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 7);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 8);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 80)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) {
+  _upb_sethas(msg, 10);
+  UPB_FIELD_AT(msg, google_protobuf_FieldOptions*, UPB_SIZE(72, 112)) = value;
+}
+UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_FieldOptions*)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_FieldDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(28, 28)) = value;
+}
+UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 9);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)) = value;
+}
+
+/* google.protobuf.OneofDescriptorProto */
+
+UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_OneofDescriptorProto *)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_OneofOptions*, UPB_SIZE(12, 24)); }
+
+UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, google_protobuf_OneofOptions*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_OneofOptions*)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_OneofDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+
+/* google.protobuf.EnumDescriptorProto */
+
+UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_EnumDescriptorProto *)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
+UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumOptions*, UPB_SIZE(12, 24)); }
+UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
+UPB_INLINE upb_strview const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
+
+UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
+}
+UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, google_protobuf_EnumOptions*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_EnumOptions*)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_EnumDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_mutable_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
+}
+UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+
+/* google.protobuf.EnumDescriptorProto.EnumReservedRange */
+
+UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) {
+  return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena);
+}
+UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
+UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+
+UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+
+/* google.protobuf.EnumValueDescriptorProto */
+
+UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_EnumValueDescriptorProto *)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); }
+UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
+UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)); }
+
+UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, google_protobuf_EnumValueOptions*, UPB_SIZE(16, 24)) = value;
+}
+UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_EnumValueOptions*)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_EnumValueDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+
+/* google.protobuf.ServiceDescriptorProto */
+
+UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_ServiceDescriptorProto *)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE upb_strview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg, size_t *len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); }
+UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)); }
+
+UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto *msg, size_t *len) {
+  return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len);
+}
+UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, google_protobuf_ServiceOptions*, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_ServiceOptions*)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_ServiceDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+
+/* google.protobuf.MethodDescriptorProto */
+
+UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) {
+  return (google_protobuf_MethodDescriptorProto *)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena);
+}
+UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 5); }
+UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 6); }
+UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, const google_protobuf_MethodOptions*, UPB_SIZE(28, 56)); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
+
+UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) {
+  _upb_sethas(msg, 5);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value;
+}
+UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) {
+  _upb_sethas(msg, 6);
+  UPB_FIELD_AT(msg, google_protobuf_MethodOptions*, UPB_SIZE(28, 56)) = value;
+}
+UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) {
+  struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg);
+  if (sub == NULL) {
+    sub = (struct google_protobuf_MethodOptions*)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
+    if (!sub) return NULL;
+    google_protobuf_MethodDescriptorProto_set_options(msg, sub);
+  }
+  return sub;
+}
+UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
+}
+
+/* google.protobuf.FileOptions */
+
+UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) {
+  return (google_protobuf_FileOptions *)upb_msg_new(&google_protobuf_FileOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 11); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 12); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 13); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 5); }
+UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 6); }
+UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 7); }
+UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 8); }
+UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 9); }
+UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 14); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 15); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 16); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 17); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 18); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 10); }
+UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 19); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(92, 160)); }
+UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions *msg) { return _upb_has_field(msg, 20); }
+UPB_INLINE upb_strview google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(100, 176)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(108, 192), len); }
+
+UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 11);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 12);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 13);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 64)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(17, 17)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(18, 18)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 5);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(19, 19)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 6);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(20, 20)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 7);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(21, 21)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 8);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(22, 22)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 9);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(23, 23)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 14);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(52, 80)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 15);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(60, 96)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 16);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(68, 112)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 17);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(76, 128)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 18);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(84, 144)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) {
+  _upb_sethas(msg, 10);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 19);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(92, 160)) = value;
+}
+UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_strview value) {
+  _upb_sethas(msg, 20);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(100, 176)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(108, 192), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(108, 192), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(108, 192), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.MessageOptions */
+
+UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) {
+  return (google_protobuf_MessageOptions *)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
+UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)); }
+UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(8, 8), len); }
+
+UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
+}
+UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(3, 3)) = value;
+}
+UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(8, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.FieldOptions */
+
+UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) {
+  return (google_protobuf_FieldOptions *)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); }
+UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); }
+UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 5); }
+UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)); }
+UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); }
+UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_has_field(msg, 6); }
+UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); }
+
+UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value;
+}
+UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)) = value;
+}
+UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) {
+  _upb_sethas(msg, 5);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(26, 26)) = value;
+}
+UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) {
+  _upb_sethas(msg, 6);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(27, 27)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.OneofOptions */
+
+UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) {
+  return (google_protobuf_OneofOptions *)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len);
+}
+
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mutable_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.EnumOptions */
+
+UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) {
+  return (google_protobuf_EnumOptions *)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
+
+UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.EnumValueOptions */
+
+UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) {
+  return (google_protobuf_EnumValueOptions *)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
+
+UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.ServiceOptions */
+
+UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) {
+  return (google_protobuf_ServiceOptions *)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); }
+
+UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.MethodOptions */
+
+UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) {
+  return (google_protobuf_MethodOptions *)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena);
+}
+UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)); }
+UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 24), len); }
+
+UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.UninterpretedOption */
+
+UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption *)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena);
+}
+UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len);
+}
+
+UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 4); }
+UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 5); }
+UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return _upb_has_field(msg, 6); }
+UPB_INLINE upb_strview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)); }
+
+UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption *msg, size_t *len) {
+  return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len);
+}
+UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor(msg, UPB_SIZE(56, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) {
+  struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(56, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
+  _upb_sethas(msg, 4);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)) = value;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)) = value;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)) = value;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, double, UPB_SIZE(24, 24)) = value;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
+  _upb_sethas(msg, 5);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(40, 48)) = value;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_strview value) {
+  _upb_sethas(msg, 6);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value;
+}
+
+/* google.protobuf.UninterpretedOption.NamePart */
+
+UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) {
+  return (google_protobuf_UninterpretedOption_NamePart *)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena);
+}
+UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len);
+}
+
+UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); }
+
+UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value;
+}
+
+/* google.protobuf.SourceCodeInfo */
+
+UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) {
+  return (google_protobuf_SourceCodeInfo *)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena);
+}
+UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len);
+}
+
+UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg, size_t *len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_mutable_location(google_protobuf_SourceCodeInfo *msg, size_t *len) {
+  return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) {
+  struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.SourceCodeInfo.Location */
+
+UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) {
+  return (google_protobuf_SourceCodeInfo_Location *)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena);
+}
+UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len);
+}
+
+UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
+UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
+UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); }
+UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE upb_strview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); }
+UPB_INLINE upb_strview const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); }
+
+UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
+  return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
+}
+UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
+  return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
+}
+UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 40), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
+}
+UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
+  return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
+}
+UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
+  return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
+}
+UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(24, 48), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
+}
+UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value;
+}
+UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value;
+}
+UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) {
+  return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len);
+}
+UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) {
+  return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena);
+}
+UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena);
+}
+
+/* google.protobuf.GeneratedCodeInfo */
+
+UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) {
+  return (google_protobuf_GeneratedCodeInfo *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena);
+}
+UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len);
+}
+
+UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg, size_t *len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
+
+UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_mutable_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t *len) {
+  return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
+}
+UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) {
+  return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena);
+}
+UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) {
+  struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
+  bool ok = _upb_array_append_accessor(
+      msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena);
+  if (!ok) return NULL;
+  return sub;
+}
+
+/* google.protobuf.GeneratedCodeInfo.Annotation */
+
+UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) {
+  return (google_protobuf_GeneratedCodeInfo_Annotation *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena);
+}
+UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size,
+                        upb_arena *arena) {
+  google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena);
+  return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) ? ret : NULL;
+}
+UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) {
+  return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len);
+}
+
+UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); }
+UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 3); }
+UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); }
+UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 1); }
+UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)); }
+UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_has_field(msg, 2); }
+UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); }
+
+UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) {
+  return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len);
+}
+UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) {
+  return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(4, 4), UPB_TYPE_INT32, arena);
+}
+UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) {
+  return _upb_array_append_accessor(
+      msg, UPB_SIZE(20, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena);
+}
+UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) {
+  _upb_sethas(msg, 3);
+  UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value;
+}
+UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
+  _upb_sethas(msg, 1);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 4)) = value;
+}
+UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) {
+  _upb_sethas(msg, 2);
+  UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/upb/json/parser.c b/legacy-libs/grpc/deps/grpc/third_party/upb/generated_for_cmake/upb/json/parser.c
new file mode 100644 (file)
index 0000000..bfe71c7
--- /dev/null
@@ -0,0 +1,3451 @@
+
+#line 1 "upb/json/parser.rl"
+/*
+** upb::json::Parser (upb_json_parser)
+**
+** A parser that uses the Ragel State Machine Compiler to generate
+** the finite automata.
+**
+** Ragel only natively handles regular languages, but we can manually
+** program it a bit to handle context-free languages like JSON, by using
+** the "fcall" and "fret" constructs.
+**
+** This parser can handle the basics, but needs several things to be fleshed
+** out:
+**
+** - handling of unicode escape sequences (including high surrogate pairs).
+** - properly check and report errors for unknown fields, stack overflow,
+**   improper array nesting (or lack of nesting).
+** - handling of base64 sequences with padding characters.
+** - handling of push-back (non-success returns from sink functions).
+** - handling of keys/escape-sequences/etc that span input buffers.
+*/
+
+#include <ctype.h>
+#include <errno.h>
+#include <float.h>
+#include <math.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <time.h>
+
+#include "upb/json/parser.h"
+#include "upb/pb/encoder.h"
+
+#include "upb/port_def.inc"
+
+#define UPB_JSON_MAX_DEPTH 64
+
+/* Type of value message */
+enum {
+  VALUE_NULLVALUE   = 0,
+  VALUE_NUMBERVALUE = 1,
+  VALUE_STRINGVALUE = 2,
+  VALUE_BOOLVALUE   = 3,
+  VALUE_STRUCTVALUE = 4,
+  VALUE_LISTVALUE   = 5
+};
+
+/* Forward declare */
+static bool is_top_level(upb_json_parser *p);
+static bool is_wellknown_msg(upb_json_parser *p, upb_wellknowntype_t type);
+static bool is_wellknown_field(upb_json_parser *p, upb_wellknowntype_t type);
+
+static bool is_number_wrapper_object(upb_json_parser *p);
+static bool does_number_wrapper_start(upb_json_parser *p);
+static bool does_number_wrapper_end(upb_json_parser *p);
+
+static bool is_string_wrapper_object(upb_json_parser *p);
+static bool does_string_wrapper_start(upb_json_parser *p);
+static bool does_string_wrapper_end(upb_json_parser *p);
+
+static bool does_fieldmask_start(upb_json_parser *p);
+static bool does_fieldmask_end(upb_json_parser *p);
+static void start_fieldmask_object(upb_json_parser *p);
+static void end_fieldmask_object(upb_json_parser *p);
+
+static void start_wrapper_object(upb_json_parser *p);
+static void end_wrapper_object(upb_json_parser *p);
+
+static void start_value_object(upb_json_parser *p, int value_type);
+static void end_value_object(upb_json_parser *p);
+
+static void start_listvalue_object(upb_json_parser *p);
+static void end_listvalue_object(upb_json_parser *p);
+
+static void start_structvalue_object(upb_json_parser *p);
+static void end_structvalue_object(upb_json_parser *p);
+
+static void start_object(upb_json_parser *p);
+static void end_object(upb_json_parser *p);
+
+static void start_any_object(upb_json_parser *p, const char *ptr);
+static bool end_any_object(upb_json_parser *p, const char *ptr);
+
+static bool start_subobject(upb_json_parser *p);
+static void end_subobject(upb_json_parser *p);
+
+static void start_member(upb_json_parser *p);
+static void end_member(upb_json_parser *p);
+static bool end_membername(upb_json_parser *p);
+
+static void start_any_member(upb_json_parser *p, const char *ptr);
+static void end_any_member(upb_json_parser *p, const char *ptr);
+static bool end_any_membername(upb_json_parser *p);
+
+size_t parse(void *closure, const void *hd, const char *buf, size_t size,
+             const upb_bufhandle *handle);
+static bool end(void *closure, const void *hd);
+
+static const char eof_ch = 'e';
+
+/* stringsink */
+typedef struct {
+  upb_byteshandler handler;
+  upb_bytessink sink;
+  char *ptr;
+  size_t len, size;
+} upb_stringsink;
+
+
+static void *stringsink_start(void *_sink, const void *hd, size_t size_hint) {
+  upb_stringsink *sink = _sink;
+  sink->len = 0;
+  UPB_UNUSED(hd);
+  UPB_UNUSED(size_hint);
+  return sink;
+}
+
+static size_t stringsink_string(void *_sink, const void *hd, const char *ptr,
+                                size_t len, const upb_bufhandle *handle) {
+  upb_stringsink *sink = _sink;
+  size_t new_size = sink->size;
+
+  UPB_UNUSED(hd);
+  UPB_UNUSED(handle);
+
+  while (sink->len + len > new_size) {
+    new_size *= 2;
+  }
+
+  if (new_size != sink->size) {
+    sink->ptr = realloc(sink->ptr, new_size);
+    sink->size = new_size;
+  }
+
+  memcpy(sink->ptr + sink->len, ptr, len);
+  sink->len += len;
+
+  return len;
+}
+
+void upb_stringsink_init(upb_stringsink *sink) {
+  upb_byteshandler_init(&sink->handler);
+  upb_byteshandler_setstartstr(&sink->handler, stringsink_start, NULL);
+  upb_byteshandler_setstring(&sink->handler, stringsink_string, NULL);
+
+  upb_bytessink_reset(&sink->sink, &sink->handler, sink);
+
+  sink->size = 32;
+  sink->ptr = malloc(sink->size);
+  sink->len = 0;
+}
+
+void upb_stringsink_uninit(upb_stringsink *sink) { free(sink->ptr); }
+
+typedef struct {
+  /* For encoding Any value field in binary format. */
+  upb_handlercache *encoder_handlercache;
+  upb_stringsink stringsink;
+
+  /* For decoding Any value field in json format. */
+  upb_json_codecache *parser_codecache;
+  upb_sink sink;
+  upb_json_parser *parser;
+
+  /* Mark the range of uninterpreted values in json input before type url. */
+  const char *before_type_url_start;
+  const char *before_type_url_end;
+
+  /* Mark the range of uninterpreted values in json input after type url. */
+  const char *after_type_url_start;
+} upb_jsonparser_any_frame;
+
+typedef struct {
+  upb_sink sink;
+
+  /* The current message in which we're parsing, and the field whose value we're
+   * expecting next. */
+  const upb_msgdef *m;
+  const upb_fielddef *f;
+
+  /* The table mapping json name to fielddef for this message. */
+  const upb_strtable *name_table;
+
+  /* We are in a repeated-field context. We need this flag to decide whether to
+   * handle the array as a normal repeated field or a
+   * google.protobuf.ListValue/google.protobuf.Value. */
+  bool is_repeated;
+
+  /* We are in a repeated-field context, ready to emit mapentries as
+   * submessages. This flag alters the start-of-object (open-brace) behavior to
+   * begin a sequence of mapentry messages rather than a single submessage. */
+  bool is_map;
+
+  /* We are in a map-entry message context. This flag is set when parsing the
+   * value field of a single map entry and indicates to all value-field parsers
+   * (subobjects, strings, numbers, and bools) that the map-entry submessage
+   * should end as soon as the value is parsed. */
+  bool is_mapentry;
+
+  /* If |is_map| or |is_mapentry| is true, |mapfield| refers to the parent
+   * message's map field that we're currently parsing. This differs from |f|
+   * because |f| is the field in the *current* message (i.e., the map-entry
+   * message itself), not the parent's field that leads to this map. */
+  const upb_fielddef *mapfield;
+
+  /* We are in an Any message context. This flag is set when parsing the Any
+   * message and indicates to all field parsers (subobjects, strings, numbers,
+   * and bools) that the parsed field should be serialized as binary data or
+   * cached (type url not found yet). */
+  bool is_any;
+
+  /* The type of packed message in Any. */
+  upb_jsonparser_any_frame *any_frame;
+
+  /* True if the field to be parsed is unknown. */
+  bool is_unknown_field;
+} upb_jsonparser_frame;
+
+static void init_frame(upb_jsonparser_frame* frame) {
+  frame->m = NULL;
+  frame->f = NULL;
+  frame->name_table = NULL;
+  frame->is_repeated = false;
+  frame->is_map = false;
+  frame->is_mapentry = false;
+  frame->mapfield = NULL;
+  frame->is_any = false;
+  frame->any_frame = NULL;
+  frame->is_unknown_field = false;
+}
+
+struct upb_json_parser {
+  upb_arena *arena;
+  const upb_json_parsermethod *method;
+  upb_bytessink input_;
+
+  /* Stack to track the JSON scopes we are in. */
+  upb_jsonparser_frame stack[UPB_JSON_MAX_DEPTH];
+  upb_jsonparser_frame *top;
+  upb_jsonparser_frame *limit;
+
+  upb_status *status;
+
+  /* Ragel's internal parsing stack for the parsing state machine. */
+  int current_state;
+  int parser_stack[UPB_JSON_MAX_DEPTH];
+  int parser_top;
+
+  /* The handle for the current buffer. */
+  const upb_bufhandle *handle;
+
+  /* Accumulate buffer.  See details in parser.rl. */
+  const char *accumulated;
+  size_t accumulated_len;
+  char *accumulate_buf;
+  size_t accumulate_buf_size;
+
+  /* Multi-part text data.  See details in parser.rl. */
+  int multipart_state;
+  upb_selector_t string_selector;
+
+  /* Input capture.  See details in parser.rl. */
+  const char *capture;
+
+  /* Intermediate result of parsing a unicode escape sequence. */
+  uint32_t digit;
+
+  /* For resolve type url in Any. */
+  const upb_symtab *symtab;
+
+  /* Whether to proceed if unknown field is met. */
+  bool ignore_json_unknown;
+
+  /* Cache for parsing timestamp due to base and zone are handled in different
+   * handlers. */
+  struct tm tm;
+};
+
+static upb_jsonparser_frame* start_jsonparser_frame(upb_json_parser *p) {
+  upb_jsonparser_frame *inner;
+  inner = p->top + 1;
+  init_frame(inner);
+  return inner;
+}
+
+struct upb_json_codecache {
+  upb_arena *arena;
+  upb_inttable methods;   /* upb_msgdef* -> upb_json_parsermethod* */
+};
+
+struct upb_json_parsermethod {
+  const upb_json_codecache *cache;
+  upb_byteshandler input_handler_;
+
+  /* Maps json_name -> fielddef */
+  upb_strtable name_table;
+};
+
+#define PARSER_CHECK_RETURN(x) if (!(x)) return false
+
+static upb_jsonparser_any_frame *json_parser_any_frame_new(
+    upb_json_parser *p) {
+  upb_jsonparser_any_frame *frame;
+
+  frame = upb_arena_malloc(p->arena, sizeof(upb_jsonparser_any_frame));
+
+  frame->encoder_handlercache = upb_pb_encoder_newcache();
+  frame->parser_codecache = upb_json_codecache_new();
+  frame->parser = NULL;
+  frame->before_type_url_start = NULL;
+  frame->before_type_url_end = NULL;
+  frame->after_type_url_start = NULL;
+
+  upb_stringsink_init(&frame->stringsink);
+
+  return frame;
+}
+
+static void json_parser_any_frame_set_payload_type(
+    upb_json_parser *p,
+    upb_jsonparser_any_frame *frame,
+    const upb_msgdef *payload_type) {
+  const upb_handlers *h;
+  const upb_json_parsermethod *parser_method;
+  upb_pb_encoder *encoder;
+
+  /* Initialize encoder. */
+  h = upb_handlercache_get(frame->encoder_handlercache, payload_type);
+  encoder = upb_pb_encoder_create(p->arena, h, frame->stringsink.sink);
+
+  /* Initialize parser. */
+  parser_method = upb_json_codecache_get(frame->parser_codecache, payload_type);
+  upb_sink_reset(&frame->sink, h, encoder);
+  frame->parser =
+      upb_json_parser_create(p->arena, parser_method, p->symtab, frame->sink,
+                             p->status, p->ignore_json_unknown);
+}
+
+static void json_parser_any_frame_free(upb_jsonparser_any_frame *frame) {
+  upb_handlercache_free(frame->encoder_handlercache);
+  upb_json_codecache_free(frame->parser_codecache);
+  upb_stringsink_uninit(&frame->stringsink);
+}
+
+static bool json_parser_any_frame_has_type_url(
+  upb_jsonparser_any_frame *frame) {
+  return frame->parser != NULL;
+}
+
+static bool json_parser_any_frame_has_value_before_type_url(
+  upb_jsonparser_any_frame *frame) {
+  return frame->before_type_url_start != frame->before_type_url_end;
+}
+
+static bool json_parser_any_frame_has_value_after_type_url(
+  upb_jsonparser_any_frame *frame) {
+  return frame->after_type_url_start != NULL;
+}
+
+static bool json_parser_any_frame_has_value(
+  upb_jsonparser_any_frame *frame) {
+  return json_parser_any_frame_has_value_before_type_url(frame) ||
+         json_parser_any_frame_has_value_after_type_url(frame);
+}
+
+static void json_parser_any_frame_set_before_type_url_end(
+    upb_jsonparser_any_frame *frame,
+    const char *ptr) {
+  if (frame->parser == NULL) {
+    frame->before_type_url_end = ptr;
+  }
+}
+
+static void json_parser_any_frame_set_after_type_url_start_once(
+    upb_jsonparser_any_frame *frame,
+    const char *ptr) {
+  if (json_parser_any_frame_has_type_url(frame) &&
+      frame->after_type_url_start == NULL) {
+    frame->after_type_url_start = ptr;
+  }
+}
+
+/* Used to signal that a capture has been suspended. */
+static char suspend_capture;
+
+static upb_selector_t getsel_for_handlertype(upb_json_parser *p,
+                                             upb_handlertype_t type) {
+  upb_selector_t sel;
+  bool ok = upb_handlers_getselector(p->top->f, type, &sel);
+  UPB_ASSERT(ok);
+  return sel;
+}
+
+static upb_selector_t parser_getsel(upb_json_parser *p) {
+  return getsel_for_handlertype(
+      p, upb_handlers_getprimitivehandlertype(p->top->f));
+}
+
+static bool check_stack(upb_json_parser *p) {
+  if ((p->top + 1) == p->limit) {
+    upb_status_seterrmsg(p->status, "Nesting too deep");
+    return false;
+  }
+
+  return true;
+}
+
+static void set_name_table(upb_json_parser *p, upb_jsonparser_frame *frame) {
+  upb_value v;
+  const upb_json_codecache *cache = p->method->cache;
+  bool ok;
+  const upb_json_parsermethod *method;
+
+  ok = upb_inttable_lookupptr(&cache->methods, frame->m, &v);
+  UPB_ASSERT(ok);
+  method = upb_value_getconstptr(v);
+
+  frame->name_table = &method->name_table;
+}
+
+/* There are GCC/Clang built-ins for overflow checking which we could start
+ * using if there was any performance benefit to it. */
+
+static bool checked_add(size_t a, size_t b, size_t *c) {
+  if (SIZE_MAX - a < b) return false;
+  *c = a + b;
+  return true;
+}
+
+static size_t saturating_multiply(size_t a, size_t b) {
+  /* size_t is unsigned, so this is defined behavior even on overflow. */
+  size_t ret = a * b;
+  if (b != 0 && ret / b != a) {
+    ret = SIZE_MAX;
+  }
+  return ret;
+}
+
+
+/* Base64 decoding ************************************************************/
+
+/* TODO(haberman): make this streaming. */
+
+static const signed char b64table[] = {
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      62/*+*/, -1,      -1,      -1,      63/*/ */,
+  52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/,
+  60/*8*/, 61/*9*/, -1,      -1,      -1,      -1,      -1,      -1,
+  -1,       0/*A*/,  1/*B*/,  2/*C*/,  3/*D*/,  4/*E*/,  5/*F*/,  6/*G*/,
+  07/*H*/,  8/*I*/,  9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/,
+  15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/,
+  23/*X*/, 24/*Y*/, 25/*Z*/, -1,      -1,      -1,      -1,      -1,
+  -1,      26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/,
+  33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/,
+  41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/,
+  49/*x*/, 50/*y*/, 51/*z*/, -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1,
+  -1,      -1,      -1,      -1,      -1,      -1,      -1,      -1
+};
+
+/* Returns the table value sign-extended to 32 bits.  Knowing that the upper
+ * bits will be 1 for unrecognized characters makes it easier to check for
+ * this error condition later (see below). */
+int32_t b64lookup(unsigned char ch) { return b64table[ch]; }
+
+/* Returns true if the given character is not a valid base64 character or
+ * padding. */
+bool nonbase64(unsigned char ch) { return b64lookup(ch) == -1 && ch != '='; }
+
+static bool base64_push(upb_json_parser *p, upb_selector_t sel, const char *ptr,
+                        size_t len) {
+  const char *limit = ptr + len;
+  for (; ptr < limit; ptr += 4) {
+    uint32_t val;
+    char output[3];
+
+    if (limit - ptr < 4) {
+      upb_status_seterrf(p->status,
+                         "Base64 input for bytes field not a multiple of 4: %s",
+                         upb_fielddef_name(p->top->f));
+      return false;
+    }
+
+    val = b64lookup(ptr[0]) << 18 |
+          b64lookup(ptr[1]) << 12 |
+          b64lookup(ptr[2]) << 6  |
+          b64lookup(ptr[3]);
+
+    /* Test the upper bit; returns true if any of the characters returned -1. */
+    if (val & 0x80000000) {
+      goto otherchar;
+    }
+
+    output[0] = val >> 16;
+    output[1] = (val >> 8) & 0xff;
+    output[2] = val & 0xff;
+    upb_sink_putstring(p->top->sink, sel, output, 3, NULL);
+  }
+  return true;
+
+otherchar:
+  if (nonbase64(ptr[0]) || nonbase64(ptr[1]) || nonbase64(ptr[2]) ||
+      nonbase64(ptr[3]) ) {
+    upb_status_seterrf(p->status,
+                       "Non-base64 characters in bytes field: %s",
+                       upb_fielddef_name(p->top->f));
+    return false;
+  } if (ptr[2] == '=') {
+    uint32_t val;
+    char output;
+
+    /* Last group contains only two input bytes, one output byte. */
+    if (ptr[0] == '=' || ptr[1] == '=' || ptr[3] != '=') {
+      goto badpadding;
+    }
+
+    val = b64lookup(ptr[0]) << 18 |
+          b64lookup(ptr[1]) << 12;
+
+    UPB_ASSERT(!(val & 0x80000000));
+    output = val >> 16;
+    upb_sink_putstring(p->top->sink, sel, &output, 1, NULL);
+    return true;
+  } else {
+    uint32_t val;
+    char output[2];
+
+    /* Last group contains only three input bytes, two output bytes. */
+    if (ptr[0] == '=' || ptr[1] == '=' || ptr[2] == '=') {
+      goto badpadding;
+    }
+
+    val = b64lookup(ptr[0]) << 18 |
+          b64lookup(ptr[1]) << 12 |
+          b64lookup(ptr[2]) << 6;
+
+    output[0] = val >> 16;
+    output[1] = (val >> 8) & 0xff;
+    upb_sink_putstring(p->top->sink, sel, output, 2, NULL);
+    return true;
+  }
+
+badpadding:
+  upb_status_seterrf(p->status,
+                     "Incorrect base64 padding for field: %s (%.*s)",
+                     upb_fielddef_name(p->top->f),
+                     4, ptr);
+  return false;
+}
+
+
+/* Accumulate buffer **********************************************************/
+
+/* Functionality for accumulating a buffer.
+ *
+ * Some parts of the parser need an entire value as a contiguous string.  For
+ * example, to look up a member name in a hash table, or to turn a string into
+ * a number, the relevant library routines need the input string to be in
+ * contiguous memory, even if the value spanned two or more buffers in the
+ * input.  These routines handle that.
+ *
+ * In the common case we can just point to the input buffer to get this
+ * contiguous string and avoid any actual copy.  So we optimistically begin
+ * this way.  But there are a few cases where we must instead copy into a
+ * separate buffer:
+ *
+ *   1. The string was not contiguous in the input (it spanned buffers).
+ *
+ *   2. The string included escape sequences that need to be interpreted to get
+ *      the true value in a contiguous buffer. */
+
+static void assert_accumulate_empty(upb_json_parser *p) {
+  UPB_ASSERT(p->accumulated == NULL);
+  UPB_ASSERT(p->accumulated_len == 0);
+}
+
+static void accumulate_clear(upb_json_parser *p) {
+  p->accumulated = NULL;
+  p->accumulated_len = 0;
+}
+
+/* Used internally by accumulate_append(). */
+static bool accumulate_realloc(upb_json_parser *p, size_t need) {
+  void *mem;
+  size_t old_size = p->accumulate_buf_size;
+  size_t new_size = UPB_MAX(old_size, 128);
+  while (new_size < need) {
+    new_size = saturating_multiply(new_size, 2);
+  }
+
+  mem = upb_arena_realloc(p->arena, p->accumulate_buf, old_size, new_size);
+  if (!mem) {
+    upb_status_seterrmsg(p->status, "Out of memory allocating buffer.");
+    return false;
+  }
+
+  p->accumulate_buf = mem;
+  p->accumulate_buf_size = new_size;
+  return true;
+}
+
+/* Logically appends the given data to the append buffer.
+ * If "can_alias" is true, we will try to avoid actually copying, but the buffer
+ * must be valid until the next accumulate_append() call (if any). */
+static bool accumulate_append(upb_json_parser *p, const char *buf, size_t len,
+                              bool can_alias) {
+  size_t need;
+
+  if (!p->accumulated && can_alias) {
+    p->accumulated = buf;
+    p->accumulated_len = len;
+    return true;
+  }
+
+  if (!checked_add(p->accumulated_len, len, &need)) {
+    upb_status_seterrmsg(p->status, "Integer overflow.");
+    return false;
+  }
+
+  if (need > p->accumulate_buf_size && !accumulate_realloc(p, need)) {
+    return false;
+  }
+
+  if (p->accumulated != p->accumulate_buf) {
+    memcpy(p->accumulate_buf, p->accumulated, p->accumulated_len);
+    p->accumulated = p->accumulate_buf;
+  }
+
+  memcpy(p->accumulate_buf + p->accumulated_len, buf, len);
+  p->accumulated_len += len;
+  return true;
+}
+
+/* Returns a pointer to the data accumulated since the last accumulate_clear()
+ * call, and writes the length to *len.  This with point either to the input
+ * buffer or a temporary accumulate buffer. */
+static const char *accumulate_getptr(upb_json_parser *p, size_t *len) {
+  UPB_ASSERT(p->accumulated);
+  *len = p->accumulated_len;
+  return p->accumulated;
+}
+
+
+/* Mult-part text data ********************************************************/
+
+/* When we have text data in the input, it can often come in multiple segments.
+ * For example, there may be some raw string data followed by an escape
+ * sequence.  The two segments are processed with different logic.  Also buffer
+ * seams in the input can cause multiple segments.
+ *
+ * As we see segments, there are two main cases for how we want to process them:
+ *
+ *  1. we want to push the captured input directly to string handlers.
+ *
+ *  2. we need to accumulate all the parts into a contiguous buffer for further
+ *     processing (field name lookup, string->number conversion, etc). */
+
+/* This is the set of states for p->multipart_state. */
+enum {
+  /* We are not currently processing multipart data. */
+  MULTIPART_INACTIVE = 0,
+
+  /* We are processing multipart data by accumulating it into a contiguous
+   * buffer. */
+  MULTIPART_ACCUMULATE = 1,
+
+  /* We are processing multipart data by pushing each part directly to the
+   * current string handlers. */
+  MULTIPART_PUSHEAGERLY = 2
+};
+
+/* Start a multi-part text value where we accumulate the data for processing at
+ * the end. */
+static void multipart_startaccum(upb_json_parser *p) {
+  assert_accumulate_empty(p);
+  UPB_ASSERT(p->multipart_state == MULTIPART_INACTIVE);
+  p->multipart_state = MULTIPART_ACCUMULATE;
+}
+
+/* Start a multi-part text value where we immediately push text data to a string
+ * value with the given selector. */
+static void multipart_start(upb_json_parser *p, upb_selector_t sel) {
+  assert_accumulate_empty(p);
+  UPB_ASSERT(p->multipart_state == MULTIPART_INACTIVE);
+  p->multipart_state = MULTIPART_PUSHEAGERLY;
+  p->string_selector = sel;
+}
+
+static bool multipart_text(upb_json_parser *p, const char *buf, size_t len,
+                           bool can_alias) {
+  switch (p->multipart_state) {
+    case MULTIPART_INACTIVE:
+      upb_status_seterrmsg(
+          p->status, "Internal error: unexpected state MULTIPART_INACTIVE");
+      return false;
+
+    case MULTIPART_ACCUMULATE:
+      if (!accumulate_append(p, buf, len, can_alias)) {
+        return false;
+      }
+      break;
+
+    case MULTIPART_PUSHEAGERLY: {
+      const upb_bufhandle *handle = can_alias ? p->handle : NULL;
+      upb_sink_putstring(p->top->sink, p->string_selector, buf, len, handle);
+      break;
+    }
+  }
+
+  return true;
+}
+
+/* Note: this invalidates the accumulate buffer!  Call only after reading its
+ * contents. */
+static void multipart_end(upb_json_parser *p) {
+  UPB_ASSERT(p->multipart_state != MULTIPART_INACTIVE);
+  p->multipart_state = MULTIPART_INACTIVE;
+  accumulate_clear(p);
+}
+
+
+/* Input capture **************************************************************/
+
+/* Functionality for capturing a region of the input as text.  Gracefully
+ * handles the case where a buffer seam occurs in the middle of the captured
+ * region. */
+
+static void capture_begin(upb_json_parser *p, const char *ptr) {
+  UPB_ASSERT(p->multipart_state != MULTIPART_INACTIVE);
+  UPB_ASSERT(p->capture == NULL);
+  p->capture = ptr;
+}
+
+static bool capture_end(upb_json_parser *p, const char *ptr) {
+  UPB_ASSERT(p->capture);
+  if (multipart_text(p, p->capture, ptr - p->capture, true)) {
+    p->capture = NULL;
+    return true;
+  } else {
+    return false;
+  }
+}
+
+/* This is called at the end of each input buffer (ie. when we have hit a
+ * buffer seam).  If we are in the middle of capturing the input, this
+ * processes the unprocessed capture region. */
+static void capture_suspend(upb_json_parser *p, const char **ptr) {
+  if (!p->capture) return;
+
+  if (multipart_text(p, p->capture, *ptr - p->capture, false)) {
+    /* We use this as a signal that we were in the middle of capturing, and
+     * that capturing should resume at the beginning of the next buffer.
+     * 
+     * We can't use *ptr here, because we have no guarantee that this pointer
+     * will be valid when we resume (if the underlying memory is freed, then
+     * using the pointer at all, even to compare to NULL, is likely undefined
+     * behavior). */
+    p->capture = &suspend_capture;
+  } else {
+    /* Need to back up the pointer to the beginning of the capture, since
+     * we were not able to actually preserve it. */
+    *ptr = p->capture;
+  }
+}
+
+static void capture_resume(upb_json_parser *p, const char *ptr) {
+  if (p->capture) {
+    UPB_ASSERT(p->capture == &suspend_capture);
+    p->capture = ptr;
+  }
+}
+
+
+/* Callbacks from the parser **************************************************/
+
+/* These are the functions called directly from the parser itself.
+ * We define these in the same order as their declarations in the parser. */
+
+static char escape_char(char in) {
+  switch (in) {
+    case 'r': return '\r';
+    case 't': return '\t';
+    case 'n': return '\n';
+    case 'f': return '\f';
+    case 'b': return '\b';
+    case '/': return '/';
+    case '"': return '"';
+    case '\\': return '\\';
+    default:
+      UPB_ASSERT(0);
+      return 'x';
+  }
+}
+
+static bool escape(upb_json_parser *p, const char *ptr) {
+  char ch = escape_char(*ptr);
+  return multipart_text(p, &ch, 1, false);
+}
+
+static void start_hex(upb_json_parser *p) {
+  p->digit = 0;
+}
+
+static void hexdigit(upb_json_parser *p, const char *ptr) {
+  char ch = *ptr;
+
+  p->digit <<= 4;
+
+  if (ch >= '0' && ch <= '9') {
+    p->digit += (ch - '0');
+  } else if (ch >= 'a' && ch <= 'f') {
+    p->digit += ((ch - 'a') + 10);
+  } else {
+    UPB_ASSERT(ch >= 'A' && ch <= 'F');
+    p->digit += ((ch - 'A') + 10);
+  }
+}
+
+static bool end_hex(upb_json_parser *p) {
+  uint32_t codepoint = p->digit;
+
+  /* emit the codepoint as UTF-8. */
+  char utf8[3]; /* support \u0000 -- \uFFFF -- need only three bytes. */
+  int length = 0;
+  if (codepoint <= 0x7F) {
+    utf8[0] = codepoint;
+    length = 1;
+  } else if (codepoint <= 0x07FF) {
+    utf8[1] = (codepoint & 0x3F) | 0x80;
+    codepoint >>= 6;
+    utf8[0] = (codepoint & 0x1F) | 0xC0;
+    length = 2;
+  } else /* codepoint <= 0xFFFF */ {
+    utf8[2] = (codepoint & 0x3F) | 0x80;
+    codepoint >>= 6;
+    utf8[1] = (codepoint & 0x3F) | 0x80;
+    codepoint >>= 6;
+    utf8[0] = (codepoint & 0x0F) | 0xE0;
+    length = 3;
+  }
+  /* TODO(haberman): Handle high surrogates: if codepoint is a high surrogate
+   * we have to wait for the next escape to get the full code point). */
+
+  return multipart_text(p, utf8, length, false);
+}
+
+static void start_text(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_text(upb_json_parser *p, const char *ptr) {
+  return capture_end(p, ptr);
+}
+
+static bool start_number(upb_json_parser *p, const char *ptr) {
+  if (is_top_level(p)) {
+    if (is_number_wrapper_object(p)) {
+      start_wrapper_object(p);
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+      start_value_object(p, VALUE_NUMBERVALUE);
+    } else {
+      return false;
+    }
+  } else if (does_number_wrapper_start(p)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_wrapper_object(p);
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_value_object(p, VALUE_NUMBERVALUE);
+  }
+
+  multipart_startaccum(p);
+  capture_begin(p, ptr);
+  return true;
+}
+
+static bool parse_number(upb_json_parser *p, bool is_quoted);
+
+static bool end_number_nontop(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+
+  if (p->top->f == NULL) {
+    multipart_end(p);
+    return true;
+  }
+
+  return parse_number(p, false);
+}
+
+static bool end_number(upb_json_parser *p, const char *ptr) {
+  if (!end_number_nontop(p, ptr)) {
+    return false;
+  }
+
+  if (does_number_wrapper_end(p)) {
+    end_wrapper_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+    end_value_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  return true;
+}
+
+/* |buf| is NULL-terminated. |buf| itself will never include quotes;
+ * |is_quoted| tells us whether this text originally appeared inside quotes. */
+static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
+                                     bool is_quoted) {
+  size_t len = strlen(buf);
+  const char *bufend = buf + len;
+  char *end;
+  upb_fieldtype_t type = upb_fielddef_type(p->top->f);
+  double val;
+  double dummy;
+  double inf = UPB_INFINITY;
+
+  errno = 0;
+
+  if (len == 0 || buf[0] == ' ') {
+    return false;
+  }
+
+  /* For integer types, first try parsing with integer-specific routines.
+   * If these succeed, they will be more accurate for int64/uint64 than
+   * strtod().
+   */
+  switch (type) {
+    case UPB_TYPE_ENUM:
+    case UPB_TYPE_INT32: {
+      long val = strtol(buf, &end, 0);
+      if (errno == ERANGE || end != bufend) {
+        break;
+      } else if (val > INT32_MAX || val < INT32_MIN) {
+        return false;
+      } else {
+        upb_sink_putint32(p->top->sink, parser_getsel(p), val);
+        return true;
+      }
+    }
+    case UPB_TYPE_UINT32: {
+      unsigned long val = strtoul(buf, &end, 0);
+      if (end != bufend) {
+        break;
+      } else if (val > UINT32_MAX || errno == ERANGE) {
+        return false;
+      } else {
+        upb_sink_putuint32(p->top->sink, parser_getsel(p), val);
+        return true;
+      }
+    }
+    /* XXX: We can't handle [u]int64 properly on 32-bit machines because
+     * strto[u]ll isn't in C89. */
+    case UPB_TYPE_INT64: {
+      long val = strtol(buf, &end, 0);
+      if (errno == ERANGE || end != bufend) {
+        break;
+      } else {
+        upb_sink_putint64(p->top->sink, parser_getsel(p), val);
+        return true;
+      }
+    }
+    case UPB_TYPE_UINT64: {
+      unsigned long val = strtoul(p->accumulated, &end, 0);
+      if (end != bufend) {
+        break;
+      } else if (errno == ERANGE) {
+        return false;
+      } else {
+        upb_sink_putuint64(p->top->sink, parser_getsel(p), val);
+        return true;
+      }
+    }
+    default:
+      break;
+  }
+
+  if (type != UPB_TYPE_DOUBLE && type != UPB_TYPE_FLOAT && is_quoted) {
+    /* Quoted numbers for integer types are not allowed to be in double form. */
+    return false;
+  }
+
+  if (len == strlen("Infinity") && strcmp(buf, "Infinity") == 0) {
+    /* C89 does not have an INFINITY macro. */
+    val = inf;
+  } else if (len == strlen("-Infinity") && strcmp(buf, "-Infinity") == 0) {
+    val = -inf;
+  } else {
+    val = strtod(buf, &end);
+    if (errno == ERANGE || end != bufend) {
+      return false;
+    }
+  }
+
+  switch (type) {
+#define CASE(capitaltype, smalltype, ctype, min, max)                     \
+    case UPB_TYPE_ ## capitaltype: {                                      \
+      if (modf(val, &dummy) != 0 || val > max || val < min) {             \
+        return false;                                                     \
+      } else {                                                            \
+        upb_sink_put ## smalltype(p->top->sink, parser_getsel(p),        \
+                                  (ctype)val);                            \
+        return true;                                                      \
+      }                                                                   \
+      break;                                                              \
+    }
+    case UPB_TYPE_ENUM:
+    CASE(INT32, int32, int32_t, INT32_MIN, INT32_MAX);
+    CASE(INT64, int64, int64_t, INT64_MIN, INT64_MAX);
+    CASE(UINT32, uint32, uint32_t, 0, UINT32_MAX);
+    CASE(UINT64, uint64, uint64_t, 0, UINT64_MAX);
+#undef CASE
+
+    case UPB_TYPE_DOUBLE:
+      upb_sink_putdouble(p->top->sink, parser_getsel(p), val);
+      return true;
+    case UPB_TYPE_FLOAT:
+      if ((val > FLT_MAX || val < -FLT_MAX) && val != inf && val != -inf) {
+        return false;
+      } else {
+        upb_sink_putfloat(p->top->sink, parser_getsel(p), val);
+        return true;
+      }
+    default:
+      return false;
+  }
+}
+
+static bool parse_number(upb_json_parser *p, bool is_quoted) {
+  size_t len;
+  const char *buf;
+
+  /* strtol() and friends unfortunately do not support specifying the length of
+   * the input string, so we need to force a copy into a NULL-terminated buffer. */
+  if (!multipart_text(p, "\0", 1, false)) {
+    return false;
+  }
+
+  buf = accumulate_getptr(p, &len);
+
+  if (parse_number_from_buffer(p, buf, is_quoted)) {
+    multipart_end(p);
+    return true;
+  } else {
+    upb_status_seterrf(p->status, "error parsing number: %s", buf);
+    multipart_end(p);
+    return false;
+  }
+}
+
+static bool parser_putbool(upb_json_parser *p, bool val) {
+  bool ok;
+
+  if (p->top->f == NULL) {
+    return true;
+  }
+
+  if (upb_fielddef_type(p->top->f) != UPB_TYPE_BOOL) {
+    upb_status_seterrf(p->status,
+                       "Boolean value specified for non-bool field: %s",
+                       upb_fielddef_name(p->top->f));
+    return false;
+  }
+
+  ok = upb_sink_putbool(p->top->sink, parser_getsel(p), val);
+  UPB_ASSERT(ok);
+
+  return true;
+}
+
+static bool end_bool(upb_json_parser *p, bool val) {
+  if (is_top_level(p)) {
+    if (is_wellknown_msg(p, UPB_WELLKNOWN_BOOLVALUE)) {
+      start_wrapper_object(p);
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+      start_value_object(p, VALUE_BOOLVALUE);
+    } else {
+      return false;
+    }
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_BOOLVALUE)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_wrapper_object(p);
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_value_object(p, VALUE_BOOLVALUE);
+  }
+
+  if (p->top->is_unknown_field) {
+    return true;
+  }
+
+  if (!parser_putbool(p, val)) {
+    return false;
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_BOOLVALUE)) {
+    end_wrapper_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+    end_value_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  return true;
+}
+
+static bool end_null(upb_json_parser *p) {
+  const char *zero_ptr = "0";
+
+  if (is_top_level(p)) {
+    if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+      start_value_object(p, VALUE_NULLVALUE);
+    } else {
+      return true;
+    }
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_value_object(p, VALUE_NULLVALUE);
+  } else {
+    return true;
+  }
+
+  /* Fill null_value field. */
+  multipart_startaccum(p);
+  capture_begin(p, zero_ptr);
+  capture_end(p, zero_ptr + 1);
+  parse_number(p, false);
+
+  end_value_object(p);
+  if (!is_top_level(p)) {
+    end_subobject(p);
+  }
+
+  return true;
+}
+
+static bool start_any_stringval(upb_json_parser *p) {
+  multipart_startaccum(p);
+  return true;
+}
+
+static bool start_stringval(upb_json_parser *p) {
+  if (is_top_level(p)) {
+    if (is_string_wrapper_object(p)) {
+      start_wrapper_object(p);
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_FIELDMASK)) {
+      start_fieldmask_object(p);
+      return true;
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_TIMESTAMP) ||
+               is_wellknown_msg(p, UPB_WELLKNOWN_DURATION)) {
+      start_object(p);
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+      start_value_object(p, VALUE_STRINGVALUE);
+    } else {
+      return false;
+    }
+  } else if (does_string_wrapper_start(p)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_wrapper_object(p);
+  } else if (does_fieldmask_start(p)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_fieldmask_object(p);
+    return true;
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_TIMESTAMP) ||
+             is_wellknown_field(p, UPB_WELLKNOWN_DURATION)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_object(p);
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
+    if (!start_subobject(p)) {
+      return false;
+    }
+    start_value_object(p, VALUE_STRINGVALUE);
+  }
+
+  if (p->top->f == NULL) {
+    multipart_startaccum(p);
+    return true;
+  }
+
+  if (p->top->is_any) {
+    return start_any_stringval(p);
+  }
+
+  if (upb_fielddef_isstring(p->top->f)) {
+    upb_jsonparser_frame *inner;
+    upb_selector_t sel;
+
+    if (!check_stack(p)) return false;
+
+    /* Start a new parser frame: parser frames correspond one-to-one with
+     * handler frames, and string events occur in a sub-frame. */
+    inner = start_jsonparser_frame(p);
+    sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR);
+    upb_sink_startstr(p->top->sink, sel, 0, &inner->sink);
+    inner->m = p->top->m;
+    inner->f = p->top->f;
+    p->top = inner;
+
+    if (upb_fielddef_type(p->top->f) == UPB_TYPE_STRING) {
+      /* For STRING fields we push data directly to the handlers as it is
+       * parsed.  We don't do this yet for BYTES fields, because our base64
+       * decoder is not streaming.
+       *
+       * TODO(haberman): make base64 decoding streaming also. */
+      multipart_start(p, getsel_for_handlertype(p, UPB_HANDLER_STRING));
+      return true;
+    } else {
+      multipart_startaccum(p);
+      return true;
+    }
+  } else if (upb_fielddef_type(p->top->f) != UPB_TYPE_BOOL &&
+             upb_fielddef_type(p->top->f) != UPB_TYPE_MESSAGE) {
+    /* No need to push a frame -- numeric values in quotes remain in the
+     * current parser frame.  These values must accmulate so we can convert
+     * them all at once at the end. */
+    multipart_startaccum(p);
+    return true;
+  } else {
+    upb_status_seterrf(p->status,
+                       "String specified for bool or submessage field: %s",
+                       upb_fielddef_name(p->top->f));
+    return false;
+  }
+}
+
+static bool end_any_stringval(upb_json_parser *p) {
+  size_t len;
+  const char *buf = accumulate_getptr(p, &len);
+
+  /* Set type_url */
+  upb_selector_t sel;
+  upb_jsonparser_frame *inner;
+  if (!check_stack(p)) return false;
+  inner = p->top + 1;
+
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR);
+  upb_sink_startstr(p->top->sink, sel, 0, &inner->sink);
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STRING);
+  upb_sink_putstring(inner->sink, sel, buf, len, NULL);
+  sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
+  upb_sink_endstr(inner->sink, sel);
+
+  multipart_end(p);
+
+  /* Resolve type url */
+  if (strncmp(buf, "type.googleapis.com/", 20) == 0 && len > 20) {
+    const upb_msgdef *payload_type = NULL;
+    buf += 20;
+    len -= 20;
+
+    payload_type = upb_symtab_lookupmsg2(p->symtab, buf, len);
+    if (payload_type == NULL) {
+      upb_status_seterrf(
+          p->status, "Cannot find packed type: %.*s\n", (int)len, buf);
+      return false;
+    }
+
+    json_parser_any_frame_set_payload_type(p, p->top->any_frame, payload_type);
+
+    return true;
+  } else {
+    upb_status_seterrf(
+        p->status, "Invalid type url: %.*s\n", (int)len, buf);
+    return false;
+  }
+}
+
+static bool end_stringval_nontop(upb_json_parser *p) {
+  bool ok = true;
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_TIMESTAMP) ||
+      is_wellknown_msg(p, UPB_WELLKNOWN_DURATION)) {
+    multipart_end(p);
+    return true;
+  }
+
+  if (p->top->f == NULL) {
+    multipart_end(p);
+    return true;
+  }
+
+  if (p->top->is_any) {
+    return end_any_stringval(p);
+  }
+
+  switch (upb_fielddef_type(p->top->f)) {
+    case UPB_TYPE_BYTES:
+      if (!base64_push(p, getsel_for_handlertype(p, UPB_HANDLER_STRING),
+                       p->accumulated, p->accumulated_len)) {
+        return false;
+      }
+      /* Fall through. */
+
+    case UPB_TYPE_STRING: {
+      upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
+      upb_sink_endstr(p->top->sink, sel);
+      p->top--;
+      break;
+    }
+
+    case UPB_TYPE_ENUM: {
+      /* Resolve enum symbolic name to integer value. */
+      const upb_enumdef *enumdef = upb_fielddef_enumsubdef(p->top->f);
+
+      size_t len;
+      const char *buf = accumulate_getptr(p, &len);
+
+      int32_t int_val = 0;
+      ok = upb_enumdef_ntoi(enumdef, buf, len, &int_val);
+
+      if (ok) {
+        upb_selector_t sel = parser_getsel(p);
+        upb_sink_putint32(p->top->sink, sel, int_val);
+      } else {
+        upb_status_seterrf(p->status, "Enum value unknown: '%.*s'", len, buf);
+      }
+
+      break;
+    }
+
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_UINT64:
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_FLOAT:
+      ok = parse_number(p, true);
+      break;
+
+    default:
+      UPB_ASSERT(false);
+      upb_status_seterrmsg(p->status, "Internal error in JSON decoder");
+      ok = false;
+      break;
+  }
+
+  multipart_end(p);
+
+  return ok;
+}
+
+static bool end_stringval(upb_json_parser *p) {
+  /* FieldMask's stringvals have been ended when handling them. Only need to
+   * close FieldMask here.*/
+  if (does_fieldmask_end(p)) {
+    end_fieldmask_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  if (!end_stringval_nontop(p)) {
+    return false;
+  }
+
+  if (does_string_wrapper_end(p)) {
+    end_wrapper_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+    end_value_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_TIMESTAMP) ||
+      is_wellknown_msg(p, UPB_WELLKNOWN_DURATION) ||
+      is_wellknown_msg(p, UPB_WELLKNOWN_FIELDMASK)) {
+    end_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+    return true;
+  }
+
+  return true;
+}
+
+static void start_duration_base(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_duration_base(upb_json_parser *p, const char *ptr) {
+  size_t len;
+  const char *buf;
+  char seconds_buf[14];
+  char nanos_buf[12];
+  char *end;
+  int64_t seconds = 0;
+  int32_t nanos = 0;
+  double val = 0.0;
+  const char *seconds_membername = "seconds";
+  const char *nanos_membername = "nanos";
+  size_t fraction_start;
+
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+
+  buf = accumulate_getptr(p, &len);
+
+  memset(seconds_buf, 0, 14);
+  memset(nanos_buf, 0, 12);
+
+  /* Find out base end. The maximus duration is 315576000000, which cannot be
+   * represented by double without losing precision. Thus, we need to handle
+   * fraction and base separately. */
+  for (fraction_start = 0; fraction_start < len && buf[fraction_start] != '.';
+       fraction_start++);
+
+  /* Parse base */
+  memcpy(seconds_buf, buf, fraction_start);
+  seconds = strtol(seconds_buf, &end, 10);
+  if (errno == ERANGE || end != seconds_buf + fraction_start) {
+    upb_status_seterrf(p->status, "error parsing duration: %s",
+                       seconds_buf);
+    return false;
+  }
+
+  if (seconds > 315576000000) {
+    upb_status_seterrf(p->status, "error parsing duration: "
+                                   "maximum acceptable value is "
+                                   "315576000000");
+    return false;
+  }
+
+  if (seconds < -315576000000) {
+    upb_status_seterrf(p->status, "error parsing duration: "
+                                   "minimum acceptable value is "
+                                   "-315576000000");
+    return false;
+  }
+
+  /* Parse fraction */
+  nanos_buf[0] = '0';
+  memcpy(nanos_buf + 1, buf + fraction_start, len - fraction_start);
+  val = strtod(nanos_buf, &end);
+  if (errno == ERANGE || end != nanos_buf + len - fraction_start + 1) {
+    upb_status_seterrf(p->status, "error parsing duration: %s",
+                       nanos_buf);
+    return false;
+  }
+
+  nanos = val * 1000000000;
+  if (seconds < 0) nanos = -nanos;
+
+  /* Clean up buffer */
+  multipart_end(p);
+
+  /* Set seconds */
+  start_member(p);
+  capture_begin(p, seconds_membername);
+  capture_end(p, seconds_membername + 7);
+  end_membername(p);
+  upb_sink_putint64(p->top->sink, parser_getsel(p), seconds);
+  end_member(p);
+
+  /* Set nanos */
+  start_member(p);
+  capture_begin(p, nanos_membername);
+  capture_end(p, nanos_membername + 5);
+  end_membername(p);
+  upb_sink_putint32(p->top->sink, parser_getsel(p), nanos);
+  end_member(p);
+
+  /* Continue previous arena */
+  multipart_startaccum(p);
+
+  return true;
+}
+
+static int parse_timestamp_number(upb_json_parser *p) {
+  size_t len;
+  const char *buf;
+  int val;
+
+  /* atoi() and friends unfortunately do not support specifying the length of
+   * the input string, so we need to force a copy into a NULL-terminated buffer. */
+  multipart_text(p, "\0", 1, false);
+
+  buf = accumulate_getptr(p, &len);
+  val = atoi(buf);
+  multipart_end(p);
+  multipart_startaccum(p);
+
+  return val;
+}
+
+static void start_year(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_year(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+  p->tm.tm_year = parse_timestamp_number(p) - 1900;
+  return true;
+}
+
+static void start_month(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_month(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+  p->tm.tm_mon = parse_timestamp_number(p) - 1;
+  return true;
+}
+
+static void start_day(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_day(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+  p->tm.tm_mday = parse_timestamp_number(p);
+  return true;
+}
+
+static void start_hour(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_hour(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+  p->tm.tm_hour = parse_timestamp_number(p);
+  return true;
+}
+
+static void start_minute(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_minute(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+  p->tm.tm_min = parse_timestamp_number(p);
+  return true;
+}
+
+static void start_second(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_second(upb_json_parser *p, const char *ptr) {
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+  p->tm.tm_sec = parse_timestamp_number(p);
+  return true;
+}
+
+static void start_timestamp_base(upb_json_parser *p) {
+  memset(&p->tm, 0, sizeof(struct tm));
+}
+
+static void start_timestamp_fraction(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_timestamp_fraction(upb_json_parser *p, const char *ptr) {
+  size_t len;
+  const char *buf;
+  char nanos_buf[12];
+  char *end;
+  double val = 0.0;
+  int32_t nanos;
+  const char *nanos_membername = "nanos";
+
+  memset(nanos_buf, 0, 12);
+
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+
+  buf = accumulate_getptr(p, &len);
+
+  if (len > 10) {
+    upb_status_seterrf(p->status,
+        "error parsing timestamp: at most 9-digit fraction.");
+    return false;
+  }
+
+  /* Parse nanos */
+  nanos_buf[0] = '0';
+  memcpy(nanos_buf + 1, buf, len);
+  val = strtod(nanos_buf, &end);
+
+  if (errno == ERANGE || end != nanos_buf + len + 1) {
+    upb_status_seterrf(p->status, "error parsing timestamp nanos: %s",
+                       nanos_buf);
+    return false;
+  }
+
+  nanos = val * 1000000000;
+
+  /* Clean up previous environment */
+  multipart_end(p);
+
+  /* Set nanos */
+  start_member(p);
+  capture_begin(p, nanos_membername);
+  capture_end(p, nanos_membername + 5);
+  end_membername(p);
+  upb_sink_putint32(p->top->sink, parser_getsel(p), nanos);
+  end_member(p);
+
+  /* Continue previous environment */
+  multipart_startaccum(p);
+
+  return true;
+}
+
+static void start_timestamp_zone(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+#define EPOCH_YEAR 1970
+#define TM_YEAR_BASE 1900
+
+static bool isleap(int year) {
+  return (year % 4) == 0 && (year % 100 != 0 || (year % 400) == 0);
+}
+
+const unsigned short int __mon_yday[2][13] = {
+    /* Normal years.  */
+    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+    /* Leap years.  */
+    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
+
+int64_t epoch(int year, int yday, int hour, int min, int sec) {
+  int64_t years = year - EPOCH_YEAR;
+
+  int64_t leap_days = years / 4 - years / 100 + years / 400;
+
+  int64_t days = years * 365 + yday + leap_days;
+  int64_t hours = days * 24 + hour;
+  int64_t mins = hours * 60 + min;
+  int64_t secs = mins * 60 + sec;
+  return secs;
+}
+
+
+static int64_t upb_mktime(const struct tm *tp) {
+  int sec = tp->tm_sec;
+  int min = tp->tm_min;
+  int hour = tp->tm_hour;
+  int mday = tp->tm_mday;
+  int mon = tp->tm_mon;
+  int year = tp->tm_year + TM_YEAR_BASE;
+
+  /* Calculate day of year from year, month, and day of month. */
+  int mon_yday = ((__mon_yday[isleap(year)][mon]) - 1);
+  int yday = mon_yday + mday;
+
+  return epoch(year, yday, hour, min, sec);
+}
+
+static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
+  size_t len;
+  const char *buf;
+  int hours;
+  int64_t seconds;
+  const char *seconds_membername = "seconds";
+
+  if (!capture_end(p, ptr)) {
+    return false;
+  }
+
+  buf = accumulate_getptr(p, &len);
+
+  if (buf[0] != 'Z') {
+    if (sscanf(buf + 1, "%2d:00", &hours) != 1) {
+      upb_status_seterrf(p->status, "error parsing timestamp offset");
+      return false;
+    }
+
+    if (buf[0] == '+') {
+      hours = -hours;
+    }
+
+    p->tm.tm_hour += hours;
+  }
+
+  /* Normalize tm */
+  seconds = upb_mktime(&p->tm);
+
+  /* Check timestamp boundary */
+  if (seconds < -62135596800) {
+    upb_status_seterrf(p->status, "error parsing timestamp: "
+                                   "minimum acceptable value is "
+                                   "0001-01-01T00:00:00Z");
+    return false;
+  }
+
+  /* Clean up previous environment */
+  multipart_end(p);
+
+  /* Set seconds */
+  start_member(p);
+  capture_begin(p, seconds_membername);
+  capture_end(p, seconds_membername + 7);
+  end_membername(p);
+  upb_sink_putint64(p->top->sink, parser_getsel(p), seconds);
+  end_member(p);
+
+  /* Continue previous environment */
+  multipart_startaccum(p);
+
+  return true;
+}
+
+static void start_fieldmask_path_text(upb_json_parser *p, const char *ptr) {
+  capture_begin(p, ptr);
+}
+
+static bool end_fieldmask_path_text(upb_json_parser *p, const char *ptr) {
+  return capture_end(p, ptr);
+}
+
+static bool start_fieldmask_path(upb_json_parser *p) {
+  upb_jsonparser_frame *inner;
+  upb_selector_t sel;
+
+  if (!check_stack(p)) return false;
+
+  /* Start a new parser frame: parser frames correspond one-to-one with
+   * handler frames, and string events occur in a sub-frame. */
+  inner = start_jsonparser_frame(p);
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR);
+  upb_sink_startstr(p->top->sink, sel, 0, &inner->sink);
+  inner->m = p->top->m;
+  inner->f = p->top->f;
+  p->top = inner;
+
+  multipart_startaccum(p);
+  return true;
+}
+
+static bool lower_camel_push(
+    upb_json_parser *p, upb_selector_t sel, const char *ptr, size_t len) {
+  const char *limit = ptr + len;
+  bool first = true;
+  for (;ptr < limit; ptr++) {
+    if (*ptr >= 'A' && *ptr <= 'Z' && !first) {
+      char lower = tolower(*ptr);
+      upb_sink_putstring(p->top->sink, sel, "_", 1, NULL);
+      upb_sink_putstring(p->top->sink, sel, &lower, 1, NULL);
+    } else {
+      upb_sink_putstring(p->top->sink, sel, ptr, 1, NULL);
+    }
+    first = false;
+  }
+  return true;
+}
+
+static bool end_fieldmask_path(upb_json_parser *p) {
+  upb_selector_t sel;
+
+  if (!lower_camel_push(
+           p, getsel_for_handlertype(p, UPB_HANDLER_STRING),
+           p->accumulated, p->accumulated_len)) {
+    return false;
+  }
+
+  sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
+  upb_sink_endstr(p->top->sink, sel);
+  p->top--;
+
+  multipart_end(p);
+  return true;
+}
+
+static void start_member(upb_json_parser *p) {
+  UPB_ASSERT(!p->top->f);
+  multipart_startaccum(p);
+}
+
+/* Helper: invoked during parse_mapentry() to emit the mapentry message's key
+ * field based on the current contents of the accumulate buffer. */
+static bool parse_mapentry_key(upb_json_parser *p) {
+
+  size_t len;
+  const char *buf = accumulate_getptr(p, &len);
+
+  /* Emit the key field. We do a bit of ad-hoc parsing here because the
+   * parser state machine has already decided that this is a string field
+   * name, and we are reinterpreting it as some arbitrary key type. In
+   * particular, integer and bool keys are quoted, so we need to parse the
+   * quoted string contents here. */
+
+  p->top->f = upb_msgdef_itof(p->top->m, UPB_MAPENTRY_KEY);
+  if (p->top->f == NULL) {
+    upb_status_seterrmsg(p->status, "mapentry message has no key");
+    return false;
+  }
+  switch (upb_fielddef_type(p->top->f)) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_UINT64:
+      /* Invoke end_number. The accum buffer has the number's text already. */
+      if (!parse_number(p, true)) {
+        return false;
+      }
+      break;
+    case UPB_TYPE_BOOL:
+      if (len == 4 && !strncmp(buf, "true", 4)) {
+        if (!parser_putbool(p, true)) {
+          return false;
+        }
+      } else if (len == 5 && !strncmp(buf, "false", 5)) {
+        if (!parser_putbool(p, false)) {
+          return false;
+        }
+      } else {
+        upb_status_seterrmsg(p->status,
+                             "Map bool key not 'true' or 'false'");
+        return false;
+      }
+      multipart_end(p);
+      break;
+    case UPB_TYPE_STRING:
+    case UPB_TYPE_BYTES: {
+      upb_sink subsink;
+      upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR);
+      upb_sink_startstr(p->top->sink, sel, len, &subsink);
+      sel = getsel_for_handlertype(p, UPB_HANDLER_STRING);
+      upb_sink_putstring(subsink, sel, buf, len, NULL);
+      sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
+      upb_sink_endstr(subsink, sel);
+      multipart_end(p);
+      break;
+    }
+    default:
+      upb_status_seterrmsg(p->status, "Invalid field type for map key");
+      return false;
+  }
+
+  return true;
+}
+
+/* Helper: emit one map entry (as a submessage in the map field sequence). This
+ * is invoked from end_membername(), at the end of the map entry's key string,
+ * with the map key in the accumulate buffer. It parses the key from that
+ * buffer, emits the handler calls to start the mapentry submessage (setting up
+ * its subframe in the process), and sets up state in the subframe so that the
+ * value parser (invoked next) will emit the mapentry's value field and then
+ * end the mapentry message. */
+
+static bool handle_mapentry(upb_json_parser *p) {
+  const upb_fielddef *mapfield;
+  const upb_msgdef *mapentrymsg;
+  upb_jsonparser_frame *inner;
+  upb_selector_t sel;
+
+  /* Map entry: p->top->sink is the seq frame, so we need to start a frame
+   * for the mapentry itself, and then set |f| in that frame so that the map
+   * value field is parsed, and also set a flag to end the frame after the
+   * map-entry value is parsed. */
+  if (!check_stack(p)) return false;
+
+  mapfield = p->top->mapfield;
+  mapentrymsg = upb_fielddef_msgsubdef(mapfield);
+
+  inner = start_jsonparser_frame(p);
+  p->top->f = mapfield;
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSUBMSG);
+  upb_sink_startsubmsg(p->top->sink, sel, &inner->sink);
+  inner->m = mapentrymsg;
+  inner->mapfield = mapfield;
+
+  /* Don't set this to true *yet* -- we reuse parsing handlers below to push
+   * the key field value to the sink, and these handlers will pop the frame
+   * if they see is_mapentry (when invoked by the parser state machine, they
+   * would have just seen the map-entry value, not key). */
+  inner->is_mapentry = false;
+  p->top = inner;
+
+  /* send STARTMSG in submsg frame. */
+  upb_sink_startmsg(p->top->sink);
+
+  parse_mapentry_key(p);
+
+  /* Set up the value field to receive the map-entry value. */
+  p->top->f = upb_msgdef_itof(p->top->m, UPB_MAPENTRY_VALUE);
+  p->top->is_mapentry = true;  /* set up to pop frame after value is parsed. */
+  p->top->mapfield = mapfield;
+  if (p->top->f == NULL) {
+    upb_status_seterrmsg(p->status, "mapentry message has no value");
+    return false;
+  }
+
+  return true;
+}
+
+static bool end_membername(upb_json_parser *p) {
+  UPB_ASSERT(!p->top->f);
+
+  if (!p->top->m) {
+    p->top->is_unknown_field = true;
+    multipart_end(p);
+    return true;
+  }
+
+  if (p->top->is_any) {
+    return end_any_membername(p);
+  } else if (p->top->is_map) {
+    return handle_mapentry(p);
+  } else {
+    size_t len;
+    const char *buf = accumulate_getptr(p, &len);
+    upb_value v;
+
+    if (upb_strtable_lookup2(p->top->name_table, buf, len, &v)) {
+      p->top->f = upb_value_getconstptr(v);
+      multipart_end(p);
+
+      return true;
+    } else if (p->ignore_json_unknown) {
+      p->top->is_unknown_field = true;
+      multipart_end(p);
+      return true;
+    } else {
+      upb_status_seterrf(p->status, "No such field: %.*s\n", (int)len, buf);
+      return false;
+    }
+  }
+}
+
+static bool end_any_membername(upb_json_parser *p) {
+  size_t len;
+  const char *buf = accumulate_getptr(p, &len);
+  upb_value v;
+
+  if (len == 5 && strncmp(buf, "@type", len) == 0) {
+    upb_strtable_lookup2(p->top->name_table, "type_url", 8, &v);
+    p->top->f = upb_value_getconstptr(v);
+    multipart_end(p);
+    return true;
+  } else {
+    p->top->is_unknown_field = true;
+    multipart_end(p);
+    return true;
+  }
+}
+
+static void end_member(upb_json_parser *p) {
+  /* If we just parsed a map-entry value, end that frame too. */
+  if (p->top->is_mapentry) {
+    upb_selector_t sel;
+    bool ok;
+    const upb_fielddef *mapfield;
+
+    UPB_ASSERT(p->top > p->stack);
+    /* send ENDMSG on submsg. */
+    upb_sink_endmsg(p->top->sink, p->status);
+    mapfield = p->top->mapfield;
+
+    /* send ENDSUBMSG in repeated-field-of-mapentries frame. */
+    p->top--;
+    ok = upb_handlers_getselector(mapfield, UPB_HANDLER_ENDSUBMSG, &sel);
+    UPB_ASSERT(ok);
+    upb_sink_endsubmsg(p->top->sink, sel);
+  }
+
+  p->top->f = NULL;
+  p->top->is_unknown_field = false;
+}
+
+static void start_any_member(upb_json_parser *p, const char *ptr) {
+  start_member(p);
+  json_parser_any_frame_set_after_type_url_start_once(p->top->any_frame, ptr);
+}
+
+static void end_any_member(upb_json_parser *p, const char *ptr) {
+  json_parser_any_frame_set_before_type_url_end(p->top->any_frame, ptr);
+  end_member(p);
+}
+
+static bool start_subobject(upb_json_parser *p) {
+  if (p->top->is_unknown_field) {
+    if (!check_stack(p)) return false;
+
+    p->top = start_jsonparser_frame(p);
+    return true;
+  }
+
+  if (upb_fielddef_ismap(p->top->f)) {
+    upb_jsonparser_frame *inner;
+    upb_selector_t sel;
+
+    /* Beginning of a map. Start a new parser frame in a repeated-field
+     * context. */
+    if (!check_stack(p)) return false;
+
+    inner = start_jsonparser_frame(p);
+    sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSEQ);
+    upb_sink_startseq(p->top->sink, sel, &inner->sink);
+    inner->m = upb_fielddef_msgsubdef(p->top->f);
+    inner->mapfield = p->top->f;
+    inner->is_map = true;
+    p->top = inner;
+
+    return true;
+  } else if (upb_fielddef_issubmsg(p->top->f)) {
+    upb_jsonparser_frame *inner;
+    upb_selector_t sel;
+
+    /* Beginning of a subobject. Start a new parser frame in the submsg
+     * context. */
+    if (!check_stack(p)) return false;
+
+    inner = start_jsonparser_frame(p);
+    sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSUBMSG);
+    upb_sink_startsubmsg(p->top->sink, sel, &inner->sink);
+    inner->m = upb_fielddef_msgsubdef(p->top->f);
+    set_name_table(p, inner);
+    p->top = inner;
+
+    if (is_wellknown_msg(p, UPB_WELLKNOWN_ANY)) {
+      p->top->is_any = true;
+      p->top->any_frame = json_parser_any_frame_new(p);
+    } else {
+      p->top->is_any = false;
+      p->top->any_frame = NULL;
+    }
+
+    return true;
+  } else {
+    upb_status_seterrf(p->status,
+                       "Object specified for non-message/group field: %s",
+                       upb_fielddef_name(p->top->f));
+    return false;
+  }
+}
+
+static bool start_subobject_full(upb_json_parser *p) {
+  if (is_top_level(p)) {
+    if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+      start_value_object(p, VALUE_STRUCTVALUE);
+      if (!start_subobject(p)) return false;
+      start_structvalue_object(p);
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_STRUCT)) {
+      start_structvalue_object(p);
+    } else {
+      return true;
+    }
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_STRUCT)) {
+    if (!start_subobject(p)) return false;
+    start_structvalue_object(p);
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE)) {
+    if (!start_subobject(p)) return false;
+    start_value_object(p, VALUE_STRUCTVALUE);
+    if (!start_subobject(p)) return false;
+    start_structvalue_object(p);
+  }
+
+  return start_subobject(p);
+}
+
+static void end_subobject(upb_json_parser *p) {
+  if (is_top_level(p)) {
+    return;
+  }
+
+  if (p->top->is_map) {
+    upb_selector_t sel;
+    p->top--;
+    sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSEQ);
+    upb_sink_endseq(p->top->sink, sel);
+  } else {
+    upb_selector_t sel;
+    bool is_unknown = p->top->m == NULL;
+    p->top--;
+    if (!is_unknown) {
+      sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSUBMSG);
+      upb_sink_endsubmsg(p->top->sink, sel);
+    }
+  }
+}
+
+static void end_subobject_full(upb_json_parser *p) {
+  end_subobject(p);
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_STRUCT)) {
+    end_structvalue_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+    end_value_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+  }
+}
+
+static bool start_array(upb_json_parser *p) {
+  upb_jsonparser_frame *inner;
+  upb_selector_t sel;
+
+  if (is_top_level(p)) {
+    if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+      start_value_object(p, VALUE_LISTVALUE);
+      if (!start_subobject(p)) return false;
+      start_listvalue_object(p);
+    } else if (is_wellknown_msg(p, UPB_WELLKNOWN_LISTVALUE)) {
+      start_listvalue_object(p);
+    } else {
+      return false;
+    }
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_LISTVALUE) &&
+             (!upb_fielddef_isseq(p->top->f) ||
+              p->top->is_repeated)) {
+    if (!start_subobject(p)) return false;
+    start_listvalue_object(p);
+  } else if (is_wellknown_field(p, UPB_WELLKNOWN_VALUE) &&
+             (!upb_fielddef_isseq(p->top->f) ||
+              p->top->is_repeated)) {
+    if (!start_subobject(p)) return false;
+    start_value_object(p, VALUE_LISTVALUE);
+    if (!start_subobject(p)) return false;
+    start_listvalue_object(p);
+  }
+
+  if (p->top->is_unknown_field) {
+    inner = start_jsonparser_frame(p);
+    inner->is_unknown_field = true;
+    p->top = inner;
+
+    return true;
+  }
+
+  if (!upb_fielddef_isseq(p->top->f)) {
+    upb_status_seterrf(p->status,
+                       "Array specified for non-repeated field: %s",
+                       upb_fielddef_name(p->top->f));
+    return false;
+  }
+
+  if (!check_stack(p)) return false;
+
+  inner = start_jsonparser_frame(p);
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSEQ);
+  upb_sink_startseq(p->top->sink, sel, &inner->sink);
+  inner->m = p->top->m;
+  inner->f = p->top->f;
+  inner->is_repeated = true;
+  p->top = inner;
+
+  return true;
+}
+
+static void end_array(upb_json_parser *p) {
+  upb_selector_t sel;
+
+  UPB_ASSERT(p->top > p->stack);
+
+  p->top--;
+
+  if (p->top->is_unknown_field) {
+    return;
+  }
+
+  sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSEQ);
+  upb_sink_endseq(p->top->sink, sel);
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_LISTVALUE)) {
+    end_listvalue_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+  }
+
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_VALUE)) {
+    end_value_object(p);
+    if (!is_top_level(p)) {
+      end_subobject(p);
+    }
+  }
+}
+
+static void start_object(upb_json_parser *p) {
+  if (!p->top->is_map && p->top->m != NULL) {
+    upb_sink_startmsg(p->top->sink);
+  }
+}
+
+static void end_object(upb_json_parser *p) {
+  if (!p->top->is_map && p->top->m != NULL) {
+    upb_sink_endmsg(p->top->sink, p->status);
+  }
+}
+
+static void start_any_object(upb_json_parser *p, const char *ptr) {
+  start_object(p);
+  p->top->any_frame->before_type_url_start = ptr;
+  p->top->any_frame->before_type_url_end = ptr;
+}
+
+static bool end_any_object(upb_json_parser *p, const char *ptr) {
+  const char *value_membername = "value";
+  bool is_well_known_packed = false;
+  const char *packed_end = ptr + 1;
+  upb_selector_t sel;
+  upb_jsonparser_frame *inner;
+
+  if (json_parser_any_frame_has_value(p->top->any_frame) &&
+      !json_parser_any_frame_has_type_url(p->top->any_frame)) {
+    upb_status_seterrmsg(p->status, "No valid type url");
+    return false;
+  }
+
+  /* Well known types data is represented as value field. */
+  if (upb_msgdef_wellknowntype(p->top->any_frame->parser->top->m) !=
+          UPB_WELLKNOWN_UNSPECIFIED) {
+    is_well_known_packed = true;
+
+    if (json_parser_any_frame_has_value_before_type_url(p->top->any_frame)) {
+      p->top->any_frame->before_type_url_start =
+          memchr(p->top->any_frame->before_type_url_start, ':',
+                 p->top->any_frame->before_type_url_end -
+                 p->top->any_frame->before_type_url_start);
+      if (p->top->any_frame->before_type_url_start == NULL) {
+        upb_status_seterrmsg(p->status, "invalid data for well known type.");
+        return false;
+      }
+      p->top->any_frame->before_type_url_start++;
+    }
+
+    if (json_parser_any_frame_has_value_after_type_url(p->top->any_frame)) {
+      p->top->any_frame->after_type_url_start =
+          memchr(p->top->any_frame->after_type_url_start, ':',
+                 (ptr + 1) -
+                 p->top->any_frame->after_type_url_start);
+      if (p->top->any_frame->after_type_url_start == NULL) {
+        upb_status_seterrmsg(p->status, "Invalid data for well known type.");
+        return false;
+      }
+      p->top->any_frame->after_type_url_start++;
+      packed_end = ptr;
+    }
+  }
+
+  if (json_parser_any_frame_has_value_before_type_url(p->top->any_frame)) {
+    if (!parse(p->top->any_frame->parser, NULL,
+               p->top->any_frame->before_type_url_start,
+               p->top->any_frame->before_type_url_end -
+               p->top->any_frame->before_type_url_start, NULL)) {
+      return false;
+    }
+  } else {
+    if (!is_well_known_packed) {
+      if (!parse(p->top->any_frame->parser, NULL, "{", 1, NULL)) {
+        return false;
+      }
+    }
+  }
+
+  if (json_parser_any_frame_has_value_before_type_url(p->top->any_frame) &&
+      json_parser_any_frame_has_value_after_type_url(p->top->any_frame)) {
+    if (!parse(p->top->any_frame->parser, NULL, ",", 1, NULL)) {
+      return false;
+    }
+  }
+
+  if (json_parser_any_frame_has_value_after_type_url(p->top->any_frame)) {
+    if (!parse(p->top->any_frame->parser, NULL,
+               p->top->any_frame->after_type_url_start,
+               packed_end - p->top->any_frame->after_type_url_start, NULL)) {
+      return false;
+    }
+  } else {
+    if (!is_well_known_packed) {
+      if (!parse(p->top->any_frame->parser, NULL, "}", 1, NULL)) {
+        return false;
+      }
+    }
+  }
+
+  if (!end(p->top->any_frame->parser, NULL)) {
+    return false;
+  }
+
+  p->top->is_any = false;
+
+  /* Set value */
+  start_member(p);
+  capture_begin(p, value_membername);
+  capture_end(p, value_membername + 5);
+  end_membername(p);
+
+  if (!check_stack(p)) return false;
+  inner = p->top + 1;
+
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR);
+  upb_sink_startstr(p->top->sink, sel, 0, &inner->sink);
+  sel = getsel_for_handlertype(p, UPB_HANDLER_STRING);
+  upb_sink_putstring(inner->sink, sel, p->top->any_frame->stringsink.ptr,
+                     p->top->any_frame->stringsink.len, NULL);
+  sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
+  upb_sink_endstr(inner->sink, sel);
+
+  end_member(p);
+
+  end_object(p);
+
+  /* Deallocate any parse frame. */
+  json_parser_any_frame_free(p->top->any_frame);
+
+  return true;
+}
+
+static bool is_string_wrapper(const upb_msgdef *m) {
+  upb_wellknowntype_t type = upb_msgdef_wellknowntype(m);
+  return type == UPB_WELLKNOWN_STRINGVALUE ||
+         type == UPB_WELLKNOWN_BYTESVALUE;
+}
+
+static bool is_fieldmask(const upb_msgdef *m) {
+  upb_wellknowntype_t type = upb_msgdef_wellknowntype(m);
+  return type == UPB_WELLKNOWN_FIELDMASK;
+}
+
+static void start_fieldmask_object(upb_json_parser *p) {
+  const char *membername = "paths";
+
+  start_object(p);
+
+  /* Set up context for parsing value */
+  start_member(p);
+  capture_begin(p, membername);
+  capture_end(p, membername + 5);
+  end_membername(p);
+
+  start_array(p);
+}
+
+static void end_fieldmask_object(upb_json_parser *p) {
+  end_array(p);
+  end_member(p);
+  end_object(p);
+}
+
+static void start_wrapper_object(upb_json_parser *p) {
+  const char *membername = "value";
+
+  start_object(p);
+
+  /* Set up context for parsing value */
+  start_member(p);
+  capture_begin(p, membername);
+  capture_end(p, membername + 5);
+  end_membername(p);
+}
+
+static void end_wrapper_object(upb_json_parser *p) {
+  end_member(p);
+  end_object(p);
+}
+
+static void start_value_object(upb_json_parser *p, int value_type) {
+  const char *nullmember = "null_value";
+  const char *numbermember = "number_value";
+  const char *stringmember = "string_value";
+  const char *boolmember = "bool_value";
+  const char *structmember = "struct_value";
+  const char *listmember = "list_value";
+  const char *membername = "";
+
+  switch (value_type) {
+    case VALUE_NULLVALUE:
+      membername = nullmember;
+      break;
+    case VALUE_NUMBERVALUE:
+      membername = numbermember;
+      break;
+    case VALUE_STRINGVALUE:
+      membername = stringmember;
+      break;
+    case VALUE_BOOLVALUE:
+      membername = boolmember;
+      break;
+    case VALUE_STRUCTVALUE:
+      membername = structmember;
+      break;
+    case VALUE_LISTVALUE:
+      membername = listmember;
+      break;
+  }
+
+  start_object(p);
+
+  /* Set up context for parsing value */
+  start_member(p);
+  capture_begin(p, membername);
+  capture_end(p, membername + strlen(membername));
+  end_membername(p);
+}
+
+static void end_value_object(upb_json_parser *p) {
+  end_member(p);
+  end_object(p);
+}
+
+static void start_listvalue_object(upb_json_parser *p) {
+  const char *membername = "values";
+
+  start_object(p);
+
+  /* Set up context for parsing value */
+  start_member(p);
+  capture_begin(p, membername);
+  capture_end(p, membername + strlen(membername));
+  end_membername(p);
+}
+
+static void end_listvalue_object(upb_json_parser *p) {
+  end_member(p);
+  end_object(p);
+}
+
+static void start_structvalue_object(upb_json_parser *p) {
+  const char *membername = "fields";
+
+  start_object(p);
+
+  /* Set up context for parsing value */
+  start_member(p);
+  capture_begin(p, membername);
+  capture_end(p, membername + strlen(membername));
+  end_membername(p);
+}
+
+static void end_structvalue_object(upb_json_parser *p) {
+  end_member(p);
+  end_object(p);
+}
+
+static bool is_top_level(upb_json_parser *p) {
+  return p->top == p->stack && p->top->f == NULL && !p->top->is_unknown_field;
+}
+
+static bool is_wellknown_msg(upb_json_parser *p, upb_wellknowntype_t type) {
+  return p->top->m != NULL && upb_msgdef_wellknowntype(p->top->m) == type;
+}
+
+static bool is_wellknown_field(upb_json_parser *p, upb_wellknowntype_t type) {
+  return p->top->f != NULL &&
+         upb_fielddef_issubmsg(p->top->f) &&
+         (upb_msgdef_wellknowntype(upb_fielddef_msgsubdef(p->top->f))
+              == type);
+}
+
+static bool does_number_wrapper_start(upb_json_parser *p) {
+  return p->top->f != NULL &&
+         upb_fielddef_issubmsg(p->top->f) &&
+         upb_msgdef_isnumberwrapper(upb_fielddef_msgsubdef(p->top->f));
+}
+
+static bool does_number_wrapper_end(upb_json_parser *p) {
+  return p->top->m != NULL && upb_msgdef_isnumberwrapper(p->top->m);
+}
+
+static bool is_number_wrapper_object(upb_json_parser *p) {
+  return p->top->m != NULL && upb_msgdef_isnumberwrapper(p->top->m);
+}
+
+static bool does_string_wrapper_start(upb_json_parser *p) {
+  return p->top->f != NULL &&
+         upb_fielddef_issubmsg(p->top->f) &&
+         is_string_wrapper(upb_fielddef_msgsubdef(p->top->f));
+}
+
+static bool does_string_wrapper_end(upb_json_parser *p) {
+  return p->top->m != NULL && is_string_wrapper(p->top->m);
+}
+
+static bool is_string_wrapper_object(upb_json_parser *p) {
+  return p->top->m != NULL && is_string_wrapper(p->top->m);
+}
+
+static bool does_fieldmask_start(upb_json_parser *p) {
+  return p->top->f != NULL &&
+         upb_fielddef_issubmsg(p->top->f) &&
+         is_fieldmask(upb_fielddef_msgsubdef(p->top->f));
+}
+
+static bool does_fieldmask_end(upb_json_parser *p) {
+  return p->top->m != NULL && is_fieldmask(p->top->m);
+}
+
+#define CHECK_RETURN_TOP(x) if (!(x)) goto error
+
+
+/* The actual parser **********************************************************/
+
+/* What follows is the Ragel parser itself.  The language is specified in Ragel
+ * and the actions call our C functions above.
+ *
+ * Ragel has an extensive set of functionality, and we use only a small part of
+ * it.  There are many action types but we only use a few:
+ *
+ *   ">" -- transition into a machine
+ *   "%" -- transition out of a machine
+ *   "@" -- transition into a final state of a machine.
+ *
+ * "@" transitions are tricky because a machine can transition into a final
+ * state repeatedly.  But in some cases we know this can't happen, for example
+ * a string which is delimited by a final '"' can only transition into its
+ * final state once, when the closing '"' is seen. */
+
+
+#line 2791 "upb/json/parser.rl"
+
+
+
+#line 2594 "upb/json/parser.c"
+static const char _json_actions[] = {
+       0, 1, 0, 1, 1, 1, 3, 1, 
+       4, 1, 6, 1, 7, 1, 8, 1, 
+       9, 1, 11, 1, 12, 1, 13, 1, 
+       14, 1, 15, 1, 16, 1, 17, 1, 
+       18, 1, 19, 1, 20, 1, 22, 1, 
+       23, 1, 24, 1, 35, 1, 37, 1, 
+       39, 1, 40, 1, 42, 1, 43, 1, 
+       44, 1, 46, 1, 48, 1, 49, 1, 
+       50, 1, 51, 1, 53, 1, 54, 2, 
+       4, 9, 2, 5, 6, 2, 7, 3, 
+       2, 7, 9, 2, 21, 26, 2, 25, 
+       10, 2, 27, 28, 2, 29, 30, 2, 
+       32, 34, 2, 33, 31, 2, 38, 36, 
+       2, 40, 42, 2, 45, 2, 2, 46, 
+       54, 2, 47, 36, 2, 49, 54, 2, 
+       50, 54, 2, 51, 54, 2, 52, 41, 
+       2, 53, 54, 3, 32, 34, 35, 4, 
+       21, 26, 27, 28
+};
+
+static const short _json_key_offsets[] = {
+       0, 0, 12, 13, 18, 23, 28, 29, 
+       30, 31, 32, 33, 34, 35, 36, 37, 
+       38, 43, 44, 48, 53, 58, 63, 67, 
+       71, 74, 77, 79, 83, 87, 89, 91, 
+       96, 98, 100, 109, 115, 121, 127, 133, 
+       135, 139, 142, 144, 146, 149, 150, 154, 
+       156, 158, 160, 162, 163, 165, 167, 168, 
+       170, 172, 173, 175, 177, 178, 180, 182, 
+       183, 185, 187, 191, 193, 195, 196, 197, 
+       198, 199, 201, 206, 208, 210, 212, 221, 
+       222, 222, 222, 227, 232, 237, 238, 239, 
+       240, 241, 241, 242, 243, 244, 244, 245, 
+       246, 247, 247, 252, 253, 257, 262, 267, 
+       272, 276, 276, 279, 282, 285, 288, 291, 
+       294, 294, 294, 294, 294, 294
+};
+
+static const char _json_trans_keys[] = {
+       32, 34, 45, 91, 102, 110, 116, 123, 
+       9, 13, 48, 57, 34, 32, 93, 125, 
+       9, 13, 32, 44, 93, 9, 13, 32, 
+       93, 125, 9, 13, 97, 108, 115, 101, 
+       117, 108, 108, 114, 117, 101, 32, 34, 
+       125, 9, 13, 34, 32, 58, 9, 13, 
+       32, 93, 125, 9, 13, 32, 44, 125, 
+       9, 13, 32, 44, 125, 9, 13, 32, 
+       34, 9, 13, 45, 48, 49, 57, 48, 
+       49, 57, 46, 69, 101, 48, 57, 69, 
+       101, 48, 57, 43, 45, 48, 57, 48, 
+       57, 48, 57, 46, 69, 101, 48, 57, 
+       34, 92, 34, 92, 34, 47, 92, 98, 
+       102, 110, 114, 116, 117, 48, 57, 65, 
+       70, 97, 102, 48, 57, 65, 70, 97, 
+       102, 48, 57, 65, 70, 97, 102, 48, 
+       57, 65, 70, 97, 102, 34, 92, 45, 
+       48, 49, 57, 48, 49, 57, 46, 115, 
+       48, 57, 115, 48, 57, 34, 46, 115, 
+       48, 57, 48, 57, 48, 57, 48, 57, 
+       48, 57, 45, 48, 57, 48, 57, 45, 
+       48, 57, 48, 57, 84, 48, 57, 48, 
+       57, 58, 48, 57, 48, 57, 58, 48, 
+       57, 48, 57, 43, 45, 46, 90, 48, 
+       57, 48, 57, 58, 48, 48, 34, 48, 
+       57, 43, 45, 90, 48, 57, 34, 44, 
+       34, 44, 34, 44, 34, 45, 91, 102, 
+       110, 116, 123, 48, 57, 34, 32, 93, 
+       125, 9, 13, 32, 44, 93, 9, 13, 
+       32, 93, 125, 9, 13, 97, 108, 115, 
+       101, 117, 108, 108, 114, 117, 101, 32, 
+       34, 125, 9, 13, 34, 32, 58, 9, 
+       13, 32, 93, 125, 9, 13, 32, 44, 
+       125, 9, 13, 32, 44, 125, 9, 13, 
+       32, 34, 9, 13, 32, 9, 13, 32, 
+       9, 13, 32, 9, 13, 32, 9, 13, 
+       32, 9, 13, 32, 9, 13, 0
+};
+
+static const char _json_single_lengths[] = {
+       0, 8, 1, 3, 3, 3, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 
+       3, 1, 2, 3, 3, 3, 2, 2, 
+       1, 3, 0, 2, 2, 0, 0, 3, 
+       2, 2, 9, 0, 0, 0, 0, 2, 
+       2, 1, 2, 0, 1, 1, 2, 0, 
+       0, 0, 0, 1, 0, 0, 1, 0, 
+       0, 1, 0, 0, 1, 0, 0, 1, 
+       0, 0, 4, 0, 0, 1, 1, 1, 
+       1, 0, 3, 2, 2, 2, 7, 1, 
+       0, 0, 3, 3, 3, 1, 1, 1, 
+       1, 0, 1, 1, 1, 0, 1, 1, 
+       1, 0, 3, 1, 2, 3, 3, 3, 
+       2, 0, 1, 1, 1, 1, 1, 1, 
+       0, 0, 0, 0, 0, 0
+};
+
+static const char _json_range_lengths[] = {
+       0, 2, 0, 1, 1, 1, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       1, 0, 1, 1, 1, 1, 1, 1, 
+       1, 0, 1, 1, 1, 1, 1, 1, 
+       0, 0, 0, 3, 3, 3, 3, 0, 
+       1, 1, 0, 1, 1, 0, 1, 1, 
+       1, 1, 1, 0, 1, 1, 0, 1, 
+       1, 0, 1, 1, 0, 1, 1, 0, 
+       1, 1, 0, 1, 1, 0, 0, 0, 
+       0, 1, 1, 0, 0, 0, 1, 0, 
+       0, 0, 1, 1, 1, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 1, 0, 1, 1, 1, 1, 
+       1, 0, 1, 1, 1, 1, 1, 1, 
+       0, 0, 0, 0, 0, 0
+};
+
+static const short _json_index_offsets[] = {
+       0, 0, 11, 13, 18, 23, 28, 30, 
+       32, 34, 36, 38, 40, 42, 44, 46, 
+       48, 53, 55, 59, 64, 69, 74, 78, 
+       82, 85, 89, 91, 95, 99, 101, 103, 
+       108, 111, 114, 124, 128, 132, 136, 140, 
+       143, 147, 150, 153, 155, 158, 160, 164, 
+       166, 168, 170, 172, 174, 176, 178, 180, 
+       182, 184, 186, 188, 190, 192, 194, 196, 
+       198, 200, 202, 207, 209, 211, 213, 215, 
+       217, 219, 221, 226, 229, 232, 235, 244, 
+       246, 247, 248, 253, 258, 263, 265, 267, 
+       269, 271, 272, 274, 276, 278, 279, 281, 
+       283, 285, 286, 291, 293, 297, 302, 307, 
+       312, 316, 317, 320, 323, 326, 329, 332, 
+       335, 336, 337, 338, 339, 340
+};
+
+static const unsigned char _json_indicies[] = {
+       0, 2, 3, 4, 5, 6, 7, 8, 
+       0, 3, 1, 9, 1, 11, 12, 1, 
+       11, 10, 13, 14, 12, 13, 1, 14, 
+       1, 1, 14, 10, 15, 1, 16, 1, 
+       17, 1, 18, 1, 19, 1, 20, 1, 
+       21, 1, 22, 1, 23, 1, 24, 1, 
+       25, 26, 27, 25, 1, 28, 1, 29, 
+       30, 29, 1, 30, 1, 1, 30, 31, 
+       32, 33, 34, 32, 1, 35, 36, 27, 
+       35, 1, 36, 26, 36, 1, 37, 38, 
+       39, 1, 38, 39, 1, 41, 42, 42, 
+       40, 43, 1, 42, 42, 43, 40, 44, 
+       44, 45, 1, 45, 1, 45, 40, 41, 
+       42, 42, 39, 40, 47, 48, 46, 50, 
+       51, 49, 52, 52, 52, 52, 52, 52, 
+       52, 52, 53, 1, 54, 54, 54, 1, 
+       55, 55, 55, 1, 56, 56, 56, 1, 
+       57, 57, 57, 1, 59, 60, 58, 61, 
+       62, 63, 1, 64, 65, 1, 66, 67, 
+       1, 68, 1, 67, 68, 1, 69, 1, 
+       66, 67, 65, 1, 70, 1, 71, 1, 
+       72, 1, 73, 1, 74, 1, 75, 1, 
+       76, 1, 77, 1, 78, 1, 79, 1, 
+       80, 1, 81, 1, 82, 1, 83, 1, 
+       84, 1, 85, 1, 86, 1, 87, 1, 
+       88, 1, 89, 89, 90, 91, 1, 92, 
+       1, 93, 1, 94, 1, 95, 1, 96, 
+       1, 97, 1, 98, 1, 99, 99, 100, 
+       98, 1, 102, 1, 101, 104, 105, 103, 
+       1, 1, 101, 106, 107, 108, 109, 110, 
+       111, 112, 107, 1, 113, 1, 114, 115, 
+       117, 118, 1, 117, 116, 119, 120, 118, 
+       119, 1, 120, 1, 1, 120, 116, 121, 
+       1, 122, 1, 123, 1, 124, 1, 125, 
+       126, 1, 127, 1, 128, 1, 129, 130, 
+       1, 131, 1, 132, 1, 133, 134, 135, 
+       136, 134, 1, 137, 1, 138, 139, 138, 
+       1, 139, 1, 1, 139, 140, 141, 142, 
+       143, 141, 1, 144, 145, 136, 144, 1, 
+       145, 135, 145, 1, 146, 147, 147, 1, 
+       148, 148, 1, 149, 149, 1, 150, 150, 
+       1, 151, 151, 1, 152, 152, 1, 1, 
+       1, 1, 1, 1, 1, 0
+};
+
+static const char _json_trans_targs[] = {
+       1, 0, 2, 107, 3, 6, 10, 13, 
+       16, 106, 4, 3, 106, 4, 5, 7, 
+       8, 9, 108, 11, 12, 109, 14, 15, 
+       110, 16, 17, 111, 18, 18, 19, 20, 
+       21, 22, 111, 21, 22, 24, 25, 31, 
+       112, 26, 28, 27, 29, 30, 33, 113, 
+       34, 33, 113, 34, 32, 35, 36, 37, 
+       38, 39, 33, 113, 34, 41, 42, 46, 
+       42, 46, 43, 45, 44, 114, 48, 49, 
+       50, 51, 52, 53, 54, 55, 56, 57, 
+       58, 59, 60, 61, 62, 63, 64, 65, 
+       66, 67, 73, 72, 68, 69, 70, 71, 
+       72, 115, 74, 67, 72, 76, 116, 76, 
+       116, 77, 79, 81, 82, 85, 90, 94, 
+       98, 80, 117, 117, 83, 82, 80, 83, 
+       84, 86, 87, 88, 89, 117, 91, 92, 
+       93, 117, 95, 96, 97, 117, 98, 99, 
+       105, 100, 100, 101, 102, 103, 104, 105, 
+       103, 104, 117, 106, 106, 106, 106, 106, 
+       106
+};
+
+static const unsigned char _json_trans_actions[] = {
+       0, 0, 113, 107, 53, 0, 0, 0, 
+       125, 59, 45, 0, 55, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 101, 51, 47, 0, 0, 45, 
+       49, 49, 104, 0, 0, 0, 0, 0, 
+       3, 0, 0, 0, 0, 0, 5, 15, 
+       0, 0, 71, 7, 13, 0, 74, 9, 
+       9, 9, 77, 80, 11, 37, 37, 37, 
+       0, 0, 0, 39, 0, 41, 86, 0, 
+       0, 0, 17, 19, 0, 21, 23, 0, 
+       25, 27, 0, 29, 31, 0, 33, 35, 
+       0, 135, 83, 135, 0, 0, 0, 0, 
+       0, 92, 0, 89, 89, 98, 43, 0, 
+       131, 95, 113, 107, 53, 0, 0, 0, 
+       125, 59, 69, 110, 45, 0, 55, 0, 
+       0, 0, 0, 0, 0, 119, 0, 0, 
+       0, 122, 0, 0, 0, 116, 0, 101, 
+       51, 47, 0, 0, 45, 49, 49, 104, 
+       0, 0, 128, 0, 57, 63, 65, 61, 
+       67
+};
+
+static const unsigned char _json_eof_actions[] = {
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 1, 0, 1, 0, 0, 1, 1, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 57, 63, 65, 61, 67, 
+       0, 0, 0, 0, 0, 0
+};
+
+static const int json_start = 1;
+
+static const int json_en_number_machine = 23;
+static const int json_en_string_machine = 32;
+static const int json_en_duration_machine = 40;
+static const int json_en_timestamp_machine = 47;
+static const int json_en_fieldmask_machine = 75;
+static const int json_en_value_machine = 78;
+static const int json_en_main = 1;
+
+
+#line 2794 "upb/json/parser.rl"
+
+size_t parse(void *closure, const void *hd, const char *buf, size_t size,
+             const upb_bufhandle *handle) {
+  upb_json_parser *parser = closure;
+
+  /* Variables used by Ragel's generated code. */
+  int cs = parser->current_state;
+  int *stack = parser->parser_stack;
+  int top = parser->parser_top;
+
+  const char *p = buf;
+  const char *pe = buf + size;
+  const char *eof = &eof_ch;
+
+  parser->handle = handle;
+
+  UPB_UNUSED(hd);
+  UPB_UNUSED(handle);
+
+  capture_resume(parser, buf);
+
+  
+#line 2872 "upb/json/parser.c"
+       {
+       int _klen;
+       unsigned int _trans;
+       const char *_acts;
+       unsigned int _nacts;
+       const char *_keys;
+
+       if ( p == pe )
+               goto _test_eof;
+       if ( cs == 0 )
+               goto _out;
+_resume:
+       _keys = _json_trans_keys + _json_key_offsets[cs];
+       _trans = _json_index_offsets[cs];
+
+       _klen = _json_single_lengths[cs];
+       if ( _klen > 0 ) {
+               const char *_lower = _keys;
+               const char *_mid;
+               const char *_upper = _keys + _klen - 1;
+               while (1) {
+                       if ( _upper < _lower )
+                               break;
+
+                       _mid = _lower + ((_upper-_lower) >> 1);
+                       if ( (*p) < *_mid )
+                               _upper = _mid - 1;
+                       else if ( (*p) > *_mid )
+                               _lower = _mid + 1;
+                       else {
+                               _trans += (unsigned int)(_mid - _keys);
+                               goto _match;
+                       }
+               }
+               _keys += _klen;
+               _trans += _klen;
+       }
+
+       _klen = _json_range_lengths[cs];
+       if ( _klen > 0 ) {
+               const char *_lower = _keys;
+               const char *_mid;
+               const char *_upper = _keys + (_klen<<1) - 2;
+               while (1) {
+                       if ( _upper < _lower )
+                               break;
+
+                       _mid = _lower + (((_upper-_lower) >> 1) & ~1);
+                       if ( (*p) < _mid[0] )
+                               _upper = _mid - 2;
+                       else if ( (*p) > _mid[1] )
+                               _lower = _mid + 2;
+                       else {
+                               _trans += (unsigned int)((_mid - _keys)>>1);
+                               goto _match;
+                       }
+               }
+               _trans += _klen;
+       }
+
+_match:
+       _trans = _json_indicies[_trans];
+       cs = _json_trans_targs[_trans];
+
+       if ( _json_trans_actions[_trans] == 0 )
+               goto _again;
+
+       _acts = _json_actions + _json_trans_actions[_trans];
+       _nacts = (unsigned int) *_acts++;
+       while ( _nacts-- > 0 )
+       {
+               switch ( *_acts++ )
+               {
+       case 1:
+#line 2599 "upb/json/parser.rl"
+       { p--; {cs = stack[--top]; goto _again;} }
+       break;
+       case 2:
+#line 2601 "upb/json/parser.rl"
+       { p--; {stack[top++] = cs; cs = 23;goto _again;} }
+       break;
+       case 3:
+#line 2605 "upb/json/parser.rl"
+       { start_text(parser, p); }
+       break;
+       case 4:
+#line 2606 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_text(parser, p)); }
+       break;
+       case 5:
+#line 2612 "upb/json/parser.rl"
+       { start_hex(parser); }
+       break;
+       case 6:
+#line 2613 "upb/json/parser.rl"
+       { hexdigit(parser, p); }
+       break;
+       case 7:
+#line 2614 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_hex(parser)); }
+       break;
+       case 8:
+#line 2620 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(escape(parser, p)); }
+       break;
+       case 9:
+#line 2626 "upb/json/parser.rl"
+       { p--; {cs = stack[--top]; goto _again;} }
+       break;
+       case 10:
+#line 2631 "upb/json/parser.rl"
+       { start_year(parser, p); }
+       break;
+       case 11:
+#line 2632 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_year(parser, p)); }
+       break;
+       case 12:
+#line 2636 "upb/json/parser.rl"
+       { start_month(parser, p); }
+       break;
+       case 13:
+#line 2637 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_month(parser, p)); }
+       break;
+       case 14:
+#line 2641 "upb/json/parser.rl"
+       { start_day(parser, p); }
+       break;
+       case 15:
+#line 2642 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_day(parser, p)); }
+       break;
+       case 16:
+#line 2646 "upb/json/parser.rl"
+       { start_hour(parser, p); }
+       break;
+       case 17:
+#line 2647 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_hour(parser, p)); }
+       break;
+       case 18:
+#line 2651 "upb/json/parser.rl"
+       { start_minute(parser, p); }
+       break;
+       case 19:
+#line 2652 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_minute(parser, p)); }
+       break;
+       case 20:
+#line 2656 "upb/json/parser.rl"
+       { start_second(parser, p); }
+       break;
+       case 21:
+#line 2657 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_second(parser, p)); }
+       break;
+       case 22:
+#line 2662 "upb/json/parser.rl"
+       { start_duration_base(parser, p); }
+       break;
+       case 23:
+#line 2663 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_duration_base(parser, p)); }
+       break;
+       case 24:
+#line 2665 "upb/json/parser.rl"
+       { p--; {cs = stack[--top]; goto _again;} }
+       break;
+       case 25:
+#line 2670 "upb/json/parser.rl"
+       { start_timestamp_base(parser); }
+       break;
+       case 26:
+#line 2672 "upb/json/parser.rl"
+       { start_timestamp_fraction(parser, p); }
+       break;
+       case 27:
+#line 2673 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_timestamp_fraction(parser, p)); }
+       break;
+       case 28:
+#line 2675 "upb/json/parser.rl"
+       { start_timestamp_zone(parser, p); }
+       break;
+       case 29:
+#line 2676 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_timestamp_zone(parser, p)); }
+       break;
+       case 30:
+#line 2678 "upb/json/parser.rl"
+       { p--; {cs = stack[--top]; goto _again;} }
+       break;
+       case 31:
+#line 2683 "upb/json/parser.rl"
+       { start_fieldmask_path_text(parser, p); }
+       break;
+       case 32:
+#line 2684 "upb/json/parser.rl"
+       { end_fieldmask_path_text(parser, p); }
+       break;
+       case 33:
+#line 2689 "upb/json/parser.rl"
+       { start_fieldmask_path(parser); }
+       break;
+       case 34:
+#line 2690 "upb/json/parser.rl"
+       { end_fieldmask_path(parser); }
+       break;
+       case 35:
+#line 2696 "upb/json/parser.rl"
+       { p--; {cs = stack[--top]; goto _again;} }
+       break;
+       case 36:
+#line 2701 "upb/json/parser.rl"
+       {
+        if (is_wellknown_msg(parser, UPB_WELLKNOWN_TIMESTAMP)) {
+          {stack[top++] = cs; cs = 47;goto _again;}
+        } else if (is_wellknown_msg(parser, UPB_WELLKNOWN_DURATION)) {
+          {stack[top++] = cs; cs = 40;goto _again;}
+        } else if (is_wellknown_msg(parser, UPB_WELLKNOWN_FIELDMASK)) {
+          {stack[top++] = cs; cs = 75;goto _again;}
+        } else {
+          {stack[top++] = cs; cs = 32;goto _again;}
+        }
+      }
+       break;
+       case 37:
+#line 2714 "upb/json/parser.rl"
+       { p--; {stack[top++] = cs; cs = 78;goto _again;} }
+       break;
+       case 38:
+#line 2719 "upb/json/parser.rl"
+       {
+        if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) {
+          start_any_member(parser, p);
+        } else {
+          start_member(parser);
+        }
+      }
+       break;
+       case 39:
+#line 2726 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_membername(parser)); }
+       break;
+       case 40:
+#line 2729 "upb/json/parser.rl"
+       {
+        if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) {
+          end_any_member(parser, p);
+        } else {
+          end_member(parser);
+        }
+      }
+       break;
+       case 41:
+#line 2740 "upb/json/parser.rl"
+       {
+        if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) {
+          start_any_object(parser, p);
+        } else {
+          start_object(parser);
+        }
+      }
+       break;
+       case 42:
+#line 2749 "upb/json/parser.rl"
+       {
+        if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) {
+          CHECK_RETURN_TOP(end_any_object(parser, p));
+        } else {
+          end_object(parser);
+        }
+      }
+       break;
+       case 43:
+#line 2761 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(start_array(parser)); }
+       break;
+       case 44:
+#line 2765 "upb/json/parser.rl"
+       { end_array(parser); }
+       break;
+       case 45:
+#line 2770 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(start_number(parser, p)); }
+       break;
+       case 46:
+#line 2771 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_number(parser, p)); }
+       break;
+       case 47:
+#line 2773 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(start_stringval(parser)); }
+       break;
+       case 48:
+#line 2774 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_stringval(parser)); }
+       break;
+       case 49:
+#line 2776 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_bool(parser, true)); }
+       break;
+       case 50:
+#line 2778 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_bool(parser, false)); }
+       break;
+       case 51:
+#line 2780 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_null(parser)); }
+       break;
+       case 52:
+#line 2782 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(start_subobject_full(parser)); }
+       break;
+       case 53:
+#line 2783 "upb/json/parser.rl"
+       { end_subobject_full(parser); }
+       break;
+       case 54:
+#line 2788 "upb/json/parser.rl"
+       { p--; {cs = stack[--top]; goto _again;} }
+       break;
+#line 3196 "upb/json/parser.c"
+               }
+       }
+
+_again:
+       if ( cs == 0 )
+               goto _out;
+       if ( ++p != pe )
+               goto _resume;
+       _test_eof: {}
+       if ( p == eof )
+       {
+       const char *__acts = _json_actions + _json_eof_actions[cs];
+       unsigned int __nacts = (unsigned int) *__acts++;
+       while ( __nacts-- > 0 ) {
+               switch ( *__acts++ ) {
+       case 0:
+#line 2597 "upb/json/parser.rl"
+       { p--; {cs = stack[--top];      if ( p == pe )
+               goto _test_eof;
+goto _again;} }
+       break;
+       case 46:
+#line 2771 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_number(parser, p)); }
+       break;
+       case 49:
+#line 2776 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_bool(parser, true)); }
+       break;
+       case 50:
+#line 2778 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_bool(parser, false)); }
+       break;
+       case 51:
+#line 2780 "upb/json/parser.rl"
+       { CHECK_RETURN_TOP(end_null(parser)); }
+       break;
+       case 53:
+#line 2783 "upb/json/parser.rl"
+       { end_subobject_full(parser); }
+       break;
+#line 3238 "upb/json/parser.c"
+               }
+       }
+       }
+
+       _out: {}
+       }
+
+#line 2816 "upb/json/parser.rl"
+
+  if (p != pe) {
+    upb_status_seterrf(parser->status, "Parse error at '%.*s'\n", pe - p, p);
+  } else {
+    capture_suspend(parser, &p);
+  }
+
+error:
+  /* Save parsing state back to parser. */
+  parser->current_state = cs;
+  parser->parser_top = top;
+
+  return p - buf;
+}
+
+static bool end(void *closure, const void *hd) {
+  upb_json_parser *parser = closure;
+
+  /* Prevent compile warning on unused static constants. */
+  UPB_UNUSED(json_start);
+  UPB_UNUSED(json_en_duration_machine);
+  UPB_UNUSED(json_en_fieldmask_machine);
+  UPB_UNUSED(json_en_number_machine);
+  UPB_UNUSED(json_en_string_machine);
+  UPB_UNUSED(json_en_timestamp_machine);
+  UPB_UNUSED(json_en_value_machine);
+  UPB_UNUSED(json_en_main);
+
+  parse(parser, hd, &eof_ch, 0, NULL);
+
+  return parser->current_state >= 106;
+}
+
+static void json_parser_reset(upb_json_parser *p) {
+  int cs;
+  int top;
+
+  p->top = p->stack;
+  init_frame(p->top);
+
+  /* Emit Ragel initialization of the parser. */
+  
+#line 3289 "upb/json/parser.c"
+       {
+       cs = json_start;
+       top = 0;
+       }
+
+#line 2858 "upb/json/parser.rl"
+  p->current_state = cs;
+  p->parser_top = top;
+  accumulate_clear(p);
+  p->multipart_state = MULTIPART_INACTIVE;
+  p->capture = NULL;
+  p->accumulated = NULL;
+}
+
+static upb_json_parsermethod *parsermethod_new(upb_json_codecache *c,
+                                               const upb_msgdef *md) {
+  upb_msg_field_iter i;
+  upb_alloc *alloc = upb_arena_alloc(c->arena);
+
+  upb_json_parsermethod *m = upb_malloc(alloc, sizeof(*m));
+
+  m->cache = c;
+
+  upb_byteshandler_init(&m->input_handler_);
+  upb_byteshandler_setstring(&m->input_handler_, parse, m);
+  upb_byteshandler_setendstr(&m->input_handler_, end, m);
+
+  upb_strtable_init2(&m->name_table, UPB_CTYPE_CONSTPTR, alloc);
+
+  /* Build name_table */
+
+  for(upb_msg_field_begin(&i, md);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    const upb_fielddef *f = upb_msg_iter_field(&i);
+    upb_value v = upb_value_constptr(f);
+    char *buf;
+
+    /* Add an entry for the JSON name. */
+    size_t len = upb_fielddef_getjsonname(f, NULL, 0);
+    buf = upb_malloc(alloc, len);
+    upb_fielddef_getjsonname(f, buf, len);
+    upb_strtable_insert3(&m->name_table, buf, strlen(buf), v, alloc);
+
+    if (strcmp(buf, upb_fielddef_name(f)) != 0) {
+      /* Since the JSON name is different from the regular field name, add an
+       * entry for the raw name (compliant proto3 JSON parsers must accept
+       * both). */
+      const char *name = upb_fielddef_name(f);
+      upb_strtable_insert3(&m->name_table, name, strlen(name), v, alloc);
+    }
+  }
+
+  return m;
+}
+
+/* Public API *****************************************************************/
+
+upb_json_parser *upb_json_parser_create(upb_arena *arena,
+                                        const upb_json_parsermethod *method,
+                                        const upb_symtab* symtab,
+                                        upb_sink output,
+                                        upb_status *status,
+                                        bool ignore_json_unknown) {
+#ifndef NDEBUG
+  const size_t size_before = upb_arena_bytesallocated(arena);
+#endif
+  upb_json_parser *p = upb_arena_malloc(arena, sizeof(upb_json_parser));
+  if (!p) return false;
+
+  p->arena = arena;
+  p->method = method;
+  p->status = status;
+  p->limit = p->stack + UPB_JSON_MAX_DEPTH;
+  p->accumulate_buf = NULL;
+  p->accumulate_buf_size = 0;
+  upb_bytessink_reset(&p->input_, &method->input_handler_, p);
+
+  json_parser_reset(p);
+  p->top->sink = output;
+  p->top->m = upb_handlers_msgdef(output.handlers);
+  if (is_wellknown_msg(p, UPB_WELLKNOWN_ANY)) {
+    p->top->is_any = true;
+    p->top->any_frame = json_parser_any_frame_new(p);
+  } else {
+    p->top->is_any = false;
+    p->top->any_frame = NULL;
+  }
+  set_name_table(p, p->top);
+  p->symtab = symtab;
+
+  p->ignore_json_unknown = ignore_json_unknown;
+
+  /* If this fails, uncomment and increase the value in parser.h. */
+  /* fprintf(stderr, "%zd\n", upb_arena_bytesallocated(arena) - size_before); */
+  UPB_ASSERT_DEBUGVAR(upb_arena_bytesallocated(arena) - size_before <=
+                      UPB_JSON_PARSER_SIZE);
+  return p;
+}
+
+upb_bytessink upb_json_parser_input(upb_json_parser *p) {
+  return p->input_;
+}
+
+const upb_byteshandler *upb_json_parsermethod_inputhandler(
+    const upb_json_parsermethod *m) {
+  return &m->input_handler_;
+}
+
+upb_json_codecache *upb_json_codecache_new(void) {
+  upb_alloc *alloc;
+  upb_json_codecache *c;
+
+  c = upb_gmalloc(sizeof(*c));
+
+  c->arena = upb_arena_new();
+  alloc = upb_arena_alloc(c->arena);
+
+  upb_inttable_init2(&c->methods, UPB_CTYPE_CONSTPTR, alloc);
+
+  return c;
+}
+
+void upb_json_codecache_free(upb_json_codecache *c) {
+  upb_arena_free(c->arena);
+  upb_gfree(c);
+}
+
+const upb_json_parsermethod *upb_json_codecache_get(upb_json_codecache *c,
+                                                    const upb_msgdef *md) {
+  upb_json_parsermethod *m;
+  upb_value v;
+  upb_msg_field_iter i;
+  upb_alloc *alloc = upb_arena_alloc(c->arena);
+
+  if (upb_inttable_lookupptr(&c->methods, md, &v)) {
+    return upb_value_getconstptr(v);
+  }
+
+  m = parsermethod_new(c, md);
+  v = upb_value_constptr(m);
+
+  if (!m) return NULL;
+  if (!upb_inttable_insertptr2(&c->methods, md, v, alloc)) return NULL;
+
+  /* Populate parser methods for all submessages, so the name tables will
+   * be available during parsing. */
+  for(upb_msg_field_begin(&i, md);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    upb_fielddef *f = upb_msg_iter_field(&i);
+
+    if (upb_fielddef_issubmsg(f)) {
+      const upb_msgdef *subdef = upb_fielddef_msgsubdef(f);
+      const upb_json_parsermethod *sub_method =
+          upb_json_codecache_get(c, subdef);
+
+      if (!sub_method) return NULL;
+    }
+  }
+
+  return m;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/tests/conformance_upb.c b/legacy-libs/grpc/deps/grpc/third_party/upb/tests/conformance_upb.c
new file mode 100644 (file)
index 0000000..6063c99
--- /dev/null
@@ -0,0 +1,179 @@
+/* This is a upb implementation of the upb conformance tests, see:
+ *   https://github.com/google/protobuf/tree/master/conformance
+ */
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "conformance/conformance.upb.h"
+#include "src/google/protobuf/test_messages_proto3.upb.h"
+
+int test_count = 0;
+
+bool CheckedRead(int fd, void *buf, size_t len) {
+  size_t ofs = 0;
+  while (len > 0) {
+    ssize_t bytes_read = read(fd, (char*)buf + ofs, len);
+
+    if (bytes_read == 0) return false;
+
+    if (bytes_read < 0) {
+      perror("reading from test runner");
+      exit(1);
+    }
+
+    len -= bytes_read;
+    ofs += bytes_read;
+  }
+
+  return true;
+}
+
+void CheckedWrite(int fd, const void *buf, size_t len) {
+  if ((size_t)write(fd, buf, len) != len) {
+    perror("writing to test runner");
+    exit(1);
+  }
+}
+
+bool strview_eql(upb_strview view, const char *str) {
+  return view.size == strlen(str) && memcmp(view.data, str, view.size) == 0;
+}
+
+static const char *proto3_msg =
+    "protobuf_test_messages.proto3.TestAllTypesProto3";
+
+void DoTest(
+    const conformance_ConformanceRequest* request,
+    conformance_ConformanceResponse *response,
+    upb_arena *arena) {
+  protobuf_test_messages_proto3_TestAllTypesProto3 *test_message;
+
+  if (!strview_eql(conformance_ConformanceRequest_message_type(request),
+                   proto3_msg)) {
+    static const char msg[] = "Only proto3 for now.";
+    conformance_ConformanceResponse_set_skipped(
+        response, upb_strview_make(msg, sizeof(msg)));
+    return;
+  }
+
+  switch (conformance_ConformanceRequest_payload_case(request)) {
+    case conformance_ConformanceRequest_payload_protobuf_payload: {
+      upb_strview payload = conformance_ConformanceRequest_protobuf_payload(request);
+      test_message = protobuf_test_messages_proto3_TestAllTypesProto3_parse(
+          payload.data, payload.size, arena);
+
+      if (!test_message) {
+        static const char msg[] = "Parse error";
+        conformance_ConformanceResponse_set_parse_error(
+            response, upb_strview_make(msg, sizeof(msg)));
+        return;
+      }
+      break;
+    }
+
+    case conformance_ConformanceRequest_payload_NOT_SET:
+      fprintf(stderr, "conformance_upb: Request didn't have payload.\n");
+      return;
+
+    default: {
+      static const char msg[] = "Unsupported input format.";
+      conformance_ConformanceResponse_set_skipped(
+          response, upb_strview_make(msg, sizeof(msg)));
+      return;
+    }
+  }
+
+  switch (conformance_ConformanceRequest_requested_output_format(request)) {
+    case conformance_UNSPECIFIED:
+      fprintf(stderr, "conformance_upb: Unspecified output format.\n");
+      exit(1);
+
+    case conformance_PROTOBUF: {
+      size_t serialized_len;
+      char *serialized =
+          protobuf_test_messages_proto3_TestAllTypesProto3_serialize(
+              test_message, arena, &serialized_len);
+      if (!serialized) {
+        static const char msg[] = "Error serializing.";
+        conformance_ConformanceResponse_set_serialize_error(
+            response, upb_strview_make(msg, sizeof(msg)));
+        return;
+      }
+      conformance_ConformanceResponse_set_protobuf_payload(
+          response, upb_strview_make(serialized, serialized_len));
+      break;
+    }
+
+    default: {
+      static const char msg[] = "Unsupported output format.";
+      conformance_ConformanceResponse_set_skipped(
+          response, upb_strview_make(msg, sizeof(msg)));
+      return;
+    }
+  }
+
+  return;
+}
+
+bool DoTestIo(void) {
+  upb_arena *arena;
+  upb_alloc *alloc;
+  upb_status status;
+  char *serialized_input;
+  char *serialized_output;
+  uint32_t input_size;
+  size_t output_size;
+  conformance_ConformanceRequest *request;
+  conformance_ConformanceResponse *response;
+
+  if (!CheckedRead(STDIN_FILENO, &input_size, sizeof(uint32_t))) {
+    /* EOF. */
+    return false;
+  }
+
+  arena = upb_arena_new();
+  alloc = upb_arena_alloc(arena);
+  serialized_input = upb_malloc(alloc, input_size);
+
+  if (!CheckedRead(STDIN_FILENO, serialized_input, input_size)) {
+    fprintf(stderr, "conformance_upb: unexpected EOF on stdin.\n");
+    exit(1);
+  }
+
+  request =
+      conformance_ConformanceRequest_parse(serialized_input, input_size, arena);
+  response = conformance_ConformanceResponse_new(arena);
+
+  if (request) {
+    DoTest(request, response, arena);
+  } else {
+    fprintf(stderr, "conformance_upb: parse of ConformanceRequest failed: %s\n",
+            upb_status_errmsg(&status));
+  }
+
+  serialized_output = conformance_ConformanceResponse_serialize(
+      response, arena, &output_size);
+
+  CheckedWrite(STDOUT_FILENO, &output_size, sizeof(uint32_t));
+  CheckedWrite(STDOUT_FILENO, serialized_output, output_size);
+
+  test_count++;
+
+  upb_arena_free(arena);
+
+  return true;
+}
+
+int main(void) {
+  while (1) {
+    if (!DoTestIo()) {
+      fprintf(stderr, "conformance_upb: received EOF from test runner "
+                      "after %d tests, exiting\n", test_count);
+      return 0;
+    }
+  }
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/tests/corpus/README b/legacy-libs/grpc/deps/grpc/third_party/upb/tests/corpus/README
new file mode 100644 (file)
index 0000000..9bd8f1e
--- /dev/null
@@ -0,0 +1 @@
+Corpus folder for fuzzing
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/tests/pb/test_varint.c b/legacy-libs/grpc/deps/grpc/third_party/upb/tests/pb/test_varint.c
new file mode 100644 (file)
index 0000000..95a04ab
--- /dev/null
@@ -0,0 +1,117 @@
+
+#include <stdio.h>
+#include "upb/pb/varint.int.h"
+#include "tests/upb_test.h"
+
+#include "upb/port_def.inc"
+
+/* Test that we can round-trip from int->varint->int. */
+static void test_varint_for_num(upb_decoderet (*decoder)(const char*),
+                                uint64_t num) {
+  char buf[16];
+  size_t bytes;
+  upb_decoderet r;
+
+  memset(buf, 0xff, sizeof(buf));
+  bytes = upb_vencode64(num, buf);
+
+  if (num <= UINT32_MAX) {
+    uint64_t encoded = upb_vencode32(num);
+    char buf2[16];
+    upb_decoderet r;
+
+    memset(buf2, 0, sizeof(buf2));
+    memcpy(&buf2, &encoded, 8);
+#ifdef UPB_BIG_ENDIAN
+    char swap[8];
+    swap[0] = buf2[7];
+    swap[1] = buf2[6];
+    swap[2] = buf2[5];
+    swap[3] = buf2[4];
+    swap[4] = buf2[3];
+    swap[5] = buf2[2];
+    swap[6] = buf2[1];
+    swap[7] = buf2[0];
+    buf2[0] = swap[0];
+    buf2[1] = swap[1];
+    buf2[2] = swap[2];
+    buf2[3] = swap[3];
+    buf2[4] = swap[4];
+    buf2[5] = swap[5];
+    buf2[6] = swap[6];
+    buf2[7] = swap[7];
+#endif    
+    r = decoder(buf2);
+    ASSERT(r.val == num);
+    ASSERT(r.p == buf2 + upb_value_size(encoded));
+    ASSERT(upb_zzenc_32(upb_zzdec_32(num)) == num);
+  }
+
+  r = decoder(buf);
+  ASSERT(r.val == num);
+  ASSERT(r.p == buf + bytes);
+  ASSERT(upb_zzenc_64(upb_zzdec_64(num)) == num);
+}
+
+static void test_varint_decoder(upb_decoderet (*decoder)(const char*)) {
+#define TEST(bytes, expected_val) {\
+    size_t n = sizeof(bytes) - 1;  /* for NULL */ \
+    char buf[UPB_PB_VARINT_MAX_LEN]; \
+    upb_decoderet r; \
+    memset(buf, 0xff, sizeof(buf)); \
+    memcpy(buf, bytes, n); \
+    r = decoder(buf); \
+    ASSERT(r.val == expected_val); \
+    ASSERT(r.p == buf + n); \
+  }
+
+  uint64_t num;
+
+  char twelvebyte[16] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1};
+  const char *twelvebyte_buf = twelvebyte;
+  /* A varint that terminates before hitting the end of the provided buffer,
+   * but in too many bytes (11 instead of 10). */
+  upb_decoderet r = decoder(twelvebyte_buf);
+  ASSERT(r.p == NULL);
+
+  TEST("\x00",                                                      0ULL);
+  TEST("\x01",                                                      1ULL);
+  TEST("\x81\x14",                                              0xa01ULL);
+  TEST("\x81\x03",                                              0x181ULL);
+  TEST("\x81\x83\x07",                                        0x1c181ULL);
+  TEST("\x81\x83\x87\x0f",                                  0x1e1c181ULL);
+  TEST("\x81\x83\x87\x8f\x1f",                            0x1f1e1c181ULL);
+  TEST("\x81\x83\x87\x8f\x9f\x3f",                      0x1f9f1e1c181ULL);
+  TEST("\x81\x83\x87\x8f\x9f\xbf\x7f",                0x1fdf9f1e1c181ULL);
+  TEST("\x81\x83\x87\x8f\x9f\xbf\xff\x01",            0x3fdf9f1e1c181ULL);
+  TEST("\x81\x83\x87\x8f\x9f\xbf\xff\x81\x03",      0x303fdf9f1e1c181ULL);
+  TEST("\x81\x83\x87\x8f\x9f\xbf\xff\x81\x83\x07", 0x8303fdf9f1e1c181ULL);
+#undef TEST
+
+  for (num = 5; num * 1.5 < UINT64_MAX; num *= 1.5) {
+    test_varint_for_num(decoder, num);
+  }
+  test_varint_for_num(decoder, 0);
+}
+
+
+#define TEST_VARINT_DECODER(decoder) \
+  /* Create non-inline versions for convenient inspection of assembly language \
+   * output. */ \
+  upb_decoderet _upb_vdecode_ ## decoder(const char *p) { \
+    return upb_vdecode_ ## decoder(p); \
+  } \
+  void test_ ## decoder(void) { \
+    test_varint_decoder(&_upb_vdecode_ ## decoder); \
+  } \
+
+TEST_VARINT_DECODER(check2_branch32)
+TEST_VARINT_DECODER(check2_branch64)
+
+int run_tests(int argc, char *argv[]) {
+  UPB_UNUSED(argc);
+  UPB_UNUSED(argv);
+  test_check2_branch32();
+  test_check2_branch64();
+  return 0;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/tests/test_util.h b/legacy-libs/grpc/deps/grpc/third_party/upb/tests/test_util.h
new file mode 100644 (file)
index 0000000..4854100
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+** Common functionality for tests.
+**/
+
+#ifndef UPB_TEST_UTIL_H_
+#define UPB_TEST_UTIL_H_
+
+#include <stdio.h>
+#include <math.h>
+#include "tests/upb_test.h"
+#include "upb/sink.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+
+upb_bufhandle global_handle;
+
+/* A convenience class for parser tests.  Provides some useful features:
+ *
+ *   - can support multiple calls to parse, to test the parser's handling
+ *     of buffer seams.
+ *
+ *   - can output verbose output about each parse call when requested, for
+ *     ease of debugging.
+ *
+ *   - can pass NULL for skipped regions of the input if requested.
+ *
+ *   - allocates and passes a separate buffer for each parsed region, to
+ *     ensure that the parser is not erroneously overreading its buffer.
+ */
+class VerboseParserEnvironment {
+ public:
+  /* Pass verbose=true to print detailed diagnostics to stderr. */
+  VerboseParserEnvironment(bool verbose) : verbose_(verbose) {}
+
+  void Reset(const char *buf, size_t len, bool may_skip, bool expect_error) {
+    buf_ = buf;
+    len_ = len;
+    ofs_ = 0;
+    expect_error_ = expect_error;
+    end_ok_set_ = false;
+    skip_until_ = may_skip ? 0 : -1;
+    skipped_with_null_ = false;
+  }
+
+  /* The user should call a series of:
+   *
+   * Reset(buf, len, may_skip);
+   * Start()
+   * ParseBuffer(X);
+   * ParseBuffer(Y);
+   * // Repeat ParseBuffer as desired, but last call should pass -1.
+   * ParseBuffer(-1);
+   * End();
+   */
+
+
+  bool Start() {
+    if (verbose_) {
+      fprintf(stderr, "Calling start()\n");
+    }
+    return sink_.Start(len_, &subc_);
+  }
+
+  bool End() {
+    if (verbose_) {
+      fprintf(stderr, "Calling end()\n");
+    }
+    end_ok_ = sink_.End();
+    end_ok_set_ = true;
+
+    return end_ok_;
+  }
+
+  bool CheckConsistency() {
+    /* If we called end (which we should only do when previous bytes are fully
+     * accepted), then end() should return true iff there were no errors. */
+    if (end_ok_set_ && end_ok_ != status_.ok()) {
+      fprintf(stderr, "End() status and saw_error didn't match.\n");
+      return false;
+    }
+
+    if (expect_error_ && status_.ok()) {
+      fprintf(stderr, "Expected error but saw none.\n");
+      return false;
+    }
+
+    if (!status_.ok()) {
+      if (expect_error_ && verbose_) {
+        fprintf(stderr, "Encountered error, as expected: %s",
+                status_.error_message());
+      } else if (!expect_error_) {
+        fprintf(stderr, "Encountered unexpected error: %s",
+                status_.error_message());
+        return false;
+      }
+    }
+
+    return true;
+  }
+
+  bool ParseBuffer(int bytes) {
+    if (bytes < 0) {
+      bytes = len_ - ofs_;
+    }
+
+    ASSERT((size_t)bytes <= (len_ - ofs_));
+
+    /* Copy buffer into a separate, temporary buffer.
+     * This is necessary to verify that the parser is not erroneously
+     * reading outside the specified bounds. */
+    char *buf2 = NULL;
+
+    if ((int)(ofs_ + bytes) <= skip_until_) {
+      skipped_with_null_ = true;
+    } else {
+      buf2 = (char*)malloc(bytes);
+      UPB_ASSERT(buf2);
+      memcpy(buf2, buf_ + ofs_, bytes);
+    }
+
+    if (buf2 == NULL && bytes == 0) {
+      /* Decoders dont' support buf=NULL, bytes=0. */
+      return true;
+    }
+
+    if (verbose_) {
+      fprintf(stderr, "Calling parse(%u) for bytes %u-%u of the input\n",
+              (unsigned)bytes, (unsigned)ofs_, (unsigned)(ofs_ + bytes));
+    }
+
+    int parsed = sink_.PutBuffer(subc_, buf2, bytes, &global_handle);
+    free(buf2);
+
+    if (verbose_) {
+      if (parsed == bytes) {
+        fprintf(stderr,
+                "parse(%u) = %u, complete byte count indicates success\n",
+                (unsigned)bytes, (unsigned)bytes);
+      } else if (parsed > bytes) {
+        fprintf(stderr,
+                "parse(%u) = %u, long byte count indicates success and skip "
+                "of the next %u bytes\n",
+                (unsigned)bytes, (unsigned)parsed, (unsigned)(parsed - bytes));
+      } else {
+        fprintf(stderr,
+                "parse(%u) = %u, short byte count indicates failure; "
+                "last %u bytes were not consumed\n",
+                (unsigned)bytes, (unsigned)parsed, (unsigned)(bytes - parsed));
+      }
+    }
+
+    if (!status_.ok()) {
+      return false;
+    }
+
+    if (parsed > bytes && skip_until_ >= 0) {
+      skip_until_ = ofs_ + parsed;
+    }
+
+    ofs_ += UPB_MIN(parsed, bytes);
+
+    return true;
+  }
+
+  void ResetBytesSink(upb::BytesSink sink) {
+    sink_ = sink;
+  }
+
+  size_t ofs() { return ofs_; }
+
+  bool SkippedWithNull() { return skipped_with_null_; }
+
+  upb::Arena* arena() { return &arena_; }
+  upb::Status* status() { return &status_; }
+
+ private:
+  upb::Arena arena_;
+  upb::Status status_;
+  upb::BytesSink sink_;
+  const char* buf_;
+  size_t len_;
+  bool verbose_;
+  size_t ofs_;
+  void *subc_;
+  bool expect_error_;
+  bool end_ok_;
+  bool end_ok_set_;
+
+  /* When our parse call returns a value greater than the number of bytes
+   * we passed in, the decoder is indicating to us that the next N bytes
+   * in the stream are not needed and can be skipped.  The user is allowed
+   * to pass a NULL buffer for those N bytes.
+   *
+   * skip_until_ is initially set to 0 if we should do this NULL-buffer
+   * skipping or -1 if we should not.  If we are open to doing NULL-buffer
+   * skipping and we get an opportunity to do it, we set skip_until to the
+   * stream offset where we can skip until.  The user can then test whether
+   * this happened by testing SkippedWithNull(). */
+  int skip_until_;
+  bool skipped_with_null_;
+};
+
+#endif  /* __cplusplus */
+
+UPB_INLINE char *upb_readfile(const char *filename, size_t *len) {
+  long size;
+  char *buf;
+  FILE *f = fopen(filename, "rb");
+  if(!f) return NULL;
+  if(fseek(f, 0, SEEK_END) != 0) goto error;
+  size = ftell(f);
+  if(size < 0) goto error;
+  if(fseek(f, 0, SEEK_SET) != 0) goto error;
+  buf = (char*)malloc(size + 1);
+  if(size && fread(buf, size, 1, f) != 1) goto error;
+  fclose(f);
+  if (len) *len = size;
+  buf[size] = '\0';
+  return buf;
+
+error:
+  fclose(f);
+  return NULL;
+}
+
+#include "upb/port_undef.inc"
+
+#endif /* UPB_TEST_UTIL_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/tests/upb_test.h b/legacy-libs/grpc/deps/grpc/third_party/upb/tests/upb_test.h
new file mode 100644 (file)
index 0000000..d4b0688
--- /dev/null
@@ -0,0 +1,53 @@
+
+#ifndef UPB_TEST_H_
+#define UPB_TEST_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int num_assertions = 0;
+uint32_t testhash = 0;
+
+#define PRINT_FAILURE(expr) \
+  fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \
+  fprintf(stderr, "expr: %s\n", #expr); \
+  if (testhash) { \
+    fprintf(stderr, "assertion failed running test %x.  " \
+                    "Run with the arg %x to run only this test.\n", \
+                    testhash, testhash); \
+  }
+
+#define ASSERT(expr) do { \
+  ++num_assertions; \
+  if (!(expr)) { \
+    PRINT_FAILURE(expr) \
+    abort(); \
+  } \
+} while (0)
+
+#define ASSERT_NOCOUNT(expr) do { \
+  if (!(expr)) { \
+    PRINT_FAILURE(expr) \
+    abort(); \
+  } \
+} while (0)
+
+#define ASSERT_STATUS(expr, status) do { \
+  ++num_assertions; \
+  if (!(expr)) { \
+    PRINT_FAILURE(expr) \
+    fprintf(stderr, "failed status: %s\n", upb_status_errmsg(status)); \
+    abort(); \
+  } \
+} while (0)
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif  /* UPB_DECODER_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/third_party/lunit/LICENSE b/legacy-libs/grpc/deps/grpc/third_party/upb/third_party/lunit/LICENSE
new file mode 100644 (file)
index 0000000..fb720fe
--- /dev/null
@@ -0,0 +1,32 @@
+
+Lunit License
+-------------
+
+Lunit is written by Michael Roth <mroth@nessie.de> and is licensed
+under the terms of the MIT license reproduced below.
+
+========================================================================
+
+Copyright (c) 2004-2010 Michael Roth <mroth@nessie.de>
+
+Permission is hereby granted, free of charge, to any person 
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be 
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+========================================================================
+
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/third_party/lunit/README.google b/legacy-libs/grpc/deps/grpc/third_party/upb/third_party/lunit/README.google
new file mode 100644 (file)
index 0000000..af3e50e
--- /dev/null
@@ -0,0 +1,9 @@
+URL: https://github.com/dcurrie/lunit
+Version: 0.5
+License: MIT
+License File: LICENSE
+Description:
+A unit testing library for Lua.
+
+Local Modifications:
+Extracted the two file we actually need from the distribution.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/README b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/README
new file mode 100644 (file)
index 0000000..3e176c9
--- /dev/null
@@ -0,0 +1,5 @@
+This directory contains code that interfaces upb with external C/C++
+libraries.  Right now this is:
+
+ * upb/bindings/lua:
+     a Lua extension that exposes upb to Lua programs via the Lua C API.
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/def.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/def.c
new file mode 100644 (file)
index 0000000..a9ab9a8
--- /dev/null
@@ -0,0 +1,766 @@
+
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include "lauxlib.h"
+#include "upb/bindings/lua/upb.h"
+#include "upb/def.h"
+
+#define LUPB_ENUMDEF "lupb.enumdef"
+#define LUPB_FIELDDEF "lupb.fielddef"
+#define LUPB_FILEDEF "lupb.filedef"
+#define LUPB_MSGDEF "lupb.msgdef"
+#define LUPB_ONEOFDEF "lupb.oneof"
+#define LUPB_SYMTAB "lupb.symtab"
+#define LUPB_OBJCACHE "lupb.objcache"
+
+#define CHK(pred)                 \
+  do {                            \
+    upb_status status;            \
+    upb_status_clear(&status);    \
+    pred;                         \
+    lupb_checkstatus(L, &status); \
+  } while (0)
+
+/* lupb_wrapper ***************************************************************/
+
+/* Wrappers around upb objects. */
+
+/* Checks type; if it matches, pulls the pointer out of the wrapper. */
+void *lupb_checkwrapper(lua_State *L, int narg, const char *type) {
+  void *ud = lua_touserdata(L, narg);
+  void *ret;
+
+  if (!ud) {
+    luaL_typerror(L, narg, "upb wrapper");
+  }
+
+  memcpy(&ret, ud, sizeof(ret));
+  if (!ret) {
+    luaL_error(L, "called into dead object");
+  }
+
+  luaL_checkudata(L, narg, type);
+  return ret;
+}
+
+void lupb_pushwrapper(lua_State *L, const void *obj, const char *type) {
+  void *ud;
+
+  if (obj == NULL) {
+    lua_pushnil(L);
+    return;
+  }
+
+  /* Lookup our cache in the registry (we don't put our objects in the registry
+   * directly because we need our cache to be a weak table). */
+  lua_getfield(L, LUA_REGISTRYINDEX, LUPB_OBJCACHE);
+  UPB_ASSERT(!lua_isnil(L, -1));  /* Should have been created by luaopen_upb. */
+  lua_pushlightuserdata(L, (void*)obj);
+  lua_rawget(L, -2);
+  /* Stack is now: objcache, cached value. */
+
+  if (lua_isnil(L, -1)) {
+    /* Remove bad cached value and push new value. */
+    lua_pop(L, 1);
+    ud = lua_newuserdata(L, sizeof(*ud));
+    memcpy(ud, &obj, sizeof(*ud));
+
+    luaL_getmetatable(L, type);
+    /* Should have been created by luaopen_upb. */
+    lupb_assert(L, !lua_isnil(L, -1));
+    lua_setmetatable(L, -2);
+
+    /* Set it in the cache. */
+    lua_pushlightuserdata(L, (void*)obj);
+    lua_pushvalue(L, -2);
+    lua_rawset(L, -4);
+  }
+
+  lua_insert(L, -2);
+  lua_pop(L, 1);
+}
+
+void lupb_msgdef_pushwrapper(lua_State *L, const upb_msgdef *m);
+void lupb_oneofdef_pushwrapper(lua_State *L, const upb_oneofdef *o);
+static void lupb_enumdef_pushwrapper(lua_State *L, const upb_enumdef *e);
+
+
+/* lupb_fielddef **************************************************************/
+
+void lupb_fielddef_pushwrapper(lua_State *L, const upb_fielddef *f) {
+  lupb_pushwrapper(L, f, LUPB_FIELDDEF);
+}
+
+const upb_fielddef *lupb_fielddef_check(lua_State *L, int narg) {
+  return lupb_checkwrapper(L, narg, LUPB_FIELDDEF);
+}
+
+static int lupb_fielddef_containingoneof(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lupb_oneofdef_pushwrapper(L, upb_fielddef_containingoneof(f));
+  return 1;
+}
+
+static int lupb_fielddef_containingtype(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lupb_msgdef_pushwrapper(L, upb_fielddef_containingtype(f));
+  return 1;
+}
+
+static int lupb_fielddef_default(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  switch (upb_fielddef_type(f)) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_ENUM:
+      lupb_pushint32(L, upb_fielddef_defaultint32(f)); break;
+    case UPB_TYPE_INT64:
+      lupb_pushint64(L, upb_fielddef_defaultint64(f)); break;
+    case UPB_TYPE_UINT32:
+      lupb_pushuint32(L, upb_fielddef_defaultuint32(f)); break;
+    case UPB_TYPE_UINT64:
+      lupb_pushuint64(L, upb_fielddef_defaultuint64(f)); break;
+    case UPB_TYPE_DOUBLE:
+      lua_pushnumber(L, upb_fielddef_defaultdouble(f)); break;
+    case UPB_TYPE_FLOAT:
+      lua_pushnumber(L, upb_fielddef_defaultfloat(f)); break;
+    case UPB_TYPE_BOOL:
+      lua_pushboolean(L, upb_fielddef_defaultbool(f)); break;
+    case UPB_TYPE_STRING:
+    case UPB_TYPE_BYTES: {
+      size_t len;
+      const char *data = upb_fielddef_defaultstr(f, &len);
+      lua_pushlstring(L, data, len);
+      break;
+    }
+    case UPB_TYPE_MESSAGE:
+      return luaL_error(L, "Message fields do not have explicit defaults.");
+  }
+  return 1;
+}
+
+static int lupb_fielddef_descriptortype(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushnumber(L, upb_fielddef_descriptortype(f));
+  return 1;
+}
+
+static int lupb_fielddef_getsel(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  upb_selector_t sel;
+  if (upb_handlers_getselector(f, luaL_checknumber(L, 2), &sel)) {
+    lua_pushinteger(L, sel);
+    return 1;
+  } else {
+    return 0;
+  }
+}
+
+static int lupb_fielddef_hassubdef(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushboolean(L, upb_fielddef_hassubdef(f));
+  return 1;
+}
+
+static int lupb_fielddef_index(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushinteger(L, upb_fielddef_index(f));
+  return 1;
+}
+
+static int lupb_fielddef_isextension(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushboolean(L, upb_fielddef_isextension(f));
+  return 1;
+}
+
+static int lupb_fielddef_label(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushinteger(L, upb_fielddef_label(f));
+  return 1;
+}
+
+static int lupb_fielddef_lazy(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushboolean(L, upb_fielddef_lazy(f));
+  return 1;
+}
+
+static int lupb_fielddef_name(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushstring(L, upb_fielddef_name(f));
+  return 1;
+}
+
+static int lupb_fielddef_number(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  int32_t num = upb_fielddef_number(f);
+  if (num)
+    lua_pushinteger(L, num);
+  else
+    lua_pushnil(L);
+  return 1;
+}
+
+static int lupb_fielddef_packed(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lua_pushboolean(L, upb_fielddef_packed(f));
+  return 1;
+}
+
+static int lupb_fielddef_msgsubdef(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lupb_msgdef_pushwrapper(L, upb_fielddef_msgsubdef(f));
+  return 1;
+}
+
+static int lupb_fielddef_enumsubdef(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  lupb_enumdef_pushwrapper(L, upb_fielddef_enumsubdef(f));
+  return 1;
+}
+
+static int lupb_fielddef_type(lua_State *L) {
+  const upb_fielddef *f = lupb_fielddef_check(L, 1);
+  if (upb_fielddef_typeisset(f))
+    lua_pushinteger(L, upb_fielddef_type(f));
+  else
+    lua_pushnil(L);
+  return 1;
+}
+
+static const struct luaL_Reg lupb_fielddef_m[] = {
+  {"containing_oneof", lupb_fielddef_containingoneof},
+  {"containing_type", lupb_fielddef_containingtype},
+  {"default", lupb_fielddef_default},
+  {"descriptor_type", lupb_fielddef_descriptortype},
+  {"getsel", lupb_fielddef_getsel},
+  {"has_subdef", lupb_fielddef_hassubdef},
+  {"index", lupb_fielddef_index},
+  {"is_extension", lupb_fielddef_isextension},
+  {"label", lupb_fielddef_label},
+  {"lazy", lupb_fielddef_lazy},
+  {"name", lupb_fielddef_name},
+  {"number", lupb_fielddef_number},
+  {"packed", lupb_fielddef_packed},
+  {"msgsubdef", lupb_fielddef_msgsubdef},
+  {"enumsubdef", lupb_fielddef_enumsubdef},
+  {"type", lupb_fielddef_type},
+  {NULL, NULL}
+};
+
+
+/* lupb_oneofdef **************************************************************/
+
+void lupb_oneofdef_pushwrapper(lua_State *L, const upb_oneofdef *o) {
+  lupb_pushwrapper(L, o, LUPB_ONEOFDEF);
+}
+
+const upb_oneofdef *lupb_oneofdef_check(lua_State *L, int narg) {
+  return lupb_checkwrapper(L, narg, LUPB_ONEOFDEF);
+}
+
+static int lupb_oneofdef_containingtype(lua_State *L) {
+  const upb_oneofdef *o = lupb_oneofdef_check(L, 1);
+  lupb_msgdef_pushwrapper(L, upb_oneofdef_containingtype(o));
+  return 1;
+}
+
+static int lupb_oneofdef_field(lua_State *L) {
+  const upb_oneofdef *o = lupb_oneofdef_check(L, 1);
+  int type = lua_type(L, 2);
+  const upb_fielddef *f;
+  if (type == LUA_TNUMBER) {
+    f = upb_oneofdef_itof(o, lua_tointeger(L, 2));
+  } else if (type == LUA_TSTRING) {
+    f = upb_oneofdef_ntofz(o, lua_tostring(L, 2));
+  } else {
+    const char *msg = lua_pushfstring(L, "number or string expected, got %s",
+                                      luaL_typename(L, 2));
+    return luaL_argerror(L, 2, msg);
+  }
+
+  lupb_fielddef_pushwrapper(L, f);
+  return 1;
+}
+
+static int lupb_oneofiter_next(lua_State *L) {
+  upb_oneof_iter *i = lua_touserdata(L, lua_upvalueindex(1));
+  if (upb_oneof_done(i)) return 0;
+  lupb_fielddef_pushwrapper(L, upb_oneof_iter_field(i));
+  upb_oneof_next(i);
+  return 1;
+}
+
+static int lupb_oneofdef_fields(lua_State *L) {
+  const upb_oneofdef *o = lupb_oneofdef_check(L, 1);
+  upb_oneof_iter *i = lua_newuserdata(L, sizeof(upb_oneof_iter));
+  upb_oneof_begin(i, o);
+  /* Need to guarantee that the msgdef outlives the iter. */
+  lua_pushvalue(L, 1);
+  lua_pushcclosure(L, &lupb_oneofiter_next, 2);
+  return 1;
+}
+
+static int lupb_oneofdef_len(lua_State *L) {
+  const upb_oneofdef *o = lupb_oneofdef_check(L, 1);
+  lua_pushinteger(L, upb_oneofdef_numfields(o));
+  return 1;
+}
+
+static int lupb_oneofdef_name(lua_State *L) {
+  const upb_oneofdef *o = lupb_oneofdef_check(L, 1);
+  lua_pushstring(L, upb_oneofdef_name(o));
+  return 1;
+}
+
+static const struct luaL_Reg lupb_oneofdef_m[] = {
+  {"containing_type", lupb_oneofdef_containingtype},
+  {"field", lupb_oneofdef_field},
+  {"fields", lupb_oneofdef_fields},
+  {"name", lupb_oneofdef_name},
+  {NULL, NULL}
+};
+
+static const struct luaL_Reg lupb_oneofdef_mm[] = {
+  {"__len", lupb_oneofdef_len},
+  {NULL, NULL}
+};
+
+
+/* lupb_msgdef ****************************************************************/
+
+typedef struct {
+  const upb_msgdef *md;
+} lupb_msgdef;
+
+void lupb_msgdef_pushwrapper(lua_State *L, const upb_msgdef *m) {
+  lupb_pushwrapper(L, m, LUPB_MSGDEF);
+}
+
+const upb_msgdef *lupb_msgdef_check(lua_State *L, int narg) {
+  return lupb_checkwrapper(L, narg, LUPB_MSGDEF);
+}
+
+static int lupb_msgdef_len(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  lua_pushinteger(L, upb_msgdef_numfields(m));
+  return 1;
+}
+
+static int lupb_msgdef_field(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  int type = lua_type(L, 2);
+  const upb_fielddef *f;
+  if (type == LUA_TNUMBER) {
+    f = upb_msgdef_itof(m, lua_tointeger(L, 2));
+  } else if (type == LUA_TSTRING) {
+    f = upb_msgdef_ntofz(m, lua_tostring(L, 2));
+  } else {
+    const char *msg = lua_pushfstring(L, "number or string expected, got %s",
+                                      luaL_typename(L, 2));
+    return luaL_argerror(L, 2, msg);
+  }
+
+  lupb_fielddef_pushwrapper(L, f);
+  return 1;
+}
+
+static int lupb_msgdef_lookupname(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  const upb_fielddef *f;
+  const upb_oneofdef *o;
+  if (!upb_msgdef_lookupnamez(m, lua_tostring(L, 2), &f, &o)) {
+    lua_pushnil(L);
+  } else if (o) {
+    lupb_oneofdef_pushwrapper(L, o);
+  } else {
+    lupb_fielddef_pushwrapper(L, f);
+  }
+  return 1;
+}
+
+static int lupb_msgfielditer_next(lua_State *L) {
+  upb_msg_field_iter *i = lua_touserdata(L, lua_upvalueindex(1));
+  if (upb_msg_field_done(i)) return 0;
+  lupb_fielddef_pushwrapper(L, upb_msg_iter_field(i));
+  upb_msg_field_next(i);
+  return 1;
+}
+
+static int lupb_msgdef_fields(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  upb_msg_field_iter *i = lua_newuserdata(L, sizeof(upb_msg_field_iter));
+  upb_msg_field_begin(i, m);
+  /* Need to guarantee that the msgdef outlives the iter. */
+  lua_pushvalue(L, 1);
+  lua_pushcclosure(L, &lupb_msgfielditer_next, 2);
+  return 1;
+}
+
+static int lupb_msgoneofiter_next(lua_State *L) {
+  upb_msg_oneof_iter *i = lua_touserdata(L, lua_upvalueindex(1));
+  if (upb_msg_oneof_done(i)) return 0;
+  lupb_oneofdef_pushwrapper(L, upb_msg_iter_oneof(i));
+  upb_msg_oneof_next(i);
+  return 1;
+}
+
+static int lupb_msgdef_oneofs(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  upb_msg_oneof_iter *i = lua_newuserdata(L, sizeof(upb_msg_oneof_iter));
+  upb_msg_oneof_begin(i, m);
+  /* Need to guarantee that the msgdef outlives the iter. */
+  lua_pushvalue(L, 1);
+  lua_pushcclosure(L, &lupb_msgoneofiter_next, 2);
+  return 1;
+}
+
+static int lupb_msgdef_mapentry(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  lua_pushboolean(L, upb_msgdef_mapentry(m));
+  return 1;
+}
+
+static int lupb_msgdef_syntax(lua_State *L) {
+  const upb_msgdef *m = lupb_msgdef_check(L, 1);
+  lua_pushinteger(L, upb_msgdef_syntax(m));
+  return 1;
+}
+
+static const struct luaL_Reg lupb_msgdef_mm[] = {
+  {"__len", lupb_msgdef_len},
+  {NULL, NULL}
+};
+
+static const struct luaL_Reg lupb_msgdef_m[] = {
+  {"field", lupb_msgdef_field},
+  {"fields", lupb_msgdef_fields},
+  {"lookup_name", lupb_msgdef_lookupname},
+  {"oneofs", lupb_msgdef_oneofs},
+  {"syntax", lupb_msgdef_syntax},
+  {"_map_entry", lupb_msgdef_mapentry},
+  {NULL, NULL}
+};
+
+
+/* lupb_enumdef ***************************************************************/
+
+const upb_enumdef *lupb_enumdef_check(lua_State *L, int narg) {
+  return lupb_checkwrapper(L, narg, LUPB_ENUMDEF);
+}
+
+static void lupb_enumdef_pushwrapper(lua_State *L, const upb_enumdef *e) {
+  lupb_pushwrapper(L, e, LUPB_ENUMDEF);
+}
+
+static int lupb_enumdef_len(lua_State *L) {
+  const upb_enumdef *e = lupb_enumdef_check(L, 1);
+  lua_pushinteger(L, upb_enumdef_numvals(e));
+  return 1;
+}
+
+static int lupb_enumdef_value(lua_State *L) {
+  const upb_enumdef *e = lupb_enumdef_check(L, 1);
+  int type = lua_type(L, 2);
+  if (type == LUA_TNUMBER) {
+    /* Pushes "nil" for a NULL pointer. */
+    int32_t key = lupb_checkint32(L, 2);
+    lua_pushstring(L, upb_enumdef_iton(e, key));
+  } else if (type == LUA_TSTRING) {
+    const char *key = lua_tostring(L, 2);
+    int32_t num;
+    if (upb_enumdef_ntoiz(e, key, &num)) {
+      lua_pushinteger(L, num);
+    } else {
+      lua_pushnil(L);
+    }
+  } else {
+    const char *msg = lua_pushfstring(L, "number or string expected, got %s",
+                                      luaL_typename(L, 2));
+    return luaL_argerror(L, 2, msg);
+  }
+  return 1;
+}
+
+static int lupb_enumiter_next(lua_State *L) {
+  upb_enum_iter *i = lua_touserdata(L, lua_upvalueindex(1));
+  if (upb_enum_done(i)) return 0;
+  lua_pushstring(L, upb_enum_iter_name(i));
+  lua_pushinteger(L, upb_enum_iter_number(i));
+  upb_enum_next(i);
+  return 2;
+}
+
+static int lupb_enumdef_values(lua_State *L) {
+  const upb_enumdef *e = lupb_enumdef_check(L, 1);
+  upb_enum_iter *i = lua_newuserdata(L, sizeof(upb_enum_iter));
+  upb_enum_begin(i, e);
+  /* Need to guarantee that the enumdef outlives the iter. */
+  lua_pushvalue(L, 1);
+  lua_pushcclosure(L, &lupb_enumiter_next, 2);
+  return 1;
+}
+
+static const struct luaL_Reg lupb_enumdef_mm[] = {
+  {"__len", lupb_enumdef_len},
+  {NULL, NULL}
+};
+
+static const struct luaL_Reg lupb_enumdef_m[] = {
+  {"value", lupb_enumdef_value},
+  {"values", lupb_enumdef_values},
+  {NULL, NULL}
+};
+
+
+/* lupb_filedef ***************************************************************/
+
+void lupb_filedef_pushwrapper(lua_State *L, const upb_filedef *f) {
+  lupb_pushwrapper(L, f, LUPB_FILEDEF);
+}
+
+const upb_filedef *lupb_filedef_check(lua_State *L, int narg) {
+  return lupb_checkwrapper(L, narg, LUPB_FILEDEF);
+}
+
+static int lupb_filedef_dep(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  int index = luaL_checkint(L, 2);
+  lupb_filedef_pushwrapper(L, upb_filedef_dep(f, index));
+  return 1;
+}
+
+static int lupb_filedef_depcount(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  lua_pushnumber(L, upb_filedef_depcount(f));
+  return 1;
+}
+
+static int lupb_filedef_enum(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  int index = luaL_checkint(L, 2);
+  lupb_enumdef_pushwrapper(L, upb_filedef_enum(f, index));
+  return 1;
+}
+
+static int lupb_filedef_enumcount(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  lua_pushnumber(L, upb_filedef_enumcount(f));
+  return 1;
+}
+
+static int lupb_filedef_msg(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  int index = luaL_checkint(L, 2);
+  lupb_msgdef_pushwrapper(L, upb_filedef_msg(f, index));
+  return 1;
+}
+
+static int lupb_filedef_msgcount(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  lua_pushnumber(L, upb_filedef_msgcount(f));
+  return 1;
+}
+
+static int lupb_filedef_name(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  lua_pushstring(L, upb_filedef_name(f));
+  return 1;
+}
+
+static int lupb_filedef_package(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  lua_pushstring(L, upb_filedef_package(f));
+  return 1;
+}
+
+static int lupb_filedef_syntax(lua_State *L) {
+  const upb_filedef *f = lupb_filedef_check(L, 1);
+  lua_pushnumber(L, upb_filedef_syntax(f));
+  return 1;
+}
+
+static const struct luaL_Reg lupb_filedef_m[] = {
+  {"dep", lupb_filedef_dep},
+  {"depcount", lupb_filedef_depcount},
+  {"enum", lupb_filedef_enum},
+  {"enumcount", lupb_filedef_enumcount},
+  {"msg", lupb_filedef_msg},
+  {"msgcount", lupb_filedef_msgcount},
+  {"name", lupb_filedef_name},
+  {"package", lupb_filedef_package},
+  {"syntax", lupb_filedef_syntax},
+  {NULL, NULL}
+};
+
+
+/* lupb_symtab ****************************************************************/
+
+typedef struct {
+  upb_symtab *symtab;
+} lupb_symtab;
+
+upb_symtab *lupb_symtab_check(lua_State *L, int narg) {
+  lupb_symtab *lsymtab = luaL_checkudata(L, narg, LUPB_SYMTAB);
+  if (!lsymtab->symtab) {
+    luaL_error(L, "called into dead object");
+  }
+  return lsymtab->symtab;
+}
+
+static int lupb_symtab_new(lua_State *L) {
+  lupb_symtab *lsymtab = lua_newuserdata(L, sizeof(*lsymtab));
+  lsymtab->symtab = upb_symtab_new();
+  luaL_getmetatable(L, LUPB_SYMTAB);
+  lua_setmetatable(L, -2);
+  return 1;
+}
+
+static int lupb_symtab_gc(lua_State *L) {
+  lupb_symtab *lsymtab = luaL_checkudata(L, 1, LUPB_SYMTAB);
+  upb_symtab_free(lsymtab->symtab);
+  lsymtab->symtab = NULL;
+  return 0;
+}
+
+/* TODO(haberman): perhaps this should take a message object instead of a
+ * serialized string once we have a good story for vending compiled-in
+ * messages. */
+static int lupb_symtab_add(lua_State *L) {
+  upb_arena *arena;
+  size_t i, n, len;
+  const google_protobuf_FileDescriptorProto *const *files;
+  google_protobuf_FileDescriptorSet *set;
+  upb_symtab *s = lupb_symtab_check(L, 1);
+  const char *str = luaL_checklstring(L, 2, &len);
+
+  lupb_arena_new(L);
+  arena = lupb_arena_check(L, -1);
+
+  set = google_protobuf_FileDescriptorSet_parse(str, len, arena);
+
+  if (!set) {
+    luaL_argerror(L, 2, "failed to parse descriptor");
+  }
+
+  files = google_protobuf_FileDescriptorSet_file(set, &n);
+  for (i = 0; i < n; i++) {
+    CHK(upb_symtab_addfile(s, files[i], &status));
+  }
+
+  return 0;
+}
+
+static int lupb_symtab_lookupmsg(lua_State *L) {
+  const upb_symtab *s = lupb_symtab_check(L, 1);
+  const upb_msgdef *m = upb_symtab_lookupmsg(s, luaL_checkstring(L, 2));
+  lupb_msgdef_pushwrapper(L, m);
+  return 1;
+}
+
+static int lupb_symtab_lookupenum(lua_State *L) {
+  const upb_symtab *s = lupb_symtab_check(L, 1);
+  const upb_enumdef *e = upb_symtab_lookupenum(s, luaL_checkstring(L, 2));
+  lupb_enumdef_pushwrapper(L, e);
+  return 1;
+}
+
+static const struct luaL_Reg lupb_symtab_m[] = {
+  {"add", lupb_symtab_add},
+  {"lookup_msg", lupb_symtab_lookupmsg},
+  {"lookup_enum", lupb_symtab_lookupenum},
+  {NULL, NULL}
+};
+
+static const struct luaL_Reg lupb_symtab_mm[] = {
+  {"__gc", lupb_symtab_gc},
+  {NULL, NULL}
+};
+
+/* lupb toplevel **************************************************************/
+
+static void lupb_setfieldi(lua_State *L, const char *field, int i) {
+  lua_pushinteger(L, i);
+  lua_setfield(L, -2, field);
+}
+
+static const struct luaL_Reg lupbdef_toplevel_m[] = {
+  {"SymbolTable", lupb_symtab_new},
+  {NULL, NULL}
+};
+
+void lupb_def_registertypes(lua_State *L) {
+  lupb_setfuncs(L, lupbdef_toplevel_m);
+
+  /* Refcounted types. */
+  lupb_register_type(L, LUPB_ENUMDEF,  lupb_enumdef_m,  lupb_enumdef_mm);
+  lupb_register_type(L, LUPB_FIELDDEF, lupb_fielddef_m, NULL);
+  lupb_register_type(L, LUPB_FILEDEF,  lupb_filedef_m,  NULL);
+  lupb_register_type(L, LUPB_MSGDEF,   lupb_msgdef_m,   lupb_msgdef_mm);
+  lupb_register_type(L, LUPB_ONEOFDEF, lupb_oneofdef_m, lupb_oneofdef_mm);
+  lupb_register_type(L, LUPB_SYMTAB,   lupb_symtab_m,   lupb_symtab_mm);
+
+  /* Create our object cache. */
+  lua_newtable(L);
+  lua_createtable(L, 0, 1);  /* Cache metatable. */
+  lua_pushstring(L, "v");    /* Values are weak. */
+  lua_setfield(L, -2, "__mode");
+  lua_setmetatable(L, -2);
+  lua_setfield(L, LUA_REGISTRYINDEX, LUPB_OBJCACHE);
+
+  /* Register constants. */
+  lupb_setfieldi(L, "LABEL_OPTIONAL", UPB_LABEL_OPTIONAL);
+  lupb_setfieldi(L, "LABEL_REQUIRED", UPB_LABEL_REQUIRED);
+  lupb_setfieldi(L, "LABEL_REPEATED", UPB_LABEL_REPEATED);
+
+  lupb_setfieldi(L, "TYPE_DOUBLE",    UPB_TYPE_DOUBLE);
+  lupb_setfieldi(L, "TYPE_FLOAT",     UPB_TYPE_FLOAT);
+  lupb_setfieldi(L, "TYPE_INT64",     UPB_TYPE_INT64);
+  lupb_setfieldi(L, "TYPE_UINT64",    UPB_TYPE_UINT64);
+  lupb_setfieldi(L, "TYPE_INT32",     UPB_TYPE_INT32);
+  lupb_setfieldi(L, "TYPE_BOOL",      UPB_TYPE_BOOL);
+  lupb_setfieldi(L, "TYPE_STRING",    UPB_TYPE_STRING);
+  lupb_setfieldi(L, "TYPE_MESSAGE",   UPB_TYPE_MESSAGE);
+  lupb_setfieldi(L, "TYPE_BYTES",     UPB_TYPE_BYTES);
+  lupb_setfieldi(L, "TYPE_UINT32",    UPB_TYPE_UINT32);
+  lupb_setfieldi(L, "TYPE_ENUM",      UPB_TYPE_ENUM);
+
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_DOUBLE",    UPB_DESCRIPTOR_TYPE_DOUBLE);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_FLOAT",     UPB_DESCRIPTOR_TYPE_FLOAT);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_INT64",     UPB_DESCRIPTOR_TYPE_INT64);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_UINT64",    UPB_DESCRIPTOR_TYPE_UINT64);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_INT32",     UPB_DESCRIPTOR_TYPE_INT32);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_FIXED64",   UPB_DESCRIPTOR_TYPE_FIXED64);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_FIXED32",   UPB_DESCRIPTOR_TYPE_FIXED32);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_BOOL",      UPB_DESCRIPTOR_TYPE_BOOL);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_STRING",    UPB_DESCRIPTOR_TYPE_STRING);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_GROUP",     UPB_DESCRIPTOR_TYPE_GROUP);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_MESSAGE",   UPB_DESCRIPTOR_TYPE_MESSAGE);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_BYTES",     UPB_DESCRIPTOR_TYPE_BYTES);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_UINT32",    UPB_DESCRIPTOR_TYPE_UINT32);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_ENUM",      UPB_DESCRIPTOR_TYPE_ENUM);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_SFIXED32",  UPB_DESCRIPTOR_TYPE_SFIXED32);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_SFIXED64",  UPB_DESCRIPTOR_TYPE_SFIXED64);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_SINT32",    UPB_DESCRIPTOR_TYPE_SINT32);
+  lupb_setfieldi(L, "DESCRIPTOR_TYPE_SINT64",    UPB_DESCRIPTOR_TYPE_SINT64);
+
+  lupb_setfieldi(L, "HANDLER_INT32",       UPB_HANDLER_INT32);
+  lupb_setfieldi(L, "HANDLER_INT64",       UPB_HANDLER_INT64);
+  lupb_setfieldi(L, "HANDLER_UINT32",      UPB_HANDLER_UINT32);
+  lupb_setfieldi(L, "HANDLER_UINT64",      UPB_HANDLER_UINT64);
+  lupb_setfieldi(L, "HANDLER_FLOAT",       UPB_HANDLER_FLOAT);
+  lupb_setfieldi(L, "HANDLER_DOUBLE",      UPB_HANDLER_DOUBLE);
+  lupb_setfieldi(L, "HANDLER_BOOL",        UPB_HANDLER_BOOL);
+  lupb_setfieldi(L, "HANDLER_STARTSTR",    UPB_HANDLER_STARTSTR);
+  lupb_setfieldi(L, "HANDLER_STRING",      UPB_HANDLER_STRING);
+  lupb_setfieldi(L, "HANDLER_ENDSTR",      UPB_HANDLER_ENDSTR);
+  lupb_setfieldi(L, "HANDLER_STARTSUBMSG", UPB_HANDLER_STARTSUBMSG);
+  lupb_setfieldi(L, "HANDLER_ENDSUBMSG",   UPB_HANDLER_ENDSUBMSG);
+  lupb_setfieldi(L, "HANDLER_STARTSEQ",    UPB_HANDLER_STARTSEQ);
+  lupb_setfieldi(L, "HANDLER_ENDSEQ",      UPB_HANDLER_ENDSEQ);
+
+  lupb_setfieldi(L, "SYNTAX_PROTO2",  UPB_SYNTAX_PROTO2);
+  lupb_setfieldi(L, "SYNTAX_PROTO3",  UPB_SYNTAX_PROTO3);
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/msg.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/msg.c
new file mode 100644 (file)
index 0000000..5e769b2
--- /dev/null
@@ -0,0 +1,1060 @@
+/*
+** lupb_msg -- Message/Array/Map objects in Lua/C that wrap upb/msg.h
+*/
+
+#include <float.h>
+#include <math.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lauxlib.h"
+#include "upb/bindings/lua/upb.h"
+#include "upb/handlers.h"
+#include "upb/legacy_msg_reflection.h"
+#include "upb/msg.h"
+
+#include "upb/port_def.inc"
+
+/*
+ * Message/Array/Map objects can be constructed in one of two ways:
+ *
+ * 1. To point to existing msg/array/map data inside an arena.
+ * 2. To create and uniquely own some brand new data.
+ *
+ * Case (1) is for when we've parsed some data into an arena (which is faster
+ * than parsing directly into Lua objects) or when we're pointing at some
+ * read-only data (like custom options in a def).
+ *
+ * Case (2) is for when a user creates the object directly in Lua.
+ *
+ * We use the userval of container objects (Message/Array/Map) to store
+ * references to sub-objects (Strings/Messages/Arrays/Maps).  But we need to
+ * keep the userval in sync with the underlying upb_msg/upb_array/upb_map.
+ * We populate the userval lazily from the underlying data.
+ *
+ * This means that no one may remove/replace any String/Message/Array/Map
+ * field/entry in the underlying upb_{msg,array,map} behind our back.  It's ok
+ * for entries to be added or for primitives to be modified, but *replacing*
+ * sub-containers is not.
+ *
+ * Luckily parse/merge follow this rule.  However clear does not, so it's not
+ * safe to clear behind our back.
+ */
+
+#define LUPB_ARENA "lupb.arena"
+
+#define LUPB_MSGCLASS "lupb.msgclass"
+#define LUPB_MSGFACTORY "lupb.msgfactory"
+
+#define LUPB_ARRAY "lupb.array"
+#define LUPB_MAP "lupb.map"
+#define LUPB_MSG "lupb.msg"
+#define LUPB_STRING "lupb.string"
+
+static int lupb_msg_pushnew(lua_State *L, int narg);
+
+/* Lazily creates the uservalue if it doesn't exist. */
+static void lupb_getuservalue(lua_State *L, int index) {
+  lua_getuservalue(L, index);
+  if (lua_isnil(L, -1)) {
+    /* Lazily create and set userval. */
+    lua_pop(L, 1);  /* nil. */
+    lua_pushvalue(L, index); /* userdata copy. */
+    lua_newtable(L);
+    lua_setuservalue(L, -2);
+    lua_pop(L, 1);  /* userdata copy. */
+    lua_getuservalue(L, index);
+  }
+  assert(!lua_isnil(L, -1));
+}
+
+static void lupb_uservalseti(lua_State *L, int userdata, int index, int val) {
+  lupb_getuservalue(L, userdata);
+  lua_pushvalue(L, val);
+  lua_rawseti(L, -2, index);
+  lua_pop(L, 1);  /* Uservalue. */
+}
+
+static void lupb_uservalgeti(lua_State *L, int userdata, int index) {
+  lupb_getuservalue(L, userdata);
+  lua_rawgeti(L, -1, index);
+  lua_insert(L, -2);
+  lua_pop(L, 1);  /* Uservalue. */
+}
+
+/* Pushes a new userdata with the given metatable. */
+static void *lupb_newuserdata(lua_State *L, size_t size, const char *type) {
+  void *ret = lua_newuserdata(L, size);
+
+  /* Set metatable. */
+  luaL_getmetatable(L, type);
+  UPB_ASSERT(!lua_isnil(L, -1));  /* Should have been created by luaopen_upb. */
+  lua_setmetatable(L, -2);
+
+  /* We don't set a uservalue here -- we lazily create it later if necessary. */
+
+  return ret;
+}
+
+
+/* lupb_arena *****************************************************************/
+
+/* lupb_arena only exists to wrap a upb_arena.  It is never exposed to users;
+ * it is an internal memory management detail.  Other objects refer to this
+ * object from their userdata to keep the arena-owned data alive. */
+
+typedef struct {
+  upb_arena *arena;
+} lupb_arena;
+
+upb_arena *lupb_arena_check(lua_State *L, int narg) {
+  lupb_arena *a = luaL_checkudata(L, narg, LUPB_ARENA);
+  return a ? a->arena : NULL;
+}
+
+int lupb_arena_new(lua_State *L) {
+  lupb_arena *a = lupb_newuserdata(L, sizeof(lupb_arena), LUPB_ARENA);
+
+  /* TODO(haberman): use Lua alloc func as block allocator?  Would need to
+   * verify that all cases of upb_malloc in msg/table are longjmp-safe. */
+  a->arena = upb_arena_new();
+
+  return 1;
+}
+
+char lupb_arena_cache_key;
+
+/* Returns the global lupb_arena func that was created in our luaopen().
+ * Callers can be guaranteed that it will be alive as long as |L| is.
+ * TODO(haberman): we shouldn't use a global arena!  We should have
+ * one arena for a parse, or per independently-created message. */
+upb_arena *lupb_arena_get(lua_State *L) {
+  upb_arena *arena;
+
+  lua_pushlightuserdata(L, &lupb_arena_cache_key);
+  lua_gettable(L, LUA_REGISTRYINDEX);
+  arena = lua_touserdata(L, -1);
+  UPB_ASSERT(arena);
+  lua_pop(L, 1);
+
+  return arena;
+}
+
+static void lupb_arena_initsingleton(lua_State *L) {
+  lua_pushlightuserdata(L, &lupb_arena_cache_key);
+  lupb_arena_new(L);
+  lua_settable(L, LUA_REGISTRYINDEX);
+}
+
+static int lupb_arena_gc(lua_State *L) {
+  upb_arena *a = lupb_arena_check(L, 1);
+  upb_arena_free(a);
+  return 0;
+}
+
+static const struct luaL_Reg lupb_arena_mm[] = {
+  {"__gc", lupb_arena_gc},
+  {NULL, NULL}
+};
+
+
+/* lupb_msgfactory ************************************************************/
+
+/* Userval contains a map of:
+ *   [1] -> SymbolTable (to keep GC-reachable)
+ *   [const upb_msgdef*] -> [lupb_msgclass userdata]
+ */
+
+#define LUPB_MSGFACTORY_SYMTAB 1
+
+typedef struct lupb_msgfactory {
+  upb_msgfactory *factory;
+} lupb_msgfactory;
+
+static int lupb_msgclass_pushnew(lua_State *L, int factory,
+                                 const upb_msgdef *md);
+
+/* lupb_msgfactory helpers. */
+
+static lupb_msgfactory *lupb_msgfactory_check(lua_State *L, int narg) {
+  return luaL_checkudata(L, narg, LUPB_MSGFACTORY);
+}
+
+static void lupb_msgfactory_pushmsgclass(lua_State *L, int narg,
+                                         const upb_msgdef *md) {
+  lupb_getuservalue(L, narg);
+  lua_pushlightuserdata(L, (void*)md);
+  lua_rawget(L, -2);
+
+  if (lua_isnil(L, -1)) {
+    lua_pop(L, 1);
+    /* TODO: verify md is in symtab? */
+    lupb_msgclass_pushnew(L, narg, md);
+
+    /* Set in userval. */
+    lua_pushlightuserdata(L, (void*)md);
+    lua_pushvalue(L, -2);
+    lua_rawset(L, -4);
+  }
+}
+
+static int lupb_msgfactory_gc(lua_State *L) {
+  lupb_msgfactory *lfactory = lupb_msgfactory_check(L, 1);
+
+  if (lfactory->factory) {
+    upb_msgfactory_free(lfactory->factory);
+    lfactory->factory = NULL;
+  }
+
+  return 0;
+}
+
+/* lupb_msgfactory Public API. */
+
+/**
+ * lupb_msgfactory_new()
+ *
+ * Handles:
+ *   msgfactory = upb.MessageFactory(symtab)
+ *
+ * Creates a new, empty MessageFactory for the given SymbolTable.
+ * Message classes will be created on demand when the user calls
+ * msgfactory.get_message_class().
+ */
+static int lupb_msgfactory_new(lua_State *L) {
+  const upb_symtab *symtab = lupb_symtab_check(L, 1);
+
+  lupb_msgfactory *lmsgfactory =
+      lupb_newuserdata(L, sizeof(lupb_msgfactory), LUPB_MSGFACTORY);
+  lmsgfactory->factory = upb_msgfactory_new(symtab);
+  lupb_uservalseti(L, -1, LUPB_MSGFACTORY_SYMTAB, 1);
+
+  return 1;
+}
+
+/**
+ * lupb_msgfactory_getmsgclass()
+ *
+ * Handles:
+ *   MessageClass = factory.get_message_class(message_name)
+ */
+static int lupb_msgfactory_getmsgclass(lua_State *L) {
+  lupb_msgfactory *lfactory = lupb_msgfactory_check(L, 1);
+  const upb_symtab *symtab = upb_msgfactory_symtab(lfactory->factory);
+  const upb_msgdef *m = upb_symtab_lookupmsg(symtab, luaL_checkstring(L, 2));
+
+  if (!m) {
+    luaL_error(L, "No such message type: %s\n", lua_tostring(L, 2));
+  }
+
+  lupb_msgfactory_pushmsgclass(L, 1, m);
+
+  return 1;
+}
+
+static const struct luaL_Reg lupb_msgfactory_m[] = {
+  {"get_message_class", lupb_msgfactory_getmsgclass},
+  {NULL, NULL}
+};
+
+static const struct luaL_Reg lupb_msgfactory_mm[] = {
+  {"__gc", lupb_msgfactory_gc},
+  {NULL, NULL}
+};
+
+
+/* lupb_msgclass **************************************************************/
+
+/* Userval contains a map of:
+ *   [1] -> MessageFactory (to keep GC-reachable)
+ *   [const upb_msgdef*] -> [lupb_msgclass userdata]
+ */
+
+#define LUPB_MSGCLASS_FACTORY 1
+
+struct lupb_msgclass {
+  const upb_msglayout *layout;
+  const upb_msgdef *msgdef;
+  const lupb_msgfactory *lfactory;
+};
+
+/* Type-checks for assigning to a message field. */
+static upb_msgval lupb_array_typecheck(lua_State *L, int narg, int msg,
+                                       const upb_fielddef *f);
+static upb_msgval lupb_map_typecheck(lua_State *L, int narg, int msg,
+                                     const upb_fielddef *f);
+static const lupb_msgclass *lupb_msg_getsubmsgclass(lua_State *L, int narg,
+                                                    const upb_fielddef *f);
+static const lupb_msgclass *lupb_msg_msgclassfor(lua_State *L, int narg,
+                                                 const upb_msgdef *md);
+
+const lupb_msgclass *lupb_msgclass_check(lua_State *L, int narg) {
+  return luaL_checkudata(L, narg, LUPB_MSGCLASS);
+}
+
+const upb_msglayout *lupb_msgclass_getlayout(lua_State *L, int narg) {
+  return lupb_msgclass_check(L, narg)->layout;
+}
+
+const upb_msgdef *lupb_msgclass_getmsgdef(const lupb_msgclass *lmsgclass) {
+  return lmsgclass->msgdef;
+}
+
+upb_msgfactory *lupb_msgclass_getfactory(const lupb_msgclass *lmsgclass) {
+  return lmsgclass->lfactory->factory;
+}
+
+/**
+ * lupb_msgclass_typecheck()
+ *
+ * Verifies that the expected msgclass matches the actual.  If not, raises a Lua
+ * error.
+ */
+static void lupb_msgclass_typecheck(lua_State *L, const lupb_msgclass *expected,
+                                    const lupb_msgclass *actual) {
+  if (expected != actual) {
+    luaL_error(L, "Message had incorrect type, expected '%s', got '%s'",
+               upb_msgdef_fullname(expected->msgdef),
+               upb_msgdef_fullname(actual->msgdef));
+  }
+}
+
+static const lupb_msgclass *lupb_msgclass_msgclassfor(lua_State *L, int narg,
+                                                      const upb_msgdef *md) {
+  lupb_uservalgeti(L, narg, LUPB_MSGCLASS_FACTORY);
+  lupb_msgfactory_pushmsgclass(L, -1, md);
+  return lupb_msgclass_check(L, -1);
+}
+
+/**
+ * lupb_msgclass_getsubmsgclass()
+ *
+ * Given a MessageClass at index |narg| and the submessage field |f|, returns
+ * the message class for this field.
+ *
+ * Currently we do a hash table lookup for this.  If we wanted we could try to
+ * optimize this by caching these pointers in our msgclass, in an array indexed
+ * by field index.  We would still need to fall back to calling msgclassfor(),
+ * unless we wanted to eagerly create message classes for all submessages.  But
+ * for big schemas that might be a lot of things to build, and we might end up
+ * not using most of them. */
+static const lupb_msgclass *lupb_msgclass_getsubmsgclass(lua_State *L, int narg,
+                                                         const upb_fielddef *f) {
+  if (upb_fielddef_type(f) != UPB_TYPE_MESSAGE) {
+    return NULL;
+  }
+
+  return lupb_msgclass_msgclassfor(L, narg, upb_fielddef_msgsubdef(f));
+}
+
+static int lupb_msgclass_pushnew(lua_State *L, int factory,
+                                 const upb_msgdef *md) {
+  const lupb_msgfactory *lfactory = lupb_msgfactory_check(L, factory);
+  lupb_msgclass *lmc = lupb_newuserdata(L, sizeof(*lmc), LUPB_MSGCLASS);
+
+  lupb_uservalseti(L, -1, LUPB_MSGCLASS_FACTORY, factory);
+  lmc->layout = upb_msgfactory_getlayout(lfactory->factory, md);
+  lmc->lfactory = lfactory;
+  lmc->msgdef = md;
+
+  return 1;
+}
+
+/* MessageClass Public API. */
+
+/**
+ * lupb_msgclass_call()
+ *
+ * Handles:
+ *   msg = MessageClass()
+ *
+ * Creates a new message from the given MessageClass.
+ */
+static int lupb_msgclass_call(lua_State *L) {
+  lupb_msg_pushnew(L, 1);
+  return 1;
+}
+
+static const struct luaL_Reg lupb_msgclass_mm[] = {
+  {"__call", lupb_msgclass_call},
+  {NULL, NULL}
+};
+
+
+/* upb <-> Lua type conversion ************************************************/
+
+static bool lupb_istypewrapped(upb_fieldtype_t type) {
+  return type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES ||
+         type == UPB_TYPE_MESSAGE;
+}
+
+static upb_msgval lupb_tomsgval(lua_State *L, upb_fieldtype_t type, int narg,
+                                const lupb_msgclass *lmsgclass) {
+  switch (type) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_ENUM:
+      return upb_msgval_int32(lupb_checkint32(L, narg));
+    case UPB_TYPE_INT64:
+      return upb_msgval_int64(lupb_checkint64(L, narg));
+    case UPB_TYPE_UINT32:
+      return upb_msgval_uint32(lupb_checkuint32(L, narg));
+    case UPB_TYPE_UINT64:
+      return upb_msgval_uint64(lupb_checkuint64(L, narg));
+    case UPB_TYPE_DOUBLE:
+      return upb_msgval_double(lupb_checkdouble(L, narg));
+    case UPB_TYPE_FLOAT:
+      return upb_msgval_float(lupb_checkfloat(L, narg));
+    case UPB_TYPE_BOOL:
+      return upb_msgval_bool(lupb_checkbool(L, narg));
+    case UPB_TYPE_STRING:
+    case UPB_TYPE_BYTES: {
+      size_t len;
+      const char *ptr = lupb_checkstring(L, narg, &len);
+      return upb_msgval_makestr(ptr, len);
+    }
+    case UPB_TYPE_MESSAGE:
+      UPB_ASSERT(lmsgclass);
+      return upb_msgval_msg(lupb_msg_checkmsg(L, narg, lmsgclass));
+  }
+  UPB_UNREACHABLE();
+}
+
+static void lupb_pushmsgval(lua_State *L, upb_fieldtype_t type,
+                            upb_msgval val) {
+  switch (type) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_ENUM:
+      lupb_pushint32(L, upb_msgval_getint32(val));
+      return;
+    case UPB_TYPE_INT64:
+      lupb_pushint64(L, upb_msgval_getint64(val));
+      return;
+    case UPB_TYPE_UINT32:
+      lupb_pushuint32(L, upb_msgval_getuint32(val));
+      return;
+    case UPB_TYPE_UINT64:
+      lupb_pushuint64(L, upb_msgval_getuint64(val));
+      return;
+    case UPB_TYPE_DOUBLE:
+      lupb_pushdouble(L, upb_msgval_getdouble(val));
+      return;
+    case UPB_TYPE_FLOAT:
+      lupb_pushfloat(L, upb_msgval_getfloat(val));
+      return;
+    case UPB_TYPE_BOOL:
+      lua_pushboolean(L, upb_msgval_getbool(val));
+      return;
+    case UPB_TYPE_STRING:
+    case UPB_TYPE_BYTES:
+    case UPB_TYPE_MESSAGE:
+      break;  /* Shouldn't call this function. */
+  }
+  UPB_UNREACHABLE();
+}
+
+
+/* lupb_array *****************************************************************/
+
+/* A strongly typed array.  Implemented by wrapping upb_array.
+ *
+ * - we only allow integer indices.
+ * - all entries must have the correct type.
+ * - we do not allow "holes" in the array; you can only assign to an existing
+ *   index or one past the end (which will grow the array by one).
+ *
+ * For string/submessage entries we keep in the userval:
+ *
+ *   [number index] -> [lupb_string/lupb_msg userdata]
+ */
+
+typedef struct {
+  /* Only needed for array of message.  This wastes space in the non-message
+   * case but simplifies the code.  Could optimize away if desired. */
+  const lupb_msgclass *lmsgclass;
+  upb_array *arr;
+  upb_fieldtype_t type;
+} lupb_array;
+
+#define ARRAY_MSGCLASS_INDEX 0
+
+static lupb_array *lupb_array_check(lua_State *L, int narg) {
+  return luaL_checkudata(L, narg, LUPB_ARRAY);
+}
+
+/**
+ * lupb_array_typecheck()
+ *
+ * Verifies that the lupb_array object at index |narg| can be safely assigned
+ * to the field |f| of the lupb_msg object at index |msg|.  If this is safe,
+ * returns a upb_msgval representing the array.  Otherwise, throws a Lua error.
+ */
+static upb_msgval lupb_array_typecheck(lua_State *L, int narg, int msg,
+                                       const upb_fielddef *f) {
+  lupb_array *larray = lupb_array_check(L, narg);
+
+  if (upb_array_type(larray->arr) != upb_fielddef_type(f) ||
+      lupb_msg_getsubmsgclass(L, msg, f) != larray->lmsgclass) {
+    luaL_error(L, "Array had incorrect type (expected: %d, got: %d)",
+               (int)upb_fielddef_type(f), (int)upb_array_type(larray->arr));
+  }
+
+  if (upb_array_type(larray->arr) == UPB_TYPE_MESSAGE) {
+    lupb_msgclass_typecheck(L, lupb_msg_getsubmsgclass(L, msg, f),
+                            larray->lmsgclass);
+  }
+
+  return upb_msgval_arr(larray->arr);
+}
+
+/**
+ * lupb_array_checkindex()
+ *
+ * Checks the array index at Lua stack index |narg| to verify that it is an
+ * integer between 1 and |max|, inclusively.  Also corrects it to be zero-based
+ * for C.
+ *
+ * We use "int" because of lua_rawseti/lua_rawgeti -- can re-evaluate if we want
+ * arrays bigger than 2^31.
+ */
+static int lupb_array_checkindex(lua_State *L, int narg, uint32_t max) {
+  uint32_t n = lupb_checkuint32(L, narg);
+  if (n == 0 || n > max || n > INT_MAX) {
+    luaL_error(L, "Invalid array index: expected between 1 and %d", (int)max);
+  }
+  return n - 1;  /* Lua uses 1-based indexing. :( */
+}
+
+/* lupb_array Public API */
+
+static int lupb_array_new(lua_State *L) {
+  lupb_array *larray;
+  upb_fieldtype_t type;
+  const lupb_msgclass *lmsgclass = NULL;
+
+  if (lua_type(L, 1) == LUA_TNUMBER) {
+    type = lupb_checkfieldtype(L, 1);
+  } else {
+    type = UPB_TYPE_MESSAGE;
+    lmsgclass = lupb_msgclass_check(L, 1);
+    lupb_uservalseti(L, -1, ARRAY_MSGCLASS_INDEX, 1);  /* GC-root lmsgclass. */
+  }
+
+  larray = lupb_newuserdata(L, sizeof(*larray), LUPB_ARRAY);
+  larray->type = type;
+  larray->lmsgclass = lmsgclass;
+  larray->arr = upb_array_new(lupb_arena_get(L));
+
+  return 1;
+}
+
+static int lupb_array_newindex(lua_State *L) {
+  lupb_array *larray = lupb_array_check(L, 1);
+  upb_fieldtype_t type = upb_array_type(larray->arr);
+  uint32_t n = lupb_array_checkindex(L, 2, upb_array_size(larray->arr) + 1);
+  upb_msgval msgval = lupb_tomsgval(L, type, 3, larray->lmsgclass);
+
+  upb_array_set(larray->arr, larray->type, n, msgval, lupb_arena_get(L));
+
+  if (lupb_istypewrapped(type)) {
+    lupb_uservalseti(L, 1, n, 3);
+  }
+
+  return 0;  /* 1 for chained assignments? */
+}
+
+static int lupb_array_index(lua_State *L) {
+  lupb_array *larray = lupb_array_check(L, 1);
+  upb_array *array = larray->arr;
+  uint32_t n = lupb_array_checkindex(L, 2, upb_array_size(array));
+  upb_fieldtype_t type = upb_array_type(array);
+
+  if (lupb_istypewrapped(type)) {
+    lupb_uservalgeti(L, 1, n);
+  } else {
+    lupb_pushmsgval(L, upb_array_type(array),
+                    upb_array_get(array, larray->type, n));
+  }
+
+  return 1;
+}
+
+static int lupb_array_len(lua_State *L) {
+  lupb_array *larray = lupb_array_check(L, 1);
+  lua_pushnumber(L, upb_array_size(larray->arr));
+  return 1;
+}
+
+static const struct luaL_Reg lupb_array_mm[] = {
+  {"__index", lupb_array_index},
+  {"__len", lupb_array_len},
+  {"__newindex", lupb_array_newindex},
+  {NULL, NULL}
+};
+
+
+/* lupb_map *******************************************************************/
+
+/* A map object.  Implemented by wrapping upb_map.
+ *
+ * When the value type is string/bytes/message, the userval consists of:
+ *
+ *   [Lua number/string] -> [lupb_string/lupb_msg userdata]
+ *
+ * For other value types we don't use the userdata.
+ */
+
+typedef struct {
+  const lupb_msgclass *value_lmsgclass;
+  upb_map *map;
+} lupb_map;
+
+#define MAP_MSGCLASS_INDEX 0
+
+/* lupb_map internal functions */
+
+static lupb_map *lupb_map_check(lua_State *L, int narg) {
+  return luaL_checkudata(L, narg, LUPB_ARRAY);
+}
+
+/**
+ * lupb_map_typecheck()
+ *
+ * Checks that the lupb_map at index |narg| can be safely assigned to the
+ * field |f| of the message at index |msg|.  If so, returns a upb_msgval for
+ * this map.  Otherwise, raises a Lua error.
+ */
+static upb_msgval lupb_map_typecheck(lua_State *L, int narg, int msg,
+                                     const upb_fielddef *f) {
+  lupb_map *lmap = lupb_map_check(L, narg);
+  upb_map *map = lmap->map;
+  const upb_msgdef *entry = upb_fielddef_msgsubdef(f);
+  const upb_fielddef *key_field = upb_msgdef_itof(entry, UPB_MAPENTRY_KEY);
+  const upb_fielddef *value_field = upb_msgdef_itof(entry, UPB_MAPENTRY_VALUE);
+
+  UPB_ASSERT(entry && key_field && value_field);
+
+  if (upb_map_keytype(map) != upb_fielddef_type(key_field)) {
+    luaL_error(L, "Map key type invalid");
+  }
+
+  if (upb_map_valuetype(map) != upb_fielddef_type(value_field)) {
+    luaL_error(L, "Map had incorrect value type (expected: %s, got: %s)",
+               upb_fielddef_type(value_field), upb_map_valuetype(map));
+  }
+
+  if (upb_map_valuetype(map) == UPB_TYPE_MESSAGE) {
+    lupb_msgclass_typecheck(
+        L, lupb_msg_msgclassfor(L, msg, upb_fielddef_msgsubdef(value_field)),
+        lmap->value_lmsgclass);
+  }
+
+  return upb_msgval_map(map);
+}
+
+/* lupb_map Public API */
+
+/**
+ * lupb_map_new
+ *
+ * Handles:
+ *   new_map = upb.Map(key_type, value_type)
+ */
+static int lupb_map_new(lua_State *L) {
+  lupb_map *lmap;
+  upb_fieldtype_t key_type = lupb_checkfieldtype(L, 1);
+  upb_fieldtype_t value_type;
+  const lupb_msgclass *value_lmsgclass = NULL;
+
+  if (lua_type(L, 2) == LUA_TNUMBER) {
+    value_type = lupb_checkfieldtype(L, 2);
+  } else {
+    value_type = UPB_TYPE_MESSAGE;
+  }
+
+  lmap = lupb_newuserdata(L, sizeof(*lmap), LUPB_MAP);
+
+  if (value_type == UPB_TYPE_MESSAGE) {
+    value_lmsgclass = lupb_msgclass_check(L, 2);
+    lupb_uservalseti(L, -1, MAP_MSGCLASS_INDEX, 2);  /* GC-root lmsgclass. */
+  }
+
+  lmap->value_lmsgclass = value_lmsgclass;
+  lmap->map = upb_map_new(key_type, value_type, lupb_arena_get(L));
+
+  return 1;
+}
+
+/**
+ * lupb_map_index
+ *
+ * Handles:
+ *   map[key]
+ */
+static int lupb_map_index(lua_State *L) {
+  lupb_map *lmap = lupb_map_check(L, 1);
+  upb_map *map = lmap->map;
+  upb_fieldtype_t valtype = upb_map_valuetype(map);
+  /* We don't always use "key", but this call checks the key type. */
+  upb_msgval key = lupb_tomsgval(L, upb_map_keytype(map), 2, NULL);
+
+  if (lupb_istypewrapped(valtype)) {
+    /* Userval contains the full map, lookup there by key. */
+    lupb_getuservalue(L, 1);
+    lua_pushvalue(L, 2);
+    lua_rawget(L, -2);
+
+    if (lua_isnil(L, -1)) {
+      /* TODO: lazy read from upb_map */
+    }
+  } else {
+    /* Lookup in upb_map. */
+    upb_msgval val;
+    if (upb_map_get(map, key, &val)) {
+      lupb_pushmsgval(L, upb_map_valuetype(map), val);
+    } else {
+      lua_pushnil(L);
+    }
+  }
+
+  return 1;
+}
+
+/**
+ * lupb_map_len
+ *
+ * Handles:
+ *   map_len = #map
+ */
+static int lupb_map_len(lua_State *L) {
+  lupb_map *lmap = lupb_map_check(L, 1);
+  lua_pushnumber(L, upb_map_size(lmap->map));
+  return 1;
+}
+
+/**
+ * lupb_map_newindex
+ *
+ * Handles:
+ *   map[key] = val
+ *   map[key] = nil  # to remove from map
+ */
+static int lupb_map_newindex(lua_State *L) {
+  lupb_map *lmap = lupb_map_check(L, 1);
+  upb_map *map = lmap->map;
+  upb_msgval key = lupb_tomsgval(L, upb_map_keytype(map), 2, NULL);
+
+  if (lua_isnil(L, 3)) {
+    /* Delete from map. */
+    upb_map_del(map, key);
+
+    if (lupb_istypewrapped(upb_map_valuetype(map))) {
+      /* Delete in userval. */
+      lupb_getuservalue(L, 1);
+      lua_pushvalue(L, 2);
+      lua_pushnil(L);
+      lua_rawset(L, -3);
+      lua_pop(L, 1);
+    }
+  } else {
+    /* Set in map. */
+    upb_msgval val =
+        lupb_tomsgval(L, upb_map_valuetype(map), 3, lmap->value_lmsgclass);
+
+    upb_map_set(map, key, val, NULL);
+
+    if (lupb_istypewrapped(upb_map_valuetype(map))) {
+      /* Set in userval. */
+      lupb_getuservalue(L, 1);
+      lua_pushvalue(L, 2);
+      lua_pushvalue(L, 3);
+      lua_rawset(L, -3);
+      lua_pop(L, 1);
+    }
+  }
+
+  return 0;
+}
+
+/* upb_mapiter [[[ */
+
+static int lupb_mapiter_next(lua_State *L) {
+  upb_mapiter *i = lua_touserdata(L, lua_upvalueindex(1));
+  lupb_map *lmap = lupb_map_check(L, 1);
+  upb_map *map = lmap->map;
+
+  if (upb_mapiter_done(i)) {
+    return 0;
+  }
+
+  lupb_pushmsgval(L, upb_map_keytype(map), upb_mapiter_key(i));
+  lupb_pushmsgval(L, upb_map_valuetype(map), upb_mapiter_value(i));
+  upb_mapiter_next(i);
+
+  return 2;
+}
+
+static int lupb_map_pairs(lua_State *L) {
+  lupb_map *lmap = lupb_map_check(L, 1);
+
+  if (lupb_istypewrapped(upb_map_keytype(lmap->map)) ||
+      lupb_istypewrapped(upb_map_valuetype(lmap->map))) {
+    /* Complex key or value type.
+     * Sync upb_map to userval if necessary, then iterate over userval. */
+
+    /* TODO: Lua tables don't know how many entries they have, gah!. */
+    return 1;
+  } else {
+    /* Simple key and value type, iterate over the upb_map directly. */
+    upb_mapiter *i = lua_newuserdata(L, upb_mapiter_sizeof());
+
+    upb_mapiter_begin(i, lmap->map);
+    lua_pushvalue(L, 1);
+
+    /* Upvalues are [upb_mapiter, lupb_map]. */
+    lua_pushcclosure(L, &lupb_mapiter_next, 2);
+
+    return 1;
+  }
+}
+
+/* upb_mapiter ]]] */
+
+static const struct luaL_Reg lupb_map_mm[] = {
+  {"__index", lupb_map_index},
+  {"__len", lupb_map_len},
+  {"__newindex", lupb_map_newindex},
+  {"__pairs", lupb_map_pairs},
+  {NULL, NULL}
+};
+
+
+/* lupb_msg *******************************************************************/
+
+/* A message object.  Implemented by wrapping upb_msg.
+ *
+ * Our userval contains:
+ *
+ * - [0] -> our message class
+ * - [lupb_fieldindex(f)] -> [lupb_{string,array,map,msg} userdata]
+ *
+ * Fields with scalar number/bool types don't go in the userval.
+ */
+
+#define LUPB_MSG_MSGCLASSINDEX 0
+#define LUPB_MSG_ARENA -1
+
+int lupb_fieldindex(const upb_fielddef *f) {
+  return upb_fielddef_index(f) + 1;  /* 1-based Lua arrays. */
+}
+
+
+typedef struct {
+  const lupb_msgclass *lmsgclass;
+  upb_msg *msg;
+} lupb_msg;
+
+/* lupb_msg helpers */
+
+static bool in_userval(const upb_fielddef *f) {
+  return lupb_istypewrapped(upb_fielddef_type(f)) || upb_fielddef_isseq(f) ||
+         upb_fielddef_ismap(f);
+}
+
+lupb_msg *lupb_msg_check(lua_State *L, int narg) {
+  lupb_msg *msg = luaL_checkudata(L, narg, LUPB_MSG);
+  if (!msg->lmsgclass) luaL_error(L, "called into dead msg");
+  return msg;
+}
+
+const upb_msg *lupb_msg_checkmsg(lua_State *L, int narg,
+                                 const lupb_msgclass *lmsgclass) {
+  lupb_msg *lmsg = lupb_msg_check(L, narg);
+  lupb_msgclass_typecheck(L, lmsgclass, lmsg->lmsgclass);
+  return lmsg->msg;
+}
+
+upb_msg *lupb_msg_checkmsg2(lua_State *L, int narg,
+                            const upb_msglayout **layout) {
+  lupb_msg *lmsg = lupb_msg_check(L, narg);
+  *layout = lmsg->lmsgclass->layout;
+  return lmsg->msg;
+}
+
+const upb_msgdef *lupb_msg_checkdef(lua_State *L, int narg) {
+  return lupb_msg_check(L, narg)->lmsgclass->msgdef;
+}
+
+static const upb_fielddef *lupb_msg_checkfield(lua_State *L,
+                                               const lupb_msg *msg,
+                                               int fieldarg) {
+  size_t len;
+  const char *fieldname = luaL_checklstring(L, fieldarg, &len);
+  const upb_msgdef *msgdef = msg->lmsgclass->msgdef;
+  const upb_fielddef *f = upb_msgdef_ntof(msgdef, fieldname, len);
+
+  if (!f) {
+    const char *msg = lua_pushfstring(L, "no such field: %s", fieldname);
+    luaL_argerror(L, fieldarg, msg);
+    return NULL;  /* Never reached. */
+  }
+
+  return f;
+}
+
+static const lupb_msgclass *lupb_msg_msgclassfor(lua_State *L, int narg,
+                                                 const upb_msgdef *md) {
+  lupb_uservalgeti(L, narg, LUPB_MSG_MSGCLASSINDEX);
+  return lupb_msgclass_msgclassfor(L, -1, md);
+}
+
+static const lupb_msgclass *lupb_msg_getsubmsgclass(lua_State *L, int narg,
+                                                    const upb_fielddef *f) {
+  lupb_uservalgeti(L, narg, LUPB_MSG_MSGCLASSINDEX);
+  return lupb_msgclass_getsubmsgclass(L, -1, f);
+}
+
+int lupb_msg_pushref(lua_State *L, int msgclass, upb_msg *msg) {
+  const lupb_msgclass *lmsgclass = lupb_msgclass_check(L, msgclass);
+  lupb_msg *lmsg = lupb_newuserdata(L, sizeof(lupb_msg), LUPB_MSG);
+
+  lmsg->lmsgclass = lmsgclass;
+  lmsg->msg = msg;
+
+  lupb_uservalseti(L, -1, LUPB_MSG_MSGCLASSINDEX, msgclass);
+  lupb_uservalseti(L, -1, LUPB_MSG_ARENA, -2);
+
+  return 1;
+}
+
+/* lupb_msg Public API */
+
+/**
+ * lupb_msg_pushnew
+ *
+ * Handles:
+ *   new_msg = MessageClass()
+ */
+static int lupb_msg_pushnew(lua_State *L, int narg) {
+  const lupb_msgclass *lmsgclass = lupb_msgclass_check(L, narg);
+  lupb_msg *lmsg = lupb_newuserdata(L, sizeof(lupb_msg), LUPB_MSG);
+
+  lmsg->lmsgclass = lmsgclass;
+  lmsg->msg = upb_msg_new(lmsgclass->layout, lupb_arena_get(L));
+
+  lupb_uservalseti(L, -1, LUPB_MSG_MSGCLASSINDEX, narg);
+
+  return 1;
+}
+
+/**
+ * lupb_msg_index
+ *
+ * Handles:
+ *   msg.foo
+ *   msg["foo"]
+ *   msg[field_descriptor]  # (for extensions) (TODO)
+ */
+static int lupb_msg_index(lua_State *L) {
+  lupb_msg *lmsg = lupb_msg_check(L, 1);
+  const upb_fielddef *f = lupb_msg_checkfield(L, lmsg, 2);
+  const upb_msglayout *l = lmsg->lmsgclass->layout;
+  int field_index = upb_fielddef_index(f);
+
+  if (in_userval(f)) {
+    lupb_uservalgeti(L, 1, lupb_fieldindex(f));
+
+    if (lua_isnil(L, -1)) {
+      /* Check if we need to lazily create wrapper. */
+      if (upb_fielddef_isseq(f)) {
+        /* TODO(haberman) */
+      } else if (upb_fielddef_issubmsg(f)) {
+        /* TODO(haberman) */
+      } else {
+        UPB_ASSERT(upb_fielddef_isstring(f));
+        if (upb_msg_has(lmsg->msg, field_index, l)) {
+          upb_msgval val = upb_msg_get(lmsg->msg, field_index, l);
+          lua_pop(L, 1);
+          lua_pushlstring(L, val.str.data, val.str.size);
+          lupb_uservalseti(L, 1, lupb_fieldindex(f), -1);
+        }
+      }
+    }
+  } else {
+    upb_msgval val = upb_msg_get(lmsg->msg, field_index, l);
+    lupb_pushmsgval(L, upb_fielddef_type(f), val);
+  }
+
+  return 1;
+}
+
+/**
+ * lupb_msg_newindex()
+ *
+ * Handles:
+ *   msg.foo = bar
+ *   msg["foo"] = bar
+ *   msg[field_descriptor] = bar  # (for extensions) (TODO)
+ */
+static int lupb_msg_newindex(lua_State *L) {
+  lupb_msg *lmsg = lupb_msg_check(L, 1);
+  const upb_fielddef *f = lupb_msg_checkfield(L, lmsg, 2);
+  upb_fieldtype_t type = upb_fielddef_type(f);
+  int field_index = upb_fielddef_index(f);
+  upb_msgval msgval;
+
+  /* Typecheck and get msgval. */
+
+  if (upb_fielddef_isseq(f)) {
+    msgval = lupb_array_typecheck(L, 3, 1, f);
+  } else if (upb_fielddef_ismap(f)) {
+    msgval = lupb_map_typecheck(L, 3, 1, f);
+  } else {
+    const lupb_msgclass *lmsgclass = NULL;
+
+    if (type == UPB_TYPE_MESSAGE) {
+      lmsgclass = lupb_msg_getsubmsgclass(L, 1, f);
+    }
+
+    msgval = lupb_tomsgval(L, type, 3, lmsgclass);
+  }
+
+  /* Set in upb_msg and userval (if necessary). */
+
+  upb_msg_set(lmsg->msg, field_index, msgval, lmsg->lmsgclass->layout);
+
+  if (in_userval(f)) {
+    lupb_uservalseti(L, 1, lupb_fieldindex(f), 3);
+  }
+
+  return 0;  /* 1 for chained assignments? */
+}
+
+static const struct luaL_Reg lupb_msg_mm[] = {
+  {"__index", lupb_msg_index},
+  {"__newindex", lupb_msg_newindex},
+  {NULL, NULL}
+};
+
+
+/* lupb_msg toplevel **********************************************************/
+
+static const struct luaL_Reg lupb_msg_toplevel_m[] = {
+  {"Array", lupb_array_new},
+  {"Map", lupb_map_new},
+  {"MessageFactory", lupb_msgfactory_new},
+  {NULL, NULL}
+};
+
+void lupb_msg_registertypes(lua_State *L) {
+  lupb_setfuncs(L, lupb_msg_toplevel_m);
+
+  lupb_register_type(L, LUPB_ARENA,      NULL,              lupb_arena_mm);
+  lupb_register_type(L, LUPB_MSGCLASS,   NULL,              lupb_msgclass_mm);
+  lupb_register_type(L, LUPB_MSGFACTORY, lupb_msgfactory_m, lupb_msgfactory_mm);
+  lupb_register_type(L, LUPB_ARRAY,      NULL,              lupb_array_mm);
+  lupb_register_type(L, LUPB_MAP,        NULL,              lupb_map_mm);
+  lupb_register_type(L, LUPB_MSG,        NULL,              lupb_msg_mm);
+
+  lupb_arena_initsingleton(L);
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb.c
new file mode 100644 (file)
index 0000000..38fd24a
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+** require("lua") -- A Lua extension for upb.
+**
+** Exposes only the core library
+** (sub-libraries are exposed in other extensions).
+**
+** 64-bit woes: Lua can only represent numbers of type lua_Number (which is
+** double unless the user specifically overrides this).  Doubles can represent
+** the entire range of 64-bit integers, but lose precision once the integers are
+** greater than 2^53.
+**
+** Lua 5.3 is adding support for integers, which will allow for 64-bit
+** integers (which can be interpreted as signed or unsigned).
+**
+** LuaJIT supports 64-bit signed and unsigned boxed representations
+** through its "cdata" mechanism, but this is not portable to regular Lua.
+**
+** Hopefully Lua 5.3 will come soon enough that we can either use Lua 5.3
+** integer support or LuaJIT 64-bit cdata for users that need the entire
+** domain of [u]int64 values.
+*/
+
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include "lauxlib.h"
+#include "upb/bindings/lua/upb.h"
+#include "upb/handlers.h"
+#include "upb/msg.h"
+
+
+/* Lua compatibility code *****************************************************/
+
+/* Lua 5.1 and Lua 5.2 have slightly incompatible APIs.  A little bit of
+ * compatibility code can help hide the difference.  Not too many people still
+ * use Lua 5.1 but LuaJIT uses the Lua 5.1 API in some ways. */
+
+#if LUA_VERSION_NUM == 501
+
+/* taken from lua 5.2's source. */
+void *luaL_testudata(lua_State *L, int ud, const char *tname) {
+  void *p = lua_touserdata(L, ud);
+  if (p != NULL) {  /* value is a userdata? */
+    if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */
+      luaL_getmetatable(L, tname);  /* get correct metatable */
+      if (!lua_rawequal(L, -1, -2))  /* not the same? */
+        p = NULL;  /* value is a userdata with wrong metatable */
+      lua_pop(L, 2);  /* remove both metatables */
+      return p;
+    }
+  }
+  return NULL;  /* value is not a userdata with a metatable */
+}
+
+static void lupb_newlib(lua_State *L, const char *name, const luaL_Reg *funcs) {
+  luaL_register(L, name, funcs);
+}
+
+#elif LUA_VERSION_NUM == 502
+
+int luaL_typerror(lua_State *L, int narg, const char *tname) {
+  const char *msg = lua_pushfstring(L, "%s expected, got %s",
+                                    tname, luaL_typename(L, narg));
+  return luaL_argerror(L, narg, msg);
+}
+
+static void lupb_newlib(lua_State *L, const char *name, const luaL_Reg *funcs) {
+  /* Lua 5.2 modules are not expected to set a global variable, so "name" is
+   * unused. */
+  UPB_UNUSED(name);
+
+  /* Can't use luaL_newlib(), because funcs is not the actual array.
+   * Could (micro-)optimize this a bit to count funcs for initial table size. */
+  lua_createtable(L, 0, 8);
+  luaL_setfuncs(L, funcs, 0);
+}
+
+#else
+#error Only Lua 5.1 and 5.2 are supported
+#endif
+
+/* Shims for upcoming Lua 5.3 functionality. */
+bool lua_isinteger(lua_State *L, int argn) {
+  UPB_UNUSED(L);
+  UPB_UNUSED(argn);
+  return false;
+}
+
+
+/* Utility functions **********************************************************/
+
+/* We store our module table in the registry, keyed by ptr.
+ * For more info about the motivation/rationale, see this thread:
+ *   http://thread.gmane.org/gmane.comp.lang.lua.general/110632 */
+bool lupb_openlib(lua_State *L, void *ptr, const char *name,
+                  const luaL_Reg *funcs) {
+  /* Lookup cached module table. */
+  lua_pushlightuserdata(L, ptr);
+  lua_rawget(L, LUA_REGISTRYINDEX);
+  if (!lua_isnil(L, -1)) {
+    return true;
+  }
+
+  lupb_newlib(L, name, funcs);
+
+  /* Save module table in cache. */
+  lua_pushlightuserdata(L, ptr);
+  lua_pushvalue(L, -2);
+  lua_rawset(L, LUA_REGISTRYINDEX);
+
+  return false;
+}
+
+void lupb_checkstatus(lua_State *L, upb_status *s) {
+  if (!upb_ok(s)) {
+    lua_pushstring(L, upb_status_errmsg(s));
+    lua_error(L);
+  }
+}
+
+/* Scalar type mapping ********************************************************/
+
+/* Functions that convert scalar/primitive values (numbers, strings, bool)
+ * between Lua and C/upb.  Handles type/range checking. */
+
+bool lupb_checkbool(lua_State *L, int narg) {
+  if (!lua_isboolean(L, narg)) {
+    luaL_error(L, "must be true or false");
+  }
+  return lua_toboolean(L, narg);
+}
+
+/* Unlike luaL_checkstring(), this does not allow implicit conversion to
+ * string. */
+const char *lupb_checkstring(lua_State *L, int narg, size_t *len) {
+  if (lua_type(L, narg) != LUA_TSTRING) {
+    luaL_error(L, "Expected string");
+  }
+
+  return lua_tolstring(L, narg, len);
+}
+
+/* Unlike luaL_checkinteger, these do not implicitly convert from string or
+ * round an existing double value.  We allow floating-point input, but only if
+ * the actual value is integral. */
+#define INTCHECK(type, ctype)                                                  \
+  ctype lupb_check##type(lua_State *L, int narg) {                             \
+    double n;                                                                  \
+    ctype i;                                                                   \
+    if (lua_isinteger(L, narg)) {                                              \
+      return lua_tointeger(L, narg);                                           \
+    }                                                                          \
+                                                                               \
+    /* Prevent implicit conversion from string. */                             \
+    luaL_checktype(L, narg, LUA_TNUMBER);                                      \
+    n = lua_tonumber(L, narg);                                                 \
+                                                                               \
+    i = (ctype)n;                                                              \
+    if ((double)i != n) {                                                      \
+      /* double -> ctype truncated or rounded. */                              \
+      luaL_error(L, "number %f was not an integer or out of range for " #type, \
+                 n);                                                           \
+    }                                                                          \
+    return i;                                                                  \
+  }                                                                            \
+  void lupb_push##type(lua_State *L, ctype val) {                              \
+    /* TODO: push integer for Lua >= 5.3, 64-bit cdata for LuaJIT. */          \
+    /* This is lossy for some [u]int64 values, which isn't great, but */       \
+    /* crashing when we encounter these values seems worse. */                 \
+    lua_pushnumber(L, val);                                                    \
+  }
+
+INTCHECK(int64,  int64_t)
+INTCHECK(int32,  int32_t)
+INTCHECK(uint64, uint64_t)
+INTCHECK(uint32, uint32_t)
+
+double lupb_checkdouble(lua_State *L, int narg) {
+  /* If we were being really hard-nosed here, we'd check whether the input was
+   * an integer that has no precise double representation.  But doubles aren't
+   * generally expected to be exact like integers are, and worse this could
+   * cause data-dependent runtime errors: one run of the program could work fine
+   * because the integer calculations happened to be exactly representable in
+   * double, while the next could crash because of subtly different input. */
+
+  luaL_checktype(L, narg, LUA_TNUMBER);  /* lua_tonumber() auto-converts. */
+  return lua_tonumber(L, narg);
+}
+
+float lupb_checkfloat(lua_State *L, int narg) {
+  /* We don't worry about checking whether the input can be exactly converted to
+   * float -- see above. */
+
+  luaL_checktype(L, narg, LUA_TNUMBER);  /* lua_tonumber() auto-converts. */
+  return lua_tonumber(L, narg);
+}
+
+void lupb_pushdouble(lua_State *L, double d) {
+  lua_pushnumber(L, d);
+}
+
+void lupb_pushfloat(lua_State *L, float d) {
+  lua_pushnumber(L, d);
+}
+
+
+static const struct luaL_Reg lupb_toplevel_m[] = {
+  {NULL, NULL}
+};
+
+void lupb_register_type(lua_State *L, const char *name, const luaL_Reg *m,
+                        const luaL_Reg *mm) {
+  luaL_newmetatable(L, name);
+
+  if (mm) {
+    lupb_setfuncs(L, mm);
+  }
+
+  if (m) {
+    /* Methods go in the mt's __index method.  This implies that you can'
+     * implement __index and also have methods. */
+    lua_getfield(L, -1, "__index");
+    lupb_assert(L, lua_isnil(L, -1));
+    lua_pop(L, 1);
+
+    lua_createtable(L, 0, 0);
+    lupb_setfuncs(L, m);
+    lua_setfield(L, -2, "__index");
+  }
+
+  lua_pop(L, 1);  /* The mt. */
+}
+
+int luaopen_upb_c(lua_State *L) {
+  static char module_key;
+  if (lupb_openlib(L, &module_key, "upb_c", lupb_toplevel_m)) {
+    return 1;
+  }
+
+  lupb_def_registertypes(L);
+  lupb_msg_registertypes(L);
+
+  return 1;  /* Return package table. */
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb.h
new file mode 100644 (file)
index 0000000..51d8acf
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+** Shared definitions for upb Lua modules.
+*/
+
+#ifndef UPB_LUA_UPB_H_
+#define UPB_LUA_UPB_H_
+
+#include "lauxlib.h"
+#include "upb/def.h"
+#include "upb/handlers.h"
+#include "upb/msg.h"
+#include "upb/msgfactory.h"
+
+/* Lua 5.1/5.2 compatibility code. */
+#if LUA_VERSION_NUM == 501
+
+#define lua_rawlen lua_objlen
+
+/* Lua >= 5.2's getuservalue/setuservalue functions do not exist in prior
+ * versions but the older function lua_getfenv() can provide 100% of its
+ * capabilities (the reverse is not true). */
+#define lua_getuservalue(L, index) lua_getfenv(L, index)
+#define lua_setuservalue(L, index) lua_setfenv(L, index)
+
+void *luaL_testudata(lua_State *L, int ud, const char *tname);
+
+#define lupb_setfuncs(L, l) luaL_register(L, NULL, l)
+
+#elif LUA_VERSION_NUM == 502
+
+int luaL_typerror(lua_State *L, int narg, const char *tname);
+
+#define lupb_setfuncs(L, l) luaL_setfuncs(L, l, 0)
+
+#else
+#error Only Lua 5.1 and 5.2 are supported
+#endif
+
+#define lupb_assert(L, predicate) \
+  if (!(predicate))               \
+    luaL_error(L, "internal error: %s, %s:%d ", #predicate, __FILE__, __LINE__);
+
+/* Function for initializing the core library.  This function is idempotent,
+ * and should be called at least once before calling any of the functions that
+ * construct core upb types. */
+int luaopen_upb(lua_State *L);
+
+/* Gets or creates a package table for a C module that is uniquely identified by
+ * "ptr".  The easiest way to supply a unique "ptr" is to pass the address of a
+ * static variable private in the module's .c file.
+ *
+ * If this module has already been registered in this lua_State, pushes it and
+ * returns true.
+ *
+ * Otherwise, creates a new module table for this module with the given name,
+ * pushes it, and registers the given top-level functions in it.  It also sets
+ * it as a global variable, but only if the current version of Lua expects that
+ * (ie Lua 5.1/LuaJIT).
+ *
+ * If "false" is returned, the caller is guaranteed that this lib has not been
+ * registered in this Lua state before (regardless of any funny business the
+ * user might have done to the global state), so the caller can safely perform
+ * one-time initialization. */
+bool lupb_openlib(lua_State *L, void *ptr, const char *name,
+                  const luaL_Reg *funcs);
+
+/* Custom check/push functions.  Unlike the Lua equivalents, they are pinned to
+ * specific types (instead of lua_Number, etc), and do not allow any implicit
+ * conversion or data loss. */
+int64_t lupb_checkint64(lua_State *L, int narg);
+int32_t lupb_checkint32(lua_State *L, int narg);
+uint64_t lupb_checkuint64(lua_State *L, int narg);
+uint32_t lupb_checkuint32(lua_State *L, int narg);
+double lupb_checkdouble(lua_State *L, int narg);
+float lupb_checkfloat(lua_State *L, int narg);
+bool lupb_checkbool(lua_State *L, int narg);
+const char *lupb_checkstring(lua_State *L, int narg, size_t *len);
+const char *lupb_checkname(lua_State *L, int narg);
+
+void lupb_pushint64(lua_State *L, int64_t val);
+void lupb_pushint32(lua_State *L, int32_t val);
+void lupb_pushuint64(lua_State *L, uint64_t val);
+void lupb_pushuint32(lua_State *L, uint32_t val);
+void lupb_pushdouble(lua_State *L, double val);
+void lupb_pushfloat(lua_State *L, float val);
+
+/* Registers a type with the given name, methods, and metamethods. */
+void lupb_register_type(lua_State *L, const char *name, const luaL_Reg *m,
+                        const luaL_Reg *mm);
+
+/* Checks the given upb_status and throws a Lua error if it is not ok. */
+void lupb_checkstatus(lua_State *L, upb_status *s);
+
+
+/** From def.c. ***************************************************************/
+
+upb_fieldtype_t lupb_checkfieldtype(lua_State *L, int narg);
+
+const upb_msgdef *lupb_msgdef_check(lua_State *L, int narg);
+const upb_enumdef *lupb_enumdef_check(lua_State *L, int narg);
+const upb_fielddef *lupb_fielddef_check(lua_State *L, int narg);
+upb_symtab *lupb_symtab_check(lua_State *L, int narg);
+
+void lupb_def_registertypes(lua_State *L);
+
+
+/** From msg.c. ***************************************************************/
+
+struct lupb_msgclass;
+typedef struct lupb_msgclass lupb_msgclass;
+
+upb_arena *lupb_arena_check(lua_State *L, int narg);
+int lupb_arena_new(lua_State *L);
+upb_arena *lupb_arena_get(lua_State *L);
+int lupb_msg_pushref(lua_State *L, int msgclass, void *msg);
+const upb_msg *lupb_msg_checkmsg(lua_State *L, int narg,
+                                 const lupb_msgclass *lmsgclass);
+upb_msg *lupb_msg_checkmsg2(lua_State *L, int narg,
+                            const upb_msglayout **layout);
+
+const lupb_msgclass *lupb_msgclass_check(lua_State *L, int narg);
+const upb_msglayout *lupb_msgclass_getlayout(lua_State *L, int narg);
+const upb_msgdef *lupb_msgclass_getmsgdef(const lupb_msgclass *lmsgclass);
+upb_msgfactory *lupb_msgclass_getfactory(const lupb_msgclass *lmsgclass);
+void lupb_msg_registertypes(lua_State *L);
+
+#endif  /* UPB_LUA_UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb/pb.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/lua/upb/pb.c
new file mode 100644 (file)
index 0000000..266bd97
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+** require("upb.pb") -- A Lua extension for upb.pb.
+**
+** Exposes all the types defined in upb/pb/{*}.h
+** Also defines a few convenience functions on top.
+*/
+
+#include "upb/bindings/lua/upb.h"
+#include "upb/decode.h"
+#include "upb/encode.h"
+
+#define LUPB_PBDECODERMETHOD "lupb.pb.decodermethod"
+
+static int lupb_pb_decode(lua_State *L) {
+  size_t len;
+  const upb_msglayout *layout;
+  upb_msg *msg = lupb_msg_checkmsg2(L, 1, &layout);
+  const char *pb = lua_tolstring(L, 2, &len);
+
+  upb_decode(pb, len, msg, layout, lupb_arena_get(L));
+  /* TODO(haberman): check for error. */
+
+  return 0;
+}
+
+static int lupb_pb_encode(lua_State *L) {
+  const upb_msglayout *layout;
+  const upb_msg *msg = lupb_msg_checkmsg2(L, 1, &layout);
+  upb_arena *arena = upb_arena_new();
+  size_t size;
+  char *result;
+
+  result = upb_encode(msg, (const void*)layout, arena, &size);
+
+  /* Free resources before we potentially bail on error. */
+  lua_pushlstring(L, result, size);
+  upb_arena_free(arena);
+  /* TODO(haberman): check for error. */
+
+  return 1;
+}
+
+static const struct luaL_Reg toplevel_m[] = {
+  {"decode", lupb_pb_decode},
+  {"encode", lupb_pb_encode},
+  {NULL, NULL}
+};
+
+int luaopen_upb_pb_c(lua_State *L) {
+  static char module_key;
+  if (lupb_openlib(L, &module_key, "upb.pb_c", toplevel_m)) {
+    return 1;
+  }
+
+  return 1;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/stdc++/string.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/bindings/stdc++/string.h
new file mode 100644 (file)
index 0000000..c346548
--- /dev/null
@@ -0,0 +1,69 @@
+
+#ifndef UPB_STDCPP_H_
+#define UPB_STDCPP_H_
+
+#include "upb/sink.h"
+
+#include "upb/port_def.inc"
+
+namespace upb {
+
+template <class T>
+class FillStringHandler {
+ public:
+  static void SetHandler(upb_byteshandler* handler) {
+    upb_byteshandler_setstartstr(handler, &FillStringHandler::StartString,
+                                 NULL);
+    upb_byteshandler_setstring(handler, &FillStringHandler::StringBuf, NULL);
+  }
+
+ private:
+  // TODO(haberman): add UpbBind/UpbMakeHandler support to BytesHandler so these
+  // can be prettier callbacks.
+  static void* StartString(void *c, const void *hd, size_t size) {
+    UPB_UNUSED(hd);
+    UPB_UNUSED(size);
+
+    T* str = static_cast<T*>(c);
+    str->clear();
+    return c;
+  }
+
+  static size_t StringBuf(void* c, const void* hd, const char* buf, size_t n,
+                          const upb_bufhandle* h) {
+    UPB_UNUSED(hd);
+    UPB_UNUSED(h);
+
+    T* str = static_cast<T*>(c);
+    try {
+      str->append(buf, n);
+      return n;
+    } catch (const std::exception&) {
+      return 0;
+    }
+  }
+};
+
+class StringSink {
+ public:
+  template <class T>
+  explicit StringSink(T* target) {
+    // TODO(haberman): we need to avoid rebuilding a new handler every time,
+    // but with class globals disallowed for google3 C++ this is tricky.
+    upb_byteshandler_init(&handler_);
+    FillStringHandler<T>::SetHandler(&handler_);
+    input_.Reset(&handler_, target);
+  }
+
+  BytesSink input() { return input_; }
+
+ private:
+  upb_byteshandler handler_;
+  BytesSink input_;
+};
+
+}  // namespace upb
+
+#include "upb/port_undef.inc"
+
+#endif  // UPB_STDCPP_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/decode.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/decode.c
new file mode 100644 (file)
index 0000000..88d4bb4
--- /dev/null
@@ -0,0 +1,604 @@
+
+#include <string.h>
+#include "upb/upb.h"
+#include "upb/decode.h"
+
+#include "upb/port_def.inc"
+
+/* Maps descriptor type -> upb field type.  */
+const uint8_t upb_desctype_to_fieldtype[] = {
+  UPB_WIRE_TYPE_END_GROUP,  /* ENDGROUP */
+  UPB_TYPE_DOUBLE,          /* DOUBLE */
+  UPB_TYPE_FLOAT,           /* FLOAT */
+  UPB_TYPE_INT64,           /* INT64 */
+  UPB_TYPE_UINT64,          /* UINT64 */
+  UPB_TYPE_INT32,           /* INT32 */
+  UPB_TYPE_UINT64,          /* FIXED64 */
+  UPB_TYPE_UINT32,          /* FIXED32 */
+  UPB_TYPE_BOOL,            /* BOOL */
+  UPB_TYPE_STRING,          /* STRING */
+  UPB_TYPE_MESSAGE,         /* GROUP */
+  UPB_TYPE_MESSAGE,         /* MESSAGE */
+  UPB_TYPE_BYTES,           /* BYTES */
+  UPB_TYPE_UINT32,          /* UINT32 */
+  UPB_TYPE_ENUM,            /* ENUM */
+  UPB_TYPE_INT32,           /* SFIXED32 */
+  UPB_TYPE_INT64,           /* SFIXED64 */
+  UPB_TYPE_INT32,           /* SINT32 */
+  UPB_TYPE_INT64,           /* SINT64 */
+};
+
+/* Data pertaining to the parse. */
+typedef struct {
+  const char *ptr;           /* Current parsing position. */
+  const char *field_start;   /* Start of this field. */
+  const char *limit;         /* End of delimited region or end of buffer. */
+  upb_arena *arena;
+  int depth;
+  uint32_t end_group;  /* Set to field number of END_GROUP tag, if any. */
+} upb_decstate;
+
+/* Data passed by value to each parsing function. */
+typedef struct {
+  char *msg;
+  const upb_msglayout *layout;
+  upb_decstate *state;
+} upb_decframe;
+
+#define CHK(x) if (!(x)) { return 0; }
+
+static bool upb_skip_unknowngroup(upb_decstate *d, int field_number);
+static bool upb_decode_message(upb_decstate *d, char *msg,
+                               const upb_msglayout *l);
+
+static bool upb_decode_varint(const char **ptr, const char *limit,
+                              uint64_t *val) {
+  uint8_t byte;
+  int bitpos = 0;
+  const char *p = *ptr;
+  *val = 0;
+
+  do {
+    CHK(bitpos < 70 && p < limit);
+    byte = *p;
+    *val |= (uint64_t)(byte & 0x7F) << bitpos;
+    p++;
+    bitpos += 7;
+  } while (byte & 0x80);
+
+  *ptr = p;
+  return true;
+}
+
+static bool upb_decode_varint32(const char **ptr, const char *limit,
+                                uint32_t *val) {
+  uint64_t u64;
+  CHK(upb_decode_varint(ptr, limit, &u64) && u64 <= UINT32_MAX);
+  *val = (uint32_t)u64;
+  return true;
+}
+
+static bool upb_decode_64bit(const char **ptr, const char *limit,
+                             uint64_t *val) {
+  CHK(limit - *ptr >= 8);
+  memcpy(val, *ptr, 8);
+  *ptr += 8;
+  return true;
+}
+
+static bool upb_decode_32bit(const char **ptr, const char *limit,
+                             uint32_t *val) {
+  CHK(limit - *ptr >= 4);
+  memcpy(val, *ptr, 4);
+  *ptr += 4;
+  return true;
+}
+
+static int32_t upb_zzdecode_32(uint32_t n) {
+  return (n >> 1) ^ -(int32_t)(n & 1);
+}
+
+static int64_t upb_zzdecode_64(uint64_t n) {
+  return (n >> 1) ^ -(int64_t)(n & 1);
+}
+
+static bool upb_decode_string(const char **ptr, const char *limit,
+                              int *outlen) {
+  uint32_t len;
+
+  CHK(upb_decode_varint32(ptr, limit, &len) &&
+      len < INT32_MAX &&
+      limit - *ptr >= (int32_t)len);
+
+  *outlen = len;
+  return true;
+}
+
+static void upb_set32(void *msg, size_t ofs, uint32_t val) {
+  memcpy((char*)msg + ofs, &val, sizeof(val));
+}
+
+static bool upb_append_unknown(upb_decstate *d, upb_decframe *frame) {
+  upb_msg_addunknown(frame->msg, d->field_start, d->ptr - d->field_start,
+                     d->arena);
+  return true;
+}
+
+
+static bool upb_skip_unknownfielddata(upb_decstate *d, uint32_t tag,
+                                      uint32_t group_fieldnum) {
+  switch (tag & 7) {
+    case UPB_WIRE_TYPE_VARINT: {
+      uint64_t val;
+      return upb_decode_varint(&d->ptr, d->limit, &val);
+    }
+    case UPB_WIRE_TYPE_32BIT: {
+      uint32_t val;
+      return upb_decode_32bit(&d->ptr, d->limit, &val);
+    }
+    case UPB_WIRE_TYPE_64BIT: {
+      uint64_t val;
+      return upb_decode_64bit(&d->ptr, d->limit, &val);
+    }
+    case UPB_WIRE_TYPE_DELIMITED: {
+      int len;
+      CHK(upb_decode_string(&d->ptr, d->limit, &len));
+      d->ptr += len;
+      return true;
+    }
+    case UPB_WIRE_TYPE_START_GROUP:
+      return upb_skip_unknowngroup(d, tag >> 3);
+    case UPB_WIRE_TYPE_END_GROUP:
+      return (tag >> 3) == group_fieldnum;
+  }
+  return false;
+}
+
+static bool upb_skip_unknowngroup(upb_decstate *d, int field_number) {
+  while (d->ptr < d->limit && d->end_group == 0) {
+    uint32_t tag = 0;
+    CHK(upb_decode_varint32(&d->ptr, d->limit, &tag));
+    CHK(upb_skip_unknownfielddata(d, tag, field_number));
+  }
+
+  CHK(d->end_group == field_number);
+  d->end_group = 0;
+  return true;
+}
+
+static bool upb_array_grow(upb_array *arr, size_t elements, size_t elem_size,
+                           upb_arena *arena) {
+  size_t needed = arr->len + elements;
+  size_t new_size = UPB_MAX(arr->size, 8);
+  size_t new_bytes;
+  size_t old_bytes;
+  void *new_data;
+  upb_alloc *alloc = upb_arena_alloc(arena);
+
+  while (new_size < needed) {
+    new_size *= 2;
+  }
+
+  old_bytes = arr->len * elem_size;
+  new_bytes = new_size * elem_size;
+  new_data = upb_realloc(alloc, arr->data, old_bytes, new_bytes);
+  CHK(new_data);
+
+  arr->data = new_data;
+  arr->size = new_size;
+  return true;
+}
+
+static void *upb_array_reserve(upb_array *arr, size_t elements,
+                               size_t elem_size, upb_arena *arena) {
+  if (arr->size - arr->len < elements) {
+    CHK(upb_array_grow(arr, elements, elem_size, arena));
+  }
+  return (char*)arr->data + (arr->len * elem_size);
+}
+
+bool upb_array_add(upb_array *arr, size_t elements, size_t elem_size,
+                   const void *data, upb_arena *arena) {
+  void *dest = upb_array_reserve(arr, elements, elem_size, arena);
+
+  CHK(dest);
+  arr->len += elements;
+  memcpy(dest, data, elements * elem_size);
+
+  return true;
+}
+
+static upb_array *upb_getarr(upb_decframe *frame,
+                             const upb_msglayout_field *field) {
+  UPB_ASSERT(field->label == UPB_LABEL_REPEATED);
+  return *(upb_array**)&frame->msg[field->offset];
+}
+
+static upb_array *upb_getorcreatearr(upb_decframe *frame,
+                                     const upb_msglayout_field *field) {
+  upb_array *arr = upb_getarr(frame, field);
+
+  if (!arr) {
+    arr = upb_array_new(frame->state->arena);
+    CHK(arr);
+    *(upb_array**)&frame->msg[field->offset] = arr;
+  }
+
+  return arr;
+}
+
+static upb_msg *upb_getorcreatemsg(upb_decframe *frame,
+                                   const upb_msglayout_field *field,
+                                   const upb_msglayout **subm) {
+  upb_msg **submsg = (void*)(frame->msg + field->offset);
+  *subm = frame->layout->submsgs[field->submsg_index];
+
+  UPB_ASSERT(field->label != UPB_LABEL_REPEATED);
+
+  if (!*submsg) {
+    *submsg = upb_msg_new(*subm, frame->state->arena);
+    CHK(*submsg);
+  }
+
+  return *submsg;
+}
+
+static upb_msg *upb_addmsg(upb_decframe *frame,
+                           const upb_msglayout_field *field,
+                           const upb_msglayout **subm) {
+  upb_msg *submsg;
+  upb_array *arr = upb_getorcreatearr(frame, field);
+
+  *subm = frame->layout->submsgs[field->submsg_index];
+  submsg = upb_msg_new(*subm, frame->state->arena);
+  CHK(submsg);
+  upb_array_add(arr, 1, sizeof(submsg), &submsg, frame->state->arena);
+
+  return submsg;
+}
+
+static void upb_sethasbit(upb_decframe *frame,
+                          const upb_msglayout_field *field) {
+  int32_t hasbit = field->presence;
+  UPB_ASSERT(field->presence > 0);
+  frame->msg[hasbit / 8] |= (1 << (hasbit % 8));
+}
+
+static void upb_setoneofcase(upb_decframe *frame,
+                             const upb_msglayout_field *field) {
+  UPB_ASSERT(field->presence < 0);
+  upb_set32(frame->msg, ~field->presence, field->number);
+}
+
+static bool upb_decode_addval(upb_decframe *frame,
+                               const upb_msglayout_field *field, void *val,
+                               size_t size) {
+  char *field_mem = frame->msg + field->offset;
+  upb_array *arr;
+
+  if (field->label == UPB_LABEL_REPEATED) {
+    arr = upb_getorcreatearr(frame, field);
+    CHK(arr);
+    field_mem = upb_array_reserve(arr, 1, size, frame->state->arena);
+    CHK(field_mem);
+  }
+
+  memcpy(field_mem, val, size);
+  return true;
+}
+
+static void upb_decode_setpresent(upb_decframe *frame,
+                                  const upb_msglayout_field *field) {
+  if (field->label == UPB_LABEL_REPEATED) {
+   upb_array *arr = upb_getarr(frame, field);
+   UPB_ASSERT(arr->len < arr->size);
+   arr->len++;
+  } else if (field->presence < 0) {
+    upb_setoneofcase(frame, field);
+  } else if (field->presence > 0) {
+    upb_sethasbit(frame, field);
+  }
+}
+
+static bool upb_decode_msgfield(upb_decstate *d, upb_msg *msg,
+                                const upb_msglayout *layout, int limit) {
+  const char* saved_limit = d->limit;
+  d->limit = d->ptr + limit;
+  CHK(--d->depth >= 0);
+  upb_decode_message(d, msg, layout);
+  d->depth++;
+  d->limit = saved_limit;
+  CHK(d->end_group == 0);
+  return true;
+}
+
+static bool upb_decode_groupfield(upb_decstate *d, upb_msg *msg,
+                                  const upb_msglayout *layout,
+                                  int field_number) {
+  CHK(--d->depth >= 0);
+  upb_decode_message(d, msg, layout);
+  d->depth++;
+  CHK(d->end_group == field_number);
+  d->end_group = 0;
+  return true;
+}
+
+static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame,
+                                   const upb_msglayout_field *field) {
+  uint64_t val;
+  CHK(upb_decode_varint(&d->ptr, d->limit, &val));
+
+  switch (field->descriptortype) {
+    case UPB_DESCRIPTOR_TYPE_INT64:
+    case UPB_DESCRIPTOR_TYPE_UINT64:
+      CHK(upb_decode_addval(frame, field, &val, sizeof(val)));
+      break;
+    case UPB_DESCRIPTOR_TYPE_INT32:
+    case UPB_DESCRIPTOR_TYPE_UINT32:
+    case UPB_DESCRIPTOR_TYPE_ENUM: {
+      uint32_t val32 = (uint32_t)val;
+      CHK(upb_decode_addval(frame, field, &val32, sizeof(val32)));
+      break;
+    }
+    case UPB_DESCRIPTOR_TYPE_BOOL: {
+      bool valbool = val != 0;
+      CHK(upb_decode_addval(frame, field, &valbool, sizeof(valbool)));
+      break;
+    }
+    case UPB_DESCRIPTOR_TYPE_SINT32: {
+      int32_t decoded = upb_zzdecode_32((uint32_t)val);
+      CHK(upb_decode_addval(frame, field, &decoded, sizeof(decoded)));
+      break;
+    }
+    case UPB_DESCRIPTOR_TYPE_SINT64: {
+      int64_t decoded = upb_zzdecode_64(val);
+      CHK(upb_decode_addval(frame, field, &decoded, sizeof(decoded)));
+      break;
+    }
+    default:
+      return upb_append_unknown(d, frame);
+  }
+
+  upb_decode_setpresent(frame, field);
+  return true;
+}
+
+static bool upb_decode_64bitfield(upb_decstate *d, upb_decframe *frame,
+                                  const upb_msglayout_field *field) {
+  uint64_t val;
+  CHK(upb_decode_64bit(&d->ptr, d->limit, &val));
+
+  switch (field->descriptortype) {
+    case UPB_DESCRIPTOR_TYPE_DOUBLE:
+    case UPB_DESCRIPTOR_TYPE_FIXED64:
+    case UPB_DESCRIPTOR_TYPE_SFIXED64:
+      CHK(upb_decode_addval(frame, field, &val, sizeof(val)));
+      break;
+    default:
+      return upb_append_unknown(d, frame);
+  }
+
+  upb_decode_setpresent(frame, field);
+  return true;
+}
+
+static bool upb_decode_32bitfield(upb_decstate *d, upb_decframe *frame,
+                                  const upb_msglayout_field *field) {
+  uint32_t val;
+  CHK(upb_decode_32bit(&d->ptr, d->limit, &val));
+
+  switch (field->descriptortype) {
+    case UPB_DESCRIPTOR_TYPE_FLOAT:
+    case UPB_DESCRIPTOR_TYPE_FIXED32:
+    case UPB_DESCRIPTOR_TYPE_SFIXED32:
+      CHK(upb_decode_addval(frame, field, &val, sizeof(val)));
+      break;
+    default:
+      return upb_append_unknown(d, frame);
+  }
+
+  upb_decode_setpresent(frame, field);
+  return true;
+}
+
+static bool upb_decode_fixedpacked(upb_decstate *d, upb_array *arr,
+                                   uint32_t len, int elem_size) {
+  size_t elements = len / elem_size;
+
+  CHK((size_t)(elements * elem_size) == len);
+  CHK(upb_array_add(arr, elements, elem_size, d->ptr, d->arena));
+  d->ptr += len;
+
+  return true;
+}
+
+static upb_strview upb_decode_strfield(upb_decstate *d, uint32_t len) {
+  upb_strview ret;
+  ret.data = d->ptr;
+  ret.size = len;
+  d->ptr += len;
+  return ret;
+}
+
+static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame,
+                               const upb_msglayout_field *field, int len) {
+  upb_array *arr = upb_getorcreatearr(frame, field);
+  CHK(arr);
+
+#define VARINT_CASE(ctype, decode) \
+  VARINT_CASE_EX(ctype, decode, decode)
+
+#define VARINT_CASE_EX(ctype, decode, dtype)                           \
+  {                                                                    \
+    const char *ptr = d->ptr;                                          \
+    const char *limit = ptr + len;                                     \
+    while (ptr < limit) {                                              \
+      uint64_t val;                                                    \
+      ctype decoded;                                                   \
+      CHK(upb_decode_varint(&ptr, limit, &val));                       \
+      decoded = (decode)((dtype)val);                                  \
+      CHK(upb_array_add(arr, 1, sizeof(decoded), &decoded, d->arena)); \
+    }                                                                  \
+    d->ptr = ptr;                                                      \
+    return true;                                                       \
+  }
+
+  switch (field->descriptortype) {
+    case UPB_DESCRIPTOR_TYPE_STRING:
+    case UPB_DESCRIPTOR_TYPE_BYTES: {
+      upb_strview str = upb_decode_strfield(d, len);
+      return upb_array_add(arr, 1, sizeof(str), &str, d->arena);
+    }
+    case UPB_DESCRIPTOR_TYPE_FLOAT:
+    case UPB_DESCRIPTOR_TYPE_FIXED32:
+    case UPB_DESCRIPTOR_TYPE_SFIXED32:
+      return upb_decode_fixedpacked(d, arr, len, sizeof(int32_t));
+    case UPB_DESCRIPTOR_TYPE_DOUBLE:
+    case UPB_DESCRIPTOR_TYPE_FIXED64:
+    case UPB_DESCRIPTOR_TYPE_SFIXED64:
+      return upb_decode_fixedpacked(d, arr, len, sizeof(int64_t));
+    case UPB_DESCRIPTOR_TYPE_INT32:
+    case UPB_DESCRIPTOR_TYPE_UINT32:
+    case UPB_DESCRIPTOR_TYPE_ENUM:
+      VARINT_CASE(uint32_t, uint32_t);
+    case UPB_DESCRIPTOR_TYPE_INT64:
+    case UPB_DESCRIPTOR_TYPE_UINT64:
+      VARINT_CASE(uint64_t, uint64_t);
+    case UPB_DESCRIPTOR_TYPE_BOOL:
+      VARINT_CASE(bool, bool);
+    case UPB_DESCRIPTOR_TYPE_SINT32:
+      VARINT_CASE_EX(int32_t, upb_zzdecode_32, uint32_t);
+    case UPB_DESCRIPTOR_TYPE_SINT64:
+      VARINT_CASE_EX(int64_t, upb_zzdecode_64, uint64_t);
+    case UPB_DESCRIPTOR_TYPE_MESSAGE: {
+      const upb_msglayout *subm;
+      upb_msg *submsg = upb_addmsg(frame, field, &subm);
+      CHK(submsg);
+      return upb_decode_msgfield(d, submsg, subm, len);
+    }
+    case UPB_DESCRIPTOR_TYPE_GROUP:
+      return upb_append_unknown(d, frame);
+  }
+#undef VARINT_CASE
+  UPB_UNREACHABLE();
+}
+
+static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame,
+                                      const upb_msglayout_field *field) {
+  int len;
+
+  CHK(upb_decode_string(&d->ptr, d->limit, &len));
+
+  if (field->label == UPB_LABEL_REPEATED) {
+    return upb_decode_toarray(d, frame, field, len);
+  } else {
+    switch (field->descriptortype) {
+      case UPB_DESCRIPTOR_TYPE_STRING:
+      case UPB_DESCRIPTOR_TYPE_BYTES: {
+        upb_strview str = upb_decode_strfield(d, len);
+        CHK(upb_decode_addval(frame, field, &str, sizeof(str)));
+        break;
+      }
+      case UPB_DESCRIPTOR_TYPE_MESSAGE: {
+        const upb_msglayout *subm;
+        upb_msg *submsg = upb_getorcreatemsg(frame, field, &subm);
+        CHK(submsg);
+        CHK(upb_decode_msgfield(d, submsg, subm, len));
+        break;
+      }
+      default:
+        /* TODO(haberman): should we accept the last element of a packed? */
+        d->ptr += len;
+        return upb_append_unknown(d, frame);
+    }
+    upb_decode_setpresent(frame, field);
+    return true;
+  }
+}
+
+static const upb_msglayout_field *upb_find_field(const upb_msglayout *l,
+                                                 uint32_t field_number) {
+  /* Lots of optimization opportunities here. */
+  int i;
+  for (i = 0; i < l->field_count; i++) {
+    if (l->fields[i].number == field_number) {
+      return &l->fields[i];
+    }
+  }
+
+  return NULL;  /* Unknown field. */
+}
+
+static bool upb_decode_field(upb_decstate *d, upb_decframe *frame) {
+  uint32_t tag;
+  const upb_msglayout_field *field;
+  int field_number;
+
+  d->field_start = d->ptr;
+  CHK(upb_decode_varint32(&d->ptr, d->limit, &tag));
+  field_number = tag >> 3;
+  field = upb_find_field(frame->layout, field_number);
+
+  if (field) {
+    switch (tag & 7) {
+      case UPB_WIRE_TYPE_VARINT:
+        return upb_decode_varintfield(d, frame, field);
+      case UPB_WIRE_TYPE_32BIT:
+        return upb_decode_32bitfield(d, frame, field);
+      case UPB_WIRE_TYPE_64BIT:
+        return upb_decode_64bitfield(d, frame, field);
+      case UPB_WIRE_TYPE_DELIMITED:
+        return upb_decode_delimitedfield(d, frame, field);
+      case UPB_WIRE_TYPE_START_GROUP: {
+        const upb_msglayout *layout;
+        upb_msg *group;
+
+        if (field->label == UPB_LABEL_REPEATED) {
+          group = upb_addmsg(frame, field, &layout);
+        } else {
+          group = upb_getorcreatemsg(frame, field, &layout);
+        }
+
+        return upb_decode_groupfield(d, group, layout, field_number);
+      }
+      case UPB_WIRE_TYPE_END_GROUP:
+        d->end_group = field_number;
+        return true;
+      default:
+        CHK(false);
+    }
+  } else {
+    CHK(field_number != 0);
+    CHK(upb_skip_unknownfielddata(d, tag, -1));
+    CHK(upb_append_unknown(d, frame));
+    return true;
+  }
+}
+
+static bool upb_decode_message(upb_decstate *d, char *msg, const upb_msglayout *l) {
+  upb_decframe frame;
+  frame.msg = msg;
+  frame.layout = l;
+  frame.state = d;
+
+  while (d->ptr < d->limit) {
+    CHK(upb_decode_field(d, &frame));
+  }
+
+  return true;
+}
+
+bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l,
+                upb_arena *arena) {
+  upb_decstate state;
+  state.ptr = buf;
+  state.limit = buf + size;
+  state.arena = arena;
+  state.depth = 64;
+  state.end_group = 0;
+
+  CHK(upb_decode_message(&state, msg, l));
+  return state.end_group == 0;
+}
+
+#undef CHK
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/decode.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/decode.h
new file mode 100644 (file)
index 0000000..9de8638
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+** upb_decode: parsing into a upb_msg using a upb_msglayout.
+*/
+
+#ifndef UPB_DECODE_H_
+#define UPB_DECODE_H_
+
+#include "upb/msg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool upb_decode(const char *buf, size_t size, upb_msg *msg,
+                const upb_msglayout *l, upb_arena *arena);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif  /* UPB_DECODE_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/def.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/def.c
new file mode 100644 (file)
index 0000000..005c012
--- /dev/null
@@ -0,0 +1,1755 @@
+
+#include "upb/def.h"
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include "google/protobuf/descriptor.upb.h"
+
+#include "upb/port_def.inc"
+
+typedef struct {
+  size_t len;
+  char str[1];  /* Null-terminated string data follows. */
+} str_t;
+
+static str_t *newstr(upb_alloc *alloc, const char *data, size_t len) {
+  str_t *ret = upb_malloc(alloc, sizeof(*ret) + len);
+  if (!ret) return NULL;
+  ret->len = len;
+  memcpy(ret->str, data, len);
+  ret->str[len] = '\0';
+  return ret;
+}
+
+struct upb_fielddef {
+  const upb_filedef *file;
+  const upb_msgdef *msgdef;
+  const char *full_name;
+  union {
+    int64_t sint;
+    uint64_t uint;
+    double dbl;
+    float flt;
+    bool boolean;
+    str_t *str;
+  } defaultval;
+  const upb_oneofdef *oneof;
+  union {
+    const upb_msgdef *msgdef;
+    const upb_enumdef *enumdef;
+    const google_protobuf_FieldDescriptorProto *unresolved;
+  } sub;
+  uint32_t number_;
+  uint32_t index_;
+  uint32_t selector_base;  /* Used to index into a upb::Handlers table. */
+  bool is_extension_;
+  bool lazy_;
+  bool packed_;
+  upb_descriptortype_t type_;
+  upb_label_t label_;
+};
+
+struct upb_msgdef {
+  const upb_filedef *file;
+  const char *full_name;
+  uint32_t selector_count;
+  uint32_t submsg_field_count;
+
+  /* Tables for looking up fields by number and name. */
+  upb_inttable itof;
+  upb_strtable ntof;
+
+  const upb_fielddef *fields;
+  const upb_oneofdef *oneofs;
+  int field_count;
+  int oneof_count;
+
+  /* Is this a map-entry message? */
+  bool map_entry;
+  upb_wellknowntype_t well_known_type;
+
+  /* TODO(haberman): proper extension ranges (there can be multiple). */
+};
+
+struct upb_enumdef {
+  const upb_filedef *file;
+  const char *full_name;
+  upb_strtable ntoi;
+  upb_inttable iton;
+  int32_t defaultval;
+};
+
+struct upb_oneofdef {
+  const upb_msgdef *parent;
+  const char *full_name;
+  uint32_t index;
+  upb_strtable ntof;
+  upb_inttable itof;
+};
+
+struct upb_filedef {
+  const char *name;
+  const char *package;
+  const char *phpprefix;
+  const char *phpnamespace;
+  upb_syntax_t syntax;
+
+  const upb_filedef **deps;
+  const upb_msgdef *msgs;
+  const upb_enumdef *enums;
+  const upb_fielddef *exts;
+
+  int dep_count;
+  int msg_count;
+  int enum_count;
+  int ext_count;
+};
+
+struct upb_symtab {
+  upb_arena *arena;
+  upb_strtable syms;  /* full_name -> packed def ptr */
+  upb_strtable files;  /* file_name -> upb_filedef* */
+};
+
+/* Inside a symtab we store tagged pointers to specific def types. */
+typedef enum {
+  UPB_DEFTYPE_MSG = 0,
+  UPB_DEFTYPE_ENUM = 1,
+  UPB_DEFTYPE_FIELD = 2,
+  UPB_DEFTYPE_ONEOF = 3
+} upb_deftype_t;
+
+static const void *unpack_def(upb_value v, upb_deftype_t type) {
+  uintptr_t num = (uintptr_t)upb_value_getconstptr(v);
+  return (num & 3) == type ? (const void*)(num & ~3) : NULL;
+}
+
+static upb_value pack_def(const void *ptr, upb_deftype_t type) {
+  uintptr_t num = (uintptr_t)ptr | type;
+  return upb_value_constptr((const void*)num);
+}
+
+/* isalpha() etc. from <ctype.h> are locale-dependent, which we don't want. */
+static bool upb_isbetween(char c, char low, char high) {
+  return c >= low && c <= high;
+}
+
+static bool upb_isletter(char c) {
+  return upb_isbetween(c, 'A', 'Z') || upb_isbetween(c, 'a', 'z') || c == '_';
+}
+
+static bool upb_isalphanum(char c) {
+  return upb_isletter(c) || upb_isbetween(c, '0', '9');
+}
+
+static bool upb_isident(upb_strview name, bool full, upb_status *s) {
+  const char *str = name.data;
+  size_t len = name.size;
+  bool start = true;
+  size_t i;
+  for (i = 0; i < len; i++) {
+    char c = str[i];
+    if (c == '.') {
+      if (start || !full) {
+        upb_status_seterrf(s, "invalid name: unexpected '.' (%s)", str);
+        return false;
+      }
+      start = true;
+    } else if (start) {
+      if (!upb_isletter(c)) {
+        upb_status_seterrf(
+            s, "invalid name: path components must start with a letter (%s)",
+            str);
+        return false;
+      }
+      start = false;
+    } else {
+      if (!upb_isalphanum(c)) {
+        upb_status_seterrf(s, "invalid name: non-alphanumeric character (%s)",
+                           str);
+        return false;
+      }
+    }
+  }
+  return !start;
+}
+
+static const char *shortdefname(const char *fullname) {
+  const char *p;
+
+  if (fullname == NULL) {
+    return NULL;
+  } else if ((p = strrchr(fullname, '.')) == NULL) {
+    /* No '.' in the name, return the full string. */
+    return fullname;
+  } else {
+    /* Return one past the last '.'. */
+    return p + 1;
+  }
+}
+
+/* All submessage fields are lower than all other fields.
+ * Secondly, fields are increasing in order. */
+uint32_t field_rank(const upb_fielddef *f) {
+  uint32_t ret = upb_fielddef_number(f);
+  const uint32_t high_bit = 1 << 30;
+  UPB_ASSERT(ret < high_bit);
+  if (!upb_fielddef_issubmsg(f))
+    ret |= high_bit;
+  return ret;
+}
+
+int cmp_fields(const void *p1, const void *p2) {
+  const upb_fielddef *f1 = *(upb_fielddef*const*)p1;
+  const upb_fielddef *f2 = *(upb_fielddef*const*)p2;
+  return field_rank(f1) - field_rank(f2);
+}
+
+/* A few implementation details of handlers.  We put these here to avoid
+ * a def -> handlers dependency. */
+
+#define UPB_STATIC_SELECTOR_COUNT 3  /* Warning: also in upb/handlers.h. */
+
+static uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f) {
+  return upb_fielddef_isseq(f) ? 2 : 0;
+}
+
+static uint32_t upb_handlers_selectorcount(const upb_fielddef *f) {
+  uint32_t ret = 1;
+  if (upb_fielddef_isseq(f)) ret += 2;    /* STARTSEQ/ENDSEQ */
+  if (upb_fielddef_isstring(f)) ret += 2; /* [STRING]/STARTSTR/ENDSTR */
+  if (upb_fielddef_issubmsg(f)) {
+    /* ENDSUBMSG (STARTSUBMSG is at table beginning) */
+    ret += 0;
+    if (upb_fielddef_lazy(f)) {
+      /* STARTSTR/ENDSTR/STRING (for lazy) */
+      ret += 3;
+    }
+  }
+  return ret;
+}
+
+static bool assign_msg_indices(upb_msgdef *m, upb_status *s) {
+  /* Sort fields.  upb internally relies on UPB_TYPE_MESSAGE fields having the
+   * lowest indexes, but we do not publicly guarantee this. */
+  upb_msg_field_iter j;
+  upb_msg_oneof_iter k;
+  int i;
+  uint32_t selector;
+  int n = upb_msgdef_numfields(m);
+  upb_fielddef **fields;
+
+  if (n == 0) {
+    m->selector_count = UPB_STATIC_SELECTOR_COUNT;
+    m->submsg_field_count = 0;
+    return true;
+  }
+
+  fields = upb_gmalloc(n * sizeof(*fields));
+  if (!fields) {
+    upb_status_setoom(s);
+    return false;
+  }
+
+  m->submsg_field_count = 0;
+  for(i = 0, upb_msg_field_begin(&j, m);
+      !upb_msg_field_done(&j);
+      upb_msg_field_next(&j), i++) {
+    upb_fielddef *f = upb_msg_iter_field(&j);
+    UPB_ASSERT(f->msgdef == m);
+    if (upb_fielddef_issubmsg(f)) {
+      m->submsg_field_count++;
+    }
+    fields[i] = f;
+  }
+
+  qsort(fields, n, sizeof(*fields), cmp_fields);
+
+  selector = UPB_STATIC_SELECTOR_COUNT + m->submsg_field_count;
+  for (i = 0; i < n; i++) {
+    upb_fielddef *f = fields[i];
+    f->index_ = i;
+    f->selector_base = selector + upb_handlers_selectorbaseoffset(f);
+    selector += upb_handlers_selectorcount(f);
+  }
+  m->selector_count = selector;
+
+  for(upb_msg_oneof_begin(&k, m), i = 0;
+      !upb_msg_oneof_done(&k);
+      upb_msg_oneof_next(&k), i++) {
+    upb_oneofdef *o = (upb_oneofdef*)upb_msg_iter_oneof(&k);
+    o->index = i;
+  }
+
+  upb_gfree(fields);
+  return true;
+}
+
+static void assign_msg_wellknowntype(upb_msgdef *m) {
+  const char *name = upb_msgdef_fullname(m);
+  if (name == NULL) {
+    m->well_known_type = UPB_WELLKNOWN_UNSPECIFIED;
+    return;
+  }
+  if (!strcmp(name, "google.protobuf.Any")) {
+    m->well_known_type = UPB_WELLKNOWN_ANY;
+  } else if (!strcmp(name, "google.protobuf.FieldMask")) {
+    m->well_known_type = UPB_WELLKNOWN_FIELDMASK;
+  } else if (!strcmp(name, "google.protobuf.Duration")) {
+    m->well_known_type = UPB_WELLKNOWN_DURATION;
+  } else if (!strcmp(name, "google.protobuf.Timestamp")) {
+    m->well_known_type = UPB_WELLKNOWN_TIMESTAMP;
+  } else if (!strcmp(name, "google.protobuf.DoubleValue")) {
+    m->well_known_type = UPB_WELLKNOWN_DOUBLEVALUE;
+  } else if (!strcmp(name, "google.protobuf.FloatValue")) {
+    m->well_known_type = UPB_WELLKNOWN_FLOATVALUE;
+  } else if (!strcmp(name, "google.protobuf.Int64Value")) {
+    m->well_known_type = UPB_WELLKNOWN_INT64VALUE;
+  } else if (!strcmp(name, "google.protobuf.UInt64Value")) {
+    m->well_known_type = UPB_WELLKNOWN_UINT64VALUE;
+  } else if (!strcmp(name, "google.protobuf.Int32Value")) {
+    m->well_known_type = UPB_WELLKNOWN_INT32VALUE;
+  } else if (!strcmp(name, "google.protobuf.UInt32Value")) {
+    m->well_known_type = UPB_WELLKNOWN_UINT32VALUE;
+  } else if (!strcmp(name, "google.protobuf.BoolValue")) {
+    m->well_known_type = UPB_WELLKNOWN_BOOLVALUE;
+  } else if (!strcmp(name, "google.protobuf.StringValue")) {
+    m->well_known_type = UPB_WELLKNOWN_STRINGVALUE;
+  } else if (!strcmp(name, "google.protobuf.BytesValue")) {
+    m->well_known_type = UPB_WELLKNOWN_BYTESVALUE;
+  } else if (!strcmp(name, "google.protobuf.Value")) {
+    m->well_known_type = UPB_WELLKNOWN_VALUE;
+  } else if (!strcmp(name, "google.protobuf.ListValue")) {
+    m->well_known_type = UPB_WELLKNOWN_LISTVALUE;
+  } else if (!strcmp(name, "google.protobuf.Struct")) {
+    m->well_known_type = UPB_WELLKNOWN_STRUCT;
+  } else {
+    m->well_known_type = UPB_WELLKNOWN_UNSPECIFIED;
+  }
+}
+
+
+/* upb_enumdef ****************************************************************/
+
+const char *upb_enumdef_fullname(const upb_enumdef *e) {
+  return e->full_name;
+}
+
+const char *upb_enumdef_name(const upb_enumdef *e) {
+  return shortdefname(e->full_name);
+}
+
+const upb_filedef *upb_enumdef_file(const upb_enumdef *e) {
+  return e->file;
+}
+
+int32_t upb_enumdef_default(const upb_enumdef *e) {
+  UPB_ASSERT(upb_enumdef_iton(e, e->defaultval));
+  return e->defaultval;
+}
+
+int upb_enumdef_numvals(const upb_enumdef *e) {
+  return upb_strtable_count(&e->ntoi);
+}
+
+void upb_enum_begin(upb_enum_iter *i, const upb_enumdef *e) {
+  /* We iterate over the ntoi table, to account for duplicate numbers. */
+  upb_strtable_begin(i, &e->ntoi);
+}
+
+void upb_enum_next(upb_enum_iter *iter) { upb_strtable_next(iter); }
+bool upb_enum_done(upb_enum_iter *iter) { return upb_strtable_done(iter); }
+
+bool upb_enumdef_ntoi(const upb_enumdef *def, const char *name,
+                      size_t len, int32_t *num) {
+  upb_value v;
+  if (!upb_strtable_lookup2(&def->ntoi, name, len, &v)) {
+    return false;
+  }
+  if (num) *num = upb_value_getint32(v);
+  return true;
+}
+
+const char *upb_enumdef_iton(const upb_enumdef *def, int32_t num) {
+  upb_value v;
+  return upb_inttable_lookup32(&def->iton, num, &v) ?
+      upb_value_getcstr(v) : NULL;
+}
+
+const char *upb_enum_iter_name(upb_enum_iter *iter) {
+  return upb_strtable_iter_key(iter);
+}
+
+int32_t upb_enum_iter_number(upb_enum_iter *iter) {
+  return upb_value_getint32(upb_strtable_iter_value(iter));
+}
+
+
+/* upb_fielddef ***************************************************************/
+
+const char *upb_fielddef_fullname(const upb_fielddef *f) {
+  return f->full_name;
+}
+
+upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f) {
+  switch (f->type_) {
+    case UPB_DESCRIPTOR_TYPE_DOUBLE:
+      return UPB_TYPE_DOUBLE;
+    case UPB_DESCRIPTOR_TYPE_FLOAT:
+      return UPB_TYPE_FLOAT;
+    case UPB_DESCRIPTOR_TYPE_INT64:
+    case UPB_DESCRIPTOR_TYPE_SINT64:
+    case UPB_DESCRIPTOR_TYPE_SFIXED64:
+      return UPB_TYPE_INT64;
+    case UPB_DESCRIPTOR_TYPE_INT32:
+    case UPB_DESCRIPTOR_TYPE_SFIXED32:
+    case UPB_DESCRIPTOR_TYPE_SINT32:
+      return UPB_TYPE_INT32;
+    case UPB_DESCRIPTOR_TYPE_UINT64:
+    case UPB_DESCRIPTOR_TYPE_FIXED64:
+      return UPB_TYPE_UINT64;
+    case UPB_DESCRIPTOR_TYPE_UINT32:
+    case UPB_DESCRIPTOR_TYPE_FIXED32:
+      return UPB_TYPE_UINT32;
+    case UPB_DESCRIPTOR_TYPE_ENUM:
+      return UPB_TYPE_ENUM;
+    case UPB_DESCRIPTOR_TYPE_BOOL:
+      return UPB_TYPE_BOOL;
+    case UPB_DESCRIPTOR_TYPE_STRING:
+      return UPB_TYPE_STRING;
+    case UPB_DESCRIPTOR_TYPE_BYTES:
+      return UPB_TYPE_BYTES;
+    case UPB_DESCRIPTOR_TYPE_GROUP:
+    case UPB_DESCRIPTOR_TYPE_MESSAGE:
+      return UPB_TYPE_MESSAGE;
+  }
+  UPB_UNREACHABLE();
+}
+
+upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f) {
+  return f->type_;
+}
+
+uint32_t upb_fielddef_index(const upb_fielddef *f) {
+  return f->index_;
+}
+
+upb_label_t upb_fielddef_label(const upb_fielddef *f) {
+  return f->label_;
+}
+
+uint32_t upb_fielddef_number(const upb_fielddef *f) {
+  return f->number_;
+}
+
+bool upb_fielddef_isextension(const upb_fielddef *f) {
+  return f->is_extension_;
+}
+
+bool upb_fielddef_lazy(const upb_fielddef *f) {
+  return f->lazy_;
+}
+
+bool upb_fielddef_packed(const upb_fielddef *f) {
+  return f->packed_;
+}
+
+const char *upb_fielddef_name(const upb_fielddef *f) {
+  return shortdefname(f->full_name);
+}
+
+uint32_t upb_fielddef_selectorbase(const upb_fielddef *f) {
+  return f->selector_base;
+}
+
+size_t upb_fielddef_getjsonname(const upb_fielddef *f, char *buf, size_t len) {
+  const char *name = upb_fielddef_name(f);
+  size_t src, dst = 0;
+  bool ucase_next = false;
+
+#define WRITE(byte) \
+  ++dst; \
+  if (dst < len) buf[dst - 1] = byte; \
+  else if (dst == len) buf[dst - 1] = '\0'
+
+  if (!name) {
+    WRITE('\0');
+    return 0;
+  }
+
+  /* Implement the transformation as described in the spec:
+   *   1. upper case all letters after an underscore.
+   *   2. remove all underscores.
+   */
+  for (src = 0; name[src]; src++) {
+    if (name[src] == '_') {
+      ucase_next = true;
+      continue;
+    }
+
+    if (ucase_next) {
+      WRITE(toupper(name[src]));
+      ucase_next = false;
+    } else {
+      WRITE(name[src]);
+    }
+  }
+
+  WRITE('\0');
+  return dst;
+
+#undef WRITE
+}
+
+const upb_msgdef *upb_fielddef_containingtype(const upb_fielddef *f) {
+  return f->msgdef;
+}
+
+const upb_oneofdef *upb_fielddef_containingoneof(const upb_fielddef *f) {
+  return f->oneof;
+}
+
+static void chkdefaulttype(const upb_fielddef *f, int ctype) {
+  UPB_UNUSED(f);
+  UPB_UNUSED(ctype);
+}
+
+int64_t upb_fielddef_defaultint64(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_INT64);
+  return f->defaultval.sint;
+}
+
+int32_t upb_fielddef_defaultint32(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_INT32);
+  return f->defaultval.sint;
+}
+
+uint64_t upb_fielddef_defaultuint64(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_UINT64);
+  return f->defaultval.uint;
+}
+
+uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_UINT32);
+  return f->defaultval.uint;
+}
+
+bool upb_fielddef_defaultbool(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_BOOL);
+  return f->defaultval.boolean;
+}
+
+float upb_fielddef_defaultfloat(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_FLOAT);
+  return f->defaultval.flt;
+}
+
+double upb_fielddef_defaultdouble(const upb_fielddef *f) {
+  chkdefaulttype(f, UPB_TYPE_DOUBLE);
+  return f->defaultval.dbl;
+}
+
+const char *upb_fielddef_defaultstr(const upb_fielddef *f, size_t *len) {
+  str_t *str = f->defaultval.str;
+  UPB_ASSERT(upb_fielddef_type(f) == UPB_TYPE_STRING ||
+         upb_fielddef_type(f) == UPB_TYPE_BYTES ||
+         upb_fielddef_type(f) == UPB_TYPE_ENUM);
+  if (str) {
+    if (len) *len = str->len;
+    return str->str;
+  } else {
+    if (len) *len = 0;
+    return NULL;
+  }
+}
+
+const upb_msgdef *upb_fielddef_msgsubdef(const upb_fielddef *f) {
+  UPB_ASSERT(upb_fielddef_type(f) == UPB_TYPE_MESSAGE);
+  return f->sub.msgdef;
+}
+
+const upb_enumdef *upb_fielddef_enumsubdef(const upb_fielddef *f) {
+  UPB_ASSERT(upb_fielddef_type(f) == UPB_TYPE_ENUM);
+  return f->sub.enumdef;
+}
+
+bool upb_fielddef_issubmsg(const upb_fielddef *f) {
+  return upb_fielddef_type(f) == UPB_TYPE_MESSAGE;
+}
+
+bool upb_fielddef_isstring(const upb_fielddef *f) {
+  return upb_fielddef_type(f) == UPB_TYPE_STRING ||
+         upb_fielddef_type(f) == UPB_TYPE_BYTES;
+}
+
+bool upb_fielddef_isseq(const upb_fielddef *f) {
+  return upb_fielddef_label(f) == UPB_LABEL_REPEATED;
+}
+
+bool upb_fielddef_isprimitive(const upb_fielddef *f) {
+  return !upb_fielddef_isstring(f) && !upb_fielddef_issubmsg(f);
+}
+
+bool upb_fielddef_ismap(const upb_fielddef *f) {
+  return upb_fielddef_isseq(f) && upb_fielddef_issubmsg(f) &&
+         upb_msgdef_mapentry(upb_fielddef_msgsubdef(f));
+}
+
+bool upb_fielddef_hassubdef(const upb_fielddef *f) {
+  return upb_fielddef_issubmsg(f) || upb_fielddef_type(f) == UPB_TYPE_ENUM;
+}
+
+bool upb_fielddef_haspresence(const upb_fielddef *f) {
+  if (upb_fielddef_isseq(f)) return false;
+  if (upb_fielddef_issubmsg(f)) return true;
+  return f->file->syntax == UPB_SYNTAX_PROTO2;
+}
+
+static bool between(int32_t x, int32_t low, int32_t high) {
+  return x >= low && x <= high;
+}
+
+bool upb_fielddef_checklabel(int32_t label) { return between(label, 1, 3); }
+bool upb_fielddef_checktype(int32_t type) { return between(type, 1, 11); }
+bool upb_fielddef_checkintfmt(int32_t fmt) { return between(fmt, 1, 3); }
+
+bool upb_fielddef_checkdescriptortype(int32_t type) {
+  return between(type, 1, 18);
+}
+
+/* upb_msgdef *****************************************************************/
+
+const char *upb_msgdef_fullname(const upb_msgdef *m) {
+  return m->full_name;
+}
+
+const upb_filedef *upb_msgdef_file(const upb_msgdef *m) {
+  return m->file;
+}
+
+const char *upb_msgdef_name(const upb_msgdef *m) {
+  return shortdefname(m->full_name);
+}
+
+upb_syntax_t upb_msgdef_syntax(const upb_msgdef *m) {
+  return m->file->syntax;
+}
+
+size_t upb_msgdef_selectorcount(const upb_msgdef *m) {
+  return m->selector_count;
+}
+
+uint32_t upb_msgdef_submsgfieldcount(const upb_msgdef *m) {
+  return m->submsg_field_count;
+}
+
+const upb_fielddef *upb_msgdef_itof(const upb_msgdef *m, uint32_t i) {
+  upb_value val;
+  return upb_inttable_lookup32(&m->itof, i, &val) ?
+      upb_value_getconstptr(val) : NULL;
+}
+
+const upb_fielddef *upb_msgdef_ntof(const upb_msgdef *m, const char *name,
+                                    size_t len) {
+  upb_value val;
+
+  if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
+    return NULL;
+  }
+
+  return unpack_def(val, UPB_DEFTYPE_FIELD);
+}
+
+const upb_oneofdef *upb_msgdef_ntoo(const upb_msgdef *m, const char *name,
+                                    size_t len) {
+  upb_value val;
+
+  if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
+    return NULL;
+  }
+
+  return unpack_def(val, UPB_DEFTYPE_ONEOF);
+}
+
+bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len,
+                           const upb_fielddef **f, const upb_oneofdef **o) {
+  upb_value val;
+
+  if (!upb_strtable_lookup2(&m->ntof, name, len, &val)) {
+    return false;
+  }
+
+  *o = unpack_def(val, UPB_DEFTYPE_ONEOF);
+  *f = unpack_def(val, UPB_DEFTYPE_FIELD);
+  UPB_ASSERT((*o != NULL) ^ (*f != NULL));  /* Exactly one of the two should be set. */
+  return true;
+}
+
+int upb_msgdef_numfields(const upb_msgdef *m) {
+  /* The number table contains only fields. */
+  return upb_inttable_count(&m->itof);
+}
+
+int upb_msgdef_numoneofs(const upb_msgdef *m) {
+  /* The name table includes oneofs, and the number table does not. */
+  return upb_strtable_count(&m->ntof) - upb_inttable_count(&m->itof);
+}
+
+bool upb_msgdef_mapentry(const upb_msgdef *m) {
+  return m->map_entry;
+}
+
+upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m) {
+  return m->well_known_type;
+}
+
+bool upb_msgdef_isnumberwrapper(const upb_msgdef *m) {
+  upb_wellknowntype_t type = upb_msgdef_wellknowntype(m);
+  return type >= UPB_WELLKNOWN_DOUBLEVALUE &&
+         type <= UPB_WELLKNOWN_UINT32VALUE;
+}
+
+void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m) {
+  upb_inttable_begin(iter, &m->itof);
+}
+
+void upb_msg_field_next(upb_msg_field_iter *iter) { upb_inttable_next(iter); }
+
+bool upb_msg_field_done(const upb_msg_field_iter *iter) {
+  return upb_inttable_done(iter);
+}
+
+upb_fielddef *upb_msg_iter_field(const upb_msg_field_iter *iter) {
+  return (upb_fielddef *)upb_value_getconstptr(upb_inttable_iter_value(iter));
+}
+
+void upb_msg_field_iter_setdone(upb_msg_field_iter *iter) {
+  upb_inttable_iter_setdone(iter);
+}
+
+bool upb_msg_field_iter_isequal(const upb_msg_field_iter * iter1,
+                                const upb_msg_field_iter * iter2) {
+  return upb_inttable_iter_isequal(iter1, iter2);
+}
+
+void upb_msg_oneof_begin(upb_msg_oneof_iter *iter, const upb_msgdef *m) {
+  upb_strtable_begin(iter, &m->ntof);
+  /* We need to skip past any initial fields. */
+  while (!upb_strtable_done(iter) &&
+         !unpack_def(upb_strtable_iter_value(iter), UPB_DEFTYPE_ONEOF)) {
+    upb_strtable_next(iter);
+  }
+}
+
+void upb_msg_oneof_next(upb_msg_oneof_iter *iter) {
+  /* We need to skip past fields to return only oneofs. */
+  do {
+    upb_strtable_next(iter);
+  } while (!upb_strtable_done(iter) &&
+           !unpack_def(upb_strtable_iter_value(iter), UPB_DEFTYPE_ONEOF));
+}
+
+bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter) {
+  return upb_strtable_done(iter);
+}
+
+const upb_oneofdef *upb_msg_iter_oneof(const upb_msg_oneof_iter *iter) {
+  return unpack_def(upb_strtable_iter_value(iter), UPB_DEFTYPE_ONEOF);
+}
+
+void upb_msg_oneof_iter_setdone(upb_msg_oneof_iter *iter) {
+  upb_strtable_iter_setdone(iter);
+}
+
+bool upb_msg_oneof_iter_isequal(const upb_msg_oneof_iter *iter1,
+                                const upb_msg_oneof_iter *iter2) {
+  return upb_strtable_iter_isequal(iter1, iter2);
+}
+
+/* upb_oneofdef ***************************************************************/
+
+const char *upb_oneofdef_name(const upb_oneofdef *o) {
+  return shortdefname(o->full_name);
+}
+
+const upb_msgdef *upb_oneofdef_containingtype(const upb_oneofdef *o) {
+  return o->parent;
+}
+
+int upb_oneofdef_numfields(const upb_oneofdef *o) {
+  return upb_strtable_count(&o->ntof);
+}
+
+uint32_t upb_oneofdef_index(const upb_oneofdef *o) {
+  return o->index;
+}
+
+const upb_fielddef *upb_oneofdef_ntof(const upb_oneofdef *o,
+                                      const char *name, size_t length) {
+  upb_value val;
+  return upb_strtable_lookup2(&o->ntof, name, length, &val) ?
+      upb_value_getptr(val) : NULL;
+}
+
+const upb_fielddef *upb_oneofdef_itof(const upb_oneofdef *o, uint32_t num) {
+  upb_value val;
+  return upb_inttable_lookup32(&o->itof, num, &val) ?
+      upb_value_getptr(val) : NULL;
+}
+
+void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o) {
+  upb_inttable_begin(iter, &o->itof);
+}
+
+void upb_oneof_next(upb_oneof_iter *iter) {
+  upb_inttable_next(iter);
+}
+
+bool upb_oneof_done(upb_oneof_iter *iter) {
+  return upb_inttable_done(iter);
+}
+
+upb_fielddef *upb_oneof_iter_field(const upb_oneof_iter *iter) {
+  return (upb_fielddef *)upb_value_getconstptr(upb_inttable_iter_value(iter));
+}
+
+void upb_oneof_iter_setdone(upb_oneof_iter *iter) {
+  upb_inttable_iter_setdone(iter);
+}
+
+/* Code to build defs from descriptor protos. *********************************/
+
+/* There is a question of how much validation to do here.  It will be difficult
+ * to perfectly match the amount of validation performed by proto2.  But since
+ * this code is used to directly build defs from Ruby (for example) we do need
+ * to validate important constraints like uniqueness of names and numbers. */
+
+#define CHK(x) if (!(x)) { return false; }
+#define CHK_OOM(x) if (!(x)) { upb_status_setoom(ctx->status); return false; }
+
+typedef struct {
+  const upb_symtab *symtab;
+  upb_filedef *file;  /* File we are building. */
+  upb_alloc *alloc;    /* Allocate defs here. */
+  upb_alloc *tmp;      /* Alloc for addtab and any other tmp data. */
+  upb_strtable *addtab;  /* full_name -> packed def ptr for new defs. */
+  upb_status *status;  /* Record errors here. */
+} symtab_addctx;
+
+static char* strviewdup(const symtab_addctx *ctx, upb_strview view) {
+  return upb_strdup2(view.data, view.size, ctx->alloc);
+}
+
+static bool streql2(const char *a, size_t n, const char *b) {
+  return n == strlen(b) && memcmp(a, b, n) == 0;
+}
+
+static bool streql_view(upb_strview view, const char *b) {
+  return streql2(view.data, view.size, b);
+}
+
+static const char *makefullname(const symtab_addctx *ctx, const char *prefix,
+                                upb_strview name) {
+  if (prefix) {
+    /* ret = prefix + '.' + name; */
+    size_t n = strlen(prefix);
+    char *ret = upb_malloc(ctx->alloc, n + name.size + 2);
+    CHK_OOM(ret);
+    strcpy(ret, prefix);
+    ret[n] = '.';
+    memcpy(&ret[n + 1], name.data, name.size);
+    ret[n + 1 + name.size] = '\0';
+    return ret;
+  } else {
+    return strviewdup(ctx, name);
+  }
+}
+
+static bool symtab_add(const symtab_addctx *ctx, const char *name,
+                       upb_value v) {
+  upb_value tmp;
+  if (upb_strtable_lookup(ctx->addtab, name, &tmp) ||
+      upb_strtable_lookup(&ctx->symtab->syms, name, &tmp)) {
+    upb_status_seterrf(ctx->status, "duplicate symbol '%s'", name);
+    return false;
+  }
+
+  CHK_OOM(upb_strtable_insert3(ctx->addtab, name, strlen(name), v, ctx->tmp));
+  return true;
+}
+
+/* Given a symbol and the base symbol inside which it is defined, find the
+ * symbol's definition in t. */
+static bool resolvename(const upb_strtable *t, const upb_fielddef *f,
+                        const char *base, upb_strview sym,
+                        upb_deftype_t type, upb_status *status,
+                        const void **def) {
+  if(sym.size == 0) return NULL;
+  if(sym.data[0] == '.') {
+    /* Symbols starting with '.' are absolute, so we do a single lookup.
+     * Slice to omit the leading '.' */
+    upb_value v;
+    if (!upb_strtable_lookup2(t, sym.data + 1, sym.size - 1, &v)) {
+      return false;
+    }
+
+    *def = unpack_def(v, type);
+
+    if (!*def) {
+      upb_status_seterrf(status,
+                         "type mismatch when resolving field %s, name %s",
+                         f->full_name, sym.data);
+      return false;
+    }
+
+    return true;
+  } else {
+    /* Remove components from base until we find an entry or run out.
+     * TODO: This branch is totally broken, but currently not used. */
+    (void)base;
+    UPB_ASSERT(false);
+    return false;
+  }
+}
+
+const void *symtab_resolve(const symtab_addctx *ctx, const upb_fielddef *f,
+                           const char *base, upb_strview sym,
+                           upb_deftype_t type) {
+  const void *ret;
+  if (!resolvename(ctx->addtab, f, base, sym, type, ctx->status, &ret) &&
+      !resolvename(&ctx->symtab->syms, f, base, sym, type, ctx->status, &ret)) {
+    if (upb_ok(ctx->status)) {
+      upb_status_seterrf(ctx->status, "couldn't resolve name '%s'", sym.data);
+    }
+    return false;
+  }
+  return ret;
+}
+
+static bool create_oneofdef(
+    const symtab_addctx *ctx, upb_msgdef *m,
+    const google_protobuf_OneofDescriptorProto *oneof_proto) {
+  upb_oneofdef *o;
+  upb_strview name = google_protobuf_OneofDescriptorProto_name(oneof_proto);
+  upb_value v;
+
+  o = (upb_oneofdef*)&m->oneofs[m->oneof_count++];
+  o->parent = m;
+  o->full_name = makefullname(ctx, m->full_name, name);
+
+  v = pack_def(o, UPB_DEFTYPE_ONEOF);
+  CHK_OOM(symtab_add(ctx, o->full_name, v));
+  CHK_OOM(upb_strtable_insert3(&m->ntof, name.data, name.size, v, ctx->alloc));
+
+  CHK_OOM(upb_inttable_init2(&o->itof, UPB_CTYPE_CONSTPTR, ctx->alloc));
+  CHK_OOM(upb_strtable_init2(&o->ntof, UPB_CTYPE_CONSTPTR, ctx->alloc));
+
+  return true;
+}
+
+static bool parse_default(const symtab_addctx *ctx, const char *str, size_t len,
+                          upb_fielddef *f) {
+  char *end;
+  char nullz[64];
+  errno = 0;
+
+  switch (upb_fielddef_type(f)) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_UINT64:
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_FLOAT:
+      /* Standard C number parsing functions expect null-terminated strings. */
+      if (len >= sizeof(nullz) - 1) {
+        return false;
+      }
+      memcpy(nullz, str, len);
+      nullz[len] = '\0';
+      str = nullz;
+      break;
+    default:
+      break;
+  }
+
+  switch (upb_fielddef_type(f)) {
+    case UPB_TYPE_INT32: {
+      long val = strtol(str, &end, 0);
+      CHK(val <= INT32_MAX && val >= INT32_MIN && errno != ERANGE && !*end);
+      f->defaultval.sint = val;
+      break;
+    }
+    case UPB_TYPE_ENUM: {
+      const upb_enumdef *e = f->sub.enumdef;
+      int32_t val;
+      CHK(upb_enumdef_ntoi(e, str, len, &val));
+      f->defaultval.sint = val;
+      break;
+    }
+    case UPB_TYPE_INT64: {
+      /* XXX: Need to write our own strtoll, since it's not available in c89. */
+      long long val = strtol(str, &end, 0);
+      CHK(val <= INT64_MAX && val >= INT64_MIN && errno != ERANGE && !*end);
+      f->defaultval.sint = val;
+      break;
+    }
+    case UPB_TYPE_UINT32: {
+      unsigned long val = strtoul(str, &end, 0);
+      CHK(val <= UINT32_MAX && errno != ERANGE && !*end);
+      f->defaultval.uint = val;
+      break;
+    }
+    case UPB_TYPE_UINT64: {
+      /* XXX: Need to write our own strtoull, since it's not available in c89. */
+      unsigned long long val = strtoul(str, &end, 0);
+      CHK(val <= UINT64_MAX && errno != ERANGE && !*end);
+      f->defaultval.uint = val;
+      break;
+    }
+    case UPB_TYPE_DOUBLE: {
+      double val = strtod(str, &end);
+      CHK(errno != ERANGE && !*end);
+      f->defaultval.dbl = val;
+      break;
+    }
+    case UPB_TYPE_FLOAT: {
+      /* XXX: Need to write our own strtof, since it's not available in c89. */
+      float val = strtod(str, &end);
+      CHK(errno != ERANGE && !*end);
+      f->defaultval.flt = val;
+      break;
+    }
+    case UPB_TYPE_BOOL: {
+      if (streql2(str, len, "false")) {
+        f->defaultval.boolean = false;
+      } else if (streql2(str, len, "true")) {
+        f->defaultval.boolean = true;
+      } else {
+        return false;
+      }
+    }
+    case UPB_TYPE_STRING:
+      f->defaultval.str = newstr(ctx->alloc, str, len);
+      break;
+    case UPB_TYPE_BYTES:
+      /* XXX: need to interpret the C-escaped value. */
+      f->defaultval.str = newstr(ctx->alloc, str, len);
+      break;
+    case UPB_TYPE_MESSAGE:
+      /* Should not have a default value. */
+      return false;
+  }
+  return true;
+}
+
+static void set_default_default(const symtab_addctx *ctx, upb_fielddef *f) {
+  switch (upb_fielddef_type(f)) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_ENUM:
+      f->defaultval.sint = 0;
+      break;
+    case UPB_TYPE_UINT64:
+    case UPB_TYPE_UINT32:
+      f->defaultval.uint = 0;
+      break;
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_FLOAT:
+      f->defaultval.dbl = 0;
+      break;
+    case UPB_TYPE_STRING:
+    case UPB_TYPE_BYTES:
+      f->defaultval.str = newstr(ctx->alloc, NULL, 0);
+      break;
+    case UPB_TYPE_BOOL:
+      f->defaultval.boolean = false;
+      break;
+    case UPB_TYPE_MESSAGE:
+      break;
+  }
+}
+
+static bool create_fielddef(
+    const symtab_addctx *ctx, const char *prefix, upb_msgdef *m,
+    const google_protobuf_FieldDescriptorProto *field_proto) {
+  upb_alloc *alloc = ctx->alloc;
+  upb_fielddef *f;
+  const google_protobuf_FieldOptions *options;
+  upb_strview name;
+  const char *full_name;
+  const char *shortname;
+  uint32_t field_number;
+
+  if (!google_protobuf_FieldDescriptorProto_has_name(field_proto)) {
+    upb_status_seterrmsg(ctx->status, "field has no name");
+    return false;
+  }
+
+  name = google_protobuf_FieldDescriptorProto_name(field_proto);
+  CHK(upb_isident(name, false, ctx->status));
+  full_name = makefullname(ctx, prefix, name);
+  shortname = shortdefname(full_name);
+
+  field_number = google_protobuf_FieldDescriptorProto_number(field_proto);
+
+  if (field_number == 0 || field_number > UPB_MAX_FIELDNUMBER) {
+    upb_status_seterrf(ctx->status, "invalid field number (%u)", field_number);
+    return false;
+  }
+
+  if (m) {
+    /* direct message field. */
+    upb_value v, packed_v;
+
+    f = (upb_fielddef*)&m->fields[m->field_count++];
+    f->msgdef = m;
+    f->is_extension_ = false;
+
+    packed_v = pack_def(f, UPB_DEFTYPE_FIELD);
+    v = upb_value_constptr(f);
+
+    if (!upb_strtable_insert3(&m->ntof, name.data, name.size, packed_v, alloc)) {
+      upb_status_seterrf(ctx->status, "duplicate field name (%s)", shortname);
+      return false;
+    }
+
+    if (!upb_inttable_insert2(&m->itof, field_number, v, alloc)) {
+      upb_status_seterrf(ctx->status, "duplicate field number (%u)",
+                         field_number);
+      return false;
+    }
+  } else {
+    /* extension field. */
+    f = (upb_fielddef*)&ctx->file->exts[ctx->file->ext_count];
+    f->is_extension_ = true;
+    CHK_OOM(symtab_add(ctx, full_name, pack_def(f, UPB_DEFTYPE_FIELD)));
+  }
+
+  f->full_name = full_name;
+  f->file = ctx->file;
+  f->type_ = (int)google_protobuf_FieldDescriptorProto_type(field_proto);
+  f->label_ = (int)google_protobuf_FieldDescriptorProto_label(field_proto);
+  f->number_ = field_number;
+  f->oneof = NULL;
+
+  /* We can't resolve the subdef or (in the case of extensions) the containing
+   * message yet, because it may not have been defined yet.  We stash a pointer
+   * to the field_proto until later when we can properly resolve it. */
+  f->sub.unresolved = field_proto;
+
+  if (f->label_ == UPB_LABEL_REQUIRED && f->file->syntax == UPB_SYNTAX_PROTO3) {
+    upb_status_seterrf(ctx->status, "proto3 fields cannot be required (%s)",
+                       f->full_name);
+    return false;
+  }
+
+  if (google_protobuf_FieldDescriptorProto_has_oneof_index(field_proto)) {
+    int oneof_index =
+        google_protobuf_FieldDescriptorProto_oneof_index(field_proto);
+    upb_oneofdef *oneof;
+    upb_value v = upb_value_constptr(f);
+
+    if (upb_fielddef_label(f) != UPB_LABEL_OPTIONAL) {
+      upb_status_seterrf(ctx->status,
+                         "fields in oneof must have OPTIONAL label (%s)",
+                         f->full_name);
+      return false;
+    }
+
+    if (!m) {
+      upb_status_seterrf(ctx->status,
+                         "oneof_index provided for extension field (%s)",
+                         f->full_name);
+      return false;
+    }
+
+    if (oneof_index >= m->oneof_count) {
+      upb_status_seterrf(ctx->status, "oneof_index out of range (%s)",
+                         f->full_name);
+      return false;
+    }
+
+    oneof = (upb_oneofdef*)&m->oneofs[oneof_index];
+    f->oneof = oneof;
+
+    CHK(upb_inttable_insert2(&oneof->itof, f->number_, v, alloc));
+    CHK(upb_strtable_insert3(&oneof->ntof, name.data, name.size, v, alloc));
+  } else {
+    f->oneof = NULL;
+  }
+
+  if (google_protobuf_FieldDescriptorProto_has_options(field_proto)) {
+    options = google_protobuf_FieldDescriptorProto_options(field_proto);
+    f->lazy_ = google_protobuf_FieldOptions_lazy(options);
+    f->packed_ = google_protobuf_FieldOptions_packed(options);
+  } else {
+    f->lazy_ = false;
+    f->packed_ = false;
+  }
+
+  return true;
+}
+
+static bool create_enumdef(
+    const symtab_addctx *ctx, const char *prefix,
+    const google_protobuf_EnumDescriptorProto *enum_proto) {
+  upb_enumdef *e;
+  const google_protobuf_EnumValueDescriptorProto *const *values;
+  upb_strview name;
+  size_t i, n;
+
+  name = google_protobuf_EnumDescriptorProto_name(enum_proto);
+  CHK(upb_isident(name, false, ctx->status));
+
+  e = (upb_enumdef*)&ctx->file->enums[ctx->file->enum_count++];
+  e->full_name = makefullname(ctx, prefix, name);
+  CHK_OOM(symtab_add(ctx, e->full_name, pack_def(e, UPB_DEFTYPE_ENUM)));
+
+  CHK_OOM(upb_strtable_init2(&e->ntoi, UPB_CTYPE_INT32, ctx->alloc));
+  CHK_OOM(upb_inttable_init2(&e->iton, UPB_CTYPE_CSTR, ctx->alloc));
+
+  e->file = ctx->file;
+  e->defaultval = 0;
+
+  values = google_protobuf_EnumDescriptorProto_value(enum_proto, &n);
+
+  if (n == 0) {
+    upb_status_seterrf(ctx->status,
+                       "enums must contain at least one value (%s)",
+                       e->full_name);
+    return false;
+  }
+
+  for (i = 0; i < n; i++) {
+    const google_protobuf_EnumValueDescriptorProto *value = values[i];
+    upb_strview name = google_protobuf_EnumValueDescriptorProto_name(value);
+    char *name2 = strviewdup(ctx, name);
+    int32_t num = google_protobuf_EnumValueDescriptorProto_number(value);
+    upb_value v = upb_value_int32(num);
+
+    if (i == 0 && e->file->syntax == UPB_SYNTAX_PROTO3 && num != 0) {
+      upb_status_seterrf(ctx->status,
+                         "for proto3, the first enum value must be zero (%s)",
+                         e->full_name);
+      return false;
+    }
+
+    if (upb_strtable_lookup(&e->ntoi, name2, NULL)) {
+      upb_status_seterrf(ctx->status, "duplicate enum label '%s'", name2);
+      return false;
+    }
+
+    CHK_OOM(name2)
+    CHK_OOM(
+        upb_strtable_insert3(&e->ntoi, name2, strlen(name2), v, ctx->alloc));
+
+    if (!upb_inttable_lookup(&e->iton, num, NULL)) {
+      upb_value v = upb_value_cstr(name2);
+      CHK_OOM(upb_inttable_insert2(&e->iton, num, v, ctx->alloc));
+    }
+  }
+
+  upb_inttable_compact2(&e->iton, ctx->alloc);
+
+  return true;
+}
+
+static bool create_msgdef(const symtab_addctx *ctx, const char *prefix,
+                          const google_protobuf_DescriptorProto *msg_proto) {
+  upb_msgdef *m;
+  const google_protobuf_MessageOptions *options;
+  const google_protobuf_OneofDescriptorProto *const *oneofs;
+  const google_protobuf_FieldDescriptorProto *const *fields;
+  const google_protobuf_EnumDescriptorProto *const *enums;
+  const google_protobuf_DescriptorProto *const *msgs;
+  size_t i, n;
+  upb_strview name;
+
+  name = google_protobuf_DescriptorProto_name(msg_proto);
+  CHK(upb_isident(name, false, ctx->status));
+
+  m = (upb_msgdef*)&ctx->file->msgs[ctx->file->msg_count++];
+  m->full_name = makefullname(ctx, prefix, name);
+  CHK_OOM(symtab_add(ctx, m->full_name, pack_def(m, UPB_DEFTYPE_MSG)));
+
+  CHK_OOM(upb_inttable_init2(&m->itof, UPB_CTYPE_CONSTPTR, ctx->alloc));
+  CHK_OOM(upb_strtable_init2(&m->ntof, UPB_CTYPE_CONSTPTR, ctx->alloc));
+
+  m->file = ctx->file;
+  m->map_entry = false;
+
+  options = google_protobuf_DescriptorProto_options(msg_proto);
+
+  if (options) {
+    m->map_entry = google_protobuf_MessageOptions_map_entry(options);
+  }
+
+  oneofs = google_protobuf_DescriptorProto_oneof_decl(msg_proto, &n);
+  m->oneof_count = 0;
+  m->oneofs = upb_malloc(ctx->alloc, sizeof(*m->oneofs) * n);
+  for (i = 0; i < n; i++) {
+    CHK(create_oneofdef(ctx, m, oneofs[i]));
+  }
+
+  fields = google_protobuf_DescriptorProto_field(msg_proto, &n);
+  m->field_count = 0;
+  m->fields = upb_malloc(ctx->alloc, sizeof(*m->fields) * n);
+  for (i = 0; i < n; i++) {
+    CHK(create_fielddef(ctx, m->full_name, m, fields[i]));
+  }
+
+  CHK(assign_msg_indices(m, ctx->status));
+  assign_msg_wellknowntype(m);
+  upb_inttable_compact2(&m->itof, ctx->alloc);
+
+  /* This message is built.  Now build nested messages and enums. */
+
+  enums = google_protobuf_DescriptorProto_enum_type(msg_proto, &n);
+  for (i = 0; i < n; i++) {
+    CHK(create_enumdef(ctx, m->full_name, enums[i]));
+  }
+
+  msgs = google_protobuf_DescriptorProto_nested_type(msg_proto, &n);
+  for (i = 0; i < n; i++) {
+    CHK(create_msgdef(ctx, m->full_name, msgs[i]));
+  }
+
+  return true;
+}
+
+typedef struct {
+  int msg_count;
+  int enum_count;
+  int ext_count;
+} decl_counts;
+
+static void count_types_in_msg(const google_protobuf_DescriptorProto *msg_proto,
+                               decl_counts *counts) {
+  const google_protobuf_DescriptorProto *const *msgs;
+  size_t i, n;
+
+  counts->msg_count++;
+
+  msgs = google_protobuf_DescriptorProto_nested_type(msg_proto, &n);
+  for (i = 0; i < n; i++) {
+    count_types_in_msg(msgs[i], counts);
+  }
+
+  google_protobuf_DescriptorProto_enum_type(msg_proto, &n);
+  counts->enum_count += n;
+
+  google_protobuf_DescriptorProto_extension(msg_proto, &n);
+  counts->ext_count += n;
+}
+
+static void count_types_in_file(
+    const google_protobuf_FileDescriptorProto *file_proto,
+    decl_counts *counts) {
+  const google_protobuf_DescriptorProto *const *msgs;
+  size_t i, n;
+
+  msgs = google_protobuf_FileDescriptorProto_message_type(file_proto, &n);
+  for (i = 0; i < n; i++) {
+    count_types_in_msg(msgs[i], counts);
+  }
+
+  google_protobuf_FileDescriptorProto_enum_type(file_proto, &n);
+  counts->enum_count += n;
+
+  google_protobuf_FileDescriptorProto_extension(file_proto, &n);
+  counts->ext_count += n;
+}
+
+static bool resolve_fielddef(const symtab_addctx *ctx, const char *prefix,
+                             upb_fielddef *f) {
+  upb_strview name;
+  const google_protobuf_FieldDescriptorProto *field_proto = f->sub.unresolved;
+
+  if (f->is_extension_) {
+    if (!google_protobuf_FieldDescriptorProto_has_extendee(field_proto)) {
+      upb_status_seterrf(ctx->status,
+                         "extension for field '%s' had no extendee",
+                         f->full_name);
+      return false;
+    }
+
+    name = google_protobuf_FieldDescriptorProto_extendee(field_proto);
+    f->msgdef = symtab_resolve(ctx, f, prefix, name, UPB_DEFTYPE_MSG);
+    CHK(f->msgdef);
+  }
+
+  if ((upb_fielddef_issubmsg(f) || f->type_ == UPB_DESCRIPTOR_TYPE_ENUM) &&
+      !google_protobuf_FieldDescriptorProto_has_type_name(field_proto)) {
+    upb_status_seterrf(ctx->status, "field '%s' is missing type name",
+                       f->full_name);
+    return false;
+  }
+
+  name = google_protobuf_FieldDescriptorProto_type_name(field_proto);
+
+  if (upb_fielddef_issubmsg(f)) {
+    f->sub.msgdef = symtab_resolve(ctx, f, prefix, name, UPB_DEFTYPE_MSG);
+    CHK(f->sub.msgdef);
+  } else if (f->type_ == UPB_DESCRIPTOR_TYPE_ENUM) {
+    f->sub.enumdef = symtab_resolve(ctx, f, prefix, name, UPB_DEFTYPE_ENUM);
+    CHK(f->sub.enumdef);
+  }
+
+  /* Have to delay resolving of the default value until now because of the enum
+   * case, since enum defaults are specified with a label. */
+  if (google_protobuf_FieldDescriptorProto_has_default_value(field_proto)) {
+    upb_strview defaultval =
+        google_protobuf_FieldDescriptorProto_default_value(field_proto);
+
+    if (f->file->syntax == UPB_SYNTAX_PROTO3) {
+      upb_status_seterrf(ctx->status,
+                         "proto3 fields cannot have explicit defaults (%s)",
+                         f->full_name);
+      return false;
+    }
+
+    if (upb_fielddef_issubmsg(f)) {
+      upb_status_seterrf(ctx->status,
+                         "message fields cannot have explicit defaults (%s)",
+                         f->full_name);
+      return false;
+    }
+
+    if (!parse_default(ctx, defaultval.data, defaultval.size, f)) {
+      upb_status_seterrf(ctx->status,
+                         "couldn't parse default '" UPB_STRVIEW_FORMAT
+                         "' for field (%s)",
+                         UPB_STRVIEW_ARGS(defaultval), f->full_name);
+      return false;
+    }
+  } else {
+    set_default_default(ctx, f);
+  }
+
+  return true;
+}
+
+static bool build_filedef(
+    const symtab_addctx *ctx, upb_filedef *file,
+    const google_protobuf_FileDescriptorProto *file_proto) {
+  upb_alloc *alloc = ctx->alloc;
+  const google_protobuf_FileOptions *file_options_proto;
+  const google_protobuf_DescriptorProto *const *msgs;
+  const google_protobuf_EnumDescriptorProto *const *enums;
+  const google_protobuf_FieldDescriptorProto *const *exts;
+  const upb_strview* strs;
+  size_t i, n;
+  decl_counts counts = {0};
+
+  count_types_in_file(file_proto, &counts);
+
+  file->msgs = upb_malloc(alloc, sizeof(*file->msgs) * counts.msg_count);
+  file->enums = upb_malloc(alloc, sizeof(*file->enums) * counts.enum_count);
+  file->exts = upb_malloc(alloc, sizeof(*file->exts) * counts.ext_count);
+
+  CHK_OOM(counts.msg_count == 0 || file->msgs);
+  CHK_OOM(counts.enum_count == 0 || file->enums);
+  CHK_OOM(counts.ext_count == 0 || file->exts);
+
+  /* We increment these as defs are added. */
+  file->msg_count = 0;
+  file->enum_count = 0;
+  file->ext_count = 0;
+
+  if (!google_protobuf_FileDescriptorProto_has_name(file_proto)) {
+    upb_status_seterrmsg(ctx->status, "File has no name");
+    return false;
+  }
+
+  file->name =
+      strviewdup(ctx, google_protobuf_FileDescriptorProto_name(file_proto));
+  file->phpprefix = NULL;
+  file->phpnamespace = NULL;
+
+  if (google_protobuf_FileDescriptorProto_has_package(file_proto)) {
+    upb_strview package =
+        google_protobuf_FileDescriptorProto_package(file_proto);
+    CHK(upb_isident(package, true, ctx->status));
+    file->package = strviewdup(ctx, package);
+  } else {
+    file->package = NULL;
+  }
+
+  if (google_protobuf_FileDescriptorProto_has_syntax(file_proto)) {
+    upb_strview syntax =
+        google_protobuf_FileDescriptorProto_syntax(file_proto);
+
+    if (streql_view(syntax, "proto2")) {
+      file->syntax = UPB_SYNTAX_PROTO2;
+    } else if (streql_view(syntax, "proto3")) {
+      file->syntax = UPB_SYNTAX_PROTO3;
+    } else {
+      upb_status_seterrf(ctx->status, "Invalid syntax '%s'", syntax);
+      return false;
+    }
+  } else {
+    file->syntax = UPB_SYNTAX_PROTO2;
+  }
+
+  /* Read options. */
+  file_options_proto = google_protobuf_FileDescriptorProto_options(file_proto);
+  if (file_options_proto) {
+    if (google_protobuf_FileOptions_has_php_class_prefix(file_options_proto)) {
+      file->phpprefix = strviewdup(
+          ctx,
+          google_protobuf_FileOptions_php_class_prefix(file_options_proto));
+    }
+    if (google_protobuf_FileOptions_has_php_namespace(file_options_proto)) {
+      file->phpnamespace = strviewdup(
+          ctx, google_protobuf_FileOptions_php_namespace(file_options_proto));
+    }
+  }
+
+  /* Verify dependencies. */
+  strs = google_protobuf_FileDescriptorProto_dependency(file_proto, &n);
+  file->deps = upb_malloc(alloc, sizeof(*file->deps) * n) ;
+  CHK_OOM(n == 0 || file->deps);
+
+  for (i = 0; i < n; i++) {
+    upb_strview dep_name = strs[i];
+    upb_value v;
+    if (!upb_strtable_lookup2(&ctx->symtab->files, dep_name.data,
+                              dep_name.size, &v)) {
+      upb_status_seterrf(ctx->status,
+                         "Depends on file '" UPB_STRVIEW_FORMAT
+                         "', but it has not been loaded",
+                         UPB_STRVIEW_ARGS(dep_name));
+      return false;
+    }
+    file->deps[i] = upb_value_getconstptr(v);
+  }
+
+  /* Create messages. */
+  msgs = google_protobuf_FileDescriptorProto_message_type(file_proto, &n);
+  for (i = 0; i < n; i++) {
+    CHK(create_msgdef(ctx, file->package, msgs[i]));
+  }
+
+  /* Create enums. */
+  enums = google_protobuf_FileDescriptorProto_enum_type(file_proto, &n);
+  for (i = 0; i < n; i++) {
+    CHK(create_enumdef(ctx, file->package, enums[i]));
+  }
+
+  /* Create extensions. */
+  exts = google_protobuf_FileDescriptorProto_extension(file_proto, &n);
+  file->exts = upb_malloc(alloc, sizeof(*file->exts) * n);
+  CHK_OOM(n == 0 || file->exts);
+  for (i = 0; i < n; i++) {
+    CHK(create_fielddef(ctx, file->package, NULL, exts[i]));
+  }
+
+  /* Now that all names are in the table, resolve references. */
+  for (i = 0; i < file->ext_count; i++) {
+    CHK(resolve_fielddef(ctx, file->package, (upb_fielddef*)&file->exts[i]));
+  }
+
+  for (i = 0; i < file->msg_count; i++) {
+    const upb_msgdef *m = &file->msgs[i];
+    int j;
+    for (j = 0; j < m->field_count; j++) {
+      CHK(resolve_fielddef(ctx, m->full_name, (upb_fielddef*)&m->fields[j]));
+    }
+  }
+
+  return true;
+ }
+
+static bool upb_symtab_addtotabs(upb_symtab *s, symtab_addctx *ctx,
+                                 upb_status *status) {
+  const upb_filedef *file = ctx->file;
+  upb_alloc *alloc = upb_arena_alloc(s->arena);
+  upb_strtable_iter iter;
+
+  CHK_OOM(upb_strtable_insert3(&s->files, file->name, strlen(file->name),
+                               upb_value_constptr(file), alloc));
+
+  upb_strtable_begin(&iter, ctx->addtab);
+  for (; !upb_strtable_done(&iter); upb_strtable_next(&iter)) {
+    const char *key = upb_strtable_iter_key(&iter);
+    size_t keylen = upb_strtable_iter_keylength(&iter);
+    upb_value value = upb_strtable_iter_value(&iter);
+    CHK_OOM(upb_strtable_insert3(&s->syms, key, keylen, value, alloc));
+  }
+
+  return true;
+}
+
+/* upb_filedef ****************************************************************/
+
+const char *upb_filedef_name(const upb_filedef *f) {
+  return f->name;
+}
+
+const char *upb_filedef_package(const upb_filedef *f) {
+  return f->package;
+}
+
+const char *upb_filedef_phpprefix(const upb_filedef *f) {
+  return f->phpprefix;
+}
+
+const char *upb_filedef_phpnamespace(const upb_filedef *f) {
+  return f->phpnamespace;
+}
+
+upb_syntax_t upb_filedef_syntax(const upb_filedef *f) {
+  return f->syntax;
+}
+
+int upb_filedef_msgcount(const upb_filedef *f) {
+  return f->msg_count;
+}
+
+int upb_filedef_depcount(const upb_filedef *f) {
+  return f->dep_count;
+}
+
+int upb_filedef_enumcount(const upb_filedef *f) {
+  return f->enum_count;
+}
+
+const upb_filedef *upb_filedef_dep(const upb_filedef *f, int i) {
+  return i < 0 || i >= f->dep_count ? NULL : f->deps[i];
+}
+
+const upb_msgdef *upb_filedef_msg(const upb_filedef *f, int i) {
+  return i < 0 || i >= f->msg_count ? NULL : &f->msgs[i];
+}
+
+const upb_enumdef *upb_filedef_enum(const upb_filedef *f, int i) {
+  return i < 0 || i >= f->enum_count ? NULL : &f->enums[i];
+}
+
+void upb_symtab_free(upb_symtab *s) {
+  upb_arena_free(s->arena);
+  upb_gfree(s);
+}
+
+upb_symtab *upb_symtab_new(void) {
+  upb_symtab *s = upb_gmalloc(sizeof(*s));
+  upb_alloc *alloc;
+
+  if (!s) {
+    return NULL;
+  }
+
+  s->arena = upb_arena_new();
+  alloc = upb_arena_alloc(s->arena);
+
+  if (!upb_strtable_init2(&s->syms, UPB_CTYPE_CONSTPTR, alloc) ||
+      !upb_strtable_init2(&s->files, UPB_CTYPE_CONSTPTR, alloc)) {
+    upb_arena_free(s->arena);
+    upb_gfree(s);
+    s = NULL;
+  }
+  return s;
+}
+
+const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym) {
+  upb_value v;
+  return upb_strtable_lookup(&s->syms, sym, &v) ?
+      unpack_def(v, UPB_DEFTYPE_MSG) : NULL;
+}
+
+const upb_msgdef *upb_symtab_lookupmsg2(const upb_symtab *s, const char *sym,
+                                        size_t len) {
+  upb_value v;
+  return upb_strtable_lookup2(&s->syms, sym, len, &v) ?
+      unpack_def(v, UPB_DEFTYPE_MSG) : NULL;
+}
+
+const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym) {
+  upb_value v;
+  return upb_strtable_lookup(&s->syms, sym, &v) ?
+      unpack_def(v, UPB_DEFTYPE_ENUM) : NULL;
+}
+
+const upb_filedef *upb_symtab_lookupfile(const upb_symtab *s, const char *name) {
+  upb_value v;
+  return upb_strtable_lookup(&s->files, name, &v) ? upb_value_getconstptr(v)
+                                                  : NULL;
+}
+
+const upb_filedef *upb_symtab_addfile(
+    upb_symtab *s, const google_protobuf_FileDescriptorProto *file_proto,
+    upb_status *status) {
+  upb_arena *tmparena = upb_arena_new();
+  upb_strtable addtab;
+  upb_alloc *alloc = upb_arena_alloc(s->arena);
+  upb_filedef *file = upb_malloc(alloc, sizeof(*file));
+  bool ok;
+  symtab_addctx ctx;
+
+  ctx.file = file;
+  ctx.symtab = s;
+  ctx.alloc = alloc;
+  ctx.tmp = upb_arena_alloc(tmparena);
+  ctx.addtab = &addtab;
+  ctx.status = status;
+
+  ok = file &&
+      upb_strtable_init2(&addtab, UPB_CTYPE_CONSTPTR, ctx.tmp) &&
+      build_filedef(&ctx, file, file_proto) &&
+      upb_symtab_addtotabs(s, &ctx, status);
+
+  upb_arena_free(tmparena);
+  return ok ? file : NULL;
+}
+
+/* Include here since we want most of this file to be stdio-free. */
+#include <stdio.h>
+
+bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init) {
+  /* Since this function should never fail (it would indicate a bug in upb) we
+   * print errors to stderr instead of returning error status to the user. */
+  upb_def_init **deps = init->deps;
+  google_protobuf_FileDescriptorProto *file;
+  upb_arena *arena;
+  upb_status status;
+
+  upb_status_clear(&status);
+
+  if (upb_strtable_lookup(&s->files, init->filename, NULL)) {
+    return true;
+  }
+
+  arena = upb_arena_new();
+
+  for (; *deps; deps++) {
+    if (!_upb_symtab_loaddefinit(s, *deps)) goto err;
+  }
+
+  file = google_protobuf_FileDescriptorProto_parse(
+      init->descriptor.data, init->descriptor.size, arena);
+
+  if (!file) {
+    upb_status_seterrf(
+        &status,
+        "Failed to parse compiled-in descriptor for file '%s'. This should "
+        "never happen.",
+        init->filename);
+    goto err;
+  }
+
+  if (!upb_symtab_addfile(s, file, &status)) goto err;
+
+  upb_arena_free(arena);
+  return true;
+
+err:
+  fprintf(stderr, "Error loading compiled-in descriptor: %s\n",
+          upb_status_errmsg(&status));
+  upb_arena_free(arena);
+  return false;
+}
+
+#undef CHK
+#undef CHK_OOM
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/def.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/def.h
new file mode 100644 (file)
index 0000000..9be2857
--- /dev/null
@@ -0,0 +1,909 @@
+/*
+** Defs are upb's internal representation of the constructs that can appear
+** in a .proto file:
+**
+** - upb::MessageDefPtr (upb_msgdef): describes a "message" construct.
+** - upb::FieldDefPtr (upb_fielddef): describes a message field.
+** - upb::FileDefPtr (upb_filedef): describes a .proto file and its defs.
+** - upb::EnumDefPtr (upb_enumdef): describes an enum.
+** - upb::OneofDefPtr (upb_oneofdef): describes a oneof.
+**
+** TODO: definitions of services.
+**
+** This is a mixed C/C++ interface that offers a full API to both languages.
+** See the top-level README for more information.
+*/
+
+#ifndef UPB_DEF_H_
+#define UPB_DEF_H_
+
+#include "upb/upb.h"
+#include "upb/table.int.h"
+#include "google/protobuf/descriptor.upb.h"
+
+#ifdef __cplusplus
+#include <cstring>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace upb {
+class EnumDefPtr;
+class FieldDefPtr;
+class FileDefPtr;
+class MessageDefPtr;
+class OneofDefPtr;
+class SymbolTable;
+}
+#endif
+
+#include "upb/port_def.inc"
+
+struct upb_enumdef;
+typedef struct upb_enumdef upb_enumdef;
+struct upb_fielddef;
+typedef struct upb_fielddef upb_fielddef;
+struct upb_filedef;
+typedef struct upb_filedef upb_filedef;
+struct upb_msgdef;
+typedef struct upb_msgdef upb_msgdef;
+struct upb_oneofdef;
+typedef struct upb_oneofdef upb_oneofdef;
+struct upb_symtab;
+typedef struct upb_symtab upb_symtab;
+
+typedef enum {
+  UPB_SYNTAX_PROTO2 = 2,
+  UPB_SYNTAX_PROTO3 = 3
+} upb_syntax_t;
+
+/* All the different kind of well known type messages. For simplicity of check,
+ * number wrappers and string wrappers are grouped together. Make sure the
+ * order and merber of these groups are not changed.
+ */
+typedef enum {
+  UPB_WELLKNOWN_UNSPECIFIED,
+  UPB_WELLKNOWN_ANY,
+  UPB_WELLKNOWN_FIELDMASK,
+  UPB_WELLKNOWN_DURATION,
+  UPB_WELLKNOWN_TIMESTAMP,
+  /* number wrappers */
+  UPB_WELLKNOWN_DOUBLEVALUE,
+  UPB_WELLKNOWN_FLOATVALUE,
+  UPB_WELLKNOWN_INT64VALUE,
+  UPB_WELLKNOWN_UINT64VALUE,
+  UPB_WELLKNOWN_INT32VALUE,
+  UPB_WELLKNOWN_UINT32VALUE,
+  /* string wrappers */
+  UPB_WELLKNOWN_STRINGVALUE,
+  UPB_WELLKNOWN_BYTESVALUE,
+  UPB_WELLKNOWN_BOOLVALUE,
+  UPB_WELLKNOWN_VALUE,
+  UPB_WELLKNOWN_LISTVALUE,
+  UPB_WELLKNOWN_STRUCT
+} upb_wellknowntype_t;
+
+/* upb_fielddef ***************************************************************/
+
+/* Maximum field number allowed for FieldDefs.  This is an inherent limit of the
+ * protobuf wire format. */
+#define UPB_MAX_FIELDNUMBER ((1 << 29) - 1)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char *upb_fielddef_fullname(const upb_fielddef *f);
+upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f);
+upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f);
+upb_label_t upb_fielddef_label(const upb_fielddef *f);
+uint32_t upb_fielddef_number(const upb_fielddef *f);
+const char *upb_fielddef_name(const upb_fielddef *f);
+bool upb_fielddef_isextension(const upb_fielddef *f);
+bool upb_fielddef_lazy(const upb_fielddef *f);
+bool upb_fielddef_packed(const upb_fielddef *f);
+size_t upb_fielddef_getjsonname(const upb_fielddef *f, char *buf, size_t len);
+const upb_msgdef *upb_fielddef_containingtype(const upb_fielddef *f);
+const upb_oneofdef *upb_fielddef_containingoneof(const upb_fielddef *f);
+uint32_t upb_fielddef_index(const upb_fielddef *f);
+bool upb_fielddef_issubmsg(const upb_fielddef *f);
+bool upb_fielddef_isstring(const upb_fielddef *f);
+bool upb_fielddef_isseq(const upb_fielddef *f);
+bool upb_fielddef_isprimitive(const upb_fielddef *f);
+bool upb_fielddef_ismap(const upb_fielddef *f);
+int64_t upb_fielddef_defaultint64(const upb_fielddef *f);
+int32_t upb_fielddef_defaultint32(const upb_fielddef *f);
+uint64_t upb_fielddef_defaultuint64(const upb_fielddef *f);
+uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f);
+bool upb_fielddef_defaultbool(const upb_fielddef *f);
+float upb_fielddef_defaultfloat(const upb_fielddef *f);
+double upb_fielddef_defaultdouble(const upb_fielddef *f);
+const char *upb_fielddef_defaultstr(const upb_fielddef *f, size_t *len);
+bool upb_fielddef_hassubdef(const upb_fielddef *f);
+bool upb_fielddef_haspresence(const upb_fielddef *f);
+const upb_msgdef *upb_fielddef_msgsubdef(const upb_fielddef *f);
+const upb_enumdef *upb_fielddef_enumsubdef(const upb_fielddef *f);
+
+/* Internal only. */
+uint32_t upb_fielddef_selectorbase(const upb_fielddef *f);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* A upb_fielddef describes a single field in a message.  It is most often
+ * found as a part of a upb_msgdef, but can also stand alone to represent
+ * an extension. */
+class upb::FieldDefPtr {
+ public:
+  FieldDefPtr() : ptr_(nullptr) {}
+  explicit FieldDefPtr(const upb_fielddef *ptr) : ptr_(ptr) {}
+
+  const upb_fielddef* ptr() const { return ptr_; }
+  explicit operator bool() const { return ptr_ != nullptr; }
+
+  typedef upb_fieldtype_t Type;
+  typedef upb_label_t Label;
+  typedef upb_descriptortype_t DescriptorType;
+
+  const char* full_name() const { return upb_fielddef_fullname(ptr_); }
+
+  Type type() const { return upb_fielddef_type(ptr_); }
+  Label label() const { return upb_fielddef_label(ptr_); }
+  const char* name() const { return upb_fielddef_name(ptr_); }
+  uint32_t number() const { return upb_fielddef_number(ptr_); }
+  bool is_extension() const { return upb_fielddef_isextension(ptr_); }
+
+  /* Copies the JSON name for this field into the given buffer.  Returns the
+   * actual size of the JSON name, including the NULL terminator.  If the
+   * return value is 0, the JSON name is unset.  If the return value is
+   * greater than len, the JSON name was truncated.  The buffer is always
+   * NULL-terminated if len > 0.
+   *
+   * The JSON name always defaults to a camelCased version of the regular
+   * name.  However if the regular name is unset, the JSON name will be unset
+   * also.
+   */
+  size_t GetJsonName(char *buf, size_t len) const {
+    return upb_fielddef_getjsonname(ptr_, buf, len);
+  }
+
+  /* Convenience version of the above function which copies the JSON name
+   * into the given string, returning false if the name is not set. */
+  template <class T>
+  bool GetJsonName(T* str) {
+    str->resize(GetJsonName(NULL, 0));
+    GetJsonName(&(*str)[0], str->size());
+    return str->size() > 0;
+  }
+
+  /* For UPB_TYPE_MESSAGE fields only where is_tag_delimited() == false,
+   * indicates whether this field should have lazy parsing handlers that yield
+   * the unparsed string for the submessage.
+   *
+   * TODO(haberman): I think we want to move this into a FieldOptions container
+   * when we add support for custom options (the FieldOptions struct will
+   * contain both regular FieldOptions like "lazy" *and* custom options). */
+  bool lazy() const { return upb_fielddef_lazy(ptr_); }
+
+  /* For non-string, non-submessage fields, this indicates whether binary
+   * protobufs are encoded in packed or non-packed format.
+   *
+   * TODO(haberman): see note above about putting options like this into a
+   * FieldOptions container. */
+  bool packed() const { return upb_fielddef_packed(ptr_); }
+
+  /* An integer that can be used as an index into an array of fields for
+   * whatever message this field belongs to.  Guaranteed to be less than
+   * f->containing_type()->field_count().  May only be accessed once the def has
+   * been finalized. */
+  uint32_t index() const { return upb_fielddef_index(ptr_); }
+
+  /* The MessageDef to which this field belongs.
+   *
+   * If this field has been added to a MessageDef, that message can be retrieved
+   * directly (this is always the case for frozen FieldDefs).
+   *
+   * If the field has not yet been added to a MessageDef, you can set the name
+   * of the containing type symbolically instead.  This is mostly useful for
+   * extensions, where the extension is declared separately from the message. */
+  MessageDefPtr containing_type() const;
+
+  /* The OneofDef to which this field belongs, or NULL if this field is not part
+   * of a oneof. */
+  OneofDefPtr containing_oneof() const;
+
+  /* The field's type according to the enum in descriptor.proto.  This is not
+   * the same as UPB_TYPE_*, because it distinguishes between (for example)
+   * INT32 and SINT32, whereas our "type" enum does not.  This return of
+   * descriptor_type() is a function of type(), integer_format(), and
+   * is_tag_delimited().  */
+  DescriptorType descriptor_type() const {
+    return upb_fielddef_descriptortype(ptr_);
+  }
+
+  /* Convenient field type tests. */
+  bool IsSubMessage() const { return upb_fielddef_issubmsg(ptr_); }
+  bool IsString() const { return upb_fielddef_isstring(ptr_); }
+  bool IsSequence() const { return upb_fielddef_isseq(ptr_); }
+  bool IsPrimitive() const { return upb_fielddef_isprimitive(ptr_); }
+  bool IsMap() const { return upb_fielddef_ismap(ptr_); }
+
+  /* Returns the non-string default value for this fielddef, which may either
+   * be something the client set explicitly or the "default default" (0 for
+   * numbers, empty for strings).  The field's type indicates the type of the
+   * returned value, except for enum fields that are still mutable.
+   *
+   * Requires that the given function matches the field's current type. */
+  int64_t default_int64() const { return upb_fielddef_defaultint64(ptr_); }
+  int32_t default_int32() const { return upb_fielddef_defaultint32(ptr_); }
+  uint64_t default_uint64() const { return upb_fielddef_defaultuint64(ptr_); }
+  uint32_t default_uint32() const { return upb_fielddef_defaultuint32(ptr_); }
+  bool default_bool() const { return upb_fielddef_defaultbool(ptr_); }
+  float default_float() const { return upb_fielddef_defaultfloat(ptr_); }
+  double default_double() const { return upb_fielddef_defaultdouble(ptr_); }
+
+  /* The resulting string is always NULL-terminated.  If non-NULL, the length
+   * will be stored in *len. */
+  const char *default_string(size_t * len) const {
+    return upb_fielddef_defaultstr(ptr_, len);
+  }
+
+  /* Returns the enum or submessage def for this field, if any.  The field's
+   * type must match (ie. you may only call enum_subdef() for fields where
+   * type() == UPB_TYPE_ENUM). */
+  EnumDefPtr enum_subdef() const;
+  MessageDefPtr message_subdef() const;
+
+ private:
+  const upb_fielddef *ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_oneofdef ***************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef upb_inttable_iter upb_oneof_iter;
+
+const char *upb_oneofdef_name(const upb_oneofdef *o);
+const upb_msgdef *upb_oneofdef_containingtype(const upb_oneofdef *o);
+int upb_oneofdef_numfields(const upb_oneofdef *o);
+uint32_t upb_oneofdef_index(const upb_oneofdef *o);
+
+/* Oneof lookups:
+ * - ntof:  look up a field by name.
+ * - ntofz: look up a field by name (as a null-terminated string).
+ * - itof:  look up a field by number. */
+const upb_fielddef *upb_oneofdef_ntof(const upb_oneofdef *o,
+                                      const char *name, size_t length);
+UPB_INLINE const upb_fielddef *upb_oneofdef_ntofz(const upb_oneofdef *o,
+                                                  const char *name) {
+  return upb_oneofdef_ntof(o, name, strlen(name));
+}
+const upb_fielddef *upb_oneofdef_itof(const upb_oneofdef *o, uint32_t num);
+
+/*  upb_oneof_iter i;
+ *  for(upb_oneof_begin(&i, e); !upb_oneof_done(&i); upb_oneof_next(&i)) {
+ *    // ...
+ *  }
+ */
+void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o);
+void upb_oneof_next(upb_oneof_iter *iter);
+bool upb_oneof_done(upb_oneof_iter *iter);
+upb_fielddef *upb_oneof_iter_field(const upb_oneof_iter *iter);
+void upb_oneof_iter_setdone(upb_oneof_iter *iter);
+bool upb_oneof_iter_isequal(const upb_oneof_iter *iter1,
+                            const upb_oneof_iter *iter2);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Class that represents a oneof. */
+class upb::OneofDefPtr {
+ public:
+  OneofDefPtr() : ptr_(nullptr) {}
+  explicit OneofDefPtr(const upb_oneofdef *ptr) : ptr_(ptr) {}
+
+  const upb_oneofdef* ptr() const { return ptr_; }
+  explicit operator bool() { return ptr_ != nullptr; }
+
+  /* Returns the MessageDef that owns this OneofDef. */
+  MessageDefPtr containing_type() const;
+
+  /* Returns the name of this oneof. This is the name used to look up the oneof
+   * by name once added to a message def. */
+  const char* name() const { return upb_oneofdef_name(ptr_); }
+
+  /* Returns the number of fields currently defined in the oneof. */
+  int field_count() const { return upb_oneofdef_numfields(ptr_); }
+
+  /* Looks up by name. */
+  FieldDefPtr FindFieldByName(const char *name, size_t len) const {
+    return FieldDefPtr(upb_oneofdef_ntof(ptr_, name, len));
+  }
+  FieldDefPtr FindFieldByName(const char* name) const {
+    return FieldDefPtr(upb_oneofdef_ntofz(ptr_, name));
+  }
+
+  template <class T>
+  FieldDefPtr FindFieldByName(const T& str) const {
+    return FindFieldByName(str.c_str(), str.size());
+  }
+
+  /* Looks up by tag number. */
+  FieldDefPtr FindFieldByNumber(uint32_t num) const {
+    return FieldDefPtr(upb_oneofdef_itof(ptr_, num));
+  }
+
+  class const_iterator
+      : public std::iterator<std::forward_iterator_tag, FieldDefPtr> {
+   public:
+    void operator++() { upb_oneof_next(&iter_); }
+
+    FieldDefPtr operator*() const {
+      return FieldDefPtr(upb_oneof_iter_field(&iter_));
+    }
+
+    bool operator!=(const const_iterator& other) const {
+      return !upb_oneof_iter_isequal(&iter_, &other.iter_);
+    }
+
+    bool operator==(const const_iterator& other) const {
+      return upb_oneof_iter_isequal(&iter_, &other.iter_);
+    }
+
+   private:
+    friend class OneofDefPtr;
+
+    const_iterator() {}
+    explicit const_iterator(OneofDefPtr o) {
+      upb_oneof_begin(&iter_, o.ptr());
+    }
+    static const_iterator end() {
+      const_iterator iter;
+      upb_oneof_iter_setdone(&iter.iter_);
+      return iter;
+    }
+
+    upb_oneof_iter iter_;
+  };
+
+  const_iterator begin() const { return const_iterator(*this); }
+  const_iterator end() const { return const_iterator::end(); }
+
+ private:
+  const upb_oneofdef *ptr_;
+};
+
+inline upb::OneofDefPtr upb::FieldDefPtr::containing_oneof() const {
+  return OneofDefPtr(upb_fielddef_containingoneof(ptr_));
+}
+
+#endif  /* __cplusplus */
+
+/* upb_msgdef *****************************************************************/
+
+typedef upb_inttable_iter upb_msg_field_iter;
+typedef upb_strtable_iter upb_msg_oneof_iter;
+
+/* Well-known field tag numbers for map-entry messages. */
+#define UPB_MAPENTRY_KEY   1
+#define UPB_MAPENTRY_VALUE 2
+
+/* Well-known field tag numbers for Any messages. */
+#define UPB_ANY_TYPE 1
+#define UPB_ANY_VALUE 2
+
+/* Well-known field tag numbers for timestamp messages. */
+#define UPB_DURATION_SECONDS 1
+#define UPB_DURATION_NANOS 2
+
+/* Well-known field tag numbers for duration messages. */
+#define UPB_TIMESTAMP_SECONDS 1
+#define UPB_TIMESTAMP_NANOS 2
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char *upb_msgdef_fullname(const upb_msgdef *m);
+const upb_filedef *upb_msgdef_file(const upb_msgdef *m);
+const char *upb_msgdef_name(const upb_msgdef *m);
+int upb_msgdef_numoneofs(const upb_msgdef *m);
+upb_syntax_t upb_msgdef_syntax(const upb_msgdef *m);
+bool upb_msgdef_mapentry(const upb_msgdef *m);
+upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m);
+bool upb_msgdef_isnumberwrapper(const upb_msgdef *m);
+bool upb_msgdef_setsyntax(upb_msgdef *m, upb_syntax_t syntax);
+const upb_fielddef *upb_msgdef_itof(const upb_msgdef *m, uint32_t i);
+const upb_fielddef *upb_msgdef_ntof(const upb_msgdef *m, const char *name,
+                                    size_t len);
+const upb_oneofdef *upb_msgdef_ntoo(const upb_msgdef *m, const char *name,
+                                    size_t len);
+int upb_msgdef_numfields(const upb_msgdef *m);
+int upb_msgdef_numoneofs(const upb_msgdef *m);
+
+UPB_INLINE const upb_oneofdef *upb_msgdef_ntooz(const upb_msgdef *m,
+                                               const char *name) {
+  return upb_msgdef_ntoo(m, name, strlen(name));
+}
+
+UPB_INLINE const upb_fielddef *upb_msgdef_ntofz(const upb_msgdef *m,
+                                                const char *name) {
+  return upb_msgdef_ntof(m, name, strlen(name));
+}
+
+/* Internal-only. */
+size_t upb_msgdef_selectorcount(const upb_msgdef *m);
+uint32_t upb_msgdef_submsgfieldcount(const upb_msgdef *m);
+
+/* Lookup of either field or oneof by name.  Returns whether either was found.
+ * If the return is true, then the found def will be set, and the non-found
+ * one set to NULL. */
+bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len,
+                           const upb_fielddef **f, const upb_oneofdef **o);
+
+UPB_INLINE bool upb_msgdef_lookupnamez(const upb_msgdef *m, const char *name,
+                                       const upb_fielddef **f,
+                                       const upb_oneofdef **o) {
+  return upb_msgdef_lookupname(m, name, strlen(name), f, o);
+}
+
+/* Iteration over fields and oneofs.  For example:
+ *
+ * upb_msg_field_iter i;
+ * for(upb_msg_field_begin(&i, m);
+ *     !upb_msg_field_done(&i);
+ *     upb_msg_field_next(&i)) {
+ *   upb_fielddef *f = upb_msg_iter_field(&i);
+ *   // ...
+ * }
+ *
+ * For C we don't have separate iterators for const and non-const.
+ * It is the caller's responsibility to cast the upb_fielddef* to
+ * const if the upb_msgdef* is const. */
+void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m);
+void upb_msg_field_next(upb_msg_field_iter *iter);
+bool upb_msg_field_done(const upb_msg_field_iter *iter);
+upb_fielddef *upb_msg_iter_field(const upb_msg_field_iter *iter);
+void upb_msg_field_iter_setdone(upb_msg_field_iter *iter);
+bool upb_msg_field_iter_isequal(const upb_msg_field_iter * iter1,
+                                const upb_msg_field_iter * iter2);
+
+/* Similar to above, we also support iterating through the oneofs in a
+ * msgdef. */
+void upb_msg_oneof_begin(upb_msg_oneof_iter * iter, const upb_msgdef *m);
+void upb_msg_oneof_next(upb_msg_oneof_iter * iter);
+bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter);
+const upb_oneofdef *upb_msg_iter_oneof(const upb_msg_oneof_iter *iter);
+void upb_msg_oneof_iter_setdone(upb_msg_oneof_iter * iter);
+bool upb_msg_oneof_iter_isequal(const upb_msg_oneof_iter *iter1,
+                                const upb_msg_oneof_iter *iter2);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Structure that describes a single .proto message type. */
+class upb::MessageDefPtr {
+ public:
+  MessageDefPtr() : ptr_(nullptr) {}
+  explicit MessageDefPtr(const upb_msgdef *ptr) : ptr_(ptr) {}
+
+  const upb_msgdef *ptr() const { return ptr_; }
+  explicit operator bool() const { return ptr_ != nullptr; }
+
+  const char* full_name() const { return upb_msgdef_fullname(ptr_); }
+  const char* name() const { return upb_msgdef_name(ptr_); }
+
+  /* The number of fields that belong to the MessageDef. */
+  int field_count() const { return upb_msgdef_numfields(ptr_); }
+
+  /* The number of oneofs that belong to the MessageDef. */
+  int oneof_count() const { return upb_msgdef_numoneofs(ptr_); }
+
+  upb_syntax_t syntax() const { return upb_msgdef_syntax(ptr_); }
+
+  /* These return null pointers if the field is not found. */
+  FieldDefPtr FindFieldByNumber(uint32_t number) const {
+    return FieldDefPtr(upb_msgdef_itof(ptr_, number));
+  }
+  FieldDefPtr FindFieldByName(const char* name, size_t len) const {
+    return FieldDefPtr(upb_msgdef_ntof(ptr_, name, len));
+  }
+  FieldDefPtr FindFieldByName(const char *name) const {
+    return FieldDefPtr(upb_msgdef_ntofz(ptr_, name));
+  }
+
+  template <class T>
+  FieldDefPtr FindFieldByName(const T& str) const {
+    return FindFieldByName(str.c_str(), str.size());
+  }
+
+  OneofDefPtr FindOneofByName(const char* name, size_t len) const {
+    return OneofDefPtr(upb_msgdef_ntoo(ptr_, name, len));
+  }
+
+  OneofDefPtr FindOneofByName(const char *name) const {
+    return OneofDefPtr(upb_msgdef_ntooz(ptr_, name));
+  }
+
+  template <class T>
+  OneofDefPtr FindOneofByName(const T &str) const {
+    return FindOneofByName(str.c_str(), str.size());
+  }
+
+  /* Is this message a map entry? */
+  bool mapentry() const { return upb_msgdef_mapentry(ptr_); }
+
+  /* Return the type of well known type message. UPB_WELLKNOWN_UNSPECIFIED for
+   * non-well-known message. */
+  upb_wellknowntype_t wellknowntype() const {
+    return upb_msgdef_wellknowntype(ptr_);
+  }
+
+  /* Whether is a number wrapper. */
+  bool isnumberwrapper() const { return upb_msgdef_isnumberwrapper(ptr_); }
+
+  /* Iteration over fields.  The order is undefined. */
+  class const_field_iterator
+      : public std::iterator<std::forward_iterator_tag, FieldDefPtr> {
+   public:
+    void operator++() { upb_msg_field_next(&iter_); }
+
+    FieldDefPtr operator*() const {
+      return FieldDefPtr(upb_msg_iter_field(&iter_));
+    }
+
+    bool operator!=(const const_field_iterator &other) const {
+      return !upb_msg_field_iter_isequal(&iter_, &other.iter_);
+    }
+
+    bool operator==(const const_field_iterator &other) const {
+      return upb_msg_field_iter_isequal(&iter_, &other.iter_);
+    }
+
+   private:
+    friend class MessageDefPtr;
+
+    explicit const_field_iterator() {}
+
+    explicit const_field_iterator(MessageDefPtr msg) {
+      upb_msg_field_begin(&iter_, msg.ptr());
+    }
+
+    static const_field_iterator end() {
+      const_field_iterator iter;
+      upb_msg_field_iter_setdone(&iter.iter_);
+      return iter;
+    }
+
+    upb_msg_field_iter iter_;
+  };
+
+  /* Iteration over oneofs. The order is undefined. */
+  class const_oneof_iterator
+      : public std::iterator<std::forward_iterator_tag, OneofDefPtr> {
+   public:
+
+    void operator++() { upb_msg_oneof_next(&iter_); }
+
+    OneofDefPtr operator*() const {
+      return OneofDefPtr(upb_msg_iter_oneof(&iter_));
+    }
+
+    bool operator!=(const const_oneof_iterator& other) const {
+      return !upb_msg_oneof_iter_isequal(&iter_, &other.iter_);
+    }
+
+    bool operator==(const const_oneof_iterator &other) const {
+      return upb_msg_oneof_iter_isequal(&iter_, &other.iter_);
+    }
+
+   private:
+    friend class MessageDefPtr;
+
+    const_oneof_iterator() {}
+
+    explicit const_oneof_iterator(MessageDefPtr msg) {
+      upb_msg_oneof_begin(&iter_, msg.ptr());
+    }
+
+    static const_oneof_iterator end() {
+      const_oneof_iterator iter;
+      upb_msg_oneof_iter_setdone(&iter.iter_);
+      return iter;
+    }
+
+    upb_msg_oneof_iter iter_;
+  };
+
+  class ConstFieldAccessor {
+   public:
+    explicit ConstFieldAccessor(const upb_msgdef* md) : md_(md) {}
+    const_field_iterator begin() { return MessageDefPtr(md_).field_begin(); }
+    const_field_iterator end() { return MessageDefPtr(md_).field_end(); }
+   private:
+    const upb_msgdef* md_;
+  };
+
+  class ConstOneofAccessor {
+   public:
+    explicit ConstOneofAccessor(const upb_msgdef* md) : md_(md) {}
+    const_oneof_iterator begin() { return MessageDefPtr(md_).oneof_begin(); }
+    const_oneof_iterator end() { return MessageDefPtr(md_).oneof_end(); }
+   private:
+    const upb_msgdef* md_;
+  };
+
+  const_field_iterator field_begin() const {
+    return const_field_iterator(*this);
+  }
+
+  const_field_iterator field_end() const { return const_field_iterator::end(); }
+
+  const_oneof_iterator oneof_begin() const {
+    return const_oneof_iterator(*this);
+  }
+
+  const_oneof_iterator oneof_end() const { return const_oneof_iterator::end(); }
+
+  ConstFieldAccessor fields() const { return ConstFieldAccessor(ptr()); }
+  ConstOneofAccessor oneofs() const { return ConstOneofAccessor(ptr()); }
+
+ private:
+  const upb_msgdef* ptr_;
+};
+
+inline upb::MessageDefPtr upb::FieldDefPtr::message_subdef() const {
+  return MessageDefPtr(upb_fielddef_msgsubdef(ptr_));
+}
+
+inline upb::MessageDefPtr upb::FieldDefPtr::containing_type() const {
+  return MessageDefPtr(upb_fielddef_containingtype(ptr_));
+}
+
+inline upb::MessageDefPtr upb::OneofDefPtr::containing_type() const {
+  return MessageDefPtr(upb_oneofdef_containingtype(ptr_));
+}
+
+#endif  /* __cplusplus */
+
+/* upb_enumdef ****************************************************************/
+
+typedef upb_strtable_iter upb_enum_iter;
+
+const char *upb_enumdef_fullname(const upb_enumdef *e);
+const char *upb_enumdef_name(const upb_enumdef *e);
+const upb_filedef *upb_enumdef_file(const upb_enumdef *e);
+int32_t upb_enumdef_default(const upb_enumdef *e);
+int upb_enumdef_numvals(const upb_enumdef *e);
+
+/* Enum lookups:
+ * - ntoi:  look up a name with specified length.
+ * - ntoiz: look up a name provided as a null-terminated string.
+ * - iton:  look up an integer, returning the name as a null-terminated
+ *          string. */
+bool upb_enumdef_ntoi(const upb_enumdef *e, const char *name, size_t len,
+                      int32_t *num);
+UPB_INLINE bool upb_enumdef_ntoiz(const upb_enumdef *e,
+                                  const char *name, int32_t *num) {
+  return upb_enumdef_ntoi(e, name, strlen(name), num);
+}
+const char *upb_enumdef_iton(const upb_enumdef *e, int32_t num);
+
+/*  upb_enum_iter i;
+ *  for(upb_enum_begin(&i, e); !upb_enum_done(&i); upb_enum_next(&i)) {
+ *    // ...
+ *  }
+ */
+void upb_enum_begin(upb_enum_iter *iter, const upb_enumdef *e);
+void upb_enum_next(upb_enum_iter *iter);
+bool upb_enum_done(upb_enum_iter *iter);
+const char *upb_enum_iter_name(upb_enum_iter *iter);
+int32_t upb_enum_iter_number(upb_enum_iter *iter);
+
+#ifdef __cplusplus
+
+class upb::EnumDefPtr {
+ public:
+  EnumDefPtr() : ptr_(nullptr) {}
+  explicit EnumDefPtr(const upb_enumdef* ptr) : ptr_(ptr) {}
+
+  const upb_enumdef* ptr() const { return ptr_; }
+  explicit operator bool() const { return ptr_ != nullptr; }
+
+  const char* full_name() const { return upb_enumdef_fullname(ptr_); }
+  const char* name() const { return upb_enumdef_name(ptr_); }
+
+  /* The value that is used as the default when no field default is specified.
+   * If not set explicitly, the first value that was added will be used.
+   * The default value must be a member of the enum.
+   * Requires that value_count() > 0. */
+  int32_t default_value() const { return upb_enumdef_default(ptr_); }
+
+  /* Returns the number of values currently defined in the enum.  Note that
+   * multiple names can refer to the same number, so this may be greater than
+   * the total number of unique numbers. */
+  int value_count() const { return upb_enumdef_numvals(ptr_); }
+
+  /* Lookups from name to integer, returning true if found. */
+  bool FindValueByName(const char *name, int32_t *num) const {
+    return upb_enumdef_ntoiz(ptr_, name, num);
+  }
+
+  /* Finds the name corresponding to the given number, or NULL if none was
+   * found.  If more than one name corresponds to this number, returns the
+   * first one that was added. */
+  const char *FindValueByNumber(int32_t num) const {
+    return upb_enumdef_iton(ptr_, num);
+  }
+
+  /* Iteration over name/value pairs.  The order is undefined.
+   * Adding an enum val invalidates any iterators.
+   *
+   * TODO: make compatible with range-for, with elements as pairs? */
+  class Iterator {
+   public:
+    explicit Iterator(EnumDefPtr e) { upb_enum_begin(&iter_, e.ptr()); }
+
+    int32_t number() { return upb_enum_iter_number(&iter_); }
+    const char *name() { return upb_enum_iter_name(&iter_); }
+    bool Done() { return upb_enum_done(&iter_); }
+    void Next() { return upb_enum_next(&iter_); }
+
+   private:
+    upb_enum_iter iter_;
+  };
+
+ private:
+  const upb_enumdef *ptr_;
+};
+
+inline upb::EnumDefPtr upb::FieldDefPtr::enum_subdef() const {
+  return EnumDefPtr(upb_fielddef_enumsubdef(ptr_));
+}
+
+#endif  /* __cplusplus */
+
+/* upb_filedef ****************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char *upb_filedef_name(const upb_filedef *f);
+const char *upb_filedef_package(const upb_filedef *f);
+const char *upb_filedef_phpprefix(const upb_filedef *f);
+const char *upb_filedef_phpnamespace(const upb_filedef *f);
+upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
+int upb_filedef_depcount(const upb_filedef *f);
+int upb_filedef_msgcount(const upb_filedef *f);
+int upb_filedef_enumcount(const upb_filedef *f);
+const upb_filedef *upb_filedef_dep(const upb_filedef *f, int i);
+const upb_msgdef *upb_filedef_msg(const upb_filedef *f, int i);
+const upb_enumdef *upb_filedef_enum(const upb_filedef *f, int i);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Class that represents a .proto file with some things defined in it.
+ *
+ * Many users won't care about FileDefs, but they are necessary if you want to
+ * read the values of file-level options. */
+class upb::FileDefPtr {
+ public:
+  explicit FileDefPtr(const upb_filedef *ptr) : ptr_(ptr) {}
+
+  const upb_filedef* ptr() const { return ptr_; }
+  explicit operator bool() const { return ptr_ != nullptr; }
+
+  /* Get/set name of the file (eg. "foo/bar.proto"). */
+  const char* name() const { return upb_filedef_name(ptr_); }
+
+  /* Package name for definitions inside the file (eg. "foo.bar"). */
+  const char* package() const { return upb_filedef_package(ptr_); }
+
+  /* Sets the php class prefix which is prepended to all php generated classes
+   * from this .proto. Default is empty. */
+  const char* phpprefix() const { return upb_filedef_phpprefix(ptr_); }
+
+  /* Use this option to change the namespace of php generated classes. Default
+   * is empty. When this option is empty, the package name will be used for
+   * determining the namespace. */
+  const char* phpnamespace() const { return upb_filedef_phpnamespace(ptr_); }
+
+  /* Syntax for the file.  Defaults to proto2. */
+  upb_syntax_t syntax() const { return upb_filedef_syntax(ptr_); }
+
+  /* Get the list of dependencies from the file.  These are returned in the
+   * order that they were added to the FileDefPtr. */
+  int dependency_count() const { return upb_filedef_depcount(ptr_); }
+  const FileDefPtr dependency(int index) const {
+    return FileDefPtr(upb_filedef_dep(ptr_, index));
+  }
+
+ private:
+  const upb_filedef* ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_symtab *****************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+upb_symtab *upb_symtab_new(void);
+void upb_symtab_free(upb_symtab* s);
+const upb_msgdef *upb_symtab_lookupmsg(const upb_symtab *s, const char *sym);
+const upb_msgdef *upb_symtab_lookupmsg2(
+    const upb_symtab *s, const char *sym, size_t len);
+const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym);
+const upb_filedef *upb_symtab_lookupfile(const upb_symtab *s, const char *name);
+int upb_symtab_filecount(const upb_symtab *s);
+const upb_filedef *upb_symtab_addfile(
+    upb_symtab *s, const google_protobuf_FileDescriptorProto *file,
+    upb_status *status);
+
+/* For generated code only: loads a generated descriptor. */
+typedef struct upb_def_init {
+  struct upb_def_init **deps;
+  const char *filename;
+  upb_strview descriptor;
+} upb_def_init;
+
+bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Non-const methods in upb::SymbolTable are NOT thread-safe. */
+class upb::SymbolTable {
+ public:
+  SymbolTable() : ptr_(upb_symtab_new(), upb_symtab_free) {}
+  explicit SymbolTable(upb_symtab* s) : ptr_(s, upb_symtab_free) {}
+
+  const upb_symtab* ptr() const { return ptr_.get(); }
+  upb_symtab* ptr() { return ptr_.get(); }
+
+  /* Finds an entry in the symbol table with this exact name.  If not found,
+   * returns NULL. */
+  MessageDefPtr LookupMessage(const char *sym) const {
+    return MessageDefPtr(upb_symtab_lookupmsg(ptr_.get(), sym));
+  }
+
+  EnumDefPtr LookupEnum(const char *sym) const {
+    return EnumDefPtr(upb_symtab_lookupenum(ptr_.get(), sym));
+  }
+
+  FileDefPtr LookupFile(const char *name) const {
+    return FileDefPtr(upb_symtab_lookupfile(ptr_.get(), name));
+  }
+
+  /* TODO: iteration? */
+
+  /* Adds the given serialized FileDescriptorProto to the pool. */
+  FileDefPtr AddFile(const google_protobuf_FileDescriptorProto *file_proto,
+                     Status *status) {
+    return FileDefPtr(
+        upb_symtab_addfile(ptr_.get(), file_proto, status->ptr()));
+  }
+
+ private:
+  std::unique_ptr<upb_symtab, decltype(&upb_symtab_free)> ptr_;
+};
+
+UPB_INLINE const char* upb_safecstr(const std::string& str) {
+  UPB_ASSERT(str.size() == std::strlen(str.c_str()));
+  return str.c_str();
+}
+
+#endif  /* __cplusplus */
+
+#include "upb/port_undef.inc"
+
+#endif /* UPB_DEF_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/encode.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/encode.c
new file mode 100644 (file)
index 0000000..43d24cd
--- /dev/null
@@ -0,0 +1,378 @@
+/* We encode backwards, to avoid pre-computing lengths (one-pass encode). */
+
+#include "upb/encode.h"
+
+#include <string.h>
+
+#include "upb/msg.h"
+#include "upb/upb.h"
+
+#include "upb/port_def.inc"
+
+#define UPB_PB_VARINT_MAX_LEN 10
+#define CHK(x) do { if (!(x)) { return false; } } while(0)
+
+static size_t upb_encode_varint(uint64_t val, char *buf) {
+  size_t i;
+  if (val < 128) { buf[0] = val; return 1; }
+  i = 0;
+  while (val) {
+    uint8_t byte = val & 0x7fU;
+    val >>= 7;
+    if (val) byte |= 0x80U;
+    buf[i++] = byte;
+  }
+  return i;
+}
+
+static uint32_t upb_zzencode_32(int32_t n) { return ((uint32_t)n << 1) ^ (n >> 31); }
+static uint64_t upb_zzencode_64(int64_t n) { return ((uint64_t)n << 1) ^ (n >> 63); }
+
+typedef struct {
+  upb_alloc *alloc;
+  char *buf, *ptr, *limit;
+} upb_encstate;
+
+static size_t upb_roundup_pow2(size_t bytes) {
+  size_t ret = 128;
+  while (ret < bytes) {
+    ret *= 2;
+  }
+  return ret;
+}
+
+static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes) {
+  size_t old_size = e->limit - e->buf;
+  size_t new_size = upb_roundup_pow2(bytes + (e->limit - e->ptr));
+  char *new_buf = upb_realloc(e->alloc, e->buf, old_size, new_size);
+  CHK(new_buf);
+
+  /* We want previous data at the end, realloc() put it at the beginning. */
+  if (old_size > 0) {
+    memmove(new_buf + new_size - old_size, e->buf, old_size);
+  }
+
+  e->ptr = new_buf + new_size - (e->limit - e->ptr);
+  e->limit = new_buf + new_size;
+  e->buf = new_buf;
+  return true;
+}
+
+/* Call to ensure that at least "bytes" bytes are available for writing at
+ * e->ptr.  Returns false if the bytes could not be allocated. */
+static bool upb_encode_reserve(upb_encstate *e, size_t bytes) {
+  CHK(UPB_LIKELY((size_t)(e->ptr - e->buf) >= bytes) ||
+      upb_encode_growbuffer(e, bytes));
+
+  e->ptr -= bytes;
+  return true;
+}
+
+/* Writes the given bytes to the buffer, handling reserve/advance. */
+static bool upb_put_bytes(upb_encstate *e, const void *data, size_t len) {
+  CHK(upb_encode_reserve(e, len));
+  memcpy(e->ptr, data, len);
+  return true;
+}
+
+static bool upb_put_fixed64(upb_encstate *e, uint64_t val) {
+  /* TODO(haberman): byte-swap for big endian. */
+  return upb_put_bytes(e, &val, sizeof(uint64_t));
+}
+
+static bool upb_put_fixed32(upb_encstate *e, uint32_t val) {
+  /* TODO(haberman): byte-swap for big endian. */
+  return upb_put_bytes(e, &val, sizeof(uint32_t));
+}
+
+static bool upb_put_varint(upb_encstate *e, uint64_t val) {
+  size_t len;
+  char *start;
+  CHK(upb_encode_reserve(e, UPB_PB_VARINT_MAX_LEN));
+  len = upb_encode_varint(val, e->ptr);
+  start = e->ptr + UPB_PB_VARINT_MAX_LEN - len;
+  memmove(start, e->ptr, len);
+  e->ptr = start;
+  return true;
+}
+
+static bool upb_put_double(upb_encstate *e, double d) {
+  uint64_t u64;
+  UPB_ASSERT(sizeof(double) == sizeof(uint64_t));
+  memcpy(&u64, &d, sizeof(uint64_t));
+  return upb_put_fixed64(e, u64);
+}
+
+static bool upb_put_float(upb_encstate *e, float d) {
+  uint32_t u32;
+  UPB_ASSERT(sizeof(float) == sizeof(uint32_t));
+  memcpy(&u32, &d, sizeof(uint32_t));
+  return upb_put_fixed32(e, u32);
+}
+
+static uint32_t upb_readcase(const char *msg, const upb_msglayout_field *f) {
+  uint32_t ret;
+  uint32_t offset = ~f->presence;
+  memcpy(&ret, msg + offset, sizeof(ret));
+  return ret;
+}
+
+static bool upb_readhasbit(const char *msg, const upb_msglayout_field *f) {
+  uint32_t hasbit = f->presence;
+  UPB_ASSERT(f->presence > 0);
+  return msg[hasbit / 8] & (1 << (hasbit % 8));
+}
+
+static bool upb_put_tag(upb_encstate *e, int field_number, int wire_type) {
+  return upb_put_varint(e, (field_number << 3) | wire_type);
+}
+
+static bool upb_put_fixedarray(upb_encstate *e, const upb_array *arr,
+                               size_t size) {
+  size_t bytes = arr->len * size;
+  return upb_put_bytes(e, arr->data, bytes) && upb_put_varint(e, bytes);
+}
+
+bool upb_encode_message(upb_encstate *e, const char *msg,
+                        const upb_msglayout *m, size_t *size);
+
+static bool upb_encode_array(upb_encstate *e, const char *field_mem,
+                             const upb_msglayout *m,
+                             const upb_msglayout_field *f) {
+  const upb_array *arr = *(const upb_array**)field_mem;
+
+  if (arr == NULL || arr->len == 0) {
+    return true;
+  }
+
+#define VARINT_CASE(ctype, encode) { \
+  ctype *start = arr->data; \
+  ctype *ptr = start + arr->len; \
+  size_t pre_len = e->limit - e->ptr; \
+  do { \
+    ptr--; \
+    CHK(upb_put_varint(e, encode)); \
+  } while (ptr != start); \
+  CHK(upb_put_varint(e, e->limit - e->ptr - pre_len)); \
+} \
+break; \
+do { ; } while(0)
+
+  switch (f->descriptortype) {
+    case UPB_DESCRIPTOR_TYPE_DOUBLE:
+      CHK(upb_put_fixedarray(e, arr, sizeof(double)));
+      break;
+    case UPB_DESCRIPTOR_TYPE_FLOAT:
+      CHK(upb_put_fixedarray(e, arr, sizeof(float)));
+      break;
+    case UPB_DESCRIPTOR_TYPE_SFIXED64:
+    case UPB_DESCRIPTOR_TYPE_FIXED64:
+      CHK(upb_put_fixedarray(e, arr, sizeof(uint64_t)));
+      break;
+    case UPB_DESCRIPTOR_TYPE_FIXED32:
+    case UPB_DESCRIPTOR_TYPE_SFIXED32:
+      CHK(upb_put_fixedarray(e, arr, sizeof(uint32_t)));
+      break;
+    case UPB_DESCRIPTOR_TYPE_INT64:
+    case UPB_DESCRIPTOR_TYPE_UINT64:
+      VARINT_CASE(uint64_t, *ptr);
+    case UPB_DESCRIPTOR_TYPE_UINT32:
+      VARINT_CASE(uint32_t, *ptr);
+    case UPB_DESCRIPTOR_TYPE_INT32:
+    case UPB_DESCRIPTOR_TYPE_ENUM:
+      VARINT_CASE(int32_t, (int64_t)*ptr);
+    case UPB_DESCRIPTOR_TYPE_BOOL:
+      VARINT_CASE(bool, *ptr);
+    case UPB_DESCRIPTOR_TYPE_SINT32:
+      VARINT_CASE(int32_t, upb_zzencode_32(*ptr));
+    case UPB_DESCRIPTOR_TYPE_SINT64:
+      VARINT_CASE(int64_t, upb_zzencode_64(*ptr));
+    case UPB_DESCRIPTOR_TYPE_STRING:
+    case UPB_DESCRIPTOR_TYPE_BYTES: {
+      upb_strview *start = arr->data;
+      upb_strview *ptr = start + arr->len;
+      do {
+        ptr--;
+        CHK(upb_put_bytes(e, ptr->data, ptr->size) &&
+            upb_put_varint(e, ptr->size) &&
+            upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
+      } while (ptr != start);
+      return true;
+    }
+    case UPB_DESCRIPTOR_TYPE_GROUP: {
+      void **start = arr->data;
+      void **ptr = start + arr->len;
+      const upb_msglayout *subm = m->submsgs[f->submsg_index];
+      do {
+        size_t size;
+        ptr--;
+        CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) &&
+            upb_encode_message(e, *ptr, subm, &size) &&
+            upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP));
+      } while (ptr != start);
+      return true;
+    }
+    case UPB_DESCRIPTOR_TYPE_MESSAGE: {
+      void **start = arr->data;
+      void **ptr = start + arr->len;
+      const upb_msglayout *subm = m->submsgs[f->submsg_index];
+      do {
+        size_t size;
+        ptr--;
+        CHK(upb_encode_message(e, *ptr, subm, &size) &&
+            upb_put_varint(e, size) &&
+            upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
+      } while (ptr != start);
+      return true;
+    }
+  }
+#undef VARINT_CASE
+
+  /* We encode all primitive arrays as packed, regardless of what was specified
+   * in the .proto file.  Could special case 1-sized arrays. */
+  CHK(upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED));
+  return true;
+}
+
+static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem,
+                                   const upb_msglayout *m,
+                                   const upb_msglayout_field *f,
+                                   bool skip_zero_value) {
+#define CASE(ctype, type, wire_type, encodeval) do { \
+  ctype val = *(ctype*)field_mem; \
+  if (skip_zero_value && val == 0) { \
+    return true; \
+  } \
+  return upb_put_ ## type(e, encodeval) && \
+      upb_put_tag(e, f->number, wire_type); \
+} while(0)
+
+  switch (f->descriptortype) {
+    case UPB_DESCRIPTOR_TYPE_DOUBLE:
+      CASE(double, double, UPB_WIRE_TYPE_64BIT, val);
+    case UPB_DESCRIPTOR_TYPE_FLOAT:
+      CASE(float, float, UPB_WIRE_TYPE_32BIT, val);
+    case UPB_DESCRIPTOR_TYPE_INT64:
+    case UPB_DESCRIPTOR_TYPE_UINT64:
+      CASE(uint64_t, varint, UPB_WIRE_TYPE_VARINT, val);
+    case UPB_DESCRIPTOR_TYPE_UINT32:
+      CASE(uint32_t, varint, UPB_WIRE_TYPE_VARINT, val);
+    case UPB_DESCRIPTOR_TYPE_INT32:
+    case UPB_DESCRIPTOR_TYPE_ENUM:
+      CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, (int64_t)val);
+    case UPB_DESCRIPTOR_TYPE_SFIXED64:
+    case UPB_DESCRIPTOR_TYPE_FIXED64:
+      CASE(uint64_t, fixed64, UPB_WIRE_TYPE_64BIT, val);
+    case UPB_DESCRIPTOR_TYPE_FIXED32:
+    case UPB_DESCRIPTOR_TYPE_SFIXED32:
+      CASE(uint32_t, fixed32, UPB_WIRE_TYPE_32BIT, val);
+    case UPB_DESCRIPTOR_TYPE_BOOL:
+      CASE(bool, varint, UPB_WIRE_TYPE_VARINT, val);
+    case UPB_DESCRIPTOR_TYPE_SINT32:
+      CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_32(val));
+    case UPB_DESCRIPTOR_TYPE_SINT64:
+      CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_64(val));
+    case UPB_DESCRIPTOR_TYPE_STRING:
+    case UPB_DESCRIPTOR_TYPE_BYTES: {
+      upb_strview view = *(upb_strview*)field_mem;
+      if (skip_zero_value && view.size == 0) {
+        return true;
+      }
+      return upb_put_bytes(e, view.data, view.size) &&
+          upb_put_varint(e, view.size) &&
+          upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED);
+    }
+    case UPB_DESCRIPTOR_TYPE_GROUP: {
+      size_t size;
+      void *submsg = *(void **)field_mem;
+      const upb_msglayout *subm = m->submsgs[f->submsg_index];
+      if (submsg == NULL) {
+        return true;
+      }
+      return upb_put_tag(e, f->number, UPB_WIRE_TYPE_END_GROUP) &&
+          upb_encode_message(e, submsg, subm, &size) &&
+          upb_put_tag(e, f->number, UPB_WIRE_TYPE_START_GROUP);
+    }
+    case UPB_DESCRIPTOR_TYPE_MESSAGE: {
+      size_t size;
+      void *submsg = *(void **)field_mem;
+      const upb_msglayout *subm = m->submsgs[f->submsg_index];
+      if (submsg == NULL) {
+        return true;
+      }
+      return upb_encode_message(e, submsg, subm, &size) &&
+          upb_put_varint(e, size) &&
+          upb_put_tag(e, f->number, UPB_WIRE_TYPE_DELIMITED);
+    }
+  }
+#undef CASE
+  UPB_UNREACHABLE();
+}
+
+bool upb_encode_message(upb_encstate *e, const char *msg,
+                        const upb_msglayout *m, size_t *size) {
+  int i;
+  size_t pre_len = e->limit - e->ptr;
+  const char *unknown;
+  size_t unknown_size;
+
+  for (i = m->field_count - 1; i >= 0; i--) {
+    const upb_msglayout_field *f = &m->fields[i];
+
+    if (f->label == UPB_LABEL_REPEATED) {
+      CHK(upb_encode_array(e, msg + f->offset, m, f));
+    } else {
+      bool skip_empty = false;
+      if (f->presence == 0) {
+        /* Proto3 presence. */
+        skip_empty = true;
+      } else if (f->presence > 0) {
+        /* Proto2 presence: hasbit. */
+        if (!upb_readhasbit(msg, f)) {
+          continue;
+        }
+      } else {
+        /* Field is in a oneof. */
+        if (upb_readcase(msg, f) != f->number) {
+          continue;
+        }
+      }
+      CHK(upb_encode_scalarfield(e, msg + f->offset, m, f, skip_empty));
+    }
+  }
+
+  unknown = upb_msg_getunknown(msg, &unknown_size);
+
+  if (unknown) {
+    upb_put_bytes(e, unknown, unknown_size);
+  }
+
+  *size = (e->limit - e->ptr) - pre_len;
+  return true;
+}
+
+char *upb_encode(const void *msg, const upb_msglayout *m, upb_arena *arena,
+                 size_t *size) {
+  upb_encstate e;
+  e.alloc = upb_arena_alloc(arena);
+  e.buf = NULL;
+  e.limit = NULL;
+  e.ptr = NULL;
+
+  if (!upb_encode_message(&e, msg, m, size)) {
+    *size = 0;
+    return NULL;
+  }
+
+  *size = e.limit - e.ptr;
+
+  if (*size == 0) {
+    static char ch;
+    return &ch;
+  } else {
+    UPB_ASSERT(e.ptr);
+    return e.ptr;
+  }
+}
+
+#undef CHK
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/encode.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/encode.h
new file mode 100644 (file)
index 0000000..6842777
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+** upb_encode: parsing into a upb_msg using a upb_msglayout.
+*/
+
+#ifndef UPB_ENCODE_H_
+#define UPB_ENCODE_H_
+
+#include "upb/msg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *upb_encode(const void *msg, const upb_msglayout *l, upb_arena *arena,
+                 size_t *size);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif  /* UPB_ENCODE_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/generated_util.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/generated_util.h
new file mode 100644 (file)
index 0000000..234bcda
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+** Functions for use by generated code.  These are not public and users must
+** not call them directly.
+*/
+
+#ifndef UPB_GENERATED_UTIL_H_
+#define UPB_GENERATED_UTIL_H_
+
+#include <stdint.h>
+#include "upb/msg.h"
+
+#include "upb/port_def.inc"
+
+#define PTR_AT(msg, ofs, type) (type*)((const char*)msg + ofs)
+
+UPB_INLINE const void *_upb_array_accessor(const void *msg, size_t ofs,
+                                           size_t *size) {
+  const upb_array *arr = *PTR_AT(msg, ofs, const upb_array*);
+  if (arr) {
+    if (size) *size = arr->len;
+    return arr->data;
+  } else {
+    if (size) *size = 0;
+    return NULL;
+  }
+}
+
+UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs,
+                                             size_t *size) {
+  upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
+  if (arr) {
+    if (size) *size = arr->len;
+    return arr->data;
+  } else {
+    if (size) *size = 0;
+    return NULL;
+  }
+}
+
+/* TODO(haberman): this is a mess.  It will improve when upb_array no longer
+ * carries reflective state (type, elem_size). */
+UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size,
+                                            size_t elem_size,
+                                            upb_fieldtype_t type,
+                                            upb_arena *arena) {
+  upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
+
+  if (!arr) {
+    arr = upb_array_new(arena);
+    if (!arr) return NULL;
+    *PTR_AT(msg, ofs, upb_array*) = arr;
+  }
+
+  if (size > arr->size) {
+    size_t new_size = UPB_MAX(arr->size, 4);
+    size_t old_bytes = arr->size * elem_size;
+    size_t new_bytes;
+    while (new_size < size) new_size *= 2;
+    new_bytes = new_size * elem_size;
+    arr->data = upb_arena_realloc(arena, arr->data, old_bytes, new_bytes);
+    if (!arr->data) {
+      return NULL;
+    }
+    arr->size = new_size;
+  }
+
+  arr->len = size;
+  return arr->data;
+}
+
+UPB_INLINE bool _upb_array_append_accessor(void *msg, size_t ofs,
+                                           size_t elem_size,
+                                           upb_fieldtype_t type,
+                                           const void *value,
+                                           upb_arena *arena) {
+  upb_array *arr = *PTR_AT(msg, ofs, upb_array*);
+  size_t i = arr ? arr->len : 0;
+  void *data =
+      _upb_array_resize_accessor(msg, ofs, i + 1, elem_size, type, arena);
+  if (!data) return false;
+  memcpy(PTR_AT(data, i * elem_size, char), value, elem_size);
+  return true;
+}
+
+UPB_INLINE bool _upb_has_field(const void *msg, size_t idx) {
+  return (*PTR_AT(msg, idx / 8, const char) & (1 << (idx % 8))) != 0;
+}
+
+UPB_INLINE bool _upb_sethas(const void *msg, size_t idx) {
+  return (*PTR_AT(msg, idx / 8, char)) |= (char)(1 << (idx % 8));
+}
+
+UPB_INLINE bool _upb_clearhas(const void *msg, size_t idx) {
+  return (*PTR_AT(msg, idx / 8, char)) &= (char)(~(1 << (idx % 8)));
+}
+
+UPB_INLINE bool _upb_has_oneof_field(const void *msg, size_t case_ofs, int32_t num) {
+  return *PTR_AT(msg, case_ofs, int32_t) == num;
+}
+
+#undef PTR_AT
+
+#include "upb/port_undef.inc"
+
+#endif  /* UPB_GENERATED_UTIL_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers-inl.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers-inl.h
new file mode 100644 (file)
index 0000000..8f8634b
--- /dev/null
@@ -0,0 +1,923 @@
+/*
+** Inline definitions for handlers.h, which are particularly long and a bit
+** tricky.
+*/
+
+#ifndef UPB_HANDLERS_INL_H_
+#define UPB_HANDLERS_INL_H_
+
+#include <limits.h>
+#include <stddef.h>
+#include "upb/handlers.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+
+/* Type detection and typedefs for integer types.
+ * For platforms where there are multiple 32-bit or 64-bit types, we need to be
+ * able to enumerate them so we can properly create overloads for all variants.
+ *
+ * If any platform existed where there were three integer types with the same
+ * size, this would have to become more complicated.  For example, short, int,
+ * and long could all be 32-bits.  Even more diabolically, short, int, long,
+ * and long long could all be 64 bits and still be standard-compliant.
+ * However, few platforms are this strange, and it's unlikely that upb will be
+ * used on the strangest ones. */
+
+/* Can't count on stdint.h limits like INT32_MAX, because in C++ these are
+ * only defined when __STDC_LIMIT_MACROS are defined before the *first* include
+ * of stdint.h.  We can't guarantee that someone else didn't include these first
+ * without defining __STDC_LIMIT_MACROS. */
+#define UPB_INT32_MAX 0x7fffffffLL
+#define UPB_INT32_MIN (-UPB_INT32_MAX - 1)
+#define UPB_INT64_MAX 0x7fffffffffffffffLL
+#define UPB_INT64_MIN (-UPB_INT64_MAX - 1)
+
+#if INT_MAX == UPB_INT32_MAX && INT_MIN == UPB_INT32_MIN
+#define UPB_INT_IS_32BITS 1
+#endif
+
+#if LONG_MAX == UPB_INT32_MAX && LONG_MIN == UPB_INT32_MIN
+#define UPB_LONG_IS_32BITS 1
+#endif
+
+#if LONG_MAX == UPB_INT64_MAX && LONG_MIN == UPB_INT64_MIN
+#define UPB_LONG_IS_64BITS 1
+#endif
+
+#if LLONG_MAX == UPB_INT64_MAX && LLONG_MIN == UPB_INT64_MIN
+#define UPB_LLONG_IS_64BITS 1
+#endif
+
+/* We use macros instead of typedefs so we can undefine them later and avoid
+ * leaking them outside this header file. */
+#if UPB_INT_IS_32BITS
+#define UPB_INT32_T int
+#define UPB_UINT32_T unsigned int
+
+#if UPB_LONG_IS_32BITS
+#define UPB_TWO_32BIT_TYPES 1
+#define UPB_INT32ALT_T long
+#define UPB_UINT32ALT_T unsigned long
+#endif  /* UPB_LONG_IS_32BITS */
+
+#elif UPB_LONG_IS_32BITS  /* && !UPB_INT_IS_32BITS */
+#define UPB_INT32_T long
+#define UPB_UINT32_T unsigned long
+#endif  /* UPB_INT_IS_32BITS */
+
+
+#if UPB_LONG_IS_64BITS
+#define UPB_INT64_T long
+#define UPB_UINT64_T unsigned long
+
+#if UPB_LLONG_IS_64BITS
+#define UPB_TWO_64BIT_TYPES 1
+#define UPB_INT64ALT_T long long
+#define UPB_UINT64ALT_T unsigned long long
+#endif  /* UPB_LLONG_IS_64BITS */
+
+#elif UPB_LLONG_IS_64BITS  /* && !UPB_LONG_IS_64BITS */
+#define UPB_INT64_T long long
+#define UPB_UINT64_T unsigned long long
+#endif  /* UPB_LONG_IS_64BITS */
+
+#undef UPB_INT32_MAX
+#undef UPB_INT32_MIN
+#undef UPB_INT64_MAX
+#undef UPB_INT64_MIN
+#undef UPB_INT_IS_32BITS
+#undef UPB_LONG_IS_32BITS
+#undef UPB_LONG_IS_64BITS
+#undef UPB_LLONG_IS_64BITS
+
+
+namespace upb {
+
+typedef void CleanupFunc(void *ptr);
+
+/* Template to remove "const" from "const T*" and just return "T*".
+ *
+ * We define a nonsense default because otherwise it will fail to instantiate as
+ * a function parameter type even in cases where we don't expect any caller to
+ * actually match the overload. */
+class CouldntRemoveConst {};
+template <class T> struct remove_constptr { typedef CouldntRemoveConst type; };
+template <class T> struct remove_constptr<const T *> { typedef T *type; };
+
+/* Template that we use below to remove a template specialization from
+ * consideration if it matches a specific type. */
+template <class T, class U> struct disable_if_same { typedef void Type; };
+template <class T> struct disable_if_same<T, T> {};
+
+template <class T> void DeletePointer(void *p) { delete static_cast<T>(p); }
+
+template <class T1, class T2>
+struct FirstUnlessVoidOrBool {
+  typedef T1 value;
+};
+
+template <class T2>
+struct FirstUnlessVoidOrBool<void, T2> {
+  typedef T2 value;
+};
+
+template <class T2>
+struct FirstUnlessVoidOrBool<bool, T2> {
+  typedef T2 value;
+};
+
+template<class T, class U>
+struct is_same {
+  static bool value;
+};
+
+template<class T>
+struct is_same<T, T> {
+  static bool value;
+};
+
+template<class T, class U>
+bool is_same<T, U>::value = false;
+
+template<class T>
+bool is_same<T, T>::value = true;
+
+/* FuncInfo *******************************************************************/
+
+/* Info about the user's original, pre-wrapped function. */
+template <class C, class R = void>
+struct FuncInfo {
+  /* The type of the closure that the function takes (its first param). */
+  typedef C Closure;
+
+  /* The return type. */
+  typedef R Return;
+};
+
+/* Func ***********************************************************************/
+
+/* Func1, Func2, Func3: Template classes representing a function and its
+ * signature.
+ *
+ * Since the function is a template parameter, calling the function can be
+ * inlined at compile-time and does not require a function pointer at runtime.
+ * These functions are not bound to a handler data so have no data or cleanup
+ * handler. */
+struct UnboundFunc {
+  CleanupFunc *GetCleanup() { return nullptr; }
+  void *GetData() { return nullptr; }
+};
+
+template <class R, class P1, R F(P1), class I>
+struct Func1 : public UnboundFunc {
+  typedef R Return;
+  typedef I FuncInfo;
+  static R Call(P1 p1) { return F(p1); }
+};
+
+template <class R, class P1, class P2, R F(P1, P2), class I>
+struct Func2 : public UnboundFunc {
+  typedef R Return;
+  typedef I FuncInfo;
+  static R Call(P1 p1, P2 p2) { return F(p1, p2); }
+};
+
+template <class R, class P1, class P2, class P3, R F(P1, P2, P3), class I>
+struct Func3 : public UnboundFunc {
+  typedef R Return;
+  typedef I FuncInfo;
+  static R Call(P1 p1, P2 p2, P3 p3) { return F(p1, p2, p3); }
+};
+
+template <class R, class P1, class P2, class P3, class P4, R F(P1, P2, P3, P4),
+          class I>
+struct Func4 : public UnboundFunc {
+  typedef R Return;
+  typedef I FuncInfo;
+  static R Call(P1 p1, P2 p2, P3 p3, P4 p4) { return F(p1, p2, p3, p4); }
+};
+
+template <class R, class P1, class P2, class P3, class P4, class P5,
+          R F(P1, P2, P3, P4, P5), class I>
+struct Func5 : public UnboundFunc {
+  typedef R Return;
+  typedef I FuncInfo;
+  static R Call(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
+    return F(p1, p2, p3, p4, p5);
+  }
+};
+
+/* BoundFunc ******************************************************************/
+
+/* BoundFunc2, BoundFunc3: Like Func2/Func3 except also contains a value that
+ * shall be bound to the function's second parameter.
+ * 
+ * Note that the second parameter is a const pointer, but our stored bound value
+ * is non-const so we can free it when the handlers are destroyed. */
+template <class T>
+struct BoundFunc {
+  typedef typename remove_constptr<T>::type MutableP2;
+  explicit BoundFunc(MutableP2 data_) : data(data_) {}
+  CleanupFunc *GetCleanup() { return &DeletePointer<MutableP2>; }
+  MutableP2 GetData() { return data; }
+  MutableP2 data;
+};
+
+template <class R, class P1, class P2, R F(P1, P2), class I>
+struct BoundFunc2 : public BoundFunc<P2> {
+  typedef BoundFunc<P2> Base;
+  typedef I FuncInfo;
+  explicit BoundFunc2(typename Base::MutableP2 arg) : Base(arg) {}
+};
+
+template <class R, class P1, class P2, class P3, R F(P1, P2, P3), class I>
+struct BoundFunc3 : public BoundFunc<P2> {
+  typedef BoundFunc<P2> Base;
+  typedef I FuncInfo;
+  explicit BoundFunc3(typename Base::MutableP2 arg) : Base(arg) {}
+};
+
+template <class R, class P1, class P2, class P3, class P4, R F(P1, P2, P3, P4),
+          class I>
+struct BoundFunc4 : public BoundFunc<P2> {
+  typedef BoundFunc<P2> Base;
+  typedef I FuncInfo;
+  explicit BoundFunc4(typename Base::MutableP2 arg) : Base(arg) {}
+};
+
+template <class R, class P1, class P2, class P3, class P4, class P5,
+          R F(P1, P2, P3, P4, P5), class I>
+struct BoundFunc5 : public BoundFunc<P2> {
+  typedef BoundFunc<P2> Base;
+  typedef I FuncInfo;
+  explicit BoundFunc5(typename Base::MutableP2 arg) : Base(arg) {}
+};
+
+/* FuncSig ********************************************************************/
+
+/* FuncSig1, FuncSig2, FuncSig3: template classes reflecting a function
+ * *signature*, but without a specific function attached.
+ *
+ * These classes contain member functions that can be invoked with a
+ * specific function to return a Func/BoundFunc class. */
+template <class R, class P1>
+struct FuncSig1 {
+  template <R F(P1)>
+  Func1<R, P1, F, FuncInfo<P1, R> > GetFunc() {
+    return Func1<R, P1, F, FuncInfo<P1, R> >();
+  }
+};
+
+template <class R, class P1, class P2>
+struct FuncSig2 {
+  template <R F(P1, P2)>
+  Func2<R, P1, P2, F, FuncInfo<P1, R> > GetFunc() {
+    return Func2<R, P1, P2, F, FuncInfo<P1, R> >();
+  }
+
+  template <R F(P1, P2)>
+  BoundFunc2<R, P1, P2, F, FuncInfo<P1, R> > GetFunc(
+      typename remove_constptr<P2>::type param2) {
+    return BoundFunc2<R, P1, P2, F, FuncInfo<P1, R> >(param2);
+  }
+};
+
+template <class R, class P1, class P2, class P3>
+struct FuncSig3 {
+  template <R F(P1, P2, P3)>
+  Func3<R, P1, P2, P3, F, FuncInfo<P1, R> > GetFunc() {
+    return Func3<R, P1, P2, P3, F, FuncInfo<P1, R> >();
+  }
+
+  template <R F(P1, P2, P3)>
+  BoundFunc3<R, P1, P2, P3, F, FuncInfo<P1, R> > GetFunc(
+      typename remove_constptr<P2>::type param2) {
+    return BoundFunc3<R, P1, P2, P3, F, FuncInfo<P1, R> >(param2);
+  }
+};
+
+template <class R, class P1, class P2, class P3, class P4>
+struct FuncSig4 {
+  template <R F(P1, P2, P3, P4)>
+  Func4<R, P1, P2, P3, P4, F, FuncInfo<P1, R> > GetFunc() {
+    return Func4<R, P1, P2, P3, P4, F, FuncInfo<P1, R> >();
+  }
+
+  template <R F(P1, P2, P3, P4)>
+  BoundFunc4<R, P1, P2, P3, P4, F, FuncInfo<P1, R> > GetFunc(
+      typename remove_constptr<P2>::type param2) {
+    return BoundFunc4<R, P1, P2, P3, P4, F, FuncInfo<P1, R> >(param2);
+  }
+};
+
+template <class R, class P1, class P2, class P3, class P4, class P5>
+struct FuncSig5 {
+  template <R F(P1, P2, P3, P4, P5)>
+  Func5<R, P1, P2, P3, P4, P5, F, FuncInfo<P1, R> > GetFunc() {
+    return Func5<R, P1, P2, P3, P4, P5, F, FuncInfo<P1, R> >();
+  }
+
+  template <R F(P1, P2, P3, P4, P5)>
+  BoundFunc5<R, P1, P2, P3, P4, P5, F, FuncInfo<P1, R> > GetFunc(
+      typename remove_constptr<P2>::type param2) {
+    return BoundFunc5<R, P1, P2, P3, P4, P5, F, FuncInfo<P1, R> >(param2);
+  }
+};
+
+/* Overloaded template function that can construct the appropriate FuncSig*
+ * class given a function pointer by deducing the template parameters. */
+template <class R, class P1>
+inline FuncSig1<R, P1> MatchFunc(R (*f)(P1)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return FuncSig1<R, P1>();
+}
+
+template <class R, class P1, class P2>
+inline FuncSig2<R, P1, P2> MatchFunc(R (*f)(P1, P2)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return FuncSig2<R, P1, P2>();
+}
+
+template <class R, class P1, class P2, class P3>
+inline FuncSig3<R, P1, P2, P3> MatchFunc(R (*f)(P1, P2, P3)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return FuncSig3<R, P1, P2, P3>();
+}
+
+template <class R, class P1, class P2, class P3, class P4>
+inline FuncSig4<R, P1, P2, P3, P4> MatchFunc(R (*f)(P1, P2, P3, P4)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return FuncSig4<R, P1, P2, P3, P4>();
+}
+
+template <class R, class P1, class P2, class P3, class P4, class P5>
+inline FuncSig5<R, P1, P2, P3, P4, P5> MatchFunc(R (*f)(P1, P2, P3, P4, P5)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return FuncSig5<R, P1, P2, P3, P4, P5>();
+}
+
+/* MethodSig ******************************************************************/
+
+/* CallMethod*: a function template that calls a given method. */
+template <class R, class C, R (C::*F)()>
+R CallMethod0(C *obj) {
+  return ((*obj).*F)();
+}
+
+template <class R, class C, class P1, R (C::*F)(P1)>
+R CallMethod1(C *obj, P1 arg1) {
+  return ((*obj).*F)(arg1);
+}
+
+template <class R, class C, class P1, class P2, R (C::*F)(P1, P2)>
+R CallMethod2(C *obj, P1 arg1, P2 arg2) {
+  return ((*obj).*F)(arg1, arg2);
+}
+
+template <class R, class C, class P1, class P2, class P3, R (C::*F)(P1, P2, P3)>
+R CallMethod3(C *obj, P1 arg1, P2 arg2, P3 arg3) {
+  return ((*obj).*F)(arg1, arg2, arg3);
+}
+
+template <class R, class C, class P1, class P2, class P3, class P4,
+          R (C::*F)(P1, P2, P3, P4)>
+R CallMethod4(C *obj, P1 arg1, P2 arg2, P3 arg3, P4 arg4) {
+  return ((*obj).*F)(arg1, arg2, arg3, arg4);
+}
+
+/* MethodSig: like FuncSig, but for member functions.
+ *
+ * GetFunc() returns a normal FuncN object, so after calling GetFunc() no
+ * more logic is required to special-case methods. */
+template <class R, class C>
+struct MethodSig0 {
+  template <R (C::*F)()>
+  Func1<R, C *, CallMethod0<R, C, F>, FuncInfo<C *, R> > GetFunc() {
+    return Func1<R, C *, CallMethod0<R, C, F>, FuncInfo<C *, R> >();
+  }
+};
+
+template <class R, class C, class P1>
+struct MethodSig1 {
+  template <R (C::*F)(P1)>
+  Func2<R, C *, P1, CallMethod1<R, C, P1, F>, FuncInfo<C *, R> > GetFunc() {
+    return Func2<R, C *, P1, CallMethod1<R, C, P1, F>, FuncInfo<C *, R> >();
+  }
+
+  template <R (C::*F)(P1)>
+  BoundFunc2<R, C *, P1, CallMethod1<R, C, P1, F>, FuncInfo<C *, R> > GetFunc(
+      typename remove_constptr<P1>::type param1) {
+    return BoundFunc2<R, C *, P1, CallMethod1<R, C, P1, F>, FuncInfo<C *, R> >(
+        param1);
+  }
+};
+
+template <class R, class C, class P1, class P2>
+struct MethodSig2 {
+  template <R (C::*F)(P1, P2)>
+  Func3<R, C *, P1, P2, CallMethod2<R, C, P1, P2, F>, FuncInfo<C *, R> >
+  GetFunc() {
+    return Func3<R, C *, P1, P2, CallMethod2<R, C, P1, P2, F>,
+                 FuncInfo<C *, R> >();
+  }
+
+  template <R (C::*F)(P1, P2)>
+  BoundFunc3<R, C *, P1, P2, CallMethod2<R, C, P1, P2, F>, FuncInfo<C *, R> >
+  GetFunc(typename remove_constptr<P1>::type param1) {
+    return BoundFunc3<R, C *, P1, P2, CallMethod2<R, C, P1, P2, F>,
+                      FuncInfo<C *, R> >(param1);
+  }
+};
+
+template <class R, class C, class P1, class P2, class P3>
+struct MethodSig3 {
+  template <R (C::*F)(P1, P2, P3)>
+  Func4<R, C *, P1, P2, P3, CallMethod3<R, C, P1, P2, P3, F>, FuncInfo<C *, R> >
+  GetFunc() {
+    return Func4<R, C *, P1, P2, P3, CallMethod3<R, C, P1, P2, P3, F>,
+                 FuncInfo<C *, R> >();
+  }
+
+  template <R (C::*F)(P1, P2, P3)>
+  BoundFunc4<R, C *, P1, P2, P3, CallMethod3<R, C, P1, P2, P3, F>,
+             FuncInfo<C *, R> >
+  GetFunc(typename remove_constptr<P1>::type param1) {
+    return BoundFunc4<R, C *, P1, P2, P3, CallMethod3<R, C, P1, P2, P3, F>,
+                      FuncInfo<C *, R> >(param1);
+  }
+};
+
+template <class R, class C, class P1, class P2, class P3, class P4>
+struct MethodSig4 {
+  template <R (C::*F)(P1, P2, P3, P4)>
+  Func5<R, C *, P1, P2, P3, P4, CallMethod4<R, C, P1, P2, P3, P4, F>,
+        FuncInfo<C *, R> >
+  GetFunc() {
+    return Func5<R, C *, P1, P2, P3, P4, CallMethod4<R, C, P1, P2, P3, P4, F>,
+                 FuncInfo<C *, R> >();
+  }
+
+  template <R (C::*F)(P1, P2, P3, P4)>
+  BoundFunc5<R, C *, P1, P2, P3, P4, CallMethod4<R, C, P1, P2, P3, P4, F>,
+             FuncInfo<C *, R> >
+  GetFunc(typename remove_constptr<P1>::type param1) {
+    return BoundFunc5<R, C *, P1, P2, P3, P4,
+                      CallMethod4<R, C, P1, P2, P3, P4, F>, FuncInfo<C *, R> >(
+        param1);
+  }
+};
+
+template <class R, class C>
+inline MethodSig0<R, C> MatchFunc(R (C::*f)()) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return MethodSig0<R, C>();
+}
+
+template <class R, class C, class P1>
+inline MethodSig1<R, C, P1> MatchFunc(R (C::*f)(P1)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return MethodSig1<R, C, P1>();
+}
+
+template <class R, class C, class P1, class P2>
+inline MethodSig2<R, C, P1, P2> MatchFunc(R (C::*f)(P1, P2)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return MethodSig2<R, C, P1, P2>();
+}
+
+template <class R, class C, class P1, class P2, class P3>
+inline MethodSig3<R, C, P1, P2, P3> MatchFunc(R (C::*f)(P1, P2, P3)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return MethodSig3<R, C, P1, P2, P3>();
+}
+
+template <class R, class C, class P1, class P2, class P3, class P4>
+inline MethodSig4<R, C, P1, P2, P3, P4> MatchFunc(R (C::*f)(P1, P2, P3, P4)) {
+  UPB_UNUSED(f);  /* Only used for template parameter deduction. */
+  return MethodSig4<R, C, P1, P2, P3, P4>();
+}
+
+/* MaybeWrapReturn ************************************************************/
+
+/* Template class that attempts to wrap the return value of the function so it
+ * matches the expected type.  There are two main adjustments it may make:
+ *
+ *   1. If the function returns void, make it return the expected type and with
+ *      a value that always indicates success.
+ *   2. If the function returns bool, make it return the expected type with a
+ *      value that indicates success or failure.
+ *
+ * The "expected type" for return is:
+ *   1. void* for start handlers.  If the closure parameter has a different type
+ *      we will cast it to void* for the return in the success case.
+ *   2. size_t for string buffer handlers.
+ *   3. bool for everything else. */
+
+/* Template parameters are FuncN type and desired return type. */
+template <class F, class R, class Enable = void>
+struct MaybeWrapReturn;
+
+/* If the return type matches, return the given function unwrapped. */
+template <class F>
+struct MaybeWrapReturn<F, typename F::Return> {
+  typedef F Func;
+};
+
+/* Function wrapper that munges the return value from void to (bool)true. */
+template <class P1, class P2, void F(P1, P2)>
+bool ReturnTrue2(P1 p1, P2 p2) {
+  F(p1, p2);
+  return true;
+}
+
+template <class P1, class P2, class P3, void F(P1, P2, P3)>
+bool ReturnTrue3(P1 p1, P2 p2, P3 p3) {
+  F(p1, p2, p3);
+  return true;
+}
+
+/* Function wrapper that munges the return value from void to (void*)arg1  */
+template <class P1, class P2, void F(P1, P2)>
+void *ReturnClosure2(P1 p1, P2 p2) {
+  F(p1, p2);
+  return p1;
+}
+
+template <class P1, class P2, class P3, void F(P1, P2, P3)>
+void *ReturnClosure3(P1 p1, P2 p2, P3 p3) {
+  F(p1, p2, p3);
+  return p1;
+}
+
+/* Function wrapper that munges the return value from R to void*. */
+template <class R, class P1, class P2, R F(P1, P2)>
+void *CastReturnToVoidPtr2(P1 p1, P2 p2) {
+  return F(p1, p2);
+}
+
+template <class R, class P1, class P2, class P3, R F(P1, P2, P3)>
+void *CastReturnToVoidPtr3(P1 p1, P2 p2, P3 p3) {
+  return F(p1, p2, p3);
+}
+
+/* Function wrapper that munges the return value from bool to void*. */
+template <class P1, class P2, bool F(P1, P2)>
+void *ReturnClosureOrBreak2(P1 p1, P2 p2) {
+  return F(p1, p2) ? p1 : UPB_BREAK;
+}
+
+template <class P1, class P2, class P3, bool F(P1, P2, P3)>
+void *ReturnClosureOrBreak3(P1 p1, P2 p2, P3 p3) {
+  return F(p1, p2, p3) ? p1 : UPB_BREAK;
+}
+
+/* For the string callback, which takes five params, returns the size param. */
+template <class P1, class P2,
+          void F(P1, P2, const char *, size_t, const upb_bufhandle *)>
+size_t ReturnStringLen(P1 p1, P2 p2, const char *p3, size_t p4,
+                       const upb_bufhandle *p5) {
+  F(p1, p2, p3, p4, p5);
+  return p4;
+}
+
+/* For the string callback, which takes five params, returns the size param or
+ * zero. */
+template <class P1, class P2,
+          bool F(P1, P2, const char *, size_t, const upb_bufhandle *)>
+size_t ReturnNOr0(P1 p1, P2 p2, const char *p3, size_t p4,
+                  const upb_bufhandle *p5) {
+  return F(p1, p2, p3, p4, p5) ? p4 : 0;
+}
+
+/* If we have a function returning void but want a function returning bool, wrap
+ * it in a function that returns true. */
+template <class P1, class P2, void F(P1, P2), class I>
+struct MaybeWrapReturn<Func2<void, P1, P2, F, I>, bool> {
+  typedef Func2<bool, P1, P2, ReturnTrue2<P1, P2, F>, I> Func;
+};
+
+template <class P1, class P2, class P3, void F(P1, P2, P3), class I>
+struct MaybeWrapReturn<Func3<void, P1, P2, P3, F, I>, bool> {
+  typedef Func3<bool, P1, P2, P3, ReturnTrue3<P1, P2, P3, F>, I> Func;
+};
+
+/* If our function returns void but we want one returning void*, wrap it in a
+ * function that returns the first argument. */
+template <class P1, class P2, void F(P1, P2), class I>
+struct MaybeWrapReturn<Func2<void, P1, P2, F, I>, void *> {
+  typedef Func2<void *, P1, P2, ReturnClosure2<P1, P2, F>, I> Func;
+};
+
+template <class P1, class P2, class P3, void F(P1, P2, P3), class I>
+struct MaybeWrapReturn<Func3<void, P1, P2, P3, F, I>, void *> {
+  typedef Func3<void *, P1, P2, P3, ReturnClosure3<P1, P2, P3, F>, I> Func;
+};
+
+/* If our function returns R* but we want one returning void*, wrap it in a
+ * function that casts to void*. */
+template <class R, class P1, class P2, R *F(P1, P2), class I>
+struct MaybeWrapReturn<Func2<R *, P1, P2, F, I>, void *,
+                       typename disable_if_same<R *, void *>::Type> {
+  typedef Func2<void *, P1, P2, CastReturnToVoidPtr2<R *, P1, P2, F>, I> Func;
+};
+
+template <class R, class P1, class P2, class P3, R *F(P1, P2, P3), class I>
+struct MaybeWrapReturn<Func3<R *, P1, P2, P3, F, I>, void *,
+                       typename disable_if_same<R *, void *>::Type> {
+  typedef Func3<void *, P1, P2, P3, CastReturnToVoidPtr3<R *, P1, P2, P3, F>, I>
+      Func;
+};
+
+/* If our function returns bool but we want one returning void*, wrap it in a
+ * function that returns either the first param or UPB_BREAK. */
+template <class P1, class P2, bool F(P1, P2), class I>
+struct MaybeWrapReturn<Func2<bool, P1, P2, F, I>, void *> {
+  typedef Func2<void *, P1, P2, ReturnClosureOrBreak2<P1, P2, F>, I> Func;
+};
+
+template <class P1, class P2, class P3, bool F(P1, P2, P3), class I>
+struct MaybeWrapReturn<Func3<bool, P1, P2, P3, F, I>, void *> {
+  typedef Func3<void *, P1, P2, P3, ReturnClosureOrBreak3<P1, P2, P3, F>, I>
+      Func;
+};
+
+/* If our function returns void but we want one returning size_t, wrap it in a
+ * function that returns the size argument. */
+template <class P1, class P2,
+          void F(P1, P2, const char *, size_t, const upb_bufhandle *), class I>
+struct MaybeWrapReturn<
+    Func5<void, P1, P2, const char *, size_t, const upb_bufhandle *, F, I>,
+          size_t> {
+  typedef Func5<size_t, P1, P2, const char *, size_t, const upb_bufhandle *,
+                ReturnStringLen<P1, P2, F>, I> Func;
+};
+
+/* If our function returns bool but we want one returning size_t, wrap it in a
+ * function that returns either 0 or the buf size. */
+template <class P1, class P2,
+          bool F(P1, P2, const char *, size_t, const upb_bufhandle *), class I>
+struct MaybeWrapReturn<
+    Func5<bool, P1, P2, const char *, size_t, const upb_bufhandle *, F, I>,
+    size_t> {
+  typedef Func5<size_t, P1, P2, const char *, size_t, const upb_bufhandle *,
+                ReturnNOr0<P1, P2, F>, I> Func;
+};
+
+/* ConvertParams **************************************************************/
+
+/* Template class that converts the function parameters if necessary, and
+ * ignores the HandlerData parameter if appropriate.
+ *
+ * Template parameter is the are FuncN function type. */
+template <class F, class T>
+struct ConvertParams;
+
+/* Function that discards the handler data parameter. */
+template <class R, class P1, R F(P1)>
+R IgnoreHandlerData2(void *p1, const void *hd) {
+  UPB_UNUSED(hd);
+  return F(static_cast<P1>(p1));
+}
+
+template <class R, class P1, class P2Wrapper, class P2Wrapped,
+          R F(P1, P2Wrapped)>
+R IgnoreHandlerData3(void *p1, const void *hd, P2Wrapper p2) {
+  UPB_UNUSED(hd);
+  return F(static_cast<P1>(p1), p2);
+}
+
+template <class R, class P1, class P2, class P3, R F(P1, P2, P3)>
+R IgnoreHandlerData4(void *p1, const void *hd, P2 p2, P3 p3) {
+  UPB_UNUSED(hd);
+  return F(static_cast<P1>(p1), p2, p3);
+}
+
+template <class R, class P1, class P2, class P3, class P4, R F(P1, P2, P3, P4)>
+R IgnoreHandlerData5(void *p1, const void *hd, P2 p2, P3 p3, P4 p4) {
+  UPB_UNUSED(hd);
+  return F(static_cast<P1>(p1), p2, p3, p4);
+}
+
+template <class R, class P1, R F(P1, const char*, size_t)>
+R IgnoreHandlerDataIgnoreHandle(void *p1, const void *hd, const char *p2,
+                                size_t p3, const upb_bufhandle *handle) {
+  UPB_UNUSED(hd);
+  UPB_UNUSED(handle);
+  return F(static_cast<P1>(p1), p2, p3);
+}
+
+/* Function that casts the handler data parameter. */
+template <class R, class P1, class P2, R F(P1, P2)>
+R CastHandlerData2(void *c, const void *hd) {
+  return F(static_cast<P1>(c), static_cast<P2>(hd));
+}
+
+template <class R, class P1, class P2, class P3Wrapper, class P3Wrapped,
+          R F(P1, P2, P3Wrapped)>
+R CastHandlerData3(void *c, const void *hd, P3Wrapper p3) {
+  return F(static_cast<P1>(c), static_cast<P2>(hd), p3);
+}
+
+template <class R, class P1, class P2, class P3, class P4, class P5,
+          R F(P1, P2, P3, P4, P5)>
+R CastHandlerData5(void *c, const void *hd, P3 p3, P4 p4, P5 p5) {
+  return F(static_cast<P1>(c), static_cast<P2>(hd), p3, p4, p5);
+}
+
+template <class R, class P1, class P2, R F(P1, P2, const char *, size_t)>
+R CastHandlerDataIgnoreHandle(void *c, const void *hd, const char *p3,
+                              size_t p4, const upb_bufhandle *handle) {
+  UPB_UNUSED(handle);
+  return F(static_cast<P1>(c), static_cast<P2>(hd), p3, p4);
+}
+
+/* For unbound functions, ignore the handler data. */
+template <class R, class P1, R F(P1), class I, class T>
+struct ConvertParams<Func1<R, P1, F, I>, T> {
+  typedef Func2<R, void *, const void *, IgnoreHandlerData2<R, P1, F>, I> Func;
+};
+
+template <class R, class P1, class P2, R F(P1, P2), class I,
+          class R2, class P1_2, class P2_2, class P3_2>
+struct ConvertParams<Func2<R, P1, P2, F, I>,
+                     R2 (*)(P1_2, P2_2, P3_2)> {
+  typedef Func3<R, void *, const void *, P3_2,
+                IgnoreHandlerData3<R, P1, P3_2, P2, F>, I> Func;
+};
+
+/* For StringBuffer only; this ignores both the handler data and the
+ * upb_bufhandle. */
+template <class R, class P1, R F(P1, const char *, size_t), class I, class T>
+struct ConvertParams<Func3<R, P1, const char *, size_t, F, I>, T> {
+  typedef Func5<R, void *, const void *, const char *, size_t,
+                const upb_bufhandle *, IgnoreHandlerDataIgnoreHandle<R, P1, F>,
+                I> Func;
+};
+
+template <class R, class P1, class P2, class P3, class P4, R F(P1, P2, P3, P4),
+          class I, class T>
+struct ConvertParams<Func4<R, P1, P2, P3, P4, F, I>, T> {
+  typedef Func5<R, void *, const void *, P2, P3, P4,
+                IgnoreHandlerData5<R, P1, P2, P3, P4, F>, I> Func;
+};
+
+/* For bound functions, cast the handler data. */
+template <class R, class P1, class P2, R F(P1, P2), class I, class T>
+struct ConvertParams<BoundFunc2<R, P1, P2, F, I>, T> {
+  typedef Func2<R, void *, const void *, CastHandlerData2<R, P1, P2, F>, I>
+      Func;
+};
+
+template <class R, class P1, class P2, class P3, R F(P1, P2, P3), class I,
+          class R2, class P1_2, class P2_2, class P3_2>
+struct ConvertParams<BoundFunc3<R, P1, P2, P3, F, I>,
+                     R2 (*)(P1_2, P2_2, P3_2)> {
+  typedef Func3<R, void *, const void *, P3_2,
+                CastHandlerData3<R, P1, P2, P3_2, P3, F>, I> Func;
+};
+
+/* For StringBuffer only; this ignores the upb_bufhandle. */
+template <class R, class P1, class P2, R F(P1, P2, const char *, size_t),
+          class I, class T>
+struct ConvertParams<BoundFunc4<R, P1, P2, const char *, size_t, F, I>, T> {
+  typedef Func5<R, void *, const void *, const char *, size_t,
+                const upb_bufhandle *,
+                CastHandlerDataIgnoreHandle<R, P1, P2, F>, I>
+      Func;
+};
+
+template <class R, class P1, class P2, class P3, class P4, class P5,
+          R F(P1, P2, P3, P4, P5), class I, class T>
+struct ConvertParams<BoundFunc5<R, P1, P2, P3, P4, P5, F, I>, T> {
+  typedef Func5<R, void *, const void *, P3, P4, P5,
+                CastHandlerData5<R, P1, P2, P3, P4, P5, F>, I> Func;
+};
+
+/* utype/ltype are upper/lower-case, ctype is canonical C type, vtype is
+ * variant C type. */
+#define TYPE_METHODS(utype, ltype, ctype, vtype)                      \
+  template <>                                                         \
+  struct CanonicalType<vtype> {                                       \
+    typedef ctype Type;                                               \
+  };                                                                  \
+  template <>                                                         \
+  inline bool HandlersPtr::SetValueHandler<vtype>(                    \
+      FieldDefPtr f, const HandlersPtr::utype##Handler &handler) {    \
+    handler.AddCleanup(ptr());                                        \
+    return upb_handlers_set##ltype(ptr(), f.ptr(), handler.handler(), \
+                                   &handler.attr());                  \
+  }
+
+TYPE_METHODS(Double, double, double,   double)
+TYPE_METHODS(Float,  float,  float,    float)
+TYPE_METHODS(UInt64, uint64, uint64_t, UPB_UINT64_T)
+TYPE_METHODS(UInt32, uint32, uint32_t, UPB_UINT32_T)
+TYPE_METHODS(Int64,  int64,  int64_t,  UPB_INT64_T)
+TYPE_METHODS(Int32,  int32,  int32_t,  UPB_INT32_T)
+TYPE_METHODS(Bool,   bool,   bool,     bool)
+
+#ifdef UPB_TWO_32BIT_TYPES
+TYPE_METHODS(Int32,  int32,  int32_t,  UPB_INT32ALT_T)
+TYPE_METHODS(UInt32, uint32, uint32_t, UPB_UINT32ALT_T)
+#endif
+
+#ifdef UPB_TWO_64BIT_TYPES
+TYPE_METHODS(Int64,  int64,  int64_t,  UPB_INT64ALT_T)
+TYPE_METHODS(UInt64, uint64, uint64_t, UPB_UINT64ALT_T)
+#endif
+#undef TYPE_METHODS
+
+template <> struct CanonicalType<Status*> {
+  typedef Status* Type;
+};
+
+template <class F> struct ReturnOf;
+
+template <class R, class P1, class P2>
+struct ReturnOf<R (*)(P1, P2)> {
+  typedef R Return;
+};
+
+template <class R, class P1, class P2, class P3>
+struct ReturnOf<R (*)(P1, P2, P3)> {
+  typedef R Return;
+};
+
+template <class R, class P1, class P2, class P3, class P4>
+struct ReturnOf<R (*)(P1, P2, P3, P4)> {
+  typedef R Return;
+};
+
+template <class R, class P1, class P2, class P3, class P4, class P5>
+struct ReturnOf<R (*)(P1, P2, P3, P4, P5)> {
+  typedef R Return;
+};
+
+
+template <class T>
+template <class F>
+inline Handler<T>::Handler(F func)
+    : registered_(false),
+      cleanup_data_(func.GetData()),
+      cleanup_func_(func.GetCleanup()) {
+  attr_.handler_data = func.GetData();
+  typedef typename ReturnOf<T>::Return Return;
+  typedef typename ConvertParams<F, T>::Func ConvertedParamsFunc;
+  typedef typename MaybeWrapReturn<ConvertedParamsFunc, Return>::Func
+      ReturnWrappedFunc;
+  handler_ = ReturnWrappedFunc().Call;
+
+  /* Set attributes based on what templates can statically tell us about the
+   * user's function. */
+
+  /* If the original function returns void, then we know that we wrapped it to
+   * always return ok. */
+  bool always_ok = is_same<typename F::FuncInfo::Return, void>::value;
+  attr_.alwaysok = always_ok;
+
+  /* Closure parameter and return type. */
+  attr_.closure_type = UniquePtrForType<typename F::FuncInfo::Closure>();
+
+  /* We use the closure type (from the first parameter) if the return type is
+   * void or bool, since these are the two cases we wrap to return the closure's
+   * type anyway.
+   *
+   * This is all nonsense for non START* handlers, but it doesn't matter because
+   * in that case the value will be ignored. */
+  typedef typename FirstUnlessVoidOrBool<typename F::FuncInfo::Return,
+                                         typename F::FuncInfo::Closure>::value
+      EffectiveReturn;
+  attr_.return_closure_type = UniquePtrForType<EffectiveReturn>();
+}
+
+template <class T>
+inline void Handler<T>::AddCleanup(upb_handlers* h) const {
+  UPB_ASSERT(!registered_);
+  registered_ = true;
+  if (cleanup_func_) {
+    bool ok = upb_handlers_addcleanup(h, cleanup_data_, cleanup_func_);
+    UPB_ASSERT(ok);
+  }
+}
+
+}  /* namespace upb */
+
+#endif  /* __cplusplus */
+
+
+#undef UPB_TWO_32BIT_TYPES
+#undef UPB_TWO_64BIT_TYPES
+#undef UPB_INT32_T
+#undef UPB_UINT32_T
+#undef UPB_INT32ALT_T
+#undef UPB_UINT32ALT_T
+#undef UPB_INT64_T
+#undef UPB_UINT64_T
+#undef UPB_INT64ALT_T
+#undef UPB_UINT64ALT_T
+
+#include "upb/port_undef.inc"
+
+#endif  /* UPB_HANDLERS_INL_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers.c
new file mode 100644 (file)
index 0000000..844a360
--- /dev/null
@@ -0,0 +1,567 @@
+/*
+** TODO(haberman): it's unclear whether a lot of the consistency checks should
+** UPB_ASSERT() or return false.
+*/
+
+#include "upb/handlers.h"
+
+#include <string.h>
+
+#include "upb/sink.h"
+
+#include "upb/port_def.inc"
+
+struct upb_handlers {
+  upb_handlercache *cache;
+  const upb_msgdef *msg;
+  const upb_handlers **sub;
+  const void *top_closure_type;
+  upb_handlers_tabent table[1];  /* Dynamically-sized field handler array. */
+};
+
+static void *upb_calloc(upb_arena *arena, size_t size) {
+  void *mem = upb_malloc(upb_arena_alloc(arena), size);
+  if (mem) {
+    memset(mem, 0, size);
+  }
+  return mem;
+}
+
+/* Defined for the sole purpose of having a unique pointer value for
+ * UPB_NO_CLOSURE. */
+char _upb_noclosure;
+
+/* Given a selector for a STARTSUBMSG handler, resolves to a pointer to the
+ * subhandlers for this submessage field. */
+#define SUBH(h, selector) (h->sub[selector])
+
+/* The selector for a submessage field is the field index. */
+#define SUBH_F(h, f) SUBH(h, upb_fielddef_index(f))
+
+static int32_t trygetsel(upb_handlers *h, const upb_fielddef *f,
+                         upb_handlertype_t type) {
+  upb_selector_t sel;
+  bool ok;
+
+  ok = upb_handlers_getselector(f, type, &sel);
+
+  UPB_ASSERT(upb_handlers_msgdef(h) == upb_fielddef_containingtype(f));
+  UPB_ASSERT(ok);
+
+  return sel;
+}
+
+static upb_selector_t handlers_getsel(upb_handlers *h, const upb_fielddef *f,
+                             upb_handlertype_t type) {
+  int32_t sel = trygetsel(h, f, type);
+  UPB_ASSERT(sel >= 0);
+  return sel;
+}
+
+static const void **returntype(upb_handlers *h, const upb_fielddef *f,
+                               upb_handlertype_t type) {
+  return &h->table[handlers_getsel(h, f, type)].attr.return_closure_type;
+}
+
+static bool doset(upb_handlers *h, int32_t sel, const upb_fielddef *f,
+                  upb_handlertype_t type, upb_func *func,
+                  const upb_handlerattr *attr) {
+  upb_handlerattr set_attr = UPB_HANDLERATTR_INIT;
+  const void *closure_type;
+  const void **context_closure_type;
+
+  UPB_ASSERT(!h->table[sel].func);
+
+  if (attr) {
+    set_attr = *attr;
+  }
+
+  /* Check that the given closure type matches the closure type that has been
+   * established for this context (if any). */
+  closure_type = set_attr.closure_type;
+
+  if (type == UPB_HANDLER_STRING) {
+    context_closure_type = returntype(h, f, UPB_HANDLER_STARTSTR);
+  } else if (f && upb_fielddef_isseq(f) &&
+             type != UPB_HANDLER_STARTSEQ &&
+             type != UPB_HANDLER_ENDSEQ) {
+    context_closure_type = returntype(h, f, UPB_HANDLER_STARTSEQ);
+  } else {
+    context_closure_type = &h->top_closure_type;
+  }
+
+  if (closure_type && *context_closure_type &&
+      closure_type != *context_closure_type) {
+    return false;
+  }
+
+  if (closure_type)
+    *context_closure_type = closure_type;
+
+  /* If this is a STARTSEQ or STARTSTR handler, check that the returned pointer
+   * matches any pre-existing expectations about what type is expected. */
+  if (type == UPB_HANDLER_STARTSEQ || type == UPB_HANDLER_STARTSTR) {
+    const void *return_type = set_attr.return_closure_type;
+    const void *table_return_type = h->table[sel].attr.return_closure_type;
+    if (return_type && table_return_type && return_type != table_return_type) {
+      return false;
+    }
+
+    if (table_return_type && !return_type) {
+      set_attr.return_closure_type = table_return_type;
+    }
+  }
+
+  h->table[sel].func = (upb_func*)func;
+  h->table[sel].attr = set_attr;
+  return true;
+}
+
+/* Returns the effective closure type for this handler (which will propagate
+ * from outer frames if this frame has no START* handler).  Not implemented for
+ * UPB_HANDLER_STRING at the moment since this is not needed.  Returns NULL is
+ * the effective closure type is unspecified (either no handler was registered
+ * to specify it or the handler that was registered did not specify the closure
+ * type). */
+const void *effective_closure_type(upb_handlers *h, const upb_fielddef *f,
+                                   upb_handlertype_t type) {
+  const void *ret;
+  upb_selector_t sel;
+
+  UPB_ASSERT(type != UPB_HANDLER_STRING);
+  ret = h->top_closure_type;
+
+  if (upb_fielddef_isseq(f) &&
+      type != UPB_HANDLER_STARTSEQ &&
+      type != UPB_HANDLER_ENDSEQ &&
+      h->table[sel = handlers_getsel(h, f, UPB_HANDLER_STARTSEQ)].func) {
+    ret = h->table[sel].attr.return_closure_type;
+  }
+
+  if (type == UPB_HANDLER_STRING &&
+      h->table[sel = handlers_getsel(h, f, UPB_HANDLER_STARTSTR)].func) {
+    ret = h->table[sel].attr.return_closure_type;
+  }
+
+  /* The effective type of the submessage; not used yet.
+   * if (type == SUBMESSAGE &&
+   *     h->table[sel = handlers_getsel(h, f, UPB_HANDLER_STARTSUBMSG)].func) {
+   *   ret = h->table[sel].attr.return_closure_type;
+   * } */
+
+  return ret;
+}
+
+/* Checks whether the START* handler specified by f & type is missing even
+ * though it is required to convert the established type of an outer frame
+ * ("closure_type") into the established type of an inner frame (represented in
+ * the return closure type of this handler's attr. */
+bool checkstart(upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type,
+                upb_status *status) {
+  const void *closure_type;
+  const upb_handlerattr *attr;
+  const void *return_closure_type;
+
+  upb_selector_t sel = handlers_getsel(h, f, type);
+  if (h->table[sel].func) return true;
+  closure_type = effective_closure_type(h, f, type);
+  attr = &h->table[sel].attr;
+  return_closure_type = attr->return_closure_type;
+  if (closure_type && return_closure_type &&
+      closure_type != return_closure_type) {
+    return false;
+  }
+  return true;
+}
+
+static upb_handlers *upb_handlers_new(const upb_msgdef *md,
+                                      upb_handlercache *cache,
+                                      upb_arena *arena) {
+  int extra;
+  upb_handlers *h;
+
+  extra = sizeof(upb_handlers_tabent) * (upb_msgdef_selectorcount(md) - 1);
+  h = upb_calloc(arena, sizeof(*h) + extra);
+  if (!h) return NULL;
+
+  h->cache = cache;
+  h->msg = md;
+
+  if (upb_msgdef_submsgfieldcount(md) > 0) {
+    size_t bytes = upb_msgdef_submsgfieldcount(md) * sizeof(*h->sub);
+    h->sub = upb_calloc(arena, bytes);
+    if (!h->sub) return NULL;
+  } else {
+    h->sub = 0;
+  }
+
+  /* calloc() above initialized all handlers to NULL. */
+  return h;
+}
+
+/* Public interface ***********************************************************/
+
+#define SETTER(name, handlerctype, handlertype)                       \
+  bool upb_handlers_set##name(upb_handlers *h, const upb_fielddef *f, \
+                              handlerctype func,                      \
+                              const upb_handlerattr *attr) {          \
+    int32_t sel = trygetsel(h, f, handlertype);                       \
+    return doset(h, sel, f, handlertype, (upb_func *)func, attr);     \
+  }
+
+SETTER(int32,       upb_int32_handlerfunc*,       UPB_HANDLER_INT32)
+SETTER(int64,       upb_int64_handlerfunc*,       UPB_HANDLER_INT64)
+SETTER(uint32,      upb_uint32_handlerfunc*,      UPB_HANDLER_UINT32)
+SETTER(uint64,      upb_uint64_handlerfunc*,      UPB_HANDLER_UINT64)
+SETTER(float,       upb_float_handlerfunc*,       UPB_HANDLER_FLOAT)
+SETTER(double,      upb_double_handlerfunc*,      UPB_HANDLER_DOUBLE)
+SETTER(bool,        upb_bool_handlerfunc*,        UPB_HANDLER_BOOL)
+SETTER(startstr,    upb_startstr_handlerfunc*,    UPB_HANDLER_STARTSTR)
+SETTER(string,      upb_string_handlerfunc*,      UPB_HANDLER_STRING)
+SETTER(endstr,      upb_endfield_handlerfunc*,    UPB_HANDLER_ENDSTR)
+SETTER(startseq,    upb_startfield_handlerfunc*,  UPB_HANDLER_STARTSEQ)
+SETTER(startsubmsg, upb_startfield_handlerfunc*,  UPB_HANDLER_STARTSUBMSG)
+SETTER(endsubmsg,   upb_endfield_handlerfunc*,    UPB_HANDLER_ENDSUBMSG)
+SETTER(endseq,      upb_endfield_handlerfunc*,    UPB_HANDLER_ENDSEQ)
+
+#undef SETTER
+
+bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
+                             const upb_handlerattr *attr) {
+  return doset(h, UPB_UNKNOWN_SELECTOR, NULL, UPB_HANDLER_INT32,
+               (upb_func *)func, attr);
+}
+
+bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
+                              const upb_handlerattr *attr) {
+  return doset(h, UPB_STARTMSG_SELECTOR, NULL, UPB_HANDLER_INT32,
+               (upb_func *)func, attr);
+}
+
+bool upb_handlers_setendmsg(upb_handlers *h, upb_endmsg_handlerfunc *func,
+                            const upb_handlerattr *attr) {
+  return doset(h, UPB_ENDMSG_SELECTOR, NULL, UPB_HANDLER_INT32,
+               (upb_func *)func, attr);
+}
+
+bool upb_handlers_setsubhandlers(upb_handlers *h, const upb_fielddef *f,
+                                 const upb_handlers *sub) {
+  UPB_ASSERT(sub);
+  UPB_ASSERT(upb_fielddef_issubmsg(f));
+  if (SUBH_F(h, f)) return false;  /* Can't reset. */
+  if (upb_handlers_msgdef(sub) != upb_fielddef_msgsubdef(f)) {
+    return false;
+  }
+  SUBH_F(h, f) = sub;
+  return true;
+}
+
+const upb_handlers *upb_handlers_getsubhandlers(const upb_handlers *h,
+                                                const upb_fielddef *f) {
+  UPB_ASSERT(upb_fielddef_issubmsg(f));
+  return SUBH_F(h, f);
+}
+
+upb_func *upb_handlers_gethandler(const upb_handlers *h, upb_selector_t s,
+                                  const void **handler_data) {
+  upb_func *ret = (upb_func *)h->table[s].func;
+  if (ret && handler_data) {
+    *handler_data = h->table[s].attr.handler_data;
+  }
+  return ret;
+}
+
+bool upb_handlers_getattr(const upb_handlers *h, upb_selector_t sel,
+                          upb_handlerattr *attr) {
+  if (!upb_handlers_gethandler(h, sel, NULL))
+    return false;
+  *attr = h->table[sel].attr;
+  return true;
+}
+
+const upb_handlers *upb_handlers_getsubhandlers_sel(const upb_handlers *h,
+                                                    upb_selector_t sel) {
+  /* STARTSUBMSG selector in sel is the field's selector base. */
+  return SUBH(h, sel - UPB_STATIC_SELECTOR_COUNT);
+}
+
+const upb_msgdef *upb_handlers_msgdef(const upb_handlers *h) { return h->msg; }
+
+bool upb_handlers_addcleanup(upb_handlers *h, void *p, upb_handlerfree *func) {
+  return upb_handlercache_addcleanup(h->cache, p, func);
+}
+
+upb_handlertype_t upb_handlers_getprimitivehandlertype(const upb_fielddef *f) {
+  switch (upb_fielddef_type(f)) {
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_ENUM: return UPB_HANDLER_INT32;
+    case UPB_TYPE_INT64: return UPB_HANDLER_INT64;
+    case UPB_TYPE_UINT32: return UPB_HANDLER_UINT32;
+    case UPB_TYPE_UINT64: return UPB_HANDLER_UINT64;
+    case UPB_TYPE_FLOAT: return UPB_HANDLER_FLOAT;
+    case UPB_TYPE_DOUBLE: return UPB_HANDLER_DOUBLE;
+    case UPB_TYPE_BOOL: return UPB_HANDLER_BOOL;
+    default: UPB_ASSERT(false); return -1;  /* Invalid input. */
+  }
+}
+
+bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type,
+                              upb_selector_t *s) {
+  uint32_t selector_base = upb_fielddef_selectorbase(f);
+  switch (type) {
+    case UPB_HANDLER_INT32:
+    case UPB_HANDLER_INT64:
+    case UPB_HANDLER_UINT32:
+    case UPB_HANDLER_UINT64:
+    case UPB_HANDLER_FLOAT:
+    case UPB_HANDLER_DOUBLE:
+    case UPB_HANDLER_BOOL:
+      if (!upb_fielddef_isprimitive(f) ||
+          upb_handlers_getprimitivehandlertype(f) != type)
+        return false;
+      *s = selector_base;
+      break;
+    case UPB_HANDLER_STRING:
+      if (upb_fielddef_isstring(f)) {
+        *s = selector_base;
+      } else if (upb_fielddef_lazy(f)) {
+        *s = selector_base + 3;
+      } else {
+        return false;
+      }
+      break;
+    case UPB_HANDLER_STARTSTR:
+      if (upb_fielddef_isstring(f) || upb_fielddef_lazy(f)) {
+        *s = selector_base + 1;
+      } else {
+        return false;
+      }
+      break;
+    case UPB_HANDLER_ENDSTR:
+      if (upb_fielddef_isstring(f) || upb_fielddef_lazy(f)) {
+        *s = selector_base + 2;
+      } else {
+        return false;
+      }
+      break;
+    case UPB_HANDLER_STARTSEQ:
+      if (!upb_fielddef_isseq(f)) return false;
+      *s = selector_base - 2;
+      break;
+    case UPB_HANDLER_ENDSEQ:
+      if (!upb_fielddef_isseq(f)) return false;
+      *s = selector_base - 1;
+      break;
+    case UPB_HANDLER_STARTSUBMSG:
+      if (!upb_fielddef_issubmsg(f)) return false;
+      /* Selectors for STARTSUBMSG are at the beginning of the table so that the
+       * selector can also be used as an index into the "sub" array of
+       * subhandlers.  The indexes for the two into these two tables are the
+       * same, except that in the handler table the static selectors come first. */
+      *s = upb_fielddef_index(f) + UPB_STATIC_SELECTOR_COUNT;
+      break;
+    case UPB_HANDLER_ENDSUBMSG:
+      if (!upb_fielddef_issubmsg(f)) return false;
+      *s = selector_base;
+      break;
+  }
+  UPB_ASSERT((size_t)*s < upb_msgdef_selectorcount(upb_fielddef_containingtype(f)));
+  return true;
+}
+
+/* upb_handlercache ***********************************************************/
+
+struct upb_handlercache {
+  upb_arena *arena;
+  upb_inttable tab;  /* maps upb_msgdef* -> upb_handlers*. */
+  upb_handlers_callback *callback;
+  const void *closure;
+};
+
+const upb_handlers *upb_handlercache_get(upb_handlercache *c,
+                                         const upb_msgdef *md) {
+  upb_msg_field_iter i;
+  upb_value v;
+  upb_handlers *h;
+
+  if (upb_inttable_lookupptr(&c->tab, md, &v)) {
+    return upb_value_getptr(v);
+  }
+
+  h = upb_handlers_new(md, c, c->arena);
+  v = upb_value_ptr(h);
+
+  if (!h) return NULL;
+  if (!upb_inttable_insertptr(&c->tab, md, v)) return NULL;
+
+  c->callback(c->closure, h);
+
+  /* For each submessage field, get or create a handlers object and set it as
+   * the subhandlers. */
+  for(upb_msg_field_begin(&i, md);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    upb_fielddef *f = upb_msg_iter_field(&i);
+
+    if (upb_fielddef_issubmsg(f)) {
+      const upb_msgdef *subdef = upb_fielddef_msgsubdef(f);
+      const upb_handlers *sub_mh = upb_handlercache_get(c, subdef);
+
+      if (!sub_mh) return NULL;
+
+      upb_handlers_setsubhandlers(h, f, sub_mh);
+    }
+  }
+
+  return h;
+}
+
+
+upb_handlercache *upb_handlercache_new(upb_handlers_callback *callback,
+                                       const void *closure) {
+  upb_handlercache *cache = upb_gmalloc(sizeof(*cache));
+
+  if (!cache) return NULL;
+
+  cache->arena = upb_arena_new();
+
+  cache->callback = callback;
+  cache->closure = closure;
+
+  if (!upb_inttable_init(&cache->tab, UPB_CTYPE_PTR)) goto oom;
+
+  return cache;
+
+oom:
+  upb_gfree(cache);
+  return NULL;
+}
+
+void upb_handlercache_free(upb_handlercache *cache) {
+  upb_inttable_uninit(&cache->tab);
+  upb_arena_free(cache->arena);
+  upb_gfree(cache);
+}
+
+bool upb_handlercache_addcleanup(upb_handlercache *c, void *p,
+                                 upb_handlerfree *func) {
+  return upb_arena_addcleanup(c->arena, p, func);
+}
+
+/* upb_byteshandler ***********************************************************/
+
+bool upb_byteshandler_setstartstr(upb_byteshandler *h,
+                                  upb_startstr_handlerfunc *func, void *d) {
+  h->table[UPB_STARTSTR_SELECTOR].func = (upb_func*)func;
+  h->table[UPB_STARTSTR_SELECTOR].attr.handler_data = d;
+  return true;
+}
+
+bool upb_byteshandler_setstring(upb_byteshandler *h,
+                                upb_string_handlerfunc *func, void *d) {
+  h->table[UPB_STRING_SELECTOR].func = (upb_func*)func;
+  h->table[UPB_STRING_SELECTOR].attr.handler_data = d;
+  return true;
+}
+
+bool upb_byteshandler_setendstr(upb_byteshandler *h,
+                                upb_endfield_handlerfunc *func, void *d) {
+  h->table[UPB_ENDSTR_SELECTOR].func = (upb_func*)func;
+  h->table[UPB_ENDSTR_SELECTOR].attr.handler_data = d;
+  return true;
+}
+
+/** Handlers for upb_msg ******************************************************/
+
+typedef struct {
+  size_t offset;
+  int32_t hasbit;
+} upb_msg_handlerdata;
+
+/* Fallback implementation if the handler is not specialized by the producer. */
+#define MSG_WRITER(type, ctype)                                               \
+  bool upb_msg_set ## type (void *c, const void *hd, ctype val) {             \
+    uint8_t *m = c;                                                           \
+    const upb_msg_handlerdata *d = hd;                                        \
+    if (d->hasbit > 0)                                                        \
+      *(uint8_t*)&m[d->hasbit / 8] |= 1 << (d->hasbit % 8);                   \
+    *(ctype*)&m[d->offset] = val;                                             \
+    return true;                                                              \
+  }                                                                           \
+
+MSG_WRITER(double, double)
+MSG_WRITER(float,  float)
+MSG_WRITER(int32,  int32_t)
+MSG_WRITER(int64,  int64_t)
+MSG_WRITER(uint32, uint32_t)
+MSG_WRITER(uint64, uint64_t)
+MSG_WRITER(bool,   bool)
+
+bool upb_msg_setscalarhandler(upb_handlers *h, const upb_fielddef *f,
+                              size_t offset, int32_t hasbit) {
+  upb_handlerattr attr = UPB_HANDLERATTR_INIT;
+  bool ok;
+
+  upb_msg_handlerdata *d = upb_gmalloc(sizeof(*d));
+  if (!d) return false;
+  d->offset = offset;
+  d->hasbit = hasbit;
+
+  attr.handler_data = d;
+  attr.alwaysok = true;
+  upb_handlers_addcleanup(h, d, upb_gfree);
+
+#define TYPE(u, l) \
+  case UPB_TYPE_##u: \
+    ok = upb_handlers_set##l(h, f, upb_msg_set##l, &attr); break;
+
+  ok = false;
+
+  switch (upb_fielddef_type(f)) {
+    TYPE(INT64,  int64);
+    TYPE(INT32,  int32);
+    TYPE(ENUM,   int32);
+    TYPE(UINT64, uint64);
+    TYPE(UINT32, uint32);
+    TYPE(DOUBLE, double);
+    TYPE(FLOAT,  float);
+    TYPE(BOOL,   bool);
+    default: UPB_ASSERT(false); break;
+  }
+#undef TYPE
+
+  return ok;
+}
+
+bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
+                                  upb_selector_t s,
+                                  upb_fieldtype_t *type,
+                                  size_t *offset,
+                                  int32_t *hasbit) {
+  const upb_msg_handlerdata *d;
+  const void *p;
+  upb_func *f = upb_handlers_gethandler(h, s, &p);
+
+  if ((upb_int64_handlerfunc*)f == upb_msg_setint64) {
+    *type = UPB_TYPE_INT64;
+  } else if ((upb_int32_handlerfunc*)f == upb_msg_setint32) {
+    *type = UPB_TYPE_INT32;
+  } else if ((upb_uint64_handlerfunc*)f == upb_msg_setuint64) {
+    *type = UPB_TYPE_UINT64;
+  } else if ((upb_uint32_handlerfunc*)f == upb_msg_setuint32) {
+    *type = UPB_TYPE_UINT32;
+  } else if ((upb_double_handlerfunc*)f == upb_msg_setdouble) {
+    *type = UPB_TYPE_DOUBLE;
+  } else if ((upb_float_handlerfunc*)f == upb_msg_setfloat) {
+    *type = UPB_TYPE_FLOAT;
+  } else if ((upb_bool_handlerfunc*)f == upb_msg_setbool) {
+    *type = UPB_TYPE_BOOL;
+  } else {
+    return false;
+  }
+
+  d = p;
+  *offset = d->offset;
+  *hasbit = d->hasbit;
+  return true;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/handlers.h
new file mode 100644 (file)
index 0000000..2d2380b
--- /dev/null
@@ -0,0 +1,732 @@
+/*
+** upb::Handlers (upb_handlers)
+**
+** A upb_handlers is like a virtual table for a upb_msgdef.  Each field of the
+** message can have associated functions that will be called when we are
+** parsing or visiting a stream of data.  This is similar to how handlers work
+** in SAX (the Simple API for XML).
+**
+** The handlers have no idea where the data is coming from, so a single set of
+** handlers could be used with two completely different data sources (for
+** example, a parser and a visitor over in-memory objects).  This decoupling is
+** the most important feature of upb, because it allows parsers and serializers
+** to be highly reusable.
+**
+** This is a mixed C/C++ interface that offers a full API to both languages.
+** See the top-level README for more information.
+*/
+
+#ifndef UPB_HANDLERS_H
+#define UPB_HANDLERS_H
+
+#include "upb/def.h"
+#include "upb/table.int.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+namespace upb {
+class HandlersPtr;
+class HandlerCache;
+template <class T> class Handler;
+template <class T> struct CanonicalType;
+}  /* namespace upb */
+#endif
+
+
+/* The maximum depth that the handler graph can have.  This is a resource limit
+ * for the C stack since we sometimes need to recursively traverse the graph.
+ * Cycles are ok; the traversal will stop when it detects a cycle, but we must
+ * hit the cycle before the maximum depth is reached.
+ *
+ * If having a single static limit is too inflexible, we can add another variant
+ * of Handlers::Freeze that allows specifying this as a parameter. */
+#define UPB_MAX_HANDLER_DEPTH 64
+
+/* All the different types of handlers that can be registered.
+ * Only needed for the advanced functions in upb::Handlers. */
+typedef enum {
+  UPB_HANDLER_INT32,
+  UPB_HANDLER_INT64,
+  UPB_HANDLER_UINT32,
+  UPB_HANDLER_UINT64,
+  UPB_HANDLER_FLOAT,
+  UPB_HANDLER_DOUBLE,
+  UPB_HANDLER_BOOL,
+  UPB_HANDLER_STARTSTR,
+  UPB_HANDLER_STRING,
+  UPB_HANDLER_ENDSTR,
+  UPB_HANDLER_STARTSUBMSG,
+  UPB_HANDLER_ENDSUBMSG,
+  UPB_HANDLER_STARTSEQ,
+  UPB_HANDLER_ENDSEQ
+} upb_handlertype_t;
+
+#define UPB_HANDLER_MAX (UPB_HANDLER_ENDSEQ+1)
+
+#define UPB_BREAK NULL
+
+/* A convenient definition for when no closure is needed. */
+extern char _upb_noclosure;
+#define UPB_NO_CLOSURE &_upb_noclosure
+
+/* A selector refers to a specific field handler in the Handlers object
+ * (for example: the STARTSUBMSG handler for field "field15"). */
+typedef int32_t upb_selector_t;
+
+/* Static selectors for upb::Handlers. */
+#define UPB_STARTMSG_SELECTOR 0
+#define UPB_ENDMSG_SELECTOR 1
+#define UPB_UNKNOWN_SELECTOR 2
+#define UPB_STATIC_SELECTOR_COUNT 3  /* Warning: also in upb/def.c. */
+
+/* Static selectors for upb::BytesHandler. */
+#define UPB_STARTSTR_SELECTOR 0
+#define UPB_STRING_SELECTOR 1
+#define UPB_ENDSTR_SELECTOR 2
+
+#ifdef __cplusplus
+template<class T> const void *UniquePtrForType() {
+  static const char ch = 0;
+  return &ch;
+}
+#endif
+
+/* upb_handlers ************************************************************/
+
+/* Handler attributes, to be registered with the handler itself. */
+typedef struct {
+  const void *handler_data;
+  const void *closure_type;
+  const void *return_closure_type;
+  bool alwaysok;
+} upb_handlerattr;
+
+#define UPB_HANDLERATTR_INIT {NULL, NULL, NULL, false}
+
+/* Bufhandle, data passed along with a buffer to indicate its provenance. */
+typedef struct {
+  /* The beginning of the buffer.  This may be different than the pointer
+   * passed to a StringBuf handler because the handler may receive data
+   * that is from the middle or end of a larger buffer. */
+  const char *buf;
+
+  /* The offset within the attached object where this buffer begins.  Only
+   * meaningful if there is an attached object. */
+  size_t objofs;
+
+  /* The attached object (if any) and a pointer representing its type. */
+  const void *obj;
+  const void *objtype;
+
+#ifdef __cplusplus
+  template <class T>
+  void SetAttachedObject(const T* _obj) {
+    obj = _obj;
+    objtype = UniquePtrForType<T>();
+  }
+
+  template <class T>
+  const T *GetAttachedObject() const {
+    return objtype == UniquePtrForType<T>() ? static_cast<const T *>(obj)
+                                            : NULL;
+  }
+#endif
+} upb_bufhandle;
+
+#define UPB_BUFHANDLE_INIT {NULL, 0, NULL, NULL}
+
+/* Handler function typedefs. */
+typedef void upb_handlerfree(void *d);
+typedef bool upb_unknown_handlerfunc(void *c, const void *hd, const char *buf,
+                                     size_t n);
+typedef bool upb_startmsg_handlerfunc(void *c, const void*);
+typedef bool upb_endmsg_handlerfunc(void *c, const void *, upb_status *status);
+typedef void* upb_startfield_handlerfunc(void *c, const void *hd);
+typedef bool upb_endfield_handlerfunc(void *c, const void *hd);
+typedef bool upb_int32_handlerfunc(void *c, const void *hd, int32_t val);
+typedef bool upb_int64_handlerfunc(void *c, const void *hd, int64_t val);
+typedef bool upb_uint32_handlerfunc(void *c, const void *hd, uint32_t val);
+typedef bool upb_uint64_handlerfunc(void *c, const void *hd, uint64_t val);
+typedef bool upb_float_handlerfunc(void *c, const void *hd, float val);
+typedef bool upb_double_handlerfunc(void *c, const void *hd, double val);
+typedef bool upb_bool_handlerfunc(void *c, const void *hd, bool val);
+typedef void *upb_startstr_handlerfunc(void *c, const void *hd,
+                                       size_t size_hint);
+typedef size_t upb_string_handlerfunc(void *c, const void *hd, const char *buf,
+                                      size_t n, const upb_bufhandle* handle);
+
+struct upb_handlers;
+typedef struct upb_handlers upb_handlers;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Mutating accessors. */
+const upb_status *upb_handlers_status(upb_handlers *h);
+void upb_handlers_clearerr(upb_handlers *h);
+const upb_msgdef *upb_handlers_msgdef(const upb_handlers *h);
+bool upb_handlers_addcleanup(upb_handlers *h, void *p, upb_handlerfree *hfree);
+bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func,
+                             const upb_handlerattr *attr);
+bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func,
+                              const upb_handlerattr *attr);
+bool upb_handlers_setendmsg(upb_handlers *h, upb_endmsg_handlerfunc *func,
+                            const upb_handlerattr *attr);
+bool upb_handlers_setint32(upb_handlers *h, const upb_fielddef *f,
+                           upb_int32_handlerfunc *func,
+                           const upb_handlerattr *attr);
+bool upb_handlers_setint64(upb_handlers *h, const upb_fielddef *f,
+                           upb_int64_handlerfunc *func,
+                           const upb_handlerattr *attr);
+bool upb_handlers_setuint32(upb_handlers *h, const upb_fielddef *f,
+                            upb_uint32_handlerfunc *func,
+                            const upb_handlerattr *attr);
+bool upb_handlers_setuint64(upb_handlers *h, const upb_fielddef *f,
+                            upb_uint64_handlerfunc *func,
+                            const upb_handlerattr *attr);
+bool upb_handlers_setfloat(upb_handlers *h, const upb_fielddef *f,
+                           upb_float_handlerfunc *func,
+                           const upb_handlerattr *attr);
+bool upb_handlers_setdouble(upb_handlers *h, const upb_fielddef *f,
+                            upb_double_handlerfunc *func,
+                            const upb_handlerattr *attr);
+bool upb_handlers_setbool(upb_handlers *h, const upb_fielddef *f,
+                          upb_bool_handlerfunc *func,
+                          const upb_handlerattr *attr);
+bool upb_handlers_setstartstr(upb_handlers *h, const upb_fielddef *f,
+                              upb_startstr_handlerfunc *func,
+                              const upb_handlerattr *attr);
+bool upb_handlers_setstring(upb_handlers *h, const upb_fielddef *f,
+                            upb_string_handlerfunc *func,
+                            const upb_handlerattr *attr);
+bool upb_handlers_setendstr(upb_handlers *h, const upb_fielddef *f,
+                            upb_endfield_handlerfunc *func,
+                            const upb_handlerattr *attr);
+bool upb_handlers_setstartseq(upb_handlers *h, const upb_fielddef *f,
+                              upb_startfield_handlerfunc *func,
+                              const upb_handlerattr *attr);
+bool upb_handlers_setstartsubmsg(upb_handlers *h, const upb_fielddef *f,
+                                 upb_startfield_handlerfunc *func,
+                                 const upb_handlerattr *attr);
+bool upb_handlers_setendsubmsg(upb_handlers *h, const upb_fielddef *f,
+                               upb_endfield_handlerfunc *func,
+                               const upb_handlerattr *attr);
+bool upb_handlers_setendseq(upb_handlers *h, const upb_fielddef *f,
+                            upb_endfield_handlerfunc *func,
+                            const upb_handlerattr *attr);
+
+/* Read-only accessors. */
+const upb_handlers *upb_handlers_getsubhandlers(const upb_handlers *h,
+                                                const upb_fielddef *f);
+const upb_handlers *upb_handlers_getsubhandlers_sel(const upb_handlers *h,
+                                                    upb_selector_t sel);
+upb_func *upb_handlers_gethandler(const upb_handlers *h, upb_selector_t s,
+                                  const void **handler_data);
+bool upb_handlers_getattr(const upb_handlers *h, upb_selector_t s,
+                          upb_handlerattr *attr);
+
+/* "Static" methods */
+upb_handlertype_t upb_handlers_getprimitivehandlertype(const upb_fielddef *f);
+bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type,
+                              upb_selector_t *s);
+UPB_INLINE upb_selector_t upb_handlers_getendselector(upb_selector_t start) {
+  return start + 1;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+namespace upb {
+typedef upb_handlers Handlers;
+}
+
+/* Convenience macros for creating a Handler object that is wrapped with a
+ * type-safe wrapper function that converts the "void*" parameters/returns
+ * of the underlying C API into nice C++ function.
+ *
+ * Sample usage:
+ *   void OnValue1(MyClosure* c, const MyHandlerData* d, int32_t val) {
+ *     // do stuff ...
+ *   }
+ *
+ *   // Handler that doesn't need any data bound to it.
+ *   void OnValue2(MyClosure* c, int32_t val) {
+ *     // do stuff ...
+ *   }
+ *
+ *   // Handler that returns bool so it can return failure if necessary.
+ *   bool OnValue3(MyClosure* c, int32_t val) {
+ *     // do stuff ...
+ *     return ok;
+ *   }
+ *
+ *   // Member function handler.
+ *   class MyClosure {
+ *    public:
+ *     void OnValue(int32_t val) {
+ *       // do stuff ...
+ *     }
+ *   };
+ *
+ *   // Takes ownership of the MyHandlerData.
+ *   handlers->SetInt32Handler(f1, UpbBind(OnValue1, new MyHandlerData(...)));
+ *   handlers->SetInt32Handler(f2, UpbMakeHandler(OnValue2));
+ *   handlers->SetInt32Handler(f1, UpbMakeHandler(OnValue3));
+ *   handlers->SetInt32Handler(f2, UpbMakeHandler(&MyClosure::OnValue));
+ */
+
+/* In C++11, the "template" disambiguator can appear even outside templates,
+ * so all calls can safely use this pair of macros. */
+
+#define UpbMakeHandler(f) upb::MatchFunc(f).template GetFunc<f>()
+
+/* We have to be careful to only evaluate "d" once. */
+#define UpbBind(f, d) upb::MatchFunc(f).template GetFunc<f>((d))
+
+/* Handler: a struct that contains the (handler, data, deleter) tuple that is
+ * used to register all handlers.  Users can Make() these directly but it's
+ * more convenient to use the UpbMakeHandler/UpbBind macros above. */
+template <class T> class upb::Handler {
+ public:
+  /* The underlying, handler function signature that upb uses internally. */
+  typedef T FuncPtr;
+
+  /* Intentionally implicit. */
+  template <class F> Handler(F func);
+  ~Handler() { UPB_ASSERT(registered_); }
+
+  void AddCleanup(upb_handlers* h) const;
+  FuncPtr handler() const { return handler_; }
+  const upb_handlerattr& attr() const { return attr_; }
+
+ private:
+  Handler(const Handler&) = delete;
+  Handler& operator=(const Handler&) = delete;
+
+  FuncPtr handler_;
+  mutable upb_handlerattr attr_;
+  mutable bool registered_;
+  void *cleanup_data_;
+  upb_handlerfree *cleanup_func_;
+};
+
+/* A upb::Handlers object represents the set of handlers associated with a
+ * message in the graph of messages.  You can think of it as a big virtual
+ * table with functions corresponding to all the events that can fire while
+ * parsing or visiting a message of a specific type.
+ *
+ * Any handlers that are not set behave as if they had successfully consumed
+ * the value.  Any unset Start* handlers will propagate their closure to the
+ * inner frame.
+ *
+ * The easiest way to create the *Handler objects needed by the Set* methods is
+ * with the UpbBind() and UpbMakeHandler() macros; see below. */
+class upb::HandlersPtr {
+ public:
+  HandlersPtr(upb_handlers* ptr) : ptr_(ptr) {}
+
+  upb_handlers* ptr() const { return ptr_; }
+
+  typedef upb_selector_t Selector;
+  typedef upb_handlertype_t Type;
+
+  typedef Handler<void *(*)(void *, const void *)> StartFieldHandler;
+  typedef Handler<bool (*)(void *, const void *)> EndFieldHandler;
+  typedef Handler<bool (*)(void *, const void *)> StartMessageHandler;
+  typedef Handler<bool (*)(void *, const void *, upb_status *)>
+      EndMessageHandler;
+  typedef Handler<void *(*)(void *, const void *, size_t)> StartStringHandler;
+  typedef Handler<size_t (*)(void *, const void *, const char *, size_t,
+                             const upb_bufhandle *)>
+      StringHandler;
+
+  template <class T> struct ValueHandler {
+    typedef Handler<bool(*)(void *, const void *, T)> H;
+  };
+
+  typedef ValueHandler<int32_t>::H     Int32Handler;
+  typedef ValueHandler<int64_t>::H     Int64Handler;
+  typedef ValueHandler<uint32_t>::H    UInt32Handler;
+  typedef ValueHandler<uint64_t>::H    UInt64Handler;
+  typedef ValueHandler<float>::H       FloatHandler;
+  typedef ValueHandler<double>::H      DoubleHandler;
+  typedef ValueHandler<bool>::H        BoolHandler;
+
+  /* Any function pointer can be converted to this and converted back to its
+   * correct type. */
+  typedef void GenericFunction();
+
+  typedef void HandlersCallback(const void *closure, upb_handlers *h);
+
+  /* Returns the msgdef associated with this handlers object. */
+  MessageDefPtr message_def() const {
+    return MessageDefPtr(upb_handlers_msgdef(ptr()));
+  }
+
+  /* Adds the given pointer and function to the list of cleanup functions that
+   * will be run when these handlers are freed.  If this pointer has previously
+   * been registered, the function returns false and does nothing. */
+  bool AddCleanup(void *ptr, upb_handlerfree *cleanup) {
+    return upb_handlers_addcleanup(ptr_, ptr, cleanup);
+  }
+
+  /* Sets the startmsg handler for the message, which is defined as follows:
+   *
+   *   bool startmsg(MyType* closure) {
+   *     // Called when the message begins.  Returns true if processing should
+   *     // continue.
+   *     return true;
+   *   }
+   */
+  bool SetStartMessageHandler(const StartMessageHandler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setstartmsg(ptr(), h.handler(), &h.attr());
+  }
+
+  /* Sets the endmsg handler for the message, which is defined as follows:
+   *
+   *   bool endmsg(MyType* closure, upb_status *status) {
+   *     // Called when processing of this message ends, whether in success or
+   *     // failure.  "status" indicates the final status of processing, and
+   *     // can also be modified in-place to update the final status.
+   *   }
+   */
+  bool SetEndMessageHandler(const EndMessageHandler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setendmsg(ptr(), h.handler(), &h.attr());
+  }
+
+  /* Sets the value handler for the given field, which is defined as follows
+   * (this is for an int32 field; other field types will pass their native
+   * C/C++ type for "val"):
+   *
+   *   bool OnValue(MyClosure* c, const MyHandlerData* d, int32_t val) {
+   *     // Called when the field's value is encountered.  "d" contains
+   *     // whatever data was bound to this field when it was registered.
+   *     // Returns true if processing should continue.
+   *     return true;
+   *   }
+   *
+   *   handers->SetInt32Handler(f, UpbBind(OnValue, new MyHandlerData(...)));
+   *
+   * The value type must exactly match f->type().
+   * For example, a handler that takes an int32_t parameter may only be used for
+   * fields of type UPB_TYPE_INT32 and UPB_TYPE_ENUM.
+   *
+   * Returns false if the handler failed to register; in this case the cleanup
+   * handler (if any) will be called immediately.
+   */
+  bool SetInt32Handler(FieldDefPtr f, const Int32Handler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setint32(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetInt64Handler (FieldDefPtr f,  const Int64Handler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setint64(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetUInt32Handler(FieldDefPtr f, const UInt32Handler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setuint32(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetUInt64Handler(FieldDefPtr f, const UInt64Handler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setuint64(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetFloatHandler (FieldDefPtr f,  const FloatHandler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setfloat(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetDoubleHandler(FieldDefPtr f, const DoubleHandler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setdouble(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetBoolHandler(FieldDefPtr f, const BoolHandler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setbool(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  /* Like the previous, but templated on the type on the value (ie. int32).
+   * This is mostly useful to call from other templates.  To call this you must
+   * specify the template parameter explicitly, ie:
+   *   h->SetValueHandler<T>(f, UpbBind(MyHandler<T>, MyData)); */
+  template <class T>
+  bool SetValueHandler(
+      FieldDefPtr f,
+      const typename ValueHandler<typename CanonicalType<T>::Type>::H &handler);
+
+  /* Sets handlers for a string field, which are defined as follows:
+   *
+   *   MySubClosure* startstr(MyClosure* c, const MyHandlerData* d,
+   *                          size_t size_hint) {
+   *     // Called when a string value begins.  The return value indicates the
+   *     // closure for the string.  "size_hint" indicates the size of the
+   *     // string if it is known, however if the string is length-delimited
+   *     // and the end-of-string is not available size_hint will be zero.
+   *     // This case is indistinguishable from the case where the size is
+   *     // known to be zero.
+   *     //
+   *     // TODO(haberman): is it important to distinguish these cases?
+   *     // If we had ssize_t as a type we could make -1 "unknown", but
+   *     // ssize_t is POSIX (not ANSI) and therefore less portable.
+   *     // In practice I suspect it won't be important to distinguish.
+   *     return closure;
+   *   }
+   *
+   *   size_t str(MyClosure* closure, const MyHandlerData* d,
+   *              const char *str, size_t len) {
+   *     // Called for each buffer of string data; the multiple physical buffers
+   *     // are all part of the same logical string.  The return value indicates
+   *     // how many bytes were consumed.  If this number is less than "len",
+   *     // this will also indicate that processing should be halted for now,
+   *     // like returning false or UPB_BREAK from any other callback.  If
+   *     // number is greater than "len", the excess bytes will be skipped over
+   *     // and not passed to the callback.
+   *     return len;
+   *   }
+   *
+   *   bool endstr(MyClosure* c, const MyHandlerData* d) {
+   *     // Called when a string value ends.  Return value indicates whether
+   *     // processing should continue.
+   *     return true;
+   *   }
+   */
+  bool SetStartStringHandler(FieldDefPtr f, const StartStringHandler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setstartstr(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetStringHandler(FieldDefPtr f, const StringHandler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setstring(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  bool SetEndStringHandler(FieldDefPtr f, const EndFieldHandler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setendstr(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  /* Sets the startseq handler, which is defined as follows:
+   *
+   *   MySubClosure *startseq(MyClosure* c, const MyHandlerData* d) {
+   *     // Called when a sequence (repeated field) begins.  The returned
+   *     // pointer indicates the closure for the sequence (or UPB_BREAK
+   *     // to interrupt processing).
+   *     return closure;
+   *   }
+   *
+   *   h->SetStartSequenceHandler(f, UpbBind(startseq, new MyHandlerData(...)));
+   *
+   * Returns "false" if "f" does not belong to this message or is not a
+   * repeated field.
+   */
+  bool SetStartSequenceHandler(FieldDefPtr f, const StartFieldHandler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setstartseq(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  /* Sets the startsubmsg handler for the given field, which is defined as
+   * follows:
+   *
+   *   MySubClosure* startsubmsg(MyClosure* c, const MyHandlerData* d) {
+   *     // Called when a submessage begins.  The returned pointer indicates the
+   *     // closure for the sequence (or UPB_BREAK to interrupt processing).
+   *     return closure;
+   *   }
+   *
+   *   h->SetStartSubMessageHandler(f, UpbBind(startsubmsg,
+   *                                           new MyHandlerData(...)));
+   *
+   * Returns "false" if "f" does not belong to this message or is not a
+   * submessage/group field.
+   */
+  bool SetStartSubMessageHandler(FieldDefPtr f, const StartFieldHandler& h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setstartsubmsg(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  /* Sets the endsubmsg handler for the given field, which is defined as
+   * follows:
+   *
+   *   bool endsubmsg(MyClosure* c, const MyHandlerData* d) {
+   *     // Called when a submessage ends.  Returns true to continue processing.
+   *     return true;
+   *   }
+   *
+   * Returns "false" if "f" does not belong to this message or is not a
+   * submessage/group field.
+   */
+  bool SetEndSubMessageHandler(FieldDefPtr f, const EndFieldHandler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setendsubmsg(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+  /* Starts the endsubseq handler for the given field, which is defined as
+   * follows:
+   *
+   *   bool endseq(MyClosure* c, const MyHandlerData* d) {
+   *     // Called when a sequence ends.  Returns true continue processing.
+   *     return true;
+   *   }
+   *
+   * Returns "false" if "f" does not belong to this message or is not a
+   * repeated field.
+   */
+  bool SetEndSequenceHandler(FieldDefPtr f, const EndFieldHandler &h) {
+    h.AddCleanup(ptr());
+    return upb_handlers_setendseq(ptr(), f.ptr(), h.handler(), &h.attr());
+  }
+
+ private:
+  upb_handlers* ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_handlercache ***********************************************************/
+
+/* A upb_handlercache lazily builds and caches upb_handlers.  You pass it a
+ * function (with optional closure) that can build handlers for a given
+ * message on-demand, and the cache maintains a map of msgdef->handlers. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct upb_handlercache;
+typedef struct upb_handlercache upb_handlercache;
+
+typedef void upb_handlers_callback(const void *closure, upb_handlers *h);
+
+upb_handlercache *upb_handlercache_new(upb_handlers_callback *callback,
+                                       const void *closure);
+void upb_handlercache_free(upb_handlercache *cache);
+const upb_handlers *upb_handlercache_get(upb_handlercache *cache,
+                                         const upb_msgdef *md);
+bool upb_handlercache_addcleanup(upb_handlercache *h, void *p,
+                                 upb_handlerfree *hfree);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+class upb::HandlerCache {
+ public:
+  HandlerCache(upb_handlers_callback *callback, const void *closure)
+      : ptr_(upb_handlercache_new(callback, closure), upb_handlercache_free) {}
+  HandlerCache(HandlerCache&&) = default;
+  HandlerCache& operator=(HandlerCache&&) = default;
+  HandlerCache(upb_handlercache* c) : ptr_(c, upb_handlercache_free) {}
+
+  upb_handlercache* ptr() { return ptr_.get(); }
+
+  const upb_handlers *Get(MessageDefPtr md) {
+    return upb_handlercache_get(ptr_.get(), md.ptr());
+  }
+
+ private:
+  std::unique_ptr<upb_handlercache, decltype(&upb_handlercache_free)> ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_byteshandler ***********************************************************/
+
+typedef struct {
+  upb_func *func;
+
+  /* It is wasteful to include the entire attributes here:
+   *
+   * * Some of the information is redundant (like storing the closure type
+   *   separately for each handler that must match).
+   * * Some of the info is only needed prior to freeze() (like closure types).
+   * * alignment padding wastes a lot of space for alwaysok_.
+   *
+   * If/when the size and locality of handlers is an issue, we can optimize this
+   * not to store the entire attr like this.  We do not expose the table's
+   * layout to allow this optimization in the future. */
+  upb_handlerattr attr;
+} upb_handlers_tabent;
+
+#define UPB_TABENT_INIT {NULL, UPB_HANDLERATTR_INIT}
+
+typedef struct {
+  upb_handlers_tabent table[3];
+} upb_byteshandler;
+
+#define UPB_BYTESHANDLER_INIT                             \
+  {                                                       \
+    { UPB_TABENT_INIT, UPB_TABENT_INIT, UPB_TABENT_INIT } \
+  }
+
+UPB_INLINE void upb_byteshandler_init(upb_byteshandler *handler) {
+  upb_byteshandler init = UPB_BYTESHANDLER_INIT;
+  *handler = init;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Caller must ensure that "d" outlives the handlers. */
+bool upb_byteshandler_setstartstr(upb_byteshandler *h,
+                                  upb_startstr_handlerfunc *func, void *d);
+bool upb_byteshandler_setstring(upb_byteshandler *h,
+                                upb_string_handlerfunc *func, void *d);
+bool upb_byteshandler_setendstr(upb_byteshandler *h,
+                                upb_endfield_handlerfunc *func, void *d);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+namespace upb {
+typedef upb_byteshandler BytesHandler;
+}
+#endif
+
+/** Message handlers ******************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These are the handlers used internally by upb_msgfactory_getmergehandlers().
+ * They write scalar data to a known offset from the message pointer.
+ *
+ * These would be trivial for anyone to implement themselves, but it's better
+ * to use these because some JITs will recognize and specialize these instead
+ * of actually calling the function. */
+
+/* Sets a handler for the given primitive field that will write the data at the
+ * given offset.  If hasbit > 0, also sets a hasbit at the given bit offset
+ * (addressing each byte low to high). */
+bool upb_msg_setscalarhandler(upb_handlers *h,
+                              const upb_fielddef *f,
+                              size_t offset,
+                              int32_t hasbit);
+
+/* If the given handler is a msghandlers_primitive field, returns true and sets
+ * *type, *offset and *hasbit.  Otherwise returns false. */
+bool upb_msg_getscalarhandlerdata(const upb_handlers *h,
+                                  upb_selector_t s,
+                                  upb_fieldtype_t *type,
+                                  size_t *offset,
+                                  int32_t *hasbit);
+
+
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#include "upb/handlers-inl.h"
+
+#endif  /* UPB_HANDLERS_H */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/parser.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/parser.h
new file mode 100644 (file)
index 0000000..d323c52
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+** upb::json::Parser (upb_json_parser)
+**
+** Parses JSON according to a specific schema.
+** Support for parsing arbitrary JSON (schema-less) will be added later.
+*/
+
+#ifndef UPB_JSON_PARSER_H_
+#define UPB_JSON_PARSER_H_
+
+#include "upb/sink.h"
+
+#ifdef __cplusplus
+namespace upb {
+namespace json {
+class CodeCache;
+class ParserPtr;
+class ParserMethodPtr;
+}  /* namespace json */
+}  /* namespace upb */
+#endif
+
+/* upb_json_parsermethod ******************************************************/
+
+struct upb_json_parsermethod;
+typedef struct upb_json_parsermethod upb_json_parsermethod;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const upb_byteshandler* upb_json_parsermethod_inputhandler(
+    const upb_json_parsermethod* m);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+class upb::json::ParserMethodPtr {
+ public:
+  ParserMethodPtr() : ptr_(nullptr) {}
+  ParserMethodPtr(const upb_json_parsermethod* ptr) : ptr_(ptr) {}
+
+  const upb_json_parsermethod* ptr() const { return ptr_; }
+
+  const BytesHandler* input_handler() const {
+    return upb_json_parsermethod_inputhandler(ptr());
+  }
+
+ private:
+  const upb_json_parsermethod* ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_json_parser ************************************************************/
+
+/* Preallocation hint: parser won't allocate more bytes than this when first
+ * constructed.  This hint may be an overestimate for some build configurations.
+ * But if the parser library is upgraded without recompiling the application,
+ * it may be an underestimate. */
+#define UPB_JSON_PARSER_SIZE 5712
+
+struct upb_json_parser;
+typedef struct upb_json_parser upb_json_parser;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+upb_json_parser* upb_json_parser_create(upb_arena* a,
+                                        const upb_json_parsermethod* m,
+                                        const upb_symtab* symtab,
+                                        upb_sink output,
+                                        upb_status *status,
+                                        bool ignore_json_unknown);
+upb_bytessink upb_json_parser_input(upb_json_parser* p);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Parses an incoming BytesStream, pushing the results to the destination
+ * sink. */
+class upb::json::ParserPtr {
+ public:
+  ParserPtr(upb_json_parser* ptr) : ptr_(ptr) {}
+
+  static ParserPtr Create(Arena* arena, ParserMethodPtr method,
+                          SymbolTable* symtab, Sink output, Status* status,
+                          bool ignore_json_unknown) {
+    upb_symtab* symtab_ptr = symtab ? symtab->ptr() : nullptr;
+    return ParserPtr(upb_json_parser_create(
+        arena->ptr(), method.ptr(), symtab_ptr, output.sink(), status->ptr(),
+        ignore_json_unknown));
+  }
+
+  BytesSink input() { return upb_json_parser_input(ptr_); }
+
+ private:
+  upb_json_parser* ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_json_codecache *********************************************************/
+
+/* Lazily builds and caches decoder methods that will push data to the given
+ * handlers.  The upb_symtab object(s) must outlive this object. */
+
+struct upb_json_codecache;
+typedef struct upb_json_codecache upb_json_codecache;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+upb_json_codecache *upb_json_codecache_new(void);
+void upb_json_codecache_free(upb_json_codecache *cache);
+const upb_json_parsermethod* upb_json_codecache_get(upb_json_codecache* cache,
+                                                    const upb_msgdef* md);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+class upb::json::CodeCache {
+ public:
+  CodeCache() : ptr_(upb_json_codecache_new(), upb_json_codecache_free) {}
+
+  /* Returns a DecoderMethod that can push data to the given handlers.
+   * If a suitable method already exists, it will be returned from the cache. */
+  ParserMethodPtr Get(MessageDefPtr md) {
+    return upb_json_codecache_get(ptr_.get(), md.ptr());
+  }
+
+ private:
+  std::unique_ptr<upb_json_codecache, decltype(&upb_json_codecache_free)> ptr_;
+};
+
+#endif
+
+#endif  /* UPB_JSON_PARSER_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/printer.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/printer.c
new file mode 100644 (file)
index 0000000..38f817d
--- /dev/null
@@ -0,0 +1,1406 @@
+/*
+** This currently uses snprintf() to format primitives, and could be optimized
+** further.
+*/
+
+#include "upb/json/printer.h"
+
+#include <ctype.h>
+#include <stdint.h>
+#include <string.h>
+#include <time.h>
+
+#include "upb/port_def.inc"
+
+struct upb_json_printer {
+  upb_sink input_;
+  /* BytesSink closure. */
+  void *subc_;
+  upb_bytessink output_;
+
+  /* We track the depth so that we know when to emit startstr/endstr on the
+   * output. */
+  int depth_;
+
+  /* Have we emitted the first element? This state is necessary to emit commas
+   * without leaving a trailing comma in arrays/maps. We keep this state per
+   * frame depth.
+   *
+   * Why max_depth * 2? UPB_MAX_HANDLER_DEPTH counts depth as nested messages.
+   * We count frames (contexts in which we separate elements by commas) as both
+   * repeated fields and messages (maps), and the worst case is a
+   * message->repeated field->submessage->repeated field->... nesting. */
+  bool first_elem_[UPB_MAX_HANDLER_DEPTH * 2];
+
+  /* To print timestamp, printer needs to cache its seconds and nanos values
+   * and convert them when ending timestamp message. See comments of
+   * printer_sethandlers_timestamp for more detail. */
+  int64_t seconds;
+  int32_t nanos;
+};
+
+/* StringPiece; a pointer plus a length. */
+typedef struct {
+  char *ptr;
+  size_t len;
+} strpc;
+
+void freestrpc(void *ptr) {
+  strpc *pc = ptr;
+  upb_gfree(pc->ptr);
+  upb_gfree(pc);
+}
+
+typedef struct {
+  bool preserve_fieldnames;
+} upb_json_printercache;
+
+/* Convert fielddef name to JSON name and return as a string piece. */
+strpc *newstrpc(upb_handlers *h, const upb_fielddef *f,
+                bool preserve_fieldnames) {
+  /* TODO(haberman): handle malloc failure. */
+  strpc *ret = upb_gmalloc(sizeof(*ret));
+  if (preserve_fieldnames) {
+    ret->ptr = upb_gstrdup(upb_fielddef_name(f));
+    ret->len = strlen(ret->ptr);
+  } else {
+    size_t len;
+    ret->len = upb_fielddef_getjsonname(f, NULL, 0);
+    ret->ptr = upb_gmalloc(ret->len);
+    len = upb_fielddef_getjsonname(f, ret->ptr, ret->len);
+    UPB_ASSERT(len == ret->len);
+    ret->len--;  /* NULL */
+  }
+
+  upb_handlers_addcleanup(h, ret, freestrpc);
+  return ret;
+}
+
+/* Convert a null-terminated const char* to a string piece. */
+strpc *newstrpc_str(upb_handlers *h, const char * str) {
+  strpc * ret = upb_gmalloc(sizeof(*ret));
+  ret->ptr = upb_gstrdup(str);
+  ret->len = strlen(str);
+  upb_handlers_addcleanup(h, ret, freestrpc);
+  return ret;
+}
+
+/* ------------ JSON string printing: values, maps, arrays ------------------ */
+
+static void print_data(
+    upb_json_printer *p, const char *buf, unsigned int len) {
+  /* TODO: Will need to change if we support pushback from the sink. */
+  size_t n = upb_bytessink_putbuf(p->output_, p->subc_, buf, len, NULL);
+  UPB_ASSERT(n == len);
+}
+
+static void print_comma(upb_json_printer *p) {
+  if (!p->first_elem_[p->depth_]) {
+    print_data(p, ",", 1);
+  }
+  p->first_elem_[p->depth_] = false;
+}
+
+/* Helpers that print properly formatted elements to the JSON output stream. */
+
+/* Used for escaping control chars in strings. */
+static const char kControlCharLimit = 0x20;
+
+UPB_INLINE bool is_json_escaped(char c) {
+  /* See RFC 4627. */
+  unsigned char uc = (unsigned char)c;
+  return uc < kControlCharLimit || uc == '"' || uc == '\\';
+}
+
+UPB_INLINE const char* json_nice_escape(char c) {
+  switch (c) {
+    case '"':  return "\\\"";
+    case '\\': return "\\\\";
+    case '\b': return "\\b";
+    case '\f': return "\\f";
+    case '\n': return "\\n";
+    case '\r': return "\\r";
+    case '\t': return "\\t";
+    default:   return NULL;
+  }
+}
+
+/* Write a properly escaped string chunk. The surrounding quotes are *not*
+ * printed; this is so that the caller has the option of emitting the string
+ * content in chunks. */
+static void putstring(upb_json_printer *p, const char *buf, unsigned int len) {
+  const char* unescaped_run = NULL;
+  unsigned int i;
+  for (i = 0; i < len; i++) {
+    char c = buf[i];
+    /* Handle escaping. */
+    if (is_json_escaped(c)) {
+      /* Use a "nice" escape, like \n, if one exists for this character. */
+      const char* escape = json_nice_escape(c);
+      /* If we don't have a specific 'nice' escape code, use a \uXXXX-style
+       * escape. */
+      char escape_buf[8];
+      if (!escape) {
+        unsigned char byte = (unsigned char)c;
+        _upb_snprintf(escape_buf, sizeof(escape_buf), "\\u%04x", (int)byte);
+        escape = escape_buf;
+      }
+
+      /* N.B. that we assume that the input encoding is equal to the output
+       * encoding (both UTF-8 for  now), so for chars >= 0x20 and != \, ", we
+       * can simply pass the bytes through. */
+
+      /* If there's a current run of unescaped chars, print that run first. */
+      if (unescaped_run) {
+        print_data(p, unescaped_run, &buf[i] - unescaped_run);
+        unescaped_run = NULL;
+      }
+      /* Then print the escape code. */
+      print_data(p, escape, strlen(escape));
+    } else {
+      /* Add to the current unescaped run of characters. */
+      if (unescaped_run == NULL) {
+        unescaped_run = &buf[i];
+      }
+    }
+  }
+
+  /* If the string ended in a run of unescaped characters, print that last run. */
+  if (unescaped_run) {
+    print_data(p, unescaped_run, &buf[len] - unescaped_run);
+  }
+}
+
+#define CHKLENGTH(x) if (!(x)) return -1;
+
+/* Helpers that format floating point values according to our custom formats.
+ * Right now we use %.8g and %.17g for float/double, respectively, to match
+ * proto2::util::JsonFormat's defaults.  May want to change this later. */
+
+const char neginf[] = "\"-Infinity\"";
+const char inf[] = "\"Infinity\"";
+
+static size_t fmt_double(double val, char* buf, size_t length) {
+  if (val == UPB_INFINITY) {
+    CHKLENGTH(length >= strlen(inf));
+    strcpy(buf, inf);
+    return strlen(inf);
+  } else if (val == -UPB_INFINITY) {
+    CHKLENGTH(length >= strlen(neginf));
+    strcpy(buf, neginf);
+    return strlen(neginf);
+  } else {
+    size_t n = _upb_snprintf(buf, length, "%.17g", val);
+    CHKLENGTH(n > 0 && n < length);
+    return n;
+  }
+}
+
+static size_t fmt_float(float val, char* buf, size_t length) {
+  size_t n = _upb_snprintf(buf, length, "%.8g", val);
+  CHKLENGTH(n > 0 && n < length);
+  return n;
+}
+
+static size_t fmt_bool(bool val, char* buf, size_t length) {
+  size_t n = _upb_snprintf(buf, length, "%s", (val ? "true" : "false"));
+  CHKLENGTH(n > 0 && n < length);
+  return n;
+}
+
+static size_t fmt_int64_as_number(long long val, char* buf, size_t length) {
+  size_t n = _upb_snprintf(buf, length, "%lld", val);
+  CHKLENGTH(n > 0 && n < length);
+  return n;
+}
+
+static size_t fmt_uint64_as_number(
+    unsigned long long val, char* buf, size_t length) {
+  size_t n = _upb_snprintf(buf, length, "%llu", val);
+  CHKLENGTH(n > 0 && n < length);
+  return n;
+}
+
+static size_t fmt_int64_as_string(long long val, char* buf, size_t length) {
+  size_t n = _upb_snprintf(buf, length, "\"%lld\"", val);
+  CHKLENGTH(n > 0 && n < length);
+  return n;
+}
+
+static size_t fmt_uint64_as_string(
+    unsigned long long val, char* buf, size_t length) {
+  size_t n = _upb_snprintf(buf, length, "\"%llu\"", val);
+  CHKLENGTH(n > 0 && n < length);
+  return n;
+}
+
+/* Print a map key given a field name. Called by scalar field handlers and by
+ * startseq for repeated fields. */
+static bool putkey(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  const strpc *key = handler_data;
+  print_comma(p);
+  print_data(p, "\"", 1);
+  putstring(p, key->ptr, key->len);
+  print_data(p, "\":", 2);
+  return true;
+}
+
+#define CHKFMT(val) if ((val) == (size_t)-1) return false;
+#define CHK(val)    if (!(val)) return false;
+
+#define TYPE_HANDLERS(type, fmt_func)                                        \
+  static bool put##type(void *closure, const void *handler_data, type val) { \
+    upb_json_printer *p = closure;                                           \
+    char data[64];                                                           \
+    size_t length = fmt_func(val, data, sizeof(data));                       \
+    UPB_UNUSED(handler_data);                                                \
+    CHKFMT(length);                                                          \
+    print_data(p, data, length);                                             \
+    return true;                                                             \
+  }                                                                          \
+  static bool scalar_##type(void *closure, const void *handler_data,         \
+                            type val) {                                      \
+    CHK(putkey(closure, handler_data));                                      \
+    CHK(put##type(closure, handler_data, val));                              \
+    return true;                                                             \
+  }                                                                          \
+  static bool repeated_##type(void *closure, const void *handler_data,       \
+                              type val) {                                    \
+    upb_json_printer *p = closure;                                           \
+    print_comma(p);                                                          \
+    CHK(put##type(closure, handler_data, val));                              \
+    return true;                                                             \
+  }
+
+#define TYPE_HANDLERS_MAPKEY(type, fmt_func)                                 \
+  static bool putmapkey_##type(void *closure, const void *handler_data,      \
+                            type val) {                                      \
+    upb_json_printer *p = closure;                                           \
+    char data[64];                                                           \
+    size_t length = fmt_func(val, data, sizeof(data));                       \
+    UPB_UNUSED(handler_data);                                                \
+    print_data(p, "\"", 1);                                                  \
+    print_data(p, data, length);                                             \
+    print_data(p, "\":", 2);                                                 \
+    return true;                                                             \
+  }
+
+TYPE_HANDLERS(double,   fmt_double)
+TYPE_HANDLERS(float,    fmt_float)
+TYPE_HANDLERS(bool,     fmt_bool)
+TYPE_HANDLERS(int32_t,  fmt_int64_as_number)
+TYPE_HANDLERS(uint32_t, fmt_int64_as_number)
+TYPE_HANDLERS(int64_t,  fmt_int64_as_string)
+TYPE_HANDLERS(uint64_t, fmt_uint64_as_string)
+
+/* double and float are not allowed to be map keys. */
+TYPE_HANDLERS_MAPKEY(bool,     fmt_bool)
+TYPE_HANDLERS_MAPKEY(int32_t,  fmt_int64_as_number)
+TYPE_HANDLERS_MAPKEY(uint32_t, fmt_int64_as_number)
+TYPE_HANDLERS_MAPKEY(int64_t,  fmt_int64_as_number)
+TYPE_HANDLERS_MAPKEY(uint64_t, fmt_uint64_as_number)
+
+#undef TYPE_HANDLERS
+#undef TYPE_HANDLERS_MAPKEY
+
+typedef struct {
+  void *keyname;
+  const upb_enumdef *enumdef;
+} EnumHandlerData;
+
+static bool scalar_enum(void *closure, const void *handler_data,
+                        int32_t val) {
+  const EnumHandlerData *hd = handler_data;
+  upb_json_printer *p = closure;
+  const char *symbolic_name;
+
+  CHK(putkey(closure, hd->keyname));
+
+  symbolic_name = upb_enumdef_iton(hd->enumdef, val);
+  if (symbolic_name) {
+    print_data(p, "\"", 1);
+    putstring(p, symbolic_name, strlen(symbolic_name));
+    print_data(p, "\"", 1);
+  } else {
+    putint32_t(closure, NULL, val);
+  }
+
+  return true;
+}
+
+static void print_enum_symbolic_name(upb_json_printer *p,
+                                     const upb_enumdef *def,
+                                     int32_t val) {
+  const char *symbolic_name = upb_enumdef_iton(def, val);
+  if (symbolic_name) {
+    print_data(p, "\"", 1);
+    putstring(p, symbolic_name, strlen(symbolic_name));
+    print_data(p, "\"", 1);
+  } else {
+    putint32_t(p, NULL, val);
+  }
+}
+
+static bool repeated_enum(void *closure, const void *handler_data,
+                          int32_t val) {
+  const EnumHandlerData *hd = handler_data;
+  upb_json_printer *p = closure;
+  print_comma(p);
+
+  print_enum_symbolic_name(p, hd->enumdef, val);
+
+  return true;
+}
+
+static bool mapvalue_enum(void *closure, const void *handler_data,
+                          int32_t val) {
+  const EnumHandlerData *hd = handler_data;
+  upb_json_printer *p = closure;
+
+  print_enum_symbolic_name(p, hd->enumdef, val);
+
+  return true;
+}
+
+static void *scalar_startsubmsg(void *closure, const void *handler_data) {
+  return putkey(closure, handler_data) ? closure : UPB_BREAK;
+}
+
+static void *repeated_startsubmsg(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_comma(p);
+  return closure;
+}
+
+static void start_frame(upb_json_printer *p) {
+  p->depth_++;
+  p->first_elem_[p->depth_] = true;
+  print_data(p, "{", 1);
+}
+
+static void end_frame(upb_json_printer *p) {
+  print_data(p, "}", 1);
+  p->depth_--;
+}
+
+static bool printer_startmsg(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  if (p->depth_ == 0) {
+    upb_bytessink_start(p->output_, 0, &p->subc_);
+  }
+  start_frame(p);
+  return true;
+}
+
+static bool printer_endmsg(void *closure, const void *handler_data, upb_status *s) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(s);
+  end_frame(p);
+  if (p->depth_ == 0) {
+    upb_bytessink_end(p->output_);
+  }
+  return true;
+}
+
+static void *startseq(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  CHK(putkey(closure, handler_data));
+  p->depth_++;
+  p->first_elem_[p->depth_] = true;
+  print_data(p, "[", 1);
+  return closure;
+}
+
+static bool endseq(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_data(p, "]", 1);
+  p->depth_--;
+  return true;
+}
+
+static void *startmap(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  CHK(putkey(closure, handler_data));
+  p->depth_++;
+  p->first_elem_[p->depth_] = true;
+  print_data(p, "{", 1);
+  return closure;
+}
+
+static bool endmap(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_data(p, "}", 1);
+  p->depth_--;
+  return true;
+}
+
+static size_t putstr(void *closure, const void *handler_data, const char *str,
+                     size_t len, const upb_bufhandle *handle) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(handle);
+  putstring(p, str, len);
+  return len;
+}
+
+/* This has to Base64 encode the bytes, because JSON has no "bytes" type. */
+static size_t putbytes(void *closure, const void *handler_data, const char *str,
+                       size_t len, const upb_bufhandle *handle) {
+  upb_json_printer *p = closure;
+
+  /* This is the regular base64, not the "web-safe" version. */
+  static const char base64[] =
+      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+  /* Base64-encode. */
+  char data[16000];
+  const char *limit = data + sizeof(data);
+  const unsigned char *from = (const unsigned char*)str;
+  char *to = data;
+  size_t remaining = len;
+  size_t bytes;
+
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(handle);
+
+  print_data(p, "\"", 1);
+
+  while (remaining > 2) {
+    if (limit - to < 4) {
+      bytes = to - data;
+      putstring(p, data, bytes);
+      to = data;
+    }
+
+    to[0] = base64[from[0] >> 2];
+    to[1] = base64[((from[0] & 0x3) << 4) | (from[1] >> 4)];
+    to[2] = base64[((from[1] & 0xf) << 2) | (from[2] >> 6)];
+    to[3] = base64[from[2] & 0x3f];
+
+    remaining -= 3;
+    to += 4;
+    from += 3;
+  }
+
+  switch (remaining) {
+    case 2:
+      to[0] = base64[from[0] >> 2];
+      to[1] = base64[((from[0] & 0x3) << 4) | (from[1] >> 4)];
+      to[2] = base64[(from[1] & 0xf) << 2];
+      to[3] = '=';
+      to += 4;
+      from += 2;
+      break;
+    case 1:
+      to[0] = base64[from[0] >> 2];
+      to[1] = base64[((from[0] & 0x3) << 4)];
+      to[2] = '=';
+      to[3] = '=';
+      to += 4;
+      from += 1;
+      break;
+  }
+
+  bytes = to - data;
+  putstring(p, data, bytes);
+  print_data(p, "\"", 1);
+  return len;
+}
+
+static void *scalar_startstr(void *closure, const void *handler_data,
+                             size_t size_hint) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(size_hint);
+  CHK(putkey(closure, handler_data));
+  print_data(p, "\"", 1);
+  return p;
+}
+
+static size_t scalar_str(void *closure, const void *handler_data,
+                         const char *str, size_t len,
+                         const upb_bufhandle *handle) {
+  CHK(putstr(closure, handler_data, str, len, handle));
+  return len;
+}
+
+static bool scalar_endstr(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_data(p, "\"", 1);
+  return true;
+}
+
+static void *repeated_startstr(void *closure, const void *handler_data,
+                               size_t size_hint) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(size_hint);
+  print_comma(p);
+  print_data(p, "\"", 1);
+  return p;
+}
+
+static size_t repeated_str(void *closure, const void *handler_data,
+                           const char *str, size_t len,
+                           const upb_bufhandle *handle) {
+  CHK(putstr(closure, handler_data, str, len, handle));
+  return len;
+}
+
+static bool repeated_endstr(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_data(p, "\"", 1);
+  return true;
+}
+
+static void *mapkeyval_startstr(void *closure, const void *handler_data,
+                                size_t size_hint) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(size_hint);
+  print_data(p, "\"", 1);
+  return p;
+}
+
+static size_t mapkey_str(void *closure, const void *handler_data,
+                         const char *str, size_t len,
+                         const upb_bufhandle *handle) {
+  CHK(putstr(closure, handler_data, str, len, handle));
+  return len;
+}
+
+static bool mapkey_endstr(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_data(p, "\":", 2);
+  return true;
+}
+
+static bool mapvalue_endstr(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  print_data(p, "\"", 1);
+  return true;
+}
+
+static size_t scalar_bytes(void *closure, const void *handler_data,
+                           const char *str, size_t len,
+                           const upb_bufhandle *handle) {
+  CHK(putkey(closure, handler_data));
+  CHK(putbytes(closure, handler_data, str, len, handle));
+  return len;
+}
+
+static size_t repeated_bytes(void *closure, const void *handler_data,
+                             const char *str, size_t len,
+                             const upb_bufhandle *handle) {
+  upb_json_printer *p = closure;
+  print_comma(p);
+  CHK(putbytes(closure, handler_data, str, len, handle));
+  return len;
+}
+
+static size_t mapkey_bytes(void *closure, const void *handler_data,
+                           const char *str, size_t len,
+                           const upb_bufhandle *handle) {
+  upb_json_printer *p = closure;
+  CHK(putbytes(closure, handler_data, str, len, handle));
+  print_data(p, ":", 1);
+  return len;
+}
+
+static void set_enum_hd(upb_handlers *h,
+                        const upb_fielddef *f,
+                        bool preserve_fieldnames,
+                        upb_handlerattr *attr) {
+  EnumHandlerData *hd = upb_gmalloc(sizeof(EnumHandlerData));
+  hd->enumdef = upb_fielddef_enumsubdef(f);
+  hd->keyname = newstrpc(h, f, preserve_fieldnames);
+  upb_handlers_addcleanup(h, hd, upb_gfree);
+  attr->handler_data = hd;
+}
+
+/* Set up handlers for a mapentry submessage (i.e., an individual key/value pair
+ * in a map).
+ *
+ * TODO: Handle missing key, missing value, out-of-order key/value, or repeated
+ * key or value cases properly. The right way to do this is to allocate a
+ * temporary structure at the start of a mapentry submessage, store key and
+ * value data in it as key and value handlers are called, and then print the
+ * key/value pair once at the end of the submessage. If we don't do this, we
+ * should at least detect the case and throw an error. However, so far all of
+ * our sources that emit mapentry messages do so canonically (with one key
+ * field, and then one value field), so this is not a pressing concern at the
+ * moment. */
+void printer_sethandlers_mapentry(const void *closure, bool preserve_fieldnames,
+                                  upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+
+  /* A mapentry message is printed simply as '"key": value'. Rather than
+   * special-case key and value for every type below, we just handle both
+   * fields explicitly here. */
+  const upb_fielddef* key_field = upb_msgdef_itof(md, UPB_MAPENTRY_KEY);
+  const upb_fielddef* value_field = upb_msgdef_itof(md, UPB_MAPENTRY_VALUE);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  UPB_UNUSED(closure);
+
+  switch (upb_fielddef_type(key_field)) {
+    case UPB_TYPE_INT32:
+      upb_handlers_setint32(h, key_field, putmapkey_int32_t, &empty_attr);
+      break;
+    case UPB_TYPE_INT64:
+      upb_handlers_setint64(h, key_field, putmapkey_int64_t, &empty_attr);
+      break;
+    case UPB_TYPE_UINT32:
+      upb_handlers_setuint32(h, key_field, putmapkey_uint32_t, &empty_attr);
+      break;
+    case UPB_TYPE_UINT64:
+      upb_handlers_setuint64(h, key_field, putmapkey_uint64_t, &empty_attr);
+      break;
+    case UPB_TYPE_BOOL:
+      upb_handlers_setbool(h, key_field, putmapkey_bool, &empty_attr);
+      break;
+    case UPB_TYPE_STRING:
+      upb_handlers_setstartstr(h, key_field, mapkeyval_startstr, &empty_attr);
+      upb_handlers_setstring(h, key_field, mapkey_str, &empty_attr);
+      upb_handlers_setendstr(h, key_field, mapkey_endstr, &empty_attr);
+      break;
+    case UPB_TYPE_BYTES:
+      upb_handlers_setstring(h, key_field, mapkey_bytes, &empty_attr);
+      break;
+    default:
+      UPB_ASSERT(false);
+      break;
+  }
+
+  switch (upb_fielddef_type(value_field)) {
+    case UPB_TYPE_INT32:
+      upb_handlers_setint32(h, value_field, putint32_t, &empty_attr);
+      break;
+    case UPB_TYPE_INT64:
+      upb_handlers_setint64(h, value_field, putint64_t, &empty_attr);
+      break;
+    case UPB_TYPE_UINT32:
+      upb_handlers_setuint32(h, value_field, putuint32_t, &empty_attr);
+      break;
+    case UPB_TYPE_UINT64:
+      upb_handlers_setuint64(h, value_field, putuint64_t, &empty_attr);
+      break;
+    case UPB_TYPE_BOOL:
+      upb_handlers_setbool(h, value_field, putbool, &empty_attr);
+      break;
+    case UPB_TYPE_FLOAT:
+      upb_handlers_setfloat(h, value_field, putfloat, &empty_attr);
+      break;
+    case UPB_TYPE_DOUBLE:
+      upb_handlers_setdouble(h, value_field, putdouble, &empty_attr);
+      break;
+    case UPB_TYPE_STRING:
+      upb_handlers_setstartstr(h, value_field, mapkeyval_startstr, &empty_attr);
+      upb_handlers_setstring(h, value_field, putstr, &empty_attr);
+      upb_handlers_setendstr(h, value_field, mapvalue_endstr, &empty_attr);
+      break;
+    case UPB_TYPE_BYTES:
+      upb_handlers_setstring(h, value_field, putbytes, &empty_attr);
+      break;
+    case UPB_TYPE_ENUM: {
+      upb_handlerattr enum_attr = UPB_HANDLERATTR_INIT;
+      set_enum_hd(h, value_field, preserve_fieldnames, &enum_attr);
+      upb_handlers_setint32(h, value_field, mapvalue_enum, &enum_attr);
+      break;
+    }
+    case UPB_TYPE_MESSAGE:
+      /* No handler necessary -- the submsg handlers will print the message
+       * as appropriate. */
+      break;
+  }
+}
+
+static bool putseconds(void *closure, const void *handler_data,
+                       int64_t seconds) {
+  upb_json_printer *p = closure;
+  p->seconds = seconds;
+  UPB_UNUSED(handler_data);
+  return true;
+}
+
+static bool putnanos(void *closure, const void *handler_data,
+                     int32_t nanos) {
+  upb_json_printer *p = closure;
+  p->nanos = nanos;
+  UPB_UNUSED(handler_data);
+  return true;
+}
+
+static void *scalar_startstr_nokey(void *closure, const void *handler_data,
+                                   size_t size_hint) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(size_hint);
+  print_data(p, "\"", 1);
+  return p;
+}
+
+static size_t putstr_nokey(void *closure, const void *handler_data,
+                           const char *str, size_t len,
+                           const upb_bufhandle *handle) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(handle);
+  print_data(p, "\"", 1);
+  putstring(p, str, len);
+  print_data(p, "\"", 1);
+  return len + 2;
+}
+
+static void *startseq_nokey(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  p->depth_++;
+  p->first_elem_[p->depth_] = true;
+  print_data(p, "[", 1);
+  return closure;
+}
+
+static void *startseq_fieldmask(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  p->depth_++;
+  p->first_elem_[p->depth_] = true;
+  return closure;
+}
+
+static bool endseq_fieldmask(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  p->depth_--;
+  return true;
+}
+
+static void *repeated_startstr_fieldmask(
+    void *closure, const void *handler_data,
+    size_t size_hint) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(size_hint);
+  print_comma(p);
+  return p;
+}
+
+static size_t repeated_str_fieldmask(
+    void *closure, const void *handler_data,
+    const char *str, size_t len,
+    const upb_bufhandle *handle) {
+  const char* limit = str + len;
+  bool upper = false;
+  size_t result_len = 0;
+  for (; str < limit; str++) {
+    if (*str == '_') {
+      upper = true;
+      continue;
+    }
+    if (upper && *str >= 'a' && *str <= 'z') {
+      char upper_char = toupper(*str);
+      CHK(putstr(closure, handler_data, &upper_char, 1, handle));
+    } else {
+      CHK(putstr(closure, handler_data, str, 1, handle));
+    }
+    upper = false;
+    result_len++;
+  }
+  return result_len;
+}
+
+static void *startmap_nokey(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  p->depth_++;
+  p->first_elem_[p->depth_] = true;
+  print_data(p, "{", 1);
+  return closure;
+}
+
+static bool putnull(void *closure, const void *handler_data,
+                    int32_t null) {
+  upb_json_printer *p = closure;
+  print_data(p, "null", 4);
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(null);
+  return true;
+}
+
+static bool printer_startdurationmsg(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  if (p->depth_ == 0) {
+    upb_bytessink_start(p->output_, 0, &p->subc_);
+  }
+  return true;
+}
+
+#define UPB_DURATION_MAX_JSON_LEN 23
+#define UPB_DURATION_MAX_NANO_LEN 9
+
+static bool printer_enddurationmsg(void *closure, const void *handler_data,
+                                   upb_status *s) {
+  upb_json_printer *p = closure;
+  char buffer[UPB_DURATION_MAX_JSON_LEN];
+  size_t base_len;
+  size_t curr;
+  size_t i;
+
+  memset(buffer, 0, UPB_DURATION_MAX_JSON_LEN);
+
+  if (p->seconds < -315576000000) {
+    upb_status_seterrf(s, "error parsing duration: "
+                          "minimum acceptable value is "
+                          "-315576000000");
+    return false;
+  }
+
+  if (p->seconds > 315576000000) {
+    upb_status_seterrf(s, "error serializing duration: "
+                          "maximum acceptable value is "
+                          "315576000000");
+    return false;
+  }
+
+  _upb_snprintf(buffer, sizeof(buffer), "%ld", (long)p->seconds);
+  base_len = strlen(buffer);
+
+  if (p->nanos != 0) {
+    char nanos_buffer[UPB_DURATION_MAX_NANO_LEN + 3];
+    _upb_snprintf(nanos_buffer, sizeof(nanos_buffer), "%.9f",
+                  p->nanos / 1000000000.0);
+    /* Remove trailing 0. */
+    for (i = UPB_DURATION_MAX_NANO_LEN + 2;
+         nanos_buffer[i] == '0'; i--) {
+      nanos_buffer[i] = 0;
+    }
+    strcpy(buffer + base_len, nanos_buffer + 1);
+  }
+
+  curr = strlen(buffer);
+  strcpy(buffer + curr, "s");
+
+  p->seconds = 0;
+  p->nanos = 0;
+
+  print_data(p, "\"", 1);
+  print_data(p, buffer, strlen(buffer));
+  print_data(p, "\"", 1);
+
+  if (p->depth_ == 0) {
+    upb_bytessink_end(p->output_);
+  }
+
+  UPB_UNUSED(handler_data);
+  return true;
+}
+
+static bool printer_starttimestampmsg(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  if (p->depth_ == 0) {
+    upb_bytessink_start(p->output_, 0, &p->subc_);
+  }
+  return true;
+}
+
+#define UPB_TIMESTAMP_MAX_JSON_LEN 31
+#define UPB_TIMESTAMP_BEFORE_NANO_LEN 19
+#define UPB_TIMESTAMP_MAX_NANO_LEN 9
+
+static bool printer_endtimestampmsg(void *closure, const void *handler_data,
+                                    upb_status *s) {
+  upb_json_printer *p = closure;
+  char buffer[UPB_TIMESTAMP_MAX_JSON_LEN];
+  time_t time = p->seconds;
+  size_t curr;
+  size_t i;
+  size_t year_length =
+      strftime(buffer, UPB_TIMESTAMP_MAX_JSON_LEN, "%Y", gmtime(&time));
+
+  if (p->seconds < -62135596800) {
+    upb_status_seterrf(s, "error parsing timestamp: "
+                          "minimum acceptable value is "
+                          "0001-01-01T00:00:00Z");
+    return false;
+  }
+
+  if (p->seconds > 253402300799) {
+    upb_status_seterrf(s, "error parsing timestamp: "
+                          "maximum acceptable value is "
+                          "9999-12-31T23:59:59Z");
+    return false;
+  }
+
+  /* strftime doesn't guarantee 4 digits for year. Prepend 0 by ourselves. */
+  for (i = 0; i < 4 - year_length; i++) {
+    buffer[i] = '0';
+  }
+
+  strftime(buffer + (4 - year_length), UPB_TIMESTAMP_MAX_JSON_LEN,
+           "%Y-%m-%dT%H:%M:%S", gmtime(&time));
+  if (p->nanos != 0) {
+    char nanos_buffer[UPB_TIMESTAMP_MAX_NANO_LEN + 3];
+    _upb_snprintf(nanos_buffer, sizeof(nanos_buffer), "%.9f",
+                  p->nanos / 1000000000.0);
+    /* Remove trailing 0. */
+    for (i = UPB_TIMESTAMP_MAX_NANO_LEN + 2;
+         nanos_buffer[i] == '0'; i--) {
+      nanos_buffer[i] = 0;
+    }
+    strcpy(buffer + UPB_TIMESTAMP_BEFORE_NANO_LEN, nanos_buffer + 1);
+  }
+
+  curr = strlen(buffer);
+  strcpy(buffer + curr, "Z");
+
+  p->seconds = 0;
+  p->nanos = 0;
+
+  print_data(p, "\"", 1);
+  print_data(p, buffer, strlen(buffer));
+  print_data(p, "\"", 1);
+
+  if (p->depth_ == 0) {
+    upb_bytessink_end(p->output_);
+  }
+
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(s);
+  return true;
+}
+
+static bool printer_startmsg_noframe(void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  if (p->depth_ == 0) {
+    upb_bytessink_start(p->output_, 0, &p->subc_);
+  }
+  return true;
+}
+
+static bool printer_endmsg_noframe(
+    void *closure, const void *handler_data, upb_status *s) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(s);
+  if (p->depth_ == 0) {
+    upb_bytessink_end(p->output_);
+  }
+  return true;
+}
+
+static bool printer_startmsg_fieldmask(
+    void *closure, const void *handler_data) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  if (p->depth_ == 0) {
+    upb_bytessink_start(p->output_, 0, &p->subc_);
+  }
+  print_data(p, "\"", 1);
+  return true;
+}
+
+static bool printer_endmsg_fieldmask(
+    void *closure, const void *handler_data, upb_status *s) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(handler_data);
+  UPB_UNUSED(s);
+  print_data(p, "\"", 1);
+  if (p->depth_ == 0) {
+    upb_bytessink_end(p->output_);
+  }
+  return true;
+}
+
+static void *scalar_startstr_onlykey(
+    void *closure, const void *handler_data, size_t size_hint) {
+  upb_json_printer *p = closure;
+  UPB_UNUSED(size_hint);
+  CHK(putkey(closure, handler_data));
+  return p;
+}
+
+/* Set up handlers for an Any submessage. */
+void printer_sethandlers_any(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+
+  const upb_fielddef* type_field = upb_msgdef_itof(md, UPB_ANY_TYPE);
+  const upb_fielddef* value_field = upb_msgdef_itof(md, UPB_ANY_VALUE);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  /* type_url's json name is "@type" */
+  upb_handlerattr type_name_attr = UPB_HANDLERATTR_INIT;
+  upb_handlerattr value_name_attr = UPB_HANDLERATTR_INIT;
+  strpc *type_url_json_name = newstrpc_str(h, "@type");
+  strpc *value_json_name = newstrpc_str(h, "value");
+
+  type_name_attr.handler_data = type_url_json_name;
+  value_name_attr.handler_data = value_json_name;
+
+  /* Set up handlers. */
+  upb_handlers_setstartmsg(h, printer_startmsg, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endmsg, &empty_attr);
+
+  upb_handlers_setstartstr(h, type_field, scalar_startstr, &type_name_attr);
+  upb_handlers_setstring(h, type_field, scalar_str, &empty_attr);
+  upb_handlers_setendstr(h, type_field, scalar_endstr, &empty_attr);
+
+  /* This is not the full and correct JSON encoding for the Any value field. It
+   * requires further processing by the wrapper code based on the type URL.
+   */
+  upb_handlers_setstartstr(h, value_field, scalar_startstr_onlykey,
+                           &value_name_attr);
+
+  UPB_UNUSED(closure);
+}
+
+/* Set up handlers for a fieldmask submessage. */
+void printer_sethandlers_fieldmask(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+  const upb_fielddef* f = upb_msgdef_itof(md, 1);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  upb_handlers_setstartseq(h, f, startseq_fieldmask, &empty_attr);
+  upb_handlers_setendseq(h, f, endseq_fieldmask, &empty_attr);
+
+  upb_handlers_setstartmsg(h, printer_startmsg_fieldmask, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endmsg_fieldmask, &empty_attr);
+
+  upb_handlers_setstartstr(h, f, repeated_startstr_fieldmask, &empty_attr);
+  upb_handlers_setstring(h, f, repeated_str_fieldmask, &empty_attr);
+
+  UPB_UNUSED(closure);
+}
+
+/* Set up handlers for a duration submessage. */
+void printer_sethandlers_duration(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+
+  const upb_fielddef* seconds_field =
+      upb_msgdef_itof(md, UPB_DURATION_SECONDS);
+  const upb_fielddef* nanos_field =
+      upb_msgdef_itof(md, UPB_DURATION_NANOS);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  upb_handlers_setstartmsg(h, printer_startdurationmsg, &empty_attr);
+  upb_handlers_setint64(h, seconds_field, putseconds, &empty_attr);
+  upb_handlers_setint32(h, nanos_field, putnanos, &empty_attr);
+  upb_handlers_setendmsg(h, printer_enddurationmsg, &empty_attr);
+
+  UPB_UNUSED(closure);
+}
+
+/* Set up handlers for a timestamp submessage. Instead of printing fields
+ * separately, the json representation of timestamp follows RFC 3339 */
+void printer_sethandlers_timestamp(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+
+  const upb_fielddef* seconds_field =
+      upb_msgdef_itof(md, UPB_TIMESTAMP_SECONDS);
+  const upb_fielddef* nanos_field =
+      upb_msgdef_itof(md, UPB_TIMESTAMP_NANOS);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  upb_handlers_setstartmsg(h, printer_starttimestampmsg, &empty_attr);
+  upb_handlers_setint64(h, seconds_field, putseconds, &empty_attr);
+  upb_handlers_setint32(h, nanos_field, putnanos, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endtimestampmsg, &empty_attr);
+
+  UPB_UNUSED(closure);
+}
+
+void printer_sethandlers_value(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+  upb_msg_field_iter i;
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  upb_handlers_setstartmsg(h, printer_startmsg_noframe, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endmsg_noframe, &empty_attr);
+
+  upb_msg_field_begin(&i, md);
+  for(; !upb_msg_field_done(&i); upb_msg_field_next(&i)) {
+    const upb_fielddef *f = upb_msg_iter_field(&i);
+
+    switch (upb_fielddef_type(f)) {
+      case UPB_TYPE_ENUM:
+        upb_handlers_setint32(h, f, putnull, &empty_attr);
+        break;
+      case UPB_TYPE_DOUBLE:
+        upb_handlers_setdouble(h, f, putdouble, &empty_attr);
+        break;
+      case UPB_TYPE_STRING:
+        upb_handlers_setstartstr(h, f, scalar_startstr_nokey, &empty_attr);
+        upb_handlers_setstring(h, f, scalar_str, &empty_attr);
+        upb_handlers_setendstr(h, f, scalar_endstr, &empty_attr);
+        break;
+      case UPB_TYPE_BOOL:
+        upb_handlers_setbool(h, f, putbool, &empty_attr);
+        break;
+      case UPB_TYPE_MESSAGE:
+        break;
+      default:
+        UPB_ASSERT(false);
+        break;
+    }
+  }
+
+  UPB_UNUSED(closure);
+}
+
+#define WRAPPER_SETHANDLERS(wrapper, type, putmethod)                      \
+void printer_sethandlers_##wrapper(const void *closure, upb_handlers *h) { \
+  const upb_msgdef *md = upb_handlers_msgdef(h);                           \
+  const upb_fielddef* f = upb_msgdef_itof(md, 1);                          \
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;                \
+  upb_handlers_setstartmsg(h, printer_startmsg_noframe, &empty_attr);      \
+  upb_handlers_setendmsg(h, printer_endmsg_noframe, &empty_attr);          \
+  upb_handlers_set##type(h, f, putmethod, &empty_attr);                    \
+  UPB_UNUSED(closure);                                                     \
+}
+
+WRAPPER_SETHANDLERS(doublevalue, double, putdouble)
+WRAPPER_SETHANDLERS(floatvalue,  float,  putfloat)
+WRAPPER_SETHANDLERS(int64value,  int64,  putint64_t)
+WRAPPER_SETHANDLERS(uint64value, uint64, putuint64_t)
+WRAPPER_SETHANDLERS(int32value,  int32,  putint32_t)
+WRAPPER_SETHANDLERS(uint32value, uint32, putuint32_t)
+WRAPPER_SETHANDLERS(boolvalue,   bool,   putbool)
+WRAPPER_SETHANDLERS(stringvalue, string, putstr_nokey)
+WRAPPER_SETHANDLERS(bytesvalue,  string, putbytes)
+
+#undef WRAPPER_SETHANDLERS
+
+void printer_sethandlers_listvalue(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+  const upb_fielddef* f = upb_msgdef_itof(md, 1);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  upb_handlers_setstartseq(h, f, startseq_nokey, &empty_attr);
+  upb_handlers_setendseq(h, f, endseq, &empty_attr);
+
+  upb_handlers_setstartmsg(h, printer_startmsg_noframe, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endmsg_noframe, &empty_attr);
+
+  upb_handlers_setstartsubmsg(h, f, repeated_startsubmsg, &empty_attr);
+
+  UPB_UNUSED(closure);
+}
+
+void printer_sethandlers_structvalue(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+  const upb_fielddef* f = upb_msgdef_itof(md, 1);
+
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+
+  upb_handlers_setstartseq(h, f, startmap_nokey, &empty_attr);
+  upb_handlers_setendseq(h, f, endmap, &empty_attr);
+
+  upb_handlers_setstartmsg(h, printer_startmsg_noframe, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endmsg_noframe, &empty_attr);
+
+  upb_handlers_setstartsubmsg(h, f, repeated_startsubmsg, &empty_attr);
+
+  UPB_UNUSED(closure);
+}
+
+void printer_sethandlers(const void *closure, upb_handlers *h) {
+  const upb_msgdef *md = upb_handlers_msgdef(h);
+  bool is_mapentry = upb_msgdef_mapentry(md);
+  upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT;
+  upb_msg_field_iter i;
+  const upb_json_printercache *cache = closure;
+  const bool preserve_fieldnames = cache->preserve_fieldnames;
+
+  if (is_mapentry) {
+    /* mapentry messages are sufficiently different that we handle them
+     * separately. */
+    printer_sethandlers_mapentry(closure, preserve_fieldnames, h);
+    return;
+  }
+
+  switch (upb_msgdef_wellknowntype(md)) {
+    case UPB_WELLKNOWN_UNSPECIFIED:
+      break;
+    case UPB_WELLKNOWN_ANY:
+      printer_sethandlers_any(closure, h);
+      return;
+    case UPB_WELLKNOWN_FIELDMASK:
+      printer_sethandlers_fieldmask(closure, h);
+      return;
+    case UPB_WELLKNOWN_DURATION:
+      printer_sethandlers_duration(closure, h);
+      return;
+    case UPB_WELLKNOWN_TIMESTAMP:
+      printer_sethandlers_timestamp(closure, h);
+      return;
+    case UPB_WELLKNOWN_VALUE:
+      printer_sethandlers_value(closure, h);
+      return;
+    case UPB_WELLKNOWN_LISTVALUE:
+      printer_sethandlers_listvalue(closure, h);
+      return;
+    case UPB_WELLKNOWN_STRUCT:
+      printer_sethandlers_structvalue(closure, h);
+      return;
+#define WRAPPER(wellknowntype, name)        \
+  case wellknowntype:                       \
+    printer_sethandlers_##name(closure, h); \
+    return;                                 \
+
+    WRAPPER(UPB_WELLKNOWN_DOUBLEVALUE, doublevalue);
+    WRAPPER(UPB_WELLKNOWN_FLOATVALUE, floatvalue);
+    WRAPPER(UPB_WELLKNOWN_INT64VALUE, int64value);
+    WRAPPER(UPB_WELLKNOWN_UINT64VALUE, uint64value);
+    WRAPPER(UPB_WELLKNOWN_INT32VALUE, int32value);
+    WRAPPER(UPB_WELLKNOWN_UINT32VALUE, uint32value);
+    WRAPPER(UPB_WELLKNOWN_BOOLVALUE, boolvalue);
+    WRAPPER(UPB_WELLKNOWN_STRINGVALUE, stringvalue);
+    WRAPPER(UPB_WELLKNOWN_BYTESVALUE, bytesvalue);
+
+#undef WRAPPER
+  }
+
+  upb_handlers_setstartmsg(h, printer_startmsg, &empty_attr);
+  upb_handlers_setendmsg(h, printer_endmsg, &empty_attr);
+
+#define TYPE(type, name, ctype)                                               \
+  case type:                                                                  \
+    if (upb_fielddef_isseq(f)) {                                              \
+      upb_handlers_set##name(h, f, repeated_##ctype, &empty_attr);            \
+    } else {                                                                  \
+      upb_handlers_set##name(h, f, scalar_##ctype, &name_attr);               \
+    }                                                                         \
+    break;
+
+  upb_msg_field_begin(&i, md);
+  for(; !upb_msg_field_done(&i); upb_msg_field_next(&i)) {
+    const upb_fielddef *f = upb_msg_iter_field(&i);
+
+    upb_handlerattr name_attr = UPB_HANDLERATTR_INIT;
+    name_attr.handler_data = newstrpc(h, f, preserve_fieldnames);
+
+    if (upb_fielddef_ismap(f)) {
+      upb_handlers_setstartseq(h, f, startmap, &name_attr);
+      upb_handlers_setendseq(h, f, endmap, &name_attr);
+    } else if (upb_fielddef_isseq(f)) {
+      upb_handlers_setstartseq(h, f, startseq, &name_attr);
+      upb_handlers_setendseq(h, f, endseq, &empty_attr);
+    }
+
+    switch (upb_fielddef_type(f)) {
+      TYPE(UPB_TYPE_FLOAT,  float,  float);
+      TYPE(UPB_TYPE_DOUBLE, double, double);
+      TYPE(UPB_TYPE_BOOL,   bool,   bool);
+      TYPE(UPB_TYPE_INT32,  int32,  int32_t);
+      TYPE(UPB_TYPE_UINT32, uint32, uint32_t);
+      TYPE(UPB_TYPE_INT64,  int64,  int64_t);
+      TYPE(UPB_TYPE_UINT64, uint64, uint64_t);
+      case UPB_TYPE_ENUM: {
+        /* For now, we always emit symbolic names for enums. We may want an
+         * option later to control this behavior, but we will wait for a real
+         * need first. */
+        upb_handlerattr enum_attr = UPB_HANDLERATTR_INIT;
+        set_enum_hd(h, f, preserve_fieldnames, &enum_attr);
+
+        if (upb_fielddef_isseq(f)) {
+          upb_handlers_setint32(h, f, repeated_enum, &enum_attr);
+        } else {
+          upb_handlers_setint32(h, f, scalar_enum, &enum_attr);
+        }
+
+        break;
+      }
+      case UPB_TYPE_STRING:
+        if (upb_fielddef_isseq(f)) {
+          upb_handlers_setstartstr(h, f, repeated_startstr, &empty_attr);
+          upb_handlers_setstring(h, f, repeated_str, &empty_attr);
+          upb_handlers_setendstr(h, f, repeated_endstr, &empty_attr);
+        } else {
+          upb_handlers_setstartstr(h, f, scalar_startstr, &name_attr);
+          upb_handlers_setstring(h, f, scalar_str, &empty_attr);
+          upb_handlers_setendstr(h, f, scalar_endstr, &empty_attr);
+        }
+        break;
+      case UPB_TYPE_BYTES:
+        /* XXX: this doesn't support strings that span buffers yet. The base64
+         * encoder will need to be made resumable for this to work properly. */
+        if (upb_fielddef_isseq(f)) {
+          upb_handlers_setstring(h, f, repeated_bytes, &empty_attr);
+        } else {
+          upb_handlers_setstring(h, f, scalar_bytes, &name_attr);
+        }
+        break;
+      case UPB_TYPE_MESSAGE:
+        if (upb_fielddef_isseq(f)) {
+          upb_handlers_setstartsubmsg(h, f, repeated_startsubmsg, &name_attr);
+        } else {
+          upb_handlers_setstartsubmsg(h, f, scalar_startsubmsg, &name_attr);
+        }
+        break;
+    }
+  }
+
+#undef TYPE
+}
+
+static void json_printer_reset(upb_json_printer *p) {
+  p->depth_ = 0;
+}
+
+
+/* Public API *****************************************************************/
+
+upb_json_printer *upb_json_printer_create(upb_arena *a, const upb_handlers *h,
+                                          upb_bytessink output) {
+#ifndef NDEBUG
+  size_t size_before = upb_arena_bytesallocated(a);
+#endif
+
+  upb_json_printer *p = upb_arena_malloc(a, sizeof(upb_json_printer));
+  if (!p) return NULL;
+
+  p->output_ = output;
+  json_printer_reset(p);
+  upb_sink_reset(&p->input_, h, p);
+  p->seconds = 0;
+  p->nanos = 0;
+
+  /* If this fails, increase the value in printer.h. */
+  UPB_ASSERT_DEBUGVAR(upb_arena_bytesallocated(a) - size_before <=
+                      UPB_JSON_PRINTER_SIZE);
+  return p;
+}
+
+upb_sink upb_json_printer_input(upb_json_printer *p) {
+  return p->input_;
+}
+
+upb_handlercache *upb_json_printer_newcache(bool preserve_proto_fieldnames) {
+  upb_json_printercache *cache = upb_gmalloc(sizeof(*cache));
+  upb_handlercache *ret = upb_handlercache_new(printer_sethandlers, cache);
+
+  cache->preserve_fieldnames = preserve_proto_fieldnames;
+  upb_handlercache_addcleanup(ret, cache, upb_gfree);
+
+  return ret;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/printer.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/json/printer.h
new file mode 100644 (file)
index 0000000..85b9b12
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+** upb::json::Printer
+**
+** Handlers that emit JSON according to a specific protobuf schema.
+*/
+
+#ifndef UPB_JSON_TYPED_PRINTER_H_
+#define UPB_JSON_TYPED_PRINTER_H_
+
+#include "upb/sink.h"
+
+#ifdef __cplusplus
+namespace upb {
+namespace json {
+class PrinterPtr;
+}  /* namespace json */
+}  /* namespace upb */
+#endif
+
+/* upb_json_printer ***********************************************************/
+
+#define UPB_JSON_PRINTER_SIZE 192
+
+struct upb_json_printer;
+typedef struct upb_json_printer upb_json_printer;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Native C API. */
+upb_json_printer *upb_json_printer_create(upb_arena *a, const upb_handlers *h,
+                                          upb_bytessink output);
+upb_sink upb_json_printer_input(upb_json_printer *p);
+const upb_handlers *upb_json_printer_newhandlers(const upb_msgdef *md,
+                                                 bool preserve_fieldnames,
+                                                 const void *owner);
+
+/* Lazily builds and caches handlers that will push encoded data to a bytessink.
+ * Any msgdef objects used with this object must outlive it. */
+upb_handlercache *upb_json_printer_newcache(bool preserve_proto_fieldnames);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Prints an incoming stream of data to a BytesSink in JSON format. */
+class upb::json::PrinterPtr {
+ public:
+  PrinterPtr(upb_json_printer* ptr) : ptr_(ptr) {}
+
+  static PrinterPtr Create(Arena *arena, const upb::Handlers *handlers,
+                           BytesSink output) {
+    return PrinterPtr(
+        upb_json_printer_create(arena->ptr(), handlers, output.sink()));
+  }
+
+  /* The input to the printer. */
+  Sink input() { return upb_json_printer_input(ptr_); }
+
+  static const size_t kSize = UPB_JSON_PRINTER_SIZE;
+
+  static HandlerCache NewCache(bool preserve_proto_fieldnames) {
+    return upb_json_printer_newcache(preserve_proto_fieldnames);
+  }
+
+ private:
+  upb_json_printer* ptr_;
+};
+
+#endif  /* __cplusplus */
+
+#endif  /* UPB_JSON_TYPED_PRINTER_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/legacy_msg_reflection.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/legacy_msg_reflection.c
new file mode 100644 (file)
index 0000000..031aa4e
--- /dev/null
@@ -0,0 +1,399 @@
+
+#include "upb/legacy_msg_reflection.h"
+
+#include <string.h>
+#include "upb/table.int.h"
+#include "upb/msg.h"
+
+#include "upb/port_def.inc"
+
+bool upb_fieldtype_mapkeyok(upb_fieldtype_t type) {
+  return type == UPB_TYPE_BOOL || type == UPB_TYPE_INT32 ||
+         type == UPB_TYPE_UINT32 || type == UPB_TYPE_INT64 ||
+         type == UPB_TYPE_UINT64 || type == UPB_TYPE_STRING;
+}
+
+#define PTR_AT(msg, ofs, type) (type*)((char*)msg + ofs)
+#define VOIDPTR_AT(msg, ofs) PTR_AT(msg, ofs, void)
+#define ENCODE_MAX_NESTING 64
+#define CHECK_TRUE(x) if (!(x)) { return false; }
+
+/** upb_msgval ****************************************************************/
+
+/* These functions will generate real memcpy() calls on ARM sadly, because
+ * the compiler assumes they might not be aligned. */
+
+static upb_msgval upb_msgval_read(const void *p, size_t ofs,
+                                  uint8_t size) {
+  upb_msgval val;
+  p = (char*)p + ofs;
+  memcpy(&val, p, size);
+  return val;
+}
+
+static void upb_msgval_write(void *p, size_t ofs, upb_msgval val,
+                             uint8_t size) {
+  p = (char*)p + ofs;
+  memcpy(p, &val, size);
+}
+
+static size_t upb_msgval_sizeof(upb_fieldtype_t type) {
+  switch (type) {
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT64:
+      return 8;
+    case UPB_TYPE_ENUM:
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_FLOAT:
+      return 4;
+    case UPB_TYPE_BOOL:
+      return 1;
+    case UPB_TYPE_MESSAGE:
+      return sizeof(void*);
+    case UPB_TYPE_BYTES:
+    case UPB_TYPE_STRING:
+      return sizeof(upb_strview);
+  }
+  UPB_UNREACHABLE();
+}
+
+static uint8_t upb_msg_fieldsize(const upb_msglayout_field *field) {
+  if (field->label == UPB_LABEL_REPEATED) {
+    return sizeof(void*);
+  } else {
+    return upb_msgval_sizeof(upb_desctype_to_fieldtype[field->descriptortype]);
+  }
+}
+
+/* TODO(haberman): this is broken right now because upb_msgval can contain
+ * a char* / size_t pair, which is too big for a upb_value.  To fix this
+ * we'll probably need to dynamically allocate a upb_msgval and store a
+ * pointer to that in the tables for extensions/maps. */
+static upb_value upb_toval(upb_msgval val) {
+  upb_value ret;
+  UPB_UNUSED(val);
+  memset(&ret, 0, sizeof(upb_value));  /* XXX */
+  return ret;
+}
+
+static upb_msgval upb_msgval_fromval(upb_value val) {
+  upb_msgval ret;
+  UPB_UNUSED(val);
+  memset(&ret, 0, sizeof(upb_msgval));  /* XXX */
+  return ret;
+}
+
+static upb_ctype_t upb_fieldtotabtype(upb_fieldtype_t type) {
+  switch (type) {
+    case UPB_TYPE_FLOAT: return UPB_CTYPE_FLOAT;
+    case UPB_TYPE_DOUBLE: return UPB_CTYPE_DOUBLE;
+    case UPB_TYPE_BOOL: return UPB_CTYPE_BOOL;
+    case UPB_TYPE_BYTES:
+    case UPB_TYPE_MESSAGE:
+    case UPB_TYPE_STRING: return UPB_CTYPE_CONSTPTR;
+    case UPB_TYPE_ENUM:
+    case UPB_TYPE_INT32: return UPB_CTYPE_INT32;
+    case UPB_TYPE_UINT32: return UPB_CTYPE_UINT32;
+    case UPB_TYPE_INT64: return UPB_CTYPE_INT64;
+    case UPB_TYPE_UINT64: return UPB_CTYPE_UINT64;
+    default: UPB_ASSERT(false); return 0;
+  }
+}
+
+
+/** upb_msg *******************************************************************/
+
+/* If we always read/write as a consistent type to each address, this shouldn't
+ * violate aliasing.
+ */
+#define DEREF(msg, ofs, type) *PTR_AT(msg, ofs, type)
+
+static const upb_msglayout_field *upb_msg_checkfield(int field_index,
+                                                     const upb_msglayout *l) {
+  UPB_ASSERT(field_index >= 0 && field_index < l->field_count);
+  return &l->fields[field_index];
+}
+
+static bool upb_msg_inoneof(const upb_msglayout_field *field) {
+  return field->presence < 0;
+}
+
+static uint32_t *upb_msg_oneofcase(const upb_msg *msg, int field_index,
+                                   const upb_msglayout *l) {
+  const upb_msglayout_field *field = upb_msg_checkfield(field_index, l);
+  UPB_ASSERT(upb_msg_inoneof(field));
+  return PTR_AT(msg, ~field->presence, uint32_t);
+}
+
+bool upb_msg_has(const upb_msg *msg,
+                 int field_index,
+                 const upb_msglayout *l) {
+  const upb_msglayout_field *field = upb_msg_checkfield(field_index, l);
+
+  UPB_ASSERT(field->presence);
+
+  if (upb_msg_inoneof(field)) {
+    /* Oneofs are set when the oneof number is set to this field. */
+    return *upb_msg_oneofcase(msg, field_index, l) == field->number;
+  } else {
+    /* Other fields are set when their hasbit is set. */
+    uint32_t hasbit = field->presence;
+    return DEREF(msg, hasbit / 8, char) | (1 << (hasbit % 8));
+  }
+}
+
+upb_msgval upb_msg_get(const upb_msg *msg, int field_index,
+                       const upb_msglayout *l) {
+  const upb_msglayout_field *field = upb_msg_checkfield(field_index, l);
+  int size = upb_msg_fieldsize(field);
+  return upb_msgval_read(msg, field->offset, size);
+}
+
+void upb_msg_set(upb_msg *msg, int field_index, upb_msgval val,
+                 const upb_msglayout *l) {
+  const upb_msglayout_field *field = upb_msg_checkfield(field_index, l);
+  int size = upb_msg_fieldsize(field);
+  upb_msgval_write(msg, field->offset, val, size);
+}
+
+
+/** upb_array *****************************************************************/
+
+#define DEREF_ARR(arr, i, type) ((type*)arr->data)[i]
+
+size_t upb_array_size(const upb_array *arr) {
+  return arr->len;
+}
+
+upb_msgval upb_array_get(const upb_array *arr, upb_fieldtype_t type, size_t i) {
+  size_t element_size = upb_msgval_sizeof(type);
+  UPB_ASSERT(i < arr->len);
+  return upb_msgval_read(arr->data, i * element_size, element_size);
+}
+
+bool upb_array_set(upb_array *arr, upb_fieldtype_t type, size_t i,
+                   upb_msgval val, upb_arena *arena) {
+  size_t element_size = upb_msgval_sizeof(type);
+  UPB_ASSERT(i <= arr->len);
+
+  if (i == arr->len) {
+    /* Extending the array. */
+
+    if (i == arr->size) {
+      /* Need to reallocate. */
+      size_t new_size = UPB_MAX(arr->size * 2, 8);
+      size_t new_bytes = new_size * element_size;
+      size_t old_bytes = arr->size * element_size;
+      upb_alloc *alloc = upb_arena_alloc(arena);
+      upb_msgval *new_data =
+          upb_realloc(alloc, arr->data, old_bytes, new_bytes);
+
+      if (!new_data) {
+        return false;
+      }
+
+      arr->data = new_data;
+      arr->size = new_size;
+    }
+
+    arr->len = i + 1;
+  }
+
+  upb_msgval_write(arr->data, i * element_size, val, element_size);
+  return true;
+}
+
+/** upb_map *******************************************************************/
+
+struct upb_map {
+  upb_fieldtype_t key_type;
+  upb_fieldtype_t val_type;
+  /* We may want to optimize this to use inttable where possible, for greater
+   * efficiency and lower memory footprint. */
+  upb_strtable strtab;
+  upb_arena *arena;
+};
+
+static void upb_map_tokey(upb_fieldtype_t type, upb_msgval *key,
+                          const char **out_key, size_t *out_len) {
+  switch (type) {
+    case UPB_TYPE_STRING:
+      /* Point to string data of the input key. */
+      *out_key = key->str.data;
+      *out_len = key->str.size;
+      return;
+    case UPB_TYPE_BOOL:
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT64:
+      /* Point to the key itself.  XXX: big-endian. */
+      *out_key = (const char*)key;
+      *out_len = upb_msgval_sizeof(type);
+      return;
+    case UPB_TYPE_BYTES:
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_ENUM:
+    case UPB_TYPE_FLOAT:
+    case UPB_TYPE_MESSAGE:
+      break;  /* Cannot be a map key. */
+  }
+  UPB_UNREACHABLE();
+}
+
+static upb_msgval upb_map_fromkey(upb_fieldtype_t type, const char *key,
+                                  size_t len) {
+  switch (type) {
+    case UPB_TYPE_STRING:
+      return upb_msgval_makestr(key, len);
+    case UPB_TYPE_BOOL:
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT64:
+      return upb_msgval_read(key, 0, upb_msgval_sizeof(type));
+    case UPB_TYPE_BYTES:
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_ENUM:
+    case UPB_TYPE_FLOAT:
+    case UPB_TYPE_MESSAGE:
+      break;  /* Cannot be a map key. */
+  }
+  UPB_UNREACHABLE();
+}
+
+upb_map *upb_map_new(upb_fieldtype_t ktype, upb_fieldtype_t vtype,
+                     upb_arena *a) {
+  upb_ctype_t vtabtype = upb_fieldtotabtype(vtype);
+  upb_alloc *alloc = upb_arena_alloc(a);
+  upb_map *map = upb_malloc(alloc, sizeof(upb_map));
+
+  if (!map) {
+    return NULL;
+  }
+
+  UPB_ASSERT(upb_fieldtype_mapkeyok(ktype));
+  map->key_type = ktype;
+  map->val_type = vtype;
+  map->arena = a;
+
+  if (!upb_strtable_init2(&map->strtab, vtabtype, alloc)) {
+    return NULL;
+  }
+
+  return map;
+}
+
+size_t upb_map_size(const upb_map *map) {
+  return upb_strtable_count(&map->strtab);
+}
+
+upb_fieldtype_t upb_map_keytype(const upb_map *map) {
+  return map->key_type;
+}
+
+upb_fieldtype_t upb_map_valuetype(const upb_map *map) {
+  return map->val_type;
+}
+
+bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val) {
+  upb_value tabval;
+  const char *key_str;
+  size_t key_len;
+  bool ret;
+
+  upb_map_tokey(map->key_type, &key, &key_str, &key_len);
+  ret = upb_strtable_lookup2(&map->strtab, key_str, key_len, &tabval);
+  if (ret) {
+    memcpy(val, &tabval, sizeof(tabval));
+  }
+
+  return ret;
+}
+
+bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val,
+                 upb_msgval *removed) {
+  const char *key_str;
+  size_t key_len;
+  upb_value tabval = upb_toval(val);
+  upb_value removedtabval;
+  upb_alloc *a = upb_arena_alloc(map->arena);
+
+  upb_map_tokey(map->key_type, &key, &key_str, &key_len);
+
+  /* TODO(haberman): add overwrite operation to minimize number of lookups. */
+  if (upb_strtable_lookup2(&map->strtab, key_str, key_len, NULL)) {
+    upb_strtable_remove3(&map->strtab, key_str, key_len, &removedtabval, a);
+    memcpy(&removed, &removedtabval, sizeof(removed));
+  }
+
+  return upb_strtable_insert3(&map->strtab, key_str, key_len, tabval, a);
+}
+
+bool upb_map_del(upb_map *map, upb_msgval key) {
+  const char *key_str;
+  size_t key_len;
+  upb_alloc *a = upb_arena_alloc(map->arena);
+
+  upb_map_tokey(map->key_type, &key, &key_str, &key_len);
+  return upb_strtable_remove3(&map->strtab, key_str, key_len, NULL, a);
+}
+
+
+/** upb_mapiter ***************************************************************/
+
+struct upb_mapiter {
+  upb_strtable_iter iter;
+  upb_fieldtype_t key_type;
+};
+
+size_t upb_mapiter_sizeof(void) {
+  return sizeof(upb_mapiter);
+}
+
+void upb_mapiter_begin(upb_mapiter *i, const upb_map *map) {
+  upb_strtable_begin(&i->iter, &map->strtab);
+  i->key_type = map->key_type;
+}
+
+upb_mapiter *upb_mapiter_new(const upb_map *t, upb_alloc *a) {
+  upb_mapiter *ret = upb_malloc(a, upb_mapiter_sizeof());
+
+  if (!ret) {
+    return NULL;
+  }
+
+  upb_mapiter_begin(ret, t);
+  return ret;
+}
+
+void upb_mapiter_free(upb_mapiter *i, upb_alloc *a) {
+  upb_free(a, i);
+}
+
+void upb_mapiter_next(upb_mapiter *i) {
+  upb_strtable_next(&i->iter);
+}
+
+bool upb_mapiter_done(const upb_mapiter *i) {
+  return upb_strtable_done(&i->iter);
+}
+
+upb_msgval upb_mapiter_key(const upb_mapiter *i) {
+  return upb_map_fromkey(i->key_type, upb_strtable_iter_key(&i->iter),
+                         upb_strtable_iter_keylength(&i->iter));
+}
+
+upb_msgval upb_mapiter_value(const upb_mapiter *i) {
+  return upb_msgval_fromval(upb_strtable_iter_value(&i->iter));
+}
+
+void upb_mapiter_setdone(upb_mapiter *i) {
+  upb_strtable_iter_setdone(&i->iter);
+}
+
+bool upb_mapiter_isequal(const upb_mapiter *i1, const upb_mapiter *i2) {
+  return upb_strtable_iter_isequal(&i1->iter, &i2->iter);
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/legacy_msg_reflection.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/legacy_msg_reflection.h
new file mode 100644 (file)
index 0000000..c54bfb9
--- /dev/null
@@ -0,0 +1,191 @@
+
+#ifndef UPB_LEGACY_MSG_REFLECTION_H_
+#define UPB_LEGACY_MSG_REFLECTION_H_
+
+#include "upb/upb.h"
+#include "upb/msg.h"
+
+#include "upb/port_def.inc"
+
+struct upb_map;
+typedef struct upb_map upb_map;
+
+struct upb_mapiter;
+typedef struct upb_mapiter upb_mapiter;
+
+/** upb_msgval ****************************************************************/
+
+/* A union representing all possible protobuf values.  Used for generic get/set
+ * operations. */
+
+typedef union {
+  bool b;
+  float flt;
+  double dbl;
+  int32_t i32;
+  int64_t i64;
+  uint32_t u32;
+  uint64_t u64;
+  const upb_map* map;
+  const upb_msg* msg;
+  const upb_array* arr;
+  const void* ptr;
+  upb_strview str;
+} upb_msgval;
+
+#define ACCESSORS(name, membername, ctype) \
+  UPB_INLINE ctype upb_msgval_get ## name(upb_msgval v) { \
+    return v.membername; \
+  } \
+  UPB_INLINE void upb_msgval_set ## name(upb_msgval *v, ctype cval) { \
+    v->membername = cval; \
+  } \
+  UPB_INLINE upb_msgval upb_msgval_ ## name(ctype v) { \
+    upb_msgval ret; \
+    ret.membername = v; \
+    return ret; \
+  }
+
+ACCESSORS(bool,   b,   bool)
+ACCESSORS(float,  flt, float)
+ACCESSORS(double, dbl, double)
+ACCESSORS(int32,  i32, int32_t)
+ACCESSORS(int64,  i64, int64_t)
+ACCESSORS(uint32, u32, uint32_t)
+ACCESSORS(uint64, u64, uint64_t)
+ACCESSORS(map,    map, const upb_map*)
+ACCESSORS(msg,    msg, const upb_msg*)
+ACCESSORS(ptr,    ptr, const void*)
+ACCESSORS(arr,    arr, const upb_array*)
+ACCESSORS(str,    str, upb_strview)
+
+#undef ACCESSORS
+
+UPB_INLINE upb_msgval upb_msgval_makestr(const char *data, size_t size) {
+  return upb_msgval_str(upb_strview_make(data, size));
+}
+
+/** upb_msg *******************************************************************/
+
+/* A upb_msg represents a protobuf message.  It always corresponds to a specific
+ * upb_msglayout, which describes how it is laid out in memory.  */
+
+/* Read-only message API.  Can be safely called by anyone. */
+
+/* Returns the value associated with this field:
+ *   - for scalar fields (including strings), the value directly.
+ *   - return upb_msg*, or upb_map* for msg/map.
+ *     If the field is unset for these field types, returns NULL.
+ *
+ * TODO(haberman): should we let users store cached array/map/msg
+ * pointers here for fields that are unset?  Could be useful for the
+ * strongly-owned submessage model (ie. generated C API that doesn't use
+ * arenas).
+ */
+upb_msgval upb_msg_get(const upb_msg *msg,
+                       int field_index,
+                       const upb_msglayout *l);
+
+/* May only be called for fields where upb_fielddef_haspresence(f) == true. */
+bool upb_msg_has(const upb_msg *msg,
+                 int field_index,
+                 const upb_msglayout *l);
+
+/* Mutable message API.  May only be called by the owner of the message who
+ * knows its ownership scheme and how to keep it consistent. */
+
+/* Sets the given field to the given value.  Does not perform any memory
+ * management: if you overwrite a pointer to a msg/array/map/string without
+ * cleaning it up (or using an arena) it will leak.
+ */
+void upb_msg_set(upb_msg *msg,
+                 int field_index,
+                 upb_msgval val,
+                 const upb_msglayout *l);
+
+/* For a primitive field, set it back to its default. For repeated, string, and
+ * submessage fields set it back to NULL.  This could involve releasing some
+ * internal memory (for example, from an extension dictionary), but it is not
+ * recursive in any way and will not recover any memory that may be used by
+ * arrays/maps/strings/msgs that this field may have pointed to.
+ */
+bool upb_msg_clearfield(upb_msg *msg,
+                        int field_index,
+                        const upb_msglayout *l);
+
+/* TODO(haberman): copyfrom()/mergefrom()? */
+
+/** upb_array *****************************************************************/
+
+/* A upb_array stores data for a repeated field.  The memory management
+ * semantics are the same as upb_msg.  A upb_array allocates dynamic
+ * memory internally for the array elements. */
+
+upb_fieldtype_t upb_array_type(const upb_array *arr);
+
+/* Read-only interface.  Safe for anyone to call. */
+
+size_t upb_array_size(const upb_array *arr);
+upb_msgval upb_array_get(const upb_array *arr, upb_fieldtype_t type, size_t i);
+
+/* Write interface.  May only be called by the message's owner who can enforce
+ * its memory management invariants. */
+
+bool upb_array_set(upb_array *arr, upb_fieldtype_t type, size_t i,
+                   upb_msgval val, upb_arena *arena);
+
+/** upb_map *******************************************************************/
+
+/* A upb_map stores data for a map field.  The memory management semantics are
+ * the same as upb_msg, with one notable exception.  upb_map will internally
+ * store a copy of all string keys, but *not* any string values or submessages.
+ * So you must ensure that any string or message values outlive the map, and you
+ * must delete them manually when they are no longer required. */
+
+upb_map *upb_map_new(upb_fieldtype_t ktype, upb_fieldtype_t vtype,
+                     upb_arena *a);
+
+/* Read-only interface.  Safe for anyone to call. */
+
+size_t upb_map_size(const upb_map *map);
+upb_fieldtype_t upb_map_keytype(const upb_map *map);
+upb_fieldtype_t upb_map_valuetype(const upb_map *map);
+bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val);
+
+/* Write interface.  May only be called by the message's owner who can enforce
+ * its memory management invariants. */
+
+/* Sets or overwrites an entry in the map.  Return value indicates whether
+ * the operation succeeded or failed with OOM, and also whether an existing
+ * key was replaced or not. */
+bool upb_map_set(upb_map *map,
+                 upb_msgval key, upb_msgval val,
+                 upb_msgval *valremoved);
+
+/* Deletes an entry in the map.  Returns true if the key was present. */
+bool upb_map_del(upb_map *map, upb_msgval key);
+
+/** upb_mapiter ***************************************************************/
+
+/* For iterating over a map.  Map iterators are invalidated by mutations to the
+ * map, but an invalidated iterator will never return junk or crash the process.
+ * An invalidated iterator may return entries that were already returned though,
+ * and if you keep invalidating the iterator during iteration, the program may
+ * enter an infinite loop. */
+
+size_t upb_mapiter_sizeof(void);
+
+void upb_mapiter_begin(upb_mapiter *i, const upb_map *t);
+upb_mapiter *upb_mapiter_new(const upb_map *t, upb_alloc *a);
+void upb_mapiter_free(upb_mapiter *i, upb_alloc *a);
+void upb_mapiter_next(upb_mapiter *i);
+bool upb_mapiter_done(const upb_mapiter *i);
+
+upb_msgval upb_mapiter_key(const upb_mapiter *i);
+upb_msgval upb_mapiter_value(const upb_mapiter *i);
+void upb_mapiter_setdone(upb_mapiter *i);
+bool upb_mapiter_isequal(const upb_mapiter *i1, const upb_mapiter *i2);
+
+#include "upb/port_undef.inc"
+
+#endif /* UPB_LEGACY_MSG_REFLECTION_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msg.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msg.c
new file mode 100644 (file)
index 0000000..a77da56
--- /dev/null
@@ -0,0 +1,111 @@
+
+#include "upb/msg.h"
+
+#include "upb/table.int.h"
+
+#include "upb/port_def.inc"
+
+#define VOIDPTR_AT(msg, ofs) (void*)((char*)msg + (int)ofs)
+
+/* Internal members of a upb_msg.  We can change this without breaking binary
+ * compatibility.  We put these before the user's data.  The user's upb_msg*
+ * points after the upb_msg_internal. */
+
+/* Used when a message is not extendable. */
+typedef struct {
+  char *unknown;
+  size_t unknown_len;
+  size_t unknown_size;
+} upb_msg_internal;
+
+/* Used when a message is extendable. */
+typedef struct {
+  upb_inttable *extdict;
+  upb_msg_internal base;
+} upb_msg_internal_withext;
+
+static int upb_msg_internalsize(const upb_msglayout *l) {
+  return sizeof(upb_msg_internal) - l->extendable * sizeof(void *);
+}
+
+static size_t upb_msg_sizeof(const upb_msglayout *l) {
+  return l->size + upb_msg_internalsize(l);
+}
+
+static upb_msg_internal *upb_msg_getinternal(upb_msg *msg) {
+  return VOIDPTR_AT(msg, -sizeof(upb_msg_internal));
+}
+
+static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) {
+  return VOIDPTR_AT(msg, -sizeof(upb_msg_internal));
+}
+
+static upb_msg_internal_withext *upb_msg_getinternalwithext(
+    upb_msg *msg, const upb_msglayout *l) {
+  UPB_ASSERT(l->extendable);
+  return VOIDPTR_AT(msg, -sizeof(upb_msg_internal_withext));
+}
+
+upb_msg *upb_msg_new(const upb_msglayout *l, upb_arena *a) {
+  upb_alloc *alloc = upb_arena_alloc(a);
+  void *mem = upb_malloc(alloc, upb_msg_sizeof(l));
+  upb_msg_internal *in;
+  upb_msg *msg;
+
+  if (!mem) {
+    return NULL;
+  }
+
+  msg = VOIDPTR_AT(mem, upb_msg_internalsize(l));
+
+  /* Initialize normal members. */
+  memset(msg, 0, l->size);
+
+  /* Initialize internal members. */
+  in = upb_msg_getinternal(msg);
+  in->unknown = NULL;
+  in->unknown_len = 0;
+  in->unknown_size = 0;
+
+  if (l->extendable) {
+    upb_msg_getinternalwithext(msg, l)->extdict = NULL;
+  }
+
+  return msg;
+}
+
+upb_array *upb_array_new(upb_arena *a) {
+  upb_array *ret = upb_arena_malloc(a, sizeof(upb_array));
+
+  if (!ret) {
+    return NULL;
+  }
+
+  ret->data = NULL;
+  ret->len = 0;
+  ret->size = 0;
+
+  return ret;
+}
+
+void upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
+                        upb_arena *arena) {
+  upb_msg_internal *in = upb_msg_getinternal(msg);
+  if (len > in->unknown_size - in->unknown_len) {
+    upb_alloc *alloc = upb_arena_alloc(arena);
+    size_t need = in->unknown_size + len;
+    size_t newsize = UPB_MAX(in->unknown_size * 2, need);
+    in->unknown = upb_realloc(alloc, in->unknown, in->unknown_size, newsize);
+    in->unknown_size = newsize;
+  }
+  memcpy(in->unknown + in->unknown_len, data, len);
+  in->unknown_len += len;
+}
+
+const char *upb_msg_getunknown(const upb_msg *msg, size_t *len) {
+  const upb_msg_internal* in = upb_msg_getinternal_const(msg);
+  *len = in->unknown_len;
+  return in->unknown;
+}
+
+#undef VOIDPTR_AT
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msg.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msg.h
new file mode 100644 (file)
index 0000000..4bec023
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+** Data structures for message tables, used for parsing and serialization.
+** This are much lighter-weight than full reflection, but they are do not
+** have enough information to convert to text format, JSON, etc.
+**
+** The definitions in this file are internal to upb.
+**/
+
+#ifndef UPB_MSG_H_
+#define UPB_MSG_H_
+
+#include <stdint.h>
+#include <string.h>
+#include "upb/upb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void upb_msg;
+
+/** upb_msglayout *************************************************************/
+
+/* upb_msglayout represents the memory layout of a given upb_msgdef.  The
+ * members are public so generated code can initialize them, but users MUST NOT
+ * read or write any of its members. */
+
+typedef struct {
+  uint32_t number;
+  uint16_t offset;
+  int16_t presence;      /* If >0, hasbit_index+1.  If <0, oneof_index+1. */
+  uint16_t submsg_index;  /* undefined if descriptortype != MESSAGE or GROUP. */
+  uint8_t descriptortype;
+  uint8_t label;
+} upb_msglayout_field;
+
+typedef struct upb_msglayout {
+  const struct upb_msglayout *const* submsgs;
+  const upb_msglayout_field *fields;
+  /* Must be aligned to sizeof(void*).  Doesn't include internal members like
+   * unknown fields, extension dict, pointer to msglayout, etc. */
+  uint16_t size;
+  uint16_t field_count;
+  bool extendable;
+} upb_msglayout;
+
+/** Message internal representation *******************************************/
+
+/* Our internal representation for repeated fields. */
+typedef struct {
+  void *data;   /* Each element is element_size. */
+  size_t len;   /* Measured in elements. */
+  size_t size;  /* Measured in elements. */
+} upb_array;
+
+upb_msg *upb_msg_new(const upb_msglayout *l, upb_arena *a);
+upb_msg *upb_msg_new(const upb_msglayout *l, upb_arena *a);
+
+void upb_msg_addunknown(upb_msg *msg, const char *data, size_t len,
+                        upb_arena *arena);
+const char *upb_msg_getunknown(const upb_msg *msg, size_t *len);
+
+upb_array *upb_array_new(upb_arena *a);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* UPB_MSG_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msgfactory.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msgfactory.c
new file mode 100644 (file)
index 0000000..4ecf272
--- /dev/null
@@ -0,0 +1,248 @@
+
+#include "upb/msgfactory.h"
+
+#include "upb/port_def.inc"
+
+static bool is_power_of_two(size_t val) {
+  return (val & (val - 1)) == 0;
+}
+
+/* Align up to the given power of 2. */
+static size_t align_up(size_t val, size_t align) {
+  UPB_ASSERT(is_power_of_two(align));
+  return (val + align - 1) & ~(align - 1);
+}
+
+static size_t div_round_up(size_t n, size_t d) {
+  return (n + d - 1) / d;
+}
+
+static size_t upb_msgval_sizeof2(upb_fieldtype_t type) {
+  switch (type) {
+    case UPB_TYPE_DOUBLE:
+    case UPB_TYPE_INT64:
+    case UPB_TYPE_UINT64:
+      return 8;
+    case UPB_TYPE_ENUM:
+    case UPB_TYPE_INT32:
+    case UPB_TYPE_UINT32:
+    case UPB_TYPE_FLOAT:
+      return 4;
+    case UPB_TYPE_BOOL:
+      return 1;
+    case UPB_TYPE_MESSAGE:
+      return sizeof(void*);
+    case UPB_TYPE_BYTES:
+    case UPB_TYPE_STRING:
+      return sizeof(upb_strview);
+  }
+  UPB_UNREACHABLE();
+}
+
+static uint8_t upb_msg_fielddefsize(const upb_fielddef *f) {
+  if (upb_fielddef_isseq(f)) {
+    return sizeof(void*);
+  } else {
+    return upb_msgval_sizeof2(upb_fielddef_type(f));
+  }
+}
+
+
+/** upb_msglayout *************************************************************/
+
+static void upb_msglayout_free(upb_msglayout *l) {
+  upb_gfree(l);
+}
+
+static size_t upb_msglayout_place(upb_msglayout *l, size_t size) {
+  size_t ret;
+
+  l->size = align_up(l->size, size);
+  ret = l->size;
+  l->size += size;
+  return ret;
+}
+
+static bool upb_msglayout_init(const upb_msgdef *m,
+                               upb_msglayout *l,
+                               upb_msgfactory *factory) {
+  upb_msg_field_iter it;
+  upb_msg_oneof_iter oit;
+  size_t hasbit;
+  size_t submsg_count = 0;
+  const upb_msglayout **submsgs;
+  upb_msglayout_field *fields;
+
+  for (upb_msg_field_begin(&it, m);
+       !upb_msg_field_done(&it);
+       upb_msg_field_next(&it)) {
+    const upb_fielddef* f = upb_msg_iter_field(&it);
+    if (upb_fielddef_issubmsg(f)) {
+      submsg_count++;
+    }
+  }
+
+  memset(l, 0, sizeof(*l));
+
+  fields = upb_gmalloc(upb_msgdef_numfields(m) * sizeof(*fields));
+  submsgs = upb_gmalloc(submsg_count * sizeof(*submsgs));
+
+  if ((!fields && upb_msgdef_numfields(m)) ||
+      (!submsgs && submsg_count)) {
+    /* OOM. */
+    upb_gfree(fields);
+    upb_gfree(submsgs);
+    return false;
+  }
+
+  l->field_count = upb_msgdef_numfields(m);
+  l->fields = fields;
+  l->submsgs = submsgs;
+
+  /* Allocate data offsets in three stages:
+   *
+   * 1. hasbits.
+   * 2. regular fields.
+   * 3. oneof fields.
+   *
+   * OPT: There is a lot of room for optimization here to minimize the size.
+   */
+
+  /* Allocate hasbits and set basic field attributes. */
+  submsg_count = 0;
+  for (upb_msg_field_begin(&it, m), hasbit = 0;
+       !upb_msg_field_done(&it);
+       upb_msg_field_next(&it)) {
+    const upb_fielddef* f = upb_msg_iter_field(&it);
+    upb_msglayout_field *field = &fields[upb_fielddef_index(f)];
+
+    field->number = upb_fielddef_number(f);
+    field->descriptortype = upb_fielddef_descriptortype(f);
+    field->label = upb_fielddef_label(f);
+
+    if (upb_fielddef_issubmsg(f)) {
+      const upb_msglayout *sub_layout =
+          upb_msgfactory_getlayout(factory, upb_fielddef_msgsubdef(f));
+      field->submsg_index = submsg_count++;
+      submsgs[field->submsg_index] = sub_layout;
+    }
+
+    if (upb_fielddef_haspresence(f) && !upb_fielddef_containingoneof(f)) {
+      field->presence = (hasbit++);
+    } else {
+      field->presence = 0;
+    }
+  }
+
+  /* Account for space used by hasbits. */
+  l->size = div_round_up(hasbit, 8);
+
+  /* Allocate non-oneof fields. */
+  for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
+       upb_msg_field_next(&it)) {
+    const upb_fielddef* f = upb_msg_iter_field(&it);
+    size_t field_size = upb_msg_fielddefsize(f);
+    size_t index = upb_fielddef_index(f);
+
+    if (upb_fielddef_containingoneof(f)) {
+      /* Oneofs are handled separately below. */
+      continue;
+    }
+
+    fields[index].offset = upb_msglayout_place(l, field_size);
+  }
+
+  /* Allocate oneof fields.  Each oneof field consists of a uint32 for the case
+   * and space for the actual data. */
+  for (upb_msg_oneof_begin(&oit, m); !upb_msg_oneof_done(&oit);
+       upb_msg_oneof_next(&oit)) {
+    const upb_oneofdef* o = upb_msg_iter_oneof(&oit);
+    upb_oneof_iter fit;
+
+    size_t case_size = sizeof(uint32_t);  /* Could potentially optimize this. */
+    size_t field_size = 0;
+    uint32_t case_offset;
+    uint32_t data_offset;
+
+    /* Calculate field size: the max of all field sizes. */
+    for (upb_oneof_begin(&fit, o);
+         !upb_oneof_done(&fit);
+         upb_oneof_next(&fit)) {
+      const upb_fielddef* f = upb_oneof_iter_field(&fit);
+      field_size = UPB_MAX(field_size, upb_msg_fielddefsize(f));
+    }
+
+    /* Align and allocate case offset. */
+    case_offset = upb_msglayout_place(l, case_size);
+    data_offset = upb_msglayout_place(l, field_size);
+
+    for (upb_oneof_begin(&fit, o);
+         !upb_oneof_done(&fit);
+         upb_oneof_next(&fit)) {
+      const upb_fielddef* f = upb_oneof_iter_field(&fit);
+      fields[upb_fielddef_index(f)].offset = data_offset;
+      fields[upb_fielddef_index(f)].presence = ~case_offset;
+    }
+  }
+
+  /* Size of the entire structure should be a multiple of its greatest
+   * alignment.  TODO: track overall alignment for real? */
+  l->size = align_up(l->size, 8);
+
+  return true;
+}
+
+
+/** upb_msgfactory ************************************************************/
+
+struct upb_msgfactory {
+  const upb_symtab *symtab;  /* We own a ref. */
+  upb_inttable layouts;
+};
+
+upb_msgfactory *upb_msgfactory_new(const upb_symtab *symtab) {
+  upb_msgfactory *ret = upb_gmalloc(sizeof(*ret));
+
+  ret->symtab = symtab;
+  upb_inttable_init(&ret->layouts, UPB_CTYPE_PTR);
+
+  return ret;
+}
+
+void upb_msgfactory_free(upb_msgfactory *f) {
+  upb_inttable_iter i;
+  upb_inttable_begin(&i, &f->layouts);
+  for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+    upb_msglayout *l = upb_value_getptr(upb_inttable_iter_value(&i));
+    upb_msglayout_free(l);
+  }
+
+  upb_inttable_uninit(&f->layouts);
+  upb_gfree(f);
+}
+
+const upb_symtab *upb_msgfactory_symtab(const upb_msgfactory *f) {
+  return f->symtab;
+}
+
+const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
+                                              const upb_msgdef *m) {
+  upb_value v;
+  UPB_ASSERT(upb_symtab_lookupmsg(f->symtab, upb_msgdef_fullname(m)) == m);
+  UPB_ASSERT(!upb_msgdef_mapentry(m));
+
+  if (upb_inttable_lookupptr(&f->layouts, m, &v)) {
+    UPB_ASSERT(upb_value_getptr(v));
+    return upb_value_getptr(v);
+  } else {
+    /* In case of circular dependency, layout has to be inserted first. */
+    upb_msglayout *l = upb_gmalloc(sizeof(*l));
+    upb_msgfactory *mutable_f = (void*)f;
+    upb_inttable_insertptr(&mutable_f->layouts, m, upb_value_ptr(l));
+    UPB_ASSERT(l);
+    if (!upb_msglayout_init(m, l, f)) {
+      upb_msglayout_free(l);
+    }
+    return l;
+  }
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msgfactory.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/msgfactory.h
new file mode 100644 (file)
index 0000000..9b3b599
--- /dev/null
@@ -0,0 +1,48 @@
+
+#include "upb/def.h"
+#include "upb/msg.h"
+
+#ifndef UPB_MSGFACTORY_H_
+#define UPB_MSGFACTORY_H_
+
+/** upb_msgfactory ************************************************************/
+
+struct upb_msgfactory;
+typedef struct upb_msgfactory upb_msgfactory;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A upb_msgfactory contains a cache of upb_msglayout, upb_handlers, and
+ * upb_visitorplan objects.  These are the objects necessary to represent,
+ * populate, and and visit upb_msg objects.
+ *
+ * These caches are all populated by upb_msgdef, and lazily created on demand.
+ */
+
+/* Creates and destroys a msgfactory, respectively.  The messages for this
+ * msgfactory must come from |symtab| (which should outlive the msgfactory). */
+upb_msgfactory *upb_msgfactory_new(const upb_symtab *symtab);
+void upb_msgfactory_free(upb_msgfactory *f);
+
+const upb_symtab *upb_msgfactory_symtab(const upb_msgfactory *f);
+
+/* The functions to get cached objects, lazily creating them on demand.  These
+ * all require:
+ *
+ * - m is in upb_msgfactory_symtab(f)
+ * - upb_msgdef_mapentry(m) == false (since map messages can't have layouts).
+ *
+ * The returned objects will live for as long as the msgfactory does.
+ *
+ * TODO(haberman): consider making this thread-safe and take a const
+ * upb_msgfactory. */
+const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f,
+                                              const upb_msgdef *m);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* UPB_MSGFACTORY_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/compile_decoder.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/compile_decoder.c
new file mode 100644 (file)
index 0000000..63d7fe2
--- /dev/null
@@ -0,0 +1,929 @@
+/*
+** protobuf decoder bytecode compiler
+**
+** Code to compile a upb::Handlers into bytecode for decoding a protobuf
+** according to that specific schema and destination handlers.
+**
+** Bytecode definition is in decoder.int.h.
+*/
+
+#include <stdarg.h>
+#include "upb/pb/decoder.int.h"
+#include "upb/pb/varint.int.h"
+
+#ifdef UPB_DUMP_BYTECODE
+#include <stdio.h>
+#endif
+
+#include "upb/port_def.inc"
+
+#define MAXLABEL 5
+#define EMPTYLABEL -1
+
+/* upb_pbdecodermethod ********************************************************/
+
+static void freemethod(upb_pbdecodermethod *method) {
+  upb_inttable_uninit(&method->dispatch);
+  upb_gfree(method);
+}
+
+static upb_pbdecodermethod *newmethod(const upb_handlers *dest_handlers,
+                                      mgroup *group) {
+  upb_pbdecodermethod *ret = upb_gmalloc(sizeof(*ret));
+  upb_byteshandler_init(&ret->input_handler_);
+
+  ret->group = group;
+  ret->dest_handlers_ = dest_handlers;
+  upb_inttable_init(&ret->dispatch, UPB_CTYPE_UINT64);
+
+  return ret;
+}
+
+const upb_handlers *upb_pbdecodermethod_desthandlers(
+    const upb_pbdecodermethod *m) {
+  return m->dest_handlers_;
+}
+
+const upb_byteshandler *upb_pbdecodermethod_inputhandler(
+    const upb_pbdecodermethod *m) {
+  return &m->input_handler_;
+}
+
+bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m) {
+  return m->is_native_;
+}
+
+
+/* mgroup *********************************************************************/
+
+static void freegroup(mgroup *g) {
+  upb_inttable_iter i;
+
+  upb_inttable_begin(&i, &g->methods);
+  for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+    freemethod(upb_value_getptr(upb_inttable_iter_value(&i)));
+  }
+
+  upb_inttable_uninit(&g->methods);
+  upb_gfree(g->bytecode);
+  upb_gfree(g);
+}
+
+mgroup *newgroup(void) {
+  mgroup *g = upb_gmalloc(sizeof(*g));
+  upb_inttable_init(&g->methods, UPB_CTYPE_PTR);
+  g->bytecode = NULL;
+  g->bytecode_end = NULL;
+  return g;
+}
+
+
+/* bytecode compiler **********************************************************/
+
+/* Data used only at compilation time. */
+typedef struct {
+  mgroup *group;
+
+  uint32_t *pc;
+  int fwd_labels[MAXLABEL];
+  int back_labels[MAXLABEL];
+
+  /* For fields marked "lazy", parse them lazily or eagerly? */
+  bool lazy;
+} compiler;
+
+static compiler *newcompiler(mgroup *group, bool lazy) {
+  compiler *ret = upb_gmalloc(sizeof(*ret));
+  int i;
+
+  ret->group = group;
+  ret->lazy = lazy;
+  for (i = 0; i < MAXLABEL; i++) {
+    ret->fwd_labels[i] = EMPTYLABEL;
+    ret->back_labels[i] = EMPTYLABEL;
+  }
+  return ret;
+}
+
+static void freecompiler(compiler *c) {
+  upb_gfree(c);
+}
+
+const size_t ptr_words = sizeof(void*) / sizeof(uint32_t);
+
+/* How many words an instruction is. */
+static int instruction_len(uint32_t instr) {
+  switch (getop(instr)) {
+    case OP_SETDISPATCH: return 1 + ptr_words;
+    case OP_TAGN: return 3;
+    case OP_SETBIGGROUPNUM: return 2;
+    default: return 1;
+  }
+}
+
+bool op_has_longofs(int32_t instruction) {
+  switch (getop(instruction)) {
+    case OP_CALL:
+    case OP_BRANCH:
+    case OP_CHECKDELIM:
+      return true;
+    /* The "tag" instructions only have 8 bytes available for the jump target,
+     * but that is ok because these opcodes only require short jumps. */
+    case OP_TAG1:
+    case OP_TAG2:
+    case OP_TAGN:
+      return false;
+    default:
+      UPB_ASSERT(false);
+      return false;
+  }
+}
+
+static int32_t getofs(uint32_t instruction) {
+  if (op_has_longofs(instruction)) {
+    return (int32_t)instruction >> 8;
+  } else {
+    return (int8_t)(instruction >> 8);
+  }
+}
+
+static void setofs(uint32_t *instruction, int32_t ofs) {
+  if (op_has_longofs(*instruction)) {
+    *instruction = getop(*instruction) | (uint32_t)ofs << 8;
+  } else {
+    *instruction = (*instruction & ~0xff00) | ((ofs & 0xff) << 8);
+  }
+  UPB_ASSERT(getofs(*instruction) == ofs);  /* Would fail in cases of overflow. */
+}
+
+static uint32_t pcofs(compiler *c) { return c->pc - c->group->bytecode; }
+
+/* Defines a local label at the current PC location.  All previous forward
+ * references are updated to point to this location.  The location is noted
+ * for any future backward references. */
+static void label(compiler *c, unsigned int label) {
+  int val;
+  uint32_t *codep;
+
+  UPB_ASSERT(label < MAXLABEL);
+  val = c->fwd_labels[label];
+  codep = (val == EMPTYLABEL) ? NULL : c->group->bytecode + val;
+  while (codep) {
+    int ofs = getofs(*codep);
+    setofs(codep, c->pc - codep - instruction_len(*codep));
+    codep = ofs ? codep + ofs : NULL;
+  }
+  c->fwd_labels[label] = EMPTYLABEL;
+  c->back_labels[label] = pcofs(c);
+}
+
+/* Creates a reference to a numbered label; either a forward reference
+ * (positive arg) or backward reference (negative arg).  For forward references
+ * the value returned now is actually a "next" pointer into a linked list of all
+ * instructions that use this label and will be patched later when the label is
+ * defined with label().
+ *
+ * The returned value is the offset that should be written into the instruction.
+ */
+static int32_t labelref(compiler *c, int label) {
+  UPB_ASSERT(label < MAXLABEL);
+  if (label == LABEL_DISPATCH) {
+    /* No resolving required. */
+    return 0;
+  } else if (label < 0) {
+    /* Backward local label.  Relative to the next instruction. */
+    uint32_t from = (c->pc + 1) - c->group->bytecode;
+    return c->back_labels[-label] - from;
+  } else {
+    /* Forward local label: prepend to (possibly-empty) linked list. */
+    int *lptr = &c->fwd_labels[label];
+    int32_t ret = (*lptr == EMPTYLABEL) ? 0 : *lptr - pcofs(c);
+    *lptr = pcofs(c);
+    return ret;
+  }
+}
+
+static void put32(compiler *c, uint32_t v) {
+  mgroup *g = c->group;
+  if (c->pc == g->bytecode_end) {
+    int ofs = pcofs(c);
+    size_t oldsize = g->bytecode_end - g->bytecode;
+    size_t newsize = UPB_MAX(oldsize * 2, 64);
+    /* TODO(haberman): handle OOM. */
+    g->bytecode = upb_grealloc(g->bytecode, oldsize * sizeof(uint32_t),
+                                            newsize * sizeof(uint32_t));
+    g->bytecode_end = g->bytecode + newsize;
+    c->pc = g->bytecode + ofs;
+  }
+  *c->pc++ = v;
+}
+
+static void putop(compiler *c, int op, ...) {
+  va_list ap;
+  va_start(ap, op);
+
+  switch (op) {
+    case OP_SETDISPATCH: {
+      uintptr_t ptr = (uintptr_t)va_arg(ap, void*);
+      put32(c, OP_SETDISPATCH);
+      put32(c, ptr);
+      if (sizeof(uintptr_t) > sizeof(uint32_t))
+        put32(c, (uint64_t)ptr >> 32);
+      break;
+    }
+    case OP_STARTMSG:
+    case OP_ENDMSG:
+    case OP_PUSHLENDELIM:
+    case OP_POP:
+    case OP_SETDELIM:
+    case OP_HALT:
+    case OP_RET:
+    case OP_DISPATCH:
+      put32(c, op);
+      break;
+    case OP_PARSE_DOUBLE:
+    case OP_PARSE_FLOAT:
+    case OP_PARSE_INT64:
+    case OP_PARSE_UINT64:
+    case OP_PARSE_INT32:
+    case OP_PARSE_FIXED64:
+    case OP_PARSE_FIXED32:
+    case OP_PARSE_BOOL:
+    case OP_PARSE_UINT32:
+    case OP_PARSE_SFIXED32:
+    case OP_PARSE_SFIXED64:
+    case OP_PARSE_SINT32:
+    case OP_PARSE_SINT64:
+    case OP_STARTSEQ:
+    case OP_ENDSEQ:
+    case OP_STARTSUBMSG:
+    case OP_ENDSUBMSG:
+    case OP_STARTSTR:
+    case OP_STRING:
+    case OP_ENDSTR:
+    case OP_PUSHTAGDELIM:
+      put32(c, op | va_arg(ap, upb_selector_t) << 8);
+      break;
+    case OP_SETBIGGROUPNUM:
+      put32(c, op);
+      put32(c, va_arg(ap, int));
+      break;
+    case OP_CALL: {
+      const upb_pbdecodermethod *method = va_arg(ap, upb_pbdecodermethod *);
+      put32(c, op | (method->code_base.ofs - (pcofs(c) + 1)) << 8);
+      break;
+    }
+    case OP_CHECKDELIM:
+    case OP_BRANCH: {
+      uint32_t instruction = op;
+      int label = va_arg(ap, int);
+      setofs(&instruction, labelref(c, label));
+      put32(c, instruction);
+      break;
+    }
+    case OP_TAG1:
+    case OP_TAG2: {
+      int label = va_arg(ap, int);
+      uint64_t tag = va_arg(ap, uint64_t);
+      uint32_t instruction = op | (tag << 16);
+      UPB_ASSERT(tag <= 0xffff);
+      setofs(&instruction, labelref(c, label));
+      put32(c, instruction);
+      break;
+    }
+    case OP_TAGN: {
+      int label = va_arg(ap, int);
+      uint64_t tag = va_arg(ap, uint64_t);
+      uint32_t instruction = op | (upb_value_size(tag) << 16);
+      setofs(&instruction, labelref(c, label));
+      put32(c, instruction);
+      put32(c, tag);
+      put32(c, tag >> 32);
+      break;
+    }
+  }
+
+  va_end(ap);
+}
+
+#if defined(UPB_DUMP_BYTECODE)
+
+const char *upb_pbdecoder_getopname(unsigned int op) {
+#define QUOTE(x) #x
+#define EXPAND_AND_QUOTE(x) QUOTE(x)
+#define OPNAME(x) OP_##x
+#define OP(x) case OPNAME(x): return EXPAND_AND_QUOTE(OPNAME(x));
+#define T(x) OP(PARSE_##x)
+  /* Keep in sync with list in decoder.int.h. */
+  switch ((opcode)op) {
+    T(DOUBLE) T(FLOAT) T(INT64) T(UINT64) T(INT32) T(FIXED64) T(FIXED32)
+    T(BOOL) T(UINT32) T(SFIXED32) T(SFIXED64) T(SINT32) T(SINT64)
+    OP(STARTMSG) OP(ENDMSG) OP(STARTSEQ) OP(ENDSEQ) OP(STARTSUBMSG)
+    OP(ENDSUBMSG) OP(STARTSTR) OP(STRING) OP(ENDSTR) OP(CALL) OP(RET)
+    OP(PUSHLENDELIM) OP(PUSHTAGDELIM) OP(SETDELIM) OP(CHECKDELIM)
+    OP(BRANCH) OP(TAG1) OP(TAG2) OP(TAGN) OP(SETDISPATCH) OP(POP)
+    OP(SETBIGGROUPNUM) OP(DISPATCH) OP(HALT)
+  }
+  return "<unknown op>";
+#undef OP
+#undef T
+}
+
+#endif
+
+#ifdef UPB_DUMP_BYTECODE
+
+static void dumpbc(uint32_t *p, uint32_t *end, FILE *f) {
+
+  uint32_t *begin = p;
+
+  while (p < end) {
+    fprintf(f, "%p  %8tx", p, p - begin);
+    uint32_t instr = *p++;
+    uint8_t op = getop(instr);
+    fprintf(f, " %s", upb_pbdecoder_getopname(op));
+    switch ((opcode)op) {
+      case OP_SETDISPATCH: {
+        const upb_inttable *dispatch;
+        memcpy(&dispatch, p, sizeof(void*));
+        p += ptr_words;
+        const upb_pbdecodermethod *method =
+            (void *)((char *)dispatch -
+                     offsetof(upb_pbdecodermethod, dispatch));
+        fprintf(f, " %s", upb_msgdef_fullname(
+                              upb_handlers_msgdef(method->dest_handlers_)));
+        break;
+      }
+      case OP_DISPATCH:
+      case OP_STARTMSG:
+      case OP_ENDMSG:
+      case OP_PUSHLENDELIM:
+      case OP_POP:
+      case OP_SETDELIM:
+      case OP_HALT:
+      case OP_RET:
+        break;
+      case OP_PARSE_DOUBLE:
+      case OP_PARSE_FLOAT:
+      case OP_PARSE_INT64:
+      case OP_PARSE_UINT64:
+      case OP_PARSE_INT32:
+      case OP_PARSE_FIXED64:
+      case OP_PARSE_FIXED32:
+      case OP_PARSE_BOOL:
+      case OP_PARSE_UINT32:
+      case OP_PARSE_SFIXED32:
+      case OP_PARSE_SFIXED64:
+      case OP_PARSE_SINT32:
+      case OP_PARSE_SINT64:
+      case OP_STARTSEQ:
+      case OP_ENDSEQ:
+      case OP_STARTSUBMSG:
+      case OP_ENDSUBMSG:
+      case OP_STARTSTR:
+      case OP_STRING:
+      case OP_ENDSTR:
+      case OP_PUSHTAGDELIM:
+        fprintf(f, " %d", instr >> 8);
+        break;
+      case OP_SETBIGGROUPNUM:
+        fprintf(f, " %d", *p++);
+        break;
+      case OP_CHECKDELIM:
+      case OP_CALL:
+      case OP_BRANCH:
+        fprintf(f, " =>0x%tx", p + getofs(instr) - begin);
+        break;
+      case OP_TAG1:
+      case OP_TAG2: {
+        fprintf(f, " tag:0x%x", instr >> 16);
+        if (getofs(instr)) {
+          fprintf(f, " =>0x%tx", p + getofs(instr) - begin);
+        }
+        break;
+      }
+      case OP_TAGN: {
+        uint64_t tag = *p++;
+        tag |= (uint64_t)*p++ << 32;
+        fprintf(f, " tag:0x%llx", (long long)tag);
+        fprintf(f, " n:%d", instr >> 16);
+        if (getofs(instr)) {
+          fprintf(f, " =>0x%tx", p + getofs(instr) - begin);
+        }
+        break;
+      }
+    }
+    fputs("\n", f);
+  }
+}
+
+#endif
+
+static uint64_t get_encoded_tag(const upb_fielddef *f, int wire_type) {
+  uint32_t tag = (upb_fielddef_number(f) << 3) | wire_type;
+  uint64_t encoded_tag = upb_vencode32(tag);
+  /* No tag should be greater than 5 bytes. */
+  UPB_ASSERT(encoded_tag <= 0xffffffffff);
+  return encoded_tag;
+}
+
+static void putchecktag(compiler *c, const upb_fielddef *f,
+                        int wire_type, int dest) {
+  uint64_t tag = get_encoded_tag(f, wire_type);
+  switch (upb_value_size(tag)) {
+    case 1:
+      putop(c, OP_TAG1, dest, tag);
+      break;
+    case 2:
+      putop(c, OP_TAG2, dest, tag);
+      break;
+    default:
+      putop(c, OP_TAGN, dest, tag);
+      break;
+  }
+}
+
+static upb_selector_t getsel(const upb_fielddef *f, upb_handlertype_t type) {
+  upb_selector_t selector;
+  bool ok = upb_handlers_getselector(f, type, &selector);
+  UPB_ASSERT(ok);
+  return selector;
+}
+
+/* Takes an existing, primary dispatch table entry and repacks it with a
+ * different alternate wire type.  Called when we are inserting a secondary
+ * dispatch table entry for an alternate wire type. */
+static uint64_t repack(uint64_t dispatch, int new_wt2) {
+  uint64_t ofs;
+  uint8_t wt1;
+  uint8_t old_wt2;
+  upb_pbdecoder_unpackdispatch(dispatch, &ofs, &wt1, &old_wt2);
+  UPB_ASSERT(old_wt2 == NO_WIRE_TYPE);  /* wt2 should not be set yet. */
+  return upb_pbdecoder_packdispatch(ofs, wt1, new_wt2);
+}
+
+/* Marks the current bytecode position as the dispatch target for this message,
+ * field, and wire type. */
+static void dispatchtarget(compiler *c, upb_pbdecodermethod *method,
+                           const upb_fielddef *f, int wire_type) {
+  /* Offset is relative to msg base. */
+  uint64_t ofs = pcofs(c) - method->code_base.ofs;
+  uint32_t fn = upb_fielddef_number(f);
+  upb_inttable *d = &method->dispatch;
+  upb_value v;
+  if (upb_inttable_remove(d, fn, &v)) {
+    /* TODO: prioritize based on packed setting in .proto file. */
+    uint64_t repacked = repack(upb_value_getuint64(v), wire_type);
+    upb_inttable_insert(d, fn, upb_value_uint64(repacked));
+    upb_inttable_insert(d, fn + UPB_MAX_FIELDNUMBER, upb_value_uint64(ofs));
+  } else {
+    uint64_t val = upb_pbdecoder_packdispatch(ofs, wire_type, NO_WIRE_TYPE);
+    upb_inttable_insert(d, fn, upb_value_uint64(val));
+  }
+}
+
+static void putpush(compiler *c, const upb_fielddef *f) {
+  if (upb_fielddef_descriptortype(f) == UPB_DESCRIPTOR_TYPE_MESSAGE) {
+    putop(c, OP_PUSHLENDELIM);
+  } else {
+    uint32_t fn = upb_fielddef_number(f);
+    if (fn >= 1 << 24) {
+      putop(c, OP_PUSHTAGDELIM, 0);
+      putop(c, OP_SETBIGGROUPNUM, fn);
+    } else {
+      putop(c, OP_PUSHTAGDELIM, fn);
+    }
+  }
+}
+
+static upb_pbdecodermethod *find_submethod(const compiler *c,
+                                           const upb_pbdecodermethod *method,
+                                           const upb_fielddef *f) {
+  const upb_handlers *sub =
+      upb_handlers_getsubhandlers(method->dest_handlers_, f);
+  upb_value v;
+  return upb_inttable_lookupptr(&c->group->methods, sub, &v)
+             ? upb_value_getptr(v)
+             : NULL;
+}
+
+static void putsel(compiler *c, opcode op, upb_selector_t sel,
+                   const upb_handlers *h) {
+  if (upb_handlers_gethandler(h, sel, NULL)) {
+    putop(c, op, sel);
+  }
+}
+
+/* Puts an opcode to call a callback, but only if a callback actually exists for
+ * this field and handler type. */
+static void maybeput(compiler *c, opcode op, const upb_handlers *h,
+                     const upb_fielddef *f, upb_handlertype_t type) {
+  putsel(c, op, getsel(f, type), h);
+}
+
+static bool haslazyhandlers(const upb_handlers *h, const upb_fielddef *f) {
+  if (!upb_fielddef_lazy(f))
+    return false;
+
+  return upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_STARTSTR), NULL) ||
+         upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_STRING), NULL) ||
+         upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_ENDSTR), NULL);
+}
+
+
+/* bytecode compiler code generation ******************************************/
+
+/* Symbolic names for our local labels. */
+#define LABEL_LOOPSTART 1  /* Top of a repeated field loop. */
+#define LABEL_LOOPBREAK 2  /* To jump out of a repeated loop */
+#define LABEL_FIELD     3  /* Jump backward to find the most recent field. */
+#define LABEL_ENDMSG    4  /* To reach the OP_ENDMSG instr for this msg. */
+
+/* Generates bytecode to parse a single non-lazy message field. */
+static void generate_msgfield(compiler *c, const upb_fielddef *f,
+                              upb_pbdecodermethod *method) {
+  const upb_handlers *h = upb_pbdecodermethod_desthandlers(method);
+  const upb_pbdecodermethod *sub_m = find_submethod(c, method, f);
+  int wire_type;
+
+  if (!sub_m) {
+    /* Don't emit any code for this field at all; it will be parsed as an
+     * unknown field.
+     *
+     * TODO(haberman): we should change this to parse it as a string field
+     * instead.  It will probably be faster, but more importantly, once we
+     * start vending unknown fields, a field shouldn't be treated as unknown
+     * just because it doesn't have subhandlers registered. */
+    return;
+  }
+
+  label(c, LABEL_FIELD);
+
+  wire_type =
+      (upb_fielddef_descriptortype(f) == UPB_DESCRIPTOR_TYPE_MESSAGE)
+          ? UPB_WIRE_TYPE_DELIMITED
+          : UPB_WIRE_TYPE_START_GROUP;
+
+  if (upb_fielddef_isseq(f)) {
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    putchecktag(c, f, wire_type, LABEL_DISPATCH);
+   dispatchtarget(c, method, f, wire_type);
+    putop(c, OP_PUSHTAGDELIM, 0);
+    putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));
+   label(c, LABEL_LOOPSTART);
+    putpush(c, f);
+    putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG));
+    putop(c, OP_CALL, sub_m);
+    putop(c, OP_POP);
+    maybeput(c, OP_ENDSUBMSG, h, f, UPB_HANDLER_ENDSUBMSG);
+    if (wire_type == UPB_WIRE_TYPE_DELIMITED) {
+      putop(c, OP_SETDELIM);
+    }
+    putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+    putchecktag(c, f, wire_type, LABEL_LOOPBREAK);
+    putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+   label(c, LABEL_LOOPBREAK);
+    putop(c, OP_POP);
+    maybeput(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ);
+  } else {
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    putchecktag(c, f, wire_type, LABEL_DISPATCH);
+   dispatchtarget(c, method, f, wire_type);
+    putpush(c, f);
+    putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG));
+    putop(c, OP_CALL, sub_m);
+    putop(c, OP_POP);
+    maybeput(c, OP_ENDSUBMSG, h, f, UPB_HANDLER_ENDSUBMSG);
+    if (wire_type == UPB_WIRE_TYPE_DELIMITED) {
+      putop(c, OP_SETDELIM);
+    }
+  }
+}
+
+/* Generates bytecode to parse a single string or lazy submessage field. */
+static void generate_delimfield(compiler *c, const upb_fielddef *f,
+                                upb_pbdecodermethod *method) {
+  const upb_handlers *h = upb_pbdecodermethod_desthandlers(method);
+
+  label(c, LABEL_FIELD);
+  if (upb_fielddef_isseq(f)) {
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
+   dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
+    putop(c, OP_PUSHTAGDELIM, 0);
+    putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));
+   label(c, LABEL_LOOPSTART);
+    putop(c, OP_PUSHLENDELIM);
+    putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR));
+    /* Need to emit even if no handler to skip past the string. */
+    putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING));
+    maybeput(c, OP_ENDSTR, h, f, UPB_HANDLER_ENDSTR);
+    putop(c, OP_POP);
+    putop(c, OP_SETDELIM);
+    putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+    putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_LOOPBREAK);
+    putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+   label(c, LABEL_LOOPBREAK);
+    putop(c, OP_POP);
+    maybeput(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ);
+  } else {
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
+   dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
+    putop(c, OP_PUSHLENDELIM);
+    putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR));
+    putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING));
+    maybeput(c, OP_ENDSTR, h, f, UPB_HANDLER_ENDSTR);
+    putop(c, OP_POP);
+    putop(c, OP_SETDELIM);
+  }
+}
+
+/* Generates bytecode to parse a single primitive field. */
+static void generate_primitivefield(compiler *c, const upb_fielddef *f,
+                                    upb_pbdecodermethod *method) {
+  const upb_handlers *h = upb_pbdecodermethod_desthandlers(method);
+  upb_descriptortype_t descriptor_type = upb_fielddef_descriptortype(f);
+  opcode parse_type;
+  upb_selector_t sel;
+  int wire_type;
+
+  label(c, LABEL_FIELD);
+
+  /* From a decoding perspective, ENUM is the same as INT32. */
+  if (descriptor_type == UPB_DESCRIPTOR_TYPE_ENUM)
+    descriptor_type = UPB_DESCRIPTOR_TYPE_INT32;
+
+  parse_type = (opcode)descriptor_type;
+
+  /* TODO(haberman): generate packed or non-packed first depending on "packed"
+   * setting in the fielddef.  This will favor (in speed) whichever was
+   * specified. */
+
+  UPB_ASSERT((int)parse_type >= 0 && parse_type <= OP_MAX);
+  sel = getsel(f, upb_handlers_getprimitivehandlertype(f));
+  wire_type = upb_pb_native_wire_types[upb_fielddef_descriptortype(f)];
+  if (upb_fielddef_isseq(f)) {
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
+   dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
+    putop(c, OP_PUSHLENDELIM);
+    putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));  /* Packed */
+   label(c, LABEL_LOOPSTART);
+    putop(c, parse_type, sel);
+    putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+    putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+   dispatchtarget(c, method, f, wire_type);
+    putop(c, OP_PUSHTAGDELIM, 0);
+    putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));  /* Non-packed */
+   label(c, LABEL_LOOPSTART);
+    putop(c, parse_type, sel);
+    putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+    putchecktag(c, f, wire_type, LABEL_LOOPBREAK);
+    putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+   label(c, LABEL_LOOPBREAK);
+    putop(c, OP_POP);  /* Packed and non-packed join. */
+    maybeput(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ);
+    putop(c, OP_SETDELIM);  /* Could remove for non-packed by dup ENDSEQ. */
+  } else {
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    putchecktag(c, f, wire_type, LABEL_DISPATCH);
+   dispatchtarget(c, method, f, wire_type);
+    putop(c, parse_type, sel);
+  }
+}
+
+/* Adds bytecode for parsing the given message to the given decoderplan,
+ * while adding all dispatch targets to this message's dispatch table. */
+static void compile_method(compiler *c, upb_pbdecodermethod *method) {
+  const upb_handlers *h;
+  const upb_msgdef *md;
+  uint32_t* start_pc;
+  upb_msg_field_iter i;
+  upb_value val;
+
+  UPB_ASSERT(method);
+
+  /* Clear all entries in the dispatch table. */
+  upb_inttable_uninit(&method->dispatch);
+  upb_inttable_init(&method->dispatch, UPB_CTYPE_UINT64);
+
+  h = upb_pbdecodermethod_desthandlers(method);
+  md = upb_handlers_msgdef(h);
+
+ method->code_base.ofs = pcofs(c);
+  putop(c, OP_SETDISPATCH, &method->dispatch);
+  putsel(c, OP_STARTMSG, UPB_STARTMSG_SELECTOR, h);
+ label(c, LABEL_FIELD);
+  start_pc = c->pc;
+  for(upb_msg_field_begin(&i, md);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    const upb_fielddef *f = upb_msg_iter_field(&i);
+    upb_fieldtype_t type = upb_fielddef_type(f);
+
+    if (type == UPB_TYPE_MESSAGE && !(haslazyhandlers(h, f) && c->lazy)) {
+      generate_msgfield(c, f, method);
+    } else if (type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES ||
+               type == UPB_TYPE_MESSAGE) {
+      generate_delimfield(c, f, method);
+    } else {
+      generate_primitivefield(c, f, method);
+    }
+  }
+
+  /* If there were no fields, or if no handlers were defined, we need to
+   * generate a non-empty loop body so that we can at least dispatch for unknown
+   * fields and check for the end of the message. */
+  if (c->pc == start_pc) {
+    /* Check for end-of-message. */
+    putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+    /* Unconditionally dispatch. */
+    putop(c, OP_DISPATCH, 0);
+  }
+
+  /* For now we just loop back to the last field of the message (or if none,
+   * the DISPATCH opcode for the message). */
+  putop(c, OP_BRANCH, -LABEL_FIELD);
+
+  /* Insert both a label and a dispatch table entry for this end-of-msg. */
+ label(c, LABEL_ENDMSG);
+  val = upb_value_uint64(pcofs(c) - method->code_base.ofs);
+  upb_inttable_insert(&method->dispatch, DISPATCH_ENDMSG, val);
+
+  putsel(c, OP_ENDMSG, UPB_ENDMSG_SELECTOR, h);
+  putop(c, OP_RET);
+
+  upb_inttable_compact(&method->dispatch);
+}
+
+/* Populate "methods" with new upb_pbdecodermethod objects reachable from "h".
+ * Returns the method for these handlers.
+ *
+ * Generates a new method for every destination handlers reachable from "h". */
+static void find_methods(compiler *c, const upb_handlers *h) {
+  upb_value v;
+  upb_msg_field_iter i;
+  const upb_msgdef *md;
+  upb_pbdecodermethod *method;
+
+  if (upb_inttable_lookupptr(&c->group->methods, h, &v))
+    return;
+
+  method = newmethod(h, c->group);
+  upb_inttable_insertptr(&c->group->methods, h, upb_value_ptr(method));
+
+  /* Find submethods. */
+  md = upb_handlers_msgdef(h);
+  for(upb_msg_field_begin(&i, md);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    const upb_fielddef *f = upb_msg_iter_field(&i);
+    const upb_handlers *sub_h;
+    if (upb_fielddef_type(f) == UPB_TYPE_MESSAGE &&
+        (sub_h = upb_handlers_getsubhandlers(h, f)) != NULL) {
+      /* We only generate a decoder method for submessages with handlers.
+       * Others will be parsed as unknown fields. */
+      find_methods(c, sub_h);
+    }
+  }
+}
+
+/* (Re-)compile bytecode for all messages in "msgs."
+ * Overwrites any existing bytecode in "c". */
+static void compile_methods(compiler *c) {
+  upb_inttable_iter i;
+
+  /* Start over at the beginning of the bytecode. */
+  c->pc = c->group->bytecode;
+
+  upb_inttable_begin(&i, &c->group->methods);
+  for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+    upb_pbdecodermethod *method = upb_value_getptr(upb_inttable_iter_value(&i));
+    compile_method(c, method);
+  }
+}
+
+static void set_bytecode_handlers(mgroup *g) {
+  upb_inttable_iter i;
+  upb_inttable_begin(&i, &g->methods);
+  for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+    upb_pbdecodermethod *m = upb_value_getptr(upb_inttable_iter_value(&i));
+    upb_byteshandler *h = &m->input_handler_;
+
+    m->code_base.ptr = g->bytecode + m->code_base.ofs;
+
+    upb_byteshandler_setstartstr(h, upb_pbdecoder_startbc, m->code_base.ptr);
+    upb_byteshandler_setstring(h, upb_pbdecoder_decode, g);
+    upb_byteshandler_setendstr(h, upb_pbdecoder_end, m);
+  }
+}
+
+
+/* TODO(haberman): allow this to be constructed for an arbitrary set of dest
+ * handlers and other mgroups (but verify we have a transitive closure). */
+const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit, bool lazy) {
+  mgroup *g;
+  compiler *c;
+
+  UPB_UNUSED(allowjit);
+
+  g = newgroup();
+  c = newcompiler(g, lazy);
+  find_methods(c, dest);
+
+  /* We compile in two passes:
+   * 1. all messages are assigned relative offsets from the beginning of the
+   *    bytecode (saved in method->code_base).
+   * 2. forwards OP_CALL instructions can be correctly linked since message
+   *    offsets have been previously assigned.
+   *
+   * Could avoid the second pass by linking OP_CALL instructions somehow. */
+  compile_methods(c);
+  compile_methods(c);
+  g->bytecode_end = c->pc;
+  freecompiler(c);
+
+#ifdef UPB_DUMP_BYTECODE
+  {
+    FILE *f = fopen("/tmp/upb-bytecode", "w");
+    UPB_ASSERT(f);
+    dumpbc(g->bytecode, g->bytecode_end, stderr);
+    dumpbc(g->bytecode, g->bytecode_end, f);
+    fclose(f);
+
+    f = fopen("/tmp/upb-bytecode.bin", "wb");
+    UPB_ASSERT(f);
+    fwrite(g->bytecode, 1, g->bytecode_end - g->bytecode, f);
+    fclose(f);
+  }
+#endif
+
+  set_bytecode_handlers(g);
+  return g;
+}
+
+
+/* upb_pbcodecache ************************************************************/
+
+upb_pbcodecache *upb_pbcodecache_new(upb_handlercache *dest) {
+  upb_pbcodecache *c = upb_gmalloc(sizeof(*c));
+
+  if (!c) return NULL;
+
+  c->dest = dest;
+  c->allow_jit = true;
+  c->lazy = false;
+
+  c->arena = upb_arena_new();
+  if (!upb_inttable_init(&c->groups, UPB_CTYPE_CONSTPTR)) return NULL;
+
+  return c;
+}
+
+void upb_pbcodecache_free(upb_pbcodecache *c) {
+  size_t i;
+
+  for (i = 0; i < upb_inttable_count(&c->groups); i++) {
+    upb_value v;
+    bool ok = upb_inttable_lookup(&c->groups, i, &v);
+    UPB_ASSERT(ok);
+    freegroup((void*)upb_value_getconstptr(v));
+  }
+
+  upb_inttable_uninit(&c->groups);
+  upb_arena_free(c->arena);
+  upb_gfree(c);
+}
+
+bool upb_pbcodecache_allowjit(const upb_pbcodecache *c) {
+  return c->allow_jit;
+}
+
+void upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow) {
+  UPB_ASSERT(upb_inttable_count(&c->groups) == 0);
+  c->allow_jit = allow;
+}
+
+void upb_pbdecodermethodopts_setlazy(upb_pbcodecache *c, bool lazy) {
+  UPB_ASSERT(upb_inttable_count(&c->groups) == 0);
+  c->lazy = lazy;
+}
+
+const upb_pbdecodermethod *upb_pbcodecache_get(upb_pbcodecache *c,
+                                               const upb_msgdef *md) {
+  upb_value v;
+  bool ok;
+  const upb_handlers *h;
+  const mgroup *g;
+
+  /* Right now we build a new DecoderMethod every time.
+   * TODO(haberman): properly cache methods by their true key. */
+  h = upb_handlercache_get(c->dest, md);
+  g = mgroup_new(h, c->allow_jit, c->lazy);
+  upb_inttable_push(&c->groups, upb_value_constptr(g));
+
+  ok = upb_inttable_lookupptr(&g->methods, h, &v);
+  UPB_ASSERT(ok);
+  return upb_value_getptr(v);
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.c
new file mode 100644 (file)
index 0000000..a7a5e7b
--- /dev/null
@@ -0,0 +1,1079 @@
+/*
+** upb::Decoder (Bytecode Decoder VM)
+**
+** Bytecode must previously have been generated using the bytecode compiler in
+** compile_decoder.c.  This decoder then walks through the bytecode op-by-op to
+** parse the input.
+**
+** Decoding is fully resumable; we just keep a pointer to the current bytecode
+** instruction and resume from there.  A fair amount of the logic here is to
+** handle the fact that values can span buffer seams and we have to be able to
+** be capable of suspending/resuming from any byte in the stream.  This
+** sometimes requires keeping a few trailing bytes from the last buffer around
+** in the "residual" buffer.
+*/
+
+#include <inttypes.h>
+#include <stddef.h>
+#include "upb/pb/decoder.int.h"
+#include "upb/pb/varint.int.h"
+
+#ifdef UPB_DUMP_BYTECODE
+#include <stdio.h>
+#endif
+
+#include "upb/port_def.inc"
+
+#define CHECK_SUSPEND(x) if (!(x)) return upb_pbdecoder_suspend(d);
+
+/* Error messages that are shared between the bytecode and JIT decoders. */
+const char *kPbDecoderStackOverflow = "Nesting too deep.";
+const char *kPbDecoderSubmessageTooLong =
+    "Submessage end extends past enclosing submessage.";
+
+/* Error messages shared within this file. */
+static const char *kUnterminatedVarint = "Unterminated varint.";
+
+/* upb_pbdecoder **************************************************************/
+
+static opcode halt = OP_HALT;
+
+/* A dummy character we can point to when the user passes us a NULL buffer.
+ * We need this because in C (NULL + 0) and (NULL - NULL) are undefined
+ * behavior, which would invalidate functions like curbufleft(). */
+static const char dummy_char;
+
+/* Whether an op consumes any of the input buffer. */
+static bool consumes_input(opcode op) {
+  switch (op) {
+    case OP_SETDISPATCH:
+    case OP_STARTMSG:
+    case OP_ENDMSG:
+    case OP_STARTSEQ:
+    case OP_ENDSEQ:
+    case OP_STARTSUBMSG:
+    case OP_ENDSUBMSG:
+    case OP_STARTSTR:
+    case OP_ENDSTR:
+    case OP_PUSHTAGDELIM:
+    case OP_POP:
+    case OP_SETDELIM:
+    case OP_SETBIGGROUPNUM:
+    case OP_CHECKDELIM:
+    case OP_CALL:
+    case OP_RET:
+    case OP_BRANCH:
+      return false;
+    default:
+      return true;
+  }
+}
+
+static size_t stacksize(upb_pbdecoder *d, size_t entries) {
+  UPB_UNUSED(d);
+  return entries * sizeof(upb_pbdecoder_frame);
+}
+
+static size_t callstacksize(upb_pbdecoder *d, size_t entries) {
+  UPB_UNUSED(d);
+
+#ifdef UPB_USE_JIT_X64
+  if (d->method_->is_native_) {
+    /* Each native stack frame needs two pointers, plus we need a few frames for
+     * the enter/exit trampolines. */
+    size_t ret = entries * sizeof(void*) * 2;
+    ret += sizeof(void*) * 10;
+    return ret;
+  }
+#endif
+
+  return entries * sizeof(uint32_t*);
+}
+
+
+static bool in_residual_buf(const upb_pbdecoder *d, const char *p);
+
+/* It's unfortunate that we have to micro-manage the compiler with
+ * UPB_FORCEINLINE and UPB_NOINLINE, especially since this tuning is necessarily
+ * specific to one hardware configuration.  But empirically on a Core i7,
+ * performance increases 30-50% with these annotations.  Every instance where
+ * these appear, gcc 4.2.1 made the wrong decision and degraded performance in
+ * benchmarks. */
+
+static void seterr(upb_pbdecoder *d, const char *msg) {
+  upb_status_seterrmsg(d->status, msg);
+}
+
+void upb_pbdecoder_seterr(upb_pbdecoder *d, const char *msg) {
+  seterr(d, msg);
+}
+
+
+/* Buffering ******************************************************************/
+
+/* We operate on one buffer at a time, which is either the user's buffer passed
+ * to our "decode" callback or some residual bytes from the previous buffer. */
+
+/* How many bytes can be safely read from d->ptr without reading past end-of-buf
+ * or past the current delimited end. */
+static size_t curbufleft(const upb_pbdecoder *d) {
+  UPB_ASSERT(d->data_end >= d->ptr);
+  return d->data_end - d->ptr;
+}
+
+/* How many bytes are available before end-of-buffer. */
+static size_t bufleft(const upb_pbdecoder *d) {
+  return d->end - d->ptr;
+}
+
+/* Overall stream offset of d->ptr. */
+uint64_t offset(const upb_pbdecoder *d) {
+  return d->bufstart_ofs + (d->ptr - d->buf);
+}
+
+/* How many bytes are available before the end of this delimited region. */
+size_t delim_remaining(const upb_pbdecoder *d) {
+  return d->top->end_ofs - offset(d);
+}
+
+/* Advances d->ptr. */
+static void advance(upb_pbdecoder *d, size_t len) {
+  UPB_ASSERT(curbufleft(d) >= len);
+  d->ptr += len;
+}
+
+static bool in_buf(const char *p, const char *buf, const char *end) {
+  return p >= buf && p <= end;
+}
+
+static bool in_residual_buf(const upb_pbdecoder *d, const char *p) {
+  return in_buf(p, d->residual, d->residual_end);
+}
+
+/* Calculates the delim_end value, which is affected by both the current buffer
+ * and the parsing stack, so must be called whenever either is updated. */
+static void set_delim_end(upb_pbdecoder *d) {
+  size_t delim_ofs = d->top->end_ofs - d->bufstart_ofs;
+  if (delim_ofs <= (size_t)(d->end - d->buf)) {
+    d->delim_end = d->buf + delim_ofs;
+    d->data_end = d->delim_end;
+  } else {
+    d->data_end = d->end;
+    d->delim_end = NULL;
+  }
+}
+
+static void switchtobuf(upb_pbdecoder *d, const char *buf, const char *end) {
+  d->ptr = buf;
+  d->buf = buf;
+  d->end = end;
+  set_delim_end(d);
+}
+
+static void advancetobuf(upb_pbdecoder *d, const char *buf, size_t len) {
+  UPB_ASSERT(curbufleft(d) == 0);
+  d->bufstart_ofs += (d->end - d->buf);
+  switchtobuf(d, buf, buf + len);
+}
+
+static void checkpoint(upb_pbdecoder *d) {
+  /* The assertion here is in the interests of efficiency, not correctness.
+   * We are trying to ensure that we don't checkpoint() more often than
+   * necessary. */
+  UPB_ASSERT(d->checkpoint != d->ptr);
+  d->checkpoint = d->ptr;
+}
+
+/* Skips "bytes" bytes in the stream, which may be more than available.  If we
+ * skip more bytes than are available, we return a long read count to the caller
+ * indicating how many bytes can be skipped over before passing actual data
+ * again.  Skipped bytes can pass a NULL buffer and the decoder guarantees they
+ * won't actually be read.
+ */
+static int32_t skip(upb_pbdecoder *d, size_t bytes) {
+  UPB_ASSERT(!in_residual_buf(d, d->ptr) || d->size_param == 0);
+  UPB_ASSERT(d->skip == 0);
+  if (bytes > delim_remaining(d)) {
+    seterr(d, "Skipped value extended beyond enclosing submessage.");
+    return upb_pbdecoder_suspend(d);
+  } else if (bufleft(d) >= bytes) {
+    /* Skipped data is all in current buffer, and more is still available. */
+    advance(d, bytes);
+    d->skip = 0;
+    return DECODE_OK;
+  } else {
+    /* Skipped data extends beyond currently available buffers. */
+    d->pc = d->last;
+    d->skip = bytes - curbufleft(d);
+    d->bufstart_ofs += (d->end - d->buf);
+    d->residual_end = d->residual;
+    switchtobuf(d, d->residual, d->residual_end);
+    return d->size_param + d->skip;
+  }
+}
+
+
+/* Resumes the decoder from an initial state or from a previous suspend. */
+int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
+                             size_t size, const upb_bufhandle *handle) {
+  UPB_UNUSED(p);  /* Useless; just for the benefit of the JIT. */
+
+  /* d->skip and d->residual_end could probably elegantly be represented
+   * as a single variable, to more easily represent this invariant. */
+  UPB_ASSERT(!(d->skip && d->residual_end > d->residual));
+
+  /* We need to remember the original size_param, so that the value we return
+   * is relative to it, even if we do some skipping first. */
+  d->size_param = size;
+  d->handle = handle;
+
+  /* Have to handle this case specially (ie. not with skip()) because the user
+   * is allowed to pass a NULL buffer here, which won't allow us to safely
+   * calculate a d->end or use our normal functions like curbufleft(). */
+  if (d->skip && d->skip >= size) {
+    d->skip -= size;
+    d->bufstart_ofs += size;
+    buf = &dummy_char;
+    size = 0;
+
+    /* We can't just return now, because we might need to execute some ops
+     * like CHECKDELIM, which could call some callbacks and pop the stack. */
+  }
+
+  /* We need to pretend that this was the actual buffer param, since some of the
+   * calculations assume that d->ptr/d->buf is relative to this. */
+  d->buf_param = buf;
+
+  if (!buf) {
+    /* NULL buf is ok if its entire span is covered by the "skip" above, but
+     * by this point we know that "skip" doesn't cover the buffer. */
+    seterr(d, "Passed NULL buffer over non-skippable region.");
+    return upb_pbdecoder_suspend(d);
+  }
+
+  if (d->residual_end > d->residual) {
+    /* We have residual bytes from the last buffer. */
+    UPB_ASSERT(d->ptr == d->residual);
+  } else {
+    switchtobuf(d, buf, buf + size);
+  }
+
+  d->checkpoint = d->ptr;
+
+  /* Handle skips that don't cover the whole buffer (as above). */
+  if (d->skip) {
+    size_t skip_bytes = d->skip;
+    d->skip = 0;
+    CHECK_RETURN(skip(d, skip_bytes));
+    checkpoint(d);
+  }
+
+  /* If we're inside an unknown group, continue to parse unknown values. */
+  if (d->top->groupnum < 0) {
+    CHECK_RETURN(upb_pbdecoder_skipunknown(d, -1, 0));
+    checkpoint(d);
+  }
+
+  return DECODE_OK;
+}
+
+/* Suspends the decoder at the last checkpoint, without saving any residual
+ * bytes.  If there are any unconsumed bytes, returns a short byte count. */
+size_t upb_pbdecoder_suspend(upb_pbdecoder *d) {
+  d->pc = d->last;
+  if (d->checkpoint == d->residual) {
+    /* Checkpoint was in residual buf; no user bytes were consumed. */
+    d->ptr = d->residual;
+    return 0;
+  } else {
+    size_t ret = d->size_param - (d->end - d->checkpoint);
+    UPB_ASSERT(!in_residual_buf(d, d->checkpoint));
+    UPB_ASSERT(d->buf == d->buf_param || d->buf == &dummy_char);
+
+    d->bufstart_ofs += (d->checkpoint - d->buf);
+    d->residual_end = d->residual;
+    switchtobuf(d, d->residual, d->residual_end);
+    return ret;
+  }
+}
+
+/* Suspends the decoder at the last checkpoint, and saves any unconsumed
+ * bytes in our residual buffer.  This is necessary if we need more user
+ * bytes to form a complete value, which might not be contiguous in the
+ * user's buffers.  Always consumes all user bytes. */
+static size_t suspend_save(upb_pbdecoder *d) {
+  /* We hit end-of-buffer before we could parse a full value.
+   * Save any unconsumed bytes (if any) to the residual buffer. */
+  d->pc = d->last;
+
+  if (d->checkpoint == d->residual) {
+    /* Checkpoint was in residual buf; append user byte(s) to residual buf. */
+    UPB_ASSERT((d->residual_end - d->residual) + d->size_param <=
+           sizeof(d->residual));
+    if (!in_residual_buf(d, d->ptr)) {
+      d->bufstart_ofs -= (d->residual_end - d->residual);
+    }
+    memcpy(d->residual_end, d->buf_param, d->size_param);
+    d->residual_end += d->size_param;
+  } else {
+    /* Checkpoint was in user buf; old residual bytes not needed. */
+    size_t save;
+    UPB_ASSERT(!in_residual_buf(d, d->checkpoint));
+
+    d->ptr = d->checkpoint;
+    save = curbufleft(d);
+    UPB_ASSERT(save <= sizeof(d->residual));
+    memcpy(d->residual, d->ptr, save);
+    d->residual_end = d->residual + save;
+    d->bufstart_ofs = offset(d);
+  }
+
+  switchtobuf(d, d->residual, d->residual_end);
+  return d->size_param;
+}
+
+/* Copies the next "bytes" bytes into "buf" and advances the stream.
+ * Requires that this many bytes are available in the current buffer. */
+UPB_FORCEINLINE static void consumebytes(upb_pbdecoder *d, void *buf,
+                                         size_t bytes) {
+  UPB_ASSERT(bytes <= curbufleft(d));
+  memcpy(buf, d->ptr, bytes);
+  advance(d, bytes);
+}
+
+/* Slow path for getting the next "bytes" bytes, regardless of whether they are
+ * available in the current buffer or not.  Returns a status code as described
+ * in decoder.int.h. */
+UPB_NOINLINE static int32_t getbytes_slow(upb_pbdecoder *d, void *buf,
+                                          size_t bytes) {
+  const size_t avail = curbufleft(d);
+  consumebytes(d, buf, avail);
+  bytes -= avail;
+  UPB_ASSERT(bytes > 0);
+  if (in_residual_buf(d, d->ptr)) {
+    advancetobuf(d, d->buf_param, d->size_param);
+  }
+  if (curbufleft(d) >= bytes) {
+    consumebytes(d, (char *)buf + avail, bytes);
+    return DECODE_OK;
+  } else if (d->data_end == d->delim_end) {
+    seterr(d, "Submessage ended in the middle of a value or group");
+    return upb_pbdecoder_suspend(d);
+  } else {
+    return suspend_save(d);
+  }
+}
+
+/* Gets the next "bytes" bytes, regardless of whether they are available in the
+ * current buffer or not.  Returns a status code as described in decoder.int.h.
+ */
+UPB_FORCEINLINE static int32_t getbytes(upb_pbdecoder *d, void *buf,
+                                        size_t bytes) {
+  if (curbufleft(d) >= bytes) {
+    /* Buffer has enough data to satisfy. */
+    consumebytes(d, buf, bytes);
+    return DECODE_OK;
+  } else {
+    return getbytes_slow(d, buf, bytes);
+  }
+}
+
+UPB_NOINLINE static size_t peekbytes_slow(upb_pbdecoder *d, void *buf,
+                                          size_t bytes) {
+  size_t ret = curbufleft(d);
+  memcpy(buf, d->ptr, ret);
+  if (in_residual_buf(d, d->ptr)) {
+    size_t copy = UPB_MIN(bytes - ret, d->size_param);
+    memcpy((char *)buf + ret, d->buf_param, copy);
+    ret += copy;
+  }
+  return ret;
+}
+
+UPB_FORCEINLINE static size_t peekbytes(upb_pbdecoder *d, void *buf,
+                                        size_t bytes) {
+  if (curbufleft(d) >= bytes) {
+    memcpy(buf, d->ptr, bytes);
+    return bytes;
+  } else {
+    return peekbytes_slow(d, buf, bytes);
+  }
+}
+
+
+/* Decoding of wire types *****************************************************/
+
+/* Slow path for decoding a varint from the current buffer position.
+ * Returns a status code as described in decoder.int.h. */
+UPB_NOINLINE int32_t upb_pbdecoder_decode_varint_slow(upb_pbdecoder *d,
+                                                      uint64_t *u64) {
+  uint8_t byte = 0x80;
+  int bitpos;
+  *u64 = 0;
+  for(bitpos = 0; bitpos < 70 && (byte & 0x80); bitpos += 7) {
+    CHECK_RETURN(getbytes(d, &byte, 1));
+    *u64 |= (uint64_t)(byte & 0x7F) << bitpos;
+  }
+  if(bitpos == 70 && (byte & 0x80)) {
+    seterr(d, kUnterminatedVarint);
+    return upb_pbdecoder_suspend(d);
+  }
+  return DECODE_OK;
+}
+
+/* Decodes a varint from the current buffer position.
+ * Returns a status code as described in decoder.int.h. */
+UPB_FORCEINLINE static int32_t decode_varint(upb_pbdecoder *d, uint64_t *u64) {
+  if (curbufleft(d) > 0 && !(*d->ptr & 0x80)) {
+    *u64 = *d->ptr;
+    advance(d, 1);
+    return DECODE_OK;
+  } else if (curbufleft(d) >= 10) {
+    /* Fast case. */
+    upb_decoderet r = upb_vdecode_fast(d->ptr);
+    if (r.p == NULL) {
+      seterr(d, kUnterminatedVarint);
+      return upb_pbdecoder_suspend(d);
+    }
+    advance(d, r.p - d->ptr);
+    *u64 = r.val;
+    return DECODE_OK;
+  } else {
+    /* Slow case -- varint spans buffer seam. */
+    return upb_pbdecoder_decode_varint_slow(d, u64);
+  }
+}
+
+/* Decodes a 32-bit varint from the current buffer position.
+ * Returns a status code as described in decoder.int.h. */
+UPB_FORCEINLINE static int32_t decode_v32(upb_pbdecoder *d, uint32_t *u32) {
+  uint64_t u64;
+  int32_t ret = decode_varint(d, &u64);
+  if (ret >= 0) return ret;
+  if (u64 > UINT32_MAX) {
+    seterr(d, "Unterminated 32-bit varint");
+    /* TODO(haberman) guarantee that this function return is >= 0 somehow,
+     * so we know this path will always be treated as error by our caller.
+     * Right now the size_t -> int32_t can overflow and produce negative values.
+     */
+    *u32 = 0;
+    return upb_pbdecoder_suspend(d);
+  }
+  *u32 = u64;
+  return DECODE_OK;
+}
+
+/* Decodes a fixed32 from the current buffer position.
+ * Returns a status code as described in decoder.int.h.
+ * TODO: proper byte swapping for big-endian machines. */
+UPB_FORCEINLINE static int32_t decode_fixed32(upb_pbdecoder *d, uint32_t *u32) {
+  return getbytes(d, u32, 4);
+}
+
+/* Decodes a fixed64 from the current buffer position.
+ * Returns a status code as described in decoder.int.h.
+ * TODO: proper byte swapping for big-endian machines. */
+UPB_FORCEINLINE static int32_t decode_fixed64(upb_pbdecoder *d, uint64_t *u64) {
+  return getbytes(d, u64, 8);
+}
+
+/* Non-static versions of the above functions.
+ * These are called by the JIT for fallback paths. */
+int32_t upb_pbdecoder_decode_f32(upb_pbdecoder *d, uint32_t *u32) {
+  return decode_fixed32(d, u32);
+}
+
+int32_t upb_pbdecoder_decode_f64(upb_pbdecoder *d, uint64_t *u64) {
+  return decode_fixed64(d, u64);
+}
+
+static double as_double(uint64_t n) { double d; memcpy(&d, &n, 8); return d; }
+static float  as_float(uint32_t n)  { float  f; memcpy(&f, &n, 4); return f; }
+
+/* Pushes a frame onto the decoder stack. */
+static bool decoder_push(upb_pbdecoder *d, uint64_t end) {
+  upb_pbdecoder_frame *fr = d->top;
+
+  if (end > fr->end_ofs) {
+    seterr(d, kPbDecoderSubmessageTooLong);
+    return false;
+  } else if (fr == d->limit) {
+    seterr(d, kPbDecoderStackOverflow);
+    return false;
+  }
+
+  fr++;
+  fr->end_ofs = end;
+  fr->dispatch = NULL;
+  fr->groupnum = 0;
+  d->top = fr;
+  return true;
+}
+
+static bool pushtagdelim(upb_pbdecoder *d, uint32_t arg) {
+  /* While we expect to see an "end" tag (either ENDGROUP or a non-sequence
+   * field number) prior to hitting any enclosing submessage end, pushing our
+   * existing delim end prevents us from continuing to parse values from a
+   * corrupt proto that doesn't give us an END tag in time. */
+  if (!decoder_push(d, d->top->end_ofs))
+    return false;
+  d->top->groupnum = arg;
+  return true;
+}
+
+/* Pops a frame from the decoder stack. */
+static void decoder_pop(upb_pbdecoder *d) { d->top--; }
+
+UPB_NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d,
+                                                 uint64_t expected) {
+  uint64_t data = 0;
+  size_t bytes = upb_value_size(expected);
+  size_t read = peekbytes(d, &data, bytes);
+  if (read == bytes && data == expected) {
+    /* Advance past matched bytes. */
+    int32_t ok = getbytes(d, &data, read);
+    UPB_ASSERT(ok < 0);
+    return DECODE_OK;
+  } else if (read < bytes && memcmp(&data, &expected, read) == 0) {
+    return suspend_save(d);
+  } else {
+    return DECODE_MISMATCH;
+  }
+}
+
+int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum,
+                                  uint8_t wire_type) {
+  if (fieldnum >= 0)
+    goto have_tag;
+
+  while (true) {
+    uint32_t tag;
+    CHECK_RETURN(decode_v32(d, &tag));
+    wire_type = tag & 0x7;
+    fieldnum = tag >> 3;
+
+have_tag:
+    if (fieldnum == 0) {
+      seterr(d, "Saw invalid field number (0)");
+      return upb_pbdecoder_suspend(d);
+    }
+
+    switch (wire_type) {
+      case UPB_WIRE_TYPE_32BIT:
+        CHECK_RETURN(skip(d, 4));
+        break;
+      case UPB_WIRE_TYPE_64BIT:
+        CHECK_RETURN(skip(d, 8));
+        break;
+      case UPB_WIRE_TYPE_VARINT: {
+        uint64_t u64;
+        CHECK_RETURN(decode_varint(d, &u64));
+        break;
+      }
+      case UPB_WIRE_TYPE_DELIMITED: {
+        uint32_t len;
+        CHECK_RETURN(decode_v32(d, &len));
+        CHECK_RETURN(skip(d, len));
+        break;
+      }
+      case UPB_WIRE_TYPE_START_GROUP:
+        CHECK_SUSPEND(pushtagdelim(d, -fieldnum));
+        break;
+      case UPB_WIRE_TYPE_END_GROUP:
+        if (fieldnum == -d->top->groupnum) {
+          decoder_pop(d);
+        } else if (fieldnum == d->top->groupnum) {
+          return DECODE_ENDGROUP;
+        } else {
+          seterr(d, "Unmatched ENDGROUP tag.");
+          return upb_pbdecoder_suspend(d);
+        }
+        break;
+      default:
+        seterr(d, "Invalid wire type");
+        return upb_pbdecoder_suspend(d);
+    }
+
+    if (d->top->groupnum >= 0) {
+      /* TODO: More code needed for handling unknown groups. */
+      upb_sink_putunknown(d->top->sink, d->checkpoint, d->ptr - d->checkpoint);
+      return DECODE_OK;
+    }
+
+    /* Unknown group -- continue looping over unknown fields. */
+    checkpoint(d);
+  }
+}
+
+static void goto_endmsg(upb_pbdecoder *d) {
+  upb_value v;
+  bool found = upb_inttable_lookup32(d->top->dispatch, DISPATCH_ENDMSG, &v);
+  UPB_ASSERT(found);
+  d->pc = d->top->base + upb_value_getuint64(v);
+}
+
+/* Parses a tag and jumps to the corresponding bytecode instruction for this
+ * field.
+ *
+ * If the tag is unknown (or the wire type doesn't match), parses the field as
+ * unknown.  If the tag is a valid ENDGROUP tag, jumps to the bytecode
+ * instruction for the end of message. */
+static int32_t dispatch(upb_pbdecoder *d) {
+  upb_inttable *dispatch = d->top->dispatch;
+  uint32_t tag;
+  uint8_t wire_type;
+  uint32_t fieldnum;
+  upb_value val;
+  int32_t retval;
+
+  /* Decode tag. */
+  CHECK_RETURN(decode_v32(d, &tag));
+  wire_type = tag & 0x7;
+  fieldnum = tag >> 3;
+
+  /* Lookup tag.  Because of packed/non-packed compatibility, we have to
+   * check the wire type against two possibilities. */
+  if (fieldnum != DISPATCH_ENDMSG &&
+      upb_inttable_lookup32(dispatch, fieldnum, &val)) {
+    uint64_t v = upb_value_getuint64(val);
+    if (wire_type == (v & 0xff)) {
+      d->pc = d->top->base + (v >> 16);
+      return DECODE_OK;
+    } else if (wire_type == ((v >> 8) & 0xff)) {
+      bool found =
+          upb_inttable_lookup(dispatch, fieldnum + UPB_MAX_FIELDNUMBER, &val);
+      UPB_ASSERT(found);
+      d->pc = d->top->base + upb_value_getuint64(val);
+      return DECODE_OK;
+    }
+  }
+
+  /* We have some unknown fields (or ENDGROUP) to parse.  The DISPATCH or TAG
+   * bytecode that triggered this is preceded by a CHECKDELIM bytecode which
+   * we need to back up to, so that when we're done skipping unknown data we
+   * can re-check the delimited end. */
+  d->last--;  /* Necessary if we get suspended */
+  d->pc = d->last;
+  UPB_ASSERT(getop(*d->last) == OP_CHECKDELIM);
+
+  /* Unknown field or ENDGROUP. */
+  retval = upb_pbdecoder_skipunknown(d, fieldnum, wire_type);
+
+  CHECK_RETURN(retval);
+
+  if (retval == DECODE_ENDGROUP) {
+    goto_endmsg(d);
+    return DECODE_OK;
+  }
+
+  return DECODE_OK;
+}
+
+/* Callers know that the stack is more than one deep because the opcodes that
+ * call this only occur after PUSH operations. */
+upb_pbdecoder_frame *outer_frame(upb_pbdecoder *d) {
+  UPB_ASSERT(d->top != d->stack);
+  return d->top - 1;
+}
+
+
+/* The main decoding loop *****************************************************/
+
+/* The main decoder VM function.  Uses traditional bytecode dispatch loop with a
+ * switch() statement. */
+size_t run_decoder_vm(upb_pbdecoder *d, const mgroup *group,
+                      const upb_bufhandle* handle) {
+
+#define VMCASE(op, code) \
+  case op: { code; if (consumes_input(op)) checkpoint(d); break; }
+#define PRIMITIVE_OP(type, wt, name, convfunc, ctype) \
+  VMCASE(OP_PARSE_ ## type, { \
+    ctype val; \
+    CHECK_RETURN(decode_ ## wt(d, &val)); \
+    upb_sink_put ## name(d->top->sink, arg, (convfunc)(val)); \
+  })
+
+  while(1) {
+    int32_t instruction;
+    opcode op;
+    uint32_t arg;
+    int32_t longofs;
+
+    d->last = d->pc;
+    instruction = *d->pc++;
+    op = getop(instruction);
+    arg = instruction >> 8;
+    longofs = arg;
+    UPB_ASSERT(d->ptr != d->residual_end);
+    UPB_UNUSED(group);
+#ifdef UPB_DUMP_BYTECODE
+    fprintf(stderr, "s_ofs=%d buf_ofs=%d data_rem=%d buf_rem=%d delim_rem=%d "
+                    "%x %s (%d)\n",
+            (int)offset(d),
+            (int)(d->ptr - d->buf),
+            (int)(d->data_end - d->ptr),
+            (int)(d->end - d->ptr),
+            (int)((d->top->end_ofs - d->bufstart_ofs) - (d->ptr - d->buf)),
+            (int)(d->pc - 1 - group->bytecode),
+            upb_pbdecoder_getopname(op),
+            arg);
+#endif
+    switch (op) {
+      /* Technically, we are losing data if we see a 32-bit varint that is not
+       * properly sign-extended.  We could detect this and error about the data
+       * loss, but proto2 does not do this, so we pass. */
+      PRIMITIVE_OP(INT32,    varint,  int32,  int32_t,      uint64_t)
+      PRIMITIVE_OP(INT64,    varint,  int64,  int64_t,      uint64_t)
+      PRIMITIVE_OP(UINT32,   varint,  uint32, uint32_t,     uint64_t)
+      PRIMITIVE_OP(UINT64,   varint,  uint64, uint64_t,     uint64_t)
+      PRIMITIVE_OP(FIXED32,  fixed32, uint32, uint32_t,     uint32_t)
+      PRIMITIVE_OP(FIXED64,  fixed64, uint64, uint64_t,     uint64_t)
+      PRIMITIVE_OP(SFIXED32, fixed32, int32,  int32_t,      uint32_t)
+      PRIMITIVE_OP(SFIXED64, fixed64, int64,  int64_t,      uint64_t)
+      PRIMITIVE_OP(BOOL,     varint,  bool,   bool,         uint64_t)
+      PRIMITIVE_OP(DOUBLE,   fixed64, double, as_double,    uint64_t)
+      PRIMITIVE_OP(FLOAT,    fixed32, float,  as_float,     uint32_t)
+      PRIMITIVE_OP(SINT32,   varint,  int32,  upb_zzdec_32, uint64_t)
+      PRIMITIVE_OP(SINT64,   varint,  int64,  upb_zzdec_64, uint64_t)
+
+      VMCASE(OP_SETDISPATCH,
+        d->top->base = d->pc - 1;
+        memcpy(&d->top->dispatch, d->pc, sizeof(void*));
+        d->pc += sizeof(void*) / sizeof(uint32_t);
+      )
+      VMCASE(OP_STARTMSG,
+        CHECK_SUSPEND(upb_sink_startmsg(d->top->sink));
+      )
+      VMCASE(OP_ENDMSG,
+        CHECK_SUSPEND(upb_sink_endmsg(d->top->sink, d->status));
+      )
+      VMCASE(OP_STARTSEQ,
+        upb_pbdecoder_frame *outer = outer_frame(d);
+        CHECK_SUSPEND(upb_sink_startseq(outer->sink, arg, &d->top->sink));
+      )
+      VMCASE(OP_ENDSEQ,
+        CHECK_SUSPEND(upb_sink_endseq(d->top->sink, arg));
+      )
+      VMCASE(OP_STARTSUBMSG,
+        upb_pbdecoder_frame *outer = outer_frame(d);
+        CHECK_SUSPEND(upb_sink_startsubmsg(outer->sink, arg, &d->top->sink));
+      )
+      VMCASE(OP_ENDSUBMSG,
+        CHECK_SUSPEND(upb_sink_endsubmsg(d->top->sink, arg));
+      )
+      VMCASE(OP_STARTSTR,
+        uint32_t len = delim_remaining(d);
+        upb_pbdecoder_frame *outer = outer_frame(d);
+        CHECK_SUSPEND(upb_sink_startstr(outer->sink, arg, len, &d->top->sink));
+        if (len == 0) {
+          d->pc++;  /* Skip OP_STRING. */
+        }
+      )
+      VMCASE(OP_STRING,
+        uint32_t len = curbufleft(d);
+        size_t n = upb_sink_putstring(d->top->sink, arg, d->ptr, len, handle);
+        if (n > len) {
+          if (n > delim_remaining(d)) {
+            seterr(d, "Tried to skip past end of string.");
+            return upb_pbdecoder_suspend(d);
+          } else {
+            int32_t ret = skip(d, n);
+            /* This shouldn't return DECODE_OK, because n > len. */
+            UPB_ASSERT(ret >= 0);
+            return ret;
+          }
+        }
+        advance(d, n);
+        if (n < len || d->delim_end == NULL) {
+          /* We aren't finished with this string yet. */
+          d->pc--;  /* Repeat OP_STRING. */
+          if (n > 0) checkpoint(d);
+          return upb_pbdecoder_suspend(d);
+        }
+      )
+      VMCASE(OP_ENDSTR,
+        CHECK_SUSPEND(upb_sink_endstr(d->top->sink, arg));
+      )
+      VMCASE(OP_PUSHTAGDELIM,
+        CHECK_SUSPEND(pushtagdelim(d, arg));
+      )
+      VMCASE(OP_SETBIGGROUPNUM,
+        d->top->groupnum = *d->pc++;
+      )
+      VMCASE(OP_POP,
+        UPB_ASSERT(d->top > d->stack);
+        decoder_pop(d);
+      )
+      VMCASE(OP_PUSHLENDELIM,
+        uint32_t len;
+        CHECK_RETURN(decode_v32(d, &len));
+        CHECK_SUSPEND(decoder_push(d, offset(d) + len));
+        set_delim_end(d);
+      )
+      VMCASE(OP_SETDELIM,
+        set_delim_end(d);
+      )
+      VMCASE(OP_CHECKDELIM,
+        /* We are guaranteed of this assert because we never allow ourselves to
+         * consume bytes beyond data_end, which covers delim_end when non-NULL.
+         */
+        UPB_ASSERT(!(d->delim_end && d->ptr > d->delim_end));
+        if (d->ptr == d->delim_end)
+          d->pc += longofs;
+      )
+      VMCASE(OP_CALL,
+        d->callstack[d->call_len++] = d->pc;
+        d->pc += longofs;
+      )
+      VMCASE(OP_RET,
+        UPB_ASSERT(d->call_len > 0);
+        d->pc = d->callstack[--d->call_len];
+      )
+      VMCASE(OP_BRANCH,
+        d->pc += longofs;
+      )
+      VMCASE(OP_TAG1,
+        uint8_t expected;
+        CHECK_SUSPEND(curbufleft(d) > 0);
+        expected = (arg >> 8) & 0xff;
+        if (*d->ptr == expected) {
+          advance(d, 1);
+        } else {
+          int8_t shortofs;
+         badtag:
+          shortofs = arg;
+          if (shortofs == LABEL_DISPATCH) {
+            CHECK_RETURN(dispatch(d));
+          } else {
+            d->pc += shortofs;
+            break; /* Avoid checkpoint(). */
+          }
+        }
+      )
+      VMCASE(OP_TAG2,
+        uint16_t expected;
+        CHECK_SUSPEND(curbufleft(d) > 0);
+        expected = (arg >> 8) & 0xffff;
+        if (curbufleft(d) >= 2) {
+          uint16_t actual;
+          memcpy(&actual, d->ptr, 2);
+          if (expected == actual) {
+            advance(d, 2);
+          } else {
+            goto badtag;
+          }
+        } else {
+          int32_t result = upb_pbdecoder_checktag_slow(d, expected);
+          if (result == DECODE_MISMATCH) goto badtag;
+          if (result >= 0) return result;
+        }
+      )
+      VMCASE(OP_TAGN, {
+        uint64_t expected;
+        int32_t result;
+        memcpy(&expected, d->pc, 8);
+        d->pc += 2;
+        result = upb_pbdecoder_checktag_slow(d, expected);
+        if (result == DECODE_MISMATCH) goto badtag;
+        if (result >= 0) return result;
+      })
+      VMCASE(OP_DISPATCH, {
+        CHECK_RETURN(dispatch(d));
+      })
+      VMCASE(OP_HALT, {
+        return d->size_param;
+      })
+    }
+  }
+}
+
+
+/* BytesHandler handlers ******************************************************/
+
+void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint) {
+  upb_pbdecoder *d = closure;
+  UPB_UNUSED(size_hint);
+  d->top->end_ofs = UINT64_MAX;
+  d->bufstart_ofs = 0;
+  d->call_len = 1;
+  d->callstack[0] = &halt;
+  d->pc = pc;
+  d->skip = 0;
+  return d;
+}
+
+void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint) {
+  upb_pbdecoder *d = closure;
+  UPB_UNUSED(hd);
+  UPB_UNUSED(size_hint);
+  d->top->end_ofs = UINT64_MAX;
+  d->bufstart_ofs = 0;
+  d->call_len = 0;
+  d->skip = 0;
+  return d;
+}
+
+bool upb_pbdecoder_end(void *closure, const void *handler_data) {
+  upb_pbdecoder *d = closure;
+  const upb_pbdecodermethod *method = handler_data;
+  uint64_t end;
+  char dummy;
+
+  if (d->residual_end > d->residual) {
+    seterr(d, "Unexpected EOF: decoder still has buffered unparsed data");
+    return false;
+  }
+
+  if (d->skip) {
+    seterr(d, "Unexpected EOF inside skipped data");
+    return false;
+  }
+
+  if (d->top->end_ofs != UINT64_MAX) {
+    seterr(d, "Unexpected EOF inside delimited string");
+    return false;
+  }
+
+  /* The user's end() call indicates that the message ends here. */
+  end = offset(d);
+  d->top->end_ofs = end;
+
+#ifdef UPB_USE_JIT_X64
+  if (method->is_native_) {
+    const mgroup *group = (const mgroup*)method->group;
+    if (d->top != d->stack)
+      d->stack->end_ofs = 0;
+    group->jit_code(closure, method->code_base.ptr, &dummy, 0, NULL);
+  } else
+#endif
+  {
+    const uint32_t *p = d->pc;
+    d->stack->end_ofs = end;
+    /* Check the previous bytecode, but guard against beginning. */
+    if (p != method->code_base.ptr) p--;
+    if (getop(*p) == OP_CHECKDELIM) {
+      /* Rewind from OP_TAG* to OP_CHECKDELIM. */
+      UPB_ASSERT(getop(*d->pc) == OP_TAG1 ||
+             getop(*d->pc) == OP_TAG2 ||
+             getop(*d->pc) == OP_TAGN ||
+             getop(*d->pc) == OP_DISPATCH);
+      d->pc = p;
+    }
+    upb_pbdecoder_decode(closure, handler_data, &dummy, 0, NULL);
+  }
+
+  if (d->call_len != 0) {
+    seterr(d, "Unexpected EOF inside submessage or group");
+    return false;
+  }
+
+  return true;
+}
+
+size_t upb_pbdecoder_decode(void *decoder, const void *group, const char *buf,
+                            size_t size, const upb_bufhandle *handle) {
+  int32_t result = upb_pbdecoder_resume(decoder, NULL, buf, size, handle);
+
+  if (result == DECODE_ENDGROUP) goto_endmsg(decoder);
+  CHECK_RETURN(result);
+
+  return run_decoder_vm(decoder, group, handle);
+}
+
+
+/* Public API *****************************************************************/
+
+void upb_pbdecoder_reset(upb_pbdecoder *d) {
+  d->top = d->stack;
+  d->top->groupnum = 0;
+  d->ptr = d->residual;
+  d->buf = d->residual;
+  d->end = d->residual;
+  d->residual_end = d->residual;
+}
+
+upb_pbdecoder *upb_pbdecoder_create(upb_arena *a, const upb_pbdecodermethod *m,
+                                    upb_sink sink, upb_status *status) {
+  const size_t default_max_nesting = 64;
+#ifndef NDEBUG
+  size_t size_before = upb_arena_bytesallocated(a);
+#endif
+
+  upb_pbdecoder *d = upb_arena_malloc(a, sizeof(upb_pbdecoder));
+  if (!d) return NULL;
+
+  d->method_ = m;
+  d->callstack = upb_arena_malloc(a, callstacksize(d, default_max_nesting));
+  d->stack = upb_arena_malloc(a, stacksize(d, default_max_nesting));
+  if (!d->stack || !d->callstack) {
+    return NULL;
+  }
+
+  d->arena = a;
+  d->limit = d->stack + default_max_nesting - 1;
+  d->stack_size = default_max_nesting;
+  d->status = status;
+
+  upb_pbdecoder_reset(d);
+  upb_bytessink_reset(&d->input_, &m->input_handler_, d);
+
+  if (d->method_->dest_handlers_) {
+    if (sink.handlers != d->method_->dest_handlers_)
+      return NULL;
+  }
+  d->top->sink = sink;
+
+  /* If this fails, increase the value in decoder.h. */
+  UPB_ASSERT_DEBUGVAR(upb_arena_bytesallocated(a) - size_before <=
+                      UPB_PB_DECODER_SIZE);
+  return d;
+}
+
+uint64_t upb_pbdecoder_bytesparsed(const upb_pbdecoder *d) {
+  return offset(d);
+}
+
+const upb_pbdecodermethod *upb_pbdecoder_method(const upb_pbdecoder *d) {
+  return d->method_;
+}
+
+upb_bytessink upb_pbdecoder_input(upb_pbdecoder *d) {
+  return d->input_;
+}
+
+size_t upb_pbdecoder_maxnesting(const upb_pbdecoder *d) {
+  return d->stack_size;
+}
+
+bool upb_pbdecoder_setmaxnesting(upb_pbdecoder *d, size_t max) {
+  UPB_ASSERT(d->top >= d->stack);
+
+  if (max < (size_t)(d->top - d->stack)) {
+    /* Can't set a limit smaller than what we are currently at. */
+    return false;
+  }
+
+  if (max > d->stack_size) {
+    /* Need to reallocate stack and callstack to accommodate. */
+    size_t old_size = stacksize(d, d->stack_size);
+    size_t new_size = stacksize(d, max);
+    void *p = upb_arena_realloc(d->arena, d->stack, old_size, new_size);
+    if (!p) {
+      return false;
+    }
+    d->stack = p;
+
+    old_size = callstacksize(d, d->stack_size);
+    new_size = callstacksize(d, max);
+    p = upb_arena_realloc(d->arena, d->callstack, old_size, new_size);
+    if (!p) {
+      return false;
+    }
+    d->callstack = p;
+
+    d->stack_size = max;
+  }
+
+  d->limit = d->stack + max - 1;
+  return true;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.h
new file mode 100644 (file)
index 0000000..709db49
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+** upb::pb::Decoder
+**
+** A high performance, streaming, resumable decoder for the binary protobuf
+** format.
+**
+** This interface works the same regardless of what decoder backend is being
+** used.  A client of this class does not need to know whether decoding is using
+** a JITted decoder (DynASM, LLVM, etc) or an interpreted decoder.  By default,
+** it will always use the fastest available decoder.  However, you can call
+** set_allow_jit(false) to disable any JIT decoder that might be available.
+** This is primarily useful for testing purposes.
+*/
+
+#ifndef UPB_DECODER_H_
+#define UPB_DECODER_H_
+
+#include "upb/sink.h"
+
+#ifdef __cplusplus
+namespace upb {
+namespace pb {
+class CodeCache;
+class DecoderPtr;
+class DecoderMethodPtr;
+class DecoderMethodOptions;
+}  /* namespace pb */
+}  /* namespace upb */
+#endif
+
+/* The maximum number of bytes we are required to buffer internally between
+ * calls to the decoder.  The value is 14: a 5 byte unknown tag plus ten-byte
+ * varint, less one because we are buffering an incomplete value.
+ *
+ * Should only be used by unit tests. */
+#define UPB_DECODER_MAX_RESIDUAL_BYTES 14
+
+/* upb_pbdecodermethod ********************************************************/
+
+struct upb_pbdecodermethod;
+typedef struct upb_pbdecodermethod upb_pbdecodermethod;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const upb_handlers *upb_pbdecodermethod_desthandlers(
+    const upb_pbdecodermethod *m);
+const upb_byteshandler *upb_pbdecodermethod_inputhandler(
+    const upb_pbdecodermethod *m);
+bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* Represents the code to parse a protobuf according to a destination
+ * Handlers. */
+class upb::pb::DecoderMethodPtr {
+ public:
+  DecoderMethodPtr() : ptr_(nullptr) {}
+  DecoderMethodPtr(const upb_pbdecodermethod* ptr) : ptr_(ptr) {}
+
+  const upb_pbdecodermethod* ptr() { return ptr_; }
+
+  /* The destination handlers that are statically bound to this method.
+   * This method is only capable of outputting to a sink that uses these
+   * handlers. */
+  const Handlers *dest_handlers() const {
+    return upb_pbdecodermethod_desthandlers(ptr_);
+  }
+
+  /* The input handlers for this decoder method. */
+  const BytesHandler* input_handler() const {
+    return upb_pbdecodermethod_inputhandler(ptr_);
+  }
+
+  /* Whether this method is native. */
+  bool is_native() const {
+    return upb_pbdecodermethod_isnative(ptr_);
+  }
+
+ private:
+  const upb_pbdecodermethod* ptr_;
+};
+
+#endif
+
+/* upb_pbdecoder **************************************************************/
+
+/* Preallocation hint: decoder won't allocate more bytes than this when first
+ * constructed.  This hint may be an overestimate for some build configurations.
+ * But if the decoder library is upgraded without recompiling the application,
+ * it may be an underestimate. */
+#define UPB_PB_DECODER_SIZE 4416
+
+struct upb_pbdecoder;
+typedef struct upb_pbdecoder upb_pbdecoder;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+upb_pbdecoder *upb_pbdecoder_create(upb_arena *arena,
+                                    const upb_pbdecodermethod *method,
+                                    upb_sink output, upb_status *status);
+const upb_pbdecodermethod *upb_pbdecoder_method(const upb_pbdecoder *d);
+upb_bytessink upb_pbdecoder_input(upb_pbdecoder *d);
+uint64_t upb_pbdecoder_bytesparsed(const upb_pbdecoder *d);
+size_t upb_pbdecoder_maxnesting(const upb_pbdecoder *d);
+bool upb_pbdecoder_setmaxnesting(upb_pbdecoder *d, size_t max);
+void upb_pbdecoder_reset(upb_pbdecoder *d);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* A Decoder receives binary protobuf data on its input sink and pushes the
+ * decoded data to its output sink. */
+class upb::pb::DecoderPtr {
+ public:
+  DecoderPtr() : ptr_(nullptr) {}
+  DecoderPtr(upb_pbdecoder* ptr) : ptr_(ptr) {}
+
+  upb_pbdecoder* ptr() { return ptr_; }
+
+  /* Constructs a decoder instance for the given method, which must outlive this
+   * decoder.  Any errors during parsing will be set on the given status, which
+   * must also outlive this decoder.
+   *
+   * The sink must match the given method. */
+  static DecoderPtr Create(Arena *arena, DecoderMethodPtr method,
+                           upb::Sink output, Status *status) {
+    return DecoderPtr(upb_pbdecoder_create(arena->ptr(), method.ptr(),
+                                           output.sink(), status->ptr()));
+  }
+
+  /* Returns the DecoderMethod this decoder is parsing from. */
+  const DecoderMethodPtr method() const {
+    return DecoderMethodPtr(upb_pbdecoder_method(ptr_));
+  }
+
+  /* The sink on which this decoder receives input. */
+  BytesSink input() { return BytesSink(upb_pbdecoder_input(ptr())); }
+
+  /* Returns number of bytes successfully parsed.
+   *
+   * This can be useful for determining the stream position where an error
+   * occurred.
+   *
+   * This value may not be up-to-date when called from inside a parsing
+   * callback. */
+  uint64_t BytesParsed() { return upb_pbdecoder_bytesparsed(ptr()); }
+
+  /* Gets/sets the parsing nexting limit.  If the total number of nested
+   * submessages and repeated fields hits this limit, parsing will fail.  This
+   * is a resource limit that controls the amount of memory used by the parsing
+   * stack.
+   *
+   * Setting the limit will fail if the parser is currently suspended at a depth
+   * greater than this, or if memory allocation of the stack fails. */
+  size_t max_nesting() { return upb_pbdecoder_maxnesting(ptr()); }
+  bool set_max_nesting(size_t max) { return upb_pbdecoder_maxnesting(ptr()); }
+
+  void Reset() { upb_pbdecoder_reset(ptr()); }
+
+  static const size_t kSize = UPB_PB_DECODER_SIZE;
+
+ private:
+  upb_pbdecoder *ptr_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_pbcodecache ************************************************************/
+
+/* Lazily builds and caches decoder methods that will push data to the given
+ * handlers.  The destination handlercache must outlive this object. */
+
+struct upb_pbcodecache;
+typedef struct upb_pbcodecache upb_pbcodecache;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+upb_pbcodecache *upb_pbcodecache_new(upb_handlercache *dest);
+void upb_pbcodecache_free(upb_pbcodecache *c);
+bool upb_pbcodecache_allowjit(const upb_pbcodecache *c);
+void upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow);
+void upb_pbcodecache_setlazy(upb_pbcodecache *c, bool lazy);
+const upb_pbdecodermethod *upb_pbcodecache_get(upb_pbcodecache *c,
+                                               const upb_msgdef *md);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* A class for caching protobuf processing code, whether bytecode for the
+ * interpreted decoder or machine code for the JIT.
+ *
+ * This class is not thread-safe. */
+class upb::pb::CodeCache {
+ public:
+  CodeCache(upb::HandlerCache *dest)
+      : ptr_(upb_pbcodecache_new(dest->ptr()), upb_pbcodecache_free) {}
+  CodeCache(CodeCache&&) = default;
+  CodeCache& operator=(CodeCache&&) = default;
+
+  upb_pbcodecache* ptr() { return ptr_.get(); }
+  const upb_pbcodecache* ptr() const { return ptr_.get(); }
+
+  /* Whether the cache is allowed to generate machine code.  Defaults to true.
+   * There is no real reason to turn it off except for testing or if you are
+   * having a specific problem with the JIT.
+   *
+   * Note that allow_jit = true does not *guarantee* that the code will be JIT
+   * compiled.  If this platform is not supported or the JIT was not compiled
+   * in, the code may still be interpreted. */
+  bool allow_jit() const { return upb_pbcodecache_allowjit(ptr()); }
+
+  /* This may only be called when the object is first constructed, and prior to
+   * any code generation. */
+  void set_allow_jit(bool allow) { upb_pbcodecache_setallowjit(ptr(), allow); }
+
+  /* Should the decoder push submessages to lazy handlers for fields that have
+   * them?  The caller should set this iff the lazy handlers expect data that is
+   * in protobuf binary format and the caller wishes to lazy parse it. */
+  void set_lazy(bool lazy) { upb_pbcodecache_setlazy(ptr(), lazy); }
+
+  /* Returns a DecoderMethod that can push data to the given handlers.
+   * If a suitable method already exists, it will be returned from the cache. */
+  const DecoderMethodPtr Get(MessageDefPtr md) {
+    return DecoderMethodPtr(upb_pbcodecache_get(ptr(), md.ptr()));
+  }
+
+ private:
+  std::unique_ptr<upb_pbcodecache, decltype(&upb_pbcodecache_free)> ptr_;
+};
+
+#endif  /* __cplusplus */
+
+#endif  /* UPB_DECODER_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.int.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/decoder.int.h
new file mode 100644 (file)
index 0000000..3ed50df
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+** Internal-only definitions for the decoder.
+*/
+
+#ifndef UPB_DECODER_INT_H_
+#define UPB_DECODER_INT_H_
+
+#include "upb/def.h"
+#include "upb/handlers.h"
+#include "upb/pb/decoder.h"
+#include "upb/sink.h"
+#include "upb/table.int.h"
+
+#include "upb/port_def.inc"
+
+/* Opcode definitions.  The canonical meaning of each opcode is its
+ * implementation in the interpreter (the JIT is written to match this).
+ *
+ * All instructions have the opcode in the low byte.
+ * Instruction format for most instructions is:
+ *
+ * +-------------------+--------+
+ * |     arg (24)      | op (8) |
+ * +-------------------+--------+
+ *
+ * Exceptions are indicated below.  A few opcodes are multi-word. */
+typedef enum {
+  /* Opcodes 1-8, 13, 15-18 parse their respective descriptor types.
+   * Arg for all of these is the upb selector for this field. */
+#define T(type) OP_PARSE_ ## type = UPB_DESCRIPTOR_TYPE_ ## type
+  T(DOUBLE), T(FLOAT), T(INT64), T(UINT64), T(INT32), T(FIXED64), T(FIXED32),
+  T(BOOL), T(UINT32), T(SFIXED32), T(SFIXED64), T(SINT32), T(SINT64),
+#undef T
+  OP_STARTMSG       = 9,   /* No arg. */
+  OP_ENDMSG         = 10,  /* No arg. */
+  OP_STARTSEQ       = 11,
+  OP_ENDSEQ         = 12,
+  OP_STARTSUBMSG    = 14,
+  OP_ENDSUBMSG      = 19,
+  OP_STARTSTR       = 20,
+  OP_STRING         = 21,
+  OP_ENDSTR         = 22,
+
+  OP_PUSHTAGDELIM   = 23,  /* No arg. */
+  OP_PUSHLENDELIM   = 24,  /* No arg. */
+  OP_POP            = 25,  /* No arg. */
+  OP_SETDELIM       = 26,  /* No arg. */
+  OP_SETBIGGROUPNUM = 27,  /* two words:
+                            *   | unused (24)     | opc (8) |
+                            *   |        groupnum (32)      | */
+  OP_CHECKDELIM     = 28,
+  OP_CALL           = 29,
+  OP_RET            = 30,
+  OP_BRANCH         = 31,
+
+  /* Different opcodes depending on how many bytes expected. */
+  OP_TAG1           = 32,  /* | match tag (16) | jump target (8) | opc (8) | */
+  OP_TAG2           = 33,  /* | match tag (16) | jump target (8) | opc (8) | */
+  OP_TAGN           = 34,  /* three words: */
+                           /*   | unused (16) | jump target(8) | opc (8) | */
+                           /*   |           match tag 1 (32)             | */
+                           /*   |           match tag 2 (32)             | */
+
+  OP_SETDISPATCH    = 35,  /* N words: */
+                           /*   | unused (24)         | opc | */
+                           /*   | upb_inttable* (32 or 64)  | */
+
+  OP_DISPATCH       = 36,  /* No arg. */
+
+  OP_HALT           = 37   /* No arg. */
+} opcode;
+
+#define OP_MAX OP_HALT
+
+UPB_INLINE opcode getop(uint32_t instr) { return (opcode)(instr & 0xff); }
+
+struct upb_pbcodecache {
+  upb_arena *arena;
+  upb_handlercache *dest;
+  bool allow_jit;
+  bool lazy;
+
+  /* Array of mgroups. */
+  upb_inttable groups;
+};
+
+/* Method group; represents a set of decoder methods that had their code
+ * emitted together.  Immutable once created.  */
+typedef struct {
+  /* Maps upb_msgdef/upb_handlers -> upb_pbdecodermethod.  Owned by us.
+   *
+   * Ideally this would be on pbcodecache (if we were actually caching code).
+   * Right now we don't actually cache anything, which is wasteful. */
+  upb_inttable methods;
+
+  /* The bytecode for our methods, if any exists.  Owned by us. */
+  uint32_t *bytecode;
+  uint32_t *bytecode_end;
+
+#ifdef UPB_USE_JIT_X64
+  /* JIT-generated machine code, if any. */
+  upb_string_handlerfunc *jit_code;
+  /* The size of the jit_code (required to munmap()). */
+  size_t jit_size;
+  char *debug_info;
+  void *dl;
+#endif
+} mgroup;
+
+/* The maximum that any submessages can be nested.  Matches proto2's limit.
+ * This specifies the size of the decoder's statically-sized array and therefore
+ * setting it high will cause the upb::pb::Decoder object to be larger.
+ *
+ * If necessary we can add a runtime-settable property to Decoder that allow
+ * this to be larger than the compile-time setting, but this would add
+ * complexity, particularly since we would have to decide how/if to give users
+ * the ability to set a custom memory allocation function. */
+#define UPB_DECODER_MAX_NESTING 64
+
+/* Internal-only struct used by the decoder. */
+typedef struct {
+  /* Space optimization note: we store two pointers here that the JIT
+   * doesn't need at all; the upb_handlers* inside the sink and
+   * the dispatch table pointer.  We can optimze so that the JIT uses
+   * smaller stack frames than the interpreter.  The only thing we need
+   * to guarantee is that the fallback routines can find end_ofs. */
+  upb_sink sink;
+
+  /* The absolute stream offset of the end-of-frame delimiter.
+   * Non-delimited frames (groups and non-packed repeated fields) reuse the
+   * delimiter of their parent, even though the frame may not end there.
+   *
+   * NOTE: the JIT stores a slightly different value here for non-top frames.
+   * It stores the value relative to the end of the enclosed message.  But the
+   * top frame is still stored the same way, which is important for ensuring
+   * that calls from the JIT into C work correctly. */
+  uint64_t end_ofs;
+  const uint32_t *base;
+
+  /* 0 indicates a length-delimited field.
+   * A positive number indicates a known group.
+   * A negative number indicates an unknown group. */
+  int32_t groupnum;
+  upb_inttable *dispatch;  /* Not used by the JIT. */
+} upb_pbdecoder_frame;
+
+struct upb_pbdecodermethod {
+  /* While compiling, the base is relative in "ofs", after compiling it is
+   * absolute in "ptr". */
+  union {
+    uint32_t ofs;     /* PC offset of method. */
+    void *ptr;        /* Pointer to bytecode or machine code for this method. */
+  } code_base;
+
+  /* The decoder method group to which this method belongs. */
+  const mgroup *group;
+
+  /* Whether this method is native code or bytecode. */
+  bool is_native_;
+
+  /* The handler one calls to invoke this method. */
+  upb_byteshandler input_handler_;
+
+  /* The destination handlers this method is bound to.  We own a ref. */
+  const upb_handlers *dest_handlers_;
+
+  /* Dispatch table -- used by both bytecode decoder and JIT when encountering a
+   * field number that wasn't the one we were expecting to see.  See
+   * decoder.int.h for the layout of this table. */
+  upb_inttable dispatch;
+};
+
+struct upb_pbdecoder {
+  upb_arena *arena;
+
+  /* Our input sink. */
+  upb_bytessink input_;
+
+  /* The decoder method we are parsing with (owned). */
+  const upb_pbdecodermethod *method_;
+
+  size_t call_len;
+  const uint32_t *pc, *last;
+
+  /* Current input buffer and its stream offset. */
+  const char *buf, *ptr, *end, *checkpoint;
+
+  /* End of the delimited region, relative to ptr, NULL if not in this buf. */
+  const char *delim_end;
+
+  /* End of the delimited region, relative to ptr, end if not in this buf. */
+  const char *data_end;
+
+  /* Overall stream offset of "buf." */
+  uint64_t bufstart_ofs;
+
+  /* Buffer for residual bytes not parsed from the previous buffer. */
+  char residual[UPB_DECODER_MAX_RESIDUAL_BYTES];
+  char *residual_end;
+
+  /* Bytes of data that should be discarded from the input beore we start
+   * parsing again.  We set this when we internally determine that we can
+   * safely skip the next N bytes, but this region extends past the current
+   * user buffer. */
+  size_t skip;
+
+  /* Stores the user buffer passed to our decode function. */
+  const char *buf_param;
+  size_t size_param;
+  const upb_bufhandle *handle;
+
+  /* Our internal stack. */
+  upb_pbdecoder_frame *stack, *top, *limit;
+  const uint32_t **callstack;
+  size_t stack_size;
+
+  upb_status *status;
+
+#ifdef UPB_USE_JIT_X64
+  /* Used momentarily by the generated code to store a value while a user
+   * function is called. */
+  uint32_t tmp_len;
+
+  const void *saved_rsp;
+#endif
+};
+
+/* Decoder entry points; used as handlers. */
+void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint);
+void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint);
+size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
+                            size_t size, const upb_bufhandle *handle);
+bool upb_pbdecoder_end(void *closure, const void *handler_data);
+
+/* Decoder-internal functions that the JIT calls to handle fallback paths. */
+int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
+                             size_t size, const upb_bufhandle *handle);
+size_t upb_pbdecoder_suspend(upb_pbdecoder *d);
+int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum,
+                                  uint8_t wire_type);
+int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d, uint64_t expected);
+int32_t upb_pbdecoder_decode_varint_slow(upb_pbdecoder *d, uint64_t *u64);
+int32_t upb_pbdecoder_decode_f32(upb_pbdecoder *d, uint32_t *u32);
+int32_t upb_pbdecoder_decode_f64(upb_pbdecoder *d, uint64_t *u64);
+void upb_pbdecoder_seterr(upb_pbdecoder *d, const char *msg);
+
+/* Error messages that are shared between the bytecode and JIT decoders. */
+extern const char *kPbDecoderStackOverflow;
+extern const char *kPbDecoderSubmessageTooLong;
+
+/* Access to decoderplan members needed by the decoder. */
+const char *upb_pbdecoder_getopname(unsigned int op);
+
+/* JIT codegen entry point. */
+void upb_pbdecoder_jit(mgroup *group);
+void upb_pbdecoder_freejit(mgroup *group);
+
+/* A special label that means "do field dispatch for this message and branch to
+ * wherever that takes you." */
+#define LABEL_DISPATCH 0
+
+/* A special slot in the dispatch table that stores the epilogue (ENDMSG and/or
+ * RET) for branching to when we find an appropriate ENDGROUP tag. */
+#define DISPATCH_ENDMSG 0
+
+/* It's important to use this invalid wire type instead of 0 (which is a valid
+ * wire type). */
+#define NO_WIRE_TYPE 0xff
+
+/* The dispatch table layout is:
+ *   [field number] -> [ 48-bit offset ][ 8-bit wt2 ][ 8-bit wt1 ]
+ *
+ * If wt1 matches, jump to the 48-bit offset.  If wt2 matches, lookup
+ * (UPB_MAX_FIELDNUMBER + fieldnum) and jump there.
+ *
+ * We need two wire types because of packed/non-packed compatibility.  A
+ * primitive repeated field can use either wire type and be valid.  While we
+ * could key the table on fieldnum+wiretype, the table would be 8x sparser.
+ *
+ * Storing two wire types in the primary value allows us to quickly rule out
+ * the second wire type without needing to do a separate lookup (this case is
+ * less common than an unknown field). */
+UPB_INLINE uint64_t upb_pbdecoder_packdispatch(uint64_t ofs, uint8_t wt1,
+                                               uint8_t wt2) {
+  return (ofs << 16) | (wt2 << 8) | wt1;
+}
+
+UPB_INLINE void upb_pbdecoder_unpackdispatch(uint64_t dispatch, uint64_t *ofs,
+                                             uint8_t *wt1, uint8_t *wt2) {
+  *wt1 = (uint8_t)dispatch;
+  *wt2 = (uint8_t)(dispatch >> 8);
+  *ofs = dispatch >> 16;
+}
+
+/* All of the functions in decoder.c that return int32_t return values according
+ * to the following scheme:
+ *   1. negative values indicate a return code from the following list.
+ *   2. positive values indicate that error or end of buffer was hit, and
+ *      that the decode function should immediately return the given value
+ *      (the decoder state has already been suspended and is ready to be
+ *      resumed). */
+#define DECODE_OK -1
+#define DECODE_MISMATCH -2  /* Used only from checktag_slow(). */
+#define DECODE_ENDGROUP -3  /* Used only from checkunknown(). */
+
+#define CHECK_RETURN(x) { int32_t ret = x; if (ret >= 0) return ret; }
+
+#include "upb/port_undef.inc"
+
+#endif  /* UPB_DECODER_INT_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/encoder.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/encoder.c
new file mode 100644 (file)
index 0000000..d108a64
--- /dev/null
@@ -0,0 +1,570 @@
+/*
+** upb::Encoder
+**
+** Since we are implementing pure handlers (ie. without any out-of-band access
+** to pre-computed lengths), we have to buffer all submessages before we can
+** emit even their first byte.
+**
+** Not knowing the size of submessages also means we can't write a perfect
+** zero-copy implementation, even with buffering.  Lengths are stored as
+** varints, which means that we don't know how many bytes to reserve for the
+** length until we know what the length is.
+**
+** This leaves us with three main choices:
+**
+** 1. buffer all submessage data in a temporary buffer, then copy it exactly
+**    once into the output buffer.
+**
+** 2. attempt to buffer data directly into the output buffer, estimating how
+**    many bytes each length will take.  When our guesses are wrong, use
+**    memmove() to grow or shrink the allotted space.
+**
+** 3. buffer directly into the output buffer, allocating a max length
+**    ahead-of-time for each submessage length.  If we overallocated, we waste
+**    space, but no memcpy() or memmove() is required.  This approach requires
+**    defining a maximum size for submessages and rejecting submessages that
+**    exceed that size.
+**
+** (2) and (3) have the potential to have better performance, but they are more
+** complicated and subtle to implement:
+**
+**   (3) requires making an arbitrary choice of the maximum message size; it
+**       wastes space when submessages are shorter than this and fails
+**       completely when they are longer.  This makes it more finicky and
+**       requires configuration based on the input.  It also makes it impossible
+**       to perfectly match the output of reference encoders that always use the
+**       optimal amount of space for each length.
+**
+**   (2) requires guessing the the size upfront, and if multiple lengths are
+**       guessed wrong the minimum required number of memmove() operations may
+**       be complicated to compute correctly.  Implemented properly, it may have
+**       a useful amortized or average cost, but more investigation is required
+**       to determine this and what the optimal algorithm is to achieve it.
+**
+**   (1) makes you always pay for exactly one copy, but its implementation is
+**       the simplest and its performance is predictable.
+**
+** So for now, we implement (1) only.  If we wish to optimize later, we should
+** be able to do it without affecting users.
+**
+** The strategy is to buffer the segments of data that do *not* depend on
+** unknown lengths in one buffer, and keep a separate buffer of segment pointers
+** and lengths.  When the top-level submessage ends, we can go beginning to end,
+** alternating the writing of lengths with memcpy() of the rest of the data.
+** At the top level though, no buffering is required.
+*/
+
+#include "upb/pb/encoder.h"
+#include "upb/pb/varint.int.h"
+
+#include "upb/port_def.inc"
+
+/* The output buffer is divided into segments; a segment is a string of data
+ * that is "ready to go" -- it does not need any varint lengths inserted into
+ * the middle.  The seams between segments are where varints will be inserted
+ * once they are known.
+ *
+ * We also use the concept of a "run", which is a range of encoded bytes that
+ * occur at a single submessage level.  Every segment contains one or more runs.
+ *
+ * A segment can span messages.  Consider:
+ *
+ *                  .--Submessage lengths---------.
+ *                  |       |                     |
+ *                  |       V                     V
+ *                  V      | |---------------    | |-----------------
+ * Submessages:    | |-----------------------------------------------
+ * Top-level msg: ------------------------------------------------------------
+ *
+ * Segments:          -----   -------------------   -----------------
+ * Runs:              *----   *--------------*---   *----------------
+ * (* marks the start)
+ *
+ * Note that the top-level menssage is not in any segment because it does not
+ * have any length preceding it.
+ *
+ * A segment is only interrupted when another length needs to be inserted.  So
+ * observe how the second segment spans both the inner submessage and part of
+ * the next enclosing message. */
+typedef struct {
+  uint32_t msglen;  /* The length to varint-encode before this segment. */
+  uint32_t seglen;  /* Length of the segment. */
+} upb_pb_encoder_segment;
+
+struct upb_pb_encoder {
+  upb_arena *arena;
+
+  /* Our input and output. */
+  upb_sink input_;
+  upb_bytessink output_;
+
+  /* The "subclosure" -- used as the inner closure as part of the bytessink
+   * protocol. */
+  void *subc;
+
+  /* The output buffer and limit, and our current write position.  "buf"
+   * initially points to "initbuf", but is dynamically allocated if we need to
+   * grow beyond the initial size. */
+  char *buf, *ptr, *limit;
+
+  /* The beginning of the current run, or undefined if we are at the top
+   * level. */
+  char *runbegin;
+
+  /* The list of segments we are accumulating. */
+  upb_pb_encoder_segment *segbuf, *segptr, *seglimit;
+
+  /* The stack of enclosing submessages.  Each entry in the stack points to the
+   * segment where this submessage's length is being accumulated. */
+  int *stack, *top, *stacklimit;
+
+  /* Depth of startmsg/endmsg calls. */
+  int depth;
+};
+
+/* low-level buffering ********************************************************/
+
+/* Low-level functions for interacting with the output buffer. */
+
+/* TODO(haberman): handle pushback */
+static void putbuf(upb_pb_encoder *e, const char *buf, size_t len) {
+  size_t n = upb_bytessink_putbuf(e->output_, e->subc, buf, len, NULL);
+  UPB_ASSERT(n == len);
+}
+
+static upb_pb_encoder_segment *top(upb_pb_encoder *e) {
+  return &e->segbuf[*e->top];
+}
+
+/* Call to ensure that at least "bytes" bytes are available for writing at
+ * e->ptr.  Returns false if the bytes could not be allocated. */
+static bool reserve(upb_pb_encoder *e, size_t bytes) {
+  if ((size_t)(e->limit - e->ptr) < bytes) {
+    /* Grow buffer. */
+    char *new_buf;
+    size_t needed = bytes + (e->ptr - e->buf);
+    size_t old_size = e->limit - e->buf;
+
+    size_t new_size = old_size;
+
+    while (new_size < needed) {
+      new_size *= 2;
+    }
+
+    new_buf = upb_arena_realloc(e->arena, e->buf, old_size, new_size);
+
+    if (new_buf == NULL) {
+      return false;
+    }
+
+    e->ptr = new_buf + (e->ptr - e->buf);
+    e->runbegin = new_buf + (e->runbegin - e->buf);
+    e->limit = new_buf + new_size;
+    e->buf = new_buf;
+  }
+
+  return true;
+}
+
+/* Call when "bytes" bytes have been writte at e->ptr.  The caller *must* have
+ * previously called reserve() with at least this many bytes. */
+static void encoder_advance(upb_pb_encoder *e, size_t bytes) {
+  UPB_ASSERT((size_t)(e->limit - e->ptr) >= bytes);
+  e->ptr += bytes;
+}
+
+/* Call when all of the bytes for a handler have been written.  Flushes the
+ * bytes if possible and necessary, returning false if this failed. */
+static bool commit(upb_pb_encoder *e) {
+  if (!e->top) {
+    /* We aren't inside a delimited region.  Flush our accumulated bytes to
+     * the output.
+     *
+     * TODO(haberman): in the future we may want to delay flushing for
+     * efficiency reasons. */
+    putbuf(e, e->buf, e->ptr - e->buf);
+    e->ptr = e->buf;
+  }
+
+  return true;
+}
+
+/* Writes the given bytes to the buffer, handling reserve/advance. */
+static bool encode_bytes(upb_pb_encoder *e, const void *data, size_t len) {
+  if (!reserve(e, len)) {
+    return false;
+  }
+
+  memcpy(e->ptr, data, len);
+  encoder_advance(e, len);
+  return true;
+}
+
+/* Finish the current run by adding the run totals to the segment and message
+ * length. */
+static void accumulate(upb_pb_encoder *e) {
+  size_t run_len;
+  UPB_ASSERT(e->ptr >= e->runbegin);
+  run_len = e->ptr - e->runbegin;
+  e->segptr->seglen += run_len;
+  top(e)->msglen += run_len;
+  e->runbegin = e->ptr;
+}
+
+/* Call to indicate the start of delimited region for which the full length is
+ * not yet known.  All data will be buffered until the length is known.
+ * Delimited regions may be nested; their lengths will all be tracked properly. */
+static bool start_delim(upb_pb_encoder *e) {
+  if (e->top) {
+    /* We are already buffering, advance to the next segment and push it on the
+     * stack. */
+    accumulate(e);
+
+    if (++e->top == e->stacklimit) {
+      /* TODO(haberman): grow stack? */
+      return false;
+    }
+
+    if (++e->segptr == e->seglimit) {
+      /* Grow segment buffer. */
+      size_t old_size =
+          (e->seglimit - e->segbuf) * sizeof(upb_pb_encoder_segment);
+      size_t new_size = old_size * 2;
+      upb_pb_encoder_segment *new_buf =
+          upb_arena_realloc(e->arena, e->segbuf, old_size, new_size);
+
+      if (new_buf == NULL) {
+        return false;
+      }
+
+      e->segptr = new_buf + (e->segptr - e->segbuf);
+      e->seglimit = new_buf + (new_size / sizeof(upb_pb_encoder_segment));
+      e->segbuf = new_buf;
+    }
+  } else {
+    /* We were previously at the top level, start buffering. */
+    e->segptr = e->segbuf;
+    e->top = e->stack;
+    e->runbegin = e->ptr;
+  }
+
+  *e->top = e->segptr - e->segbuf;
+  e->segptr->seglen = 0;
+  e->segptr->msglen = 0;
+
+  return true;
+}
+
+/* Call to indicate the end of a delimited region.  We now know the length of
+ * the delimited region.  If we are not nested inside any other delimited
+ * regions, we can now emit all of the buffered data we accumulated. */
+static bool end_delim(upb_pb_encoder *e) {
+  size_t msglen;
+  accumulate(e);
+  msglen = top(e)->msglen;
+
+  if (e->top == e->stack) {
+    /* All lengths are now available, emit all buffered data. */
+    char buf[UPB_PB_VARINT_MAX_LEN];
+    upb_pb_encoder_segment *s;
+    const char *ptr = e->buf;
+    for (s = e->segbuf; s <= e->segptr; s++) {
+      size_t lenbytes = upb_vencode64(s->msglen, buf);
+      putbuf(e, buf, lenbytes);
+      putbuf(e, ptr, s->seglen);
+      ptr += s->seglen;
+    }
+
+    e->ptr = e->buf;
+    e->top = NULL;
+  } else {
+    /* Need to keep buffering; propagate length info into enclosing
+     * submessages. */
+    --e->top;
+    top(e)->msglen += msglen + upb_varint_size(msglen);
+  }
+
+  return true;
+}
+
+
+/* tag_t **********************************************************************/
+
+/* A precomputed (pre-encoded) tag and length. */
+
+typedef struct {
+  uint8_t bytes;
+  char tag[7];
+} tag_t;
+
+/* Allocates a new tag for this field, and sets it in these handlerattr. */
+static void new_tag(upb_handlers *h, const upb_fielddef *f, upb_wiretype_t wt,
+                    upb_handlerattr *attr) {
+  uint32_t n = upb_fielddef_number(f);
+
+  tag_t *tag = upb_gmalloc(sizeof(tag_t));
+  tag->bytes = upb_vencode64((n << 3) | wt, tag->tag);
+
+  attr->handler_data = tag;
+  upb_handlers_addcleanup(h, tag, upb_gfree);
+}
+
+static bool encode_tag(upb_pb_encoder *e, const tag_t *tag) {
+  return encode_bytes(e, tag->tag, tag->bytes);
+}
+
+
+/* encoding of wire types *****************************************************/
+
+static bool encode_fixed64(upb_pb_encoder *e, uint64_t val) {
+  /* TODO(haberman): byte-swap for big endian. */
+  return encode_bytes(e, &val, sizeof(uint64_t));
+}
+
+static bool encode_fixed32(upb_pb_encoder *e, uint32_t val) {
+  /* TODO(haberman): byte-swap for big endian. */
+  return encode_bytes(e, &val, sizeof(uint32_t));
+}
+
+static bool encode_varint(upb_pb_encoder *e, uint64_t val) {
+  if (!reserve(e, UPB_PB_VARINT_MAX_LEN)) {
+    return false;
+  }
+
+  encoder_advance(e, upb_vencode64(val, e->ptr));
+  return true;
+}
+
+static uint64_t dbl2uint64(double d) {
+  uint64_t ret;
+  memcpy(&ret, &d, sizeof(uint64_t));
+  return ret;
+}
+
+static uint32_t flt2uint32(float d) {
+  uint32_t ret;
+  memcpy(&ret, &d, sizeof(uint32_t));
+  return ret;
+}
+
+
+/* encoding of proto types ****************************************************/
+
+static bool startmsg(void *c, const void *hd) {
+  upb_pb_encoder *e = c;
+  UPB_UNUSED(hd);
+  if (e->depth++ == 0) {
+    upb_bytessink_start(e->output_, 0, &e->subc);
+  }
+  return true;
+}
+
+static bool endmsg(void *c, const void *hd, upb_status *status) {
+  upb_pb_encoder *e = c;
+  UPB_UNUSED(hd);
+  UPB_UNUSED(status);
+  if (--e->depth == 0) {
+    upb_bytessink_end(e->output_);
+  }
+  return true;
+}
+
+static void *encode_startdelimfield(void *c, const void *hd) {
+  bool ok = encode_tag(c, hd) && commit(c) && start_delim(c);
+  return ok ? c : UPB_BREAK;
+}
+
+static bool encode_unknown(void *c, const void *hd, const char *buf,
+                           size_t len) {
+  UPB_UNUSED(hd);
+  return encode_bytes(c, buf, len) && commit(c);
+}
+
+static bool encode_enddelimfield(void *c, const void *hd) {
+  UPB_UNUSED(hd);
+  return end_delim(c);
+}
+
+static void *encode_startgroup(void *c, const void *hd) {
+  return (encode_tag(c, hd) && commit(c)) ? c : UPB_BREAK;
+}
+
+static bool encode_endgroup(void *c, const void *hd) {
+  return encode_tag(c, hd) && commit(c);
+}
+
+static void *encode_startstr(void *c, const void *hd, size_t size_hint) {
+  UPB_UNUSED(size_hint);
+  return encode_startdelimfield(c, hd);
+}
+
+static size_t encode_strbuf(void *c, const void *hd, const char *buf,
+                            size_t len, const upb_bufhandle *h) {
+  UPB_UNUSED(hd);
+  UPB_UNUSED(h);
+  return encode_bytes(c, buf, len) ? len : 0;
+}
+
+#define T(type, ctype, convert, encode)                                  \
+  static bool encode_scalar_##type(void *e, const void *hd, ctype val) { \
+    return encode_tag(e, hd) && encode(e, (convert)(val)) && commit(e);  \
+  }                                                                      \
+  static bool encode_packed_##type(void *e, const void *hd, ctype val) { \
+    UPB_UNUSED(hd);                                                      \
+    return encode(e, (convert)(val));                                    \
+  }
+
+T(double,   double,   dbl2uint64,   encode_fixed64)
+T(float,    float,    flt2uint32,   encode_fixed32)
+T(int64,    int64_t,  uint64_t,     encode_varint)
+T(int32,    int32_t,  int64_t,      encode_varint)
+T(fixed64,  uint64_t, uint64_t,     encode_fixed64)
+T(fixed32,  uint32_t, uint32_t,     encode_fixed32)
+T(bool,     bool,     bool,         encode_varint)
+T(uint32,   uint32_t, uint32_t,     encode_varint)
+T(uint64,   uint64_t, uint64_t,     encode_varint)
+T(enum,     int32_t,  uint32_t,     encode_varint)
+T(sfixed32, int32_t,  uint32_t,     encode_fixed32)
+T(sfixed64, int64_t,  uint64_t,     encode_fixed64)
+T(sint32,   int32_t,  upb_zzenc_32, encode_varint)
+T(sint64,   int64_t,  upb_zzenc_64, encode_varint)
+
+#undef T
+
+
+/* code to build the handlers *************************************************/
+
+#include <stdio.h>
+static void newhandlers_callback(const void *closure, upb_handlers *h) {
+  const upb_msgdef *m;
+  upb_msg_field_iter i;
+
+  UPB_UNUSED(closure);
+
+  upb_handlers_setstartmsg(h, startmsg, NULL);
+  upb_handlers_setendmsg(h, endmsg, NULL);
+  upb_handlers_setunknown(h, encode_unknown, NULL);
+
+  m = upb_handlers_msgdef(h);
+  for(upb_msg_field_begin(&i, m);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    const upb_fielddef *f = upb_msg_iter_field(&i);
+    bool packed = upb_fielddef_isseq(f) && upb_fielddef_isprimitive(f) &&
+                  upb_fielddef_packed(f);
+    upb_handlerattr attr = UPB_HANDLERATTR_INIT;
+    upb_wiretype_t wt =
+        packed ? UPB_WIRE_TYPE_DELIMITED
+               : upb_pb_native_wire_types[upb_fielddef_descriptortype(f)];
+
+    /* Pre-encode the tag for this field. */
+    new_tag(h, f, wt, &attr);
+
+    if (packed) {
+      upb_handlers_setstartseq(h, f, encode_startdelimfield, &attr);
+      upb_handlers_setendseq(h, f, encode_enddelimfield, &attr);
+    }
+
+#define T(upper, lower, upbtype)                                     \
+  case UPB_DESCRIPTOR_TYPE_##upper:                                  \
+    if (packed) {                                                    \
+      upb_handlers_set##upbtype(h, f, encode_packed_##lower, &attr); \
+    } else {                                                         \
+      upb_handlers_set##upbtype(h, f, encode_scalar_##lower, &attr); \
+    }                                                                \
+    break;
+
+    switch (upb_fielddef_descriptortype(f)) {
+      T(DOUBLE,   double,   double);
+      T(FLOAT,    float,    float);
+      T(INT64,    int64,    int64);
+      T(INT32,    int32,    int32);
+      T(FIXED64,  fixed64,  uint64);
+      T(FIXED32,  fixed32,  uint32);
+      T(BOOL,     bool,     bool);
+      T(UINT32,   uint32,   uint32);
+      T(UINT64,   uint64,   uint64);
+      T(ENUM,     enum,     int32);
+      T(SFIXED32, sfixed32, int32);
+      T(SFIXED64, sfixed64, int64);
+      T(SINT32,   sint32,   int32);
+      T(SINT64,   sint64,   int64);
+      case UPB_DESCRIPTOR_TYPE_STRING:
+      case UPB_DESCRIPTOR_TYPE_BYTES:
+        upb_handlers_setstartstr(h, f, encode_startstr, &attr);
+        upb_handlers_setendstr(h, f, encode_enddelimfield, &attr);
+        upb_handlers_setstring(h, f, encode_strbuf, &attr);
+        break;
+      case UPB_DESCRIPTOR_TYPE_MESSAGE:
+        upb_handlers_setstartsubmsg(h, f, encode_startdelimfield, &attr);
+        upb_handlers_setendsubmsg(h, f, encode_enddelimfield, &attr);
+        break;
+      case UPB_DESCRIPTOR_TYPE_GROUP: {
+        /* Endgroup takes a different tag (wire_type = END_GROUP). */
+        upb_handlerattr attr2 = UPB_HANDLERATTR_INIT;
+        new_tag(h, f, UPB_WIRE_TYPE_END_GROUP, &attr2);
+
+        upb_handlers_setstartsubmsg(h, f, encode_startgroup, &attr);
+        upb_handlers_setendsubmsg(h, f, encode_endgroup, &attr2);
+
+        break;
+      }
+    }
+
+#undef T
+  }
+}
+
+void upb_pb_encoder_reset(upb_pb_encoder *e) {
+  e->segptr = NULL;
+  e->top = NULL;
+  e->depth = 0;
+}
+
+
+/* public API *****************************************************************/
+
+upb_handlercache *upb_pb_encoder_newcache(void) {
+  return upb_handlercache_new(newhandlers_callback, NULL);
+}
+
+upb_pb_encoder *upb_pb_encoder_create(upb_arena *arena, const upb_handlers *h,
+                                      upb_bytessink output) {
+  const size_t initial_bufsize = 256;
+  const size_t initial_segbufsize = 16;
+  /* TODO(haberman): make this configurable. */
+  const size_t stack_size = 64;
+#ifndef NDEBUG
+  const size_t size_before = upb_arena_bytesallocated(arena);
+#endif
+
+  upb_pb_encoder *e = upb_arena_malloc(arena, sizeof(upb_pb_encoder));
+  if (!e) return NULL;
+
+  e->buf = upb_arena_malloc(arena, initial_bufsize);
+  e->segbuf = upb_arena_malloc(arena, initial_segbufsize * sizeof(*e->segbuf));
+  e->stack = upb_arena_malloc(arena, stack_size * sizeof(*e->stack));
+
+  if (!e->buf || !e->segbuf || !e->stack) {
+    return NULL;
+  }
+
+  e->limit = e->buf + initial_bufsize;
+  e->seglimit = e->segbuf + initial_segbufsize;
+  e->stacklimit = e->stack + stack_size;
+
+  upb_pb_encoder_reset(e);
+  upb_sink_reset(&e->input_, h, e);
+
+  e->arena = arena;
+  e->output_ = output;
+  e->subc = output.closure;
+  e->ptr = e->buf;
+
+  /* If this fails, increase the value in encoder.h. */
+  UPB_ASSERT_DEBUGVAR(upb_arena_bytesallocated(arena) - size_before <=
+                      UPB_PB_ENCODER_SIZE);
+  return e;
+}
+
+upb_sink upb_pb_encoder_input(upb_pb_encoder *e) { return e->input_; }
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/encoder.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/encoder.h
new file mode 100644 (file)
index 0000000..f125b37
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+** upb::pb::Encoder (upb_pb_encoder)
+**
+** Implements a set of upb_handlers that write protobuf data to the binary wire
+** format.
+**
+** This encoder implementation does not have any access to any out-of-band or
+** precomputed lengths for submessages, so it must buffer submessages internally
+** before it can emit the first byte.
+*/
+
+#ifndef UPB_ENCODER_H_
+#define UPB_ENCODER_H_
+
+#include "upb/sink.h"
+
+#ifdef __cplusplus
+namespace upb {
+namespace pb {
+class EncoderPtr;
+}  /* namespace pb */
+}  /* namespace upb */
+#endif
+
+#define UPB_PBENCODER_MAX_NESTING 100
+
+/* upb_pb_encoder *************************************************************/
+
+/* Preallocation hint: decoder won't allocate more bytes than this when first
+ * constructed.  This hint may be an overestimate for some build configurations.
+ * But if the decoder library is upgraded without recompiling the application,
+ * it may be an underestimate. */
+#define UPB_PB_ENCODER_SIZE 784
+
+struct upb_pb_encoder;
+typedef struct upb_pb_encoder upb_pb_encoder;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+upb_sink upb_pb_encoder_input(upb_pb_encoder *p);
+upb_pb_encoder* upb_pb_encoder_create(upb_arena* a, const upb_handlers* h,
+                                      upb_bytessink output);
+
+/* Lazily builds and caches handlers that will push encoded data to a bytessink.
+ * Any msgdef objects used with this object must outlive it. */
+upb_handlercache *upb_pb_encoder_newcache(void);
+
+#ifdef __cplusplus
+}  /* extern "C" { */
+
+class upb::pb::EncoderPtr {
+ public:
+  EncoderPtr(upb_pb_encoder* ptr) : ptr_(ptr) {}
+
+  upb_pb_encoder* ptr() { return ptr_; }
+
+  /* Creates a new encoder in the given environment.  The Handlers must have
+   * come from NewHandlers() below. */
+  static EncoderPtr Create(Arena* arena, const Handlers* handlers,
+                           BytesSink output) {
+    return EncoderPtr(
+        upb_pb_encoder_create(arena->ptr(), handlers, output.sink()));
+  }
+
+  /* The input to the encoder. */
+  upb::Sink input() { return upb_pb_encoder_input(ptr()); }
+
+  /* Creates a new set of handlers for this MessageDef. */
+  static HandlerCache NewCache() {
+    return HandlerCache(upb_pb_encoder_newcache());
+  }
+
+  static const size_t kSize = UPB_PB_ENCODER_SIZE;
+
+ private:
+  upb_pb_encoder* ptr_;
+};
+
+#endif  /* __cplusplus */
+
+#endif  /* UPB_ENCODER_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/textprinter.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/textprinter.c
new file mode 100644 (file)
index 0000000..0760173
--- /dev/null
@@ -0,0 +1,340 @@
+/*
+ * upb::pb::TextPrinter
+ *
+ * OPT: This is not optimized at all.  It uses printf() which parses the format
+ * string every time, and it allocates memory for every put.
+ */
+
+#include "upb/pb/textprinter.h"
+
+#include <ctype.h>
+#include <float.h>
+#include <inttypes.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "upb/sink.h"
+
+#include "upb/port_def.inc"
+
+struct upb_textprinter {
+  upb_sink input_;
+  upb_bytessink output_;
+  int indent_depth_;
+  bool single_line_;
+  void *subc;
+};
+
+#define CHECK(x) if ((x) < 0) goto err;
+
+static const char *shortname(const char *longname) {
+  const char *last = strrchr(longname, '.');
+  return last ? last + 1 : longname;
+}
+
+static int indent(upb_textprinter *p) {
+  int i;
+  if (!p->single_line_)
+    for (i = 0; i < p->indent_depth_; i++)
+      upb_bytessink_putbuf(p->output_, p->subc, "  ", 2, NULL);
+  return 0;
+}
+
+static int endfield(upb_textprinter *p) {
+  const char ch = (p->single_line_ ? ' ' : '\n');
+  upb_bytessink_putbuf(p->output_, p->subc, &ch, 1, NULL);
+  return 0;
+}
+
+static int putescaped(upb_textprinter *p, const char *buf, size_t len,
+                      bool preserve_utf8) {
+  /* Based on CEscapeInternal() from Google's protobuf release. */
+  char dstbuf[4096], *dst = dstbuf, *dstend = dstbuf + sizeof(dstbuf);
+  const char *end = buf + len;
+
+  /* I think hex is prettier and more useful, but proto2 uses octal; should
+   * investigate whether it can parse hex also. */
+  const bool use_hex = false;
+  bool last_hex_escape = false; /* true if last output char was \xNN */
+
+  for (; buf < end; buf++) {
+    bool is_hex_escape;
+
+    if (dstend - dst < 4) {
+      upb_bytessink_putbuf(p->output_, p->subc, dstbuf, dst - dstbuf, NULL);
+      dst = dstbuf;
+    }
+
+    is_hex_escape = false;
+    switch (*buf) {
+      case '\n': *(dst++) = '\\'; *(dst++) = 'n';  break;
+      case '\r': *(dst++) = '\\'; *(dst++) = 'r';  break;
+      case '\t': *(dst++) = '\\'; *(dst++) = 't';  break;
+      case '\"': *(dst++) = '\\'; *(dst++) = '\"'; break;
+      case '\'': *(dst++) = '\\'; *(dst++) = '\''; break;
+      case '\\': *(dst++) = '\\'; *(dst++) = '\\'; break;
+      default:
+        /* Note that if we emit \xNN and the buf character after that is a hex
+         * digit then that digit must be escaped too to prevent it being
+         * interpreted as part of the character code by C. */
+        if ((!preserve_utf8 || (uint8_t)*buf < 0x80) &&
+            (!isprint(*buf) || (last_hex_escape && isxdigit(*buf)))) {
+          sprintf(dst, (use_hex ? "\\x%02x" : "\\%03o"), (uint8_t)*buf);
+          is_hex_escape = use_hex;
+          dst += 4;
+        } else {
+          *(dst++) = *buf; break;
+        }
+    }
+    last_hex_escape = is_hex_escape;
+  }
+  /* Flush remaining data. */
+  upb_bytessink_putbuf(p->output_, p->subc, dstbuf, dst - dstbuf, NULL);
+  return 0;
+}
+
+bool putf(upb_textprinter *p, const char *fmt, ...) {
+  va_list args;
+  va_list args_copy;
+  char *str;
+  int written;
+  int len;
+  bool ok;
+
+  va_start(args, fmt);
+
+  /* Run once to get the length of the string. */
+  _upb_va_copy(args_copy, args);
+  len = _upb_vsnprintf(NULL, 0, fmt, args_copy);
+  va_end(args_copy);
+
+  /* + 1 for NULL terminator (vsprintf() requires it even if we don't). */
+  str = upb_gmalloc(len + 1);
+  if (!str) return false;
+  written = vsprintf(str, fmt, args);
+  va_end(args);
+  UPB_ASSERT(written == len);
+
+  ok = upb_bytessink_putbuf(p->output_, p->subc, str, len, NULL);
+  upb_gfree(str);
+  return ok;
+}
+
+
+/* handlers *******************************************************************/
+
+static bool textprinter_startmsg(void *c, const void *hd) {
+  upb_textprinter *p = c;
+  UPB_UNUSED(hd);
+  if (p->indent_depth_ == 0) {
+    upb_bytessink_start(p->output_, 0, &p->subc);
+  }
+  return true;
+}
+
+static bool textprinter_endmsg(void *c, const void *hd, upb_status *s) {
+  upb_textprinter *p = c;
+  UPB_UNUSED(hd);
+  UPB_UNUSED(s);
+  if (p->indent_depth_ == 0) {
+    upb_bytessink_end(p->output_);
+  }
+  return true;
+}
+
+#define TYPE(name, ctype, fmt) \
+  static bool textprinter_put ## name(void *closure, const void *handler_data, \
+                                      ctype val) {                             \
+    upb_textprinter *p = closure;                                              \
+    const upb_fielddef *f = handler_data;                                      \
+    CHECK(indent(p));                                                          \
+    putf(p, "%s: " fmt, upb_fielddef_name(f), val);                            \
+    CHECK(endfield(p));                                                        \
+    return true;                                                               \
+  err:                                                                         \
+    return false;                                                              \
+}
+
+static bool textprinter_putbool(void *closure, const void *handler_data,
+                                bool val) {
+  upb_textprinter *p = closure;
+  const upb_fielddef *f = handler_data;
+  CHECK(indent(p));
+  putf(p, "%s: %s", upb_fielddef_name(f), val ? "true" : "false");
+  CHECK(endfield(p));
+  return true;
+err:
+  return false;
+}
+
+#define STRINGIFY_HELPER(x) #x
+#define STRINGIFY_MACROVAL(x) STRINGIFY_HELPER(x)
+
+TYPE(int32,  int32_t,  "%" PRId32)
+TYPE(int64,  int64_t,  "%" PRId64)
+TYPE(uint32, uint32_t, "%" PRIu32)
+TYPE(uint64, uint64_t, "%" PRIu64)
+TYPE(float,  float,    "%." STRINGIFY_MACROVAL(FLT_DIG) "g")
+TYPE(double, double,   "%." STRINGIFY_MACROVAL(DBL_DIG) "g")
+
+#undef TYPE
+
+/* Output a symbolic value from the enum if found, else just print as int32. */
+static bool textprinter_putenum(void *closure, const void *handler_data,
+                                int32_t val) {
+  upb_textprinter *p = closure;
+  const upb_fielddef *f = handler_data;
+  const upb_enumdef *enum_def = upb_fielddef_enumsubdef(f);
+  const char *label = upb_enumdef_iton(enum_def, val);
+  if (label) {
+    indent(p);
+    putf(p, "%s: %s", upb_fielddef_name(f), label);
+    endfield(p);
+  } else {
+    if (!textprinter_putint32(closure, handler_data, val))
+      return false;
+  }
+  return true;
+}
+
+static void *textprinter_startstr(void *closure, const void *handler_data,
+                      size_t size_hint) {
+  upb_textprinter *p = closure;
+  const upb_fielddef *f = handler_data;
+  UPB_UNUSED(size_hint);
+  indent(p);
+  putf(p, "%s: \"", upb_fielddef_name(f));
+  return p;
+}
+
+static bool textprinter_endstr(void *closure, const void *handler_data) {
+  upb_textprinter *p = closure;
+  UPB_UNUSED(handler_data);
+  putf(p, "\"");
+  endfield(p);
+  return true;
+}
+
+static size_t textprinter_putstr(void *closure, const void *hd, const char *buf,
+                                 size_t len, const upb_bufhandle *handle) {
+  upb_textprinter *p = closure;
+  const upb_fielddef *f = hd;
+  UPB_UNUSED(handle);
+  CHECK(putescaped(p, buf, len, upb_fielddef_type(f) == UPB_TYPE_STRING));
+  return len;
+err:
+  return 0;
+}
+
+static void *textprinter_startsubmsg(void *closure, const void *handler_data) {
+  upb_textprinter *p = closure;
+  const char *name = handler_data;
+  CHECK(indent(p));
+  putf(p, "%s {%c", name, p->single_line_ ? ' ' : '\n');
+  p->indent_depth_++;
+  return p;
+err:
+  return UPB_BREAK;
+}
+
+static bool textprinter_endsubmsg(void *closure, const void *handler_data) {
+  upb_textprinter *p = closure;
+  UPB_UNUSED(handler_data);
+  p->indent_depth_--;
+  CHECK(indent(p));
+  upb_bytessink_putbuf(p->output_, p->subc, "}", 1, NULL);
+  CHECK(endfield(p));
+  return true;
+err:
+  return false;
+}
+
+static void onmreg(const void *c, upb_handlers *h) {
+  const upb_msgdef *m = upb_handlers_msgdef(h);
+  upb_msg_field_iter i;
+  UPB_UNUSED(c);
+
+  upb_handlers_setstartmsg(h, textprinter_startmsg, NULL);
+  upb_handlers_setendmsg(h, textprinter_endmsg, NULL);
+
+  for(upb_msg_field_begin(&i, m);
+      !upb_msg_field_done(&i);
+      upb_msg_field_next(&i)) {
+    upb_fielddef *f = upb_msg_iter_field(&i);
+    upb_handlerattr attr = UPB_HANDLERATTR_INIT;
+    attr.handler_data = f;
+    switch (upb_fielddef_type(f)) {
+      case UPB_TYPE_INT32:
+        upb_handlers_setint32(h, f, textprinter_putint32, &attr);
+        break;
+      case UPB_TYPE_INT64:
+        upb_handlers_setint64(h, f, textprinter_putint64, &attr);
+        break;
+      case UPB_TYPE_UINT32:
+        upb_handlers_setuint32(h, f, textprinter_putuint32, &attr);
+        break;
+      case UPB_TYPE_UINT64:
+        upb_handlers_setuint64(h, f, textprinter_putuint64, &attr);
+        break;
+      case UPB_TYPE_FLOAT:
+        upb_handlers_setfloat(h, f, textprinter_putfloat, &attr);
+        break;
+      case UPB_TYPE_DOUBLE:
+        upb_handlers_setdouble(h, f, textprinter_putdouble, &attr);
+        break;
+      case UPB_TYPE_BOOL:
+        upb_handlers_setbool(h, f, textprinter_putbool, &attr);
+        break;
+      case UPB_TYPE_STRING:
+      case UPB_TYPE_BYTES:
+        upb_handlers_setstartstr(h, f, textprinter_startstr, &attr);
+        upb_handlers_setstring(h, f, textprinter_putstr, &attr);
+        upb_handlers_setendstr(h, f, textprinter_endstr, &attr);
+        break;
+      case UPB_TYPE_MESSAGE: {
+        const char *name =
+            upb_fielddef_descriptortype(f) == UPB_DESCRIPTOR_TYPE_GROUP
+                ? shortname(upb_msgdef_fullname(upb_fielddef_msgsubdef(f)))
+                : upb_fielddef_name(f);
+        attr.handler_data = name;
+        upb_handlers_setstartsubmsg(h, f, textprinter_startsubmsg, &attr);
+        upb_handlers_setendsubmsg(h, f, textprinter_endsubmsg, &attr);
+        break;
+      }
+      case UPB_TYPE_ENUM:
+        upb_handlers_setint32(h, f, textprinter_putenum, &attr);
+        break;
+    }
+  }
+}
+
+static void textprinter_reset(upb_textprinter *p, bool single_line) {
+  p->single_line_ = single_line;
+  p->indent_depth_ = 0;
+}
+
+
+/* Public API *****************************************************************/
+
+upb_textprinter *upb_textprinter_create(upb_arena *arena, const upb_handlers *h,
+                                        upb_bytessink output) {
+  upb_textprinter *p = upb_arena_malloc(arena, sizeof(upb_textprinter));
+  if (!p) return NULL;
+
+  p->output_ = output;
+  upb_sink_reset(&p->input_, h, p);
+  textprinter_reset(p, false);
+
+  return p;
+}
+
+upb_handlercache *upb_textprinter_newcache(void) {
+  return upb_handlercache_new(&onmreg, NULL);
+}
+
+upb_sink upb_textprinter_input(upb_textprinter *p) { return p->input_; }
+
+void upb_textprinter_setsingleline(upb_textprinter *p, bool single_line) {
+  p->single_line_ = single_line;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/textprinter.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/textprinter.h
new file mode 100644 (file)
index 0000000..7e20d75
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+** upb::pb::TextPrinter (upb_textprinter)
+**
+** Handlers for writing to protobuf text format.
+*/
+
+#ifndef UPB_TEXT_H_
+#define UPB_TEXT_H_
+
+#include "upb/sink.h"
+
+#ifdef __cplusplus
+namespace upb {
+namespace pb {
+class TextPrinterPtr;
+}  /* namespace pb */
+}  /* namespace upb */
+#endif
+
+/* upb_textprinter ************************************************************/
+
+struct upb_textprinter;
+typedef struct upb_textprinter upb_textprinter;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* C API. */
+upb_textprinter *upb_textprinter_create(upb_arena *arena, const upb_handlers *h,
+                                        upb_bytessink output);
+void upb_textprinter_setsingleline(upb_textprinter *p, bool single_line);
+upb_sink upb_textprinter_input(upb_textprinter *p);
+upb_handlercache *upb_textprinter_newcache(void);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+class upb::pb::TextPrinterPtr {
+ public:
+  TextPrinterPtr(upb_textprinter* ptr) : ptr_(ptr) {}
+
+  /* The given handlers must have come from NewHandlers().  It must outlive the
+   * TextPrinter. */
+  static TextPrinterPtr Create(Arena *arena, upb::HandlersPtr *handlers,
+                               BytesSink output) {
+    return TextPrinterPtr(
+        upb_textprinter_create(arena->ptr(), handlers->ptr(), output.sink()));
+  }
+
+  void SetSingleLineMode(bool single_line) {
+    upb_textprinter_setsingleline(ptr_, single_line);
+  }
+
+  Sink input() { return upb_textprinter_input(ptr_); }
+
+  /* If handler caching becomes a requirement we can add a code cache as in
+   * decoder.h */
+  static HandlerCache NewCache() {
+    return HandlerCache(upb_textprinter_newcache());
+  }
+
+ private:
+  upb_textprinter* ptr_;
+};
+
+#endif
+
+#endif  /* UPB_TEXT_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/varint.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/varint.c
new file mode 100644 (file)
index 0000000..90f58a1
--- /dev/null
@@ -0,0 +1,74 @@
+
+#include "upb/pb/varint.int.h"
+
+/* Index is descriptor type. */
+const uint8_t upb_pb_native_wire_types[] = {
+  UPB_WIRE_TYPE_END_GROUP,     /* ENDGROUP */
+  UPB_WIRE_TYPE_64BIT,         /* DOUBLE */
+  UPB_WIRE_TYPE_32BIT,         /* FLOAT */
+  UPB_WIRE_TYPE_VARINT,        /* INT64 */
+  UPB_WIRE_TYPE_VARINT,        /* UINT64 */
+  UPB_WIRE_TYPE_VARINT,        /* INT32 */
+  UPB_WIRE_TYPE_64BIT,         /* FIXED64 */
+  UPB_WIRE_TYPE_32BIT,         /* FIXED32 */
+  UPB_WIRE_TYPE_VARINT,        /* BOOL */
+  UPB_WIRE_TYPE_DELIMITED,     /* STRING */
+  UPB_WIRE_TYPE_START_GROUP,   /* GROUP */
+  UPB_WIRE_TYPE_DELIMITED,     /* MESSAGE */
+  UPB_WIRE_TYPE_DELIMITED,     /* BYTES */
+  UPB_WIRE_TYPE_VARINT,        /* UINT32 */
+  UPB_WIRE_TYPE_VARINT,        /* ENUM */
+  UPB_WIRE_TYPE_32BIT,         /* SFIXED32 */
+  UPB_WIRE_TYPE_64BIT,         /* SFIXED64 */
+  UPB_WIRE_TYPE_VARINT,        /* SINT32 */
+  UPB_WIRE_TYPE_VARINT,        /* SINT64 */
+};
+
+/* A basic branch-based decoder, uses 32-bit values to get good performance
+ * on 32-bit architectures (but performs well on 64-bits also).
+ * This scheme comes from the original Google Protobuf implementation
+ * (proto2). */
+upb_decoderet upb_vdecode_max8_branch32(upb_decoderet r) {
+  upb_decoderet err = {NULL, 0};
+  const char *p = r.p;
+  uint32_t low = (uint32_t)r.val;
+  uint32_t high = 0;
+  uint32_t b;
+  b = *(p++); low  |= (b & 0x7fU) << 14; if (!(b & 0x80)) goto done;
+  b = *(p++); low  |= (b & 0x7fU) << 21; if (!(b & 0x80)) goto done;
+  b = *(p++); low  |= (b & 0x7fU) << 28;
+              high  = (b & 0x7fU) >>  4; if (!(b & 0x80)) goto done;
+  b = *(p++); high |= (b & 0x7fU) <<  3; if (!(b & 0x80)) goto done;
+  b = *(p++); high |= (b & 0x7fU) << 10; if (!(b & 0x80)) goto done;
+  b = *(p++); high |= (b & 0x7fU) << 17; if (!(b & 0x80)) goto done;
+  b = *(p++); high |= (b & 0x7fU) << 24; if (!(b & 0x80)) goto done;
+  b = *(p++); high |= (b & 0x7fU) << 31; if (!(b & 0x80)) goto done;
+  return err;
+
+done:
+  r.val = ((uint64_t)high << 32) | low;
+  r.p = p;
+  return r;
+}
+
+/* Like the previous, but uses 64-bit values. */
+upb_decoderet upb_vdecode_max8_branch64(upb_decoderet r) {
+  const char *p = r.p;
+  uint64_t val = r.val;
+  uint64_t b;
+  upb_decoderet err = {NULL, 0};
+  b = *(p++); val |= (b & 0x7fU) << 14; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 21; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 28; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 35; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 42; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 49; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 56; if (!(b & 0x80)) goto done;
+  b = *(p++); val |= (b & 0x7fU) << 63; if (!(b & 0x80)) goto done;
+  return err;
+
+done:
+  r.val = val;
+  r.p = p;
+  return r;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/varint.int.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/pb/varint.int.h
new file mode 100644 (file)
index 0000000..ff1ca66
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+** A number of routines for varint manipulation (we keep them all around to
+** have multiple approaches available for benchmarking).
+*/
+
+#ifndef UPB_VARINT_DECODER_H_
+#define UPB_VARINT_DECODER_H_
+
+#include <assert.h>
+#include <stdint.h>
+#include <string.h>
+#include "upb/upb.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UPB_MAX_WIRE_TYPE 5
+
+/* The maximum number of bytes that it takes to encode a 64-bit varint. */
+#define UPB_PB_VARINT_MAX_LEN 10
+
+/* Array of the "native" (ie. non-packed-repeated) wire type for the given a
+ * descriptor type (upb_descriptortype_t). */
+extern const uint8_t upb_pb_native_wire_types[];
+
+UPB_INLINE uint64_t byteswap64(uint64_t val)
+{
+  return ((((val) & 0xff00000000000000ull) >> 56)
+    | (((val) & 0x00ff000000000000ull) >> 40)
+    | (((val) & 0x0000ff0000000000ull) >> 24)
+    | (((val) & 0x000000ff00000000ull) >> 8)
+    | (((val) & 0x00000000ff000000ull) << 8)
+    | (((val) & 0x0000000000ff0000ull) << 24)
+    | (((val) & 0x000000000000ff00ull) << 40)
+    | (((val) & 0x00000000000000ffull) << 56));
+}
+
+/* Zig-zag encoding/decoding **************************************************/
+
+UPB_INLINE int32_t upb_zzdec_32(uint32_t n) {
+  return (n >> 1) ^ -(int32_t)(n & 1);
+}
+UPB_INLINE int64_t upb_zzdec_64(uint64_t n) {
+  return (n >> 1) ^ -(int64_t)(n & 1);
+}
+UPB_INLINE uint32_t upb_zzenc_32(int32_t n) {
+  return ((uint32_t)n << 1) ^ (n >> 31);
+}
+UPB_INLINE uint64_t upb_zzenc_64(int64_t n) {
+  return ((uint64_t)n << 1) ^ (n >> 63);
+}
+
+/* Decoding *******************************************************************/
+
+/* All decoding functions return this struct by value. */
+typedef struct {
+  const char *p;  /* NULL if the varint was unterminated. */
+  uint64_t val;
+} upb_decoderet;
+
+UPB_INLINE upb_decoderet upb_decoderet_make(const char *p, uint64_t val) {
+  upb_decoderet ret;
+  ret.p = p;
+  ret.val = val;
+  return ret;
+}
+
+upb_decoderet upb_vdecode_max8_branch32(upb_decoderet r);
+upb_decoderet upb_vdecode_max8_branch64(upb_decoderet r);
+
+/* Template for a function that checks the first two bytes with branching
+ * and dispatches 2-10 bytes with a separate function.  Note that this may read
+ * up to 10 bytes, so it must not be used unless there are at least ten bytes
+ * left in the buffer! */
+#define UPB_VARINT_DECODER_CHECK2(name, decode_max8_function)                  \
+UPB_INLINE upb_decoderet upb_vdecode_check2_ ## name(const char *_p) {         \
+  uint8_t *p = (uint8_t*)_p;                                                   \
+  upb_decoderet r;                                                             \
+  if ((*p & 0x80) == 0) {                                                      \
+  /* Common case: one-byte varint. */                                          \
+    return upb_decoderet_make(_p + 1, *p & 0x7fU);                             \
+  }                                                                            \
+  r = upb_decoderet_make(_p + 2, (*p & 0x7fU) | ((*(p + 1) & 0x7fU) << 7));    \
+  if ((*(p + 1) & 0x80) == 0) {                                                \
+    /* Two-byte varint. */                                                     \
+    return r;                                                                  \
+  }                                                                            \
+  /* Longer varint, fallback to out-of-line function. */                       \
+  return decode_max8_function(r);                                              \
+}
+
+UPB_VARINT_DECODER_CHECK2(branch32, upb_vdecode_max8_branch32)
+UPB_VARINT_DECODER_CHECK2(branch64, upb_vdecode_max8_branch64)
+#undef UPB_VARINT_DECODER_CHECK2
+
+/* Our canonical functions for decoding varints, based on the currently
+ * favored best-performing implementations. */
+UPB_INLINE upb_decoderet upb_vdecode_fast(const char *p) {
+  if (sizeof(long) == 8)
+    return upb_vdecode_check2_branch64(p);
+  else
+    return upb_vdecode_check2_branch32(p);
+}
+
+
+/* Encoding *******************************************************************/
+
+UPB_INLINE int upb_value_size(uint64_t val) {
+#ifdef __GNUC__
+  int high_bit = 63 - __builtin_clzll(val);  /* 0-based, undef if val == 0. */
+#else
+  int high_bit = 0;
+  uint64_t tmp = val;
+  while(tmp >>= 1) high_bit++;
+#endif
+  return val == 0 ? 1 : high_bit / 8 + 1;
+}
+
+/* Encodes a 64-bit varint into buf (which must be >=UPB_PB_VARINT_MAX_LEN
+ * bytes long), returning how many bytes were used.
+ *
+ * TODO: benchmark and optimize if necessary. */
+UPB_INLINE size_t upb_vencode64(uint64_t val, char *buf) {
+  size_t i;
+  if (val == 0) { buf[0] = 0; return 1; }
+  i = 0;
+  while (val) {
+    uint8_t byte = val & 0x7fU;
+    val >>= 7;
+    if (val) byte |= 0x80U;
+    buf[i++] = byte;
+  }
+  return i;
+}
+
+UPB_INLINE size_t upb_varint_size(uint64_t val) {
+  char buf[UPB_PB_VARINT_MAX_LEN];
+  return upb_vencode64(val, buf);
+}
+
+/* Encodes a 32-bit varint, *not* sign-extended. */
+UPB_INLINE uint64_t upb_vencode32(uint32_t val) {
+  char buf[UPB_PB_VARINT_MAX_LEN];
+  size_t bytes = upb_vencode64(val, buf);
+  uint64_t ret = 0;
+  UPB_ASSERT(bytes <= 5);
+  memcpy(&ret, buf, bytes);
+#ifdef UPB_BIG_ENDIAN
+  ret = byteswap64(ret);
+#endif
+  UPB_ASSERT(ret <= 0xffffffffffU);
+  return ret;
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* UPB_VARINT_DECODER_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/port.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/port.c
new file mode 100644 (file)
index 0000000..023f7dc
--- /dev/null
@@ -0,0 +1,27 @@
+
+#include "upb/upb.h"
+#include "upb/port_def.inc"
+
+#ifdef UPB_MSVC_VSNPRINTF
+/* Visual C++ earlier than 2015 doesn't have standard C99 snprintf and
+ * vsnprintf. To support them, missing functions are manually implemented
+ * using the existing secure functions. */
+int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg) {
+  if (!s) {
+    return _vscprintf(format, arg);
+  }
+  int ret = _vsnprintf_s(s, n, _TRUNCATE, format, arg);
+  if (ret < 0) {
+       ret = _vscprintf(format, arg);
+  }
+  return ret;
+}
+
+int msvc_snprintf(char* s, size_t n, const char* format, ...) {
+  va_list arg;
+  va_start(arg, format);
+  int ret = msvc_vsnprintf(s, n, format, arg);
+  va_end(arg);
+  return ret;
+}
+#endif
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/port_def.inc b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/port_def.inc
new file mode 100644 (file)
index 0000000..8362f78
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+* This is where we define macros used across upb.
+*
+* All of these macros are undef'd in port_undef.inc to avoid leaking them to
+* users.
+*
+* The correct usage is:
+*
+*   #include "upb/foobar.h"
+*   #include "upb/baz.h"
+*
+*   // MUST be last included header.
+*   #include "upb/port_def.inc"
+*
+*   // Code for this file.
+*   // <...>
+*
+*   // Can be omitted for .c files, required for .h.
+*   #include "upb/port_undef.inc"
+*
+* This file is private and must not be included by users!
+*/
+#ifndef UINTPTR_MAX
+#error must include stdint.h first
+#endif
+
+#if UINTPTR_MAX == 0xffffffff
+#define UPB_SIZE(size32, size64) size32
+#else
+#define UPB_SIZE(size32, size64) size64
+#endif
+
+#define UPB_FIELD_AT(msg, fieldtype, offset) \
+  *(fieldtype*)((const char*)(msg) + offset)
+
+#define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
+  UPB_FIELD_AT(msg, int, case_offset) == case_val                              \
+      ? UPB_FIELD_AT(msg, fieldtype, offset)                                   \
+      : default
+
+#define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
+  UPB_FIELD_AT(msg, int, case_offset) = case_val;                             \
+  UPB_FIELD_AT(msg, fieldtype, offset) = value;
+
+/* UPB_INLINE: inline if possible, emit standalone code if required. */
+#ifdef __cplusplus
+#define UPB_INLINE inline
+#elif defined (__GNUC__) || defined(__clang__)
+#define UPB_INLINE static __inline__
+#else
+#define UPB_INLINE static
+#endif
+
+/* Hints to the compiler about likely/unlikely branches. */
+#if defined (__GNUC__) || defined(__clang__)
+#define UPB_LIKELY(x) __builtin_expect((x),1)
+#define UPB_UNLIKELY(x) __builtin_expect((x),0)
+#else
+#define UPB_LIKELY(x) (x)
+#define UPB_UNLIKELY(x) (x)
+#endif
+
+/* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler
+ * doesn't provide these preprocessor symbols. */
+#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define UPB_BIG_ENDIAN
+#endif
+
+/* Macros for function attributes on compilers that support them. */
+#ifdef __GNUC__
+#define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
+#define UPB_NOINLINE __attribute__((noinline))
+#define UPB_NORETURN __attribute__((__noreturn__))
+#else  /* !defined(__GNUC__) */
+#define UPB_FORCEINLINE
+#define UPB_NOINLINE
+#define UPB_NORETURN
+#endif
+
+#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
+/* C99/C++11 versions. */
+#include <stdio.h>
+#define _upb_snprintf snprintf
+#define _upb_vsnprintf vsnprintf
+#define _upb_va_copy(a, b) va_copy(a, b)
+#elif defined(_MSC_VER)
+/* Microsoft C/C++ versions. */
+#include <stdarg.h>
+#include <stdio.h>
+#if _MSC_VER < 1900
+int msvc_snprintf(char* s, size_t n, const char* format, ...);
+int msvc_vsnprintf(char* s, size_t n, const char* format, va_list arg);
+#define UPB_MSVC_VSNPRINTF
+#define _upb_snprintf msvc_snprintf
+#define _upb_vsnprintf msvc_vsnprintf
+#else
+#define _upb_snprintf snprintf
+#define _upb_vsnprintf vsnprintf
+#endif
+#define _upb_va_copy(a, b) va_copy(a, b)
+#elif defined __GNUC__
+/* A few hacky workarounds for functions not in C89.
+ * For internal use only!
+ * TODO(haberman): fix these by including our own implementations, or finding
+ * another workaround.
+ */
+#define _upb_snprintf __builtin_snprintf
+#define _upb_vsnprintf __builtin_vsnprintf
+#define _upb_va_copy(a, b) __va_copy(a, b)
+#else
+#error Need implementations of [v]snprintf and va_copy
+#endif
+
+#ifdef __cplusplus
+#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || \
+    (defined(_MSC_VER) && _MSC_VER >= 1900)
+// C++11 is present
+#else
+#error upb requires C++11 for C++ support
+#endif
+#endif
+
+#define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
+#define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
+
+#define UPB_UNUSED(var) (void)var
+
+/* UPB_ASSERT(): in release mode, we use the expression without letting it be
+ * evaluated.  This prevents "unused variable" warnings. */
+#ifdef NDEBUG
+#define UPB_ASSERT(expr) do {} while (false && (expr))
+#else
+#define UPB_ASSERT(expr) assert(expr)
+#endif
+
+/* UPB_ASSERT_DEBUGVAR(): assert that uses functions or variables that only
+ * exist in debug mode.  This turns into regular assert. */
+#define UPB_ASSERT_DEBUGVAR(expr) assert(expr)
+
+#if defined(__GNUC__) || defined(__clang__)
+#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
+#else
+#define UPB_UNREACHABLE() do { assert(0); } while(0)
+#endif
+
+/* UPB_INFINITY representing floating-point positive infinity. */
+#include <math.h>
+#ifdef INFINITY
+#define UPB_INFINITY INFINITY
+#else
+#define UPB_INFINITY (1.0 / 0.0)
+#endif
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/port_undef.inc b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/port_undef.inc
new file mode 100644 (file)
index 0000000..103180b
--- /dev/null
@@ -0,0 +1,21 @@
+/* See port_def.inc.  This should #undef all macros #defined there. */
+
+#undef UPB_SIZE
+#undef UPB_FIELD_AT
+#undef UPB_READ_ONEOF
+#undef UPB_WRITE_ONEOF
+#undef UPB_INLINE
+#undef UPB_FORCEINLINE
+#undef UPB_NOINLINE
+#undef UPB_NORETURN
+#undef UPB_MAX
+#undef UPB_MIN
+#undef UPB_UNUSED
+#undef UPB_ASSERT
+#undef UPB_ASSERT_DEBUGVAR
+#undef UPB_UNREACHABLE
+#undef UPB_INFINITY
+#undef UPB_MSVC_VSNPRINTF
+#undef _upb_snprintf
+#undef _upb_vsnprintf
+#undef _upb_va_copy
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.c
new file mode 100644 (file)
index 0000000..d55d258
--- /dev/null
@@ -0,0 +1,17 @@
+
+#include "upb/sink.h"
+
+bool upb_bufsrc_putbuf(const char *buf, size_t len, upb_bytessink sink) {
+  void *subc;
+  bool ret;
+  upb_bufhandle handle = UPB_BUFHANDLE_INIT;
+  handle.buf = buf;
+  ret = upb_bytessink_start(sink, len, &subc);
+  if (ret && len != 0) {
+    ret = (upb_bytessink_putbuf(sink, subc, buf, len, &handle) >= len);
+  }
+  if (ret) {
+    ret = upb_bytessink_end(sink);
+  }
+  return ret;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/sink.h
new file mode 100644 (file)
index 0000000..47d218a
--- /dev/null
@@ -0,0 +1,516 @@
+/*
+** upb::Sink (upb_sink)
+** upb::BytesSink (upb_bytessink)
+**
+** A upb_sink is an object that binds a upb_handlers object to some runtime
+** state.  It is the object that can actually receive data via the upb_handlers
+** interface.
+**
+** Unlike upb_def and upb_handlers, upb_sink is never frozen, immutable, or
+** thread-safe.  You can create as many of them as you want, but each one may
+** only be used in a single thread at a time.
+**
+** If we compare with class-based OOP, a you can think of a upb_def as an
+** abstract base class, a upb_handlers as a concrete derived class, and a
+** upb_sink as an object (class instance).
+*/
+
+#ifndef UPB_SINK_H
+#define UPB_SINK_H
+
+#include "upb/handlers.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+namespace upb {
+class BytesSink;
+class Sink;
+}
+#endif
+
+/* upb_sink *******************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+  const upb_handlers *handlers;
+  void *closure;
+} upb_sink;
+
+#define PUTVAL(type, ctype)                                           \
+  UPB_INLINE bool upb_sink_put##type(upb_sink s, upb_selector_t sel,  \
+                                     ctype val) {                     \
+    typedef upb_##type##_handlerfunc functype;                        \
+    functype *func;                                                   \
+    const void *hd;                                                   \
+    if (!s.handlers) return true;                                     \
+    func = (functype *)upb_handlers_gethandler(s.handlers, sel, &hd); \
+    if (!func) return true;                                           \
+    return func(s.closure, hd, val);                                  \
+  }
+
+PUTVAL(int32,  int32_t)
+PUTVAL(int64,  int64_t)
+PUTVAL(uint32, uint32_t)
+PUTVAL(uint64, uint64_t)
+PUTVAL(float,  float)
+PUTVAL(double, double)
+PUTVAL(bool,   bool)
+#undef PUTVAL
+
+UPB_INLINE void upb_sink_reset(upb_sink *s, const upb_handlers *h, void *c) {
+  s->handlers = h;
+  s->closure = c;
+}
+
+UPB_INLINE size_t upb_sink_putstring(upb_sink s, upb_selector_t sel,
+                                     const char *buf, size_t n,
+                                     const upb_bufhandle *handle) {
+  typedef upb_string_handlerfunc func;
+  func *handler;
+  const void *hd;
+  if (!s.handlers) return n;
+  handler = (func *)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!handler) return n;
+  return handler(s.closure, hd, buf, n, handle);
+}
+
+UPB_INLINE bool upb_sink_putunknown(upb_sink s, const char *buf, size_t n) {
+  typedef upb_unknown_handlerfunc func;
+  func *handler;
+  const void *hd;
+  if (!s.handlers) return true;
+  handler =
+      (func *)upb_handlers_gethandler(s.handlers, UPB_UNKNOWN_SELECTOR, &hd);
+
+  if (!handler) return n;
+  return handler(s.closure, hd, buf, n);
+}
+
+UPB_INLINE bool upb_sink_startmsg(upb_sink s) {
+  typedef upb_startmsg_handlerfunc func;
+  func *startmsg;
+  const void *hd;
+  if (!s.handlers) return true;
+  startmsg =
+      (func *)upb_handlers_gethandler(s.handlers, UPB_STARTMSG_SELECTOR, &hd);
+
+  if (!startmsg) return true;
+  return startmsg(s.closure, hd);
+}
+
+UPB_INLINE bool upb_sink_endmsg(upb_sink s, upb_status *status) {
+  typedef upb_endmsg_handlerfunc func;
+  func *endmsg;
+  const void *hd;
+  if (!s.handlers) return true;
+  endmsg =
+      (func *)upb_handlers_gethandler(s.handlers, UPB_ENDMSG_SELECTOR, &hd);
+
+  if (!endmsg) return true;
+  return endmsg(s.closure, hd, status);
+}
+
+UPB_INLINE bool upb_sink_startseq(upb_sink s, upb_selector_t sel,
+                                  upb_sink *sub) {
+  typedef upb_startfield_handlerfunc func;
+  func *startseq;
+  const void *hd;
+  sub->closure = s.closure;
+  sub->handlers = s.handlers;
+  if (!s.handlers) return true;
+  startseq = (func*)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!startseq) return true;
+  sub->closure = startseq(s.closure, hd);
+  return sub->closure ? true : false;
+}
+
+UPB_INLINE bool upb_sink_endseq(upb_sink s, upb_selector_t sel) {
+  typedef upb_endfield_handlerfunc func;
+  func *endseq;
+  const void *hd;
+  if (!s.handlers) return true;
+  endseq = (func*)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!endseq) return true;
+  return endseq(s.closure, hd);
+}
+
+UPB_INLINE bool upb_sink_startstr(upb_sink s, upb_selector_t sel,
+                                  size_t size_hint, upb_sink *sub) {
+  typedef upb_startstr_handlerfunc func;
+  func *startstr;
+  const void *hd;
+  sub->closure = s.closure;
+  sub->handlers = s.handlers;
+  if (!s.handlers) return true;
+  startstr = (func*)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!startstr) return true;
+  sub->closure = startstr(s.closure, hd, size_hint);
+  return sub->closure ? true : false;
+}
+
+UPB_INLINE bool upb_sink_endstr(upb_sink s, upb_selector_t sel) {
+  typedef upb_endfield_handlerfunc func;
+  func *endstr;
+  const void *hd;
+  if (!s.handlers) return true;
+  endstr = (func*)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!endstr) return true;
+  return endstr(s.closure, hd);
+}
+
+UPB_INLINE bool upb_sink_startsubmsg(upb_sink s, upb_selector_t sel,
+                                     upb_sink *sub) {
+  typedef upb_startfield_handlerfunc func;
+  func *startsubmsg;
+  const void *hd;
+  sub->closure = s.closure;
+  if (!s.handlers) {
+    sub->handlers = NULL;
+    return true;
+  }
+  sub->handlers = upb_handlers_getsubhandlers_sel(s.handlers, sel);
+  startsubmsg = (func*)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!startsubmsg) return true;
+  sub->closure = startsubmsg(s.closure, hd);
+  return sub->closure ? true : false;
+}
+
+UPB_INLINE bool upb_sink_endsubmsg(upb_sink s, upb_selector_t sel) {
+  typedef upb_endfield_handlerfunc func;
+  func *endsubmsg;
+  const void *hd;
+  if (!s.handlers) return true;
+  endsubmsg = (func*)upb_handlers_gethandler(s.handlers, sel, &hd);
+
+  if (!endsubmsg) return s.closure;
+  return endsubmsg(s.closure, hd);
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+/* A upb::Sink is an object that binds a upb::Handlers object to some runtime
+ * state.  It represents an endpoint to which data can be sent.
+ *
+ * TODO(haberman): right now all of these functions take selectors.  Should they
+ * take selectorbase instead?
+ *
+ * ie. instead of calling:
+ *   sink->StartString(FOO_FIELD_START_STRING, ...)
+ * a selector base would let you say:
+ *   sink->StartString(FOO_FIELD, ...)
+ *
+ * This would make call sites a little nicer and require emitting fewer selector
+ * definitions in .h files.
+ *
+ * But the current scheme has the benefit that you can retrieve a function
+ * pointer for any handler with handlers->GetHandler(selector), without having
+ * to have a separate GetHandler() function for each handler type.  The JIT
+ * compiler uses this.  To accommodate we'd have to expose a separate
+ * GetHandler() for every handler type.
+ *
+ * Also to ponder: selectors right now are independent of a specific Handlers
+ * instance.  In other words, they allocate a number to every possible handler
+ * that *could* be registered, without knowing anything about what handlers
+ * *are* registered.  That means that using selectors as table offsets prohibits
+ * us from compacting the handler table at Freeze() time.  If the table is very
+ * sparse, this could be wasteful.
+ *
+ * Having another selector-like thing that is specific to a Handlers instance
+ * would allow this compacting, but then it would be impossible to write code
+ * ahead-of-time that can be bound to any Handlers instance at runtime.  For
+ * example, a .proto file parser written as straight C will not know what
+ * Handlers it will be bound to, so when it calls sink->StartString() what
+ * selector will it pass?  It needs a selector like we have today, that is
+ * independent of any particular upb::Handlers.
+ *
+ * Is there a way then to allow Handlers table compaction? */
+class upb::Sink {
+ public:
+  /* Constructor with no initialization; must be Reset() before use. */
+  Sink() {}
+
+  Sink(const Sink&) = default;
+  Sink& operator=(const Sink&) = default;
+
+  Sink(const upb_sink& sink) : sink_(sink) {}
+  Sink &operator=(const upb_sink &sink) {
+    sink_ = sink;
+    return *this;
+  }
+
+  upb_sink sink() { return sink_; }
+
+  /* Constructs a new sink for the given frozen handlers and closure.
+   *
+   * TODO: once the Handlers know the expected closure type, verify that T
+   * matches it. */
+  template <class T> Sink(const upb_handlers* handlers, T* closure) {
+    Reset(handlers, closure);
+  }
+
+  upb_sink* ptr() { return &sink_; }
+
+  /* Resets the value of the sink. */
+  template <class T> void Reset(const upb_handlers* handlers, T* closure) {
+    upb_sink_reset(&sink_, handlers, closure);
+  }
+
+  /* Returns the top-level object that is bound to this sink.
+   *
+   * TODO: once the Handlers know the expected closure type, verify that T
+   * matches it. */
+  template <class T> T* GetObject() const {
+    return static_cast<T*>(sink_.closure);
+  }
+
+  /* Functions for pushing data into the sink.
+   *
+   * These return false if processing should stop (either due to error or just
+   * to suspend).
+   *
+   * These may not be called from within one of the same sink's handlers (in
+   * other words, handlers are not re-entrant). */
+
+  /* Should be called at the start and end of every message; both the top-level
+   * message and submessages.  This means that submessages should use the
+   * following sequence:
+   *   sink->StartSubMessage(startsubmsg_selector);
+   *   sink->StartMessage();
+   *   // ...
+   *   sink->EndMessage(&status);
+   *   sink->EndSubMessage(endsubmsg_selector); */
+  bool StartMessage() { return upb_sink_startmsg(sink_); }
+  bool EndMessage(upb_status *status) {
+    return upb_sink_endmsg(sink_, status);
+  }
+
+  /* Putting of individual values.  These work for both repeated and
+   * non-repeated fields, but for repeated fields you must wrap them in
+   * calls to StartSequence()/EndSequence(). */
+  bool PutInt32(HandlersPtr::Selector s, int32_t val) {
+    return upb_sink_putint32(sink_, s, val);
+  }
+
+  bool PutInt64(HandlersPtr::Selector s, int64_t val) {
+    return upb_sink_putint64(sink_, s, val);
+  }
+
+  bool PutUInt32(HandlersPtr::Selector s, uint32_t val) {
+    return upb_sink_putuint32(sink_, s, val);
+  }
+
+  bool PutUInt64(HandlersPtr::Selector s, uint64_t val) {
+    return upb_sink_putuint64(sink_, s, val);
+  }
+
+  bool PutFloat(HandlersPtr::Selector s, float val) {
+    return upb_sink_putfloat(sink_, s, val);
+  }
+
+  bool PutDouble(HandlersPtr::Selector s, double val) {
+    return upb_sink_putdouble(sink_, s, val);
+  }
+
+  bool PutBool(HandlersPtr::Selector s, bool val) {
+    return upb_sink_putbool(sink_, s, val);
+  }
+
+  /* Putting of string/bytes values.  Each string can consist of zero or more
+   * non-contiguous buffers of data.
+   *
+   * For StartString(), the function will write a sink for the string to "sub."
+   * The sub-sink must be used for any/all PutStringBuffer() calls. */
+  bool StartString(HandlersPtr::Selector s, size_t size_hint, Sink* sub) {
+    upb_sink sub_c;
+    bool ret = upb_sink_startstr(sink_, s, size_hint, &sub_c);
+    *sub = sub_c;
+    return ret;
+  }
+
+  size_t PutStringBuffer(HandlersPtr::Selector s, const char *buf, size_t len,
+                         const upb_bufhandle *handle) {
+    return upb_sink_putstring(sink_, s, buf, len, handle);
+  }
+
+  bool EndString(HandlersPtr::Selector s) {
+    return upb_sink_endstr(sink_, s);
+  }
+
+  /* For submessage fields.
+   *
+   * For StartSubMessage(), the function will write a sink for the string to
+   * "sub." The sub-sink must be used for any/all handlers called within the
+   * submessage. */
+  bool StartSubMessage(HandlersPtr::Selector s, Sink* sub) {
+    upb_sink sub_c;
+    bool ret = upb_sink_startsubmsg(sink_, s, &sub_c);
+    *sub = sub_c;
+    return ret;
+  }
+
+  bool EndSubMessage(HandlersPtr::Selector s) {
+    return upb_sink_endsubmsg(sink_, s);
+  }
+
+  /* For repeated fields of any type, the sequence of values must be wrapped in
+   * these calls.
+   *
+   * For StartSequence(), the function will write a sink for the string to
+   * "sub." The sub-sink must be used for any/all handlers called within the
+   * sequence. */
+  bool StartSequence(HandlersPtr::Selector s, Sink* sub) {
+    upb_sink sub_c;
+    bool ret = upb_sink_startseq(sink_, s, &sub_c);
+    *sub = sub_c;
+    return ret;
+  }
+
+  bool EndSequence(HandlersPtr::Selector s) {
+    return upb_sink_endseq(sink_, s);
+  }
+
+  /* Copy and assign specifically allowed.
+   * We don't even bother making these members private because so many
+   * functions need them and this is mainly just a dumb data container anyway.
+   */
+
+ private:
+  upb_sink sink_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_bytessink **************************************************************/
+
+typedef struct {
+  const upb_byteshandler *handler;
+  void *closure;
+} upb_bytessink ;
+
+UPB_INLINE void upb_bytessink_reset(upb_bytessink* s, const upb_byteshandler *h,
+                                    void *closure) {
+  s->handler = h;
+  s->closure = closure;
+}
+
+UPB_INLINE bool upb_bytessink_start(upb_bytessink s, size_t size_hint,
+                                    void **subc) {
+  typedef upb_startstr_handlerfunc func;
+  func *start;
+  *subc = s.closure;
+  if (!s.handler) return true;
+  start = (func *)s.handler->table[UPB_STARTSTR_SELECTOR].func;
+
+  if (!start) return true;
+  *subc = start(s.closure,
+                s.handler->table[UPB_STARTSTR_SELECTOR].attr.handler_data,
+                size_hint);
+  return *subc != NULL;
+}
+
+UPB_INLINE size_t upb_bytessink_putbuf(upb_bytessink s, void *subc,
+                                       const char *buf, size_t size,
+                                       const upb_bufhandle* handle) {
+  typedef upb_string_handlerfunc func;
+  func *putbuf;
+  if (!s.handler) return true;
+  putbuf = (func *)s.handler->table[UPB_STRING_SELECTOR].func;
+
+  if (!putbuf) return true;
+  return putbuf(subc, s.handler->table[UPB_STRING_SELECTOR].attr.handler_data,
+                buf, size, handle);
+}
+
+UPB_INLINE bool upb_bytessink_end(upb_bytessink s) {
+  typedef upb_endfield_handlerfunc func;
+  func *end;
+  if (!s.handler) return true;
+  end = (func *)s.handler->table[UPB_ENDSTR_SELECTOR].func;
+
+  if (!end) return true;
+  return end(s.closure,
+             s.handler->table[UPB_ENDSTR_SELECTOR].attr.handler_data);
+}
+
+#ifdef __cplusplus
+
+class upb::BytesSink {
+ public:
+  BytesSink() {}
+
+  BytesSink(const BytesSink&) = default;
+  BytesSink& operator=(const BytesSink&) = default;
+
+  BytesSink(const upb_bytessink& sink) : sink_(sink) {}
+  BytesSink &operator=(const upb_bytessink &sink) {
+    sink_ = sink;
+    return *this;
+  }
+
+  upb_bytessink sink() { return sink_; }
+
+  /* Constructs a new sink for the given frozen handlers and closure.
+   *
+   * TODO(haberman): once the Handlers know the expected closure type, verify
+   * that T matches it. */
+  template <class T> BytesSink(const upb_byteshandler* handler, T* closure) {
+    upb_bytessink_reset(sink_, handler, closure);
+  }
+
+  /* Resets the value of the sink. */
+  template <class T> void Reset(const upb_byteshandler* handler, T* closure) {
+    upb_bytessink_reset(&sink_, handler, closure);
+  }
+
+  bool Start(size_t size_hint, void **subc) {
+    return upb_bytessink_start(sink_, size_hint, subc);
+  }
+
+  size_t PutBuffer(void *subc, const char *buf, size_t len,
+                   const upb_bufhandle *handle) {
+    return upb_bytessink_putbuf(sink_, subc, buf, len, handle);
+  }
+
+  bool End() {
+    return upb_bytessink_end(sink_);
+  }
+
+ private:
+  upb_bytessink sink_;
+};
+
+#endif  /* __cplusplus */
+
+/* upb_bufsrc *****************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool upb_bufsrc_putbuf(const char *buf, size_t len, upb_bytessink sink);
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+namespace upb {
+template <class T> bool PutBuffer(const T& str, BytesSink sink) {
+  return upb_bufsrc_putbuf(str.data(), str.size(), sink.sink());
+}
+}
+
+#endif  /* __cplusplus */
+
+#include "upb/port_undef.inc"
+
+#endif
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/table.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/table.c
new file mode 100644 (file)
index 0000000..13f8d81
--- /dev/null
@@ -0,0 +1,911 @@
+/*
+** upb_table Implementation
+**
+** Implementation is heavily inspired by Lua's ltable.c.
+*/
+
+#include "upb/table.int.h"
+
+#include <string.h>
+
+#include "upb/port_def.inc"
+
+#define UPB_MAXARRSIZE 16  /* 64k. */
+
+/* From Chromium. */
+#define ARRAY_SIZE(x) \
+    ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
+
+static void upb_check_alloc(upb_table *t, upb_alloc *a) {
+  UPB_UNUSED(t);
+  UPB_UNUSED(a);
+  UPB_ASSERT_DEBUGVAR(t->alloc == a);
+}
+
+static const double MAX_LOAD = 0.85;
+
+/* The minimum utilization of the array part of a mixed hash/array table.  This
+ * is a speed/memory-usage tradeoff (though it's not straightforward because of
+ * cache effects).  The lower this is, the more memory we'll use. */
+static const double MIN_DENSITY = 0.1;
+
+bool is_pow2(uint64_t v) { return v == 0 || (v & (v - 1)) == 0; }
+
+int log2ceil(uint64_t v) {
+  int ret = 0;
+  bool pow2 = is_pow2(v);
+  while (v >>= 1) ret++;
+  ret = pow2 ? ret : ret + 1;  /* Ceiling. */
+  return UPB_MIN(UPB_MAXARRSIZE, ret);
+}
+
+char *upb_strdup(const char *s, upb_alloc *a) {
+  return upb_strdup2(s, strlen(s), a);
+}
+
+char *upb_strdup2(const char *s, size_t len, upb_alloc *a) {
+  size_t n;
+  char *p;
+
+  /* Prevent overflow errors. */
+  if (len == SIZE_MAX) return NULL;
+  /* Always null-terminate, even if binary data; but don't rely on the input to
+   * have a null-terminating byte since it may be a raw binary buffer. */
+  n = len + 1;
+  p = upb_malloc(a, n);
+  if (p) {
+    memcpy(p, s, len);
+    p[len] = 0;
+  }
+  return p;
+}
+
+/* A type to represent the lookup key of either a strtable or an inttable. */
+typedef union {
+  uintptr_t num;
+  struct {
+    const char *str;
+    size_t len;
+  } str;
+} lookupkey_t;
+
+static lookupkey_t strkey2(const char *str, size_t len) {
+  lookupkey_t k;
+  k.str.str = str;
+  k.str.len = len;
+  return k;
+}
+
+static lookupkey_t intkey(uintptr_t key) {
+  lookupkey_t k;
+  k.num = key;
+  return k;
+}
+
+typedef uint32_t hashfunc_t(upb_tabkey key);
+typedef bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2);
+
+/* Base table (shared code) ***************************************************/
+
+/* For when we need to cast away const. */
+static upb_tabent *mutable_entries(upb_table *t) {
+  return (upb_tabent*)t->entries;
+}
+
+static bool isfull(upb_table *t) {
+  if (upb_table_size(t) == 0) {
+    return true;
+  } else {
+    return ((double)(t->count + 1) / upb_table_size(t)) > MAX_LOAD;
+  }
+}
+
+static bool init(upb_table *t, upb_ctype_t ctype, uint8_t size_lg2,
+                 upb_alloc *a) {
+  size_t bytes;
+
+  t->count = 0;
+  t->ctype = ctype;
+  t->size_lg2 = size_lg2;
+  t->mask = upb_table_size(t) ? upb_table_size(t) - 1 : 0;
+#ifndef NDEBUG
+  t->alloc = a;
+#endif
+  bytes = upb_table_size(t) * sizeof(upb_tabent);
+  if (bytes > 0) {
+    t->entries = upb_malloc(a, bytes);
+    if (!t->entries) return false;
+    memset(mutable_entries(t), 0, bytes);
+  } else {
+    t->entries = NULL;
+  }
+  return true;
+}
+
+static void uninit(upb_table *t, upb_alloc *a) {
+  upb_check_alloc(t, a);
+  upb_free(a, mutable_entries(t));
+}
+
+static upb_tabent *emptyent(upb_table *t) {
+  upb_tabent *e = mutable_entries(t) + upb_table_size(t);
+  while (1) { if (upb_tabent_isempty(--e)) return e; UPB_ASSERT(e > t->entries); }
+}
+
+static upb_tabent *getentry_mutable(upb_table *t, uint32_t hash) {
+  return (upb_tabent*)upb_getentry(t, hash);
+}
+
+static const upb_tabent *findentry(const upb_table *t, lookupkey_t key,
+                                   uint32_t hash, eqlfunc_t *eql) {
+  const upb_tabent *e;
+
+  if (t->size_lg2 == 0) return NULL;
+  e = upb_getentry(t, hash);
+  if (upb_tabent_isempty(e)) return NULL;
+  while (1) {
+    if (eql(e->key, key)) return e;
+    if ((e = e->next) == NULL) return NULL;
+  }
+}
+
+static upb_tabent *findentry_mutable(upb_table *t, lookupkey_t key,
+                                     uint32_t hash, eqlfunc_t *eql) {
+  return (upb_tabent*)findentry(t, key, hash, eql);
+}
+
+static bool lookup(const upb_table *t, lookupkey_t key, upb_value *v,
+                   uint32_t hash, eqlfunc_t *eql) {
+  const upb_tabent *e = findentry(t, key, hash, eql);
+  if (e) {
+    if (v) {
+      _upb_value_setval(v, e->val.val, t->ctype);
+    }
+    return true;
+  } else {
+    return false;
+  }
+}
+
+/* The given key must not already exist in the table. */
+static void insert(upb_table *t, lookupkey_t key, upb_tabkey tabkey,
+                   upb_value val, uint32_t hash,
+                   hashfunc_t *hashfunc, eqlfunc_t *eql) {
+  upb_tabent *mainpos_e;
+  upb_tabent *our_e;
+
+  UPB_ASSERT(findentry(t, key, hash, eql) == NULL);
+  UPB_ASSERT_DEBUGVAR(val.ctype == t->ctype);
+
+  t->count++;
+  mainpos_e = getentry_mutable(t, hash);
+  our_e = mainpos_e;
+
+  if (upb_tabent_isempty(mainpos_e)) {
+    /* Our main position is empty; use it. */
+    our_e->next = NULL;
+  } else {
+    /* Collision. */
+    upb_tabent *new_e = emptyent(t);
+    /* Head of collider's chain. */
+    upb_tabent *chain = getentry_mutable(t, hashfunc(mainpos_e->key));
+    if (chain == mainpos_e) {
+      /* Existing ent is in its main posisiton (it has the same hash as us, and
+       * is the head of our chain).  Insert to new ent and append to this chain. */
+      new_e->next = mainpos_e->next;
+      mainpos_e->next = new_e;
+      our_e = new_e;
+    } else {
+      /* Existing ent is not in its main position (it is a node in some other
+       * chain).  This implies that no existing ent in the table has our hash.
+       * Evict it (updating its chain) and use its ent for head of our chain. */
+      *new_e = *mainpos_e;  /* copies next. */
+      while (chain->next != mainpos_e) {
+        chain = (upb_tabent*)chain->next;
+        UPB_ASSERT(chain);
+      }
+      chain->next = new_e;
+      our_e = mainpos_e;
+      our_e->next = NULL;
+    }
+  }
+  our_e->key = tabkey;
+  our_e->val.val = val.val;
+  UPB_ASSERT(findentry(t, key, hash, eql) == our_e);
+}
+
+static bool rm(upb_table *t, lookupkey_t key, upb_value *val,
+               upb_tabkey *removed, uint32_t hash, eqlfunc_t *eql) {
+  upb_tabent *chain = getentry_mutable(t, hash);
+  if (upb_tabent_isempty(chain)) return false;
+  if (eql(chain->key, key)) {
+    /* Element to remove is at the head of its chain. */
+    t->count--;
+    if (val) _upb_value_setval(val, chain->val.val, t->ctype);
+    if (removed) *removed = chain->key;
+    if (chain->next) {
+      upb_tabent *move = (upb_tabent*)chain->next;
+      *chain = *move;
+      move->key = 0;  /* Make the slot empty. */
+    } else {
+      chain->key = 0;  /* Make the slot empty. */
+    }
+    return true;
+  } else {
+    /* Element to remove is either in a non-head position or not in the
+     * table. */
+    while (chain->next && !eql(chain->next->key, key)) {
+      chain = (upb_tabent*)chain->next;
+    }
+    if (chain->next) {
+      /* Found element to remove. */
+      upb_tabent *rm = (upb_tabent*)chain->next;
+      t->count--;
+      if (val) _upb_value_setval(val, chain->next->val.val, t->ctype);
+      if (removed) *removed = rm->key;
+      rm->key = 0;  /* Make the slot empty. */
+      chain->next = rm->next;
+      return true;
+    } else {
+      /* Element to remove is not in the table. */
+      return false;
+    }
+  }
+}
+
+static size_t next(const upb_table *t, size_t i) {
+  do {
+    if (++i >= upb_table_size(t))
+      return SIZE_MAX;
+  } while(upb_tabent_isempty(&t->entries[i]));
+
+  return i;
+}
+
+static size_t begin(const upb_table *t) {
+  return next(t, -1);
+}
+
+
+/* upb_strtable ***************************************************************/
+
+/* A simple "subclass" of upb_table that only adds a hash function for strings. */
+
+static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) {
+  uint32_t len = (uint32_t) k2.str.len;
+  char *str = upb_malloc(a, k2.str.len + sizeof(uint32_t) + 1);
+  if (str == NULL) return 0;
+  memcpy(str, &len, sizeof(uint32_t));
+  memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len + 1);
+  return (uintptr_t)str;
+}
+
+static uint32_t strhash(upb_tabkey key) {
+  uint32_t len;
+  char *str = upb_tabstr(key, &len);
+  return upb_murmur_hash2(str, len, 0);
+}
+
+static bool streql(upb_tabkey k1, lookupkey_t k2) {
+  uint32_t len;
+  char *str = upb_tabstr(k1, &len);
+  return len == k2.str.len && memcmp(str, k2.str.str, len) == 0;
+}
+
+bool upb_strtable_init2(upb_strtable *t, upb_ctype_t ctype, upb_alloc *a) {
+  return init(&t->t, ctype, 2, a);
+}
+
+void upb_strtable_uninit2(upb_strtable *t, upb_alloc *a) {
+  size_t i;
+  for (i = 0; i < upb_table_size(&t->t); i++)
+    upb_free(a, (void*)t->t.entries[i].key);
+  uninit(&t->t, a);
+}
+
+bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_alloc *a) {
+  upb_strtable new_table;
+  upb_strtable_iter i;
+
+  upb_check_alloc(&t->t, a);
+
+  if (!init(&new_table.t, t->t.ctype, size_lg2, a))
+    return false;
+  upb_strtable_begin(&i, t);
+  for ( ; !upb_strtable_done(&i); upb_strtable_next(&i)) {
+    upb_strtable_insert3(
+        &new_table,
+        upb_strtable_iter_key(&i),
+        upb_strtable_iter_keylength(&i),
+        upb_strtable_iter_value(&i),
+        a);
+  }
+  upb_strtable_uninit2(t, a);
+  *t = new_table;
+  return true;
+}
+
+bool upb_strtable_insert3(upb_strtable *t, const char *k, size_t len,
+                          upb_value v, upb_alloc *a) {
+  lookupkey_t key;
+  upb_tabkey tabkey;
+  uint32_t hash;
+
+  upb_check_alloc(&t->t, a);
+
+  if (isfull(&t->t)) {
+    /* Need to resize.  New table of double the size, add old elements to it. */
+    if (!upb_strtable_resize(t, t->t.size_lg2 + 1, a)) {
+      return false;
+    }
+  }
+
+  key = strkey2(k, len);
+  tabkey = strcopy(key, a);
+  if (tabkey == 0) return false;
+
+  hash = upb_murmur_hash2(key.str.str, key.str.len, 0);
+  insert(&t->t, key, tabkey, v, hash, &strhash, &streql);
+  return true;
+}
+
+bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
+                          upb_value *v) {
+  uint32_t hash = upb_murmur_hash2(key, len, 0);
+  return lookup(&t->t, strkey2(key, len), v, hash, &streql);
+}
+
+bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len,
+                         upb_value *val, upb_alloc *alloc) {
+  uint32_t hash = upb_murmur_hash2(key, len, 0);
+  upb_tabkey tabkey;
+  if (rm(&t->t, strkey2(key, len), val, &tabkey, hash, &streql)) {
+    upb_free(alloc, (void*)tabkey);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+/* Iteration */
+
+static const upb_tabent *str_tabent(const upb_strtable_iter *i) {
+  return &i->t->t.entries[i->index];
+}
+
+void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t) {
+  i->t = t;
+  i->index = begin(&t->t);
+}
+
+void upb_strtable_next(upb_strtable_iter *i) {
+  i->index = next(&i->t->t, i->index);
+}
+
+bool upb_strtable_done(const upb_strtable_iter *i) {
+  if (!i->t) return true;
+  return i->index >= upb_table_size(&i->t->t) ||
+         upb_tabent_isempty(str_tabent(i));
+}
+
+const char *upb_strtable_iter_key(const upb_strtable_iter *i) {
+  UPB_ASSERT(!upb_strtable_done(i));
+  return upb_tabstr(str_tabent(i)->key, NULL);
+}
+
+size_t upb_strtable_iter_keylength(const upb_strtable_iter *i) {
+  uint32_t len;
+  UPB_ASSERT(!upb_strtable_done(i));
+  upb_tabstr(str_tabent(i)->key, &len);
+  return len;
+}
+
+upb_value upb_strtable_iter_value(const upb_strtable_iter *i) {
+  UPB_ASSERT(!upb_strtable_done(i));
+  return _upb_value_val(str_tabent(i)->val.val, i->t->t.ctype);
+}
+
+void upb_strtable_iter_setdone(upb_strtable_iter *i) {
+  i->t = NULL;
+  i->index = SIZE_MAX;
+}
+
+bool upb_strtable_iter_isequal(const upb_strtable_iter *i1,
+                               const upb_strtable_iter *i2) {
+  if (upb_strtable_done(i1) && upb_strtable_done(i2))
+    return true;
+  return i1->t == i2->t && i1->index == i2->index;
+}
+
+
+/* upb_inttable ***************************************************************/
+
+/* For inttables we use a hybrid structure where small keys are kept in an
+ * array and large keys are put in the hash table. */
+
+static uint32_t inthash(upb_tabkey key) { return upb_inthash(key); }
+
+static bool inteql(upb_tabkey k1, lookupkey_t k2) {
+  return k1 == k2.num;
+}
+
+static upb_tabval *mutable_array(upb_inttable *t) {
+  return (upb_tabval*)t->array;
+}
+
+static upb_tabval *inttable_val(upb_inttable *t, uintptr_t key) {
+  if (key < t->array_size) {
+    return upb_arrhas(t->array[key]) ? &(mutable_array(t)[key]) : NULL;
+  } else {
+    upb_tabent *e =
+        findentry_mutable(&t->t, intkey(key), upb_inthash(key), &inteql);
+    return e ? &e->val : NULL;
+  }
+}
+
+static const upb_tabval *inttable_val_const(const upb_inttable *t,
+                                            uintptr_t key) {
+  return inttable_val((upb_inttable*)t, key);
+}
+
+size_t upb_inttable_count(const upb_inttable *t) {
+  return t->t.count + t->array_count;
+}
+
+static void check(upb_inttable *t) {
+  UPB_UNUSED(t);
+#if defined(UPB_DEBUG_TABLE) && !defined(NDEBUG)
+  {
+    /* This check is very expensive (makes inserts/deletes O(N)). */
+    size_t count = 0;
+    upb_inttable_iter i;
+    upb_inttable_begin(&i, t);
+    for(; !upb_inttable_done(&i); upb_inttable_next(&i), count++) {
+      UPB_ASSERT(upb_inttable_lookup(t, upb_inttable_iter_key(&i), NULL));
+    }
+    UPB_ASSERT(count == upb_inttable_count(t));
+  }
+#endif
+}
+
+bool upb_inttable_sizedinit(upb_inttable *t, upb_ctype_t ctype,
+                            size_t asize, int hsize_lg2, upb_alloc *a) {
+  size_t array_bytes;
+
+  if (!init(&t->t, ctype, hsize_lg2, a)) return false;
+  /* Always make the array part at least 1 long, so that we know key 0
+   * won't be in the hash part, which simplifies things. */
+  t->array_size = UPB_MAX(1, asize);
+  t->array_count = 0;
+  array_bytes = t->array_size * sizeof(upb_value);
+  t->array = upb_malloc(a, array_bytes);
+  if (!t->array) {
+    uninit(&t->t, a);
+    return false;
+  }
+  memset(mutable_array(t), 0xff, array_bytes);
+  check(t);
+  return true;
+}
+
+bool upb_inttable_init2(upb_inttable *t, upb_ctype_t ctype, upb_alloc *a) {
+  return upb_inttable_sizedinit(t, ctype, 0, 4, a);
+}
+
+void upb_inttable_uninit2(upb_inttable *t, upb_alloc *a) {
+  uninit(&t->t, a);
+  upb_free(a, mutable_array(t));
+}
+
+bool upb_inttable_insert2(upb_inttable *t, uintptr_t key, upb_value val,
+                          upb_alloc *a) {
+  upb_tabval tabval;
+  tabval.val = val.val;
+  UPB_ASSERT(upb_arrhas(tabval));  /* This will reject (uint64_t)-1.  Fix this. */
+
+  upb_check_alloc(&t->t, a);
+
+  if (key < t->array_size) {
+    UPB_ASSERT(!upb_arrhas(t->array[key]));
+    t->array_count++;
+    mutable_array(t)[key].val = val.val;
+  } else {
+    if (isfull(&t->t)) {
+      /* Need to resize the hash part, but we re-use the array part. */
+      size_t i;
+      upb_table new_table;
+
+      if (!init(&new_table, t->t.ctype, t->t.size_lg2 + 1, a)) {
+        return false;
+      }
+
+      for (i = begin(&t->t); i < upb_table_size(&t->t); i = next(&t->t, i)) {
+        const upb_tabent *e = &t->t.entries[i];
+        uint32_t hash;
+        upb_value v;
+
+        _upb_value_setval(&v, e->val.val, t->t.ctype);
+        hash = upb_inthash(e->key);
+        insert(&new_table, intkey(e->key), e->key, v, hash, &inthash, &inteql);
+      }
+
+      UPB_ASSERT(t->t.count == new_table.count);
+
+      uninit(&t->t, a);
+      t->t = new_table;
+    }
+    insert(&t->t, intkey(key), key, val, upb_inthash(key), &inthash, &inteql);
+  }
+  check(t);
+  return true;
+}
+
+bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v) {
+  const upb_tabval *table_v = inttable_val_const(t, key);
+  if (!table_v) return false;
+  if (v) _upb_value_setval(v, table_v->val, t->t.ctype);
+  return true;
+}
+
+bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val) {
+  upb_tabval *table_v = inttable_val(t, key);
+  if (!table_v) return false;
+  table_v->val = val.val;
+  return true;
+}
+
+bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val) {
+  bool success;
+  if (key < t->array_size) {
+    if (upb_arrhas(t->array[key])) {
+      upb_tabval empty = UPB_TABVALUE_EMPTY_INIT;
+      t->array_count--;
+      if (val) {
+        _upb_value_setval(val, t->array[key].val, t->t.ctype);
+      }
+      mutable_array(t)[key] = empty;
+      success = true;
+    } else {
+      success = false;
+    }
+  } else {
+    success = rm(&t->t, intkey(key), val, NULL, upb_inthash(key), &inteql);
+  }
+  check(t);
+  return success;
+}
+
+bool upb_inttable_push2(upb_inttable *t, upb_value val, upb_alloc *a) {
+  upb_check_alloc(&t->t, a);
+  return upb_inttable_insert2(t, upb_inttable_count(t), val, a);
+}
+
+upb_value upb_inttable_pop(upb_inttable *t) {
+  upb_value val;
+  bool ok = upb_inttable_remove(t, upb_inttable_count(t) - 1, &val);
+  UPB_ASSERT(ok);
+  return val;
+}
+
+bool upb_inttable_insertptr2(upb_inttable *t, const void *key, upb_value val,
+                             upb_alloc *a) {
+  upb_check_alloc(&t->t, a);
+  return upb_inttable_insert2(t, (uintptr_t)key, val, a);
+}
+
+bool upb_inttable_lookupptr(const upb_inttable *t, const void *key,
+                            upb_value *v) {
+  return upb_inttable_lookup(t, (uintptr_t)key, v);
+}
+
+bool upb_inttable_removeptr(upb_inttable *t, const void *key, upb_value *val) {
+  return upb_inttable_remove(t, (uintptr_t)key, val);
+}
+
+void upb_inttable_compact2(upb_inttable *t, upb_alloc *a) {
+  /* A power-of-two histogram of the table keys. */
+  size_t counts[UPB_MAXARRSIZE + 1] = {0};
+
+  /* The max key in each bucket. */
+  uintptr_t max[UPB_MAXARRSIZE + 1] = {0};
+
+  upb_inttable_iter i;
+  size_t arr_count;
+  int size_lg2;
+  upb_inttable new_t;
+
+  upb_check_alloc(&t->t, a);
+
+  upb_inttable_begin(&i, t);
+  for (; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+    uintptr_t key = upb_inttable_iter_key(&i);
+    int bucket = log2ceil(key);
+    max[bucket] = UPB_MAX(max[bucket], key);
+    counts[bucket]++;
+  }
+
+  /* Find the largest power of two that satisfies the MIN_DENSITY
+   * definition (while actually having some keys). */
+  arr_count = upb_inttable_count(t);
+
+  for (size_lg2 = ARRAY_SIZE(counts) - 1; size_lg2 > 0; size_lg2--) {
+    if (counts[size_lg2] == 0) {
+      /* We can halve again without losing any entries. */
+      continue;
+    } else if (arr_count >= (1 << size_lg2) * MIN_DENSITY) {
+      break;
+    }
+
+    arr_count -= counts[size_lg2];
+  }
+
+  UPB_ASSERT(arr_count <= upb_inttable_count(t));
+
+  {
+    /* Insert all elements into new, perfectly-sized table. */
+    size_t arr_size = max[size_lg2] + 1;  /* +1 so arr[max] will fit. */
+    size_t hash_count = upb_inttable_count(t) - arr_count;
+    size_t hash_size = hash_count ? (hash_count / MAX_LOAD) + 1 : 0;
+    int hashsize_lg2 = log2ceil(hash_size);
+
+    upb_inttable_sizedinit(&new_t, t->t.ctype, arr_size, hashsize_lg2, a);
+    upb_inttable_begin(&i, t);
+    for (; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+      uintptr_t k = upb_inttable_iter_key(&i);
+      upb_inttable_insert2(&new_t, k, upb_inttable_iter_value(&i), a);
+    }
+    UPB_ASSERT(new_t.array_size == arr_size);
+    UPB_ASSERT(new_t.t.size_lg2 == hashsize_lg2);
+  }
+  upb_inttable_uninit2(t, a);
+  *t = new_t;
+}
+
+/* Iteration. */
+
+static const upb_tabent *int_tabent(const upb_inttable_iter *i) {
+  UPB_ASSERT(!i->array_part);
+  return &i->t->t.entries[i->index];
+}
+
+static upb_tabval int_arrent(const upb_inttable_iter *i) {
+  UPB_ASSERT(i->array_part);
+  return i->t->array[i->index];
+}
+
+void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t) {
+  i->t = t;
+  i->index = -1;
+  i->array_part = true;
+  upb_inttable_next(i);
+}
+
+void upb_inttable_next(upb_inttable_iter *iter) {
+  const upb_inttable *t = iter->t;
+  if (iter->array_part) {
+    while (++iter->index < t->array_size) {
+      if (upb_arrhas(int_arrent(iter))) {
+        return;
+      }
+    }
+    iter->array_part = false;
+    iter->index = begin(&t->t);
+  } else {
+    iter->index = next(&t->t, iter->index);
+  }
+}
+
+bool upb_inttable_done(const upb_inttable_iter *i) {
+  if (!i->t) return true;
+  if (i->array_part) {
+    return i->index >= i->t->array_size ||
+           !upb_arrhas(int_arrent(i));
+  } else {
+    return i->index >= upb_table_size(&i->t->t) ||
+           upb_tabent_isempty(int_tabent(i));
+  }
+}
+
+uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i) {
+  UPB_ASSERT(!upb_inttable_done(i));
+  return i->array_part ? i->index : int_tabent(i)->key;
+}
+
+upb_value upb_inttable_iter_value(const upb_inttable_iter *i) {
+  UPB_ASSERT(!upb_inttable_done(i));
+  return _upb_value_val(
+      i->array_part ? i->t->array[i->index].val : int_tabent(i)->val.val,
+      i->t->t.ctype);
+}
+
+void upb_inttable_iter_setdone(upb_inttable_iter *i) {
+  i->t = NULL;
+  i->index = SIZE_MAX;
+  i->array_part = false;
+}
+
+bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
+                                          const upb_inttable_iter *i2) {
+  if (upb_inttable_done(i1) && upb_inttable_done(i2))
+    return true;
+  return i1->t == i2->t && i1->index == i2->index &&
+         i1->array_part == i2->array_part;
+}
+
+#if defined(UPB_UNALIGNED_READS_OK) || defined(__s390x__)
+/* -----------------------------------------------------------------------------
+ * MurmurHash2, by Austin Appleby (released as public domain).
+ * Reformatted and C99-ified by Joshua Haberman.
+ * Note - This code makes a few assumptions about how your machine behaves -
+ *   1. We can read a 4-byte value from any address without crashing
+ *   2. sizeof(int) == 4 (in upb this limitation is removed by using uint32_t
+ * And it has a few limitations -
+ *   1. It will not work incrementally.
+ *   2. It will not produce the same results on little-endian and big-endian
+ *      machines. */
+uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) {
+  /* 'm' and 'r' are mixing constants generated offline.
+   * They're not really 'magic', they just happen to work well. */
+  const uint32_t m = 0x5bd1e995;
+  const int32_t r = 24;
+
+  /* Initialize the hash to a 'random' value */
+  uint32_t h = seed ^ len;
+
+  /* Mix 4 bytes at a time into the hash */
+  const uint8_t * data = (const uint8_t *)key;
+  while(len >= 4) {
+    uint32_t k = *(uint32_t *)data;
+
+    k *= m;
+    k ^= k >> r;
+    k *= m;
+
+    h *= m;
+    h ^= k;
+
+    data += 4;
+    len -= 4;
+  }
+
+  /* Handle the last few bytes of the input array */
+  switch(len) {
+    case 3: h ^= data[2] << 16;
+    case 2: h ^= data[1] << 8;
+    case 1: h ^= data[0]; h *= m;
+  };
+
+  /* Do a few final mixes of the hash to ensure the last few
+   * bytes are well-incorporated. */
+  h ^= h >> 13;
+  h *= m;
+  h ^= h >> 15;
+
+  return h;
+}
+
+#else /* !UPB_UNALIGNED_READS_OK */
+
+/* -----------------------------------------------------------------------------
+ * MurmurHashAligned2, by Austin Appleby
+ * Same algorithm as MurmurHash2, but only does aligned reads - should be safer
+ * on certain platforms.
+ * Performance will be lower than MurmurHash2 */
+
+#define MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
+
+uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed) {
+  const uint32_t m = 0x5bd1e995;
+  const int32_t r = 24;
+  const uint8_t * data = (const uint8_t *)key;
+  uint32_t h = (uint32_t)(seed ^ len);
+  uint8_t align = (uintptr_t)data & 3;
+
+  if(align && (len >= 4)) {
+    /* Pre-load the temp registers */
+    uint32_t t = 0, d = 0;
+    int32_t sl;
+    int32_t sr;
+
+    switch(align) {
+      case 1: t |= data[2] << 16;
+      case 2: t |= data[1] << 8;
+      case 3: t |= data[0];
+    }
+
+    t <<= (8 * align);
+
+    data += 4-align;
+    len -= 4-align;
+
+    sl = 8 * (4-align);
+    sr = 8 * align;
+
+    /* Mix */
+
+    while(len >= 4) {
+      uint32_t k;
+
+      d = *(uint32_t *)data;
+      t = (t >> sr) | (d << sl);
+
+      k = t;
+
+      MIX(h,k,m);
+
+      t = d;
+
+      data += 4;
+      len -= 4;
+    }
+
+    /* Handle leftover data in temp registers */
+
+    d = 0;
+
+    if(len >= align) {
+      uint32_t k;
+
+      switch(align) {
+        case 3: d |= data[2] << 16;
+        case 2: d |= data[1] << 8;
+        case 1: d |= data[0];
+      }
+
+      k = (t >> sr) | (d << sl);
+      MIX(h,k,m);
+
+      data += align;
+      len -= align;
+
+      /* ----------
+       * Handle tail bytes */
+
+      switch(len) {
+        case 3: h ^= data[2] << 16;
+        case 2: h ^= data[1] << 8;
+        case 1: h ^= data[0]; h *= m;
+      };
+    } else {
+      switch(len) {
+        case 3: d |= data[2] << 16;
+        case 2: d |= data[1] << 8;
+        case 1: d |= data[0];
+        case 0: h ^= (t >> sr) | (d << sl); h *= m;
+      }
+    }
+
+    h ^= h >> 13;
+    h *= m;
+    h ^= h >> 15;
+
+    return h;
+  } else {
+    while(len >= 4) {
+      uint32_t k = *(uint32_t *)data;
+
+      MIX(h,k,m);
+
+      data += 4;
+      len -= 4;
+    }
+
+    /* ----------
+     * Handle tail bytes */
+
+    switch(len) {
+      case 3: h ^= data[2] << 16;
+      case 2: h ^= data[1] << 8;
+      case 1: h ^= data[0]; h *= m;
+    };
+
+    h ^= h >> 13;
+    h *= m;
+    h ^= h >> 15;
+
+    return h;
+  }
+}
+#undef MIX
+
+#endif /* UPB_UNALIGNED_READS_OK */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/table.int.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/table.int.h
new file mode 100644 (file)
index 0000000..23b0b2f
--- /dev/null
@@ -0,0 +1,507 @@
+/*
+** upb_table
+**
+** This header is INTERNAL-ONLY!  Its interfaces are not public or stable!
+** This file defines very fast int->upb_value (inttable) and string->upb_value
+** (strtable) hash tables.
+**
+** The table uses chained scatter with Brent's variation (inspired by the Lua
+** implementation of hash tables).  The hash function for strings is Austin
+** Appleby's "MurmurHash."
+**
+** The inttable uses uintptr_t as its key, which guarantees it can be used to
+** store pointers or integers of at least 32 bits (upb isn't really useful on
+** systems where sizeof(void*) < 4).
+**
+** The table must be homogenous (all values of the same type).  In debug
+** mode, we check this on insert and lookup.
+*/
+
+#ifndef UPB_TABLE_H_
+#define UPB_TABLE_H_
+
+#include <stdint.h>
+#include <string.h>
+#include "upb/upb.h"
+
+#include "upb/port_def.inc"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* upb_value ******************************************************************/
+
+/* A tagged union (stored untagged inside the table) so that we can check that
+ * clients calling table accessors are correctly typed without having to have
+ * an explosion of accessors. */
+typedef enum {
+  UPB_CTYPE_INT32    = 1,
+  UPB_CTYPE_INT64    = 2,
+  UPB_CTYPE_UINT32   = 3,
+  UPB_CTYPE_UINT64   = 4,
+  UPB_CTYPE_BOOL     = 5,
+  UPB_CTYPE_CSTR     = 6,
+  UPB_CTYPE_PTR      = 7,
+  UPB_CTYPE_CONSTPTR = 8,
+  UPB_CTYPE_FPTR     = 9,
+  UPB_CTYPE_FLOAT    = 10,
+  UPB_CTYPE_DOUBLE   = 11
+} upb_ctype_t;
+
+typedef struct {
+  uint64_t val;
+#ifndef NDEBUG
+  /* In debug mode we carry the value type around also so we can check accesses
+   * to be sure the right member is being read. */
+  upb_ctype_t ctype;
+#endif
+} upb_value;
+
+#ifdef NDEBUG
+#define SET_TYPE(dest, val)      UPB_UNUSED(val)
+#else
+#define SET_TYPE(dest, val) dest = val
+#endif
+
+/* Like strdup(), which isn't always available since it's not ANSI C. */
+char *upb_strdup(const char *s, upb_alloc *a);
+/* Variant that works with a length-delimited rather than NULL-delimited string,
+ * as supported by strtable. */
+char *upb_strdup2(const char *s, size_t len, upb_alloc *a);
+
+UPB_INLINE char *upb_gstrdup(const char *s) {
+  return upb_strdup(s, &upb_alloc_global);
+}
+
+UPB_INLINE void _upb_value_setval(upb_value *v, uint64_t val,
+                                  upb_ctype_t ctype) {
+  v->val = val;
+  SET_TYPE(v->ctype, ctype);
+}
+
+UPB_INLINE upb_value _upb_value_val(uint64_t val, upb_ctype_t ctype) {
+  upb_value ret;
+  _upb_value_setval(&ret, val, ctype);
+  return ret;
+}
+
+/* For each value ctype, define the following set of functions:
+ *
+ * // Get/set an int32 from a upb_value.
+ * int32_t upb_value_getint32(upb_value val);
+ * void upb_value_setint32(upb_value *val, int32_t cval);
+ *
+ * // Construct a new upb_value from an int32.
+ * upb_value upb_value_int32(int32_t val); */
+#define FUNCS(name, membername, type_t, converter, proto_type) \
+  UPB_INLINE void upb_value_set ## name(upb_value *val, type_t cval) { \
+    val->val = (converter)cval; \
+    SET_TYPE(val->ctype, proto_type); \
+  } \
+  UPB_INLINE upb_value upb_value_ ## name(type_t val) { \
+    upb_value ret; \
+    upb_value_set ## name(&ret, val); \
+    return ret; \
+  } \
+  UPB_INLINE type_t upb_value_get ## name(upb_value val) { \
+    UPB_ASSERT_DEBUGVAR(val.ctype == proto_type); \
+    return (type_t)(converter)val.val; \
+  }
+
+FUNCS(int32,    int32,        int32_t,      int32_t,    UPB_CTYPE_INT32)
+FUNCS(int64,    int64,        int64_t,      int64_t,    UPB_CTYPE_INT64)
+FUNCS(uint32,   uint32,       uint32_t,     uint32_t,   UPB_CTYPE_UINT32)
+FUNCS(uint64,   uint64,       uint64_t,     uint64_t,   UPB_CTYPE_UINT64)
+FUNCS(bool,     _bool,        bool,         bool,       UPB_CTYPE_BOOL)
+FUNCS(cstr,     cstr,         char*,        uintptr_t,  UPB_CTYPE_CSTR)
+FUNCS(ptr,      ptr,          void*,        uintptr_t,  UPB_CTYPE_PTR)
+FUNCS(constptr, constptr,     const void*,  uintptr_t,  UPB_CTYPE_CONSTPTR)
+FUNCS(fptr,     fptr,         upb_func*,    uintptr_t,  UPB_CTYPE_FPTR)
+
+#undef FUNCS
+
+UPB_INLINE void upb_value_setfloat(upb_value *val, float cval) {
+  memcpy(&val->val, &cval, sizeof(cval));
+  SET_TYPE(val->ctype, UPB_CTYPE_FLOAT);
+}
+
+UPB_INLINE void upb_value_setdouble(upb_value *val, double cval) {
+  memcpy(&val->val, &cval, sizeof(cval));
+  SET_TYPE(val->ctype, UPB_CTYPE_DOUBLE);
+}
+
+UPB_INLINE upb_value upb_value_float(float cval) {
+  upb_value ret;
+  upb_value_setfloat(&ret, cval);
+  return ret;
+}
+
+UPB_INLINE upb_value upb_value_double(double cval) {
+  upb_value ret;
+  upb_value_setdouble(&ret, cval);
+  return ret;
+}
+
+#undef SET_TYPE
+
+
+/* upb_tabkey *****************************************************************/
+
+/* Either:
+ *   1. an actual integer key, or
+ *   2. a pointer to a string prefixed by its uint32_t length, owned by us.
+ *
+ * ...depending on whether this is a string table or an int table.  We would
+ * make this a union of those two types, but C89 doesn't support statically
+ * initializing a non-first union member. */
+typedef uintptr_t upb_tabkey;
+
+UPB_INLINE char *upb_tabstr(upb_tabkey key, uint32_t *len) {
+  char* mem = (char*)key;
+  if (len) memcpy(len, mem, sizeof(*len));
+  return mem + sizeof(*len);
+}
+
+
+/* upb_tabval *****************************************************************/
+
+typedef struct {
+  uint64_t val;
+} upb_tabval;
+
+#define UPB_TABVALUE_EMPTY_INIT  {-1}
+
+
+/* upb_table ******************************************************************/
+
+typedef struct _upb_tabent {
+  upb_tabkey key;
+  upb_tabval val;
+
+  /* Internal chaining.  This is const so we can create static initializers for
+   * tables.  We cast away const sometimes, but *only* when the containing
+   * upb_table is known to be non-const.  This requires a bit of care, but
+   * the subtlety is confined to table.c. */
+  const struct _upb_tabent *next;
+} upb_tabent;
+
+typedef struct {
+  size_t count;          /* Number of entries in the hash part. */
+  size_t mask;           /* Mask to turn hash value -> bucket. */
+  upb_ctype_t ctype;     /* Type of all values. */
+  uint8_t size_lg2;      /* Size of the hashtable part is 2^size_lg2 entries. */
+
+  /* Hash table entries.
+   * Making this const isn't entirely accurate; what we really want is for it to
+   * have the same const-ness as the table it's inside.  But there's no way to
+   * declare that in C.  So we have to make it const so that we can statically
+   * initialize const hash tables.  Then we cast away const when we have to.
+   */
+  const upb_tabent *entries;
+
+#ifndef NDEBUG
+  /* This table's allocator.  We make the user pass it in to every relevant
+   * function and only use this to check it in debug mode.  We do this solely
+   * to keep upb_table as small as possible.  This might seem slightly paranoid
+   * but the plan is to use upb_table for all map fields and extension sets in
+   * a forthcoming message representation, so there could be a lot of these.
+   * If this turns out to be too annoying later, we can change it (since this
+   * is an internal-only header file). */
+  upb_alloc *alloc;
+#endif
+} upb_table;
+
+typedef struct {
+  upb_table t;
+} upb_strtable;
+
+typedef struct {
+  upb_table t;              /* For entries that don't fit in the array part. */
+  const upb_tabval *array;  /* Array part of the table. See const note above. */
+  size_t array_size;        /* Array part size. */
+  size_t array_count;       /* Array part number of elements. */
+} upb_inttable;
+
+#define UPB_INTTABLE_INIT(count, mask, ctype, size_lg2, ent, a, asize, acount) \
+  {UPB_TABLE_INIT(count, mask, ctype, size_lg2, ent), a, asize, acount}
+
+#define UPB_EMPTY_INTTABLE_INIT(ctype) \
+  UPB_INTTABLE_INIT(0, 0, ctype, 0, NULL, NULL, 0, 0)
+
+#define UPB_ARRAY_EMPTYENT -1
+
+UPB_INLINE size_t upb_table_size(const upb_table *t) {
+  if (t->size_lg2 == 0)
+    return 0;
+  else
+    return 1 << t->size_lg2;
+}
+
+/* Internal-only functions, in .h file only out of necessity. */
+UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e) {
+  return e->key == 0;
+}
+
+/* Used by some of the unit tests for generic hashing functionality. */
+uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed);
+
+UPB_INLINE uintptr_t upb_intkey(uintptr_t key) {
+  return key;
+}
+
+UPB_INLINE uint32_t upb_inthash(uintptr_t key) {
+  return (uint32_t)key;
+}
+
+static const upb_tabent *upb_getentry(const upb_table *t, uint32_t hash) {
+  return t->entries + (hash & t->mask);
+}
+
+UPB_INLINE bool upb_arrhas(upb_tabval key) {
+  return key.val != (uint64_t)-1;
+}
+
+/* Initialize and uninitialize a table, respectively.  If memory allocation
+ * failed, false is returned that the table is uninitialized. */
+bool upb_inttable_init2(upb_inttable *table, upb_ctype_t ctype, upb_alloc *a);
+bool upb_strtable_init2(upb_strtable *table, upb_ctype_t ctype, upb_alloc *a);
+void upb_inttable_uninit2(upb_inttable *table, upb_alloc *a);
+void upb_strtable_uninit2(upb_strtable *table, upb_alloc *a);
+
+UPB_INLINE bool upb_inttable_init(upb_inttable *table, upb_ctype_t ctype) {
+  return upb_inttable_init2(table, ctype, &upb_alloc_global);
+}
+
+UPB_INLINE bool upb_strtable_init(upb_strtable *table, upb_ctype_t ctype) {
+  return upb_strtable_init2(table, ctype, &upb_alloc_global);
+}
+
+UPB_INLINE void upb_inttable_uninit(upb_inttable *table) {
+  upb_inttable_uninit2(table, &upb_alloc_global);
+}
+
+UPB_INLINE void upb_strtable_uninit(upb_strtable *table) {
+  upb_strtable_uninit2(table, &upb_alloc_global);
+}
+
+/* Returns the number of values in the table. */
+size_t upb_inttable_count(const upb_inttable *t);
+UPB_INLINE size_t upb_strtable_count(const upb_strtable *t) {
+  return t->t.count;
+}
+
+void upb_inttable_packedsize(const upb_inttable *t, size_t *size);
+void upb_strtable_packedsize(const upb_strtable *t, size_t *size);
+upb_inttable *upb_inttable_pack(const upb_inttable *t, void *p, size_t *ofs,
+                                size_t size);
+upb_strtable *upb_strtable_pack(const upb_strtable *t, void *p, size_t *ofs,
+                                size_t size);
+
+/* Inserts the given key into the hashtable with the given value.  The key must
+ * not already exist in the hash table.  For string tables, the key must be
+ * NULL-terminated, and the table will make an internal copy of the key.
+ * Inttables must not insert a value of UINTPTR_MAX.
+ *
+ * If a table resize was required but memory allocation failed, false is
+ * returned and the table is unchanged. */
+bool upb_inttable_insert2(upb_inttable *t, uintptr_t key, upb_value val,
+                          upb_alloc *a);
+bool upb_strtable_insert3(upb_strtable *t, const char *key, size_t len,
+                          upb_value val, upb_alloc *a);
+
+UPB_INLINE bool upb_inttable_insert(upb_inttable *t, uintptr_t key,
+                                    upb_value val) {
+  return upb_inttable_insert2(t, key, val, &upb_alloc_global);
+}
+
+UPB_INLINE bool upb_strtable_insert2(upb_strtable *t, const char *key,
+                                     size_t len, upb_value val) {
+  return upb_strtable_insert3(t, key, len, val, &upb_alloc_global);
+}
+
+/* For NULL-terminated strings. */
+UPB_INLINE bool upb_strtable_insert(upb_strtable *t, const char *key,
+                                    upb_value val) {
+  return upb_strtable_insert2(t, key, strlen(key), val);
+}
+
+/* Looks up key in this table, returning "true" if the key was found.
+ * If v is non-NULL, copies the value for this key into *v. */
+bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v);
+bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
+                          upb_value *v);
+
+/* For NULL-terminated strings. */
+UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key,
+                                    upb_value *v) {
+  return upb_strtable_lookup2(t, key, strlen(key), v);
+}
+
+/* Removes an item from the table.  Returns true if the remove was successful,
+ * and stores the removed item in *val if non-NULL. */
+bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val);
+bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len,
+                          upb_value *val, upb_alloc *alloc);
+
+UPB_INLINE bool upb_strtable_remove2(upb_strtable *t, const char *key,
+                                     size_t len, upb_value *val) {
+  return upb_strtable_remove3(t, key, len, val, &upb_alloc_global);
+}
+
+/* For NULL-terminated strings. */
+UPB_INLINE bool upb_strtable_remove(upb_strtable *t, const char *key,
+                                    upb_value *v) {
+  return upb_strtable_remove2(t, key, strlen(key), v);
+}
+
+/* Updates an existing entry in an inttable.  If the entry does not exist,
+ * returns false and does nothing.  Unlike insert/remove, this does not
+ * invalidate iterators. */
+bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val);
+
+/* Handy routines for treating an inttable like a stack.  May not be mixed with
+ * other insert/remove calls. */
+bool upb_inttable_push2(upb_inttable *t, upb_value val, upb_alloc *a);
+upb_value upb_inttable_pop(upb_inttable *t);
+
+UPB_INLINE bool upb_inttable_push(upb_inttable *t, upb_value val) {
+  return upb_inttable_push2(t, val, &upb_alloc_global);
+}
+
+/* Convenience routines for inttables with pointer keys. */
+bool upb_inttable_insertptr2(upb_inttable *t, const void *key, upb_value val,
+                             upb_alloc *a);
+bool upb_inttable_removeptr(upb_inttable *t, const void *key, upb_value *val);
+bool upb_inttable_lookupptr(
+    const upb_inttable *t, const void *key, upb_value *val);
+
+UPB_INLINE bool upb_inttable_insertptr(upb_inttable *t, const void *key,
+                                       upb_value val) {
+  return upb_inttable_insertptr2(t, key, val, &upb_alloc_global);
+}
+
+/* Optimizes the table for the current set of entries, for both memory use and
+ * lookup time.  Client should call this after all entries have been inserted;
+ * inserting more entries is legal, but will likely require a table resize. */
+void upb_inttable_compact2(upb_inttable *t, upb_alloc *a);
+
+UPB_INLINE void upb_inttable_compact(upb_inttable *t) {
+  upb_inttable_compact2(t, &upb_alloc_global);
+}
+
+/* A special-case inlinable version of the lookup routine for 32-bit
+ * integers. */
+UPB_INLINE bool upb_inttable_lookup32(const upb_inttable *t, uint32_t key,
+                                      upb_value *v) {
+  *v = upb_value_int32(0);  /* Silence compiler warnings. */
+  if (key < t->array_size) {
+    upb_tabval arrval = t->array[key];
+    if (upb_arrhas(arrval)) {
+      _upb_value_setval(v, arrval.val, t->t.ctype);
+      return true;
+    } else {
+      return false;
+    }
+  } else {
+    const upb_tabent *e;
+    if (t->t.entries == NULL) return false;
+    for (e = upb_getentry(&t->t, upb_inthash(key)); true; e = e->next) {
+      if ((uint32_t)e->key == key) {
+        _upb_value_setval(v, e->val.val, t->t.ctype);
+        return true;
+      }
+      if (e->next == NULL) return false;
+    }
+  }
+}
+
+/* Exposed for testing only. */
+bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_alloc *a);
+
+/* Iterators ******************************************************************/
+
+/* Iterators for int and string tables.  We are subject to some kind of unusual
+ * design constraints:
+ *
+ * For high-level languages:
+ *  - we must be able to guarantee that we don't crash or corrupt memory even if
+ *    the program accesses an invalidated iterator.
+ *
+ * For C++11 range-based for:
+ *  - iterators must be copyable
+ *  - iterators must be comparable
+ *  - it must be possible to construct an "end" value.
+ *
+ * Iteration order is undefined.
+ *
+ * Modifying the table invalidates iterators.  upb_{str,int}table_done() is
+ * guaranteed to work even on an invalidated iterator, as long as the table it
+ * is iterating over has not been freed.  Calling next() or accessing data from
+ * an invalidated iterator yields unspecified elements from the table, but it is
+ * guaranteed not to crash and to return real table elements (except when done()
+ * is true). */
+
+
+/* upb_strtable_iter **********************************************************/
+
+/*   upb_strtable_iter i;
+ *   upb_strtable_begin(&i, t);
+ *   for(; !upb_strtable_done(&i); upb_strtable_next(&i)) {
+ *     const char *key = upb_strtable_iter_key(&i);
+ *     const upb_value val = upb_strtable_iter_value(&i);
+ *     // ...
+ *   }
+ */
+
+typedef struct {
+  const upb_strtable *t;
+  size_t index;
+} upb_strtable_iter;
+
+void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t);
+void upb_strtable_next(upb_strtable_iter *i);
+bool upb_strtable_done(const upb_strtable_iter *i);
+const char *upb_strtable_iter_key(const upb_strtable_iter *i);
+size_t upb_strtable_iter_keylength(const upb_strtable_iter *i);
+upb_value upb_strtable_iter_value(const upb_strtable_iter *i);
+void upb_strtable_iter_setdone(upb_strtable_iter *i);
+bool upb_strtable_iter_isequal(const upb_strtable_iter *i1,
+                               const upb_strtable_iter *i2);
+
+
+/* upb_inttable_iter **********************************************************/
+
+/*   upb_inttable_iter i;
+ *   upb_inttable_begin(&i, t);
+ *   for(; !upb_inttable_done(&i); upb_inttable_next(&i)) {
+ *     uintptr_t key = upb_inttable_iter_key(&i);
+ *     upb_value val = upb_inttable_iter_value(&i);
+ *     // ...
+ *   }
+ */
+
+typedef struct {
+  const upb_inttable *t;
+  size_t index;
+  bool array_part;
+} upb_inttable_iter;
+
+void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t);
+void upb_inttable_next(upb_inttable_iter *i);
+bool upb_inttable_done(const upb_inttable_iter *i);
+uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i);
+upb_value upb_inttable_iter_value(const upb_inttable_iter *i);
+void upb_inttable_iter_setdone(upb_inttable_iter *i);
+bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
+                               const upb_inttable_iter *i2);
+
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#include "upb/port_undef.inc"
+
+#endif  /* UPB_TABLE_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/upb.c b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/upb.c
new file mode 100644 (file)
index 0000000..266ea7d
--- /dev/null
@@ -0,0 +1,261 @@
+
+#include "upb/upb.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "upb/port_def.inc"
+
+/* Guarantee null-termination and provide ellipsis truncation.
+ * It may be tempting to "optimize" this by initializing these final
+ * four bytes up-front and then being careful never to overwrite them,
+ * this is safer and simpler. */
+static void nullz(upb_status *status) {
+  const char *ellipsis = "...";
+  size_t len = strlen(ellipsis);
+  UPB_ASSERT(sizeof(status->msg) > len);
+  memcpy(status->msg + sizeof(status->msg) - len, ellipsis, len);
+}
+
+/* upb_status *****************************************************************/
+
+void upb_status_clear(upb_status *status) {
+  if (!status) return;
+  status->ok = true;
+  status->msg[0] = '\0';
+}
+
+bool upb_ok(const upb_status *status) { return status->ok; }
+
+const char *upb_status_errmsg(const upb_status *status) { return status->msg; }
+
+void upb_status_seterrmsg(upb_status *status, const char *msg) {
+  if (!status) return;
+  status->ok = false;
+  strncpy(status->msg, msg, sizeof(status->msg));
+  nullz(status);
+}
+
+void upb_status_seterrf(upb_status *status, const char *fmt, ...) {
+  va_list args;
+  va_start(args, fmt);
+  upb_status_vseterrf(status, fmt, args);
+  va_end(args);
+}
+
+void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args) {
+  if (!status) return;
+  status->ok = false;
+  _upb_vsnprintf(status->msg, sizeof(status->msg), fmt, args);
+  nullz(status);
+}
+
+/* upb_alloc ******************************************************************/
+
+static void *upb_global_allocfunc(upb_alloc *alloc, void *ptr, size_t oldsize,
+                                  size_t size) {
+  UPB_UNUSED(alloc);
+  UPB_UNUSED(oldsize);
+  if (size == 0) {
+    free(ptr);
+    return NULL;
+  } else {
+    return realloc(ptr, size);
+  }
+}
+
+upb_alloc upb_alloc_global = {&upb_global_allocfunc};
+
+/* upb_arena ******************************************************************/
+
+/* Be conservative and choose 16 in case anyone is using SSE. */
+static const size_t maxalign = 16;
+
+static size_t align_up_max(size_t size) {
+  return ((size + maxalign - 1) / maxalign) * maxalign;
+}
+
+struct upb_arena {
+  /* We implement the allocator interface.
+   * This must be the first member of upb_arena! */
+  upb_alloc alloc;
+
+  /* Allocator to allocate arena blocks.  We are responsible for freeing these
+   * when we are destroyed. */
+  upb_alloc *block_alloc;
+
+  size_t bytes_allocated;
+  size_t next_block_size;
+  size_t max_block_size;
+
+  /* Linked list of blocks.  Points to an arena_block, defined in env.c */
+  void *block_head;
+
+  /* Cleanup entries.  Pointer to a cleanup_ent, defined in env.c */
+  void *cleanup_head;
+};
+
+typedef struct mem_block {
+  struct mem_block *next;
+  size_t size;
+  size_t used;
+  bool owned;
+  /* Data follows. */
+} mem_block;
+
+typedef struct cleanup_ent {
+  struct cleanup_ent *next;
+  upb_cleanup_func *cleanup;
+  void *ud;
+} cleanup_ent;
+
+static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size,
+                               bool owned) {
+  mem_block *block = ptr;
+
+  block->next = a->block_head;
+  block->size = size;
+  block->used = align_up_max(sizeof(mem_block));
+  block->owned = owned;
+
+  a->block_head = block;
+
+  /* TODO(haberman): ASAN poison. */
+}
+
+static mem_block *upb_arena_allocblock(upb_arena *a, size_t size) {
+  size_t block_size = UPB_MAX(size, a->next_block_size) + sizeof(mem_block);
+  mem_block *block = upb_malloc(a->block_alloc, block_size);
+
+  if (!block) {
+    return NULL;
+  }
+
+  upb_arena_addblock(a, block, block_size, true);
+  a->next_block_size = UPB_MIN(block_size * 2, a->max_block_size);
+
+  return block;
+}
+
+static void *upb_arena_doalloc(upb_alloc *alloc, void *ptr, size_t oldsize,
+                               size_t size) {
+  upb_arena *a = (upb_arena*)alloc;  /* upb_alloc is initial member. */
+  mem_block *block = a->block_head;
+  void *ret;
+
+  if (size == 0) {
+    return NULL;  /* We are an arena, don't need individual frees. */
+  }
+
+  size = align_up_max(size);
+
+  /* TODO(haberman): special-case if this is a realloc of the last alloc? */
+
+  if (!block || block->size - block->used < size) {
+    /* Slow path: have to allocate a new block. */
+    block = upb_arena_allocblock(a, size);
+
+    if (!block) {
+      return NULL;  /* Out of memory. */
+    }
+  }
+
+  ret = (char*)block + block->used;
+  block->used += size;
+
+  if (oldsize > 0) {
+    memcpy(ret, ptr, oldsize);  /* Preserve existing data. */
+  }
+
+  /* TODO(haberman): ASAN unpoison. */
+
+  a->bytes_allocated += size;
+  return ret;
+}
+
+/* Public Arena API ***********************************************************/
+
+#define upb_alignof(type) offsetof (struct { char c; type member; }, member)
+
+upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc) {
+  const size_t first_block_overhead = sizeof(upb_arena) + sizeof(mem_block);
+  upb_arena *a;
+  bool owned = false;
+
+  /* Round block size down to alignof(*a) since we will allocate the arena
+   * itself at the end. */
+  n &= ~(upb_alignof(upb_arena) - 1);
+
+  if (n < first_block_overhead) {
+    /* We need to malloc the initial block. */
+    n = first_block_overhead + 256;
+    owned = true;
+    if (!alloc || !(mem = upb_malloc(alloc, n))) {
+      return NULL;
+    }
+  }
+
+  a = (void*)((char*)mem + n - sizeof(*a));
+  n -= sizeof(*a);
+
+  a->alloc.func = &upb_arena_doalloc;
+  a->block_alloc = &upb_alloc_global;
+  a->bytes_allocated = 0;
+  a->next_block_size = 256;
+  a->max_block_size = 16384;
+  a->cleanup_head = NULL;
+  a->block_head = NULL;
+  a->block_alloc = alloc;
+
+  upb_arena_addblock(a, mem, n, owned);
+
+  return a;
+}
+
+#undef upb_alignof
+
+void upb_arena_free(upb_arena *a) {
+  cleanup_ent *ent = a->cleanup_head;
+  mem_block *block = a->block_head;
+
+  while (ent) {
+    ent->cleanup(ent->ud);
+    ent = ent->next;
+  }
+
+  /* Must do this after running cleanup functions, because this will delete
+   * the memory we store our cleanup entries in! */
+  while (block) {
+    /* Load first since we are deleting block. */
+    mem_block *next = block->next;
+
+    if (block->owned) {
+      upb_free(a->block_alloc, block);
+    }
+
+    block = next;
+  }
+}
+
+bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func) {
+  cleanup_ent *ent = upb_malloc(&a->alloc, sizeof(cleanup_ent));
+  if (!ent) {
+    return false;  /* Out of memory. */
+  }
+
+  ent->cleanup = func;
+  ent->ud = ud;
+  ent->next = a->cleanup_head;
+  a->cleanup_head = ent;
+
+  return true;
+}
+
+size_t upb_arena_bytesallocated(const upb_arena *a) {
+  return a->bytes_allocated;
+}
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upb/upb.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upb/upb.h
new file mode 100644 (file)
index 0000000..79c19d2
--- /dev/null
@@ -0,0 +1,364 @@
+/*
+** This file contains shared definitions that are widely used across upb.
+**
+** This is a mixed C/C++ interface that offers a full API to both languages.
+** See the top-level README for more information.
+*/
+
+#ifndef UPB_H_
+#define UPB_H_
+
+#include <assert.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+#include <memory>
+namespace upb {
+class Arena;
+class Status;
+template <int N> class InlinedArena;
+}
+#endif
+
+#include "upb/port_def.inc"
+
+/* upb_status *****************************************************************/
+
+/* upb_status represents a success or failure status and error message.
+ * It owns no resources and allocates no memory, so it should work
+ * even in OOM situations. */
+
+/* The maximum length of an error message before it will get truncated. */
+#define UPB_STATUS_MAX_MESSAGE 127
+
+typedef struct {
+  bool ok;
+  char msg[UPB_STATUS_MAX_MESSAGE];  /* Error message; NULL-terminated. */
+} upb_status;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char *upb_status_errmsg(const upb_status *status);
+bool upb_ok(const upb_status *status);
+
+/* Any of the functions that write to a status object allow status to be NULL,
+ * to support use cases where the function's caller does not care about the
+ * status message. */
+void upb_status_clear(upb_status *status);
+void upb_status_seterrmsg(upb_status *status, const char *msg);
+void upb_status_seterrf(upb_status *status, const char *fmt, ...);
+void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args);
+
+UPB_INLINE void upb_status_setoom(upb_status *status) {
+  upb_status_seterrmsg(status, "out of memory");
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+class upb::Status {
+ public:
+  Status() { upb_status_clear(&status_); }
+
+  upb_status* ptr() { return &status_; }
+
+  /* Returns true if there is no error. */
+  bool ok() const { return upb_ok(&status_); }
+
+  /* Guaranteed to be NULL-terminated. */
+  const char *error_message() const { return upb_status_errmsg(&status_); }
+
+  /* The error message will be truncated if it is longer than
+   * UPB_STATUS_MAX_MESSAGE-4. */
+  void SetErrorMessage(const char *msg) { upb_status_seterrmsg(&status_, msg); }
+  void SetFormattedErrorMessage(const char *fmt, ...) {
+    va_list args;
+    va_start(args, fmt);
+    upb_status_vseterrf(&status_, fmt, args);
+    va_end(args);
+  }
+
+  /* Resets the status to a successful state with no message. */
+  void Clear() { upb_status_clear(&status_); }
+
+ private:
+  upb_status status_;
+};
+
+#endif  /* __cplusplus */
+
+/** upb_strview ************************************************************/
+
+typedef struct {
+  const char *data;
+  size_t size;
+} upb_strview;
+
+UPB_INLINE upb_strview upb_strview_make(const char *data, size_t size) {
+  upb_strview ret;
+  ret.data = data;
+  ret.size = size;
+  return ret;
+}
+
+UPB_INLINE upb_strview upb_strview_makez(const char *data) {
+  return upb_strview_make(data, strlen(data));
+}
+
+UPB_INLINE bool upb_strview_eql(upb_strview a, upb_strview b) {
+  return a.size == b.size && memcmp(a.data, b.data, a.size) == 0;
+}
+
+#define UPB_STRVIEW_INIT(ptr, len) {ptr, len}
+
+#define UPB_STRVIEW_FORMAT "%.*s"
+#define UPB_STRVIEW_ARGS(view) (int)(view).size, (view).data
+
+/** upb_alloc *****************************************************************/
+
+/* A upb_alloc is a possibly-stateful allocator object.
+ *
+ * It could either be an arena allocator (which doesn't require individual
+ * free() calls) or a regular malloc() (which does).  The client must therefore
+ * free memory unless it knows that the allocator is an arena allocator. */
+
+struct upb_alloc;
+typedef struct upb_alloc upb_alloc;
+
+/* A malloc()/free() function.
+ * If "size" is 0 then the function acts like free(), otherwise it acts like
+ * realloc().  Only "oldsize" bytes from a previous allocation are preserved. */
+typedef void *upb_alloc_func(upb_alloc *alloc, void *ptr, size_t oldsize,
+                             size_t size);
+
+struct upb_alloc {
+  upb_alloc_func *func;
+};
+
+UPB_INLINE void *upb_malloc(upb_alloc *alloc, size_t size) {
+  UPB_ASSERT(alloc);
+  return alloc->func(alloc, NULL, 0, size);
+}
+
+UPB_INLINE void *upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize,
+                             size_t size) {
+  UPB_ASSERT(alloc);
+  return alloc->func(alloc, ptr, oldsize, size);
+}
+
+UPB_INLINE void upb_free(upb_alloc *alloc, void *ptr) {
+  assert(alloc);
+  alloc->func(alloc, ptr, 0, 0);
+}
+
+/* The global allocator used by upb.  Uses the standard malloc()/free(). */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern upb_alloc upb_alloc_global;
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+/* Functions that hard-code the global malloc.
+ *
+ * We still get benefit because we can put custom logic into our global
+ * allocator, like injecting out-of-memory faults in debug/testing builds. */
+
+UPB_INLINE void *upb_gmalloc(size_t size) {
+  return upb_malloc(&upb_alloc_global, size);
+}
+
+UPB_INLINE void *upb_grealloc(void *ptr, size_t oldsize, size_t size) {
+  return upb_realloc(&upb_alloc_global, ptr, oldsize, size);
+}
+
+UPB_INLINE void upb_gfree(void *ptr) {
+  upb_free(&upb_alloc_global, ptr);
+}
+
+/* upb_arena ******************************************************************/
+
+/* upb_arena is a specific allocator implementation that uses arena allocation.
+ * The user provides an allocator that will be used to allocate the underlying
+ * arena blocks.  Arenas by nature do not require the individual allocations
+ * to be freed.  However the Arena does allow users to register cleanup
+ * functions that will run when the arena is destroyed.
+ *
+ * A upb_arena is *not* thread-safe.
+ *
+ * You could write a thread-safe arena allocator that satisfies the
+ * upb_alloc interface, but it would not be as efficient for the
+ * single-threaded case. */
+
+typedef void upb_cleanup_func(void *ud);
+
+struct upb_arena;
+typedef struct upb_arena upb_arena;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Creates an arena from the given initial block (if any -- n may be 0).
+ * Additional blocks will be allocated from |alloc|.  If |alloc| is NULL, this
+ * is a fixed-size arena and cannot grow. */
+upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc);
+void upb_arena_free(upb_arena *a);
+bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func);
+size_t upb_arena_bytesallocated(const upb_arena *a);
+
+UPB_INLINE upb_alloc *upb_arena_alloc(upb_arena *a) { return (upb_alloc*)a; }
+
+/* Convenience wrappers around upb_alloc functions. */
+
+UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) {
+  return upb_malloc(upb_arena_alloc(a), size);
+}
+
+UPB_INLINE void *upb_arena_realloc(upb_arena *a, void *ptr, size_t oldsize,
+                                   size_t size) {
+  return upb_realloc(upb_arena_alloc(a), ptr, oldsize, size);
+}
+
+UPB_INLINE upb_arena *upb_arena_new(void) {
+  return upb_arena_init(NULL, 0, &upb_alloc_global);
+}
+
+#ifdef __cplusplus
+}  /* extern "C" */
+
+class upb::Arena {
+ public:
+  /* A simple arena with no initial memory block and the default allocator. */
+  Arena() : ptr_(upb_arena_new(), upb_arena_free) {}
+
+  upb_arena* ptr() { return ptr_.get(); }
+
+  /* Allows this arena to be used as a generic allocator.
+   *
+   * The arena does not need free() calls so when using Arena as an allocator
+   * it is safe to skip them.  However they are no-ops so there is no harm in
+   * calling free() either. */
+  upb_alloc *allocator() { return upb_arena_alloc(ptr_.get()); }
+
+  /* Add a cleanup function to run when the arena is destroyed.
+   * Returns false on out-of-memory. */
+  bool AddCleanup(void *ud, upb_cleanup_func* func) {
+    return upb_arena_addcleanup(ptr_.get(), ud, func);
+  }
+
+  /* Total number of bytes that have been allocated.  It is undefined what
+   * Realloc() does to &arena_ counter. */
+  size_t BytesAllocated() const { return upb_arena_bytesallocated(ptr_.get()); }
+
+ private:
+  std::unique_ptr<upb_arena, decltype(&upb_arena_free)> ptr_;
+};
+
+#endif
+
+/* upb::InlinedArena **********************************************************/
+
+/* upb::InlinedArena seeds the arenas with a predefined amount of memory.  No
+ * heap memory will be allocated until the initial block is exceeded.
+ *
+ * These types only exist in C++ */
+
+#ifdef __cplusplus
+
+template <int N> class upb::InlinedArena : public upb::Arena {
+ public:
+  InlinedArena() : ptr_(upb_arena_new(&initial_block_, N, &upb_alloc_global)) {}
+
+  upb_arena* ptr() { return ptr_.get(); }
+
+ private:
+  InlinedArena(const InlinedArena*) = delete;
+  InlinedArena& operator=(const InlinedArena*) = delete;
+
+  std::unique_ptr<upb_arena, decltype(&upb_arena_free)> ptr_;
+  char initial_block_[N];
+};
+
+#endif  /* __cplusplus */
+
+/* Constants ******************************************************************/
+
+/* Generic function type. */
+typedef void upb_func(void);
+
+/* A list of types as they are encoded on-the-wire. */
+typedef enum {
+  UPB_WIRE_TYPE_VARINT      = 0,
+  UPB_WIRE_TYPE_64BIT       = 1,
+  UPB_WIRE_TYPE_DELIMITED   = 2,
+  UPB_WIRE_TYPE_START_GROUP = 3,
+  UPB_WIRE_TYPE_END_GROUP   = 4,
+  UPB_WIRE_TYPE_32BIT       = 5
+} upb_wiretype_t;
+
+/* The types a field can have.  Note that this list is not identical to the
+ * types defined in descriptor.proto, which gives INT32 and SINT32 separate
+ * types (we distinguish the two with the "integer encoding" enum below). */
+typedef enum {
+  /* Types stored in 1 byte. */
+  UPB_TYPE_BOOL     = 1,
+  /* Types stored in 4 bytes. */
+  UPB_TYPE_FLOAT    = 2,
+  UPB_TYPE_INT32    = 3,
+  UPB_TYPE_UINT32   = 4,
+  UPB_TYPE_ENUM     = 5,  /* Enum values are int32. */
+  /* Types stored as pointers (probably 4 or 8 bytes). */
+  UPB_TYPE_STRING   = 6,
+  UPB_TYPE_BYTES    = 7,
+  UPB_TYPE_MESSAGE  = 8,
+  /* Types stored as 8 bytes. */
+  UPB_TYPE_DOUBLE   = 9,
+  UPB_TYPE_INT64    = 10,
+  UPB_TYPE_UINT64   = 11
+} upb_fieldtype_t;
+
+/* The repeated-ness of each field; this matches descriptor.proto. */
+typedef enum {
+  UPB_LABEL_OPTIONAL = 1,
+  UPB_LABEL_REQUIRED = 2,
+  UPB_LABEL_REPEATED = 3
+} upb_label_t;
+
+/* Descriptor types, as defined in descriptor.proto. */
+typedef enum {
+  UPB_DESCRIPTOR_TYPE_DOUBLE   = 1,
+  UPB_DESCRIPTOR_TYPE_FLOAT    = 2,
+  UPB_DESCRIPTOR_TYPE_INT64    = 3,
+  UPB_DESCRIPTOR_TYPE_UINT64   = 4,
+  UPB_DESCRIPTOR_TYPE_INT32    = 5,
+  UPB_DESCRIPTOR_TYPE_FIXED64  = 6,
+  UPB_DESCRIPTOR_TYPE_FIXED32  = 7,
+  UPB_DESCRIPTOR_TYPE_BOOL     = 8,
+  UPB_DESCRIPTOR_TYPE_STRING   = 9,
+  UPB_DESCRIPTOR_TYPE_GROUP    = 10,
+  UPB_DESCRIPTOR_TYPE_MESSAGE  = 11,
+  UPB_DESCRIPTOR_TYPE_BYTES    = 12,
+  UPB_DESCRIPTOR_TYPE_UINT32   = 13,
+  UPB_DESCRIPTOR_TYPE_ENUM     = 14,
+  UPB_DESCRIPTOR_TYPE_SFIXED32 = 15,
+  UPB_DESCRIPTOR_TYPE_SFIXED64 = 16,
+  UPB_DESCRIPTOR_TYPE_SINT32   = 17,
+  UPB_DESCRIPTOR_TYPE_SINT64   = 18
+} upb_descriptortype_t;
+
+extern const uint8_t upb_desctype_to_fieldtype[];
+
+#include "upb/port_undef.inc"
+
+#endif  /* UPB_H_ */
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upbc/generator.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upbc/generator.h
new file mode 100644 (file)
index 0000000..ed6cedc
--- /dev/null
@@ -0,0 +1,12 @@
+
+#ifndef UPBC_GENERATOR_H_
+#define UPBC_GENERATOR_H_
+
+#include <memory>
+#include <google/protobuf/compiler/code_generator.h>
+
+namespace upbc {
+std::unique_ptr<google::protobuf::compiler::CodeGenerator> GetGenerator();
+}
+
+#endif  // UPBC_GENERATOR_H_
diff --git a/legacy-libs/grpc/deps/grpc/third_party/upb/upbc/message_layout.h b/legacy-libs/grpc/deps/grpc/third_party/upb/upbc/message_layout.h
new file mode 100644 (file)
index 0000000..c2446a0
--- /dev/null
@@ -0,0 +1,107 @@
+
+#ifndef UPBC_MESSAGE_LAYOUT_H
+#define UPBC_MESSAGE_LAYOUT_H
+
+#include "absl/base/macros.h"
+#include "absl/container/flat_hash_map.h"
+#include "google/protobuf/descriptor.h"
+
+namespace upbc {
+
+class MessageLayout {
+ public:
+  struct Size {
+    void Add(const Size& other) {
+      size32 += other.size32;
+      size64 += other.size64;
+    }
+
+    void MaxFrom(const Size& other) {
+      size32 = std::max(size32, other.size32);
+      size64 = std::max(size64, other.size64);
+    }
+
+    void AlignUp(const Size& align) {
+      size32 = Align(size32, align.size32);
+      size64 = Align(size64, align.size64);
+    }
+
+    int64_t size32;
+    int64_t size64;
+  };
+
+  struct SizeAndAlign {
+    Size size;
+    Size align;
+
+    void MaxFrom(const SizeAndAlign& other) {
+      size.MaxFrom(other.size);
+      align.MaxFrom(other.align);
+    }
+  };
+
+  MessageLayout(const google::protobuf::Descriptor* descriptor) {
+    ComputeLayout(descriptor);
+  }
+
+  Size GetFieldOffset(const google::protobuf::FieldDescriptor* field) const {
+    return GetMapValue(field_offsets_, field);
+  }
+
+  Size GetOneofCaseOffset(
+      const google::protobuf::OneofDescriptor* oneof) const {
+    return GetMapValue(oneof_case_offsets_, oneof);
+  }
+
+  int GetHasbitIndex(const google::protobuf::FieldDescriptor* field) const {
+    return GetMapValue(hasbit_indexes_, field);
+  }
+
+  Size message_size() const { return size_; }
+
+  static bool HasHasbit(const google::protobuf::FieldDescriptor* field);
+  static SizeAndAlign SizeOfUnwrapped(
+      const google::protobuf::FieldDescriptor* field);
+
+ private:
+  void ComputeLayout(const google::protobuf::Descriptor* descriptor);
+  void PlaceNonOneofFields(const google::protobuf::Descriptor* descriptor);
+  void PlaceOneofFields(const google::protobuf::Descriptor* descriptor);
+  Size Place(SizeAndAlign size_and_align);
+
+  template <class K, class V>
+  static V GetMapValue(const absl::flat_hash_map<K, V>& map, K key) {
+    auto iter = map.find(key);
+    if (iter == map.end()) {
+      fprintf(stderr, "No value for field.\n");
+      abort();
+    }
+    return iter->second;
+  }
+
+  static bool IsPowerOfTwo(size_t val) {
+    return (val & (val - 1)) == 0;
+  }
+
+  static size_t Align(size_t val, size_t align) {
+    ABSL_ASSERT(IsPowerOfTwo(align));
+    return (val + align - 1) & ~(align - 1);
+  }
+
+  static SizeAndAlign SizeOf(const google::protobuf::FieldDescriptor* field);
+  static int64_t FieldLayoutRank(
+      const google::protobuf::FieldDescriptor* field);
+
+  absl::flat_hash_map<const google::protobuf::FieldDescriptor*, Size>
+      field_offsets_;
+  absl::flat_hash_map<const google::protobuf::FieldDescriptor*, int>
+      hasbit_indexes_;
+  absl::flat_hash_map<const google::protobuf::OneofDescriptor*, Size>
+      oneof_case_offsets_;
+  Size maxalign_;
+  Size size_;
+};
+
+}  // namespace upbc
+
+#endif  // UPBC_MESSAGE_LAYOUT_H
index 2537075..efaaa7c 100644 (file)
@@ -101,7 +101,7 @@ bool CreateMetadataArray(Local<Object> metadata_obj, grpc_metadata_array *array)
   array->metadata = reinterpret_cast<grpc_metadata *>(
       gpr_zalloc(array->capacity * sizeof(grpc_metadata)));
   for (unsigned int i = 0; i < keys->Length(); i++) {
-    Local<String> current_key(Nan::To<String>(keys->Get(i)).ToLocalChecked());
+    Local<String> current_key(Nan::To<String>(Nan::Get(keys, i).ToLocalChecked()).ToLocalChecked());
     Local<Array> values =
         Local<Array>::Cast(Nan::Get(metadata, current_key).ToLocalChecked());
     grpc_slice key_slice = CreateSliceFromString(current_key);
@@ -158,7 +158,7 @@ Local<Value> ParseMetadata(const grpc_metadata_array *metadata_array) {
       array = Local<Array>::Cast(maybe_array.ToLocalChecked());
     }
     if (grpc_is_binary_header(elem->key)) {
-      Nan::Set(array, array->Length(), CreateBufferFromSlice(elem->value));
+      Nan::Set(array, array->Length(), CopyBufferFromSlice(elem->value));
     } else {
       // TODO(murgatroid99): Use zero-copy string construction instead
       Nan::Set(array, array->Length(), CopyStringFromSlice(elem->value));
@@ -678,7 +678,7 @@ NAN_METHOD(Call::StartBatch) {
       default:
         return Nan::ThrowError("Argument object had an unrecognized key");
     }
-    if (!op->ParseOp(obj->Get(type), &ops[i])) {
+    if (!op->ParseOp(Nan::Get(obj, type).ToLocalChecked(), &ops[i])) {
       return Nan::ThrowTypeError("Incorrectly typed arguments to startBatch");
     }
     op_vector->push_back(std::move(op));
index 14293ab..fa7f841 100644 (file)
@@ -207,7 +207,7 @@ NAN_METHOD(Channel::New) {
   if (info.IsConstructCall()) {
     if (!info[0]->IsString()) {
       return Nan::ThrowTypeError(
-          "Channel expects a string, a credential and an object");
+          "Channel's first argument (address) must be a string");
     }
     grpc_channel *wrapped_channel;
     // Owned by the Channel object
@@ -215,7 +215,7 @@ NAN_METHOD(Channel::New) {
     grpc_channel_credentials *creds;
     if (!ChannelCredentials::HasInstance(info[1])) {
       return Nan::ThrowTypeError(
-          "Channel's second argument must be a ChannelCredentials");
+          "Channel's second argument (credentials) must be a ChannelCredentials");
     }
     ChannelCredentials *creds_object = ObjectWrap::Unwrap<ChannelCredentials>(
         Nan::To<Object>(info[1]).ToLocalChecked());
@@ -224,7 +224,7 @@ NAN_METHOD(Channel::New) {
     if (!ParseChannelArgs(info[2], &channel_args_ptr)) {
       DeallocateChannelArgs(channel_args_ptr);
       return Nan::ThrowTypeError(
-          "Channel options must be an object with "
+          "Channel third argument (options) must be an object with "
           "string keys and integer or string values");
     }
     if (creds == NULL) {
index 49bc05b..1446355 100644 (file)
@@ -33,12 +33,6 @@ using v8::String;
 using v8::Value;
 
 namespace {
-void SliceFreeCallback(char *data, void *hint) {
-  grpc_slice *slice = reinterpret_cast<grpc_slice *>(hint);
-  grpc_slice_unref(*slice);
-  delete slice;
-}
-
 void string_destroy_func(void *user_data) {
   delete reinterpret_cast<Nan::Utf8String *>(user_data);
 }
@@ -74,16 +68,12 @@ Local<String> CopyStringFromSlice(const grpc_slice slice) {
           .ToLocalChecked());
 }
 
-Local<Value> CreateBufferFromSlice(const grpc_slice slice) {
+Local<Value> CopyBufferFromSlice(const grpc_slice slice) {
   Nan::EscapableHandleScope scope;
-  grpc_slice *slice_ptr = new grpc_slice;
-  *slice_ptr = grpc_slice_ref(slice);
   return scope.Escape(
-      Nan::NewBuffer(
-          const_cast<char *>(
-              reinterpret_cast<const char *>(GRPC_SLICE_START_PTR(*slice_ptr))),
-          GRPC_SLICE_LENGTH(*slice_ptr), SliceFreeCallback, slice_ptr)
-          .ToLocalChecked());
+    Nan::CopyBuffer(reinterpret_cast<const char *>(GRPC_SLICE_START_PTR(slice)),
+      GRPC_SLICE_LENGTH(slice))
+    .ToLocalChecked());
 }
 
 }  // namespace node
index 0a652c5..69110bb 100644 (file)
@@ -32,7 +32,7 @@ grpc_slice CreateSliceFromBuffer(const v8::Local<v8::Value> source);
 
 v8::Local<v8::String> CopyStringFromSlice(const grpc_slice slice);
 
-v8::Local<v8::Value> CreateBufferFromSlice(const grpc_slice slice);
+v8::Local<v8::Value> CopyBufferFromSlice(const grpc_slice slice);
 
 }  // namespace node
 }  // namespace grpc
index b713873..5a48acc 100644 (file)
@@ -1,4 +1,3 @@
-import { EventEmitter } from "events";
 
 /*
  * Copyright 2019 gRPC authors.
@@ -17,11 +16,50 @@ import { EventEmitter } from "events";
  *
  */
 
+/// <reference types="bytebuffer" />
+
 declare module "grpc" {
-  import { Message, Service as ProtobufService } from "protobufjs";
+  // add imports here, inside the "grpc" module, to keep it as an ambient module
+  import { EventEmitter } from "events";
   import { Duplex, Readable, Writable } from "stream";
   import { SecureContext } from "tls";
 
+  /* The Message interface is copied and slightly modified from @types/protobuf
+   * version 5.0.31, which was distributed under the following license:
+   *
+   * This project is licensed under the MIT license.
+   * Copyrights are respective of each contributor listed at the beginning of each definition file.
+   *
+   * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+   *
+   * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+   *
+   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+   */
+  export interface ProtobufMessage {
+    $add(key: string, value: any, noAssert?: boolean): ProtobufMessage;
+    $get<T>(key: string): T;
+    $set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void;
+    add(key: string, value: any, noAssert?: boolean): ProtobufMessage;
+    calculate(): number;
+    encode(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer;
+    encode64(): string;
+    encodeAB(): ArrayBuffer;
+    encodeNB(): Buffer;
+    encodeHex(): string;
+    encodeJSON(): string;
+    encodeDelimited(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer;
+    get<T>(key: string, noAssert?: boolean): T;
+    set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void;
+    toArrayBuffer(): ArrayBuffer;
+    toBase64(): string;
+    toBuffer(): Buffer;
+    toHex(): string;
+    toRaw(binaryAsBase64?: boolean, longsAsStrings?: boolean): {[key: string]: any};
+    toString(): string;
+    [field: string]: any;
+  }
+
   /**
    * Load a ProtoBuf.js object as a gRPC object.
    * @param value The ProtoBuf.js reflection object to load
@@ -85,7 +123,7 @@ declare module "grpc" {
    * - Anything else becomes the relevant reflection object that ProtoBuf.js would create
    */
   export interface GrpcObject {
-    [name: string]: GrpcObject | typeof Client | Message;
+    [name: string]: GrpcObject | typeof Client | ProtobufMessage;
   }
 
   /**
@@ -414,13 +452,13 @@ declare module "grpc" {
    * User provided method to handle server streaming methods on the server.
    */
   type handleServerStreamingCall<RequestType, ResponseType> =
-    (call: ServerWriteableStream<RequestType>) => void;
+    (call: ServerWritableStream<RequestType, ResponseType>) => void;
 
   /**
    * A stream that the server can write to. Used for calls that are streaming
    * from the server side.
    */
-  export class ServerWriteableStream<RequestType> extends Writable {
+  export class ServerWritableStream<RequestType, ResponseType=unknown> extends Writable {
     /**
      * Indicates if the call has been cancelled
      */
@@ -451,6 +489,10 @@ declare module "grpc" {
     sendMetadata(responseMetadata: Metadata): void;
   }
 
+  /* This typo existed in previous versions of this file, so we provide this
+   * type alias for backwards compatibility. */
+  export type ServerWriteableStream<RequestType, ResponseType=unknown> = ServerWritableStream<RequestType, ResponseType>;
+
   /**
    * User provided method to handle bidirectional streaming calls on the server.
    */
@@ -864,6 +906,17 @@ declare module "grpc" {
     INFO,
     ERROR,
   }
+  
+  /**
+   * Method type constants
+   */
+  export enum methodTypes {
+    UNARY,
+    CLIENT_STREAMING,
+    SERVER_STREAMING,
+    BIDI_STREAMING,
+  }
+
 
   /**
    * A certificate as received by the checkServerIdentity callback.
@@ -1129,7 +1182,7 @@ declare module "grpc" {
       argument: RequestType,
       metadata?: Metadata | null,
       options?: CallOptions | null,
-    ): ClientReadableStream<RequestType>;
+    ): ClientReadableStream<ResponseType>;
 
     /**
      * Make a bidirectional stream request with this method on the given channel.
@@ -1196,11 +1249,11 @@ declare module "grpc" {
      * Indicates which properties of a parent call should propagate to this
      * call. Bitwise combination of flags in `grpc.propagate`.
      */
-    propagate_flags: number;
+    propagate_flags?: number;
     /**
      * The credentials that should be used to make this particular call.
      */
-    credentials: CallCredentials;
+    credentials?: CallCredentials;
     /**
      * Additional custom call options. These can be used to pass additional
      * data per-call to client interceptors
index 9534c7d..3cb0fd4 100644 (file)
@@ -161,6 +161,9 @@ exports.loadPackageDefinition = function loadPackageDefintion(packageDef) {
   for (const serviceFqn in packageDef) {
     const service = packageDef[serviceFqn];
     const nameComponents = serviceFqn.split('.');
+    if (nameComponents.some(comp => common.isPrototypePolluted(comp))) {
+      continue;
+    }
     const serviceName = nameComponents[nameComponents.length-1];
     let current = result;
     for (const packageName of nameComponents.slice(0, -1)) {
diff --git a/legacy-libs/grpc/node_modules/abbrev/LICENSE b/legacy-libs/grpc/node_modules/abbrev/LICENSE
deleted file mode 100644 (file)
index 9bcfa9d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-This software is dual-licensed under the ISC and MIT licenses.
-You may use this software under EITHER of the following licenses.
-
-----------
-
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-----------
-
-Copyright Isaac Z. Schlueter and Contributors
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/abbrev/README.md b/legacy-libs/grpc/node_modules/abbrev/README.md
deleted file mode 100644 (file)
index 99746fe..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# abbrev-js
-
-Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
-
-Usage:
-
-    var abbrev = require("abbrev");
-    abbrev("foo", "fool", "folding", "flop");
-    
-    // returns:
-    { fl: 'flop'
-    , flo: 'flop'
-    , flop: 'flop'
-    , fol: 'folding'
-    , fold: 'folding'
-    , foldi: 'folding'
-    , foldin: 'folding'
-    , folding: 'folding'
-    , foo: 'foo'
-    , fool: 'fool'
-    }
-
-This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
diff --git a/legacy-libs/grpc/node_modules/abbrev/abbrev.js b/legacy-libs/grpc/node_modules/abbrev/abbrev.js
deleted file mode 100644 (file)
index 7b1dc5d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-module.exports = exports = abbrev.abbrev = abbrev
-
-abbrev.monkeyPatch = monkeyPatch
-
-function monkeyPatch () {
-  Object.defineProperty(Array.prototype, 'abbrev', {
-    value: function () { return abbrev(this) },
-    enumerable: false, configurable: true, writable: true
-  })
-
-  Object.defineProperty(Object.prototype, 'abbrev', {
-    value: function () { return abbrev(Object.keys(this)) },
-    enumerable: false, configurable: true, writable: true
-  })
-}
-
-function abbrev (list) {
-  if (arguments.length !== 1 || !Array.isArray(list)) {
-    list = Array.prototype.slice.call(arguments, 0)
-  }
-  for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
-    args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
-  }
-
-  // sort them lexicographically, so that they're next to their nearest kin
-  args = args.sort(lexSort)
-
-  // walk through each, seeing how much it has in common with the next and previous
-  var abbrevs = {}
-    , prev = ""
-  for (var i = 0, l = args.length ; i < l ; i ++) {
-    var current = args[i]
-      , next = args[i + 1] || ""
-      , nextMatches = true
-      , prevMatches = true
-    if (current === next) continue
-    for (var j = 0, cl = current.length ; j < cl ; j ++) {
-      var curChar = current.charAt(j)
-      nextMatches = nextMatches && curChar === next.charAt(j)
-      prevMatches = prevMatches && curChar === prev.charAt(j)
-      if (!nextMatches && !prevMatches) {
-        j ++
-        break
-      }
-    }
-    prev = current
-    if (j === cl) {
-      abbrevs[current] = current
-      continue
-    }
-    for (var a = current.substr(0, j) ; j <= cl ; j ++) {
-      abbrevs[a] = current
-      a += current.charAt(j)
-    }
-  }
-  return abbrevs
-}
-
-function lexSort (a, b) {
-  return a === b ? 0 : a > b ? 1 : -1
-}
diff --git a/legacy-libs/grpc/node_modules/abbrev/package.json b/legacy-libs/grpc/node_modules/abbrev/package.json
deleted file mode 100644 (file)
index 1d5f62d..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{
-  "_args": [
-    [
-      "abbrev@1.1.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "abbrev@1.1.1",
-  "_id": "abbrev@1.1.1",
-  "_inBundle": false,
-  "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
-  "_location": "/grpc/abbrev",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "abbrev@1.1.1",
-    "name": "abbrev",
-    "escapedName": "abbrev",
-    "rawSpec": "1.1.1",
-    "saveSpec": null,
-    "fetchSpec": "1.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/nopt"
-  ],
-  "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/abbrev-js/issues"
-  },
-  "dependencies": {},
-  "description": "Like ruby's abbrev module, but in js",
-  "devDependencies": {
-    "tap": "^10.1"
-  },
-  "files": [
-    "abbrev.js"
-  ],
-  "homepage": "https://github.com/isaacs/abbrev-js#readme",
-  "license": "ISC",
-  "main": "abbrev.js",
-  "name": "abbrev",
-  "optionalDependencies": {},
-  "readme": "# abbrev-js\n\nJust like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).\n\nUsage:\n\n    var abbrev = require(\"abbrev\");\n    abbrev(\"foo\", \"fool\", \"folding\", \"flop\");\n    \n    // returns:\n    { fl: 'flop'\n    , flo: 'flop'\n    , flop: 'flop'\n    , fol: 'folding'\n    , fold: 'folding'\n    , foldi: 'folding'\n    , foldin: 'folding'\n    , folding: 'folding'\n    , foo: 'foo'\n    , fool: 'fool'\n    }\n\nThis is handy for command-line scripts, or other cases where you want to be able to accept shorthands.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test.js --100"
-  },
-  "version": "1.1.1"
-}
diff --git a/legacy-libs/grpc/node_modules/ansi-regex/index.js b/legacy-libs/grpc/node_modules/ansi-regex/index.js
deleted file mode 100644 (file)
index b9574ed..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict';
-module.exports = function () {
-       return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
-};
diff --git a/legacy-libs/grpc/node_modules/ansi-regex/package.json b/legacy-libs/grpc/node_modules/ansi-regex/package.json
deleted file mode 100644 (file)
index cbb8886..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-{
-  "_args": [
-    [
-      "ansi-regex@2.1.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "ansi-regex@2.1.1",
-  "_id": "ansi-regex@2.1.1",
-  "_inBundle": false,
-  "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
-  "_location": "/grpc/ansi-regex",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "ansi-regex@2.1.1",
-    "name": "ansi-regex",
-    "escapedName": "ansi-regex",
-    "rawSpec": "2.1.1",
-    "saveSpec": null,
-    "fetchSpec": "2.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/strip-ansi"
-  ],
-  "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/chalk/ansi-regex/issues"
-  },
-  "dependencies": {},
-  "description": "Regular expression for matching ANSI escape codes",
-  "devDependencies": {
-    "ava": "0.17.0",
-    "xo": "0.16.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/chalk/ansi-regex#readme",
-  "keywords": [
-    "ansi",
-    "styles",
-    "color",
-    "colour",
-    "colors",
-    "terminal",
-    "console",
-    "cli",
-    "string",
-    "tty",
-    "escape",
-    "formatting",
-    "rgb",
-    "256",
-    "shell",
-    "xterm",
-    "command-line",
-    "text",
-    "regex",
-    "regexp",
-    "re",
-    "match",
-    "test",
-    "find",
-    "pattern"
-  ],
-  "license": "MIT",
-  "maintainers": [
-    {
-      "name": "Sindre Sorhus",
-      "email": "sindresorhus@gmail.com",
-      "url": "sindresorhus.com"
-    },
-    {
-      "name": "Joshua Appelman",
-      "email": "jappelman@xebia.com",
-      "url": "jbnicolai.com"
-    },
-    {
-      "name": "JD Ballard",
-      "email": "i.am.qix@gmail.com",
-      "url": "github.com/qix-"
-    }
-  ],
-  "name": "ansi-regex",
-  "optionalDependencies": {},
-  "readme": "# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)\n\n> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)\n\n\n## Install\n\n```\n$ npm install --save ansi-regex\n```\n\n\n## Usage\n\n```js\nconst ansiRegex = require('ansi-regex');\n\nansiRegex().test('\\u001b[4mcake\\u001b[0m');\n//=> true\n\nansiRegex().test('cake');\n//=> false\n\n'\\u001b[4mcake\\u001b[0m'.match(ansiRegex());\n//=> ['\\u001b[4m', '\\u001b[0m']\n```\n\n## FAQ\n\n### Why do you test for codes not in the ECMA 48 standard?\n\nSome of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.\n\nOn the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of \"interrupts\" that can mean different things on certain brands of processors, most of which have been phased out.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/chalk/ansi-regex.git"
-  },
-  "scripts": {
-    "test": "xo && ava --verbose",
-    "view-supported": "node fixtures/view-codes.js"
-  },
-  "version": "2.1.1",
-  "xo": {
-    "rules": {
-      "guard-for-in": 0,
-      "no-loop-func": 0
-    }
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/ansi-regex/readme.md b/legacy-libs/grpc/node_modules/ansi-regex/readme.md
deleted file mode 100644 (file)
index 6a928ed..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
-
-> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
-
-
-## Install
-
-```
-$ npm install --save ansi-regex
-```
-
-
-## Usage
-
-```js
-const ansiRegex = require('ansi-regex');
-
-ansiRegex().test('\u001b[4mcake\u001b[0m');
-//=> true
-
-ansiRegex().test('cake');
-//=> false
-
-'\u001b[4mcake\u001b[0m'.match(ansiRegex());
-//=> ['\u001b[4m', '\u001b[0m']
-```
-
-## FAQ
-
-### Why do you test for codes not in the ECMA 48 standard?
-
-Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
-
-On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/aproba/LICENSE b/legacy-libs/grpc/node_modules/aproba/LICENSE
deleted file mode 100644 (file)
index f4be44d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Copyright (c) 2015, Rebecca Turner <me@re-becca.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
diff --git a/legacy-libs/grpc/node_modules/aproba/README.md b/legacy-libs/grpc/node_modules/aproba/README.md
deleted file mode 100644 (file)
index 0bfc594..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-aproba
-======
-
-A ridiculously light-weight function argument validator
-
-```
-var validate = require("aproba")
-
-function myfunc(a, b, c) {
-  // `a` must be a string, `b` a number, `c` a function
-  validate('SNF', arguments) // [a,b,c] is also valid
-}
-
-myfunc('test', 23, function () {}) // ok
-myfunc(123, 23, function () {}) // type error
-myfunc('test', 23) // missing arg error
-myfunc('test', 23, function () {}, true) // too many args error
-
-```
-
-Valid types are:
-
-| type | description
-| :--: | :----------
-| *    | matches any type
-| A    | `Array.isArray` OR an `arguments` object
-| S    | typeof == string
-| N    | typeof == number
-| F    | typeof == function
-| O    | typeof == object and not type A and not type E
-| B    | typeof == boolean
-| E    | `instanceof Error` OR `null` **(special: see below)**
-| Z    | == `null`
-
-Validation failures throw one of three exception types, distinguished by a
-`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`.
-
-If you pass in an invalid type then it will throw with a code of
-`EUNKNOWNTYPE`.
-
-If an **error** argument is found and is not null then the remaining
-arguments are optional.  That is, if you say `ESO` then that's like using a
-non-magical `E` in: `E|ESO|ZSO`.
-
-### But I have optional arguments?!
-
-You can provide more than one signature by separating them with pipes `|`.
-If any signature matches the arguments then they'll be considered valid.
-
-So for example, say you wanted to write a signature for
-`fs.createWriteStream`.  The docs for it describe it thusly:
-
-```
-fs.createWriteStream(path[, options])
-```
-
-This would be a signature of `SO|S`.  That is, a string and and object, or
-just a string.
-
-Now, if you read the full `fs` docs, you'll see that actually path can ALSO
-be a buffer.  And options can be a string, that is:
-```
-path <String> | <Buffer>
-options <String> | <Object>
-```
-
-To reproduce this you have to fully enumerate all of the possible
-combinations and that implies a signature of `SO|SS|OO|OS|S|O`.  The
-awkwardness is a feature: It reminds you of the complexity you're adding to
-your API when you do this sort of thing.
-
-
-### Browser support
-
-This has no dependencies and should work in browsers, though you'll have
-noisier stack traces.
-
-### Why this exists
-
-I wanted a very simple argument validator. It needed to do two things:
-
-1. Be more concise and easier to use than assertions
-
-2. Not encourage an infinite bikeshed of DSLs
-
-This is why types are specified by a single character and there's no such
-thing as an optional argument. 
-
-This is not intended to validate user data. This is specifically about
-asserting the interface of your functions.
-
-If you need greater validation, I encourage you to write them by hand or
-look elsewhere.
-
diff --git a/legacy-libs/grpc/node_modules/aproba/index.js b/legacy-libs/grpc/node_modules/aproba/index.js
deleted file mode 100644 (file)
index 6f3f797..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-'use strict'
-
-function isArguments (thingy) {
-  return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee')
-}
-
-var types = {
-  '*': {label: 'any', check: function () { return true }},
-  A: {label: 'array', check: function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }},
-  S: {label: 'string', check: function (thingy) { return typeof thingy === 'string' }},
-  N: {label: 'number', check: function (thingy) { return typeof thingy === 'number' }},
-  F: {label: 'function', check: function (thingy) { return typeof thingy === 'function' }},
-  O: {label: 'object', check: function (thingy) { return typeof thingy === 'object' && thingy != null && !types.A.check(thingy) && !types.E.check(thingy) }},
-  B: {label: 'boolean', check: function (thingy) { return typeof thingy === 'boolean' }},
-  E: {label: 'error', check: function (thingy) { return thingy instanceof Error }},
-  Z: {label: 'null', check: function (thingy) { return thingy == null }}
-}
-
-function addSchema (schema, arity) {
-  var group = arity[schema.length] = arity[schema.length] || []
-  if (group.indexOf(schema) === -1) group.push(schema)
-}
-
-var validate = module.exports = function (rawSchemas, args) {
-  if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length)
-  if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas')
-  if (!args) throw missingRequiredArg(1, 'args')
-  if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas)
-  if (!types.A.check(args)) throw invalidType(1, ['array'], args)
-  var schemas = rawSchemas.split('|')
-  var arity = {}
-
-  schemas.forEach(function (schema) {
-    for (var ii = 0; ii < schema.length; ++ii) {
-      var type = schema[ii]
-      if (!types[type]) throw unknownType(ii, type)
-    }
-    if (/E.*E/.test(schema)) throw moreThanOneError(schema)
-    addSchema(schema, arity)
-    if (/E/.test(schema)) {
-      addSchema(schema.replace(/E.*$/, 'E'), arity)
-      addSchema(schema.replace(/E/, 'Z'), arity)
-      if (schema.length === 1) addSchema('', arity)
-    }
-  })
-  var matching = arity[args.length]
-  if (!matching) {
-    throw wrongNumberOfArgs(Object.keys(arity), args.length)
-  }
-  for (var ii = 0; ii < args.length; ++ii) {
-    var newMatching = matching.filter(function (schema) {
-      var type = schema[ii]
-      var typeCheck = types[type].check
-      return typeCheck(args[ii])
-    })
-    if (!newMatching.length) {
-      var labels = matching.map(function (schema) {
-        return types[schema[ii]].label
-      }).filter(function (schema) { return schema != null })
-      throw invalidType(ii, labels, args[ii])
-    }
-    matching = newMatching
-  }
-}
-
-function missingRequiredArg (num) {
-  return newException('EMISSINGARG', 'Missing required argument #' + (num + 1))
-}
-
-function unknownType (num, type) {
-  return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1))
-}
-
-function invalidType (num, expectedTypes, value) {
-  var valueType
-  Object.keys(types).forEach(function (typeCode) {
-    if (types[typeCode].check(value)) valueType = types[typeCode].label
-  })
-  return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
-    englishList(expectedTypes) + ' but got ' + valueType)
-}
-
-function englishList (list) {
-  return list.join(', ').replace(/, ([^,]+)$/, ' or $1')
-}
-
-function wrongNumberOfArgs (expected, got) {
-  var english = englishList(expected)
-  var args = expected.every(function (ex) { return ex.length === 1 })
-    ? 'argument'
-    : 'arguments'
-  return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got)
-}
-
-function moreThanOneError (schema) {
-  return newException('ETOOMANYERRORTYPES',
-    'Only one error type per argument signature is allowed, more than one found in "' + schema + '"')
-}
-
-function newException (code, msg) {
-  var e = new Error(msg)
-  e.code = code
-  if (Error.captureStackTrace) Error.captureStackTrace(e, validate)
-  return e
-}
diff --git a/legacy-libs/grpc/node_modules/aproba/package.json b/legacy-libs/grpc/node_modules/aproba/package.json
deleted file mode 100644 (file)
index 5f9d995..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-{
-  "_args": [
-    [
-      "aproba@1.2.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "aproba@1.2.0",
-  "_id": "aproba@1.2.0",
-  "_inBundle": false,
-  "_integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
-  "_location": "/grpc/aproba",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "aproba@1.2.0",
-    "name": "aproba",
-    "escapedName": "aproba",
-    "rawSpec": "1.2.0",
-    "saveSpec": null,
-    "fetchSpec": "1.2.0"
-  },
-  "_requiredBy": [
-    "/grpc/gauge"
-  ],
-  "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.2.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Rebecca Turner",
-    "email": "me@re-becca.org"
-  },
-  "bugs": {
-    "url": "https://github.com/iarna/aproba/issues"
-  },
-  "dependencies": {},
-  "description": "A ridiculously light-weight argument validator (now browser friendly)",
-  "devDependencies": {
-    "standard": "^10.0.3",
-    "tap": "^10.0.2"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/iarna/aproba",
-  "keywords": [
-    "argument",
-    "validate"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "aproba",
-  "optionalDependencies": {},
-  "readme": "aproba\n======\n\nA ridiculously light-weight function argument validator\n\n```\nvar validate = require(\"aproba\")\n\nfunction myfunc(a, b, c) {\n  // `a` must be a string, `b` a number, `c` a function\n  validate('SNF', arguments) // [a,b,c] is also valid\n}\n\nmyfunc('test', 23, function () {}) // ok\nmyfunc(123, 23, function () {}) // type error\nmyfunc('test', 23) // missing arg error\nmyfunc('test', 23, function () {}, true) // too many args error\n\n```\n\nValid types are:\n\n| type | description\n| :--: | :----------\n| *    | matches any type\n| A    | `Array.isArray` OR an `arguments` object\n| S    | typeof == string\n| N    | typeof == number\n| F    | typeof == function\n| O    | typeof == object and not type A and not type E\n| B    | typeof == boolean\n| E    | `instanceof Error` OR `null` **(special: see below)**\n| Z    | == `null`\n\nValidation failures throw one of three exception types, distinguished by a\n`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`.\n\nIf you pass in an invalid type then it will throw with a code of\n`EUNKNOWNTYPE`.\n\nIf an **error** argument is found and is not null then the remaining\narguments are optional.  That is, if you say `ESO` then that's like using a\nnon-magical `E` in: `E|ESO|ZSO`.\n\n### But I have optional arguments?!\n\nYou can provide more than one signature by separating them with pipes `|`.\nIf any signature matches the arguments then they'll be considered valid.\n\nSo for example, say you wanted to write a signature for\n`fs.createWriteStream`.  The docs for it describe it thusly:\n\n```\nfs.createWriteStream(path[, options])\n```\n\nThis would be a signature of `SO|S`.  That is, a string and and object, or\njust a string.\n\nNow, if you read the full `fs` docs, you'll see that actually path can ALSO\nbe a buffer.  And options can be a string, that is:\n```\npath <String> | <Buffer>\noptions <String> | <Object>\n```\n\nTo reproduce this you have to fully enumerate all of the possible\ncombinations and that implies a signature of `SO|SS|OO|OS|S|O`.  The\nawkwardness is a feature: It reminds you of the complexity you're adding to\nyour API when you do this sort of thing.\n\n\n### Browser support\n\nThis has no dependencies and should work in browsers, though you'll have\nnoisier stack traces.\n\n### Why this exists\n\nI wanted a very simple argument validator. It needed to do two things:\n\n1. Be more concise and easier to use than assertions\n\n2. Not encourage an infinite bikeshed of DSLs\n\nThis is why types are specified by a single character and there's no such\nthing as an optional argument. \n\nThis is not intended to validate user data. This is specifically about\nasserting the interface of your functions.\n\nIf you need greater validation, I encourage you to write them by hand or\nlook elsewhere.\n\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/iarna/aproba.git"
-  },
-  "scripts": {
-    "test": "standard && tap -j3 test/*.js"
-  },
-  "version": "1.2.0"
-}
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/CHANGES.md b/legacy-libs/grpc/node_modules/are-we-there-yet/CHANGES.md
deleted file mode 100644 (file)
index 21f3b1c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-Hi, figured we could actually use a changelog now:
-
-## 1.1.5 2018-05-24
-
-* [#92](https://github.com/iarna/are-we-there-yet/pull/92) Fix bug where
-  `finish` would throw errors when including `TrackerStream` objects in
-  `TrackerGroup` collections.  (@brianloveswords)
-
-## 1.1.4 2017-04-21
-
-* Fix typo in package.json
-
-## 1.1.3 2017-04-21
-
-* Improve documentation and limit files included in the distribution.
-
-## 1.1.2 2016-03-15
-
-* Add tracker group cycle detection and tests for it
-
-## 1.1.1 2016-01-29
-
-* Fix a typo in stream completion tracker
-
-## 1.1.0 2016-01-29
-
-* Rewrote completion percent computation to be low impact– no more walking a
-  tree of completion groups every time we need this info.  Previously, with
-  medium sized tree of completion groups, even a relatively modest number of
-  calls to the top level `completed()` method would result in absurd numbers
-  of calls overall as it walked down the tree. We now, instead, keep track as
-  we bubble up changes, so the computation is limited to when data changes and
-  to the depth of that one branch, instead of _every_ node. (Plus, we were already
-  incurring _this_ cost, since we already bubbled out changes.)
-* Moved different tracker types out to their own files.
-* Made tests test for TOO MANY events too.
-* Standarized the source code formatting
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/LICENSE b/legacy-libs/grpc/node_modules/are-we-there-yet/LICENSE
deleted file mode 100644 (file)
index af45880..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Copyright (c) 2015, Rebecca Turner
-
-Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/README.md b/legacy-libs/grpc/node_modules/are-we-there-yet/README.md
deleted file mode 100644 (file)
index 7e2b42d..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-are-we-there-yet
-----------------
-
-Track complex hiearchies of asynchronous task completion statuses.  This is
-intended to give you a way of recording and reporting the progress of the big
-recursive fan-out and gather type workflows that are so common in async.
-
-What you do with this completion data is up to you, but the most common use case is to
-feed it to one of the many progress bar modules.
-
-Most progress bar modules include a rudamentary version of this, but my
-needs were more complex.
-
-Usage
-=====
-
-```javascript
-var TrackerGroup = require("are-we-there-yet").TrackerGroup
-
-var top = new TrackerGroup("program")
-
-var single = top.newItem("one thing", 100)
-single.completeWork(20)
-
-console.log(top.completed()) // 0.2
-
-fs.stat("file", function(er, stat) {
-  if (er) throw er  
-  var stream = top.newStream("file", stat.size)
-  console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete
-                              // and 50% * 20% == 10%
-  fs.createReadStream("file").pipe(stream).on("data", function (chunk) {
-    // do stuff with chunk
-  })
-  top.on("change", function (name) {
-    // called each time a chunk is read from "file"
-    // top.completed() will start at 0.1 and fill up to 0.6 as the file is read
-  })
-})
-```
-
-Shared Methods
-==============
-
-* var completed = tracker.completed()
-
-Implemented in: `Tracker`, `TrackerGroup`, `TrackerStream`
-
-Returns the ratio of completed work to work to be done. Range of 0 to 1.
-
-* tracker.finish()
-
-Implemented in: `Tracker`, `TrackerGroup`
-
-Marks the tracker as completed. With a TrackerGroup this marks all of its
-components as completed.
-
-Marks all of the components of this tracker as finished, which in turn means
-that `tracker.completed()` for this will now be 1.
-
-This will result in one or more `change` events being emitted.
-
-Events
-======
-
-All tracker objects emit `change` events with the following arguments:
-
-```
-function (name, completed, tracker)
-```
-
-`name` is the name of the tracker that originally emitted the event,
-or if it didn't have one, the first containing tracker group that had one.
-
-`completed` is the percent complete (as returned by `tracker.completed()` method).
-
-`tracker` is the tracker object that you are listening for events on.
-
-TrackerGroup
-============
-
-* var tracker = new TrackerGroup(**name**)
-
-  * **name** *(optional)* - The name of this tracker group, used in change
-    notifications if the component updating didn't have a name. Defaults to undefined.
-
-Creates a new empty tracker aggregation group. These are trackers whose
-completion status is determined by the completion status of other trackers.
-
-* tracker.addUnit(**otherTracker**, **weight**)
-
-  * **otherTracker** - Any of the other are-we-there-yet tracker objects
-  * **weight** *(optional)* - The weight to give the tracker, defaults to 1.
-
-Adds the **otherTracker** to this aggregation group. The weight determines
-how long you expect this tracker to take to complete in proportion to other
-units.  So for instance, if you add one tracker with a weight of 1 and
-another with a weight of 2, you're saying the second will take twice as long
-to complete as the first.  As such, the first will account for 33% of the
-completion of this tracker and the second will account for the other 67%.
-
-Returns **otherTracker**.
-
-* var subGroup = tracker.newGroup(**name**, **weight**)
-
-The above is exactly equivalent to:
-
-```javascript
-  var subGroup = tracker.addUnit(new TrackerGroup(name), weight)
-```
-
-* var subItem = tracker.newItem(**name**, **todo**, **weight**)
-
-The above is exactly equivalent to:
-
-```javascript
-  var subItem = tracker.addUnit(new Tracker(name, todo), weight)
-```
-
-* var subStream = tracker.newStream(**name**, **todo**, **weight**)
-
-The above is exactly equivalent to:
-
-```javascript
-  var subStream = tracker.addUnit(new TrackerStream(name, todo), weight)
-```
-
-* console.log( tracker.debug() )
-
-Returns a tree showing the completion of this tracker group and all of its
-children, including recursively entering all of the children.
-
-Tracker
-=======
-
-* var tracker = new Tracker(**name**, **todo**)
-
-  * **name** *(optional)* The name of this counter to report in change
-    events.  Defaults to undefined.
-  * **todo** *(optional)* The amount of work todo (a number). Defaults to 0.
-
-Ordinarily these are constructed as a part of a tracker group (via
-`newItem`).
-
-* var completed = tracker.completed()
-
-Returns the ratio of completed work to work to be done. Range of 0 to 1. If
-total work to be done is 0 then it will return 0.
-
-* tracker.addWork(**todo**)
-
-  * **todo** A number to add to the amount of work to be done.
-
-Increases the amount of work to be done, thus decreasing the completion
-percentage.  Triggers a `change` event.
-
-* tracker.completeWork(**completed**)
-
-  * **completed** A number to add to the work complete
-
-Increase the amount of work complete, thus increasing the completion percentage.
-Will never increase the work completed past the amount of work todo. That is,
-percentages > 100% are not allowed. Triggers a `change` event.
-
-* tracker.finish()
-
-Marks this tracker as finished, tracker.completed() will now be 1. Triggers
-a `change` event.
-
-TrackerStream
-=============
-
-* var tracker = new TrackerStream(**name**, **size**, **options**)
-
-  * **name** *(optional)* The name of this counter to report in change
-    events.  Defaults to undefined.
-  * **size** *(optional)* The number of bytes being sent through this stream.
-  * **options** *(optional)* A hash of stream options
-
-The tracker stream object is a pass through stream that updates an internal
-tracker object each time a block passes through.  It's intended to track
-downloads, file extraction and other related activities. You use it by piping
-your data source into it and then using it as your data source.
-
-If your data has a length attribute then that's used as the amount of work
-completed when the chunk is passed through.  If it does not (eg, object
-streams) then each chunk counts as completing 1 unit of work, so your size
-should be the total number of objects being streamed.
-
-* tracker.addWork(**todo**)
-
-  * **todo** Increase the expected overall size by **todo** bytes.
-
-Increases the amount of work to be done, thus decreasing the completion
-percentage.  Triggers a `change` event.
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/index.js b/legacy-libs/grpc/node_modules/are-we-there-yet/index.js
deleted file mode 100644 (file)
index 57d8743..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict'
-exports.TrackerGroup = require('./tracker-group.js')
-exports.Tracker = require('./tracker.js')
-exports.TrackerStream = require('./tracker-stream.js')
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/package.json b/legacy-libs/grpc/node_modules/are-we-there-yet/package.json
deleted file mode 100644 (file)
index ddcb7a6..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_args": [
-    [
-      "are-we-there-yet@1.1.5",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "are-we-there-yet@1.1.5",
-  "_id": "are-we-there-yet@1.1.5",
-  "_inBundle": false,
-  "_integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
-  "_location": "/grpc/are-we-there-yet",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "are-we-there-yet@1.1.5",
-    "name": "are-we-there-yet",
-    "escapedName": "are-we-there-yet",
-    "rawSpec": "1.1.5",
-    "saveSpec": null,
-    "fetchSpec": "1.1.5"
-  },
-  "_requiredBy": [
-    "/grpc/npmlog"
-  ],
-  "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.5",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Rebecca Turner",
-    "url": "http://re-becca.org"
-  },
-  "bugs": {
-    "url": "https://github.com/iarna/are-we-there-yet/issues"
-  },
-  "dependencies": {
-    "delegates": "^1.0.0",
-    "readable-stream": "^2.0.6"
-  },
-  "description": "Keep track of the overall completion of many disparate processes",
-  "devDependencies": {
-    "standard": "^11.0.1",
-    "tap": "^12.0.1"
-  },
-  "files": [
-    "index.js",
-    "tracker-base.js",
-    "tracker-group.js",
-    "tracker-stream.js",
-    "tracker.js",
-    "CHANGES.md"
-  ],
-  "homepage": "https://github.com/iarna/are-we-there-yet",
-  "license": "ISC",
-  "main": "index.js",
-  "name": "are-we-there-yet",
-  "optionalDependencies": {},
-  "readme": "are-we-there-yet\n----------------\n\nTrack complex hiearchies of asynchronous task completion statuses.  This is\nintended to give you a way of recording and reporting the progress of the big\nrecursive fan-out and gather type workflows that are so common in async.\n\nWhat you do with this completion data is up to you, but the most common use case is to\nfeed it to one of the many progress bar modules.\n\nMost progress bar modules include a rudamentary version of this, but my\nneeds were more complex.\n\nUsage\n=====\n\n```javascript\nvar TrackerGroup = require(\"are-we-there-yet\").TrackerGroup\n\nvar top = new TrackerGroup(\"program\")\n\nvar single = top.newItem(\"one thing\", 100)\nsingle.completeWork(20)\n\nconsole.log(top.completed()) // 0.2\n\nfs.stat(\"file\", function(er, stat) {\n  if (er) throw er  \n  var stream = top.newStream(\"file\", stat.size)\n  console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete\n                              // and 50% * 20% == 10%\n  fs.createReadStream(\"file\").pipe(stream).on(\"data\", function (chunk) {\n    // do stuff with chunk\n  })\n  top.on(\"change\", function (name) {\n    // called each time a chunk is read from \"file\"\n    // top.completed() will start at 0.1 and fill up to 0.6 as the file is read\n  })\n})\n```\n\nShared Methods\n==============\n\n* var completed = tracker.completed()\n\nImplemented in: `Tracker`, `TrackerGroup`, `TrackerStream`\n\nReturns the ratio of completed work to work to be done. Range of 0 to 1.\n\n* tracker.finish()\n\nImplemented in: `Tracker`, `TrackerGroup`\n\nMarks the tracker as completed. With a TrackerGroup this marks all of its\ncomponents as completed.\n\nMarks all of the components of this tracker as finished, which in turn means\nthat `tracker.completed()` for this will now be 1.\n\nThis will result in one or more `change` events being emitted.\n\nEvents\n======\n\nAll tracker objects emit `change` events with the following arguments:\n\n```\nfunction (name, completed, tracker)\n```\n\n`name` is the name of the tracker that originally emitted the event,\nor if it didn't have one, the first containing tracker group that had one.\n\n`completed` is the percent complete (as returned by `tracker.completed()` method).\n\n`tracker` is the tracker object that you are listening for events on.\n\nTrackerGroup\n============\n\n* var tracker = new TrackerGroup(**name**)\n\n  * **name** *(optional)* - The name of this tracker group, used in change\n    notifications if the component updating didn't have a name. Defaults to undefined.\n\nCreates a new empty tracker aggregation group. These are trackers whose\ncompletion status is determined by the completion status of other trackers.\n\n* tracker.addUnit(**otherTracker**, **weight**)\n\n  * **otherTracker** - Any of the other are-we-there-yet tracker objects\n  * **weight** *(optional)* - The weight to give the tracker, defaults to 1.\n\nAdds the **otherTracker** to this aggregation group. The weight determines\nhow long you expect this tracker to take to complete in proportion to other\nunits.  So for instance, if you add one tracker with a weight of 1 and\nanother with a weight of 2, you're saying the second will take twice as long\nto complete as the first.  As such, the first will account for 33% of the\ncompletion of this tracker and the second will account for the other 67%.\n\nReturns **otherTracker**.\n\n* var subGroup = tracker.newGroup(**name**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n  var subGroup = tracker.addUnit(new TrackerGroup(name), weight)\n```\n\n* var subItem = tracker.newItem(**name**, **todo**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n  var subItem = tracker.addUnit(new Tracker(name, todo), weight)\n```\n\n* var subStream = tracker.newStream(**name**, **todo**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n  var subStream = tracker.addUnit(new TrackerStream(name, todo), weight)\n```\n\n* console.log( tracker.debug() )\n\nReturns a tree showing the completion of this tracker group and all of its\nchildren, including recursively entering all of the children.\n\nTracker\n=======\n\n* var tracker = new Tracker(**name**, **todo**)\n\n  * **name** *(optional)* The name of this counter to report in change\n    events.  Defaults to undefined.\n  * **todo** *(optional)* The amount of work todo (a number). Defaults to 0.\n\nOrdinarily these are constructed as a part of a tracker group (via\n`newItem`).\n\n* var completed = tracker.completed()\n\nReturns the ratio of completed work to work to be done. Range of 0 to 1. If\ntotal work to be done is 0 then it will return 0.\n\n* tracker.addWork(**todo**)\n\n  * **todo** A number to add to the amount of work to be done.\n\nIncreases the amount of work to be done, thus decreasing the completion\npercentage.  Triggers a `change` event.\n\n* tracker.completeWork(**completed**)\n\n  * **completed** A number to add to the work complete\n\nIncrease the amount of work complete, thus increasing the completion percentage.\nWill never increase the work completed past the amount of work todo. That is,\npercentages > 100% are not allowed. Triggers a `change` event.\n\n* tracker.finish()\n\nMarks this tracker as finished, tracker.completed() will now be 1. Triggers\na `change` event.\n\nTrackerStream\n=============\n\n* var tracker = new TrackerStream(**name**, **size**, **options**)\n\n  * **name** *(optional)* The name of this counter to report in change\n    events.  Defaults to undefined.\n  * **size** *(optional)* The number of bytes being sent through this stream.\n  * **options** *(optional)* A hash of stream options\n\nThe tracker stream object is a pass through stream that updates an internal\ntracker object each time a block passes through.  It's intended to track\ndownloads, file extraction and other related activities. You use it by piping\nyour data source into it and then using it as your data source.\n\nIf your data has a length attribute then that's used as the amount of work\ncompleted when the chunk is passed through.  If it does not (eg, object\nstreams) then each chunk counts as completing 1 unit of work, so your size\nshould be the total number of objects being streamed.\n\n* tracker.addWork(**todo**)\n\n  * **todo** Increase the expected overall size by **todo** bytes.\n\nIncreases the amount of work to be done, thus decreasing the completion\npercentage.  Triggers a `change` event.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/iarna/are-we-there-yet.git"
-  },
-  "scripts": {
-    "test": "standard && tap test/*.js"
-  },
-  "version": "1.1.5"
-}
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-base.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-base.js
deleted file mode 100644 (file)
index 6f43687..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-var EventEmitter = require('events').EventEmitter
-var util = require('util')
-
-var trackerId = 0
-var TrackerBase = module.exports = function (name) {
-  EventEmitter.call(this)
-  this.id = ++trackerId
-  this.name = name
-}
-util.inherits(TrackerBase, EventEmitter)
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-group.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-group.js
deleted file mode 100644 (file)
index 9759e12..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-'use strict'
-var util = require('util')
-var TrackerBase = require('./tracker-base.js')
-var Tracker = require('./tracker.js')
-var TrackerStream = require('./tracker-stream.js')
-
-var TrackerGroup = module.exports = function (name) {
-  TrackerBase.call(this, name)
-  this.parentGroup = null
-  this.trackers = []
-  this.completion = {}
-  this.weight = {}
-  this.totalWeight = 0
-  this.finished = false
-  this.bubbleChange = bubbleChange(this)
-}
-util.inherits(TrackerGroup, TrackerBase)
-
-function bubbleChange (trackerGroup) {
-  return function (name, completed, tracker) {
-    trackerGroup.completion[tracker.id] = completed
-    if (trackerGroup.finished) return
-    trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
-  }
-}
-
-TrackerGroup.prototype.nameInTree = function () {
-  var names = []
-  var from = this
-  while (from) {
-    names.unshift(from.name)
-    from = from.parentGroup
-  }
-  return names.join('/')
-}
-
-TrackerGroup.prototype.addUnit = function (unit, weight) {
-  if (unit.addUnit) {
-    var toTest = this
-    while (toTest) {
-      if (unit === toTest) {
-        throw new Error(
-          'Attempted to add tracker group ' +
-          unit.name + ' to tree that already includes it ' +
-          this.nameInTree(this))
-      }
-      toTest = toTest.parentGroup
-    }
-    unit.parentGroup = this
-  }
-  this.weight[unit.id] = weight || 1
-  this.totalWeight += this.weight[unit.id]
-  this.trackers.push(unit)
-  this.completion[unit.id] = unit.completed()
-  unit.on('change', this.bubbleChange)
-  if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit)
-  return unit
-}
-
-TrackerGroup.prototype.completed = function () {
-  if (this.trackers.length === 0) return 0
-  var valPerWeight = 1 / this.totalWeight
-  var completed = 0
-  for (var ii = 0; ii < this.trackers.length; ii++) {
-    var trackerId = this.trackers[ii].id
-    completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId]
-  }
-  return completed
-}
-
-TrackerGroup.prototype.newGroup = function (name, weight) {
-  return this.addUnit(new TrackerGroup(name), weight)
-}
-
-TrackerGroup.prototype.newItem = function (name, todo, weight) {
-  return this.addUnit(new Tracker(name, todo), weight)
-}
-
-TrackerGroup.prototype.newStream = function (name, todo, weight) {
-  return this.addUnit(new TrackerStream(name, todo), weight)
-}
-
-TrackerGroup.prototype.finish = function () {
-  this.finished = true
-  if (!this.trackers.length) this.addUnit(new Tracker(), 1, true)
-  for (var ii = 0; ii < this.trackers.length; ii++) {
-    var tracker = this.trackers[ii]
-    tracker.finish()
-    tracker.removeListener('change', this.bubbleChange)
-  }
-  this.emit('change', this.name, 1, this)
-}
-
-var buffer = '                                  '
-TrackerGroup.prototype.debug = function (depth) {
-  depth = depth || 0
-  var indent = depth ? buffer.substr(0, depth) : ''
-  var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
-  this.trackers.forEach(function (tracker) {
-    if (tracker instanceof TrackerGroup) {
-      output += tracker.debug(depth + 1)
-    } else {
-      output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
-    }
-  })
-  return output
-}
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-stream.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker-stream.js
deleted file mode 100644 (file)
index e1cf850..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict'
-var util = require('util')
-var stream = require('readable-stream')
-var delegate = require('delegates')
-var Tracker = require('./tracker.js')
-
-var TrackerStream = module.exports = function (name, size, options) {
-  stream.Transform.call(this, options)
-  this.tracker = new Tracker(name, size)
-  this.name = name
-  this.id = this.tracker.id
-  this.tracker.on('change', delegateChange(this))
-}
-util.inherits(TrackerStream, stream.Transform)
-
-function delegateChange (trackerStream) {
-  return function (name, completion, tracker) {
-    trackerStream.emit('change', name, completion, trackerStream)
-  }
-}
-
-TrackerStream.prototype._transform = function (data, encoding, cb) {
-  this.tracker.completeWork(data.length ? data.length : 1)
-  this.push(data)
-  cb()
-}
-
-TrackerStream.prototype._flush = function (cb) {
-  this.tracker.finish()
-  cb()
-}
-
-delegate(TrackerStream.prototype, 'tracker')
-  .method('completed')
-  .method('addWork')
-  .method('finish')
diff --git a/legacy-libs/grpc/node_modules/are-we-there-yet/tracker.js b/legacy-libs/grpc/node_modules/are-we-there-yet/tracker.js
deleted file mode 100644 (file)
index 68c2339..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict'
-var util = require('util')
-var TrackerBase = require('./tracker-base.js')
-
-var Tracker = module.exports = function (name, todo) {
-  TrackerBase.call(this, name)
-  this.workDone = 0
-  this.workTodo = todo || 0
-}
-util.inherits(Tracker, TrackerBase)
-
-Tracker.prototype.completed = function () {
-  return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
-}
-
-Tracker.prototype.addWork = function (work) {
-  this.workTodo += work
-  this.emit('change', this.name, this.completed(), this)
-}
-
-Tracker.prototype.completeWork = function (work) {
-  this.workDone += work
-  if (this.workDone > this.workTodo) this.workDone = this.workTodo
-  this.emit('change', this.name, this.completed(), this)
-}
-
-Tracker.prototype.finish = function () {
-  this.workTodo = this.workDone = 1
-  this.emit('change', this.name, 1, this)
-}
diff --git a/legacy-libs/grpc/node_modules/balanced-match/LICENSE.md b/legacy-libs/grpc/node_modules/balanced-match/LICENSE.md
deleted file mode 100644 (file)
index 2cdc8e4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-(MIT)
-
-Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/balanced-match/README.md b/legacy-libs/grpc/node_modules/balanced-match/README.md
deleted file mode 100644 (file)
index 08e918c..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-# balanced-match
-
-Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
-
-[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
-[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
-
-[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
-
-## Example
-
-Get the first matching pair of braces:
-
-```js
-var balanced = require('balanced-match');
-
-console.log(balanced('{', '}', 'pre{in{nested}}post'));
-console.log(balanced('{', '}', 'pre{first}between{second}post'));
-console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre  {   in{nest}   }  post'));
-```
-
-The matches are:
-
-```bash
-$ node example.js
-{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
-{ start: 3,
-  end: 9,
-  pre: 'pre',
-  body: 'first',
-  post: 'between{second}post' }
-{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
-```
-
-## API
-
-### var m = balanced(a, b, str)
-
-For the first non-nested matching pair of `a` and `b` in `str`, return an
-object with those keys:
-
-* **start** the index of the first match of `a`
-* **end** the index of the matching `b`
-* **pre** the preamble, `a` and `b` not included
-* **body** the match, `a` and `b` not included
-* **post** the postscript, `a` and `b` not included
-
-If there's no match, `undefined` will be returned.
-
-If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
-
-### var r = balanced.range(a, b, str)
-
-For the first non-nested matching pair of `a` and `b` in `str`, return an
-array with indexes: `[ <a index>, <b index> ]`.
-
-If there's no match, `undefined` will be returned.
-
-If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
-
-## Installation
-
-With [npm](https://npmjs.org) do:
-
-```bash
-npm install balanced-match
-```
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/balanced-match/index.js b/legacy-libs/grpc/node_modules/balanced-match/index.js
deleted file mode 100644 (file)
index 1685a76..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-'use strict';
-module.exports = balanced;
-function balanced(a, b, str) {
-  if (a instanceof RegExp) a = maybeMatch(a, str);
-  if (b instanceof RegExp) b = maybeMatch(b, str);
-
-  var r = range(a, b, str);
-
-  return r && {
-    start: r[0],
-    end: r[1],
-    pre: str.slice(0, r[0]),
-    body: str.slice(r[0] + a.length, r[1]),
-    post: str.slice(r[1] + b.length)
-  };
-}
-
-function maybeMatch(reg, str) {
-  var m = str.match(reg);
-  return m ? m[0] : null;
-}
-
-balanced.range = range;
-function range(a, b, str) {
-  var begs, beg, left, right, result;
-  var ai = str.indexOf(a);
-  var bi = str.indexOf(b, ai + 1);
-  var i = ai;
-
-  if (ai >= 0 && bi > 0) {
-    begs = [];
-    left = str.length;
-
-    while (i >= 0 && !result) {
-      if (i == ai) {
-        begs.push(i);
-        ai = str.indexOf(a, i + 1);
-      } else if (begs.length == 1) {
-        result = [ begs.pop(), bi ];
-      } else {
-        beg = begs.pop();
-        if (beg < left) {
-          left = beg;
-          right = bi;
-        }
-
-        bi = str.indexOf(b, i + 1);
-      }
-
-      i = ai < bi && ai >= 0 ? ai : bi;
-    }
-
-    if (begs.length) {
-      result = [ left, right ];
-    }
-  }
-
-  return result;
-}
diff --git a/legacy-libs/grpc/node_modules/balanced-match/package.json b/legacy-libs/grpc/node_modules/balanced-match/package.json
deleted file mode 100644 (file)
index c35a498..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{
-  "_args": [
-    [
-      "balanced-match@1.0.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "balanced-match@1.0.0",
-  "_id": "balanced-match@1.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
-  "_location": "/grpc/balanced-match",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "balanced-match@1.0.0",
-    "name": "balanced-match",
-    "escapedName": "balanced-match",
-    "rawSpec": "1.0.0",
-    "saveSpec": null,
-    "fetchSpec": "1.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/brace-expansion"
-  ],
-  "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Julian Gruber",
-    "email": "mail@juliangruber.com",
-    "url": "http://juliangruber.com"
-  },
-  "bugs": {
-    "url": "https://github.com/juliangruber/balanced-match/issues"
-  },
-  "dependencies": {},
-  "description": "Match balanced character pairs, like \"{\" and \"}\"",
-  "devDependencies": {
-    "matcha": "^0.7.0",
-    "tape": "^4.6.0"
-  },
-  "homepage": "https://github.com/juliangruber/balanced-match",
-  "keywords": [
-    "match",
-    "regexp",
-    "test",
-    "balanced",
-    "parse"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "balanced-match",
-  "optionalDependencies": {},
-  "readme": "# balanced-match\n\nMatch balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!\n\n[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)\n[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)\n\n[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)\n\n## Example\n\nGet the first matching pair of braces:\n\n```js\nvar balanced = require('balanced-match');\n\nconsole.log(balanced('{', '}', 'pre{in{nested}}post'));\nconsole.log(balanced('{', '}', 'pre{first}between{second}post'));\nconsole.log(balanced(/\\s+\\{\\s+/, /\\s+\\}\\s+/, 'pre  {   in{nest}   }  post'));\n```\n\nThe matches are:\n\n```bash\n$ node example.js\n{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }\n{ start: 3,\n  end: 9,\n  pre: 'pre',\n  body: 'first',\n  post: 'between{second}post' }\n{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }\n```\n\n## API\n\n### var m = balanced(a, b, str)\n\nFor the first non-nested matching pair of `a` and `b` in `str`, return an\nobject with those keys:\n\n* **start** the index of the first match of `a`\n* **end** the index of the matching `b`\n* **pre** the preamble, `a` and `b` not included\n* **body** the match, `a` and `b` not included\n* **post** the postscript, `a` and `b` not included\n\nIf there's no match, `undefined` will be returned.\n\nIf the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.\n\n### var r = balanced.range(a, b, str)\n\nFor the first non-nested matching pair of `a` and `b` in `str`, return an\narray with indexes: `[ <a index>, <b index> ]`.\n\nIf there's no match, `undefined` will be returned.\n\nIf the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.\n\n## Installation\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install balanced-match\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/juliangruber/balanced-match.git"
-  },
-  "scripts": {
-    "bench": "make bench",
-    "test": "make test"
-  },
-  "testling": {
-    "files": "test/*.js",
-    "browsers": [
-      "ie/8..latest",
-      "firefox/20..latest",
-      "firefox/nightly",
-      "chrome/25..latest",
-      "chrome/canary",
-      "opera/12..latest",
-      "opera/next",
-      "safari/5.1..latest",
-      "ipad/6.0..latest",
-      "iphone/6.0..latest",
-      "android-browser/4.2..latest"
-    ]
-  },
-  "version": "1.0.0"
-}
diff --git a/legacy-libs/grpc/node_modules/brace-expansion/LICENSE b/legacy-libs/grpc/node_modules/brace-expansion/LICENSE
deleted file mode 100644 (file)
index de32266..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/brace-expansion/README.md b/legacy-libs/grpc/node_modules/brace-expansion/README.md
deleted file mode 100644 (file)
index 6b4e0e1..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-# brace-expansion
-
-[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), 
-as known from sh/bash, in JavaScript.
-
-[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
-[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
-[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)
-
-[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
-
-## Example
-
-```js
-var expand = require('brace-expansion');
-
-expand('file-{a,b,c}.jpg')
-// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
-
-expand('-v{,,}')
-// => ['-v', '-v', '-v']
-
-expand('file{0..2}.jpg')
-// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
-
-expand('file-{a..c}.jpg')
-// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
-
-expand('file{2..0}.jpg')
-// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
-
-expand('file{0..4..2}.jpg')
-// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
-
-expand('file-{a..e..2}.jpg')
-// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
-
-expand('file{00..10..5}.jpg')
-// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
-
-expand('{{A..C},{a..c}}')
-// => ['A', 'B', 'C', 'a', 'b', 'c']
-
-expand('ppp{,config,oe{,conf}}')
-// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
-```
-
-## API
-
-```js
-var expand = require('brace-expansion');
-```
-
-### var expanded = expand(str)
-
-Return an array of all possible and valid expansions of `str`. If none are
-found, `[str]` is returned.
-
-Valid expansions are:
-
-```js
-/^(.*,)+(.+)?$/
-// {a,b,...}
-```
-
-A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
-
-```js
-/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
-// {x..y[..incr]}
-```
-
-A numeric sequence from `x` to `y` inclusive, with optional increment.
-If `x` or `y` start with a leading `0`, all the numbers will be padded
-to have equal length. Negative numbers and backwards iteration work too.
-
-```js
-/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
-// {x..y[..incr]}
-```
-
-An alphabetic sequence from `x` to `y` inclusive, with optional increment.
-`x` and `y` must be exactly one character, and if given, `incr` must be a
-number.
-
-For compatibility reasons, the string `${` is not eligible for brace expansion.
-
-## Installation
-
-With [npm](https://npmjs.org) do:
-
-```bash
-npm install brace-expansion
-```
-
-## Contributors
-
-- [Julian Gruber](https://github.com/juliangruber)
-- [Isaac Z. Schlueter](https://github.com/isaacs)
-
-## Sponsors
-
-This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
-
-Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/brace-expansion/index.js b/legacy-libs/grpc/node_modules/brace-expansion/index.js
deleted file mode 100644 (file)
index 0478be8..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-var concatMap = require('concat-map');
-var balanced = require('balanced-match');
-
-module.exports = expandTop;
-
-var escSlash = '\0SLASH'+Math.random()+'\0';
-var escOpen = '\0OPEN'+Math.random()+'\0';
-var escClose = '\0CLOSE'+Math.random()+'\0';
-var escComma = '\0COMMA'+Math.random()+'\0';
-var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
-function numeric(str) {
-  return parseInt(str, 10) == str
-    ? parseInt(str, 10)
-    : str.charCodeAt(0);
-}
-
-function escapeBraces(str) {
-  return str.split('\\\\').join(escSlash)
-            .split('\\{').join(escOpen)
-            .split('\\}').join(escClose)
-            .split('\\,').join(escComma)
-            .split('\\.').join(escPeriod);
-}
-
-function unescapeBraces(str) {
-  return str.split(escSlash).join('\\')
-            .split(escOpen).join('{')
-            .split(escClose).join('}')
-            .split(escComma).join(',')
-            .split(escPeriod).join('.');
-}
-
-
-// Basically just str.split(","), but handling cases
-// where we have nested braced sections, which should be
-// treated as individual members, like {a,{b,c},d}
-function parseCommaParts(str) {
-  if (!str)
-    return [''];
-
-  var parts = [];
-  var m = balanced('{', '}', str);
-
-  if (!m)
-    return str.split(',');
-
-  var pre = m.pre;
-  var body = m.body;
-  var post = m.post;
-  var p = pre.split(',');
-
-  p[p.length-1] += '{' + body + '}';
-  var postParts = parseCommaParts(post);
-  if (post.length) {
-    p[p.length-1] += postParts.shift();
-    p.push.apply(p, postParts);
-  }
-
-  parts.push.apply(parts, p);
-
-  return parts;
-}
-
-function expandTop(str) {
-  if (!str)
-    return [];
-
-  // I don't know why Bash 4.3 does this, but it does.
-  // Anything starting with {} will have the first two bytes preserved
-  // but *only* at the top level, so {},a}b will not expand to anything,
-  // but a{},b}c will be expanded to [a}c,abc].
-  // One could argue that this is a bug in Bash, but since the goal of
-  // this module is to match Bash's rules, we escape a leading {}
-  if (str.substr(0, 2) === '{}') {
-    str = '\\{\\}' + str.substr(2);
-  }
-
-  return expand(escapeBraces(str), true).map(unescapeBraces);
-}
-
-function identity(e) {
-  return e;
-}
-
-function embrace(str) {
-  return '{' + str + '}';
-}
-function isPadded(el) {
-  return /^-?0\d/.test(el);
-}
-
-function lte(i, y) {
-  return i <= y;
-}
-function gte(i, y) {
-  return i >= y;
-}
-
-function expand(str, isTop) {
-  var expansions = [];
-
-  var m = balanced('{', '}', str);
-  if (!m || /\$$/.test(m.pre)) return [str];
-
-  var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
-  var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
-  var isSequence = isNumericSequence || isAlphaSequence;
-  var isOptions = m.body.indexOf(',') >= 0;
-  if (!isSequence && !isOptions) {
-    // {a},b}
-    if (m.post.match(/,.*\}/)) {
-      str = m.pre + '{' + m.body + escClose + m.post;
-      return expand(str);
-    }
-    return [str];
-  }
-
-  var n;
-  if (isSequence) {
-    n = m.body.split(/\.\./);
-  } else {
-    n = parseCommaParts(m.body);
-    if (n.length === 1) {
-      // x{{a,b}}y ==> x{a}y x{b}y
-      n = expand(n[0], false).map(embrace);
-      if (n.length === 1) {
-        var post = m.post.length
-          ? expand(m.post, false)
-          : [''];
-        return post.map(function(p) {
-          return m.pre + n[0] + p;
-        });
-      }
-    }
-  }
-
-  // at this point, n is the parts, and we know it's not a comma set
-  // with a single entry.
-
-  // no need to expand pre, since it is guaranteed to be free of brace-sets
-  var pre = m.pre;
-  var post = m.post.length
-    ? expand(m.post, false)
-    : [''];
-
-  var N;
-
-  if (isSequence) {
-    var x = numeric(n[0]);
-    var y = numeric(n[1]);
-    var width = Math.max(n[0].length, n[1].length)
-    var incr = n.length == 3
-      ? Math.abs(numeric(n[2]))
-      : 1;
-    var test = lte;
-    var reverse = y < x;
-    if (reverse) {
-      incr *= -1;
-      test = gte;
-    }
-    var pad = n.some(isPadded);
-
-    N = [];
-
-    for (var i = x; test(i, y); i += incr) {
-      var c;
-      if (isAlphaSequence) {
-        c = String.fromCharCode(i);
-        if (c === '\\')
-          c = '';
-      } else {
-        c = String(i);
-        if (pad) {
-          var need = width - c.length;
-          if (need > 0) {
-            var z = new Array(need + 1).join('0');
-            if (i < 0)
-              c = '-' + z + c.slice(1);
-            else
-              c = z + c;
-          }
-        }
-      }
-      N.push(c);
-    }
-  } else {
-    N = concatMap(n, function(el) { return expand(el, false) });
-  }
-
-  for (var j = 0; j < N.length; j++) {
-    for (var k = 0; k < post.length; k++) {
-      var expansion = pre + N[j] + post[k];
-      if (!isTop || isSequence || expansion)
-        expansions.push(expansion);
-    }
-  }
-
-  return expansions;
-}
-
diff --git a/legacy-libs/grpc/node_modules/brace-expansion/package.json b/legacy-libs/grpc/node_modules/brace-expansion/package.json
deleted file mode 100644 (file)
index 5256a00..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-{
-  "_args": [
-    [
-      "brace-expansion@1.1.11",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "brace-expansion@1.1.11",
-  "_id": "brace-expansion@1.1.11",
-  "_inBundle": false,
-  "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
-  "_location": "/grpc/brace-expansion",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "brace-expansion@1.1.11",
-    "name": "brace-expansion",
-    "escapedName": "brace-expansion",
-    "rawSpec": "1.1.11",
-    "saveSpec": null,
-    "fetchSpec": "1.1.11"
-  },
-  "_requiredBy": [
-    "/grpc/minimatch"
-  ],
-  "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.11",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Julian Gruber",
-    "email": "mail@juliangruber.com",
-    "url": "http://juliangruber.com"
-  },
-  "bugs": {
-    "url": "https://github.com/juliangruber/brace-expansion/issues"
-  },
-  "dependencies": {
-    "balanced-match": "^1.0.0",
-    "concat-map": "0.0.1"
-  },
-  "description": "Brace expansion as known from sh/bash",
-  "devDependencies": {
-    "matcha": "^0.7.0",
-    "tape": "^4.6.0"
-  },
-  "homepage": "https://github.com/juliangruber/brace-expansion",
-  "keywords": [],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "brace-expansion",
-  "optionalDependencies": {},
-  "readme": "# brace-expansion\n\n[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), \nas known from sh/bash, in JavaScript.\n\n[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)\n[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)\n[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)\n\n[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)\n\n## Example\n\n```js\nvar expand = require('brace-expansion');\n\nexpand('file-{a,b,c}.jpg')\n// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']\n\nexpand('-v{,,}')\n// => ['-v', '-v', '-v']\n\nexpand('file{0..2}.jpg')\n// => ['file0.jpg', 'file1.jpg', 'file2.jpg']\n\nexpand('file-{a..c}.jpg')\n// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']\n\nexpand('file{2..0}.jpg')\n// => ['file2.jpg', 'file1.jpg', 'file0.jpg']\n\nexpand('file{0..4..2}.jpg')\n// => ['file0.jpg', 'file2.jpg', 'file4.jpg']\n\nexpand('file-{a..e..2}.jpg')\n// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']\n\nexpand('file{00..10..5}.jpg')\n// => ['file00.jpg', 'file05.jpg', 'file10.jpg']\n\nexpand('{{A..C},{a..c}}')\n// => ['A', 'B', 'C', 'a', 'b', 'c']\n\nexpand('ppp{,config,oe{,conf}}')\n// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']\n```\n\n## API\n\n```js\nvar expand = require('brace-expansion');\n```\n\n### var expanded = expand(str)\n\nReturn an array of all possible and valid expansions of `str`. If none are\nfound, `[str]` is returned.\n\nValid expansions are:\n\n```js\n/^(.*,)+(.+)?$/\n// {a,b,...}\n```\n\nA comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.\n\n```js\n/^-?\\d+\\.\\.-?\\d+(\\.\\.-?\\d+)?$/\n// {x..y[..incr]}\n```\n\nA numeric sequence from `x` to `y` inclusive, with optional increment.\nIf `x` or `y` start with a leading `0`, all the numbers will be padded\nto have equal length. Negative numbers and backwards iteration work too.\n\n```js\n/^-?\\d+\\.\\.-?\\d+(\\.\\.-?\\d+)?$/\n// {x..y[..incr]}\n```\n\nAn alphabetic sequence from `x` to `y` inclusive, with optional increment.\n`x` and `y` must be exactly one character, and if given, `incr` must be a\nnumber.\n\nFor compatibility reasons, the string `${` is not eligible for brace expansion.\n\n## Installation\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install brace-expansion\n```\n\n## Contributors\n\n- [Julian Gruber](https://github.com/juliangruber)\n- [Isaac Z. Schlueter](https://github.com/isaacs)\n\n## Sponsors\n\nThis module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!\n\nDo you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/juliangruber/brace-expansion.git"
-  },
-  "scripts": {
-    "bench": "matcha test/perf/bench.js",
-    "gentest": "bash test/generate.sh",
-    "test": "tape test/*.js"
-  },
-  "testling": {
-    "files": "test/*.js",
-    "browsers": [
-      "ie/8..latest",
-      "firefox/20..latest",
-      "firefox/nightly",
-      "chrome/25..latest",
-      "chrome/canary",
-      "opera/12..latest",
-      "opera/next",
-      "safari/5.1..latest",
-      "ipad/6.0..latest",
-      "iphone/6.0..latest",
-      "android-browser/4.2..latest"
-    ]
-  },
-  "version": "1.1.11"
-}
diff --git a/legacy-libs/grpc/node_modules/camelcase/index.js b/legacy-libs/grpc/node_modules/camelcase/index.js
new file mode 100644 (file)
index 0000000..929facb
--- /dev/null
@@ -0,0 +1,56 @@
+'use strict';
+
+function preserveCamelCase(str) {
+       var isLastCharLower = false;
+
+       for (var i = 0; i < str.length; i++) {
+               var c = str.charAt(i);
+
+               if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) {
+                       str = str.substr(0, i) + '-' + str.substr(i);
+                       isLastCharLower = false;
+                       i++;
+               } else {
+                       isLastCharLower = (c.toLowerCase() === c);
+               }
+       }
+
+       return str;
+}
+
+module.exports = function () {
+       var str = [].map.call(arguments, function (str) {
+               return str.trim();
+       }).filter(function (str) {
+               return str.length;
+       }).join('-');
+
+       if (!str.length) {
+               return '';
+       }
+
+       if (str.length === 1) {
+               return str;
+       }
+
+       if (!(/[_.\- ]+/).test(str)) {
+               if (str === str.toUpperCase()) {
+                       return str.toLowerCase();
+               }
+
+               if (str[0] !== str[0].toLowerCase()) {
+                       return str[0].toLowerCase() + str.slice(1);
+               }
+
+               return str;
+       }
+
+       str = preserveCamelCase(str);
+
+       return str
+       .replace(/^[_.\- ]+/, '')
+       .toLowerCase()
+       .replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
+               return p1.toUpperCase();
+       });
+};
diff --git a/legacy-libs/grpc/node_modules/camelcase/package.json b/legacy-libs/grpc/node_modules/camelcase/package.json
new file mode 100644 (file)
index 0000000..2558bd6
--- /dev/null
@@ -0,0 +1,107 @@
+{
+  "_args": [
+    [
+      {
+        "raw": "camelcase@^2.0.1",
+        "scope": null,
+        "escapedName": "camelcase",
+        "name": "camelcase",
+        "rawSpec": "^2.0.1",
+        "spec": ">=2.0.1 <3.0.0",
+        "type": "range"
+      },
+      "/var/opt/motion2/node_modules/grpc/node_modules/yargs"
+    ]
+  ],
+  "_from": "camelcase@>=2.0.1 <3.0.0",
+  "_id": "camelcase@2.1.1",
+  "_inCache": true,
+  "_location": "/grpc/camelcase",
+  "_nodeVersion": "4.3.0",
+  "_npmOperationalInternal": {
+    "host": "packages-12-west.internal.npmjs.com",
+    "tmp": "tmp/camelcase-2.1.1.tgz_1457803836074_0.4515206723008305"
+  },
+  "_npmUser": {
+    "name": "sindresorhus",
+    "email": "sindresorhus@gmail.com"
+  },
+  "_npmVersion": "2.14.12",
+  "_phantomChildren": {},
+  "_requested": {
+    "raw": "camelcase@^2.0.1",
+    "scope": null,
+    "escapedName": "camelcase",
+    "name": "camelcase",
+    "rawSpec": "^2.0.1",
+    "spec": ">=2.0.1 <3.0.0",
+    "type": "range"
+  },
+  "_requiredBy": [
+    "/grpc/yargs"
+  ],
+  "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz",
+  "_shasum": "7c1d16d679a1bbe59ca02cacecfb011e201f5a1f",
+  "_shrinkwrap": null,
+  "_spec": "camelcase@^2.0.1",
+  "_where": "/var/opt/motion2/node_modules/grpc/node_modules/yargs",
+  "author": {
+    "name": "Sindre Sorhus",
+    "email": "sindresorhus@gmail.com",
+    "url": "http://sindresorhus.com"
+  },
+  "bugs": {
+    "url": "https://github.com/sindresorhus/camelcase/issues"
+  },
+  "dependencies": {},
+  "description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
+  "devDependencies": {
+    "ava": "*",
+    "xo": "*"
+  },
+  "directories": {},
+  "dist": {
+    "shasum": "7c1d16d679a1bbe59ca02cacecfb011e201f5a1f",
+    "tarball": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz"
+  },
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "files": [
+    "index.js"
+  ],
+  "gitHead": "35c9c8abce5b9cc9defe534ab25823dc6383180f",
+  "homepage": "https://github.com/sindresorhus/camelcase",
+  "keywords": [
+    "camelcase",
+    "camel-case",
+    "camel",
+    "case",
+    "dash",
+    "hyphen",
+    "dot",
+    "underscore",
+    "separator",
+    "string",
+    "text",
+    "convert"
+  ],
+  "license": "MIT",
+  "maintainers": [
+    {
+      "name": "sindresorhus",
+      "email": "sindresorhus@gmail.com"
+    }
+  ],
+  "name": "camelcase",
+  "optionalDependencies": {},
+  "readme": "ERROR: No README data found!",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/sindresorhus/camelcase.git"
+  },
+  "scripts": {
+    "test": "xo && ava"
+  },
+  "version": "2.1.1"
+}
diff --git a/legacy-libs/grpc/node_modules/camelcase/readme.md b/legacy-libs/grpc/node_modules/camelcase/readme.md
new file mode 100644 (file)
index 0000000..080b2a1
--- /dev/null
@@ -0,0 +1,57 @@
+# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
+
+> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar`
+
+
+## Install
+
+```
+$ npm install --save camelcase
+```
+
+
+## Usage
+
+```js
+const camelCase = require('camelcase');
+
+camelCase('foo-bar');
+//=> 'fooBar'
+
+camelCase('foo_bar');
+//=> 'fooBar'
+
+camelCase('Foo-Bar');
+//=> 'fooBar'
+
+camelCase('--foo.bar');
+//=> 'fooBar'
+
+camelCase('__foo__bar__');
+//=> 'fooBar'
+
+camelCase('foo bar');
+//=> 'fooBar'
+
+console.log(process.argv[3]);
+//=> '--foo-bar'
+camelCase(process.argv[3]);
+//=> 'fooBar'
+
+camelCase('foo', 'bar');
+//=> 'fooBar'
+
+camelCase('__foo__', '--bar');
+//=> 'fooBar'
+```
+
+
+## Related
+
+- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
+- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/chownr/LICENSE b/legacy-libs/grpc/node_modules/chownr/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/chownr/README.md b/legacy-libs/grpc/node_modules/chownr/README.md
deleted file mode 100644 (file)
index 70e9a54..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Like `chown -R`.
-
-Takes the same arguments as `fs.chown()`
diff --git a/legacy-libs/grpc/node_modules/chownr/chownr.js b/legacy-libs/grpc/node_modules/chownr/chownr.js
deleted file mode 100644 (file)
index 7e63928..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-'use strict'
-const fs = require('fs')
-const path = require('path')
-
-/* istanbul ignore next */
-const LCHOWN = fs.lchown ? 'lchown' : 'chown'
-/* istanbul ignore next */
-const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync'
-
-// fs.readdir could only accept an options object as of node v6
-const nodeVersion = process.version
-let readdir = (path, options, cb) => fs.readdir(path, options, cb)
-let readdirSync = (path, options) => fs.readdirSync(path, options)
-/* istanbul ignore next */
-if (/^v4\./.test(nodeVersion))
-  readdir = (path, options, cb) => fs.readdir(path, cb)
-
-const chownrKid = (p, child, uid, gid, cb) => {
-  if (typeof child === 'string')
-    return fs.lstat(path.resolve(p, child), (er, stats) => {
-      if (er)
-        return cb(er)
-      stats.name = child
-      chownrKid(p, stats, uid, gid, cb)
-    })
-
-  if (child.isDirectory()) {
-    chownr(path.resolve(p, child.name), uid, gid, er => {
-      if (er)
-        return cb(er)
-      fs[LCHOWN](path.resolve(p, child.name), uid, gid, cb)
-    })
-  } else
-    fs[LCHOWN](path.resolve(p, child.name), uid, gid, cb)
-}
-
-
-const chownr = (p, uid, gid, cb) => {
-  readdir(p, { withFileTypes: true }, (er, children) => {
-    // any error other than ENOTDIR or ENOTSUP means it's not readable,
-    // or doesn't exist.  give up.
-    if (er && er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
-      return cb(er)
-    if (er || !children.length) return fs[LCHOWN](p, uid, gid, cb)
-
-    let len = children.length
-    let errState = null
-    const then = er => {
-      if (errState) return
-      if (er) return cb(errState = er)
-      if (-- len === 0) return fs[LCHOWN](p, uid, gid, cb)
-    }
-
-    children.forEach(child => chownrKid(p, child, uid, gid, then))
-  })
-}
-
-const chownrKidSync = (p, child, uid, gid) => {
-  if (typeof child === 'string') {
-    const stats = fs.lstatSync(path.resolve(p, child))
-    stats.name = child
-    child = stats
-  }
-
-  if (child.isDirectory())
-    chownrSync(path.resolve(p, child.name), uid, gid)
-
-  fs[LCHOWNSYNC](path.resolve(p, child.name), uid, gid)
-}
-
-const chownrSync = (p, uid, gid) => {
-  let children
-  try {
-    children = readdirSync(p, { withFileTypes: true })
-  } catch (er) {
-    if (er && er.code === 'ENOTDIR' && er.code !== 'ENOTSUP')
-      return fs[LCHOWNSYNC](p, uid, gid)
-    throw er
-  }
-
-  if (children.length)
-    children.forEach(child => chownrKidSync(p, child, uid, gid))
-
-  return fs[LCHOWNSYNC](p, uid, gid)
-}
-
-module.exports = chownr
-chownr.sync = chownrSync
diff --git a/legacy-libs/grpc/node_modules/chownr/package.json b/legacy-libs/grpc/node_modules/chownr/package.json
deleted file mode 100644 (file)
index c6bedef..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{
-  "_from": "chownr@^1.1.1",
-  "_id": "chownr@1.1.1",
-  "_inBundle": false,
-  "_integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==",
-  "_location": "/grpc/chownr",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "chownr@^1.1.1",
-    "name": "chownr",
-    "escapedName": "chownr",
-    "rawSpec": "^1.1.1",
-    "saveSpec": null,
-    "fetchSpec": "^1.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz",
-  "_shasum": "54726b8b8fff4df053c42187e801fb4412df1494",
-  "_shrinkwrap": null,
-  "_spec": "chownr@^1.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/chownr/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "like `chown -R`",
-  "devDependencies": {
-    "mkdirp": "0.3",
-    "rimraf": "",
-    "tap": "^12.0.1"
-  },
-  "files": [
-    "chownr.js"
-  ],
-  "homepage": "https://github.com/isaacs/chownr#readme",
-  "license": "ISC",
-  "main": "chownr.js",
-  "name": "chownr",
-  "optionalDependencies": {},
-  "readme": "Like `chown -R`.\n\nTakes the same arguments as `fs.chown()`\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/chownr.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --cov"
-  },
-  "version": "1.1.1"
-}
diff --git a/legacy-libs/grpc/node_modules/cliui/CHANGELOG.md b/legacy-libs/grpc/node_modules/cliui/CHANGELOG.md
new file mode 100644 (file)
index 0000000..ef6a35e
--- /dev/null
@@ -0,0 +1,15 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+<a name="3.2.0"></a>
+# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
+
+
+### Bug Fixes
+
+* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
+
+### Features
+
+* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
diff --git a/legacy-libs/grpc/node_modules/cliui/LICENSE.txt b/legacy-libs/grpc/node_modules/cliui/LICENSE.txt
new file mode 100644 (file)
index 0000000..c7e2747
--- /dev/null
@@ -0,0 +1,14 @@
+Copyright (c) 2015, Contributors
+
+Permission to use, copy, modify, and/or distribute this software
+for any purpose with or without fee is hereby granted, provided
+that the above copyright notice and this permission notice
+appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
+LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/cliui/README.md b/legacy-libs/grpc/node_modules/cliui/README.md
new file mode 100644 (file)
index 0000000..028392c
--- /dev/null
@@ -0,0 +1,110 @@
+# cliui
+
+[![Build Status](https://travis-ci.org/yargs/cliui.svg)](https://travis-ci.org/yargs/cliui)
+[![Coverage Status](https://coveralls.io/repos/yargs/cliui/badge.svg?branch=)](https://coveralls.io/r/yargs/cliui?branch=)
+[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui)
+[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
+
+easily create complex multi-column command-line-interfaces.
+
+## Example
+
+```js
+var ui = require('cliui')({
+  width: 80
+})
+
+ui.div('Usage: $0 [command] [options]')
+
+ui.div({
+  text: 'Options:',
+  padding: [2, 0, 2, 0]
+})
+
+ui.div(
+  {
+    text: "-f, --file",
+    width: 20,
+    padding: [0, 4, 0, 4]
+  },
+  {
+    text: "the file to load." +
+      chalk.green("(if this description is long it wraps).")
+    ,
+    width: 20
+  },
+  {
+    text: chalk.red("[required]"),
+    align: 'right'
+  }
+)
+
+console.log(ui.toString())
+```
+
+<img width="500" src="screenshot.png">
+
+## Layout DSL
+
+cliui exposes a simple layout DSL:
+
+If you create a single `ui.row`, passing a string rather than an
+object:
+
+* `\n`: characters will be interpreted as new rows.
+* `\t`: characters will be interpreted as new columns.
+* `\s`: characters will be interpreted as padding.
+
+**as an example...**
+
+```js
+var ui = require('./')({
+  width: 60
+})
+
+ui.div(
+  'Usage: node ./bin/foo.js\n' +
+  '  <regex>\t  provide a regex\n' +
+  '  <glob>\t  provide a glob\t [required]'
+)
+
+console.log(ui.toString())
+```
+
+**will output:**
+
+```shell
+Usage: node ./bin/foo.js
+  <regex>  provide a regex
+  <glob>   provide a glob          [required]
+```
+
+## Methods
+
+```js
+cliui = require('cliui')
+```
+
+### cliui({width: integer})
+
+Specify the maximum width of the UI being generated.
+
+### cliui({wrap: boolean})
+
+Enable or disable the wrapping of text in a column.
+
+### cliui.div(column, column, column)
+
+Create a row with any number of columns, a column
+can either be a string, or an object with the following
+options:
+
+* **width:** the width of a column.
+* **align:** alignment, `right` or `center`.
+* **padding:** `[top, right, bottom, left]`.
+* **border:** should a border be placed around the div?
+
+### cliui.span(column, column, column)
+
+Similar to `div`, except the next row will be appended without
+a new line being created.
diff --git a/legacy-libs/grpc/node_modules/cliui/index.js b/legacy-libs/grpc/node_modules/cliui/index.js
new file mode 100644 (file)
index 0000000..e501e78
--- /dev/null
@@ -0,0 +1,316 @@
+var stringWidth = require('string-width')
+var stripAnsi = require('strip-ansi')
+var wrap = require('wrap-ansi')
+var align = {
+  right: alignRight,
+  center: alignCenter
+}
+var top = 0
+var right = 1
+var bottom = 2
+var left = 3
+
+function UI (opts) {
+  this.width = opts.width
+  this.wrap = opts.wrap
+  this.rows = []
+}
+
+UI.prototype.span = function () {
+  var cols = this.div.apply(this, arguments)
+  cols.span = true
+}
+
+UI.prototype.div = function () {
+  if (arguments.length === 0) this.div('')
+  if (this.wrap && this._shouldApplyLayoutDSL.apply(this, arguments)) {
+    return this._applyLayoutDSL(arguments[0])
+  }
+
+  var cols = []
+
+  for (var i = 0, arg; (arg = arguments[i]) !== undefined; i++) {
+    if (typeof arg === 'string') cols.push(this._colFromString(arg))
+    else cols.push(arg)
+  }
+
+  this.rows.push(cols)
+  return cols
+}
+
+UI.prototype._shouldApplyLayoutDSL = function () {
+  return arguments.length === 1 && typeof arguments[0] === 'string' &&
+    /[\t\n]/.test(arguments[0])
+}
+
+UI.prototype._applyLayoutDSL = function (str) {
+  var _this = this
+  var rows = str.split('\n')
+  var leftColumnWidth = 0
+
+  // simple heuristic for layout, make sure the
+  // second column lines up along the left-hand.
+  // don't allow the first column to take up more
+  // than 50% of the screen.
+  rows.forEach(function (row) {
+    var columns = row.split('\t')
+    if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
+      leftColumnWidth = Math.min(
+        Math.floor(_this.width * 0.5),
+        stringWidth(columns[0])
+      )
+    }
+  })
+
+  // generate a table:
+  //  replacing ' ' with padding calculations.
+  //  using the algorithmically generated width.
+  rows.forEach(function (row) {
+    var columns = row.split('\t')
+    _this.div.apply(_this, columns.map(function (r, i) {
+      return {
+        text: r.trim(),
+        padding: _this._measurePadding(r),
+        width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
+      }
+    }))
+  })
+
+  return this.rows[this.rows.length - 1]
+}
+
+UI.prototype._colFromString = function (str) {
+  return {
+    text: str,
+    padding: this._measurePadding(str)
+  }
+}
+
+UI.prototype._measurePadding = function (str) {
+  // measure padding without ansi escape codes
+  var noAnsi = stripAnsi(str)
+  return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
+}
+
+UI.prototype.toString = function () {
+  var _this = this
+  var lines = []
+
+  _this.rows.forEach(function (row, i) {
+    _this.rowToString(row, lines)
+  })
+
+  // don't display any lines with the
+  // hidden flag set.
+  lines = lines.filter(function (line) {
+    return !line.hidden
+  })
+
+  return lines.map(function (line) {
+    return line.text
+  }).join('\n')
+}
+
+UI.prototype.rowToString = function (row, lines) {
+  var _this = this
+  var padding
+  var rrows = this._rasterize(row)
+  var str = ''
+  var ts
+  var width
+  var wrapWidth
+
+  rrows.forEach(function (rrow, r) {
+    str = ''
+    rrow.forEach(function (col, c) {
+      ts = '' // temporary string used during alignment/padding.
+      width = row[c].width // the width with padding.
+      wrapWidth = _this._negatePadding(row[c]) // the width without padding.
+
+      ts += col
+
+      for (var i = 0; i < wrapWidth - stringWidth(col); i++) {
+        ts += ' '
+      }
+
+      // align the string within its column.
+      if (row[c].align && row[c].align !== 'left' && _this.wrap) {
+        ts = align[row[c].align](ts, wrapWidth)
+        if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ')
+      }
+
+      // apply border and padding to string.
+      padding = row[c].padding || [0, 0, 0, 0]
+      if (padding[left]) str += new Array(padding[left] + 1).join(' ')
+      str += addBorder(row[c], ts, '| ')
+      str += ts
+      str += addBorder(row[c], ts, ' |')
+      if (padding[right]) str += new Array(padding[right] + 1).join(' ')
+
+      // if prior row is span, try to render the
+      // current row on the prior line.
+      if (r === 0 && lines.length > 0) {
+        str = _this._renderInline(str, lines[lines.length - 1])
+      }
+    })
+
+    // remove trailing whitespace.
+    lines.push({
+      text: str.replace(/ +$/, ''),
+      span: row.span
+    })
+  })
+
+  return lines
+}
+
+function addBorder (col, ts, style) {
+  if (col.border) {
+    if (/[.']-+[.']/.test(ts)) return ''
+    else if (ts.trim().length) return style
+    else return '  '
+  }
+  return ''
+}
+
+// if the full 'source' can render in
+// the target line, do so.
+UI.prototype._renderInline = function (source, previousLine) {
+  var leadingWhitespace = source.match(/^ */)[0].length
+  var target = previousLine.text
+  var targetTextWidth = stringWidth(target.trimRight())
+
+  if (!previousLine.span) return source
+
+  // if we're not applying wrapping logic,
+  // just always append to the span.
+  if (!this.wrap) {
+    previousLine.hidden = true
+    return target + source
+  }
+
+  if (leadingWhitespace < targetTextWidth) return source
+
+  previousLine.hidden = true
+
+  return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft()
+}
+
+UI.prototype._rasterize = function (row) {
+  var _this = this
+  var i
+  var rrow
+  var rrows = []
+  var widths = this._columnWidths(row)
+  var wrapped
+
+  // word wrap all columns, and create
+  // a data-structure that is easy to rasterize.
+  row.forEach(function (col, c) {
+    // leave room for left and right padding.
+    col.width = widths[c]
+    if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), {hard: true}).split('\n')
+    else wrapped = col.text.split('\n')
+
+    if (col.border) {
+      wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.')
+      wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'")
+    }
+
+    // add top and bottom padding.
+    if (col.padding) {
+      for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
+      for (i = 0; i < (col.padding[bottom] || 0); i++) wrapped.push('')
+    }
+
+    wrapped.forEach(function (str, r) {
+      if (!rrows[r]) rrows.push([])
+
+      rrow = rrows[r]
+
+      for (var i = 0; i < c; i++) {
+        if (rrow[i] === undefined) rrow.push('')
+      }
+      rrow.push(str)
+    })
+  })
+
+  return rrows
+}
+
+UI.prototype._negatePadding = function (col) {
+  var wrapWidth = col.width
+  if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
+  if (col.border) wrapWidth -= 4
+  return wrapWidth
+}
+
+UI.prototype._columnWidths = function (row) {
+  var _this = this
+  var widths = []
+  var unset = row.length
+  var unsetWidth
+  var remainingWidth = this.width
+
+  // column widths can be set in config.
+  row.forEach(function (col, i) {
+    if (col.width) {
+      unset--
+      widths[i] = col.width
+      remainingWidth -= col.width
+    } else {
+      widths[i] = undefined
+    }
+  })
+
+  // any unset widths should be calculated.
+  if (unset) unsetWidth = Math.floor(remainingWidth / unset)
+  widths.forEach(function (w, i) {
+    if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text)
+    else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i]))
+  })
+
+  return widths
+}
+
+// calculates the minimum width of
+// a column, based on padding preferences.
+function _minWidth (col) {
+  var padding = col.padding || []
+  var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
+  if (col.border) minWidth += 4
+  return minWidth
+}
+
+function alignRight (str, width) {
+  str = str.trim()
+  var padding = ''
+  var strWidth = stringWidth(str)
+
+  if (strWidth < width) {
+    padding = new Array(width - strWidth + 1).join(' ')
+  }
+
+  return padding + str
+}
+
+function alignCenter (str, width) {
+  str = str.trim()
+  var padding = ''
+  var strWidth = stringWidth(str.trim())
+
+  if (strWidth < width) {
+    padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ')
+  }
+
+  return padding + str
+}
+
+module.exports = function (opts) {
+  opts = opts || {}
+
+  return new UI({
+    width: (opts || {}).width || 80,
+    wrap: typeof opts.wrap === 'boolean' ? opts.wrap : true
+  })
+}
diff --git a/legacy-libs/grpc/node_modules/cliui/package.json b/legacy-libs/grpc/node_modules/cliui/package.json
new file mode 100644 (file)
index 0000000..2f6f7dd
--- /dev/null
@@ -0,0 +1,131 @@
+{
+  "_args": [
+    [
+      {
+        "raw": "cliui@^3.0.3",
+        "scope": null,
+        "escapedName": "cliui",
+        "name": "cliui",
+        "rawSpec": "^3.0.3",
+        "spec": ">=3.0.3 <4.0.0",
+        "type": "range"
+      },
+      "/var/opt/motion2/node_modules/grpc/node_modules/yargs"
+    ]
+  ],
+  "_from": "cliui@>=3.0.3 <4.0.0",
+  "_id": "cliui@3.2.0",
+  "_inCache": true,
+  "_location": "/grpc/cliui",
+  "_nodeVersion": "5.1.0",
+  "_npmOperationalInternal": {
+    "host": "packages-12-west.internal.npmjs.com",
+    "tmp": "tmp/cliui-3.2.0.tgz_1460342854008_0.8861493801232427"
+  },
+  "_npmUser": {
+    "name": "bcoe",
+    "email": "ben@npmjs.com"
+  },
+  "_npmVersion": "3.3.12",
+  "_phantomChildren": {},
+  "_requested": {
+    "raw": "cliui@^3.0.3",
+    "scope": null,
+    "escapedName": "cliui",
+    "name": "cliui",
+    "rawSpec": "^3.0.3",
+    "spec": ">=3.0.3 <4.0.0",
+    "type": "range"
+  },
+  "_requiredBy": [
+    "/grpc/yargs"
+  ],
+  "_resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
+  "_shasum": "120601537a916d29940f934da3b48d585a39213d",
+  "_shrinkwrap": null,
+  "_spec": "cliui@^3.0.3",
+  "_where": "/var/opt/motion2/node_modules/grpc/node_modules/yargs",
+  "author": {
+    "name": "Ben Coe",
+    "email": "ben@npmjs.com"
+  },
+  "bugs": {
+    "url": "https://github.com/yargs/cliui/issues"
+  },
+  "config": {
+    "blanket": {
+      "pattern": [
+        "index.js"
+      ],
+      "data-cover-never": [
+        "node_modules",
+        "test"
+      ],
+      "output-reporter": "spec"
+    }
+  },
+  "dependencies": {
+    "string-width": "^1.0.1",
+    "strip-ansi": "^3.0.1",
+    "wrap-ansi": "^2.0.0"
+  },
+  "description": "easily create complex multi-column command-line-interfaces",
+  "devDependencies": {
+    "chai": "^3.5.0",
+    "chalk": "^1.1.2",
+    "coveralls": "^2.11.8",
+    "mocha": "^2.4.5",
+    "nyc": "^6.4.0",
+    "standard": "^6.0.8",
+    "standard-version": "^2.1.2"
+  },
+  "directories": {},
+  "dist": {
+    "shasum": "120601537a916d29940f934da3b48d585a39213d",
+    "tarball": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz"
+  },
+  "files": [
+    "index.js"
+  ],
+  "gitHead": "75d62e9dfa77a0e0a9c3ac3b96b02baa294142ce",
+  "homepage": "https://github.com/yargs/cliui#readme",
+  "keywords": [
+    "cli",
+    "command-line",
+    "layout",
+    "design",
+    "console",
+    "wrap",
+    "table"
+  ],
+  "license": "ISC",
+  "main": "index.js",
+  "maintainers": [
+    {
+      "name": "bcoe",
+      "email": "ben@npmjs.com"
+    }
+  ],
+  "name": "cliui",
+  "optionalDependencies": {},
+  "readme": "ERROR: No README data found!",
+  "repository": {
+    "type": "git",
+    "url": "git+ssh://git@github.com/yargs/cliui.git"
+  },
+  "scripts": {
+    "coverage": "nyc --reporter=text-lcov mocha | coveralls",
+    "pretest": "standard",
+    "test": "nyc mocha",
+    "version": "standard-version"
+  },
+  "standard": {
+    "ignore": [
+      "**/example/**"
+    ],
+    "globals": [
+      "it"
+    ]
+  },
+  "version": "3.2.0"
+}
diff --git a/legacy-libs/grpc/node_modules/code-point-at/index.js b/legacy-libs/grpc/node_modules/code-point-at/index.js
deleted file mode 100644 (file)
index 0432fe6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* eslint-disable babel/new-cap, xo/throw-new-error */
-'use strict';
-module.exports = function (str, pos) {
-       if (str === null || str === undefined) {
-               throw TypeError();
-       }
-
-       str = String(str);
-
-       var size = str.length;
-       var i = pos ? Number(pos) : 0;
-
-       if (Number.isNaN(i)) {
-               i = 0;
-       }
-
-       if (i < 0 || i >= size) {
-               return undefined;
-       }
-
-       var first = str.charCodeAt(i);
-
-       if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
-               var second = str.charCodeAt(i + 1);
-
-               if (second >= 0xDC00 && second <= 0xDFFF) {
-                       return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000;
-               }
-       }
-
-       return first;
-};
diff --git a/legacy-libs/grpc/node_modules/code-point-at/license b/legacy-libs/grpc/node_modules/code-point-at/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/code-point-at/package.json b/legacy-libs/grpc/node_modules/code-point-at/package.json
deleted file mode 100644 (file)
index 0d7150f..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "_args": [
-    [
-      "code-point-at@1.1.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "code-point-at@1.1.0",
-  "_id": "code-point-at@1.1.0",
-  "_inBundle": false,
-  "_integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
-  "_location": "/grpc/code-point-at",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "code-point-at@1.1.0",
-    "name": "code-point-at",
-    "escapedName": "code-point-at",
-    "rawSpec": "1.1.0",
-    "saveSpec": null,
-    "fetchSpec": "1.1.0"
-  },
-  "_requiredBy": [
-    "/grpc/string-width"
-  ],
-  "_resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/code-point-at/issues"
-  },
-  "dependencies": {},
-  "description": "ES2015 `String#codePointAt()` ponyfill",
-  "devDependencies": {
-    "ava": "*",
-    "xo": "^0.16.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/code-point-at#readme",
-  "keywords": [
-    "es2015",
-    "ponyfill",
-    "polyfill",
-    "shim",
-    "string",
-    "str",
-    "code",
-    "point",
-    "at",
-    "codepoint",
-    "unicode"
-  ],
-  "license": "MIT",
-  "name": "code-point-at",
-  "optionalDependencies": {},
-  "readme": "# code-point-at [![Build Status](https://travis-ci.org/sindresorhus/code-point-at.svg?branch=master)](https://travis-ci.org/sindresorhus/code-point-at)\n\n> ES2015 [`String#codePointAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save code-point-at\n```\n\n\n## Usage\n\n```js\nvar codePointAt = require('code-point-at');\n\ncodePointAt('🐴');\n//=> 128052\n\ncodePointAt('abc', 2);\n//=> 99\n```\n\n## API\n\n### codePointAt(input, [position])\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/code-point-at.git"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "version": "1.1.0"
-}
diff --git a/legacy-libs/grpc/node_modules/code-point-at/readme.md b/legacy-libs/grpc/node_modules/code-point-at/readme.md
deleted file mode 100644 (file)
index 4c97730..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# code-point-at [![Build Status](https://travis-ci.org/sindresorhus/code-point-at.svg?branch=master)](https://travis-ci.org/sindresorhus/code-point-at)
-
-> ES2015 [`String#codePointAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) [ponyfill](https://ponyfill.com)
-
-
-## Install
-
-```
-$ npm install --save code-point-at
-```
-
-
-## Usage
-
-```js
-var codePointAt = require('code-point-at');
-
-codePointAt('🐴');
-//=> 128052
-
-codePointAt('abc', 2);
-//=> 99
-```
-
-## API
-
-### codePointAt(input, [position])
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/concat-map/LICENSE b/legacy-libs/grpc/node_modules/concat-map/LICENSE
deleted file mode 100644 (file)
index ee27ba4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/concat-map/README.markdown b/legacy-libs/grpc/node_modules/concat-map/README.markdown
deleted file mode 100644 (file)
index 408f70a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-concat-map
-==========
-
-Concatenative mapdashery.
-
-[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map)
-
-[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map)
-
-example
-=======
-
-``` js
-var concatMap = require('concat-map');
-var xs = [ 1, 2, 3, 4, 5, 6 ];
-var ys = concatMap(xs, function (x) {
-    return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
-});
-console.dir(ys);
-```
-
-***
-
-```
-[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
-```
-
-methods
-=======
-
-``` js
-var concatMap = require('concat-map')
-```
-
-concatMap(xs, fn)
------------------
-
-Return an array of concatenated elements by calling `fn(x, i)` for each element
-`x` and each index `i` in the array `xs`.
-
-When `fn(x, i)` returns an array, its result will be concatenated with the
-result array. If `fn(x, i)` returns anything else, that value will be pushed
-onto the end of the result array.
-
-install
-=======
-
-With [npm](http://npmjs.org) do:
-
-```
-npm install concat-map
-```
-
-license
-=======
-
-MIT
-
-notes
-=====
-
-This module was written while sitting high above the ground in a tree.
diff --git a/legacy-libs/grpc/node_modules/concat-map/example/map.js b/legacy-libs/grpc/node_modules/concat-map/example/map.js
deleted file mode 100644 (file)
index 3365621..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-var concatMap = require('../');
-var xs = [ 1, 2, 3, 4, 5, 6 ];
-var ys = concatMap(xs, function (x) {
-    return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
-});
-console.dir(ys);
diff --git a/legacy-libs/grpc/node_modules/concat-map/index.js b/legacy-libs/grpc/node_modules/concat-map/index.js
deleted file mode 100644 (file)
index b29a781..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-module.exports = function (xs, fn) {
-    var res = [];
-    for (var i = 0; i < xs.length; i++) {
-        var x = fn(xs[i], i);
-        if (isArray(x)) res.push.apply(res, x);
-        else res.push(x);
-    }
-    return res;
-};
-
-var isArray = Array.isArray || function (xs) {
-    return Object.prototype.toString.call(xs) === '[object Array]';
-};
diff --git a/legacy-libs/grpc/node_modules/concat-map/package.json b/legacy-libs/grpc/node_modules/concat-map/package.json
deleted file mode 100644 (file)
index 5601b9f..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-{
-  "_args": [
-    [
-      "concat-map@0.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "concat-map@0.0.1",
-  "_id": "concat-map@0.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
-  "_location": "/grpc/concat-map",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "concat-map@0.0.1",
-    "name": "concat-map",
-    "escapedName": "concat-map",
-    "rawSpec": "0.0.1",
-    "saveSpec": null,
-    "fetchSpec": "0.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/brace-expansion"
-  ],
-  "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "0.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "James Halliday",
-    "email": "mail@substack.net",
-    "url": "http://substack.net"
-  },
-  "bugs": {
-    "url": "https://github.com/substack/node-concat-map/issues"
-  },
-  "dependencies": {},
-  "description": "concatenative mapdashery",
-  "devDependencies": {
-    "tape": "~2.4.0"
-  },
-  "directories": {
-    "example": "example",
-    "test": "test"
-  },
-  "homepage": "https://github.com/substack/node-concat-map#readme",
-  "keywords": [
-    "concat",
-    "concatMap",
-    "map",
-    "functional",
-    "higher-order"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "concat-map",
-  "optionalDependencies": {},
-  "readme": "concat-map\n==========\n\nConcatenative mapdashery.\n\n[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map)\n\n[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map)\n\nexample\n=======\n\n``` js\nvar concatMap = require('concat-map');\nvar xs = [ 1, 2, 3, 4, 5, 6 ];\nvar ys = concatMap(xs, function (x) {\n    return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];\n});\nconsole.dir(ys);\n```\n\n***\n\n```\n[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]\n```\n\nmethods\n=======\n\n``` js\nvar concatMap = require('concat-map')\n```\n\nconcatMap(xs, fn)\n-----------------\n\nReturn an array of concatenated elements by calling `fn(x, i)` for each element\n`x` and each index `i` in the array `xs`.\n\nWhen `fn(x, i)` returns an array, its result will be concatenated with the\nresult array. If `fn(x, i)` returns anything else, that value will be pushed\nonto the end of the result array.\n\ninstall\n=======\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install concat-map\n```\n\nlicense\n=======\n\nMIT\n\nnotes\n=====\n\nThis module was written while sitting high above the ground in a tree.\n",
-  "readmeFilename": "README.markdown",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/substack/node-concat-map.git"
-  },
-  "scripts": {
-    "test": "tape test/*.js"
-  },
-  "testling": {
-    "files": "test/*.js",
-    "browsers": {
-      "ie": [
-        6,
-        7,
-        8,
-        9
-      ],
-      "ff": [
-        3.5,
-        10,
-        15
-      ],
-      "chrome": [
-        10,
-        22
-      ],
-      "safari": [
-        5.1
-      ],
-      "opera": [
-        12
-      ]
-    }
-  },
-  "version": "0.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/concat-map/test/map.js b/legacy-libs/grpc/node_modules/concat-map/test/map.js
deleted file mode 100644 (file)
index fdbd702..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-var concatMap = require('../');
-var test = require('tape');
-
-test('empty or not', function (t) {
-    var xs = [ 1, 2, 3, 4, 5, 6 ];
-    var ixes = [];
-    var ys = concatMap(xs, function (x, ix) {
-        ixes.push(ix);
-        return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
-    });
-    t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
-    t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
-    t.end();
-});
-
-test('always something', function (t) {
-    var xs = [ 'a', 'b', 'c', 'd' ];
-    var ys = concatMap(xs, function (x) {
-        return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
-    });
-    t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
-    t.end();
-});
-
-test('scalars', function (t) {
-    var xs = [ 'a', 'b', 'c', 'd' ];
-    var ys = concatMap(xs, function (x) {
-        return x === 'b' ? [ 'B', 'B', 'B' ] : x;
-    });
-    t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
-    t.end();
-});
-
-test('undefs', function (t) {
-    var xs = [ 'a', 'b', 'c', 'd' ];
-    var ys = concatMap(xs, function () {});
-    t.same(ys, [ undefined, undefined, undefined, undefined ]);
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/console-control-strings/LICENSE b/legacy-libs/grpc/node_modules/console-control-strings/LICENSE
deleted file mode 100644 (file)
index e756052..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2014, Rebecca Turner <me@re-becca.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/console-control-strings/README.md b/legacy-libs/grpc/node_modules/console-control-strings/README.md
deleted file mode 100644 (file)
index f58cc8d..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-# Console Control Strings
-
-A library of cross-platform tested terminal/console command strings for
-doing things like color and cursor positioning.  This is a subset of both
-ansi and vt100.  All control codes included work on both Windows & Unix-like
-OSes, except where noted.
-
-## Usage
-
-```js
-var consoleControl = require('console-control-strings')
-
-console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))
-process.stdout.write(consoleControl.goto(75, 10))
-```
-
-## Why Another?
-
-There are tons of libraries similar to this one.  I wanted one that was:
-
-1. Very clear about compatibility goals.
-2. Could emit, for instance, a start color code without an end one.
-3. Returned strings w/o writing to streams.
-4. Was not weighed down with other unrelated baggage.
-
-## Functions
-
-### var code = consoleControl.up(_num = 1_)
-
-Returns the escape sequence to move _num_ lines up.
-
-### var code = consoleControl.down(_num = 1_)
-
-Returns the escape sequence to move _num_ lines down.
-
-### var code = consoleControl.forward(_num = 1_)
-
-Returns the escape sequence to move _num_ lines righ.
-
-### var code = consoleControl.back(_num = 1_)
-
-Returns the escape sequence to move _num_ lines left.
-
-### var code = consoleControl.nextLine(_num = 1_)
-
-Returns the escape sequence to move _num_ lines down and to the beginning of
-the line.
-
-### var code = consoleControl.previousLine(_num = 1_)
-
-Returns the escape sequence to move _num_ lines up and to the beginning of
-the line.
-
-### var code = consoleControl.eraseData()
-
-Returns the escape sequence to erase everything from the current cursor
-position to the bottom right of the screen.  This is line based, so it
-erases the remainder of the current line and all following lines.
-
-### var code = consoleControl.eraseLine()
-
-Returns the escape sequence to erase to the end of the current line.
-
-### var code = consoleControl.goto(_x_, _y_)
-
-Returns the escape sequence to move the cursor to the designated position. 
-Note that the origin is _1, 1_ not _0, 0_.
-
-### var code = consoleControl.gotoSOL()
-
-Returns the escape sequence to move the cursor to the beginning of the
-current line. (That is, it returns a carriage return, `\r`.)
-
-### var code = consoleControl.beep()
-
-Returns the escape sequence to cause the termianl to beep.  (That is, it
-returns unicode character `\x0007`, a Control-G.)
-
-### var code = consoleControl.hideCursor()
-
-Returns the escape sequence to hide the cursor.
-
-### var code = consoleControl.showCursor()
-
-Returns the escape sequence to show the cursor.
-
-### var code = consoleControl.color(_colors = []_)
-
-### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_)
-
-Returns the escape sequence to set the current terminal display attributes
-(mostly colors).  Arguments can either be a list of attributes or an array
-of attributes.  The difference between passing in an array or list of colors
-and calling `.color` separately for each one, is that in the former case a
-single escape sequence will be produced where as in the latter each change
-will have its own distinct escape sequence.  Each attribute can be one of:
-
-* Reset:
-  * **reset** – Reset all attributes to the terminal default.
-* Styles:
-  * **bold** – Display text as bold.  In some terminals this means using a
-    bold font, in others this means changing the color.  In some it means
-    both.
-  * **italic** – Display text as italic. This is not available in most Windows terminals.
-  * **underline** – Underline text. This is not available in most Windows Terminals.
-  * **inverse** – Invert the foreground and background colors.
-  * **stopBold** – Do not display text as bold.
-  * **stopItalic** – Do not display text as italic.
-  * **stopUnderline** – Do not underline text.
-  * **stopInverse** – Do not invert foreground and background.
-* Colors:
-  * **white**
-  * **black**
-  * **blue**
-  * **cyan**
-  * **green**
-  * **magenta**
-  * **red**
-  * **yellow**
-  * **grey** / **brightBlack**
-  * **brightRed**
-  * **brightGreen**
-  * **brightYellow**
-  * **brightBlue**
-  * **brightMagenta**
-  * **brightCyan**
-  * **brightWhite**
-* Background Colors:
-  * **bgWhite**
-  * **bgBlack**
-  * **bgBlue**
-  * **bgCyan**
-  * **bgGreen**
-  * **bgMagenta**
-  * **bgRed**
-  * **bgYellow**
-  * **bgGrey** / **bgBrightBlack**
-  * **bgBrightRed**
-  * **bgBrightGreen**
-  * **bgBrightYellow**
-  * **bgBrightBlue**
-  * **bgBrightMagenta**
-  * **bgBrightCyan**
-  * **bgBrightWhite**
-
diff --git a/legacy-libs/grpc/node_modules/console-control-strings/README.md~ b/legacy-libs/grpc/node_modules/console-control-strings/README.md~
deleted file mode 100644 (file)
index 6eb34e8..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-# Console Control Strings
-
-A library of cross-platform tested terminal/console command strings for
-doing things like color and cursor positioning.  This is a subset of both
-ansi and vt100.  All control codes included work on both Windows & Unix-like
-OSes, except where noted.
-
-## Usage
-
-```js
-var consoleControl = require('console-control-strings')
-
-console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))
-process.stdout.write(consoleControl.goto(75, 10))
-```
-
-## Why Another?
-
-There are tons of libraries similar to this one.  I wanted one that was:
-
-1. Very clear about compatibility goals.
-2. Could emit, for instance, a start color code without an end one.
-3. Returned strings w/o writing to streams.
-4. Was not weighed down with other unrelated baggage.
-
-## Functions
-
-### var code = consoleControl.up(_num = 1_)
-
-Returns the escape sequence to move _num_ lines up.
-
-### var code = consoleControl.down(_num = 1_)
-
-Returns the escape sequence to move _num_ lines down.
-
-### var code = consoleControl.forward(_num = 1_)
-
-Returns the escape sequence to move _num_ lines righ.
-
-### var code = consoleControl.back(_num = 1_)
-
-Returns the escape sequence to move _num_ lines left.
-
-### var code = consoleControl.nextLine(_num = 1_)
-
-Returns the escape sequence to move _num_ lines down and to the beginning of
-the line.
-
-### var code = consoleControl.previousLine(_num = 1_)
-
-Returns the escape sequence to move _num_ lines up and to the beginning of
-the line.
-
-### var code = consoleControl.eraseData()
-
-Returns the escape sequence to erase everything from the current cursor
-position to the bottom right of the screen.  This is line based, so it
-erases the remainder of the current line and all following lines.
-
-### var code = consoleControl.eraseLine()
-
-Returns the escape sequence to erase to the end of the current line.
-
-### var code = consoleControl.goto(_x_, _y_)
-
-Returns the escape sequence to move the cursor to the designated position. 
-Note that the origin is _1, 1_ not _0, 0_.
-
-### var code = consoleControl.gotoSOL()
-
-Returns the escape sequence to move the cursor to the beginning of the
-current line. (That is, it returns a carriage return, `\r`.)
-
-### var code = consoleControl.hideCursor()
-
-Returns the escape sequence to hide the cursor.
-
-### var code = consoleControl.showCursor()
-
-Returns the escape sequence to show the cursor.
-
-### var code = consoleControl.color(_colors = []_)
-
-### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_)
-
-Returns the escape sequence to set the current terminal display attributes
-(mostly colors).  Arguments can either be a list of attributes or an array
-of attributes.  The difference between passing in an array or list of colors
-and calling `.color` separately for each one, is that in the former case a
-single escape sequence will be produced where as in the latter each change
-will have its own distinct escape sequence.  Each attribute can be one of:
-
-* Reset:
-  * **reset** – Reset all attributes to the terminal default.
-* Styles:
-  * **bold** – Display text as bold.  In some terminals this means using a
-    bold font, in others this means changing the color.  In some it means
-    both.
-  * **italic** – Display text as italic. This is not available in most Windows terminals.
-  * **underline** – Underline text. This is not available in most Windows Terminals.
-  * **inverse** – Invert the foreground and background colors.
-  * **stopBold** – Do not display text as bold.
-  * **stopItalic** – Do not display text as italic.
-  * **stopUnderline** – Do not underline text.
-  * **stopInverse** – Do not invert foreground and background.
-* Colors:
-  * **white**
-  * **black**
-  * **blue**
-  * **cyan**
-  * **green**
-  * **magenta**
-  * **red**
-  * **yellow**
-  * **grey** / **brightBlack**
-  * **brightRed**
-  * **brightGreen**
-  * **brightYellow**
-  * **brightBlue**
-  * **brightMagenta**
-  * **brightCyan**
-  * **brightWhite**
-* Background Colors:
-  * **bgWhite**
-  * **bgBlack**
-  * **bgBlue**
-  * **bgCyan**
-  * **bgGreen**
-  * **bgMagenta**
-  * **bgRed**
-  * **bgYellow**
-  * **bgGrey** / **bgBrightBlack**
-  * **bgBrightRed**
-  * **bgBrightGreen**
-  * **bgBrightYellow**
-  * **bgBrightBlue**
-  * **bgBrightMagenta**
-  * **bgBrightCyan**
-  * **bgBrightWhite**
-
diff --git a/legacy-libs/grpc/node_modules/console-control-strings/index.js b/legacy-libs/grpc/node_modules/console-control-strings/index.js
deleted file mode 100644 (file)
index bf89034..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-'use strict'
-
-// These tables borrowed from `ansi`
-
-var prefix = '\x1b['
-
-exports.up = function up (num) {
-  return prefix + (num || '') + 'A'
-}
-
-exports.down = function down (num) {
-  return prefix + (num || '') + 'B'
-}
-
-exports.forward = function forward (num) {
-  return prefix + (num || '') + 'C'
-}
-
-exports.back = function back (num) {
-  return prefix + (num || '') + 'D'
-}
-
-exports.nextLine = function nextLine (num) {
-  return prefix + (num || '') + 'E'
-}
-
-exports.previousLine = function previousLine (num) {
-  return prefix + (num || '') + 'F'
-}
-
-exports.horizontalAbsolute = function horizontalAbsolute (num) {
-  if (num == null) throw new Error('horizontalAboslute requires a column to position to')
-  return prefix + num + 'G'
-}
-
-exports.eraseData = function eraseData () {
-  return prefix + 'J'
-}
-
-exports.eraseLine = function eraseLine () {
-  return prefix + 'K'
-}
-
-exports.goto = function (x, y) {
-  return prefix + y + ';' + x + 'H'
-}
-
-exports.gotoSOL = function () {
-  return '\r'
-}
-
-exports.beep = function () {
-  return '\x07'
-}
-
-exports.hideCursor = function hideCursor () {
-  return prefix + '?25l'
-}
-
-exports.showCursor = function showCursor () {
-  return prefix + '?25h'
-}
-
-var colors = {
-  reset: 0,
-// styles
-  bold: 1,
-  italic: 3,
-  underline: 4,
-  inverse: 7,
-// resets
-  stopBold: 22,
-  stopItalic: 23,
-  stopUnderline: 24,
-  stopInverse: 27,
-// colors
-  white: 37,
-  black: 30,
-  blue: 34,
-  cyan: 36,
-  green: 32,
-  magenta: 35,
-  red: 31,
-  yellow: 33,
-  bgWhite: 47,
-  bgBlack: 40,
-  bgBlue: 44,
-  bgCyan: 46,
-  bgGreen: 42,
-  bgMagenta: 45,
-  bgRed: 41,
-  bgYellow: 43,
-
-  grey: 90,
-  brightBlack: 90,
-  brightRed: 91,
-  brightGreen: 92,
-  brightYellow: 93,
-  brightBlue: 94,
-  brightMagenta: 95,
-  brightCyan: 96,
-  brightWhite: 97,
-
-  bgGrey: 100,
-  bgBrightBlack: 100,
-  bgBrightRed: 101,
-  bgBrightGreen: 102,
-  bgBrightYellow: 103,
-  bgBrightBlue: 104,
-  bgBrightMagenta: 105,
-  bgBrightCyan: 106,
-  bgBrightWhite: 107
-}
-
-exports.color = function color (colorWith) {
-  if (arguments.length !== 1 || !Array.isArray(colorWith)) {
-    colorWith = Array.prototype.slice.call(arguments)
-  }
-  return prefix + colorWith.map(colorNameToCode).join(';') + 'm'
-}
-
-function colorNameToCode (color) {
-  if (colors[color] != null) return colors[color]
-  throw new Error('Unknown color or style name: ' + color)
-}
diff --git a/legacy-libs/grpc/node_modules/console-control-strings/package.json b/legacy-libs/grpc/node_modules/console-control-strings/package.json
deleted file mode 100644 (file)
index 85dd604..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-{
-  "_args": [
-    [
-      "console-control-strings@1.1.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "console-control-strings@1.1.0",
-  "_id": "console-control-strings@1.1.0",
-  "_inBundle": false,
-  "_integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
-  "_location": "/grpc/console-control-strings",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "console-control-strings@1.1.0",
-    "name": "console-control-strings",
-    "escapedName": "console-control-strings",
-    "rawSpec": "1.1.0",
-    "saveSpec": null,
-    "fetchSpec": "1.1.0"
-  },
-  "_requiredBy": [
-    "/grpc/gauge",
-    "/grpc/npmlog"
-  ],
-  "_resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Rebecca Turner",
-    "email": "me@re-becca.org",
-    "url": "http://re-becca.org/"
-  },
-  "bugs": {
-    "url": "https://github.com/iarna/console-control-strings/issues"
-  },
-  "dependencies": {},
-  "description": "A library of cross-platform tested terminal/console command strings for doing things like color and cursor positioning.  This is a subset of both ansi and vt100.  All control codes included work on both Windows & Unix-like OSes, except where noted.",
-  "devDependencies": {
-    "standard": "^7.1.2",
-    "tap": "^5.7.2"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "LICENSE",
-    "index.js"
-  ],
-  "homepage": "https://github.com/iarna/console-control-strings#readme",
-  "keywords": [],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "console-control-strings",
-  "optionalDependencies": {},
-  "readme": "# Console Control Strings\n\nA library of cross-platform tested terminal/console command strings for\ndoing things like color and cursor positioning.  This is a subset of both\nansi and vt100.  All control codes included work on both Windows & Unix-like\nOSes, except where noted.\n\n## Usage\n\n```js\nvar consoleControl = require('console-control-strings')\n\nconsole.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))\nprocess.stdout.write(consoleControl.goto(75, 10))\n```\n\n## Why Another?\n\nThere are tons of libraries similar to this one.  I wanted one that was:\n\n1. Very clear about compatibility goals.\n2. Could emit, for instance, a start color code without an end one.\n3. Returned strings w/o writing to streams.\n4. Was not weighed down with other unrelated baggage.\n\n## Functions\n\n### var code = consoleControl.up(_num = 1_)\n\nReturns the escape sequence to move _num_ lines up.\n\n### var code = consoleControl.down(_num = 1_)\n\nReturns the escape sequence to move _num_ lines down.\n\n### var code = consoleControl.forward(_num = 1_)\n\nReturns the escape sequence to move _num_ lines righ.\n\n### var code = consoleControl.back(_num = 1_)\n\nReturns the escape sequence to move _num_ lines left.\n\n### var code = consoleControl.nextLine(_num = 1_)\n\nReturns the escape sequence to move _num_ lines down and to the beginning of\nthe line.\n\n### var code = consoleControl.previousLine(_num = 1_)\n\nReturns the escape sequence to move _num_ lines up and to the beginning of\nthe line.\n\n### var code = consoleControl.eraseData()\n\nReturns the escape sequence to erase everything from the current cursor\nposition to the bottom right of the screen.  This is line based, so it\nerases the remainder of the current line and all following lines.\n\n### var code = consoleControl.eraseLine()\n\nReturns the escape sequence to erase to the end of the current line.\n\n### var code = consoleControl.goto(_x_, _y_)\n\nReturns the escape sequence to move the cursor to the designated position. \nNote that the origin is _1, 1_ not _0, 0_.\n\n### var code = consoleControl.gotoSOL()\n\nReturns the escape sequence to move the cursor to the beginning of the\ncurrent line. (That is, it returns a carriage return, `\\r`.)\n\n### var code = consoleControl.beep()\n\nReturns the escape sequence to cause the termianl to beep.  (That is, it\nreturns unicode character `\\x0007`, a Control-G.)\n\n### var code = consoleControl.hideCursor()\n\nReturns the escape sequence to hide the cursor.\n\n### var code = consoleControl.showCursor()\n\nReturns the escape sequence to show the cursor.\n\n### var code = consoleControl.color(_colors = []_)\n\n### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_)\n\nReturns the escape sequence to set the current terminal display attributes\n(mostly colors).  Arguments can either be a list of attributes or an array\nof attributes.  The difference between passing in an array or list of colors\nand calling `.color` separately for each one, is that in the former case a\nsingle escape sequence will be produced where as in the latter each change\nwill have its own distinct escape sequence.  Each attribute can be one of:\n\n* Reset:\n  * **reset** – Reset all attributes to the terminal default.\n* Styles:\n  * **bold** – Display text as bold.  In some terminals this means using a\n    bold font, in others this means changing the color.  In some it means\n    both.\n  * **italic** – Display text as italic. This is not available in most Windows terminals.\n  * **underline** – Underline text. This is not available in most Windows Terminals.\n  * **inverse** – Invert the foreground and background colors.\n  * **stopBold** – Do not display text as bold.\n  * **stopItalic** – Do not display text as italic.\n  * **stopUnderline** – Do not underline text.\n  * **stopInverse** – Do not invert foreground and background.\n* Colors:\n  * **white**\n  * **black**\n  * **blue**\n  * **cyan**\n  * **green**\n  * **magenta**\n  * **red**\n  * **yellow**\n  * **grey** / **brightBlack**\n  * **brightRed**\n  * **brightGreen**\n  * **brightYellow**\n  * **brightBlue**\n  * **brightMagenta**\n  * **brightCyan**\n  * **brightWhite**\n* Background Colors:\n  * **bgWhite**\n  * **bgBlack**\n  * **bgBlue**\n  * **bgCyan**\n  * **bgGreen**\n  * **bgMagenta**\n  * **bgRed**\n  * **bgYellow**\n  * **bgGrey** / **bgBrightBlack**\n  * **bgBrightRed**\n  * **bgBrightGreen**\n  * **bgBrightYellow**\n  * **bgBrightBlue**\n  * **bgBrightMagenta**\n  * **bgBrightCyan**\n  * **bgBrightWhite**\n\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/iarna/console-control-strings.git"
-  },
-  "scripts": {
-    "test": "standard && tap test/*.js"
-  },
-  "version": "1.1.0"
-}
diff --git a/legacy-libs/grpc/node_modules/core-util-is/LICENSE b/legacy-libs/grpc/node_modules/core-util-is/LICENSE
deleted file mode 100644 (file)
index d8d7f94..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright Node.js contributors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/core-util-is/README.md b/legacy-libs/grpc/node_modules/core-util-is/README.md
deleted file mode 100644 (file)
index 5a76b41..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# core-util-is
-
-The `util.is*` functions introduced in Node v0.12.
diff --git a/legacy-libs/grpc/node_modules/core-util-is/float.patch b/legacy-libs/grpc/node_modules/core-util-is/float.patch
deleted file mode 100644 (file)
index a06d5c0..0000000
+++ /dev/null
@@ -1,604 +0,0 @@
-diff --git a/lib/util.js b/lib/util.js
-index a03e874..9074e8e 100644
---- a/lib/util.js
-+++ b/lib/util.js
-@@ -19,430 +19,6 @@
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
-
--var formatRegExp = /%[sdj%]/g;
--exports.format = function(f) {
--  if (!isString(f)) {
--    var objects = [];
--    for (var i = 0; i < arguments.length; i++) {
--      objects.push(inspect(arguments[i]));
--    }
--    return objects.join(' ');
--  }
--
--  var i = 1;
--  var args = arguments;
--  var len = args.length;
--  var str = String(f).replace(formatRegExp, function(x) {
--    if (x === '%%') return '%';
--    if (i >= len) return x;
--    switch (x) {
--      case '%s': return String(args[i++]);
--      case '%d': return Number(args[i++]);
--      case '%j':
--        try {
--          return JSON.stringify(args[i++]);
--        } catch (_) {
--          return '[Circular]';
--        }
--      default:
--        return x;
--    }
--  });
--  for (var x = args[i]; i < len; x = args[++i]) {
--    if (isNull(x) || !isObject(x)) {
--      str += ' ' + x;
--    } else {
--      str += ' ' + inspect(x);
--    }
--  }
--  return str;
--};
--
--
--// Mark that a method should not be used.
--// Returns a modified function which warns once by default.
--// If --no-deprecation is set, then it is a no-op.
--exports.deprecate = function(fn, msg) {
--  // Allow for deprecating things in the process of starting up.
--  if (isUndefined(global.process)) {
--    return function() {
--      return exports.deprecate(fn, msg).apply(this, arguments);
--    };
--  }
--
--  if (process.noDeprecation === true) {
--    return fn;
--  }
--
--  var warned = false;
--  function deprecated() {
--    if (!warned) {
--      if (process.throwDeprecation) {
--        throw new Error(msg);
--      } else if (process.traceDeprecation) {
--        console.trace(msg);
--      } else {
--        console.error(msg);
--      }
--      warned = true;
--    }
--    return fn.apply(this, arguments);
--  }
--
--  return deprecated;
--};
--
--
--var debugs = {};
--var debugEnviron;
--exports.debuglog = function(set) {
--  if (isUndefined(debugEnviron))
--    debugEnviron = process.env.NODE_DEBUG || '';
--  set = set.toUpperCase();
--  if (!debugs[set]) {
--    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
--      var pid = process.pid;
--      debugs[set] = function() {
--        var msg = exports.format.apply(exports, arguments);
--        console.error('%s %d: %s', set, pid, msg);
--      };
--    } else {
--      debugs[set] = function() {};
--    }
--  }
--  return debugs[set];
--};
--
--
--/**
-- * Echos the value of a value. Trys to print the value out
-- * in the best way possible given the different types.
-- *
-- * @param {Object} obj The object to print out.
-- * @param {Object} opts Optional options object that alters the output.
-- */
--/* legacy: obj, showHidden, depth, colors*/
--function inspect(obj, opts) {
--  // default options
--  var ctx = {
--    seen: [],
--    stylize: stylizeNoColor
--  };
--  // legacy...
--  if (arguments.length >= 3) ctx.depth = arguments[2];
--  if (arguments.length >= 4) ctx.colors = arguments[3];
--  if (isBoolean(opts)) {
--    // legacy...
--    ctx.showHidden = opts;
--  } else if (opts) {
--    // got an "options" object
--    exports._extend(ctx, opts);
--  }
--  // set default options
--  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
--  if (isUndefined(ctx.depth)) ctx.depth = 2;
--  if (isUndefined(ctx.colors)) ctx.colors = false;
--  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
--  if (ctx.colors) ctx.stylize = stylizeWithColor;
--  return formatValue(ctx, obj, ctx.depth);
--}
--exports.inspect = inspect;
--
--
--// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
--inspect.colors = {
--  'bold' : [1, 22],
--  'italic' : [3, 23],
--  'underline' : [4, 24],
--  'inverse' : [7, 27],
--  'white' : [37, 39],
--  'grey' : [90, 39],
--  'black' : [30, 39],
--  'blue' : [34, 39],
--  'cyan' : [36, 39],
--  'green' : [32, 39],
--  'magenta' : [35, 39],
--  'red' : [31, 39],
--  'yellow' : [33, 39]
--};
--
--// Don't use 'blue' not visible on cmd.exe
--inspect.styles = {
--  'special': 'cyan',
--  'number': 'yellow',
--  'boolean': 'yellow',
--  'undefined': 'grey',
--  'null': 'bold',
--  'string': 'green',
--  'date': 'magenta',
--  // "name": intentionally not styling
--  'regexp': 'red'
--};
--
--
--function stylizeWithColor(str, styleType) {
--  var style = inspect.styles[styleType];
--
--  if (style) {
--    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
--           '\u001b[' + inspect.colors[style][1] + 'm';
--  } else {
--    return str;
--  }
--}
--
--
--function stylizeNoColor(str, styleType) {
--  return str;
--}
--
--
--function arrayToHash(array) {
--  var hash = {};
--
--  array.forEach(function(val, idx) {
--    hash[val] = true;
--  });
--
--  return hash;
--}
--
--
--function formatValue(ctx, value, recurseTimes) {
--  // Provide a hook for user-specified inspect functions.
--  // Check that value is an object with an inspect function on it
--  if (ctx.customInspect &&
--      value &&
--      isFunction(value.inspect) &&
--      // Filter out the util module, it's inspect function is special
--      value.inspect !== exports.inspect &&
--      // Also filter out any prototype objects using the circular check.
--      !(value.constructor && value.constructor.prototype === value)) {
--    var ret = value.inspect(recurseTimes, ctx);
--    if (!isString(ret)) {
--      ret = formatValue(ctx, ret, recurseTimes);
--    }
--    return ret;
--  }
--
--  // Primitive types cannot have properties
--  var primitive = formatPrimitive(ctx, value);
--  if (primitive) {
--    return primitive;
--  }
--
--  // Look up the keys of the object.
--  var keys = Object.keys(value);
--  var visibleKeys = arrayToHash(keys);
--
--  if (ctx.showHidden) {
--    keys = Object.getOwnPropertyNames(value);
--  }
--
--  // Some type of object without properties can be shortcutted.
--  if (keys.length === 0) {
--    if (isFunction(value)) {
--      var name = value.name ? ': ' + value.name : '';
--      return ctx.stylize('[Function' + name + ']', 'special');
--    }
--    if (isRegExp(value)) {
--      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
--    }
--    if (isDate(value)) {
--      return ctx.stylize(Date.prototype.toString.call(value), 'date');
--    }
--    if (isError(value)) {
--      return formatError(value);
--    }
--  }
--
--  var base = '', array = false, braces = ['{', '}'];
--
--  // Make Array say that they are Array
--  if (isArray(value)) {
--    array = true;
--    braces = ['[', ']'];
--  }
--
--  // Make functions say that they are functions
--  if (isFunction(value)) {
--    var n = value.name ? ': ' + value.name : '';
--    base = ' [Function' + n + ']';
--  }
--
--  // Make RegExps say that they are RegExps
--  if (isRegExp(value)) {
--    base = ' ' + RegExp.prototype.toString.call(value);
--  }
--
--  // Make dates with properties first say the date
--  if (isDate(value)) {
--    base = ' ' + Date.prototype.toUTCString.call(value);
--  }
--
--  // Make error with message first say the error
--  if (isError(value)) {
--    base = ' ' + formatError(value);
--  }
--
--  if (keys.length === 0 && (!array || value.length == 0)) {
--    return braces[0] + base + braces[1];
--  }
--
--  if (recurseTimes < 0) {
--    if (isRegExp(value)) {
--      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
--    } else {
--      return ctx.stylize('[Object]', 'special');
--    }
--  }
--
--  ctx.seen.push(value);
--
--  var output;
--  if (array) {
--    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
--  } else {
--    output = keys.map(function(key) {
--      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
--    });
--  }
--
--  ctx.seen.pop();
--
--  return reduceToSingleString(output, base, braces);
--}
--
--
--function formatPrimitive(ctx, value) {
--  if (isUndefined(value))
--    return ctx.stylize('undefined', 'undefined');
--  if (isString(value)) {
--    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
--                                             .replace(/'/g, "\\'")
--                                             .replace(/\\"/g, '"') + '\'';
--    return ctx.stylize(simple, 'string');
--  }
--  if (isNumber(value)) {
--    // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
--    // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
--    if (value === 0 && 1 / value < 0)
--      return ctx.stylize('-0', 'number');
--    return ctx.stylize('' + value, 'number');
--  }
--  if (isBoolean(value))
--    return ctx.stylize('' + value, 'boolean');
--  // For some reason typeof null is "object", so special case here.
--  if (isNull(value))
--    return ctx.stylize('null', 'null');
--}
--
--
--function formatError(value) {
--  return '[' + Error.prototype.toString.call(value) + ']';
--}
--
--
--function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
--  var output = [];
--  for (var i = 0, l = value.length; i < l; ++i) {
--    if (hasOwnProperty(value, String(i))) {
--      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
--          String(i), true));
--    } else {
--      output.push('');
--    }
--  }
--  keys.forEach(function(key) {
--    if (!key.match(/^\d+$/)) {
--      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
--          key, true));
--    }
--  });
--  return output;
--}
--
--
--function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
--  var name, str, desc;
--  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
--  if (desc.get) {
--    if (desc.set) {
--      str = ctx.stylize('[Getter/Setter]', 'special');
--    } else {
--      str = ctx.stylize('[Getter]', 'special');
--    }
--  } else {
--    if (desc.set) {
--      str = ctx.stylize('[Setter]', 'special');
--    }
--  }
--  if (!hasOwnProperty(visibleKeys, key)) {
--    name = '[' + key + ']';
--  }
--  if (!str) {
--    if (ctx.seen.indexOf(desc.value) < 0) {
--      if (isNull(recurseTimes)) {
--        str = formatValue(ctx, desc.value, null);
--      } else {
--        str = formatValue(ctx, desc.value, recurseTimes - 1);
--      }
--      if (str.indexOf('\n') > -1) {
--        if (array) {
--          str = str.split('\n').map(function(line) {
--            return '  ' + line;
--          }).join('\n').substr(2);
--        } else {
--          str = '\n' + str.split('\n').map(function(line) {
--            return '   ' + line;
--          }).join('\n');
--        }
--      }
--    } else {
--      str = ctx.stylize('[Circular]', 'special');
--    }
--  }
--  if (isUndefined(name)) {
--    if (array && key.match(/^\d+$/)) {
--      return str;
--    }
--    name = JSON.stringify('' + key);
--    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
--      name = name.substr(1, name.length - 2);
--      name = ctx.stylize(name, 'name');
--    } else {
--      name = name.replace(/'/g, "\\'")
--                 .replace(/\\"/g, '"')
--                 .replace(/(^"|"$)/g, "'");
--      name = ctx.stylize(name, 'string');
--    }
--  }
--
--  return name + ': ' + str;
--}
--
--
--function reduceToSingleString(output, base, braces) {
--  var numLinesEst = 0;
--  var length = output.reduce(function(prev, cur) {
--    numLinesEst++;
--    if (cur.indexOf('\n') >= 0) numLinesEst++;
--    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
--  }, 0);
--
--  if (length > 60) {
--    return braces[0] +
--           (base === '' ? '' : base + '\n ') +
--           ' ' +
--           output.join(',\n  ') +
--           ' ' +
--           braces[1];
--  }
--
--  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
--}
--
--
- // NOTE: These type checking functions intentionally don't use `instanceof`
- // because it is fragile and can be easily faked with `Object.create()`.
- function isArray(ar) {
-@@ -522,166 +98,10 @@ function isPrimitive(arg) {
- exports.isPrimitive = isPrimitive;
-
- function isBuffer(arg) {
--  return arg instanceof Buffer;
-+  return Buffer.isBuffer(arg);
- }
- exports.isBuffer = isBuffer;
-
- function objectToString(o) {
-   return Object.prototype.toString.call(o);
--}
--
--
--function pad(n) {
--  return n < 10 ? '0' + n.toString(10) : n.toString(10);
--}
--
--
--var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
--              'Oct', 'Nov', 'Dec'];
--
--// 26 Feb 16:19:34
--function timestamp() {
--  var d = new Date();
--  var time = [pad(d.getHours()),
--              pad(d.getMinutes()),
--              pad(d.getSeconds())].join(':');
--  return [d.getDate(), months[d.getMonth()], time].join(' ');
--}
--
--
--// log is just a thin wrapper to console.log that prepends a timestamp
--exports.log = function() {
--  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
--};
--
--
--/**
-- * Inherit the prototype methods from one constructor into another.
-- *
-- * The Function.prototype.inherits from lang.js rewritten as a standalone
-- * function (not on Function.prototype). NOTE: If this file is to be loaded
-- * during bootstrapping this function needs to be rewritten using some native
-- * functions as prototype setup using normal JavaScript does not work as
-- * expected during bootstrapping (see mirror.js in r114903).
-- *
-- * @param {function} ctor Constructor function which needs to inherit the
-- *     prototype.
-- * @param {function} superCtor Constructor function to inherit prototype from.
-- */
--exports.inherits = function(ctor, superCtor) {
--  ctor.super_ = superCtor;
--  ctor.prototype = Object.create(superCtor.prototype, {
--    constructor: {
--      value: ctor,
--      enumerable: false,
--      writable: true,
--      configurable: true
--    }
--  });
--};
--
--exports._extend = function(origin, add) {
--  // Don't do anything if add isn't an object
--  if (!add || !isObject(add)) return origin;
--
--  var keys = Object.keys(add);
--  var i = keys.length;
--  while (i--) {
--    origin[keys[i]] = add[keys[i]];
--  }
--  return origin;
--};
--
--function hasOwnProperty(obj, prop) {
--  return Object.prototype.hasOwnProperty.call(obj, prop);
--}
--
--
--// Deprecated old stuff.
--
--exports.p = exports.deprecate(function() {
--  for (var i = 0, len = arguments.length; i < len; ++i) {
--    console.error(exports.inspect(arguments[i]));
--  }
--}, 'util.p: Use console.error() instead');
--
--
--exports.exec = exports.deprecate(function() {
--  return require('child_process').exec.apply(this, arguments);
--}, 'util.exec is now called `child_process.exec`.');
--
--
--exports.print = exports.deprecate(function() {
--  for (var i = 0, len = arguments.length; i < len; ++i) {
--    process.stdout.write(String(arguments[i]));
--  }
--}, 'util.print: Use console.log instead');
--
--
--exports.puts = exports.deprecate(function() {
--  for (var i = 0, len = arguments.length; i < len; ++i) {
--    process.stdout.write(arguments[i] + '\n');
--  }
--}, 'util.puts: Use console.log instead');
--
--
--exports.debug = exports.deprecate(function(x) {
--  process.stderr.write('DEBUG: ' + x + '\n');
--}, 'util.debug: Use console.error instead');
--
--
--exports.error = exports.deprecate(function(x) {
--  for (var i = 0, len = arguments.length; i < len; ++i) {
--    process.stderr.write(arguments[i] + '\n');
--  }
--}, 'util.error: Use console.error instead');
--
--
--exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
--  var callbackCalled = false;
--
--  function call(a, b, c) {
--    if (callback && !callbackCalled) {
--      callback(a, b, c);
--      callbackCalled = true;
--    }
--  }
--
--  readStream.addListener('data', function(chunk) {
--    if (writeStream.write(chunk) === false) readStream.pause();
--  });
--
--  writeStream.addListener('drain', function() {
--    readStream.resume();
--  });
--
--  readStream.addListener('end', function() {
--    writeStream.end();
--  });
--
--  readStream.addListener('close', function() {
--    call();
--  });
--
--  readStream.addListener('error', function(err) {
--    writeStream.end();
--    call(err);
--  });
--
--  writeStream.addListener('error', function(err) {
--    readStream.destroy();
--    call(err);
--  });
--}, 'util.pump(): Use readableStream.pipe() instead');
--
--
--var uv;
--exports._errnoException = function(err, syscall) {
--  if (isUndefined(uv)) uv = process.binding('uv');
--  var errname = uv.errname(err);
--  var e = new Error(syscall + ' ' + errname);
--  e.code = errname;
--  e.errno = errname;
--  e.syscall = syscall;
--  return e;
--};
-+}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/core-util-is/lib/util.js b/legacy-libs/grpc/node_modules/core-util-is/lib/util.js
deleted file mode 100644 (file)
index ff4c851..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
-
-function isArray(arg) {
-  if (Array.isArray) {
-    return Array.isArray(arg);
-  }
-  return objectToString(arg) === '[object Array]';
-}
-exports.isArray = isArray;
-
-function isBoolean(arg) {
-  return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
-
-function isNull(arg) {
-  return arg === null;
-}
-exports.isNull = isNull;
-
-function isNullOrUndefined(arg) {
-  return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
-
-function isNumber(arg) {
-  return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
-
-function isString(arg) {
-  return typeof arg === 'string';
-}
-exports.isString = isString;
-
-function isSymbol(arg) {
-  return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
-
-function isUndefined(arg) {
-  return arg === void 0;
-}
-exports.isUndefined = isUndefined;
-
-function isRegExp(re) {
-  return objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
-
-function isObject(arg) {
-  return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
-
-function isDate(d) {
-  return objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
-
-function isError(e) {
-  return (objectToString(e) === '[object Error]' || e instanceof Error);
-}
-exports.isError = isError;
-
-function isFunction(arg) {
-  return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
-
-function isPrimitive(arg) {
-  return arg === null ||
-         typeof arg === 'boolean' ||
-         typeof arg === 'number' ||
-         typeof arg === 'string' ||
-         typeof arg === 'symbol' ||  // ES6 symbol
-         typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
-
-exports.isBuffer = Buffer.isBuffer;
-
-function objectToString(o) {
-  return Object.prototype.toString.call(o);
-}
diff --git a/legacy-libs/grpc/node_modules/core-util-is/package.json b/legacy-libs/grpc/node_modules/core-util-is/package.json
deleted file mode 100644 (file)
index 321b588..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_args": [
-    [
-      "core-util-is@1.0.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "core-util-is@1.0.2",
-  "_id": "core-util-is@1.0.2",
-  "_inBundle": false,
-  "_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
-  "_location": "/grpc/core-util-is",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "core-util-is@1.0.2",
-    "name": "core-util-is",
-    "escapedName": "core-util-is",
-    "rawSpec": "1.0.2",
-    "saveSpec": null,
-    "fetchSpec": "1.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/readable-stream"
-  ],
-  "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/core-util-is/issues"
-  },
-  "dependencies": {},
-  "description": "The `util.is*` functions introduced in Node v0.12.",
-  "devDependencies": {
-    "tap": "^2.3.0"
-  },
-  "homepage": "https://github.com/isaacs/core-util-is#readme",
-  "keywords": [
-    "util",
-    "isBuffer",
-    "isArray",
-    "isNumber",
-    "isString",
-    "isRegExp",
-    "isThis",
-    "isThat",
-    "polyfill"
-  ],
-  "license": "MIT",
-  "main": "lib/util.js",
-  "name": "core-util-is",
-  "optionalDependencies": {},
-  "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/core-util-is.git"
-  },
-  "scripts": {
-    "test": "tap test.js"
-  },
-  "version": "1.0.2"
-}
diff --git a/legacy-libs/grpc/node_modules/core-util-is/test.js b/legacy-libs/grpc/node_modules/core-util-is/test.js
deleted file mode 100644 (file)
index 1a490c6..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-var assert = require('tap');
-
-var t = require('./lib/util');
-
-assert.equal(t.isArray([]), true);
-assert.equal(t.isArray({}), false);
-
-assert.equal(t.isBoolean(null), false);
-assert.equal(t.isBoolean(true), true);
-assert.equal(t.isBoolean(false), true);
-
-assert.equal(t.isNull(null), true);
-assert.equal(t.isNull(undefined), false);
-assert.equal(t.isNull(false), false);
-assert.equal(t.isNull(), false);
-
-assert.equal(t.isNullOrUndefined(null), true);
-assert.equal(t.isNullOrUndefined(undefined), true);
-assert.equal(t.isNullOrUndefined(false), false);
-assert.equal(t.isNullOrUndefined(), true);
-
-assert.equal(t.isNumber(null), false);
-assert.equal(t.isNumber('1'), false);
-assert.equal(t.isNumber(1), true);
-
-assert.equal(t.isString(null), false);
-assert.equal(t.isString('1'), true);
-assert.equal(t.isString(1), false);
-
-assert.equal(t.isSymbol(null), false);
-assert.equal(t.isSymbol('1'), false);
-assert.equal(t.isSymbol(1), false);
-assert.equal(t.isSymbol(Symbol()), true);
-
-assert.equal(t.isUndefined(null), false);
-assert.equal(t.isUndefined(undefined), true);
-assert.equal(t.isUndefined(false), false);
-assert.equal(t.isUndefined(), true);
-
-assert.equal(t.isRegExp(null), false);
-assert.equal(t.isRegExp('1'), false);
-assert.equal(t.isRegExp(new RegExp()), true);
-
-assert.equal(t.isObject({}), true);
-assert.equal(t.isObject([]), true);
-assert.equal(t.isObject(new RegExp()), true);
-assert.equal(t.isObject(new Date()), true);
-
-assert.equal(t.isDate(null), false);
-assert.equal(t.isDate('1'), false);
-assert.equal(t.isDate(new Date()), true);
-
-assert.equal(t.isError(null), false);
-assert.equal(t.isError({ err: true }), false);
-assert.equal(t.isError(new Error()), true);
-
-assert.equal(t.isFunction(null), false);
-assert.equal(t.isFunction({ }), false);
-assert.equal(t.isFunction(function() {}), true);
-
-assert.equal(t.isPrimitive(null), true);
-assert.equal(t.isPrimitive(''), true);
-assert.equal(t.isPrimitive(0), true);
-assert.equal(t.isPrimitive(new Date()), false);
-
-assert.equal(t.isBuffer(null), false);
-assert.equal(t.isBuffer({}), false);
-assert.equal(t.isBuffer(new Buffer(0)), true);
diff --git a/legacy-libs/grpc/node_modules/deep-extend/CHANGELOG.md b/legacy-libs/grpc/node_modules/deep-extend/CHANGELOG.md
deleted file mode 100644 (file)
index dd13ec1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-Changelog
-=========
-
-v0.6.0
-------
-
-- Updated "devDependencies" versions to fix vulnerability alerts
-- Dropped support of io.js and node.js v0.12.x and lower since new versions of
-  "devDependencies" couldn't work with those old node.js versions
-  (minimal supported version of node.js now is v4.0.0)
-
-v0.5.1
-------
-
-- Fix prototype pollution vulnerability (thanks to @mwakerman for the PR)
-- Avoid using deprecated Buffer API (thanks to @ChALkeR for the PR)
-
-v0.5.0
-------
-
-- Auto-testing provided by Travis CI;
-- Support older Node.JS versions (`v0.11.x` and `v0.10.x`);
-- Removed tests files from npm package.
-
-v0.4.2
-------
-
-- Fix for `null` as an argument.
-
-v0.4.1
-------
-
-- Removed test code from <b>npm</b> package
-  ([see pull request #21](https://github.com/unclechu/node-deep-extend/pull/21));
-- Increased minimal version of Node from `0.4.0` to `0.12.0`
-  (because can't run tests on lesser version anyway).
-
-v0.4.0
-------
-
-- **WARNING!** Broken backward compatibility with `v0.3.x`;
-- Fixed bug with extending arrays instead of cloning;
-- Deep cloning for arrays;
-- Check for own property;
-- Fixed some documentation issues;
-- Strict JS mode.
diff --git a/legacy-libs/grpc/node_modules/deep-extend/LICENSE b/legacy-libs/grpc/node_modules/deep-extend/LICENSE
deleted file mode 100644 (file)
index 5c58916..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013-2018, Viacheslav Lotsmanov
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/deep-extend/README.md b/legacy-libs/grpc/node_modules/deep-extend/README.md
deleted file mode 100644 (file)
index 67c7fc0..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-Deep Extend
-===========
-
-Recursive object extending.
-
-[![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend)
-
-[![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/)
-
-Install
--------
-
-```bash
-$ npm install deep-extend
-```
-
-Usage
------
-
-```javascript
-var deepExtend = require('deep-extend');
-var obj1 = {
-  a: 1,
-  b: 2,
-  d: {
-    a: 1,
-    b: [],
-    c: { test1: 123, test2: 321 }
-  },
-  f: 5,
-  g: 123,
-  i: 321,
-  j: [1, 2]
-};
-var obj2 = {
-  b: 3,
-  c: 5,
-  d: {
-    b: { first: 'one', second: 'two' },
-    c: { test2: 222 }
-  },
-  e: { one: 1, two: 2 },
-  f: [],
-  g: (void 0),
-  h: /abc/g,
-  i: null,
-  j: [3, 4]
-};
-
-deepExtend(obj1, obj2);
-
-console.log(obj1);
-/*
-{ a: 1,
-  b: 3,
-  d:
-   { a: 1,
-     b: { first: 'one', second: 'two' },
-     c: { test1: 123, test2: 222 } },
-  f: [],
-  g: undefined,
-  c: 5,
-  e: { one: 1, two: 2 },
-  h: /abc/g,
-  i: null,
-  j: [3, 4] }
-*/
-```
-
-Unit testing
-------------
-
-```bash
-$ npm test
-```
-
-Changelog
----------
-
-[CHANGELOG.md](./CHANGELOG.md)
-
-Any issues?
------------
-
-Please, report about issues
-[here](https://github.com/unclechu/node-deep-extend/issues).
-
-License
--------
-
-[MIT](./LICENSE)
diff --git a/legacy-libs/grpc/node_modules/deep-extend/index.js b/legacy-libs/grpc/node_modules/deep-extend/index.js
deleted file mode 100644 (file)
index 762d81e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib/deep-extend');
diff --git a/legacy-libs/grpc/node_modules/deep-extend/lib/deep-extend.js b/legacy-libs/grpc/node_modules/deep-extend/lib/deep-extend.js
deleted file mode 100644 (file)
index 651fd8d..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*!
- * @description Recursive object extending
- * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
- * @license MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013-2018 Viacheslav Lotsmanov
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-'use strict';
-
-function isSpecificValue(val) {
-       return (
-               val instanceof Buffer
-               || val instanceof Date
-               || val instanceof RegExp
-       ) ? true : false;
-}
-
-function cloneSpecificValue(val) {
-       if (val instanceof Buffer) {
-               var x = Buffer.alloc
-                       ? Buffer.alloc(val.length)
-                       : new Buffer(val.length);
-               val.copy(x);
-               return x;
-       } else if (val instanceof Date) {
-               return new Date(val.getTime());
-       } else if (val instanceof RegExp) {
-               return new RegExp(val);
-       } else {
-               throw new Error('Unexpected situation');
-       }
-}
-
-/**
- * Recursive cloning array.
- */
-function deepCloneArray(arr) {
-       var clone = [];
-       arr.forEach(function (item, index) {
-               if (typeof item === 'object' && item !== null) {
-                       if (Array.isArray(item)) {
-                               clone[index] = deepCloneArray(item);
-                       } else if (isSpecificValue(item)) {
-                               clone[index] = cloneSpecificValue(item);
-                       } else {
-                               clone[index] = deepExtend({}, item);
-                       }
-               } else {
-                       clone[index] = item;
-               }
-       });
-       return clone;
-}
-
-function safeGetProperty(object, property) {
-       return property === '__proto__' ? undefined : object[property];
-}
-
-/**
- * Extening object that entered in first argument.
- *
- * Returns extended object or false if have no target object or incorrect type.
- *
- * If you wish to clone source object (without modify it), just use empty new
- * object as first argument, like this:
- *   deepExtend({}, yourObj_1, [yourObj_N]);
- */
-var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
-       if (arguments.length < 1 || typeof arguments[0] !== 'object') {
-               return false;
-       }
-
-       if (arguments.length < 2) {
-               return arguments[0];
-       }
-
-       var target = arguments[0];
-
-       // convert arguments to array and cut off target object
-       var args = Array.prototype.slice.call(arguments, 1);
-
-       var val, src, clone;
-
-       args.forEach(function (obj) {
-               // skip argument if isn't an object, is null, or is an array
-               if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
-                       return;
-               }
-
-               Object.keys(obj).forEach(function (key) {
-                       src = safeGetProperty(target, key); // source value
-                       val = safeGetProperty(obj, key); // new value
-
-                       // recursion prevention
-                       if (val === target) {
-                               return;
-
-                       /**
-                        * if new value isn't object then just overwrite by new value
-                        * instead of extending.
-                        */
-                       } else if (typeof val !== 'object' || val === null) {
-                               target[key] = val;
-                               return;
-
-                       // just clone arrays (and recursive clone objects inside)
-                       } else if (Array.isArray(val)) {
-                               target[key] = deepCloneArray(val);
-                               return;
-
-                       // custom cloning and overwrite for specific objects
-                       } else if (isSpecificValue(val)) {
-                               target[key] = cloneSpecificValue(val);
-                               return;
-
-                       // overwrite by new value if source isn't object or array
-                       } else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
-                               target[key] = deepExtend({}, val);
-                               return;
-
-                       // source value and new value is objects both, extending...
-                       } else {
-                               target[key] = deepExtend(src, val);
-                               return;
-                       }
-               });
-       });
-
-       return target;
-};
diff --git a/legacy-libs/grpc/node_modules/deep-extend/package.json b/legacy-libs/grpc/node_modules/deep-extend/package.json
deleted file mode 100644 (file)
index 9e7afc0..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-{
-  "_args": [
-    [
-      "deep-extend@0.6.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "deep-extend@0.6.0",
-  "_id": "deep-extend@0.6.0",
-  "_inBundle": false,
-  "_integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
-  "_location": "/grpc/deep-extend",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "deep-extend@0.6.0",
-    "name": "deep-extend",
-    "escapedName": "deep-extend",
-    "rawSpec": "0.6.0",
-    "saveSpec": null,
-    "fetchSpec": "0.6.0"
-  },
-  "_requiredBy": [
-    "/grpc/rc"
-  ],
-  "_resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "0.6.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Viacheslav Lotsmanov",
-    "email": "lotsmanov89@gmail.com"
-  },
-  "bugs": {
-    "url": "https://github.com/unclechu/node-deep-extend/issues"
-  },
-  "contributors": [
-    {
-      "name": "Romain Prieto",
-      "url": "https://github.com/rprieto"
-    },
-    {
-      "name": "Max Maximov",
-      "url": "https://github.com/maxmaximov"
-    },
-    {
-      "name": "Marshall Bowers",
-      "url": "https://github.com/maxdeviant"
-    },
-    {
-      "name": "Misha Wakerman",
-      "url": "https://github.com/mwakerman"
-    }
-  ],
-  "dependencies": {},
-  "description": "Recursive object extending",
-  "devDependencies": {
-    "mocha": "5.2.0",
-    "should": "13.2.1"
-  },
-  "engines": {
-    "node": ">=4.0.0"
-  },
-  "files": [
-    "index.js",
-    "lib/"
-  ],
-  "homepage": "https://github.com/unclechu/node-deep-extend",
-  "keywords": [
-    "deep-extend",
-    "extend",
-    "deep",
-    "recursive",
-    "xtend",
-    "clone",
-    "merge",
-    "json"
-  ],
-  "license": "MIT",
-  "licenses": [
-    {
-      "type": "MIT",
-      "url": "https://raw.githubusercontent.com/unclechu/node-deep-extend/master/LICENSE"
-    }
-  ],
-  "main": "lib/deep-extend.js",
-  "name": "deep-extend",
-  "optionalDependencies": {},
-  "readme": "Deep Extend\n===========\n\nRecursive object extending.\n\n[![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend)\n\n[![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/)\n\nInstall\n-------\n\n```bash\n$ npm install deep-extend\n```\n\nUsage\n-----\n\n```javascript\nvar deepExtend = require('deep-extend');\nvar obj1 = {\n  a: 1,\n  b: 2,\n  d: {\n    a: 1,\n    b: [],\n    c: { test1: 123, test2: 321 }\n  },\n  f: 5,\n  g: 123,\n  i: 321,\n  j: [1, 2]\n};\nvar obj2 = {\n  b: 3,\n  c: 5,\n  d: {\n    b: { first: 'one', second: 'two' },\n    c: { test2: 222 }\n  },\n  e: { one: 1, two: 2 },\n  f: [],\n  g: (void 0),\n  h: /abc/g,\n  i: null,\n  j: [3, 4]\n};\n\ndeepExtend(obj1, obj2);\n\nconsole.log(obj1);\n/*\n{ a: 1,\n  b: 3,\n  d:\n   { a: 1,\n     b: { first: 'one', second: 'two' },\n     c: { test1: 123, test2: 222 } },\n  f: [],\n  g: undefined,\n  c: 5,\n  e: { one: 1, two: 2 },\n  h: /abc/g,\n  i: null,\n  j: [3, 4] }\n*/\n```\n\nUnit testing\n------------\n\n```bash\n$ npm test\n```\n\nChangelog\n---------\n\n[CHANGELOG.md](./CHANGELOG.md)\n\nAny issues?\n-----------\n\nPlease, report about issues\n[here](https://github.com/unclechu/node-deep-extend/issues).\n\nLicense\n-------\n\n[MIT](./LICENSE)\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/unclechu/node-deep-extend.git"
-  },
-  "scripts": {
-    "test": "mocha"
-  },
-  "version": "0.6.0"
-}
diff --git a/legacy-libs/grpc/node_modules/delegates/History.md b/legacy-libs/grpc/node_modules/delegates/History.md
deleted file mode 100644 (file)
index 25959ea..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-1.0.0 / 2015-12-14
-==================
-
-  * Merge pull request #12 from kasicka/master
-  * Add license text
-
-0.1.0 / 2014-10-17
-==================
-
- * adds `.fluent()` to api
-
-0.0.3 / 2014-01-13
-==================
-
- * fix receiver for .method()
-
-0.0.2 / 2014-01-13
-==================
-
- * Object.defineProperty() sucks
- * Initial commit
diff --git a/legacy-libs/grpc/node_modules/delegates/License b/legacy-libs/grpc/node_modules/delegates/License
deleted file mode 100644 (file)
index 60de60a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2015 TJ Holowaychuk <tj@vision-media.ca>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/delegates/Makefile b/legacy-libs/grpc/node_modules/delegates/Makefile
deleted file mode 100644 (file)
index a9dcfd5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-test:
-       @./node_modules/.bin/mocha \
-               --require should \
-               --reporter spec \
-               --bail
-
-.PHONY: test
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/delegates/Readme.md b/legacy-libs/grpc/node_modules/delegates/Readme.md
deleted file mode 100644 (file)
index ab8cf4a..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-
-# delegates
-
-  Node method and accessor delegation utilty.
-
-## Installation
-
-```
-$ npm install delegates
-```
-
-## Example
-
-```js
-var delegate = require('delegates');
-
-...
-
-delegate(proto, 'request')
-  .method('acceptsLanguages')
-  .method('acceptsEncodings')
-  .method('acceptsCharsets')
-  .method('accepts')
-  .method('is')
-  .access('querystring')
-  .access('idempotent')
-  .access('socket')
-  .access('length')
-  .access('query')
-  .access('search')
-  .access('status')
-  .access('method')
-  .access('path')
-  .access('body')
-  .access('host')
-  .access('url')
-  .getter('subdomains')
-  .getter('protocol')
-  .getter('header')
-  .getter('stale')
-  .getter('fresh')
-  .getter('secure')
-  .getter('ips')
-  .getter('ip')
-```
-
-# API
-
-## Delegate(proto, prop)
-
-Creates a delegator instance used to configure using the `prop` on the given
-`proto` object. (which is usually a prototype)
-
-## Delegate#method(name)
-
-Allows the given method `name` to be accessed on the host.
-
-## Delegate#getter(name)
-
-Creates a "getter" for the property with the given `name` on the delegated
-object.
-
-## Delegate#setter(name)
-
-Creates a "setter" for the property with the given `name` on the delegated
-object.
-
-## Delegate#access(name)
-
-Creates an "accessor" (ie: both getter *and* setter) for the property with the
-given `name` on the delegated object.
-
-## Delegate#fluent(name)
-
-A unique type of "accessor" that works for a "fluent" API. When called as a
-getter, the method returns the expected value. However, if the method is called
-with a value, it will return itself so it can be chained. For example:
-
-```js
-delegate(proto, 'request')
-  .fluent('query')
-
-// getter
-var q = request.query();
-
-// setter (chainable)
-request
-  .query({ a: 1 })
-  .query({ b: 2 });
-```
-
-# License
-
-  MIT
diff --git a/legacy-libs/grpc/node_modules/delegates/index.js b/legacy-libs/grpc/node_modules/delegates/index.js
deleted file mode 100644 (file)
index 17c222d..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-
-/**
- * Expose `Delegator`.
- */
-
-module.exports = Delegator;
-
-/**
- * Initialize a delegator.
- *
- * @param {Object} proto
- * @param {String} target
- * @api public
- */
-
-function Delegator(proto, target) {
-  if (!(this instanceof Delegator)) return new Delegator(proto, target);
-  this.proto = proto;
-  this.target = target;
-  this.methods = [];
-  this.getters = [];
-  this.setters = [];
-  this.fluents = [];
-}
-
-/**
- * Delegate method `name`.
- *
- * @param {String} name
- * @return {Delegator} self
- * @api public
- */
-
-Delegator.prototype.method = function(name){
-  var proto = this.proto;
-  var target = this.target;
-  this.methods.push(name);
-
-  proto[name] = function(){
-    return this[target][name].apply(this[target], arguments);
-  };
-
-  return this;
-};
-
-/**
- * Delegator accessor `name`.
- *
- * @param {String} name
- * @return {Delegator} self
- * @api public
- */
-
-Delegator.prototype.access = function(name){
-  return this.getter(name).setter(name);
-};
-
-/**
- * Delegator getter `name`.
- *
- * @param {String} name
- * @return {Delegator} self
- * @api public
- */
-
-Delegator.prototype.getter = function(name){
-  var proto = this.proto;
-  var target = this.target;
-  this.getters.push(name);
-
-  proto.__defineGetter__(name, function(){
-    return this[target][name];
-  });
-
-  return this;
-};
-
-/**
- * Delegator setter `name`.
- *
- * @param {String} name
- * @return {Delegator} self
- * @api public
- */
-
-Delegator.prototype.setter = function(name){
-  var proto = this.proto;
-  var target = this.target;
-  this.setters.push(name);
-
-  proto.__defineSetter__(name, function(val){
-    return this[target][name] = val;
-  });
-
-  return this;
-};
-
-/**
- * Delegator fluent accessor
- *
- * @param {String} name
- * @return {Delegator} self
- * @api public
- */
-
-Delegator.prototype.fluent = function (name) {
-  var proto = this.proto;
-  var target = this.target;
-  this.fluents.push(name);
-
-  proto[name] = function(val){
-    if ('undefined' != typeof val) {
-      this[target][name] = val;
-      return this;
-    } else {
-      return this[target][name];
-    }
-  };
-
-  return this;
-};
diff --git a/legacy-libs/grpc/node_modules/delegates/package.json b/legacy-libs/grpc/node_modules/delegates/package.json
deleted file mode 100644 (file)
index e727b4a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-{
-  "_args": [
-    [
-      "delegates@1.0.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "delegates@1.0.0",
-  "_id": "delegates@1.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
-  "_location": "/grpc/delegates",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "delegates@1.0.0",
-    "name": "delegates",
-    "escapedName": "delegates",
-    "rawSpec": "1.0.0",
-    "saveSpec": null,
-    "fetchSpec": "1.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/are-we-there-yet"
-  ],
-  "_resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "bugs": {
-    "url": "https://github.com/visionmedia/node-delegates/issues"
-  },
-  "dependencies": {},
-  "description": "delegate methods and accessors to another property",
-  "devDependencies": {
-    "mocha": "*",
-    "should": "*"
-  },
-  "homepage": "https://github.com/visionmedia/node-delegates#readme",
-  "keywords": [
-    "delegate",
-    "delegation"
-  ],
-  "license": "MIT",
-  "name": "delegates",
-  "optionalDependencies": {},
-  "readme": "\n# delegates\n\n  Node method and accessor delegation utilty.\n\n## Installation\n\n```\n$ npm install delegates\n```\n\n## Example\n\n```js\nvar delegate = require('delegates');\n\n...\n\ndelegate(proto, 'request')\n  .method('acceptsLanguages')\n  .method('acceptsEncodings')\n  .method('acceptsCharsets')\n  .method('accepts')\n  .method('is')\n  .access('querystring')\n  .access('idempotent')\n  .access('socket')\n  .access('length')\n  .access('query')\n  .access('search')\n  .access('status')\n  .access('method')\n  .access('path')\n  .access('body')\n  .access('host')\n  .access('url')\n  .getter('subdomains')\n  .getter('protocol')\n  .getter('header')\n  .getter('stale')\n  .getter('fresh')\n  .getter('secure')\n  .getter('ips')\n  .getter('ip')\n```\n\n# API\n\n## Delegate(proto, prop)\n\nCreates a delegator instance used to configure using the `prop` on the given\n`proto` object. (which is usually a prototype)\n\n## Delegate#method(name)\n\nAllows the given method `name` to be accessed on the host.\n\n## Delegate#getter(name)\n\nCreates a \"getter\" for the property with the given `name` on the delegated\nobject.\n\n## Delegate#setter(name)\n\nCreates a \"setter\" for the property with the given `name` on the delegated\nobject.\n\n## Delegate#access(name)\n\nCreates an \"accessor\" (ie: both getter *and* setter) for the property with the\ngiven `name` on the delegated object.\n\n## Delegate#fluent(name)\n\nA unique type of \"accessor\" that works for a \"fluent\" API. When called as a\ngetter, the method returns the expected value. However, if the method is called\nwith a value, it will return itself so it can be chained. For example:\n\n```js\ndelegate(proto, 'request')\n  .fluent('query')\n\n// getter\nvar q = request.query();\n\n// setter (chainable)\nrequest\n  .query({ a: 1 })\n  .query({ b: 2 });\n```\n\n# License\n\n  MIT\n",
-  "readmeFilename": "Readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/visionmedia/node-delegates.git"
-  },
-  "version": "1.0.0"
-}
diff --git a/legacy-libs/grpc/node_modules/delegates/test/index.js b/legacy-libs/grpc/node_modules/delegates/test/index.js
deleted file mode 100644 (file)
index 7b6e3d4..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-
-var assert = require('assert');
-var delegate = require('..');
-
-describe('.method(name)', function(){
-  it('should delegate methods', function(){
-    var obj = {};
-
-    obj.request = {
-      foo: function(bar){
-        assert(this == obj.request);
-        return bar;
-      }
-    };
-
-    delegate(obj, 'request').method('foo');
-
-    obj.foo('something').should.equal('something');
-  })
-})
-
-describe('.getter(name)', function(){
-  it('should delegate getters', function(){
-    var obj = {};
-
-    obj.request = {
-      get type() {
-        return 'text/html';
-      }
-    }
-
-    delegate(obj, 'request').getter('type');
-
-    obj.type.should.equal('text/html');
-  })
-})
-
-describe('.setter(name)', function(){
-  it('should delegate setters', function(){
-    var obj = {};
-
-    obj.request = {
-      get type() {
-        return this._type.toUpperCase();
-      },
-
-      set type(val) {
-        this._type = val;
-      }
-    }
-
-    delegate(obj, 'request').setter('type');
-
-    obj.type = 'hey';
-    obj.request.type.should.equal('HEY');
-  })
-})
-
-describe('.access(name)', function(){
-  it('should delegate getters and setters', function(){
-    var obj = {};
-
-    obj.request = {
-      get type() {
-        return this._type.toUpperCase();
-      },
-
-      set type(val) {
-        this._type = val;
-      }
-    }
-
-    delegate(obj, 'request').access('type');
-
-    obj.type = 'hey';
-    obj.type.should.equal('HEY');
-  })
-})
-
-describe('.fluent(name)', function () {
-  it('should delegate in a fluent fashion', function () {
-    var obj = {
-      settings: {
-        env: 'development'
-      }
-    };
-
-    delegate(obj, 'settings').fluent('env');
-
-    obj.env().should.equal('development');
-    obj.env('production').should.equal(obj);
-    obj.settings.env.should.equal('production');
-  })
-})
diff --git a/legacy-libs/grpc/node_modules/detect-libc/LICENSE b/legacy-libs/grpc/node_modules/detect-libc/LICENSE
deleted file mode 100644 (file)
index 8dada3e..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "{}"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright {yyyy} {name of copyright owner}
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/legacy-libs/grpc/node_modules/detect-libc/README.md b/legacy-libs/grpc/node_modules/detect-libc/README.md
deleted file mode 100644 (file)
index 3176357..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-# detect-libc
-
-Node.js module to detect the C standard library (libc) implementation
-family and version in use on a given Linux system.
-
-Provides a value suitable for use with the `LIBC` option of
-[prebuild](https://www.npmjs.com/package/prebuild),
-[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and
-[prebuild-install](https://www.npmjs.com/package/prebuild-install),
-therefore allowing build and provision of pre-compiled binaries
-for musl-based Linux e.g. Alpine as well as glibc-based.
-
-Currently supports libc detection of `glibc` and `musl`.
-
-## Install
-
-```sh
-npm install detect-libc
-```
-
-## Usage
-
-### API
-
-```js
-const { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc');
-```
-
-* `GLIBC` is a String containing the value "glibc" for comparison with `family`.
-* `MUSL` is a String containing the value "musl" for comparison with `family`.
-* `family` is a String representing the system libc family.
-* `version` is a String representing the system libc version number.
-* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine.
-
-### detect-libc command line tool
-
-When run on a Linux system with a non-glibc libc,
-the child command will be run with the `LIBC` environment variable
-set to the relevant value.
-
-On all other platforms will run the child command as-is.
-
-The command line feature requires `spawnSync` provided by Node v0.12+.
-
-```sh
-detect-libc child-command
-```
-
-## Integrating with prebuild
-
-```json
-  "scripts": {
-    "install": "detect-libc prebuild-install || node-gyp rebuild",
-    "test": "mocha && detect-libc prebuild-ci"
-  },
-  "dependencies": {
-    "detect-libc": "^1.0.2",
-    "prebuild-install": "^2.2.0"
-  },
-  "devDependencies": {
-    "prebuild": "^6.2.1",
-    "prebuild-ci": "^2.2.3"
-  }
-```
-
-## Licence
-
-Copyright 2017 Lovell Fuller
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/legacy-libs/grpc/node_modules/detect-libc/bin/detect-libc.js b/legacy-libs/grpc/node_modules/detect-libc/bin/detect-libc.js
deleted file mode 100644 (file)
index 5486127..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env node
-
-'use strict';
-
-var spawnSync = require('child_process').spawnSync;
-var libc = require('../');
-
-var spawnOptions = {
-  env: process.env,
-  shell: true,
-  stdio: 'inherit'
-};
-
-if (libc.isNonGlibcLinux) {
-  spawnOptions.env.LIBC = process.env.LIBC || libc.family;
-}
-
-process.exit(spawnSync(process.argv[2], process.argv.slice(3), spawnOptions).status);
diff --git a/legacy-libs/grpc/node_modules/detect-libc/lib/detect-libc.js b/legacy-libs/grpc/node_modules/detect-libc/lib/detect-libc.js
deleted file mode 100644 (file)
index 1855fe1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-'use strict';
-
-var platform = require('os').platform();
-var spawnSync = require('child_process').spawnSync;
-var readdirSync = require('fs').readdirSync;
-
-var GLIBC = 'glibc';
-var MUSL = 'musl';
-
-var spawnOptions = {
-  encoding: 'utf8',
-  env: process.env
-};
-
-if (!spawnSync) {
-  spawnSync = function () {
-    return { status: 126, stdout: '', stderr: '' };
-  };
-}
-
-function contains (needle) {
-  return function (haystack) {
-    return haystack.indexOf(needle) !== -1;
-  };
-}
-
-function versionFromMuslLdd (out) {
-  return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1];
-}
-
-function safeReaddirSync (path) {
-  try {
-    return readdirSync(path);
-  } catch (e) {}
-  return [];
-}
-
-var family = '';
-var version = '';
-var method = '';
-
-if (platform === 'linux') {
-  // Try getconf
-  var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions);
-  if (glibc.status === 0) {
-    family = GLIBC;
-    version = glibc.stdout.trim().split(' ')[1];
-    method = 'getconf';
-  } else {
-    // Try ldd
-    var ldd = spawnSync('ldd', ['--version'], spawnOptions);
-    if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) {
-      family = MUSL;
-      version = versionFromMuslLdd(ldd.stdout);
-      method = 'ldd';
-    } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) {
-      family = MUSL;
-      version = versionFromMuslLdd(ldd.stderr);
-      method = 'ldd';
-    } else {
-      // Try filesystem (family only)
-      var lib = safeReaddirSync('/lib');
-      if (lib.some(contains('-linux-gnu'))) {
-        family = GLIBC;
-        method = 'filesystem';
-      } else if (lib.some(contains('libc.musl-'))) {
-        family = MUSL;
-        method = 'filesystem';
-      } else if (lib.some(contains('ld-musl-'))) {
-        family = MUSL;
-        method = 'filesystem';
-      } else {
-        var usrSbin = safeReaddirSync('/usr/sbin');
-        if (usrSbin.some(contains('glibc'))) {
-          family = GLIBC;
-          method = 'filesystem';
-        }
-      }
-    }
-  }
-}
-
-var isNonGlibcLinux = (family !== '' && family !== GLIBC);
-
-module.exports = {
-  GLIBC: GLIBC,
-  MUSL: MUSL,
-  family: family,
-  version: version,
-  method: method,
-  isNonGlibcLinux: isNonGlibcLinux
-};
diff --git a/legacy-libs/grpc/node_modules/detect-libc/package.json b/legacy-libs/grpc/node_modules/detect-libc/package.json
deleted file mode 100644 (file)
index 1bda8cf..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "_args": [
-    [
-      "detect-libc@1.0.3",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "detect-libc@1.0.3",
-  "_id": "detect-libc@1.0.3",
-  "_inBundle": false,
-  "_integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
-  "_location": "/grpc/detect-libc",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "detect-libc@1.0.3",
-    "name": "detect-libc",
-    "escapedName": "detect-libc",
-    "rawSpec": "1.0.3",
-    "saveSpec": null,
-    "fetchSpec": "1.0.3"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.3",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Lovell Fuller",
-    "email": "npm@lovell.info"
-  },
-  "bin": {
-    "detect-libc": "./bin/detect-libc.js"
-  },
-  "bugs": {
-    "url": "https://github.com/lovell/detect-libc/issues"
-  },
-  "contributors": [
-    {
-      "name": "Niklas Salmoukas",
-      "email": "niklas@salmoukas.com"
-    }
-  ],
-  "dependencies": {},
-  "description": "Node.js module to detect the C standard library (libc) implementation family and version",
-  "devDependencies": {
-    "ava": "^0.23.0",
-    "nyc": "^11.3.0",
-    "proxyquire": "^1.8.0",
-    "semistandard": "^11.0.0"
-  },
-  "engines": {
-    "node": ">=0.10"
-  },
-  "homepage": "https://github.com/lovell/detect-libc#readme",
-  "keywords": [
-    "libc",
-    "glibc",
-    "musl"
-  ],
-  "license": "Apache-2.0",
-  "main": "lib/detect-libc.js",
-  "name": "detect-libc",
-  "optionalDependencies": {},
-  "readme": "# detect-libc\n\nNode.js module to detect the C standard library (libc) implementation\nfamily and version in use on a given Linux system.\n\nProvides a value suitable for use with the `LIBC` option of\n[prebuild](https://www.npmjs.com/package/prebuild),\n[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and\n[prebuild-install](https://www.npmjs.com/package/prebuild-install),\ntherefore allowing build and provision of pre-compiled binaries\nfor musl-based Linux e.g. Alpine as well as glibc-based.\n\nCurrently supports libc detection of `glibc` and `musl`.\n\n## Install\n\n```sh\nnpm install detect-libc\n```\n\n## Usage\n\n### API\n\n```js\nconst { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc');\n```\n\n* `GLIBC` is a String containing the value \"glibc\" for comparison with `family`.\n* `MUSL` is a String containing the value \"musl\" for comparison with `family`.\n* `family` is a String representing the system libc family.\n* `version` is a String representing the system libc version number.\n* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine.\n\n### detect-libc command line tool\n\nWhen run on a Linux system with a non-glibc libc,\nthe child command will be run with the `LIBC` environment variable\nset to the relevant value.\n\nOn all other platforms will run the child command as-is.\n\nThe command line feature requires `spawnSync` provided by Node v0.12+.\n\n```sh\ndetect-libc child-command\n```\n\n## Integrating with prebuild\n\n```json\n  \"scripts\": {\n    \"install\": \"detect-libc prebuild-install || node-gyp rebuild\",\n    \"test\": \"mocha && detect-libc prebuild-ci\"\n  },\n  \"dependencies\": {\n    \"detect-libc\": \"^1.0.2\",\n    \"prebuild-install\": \"^2.2.0\"\n  },\n  \"devDependencies\": {\n    \"prebuild\": \"^6.2.1\",\n    \"prebuild-ci\": \"^2.2.3\"\n  }\n```\n\n## Licence\n\nCopyright 2017 Lovell Fuller\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/lovell/detect-libc.git"
-  },
-  "scripts": {
-    "test": "semistandard && nyc --reporter=lcov ava"
-  },
-  "version": "1.0.3"
-}
diff --git a/legacy-libs/grpc/node_modules/fs-minipass/LICENSE b/legacy-libs/grpc/node_modules/fs-minipass/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/fs-minipass/README.md b/legacy-libs/grpc/node_modules/fs-minipass/README.md
deleted file mode 100644 (file)
index 1e61241..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# fs-minipass
-
-Filesystem streams based on [minipass](http://npm.im/minipass).
-
-4 classes are exported:
-
-- ReadStream
-- ReadStreamSync
-- WriteStream
-- WriteStreamSync
-
-When using `ReadStreamSync`, all of the data is made available
-immediately upon consuming the stream.  Nothing is buffered in memory
-when the stream is constructed.  If the stream is piped to a writer,
-then it will synchronously `read()` and emit data into the writer as
-fast as the writer can consume it.  (That is, it will respect
-backpressure.)  If you call `stream.read()` then it will read the
-entire file and return the contents.
-
-When using `WriteStreamSync`, every write is flushed to the file
-synchronously.  If your writes all come in a single tick, then it'll
-write it all out in a single tick.  It's as synchronous as you are.
-
-The async versions work much like their node builtin counterparts,
-with the exception of introducing significantly less Stream machinery
-overhead.
-
-## USAGE
-
-It's just streams, you pipe them or read() them or write() to them.
-
-```js
-const fsm = require('fs-minipass')
-const readStream = new fsm.ReadStream('file.txt')
-const writeStream = new fsm.WriteStream('output.txt')
-writeStream.write('some file header or whatever\n')
-readStream.pipe(writeStream)
-```
-
-## ReadStream(path, options)
-
-Path string is required, but somewhat irrelevant if an open file
-descriptor is passed in as an option.
-
-Options:
-
-- `fd` Pass in a numeric file descriptor, if the file is already open.
-- `readSize` The size of reads to do, defaults to 16MB
-- `size` The size of the file, if known.  Prevents zero-byte read()
-  call at the end.
-- `autoClose` Set to `false` to prevent the file descriptor from being
-  closed when the file is done being read.
-
-## WriteStream(path, options)
-
-Path string is required, but somewhat irrelevant if an open file
-descriptor is passed in as an option.
-
-Options:
-
-- `fd` Pass in a numeric file descriptor, if the file is already open.
-- `mode` The mode to create the file with. Defaults to `0o666`.
-- `start` The position in the file to start reading.  If not
-  specified, then the file will start writing at position zero, and be
-  truncated by default.
-- `autoClose` Set to `false` to prevent the file descriptor from being
-  closed when the stream is ended.
-- `flags` Flags to use when opening the file.  Irrelevant if `fd` is
-  passed in, since file won't be opened in that case.  Defaults to
-  `'a'` if a `pos` is specified, or `'w'` otherwise.
diff --git a/legacy-libs/grpc/node_modules/fs-minipass/index.js b/legacy-libs/grpc/node_modules/fs-minipass/index.js
deleted file mode 100644 (file)
index 6bb7f10..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-'use strict'
-const MiniPass = require('minipass')
-const EE = require('events').EventEmitter
-const fs = require('fs')
-
-// for writev
-const binding = process.binding('fs')
-const writeBuffers = binding.writeBuffers
-const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback
-
-const _autoClose = Symbol('_autoClose')
-const _close = Symbol('_close')
-const _ended = Symbol('_ended')
-const _fd = Symbol('_fd')
-const _finished = Symbol('_finished')
-const _flags = Symbol('_flags')
-const _flush = Symbol('_flush')
-const _handleChunk = Symbol('_handleChunk')
-const _makeBuf = Symbol('_makeBuf')
-const _mode = Symbol('_mode')
-const _needDrain = Symbol('_needDrain')
-const _onerror = Symbol('_onerror')
-const _onopen = Symbol('_onopen')
-const _onread = Symbol('_onread')
-const _onwrite = Symbol('_onwrite')
-const _open = Symbol('_open')
-const _path = Symbol('_path')
-const _pos = Symbol('_pos')
-const _queue = Symbol('_queue')
-const _read = Symbol('_read')
-const _readSize = Symbol('_readSize')
-const _reading = Symbol('_reading')
-const _remain = Symbol('_remain')
-const _size = Symbol('_size')
-const _write = Symbol('_write')
-const _writing = Symbol('_writing')
-const _defaultFlag = Symbol('_defaultFlag')
-
-class ReadStream extends MiniPass {
-  constructor (path, opt) {
-    opt = opt || {}
-    super(opt)
-
-    this.writable = false
-
-    if (typeof path !== 'string')
-      throw new TypeError('path must be a string')
-
-    this[_fd] = typeof opt.fd === 'number' ? opt.fd : null
-    this[_path] = path
-    this[_readSize] = opt.readSize || 16*1024*1024
-    this[_reading] = false
-    this[_size] = typeof opt.size === 'number' ? opt.size : Infinity
-    this[_remain] = this[_size]
-    this[_autoClose] = typeof opt.autoClose === 'boolean' ?
-      opt.autoClose : true
-
-    if (typeof this[_fd] === 'number')
-      this[_read]()
-    else
-      this[_open]()
-  }
-
-  get fd () { return this[_fd] }
-  get path () { return this[_path] }
-
-  write () {
-    throw new TypeError('this is a readable stream')
-  }
-
-  end () {
-    throw new TypeError('this is a readable stream')
-  }
-
-  [_open] () {
-    fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))
-  }
-
-  [_onopen] (er, fd) {
-    if (er)
-      this[_onerror](er)
-    else {
-      this[_fd] = fd
-      this.emit('open', fd)
-      this[_read]()
-    }
-  }
-
-  [_makeBuf] () {
-    return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))
-  }
-
-  [_read] () {
-    if (!this[_reading]) {
-      this[_reading] = true
-      const buf = this[_makeBuf]()
-      /* istanbul ignore if */
-      if (buf.length === 0) return process.nextTick(() => this[_onread](null, 0, buf))
-      fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) =>
-        this[_onread](er, br, buf))
-    }
-  }
-
-  [_onread] (er, br, buf) {
-    this[_reading] = false
-    if (er)
-      this[_onerror](er)
-    else if (this[_handleChunk](br, buf))
-      this[_read]()
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      fs.close(this[_fd], _ => this.emit('close'))
-      this[_fd] = null
-    }
-  }
-
-  [_onerror] (er) {
-    this[_reading] = true
-    this[_close]()
-    this.emit('error', er)
-  }
-
-  [_handleChunk] (br, buf) {
-    let ret = false
-    // no effect if infinite
-    this[_remain] -= br
-    if (br > 0)
-      ret = super.write(br < buf.length ? buf.slice(0, br) : buf)
-
-    if (br === 0 || this[_remain] <= 0) {
-      ret = false
-      this[_close]()
-      super.end()
-    }
-
-    return ret
-  }
-
-  emit (ev, data) {
-    switch (ev) {
-      case 'prefinish':
-      case 'finish':
-        break
-
-      case 'drain':
-        if (typeof this[_fd] === 'number')
-          this[_read]()
-        break
-
-      default:
-        return super.emit(ev, data)
-    }
-  }
-}
-
-class ReadStreamSync extends ReadStream {
-  [_open] () {
-    let threw = true
-    try {
-      this[_onopen](null, fs.openSync(this[_path], 'r'))
-      threw = false
-    } finally {
-      if (threw)
-        this[_close]()
-    }
-  }
-
-  [_read] () {
-    let threw = true
-    try {
-      if (!this[_reading]) {
-        this[_reading] = true
-        do {
-          const buf = this[_makeBuf]()
-          /* istanbul ignore next */
-          const br = buf.length === 0 ? 0 : fs.readSync(this[_fd], buf, 0, buf.length, null)
-          if (!this[_handleChunk](br, buf))
-            break
-        } while (true)
-        this[_reading] = false
-      }
-      threw = false
-    } finally {
-      if (threw)
-        this[_close]()
-    }
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      try {
-        fs.closeSync(this[_fd])
-      } catch (er) {}
-      this[_fd] = null
-      this.emit('close')
-    }
-  }
-}
-
-class WriteStream extends EE {
-  constructor (path, opt) {
-    opt = opt || {}
-    super(opt)
-    this.readable = false
-    this[_writing] = false
-    this[_ended] = false
-    this[_needDrain] = false
-    this[_queue] = []
-    this[_path] = path
-    this[_fd] = typeof opt.fd === 'number' ? opt.fd : null
-    this[_mode] = opt.mode === undefined ? 0o666 : opt.mode
-    this[_pos] = typeof opt.start === 'number' ? opt.start : null
-    this[_autoClose] = typeof opt.autoClose === 'boolean' ?
-      opt.autoClose : true
-
-    // truncating makes no sense when writing into the middle
-    const defaultFlag = this[_pos] !== null ? 'r+' : 'w'
-    this[_defaultFlag] = opt.flags === undefined
-    this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags
-
-    if (this[_fd] === null)
-      this[_open]()
-  }
-
-  get fd () { return this[_fd] }
-  get path () { return this[_path] }
-
-  [_onerror] (er) {
-    this[_close]()
-    this[_writing] = true
-    this.emit('error', er)
-  }
-
-  [_open] () {
-    fs.open(this[_path], this[_flags], this[_mode],
-      (er, fd) => this[_onopen](er, fd))
-  }
-
-  [_onopen] (er, fd) {
-    if (this[_defaultFlag] &&
-        this[_flags] === 'r+' &&
-        er && er.code === 'ENOENT') {
-      this[_flags] = 'w'
-      this[_open]()
-    } else if (er)
-      this[_onerror](er)
-    else {
-      this[_fd] = fd
-      this.emit('open', fd)
-      this[_flush]()
-    }
-  }
-
-  end (buf, enc) {
-    if (buf)
-      this.write(buf, enc)
-
-    this[_ended] = true
-
-    // synthetic after-write logic, where drain/finish live
-    if (!this[_writing] && !this[_queue].length &&
-        typeof this[_fd] === 'number')
-      this[_onwrite](null, 0)
-  }
-
-  write (buf, enc) {
-    if (typeof buf === 'string')
-      buf = new Buffer(buf, enc)
-
-    if (this[_ended]) {
-      this.emit('error', new Error('write() after end()'))
-      return false
-    }
-
-    if (this[_fd] === null || this[_writing] || this[_queue].length) {
-      this[_queue].push(buf)
-      this[_needDrain] = true
-      return false
-    }
-
-    this[_writing] = true
-    this[_write](buf)
-    return true
-  }
-
-  [_write] (buf) {
-    fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) =>
-      this[_onwrite](er, bw))
-  }
-
-  [_onwrite] (er, bw) {
-    if (er)
-      this[_onerror](er)
-    else {
-      if (this[_pos] !== null)
-        this[_pos] += bw
-      if (this[_queue].length)
-        this[_flush]()
-      else {
-        this[_writing] = false
-
-        if (this[_ended] && !this[_finished]) {
-          this[_finished] = true
-          this[_close]()
-          this.emit('finish')
-        } else if (this[_needDrain]) {
-          this[_needDrain] = false
-          this.emit('drain')
-        }
-      }
-    }
-  }
-
-  [_flush] () {
-    if (this[_queue].length === 0) {
-      if (this[_ended])
-        this[_onwrite](null, 0)
-    } else if (this[_queue].length === 1)
-      this[_write](this[_queue].pop())
-    else {
-      const iovec = this[_queue]
-      this[_queue] = []
-      writev(this[_fd], iovec, this[_pos],
-        (er, bw) => this[_onwrite](er, bw))
-    }
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      fs.close(this[_fd], _ => this.emit('close'))
-      this[_fd] = null
-    }
-  }
-}
-
-class WriteStreamSync extends WriteStream {
-  [_open] () {
-    let fd
-    try {
-      fd = fs.openSync(this[_path], this[_flags], this[_mode])
-    } catch (er) {
-      if (this[_defaultFlag] &&
-          this[_flags] === 'r+' &&
-          er && er.code === 'ENOENT') {
-        this[_flags] = 'w'
-        return this[_open]()
-      } else
-        throw er
-    }
-    this[_onopen](null, fd)
-  }
-
-  [_close] () {
-    if (this[_autoClose] && typeof this[_fd] === 'number') {
-      try {
-        fs.closeSync(this[_fd])
-      } catch (er) {}
-      this[_fd] = null
-      this.emit('close')
-    }
-  }
-
-  [_write] (buf) {
-    try {
-      this[_onwrite](null,
-        fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]))
-    } catch (er) {
-      this[_onwrite](er, 0)
-    }
-  }
-}
-
-const writev = (fd, iovec, pos, cb) => {
-  const done = (er, bw) => cb(er, bw, iovec)
-  const req = new FSReqWrap()
-  req.oncomplete = done
-  binding.writeBuffers(fd, iovec, pos, req)
-}
-
-exports.ReadStream = ReadStream
-exports.ReadStreamSync = ReadStreamSync
-
-exports.WriteStream = WriteStream
-exports.WriteStreamSync = WriteStreamSync
diff --git a/legacy-libs/grpc/node_modules/fs-minipass/package.json b/legacy-libs/grpc/node_modules/fs-minipass/package.json
deleted file mode 100644 (file)
index 008d02b..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-{
-  "_from": "fs-minipass@^1.2.5",
-  "_id": "fs-minipass@1.2.6",
-  "_inBundle": false,
-  "_integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==",
-  "_location": "/grpc/fs-minipass",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "fs-minipass@^1.2.5",
-    "name": "fs-minipass",
-    "escapedName": "fs-minipass",
-    "rawSpec": "^1.2.5",
-    "saveSpec": null,
-    "fetchSpec": "^1.2.5"
-  },
-  "_requiredBy": [
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz",
-  "_shasum": "2c5cc30ded81282bfe8a0d7c7c1853ddeb102c07",
-  "_shrinkwrap": null,
-  "_spec": "fs-minipass@^1.2.5",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/fs-minipass/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "minipass": "^2.2.1"
-  },
-  "deprecated": false,
-  "description": "fs read and write streams based on minipass",
-  "devDependencies": {
-    "mutate-fs": "^2.0.1",
-    "tap": "^13.1.9"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/npm/fs-minipass#readme",
-  "keywords": [],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "fs-minipass",
-  "optionalDependencies": {},
-  "readme": "# fs-minipass\n\nFilesystem streams based on [minipass](http://npm.im/minipass).\n\n4 classes are exported:\n\n- ReadStream\n- ReadStreamSync\n- WriteStream\n- WriteStreamSync\n\nWhen using `ReadStreamSync`, all of the data is made available\nimmediately upon consuming the stream.  Nothing is buffered in memory\nwhen the stream is constructed.  If the stream is piped to a writer,\nthen it will synchronously `read()` and emit data into the writer as\nfast as the writer can consume it.  (That is, it will respect\nbackpressure.)  If you call `stream.read()` then it will read the\nentire file and return the contents.\n\nWhen using `WriteStreamSync`, every write is flushed to the file\nsynchronously.  If your writes all come in a single tick, then it'll\nwrite it all out in a single tick.  It's as synchronous as you are.\n\nThe async versions work much like their node builtin counterparts,\nwith the exception of introducing significantly less Stream machinery\noverhead.\n\n## USAGE\n\nIt's just streams, you pipe them or read() them or write() to them.\n\n```js\nconst fsm = require('fs-minipass')\nconst readStream = new fsm.ReadStream('file.txt')\nconst writeStream = new fsm.WriteStream('output.txt')\nwriteStream.write('some file header or whatever\\n')\nreadStream.pipe(writeStream)\n```\n\n## ReadStream(path, options)\n\nPath string is required, but somewhat irrelevant if an open file\ndescriptor is passed in as an option.\n\nOptions:\n\n- `fd` Pass in a numeric file descriptor, if the file is already open.\n- `readSize` The size of reads to do, defaults to 16MB\n- `size` The size of the file, if known.  Prevents zero-byte read()\n  call at the end.\n- `autoClose` Set to `false` to prevent the file descriptor from being\n  closed when the file is done being read.\n\n## WriteStream(path, options)\n\nPath string is required, but somewhat irrelevant if an open file\ndescriptor is passed in as an option.\n\nOptions:\n\n- `fd` Pass in a numeric file descriptor, if the file is already open.\n- `mode` The mode to create the file with. Defaults to `0o666`.\n- `start` The position in the file to start reading.  If not\n  specified, then the file will start writing at position zero, and be\n  truncated by default.\n- `autoClose` Set to `false` to prevent the file descriptor from being\n  closed when the stream is ended.\n- `flags` Flags to use when opening the file.  Irrelevant if `fd` is\n  passed in, since file won't be opened in that case.  Defaults to\n  `'a'` if a `pos` is specified, or `'w'` otherwise.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/fs-minipass.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --follow-tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap"
-  },
-  "tap": {
-    "check-coverage": true
-  },
-  "version": "1.2.6"
-}
diff --git a/legacy-libs/grpc/node_modules/fs.realpath/LICENSE b/legacy-libs/grpc/node_modules/fs.realpath/LICENSE
deleted file mode 100644 (file)
index 5bd884c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-----
-
-This library bundles a version of the `fs.realpath` and `fs.realpathSync`
-methods from Node.js v0.10 under the terms of the Node.js MIT license.
-
-Node's license follows, also included at the header of `old.js` which contains
-the licensed code:
-
-  Copyright Joyent, Inc. and other Node contributors.
-
-  Permission is hereby granted, free of charge, to any person obtaining a
-  copy of this software and associated documentation files (the "Software"),
-  to deal in the Software without restriction, including without limitation
-  the rights to use, copy, modify, merge, publish, distribute, sublicense,
-  and/or sell copies of the Software, and to permit persons to whom the
-  Software is furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be included in
-  all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-  DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/fs.realpath/README.md b/legacy-libs/grpc/node_modules/fs.realpath/README.md
deleted file mode 100644 (file)
index a42ceac..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# fs.realpath
-
-A backwards-compatible fs.realpath for Node v6 and above
-
-In Node v6, the JavaScript implementation of fs.realpath was replaced
-with a faster (but less resilient) native implementation.  That raises
-new and platform-specific errors and cannot handle long or excessively
-symlink-looping paths.
-
-This module handles those cases by detecting the new errors and
-falling back to the JavaScript implementation.  On versions of Node
-prior to v6, it has no effect.
-
-## USAGE
-
-```js
-var rp = require('fs.realpath')
-
-// async version
-rp.realpath(someLongAndLoopingPath, function (er, real) {
-  // the ELOOP was handled, but it was a bit slower
-})
-
-// sync version
-var real = rp.realpathSync(someLongAndLoopingPath)
-
-// monkeypatch at your own risk!
-// This replaces the fs.realpath/fs.realpathSync builtins
-rp.monkeypatch()
-
-// un-do the monkeypatching
-rp.unmonkeypatch()
-```
diff --git a/legacy-libs/grpc/node_modules/fs.realpath/index.js b/legacy-libs/grpc/node_modules/fs.realpath/index.js
deleted file mode 100644 (file)
index b09c7c7..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-module.exports = realpath
-realpath.realpath = realpath
-realpath.sync = realpathSync
-realpath.realpathSync = realpathSync
-realpath.monkeypatch = monkeypatch
-realpath.unmonkeypatch = unmonkeypatch
-
-var fs = require('fs')
-var origRealpath = fs.realpath
-var origRealpathSync = fs.realpathSync
-
-var version = process.version
-var ok = /^v[0-5]\./.test(version)
-var old = require('./old.js')
-
-function newError (er) {
-  return er && er.syscall === 'realpath' && (
-    er.code === 'ELOOP' ||
-    er.code === 'ENOMEM' ||
-    er.code === 'ENAMETOOLONG'
-  )
-}
-
-function realpath (p, cache, cb) {
-  if (ok) {
-    return origRealpath(p, cache, cb)
-  }
-
-  if (typeof cache === 'function') {
-    cb = cache
-    cache = null
-  }
-  origRealpath(p, cache, function (er, result) {
-    if (newError(er)) {
-      old.realpath(p, cache, cb)
-    } else {
-      cb(er, result)
-    }
-  })
-}
-
-function realpathSync (p, cache) {
-  if (ok) {
-    return origRealpathSync(p, cache)
-  }
-
-  try {
-    return origRealpathSync(p, cache)
-  } catch (er) {
-    if (newError(er)) {
-      return old.realpathSync(p, cache)
-    } else {
-      throw er
-    }
-  }
-}
-
-function monkeypatch () {
-  fs.realpath = realpath
-  fs.realpathSync = realpathSync
-}
-
-function unmonkeypatch () {
-  fs.realpath = origRealpath
-  fs.realpathSync = origRealpathSync
-}
diff --git a/legacy-libs/grpc/node_modules/fs.realpath/old.js b/legacy-libs/grpc/node_modules/fs.realpath/old.js
deleted file mode 100644 (file)
index b40305e..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var pathModule = require('path');
-var isWindows = process.platform === 'win32';
-var fs = require('fs');
-
-// JavaScript implementation of realpath, ported from node pre-v6
-
-var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
-
-function rethrow() {
-  // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
-  // is fairly slow to generate.
-  var callback;
-  if (DEBUG) {
-    var backtrace = new Error;
-    callback = debugCallback;
-  } else
-    callback = missingCallback;
-
-  return callback;
-
-  function debugCallback(err) {
-    if (err) {
-      backtrace.message = err.message;
-      err = backtrace;
-      missingCallback(err);
-    }
-  }
-
-  function missingCallback(err) {
-    if (err) {
-      if (process.throwDeprecation)
-        throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
-      else if (!process.noDeprecation) {
-        var msg = 'fs: missing callback ' + (err.stack || err.message);
-        if (process.traceDeprecation)
-          console.trace(msg);
-        else
-          console.error(msg);
-      }
-    }
-  }
-}
-
-function maybeCallback(cb) {
-  return typeof cb === 'function' ? cb : rethrow();
-}
-
-var normalize = pathModule.normalize;
-
-// Regexp that finds the next partion of a (partial) path
-// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
-if (isWindows) {
-  var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
-} else {
-  var nextPartRe = /(.*?)(?:[\/]+|$)/g;
-}
-
-// Regex to find the device root, including trailing slash. E.g. 'c:\\'.
-if (isWindows) {
-  var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
-} else {
-  var splitRootRe = /^[\/]*/;
-}
-
-exports.realpathSync = function realpathSync(p, cache) {
-  // make p is absolute
-  p = pathModule.resolve(p);
-
-  if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
-    return cache[p];
-  }
-
-  var original = p,
-      seenLinks = {},
-      knownHard = {};
-
-  // current character position in p
-  var pos;
-  // the partial path so far, including a trailing slash if any
-  var current;
-  // the partial path without a trailing slash (except when pointing at a root)
-  var base;
-  // the partial path scanned in the previous round, with slash
-  var previous;
-
-  start();
-
-  function start() {
-    // Skip over roots
-    var m = splitRootRe.exec(p);
-    pos = m[0].length;
-    current = m[0];
-    base = m[0];
-    previous = '';
-
-    // On windows, check that the root exists. On unix there is no need.
-    if (isWindows && !knownHard[base]) {
-      fs.lstatSync(base);
-      knownHard[base] = true;
-    }
-  }
-
-  // walk down the path, swapping out linked pathparts for their real
-  // values
-  // NB: p.length changes.
-  while (pos < p.length) {
-    // find the next part
-    nextPartRe.lastIndex = pos;
-    var result = nextPartRe.exec(p);
-    previous = current;
-    current += result[0];
-    base = previous + result[1];
-    pos = nextPartRe.lastIndex;
-
-    // continue if not a symlink
-    if (knownHard[base] || (cache && cache[base] === base)) {
-      continue;
-    }
-
-    var resolvedLink;
-    if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
-      // some known symbolic link.  no need to stat again.
-      resolvedLink = cache[base];
-    } else {
-      var stat = fs.lstatSync(base);
-      if (!stat.isSymbolicLink()) {
-        knownHard[base] = true;
-        if (cache) cache[base] = base;
-        continue;
-      }
-
-      // read the link if it wasn't read before
-      // dev/ino always return 0 on windows, so skip the check.
-      var linkTarget = null;
-      if (!isWindows) {
-        var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
-        if (seenLinks.hasOwnProperty(id)) {
-          linkTarget = seenLinks[id];
-        }
-      }
-      if (linkTarget === null) {
-        fs.statSync(base);
-        linkTarget = fs.readlinkSync(base);
-      }
-      resolvedLink = pathModule.resolve(previous, linkTarget);
-      // track this, if given a cache.
-      if (cache) cache[base] = resolvedLink;
-      if (!isWindows) seenLinks[id] = linkTarget;
-    }
-
-    // resolve the link, then start over
-    p = pathModule.resolve(resolvedLink, p.slice(pos));
-    start();
-  }
-
-  if (cache) cache[original] = p;
-
-  return p;
-};
-
-
-exports.realpath = function realpath(p, cache, cb) {
-  if (typeof cb !== 'function') {
-    cb = maybeCallback(cache);
-    cache = null;
-  }
-
-  // make p is absolute
-  p = pathModule.resolve(p);
-
-  if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
-    return process.nextTick(cb.bind(null, null, cache[p]));
-  }
-
-  var original = p,
-      seenLinks = {},
-      knownHard = {};
-
-  // current character position in p
-  var pos;
-  // the partial path so far, including a trailing slash if any
-  var current;
-  // the partial path without a trailing slash (except when pointing at a root)
-  var base;
-  // the partial path scanned in the previous round, with slash
-  var previous;
-
-  start();
-
-  function start() {
-    // Skip over roots
-    var m = splitRootRe.exec(p);
-    pos = m[0].length;
-    current = m[0];
-    base = m[0];
-    previous = '';
-
-    // On windows, check that the root exists. On unix there is no need.
-    if (isWindows && !knownHard[base]) {
-      fs.lstat(base, function(err) {
-        if (err) return cb(err);
-        knownHard[base] = true;
-        LOOP();
-      });
-    } else {
-      process.nextTick(LOOP);
-    }
-  }
-
-  // walk down the path, swapping out linked pathparts for their real
-  // values
-  function LOOP() {
-    // stop if scanned past end of path
-    if (pos >= p.length) {
-      if (cache) cache[original] = p;
-      return cb(null, p);
-    }
-
-    // find the next part
-    nextPartRe.lastIndex = pos;
-    var result = nextPartRe.exec(p);
-    previous = current;
-    current += result[0];
-    base = previous + result[1];
-    pos = nextPartRe.lastIndex;
-
-    // continue if not a symlink
-    if (knownHard[base] || (cache && cache[base] === base)) {
-      return process.nextTick(LOOP);
-    }
-
-    if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
-      // known symbolic link.  no need to stat again.
-      return gotResolvedLink(cache[base]);
-    }
-
-    return fs.lstat(base, gotStat);
-  }
-
-  function gotStat(err, stat) {
-    if (err) return cb(err);
-
-    // if not a symlink, skip to the next path part
-    if (!stat.isSymbolicLink()) {
-      knownHard[base] = true;
-      if (cache) cache[base] = base;
-      return process.nextTick(LOOP);
-    }
-
-    // stat & read the link if not read before
-    // call gotTarget as soon as the link target is known
-    // dev/ino always return 0 on windows, so skip the check.
-    if (!isWindows) {
-      var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
-      if (seenLinks.hasOwnProperty(id)) {
-        return gotTarget(null, seenLinks[id], base);
-      }
-    }
-    fs.stat(base, function(err) {
-      if (err) return cb(err);
-
-      fs.readlink(base, function(err, target) {
-        if (!isWindows) seenLinks[id] = target;
-        gotTarget(err, target);
-      });
-    });
-  }
-
-  function gotTarget(err, target, base) {
-    if (err) return cb(err);
-
-    var resolvedLink = pathModule.resolve(previous, target);
-    if (cache) cache[base] = resolvedLink;
-    gotResolvedLink(resolvedLink);
-  }
-
-  function gotResolvedLink(resolvedLink) {
-    // resolve the link, then start over
-    p = pathModule.resolve(resolvedLink, p.slice(pos));
-    start();
-  }
-};
diff --git a/legacy-libs/grpc/node_modules/fs.realpath/package.json b/legacy-libs/grpc/node_modules/fs.realpath/package.json
deleted file mode 100644 (file)
index 88ff784..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-{
-  "_args": [
-    [
-      "fs.realpath@1.0.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "fs.realpath@1.0.0",
-  "_id": "fs.realpath@1.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
-  "_location": "/grpc/fs.realpath",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "fs.realpath@1.0.0",
-    "name": "fs.realpath",
-    "escapedName": "fs.realpath",
-    "rawSpec": "1.0.0",
-    "saveSpec": null,
-    "fetchSpec": "1.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/rimraf/glob"
-  ],
-  "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/fs.realpath/issues"
-  },
-  "dependencies": {},
-  "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails",
-  "devDependencies": {},
-  "files": [
-    "old.js",
-    "index.js"
-  ],
-  "homepage": "https://github.com/isaacs/fs.realpath#readme",
-  "keywords": [
-    "realpath",
-    "fs",
-    "polyfill"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "fs.realpath",
-  "optionalDependencies": {},
-  "readme": "# fs.realpath\n\nA backwards-compatible fs.realpath for Node v6 and above\n\nIn Node v6, the JavaScript implementation of fs.realpath was replaced\nwith a faster (but less resilient) native implementation.  That raises\nnew and platform-specific errors and cannot handle long or excessively\nsymlink-looping paths.\n\nThis module handles those cases by detecting the new errors and\nfalling back to the JavaScript implementation.  On versions of Node\nprior to v6, it has no effect.\n\n## USAGE\n\n```js\nvar rp = require('fs.realpath')\n\n// async version\nrp.realpath(someLongAndLoopingPath, function (er, real) {\n  // the ELOOP was handled, but it was a bit slower\n})\n\n// sync version\nvar real = rp.realpathSync(someLongAndLoopingPath)\n\n// monkeypatch at your own risk!\n// This replaces the fs.realpath/fs.realpathSync builtins\nrp.monkeypatch()\n\n// un-do the monkeypatching\nrp.unmonkeypatch()\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/isaacs/fs.realpath.git"
-  },
-  "scripts": {
-    "test": "tap test/*.js --cov"
-  },
-  "version": "1.0.0"
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/CHANGELOG.md b/legacy-libs/grpc/node_modules/gauge/CHANGELOG.md
deleted file mode 100644 (file)
index 407bc19..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-### v2.7.4
-
-* Reset colors prior to ending a line, to eliminate flicker when a line
-  is trucated between start and end color sequences.
-
-### v2.7.3
-
-* Only create our onExit handler when we're enabled and remove it when we're
-  disabled.  This stops us from creating multiple onExit handlers when
-  multiple gauge objects are being used.
-* Fix bug where if a theme name were given instead of a theme object, it
-  would crash.
-* Remove supports-color because it's not actually used.  Uhm.  Yes, I just
-  updated it.  >.>
-
-### v2.7.2
-
-* Use supports-color instead of has-color (as the module has been renamed)
-
-### v2.7.1
-
-* Bug fix: Calls to show/pulse while the progress bar is disabled should still
-  update our internal representation of what would be shown should it be enabled.
-
-### v2.7.0
-
-* New feature: Add new `isEnabled` method to allow introspection of the gauge's
-  "enabledness" as controlled by `.enable()` and `.disable()`.
-
-### v2.6.0
-
-* Bug fix: Don't run the code associated with `enable`/`disable` if the gauge
-  is already enabled or disabled respectively.  This prevents leaking event
-  listeners, amongst other weirdness.
-* New feature: Template items can have default values that will be used if no
-  value was otherwise passed in.
-
-### v2.5.3
-
-* Default to `enabled` only if we have a tty.  Users can always override
-  this by passing in the `enabled` option explicitly or by calling calling
-  `gauge.enable()`.
-
-### v2.5.2
-
-* Externalized `./console-strings.js` into `console-control-strings`.
-
-### v2.5.1
-
-* Update to `signal-exit@3.0.0`, which fixes a compatibility bug with the
-  node profiler.
-* [#39](https://github.com/iarna/gauge/pull/39) Fix tests on 0.10 and add
-  a missing devDependency. ([@helloyou2012](https://github.com/helloyou2012))
-
-### v2.5.0
-
-* Add way to programmatically fetch a list of theme names in a themeset
-  (`Themeset.getThemeNames`).
-
-### v2.4.0
-
-* Add support for setting themesets on existing gauge objects.
-* Add post-IO callback to `gauge.hide()` as it is somtetimes necessary when
-  your terminal is interleaving output from multiple filehandles (ie, stdout
-  & stderr).
-
-### v2.3.1
-
-* Fix a refactor bug in setTheme where it wasn't accepting the various types
-  of args it should.
-
-### v2.3.0
-
-#### FEATURES
-
-* Add setTemplate & setTheme back in.
-* Add support for named themes, you can now ask for things like 'colorASCII'
-  and 'brailleSpinner'.  Of course, you can still pass in theme objects.
-  Additionally you can now pass in an object with `hasUnicode`, `hasColor` and
-  `platform` keys in order to override our guesses as to those values when
-  selecting a default theme from the themeset.
-* Make the output stream optional (it defaults to `process.stderr` now).
-* Add `setWriteTo(stream[, tty])` to change the output stream and,
-  optionally, tty.
-
-#### BUG FIXES & REFACTORING
-
-* Abort the display phase early if we're supposed to be hidden and we are.
-* Stop printing a bunch of spaces at the end of lines, since we're already
-  using an erase-to-end-of-line code anyway.
-* The unicode themes were missing the subsection separator.
-
-### v2.2.1
-
-* Fix image in readme
-
-### v2.2.0
-
-* All new themes API– reference themes by name and pass in custom themes and
-  themesets (themesets get platform support autodetection done on them to
-  select the best theme).  Theme mixins let you add features to all existing
-  themes.
-* Much, much improved test coverage.
-
-### v2.1.0
-
-* Got rid of ░ in the default platform, noUnicode, hasColor theme.  Thanks
-  to @yongtw123 for pointing out this had snuck in.
-* Fiddled with the demo output to make it easier to see the spinner spin. Also
-  added prints before each platforms test output.
-* I forgot to include `signal-exit` in our deps.  <.< Thank you @KenanY for
-  finding this. Then I was lazy and made a new commit instead of using his
-  PR. Again, thank you for your patience @KenenY.
-* Drastically speed up travis testing.
-* Add a small javascript demo (demo.js) for showing off the various themes
-  (and testing them on diff platforms).
-* Change: The subsection separator from ⁄ and / (different chars) to >.
-* Fix crasher: A show or pulse without a label would cause the template renderer
-  to complain about a missing value.
-* New feature: Add the ability to disable the clean-up-on-exit behavior.
-  Not something I expect to be widely desirable, but important if you have
-  multiple distinct gauge instances in your app.
-* Use our own color support detection.
-  The `has-color` module proved too magic for my needs, making assumptions
-  as to which stream we write to and reading command line arguments.
-
-### v2.0.0
-
-This is a major rewrite of the internals.  Externally there are fewer
-changes:
-
-* On node>0.8 gauge object now prints updates at a fixed rate.  This means
-  that when you call `show` it may wate up to `updateInterval` ms before it
-  actually prints an update.  You override this behavior with the
-  `fixedFramerate` option.
-* The gauge object now keeps the cursor hidden as long as it's enabled and
-  shown.
-* The constructor's arguments have changed, now it takes a mandatory output
-  stream and an optional options object.  The stream no longer needs to be
-  an `ansi`ified stream, although it can be if you want (but we won't make
-  use of its special features).
-* Previously the gauge was disabled by default if `process.stdout` wasn't a
-  tty.  Now it always defaults to enabled.  If you want the previous
-  behavior set the `enabled` option to `process.stdout.isTTY`.
-* The constructor's options have changed– see the docs for details.
-* Themes are entirely different.  If you were using a custom theme, or
-  referring to one directly (eg via `Gauge.unicode` or `Gauge.ascii`) then
-  you'll need to change your code.  You can get the equivalent of the latter
-  with:
-  ```
-  var themes = require('gauge/themes')
-  var unicodeTheme = themes(true, true) // returns the color unicode theme for your platform
-  ```
-  The default themes no longer use any ambiguous width characters, so even
-  if you choose to display those as wide your progress bar should still
-  display correctly.
-* Templates are entirely different and if you were using a custom one, you
-  should consult the documentation to learn how to recreate it.  If you were
-  using the default, be aware that it has changed and the result looks quite
-  a bit different.
diff --git a/legacy-libs/grpc/node_modules/gauge/LICENSE b/legacy-libs/grpc/node_modules/gauge/LICENSE
deleted file mode 100644 (file)
index e756052..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2014, Rebecca Turner <me@re-becca.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/gauge/README.md b/legacy-libs/grpc/node_modules/gauge/README.md
deleted file mode 100644 (file)
index bdd60e3..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-gauge
-=====
-
-A nearly stateless terminal based horizontal gauge / progress bar.
-
-```javascript
-var Gauge = require("gauge")
-
-var gauge = new Gauge()
-
-gauge.show("test", 0.20)
-
-gauge.pulse("this")
-
-gauge.hide()
-```
-
-![](gauge-demo.gif)
-
-
-### CHANGES FROM 1.x
-
-Gauge 2.x is breaking release, please see the [changelog] for details on
-what's changed if you were previously a user of this module.
-
-[changelog]: CHANGELOG.md
-
-### THE GAUGE CLASS
-
-This is the typical interface to the module– it provides a pretty
-fire-and-forget interface to displaying your status information.
-
-```
-var Gauge = require("gauge")
-
-var gauge = new Gauge([stream], [options])
-```
-
-* **stream** – *(optional, default STDERR)* A stream that progress bar
-  updates are to be written to.  Gauge honors backpressure and will pause
-  most writing if it is indicated.
-* **options** – *(optional)* An option object.
-
-Constructs a new gauge. Gauges are drawn on a single line, and are not drawn
-if **stream** isn't a tty and a tty isn't explicitly provided.
-
-If **stream** is a terminal or if you pass in **tty** to **options** then we
-will detect terminal resizes and redraw to fit.  We do this by watching for
-`resize` events on the tty.  (To work around a bug in verisons of Node prior
-to 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to
-larger window sizes will be clean, but shrinking the window will always
-result in some cruft.
-
-**IMPORTANT:** If you prevously were passing in a non-tty stream but you still
-want output (for example, a stream wrapped by the `ansi` module) then you
-need to pass in the **tty** option below, as `gauge` needs access to
-the underlying tty in order to do things like terminal resizes and terminal
-width detection.
-
-The **options** object can have the following properties, all of which are
-optional:
-
-* **updateInterval**: How often gauge updates should be drawn, in miliseconds.
-* **fixedFramerate**: Defaults to false on node 0.8, true on everything
-  else.  When this is true a timer is created to trigger once every
-  `updateInterval` ms, when false, updates are printed as soon as they come
-  in but updates more often than `updateInterval` are ignored.  The reason
-  0.8 doesn't have this set to true is that it can't `unref` its timer and
-  so it would stop your program from exiting– if you want to use this
-  feature with 0.8 just make sure you call `gauge.disable()` before you
-  expect your program to exit.
-* **themes**: A themeset to use when selecting the theme to use. Defaults
-  to `gauge/themes`, see the [themes] documentation for details.
-* **theme**: Select a theme for use, it can be a:
-  * Theme object, in which case the **themes** is not used.
-  * The name of a theme, which will be looked up in the current *themes*
-    object.
-  * A configuration object with any of `hasUnicode`, `hasColor` or
-    `platform` keys, which if wlll be used to override our guesses when making
-    a default theme selection.
-
-  If no theme is selected then a default is picked using a combination of our
-  best guesses at your OS, color support and unicode support.
-* **template**: Describes what you want your gauge to look like.  The
-  default is what npm uses.  Detailed [documentation] is later in this
-  document.
-* **hideCursor**: Defaults to true.  If true, then the cursor will be hidden
-  while the gauge is displayed.
-* **tty**: The tty that you're ultimately writing to.  Defaults to the same
-  as **stream**.  This is used for detecting the width of the terminal and
-  resizes. The width used is `tty.columns - 1`. If no tty is available then
-  a width of `79` is assumed.
-* **enabled**: Defaults to true if `tty` is a TTY, false otherwise.  If true
-  the gauge starts enabled.  If disabled then all update commands are
-  ignored and no gauge will be printed until you call `.enable()`.
-* **Plumbing**: The class to use to actually generate the gauge for
-  printing.  This defaults to `require('gauge/plumbing')` and ordinarly you
-  shouldn't need to override this.
-* **cleanupOnExit**: Defaults to true. Ordinarily we register an exit
-  handler to make sure your cursor is turned back on and the progress bar
-  erased when your process exits, even if you Ctrl-C out or otherwise exit
-  unexpectedly. You can disable this and it won't register the exit handler.
-
-[has-unicode]: https://www.npmjs.com/package/has-unicode
-[themes]: #themes
-[documentation]: #templates
-
-#### `gauge.show(section | status, [completed])`
-
-The first argument is either the section, the name of the current thing
-contributing to progress, or an object with keys like **section**,
-**subsection** & **completed** (or any others you have types for in a custom
-template).  If you don't want to update or set any of these you can pass
-`null` and it will be ignored.
-
-The second argument is the percent completed as a value between 0 and 1.
-Without it, completion is just not updated. You'll also note that completion
-can be passed in as part of a status object as the first argument. If both
-it and the completed argument are passed in, the completed argument wins.
-
-#### `gauge.hide([cb])`
-
-Removes the gauge from the terminal.  Optionally, callback `cb` after IO has
-had an opportunity to happen (currently this just means after `setImmediate`
-has called back.)
-
-It turns out this is important when you're pausing the progress bar on one
-filehandle and printing to another– otherwise (with a big enough print) node
-can end up printing the "end progress bar" bits to the progress bar filehandle
-while other stuff is printing to another filehandle. These getting interleaved
-can cause corruption in some terminals.
-
-#### `gauge.pulse([subsection])`
-
-* **subsection** – *(optional)* The specific thing that triggered this pulse
-
-Spins the spinner in the gauge to show output.  If **subsection** is
-included then it will be combined with the last name passed to `gauge.show`.
-
-#### `gauge.disable()`
-
-Hides the gauge and ignores further calls to `show` or `pulse`.
-
-#### `gauge.enable()`
-
-Shows the gauge and resumes updating when `show` or `pulse` is called.
-
-#### `gauge.isEnabled()`
-
-Returns true if the gauge is enabled.
-
-#### `gauge.setThemeset(themes)`
-
-Change the themeset to select a theme from. The same as the `themes` option
-used in the constructor. The theme will be reselected from this themeset.
-
-#### `gauge.setTheme(theme)`
-
-Change the active theme, will be displayed with the next show or pulse. This can be:
-
-* Theme object, in which case the **themes** is not used.
-* The name of a theme, which will be looked up in the current *themes*
-  object.
-* A configuration object with any of `hasUnicode`, `hasColor` or
-  `platform` keys, which if wlll be used to override our guesses when making
-  a default theme selection.
-
-If no theme is selected then a default is picked using a combination of our
-best guesses at your OS, color support and unicode support.
-
-#### `gauge.setTemplate(template)`
-
-Change the active template, will be displayed with the next show or pulse
-
-### Tracking Completion
-
-If you have more than one thing going on that you want to track completion
-of, you may find the related [are-we-there-yet] helpful.  It's `change`
-event can be wired up to the `show` method to get a more traditional
-progress bar interface.
-
-[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet
-
-### THEMES
-
-```
-var themes = require('gauge/themes')
-
-// fetch the default color unicode theme for this platform
-var ourTheme = themes({hasUnicode: true, hasColor: true})
-
-// fetch the default non-color unicode theme for osx
-var ourTheme = themes({hasUnicode: true, hasColor: false, platform: 'darwin'})
-
-// create a new theme based on the color ascii theme for this platform
-// that brackets the progress bar with arrows
-var ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), {
-  preProgressbar: '→',
-  postProgressbar: '←'
-})
-```
-
-The object returned by `gauge/themes` is an instance of the `ThemeSet` class.
-
-```
-var ThemeSet = require('gauge/theme-set')
-var themes = new ThemeSet()
-// or
-var themes = require('gauge/themes')
-var mythemes = themes.newThemeset() // creates a new themeset based on the default themes
-```
-
-#### themes(opts)
-#### themes.getDefault(opts)
-
-Theme objects are a function that fetches the default theme based on
-platform, unicode and color support.
-
-Options is an object with the following properties:
-
-* **hasUnicode** - If true, fetch a unicode theme, if no unicode theme is
-  available then a non-unicode theme will be used.
-* **hasColor** - If true, fetch a color theme, if no color theme is
-  available a non-color theme will be used.
-* **platform** (optional) - Defaults to `process.platform`.  If no
-  platform match is available then `fallback` is used instead.
-
-If no compatible theme can be found then an error will be thrown with a
-`code` of `EMISSINGTHEME`.
-
-#### themes.addTheme(themeName, themeObj)
-#### themes.addTheme(themeName, [parentTheme], newTheme)
-
-Adds a named theme to the themeset.  You can pass in either a theme object,
-as returned by `themes.newTheme` or the arguments you'd pass to
-`themes.newTheme`.
-
-#### themes.getThemeNames()
-
-Return a list of all of the names of the themes in this themeset. Suitable
-for use in `themes.getTheme(…)`.
-
-#### themes.getTheme(name)
-
-Returns the theme object from this theme set named `name`.
-
-If `name` does not exist in this themeset an error will be thrown with
-a `code` of `EMISSINGTHEME`.
-
-#### themes.setDefault([opts], themeName)
-
-`opts` is an object with the following properties.
-
-* **platform** - Defaults to `'fallback'`.  If your theme is platform
-  specific, specify that here with the platform from `process.platform`, eg,
-  `win32`, `darwin`, etc.
-* **hasUnicode** - Defaults to `false`. If your theme uses unicode you
-  should set this to true.
-* **hasColor** - Defaults to `false`.  If your theme uses color you should
-  set this to true.
-
-`themeName` is the name of the theme (as given to `addTheme`) to use for
-this set of `opts`.
-
-#### themes.newTheme([parentTheme,] newTheme)
-
-Create a new theme object based on `parentTheme`.  If no `parentTheme` is
-provided then a minimal parentTheme that defines functions for rendering the
-activity indicator (spinner) and progress bar will be defined. (This
-fallback parent is defined in `gauge/base-theme`.)
-
-newTheme should be a bare object– we'll start by discussing the properties
-defined by the default themes:
-
-* **preProgressbar** - displayed prior to the progress bar, if the progress
-  bar is displayed.
-* **postProgressbar** - displayed after the progress bar, if the progress bar
-  is displayed.
-* **progressBarTheme** - The subtheme passed through to the progress bar
-  renderer, it's an object with `complete` and `remaining` properties
-  that are the strings you want repeated for those sections of the progress
-  bar.
-* **activityIndicatorTheme** - The theme for the activity indicator (spinner),
-  this can either be a string, in which each character is a different step, or
-  an array of strings.
-* **preSubsection** - Displayed as a separator between the `section` and
-  `subsection` when the latter is printed.
-
-More generally, themes can have any value that would be a valid value when rendering
-templates. The properties in the theme are used when their name matches a type in
-the template. Their values can be:
-
-* **strings & numbers** - They'll be included as is
-* **function (values, theme, width)** - Should return what you want in your output.
-  *values* is an object with values provided via `gauge.show`,
-  *theme* is the theme specific to this item (see below) or this theme object,
-  and *width* is the number of characters wide your result should be.
-
-There are a couple of special prefixes:
-
-* **pre** - Is shown prior to the property, if its displayed.
-* **post** - Is shown after the property, if its displayed.
-
-And one special suffix:
-
-* **Theme** - Its value is passed to a function-type item as the theme.
-
-#### themes.addToAllThemes(theme)
-
-This *mixes-in* `theme` into all themes currently defined. It also adds it
-to the default parent theme for this themeset, so future themes added to
-this themeset will get the values from `theme` by default.
-
-#### themes.newThemeset()
-
-Copy the current themeset into a new one.  This allows you to easily inherit
-one themeset from another.
-
-### TEMPLATES
-
-A template is an array of objects and strings that, after being evaluated,
-will be turned into the gauge line.  The default template is:
-
-```javascript
-[
-    {type: 'progressbar', length: 20},
-    {type: 'activityIndicator', kerning: 1, length: 1},
-    {type: 'section', kerning: 1, default: ''},
-    {type: 'subsection', kerning: 1, default: ''}
-]
-```
-
-The various template elements can either be **plain strings**, in which case they will
-be be included verbatum in the output, or objects with the following properties:
-
-* *type* can be any of the following plus any keys you pass into `gauge.show` plus
-  any keys you have on a custom theme.
-  * `section` – What big thing you're working on now.
-  * `subsection` – What component of that thing is currently working.
-  * `activityIndicator` – Shows a spinner using the `activityIndicatorTheme`
-    from your active theme.
-  * `progressbar` – A progress bar representing your current `completed`
-    using the `progressbarTheme` from your active theme.
-* *kerning* – Number of spaces that must be between this item and other
-  items, if this item is displayed at all.
-* *maxLength* – The maximum length for this element. If its value is longer it
-  will be truncated.
-* *minLength* – The minimum length for this element. If its value is shorter it
-  will be padded according to the *align* value.
-* *align* – (Default: left) Possible values "left", "right" and "center". Works
-  as you'd expect from word processors.
-* *length* – Provides a single value for both *minLength* and *maxLength*. If both
-  *length* and *minLength or *maxLength* are specifed then the latter take precedence.
-* *value* – A literal value to use for this template item.
-* *default* – A default value to use for this template item if a value
-  wasn't otherwise passed in.
-
-### PLUMBING
-
-This is the super simple, assume nothing, do no magic internals used by gauge to
-implement its ordinary interface.
-
-```
-var Plumbing = require('gauge/plumbing')
-var gauge = new Plumbing(theme, template, width)
-```
-
-* **theme**: The theme to use.
-* **template**: The template to use.
-* **width**: How wide your gauge should be
-
-#### `gauge.setTheme(theme)`
-
-Change the active theme.
-
-#### `gauge.setTemplate(template)`
-
-Change the active template.
-
-#### `gauge.setWidth(width)`
-
-Change the width to render at.
-
-#### `gauge.hide()`
-
-Return the string necessary to hide the progress bar
-
-#### `gauge.hideCursor()`
-
-Return a string to hide the cursor.
-
-#### `gauge.showCursor()`
-
-Return a string to show the cursor.
-
-#### `gauge.show(status)`
-
-Using `status` for values, render the provided template with the theme and return
-a string that is suitable for printing to update the gauge.
diff --git a/legacy-libs/grpc/node_modules/gauge/base-theme.js b/legacy-libs/grpc/node_modules/gauge/base-theme.js
deleted file mode 100644 (file)
index 0b67638..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-var spin = require('./spin.js')
-var progressBar = require('./progress-bar.js')
-
-module.exports = {
-  activityIndicator: function (values, theme, width) {
-    if (values.spun == null) return
-    return spin(theme, values.spun)
-  },
-  progressbar: function (values, theme, width) {
-    if (values.completed == null) return
-    return progressBar(theme, width, values.completed)
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/error.js b/legacy-libs/grpc/node_modules/gauge/error.js
deleted file mode 100644 (file)
index d9914ba..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict'
-var util = require('util')
-
-var User = exports.User = function User (msg) {
-  var err = new Error(msg)
-  Error.captureStackTrace(err, User)
-  err.code = 'EGAUGE'
-  return err
-}
-
-exports.MissingTemplateValue = function MissingTemplateValue (item, values) {
-  var err = new User(util.format('Missing template value "%s"', item.type))
-  Error.captureStackTrace(err, MissingTemplateValue)
-  err.template = item
-  err.values = values
-  return err
-}
-
-exports.Internal = function Internal (msg) {
-  var err = new Error(msg)
-  Error.captureStackTrace(err, Internal)
-  err.code = 'EGAUGEINTERNAL'
-  return err
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/has-color.js b/legacy-libs/grpc/node_modules/gauge/has-color.js
deleted file mode 100644 (file)
index e283a25..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-module.exports = isWin32() || isColorTerm()
-
-function isWin32 () {
-  return process.platform === 'win32'
-}
-
-function isColorTerm () {
-  var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i
-  return !!process.env.COLORTERM || termHasColor.test(process.env.TERM)
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/index.js b/legacy-libs/grpc/node_modules/gauge/index.js
deleted file mode 100644 (file)
index c553240..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-'use strict'
-var Plumbing = require('./plumbing.js')
-var hasUnicode = require('has-unicode')
-var hasColor = require('./has-color.js')
-var onExit = require('signal-exit')
-var defaultThemes = require('./themes')
-var setInterval = require('./set-interval.js')
-var process = require('./process.js')
-var setImmediate = require('./set-immediate')
-
-module.exports = Gauge
-
-function callWith (obj, method) {
-  return function () {
-    return method.call(obj)
-  }
-}
-
-function Gauge (arg1, arg2) {
-  var options, writeTo
-  if (arg1 && arg1.write) {
-    writeTo = arg1
-    options = arg2 || {}
-  } else if (arg2 && arg2.write) {
-    writeTo = arg2
-    options = arg1 || {}
-  } else {
-    writeTo = process.stderr
-    options = arg1 || arg2 || {}
-  }
-
-  this._status = {
-    spun: 0,
-    section: '',
-    subsection: ''
-  }
-  this._paused = false // are we paused for back pressure?
-  this._disabled = true // are all progress bar updates disabled?
-  this._showing = false // do we WANT the progress bar on screen
-  this._onScreen = false // IS the progress bar on screen
-  this._needsRedraw = false // should we print something at next tick?
-  this._hideCursor = options.hideCursor == null ? true : options.hideCursor
-  this._fixedFramerate = options.fixedFramerate == null
-    ? !(/^v0\.8\./.test(process.version))
-    : options.fixedFramerate
-  this._lastUpdateAt = null
-  this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval
-
-  this._themes = options.themes || defaultThemes
-  this._theme = options.theme
-  var theme = this._computeTheme(options.theme)
-  var template = options.template || [
-    {type: 'progressbar', length: 20},
-    {type: 'activityIndicator', kerning: 1, length: 1},
-    {type: 'section', kerning: 1, default: ''},
-    {type: 'subsection', kerning: 1, default: ''}
-  ]
-  this.setWriteTo(writeTo, options.tty)
-  var PlumbingClass = options.Plumbing || Plumbing
-  this._gauge = new PlumbingClass(theme, template, this.getWidth())
-
-  this._$$doRedraw = callWith(this, this._doRedraw)
-  this._$$handleSizeChange = callWith(this, this._handleSizeChange)
-
-  this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit
-  this._removeOnExit = null
-
-  if (options.enabled || (options.enabled == null && this._tty && this._tty.isTTY)) {
-    this.enable()
-  } else {
-    this.disable()
-  }
-}
-Gauge.prototype = {}
-
-Gauge.prototype.isEnabled = function () {
-  return !this._disabled
-}
-
-Gauge.prototype.setTemplate = function (template) {
-  this._gauge.setTemplate(template)
-  if (this._showing) this._requestRedraw()
-}
-
-Gauge.prototype._computeTheme = function (theme) {
-  if (!theme) theme = {}
-  if (typeof theme === 'string') {
-    theme = this._themes.getTheme(theme)
-  } else if (theme && (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null)) {
-    var useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode
-    var useColor = theme.hasColor == null ? hasColor : theme.hasColor
-    theme = this._themes.getDefault({hasUnicode: useUnicode, hasColor: useColor, platform: theme.platform})
-  }
-  return theme
-}
-
-Gauge.prototype.setThemeset = function (themes) {
-  this._themes = themes
-  this.setTheme(this._theme)
-}
-
-Gauge.prototype.setTheme = function (theme) {
-  this._gauge.setTheme(this._computeTheme(theme))
-  if (this._showing) this._requestRedraw()
-  this._theme = theme
-}
-
-Gauge.prototype._requestRedraw = function () {
-  this._needsRedraw = true
-  if (!this._fixedFramerate) this._doRedraw()
-}
-
-Gauge.prototype.getWidth = function () {
-  return ((this._tty && this._tty.columns) || 80) - 1
-}
-
-Gauge.prototype.setWriteTo = function (writeTo, tty) {
-  var enabled = !this._disabled
-  if (enabled) this.disable()
-  this._writeTo = writeTo
-  this._tty = tty ||
-    (writeTo === process.stderr && process.stdout.isTTY && process.stdout) ||
-    (writeTo.isTTY && writeTo) ||
-    this._tty
-  if (this._gauge) this._gauge.setWidth(this.getWidth())
-  if (enabled) this.enable()
-}
-
-Gauge.prototype.enable = function () {
-  if (!this._disabled) return
-  this._disabled = false
-  if (this._tty) this._enableEvents()
-  if (this._showing) this.show()
-}
-
-Gauge.prototype.disable = function () {
-  if (this._disabled) return
-  if (this._showing) {
-    this._lastUpdateAt = null
-    this._showing = false
-    this._doRedraw()
-    this._showing = true
-  }
-  this._disabled = true
-  if (this._tty) this._disableEvents()
-}
-
-Gauge.prototype._enableEvents = function () {
-  if (this._cleanupOnExit) {
-    this._removeOnExit = onExit(callWith(this, this.disable))
-  }
-  this._tty.on('resize', this._$$handleSizeChange)
-  if (this._fixedFramerate) {
-    this.redrawTracker = setInterval(this._$$doRedraw, this._updateInterval)
-    if (this.redrawTracker.unref) this.redrawTracker.unref()
-  }
-}
-
-Gauge.prototype._disableEvents = function () {
-  this._tty.removeListener('resize', this._$$handleSizeChange)
-  if (this._fixedFramerate) clearInterval(this.redrawTracker)
-  if (this._removeOnExit) this._removeOnExit()
-}
-
-Gauge.prototype.hide = function (cb) {
-  if (this._disabled) return cb && process.nextTick(cb)
-  if (!this._showing) return cb && process.nextTick(cb)
-  this._showing = false
-  this._doRedraw()
-  cb && setImmediate(cb)
-}
-
-Gauge.prototype.show = function (section, completed) {
-  this._showing = true
-  if (typeof section === 'string') {
-    this._status.section = section
-  } else if (typeof section === 'object') {
-    var sectionKeys = Object.keys(section)
-    for (var ii = 0; ii < sectionKeys.length; ++ii) {
-      var key = sectionKeys[ii]
-      this._status[key] = section[key]
-    }
-  }
-  if (completed != null) this._status.completed = completed
-  if (this._disabled) return
-  this._requestRedraw()
-}
-
-Gauge.prototype.pulse = function (subsection) {
-  this._status.subsection = subsection || ''
-  this._status.spun ++
-  if (this._disabled) return
-  if (!this._showing) return
-  this._requestRedraw()
-}
-
-Gauge.prototype._handleSizeChange = function () {
-  this._gauge.setWidth(this._tty.columns - 1)
-  this._requestRedraw()
-}
-
-Gauge.prototype._doRedraw = function () {
-  if (this._disabled || this._paused) return
-  if (!this._fixedFramerate) {
-    var now = Date.now()
-    if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) return
-    this._lastUpdateAt = now
-  }
-  if (!this._showing && this._onScreen) {
-    this._onScreen = false
-    var result = this._gauge.hide()
-    if (this._hideCursor) {
-      result += this._gauge.showCursor()
-    }
-    return this._writeTo.write(result)
-  }
-  if (!this._showing && !this._onScreen) return
-  if (this._showing && !this._onScreen) {
-    this._onScreen = true
-    this._needsRedraw = true
-    if (this._hideCursor) {
-      this._writeTo.write(this._gauge.hideCursor())
-    }
-  }
-  if (!this._needsRedraw) return
-  if (!this._writeTo.write(this._gauge.show(this._status))) {
-    this._paused = true
-    this._writeTo.on('drain', callWith(this, function () {
-      this._paused = false
-      this._doRedraw()
-    }))
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/package.json b/legacy-libs/grpc/node_modules/gauge/package.json
deleted file mode 100644 (file)
index e4549ce..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-{
-  "_args": [
-    [
-      "gauge@2.7.4",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "gauge@2.7.4",
-  "_id": "gauge@2.7.4",
-  "_inBundle": false,
-  "_integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
-  "_location": "/grpc/gauge",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "gauge@2.7.4",
-    "name": "gauge",
-    "escapedName": "gauge",
-    "rawSpec": "2.7.4",
-    "saveSpec": null,
-    "fetchSpec": "2.7.4"
-  },
-  "_requiredBy": [
-    "/grpc/npmlog"
-  ],
-  "_resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.7.4",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Rebecca Turner",
-    "email": "me@re-becca.org"
-  },
-  "bugs": {
-    "url": "https://github.com/iarna/gauge/issues"
-  },
-  "dependencies": {
-    "aproba": "^1.0.3",
-    "console-control-strings": "^1.0.0",
-    "has-unicode": "^2.0.0",
-    "object-assign": "^4.1.0",
-    "signal-exit": "^3.0.0",
-    "string-width": "^1.0.1",
-    "strip-ansi": "^3.0.1",
-    "wide-align": "^1.1.0"
-  },
-  "description": "A terminal based horizontal guage",
-  "devDependencies": {
-    "readable-stream": "^2.0.6",
-    "require-inject": "^1.4.0",
-    "standard": "^7.1.2",
-    "tap": "^5.7.2",
-    "through2": "^2.0.0"
-  },
-  "files": [
-    "base-theme.js",
-    "CHANGELOG.md",
-    "error.js",
-    "has-color.js",
-    "index.js",
-    "LICENSE",
-    "package.json",
-    "plumbing.js",
-    "process.js",
-    "progress-bar.js",
-    "README.md",
-    "render-template.js",
-    "set-immediate.js",
-    "set-interval.js",
-    "spin.js",
-    "template-item.js",
-    "theme-set.js",
-    "themes.js",
-    "wide-truncate.js"
-  ],
-  "homepage": "https://github.com/iarna/gauge",
-  "keywords": [
-    "progressbar",
-    "progress",
-    "gauge"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "gauge",
-  "optionalDependencies": {},
-  "readme": "gauge\n=====\n\nA nearly stateless terminal based horizontal gauge / progress bar.\n\n```javascript\nvar Gauge = require(\"gauge\")\n\nvar gauge = new Gauge()\n\ngauge.show(\"test\", 0.20)\n\ngauge.pulse(\"this\")\n\ngauge.hide()\n```\n\n![](gauge-demo.gif)\n\n\n### CHANGES FROM 1.x\n\nGauge 2.x is breaking release, please see the [changelog] for details on\nwhat's changed if you were previously a user of this module.\n\n[changelog]: CHANGELOG.md\n\n### THE GAUGE CLASS\n\nThis is the typical interface to the module– it provides a pretty\nfire-and-forget interface to displaying your status information.\n\n```\nvar Gauge = require(\"gauge\")\n\nvar gauge = new Gauge([stream], [options])\n```\n\n* **stream** – *(optional, default STDERR)* A stream that progress bar\n  updates are to be written to.  Gauge honors backpressure and will pause\n  most writing if it is indicated.\n* **options** – *(optional)* An option object.\n\nConstructs a new gauge. Gauges are drawn on a single line, and are not drawn\nif **stream** isn't a tty and a tty isn't explicitly provided.\n\nIf **stream** is a terminal or if you pass in **tty** to **options** then we\nwill detect terminal resizes and redraw to fit.  We do this by watching for\n`resize` events on the tty.  (To work around a bug in verisons of Node prior\nto 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to\nlarger window sizes will be clean, but shrinking the window will always\nresult in some cruft.\n\n**IMPORTANT:** If you prevously were passing in a non-tty stream but you still\nwant output (for example, a stream wrapped by the `ansi` module) then you\nneed to pass in the **tty** option below, as `gauge` needs access to\nthe underlying tty in order to do things like terminal resizes and terminal\nwidth detection.\n\nThe **options** object can have the following properties, all of which are\noptional:\n\n* **updateInterval**: How often gauge updates should be drawn, in miliseconds.\n* **fixedFramerate**: Defaults to false on node 0.8, true on everything\n  else.  When this is true a timer is created to trigger once every\n  `updateInterval` ms, when false, updates are printed as soon as they come\n  in but updates more often than `updateInterval` are ignored.  The reason\n  0.8 doesn't have this set to true is that it can't `unref` its timer and\n  so it would stop your program from exiting– if you want to use this\n  feature with 0.8 just make sure you call `gauge.disable()` before you\n  expect your program to exit.\n* **themes**: A themeset to use when selecting the theme to use. Defaults\n  to `gauge/themes`, see the [themes] documentation for details.\n* **theme**: Select a theme for use, it can be a:\n  * Theme object, in which case the **themes** is not used.\n  * The name of a theme, which will be looked up in the current *themes*\n    object.\n  * A configuration object with any of `hasUnicode`, `hasColor` or\n    `platform` keys, which if wlll be used to override our guesses when making\n    a default theme selection.\n\n  If no theme is selected then a default is picked using a combination of our\n  best guesses at your OS, color support and unicode support.\n* **template**: Describes what you want your gauge to look like.  The\n  default is what npm uses.  Detailed [documentation] is later in this\n  document.\n* **hideCursor**: Defaults to true.  If true, then the cursor will be hidden\n  while the gauge is displayed.\n* **tty**: The tty that you're ultimately writing to.  Defaults to the same\n  as **stream**.  This is used for detecting the width of the terminal and\n  resizes. The width used is `tty.columns - 1`. If no tty is available then\n  a width of `79` is assumed.\n* **enabled**: Defaults to true if `tty` is a TTY, false otherwise.  If true\n  the gauge starts enabled.  If disabled then all update commands are\n  ignored and no gauge will be printed until you call `.enable()`.\n* **Plumbing**: The class to use to actually generate the gauge for\n  printing.  This defaults to `require('gauge/plumbing')` and ordinarly you\n  shouldn't need to override this.\n* **cleanupOnExit**: Defaults to true. Ordinarily we register an exit\n  handler to make sure your cursor is turned back on and the progress bar\n  erased when your process exits, even if you Ctrl-C out or otherwise exit\n  unexpectedly. You can disable this and it won't register the exit handler.\n\n[has-unicode]: https://www.npmjs.com/package/has-unicode\n[themes]: #themes\n[documentation]: #templates\n\n#### `gauge.show(section | status, [completed])`\n\nThe first argument is either the section, the name of the current thing\ncontributing to progress, or an object with keys like **section**,\n**subsection** & **completed** (or any others you have types for in a custom\ntemplate).  If you don't want to update or set any of these you can pass\n`null` and it will be ignored.\n\nThe second argument is the percent completed as a value between 0 and 1.\nWithout it, completion is just not updated. You'll also note that completion\ncan be passed in as part of a status object as the first argument. If both\nit and the completed argument are passed in, the completed argument wins.\n\n#### `gauge.hide([cb])`\n\nRemoves the gauge from the terminal.  Optionally, callback `cb` after IO has\nhad an opportunity to happen (currently this just means after `setImmediate`\nhas called back.)\n\nIt turns out this is important when you're pausing the progress bar on one\nfilehandle and printing to another– otherwise (with a big enough print) node\ncan end up printing the \"end progress bar\" bits to the progress bar filehandle\nwhile other stuff is printing to another filehandle. These getting interleaved\ncan cause corruption in some terminals.\n\n#### `gauge.pulse([subsection])`\n\n* **subsection** – *(optional)* The specific thing that triggered this pulse\n\nSpins the spinner in the gauge to show output.  If **subsection** is\nincluded then it will be combined with the last name passed to `gauge.show`.\n\n#### `gauge.disable()`\n\nHides the gauge and ignores further calls to `show` or `pulse`.\n\n#### `gauge.enable()`\n\nShows the gauge and resumes updating when `show` or `pulse` is called.\n\n#### `gauge.isEnabled()`\n\nReturns true if the gauge is enabled.\n\n#### `gauge.setThemeset(themes)`\n\nChange the themeset to select a theme from. The same as the `themes` option\nused in the constructor. The theme will be reselected from this themeset.\n\n#### `gauge.setTheme(theme)`\n\nChange the active theme, will be displayed with the next show or pulse. This can be:\n\n* Theme object, in which case the **themes** is not used.\n* The name of a theme, which will be looked up in the current *themes*\n  object.\n* A configuration object with any of `hasUnicode`, `hasColor` or\n  `platform` keys, which if wlll be used to override our guesses when making\n  a default theme selection.\n\nIf no theme is selected then a default is picked using a combination of our\nbest guesses at your OS, color support and unicode support.\n\n#### `gauge.setTemplate(template)`\n\nChange the active template, will be displayed with the next show or pulse\n\n### Tracking Completion\n\nIf you have more than one thing going on that you want to track completion\nof, you may find the related [are-we-there-yet] helpful.  It's `change`\nevent can be wired up to the `show` method to get a more traditional\nprogress bar interface.\n\n[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet\n\n### THEMES\n\n```\nvar themes = require('gauge/themes')\n\n// fetch the default color unicode theme for this platform\nvar ourTheme = themes({hasUnicode: true, hasColor: true})\n\n// fetch the default non-color unicode theme for osx\nvar ourTheme = themes({hasUnicode: true, hasColor: false, platform: 'darwin'})\n\n// create a new theme based on the color ascii theme for this platform\n// that brackets the progress bar with arrows\nvar ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), {\n  preProgressbar: '→',\n  postProgressbar: '←'\n})\n```\n\nThe object returned by `gauge/themes` is an instance of the `ThemeSet` class.\n\n```\nvar ThemeSet = require('gauge/theme-set')\nvar themes = new ThemeSet()\n// or\nvar themes = require('gauge/themes')\nvar mythemes = themes.newThemeset() // creates a new themeset based on the default themes\n```\n\n#### themes(opts)\n#### themes.getDefault(opts)\n\nTheme objects are a function that fetches the default theme based on\nplatform, unicode and color support.\n\nOptions is an object with the following properties:\n\n* **hasUnicode** - If true, fetch a unicode theme, if no unicode theme is\n  available then a non-unicode theme will be used.\n* **hasColor** - If true, fetch a color theme, if no color theme is\n  available a non-color theme will be used.\n* **platform** (optional) - Defaults to `process.platform`.  If no\n  platform match is available then `fallback` is used instead.\n\nIf no compatible theme can be found then an error will be thrown with a\n`code` of `EMISSINGTHEME`.\n\n#### themes.addTheme(themeName, themeObj)\n#### themes.addTheme(themeName, [parentTheme], newTheme)\n\nAdds a named theme to the themeset.  You can pass in either a theme object,\nas returned by `themes.newTheme` or the arguments you'd pass to\n`themes.newTheme`.\n\n#### themes.getThemeNames()\n\nReturn a list of all of the names of the themes in this themeset. Suitable\nfor use in `themes.getTheme(…)`.\n\n#### themes.getTheme(name)\n\nReturns the theme object from this theme set named `name`.\n\nIf `name` does not exist in this themeset an error will be thrown with\na `code` of `EMISSINGTHEME`.\n\n#### themes.setDefault([opts], themeName)\n\n`opts` is an object with the following properties.\n\n* **platform** - Defaults to `'fallback'`.  If your theme is platform\n  specific, specify that here with the platform from `process.platform`, eg,\n  `win32`, `darwin`, etc.\n* **hasUnicode** - Defaults to `false`. If your theme uses unicode you\n  should set this to true.\n* **hasColor** - Defaults to `false`.  If your theme uses color you should\n  set this to true.\n\n`themeName` is the name of the theme (as given to `addTheme`) to use for\nthis set of `opts`.\n\n#### themes.newTheme([parentTheme,] newTheme)\n\nCreate a new theme object based on `parentTheme`.  If no `parentTheme` is\nprovided then a minimal parentTheme that defines functions for rendering the\nactivity indicator (spinner) and progress bar will be defined. (This\nfallback parent is defined in `gauge/base-theme`.)\n\nnewTheme should be a bare object– we'll start by discussing the properties\ndefined by the default themes:\n\n* **preProgressbar** - displayed prior to the progress bar, if the progress\n  bar is displayed.\n* **postProgressbar** - displayed after the progress bar, if the progress bar\n  is displayed.\n* **progressBarTheme** - The subtheme passed through to the progress bar\n  renderer, it's an object with `complete` and `remaining` properties\n  that are the strings you want repeated for those sections of the progress\n  bar.\n* **activityIndicatorTheme** - The theme for the activity indicator (spinner),\n  this can either be a string, in which each character is a different step, or\n  an array of strings.\n* **preSubsection** - Displayed as a separator between the `section` and\n  `subsection` when the latter is printed.\n\nMore generally, themes can have any value that would be a valid value when rendering\ntemplates. The properties in the theme are used when their name matches a type in\nthe template. Their values can be:\n\n* **strings & numbers** - They'll be included as is\n* **function (values, theme, width)** - Should return what you want in your output.\n  *values* is an object with values provided via `gauge.show`,\n  *theme* is the theme specific to this item (see below) or this theme object,\n  and *width* is the number of characters wide your result should be.\n\nThere are a couple of special prefixes:\n\n* **pre** - Is shown prior to the property, if its displayed.\n* **post** - Is shown after the property, if its displayed.\n\nAnd one special suffix:\n\n* **Theme** - Its value is passed to a function-type item as the theme.\n\n#### themes.addToAllThemes(theme)\n\nThis *mixes-in* `theme` into all themes currently defined. It also adds it\nto the default parent theme for this themeset, so future themes added to\nthis themeset will get the values from `theme` by default.\n\n#### themes.newThemeset()\n\nCopy the current themeset into a new one.  This allows you to easily inherit\none themeset from another.\n\n### TEMPLATES\n\nA template is an array of objects and strings that, after being evaluated,\nwill be turned into the gauge line.  The default template is:\n\n```javascript\n[\n    {type: 'progressbar', length: 20},\n    {type: 'activityIndicator', kerning: 1, length: 1},\n    {type: 'section', kerning: 1, default: ''},\n    {type: 'subsection', kerning: 1, default: ''}\n]\n```\n\nThe various template elements can either be **plain strings**, in which case they will\nbe be included verbatum in the output, or objects with the following properties:\n\n* *type* can be any of the following plus any keys you pass into `gauge.show` plus\n  any keys you have on a custom theme.\n  * `section` – What big thing you're working on now.\n  * `subsection` – What component of that thing is currently working.\n  * `activityIndicator` – Shows a spinner using the `activityIndicatorTheme`\n    from your active theme.\n  * `progressbar` – A progress bar representing your current `completed`\n    using the `progressbarTheme` from your active theme.\n* *kerning* – Number of spaces that must be between this item and other\n  items, if this item is displayed at all.\n* *maxLength* – The maximum length for this element. If its value is longer it\n  will be truncated.\n* *minLength* – The minimum length for this element. If its value is shorter it\n  will be padded according to the *align* value.\n* *align* – (Default: left) Possible values \"left\", \"right\" and \"center\". Works\n  as you'd expect from word processors.\n* *length* – Provides a single value for both *minLength* and *maxLength*. If both\n  *length* and *minLength or *maxLength* are specifed then the latter take precedence.\n* *value* – A literal value to use for this template item.\n* *default* – A default value to use for this template item if a value\n  wasn't otherwise passed in.\n\n### PLUMBING\n\nThis is the super simple, assume nothing, do no magic internals used by gauge to\nimplement its ordinary interface.\n\n```\nvar Plumbing = require('gauge/plumbing')\nvar gauge = new Plumbing(theme, template, width)\n```\n\n* **theme**: The theme to use.\n* **template**: The template to use.\n* **width**: How wide your gauge should be\n\n#### `gauge.setTheme(theme)`\n\nChange the active theme.\n\n#### `gauge.setTemplate(template)`\n\nChange the active template.\n\n#### `gauge.setWidth(width)`\n\nChange the width to render at.\n\n#### `gauge.hide()`\n\nReturn the string necessary to hide the progress bar\n\n#### `gauge.hideCursor()`\n\nReturn a string to hide the cursor.\n\n#### `gauge.showCursor()`\n\nReturn a string to show the cursor.\n\n#### `gauge.show(status)`\n\nUsing `status` for values, render the provided template with the theme and return\na string that is suitable for printing to update the gauge.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/iarna/gauge.git"
-  },
-  "scripts": {
-    "prepublish": "rm -f *~",
-    "test": "standard && tap test/*.js --coverage"
-  },
-  "version": "2.7.4"
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/plumbing.js b/legacy-libs/grpc/node_modules/gauge/plumbing.js
deleted file mode 100644 (file)
index 1afb4af..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-'use strict'
-var consoleControl = require('console-control-strings')
-var renderTemplate = require('./render-template.js')
-var validate = require('aproba')
-
-var Plumbing = module.exports = function (theme, template, width) {
-  if (!width) width = 80
-  validate('OAN', [theme, template, width])
-  this.showing = false
-  this.theme = theme
-  this.width = width
-  this.template = template
-}
-Plumbing.prototype = {}
-
-Plumbing.prototype.setTheme = function (theme) {
-  validate('O', [theme])
-  this.theme = theme
-}
-
-Plumbing.prototype.setTemplate = function (template) {
-  validate('A', [template])
-  this.template = template
-}
-
-Plumbing.prototype.setWidth = function (width) {
-  validate('N', [width])
-  this.width = width
-}
-
-Plumbing.prototype.hide = function () {
-  return consoleControl.gotoSOL() + consoleControl.eraseLine()
-}
-
-Plumbing.prototype.hideCursor = consoleControl.hideCursor
-
-Plumbing.prototype.showCursor = consoleControl.showCursor
-
-Plumbing.prototype.show = function (status) {
-  var values = Object.create(this.theme)
-  for (var key in status) {
-    values[key] = status[key]
-  }
-
-  return renderTemplate(this.width, this.template, values).trim() +
-         consoleControl.color('reset') +
-         consoleControl.eraseLine() + consoleControl.gotoSOL()
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/process.js b/legacy-libs/grpc/node_modules/gauge/process.js
deleted file mode 100644 (file)
index 05e8569..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict'
-// this exists so we can replace it during testing
-module.exports = process
diff --git a/legacy-libs/grpc/node_modules/gauge/progress-bar.js b/legacy-libs/grpc/node_modules/gauge/progress-bar.js
deleted file mode 100644 (file)
index 7f8dd68..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict'
-var validate = require('aproba')
-var renderTemplate = require('./render-template.js')
-var wideTruncate = require('./wide-truncate')
-var stringWidth = require('string-width')
-
-module.exports = function (theme, width, completed) {
-  validate('ONN', [theme, width, completed])
-  if (completed < 0) completed = 0
-  if (completed > 1) completed = 1
-  if (width <= 0) return ''
-  var sofar = Math.round(width * completed)
-  var rest = width - sofar
-  var template = [
-    {type: 'complete', value: repeat(theme.complete, sofar), length: sofar},
-    {type: 'remaining', value: repeat(theme.remaining, rest), length: rest}
-  ]
-  return renderTemplate(width, template, theme)
-}
-
-// lodash's way of repeating
-function repeat (string, width) {
-  var result = ''
-  var n = width
-  do {
-    if (n % 2) {
-      result += string
-    }
-    n = Math.floor(n / 2)
-    /*eslint no-self-assign: 0*/
-    string += string
-  } while (n && stringWidth(result) < width)
-
-  return wideTruncate(result, width)
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/render-template.js b/legacy-libs/grpc/node_modules/gauge/render-template.js
deleted file mode 100644 (file)
index 3261bfb..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-'use strict'
-var align = require('wide-align')
-var validate = require('aproba')
-var objectAssign = require('object-assign')
-var wideTruncate = require('./wide-truncate')
-var error = require('./error')
-var TemplateItem = require('./template-item')
-
-function renderValueWithValues (values) {
-  return function (item) {
-    return renderValue(item, values)
-  }
-}
-
-var renderTemplate = module.exports = function (width, template, values) {
-  var items = prepareItems(width, template, values)
-  var rendered = items.map(renderValueWithValues(values)).join('')
-  return align.left(wideTruncate(rendered, width), width)
-}
-
-function preType (item) {
-  var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1)
-  return 'pre' + cappedTypeName
-}
-
-function postType (item) {
-  var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1)
-  return 'post' + cappedTypeName
-}
-
-function hasPreOrPost (item, values) {
-  if (!item.type) return
-  return values[preType(item)] || values[postType(item)]
-}
-
-function generatePreAndPost (baseItem, parentValues) {
-  var item = objectAssign({}, baseItem)
-  var values = Object.create(parentValues)
-  var template = []
-  var pre = preType(item)
-  var post = postType(item)
-  if (values[pre]) {
-    template.push({value: values[pre]})
-    values[pre] = null
-  }
-  item.minLength = null
-  item.length = null
-  item.maxLength = null
-  template.push(item)
-  values[item.type] = values[item.type]
-  if (values[post]) {
-    template.push({value: values[post]})
-    values[post] = null
-  }
-  return function ($1, $2, length) {
-    return renderTemplate(length, template, values)
-  }
-}
-
-function prepareItems (width, template, values) {
-  function cloneAndObjectify (item, index, arr) {
-    var cloned = new TemplateItem(item, width)
-    var type = cloned.type
-    if (cloned.value == null) {
-      if (!(type in values)) {
-        if (cloned.default == null) {
-          throw new error.MissingTemplateValue(cloned, values)
-        } else {
-          cloned.value = cloned.default
-        }
-      } else {
-        cloned.value = values[type]
-      }
-    }
-    if (cloned.value == null || cloned.value === '') return null
-    cloned.index = index
-    cloned.first = index === 0
-    cloned.last = index === arr.length - 1
-    if (hasPreOrPost(cloned, values)) cloned.value = generatePreAndPost(cloned, values)
-    return cloned
-  }
-
-  var output = template.map(cloneAndObjectify).filter(function (item) { return item != null })
-
-  var outputLength = 0
-  var remainingSpace = width
-  var variableCount = output.length
-
-  function consumeSpace (length) {
-    if (length > remainingSpace) length = remainingSpace
-    outputLength += length
-    remainingSpace -= length
-  }
-
-  function finishSizing (item, length) {
-    if (item.finished) throw new error.Internal('Tried to finish template item that was already finished')
-    if (length === Infinity) throw new error.Internal('Length of template item cannot be infinity')
-    if (length != null) item.length = length
-    item.minLength = null
-    item.maxLength = null
-    --variableCount
-    item.finished = true
-    if (item.length == null) item.length = item.getBaseLength()
-    if (item.length == null) throw new error.Internal('Finished template items must have a length')
-    consumeSpace(item.getLength())
-  }
-
-  output.forEach(function (item) {
-    if (!item.kerning) return
-    var prevPadRight = item.first ? 0 : output[item.index - 1].padRight
-    if (!item.first && prevPadRight < item.kerning) item.padLeft = item.kerning - prevPadRight
-    if (!item.last) item.padRight = item.kerning
-  })
-
-  // Finish any that have a fixed (literal or intuited) length
-  output.forEach(function (item) {
-    if (item.getBaseLength() == null) return
-    finishSizing(item)
-  })
-
-  var resized = 0
-  var resizing
-  var hunkSize
-  do {
-    resizing = false
-    hunkSize = Math.round(remainingSpace / variableCount)
-    output.forEach(function (item) {
-      if (item.finished) return
-      if (!item.maxLength) return
-      if (item.getMaxLength() < hunkSize) {
-        finishSizing(item, item.maxLength)
-        resizing = true
-      }
-    })
-  } while (resizing && resized++ < output.length)
-  if (resizing) throw new error.Internal('Resize loop iterated too many times while determining maxLength')
-
-  resized = 0
-  do {
-    resizing = false
-    hunkSize = Math.round(remainingSpace / variableCount)
-    output.forEach(function (item) {
-      if (item.finished) return
-      if (!item.minLength) return
-      if (item.getMinLength() >= hunkSize) {
-        finishSizing(item, item.minLength)
-        resizing = true
-      }
-    })
-  } while (resizing && resized++ < output.length)
-  if (resizing) throw new error.Internal('Resize loop iterated too many times while determining minLength')
-
-  hunkSize = Math.round(remainingSpace / variableCount)
-  output.forEach(function (item) {
-    if (item.finished) return
-    finishSizing(item, hunkSize)
-  })
-
-  return output
-}
-
-function renderFunction (item, values, length) {
-  validate('OON', arguments)
-  if (item.type) {
-    return item.value(values, values[item.type + 'Theme'] || {}, length)
-  } else {
-    return item.value(values, {}, length)
-  }
-}
-
-function renderValue (item, values) {
-  var length = item.getBaseLength()
-  var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value
-  if (value == null || value === '') return ''
-  var alignWith = align[item.align] || align.left
-  var leftPadding = item.padLeft ? align.left('', item.padLeft) : ''
-  var rightPadding = item.padRight ? align.right('', item.padRight) : ''
-  var truncated = wideTruncate(String(value), length)
-  var aligned = alignWith(truncated, length)
-  return leftPadding + aligned + rightPadding
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/set-immediate.js b/legacy-libs/grpc/node_modules/gauge/set-immediate.js
deleted file mode 100644 (file)
index 6650a48..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-var process = require('./process')
-try {
-  module.exports = setImmediate
-} catch (ex) {
-  module.exports = process.nextTick
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/set-interval.js b/legacy-libs/grpc/node_modules/gauge/set-interval.js
deleted file mode 100644 (file)
index 5761987..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict'
-// this exists so we can replace it during testing
-module.exports = setInterval
diff --git a/legacy-libs/grpc/node_modules/gauge/spin.js b/legacy-libs/grpc/node_modules/gauge/spin.js
deleted file mode 100644 (file)
index 34142ee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict'
-
-module.exports = function spin (spinstr, spun) {
-  return spinstr[spun % spinstr.length]
-}
diff --git a/legacy-libs/grpc/node_modules/gauge/template-item.js b/legacy-libs/grpc/node_modules/gauge/template-item.js
deleted file mode 100644 (file)
index e46f447..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-'use strict'
-var stringWidth = require('string-width')
-
-module.exports = TemplateItem
-
-function isPercent (num) {
-  if (typeof num !== 'string') return false
-  return num.slice(-1) === '%'
-}
-
-function percent (num) {
-  return Number(num.slice(0, -1)) / 100
-}
-
-function TemplateItem (values, outputLength) {
-  this.overallOutputLength = outputLength
-  this.finished = false
-  this.type = null
-  this.value = null
-  this.length = null
-  this.maxLength = null
-  this.minLength = null
-  this.kerning = null
-  this.align = 'left'
-  this.padLeft = 0
-  this.padRight = 0
-  this.index = null
-  this.first = null
-  this.last = null
-  if (typeof values === 'string') {
-    this.value = values
-  } else {
-    for (var prop in values) this[prop] = values[prop]
-  }
-  // Realize percents
-  if (isPercent(this.length)) {
-    this.length = Math.round(this.overallOutputLength * percent(this.length))
-  }
-  if (isPercent(this.minLength)) {
-    this.minLength = Math.round(this.overallOutputLength * percent(this.minLength))
-  }
-  if (isPercent(this.maxLength)) {
-    this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength))
-  }
-  return this
-}
-
-TemplateItem.prototype = {}
-
-TemplateItem.prototype.getBaseLength = function () {
-  var length = this.length
-  if (length == null && typeof this.value === 'string' && this.maxLength == null && this.minLength == null) {
-    length = stringWidth(this.value)
-  }
-  return length
-}
-
-TemplateItem.prototype.getLength = function () {
-  var length = this.getBaseLength()
-  if (length == null) return null
-  return length + this.padLeft + this.padRight
-}
-
-TemplateItem.prototype.getMaxLength = function () {
-  if (this.maxLength == null) return null
-  return this.maxLength + this.padLeft + this.padRight
-}
-
-TemplateItem.prototype.getMinLength = function () {
-  if (this.minLength == null) return null
-  return this.minLength + this.padLeft + this.padRight
-}
-
diff --git a/legacy-libs/grpc/node_modules/gauge/theme-set.js b/legacy-libs/grpc/node_modules/gauge/theme-set.js
deleted file mode 100644 (file)
index 68971d5..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-'use strict'
-var objectAssign = require('object-assign')
-
-module.exports = function () {
-  return ThemeSetProto.newThemeSet()
-}
-
-var ThemeSetProto = {}
-
-ThemeSetProto.baseTheme = require('./base-theme.js')
-
-ThemeSetProto.newTheme = function (parent, theme) {
-  if (!theme) {
-    theme = parent
-    parent = this.baseTheme
-  }
-  return objectAssign({}, parent, theme)
-}
-
-ThemeSetProto.getThemeNames = function () {
-  return Object.keys(this.themes)
-}
-
-ThemeSetProto.addTheme = function (name, parent, theme) {
-  this.themes[name] = this.newTheme(parent, theme)
-}
-
-ThemeSetProto.addToAllThemes = function (theme) {
-  var themes = this.themes
-  Object.keys(themes).forEach(function (name) {
-    objectAssign(themes[name], theme)
-  })
-  objectAssign(this.baseTheme, theme)
-}
-
-ThemeSetProto.getTheme = function (name) {
-  if (!this.themes[name]) throw this.newMissingThemeError(name)
-  return this.themes[name]
-}
-
-ThemeSetProto.setDefault = function (opts, name) {
-  if (name == null) {
-    name = opts
-    opts = {}
-  }
-  var platform = opts.platform == null ? 'fallback' : opts.platform
-  var hasUnicode = !!opts.hasUnicode
-  var hasColor = !!opts.hasColor
-  if (!this.defaults[platform]) this.defaults[platform] = {true: {}, false: {}}
-  this.defaults[platform][hasUnicode][hasColor] = name
-}
-
-ThemeSetProto.getDefault = function (opts) {
-  if (!opts) opts = {}
-  var platformName = opts.platform || process.platform
-  var platform = this.defaults[platformName] || this.defaults.fallback
-  var hasUnicode = !!opts.hasUnicode
-  var hasColor = !!opts.hasColor
-  if (!platform) throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor)
-  if (!platform[hasUnicode][hasColor]) {
-    if (hasUnicode && hasColor && platform[!hasUnicode][hasColor]) {
-      hasUnicode = false
-    } else if (hasUnicode && hasColor && platform[hasUnicode][!hasColor]) {
-      hasColor = false
-    } else if (hasUnicode && hasColor && platform[!hasUnicode][!hasColor]) {
-      hasUnicode = false
-      hasColor = false
-    } else if (hasUnicode && !hasColor && platform[!hasUnicode][hasColor]) {
-      hasUnicode = false
-    } else if (!hasUnicode && hasColor && platform[hasUnicode][!hasColor]) {
-      hasColor = false
-    } else if (platform === this.defaults.fallback) {
-      throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor)
-    }
-  }
-  if (platform[hasUnicode][hasColor]) {
-    return this.getTheme(platform[hasUnicode][hasColor])
-  } else {
-    return this.getDefault(objectAssign({}, opts, {platform: 'fallback'}))
-  }
-}
-
-ThemeSetProto.newMissingThemeError = function newMissingThemeError (name) {
-  var err = new Error('Could not find a gauge theme named "' + name + '"')
-  Error.captureStackTrace.call(err, newMissingThemeError)
-  err.theme = name
-  err.code = 'EMISSINGTHEME'
-  return err
-}
-
-ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) {
-  var err = new Error(
-    'Could not find a gauge theme for your platform/unicode/color use combo:\n' +
-    '    platform = ' + platformName + '\n' +
-    '    hasUnicode = ' + hasUnicode + '\n' +
-    '    hasColor = ' + hasColor)
-  Error.captureStackTrace.call(err, newMissingDefaultThemeError)
-  err.platform = platformName
-  err.hasUnicode = hasUnicode
-  err.hasColor = hasColor
-  err.code = 'EMISSINGTHEME'
-  return err
-}
-
-ThemeSetProto.newThemeSet = function () {
-  var themeset = function (opts) {
-    return themeset.getDefault(opts)
-  }
-  return objectAssign(themeset, ThemeSetProto, {
-    themes: objectAssign({}, this.themes),
-    baseTheme: objectAssign({}, this.baseTheme),
-    defaults: JSON.parse(JSON.stringify(this.defaults || {}))
-  })
-}
-
diff --git a/legacy-libs/grpc/node_modules/gauge/themes.js b/legacy-libs/grpc/node_modules/gauge/themes.js
deleted file mode 100644 (file)
index eb5a4f5..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-'use strict'
-var consoleControl = require('console-control-strings')
-var ThemeSet = require('./theme-set.js')
-
-var themes = module.exports = new ThemeSet()
-
-themes.addTheme('ASCII', {
-  preProgressbar: '[',
-  postProgressbar: ']',
-  progressbarTheme: {
-    complete: '#',
-    remaining: '.'
-  },
-  activityIndicatorTheme: '-\\|/',
-  preSubsection: '>'
-})
-
-themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
-  progressbarTheme: {
-    preComplete: consoleControl.color('inverse'),
-    complete: ' ',
-    postComplete: consoleControl.color('stopInverse'),
-    preRemaining: consoleControl.color('brightBlack'),
-    remaining: '.',
-    postRemaining: consoleControl.color('reset')
-  }
-})
-
-themes.addTheme('brailleSpinner', {
-  preProgressbar: '⸨',
-  postProgressbar: '⸩',
-  progressbarTheme: {
-    complete: '░',
-    remaining: '⠂'
-  },
-  activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
-  preSubsection: '>'
-})
-
-themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), {
-  progressbarTheme: {
-    preComplete: consoleControl.color('inverse'),
-    complete: ' ',
-    postComplete: consoleControl.color('stopInverse'),
-    preRemaining: consoleControl.color('brightBlack'),
-    remaining: '░',
-    postRemaining: consoleControl.color('reset')
-  }
-})
-
-themes.setDefault({}, 'ASCII')
-themes.setDefault({hasColor: true}, 'colorASCII')
-themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner')
-themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner')
diff --git a/legacy-libs/grpc/node_modules/gauge/wide-truncate.js b/legacy-libs/grpc/node_modules/gauge/wide-truncate.js
deleted file mode 100644 (file)
index c531bc4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict'
-var stringWidth = require('string-width')
-var stripAnsi = require('strip-ansi')
-
-module.exports = wideTruncate
-
-function wideTruncate (str, target) {
-  if (stringWidth(str) === 0) return str
-  if (target <= 0) return ''
-  if (stringWidth(str) <= target) return str
-
-  // We compute the number of bytes of ansi sequences here and add
-  // that to our initial truncation to ensure that we don't slice one
-  // that we want to keep in half.
-  var noAnsi = stripAnsi(str)
-  var ansiSize = str.length + noAnsi.length
-  var truncated = str.slice(0, target + ansiSize)
-
-  // we have to shrink the result to account for our ansi sequence buffer
-  // (if an ansi sequence was truncated) and double width characters.
-  while (stringWidth(truncated) > target) {
-    truncated = truncated.slice(0, -1)
-  }
-  return truncated
-}
diff --git a/legacy-libs/grpc/node_modules/has-unicode/LICENSE b/legacy-libs/grpc/node_modules/has-unicode/LICENSE
deleted file mode 100644 (file)
index d42e25e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Copyright (c) 2014, Rebecca Turner <me@re-becca.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
diff --git a/legacy-libs/grpc/node_modules/has-unicode/README.md b/legacy-libs/grpc/node_modules/has-unicode/README.md
deleted file mode 100644 (file)
index 5a03e59..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-has-unicode
-===========
-
-Try to guess if your terminal supports unicode
-
-```javascript
-var hasUnicode = require("has-unicode")
-
-if (hasUnicode()) {
-  // the terminal probably has unicode support
-}
-```
-```javascript
-var hasUnicode = require("has-unicode").tryHarder
-hasUnicode(function(unicodeSupported) {
-  if (unicodeSupported) {
-    // the terminal probably has unicode support
-  }
-})
-```
-
-## Detecting Unicode
-
-What we actually detect is UTF-8 support, as that's what Node itself supports.
-If you have a UTF-16 locale then you won't be detected as unicode capable.
-
-### Windows
-
-Since at least Windows 7, `cmd` and `powershell` have been unicode capable,
-but unfortunately even then it's not guaranteed. In many localizations it
-still uses legacy code pages and there's no facility short of running
-programs or linking C++ that will let us detect this. As such, we
-report any Windows installation as NOT unicode capable, and recommend
-that you encourage your users to override this via config.
-
-### Unix Like Operating Systems
-
-We look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in
-that order.  For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value. 
-For `LC_CTYPE` it looks to see if the value is `UTF-8`.  This is sufficient
-for most POSIX systems.  While locale data can be put in `/etc/locale.conf`
-as well, AFAIK it's always copied into the environment.
-
diff --git a/legacy-libs/grpc/node_modules/has-unicode/index.js b/legacy-libs/grpc/node_modules/has-unicode/index.js
deleted file mode 100644 (file)
index 9b0fe44..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-"use strict"
-var os = require("os")
-
-var hasUnicode = module.exports = function () {
-  // Recent Win32 platforms (>XP) CAN support unicode in the console but
-  // don't have to, and in non-english locales often use traditional local
-  // code pages. There's no way, short of windows system calls or execing
-  // the chcp command line program to figure this out. As such, we default
-  // this to false and encourage your users to override it via config if
-  // appropriate.
-  if (os.type() == "Windows_NT") { return false }
-
-  var isUTF8 = /UTF-?8$/i
-  var ctype = process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG
-  return isUTF8.test(ctype)
-}
diff --git a/legacy-libs/grpc/node_modules/has-unicode/package.json b/legacy-libs/grpc/node_modules/has-unicode/package.json
deleted file mode 100644 (file)
index 317695d..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-{
-  "_args": [
-    [
-      "has-unicode@2.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "has-unicode@2.0.1",
-  "_id": "has-unicode@2.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
-  "_location": "/grpc/has-unicode",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "has-unicode@2.0.1",
-    "name": "has-unicode",
-    "escapedName": "has-unicode",
-    "rawSpec": "2.0.1",
-    "saveSpec": null,
-    "fetchSpec": "2.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/gauge"
-  ],
-  "_resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Rebecca Turner",
-    "email": "me@re-becca.org"
-  },
-  "bugs": {
-    "url": "https://github.com/iarna/has-unicode/issues"
-  },
-  "dependencies": {},
-  "description": "Try to guess if your terminal supports unicode",
-  "devDependencies": {
-    "require-inject": "^1.3.0",
-    "tap": "^2.3.1"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/iarna/has-unicode",
-  "keywords": [
-    "unicode",
-    "terminal"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "has-unicode",
-  "optionalDependencies": {},
-  "readme": "has-unicode\n===========\n\nTry to guess if your terminal supports unicode\n\n```javascript\nvar hasUnicode = require(\"has-unicode\")\n\nif (hasUnicode()) {\n  // the terminal probably has unicode support\n}\n```\n```javascript\nvar hasUnicode = require(\"has-unicode\").tryHarder\nhasUnicode(function(unicodeSupported) {\n  if (unicodeSupported) {\n    // the terminal probably has unicode support\n  }\n})\n```\n\n## Detecting Unicode\n\nWhat we actually detect is UTF-8 support, as that's what Node itself supports.\nIf you have a UTF-16 locale then you won't be detected as unicode capable.\n\n### Windows\n\nSince at least Windows 7, `cmd` and `powershell` have been unicode capable,\nbut unfortunately even then it's not guaranteed. In many localizations it\nstill uses legacy code pages and there's no facility short of running\nprograms or linking C++ that will let us detect this. As such, we\nreport any Windows installation as NOT unicode capable, and recommend\nthat you encourage your users to override this via config.\n\n### Unix Like Operating Systems\n\nWe look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in\nthat order.  For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value. \nFor `LC_CTYPE` it looks to see if the value is `UTF-8`.  This is sufficient\nfor most POSIX systems.  While locale data can be put in `/etc/locale.conf`\nas well, AFAIK it's always copied into the environment.\n\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/iarna/has-unicode.git"
-  },
-  "scripts": {
-    "test": "tap test/*.js"
-  },
-  "version": "2.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/Changelog.md b/legacy-libs/grpc/node_modules/iconv-lite/Changelog.md
deleted file mode 100644 (file)
index e31cd0c..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-
-# 0.4.23 / 2018-05-07
-
-  * Fix deprecation warning in Node v10 due to the last usage of `new Buffer` (#185, by @felixbuenemann)
-  * Switched from NodeBuffer to Buffer in typings (#155 by @felixfbecker, #186 by @larssn)
-
-
-# 0.4.22 / 2018-05-05
-
-  * Use older semver style for dependencies to be compatible with Node version 0.10 (#182, by @dougwilson)
-  * Fix tests to accomodate fixes in Node v10 (#182, by @dougwilson)
-
-
-# 0.4.21 / 2018-04-06
-
-  * Fix encoding canonicalization (#156)
-  * Fix the paths in the "browser" field in package.json (#174 by @LMLB)
-  * Removed "contributors" section in package.json - see Git history instead.
-
-
-# 0.4.20 / 2018-04-06
-
-  * Updated `new Buffer()` usages with recommended replacements as it's being deprecated in Node v10 (#176, #178 by @ChALkeR)
-
-
-# 0.4.19 / 2017-09-09
-
-  * Fixed iso8859-1 codec regression in handling untranslatable characters (#162, caused by #147)
-  * Re-generated windows1255 codec, because it was updated in iconv project
-  * Fixed grammar in error message when iconv-lite is loaded with encoding other than utf8
-
-
-# 0.4.18 / 2017-06-13
-
-  * Fixed CESU-8 regression in Node v8.
-
-
-# 0.4.17 / 2017-04-22
-
- * Updated typescript definition file to support Angular 2 AoT mode (#153 by @larssn)
-
-
-# 0.4.16 / 2017-04-22
-
- * Added support for React Native (#150)
- * Changed iso8859-1 encoding to usine internal 'binary' encoding, as it's the same thing (#147 by @mscdex)
- * Fixed typo in Readme (#138 by @jiangzhuo)
- * Fixed build for Node v6.10+ by making correct version comparison
- * Added a warning if iconv-lite is loaded not as utf-8 (see #142)
-
-
-# 0.4.15 / 2016-11-21
-
- * Fixed typescript type definition (#137)
-
-
-# 0.4.14 / 2016-11-20
-
- * Preparation for v1.0
- * Added Node v6 and latest Node versions to Travis CI test rig
- * Deprecated Node v0.8 support
- * Typescript typings (@larssn)
- * Fix encoding of Euro character in GB 18030 (inspired by @lygstate)
- * Add ms prefix to dbcs windows encodings (@rokoroku)
-
-
-# 0.4.13 / 2015-10-01
-
- * Fix silly mistake in deprecation notice.
-
-
-# 0.4.12 / 2015-09-26
-
- * Node v4 support:
-   * Added CESU-8 decoding (#106)
-   * Added deprecation notice for `extendNodeEncodings`
-   * Added Travis tests for Node v4 and io.js latest (#105 by @Mithgol)
-
-
-# 0.4.11 / 2015-07-03
-
- * Added CESU-8 encoding.
-
-
-# 0.4.10 / 2015-05-26
-
- * Changed UTF-16 endianness heuristic to take into account any ASCII chars, not
-   just spaces. This should minimize the importance of "default" endianness.
-
-
-# 0.4.9 / 2015-05-24
-
- * Streamlined BOM handling: strip BOM by default, add BOM when encoding if 
-   addBOM: true. Added docs to Readme.
- * UTF16 now uses UTF16-LE by default.
- * Fixed minor issue with big5 encoding.
- * Added io.js testing on Travis; updated node-iconv version to test against.
-   Now we just skip testing SBCS encodings that node-iconv doesn't support.
- * (internal refactoring) Updated codec interface to use classes.
- * Use strict mode in all files.
-
-
-# 0.4.8 / 2015-04-14
- * added alias UNICODE-1-1-UTF-7 for UTF-7 encoding (#94)
-
-
-# 0.4.7 / 2015-02-05
-
- * stop official support of Node.js v0.8. Should still work, but no guarantees.
-   reason: Packages needed for testing are hard to get on Travis CI.
- * work in environment where Object.prototype is monkey patched with enumerable 
-   props (#89).
-
-
-# 0.4.6 / 2015-01-12
- * fix rare aliases of single-byte encodings (thanks @mscdex)
- * double the timeout for dbcs tests to make them less flaky on travis
-
-
-# 0.4.5 / 2014-11-20
-
- * fix windows-31j and x-sjis encoding support (@nleush)
- * minor fix: undefined variable reference when internal error happens
-
-
-# 0.4.4 / 2014-07-16
-
- * added encodings UTF-7 (RFC2152) and UTF-7-IMAP (RFC3501 Section 5.1.3)
- * fixed streaming base64 encoding
-
-
-# 0.4.3 / 2014-06-14
-
- * added encodings UTF-16BE and UTF-16 with BOM
-
-
-# 0.4.2 / 2014-06-12
-
- * don't throw exception if `extendNodeEncodings()` is called more than once
-
-
-# 0.4.1 / 2014-06-11
-
- * codepage 808 added
-
-
-# 0.4.0 / 2014-06-10
-
- * code is rewritten from scratch
- * all widespread encodings are supported
- * streaming interface added
- * browserify compatibility added
- * (optional) extend core primitive encodings to make usage even simpler
- * moved from vows to mocha as the testing framework
-
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/LICENSE b/legacy-libs/grpc/node_modules/iconv-lite/LICENSE
deleted file mode 100644 (file)
index d518d83..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2011 Alexander Shtuchkin
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/README.md b/legacy-libs/grpc/node_modules/iconv-lite/README.md
deleted file mode 100644 (file)
index c981c37..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite)
-
- * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io).
- * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), 
-   [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others.
- * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison).
- * Intuitive encode/decode API
- * Streaming support for Node v0.10+
- * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings.
- * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included).
- * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included.
- * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`).
- * License: MIT.
-
-[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/)
-
-## Usage
-### Basic API
-```javascript
-var iconv = require('iconv-lite');
-
-// Convert from an encoded buffer to js string.
-str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251');
-
-// Convert from js string to an encoded buffer.
-buf = iconv.encode("Sample input string", 'win1251');
-
-// Check if encoding is supported
-iconv.encodingExists("us-ascii")
-```
-
-### Streaming API (Node v0.10+)
-```javascript
-
-// Decode stream (from binary stream to js strings)
-http.createServer(function(req, res) {
-    var converterStream = iconv.decodeStream('win1251');
-    req.pipe(converterStream);
-
-    converterStream.on('data', function(str) {
-        console.log(str); // Do something with decoded strings, chunk-by-chunk.
-    });
-});
-
-// Convert encoding streaming example
-fs.createReadStream('file-in-win1251.txt')
-    .pipe(iconv.decodeStream('win1251'))
-    .pipe(iconv.encodeStream('ucs2'))
-    .pipe(fs.createWriteStream('file-in-ucs2.txt'));
-
-// Sugar: all encode/decode streams have .collect(cb) method to accumulate data.
-http.createServer(function(req, res) {
-    req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) {
-        assert(typeof body == 'string');
-        console.log(body); // full request body string
-    });
-});
-```
-
-### [Deprecated] Extend Node.js own encodings
-> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility).
-
-```javascript
-// After this call all Node basic primitives will understand iconv-lite encodings.
-iconv.extendNodeEncodings();
-
-// Examples:
-buf = new Buffer(str, 'win1251');
-buf.write(str, 'gbk');
-str = buf.toString('latin1');
-assert(Buffer.isEncoding('iso-8859-15'));
-Buffer.byteLength(str, 'us-ascii');
-
-http.createServer(function(req, res) {
-    req.setEncoding('big5');
-    req.collect(function(err, body) {
-        console.log(body);
-    });
-});
-
-fs.createReadStream("file.txt", "shift_jis");
-
-// External modules are also supported (if they use Node primitives, which they probably do).
-request = require('request');
-request({
-    url: "http://github.com/", 
-    encoding: "cp932"
-});
-
-// To remove extensions
-iconv.undoExtendNodeEncodings();
-```
-
-## Supported encodings
-
- *  All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex.
- *  Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap.
- *  All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, 
-    IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. 
-    Aliases like 'latin1', 'us-ascii' also supported.
- *  All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2312, GBK, GB18030, Big5, Shift_JIS, EUC-JP.
-
-See [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings).
-
-Most singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors!
-
-Multibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors!
-
-
-## Encoding/decoding speed
-
-Comparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). 
-Note: your results may vary, so please always check on your hardware.
-
-    operation             iconv@2.1.4   iconv-lite@0.4.7
-    ----------------------------------------------------------
-    encode('win1251')     ~96 Mb/s      ~320 Mb/s
-    decode('win1251')     ~95 Mb/s      ~246 Mb/s
-
-## BOM handling
-
- * Decoding: BOM is stripped by default, unless overridden by passing `stripBOM: false` in options
-   (f.ex. `iconv.decode(buf, enc, {stripBOM: false})`).
-   A callback might also be given as a `stripBOM` parameter - it'll be called if BOM character was actually found.
- * If you want to detect UTF-8 BOM when decoding other encodings, use [node-autodetect-decoder-stream](https://github.com/danielgindi/node-autodetect-decoder-stream) module.
- * Encoding: No BOM added, unless overridden by `addBOM: true` option.
-
-## UTF-16 Encodings
-
-This library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be
-smart about endianness in the following ways:
- * Decoding: uses BOM and 'spaces heuristic' to determine input endianness. Default is UTF-16LE, but can be 
-   overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`.
- * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override.
-
-## Other notes
-
-When decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding).  
-Untranslatable characters are set to � or ?. No transliteration is currently supported.  
-Node versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77).  
-
-## Testing
-
-```bash
-$ git clone git@github.com:ashtuchkin/iconv-lite.git
-$ cd iconv-lite
-$ npm install
-$ npm test
-    
-$ # To view performance:
-$ node test/performance.js
-
-$ # To view test coverage:
-$ npm run coverage
-$ open coverage/lcov-report/index.html
-```
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-codec.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-codec.js
deleted file mode 100644 (file)
index 1fe3e16..0000000
+++ /dev/null
@@ -1,555 +0,0 @@
-"use strict";
-var Buffer = require("safer-buffer").Buffer;
-
-// Multibyte codec. In this scheme, a character is represented by 1 or more bytes.
-// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences.
-// To save memory and loading time, we read table files only when requested.
-
-exports._dbcs = DBCSCodec;
-
-var UNASSIGNED = -1,
-    GB18030_CODE = -2,
-    SEQ_START  = -10,
-    NODE_START = -1000,
-    UNASSIGNED_NODE = new Array(0x100),
-    DEF_CHAR = -1;
-
-for (var i = 0; i < 0x100; i++)
-    UNASSIGNED_NODE[i] = UNASSIGNED;
-
-
-// Class DBCSCodec reads and initializes mapping tables.
-function DBCSCodec(codecOptions, iconv) {
-    this.encodingName = codecOptions.encodingName;
-    if (!codecOptions)
-        throw new Error("DBCS codec is called without the data.")
-    if (!codecOptions.table)
-        throw new Error("Encoding '" + this.encodingName + "' has no data.");
-
-    // Load tables.
-    var mappingTable = codecOptions.table();
-
-
-    // Decode tables: MBCS -> Unicode.
-
-    // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256.
-    // Trie root is decodeTables[0].
-    // Values: >=  0 -> unicode character code. can be > 0xFFFF
-    //         == UNASSIGNED -> unknown/unassigned sequence.
-    //         == GB18030_CODE -> this is the end of a GB18030 4-byte sequence.
-    //         <= NODE_START -> index of the next node in our trie to process next byte.
-    //         <= SEQ_START  -> index of the start of a character code sequence, in decodeTableSeq.
-    this.decodeTables = [];
-    this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.
-
-    // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. 
-    this.decodeTableSeq = [];
-
-    // Actual mapping tables consist of chunks. Use them to fill up decode tables.
-    for (var i = 0; i < mappingTable.length; i++)
-        this._addDecodeChunk(mappingTable[i]);
-
-    this.defaultCharUnicode = iconv.defaultCharUnicode;
-
-    
-    // Encode tables: Unicode -> DBCS.
-
-    // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance.
-    // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null.
-    // Values: >=  0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.).
-    //         == UNASSIGNED -> no conversion found. Output a default char.
-    //         <= SEQ_START  -> it's an index in encodeTableSeq, see below. The character starts a sequence.
-    this.encodeTable = [];
-    
-    // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of
-    // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key
-    // means end of sequence (needed when one sequence is a strict subsequence of another).
-    // Objects are kept separately from encodeTable to increase performance.
-    this.encodeTableSeq = [];
-
-    // Some chars can be decoded, but need not be encoded.
-    var skipEncodeChars = {};
-    if (codecOptions.encodeSkipVals)
-        for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {
-            var val = codecOptions.encodeSkipVals[i];
-            if (typeof val === 'number')
-                skipEncodeChars[val] = true;
-            else
-                for (var j = val.from; j <= val.to; j++)
-                    skipEncodeChars[j] = true;
-        }
-        
-    // Use decode trie to recursively fill out encode tables.
-    this._fillEncodeTable(0, 0, skipEncodeChars);
-
-    // Add more encoding pairs when needed.
-    if (codecOptions.encodeAdd) {
-        for (var uChar in codecOptions.encodeAdd)
-            if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
-                this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
-    }
-
-    this.defCharSB  = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
-    if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?'];
-    if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0);
-
-
-    // Load & create GB18030 tables when needed.
-    if (typeof codecOptions.gb18030 === 'function') {
-        this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges.
-
-        // Add GB18030 decode tables.
-        var thirdByteNodeIdx = this.decodeTables.length;
-        var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0);
-
-        var fourthByteNodeIdx = this.decodeTables.length;
-        var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0);
-
-        for (var i = 0x81; i <= 0xFE; i++) {
-            var secondByteNodeIdx = NODE_START - this.decodeTables[0][i];
-            var secondByteNode = this.decodeTables[secondByteNodeIdx];
-            for (var j = 0x30; j <= 0x39; j++)
-                secondByteNode[j] = NODE_START - thirdByteNodeIdx;
-        }
-        for (var i = 0x81; i <= 0xFE; i++)
-            thirdByteNode[i] = NODE_START - fourthByteNodeIdx;
-        for (var i = 0x30; i <= 0x39; i++)
-            fourthByteNode[i] = GB18030_CODE
-    }        
-}
-
-DBCSCodec.prototype.encoder = DBCSEncoder;
-DBCSCodec.prototype.decoder = DBCSDecoder;
-
-// Decoder helpers
-DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
-    var bytes = [];
-    for (; addr > 0; addr >>= 8)
-        bytes.push(addr & 0xFF);
-    if (bytes.length == 0)
-        bytes.push(0);
-
-    var node = this.decodeTables[0];
-    for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie.
-        var val = node[bytes[i]];
-
-        if (val == UNASSIGNED) { // Create new node.
-            node[bytes[i]] = NODE_START - this.decodeTables.length;
-            this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
-        }
-        else if (val <= NODE_START) { // Existing node.
-            node = this.decodeTables[NODE_START - val];
-        }
-        else
-            throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
-    }
-    return node;
-}
-
-
-DBCSCodec.prototype._addDecodeChunk = function(chunk) {
-    // First element of chunk is the hex mbcs code where we start.
-    var curAddr = parseInt(chunk[0], 16);
-
-    // Choose the decoding node where we'll write our chars.
-    var writeTable = this._getDecodeTrieNode(curAddr);
-    curAddr = curAddr & 0xFF;
-
-    // Write all other elements of the chunk to the table.
-    for (var k = 1; k < chunk.length; k++) {
-        var part = chunk[k];
-        if (typeof part === "string") { // String, write as-is.
-            for (var l = 0; l < part.length;) {
-                var code = part.charCodeAt(l++);
-                if (0xD800 <= code && code < 0xDC00) { // Decode surrogate
-                    var codeTrail = part.charCodeAt(l++);
-                    if (0xDC00 <= codeTrail && codeTrail < 0xE000)
-                        writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00);
-                    else
-                        throw new Error("Incorrect surrogate pair in "  + this.encodingName + " at chunk " + chunk[0]);
-                }
-                else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used)
-                    var len = 0xFFF - code + 2;
-                    var seq = [];
-                    for (var m = 0; m < len; m++)
-                        seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq.
-
-                    writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
-                    this.decodeTableSeq.push(seq);
-                }
-                else
-                    writeTable[curAddr++] = code; // Basic char
-            }
-        } 
-        else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character.
-            var charCode = writeTable[curAddr - 1] + 1;
-            for (var l = 0; l < part; l++)
-                writeTable[curAddr++] = charCode++;
-        }
-        else
-            throw new Error("Incorrect type '" + typeof part + "' given in "  + this.encodingName + " at chunk " + chunk[0]);
-    }
-    if (curAddr > 0xFF)
-        throw new Error("Incorrect chunk in "  + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
-}
-
-// Encoder helpers
-DBCSCodec.prototype._getEncodeBucket = function(uCode) {
-    var high = uCode >> 8; // This could be > 0xFF because of astral characters.
-    if (this.encodeTable[high] === undefined)
-        this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand.
-    return this.encodeTable[high];
-}
-
-DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
-    var bucket = this._getEncodeBucket(uCode);
-    var low = uCode & 0xFF;
-    if (bucket[low] <= SEQ_START)
-        this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it.
-    else if (bucket[low] == UNASSIGNED)
-        bucket[low] = dbcsCode;
-}
-
-DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
-    
-    // Get the root of character tree according to first character of the sequence.
-    var uCode = seq[0];
-    var bucket = this._getEncodeBucket(uCode);
-    var low = uCode & 0xFF;
-
-    var node;
-    if (bucket[low] <= SEQ_START) {
-        // There's already a sequence with  - use it.
-        node = this.encodeTableSeq[SEQ_START-bucket[low]];
-    }
-    else {
-        // There was no sequence object - allocate a new one.
-        node = {};
-        if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence.
-        bucket[low] = SEQ_START - this.encodeTableSeq.length;
-        this.encodeTableSeq.push(node);
-    }
-
-    // Traverse the character tree, allocating new nodes as needed.
-    for (var j = 1; j < seq.length-1; j++) {
-        var oldVal = node[uCode];
-        if (typeof oldVal === 'object')
-            node = oldVal;
-        else {
-            node = node[uCode] = {}
-            if (oldVal !== undefined)
-                node[DEF_CHAR] = oldVal
-        }
-    }
-
-    // Set the leaf to given dbcsCode.
-    uCode = seq[seq.length-1];
-    node[uCode] = dbcsCode;
-}
-
-DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {
-    var node = this.decodeTables[nodeIdx];
-    for (var i = 0; i < 0x100; i++) {
-        var uCode = node[i];
-        var mbCode = prefix + i;
-        if (skipEncodeChars[mbCode])
-            continue;
-
-        if (uCode >= 0)
-            this._setEncodeChar(uCode, mbCode);
-        else if (uCode <= NODE_START)
-            this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars);
-        else if (uCode <= SEQ_START)
-            this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
-    }
-}
-
-
-
-// == Encoder ==================================================================
-
-function DBCSEncoder(options, codec) {
-    // Encoder state
-    this.leadSurrogate = -1;
-    this.seqObj = undefined;
-    
-    // Static data
-    this.encodeTable = codec.encodeTable;
-    this.encodeTableSeq = codec.encodeTableSeq;
-    this.defaultCharSingleByte = codec.defCharSB;
-    this.gb18030 = codec.gb18030;
-}
-
-DBCSEncoder.prototype.write = function(str) {
-    var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)),
-        leadSurrogate = this.leadSurrogate,
-        seqObj = this.seqObj, nextChar = -1,
-        i = 0, j = 0;
-
-    while (true) {
-        // 0. Get next character.
-        if (nextChar === -1) {
-            if (i == str.length) break;
-            var uCode = str.charCodeAt(i++);
-        }
-        else {
-            var uCode = nextChar;
-            nextChar = -1;    
-        }
-
-        // 1. Handle surrogates.
-        if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates.
-            if (uCode < 0xDC00) { // We've got lead surrogate.
-                if (leadSurrogate === -1) {
-                    leadSurrogate = uCode;
-                    continue;
-                } else {
-                    leadSurrogate = uCode;
-                    // Double lead surrogate found.
-                    uCode = UNASSIGNED;
-                }
-            } else { // We've got trail surrogate.
-                if (leadSurrogate !== -1) {
-                    uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00);
-                    leadSurrogate = -1;
-                } else {
-                    // Incomplete surrogate pair - only trail surrogate found.
-                    uCode = UNASSIGNED;
-                }
-                
-            }
-        }
-        else if (leadSurrogate !== -1) {
-            // Incomplete surrogate pair - only lead surrogate found.
-            nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char.
-            leadSurrogate = -1;
-        }
-
-        // 2. Convert uCode character.
-        var dbcsCode = UNASSIGNED;
-        if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence
-            var resCode = seqObj[uCode];
-            if (typeof resCode === 'object') { // Sequence continues.
-                seqObj = resCode;
-                continue;
-
-            } else if (typeof resCode == 'number') { // Sequence finished. Write it.
-                dbcsCode = resCode;
-
-            } else if (resCode == undefined) { // Current character is not part of the sequence.
-
-                // Try default character for this sequence
-                resCode = seqObj[DEF_CHAR];
-                if (resCode !== undefined) {
-                    dbcsCode = resCode; // Found. Write it.
-                    nextChar = uCode; // Current character will be written too in the next iteration.
-
-                } else {
-                    // TODO: What if we have no default? (resCode == undefined)
-                    // Then, we should write first char of the sequence as-is and try the rest recursively.
-                    // Didn't do it for now because no encoding has this situation yet.
-                    // Currently, just skip the sequence and write current char.
-                }
-            }
-            seqObj = undefined;
-        }
-        else if (uCode >= 0) {  // Regular character
-            var subtable = this.encodeTable[uCode >> 8];
-            if (subtable !== undefined)
-                dbcsCode = subtable[uCode & 0xFF];
-            
-            if (dbcsCode <= SEQ_START) { // Sequence start
-                seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];
-                continue;
-            }
-
-            if (dbcsCode == UNASSIGNED && this.gb18030) {
-                // Use GB18030 algorithm to find character(s) to write.
-                var idx = findIdx(this.gb18030.uChars, uCode);
-                if (idx != -1) {
-                    var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
-                    newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600;
-                    newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260;
-                    newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10;
-                    newBuf[j++] = 0x30 + dbcsCode;
-                    continue;
-                }
-            }
-        }
-
-        // 3. Write dbcsCode character.
-        if (dbcsCode === UNASSIGNED)
-            dbcsCode = this.defaultCharSingleByte;
-        
-        if (dbcsCode < 0x100) {
-            newBuf[j++] = dbcsCode;
-        }
-        else if (dbcsCode < 0x10000) {
-            newBuf[j++] = dbcsCode >> 8;   // high byte
-            newBuf[j++] = dbcsCode & 0xFF; // low byte
-        }
-        else {
-            newBuf[j++] = dbcsCode >> 16;
-            newBuf[j++] = (dbcsCode >> 8) & 0xFF;
-            newBuf[j++] = dbcsCode & 0xFF;
-        }
-    }
-
-    this.seqObj = seqObj;
-    this.leadSurrogate = leadSurrogate;
-    return newBuf.slice(0, j);
-}
-
-DBCSEncoder.prototype.end = function() {
-    if (this.leadSurrogate === -1 && this.seqObj === undefined)
-        return; // All clean. Most often case.
-
-    var newBuf = Buffer.alloc(10), j = 0;
-
-    if (this.seqObj) { // We're in the sequence.
-        var dbcsCode = this.seqObj[DEF_CHAR];
-        if (dbcsCode !== undefined) { // Write beginning of the sequence.
-            if (dbcsCode < 0x100) {
-                newBuf[j++] = dbcsCode;
-            }
-            else {
-                newBuf[j++] = dbcsCode >> 8;   // high byte
-                newBuf[j++] = dbcsCode & 0xFF; // low byte
-            }
-        } else {
-            // See todo above.
-        }
-        this.seqObj = undefined;
-    }
-
-    if (this.leadSurrogate !== -1) {
-        // Incomplete surrogate pair - only lead surrogate found.
-        newBuf[j++] = this.defaultCharSingleByte;
-        this.leadSurrogate = -1;
-    }
-    
-    return newBuf.slice(0, j);
-}
-
-// Export for testing
-DBCSEncoder.prototype.findIdx = findIdx;
-
-
-// == Decoder ==================================================================
-
-function DBCSDecoder(options, codec) {
-    // Decoder state
-    this.nodeIdx = 0;
-    this.prevBuf = Buffer.alloc(0);
-
-    // Static data
-    this.decodeTables = codec.decodeTables;
-    this.decodeTableSeq = codec.decodeTableSeq;
-    this.defaultCharUnicode = codec.defaultCharUnicode;
-    this.gb18030 = codec.gb18030;
-}
-
-DBCSDecoder.prototype.write = function(buf) {
-    var newBuf = Buffer.alloc(buf.length*2),
-        nodeIdx = this.nodeIdx, 
-        prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,
-        seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.
-        uCode;
-
-    if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later.
-        prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);
-    
-    for (var i = 0, j = 0; i < buf.length; i++) {
-        var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset];
-
-        // Lookup in current trie node.
-        var uCode = this.decodeTables[nodeIdx][curByte];
-
-        if (uCode >= 0) { 
-            // Normal character, just use it.
-        }
-        else if (uCode === UNASSIGNED) { // Unknown char.
-            // TODO: Callback with seq.
-            //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
-            i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle).
-            uCode = this.defaultCharUnicode.charCodeAt(0);
-        }
-        else if (uCode === GB18030_CODE) {
-            var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
-            var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30);
-            var idx = findIdx(this.gb18030.gbChars, ptr);
-            uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];
-        }
-        else if (uCode <= NODE_START) { // Go to next trie node.
-            nodeIdx = NODE_START - uCode;
-            continue;
-        }
-        else if (uCode <= SEQ_START) { // Output a sequence of chars.
-            var seq = this.decodeTableSeq[SEQ_START - uCode];
-            for (var k = 0; k < seq.length - 1; k++) {
-                uCode = seq[k];
-                newBuf[j++] = uCode & 0xFF;
-                newBuf[j++] = uCode >> 8;
-            }
-            uCode = seq[seq.length-1];
-        }
-        else
-            throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
-
-        // Write the character to buffer, handling higher planes using surrogate pair.
-        if (uCode > 0xFFFF) { 
-            uCode -= 0x10000;
-            var uCodeLead = 0xD800 + Math.floor(uCode / 0x400);
-            newBuf[j++] = uCodeLead & 0xFF;
-            newBuf[j++] = uCodeLead >> 8;
-
-            uCode = 0xDC00 + uCode % 0x400;
-        }
-        newBuf[j++] = uCode & 0xFF;
-        newBuf[j++] = uCode >> 8;
-
-        // Reset trie node.
-        nodeIdx = 0; seqStart = i+1;
-    }
-
-    this.nodeIdx = nodeIdx;
-    this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset);
-    return newBuf.slice(0, j).toString('ucs2');
-}
-
-DBCSDecoder.prototype.end = function() {
-    var ret = '';
-
-    // Try to parse all remaining chars.
-    while (this.prevBuf.length > 0) {
-        // Skip 1 character in the buffer.
-        ret += this.defaultCharUnicode;
-        var buf = this.prevBuf.slice(1);
-
-        // Parse remaining as usual.
-        this.prevBuf = Buffer.alloc(0);
-        this.nodeIdx = 0;
-        if (buf.length > 0)
-            ret += this.write(buf);
-    }
-
-    this.nodeIdx = 0;
-    return ret;
-}
-
-// Binary search for GB18030. Returns largest i such that table[i] <= val.
-function findIdx(table, val) {
-    if (table[0] > val)
-        return -1;
-
-    var l = 0, r = table.length;
-    while (l < r-1) { // always table[l] <= val < table[r]
-        var mid = l + Math.floor((r-l+1)/2);
-        if (table[mid] <= val)
-            l = mid;
-        else
-            r = mid;
-    }
-    return l;
-}
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-data.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/dbcs-data.js
deleted file mode 100644 (file)
index 4b61914..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-"use strict";
-
-// Description of supported double byte encodings and aliases.
-// Tables are not require()-d until they are needed to speed up library load.
-// require()-s are direct to support Browserify.
-
-module.exports = {
-    
-    // == Japanese/ShiftJIS ====================================================
-    // All japanese encodings are based on JIS X set of standards:
-    // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
-    // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. 
-    //              Has several variations in 1978, 1983, 1990 and 1997.
-    // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
-    // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
-    //              2 planes, first is superset of 0208, second - revised 0212.
-    //              Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx)
-
-    // Byte encodings are:
-    //  * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte
-    //               encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC.
-    //               Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI.
-    //  * EUC-JP:    Up to 3 bytes per character. Used mostly on *nixes.
-    //               0x00-0x7F       - lower part of 0201
-    //               0x8E, 0xA1-0xDF - upper part of 0201
-    //               (0xA1-0xFE)x2   - 0208 plane (94x94).
-    //               0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
-    //  * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
-    //               Used as-is in ISO2022 family.
-    //  * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, 
-    //                0201-1976 Roman, 0208-1978, 0208-1983.
-    //  * ISO2022-JP-1: Adds esc seq for 0212-1990.
-    //  * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
-    //  * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2.
-    //  * ISO2022-JP-2004: Adds 0213-2004 Plane 1.
-    //
-    // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
-    //
-    // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
-
-    'shiftjis': {
-        type: '_dbcs',
-        table: function() { return require('./tables/shiftjis.json') },
-        encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
-        encodeSkipVals: [{from: 0xED40, to: 0xF940}],
-    },
-    'csshiftjis': 'shiftjis',
-    'mskanji': 'shiftjis',
-    'sjis': 'shiftjis',
-    'windows31j': 'shiftjis',
-    'ms31j': 'shiftjis',
-    'xsjis': 'shiftjis',
-    'windows932': 'shiftjis',
-    'ms932': 'shiftjis',
-    '932': 'shiftjis',
-    'cp932': 'shiftjis',
-
-    'eucjp': {
-        type: '_dbcs',
-        table: function() { return require('./tables/eucjp.json') },
-        encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
-    },
-
-    // TODO: KDDI extension to Shift_JIS
-    // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes.
-    // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars.
-
-
-    // == Chinese/GBK ==========================================================
-    // http://en.wikipedia.org/wiki/GBK
-    // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
-
-    // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
-    'gb2312': 'cp936',
-    'gb231280': 'cp936',
-    'gb23121980': 'cp936',
-    'csgb2312': 'cp936',
-    'csiso58gb231280': 'cp936',
-    'euccn': 'cp936',
-
-    // Microsoft's CP936 is a subset and approximation of GBK.
-    'windows936': 'cp936',
-    'ms936': 'cp936',
-    '936': 'cp936',
-    'cp936': {
-        type: '_dbcs',
-        table: function() { return require('./tables/cp936.json') },
-    },
-
-    // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
-    'gbk': {
-        type: '_dbcs',
-        table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) },
-    },
-    'xgbk': 'gbk',
-    'isoir58': 'gbk',
-
-    // GB18030 is an algorithmic extension of GBK.
-    // Main source: https://www.w3.org/TR/encoding/#gbk-encoder
-    // http://icu-project.org/docs/papers/gb18030.html
-    // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
-    // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
-    'gb18030': {
-        type: '_dbcs',
-        table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) },
-        gb18030: function() { return require('./tables/gb18030-ranges.json') },
-        encodeSkipVals: [0x80],
-        encodeAdd: {'€': 0xA2E3},
-    },
-
-    'chinese': 'gb18030',
-
-
-    // == Korean ===============================================================
-    // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
-    'windows949': 'cp949',
-    'ms949': 'cp949',
-    '949': 'cp949',
-    'cp949': {
-        type: '_dbcs',
-        table: function() { return require('./tables/cp949.json') },
-    },
-
-    'cseuckr': 'cp949',
-    'csksc56011987': 'cp949',
-    'euckr': 'cp949',
-    'isoir149': 'cp949',
-    'korean': 'cp949',
-    'ksc56011987': 'cp949',
-    'ksc56011989': 'cp949',
-    'ksc5601': 'cp949',
-
-
-    // == Big5/Taiwan/Hong Kong ================================================
-    // There are lots of tables for Big5 and cp950. Please see the following links for history:
-    // http://moztw.org/docs/big5/  http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
-    // Variations, in roughly number of defined chars:
-    //  * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT
-    //  * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
-    //  * Big5-2003 (Taiwan standard) almost superset of cp950.
-    //  * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
-    //  * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. 
-    //    many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
-    //    Plus, it has 4 combining sequences.
-    //    Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
-    //    because big5-hkscs is the only encoding to include astral characters in non-algorithmic way.
-    //    Implementations are not consistent within browsers; sometimes labeled as just big5.
-    //    MS Internet Explorer switches from big5 to big5-hkscs when a patch applied.
-    //    Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31
-    //    In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
-    //    Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
-    //                   http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
-    // 
-    // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
-    // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
-
-    'windows950': 'cp950',
-    'ms950': 'cp950',
-    '950': 'cp950',
-    'cp950': {
-        type: '_dbcs',
-        table: function() { return require('./tables/cp950.json') },
-    },
-
-    // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
-    'big5': 'big5hkscs',
-    'big5hkscs': {
-        type: '_dbcs',
-        table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) },
-        encodeSkipVals: [0xa2cc],
-    },
-
-    'cnbig5': 'big5hkscs',
-    'csbig5': 'big5hkscs',
-    'xxbig5': 'big5hkscs',
-};
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/index.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/index.js
deleted file mode 100644 (file)
index e304003..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-
-// Update this array if you add/rename/remove files in this directory.
-// We support Browserify by skipping automatic module discovery and requiring modules directly.
-var modules = [
-    require("./internal"),
-    require("./utf16"),
-    require("./utf7"),
-    require("./sbcs-codec"),
-    require("./sbcs-data"),
-    require("./sbcs-data-generated"),
-    require("./dbcs-codec"),
-    require("./dbcs-data"),
-];
-
-// Put all encoding/alias/codec definitions to single object and export it. 
-for (var i = 0; i < modules.length; i++) {
-    var module = modules[i];
-    for (var enc in module)
-        if (Object.prototype.hasOwnProperty.call(module, enc))
-            exports[enc] = module[enc];
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/internal.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/internal.js
deleted file mode 100644 (file)
index 05ce38b..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-"use strict";
-var Buffer = require("safer-buffer").Buffer;
-
-// Export Node.js internal encodings.
-
-module.exports = {
-    // Encodings
-    utf8:   { type: "_internal", bomAware: true},
-    cesu8:  { type: "_internal", bomAware: true},
-    unicode11utf8: "utf8",
-
-    ucs2:   { type: "_internal", bomAware: true},
-    utf16le: "ucs2",
-
-    binary: { type: "_internal" },
-    base64: { type: "_internal" },
-    hex:    { type: "_internal" },
-
-    // Codec.
-    _internal: InternalCodec,
-};
-
-//------------------------------------------------------------------------------
-
-function InternalCodec(codecOptions, iconv) {
-    this.enc = codecOptions.encodingName;
-    this.bomAware = codecOptions.bomAware;
-
-    if (this.enc === "base64")
-        this.encoder = InternalEncoderBase64;
-    else if (this.enc === "cesu8") {
-        this.enc = "utf8"; // Use utf8 for decoding.
-        this.encoder = InternalEncoderCesu8;
-
-        // Add decoder for versions of Node not supporting CESU-8
-        if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') {
-            this.decoder = InternalDecoderCesu8;
-            this.defaultCharUnicode = iconv.defaultCharUnicode;
-        }
-    }
-}
-
-InternalCodec.prototype.encoder = InternalEncoder;
-InternalCodec.prototype.decoder = InternalDecoder;
-
-//------------------------------------------------------------------------------
-
-// We use node.js internal decoder. Its signature is the same as ours.
-var StringDecoder = require('string_decoder').StringDecoder;
-
-if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
-    StringDecoder.prototype.end = function() {};
-
-
-function InternalDecoder(options, codec) {
-    StringDecoder.call(this, codec.enc);
-}
-
-InternalDecoder.prototype = StringDecoder.prototype;
-
-
-//------------------------------------------------------------------------------
-// Encoder is mostly trivial
-
-function InternalEncoder(options, codec) {
-    this.enc = codec.enc;
-}
-
-InternalEncoder.prototype.write = function(str) {
-    return Buffer.from(str, this.enc);
-}
-
-InternalEncoder.prototype.end = function() {
-}
-
-
-//------------------------------------------------------------------------------
-// Except base64 encoder, which must keep its state.
-
-function InternalEncoderBase64(options, codec) {
-    this.prevStr = '';
-}
-
-InternalEncoderBase64.prototype.write = function(str) {
-    str = this.prevStr + str;
-    var completeQuads = str.length - (str.length % 4);
-    this.prevStr = str.slice(completeQuads);
-    str = str.slice(0, completeQuads);
-
-    return Buffer.from(str, "base64");
-}
-
-InternalEncoderBase64.prototype.end = function() {
-    return Buffer.from(this.prevStr, "base64");
-}
-
-
-//------------------------------------------------------------------------------
-// CESU-8 encoder is also special.
-
-function InternalEncoderCesu8(options, codec) {
-}
-
-InternalEncoderCesu8.prototype.write = function(str) {
-    var buf = Buffer.alloc(str.length * 3), bufIdx = 0;
-    for (var i = 0; i < str.length; i++) {
-        var charCode = str.charCodeAt(i);
-        // Naive implementation, but it works because CESU-8 is especially easy
-        // to convert from UTF-16 (which all JS strings are encoded in).
-        if (charCode < 0x80)
-            buf[bufIdx++] = charCode;
-        else if (charCode < 0x800) {
-            buf[bufIdx++] = 0xC0 + (charCode >>> 6);
-            buf[bufIdx++] = 0x80 + (charCode & 0x3f);
-        }
-        else { // charCode will always be < 0x10000 in javascript.
-            buf[bufIdx++] = 0xE0 + (charCode >>> 12);
-            buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f);
-            buf[bufIdx++] = 0x80 + (charCode & 0x3f);
-        }
-    }
-    return buf.slice(0, bufIdx);
-}
-
-InternalEncoderCesu8.prototype.end = function() {
-}
-
-//------------------------------------------------------------------------------
-// CESU-8 decoder is not implemented in Node v4.0+
-
-function InternalDecoderCesu8(options, codec) {
-    this.acc = 0;
-    this.contBytes = 0;
-    this.accBytes = 0;
-    this.defaultCharUnicode = codec.defaultCharUnicode;
-}
-
-InternalDecoderCesu8.prototype.write = function(buf) {
-    var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, 
-        res = '';
-    for (var i = 0; i < buf.length; i++) {
-        var curByte = buf[i];
-        if ((curByte & 0xC0) !== 0x80) { // Leading byte
-            if (contBytes > 0) { // Previous code is invalid
-                res += this.defaultCharUnicode;
-                contBytes = 0;
-            }
-
-            if (curByte < 0x80) { // Single-byte code
-                res += String.fromCharCode(curByte);
-            } else if (curByte < 0xE0) { // Two-byte code
-                acc = curByte & 0x1F;
-                contBytes = 1; accBytes = 1;
-            } else if (curByte < 0xF0) { // Three-byte code
-                acc = curByte & 0x0F;
-                contBytes = 2; accBytes = 1;
-            } else { // Four or more are not supported for CESU-8.
-                res += this.defaultCharUnicode;
-            }
-        } else { // Continuation byte
-            if (contBytes > 0) { // We're waiting for it.
-                acc = (acc << 6) | (curByte & 0x3f);
-                contBytes--; accBytes++;
-                if (contBytes === 0) {
-                    // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80)
-                    if (accBytes === 2 && acc < 0x80 && acc > 0)
-                        res += this.defaultCharUnicode;
-                    else if (accBytes === 3 && acc < 0x800)
-                        res += this.defaultCharUnicode;
-                    else
-                        // Actually add character.
-                        res += String.fromCharCode(acc);
-                }
-            } else { // Unexpected continuation byte
-                res += this.defaultCharUnicode;
-            }
-        }
-    }
-    this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes;
-    return res;
-}
-
-InternalDecoderCesu8.prototype.end = function() {
-    var res = 0;
-    if (this.contBytes > 0)
-        res += this.defaultCharUnicode;
-    return res;
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-codec.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-codec.js
deleted file mode 100644 (file)
index f225823..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-"use strict";
-var Buffer = require("safer-buffer").Buffer;
-
-// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that
-// correspond to encoded bytes (if 128 - then lower half is ASCII). 
-
-exports._sbcs = SBCSCodec;
-function SBCSCodec(codecOptions, iconv) {
-    if (!codecOptions)
-        throw new Error("SBCS codec is called without the data.")
-    
-    // Prepare char buffer for decoding.
-    if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256))
-        throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)");
-    
-    if (codecOptions.chars.length === 128) {
-        var asciiString = "";
-        for (var i = 0; i < 128; i++)
-            asciiString += String.fromCharCode(i);
-        codecOptions.chars = asciiString + codecOptions.chars;
-    }
-
-    this.decodeBuf = new Buffer.from(codecOptions.chars, 'ucs2');
-    
-    // Encoding buffer.
-    var encodeBuf = new Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
-
-    for (var i = 0; i < codecOptions.chars.length; i++)
-        encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
-
-    this.encodeBuf = encodeBuf;
-}
-
-SBCSCodec.prototype.encoder = SBCSEncoder;
-SBCSCodec.prototype.decoder = SBCSDecoder;
-
-
-function SBCSEncoder(options, codec) {
-    this.encodeBuf = codec.encodeBuf;
-}
-
-SBCSEncoder.prototype.write = function(str) {
-    var buf = Buffer.alloc(str.length);
-    for (var i = 0; i < str.length; i++)
-        buf[i] = this.encodeBuf[str.charCodeAt(i)];
-    
-    return buf;
-}
-
-SBCSEncoder.prototype.end = function() {
-}
-
-
-function SBCSDecoder(options, codec) {
-    this.decodeBuf = codec.decodeBuf;
-}
-
-SBCSDecoder.prototype.write = function(buf) {
-    // Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
-    var decodeBuf = this.decodeBuf;
-    var newBuf = Buffer.alloc(buf.length*2);
-    var idx1 = 0, idx2 = 0;
-    for (var i = 0; i < buf.length; i++) {
-        idx1 = buf[i]*2; idx2 = i*2;
-        newBuf[idx2] = decodeBuf[idx1];
-        newBuf[idx2+1] = decodeBuf[idx1+1];
-    }
-    return newBuf.toString('ucs2');
-}
-
-SBCSDecoder.prototype.end = function() {
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data-generated.js
deleted file mode 100644 (file)
index 9b48236..0000000
+++ /dev/null
@@ -1,451 +0,0 @@
-"use strict";
-
-// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script.
-module.exports = {
-  "437": "cp437",
-  "737": "cp737",
-  "775": "cp775",
-  "850": "cp850",
-  "852": "cp852",
-  "855": "cp855",
-  "856": "cp856",
-  "857": "cp857",
-  "858": "cp858",
-  "860": "cp860",
-  "861": "cp861",
-  "862": "cp862",
-  "863": "cp863",
-  "864": "cp864",
-  "865": "cp865",
-  "866": "cp866",
-  "869": "cp869",
-  "874": "windows874",
-  "922": "cp922",
-  "1046": "cp1046",
-  "1124": "cp1124",
-  "1125": "cp1125",
-  "1129": "cp1129",
-  "1133": "cp1133",
-  "1161": "cp1161",
-  "1162": "cp1162",
-  "1163": "cp1163",
-  "1250": "windows1250",
-  "1251": "windows1251",
-  "1252": "windows1252",
-  "1253": "windows1253",
-  "1254": "windows1254",
-  "1255": "windows1255",
-  "1256": "windows1256",
-  "1257": "windows1257",
-  "1258": "windows1258",
-  "28591": "iso88591",
-  "28592": "iso88592",
-  "28593": "iso88593",
-  "28594": "iso88594",
-  "28595": "iso88595",
-  "28596": "iso88596",
-  "28597": "iso88597",
-  "28598": "iso88598",
-  "28599": "iso88599",
-  "28600": "iso885910",
-  "28601": "iso885911",
-  "28603": "iso885913",
-  "28604": "iso885914",
-  "28605": "iso885915",
-  "28606": "iso885916",
-  "windows874": {
-    "type": "_sbcs",
-    "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
-  },
-  "win874": "windows874",
-  "cp874": "windows874",
-  "windows1250": {
-    "type": "_sbcs",
-    "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬\ad®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙"
-  },
-  "win1250": "windows1250",
-  "cp1250": "windows1250",
-  "windows1251": {
-    "type": "_sbcs",
-    "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬\ad®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
-  },
-  "win1251": "windows1251",
-  "cp1251": "windows1251",
-  "windows1252": {
-    "type": "_sbcs",
-    "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
-  },
-  "win1252": "windows1252",
-  "cp1252": "windows1252",
-  "windows1253": {
-    "type": "_sbcs",
-    "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬\ad®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�"
-  },
-  "win1253": "windows1253",
-  "cp1253": "windows1253",
-  "windows1254": {
-    "type": "_sbcs",
-    "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ"
-  },
-  "win1254": "windows1254",
-  "cp1254": "windows1254",
-  "windows1255": {
-    "type": "_sbcs",
-    "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬\ad®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��\200e\200f�"
-  },
-  "win1255": "windows1255",
-  "cp1255": "windows1255",
-  "windows1256": {
-    "type": "_sbcs",
-    "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ\200c\200dں ،¢£¤¥¦§¨©ھ«¬\ad®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü\200e\200fے"
-  },
-  "win1256": "windows1256",
-  "cp1256": "windows1256",
-  "windows1257": {
-    "type": "_sbcs",
-    "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬\ad®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙"
-  },
-  "win1257": "windows1257",
-  "cp1257": "windows1257",
-  "windows1258": {
-    "type": "_sbcs",
-    "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"
-  },
-  "win1258": "windows1258",
-  "cp1258": "windows1258",
-  "iso88591": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
-  },
-  "cp28591": "iso88591",
-  "iso88592": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f Ą˘Ł¤ĽŚ§¨ŠŞŤŹ\adŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙"
-  },
-  "cp28592": "iso88592",
-  "iso88593": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f Ħ˘£¤�Ĥ§¨İŞĞĴ\ad�ݰħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙"
-  },
-  "cp28593": "iso88593",
-  "iso88594": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ĄĸŖ¤Ĩϧ¨ŠĒĢŦ\adޝ°ą˛ŗ´ĩšēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖרŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙"
-  },
-  "cp28594": "iso88594",
-  "iso88595": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ЁЂЃЄЅІЇЈЉЊЋЌ\adЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ"
-  },
-  "cp28595": "iso88595",
-  "iso88596": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ���¤�������،\ad�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������"
-  },
-  "cp28596": "iso88596",
-  "iso88597": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ‘’£€₯¦§¨©ͺ«¬\ad�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�"
-  },
-  "cp28597": "iso88597",
-  "iso88598": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f �¢£¤¥¦§¨©×«¬\ad®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��\200e\200f�"
-  },
-  "cp28598": "iso88598",
-  "iso88599": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ"
-  },
-  "cp28599": "iso88599",
-  "iso885910": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ĄĒĢĪĨͧĻĐŠŦŽ\adŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ"
-  },
-  "cp28600": "iso885910",
-  "iso885911": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
-  },
-  "cp28601": "iso885911",
-  "iso885913": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ”¢£¤„¦§Ø©Ŗ«¬\ad®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’"
-  },
-  "cp28603": "iso885913",
-  "iso885914": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ\ad®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ"
-  },
-  "cp28604": "iso885914",
-  "iso885915": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£€¥Š§š©ª«¬\ad®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
-  },
-  "cp28605": "iso885915",
-  "iso885916": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ĄąŁ€„Чš©Ș«Ź\adźŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ"
-  },
-  "cp28606": "iso885916",
-  "cp437": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
-  },
-  "ibm437": "cp437",
-  "csibm437": "cp437",
-  "cp737": {
-    "type": "_sbcs",
-    "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ "
-  },
-  "ibm737": "cp737",
-  "csibm737": "cp737",
-  "cp775": {
-    "type": "_sbcs",
-    "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£Ø×¤ĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’\ad±“¾¶§÷„°∙·¹³²■ "
-  },
-  "ibm775": "cp775",
-  "csibm775": "cp775",
-  "cp850": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´\ad±‗¾¶§÷¸°¨·¹³²■ "
-  },
-  "ibm850": "cp850",
-  "csibm850": "cp850",
-  "cp852": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´\ad˝˛ˇ˘§÷¸°¨˙űŘř■ "
-  },
-  "ibm852": "cp852",
-  "csibm852": "cp852",
-  "cp855": {
-    "type": "_sbcs",
-    "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№\adыЫзЗшШэЭщЩчЧ§■ "
-  },
-  "ibm855": "cp855",
-  "csibm855": "cp855",
-  "cp856": {
-    "type": "_sbcs",
-    "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´\ad±‗¾¶§÷¸°¨·¹³²■ "
-  },
-  "ibm856": "cp856",
-  "csibm856": "cp856",
-  "cp857": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´\ad±�¾¶§÷¸°¨·¹³²■ "
-  },
-  "ibm857": "cp857",
-  "csibm857": "cp857",
-  "cp858": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´\ad±‗¾¶§÷¸°¨·¹³²■ "
-  },
-  "ibm858": "cp858",
-  "csibm858": "cp858",
-  "cp860": {
-    "type": "_sbcs",
-    "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
-  },
-  "ibm860": "cp860",
-  "csibm860": "cp860",
-  "cp861": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
-  },
-  "ibm861": "cp861",
-  "csibm861": "cp861",
-  "cp862": {
-    "type": "_sbcs",
-    "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
-  },
-  "ibm862": "cp862",
-  "csibm862": "cp862",
-  "cp863": {
-    "type": "_sbcs",
-    "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
-  },
-  "ibm863": "cp863",
-  "csibm863": "cp863",
-  "cp864": {
-    "type": "_sbcs",
-    "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\7f°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� \adﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�"
-  },
-  "ibm864": "cp864",
-  "csibm864": "cp864",
-  "cp865": {
-    "type": "_sbcs",
-    "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
-  },
-  "ibm865": "cp865",
-  "csibm865": "cp865",
-  "cp866": {
-    "type": "_sbcs",
-    "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ "
-  },
-  "ibm866": "cp866",
-  "csibm866": "cp866",
-  "cp869": {
-    "type": "_sbcs",
-    "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄\ad±υφχ§ψ΅°¨ωϋΰώ■ "
-  },
-  "ibm869": "cp869",
-  "csibm869": "cp869",
-  "cp922": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£¤¥¦§¨©ª«¬\ad®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"
-  },
-  "ibm922": "cp922",
-  "csibm922": "cp922",
-  "cp1046": {
-    "type": "_sbcs",
-    "chars": "ﺈ×÷\f8f6\f8f5\f8f4\f8f7\88■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ \f8fa\f8f9\f8f8¤\f8fbﺋﺑﺗﺛﺟﺣ،\adﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟ\f8fcﻵﻷﻹﻻﻣﻧﻬﻩ�"
-  },
-  "ibm1046": "cp1046",
-  "csibm1046": "cp1046",
-  "cp1124": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ЁЂҐЄЅІЇЈЉЊЋЌ\adЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ"
-  },
-  "ibm1124": "cp1124",
-  "csibm1124": "cp1124",
-  "cp1125": {
-    "type": "_sbcs",
-    "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ "
-  },
-  "ibm1125": "cp1125",
-  "csibm1125": "cp1125",
-  "cp1129": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£¤¥¦§œ©ª«¬\ad®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"
-  },
-  "ibm1129": "cp1129",
-  "csibm1129": "cp1129",
-  "cp1133": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�"
-  },
-  "ibm1133": "cp1133",
-  "csibm1133": "cp1133",
-  "cp1161": {
-    "type": "_sbcs",
-    "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ "
-  },
-  "ibm1161": "cp1161",
-  "csibm1161": "cp1161",
-  "cp1162": {
-    "type": "_sbcs",
-    "chars": "€\81\82\83\84\86\87\88\89\8a\8b\8c\8d\8e\8f\90‘’“”•–—\98\99\9a\9b\9c\9d\9e\9f กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
-  },
-  "ibm1162": "cp1162",
-  "csibm1162": "cp1162",
-  "cp1163": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£€¥¦§œ©ª«¬\ad®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"
-  },
-  "ibm1163": "cp1163",
-  "csibm1163": "cp1163",
-  "maccroatian": {
-    "type": "_sbcs",
-    "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ"
-  },
-  "maccyrillic": {
-    "type": "_sbcs",
-    "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤"
-  },
-  "macgreek": {
-    "type": "_sbcs",
-    "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦\adùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�"
-  },
-  "maciceland": {
-    "type": "_sbcs",
-    "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
-  },
-  "macroman": {
-    "type": "_sbcs",
-    "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
-  },
-  "macromania": {
-    "type": "_sbcs",
-    "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
-  },
-  "macthai": {
-    "type": "_sbcs",
-    "chars": "«»…\f88c\f88f\f892\f895\f898\f88b\f88e\f891\f894\f897“”\f899�•\f884\f889\f885\f886\f887\f888\f88a\f88d\f890\f893\f896‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู\feff\200b–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����"
-  },
-  "macturkish": {
-    "type": "_sbcs",
-    "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ"
-  },
-  "macukraine": {
-    "type": "_sbcs",
-    "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤"
-  },
-  "koi8r": {
-    "type": "_sbcs",
-    "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
-  },
-  "koi8u": {
-    "type": "_sbcs",
-    "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
-  },
-  "koi8ru": {
-    "type": "_sbcs",
-    "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
-  },
-  "koi8t": {
-    "type": "_sbcs",
-    "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬\ad®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ"
-  },
-  "armscii8": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�"
-  },
-  "rk1048": {
-    "type": "_sbcs",
-    "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬\ad®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
-  },
-  "tcvn": {
-    "type": "_sbcs",
-    "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\7fÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ"
-  },
-  "georgianacademy": {
-    "type": "_sbcs",
-    "chars": "\80\81‚ƒ„…†‡ˆ‰Š‹Œ\8d\8e\8f\90‘’“”•–—˜™š›œ\9d\9eŸ ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
-  },
-  "georgianps": {
-    "type": "_sbcs",
-    "chars": "\80\81‚ƒ„…†‡ˆ‰Š‹Œ\8d\8e\8f\90‘’“”•–—˜™š›œ\9d\9eŸ ¡¢£¤¥¦§¨©ª«¬\ad®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
-  },
-  "pt154": {
-    "type": "_sbcs",
-    "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
-  },
-  "viscii": {
-    "type": "_sbcs",
-    "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\7fẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ"
-  },
-  "iso646cn": {
-    "type": "_sbcs",
-    "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾\7f��������������������������������������������������������������������������������������������������������������������������������"
-  },
-  "iso646jp": {
-    "type": "_sbcs",
-    "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾\7f��������������������������������������������������������������������������������������������������������������������������������"
-  },
-  "hproman8": {
-    "type": "_sbcs",
-    "chars": "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�"
-  },
-  "macintosh": {
-    "type": "_sbcs",
-    "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"
-  },
-  "ascii": {
-    "type": "_sbcs",
-    "chars": "��������������������������������������������������������������������������������������������������������������������������������"
-  },
-  "tis620": {
-    "type": "_sbcs",
-    "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"
-  }
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/sbcs-data.js
deleted file mode 100644 (file)
index 2d6f846..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-"use strict";
-
-// Manually added data to be used by sbcs codec in addition to generated one.
-
-module.exports = {
-    // Not supported by iconv, not sure why.
-    "10029": "maccenteuro",
-    "maccenteuro": {
-        "type": "_sbcs",
-        "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ"
-    },
-
-    "808": "cp808",
-    "ibm808": "cp808",
-    "cp808": {
-        "type": "_sbcs",
-        "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ "
-    },
-
-    // Aliases of generated encodings.
-    "ascii8bit": "ascii",
-    "usascii": "ascii",
-    "ansix34": "ascii",
-    "ansix341968": "ascii",
-    "ansix341986": "ascii",
-    "csascii": "ascii",
-    "cp367": "ascii",
-    "ibm367": "ascii",
-    "isoir6": "ascii",
-    "iso646us": "ascii",
-    "iso646irv": "ascii",
-    "us": "ascii",
-
-    "latin1": "iso88591",
-    "latin2": "iso88592",
-    "latin3": "iso88593",
-    "latin4": "iso88594",
-    "latin5": "iso88599",
-    "latin6": "iso885910",
-    "latin7": "iso885913",
-    "latin8": "iso885914",
-    "latin9": "iso885915",
-    "latin10": "iso885916",
-
-    "csisolatin1": "iso88591",
-    "csisolatin2": "iso88592",
-    "csisolatin3": "iso88593",
-    "csisolatin4": "iso88594",
-    "csisolatincyrillic": "iso88595",
-    "csisolatinarabic": "iso88596",
-    "csisolatingreek" : "iso88597",
-    "csisolatinhebrew": "iso88598",
-    "csisolatin5": "iso88599",
-    "csisolatin6": "iso885910",
-
-    "l1": "iso88591",
-    "l2": "iso88592",
-    "l3": "iso88593",
-    "l4": "iso88594",
-    "l5": "iso88599",
-    "l6": "iso885910",
-    "l7": "iso885913",
-    "l8": "iso885914",
-    "l9": "iso885915",
-    "l10": "iso885916",
-
-    "isoir14": "iso646jp",
-    "isoir57": "iso646cn",
-    "isoir100": "iso88591",
-    "isoir101": "iso88592",
-    "isoir109": "iso88593",
-    "isoir110": "iso88594",
-    "isoir144": "iso88595",
-    "isoir127": "iso88596",
-    "isoir126": "iso88597",
-    "isoir138": "iso88598",
-    "isoir148": "iso88599",
-    "isoir157": "iso885910",
-    "isoir166": "tis620",
-    "isoir179": "iso885913",
-    "isoir199": "iso885914",
-    "isoir203": "iso885915",
-    "isoir226": "iso885916",
-
-    "cp819": "iso88591",
-    "ibm819": "iso88591",
-
-    "cyrillic": "iso88595",
-
-    "arabic": "iso88596",
-    "arabic8": "iso88596",
-    "ecma114": "iso88596",
-    "asmo708": "iso88596",
-
-    "greek" : "iso88597",
-    "greek8" : "iso88597",
-    "ecma118" : "iso88597",
-    "elot928" : "iso88597",
-
-    "hebrew": "iso88598",
-    "hebrew8": "iso88598",
-
-    "turkish": "iso88599",
-    "turkish8": "iso88599",
-
-    "thai": "iso885911",
-    "thai8": "iso885911",
-
-    "celtic": "iso885914",
-    "celtic8": "iso885914",
-    "isoceltic": "iso885914",
-
-    "tis6200": "tis620",
-    "tis62025291": "tis620",
-    "tis62025330": "tis620",
-
-    "10000": "macroman",
-    "10006": "macgreek",
-    "10007": "maccyrillic",
-    "10079": "maciceland",
-    "10081": "macturkish",
-
-    "cspc8codepage437": "cp437",
-    "cspc775baltic": "cp775",
-    "cspc850multilingual": "cp850",
-    "cspcp852": "cp852",
-    "cspc862latinhebrew": "cp862",
-    "cpgr": "cp869",
-
-    "msee": "cp1250",
-    "mscyrl": "cp1251",
-    "msansi": "cp1252",
-    "msgreek": "cp1253",
-    "msturk": "cp1254",
-    "mshebr": "cp1255",
-    "msarab": "cp1256",
-    "winbaltrim": "cp1257",
-
-    "cp20866": "koi8r",
-    "20866": "koi8r",
-    "ibm878": "koi8r",
-    "cskoi8r": "koi8r",
-
-    "cp21866": "koi8u",
-    "21866": "koi8u",
-    "ibm1168": "koi8u",
-
-    "strk10482002": "rk1048",
-
-    "tcvn5712": "tcvn",
-    "tcvn57121": "tcvn",
-
-    "gb198880": "iso646cn",
-    "cn": "iso646cn",
-
-    "csiso14jisc6220ro": "iso646jp",
-    "jisc62201969ro": "iso646jp",
-    "jp": "iso646jp",
-
-    "cshproman8": "hproman8",
-    "r8": "hproman8",
-    "roman8": "hproman8",
-    "xroman8": "hproman8",
-    "ibm1051": "hproman8",
-
-    "mac": "macintosh",
-    "csmacintosh": "macintosh",
-};
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/big5-added.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/big5-added.json
deleted file mode 100644 (file)
index 3c3d3c2..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-[
-["8740","䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"],
-["8767","綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬"],
-["87a1","𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋"],
-["8840","㇀",4,"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒ࿿Ê̄Ế࿿Ê̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ"],
-["88a1","ǜü࿿ê̄ế࿿ê̌ềêɡ⏚⏛"],
-["8940","𪎩𡅅"],
-["8943","攊"],
-["8946","丽滝鵎釟"],
-["894c","𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮"],
-["89a1","琑糼緍楆竉刧"],
-["89ab","醌碸酞肼"],
-["89b0","贋胶𠧧"],
-["89b5","肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁"],
-["89c1","溚舾甙"],
-["89c5","䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅"],
-["8a40","𧶄唥"],
-["8a43","𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓"],
-["8a64","𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕"],
-["8a76","䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯"],
-["8aa1","𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱"],
-["8aac","䠋𠆩㿺塳𢶍"],
-["8ab2","𤗈𠓼𦂗𠽌𠶖啹䂻䎺"],
-["8abb","䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃"],
-["8ac9","𪘁𠸉𢫏𢳉"],
-["8ace","𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻"],
-["8adf","𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌"],
-["8af6","𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭"],
-["8b40","𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹"],
-["8b55","𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑"],
-["8ba1","𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁"],
-["8bde","𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢"],
-["8c40","倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋"],
-["8ca1","𣏹椙橃𣱣泿"],
-["8ca7","爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚"],
-["8cc9","顨杫䉶圽"],
-["8cce","藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶"],
-["8ce6","峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻"],
-["8d40","𠮟"],
-["8d42","𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱"],
-["8da1","㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘"],
-["8e40","𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎"],
-["8ea1","繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛"],
-["8f40","蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖"],
-["8fa1","𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起"],
-["9040","趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛"],
-["90a1","𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜"],
-["9140","𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈"],
-["91a1","鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨"],
-["9240","𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘"],
-["92a1","働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃"],
-["9340","媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍"],
-["93a1","摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋"],
-["9440","銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻"],
-["94a1","㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡"],
-["9540","𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂"],
-["95a1","衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰"],
-["9640","桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸"],
-["96a1","𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉"],
-["9740","愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫"],
-["97a1","𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎"],
-["9840","𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦"],
-["98a1","咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃"],
-["9940","䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚"],
-["99a1","䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿"],
-["9a40","鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺"],
-["9aa1","黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪"],
-["9b40","𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌"],
-["9b62","𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎"],
-["9ba1","椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊"],
-["9c40","嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶"],
-["9ca1","㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏"],
-["9d40","𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁"],
-["9da1","辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢"],
-["9e40","𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺"],
-["9ea1","鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭"],
-["9ead","𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹"],
-["9ec5","㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲"],
-["9ef5","噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼"],
-["9f40","籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱"],
-["9f4f","凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰"],
-["9fa1","椬叚鰊鴂䰻陁榀傦畆𡝭駚剳"],
-["9fae","酙隁酜"],
-["9fb2","酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽"],
-["9fc1","𤤙盖鮝个𠳔莾衂"],
-["9fc9","届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳"],
-["9fdb","歒酼龥鮗頮颴骺麨麄煺笔"],
-["9fe7","毺蠘罸"],
-["9feb","嘠𪙊蹷齓"],
-["9ff0","跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇"],
-["a040","𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷"],
-["a055","𡠻𦸅"],
-["a058","詾𢔛"],
-["a05b","惽癧髗鵄鍮鮏蟵"],
-["a063","蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽"],
-["a073","坟慯抦戹拎㩜懢厪𣏵捤栂㗒"],
-["a0a1","嵗𨯂迚𨸹"],
-["a0a6","僙𡵆礆匲阸𠼻䁥"],
-["a0ae","矾"],
-["a0b0","糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦"],
-["a0d4","覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷"],
-["a0e2","罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫"],
-["a3c0","␀",31,"␡"],
-["c6a1","①",9,"⑴",9,"ⅰ",9,"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー[]✽ぁ",23],
-["c740","す",58,"ァアィイ"],
-["c7a1","ゥ",81,"А",5,"ЁЖ",4],
-["c840","Л",26,"ёж",25,"⇧↸↹㇏𠃌乚𠂊刂䒑"],
-["c8a1","龰冈龱𧘇"],
-["c8cd","¬¦'"㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣"],
-["c8f5","ʃɐɛɔɵœøŋʊɪ"],
-["f9fe","■"],
-["fa40","𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸"],
-["faa1","鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍"],
-["fb40","𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙"],
-["fba1","𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂"],
-["fc40","廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷"],
-["fca1","𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝"],
-["fd40","𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀"],
-["fda1","𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎"],
-["fe40","鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌"],
-["fea1","𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔"]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp936.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp936.json
deleted file mode 100644 (file)
index 49ddb9a..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-[
-["0","\u0000",127,"€"],
-["8140","丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪",5,"乲乴",9,"乿",6,"亇亊"],
-["8180","亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂",6,"伋伌伒",4,"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾",4,"佄佅佇",5,"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢"],
-["8240","侤侫侭侰",4,"侶",8,"俀俁係俆俇俈俉俋俌俍俒",4,"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿",11],
-["8280","個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯",10,"倻倽倿偀偁偂偄偅偆偉偊偋偍偐",4,"偖偗偘偙偛偝",7,"偦",5,"偭",8,"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎",20,"傤傦傪傫傭",4,"傳",6,"傼"],
-["8340","傽",17,"僐",5,"僗僘僙僛",10,"僨僩僪僫僯僰僱僲僴僶",4,"僼",9,"儈"],
-["8380","儉儊儌",5,"儓",13,"儢",28,"兂兇兊兌兎兏児兒兓兗兘兙兛兝",4,"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦",4,"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒",5],
-["8440","凘凙凚凜凞凟凢凣凥",5,"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄",5,"剋剎剏剒剓剕剗剘"],
-["8480","剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳",9,"剾劀劃",4,"劉",6,"劑劒劔",6,"劜劤劥劦劧劮劯劰労",9,"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務",5,"勠勡勢勣勥",10,"勱",7,"勻勼勽匁匂匃匄匇匉匊匋匌匎"],
-["8540","匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯",9,"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏"],
-["8580","厐",4,"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯",6,"厷厸厹厺厼厽厾叀參",4,"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝",4,"呣呥呧呩",7,"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡"],
-["8640","咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠",4,"哫哬哯哰哱哴",5,"哻哾唀唂唃唄唅唈唊",4,"唒唓唕",5,"唜唝唞唟唡唥唦"],
-["8680","唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋",4,"啑啒啓啔啗",4,"啝啞啟啠啢啣啨啩啫啯",5,"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠",6,"喨",8,"喲喴営喸喺喼喿",4,"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗",4,"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸",4,"嗿嘂嘃嘄嘅"],
-["8740","嘆嘇嘊嘋嘍嘐",7,"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀",11,"噏",4,"噕噖噚噛噝",4],
-["8780","噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽",7,"嚇",6,"嚐嚑嚒嚔",14,"嚤",10,"嚰",6,"嚸嚹嚺嚻嚽",12,"囋",8,"囕囖囘囙囜団囥",5,"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國",6],
-["8840","園",9,"圝圞圠圡圢圤圥圦圧圫圱圲圴",4,"圼圽圿坁坃坄坅坆坈坉坋坒",4,"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀"],
-["8880","垁垇垈垉垊垍",4,"垔",6,"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹",8,"埄",6,"埌埍埐埑埓埖埗埛埜埞埡埢埣埥",7,"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥",4,"堫",4,"報堲堳場堶",7],
-["8940","堾",5,"塅",6,"塎塏塐塒塓塕塖塗塙",4,"塟",5,"塦",4,"塭",16,"塿墂墄墆墇墈墊墋墌"],
-["8980","墍",4,"墔",4,"墛墜墝墠",7,"墪",17,"墽墾墿壀壂壃壄壆",10,"壒壓壔壖",13,"壥",5,"壭壯壱売壴壵壷壸壺",7,"夃夅夆夈",4,"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻"],
-["8a40","夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛",4,"奡奣奤奦",12,"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦"],
-["8a80","妧妬妭妰妱妳",5,"妺妼妽妿",6,"姇姈姉姌姍姎姏姕姖姙姛姞",4,"姤姦姧姩姪姫姭",11,"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪",6,"娳娵娷",4,"娽娾娿婁",4,"婇婈婋",9,"婖婗婘婙婛",5],
-["8b40","婡婣婤婥婦婨婩婫",8,"婸婹婻婼婽婾媀",17,"媓",6,"媜",13,"媫媬"],
-["8b80","媭",4,"媴媶媷媹",4,"媿嫀嫃",5,"嫊嫋嫍",4,"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬",4,"嫲",22,"嬊",11,"嬘",25,"嬳嬵嬶嬸",7,"孁",6],
-["8c40","孈",7,"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏"],
-["8c80","寑寔",8,"寠寢寣實寧審",4,"寯寱",6,"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧",6,"屰屲",6,"屻屼屽屾岀岃",4,"岉岊岋岎岏岒岓岕岝",4,"岤",4],
-["8d40","岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅",5,"峌",5,"峓",5,"峚",6,"峢峣峧峩峫峬峮峯峱",9,"峼",4],
-["8d80","崁崄崅崈",5,"崏",4,"崕崗崘崙崚崜崝崟",4,"崥崨崪崫崬崯",4,"崵",7,"崿",7,"嵈嵉嵍",10,"嵙嵚嵜嵞",10,"嵪嵭嵮嵰嵱嵲嵳嵵",12,"嶃",21,"嶚嶛嶜嶞嶟嶠"],
-["8e40","嶡",21,"嶸",12,"巆",6,"巎",12,"巜巟巠巣巤巪巬巭"],
-["8e80","巰巵巶巸",4,"巿帀帄帇帉帊帋帍帎帒帓帗帞",7,"帨",4,"帯帰帲",4,"帹帺帾帿幀幁幃幆",5,"幍",6,"幖",4,"幜幝幟幠幣",14,"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨",4,"庮",4,"庴庺庻庼庽庿",6],
-["8f40","廆廇廈廋",5,"廔廕廗廘廙廚廜",11,"廩廫",8,"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤"],
-["8f80","弨弫弬弮弰弲",6,"弻弽弾弿彁",14,"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢",5,"復徫徬徯",5,"徶徸徹徺徻徾",4,"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇"],
-["9040","怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰",4,"怶",4,"怽怾恀恄",6,"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀"],
-["9080","悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽",7,"惇惈惉惌",4,"惒惓惔惖惗惙惛惞惡",4,"惪惱惲惵惷惸惻",4,"愂愃愄愅愇愊愋愌愐",4,"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬",18,"慀",6],
-["9140","慇慉態慍慏慐慒慓慔慖",6,"慞慟慠慡慣慤慥慦慩",6,"慱慲慳慴慶慸",18,"憌憍憏",4,"憕"],
-["9180","憖",6,"憞",8,"憪憫憭",9,"憸",5,"憿懀懁懃",4,"應懌",4,"懓懕",16,"懧",13,"懶",8,"戀",5,"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸",4,"扂扄扅扆扊"],
-["9240","扏扐払扖扗扙扚扜",6,"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋",5,"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁"],
-["9280","拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳",5,"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖",7,"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙",6,"採掤掦掫掯掱掲掵掶掹掻掽掿揀"],
-["9340","揁揂揃揅揇揈揊揋揌揑揓揔揕揗",6,"揟揢揤",4,"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆",4,"損搎搑搒搕",5,"搝搟搢搣搤"],
-["9380","搥搧搨搩搫搮",5,"搵",4,"搻搼搾摀摂摃摉摋",6,"摓摕摖摗摙",4,"摟",7,"摨摪摫摬摮",9,"摻",6,"撃撆撈",8,"撓撔撗撘撚撛撜撝撟",4,"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆",6,"擏擑擓擔擕擖擙據"],
-["9440","擛擜擝擟擠擡擣擥擧",24,"攁",7,"攊",7,"攓",4,"攙",8],
-["9480","攢攣攤攦",4,"攬攭攰攱攲攳攷攺攼攽敀",4,"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數",14,"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱",7,"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘",7,"旡旣旤旪旫"],
-["9540","旲旳旴旵旸旹旻",4,"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷",4,"昽昿晀時晄",6,"晍晎晐晑晘"],
-["9580","晙晛晜晝晞晠晢晣晥晧晩",4,"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘",4,"暞",8,"暩",4,"暯",4,"暵暶暷暸暺暻暼暽暿",25,"曚曞",7,"曧曨曪",5,"曱曵曶書曺曻曽朁朂會"],
-["9640","朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠",5,"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗",4,"杝杢杣杤杦杧杫杬杮東杴杶"],
-["9680","杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹",7,"柂柅",9,"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵",7,"柾栁栂栃栄栆栍栐栒栔栕栘",4,"栞栟栠栢",6,"栫",6,"栴栵栶栺栻栿桇桋桍桏桒桖",5],
-["9740","桜桝桞桟桪桬",7,"桵桸",8,"梂梄梇",7,"梐梑梒梔梕梖梘",9,"梣梤梥梩梪梫梬梮梱梲梴梶梷梸"],
-["9780","梹",6,"棁棃",5,"棊棌棎棏棐棑棓棔棖棗棙棛",4,"棡棢棤",9,"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆",4,"椌椏椑椓",11,"椡椢椣椥",7,"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃",16,"楕楖楘楙楛楜楟"],
-["9840","楡楢楤楥楧楨楩楪楬業楯楰楲",4,"楺楻楽楾楿榁榃榅榊榋榌榎",5,"榖榗榙榚榝",9,"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽"],
-["9880","榾榿槀槂",7,"構槍槏槑槒槓槕",5,"槜槝槞槡",11,"槮槯槰槱槳",9,"槾樀",9,"樋",11,"標",5,"樠樢",5,"権樫樬樭樮樰樲樳樴樶",6,"樿",4,"橅橆橈",7,"橑",6,"橚"],
-["9940","橜",4,"橢橣橤橦",10,"橲",6,"橺橻橽橾橿檁檂檃檅",8,"檏檒",4,"檘",7,"檡",5],
-["9980","檧檨檪檭",114,"欥欦欨",6],
-["9a40","欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍",11,"歚",7,"歨歩歫",13,"歺歽歾歿殀殅殈"],
-["9a80","殌殎殏殐殑殔殕殗殘殙殜",4,"殢",7,"殫",7,"殶殸",6,"毀毃毄毆",4,"毌毎毐毑毘毚毜",4,"毢",7,"毬毭毮毰毱毲毴毶毷毸毺毻毼毾",6,"氈",4,"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋",4,"汑汒汓汖汘"],
-["9b40","汙汚汢汣汥汦汧汫",4,"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘"],
-["9b80","泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟",5,"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽",4,"涃涄涆涇涊涋涍涏涐涒涖",4,"涜涢涥涬涭涰涱涳涴涶涷涹",5,"淁淂淃淈淉淊"],
-["9c40","淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽",7,"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵"],
-["9c80","渶渷渹渻",7,"湅",7,"湏湐湑湒湕湗湙湚湜湝湞湠",10,"湬湭湯",14,"満溁溂溄溇溈溊",4,"溑",6,"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪",5],
-["9d40","滰滱滲滳滵滶滷滸滺",7,"漃漄漅漇漈漊",4,"漐漑漒漖",9,"漡漢漣漥漦漧漨漬漮漰漲漴漵漷",6,"漿潀潁潂"],
-["9d80","潃潄潅潈潉潊潌潎",9,"潙潚潛潝潟潠潡潣潤潥潧",5,"潯潰潱潳潵潶潷潹潻潽",6,"澅澆澇澊澋澏",12,"澝澞澟澠澢",4,"澨",10,"澴澵澷澸澺",5,"濁濃",5,"濊",6,"濓",10,"濟濢濣濤濥"],
-["9e40","濦",7,"濰",32,"瀒",7,"瀜",6,"瀤",6],
-["9e80","瀫",9,"瀶瀷瀸瀺",17,"灍灎灐",13,"灟",11,"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞",12,"炰炲炴炵炶為炾炿烄烅烆烇烉烋",12,"烚"],
-["9f40","烜烝烞烠烡烢烣烥烪烮烰",6,"烸烺烻烼烾",10,"焋",4,"焑焒焔焗焛",10,"焧",7,"焲焳焴"],
-["9f80","焵焷",13,"煆煇煈煉煋煍煏",12,"煝煟",4,"煥煩",4,"煯煰煱煴煵煶煷煹煻煼煾",5,"熅",4,"熋熌熍熎熐熑熒熓熕熖熗熚",4,"熡",6,"熩熪熫熭",5,"熴熶熷熸熺",8,"燄",9,"燏",4],
-["a040","燖",9,"燡燢燣燤燦燨",5,"燯",9,"燺",11,"爇",19],
-["a080","爛爜爞",9,"爩爫爭爮爯爲爳爴爺爼爾牀",6,"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅",4,"犌犎犐犑犓",11,"犠",11,"犮犱犲犳犵犺",6,"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛"],
-["a1a1"," 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈",7,"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓"],
-["a2a1","ⅰ",9],
-["a2b1","⒈",19,"⑴",19,"①",9],
-["a2e5","㈠",9],
-["a2f1","Ⅰ",11],
-["a3a1","!"#¥%",88," ̄"],
-["a4a1","ぁ",82],
-["a5a1","ァ",85],
-["a6a1","Α",16,"Σ",6],
-["a6c1","α",16,"σ",6],
-["a6e0","︵︶︹︺︿﹀︽︾﹁﹂﹃﹄"],
-["a6ee","︻︼︷︸︱"],
-["a6f4","︳︴"],
-["a7a1","А",5,"ЁЖ",25],
-["a7d1","а",5,"ёж",25],
-["a840","ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═",35,"▁",6],
-["a880","█",7,"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞"],
-["a8a1","āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ"],
-["a8bd","ńň"],
-["a8c0","ɡ"],
-["a8c5","ㄅ",36],
-["a940","〡",8,"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦"],
-["a959","℡㈱"],
-["a95c","‐"],
-["a960","ー゛゜ヽヾ〆ゝゞ﹉",9,"﹔﹕﹖﹗﹙",8],
-["a980","﹢",4,"﹨﹩﹪﹫"],
-["a996","〇"],
-["a9a4","─",75],
-["aa40","狜狝狟狢",5,"狪狫狵狶狹狽狾狿猀猂猄",5,"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀",8],
-["aa80","獉獊獋獌獎獏獑獓獔獕獖獘",7,"獡",10,"獮獰獱"],
-["ab40","獲",11,"獿",4,"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣",5,"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃",4],
-["ab80","珋珌珎珒",6,"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳",4],
-["ac40","珸",10,"琄琇琈琋琌琍琎琑",8,"琜",5,"琣琤琧琩琫琭琯琱琲琷",4,"琽琾琿瑀瑂",11],
-["ac80","瑎",6,"瑖瑘瑝瑠",12,"瑮瑯瑱",4,"瑸瑹瑺"],
-["ad40","瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑",10,"璝璟",7,"璪",15,"璻",12],
-["ad80","瓈",9,"瓓",8,"瓝瓟瓡瓥瓧",6,"瓰瓱瓲"],
-["ae40","瓳瓵瓸",6,"甀甁甂甃甅",7,"甎甐甒甔甕甖甗甛甝甞甠",4,"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘"],
-["ae80","畝",7,"畧畨畩畫",6,"畳畵當畷畺",4,"疀疁疂疄疅疇"],
-["af40","疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦",4,"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇"],
-["af80","瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄"],
-["b040","癅",6,"癎",5,"癕癗",4,"癝癟癠癡癢癤",6,"癬癭癮癰",7,"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛"],
-["b080","皜",7,"皥",8,"皯皰皳皵",9,"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥"],
-["b140","盄盇盉盋盌盓盕盙盚盜盝盞盠",4,"盦",7,"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎",10,"眛眜眝眞眡眣眤眥眧眪眫"],
-["b180","眬眮眰",4,"眹眻眽眾眿睂睄睅睆睈",7,"睒",7,"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳"],
-["b240","睝睞睟睠睤睧睩睪睭",11,"睺睻睼瞁瞂瞃瞆",5,"瞏瞐瞓",11,"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶",4],
-["b280","瞼瞾矀",12,"矎",8,"矘矙矚矝",4,"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖"],
-["b340","矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃",5,"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚"],
-["b380","硛硜硞",11,"硯",7,"硸硹硺硻硽",6,"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚"],
-["b440","碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨",7,"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚",9],
-["b480","磤磥磦磧磩磪磫磭",4,"磳磵磶磸磹磻",5,"礂礃礄礆",6,"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮"],
-["b540","礍",5,"礔",9,"礟",4,"礥",14,"礵",4,"礽礿祂祃祄祅祇祊",8,"祔祕祘祙祡祣"],
-["b580","祤祦祩祪祫祬祮祰",6,"祹祻",4,"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠"],
-["b640","禓",6,"禛",11,"禨",10,"禴",4,"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙",5,"秠秡秢秥秨秪"],
-["b680","秬秮秱",6,"秹秺秼秾秿稁稄稅稇稈稉稊稌稏",4,"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二"],
-["b740","稝稟稡稢稤",14,"稴稵稶稸稺稾穀",5,"穇",9,"穒",4,"穘",16],
-["b780","穩",6,"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服"],
-["b840","窣窤窧窩窪窫窮",4,"窴",10,"竀",10,"竌",9,"竗竘竚竛竜竝竡竢竤竧",5,"竮竰竱竲竳"],
-["b880","竴",4,"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹"],
-["b940","笯笰笲笴笵笶笷笹笻笽笿",5,"筆筈筊筍筎筓筕筗筙筜筞筟筡筣",10,"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆",6,"箎箏"],
-["b980","箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹",7,"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈"],
-["ba40","篅篈築篊篋篍篎篏篐篒篔",4,"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲",4,"篸篹篺篻篽篿",7,"簈簉簊簍簎簐",5,"簗簘簙"],
-["ba80","簚",4,"簠",5,"簨簩簫",12,"簹",5,"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖"],
-["bb40","籃",9,"籎",36,"籵",5,"籾",9],
-["bb80","粈粊",6,"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴",4,"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕"],
-["bc40","粿糀糂糃糄糆糉糋糎",6,"糘糚糛糝糞糡",6,"糩",5,"糰",7,"糹糺糼",13,"紋",5],
-["bc80","紑",14,"紡紣紤紥紦紨紩紪紬紭紮細",6,"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件"],
-["bd40","紷",54,"絯",7],
-["bd80","絸",32,"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸"],
-["be40","継",12,"綧",6,"綯",42],
-["be80","線",32,"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻"],
-["bf40","緻",62],
-["bf80","縺縼",4,"繂",4,"繈",21,"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀"],
-["c040","繞",35,"纃",23,"纜纝纞"],
-["c080","纮纴纻纼绖绤绬绹缊缐缞缷缹缻",6,"罃罆",9,"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐"],
-["c140","罖罙罛罜罝罞罠罣",4,"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂",7,"羋羍羏",4,"羕",4,"羛羜羠羢羣羥羦羨",6,"羱"],
-["c180","羳",4,"羺羻羾翀翂翃翄翆翇翈翉翋翍翏",4,"翖翗翙",5,"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿"],
-["c240","翤翧翨翪翫翬翭翯翲翴",6,"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫",5,"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗"],
-["c280","聙聛",13,"聫",5,"聲",11,"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫"],
-["c340","聾肁肂肅肈肊肍",5,"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇",4,"胏",6,"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋"],
-["c380","脌脕脗脙脛脜脝脟",12,"脭脮脰脳脴脵脷脹",4,"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸"],
-["c440","腀",5,"腇腉腍腎腏腒腖腗腘腛",4,"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃",4,"膉膋膌膍膎膐膒",5,"膙膚膞",4,"膤膥"],
-["c480","膧膩膫",7,"膴",5,"膼膽膾膿臄臅臇臈臉臋臍",6,"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁"],
-["c540","臔",14,"臤臥臦臨臩臫臮",4,"臵",5,"臽臿舃與",4,"舎舏舑舓舕",5,"舝舠舤舥舦舧舩舮舲舺舼舽舿"],
-["c580","艀艁艂艃艅艆艈艊艌艍艎艐",7,"艙艛艜艝艞艠",7,"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗"],
-["c640","艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸"],
-["c680","苺苼",4,"茊茋茍茐茒茓茖茘茙茝",9,"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐"],
-["c740","茾茿荁荂荄荅荈荊",4,"荓荕",4,"荝荢荰",6,"荹荺荾",6,"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡",6,"莬莭莮"],
-["c780","莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠"],
-["c840","菮華菳",4,"菺菻菼菾菿萀萂萅萇萈萉萊萐萒",5,"萙萚萛萞",5,"萩",7,"萲",5,"萹萺萻萾",7,"葇葈葉"],
-["c880","葊",6,"葒",4,"葘葝葞葟葠葢葤",4,"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁"],
-["c940","葽",4,"蒃蒄蒅蒆蒊蒍蒏",7,"蒘蒚蒛蒝蒞蒟蒠蒢",12,"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗"],
-["c980","蓘",4,"蓞蓡蓢蓤蓧",4,"蓭蓮蓯蓱",10,"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳"],
-["ca40","蔃",8,"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢",8,"蔭",9,"蔾",4,"蕄蕅蕆蕇蕋",10],
-["ca80","蕗蕘蕚蕛蕜蕝蕟",4,"蕥蕦蕧蕩",8,"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱"],
-["cb40","薂薃薆薈",6,"薐",10,"薝",6,"薥薦薧薩薫薬薭薱",5,"薸薺",6,"藂",6,"藊",4,"藑藒"],
-["cb80","藔藖",5,"藝",6,"藥藦藧藨藪",14,"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔"],
-["cc40","藹藺藼藽藾蘀",4,"蘆",10,"蘒蘓蘔蘕蘗",15,"蘨蘪",13,"蘹蘺蘻蘽蘾蘿虀"],
-["cc80","虁",11,"虒虓處",4,"虛虜虝號虠虡虣",7,"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃"],
-["cd40","虭虯虰虲",6,"蚃",6,"蚎",4,"蚔蚖",5,"蚞",4,"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻",4,"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜"],
-["cd80","蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威"],
-["ce40","蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀",6,"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚",5,"蝡蝢蝦",7,"蝯蝱蝲蝳蝵"],
-["ce80","蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎",4,"螔螕螖螘",6,"螠",4,"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺"],
-["cf40","螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁",4,"蟇蟈蟉蟌",4,"蟔",6,"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯",9],
-["cf80","蟺蟻蟼蟽蟿蠀蠁蠂蠄",5,"蠋",7,"蠔蠗蠘蠙蠚蠜",4,"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓"],
-["d040","蠤",13,"蠳",5,"蠺蠻蠽蠾蠿衁衂衃衆",5,"衎",5,"衕衖衘衚",6,"衦衧衪衭衯衱衳衴衵衶衸衹衺"],
-["d080","衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗",4,"袝",4,"袣袥",5,"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄"],
-["d140","袬袮袯袰袲",4,"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚",4,"裠裡裦裧裩",6,"裲裵裶裷裺裻製裿褀褁褃",5],
-["d180","褉褋",4,"褑褔",4,"褜",4,"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶"],
-["d240","褸",8,"襂襃襅",24,"襠",5,"襧",19,"襼"],
-["d280","襽襾覀覂覄覅覇",26,"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐"],
-["d340","覢",30,"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴",6],
-["d380","觻",4,"訁",5,"計",21,"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉"],
-["d440","訞",31,"訿",8,"詉",21],
-["d480","詟",25,"詺",6,"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧"],
-["d540","誁",7,"誋",7,"誔",46],
-["d580","諃",32,"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政"],
-["d640","諤",34,"謈",27],
-["d680","謤謥謧",30,"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑"],
-["d740","譆",31,"譧",4,"譭",25],
-["d780","讇",24,"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"],
-["d840","谸",8,"豂豃豄豅豈豊豋豍",7,"豖豗豘豙豛",5,"豣",6,"豬",6,"豴豵豶豷豻",6,"貃貄貆貇"],
-["d880","貈貋貍",6,"貕貖貗貙",20,"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝"],
-["d940","貮",62],
-["d980","賭",32,"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼"],
-["da40","贎",14,"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸",8,"趂趃趆趇趈趉趌",4,"趒趓趕",9,"趠趡"],
-["da80","趢趤",12,"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺"],
-["db40","跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾",6,"踆踇踈踋踍踎踐踑踒踓踕",7,"踠踡踤",4,"踫踭踰踲踳踴踶踷踸踻踼踾"],
-["db80","踿蹃蹅蹆蹌",4,"蹓",5,"蹚",11,"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝"],
-["dc40","蹳蹵蹷",4,"蹽蹾躀躂躃躄躆躈",6,"躑躒躓躕",6,"躝躟",11,"躭躮躰躱躳",6,"躻",7],
-["dc80","軃",10,"軏",21,"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥"],
-["dd40","軥",62],
-["dd80","輤",32,"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺"],
-["de40","轅",32,"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆"],
-["de80","迉",4,"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖"],
-["df40","這逜連逤逥逧",5,"逰",4,"逷逹逺逽逿遀遃遅遆遈",4,"過達違遖遙遚遜",5,"遤遦遧適遪遫遬遯",4,"遶",6,"遾邁"],
-["df80","還邅邆邇邉邊邌",4,"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼"],
-["e040","郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅",19,"鄚鄛鄜"],
-["e080","鄝鄟鄠鄡鄤",10,"鄰鄲",6,"鄺",8,"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼"],
-["e140","酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀",4,"醆醈醊醎醏醓",6,"醜",5,"醤",5,"醫醬醰醱醲醳醶醷醸醹醻"],
-["e180","醼",10,"釈釋釐釒",9,"針",8,"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺"],
-["e240","釦",62],
-["e280","鈥",32,"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧",5,"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂"],
-["e340","鉆",45,"鉵",16],
-["e380","銆",7,"銏",24,"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾"],
-["e440","銨",5,"銯",24,"鋉",31],
-["e480","鋩",32,"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑"],
-["e540","錊",51,"錿",10],
-["e580","鍊",31,"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣"],
-["e640","鍬",34,"鎐",27],
-["e680","鎬",29,"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩"],
-["e740","鏎",7,"鏗",54],
-["e780","鐎",32,"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡",6,"缪缫缬缭缯",4,"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬"],
-["e840","鐯",14,"鐿",43,"鑬鑭鑮鑯"],
-["e880","鑰",20,"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹"],
-["e940","锧锳锽镃镈镋镕镚镠镮镴镵長",7,"門",42],
-["e980","閫",32,"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋"],
-["ea40","闌",27,"闬闿阇阓阘阛阞阠阣",6,"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗"],
-["ea80","陘陙陚陜陝陞陠陣陥陦陫陭",4,"陳陸",12,"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰"],
-["eb40","隌階隑隒隓隕隖隚際隝",9,"隨",7,"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖",9,"雡",6,"雫"],
-["eb80","雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗",4,"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻"],
-["ec40","霡",8,"霫霬霮霯霱霳",4,"霺霻霼霽霿",18,"靔靕靗靘靚靜靝靟靣靤靦靧靨靪",7],
-["ec80","靲靵靷",4,"靽",7,"鞆",4,"鞌鞎鞏鞐鞓鞕鞖鞗鞙",4,"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐"],
-["ed40","鞞鞟鞡鞢鞤",6,"鞬鞮鞰鞱鞳鞵",46],
-["ed80","韤韥韨韮",4,"韴韷",23,"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨"],
-["ee40","頏",62],
-["ee80","顎",32,"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶",4,"钼钽钿铄铈",6,"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪"],
-["ef40","顯",5,"颋颎颒颕颙颣風",37,"飏飐飔飖飗飛飜飝飠",4],
-["ef80","飥飦飩",30,"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒",4,"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤",8,"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔"],
-["f040","餈",4,"餎餏餑",28,"餯",26],
-["f080","饊",9,"饖",12,"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨",4,"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦",6,"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙"],
-["f140","馌馎馚",10,"馦馧馩",47],
-["f180","駙",32,"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃"],
-["f240","駺",62],
-["f280","騹",32,"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒"],
-["f340","驚",17,"驲骃骉骍骎骔骕骙骦骩",6,"骲骳骴骵骹骻骽骾骿髃髄髆",4,"髍髎髏髐髒體髕髖髗髙髚髛髜"],
-["f380","髝髞髠髢髣髤髥髧髨髩髪髬髮髰",8,"髺髼",6,"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋"],
-["f440","鬇鬉",5,"鬐鬑鬒鬔",10,"鬠鬡鬢鬤",10,"鬰鬱鬳",7,"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕",5],
-["f480","魛",32,"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤"],
-["f540","魼",62],
-["f580","鮻",32,"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜"],
-["f640","鯜",62],
-["f680","鰛",32,"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅",5,"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞",5,"鲥",4,"鲫鲭鲮鲰",7,"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋"],
-["f740","鰼",62],
-["f780","鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾",4,"鳈鳉鳑鳒鳚鳛鳠鳡鳌",4,"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄"],
-["f840","鳣",62],
-["f880","鴢",32],
-["f940","鵃",62],
-["f980","鶂",32],
-["fa40","鶣",62],
-["fa80","鷢",32],
-["fb40","鸃",27,"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴",9,"麀"],
-["fb80","麁麃麄麅麆麉麊麌",5,"麔",8,"麞麠",5,"麧麨麩麪"],
-["fc40","麫",8,"麵麶麷麹麺麼麿",4,"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰",8,"黺黽黿",6],
-["fc80","鼆",4,"鼌鼏鼑鼒鼔鼕鼖鼘鼚",5,"鼡鼣",8,"鼭鼮鼰鼱"],
-["fd40","鼲",4,"鼸鼺鼼鼿",4,"齅",10,"齒",38],
-["fd80","齹",5,"龁龂龍",11,"龜龝龞龡",4,"郎凉秊裏隣"],
-["fe40","兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩"]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp949.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp949.json
deleted file mode 100644 (file)
index 2022a00..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-[
-["0","\u0000",127],
-["8141","갂갃갅갆갋",4,"갘갞갟갡갢갣갥",6,"갮갲갳갴"],
-["8161","갵갶갷갺갻갽갾갿걁",9,"걌걎",5,"걕"],
-["8181","걖걗걙걚걛걝",18,"걲걳걵걶걹걻",4,"겂겇겈겍겎겏겑겒겓겕",6,"겞겢",5,"겫겭겮겱",6,"겺겾겿곀곂곃곅곆곇곉곊곋곍",7,"곖곘",7,"곢곣곥곦곩곫곭곮곲곴곷",4,"곾곿괁괂괃괅괇",4,"괎괐괒괓"],
-["8241","괔괕괖괗괙괚괛괝괞괟괡",7,"괪괫괮",5],
-["8261","괶괷괹괺괻괽",6,"굆굈굊",5,"굑굒굓굕굖굗"],
-["8281","굙",7,"굢굤",7,"굮굯굱굲굷굸굹굺굾궀궃",4,"궊궋궍궎궏궑",10,"궞",5,"궥",17,"궸",7,"귂귃귅귆귇귉",6,"귒귔",7,"귝귞귟귡귢귣귥",18],
-["8341","귺귻귽귾긂",5,"긊긌긎",5,"긕",7],
-["8361","긝",18,"긲긳긵긶긹긻긼"],
-["8381","긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗",4,"깞깢깣깤깦깧깪깫깭깮깯깱",6,"깺깾",5,"꺆",5,"꺍",46,"꺿껁껂껃껅",6,"껎껒",5,"껚껛껝",8],
-["8441","껦껧껩껪껬껮",5,"껵껶껷껹껺껻껽",8],
-["8461","꼆꼉꼊꼋꼌꼎꼏꼑",18],
-["8481","꼤",7,"꼮꼯꼱꼳꼵",6,"꼾꽀꽄꽅꽆꽇꽊",5,"꽑",10,"꽞",5,"꽦",18,"꽺",5,"꾁꾂꾃꾅꾆꾇꾉",6,"꾒꾓꾔꾖",5,"꾝",26,"꾺꾻꾽꾾"],
-["8541","꾿꿁",5,"꿊꿌꿏",4,"꿕",6,"꿝",4],
-["8561","꿢",5,"꿪",5,"꿲꿳꿵꿶꿷꿹",6,"뀂뀃"],
-["8581","뀅",6,"뀍뀎뀏뀑뀒뀓뀕",6,"뀞",9,"뀩",26,"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞",29,"끾끿낁낂낃낅",6,"낎낐낒",5,"낛낝낞낣낤"],
-["8641","낥낦낧낪낰낲낶낷낹낺낻낽",6,"냆냊",5,"냒"],
-["8661","냓냕냖냗냙",6,"냡냢냣냤냦",10],
-["8681","냱",22,"넊넍넎넏넑넔넕넖넗넚넞",4,"넦넧넩넪넫넭",6,"넶넺",5,"녂녃녅녆녇녉",6,"녒녓녖녗녙녚녛녝녞녟녡",22,"녺녻녽녾녿놁놃",4,"놊놌놎놏놐놑놕놖놗놙놚놛놝"],
-["8741","놞",9,"놩",15],
-["8761","놹",18,"뇍뇎뇏뇑뇒뇓뇕"],
-["8781","뇖",5,"뇞뇠",7,"뇪뇫뇭뇮뇯뇱",7,"뇺뇼뇾",5,"눆눇눉눊눍",6,"눖눘눚",5,"눡",18,"눵",6,"눽",26,"뉙뉚뉛뉝뉞뉟뉡",6,"뉪",4],
-["8841","뉯",4,"뉶",5,"뉽",6,"늆늇늈늊",4],
-["8861","늏늒늓늕늖늗늛",4,"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷"],
-["8881","늸",15,"닊닋닍닎닏닑닓",4,"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉",6,"댒댖",5,"댝",54,"덗덙덚덝덠덡덢덣"],
-["8941","덦덨덪덬덭덯덲덳덵덶덷덹",6,"뎂뎆",5,"뎍"],
-["8961","뎎뎏뎑뎒뎓뎕",10,"뎢",5,"뎩뎪뎫뎭"],
-["8981","뎮",21,"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩",18,"돽",18,"됑",6,"됙됚됛됝됞됟됡",6,"됪됬",7,"됵",15],
-["8a41","둅",10,"둒둓둕둖둗둙",6,"둢둤둦"],
-["8a61","둧",4,"둭",18,"뒁뒂"],
-["8a81","뒃",4,"뒉",19,"뒞",5,"뒥뒦뒧뒩뒪뒫뒭",7,"뒶뒸뒺",5,"듁듂듃듅듆듇듉",6,"듑듒듓듔듖",5,"듞듟듡듢듥듧",4,"듮듰듲",5,"듹",26,"딖딗딙딚딝"],
-["8b41","딞",5,"딦딫",4,"딲딳딵딶딷딹",6,"땂땆"],
-["8b61","땇땈땉땊땎땏땑땒땓땕",6,"땞땢",8],
-["8b81","땫",52,"떢떣떥떦떧떩떬떭떮떯떲떶",4,"떾떿뗁뗂뗃뗅",6,"뗎뗒",5,"뗙",18,"뗭",18],
-["8c41","똀",15,"똒똓똕똖똗똙",4],
-["8c61","똞",6,"똦",5,"똭",6,"똵",5],
-["8c81","똻",12,"뙉",26,"뙥뙦뙧뙩",50,"뚞뚟뚡뚢뚣뚥",5,"뚭뚮뚯뚰뚲",16],
-["8d41","뛃",16,"뛕",8],
-["8d61","뛞",17,"뛱뛲뛳뛵뛶뛷뛹뛺"],
-["8d81","뛻",4,"뜂뜃뜄뜆",33,"뜪뜫뜭뜮뜱",6,"뜺뜼",7,"띅띆띇띉띊띋띍",6,"띖",9,"띡띢띣띥띦띧띩",6,"띲띴띶",5,"띾띿랁랂랃랅",6,"랎랓랔랕랚랛랝랞"],
-["8e41","랟랡",6,"랪랮",5,"랶랷랹",8],
-["8e61","럂",4,"럈럊",19],
-["8e81","럞",13,"럮럯럱럲럳럵",6,"럾렂",4,"렊렋렍렎렏렑",6,"렚렜렞",5,"렦렧렩렪렫렭",6,"렶렺",5,"롁롂롃롅",11,"롒롔",7,"롞롟롡롢롣롥",6,"롮롰롲",5,"롹롺롻롽",7],
-["8f41","뢅",7,"뢎",17],
-["8f61","뢠",7,"뢩",6,"뢱뢲뢳뢵뢶뢷뢹",4],
-["8f81","뢾뢿룂룄룆",5,"룍룎룏룑룒룓룕",7,"룞룠룢",5,"룪룫룭룮룯룱",6,"룺룼룾",5,"뤅",18,"뤙",6,"뤡",26,"뤾뤿륁륂륃륅",6,"륍륎륐륒",5],
-["9041","륚륛륝륞륟륡",6,"륪륬륮",5,"륶륷륹륺륻륽"],
-["9061","륾",5,"릆릈릋릌릏",15],
-["9081","릟",12,"릮릯릱릲릳릵",6,"릾맀맂",5,"맊맋맍맓",4,"맚맜맟맠맢맦맧맩맪맫맭",6,"맶맻",4,"먂",5,"먉",11,"먖",33,"먺먻먽먾먿멁멃멄멅멆"],
-["9141","멇멊멌멏멐멑멒멖멗멙멚멛멝",6,"멦멪",5],
-["9161","멲멳멵멶멷멹",9,"몆몈몉몊몋몍",5],
-["9181","몓",20,"몪몭몮몯몱몳",4,"몺몼몾",5,"뫅뫆뫇뫉",14,"뫚",33,"뫽뫾뫿묁묂묃묅",7,"묎묐묒",5,"묙묚묛묝묞묟묡",6],
-["9241","묨묪묬",7,"묷묹묺묿",4,"뭆뭈뭊뭋뭌뭎뭑뭒"],
-["9261","뭓뭕뭖뭗뭙",7,"뭢뭤",7,"뭭",4],
-["9281","뭲",21,"뮉뮊뮋뮍뮎뮏뮑",18,"뮥뮦뮧뮩뮪뮫뮭",6,"뮵뮶뮸",7,"믁믂믃믅믆믇믉",6,"믑믒믔",35,"믺믻믽믾밁"],
-["9341","밃",4,"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵"],
-["9361","밶밷밹",6,"뱂뱆뱇뱈뱊뱋뱎뱏뱑",8],
-["9381","뱚뱛뱜뱞",37,"벆벇벉벊벍벏",4,"벖벘벛",4,"벢벣벥벦벩",6,"벲벶",5,"벾벿볁볂볃볅",7,"볎볒볓볔볖볗볙볚볛볝",22,"볷볹볺볻볽"],
-["9441","볾",5,"봆봈봊",5,"봑봒봓봕",8],
-["9461","봞",5,"봥",6,"봭",12],
-["9481","봺",5,"뵁",6,"뵊뵋뵍뵎뵏뵑",6,"뵚",9,"뵥뵦뵧뵩",22,"붂붃붅붆붋",4,"붒붔붖붗붘붛붝",6,"붥",10,"붱",6,"붹",24],
-["9541","뷒뷓뷖뷗뷙뷚뷛뷝",11,"뷪",5,"뷱"],
-["9561","뷲뷳뷵뷶뷷뷹",6,"븁븂븄븆",5,"븎븏븑븒븓"],
-["9581","븕",6,"븞븠",35,"빆빇빉빊빋빍빏",4,"빖빘빜빝빞빟빢빣빥빦빧빩빫",4,"빲빶",4,"빾빿뺁뺂뺃뺅",6,"뺎뺒",5,"뺚",13,"뺩",14],
-["9641","뺸",23,"뻒뻓"],
-["9661","뻕뻖뻙",6,"뻡뻢뻦",5,"뻭",8],
-["9681","뻶",10,"뼂",5,"뼊",13,"뼚뼞",33,"뽂뽃뽅뽆뽇뽉",6,"뽒뽓뽔뽖",44],
-["9741","뾃",16,"뾕",8],
-["9761","뾞",17,"뾱",7],
-["9781","뾹",11,"뿆",5,"뿎뿏뿑뿒뿓뿕",6,"뿝뿞뿠뿢",89,"쀽쀾쀿"],
-["9841","쁀",16,"쁒",5,"쁙쁚쁛"],
-["9861","쁝쁞쁟쁡",6,"쁪",15],
-["9881","쁺",21,"삒삓삕삖삗삙",6,"삢삤삦",5,"삮삱삲삷",4,"삾샂샃샄샆샇샊샋샍샎샏샑",6,"샚샞",5,"샦샧샩샪샫샭",6,"샶샸샺",5,"섁섂섃섅섆섇섉",6,"섑섒섓섔섖",5,"섡섢섥섨섩섪섫섮"],
-["9941","섲섳섴섵섷섺섻섽섾섿셁",6,"셊셎",5,"셖셗"],
-["9961","셙셚셛셝",6,"셦셪",5,"셱셲셳셵셶셷셹셺셻"],
-["9981","셼",8,"솆",5,"솏솑솒솓솕솗",4,"솞솠솢솣솤솦솧솪솫솭솮솯솱",11,"솾",5,"쇅쇆쇇쇉쇊쇋쇍",6,"쇕쇖쇙",6,"쇡쇢쇣쇥쇦쇧쇩",6,"쇲쇴",7,"쇾쇿숁숂숃숅",6,"숎숐숒",5,"숚숛숝숞숡숢숣"],
-["9a41","숤숥숦숧숪숬숮숰숳숵",16],
-["9a61","쉆쉇쉉",6,"쉒쉓쉕쉖쉗쉙",6,"쉡쉢쉣쉤쉦"],
-["9a81","쉧",4,"쉮쉯쉱쉲쉳쉵",6,"쉾슀슂",5,"슊",5,"슑",6,"슙슚슜슞",5,"슦슧슩슪슫슮",5,"슶슸슺",33,"싞싟싡싢싥",5,"싮싰싲싳싴싵싷싺싽싾싿쌁",6,"쌊쌋쌎쌏"],
-["9b41","쌐쌑쌒쌖쌗쌙쌚쌛쌝",6,"쌦쌧쌪",8],
-["9b61","쌳",17,"썆",7],
-["9b81","썎",25,"썪썫썭썮썯썱썳",4,"썺썻썾",5,"쎅쎆쎇쎉쎊쎋쎍",50,"쏁",22,"쏚"],
-["9c41","쏛쏝쏞쏡쏣",4,"쏪쏫쏬쏮",5,"쏶쏷쏹",5],
-["9c61","쏿",8,"쐉",6,"쐑",9],
-["9c81","쐛",8,"쐥",6,"쐭쐮쐯쐱쐲쐳쐵",6,"쐾",9,"쑉",26,"쑦쑧쑩쑪쑫쑭",6,"쑶쑷쑸쑺",5,"쒁",18,"쒕",6,"쒝",12],
-["9d41","쒪",13,"쒹쒺쒻쒽",8],
-["9d61","쓆",25],
-["9d81","쓠",8,"쓪",5,"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂",9,"씍씎씏씑씒씓씕",6,"씝",10,"씪씫씭씮씯씱",6,"씺씼씾",5,"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩",6,"앲앶",5,"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔"],
-["9e41","얖얙얚얛얝얞얟얡",7,"얪",9,"얶"],
-["9e61","얷얺얿",4,"엋엍엏엒엓엕엖엗엙",6,"엢엤엦엧"],
-["9e81","엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑",6,"옚옝",6,"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉",6,"왒왖",5,"왞왟왡",10,"왭왮왰왲",5,"왺왻왽왾왿욁",6,"욊욌욎",5,"욖욗욙욚욛욝",6,"욦"],
-["9f41","욨욪",5,"욲욳욵욶욷욻",4,"웂웄웆",5,"웎"],
-["9f61","웏웑웒웓웕",6,"웞웟웢",5,"웪웫웭웮웯웱웲"],
-["9f81","웳",4,"웺웻웼웾",5,"윆윇윉윊윋윍",6,"윖윘윚",5,"윢윣윥윦윧윩",6,"윲윴윶윸윹윺윻윾윿읁읂읃읅",4,"읋읎읐읙읚읛읝읞읟읡",6,"읩읪읬",7,"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛",4,"잢잧",4,"잮잯잱잲잳잵잶잷"],
-["a041","잸잹잺잻잾쟂",5,"쟊쟋쟍쟏쟑",6,"쟙쟚쟛쟜"],
-["a061","쟞",5,"쟥쟦쟧쟩쟪쟫쟭",13],
-["a081","쟻",4,"젂젃젅젆젇젉젋",4,"젒젔젗",4,"젞젟젡젢젣젥",6,"젮젰젲",5,"젹젺젻젽젾젿졁",6,"졊졋졎",5,"졕",26,"졲졳졵졶졷졹졻",4,"좂좄좈좉좊좎",5,"좕",7,"좞좠좢좣좤"],
-["a141","좥좦좧좩",18,"좾좿죀죁"],
-["a161","죂죃죅죆죇죉죊죋죍",6,"죖죘죚",5,"죢죣죥"],
-["a181","죦",14,"죶",5,"죾죿줁줂줃줇",4,"줎 、。·‥…¨〃\ad―∥\∼‘’“”〔〕〈",9,"±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬"],
-["a241","줐줒",5,"줙",18],
-["a261","줭",6,"줵",18],
-["a281","쥈",7,"쥒쥓쥕쥖쥗쥙",6,"쥢쥤",7,"쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®"],
-["a341","쥱쥲쥳쥵",6,"쥽",10,"즊즋즍즎즏"],
-["a361","즑",6,"즚즜즞",16],
-["a381","즯",16,"짂짃짅짆짉짋",4,"짒짔짗짘짛!",58,"₩]",32," ̄"],
-["a441","짞짟짡짣짥짦짨짩짪짫짮짲",5,"짺짻짽짾짿쨁쨂쨃쨄"],
-["a461","쨅쨆쨇쨊쨎",5,"쨕쨖쨗쨙",12],
-["a481","쨦쨧쨨쨪",28,"ㄱ",93],
-["a541","쩇",4,"쩎쩏쩑쩒쩓쩕",6,"쩞쩢",5,"쩩쩪"],
-["a561","쩫",17,"쩾",5,"쪅쪆"],
-["a581","쪇",16,"쪙",14,"ⅰ",9],
-["a5b0","Ⅰ",9],
-["a5c1","Α",16,"Σ",6],
-["a5e1","α",16,"σ",6],
-["a641","쪨",19,"쪾쪿쫁쫂쫃쫅"],
-["a661","쫆",5,"쫎쫐쫒쫔쫕쫖쫗쫚",5,"쫡",6],
-["a681","쫨쫩쫪쫫쫭",6,"쫵",18,"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃",7],
-["a741","쬋",4,"쬑쬒쬓쬕쬖쬗쬙",6,"쬢",7],
-["a761","쬪",22,"쭂쭃쭄"],
-["a781","쭅쭆쭇쭊쭋쭍쭎쭏쭑",6,"쭚쭛쭜쭞",5,"쭥",7,"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙",9,"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰",9,"㎀",4,"㎺",5,"㎐",4,"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆"],
-["a841","쭭",10,"쭺",14],
-["a861","쮉",18,"쮝",6],
-["a881","쮤",19,"쮹",11,"ÆÐªĦ"],
-["a8a6","IJ"],
-["a8a8","ĿŁØŒºÞŦŊ"],
-["a8b1","㉠",27,"ⓐ",25,"①",14,"½⅓⅔¼¾⅛⅜⅝⅞"],
-["a941","쯅",14,"쯕",10],
-["a961","쯠쯡쯢쯣쯥쯦쯨쯪",18],
-["a981","쯽",14,"찎찏찑찒찓찕",6,"찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀",27,"⒜",25,"⑴",14,"¹²³⁴ⁿ₁₂₃₄"],
-["aa41","찥찦찪찫찭찯찱",6,"찺찿",4,"챆챇챉챊챋챍챎"],
-["aa61","챏",4,"챖챚",5,"챡챢챣챥챧챩",6,"챱챲"],
-["aa81","챳챴챶",29,"ぁ",82],
-["ab41","첔첕첖첗첚첛첝첞첟첡",6,"첪첮",5,"첶첷첹"],
-["ab61","첺첻첽",6,"쳆쳈쳊",5,"쳑쳒쳓쳕",5],
-["ab81","쳛",8,"쳥",6,"쳭쳮쳯쳱",12,"ァ",85],
-["ac41","쳾쳿촀촂",5,"촊촋촍촎촏촑",6,"촚촜촞촟촠"],
-["ac61","촡촢촣촥촦촧촩촪촫촭",11,"촺",4],
-["ac81","촿",28,"쵝쵞쵟А",5,"ЁЖ",25],
-["acd1","а",5,"ёж",25],
-["ad41","쵡쵢쵣쵥",6,"쵮쵰쵲",5,"쵹",7],
-["ad61","춁",6,"춉",10,"춖춗춙춚춛춝춞춟"],
-["ad81","춠춡춢춣춦춨춪",5,"춱",18,"췅"],
-["ae41","췆",5,"췍췎췏췑",16],
-["ae61","췢",5,"췩췪췫췭췮췯췱",6,"췺췼췾",4],
-["ae81","츃츅츆츇츉츊츋츍",6,"츕츖츗츘츚",5,"츢츣츥츦츧츩츪츫"],
-["af41","츬츭츮츯츲츴츶",19],
-["af61","칊",13,"칚칛칝칞칢",5,"칪칬"],
-["af81","칮",5,"칶칷칹칺칻칽",6,"캆캈캊",5,"캒캓캕캖캗캙"],
-["b041","캚",5,"캢캦",5,"캮",12],
-["b061","캻",5,"컂",19],
-["b081","컖",13,"컦컧컩컪컭",6,"컶컺",5,"가각간갇갈갉갊감",7,"같",4,"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆"],
-["b141","켂켃켅켆켇켉",6,"켒켔켖",5,"켝켞켟켡켢켣"],
-["b161","켥",6,"켮켲",5,"켹",11],
-["b181","콅",14,"콖콗콙콚콛콝",6,"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸"],
-["b241","콭콮콯콲콳콵콶콷콹",6,"쾁쾂쾃쾄쾆",5,"쾍"],
-["b261","쾎",18,"쾢",5,"쾩"],
-["b281","쾪",5,"쾱",18,"쿅",6,"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙"],
-["b341","쿌",19,"쿢쿣쿥쿦쿧쿩"],
-["b361","쿪",5,"쿲쿴쿶",5,"쿽쿾쿿퀁퀂퀃퀅",5],
-["b381","퀋",5,"퀒",5,"퀙",19,"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫",4,"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝"],
-["b441","퀮",5,"퀶퀷퀹퀺퀻퀽",6,"큆큈큊",5],
-["b461","큑큒큓큕큖큗큙",6,"큡",10,"큮큯"],
-["b481","큱큲큳큵",6,"큾큿킀킂",18,"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫",4,"닳담답닷",4,"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥"],
-["b541","킕",14,"킦킧킩킪킫킭",5],
-["b561","킳킶킸킺",5,"탂탃탅탆탇탊",5,"탒탖",4],
-["b581","탛탞탟탡탢탣탥",6,"탮탲",5,"탹",11,"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸"],
-["b641","턅",7,"턎",17],
-["b661","턠",15,"턲턳턵턶턷턹턻턼턽턾"],
-["b681","턿텂텆",5,"텎텏텑텒텓텕",6,"텞텠텢",5,"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗"],
-["b741","텮",13,"텽",6,"톅톆톇톉톊"],
-["b761","톋",20,"톢톣톥톦톧"],
-["b781","톩",6,"톲톴톶톷톸톹톻톽톾톿퇁",14,"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩"],
-["b841","퇐",7,"퇙",17],
-["b861","퇫",8,"퇵퇶퇷퇹",13],
-["b881","툈툊",5,"툑",24,"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많",4,"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼"],
-["b941","툪툫툮툯툱툲툳툵",6,"툾퉀퉂",5,"퉉퉊퉋퉌"],
-["b961","퉍",14,"퉝",6,"퉥퉦퉧퉨"],
-["b981","퉩",22,"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바",4,"받",4,"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗"],
-["ba41","튍튎튏튒튓튔튖",5,"튝튞튟튡튢튣튥",6,"튭"],
-["ba61","튮튯튰튲",5,"튺튻튽튾틁틃",4,"틊틌",5],
-["ba81","틒틓틕틖틗틙틚틛틝",6,"틦",9,"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤"],
-["bb41","틻",4,"팂팄팆",5,"팏팑팒팓팕팗",4,"팞팢팣"],
-["bb61","팤팦팧팪팫팭팮팯팱",6,"팺팾",5,"퍆퍇퍈퍉"],
-["bb81","퍊",31,"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤"],
-["bc41","퍪",17,"퍾퍿펁펂펃펅펆펇"],
-["bc61","펈펉펊펋펎펒",5,"펚펛펝펞펟펡",6,"펪펬펮"],
-["bc81","펯",4,"펵펶펷펹펺펻펽",6,"폆폇폊",5,"폑",5,"샥샨샬샴샵샷샹섀섄섈섐섕서",4,"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭"],
-["bd41","폗폙",7,"폢폤",7,"폮폯폱폲폳폵폶폷"],
-["bd61","폸폹폺폻폾퐀퐂",5,"퐉",13],
-["bd81","퐗",5,"퐞",25,"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰"],
-["be41","퐸",7,"푁푂푃푅",14],
-["be61","푔",7,"푝푞푟푡푢푣푥",7,"푮푰푱푲"],
-["be81","푳",4,"푺푻푽푾풁풃",4,"풊풌풎",5,"풕",8,"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄",6,"엌엎"],
-["bf41","풞",10,"풪",14],
-["bf61","풹",18,"퓍퓎퓏퓑퓒퓓퓕"],
-["bf81","퓖",5,"퓝퓞퓠",7,"퓩퓪퓫퓭퓮퓯퓱",6,"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염",5,"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨"],
-["c041","퓾",5,"픅픆픇픉픊픋픍",6,"픖픘",5],
-["c061","픞",25],
-["c081","픸픹픺픻픾픿핁핂핃핅",6,"핎핐핒",5,"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응",7,"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊"],
-["c141","핤핦핧핪핬핮",5,"핶핷핹핺핻핽",6,"햆햊햋"],
-["c161","햌햍햎햏햑",19,"햦햧"],
-["c181","햨",31,"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓"],
-["c241","헊헋헍헎헏헑헓",4,"헚헜헞",5,"헦헧헩헪헫헭헮"],
-["c261","헯",4,"헶헸헺",5,"혂혃혅혆혇혉",6,"혒"],
-["c281","혖",5,"혝혞혟혡혢혣혥",7,"혮",9,"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻"],
-["c341","혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝",4],
-["c361","홢",4,"홨홪",5,"홲홳홵",11],
-["c381","횁횂횄횆",5,"횎횏횑횒횓횕",7,"횞횠횢",5,"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층"],
-["c441","횫횭횮횯횱",7,"횺횼",7,"훆훇훉훊훋"],
-["c461","훍훎훏훐훒훓훕훖훘훚",5,"훡훢훣훥훦훧훩",4],
-["c481","훮훯훱훲훳훴훶",5,"훾훿휁휂휃휅",11,"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼"],
-["c541","휕휖휗휚휛휝휞휟휡",6,"휪휬휮",5,"휶휷휹"],
-["c561","휺휻휽",6,"흅흆흈흊",5,"흒흓흕흚",4],
-["c581","흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵",6,"흾흿힀힂",5,"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜"],
-["c641","힍힎힏힑",6,"힚힜힞",5],
-["c6a1","퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁"],
-["c7a1","퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠"],
-["c8a1","혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝"],
-["caa1","伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕"],
-["cba1","匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢"],
-["cca1","瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械"],
-["cda1","棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜"],
-["cea1","科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾"],
-["cfa1","區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴"],
-["d0a1","鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣"],
-["d1a1","朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩",5,"那樂",4,"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉"],
-["d2a1","納臘蠟衲囊娘廊",4,"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧",5,"駑魯",10,"濃籠聾膿農惱牢磊腦賂雷尿壘",7,"嫩訥杻紐勒",5,"能菱陵尼泥匿溺多茶"],
-["d3a1","丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃"],
-["d4a1","棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅"],
-["d5a1","蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣"],
-["d6a1","煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼"],
-["d7a1","遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬"],
-["d8a1","立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅"],
-["d9a1","蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文"],
-["daa1","汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑"],
-["dba1","發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖"],
-["dca1","碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦"],
-["dda1","孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥"],
-["dea1","脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索"],
-["dfa1","傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署"],
-["e0a1","胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬"],
-["e1a1","聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁"],
-["e2a1","戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧"],
-["e3a1","嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁"],
-["e4a1","沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額"],
-["e5a1","櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬"],
-["e6a1","旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒"],
-["e7a1","簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳"],
-["e8a1","烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療"],
-["e9a1","窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓"],
-["eaa1","運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜"],
-["eba1","濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼"],
-["eca1","議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄"],
-["eda1","立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長"],
-["eea1","障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱"],
-["efa1","煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖"],
-["f0a1","靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫"],
-["f1a1","踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只"],
-["f2a1","咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯"],
-["f3a1","鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策"],
-["f4a1","責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢"],
-["f5a1","椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃"],
-["f6a1","贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託"],
-["f7a1","鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑"],
-["f8a1","阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃"],
-["f9a1","品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航"],
-["faa1","行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型"],
-["fba1","形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵"],
-["fca1","禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆"],
-["fda1","爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰"]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp950.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/cp950.json
deleted file mode 100644 (file)
index d8bc871..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-[
-["0","\u0000",127],
-["a140"," ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚"],
-["a1a1","﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢",4,"~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/"],
-["a240","\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁",7,"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭"],
-["a2a1","╮╰╯═╞╪╡◢◣◥◤╱╲╳0",9,"Ⅰ",9,"〡",8,"十卄卅A",25,"a",21],
-["a340","wxyzΑ",16,"Σ",6,"α",16,"σ",6,"ㄅ",10],
-["a3a1","ㄐ",25,"˙ˉˊˇˋ"],
-["a3e1","€"],
-["a440","一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才"],
-["a4a1","丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙"],
-["a540","世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外"],
-["a5a1","央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全"],
-["a640","共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年"],
-["a6a1","式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣"],
-["a740","作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍"],
-["a7a1","均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠"],
-["a840","杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒"],
-["a8a1","芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵"],
-["a940","咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居"],
-["a9a1","屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊"],
-["aa40","昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠"],
-["aaa1","炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附"],
-["ab40","陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品"],
-["aba1","哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷"],
-["ac40","拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗"],
-["aca1","活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄"],
-["ad40","耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥"],
-["ada1","迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪"],
-["ae40","哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙"],
-["aea1","恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓"],
-["af40","浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷"],
-["afa1","砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃"],
-["b040","虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡"],
-["b0a1","陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀"],
-["b140","娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽"],
-["b1a1","情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺"],
-["b240","毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶"],
-["b2a1","瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼"],
-["b340","莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途"],
-["b3a1","部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠"],
-["b440","婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍"],
-["b4a1","插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋"],
-["b540","溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘"],
-["b5a1","窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁"],
-["b640","詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑"],
-["b6a1","間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼"],
-["b740","媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業"],
-["b7a1","楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督"],
-["b840","睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫"],
-["b8a1","腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊"],
-["b940","辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴"],
-["b9a1","飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇"],
-["ba40","愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢"],
-["baa1","滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬"],
-["bb40","罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤"],
-["bba1","說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜"],
-["bc40","劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂"],
-["bca1","慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃"],
-["bd40","瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯"],
-["bda1","翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞"],
-["be40","輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉"],
-["bea1","鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡"],
-["bf40","濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊"],
-["bfa1","縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚"],
-["c040","錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇"],
-["c0a1","嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬"],
-["c140","瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪"],
-["c1a1","薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁"],
-["c240","駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘"],
-["c2a1","癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦"],
-["c340","鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸"],
-["c3a1","獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類"],
-["c440","願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼"],
-["c4a1","纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴"],
-["c540","護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬"],
-["c5a1","禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒"],
-["c640","讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲"],
-["c940","乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕"],
-["c9a1","氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋"],
-["ca40","汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘"],
-["caa1","吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇"],
-["cb40","杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓"],
-["cba1","芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢"],
-["cc40","坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋"],
-["cca1","怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲"],
-["cd40","泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺"],
-["cda1","矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏"],
-["ce40","哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛"],
-["cea1","峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺"],
-["cf40","柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂"],
-["cfa1","洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀"],
-["d040","穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪"],
-["d0a1","苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱"],
-["d140","唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧"],
-["d1a1","恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤"],
-["d240","毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸"],
-["d2a1","牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐"],
-["d340","笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢"],
-["d3a1","荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐"],
-["d440","酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅"],
-["d4a1","唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏"],
-["d540","崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟"],
-["d5a1","捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉"],
-["d640","淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏"],
-["d6a1","痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟"],
-["d740","耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷"],
-["d7a1","蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪"],
-["d840","釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷"],
-["d8a1","堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔"],
-["d940","惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒"],
-["d9a1","晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞"],
-["da40","湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖"],
-["daa1","琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥"],
-["db40","罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳"],
-["dba1","菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺"],
-["dc40","軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈"],
-["dca1","隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆"],
-["dd40","媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤"],
-["dda1","搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼"],
-["de40","毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓"],
-["dea1","煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓"],
-["df40","稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯"],
-["dfa1","腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤"],
-["e040","觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿"],
-["e0a1","遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠"],
-["e140","凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠"],
-["e1a1","寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉"],
-["e240","榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊"],
-["e2a1","漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓"],
-["e340","禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞"],
-["e3a1","耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻"],
-["e440","裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍"],
-["e4a1","銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘"],
-["e540","噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉"],
-["e5a1","憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒"],
-["e640","澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙"],
-["e6a1","獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟"],
-["e740","膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢"],
-["e7a1","蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧"],
-["e840","踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓"],
-["e8a1","銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮"],
-["e940","噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺"],
-["e9a1","憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸"],
-["ea40","澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙"],
-["eaa1","瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘"],
-["eb40","蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠"],
-["eba1","諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌"],
-["ec40","錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕"],
-["eca1","魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎"],
-["ed40","檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶"],
-["eda1","瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞"],
-["ee40","蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞"],
-["eea1","謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜"],
-["ef40","鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰"],
-["efa1","鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶"],
-["f040","璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒"],
-["f0a1","臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧"],
-["f140","蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪"],
-["f1a1","鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰"],
-["f240","徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛"],
-["f2a1","礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕"],
-["f340","譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦"],
-["f3a1","鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲"],
-["f440","嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩"],
-["f4a1","禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿"],
-["f540","鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛"],
-["f5a1","鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥"],
-["f640","蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺"],
-["f6a1","騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚"],
-["f740","糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊"],
-["f7a1","驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾"],
-["f840","讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏"],
-["f8a1","齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚"],
-["f940","纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊"],
-["f9a1","龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/eucjp.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/eucjp.json
deleted file mode 100644 (file)
index 4fa61ca..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-[
-["0","\u0000",127],
-["8ea1","。",62],
-["a1a1"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇"],
-["a2a1","◆□■△▲▽▼※〒→←↑↓〓"],
-["a2ba","∈∋⊆⊇⊂⊃∪∩"],
-["a2ca","∧∨¬⇒⇔∀∃"],
-["a2dc","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"],
-["a2f2","ʼn♯♭♪†‡¶"],
-["a2fe","◯"],
-["a3b0","0",9],
-["a3c1","A",25],
-["a3e1","a",25],
-["a4a1","ぁ",82],
-["a5a1","ァ",85],
-["a6a1","Α",16,"Σ",6],
-["a6c1","α",16,"σ",6],
-["a7a1","А",5,"ЁЖ",25],
-["a7d1","а",5,"ёж",25],
-["a8a1","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"],
-["ada1","①",19,"Ⅰ",9],
-["adc0","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"],
-["addf","㍻〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"],
-["b0a1","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"],
-["b1a1","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応"],
-["b2a1","押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"],
-["b3a1","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱"],
-["b4a1","粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"],
-["b5a1","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京"],
-["b6a1","供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"],
-["b7a1","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲"],
-["b8a1","検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"],
-["b9a1","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込"],
-["baa1","此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"],
-["bba1","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時"],
-["bca1","次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"],
-["bda1","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償"],
-["bea1","勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"],
-["bfa1","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾"],
-["c0a1","澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"],
-["c1a1","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎"],
-["c2a1","臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"],
-["c3a1","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵"],
-["c4a1","帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"],
-["c5a1","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到"],
-["c6a1","董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"],
-["c7a1","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦"],
-["c8a1","函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"],
-["c9a1","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服"],
-["caa1","福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"],
-["cba1","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満"],
-["cca1","漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"],
-["cda1","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃"],
-["cea1","痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"],
-["cfa1","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"],
-["d0a1","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"],
-["d1a1","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨"],
-["d2a1","辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"],
-["d3a1","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉"],
-["d4a1","圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"],
-["d5a1","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓"],
-["d6a1","屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"],
-["d7a1","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚"],
-["d8a1","悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"],
-["d9a1","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼"],
-["daa1","據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"],
-["dba1","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍"],
-["dca1","棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"],
-["dda1","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾"],
-["dea1","沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"],
-["dfa1","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼"],
-["e0a1","燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"],
-["e1a1","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰"],
-["e2a1","癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"],
-["e3a1","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐"],
-["e4a1","筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"],
-["e5a1","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺"],
-["e6a1","罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"],
-["e7a1","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙"],
-["e8a1","茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"],
-["e9a1","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙"],
-["eaa1","蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"],
-["eba1","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫"],
-["eca1","譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"],
-["eda1","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸"],
-["eea1","遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"],
-["efa1","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞"],
-["f0a1","陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"],
-["f1a1","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷"],
-["f2a1","髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"],
-["f3a1","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠"],
-["f4a1","堯槇遙瑤凜熙"],
-["f9a1","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德"],
-["faa1","忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"],
-["fba1","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚"],
-["fca1","釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"],
-["fcf1","ⅰ",9,"¬¦'""],
-["8fa2af","˘ˇ¸˙˝¯˛˚~΄΅"],
-["8fa2c2","¡¦¿"],
-["8fa2eb","ºª©®™¤№"],
-["8fa6e1","ΆΈΉΊΪ"],
-["8fa6e7","Ό"],
-["8fa6e9","ΎΫ"],
-["8fa6ec","Ώ"],
-["8fa6f1","άέήίϊΐόςύϋΰώ"],
-["8fa7c2","Ђ",10,"ЎЏ"],
-["8fa7f2","ђ",10,"ўџ"],
-["8fa9a1","ÆĐ"],
-["8fa9a4","Ħ"],
-["8fa9a6","IJ"],
-["8fa9a8","ŁĿ"],
-["8fa9ab","ŊØŒ"],
-["8fa9af","ŦÞ"],
-["8fa9c1","æđðħıijĸłŀʼnŋøœßŧþ"],
-["8faaa1","ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ"],
-["8faaba","ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ"],
-["8faba1","áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ"],
-["8fabbd","ġĥíìïîǐ"],
-["8fabc5","īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż"],
-["8fb0a1","丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄"],
-["8fb1a1","侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐"],
-["8fb2a1","傒傓傔傖傛傜傞",4,"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂"],
-["8fb3a1","凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋"],
-["8fb4a1","匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿"],
-["8fb5a1","咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒"],
-["8fb6a1","嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍",5,"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤",4,"囱囫园"],
-["8fb7a1","囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭",4,"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡"],
-["8fb8a1","堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭"],
-["8fb9a1","奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿"],
-["8fbaa1","嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖",4,"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩"],
-["8fbba1","屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤"],
-["8fbca1","巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪",4,"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧"],
-["8fbda1","彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐",4,"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷"],
-["8fbea1","悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐",4,"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥"],
-["8fbfa1","懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵"],
-["8fc0a1","捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿"],
-["8fc1a1","擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝"],
-["8fc2a1","昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝"],
-["8fc3a1","杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮",4,"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏"],
-["8fc4a1","棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲"],
-["8fc5a1","樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽"],
-["8fc6a1","歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖"],
-["8fc7a1","泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞"],
-["8fc8a1","湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊"],
-["8fc9a1","濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔",4,"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃",4,"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠"],
-["8fcaa1","煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻"],
-["8fcba1","狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽"],
-["8fcca1","珿琀琁琄琇琊琑琚琛琤琦琨",9,"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆"],
-["8fcda1","甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹",5,"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹"],
-["8fcea1","瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢",6,"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢"],
-["8fcfa1","睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳"],
-["8fd0a1","碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞"],
-["8fd1a1","秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰"],
-["8fd2a1","笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙",5],
-["8fd3a1","籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝"],
-["8fd4a1","綞綦綧綪綳綶綷綹緂",4,"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭"],
-["8fd5a1","罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮"],
-["8fd6a1","胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆"],
-["8fd7a1","艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸"],
-["8fd8a1","荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓"],
-["8fd9a1","蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏",4,"蕖蕙蕜",6,"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼"],
-["8fdaa1","藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠",4,"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣"],
-["8fdba1","蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃",6,"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵"],
-["8fdca1","蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊",4,"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺"],
-["8fdda1","襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔",4,"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳"],
-["8fdea1","誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂",4,"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆"],
-["8fdfa1","貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢"],
-["8fe0a1","踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁"],
-["8fe1a1","轃轇轏轑",4,"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃"],
-["8fe2a1","郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿"],
-["8fe3a1","釂釃釅釓釔釗釙釚釞釤釥釩釪釬",5,"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵",4,"鉻鉼鉽鉿銈銉銊銍銎銒銗"],
-["8fe4a1","銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿",4,"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶"],
-["8fe5a1","鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉",4,"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹"],
-["8fe6a1","镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂"],
-["8fe7a1","霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦"],
-["8fe8a1","頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱",4,"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵"],
-["8fe9a1","馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿",4],
-["8feaa1","鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪",4,"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸"],
-["8feba1","鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦",4,"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻"],
-["8feca1","鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵"],
-["8feda1","黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃",4,"齓齕齖齗齘齚齝齞齨齩齭",4,"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥"]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json
deleted file mode 100644 (file)
index 85c6934..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"uChars":[128,165,169,178,184,216,226,235,238,244,248,251,253,258,276,284,300,325,329,334,364,463,465,467,469,471,473,475,477,506,594,610,712,716,730,930,938,962,970,1026,1104,1106,8209,8215,8218,8222,8231,8241,8244,8246,8252,8365,8452,8454,8458,8471,8482,8556,8570,8596,8602,8713,8720,8722,8726,8731,8737,8740,8742,8748,8751,8760,8766,8777,8781,8787,8802,8808,8816,8854,8858,8870,8896,8979,9322,9372,9548,9588,9616,9622,9634,9652,9662,9672,9676,9680,9702,9735,9738,9793,9795,11906,11909,11913,11917,11928,11944,11947,11951,11956,11960,11964,11979,12284,12292,12312,12319,12330,12351,12436,12447,12535,12543,12586,12842,12850,12964,13200,13215,13218,13253,13263,13267,13270,13384,13428,13727,13839,13851,14617,14703,14801,14816,14964,15183,15471,15585,16471,16736,17208,17325,17330,17374,17623,17997,18018,18212,18218,18301,18318,18760,18811,18814,18820,18823,18844,18848,18872,19576,19620,19738,19887,40870,59244,59336,59367,59413,59417,59423,59431,59437,59443,59452,59460,59478,59493,63789,63866,63894,63976,63986,64016,64018,64021,64025,64034,64037,64042,65074,65093,65107,65112,65127,65132,65375,65510,65536],"gbChars":[0,36,38,45,50,81,89,95,96,100,103,104,105,109,126,133,148,172,175,179,208,306,307,308,309,310,311,312,313,341,428,443,544,545,558,741,742,749,750,805,819,820,7922,7924,7925,7927,7934,7943,7944,7945,7950,8062,8148,8149,8152,8164,8174,8236,8240,8262,8264,8374,8380,8381,8384,8388,8390,8392,8393,8394,8396,8401,8406,8416,8419,8424,8437,8439,8445,8482,8485,8496,8521,8603,8936,8946,9046,9050,9063,9066,9076,9092,9100,9108,9111,9113,9131,9162,9164,9218,9219,11329,11331,11334,11336,11346,11361,11363,11366,11370,11372,11375,11389,11682,11686,11687,11692,11694,11714,11716,11723,11725,11730,11736,11982,11989,12102,12336,12348,12350,12384,12393,12395,12397,12510,12553,12851,12962,12973,13738,13823,13919,13933,14080,14298,14585,14698,15583,15847,16318,16434,16438,16481,16729,17102,17122,17315,17320,17402,17418,17859,17909,17911,17915,17916,17936,17939,17961,18664,18703,18814,18962,19043,33469,33470,33471,33484,33485,33490,33497,33501,33505,33513,33520,33536,33550,37845,37921,37948,38029,38038,38064,38065,38066,38069,38075,38076,38078,39108,39109,39113,39114,39115,39116,39265,39394,189000]}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gbk-added.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/gbk-added.json
deleted file mode 100644 (file)
index 8abfa9f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-[
-["a140","\e4c6",62],
-["a180","\e505",32],
-["a240","\e526",62],
-["a280","\e565",32],
-["a2ab","\e766",5],
-["a2e3","€\e76d"],
-["a2ef","\e76e\e76f"],
-["a2fd","\e770\e771"],
-["a340","\e586",62],
-["a380","\e5c5",31," "],
-["a440","\e5e6",62],
-["a480","\e625",32],
-["a4f4","\e772",10],
-["a540","\e646",62],
-["a580","\e685",32],
-["a5f7","\e77d",7],
-["a640","\e6a6",62],
-["a680","\e6e5",32],
-["a6b9","\e785",7],
-["a6d9","\e78d",6],
-["a6ec","\e794\e795"],
-["a6f3","\e796"],
-["a6f6","\e797",8],
-["a740","\e706",62],
-["a780","\e745",32],
-["a7c2","\e7a0",14],
-["a7f2","\e7af",12],
-["a896","\e7bc",10],
-["a8bc","\e7c7"],
-["a8bf","ǹ"],
-["a8c1","\e7c9\e7ca\e7cb\e7cc"],
-["a8ea","\e7cd",20],
-["a958","\e7e2"],
-["a95b","\e7e3"],
-["a95d","\e7e4\e7e5\e7e6"],
-["a989","〾⿰",11],
-["a997","\e7f4",12],
-["a9f0","\e801",14],
-["aaa1","\e000",93],
-["aba1","\e05e",93],
-["aca1","\e0bc",93],
-["ada1","\e11a",93],
-["aea1","\e178",93],
-["afa1","\e1d6",93],
-["d7fa","\e810",4],
-["f8a1","\e234",93],
-["f9a1","\e292",93],
-["faa1","\e2f0",93],
-["fba1","\e34e",93],
-["fca1","\e3ac",93],
-["fda1","\e40a",93],
-["fe50","⺁\e816\e817\e818⺄㑳㑇⺈⺋\e81e㖞㘚㘎⺌⺗㥮㤘\e826㧏㧟㩳㧐\e82b\e82c㭎㱮㳠⺧\e831\e832⺪䁖䅟⺮䌷⺳⺶⺷\e83b䎱䎬⺻䏝䓖䙡䙌\e843"],
-["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶\e854\e855䲣䲟䲠䲡䱷䲢䴓",6,"䶮\e864\e468",93]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/shiftjis.json b/legacy-libs/grpc/node_modules/iconv-lite/encodings/tables/shiftjis.json
deleted file mode 100644 (file)
index 5a3a43c..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-[
-["0","\u0000",128],
-["a1","。",62],
-["8140"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×"],
-["8180","÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓"],
-["81b8","∈∋⊆⊇⊂⊃∪∩"],
-["81c8","∧∨¬⇒⇔∀∃"],
-["81da","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"],
-["81f0","ʼn♯♭♪†‡¶"],
-["81fc","◯"],
-["824f","0",9],
-["8260","A",25],
-["8281","a",25],
-["829f","ぁ",82],
-["8340","ァ",62],
-["8380","ム",22],
-["839f","Α",16,"Σ",6],
-["83bf","α",16,"σ",6],
-["8440","А",5,"ЁЖ",25],
-["8470","а",5,"ёж",7],
-["8480","о",17],
-["849f","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"],
-["8740","①",19,"Ⅰ",9],
-["875f","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"],
-["877e","㍻"],
-["8780","〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"],
-["889f","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"],
-["8940","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円"],
-["8980","園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"],
-["8a40","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫"],
-["8a80","橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"],
-["8b40","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救"],
-["8b80","朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"],
-["8c40","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨"],
-["8c80","劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"],
-["8d40","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降"],
-["8d80","項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"],
-["8e40","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止"],
-["8e80","死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"],
-["8f40","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳"],
-["8f80","準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"],
-["9040","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨"],
-["9080","逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"],
-["9140","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻"],
-["9180","操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"],
-["9240","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄"],
-["9280","逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"],
-["9340","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬"],
-["9380","凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"],
-["9440","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅"],
-["9480","楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"],
-["9540","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷"],
-["9580","斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"],
-["9640","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆"],
-["9680","摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"],
-["9740","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲"],
-["9780","沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"],
-["9840","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"],
-["989f","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"],
-["9940","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭"],
-["9980","凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"],
-["9a40","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸"],
-["9a80","噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"],
-["9b40","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀"],
-["9b80","它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"],
-["9c40","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠"],
-["9c80","怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"],
-["9d40","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫"],
-["9d80","捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"],
-["9e40","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎"],
-["9e80","梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"],
-["9f40","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯"],
-["9f80","麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"],
-["e040","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝"],
-["e080","烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"],
-["e140","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿"],
-["e180","痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"],
-["e240","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰"],
-["e280","窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"],
-["e340","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷"],
-["e380","縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"],
-["e440","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤"],
-["e480","艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"],
-["e540","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬"],
-["e580","蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"],
-["e640","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧"],
-["e680","諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"],
-["e740","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜"],
-["e780","轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"],
-["e840","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙"],
-["e880","閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"],
-["e940","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃"],
-["e980","騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"],
-["ea40","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯"],
-["ea80","黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙"],
-["ed40","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏"],
-["ed80","塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"],
-["ee40","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙"],
-["ee80","蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"],
-["eeef","ⅰ",9,"¬¦'""],
-["f040","\e000",62],
-["f080","\e03f",124],
-["f140","\e0bc",62],
-["f180","\e0fb",124],
-["f240","\e178",62],
-["f280","\e1b7",124],
-["f340","\e234",62],
-["f380","\e273",124],
-["f440","\e2f0",62],
-["f480","\e32f",124],
-["f540","\e3ac",62],
-["f580","\e3eb",124],
-["f640","\e468",62],
-["f680","\e4a7",124],
-["f740","\e524",62],
-["f780","\e563",124],
-["f840","\e5e0",62],
-["f880","\e61f",124],
-["f940","\e69c"],
-["fa40","ⅰ",9,"Ⅰ",9,"¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊"],
-["fa80","兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯"],
-["fb40","涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神"],
-["fb80","祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙"],
-["fc40","髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"]
-]
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf16.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf16.js
deleted file mode 100644 (file)
index 54765ae..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-"use strict";
-var Buffer = require("safer-buffer").Buffer;
-
-// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js
-
-// == UTF16-BE codec. ==========================================================
-
-exports.utf16be = Utf16BECodec;
-function Utf16BECodec() {
-}
-
-Utf16BECodec.prototype.encoder = Utf16BEEncoder;
-Utf16BECodec.prototype.decoder = Utf16BEDecoder;
-Utf16BECodec.prototype.bomAware = true;
-
-
-// -- Encoding
-
-function Utf16BEEncoder() {
-}
-
-Utf16BEEncoder.prototype.write = function(str) {
-    var buf = Buffer.from(str, 'ucs2');
-    for (var i = 0; i < buf.length; i += 2) {
-        var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp;
-    }
-    return buf;
-}
-
-Utf16BEEncoder.prototype.end = function() {
-}
-
-
-// -- Decoding
-
-function Utf16BEDecoder() {
-    this.overflowByte = -1;
-}
-
-Utf16BEDecoder.prototype.write = function(buf) {
-    if (buf.length == 0)
-        return '';
-
-    var buf2 = Buffer.alloc(buf.length + 1),
-        i = 0, j = 0;
-
-    if (this.overflowByte !== -1) {
-        buf2[0] = buf[0];
-        buf2[1] = this.overflowByte;
-        i = 1; j = 2;
-    }
-
-    for (; i < buf.length-1; i += 2, j+= 2) {
-        buf2[j] = buf[i+1];
-        buf2[j+1] = buf[i];
-    }
-
-    this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1;
-
-    return buf2.slice(0, j).toString('ucs2');
-}
-
-Utf16BEDecoder.prototype.end = function() {
-}
-
-
-// == UTF-16 codec =============================================================
-// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic.
-// Defaults to UTF-16LE, as it's prevalent and default in Node.
-// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le
-// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'});
-
-// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false).
-
-exports.utf16 = Utf16Codec;
-function Utf16Codec(codecOptions, iconv) {
-    this.iconv = iconv;
-}
-
-Utf16Codec.prototype.encoder = Utf16Encoder;
-Utf16Codec.prototype.decoder = Utf16Decoder;
-
-
-// -- Encoding (pass-through)
-
-function Utf16Encoder(options, codec) {
-    options = options || {};
-    if (options.addBOM === undefined)
-        options.addBOM = true;
-    this.encoder = codec.iconv.getEncoder('utf-16le', options);
-}
-
-Utf16Encoder.prototype.write = function(str) {
-    return this.encoder.write(str);
-}
-
-Utf16Encoder.prototype.end = function() {
-    return this.encoder.end();
-}
-
-
-// -- Decoding
-
-function Utf16Decoder(options, codec) {
-    this.decoder = null;
-    this.initialBytes = [];
-    this.initialBytesLen = 0;
-
-    this.options = options || {};
-    this.iconv = codec.iconv;
-}
-
-Utf16Decoder.prototype.write = function(buf) {
-    if (!this.decoder) {
-        // Codec is not chosen yet. Accumulate initial bytes.
-        this.initialBytes.push(buf);
-        this.initialBytesLen += buf.length;
-        
-        if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below)
-            return '';
-
-        // We have enough bytes -> detect endianness.
-        var buf = Buffer.concat(this.initialBytes),
-            encoding = detectEncoding(buf, this.options.defaultEncoding);
-        this.decoder = this.iconv.getDecoder(encoding, this.options);
-        this.initialBytes.length = this.initialBytesLen = 0;
-    }
-
-    return this.decoder.write(buf);
-}
-
-Utf16Decoder.prototype.end = function() {
-    if (!this.decoder) {
-        var buf = Buffer.concat(this.initialBytes),
-            encoding = detectEncoding(buf, this.options.defaultEncoding);
-        this.decoder = this.iconv.getDecoder(encoding, this.options);
-
-        var res = this.decoder.write(buf),
-            trail = this.decoder.end();
-
-        return trail ? (res + trail) : res;
-    }
-    return this.decoder.end();
-}
-
-function detectEncoding(buf, defaultEncoding) {
-    var enc = defaultEncoding || 'utf-16le';
-
-    if (buf.length >= 2) {
-        // Check BOM.
-        if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM
-            enc = 'utf-16be';
-        else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM
-            enc = 'utf-16le';
-        else {
-            // No BOM found. Try to deduce encoding from initial content.
-            // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.
-            // So, we count ASCII as if it was LE or BE, and decide from that.
-            var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions
-                _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even.
-
-            for (var i = 0; i < _len; i += 2) {
-                if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++;
-                if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++;
-            }
-
-            if (asciiCharsBE > asciiCharsLE)
-                enc = 'utf-16be';
-            else if (asciiCharsBE < asciiCharsLE)
-                enc = 'utf-16le';
-        }
-    }
-
-    return enc;
-}
-
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf7.js b/legacy-libs/grpc/node_modules/iconv-lite/encodings/utf7.js
deleted file mode 100644 (file)
index b7631c2..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-"use strict";
-var Buffer = require("safer-buffer").Buffer;
-
-// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152
-// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3
-
-exports.utf7 = Utf7Codec;
-exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7
-function Utf7Codec(codecOptions, iconv) {
-    this.iconv = iconv;
-};
-
-Utf7Codec.prototype.encoder = Utf7Encoder;
-Utf7Codec.prototype.decoder = Utf7Decoder;
-Utf7Codec.prototype.bomAware = true;
-
-
-// -- Encoding
-
-var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
-
-function Utf7Encoder(options, codec) {
-    this.iconv = codec.iconv;
-}
-
-Utf7Encoder.prototype.write = function(str) {
-    // Naive implementation.
-    // Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-".
-    return Buffer.from(str.replace(nonDirectChars, function(chunk) {
-        return "+" + (chunk === '+' ? '' : 
-            this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) 
-            + "-";
-    }.bind(this)));
-}
-
-Utf7Encoder.prototype.end = function() {
-}
-
-
-// -- Decoding
-
-function Utf7Decoder(options, codec) {
-    this.iconv = codec.iconv;
-    this.inBase64 = false;
-    this.base64Accum = '';
-}
-
-var base64Regex = /[A-Za-z0-9\/+]/;
-var base64Chars = [];
-for (var i = 0; i < 256; i++)
-    base64Chars[i] = base64Regex.test(String.fromCharCode(i));
-
-var plusChar = '+'.charCodeAt(0), 
-    minusChar = '-'.charCodeAt(0),
-    andChar = '&'.charCodeAt(0);
-
-Utf7Decoder.prototype.write = function(buf) {
-    var res = "", lastI = 0,
-        inBase64 = this.inBase64,
-        base64Accum = this.base64Accum;
-
-    // The decoder is more involved as we must handle chunks in stream.
-
-    for (var i = 0; i < buf.length; i++) {
-        if (!inBase64) { // We're in direct mode.
-            // Write direct chars until '+'
-            if (buf[i] == plusChar) {
-                res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
-                lastI = i+1;
-                inBase64 = true;
-            }
-        } else { // We decode base64.
-            if (!base64Chars[buf[i]]) { // Base64 ended.
-                if (i == lastI && buf[i] == minusChar) {// "+-" -> "+"
-                    res += "+";
-                } else {
-                    var b64str = base64Accum + buf.slice(lastI, i).toString();
-                    res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
-                }
-
-                if (buf[i] != minusChar) // Minus is absorbed after base64.
-                    i--;
-
-                lastI = i+1;
-                inBase64 = false;
-                base64Accum = '';
-            }
-        }
-    }
-
-    if (!inBase64) {
-        res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
-    } else {
-        var b64str = base64Accum + buf.slice(lastI).toString();
-
-        var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
-        base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
-        b64str = b64str.slice(0, canBeDecoded);
-
-        res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
-    }
-
-    this.inBase64 = inBase64;
-    this.base64Accum = base64Accum;
-
-    return res;
-}
-
-Utf7Decoder.prototype.end = function() {
-    var res = "";
-    if (this.inBase64 && this.base64Accum.length > 0)
-        res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
-
-    this.inBase64 = false;
-    this.base64Accum = '';
-    return res;
-}
-
-
-// UTF-7-IMAP codec.
-// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3)
-// Differences:
-//  * Base64 part is started by "&" instead of "+"
-//  * Direct characters are 0x20-0x7E, except "&" (0x26)
-//  * In Base64, "," is used instead of "/"
-//  * Base64 must not be used to represent direct characters.
-//  * No implicit shift back from Base64 (should always end with '-')
-//  * String must end in non-shifted position.
-//  * "-&" while in base64 is not allowed.
-
-
-exports.utf7imap = Utf7IMAPCodec;
-function Utf7IMAPCodec(codecOptions, iconv) {
-    this.iconv = iconv;
-};
-
-Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
-Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
-Utf7IMAPCodec.prototype.bomAware = true;
-
-
-// -- Encoding
-
-function Utf7IMAPEncoder(options, codec) {
-    this.iconv = codec.iconv;
-    this.inBase64 = false;
-    this.base64Accum = Buffer.alloc(6);
-    this.base64AccumIdx = 0;
-}
-
-Utf7IMAPEncoder.prototype.write = function(str) {
-    var inBase64 = this.inBase64,
-        base64Accum = this.base64Accum,
-        base64AccumIdx = this.base64AccumIdx,
-        buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0;
-
-    for (var i = 0; i < str.length; i++) {
-        var uChar = str.charCodeAt(i);
-        if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'.
-            if (inBase64) {
-                if (base64AccumIdx > 0) {
-                    bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
-                    base64AccumIdx = 0;
-                }
-
-                buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
-                inBase64 = false;
-            }
-
-            if (!inBase64) {
-                buf[bufIdx++] = uChar; // Write direct character
-
-                if (uChar === andChar)  // Ampersand -> '&-'
-                    buf[bufIdx++] = minusChar;
-            }
-
-        } else { // Non-direct character
-            if (!inBase64) {
-                buf[bufIdx++] = andChar; // Write '&', then go to base64 mode.
-                inBase64 = true;
-            }
-            if (inBase64) {
-                base64Accum[base64AccumIdx++] = uChar >> 8;
-                base64Accum[base64AccumIdx++] = uChar & 0xFF;
-
-                if (base64AccumIdx == base64Accum.length) {
-                    bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx);
-                    base64AccumIdx = 0;
-                }
-            }
-        }
-    }
-
-    this.inBase64 = inBase64;
-    this.base64AccumIdx = base64AccumIdx;
-
-    return buf.slice(0, bufIdx);
-}
-
-Utf7IMAPEncoder.prototype.end = function() {
-    var buf = Buffer.alloc(10), bufIdx = 0;
-    if (this.inBase64) {
-        if (this.base64AccumIdx > 0) {
-            bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
-            this.base64AccumIdx = 0;
-        }
-
-        buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
-        this.inBase64 = false;
-    }
-
-    return buf.slice(0, bufIdx);
-}
-
-
-// -- Decoding
-
-function Utf7IMAPDecoder(options, codec) {
-    this.iconv = codec.iconv;
-    this.inBase64 = false;
-    this.base64Accum = '';
-}
-
-var base64IMAPChars = base64Chars.slice();
-base64IMAPChars[','.charCodeAt(0)] = true;
-
-Utf7IMAPDecoder.prototype.write = function(buf) {
-    var res = "", lastI = 0,
-        inBase64 = this.inBase64,
-        base64Accum = this.base64Accum;
-
-    // The decoder is more involved as we must handle chunks in stream.
-    // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end).
-
-    for (var i = 0; i < buf.length; i++) {
-        if (!inBase64) { // We're in direct mode.
-            // Write direct chars until '&'
-            if (buf[i] == andChar) {
-                res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
-                lastI = i+1;
-                inBase64 = true;
-            }
-        } else { // We decode base64.
-            if (!base64IMAPChars[buf[i]]) { // Base64 ended.
-                if (i == lastI && buf[i] == minusChar) { // "&-" -> "&"
-                    res += "&";
-                } else {
-                    var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/');
-                    res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
-                }
-
-                if (buf[i] != minusChar) // Minus may be absorbed after base64.
-                    i--;
-
-                lastI = i+1;
-                inBase64 = false;
-                base64Accum = '';
-            }
-        }
-    }
-
-    if (!inBase64) {
-        res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
-    } else {
-        var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/');
-
-        var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
-        base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
-        b64str = b64str.slice(0, canBeDecoded);
-
-        res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
-    }
-
-    this.inBase64 = inBase64;
-    this.base64Accum = base64Accum;
-
-    return res;
-}
-
-Utf7IMAPDecoder.prototype.end = function() {
-    var res = "";
-    if (this.inBase64 && this.base64Accum.length > 0)
-        res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
-
-    this.inBase64 = false;
-    this.base64Accum = '';
-    return res;
-}
-
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/bom-handling.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/bom-handling.js
deleted file mode 100644 (file)
index 1050872..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-
-var BOMChar = '\uFEFF';
-
-exports.PrependBOM = PrependBOMWrapper
-function PrependBOMWrapper(encoder, options) {
-    this.encoder = encoder;
-    this.addBOM = true;
-}
-
-PrependBOMWrapper.prototype.write = function(str) {
-    if (this.addBOM) {
-        str = BOMChar + str;
-        this.addBOM = false;
-    }
-
-    return this.encoder.write(str);
-}
-
-PrependBOMWrapper.prototype.end = function() {
-    return this.encoder.end();
-}
-
-
-//------------------------------------------------------------------------------
-
-exports.StripBOM = StripBOMWrapper;
-function StripBOMWrapper(decoder, options) {
-    this.decoder = decoder;
-    this.pass = false;
-    this.options = options || {};
-}
-
-StripBOMWrapper.prototype.write = function(buf) {
-    var res = this.decoder.write(buf);
-    if (this.pass || !res)
-        return res;
-
-    if (res[0] === BOMChar) {
-        res = res.slice(1);
-        if (typeof this.options.stripBOM === 'function')
-            this.options.stripBOM();
-    }
-
-    this.pass = true;
-    return res;
-}
-
-StripBOMWrapper.prototype.end = function() {
-    return this.decoder.end();
-}
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/extend-node.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/extend-node.js
deleted file mode 100644 (file)
index 87f5394..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-"use strict";
-var Buffer = require("buffer").Buffer;
-// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer
-
-// == Extend Node primitives to use iconv-lite =================================
-
-module.exports = function (iconv) {
-    var original = undefined; // Place to keep original methods.
-
-    // Node authors rewrote Buffer internals to make it compatible with
-    // Uint8Array and we cannot patch key functions since then.
-    // Note: this does use older Buffer API on a purpose
-    iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array);
-
-    iconv.extendNodeEncodings = function extendNodeEncodings() {
-        if (original) return;
-        original = {};
-
-        if (!iconv.supportsNodeEncodingsExtension) {
-            console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node");
-            console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility");
-            return;
-        }
-
-        var nodeNativeEncodings = {
-            'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, 
-            'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true,
-        };
-
-        Buffer.isNativeEncoding = function(enc) {
-            return enc && nodeNativeEncodings[enc.toLowerCase()];
-        }
-
-        // -- SlowBuffer -----------------------------------------------------------
-        var SlowBuffer = require('buffer').SlowBuffer;
-
-        original.SlowBufferToString = SlowBuffer.prototype.toString;
-        SlowBuffer.prototype.toString = function(encoding, start, end) {
-            encoding = String(encoding || 'utf8').toLowerCase();
-
-            // Use native conversion when possible
-            if (Buffer.isNativeEncoding(encoding))
-                return original.SlowBufferToString.call(this, encoding, start, end);
-
-            // Otherwise, use our decoding method.
-            if (typeof start == 'undefined') start = 0;
-            if (typeof end == 'undefined') end = this.length;
-            return iconv.decode(this.slice(start, end), encoding);
-        }
-
-        original.SlowBufferWrite = SlowBuffer.prototype.write;
-        SlowBuffer.prototype.write = function(string, offset, length, encoding) {
-            // Support both (string, offset, length, encoding)
-            // and the legacy (string, encoding, offset, length)
-            if (isFinite(offset)) {
-                if (!isFinite(length)) {
-                    encoding = length;
-                    length = undefined;
-                }
-            } else {  // legacy
-                var swap = encoding;
-                encoding = offset;
-                offset = length;
-                length = swap;
-            }
-
-            offset = +offset || 0;
-            var remaining = this.length - offset;
-            if (!length) {
-                length = remaining;
-            } else {
-                length = +length;
-                if (length > remaining) {
-                    length = remaining;
-                }
-            }
-            encoding = String(encoding || 'utf8').toLowerCase();
-
-            // Use native conversion when possible
-            if (Buffer.isNativeEncoding(encoding))
-                return original.SlowBufferWrite.call(this, string, offset, length, encoding);
-
-            if (string.length > 0 && (length < 0 || offset < 0))
-                throw new RangeError('attempt to write beyond buffer bounds');
-
-            // Otherwise, use our encoding method.
-            var buf = iconv.encode(string, encoding);
-            if (buf.length < length) length = buf.length;
-            buf.copy(this, offset, 0, length);
-            return length;
-        }
-
-        // -- Buffer ---------------------------------------------------------------
-
-        original.BufferIsEncoding = Buffer.isEncoding;
-        Buffer.isEncoding = function(encoding) {
-            return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding);
-        }
-
-        original.BufferByteLength = Buffer.byteLength;
-        Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) {
-            encoding = String(encoding || 'utf8').toLowerCase();
-
-            // Use native conversion when possible
-            if (Buffer.isNativeEncoding(encoding))
-                return original.BufferByteLength.call(this, str, encoding);
-
-            // Slow, I know, but we don't have a better way yet.
-            return iconv.encode(str, encoding).length;
-        }
-
-        original.BufferToString = Buffer.prototype.toString;
-        Buffer.prototype.toString = function(encoding, start, end) {
-            encoding = String(encoding || 'utf8').toLowerCase();
-
-            // Use native conversion when possible
-            if (Buffer.isNativeEncoding(encoding))
-                return original.BufferToString.call(this, encoding, start, end);
-
-            // Otherwise, use our decoding method.
-            if (typeof start == 'undefined') start = 0;
-            if (typeof end == 'undefined') end = this.length;
-            return iconv.decode(this.slice(start, end), encoding);
-        }
-
-        original.BufferWrite = Buffer.prototype.write;
-        Buffer.prototype.write = function(string, offset, length, encoding) {
-            var _offset = offset, _length = length, _encoding = encoding;
-            // Support both (string, offset, length, encoding)
-            // and the legacy (string, encoding, offset, length)
-            if (isFinite(offset)) {
-                if (!isFinite(length)) {
-                    encoding = length;
-                    length = undefined;
-                }
-            } else {  // legacy
-                var swap = encoding;
-                encoding = offset;
-                offset = length;
-                length = swap;
-            }
-
-            encoding = String(encoding || 'utf8').toLowerCase();
-
-            // Use native conversion when possible
-            if (Buffer.isNativeEncoding(encoding))
-                return original.BufferWrite.call(this, string, _offset, _length, _encoding);
-
-            offset = +offset || 0;
-            var remaining = this.length - offset;
-            if (!length) {
-                length = remaining;
-            } else {
-                length = +length;
-                if (length > remaining) {
-                    length = remaining;
-                }
-            }
-
-            if (string.length > 0 && (length < 0 || offset < 0))
-                throw new RangeError('attempt to write beyond buffer bounds');
-
-            // Otherwise, use our encoding method.
-            var buf = iconv.encode(string, encoding);
-            if (buf.length < length) length = buf.length;
-            buf.copy(this, offset, 0, length);
-            return length;
-
-            // TODO: Set _charsWritten.
-        }
-
-
-        // -- Readable -------------------------------------------------------------
-        if (iconv.supportsStreams) {
-            var Readable = require('stream').Readable;
-
-            original.ReadableSetEncoding = Readable.prototype.setEncoding;
-            Readable.prototype.setEncoding = function setEncoding(enc, options) {
-                // Use our own decoder, it has the same interface.
-                // We cannot use original function as it doesn't handle BOM-s.
-                this._readableState.decoder = iconv.getDecoder(enc, options);
-                this._readableState.encoding = enc;
-            }
-
-            Readable.prototype.collect = iconv._collect;
-        }
-    }
-
-    // Remove iconv-lite Node primitive extensions.
-    iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() {
-        if (!iconv.supportsNodeEncodingsExtension)
-            return;
-        if (!original)
-            throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.")
-
-        delete Buffer.isNativeEncoding;
-
-        var SlowBuffer = require('buffer').SlowBuffer;
-
-        SlowBuffer.prototype.toString = original.SlowBufferToString;
-        SlowBuffer.prototype.write = original.SlowBufferWrite;
-
-        Buffer.isEncoding = original.BufferIsEncoding;
-        Buffer.byteLength = original.BufferByteLength;
-        Buffer.prototype.toString = original.BufferToString;
-        Buffer.prototype.write = original.BufferWrite;
-
-        if (iconv.supportsStreams) {
-            var Readable = require('stream').Readable;
-
-            Readable.prototype.setEncoding = original.ReadableSetEncoding;
-            delete Readable.prototype.collect;
-        }
-
-        original = undefined;
-    }
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/index.d.ts b/legacy-libs/grpc/node_modules/iconv-lite/lib/index.d.ts
deleted file mode 100644 (file)
index 0547eb3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License.
- *  REQUIREMENT: This definition is dependent on the @types/node definition.
- *  Install with `npm install @types/node --save-dev`
- *--------------------------------------------------------------------------------------------*/
-
-declare module 'iconv-lite' {
-       export function decode(buffer: Buffer, encoding: string, options?: Options): string;
-
-       export function encode(content: string, encoding: string, options?: Options): Buffer;
-
-       export function encodingExists(encoding: string): boolean;
-
-       export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
-
-       export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
-}
-
-export interface Options {
-    stripBOM?: boolean;
-    addBOM?: boolean;
-    defaultEncoding?: string;
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/index.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/index.js
deleted file mode 100644 (file)
index 5391919..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-"use strict";
-
-// Some environments don't have global Buffer (e.g. React Native).
-// Solution would be installing npm modules "buffer" and "stream" explicitly.
-var Buffer = require("safer-buffer").Buffer;
-
-var bomHandling = require("./bom-handling"),
-    iconv = module.exports;
-
-// All codecs and aliases are kept here, keyed by encoding name/alias.
-// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`.
-iconv.encodings = null;
-
-// Characters emitted in case of error.
-iconv.defaultCharUnicode = '�';
-iconv.defaultCharSingleByte = '?';
-
-// Public API.
-iconv.encode = function encode(str, encoding, options) {
-    str = "" + (str || ""); // Ensure string.
-
-    var encoder = iconv.getEncoder(encoding, options);
-
-    var res = encoder.write(str);
-    var trail = encoder.end();
-    
-    return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res;
-}
-
-iconv.decode = function decode(buf, encoding, options) {
-    if (typeof buf === 'string') {
-        if (!iconv.skipDecodeWarning) {
-            console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding');
-            iconv.skipDecodeWarning = true;
-        }
-
-        buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer.
-    }
-
-    var decoder = iconv.getDecoder(encoding, options);
-
-    var res = decoder.write(buf);
-    var trail = decoder.end();
-
-    return trail ? (res + trail) : res;
-}
-
-iconv.encodingExists = function encodingExists(enc) {
-    try {
-        iconv.getCodec(enc);
-        return true;
-    } catch (e) {
-        return false;
-    }
-}
-
-// Legacy aliases to convert functions
-iconv.toEncoding = iconv.encode;
-iconv.fromEncoding = iconv.decode;
-
-// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache.
-iconv._codecDataCache = {};
-iconv.getCodec = function getCodec(encoding) {
-    if (!iconv.encodings)
-        iconv.encodings = require("../encodings"); // Lazy load all encoding definitions.
-    
-    // Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
-    var enc = iconv._canonicalizeEncoding(encoding);
-
-    // Traverse iconv.encodings to find actual codec.
-    var codecOptions = {};
-    while (true) {
-        var codec = iconv._codecDataCache[enc];
-        if (codec)
-            return codec;
-
-        var codecDef = iconv.encodings[enc];
-
-        switch (typeof codecDef) {
-            case "string": // Direct alias to other encoding.
-                enc = codecDef;
-                break;
-
-            case "object": // Alias with options. Can be layered.
-                for (var key in codecDef)
-                    codecOptions[key] = codecDef[key];
-
-                if (!codecOptions.encodingName)
-                    codecOptions.encodingName = enc;
-                
-                enc = codecDef.type;
-                break;
-
-            case "function": // Codec itself.
-                if (!codecOptions.encodingName)
-                    codecOptions.encodingName = enc;
-
-                // The codec function must load all tables and return object with .encoder and .decoder methods.
-                // It'll be called only once (for each different options object).
-                codec = new codecDef(codecOptions, iconv);
-
-                iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later.
-                return codec;
-
-            default:
-                throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
-        }
-    }
-}
-
-iconv._canonicalizeEncoding = function(encoding) {
-    // Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
-    return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
-}
-
-iconv.getEncoder = function getEncoder(encoding, options) {
-    var codec = iconv.getCodec(encoding),
-        encoder = new codec.encoder(options, codec);
-
-    if (codec.bomAware && options && options.addBOM)
-        encoder = new bomHandling.PrependBOM(encoder, options);
-
-    return encoder;
-}
-
-iconv.getDecoder = function getDecoder(encoding, options) {
-    var codec = iconv.getCodec(encoding),
-        decoder = new codec.decoder(options, codec);
-
-    if (codec.bomAware && !(options && options.stripBOM === false))
-        decoder = new bomHandling.StripBOM(decoder, options);
-
-    return decoder;
-}
-
-
-// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json.
-var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node;
-if (nodeVer) {
-
-    // Load streaming support in Node v0.10+
-    var nodeVerArr = nodeVer.split(".").map(Number);
-    if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
-        require("./streams")(iconv);
-    }
-
-    // Load Node primitive extensions.
-    require("./extend-node")(iconv);
-}
-
-if ("Ā" != "\u0100") {
-    console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info.");
-}
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/lib/streams.js b/legacy-libs/grpc/node_modules/iconv-lite/lib/streams.js
deleted file mode 100644 (file)
index 4409552..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-"use strict";
-
-var Buffer = require("buffer").Buffer,
-    Transform = require("stream").Transform;
-
-
-// == Exports ==================================================================
-module.exports = function(iconv) {
-    
-    // Additional Public API.
-    iconv.encodeStream = function encodeStream(encoding, options) {
-        return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);
-    }
-
-    iconv.decodeStream = function decodeStream(encoding, options) {
-        return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);
-    }
-
-    iconv.supportsStreams = true;
-
-
-    // Not published yet.
-    iconv.IconvLiteEncoderStream = IconvLiteEncoderStream;
-    iconv.IconvLiteDecoderStream = IconvLiteDecoderStream;
-    iconv._collect = IconvLiteDecoderStream.prototype.collect;
-};
-
-
-// == Encoder stream =======================================================
-function IconvLiteEncoderStream(conv, options) {
-    this.conv = conv;
-    options = options || {};
-    options.decodeStrings = false; // We accept only strings, so we don't need to decode them.
-    Transform.call(this, options);
-}
-
-IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
-    constructor: { value: IconvLiteEncoderStream }
-});
-
-IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
-    if (typeof chunk != 'string')
-        return done(new Error("Iconv encoding stream needs strings as its input."));
-    try {
-        var res = this.conv.write(chunk);
-        if (res && res.length) this.push(res);
-        done();
-    }
-    catch (e) {
-        done(e);
-    }
-}
-
-IconvLiteEncoderStream.prototype._flush = function(done) {
-    try {
-        var res = this.conv.end();
-        if (res && res.length) this.push(res);
-        done();
-    }
-    catch (e) {
-        done(e);
-    }
-}
-
-IconvLiteEncoderStream.prototype.collect = function(cb) {
-    var chunks = [];
-    this.on('error', cb);
-    this.on('data', function(chunk) { chunks.push(chunk); });
-    this.on('end', function() {
-        cb(null, Buffer.concat(chunks));
-    });
-    return this;
-}
-
-
-// == Decoder stream =======================================================
-function IconvLiteDecoderStream(conv, options) {
-    this.conv = conv;
-    options = options || {};
-    options.encoding = this.encoding = 'utf8'; // We output strings.
-    Transform.call(this, options);
-}
-
-IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
-    constructor: { value: IconvLiteDecoderStream }
-});
-
-IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
-    if (!Buffer.isBuffer(chunk))
-        return done(new Error("Iconv decoding stream needs buffers as its input."));
-    try {
-        var res = this.conv.write(chunk);
-        if (res && res.length) this.push(res, this.encoding);
-        done();
-    }
-    catch (e) {
-        done(e);
-    }
-}
-
-IconvLiteDecoderStream.prototype._flush = function(done) {
-    try {
-        var res = this.conv.end();
-        if (res && res.length) this.push(res, this.encoding);                
-        done();
-    }
-    catch (e) {
-        done(e);
-    }
-}
-
-IconvLiteDecoderStream.prototype.collect = function(cb) {
-    var res = '';
-    this.on('error', cb);
-    this.on('data', function(chunk) { res += chunk; });
-    this.on('end', function() {
-        cb(null, res);
-    });
-    return this;
-}
-
diff --git a/legacy-libs/grpc/node_modules/iconv-lite/package.json b/legacy-libs/grpc/node_modules/iconv-lite/package.json
deleted file mode 100644 (file)
index 0f2f7d8..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-{
-  "_args": [
-    [
-      "iconv-lite@0.4.23",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "iconv-lite@0.4.23",
-  "_id": "iconv-lite@0.4.23",
-  "_inBundle": false,
-  "_integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
-  "_location": "/grpc/iconv-lite",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "iconv-lite@0.4.23",
-    "name": "iconv-lite",
-    "escapedName": "iconv-lite",
-    "rawSpec": "0.4.23",
-    "saveSpec": null,
-    "fetchSpec": "0.4.23"
-  },
-  "_requiredBy": [
-    "/grpc/needle"
-  ],
-  "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
-  "_shrinkwrap": null,
-  "_spec": "0.4.23",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Alexander Shtuchkin",
-    "email": "ashtuchkin@gmail.com"
-  },
-  "browser": {
-    "./lib/extend-node": false,
-    "./lib/streams": false
-  },
-  "bugs": {
-    "url": "https://github.com/ashtuchkin/iconv-lite/issues"
-  },
-  "dependencies": {
-    "safer-buffer": ">= 2.1.2 < 3"
-  },
-  "description": "Convert character encodings in pure javascript.",
-  "devDependencies": {
-    "async": "*",
-    "errto": "*",
-    "iconv": "*",
-    "istanbul": "*",
-    "mocha": "^3.1.0",
-    "request": "~2.81.0",
-    "semver": "*",
-    "unorm": "*"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "homepage": "https://github.com/ashtuchkin/iconv-lite",
-  "keywords": [
-    "iconv",
-    "convert",
-    "charset",
-    "icu"
-  ],
-  "license": "MIT",
-  "main": "./lib/index.js",
-  "name": "iconv-lite",
-  "optionalDependencies": {},
-  "readme": "## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite)\n\n * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io).\n * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), \n   [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others.\n * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison).\n * Intuitive encode/decode API\n * Streaming support for Node v0.10+\n * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings.\n * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included).\n * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included.\n * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`).\n * License: MIT.\n\n[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/)\n\n## Usage\n### Basic API\n```javascript\nvar iconv = require('iconv-lite');\n\n// Convert from an encoded buffer to js string.\nstr = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251');\n\n// Convert from js string to an encoded buffer.\nbuf = iconv.encode(\"Sample input string\", 'win1251');\n\n// Check if encoding is supported\niconv.encodingExists(\"us-ascii\")\n```\n\n### Streaming API (Node v0.10+)\n```javascript\n\n// Decode stream (from binary stream to js strings)\nhttp.createServer(function(req, res) {\n    var converterStream = iconv.decodeStream('win1251');\n    req.pipe(converterStream);\n\n    converterStream.on('data', function(str) {\n        console.log(str); // Do something with decoded strings, chunk-by-chunk.\n    });\n});\n\n// Convert encoding streaming example\nfs.createReadStream('file-in-win1251.txt')\n    .pipe(iconv.decodeStream('win1251'))\n    .pipe(iconv.encodeStream('ucs2'))\n    .pipe(fs.createWriteStream('file-in-ucs2.txt'));\n\n// Sugar: all encode/decode streams have .collect(cb) method to accumulate data.\nhttp.createServer(function(req, res) {\n    req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) {\n        assert(typeof body == 'string');\n        console.log(body); // full request body string\n    });\n});\n```\n\n### [Deprecated] Extend Node.js own encodings\n> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility).\n\n```javascript\n// After this call all Node basic primitives will understand iconv-lite encodings.\niconv.extendNodeEncodings();\n\n// Examples:\nbuf = new Buffer(str, 'win1251');\nbuf.write(str, 'gbk');\nstr = buf.toString('latin1');\nassert(Buffer.isEncoding('iso-8859-15'));\nBuffer.byteLength(str, 'us-ascii');\n\nhttp.createServer(function(req, res) {\n    req.setEncoding('big5');\n    req.collect(function(err, body) {\n        console.log(body);\n    });\n});\n\nfs.createReadStream(\"file.txt\", \"shift_jis\");\n\n// External modules are also supported (if they use Node primitives, which they probably do).\nrequest = require('request');\nrequest({\n    url: \"http://github.com/\", \n    encoding: \"cp932\"\n});\n\n// To remove extensions\niconv.undoExtendNodeEncodings();\n```\n\n## Supported encodings\n\n *  All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex.\n *  Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap.\n *  All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, \n    IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. \n    Aliases like 'latin1', 'us-ascii' also supported.\n *  All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2312, GBK, GB18030, Big5, Shift_JIS, EUC-JP.\n\nSee [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings).\n\nMost singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors!\n\nMultibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors!\n\n\n## Encoding/decoding speed\n\nComparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). \nNote: your results may vary, so please always check on your hardware.\n\n    operation             iconv@2.1.4   iconv-lite@0.4.7\n    ----------------------------------------------------------\n    encode('win1251')     ~96 Mb/s      ~320 Mb/s\n    decode('win1251')     ~95 Mb/s      ~246 Mb/s\n\n## BOM handling\n\n * Decoding: BOM is stripped by default, unless overridden by passing `stripBOM: false` in options\n   (f.ex. `iconv.decode(buf, enc, {stripBOM: false})`).\n   A callback might also be given as a `stripBOM` parameter - it'll be called if BOM character was actually found.\n * If you want to detect UTF-8 BOM when decoding other encodings, use [node-autodetect-decoder-stream](https://github.com/danielgindi/node-autodetect-decoder-stream) module.\n * Encoding: No BOM added, unless overridden by `addBOM: true` option.\n\n## UTF-16 Encodings\n\nThis library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be\nsmart about endianness in the following ways:\n * Decoding: uses BOM and 'spaces heuristic' to determine input endianness. Default is UTF-16LE, but can be \n   overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`.\n * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override.\n\n## Other notes\n\nWhen decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding).  \nUntranslatable characters are set to � or ?. No transliteration is currently supported.  \nNode versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77).  \n\n## Testing\n\n```bash\n$ git clone git@github.com:ashtuchkin/iconv-lite.git\n$ cd iconv-lite\n$ npm install\n$ npm test\n    \n$ # To view performance:\n$ node test/performance.js\n\n$ # To view test coverage:\n$ npm run coverage\n$ open coverage/lcov-report/index.html\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/ashtuchkin/iconv-lite.git"
-  },
-  "scripts": {
-    "coverage": "istanbul cover _mocha -- --grep .",
-    "coverage-open": "open coverage/lcov-report/index.html",
-    "test": "mocha --reporter spec --grep ."
-  },
-  "typings": "./lib/index.d.ts",
-  "version": "0.4.23"
-}
diff --git a/legacy-libs/grpc/node_modules/ignore-walk/LICENSE b/legacy-libs/grpc/node_modules/ignore-walk/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/ignore-walk/README.md b/legacy-libs/grpc/node_modules/ignore-walk/README.md
deleted file mode 100644 (file)
index 66b69e8..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# ignore-walk
-
-[![Build
-Status](https://travis-ci.org/isaacs/ignore-walk.svg?branch=master)](https://travis-ci.org/isaacs/ignore-walk)
-
-Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.
-
-Walk a directory creating a list of entries, parsing any `.ignore`
-files met along the way to exclude files.
-
-## USAGE
-
-```javascript
-const walk = require('ignore-walk')
-
-// All options are optional, defaults provided.
-
-// this function returns a promise, but you can also pass a cb
-// if you like that approach better.
-walk({
-  path: '...', // root dir to start in. defaults to process.cwd()
-  ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']
-  includeEmpty: true|false, // true to include empty dirs, default false
-  follow: true|false // true to follow symlink dirs, default false
-}, callback)
-
-// to walk synchronously, do it this way:
-const result = walk.sync({ path: '/wow/such/filepath' })
-```
-
-If you want to get at the underlying classes, they're at `walk.Walker`
-and `walk.WalkerSync`.
-
-## OPTIONS
-
-* `path` The path to start in.  Defaults to `process.cwd()`
-
-* `ignoreFiles` Filenames to treat as ignore files.  The default is
-  `['.ignore']`.  (This is where you'd put `.gitignore` or
-  `.npmignore` or whatever.)  If multiple ignore files are in a
-  directory, then rules from each are applied in the order that the
-  files are listed.
-
-* `includeEmpty` Set to `true` to include empty directories, assuming
-  they are not excluded by any of the ignore rules.  If not set, then
-  this follows the standard `git` behavior of not including
-  directories that are empty.
-
-    Note: this will cause an empty directory to be included if it
-    would contain an included entry, even if it would have otherwise
-    been excluded itself.
-
-    For example, given the rules `*` (ignore everything) and `!/a/b/c`
-    (re-include the entry at `/a/b/c`), the directory `/a/b` will be
-    included if it is empty.
-
-* `follow`  Set to `true` to treat symbolically linked directories as
-  directories, recursing into them.  There is no handling for nested
-  symlinks, so `ELOOP` errors can occur in some cases when using this
-  option.  Defaults to `false`.
diff --git a/legacy-libs/grpc/node_modules/ignore-walk/index.js b/legacy-libs/grpc/node_modules/ignore-walk/index.js
deleted file mode 100644 (file)
index abfd9ec..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-'use strict'
-
-const fs = require('fs')
-const path = require('path')
-const EE = require('events').EventEmitter
-const Minimatch = require('minimatch').Minimatch
-
-class Walker extends EE {
-  constructor (opts) {
-    opts = opts || {}
-    super(opts)
-    this.path = opts.path || process.cwd()
-    this.basename = path.basename(this.path)
-    this.ignoreFiles = opts.ignoreFiles || [ '.ignore' ]
-    this.ignoreRules = {}
-    this.parent = opts.parent || null
-    this.includeEmpty = !!opts.includeEmpty
-    this.root = this.parent ? this.parent.root : this.path
-    this.follow = !!opts.follow
-    this.result = this.parent ? this.parent.result : []
-    this.entries = null
-    this.sawError = false
-  }
-
-  sort (a, b) {
-    return a.localeCompare(b)
-  }
-
-  emit (ev, data) {
-    let ret = false
-    if (!(this.sawError && ev === 'error')) {
-      if (ev === 'error')
-        this.sawError = true
-      else if (ev === 'done' && !this.parent)
-        data = data.sort(this.sort)
-      if (ev === 'error' && this.parent)
-        ret = this.parent.emit('error', data)
-      else
-        ret = super.emit(ev, data)
-    }
-    return ret
-  }
-
-  start () {
-    fs.readdir(this.path, (er, entries) =>
-      er ? this.emit('error', er) : this.onReaddir(entries))
-    return this
-  }
-
-  isIgnoreFile (e) {
-    return e !== "." &&
-      e !== ".." &&
-      -1 !== this.ignoreFiles.indexOf(e)
-  }
-
-  onReaddir (entries) {
-    this.entries = entries
-    if (entries.length === 0) {
-      if (this.includeEmpty)
-        this.result.push(this.path.substr(this.root.length + 1))
-      this.emit('done', this.result)
-    } else {
-      const hasIg = this.entries.some(e =>
-        this.isIgnoreFile(e))
-
-      if (hasIg)
-        this.addIgnoreFiles()
-      else
-        this.filterEntries()
-    }
-  }
-
-  addIgnoreFiles () {
-    const newIg = this.entries
-      .filter(e => this.isIgnoreFile(e))
-
-    let igCount = newIg.length
-    const then = _ => {
-      if (--igCount === 0)
-        this.filterEntries()
-    }
-
-    newIg.forEach(e => this.addIgnoreFile(e, then))
-  }
-
-  addIgnoreFile (file, then) {
-    const ig = path.resolve(this.path, file)
-    fs.readFile(ig, 'utf8', (er, data) =>
-      er ? this.emit('error', er) : this.onReadIgnoreFile(file, data, then))
-  }
-
-  onReadIgnoreFile (file, data, then) {
-    const mmopt = {
-      matchBase: true,
-      dot: true,
-      flipNegate: true,
-      nocase: true
-    }
-    const rules = data.split(/\r?\n/)
-      .filter(line => !/^#|^$/.test(line.trim()))
-      .map(r => new Minimatch(r, mmopt))
-
-    this.ignoreRules[file] = rules
-
-    then()
-  }
-
-  filterEntries () {
-    // at this point we either have ignore rules, or just inheriting
-    // this exclusion is at the point where we know the list of
-    // entries in the dir, but don't know what they are.  since
-    // some of them *might* be directories, we have to run the
-    // match in dir-mode as well, so that we'll pick up partials
-    // of files that will be included later.  Anything included
-    // at this point will be checked again later once we know
-    // what it is.
-    const filtered = this.entries.map(entry => {
-      // at this point, we don't know if it's a dir or not.
-      const passFile = this.filterEntry(entry)
-      const passDir = this.filterEntry(entry, true)
-      return (passFile || passDir) ? [entry, passFile, passDir] : false
-    }).filter(e => e)
-
-    // now we stat them all
-    // if it's a dir, and passes as a dir, then recurse
-    // if it's not a dir, but passes as a file, add to set
-    let entryCount = filtered.length
-    if (entryCount === 0) {
-      this.emit('done', this.result)
-    } else {
-      const then = _ => {
-        if (-- entryCount === 0)
-          this.emit('done', this.result)
-      }
-      filtered.forEach(filt => {
-        const entry = filt[0]
-        const file = filt[1]
-        const dir = filt[2]
-        this.stat(entry, file, dir, then)
-      })
-    }
-  }
-
-  onstat (st, entry, file, dir, then) {
-    const abs = this.path + '/' + entry
-    if (!st.isDirectory()) {
-      if (file)
-        this.result.push(abs.substr(this.root.length + 1))
-      then()
-    } else {
-      // is a directory
-      if (dir)
-        this.walker(entry, then)
-      else
-        then()
-    }
-  }
-
-  stat (entry, file, dir, then) {
-    const abs = this.path + '/' + entry
-    fs[this.follow ? 'stat' : 'lstat'](abs, (er, st) => {
-      if (er)
-        this.emit('error', er)
-      else
-        this.onstat(st, entry, file, dir, then)
-    })
-  }
-
-  walkerOpt (entry) {
-    return {
-      path: this.path + '/' + entry,
-      parent: this,
-      ignoreFiles: this.ignoreFiles,
-      follow: this.follow,
-      includeEmpty: this.includeEmpty
-    }
-  }
-
-  walker (entry, then) {
-    new Walker(this.walkerOpt(entry)).on('done', then).start()
-  }
-
-  filterEntry (entry, partial) {
-    let included = true
-
-    // this = /a/b/c
-    // entry = d
-    // parent /a/b sees c/d
-    if (this.parent && this.parent.filterEntry) {
-      var pt = this.basename + "/" + entry
-      included = this.parent.filterEntry(pt, partial)
-    }
-
-    this.ignoreFiles.forEach(f => {
-      if (this.ignoreRules[f]) {
-        this.ignoreRules[f].forEach(rule => {
-          // negation means inclusion
-          // so if it's negated, and already included, no need to check
-          // likewise if it's neither negated nor included
-          if (rule.negate !== included) {
-            // first, match against /foo/bar
-            // then, against foo/bar
-            // then, in the case of partials, match with a /
-            const match = rule.match('/' + entry) ||
-              rule.match(entry) ||
-              (!!partial && (
-                rule.match('/' + entry + '/') ||
-                rule.match(entry + '/'))) ||
-              (!!partial && rule.negate && (
-                rule.match('/' + entry, true) ||
-                rule.match(entry, true)))
-
-            if (match)
-              included = rule.negate
-          }
-        })
-      }
-    })
-
-    return included
-  }
-}
-
-class WalkerSync extends Walker {
-  constructor (opt) {
-    super(opt)
-  }
-
-  start () {
-    this.onReaddir(fs.readdirSync(this.path))
-    return this
-  }
-
-  addIgnoreFile (file, then) {
-    const ig = path.resolve(this.path, file)
-    this.onReadIgnoreFile(file, fs.readFileSync(ig, 'utf8'), then)
-  }
-
-  stat (entry, file, dir, then) {
-    const abs = this.path + '/' + entry
-    const st = fs[this.follow ? 'statSync' : 'lstatSync'](abs)
-    this.onstat(st, entry, file, dir, then)
-  }
-
-  walker (entry, then) {
-    new WalkerSync(this.walkerOpt(entry)).start()
-    then()
-  }
-}
-
-const walk = (options, callback) => {
-  const p = new Promise((resolve, reject) => {
-    new Walker(options).on('done', resolve).on('error', reject).start()
-  })
-  return callback ? p.then(res => callback(null, res), callback) : p
-}
-
-const walkSync = options => {
-  return new WalkerSync(options).start().result
-}
-
-module.exports = walk
-walk.sync = walkSync
-walk.Walker = Walker
-walk.WalkerSync = WalkerSync
diff --git a/legacy-libs/grpc/node_modules/ignore-walk/package.json b/legacy-libs/grpc/node_modules/ignore-walk/package.json
deleted file mode 100644 (file)
index 0405313..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "_args": [
-    [
-      "ignore-walk@3.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "ignore-walk@3.0.1",
-  "_id": "ignore-walk@3.0.1",
-  "_inBundle": false,
-  "_integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
-  "_location": "/grpc/ignore-walk",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "ignore-walk@3.0.1",
-    "name": "ignore-walk",
-    "escapedName": "ignore-walk",
-    "rawSpec": "3.0.1",
-    "saveSpec": null,
-    "fetchSpec": "3.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/npm-packlist"
-  ],
-  "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "3.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/ignore-walk/issues"
-  },
-  "dependencies": {
-    "minimatch": "^3.0.4"
-  },
-  "description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.",
-  "devDependencies": {
-    "mkdirp": "^0.5.1",
-    "mutate-fs": "^1.1.0",
-    "rimraf": "^2.6.1",
-    "tap": "^10.7.2"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/isaacs/ignore-walk#readme",
-  "keywords": [
-    "ignorefile",
-    "ignore",
-    "file",
-    ".gitignore",
-    ".npmignore",
-    "glob"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "ignore-walk",
-  "optionalDependencies": {},
-  "readme": "# ignore-walk\n\n[![Build\nStatus](https://travis-ci.org/isaacs/ignore-walk.svg?branch=master)](https://travis-ci.org/isaacs/ignore-walk)\n\nNested/recursive `.gitignore`/`.npmignore` parsing and filtering.\n\nWalk a directory creating a list of entries, parsing any `.ignore`\nfiles met along the way to exclude files.\n\n## USAGE\n\n```javascript\nconst walk = require('ignore-walk')\n\n// All options are optional, defaults provided.\n\n// this function returns a promise, but you can also pass a cb\n// if you like that approach better.\nwalk({\n  path: '...', // root dir to start in. defaults to process.cwd()\n  ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']\n  includeEmpty: true|false, // true to include empty dirs, default false\n  follow: true|false // true to follow symlink dirs, default false\n}, callback)\n\n// to walk synchronously, do it this way:\nconst result = walk.sync({ path: '/wow/such/filepath' })\n```\n\nIf you want to get at the underlying classes, they're at `walk.Walker`\nand `walk.WalkerSync`.\n\n## OPTIONS\n\n* `path` The path to start in.  Defaults to `process.cwd()`\n\n* `ignoreFiles` Filenames to treat as ignore files.  The default is\n  `['.ignore']`.  (This is where you'd put `.gitignore` or\n  `.npmignore` or whatever.)  If multiple ignore files are in a\n  directory, then rules from each are applied in the order that the\n  files are listed.\n\n* `includeEmpty` Set to `true` to include empty directories, assuming\n  they are not excluded by any of the ignore rules.  If not set, then\n  this follows the standard `git` behavior of not including\n  directories that are empty.\n\n    Note: this will cause an empty directory to be included if it\n    would contain an included entry, even if it would have otherwise\n    been excluded itself.\n\n    For example, given the rules `*` (ignore everything) and `!/a/b/c`\n    (re-include the entry at `/a/b/c`), the directory `/a/b` will be\n    included if it is empty.\n\n* `follow`  Set to `true` to treat symbolically linked directories as\n  directories, recursing into them.  There is no handling for nested\n  symlinks, so `ELOOP` errors can occur in some cases when using this\n  option.  Defaults to `false`.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/isaacs/ignore-walk.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --100"
-  },
-  "version": "3.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/inflight/LICENSE b/legacy-libs/grpc/node_modules/inflight/LICENSE
deleted file mode 100644 (file)
index 05eeeb8..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/inflight/README.md b/legacy-libs/grpc/node_modules/inflight/README.md
deleted file mode 100644 (file)
index 6dc8929..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# inflight
-
-Add callbacks to requests in flight to avoid async duplication
-
-## USAGE
-
-```javascript
-var inflight = require('inflight')
-
-// some request that does some stuff
-function req(key, callback) {
-  // key is any random string.  like a url or filename or whatever.
-  //
-  // will return either a falsey value, indicating that the
-  // request for this key is already in flight, or a new callback
-  // which when called will call all callbacks passed to inflightk
-  // with the same key
-  callback = inflight(key, callback)
-
-  // If we got a falsey value back, then there's already a req going
-  if (!callback) return
-
-  // this is where you'd fetch the url or whatever
-  // callback is also once()-ified, so it can safely be assigned
-  // to multiple events etc.  First call wins.
-  setTimeout(function() {
-    callback(null, key)
-  }, 100)
-}
-
-// only assigns a single setTimeout
-// when it dings, all cbs get called
-req('foo', cb1)
-req('foo', cb2)
-req('foo', cb3)
-req('foo', cb4)
-```
diff --git a/legacy-libs/grpc/node_modules/inflight/inflight.js b/legacy-libs/grpc/node_modules/inflight/inflight.js
deleted file mode 100644 (file)
index 48202b3..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-var wrappy = require('wrappy')
-var reqs = Object.create(null)
-var once = require('once')
-
-module.exports = wrappy(inflight)
-
-function inflight (key, cb) {
-  if (reqs[key]) {
-    reqs[key].push(cb)
-    return null
-  } else {
-    reqs[key] = [cb]
-    return makeres(key)
-  }
-}
-
-function makeres (key) {
-  return once(function RES () {
-    var cbs = reqs[key]
-    var len = cbs.length
-    var args = slice(arguments)
-
-    // XXX It's somewhat ambiguous whether a new callback added in this
-    // pass should be queued for later execution if something in the
-    // list of callbacks throws, or if it should just be discarded.
-    // However, it's such an edge case that it hardly matters, and either
-    // choice is likely as surprising as the other.
-    // As it happens, we do go ahead and schedule it for later execution.
-    try {
-      for (var i = 0; i < len; i++) {
-        cbs[i].apply(null, args)
-      }
-    } finally {
-      if (cbs.length > len) {
-        // added more in the interim.
-        // de-zalgo, just in case, but don't call again.
-        cbs.splice(0, len)
-        process.nextTick(function () {
-          RES.apply(null, args)
-        })
-      } else {
-        delete reqs[key]
-      }
-    }
-  })
-}
-
-function slice (args) {
-  var length = args.length
-  var array = []
-
-  for (var i = 0; i < length; i++) array[i] = args[i]
-  return array
-}
diff --git a/legacy-libs/grpc/node_modules/inflight/package.json b/legacy-libs/grpc/node_modules/inflight/package.json
deleted file mode 100644 (file)
index 9bf5e01..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "_args": [
-    [
-      "inflight@1.0.6",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "inflight@1.0.6",
-  "_id": "inflight@1.0.6",
-  "_inBundle": false,
-  "_integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
-  "_location": "/grpc/inflight",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "inflight@1.0.6",
-    "name": "inflight",
-    "escapedName": "inflight",
-    "rawSpec": "1.0.6",
-    "saveSpec": null,
-    "fetchSpec": "1.0.6"
-  },
-  "_requiredBy": [
-    "/grpc/rimraf/glob"
-  ],
-  "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.6",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/inflight/issues"
-  },
-  "dependencies": {
-    "once": "^1.3.0",
-    "wrappy": "1"
-  },
-  "description": "Add callbacks to requests in flight to avoid async duplication",
-  "devDependencies": {
-    "tap": "^7.1.2"
-  },
-  "files": [
-    "inflight.js"
-  ],
-  "homepage": "https://github.com/isaacs/inflight",
-  "license": "ISC",
-  "main": "inflight.js",
-  "name": "inflight",
-  "optionalDependencies": {},
-  "readme": "# inflight\n\nAdd callbacks to requests in flight to avoid async duplication\n\n## USAGE\n\n```javascript\nvar inflight = require('inflight')\n\n// some request that does some stuff\nfunction req(key, callback) {\n  // key is any random string.  like a url or filename or whatever.\n  //\n  // will return either a falsey value, indicating that the\n  // request for this key is already in flight, or a new callback\n  // which when called will call all callbacks passed to inflightk\n  // with the same key\n  callback = inflight(key, callback)\n\n  // If we got a falsey value back, then there's already a req going\n  if (!callback) return\n\n  // this is where you'd fetch the url or whatever\n  // callback is also once()-ified, so it can safely be assigned\n  // to multiple events etc.  First call wins.\n  setTimeout(function() {\n    callback(null, key)\n  }, 100)\n}\n\n// only assigns a single setTimeout\n// when it dings, all cbs get called\nreq('foo', cb1)\nreq('foo', cb2)\nreq('foo', cb3)\nreq('foo', cb4)\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/inflight.git"
-  },
-  "scripts": {
-    "test": "tap test.js --100"
-  },
-  "version": "1.0.6"
-}
diff --git a/legacy-libs/grpc/node_modules/inherits/LICENSE b/legacy-libs/grpc/node_modules/inherits/LICENSE
deleted file mode 100644 (file)
index dea3013..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
diff --git a/legacy-libs/grpc/node_modules/inherits/README.md b/legacy-libs/grpc/node_modules/inherits/README.md
deleted file mode 100644 (file)
index b1c5665..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-Browser-friendly inheritance fully compatible with standard node.js
-[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
-
-This package exports standard `inherits` from node.js `util` module in
-node environment, but also provides alternative browser-friendly
-implementation through [browser
-field](https://gist.github.com/shtylman/4339901). Alternative
-implementation is a literal copy of standard one located in standalone
-module to avoid requiring of `util`. It also has a shim for old
-browsers with no `Object.create` support.
-
-While keeping you sure you are using standard `inherits`
-implementation in node.js environment, it allows bundlers such as
-[browserify](https://github.com/substack/node-browserify) to not
-include full `util` package to your client code if all you need is
-just `inherits` function. It worth, because browser shim for `util`
-package is large and `inherits` is often the single function you need
-from it.
-
-It's recommended to use this package instead of
-`require('util').inherits` for any code that has chances to be used
-not only in node.js but in browser too.
-
-## usage
-
-```js
-var inherits = require('inherits');
-// then use exactly as the standard one
-```
-
-## note on version ~1.0
-
-Version ~1.0 had completely different motivation and is not compatible
-neither with 2.0 nor with standard node.js `inherits`.
-
-If you are using version ~1.0 and planning to switch to ~2.0, be
-careful:
-
-* new version uses `super_` instead of `super` for referencing
-  superclass
-* new version overwrites current prototype while old one preserves any
-  existing fields on it
diff --git a/legacy-libs/grpc/node_modules/inherits/inherits.js b/legacy-libs/grpc/node_modules/inherits/inherits.js
deleted file mode 100644 (file)
index 3b94763..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-try {
-  var util = require('util');
-  if (typeof util.inherits !== 'function') throw '';
-  module.exports = util.inherits;
-} catch (e) {
-  module.exports = require('./inherits_browser.js');
-}
diff --git a/legacy-libs/grpc/node_modules/inherits/inherits_browser.js b/legacy-libs/grpc/node_modules/inherits/inherits_browser.js
deleted file mode 100644 (file)
index c1e78a7..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-if (typeof Object.create === 'function') {
-  // implementation from standard node.js 'util' module
-  module.exports = function inherits(ctor, superCtor) {
-    ctor.super_ = superCtor
-    ctor.prototype = Object.create(superCtor.prototype, {
-      constructor: {
-        value: ctor,
-        enumerable: false,
-        writable: true,
-        configurable: true
-      }
-    });
-  };
-} else {
-  // old school shim for old browsers
-  module.exports = function inherits(ctor, superCtor) {
-    ctor.super_ = superCtor
-    var TempCtor = function () {}
-    TempCtor.prototype = superCtor.prototype
-    ctor.prototype = new TempCtor()
-    ctor.prototype.constructor = ctor
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/inherits/package.json b/legacy-libs/grpc/node_modules/inherits/package.json
deleted file mode 100644 (file)
index dac6c33..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_args": [
-    [
-      "inherits@2.0.3",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "inherits@2.0.3",
-  "_id": "inherits@2.0.3",
-  "_inBundle": false,
-  "_integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
-  "_location": "/grpc/inherits",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "inherits@2.0.3",
-    "name": "inherits",
-    "escapedName": "inherits",
-    "rawSpec": "2.0.3",
-    "saveSpec": null,
-    "fetchSpec": "2.0.3"
-  },
-  "_requiredBy": [
-    "/grpc/readable-stream",
-    "/grpc/rimraf/glob"
-  ],
-  "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.0.3",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "browser": "./inherits_browser.js",
-  "bugs": {
-    "url": "https://github.com/isaacs/inherits/issues"
-  },
-  "dependencies": {},
-  "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
-  "devDependencies": {
-    "tap": "^7.1.0"
-  },
-  "files": [
-    "inherits.js",
-    "inherits_browser.js"
-  ],
-  "homepage": "https://github.com/isaacs/inherits#readme",
-  "keywords": [
-    "inheritance",
-    "class",
-    "klass",
-    "oop",
-    "object-oriented",
-    "inherits",
-    "browser",
-    "browserify"
-  ],
-  "license": "ISC",
-  "main": "./inherits.js",
-  "name": "inherits",
-  "optionalDependencies": {},
-  "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n  superclass\n* new version overwrites current prototype while old one preserves any\n  existing fields on it\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/inherits.git"
-  },
-  "scripts": {
-    "test": "node test"
-  },
-  "version": "2.0.3"
-}
diff --git a/legacy-libs/grpc/node_modules/ini/LICENSE b/legacy-libs/grpc/node_modules/ini/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/ini/README.md b/legacy-libs/grpc/node_modules/ini/README.md
deleted file mode 100644 (file)
index 33df258..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-An ini format parser and serializer for node.
-
-Sections are treated as nested objects.  Items before the first
-heading are saved on the object directly.
-
-## Usage
-
-Consider an ini-file `config.ini` that looks like this:
-
-    ; this comment is being ignored
-    scope = global
-
-    [database]
-    user = dbuser
-    password = dbpassword
-    database = use_this_database
-
-    [paths.default]
-    datadir = /var/lib/data
-    array[] = first value
-    array[] = second value
-    array[] = third value
-
-You can read, manipulate and write the ini-file like so:
-
-    var fs = require('fs')
-      , ini = require('ini')
-
-    var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))
-
-    config.scope = 'local'
-    config.database.database = 'use_another_database'
-    config.paths.default.tmpdir = '/tmp'
-    delete config.paths.default.datadir
-    config.paths.default.array.push('fourth value')
-
-    fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))
-
-This will result in a file called `config_modified.ini` being written
-to the filesystem with the following content:
-
-    [section]
-    scope=local
-    [section.database]
-    user=dbuser
-    password=dbpassword
-    database=use_another_database
-    [section.paths.default]
-    tmpdir=/tmp
-    array[]=first value
-    array[]=second value
-    array[]=third value
-    array[]=fourth value
-
-
-## API
-
-### decode(inistring)
-
-Decode the ini-style formatted `inistring` into a nested object.
-
-### parse(inistring)
-
-Alias for `decode(inistring)`
-
-### encode(object, [options])
-
-Encode the object `object` into an ini-style formatted string. If the
-optional parameter `section` is given, then all top-level properties
-of the object are put into this section and the `section`-string is
-prepended to all sub-sections, see the usage example above.
-
-The `options` object may contain the following:
-
-* `section` A string which will be the first `section` in the encoded
-  ini data.  Defaults to none.
-* `whitespace` Boolean to specify whether to put whitespace around the
-  `=` character.  By default, whitespace is omitted, to be friendly to
-  some persnickety old parsers that don't tolerate it well.  But some
-  find that it's more human-readable and pretty with the whitespace.
-
-For backwards compatibility reasons, if a `string` options is passed
-in, then it is assumed to be the `section` value.
-
-### stringify(object, [options])
-
-Alias for `encode(object, [options])`
-
-### safe(val)
-
-Escapes the string `val` such that it is safe to be used as a key or
-value in an ini-file. Basically escapes quotes. For example
-
-    ini.safe('"unsafe string"')
-
-would result in
-
-    "\"unsafe string\""
-
-### unsafe(val)
-
-Unescapes the string `val`
diff --git a/legacy-libs/grpc/node_modules/ini/ini.js b/legacy-libs/grpc/node_modules/ini/ini.js
deleted file mode 100644 (file)
index 590195d..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-exports.parse = exports.decode = decode
-
-exports.stringify = exports.encode = encode
-
-exports.safe = safe
-exports.unsafe = unsafe
-
-var eol = typeof process !== 'undefined' &&
-  process.platform === 'win32' ? '\r\n' : '\n'
-
-function encode (obj, opt) {
-  var children = []
-  var out = ''
-
-  if (typeof opt === 'string') {
-    opt = {
-      section: opt,
-      whitespace: false
-    }
-  } else {
-    opt = opt || {}
-    opt.whitespace = opt.whitespace === true
-  }
-
-  var separator = opt.whitespace ? ' = ' : '='
-
-  Object.keys(obj).forEach(function (k, _, __) {
-    var val = obj[k]
-    if (val && Array.isArray(val)) {
-      val.forEach(function (item) {
-        out += safe(k + '[]') + separator + safe(item) + '\n'
-      })
-    } else if (val && typeof val === 'object') {
-      children.push(k)
-    } else {
-      out += safe(k) + separator + safe(val) + eol
-    }
-  })
-
-  if (opt.section && out.length) {
-    out = '[' + safe(opt.section) + ']' + eol + out
-  }
-
-  children.forEach(function (k, _, __) {
-    var nk = dotSplit(k).join('\\.')
-    var section = (opt.section ? opt.section + '.' : '') + nk
-    var child = encode(obj[k], {
-      section: section,
-      whitespace: opt.whitespace
-    })
-    if (out.length && child.length) {
-      out += eol
-    }
-    out += child
-  })
-
-  return out
-}
-
-function dotSplit (str) {
-  return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
-    .replace(/\\\./g, '\u0001')
-    .split(/\./).map(function (part) {
-      return part.replace(/\1/g, '\\.')
-      .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
-    })
-}
-
-function decode (str) {
-  var out = {}
-  var p = out
-  var section = null
-  //          section     |key      = value
-  var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
-  var lines = str.split(/[\r\n]+/g)
-
-  lines.forEach(function (line, _, __) {
-    if (!line || line.match(/^\s*[;#]/)) return
-    var match = line.match(re)
-    if (!match) return
-    if (match[1] !== undefined) {
-      section = unsafe(match[1])
-      p = out[section] = out[section] || {}
-      return
-    }
-    var key = unsafe(match[2])
-    var value = match[3] ? unsafe(match[4]) : true
-    switch (value) {
-      case 'true':
-      case 'false':
-      case 'null': value = JSON.parse(value)
-    }
-
-    // Convert keys with '[]' suffix to an array
-    if (key.length > 2 && key.slice(-2) === '[]') {
-      key = key.substring(0, key.length - 2)
-      if (!p[key]) {
-        p[key] = []
-      } else if (!Array.isArray(p[key])) {
-        p[key] = [p[key]]
-      }
-    }
-
-    // safeguard against resetting a previously defined
-    // array by accidentally forgetting the brackets
-    if (Array.isArray(p[key])) {
-      p[key].push(value)
-    } else {
-      p[key] = value
-    }
-  })
-
-  // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
-  // use a filter to return the keys that have to be deleted.
-  Object.keys(out).filter(function (k, _, __) {
-    if (!out[k] ||
-      typeof out[k] !== 'object' ||
-      Array.isArray(out[k])) {
-      return false
-    }
-    // see if the parent section is also an object.
-    // if so, add it to that, and mark this one for deletion
-    var parts = dotSplit(k)
-    var p = out
-    var l = parts.pop()
-    var nl = l.replace(/\\\./g, '.')
-    parts.forEach(function (part, _, __) {
-      if (!p[part] || typeof p[part] !== 'object') p[part] = {}
-      p = p[part]
-    })
-    if (p === out && nl === l) {
-      return false
-    }
-    p[nl] = out[k]
-    return true
-  }).forEach(function (del, _, __) {
-    delete out[del]
-  })
-
-  return out
-}
-
-function isQuoted (val) {
-  return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
-    (val.charAt(0) === "'" && val.slice(-1) === "'")
-}
-
-function safe (val) {
-  return (typeof val !== 'string' ||
-    val.match(/[=\r\n]/) ||
-    val.match(/^\[/) ||
-    (val.length > 1 &&
-     isQuoted(val)) ||
-    val !== val.trim())
-      ? JSON.stringify(val)
-      : val.replace(/;/g, '\\;').replace(/#/g, '\\#')
-}
-
-function unsafe (val, doUnesc) {
-  val = (val || '').trim()
-  if (isQuoted(val)) {
-    // remove the single quotes before calling JSON.parse
-    if (val.charAt(0) === "'") {
-      val = val.substr(1, val.length - 2)
-    }
-    try { val = JSON.parse(val) } catch (_) {}
-  } else {
-    // walk the val to find the first not-escaped ; character
-    var esc = false
-    var unesc = ''
-    for (var i = 0, l = val.length; i < l; i++) {
-      var c = val.charAt(i)
-      if (esc) {
-        if ('\\;#'.indexOf(c) !== -1) {
-          unesc += c
-        } else {
-          unesc += '\\' + c
-        }
-        esc = false
-      } else if (';#'.indexOf(c) !== -1) {
-        break
-      } else if (c === '\\') {
-        esc = true
-      } else {
-        unesc += c
-      }
-    }
-    if (esc) {
-      unesc += '\\'
-    }
-    return unesc.trim()
-  }
-  return val
-}
diff --git a/legacy-libs/grpc/node_modules/ini/package.json b/legacy-libs/grpc/node_modules/ini/package.json
deleted file mode 100644 (file)
index 541a101..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_args": [
-    [
-      "ini@1.3.5",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "ini@1.3.5",
-  "_id": "ini@1.3.5",
-  "_inBundle": false,
-  "_integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
-  "_location": "/grpc/ini",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "ini@1.3.5",
-    "name": "ini",
-    "escapedName": "ini",
-    "rawSpec": "1.3.5",
-    "saveSpec": null,
-    "fetchSpec": "1.3.5"
-  },
-  "_requiredBy": [
-    "/grpc/rc"
-  ],
-  "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.3.5",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/ini/issues"
-  },
-  "dependencies": {},
-  "description": "An ini encoder/decoder for node",
-  "devDependencies": {
-    "standard": "^10.0.3",
-    "tap": "^10.7.3 || 11"
-  },
-  "engines": {
-    "node": "*"
-  },
-  "files": [
-    "ini.js"
-  ],
-  "homepage": "https://github.com/isaacs/ini#readme",
-  "license": "ISC",
-  "main": "ini.js",
-  "name": "ini",
-  "optionalDependencies": {},
-  "readme": "An ini format parser and serializer for node.\n\nSections are treated as nested objects.  Items before the first\nheading are saved on the object directly.\n\n## Usage\n\nConsider an ini-file `config.ini` that looks like this:\n\n    ; this comment is being ignored\n    scope = global\n\n    [database]\n    user = dbuser\n    password = dbpassword\n    database = use_this_database\n\n    [paths.default]\n    datadir = /var/lib/data\n    array[] = first value\n    array[] = second value\n    array[] = third value\n\nYou can read, manipulate and write the ini-file like so:\n\n    var fs = require('fs')\n      , ini = require('ini')\n\n    var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))\n\n    config.scope = 'local'\n    config.database.database = 'use_another_database'\n    config.paths.default.tmpdir = '/tmp'\n    delete config.paths.default.datadir\n    config.paths.default.array.push('fourth value')\n\n    fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))\n\nThis will result in a file called `config_modified.ini` being written\nto the filesystem with the following content:\n\n    [section]\n    scope=local\n    [section.database]\n    user=dbuser\n    password=dbpassword\n    database=use_another_database\n    [section.paths.default]\n    tmpdir=/tmp\n    array[]=first value\n    array[]=second value\n    array[]=third value\n    array[]=fourth value\n\n\n## API\n\n### decode(inistring)\n\nDecode the ini-style formatted `inistring` into a nested object.\n\n### parse(inistring)\n\nAlias for `decode(inistring)`\n\n### encode(object, [options])\n\nEncode the object `object` into an ini-style formatted string. If the\noptional parameter `section` is given, then all top-level properties\nof the object are put into this section and the `section`-string is\nprepended to all sub-sections, see the usage example above.\n\nThe `options` object may contain the following:\n\n* `section` A string which will be the first `section` in the encoded\n  ini data.  Defaults to none.\n* `whitespace` Boolean to specify whether to put whitespace around the\n  `=` character.  By default, whitespace is omitted, to be friendly to\n  some persnickety old parsers that don't tolerate it well.  But some\n  find that it's more human-readable and pretty with the whitespace.\n\nFor backwards compatibility reasons, if a `string` options is passed\nin, then it is assumed to be the `section` value.\n\n### stringify(object, [options])\n\nAlias for `encode(object, [options])`\n\n### safe(val)\n\nEscapes the string `val` such that it is safe to be used as a key or\nvalue in an ini-file. Basically escapes quotes. For example\n\n    ini.safe('\"unsafe string\"')\n\nwould result in\n\n    \"\\\"unsafe string\\\"\"\n\n### unsafe(val)\n\nUnescapes the string `val`\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/ini.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "pretest": "standard ini.js",
-    "preversion": "npm test",
-    "test": "tap test/*.js --100 -J"
-  },
-  "version": "1.3.5"
-}
diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/index.js b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/index.js
deleted file mode 100644 (file)
index a7d3e38..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-'use strict';
-var numberIsNan = require('number-is-nan');
-
-module.exports = function (x) {
-       if (numberIsNan(x)) {
-               return false;
-       }
-
-       // https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
-
-       // code points are derived from:
-       // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
-       if (x >= 0x1100 && (
-               x <= 0x115f ||  // Hangul Jamo
-               0x2329 === x || // LEFT-POINTING ANGLE BRACKET
-               0x232a === x || // RIGHT-POINTING ANGLE BRACKET
-               // CJK Radicals Supplement .. Enclosed CJK Letters and Months
-               (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
-               // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
-               0x3250 <= x && x <= 0x4dbf ||
-               // CJK Unified Ideographs .. Yi Radicals
-               0x4e00 <= x && x <= 0xa4c6 ||
-               // Hangul Jamo Extended-A
-               0xa960 <= x && x <= 0xa97c ||
-               // Hangul Syllables
-               0xac00 <= x && x <= 0xd7a3 ||
-               // CJK Compatibility Ideographs
-               0xf900 <= x && x <= 0xfaff ||
-               // Vertical Forms
-               0xfe10 <= x && x <= 0xfe19 ||
-               // CJK Compatibility Forms .. Small Form Variants
-               0xfe30 <= x && x <= 0xfe6b ||
-               // Halfwidth and Fullwidth Forms
-               0xff01 <= x && x <= 0xff60 ||
-               0xffe0 <= x && x <= 0xffe6 ||
-               // Kana Supplement
-               0x1b000 <= x && x <= 0x1b001 ||
-               // Enclosed Ideographic Supplement
-               0x1f200 <= x && x <= 0x1f251 ||
-               // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
-               0x20000 <= x && x <= 0x3fffd)) {
-               return true;
-       }
-
-       return false;
-}
diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/license b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/package.json b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/package.json
deleted file mode 100644 (file)
index fe46afc..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{
-  "_args": [
-    [
-      "is-fullwidth-code-point@1.0.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "is-fullwidth-code-point@1.0.0",
-  "_id": "is-fullwidth-code-point@1.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
-  "_location": "/grpc/is-fullwidth-code-point",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "is-fullwidth-code-point@1.0.0",
-    "name": "is-fullwidth-code-point",
-    "escapedName": "is-fullwidth-code-point",
-    "rawSpec": "1.0.0",
-    "saveSpec": null,
-    "fetchSpec": "1.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/string-width"
-  ],
-  "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues"
-  },
-  "dependencies": {
-    "number-is-nan": "^1.0.0"
-  },
-  "description": "Check if the character represented by a given Unicode code point is fullwidth",
-  "devDependencies": {
-    "ava": "0.0.4",
-    "code-point-at": "^1.0.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme",
-  "keywords": [
-    "fullwidth",
-    "full-width",
-    "full",
-    "width",
-    "unicode",
-    "character",
-    "char",
-    "string",
-    "str",
-    "codepoint",
-    "code",
-    "point",
-    "is",
-    "detect",
-    "check"
-  ],
-  "license": "MIT",
-  "name": "is-fullwidth-code-point",
-  "optionalDependencies": {},
-  "readme": "# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)\n\n> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)\n\n\n## Install\n\n```\n$ npm install --save is-fullwidth-code-point\n```\n\n\n## Usage\n\n```js\nvar isFullwidthCodePoint = require('is-fullwidth-code-point');\n\nisFullwidthCodePoint('谢'.codePointAt());\n//=> true\n\nisFullwidthCodePoint('a'.codePointAt());\n//=> false\n```\n\n\n## API\n\n### isFullwidthCodePoint(input)\n\n#### input\n\nType: `number`\n\n[Code point](https://en.wikipedia.org/wiki/Code_point) of a character.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git"
-  },
-  "scripts": {
-    "test": "node test.js"
-  },
-  "version": "1.0.0"
-}
diff --git a/legacy-libs/grpc/node_modules/is-fullwidth-code-point/readme.md b/legacy-libs/grpc/node_modules/is-fullwidth-code-point/readme.md
deleted file mode 100644 (file)
index 4936464..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)
-
-> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
-
-
-## Install
-
-```
-$ npm install --save is-fullwidth-code-point
-```
-
-
-## Usage
-
-```js
-var isFullwidthCodePoint = require('is-fullwidth-code-point');
-
-isFullwidthCodePoint('谢'.codePointAt());
-//=> true
-
-isFullwidthCodePoint('a'.codePointAt());
-//=> false
-```
-
-
-## API
-
-### isFullwidthCodePoint(input)
-
-#### input
-
-Type: `number`
-
-[Code point](https://en.wikipedia.org/wiki/Code_point) of a character.
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/isarray/Makefile b/legacy-libs/grpc/node_modules/isarray/Makefile
deleted file mode 100644 (file)
index 787d56e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-test:
-       @node_modules/.bin/tape test.js
-
-.PHONY: test
-
diff --git a/legacy-libs/grpc/node_modules/isarray/README.md b/legacy-libs/grpc/node_modules/isarray/README.md
deleted file mode 100644 (file)
index 16d2c59..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-
-# isarray
-
-`Array#isArray` for older browsers.
-
-[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray)
-[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray)
-
-[![browser support](https://ci.testling.com/juliangruber/isarray.png)
-](https://ci.testling.com/juliangruber/isarray)
-
-## Usage
-
-```js
-var isArray = require('isarray');
-
-console.log(isArray([])); // => true
-console.log(isArray({})); // => false
-```
-
-## Installation
-
-With [npm](http://npmjs.org) do
-
-```bash
-$ npm install isarray
-```
-
-Then bundle for the browser with
-[browserify](https://github.com/substack/browserify).
-
-With [component](http://component.io) do
-
-```bash
-$ component install juliangruber/isarray
-```
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/isarray/component.json b/legacy-libs/grpc/node_modules/isarray/component.json
deleted file mode 100644 (file)
index 9e31b68..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "name" : "isarray",
-  "description" : "Array#isArray for older browsers",
-  "version" : "0.0.1",
-  "repository" : "juliangruber/isarray",
-  "homepage": "https://github.com/juliangruber/isarray",
-  "main" : "index.js",
-  "scripts" : [
-    "index.js"
-  ],
-  "dependencies" : {},
-  "keywords": ["browser","isarray","array"],
-  "author": {
-    "name": "Julian Gruber",
-    "email": "mail@juliangruber.com",
-    "url": "http://juliangruber.com"
-  },
-  "license": "MIT"
-}
diff --git a/legacy-libs/grpc/node_modules/isarray/index.js b/legacy-libs/grpc/node_modules/isarray/index.js
deleted file mode 100644 (file)
index a57f634..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-var toString = {}.toString;
-
-module.exports = Array.isArray || function (arr) {
-  return toString.call(arr) == '[object Array]';
-};
diff --git a/legacy-libs/grpc/node_modules/isarray/package.json b/legacy-libs/grpc/node_modules/isarray/package.json
deleted file mode 100644 (file)
index 387fb1c..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-{
-  "_args": [
-    [
-      "isarray@1.0.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "isarray@1.0.0",
-  "_id": "isarray@1.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
-  "_location": "/grpc/isarray",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "isarray@1.0.0",
-    "name": "isarray",
-    "escapedName": "isarray",
-    "rawSpec": "1.0.0",
-    "saveSpec": null,
-    "fetchSpec": "1.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/readable-stream"
-  ],
-  "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Julian Gruber",
-    "email": "mail@juliangruber.com",
-    "url": "http://juliangruber.com"
-  },
-  "bugs": {
-    "url": "https://github.com/juliangruber/isarray/issues"
-  },
-  "dependencies": {},
-  "description": "Array#isArray for older browsers",
-  "devDependencies": {
-    "tape": "~2.13.4"
-  },
-  "homepage": "https://github.com/juliangruber/isarray",
-  "keywords": [
-    "browser",
-    "isarray",
-    "array"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "isarray",
-  "optionalDependencies": {},
-  "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray)\n[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray)\n\n[![browser support](https://ci.testling.com/juliangruber/isarray.png)\n](https://ci.testling.com/juliangruber/isarray)\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/juliangruber/isarray.git"
-  },
-  "scripts": {
-    "test": "tape test.js"
-  },
-  "testling": {
-    "files": "test.js",
-    "browsers": [
-      "ie/8..latest",
-      "firefox/17..latest",
-      "firefox/nightly",
-      "chrome/22..latest",
-      "chrome/canary",
-      "opera/12..latest",
-      "opera/next",
-      "safari/5.1..latest",
-      "ipad/6.0..latest",
-      "iphone/6.0..latest",
-      "android-browser/4.2..latest"
-    ]
-  },
-  "version": "1.0.0"
-}
diff --git a/legacy-libs/grpc/node_modules/isarray/test.js b/legacy-libs/grpc/node_modules/isarray/test.js
deleted file mode 100644 (file)
index e0c3444..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-var isArray = require('./');
-var test = require('tape');
-
-test('is array', function(t){
-  t.ok(isArray([]));
-  t.notOk(isArray({}));
-  t.notOk(isArray(null));
-  t.notOk(isArray(false));
-
-  var obj = {};
-  obj[0] = true;
-  t.notOk(isArray(obj));
-
-  var arr = [];
-  arr.foo = 'bar';
-  t.ok(isArray(arr));
-
-  t.end();
-});
-
diff --git a/legacy-libs/grpc/node_modules/minimatch/LICENSE b/legacy-libs/grpc/node_modules/minimatch/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/minimatch/README.md b/legacy-libs/grpc/node_modules/minimatch/README.md
deleted file mode 100644 (file)
index ad72b81..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-# minimatch
-
-A minimal matching utility.
-
-[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch)
-
-
-This is the matching library used internally by npm.
-
-It works by converting glob expressions into JavaScript `RegExp`
-objects.
-
-## Usage
-
-```javascript
-var minimatch = require("minimatch")
-
-minimatch("bar.foo", "*.foo") // true!
-minimatch("bar.foo", "*.bar") // false!
-minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
-```
-
-## Features
-
-Supports these glob features:
-
-* Brace Expansion
-* Extended glob matching
-* "Globstar" `**` matching
-
-See:
-
-* `man sh`
-* `man bash`
-* `man 3 fnmatch`
-* `man 5 gitignore`
-
-## Minimatch Class
-
-Create a minimatch object by instantiating the `minimatch.Minimatch` class.
-
-```javascript
-var Minimatch = require("minimatch").Minimatch
-var mm = new Minimatch(pattern, options)
-```
-
-### Properties
-
-* `pattern` The original pattern the minimatch object represents.
-* `options` The options supplied to the constructor.
-* `set` A 2-dimensional array of regexp or string expressions.
-  Each row in the
-  array corresponds to a brace-expanded pattern.  Each item in the row
-  corresponds to a single path-part.  For example, the pattern
-  `{a,b/c}/d` would expand to a set of patterns like:
-
-        [ [ a, d ]
-        , [ b, c, d ] ]
-
-    If a portion of the pattern doesn't have any "magic" in it
-    (that is, it's something like `"foo"` rather than `fo*o?`), then it
-    will be left as a string rather than converted to a regular
-    expression.
-
-* `regexp` Created by the `makeRe` method.  A single regular expression
-  expressing the entire pattern.  This is useful in cases where you wish
-  to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
-* `negate` True if the pattern is negated.
-* `comment` True if the pattern is a comment.
-* `empty` True if the pattern is `""`.
-
-### Methods
-
-* `makeRe` Generate the `regexp` member if necessary, and return it.
-  Will return `false` if the pattern is invalid.
-* `match(fname)` Return true if the filename matches the pattern, or
-  false otherwise.
-* `matchOne(fileArray, patternArray, partial)` Take a `/`-split
-  filename, and match it against a single row in the `regExpSet`.  This
-  method is mainly for internal use, but is exposed so that it can be
-  used by a glob-walker that needs to avoid excessive filesystem calls.
-
-All other methods are internal, and will be called as necessary.
-
-### minimatch(path, pattern, options)
-
-Main export.  Tests a path against the pattern using the options.
-
-```javascript
-var isJS = minimatch(file, "*.js", { matchBase: true })
-```
-
-### minimatch.filter(pattern, options)
-
-Returns a function that tests its
-supplied argument, suitable for use with `Array.filter`.  Example:
-
-```javascript
-var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}))
-```
-
-### minimatch.match(list, pattern, options)
-
-Match against the list of
-files, in the style of fnmatch or glob.  If nothing is matched, and
-options.nonull is set, then return a list containing the pattern itself.
-
-```javascript
-var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}))
-```
-
-### minimatch.makeRe(pattern, options)
-
-Make a regular expression object from the pattern.
-
-## Options
-
-All options are `false` by default.
-
-### debug
-
-Dump a ton of stuff to stderr.
-
-### nobrace
-
-Do not expand `{a,b}` and `{1..3}` brace sets.
-
-### noglobstar
-
-Disable `**` matching against multiple folder names.
-
-### dot
-
-Allow patterns to match filenames starting with a period, even if
-the pattern does not explicitly have a period in that spot.
-
-Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
-is set.
-
-### noext
-
-Disable "extglob" style patterns like `+(a|b)`.
-
-### nocase
-
-Perform a case-insensitive match.
-
-### nonull
-
-When a match is not found by `minimatch.match`, return a list containing
-the pattern itself if this option is set.  When not set, an empty list
-is returned if there are no matches.
-
-### matchBase
-
-If set, then patterns without slashes will be matched
-against the basename of the path if it contains slashes.  For example,
-`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
-
-### nocomment
-
-Suppress the behavior of treating `#` at the start of a pattern as a
-comment.
-
-### nonegate
-
-Suppress the behavior of treating a leading `!` character as negation.
-
-### flipNegate
-
-Returns from negate expressions the same as if they were not negated.
-(Ie, true on a hit, false on a miss.)
-
-
-## Comparisons to other fnmatch/glob implementations
-
-While strict compliance with the existing standards is a worthwhile
-goal, some discrepancies exist between minimatch and other
-implementations, and are intentional.
-
-If the pattern starts with a `!` character, then it is negated.  Set the
-`nonegate` flag to suppress this behavior, and treat leading `!`
-characters normally.  This is perhaps relevant if you wish to start the
-pattern with a negative extglob pattern like `!(a|B)`.  Multiple `!`
-characters at the start of a pattern will negate the pattern multiple
-times.
-
-If a pattern starts with `#`, then it is treated as a comment, and
-will not match anything.  Use `\#` to match a literal `#` at the
-start of a line, or set the `nocomment` flag to suppress this behavior.
-
-The double-star character `**` is supported by default, unless the
-`noglobstar` flag is set.  This is supported in the manner of bsdglob
-and bash 4.1, where `**` only has special significance if it is the only
-thing in a path part.  That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not.
-
-If an escaped pattern has no matches, and the `nonull` flag is set,
-then minimatch.match returns the pattern as-provided, rather than
-interpreting the character escapes.  For example,
-`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
-`"*a?"`.  This is akin to setting the `nullglob` option in bash, except
-that it does not resolve escaped pattern characters.
-
-If brace expansion is not disabled, then it is performed before any
-other interpretation of the glob pattern.  Thus, a pattern like
-`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
-**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
-checked for validity.  Since those two are valid, matching proceeds.
diff --git a/legacy-libs/grpc/node_modules/minimatch/minimatch.js b/legacy-libs/grpc/node_modules/minimatch/minimatch.js
deleted file mode 100644 (file)
index 5b5f8cf..0000000
+++ /dev/null
@@ -1,923 +0,0 @@
-module.exports = minimatch
-minimatch.Minimatch = Minimatch
-
-var path = { sep: '/' }
-try {
-  path = require('path')
-} catch (er) {}
-
-var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = require('brace-expansion')
-
-var plTypes = {
-  '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
-  '?': { open: '(?:', close: ')?' },
-  '+': { open: '(?:', close: ')+' },
-  '*': { open: '(?:', close: ')*' },
-  '@': { open: '(?:', close: ')' }
-}
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-var qmark = '[^/]'
-
-// * => any number of characters
-var star = qmark + '*?'
-
-// ** when dots are allowed.  Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// characters that need to be escaped in RegExp.
-var reSpecials = charSet('().*{}+?[]^$\\!')
-
-// "abc" -> { a:true, b:true, c:true }
-function charSet (s) {
-  return s.split('').reduce(function (set, c) {
-    set[c] = true
-    return set
-  }, {})
-}
-
-// normalizes slashes.
-var slashSplit = /\/+/
-
-minimatch.filter = filter
-function filter (pattern, options) {
-  options = options || {}
-  return function (p, i, list) {
-    return minimatch(p, pattern, options)
-  }
-}
-
-function ext (a, b) {
-  a = a || {}
-  b = b || {}
-  var t = {}
-  Object.keys(b).forEach(function (k) {
-    t[k] = b[k]
-  })
-  Object.keys(a).forEach(function (k) {
-    t[k] = a[k]
-  })
-  return t
-}
-
-minimatch.defaults = function (def) {
-  if (!def || !Object.keys(def).length) return minimatch
-
-  var orig = minimatch
-
-  var m = function minimatch (p, pattern, options) {
-    return orig.minimatch(p, pattern, ext(def, options))
-  }
-
-  m.Minimatch = function Minimatch (pattern, options) {
-    return new orig.Minimatch(pattern, ext(def, options))
-  }
-
-  return m
-}
-
-Minimatch.defaults = function (def) {
-  if (!def || !Object.keys(def).length) return Minimatch
-  return minimatch.defaults(def).Minimatch
-}
-
-function minimatch (p, pattern, options) {
-  if (typeof pattern !== 'string') {
-    throw new TypeError('glob pattern string required')
-  }
-
-  if (!options) options = {}
-
-  // shortcut: comments match nothing.
-  if (!options.nocomment && pattern.charAt(0) === '#') {
-    return false
-  }
-
-  // "" only matches ""
-  if (pattern.trim() === '') return p === ''
-
-  return new Minimatch(pattern, options).match(p)
-}
-
-function Minimatch (pattern, options) {
-  if (!(this instanceof Minimatch)) {
-    return new Minimatch(pattern, options)
-  }
-
-  if (typeof pattern !== 'string') {
-    throw new TypeError('glob pattern string required')
-  }
-
-  if (!options) options = {}
-  pattern = pattern.trim()
-
-  // windows support: need to use /, not \
-  if (path.sep !== '/') {
-    pattern = pattern.split(path.sep).join('/')
-  }
-
-  this.options = options
-  this.set = []
-  this.pattern = pattern
-  this.regexp = null
-  this.negate = false
-  this.comment = false
-  this.empty = false
-
-  // make the set of regexps etc.
-  this.make()
-}
-
-Minimatch.prototype.debug = function () {}
-
-Minimatch.prototype.make = make
-function make () {
-  // don't do it more than once.
-  if (this._made) return
-
-  var pattern = this.pattern
-  var options = this.options
-
-  // empty patterns and comments match nothing.
-  if (!options.nocomment && pattern.charAt(0) === '#') {
-    this.comment = true
-    return
-  }
-  if (!pattern) {
-    this.empty = true
-    return
-  }
-
-  // step 1: figure out negation, etc.
-  this.parseNegate()
-
-  // step 2: expand braces
-  var set = this.globSet = this.braceExpand()
-
-  if (options.debug) this.debug = console.error
-
-  this.debug(this.pattern, set)
-
-  // step 3: now we have a set, so turn each one into a series of path-portion
-  // matching patterns.
-  // These will be regexps, except in the case of "**", which is
-  // set to the GLOBSTAR object for globstar behavior,
-  // and will not contain any / characters
-  set = this.globParts = set.map(function (s) {
-    return s.split(slashSplit)
-  })
-
-  this.debug(this.pattern, set)
-
-  // glob --> regexps
-  set = set.map(function (s, si, set) {
-    return s.map(this.parse, this)
-  }, this)
-
-  this.debug(this.pattern, set)
-
-  // filter out everything that didn't compile properly.
-  set = set.filter(function (s) {
-    return s.indexOf(false) === -1
-  })
-
-  this.debug(this.pattern, set)
-
-  this.set = set
-}
-
-Minimatch.prototype.parseNegate = parseNegate
-function parseNegate () {
-  var pattern = this.pattern
-  var negate = false
-  var options = this.options
-  var negateOffset = 0
-
-  if (options.nonegate) return
-
-  for (var i = 0, l = pattern.length
-    ; i < l && pattern.charAt(i) === '!'
-    ; i++) {
-    negate = !negate
-    negateOffset++
-  }
-
-  if (negateOffset) this.pattern = pattern.substr(negateOffset)
-  this.negate = negate
-}
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = function (pattern, options) {
-  return braceExpand(pattern, options)
-}
-
-Minimatch.prototype.braceExpand = braceExpand
-
-function braceExpand (pattern, options) {
-  if (!options) {
-    if (this instanceof Minimatch) {
-      options = this.options
-    } else {
-      options = {}
-    }
-  }
-
-  pattern = typeof pattern === 'undefined'
-    ? this.pattern : pattern
-
-  if (typeof pattern === 'undefined') {
-    throw new TypeError('undefined pattern')
-  }
-
-  if (options.nobrace ||
-    !pattern.match(/\{.*\}/)) {
-    // shortcut. no need to expand.
-    return [pattern]
-  }
-
-  return expand(pattern)
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion.  Otherwise, any series
-// of * is equivalent to a single *.  Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-Minimatch.prototype.parse = parse
-var SUBPARSE = {}
-function parse (pattern, isSub) {
-  if (pattern.length > 1024 * 64) {
-    throw new TypeError('pattern is too long')
-  }
-
-  var options = this.options
-
-  // shortcuts
-  if (!options.noglobstar && pattern === '**') return GLOBSTAR
-  if (pattern === '') return ''
-
-  var re = ''
-  var hasMagic = !!options.nocase
-  var escaping = false
-  // ? => one single character
-  var patternListStack = []
-  var negativeLists = []
-  var stateChar
-  var inClass = false
-  var reClassStart = -1
-  var classStart = -1
-  // . and .. never match anything that doesn't start with .,
-  // even when options.dot is set.
-  var patternStart = pattern.charAt(0) === '.' ? '' // anything
-  // not (start or / followed by . or .. followed by / or end)
-  : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
-  : '(?!\\.)'
-  var self = this
-
-  function clearStateChar () {
-    if (stateChar) {
-      // we had some state-tracking character
-      // that wasn't consumed by this pass.
-      switch (stateChar) {
-        case '*':
-          re += star
-          hasMagic = true
-        break
-        case '?':
-          re += qmark
-          hasMagic = true
-        break
-        default:
-          re += '\\' + stateChar
-        break
-      }
-      self.debug('clearStateChar %j %j', stateChar, re)
-      stateChar = false
-    }
-  }
-
-  for (var i = 0, len = pattern.length, c
-    ; (i < len) && (c = pattern.charAt(i))
-    ; i++) {
-    this.debug('%s\t%s %s %j', pattern, i, re, c)
-
-    // skip over any that are escaped.
-    if (escaping && reSpecials[c]) {
-      re += '\\' + c
-      escaping = false
-      continue
-    }
-
-    switch (c) {
-      case '/':
-        // completely not allowed, even escaped.
-        // Should already be path-split by now.
-        return false
-
-      case '\\':
-        clearStateChar()
-        escaping = true
-      continue
-
-      // the various stateChar values
-      // for the "extglob" stuff.
-      case '?':
-      case '*':
-      case '+':
-      case '@':
-      case '!':
-        this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
-        // all of those are literals inside a class, except that
-        // the glob [!a] means [^a] in regexp
-        if (inClass) {
-          this.debug('  in class')
-          if (c === '!' && i === classStart + 1) c = '^'
-          re += c
-          continue
-        }
-
-        // if we already have a stateChar, then it means
-        // that there was something like ** or +? in there.
-        // Handle the stateChar, then proceed with this one.
-        self.debug('call clearStateChar %j', stateChar)
-        clearStateChar()
-        stateChar = c
-        // if extglob is disabled, then +(asdf|foo) isn't a thing.
-        // just clear the statechar *now*, rather than even diving into
-        // the patternList stuff.
-        if (options.noext) clearStateChar()
-      continue
-
-      case '(':
-        if (inClass) {
-          re += '('
-          continue
-        }
-
-        if (!stateChar) {
-          re += '\\('
-          continue
-        }
-
-        patternListStack.push({
-          type: stateChar,
-          start: i - 1,
-          reStart: re.length,
-          open: plTypes[stateChar].open,
-          close: plTypes[stateChar].close
-        })
-        // negation is (?:(?!js)[^/]*)
-        re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
-        this.debug('plType %j %j', stateChar, re)
-        stateChar = false
-      continue
-
-      case ')':
-        if (inClass || !patternListStack.length) {
-          re += '\\)'
-          continue
-        }
-
-        clearStateChar()
-        hasMagic = true
-        var pl = patternListStack.pop()
-        // negation is (?:(?!js)[^/]*)
-        // The others are (?:<pattern>)<type>
-        re += pl.close
-        if (pl.type === '!') {
-          negativeLists.push(pl)
-        }
-        pl.reEnd = re.length
-      continue
-
-      case '|':
-        if (inClass || !patternListStack.length || escaping) {
-          re += '\\|'
-          escaping = false
-          continue
-        }
-
-        clearStateChar()
-        re += '|'
-      continue
-
-      // these are mostly the same in regexp and glob
-      case '[':
-        // swallow any state-tracking char before the [
-        clearStateChar()
-
-        if (inClass) {
-          re += '\\' + c
-          continue
-        }
-
-        inClass = true
-        classStart = i
-        reClassStart = re.length
-        re += c
-      continue
-
-      case ']':
-        //  a right bracket shall lose its special
-        //  meaning and represent itself in
-        //  a bracket expression if it occurs
-        //  first in the list.  -- POSIX.2 2.8.3.2
-        if (i === classStart + 1 || !inClass) {
-          re += '\\' + c
-          escaping = false
-          continue
-        }
-
-        // handle the case where we left a class open.
-        // "[z-a]" is valid, equivalent to "\[z-a\]"
-        if (inClass) {
-          // split where the last [ was, make sure we don't have
-          // an invalid re. if so, re-walk the contents of the
-          // would-be class to re-translate any characters that
-          // were passed through as-is
-          // TODO: It would probably be faster to determine this
-          // without a try/catch and a new RegExp, but it's tricky
-          // to do safely.  For now, this is safe and works.
-          var cs = pattern.substring(classStart + 1, i)
-          try {
-            RegExp('[' + cs + ']')
-          } catch (er) {
-            // not a valid class!
-            var sp = this.parse(cs, SUBPARSE)
-            re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
-            hasMagic = hasMagic || sp[1]
-            inClass = false
-            continue
-          }
-        }
-
-        // finish up the class.
-        hasMagic = true
-        inClass = false
-        re += c
-      continue
-
-      default:
-        // swallow any state char that wasn't consumed
-        clearStateChar()
-
-        if (escaping) {
-          // no need
-          escaping = false
-        } else if (reSpecials[c]
-          && !(c === '^' && inClass)) {
-          re += '\\'
-        }
-
-        re += c
-
-    } // switch
-  } // for
-
-  // handle the case where we left a class open.
-  // "[abc" is valid, equivalent to "\[abc"
-  if (inClass) {
-    // split where the last [ was, and escape it
-    // this is a huge pita.  We now have to re-walk
-    // the contents of the would-be class to re-translate
-    // any characters that were passed through as-is
-    cs = pattern.substr(classStart + 1)
-    sp = this.parse(cs, SUBPARSE)
-    re = re.substr(0, reClassStart) + '\\[' + sp[0]
-    hasMagic = hasMagic || sp[1]
-  }
-
-  // handle the case where we had a +( thing at the *end*
-  // of the pattern.
-  // each pattern list stack adds 3 chars, and we need to go through
-  // and escape any | chars that were passed through as-is for the regexp.
-  // Go through and escape them, taking care not to double-escape any
-  // | chars that were already escaped.
-  for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
-    var tail = re.slice(pl.reStart + pl.open.length)
-    this.debug('setting tail', re, pl)
-    // maybe some even number of \, then maybe 1 \, followed by a |
-    tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
-      if (!$2) {
-        // the | isn't already escaped, so escape it.
-        $2 = '\\'
-      }
-
-      // need to escape all those slashes *again*, without escaping the
-      // one that we need for escaping the | character.  As it works out,
-      // escaping an even number of slashes can be done by simply repeating
-      // it exactly after itself.  That's why this trick works.
-      //
-      // I am sorry that you have to see this.
-      return $1 + $1 + $2 + '|'
-    })
-
-    this.debug('tail=%j\n   %s', tail, tail, pl, re)
-    var t = pl.type === '*' ? star
-      : pl.type === '?' ? qmark
-      : '\\' + pl.type
-
-    hasMagic = true
-    re = re.slice(0, pl.reStart) + t + '\\(' + tail
-  }
-
-  // handle trailing things that only matter at the very end.
-  clearStateChar()
-  if (escaping) {
-    // trailing \\
-    re += '\\\\'
-  }
-
-  // only need to apply the nodot start if the re starts with
-  // something that could conceivably capture a dot
-  var addPatternStart = false
-  switch (re.charAt(0)) {
-    case '.':
-    case '[':
-    case '(': addPatternStart = true
-  }
-
-  // Hack to work around lack of negative lookbehind in JS
-  // A pattern like: *.!(x).!(y|z) needs to ensure that a name
-  // like 'a.xyz.yz' doesn't match.  So, the first negative
-  // lookahead, has to look ALL the way ahead, to the end of
-  // the pattern.
-  for (var n = negativeLists.length - 1; n > -1; n--) {
-    var nl = negativeLists[n]
-
-    var nlBefore = re.slice(0, nl.reStart)
-    var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
-    var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
-    var nlAfter = re.slice(nl.reEnd)
-
-    nlLast += nlAfter
-
-    // Handle nested stuff like *(*.js|!(*.json)), where open parens
-    // mean that we should *not* include the ) in the bit that is considered
-    // "after" the negated section.
-    var openParensBefore = nlBefore.split('(').length - 1
-    var cleanAfter = nlAfter
-    for (i = 0; i < openParensBefore; i++) {
-      cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
-    }
-    nlAfter = cleanAfter
-
-    var dollar = ''
-    if (nlAfter === '' && isSub !== SUBPARSE) {
-      dollar = '$'
-    }
-    var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
-    re = newRe
-  }
-
-  // if the re is not "" at this point, then we need to make sure
-  // it doesn't match against an empty path part.
-  // Otherwise a/* will match a/, which it should not.
-  if (re !== '' && hasMagic) {
-    re = '(?=.)' + re
-  }
-
-  if (addPatternStart) {
-    re = patternStart + re
-  }
-
-  // parsing just a piece of a larger pattern.
-  if (isSub === SUBPARSE) {
-    return [re, hasMagic]
-  }
-
-  // skip the regexp for non-magical patterns
-  // unescape anything in it, though, so that it'll be
-  // an exact match against a file etc.
-  if (!hasMagic) {
-    return globUnescape(pattern)
-  }
-
-  var flags = options.nocase ? 'i' : ''
-  try {
-    var regExp = new RegExp('^' + re + '$', flags)
-  } catch (er) {
-    // If it was an invalid regular expression, then it can't match
-    // anything.  This trick looks for a character after the end of
-    // the string, which is of course impossible, except in multi-line
-    // mode, but it's not a /m regex.
-    return new RegExp('$.')
-  }
-
-  regExp._glob = pattern
-  regExp._src = re
-
-  return regExp
-}
-
-minimatch.makeRe = function (pattern, options) {
-  return new Minimatch(pattern, options || {}).makeRe()
-}
-
-Minimatch.prototype.makeRe = makeRe
-function makeRe () {
-  if (this.regexp || this.regexp === false) return this.regexp
-
-  // at this point, this.set is a 2d array of partial
-  // pattern strings, or "**".
-  //
-  // It's better to use .match().  This function shouldn't
-  // be used, really, but it's pretty convenient sometimes,
-  // when you just want to work with a regex.
-  var set = this.set
-
-  if (!set.length) {
-    this.regexp = false
-    return this.regexp
-  }
-  var options = this.options
-
-  var twoStar = options.noglobstar ? star
-    : options.dot ? twoStarDot
-    : twoStarNoDot
-  var flags = options.nocase ? 'i' : ''
-
-  var re = set.map(function (pattern) {
-    return pattern.map(function (p) {
-      return (p === GLOBSTAR) ? twoStar
-      : (typeof p === 'string') ? regExpEscape(p)
-      : p._src
-    }).join('\\\/')
-  }).join('|')
-
-  // must match entire pattern
-  // ending in a * or ** will make it less strict.
-  re = '^(?:' + re + ')$'
-
-  // can match anything, as long as it's not this.
-  if (this.negate) re = '^(?!' + re + ').*$'
-
-  try {
-    this.regexp = new RegExp(re, flags)
-  } catch (ex) {
-    this.regexp = false
-  }
-  return this.regexp
-}
-
-minimatch.match = function (list, pattern, options) {
-  options = options || {}
-  var mm = new Minimatch(pattern, options)
-  list = list.filter(function (f) {
-    return mm.match(f)
-  })
-  if (mm.options.nonull && !list.length) {
-    list.push(pattern)
-  }
-  return list
-}
-
-Minimatch.prototype.match = match
-function match (f, partial) {
-  this.debug('match', f, this.pattern)
-  // short-circuit in the case of busted things.
-  // comments, etc.
-  if (this.comment) return false
-  if (this.empty) return f === ''
-
-  if (f === '/' && partial) return true
-
-  var options = this.options
-
-  // windows: need to use /, not \
-  if (path.sep !== '/') {
-    f = f.split(path.sep).join('/')
-  }
-
-  // treat the test path as a set of pathparts.
-  f = f.split(slashSplit)
-  this.debug(this.pattern, 'split', f)
-
-  // just ONE of the pattern sets in this.set needs to match
-  // in order for it to be valid.  If negating, then just one
-  // match means that we have failed.
-  // Either way, return on the first hit.
-
-  var set = this.set
-  this.debug(this.pattern, 'set', set)
-
-  // Find the basename of the path by looking for the last non-empty segment
-  var filename
-  var i
-  for (i = f.length - 1; i >= 0; i--) {
-    filename = f[i]
-    if (filename) break
-  }
-
-  for (i = 0; i < set.length; i++) {
-    var pattern = set[i]
-    var file = f
-    if (options.matchBase && pattern.length === 1) {
-      file = [filename]
-    }
-    var hit = this.matchOne(file, pattern, partial)
-    if (hit) {
-      if (options.flipNegate) return true
-      return !this.negate
-    }
-  }
-
-  // didn't get any hits.  this is success if it's a negative
-  // pattern, failure otherwise.
-  if (options.flipNegate) return false
-  return this.negate
-}
-
-// set partial to true to test if, for example,
-// "/a/b" matches the start of "/*/b/*/d"
-// Partial means, if you run out of file before you run
-// out of pattern, then that's fine, as long as all
-// the parts match.
-Minimatch.prototype.matchOne = function (file, pattern, partial) {
-  var options = this.options
-
-  this.debug('matchOne',
-    { 'this': this, file: file, pattern: pattern })
-
-  this.debug('matchOne', file.length, pattern.length)
-
-  for (var fi = 0,
-      pi = 0,
-      fl = file.length,
-      pl = pattern.length
-      ; (fi < fl) && (pi < pl)
-      ; fi++, pi++) {
-    this.debug('matchOne loop')
-    var p = pattern[pi]
-    var f = file[fi]
-
-    this.debug(pattern, p, f)
-
-    // should be impossible.
-    // some invalid regexp stuff in the set.
-    if (p === false) return false
-
-    if (p === GLOBSTAR) {
-      this.debug('GLOBSTAR', [pattern, p, f])
-
-      // "**"
-      // a/**/b/**/c would match the following:
-      // a/b/x/y/z/c
-      // a/x/y/z/b/c
-      // a/b/x/b/x/c
-      // a/b/c
-      // To do this, take the rest of the pattern after
-      // the **, and see if it would match the file remainder.
-      // If so, return success.
-      // If not, the ** "swallows" a segment, and try again.
-      // This is recursively awful.
-      //
-      // a/**/b/**/c matching a/b/x/y/z/c
-      // - a matches a
-      // - doublestar
-      //   - matchOne(b/x/y/z/c, b/**/c)
-      //     - b matches b
-      //     - doublestar
-      //       - matchOne(x/y/z/c, c) -> no
-      //       - matchOne(y/z/c, c) -> no
-      //       - matchOne(z/c, c) -> no
-      //       - matchOne(c, c) yes, hit
-      var fr = fi
-      var pr = pi + 1
-      if (pr === pl) {
-        this.debug('** at the end')
-        // a ** at the end will just swallow the rest.
-        // We have found a match.
-        // however, it will not swallow /.x, unless
-        // options.dot is set.
-        // . and .. are *never* matched by **, for explosively
-        // exponential reasons.
-        for (; fi < fl; fi++) {
-          if (file[fi] === '.' || file[fi] === '..' ||
-            (!options.dot && file[fi].charAt(0) === '.')) return false
-        }
-        return true
-      }
-
-      // ok, let's see if we can swallow whatever we can.
-      while (fr < fl) {
-        var swallowee = file[fr]
-
-        this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
-        // XXX remove this slice.  Just pass the start index.
-        if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
-          this.debug('globstar found match!', fr, fl, swallowee)
-          // found a match.
-          return true
-        } else {
-          // can't swallow "." or ".." ever.
-          // can only swallow ".foo" when explicitly asked.
-          if (swallowee === '.' || swallowee === '..' ||
-            (!options.dot && swallowee.charAt(0) === '.')) {
-            this.debug('dot detected!', file, fr, pattern, pr)
-            break
-          }
-
-          // ** swallows a segment, and continue.
-          this.debug('globstar swallow a segment, and continue')
-          fr++
-        }
-      }
-
-      // no match was found.
-      // However, in partial mode, we can't say this is necessarily over.
-      // If there's more *pattern* left, then
-      if (partial) {
-        // ran out of file
-        this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
-        if (fr === fl) return true
-      }
-      return false
-    }
-
-    // something other than **
-    // non-magic patterns just have to match exactly
-    // patterns with magic have been turned into regexps.
-    var hit
-    if (typeof p === 'string') {
-      if (options.nocase) {
-        hit = f.toLowerCase() === p.toLowerCase()
-      } else {
-        hit = f === p
-      }
-      this.debug('string match', p, f, hit)
-    } else {
-      hit = f.match(p)
-      this.debug('pattern match', p, f, hit)
-    }
-
-    if (!hit) return false
-  }
-
-  // Note: ending in / means that we'll get a final ""
-  // at the end of the pattern.  This can only match a
-  // corresponding "" at the end of the file.
-  // If the file ends in /, then it can only match a
-  // a pattern that ends in /, unless the pattern just
-  // doesn't have any more for it. But, a/b/ should *not*
-  // match "a/b/*", even though "" matches against the
-  // [^/]*? pattern, except in partial mode, where it might
-  // simply not be reached yet.
-  // However, a/b/ should still satisfy a/*
-
-  // now either we fell off the end of the pattern, or we're done.
-  if (fi === fl && pi === pl) {
-    // ran out of pattern and filename at the same time.
-    // an exact hit!
-    return true
-  } else if (fi === fl) {
-    // ran out of file, but still had pattern left.
-    // this is ok if we're doing the match as part of
-    // a glob fs traversal.
-    return partial
-  } else if (pi === pl) {
-    // ran out of pattern, still have file left.
-    // this is only acceptable if we're on the very last
-    // empty segment of a file with a trailing slash.
-    // a/* should match a/b/
-    var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
-    return emptyFileEnd
-  }
-
-  // should be unreachable.
-  throw new Error('wtf?')
-}
-
-// replace stuff like \* with *
-function globUnescape (s) {
-  return s.replace(/\\(.)/g, '$1')
-}
-
-function regExpEscape (s) {
-  return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-}
diff --git a/legacy-libs/grpc/node_modules/minimatch/package.json b/legacy-libs/grpc/node_modules/minimatch/package.json
deleted file mode 100644 (file)
index ebfbfc8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-{
-  "_args": [
-    [
-      "minimatch@3.0.4",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "minimatch@3.0.4",
-  "_id": "minimatch@3.0.4",
-  "_inBundle": false,
-  "_integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
-  "_location": "/grpc/minimatch",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "minimatch@3.0.4",
-    "name": "minimatch",
-    "escapedName": "minimatch",
-    "rawSpec": "3.0.4",
-    "saveSpec": null,
-    "fetchSpec": "3.0.4"
-  },
-  "_requiredBy": [
-    "/grpc/ignore-walk",
-    "/grpc/rimraf/glob"
-  ],
-  "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
-  "_shrinkwrap": null,
-  "_spec": "3.0.4",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/minimatch/issues"
-  },
-  "dependencies": {
-    "brace-expansion": "^1.1.7"
-  },
-  "description": "a glob matcher in javascript",
-  "devDependencies": {
-    "tap": "^10.3.2"
-  },
-  "engines": {
-    "node": "*"
-  },
-  "files": [
-    "minimatch.js"
-  ],
-  "homepage": "https://github.com/isaacs/minimatch#readme",
-  "license": "ISC",
-  "main": "minimatch.js",
-  "name": "minimatch",
-  "optionalDependencies": {},
-  "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\nminimatch(\"bar.foo\", \"*.+(bar|foo)\", { debug: true }) // true, and noisy!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n## Minimatch Class\n\nCreate a minimatch object by instantiating the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n  Each row in the\n  array corresponds to a brace-expanded pattern.  Each item in the row\n  corresponds to a single path-part.  For example, the pattern\n  `{a,b/c}/d` would expand to a set of patterns like:\n\n        [ [ a, d ]\n        , [ b, c, d ] ]\n\n    If a portion of the pattern doesn't have any \"magic\" in it\n    (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n    will be left as a string rather than converted to a regular\n    expression.\n\n* `regexp` Created by the `makeRe` method.  A single regular expression\n  expressing the entire pattern.  This is useful in cases where you wish\n  to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n  Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n  false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n  filename, and match it against a single row in the `regExpSet`.  This\n  method is mainly for internal use, but is exposed so that it can be\n  used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n### minimatch(path, pattern, options)\n\nMain export.  Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`.  Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob.  If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself if this option is set.  When not set, an empty list\nis returned if there are no matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes.  For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated.  Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally.  This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`.  Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything.  Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set.  This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part.  That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes.  For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`.  This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern.  Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity.  Since those two are valid, matching proceeds.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/minimatch.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --cov"
-  },
-  "version": "3.0.4"
-}
diff --git a/legacy-libs/grpc/node_modules/minimist/LICENSE b/legacy-libs/grpc/node_modules/minimist/LICENSE
deleted file mode 100644 (file)
index ee27ba4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/minimist/example/parse.js b/legacy-libs/grpc/node_modules/minimist/example/parse.js
deleted file mode 100644 (file)
index abff3e8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-var argv = require('../')(process.argv.slice(2));
-console.dir(argv);
diff --git a/legacy-libs/grpc/node_modules/minimist/index.js b/legacy-libs/grpc/node_modules/minimist/index.js
deleted file mode 100644 (file)
index 6a0559d..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-module.exports = function (args, opts) {
-    if (!opts) opts = {};
-    
-    var flags = { bools : {}, strings : {}, unknownFn: null };
-
-    if (typeof opts['unknown'] === 'function') {
-        flags.unknownFn = opts['unknown'];
-    }
-
-    if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
-      flags.allBools = true;
-    } else {
-      [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
-          flags.bools[key] = true;
-      });
-    }
-    
-    var aliases = {};
-    Object.keys(opts.alias || {}).forEach(function (key) {
-        aliases[key] = [].concat(opts.alias[key]);
-        aliases[key].forEach(function (x) {
-            aliases[x] = [key].concat(aliases[key].filter(function (y) {
-                return x !== y;
-            }));
-        });
-    });
-
-    [].concat(opts.string).filter(Boolean).forEach(function (key) {
-        flags.strings[key] = true;
-        if (aliases[key]) {
-            flags.strings[aliases[key]] = true;
-        }
-     });
-
-    var defaults = opts['default'] || {};
-    
-    var argv = { _ : [] };
-    Object.keys(flags.bools).forEach(function (key) {
-        setArg(key, defaults[key] === undefined ? false : defaults[key]);
-    });
-    
-    var notFlags = [];
-
-    if (args.indexOf('--') !== -1) {
-        notFlags = args.slice(args.indexOf('--')+1);
-        args = args.slice(0, args.indexOf('--'));
-    }
-
-    function argDefined(key, arg) {
-        return (flags.allBools && /^--[^=]+$/.test(arg)) ||
-            flags.strings[key] || flags.bools[key] || aliases[key];
-    }
-
-    function setArg (key, val, arg) {
-        if (arg && flags.unknownFn && !argDefined(key, arg)) {
-            if (flags.unknownFn(arg) === false) return;
-        }
-
-        var value = !flags.strings[key] && isNumber(val)
-            ? Number(val) : val
-        ;
-        setKey(argv, key.split('.'), value);
-        
-        (aliases[key] || []).forEach(function (x) {
-            setKey(argv, x.split('.'), value);
-        });
-    }
-
-    function setKey (obj, keys, value) {
-        var o = obj;
-        keys.slice(0,-1).forEach(function (key) {
-            if (o[key] === undefined) o[key] = {};
-            o = o[key];
-        });
-
-        var key = keys[keys.length - 1];
-        if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
-            o[key] = value;
-        }
-        else if (Array.isArray(o[key])) {
-            o[key].push(value);
-        }
-        else {
-            o[key] = [ o[key], value ];
-        }
-    }
-    
-    function aliasIsBoolean(key) {
-      return aliases[key].some(function (x) {
-          return flags.bools[x];
-      });
-    }
-
-    for (var i = 0; i < args.length; i++) {
-        var arg = args[i];
-        
-        if (/^--.+=/.test(arg)) {
-            // Using [\s\S] instead of . because js doesn't support the
-            // 'dotall' regex modifier. See:
-            // http://stackoverflow.com/a/1068308/13216
-            var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
-            var key = m[1];
-            var value = m[2];
-            if (flags.bools[key]) {
-                value = value !== 'false';
-            }
-            setArg(key, value, arg);
-        }
-        else if (/^--no-.+/.test(arg)) {
-            var key = arg.match(/^--no-(.+)/)[1];
-            setArg(key, false, arg);
-        }
-        else if (/^--.+/.test(arg)) {
-            var key = arg.match(/^--(.+)/)[1];
-            var next = args[i + 1];
-            if (next !== undefined && !/^-/.test(next)
-            && !flags.bools[key]
-            && !flags.allBools
-            && (aliases[key] ? !aliasIsBoolean(key) : true)) {
-                setArg(key, next, arg);
-                i++;
-            }
-            else if (/^(true|false)$/.test(next)) {
-                setArg(key, next === 'true', arg);
-                i++;
-            }
-            else {
-                setArg(key, flags.strings[key] ? '' : true, arg);
-            }
-        }
-        else if (/^-[^-]+/.test(arg)) {
-            var letters = arg.slice(1,-1).split('');
-            
-            var broken = false;
-            for (var j = 0; j < letters.length; j++) {
-                var next = arg.slice(j+2);
-                
-                if (next === '-') {
-                    setArg(letters[j], next, arg)
-                    continue;
-                }
-                
-                if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
-                    setArg(letters[j], next.split('=')[1], arg);
-                    broken = true;
-                    break;
-                }
-                
-                if (/[A-Za-z]/.test(letters[j])
-                && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
-                    setArg(letters[j], next, arg);
-                    broken = true;
-                    break;
-                }
-                
-                if (letters[j+1] && letters[j+1].match(/\W/)) {
-                    setArg(letters[j], arg.slice(j+2), arg);
-                    broken = true;
-                    break;
-                }
-                else {
-                    setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
-                }
-            }
-            
-            var key = arg.slice(-1)[0];
-            if (!broken && key !== '-') {
-                if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
-                && !flags.bools[key]
-                && (aliases[key] ? !aliasIsBoolean(key) : true)) {
-                    setArg(key, args[i+1], arg);
-                    i++;
-                }
-                else if (args[i+1] && /true|false/.test(args[i+1])) {
-                    setArg(key, args[i+1] === 'true', arg);
-                    i++;
-                }
-                else {
-                    setArg(key, flags.strings[key] ? '' : true, arg);
-                }
-            }
-        }
-        else {
-            if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
-                argv._.push(
-                    flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
-                );
-            }
-            if (opts.stopEarly) {
-                argv._.push.apply(argv._, args.slice(i + 1));
-                break;
-            }
-        }
-    }
-    
-    Object.keys(defaults).forEach(function (key) {
-        if (!hasKey(argv, key.split('.'))) {
-            setKey(argv, key.split('.'), defaults[key]);
-            
-            (aliases[key] || []).forEach(function (x) {
-                setKey(argv, x.split('.'), defaults[key]);
-            });
-        }
-    });
-    
-    if (opts['--']) {
-        argv['--'] = new Array();
-        notFlags.forEach(function(key) {
-            argv['--'].push(key);
-        });
-    }
-    else {
-        notFlags.forEach(function(key) {
-            argv._.push(key);
-        });
-    }
-
-    return argv;
-};
-
-function hasKey (obj, keys) {
-    var o = obj;
-    keys.slice(0,-1).forEach(function (key) {
-        o = (o[key] || {});
-    });
-
-    var key = keys[keys.length - 1];
-    return key in o;
-}
-
-function isNumber (x) {
-    if (typeof x === 'number') return true;
-    if (/^0x[0-9a-f]+$/i.test(x)) return true;
-    return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
-}
-
diff --git a/legacy-libs/grpc/node_modules/minimist/package.json b/legacy-libs/grpc/node_modules/minimist/package.json
deleted file mode 100644 (file)
index 4daddce..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-{
-  "_args": [
-    [
-      "minimist@1.2.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "minimist@1.2.0",
-  "_id": "minimist@1.2.0",
-  "_inBundle": false,
-  "_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
-  "_location": "/grpc/minimist",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "minimist@1.2.0",
-    "name": "minimist",
-    "escapedName": "minimist",
-    "rawSpec": "1.2.0",
-    "saveSpec": null,
-    "fetchSpec": "1.2.0"
-  },
-  "_requiredBy": [
-    "/grpc/rc"
-  ],
-  "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.2.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "James Halliday",
-    "email": "mail@substack.net",
-    "url": "http://substack.net"
-  },
-  "bugs": {
-    "url": "https://github.com/substack/minimist/issues"
-  },
-  "dependencies": {},
-  "description": "parse argument options",
-  "devDependencies": {
-    "covert": "^1.0.0",
-    "tap": "~0.4.0",
-    "tape": "^3.5.0"
-  },
-  "homepage": "https://github.com/substack/minimist",
-  "keywords": [
-    "argv",
-    "getopt",
-    "parser",
-    "optimist"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "minimist",
-  "optionalDependencies": {},
-  "readme": "# minimist\n\nparse argument options\n\nThis module is the guts of optimist's argument parser without all the\nfanciful decoration.\n\n[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)\n\n[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)\n\n# example\n\n``` js\nvar argv = require('minimist')(process.argv.slice(2));\nconsole.dir(argv);\n```\n\n```\n$ node example/parse.js -a beep -b boop\n{ _: [], a: 'beep', b: 'boop' }\n```\n\n```\n$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz\n{ _: [ 'foo', 'bar', 'baz' ],\n  x: 3,\n  y: 4,\n  n: 5,\n  a: true,\n  b: true,\n  c: true,\n  beep: 'boop' }\n```\n\n# methods\n\n``` js\nvar parseArgs = require('minimist')\n```\n\n## var argv = parseArgs(args, opts={})\n\nReturn an argument object `argv` populated with the array arguments from `args`.\n\n`argv._` contains all the arguments that didn't have an option associated with\nthem.\n\nNumeric-looking arguments will be returned as numbers unless `opts.string` or\n`opts.boolean` is set for that argument name.\n\nAny arguments after `'--'` will not be parsed and will end up in `argv._`.\n\noptions can be:\n\n* `opts.string` - a string or array of strings argument names to always treat as\nstrings\n* `opts.boolean` - a boolean, string or array of strings to always treat as\nbooleans. if `true` will treat all double hyphenated arguments without equal signs\nas boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)\n* `opts.alias` - an object mapping string names to strings or arrays of string\nargument names to use as aliases\n* `opts.default` - an object mapping string argument names to default values\n* `opts.stopEarly` - when true, populate `argv._` with everything after the\nfirst non-option\n* `opts['--']` - when true, populate `argv._` with everything before the `--`\nand `argv['--']` with everything after the `--`. Here's an example:\n* `opts.unknown` - a function which is invoked with a command line parameter not\ndefined in the `opts` configuration object. If the function returns `false`, the\nunknown option is not added to `argv`.\n\n```\n> require('./')('one two three -- four five --six'.split(' '), { '--': true })\n{ _: [ 'one', 'two', 'three' ],\n  '--': [ 'four', 'five', '--six' ] }\n```\n\nNote that with `opts['--']` set, parsing for arguments still stops after the\n`--`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install minimist\n```\n\n# license\n\nMIT\n",
-  "readmeFilename": "readme.markdown",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/substack/minimist.git"
-  },
-  "scripts": {
-    "coverage": "covert test/*.js",
-    "test": "tap test/*.js"
-  },
-  "testling": {
-    "files": "test/*.js",
-    "browsers": [
-      "ie/6..latest",
-      "ff/5",
-      "firefox/latest",
-      "chrome/10",
-      "chrome/latest",
-      "safari/5.1",
-      "safari/latest",
-      "opera/12"
-    ]
-  },
-  "version": "1.2.0"
-}
diff --git a/legacy-libs/grpc/node_modules/minimist/readme.markdown b/legacy-libs/grpc/node_modules/minimist/readme.markdown
deleted file mode 100644 (file)
index 30a74cf..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-# minimist
-
-parse argument options
-
-This module is the guts of optimist's argument parser without all the
-fanciful decoration.
-
-[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)
-
-[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)
-
-# example
-
-``` js
-var argv = require('minimist')(process.argv.slice(2));
-console.dir(argv);
-```
-
-```
-$ node example/parse.js -a beep -b boop
-{ _: [], a: 'beep', b: 'boop' }
-```
-
-```
-$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
-{ _: [ 'foo', 'bar', 'baz' ],
-  x: 3,
-  y: 4,
-  n: 5,
-  a: true,
-  b: true,
-  c: true,
-  beep: 'boop' }
-```
-
-# methods
-
-``` js
-var parseArgs = require('minimist')
-```
-
-## var argv = parseArgs(args, opts={})
-
-Return an argument object `argv` populated with the array arguments from `args`.
-
-`argv._` contains all the arguments that didn't have an option associated with
-them.
-
-Numeric-looking arguments will be returned as numbers unless `opts.string` or
-`opts.boolean` is set for that argument name.
-
-Any arguments after `'--'` will not be parsed and will end up in `argv._`.
-
-options can be:
-
-* `opts.string` - a string or array of strings argument names to always treat as
-strings
-* `opts.boolean` - a boolean, string or array of strings to always treat as
-booleans. if `true` will treat all double hyphenated arguments without equal signs
-as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
-* `opts.alias` - an object mapping string names to strings or arrays of string
-argument names to use as aliases
-* `opts.default` - an object mapping string argument names to default values
-* `opts.stopEarly` - when true, populate `argv._` with everything after the
-first non-option
-* `opts['--']` - when true, populate `argv._` with everything before the `--`
-and `argv['--']` with everything after the `--`. Here's an example:
-* `opts.unknown` - a function which is invoked with a command line parameter not
-defined in the `opts` configuration object. If the function returns `false`, the
-unknown option is not added to `argv`.
-
-```
-> require('./')('one two three -- four five --six'.split(' '), { '--': true })
-{ _: [ 'one', 'two', 'three' ],
-  '--': [ 'four', 'five', '--six' ] }
-```
-
-Note that with `opts['--']` set, parsing for arguments still stops after the
-`--`.
-
-# install
-
-With [npm](https://npmjs.org) do:
-
-```
-npm install minimist
-```
-
-# license
-
-MIT
diff --git a/legacy-libs/grpc/node_modules/minimist/test/all_bool.js b/legacy-libs/grpc/node_modules/minimist/test/all_bool.js
deleted file mode 100644 (file)
index ac83548..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('flag boolean true (default all --args to boolean)', function (t) {
-    var argv = parse(['moo', '--honk', 'cow'], {
-        boolean: true
-    });
-    
-    t.deepEqual(argv, {
-        honk: true,
-        _: ['moo', 'cow']
-    });
-    
-    t.deepEqual(typeof argv.honk, 'boolean');
-    t.end();
-});
-
-test('flag boolean true only affects double hyphen arguments without equals signs', function (t) {
-    var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
-        boolean: true
-    });
-    
-    t.deepEqual(argv, {
-        honk: true,
-        tacos: 'good',
-        p: 55,
-        _: ['moo', 'cow']
-    });
-    
-    t.deepEqual(typeof argv.honk, 'boolean');
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/bool.js b/legacy-libs/grpc/node_modules/minimist/test/bool.js
deleted file mode 100644 (file)
index 14b0717..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('flag boolean default false', function (t) {
-    var argv = parse(['moo'], {
-        boolean: ['t', 'verbose'],
-        default: { verbose: false, t: false }
-    });
-    
-    t.deepEqual(argv, {
-        verbose: false,
-        t: false,
-        _: ['moo']
-    });
-    
-    t.deepEqual(typeof argv.verbose, 'boolean');
-    t.deepEqual(typeof argv.t, 'boolean');
-    t.end();
-
-});
-
-test('boolean groups', function (t) {
-    var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
-        boolean: ['x','y','z']
-    });
-    
-    t.deepEqual(argv, {
-        x : true,
-        y : false,
-        z : true,
-        _ : [ 'one', 'two', 'three' ]
-    });
-    
-    t.deepEqual(typeof argv.x, 'boolean');
-    t.deepEqual(typeof argv.y, 'boolean');
-    t.deepEqual(typeof argv.z, 'boolean');
-    t.end();
-});
-test('boolean and alias with chainable api', function (t) {
-    var aliased = [ '-h', 'derp' ];
-    var regular = [ '--herp',  'derp' ];
-    var opts = {
-        herp: { alias: 'h', boolean: true }
-    };
-    var aliasedArgv = parse(aliased, {
-        boolean: 'herp',
-        alias: { h: 'herp' }
-    });
-    var propertyArgv = parse(regular, {
-        boolean: 'herp',
-        alias: { h: 'herp' }
-    });
-    var expected = {
-        herp: true,
-        h: true,
-        '_': [ 'derp' ]
-    };
-    
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected); 
-    t.end();
-});
-
-test('boolean and alias with options hash', function (t) {
-    var aliased = [ '-h', 'derp' ];
-    var regular = [ '--herp', 'derp' ];
-    var opts = {
-        alias: { 'h': 'herp' },
-        boolean: 'herp'
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-    var expected = {
-        herp: true,
-        h: true,
-        '_': [ 'derp' ]
-    };
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected);
-    t.end();
-});
-
-test('boolean and alias array with options hash', function (t) {
-    var aliased = [ '-h', 'derp' ];
-    var regular = [ '--herp', 'derp' ];
-    var alt = [ '--harp', 'derp' ];
-    var opts = {
-        alias: { 'h': ['herp', 'harp'] },
-        boolean: 'h'
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-    var altPropertyArgv = parse(alt, opts);
-    var expected = {
-        harp: true,
-        herp: true,
-        h: true,
-        '_': [ 'derp' ]
-    };
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected);
-    t.same(altPropertyArgv, expected);
-    t.end();
-});
-
-test('boolean and alias using explicit true', function (t) {
-    var aliased = [ '-h', 'true' ];
-    var regular = [ '--herp',  'true' ];
-    var opts = {
-        alias: { h: 'herp' },
-        boolean: 'h'
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-    var expected = {
-        herp: true,
-        h: true,
-        '_': [ ]
-    };
-
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected); 
-    t.end();
-});
-
-// regression, see https://github.com/substack/node-optimist/issues/71
-test('boolean and --x=true', function(t) {
-    var parsed = parse(['--boool', '--other=true'], {
-        boolean: 'boool'
-    });
-
-    t.same(parsed.boool, true);
-    t.same(parsed.other, 'true');
-
-    parsed = parse(['--boool', '--other=false'], {
-        boolean: 'boool'
-    });
-    
-    t.same(parsed.boool, true);
-    t.same(parsed.other, 'false');
-    t.end();
-});
-
-test('boolean --boool=true', function (t) {
-    var parsed = parse(['--boool=true'], {
-        default: {
-            boool: false
-        },
-        boolean: ['boool']
-    });
-
-    t.same(parsed.boool, true);
-    t.end();
-});
-
-test('boolean --boool=false', function (t) {
-    var parsed = parse(['--boool=false'], {
-        default: {
-          boool: true
-        },
-        boolean: ['boool']
-    });
-
-    t.same(parsed.boool, false);
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/dash.js b/legacy-libs/grpc/node_modules/minimist/test/dash.js
deleted file mode 100644 (file)
index 5a4fa5b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('-', function (t) {
-    t.plan(5);
-    t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
-    t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
-    t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
-    t.deepEqual(
-        parse([ '-b', '-' ], { boolean: 'b' }),
-        { b: true, _: [ '-' ] }
-    );
-    t.deepEqual(
-        parse([ '-s', '-' ], { string: 's' }),
-        { s: '-', _: [] }
-    );
-});
-
-test('-a -- b', function (t) {
-    t.plan(3);
-    t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-    t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-    t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-});
-
-test('move arguments after the -- into their own `--` array', function(t) {
-    t.plan(1);
-    t.deepEqual(
-        parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
-        { name: 'John', _: [ 'before' ], '--': [ 'after' ] });
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/default_bool.js b/legacy-libs/grpc/node_modules/minimist/test/default_bool.js
deleted file mode 100644 (file)
index 780a311..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-var test = require('tape');
-var parse = require('../');
-
-test('boolean default true', function (t) {
-    var argv = parse([], {
-        boolean: 'sometrue',
-        default: { sometrue: true }
-    });
-    t.equal(argv.sometrue, true);
-    t.end();
-});
-
-test('boolean default false', function (t) {
-    var argv = parse([], {
-        boolean: 'somefalse',
-        default: { somefalse: false }
-    });
-    t.equal(argv.somefalse, false);
-    t.end();
-});
-
-test('boolean default to null', function (t) {
-    var argv = parse([], {
-        boolean: 'maybe',
-        default: { maybe: null }
-    });
-    t.equal(argv.maybe, null);
-    var argv = parse(['--maybe'], {
-        boolean: 'maybe',
-        default: { maybe: null }
-    });
-    t.equal(argv.maybe, true);
-    t.end();
-
-})
diff --git a/legacy-libs/grpc/node_modules/minimist/test/dotted.js b/legacy-libs/grpc/node_modules/minimist/test/dotted.js
deleted file mode 100644 (file)
index d8b3e85..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('dotted alias', function (t) {
-    var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
-    t.equal(argv.a.b, 22);
-    t.equal(argv.aa.bb, 22);
-    t.end();
-});
-
-test('dotted default', function (t) {
-    var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
-    t.equal(argv.a.b, 11);
-    t.equal(argv.aa.bb, 11);
-    t.end();
-});
-
-test('dotted default with no alias', function (t) {
-    var argv = parse('', {default: {'a.b': 11}});
-    t.equal(argv.a.b, 11);
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/kv_short.js b/legacy-libs/grpc/node_modules/minimist/test/kv_short.js
deleted file mode 100644 (file)
index f813b30..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('short -k=v' , function (t) {
-    t.plan(1);
-    
-    var argv = parse([ '-b=123' ]);
-    t.deepEqual(argv, { b: 123, _: [] });
-});
-
-test('multi short -k=v' , function (t) {
-    t.plan(1);
-    
-    var argv = parse([ '-a=whatever', '-b=robots' ]);
-    t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] });
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/long.js b/legacy-libs/grpc/node_modules/minimist/test/long.js
deleted file mode 100644 (file)
index 5d3a1e0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-var test = require('tape');
-var parse = require('../');
-
-test('long opts', function (t) {
-    t.deepEqual(
-        parse([ '--bool' ]),
-        { bool : true, _ : [] },
-        'long boolean'
-    );
-    t.deepEqual(
-        parse([ '--pow', 'xixxle' ]),
-        { pow : 'xixxle', _ : [] },
-        'long capture sp'
-    );
-    t.deepEqual(
-        parse([ '--pow=xixxle' ]),
-        { pow : 'xixxle', _ : [] },
-        'long capture eq'
-    );
-    t.deepEqual(
-        parse([ '--host', 'localhost', '--port', '555' ]),
-        { host : 'localhost', port : 555, _ : [] },
-        'long captures sp'
-    );
-    t.deepEqual(
-        parse([ '--host=localhost', '--port=555' ]),
-        { host : 'localhost', port : 555, _ : [] },
-        'long captures eq'
-    );
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/num.js b/legacy-libs/grpc/node_modules/minimist/test/num.js
deleted file mode 100644 (file)
index 2cc77f4..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('nums', function (t) {
-    var argv = parse([
-        '-x', '1234',
-        '-y', '5.67',
-        '-z', '1e7',
-        '-w', '10f',
-        '--hex', '0xdeadbeef',
-        '789'
-    ]);
-    t.deepEqual(argv, {
-        x : 1234,
-        y : 5.67,
-        z : 1e7,
-        w : '10f',
-        hex : 0xdeadbeef,
-        _ : [ 789 ]
-    });
-    t.deepEqual(typeof argv.x, 'number');
-    t.deepEqual(typeof argv.y, 'number');
-    t.deepEqual(typeof argv.z, 'number');
-    t.deepEqual(typeof argv.w, 'string');
-    t.deepEqual(typeof argv.hex, 'number');
-    t.deepEqual(typeof argv._[0], 'number');
-    t.end();
-});
-
-test('already a number', function (t) {
-    var argv = parse([ '-x', 1234, 789 ]);
-    t.deepEqual(argv, { x : 1234, _ : [ 789 ] });
-    t.deepEqual(typeof argv.x, 'number');
-    t.deepEqual(typeof argv._[0], 'number');
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/parse.js b/legacy-libs/grpc/node_modules/minimist/test/parse.js
deleted file mode 100644 (file)
index 7b4a2a1..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('parse args', function (t) {
-    t.deepEqual(
-        parse([ '--no-moo' ]),
-        { moo : false, _ : [] },
-        'no'
-    );
-    t.deepEqual(
-        parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
-        { v : ['a','b','c'], _ : [] },
-        'multi'
-    );
-    t.end();
-});
-test('comprehensive', function (t) {
-    t.deepEqual(
-        parse([
-            '--name=meowmers', 'bare', '-cats', 'woo',
-            '-h', 'awesome', '--multi=quux',
-            '--key', 'value',
-            '-b', '--bool', '--no-meep', '--multi=baz',
-            '--', '--not-a-flag', 'eek'
-        ]),
-        {
-            c : true,
-            a : true,
-            t : true,
-            s : 'woo',
-            h : 'awesome',
-            b : true,
-            bool : true,
-            key : 'value',
-            multi : [ 'quux', 'baz' ],
-            meep : false,
-            name : 'meowmers',
-            _ : [ 'bare', '--not-a-flag', 'eek' ]
-        }
-    );
-    t.end();
-});
-
-test('flag boolean', function (t) {
-    var argv = parse([ '-t', 'moo' ], { boolean: 't' });
-    t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
-    t.deepEqual(typeof argv.t, 'boolean');
-    t.end();
-});
-
-test('flag boolean value', function (t) {
-    var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
-        boolean: [ 't', 'verbose' ],
-        default: { verbose: true }
-    });
-    
-    t.deepEqual(argv, {
-        verbose: false,
-        t: true,
-        _: ['moo']
-    });
-    
-    t.deepEqual(typeof argv.verbose, 'boolean');
-    t.deepEqual(typeof argv.t, 'boolean');
-    t.end();
-});
-
-test('newlines in params' , function (t) {
-    var args = parse([ '-s', "X\nX" ])
-    t.deepEqual(args, { _ : [], s : "X\nX" });
-    
-    // reproduce in bash:
-    // VALUE="new
-    // line"
-    // node program.js --s="$VALUE"
-    args = parse([ "--s=X\nX" ])
-    t.deepEqual(args, { _ : [], s : "X\nX" });
-    t.end();
-});
-
-test('strings' , function (t) {
-    var s = parse([ '-s', '0001234' ], { string: 's' }).s;
-    t.equal(s, '0001234');
-    t.equal(typeof s, 'string');
-    
-    var x = parse([ '-x', '56' ], { string: 'x' }).x;
-    t.equal(x, '56');
-    t.equal(typeof x, 'string');
-    t.end();
-});
-
-test('stringArgs', function (t) {
-    var s = parse([ '  ', '  ' ], { string: '_' })._;
-    t.same(s.length, 2);
-    t.same(typeof s[0], 'string');
-    t.same(s[0], '  ');
-    t.same(typeof s[1], 'string');
-    t.same(s[1], '  ');
-    t.end();
-});
-
-test('empty strings', function(t) {
-    var s = parse([ '-s' ], { string: 's' }).s;
-    t.equal(s, '');
-    t.equal(typeof s, 'string');
-
-    var str = parse([ '--str' ], { string: 'str' }).str;
-    t.equal(str, '');
-    t.equal(typeof str, 'string');
-
-    var letters = parse([ '-art' ], {
-        string: [ 'a', 't' ]
-    });
-
-    t.equal(letters.a, '');
-    t.equal(letters.r, true);
-    t.equal(letters.t, '');
-
-    t.end();
-});
-
-
-test('string and alias', function(t) {
-    var x = parse([ '--str',  '000123' ], {
-        string: 's',
-        alias: { s: 'str' }
-    });
-
-    t.equal(x.str, '000123');
-    t.equal(typeof x.str, 'string');
-    t.equal(x.s, '000123');
-    t.equal(typeof x.s, 'string');
-
-    var y = parse([ '-s',  '000123' ], {
-        string: 'str',
-        alias: { str: 's' }
-    });
-
-    t.equal(y.str, '000123');
-    t.equal(typeof y.str, 'string');
-    t.equal(y.s, '000123');
-    t.equal(typeof y.s, 'string');
-    t.end();
-});
-
-test('slashBreak', function (t) {
-    t.same(
-        parse([ '-I/foo/bar/baz' ]),
-        { I : '/foo/bar/baz', _ : [] }
-    );
-    t.same(
-        parse([ '-xyz/foo/bar/baz' ]),
-        { x : true, y : true, z : '/foo/bar/baz', _ : [] }
-    );
-    t.end();
-});
-
-test('alias', function (t) {
-    var argv = parse([ '-f', '11', '--zoom', '55' ], {
-        alias: { z: 'zoom' }
-    });
-    t.equal(argv.zoom, 55);
-    t.equal(argv.z, argv.zoom);
-    t.equal(argv.f, 11);
-    t.end();
-});
-
-test('multiAlias', function (t) {
-    var argv = parse([ '-f', '11', '--zoom', '55' ], {
-        alias: { z: [ 'zm', 'zoom' ] }
-    });
-    t.equal(argv.zoom, 55);
-    t.equal(argv.z, argv.zoom);
-    t.equal(argv.z, argv.zm);
-    t.equal(argv.f, 11);
-    t.end();
-});
-
-test('nested dotted objects', function (t) {
-    var argv = parse([
-        '--foo.bar', '3', '--foo.baz', '4',
-        '--foo.quux.quibble', '5', '--foo.quux.o_O',
-        '--beep.boop'
-    ]);
-    
-    t.same(argv.foo, {
-        bar : 3,
-        baz : 4,
-        quux : {
-            quibble : 5,
-            o_O : true
-        }
-    });
-    t.same(argv.beep, { boop : true });
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/parse_modified.js b/legacy-libs/grpc/node_modules/minimist/test/parse_modified.js
deleted file mode 100644 (file)
index ab620dc..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('parse with modifier functions' , function (t) {
-    t.plan(1);
-    
-    var argv = parse([ '-b', '123' ], { boolean: 'b' });
-    t.deepEqual(argv, { b: true, _: [123] });
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/short.js b/legacy-libs/grpc/node_modules/minimist/test/short.js
deleted file mode 100644 (file)
index d513a1c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('numeric short args', function (t) {
-    t.plan(2);
-    t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
-    t.deepEqual(
-        parse([ '-123', '456' ]),
-        { 1: true, 2: true, 3: 456, _: [] }
-    );
-});
-
-test('short', function (t) {
-    t.deepEqual(
-        parse([ '-b' ]),
-        { b : true, _ : [] },
-        'short boolean'
-    );
-    t.deepEqual(
-        parse([ 'foo', 'bar', 'baz' ]),
-        { _ : [ 'foo', 'bar', 'baz' ] },
-        'bare'
-    );
-    t.deepEqual(
-        parse([ '-cats' ]),
-        { c : true, a : true, t : true, s : true, _ : [] },
-        'group'
-    );
-    t.deepEqual(
-        parse([ '-cats', 'meow' ]),
-        { c : true, a : true, t : true, s : 'meow', _ : [] },
-        'short group next'
-    );
-    t.deepEqual(
-        parse([ '-h', 'localhost' ]),
-        { h : 'localhost', _ : [] },
-        'short capture'
-    );
-    t.deepEqual(
-        parse([ '-h', 'localhost', '-p', '555' ]),
-        { h : 'localhost', p : 555, _ : [] },
-        'short captures'
-    );
-    t.end();
-});
-test('mixed short bool and capture', function (t) {
-    t.same(
-        parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
-        {
-            f : true, p : 555, h : 'localhost',
-            _ : [ 'script.js' ]
-        }
-    );
-    t.end();
-});
-test('short and long', function (t) {
-    t.deepEqual(
-        parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
-        {
-            f : true, p : 555, h : 'localhost',
-            _ : [ 'script.js' ]
-        }
-    );
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/stop_early.js b/legacy-libs/grpc/node_modules/minimist/test/stop_early.js
deleted file mode 100644 (file)
index bdf9fbc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('stops parsing on the first non-option when stopEarly is set', function (t) {
-    var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], {
-        stopEarly: true
-    });
-
-    t.deepEqual(argv, {
-        aaa: 'bbb',
-        _: ['ccc', '--ddd']
-    });
-
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/unknown.js b/legacy-libs/grpc/node_modules/minimist/test/unknown.js
deleted file mode 100644 (file)
index 462a36b..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('boolean and alias is not unknown', function (t) {
-    var unknown = [];
-    function unknownFn(arg) {
-        unknown.push(arg);
-        return false;
-    }
-    var aliased = [ '-h', 'true', '--derp', 'true' ];
-    var regular = [ '--herp',  'true', '-d', 'true' ];
-    var opts = {
-        alias: { h: 'herp' },
-        boolean: 'h',
-        unknown: unknownFn
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-
-    t.same(unknown, ['--derp', '-d']);
-    t.end();
-});
-
-test('flag boolean true any double hyphen argument is not unknown', function (t) {
-    var unknown = [];
-    function unknownFn(arg) {
-        unknown.push(arg);
-        return false;
-    }
-    var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], {
-        boolean: true,
-        unknown: unknownFn
-    });
-    t.same(unknown, ['--tacos=good', 'cow', '-p']);
-    t.same(argv, {
-        honk: true,
-        _: []
-    });
-    t.end();
-});
-
-test('string and alias is not unknown', function (t) {
-    var unknown = [];
-    function unknownFn(arg) {
-        unknown.push(arg);
-        return false;
-    }
-    var aliased = [ '-h', 'hello', '--derp', 'goodbye' ];
-    var regular = [ '--herp',  'hello', '-d', 'moon' ];
-    var opts = {
-        alias: { h: 'herp' },
-        string: 'h',
-        unknown: unknownFn
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-
-    t.same(unknown, ['--derp', '-d']);
-    t.end();
-});
-
-test('default and alias is not unknown', function (t) {
-    var unknown = [];
-    function unknownFn(arg) {
-        unknown.push(arg);
-        return false;
-    }
-    var aliased = [ '-h', 'hello' ];
-    var regular = [ '--herp',  'hello' ];
-    var opts = {
-        default: { 'h': 'bar' },
-        alias: { 'h': 'herp' },
-        unknown: unknownFn
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-
-    t.same(unknown, []);
-    t.end();
-    unknownFn(); // exercise fn for 100% coverage
-});
-
-test('value following -- is not unknown', function (t) {
-    var unknown = [];
-    function unknownFn(arg) {
-        unknown.push(arg);
-        return false;
-    }
-    var aliased = [ '--bad', '--', 'good', 'arg' ];
-    var opts = {
-        '--': true,
-        unknown: unknownFn
-    };
-    var argv = parse(aliased, opts);
-
-    t.same(unknown, ['--bad']);
-    t.same(argv, {
-        '--': ['good', 'arg'],
-        '_': []
-    })
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/minimist/test/whitespace.js b/legacy-libs/grpc/node_modules/minimist/test/whitespace.js
deleted file mode 100644 (file)
index 8a52a58..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('whitespace should be whitespace' , function (t) {
-    t.plan(1);
-    var x = parse([ '-x', '\t' ]).x;
-    t.equal(x, '\t');
-});
diff --git a/legacy-libs/grpc/node_modules/minipass/LICENSE b/legacy-libs/grpc/node_modules/minipass/LICENSE
deleted file mode 100644 (file)
index 20a4762..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) npm, Inc. and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/minipass/README.md b/legacy-libs/grpc/node_modules/minipass/README.md
deleted file mode 100644 (file)
index 7a83c59..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-# minipass
-
-A _very_ minimal implementation of a [PassThrough
-stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough)
-
-[It's very
-fast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0)
-for objects, strings, and buffers.
-
-Supports pipe()ing (including multi-pipe() and backpressure
-transmission), buffering data until either a `data` event handler or
-`pipe()` is added (so you don't lose the first chunk), and most other
-cases where PassThrough is a good idea.
-
-There is a `read()` method, but it's much more efficient to consume
-data from this stream via `'data'` events or by calling `pipe()` into
-some other stream.  Calling `read()` requires the buffer to be
-flattened in some cases, which requires copying memory.
-
-There is also no `unpipe()` method.  Once you start piping, there is
-no stopping it!
-
-If you set `objectMode: true` in the options, then whatever is written
-will be emitted.  Otherwise, it'll do a minimal amount of Buffer
-copying to ensure proper Streams semantics when `read(n)` is called.
-
-This is not a `through` or `through2` stream.  It doesn't transform
-the data, it just passes it right through.  If you want to transform
-the data, extend the class, and override the `write()` method.  Once
-you're done transforming the data however you want, call
-`super.write()` with the transform output.
-
-For an example of a stream that extends MiniPass to provide transform
-capabilities, check out [minizlib](http://npm.im/minizlib).
-
-## USAGE
-
-```js
-const MiniPass = require('minipass')
-const mp = new MiniPass(options) // optional: { encoding }
-mp.write('foo')
-mp.pipe(someOtherStream)
-mp.end('bar')
-```
-
-### collecting
-
-```js
-mp.collect().then(all => {
-  // all is an array of all the data emitted
-  // encoding is supported in this case, so
-  // so the result will be a collection of strings if
-  // an encoding is specified, or buffers/objects if not.
-  //
-  // In an async function, you may do
-  // const data = await stream.collect()
-})
-```
-
-### iteration
-
-You can iterate over streams synchronously or asynchronously in
-platforms that support it.
-
-Synchronous iteration will end when the currently available data is
-consumed, even if the `end` event has not been reached.  In string and
-buffer mode, the data is concatenated, so unless multiple writes are
-occurring in the same tick as the `read()`, sync iteration loops will
-generally only have a single iteration.
-
-To consume chunks in this way exactly as they have been written, with
-no flattening, create the stream with the `{ objectMode: true }`
-option.
-
-```js
-const mp = new Minipass({ objectMode: true })
-mp.write('a')
-mp.write('b')
-for (let letter of mp) {
-  console.log(letter) // a, b
-}
-mp.write('c')
-mp.write('d')
-for (let letter of mp) {
-  console.log(letter) // c, d
-}
-mp.write('e')
-mp.end()
-for (let letter of mp) {
-  console.log(letter) // e
-}
-for (let letter of mp) {
-  console.log(letter) // nothing
-}
-```
-
-Asynchronous iteration will continue until the end event is reached,
-consuming all of the data.
-
-```js
-const mp = new Minipass({ encoding: 'utf8' })
-
-// some source of some data
-let i = 5
-const inter = setInterval(() => {
-  if (i --> 0)
-    mp.write(Buffer.from('foo\n', 'utf8'))
-  else {
-    mp.end()
-    clearInterval(inter)
-  }
-}, 100)
-
-// consume the data with asynchronous iteration
-async function consume () {
-  for await (let chunk of mp) {
-    console.log(chunk)
-  }
-  return 'ok'
-}
-
-consume().then(res => console.log(res))
-// logs `foo\n` 5 times, and then `ok`
-```
diff --git a/legacy-libs/grpc/node_modules/minipass/index.js b/legacy-libs/grpc/node_modules/minipass/index.js
deleted file mode 100644 (file)
index de472c3..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-'use strict'
-const EE = require('events')
-const Yallist = require('yallist')
-const EOF = Symbol('EOF')
-const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
-const EMITTED_END = Symbol('emittedEnd')
-const CLOSED = Symbol('closed')
-const READ = Symbol('read')
-const FLUSH = Symbol('flush')
-const doIter = process.env._MP_NO_ITERATOR_SYMBOLS_  !== '1'
-const ASYNCITERATOR = doIter && Symbol.asyncIterator || Symbol('asyncIterator not implemented')
-const ITERATOR = doIter && Symbol.iterator || Symbol('iterator not implemented')
-const FLUSHCHUNK = Symbol('flushChunk')
-const SD = require('string_decoder').StringDecoder
-const ENCODING = Symbol('encoding')
-const DECODER = Symbol('decoder')
-const FLOWING = Symbol('flowing')
-const RESUME = Symbol('resume')
-const BUFFERLENGTH = Symbol('bufferLength')
-const BUFFERPUSH = Symbol('bufferPush')
-const BUFFERSHIFT = Symbol('bufferShift')
-const OBJECTMODE = Symbol('objectMode')
-
-// Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from
-// or Buffer.alloc, and Buffer in node 10 deprecated the ctor.
-// .M, this is fine .\^/M..
-let B = Buffer
-/* istanbul ignore next */
-if (!B.alloc) {
-  B = require('safe-buffer').Buffer
-}
-
-module.exports = class MiniPass extends EE {
-  constructor (options) {
-    super()
-    this[FLOWING] = false
-    this.pipes = new Yallist()
-    this.buffer = new Yallist()
-    this[OBJECTMODE] = options && options.objectMode || false
-    if (this[OBJECTMODE])
-      this[ENCODING] = null
-    else
-      this[ENCODING] = options && options.encoding || null
-    if (this[ENCODING] === 'buffer')
-      this[ENCODING] = null
-    this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
-    this[EOF] = false
-    this[EMITTED_END] = false
-    this[CLOSED] = false
-    this.writable = true
-    this.readable = true
-    this[BUFFERLENGTH] = 0
-  }
-
-  get bufferLength () { return this[BUFFERLENGTH] }
-
-  get encoding () { return this[ENCODING] }
-  set encoding (enc) {
-    if (this[OBJECTMODE])
-      throw new Error('cannot set encoding in objectMode')
-
-    if (this[ENCODING] && enc !== this[ENCODING] &&
-        (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))
-      throw new Error('cannot change encoding')
-
-    if (this[ENCODING] !== enc) {
-      this[DECODER] = enc ? new SD(enc) : null
-      if (this.buffer.length)
-        this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))
-    }
-
-    this[ENCODING] = enc
-  }
-
-  setEncoding (enc) {
-    this.encoding = enc
-  }
-
-  write (chunk, encoding, cb) {
-    if (this[EOF])
-      throw new Error('write after end')
-
-    if (typeof encoding === 'function')
-      cb = encoding, encoding = 'utf8'
-
-    if (!encoding)
-      encoding = 'utf8'
-
-    // fast-path writing strings of same encoding to a stream with
-    // an empty buffer, skipping the buffer/decoder dance
-    if (typeof chunk === 'string' && !this[OBJECTMODE] &&
-        // unless it is a string already ready for us to use
-        !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
-      chunk = B.from(chunk, encoding)
-    }
-
-    if (B.isBuffer(chunk) && this[ENCODING])
-      chunk = this[DECODER].write(chunk)
-
-    try {
-      return this.flowing
-        ? (this.emit('data', chunk), this.flowing)
-        : (this[BUFFERPUSH](chunk), false)
-    } finally {
-      this.emit('readable')
-      if (cb)
-        cb()
-    }
-  }
-
-  read (n) {
-    try {
-      if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH])
-        return null
-
-      if (this[OBJECTMODE])
-        n = null
-
-      if (this.buffer.length > 1 && !this[OBJECTMODE]) {
-        if (this.encoding)
-          this.buffer = new Yallist([
-            Array.from(this.buffer).join('')
-          ])
-        else
-          this.buffer = new Yallist([
-            B.concat(Array.from(this.buffer), this[BUFFERLENGTH])
-          ])
-      }
-
-      return this[READ](n || null, this.buffer.head.value)
-    } finally {
-      this[MAYBE_EMIT_END]()
-    }
-  }
-
-  [READ] (n, chunk) {
-    if (n === chunk.length || n === null)
-      this[BUFFERSHIFT]()
-    else {
-      this.buffer.head.value = chunk.slice(n)
-      chunk = chunk.slice(0, n)
-      this[BUFFERLENGTH] -= n
-    }
-
-    this.emit('data', chunk)
-
-    if (!this.buffer.length && !this[EOF])
-      this.emit('drain')
-
-    return chunk
-  }
-
-  end (chunk, encoding, cb) {
-    if (typeof chunk === 'function')
-      cb = chunk, chunk = null
-    if (typeof encoding === 'function')
-      cb = encoding, encoding = 'utf8'
-    if (chunk)
-      this.write(chunk, encoding)
-    if (cb)
-      this.once('end', cb)
-    this[EOF] = true
-    this.writable = false
-    if (this.flowing)
-      this[MAYBE_EMIT_END]()
-  }
-
-  // don't let the internal resume be overwritten
-  [RESUME] () {
-    this[FLOWING] = true
-    this.emit('resume')
-    if (this.buffer.length)
-      this[FLUSH]()
-    else if (this[EOF])
-      this[MAYBE_EMIT_END]()
-    else
-      this.emit('drain')
-  }
-
-  resume () {
-    return this[RESUME]()
-  }
-
-  pause () {
-    this[FLOWING] = false
-  }
-
-  get flowing () {
-    return this[FLOWING]
-  }
-
-  [BUFFERPUSH] (chunk) {
-    if (this[OBJECTMODE])
-      this[BUFFERLENGTH] += 1
-    else
-      this[BUFFERLENGTH] += chunk.length
-    return this.buffer.push(chunk)
-  }
-
-  [BUFFERSHIFT] () {
-    if (this.buffer.length) {
-      if (this[OBJECTMODE])
-        this[BUFFERLENGTH] -= 1
-      else
-        this[BUFFERLENGTH] -= this.buffer.head.value.length
-    }
-    return this.buffer.shift()
-  }
-
-  [FLUSH] () {
-    do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
-
-    if (!this.buffer.length && !this[EOF])
-      this.emit('drain')
-  }
-
-  [FLUSHCHUNK] (chunk) {
-    return chunk ? (this.emit('data', chunk), this.flowing) : false
-  }
-
-  pipe (dest, opts) {
-    if (dest === process.stdout || dest === process.stderr)
-      (opts = opts || {}).end = false
-    const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() }
-    this.pipes.push(p)
-
-    dest.on('drain', p.ondrain)
-    this[RESUME]()
-    return dest
-  }
-
-  addListener (ev, fn) {
-    return this.on(ev, fn)
-  }
-
-  on (ev, fn) {
-    try {
-      return super.on(ev, fn)
-    } finally {
-      if (ev === 'data' && !this.pipes.length && !this.flowing)
-        this[RESUME]()
-      else if (ev === 'end' && this[EMITTED_END]) {
-        super.emit('end')
-        this.removeAllListeners('end')
-      }
-    }
-  }
-
-  get emittedEnd () {
-    return this[EMITTED_END]
-  }
-
-  [MAYBE_EMIT_END] () {
-    if (!this[EMITTED_END] && this.buffer.length === 0 && this[EOF]) {
-      this.emit('end')
-      this.emit('prefinish')
-      this.emit('finish')
-      if (this[CLOSED])
-        this.emit('close')
-    }
-  }
-
-  emit (ev, data) {
-    if (ev === 'data') {
-      if (!data)
-        return
-
-      if (this.pipes.length)
-        this.pipes.forEach(p => p.dest.write(data) || this.pause())
-    } else if (ev === 'end') {
-      if (this[EMITTED_END] === true)
-        return
-
-      this[EMITTED_END] = true
-      this.readable = false
-
-      if (this[DECODER]) {
-        data = this[DECODER].end()
-        if (data) {
-          this.pipes.forEach(p => p.dest.write(data))
-          super.emit('data', data)
-        }
-      }
-
-      this.pipes.forEach(p => {
-        p.dest.removeListener('drain', p.ondrain)
-        if (!p.opts || p.opts.end !== false)
-          p.dest.end()
-      })
-    } else if (ev === 'close') {
-      this[CLOSED] = true
-      // don't emit close before 'end' and 'finish'
-      if (!this[EMITTED_END])
-        return
-    }
-
-    const args = new Array(arguments.length)
-    args[0] = ev
-    args[1] = data
-    if (arguments.length > 2) {
-      for (let i = 2; i < arguments.length; i++) {
-        args[i] = arguments[i]
-      }
-    }
-
-    try {
-      return super.emit.apply(this, args)
-    } finally {
-      if (ev !== 'end')
-        this[MAYBE_EMIT_END]()
-      else
-        this.removeAllListeners('end')
-    }
-  }
-
-  // const all = await stream.collect()
-  collect () {
-    return new Promise((resolve, reject) => {
-      const buf = []
-      this.on('data', c => buf.push(c))
-      this.on('end', () => resolve(buf))
-      this.on('error', reject)
-    })
-  }
-
-  // for await (let chunk of stream)
-  [ASYNCITERATOR] () {
-    const next = () => {
-      const res = this.read()
-      if (res !== null)
-        return Promise.resolve({ done: false, value: res })
-
-      if (this[EOF])
-        return Promise.resolve({ done: true })
-
-      let resolve = null
-      let reject = null
-      const onerr = er => {
-        this.removeListener('data', ondata)
-        this.removeListener('end', onend)
-        reject(er)
-      }
-      const ondata = value => {
-        this.removeListener('error', onerr)
-        this.removeListener('end', onend)
-        this.pause()
-        resolve({ value: value, done: !!this[EOF] })
-      }
-      const onend = () => {
-        this.removeListener('error', onerr)
-        this.removeListener('data', ondata)
-        resolve({ done: true })
-      }
-      return new Promise((res, rej) => {
-        reject = rej
-        resolve = res
-        this.once('error', onerr)
-        this.once('end', onend)
-        this.once('data', ondata)
-      })
-    }
-
-    return { next }
-  }
-
-  // for (let chunk of stream)
-  [ITERATOR] () {
-    const next = () => {
-      const value = this.read()
-      const done = value === null
-      return { value, done }
-    }
-    return { next }
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/minipass/package.json b/legacy-libs/grpc/node_modules/minipass/package.json
deleted file mode 100644 (file)
index 9b68cd6..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-{
-  "_from": "minipass@^2.3.4",
-  "_id": "minipass@2.3.5",
-  "_inBundle": false,
-  "_integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
-  "_location": "/grpc/minipass",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "minipass@^2.3.4",
-    "name": "minipass",
-    "escapedName": "minipass",
-    "rawSpec": "^2.3.4",
-    "saveSpec": null,
-    "fetchSpec": "^2.3.4"
-  },
-  "_requiredBy": [
-    "/grpc/fs-minipass",
-    "/grpc/minizlib",
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz",
-  "_shasum": "cacebe492022497f656b0f0f51e2682a9ed2d848",
-  "_shrinkwrap": null,
-  "_spec": "minipass@^2.3.4",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/minipass/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "safe-buffer": "^5.1.2",
-    "yallist": "^3.0.0"
-  },
-  "deprecated": false,
-  "description": "minimal implementation of a PassThrough stream",
-  "devDependencies": {
-    "end-of-stream": "^1.4.0",
-    "tap": "^12.0.1",
-    "through2": "^2.0.3"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/isaacs/minipass#readme",
-  "keywords": [
-    "passthrough",
-    "stream"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "minipass",
-  "optionalDependencies": {},
-  "readme": "# minipass\n\nA _very_ minimal implementation of a [PassThrough\nstream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough)\n\n[It's very\nfast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0)\nfor objects, strings, and buffers.\n\nSupports pipe()ing (including multi-pipe() and backpressure\ntransmission), buffering data until either a `data` event handler or\n`pipe()` is added (so you don't lose the first chunk), and most other\ncases where PassThrough is a good idea.\n\nThere is a `read()` method, but it's much more efficient to consume\ndata from this stream via `'data'` events or by calling `pipe()` into\nsome other stream.  Calling `read()` requires the buffer to be\nflattened in some cases, which requires copying memory.\n\nThere is also no `unpipe()` method.  Once you start piping, there is\nno stopping it!\n\nIf you set `objectMode: true` in the options, then whatever is written\nwill be emitted.  Otherwise, it'll do a minimal amount of Buffer\ncopying to ensure proper Streams semantics when `read(n)` is called.\n\nThis is not a `through` or `through2` stream.  It doesn't transform\nthe data, it just passes it right through.  If you want to transform\nthe data, extend the class, and override the `write()` method.  Once\nyou're done transforming the data however you want, call\n`super.write()` with the transform output.\n\nFor an example of a stream that extends MiniPass to provide transform\ncapabilities, check out [minizlib](http://npm.im/minizlib).\n\n## USAGE\n\n```js\nconst MiniPass = require('minipass')\nconst mp = new MiniPass(options) // optional: { encoding }\nmp.write('foo')\nmp.pipe(someOtherStream)\nmp.end('bar')\n```\n\n### collecting\n\n```js\nmp.collect().then(all => {\n  // all is an array of all the data emitted\n  // encoding is supported in this case, so\n  // so the result will be a collection of strings if\n  // an encoding is specified, or buffers/objects if not.\n  //\n  // In an async function, you may do\n  // const data = await stream.collect()\n})\n```\n\n### iteration\n\nYou can iterate over streams synchronously or asynchronously in\nplatforms that support it.\n\nSynchronous iteration will end when the currently available data is\nconsumed, even if the `end` event has not been reached.  In string and\nbuffer mode, the data is concatenated, so unless multiple writes are\noccurring in the same tick as the `read()`, sync iteration loops will\ngenerally only have a single iteration.\n\nTo consume chunks in this way exactly as they have been written, with\nno flattening, create the stream with the `{ objectMode: true }`\noption.\n\n```js\nconst mp = new Minipass({ objectMode: true })\nmp.write('a')\nmp.write('b')\nfor (let letter of mp) {\n  console.log(letter) // a, b\n}\nmp.write('c')\nmp.write('d')\nfor (let letter of mp) {\n  console.log(letter) // c, d\n}\nmp.write('e')\nmp.end()\nfor (let letter of mp) {\n  console.log(letter) // e\n}\nfor (let letter of mp) {\n  console.log(letter) // nothing\n}\n```\n\nAsynchronous iteration will continue until the end event is reached,\nconsuming all of the data.\n\n```js\nconst mp = new Minipass({ encoding: 'utf8' })\n\n// some source of some data\nlet i = 5\nconst inter = setInterval(() => {\n  if (i --> 0)\n    mp.write(Buffer.from('foo\\n', 'utf8'))\n  else {\n    mp.end()\n    clearInterval(inter)\n  }\n}, 100)\n\n// consume the data with asynchronous iteration\nasync function consume () {\n  for await (let chunk of mp) {\n    console.log(chunk)\n  }\n  return 'ok'\n}\n\nconsume().then(res => console.log(res))\n// logs `foo\\n` 5 times, and then `ok`\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/isaacs/minipass.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --100"
-  },
-  "version": "2.3.5"
-}
diff --git a/legacy-libs/grpc/node_modules/minizlib/LICENSE b/legacy-libs/grpc/node_modules/minizlib/LICENSE
deleted file mode 100644 (file)
index ffce738..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Minizlib was created by Isaac Z. Schlueter.
-It is a derivative work of the Node.js project.
-
-"""
-Copyright Isaac Z. Schlueter and Contributors
-Copyright Node.js contributors. All rights reserved.
-Copyright Joyent, Inc. and other Node contributors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-"""
diff --git a/legacy-libs/grpc/node_modules/minizlib/README.md b/legacy-libs/grpc/node_modules/minizlib/README.md
deleted file mode 100644 (file)
index 2b58554..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# minizlib
-
-A tiny fast zlib stream built on [minipass](http://npm.im/minipass)
-and Node.js's zlib binding.
-
-This module was created to serve the needs of
-[node-tar](http://npm.im/tar) v2.  If your needs are different, then
-it may not be for you.
-
-## How does this differ from the streams in `require('zlib')`?
-
-First, there are no convenience methods to compress or decompress a
-buffer.  If you want those, use the built-in `zlib` module.  This is
-only streams.
-
-This module compresses and decompresses the data as fast as you feed
-it in.  It is synchronous, and runs on the main process thread.  Zlib
-operations can be high CPU, but they're very fast, and doing it this
-way means much less bookkeeping and artificial deferral.
-
-Node's built in zlib streams are built on top of `stream.Transform`.
-They do the maximally safe thing with respect to consistent
-asynchrony, buffering, and backpressure.
-
-This module _does_ support backpressure, and will buffer output chunks
-that are not consumed, but is less of a mediator between the input and
-output.  There is no high or low watermarks, no state objects, and so
-artificial async deferrals.  It will not protect you from Zalgo.
-
-If you write, data will be emitted right away.  If you write
-everything synchronously in one tick, and you are listening to the
-`data` event to consume it, then it'll all be emitted right away in
-that same tick.  If you want data to be emitted in the next tick, then
-write it in the next tick.
-
-It is thus the responsibility of the reader and writer to manage their
-own consumption and process execution flow.
-
-The goal is to compress and decompress as fast as possible, even for
-files that are too large to store all in one buffer.
-
-The API is very similar to the built-in zlib module.  There are
-classes that you instantiate with `new` and they are streams that can
-be piped together.
diff --git a/legacy-libs/grpc/node_modules/minizlib/constants.js b/legacy-libs/grpc/node_modules/minizlib/constants.js
deleted file mode 100644 (file)
index 4edffde..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-module.exports = Object.freeze({
-  Z_NO_FLUSH: 0,
-  Z_PARTIAL_FLUSH: 1,
-  Z_SYNC_FLUSH: 2,
-  Z_FULL_FLUSH: 3,
-  Z_FINISH: 4,
-  Z_BLOCK: 5,
-  Z_OK: 0,
-  Z_STREAM_END: 1,
-  Z_NEED_DICT: 2,
-  Z_ERRNO: -1,
-  Z_STREAM_ERROR: -2,
-  Z_DATA_ERROR: -3,
-  Z_MEM_ERROR: -4,
-  Z_BUF_ERROR: -5,
-  Z_VERSION_ERROR: -6,
-  Z_NO_COMPRESSION: 0,
-  Z_BEST_SPEED: 1,
-  Z_BEST_COMPRESSION: 9,
-  Z_DEFAULT_COMPRESSION: -1,
-  Z_FILTERED: 1,
-  Z_HUFFMAN_ONLY: 2,
-  Z_RLE: 3,
-  Z_FIXED: 4,
-  Z_DEFAULT_STRATEGY: 0,
-  ZLIB_VERNUM: 4736,
-  DEFLATE: 1,
-  INFLATE: 2,
-  GZIP: 3,
-  GUNZIP: 4,
-  DEFLATERAW: 5,
-  INFLATERAW: 6,
-  UNZIP: 7,
-  Z_MIN_WINDOWBITS: 8,
-  Z_MAX_WINDOWBITS: 15,
-  Z_DEFAULT_WINDOWBITS: 15,
-  Z_MIN_CHUNK: 64,
-  Z_MAX_CHUNK: Infinity,
-  Z_DEFAULT_CHUNK: 16384,
-  Z_MIN_MEMLEVEL: 1,
-  Z_MAX_MEMLEVEL: 9,
-  Z_DEFAULT_MEMLEVEL: 8,
-  Z_MIN_LEVEL: -1,
-  Z_MAX_LEVEL: 9,
-  Z_DEFAULT_LEVEL: -1
-})
diff --git a/legacy-libs/grpc/node_modules/minizlib/index.js b/legacy-libs/grpc/node_modules/minizlib/index.js
deleted file mode 100644 (file)
index df48696..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-'use strict'
-
-const assert = require('assert')
-const Buffer = require('buffer').Buffer
-const realZlib = require('zlib')
-
-const constants = exports.constants = require('./constants.js')
-const MiniPass = require('minipass')
-
-const OriginalBufferConcat = Buffer.concat
-
-class ZlibError extends Error {
-  constructor (msg, errno) {
-    super('zlib: ' + msg)
-    this.errno = errno
-    this.code = codes.get(errno)
-  }
-
-  get name () {
-    return 'ZlibError'
-  }
-}
-
-// translation table for return codes.
-const codes = new Map([
-  [constants.Z_OK, 'Z_OK'],
-  [constants.Z_STREAM_END, 'Z_STREAM_END'],
-  [constants.Z_NEED_DICT, 'Z_NEED_DICT'],
-  [constants.Z_ERRNO, 'Z_ERRNO'],
-  [constants.Z_STREAM_ERROR, 'Z_STREAM_ERROR'],
-  [constants.Z_DATA_ERROR, 'Z_DATA_ERROR'],
-  [constants.Z_MEM_ERROR, 'Z_MEM_ERROR'],
-  [constants.Z_BUF_ERROR, 'Z_BUF_ERROR'],
-  [constants.Z_VERSION_ERROR, 'Z_VERSION_ERROR']
-])
-
-const validFlushFlags = new Set([
-  constants.Z_NO_FLUSH,
-  constants.Z_PARTIAL_FLUSH,
-  constants.Z_SYNC_FLUSH,
-  constants.Z_FULL_FLUSH,
-  constants.Z_FINISH,
-  constants.Z_BLOCK
-])
-
-const strategies = new Set([
-  constants.Z_FILTERED,
-  constants.Z_HUFFMAN_ONLY,
-  constants.Z_RLE,
-  constants.Z_FIXED,
-  constants.Z_DEFAULT_STRATEGY
-])
-
-// the Zlib class they all inherit from
-// This thing manages the queue of requests, and returns
-// true or false if there is anything in the queue when
-// you call the .write() method.
-const _opts = Symbol('opts')
-const _flushFlag = Symbol('flushFlag')
-const _finishFlush = Symbol('finishFlush')
-const _handle = Symbol('handle')
-const _onError = Symbol('onError')
-const _level = Symbol('level')
-const _strategy = Symbol('strategy')
-const _ended = Symbol('ended')
-
-class Zlib extends MiniPass {
-  constructor (opts, mode) {
-    super(opts)
-    this[_ended] = false
-    this[_opts] = opts = opts || {}
-    if (opts.flush && !validFlushFlags.has(opts.flush)) {
-      throw new TypeError('Invalid flush flag: ' + opts.flush)
-    }
-    if (opts.finishFlush && !validFlushFlags.has(opts.finishFlush)) {
-      throw new TypeError('Invalid flush flag: ' + opts.finishFlush)
-    }
-
-    this[_flushFlag] = opts.flush || constants.Z_NO_FLUSH
-    this[_finishFlush] = typeof opts.finishFlush !== 'undefined' ?
-      opts.finishFlush : constants.Z_FINISH
-
-    if (opts.chunkSize) {
-      if (opts.chunkSize < constants.Z_MIN_CHUNK) {
-        throw new RangeError('Invalid chunk size: ' + opts.chunkSize)
-      }
-    }
-
-    if (opts.windowBits) {
-      if (opts.windowBits < constants.Z_MIN_WINDOWBITS ||
-          opts.windowBits > constants.Z_MAX_WINDOWBITS) {
-        throw new RangeError('Invalid windowBits: ' + opts.windowBits)
-      }
-    }
-
-    if (opts.level) {
-      if (opts.level < constants.Z_MIN_LEVEL ||
-          opts.level > constants.Z_MAX_LEVEL) {
-        throw new RangeError('Invalid compression level: ' + opts.level)
-      }
-    }
-
-    if (opts.memLevel) {
-      if (opts.memLevel < constants.Z_MIN_MEMLEVEL ||
-          opts.memLevel > constants.Z_MAX_MEMLEVEL) {
-        throw new RangeError('Invalid memLevel: ' + opts.memLevel)
-      }
-    }
-
-    if (opts.strategy && !(strategies.has(opts.strategy)))
-      throw new TypeError('Invalid strategy: ' + opts.strategy)
-
-    if (opts.dictionary) {
-      if (!(opts.dictionary instanceof Buffer)) {
-        throw new TypeError('Invalid dictionary: it should be a Buffer instance')
-      }
-    }
-
-    this[_handle] = new realZlib[mode](opts)
-
-    this[_onError] = (err) => {
-      // there is no way to cleanly recover.
-      // continuing only obscures problems.
-      this.close()
-
-      const error = new ZlibError(err.message, err.errno)
-      this.emit('error', error)
-    }
-    this[_handle].on('error', this[_onError])
-
-    const level = typeof opts.level === 'number' ? opts.level
-                : constants.Z_DEFAULT_COMPRESSION
-
-    var strategy = typeof opts.strategy === 'number' ? opts.strategy
-                 : constants.Z_DEFAULT_STRATEGY
-
-    // API changed in node v9
-    /* istanbul ignore next */
-
-    this[_level] = level
-    this[_strategy] = strategy
-
-    this.once('end', this.close)
-  }
-
-  close () {
-    if (this[_handle]) {
-      this[_handle].close()
-      this[_handle] = null
-      this.emit('close')
-    }
-  }
-
-  params (level, strategy) {
-    if (!this[_handle])
-      throw new Error('cannot switch params when binding is closed')
-
-    // no way to test this without also not supporting params at all
-    /* istanbul ignore if */
-    if (!this[_handle].params)
-      throw new Error('not supported in this implementation')
-
-    if (level < constants.Z_MIN_LEVEL ||
-        level > constants.Z_MAX_LEVEL) {
-      throw new RangeError('Invalid compression level: ' + level)
-    }
-
-    if (!(strategies.has(strategy)))
-      throw new TypeError('Invalid strategy: ' + strategy)
-
-    if (this[_level] !== level || this[_strategy] !== strategy) {
-      this.flush(constants.Z_SYNC_FLUSH)
-      assert(this[_handle], 'zlib binding closed')
-      // .params() calls .flush(), but the latter is always async in the
-      // core zlib. We override .flush() temporarily to intercept that and
-      // flush synchronously.
-      const origFlush = this[_handle].flush
-      this[_handle].flush = (flushFlag, cb) => {
-        this[_handle].flush = origFlush
-        this.flush(flushFlag)
-        cb()
-      }
-      this[_handle].params(level, strategy)
-      /* istanbul ignore else */
-      if (this[_handle]) {
-        this[_level] = level
-        this[_strategy] = strategy
-      }
-    }
-  }
-
-  reset () {
-    assert(this[_handle], 'zlib binding closed')
-    return this[_handle].reset()
-  }
-
-  flush (kind) {
-    if (kind === undefined)
-      kind = constants.Z_FULL_FLUSH
-
-    if (this.ended)
-      return
-
-    const flushFlag = this[_flushFlag]
-    this[_flushFlag] = kind
-    this.write(Buffer.alloc(0))
-    this[_flushFlag] = flushFlag
-  }
-
-  end (chunk, encoding, cb) {
-    if (chunk)
-      this.write(chunk, encoding)
-    this.flush(this[_finishFlush])
-    this[_ended] = true
-    return super.end(null, null, cb)
-  }
-
-  get ended () {
-    return this[_ended]
-  }
-
-  write (chunk, encoding, cb) {
-    // process the chunk using the sync process
-    // then super.write() all the outputted chunks
-    if (typeof encoding === 'function')
-      cb = encoding, encoding = 'utf8'
-
-    if (typeof chunk === 'string')
-      chunk = Buffer.from(chunk, encoding)
-
-    assert(this[_handle], 'zlib binding closed')
-
-    // _processChunk tries to .close() the native handle after it's done, so we
-    // intercept that by temporarily making it a no-op.
-    const nativeHandle = this[_handle]._handle
-    const originalNativeClose = nativeHandle.close
-    nativeHandle.close = () => {}
-    const originalClose = this[_handle].close
-    this[_handle].close = () => {}
-    // It also calls `Buffer.concat()` at the end, which may be convenient
-    // for some, but which we are not interested in as it slows us down.
-    Buffer.concat = (args) => args
-    let result
-    try {
-      result = this[_handle]._processChunk(chunk, this[_flushFlag])
-    } catch (err) {
-      this[_onError](err)
-    } finally {
-      Buffer.concat = OriginalBufferConcat
-      if (this[_handle]) {
-        // Core zlib resets `_handle` to null after attempting to close the
-        // native handle. Our no-op handler prevented actual closure, but we
-        // need to restore the `._handle` property.
-        this[_handle]._handle = nativeHandle
-        nativeHandle.close = originalNativeClose
-        this[_handle].close = originalClose
-        // `_processChunk()` adds an 'error' listener. If we don't remove it
-        // after each call, these handlers start piling up.
-        this[_handle].removeAllListeners('error')
-      }
-    }
-
-    let writeReturn
-    if (result) {
-      if (Array.isArray(result) && result.length > 0) {
-        // The first buffer is always `handle._outBuffer`, which would be
-        // re-used for later invocations; so, we always have to copy that one.
-        writeReturn = super.write(Buffer.from(result[0]))
-        for (let i = 1; i < result.length; i++) {
-          writeReturn = super.write(result[i])
-        }
-      } else {
-        writeReturn = super.write(Buffer.from(result))
-      }
-    }
-
-    if (cb)
-      cb()
-    return writeReturn
-  }
-}
-
-// minimal 2-byte header
-class Deflate extends Zlib {
-  constructor (opts) {
-    super(opts, 'Deflate')
-  }
-}
-
-class Inflate extends Zlib {
-  constructor (opts) {
-    super(opts, 'Inflate')
-  }
-}
-
-// gzip - bigger header, same deflate compression
-class Gzip extends Zlib {
-  constructor (opts) {
-    super(opts, 'Gzip')
-  }
-}
-
-class Gunzip extends Zlib {
-  constructor (opts) {
-    super(opts, 'Gunzip')
-  }
-}
-
-// raw - no header
-class DeflateRaw extends Zlib {
-  constructor (opts) {
-    super(opts, 'DeflateRaw')
-  }
-}
-
-class InflateRaw extends Zlib {
-  constructor (opts) {
-    super(opts, 'InflateRaw')
-  }
-}
-
-// auto-detect header.
-class Unzip extends Zlib {
-  constructor (opts) {
-    super(opts, 'Unzip')
-  }
-}
-
-exports.Deflate = Deflate
-exports.Inflate = Inflate
-exports.Gzip = Gzip
-exports.Gunzip = Gunzip
-exports.DeflateRaw = DeflateRaw
-exports.InflateRaw = InflateRaw
-exports.Unzip = Unzip
diff --git a/legacy-libs/grpc/node_modules/minizlib/package.json b/legacy-libs/grpc/node_modules/minizlib/package.json
deleted file mode 100644 (file)
index f5919ae..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-{
-  "_from": "minizlib@^1.1.1",
-  "_id": "minizlib@1.2.1",
-  "_inBundle": false,
-  "_integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
-  "_location": "/grpc/minizlib",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "minizlib@^1.1.1",
-    "name": "minizlib",
-    "escapedName": "minizlib",
-    "rawSpec": "^1.1.1",
-    "saveSpec": null,
-    "fetchSpec": "^1.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
-  "_shasum": "dd27ea6136243c7c880684e8672bb3a45fd9b614",
-  "_shrinkwrap": null,
-  "_spec": "minizlib@^1.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/minizlib/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "minipass": "^2.2.1"
-  },
-  "deprecated": false,
-  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
-  "devDependencies": {
-    "tap": "^12.0.1"
-  },
-  "files": [
-    "index.js",
-    "constants.js"
-  ],
-  "homepage": "https://github.com/isaacs/minizlib#readme",
-  "keywords": [
-    "zlib",
-    "gzip",
-    "gunzip",
-    "deflate",
-    "inflate",
-    "compression",
-    "zip",
-    "unzip"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "minizlib",
-  "optionalDependencies": {},
-  "readme": "# minizlib\n\nA tiny fast zlib stream built on [minipass](http://npm.im/minipass)\nand Node.js's zlib binding.\n\nThis module was created to serve the needs of\n[node-tar](http://npm.im/tar) v2.  If your needs are different, then\nit may not be for you.\n\n## How does this differ from the streams in `require('zlib')`?\n\nFirst, there are no convenience methods to compress or decompress a\nbuffer.  If you want those, use the built-in `zlib` module.  This is\nonly streams.\n\nThis module compresses and decompresses the data as fast as you feed\nit in.  It is synchronous, and runs on the main process thread.  Zlib\noperations can be high CPU, but they're very fast, and doing it this\nway means much less bookkeeping and artificial deferral.\n\nNode's built in zlib streams are built on top of `stream.Transform`.\nThey do the maximally safe thing with respect to consistent\nasynchrony, buffering, and backpressure.\n\nThis module _does_ support backpressure, and will buffer output chunks\nthat are not consumed, but is less of a mediator between the input and\noutput.  There is no high or low watermarks, no state objects, and so\nartificial async deferrals.  It will not protect you from Zalgo.\n\nIf you write, data will be emitted right away.  If you write\neverything synchronously in one tick, and you are listening to the\n`data` event to consume it, then it'll all be emitted right away in\nthat same tick.  If you want data to be emitted in the next tick, then\nwrite it in the next tick.\n\nIt is thus the responsibility of the reader and writer to manage their\nown consumption and process execution flow.\n\nThe goal is to compress and decompress as fast as possible, even for\nfiles that are too large to store all in one buffer.\n\nThe API is very similar to the built-in zlib module.  There are\nclasses that you instantiate with `new` and they are streams that can\nbe piped together.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/isaacs/minizlib.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --100 -J"
-  },
-  "version": "1.2.1"
-}
diff --git a/legacy-libs/grpc/node_modules/mkdirp/bin/cmd.js b/legacy-libs/grpc/node_modules/mkdirp/bin/cmd.js
deleted file mode 100644 (file)
index d95de15..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env node
-
-var mkdirp = require('../');
-var minimist = require('minimist');
-var fs = require('fs');
-
-var argv = minimist(process.argv.slice(2), {
-    alias: { m: 'mode', h: 'help' },
-    string: [ 'mode' ]
-});
-if (argv.help) {
-    fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout);
-    return;
-}
-
-var paths = argv._.slice();
-var mode = argv.mode ? parseInt(argv.mode, 8) : undefined;
-
-(function next () {
-    if (paths.length === 0) return;
-    var p = paths.shift();
-    
-    if (mode === undefined) mkdirp(p, cb)
-    else mkdirp(p, mode, cb)
-    
-    function cb (err) {
-        if (err) {
-            console.error(err.message);
-            process.exit(1);
-        }
-        else next();
-    }
-})();
diff --git a/legacy-libs/grpc/node_modules/mkdirp/bin/usage.txt b/legacy-libs/grpc/node_modules/mkdirp/bin/usage.txt
deleted file mode 100644 (file)
index f952aa2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-usage: mkdirp [DIR1,DIR2..] {OPTIONS}
-
-  Create each supplied directory including any necessary parent directories that
-  don't yet exist.
-  
-  If the directory already exists, do nothing.
-
-OPTIONS are:
-
-  -m, --mode   If a directory needs to be created, set the mode as an octal
-               permission string.
-
diff --git a/legacy-libs/grpc/node_modules/mkdirp/examples/pow.js b/legacy-libs/grpc/node_modules/mkdirp/examples/pow.js
deleted file mode 100644 (file)
index e692421..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-var mkdirp = require('mkdirp');
-
-mkdirp('/tmp/foo/bar/baz', function (err) {
-    if (err) console.error(err)
-    else console.log('pow!')
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/index.js b/legacy-libs/grpc/node_modules/mkdirp/index.js
deleted file mode 100644 (file)
index 6ce241b..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-var path = require('path');
-var fs = require('fs');
-var _0777 = parseInt('0777', 8);
-
-module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
-
-function mkdirP (p, opts, f, made) {
-    if (typeof opts === 'function') {
-        f = opts;
-        opts = {};
-    }
-    else if (!opts || typeof opts !== 'object') {
-        opts = { mode: opts };
-    }
-    
-    var mode = opts.mode;
-    var xfs = opts.fs || fs;
-    
-    if (mode === undefined) {
-        mode = _0777 & (~process.umask());
-    }
-    if (!made) made = null;
-    
-    var cb = f || function () {};
-    p = path.resolve(p);
-    
-    xfs.mkdir(p, mode, function (er) {
-        if (!er) {
-            made = made || p;
-            return cb(null, made);
-        }
-        switch (er.code) {
-            case 'ENOENT':
-                mkdirP(path.dirname(p), opts, function (er, made) {
-                    if (er) cb(er, made);
-                    else mkdirP(p, opts, cb, made);
-                });
-                break;
-
-            // In the case of any other error, just see if there's a dir
-            // there already.  If so, then hooray!  If not, then something
-            // is borked.
-            default:
-                xfs.stat(p, function (er2, stat) {
-                    // if the stat fails, then that's super weird.
-                    // let the original error be the failure reason.
-                    if (er2 || !stat.isDirectory()) cb(er, made)
-                    else cb(null, made);
-                });
-                break;
-        }
-    });
-}
-
-mkdirP.sync = function sync (p, opts, made) {
-    if (!opts || typeof opts !== 'object') {
-        opts = { mode: opts };
-    }
-    
-    var mode = opts.mode;
-    var xfs = opts.fs || fs;
-    
-    if (mode === undefined) {
-        mode = _0777 & (~process.umask());
-    }
-    if (!made) made = null;
-
-    p = path.resolve(p);
-
-    try {
-        xfs.mkdirSync(p, mode);
-        made = made || p;
-    }
-    catch (err0) {
-        switch (err0.code) {
-            case 'ENOENT' :
-                made = sync(path.dirname(p), opts, made);
-                sync(p, opts, made);
-                break;
-
-            // In the case of any other error, just see if there's a dir
-            // there already.  If so, then hooray!  If not, then something
-            // is borked.
-            default:
-                var stat;
-                try {
-                    stat = xfs.statSync(p);
-                }
-                catch (err1) {
-                    throw err0;
-                }
-                if (!stat.isDirectory()) throw err0;
-                break;
-        }
-    }
-
-    return made;
-};
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/LICENSE b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/LICENSE
deleted file mode 100644 (file)
index ee27ba4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/example/parse.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/example/parse.js
deleted file mode 100644 (file)
index abff3e8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-var argv = require('../')(process.argv.slice(2));
-console.dir(argv);
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/index.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/index.js
deleted file mode 100644 (file)
index 584f551..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-module.exports = function (args, opts) {
-    if (!opts) opts = {};
-    
-    var flags = { bools : {}, strings : {} };
-    
-    [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
-        flags.bools[key] = true;
-    });
-    
-    [].concat(opts.string).filter(Boolean).forEach(function (key) {
-        flags.strings[key] = true;
-    });
-    
-    var aliases = {};
-    Object.keys(opts.alias || {}).forEach(function (key) {
-        aliases[key] = [].concat(opts.alias[key]);
-        aliases[key].forEach(function (x) {
-            aliases[x] = [key].concat(aliases[key].filter(function (y) {
-                return x !== y;
-            }));
-        });
-    });
-    
-    var defaults = opts['default'] || {};
-    
-    var argv = { _ : [] };
-    Object.keys(flags.bools).forEach(function (key) {
-        setArg(key, defaults[key] === undefined ? false : defaults[key]);
-    });
-    
-    var notFlags = [];
-
-    if (args.indexOf('--') !== -1) {
-        notFlags = args.slice(args.indexOf('--')+1);
-        args = args.slice(0, args.indexOf('--'));
-    }
-
-    function setArg (key, val) {
-        var value = !flags.strings[key] && isNumber(val)
-            ? Number(val) : val
-        ;
-        setKey(argv, key.split('.'), value);
-        
-        (aliases[key] || []).forEach(function (x) {
-            setKey(argv, x.split('.'), value);
-        });
-    }
-    
-    for (var i = 0; i < args.length; i++) {
-        var arg = args[i];
-        
-        if (/^--.+=/.test(arg)) {
-            // Using [\s\S] instead of . because js doesn't support the
-            // 'dotall' regex modifier. See:
-            // http://stackoverflow.com/a/1068308/13216
-            var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
-            setArg(m[1], m[2]);
-        }
-        else if (/^--no-.+/.test(arg)) {
-            var key = arg.match(/^--no-(.+)/)[1];
-            setArg(key, false);
-        }
-        else if (/^--.+/.test(arg)) {
-            var key = arg.match(/^--(.+)/)[1];
-            var next = args[i + 1];
-            if (next !== undefined && !/^-/.test(next)
-            && !flags.bools[key]
-            && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
-                setArg(key, next);
-                i++;
-            }
-            else if (/^(true|false)$/.test(next)) {
-                setArg(key, next === 'true');
-                i++;
-            }
-            else {
-                setArg(key, flags.strings[key] ? '' : true);
-            }
-        }
-        else if (/^-[^-]+/.test(arg)) {
-            var letters = arg.slice(1,-1).split('');
-            
-            var broken = false;
-            for (var j = 0; j < letters.length; j++) {
-                var next = arg.slice(j+2);
-                
-                if (next === '-') {
-                    setArg(letters[j], next)
-                    continue;
-                }
-                
-                if (/[A-Za-z]/.test(letters[j])
-                && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
-                    setArg(letters[j], next);
-                    broken = true;
-                    break;
-                }
-                
-                if (letters[j+1] && letters[j+1].match(/\W/)) {
-                    setArg(letters[j], arg.slice(j+2));
-                    broken = true;
-                    break;
-                }
-                else {
-                    setArg(letters[j], flags.strings[letters[j]] ? '' : true);
-                }
-            }
-            
-            var key = arg.slice(-1)[0];
-            if (!broken && key !== '-') {
-                if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
-                && !flags.bools[key]
-                && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
-                    setArg(key, args[i+1]);
-                    i++;
-                }
-                else if (args[i+1] && /true|false/.test(args[i+1])) {
-                    setArg(key, args[i+1] === 'true');
-                    i++;
-                }
-                else {
-                    setArg(key, flags.strings[key] ? '' : true);
-                }
-            }
-        }
-        else {
-            argv._.push(
-                flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
-            );
-        }
-    }
-    
-    Object.keys(defaults).forEach(function (key) {
-        if (!hasKey(argv, key.split('.'))) {
-            setKey(argv, key.split('.'), defaults[key]);
-            
-            (aliases[key] || []).forEach(function (x) {
-                setKey(argv, x.split('.'), defaults[key]);
-            });
-        }
-    });
-    
-    notFlags.forEach(function(key) {
-        argv._.push(key);
-    });
-
-    return argv;
-};
-
-function hasKey (obj, keys) {
-    var o = obj;
-    keys.slice(0,-1).forEach(function (key) {
-        o = (o[key] || {});
-    });
-
-    var key = keys[keys.length - 1];
-    return key in o;
-}
-
-function setKey (obj, keys, value) {
-    var o = obj;
-    keys.slice(0,-1).forEach(function (key) {
-        if (o[key] === undefined) o[key] = {};
-        o = o[key];
-    });
-    
-    var key = keys[keys.length - 1];
-    if (o[key] === undefined || typeof o[key] === 'boolean') {
-        o[key] = value;
-    }
-    else if (Array.isArray(o[key])) {
-        o[key].push(value);
-    }
-    else {
-        o[key] = [ o[key], value ];
-    }
-}
-
-function isNumber (x) {
-    if (typeof x === 'number') return true;
-    if (/^0x[0-9a-f]+$/i.test(x)) return true;
-    return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
-}
-
-function longest (xs) {
-    return Math.max.apply(null, xs.map(function (x) { return x.length }));
-}
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/package.json b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/package.json
deleted file mode 100644 (file)
index f59f73a..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-{
-  "_args": [
-    [
-      "minimist@0.0.8",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "minimist@0.0.8",
-  "_id": "minimist@0.0.8",
-  "_inBundle": false,
-  "_integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
-  "_location": "/grpc/mkdirp/minimist",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "minimist@0.0.8",
-    "name": "minimist",
-    "escapedName": "minimist",
-    "rawSpec": "0.0.8",
-    "saveSpec": null,
-    "fetchSpec": "0.0.8"
-  },
-  "_requiredBy": [
-    "/grpc/mkdirp"
-  ],
-  "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
-  "_shrinkwrap": null,
-  "_spec": "0.0.8",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "James Halliday",
-    "email": "mail@substack.net",
-    "url": "http://substack.net"
-  },
-  "bugs": {
-    "url": "https://github.com/substack/minimist/issues"
-  },
-  "dependencies": {},
-  "description": "parse argument options",
-  "devDependencies": {
-    "tap": "~0.4.0",
-    "tape": "~1.0.4"
-  },
-  "homepage": "https://github.com/substack/minimist",
-  "keywords": [
-    "argv",
-    "getopt",
-    "parser",
-    "optimist"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "minimist",
-  "optionalDependencies": {},
-  "readme": "# minimist\n\nparse argument options\n\nThis module is the guts of optimist's argument parser without all the\nfanciful decoration.\n\n[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)\n\n[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)\n\n# example\n\n``` js\nvar argv = require('minimist')(process.argv.slice(2));\nconsole.dir(argv);\n```\n\n```\n$ node example/parse.js -a beep -b boop\n{ _: [], a: 'beep', b: 'boop' }\n```\n\n```\n$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz\n{ _: [ 'foo', 'bar', 'baz' ],\n  x: 3,\n  y: 4,\n  n: 5,\n  a: true,\n  b: true,\n  c: true,\n  beep: 'boop' }\n```\n\n# methods\n\n``` js\nvar parseArgs = require('minimist')\n```\n\n## var argv = parseArgs(args, opts={})\n\nReturn an argument object `argv` populated with the array arguments from `args`.\n\n`argv._` contains all the arguments that didn't have an option associated with\nthem.\n\nNumeric-looking arguments will be returned as numbers unless `opts.string` or\n`opts.boolean` is set for that argument name.\n\nAny arguments after `'--'` will not be parsed and will end up in `argv._`.\n\noptions can be:\n\n* `opts.string` - a string or array of strings argument names to always treat as\nstrings\n* `opts.boolean` - a string or array of strings to always treat as booleans\n* `opts.alias` - an object mapping string names to strings or arrays of string\nargument names to use as aliases\n* `opts.default` - an object mapping string argument names to default values\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install minimist\n```\n\n# license\n\nMIT\n",
-  "readmeFilename": "readme.markdown",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/substack/minimist.git"
-  },
-  "scripts": {
-    "test": "tap test/*.js"
-  },
-  "testling": {
-    "files": "test/*.js",
-    "browsers": [
-      "ie/6..latest",
-      "ff/5",
-      "firefox/latest",
-      "chrome/10",
-      "chrome/latest",
-      "safari/5.1",
-      "safari/latest",
-      "opera/12"
-    ]
-  },
-  "version": "0.0.8"
-}
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/readme.markdown b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/readme.markdown
deleted file mode 100644 (file)
index c256353..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# minimist
-
-parse argument options
-
-This module is the guts of optimist's argument parser without all the
-fanciful decoration.
-
-[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)
-
-[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)
-
-# example
-
-``` js
-var argv = require('minimist')(process.argv.slice(2));
-console.dir(argv);
-```
-
-```
-$ node example/parse.js -a beep -b boop
-{ _: [], a: 'beep', b: 'boop' }
-```
-
-```
-$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
-{ _: [ 'foo', 'bar', 'baz' ],
-  x: 3,
-  y: 4,
-  n: 5,
-  a: true,
-  b: true,
-  c: true,
-  beep: 'boop' }
-```
-
-# methods
-
-``` js
-var parseArgs = require('minimist')
-```
-
-## var argv = parseArgs(args, opts={})
-
-Return an argument object `argv` populated with the array arguments from `args`.
-
-`argv._` contains all the arguments that didn't have an option associated with
-them.
-
-Numeric-looking arguments will be returned as numbers unless `opts.string` or
-`opts.boolean` is set for that argument name.
-
-Any arguments after `'--'` will not be parsed and will end up in `argv._`.
-
-options can be:
-
-* `opts.string` - a string or array of strings argument names to always treat as
-strings
-* `opts.boolean` - a string or array of strings to always treat as booleans
-* `opts.alias` - an object mapping string names to strings or arrays of string
-argument names to use as aliases
-* `opts.default` - an object mapping string argument names to default values
-
-# install
-
-With [npm](https://npmjs.org) do:
-
-```
-npm install minimist
-```
-
-# license
-
-MIT
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dash.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dash.js
deleted file mode 100644 (file)
index 8b034b9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('-', function (t) {
-    t.plan(5);
-    t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
-    t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
-    t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
-    t.deepEqual(
-        parse([ '-b', '-' ], { boolean: 'b' }),
-        { b: true, _: [ '-' ] }
-    );
-    t.deepEqual(
-        parse([ '-s', '-' ], { string: 's' }),
-        { s: '-', _: [] }
-    );
-});
-
-test('-a -- b', function (t) {
-    t.plan(3);
-    t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-    t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-    t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/default_bool.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/default_bool.js
deleted file mode 100644 (file)
index f0041ee..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-var test = require('tape');
-var parse = require('../');
-
-test('boolean default true', function (t) {
-    var argv = parse([], {
-        boolean: 'sometrue',
-        default: { sometrue: true }
-    });
-    t.equal(argv.sometrue, true);
-    t.end();
-});
-
-test('boolean default false', function (t) {
-    var argv = parse([], {
-        boolean: 'somefalse',
-        default: { somefalse: false }
-    });
-    t.equal(argv.somefalse, false);
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dotted.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/dotted.js
deleted file mode 100644 (file)
index ef0ae34..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('dotted alias', function (t) {
-    var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
-    t.equal(argv.a.b, 22);
-    t.equal(argv.aa.bb, 22);
-    t.end();
-});
-
-test('dotted default', function (t) {
-    var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
-    t.equal(argv.a.b, 11);
-    t.equal(argv.aa.bb, 11);
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/long.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/long.js
deleted file mode 100644 (file)
index 5d3a1e0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-var test = require('tape');
-var parse = require('../');
-
-test('long opts', function (t) {
-    t.deepEqual(
-        parse([ '--bool' ]),
-        { bool : true, _ : [] },
-        'long boolean'
-    );
-    t.deepEqual(
-        parse([ '--pow', 'xixxle' ]),
-        { pow : 'xixxle', _ : [] },
-        'long capture sp'
-    );
-    t.deepEqual(
-        parse([ '--pow=xixxle' ]),
-        { pow : 'xixxle', _ : [] },
-        'long capture eq'
-    );
-    t.deepEqual(
-        parse([ '--host', 'localhost', '--port', '555' ]),
-        { host : 'localhost', port : 555, _ : [] },
-        'long captures sp'
-    );
-    t.deepEqual(
-        parse([ '--host=localhost', '--port=555' ]),
-        { host : 'localhost', port : 555, _ : [] },
-        'long captures eq'
-    );
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse.js
deleted file mode 100644 (file)
index 8a90646..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('parse args', function (t) {
-    t.deepEqual(
-        parse([ '--no-moo' ]),
-        { moo : false, _ : [] },
-        'no'
-    );
-    t.deepEqual(
-        parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
-        { v : ['a','b','c'], _ : [] },
-        'multi'
-    );
-    t.end();
-});
-test('comprehensive', function (t) {
-    t.deepEqual(
-        parse([
-            '--name=meowmers', 'bare', '-cats', 'woo',
-            '-h', 'awesome', '--multi=quux',
-            '--key', 'value',
-            '-b', '--bool', '--no-meep', '--multi=baz',
-            '--', '--not-a-flag', 'eek'
-        ]),
-        {
-            c : true,
-            a : true,
-            t : true,
-            s : 'woo',
-            h : 'awesome',
-            b : true,
-            bool : true,
-            key : 'value',
-            multi : [ 'quux', 'baz' ],
-            meep : false,
-            name : 'meowmers',
-            _ : [ 'bare', '--not-a-flag', 'eek' ]
-        }
-    );
-    t.end();
-});
-
-test('nums', function (t) {
-    var argv = parse([
-        '-x', '1234',
-        '-y', '5.67',
-        '-z', '1e7',
-        '-w', '10f',
-        '--hex', '0xdeadbeef',
-        '789'
-    ]);
-    t.deepEqual(argv, {
-        x : 1234,
-        y : 5.67,
-        z : 1e7,
-        w : '10f',
-        hex : 0xdeadbeef,
-        _ : [ 789 ]
-    });
-    t.deepEqual(typeof argv.x, 'number');
-    t.deepEqual(typeof argv.y, 'number');
-    t.deepEqual(typeof argv.z, 'number');
-    t.deepEqual(typeof argv.w, 'string');
-    t.deepEqual(typeof argv.hex, 'number');
-    t.deepEqual(typeof argv._[0], 'number');
-    t.end();
-});
-
-test('flag boolean', function (t) {
-    var argv = parse([ '-t', 'moo' ], { boolean: 't' });
-    t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
-    t.deepEqual(typeof argv.t, 'boolean');
-    t.end();
-});
-
-test('flag boolean value', function (t) {
-    var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
-        boolean: [ 't', 'verbose' ],
-        default: { verbose: true }
-    });
-    
-    t.deepEqual(argv, {
-        verbose: false,
-        t: true,
-        _: ['moo']
-    });
-    
-    t.deepEqual(typeof argv.verbose, 'boolean');
-    t.deepEqual(typeof argv.t, 'boolean');
-    t.end();
-});
-
-test('flag boolean default false', function (t) {
-    var argv = parse(['moo'], {
-        boolean: ['t', 'verbose'],
-        default: { verbose: false, t: false }
-    });
-    
-    t.deepEqual(argv, {
-        verbose: false,
-        t: false,
-        _: ['moo']
-    });
-    
-    t.deepEqual(typeof argv.verbose, 'boolean');
-    t.deepEqual(typeof argv.t, 'boolean');
-    t.end();
-
-});
-
-test('boolean groups', function (t) {
-    var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
-        boolean: ['x','y','z']
-    });
-    
-    t.deepEqual(argv, {
-        x : true,
-        y : false,
-        z : true,
-        _ : [ 'one', 'two', 'three' ]
-    });
-    
-    t.deepEqual(typeof argv.x, 'boolean');
-    t.deepEqual(typeof argv.y, 'boolean');
-    t.deepEqual(typeof argv.z, 'boolean');
-    t.end();
-});
-
-test('newlines in params' , function (t) {
-    var args = parse([ '-s', "X\nX" ])
-    t.deepEqual(args, { _ : [], s : "X\nX" });
-    
-    // reproduce in bash:
-    // VALUE="new
-    // line"
-    // node program.js --s="$VALUE"
-    args = parse([ "--s=X\nX" ])
-    t.deepEqual(args, { _ : [], s : "X\nX" });
-    t.end();
-});
-
-test('strings' , function (t) {
-    var s = parse([ '-s', '0001234' ], { string: 's' }).s;
-    t.equal(s, '0001234');
-    t.equal(typeof s, 'string');
-    
-    var x = parse([ '-x', '56' ], { string: 'x' }).x;
-    t.equal(x, '56');
-    t.equal(typeof x, 'string');
-    t.end();
-});
-
-test('stringArgs', function (t) {
-    var s = parse([ '  ', '  ' ], { string: '_' })._;
-    t.same(s.length, 2);
-    t.same(typeof s[0], 'string');
-    t.same(s[0], '  ');
-    t.same(typeof s[1], 'string');
-    t.same(s[1], '  ');
-    t.end();
-});
-
-test('empty strings', function(t) {
-    var s = parse([ '-s' ], { string: 's' }).s;
-    t.equal(s, '');
-    t.equal(typeof s, 'string');
-
-    var str = parse([ '--str' ], { string: 'str' }).str;
-    t.equal(str, '');
-    t.equal(typeof str, 'string');
-
-    var letters = parse([ '-art' ], {
-        string: [ 'a', 't' ]
-    });
-
-    t.equal(letters.a, '');
-    t.equal(letters.r, true);
-    t.equal(letters.t, '');
-
-    t.end();
-});
-
-
-test('slashBreak', function (t) {
-    t.same(
-        parse([ '-I/foo/bar/baz' ]),
-        { I : '/foo/bar/baz', _ : [] }
-    );
-    t.same(
-        parse([ '-xyz/foo/bar/baz' ]),
-        { x : true, y : true, z : '/foo/bar/baz', _ : [] }
-    );
-    t.end();
-});
-
-test('alias', function (t) {
-    var argv = parse([ '-f', '11', '--zoom', '55' ], {
-        alias: { z: 'zoom' }
-    });
-    t.equal(argv.zoom, 55);
-    t.equal(argv.z, argv.zoom);
-    t.equal(argv.f, 11);
-    t.end();
-});
-
-test('multiAlias', function (t) {
-    var argv = parse([ '-f', '11', '--zoom', '55' ], {
-        alias: { z: [ 'zm', 'zoom' ] }
-    });
-    t.equal(argv.zoom, 55);
-    t.equal(argv.z, argv.zoom);
-    t.equal(argv.z, argv.zm);
-    t.equal(argv.f, 11);
-    t.end();
-});
-
-test('nested dotted objects', function (t) {
-    var argv = parse([
-        '--foo.bar', '3', '--foo.baz', '4',
-        '--foo.quux.quibble', '5', '--foo.quux.o_O',
-        '--beep.boop'
-    ]);
-    
-    t.same(argv.foo, {
-        bar : 3,
-        baz : 4,
-        quux : {
-            quibble : 5,
-            o_O : true
-        }
-    });
-    t.same(argv.beep, { boop : true });
-    t.end();
-});
-
-test('boolean and alias with chainable api', function (t) {
-    var aliased = [ '-h', 'derp' ];
-    var regular = [ '--herp',  'derp' ];
-    var opts = {
-        herp: { alias: 'h', boolean: true }
-    };
-    var aliasedArgv = parse(aliased, {
-        boolean: 'herp',
-        alias: { h: 'herp' }
-    });
-    var propertyArgv = parse(regular, {
-        boolean: 'herp',
-        alias: { h: 'herp' }
-    });
-    var expected = {
-        herp: true,
-        h: true,
-        '_': [ 'derp' ]
-    };
-    
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected); 
-    t.end();
-});
-
-test('boolean and alias with options hash', function (t) {
-    var aliased = [ '-h', 'derp' ];
-    var regular = [ '--herp', 'derp' ];
-    var opts = {
-        alias: { 'h': 'herp' },
-        boolean: 'herp'
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-    var expected = {
-        herp: true,
-        h: true,
-        '_': [ 'derp' ]
-    };
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected);
-    t.end();
-});
-
-test('boolean and alias using explicit true', function (t) {
-    var aliased = [ '-h', 'true' ];
-    var regular = [ '--herp',  'true' ];
-    var opts = {
-        alias: { h: 'herp' },
-        boolean: 'h'
-    };
-    var aliasedArgv = parse(aliased, opts);
-    var propertyArgv = parse(regular, opts);
-    var expected = {
-        herp: true,
-        h: true,
-        '_': [ ]
-    };
-
-    t.same(aliasedArgv, expected);
-    t.same(propertyArgv, expected); 
-    t.end();
-});
-
-// regression, see https://github.com/substack/node-optimist/issues/71
-test('boolean and --x=true', function(t) {
-    var parsed = parse(['--boool', '--other=true'], {
-        boolean: 'boool'
-    });
-
-    t.same(parsed.boool, true);
-    t.same(parsed.other, 'true');
-
-    parsed = parse(['--boool', '--other=false'], {
-        boolean: 'boool'
-    });
-    
-    t.same(parsed.boool, true);
-    t.same(parsed.other, 'false');
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
deleted file mode 100644 (file)
index 21851b0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('parse with modifier functions' , function (t) {
-    t.plan(1);
-    
-    var argv = parse([ '-b', '123' ], { boolean: 'b' });
-    t.deepEqual(argv, { b: true, _: ['123'] });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/short.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/short.js
deleted file mode 100644 (file)
index d513a1c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('numeric short args', function (t) {
-    t.plan(2);
-    t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
-    t.deepEqual(
-        parse([ '-123', '456' ]),
-        { 1: true, 2: true, 3: 456, _: [] }
-    );
-});
-
-test('short', function (t) {
-    t.deepEqual(
-        parse([ '-b' ]),
-        { b : true, _ : [] },
-        'short boolean'
-    );
-    t.deepEqual(
-        parse([ 'foo', 'bar', 'baz' ]),
-        { _ : [ 'foo', 'bar', 'baz' ] },
-        'bare'
-    );
-    t.deepEqual(
-        parse([ '-cats' ]),
-        { c : true, a : true, t : true, s : true, _ : [] },
-        'group'
-    );
-    t.deepEqual(
-        parse([ '-cats', 'meow' ]),
-        { c : true, a : true, t : true, s : 'meow', _ : [] },
-        'short group next'
-    );
-    t.deepEqual(
-        parse([ '-h', 'localhost' ]),
-        { h : 'localhost', _ : [] },
-        'short capture'
-    );
-    t.deepEqual(
-        parse([ '-h', 'localhost', '-p', '555' ]),
-        { h : 'localhost', p : 555, _ : [] },
-        'short captures'
-    );
-    t.end();
-});
-test('mixed short bool and capture', function (t) {
-    t.same(
-        parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
-        {
-            f : true, p : 555, h : 'localhost',
-            _ : [ 'script.js' ]
-        }
-    );
-    t.end();
-});
-test('short and long', function (t) {
-    t.deepEqual(
-        parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
-        {
-            f : true, p : 555, h : 'localhost',
-            _ : [ 'script.js' ]
-        }
-    );
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/whitespace.js b/legacy-libs/grpc/node_modules/mkdirp/node_modules/minimist/test/whitespace.js
deleted file mode 100644 (file)
index 8a52a58..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('whitespace should be whitespace' , function (t) {
-    t.plan(1);
-    var x = parse([ '-x', '\t' ]).x;
-    t.equal(x, '\t');
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/package.json b/legacy-libs/grpc/node_modules/mkdirp/package.json
deleted file mode 100644 (file)
index 779e468..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_args": [
-    [
-      "mkdirp@0.5.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "mkdirp@0.5.1",
-  "_id": "mkdirp@0.5.1",
-  "_inBundle": false,
-  "_integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
-  "_location": "/grpc/mkdirp",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "mkdirp@0.5.1",
-    "name": "mkdirp",
-    "escapedName": "mkdirp",
-    "rawSpec": "0.5.1",
-    "saveSpec": null,
-    "fetchSpec": "0.5.1"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp",
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "0.5.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "James Halliday",
-    "email": "mail@substack.net",
-    "url": "http://substack.net"
-  },
-  "bin": {
-    "mkdirp": "bin/cmd.js"
-  },
-  "bugs": {
-    "url": "https://github.com/substack/node-mkdirp/issues"
-  },
-  "dependencies": {
-    "minimist": "0.0.8"
-  },
-  "description": "Recursively mkdir, like `mkdir -p`",
-  "devDependencies": {
-    "mock-fs": "2 >=2.7.0",
-    "tap": "1"
-  },
-  "homepage": "https://github.com/substack/node-mkdirp#readme",
-  "keywords": [
-    "mkdir",
-    "directory"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "mkdirp",
-  "optionalDependencies": {},
-  "readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n    \nmkdirp('/tmp/foo/bar/baz', function (err) {\n    if (err) console.error(err)\n    else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, opts, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `opts.mode`. If `opts` is a non-object, it will be treated as\nthe `opts.mode`.\n\nIf `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\nYou can optionally pass in an alternate `fs` implementation by passing in\n`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and\n`opts.fs.stat(path, cb)`.\n\n## mkdirp.sync(dir, opts)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `opts.mode`. If `opts` is a non-object, it will be\ntreated as the `opts.mode`.\n\nIf `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\nYou can optionally pass in an alternate `fs` implementation by passing in\n`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and\n`opts.fs.statSync(path)`.\n\n# usage\n\nThis package also ships with a `mkdirp` command.\n\n```\nusage: mkdirp [DIR1,DIR2..] {OPTIONS}\n\n  Create each supplied directory including any necessary parent directories that\n  don't yet exist.\n  \n  If the directory already exists, do nothing.\n\nOPTIONS are:\n\n  -m, --mode   If a directory needs to be created, set the mode as an octal\n               permission string.\n\n```\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\nto get the library, or\n\n```\nnpm install -g mkdirp\n```\n\nto get the command.\n\n# license\n\nMIT\n",
-  "readmeFilename": "readme.markdown",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/substack/node-mkdirp.git"
-  },
-  "scripts": {
-    "test": "tap test/*.js"
-  },
-  "version": "0.5.1"
-}
diff --git a/legacy-libs/grpc/node_modules/mkdirp/readme.markdown b/legacy-libs/grpc/node_modules/mkdirp/readme.markdown
deleted file mode 100644 (file)
index 3cc1315..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-# mkdirp
-
-Like `mkdir -p`, but in node.js!
-
-[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
-
-# example
-
-## pow.js
-
-```js
-var mkdirp = require('mkdirp');
-    
-mkdirp('/tmp/foo/bar/baz', function (err) {
-    if (err) console.error(err)
-    else console.log('pow!')
-});
-```
-
-Output
-
-```
-pow!
-```
-
-And now /tmp/foo/bar/baz exists, huzzah!
-
-# methods
-
-```js
-var mkdirp = require('mkdirp');
-```
-
-## mkdirp(dir, opts, cb)
-
-Create a new directory and any necessary subdirectories at `dir` with octal
-permission string `opts.mode`. If `opts` is a non-object, it will be treated as
-the `opts.mode`.
-
-If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
-
-`cb(err, made)` fires with the error or the first directory `made`
-that had to be created, if any.
-
-You can optionally pass in an alternate `fs` implementation by passing in
-`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and
-`opts.fs.stat(path, cb)`.
-
-## mkdirp.sync(dir, opts)
-
-Synchronously create a new directory and any necessary subdirectories at `dir`
-with octal permission string `opts.mode`. If `opts` is a non-object, it will be
-treated as the `opts.mode`.
-
-If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
-
-Returns the first directory that had to be created, if any.
-
-You can optionally pass in an alternate `fs` implementation by passing in
-`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and
-`opts.fs.statSync(path)`.
-
-# usage
-
-This package also ships with a `mkdirp` command.
-
-```
-usage: mkdirp [DIR1,DIR2..] {OPTIONS}
-
-  Create each supplied directory including any necessary parent directories that
-  don't yet exist.
-  
-  If the directory already exists, do nothing.
-
-OPTIONS are:
-
-  -m, --mode   If a directory needs to be created, set the mode as an octal
-               permission string.
-
-```
-
-# install
-
-With [npm](http://npmjs.org) do:
-
-```
-npm install mkdirp
-```
-
-to get the library, or
-
-```
-npm install -g mkdirp
-```
-
-to get the command.
-
-# license
-
-MIT
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/chmod.js b/legacy-libs/grpc/node_modules/mkdirp/test/chmod.js
deleted file mode 100644 (file)
index 6a404b9..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-var mkdirp = require('../').mkdirp;
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-var _0744 = parseInt('0744', 8);
-
-var ps = [ '', 'tmp' ];
-
-for (var i = 0; i < 25; i++) {
-    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    ps.push(dir);
-}
-
-var file = ps.join('/');
-
-test('chmod-pre', function (t) {
-    var mode = _0744
-    mkdirp(file, mode, function (er) {
-        t.ifError(er, 'should not error');
-        fs.stat(file, function (er, stat) {
-            t.ifError(er, 'should exist');
-            t.ok(stat && stat.isDirectory(), 'should be directory');
-            t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
-            t.end();
-        });
-    });
-});
-
-test('chmod', function (t) {
-    var mode = _0755
-    mkdirp(file, mode, function (er) {
-        t.ifError(er, 'should not error');
-        fs.stat(file, function (er, stat) {
-            t.ifError(er, 'should exist');
-            t.ok(stat && stat.isDirectory(), 'should be directory');
-            t.end();
-        });
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/clobber.js b/legacy-libs/grpc/node_modules/mkdirp/test/clobber.js
deleted file mode 100644 (file)
index 2433b9a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-var mkdirp = require('../').mkdirp;
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-var _0755 = parseInt('0755', 8);
-
-var ps = [ '', 'tmp' ];
-
-for (var i = 0; i < 25; i++) {
-    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    ps.push(dir);
-}
-
-var file = ps.join('/');
-
-// a file in the way
-var itw = ps.slice(0, 3).join('/');
-
-
-test('clobber-pre', function (t) {
-    console.error("about to write to "+itw)
-    fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
-
-    fs.stat(itw, function (er, stat) {
-        t.ifError(er)
-        t.ok(stat && stat.isFile(), 'should be file')
-        t.end()
-    })
-})
-
-test('clobber', function (t) {
-    t.plan(2);
-    mkdirp(file, _0755, function (err) {
-        t.ok(err);
-        t.equal(err.code, 'ENOTDIR');
-        t.end();
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/mkdirp.js b/legacy-libs/grpc/node_modules/mkdirp/test/mkdirp.js
deleted file mode 100644 (file)
index eaa8921..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('woo', function (t) {
-    t.plan(5);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    
-    var file = '/tmp/' + [x,y,z].join('/');
-    
-    mkdirp(file, _0755, function (err) {
-        t.ifError(err);
-        exists(file, function (ex) {
-            t.ok(ex, 'file created');
-            fs.stat(file, function (err, stat) {
-                t.ifError(err);
-                t.equal(stat.mode & _0777, _0755);
-                t.ok(stat.isDirectory(), 'target not a directory');
-            })
-        })
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs.js b/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs.js
deleted file mode 100644 (file)
index 97186b6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var test = require('tap').test;
-var mockfs = require('mock-fs');
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('opts.fs', function (t) {
-    t.plan(5);
-    
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    
-    var file = '/beep/boop/' + [x,y,z].join('/');
-    var xfs = mockfs.fs();
-    
-    mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
-        t.ifError(err);
-        xfs.exists(file, function (ex) {
-            t.ok(ex, 'created file');
-            xfs.stat(file, function (err, stat) {
-                t.ifError(err);
-                t.equal(stat.mode & _0777, _0755);
-                t.ok(stat.isDirectory(), 'target not a directory');
-            });
-        });
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/opts_fs_sync.js
deleted file mode 100644 (file)
index 6c370aa..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var test = require('tap').test;
-var mockfs = require('mock-fs');
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('opts.fs sync', function (t) {
-    t.plan(4);
-    
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    
-    var file = '/beep/boop/' + [x,y,z].join('/');
-    var xfs = mockfs.fs();
-    
-    mkdirp.sync(file, { fs: xfs, mode: _0755 });
-    xfs.exists(file, function (ex) {
-        t.ok(ex, 'created file');
-        xfs.stat(file, function (err, stat) {
-            t.ifError(err);
-            t.equal(stat.mode & _0777, _0755);
-            t.ok(stat.isDirectory(), 'target not a directory');
-        });
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/perm.js b/legacy-libs/grpc/node_modules/mkdirp/test/perm.js
deleted file mode 100644 (file)
index fbce44b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('async perm', function (t) {
-    t.plan(5);
-    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
-    
-    mkdirp(file, _0755, function (err) {
-        t.ifError(err);
-        exists(file, function (ex) {
-            t.ok(ex, 'file created');
-            fs.stat(file, function (err, stat) {
-                t.ifError(err);
-                t.equal(stat.mode & _0777, _0755);
-                t.ok(stat.isDirectory(), 'target not a directory');
-            })
-        })
-    });
-});
-
-test('async root perm', function (t) {
-    mkdirp('/tmp', _0755, function (err) {
-        if (err) t.fail(err);
-        t.end();
-    });
-    t.end();
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/perm_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/perm_sync.js
deleted file mode 100644 (file)
index 398229f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('sync perm', function (t) {
-    t.plan(4);
-    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
-    
-    mkdirp.sync(file, _0755);
-    exists(file, function (ex) {
-        t.ok(ex, 'file created');
-        fs.stat(file, function (err, stat) {
-            t.ifError(err);
-            t.equal(stat.mode & _0777, _0755);
-            t.ok(stat.isDirectory(), 'target not a directory');
-        });
-    });
-});
-
-test('sync root perm', function (t) {
-    t.plan(3);
-    
-    var file = '/tmp';
-    mkdirp.sync(file, _0755);
-    exists(file, function (ex) {
-        t.ok(ex, 'file created');
-        fs.stat(file, function (err, stat) {
-            t.ifError(err);
-            t.ok(stat.isDirectory(), 'target not a directory');
-        })
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/race.js b/legacy-libs/grpc/node_modules/mkdirp/test/race.js
deleted file mode 100644 (file)
index b0b9e18..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-var mkdirp = require('../').mkdirp;
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('race', function (t) {
-    t.plan(10);
-    var ps = [ '', 'tmp' ];
-    
-    for (var i = 0; i < 25; i++) {
-        var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-        ps.push(dir);
-    }
-    var file = ps.join('/');
-    
-    var res = 2;
-    mk(file);
-    
-    mk(file);
-    
-    function mk (file, cb) {
-        mkdirp(file, _0755, function (err) {
-            t.ifError(err);
-            exists(file, function (ex) {
-                t.ok(ex, 'file created');
-                fs.stat(file, function (err, stat) {
-                    t.ifError(err);
-                    t.equal(stat.mode & _0777, _0755);
-                    t.ok(stat.isDirectory(), 'target not a directory');
-                });
-            })
-        });
-    }
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/rel.js b/legacy-libs/grpc/node_modules/mkdirp/test/rel.js
deleted file mode 100644 (file)
index 4ddb342..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('rel', function (t) {
-    t.plan(5);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    
-    var cwd = process.cwd();
-    process.chdir('/tmp');
-    
-    var file = [x,y,z].join('/');
-    
-    mkdirp(file, _0755, function (err) {
-        t.ifError(err);
-        exists(file, function (ex) {
-            t.ok(ex, 'file created');
-            fs.stat(file, function (err, stat) {
-                t.ifError(err);
-                process.chdir(cwd);
-                t.equal(stat.mode & _0777, _0755);
-                t.ok(stat.isDirectory(), 'target not a directory');
-            })
-        })
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/return.js b/legacy-libs/grpc/node_modules/mkdirp/test/return.js
deleted file mode 100644 (file)
index bce68e5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-test('return value', function (t) {
-    t.plan(4);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-
-    var file = '/tmp/' + [x,y,z].join('/');
-
-    // should return the first dir created.
-    // By this point, it would be profoundly surprising if /tmp didn't
-    // already exist, since every other test makes things in there.
-    mkdirp(file, function (err, made) {
-        t.ifError(err);
-        t.equal(made, '/tmp/' + x);
-        mkdirp(file, function (err, made) {
-          t.ifError(err);
-          t.equal(made, null);
-        });
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/return_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/return_sync.js
deleted file mode 100644 (file)
index 7c222d3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-test('return value', function (t) {
-    t.plan(2);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-
-    var file = '/tmp/' + [x,y,z].join('/');
-
-    // should return the first dir created.
-    // By this point, it would be profoundly surprising if /tmp didn't
-    // already exist, since every other test makes things in there.
-    // Note that this will throw on failure, which will fail the test.
-    var made = mkdirp.sync(file);
-    t.equal(made, '/tmp/' + x);
-
-    // making the same file again should have no effect.
-    made = mkdirp.sync(file);
-    t.equal(made, null);
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/root.js b/legacy-libs/grpc/node_modules/mkdirp/test/root.js
deleted file mode 100644 (file)
index 9e7d079..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-var _0755 = parseInt('0755', 8);
-
-test('root', function (t) {
-    // '/' on unix, 'c:/' on windows.
-    var file = path.resolve('/');
-
-    mkdirp(file, _0755, function (err) {
-        if (err) throw err
-        fs.stat(file, function (er, stat) {
-            if (er) throw er
-            t.ok(stat.isDirectory(), 'target is a directory');
-            t.end();
-        })
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/sync.js
deleted file mode 100644 (file)
index 8c8dc93..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('sync', function (t) {
-    t.plan(4);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-
-    var file = '/tmp/' + [x,y,z].join('/');
-
-    try {
-        mkdirp.sync(file, _0755);
-    } catch (err) {
-        t.fail(err);
-        return t.end();
-    }
-
-    exists(file, function (ex) {
-        t.ok(ex, 'file created');
-        fs.stat(file, function (err, stat) {
-            t.ifError(err);
-            t.equal(stat.mode & _0777, _0755);
-            t.ok(stat.isDirectory(), 'target not a directory');
-        });
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/umask.js b/legacy-libs/grpc/node_modules/mkdirp/test/umask.js
deleted file mode 100644 (file)
index 2033c63..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('implicit mode from umask', function (t) {
-    t.plan(5);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    
-    var file = '/tmp/' + [x,y,z].join('/');
-    
-    mkdirp(file, function (err) {
-        t.ifError(err);
-        exists(file, function (ex) {
-            t.ok(ex, 'file created');
-            fs.stat(file, function (err, stat) {
-                t.ifError(err);
-                t.equal(stat.mode & _0777, _0777 & (~process.umask()));
-                t.ok(stat.isDirectory(), 'target not a directory');
-            });
-        })
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/mkdirp/test/umask_sync.js b/legacy-libs/grpc/node_modules/mkdirp/test/umask_sync.js
deleted file mode 100644 (file)
index 11a7614..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var exists = fs.exists || path.exists;
-var test = require('tap').test;
-var _0777 = parseInt('0777', 8);
-var _0755 = parseInt('0755', 8);
-
-test('umask sync modes', function (t) {
-    t.plan(4);
-    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-
-    var file = '/tmp/' + [x,y,z].join('/');
-
-    try {
-        mkdirp.sync(file);
-    } catch (err) {
-        t.fail(err);
-        return t.end();
-    }
-
-    exists(file, function (ex) {
-        t.ok(ex, 'file created');
-        fs.stat(file, function (err, stat) {
-            t.ifError(err);
-            t.equal(stat.mode & _0777, (_0777 & (~process.umask())));
-            t.ok(stat.isDirectory(), 'target not a directory');
-        });
-    });
-});
diff --git a/legacy-libs/grpc/node_modules/nan/CHANGELOG.md b/legacy-libs/grpc/node_modules/nan/CHANGELOG.md
new file mode 100644 (file)
index 0000000..93d9496
--- /dev/null
@@ -0,0 +1,537 @@
+# NAN ChangeLog
+
+**Version 2.14.2: current Node 14.13.1, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1**
+
+### 2.14.2 Oct 13 2020
+
+  - Bugfix: fix gcc 8 function cast warning (#899) 35f0fab205574b2cbda04e6347c8b2db755e124f
+
+### 2.14.1 Apr 21 2020
+
+  - Bugfix: use GetBackingStore() instead of GetContents() (#888) 2c023bd447661a61071da318b0ff4003c3858d39
+
+### 2.14.0 May 16 2019
+
+  - Feature: Add missing methods to Nan::Maybe<T> (#852) 4e962489fb84a184035b9fa74f245f650249aca6
+
+### 2.13.2 Mar 24 2019
+
+  - Bugfix: remove usage of deprecated `IsNearDeath` (#842) fbaf42252af279c3d867c6b193571f9711c39847
+
+### 2.13.1 Mar 14 2019
+
+  - Bugfix: check V8 version directly instead of inferring from NMV (#840) 12f9df9f393285de8fb4a8cd01478dc4fe3b089d
+
+### 2.13.0 Mar 13 2019
+
+  - Feature: add support for node master (#831) 113c0282072e7ff4f9dfc98b432fd894b798c2c
+
+### 2.12.1 Dec 18 2018
+
+  - Bugfix: Fix build breakage with Node.js 10.0.0-10.9.0. (#833) 625e90e8fef8d39ffa7247250a76a100b2487474
+
+### 2.12.0 Dec 16 2018
+
+  - Bugfix: Add scope.Escape() to Call() (#817) 2e5ed4fc3a8ac80a6ef1f2a55099ab3ac8800dc6
+  - Bugfix: Fix Node.js v10.12.0 deprecation warnings. 509859cc23b1770376b56550a027840a2ce0f73d
+  - Feature: Allow SetWeak() for non-object persistent handles. (#824) e6ef6a48e7e671fe3e4b7dddaa8912a3f8262ecd
+
+### 2.11.1 Sep 29 2018
+
+  - Fix: adapt to V8 7.0 24a22c3b25eeeec2016c6ec239bdd6169e985447
+
+### 2.11.0 Aug 25 2018
+
+  - Removal: remove `FunctionCallbackInfo::Callee` for nodejs `>= 10` 1a56c0a6efd4fac944cb46c30912a8e023bda7d4
+  - Bugfix: Fix `AsyncProgressWorkerBase::WorkProgress` sends invalid data b0c764d1dab11e9f8b37ffb81e2560a4498aad5e
+  - Feature: Introduce `GetCurrentEventLoop` b4911b0bb1f6d47d860e10ec014d941c51efac5e
+  - Feature: Add `NAN_MODULE_WORKER_ENABLED` macro as a replacement for `NAN_MODULE` b058fb047d18a58250e66ae831444441c1f2ac7a
+
+### 2.10.0 Mar 16 2018
+
+  - Deprecation: Deprecate `MakeCallback` 5e92b19a59e194241d6a658bd6ff7bfbda372950
+  - Feature: add `Nan::Call` overload 4482e1242fe124d166fc1a5b2be3c1cc849fe452
+  - Feature: add more `Nan::Call` overloads 8584e63e6d04c7d2eb8c4a664e4ef57d70bf672b
+  - Feature: Fix deprecation warnings for Node 10 1caf258243b0602ed56922bde74f1c91b0cbcb6a
+
+### 2.9.2 Feb 22 2018
+
+  - Bugfix: Bandaid for async hooks 212bd2f849be14ef1b02fc85010b053daa24252b
+
+### 2.9.1 Feb 22 2018
+
+  - Bugfix: Avoid deprecation warnings in deprecated `Nan::Callback::operator()` 372b14d91289df4604b0f81780709708c45a9aa4
+  - Bugfix: Avoid deprecation warnings in `Nan::JSON` 3bc294bce0b7d0a3ee4559926303e5ed4866fda2
+
+### 2.9.0 Feb 22 2018
+
+  - Deprecation: Deprecate legacy `Callback::Call` 6dd5fa690af61ca3523004b433304c581b3ea309
+  - Feature: introduce `AsyncResource` class 90c0a179c0d8cb5fd26f1a7d2b1d6231eb402d48o
+  - Feature: Add context aware `Nan::Callback::Call` functions 7169e09fb088418b6e388222e88b4c13f07ebaee
+  - Feature: Make `AsyncWorker` context aware 066ba21a6fb9e2b5230c9ed3a6fc51f1211736a4
+  - Feature: add `Callback` overload to `Nan::Call` 5328daf66e202658c1dc0d916c3aaba99b3cc606
+  - Bugfix: fix warning: suggest parentheses around `&&` within `||` b2bb63d68b8ae623a526b542764e1ac82319cb2c
+  - Bugfix: Fix compilation on io.js 3 d06114dba0a522fb436f0c5f47b994210968cd7b
+
+### 2.8.0 Nov 15 2017
+
+  - Deprecation: Deprecate `Nan::ForceSet` in favor of `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7
+  - Feature: Add `Nan::AsyncProgressQueueWorker` a976636ecc2ef617d1b061ce4a6edf39923691cb
+  - Feature: Add `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7
+  - Bugfix: Fix compiling on io.js 1 & 2 82705a64503ce60c62e98df5bd02972bba090900
+  - Bugfix: Use DefineOwnProperty instead of ForceSet 95cbb976d6fbbba88ba0f86dd188223a8591b4e7
+
+### 2.7.0 Aug 30 2017
+
+  - Feature: Add `Nan::To<v8::Function>()` overload. b93280670c9f6da42ed4cf6cbf085ffdd87bd65b
+  - Bugfix: Fix ternary in `Nan::MaybeLocal<T>::FromMaybe<S>()`. 79a26f7d362e756a9524e672a82c3d603b542867
+
+### 2.6.2 Apr 12 2017
+
+  - Bugfix: Fix v8::JSON::Parse() deprecation warning. 87f6a3c65815fa062296a994cc863e2fa124867d
+
+### 2.6.1 Apr 6 2017
+
+  - Bugfix: nan_json.h: fix build breakage in Node 6 ac8d47dc3c10bfbf3f15a6b951633120c0ee6d51
+
+### 2.6.0 Apr 6 2017
+
+  - Feature: nan: add support for JSON::Parse & Stringify b533226c629cce70e1932a873bb6f849044a56c5
+
+### 2.5.1 Jan 23 2017
+
+  - Bugfix: Fix disappearing handle for private value 6a80995694f162ef63dbc9948fbefd45d4485aa0
+  - Bugfix: Add missing scopes a93b8bae6bc7d32a170db6e89228b7f60ee57112
+  - Bugfix: Use string::data instead of string::front in NewOneByteString d5f920371e67e1f3b268295daee6e83af86b6e50
+
+### 2.5.0 Dec 21 2016
+
+  - Feature: Support Private accessors a86255cb357e8ad8ccbf1f6a4a901c921e39a178
+  - Bugfix: Abort in delete operators that shouldn't be called 0fe38215ff8581703967dfd26c12793feb960018
+
+### 2.4.0 Jul 10 2016
+
+  - Feature: Rewrite Callback to add Callback::Reset c4cf44d61f8275cd5f7b0c911d7a806d4004f649
+  - Feature: AsyncProgressWorker: add template types for .send 1242c9a11a7ed481c8f08ec06316385cacc513d0
+  - Bugfix: Add constness to old Persistent comparison operators bd43cb9982c7639605d60fd073efe8cae165d9b2
+
+### 2.3.5 May 31 2016
+
+  - Bugfix: Replace NAN_INLINE with 'inline' keyword. 71819d8725f822990f439479c9aba3b240804909
+
+### 2.3.4 May 31 2016
+
+  - Bugfix: Remove V8 deprecation warnings 0592fb0a47f3a1c7763087ebea8e1138829f24f9
+  - Bugfix: Fix new versions not to use WeakCallbackInfo::IsFirstPass 615c19d9e03d4be2049c10db0151edbc3b229246
+  - Bugfix: Make ObjectWrap::handle() const d19af99595587fe7a26bd850af6595c2a7145afc
+  - Bugfix: Fix compilation errors related to 0592fb0a47f3a1c7763087ebea8e1138829f24f9 e9191c525b94f652718325e28610a1adcf90fed8
+
+### 2.3.3 May 4 2016
+
+  - Bugfix: Refactor SetMethod() to deal with v8::Templates (#566) b9083cf6d5de6ebe6bcb49c7502fbb7c0d9ddda8
+
+### 2.3.2 Apr 27 2016
+
+  - Bugfix: Fix compilation on outdated versions due to Handle removal f8b7c875d04d425a41dfd4f3f8345bc3a11e6c52
+
+### 2.3.1 Apr 27 2016
+
+  - Bugfix: Don't use deprecated v8::Template::Set() in SetMethod a90951e9ea70fa1b3836af4b925322919159100e
+
+### 2.3.0 Apr 27 2016
+
+  - Feature: added Signal() for invoking async callbacks without sending data from AsyncProgressWorker d8adba45f20e077d00561b20199133620c990b38
+  - Bugfix: Don't use deprecated v8::Template::Set() 00dacf0a4b86027415867fa7f1059acc499dcece
+
+### 2.2.1 Mar 29 2016
+
+  - Bugfix: Use NewFromUnsigned in ReturnValue<T>::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58
+  - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9
+
+### 2.2.0 Jan 9 2016
+
+  - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6
+  - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec
+  - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9
+  - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b
+
+### 2.1.0 Oct 8 2015
+
+  - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c
+  - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555
+  - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d
+  - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b
+  - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537
+  - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff
+  - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f
+
+### 2.0.9 Sep 8 2015
+
+  - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7
+
+### 2.0.8 Aug 28 2015
+
+  - Work around duplicate linking bug in clang 11902da
+
+### 2.0.7 Aug 26 2015
+
+  - Build: Repackage
+
+### 2.0.6 Aug 26 2015
+
+  - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1
+  - Bugfix: Remove unused static std::map instances 525bddc
+  - Bugfix: Make better use of maybe versions of APIs bfba85b
+  - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d
+
+### 2.0.5 Aug 10 2015
+
+  - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1
+  - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d
+
+### 2.0.4 Aug 6 2015
+
+  - Build: Repackage
+
+### 2.0.3 Aug 6 2015
+
+  - Bugfix: Don't use clang++ / g++ syntax extension. 231450e
+
+### 2.0.2 Aug 6 2015
+
+  - Build: Repackage
+
+### 2.0.1 Aug 6 2015
+
+  - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687
+  - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601
+  - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f
+  - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed
+
+### 2.0.0 Jul 31 2015
+
+  - Change: Renamed identifiers with leading underscores       b5932b4
+  - Change: Replaced NanObjectWrapHandle with class NanObjectWrap      464f1e1
+  - Change: Replace NanScope and NanEscpableScope macros with classes  47751c4
+  - Change: Rename NanNewBufferHandle to NanNewBuffer  6745f99
+  - Change: Rename NanBufferUse to NanNewBuffer        3e8b0a5
+  - Change: Rename NanNewBuffer to NanCopyBuffer       d6af78d
+  - Change: Remove Nan prefix from all names   72d1f67
+  - Change: Update Buffer API for new upstream changes d5d3291
+  - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope    21a7a6a
+  - Change: Get rid of Handles  e6c0daf
+  - Feature: Support io.js 3 with V8 4.4
+  - Feature: Introduce NanPersistent   7fed696
+  - Feature: Introduce NanGlobal       4408da1
+  - Feature: Added NanTryCatch 10f1ca4
+  - Feature: Update for V8 v4.3        4b6404a
+  - Feature: Introduce NanNewOneByteString     c543d32
+  - Feature: Introduce namespace Nan   67ed1b1
+  - Removal: Remove NanLocker and NanUnlocker  dd6e401
+  - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9
+  - Removal: Remove NanReturn* macros  d90a25c
+  - Removal: Remove HasInstance        e8f84fe
+
+
+### 1.9.0 Jul 31 2015
+
+  - Feature: Added `NanFatalException` 81d4a2c
+  - Feature: Added more error types 4265f06
+  - Feature: Added dereference and function call operators to NanCallback c4b2ed0
+  - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c
+  - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6
+  - Feature: Added NanErrnoException dd87d9e
+  - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130
+  - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c
+  - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b
+
+### 1.8.4 Apr 26 2015
+
+  - Build: Repackage
+
+### 1.8.3 Apr 26 2015
+
+  - Bugfix: Include missing header 1af8648
+
+### 1.8.2 Apr 23 2015
+
+  - Build: Repackage
+
+### 1.8.1 Apr 23 2015
+
+  - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3
+
+### 1.8.0 Apr 23 2015
+
+  - Feature: Allow primitives with NanReturnValue 2e4475e
+  - Feature: Added comparison operators to NanCallback 55b075e
+  - Feature: Backport thread local storage 15bb7fa
+  - Removal: Remove support for signatures with arguments 8a2069d
+  - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59
+
+### 1.7.0 Feb 28 2015
+
+  - Feature: Made NanCallback::Call accept optional target 8d54da7
+  - Feature: Support atom-shell 0.21 0b7f1bb
+
+### 1.6.2 Feb 6 2015
+
+  - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639
+
+### 1.6.1 Jan 23 2015
+
+  - Build: version bump
+
+### 1.5.3 Jan 23 2015
+
+  - Build: repackage
+
+### 1.6.0 Jan 23 2015
+
+ - Deprecated `NanNewContextHandle` in favor of `NanNew<Context>` 49259af
+ - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179
+ - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9
+
+### 1.5.2 Jan 23 2015
+
+  - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4
+  - Bugfix: Readded missing String constructors 18d828f
+  - Bugfix: Add overload handling NanNew<FunctionTemplate>(..) 5ef813b
+  - Bugfix: Fix uv_work_cb versioning 997e4ae
+  - Bugfix: Add function factory and test 4eca89c
+  - Bugfix: Add object template factory and test cdcb951
+  - Correctness: Lifted an io.js related typedef c9490be
+  - Correctness: Make explicit downcasts of String lengths 00074e6
+  - Windows: Limit the scope of disabled warning C4530 83d7deb
+
+### 1.5.1 Jan 15 2015
+
+  - Build: version bump
+
+### 1.4.3 Jan 15 2015
+
+  - Build: version bump
+
+### 1.4.2 Jan 15 2015
+
+  - Feature: Support io.js 0dbc5e8
+
+### 1.5.0 Jan 14 2015
+
+ - Feature: Support io.js b003843
+ - Correctness: Improved NanNew internals 9cd4f6a
+ - Feature: Implement progress to NanAsyncWorker 8d6a160
+
+### 1.4.1 Nov 8 2014
+
+ - Bugfix: Handle DEBUG definition correctly
+ - Bugfix: Accept int as Boolean
+
+### 1.4.0 Nov 1 2014
+
+ - Feature: Added NAN_GC_CALLBACK 6a5c245
+ - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8
+ - Correctness: Added constness to references in NanHasInstance 02c61cd
+ - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6
+ - Windoze: Shut Visual Studio up when compiling 8d558c1
+ - License: Switch to plain MIT from custom hacked MIT license 11de983
+ - Build: Added test target to Makefile e232e46
+ - Performance: Removed superfluous scope in NanAsyncWorker f4b7821
+ - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208
+ - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450
+
+### 1.3.0 Aug 2 2014
+
+ - Added NanNew<v8::String, std::string>(std::string)
+ - Added NanNew<v8::String, std::string&>(std::string&)
+ - Added NanAsciiString helper class
+ - Added NanUtf8String helper class
+ - Added NanUcs2String helper class
+ - Deprecated NanRawString()
+ - Deprecated NanCString()
+ - Added NanGetIsolateData(v8::Isolate *isolate)
+ - Added NanMakeCallback(v8::Handle<v8::Object> target, v8::Handle<v8::Function> func, int argc, v8::Handle<v8::Value>* argv)
+ - Added NanMakeCallback(v8::Handle<v8::Object> target, v8::Handle<v8::String> symbol, int argc, v8::Handle<v8::Value>* argv)
+ - Added NanMakeCallback(v8::Handle<v8::Object> target, const char* method, int argc, v8::Handle<v8::Value>* argv)
+ - Added NanSetTemplate(v8::Handle<v8::Template> templ, v8::Handle<v8::String> name , v8::Handle<v8::Data> value, v8::PropertyAttribute attributes)
+ - Added NanSetPrototypeTemplate(v8::Local<v8::FunctionTemplate> templ, v8::Handle<v8::String> name, v8::Handle<v8::Data> value, v8::PropertyAttribute attributes)
+ - Added NanSetInstanceTemplate(v8::Local<v8::FunctionTemplate> templ, const char *name, v8::Handle<v8::Data> value)
+ - Added NanSetInstanceTemplate(v8::Local<v8::FunctionTemplate> templ, v8::Handle<v8::String> name, v8::Handle<v8::Data> value, v8::PropertyAttribute attributes)
+
+### 1.2.0 Jun 5 2014
+
+ - Add NanSetPrototypeTemplate
+ - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class,
+     introduced _NanWeakCallbackDispatcher
+ - Removed -Wno-unused-local-typedefs from test builds
+ - Made test builds Windows compatible ('Sleep()')
+
+### 1.1.2 May 28 2014
+
+ - Release to fix more stuff-ups in 1.1.1
+
+### 1.1.1 May 28 2014
+
+ - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0
+
+### 1.1.0 May 25 2014
+
+ - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead
+ - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]),
+     (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*,
+     v8::String::ExternalAsciiStringResource*
+ - Deprecate NanSymbol()
+ - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker
+
+### 1.0.0 May 4 2014
+
+ - Heavy API changes for V8 3.25 / Node 0.11.13
+ - Use cpplint.py
+ - Removed NanInitPersistent
+ - Removed NanPersistentToLocal
+ - Removed NanFromV8String
+ - Removed NanMakeWeak
+ - Removed NanNewLocal
+ - Removed NAN_WEAK_CALLBACK_OBJECT
+ - Removed NAN_WEAK_CALLBACK_DATA
+ - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions
+ - Introduce NanUndefined, NanNull, NanTrue and NanFalse
+ - Introduce NanEscapableScope and NanEscapeScope
+ - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node)
+ - Introduce NanMakeCallback for node::MakeCallback
+ - Introduce NanSetTemplate
+ - Introduce NanGetCurrentContext
+ - Introduce NanCompileScript and NanRunScript
+ - Introduce NanAdjustExternalMemory
+ - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback
+ - Introduce NanGetHeapStatistics
+ - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent()
+
+### 0.8.0 Jan 9 2014
+
+ - NanDispose -> NanDisposePersistent, deprecate NanDispose
+ - Extract _NAN_*_RETURN_TYPE, pull up NAN_*()
+
+### 0.7.1 Jan 9 2014
+
+ - Fixes to work against debug builds of Node
+ - Safer NanPersistentToLocal (avoid reinterpret_cast)
+ - Speed up common NanRawString case by only extracting flattened string when necessary
+
+### 0.7.0 Dec 17 2013
+
+ - New no-arg form of NanCallback() constructor.
+ - NanCallback#Call takes Handle rather than Local
+ - Removed deprecated NanCallback#Run method, use NanCallback#Call instead
+ - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS
+ - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call()
+ - Introduce NanRawString() for char* (or appropriate void*) from v8::String
+     (replacement for NanFromV8String)
+ - Introduce NanCString() for null-terminated char* from v8::String
+
+### 0.6.0 Nov 21 2013
+
+ - Introduce NanNewLocal<T>(v8::Handle<T> value) for use in place of
+     v8::Local<T>::New(...) since v8 started requiring isolate in Node 0.11.9
+
+### 0.5.2 Nov 16 2013
+
+ - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public
+
+### 0.5.1 Nov 12 2013
+
+ - Use node::MakeCallback() instead of direct v8::Function::Call()
+
+### 0.5.0 Nov 11 2013
+
+ - Added @TooTallNate as collaborator
+ - New, much simpler, "include_dirs" for binding.gyp
+ - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros
+
+### 0.4.4 Nov 2 2013
+
+ - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+
+
+### 0.4.3 Nov 2 2013
+
+ - Include node_object_wrap.h, removed from node.h for Node 0.11.8.
+
+### 0.4.2 Nov 2 2013
+
+ - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for
+     Node 0.11.8 release.
+
+### 0.4.1 Sep 16 2013
+
+ - Added explicit `#include <uv.h>` as it was removed from node.h for v0.11.8
+
+### 0.4.0 Sep 2 2013
+
+ - Added NAN_INLINE and NAN_DEPRECATED and made use of them
+ - Added NanError, NanTypeError and NanRangeError
+ - Cleaned up code
+
+### 0.3.2 Aug 30 2013
+
+ - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent
+     in NanAsyncWorker
+
+### 0.3.1 Aug 20 2013
+
+ - fix "not all control paths return a value" compile warning on some platforms
+
+### 0.3.0 Aug 19 2013
+
+ - Made NAN work with NPM
+ - Lots of fixes to NanFromV8String, pulling in features from new Node core
+ - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API
+ - Added optional error number argument for NanThrowError()
+ - Added NanInitPersistent()
+ - Added NanReturnNull() and NanReturnEmptyString()
+ - Added NanLocker and NanUnlocker
+ - Added missing scopes
+ - Made sure to clear disposed Persistent handles
+ - Changed NanAsyncWorker to allocate error messages on the heap
+ - Changed NanThrowError(Local<Value>) to NanThrowError(Handle<Value>)
+ - Fixed leak in NanAsyncWorker when errmsg is used
+
+### 0.2.2 Aug 5 2013
+
+ - Fixed usage of undefined variable with node::BASE64 in NanFromV8String()
+
+### 0.2.1 Aug 5 2013
+
+ - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for
+     NanFromV8String()
+
+### 0.2.0 Aug 5 2013
+
+ - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR,
+     NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY
+ - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS,
+     _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS,
+     _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS,
+     _NAN_PROPERTY_QUERY_ARGS
+ - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer
+ - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT,
+     NAN_WEAK_CALLBACK_DATA, NanMakeWeak
+ - Renamed THROW_ERROR to _NAN_THROW_ERROR
+ - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*)
+ - Added NanBufferUse(char*, uint32_t)
+ - Added NanNewContextHandle(v8::ExtensionConfiguration*,
+       v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)
+ - Fixed broken NanCallback#GetFunction()
+ - Added optional encoding and size arguments to NanFromV8String()
+ - Added NanGetPointerSafe() and NanSetPointerSafe()
+ - Added initial test suite (to be expanded)
+ - Allow NanUInt32OptionValue to convert any Number object
+
+### 0.1.0 Jul 21 2013
+
+ - Added `NAN_GETTER`, `NAN_SETTER`
+ - Added `NanThrowError` with single Local<Value> argument
+ - Added `NanNewBufferHandle` with single uint32_t argument
+ - Added `NanHasInstance(Persistent<FunctionTemplate>&, Handle<Value>)`
+ - Added `Local<Function> NanCallback#GetFunction()`
+ - Added `NanCallback#Call(int, Local<Value>[])`
+ - Deprecated `NanCallback#Run(int, Local<Value>[])` in favour of Call
diff --git a/legacy-libs/grpc/node_modules/nan/LICENSE.md b/legacy-libs/grpc/node_modules/nan/LICENSE.md
new file mode 100644 (file)
index 0000000..dddd13d
--- /dev/null
@@ -0,0 +1,13 @@
+The MIT License (MIT)
+=====================
+
+Copyright (c) 2018 NAN contributors
+-----------------------------------
+
+*NAN contributors listed at <https://github.com/nodejs/nan#contributors>*
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/nan/README.md b/legacy-libs/grpc/node_modules/nan/README.md
new file mode 100644 (file)
index 0000000..f671ef1
--- /dev/null
@@ -0,0 +1,455 @@
+Native Abstractions for Node.js
+===============================
+
+**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14.**
+
+***Current version: 2.14.2***
+
+*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)*
+
+[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/)
+
+[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan)
+[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan)
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a bit more pleasant.
+
+ * **[News & Updates](#news)**
+ * **[Usage](#usage)**
+ * **[Example](#example)**
+ * **[API](#api)**
+ * **[Tests](#tests)**
+ * **[Known issues](#issues)**
+ * **[Governance & Contributing](#governance)**
+
+<a name="news"></a>
+
+## News & Updates
+
+<a name="usage"></a>
+
+## Usage
+
+Simply add **NAN** as a dependency in the *package.json* of your Node addon:
+
+``` bash
+$ npm install --save nan
+```
+
+Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include <nan.h>` in your *.cpp* files:
+
+``` python
+"include_dirs" : [
+    "<!(node -e \"require('nan')\")"
+]
+```
+
+This works like a `-I<path-to-NAN>` when compiling your addon.
+
+<a name="example"></a>
+
+## Example
+
+Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**.
+
+Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality.
+
+For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.
+
+Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon.
+
+Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure.
+
+<a name="api"></a>
+
+## API
+
+Additional to the NAN documentation below, please consult:
+
+* [The V8 Getting Started * Guide](https://v8.dev/docs/embed)
+* [V8 API Documentation](https://v8docs.nodesource.com/)
+* [Node Add-on Documentation](https://nodejs.org/api/addons.html)
+
+<!-- START API -->
+
+### JavaScript-accessible methods
+
+A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information.
+
+In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type.
+
+* **Method argument types**
+ - <a href="doc/methods.md#api_nan_function_callback_info"><b><code>Nan::FunctionCallbackInfo</code></b></a>
+ - <a href="doc/methods.md#api_nan_property_callback_info"><b><code>Nan::PropertyCallbackInfo</code></b></a>
+ - <a href="doc/methods.md#api_nan_return_value"><b><code>Nan::ReturnValue</code></b></a>
+* **Method declarations**
+ - <a href="doc/methods.md#api_nan_method"><b>Method declaration</b></a>
+ - <a href="doc/methods.md#api_nan_getter"><b>Getter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_setter"><b>Setter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_property_getter"><b>Property getter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_property_setter"><b>Property setter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_property_enumerator"><b>Property enumerator declaration</b></a>
+ - <a href="doc/methods.md#api_nan_property_deleter"><b>Property deleter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_property_query"><b>Property query declaration</b></a>
+ - <a href="doc/methods.md#api_nan_index_getter"><b>Index getter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_index_setter"><b>Index setter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_index_enumerator"><b>Index enumerator declaration</b></a>
+ - <a href="doc/methods.md#api_nan_index_deleter"><b>Index deleter declaration</b></a>
+ - <a href="doc/methods.md#api_nan_index_query"><b>Index query declaration</b></a>
+* Method and template helpers
+ - <a href="doc/methods.md#api_nan_set_method"><b><code>Nan::SetMethod()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_prototype_method"><b><code>Nan::SetPrototypeMethod()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_accessor"><b><code>Nan::SetAccessor()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_named_property_handler"><b><code>Nan::SetNamedPropertyHandler()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_indexed_property_handler"><b><code>Nan::SetIndexedPropertyHandler()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_template"><b><code>Nan::SetTemplate()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_prototype_template"><b><code>Nan::SetPrototypeTemplate()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_instance_template"><b><code>Nan::SetInstanceTemplate()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_call_handler"><b><code>Nan::SetCallHandler()</code></b></a>
+ - <a href="doc/methods.md#api_nan_set_call_as_function_handler"><b><code>Nan::SetCallAsFunctionHandler()</code></b></a>
+
+### Scopes
+
+A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works.
+
+A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope.
+
+The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these.
+
+ - <a href="doc/scopes.md#api_nan_handle_scope"><b><code>Nan::HandleScope</code></b></a>
+ - <a href="doc/scopes.md#api_nan_escapable_handle_scope"><b><code>Nan::EscapableHandleScope</code></b></a>
+
+Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection).
+
+### Persistent references
+
+An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed.
+
+Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported.
+
+ - <a href="doc/persistent.md#api_nan_persistent_base"><b><code>Nan::PersistentBase & v8::PersistentBase</code></b></a>
+ - <a href="doc/persistent.md#api_nan_non_copyable_persistent_traits"><b><code>Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits</code></b></a>
+ - <a href="doc/persistent.md#api_nan_copyable_persistent_traits"><b><code>Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits</code></b></a>
+ - <a href="doc/persistent.md#api_nan_persistent"><b><code>Nan::Persistent</code></b></a>
+ - <a href="doc/persistent.md#api_nan_global"><b><code>Nan::Global</code></b></a>
+ - <a href="doc/persistent.md#api_nan_weak_callback_info"><b><code>Nan::WeakCallbackInfo</code></b></a>
+ - <a href="doc/persistent.md#api_nan_weak_callback_type"><b><code>Nan::WeakCallbackType</code></b></a>
+
+Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles).
+
+### New
+
+NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8.
+
+ - <a href="doc/new.md#api_nan_new"><b><code>Nan::New()</code></b></a>
+ - <a href="doc/new.md#api_nan_undefined"><b><code>Nan::Undefined()</code></b></a>
+ - <a href="doc/new.md#api_nan_null"><b><code>Nan::Null()</code></b></a>
+ - <a href="doc/new.md#api_nan_true"><b><code>Nan::True()</code></b></a>
+ - <a href="doc/new.md#api_nan_false"><b><code>Nan::False()</code></b></a>
+ - <a href="doc/new.md#api_nan_empty_string"><b><code>Nan::EmptyString()</code></b></a>
+
+
+### Converters
+
+NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN.
+
+ - <a href="doc/converters.md#api_nan_to"><b><code>Nan::To()</code></b></a>
+
+### Maybe Types
+
+The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_.
+
+* **Maybe Types**
+  - <a href="doc/maybe_types.md#api_nan_maybe_local"><b><code>Nan::MaybeLocal</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_maybe"><b><code>Nan::Maybe</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_nothing"><b><code>Nan::Nothing</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_just"><b><code>Nan::Just</code></b></a>
+* **Maybe Helpers**
+  - <a href="doc/maybe_types.md#api_nan_call"><b><code>Nan::Call()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_to_detail_string"><b><code>Nan::ToDetailString()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_to_array_index"><b><code>Nan::ToArrayIndex()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_equals"><b><code>Nan::Equals()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_new_instance"><b><code>Nan::NewInstance()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_function"><b><code>Nan::GetFunction()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_set"><b><code>Nan::Set()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_define_own_property"><b><code>Nan::DefineOwnProperty()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_force_set"><del><b><code>Nan::ForceSet()</code></b></del></a>
+  - <a href="doc/maybe_types.md#api_nan_get"><b><code>Nan::Get()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_property_attribute"><b><code>Nan::GetPropertyAttributes()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_has"><b><code>Nan::Has()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_delete"><b><code>Nan::Delete()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_property_names"><b><code>Nan::GetPropertyNames()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_own_property_names"><b><code>Nan::GetOwnPropertyNames()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_set_prototype"><b><code>Nan::SetPrototype()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_object_proto_to_string"><b><code>Nan::ObjectProtoToString()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_has_own_property"><b><code>Nan::HasOwnProperty()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_has_real_named_property"><b><code>Nan::HasRealNamedProperty()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_has_real_indexed_property"><b><code>Nan::HasRealIndexedProperty()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_has_real_named_callback_property"><b><code>Nan::HasRealNamedCallbackProperty()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_real_named_property_in_prototype_chain"><b><code>Nan::GetRealNamedPropertyInPrototypeChain()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_real_named_property"><b><code>Nan::GetRealNamedProperty()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_call_as_function"><b><code>Nan::CallAsFunction()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_call_as_constructor"><b><code>Nan::CallAsConstructor()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_source_line"><b><code>Nan::GetSourceLine()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_line_number"><b><code>Nan::GetLineNumber()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_start_column"><b><code>Nan::GetStartColumn()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_end_column"><b><code>Nan::GetEndColumn()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_clone_element_at"><b><code>Nan::CloneElementAt()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_has_private"><b><code>Nan::HasPrivate()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_get_private"><b><code>Nan::GetPrivate()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_set_private"><b><code>Nan::SetPrivate()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_delete_private"><b><code>Nan::DeletePrivate()</code></b></a>
+  - <a href="doc/maybe_types.md#api_nan_make_maybe"><b><code>Nan::MakeMaybe()</code></b></a>
+
+### Script
+
+NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8.
+
+ - <a href="doc/script.md#api_nan_compile_script"><b><code>Nan::CompileScript()</code></b></a>
+ - <a href="doc/script.md#api_nan_run_script"><b><code>Nan::RunScript()</code></b></a>
+
+
+### JSON
+
+The _JSON_ object provides the C++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object.
+
+ - <a href="doc/json.md#api_nan_json_parse"><b><code>Nan::JSON.Parse</code></b></a>
+ - <a href="doc/json.md#api_nan_json_stringify"><b><code>Nan::JSON.Stringify</code></b></a>
+
+Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments.
+
+### Errors
+
+NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted.
+
+Note that an Error object is simply a specialized form of `v8::Value`.
+
+Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information.
+
+ - <a href="doc/errors.md#api_nan_error"><b><code>Nan::Error()</code></b></a>
+ - <a href="doc/errors.md#api_nan_range_error"><b><code>Nan::RangeError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_reference_error"><b><code>Nan::ReferenceError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_syntax_error"><b><code>Nan::SyntaxError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_type_error"><b><code>Nan::TypeError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_throw_error"><b><code>Nan::ThrowError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_throw_range_error"><b><code>Nan::ThrowRangeError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_throw_reference_error"><b><code>Nan::ThrowReferenceError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_throw_syntax_error"><b><code>Nan::ThrowSyntaxError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_throw_type_error"><b><code>Nan::ThrowTypeError()</code></b></a>
+ - <a href="doc/errors.md#api_nan_fatal_exception"><b><code>Nan::FatalException()</code></b></a>
+ - <a href="doc/errors.md#api_nan_errno_exception"><b><code>Nan::ErrnoException()</code></b></a>
+ - <a href="doc/errors.md#api_nan_try_catch"><b><code>Nan::TryCatch</code></b></a>
+
+
+### Buffers
+
+NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility.
+
+ - <a href="doc/buffers.md#api_nan_new_buffer"><b><code>Nan::NewBuffer()</code></b></a>
+ - <a href="doc/buffers.md#api_nan_copy_buffer"><b><code>Nan::CopyBuffer()</code></b></a>
+ - <a href="doc/buffers.md#api_nan_free_callback"><b><code>Nan::FreeCallback()</code></b></a>
+
+### Nan::Callback
+
+`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution.
+
+ - <a href="doc/callback.md#api_nan_callback"><b><code>Nan::Callback</code></b></a>
+
+### Asynchronous work helpers
+
+`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier.
+
+ - <a href="doc/asyncworker.md#api_nan_async_worker"><b><code>Nan::AsyncWorker</code></b></a>
+ - <a href="doc/asyncworker.md#api_nan_async_progress_worker"><b><code>Nan::AsyncProgressWorkerBase &amp; Nan::AsyncProgressWorker</code></b></a>
+ - <a href="doc/asyncworker.md#api_nan_async_progress_queue_worker"><b><code>Nan::AsyncProgressQueueWorker</code></b></a>
+ - <a href="doc/asyncworker.md#api_nan_async_queue_worker"><b><code>Nan::AsyncQueueWorker</code></b></a>
+
+### Strings & Bytes
+
+Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing.
+
+ - <a href="doc/string_bytes.md#api_nan_encoding"><b><code>Nan::Encoding</code></b></a>
+ - <a href="doc/string_bytes.md#api_nan_encode"><b><code>Nan::Encode()</code></b></a>
+ - <a href="doc/string_bytes.md#api_nan_decode_bytes"><b><code>Nan::DecodeBytes()</code></b></a>
+ - <a href="doc/string_bytes.md#api_nan_decode_write"><b><code>Nan::DecodeWrite()</code></b></a>
+
+
+### Object Wrappers
+
+The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects.
+
+ - <a href="doc/object_wrappers.md#api_nan_object_wrap"><b><code>Nan::ObjectWrap</code></b></a>
+
+
+### V8 internals
+
+The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods.
+
+ - <a href="doc/v8_internals.md#api_nan_gc_callback"><b><code>NAN_GC_CALLBACK()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_add_gc_epilogue_callback"><b><code>Nan::AddGCEpilogueCallback()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_remove_gc_epilogue_callback"><b><code>Nan::RemoveGCEpilogueCallback()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_add_gc_prologue_callback"><b><code>Nan::AddGCPrologueCallback()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_remove_gc_prologue_callback"><b><code>Nan::RemoveGCPrologueCallback()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_get_heap_statistics"><b><code>Nan::GetHeapStatistics()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_set_counter_function"><b><code>Nan::SetCounterFunction()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_set_create_histogram_function"><b><code>Nan::SetCreateHistogramFunction()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_set_add_histogram_sample_function"><b><code>Nan::SetAddHistogramSampleFunction()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_idle_notification"><b><code>Nan::IdleNotification()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_low_memory_notification"><b><code>Nan::LowMemoryNotification()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_context_disposed_notification"><b><code>Nan::ContextDisposedNotification()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_get_internal_field_pointer"><b><code>Nan::GetInternalFieldPointer()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_set_internal_field_pointer"><b><code>Nan::SetInternalFieldPointer()</code></b></a>
+ - <a href="doc/v8_internals.md#api_nan_adjust_external_memory"><b><code>Nan::AdjustExternalMemory()</code></b></a>
+
+
+### Miscellaneous V8 Helpers
+
+ - <a href="doc/v8_misc.md#api_nan_utf8_string"><b><code>Nan::Utf8String</code></b></a>
+ - <a href="doc/v8_misc.md#api_nan_get_current_context"><b><code>Nan::GetCurrentContext()</code></b></a>
+ - <a href="doc/v8_misc.md#api_nan_set_isolate_data"><b><code>Nan::SetIsolateData()</code></b></a>
+ - <a href="doc/v8_misc.md#api_nan_get_isolate_data"><b><code>Nan::GetIsolateData()</code></b></a>
+ - <a href="doc/v8_misc.md#api_nan_typedarray_contents"><b><code>Nan::TypedArrayContents</code></b></a>
+
+
+### Miscellaneous Node Helpers
+
+ - <a href="doc/node_misc.md#api_nan_asyncresource"><b><code>Nan::AsyncResource</code></b></a>
+ - <a href="doc/node_misc.md#api_nan_make_callback"><b><code>Nan::MakeCallback()</code></b></a>
+ - <a href="doc/node_misc.md#api_nan_module_init"><b><code>NAN_MODULE_INIT()</code></b></a>
+ - <a href="doc/node_misc.md#api_nan_export"><b><code>Nan::Export()</code></b></a>
+
+<!-- END API -->
+
+
+<a name="tests"></a>
+
+### Tests
+
+To run the NAN tests do:
+
+``` sh
+npm install
+npm run-script rebuild-tests
+npm test
+```
+
+Or just:
+
+``` sh
+npm install
+make test
+```
+
+<a name="issues"></a>
+
+## Known issues
+
+### Compiling against Node.js 0.12 on OSX
+
+With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12
+do not compile anymore. The error looks something like:
+
+```
+❯   CXX(target) Release/obj.target/accessors/cpp/accessors.o
+In file included from ../cpp/accessors.cpp:9:
+In file included from ../../nan.h:51:
+In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61:
+/Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope'
+  return Handle<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
+                                        ~~~~~~~~~~~~~^~~~~~~~~~~~
+```
+
+This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make
+`v8::Handle` a friend of `v8::HandleScope`. Since neither Node.js not V8 support this release line anymore
+this patch cannot be released by either project in an official release.
+
+For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support
+that configuration, you will need to either get an older compiler, or apply a source patch to the version
+of V8 headers as a workaround.
+
+<a name="governance"></a>
+
+## Governance & Contributing
+
+NAN is governed by the [Node.js Addon API Working Group](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md#addon-api)
+
+### Addon API Working Group (WG)
+
+The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project.
+
+Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects.
+
+The WG has final authority over this project including:
+
+* Technical direction
+* Project governance and process (including this policy)
+* Contribution policy
+* GitHub repository hosting
+* Maintaining the list of additional Collaborators
+
+For the current list of WG members, see the project [README.md](./README.md#collaborators).
+
+Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote.
+
+_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly.
+
+For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators).
+
+### Consensus Seeking Process
+
+The WG follows a [Consensus Seeking](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model.
+
+Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification.
+
+If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins.
+
+<a id="developers-certificate-of-origin"></a>
+
+## Developer's Certificate of Origin 1.1
+
+By making a contribution to this project, I certify that:
+
+* (a) The contribution was created in whole or in part by me and I
+  have the right to submit it under the open source license
+  indicated in the file; or
+
+* (b) The contribution is based upon previous work that, to the best
+  of my knowledge, is covered under an appropriate open source
+  license and I have the right under that license to submit that
+  work with modifications, whether created in whole or in part
+  by me, under the same open source license (unless I am
+  permitted to submit under a different license), as indicated
+  in the file; or
+
+* (c) The contribution was provided directly to me by some other
+  person who certified (a), (b) or (c) and I have not modified
+  it.
+
+* (d) I understand and agree that this project and the contribution
+  are public and that a record of the contribution (including all
+  personal information I submit with it, including my sign-off) is
+  maintained indefinitely and may be redistributed consistent with
+  this project or the open source license(s) involved.
+
+<a name="collaborators"></a>
+
+### WG Members / Collaborators
+
+<table><tbody>
+<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>
+<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td><td>-</td></tr>
+<tr><th align="left">Trevor Norris</th><td><a href="https://github.com/trevnorris">GitHub/trevnorris</a></td><td><a href="http://twitter.com/trevnorris">Twitter/@trevnorris</a></td></tr>
+<tr><th align="left">Nathan Rajlich</th><td><a href="https://github.com/TooTallNate">GitHub/TooTallNate</a></td><td><a href="http://twitter.com/TooTallNate">Twitter/@TooTallNate</a></td></tr>
+<tr><th align="left">Brett Lawson</th><td><a href="https://github.com/brett19">GitHub/brett19</a></td><td><a href="http://twitter.com/brett19x">Twitter/@brett19x</a></td></tr>
+<tr><th align="left">Ben Noordhuis</th><td><a href="https://github.com/bnoordhuis">GitHub/bnoordhuis</a></td><td><a href="http://twitter.com/bnoordhuis">Twitter/@bnoordhuis</a></td></tr>
+<tr><th align="left">David Siegel</th><td><a href="https://github.com/agnat">GitHub/agnat</a></td><td><a href="http://twitter.com/agnat">Twitter/@agnat</a></td></tr>
+<tr><th align="left">Michael Ira Krufky</th><td><a href="https://github.com/mkrufky">GitHub/mkrufky</a></td><td><a href="http://twitter.com/mkrufky">Twitter/@mkrufky</a></td></tr>
+</tbody></table>
+
+## Licence &amp; copyright
+
+Copyright (c) 2018 NAN WG Members / Collaborators (listed above).
+
+Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
diff --git a/legacy-libs/grpc/node_modules/nan/doc/asyncworker.md b/legacy-libs/grpc/node_modules/nan/doc/asyncworker.md
new file mode 100644 (file)
index 0000000..04231f8
--- /dev/null
@@ -0,0 +1,146 @@
+## Asynchronous work helpers
+
+`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier.
+
+ - <a href="#api_nan_async_worker"><b><code>Nan::AsyncWorker</code></b></a>
+ - <a href="#api_nan_async_progress_worker"><b><code>Nan::AsyncProgressWorkerBase &amp; Nan::AsyncProgressWorker</code></b></a>
+ - <a href="#api_nan_async_progress_queue_worker"><b><code>Nan::AsyncProgressQueueWorker</code></b></a>
+ - <a href="#api_nan_async_queue_worker"><b><code>Nan::AsyncQueueWorker</code></b></a>
+
+<a name="api_nan_async_worker"></a>
+### Nan::AsyncWorker
+
+`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress.
+
+This class internally handles the details of creating an [`AsyncResource`][AsyncResource], and running the callback in the
+correct async context. To be able to identify the async resources created by this class in async-hooks, provide a
+`resource_name` to the constructor. It is recommended that the module name be used as a prefix to the `resource_name` to avoid
+collisions in the names. For more details see [`AsyncResource`][AsyncResource] documentation.  The `resource_name` needs to stay valid for the lifetime of the worker instance.
+
+Definition:
+
+```c++
+class AsyncWorker {
+ public:
+  explicit AsyncWorker(Callback *callback_, const char* resource_name = "nan:AsyncWorker");
+
+  virtual ~AsyncWorker();
+
+  virtual void WorkComplete();
+
+  void SaveToPersistent(const char *key, const v8::Local<v8::Value> &value);
+
+  void SaveToPersistent(const v8::Local<v8::String> &key,
+                        const v8::Local<v8::Value> &value);
+
+  void SaveToPersistent(uint32_t index,
+                        const v8::Local<v8::Value> &value);
+
+  v8::Local<v8::Value> GetFromPersistent(const char *key) const;
+
+  v8::Local<v8::Value> GetFromPersistent(const v8::Local<v8::String> &key) const;
+
+  v8::Local<v8::Value> GetFromPersistent(uint32_t index) const;
+
+  virtual void Execute() = 0;
+
+  uv_work_t request;
+
+  virtual void Destroy();
+
+ protected:
+  Persistent<v8::Object> persistentHandle;
+
+  Callback *callback;
+
+  virtual void HandleOKCallback();
+
+  virtual void HandleErrorCallback();
+
+  void SetErrorMessage(const char *msg);
+
+  const char* ErrorMessage();
+};
+```
+
+<a name="api_nan_async_progress_worker"></a>
+### Nan::AsyncProgressWorkerBase &amp; Nan::AsyncProgressWorker
+
+`Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript.
+
+Previously the definition of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `<char>` for compatibility.
+
+`Nan::AsyncProgressWorkerBase` &amp; `Nan::AsyncProgressWorker` is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar.  The last event sent before the main thread is woken will be delivered.
+
+Definition:
+
+```c++
+template<class T>
+class AsyncProgressWorkerBase<T> : public AsyncWorker {
+ public:
+  explicit AsyncProgressWorkerBase(Callback *callback_, const char* resource_name = ...);
+
+  virtual ~AsyncProgressWorkerBase();
+
+  void WorkProgress();
+
+  class ExecutionProgress {
+   public:
+    void Signal() const;
+    void Send(const T* data, size_t count) const;
+  };
+
+  virtual void Execute(const ExecutionProgress& progress) = 0;
+
+  virtual void HandleProgressCallback(const T *data, size_t count) = 0;
+
+  virtual void Destroy();
+};
+
+typedef AsyncProgressWorkerBase<T> AsyncProgressWorker;
+```
+
+<a name="api_nan_async_progress_queue_worker"></a>
+### Nan::AsyncProgressQueueWorker
+
+`Nan::AsyncProgressQueueWorker` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript.
+
+`Nan::AsyncProgressQueueWorker` behaves exactly the same as `Nan::AsyncProgressWorker`, except all events are queued and delivered to the main thread.
+
+Definition:
+
+```c++
+template<class T>
+class AsyncProgressQueueWorker<T> : public AsyncWorker {
+ public:
+  explicit AsyncProgressQueueWorker(Callback *callback_, const char* resource_name = "nan:AsyncProgressQueueWorker");
+
+  virtual ~AsyncProgressQueueWorker();
+
+  void WorkProgress();
+
+  class ExecutionProgress {
+   public:
+    void Send(const T* data, size_t count) const;
+  };
+
+  virtual void Execute(const ExecutionProgress& progress) = 0;
+
+  virtual void HandleProgressCallback(const T *data, size_t count) = 0;
+
+  virtual void Destroy();
+};
+```
+
+<a name="api_nan_async_queue_worker"></a>
+### Nan::AsyncQueueWorker
+
+`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`.
+
+Definition:
+
+```c++
+void AsyncQueueWorker(AsyncWorker *);
+```
+
+[AsyncResource]: node_misc.md#api_nan_asyncresource
diff --git a/legacy-libs/grpc/node_modules/nan/doc/buffers.md b/legacy-libs/grpc/node_modules/nan/doc/buffers.md
new file mode 100644 (file)
index 0000000..8d8d25c
--- /dev/null
@@ -0,0 +1,54 @@
+## Buffers
+
+NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility.
+
+ - <a href="#api_nan_new_buffer"><b><code>Nan::NewBuffer()</code></b></a>
+ - <a href="#api_nan_copy_buffer"><b><code>Nan::CopyBuffer()</code></b></a>
+ - <a href="#api_nan_free_callback"><b><code>Nan::FreeCallback()</code></b></a>
+
+<a name="api_nan_new_buffer"></a>
+### Nan::NewBuffer()
+
+Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`.
+
+Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management.
+When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`.
+You _must not_ free the memory space manually once you have created a `Buffer` in this way.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Object> Nan::NewBuffer(uint32_t size)
+Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char* data, uint32_t size)
+Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char *data,
+                                           size_t length,
+                                           Nan::FreeCallback callback,
+                                           void *hint)
+```
+
+
+<a name="api_nan_copy_buffer"></a>
+### Nan::CopyBuffer()
+
+Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`.
+
+Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Object> Nan::CopyBuffer(const char *data, uint32_t size)
+```
+
+
+<a name="api_nan_free_callback"></a>
+### Nan::FreeCallback()
+
+A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer).
+The supplied callback will be invoked when the `Buffer` undergoes garbage collection.
+
+Signature:
+
+```c++
+typedef void (*FreeCallback)(char *data, void *hint);
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/callback.md b/legacy-libs/grpc/node_modules/nan/doc/callback.md
new file mode 100644 (file)
index 0000000..f7af0bf
--- /dev/null
@@ -0,0 +1,76 @@
+## Nan::Callback
+
+`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution.
+
+ - <a href="#api_nan_callback"><b><code>Nan::Callback</code></b></a>
+
+<a name="api_nan_callback"></a>
+### Nan::Callback
+
+```c++
+class Callback {
+ public:
+  Callback();
+
+  explicit Callback(const v8::Local<v8::Function> &fn);
+
+  ~Callback();
+
+  bool operator==(const Callback &other) const;
+
+  bool operator!=(const Callback &other) const;
+
+  v8::Local<v8::Function> operator*() const;
+
+  MaybeLocal<v8::Value> operator()(AsyncResource* async_resource,
+                                   v8::Local<v8::Object> target,
+                                   int argc = 0,
+                                   v8::Local<v8::Value> argv[] = 0) const;
+
+  MaybeLocal<v8::Value> operator()(AsyncResource* async_resource,
+                                   int argc = 0,
+                                   v8::Local<v8::Value> argv[] = 0) const;
+
+  void SetFunction(const v8::Local<v8::Function> &fn);
+
+  v8::Local<v8::Function> GetFunction() const;
+
+  bool IsEmpty() const;
+
+  void Reset(const v8::Local<v8::Function> &fn);
+
+  void Reset();
+
+  MaybeLocal<v8::Value> Call(v8::Local<v8::Object> target,
+                            int argc,
+                            v8::Local<v8::Value> argv[],
+                            AsyncResource* async_resource) const;
+  MaybeLocal<v8::Value> Call(int argc,
+                             v8::Local<v8::Value> argv[],
+                             AsyncResource* async_resource) const;
+
+  // Deprecated versions. Use the versions that accept an async_resource instead
+  // as they run the callback in the correct async context as specified by the
+  // resource. If you want to call a synchronous JS function (i.e. on a
+  // non-empty JS stack), you can use Nan::Call instead.
+  v8::Local<v8::Value> operator()(v8::Local<v8::Object> target,
+                                  int argc = 0,
+                                  v8::Local<v8::Value> argv[] = 0) const;
+
+  v8::Local<v8::Value> operator()(int argc = 0,
+                                  v8::Local<v8::Value> argv[] = 0) const;
+  v8::Local<v8::Value> Call(v8::Local<v8::Object> target,
+                            int argc,
+                            v8::Local<v8::Value> argv[]) const;
+
+  v8::Local<v8::Value> Call(int argc, v8::Local<v8::Value> argv[]) const;
+};
+```
+
+Example usage:
+
+```c++
+v8::Local<v8::Function> function;
+Nan::Callback callback(function);
+callback.Call(0, 0);
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/converters.md b/legacy-libs/grpc/node_modules/nan/doc/converters.md
new file mode 100644 (file)
index 0000000..d20861b
--- /dev/null
@@ -0,0 +1,41 @@
+## Converters
+
+NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN.
+
+ - <a href="#api_nan_to"><b><code>Nan::To()</code></b></a>
+
+<a name="api_nan_to"></a>
+### Nan::To()
+
+Converts a `v8::Local<v8::Value>` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly.
+
+See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types.
+
+Signatures:
+
+```c++
+// V8 types
+Nan::MaybeLocal<v8::Boolean> Nan::To<v8::Boolean>(v8::Local<v8::Value> val);
+Nan::MaybeLocal<v8::Int32> Nan::To<v8::Int32>(v8::Local<v8::Value> val);
+Nan::MaybeLocal<v8::Integer> Nan::To<v8::Integer>(v8::Local<v8::Value> val);
+Nan::MaybeLocal<v8::Object> Nan::To<v8::Object>(v8::Local<v8::Value> val);
+Nan::MaybeLocal<v8::Number> Nan::To<v8::Number>(v8::Local<v8::Value> val);
+Nan::MaybeLocal<v8::String> Nan::To<v8::String>(v8::Local<v8::Value> val);
+Nan::MaybeLocal<v8::Uint32> Nan::To<v8::Uint32>(v8::Local<v8::Value> val);
+
+// Native types
+Nan::Maybe<bool> Nan::To<bool>(v8::Local<v8::Value> val);
+Nan::Maybe<double> Nan::To<double>(v8::Local<v8::Value> val);
+Nan::Maybe<int32_t> Nan::To<int32_t>(v8::Local<v8::Value> val);
+Nan::Maybe<int64_t> Nan::To<int64_t>(v8::Local<v8::Value> val);
+Nan::Maybe<uint32_t> Nan::To<uint32_t>(v8::Local<v8::Value> val);
+```
+
+### Example
+
+```c++
+v8::Local<v8::Value> val;
+Nan::MaybeLocal<v8::String> str = Nan::To<v8::String>(val);
+Nan::Maybe<double> d = Nan::To<double>(val);
+```
+
diff --git a/legacy-libs/grpc/node_modules/nan/doc/errors.md b/legacy-libs/grpc/node_modules/nan/doc/errors.md
new file mode 100644 (file)
index 0000000..843435b
--- /dev/null
@@ -0,0 +1,226 @@
+## Errors
+
+NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted.
+
+Note that an Error object is simply a specialized form of `v8::Value`.
+
+Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information.
+
+ - <a href="#api_nan_error"><b><code>Nan::Error()</code></b></a>
+ - <a href="#api_nan_range_error"><b><code>Nan::RangeError()</code></b></a>
+ - <a href="#api_nan_reference_error"><b><code>Nan::ReferenceError()</code></b></a>
+ - <a href="#api_nan_syntax_error"><b><code>Nan::SyntaxError()</code></b></a>
+ - <a href="#api_nan_type_error"><b><code>Nan::TypeError()</code></b></a>
+ - <a href="#api_nan_throw_error"><b><code>Nan::ThrowError()</code></b></a>
+ - <a href="#api_nan_throw_range_error"><b><code>Nan::ThrowRangeError()</code></b></a>
+ - <a href="#api_nan_throw_reference_error"><b><code>Nan::ThrowReferenceError()</code></b></a>
+ - <a href="#api_nan_throw_syntax_error"><b><code>Nan::ThrowSyntaxError()</code></b></a>
+ - <a href="#api_nan_throw_type_error"><b><code>Nan::ThrowTypeError()</code></b></a>
+ - <a href="#api_nan_fatal_exception"><b><code>Nan::FatalException()</code></b></a>
+ - <a href="#api_nan_errno_exception"><b><code>Nan::ErrnoException()</code></b></a>
+ - <a href="#api_nan_try_catch"><b><code>Nan::TryCatch</code></b></a>
+
+
+<a name="api_nan_error"></a>
+### Nan::Error()
+
+Create a new Error object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8.
+
+Note that an Error object is simply a specialized form of `v8::Value`.
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::Error(const char *msg);
+v8::Local<v8::Value> Nan::Error(v8::Local<v8::String> msg);
+```
+
+
+<a name="api_nan_range_error"></a>
+### Nan::RangeError()
+
+Create a new RangeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8.
+
+Note that an RangeError object is simply a specialized form of `v8::Value`.
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::RangeError(const char *msg);
+v8::Local<v8::Value> Nan::RangeError(v8::Local<v8::String> msg);
+```
+
+
+<a name="api_nan_reference_error"></a>
+### Nan::ReferenceError()
+
+Create a new ReferenceError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8.
+
+Note that an ReferenceError object is simply a specialized form of `v8::Value`.
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::ReferenceError(const char *msg);
+v8::Local<v8::Value> Nan::ReferenceError(v8::Local<v8::String> msg);
+```
+
+
+<a name="api_nan_syntax_error"></a>
+### Nan::SyntaxError()
+
+Create a new SyntaxError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8.
+
+Note that an SyntaxError object is simply a specialized form of `v8::Value`.
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::SyntaxError(const char *msg);
+v8::Local<v8::Value> Nan::SyntaxError(v8::Local<v8::String> msg);
+```
+
+
+<a name="api_nan_type_error"></a>
+### Nan::TypeError()
+
+Create a new TypeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8.
+
+Note that an TypeError object is simply a specialized form of `v8::Value`.
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::TypeError(const char *msg);
+v8::Local<v8::Value> Nan::TypeError(v8::Local<v8::String> msg);
+```
+
+
+<a name="api_nan_throw_error"></a>
+### Nan::ThrowError()
+
+Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created.
+
+Signature:
+
+```c++
+void Nan::ThrowError(const char *msg);
+void Nan::ThrowError(v8::Local<v8::String> msg);
+void Nan::ThrowError(v8::Local<v8::Value> error);
+```
+
+
+<a name="api_nan_throw_range_error"></a>
+### Nan::ThrowRangeError()
+
+Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created.
+
+Signature:
+
+```c++
+void Nan::ThrowRangeError(const char *msg);
+void Nan::ThrowRangeError(v8::Local<v8::String> msg);
+void Nan::ThrowRangeError(v8::Local<v8::Value> error);
+```
+
+
+<a name="api_nan_throw_reference_error"></a>
+### Nan::ThrowReferenceError()
+
+Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created.
+
+Signature:
+
+```c++
+void Nan::ThrowReferenceError(const char *msg);
+void Nan::ThrowReferenceError(v8::Local<v8::String> msg);
+void Nan::ThrowReferenceError(v8::Local<v8::Value> error);
+```
+
+
+<a name="api_nan_throw_syntax_error"></a>
+### Nan::ThrowSyntaxError()
+
+Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created.
+
+Signature:
+
+```c++
+void Nan::ThrowSyntaxError(const char *msg);
+void Nan::ThrowSyntaxError(v8::Local<v8::String> msg);
+void Nan::ThrowSyntaxError(v8::Local<v8::Value> error);
+```
+
+
+<a name="api_nan_throw_type_error"></a>
+### Nan::ThrowTypeError()
+
+Throw an TypeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new TypeError object will be created.
+
+Signature:
+
+```c++
+void Nan::ThrowTypeError(const char *msg);
+void Nan::ThrowTypeError(v8::Local<v8::String> msg);
+void Nan::ThrowTypeError(v8::Local<v8::Value> error);
+```
+
+<a name="api_nan_fatal_exception"></a>
+### Nan::FatalException()
+
+Replaces `node::FatalException()` which has a different API across supported versions of Node. For use with [`Nan::TryCatch`](#api_nan_try_catch).
+
+Signature:
+
+```c++
+void Nan::FatalException(const Nan::TryCatch& try_catch);
+```
+
+<a name="api_nan_errno_exception"></a>
+### Nan::ErrnoException()
+
+Replaces `node::ErrnoException()` which has a different API across supported versions of Node. 
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::ErrnoException(int errorno,
+                                         const char* syscall = NULL,
+                                         const char* message = NULL,
+                                         const char* path = NULL);
+```
+
+
+<a name="api_nan_try_catch"></a>
+### Nan::TryCatch
+
+A simple wrapper around [`v8::TryCatch`](https://v8docs.nodesource.com/node-8.16/d4/dc6/classv8_1_1_try_catch.html) compatible with all supported versions of V8. Can be used as a direct replacement in most cases. See also [`Nan::FatalException()`](#api_nan_fatal_exception) for an internal use compatible with `node::FatalException`.
+
+Signature:
+
+```c++
+class Nan::TryCatch {
+ public:
+  Nan::TryCatch();
+
+  bool HasCaught() const;
+
+  bool CanContinue() const;
+
+  v8::Local<v8::Value> ReThrow();
+
+  v8::Local<v8::Value> Exception() const;
+
+  // Nan::MaybeLocal for older versions of V8
+  v8::MaybeLocal<v8::Value> StackTrace() const;
+
+  v8::Local<v8::Message> Message() const;
+
+  void Reset();
+
+  void SetVerbose(bool value);
+
+  void SetCaptureMessage(bool value);
+};
+```
+
diff --git a/legacy-libs/grpc/node_modules/nan/doc/json.md b/legacy-libs/grpc/node_modules/nan/doc/json.md
new file mode 100644 (file)
index 0000000..d142597
--- /dev/null
@@ -0,0 +1,62 @@
+## JSON
+
+The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object.
+
+ - <a href="#api_nan_json_parse"><b><code>Nan::JSON.Parse</code></b></a>
+ - <a href="#api_nan_json_stringify"><b><code>Nan::JSON.Stringify</code></b></a>
+
+Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments.
+
+<a name="api_nan_json_parse"></a>
+
+### Nan::JSON.Parse
+
+A simple wrapper around [`v8::JSON::Parse`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a936310d2540fb630ed37d3ee3ffe4504).
+
+Definition:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::JSON::Parse(v8::Local<v8::String> json_string);
+```
+
+Use `JSON.Parse(json_string)` to parse a string into a `v8::Value`.
+
+Example:
+
+```c++
+v8::Local<v8::String> json_string = Nan::New("{ \"JSON\": \"object\" }").ToLocalChecked();
+
+Nan::JSON NanJSON;
+Nan::MaybeLocal<v8::Value> result = NanJSON.Parse(json_string);
+if (!result.IsEmpty()) {
+  v8::Local<v8::Value> val = result.ToLocalChecked();
+}
+```
+
+<a name="api_nan_json_stringify"></a>
+
+### Nan::JSON.Stringify
+
+A simple wrapper around [`v8::JSON::Stringify`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a44b255c3531489ce43f6110209138860).
+
+Definition:
+
+```c++
+Nan::MaybeLocal<v8::String> Nan::JSON::Stringify(v8::Local<v8::Object> json_object, v8::Local<v8::String> gap = v8::Local<v8::String>());
+```
+
+Use `JSON.Stringify(value)` to stringify a `v8::Object`.
+
+Example:
+
+```c++
+// using `v8::Local<v8::Value> val` from the `JSON::Parse` example
+v8::Local<v8::Object> obj = Nan::To<v8::Object>(val).ToLocalChecked();
+
+Nan::JSON NanJSON;
+Nan::MaybeLocal<v8::String> result = NanJSON.Stringify(obj);
+if (!result.IsEmpty()) {
+  v8::Local<v8::String> stringified = result.ToLocalChecked();
+}
+```
+
diff --git a/legacy-libs/grpc/node_modules/nan/doc/maybe_types.md b/legacy-libs/grpc/node_modules/nan/doc/maybe_types.md
new file mode 100644 (file)
index 0000000..142851a
--- /dev/null
@@ -0,0 +1,583 @@
+## Maybe Types
+
+The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_.
+
+* **Maybe Types**
+  - <a href="#api_nan_maybe_local"><b><code>Nan::MaybeLocal</code></b></a>
+  - <a href="#api_nan_maybe"><b><code>Nan::Maybe</code></b></a>
+  - <a href="#api_nan_nothing"><b><code>Nan::Nothing</code></b></a>
+  - <a href="#api_nan_just"><b><code>Nan::Just</code></b></a>
+* **Maybe Helpers**
+  - <a href="#api_nan_call"><b><code>Nan::Call()</code></b></a>
+  - <a href="#api_nan_to_detail_string"><b><code>Nan::ToDetailString()</code></b></a>
+  - <a href="#api_nan_to_array_index"><b><code>Nan::ToArrayIndex()</code></b></a>
+  - <a href="#api_nan_equals"><b><code>Nan::Equals()</code></b></a>
+  - <a href="#api_nan_new_instance"><b><code>Nan::NewInstance()</code></b></a>
+  - <a href="#api_nan_get_function"><b><code>Nan::GetFunction()</code></b></a>
+  - <a href="#api_nan_set"><b><code>Nan::Set()</code></b></a>
+  - <a href="#api_nan_define_own_property"><b><code>Nan::DefineOwnProperty()</code></b></a>
+  - <a href="#api_nan_force_set"><del><b><code>Nan::ForceSet()</code></b></del></a>
+  - <a href="#api_nan_get"><b><code>Nan::Get()</code></b></a>
+  - <a href="#api_nan_get_property_attribute"><b><code>Nan::GetPropertyAttributes()</code></b></a>
+  - <a href="#api_nan_has"><b><code>Nan::Has()</code></b></a>
+  - <a href="#api_nan_delete"><b><code>Nan::Delete()</code></b></a>
+  - <a href="#api_nan_get_property_names"><b><code>Nan::GetPropertyNames()</code></b></a>
+  - <a href="#api_nan_get_own_property_names"><b><code>Nan::GetOwnPropertyNames()</code></b></a>
+  - <a href="#api_nan_set_prototype"><b><code>Nan::SetPrototype()</code></b></a>
+  - <a href="#api_nan_object_proto_to_string"><b><code>Nan::ObjectProtoToString()</code></b></a>
+  - <a href="#api_nan_has_own_property"><b><code>Nan::HasOwnProperty()</code></b></a>
+  - <a href="#api_nan_has_real_named_property"><b><code>Nan::HasRealNamedProperty()</code></b></a>
+  - <a href="#api_nan_has_real_indexed_property"><b><code>Nan::HasRealIndexedProperty()</code></b></a>
+  - <a href="#api_nan_has_real_named_callback_property"><b><code>Nan::HasRealNamedCallbackProperty()</code></b></a>
+  - <a href="#api_nan_get_real_named_property_in_prototype_chain"><b><code>Nan::GetRealNamedPropertyInPrototypeChain()</code></b></a>
+  - <a href="#api_nan_get_real_named_property"><b><code>Nan::GetRealNamedProperty()</code></b></a>
+  - <a href="#api_nan_call_as_function"><b><code>Nan::CallAsFunction()</code></b></a>
+  - <a href="#api_nan_call_as_constructor"><b><code>Nan::CallAsConstructor()</code></b></a>
+  - <a href="#api_nan_get_source_line"><b><code>Nan::GetSourceLine()</code></b></a>
+  - <a href="#api_nan_get_line_number"><b><code>Nan::GetLineNumber()</code></b></a>
+  - <a href="#api_nan_get_start_column"><b><code>Nan::GetStartColumn()</code></b></a>
+  - <a href="#api_nan_get_end_column"><b><code>Nan::GetEndColumn()</code></b></a>
+  - <a href="#api_nan_clone_element_at"><b><code>Nan::CloneElementAt()</code></b></a>
+  - <a href="#api_nan_has_private"><b><code>Nan::HasPrivate()</code></b></a>
+  - <a href="#api_nan_get_private"><b><code>Nan::GetPrivate()</code></b></a>
+  - <a href="#api_nan_set_private"><b><code>Nan::SetPrivate()</code></b></a>
+  - <a href="#api_nan_delete_private"><b><code>Nan::DeletePrivate()</code></b></a>
+  - <a href="#api_nan_make_maybe"><b><code>Nan::MakeMaybe()</code></b></a>
+
+<a name="api_nan_maybe_local"></a>
+### Nan::MaybeLocal
+
+A `Nan::MaybeLocal<T>` is a wrapper around [`v8::Local<T>`](https://v8docs.nodesource.com/node-8.16/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local<T>` is empty before it can be used.
+
+If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned.
+
+Definition:
+
+```c++
+template<typename T> class Nan::MaybeLocal {
+ public:
+  MaybeLocal();
+
+  template<typename S> MaybeLocal(v8::Local<S> that);
+
+  bool IsEmpty() const;
+
+  template<typename S> bool ToLocal(v8::Local<S> *out);
+
+  // Will crash if the MaybeLocal<> is empty.
+  v8::Local<T> ToLocalChecked();
+
+  template<typename S> v8::Local<S> FromMaybe(v8::Local<S> default_value) const;
+};
+```
+
+See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.16/d8/d7d/classv8_1_1_maybe_local.html) for further details.
+
+<a name="api_nan_maybe"></a>
+### Nan::Maybe
+
+A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
+
+If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned.
+
+Definition:
+
+```c++
+template<typename T> class Nan::Maybe {
+ public:
+  bool IsNothing() const;
+  bool IsJust() const;
+
+  // Will crash if the Maybe<> is nothing.
+  T FromJust();
+
+  T FromMaybe(const T& default_value);
+
+  bool operator==(const Maybe &other);
+
+  bool operator!=(const Maybe &other);
+};
+```
+
+See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.16/d9/d4b/classv8_1_1_maybe.html) for further details.
+
+<a name="api_nan_nothing"></a>
+### Nan::Nothing
+
+Construct an empty `Nan::Maybe` type representing _nothing_.
+
+```c++
+template<typename T> Nan::Maybe<T> Nan::Nothing();
+```
+
+<a name="api_nan_just"></a>
+### Nan::Just
+
+Construct a `Nan::Maybe` type representing _just_ a value.
+
+```c++
+template<typename T> Nan::Maybe<T> Nan::Just(const T &t);
+```
+
+<a name="api_nan_call"></a>
+### Nan::Call()
+
+A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8.
+
+For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::Call(v8::Local<v8::Function> fun, v8::Local<v8::Object> recv, int argc, v8::Local<v8::Value> argv[]);
+Nan::MaybeLocal<v8::Value> Nan::Call(const Nan::Callback& callback, v8::Local<v8::Object> recv,
+ int argc, v8::Local<v8::Value> argv[]);
+Nan::MaybeLocal<v8::Value> Nan::Call(const Nan::Callback& callback, int argc, v8::Local<v8::Value> argv[]);
+```
+
+
+<a name="api_nan_to_detail_string"></a>
+### Nan::ToDetailString()
+
+A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::String> Nan::ToDetailString(v8::Local<v8::Value> val);
+```
+
+
+<a name="api_nan_to_array_index"></a>
+### Nan::ToArrayIndex()
+
+A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Uint32> Nan::ToArrayIndex(v8::Local<v8::Value> val);
+```
+
+
+<a name="api_nan_equals"></a>
+### Nan::Equals()
+
+A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::Equals(v8::Local<v8::Value> a, v8::Local<v8::Value>(b));
+```
+
+
+<a name="api_nan_new_instance"></a>
+### Nan::NewInstance()
+
+A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Object> Nan::NewInstance(v8::Local<v8::Function> h);
+Nan::MaybeLocal<v8::Object> Nan::NewInstance(v8::Local<v8::Function> h, int argc, v8::Local<v8::Value> argv[]);
+Nan::MaybeLocal<v8::Object> Nan::NewInstance(v8::Local<v8::ObjectTemplate> h);
+```
+
+
+<a name="api_nan_get_function"></a>
+### Nan::GetFunction()
+
+A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Function> Nan::GetFunction(v8::Local<v8::FunctionTemplate> t);
+```
+
+
+<a name="api_nan_set"></a>
+### Nan::Set()
+
+A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::Set(v8::Local<v8::Object> obj,
+                          v8::Local<v8::Value> key,
+                          v8::Local<v8::Value> value)
+Nan::Maybe<bool> Nan::Set(v8::Local<v8::Object> obj,
+                          uint32_t index,
+                          v8::Local<v8::Value> value);
+```
+
+
+<a name="api_nan_define_own_property"></a>
+### Nan::DefineOwnProperty()
+
+A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::DefineOwnProperty(v8::Local<v8::Object> obj,
+                                        v8::Local<v8::String> key,
+                                        v8::Local<v8::Value> value,
+                                        v8::PropertyAttribute attribs = v8::None);
+```
+
+
+<a name="api_nan_force_set"></a>
+### <del>Nan::ForceSet()</del>
+
+Deprecated, use <a href="#api_nan_define_own_property"><code>Nan::DefineOwnProperty()</code></a>.
+
+<del>A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8.</del>
+
+Signature:
+
+```c++
+NAN_DEPRECATED Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object> obj,
+                                              v8::Local<v8::Value> key,
+                                              v8::Local<v8::Value> value,
+                                              v8::PropertyAttribute attribs = v8::None);
+```
+
+
+<a name="api_nan_get"></a>
+### Nan::Get()
+
+A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::Get(v8::Local<v8::Object> obj,
+                                    v8::Local<v8::Value> key);
+Nan::MaybeLocal<v8::Value> Nan::Get(v8::Local<v8::Object> obj, uint32_t index);
+```
+
+
+<a name="api_nan_get_property_attribute"></a>
+### Nan::GetPropertyAttributes()
+
+A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<v8::PropertyAttribute> Nan::GetPropertyAttributes(
+    v8::Local<v8::Object> obj,
+    v8::Local<v8::Value> key);
+```
+
+
+<a name="api_nan_has"></a>
+### Nan::Has()
+
+A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::Has(v8::Local<v8::Object> obj, v8::Local<v8::String> key);
+Nan::Maybe<bool> Nan::Has(v8::Local<v8::Object> obj, uint32_t index);
+```
+
+
+<a name="api_nan_delete"></a>
+### Nan::Delete()
+
+A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::Delete(v8::Local<v8::Object> obj,
+                             v8::Local<v8::String> key);
+Nan::Maybe<bool> Nan::Delete(v8::Local<v8::Object> obj, uint32_t index);
+```
+
+
+<a name="api_nan_get_property_names"></a>
+### Nan::GetPropertyNames()
+
+A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Array> Nan::GetPropertyNames(v8::Local<v8::Object> obj);
+```
+
+
+<a name="api_nan_get_own_property_names"></a>
+### Nan::GetOwnPropertyNames()
+
+A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Array> Nan::GetOwnPropertyNames(v8::Local<v8::Object> obj);
+```
+
+
+<a name="api_nan_set_prototype"></a>
+### Nan::SetPrototype()
+
+A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::SetPrototype(v8::Local<v8::Object> obj,
+                                   v8::Local<v8::Value> prototype);
+```
+
+
+<a name="api_nan_object_proto_to_string"></a>
+### Nan::ObjectProtoToString()
+
+A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::String> Nan::ObjectProtoToString(v8::Local<v8::Object> obj);
+```
+
+
+<a name="api_nan_has_own_property"></a>
+### Nan::HasOwnProperty()
+
+A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::HasOwnProperty(v8::Local<v8::Object> obj,
+                                     v8::Local<v8::String> key);
+```
+
+
+<a name="api_nan_has_real_named_property"></a>
+### Nan::HasRealNamedProperty()
+
+A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::HasRealNamedProperty(v8::Local<v8::Object> obj,
+                                           v8::Local<v8::String> key);
+```
+
+
+<a name="api_nan_has_real_indexed_property"></a>
+### Nan::HasRealIndexedProperty()
+
+A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::HasRealIndexedProperty(v8::Local<v8::Object> obj,
+                                             uint32_t index);
+```
+
+
+<a name="api_nan_has_real_named_callback_property"></a>
+### Nan::HasRealNamedCallbackProperty()
+
+A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::HasRealNamedCallbackProperty(
+    v8::Local<v8::Object> obj,
+    v8::Local<v8::String> key);
+```
+
+
+<a name="api_nan_get_real_named_property_in_prototype_chain"></a>
+### Nan::GetRealNamedPropertyInPrototypeChain()
+
+A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::GetRealNamedPropertyInPrototypeChain(
+    v8::Local<v8::Object> obj,
+    v8::Local<v8::String> key);
+```
+
+
+<a name="api_nan_get_real_named_property"></a>
+### Nan::GetRealNamedProperty()
+
+A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::GetRealNamedProperty(v8::Local<v8::Object> obj,
+                                                     v8::Local<v8::String> key);
+```
+
+
+<a name="api_nan_call_as_function"></a>
+### Nan::CallAsFunction()
+
+A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::CallAsFunction(v8::Local<v8::Object> obj,
+                                               v8::Local<v8::Object> recv,
+                                               int argc,
+                                               v8::Local<v8::Value> argv[]);
+```
+
+
+<a name="api_nan_call_as_constructor"></a>
+### Nan::CallAsConstructor()
+
+A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::CallAsConstructor(v8::Local<v8::Object> obj,
+                                                  int argc,
+                                                  v8::Local<v8::Value> argv[]);
+```
+
+
+<a name="api_nan_get_source_line"></a>
+### Nan::GetSourceLine()
+
+A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::String> Nan::GetSourceLine(v8::Local<v8::Message> msg);
+```
+
+
+<a name="api_nan_get_line_number"></a>
+### Nan::GetLineNumber()
+
+A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<int> Nan::GetLineNumber(v8::Local<v8::Message> msg);
+```
+
+
+<a name="api_nan_get_start_column"></a>
+### Nan::GetStartColumn()
+
+A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<int> Nan::GetStartColumn(v8::Local<v8::Message> msg);
+```
+
+
+<a name="api_nan_get_end_column"></a>
+### Nan::GetEndColumn()
+
+A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<int> Nan::GetEndColumn(v8::Local<v8::Message> msg);
+```
+
+
+<a name="api_nan_clone_element_at"></a>
+### Nan::CloneElementAt()
+
+A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Object> Nan::CloneElementAt(v8::Local<v8::Array> array, uint32_t index);
+```
+
+<a name="api_nan_has_private"></a>
+### Nan::HasPrivate()
+
+A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::HasPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key);
+```
+
+<a name="api_nan_get_private"></a>
+### Nan::GetPrivate()
+
+A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::GetPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key);
+```
+
+<a name="api_nan_set_private"></a>
+### Nan::SetPrivate()
+
+A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::SetPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key, v8::Local<v8::Value> value);
+```
+
+<a name="api_nan_delete_private"></a>
+### Nan::DeletePrivate()
+
+A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::Maybe<bool> Nan::DeletePrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key);
+```
+
+<a name="api_nan_make_maybe"></a>
+### Nan::MakeMaybe()
+
+Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN.
+
+Synopsis:
+
+```c++
+  MaybeLocal<v8::Number> someNumber = MakeMaybe(New<v8::Number>(3.141592654));
+  MaybeLocal<v8::String> someString = MakeMaybe(New<v8::String>("probably"));
+```
+
+Signature:
+
+```c++
+template <typename T, template <typename> class MaybeMaybe>
+Nan::MaybeLocal<T> Nan::MakeMaybe(MaybeMaybe<T> v);
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/methods.md b/legacy-libs/grpc/node_modules/nan/doc/methods.md
new file mode 100644 (file)
index 0000000..9642d02
--- /dev/null
@@ -0,0 +1,664 @@
+## JavaScript-accessible methods
+
+A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information.
+
+In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type.
+
+* **Method argument types**
+ - <a href="#api_nan_function_callback_info"><b><code>Nan::FunctionCallbackInfo</code></b></a>
+ - <a href="#api_nan_property_callback_info"><b><code>Nan::PropertyCallbackInfo</code></b></a>
+ - <a href="#api_nan_return_value"><b><code>Nan::ReturnValue</code></b></a>
+* **Method declarations**
+ - <a href="#api_nan_method"><b>Method declaration</b></a>
+ - <a href="#api_nan_getter"><b>Getter declaration</b></a>
+ - <a href="#api_nan_setter"><b>Setter declaration</b></a>
+ - <a href="#api_nan_property_getter"><b>Property getter declaration</b></a>
+ - <a href="#api_nan_property_setter"><b>Property setter declaration</b></a>
+ - <a href="#api_nan_property_enumerator"><b>Property enumerator declaration</b></a>
+ - <a href="#api_nan_property_deleter"><b>Property deleter declaration</b></a>
+ - <a href="#api_nan_property_query"><b>Property query declaration</b></a>
+ - <a href="#api_nan_index_getter"><b>Index getter declaration</b></a>
+ - <a href="#api_nan_index_setter"><b>Index setter declaration</b></a>
+ - <a href="#api_nan_index_enumerator"><b>Index enumerator declaration</b></a>
+ - <a href="#api_nan_index_deleter"><b>Index deleter declaration</b></a>
+ - <a href="#api_nan_index_query"><b>Index query declaration</b></a>
+* Method and template helpers
+ - <a href="#api_nan_set_method"><b><code>Nan::SetMethod()</code></b></a>
+ - <a href="#api_nan_set_prototype_method"><b><code>Nan::SetPrototypeMethod()</code></b></a>
+ - <a href="#api_nan_set_accessor"><b><code>Nan::SetAccessor()</code></b></a>
+ - <a href="#api_nan_set_named_property_handler"><b><code>Nan::SetNamedPropertyHandler()</code></b></a>
+ - <a href="#api_nan_set_indexed_property_handler"><b><code>Nan::SetIndexedPropertyHandler()</code></b></a>
+ - <a href="#api_nan_set_template"><b><code>Nan::SetTemplate()</code></b></a>
+ - <a href="#api_nan_set_prototype_template"><b><code>Nan::SetPrototypeTemplate()</code></b></a>
+ - <a href="#api_nan_set_instance_template"><b><code>Nan::SetInstanceTemplate()</code></b></a>
+ - <a href="#api_nan_set_call_handler"><b><code>Nan::SetCallHandler()</code></b></a>
+ - <a href="#api_nan_set_call_as_function_handler"><b><code>Nan::SetCallAsFunctionHandler()</code></b></a>
+
+<a name="api_nan_function_callback_info"></a>
+### Nan::FunctionCallbackInfo
+
+`Nan::FunctionCallbackInfo` should be used in place of [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html), even with older versions of Node where `v8::FunctionCallbackInfo` does not exist.
+
+Definition:
+
+```c++
+template<typename T> class FunctionCallbackInfo {
+ public:
+  ReturnValue<T> GetReturnValue() const;
+  v8::Local<v8::Function> Callee(); // NOTE: Not available in NodeJS >= 10.0.0
+  v8::Local<v8::Value> Data();
+  v8::Local<v8::Object> Holder();
+  bool IsConstructCall();
+  int Length() const;
+  v8::Local<v8::Value> operator[](int i) const;
+  v8::Local<v8::Object> This() const;
+  v8::Isolate *GetIsolate() const;
+};
+```
+
+See the [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from methods.
+
+**Note:** `FunctionCallbackInfo::Callee` is removed in Node.js after `10.0.0` because it is was deprecated in V8. Consider using `info.Data()` to pass any information you need.
+
+<a name="api_nan_property_callback_info"></a>
+### Nan::PropertyCallbackInfo
+
+`Nan::PropertyCallbackInfo` should be used in place of [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html), even with older versions of Node where `v8::PropertyCallbackInfo` does not exist.
+
+Definition:
+
+```c++
+template<typename T> class PropertyCallbackInfo : public PropertyCallbackInfoBase<T> {
+ public:
+  ReturnValue<T> GetReturnValue() const;
+  v8::Isolate* GetIsolate() const;
+  v8::Local<v8::Value> Data() const;
+  v8::Local<v8::Object> This() const;
+  v8::Local<v8::Object> Holder() const;
+};
+```
+
+See the [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from property accessor methods.
+
+<a name="api_nan_return_value"></a>
+### Nan::ReturnValue
+
+`Nan::ReturnValue` is used in place of [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) on both [`Nan::FunctionCallbackInfo`](#api_nan_function_callback_info) and [`Nan::PropertyCallbackInfo`](#api_nan_property_callback_info) as the return type of `GetReturnValue()`.
+
+Example usage:
+
+```c++
+void EmptyArray(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+  info.GetReturnValue().Set(Nan::New<v8::Array>());
+}
+```
+
+Definition:
+
+```c++
+template<typename T> class ReturnValue {
+ public:
+  // Handle setters
+  template <typename S> void Set(const v8::Local<S> &handle);
+  template <typename S> void Set(const Nan::Global<S> &handle);
+
+  // Fast primitive setters
+  void Set(bool value);
+  void Set(double i);
+  void Set(int32_t i);
+  void Set(uint32_t i);
+
+  // Fast JS primitive setters
+  void SetNull();
+  void SetUndefined();
+  void SetEmptyString();
+
+  // Convenience getter for isolate
+  v8::Isolate *GetIsolate() const;
+};
+```
+
+See the documentation on [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) for further information on this.
+
+<a name="api_nan_method"></a>
+### Method declaration
+
+JavaScript-accessible methods should be declared with the following signature to form a `Nan::FunctionCallback`:
+
+```c++
+typedef void(*FunctionCallback)(const FunctionCallbackInfo<v8::Value>&);
+```
+
+Example:
+
+```c++
+void MethodName(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+  ...
+}
+```
+
+You do not need to declare a new `HandleScope` within a method as one is implicitly created for you.
+
+**Example usage**
+
+```c++
+// .h:
+class Foo : public Nan::ObjectWrap {
+  ...
+
+  static void Bar(const Nan::FunctionCallbackInfo<v8::Value>& info);
+  static void Baz(const Nan::FunctionCallbackInfo<v8::Value>& info);
+}
+
+
+// .cc:
+void Foo::Bar(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+  ...
+}
+
+void Foo::Baz(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+  ...
+}
+```
+
+A helper macro `NAN_METHOD(methodname)` exists, compatible with NAN v1 method declarations.
+
+**Example usage with `NAN_METHOD(methodname)`**
+
+```c++
+// .h:
+class Foo : public Nan::ObjectWrap {
+  ...
+
+  static NAN_METHOD(Bar);
+  static NAN_METHOD(Baz);
+}
+
+
+// .cc:
+NAN_METHOD(Foo::Bar) {
+  ...
+}
+
+NAN_METHOD(Foo::Baz) {
+  ...
+}
+```
+
+Use [`Nan::SetPrototypeMethod`](#api_nan_set_prototype_method) to attach a method to a JavaScript function prototype or [`Nan::SetMethod`](#api_nan_set_method) to attach a method directly on a JavaScript object.
+
+<a name="api_nan_getter"></a>
+### Getter declaration
+
+JavaScript-accessible getters should be declared with the following signature to form a `Nan::GetterCallback`:
+
+```c++
+typedef void(*GetterCallback)(v8::Local<v8::String>,
+                              const PropertyCallbackInfo<v8::Value>&);
+```
+
+Example:
+
+```c++
+void GetterName(v8::Local<v8::String> property,
+                const Nan::PropertyCallbackInfo<v8::Value>& info) {
+  ...
+}
+```
+
+You do not need to declare a new `HandleScope` within a getter as one is implicitly created for you.
+
+A helper macro `NAN_GETTER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors).
+
+<a name="api_nan_setter"></a>
+### Setter declaration
+
+JavaScript-accessible setters should be declared with the following signature to form a <b><code>Nan::SetterCallback</code></b>:
+
+```c++
+typedef void(*SetterCallback)(v8::Local<v8::String>,
+                              v8::Local<v8::Value>,
+                              const PropertyCallbackInfo<void>&);
+```
+
+Example:
+
+```c++
+void SetterName(v8::Local<v8::String> property,
+                v8::Local<v8::Value> value,
+                const Nan::PropertyCallbackInfo<void>& info) {
+  ...
+}
+```
+
+You do not need to declare a new `HandleScope` within a setter as one is implicitly created for you.
+
+A helper macro `NAN_SETTER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors).
+
+<a name="api_nan_property_getter"></a>
+### Property getter declaration
+
+JavaScript-accessible property getters should be declared with the following signature to form a <b><code>Nan::PropertyGetterCallback</code></b>:
+
+```c++
+typedef void(*PropertyGetterCallback)(v8::Local<v8::String>,
+                                      const PropertyCallbackInfo<v8::Value>&);
+```
+
+Example:
+
+```c++
+void PropertyGetterName(v8::Local<v8::String> property,
+                        const Nan::PropertyCallbackInfo<v8::Value>& info) {
+  ...
+}
+```
+
+You do not need to declare a new `HandleScope` within a property getter as one is implicitly created for you.
+
+A helper macro `NAN_PROPERTY_GETTER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_property_setter"></a>
+### Property setter declaration
+
+JavaScript-accessible property setters should be declared with the following signature to form a <b><code>Nan::PropertySetterCallback</code></b>:
+
+```c++
+typedef void(*PropertySetterCallback)(v8::Local<v8::String>,
+                                      v8::Local<v8::Value>,
+                                      const PropertyCallbackInfo<v8::Value>&);
+```
+
+Example:
+
+```c++
+void PropertySetterName(v8::Local<v8::String> property,
+                        v8::Local<v8::Value> value,
+                        const Nan::PropertyCallbackInfo<v8::Value>& info);
+```
+
+You do not need to declare a new `HandleScope` within a property setter as one is implicitly created for you.
+
+A helper macro `NAN_PROPERTY_SETTER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_property_enumerator"></a>
+### Property enumerator declaration
+
+JavaScript-accessible property enumerators should be declared with the following signature to form a <b><code>Nan::PropertyEnumeratorCallback</code></b>:
+
+```c++
+typedef void(*PropertyEnumeratorCallback)(const PropertyCallbackInfo<v8::Array>&);
+```
+
+Example:
+
+```c++
+void PropertyEnumeratorName(const Nan::PropertyCallbackInfo<v8::Array>& info);
+```
+
+You do not need to declare a new `HandleScope` within a property enumerator as one is implicitly created for you.
+
+A helper macro `NAN_PROPERTY_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_property_deleter"></a>
+### Property deleter declaration
+
+JavaScript-accessible property deleters should be declared with the following signature to form a <b><code>Nan::PropertyDeleterCallback</code></b>:
+
+```c++
+typedef void(*PropertyDeleterCallback)(v8::Local<v8::String>,
+                                       const PropertyCallbackInfo<v8::Boolean>&);
+```
+
+Example:
+
+```c++
+void PropertyDeleterName(v8::Local<v8::String> property,
+                         const Nan::PropertyCallbackInfo<v8::Boolean>& info);
+```
+
+You do not need to declare a new `HandleScope` within a property deleter as one is implicitly created for you.
+
+A helper macro `NAN_PROPERTY_DELETER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_property_query"></a>
+### Property query declaration
+
+JavaScript-accessible property query methods should be declared with the following signature to form a <b><code>Nan::PropertyQueryCallback</code></b>:
+
+```c++
+typedef void(*PropertyQueryCallback)(v8::Local<v8::String>,
+                                     const PropertyCallbackInfo<v8::Integer>&);
+```
+
+Example:
+
+```c++
+void PropertyQueryName(v8::Local<v8::String> property,
+                       const Nan::PropertyCallbackInfo<v8::Integer>& info);
+```
+
+You do not need to declare a new `HandleScope` within a property query method as one is implicitly created for you.
+
+A helper macro `NAN_PROPERTY_QUERY(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_index_getter"></a>
+### Index getter declaration
+
+JavaScript-accessible index getter methods should be declared with the following signature to form a <b><code>Nan::IndexGetterCallback</code></b>:
+
+```c++
+typedef void(*IndexGetterCallback)(uint32_t,
+                                   const PropertyCallbackInfo<v8::Value>&);
+```
+
+Example:
+
+```c++
+void IndexGetterName(uint32_t index, const PropertyCallbackInfo<v8::Value>& info);
+```
+
+You do not need to declare a new `HandleScope` within a index getter as one is implicitly created for you.
+
+A helper macro `NAN_INDEX_GETTER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_index_setter"></a>
+### Index setter declaration
+
+JavaScript-accessible index setter methods should be declared with the following signature to form a <b><code>Nan::IndexSetterCallback</code></b>:
+
+```c++
+typedef void(*IndexSetterCallback)(uint32_t,
+                                   v8::Local<v8::Value>,
+                                   const PropertyCallbackInfo<v8::Value>&);
+```
+
+Example:
+
+```c++
+void IndexSetterName(uint32_t index,
+                     v8::Local<v8::Value> value,
+                     const PropertyCallbackInfo<v8::Value>& info);
+```
+
+You do not need to declare a new `HandleScope` within a index setter as one is implicitly created for you.
+
+A helper macro `NAN_INDEX_SETTER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_index_enumerator"></a>
+### Index enumerator declaration
+
+JavaScript-accessible index enumerator methods should be declared with the following signature to form a <b><code>Nan::IndexEnumeratorCallback</code></b>:
+
+```c++
+typedef void(*IndexEnumeratorCallback)(const PropertyCallbackInfo<v8::Array>&);
+```
+
+Example:
+
+```c++
+void IndexEnumeratorName(const PropertyCallbackInfo<v8::Array>& info);
+```
+
+You do not need to declare a new `HandleScope` within a index enumerator as one is implicitly created for you.
+
+A helper macro `NAN_INDEX_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_index_deleter"></a>
+### Index deleter declaration
+
+JavaScript-accessible index deleter methods should be declared with the following signature to form a <b><code>Nan::IndexDeleterCallback</code></b>:
+
+```c++
+typedef void(*IndexDeleterCallback)(uint32_t,
+                                    const PropertyCallbackInfo<v8::Boolean>&);
+```
+
+Example:
+
+```c++
+void IndexDeleterName(uint32_t index, const PropertyCallbackInfo<v8::Boolean>& info);
+```
+
+You do not need to declare a new `HandleScope` within a index deleter as one is implicitly created for you.
+
+A helper macro `NAN_INDEX_DELETER(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_index_query"></a>
+### Index query declaration
+
+JavaScript-accessible index query methods should be declared with the following signature to form a <b><code>Nan::IndexQueryCallback</code></b>:
+
+```c++
+typedef void(*IndexQueryCallback)(uint32_t,
+                                  const PropertyCallbackInfo<v8::Integer>&);
+```
+
+Example:
+
+```c++
+void IndexQueryName(uint32_t index, const PropertyCallbackInfo<v8::Integer>& info);
+```
+
+You do not need to declare a new `HandleScope` within a index query method as one is implicitly created for you.
+
+A helper macro `NAN_INDEX_QUERY(methodname)` exists, compatible with NAN v1 method declarations.
+
+Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors).
+
+<a name="api_nan_set_method"></a>
+### Nan::SetMethod()
+
+Sets a method with a given name directly on a JavaScript object where the method has the `Nan::FunctionCallback` signature (see <a href="#api_nan_method">Method declaration</a>).
+
+Signature:
+
+```c++
+void Nan::SetMethod(v8::Local<v8::Object> recv,
+                    const char *name,
+                    Nan::FunctionCallback callback,
+                    v8::Local<v8::Value> data = v8::Local<v8::Value>())
+void Nan::SetMethod(v8::Local<v8::Template> templ,
+                    const char *name,
+                    Nan::FunctionCallback callback,
+                    v8::Local<v8::Value> data = v8::Local<v8::Value>())
+```
+
+<a name="api_nan_set_prototype_method"></a>
+### Nan::SetPrototypeMethod()
+
+Sets a method with a given name on a `FunctionTemplate`'s prototype where the method has the `Nan::FunctionCallback` signature (see <a href="#api_nan_method">Method declaration</a>).
+
+Signature:
+
+```c++
+void Nan::SetPrototypeMethod(v8::Local<v8::FunctionTemplate> recv,
+                             const char* name,
+                             Nan::FunctionCallback callback,
+                             v8::Local<v8::Value> data = v8::Local<v8::Value>())
+```
+
+<a name="api_nan_set_accessor"></a>
+### Nan::SetAccessor()
+
+Sets getters and setters for a property with a given name on an `ObjectTemplate` or a plain `Object`. Accepts getters with the `Nan::GetterCallback` signature (see <a href="#api_nan_getter">Getter declaration</a>) and setters with the `Nan::SetterCallback` signature (see <a href="#api_nan_setter">Setter declaration</a>).
+
+Signature:
+
+```c++
+void SetAccessor(v8::Local<v8::ObjectTemplate> tpl,
+                 v8::Local<v8::String> name,
+                 Nan::GetterCallback getter,
+                 Nan::SetterCallback setter = 0,
+                 v8::Local<v8::Value> data = v8::Local<v8::Value>(),
+                 v8::AccessControl settings = v8::DEFAULT,
+                 v8::PropertyAttribute attribute = v8::None,
+                 imp::Sig signature = imp::Sig());
+bool SetAccessor(v8::Local<v8::Object> obj,
+                 v8::Local<v8::String> name,
+                 Nan::GetterCallback getter,
+                 Nan::SetterCallback setter = 0,
+                 v8::Local<v8::Value> data = v8::Local<v8::Value>(),
+                 v8::AccessControl settings = v8::DEFAULT,
+                 v8::PropertyAttribute attribute = v8::None)
+```
+
+See the V8 [`ObjectTemplate#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#aca0ed196f8a9adb1f68b1aadb6c9cd77) and [`Object#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ae91b3b56b357f285288c89fbddc46d1b) for further information about how to use `Nan::SetAccessor()`.
+
+<a name="api_nan_set_named_property_handler"></a>
+### Nan::SetNamedPropertyHandler()
+
+Sets named property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts:
+
+* Property getters with the `Nan::PropertyGetterCallback` signature (see <a href="#api_nan_property_getter">Property getter declaration</a>)
+* Property setters with the `Nan::PropertySetterCallback` signature (see <a href="#api_nan_property_setter">Property setter declaration</a>)
+* Property query methods with the `Nan::PropertyQueryCallback` signature (see <a href="#api_nan_property_query">Property query declaration</a>)
+* Property deleters with the `Nan::PropertyDeleterCallback` signature (see <a href="#api_nan_property_deleter">Property deleter declaration</a>)
+* Property enumerators with the `Nan::PropertyEnumeratorCallback` signature (see <a href="#api_nan_property_enumerator">Property enumerator declaration</a>)
+
+Signature:
+
+```c++
+void SetNamedPropertyHandler(v8::Local<v8::ObjectTemplate> tpl,
+                             Nan::PropertyGetterCallback getter,
+                             Nan::PropertySetterCallback setter = 0,
+                             Nan::PropertyQueryCallback query = 0,
+                             Nan::PropertyDeleterCallback deleter = 0,
+                             Nan::PropertyEnumeratorCallback enumerator = 0,
+                             v8::Local<v8::Value> data = v8::Local<v8::Value>())
+```
+
+See the V8 [`ObjectTemplate#SetNamedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a33b3ebd7de641f6cc6414b7de01fc1c7) for further information about how to use `Nan::SetNamedPropertyHandler()`.
+
+<a name="api_nan_set_indexed_property_handler"></a>
+### Nan::SetIndexedPropertyHandler()
+
+Sets indexed property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts:
+
+* Indexed property getters with the `Nan::IndexGetterCallback` signature (see <a href="#api_nan_index_getter">Index getter declaration</a>)
+* Indexed property setters with the `Nan::IndexSetterCallback` signature (see <a href="#api_nan_index_setter">Index setter declaration</a>)
+* Indexed property query methods with the `Nan::IndexQueryCallback` signature (see <a href="#api_nan_index_query">Index query declaration</a>)
+* Indexed property deleters with the `Nan::IndexDeleterCallback` signature (see <a href="#api_nan_index_deleter">Index deleter declaration</a>)
+* Indexed property enumerators with the `Nan::IndexEnumeratorCallback` signature (see <a href="#api_nan_index_enumerator">Index enumerator declaration</a>)
+
+Signature:
+
+```c++
+void SetIndexedPropertyHandler(v8::Local<v8::ObjectTemplate> tpl,
+                               Nan::IndexGetterCallback getter,
+                               Nan::IndexSetterCallback setter = 0,
+                               Nan::IndexQueryCallback query = 0,
+                               Nan::IndexDeleterCallback deleter = 0,
+                               Nan::IndexEnumeratorCallback enumerator = 0,
+                               v8::Local<v8::Value> data = v8::Local<v8::Value>())
+```
+
+See the V8 [`ObjectTemplate#SetIndexedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ac89f06d634add0e890452033f7d17ff1) for further information about how to use `Nan::SetIndexedPropertyHandler()`.
+
+<a name="api_nan_set_template"></a>
+### Nan::SetTemplate()
+
+Adds properties on an `Object`'s or `Function`'s template.
+
+Signature:
+
+```c++
+void Nan::SetTemplate(v8::Local<v8::Template> templ,
+                      const char *name,
+                      v8::Local<v8::Data> value);
+void Nan::SetTemplate(v8::Local<v8::Template> templ,
+                      v8::Local<v8::String> name,
+                      v8::Local<v8::Data> value,
+                      v8::PropertyAttribute attributes)
+```
+
+Calls the `Template`'s [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#ae3fbaff137557aa6a0233bc7e52214ac).
+
+<a name="api_nan_set_prototype_template"></a>
+### Nan::SetPrototypeTemplate()
+
+Adds properties on an `Object`'s or `Function`'s prototype template.
+
+Signature:
+
+```c++
+void Nan::SetPrototypeTemplate(v8::Local<v8::FunctionTemplate> templ,
+                               const char *name,
+                               v8::Local<v8::Data> value);
+void Nan::SetPrototypeTemplate(v8::Local<v8::FunctionTemplate> templ,
+                               v8::Local<v8::String> name,
+                               v8::Local<v8::Data> value,
+                               v8::PropertyAttribute attributes)
+```
+
+Calls the `FunctionTemplate`'s _PrototypeTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf).
+
+<a name="api_nan_set_instance_template"></a>
+### Nan::SetInstanceTemplate()
+
+Use to add instance properties on `FunctionTemplate`'s.
+
+Signature:
+
+```c++
+void Nan::SetInstanceTemplate(v8::Local<v8::FunctionTemplate> templ,
+                              const char *name,
+                              v8::Local<v8::Data> value);
+void Nan::SetInstanceTemplate(v8::Local<v8::FunctionTemplate> templ,
+                              v8::Local<v8::String> name,
+                              v8::Local<v8::Data> value,
+                              v8::PropertyAttribute attributes)
+```
+
+Calls the `FunctionTemplate`'s _InstanceTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf).
+
+<a name="api_nan_set_call_handler"></a>
+### Nan::SetCallHandler()
+
+Set the call-handler callback for a `v8::FunctionTemplate`.
+This callback is called whenever the function created from this FunctionTemplate is called.
+
+Signature:
+
+```c++
+void Nan::SetCallHandler(v8::Local<v8::FunctionTemplate> templ, Nan::FunctionCallback callback, v8::Local<v8::Value> data = v8::Local<v8::Value>())
+```
+
+Calls the `FunctionTemplate`'s [`SetCallHandler()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#ab7574b298db3c27fbc2ed465c08ea2f8).
+
+<a name="api_nan_set_call_as_function_handler"></a>
+### Nan::SetCallAsFunctionHandler()
+
+Sets the callback to be used when calling instances created from the `v8::ObjectTemplate` as a function.
+If no callback is set, instances behave like normal JavaScript objects that cannot be called as a function.
+
+Signature:
+
+```c++
+void Nan::SetCallAsFunctionHandler(v8::Local<v8::ObjectTemplate> templ, Nan::FunctionCallback callback, v8::Local<v8::Value> data = v8::Local<v8::Value>())
+```
+
+Calls the `ObjectTemplate`'s [`SetCallAsFunctionHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a5e9612fc80bf6db8f2da199b9b0bd04e).
+
diff --git a/legacy-libs/grpc/node_modules/nan/doc/new.md b/legacy-libs/grpc/node_modules/nan/doc/new.md
new file mode 100644 (file)
index 0000000..0f28a0e
--- /dev/null
@@ -0,0 +1,147 @@
+## New
+
+NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8.
+
+ - <a href="#api_nan_new"><b><code>Nan::New()</code></b></a>
+ - <a href="#api_nan_undefined"><b><code>Nan::Undefined()</code></b></a>
+ - <a href="#api_nan_null"><b><code>Nan::Null()</code></b></a>
+ - <a href="#api_nan_true"><b><code>Nan::True()</code></b></a>
+ - <a href="#api_nan_false"><b><code>Nan::False()</code></b></a>
+ - <a href="#api_nan_empty_string"><b><code>Nan::EmptyString()</code></b></a>
+
+
+<a name="api_nan_new"></a>
+### Nan::New()
+
+`Nan::New()` should be used to instantiate new JavaScript objects.
+
+Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation.
+
+Signatures:
+
+Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local<T>`. The following types will be contained within a `Nan::MaybeLocal<T>`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`.
+
+Empty objects:
+
+```c++
+Nan::New<T>();
+```
+
+Generic single and multiple-argument:
+
+```c++
+Nan::New<T>(A0 arg0);
+Nan::New<T>(A0 arg0, A1 arg1);
+Nan::New<T>(A0 arg0, A1 arg1, A2 arg2);
+Nan::New<T>(A0 arg0, A1 arg1, A2 arg2, A3 arg3);
+```
+
+For creating `v8::FunctionTemplate` and `v8::Function` objects:
+
+_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._
+
+```c++
+Nan::New<T>(Nan::FunctionCallback callback,
+            v8::Local<v8::Value> data = v8::Local<v8::Value>());
+Nan::New<T>(Nan::FunctionCallback callback,
+            v8::Local<v8::Value> data = v8::Local<v8::Value>(),
+            A2 a2 = A2());
+```
+
+Native number types:
+
+```c++
+v8::Local<v8::Boolean> Nan::New<T>(bool value);
+v8::Local<v8::Int32> Nan::New<T>(int32_t value);
+v8::Local<v8::Uint32> Nan::New<T>(uint32_t value);
+v8::Local<v8::Number> Nan::New<T>(double value);
+```
+
+String types:
+
+```c++
+Nan::MaybeLocal<v8::String> Nan::New<T>(std::string const& value);
+Nan::MaybeLocal<v8::String> Nan::New<T>(const char * value, int length);
+Nan::MaybeLocal<v8::String> Nan::New<T>(const char * value);
+Nan::MaybeLocal<v8::String> Nan::New<T>(const uint16_t * value);
+Nan::MaybeLocal<v8::String> Nan::New<T>(const uint16_t * value, int length);
+```
+
+Specialized types:
+
+```c++
+v8::Local<v8::String> Nan::New<T>(v8::String::ExternalStringResource * value);
+v8::Local<v8::String> Nan::New<T>(Nan::ExternalOneByteStringResource * value);
+v8::Local<v8::RegExp> Nan::New<T>(v8::Local<v8::String> pattern, v8::RegExp::Flags flags);
+```
+
+Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.16/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8.
+
+
+<a name="api_nan_undefined"></a>
+### Nan::Undefined()
+
+A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8.
+
+Signature:
+
+```c++
+v8::Local<v8::Primitive> Nan::Undefined()
+```
+
+<a name="api_nan_null"></a>
+### Nan::Null()
+
+A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8.
+
+Signature:
+
+```c++
+v8::Local<v8::Primitive> Nan::Null()
+```
+
+<a name="api_nan_true"></a>
+### Nan::True()
+
+A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8.
+
+Signature:
+
+```c++
+v8::Local<v8::Boolean> Nan::True()
+```
+
+<a name="api_nan_false"></a>
+### Nan::False()
+
+A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8.
+
+Signature:
+
+```c++
+v8::Local<v8::Boolean> Nan::False()
+```
+
+<a name="api_nan_empty_string"></a>
+### Nan::EmptyString()
+
+Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8.
+
+Signature:
+
+```c++
+v8::Local<v8::String> Nan::EmptyString()
+```
+
+
+<a name="api_nan_new_one_byte_string"></a>
+### Nan::NewOneByteString()
+
+An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::String> Nan::NewOneByteString(const uint8_t * value,
+                                                  int length = -1)
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/node_misc.md b/legacy-libs/grpc/node_modules/nan/doc/node_misc.md
new file mode 100644 (file)
index 0000000..17578e3
--- /dev/null
@@ -0,0 +1,123 @@
+## Miscellaneous Node Helpers
+
+ - <a href="#api_nan_asyncresource"><b><code>Nan::AsyncResource</code></b></a>
+ - <a href="#api_nan_make_callback"><b><code>Nan::MakeCallback()</code></b></a>
+ - <a href="#api_nan_module_init"><b><code>NAN_MODULE_INIT()</code></b></a>
+ - <a href="#api_nan_export"><b><code>Nan::Export()</code></b></a>
+
+<a name="api_nan_asyncresource"></a>
+### Nan::AsyncResource
+
+This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API.
+
+When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track
+async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`,
+and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or
+`v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms
+such as domains and [async_hooks][] function correctly.
+
+Definition:
+
+```c++
+class AsyncResource {
+ public:
+  AsyncResource(v8::Local<v8::String> name,
+                v8::Local<v8::Object> resource = New<v8::Object>());
+  AsyncResource(const char* name,
+                v8::Local<v8::Object> resource = New<v8::Object>());
+  ~AsyncResource();
+
+  v8::MaybeLocal<v8::Value> runInAsyncScope(v8::Local<v8::Object> target,
+                                            v8::Local<v8::Function> func,
+                                            int argc,
+                                            v8::Local<v8::Value>* argv);
+  v8::MaybeLocal<v8::Value> runInAsyncScope(v8::Local<v8::Object> target,
+                                            v8::Local<v8::String> symbol,
+                                            int argc,
+                                            v8::Local<v8::Value>* argv);
+  v8::MaybeLocal<v8::Value> runInAsyncScope(v8::Local<v8::Object> target,
+                                            const char* method,
+                                            int argc,
+                                            v8::Local<v8::Value>* argv);
+};
+```
+
+* `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][]
+  API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend
+  that the name include the name of the owning module as a prefix. For example `mysql` module could use something like
+  `mysql:batch-db-query-resource`.
+* `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][]
+  `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically.
+* When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the
+  correct async execution context.
+* `AsyncDestroy` is automatically called when an AsyncResource object is destroyed.
+
+For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the
+[N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory.
+
+<a name="api_nan_make_callback"></a>
+### Nan::MakeCallback()
+
+Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+
+has deprecated these legacy APIs as they do not provide a mechanism to preserve
+async context.
+
+We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or
+`v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution
+context – something that is essential for functionality like domains, async_hooks and async debugging.
+
+Signatures:
+
+```c++
+NAN_DEPRECATED
+v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object> target,
+                                       v8::Local<v8::Function> func,
+                                       int argc,
+                                       v8::Local<v8::Value>* argv);
+NAN_DEPRECATED
+v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object> target,
+                                       v8::Local<v8::String> symbol,
+                                       int argc,
+                                       v8::Local<v8::Value>* argv);
+NAN_DEPRECATED
+v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object> target,
+                                       const char* method,
+                                       int argc,
+                                       v8::Local<v8::Value>* argv);
+```
+
+
+<a name="api_nan_module_init"></a>
+### NAN_MODULE_INIT()
+
+Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object.
+
+See example below.
+
+<a name="api_nan_export"></a>
+### Nan::Export()
+
+A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript.
+
+Signature:
+
+```c++
+void Export(v8::Local<v8::Object> target, const char *name, Nan::FunctionCallback f)
+```
+
+Also available as the shortcut `NAN_EXPORT` macro.
+
+Example:
+
+```c++
+NAN_METHOD(Foo) {
+  ...
+}
+
+NAN_MODULE_INIT(Init) {
+  NAN_EXPORT(target, Foo);
+}
+```
+
+[async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html
+[napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations
diff --git a/legacy-libs/grpc/node_modules/nan/doc/object_wrappers.md b/legacy-libs/grpc/node_modules/nan/doc/object_wrappers.md
new file mode 100644 (file)
index 0000000..07d8c05
--- /dev/null
@@ -0,0 +1,263 @@
+## Object Wrappers
+
+The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects.
+
+ - <a href="#api_nan_object_wrap"><b><code>Nan::ObjectWrap</code></b></a>
+
+
+<a name="api_nan_object_wrap"></a>
+### Nan::ObjectWrap()
+
+A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency.
+
+Definition:
+
+```c++
+class ObjectWrap {
+ public:
+  ObjectWrap();
+
+  virtual ~ObjectWrap();
+
+  template <class T>
+  static inline T* Unwrap(v8::Local<v8::Object> handle);
+
+  inline v8::Local<v8::Object> handle();
+
+  inline Nan::Persistent<v8::Object>& persistent();
+
+ protected:
+  inline void Wrap(v8::Local<v8::Object> handle);
+
+  inline void MakeWeak();
+
+  /* Ref() marks the object as being attached to an event loop.
+   * Refed objects will not be garbage collected, even if
+   * all references are lost.
+   */
+  virtual void Ref();
+
+  /* Unref() marks an object as detached from the event loop.  This is its
+   * default state.  When an object with a "weak" reference changes from
+   * attached to detached state it will be freed. Be careful not to access
+   * the object after making this call as it might be gone!
+   * (A "weak reference" means an object that only has a
+   * persistent handle.)
+   *
+   * DO NOT CALL THIS FROM DESTRUCTOR
+   */
+  virtual void Unref();
+
+  int refs_;  // ro
+};
+```
+
+See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details.
+
+### This vs. Holder
+
+When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class.
+The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance.
+In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected.
+However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain.
+In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption.
+
+On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype.
+So either define your accessors on the instance template,
+or use `This()` after verifying that it is indeed a valid object.
+
+### Examples
+
+#### Basic
+
+```c++
+class MyObject : public Nan::ObjectWrap {
+ public:
+  static NAN_MODULE_INIT(Init) {
+    v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
+    tpl->SetClassName(Nan::New("MyObject").ToLocalChecked());
+    tpl->InstanceTemplate()->SetInternalFieldCount(1);
+
+    Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle);
+    Nan::SetPrototypeMethod(tpl, "getValue", GetValue);
+
+    constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked());
+    Nan::Set(target, Nan::New("MyObject").ToLocalChecked(),
+      Nan::GetFunction(tpl).ToLocalChecked());
+  }
+
+ private:
+  explicit MyObject(double value = 0) : value_(value) {}
+  ~MyObject() {}
+
+  static NAN_METHOD(New) {
+    if (info.IsConstructCall()) {
+      double value = info[0]->IsUndefined() ? 0 : Nan::To<double>(info[0]).FromJust();
+      MyObject *obj = new MyObject(value);
+      obj->Wrap(info.This());
+      info.GetReturnValue().Set(info.This());
+    } else {
+      const int argc = 1;
+      v8::Local<v8::Value> argv[argc] = {info[0]};
+      v8::Local<v8::Function> cons = Nan::New(constructor());
+      info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked());
+    }
+  }
+
+  static NAN_METHOD(GetHandle) {
+    MyObject* obj = Nan::ObjectWrap::Unwrap<MyObject>(info.Holder());
+    info.GetReturnValue().Set(obj->handle());
+  }
+
+  static NAN_METHOD(GetValue) {
+    MyObject* obj = Nan::ObjectWrap::Unwrap<MyObject>(info.Holder());
+    info.GetReturnValue().Set(obj->value_);
+  }
+
+  static inline Nan::Persistent<v8::Function> & constructor() {
+    static Nan::Persistent<v8::Function> my_constructor;
+    return my_constructor;
+  }
+
+  double value_;
+};
+
+NODE_MODULE(objectwrapper, MyObject::Init)
+```
+
+To use in Javascript:
+
+```Javascript
+var objectwrapper = require('bindings')('objectwrapper');
+
+var obj = new objectwrapper.MyObject(5);
+console.log('Should be 5: ' + obj.getValue());
+```
+
+#### Factory of wrapped objects
+
+```c++
+class MyFactoryObject : public Nan::ObjectWrap {
+ public:
+  static NAN_MODULE_INIT(Init) {
+    v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
+    tpl->InstanceTemplate()->SetInternalFieldCount(1);
+
+    Nan::SetPrototypeMethod(tpl, "getValue", GetValue);
+
+    constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked());
+  }
+
+  static NAN_METHOD(NewInstance) {
+    v8::Local<v8::Function> cons = Nan::New(constructor());
+    double value = info[0]->IsNumber() ? Nan::To<double>(info[0]).FromJust() : 0;
+    const int argc = 1;
+    v8::Local<v8::Value> argv[1] = {Nan::New(value)};
+    info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked());
+  }
+
+  // Needed for the next example:
+  inline double value() const {
+    return value_;
+  }
+
+ private:
+  explicit MyFactoryObject(double value = 0) : value_(value) {}
+  ~MyFactoryObject() {}
+
+  static NAN_METHOD(New) {
+    if (info.IsConstructCall()) {
+      double value = info[0]->IsNumber() ? Nan::To<double>(info[0]).FromJust() : 0;
+      MyFactoryObject * obj = new MyFactoryObject(value);
+      obj->Wrap(info.This());
+      info.GetReturnValue().Set(info.This());
+    } else {
+      const int argc = 1;
+      v8::Local<v8::Value> argv[argc] = {info[0]};
+      v8::Local<v8::Function> cons = Nan::New(constructor());
+      info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked());
+    }
+  }
+
+  static NAN_METHOD(GetValue) {
+    MyFactoryObject* obj = ObjectWrap::Unwrap<MyFactoryObject>(info.Holder());
+    info.GetReturnValue().Set(obj->value_);
+  }
+
+  static inline Nan::Persistent<v8::Function> & constructor() {
+    static Nan::Persistent<v8::Function> my_constructor;
+    return my_constructor;
+  }
+
+  double value_;
+};
+
+NAN_MODULE_INIT(Init) {
+  MyFactoryObject::Init(target);
+  Nan::Set(target,
+    Nan::New<v8::String>("newFactoryObjectInstance").ToLocalChecked(),
+    Nan::GetFunction(
+      Nan::New<v8::FunctionTemplate>(MyFactoryObject::NewInstance)).ToLocalChecked()
+  );
+}
+
+NODE_MODULE(wrappedobjectfactory, Init)
+```
+
+To use in Javascript:
+
+```Javascript
+var wrappedobjectfactory = require('bindings')('wrappedobjectfactory');
+
+var obj = wrappedobjectfactory.newFactoryObjectInstance(10);
+console.log('Should be 10: ' + obj.getValue());
+```
+
+#### Passing wrapped objects around
+
+Use the `MyFactoryObject` class above along with the following:
+
+```c++
+static NAN_METHOD(Sum) {
+  Nan::MaybeLocal<v8::Object> maybe1 = Nan::To<v8::Object>(info[0]);
+  Nan::MaybeLocal<v8::Object> maybe2 = Nan::To<v8::Object>(info[1]);
+
+  // Quick check:
+  if (maybe1.IsEmpty() || maybe2.IsEmpty()) {
+    // return value is undefined by default
+    return;
+  }
+
+  MyFactoryObject* obj1 =
+    Nan::ObjectWrap::Unwrap<MyFactoryObject>(maybe1.ToLocalChecked());
+  MyFactoryObject* obj2 =
+    Nan::ObjectWrap::Unwrap<MyFactoryObject>(maybe2.ToLocalChecked());
+
+  info.GetReturnValue().Set(Nan::New<v8::Number>(obj1->value() + obj2->value()));
+}
+
+NAN_MODULE_INIT(Init) {
+  MyFactoryObject::Init(target);
+  Nan::Set(target,
+    Nan::New<v8::String>("newFactoryObjectInstance").ToLocalChecked(),
+    Nan::GetFunction(
+      Nan::New<v8::FunctionTemplate>(MyFactoryObject::NewInstance)).ToLocalChecked()
+  );
+  Nan::Set(target,
+    Nan::New<v8::String>("sum").ToLocalChecked(),
+    Nan::GetFunction(Nan::New<v8::FunctionTemplate>(Sum)).ToLocalChecked()
+  );
+}
+
+NODE_MODULE(myaddon, Init)
+```
+
+To use in Javascript:
+
+```Javascript
+var myaddon = require('bindings')('myaddon');
+
+var obj1 = myaddon.newFactoryObjectInstance(5);
+var obj2 = myaddon.newFactoryObjectInstance(10);
+console.log('sum of object values: ' + myaddon.sum(obj1, obj2));
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/persistent.md b/legacy-libs/grpc/node_modules/nan/doc/persistent.md
new file mode 100644 (file)
index 0000000..2e13f6b
--- /dev/null
@@ -0,0 +1,296 @@
+## Persistent references
+
+An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed.
+
+Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported.
+
+ - <a href="#api_nan_persistent_base"><b><code>Nan::PersistentBase & v8::PersistentBase</code></b></a>
+ - <a href="#api_nan_non_copyable_persistent_traits"><b><code>Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits</code></b></a>
+ - <a href="#api_nan_copyable_persistent_traits"><b><code>Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits</code></b></a>
+ - <a href="#api_nan_persistent"><b><code>Nan::Persistent</code></b></a>
+ - <a href="#api_nan_global"><b><code>Nan::Global</code></b></a>
+ - <a href="#api_nan_weak_callback_info"><b><code>Nan::WeakCallbackInfo</code></b></a>
+ - <a href="#api_nan_weak_callback_type"><b><code>Nan::WeakCallbackType</code></b></a>
+
+Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles).
+
+<a name="api_nan_persistent_base"></a>
+### Nan::PersistentBase & v8::PersistentBase
+
+A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`.
+
+Definition:
+
+_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_
+
+```c++
+template<typename T> class PersistentBase {
+ public:
+  /**
+   * If non-empty, destroy the underlying storage cell
+   */
+  void Reset();
+
+  /**
+   * If non-empty, destroy the underlying storage cell and create a new one with
+   * the contents of another if it is also non-empty
+   */
+  template<typename S> void Reset(const v8::Local<S> &other);
+
+  /**
+   * If non-empty, destroy the underlying storage cell and create a new one with
+   * the contents of another if it is also non-empty
+   */
+  template<typename S> void Reset(const PersistentBase<S> &other);
+
+  /** Returns true if the handle is empty. */
+  bool IsEmpty() const;
+
+  /**
+   * If non-empty, destroy the underlying storage cell
+   * IsEmpty() will return true after this call.
+   */
+  void Empty();
+
+  template<typename S> bool operator==(const PersistentBase<S> &that);
+
+  template<typename S> bool operator==(const v8::Local<S> &that);
+
+  template<typename S> bool operator!=(const PersistentBase<S> &that);
+
+  template<typename S> bool operator!=(const v8::Local<S> &that);
+
+   /**
+   *  Install a finalization callback on this object.
+   *  NOTE: There is no guarantee as to *when* or even *if* the callback is
+   *  invoked. The invocation is performed solely on a best effort basis.
+   *  As always, GC-based finalization should *not* be relied upon for any
+   *  critical form of resource management! At the moment you can either
+   *  specify a parameter for the callback or the location of two internal
+   *  fields in the dying object.
+   */
+  template<typename P>
+  void SetWeak(P *parameter,
+               typename WeakCallbackInfo<P>::Callback callback,
+               WeakCallbackType type);
+
+  void ClearWeak();
+
+  /**
+   * Marks the reference to this object independent. Garbage collector is free
+   * to ignore any object groups containing this object. Weak callback for an
+   * independent handle should not assume that it will be preceded by a global
+   * GC prologue callback or followed by a global GC epilogue callback.
+   */
+  void MarkIndependent() const;
+
+  bool IsIndependent() const;
+
+  /** Checks if the handle holds the only reference to an object. */
+  bool IsNearDeath() const;
+
+  /** Returns true if the handle's reference is weak.  */
+  bool IsWeak() const
+};
+```
+
+See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.16/d4/dca/classv8_1_1_persistent_base.html) for further information.
+
+**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object:
+
+```c++
+v8::Local<v8::Object> object = Nan::New(persistent);
+```
+
+<a name="api_nan_non_copyable_persistent_traits"></a>
+### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits
+
+Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version.
+
+Definition:
+
+_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_
+
+```c++
+template<typename T> class NonCopyablePersistentTraits {
+ public:
+  typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent;
+
+  static const bool kResetInDestructor = false;
+
+  template<typename S, typename M>
+  static void Copy(const Persistent<S, M> &source,
+                   NonCopyablePersistent *dest);
+
+  template<typename O> static void Uncompilable();
+};
+```
+
+See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information.
+
+<a name="api_nan_copyable_persistent_traits"></a>
+### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits
+
+A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc..
+
+Definition:
+
+_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_
+
+```c++
+template<typename T>
+class CopyablePersistentTraits {
+ public:
+  typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
+
+  static const bool kResetInDestructor = true;
+
+  template<typename S, typename M>
+  static void Copy(const Persistent<S, M> &source,
+                   CopyablePersistent *dest);
+};
+```
+
+See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information.
+
+<a name="api_nan_persistent"></a>
+### Nan::Persistent
+
+A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`.
+
+Definition:
+
+```c++
+template<typename T, typename M = NonCopyablePersistentTraits<T> >
+class Persistent;
+
+template<typename T, typename M> class Persistent : public PersistentBase<T> {
+ public:
+ /**
+  * A Persistent with no storage cell.
+  */
+  Persistent();
+
+  /**
+   * Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a
+   * new storage cell is created pointing to the same object, and no flags are
+   * set.
+   */
+  template<typename S> Persistent(v8::Local<S> that);
+
+  /**
+   * Construct a Persistent from a Persistent. When the Persistent is non-empty,
+   * a new storage cell is created pointing to the same object, and no flags are
+   * set.
+   */
+  Persistent(const Persistent &that);
+
+  /**
+   * The copy constructors and assignment operator create a Persistent exactly
+   * as the Persistent constructor, but the Copy function from the traits class
+   * is called, allowing the setting of flags based on the copied Persistent.
+   */
+  Persistent &operator=(const Persistent &that);
+
+  template <typename S, typename M2>
+  Persistent &operator=(const Persistent<S, M2> &that);
+
+  /**
+   * The destructor will dispose the Persistent based on the kResetInDestructor
+   * flags in the traits class.  Since not calling dispose can result in a
+   * memory leak, it is recommended to always set this flag.
+   */
+  ~Persistent();
+};
+```
+
+See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.16/d2/d78/classv8_1_1_persistent.html) for further information.
+
+<a name="api_nan_global"></a>
+### Nan::Global
+
+A type of `PersistentBase` which has move semantics.
+
+```c++
+template<typename T> class Global : public PersistentBase<T> {
+ public:
+  /**
+   * A Global with no storage cell.
+   */
+  Global();
+
+  /**
+   * Construct a Global from a v8::Local. When the v8::Local is non-empty, a new
+   * storage cell is created pointing to the same object, and no flags are set.
+   */
+  template<typename S> Global(v8::Local<S> that);
+  /**
+   * Construct a Global from a PersistentBase. When the Persistent is non-empty,
+   * a new storage cell is created pointing to the same object, and no flags are
+   * set.
+   */
+  template<typename S> Global(const PersistentBase<S> &that);
+
+  /**
+   * Pass allows returning globals from functions, etc.
+   */
+  Global Pass();
+};
+```
+
+See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.16/d5/d40/classv8_1_1_global.html) for further information.
+
+<a name="api_nan_weak_callback_info"></a>
+### Nan::WeakCallbackInfo
+
+`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8.
+
+Definition:
+
+```c++
+template<typename T> class WeakCallbackInfo {
+ public:
+  typedef void (*Callback)(const WeakCallbackInfo<T>& data);
+
+  v8::Isolate *GetIsolate() const;
+
+  /**
+   * Get the parameter that was associated with the weak handle.
+   */
+  T *GetParameter() const;
+
+  /**
+   * Get pointer from internal field, index can be 0 or 1.
+   */
+  void *GetInternalField(int index) const;
+};
+```
+
+Example usage:
+
+```c++
+void weakCallback(const WeakCallbackInfo<int> &data) {
+  int *parameter = data.GetParameter();
+  delete parameter;
+}
+
+Persistent<v8::Object> obj;
+int *data = new int(0);
+obj.SetWeak(data, callback, WeakCallbackType::kParameter);
+```
+
+See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d8/d06/classv8_1_1_weak_callback_info.html) for further information.
+
+<a name="api_nan_weak_callback_type"></a>
+### Nan::WeakCallbackType
+
+Represents the type of a weak callback.
+A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`.
+A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase<v8::Object>` being made weak.
+Note that only `v8::Object`s and derivatives can have internal fields.
+
+Definition:
+
+```c++
+enum class WeakCallbackType { kParameter, kInternalFields };
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/scopes.md b/legacy-libs/grpc/node_modules/nan/doc/scopes.md
new file mode 100644 (file)
index 0000000..84000ee
--- /dev/null
@@ -0,0 +1,73 @@
+## Scopes
+
+A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works.
+
+A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope.
+
+The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these.
+
+ - <a href="#api_nan_handle_scope"><b><code>Nan::HandleScope</code></b></a>
+ - <a href="#api_nan_escapable_handle_scope"><b><code>Nan::EscapableHandleScope</code></b></a>
+
+Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection).
+
+<a name="api_nan_handle_scope"></a>
+### Nan::HandleScope
+
+A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.16/d3/d95/classv8_1_1_handle_scope.html).
+
+Definition:
+
+```c++
+class Nan::HandleScope {
+ public:
+  Nan::HandleScope();
+  static int NumberOfHandles();
+};
+```
+
+Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself.
+
+Example:
+
+```c++
+// new object is created, it needs a new scope:
+void Pointless() {
+  Nan::HandleScope scope;
+  v8::Local<v8::Object> obj = Nan::New<v8::Object>();
+}
+
+// JavaScript-accessible method already has a HandleScope
+NAN_METHOD(Pointless2) {
+  v8::Local<v8::Object> obj = Nan::New<v8::Object>();
+}
+```
+
+<a name="api_nan_escapable_handle_scope"></a>
+### Nan::EscapableHandleScope
+
+Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it.
+
+Definition:
+
+```c++
+class Nan::EscapableHandleScope {
+ public:
+  Nan::EscapableHandleScope();
+  static int NumberOfHandles();
+  template<typename T> v8::Local<T> Escape(v8::Local<T> value);
+}
+```
+
+Use `Escape(value)` to return the object.
+
+Example:
+
+```c++
+v8::Local<v8::Object> EmptyObj() {
+  Nan::EscapableHandleScope scope;
+  v8::Local<v8::Object> obj = Nan::New<v8::Object>();
+  return scope.Escape(obj);
+}
+```
+
diff --git a/legacy-libs/grpc/node_modules/nan/doc/script.md b/legacy-libs/grpc/node_modules/nan/doc/script.md
new file mode 100644 (file)
index 0000000..213320a
--- /dev/null
@@ -0,0 +1,38 @@
+## Script
+
+NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8.
+
+ - <a href="#api_nan_compile_script"><b><code>Nan::CompileScript()</code></b></a>
+ - <a href="#api_nan_run_script"><b><code>Nan::RunScript()</code></b></a>
+
+
+<a name="api_nan_compile_script"></a>
+### Nan::CompileScript()
+
+A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.16/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b).
+
+Note that `Nan::BoundScript` is an alias for `v8::Script`.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(
+    v8::Local<v8::String> s,
+    const v8::ScriptOrigin& origin);
+Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(v8::Local<v8::String> s);
+```
+
+
+<a name="api_nan_run_script"></a>
+### Nan::RunScript()
+
+Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`.
+
+Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::UnboundScript> script)
+Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::BoundScript> script) 
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/string_bytes.md b/legacy-libs/grpc/node_modules/nan/doc/string_bytes.md
new file mode 100644 (file)
index 0000000..7c1bd32
--- /dev/null
@@ -0,0 +1,62 @@
+## Strings & Bytes
+
+Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing.
+
+ - <a href="#api_nan_encoding"><b><code>Nan::Encoding</code></b></a>
+ - <a href="#api_nan_encode"><b><code>Nan::Encode()</code></b></a>
+ - <a href="#api_nan_decode_bytes"><b><code>Nan::DecodeBytes()</code></b></a>
+ - <a href="#api_nan_decode_write"><b><code>Nan::DecodeWrite()</code></b></a>
+
+
+<a name="api_nan_encoding"></a>
+### Nan::Encoding
+
+An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node.
+
+Definition:
+
+```c++
+enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER }
+```
+
+
+<a name="api_nan_encode"></a>
+### Nan::Encode()
+
+A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node.
+
+Signature:
+
+```c++
+v8::Local<v8::Value> Nan::Encode(const void *buf,
+                                 size_t len,
+                                 enum Nan::Encoding encoding = BINARY);
+```
+
+
+<a name="api_nan_decode_bytes"></a>
+### Nan::DecodeBytes()
+
+A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node.
+
+Signature:
+
+```c++
+ssize_t Nan::DecodeBytes(v8::Local<v8::Value> val,
+                         enum Nan::Encoding encoding = BINARY);
+```
+
+
+<a name="api_nan_decode_write"></a>
+### Nan::DecodeWrite()
+
+A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node.
+
+Signature:
+
+```c++
+ssize_t Nan::DecodeWrite(char *buf,
+                         size_t len,
+                         v8::Local<v8::Value> val,
+                         enum Nan::Encoding encoding = BINARY);
+```
diff --git a/legacy-libs/grpc/node_modules/nan/doc/v8_internals.md b/legacy-libs/grpc/node_modules/nan/doc/v8_internals.md
new file mode 100644 (file)
index 0000000..08dd6d0
--- /dev/null
@@ -0,0 +1,199 @@
+## V8 internals
+
+The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods.
+
+ - <a href="#api_nan_gc_callback"><b><code>NAN_GC_CALLBACK()</code></b></a>
+ - <a href="#api_nan_add_gc_epilogue_callback"><b><code>Nan::AddGCEpilogueCallback()</code></b></a>
+ - <a href="#api_nan_remove_gc_epilogue_callback"><b><code>Nan::RemoveGCEpilogueCallback()</code></b></a>
+ - <a href="#api_nan_add_gc_prologue_callback"><b><code>Nan::AddGCPrologueCallback()</code></b></a>
+ - <a href="#api_nan_remove_gc_prologue_callback"><b><code>Nan::RemoveGCPrologueCallback()</code></b></a>
+ - <a href="#api_nan_get_heap_statistics"><b><code>Nan::GetHeapStatistics()</code></b></a>
+ - <a href="#api_nan_set_counter_function"><b><code>Nan::SetCounterFunction()</code></b></a>
+ - <a href="#api_nan_set_create_histogram_function"><b><code>Nan::SetCreateHistogramFunction()</code></b></a>
+ - <a href="#api_nan_set_add_histogram_sample_function"><b><code>Nan::SetAddHistogramSampleFunction()</code></b></a>
+ - <a href="#api_nan_idle_notification"><b><code>Nan::IdleNotification()</code></b></a>
+ - <a href="#api_nan_low_memory_notification"><b><code>Nan::LowMemoryNotification()</code></b></a>
+ - <a href="#api_nan_context_disposed_notification"><b><code>Nan::ContextDisposedNotification()</code></b></a>
+ - <a href="#api_nan_get_internal_field_pointer"><b><code>Nan::GetInternalFieldPointer()</code></b></a>
+ - <a href="#api_nan_set_internal_field_pointer"><b><code>Nan::SetInternalFieldPointer()</code></b></a>
+ - <a href="#api_nan_adjust_external_memory"><b><code>Nan::AdjustExternalMemory()</code></b></a>
+
+
+<a name="api_nan_gc_callback"></a>
+### NAN_GC_CALLBACK(callbackname)
+
+Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`.
+
+```c++
+static Nan::Persistent<Function> callback;
+
+NAN_GC_CALLBACK(gcPrologueCallback) {
+  v8::Local<Value> argv[] = { Nan::New("prologue").ToLocalChecked() };
+  Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv);
+}
+
+NAN_METHOD(Hook) {
+  callback.Reset(To<Function>(args[0]).ToLocalChecked());
+  Nan::AddGCPrologueCallback(gcPrologueCallback);
+  info.GetReturnValue().Set(info.Holder());
+}
+```
+
+<a name="api_nan_add_gc_epilogue_callback"></a>
+### Nan::AddGCEpilogueCallback()
+
+Signature:
+
+```c++
+void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll)
+```
+
+Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e).
+
+<a name="api_nan_remove_gc_epilogue_callback"></a>
+### Nan::RemoveGCEpilogueCallback()
+
+Signature:
+
+```c++
+void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback)
+```
+
+Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c).
+
+<a name="api_nan_add_gc_prologue_callback"></a>
+### Nan::AddGCPrologueCallback()
+
+Signature:
+
+```c++
+void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback)
+```
+
+Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8).
+
+<a name="api_nan_remove_gc_prologue_callback"></a>
+### Nan::RemoveGCPrologueCallback()
+
+Signature:
+
+```c++
+void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback)
+```
+
+Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e).
+
+<a name="api_nan_get_heap_statistics"></a>
+### Nan::GetHeapStatistics()
+
+Signature:
+
+```c++
+void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics)
+```
+
+Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34).
+
+<a name="api_nan_set_counter_function"></a>
+### Nan::SetCounterFunction()
+
+Signature:
+
+```c++
+void Nan::SetCounterFunction(v8::CounterLookupCallback cb)
+```
+
+Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94).
+
+<a name="api_nan_set_create_histogram_function"></a>
+### Nan::SetCreateHistogramFunction()
+
+Signature:
+
+```c++
+void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb) 
+```
+
+Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732).
+
+<a name="api_nan_set_add_histogram_sample_function"></a>
+### Nan::SetAddHistogramSampleFunction()
+
+Signature:
+
+```c++
+void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) 
+```
+
+Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea).
+
+<a name="api_nan_idle_notification"></a>
+### Nan::IdleNotification()
+
+Signature:
+
+```c++
+bool Nan::IdleNotification(int idle_time_in_ms)
+```
+
+Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version.
+
+<a name="api_nan_low_memory_notification"></a>
+### Nan::LowMemoryNotification()
+
+Signature:
+
+```c++
+void Nan::LowMemoryNotification() 
+```
+
+Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f).
+
+<a name="api_nan_context_disposed_notification"></a>
+### Nan::ContextDisposedNotification()
+
+Signature:
+
+```c++
+void Nan::ContextDisposedNotification()
+```
+
+Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b).
+
+<a name="api_nan_get_internal_field_pointer"></a>
+### Nan::GetInternalFieldPointer()
+
+Gets a pointer to the internal field with at `index` from a V8 `Object` handle.
+
+Signature:
+
+```c++
+void* Nan::GetInternalFieldPointer(v8::Local<v8::Object> object, int index) 
+```
+
+Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8.
+
+<a name="api_nan_set_internal_field_pointer"></a>
+### Nan::SetInternalFieldPointer()
+
+Sets the value of the internal field at `index` on a V8 `Object` handle.
+
+Signature:
+
+```c++
+void Nan::SetInternalFieldPointer(v8::Local<v8::Object> object, int index, void* value)
+```
+
+Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8.
+
+<a name="api_nan_adjust_external_memory"></a>
+### Nan::AdjustExternalMemory()
+
+Signature:
+
+```c++
+int Nan::AdjustExternalMemory(int bytesChange)
+```
+
+Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e).
+
diff --git a/legacy-libs/grpc/node_modules/nan/doc/v8_misc.md b/legacy-libs/grpc/node_modules/nan/doc/v8_misc.md
new file mode 100644 (file)
index 0000000..1bd46d3
--- /dev/null
@@ -0,0 +1,85 @@
+## Miscellaneous V8 Helpers
+
+ - <a href="#api_nan_utf8_string"><b><code>Nan::Utf8String</code></b></a>
+ - <a href="#api_nan_get_current_context"><b><code>Nan::GetCurrentContext()</code></b></a>
+ - <a href="#api_nan_set_isolate_data"><b><code>Nan::SetIsolateData()</code></b></a>
+ - <a href="#api_nan_get_isolate_data"><b><code>Nan::GetIsolateData()</code></b></a>
+ - <a href="#api_nan_typedarray_contents"><b><code>Nan::TypedArrayContents</code></b></a>
+
+
+<a name="api_nan_utf8_string"></a>
+### Nan::Utf8String
+
+Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object.
+
+An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/node-8.16/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8.
+
+Definition:
+
+```c++
+class Nan::Utf8String {
+ public:
+  Nan::Utf8String(v8::Local<v8::Value> from);
+
+  int length() const;
+
+  char* operator*();
+  const char* operator*() const;
+};
+```
+
+<a name="api_nan_get_current_context"></a>
+### Nan::GetCurrentContext()
+
+A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8.
+
+Signature:
+
+```c++
+v8::Local<v8::Context> Nan::GetCurrentContext()
+```
+
+<a name="api_nan_set_isolate_data"></a>
+### Nan::SetIsolateData()
+
+A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36).
+
+Signature:
+
+```c++
+void Nan::SetIsolateData(v8::Isolate *isolate, T *data)
+```
+
+
+<a name="api_nan_get_isolate_data"></a>
+### Nan::GetIsolateData()
+
+A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257).
+
+Signature:
+
+```c++
+T *Nan::GetIsolateData(v8::Isolate *isolate)
+```
+
+<a name="api_nan_typedarray_contents"></a>
+### Nan::TypedArrayContents<T>
+
+A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++.  If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0.  If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail.
+
+Note that you must store a reference to the `array` object while you are accessing its contents.
+
+Definition:
+
+```c++
+template<typename T>
+class Nan::TypedArrayContents {
+ public:
+  TypedArrayContents(v8::Local<Value> array);
+
+  size_t length() const;
+
+  T* const operator*();
+  const T* const operator*() const;
+};
+```
diff --git a/legacy-libs/grpc/node_modules/nan/include_dirs.js b/legacy-libs/grpc/node_modules/nan/include_dirs.js
new file mode 100644 (file)
index 0000000..4f1dfb4
--- /dev/null
@@ -0,0 +1 @@
+console.log(require('path').relative('.', __dirname));
diff --git a/legacy-libs/grpc/node_modules/nan/nan.h b/legacy-libs/grpc/node_modules/nan/nan.h
new file mode 100644 (file)
index 0000000..59cd9b6
--- /dev/null
@@ -0,0 +1,2898 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors:
+ *   - Rod Vagg <https://github.com/rvagg>
+ *   - Benjamin Byholm <https://github.com/kkoopa>
+ *   - Trevor Norris <https://github.com/trevnorris>
+ *   - Nathan Rajlich <https://github.com/TooTallNate>
+ *   - Brett Lawson <https://github.com/brett19>
+ *   - Ben Noordhuis <https://github.com/bnoordhuis>
+ *   - David Siegel <https://github.com/agnat>
+ *   - Michael Ira Krufky <https://github.com/mkrufky>
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ *
+ * Version 2.14.2: current Node 14.13.1, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1
+ *
+ * See https://github.com/nodejs/nan for the latest update to this file
+ **********************************************************************************/
+
+#ifndef NAN_H_
+#define NAN_H_
+
+#include <node_version.h>
+
+#define NODE_0_10_MODULE_VERSION 11
+#define NODE_0_12_MODULE_VERSION 14
+#define ATOM_0_21_MODULE_VERSION 41
+#define IOJS_1_0_MODULE_VERSION  42
+#define IOJS_1_1_MODULE_VERSION  43
+#define IOJS_2_0_MODULE_VERSION  44
+#define IOJS_3_0_MODULE_VERSION  45
+#define NODE_4_0_MODULE_VERSION  46
+#define NODE_5_0_MODULE_VERSION  47
+#define NODE_6_0_MODULE_VERSION  48
+#define NODE_7_0_MODULE_VERSION  51
+#define NODE_8_0_MODULE_VERSION  57
+#define NODE_9_0_MODULE_VERSION  59
+#define NODE_10_0_MODULE_VERSION 64
+#define NODE_11_0_MODULE_VERSION 67
+#define NODE_12_0_MODULE_VERSION 72
+#define NODE_13_0_MODULE_VERSION 79
+#define NODE_14_0_MODULE_VERSION 83
+
+#ifdef _MSC_VER
+# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800)
+#else
+# define NAN_HAS_CPLUSPLUS_11 (__cplusplus >= 201103L)
+#endif
+
+#if NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION && !NAN_HAS_CPLUSPLUS_11
+# error This version of node/NAN/v8 requires a C++11 compiler
+#endif
+
+#include <uv.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_object_wrap.h>
+#include <algorithm>
+#include <cstring>
+#include <climits>
+#include <cstdlib>
+#include <utility>
+#if defined(_MSC_VER)
+# pragma warning( push )
+# pragma warning( disable : 4530 )
+# include <queue>
+# include <string>
+# include <vector>
+# pragma warning( pop )
+#else
+# include <queue>
+# include <string>
+# include <vector>
+#endif
+
+// uv helpers
+#ifdef UV_VERSION_MAJOR
+# ifndef UV_VERSION_PATCH
+#  define UV_VERSION_PATCH 0
+# endif
+# define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \
+                         (UV_VERSION_MINOR <<  8) | \
+                         (UV_VERSION_PATCH))
+#else
+# define NAUV_UVVERSION 0x000b00
+#endif
+
+#if NAUV_UVVERSION < 0x000b0b
+# ifdef WIN32
+#  include <windows.h>
+# else
+#  include <pthread.h>
+# endif
+#endif
+
+namespace Nan {
+
+#define NAN_CONCAT(a, b) NAN_CONCAT_HELPER(a, b)
+#define NAN_CONCAT_HELPER(a, b) a##b
+
+#define NAN_INLINE inline  // TODO(bnoordhuis) Remove in v3.0.0.
+
+#if defined(__GNUC__) && \
+    !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS)
+# define NAN_DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER) && \
+    !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS)
+# define NAN_DEPRECATED __declspec(deprecated)
+#else
+# define NAN_DEPRECATED
+#endif
+
+#if NAN_HAS_CPLUSPLUS_11
+# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete;
+# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete;
+# define NAN_DISALLOW_MOVE(CLASS)                                              \
+    CLASS(CLASS&&) = delete;  /* NOLINT(build/c++11) */                        \
+    void operator=(CLASS&&) = delete;
+#else
+# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&);
+# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&);
+# define NAN_DISALLOW_MOVE(CLASS)
+#endif
+
+#define NAN_DISALLOW_ASSIGN_COPY(CLASS)                                        \
+    NAN_DISALLOW_ASSIGN(CLASS)                                                 \
+    NAN_DISALLOW_COPY(CLASS)
+
+#define NAN_DISALLOW_ASSIGN_MOVE(CLASS)                                        \
+    NAN_DISALLOW_ASSIGN(CLASS)                                                 \
+    NAN_DISALLOW_MOVE(CLASS)
+
+#define NAN_DISALLOW_COPY_MOVE(CLASS)                                          \
+    NAN_DISALLOW_COPY(CLASS)                                                   \
+    NAN_DISALLOW_MOVE(CLASS)
+
+#define NAN_DISALLOW_ASSIGN_COPY_MOVE(CLASS)                                   \
+    NAN_DISALLOW_ASSIGN(CLASS)                                                 \
+    NAN_DISALLOW_COPY(CLASS)                                                   \
+    NAN_DISALLOW_MOVE(CLASS)
+
+#define TYPE_CHECK(T, S)                                                       \
+    while (false) {                                                            \
+      *(static_cast<T *volatile *>(0)) = static_cast<S*>(0);                   \
+    }
+
+//=== RegistrationFunction =====================================================
+
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+  typedef v8::Handle<v8::Object> ADDON_REGISTER_FUNCTION_ARGS_TYPE;
+#else
+  typedef v8::Local<v8::Object> ADDON_REGISTER_FUNCTION_ARGS_TYPE;
+#endif
+
+#define NAN_MODULE_INIT(name)                                                  \
+    void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target)
+
+#if NODE_MAJOR_VERSION >= 10 || \
+    NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3
+#define NAN_MODULE_WORKER_ENABLED(module_name, registration)                   \
+    extern "C" NODE_MODULE_EXPORT void                                         \
+      NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)(                 \
+        v8::Local<v8::Object> exports, v8::Local<v8::Value> module,            \
+        v8::Local<v8::Context> context)                                        \
+    {                                                                          \
+        registration(exports);                                                 \
+    }
+#else
+#define NAN_MODULE_WORKER_ENABLED(module_name, registration)                   \
+    NODE_MODULE(module_name, registration)
+#endif
+
+//=== CallbackInfo =============================================================
+
+#include "nan_callbacks.h"  // NOLINT(build/include)
+
+//==============================================================================
+
+#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION)
+typedef v8::Script             UnboundScript;
+typedef v8::Script             BoundScript;
+#else
+typedef v8::UnboundScript      UnboundScript;
+typedef v8::Script             BoundScript;
+#endif
+
+#if (NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION)
+typedef v8::String::ExternalAsciiStringResource
+    ExternalOneByteStringResource;
+#else
+typedef v8::String::ExternalOneByteStringResource
+    ExternalOneByteStringResource;
+#endif
+
+#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION)
+template<typename T>
+class NonCopyablePersistentTraits :
+    public v8::NonCopyablePersistentTraits<T> {};
+template<typename T>
+class CopyablePersistentTraits :
+    public v8::CopyablePersistentTraits<T> {};
+
+template<typename T>
+class PersistentBase :
+    public v8::PersistentBase<T> {};
+
+template<typename T, typename M = v8::NonCopyablePersistentTraits<T> >
+class Persistent;
+#else
+template<typename T> class NonCopyablePersistentTraits;
+template<typename T> class PersistentBase;
+template<typename T, typename P> class WeakCallbackData;
+template<typename T, typename M = NonCopyablePersistentTraits<T> >
+class Persistent;
+#endif  // NODE_MODULE_VERSION
+
+template<typename T>
+class Maybe {
+ public:
+  inline bool IsNothing() const { return !has_value_; }
+  inline bool IsJust() const { return has_value_; }
+
+  inline T ToChecked() const { return FromJust(); }
+  inline void Check() const { FromJust(); }
+
+  inline bool To(T* out) const {
+    if (IsJust()) *out = value_;
+    return IsJust();
+  }
+
+  inline T FromJust() const {
+#if defined(V8_ENABLE_CHECKS)
+    assert(IsJust() && "FromJust is Nothing");
+#endif  // V8_ENABLE_CHECKS
+    return value_;
+  }
+
+  inline T FromMaybe(const T& default_value) const {
+    return has_value_ ? value_ : default_value;
+  }
+
+  inline bool operator==(const Maybe &other) const {
+    return (IsJust() == other.IsJust()) &&
+        (!IsJust() || FromJust() == other.FromJust());
+  }
+
+  inline bool operator!=(const Maybe &other) const {
+    return !operator==(other);
+  }
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+  // Allow implicit conversions from v8::Maybe<T> to Nan::Maybe<T>.
+  Maybe(const v8::Maybe<T>& that)  // NOLINT(runtime/explicit)
+    : has_value_(that.IsJust())
+    , value_(that.FromMaybe(T())) {}
+#endif
+
+ private:
+  Maybe() : has_value_(false) {}
+  explicit Maybe(const T& t) : has_value_(true), value_(t) {}
+  bool has_value_;
+  T value_;
+
+  template<typename U>
+  friend Maybe<U> Nothing();
+  template<typename U>
+  friend Maybe<U> Just(const U& u);
+};
+
+template<typename T>
+inline Maybe<T> Nothing() {
+  return Maybe<T>();
+}
+
+template<typename T>
+inline Maybe<T> Just(const T& t) {
+  return Maybe<T>(t);
+}
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+# include "nan_maybe_43_inl.h"  // NOLINT(build/include)
+#else
+# include "nan_maybe_pre_43_inl.h"  // NOLINT(build/include)
+#endif
+
+#include "nan_converters.h"  // NOLINT(build/include)
+#include "nan_new.h"  // NOLINT(build/include)
+
+#if NAUV_UVVERSION < 0x000b17
+#define NAUV_WORK_CB(func) \
+    void func(uv_async_t *async, int)
+#else
+#define NAUV_WORK_CB(func) \
+    void func(uv_async_t *async)
+#endif
+
+#if NAUV_UVVERSION >= 0x000b0b
+
+typedef uv_key_t nauv_key_t;
+
+inline int nauv_key_create(nauv_key_t *key) {
+  return uv_key_create(key);
+}
+
+inline void nauv_key_delete(nauv_key_t *key) {
+  uv_key_delete(key);
+}
+
+inline void* nauv_key_get(nauv_key_t *key) {
+  return uv_key_get(key);
+}
+
+inline void nauv_key_set(nauv_key_t *key, void *value) {
+  uv_key_set(key, value);
+}
+
+#else
+
+/* Implement thread local storage for older versions of libuv.
+ * This is essentially a backport of libuv commit 5d2434bf
+ * written by Ben Noordhuis, adjusted for names and inline.
+ */
+
+#ifndef WIN32
+
+typedef pthread_key_t nauv_key_t;
+
+inline int nauv_key_create(nauv_key_t* key) {
+  return -pthread_key_create(key, NULL);
+}
+
+inline void nauv_key_delete(nauv_key_t* key) {
+  if (pthread_key_delete(*key))
+    abort();
+}
+
+inline void* nauv_key_get(nauv_key_t* key) {
+  return pthread_getspecific(*key);
+}
+
+inline void nauv_key_set(nauv_key_t* key, void* value) {
+  if (pthread_setspecific(*key, value))
+    abort();
+}
+
+#else
+
+typedef struct {
+  DWORD tls_index;
+} nauv_key_t;
+
+inline int nauv_key_create(nauv_key_t* key) {
+  key->tls_index = TlsAlloc();
+  if (key->tls_index == TLS_OUT_OF_INDEXES)
+    return UV_ENOMEM;
+  return 0;
+}
+
+inline void nauv_key_delete(nauv_key_t* key) {
+  if (TlsFree(key->tls_index) == FALSE)
+    abort();
+  key->tls_index = TLS_OUT_OF_INDEXES;
+}
+
+inline void* nauv_key_get(nauv_key_t* key) {
+  void* value = TlsGetValue(key->tls_index);
+  if (value == NULL)
+    if (GetLastError() != ERROR_SUCCESS)
+      abort();
+  return value;
+}
+
+inline void nauv_key_set(nauv_key_t* key, void* value) {
+  if (TlsSetValue(key->tls_index, value) == FALSE)
+    abort();
+}
+
+#endif
+#endif
+
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+template<typename T>
+v8::Local<T> New(v8::Handle<T>);
+#endif
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+  typedef v8::WeakCallbackType WeakCallbackType;
+#else
+struct WeakCallbackType {
+  enum E {kParameter, kInternalFields};
+  E type;
+  WeakCallbackType(E other) : type(other) {}  // NOLINT(runtime/explicit)
+  inline bool operator==(E other) { return other == this->type; }
+  inline bool operator!=(E other) { return !operator==(other); }
+};
+#endif
+
+template<typename P> class WeakCallbackInfo;
+
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+# include "nan_persistent_12_inl.h"  // NOLINT(build/include)
+#else
+# include "nan_persistent_pre_12_inl.h"  // NOLINT(build/include)
+#endif
+
+namespace imp {
+  static const size_t kMaxLength = 0x3fffffff;
+  // v8::String::REPLACE_INVALID_UTF8 was introduced
+  // in node.js v0.10.29 and v0.8.27.
+#if NODE_MAJOR_VERSION > 0 || \
+    NODE_MINOR_VERSION > 10 || \
+    NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \
+    NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27
+  static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
+#else
+  static const unsigned kReplaceInvalidUtf8 = 0;
+#endif
+}  // end of namespace imp
+
+//=== HandleScope ==============================================================
+
+class HandleScope {
+  v8::HandleScope scope;
+
+ public:
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  inline HandleScope() : scope(v8::Isolate::GetCurrent()) {}
+  inline static int NumberOfHandles() {
+    return v8::HandleScope::NumberOfHandles(v8::Isolate::GetCurrent());
+  }
+#else
+  inline HandleScope() : scope() {}
+  inline static int NumberOfHandles() {
+    return v8::HandleScope::NumberOfHandles();
+  }
+#endif
+
+ private:
+  // Make it hard to create heap-allocated or illegal handle scopes by
+  // disallowing certain operations.
+  HandleScope(const HandleScope &);
+  void operator=(const HandleScope &);
+  void *operator new(size_t size);
+  void operator delete(void *, size_t) {
+    abort();
+  }
+};
+
+class EscapableHandleScope {
+ public:
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {}
+
+  inline static int NumberOfHandles() {
+    return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent());
+  }
+
+  template<typename T>
+  inline v8::Local<T> Escape(v8::Local<T> value) {
+    return scope.Escape(value);
+  }
+
+ private:
+  v8::EscapableHandleScope scope;
+#else
+  inline EscapableHandleScope() : scope() {}
+
+  inline static int NumberOfHandles() {
+    return v8::HandleScope::NumberOfHandles();
+  }
+
+  template<typename T>
+  inline v8::Local<T> Escape(v8::Local<T> value) {
+    return scope.Close(value);
+  }
+
+ private:
+  v8::HandleScope scope;
+#endif
+
+ private:
+  // Make it hard to create heap-allocated or illegal handle scopes by
+  // disallowing certain operations.
+  EscapableHandleScope(const EscapableHandleScope &);
+  void operator=(const EscapableHandleScope &);
+  void *operator new(size_t size);
+  void operator delete(void *, size_t) {
+    abort();
+  }
+};
+
+//=== TryCatch =================================================================
+
+class TryCatch {
+  v8::TryCatch try_catch_;
+  friend void FatalException(const TryCatch&);
+
+ public:
+#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+  TryCatch() : try_catch_(v8::Isolate::GetCurrent()) {}
+#endif
+
+  inline bool HasCaught() const { return try_catch_.HasCaught(); }
+
+  inline bool CanContinue() const { return try_catch_.CanContinue(); }
+
+  inline v8::Local<v8::Value> ReThrow() {
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    return New(try_catch_.ReThrow());
+#else
+    return try_catch_.ReThrow();
+#endif
+  }
+
+  inline v8::Local<v8::Value> Exception() const {
+    return try_catch_.Exception();
+  }
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+  inline v8::MaybeLocal<v8::Value> StackTrace() const {
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+    return scope.Escape(try_catch_.StackTrace(isolate->GetCurrentContext())
+                            .FromMaybe(v8::Local<v8::Value>()));
+  }
+#else
+  inline MaybeLocal<v8::Value> StackTrace() const {
+    return try_catch_.StackTrace();
+  }
+#endif
+
+  inline v8::Local<v8::Message> Message() const {
+    return try_catch_.Message();
+  }
+
+  inline void Reset() { try_catch_.Reset(); }
+
+  inline void SetVerbose(bool value) { try_catch_.SetVerbose(value); }
+
+  inline void SetCaptureMessage(bool value) {
+    try_catch_.SetCaptureMessage(value);
+  }
+};
+
+v8::Local<v8::Value> MakeCallback(v8::Local<v8::Object> target,
+                                  v8::Local<v8::Function> func,
+                                  int argc,
+                                  v8::Local<v8::Value>* argv);
+v8::Local<v8::Value> MakeCallback(v8::Local<v8::Object> target,
+                                  v8::Local<v8::String> symbol,
+                                  int argc,
+                                  v8::Local<v8::Value>* argv);
+v8::Local<v8::Value> MakeCallback(v8::Local<v8::Object> target,
+                                  const char* method,
+                                  int argc,
+                                  v8::Local<v8::Value>* argv);
+
+// === AsyncResource ===========================================================
+
+class AsyncResource {
+ public:
+  AsyncResource(
+      v8::Local<v8::String> name
+    , v8::Local<v8::Object> resource = New<v8::Object>()) {
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    v8::Isolate* isolate = v8::Isolate::GetCurrent();
+
+    if (resource.IsEmpty()) {
+      resource = New<v8::Object>();
+    }
+
+    context = node::EmitAsyncInit(isolate, resource, name);
+#endif
+  }
+
+  AsyncResource(
+      const char* name
+    , v8::Local<v8::Object> resource = New<v8::Object>()) {
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    v8::Isolate* isolate = v8::Isolate::GetCurrent();
+
+    if (resource.IsEmpty()) {
+      resource = New<v8::Object>();
+    }
+
+    v8::Local<v8::String> name_string =
+        New<v8::String>(name).ToLocalChecked();
+    context = node::EmitAsyncInit(isolate, resource, name_string);
+#endif
+  }
+
+  ~AsyncResource() {
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    v8::Isolate* isolate = v8::Isolate::GetCurrent();
+    node::EmitAsyncDestroy(isolate, context);
+#endif
+  }
+
+  inline MaybeLocal<v8::Value> runInAsyncScope(
+      v8::Local<v8::Object> target
+    , v8::Local<v8::Function> func
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION
+    return MakeCallback(target, func, argc, argv);
+#else
+    return node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, func, argc, argv, context);
+#endif
+  }
+
+  inline MaybeLocal<v8::Value> runInAsyncScope(
+      v8::Local<v8::Object> target
+    , v8::Local<v8::String> symbol
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION
+    return MakeCallback(target, symbol, argc, argv);
+#else
+    return node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, symbol, argc, argv, context);
+#endif
+  }
+
+  inline MaybeLocal<v8::Value> runInAsyncScope(
+      v8::Local<v8::Object> target
+    , const char* method
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION
+    return MakeCallback(target, method, argc, argv);
+#else
+    return node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, method, argc, argv, context);
+#endif
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncResource)
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+  node::async_context context;
+#endif
+};
+
+inline uv_loop_t* GetCurrentEventLoop() {
+#if NODE_MAJOR_VERSION >= 10 || \
+  NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 || \
+  NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10
+    return node::GetCurrentEventLoop(v8::Isolate::GetCurrent());
+#else
+    return uv_default_loop();
+#endif
+}
+
+//============ =================================================================
+
+/* node 0.12  */
+#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION
+  inline
+  void SetCounterFunction(v8::CounterLookupCallback cb) {
+    v8::Isolate::GetCurrent()->SetCounterFunction(cb);
+  }
+
+  inline
+  void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) {
+    v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb);
+  }
+
+  inline
+  void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) {
+    v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb);
+  }
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+  inline bool IdleNotification(int idle_time_in_ms) {
+    return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
+        idle_time_in_ms * 0.001);
+  }
+# else
+  inline bool IdleNotification(int idle_time_in_ms) {
+    return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms);
+  }
+#endif
+
+  inline void LowMemoryNotification() {
+    v8::Isolate::GetCurrent()->LowMemoryNotification();
+  }
+
+  inline void ContextDisposedNotification() {
+    v8::Isolate::GetCurrent()->ContextDisposedNotification();
+  }
+#else
+  inline
+  void SetCounterFunction(v8::CounterLookupCallback cb) {
+    v8::V8::SetCounterFunction(cb);
+  }
+
+  inline
+  void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) {
+    v8::V8::SetCreateHistogramFunction(cb);
+  }
+
+  inline
+  void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) {
+    v8::V8::SetAddHistogramSampleFunction(cb);
+  }
+
+  inline bool IdleNotification(int idle_time_in_ms) {
+    return v8::V8::IdleNotification(idle_time_in_ms);
+  }
+
+  inline void LowMemoryNotification() {
+    v8::V8::LowMemoryNotification();
+  }
+
+  inline void ContextDisposedNotification() {
+    v8::V8::ContextDisposedNotification();
+  }
+#endif
+
+#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION)  // Node 0.12
+  inline v8::Local<v8::Primitive> Undefined() {
+# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::Undefined(v8::Isolate::GetCurrent())));
+# else
+    return v8::Undefined(v8::Isolate::GetCurrent());
+# endif
+  }
+
+  inline v8::Local<v8::Primitive> Null() {
+# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::Null(v8::Isolate::GetCurrent())));
+# else
+    return v8::Null(v8::Isolate::GetCurrent());
+# endif
+  }
+
+  inline v8::Local<v8::Boolean> True() {
+# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::True(v8::Isolate::GetCurrent())));
+# else
+    return v8::True(v8::Isolate::GetCurrent());
+# endif
+  }
+
+  inline v8::Local<v8::Boolean> False() {
+# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::False(v8::Isolate::GetCurrent())));
+# else
+    return v8::False(v8::Isolate::GetCurrent());
+# endif
+  }
+
+  inline v8::Local<v8::String> EmptyString() {
+    return v8::String::Empty(v8::Isolate::GetCurrent());
+  }
+
+  inline int AdjustExternalMemory(int bc) {
+    return static_cast<int>(
+        v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc));
+  }
+
+  inline void SetTemplate(
+      v8::Local<v8::Template> templ
+    , const char *name
+    , v8::Local<v8::Data> value) {
+    templ->Set(v8::Isolate::GetCurrent(), name, value);
+  }
+
+  inline void SetTemplate(
+      v8::Local<v8::Template> templ
+    , v8::Local<v8::String> name
+    , v8::Local<v8::Data> value
+    , v8::PropertyAttribute attributes) {
+    templ->Set(name, value, attributes);
+  }
+
+  inline v8::Local<v8::Context> GetCurrentContext() {
+    return v8::Isolate::GetCurrent()->GetCurrentContext();
+  }
+
+  inline void* GetInternalFieldPointer(
+      v8::Local<v8::Object> object
+    , int index) {
+    return object->GetAlignedPointerFromInternalField(index);
+  }
+
+  inline void SetInternalFieldPointer(
+      v8::Local<v8::Object> object
+    , int index
+    , void* value) {
+    object->SetAlignedPointerInInternalField(index, value);
+  }
+
+# define NAN_GC_CALLBACK(name)                                                 \
+    void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags)
+
+#if NODE_MODULE_VERSION <= NODE_4_0_MODULE_VERSION
+  typedef v8::Isolate::GCEpilogueCallback GCEpilogueCallback;
+  typedef v8::Isolate::GCPrologueCallback GCPrologueCallback;
+#else
+  typedef v8::Isolate::GCCallback GCEpilogueCallback;
+  typedef v8::Isolate::GCCallback GCPrologueCallback;
+#endif
+
+  inline void AddGCEpilogueCallback(
+      GCEpilogueCallback callback
+    , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+    v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter);
+  }
+
+  inline void RemoveGCEpilogueCallback(
+      GCEpilogueCallback callback) {
+    v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback);
+  }
+
+  inline void AddGCPrologueCallback(
+      GCPrologueCallback callback
+    , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+    v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter);
+  }
+
+  inline void RemoveGCPrologueCallback(
+      GCPrologueCallback callback) {
+    v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback);
+  }
+
+  inline void GetHeapStatistics(
+      v8::HeapStatistics *heap_statistics) {
+    v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics);
+  }
+
+# define X(NAME)                                                               \
+    inline v8::Local<v8::Value> NAME(const char *msg) {                        \
+      EscapableHandleScope scope;                                              \
+      return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked()));     \
+    }                                                                          \
+                                                                               \
+    inline                                                                     \
+    v8::Local<v8::Value> NAME(v8::Local<v8::String> msg) {                     \
+      return v8::Exception::NAME(msg);                                         \
+    }                                                                          \
+                                                                               \
+    inline void Throw ## NAME(const char *msg) {                               \
+      HandleScope scope;                                                       \
+      v8::Isolate::GetCurrent()->ThrowException(                               \
+          v8::Exception::NAME(New(msg).ToLocalChecked()));                     \
+    }                                                                          \
+                                                                               \
+    inline void Throw ## NAME(v8::Local<v8::String> msg) {                     \
+      HandleScope scope;                                                       \
+      v8::Isolate::GetCurrent()->ThrowException(                               \
+          v8::Exception::NAME(msg));                                           \
+    }
+
+  X(Error)
+  X(RangeError)
+  X(ReferenceError)
+  X(SyntaxError)
+  X(TypeError)
+
+# undef X
+
+  inline void ThrowError(v8::Local<v8::Value> error) {
+    v8::Isolate::GetCurrent()->ThrowException(error);
+  }
+
+  inline MaybeLocal<v8::Object> NewBuffer(
+      char *data
+    , size_t length
+#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
+    , node::Buffer::FreeCallback callback
+#else
+    , node::smalloc::FreeCallback callback
+#endif
+    , void *hint
+  ) {
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(length <= imp::kMaxLength && "too large buffer");
+#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
+    return node::Buffer::New(
+        v8::Isolate::GetCurrent(), data, length, callback, hint);
+#else
+    return node::Buffer::New(v8::Isolate::GetCurrent(), data, length, callback,
+                             hint);
+#endif
+  }
+
+  inline MaybeLocal<v8::Object> CopyBuffer(
+      const char *data
+    , uint32_t size
+  ) {
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(size <= imp::kMaxLength && "too large buffer");
+#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
+    return node::Buffer::Copy(
+        v8::Isolate::GetCurrent(), data, size);
+#else
+    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
+#endif
+  }
+
+  inline MaybeLocal<v8::Object> NewBuffer(uint32_t size) {
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(size <= imp::kMaxLength && "too large buffer");
+#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
+    return node::Buffer::New(
+        v8::Isolate::GetCurrent(), size);
+#else
+    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
+#endif
+  }
+
+  inline MaybeLocal<v8::Object> NewBuffer(
+      char* data
+    , uint32_t size
+  ) {
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(size <= imp::kMaxLength && "too large buffer");
+#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
+    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
+#else
+    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
+#endif
+  }
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+  inline MaybeLocal<v8::String>
+  NewOneByteString(const uint8_t * value, int length = -1) {
+    return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value,
+          v8::NewStringType::kNormal, length);
+  }
+
+  inline MaybeLocal<BoundScript> CompileScript(
+      v8::Local<v8::String> s
+    , const v8::ScriptOrigin& origin
+  ) {
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+    v8::ScriptCompiler::Source source(s, origin);
+    return scope.Escape(
+        v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source)
+            .FromMaybe(v8::Local<BoundScript>()));
+  }
+
+  inline MaybeLocal<BoundScript> CompileScript(
+      v8::Local<v8::String> s
+  ) {
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+    v8::ScriptCompiler::Source source(s);
+    return scope.Escape(
+        v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source)
+            .FromMaybe(v8::Local<BoundScript>()));
+  }
+
+  inline MaybeLocal<v8::Value> RunScript(
+      v8::Local<UnboundScript> script
+  ) {
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+    return scope.Escape(script->BindToCurrentContext()
+                            ->Run(isolate->GetCurrentContext())
+                            .FromMaybe(v8::Local<v8::Value>()));
+  }
+
+  inline MaybeLocal<v8::Value> RunScript(
+      v8::Local<BoundScript> script
+  ) {
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+    return scope.Escape(script->Run(isolate->GetCurrentContext())
+                            .FromMaybe(v8::Local<v8::Value>()));
+  }
+#else
+  inline MaybeLocal<v8::String>
+  NewOneByteString(const uint8_t * value, int length = -1) {
+    return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value,
+                                      v8::String::kNormalString, length);
+  }
+
+  inline MaybeLocal<BoundScript> CompileScript(
+      v8::Local<v8::String> s
+    , const v8::ScriptOrigin& origin
+  ) {
+    v8::ScriptCompiler::Source source(s, origin);
+    return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source);
+  }
+
+  inline MaybeLocal<BoundScript> CompileScript(
+      v8::Local<v8::String> s
+  ) {
+    v8::ScriptCompiler::Source source(s);
+    return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source);
+  }
+
+  inline MaybeLocal<v8::Value> RunScript(
+      v8::Local<UnboundScript> script
+  ) {
+    EscapableHandleScope scope;
+    return scope.Escape(script->BindToCurrentContext()->Run());
+  }
+
+  inline MaybeLocal<v8::Value> RunScript(
+      v8::Local<BoundScript> script
+  ) {
+    return script->Run();
+  }
+#endif
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
+      v8::Local<v8::Object> target
+    , v8::Local<v8::Function> func
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, func, argc, argv)));
+#else
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource res("nan:makeCallback");
+    return res.runInAsyncScope(target, func, argc, argv)
+        .FromMaybe(v8::Local<v8::Value>());
+# else
+    return node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, func, argc, argv);
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#endif  // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+  }
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
+      v8::Local<v8::Object> target
+    , v8::Local<v8::String> symbol
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, symbol, argc, argv)));
+#else
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource res("nan:makeCallback");
+    return res.runInAsyncScope(target, symbol, argc, argv)
+        .FromMaybe(v8::Local<v8::Value>());
+# else
+    return node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, symbol, argc, argv);
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#endif  // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+  }
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
+      v8::Local<v8::Object> target
+    , const char* method
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    return scope.Escape(New(node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, method, argc, argv)));
+#else
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource res("nan:makeCallback");
+    return res.runInAsyncScope(target, method, argc, argv)
+        .FromMaybe(v8::Local<v8::Value>());
+# else
+    return node::MakeCallback(
+        v8::Isolate::GetCurrent(), target, method, argc, argv);
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#endif  // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+  }
+
+  inline void FatalException(const TryCatch& try_catch) {
+    node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_);
+  }
+
+  inline v8::Local<v8::Value> ErrnoException(
+          int errorno
+       ,  const char* syscall = NULL
+       ,  const char* message = NULL
+       ,  const char* path = NULL) {
+    return node::ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall,
+            message, path);
+  }
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> NanErrnoException(
+          int errorno
+       ,  const char* syscall = NULL
+       ,  const char* message = NULL
+       ,  const char* path = NULL) {
+    return ErrnoException(errorno, syscall, message, path);
+  }
+
+  template<typename T>
+  inline void SetIsolateData(
+      v8::Isolate *isolate
+    , T *data
+  ) {
+      isolate->SetData(0, data);
+  }
+
+  template<typename T>
+  inline T *GetIsolateData(
+      v8::Isolate *isolate
+  ) {
+      return static_cast<T*>(isolate->GetData(0));
+  }
+
+class Utf8String {
+ public:
+  inline explicit Utf8String(v8::Local<v8::Value> from) :
+      length_(0), str_(str_st_) {
+    HandleScope scope;
+    if (!from.IsEmpty()) {
+#if NODE_MAJOR_VERSION >= 10
+      v8::Local<v8::Context> context = GetCurrentContext();
+      v8::Local<v8::String> string =
+          from->ToString(context).FromMaybe(v8::Local<v8::String>());
+#else
+      v8::Local<v8::String> string = from->ToString();
+#endif
+      if (!string.IsEmpty()) {
+        size_t len = 3 * string->Length() + 1;
+        assert(len <= INT_MAX);
+        if (len > sizeof (str_st_)) {
+          str_ = static_cast<char*>(malloc(len));
+          assert(str_ != 0);
+        }
+        const int flags =
+            v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8;
+#if NODE_MAJOR_VERSION >= 11
+        length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_,
+                                    static_cast<int>(len), 0, flags);
+#else
+        // See https://github.com/nodejs/nan/issues/832.
+        // Disable the warning as there is no way around it.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4996)
+#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+        length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+#endif  // NODE_MAJOR_VERSION < 11
+        str_[length_] = '\0';
+      }
+    }
+  }
+
+  inline int length() const {
+    return length_;
+  }
+
+  inline char* operator*() { return str_; }
+  inline const char* operator*() const { return str_; }
+
+  inline ~Utf8String() {
+    if (str_ != str_st_) {
+      free(str_);
+    }
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String)
+
+  int length_;
+  char *str_;
+  char str_st_[1024];
+};
+
+#else  // Node 0.8 and 0.10
+  inline v8::Local<v8::Primitive> Undefined() {
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::Undefined()));
+  }
+
+  inline v8::Local<v8::Primitive> Null() {
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::Null()));
+  }
+
+  inline v8::Local<v8::Boolean> True() {
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::True()));
+  }
+
+  inline v8::Local<v8::Boolean> False() {
+    EscapableHandleScope scope;
+    return scope.Escape(New(v8::False()));
+  }
+
+  inline v8::Local<v8::String> EmptyString() {
+    return v8::String::Empty();
+  }
+
+  inline int AdjustExternalMemory(int bc) {
+    return static_cast<int>(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc));
+  }
+
+  inline void SetTemplate(
+      v8::Local<v8::Template> templ
+    , const char *name
+    , v8::Local<v8::Data> value) {
+    templ->Set(name, value);
+  }
+
+  inline void SetTemplate(
+      v8::Local<v8::Template> templ
+    , v8::Local<v8::String> name
+    , v8::Local<v8::Data> value
+    , v8::PropertyAttribute attributes) {
+    templ->Set(name, value, attributes);
+  }
+
+  inline v8::Local<v8::Context> GetCurrentContext() {
+    return v8::Context::GetCurrent();
+  }
+
+  inline void* GetInternalFieldPointer(
+      v8::Local<v8::Object> object
+    , int index) {
+    return object->GetPointerFromInternalField(index);
+  }
+
+  inline void SetInternalFieldPointer(
+      v8::Local<v8::Object> object
+    , int index
+    , void* value) {
+    object->SetPointerInInternalField(index, value);
+  }
+
+# define NAN_GC_CALLBACK(name)                                                 \
+    void name(v8::GCType type, v8::GCCallbackFlags flags)
+
+  inline void AddGCEpilogueCallback(
+    v8::GCEpilogueCallback callback
+  , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+    v8::V8::AddGCEpilogueCallback(callback, gc_type_filter);
+  }
+  inline void RemoveGCEpilogueCallback(
+    v8::GCEpilogueCallback callback) {
+    v8::V8::RemoveGCEpilogueCallback(callback);
+  }
+  inline void AddGCPrologueCallback(
+    v8::GCPrologueCallback callback
+  , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+    v8::V8::AddGCPrologueCallback(callback, gc_type_filter);
+  }
+  inline void RemoveGCPrologueCallback(
+    v8::GCPrologueCallback callback) {
+    v8::V8::RemoveGCPrologueCallback(callback);
+  }
+  inline void GetHeapStatistics(
+    v8::HeapStatistics *heap_statistics) {
+    v8::V8::GetHeapStatistics(heap_statistics);
+  }
+
+# define X(NAME)                                                               \
+    inline v8::Local<v8::Value> NAME(const char *msg) {                        \
+      EscapableHandleScope scope;                                              \
+      return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked()));     \
+    }                                                                          \
+                                                                               \
+    inline                                                                     \
+    v8::Local<v8::Value> NAME(v8::Local<v8::String> msg) {                     \
+      return v8::Exception::NAME(msg);                                         \
+    }                                                                          \
+                                                                               \
+    inline void Throw ## NAME(const char *msg) {                               \
+      HandleScope scope;                                                       \
+      v8::ThrowException(v8::Exception::NAME(New(msg).ToLocalChecked()));      \
+    }                                                                          \
+                                                                               \
+    inline                                                                     \
+    void Throw ## NAME(v8::Local<v8::String> errmsg) {                         \
+      HandleScope scope;                                                       \
+      v8::ThrowException(v8::Exception::NAME(errmsg));                         \
+    }
+
+  X(Error)
+  X(RangeError)
+  X(ReferenceError)
+  X(SyntaxError)
+  X(TypeError)
+
+# undef X
+
+  inline void ThrowError(v8::Local<v8::Value> error) {
+    v8::ThrowException(error);
+  }
+
+  inline MaybeLocal<v8::Object> NewBuffer(
+      char *data
+    , size_t length
+    , node::Buffer::free_callback callback
+    , void *hint
+  ) {
+    EscapableHandleScope scope;
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(length <= imp::kMaxLength && "too large buffer");
+    return scope.Escape(
+        New(node::Buffer::New(data, length, callback, hint)->handle_));
+  }
+
+  inline MaybeLocal<v8::Object> CopyBuffer(
+      const char *data
+    , uint32_t size
+  ) {
+    EscapableHandleScope scope;
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(size <= imp::kMaxLength && "too large buffer");
+#if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION
+    return scope.Escape(New(node::Buffer::New(data, size)->handle_));
+#else
+    return scope.Escape(
+        New(node::Buffer::New(const_cast<char *>(data), size)->handle_));
+#endif
+  }
+
+  inline MaybeLocal<v8::Object> NewBuffer(uint32_t size) {
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    EscapableHandleScope scope;
+    assert(size <= imp::kMaxLength && "too large buffer");
+    return scope.Escape(New(node::Buffer::New(size)->handle_));
+  }
+
+  inline void FreeData(char *data, void *hint) {
+    (void) hint;  // unused
+    delete[] data;
+  }
+
+  inline MaybeLocal<v8::Object> NewBuffer(
+      char* data
+    , uint32_t size
+  ) {
+    EscapableHandleScope scope;
+    // arbitrary buffer lengths requires
+    // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
+    assert(size <= imp::kMaxLength && "too large buffer");
+    return scope.Escape(
+        New(node::Buffer::New(data, size, FreeData, NULL)->handle_));
+  }
+
+namespace imp {
+inline void
+widenString(std::vector<uint16_t> *ws, const uint8_t *s, int l) {
+  size_t len = static_cast<size_t>(l);
+  if (l < 0) {
+    len = strlen(reinterpret_cast<const char*>(s));
+  }
+  assert(len <= INT_MAX && "string too long");
+  ws->resize(len);
+  std::copy(s, s + len, ws->begin());  // NOLINT(build/include_what_you_use)
+}
+}  // end of namespace imp
+
+  inline MaybeLocal<v8::String>
+  NewOneByteString(const uint8_t * value, int length = -1) {
+    std::vector<uint16_t> wideString;  // NOLINT(build/include_what_you_use)
+    imp::widenString(&wideString, value, length);
+    return v8::String::New(wideString.data(),
+                           static_cast<int>(wideString.size()));
+  }
+
+  inline MaybeLocal<BoundScript> CompileScript(
+      v8::Local<v8::String> s
+    , const v8::ScriptOrigin& origin
+  ) {
+    return v8::Script::Compile(s, const_cast<v8::ScriptOrigin *>(&origin));
+  }
+
+  inline MaybeLocal<BoundScript> CompileScript(
+    v8::Local<v8::String> s
+  ) {
+    return v8::Script::Compile(s);
+  }
+
+  inline
+  MaybeLocal<v8::Value> RunScript(v8::Local<v8::Script> script) {
+    return script->Run();
+  }
+
+  inline v8::Local<v8::Value> MakeCallback(
+      v8::Local<v8::Object> target
+    , v8::Local<v8::Function> func
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+    v8::HandleScope scope;
+    return scope.Close(New(node::MakeCallback(target, func, argc, argv)));
+  }
+
+  inline v8::Local<v8::Value> MakeCallback(
+      v8::Local<v8::Object> target
+    , v8::Local<v8::String> symbol
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+    v8::HandleScope scope;
+    return scope.Close(New(node::MakeCallback(target, symbol, argc, argv)));
+  }
+
+  inline v8::Local<v8::Value> MakeCallback(
+      v8::Local<v8::Object> target
+    , const char* method
+    , int argc
+    , v8::Local<v8::Value>* argv) {
+    v8::HandleScope scope;
+    return scope.Close(New(node::MakeCallback(target, method, argc, argv)));
+  }
+
+  inline void FatalException(const TryCatch& try_catch) {
+    node::FatalException(const_cast<v8::TryCatch &>(try_catch.try_catch_));
+  }
+
+  inline v8::Local<v8::Value> ErrnoException(
+          int errorno
+       ,  const char* syscall = NULL
+       ,  const char* message = NULL
+       ,  const char* path = NULL) {
+    return node::ErrnoException(errorno, syscall, message, path);
+  }
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> NanErrnoException(
+          int errorno
+       ,  const char* syscall = NULL
+       ,  const char* message = NULL
+       ,  const char* path = NULL) {
+    return ErrnoException(errorno, syscall, message, path);
+  }
+
+
+  template<typename T>
+  inline void SetIsolateData(
+      v8::Isolate *isolate
+    , T *data
+  ) {
+      isolate->SetData(data);
+  }
+
+  template<typename T>
+  inline T *GetIsolateData(
+      v8::Isolate *isolate
+  ) {
+      return static_cast<T*>(isolate->GetData());
+  }
+
+class Utf8String {
+ public:
+  inline explicit Utf8String(v8::Local<v8::Value> from) :
+      length_(0), str_(str_st_) {
+    v8::HandleScope scope;
+    if (!from.IsEmpty()) {
+      v8::Local<v8::String> string = from->ToString();
+      if (!string.IsEmpty()) {
+        size_t len = 3 * string->Length() + 1;
+        assert(len <= INT_MAX);
+        if (len > sizeof (str_st_)) {
+          str_ = static_cast<char*>(malloc(len));
+          assert(str_ != 0);
+        }
+        const int flags =
+            v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8;
+        length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
+        str_[length_] = '\0';
+      }
+    }
+  }
+
+  inline int length() const {
+    return length_;
+  }
+
+  inline char* operator*() { return str_; }
+  inline const char* operator*() const { return str_; }
+
+  inline ~Utf8String() {
+    if (str_ != str_st_) {
+      free(str_);
+    }
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String)
+
+  int length_;
+  char *str_;
+  char str_st_[1024];
+};
+
+#endif  // NODE_MODULE_VERSION
+
+typedef void (*FreeCallback)(char *data, void *hint);
+
+typedef const FunctionCallbackInfo<v8::Value>& NAN_METHOD_ARGS_TYPE;
+typedef void NAN_METHOD_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Value>& NAN_GETTER_ARGS_TYPE;
+typedef void NAN_GETTER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<void>& NAN_SETTER_ARGS_TYPE;
+typedef void NAN_SETTER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Value>&
+    NAN_PROPERTY_GETTER_ARGS_TYPE;
+typedef void NAN_PROPERTY_GETTER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Value>&
+    NAN_PROPERTY_SETTER_ARGS_TYPE;
+typedef void NAN_PROPERTY_SETTER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Array>&
+    NAN_PROPERTY_ENUMERATOR_ARGS_TYPE;
+typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Boolean>&
+    NAN_PROPERTY_DELETER_ARGS_TYPE;
+typedef void NAN_PROPERTY_DELETER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Integer>&
+    NAN_PROPERTY_QUERY_ARGS_TYPE;
+typedef void NAN_PROPERTY_QUERY_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Value>& NAN_INDEX_GETTER_ARGS_TYPE;
+typedef void NAN_INDEX_GETTER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Value>& NAN_INDEX_SETTER_ARGS_TYPE;
+typedef void NAN_INDEX_SETTER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Array>&
+    NAN_INDEX_ENUMERATOR_ARGS_TYPE;
+typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Boolean>&
+    NAN_INDEX_DELETER_ARGS_TYPE;
+typedef void NAN_INDEX_DELETER_RETURN_TYPE;
+
+typedef const PropertyCallbackInfo<v8::Integer>&
+    NAN_INDEX_QUERY_ARGS_TYPE;
+typedef void NAN_INDEX_QUERY_RETURN_TYPE;
+
+#define NAN_METHOD(name)                                                       \
+    Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info)
+#define NAN_GETTER(name)                                                       \
+    Nan::NAN_GETTER_RETURN_TYPE name(                                          \
+        v8::Local<v8::String> property                                         \
+      , Nan::NAN_GETTER_ARGS_TYPE info)
+#define NAN_SETTER(name)                                                       \
+    Nan::NAN_SETTER_RETURN_TYPE name(                                          \
+        v8::Local<v8::String> property                                         \
+      , v8::Local<v8::Value> value                                             \
+      , Nan::NAN_SETTER_ARGS_TYPE info)
+#define NAN_PROPERTY_GETTER(name)                                              \
+    Nan::NAN_PROPERTY_GETTER_RETURN_TYPE name(                                 \
+        v8::Local<v8::String> property                                         \
+      , Nan::NAN_PROPERTY_GETTER_ARGS_TYPE info)
+#define NAN_PROPERTY_SETTER(name)                                              \
+    Nan::NAN_PROPERTY_SETTER_RETURN_TYPE name(                                 \
+        v8::Local<v8::String> property                                         \
+      , v8::Local<v8::Value> value                                             \
+      , Nan::NAN_PROPERTY_SETTER_ARGS_TYPE info)
+#define NAN_PROPERTY_ENUMERATOR(name)                                          \
+    Nan::NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(                             \
+        Nan::NAN_PROPERTY_ENUMERATOR_ARGS_TYPE info)
+#define NAN_PROPERTY_DELETER(name)                                             \
+    Nan::NAN_PROPERTY_DELETER_RETURN_TYPE name(                                \
+        v8::Local<v8::String> property                                         \
+      , Nan::NAN_PROPERTY_DELETER_ARGS_TYPE info)
+#define NAN_PROPERTY_QUERY(name)                                               \
+    Nan::NAN_PROPERTY_QUERY_RETURN_TYPE name(                                  \
+        v8::Local<v8::String> property                                         \
+      , Nan::NAN_PROPERTY_QUERY_ARGS_TYPE info)
+# define NAN_INDEX_GETTER(name)                                                \
+    Nan::NAN_INDEX_GETTER_RETURN_TYPE name(                                    \
+        uint32_t index                                                         \
+      , Nan::NAN_INDEX_GETTER_ARGS_TYPE info)
+#define NAN_INDEX_SETTER(name)                                                 \
+    Nan::NAN_INDEX_SETTER_RETURN_TYPE name(                                    \
+        uint32_t index                                                         \
+      , v8::Local<v8::Value> value                                             \
+      , Nan::NAN_INDEX_SETTER_ARGS_TYPE info)
+#define NAN_INDEX_ENUMERATOR(name)                                             \
+    Nan::NAN_INDEX_ENUMERATOR_RETURN_TYPE                                      \
+    name(Nan::NAN_INDEX_ENUMERATOR_ARGS_TYPE info)
+#define NAN_INDEX_DELETER(name)                                                \
+    Nan::NAN_INDEX_DELETER_RETURN_TYPE name(                                   \
+        uint32_t index                                                         \
+      , Nan::NAN_INDEX_DELETER_ARGS_TYPE info)
+#define NAN_INDEX_QUERY(name)                                                  \
+    Nan::NAN_INDEX_QUERY_RETURN_TYPE name(                                     \
+        uint32_t index                                                         \
+      , Nan::NAN_INDEX_QUERY_ARGS_TYPE info)
+
+class Callback {
+ public:
+  Callback() {}
+
+  explicit Callback(const v8::Local<v8::Function> &fn) : handle_(fn) {}
+
+  ~Callback() {
+    handle_.Reset();
+  }
+
+  bool operator==(const Callback &other) const {
+    return handle_ == other.handle_;
+  }
+
+  bool operator!=(const Callback &other) const {
+    return !operator==(other);
+  }
+
+  inline
+  v8::Local<v8::Function> operator*() const { return GetFunction(); }
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> operator()(
+      v8::Local<v8::Object> target
+    , int argc = 0
+    , v8::Local<v8::Value> argv[] = 0) const {
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource async("nan:Callback:operator()");
+    return Call_(isolate, target, argc, argv, &async)
+        .FromMaybe(v8::Local<v8::Value>());
+# else
+    return Call_(isolate, target, argc, argv);
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#else
+    return Call_(target, argc, argv);
+#endif  //  NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  }
+
+  NAN_DEPRECATED inline v8::Local<v8::Value> operator()(
+      int argc = 0
+    , v8::Local<v8::Value> argv[] = 0) const {
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource async("nan:Callback:operator()");
+    return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(),
+                              argc, argv, &async)
+                            .FromMaybe(v8::Local<v8::Value>()));
+# else
+    return scope.Escape(
+        Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv));
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#else
+    v8::HandleScope scope;
+    return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv));
+#endif  //  NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  }
+
+  inline MaybeLocal<v8::Value> operator()(
+      AsyncResource* resource
+    , int argc = 0
+    , v8::Local<v8::Value> argv[] = 0) const {
+    return this->Call(argc, argv, resource);
+  }
+
+  inline MaybeLocal<v8::Value> operator()(
+      AsyncResource* resource
+    , v8::Local<v8::Object> target
+    , int argc = 0
+    , v8::Local<v8::Value> argv[] = 0) const {
+    return this->Call(target, argc, argv, resource);
+  }
+
+  // TODO(kkoopa): remove
+  inline void SetFunction(const v8::Local<v8::Function> &fn) {
+    Reset(fn);
+  }
+
+  inline void Reset(const v8::Local<v8::Function> &fn) {
+    handle_.Reset(fn);
+  }
+
+  inline void Reset() {
+    handle_.Reset();
+  }
+
+  inline v8::Local<v8::Function> GetFunction() const {
+    return New(handle_);
+  }
+
+  inline bool IsEmpty() const {
+    return handle_.IsEmpty();
+  }
+
+  // Deprecated: For async callbacks Use the versions that accept an
+  // AsyncResource. If this callback does not correspond to an async resource,
+  // that is, it is a synchronous function call on a non-empty JS stack, you
+  // should Nan::Call instead.
+  NAN_DEPRECATED inline v8::Local<v8::Value>
+  Call(v8::Local<v8::Object> target
+     , int argc
+     , v8::Local<v8::Value> argv[]) const {
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource async("nan:Callback:Call");
+    return Call_(isolate, target, argc, argv, &async)
+        .FromMaybe(v8::Local<v8::Value>());
+# else
+    return Call_(isolate, target, argc, argv);
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#else
+    return Call_(target, argc, argv);
+#endif
+  }
+
+  // Deprecated: For async callbacks Use the versions that accept an
+  // AsyncResource. If this callback does not correspond to an async resource,
+  // that is, it is a synchronous function call on a non-empty JS stack, you
+  // should Nan::Call instead.
+  NAN_DEPRECATED inline v8::Local<v8::Value>
+  Call(int argc, v8::Local<v8::Value> argv[]) const {
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    AsyncResource async("nan:Callback:Call");
+    return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(),
+                              argc, argv, &async)
+                            .FromMaybe(v8::Local<v8::Value>()));
+# else
+    return scope.Escape(
+        Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv));
+# endif  // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+#else
+    v8::HandleScope scope;
+    return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv));
+#endif
+  }
+
+  inline MaybeLocal<v8::Value>
+  Call(v8::Local<v8::Object> target
+     , int argc
+     , v8::Local<v8::Value> argv[]
+     , AsyncResource* resource) const {
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    v8::Isolate* isolate = v8::Isolate::GetCurrent();
+    return Call_(isolate, target, argc, argv, resource);
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    return Call_(isolate, target, argc, argv);
+#else
+    return Call_(target, argc, argv);
+#endif
+  }
+
+  inline MaybeLocal<v8::Value>
+  Call(int argc, v8::Local<v8::Value> argv[], AsyncResource* resource) const {
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+    v8::Isolate* isolate = v8::Isolate::GetCurrent();
+    return Call(isolate->GetCurrentContext()->Global(), argc, argv, resource);
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+    v8::Isolate *isolate = v8::Isolate::GetCurrent();
+    v8::EscapableHandleScope scope(isolate);
+    return scope.Escape(
+        Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv));
+#else
+    v8::HandleScope scope;
+    return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv));
+#endif
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(Callback)
+  Persistent<v8::Function> handle_;
+
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+  MaybeLocal<v8::Value> Call_(v8::Isolate *isolate
+                            , v8::Local<v8::Object> target
+                            , int argc
+                            , v8::Local<v8::Value> argv[]
+                            , AsyncResource* resource) const {
+    EscapableHandleScope scope;
+    v8::Local<v8::Function> func = New(handle_);
+    auto maybe = resource->runInAsyncScope(target, func, argc, argv);
+    v8::Local<v8::Value> local;
+    if (!maybe.ToLocal(&local)) return MaybeLocal<v8::Value>();
+    return scope.Escape(local);
+  }
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  v8::Local<v8::Value> Call_(v8::Isolate *isolate
+                           , v8::Local<v8::Object> target
+                           , int argc
+                           , v8::Local<v8::Value> argv[]) const {
+    EscapableHandleScope scope;
+
+    v8::Local<v8::Function> callback = New(handle_);
+# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+    return scope.Escape(New(node::MakeCallback(
+        isolate
+      , target
+      , callback
+      , argc
+      , argv
+    )));
+# else
+    return scope.Escape(node::MakeCallback(
+        isolate
+      , target
+      , callback
+      , argc
+      , argv
+    ));
+# endif
+  }
+#else
+  v8::Local<v8::Value> Call_(v8::Local<v8::Object> target
+                           , int argc
+                           , v8::Local<v8::Value> argv[]) const {
+    EscapableHandleScope scope;
+
+    v8::Local<v8::Function> callback = New(handle_);
+    return scope.Escape(New(node::MakeCallback(
+        target
+      , callback
+      , argc
+      , argv
+    )));
+  }
+#endif
+};
+
+inline MaybeLocal<v8::Value> Call(
+    const Nan::Callback& callback
+  , v8::Local<v8::Object> recv
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  return Call(*callback, recv, argc, argv);
+}
+
+inline MaybeLocal<v8::Value> Call(
+    const Nan::Callback& callback
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  v8::Isolate* isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(
+      Call(*callback, isolate->GetCurrentContext()->Global(), argc, argv)
+          .FromMaybe(v8::Local<v8::Value>()));
+#else
+  EscapableHandleScope scope;
+  return scope.Escape(
+      Call(*callback, v8::Context::GetCurrent()->Global(), argc, argv)
+          .FromMaybe(v8::Local<v8::Value>()));
+#endif
+}
+
+inline MaybeLocal<v8::Value> Call(
+    v8::Local<v8::String> symbol
+  , v8::Local<v8::Object> recv
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  EscapableHandleScope scope;
+  v8::Local<v8::Value> fn_v =
+      Get(recv, symbol).FromMaybe(v8::Local<v8::Value>());
+  if (fn_v.IsEmpty() || !fn_v->IsFunction()) return v8::Local<v8::Value>();
+  v8::Local<v8::Function> fn = fn_v.As<v8::Function>();
+  return scope.Escape(
+      Call(fn, recv, argc, argv).FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline MaybeLocal<v8::Value> Call(
+    const char* method
+  , v8::Local<v8::Object> recv
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  EscapableHandleScope scope;
+  v8::Local<v8::String> method_string =
+      New<v8::String>(method).ToLocalChecked();
+  return scope.Escape(
+      Call(method_string, recv, argc, argv).FromMaybe(v8::Local<v8::Value>()));
+}
+
+/* abstract */ class AsyncWorker {
+ public:
+  explicit AsyncWorker(Callback *callback_,
+                       const char* resource_name = "nan:AsyncWorker")
+      : callback(callback_), errmsg_(NULL) {
+    request.data = this;
+
+    HandleScope scope;
+    v8::Local<v8::Object> obj = New<v8::Object>();
+    persistentHandle.Reset(obj);
+    async_resource = new AsyncResource(resource_name, obj);
+  }
+
+  virtual ~AsyncWorker() {
+    HandleScope scope;
+
+    if (!persistentHandle.IsEmpty())
+      persistentHandle.Reset();
+    delete callback;
+    delete[] errmsg_;
+    delete async_resource;
+  }
+
+  virtual void WorkComplete() {
+    HandleScope scope;
+
+    if (errmsg_ == NULL)
+      HandleOKCallback();
+    else
+      HandleErrorCallback();
+    delete callback;
+    callback = NULL;
+  }
+
+  inline void SaveToPersistent(
+      const char *key, const v8::Local<v8::Value> &value) {
+    HandleScope scope;
+    Set(New(persistentHandle), New(key).ToLocalChecked(), value).FromJust();
+  }
+
+  inline void SaveToPersistent(
+      const v8::Local<v8::String> &key, const v8::Local<v8::Value> &value) {
+    HandleScope scope;
+    Set(New(persistentHandle), key, value).FromJust();
+  }
+
+  inline void SaveToPersistent(
+      uint32_t index, const v8::Local<v8::Value> &value) {
+    HandleScope scope;
+    Set(New(persistentHandle), index, value).FromJust();
+  }
+
+  inline v8::Local<v8::Value> GetFromPersistent(const char *key) const {
+    EscapableHandleScope scope;
+    return scope.Escape(
+        Get(New(persistentHandle), New(key).ToLocalChecked())
+        .FromMaybe(v8::Local<v8::Value>()));
+  }
+
+  inline v8::Local<v8::Value>
+  GetFromPersistent(const v8::Local<v8::String> &key) const {
+    EscapableHandleScope scope;
+    return scope.Escape(
+        Get(New(persistentHandle), key)
+        .FromMaybe(v8::Local<v8::Value>()));
+  }
+
+  inline v8::Local<v8::Value> GetFromPersistent(uint32_t index) const {
+    EscapableHandleScope scope;
+    return scope.Escape(
+        Get(New(persistentHandle), index)
+        .FromMaybe(v8::Local<v8::Value>()));
+  }
+
+  virtual void Execute() = 0;
+
+  uv_work_t request;
+
+  virtual void Destroy() {
+      delete this;
+  }
+
+ protected:
+  Persistent<v8::Object> persistentHandle;
+  Callback *callback;
+  AsyncResource *async_resource;
+
+  virtual void HandleOKCallback() {
+    HandleScope scope;
+
+    callback->Call(0, NULL, async_resource);
+  }
+
+  virtual void HandleErrorCallback() {
+    HandleScope scope;
+
+    v8::Local<v8::Value> argv[] = {
+      v8::Exception::Error(New<v8::String>(ErrorMessage()).ToLocalChecked())
+    };
+    callback->Call(1, argv, async_resource);
+  }
+
+  void SetErrorMessage(const char *msg) {
+    delete[] errmsg_;
+
+    size_t size = strlen(msg) + 1;
+    errmsg_ = new char[size];
+    memcpy(errmsg_, msg, size);
+  }
+
+  const char* ErrorMessage() const {
+    return errmsg_;
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncWorker)
+  char *errmsg_;
+};
+
+/* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker {
+ public:
+  explicit AsyncBareProgressWorkerBase(
+      Callback *callback_,
+      const char* resource_name = "nan:AsyncBareProgressWorkerBase")
+      : AsyncWorker(callback_, resource_name) {
+    uv_async_init(
+        GetCurrentEventLoop()
+      , &async
+      , AsyncProgress_
+    );
+    async.data = this;
+  }
+
+  virtual ~AsyncBareProgressWorkerBase() {
+  }
+
+  virtual void WorkProgress() = 0;
+
+  virtual void Destroy() {
+      uv_close(reinterpret_cast<uv_handle_t*>(&async), AsyncClose_);
+  }
+
+ private:
+  inline static NAUV_WORK_CB(AsyncProgress_) {
+    AsyncBareProgressWorkerBase *worker =
+            static_cast<AsyncBareProgressWorkerBase*>(async->data);
+    worker->WorkProgress();
+  }
+
+  inline static void AsyncClose_(uv_handle_t* handle) {
+    AsyncBareProgressWorkerBase *worker =
+            static_cast<AsyncBareProgressWorkerBase*>(handle->data);
+    delete worker;
+  }
+
+ protected:
+  uv_async_t async;
+};
+
+template<class T>
+/* abstract */
+class AsyncBareProgressWorker : public AsyncBareProgressWorkerBase {
+ public:
+  explicit AsyncBareProgressWorker(
+      Callback *callback_,
+      const char* resource_name = "nan:AsyncBareProgressWorker")
+      : AsyncBareProgressWorkerBase(callback_, resource_name) {
+    uv_mutex_init(&async_lock);
+  }
+
+  virtual ~AsyncBareProgressWorker() {
+    uv_mutex_destroy(&async_lock);
+  }
+
+  class ExecutionProgress {
+    friend class AsyncBareProgressWorker;
+   public:
+    void Signal() const {
+      uv_mutex_lock(&that_->async_lock);
+      uv_async_send(&that_->async);
+      uv_mutex_unlock(&that_->async_lock);
+    }
+
+    void Send(const T* data, size_t count) const {
+      that_->SendProgress_(data, count);
+    }
+
+   private:
+    explicit ExecutionProgress(AsyncBareProgressWorker *that) : that_(that) {}
+    NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress)
+    AsyncBareProgressWorker* const that_;
+  };
+
+  virtual void Execute(const ExecutionProgress& progress) = 0;
+  virtual void HandleProgressCallback(const T *data, size_t size) = 0;
+
+ protected:
+  uv_mutex_t async_lock;
+
+ private:
+  void Execute() /*final override*/ {
+    ExecutionProgress progress(this);
+    Execute(progress);
+  }
+
+  virtual void SendProgress_(const T *data, size_t count) = 0;
+};
+
+template<class T>
+/* abstract */
+class AsyncProgressWorkerBase : public AsyncBareProgressWorker<T> {
+ public:
+  explicit AsyncProgressWorkerBase(
+      Callback *callback_,
+      const char* resource_name = "nan:AsyncProgressWorkerBase")
+      : AsyncBareProgressWorker<T>(callback_, resource_name), asyncdata_(NULL),
+        asyncsize_(0) {
+  }
+
+  virtual ~AsyncProgressWorkerBase() {
+    delete[] asyncdata_;
+  }
+
+  void WorkProgress() {
+    uv_mutex_lock(&this->async_lock);
+    T *data = asyncdata_;
+    size_t size = asyncsize_;
+    asyncdata_ = NULL;
+    asyncsize_ = 0;
+    uv_mutex_unlock(&this->async_lock);
+
+    // Don't send progress events after we've already completed.
+    if (this->callback) {
+        this->HandleProgressCallback(data, size);
+    }
+    delete[] data;
+  }
+
+ private:
+  void SendProgress_(const T *data, size_t count) {
+    T *new_data = new T[count];
+    std::copy(data, data + count, new_data);
+
+    uv_mutex_lock(&this->async_lock);
+    T *old_data = asyncdata_;
+    asyncdata_ = new_data;
+    asyncsize_ = count;
+    uv_async_send(&this->async);
+    uv_mutex_unlock(&this->async_lock);
+
+    delete[] old_data;
+  }
+
+  T *asyncdata_;
+  size_t asyncsize_;
+};
+
+// This ensures compatibility to the previous un-templated AsyncProgressWorker
+// class definition.
+typedef AsyncProgressWorkerBase<char> AsyncProgressWorker;
+
+template<class T>
+/* abstract */
+class AsyncBareProgressQueueWorker : public AsyncBareProgressWorkerBase {
+ public:
+  explicit AsyncBareProgressQueueWorker(
+      Callback *callback_,
+      const char* resource_name = "nan:AsyncBareProgressQueueWorker")
+      : AsyncBareProgressWorkerBase(callback_, resource_name) {
+  }
+
+  virtual ~AsyncBareProgressQueueWorker() {
+  }
+
+  class ExecutionProgress {
+    friend class AsyncBareProgressQueueWorker;
+   public:
+    void Send(const T* data, size_t count) const {
+      that_->SendProgress_(data, count);
+    }
+
+   private:
+    explicit ExecutionProgress(AsyncBareProgressQueueWorker *that)
+        : that_(that) {}
+    NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress)
+    AsyncBareProgressQueueWorker* const that_;
+  };
+
+  virtual void Execute(const ExecutionProgress& progress) = 0;
+  virtual void HandleProgressCallback(const T *data, size_t size) = 0;
+
+ private:
+  void Execute() /*final override*/ {
+    ExecutionProgress progress(this);
+    Execute(progress);
+  }
+
+  virtual void SendProgress_(const T *data, size_t count) = 0;
+};
+
+template<class T>
+/* abstract */
+class AsyncProgressQueueWorker : public AsyncBareProgressQueueWorker<T> {
+ public:
+  explicit AsyncProgressQueueWorker(
+      Callback *callback_,
+      const char* resource_name = "nan:AsyncProgressQueueWorker")
+      : AsyncBareProgressQueueWorker<T>(callback_) {
+    uv_mutex_init(&async_lock);
+  }
+
+  virtual ~AsyncProgressQueueWorker() {
+    uv_mutex_lock(&async_lock);
+
+    while (!asyncdata_.empty()) {
+      std::pair<T*, size_t> &datapair = asyncdata_.front();
+      T *data = datapair.first;
+
+      asyncdata_.pop();
+
+      delete[] data;
+    }
+
+    uv_mutex_unlock(&async_lock);
+    uv_mutex_destroy(&async_lock);
+  }
+
+  void WorkComplete() {
+    WorkProgress();
+    AsyncWorker::WorkComplete();
+  }
+
+  void WorkProgress() {
+    uv_mutex_lock(&async_lock);
+
+    while (!asyncdata_.empty()) {
+      std::pair<T*, size_t> &datapair = asyncdata_.front();
+
+      T *data = datapair.first;
+      size_t size = datapair.second;
+
+      asyncdata_.pop();
+      uv_mutex_unlock(&async_lock);
+
+      // Don't send progress events after we've already completed.
+      if (this->callback) {
+          this->HandleProgressCallback(data, size);
+      }
+
+      delete[] data;
+
+      uv_mutex_lock(&async_lock);
+    }
+
+    uv_mutex_unlock(&async_lock);
+  }
+
+ private:
+  void SendProgress_(const T *data, size_t count) {
+    T *new_data = new T[count];
+    std::copy(data, data + count, new_data);
+
+    uv_mutex_lock(&async_lock);
+    asyncdata_.push(std::pair<T*, size_t>(new_data, count));
+    uv_mutex_unlock(&async_lock);
+
+    uv_async_send(&this->async);
+  }
+
+  uv_mutex_t async_lock;
+  std::queue<std::pair<T*, size_t> > asyncdata_;
+};
+
+inline void AsyncExecute (uv_work_t* req) {
+  AsyncWorker *worker = static_cast<AsyncWorker*>(req->data);
+  worker->Execute();
+}
+
+/* uv_after_work_cb has 1 argument before node-v0.9.4 and
+ * 2 arguments since node-v0.9.4
+ * https://github.com/libuv/libuv/commit/92fb84b751e18f032c02609467f44bfe927b80c5
+ */
+inline void AsyncExecuteComplete(uv_work_t *req) {
+  AsyncWorker* worker = static_cast<AsyncWorker*>(req->data);
+  worker->WorkComplete();
+  worker->Destroy();
+}
+inline void AsyncExecuteComplete (uv_work_t* req, int status) {
+  AsyncExecuteComplete(req);
+}
+
+inline void AsyncQueueWorker (AsyncWorker* worker) {
+  uv_queue_work(
+      GetCurrentEventLoop()
+    , &worker->request
+    , AsyncExecute
+    , AsyncExecuteComplete
+  );
+}
+
+namespace imp {
+
+inline
+ExternalOneByteStringResource const*
+GetExternalResource(v8::Local<v8::String> str) {
+#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION
+    return str->GetExternalAsciiStringResource();
+#else
+    return str->GetExternalOneByteStringResource();
+#endif
+}
+
+inline
+bool
+IsExternal(v8::Local<v8::String> str) {
+#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION
+    return str->IsExternalAscii();
+#else
+    return str->IsExternalOneByte();
+#endif
+}
+
+}  // end of namespace imp
+
+enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER};
+
+#if NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION
+# include "nan_string_bytes.h"  // NOLINT(build/include)
+#endif
+
+inline v8::Local<v8::Value> Encode(
+    const void *buf, size_t len, enum Encoding encoding = BINARY) {
+#if (NODE_MODULE_VERSION >= ATOM_0_21_MODULE_VERSION)
+  v8::Isolate* isolate = v8::Isolate::GetCurrent();
+  node::encoding node_enc = static_cast<node::encoding>(encoding);
+
+  if (encoding == UCS2) {
+    return node::Encode(
+        isolate
+      , reinterpret_cast<const uint16_t *>(buf)
+      , len / 2);
+  } else {
+    return node::Encode(
+        isolate
+      , reinterpret_cast<const char *>(buf)
+      , len
+      , node_enc);
+  }
+#elif (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION)
+  return node::Encode(
+      v8::Isolate::GetCurrent()
+    , buf, len
+    , static_cast<node::encoding>(encoding));
+#else
+# if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION
+  return node::Encode(buf, len, static_cast<node::encoding>(encoding));
+# else
+  return imp::Encode(reinterpret_cast<const char*>(buf), len, encoding);
+# endif
+#endif
+}
+
+inline ssize_t DecodeBytes(
+    v8::Local<v8::Value> val, enum Encoding encoding = BINARY) {
+#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION)
+  return node::DecodeBytes(
+      v8::Isolate::GetCurrent()
+    , val
+    , static_cast<node::encoding>(encoding));
+#else
+# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION)
+  if (encoding == BUFFER) {
+    return node::DecodeBytes(val, node::BINARY);
+  }
+# endif
+  return node::DecodeBytes(val, static_cast<node::encoding>(encoding));
+#endif
+}
+
+inline ssize_t DecodeWrite(
+    char *buf
+  , size_t len
+  , v8::Local<v8::Value> val
+  , enum Encoding encoding = BINARY) {
+#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION)
+  return node::DecodeWrite(
+      v8::Isolate::GetCurrent()
+    , buf
+    , len
+    , val
+    , static_cast<node::encoding>(encoding));
+#else
+# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION)
+  if (encoding == BUFFER) {
+    return node::DecodeWrite(buf, len, val, node::BINARY);
+  }
+# endif
+  return node::DecodeWrite(
+      buf
+    , len
+    , val
+    , static_cast<node::encoding>(encoding));
+#endif
+}
+
+inline void SetPrototypeTemplate(
+    v8::Local<v8::FunctionTemplate> templ
+  , const char *name
+  , v8::Local<v8::Data> value
+) {
+  HandleScope scope;
+  SetTemplate(templ->PrototypeTemplate(), name, value);
+}
+
+inline void SetPrototypeTemplate(
+    v8::Local<v8::FunctionTemplate> templ
+  , v8::Local<v8::String> name
+  , v8::Local<v8::Data> value
+  , v8::PropertyAttribute attributes
+) {
+  HandleScope scope;
+  SetTemplate(templ->PrototypeTemplate(), name, value, attributes);
+}
+
+inline void SetInstanceTemplate(
+    v8::Local<v8::FunctionTemplate> templ
+  , const char *name
+  , v8::Local<v8::Data> value
+) {
+  HandleScope scope;
+  SetTemplate(templ->InstanceTemplate(), name, value);
+}
+
+inline void SetInstanceTemplate(
+    v8::Local<v8::FunctionTemplate> templ
+  , v8::Local<v8::String> name
+  , v8::Local<v8::Data> value
+  , v8::PropertyAttribute attributes
+) {
+  HandleScope scope;
+  SetTemplate(templ->InstanceTemplate(), name, value, attributes);
+}
+
+namespace imp {
+
+// Note(@agnat): Helper to distinguish different receiver types. The first
+// version deals with receivers derived from v8::Template. The second version
+// handles everything else. The final argument only serves as discriminator and
+// is unused.
+template <typename T>
+inline
+void
+SetMethodAux(T recv,
+             v8::Local<v8::String> name,
+             v8::Local<v8::FunctionTemplate> tpl,
+             v8::Template *) {
+  recv->Set(name, tpl);
+}
+
+template <typename T>
+inline
+void
+SetMethodAux(T recv,
+             v8::Local<v8::String> name,
+             v8::Local<v8::FunctionTemplate> tpl,
+             ...) {
+  Set(recv, name, GetFunction(tpl).ToLocalChecked());
+}
+
+}  // end of namespace imp
+
+template <typename T, template <typename> class HandleType>
+inline void SetMethod(
+    HandleType<T> recv
+  , const char *name
+  , FunctionCallback callback
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+  HandleScope scope;
+  v8::Local<v8::FunctionTemplate> t = New<v8::FunctionTemplate>(callback, data);
+  v8::Local<v8::String> fn_name = New(name).ToLocalChecked();
+  t->SetClassName(fn_name);
+  // Note(@agnat): Pass an empty T* as discriminator. See note on
+  // SetMethodAux(...) above
+  imp::SetMethodAux(recv, fn_name, t, static_cast<T*>(0));
+}
+
+inline void SetPrototypeMethod(
+    v8::Local<v8::FunctionTemplate> recv
+  , const char* name
+  , FunctionCallback callback
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+  HandleScope scope;
+  v8::Local<v8::FunctionTemplate> t = New<v8::FunctionTemplate>(
+      callback
+    , data
+    , New<v8::Signature>(recv));
+  v8::Local<v8::String> fn_name = New(name).ToLocalChecked();
+  recv->PrototypeTemplate()->Set(fn_name, t);
+  t->SetClassName(fn_name);
+}
+
+//=== Accessors and Such =======================================================
+
+inline void SetAccessor(
+    v8::Local<v8::ObjectTemplate> tpl
+  , v8::Local<v8::String> name
+  , GetterCallback getter
+  , SetterCallback setter = 0
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()
+  , v8::AccessControl settings = v8::DEFAULT
+  , v8::PropertyAttribute attribute = v8::None
+  , imp::Sig signature = imp::Sig()) {
+  HandleScope scope;
+
+  imp::NativeGetter getter_ =
+      imp::GetterCallbackWrapper;
+  imp::NativeSetter setter_ =
+      setter ? imp::SetterCallbackWrapper : 0;
+
+  v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>();
+  otpl->SetInternalFieldCount(imp::kAccessorFieldCount);
+  v8::Local<v8::Object> obj = NewInstance(otpl).ToLocalChecked();
+
+  obj->SetInternalField(
+      imp::kGetterIndex
+    , New<v8::External>(reinterpret_cast<void *>(getter)));
+
+  if (setter != 0) {
+    obj->SetInternalField(
+        imp::kSetterIndex
+      , New<v8::External>(reinterpret_cast<void *>(setter)));
+  }
+
+  if (!data.IsEmpty()) {
+    obj->SetInternalField(imp::kDataIndex, data);
+  }
+
+  tpl->SetAccessor(
+      name
+    , getter_
+    , setter_
+    , obj
+    , settings
+    , attribute
+    , signature);
+}
+
+inline bool SetAccessor(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> name
+  , GetterCallback getter
+  , SetterCallback setter = 0
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()
+  , v8::AccessControl settings = v8::DEFAULT
+  , v8::PropertyAttribute attribute = v8::None) {
+  HandleScope scope;
+
+  imp::NativeGetter getter_ =
+      imp::GetterCallbackWrapper;
+  imp::NativeSetter setter_ =
+      setter ? imp::SetterCallbackWrapper : 0;
+
+  v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>();
+  otpl->SetInternalFieldCount(imp::kAccessorFieldCount);
+  v8::Local<v8::Object> dataobj = NewInstance(otpl).ToLocalChecked();
+
+  dataobj->SetInternalField(
+      imp::kGetterIndex
+    , New<v8::External>(reinterpret_cast<void *>(getter)));
+
+  if (!data.IsEmpty()) {
+    dataobj->SetInternalField(imp::kDataIndex, data);
+  }
+
+  if (setter) {
+    dataobj->SetInternalField(
+        imp::kSetterIndex
+      , New<v8::External>(reinterpret_cast<void *>(setter)));
+  }
+
+#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
+  return obj->SetAccessor(
+      GetCurrentContext()
+    , name
+    , getter_
+    , setter_
+    , dataobj
+    , settings
+    , attribute).FromMaybe(false);
+#else
+  return obj->SetAccessor(
+      name
+    , getter_
+    , setter_
+    , dataobj
+    , settings
+    , attribute);
+#endif
+}
+
+inline void SetNamedPropertyHandler(
+    v8::Local<v8::ObjectTemplate> tpl
+  , PropertyGetterCallback getter
+  , PropertySetterCallback setter = 0
+  , PropertyQueryCallback query = 0
+  , PropertyDeleterCallback deleter = 0
+  , PropertyEnumeratorCallback enumerator = 0
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+  HandleScope scope;
+
+  imp::NativePropertyGetter getter_ =
+      imp::PropertyGetterCallbackWrapper;
+  imp::NativePropertySetter setter_ =
+      setter ? imp::PropertySetterCallbackWrapper : 0;
+  imp::NativePropertyQuery query_ =
+      query ? imp::PropertyQueryCallbackWrapper : 0;
+  imp::NativePropertyDeleter *deleter_ =
+      deleter ? imp::PropertyDeleterCallbackWrapper : 0;
+  imp::NativePropertyEnumerator enumerator_ =
+      enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0;
+
+  v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>();
+  otpl->SetInternalFieldCount(imp::kPropertyFieldCount);
+  v8::Local<v8::Object> obj = NewInstance(otpl).ToLocalChecked();
+  obj->SetInternalField(
+      imp::kPropertyGetterIndex
+    , New<v8::External>(reinterpret_cast<void *>(getter)));
+
+  if (setter) {
+    obj->SetInternalField(
+        imp::kPropertySetterIndex
+      , New<v8::External>(reinterpret_cast<void *>(setter)));
+  }
+
+  if (query) {
+    obj->SetInternalField(
+        imp::kPropertyQueryIndex
+      , New<v8::External>(reinterpret_cast<void *>(query)));
+  }
+
+  if (deleter) {
+    obj->SetInternalField(
+        imp::kPropertyDeleterIndex
+      , New<v8::External>(reinterpret_cast<void *>(deleter)));
+  }
+
+  if (enumerator) {
+    obj->SetInternalField(
+        imp::kPropertyEnumeratorIndex
+      , New<v8::External>(reinterpret_cast<void *>(enumerator)));
+  }
+
+  if (!data.IsEmpty()) {
+    obj->SetInternalField(imp::kDataIndex, data);
+  }
+
+#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+  tpl->SetHandler(v8::NamedPropertyHandlerConfiguration(
+      getter_, setter_, query_, deleter_, enumerator_, obj));
+#else
+  tpl->SetNamedPropertyHandler(
+      getter_
+    , setter_
+    , query_
+    , deleter_
+    , enumerator_
+    , obj);
+#endif
+}
+
+inline void SetIndexedPropertyHandler(
+    v8::Local<v8::ObjectTemplate> tpl
+  , IndexGetterCallback getter
+  , IndexSetterCallback setter = 0
+  , IndexQueryCallback query = 0
+  , IndexDeleterCallback deleter = 0
+  , IndexEnumeratorCallback enumerator = 0
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+  HandleScope scope;
+
+  imp::NativeIndexGetter getter_ =
+      imp::IndexGetterCallbackWrapper;
+  imp::NativeIndexSetter setter_ =
+      setter ? imp::IndexSetterCallbackWrapper : 0;
+  imp::NativeIndexQuery query_ =
+      query ? imp::IndexQueryCallbackWrapper : 0;
+  imp::NativeIndexDeleter deleter_ =
+      deleter ? imp::IndexDeleterCallbackWrapper : 0;
+  imp::NativeIndexEnumerator enumerator_ =
+      enumerator ? imp::IndexEnumeratorCallbackWrapper : 0;
+
+  v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>();
+  otpl->SetInternalFieldCount(imp::kIndexPropertyFieldCount);
+  v8::Local<v8::Object> obj = NewInstance(otpl).ToLocalChecked();
+  obj->SetInternalField(
+      imp::kIndexPropertyGetterIndex
+    , New<v8::External>(reinterpret_cast<void *>(getter)));
+
+  if (setter) {
+    obj->SetInternalField(
+        imp::kIndexPropertySetterIndex
+      , New<v8::External>(reinterpret_cast<void *>(setter)));
+  }
+
+  if (query) {
+    obj->SetInternalField(
+        imp::kIndexPropertyQueryIndex
+      , New<v8::External>(reinterpret_cast<void *>(query)));
+  }
+
+  if (deleter) {
+    obj->SetInternalField(
+        imp::kIndexPropertyDeleterIndex
+      , New<v8::External>(reinterpret_cast<void *>(deleter)));
+  }
+
+  if (enumerator) {
+    obj->SetInternalField(
+        imp::kIndexPropertyEnumeratorIndex
+      , New<v8::External>(reinterpret_cast<void *>(enumerator)));
+  }
+
+  if (!data.IsEmpty()) {
+    obj->SetInternalField(imp::kDataIndex, data);
+  }
+
+#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+  tpl->SetHandler(v8::IndexedPropertyHandlerConfiguration(
+      getter_, setter_, query_, deleter_, enumerator_, obj));
+#else
+  tpl->SetIndexedPropertyHandler(
+      getter_
+    , setter_
+    , query_
+    , deleter_
+    , enumerator_
+    , obj);
+#endif
+}
+
+inline void SetCallHandler(
+    v8::Local<v8::FunctionTemplate> tpl
+  , FunctionCallback callback
+  , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+  HandleScope scope;
+
+  v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>();
+  otpl->SetInternalFieldCount(imp::kFunctionFieldCount);
+  v8::Local<v8::Object> obj = NewInstance(otpl).ToLocalChecked();
+
+  obj->SetInternalField(
+      imp::kFunctionIndex
+    , New<v8::External>(reinterpret_cast<void *>(callback)));
+
+  if (!data.IsEmpty()) {
+    obj->SetInternalField(imp::kDataIndex, data);
+  }
+
+  tpl->SetCallHandler(imp::FunctionCallbackWrapper, obj);
+}
+
+
+inline void SetCallAsFunctionHandler(
+    v8::Local<v8::ObjectTemplate> tpl,
+    FunctionCallback callback,
+    v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+  HandleScope scope;
+
+  v8::Local<v8::ObjectTemplate> otpl = New<v8::ObjectTemplate>();
+  otpl->SetInternalFieldCount(imp::kFunctionFieldCount);
+  v8::Local<v8::Object> obj = NewInstance(otpl).ToLocalChecked();
+
+  obj->SetInternalField(
+      imp::kFunctionIndex
+    , New<v8::External>(reinterpret_cast<void *>(callback)));
+
+  if (!data.IsEmpty()) {
+    obj->SetInternalField(imp::kDataIndex, data);
+  }
+
+  tpl->SetCallAsFunctionHandler(imp::FunctionCallbackWrapper, obj);
+}
+
+//=== Weak Persistent Handling =================================================
+
+#include "nan_weak.h"  // NOLINT(build/include)
+
+//=== ObjectWrap ===============================================================
+
+#include "nan_object_wrap.h"  // NOLINT(build/include)
+
+//=== HiddenValue/Private ======================================================
+
+#include "nan_private.h"  // NOLINT(build/include)
+
+//=== Export ==================================================================
+
+inline
+void
+Export(ADDON_REGISTER_FUNCTION_ARGS_TYPE target, const char *name,
+    FunctionCallback f) {
+  HandleScope scope;
+
+  Set(target, New<v8::String>(name).ToLocalChecked(),
+      GetFunction(New<v8::FunctionTemplate>(f)).ToLocalChecked());
+}
+
+//=== Tap Reverse Binding =====================================================
+
+struct Tap {
+  explicit Tap(v8::Local<v8::Value> t) : t_() {
+    HandleScope scope;
+
+    t_.Reset(To<v8::Object>(t).ToLocalChecked());
+  }
+
+  ~Tap() { t_.Reset(); }  // not sure if necessary
+
+  inline void plan(int i) {
+    HandleScope scope;
+    v8::Local<v8::Value> arg = New(i);
+    Call("plan", New(t_), 1, &arg);
+  }
+
+  inline void ok(bool isOk, const char *msg = NULL) {
+    HandleScope scope;
+    v8::Local<v8::Value> args[2];
+    args[0] = New(isOk);
+    if (msg) args[1] = New(msg).ToLocalChecked();
+    Call("ok", New(t_), msg ? 2 : 1, args);
+  }
+
+  inline void pass(const char * msg = NULL) {
+    HandleScope scope;
+    v8::Local<v8::Value> hmsg;
+    if (msg) hmsg = New(msg).ToLocalChecked();
+    Call("pass", New(t_), msg ? 1 : 0, &hmsg);
+  }
+
+  inline void end() {
+    HandleScope scope;
+    Call("end", New(t_), 0, NULL);
+  }
+
+ private:
+  Persistent<v8::Object> t_;
+};
+
+#define NAN_STRINGIZE2(x) #x
+#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x)
+#define NAN_TEST_EXPRESSION(expression) \
+  ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression
+
+#define NAN_EXPORT(target, function) Export(target, #function, function)
+
+#undef TYPE_CHECK
+
+//=== Generic Maybefication ===================================================
+
+namespace imp {
+
+template <typename T> struct Maybefier;
+
+template <typename T> struct Maybefier<v8::Local<T> > {
+  inline static MaybeLocal<T> convert(v8::Local<T> v) {
+    return v;
+  }
+};
+
+template <typename T> struct Maybefier<MaybeLocal<T> > {
+  inline static MaybeLocal<T> convert(MaybeLocal<T> v) {
+    return v;
+  }
+};
+
+}  // end of namespace imp
+
+template <typename T, template <typename> class MaybeMaybe>
+inline MaybeLocal<T>
+MakeMaybe(MaybeMaybe<T> v) {
+  return imp::Maybefier<MaybeMaybe<T> >::convert(v);
+}
+
+//=== TypedArrayContents =======================================================
+
+#include "nan_typedarray_contents.h"  // NOLINT(build/include)
+
+//=== JSON =====================================================================
+
+#include "nan_json.h"  // NOLINT(build/include)
+
+}  // end of namespace Nan
+
+#endif  // NAN_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_callbacks.h b/legacy-libs/grpc/node_modules/nan/nan_callbacks.h
new file mode 100644 (file)
index 0000000..53ede84
--- /dev/null
@@ -0,0 +1,88 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_CALLBACKS_H_
+#define NAN_CALLBACKS_H_
+
+template<typename T> class FunctionCallbackInfo;
+template<typename T> class PropertyCallbackInfo;
+template<typename T> class Global;
+
+typedef void(*FunctionCallback)(const FunctionCallbackInfo<v8::Value>&);
+typedef void(*GetterCallback)
+    (v8::Local<v8::String>, const PropertyCallbackInfo<v8::Value>&);
+typedef void(*SetterCallback)(
+    v8::Local<v8::String>,
+    v8::Local<v8::Value>,
+    const PropertyCallbackInfo<void>&);
+typedef void(*PropertyGetterCallback)(
+    v8::Local<v8::String>,
+    const PropertyCallbackInfo<v8::Value>&);
+typedef void(*PropertySetterCallback)(
+    v8::Local<v8::String>,
+    v8::Local<v8::Value>,
+    const PropertyCallbackInfo<v8::Value>&);
+typedef void(*PropertyEnumeratorCallback)
+    (const PropertyCallbackInfo<v8::Array>&);
+typedef void(*PropertyDeleterCallback)(
+    v8::Local<v8::String>,
+    const PropertyCallbackInfo<v8::Boolean>&);
+typedef void(*PropertyQueryCallback)(
+    v8::Local<v8::String>,
+    const PropertyCallbackInfo<v8::Integer>&);
+typedef void(*IndexGetterCallback)(
+    uint32_t,
+    const PropertyCallbackInfo<v8::Value>&);
+typedef void(*IndexSetterCallback)(
+    uint32_t,
+    v8::Local<v8::Value>,
+    const PropertyCallbackInfo<v8::Value>&);
+typedef void(*IndexEnumeratorCallback)
+    (const PropertyCallbackInfo<v8::Array>&);
+typedef void(*IndexDeleterCallback)(
+    uint32_t,
+    const PropertyCallbackInfo<v8::Boolean>&);
+typedef void(*IndexQueryCallback)(
+    uint32_t,
+    const PropertyCallbackInfo<v8::Integer>&);
+
+namespace imp {
+typedef v8::Local<v8::AccessorSignature> Sig;
+
+static const int kDataIndex =                    0;
+
+static const int kFunctionIndex =                1;
+static const int kFunctionFieldCount =           2;
+
+static const int kGetterIndex =                  1;
+static const int kSetterIndex =                  2;
+static const int kAccessorFieldCount =           3;
+
+static const int kPropertyGetterIndex =          1;
+static const int kPropertySetterIndex =          2;
+static const int kPropertyEnumeratorIndex =      3;
+static const int kPropertyDeleterIndex =         4;
+static const int kPropertyQueryIndex =           5;
+static const int kPropertyFieldCount =           6;
+
+static const int kIndexPropertyGetterIndex =     1;
+static const int kIndexPropertySetterIndex =     2;
+static const int kIndexPropertyEnumeratorIndex = 3;
+static const int kIndexPropertyDeleterIndex =    4;
+static const int kIndexPropertyQueryIndex =      5;
+static const int kIndexPropertyFieldCount =      6;
+
+}  // end of namespace imp
+
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+# include "nan_callbacks_12_inl.h"  // NOLINT(build/include)
+#else
+# include "nan_callbacks_pre_12_inl.h"  // NOLINT(build/include)
+#endif
+
+#endif  // NAN_CALLBACKS_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_callbacks_12_inl.h b/legacy-libs/grpc/node_modules/nan/nan_callbacks_12_inl.h
new file mode 100644 (file)
index 0000000..c27b18d
--- /dev/null
@@ -0,0 +1,514 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_CALLBACKS_12_INL_H_
+#define NAN_CALLBACKS_12_INL_H_
+
+template<typename T>
+class ReturnValue {
+  v8::ReturnValue<T> value_;
+
+ public:
+  template <class S>
+  explicit inline ReturnValue(const v8::ReturnValue<S> &value) :
+      value_(value) {}
+  template <class S>
+  explicit inline ReturnValue(const ReturnValue<S>& that)
+      : value_(that.value_) {
+    TYPE_CHECK(T, S);
+  }
+
+  // Handle setters
+  template <typename S> inline void Set(const v8::Local<S> &handle) {
+    TYPE_CHECK(T, S);
+    value_.Set(handle);
+  }
+
+  template <typename S> inline void Set(const Global<S> &handle) {
+    TYPE_CHECK(T, S);
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) &&                       \
+  (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 &&                           \
+  defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8))))
+    value_.Set(handle);
+#else
+    value_.Set(*reinterpret_cast<const v8::Persistent<S>*>(&handle));
+    const_cast<Global<S> &>(handle).Reset();
+#endif
+  }
+
+  // Fast primitive setters
+  inline void Set(bool value) {
+    TYPE_CHECK(T, v8::Boolean);
+    value_.Set(value);
+  }
+
+  inline void Set(double i) {
+    TYPE_CHECK(T, v8::Number);
+    value_.Set(i);
+  }
+
+  inline void Set(int32_t i) {
+    TYPE_CHECK(T, v8::Integer);
+    value_.Set(i);
+  }
+
+  inline void Set(uint32_t i) {
+    TYPE_CHECK(T, v8::Integer);
+    value_.Set(i);
+  }
+
+  // Fast JS primitive setters
+  inline void SetNull() {
+    TYPE_CHECK(T, v8::Primitive);
+    value_.SetNull();
+  }
+
+  inline void SetUndefined() {
+    TYPE_CHECK(T, v8::Primitive);
+    value_.SetUndefined();
+  }
+
+  inline void SetEmptyString() {
+    TYPE_CHECK(T, v8::String);
+    value_.SetEmptyString();
+  }
+
+  // Convenience getter for isolate
+  inline v8::Isolate *GetIsolate() const {
+    return value_.GetIsolate();
+  }
+
+  // Pointer setter: Uncompilable to prevent inadvertent misuse.
+  template<typename S>
+  inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
+};
+
+template<typename T>
+class FunctionCallbackInfo {
+  const v8::FunctionCallbackInfo<T> &info_;
+  const v8::Local<v8::Value> data_;
+
+ public:
+  explicit inline FunctionCallbackInfo(
+      const v8::FunctionCallbackInfo<T> &info
+    , v8::Local<v8::Value> data) :
+          info_(info)
+        , data_(data) {}
+
+  inline ReturnValue<T> GetReturnValue() const {
+    return ReturnValue<T>(info_.GetReturnValue());
+  }
+
+#if NODE_MAJOR_VERSION < 10
+  inline v8::Local<v8::Function> Callee() const { return info_.Callee(); }
+#endif
+  inline v8::Local<v8::Value> Data() const { return data_; }
+  inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
+  inline bool IsConstructCall() const { return info_.IsConstructCall(); }
+  inline int Length() const { return info_.Length(); }
+  inline v8::Local<v8::Value> operator[](int i) const { return info_[i]; }
+  inline v8::Local<v8::Object> This() const { return info_.This(); }
+  inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); }
+
+
+ protected:
+  static const int kHolderIndex = 0;
+  static const int kIsolateIndex = 1;
+  static const int kReturnValueDefaultValueIndex = 2;
+  static const int kReturnValueIndex = 3;
+  static const int kDataIndex = 4;
+  static const int kCalleeIndex = 5;
+  static const int kContextSaveIndex = 6;
+  static const int kArgsLength = 7;
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
+};
+
+template<typename T>
+class PropertyCallbackInfo {
+  const v8::PropertyCallbackInfo<T> &info_;
+  const v8::Local<v8::Value> data_;
+
+ public:
+  explicit inline PropertyCallbackInfo(
+      const v8::PropertyCallbackInfo<T> &info
+    , const v8::Local<v8::Value> data) :
+          info_(info)
+        , data_(data) {}
+
+  inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
+  inline v8::Local<v8::Value> Data() const { return data_; }
+  inline v8::Local<v8::Object> This() const { return info_.This(); }
+  inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
+  inline ReturnValue<T> GetReturnValue() const {
+    return ReturnValue<T>(info_.GetReturnValue());
+  }
+
+ protected:
+  static const int kHolderIndex = 0;
+  static const int kIsolateIndex = 1;
+  static const int kReturnValueDefaultValueIndex = 2;
+  static const int kReturnValueIndex = 3;
+  static const int kDataIndex = 4;
+  static const int kThisIndex = 5;
+  static const int kArgsLength = 6;
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo)
+};
+
+namespace imp {
+static
+void FunctionCallbackWrapper(const v8::FunctionCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  FunctionCallback callback = reinterpret_cast<FunctionCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kFunctionIndex).As<v8::External>()->Value()));
+  FunctionCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  callback(cbinfo);
+}
+
+typedef void (*NativeFunction)(const v8::FunctionCallbackInfo<v8::Value> &);
+
+#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+static
+void GetterCallbackWrapper(
+    v8::Local<v8::Name> property
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  GetterCallback callback = reinterpret_cast<GetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
+  callback(property.As<v8::String>(), cbinfo);
+}
+
+typedef void (*NativeGetter)
+    (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void SetterCallbackWrapper(
+    v8::Local<v8::Name> property
+  , v8::Local<v8::Value> value
+  , const v8::PropertyCallbackInfo<void> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<void>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  SetterCallback callback = reinterpret_cast<SetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
+  callback(property.As<v8::String>(), value, cbinfo);
+}
+
+typedef void (*NativeSetter)(
+    v8::Local<v8::Name>
+  , v8::Local<v8::Value>
+  , const v8::PropertyCallbackInfo<void> &);
+#else
+static
+void GetterCallbackWrapper(
+    v8::Local<v8::String> property
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  GetterCallback callback = reinterpret_cast<GetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
+  callback(property, cbinfo);
+}
+
+typedef void (*NativeGetter)
+    (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void SetterCallbackWrapper(
+    v8::Local<v8::String> property
+  , v8::Local<v8::Value> value
+  , const v8::PropertyCallbackInfo<void> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<void>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  SetterCallback callback = reinterpret_cast<SetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
+  callback(property, value, cbinfo);
+}
+
+typedef void (*NativeSetter)(
+    v8::Local<v8::String>
+  , v8::Local<v8::Value>
+  , const v8::PropertyCallbackInfo<void> &);
+#endif
+
+#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+static
+void PropertyGetterCallbackWrapper(
+    v8::Local<v8::Name> property
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyGetterIndex)
+              .As<v8::External>()->Value()));
+  callback(property.As<v8::String>(), cbinfo);
+}
+
+typedef void (*NativePropertyGetter)
+    (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void PropertySetterCallbackWrapper(
+    v8::Local<v8::Name> property
+  , v8::Local<v8::Value> value
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertySetterIndex)
+              .As<v8::External>()->Value()));
+  callback(property.As<v8::String>(), value, cbinfo);
+}
+
+typedef void (*NativePropertySetter)(
+    v8::Local<v8::Name>
+  , v8::Local<v8::Value>
+  , const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void PropertyEnumeratorCallbackWrapper(
+    const v8::PropertyCallbackInfo<v8::Array> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Array>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyEnumeratorCallback callback =
+      reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyEnumeratorIndex)
+              .As<v8::External>()->Value()));
+  callback(cbinfo);
+}
+
+typedef void (*NativePropertyEnumerator)
+    (const v8::PropertyCallbackInfo<v8::Array> &);
+
+static
+void PropertyDeleterCallbackWrapper(
+    v8::Local<v8::Name> property
+  , const v8::PropertyCallbackInfo<v8::Boolean> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Boolean>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyDeleterIndex)
+              .As<v8::External>()->Value()));
+  callback(property.As<v8::String>(), cbinfo);
+}
+
+typedef void (NativePropertyDeleter)
+    (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean> &);
+
+static
+void PropertyQueryCallbackWrapper(
+    v8::Local<v8::Name> property
+  , const v8::PropertyCallbackInfo<v8::Integer> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Integer>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyQueryIndex)
+              .As<v8::External>()->Value()));
+  callback(property.As<v8::String>(), cbinfo);
+}
+
+typedef void (*NativePropertyQuery)
+    (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
+#else
+static
+void PropertyGetterCallbackWrapper(
+    v8::Local<v8::String> property
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyGetterIndex)
+              .As<v8::External>()->Value()));
+  callback(property, cbinfo);
+}
+
+typedef void (*NativePropertyGetter)
+    (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void PropertySetterCallbackWrapper(
+    v8::Local<v8::String> property
+  , v8::Local<v8::Value> value
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertySetterIndex)
+              .As<v8::External>()->Value()));
+  callback(property, value, cbinfo);
+}
+
+typedef void (*NativePropertySetter)(
+    v8::Local<v8::String>
+  , v8::Local<v8::Value>
+  , const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void PropertyEnumeratorCallbackWrapper(
+    const v8::PropertyCallbackInfo<v8::Array> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Array>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyEnumeratorCallback callback =
+      reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyEnumeratorIndex)
+              .As<v8::External>()->Value()));
+  callback(cbinfo);
+}
+
+typedef void (*NativePropertyEnumerator)
+    (const v8::PropertyCallbackInfo<v8::Array> &);
+
+static
+void PropertyDeleterCallbackWrapper(
+    v8::Local<v8::String> property
+  , const v8::PropertyCallbackInfo<v8::Boolean> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Boolean>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyDeleterIndex)
+              .As<v8::External>()->Value()));
+  callback(property, cbinfo);
+}
+
+typedef void (NativePropertyDeleter)
+    (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean> &);
+
+static
+void PropertyQueryCallbackWrapper(
+    v8::Local<v8::String> property
+  , const v8::PropertyCallbackInfo<v8::Integer> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Integer>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyQueryIndex)
+              .As<v8::External>()->Value()));
+  callback(property, cbinfo);
+}
+
+typedef void (*NativePropertyQuery)
+    (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &);
+#endif
+
+static
+void IndexGetterCallbackWrapper(
+    uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyGetterIndex)
+              .As<v8::External>()->Value()));
+  callback(index, cbinfo);
+}
+
+typedef void (*NativeIndexGetter)
+    (uint32_t, const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void IndexSetterCallbackWrapper(
+    uint32_t index
+  , v8::Local<v8::Value> value
+  , const v8::PropertyCallbackInfo<v8::Value> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertySetterIndex)
+              .As<v8::External>()->Value()));
+  callback(index, value, cbinfo);
+}
+
+typedef void (*NativeIndexSetter)(
+    uint32_t
+  , v8::Local<v8::Value>
+  , const v8::PropertyCallbackInfo<v8::Value> &);
+
+static
+void IndexEnumeratorCallbackWrapper(
+    const v8::PropertyCallbackInfo<v8::Array> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Array>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(
+              kIndexPropertyEnumeratorIndex).As<v8::External>()->Value()));
+  callback(cbinfo);
+}
+
+typedef void (*NativeIndexEnumerator)
+    (const v8::PropertyCallbackInfo<v8::Array> &);
+
+static
+void IndexDeleterCallbackWrapper(
+    uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Boolean>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyDeleterIndex)
+              .As<v8::External>()->Value()));
+  callback(index, cbinfo);
+}
+
+typedef void (*NativeIndexDeleter)
+    (uint32_t, const v8::PropertyCallbackInfo<v8::Boolean> &);
+
+static
+void IndexQueryCallbackWrapper(
+    uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Integer>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyQueryIndex)
+              .As<v8::External>()->Value()));
+  callback(index, cbinfo);
+}
+
+typedef void (*NativeIndexQuery)
+    (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
+}  // end of namespace imp
+
+#endif  // NAN_CALLBACKS_12_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_callbacks_pre_12_inl.h b/legacy-libs/grpc/node_modules/nan/nan_callbacks_pre_12_inl.h
new file mode 100644 (file)
index 0000000..c9ba499
--- /dev/null
@@ -0,0 +1,520 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_CALLBACKS_PRE_12_INL_H_
+#define NAN_CALLBACKS_PRE_12_INL_H_
+
+namespace imp {
+template<typename T> class ReturnValueImp;
+}  // end of namespace imp
+
+template<typename T>
+class ReturnValue {
+  v8::Isolate *isolate_;
+  v8::Persistent<T> *value_;
+  friend class imp::ReturnValueImp<T>;
+
+ public:
+  template <class S>
+  explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent<S> *p) :
+      isolate_(isolate), value_(p) {}
+  template <class S>
+  explicit inline ReturnValue(const ReturnValue<S>& that)
+      : isolate_(that.isolate_), value_(that.value_) {
+    TYPE_CHECK(T, S);
+  }
+
+  // Handle setters
+  template <typename S> inline void Set(const v8::Local<S> &handle) {
+    TYPE_CHECK(T, S);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(handle);
+  }
+
+  template <typename S> inline void Set(const Global<S> &handle) {
+    TYPE_CHECK(T, S);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(handle.persistent);
+    const_cast<Global<S> &>(handle).Reset();
+  }
+
+  // Fast primitive setters
+  inline void Set(bool value) {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::Boolean);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::Boolean::New(value));
+  }
+
+  inline void Set(double i) {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::Number);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::Number::New(i));
+  }
+
+  inline void Set(int32_t i) {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::Integer);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::Int32::New(i));
+  }
+
+  inline void Set(uint32_t i) {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::Integer);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::Uint32::NewFromUnsigned(i));
+  }
+
+  // Fast JS primitive setters
+  inline void SetNull() {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::Primitive);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::Null());
+  }
+
+  inline void SetUndefined() {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::Primitive);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::Undefined());
+  }
+
+  inline void SetEmptyString() {
+    v8::HandleScope scope;
+
+    TYPE_CHECK(T, v8::String);
+    value_->Dispose();
+    *value_ = v8::Persistent<T>::New(v8::String::Empty());
+  }
+
+  // Convenience getter for isolate
+  inline v8::Isolate *GetIsolate() const {
+    return isolate_;
+  }
+
+  // Pointer setter: Uncompilable to prevent inadvertent misuse.
+  template<typename S>
+  inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
+};
+
+template<typename T>
+class FunctionCallbackInfo {
+  const v8::Arguments &args_;
+  v8::Local<v8::Value> data_;
+  ReturnValue<T> return_value_;
+  v8::Persistent<T> retval_;
+
+ public:
+  explicit inline FunctionCallbackInfo(
+      const v8::Arguments &args
+    , v8::Local<v8::Value> data) :
+          args_(args)
+        , data_(data)
+        , return_value_(args.GetIsolate(), &retval_)
+        , retval_(v8::Persistent<T>::New(v8::Undefined())) {}
+
+  inline ~FunctionCallbackInfo() {
+    retval_.Dispose();
+    retval_.Clear();
+  }
+
+  inline ReturnValue<T> GetReturnValue() const {
+    return ReturnValue<T>(return_value_);
+  }
+
+  inline v8::Local<v8::Function> Callee() const { return args_.Callee(); }
+  inline v8::Local<v8::Value> Data() const { return data_; }
+  inline v8::Local<v8::Object> Holder() const { return args_.Holder(); }
+  inline bool IsConstructCall() const { return args_.IsConstructCall(); }
+  inline int Length() const { return args_.Length(); }
+  inline v8::Local<v8::Value> operator[](int i) const { return args_[i]; }
+  inline v8::Local<v8::Object> This() const { return args_.This(); }
+  inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); }
+
+
+ protected:
+  static const int kHolderIndex = 0;
+  static const int kIsolateIndex = 1;
+  static const int kReturnValueDefaultValueIndex = 2;
+  static const int kReturnValueIndex = 3;
+  static const int kDataIndex = 4;
+  static const int kCalleeIndex = 5;
+  static const int kContextSaveIndex = 6;
+  static const int kArgsLength = 7;
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
+};
+
+template<typename T>
+class PropertyCallbackInfoBase {
+  const v8::AccessorInfo &info_;
+  const v8::Local<v8::Value> data_;
+
+ public:
+  explicit inline PropertyCallbackInfoBase(
+      const v8::AccessorInfo &info
+    , const v8::Local<v8::Value> data) :
+          info_(info)
+        , data_(data) {}
+
+  inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
+  inline v8::Local<v8::Value> Data() const { return data_; }
+  inline v8::Local<v8::Object> This() const { return info_.This(); }
+  inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
+
+ protected:
+  static const int kHolderIndex = 0;
+  static const int kIsolateIndex = 1;
+  static const int kReturnValueDefaultValueIndex = 2;
+  static const int kReturnValueIndex = 3;
+  static const int kDataIndex = 4;
+  static const int kThisIndex = 5;
+  static const int kArgsLength = 6;
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase)
+};
+
+template<typename T>
+class PropertyCallbackInfo : public PropertyCallbackInfoBase<T> {
+  ReturnValue<T> return_value_;
+  v8::Persistent<T> retval_;
+
+ public:
+  explicit inline PropertyCallbackInfo(
+      const v8::AccessorInfo &info
+    , const v8::Local<v8::Value> data) :
+          PropertyCallbackInfoBase<T>(info, data)
+        , return_value_(info.GetIsolate(), &retval_)
+        , retval_(v8::Persistent<T>::New(v8::Undefined())) {}
+
+  inline ~PropertyCallbackInfo() {
+    retval_.Dispose();
+    retval_.Clear();
+  }
+
+  inline ReturnValue<T> GetReturnValue() const { return return_value_; }
+};
+
+template<>
+class PropertyCallbackInfo<v8::Array> :
+    public PropertyCallbackInfoBase<v8::Array> {
+  ReturnValue<v8::Array> return_value_;
+  v8::Persistent<v8::Array> retval_;
+
+ public:
+  explicit inline PropertyCallbackInfo(
+      const v8::AccessorInfo &info
+    , const v8::Local<v8::Value> data) :
+          PropertyCallbackInfoBase<v8::Array>(info, data)
+        , return_value_(info.GetIsolate(), &retval_)
+        , retval_(v8::Persistent<v8::Array>::New(v8::Local<v8::Array>())) {}
+
+  inline ~PropertyCallbackInfo() {
+    retval_.Dispose();
+    retval_.Clear();
+  }
+
+  inline ReturnValue<v8::Array> GetReturnValue() const {
+    return return_value_;
+  }
+};
+
+template<>
+class PropertyCallbackInfo<v8::Boolean> :
+    public PropertyCallbackInfoBase<v8::Boolean> {
+  ReturnValue<v8::Boolean> return_value_;
+  v8::Persistent<v8::Boolean> retval_;
+
+ public:
+  explicit inline PropertyCallbackInfo(
+      const v8::AccessorInfo &info
+    , const v8::Local<v8::Value> data) :
+          PropertyCallbackInfoBase<v8::Boolean>(info, data)
+        , return_value_(info.GetIsolate(), &retval_)
+        , retval_(v8::Persistent<v8::Boolean>::New(v8::Local<v8::Boolean>())) {}
+
+  inline ~PropertyCallbackInfo() {
+    retval_.Dispose();
+    retval_.Clear();
+  }
+
+  inline ReturnValue<v8::Boolean> GetReturnValue() const {
+    return return_value_;
+  }
+};
+
+template<>
+class PropertyCallbackInfo<v8::Integer> :
+    public PropertyCallbackInfoBase<v8::Integer> {
+  ReturnValue<v8::Integer> return_value_;
+  v8::Persistent<v8::Integer> retval_;
+
+ public:
+  explicit inline PropertyCallbackInfo(
+      const v8::AccessorInfo &info
+    , const v8::Local<v8::Value> data) :
+          PropertyCallbackInfoBase<v8::Integer>(info, data)
+        , return_value_(info.GetIsolate(), &retval_)
+        , retval_(v8::Persistent<v8::Integer>::New(v8::Local<v8::Integer>())) {}
+
+  inline ~PropertyCallbackInfo() {
+    retval_.Dispose();
+    retval_.Clear();
+  }
+
+  inline ReturnValue<v8::Integer> GetReturnValue() const {
+    return return_value_;
+  }
+};
+
+namespace imp {
+template<typename T>
+class ReturnValueImp : public ReturnValue<T> {
+ public:
+  explicit ReturnValueImp(ReturnValue<T> that) :
+      ReturnValue<T>(that) {}
+  inline v8::Handle<T> Value() {
+      return *ReturnValue<T>::value_;
+  }
+};
+
+static
+v8::Handle<v8::Value> FunctionCallbackWrapper(const v8::Arguments &args) {
+  v8::Local<v8::Object> obj = args.Data().As<v8::Object>();
+  FunctionCallback callback = reinterpret_cast<FunctionCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kFunctionIndex).As<v8::External>()->Value()));
+  FunctionCallbackInfo<v8::Value>
+      cbinfo(args, obj->GetInternalField(kDataIndex));
+  callback(cbinfo);
+  return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Value> (*NativeFunction)(const v8::Arguments &);
+
+static
+v8::Handle<v8::Value> GetterCallbackWrapper(
+    v8::Local<v8::String> property, const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  GetterCallback callback = reinterpret_cast<GetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
+  callback(property, cbinfo);
+  return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Value> (*NativeGetter)
+    (v8::Local<v8::String>, const v8::AccessorInfo &);
+
+static
+void SetterCallbackWrapper(
+    v8::Local<v8::String> property
+  , v8::Local<v8::Value> value
+  , const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<void>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  SetterCallback callback = reinterpret_cast<SetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
+  callback(property, value, cbinfo);
+}
+
+typedef void (*NativeSetter)
+    (v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Value> PropertyGetterCallbackWrapper(
+    v8::Local<v8::String> property, const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyGetterIndex)
+              .As<v8::External>()->Value()));
+  callback(property, cbinfo);
+  return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Value> (*NativePropertyGetter)
+    (v8::Local<v8::String>, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Value> PropertySetterCallbackWrapper(
+    v8::Local<v8::String> property
+  , v8::Local<v8::Value> value
+  , const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertySetterIndex)
+              .As<v8::External>()->Value()));
+  callback(property, value, cbinfo);
+  return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Value> (*NativePropertySetter)
+    (v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Array> PropertyEnumeratorCallbackWrapper(
+    const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Array>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyEnumeratorCallback callback =
+      reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyEnumeratorIndex)
+              .As<v8::External>()->Value()));
+  callback(cbinfo);
+  return ReturnValueImp<v8::Array>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Array> (*NativePropertyEnumerator)
+    (const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Boolean> PropertyDeleterCallbackWrapper(
+    v8::Local<v8::String> property
+  , const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Boolean>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyDeleterIndex)
+              .As<v8::External>()->Value()));
+  callback(property, cbinfo);
+  return ReturnValueImp<v8::Boolean>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Boolean> (NativePropertyDeleter)
+    (v8::Local<v8::String>, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Integer> PropertyQueryCallbackWrapper(
+    v8::Local<v8::String> property, const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Integer>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kPropertyQueryIndex)
+              .As<v8::External>()->Value()));
+  callback(property, cbinfo);
+  return ReturnValueImp<v8::Integer>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Integer> (*NativePropertyQuery)
+    (v8::Local<v8::String>, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Value> IndexGetterCallbackWrapper(
+    uint32_t index, const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyGetterIndex)
+              .As<v8::External>()->Value()));
+  callback(index, cbinfo);
+  return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Value> (*NativeIndexGetter)
+    (uint32_t, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Value> IndexSetterCallbackWrapper(
+    uint32_t index
+  , v8::Local<v8::Value> value
+  , const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Value>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertySetterIndex)
+              .As<v8::External>()->Value()));
+  callback(index, value, cbinfo);
+  return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Value> (*NativeIndexSetter)
+    (uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Array> IndexEnumeratorCallbackWrapper(
+    const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Array>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyEnumeratorIndex)
+              .As<v8::External>()->Value()));
+  callback(cbinfo);
+  return ReturnValueImp<v8::Array>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Array> (*NativeIndexEnumerator)
+    (const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Boolean> IndexDeleterCallbackWrapper(
+    uint32_t index, const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Boolean>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyDeleterIndex)
+              .As<v8::External>()->Value()));
+  callback(index, cbinfo);
+  return ReturnValueImp<v8::Boolean>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Boolean> (*NativeIndexDeleter)
+    (uint32_t, const v8::AccessorInfo &);
+
+static
+v8::Handle<v8::Integer> IndexQueryCallbackWrapper(
+    uint32_t index, const v8::AccessorInfo &info) {
+  v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
+  PropertyCallbackInfo<v8::Integer>
+      cbinfo(info, obj->GetInternalField(kDataIndex));
+  IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
+      reinterpret_cast<intptr_t>(
+          obj->GetInternalField(kIndexPropertyQueryIndex)
+              .As<v8::External>()->Value()));
+  callback(index, cbinfo);
+  return ReturnValueImp<v8::Integer>(cbinfo.GetReturnValue()).Value();
+}
+
+typedef v8::Handle<v8::Integer> (*NativeIndexQuery)
+    (uint32_t, const v8::AccessorInfo &);
+}  // end of namespace imp
+
+#endif  // NAN_CALLBACKS_PRE_12_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_converters.h b/legacy-libs/grpc/node_modules/nan/nan_converters.h
new file mode 100644 (file)
index 0000000..c0b3272
--- /dev/null
@@ -0,0 +1,72 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_CONVERTERS_H_
+#define NAN_CONVERTERS_H_
+
+namespace imp {
+template<typename T> struct ToFactoryBase {
+  typedef MaybeLocal<T> return_t;
+};
+template<typename T> struct ValueFactoryBase { typedef Maybe<T> return_t; };
+
+template<typename T> struct ToFactory;
+
+template<>
+struct ToFactory<v8::Function> : ToFactoryBase<v8::Function> {
+  static inline return_t convert(v8::Local<v8::Value> val) {
+    if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal<v8::Function>();
+    return MaybeLocal<v8::Function>(val.As<v8::Function>());
+  }
+};
+
+#define X(TYPE)                                                                \
+    template<>                                                                 \
+    struct ToFactory<v8::TYPE> : ToFactoryBase<v8::TYPE> {                     \
+      static inline return_t convert(v8::Local<v8::Value> val);                \
+    };
+
+X(Boolean)
+X(Number)
+X(String)
+X(Object)
+X(Integer)
+X(Uint32)
+X(Int32)
+
+#undef X
+
+#define X(TYPE)                                                                \
+    template<>                                                                 \
+    struct ToFactory<TYPE> : ValueFactoryBase<TYPE> {                          \
+      static inline return_t convert(v8::Local<v8::Value> val);                \
+    };
+
+X(bool)
+X(double)
+X(int64_t)
+X(uint32_t)
+X(int32_t)
+
+#undef X
+}  // end of namespace imp
+
+template<typename T>
+inline
+typename imp::ToFactory<T>::return_t To(v8::Local<v8::Value> val) {
+  return imp::ToFactory<T>::convert(val);
+}
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+# include "nan_converters_43_inl.h"
+#else
+# include "nan_converters_pre_43_inl.h"
+#endif
+
+#endif  // NAN_CONVERTERS_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_converters_43_inl.h b/legacy-libs/grpc/node_modules/nan/nan_converters_43_inl.h
new file mode 100644 (file)
index 0000000..41b72de
--- /dev/null
@@ -0,0 +1,68 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_CONVERTERS_43_INL_H_
+#define NAN_CONVERTERS_43_INL_H_
+
+#define X(TYPE)                                                                \
+imp::ToFactory<v8::TYPE>::return_t                                             \
+imp::ToFactory<v8::TYPE>::convert(v8::Local<v8::Value> val) {                  \
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();                            \
+  v8::EscapableHandleScope scope(isolate);                                     \
+  return scope.Escape(                                                         \
+      val->To ## TYPE(isolate->GetCurrentContext())                            \
+          .FromMaybe(v8::Local<v8::TYPE>()));                                  \
+}
+
+X(Number)
+X(String)
+X(Object)
+X(Integer)
+X(Uint32)
+X(Int32)
+// V8 <= 7.0
+#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0)
+X(Boolean)
+#else
+imp::ToFactory<v8::Boolean>::return_t                                          \
+imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value> val) {               \
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();                            \
+  v8::EscapableHandleScope scope(isolate);                                     \
+  return scope.Escape(val->ToBoolean(isolate));                                \
+}
+#endif
+
+#undef X
+
+#define X(TYPE, NAME)                                                          \
+imp::ToFactory<TYPE>::return_t                                                 \
+imp::ToFactory<TYPE>::convert(v8::Local<v8::Value> val) {                      \
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();                            \
+  v8::HandleScope scope(isolate);                                              \
+  return val->NAME ## Value(isolate->GetCurrentContext());                     \
+}
+
+X(double, Number)
+X(int64_t, Integer)
+X(uint32_t, Uint32)
+X(int32_t, Int32)
+// V8 <= 7.0
+#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0)
+X(bool, Boolean)
+#else
+imp::ToFactory<bool>::return_t                                                 \
+imp::ToFactory<bool>::convert(v8::Local<v8::Value> val) {                      \
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();                            \
+  v8::HandleScope scope(isolate);                                              \
+  return Just<bool>(val->BooleanValue(isolate));                               \
+}
+#endif
+
+#undef X
+
+#endif  // NAN_CONVERTERS_43_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_converters_pre_43_inl.h b/legacy-libs/grpc/node_modules/nan/nan_converters_pre_43_inl.h
new file mode 100644 (file)
index 0000000..ae0518a
--- /dev/null
@@ -0,0 +1,42 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_CONVERTERS_PRE_43_INL_H_
+#define NAN_CONVERTERS_PRE_43_INL_H_
+
+#define X(TYPE)                                                                \
+imp::ToFactory<v8::TYPE>::return_t                                             \
+imp::ToFactory<v8::TYPE>::convert(v8::Local<v8::Value> val) {                  \
+  return val->To ## TYPE();                                                    \
+}
+
+X(Boolean)
+X(Number)
+X(String)
+X(Object)
+X(Integer)
+X(Uint32)
+X(Int32)
+
+#undef X
+
+#define X(TYPE, NAME)                                                          \
+imp::ToFactory<TYPE>::return_t                                                 \
+imp::ToFactory<TYPE>::convert(v8::Local<v8::Value> val) {                      \
+  return Just(val->NAME ## Value());                                           \
+}
+
+X(bool, Boolean)
+X(double, Number)
+X(int64_t, Integer)
+X(uint32_t, Uint32)
+X(int32_t, Int32)
+
+#undef X
+
+#endif  // NAN_CONVERTERS_PRE_43_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_define_own_property_helper.h b/legacy-libs/grpc/node_modules/nan/nan_define_own_property_helper.h
new file mode 100644 (file)
index 0000000..d710ef2
--- /dev/null
@@ -0,0 +1,29 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_
+#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_
+
+namespace imp {
+
+inline Maybe<bool> DefineOwnPropertyHelper(
+    v8::PropertyAttribute current
+  , v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key
+  , v8::Handle<v8::Value> value
+  , v8::PropertyAttribute attribs = v8::None) {
+  return !(current & v8::DontDelete) ||                     // configurable OR
+                  (!(current & v8::ReadOnly) &&             // writable AND
+                   !((attribs ^ current) & ~v8::ReadOnly))  // same excluding RO
+             ? Just<bool>(obj->ForceSet(key, value, attribs))
+             : Nothing<bool>();
+}
+
+}  // end of namespace imp
+
+#endif  // NAN_DEFINE_OWN_PROPERTY_HELPER_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_implementation_12_inl.h b/legacy-libs/grpc/node_modules/nan/nan_implementation_12_inl.h
new file mode 100644 (file)
index 0000000..255293a
--- /dev/null
@@ -0,0 +1,430 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_IMPLEMENTATION_12_INL_H_
+#define NAN_IMPLEMENTATION_12_INL_H_
+//==============================================================================
+// node v0.11 implementation
+//==============================================================================
+
+namespace imp {
+
+//=== Array ====================================================================
+
+Factory<v8::Array>::return_t
+Factory<v8::Array>::New() {
+  return v8::Array::New(v8::Isolate::GetCurrent());
+}
+
+Factory<v8::Array>::return_t
+Factory<v8::Array>::New(int length) {
+  return v8::Array::New(v8::Isolate::GetCurrent(), length);
+}
+
+//=== Boolean ==================================================================
+
+Factory<v8::Boolean>::return_t
+Factory<v8::Boolean>::New(bool value) {
+  return v8::Boolean::New(v8::Isolate::GetCurrent(), value);
+}
+
+//=== Boolean Object ===========================================================
+
+Factory<v8::BooleanObject>::return_t
+Factory<v8::BooleanObject>::New(bool value) {
+#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
+  return v8::BooleanObject::New(
+    v8::Isolate::GetCurrent(), value).As<v8::BooleanObject>();
+#else
+  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
+#endif
+}
+
+//=== Context ==================================================================
+
+Factory<v8::Context>::return_t
+Factory<v8::Context>::New( v8::ExtensionConfiguration* extensions
+                         , v8::Local<v8::ObjectTemplate> tmpl
+                         , v8::Local<v8::Value> obj) {
+  return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj);
+}
+
+//=== Date =====================================================================
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+Factory<v8::Date>::return_t
+Factory<v8::Date>::New(double value) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value)
+      .FromMaybe(v8::Local<v8::Value>()).As<v8::Date>());
+}
+#else
+Factory<v8::Date>::return_t
+Factory<v8::Date>::New(double value) {
+  return v8::Date::New(v8::Isolate::GetCurrent(), value).As<v8::Date>();
+}
+#endif
+
+//=== External =================================================================
+
+Factory<v8::External>::return_t
+Factory<v8::External>::New(void * value) {
+  return v8::External::New(v8::Isolate::GetCurrent(), value);
+}
+
+//=== Function =================================================================
+
+Factory<v8::Function>::return_t
+Factory<v8::Function>::New( FunctionCallback callback
+                          , v8::Local<v8::Value> data) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New(isolate);
+  tpl->SetInternalFieldCount(imp::kFunctionFieldCount);
+  v8::Local<v8::Object> obj = NewInstance(tpl).ToLocalChecked();
+
+  obj->SetInternalField(
+      imp::kFunctionIndex
+    , v8::External::New(isolate, reinterpret_cast<void *>(callback)));
+
+  v8::Local<v8::Value> val = v8::Local<v8::Value>::New(isolate, data);
+
+  if (!val.IsEmpty()) {
+    obj->SetInternalField(imp::kDataIndex, val);
+  }
+
+#if NODE_MAJOR_VERSION >= 10
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Function> function =
+      v8::Function::New(context, imp::FunctionCallbackWrapper, obj)
+      .ToLocalChecked();
+#else
+  v8::Local<v8::Function> function =
+      v8::Function::New(isolate, imp::FunctionCallbackWrapper, obj);
+#endif
+
+  return scope.Escape(function);
+}
+
+//=== Function Template ========================================================
+
+Factory<v8::FunctionTemplate>::return_t
+Factory<v8::FunctionTemplate>::New( FunctionCallback callback
+                                  , v8::Local<v8::Value> data
+                                  , v8::Local<v8::Signature> signature) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  if (callback) {
+    v8::EscapableHandleScope scope(isolate);
+    v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New(isolate);
+    tpl->SetInternalFieldCount(imp::kFunctionFieldCount);
+    v8::Local<v8::Object> obj = NewInstance(tpl).ToLocalChecked();
+
+    obj->SetInternalField(
+        imp::kFunctionIndex
+      , v8::External::New(isolate, reinterpret_cast<void *>(callback)));
+    v8::Local<v8::Value> val = v8::Local<v8::Value>::New(isolate, data);
+
+    if (!val.IsEmpty()) {
+      obj->SetInternalField(imp::kDataIndex, val);
+    }
+
+    return scope.Escape(v8::FunctionTemplate::New( isolate
+                                    , imp::FunctionCallbackWrapper
+                                    , obj
+                                    , signature));
+  } else {
+    return v8::FunctionTemplate::New(isolate, 0, data, signature);
+  }
+}
+
+//=== Number ===================================================================
+
+Factory<v8::Number>::return_t
+Factory<v8::Number>::New(double value) {
+  return v8::Number::New(v8::Isolate::GetCurrent(), value);
+}
+
+//=== Number Object ============================================================
+
+Factory<v8::NumberObject>::return_t
+Factory<v8::NumberObject>::New(double value) {
+  return v8::NumberObject::New( v8::Isolate::GetCurrent()
+                              , value).As<v8::NumberObject>();
+}
+
+//=== Integer, Int32 and Uint32 ================================================
+
+template <typename T>
+typename IntegerFactory<T>::return_t
+IntegerFactory<T>::New(int32_t value) {
+  return To<T>(T::New(v8::Isolate::GetCurrent(), value));
+}
+
+template <typename T>
+typename IntegerFactory<T>::return_t
+IntegerFactory<T>::New(uint32_t value) {
+  return To<T>(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value));
+}
+
+Factory<v8::Uint32>::return_t
+Factory<v8::Uint32>::New(int32_t value) {
+  return To<v8::Uint32>(
+      v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value));
+}
+
+Factory<v8::Uint32>::return_t
+Factory<v8::Uint32>::New(uint32_t value) {
+  return To<v8::Uint32>(
+      v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value));
+}
+
+//=== Object ===================================================================
+
+Factory<v8::Object>::return_t
+Factory<v8::Object>::New() {
+  return v8::Object::New(v8::Isolate::GetCurrent());
+}
+
+//=== Object Template ==========================================================
+
+Factory<v8::ObjectTemplate>::return_t
+Factory<v8::ObjectTemplate>::New() {
+  return v8::ObjectTemplate::New(v8::Isolate::GetCurrent());
+}
+
+//=== RegExp ===================================================================
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+Factory<v8::RegExp>::return_t
+Factory<v8::RegExp>::New(
+    v8::Local<v8::String> pattern
+  , v8::RegExp::Flags flags) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(
+      v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags)
+          .FromMaybe(v8::Local<v8::RegExp>()));
+}
+#else
+Factory<v8::RegExp>::return_t
+Factory<v8::RegExp>::New(
+    v8::Local<v8::String> pattern
+  , v8::RegExp::Flags flags) {
+  return v8::RegExp::New(pattern, flags);
+}
+#endif
+
+//=== Script ===================================================================
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+Factory<v8::Script>::return_t
+Factory<v8::Script>::New( v8::Local<v8::String> source) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  v8::ScriptCompiler::Source src(source);
+  return scope.Escape(
+      v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src)
+          .FromMaybe(v8::Local<v8::Script>()));
+}
+
+Factory<v8::Script>::return_t
+Factory<v8::Script>::New( v8::Local<v8::String> source
+                        , v8::ScriptOrigin const& origin) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  v8::ScriptCompiler::Source src(source, origin);
+  return scope.Escape(
+      v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src)
+          .FromMaybe(v8::Local<v8::Script>()));
+}
+#else
+Factory<v8::Script>::return_t
+Factory<v8::Script>::New( v8::Local<v8::String> source) {
+  v8::ScriptCompiler::Source src(source);
+  return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src);
+}
+
+Factory<v8::Script>::return_t
+Factory<v8::Script>::New( v8::Local<v8::String> source
+                        , v8::ScriptOrigin const& origin) {
+  v8::ScriptCompiler::Source src(source, origin);
+  return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src);
+}
+#endif
+
+//=== Signature ================================================================
+
+Factory<v8::Signature>::return_t
+Factory<v8::Signature>::New(Factory<v8::Signature>::FTH receiver) {
+  return v8::Signature::New(v8::Isolate::GetCurrent(), receiver);
+}
+
+//=== String ===================================================================
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New() {
+  return v8::String::Empty(v8::Isolate::GetCurrent());
+}
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+Factory<v8::String>::return_t
+Factory<v8::String>::New(const char * value, int length) {
+  return v8::String::NewFromUtf8(
+      v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(std::string const& value) {
+  assert(value.size() <= INT_MAX && "string too long");
+  return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),
+      value.data(), v8::NewStringType::kNormal, static_cast<int>(value.size()));
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(const uint16_t * value, int length) {
+  return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value,
+        v8::NewStringType::kNormal, length);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(v8::String::ExternalStringResource * value) {
+  return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(ExternalOneByteStringResource * value) {
+  return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value);
+}
+#else
+Factory<v8::String>::return_t
+Factory<v8::String>::New(const char * value, int length) {
+  return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value,
+                                 v8::String::kNormalString, length);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(
+    std::string const& value) /* NOLINT(build/include_what_you_use) */ {
+  assert(value.size() <= INT_MAX && "string too long");
+  return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(),
+                                 v8::String::kNormalString,
+                                 static_cast<int>(value.size()));
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(const uint16_t * value, int length) {
+  return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value,
+                                    v8::String::kNormalString, length);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(v8::String::ExternalStringResource * value) {
+  return v8::String::NewExternal(v8::Isolate::GetCurrent(), value);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(ExternalOneByteStringResource * value) {
+  return v8::String::NewExternal(v8::Isolate::GetCurrent(), value);
+}
+#endif
+
+//=== String Object ============================================================
+
+// See https://github.com/nodejs/nan/pull/811#discussion_r224594980.
+// Disable the warning as there is no way around it.
+// TODO(bnoordhuis) Use isolate-based version in Node.js v12.
+Factory<v8::StringObject>::return_t
+Factory<v8::StringObject>::New(v8::Local<v8::String> value) {
+// V8 > 7.0
+#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0)
+  return v8::StringObject::New(v8::Isolate::GetCurrent(), value)
+      .As<v8::StringObject>();
+#else
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4996)
+#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+  return v8::StringObject::New(value).As<v8::StringObject>();
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+}
+
+//=== Unbound Script ===========================================================
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+Factory<v8::UnboundScript>::return_t
+Factory<v8::UnboundScript>::New(v8::Local<v8::String> source) {
+  v8::ScriptCompiler::Source src(source);
+  return v8::ScriptCompiler::CompileUnboundScript(
+      v8::Isolate::GetCurrent(), &src);
+}
+
+Factory<v8::UnboundScript>::return_t
+Factory<v8::UnboundScript>::New( v8::Local<v8::String> source
+                               , v8::ScriptOrigin const& origin) {
+  v8::ScriptCompiler::Source src(source, origin);
+  return v8::ScriptCompiler::CompileUnboundScript(
+      v8::Isolate::GetCurrent(), &src);
+}
+#else
+Factory<v8::UnboundScript>::return_t
+Factory<v8::UnboundScript>::New(v8::Local<v8::String> source) {
+  v8::ScriptCompiler::Source src(source);
+  return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src);
+}
+
+Factory<v8::UnboundScript>::return_t
+Factory<v8::UnboundScript>::New( v8::Local<v8::String> source
+                               , v8::ScriptOrigin const& origin) {
+  v8::ScriptCompiler::Source src(source, origin);
+  return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src);
+}
+#endif
+
+}  // end of namespace imp
+
+//=== Presistents and Handles ==================================================
+
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+template <typename T>
+inline v8::Local<T> New(v8::Handle<T> h) {
+  return v8::Local<T>::New(v8::Isolate::GetCurrent(), h);
+}
+#endif
+
+template <typename T, typename M>
+inline v8::Local<T> New(v8::Persistent<T, M> const& p) {
+  return v8::Local<T>::New(v8::Isolate::GetCurrent(), p);
+}
+
+template <typename T, typename M>
+inline v8::Local<T> New(Persistent<T, M> const& p) {
+  return v8::Local<T>::New(v8::Isolate::GetCurrent(), p);
+}
+
+template <typename T>
+inline v8::Local<T> New(Global<T> const& p) {
+  return v8::Local<T>::New(v8::Isolate::GetCurrent(), p);
+}
+
+#endif  // NAN_IMPLEMENTATION_12_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_implementation_pre_12_inl.h b/legacy-libs/grpc/node_modules/nan/nan_implementation_pre_12_inl.h
new file mode 100644 (file)
index 0000000..1472421
--- /dev/null
@@ -0,0 +1,263 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_
+#define NAN_IMPLEMENTATION_PRE_12_INL_H_
+
+//==============================================================================
+// node v0.10 implementation
+//==============================================================================
+
+namespace imp {
+
+//=== Array ====================================================================
+
+Factory<v8::Array>::return_t
+Factory<v8::Array>::New() {
+  return v8::Array::New();
+}
+
+Factory<v8::Array>::return_t
+Factory<v8::Array>::New(int length) {
+  return v8::Array::New(length);
+}
+
+//=== Boolean ==================================================================
+
+Factory<v8::Boolean>::return_t
+Factory<v8::Boolean>::New(bool value) {
+  return v8::Boolean::New(value)->ToBoolean();
+}
+
+//=== Boolean Object ===========================================================
+
+Factory<v8::BooleanObject>::return_t
+Factory<v8::BooleanObject>::New(bool value) {
+  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
+}
+
+//=== Context ==================================================================
+
+Factory<v8::Context>::return_t
+Factory<v8::Context>::New( v8::ExtensionConfiguration* extensions
+                         , v8::Local<v8::ObjectTemplate> tmpl
+                         , v8::Local<v8::Value> obj) {
+  v8::Persistent<v8::Context> ctx = v8::Context::New(extensions, tmpl, obj);
+  v8::Local<v8::Context> lctx = v8::Local<v8::Context>::New(ctx);
+  ctx.Dispose();
+  return lctx;
+}
+
+//=== Date =====================================================================
+
+Factory<v8::Date>::return_t
+Factory<v8::Date>::New(double value) {
+  return v8::Date::New(value).As<v8::Date>();
+}
+
+//=== External =================================================================
+
+Factory<v8::External>::return_t
+Factory<v8::External>::New(void * value) {
+  return v8::External::New(value);
+}
+
+//=== Function =================================================================
+
+Factory<v8::Function>::return_t
+Factory<v8::Function>::New( FunctionCallback callback
+                          , v8::Local<v8::Value> data) {
+  v8::HandleScope scope;
+
+  return scope.Close(Factory<v8::FunctionTemplate>::New(
+                         callback, data, v8::Local<v8::Signature>())
+                         ->GetFunction());
+}
+
+
+//=== FunctionTemplate =========================================================
+
+Factory<v8::FunctionTemplate>::return_t
+Factory<v8::FunctionTemplate>::New( FunctionCallback callback
+                                  , v8::Local<v8::Value> data
+                                  , v8::Local<v8::Signature> signature) {
+  if (callback) {
+    v8::HandleScope scope;
+
+    v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New();
+    tpl->SetInternalFieldCount(imp::kFunctionFieldCount);
+    v8::Local<v8::Object> obj = tpl->NewInstance();
+
+    obj->SetInternalField(
+        imp::kFunctionIndex
+      , v8::External::New(reinterpret_cast<void *>(callback)));
+
+    v8::Local<v8::Value> val = v8::Local<v8::Value>::New(data);
+
+    if (!val.IsEmpty()) {
+      obj->SetInternalField(imp::kDataIndex, val);
+    }
+
+    // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find
+    // a way. Have at it though...
+    return scope.Close(
+        v8::FunctionTemplate::New(imp::FunctionCallbackWrapper
+                                 , obj
+                                 , signature));
+  } else {
+    return v8::FunctionTemplate::New(0, data, signature);
+  }
+}
+
+//=== Number ===================================================================
+
+Factory<v8::Number>::return_t
+Factory<v8::Number>::New(double value) {
+  return v8::Number::New(value);
+}
+
+//=== Number Object ============================================================
+
+Factory<v8::NumberObject>::return_t
+Factory<v8::NumberObject>::New(double value) {
+  return v8::NumberObject::New(value).As<v8::NumberObject>();
+}
+
+//=== Integer, Int32 and Uint32 ================================================
+
+template <typename T>
+typename IntegerFactory<T>::return_t
+IntegerFactory<T>::New(int32_t value) {
+  return To<T>(T::New(value));
+}
+
+template <typename T>
+typename IntegerFactory<T>::return_t
+IntegerFactory<T>::New(uint32_t value) {
+  return To<T>(T::NewFromUnsigned(value));
+}
+
+Factory<v8::Uint32>::return_t
+Factory<v8::Uint32>::New(int32_t value) {
+  return To<v8::Uint32>(v8::Uint32::NewFromUnsigned(value));
+}
+
+Factory<v8::Uint32>::return_t
+Factory<v8::Uint32>::New(uint32_t value) {
+  return To<v8::Uint32>(v8::Uint32::NewFromUnsigned(value));
+}
+
+
+//=== Object ===================================================================
+
+Factory<v8::Object>::return_t
+Factory<v8::Object>::New() {
+  return v8::Object::New();
+}
+
+//=== Object Template ==========================================================
+
+Factory<v8::ObjectTemplate>::return_t
+Factory<v8::ObjectTemplate>::New() {
+  return v8::ObjectTemplate::New();
+}
+
+//=== RegExp ===================================================================
+
+Factory<v8::RegExp>::return_t
+Factory<v8::RegExp>::New(
+    v8::Local<v8::String> pattern
+  , v8::RegExp::Flags flags) {
+  return v8::RegExp::New(pattern, flags);
+}
+
+//=== Script ===================================================================
+
+Factory<v8::Script>::return_t
+Factory<v8::Script>::New( v8::Local<v8::String> source) {
+  return v8::Script::New(source);
+}
+Factory<v8::Script>::return_t
+Factory<v8::Script>::New( v8::Local<v8::String> source
+                        , v8::ScriptOrigin const& origin) {
+  return v8::Script::New(source, const_cast<v8::ScriptOrigin*>(&origin));
+}
+
+//=== Signature ================================================================
+
+Factory<v8::Signature>::return_t
+Factory<v8::Signature>::New(Factory<v8::Signature>::FTH receiver) {
+  return v8::Signature::New(receiver);
+}
+
+//=== String ===================================================================
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New() {
+  return v8::String::Empty();
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(const char * value, int length) {
+  return v8::String::New(value, length);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(
+    std::string const& value) /* NOLINT(build/include_what_you_use) */ {
+  assert(value.size() <= INT_MAX && "string too long");
+  return v8::String::New(value.data(), static_cast<int>(value.size()));
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(const uint16_t * value, int length) {
+  return v8::String::New(value, length);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(v8::String::ExternalStringResource * value) {
+  return v8::String::NewExternal(value);
+}
+
+Factory<v8::String>::return_t
+Factory<v8::String>::New(v8::String::ExternalAsciiStringResource * value) {
+  return v8::String::NewExternal(value);
+}
+
+//=== String Object ============================================================
+
+Factory<v8::StringObject>::return_t
+Factory<v8::StringObject>::New(v8::Local<v8::String> value) {
+  return v8::StringObject::New(value).As<v8::StringObject>();
+}
+
+}  // end of namespace imp
+
+//=== Presistents and Handles ==================================================
+
+template <typename T>
+inline v8::Local<T> New(v8::Handle<T> h) {
+  return v8::Local<T>::New(h);
+}
+
+template <typename T>
+inline v8::Local<T> New(v8::Persistent<T> const& p) {
+  return v8::Local<T>::New(p);
+}
+
+template <typename T, typename M>
+inline v8::Local<T> New(Persistent<T, M> const& p) {
+  return v8::Local<T>::New(p.persistent);
+}
+
+template <typename T>
+inline v8::Local<T> New(Global<T> const& p) {
+  return v8::Local<T>::New(p.persistent);
+}
+
+#endif  // NAN_IMPLEMENTATION_PRE_12_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_json.h b/legacy-libs/grpc/node_modules/nan/nan_json.h
new file mode 100644 (file)
index 0000000..33ac8ba
--- /dev/null
@@ -0,0 +1,166 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_JSON_H_
+#define NAN_JSON_H_
+
+#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION
+#define NAN_JSON_H_NEED_PARSE 1
+#else
+#define NAN_JSON_H_NEED_PARSE 0
+#endif  // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION
+
+#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION
+#define NAN_JSON_H_NEED_STRINGIFY 0
+#else
+#define NAN_JSON_H_NEED_STRINGIFY 1
+#endif  // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION
+
+class JSON {
+ public:
+  JSON() {
+#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY
+    Nan::HandleScope scope;
+
+    Nan::MaybeLocal<v8::Value> maybe_global_json = Nan::Get(
+      Nan::GetCurrentContext()->Global(),
+      Nan::New("JSON").ToLocalChecked()
+    );
+
+    assert(!maybe_global_json.IsEmpty() && "global JSON is empty");
+    v8::Local<v8::Value> val_global_json = maybe_global_json.ToLocalChecked();
+
+    assert(val_global_json->IsObject() && "global JSON is not an object");
+    Nan::MaybeLocal<v8::Object> maybe_obj_global_json =
+      Nan::To<v8::Object>(val_global_json);
+
+    assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty");
+    v8::Local<v8::Object> global_json = maybe_obj_global_json.ToLocalChecked();
+
+#if NAN_JSON_H_NEED_PARSE
+    Nan::MaybeLocal<v8::Value> maybe_parse_method = Nan::Get(
+      global_json, Nan::New("parse").ToLocalChecked()
+    );
+
+    assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty");
+    v8::Local<v8::Value> parse_method = maybe_parse_method.ToLocalChecked();
+
+    assert(parse_method->IsFunction() && "JSON.parse is not a function");
+    parse_cb_.Reset(parse_method.As<v8::Function>());
+#endif  // NAN_JSON_H_NEED_PARSE
+
+#if NAN_JSON_H_NEED_STRINGIFY
+    Nan::MaybeLocal<v8::Value> maybe_stringify_method = Nan::Get(
+      global_json, Nan::New("stringify").ToLocalChecked()
+    );
+
+    assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty");
+    v8::Local<v8::Value> stringify_method =
+      maybe_stringify_method.ToLocalChecked();
+
+    assert(
+      stringify_method->IsFunction() && "JSON.stringify is not a function"
+    );
+    stringify_cb_.Reset(stringify_method.As<v8::Function>());
+#endif  // NAN_JSON_H_NEED_STRINGIFY
+#endif  // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY
+  }
+
+  inline
+  Nan::MaybeLocal<v8::Value> Parse(v8::Local<v8::String> json_string) {
+    Nan::EscapableHandleScope scope;
+#if NAN_JSON_H_NEED_PARSE
+    return scope.Escape(parse(json_string));
+#else
+    Nan::MaybeLocal<v8::Value> result;
+#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \
+    NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION
+    result = v8::JSON::Parse(json_string);
+#else
+#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION
+    v8::Local<v8::Context> context_or_isolate = Nan::GetCurrentContext();
+#else
+    v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent();
+#endif  // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION
+    result = v8::JSON::Parse(context_or_isolate, json_string);
+#endif  // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION &&
+        // NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION
+    if (result.IsEmpty()) return v8::Local<v8::Value>();
+    return scope.Escape(result.ToLocalChecked());
+#endif  // NAN_JSON_H_NEED_PARSE
+  }
+
+  inline
+  Nan::MaybeLocal<v8::String> Stringify(v8::Local<v8::Object> json_object) {
+    Nan::EscapableHandleScope scope;
+    Nan::MaybeLocal<v8::String> result =
+#if NAN_JSON_H_NEED_STRINGIFY
+      Nan::To<v8::String>(stringify(json_object));
+#else
+      v8::JSON::Stringify(Nan::GetCurrentContext(), json_object);
+#endif  // NAN_JSON_H_NEED_STRINGIFY
+    if (result.IsEmpty()) return v8::Local<v8::String>();
+    return scope.Escape(result.ToLocalChecked());
+  }
+
+  inline
+  Nan::MaybeLocal<v8::String> Stringify(v8::Local<v8::Object> json_object,
+    v8::Local<v8::String> gap) {
+    Nan::EscapableHandleScope scope;
+    Nan::MaybeLocal<v8::String> result =
+#if NAN_JSON_H_NEED_STRINGIFY
+      Nan::To<v8::String>(stringify(json_object, gap));
+#else
+      v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap);
+#endif  // NAN_JSON_H_NEED_STRINGIFY
+    if (result.IsEmpty()) return v8::Local<v8::String>();
+    return scope.Escape(result.ToLocalChecked());
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON)
+#if NAN_JSON_H_NEED_PARSE
+  Nan::Callback parse_cb_;
+#endif  // NAN_JSON_H_NEED_PARSE
+#if NAN_JSON_H_NEED_STRINGIFY
+  Nan::Callback stringify_cb_;
+#endif  // NAN_JSON_H_NEED_STRINGIFY
+
+#if NAN_JSON_H_NEED_PARSE
+  inline v8::Local<v8::Value> parse(v8::Local<v8::Value> arg) {
+    assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty");
+    AsyncResource resource("nan:JSON.parse");
+    return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local<v8::Value>());
+  }
+#endif  // NAN_JSON_H_NEED_PARSE
+
+#if NAN_JSON_H_NEED_STRINGIFY
+  inline v8::Local<v8::Value> stringify(v8::Local<v8::Value> arg) {
+    assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty");
+    AsyncResource resource("nan:JSON.stringify");
+    return stringify_cb_.Call(1, &arg, &resource)
+        .FromMaybe(v8::Local<v8::Value>());
+  }
+
+  inline v8::Local<v8::Value> stringify(v8::Local<v8::Value> arg,
+    v8::Local<v8::String> gap) {
+    assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty");
+
+    v8::Local<v8::Value> argv[] = {
+      arg,
+      Nan::Null(),
+      gap
+    };
+    AsyncResource resource("nan:JSON.stringify");
+    return stringify_cb_.Call(3, argv, &resource)
+        .FromMaybe(v8::Local<v8::Value>());
+  }
+#endif  // NAN_JSON_H_NEED_STRINGIFY
+};
+
+#endif  // NAN_JSON_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_maybe_43_inl.h b/legacy-libs/grpc/node_modules/nan/nan_maybe_43_inl.h
new file mode 100644 (file)
index 0000000..c04ce30
--- /dev/null
@@ -0,0 +1,356 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_MAYBE_43_INL_H_
+#define NAN_MAYBE_43_INL_H_
+
+template<typename T>
+using MaybeLocal = v8::MaybeLocal<T>;
+
+inline
+MaybeLocal<v8::String> ToDetailString(v8::Local<v8::Value> val) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(val->ToDetailString(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::String>()));
+}
+
+inline
+MaybeLocal<v8::Uint32> ToArrayIndex(v8::Local<v8::Value> val) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::Uint32>()));
+}
+
+inline
+Maybe<bool> Equals(v8::Local<v8::Value> a, v8::Local<v8::Value>(b)) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return a->Equals(isolate->GetCurrentContext(), b);
+}
+
+inline
+MaybeLocal<v8::Object> NewInstance(v8::Local<v8::Function> h) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(h->NewInstance(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::Object>()));
+}
+
+inline
+MaybeLocal<v8::Object> NewInstance(
+      v8::Local<v8::Function> h
+    , int argc
+    , v8::Local<v8::Value> argv[]) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv)
+                          .FromMaybe(v8::Local<v8::Object>()));
+}
+
+inline
+MaybeLocal<v8::Object> NewInstance(v8::Local<v8::ObjectTemplate> h) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(h->NewInstance(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::Object>()));
+}
+
+
+inline MaybeLocal<v8::Function> GetFunction(
+    v8::Local<v8::FunctionTemplate> t) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(t->GetFunction(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::Function>()));
+}
+
+inline Maybe<bool> Set(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::Value> key
+  , v8::Local<v8::Value> value) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->Set(isolate->GetCurrentContext(), key, value);
+}
+
+inline Maybe<bool> Set(
+    v8::Local<v8::Object> obj
+  , uint32_t index
+  , v8::Local<v8::Value> value) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->Set(isolate->GetCurrentContext(), index, value);
+}
+
+#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION
+#include "nan_define_own_property_helper.h"  // NOLINT(build/include)
+#endif
+
+inline Maybe<bool> DefineOwnProperty(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key
+  , v8::Local<v8::Value> value
+  , v8::PropertyAttribute attribs = v8::None) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION
+  return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value,
+                                attribs);
+#else
+  Maybe<v8::PropertyAttribute> maybeCurrent =
+      obj->GetPropertyAttributes(isolate->GetCurrentContext(), key);
+  if (maybeCurrent.IsNothing()) {
+    return Nothing<bool>();
+  }
+  v8::PropertyAttribute current = maybeCurrent.FromJust();
+  return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs);
+#endif
+}
+
+NAN_DEPRECATED inline Maybe<bool> ForceSet(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::Value> key
+  , v8::Local<v8::Value> value
+  , v8::PropertyAttribute attribs = v8::None) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
+  return key->IsName()
+             ? obj->DefineOwnProperty(isolate->GetCurrentContext(),
+                                      key.As<v8::Name>(), value, attribs)
+             : Nothing<bool>();
+#else
+  return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
+#endif
+}
+
+inline MaybeLocal<v8::Value> Get(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::Value> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(obj->Get(isolate->GetCurrentContext(), key)
+                          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline
+MaybeLocal<v8::Value> Get(v8::Local<v8::Object> obj, uint32_t index) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(obj->Get(isolate->GetCurrentContext(), index)
+                          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline v8::PropertyAttribute GetPropertyAttributes(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::Value> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key)
+      .FromJust();
+}
+
+inline Maybe<bool> Has(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->Has(isolate->GetCurrentContext(), key);
+}
+
+inline Maybe<bool> Has(v8::Local<v8::Object> obj, uint32_t index) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->Has(isolate->GetCurrentContext(), index);
+}
+
+inline Maybe<bool> Delete(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->Delete(isolate->GetCurrentContext(), key);
+}
+
+inline
+Maybe<bool> Delete(v8::Local<v8::Object> obj, uint32_t index) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->Delete(isolate->GetCurrentContext(), index);
+}
+
+inline
+MaybeLocal<v8::Array> GetPropertyNames(v8::Local<v8::Object> obj) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::Array>()));
+}
+
+inline
+MaybeLocal<v8::Array> GetOwnPropertyNames(v8::Local<v8::Object> obj) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::Array>()));
+}
+
+inline Maybe<bool> SetPrototype(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::Value> prototype) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->SetPrototype(isolate->GetCurrentContext(), prototype);
+}
+
+inline MaybeLocal<v8::String> ObjectProtoToString(
+    v8::Local<v8::Object> obj) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::String>()));
+}
+
+inline Maybe<bool> HasOwnProperty(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->HasOwnProperty(isolate->GetCurrentContext(), key);
+}
+
+inline Maybe<bool> HasRealNamedProperty(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key);
+}
+
+inline Maybe<bool> HasRealIndexedProperty(
+    v8::Local<v8::Object> obj
+  , uint32_t index) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index);
+}
+
+inline Maybe<bool> HasRealNamedCallbackProperty(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key);
+}
+
+inline MaybeLocal<v8::Value> GetRealNamedPropertyInPrototypeChain(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain(
+                             isolate->GetCurrentContext(), key)
+                          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline MaybeLocal<v8::Value> GetRealNamedProperty(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::String> key) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(
+      obj->GetRealNamedProperty(isolate->GetCurrentContext(), key)
+          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline MaybeLocal<v8::Value> CallAsFunction(
+    v8::Local<v8::Object> obj
+  , v8::Local<v8::Object> recv
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(
+      obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv)
+          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline MaybeLocal<v8::Value> CallAsConstructor(
+    v8::Local<v8::Object> obj
+  , int argc, v8::Local<v8::Value> argv[]) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(
+      obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv)
+          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+inline
+MaybeLocal<v8::String> GetSourceLine(v8::Local<v8::Message> msg) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext())
+                          .FromMaybe(v8::Local<v8::String>()));
+}
+
+inline Maybe<int> GetLineNumber(v8::Local<v8::Message> msg) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return msg->GetLineNumber(isolate->GetCurrentContext());
+}
+
+inline Maybe<int> GetStartColumn(v8::Local<v8::Message> msg) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return msg->GetStartColumn(isolate->GetCurrentContext());
+}
+
+inline Maybe<int> GetEndColumn(v8::Local<v8::Message> msg) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::HandleScope scope(isolate);
+  return msg->GetEndColumn(isolate->GetCurrentContext());
+}
+
+inline MaybeLocal<v8::Object> CloneElementAt(
+    v8::Local<v8::Array> array
+  , uint32_t index) {
+#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Value> elem;
+  v8::Local<v8::Object> obj;
+  if (!array->Get(context, index).ToLocal(&elem)) {
+    return scope.Escape(obj);
+  }
+  if (!elem->ToObject(context).ToLocal(&obj)) {
+    return scope.Escape(v8::Local<v8::Object>());
+  }
+  return scope.Escape(obj->Clone());
+#else
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index)
+                          .FromMaybe(v8::Local<v8::Object>()));
+#endif
+}
+
+inline MaybeLocal<v8::Value> Call(
+    v8::Local<v8::Function> fun
+  , v8::Local<v8::Object> recv
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv)
+                          .FromMaybe(v8::Local<v8::Value>()));
+}
+
+#endif  // NAN_MAYBE_43_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_maybe_pre_43_inl.h b/legacy-libs/grpc/node_modules/nan/nan_maybe_pre_43_inl.h
new file mode 100644 (file)
index 0000000..83325ae
--- /dev/null
@@ -0,0 +1,268 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_MAYBE_PRE_43_INL_H_
+#define NAN_MAYBE_PRE_43_INL_H_
+
+template<typename T>
+class MaybeLocal {
+ public:
+  inline MaybeLocal() : val_(v8::Local<T>()) {}
+
+  template<typename S>
+# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION
+  inline
+  MaybeLocal(v8::Local<S> that) : val_(that) {}  // NOLINT(runtime/explicit)
+# else
+  inline
+  MaybeLocal(v8::Local<S> that) :  // NOLINT(runtime/explicit)
+      val_(*reinterpret_cast<v8::Local<T>*>(&that)) {}
+# endif
+
+  inline bool IsEmpty() const { return val_.IsEmpty(); }
+
+  template<typename S>
+  inline bool ToLocal(v8::Local<S> *out) const {
+    *out = val_;
+    return !IsEmpty();
+  }
+
+  inline v8::Local<T> ToLocalChecked() const {
+#if defined(V8_ENABLE_CHECKS)
+    assert(!IsEmpty() && "ToLocalChecked is Empty");
+#endif  // V8_ENABLE_CHECKS
+    return val_;
+  }
+
+  template<typename S>
+  inline v8::Local<S> FromMaybe(v8::Local<S> default_value) const {
+    return IsEmpty() ? default_value : v8::Local<S>(val_);
+  }
+
+ private:
+  v8::Local<T> val_;
+};
+
+inline
+MaybeLocal<v8::String> ToDetailString(v8::Handle<v8::Value> val) {
+  return MaybeLocal<v8::String>(val->ToDetailString());
+}
+
+inline
+MaybeLocal<v8::Uint32> ToArrayIndex(v8::Handle<v8::Value> val) {
+  return MaybeLocal<v8::Uint32>(val->ToArrayIndex());
+}
+
+inline
+Maybe<bool> Equals(v8::Handle<v8::Value> a, v8::Handle<v8::Value>(b)) {
+  return Just<bool>(a->Equals(b));
+}
+
+inline
+MaybeLocal<v8::Object> NewInstance(v8::Handle<v8::Function> h) {
+  return MaybeLocal<v8::Object>(h->NewInstance());
+}
+
+inline
+MaybeLocal<v8::Object> NewInstance(
+      v8::Local<v8::Function> h
+    , int argc
+    , v8::Local<v8::Value> argv[]) {
+  return MaybeLocal<v8::Object>(h->NewInstance(argc, argv));
+}
+
+inline
+MaybeLocal<v8::Object> NewInstance(v8::Handle<v8::ObjectTemplate> h) {
+  return MaybeLocal<v8::Object>(h->NewInstance());
+}
+
+inline
+MaybeLocal<v8::Function> GetFunction(v8::Handle<v8::FunctionTemplate> t) {
+  return MaybeLocal<v8::Function>(t->GetFunction());
+}
+
+inline Maybe<bool> Set(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::Value> key
+  , v8::Handle<v8::Value> value) {
+  return Just<bool>(obj->Set(key, value));
+}
+
+inline Maybe<bool> Set(
+    v8::Handle<v8::Object> obj
+  , uint32_t index
+  , v8::Handle<v8::Value> value) {
+  return Just<bool>(obj->Set(index, value));
+}
+
+#include "nan_define_own_property_helper.h"  // NOLINT(build/include)
+
+inline Maybe<bool> DefineOwnProperty(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key
+  , v8::Handle<v8::Value> value
+  , v8::PropertyAttribute attribs = v8::None) {
+  v8::PropertyAttribute current = obj->GetPropertyAttributes(key);
+  return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs);
+}
+
+NAN_DEPRECATED inline Maybe<bool> ForceSet(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::Value> key
+  , v8::Handle<v8::Value> value
+  , v8::PropertyAttribute attribs = v8::None) {
+  return Just<bool>(obj->ForceSet(key, value, attribs));
+}
+
+inline MaybeLocal<v8::Value> Get(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::Value> key) {
+  return MaybeLocal<v8::Value>(obj->Get(key));
+}
+
+inline MaybeLocal<v8::Value> Get(
+    v8::Handle<v8::Object> obj
+  , uint32_t index) {
+  return MaybeLocal<v8::Value>(obj->Get(index));
+}
+
+inline Maybe<v8::PropertyAttribute> GetPropertyAttributes(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::Value> key) {
+  return Just<v8::PropertyAttribute>(obj->GetPropertyAttributes(key));
+}
+
+inline Maybe<bool> Has(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return Just<bool>(obj->Has(key));
+}
+
+inline Maybe<bool> Has(
+    v8::Handle<v8::Object> obj
+  , uint32_t index) {
+  return Just<bool>(obj->Has(index));
+}
+
+inline Maybe<bool> Delete(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return Just<bool>(obj->Delete(key));
+}
+
+inline Maybe<bool> Delete(
+    v8::Handle<v8::Object> obj
+  , uint32_t index) {
+  return Just<bool>(obj->Delete(index));
+}
+
+inline
+MaybeLocal<v8::Array> GetPropertyNames(v8::Handle<v8::Object> obj) {
+  return MaybeLocal<v8::Array>(obj->GetPropertyNames());
+}
+
+inline
+MaybeLocal<v8::Array> GetOwnPropertyNames(v8::Handle<v8::Object> obj) {
+  return MaybeLocal<v8::Array>(obj->GetOwnPropertyNames());
+}
+
+inline Maybe<bool> SetPrototype(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::Value> prototype) {
+  return Just<bool>(obj->SetPrototype(prototype));
+}
+
+inline MaybeLocal<v8::String> ObjectProtoToString(
+    v8::Handle<v8::Object> obj) {
+  return MaybeLocal<v8::String>(obj->ObjectProtoToString());
+}
+
+inline Maybe<bool> HasOwnProperty(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return Just<bool>(obj->HasOwnProperty(key));
+}
+
+inline Maybe<bool> HasRealNamedProperty(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return Just<bool>(obj->HasRealNamedProperty(key));
+}
+
+inline Maybe<bool> HasRealIndexedProperty(
+    v8::Handle<v8::Object> obj
+  , uint32_t index) {
+  return Just<bool>(obj->HasRealIndexedProperty(index));
+}
+
+inline Maybe<bool> HasRealNamedCallbackProperty(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return Just<bool>(obj->HasRealNamedCallbackProperty(key));
+}
+
+inline MaybeLocal<v8::Value> GetRealNamedPropertyInPrototypeChain(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return MaybeLocal<v8::Value>(
+      obj->GetRealNamedPropertyInPrototypeChain(key));
+}
+
+inline MaybeLocal<v8::Value> GetRealNamedProperty(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::String> key) {
+  return MaybeLocal<v8::Value>(obj->GetRealNamedProperty(key));
+}
+
+inline MaybeLocal<v8::Value> CallAsFunction(
+    v8::Handle<v8::Object> obj
+  , v8::Handle<v8::Object> recv
+  , int argc
+  , v8::Handle<v8::Value> argv[]) {
+  return MaybeLocal<v8::Value>(obj->CallAsFunction(recv, argc, argv));
+}
+
+inline MaybeLocal<v8::Value> CallAsConstructor(
+    v8::Handle<v8::Object> obj
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  return MaybeLocal<v8::Value>(obj->CallAsConstructor(argc, argv));
+}
+
+inline
+MaybeLocal<v8::String> GetSourceLine(v8::Handle<v8::Message> msg) {
+  return MaybeLocal<v8::String>(msg->GetSourceLine());
+}
+
+inline Maybe<int> GetLineNumber(v8::Handle<v8::Message> msg) {
+  return Just<int>(msg->GetLineNumber());
+}
+
+inline Maybe<int> GetStartColumn(v8::Handle<v8::Message> msg) {
+  return Just<int>(msg->GetStartColumn());
+}
+
+inline Maybe<int> GetEndColumn(v8::Handle<v8::Message> msg) {
+  return Just<int>(msg->GetEndColumn());
+}
+
+inline MaybeLocal<v8::Object> CloneElementAt(
+    v8::Handle<v8::Array> array
+  , uint32_t index) {
+  return MaybeLocal<v8::Object>(array->CloneElementAt(index));
+}
+
+inline MaybeLocal<v8::Value> Call(
+    v8::Local<v8::Function> fun
+  , v8::Local<v8::Object> recv
+  , int argc
+  , v8::Local<v8::Value> argv[]) {
+  return MaybeLocal<v8::Value>(fun->Call(recv, argc, argv));
+}
+
+#endif  // NAN_MAYBE_PRE_43_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_new.h b/legacy-libs/grpc/node_modules/nan/nan_new.h
new file mode 100644 (file)
index 0000000..cdf8bbe
--- /dev/null
@@ -0,0 +1,340 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_NEW_H_
+#define NAN_NEW_H_
+
+namespace imp {  // scnr
+
+// TODO(agnat): Generalize
+template <typename T> v8::Local<T> To(v8::Local<v8::Integer> i);
+
+template <>
+inline
+v8::Local<v8::Integer>
+To<v8::Integer>(v8::Local<v8::Integer> i) {
+  return Nan::To<v8::Integer>(i).ToLocalChecked();
+}
+
+template <>
+inline
+v8::Local<v8::Int32>
+To<v8::Int32>(v8::Local<v8::Integer> i) {
+  return Nan::To<v8::Int32>(i).ToLocalChecked();
+}
+
+template <>
+inline
+v8::Local<v8::Uint32>
+To<v8::Uint32>(v8::Local<v8::Integer> i) {
+  return Nan::To<v8::Uint32>(i).ToLocalChecked();
+}
+
+template <typename T> struct FactoryBase {
+  typedef v8::Local<T> return_t;
+};
+
+template <typename T> struct MaybeFactoryBase {
+  typedef MaybeLocal<T> return_t;
+};
+
+template <typename T> struct Factory;
+
+template <>
+struct Factory<v8::Array> : FactoryBase<v8::Array> {
+  static inline return_t New();
+  static inline return_t New(int length);
+};
+
+template <>
+struct Factory<v8::Boolean> : FactoryBase<v8::Boolean> {
+  static inline return_t New(bool value);
+};
+
+template <>
+struct Factory<v8::BooleanObject> : FactoryBase<v8::BooleanObject> {
+  static inline return_t New(bool value);
+};
+
+template <>
+struct Factory<v8::Context> : FactoryBase<v8::Context> {
+  static inline
+  return_t
+  New( v8::ExtensionConfiguration* extensions = NULL
+     , v8::Local<v8::ObjectTemplate> tmpl = v8::Local<v8::ObjectTemplate>()
+     , v8::Local<v8::Value> obj = v8::Local<v8::Value>());
+};
+
+template <>
+struct Factory<v8::Date> : MaybeFactoryBase<v8::Date> {
+  static inline return_t New(double value);
+};
+
+template <>
+struct Factory<v8::External> : FactoryBase<v8::External> {
+  static inline return_t New(void *value);
+};
+
+template <>
+struct Factory<v8::Function> : FactoryBase<v8::Function> {
+  static inline
+  return_t
+  New( FunctionCallback callback
+     , v8::Local<v8::Value> data = v8::Local<v8::Value>());
+};
+
+template <>
+struct Factory<v8::FunctionTemplate> : FactoryBase<v8::FunctionTemplate> {
+  static inline
+  return_t
+  New( FunctionCallback callback = NULL
+     , v8::Local<v8::Value> data = v8::Local<v8::Value>()
+     , v8::Local<v8::Signature> signature = v8::Local<v8::Signature>());
+};
+
+template <>
+struct Factory<v8::Number> : FactoryBase<v8::Number> {
+  static inline return_t New(double value);
+};
+
+template <>
+struct Factory<v8::NumberObject> : FactoryBase<v8::NumberObject> {
+  static inline return_t New(double value);
+};
+
+template <typename T>
+struct IntegerFactory : FactoryBase<T> {
+  typedef typename FactoryBase<T>::return_t return_t;
+  static inline return_t New(int32_t value);
+  static inline return_t New(uint32_t value);
+};
+
+template <>
+struct Factory<v8::Integer> : IntegerFactory<v8::Integer> {};
+
+template <>
+struct Factory<v8::Int32> : IntegerFactory<v8::Int32> {};
+
+template <>
+struct Factory<v8::Uint32> : FactoryBase<v8::Uint32> {
+  static inline return_t New(int32_t value);
+  static inline return_t New(uint32_t value);
+};
+
+template <>
+struct Factory<v8::Object> : FactoryBase<v8::Object> {
+  static inline return_t New();
+};
+
+template <>
+struct Factory<v8::ObjectTemplate> : FactoryBase<v8::ObjectTemplate> {
+  static inline return_t New();
+};
+
+template <>
+struct Factory<v8::RegExp> : MaybeFactoryBase<v8::RegExp> {
+  static inline return_t New(
+      v8::Local<v8::String> pattern, v8::RegExp::Flags flags);
+};
+
+template <>
+struct Factory<v8::Script> : MaybeFactoryBase<v8::Script> {
+  static inline return_t New( v8::Local<v8::String> source);
+  static inline return_t New( v8::Local<v8::String> source
+                            , v8::ScriptOrigin const& origin);
+};
+
+template <>
+struct Factory<v8::Signature> : FactoryBase<v8::Signature> {
+  typedef v8::Local<v8::FunctionTemplate> FTH;
+  static inline return_t New(FTH receiver = FTH());
+};
+
+template <>
+struct Factory<v8::String> : MaybeFactoryBase<v8::String> {
+  static inline return_t New();
+  static inline return_t New(const char *value, int length = -1);
+  static inline return_t New(const uint16_t *value, int length = -1);
+  static inline return_t New(std::string const& value);
+
+  static inline return_t New(v8::String::ExternalStringResource * value);
+  static inline return_t New(ExternalOneByteStringResource * value);
+};
+
+template <>
+struct Factory<v8::StringObject> : FactoryBase<v8::StringObject> {
+  static inline return_t New(v8::Local<v8::String> value);
+};
+
+}  // end of namespace imp
+
+#if (NODE_MODULE_VERSION >= 12)
+
+namespace imp {
+
+template <>
+struct Factory<v8::UnboundScript> : MaybeFactoryBase<v8::UnboundScript> {
+  static inline return_t New( v8::Local<v8::String> source);
+  static inline return_t New( v8::Local<v8::String> source
+                            , v8::ScriptOrigin const& origin);
+};
+
+}  // end of namespace imp
+
+# include "nan_implementation_12_inl.h"
+
+#else  // NODE_MODULE_VERSION >= 12
+
+# include "nan_implementation_pre_12_inl.h"
+
+#endif
+
+//=== API ======================================================================
+
+template <typename T>
+typename imp::Factory<T>::return_t
+New() {
+  return imp::Factory<T>::New();
+}
+
+template <typename T, typename A0>
+typename imp::Factory<T>::return_t
+New(A0 arg0) {
+  return imp::Factory<T>::New(arg0);
+}
+
+template <typename T, typename A0, typename A1>
+typename imp::Factory<T>::return_t
+New(A0 arg0, A1 arg1) {
+  return imp::Factory<T>::New(arg0, arg1);
+}
+
+template <typename T, typename A0, typename A1, typename A2>
+typename imp::Factory<T>::return_t
+New(A0 arg0, A1 arg1, A2 arg2) {
+  return imp::Factory<T>::New(arg0, arg1, arg2);
+}
+
+template <typename T, typename A0, typename A1, typename A2, typename A3>
+typename imp::Factory<T>::return_t
+New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) {
+  return imp::Factory<T>::New(arg0, arg1, arg2, arg3);
+}
+
+// Note(agnat): When passing overloaded function pointers to template functions
+// as generic arguments the compiler needs help in picking the right overload.
+// These two functions handle New<Function> and New<FunctionTemplate> with
+// all argument variations.
+
+// v8::Function and v8::FunctionTemplate with one or two arguments
+template <typename T>
+typename imp::Factory<T>::return_t
+New( FunctionCallback callback
+      , v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
+    return imp::Factory<T>::New(callback, data);
+}
+
+// v8::Function and v8::FunctionTemplate with three arguments
+template <typename T, typename A2>
+typename imp::Factory<T>::return_t
+New( FunctionCallback callback
+      , v8::Local<v8::Value> data = v8::Local<v8::Value>()
+      , A2 a2 = A2()) {
+    return imp::Factory<T>::New(callback, data, a2);
+}
+
+// Convenience
+
+#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
+template <typename T> inline v8::Local<T> New(v8::Handle<T> h);
+#endif
+
+#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+template <typename T, typename M>
+    inline v8::Local<T> New(v8::Persistent<T, M> const& p);
+#else
+template <typename T> inline v8::Local<T> New(v8::Persistent<T> const& p);
+#endif
+template <typename T, typename M>
+inline v8::Local<T> New(Persistent<T, M> const& p);
+template <typename T>
+inline v8::Local<T> New(Global<T> const& p);
+
+inline
+imp::Factory<v8::Boolean>::return_t
+New(bool value) {
+  return New<v8::Boolean>(value);
+}
+
+inline
+imp::Factory<v8::Int32>::return_t
+New(int32_t value) {
+  return New<v8::Int32>(value);
+}
+
+inline
+imp::Factory<v8::Uint32>::return_t
+New(uint32_t value) {
+  return New<v8::Uint32>(value);
+}
+
+inline
+imp::Factory<v8::Number>::return_t
+New(double value) {
+  return New<v8::Number>(value);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(std::string const& value) {  // NOLINT(build/include_what_you_use)
+  return New<v8::String>(value);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(const char * value, int length) {
+  return New<v8::String>(value, length);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(const uint16_t * value, int length) {
+  return New<v8::String>(value, length);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(const char * value) {
+  return New<v8::String>(value);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(const uint16_t * value) {
+  return New<v8::String>(value);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(v8::String::ExternalStringResource * value) {
+  return New<v8::String>(value);
+}
+
+inline
+imp::Factory<v8::String>::return_t
+New(ExternalOneByteStringResource * value) {
+  return New<v8::String>(value);
+}
+
+inline
+imp::Factory<v8::RegExp>::return_t
+New(v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+  return New<v8::RegExp>(pattern, flags);
+}
+
+#endif  // NAN_NEW_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_object_wrap.h b/legacy-libs/grpc/node_modules/nan/nan_object_wrap.h
new file mode 100644 (file)
index 0000000..78712f9
--- /dev/null
@@ -0,0 +1,156 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_OBJECT_WRAP_H_
+#define NAN_OBJECT_WRAP_H_
+
+class ObjectWrap {
+ public:
+  ObjectWrap() {
+    refs_ = 0;
+  }
+
+
+  virtual ~ObjectWrap() {
+    if (persistent().IsEmpty()) {
+      return;
+    }
+
+    persistent().ClearWeak();
+    persistent().Reset();
+  }
+
+
+  template <class T>
+  static inline T* Unwrap(v8::Local<v8::Object> object) {
+    assert(!object.IsEmpty());
+    assert(object->InternalFieldCount() > 0);
+    // Cast to ObjectWrap before casting to T.  A direct cast from void
+    // to T won't work right when T has more than one base class.
+    void* ptr = GetInternalFieldPointer(object, 0);
+    ObjectWrap* wrap = static_cast<ObjectWrap*>(ptr);
+    return static_cast<T*>(wrap);
+  }
+
+
+  inline v8::Local<v8::Object> handle() const {
+    return New(handle_);
+  }
+
+
+  inline Persistent<v8::Object>& persistent() {
+    return handle_;
+  }
+
+
+ protected:
+  inline void Wrap(v8::Local<v8::Object> object) {
+    assert(persistent().IsEmpty());
+    assert(object->InternalFieldCount() > 0);
+    SetInternalFieldPointer(object, 0, this);
+    persistent().Reset(object);
+    MakeWeak();
+  }
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+
+  inline void MakeWeak() {
+    persistent().v8::PersistentBase<v8::Object>::SetWeak(
+        this, WeakCallback, v8::WeakCallbackType::kParameter);
+#if NODE_MAJOR_VERSION < 10
+    // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too.
+    persistent().MarkIndependent();
+#endif
+  }
+
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+
+  inline void MakeWeak() {
+    persistent().v8::PersistentBase<v8::Object>::SetWeak(this, WeakCallback);
+    persistent().MarkIndependent();
+  }
+
+#else
+
+  inline void MakeWeak() {
+    persistent().persistent.MakeWeak(this, WeakCallback);
+    persistent().MarkIndependent();
+  }
+
+#endif
+
+  /* Ref() marks the object as being attached to an event loop.
+   * Refed objects will not be garbage collected, even if
+   * all references are lost.
+   */
+  virtual void Ref() {
+    assert(!persistent().IsEmpty());
+    persistent().ClearWeak();
+    refs_++;
+  }
+
+  /* Unref() marks an object as detached from the event loop.  This is its
+   * default state.  When an object with a "weak" reference changes from
+   * attached to detached state it will be freed. Be careful not to access
+   * the object after making this call as it might be gone!
+   * (A "weak reference" means an object that only has a
+   * persistent handle.)
+   *
+   * DO NOT CALL THIS FROM DESTRUCTOR
+   */
+  virtual void Unref() {
+    assert(!persistent().IsEmpty());
+    assert(!persistent().IsWeak());
+    assert(refs_ > 0);
+    if (--refs_ == 0)
+      MakeWeak();
+  }
+
+  int refs_;  // ro
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap)
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+
+  static void
+  WeakCallback(v8::WeakCallbackInfo<ObjectWrap> const& info) {
+    ObjectWrap* wrap = info.GetParameter();
+    assert(wrap->refs_ == 0);
+    wrap->handle_.Reset();
+    delete wrap;
+  }
+
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+
+  static void
+  WeakCallback(v8::WeakCallbackData<v8::Object, ObjectWrap> const& data) {
+    ObjectWrap* wrap = data.GetParameter();
+    assert(wrap->refs_ == 0);
+    assert(wrap->handle_.IsNearDeath());
+    wrap->handle_.Reset();
+    delete wrap;
+  }
+
+#else
+
+  static void WeakCallback(v8::Persistent<v8::Value> value, void *data) {
+    ObjectWrap *wrap = static_cast<ObjectWrap*>(data);
+    assert(wrap->refs_ == 0);
+    assert(wrap->handle_.IsNearDeath());
+    wrap->handle_.Reset();
+    delete wrap;
+  }
+
+#endif
+  Persistent<v8::Object> handle_;
+};
+
+
+#endif  // NAN_OBJECT_WRAP_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_persistent_12_inl.h b/legacy-libs/grpc/node_modules/nan/nan_persistent_12_inl.h
new file mode 100644 (file)
index 0000000..d9649e8
--- /dev/null
@@ -0,0 +1,132 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_PERSISTENT_12_INL_H_
+#define NAN_PERSISTENT_12_INL_H_
+
+template<typename T, typename M> class Persistent :
+    public v8::Persistent<T, M> {
+ public:
+  inline Persistent() : v8::Persistent<T, M>() {}
+
+  template<typename S> inline Persistent(v8::Local<S> that) :
+      v8::Persistent<T, M>(v8::Isolate::GetCurrent(), that) {}
+
+  template<typename S, typename M2>
+  inline
+  Persistent(const v8::Persistent<S, M2> &that) :  // NOLINT(runtime/explicit)
+      v8::Persistent<T, M2>(v8::Isolate::GetCurrent(), that) {}
+
+  inline void Reset() { v8::PersistentBase<T>::Reset(); }
+
+  template <typename S>
+  inline void Reset(const v8::Local<S> &other) {
+    v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
+  }
+
+  template <typename S>
+  inline void Reset(const v8::PersistentBase<S> &other) {
+    v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
+  }
+
+  template<typename P>
+  inline void SetWeak(
+    P *parameter
+    , typename WeakCallbackInfo<P>::Callback callback
+    , WeakCallbackType type);
+
+ private:
+  inline T *operator*() const { return *PersistentBase<T>::persistent; }
+
+  template<typename S, typename M2>
+  inline void Copy(const Persistent<S, M2> &that) {
+    TYPE_CHECK(T, S);
+
+    this->Reset();
+
+    if (!that.IsEmpty()) {
+      this->Reset(that);
+      M::Copy(that, this);
+    }
+  }
+};
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+template<typename T>
+class Global : public v8::Global<T> {
+ public:
+  inline Global() : v8::Global<T>() {}
+
+  template<typename S> inline Global(v8::Local<S> that) :
+    v8::Global<T>(v8::Isolate::GetCurrent(), that) {}
+
+  template<typename S>
+  inline
+  Global(const v8::PersistentBase<S> &that) :  // NOLINT(runtime/explicit)
+      v8::Global<S>(v8::Isolate::GetCurrent(), that) {}
+
+  inline void Reset() { v8::PersistentBase<T>::Reset(); }
+
+  template <typename S>
+  inline void Reset(const v8::Local<S> &other) {
+    v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
+  }
+
+  template <typename S>
+  inline void Reset(const v8::PersistentBase<S> &other) {
+    v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
+  }
+
+  template<typename P>
+  inline void SetWeak(
+    P *parameter
+    , typename WeakCallbackInfo<P>::Callback callback
+    , WeakCallbackType type) {
+    reinterpret_cast<Persistent<T>*>(this)->SetWeak(
+        parameter, callback, type);
+  }
+};
+#else
+template<typename T>
+class Global : public v8::UniquePersistent<T> {
+ public:
+  inline Global() : v8::UniquePersistent<T>() {}
+
+  template<typename S> inline Global(v8::Local<S> that) :
+    v8::UniquePersistent<T>(v8::Isolate::GetCurrent(), that) {}
+
+  template<typename S>
+  inline
+  Global(const v8::PersistentBase<S> &that) :  // NOLINT(runtime/explicit)
+      v8::UniquePersistent<S>(v8::Isolate::GetCurrent(), that) {}
+
+  inline void Reset() { v8::PersistentBase<T>::Reset(); }
+
+  template <typename S>
+  inline void Reset(const v8::Local<S> &other) {
+    v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
+  }
+
+  template <typename S>
+  inline void Reset(const v8::PersistentBase<S> &other) {
+    v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
+  }
+
+  template<typename P>
+  inline void SetWeak(
+    P *parameter
+    , typename WeakCallbackInfo<P>::Callback callback
+    , WeakCallbackType type) {
+    reinterpret_cast<Persistent<T>*>(this)->SetWeak(
+        parameter, callback, type);
+  }
+};
+#endif
+
+#endif  // NAN_PERSISTENT_12_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_persistent_pre_12_inl.h b/legacy-libs/grpc/node_modules/nan/nan_persistent_pre_12_inl.h
new file mode 100644 (file)
index 0000000..4c9c59d
--- /dev/null
@@ -0,0 +1,242 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_PERSISTENT_PRE_12_INL_H_
+#define NAN_PERSISTENT_PRE_12_INL_H_
+
+template<typename T>
+class PersistentBase {
+  v8::Persistent<T> persistent;
+  template<typename U>
+  friend v8::Local<U> New(const PersistentBase<U> &p);
+  template<typename U, typename M>
+  friend v8::Local<U> New(const Persistent<U, M> &p);
+  template<typename U>
+  friend v8::Local<U> New(const Global<U> &p);
+  template<typename S> friend class ReturnValue;
+
+ public:
+  inline PersistentBase() :
+      persistent() {}
+
+  inline void Reset() {
+    persistent.Dispose();
+    persistent.Clear();
+  }
+
+  template<typename S>
+  inline void Reset(const v8::Local<S> &other) {
+    TYPE_CHECK(T, S);
+
+    if (!persistent.IsEmpty()) {
+      persistent.Dispose();
+    }
+
+    if (other.IsEmpty()) {
+      persistent.Clear();
+    } else {
+      persistent = v8::Persistent<T>::New(other);
+    }
+  }
+
+  template<typename S>
+  inline void Reset(const PersistentBase<S> &other) {
+    TYPE_CHECK(T, S);
+
+    if (!persistent.IsEmpty()) {
+      persistent.Dispose();
+    }
+
+    if (other.IsEmpty()) {
+      persistent.Clear();
+    } else {
+      persistent = v8::Persistent<T>::New(other.persistent);
+    }
+  }
+
+  inline bool IsEmpty() const { return persistent.IsEmpty(); }
+
+  inline void Empty() { persistent.Clear(); }
+
+  template<typename S>
+  inline bool operator==(const PersistentBase<S> &that) const {
+    return this->persistent == that.persistent;
+  }
+
+  template<typename S>
+  inline bool operator==(const v8::Local<S> &that) const {
+    return this->persistent == that;
+  }
+
+  template<typename S>
+  inline bool operator!=(const PersistentBase<S> &that) const {
+    return !operator==(that);
+  }
+
+  template<typename S>
+  inline bool operator!=(const v8::Local<S> &that) const {
+    return !operator==(that);
+  }
+
+  template<typename P>
+  inline void SetWeak(
+    P *parameter
+    , typename WeakCallbackInfo<P>::Callback callback
+    , WeakCallbackType type);
+
+  inline void ClearWeak() { persistent.ClearWeak(); }
+
+  inline void MarkIndependent() { persistent.MarkIndependent(); }
+
+  inline bool IsIndependent() const { return persistent.IsIndependent(); }
+
+  inline bool IsNearDeath() const { return persistent.IsNearDeath(); }
+
+  inline bool IsWeak() const { return persistent.IsWeak(); }
+
+ private:
+  inline explicit PersistentBase(v8::Persistent<T> that) :
+      persistent(that) { }
+  inline explicit PersistentBase(T *val) : persistent(val) {}
+  template<typename S, typename M> friend class Persistent;
+  template<typename S> friend class Global;
+  friend class ObjectWrap;
+};
+
+template<typename T>
+class NonCopyablePersistentTraits {
+ public:
+  typedef Persistent<T, NonCopyablePersistentTraits<T> >
+      NonCopyablePersistent;
+  static const bool kResetInDestructor = false;
+  template<typename S, typename M>
+  inline static void Copy(const Persistent<S, M> &source,
+                             NonCopyablePersistent *dest) {
+    Uncompilable<v8::Object>();
+  }
+
+  template<typename O> inline static void Uncompilable() {
+    TYPE_CHECK(O, v8::Primitive);
+  }
+};
+
+template<typename T>
+struct CopyablePersistentTraits {
+  typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
+  static const bool kResetInDestructor = true;
+  template<typename S, typename M>
+  static inline void Copy(const Persistent<S, M> &source,
+                             CopyablePersistent *dest) {}
+};
+
+template<typename T, typename M> class Persistent :
+    public PersistentBase<T> {
+ public:
+  inline Persistent() {}
+
+  template<typename S> inline Persistent(v8::Handle<S> that)
+      : PersistentBase<T>(v8::Persistent<T>::New(that)) {
+    TYPE_CHECK(T, S);
+  }
+
+  inline Persistent(const Persistent &that) : PersistentBase<T>() {
+    Copy(that);
+  }
+
+  template<typename S, typename M2>
+  inline Persistent(const Persistent<S, M2> &that) :
+      PersistentBase<T>() {
+    Copy(that);
+  }
+
+  inline Persistent &operator=(const Persistent &that) {
+    Copy(that);
+    return *this;
+  }
+
+  template <class S, class M2>
+  inline Persistent &operator=(const Persistent<S, M2> &that) {
+    Copy(that);
+    return *this;
+  }
+
+  inline ~Persistent() {
+    if (M::kResetInDestructor) this->Reset();
+  }
+
+ private:
+  inline T *operator*() const { return *PersistentBase<T>::persistent; }
+
+  template<typename S, typename M2>
+  inline void Copy(const Persistent<S, M2> &that) {
+    TYPE_CHECK(T, S);
+
+    this->Reset();
+
+    if (!that.IsEmpty()) {
+      this->persistent = v8::Persistent<T>::New(that.persistent);
+      M::Copy(that, this);
+    }
+  }
+};
+
+template<typename T>
+class Global : public PersistentBase<T> {
+  struct RValue {
+    inline explicit RValue(Global* obj) : object(obj) {}
+    Global* object;
+  };
+
+ public:
+  inline Global() : PersistentBase<T>(0) { }
+
+  template <typename S>
+  inline Global(v8::Local<S> that)  // NOLINT(runtime/explicit)
+      : PersistentBase<T>(v8::Persistent<T>::New(that)) {
+    TYPE_CHECK(T, S);
+  }
+
+  template <typename S>
+  inline Global(const PersistentBase<S> &that)  // NOLINT(runtime/explicit)
+    : PersistentBase<T>(that) {
+    TYPE_CHECK(T, S);
+  }
+  /**
+   * Move constructor.
+   */
+  inline Global(RValue rvalue)  // NOLINT(runtime/explicit)
+    : PersistentBase<T>(rvalue.object->persistent) {
+    rvalue.object->Reset();
+  }
+  inline ~Global() { this->Reset(); }
+  /**
+   * Move via assignment.
+   */
+  template<typename S>
+  inline Global &operator=(Global<S> rhs) {
+    TYPE_CHECK(T, S);
+    this->Reset(rhs.persistent);
+    rhs.Reset();
+    return *this;
+  }
+  /**
+   * Cast operator for moves.
+   */
+  inline operator RValue() { return RValue(this); }
+  /**
+   * Pass allows returning uniques from functions, etc.
+   */
+  Global Pass() { return Global(RValue(this)); }
+
+ private:
+  Global(Global &);
+  void operator=(Global &);
+  template<typename S> friend class ReturnValue;
+};
+
+#endif  // NAN_PERSISTENT_PRE_12_INL_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_private.h b/legacy-libs/grpc/node_modules/nan/nan_private.h
new file mode 100644 (file)
index 0000000..15f44cc
--- /dev/null
@@ -0,0 +1,73 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_PRIVATE_H_
+#define NAN_PRIVATE_H_
+
+inline Maybe<bool>
+HasPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key) {
+  HandleScope scope;
+#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
+  return object->HasPrivate(context, private_key);
+#else
+  return Just(!object->GetHiddenValue(key).IsEmpty());
+#endif
+}
+
+inline MaybeLocal<v8::Value>
+GetPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key) {
+#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::EscapableHandleScope scope(isolate);
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
+  v8::MaybeLocal<v8::Value> v = object->GetPrivate(context, private_key);
+  return scope.Escape(v.ToLocalChecked());
+#else
+  EscapableHandleScope scope;
+  v8::Local<v8::Value> v = object->GetHiddenValue(key);
+  if (v.IsEmpty()) {
+    v = Undefined();
+  }
+  return scope.Escape(v);
+#endif
+}
+
+inline Maybe<bool> SetPrivate(
+    v8::Local<v8::Object> object,
+    v8::Local<v8::String> key,
+    v8::Local<v8::Value> value) {
+#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
+  HandleScope scope;
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
+  return object->SetPrivate(context, private_key, value);
+#else
+  return Just(object->SetHiddenValue(key, value));
+#endif
+}
+
+inline Maybe<bool> DeletePrivate(
+    v8::Local<v8::Object> object,
+    v8::Local<v8::String> key) {
+#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
+  HandleScope scope;
+  v8::Isolate *isolate = v8::Isolate::GetCurrent();
+  v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
+  return object->DeletePrivate(isolate->GetCurrentContext(), private_key);
+#else
+  return Just(object->DeleteHiddenValue(key));
+#endif
+}
+
+#endif  // NAN_PRIVATE_H_
+
diff --git a/legacy-libs/grpc/node_modules/nan/nan_string_bytes.h b/legacy-libs/grpc/node_modules/nan/nan_string_bytes.h
new file mode 100644 (file)
index 0000000..a2e6437
--- /dev/null
@@ -0,0 +1,305 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#ifndef NAN_STRING_BYTES_H_
+#define NAN_STRING_BYTES_H_
+
+// Decodes a v8::Local<v8::String> or Buffer to a raw char*
+
+namespace imp {
+
+using v8::Local;
+using v8::Object;
+using v8::String;
+using v8::Value;
+
+
+//// Base 64 ////
+
+#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)
+
+
+
+//// HEX ////
+
+static bool contains_non_ascii_slow(const char* buf, size_t len) {
+  for (size_t i = 0; i < len; ++i) {
+    if (buf[i] & 0x80) return true;
+  }
+  return false;
+}
+
+
+static bool contains_non_ascii(const char* src, size_t len) {
+  if (len < 16) {
+    return contains_non_ascii_slow(src, len);
+  }
+
+  const unsigned bytes_per_word = sizeof(void*);
+  const unsigned align_mask = bytes_per_word - 1;
+  const unsigned unaligned = reinterpret_cast<uintptr_t>(src) & align_mask;
+
+  if (unaligned > 0) {
+    const unsigned n = bytes_per_word - unaligned;
+    if (contains_non_ascii_slow(src, n)) return true;
+    src += n;
+    len -= n;
+  }
+
+
+#if defined(__x86_64__) || defined(_WIN64)
+  const uintptr_t mask = 0x8080808080808080ll;
+#else
+  const uintptr_t mask = 0x80808080l;
+#endif
+
+  const uintptr_t* srcw = reinterpret_cast<const uintptr_t*>(src);
+
+  for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) {
+    if (srcw[i] & mask) return true;
+  }
+
+  const unsigned remainder = len & align_mask;
+  if (remainder > 0) {
+    const size_t offset = len - remainder;
+    if (contains_non_ascii_slow(src + offset, remainder)) return true;
+  }
+
+  return false;
+}
+
+
+static void force_ascii_slow(const char* src, char* dst, size_t len) {
+  for (size_t i = 0; i < len; ++i) {
+    dst[i] = src[i] & 0x7f;
+  }
+}
+
+
+static void force_ascii(const char* src, char* dst, size_t len) {
+  if (len < 16) {
+    force_ascii_slow(src, dst, len);
+    return;
+  }
+
+  const unsigned bytes_per_word = sizeof(void*);
+  const unsigned align_mask = bytes_per_word - 1;
+  const unsigned src_unalign = reinterpret_cast<uintptr_t>(src) & align_mask;
+  const unsigned dst_unalign = reinterpret_cast<uintptr_t>(dst) & align_mask;
+
+  if (src_unalign > 0) {
+    if (src_unalign == dst_unalign) {
+      const unsigned unalign = bytes_per_word - src_unalign;
+      force_ascii_slow(src, dst, unalign);
+      src += unalign;
+      dst += unalign;
+      len -= src_unalign;
+    } else {
+      force_ascii_slow(src, dst, len);
+      return;
+    }
+  }
+
+#if defined(__x86_64__) || defined(_WIN64)
+  const uintptr_t mask = ~0x8080808080808080ll;
+#else
+  const uintptr_t mask = ~0x80808080l;
+#endif
+
+  const uintptr_t* srcw = reinterpret_cast<const uintptr_t*>(src);
+  uintptr_t* dstw = reinterpret_cast<uintptr_t*>(dst);
+
+  for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) {
+    dstw[i] = srcw[i] & mask;
+  }
+
+  const unsigned remainder = len & align_mask;
+  if (remainder > 0) {
+    const size_t offset = len - remainder;
+    force_ascii_slow(src + offset, dst + offset, remainder);
+  }
+}
+
+
+static size_t base64_encode(const char* src,
+                            size_t slen,
+                            char* dst,
+                            size_t dlen) {
+  // We know how much we'll write, just make sure that there's space.
+  assert(dlen >= base64_encoded_size(slen) &&
+      "not enough space provided for base64 encode");
+
+  dlen = base64_encoded_size(slen);
+
+  unsigned a;
+  unsigned b;
+  unsigned c;
+  unsigned i;
+  unsigned k;
+  unsigned n;
+
+  static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                              "abcdefghijklmnopqrstuvwxyz"
+                              "0123456789+/";
+
+  i = 0;
+  k = 0;
+  n = slen / 3 * 3;
+
+  while (i < n) {
+    a = src[i + 0] & 0xff;
+    b = src[i + 1] & 0xff;
+    c = src[i + 2] & 0xff;
+
+    dst[k + 0] = table[a >> 2];
+    dst[k + 1] = table[((a & 3) << 4) | (b >> 4)];
+    dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)];
+    dst[k + 3] = table[c & 0x3f];
+
+    i += 3;
+    k += 4;
+  }
+
+  if (n != slen) {
+    switch (slen - n) {
+      case 1:
+        a = src[i + 0] & 0xff;
+        dst[k + 0] = table[a >> 2];
+        dst[k + 1] = table[(a & 3) << 4];
+        dst[k + 2] = '=';
+        dst[k + 3] = '=';
+        break;
+
+      case 2:
+        a = src[i + 0] & 0xff;
+        b = src[i + 1] & 0xff;
+        dst[k + 0] = table[a >> 2];
+        dst[k + 1] = table[((a & 3) << 4) | (b >> 4)];
+        dst[k + 2] = table[(b & 0x0f) << 2];
+        dst[k + 3] = '=';
+        break;
+    }
+  }
+
+  return dlen;
+}
+
+
+static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) {
+  // We know how much we'll write, just make sure that there's space.
+  assert(dlen >= slen * 2 &&
+      "not enough space provided for hex encode");
+
+  dlen = slen * 2;
+  for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) {
+    static const char hex[] = "0123456789abcdef";
+    uint8_t val = static_cast<uint8_t>(src[i]);
+    dst[k + 0] = hex[val >> 4];
+    dst[k + 1] = hex[val & 15];
+  }
+
+  return dlen;
+}
+
+
+
+static Local<Value> Encode(const char* buf,
+                           size_t buflen,
+                           enum Encoding encoding) {
+  assert(buflen <= node::Buffer::kMaxLength);
+  if (!buflen && encoding != BUFFER)
+    return New("").ToLocalChecked();
+
+  Local<String> val;
+  switch (encoding) {
+    case BUFFER:
+      return CopyBuffer(buf, buflen).ToLocalChecked();
+
+    case ASCII:
+      if (contains_non_ascii(buf, buflen)) {
+        char* out = new char[buflen];
+        force_ascii(buf, out, buflen);
+        val = New<String>(out, buflen).ToLocalChecked();
+        delete[] out;
+      } else {
+        val = New<String>(buf, buflen).ToLocalChecked();
+      }
+      break;
+
+    case UTF8:
+      val = New<String>(buf, buflen).ToLocalChecked();
+      break;
+
+    case BINARY: {
+      // TODO(isaacs) use ExternalTwoByteString?
+      const unsigned char *cbuf = reinterpret_cast<const unsigned char*>(buf);
+      uint16_t * twobytebuf = new uint16_t[buflen];
+      for (size_t i = 0; i < buflen; i++) {
+        // XXX is the following line platform independent?
+        twobytebuf[i] = cbuf[i];
+      }
+      val = New<String>(twobytebuf, buflen).ToLocalChecked();
+      delete[] twobytebuf;
+      break;
+    }
+
+    case BASE64: {
+      size_t dlen = base64_encoded_size(buflen);
+      char* dst = new char[dlen];
+
+      size_t written = base64_encode(buf, buflen, dst, dlen);
+      assert(written == dlen);
+
+      val = New<String>(dst, dlen).ToLocalChecked();
+      delete[] dst;
+      break;
+    }
+
+    case UCS2: {
+      const uint16_t* data = reinterpret_cast<const uint16_t*>(buf);
+      val = New<String>(data, buflen / 2).ToLocalChecked();
+      break;
+    }
+
+    case HEX: {
+      size_t dlen = buflen * 2;
+      char* dst = new char[dlen];
+      size_t written = hex_encode(buf, buflen, dst, dlen);
+      assert(written == dlen);
+
+      val = New<String>(dst, dlen).ToLocalChecked();
+      delete[] dst;
+      break;
+    }
+
+    default:
+      assert(0 && "unknown encoding");
+      break;
+  }
+
+  return val;
+}
+
+#undef base64_encoded_size
+
+}  // end of namespace imp
+
+#endif  // NAN_STRING_BYTES_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_typedarray_contents.h b/legacy-libs/grpc/node_modules/nan/nan_typedarray_contents.h
new file mode 100644 (file)
index 0000000..c6ac8a4
--- /dev/null
@@ -0,0 +1,96 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_TYPEDARRAY_CONTENTS_H_
+#define NAN_TYPEDARRAY_CONTENTS_H_
+
+template<typename T>
+class TypedArrayContents {
+ public:
+  inline explicit TypedArrayContents(v8::Local<v8::Value> from) :
+      length_(0), data_(NULL) {
+    HandleScope scope;
+
+    size_t length = 0;
+    void*  data = NULL;
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+
+    if (from->IsArrayBufferView()) {
+      v8::Local<v8::ArrayBufferView> array =
+        v8::Local<v8::ArrayBufferView>::Cast(from);
+
+      const size_t    byte_length = array->ByteLength();
+      const ptrdiff_t byte_offset = array->ByteOffset();
+      v8::Local<v8::ArrayBuffer> buffer = array->Buffer();
+
+      length = byte_length / sizeof(T);
+// Actually it's 7.9 here but this would lead to ABI issues with Node.js 13
+// using 7.8 till 13.2.0.
+#if (V8_MAJOR_VERSION >= 8)
+      data = static_cast<char*>(buffer->GetBackingStore()->Data()) + byte_offset;
+#else
+      data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
+#endif
+    }
+
+#else
+
+    if (from->IsObject() && !from->IsNull()) {
+      v8::Local<v8::Object> array = v8::Local<v8::Object>::Cast(from);
+
+      MaybeLocal<v8::Value> buffer = Get(array,
+        New<v8::String>("buffer").ToLocalChecked());
+      MaybeLocal<v8::Value> byte_length = Get(array,
+        New<v8::String>("byteLength").ToLocalChecked());
+      MaybeLocal<v8::Value> byte_offset = Get(array,
+        New<v8::String>("byteOffset").ToLocalChecked());
+
+      if (!buffer.IsEmpty() &&
+          !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() &&
+          !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) {
+        data = array->GetIndexedPropertiesExternalArrayData();
+        if(data) {
+          length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T);
+        }
+      }
+    }
+
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L
+    assert(reinterpret_cast<uintptr_t>(data) % alignof (T) == 0);
+#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__)
+    assert(reinterpret_cast<uintptr_t>(data) % __alignof(T) == 0);
+#else
+    assert(reinterpret_cast<uintptr_t>(data) % sizeof (T) == 0);
+#endif
+
+    length_ = length;
+    data_   = static_cast<T*>(data);
+  }
+
+  inline size_t length() const      { return length_; }
+  inline T* operator*()             { return data_;   }
+  inline const T* operator*() const { return data_;   }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents)
+
+  //Disable heap allocation
+  void *operator new(size_t size);
+  void operator delete(void *, size_t) {
+    abort();
+  }
+
+  size_t  length_;
+  T*      data_;
+};
+
+#endif  // NAN_TYPEDARRAY_CONTENTS_H_
diff --git a/legacy-libs/grpc/node_modules/nan/nan_weak.h b/legacy-libs/grpc/node_modules/nan/nan_weak.h
new file mode 100644 (file)
index 0000000..7e7ab07
--- /dev/null
@@ -0,0 +1,437 @@
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+#ifndef NAN_WEAK_H_
+#define NAN_WEAK_H_
+
+static const int kInternalFieldsInWeakCallback = 2;
+static const int kNoInternalFieldIndex = -1;
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \
+    v8::WeakCallbackInfo<WeakCallbackInfo<T> > const&
+# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \
+    NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
+#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION
+# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \
+    v8::PhantomCallbackData<WeakCallbackInfo<T> > const&
+# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \
+    NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
+#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \
+    v8::PhantomCallbackData<WeakCallbackInfo<T> > const&
+# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \
+    v8::InternalFieldsCallbackData<WeakCallbackInfo<T>, void> const&
+# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+# define NAN_WEAK_CALLBACK_DATA_TYPE_ \
+    v8::WeakCallbackData<S, WeakCallbackInfo<T> > const&
+# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_
+#else
+# define NAN_WEAK_CALLBACK_DATA_TYPE_ void *
+# define NAN_WEAK_CALLBACK_SIG_ \
+    v8::Persistent<v8::Value>, NAN_WEAK_CALLBACK_DATA_TYPE_
+#endif
+
+template<typename T>
+class WeakCallbackInfo {
+ public:
+  typedef void (*Callback)(const WeakCallbackInfo<T>& data);
+  WeakCallbackInfo(
+      Persistent<v8::Value> *persistent
+    , Callback callback
+    , void *parameter
+    , void *field1 = 0
+    , void *field2 = 0) :
+        callback_(callback), isolate_(0), parameter_(parameter) {
+    std::memcpy(&persistent_, persistent, sizeof (v8::Persistent<v8::Value>));
+    internal_fields_[0] = field1;
+    internal_fields_[1] = field2;
+  }
+  inline v8::Isolate *GetIsolate() const { return isolate_; }
+  inline T *GetParameter() const { return static_cast<T*>(parameter_); }
+  inline void *GetInternalField(int index) const {
+    assert((index == 0 || index == 1) && "internal field index out of bounds");
+    if (index == 0) {
+      return internal_fields_[0];
+    } else {
+      return internal_fields_[1];
+    }
+  }
+
+ private:
+  NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo)
+  Callback callback_;
+  v8::Isolate *isolate_;
+  void *parameter_;
+  void *internal_fields_[kInternalFieldsInWeakCallback];
+  v8::Persistent<v8::Value> persistent_;
+  template<typename S, typename M> friend class Persistent;
+  template<typename S> friend class PersistentBase;
+#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION
+# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+  template<typename S>
+  static void invoke(NAN_WEAK_CALLBACK_SIG_ data);
+  template<typename S>
+  static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data);
+# else
+  static void invoke(NAN_WEAK_CALLBACK_SIG_ data);
+  static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data);
+# endif
+#else
+# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                     \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+  template<bool isFirstPass>
+  static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data);
+  template<bool isFirstPass>
+  static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data);
+# else
+  static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data);
+  static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data);
+# endif
+  static WeakCallbackInfo *unwrapparameter(
+      NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data);
+  static WeakCallbackInfo *unwraptwofield(
+      NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data);
+#endif
+};
+
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+
+template<typename T>
+template<bool isFirstPass>
+void
+WeakCallbackInfo<T>::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) {
+  WeakCallbackInfo<T> *cbinfo = unwrapparameter(data);
+  if (isFirstPass) {
+    cbinfo->persistent_.Reset();
+    data.SetSecondPassCallback(invokeparameter<false>);
+  } else {
+    cbinfo->callback_(*cbinfo);
+    delete cbinfo;
+  }
+}
+
+template<typename T>
+template<bool isFirstPass>
+void
+WeakCallbackInfo<T>::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) {
+  WeakCallbackInfo<T> *cbinfo = unwraptwofield(data);
+  if (isFirstPass) {
+    cbinfo->persistent_.Reset();
+    data.SetSecondPassCallback(invoketwofield<false>);
+  } else {
+    cbinfo->callback_(*cbinfo);
+    delete cbinfo;
+  }
+}
+
+template<typename T>
+WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrapparameter(
+    NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) {
+  WeakCallbackInfo<T> *cbinfo =
+      static_cast<WeakCallbackInfo<T>*>(data.GetParameter());
+  cbinfo->isolate_ = data.GetIsolate();
+  return cbinfo;
+}
+
+template<typename T>
+WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwraptwofield(
+    NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) {
+  WeakCallbackInfo<T> *cbinfo =
+      static_cast<WeakCallbackInfo<T>*>(data.GetInternalField(0));
+  cbinfo->isolate_ = data.GetIsolate();
+  return cbinfo;
+}
+
+#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_
+#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_
+#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
+# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+
+template<typename T>
+void
+WeakCallbackInfo<T>::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) {
+  WeakCallbackInfo<T> *cbinfo = unwrapparameter(data);
+  cbinfo->persistent_.Reset();
+  cbinfo->callback_(*cbinfo);
+  delete cbinfo;
+}
+
+template<typename T>
+void
+WeakCallbackInfo<T>::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) {
+  WeakCallbackInfo<T> *cbinfo = unwraptwofield(data);
+  cbinfo->persistent_.Reset();
+  cbinfo->callback_(*cbinfo);
+  delete cbinfo;
+}
+
+template<typename T>
+WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrapparameter(
+    NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) {
+  WeakCallbackInfo<T> *cbinfo =
+       static_cast<WeakCallbackInfo<T>*>(data.GetParameter());
+  cbinfo->isolate_ = data.GetIsolate();
+  return cbinfo;
+}
+
+template<typename T>
+WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwraptwofield(
+    NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) {
+  WeakCallbackInfo<T> *cbinfo =
+       static_cast<WeakCallbackInfo<T>*>(data.GetInternalField1());
+  cbinfo->isolate_ = data.GetIsolate();
+  return cbinfo;
+}
+
+#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_
+#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_
+#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
+#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+
+template<typename T>
+template<typename S>
+void WeakCallbackInfo<T>::invoke(NAN_WEAK_CALLBACK_SIG_ data) {
+  WeakCallbackInfo<T> *cbinfo = unwrap(data);
+  cbinfo->persistent_.Reset();
+  cbinfo->callback_(*cbinfo);
+  delete cbinfo;
+}
+
+template<typename T>
+template<typename S>
+WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrap(
+    NAN_WEAK_CALLBACK_DATA_TYPE_ data) {
+  void *parameter = data.GetParameter();
+  WeakCallbackInfo<T> *cbinfo =
+      static_cast<WeakCallbackInfo<T>*>(parameter);
+  cbinfo->isolate_ = data.GetIsolate();
+  return cbinfo;
+}
+
+#undef NAN_WEAK_CALLBACK_SIG_
+#undef NAN_WEAK_CALLBACK_DATA_TYPE_
+#else
+
+template<typename T>
+void WeakCallbackInfo<T>::invoke(NAN_WEAK_CALLBACK_SIG_ data) {
+  WeakCallbackInfo<T> *cbinfo = unwrap(data);
+  cbinfo->persistent_.Dispose();
+  cbinfo->persistent_.Clear();
+  cbinfo->callback_(*cbinfo);
+  delete cbinfo;
+}
+
+template<typename T>
+WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrap(
+    NAN_WEAK_CALLBACK_DATA_TYPE_ data) {
+  WeakCallbackInfo<T> *cbinfo =
+      static_cast<WeakCallbackInfo<T>*>(data);
+  cbinfo->isolate_ = v8::Isolate::GetCurrent();
+  return cbinfo;
+}
+
+#undef NAN_WEAK_CALLBACK_SIG_
+#undef NAN_WEAK_CALLBACK_DATA_TYPE_
+#endif
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
+  (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+template<typename T, typename M>
+template<typename P>
+inline void Persistent<T, M>::SetWeak(
+    P *parameter
+  , typename WeakCallbackInfo<P>::Callback callback
+  , WeakCallbackType type) {
+  WeakCallbackInfo<P> *wcbd;
+  if (type == WeakCallbackType::kParameter) {
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , parameter);
+    v8::PersistentBase<T>::SetWeak(
+        wcbd
+      , WeakCallbackInfo<P>::template invokeparameter<true>
+      , type);
+  } else {
+    v8::Local<v8::Value>* self_v(reinterpret_cast<v8::Local<v8::Value>*>(this));
+    assert((*self_v)->IsObject());
+    v8::Local<v8::Object> self((*self_v).As<v8::Object>());
+    int count = self->InternalFieldCount();
+    void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
+    for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
+      internal_fields[i] = self->GetAlignedPointerFromInternalField(i);
+    }
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , 0
+      , internal_fields[0]
+      , internal_fields[1]);
+    self->SetAlignedPointerInInternalField(0, wcbd);
+    v8::PersistentBase<T>::SetWeak(
+        static_cast<WeakCallbackInfo<P>*>(0)
+      , WeakCallbackInfo<P>::template invoketwofield<true>
+      , type);
+  }
+}
+#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION
+template<typename T, typename M>
+template<typename P>
+inline void Persistent<T, M>::SetWeak(
+    P *parameter
+  , typename WeakCallbackInfo<P>::Callback callback
+  , WeakCallbackType type) {
+  WeakCallbackInfo<P> *wcbd;
+  if (type == WeakCallbackType::kParameter) {
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , parameter);
+    v8::PersistentBase<T>::SetPhantom(
+        wcbd
+      , WeakCallbackInfo<P>::invokeparameter);
+  } else {
+    v8::Local<v8::Value>* self_v(reinterpret_cast<v8::Local<v8::Value>*>(this));
+    assert((*self_v)->IsObject());
+    v8::Local<v8::Object> self((*self_v).As<v8::Object>());
+    int count = self->InternalFieldCount();
+    void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
+    for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
+      internal_fields[i] = self->GetAlignedPointerFromInternalField(i);
+    }
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , 0
+      , internal_fields[0]
+      , internal_fields[1]);
+    self->SetAlignedPointerInInternalField(0, wcbd);
+    v8::PersistentBase<T>::SetPhantom(
+        static_cast<WeakCallbackInfo<P>*>(0)
+      , WeakCallbackInfo<P>::invoketwofield
+      , 0
+      , count > 1 ? 1 : kNoInternalFieldIndex);
+  }
+}
+#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+template<typename T, typename M>
+template<typename P>
+inline void Persistent<T, M>::SetWeak(
+    P *parameter
+  , typename WeakCallbackInfo<P>::Callback callback
+  , WeakCallbackType type) {
+  WeakCallbackInfo<P> *wcbd;
+  if (type == WeakCallbackType::kParameter) {
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , parameter);
+    v8::PersistentBase<T>::SetPhantom(
+        wcbd
+      , WeakCallbackInfo<P>::invokeparameter);
+  } else {
+    v8::Local<v8::Value>* self_v(reinterpret_cast<v8::Local<v8::Value>*>(this));
+    assert((*self_v)->IsObject());
+    v8::Local<v8::Object> self((*self_v).As<v8::Object>());
+    int count = self->InternalFieldCount();
+    void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
+    for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
+      internal_fields[i] = self->GetAlignedPointerFromInternalField(i);
+    }
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , 0
+      , internal_fields[0]
+      , internal_fields[1]);
+    self->SetAlignedPointerInInternalField(0, wcbd);
+    v8::PersistentBase<T>::SetPhantom(
+        WeakCallbackInfo<P>::invoketwofield
+      , 0
+      , count > 1 ? 1 : kNoInternalFieldIndex);
+  }
+}
+#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
+template<typename T, typename M>
+template<typename P>
+inline void Persistent<T, M>::SetWeak(
+    P *parameter
+  , typename WeakCallbackInfo<P>::Callback callback
+  , WeakCallbackType type) {
+  WeakCallbackInfo<P> *wcbd;
+  if (type == WeakCallbackType::kParameter) {
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , parameter);
+    v8::PersistentBase<T>::SetWeak(wcbd, WeakCallbackInfo<P>::invoke);
+  } else {
+    v8::Local<v8::Value>* self_v(reinterpret_cast<v8::Local<v8::Value>*>(this));
+    assert((*self_v)->IsObject());
+    v8::Local<v8::Object> self((*self_v).As<v8::Object>());
+    int count = self->InternalFieldCount();
+    void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
+    for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
+      internal_fields[i] = self->GetAlignedPointerFromInternalField(i);
+    }
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , 0
+      , internal_fields[0]
+      , internal_fields[1]);
+    v8::PersistentBase<T>::SetWeak(wcbd, WeakCallbackInfo<P>::invoke);
+  }
+}
+#else
+template<typename T>
+template<typename P>
+inline void PersistentBase<T>::SetWeak(
+    P *parameter
+  , typename WeakCallbackInfo<P>::Callback callback
+  , WeakCallbackType type) {
+  WeakCallbackInfo<P> *wcbd;
+  if (type == WeakCallbackType::kParameter) {
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , parameter);
+    persistent.MakeWeak(wcbd, WeakCallbackInfo<P>::invoke);
+  } else {
+    v8::Local<v8::Value>* self_v(reinterpret_cast<v8::Local<v8::Value>*>(this));
+    assert((*self_v)->IsObject());
+    v8::Local<v8::Object> self((*self_v).As<v8::Object>());
+    int count = self->InternalFieldCount();
+    void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
+    for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
+      internal_fields[i] = self->GetPointerFromInternalField(i);
+    }
+    wcbd = new WeakCallbackInfo<P>(
+        reinterpret_cast<Persistent<v8::Value>*>(this)
+      , callback
+      , 0
+      , internal_fields[0]
+      , internal_fields[1]);
+    persistent.MakeWeak(wcbd, WeakCallbackInfo<P>::invoke);
+  }
+}
+#endif
+
+#endif  // NAN_WEAK_H_
diff --git a/legacy-libs/grpc/node_modules/nan/package.json b/legacy-libs/grpc/node_modules/nan/package.json
new file mode 100644 (file)
index 0000000..b2939e5
--- /dev/null
@@ -0,0 +1,143 @@
+{
+  "_args": [
+    [
+      {
+        "raw": "nan@^2.13.2",
+        "scope": null,
+        "escapedName": "nan",
+        "name": "nan",
+        "rawSpec": "^2.13.2",
+        "spec": ">=2.13.2 <3.0.0",
+        "type": "range"
+      },
+      "/var/opt/motion2/node_modules/grpc"
+    ]
+  ],
+  "_from": "nan@>=2.13.2 <3.0.0",
+  "_hasShrinkwrap": false,
+  "_id": "nan@2.14.2",
+  "_inCache": true,
+  "_location": "/grpc/nan",
+  "_nodeVersion": "9.6.0",
+  "_npmOperationalInternal": {
+    "host": "s3://npm-registry-packages",
+    "tmp": "tmp/nan_2.14.2_1602593394727_0.8742800087816833"
+  },
+  "_npmUser": {
+    "name": "kkoopa",
+    "email": "bbyholm@abo.fi"
+  },
+  "_npmVersion": "5.6.0",
+  "_phantomChildren": {},
+  "_requested": {
+    "raw": "nan@^2.13.2",
+    "scope": null,
+    "escapedName": "nan",
+    "name": "nan",
+    "rawSpec": "^2.13.2",
+    "spec": ">=2.13.2 <3.0.0",
+    "type": "range"
+  },
+  "_requiredBy": [
+    "/grpc"
+  ],
+  "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
+  "_shasum": "f5376400695168f4cc694ac9393d0c9585eeea19",
+  "_shrinkwrap": null,
+  "_spec": "nan@^2.13.2",
+  "_where": "/var/opt/motion2/node_modules/grpc",
+  "bugs": {
+    "url": "https://github.com/nodejs/nan/issues"
+  },
+  "contributors": [
+    {
+      "name": "Rod Vagg",
+      "email": "r@va.gg",
+      "url": "https://github.com/rvagg"
+    },
+    {
+      "name": "Benjamin Byholm",
+      "email": "bbyholm@abo.fi",
+      "url": "https://github.com/kkoopa/"
+    },
+    {
+      "name": "Trevor Norris",
+      "email": "trev.norris@gmail.com",
+      "url": "https://github.com/trevnorris"
+    },
+    {
+      "name": "Nathan Rajlich",
+      "email": "nathan@tootallnate.net",
+      "url": "https://github.com/TooTallNate"
+    },
+    {
+      "name": "Brett Lawson",
+      "email": "brett19@gmail.com",
+      "url": "https://github.com/brett19"
+    },
+    {
+      "name": "Ben Noordhuis",
+      "email": "info@bnoordhuis.nl",
+      "url": "https://github.com/bnoordhuis"
+    },
+    {
+      "name": "David Siegel",
+      "email": "david@artcom.de",
+      "url": "https://github.com/agnat"
+    },
+    {
+      "name": "Michael Ira Krufky",
+      "email": "mkrufky@gmail.com",
+      "url": "https://github.com/mkrufky"
+    }
+  ],
+  "dependencies": {},
+  "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 14 compatibility",
+  "devDependencies": {
+    "bindings": "~1.2.1",
+    "commander": "^2.8.1",
+    "glob": "^5.0.14",
+    "node-gyp": "~3.6.2",
+    "readable-stream": "^2.1.4",
+    "request": "=2.81.0",
+    "tap": "~0.7.1",
+    "xtend": "~4.0.0"
+  },
+  "directories": {},
+  "dist": {
+    "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
+    "shasum": "f5376400695168f4cc694ac9393d0c9585eeea19",
+    "tarball": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
+    "fileCount": 46,
+    "unpackedSize": 417991,
+    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhaJzCRA9TVsSAnZWagAAqa0P/33rKLxI1mx53dz2Z6/B\nQQAJOUcgZgpIdY7LkaDGw6oTRyYoDg9uq1aOW7uL6OTJGZb/0UH3LS/gs5CK\nUk1CnYitqHSmyzOCO6tZyQmiFqYqLJf5drQn+uV9sU3bi2+u42Z03vTv5v+j\nEwRLH3TfeMbrEOgDdBuo6RB+jgaZHKyEXsvCe6NXXAaAQ8as82vtDOA1FOzq\nhB91RTYgS57lF3g/ciWg/Bvb7o2Fwep7+Ah/22Cpz9UC8fm8QGz4/lQRba3m\n504ah7HXRoF79+HqvntRKF0j8fJ8fpX3cu7wQ5UND8bj/VhhNpKZtM/tCv98\nq00KMaWYNqD+NJYKULLS658iJVjpPNr9UElb3+jNDCoX+UEvdOckuJKwo5u0\n7HRmqpE6Pb0MGfVqhHK6K3buwg+eccMcCKPiHHaiZvqa/jD0savGNx2ylMVD\niTpyl8XV+ZU9vfR1tJ3OFYzOGfXOGG5LqOut/hT0qjBLTWXL3ajPcxCNdJRH\nWSrDJ7Y3da/KkyMdX37t39Q6JkQbD2hz2nGNIr1pe36CNqx8FMOvnHG2Gwuy\nGFdcABFLpkppKhHmRebaRlQXJ416KHzxUkD+A/5DcUb7ChoJgn4j6TN7ewVb\nNOb7UllppKKHOseXgre8uJM1vVslNLVsBYzfgv58uhSTbMvo5QBuK/QHKilw\nRoBa\r\n=4oJR\r\n-----END PGP SIGNATURE-----\r\n"
+  },
+  "gitHead": "7c3fc6884666bd19b597ea58a99f51f2f4860c4e",
+  "homepage": "https://github.com/nodejs/nan#readme",
+  "license": "MIT",
+  "main": "include_dirs.js",
+  "maintainers": [
+    {
+      "name": "kkoopa",
+      "email": "bbyholm@abo.fi"
+    },
+    {
+      "name": "rvagg",
+      "email": "r@va.gg"
+    }
+  ],
+  "name": "nan",
+  "optionalDependencies": {},
+  "readme": "ERROR: No README data found!",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/nodejs/nan.git"
+  },
+  "scripts": {
+    "docs": "doc/.build.sh",
+    "rebuild-tests": "node-gyp rebuild --msvs_version=2015 --directory test",
+    "test": "tap --gc --stderr test/js/*-test.js",
+    "test:worker": "node --experimental-worker test/tap-as-worker.js --gc --stderr test/js/*-test.js"
+  },
+  "version": "2.14.2"
+}
diff --git a/legacy-libs/grpc/node_modules/nan/tools/1to2.js b/legacy-libs/grpc/node_modules/nan/tools/1to2.js
new file mode 100644 (file)
index 0000000..6af2505
--- /dev/null
@@ -0,0 +1,412 @@
+#!/usr/bin/env node
+/*********************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2018 NAN contributors
+ *
+ * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
+ ********************************************************************/
+
+var commander = require('commander'),
+    fs = require('fs'),
+    glob = require('glob'),
+    groups = [],
+    total = 0,
+    warning1 = '/* ERROR: Rewrite using Buffer */\n',
+    warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n',
+    length,
+    i;
+
+fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) {
+  if (err) {
+    throw err;
+  }
+
+  commander
+      .version(JSON.parse(data).version)
+      .usage('[options] <file ...>')
+      .parse(process.argv);
+
+  if (!process.argv.slice(2).length) {
+    commander.outputHelp();
+  }
+});
+
+/* construct strings representing regular expressions
+   each expression contains a unique group allowing for identification of the match
+   the index of this key group, relative to the regular expression in question,
+    is indicated by the first array member */
+
+/* simple substistutions, key group is the entire match, 0 */
+groups.push([0, [
+  '_NAN_',
+  'NODE_SET_METHOD',
+  'NODE_SET_PROTOTYPE_METHOD',
+  'NanAsciiString',
+  'NanEscapeScope',
+  'NanReturnValue',
+  'NanUcs2String'].join('|')]);
+
+/* substitutions of parameterless macros, key group is 1 */
+groups.push([1, ['(', [
+  'NanEscapableScope',
+  'NanReturnNull',
+  'NanReturnUndefined',
+  'NanScope'].join('|'), ')\\(\\)'].join('')]);
+
+/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */
+groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']);
+
+/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */ 
+groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]);
+
+/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */
+groups.push([2, ['(', warning2, ')?', '^.*?(', [
+      'GetIndexedPropertiesExternalArrayDataLength',
+      'GetIndexedPropertiesExternalArrayData',
+      'GetIndexedPropertiesExternalArrayDataType',
+      'GetIndexedPropertiesPixelData',
+      'GetIndexedPropertiesPixelDataLength',
+      'HasIndexedPropertiesInExternalArrayData',
+      'HasIndexedPropertiesInPixelData',
+      'SetIndexedPropertiesToExternalArrayData',
+      'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]);
+
+/* No need for NanScope in V8-exposed methods, key group 2 */
+groups.push([2, ['((', [
+      'NAN_METHOD',
+      'NAN_GETTER',
+      'NAN_SETTER',
+      'NAN_PROPERTY_GETTER',
+      'NAN_PROPERTY_SETTER',
+      'NAN_PROPERTY_ENUMERATOR',
+      'NAN_PROPERTY_DELETER',
+      'NAN_PROPERTY_QUERY',
+      'NAN_INDEX_GETTER',
+      'NAN_INDEX_SETTER',
+      'NAN_INDEX_ENUMERATOR',
+      'NAN_INDEX_DELETER',
+      'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]);
+
+/* v8::Value::ToXXXXXXX returns v8::MaybeLocal<T>, key group 3 */
+groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [
+      'Boolean',
+      'Number',
+      'String',
+      'Object',
+      'Integer',
+      'Uint32',
+      'Int32'].join('|'), ')\\('].join('')]);
+
+/* v8::Value::XXXXXXXValue returns v8::Maybe<T>, key group 3 */
+groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [
+      'Boolean',
+      'Number',
+      'Integer',
+      'Uint32',
+      'Int32'].join('|'), ')Value)\\('].join('')]);
+
+/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */
+groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']);
+
+/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */
+groups.push([1, ['(', [
+  'NanDisposePersistent',
+  'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]);
+
+/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */
+groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']);
+
+/* Many methods of v8::Object and others now return v8::MaybeLocal<T>, key group 3 */
+groups.push([3, ['([\\s])([^\\s]+)->(', [
+  'GetEndColumn',
+  'GetFunction',
+  'GetLineNumber',
+  'NewInstance',
+  'GetPropertyNames',
+  'GetOwnPropertyNames',
+  'GetSourceLine',
+  'GetStartColumn',
+  'ObjectProtoToString',
+  'ToArrayIndex',
+  'ToDetailString',
+  'CallAsConstructor',
+  'CallAsFunction',
+  'CloneElementAt',
+  'Delete',
+  'ForceSet',
+  'Get',
+  'GetPropertyAttributes',
+  'GetRealNamedProperty',
+  'GetRealNamedPropertyInPrototypeChain',
+  'Has',
+  'HasOwnProperty',
+  'HasRealIndexedProperty',
+  'HasRealNamedCallbackProperty',
+  'HasRealNamedProperty',
+  'Set',
+  'SetAccessor',
+  'SetIndexedPropertyHandler',
+  'SetNamedPropertyHandler',
+  'SetPrototype'].join('|'), ')\\('].join('')]);
+
+/* You should get an error if any of these fail anyways,
+   or handle the error better, it is indicated either way, key group 2 */
+groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]);
+
+/* v8::Value::Equals now returns a v8::Maybe, key group 3 */
+groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']);
+
+/* NanPersistent makes this unnecessary, key group 1 */
+groups.push([1, '(NanAssignPersistent)(?:<v8\\:\\:[^>]+>)?\\(([^,]+),\\s*']);
+
+/* args has been renamed to info, key group 2 */
+groups.push([2, '(\\W)(args)(\\W)'])
+
+/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */
+groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']);
+
+/* v8::Persistent was replaced with NanPersistent, key group 2 */
+groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']);
+
+/* counts the number of capturing groups in a well-formed regular expression,
+   ignoring non-capturing groups and escaped parentheses */
+function groupcount(s) {
+  var positive = s.match(/\((?!\?)/g),
+      negative = s.match(/\\\(/g);
+  return (positive ? positive.length : 0) - (negative ? negative.length : 0);
+}
+
+/* compute the absolute position of each key group in the joined master RegExp */
+for (i = 1, length = groups.length; i < length; i++) {
+       total += groupcount(groups[i - 1][1]);
+       groups[i][0] += total;
+}
+
+/* create the master RegExp, whis is the union of all the groups' expressions */
+master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm');
+
+/* replacement function for String.replace, receives 21 arguments */
+function replace() {
+       /* simple expressions */
+      switch (arguments[groups[0][0]]) {
+        case '_NAN_':
+          return 'NAN_';
+        case 'NODE_SET_METHOD':
+          return 'NanSetMethod';
+        case 'NODE_SET_PROTOTYPE_METHOD':
+          return 'NanSetPrototypeMethod';
+        case 'NanAsciiString':
+          return 'NanUtf8String';
+        case 'NanEscapeScope':
+          return 'scope.Escape';
+        case 'NanReturnNull':
+          return 'info.GetReturnValue().SetNull';
+        case 'NanReturnValue':
+          return 'info.GetReturnValue().Set';
+        case 'NanUcs2String':
+          return 'v8::String::Value';
+        default:
+      }
+
+      /* macros without arguments */
+      switch (arguments[groups[1][0]]) {
+        case 'NanEscapableScope':
+          return 'NanEscapableScope scope'
+        case 'NanReturnUndefined':
+          return 'return';
+        case 'NanScope':
+          return 'NanScope scope';
+        default:
+      }
+
+      /* TryCatch, emulate negative backref */
+      if (arguments[groups[2][0]] === 'TryCatch') {
+        return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch';
+      }
+
+      /* NanNew("foo") --> NanNew("foo").ToLocalChecked() */
+      if (arguments[groups[3][0]] === 'NanNew') {
+        return [arguments[0], '.ToLocalChecked()'].join('');
+      }
+
+      /* insert warning for removed functions as comment on new line above */
+      switch (arguments[groups[4][0]]) {
+        case 'GetIndexedPropertiesExternalArrayData':
+        case 'GetIndexedPropertiesExternalArrayDataLength':
+        case 'GetIndexedPropertiesExternalArrayDataType':
+        case 'GetIndexedPropertiesPixelData':
+        case 'GetIndexedPropertiesPixelDataLength':
+        case 'HasIndexedPropertiesInExternalArrayData':
+        case 'HasIndexedPropertiesInPixelData':
+        case 'SetIndexedPropertiesToExternalArrayData':
+        case 'SetIndexedPropertiesToPixelData':
+          return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join('');
+        default:
+      }
+
+     /* remove unnecessary NanScope() */
+      switch (arguments[groups[5][0]]) {
+        case 'NAN_GETTER':
+        case 'NAN_METHOD':
+        case 'NAN_SETTER':
+        case 'NAN_INDEX_DELETER':
+        case 'NAN_INDEX_ENUMERATOR':
+        case 'NAN_INDEX_GETTER':
+        case 'NAN_INDEX_QUERY':
+        case 'NAN_INDEX_SETTER':
+        case 'NAN_PROPERTY_DELETER':
+        case 'NAN_PROPERTY_ENUMERATOR':
+        case 'NAN_PROPERTY_GETTER':
+        case 'NAN_PROPERTY_QUERY':
+        case 'NAN_PROPERTY_SETTER':
+          return arguments[groups[5][0] - 1];
+        default:
+      }
+
+      /* Value conversion */
+      switch (arguments[groups[6][0]]) {
+        case 'Boolean':
+        case 'Int32':
+        case 'Integer':
+        case 'Number':
+        case 'Object':
+        case 'String':
+        case 'Uint32':
+          return [arguments[groups[6][0] - 2], 'NanTo<v8::', arguments[groups[6][0]], '>(',  arguments[groups[6][0] - 1]].join('');
+        default:
+      }
+
+      /* other value conversion */
+      switch (arguments[groups[7][0]]) {
+        case 'BooleanValue':
+          return [arguments[groups[7][0] - 2], 'NanTo<bool>(', arguments[groups[7][0] - 1]].join('');
+        case 'Int32Value':
+          return [arguments[groups[7][0] - 2], 'NanTo<int32_t>(', arguments[groups[7][0] - 1]].join('');
+        case 'IntegerValue':
+          return [arguments[groups[7][0] - 2], 'NanTo<int64_t>(', arguments[groups[7][0] - 1]].join('');
+        case 'Uint32Value':
+          return [arguments[groups[7][0] - 2], 'NanTo<uint32_t>(', arguments[groups[7][0] - 1]].join('');
+        default:
+      }
+
+      /* NAN_WEAK_CALLBACK */
+      if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') {
+        return ['template<typename T>\nvoid ',
+          arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo<T> &data)'].join('');
+      }
+
+      /* use methods on NAN classes instead */
+      switch (arguments[groups[9][0]]) {
+        case 'NanDisposePersistent':
+          return [arguments[groups[9][0] + 1], '.Reset('].join('');
+        case 'NanObjectWrapHandle':
+          return [arguments[groups[9][0] + 1], '->handle('].join('');
+        default:
+      }
+
+      /* use method on NanPersistent instead */
+      if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') {
+        return arguments[groups[10][0] + 1] + '.SetWeak(';
+      }
+
+      /* These return Maybes, the upper ones take no arguments */
+      switch (arguments[groups[11][0]]) {
+        case 'GetEndColumn':
+        case 'GetFunction':
+        case 'GetLineNumber':
+        case 'GetOwnPropertyNames':
+        case 'GetPropertyNames':
+        case 'GetSourceLine':
+        case 'GetStartColumn':
+        case 'NewInstance':
+        case 'ObjectProtoToString':
+        case 'ToArrayIndex':
+        case 'ToDetailString':
+          return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join('');
+        case 'CallAsConstructor':
+        case 'CallAsFunction':
+        case 'CloneElementAt':
+        case 'Delete':
+        case 'ForceSet':
+        case 'Get':
+        case 'GetPropertyAttributes':
+        case 'GetRealNamedProperty':
+        case 'GetRealNamedPropertyInPrototypeChain':
+        case 'Has':
+        case 'HasOwnProperty':
+        case 'HasRealIndexedProperty':
+        case 'HasRealNamedCallbackProperty':
+        case 'HasRealNamedProperty':
+        case 'Set':
+        case 'SetAccessor':
+        case 'SetIndexedPropertyHandler':
+        case 'SetNamedPropertyHandler':
+        case 'SetPrototype':
+          return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join('');
+        default:
+      }
+
+      /* Automatic ToLocalChecked(), take it or leave it */
+      switch (arguments[groups[12][0]]) {
+        case 'Date':
+        case 'String':
+        case 'RegExp':
+          return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join('');
+        default:
+      }
+
+      /* NanEquals is now required for uniformity */
+      if (arguments[groups[13][0]] === 'Equals') {
+        return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join('');
+      }
+
+      /* use method on replacement class instead */
+      if (arguments[groups[14][0]] === 'NanAssignPersistent') {
+        return [arguments[groups[14][0] + 1], '.Reset('].join('');
+      }
+
+      /* args --> info */
+      if (arguments[groups[15][0]] === 'args') {
+        return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join('');
+      }
+
+      /* ObjectWrap --> NanObjectWrap */
+      if (arguments[groups[16][0]] === 'ObjectWrap') {
+        return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join('');
+      }
+
+      /* Persistent --> NanPersistent */
+      if (arguments[groups[17][0]] === 'Persistent') {
+        return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join('');
+      }
+
+      /* This should not happen. A switch is probably missing a case if it does. */
+      throw 'Unhandled match: ' + arguments[0];
+}
+
+/* reads a file, runs replacement and writes it back */
+function processFile(file) {
+  fs.readFile(file, {encoding: 'utf8'}, function (err, data) {
+    if (err) {
+      throw err;
+    }
+
+    /* run replacement twice, might need more runs */
+    fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) {
+      if (err) {
+        throw err;
+      }
+    });
+  });
+}
+
+/* process file names from command line and process the identified files */
+for (i = 2, length = process.argv.length; i < length; i++) {
+  glob(process.argv[i], function (err, matches) {
+    if (err) {
+      throw err;
+    }
+    matches.forEach(processFile);
+  });
+}
diff --git a/legacy-libs/grpc/node_modules/nan/tools/README.md b/legacy-libs/grpc/node_modules/nan/tools/README.md
new file mode 100644 (file)
index 0000000..7f07e4b
--- /dev/null
@@ -0,0 +1,14 @@
+1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions,
+false positives and missed opportunities. The input files are rewritten in place. Make sure that
+you have backups. You will have to manually review the changes afterwards and do some touchups.
+
+```sh
+$ tools/1to2.js
+
+  Usage: 1to2 [options] <file ...>
+
+  Options:
+
+    -h, --help     output usage information
+    -V, --version  output the version number
+```
diff --git a/legacy-libs/grpc/node_modules/nan/tools/package.json b/legacy-libs/grpc/node_modules/nan/tools/package.json
new file mode 100644 (file)
index 0000000..2dcdd78
--- /dev/null
@@ -0,0 +1,19 @@
+{
+  "name": "1to2",
+  "version": "1.0.0",
+  "description": "NAN 1 -> 2 Migration Script",
+  "main": "1to2.js",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/nodejs/nan.git"
+  },
+  "contributors": [
+    "Benjamin Byholm <bbyholm@abo.fi> (https://github.com/kkoopa/)",
+    "Mathias Küsel (https://github.com/mathiask88/)"
+  ],
+  "dependencies": {
+    "glob": "~5.0.10",
+    "commander": "~2.8.1"
+  },
+  "license": "MIT"
+}
diff --git a/legacy-libs/grpc/node_modules/needle/README.md b/legacy-libs/grpc/node_modules/needle/README.md
deleted file mode 100644 (file)
index 149bacc..0000000
+++ /dev/null
@@ -1,593 +0,0 @@
-Needle
-======
-
-[![NPM](https://nodei.co/npm/needle.png)](https://nodei.co/npm/needle/)
-
-The leanest and most handsome HTTP client in the Nodelands.
-
-```js
-var needle = require('needle');
-
-needle.get('http://www.google.com', function(error, response) {
-  if (!error && response.statusCode == 200)
-    console.log(response.body);
-});
-```
-
-Callbacks not floating your boat? Needle got your back.
-
-``` js
-var data = {
-  file: '/home/johnlennon/walrus.png',
-  content_type: 'image/png'
-};
-
-// the callback is optional, and needle returns a `readableStream` object
-// that triggers a 'done' event when the request/response process is complete.
-needle
-  .post('https://my.server.com/foo', data, { multipart: true })
-  .on('readable', function() { /* eat your chunks */ })
-  .on('done', function(err, resp) {
-    console.log('Ready-o!');
-  })
-```
-
-From version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object.
-
-```js
-needle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true })
-  .then(function(response) {
-    return doSomethingWith(response)
-  })
-  .catch(function(err) {
-    console.log('Call the locksmith!')
-  })
-```
-
-With only two real dependencies, Needle supports:
-
- - HTTP/HTTPS requests, with the usual verbs you would expect
- - All of Node's native TLS options, such as 'rejectUnauthorized' (see below)
- - Basic & Digest authentication with auto-detection
- - Multipart form-data (e.g. file uploads)
- - HTTP Proxy forwarding, optionally with authentication
- - Streaming gzip or deflate decompression
- - Automatic XML & JSON parsing
- - 301/302/303 redirect following, with fine-grained tuning, and
- - Streaming non-UTF-8 charset decoding, via `iconv-lite`
-
-And yes, Mr. Wayne, it does come in black.
-
-This makes Needle an ideal alternative for performing quick HTTP requests in Node, either for API interaction, downloading or uploading streams of data, and so on. If you need OAuth, AWS support or anything fancier, you should check out mikeal's request module.
-
-Install
--------
-
-```
-$ npm install needle
-```
-
-Usage
------
-
-```js
-// using promises
-needle('get', 'https://server.com/posts/12')
-  .then(function(resp) {
-    // ...
-  })
-  .catch(function(err) {
-    // ...
-  });
-
-// with callback
-needle.get('ifconfig.me/all.json', function(error, response, body) {
-  if (error) throw error;
-
-  // body is an alias for `response.body`,
-  // that in this case holds a JSON-decoded object.
-  console.log(body.ip_addr);
-});
-
-// no callback, using streams
-var out = fs.createWriteStream('logo.png');
-needle.get('https://google.com/images/logo.png').pipe(out).on('finish', function() {
-  console.log('Pipe finished!');
-});
-```
-
-As you can see, you can use Needle with Promises or without them. When using Promises or when a callback is passed, the response's body will be buffered and written to `response.body`, and the callback will be fired when all of the data has been collected and processed (e.g. decompressed, decoded and/or parsed).
-
-When no callback is passed, however, the buffering logic will be skipped but the response stream will still go through Needle's processing pipeline, so you get all the benefits of post-processing while keeping the streamishness we all love from Node.
-
-Response pipeline
------------------
-
-Depending on the response's Content-Type, Needle will either attempt to parse JSON or XML streams, or, if a text response was received, will ensure that the final encoding you get is UTF-8.
-
-You can also request a gzip/deflated response, which, if sent by the server, will be processed before parsing or decoding is performed.
-
-```js
-needle.get('http://stackoverflow.com/feeds', { compressed: true }, function(err, resp) {
-  console.log(resp.body); // this little guy won't be a Gzipped binary blob
-                          // but a nice object containing all the latest entries
-});
-```
-
-Or in anti-callback mode, using a few other options:
-
-```js
-var options = {
-  compressed         : true, // sets 'Accept-Encoding' to 'gzip,deflate'
-  follow_max         : 5,    // follow up to five redirects
-  rejectUnauthorized : true  // verify SSL certificate
-}
-
-var stream = needle.get('https://backend.server.com/everything.html', options);
-
-// read the chunks from the 'readable' event, so the stream gets consumed.
-stream.on('readable', function() {
-  while (data = this.read()) {
-    console.log(data.toString());
-  }
-})
-
-stream.on('done', function(err) {
-  // if our request had an error, our 'done' event will tell us.
-  if (!err) console.log('Great success!');
-})
-```
-
-API
----
-
-### needle(method, url[, data][, options][, callback]) `(> 2.0.x)`
-
-Calling `needle()` directly returns a Promise. Besides `method` and `url`, all parameters are optional, although when sending a `post`, `put` or `patch` request you will get an error if `data` is not present.
-
-```js
-needle('get', 'http://some.url.com')
-  .then(function(resp) { console.log(resp.body) })
-  .catch(function(err) { console.error(err) })
-})
-```
-
-Except from the above, all of Needle's request methods return a Readable stream, and both `options` and `callback` are optional. If passed, the callback will return three arguments: `error`, `response` and `body`, which is basically an alias for `response.body`.
-
-### needle.head(url[, options][, callback])
-
-```js
-needle.head('https://my.backend.server.com', {
-  open_timeout: 5000 // if we're not able to open a connection in 5 seconds, boom.
-}, function(err, resp) {
-  if (err)
-    console.log('Shoot! Something is wrong: ' + err.message)
-  else
-    console.log('Yup, still alive.')
-})
-```
-
-### needle.get(url[, options][, callback])
-
-```js
-needle.get('google.com/search?q=syd+barrett', function(err, resp) {
-  // if no http:// is found, Needle will automagically prepend it.
-});
-```
-
-### needle.post(url, data[, options][, callback])
-
-```js
-var options = {
-  headers: { 'X-Custom-Header': 'Bumbaway atuna' }
-}
-
-needle.post('https://my.app.com/endpoint', 'foo=bar', options, function(err, resp) {
-  // you can pass params as a string or as an object.
-});
-```
-
-### needle.put(url, data[, options][, callback])
-
-```js
-var nested = {
-  params: {
-    are: {
-      also: 'supported'
-    }
-  }
-}
-
-needle.put('https://api.app.com/v2', nested, function(err, resp) {
-  console.log('Got ' + resp.bytes + ' bytes.') // another nice treat from this handsome fella.
-});
-```
-
-### needle.patch(url, data[, options][, callback])
-
-Same behaviour as PUT.
-
-### needle.delete(url, data[, options][, callback])
-
-```js
-var options = {
-  username: 'fidelio',
-  password: 'x'
-}
-
-needle.delete('https://api.app.com/messages/123', null, options, function(err, resp) {
-  // in this case, data may be null, but you need to explicity pass it.
-});
-```
-
-### needle.request(method, url, data[, options][, callback])
-
-Generic request. This not only allows for flexibility, but also lets you perform a GET request with data, in which case will be appended to the request as a query string, unless you pass a `json: true` option (read below).
-
-```js
-var params = {
-  q    : 'a very smart query',
-  page : 2
-}
-
-needle.request('get', 'forum.com/search', params, function(err, resp) {
-  if (!err && resp.statusCode == 200)
-    console.log(resp.body); // here you go, mister.
-});
-```
-
-Now, if you set pass `json: true` among the options, Needle won't set your params as a querystring but instead send a JSON representation of your data through the request's body, as well as set the `Content-Type` and `Accept` headers to `application/json`.
-
-```js
-needle.request('get', 'forum.com/search', params, { json: true }, function(err, resp) {
-  if (resp.statusCode == 200) console.log('It worked!');
-});
-```
-
-Events
-------
-
-The [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) object returned by the above request methods emits the following events, in addition to the regular ones (e.g. `end`, `close`, `data`, `pipe`, `readable`).
-
-### Event: `'response'`
-
- - `response <http.IncomingMessage>`
-
-Emitted when the underlying [http.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest) emits a response event. This is after the connection is established and the header received, but before any of it is processed (e.g. authorization required or redirect to be followed). No data has been consumed at this point.
-
-### Event: `'redirect'`
-
- - `location <String>`
-
-Indicates that the a redirect is being followed. This means that the response code was a redirect (`301`, `302`, `303`, `307`) and the given [redirect options](#redirect-options) allowed following the URL received in the `Location` header.
-
-### Event: `'header'`
-
- - `statusCode <Integer>`
- - `headers <Object>`
-
-Triggered after the header has been processed, and just before the data is to be consumed. This implies that no redirect was followed and/or authentication header was received. In other words, we got a "valid" response.
-
-### Event: `'done'` (previously 'end')
-
- - `exception <Error>` (optional)
-
-Emitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. Unlike a regular stream's `end` event, Needle's `done` will be fired either on success or on failure, which is why the first argument may be an Error object. In other words:
-
-```js
-var resp = needle.get('something.worthy/of/being/streamed/by/needle');
-resp.pipe(someWritableStream);
-
-resp.on('done', function(err) {
-  if (err) console.log('An error ocurred: ' + err.message);
-  else console.log('Great success!');
-})
-```
-
-### Event: `'err'`
-
- - `exception <Error>`
-
-Emitted when an error ocurrs. This should only happen once in the lifecycle of a Needle request.
-
-### Event: `'timeout'`
-
- - `type <String>`
-
-Emitted when an timeout error occurs. Type can be either 'open', 'response', or 'read'. This will called right before aborting the request, which will also trigger an `err` event, a described above, with an `ECONNRESET` (Socket hang up) exception.
-
-Request options
----------------
-
-For information about options that've changed, there's always [the changelog](https://github.com/tomas/needle/releases).
-
- - `agent`       : Uses an [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) of your choice, instead of the global, default one. Useful for tweaking the behaviour at the connection level, such as when doing tunneling (see below for an example).
- - `json`        : When `true`, sets content type to `application/json` and sends request body as JSON string, instead of a query string.
- - `open_timeout`: (or `timeout`) Returns error if connection takes longer than X milisecs to establish. Defaults to `10000` (10 secs). `0` means no timeout.
- - `response_timeout`: Returns error if no response headers are received in X milisecs, counting from when the connection is opened. Defaults to `0` (no response timeout).
- - `read_timeout`: Returns error if data transfer takes longer than X milisecs, once response headers are received. Defaults to `0` (no timeout).
- - `follow_max`  : (or `follow`) Number of redirects to follow. Defaults to `0`. See below for more redirect options.
- - `multipart`   : Enables multipart/form-data encoding. Defaults to `false`. Use it when uploading files.
- - `proxy`       : Forwards request through HTTP(s) proxy. Eg. `proxy: 'http://user:pass@proxy.server.com:3128'`. For more advanced proxying/tunneling use a custom `agent`, as described below.
- - `headers`     : Object containing custom HTTP headers for request. Overrides defaults described below.
- - `auth`        : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers.
- - `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads.
- - `localAddress`     : <string>, IP address. Passed to http/https request. Local interface from witch the request should be emitted.
-
-Response options
-----------------
-
- - `decode_response` : (or `decode`) Whether to decode the text responses to UTF-8, if Content-Type header shows a different charset. Defaults to `true`.
- - `parse_response`  : (or `parse`) Whether to parse XML or JSON response bodies automagically. Defaults to `true`. You can also set this to 'xml' or 'json' in which case Needle will *only* parse the response if the content type matches.
- - `output`          : Dump response output to file. This occurs after parsing and charset decoding is done.
- - `parse_cookies`   : Whether to parse response’s `Set-Cookie` header. Defaults to `true`. If parsed, response cookies will be available at `resp.cookies`.
-
-HTTP Header options
--------------------
-
-These are basically shortcuts to the `headers` option described above.
-
- - `cookies`   : Builds and sets a Cookie header from a `{ key: 'value' }` object.
- - `compressed`: If `true`, sets 'Accept-Encoding' header to 'gzip,deflate', and inflates content if zipped. Defaults to `false`.
- - `username`  : For HTTP basic auth.
- - `password`  : For HTTP basic auth. Requires username to be passed, but is optional.
- - `accept`    : Sets 'Accept' HTTP header. Defaults to `*/*`.
- - `connection`: Sets 'Connection' HTTP header. Not set by default, unless running Node < 0.11.4 in which case it defaults to `close`. More info about this below.
- - `user_agent`: Sets the 'User-Agent' HTTP header. Defaults to `Needle/{version} (Node.js {node_version})`.
- - `content_type`: Sets the 'Content-Type' header. Unset by default, unless you're sending data in which case it's set accordingly to whatever is being sent (`application/x-www-form-urlencoded`, `application/json` or `multipart/form-data`). That is, of course, unless the option is passed, either here or through `options.headers`. You're the boss.
-
-Node.js TLS Options
--------------------
-
-These options are passed directly to `https.request` if present. Taken from the [original documentation](http://nodejs.org/docs/latest/api/https.html):
-
- - `pfx`                : Certificate, Private key and CA certificates to use for SSL.
- - `key`                : Private key to use for SSL.
- - `passphrase`         : A string of passphrase for the private key or pfx.
- - `cert`               : Public x509 certificate to use.
- - `ca`                 : An authority certificate or array of authority certificates to check the remote host against.
- - `ciphers`            : A string describing the ciphers to use or exclude.
- - `rejectUnauthorized` : If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent.
- - `secureProtocol`     : The SSL method to use, e.g. SSLv3_method to force SSL version 3.
-
-Redirect options
-----------------
-
-These options only apply if the `follow_max` (or `follow`) option is higher than 0.
-
- - `follow_set_cookies`      : Sends the cookies received in the `set-cookie` header as part of the following request. `false` by default.
- - `follow_set_referer`      : Sets the 'Referer' header to the requested URI when following a redirect. `false` by default.
- - `follow_keep_method`      : If enabled, resends the request using the original verb instead of being rewritten to `get` with no data. `false` by default.
- - `follow_if_same_host`     : When true, Needle will only follow redirects that point to the same host as the original request. `false` by default.
- - `follow_if_same_protocol` : When true, Needle will only follow redirects that point to the same protocol as the original request. `false` by default.
-
-Overriding Defaults
--------------------
-
-Yes sir, we have it. Needle includes a `defaults()` method, that lets you override some of the defaults for all future requests. Like this:
-
-```js
-needle.defaults({
-  open_timeout: 60000,
-  user_agent: 'MyApp/1.2.3',
-  parse_response: false });
-```
-
-This will override Needle's default user agent and 10-second timeout, and disable response parsing, so you don't need to pass those options in every other request.
-
-More advanced Proxy support
----------------------------
-
-Since you can pass a custom HTTPAgent to Needle you can do all sorts of neat stuff. For example, if you want to use the [`tunnel`](https://github.com/koichik/node-tunnel) module for HTTPS proxying, you can do this:
-
-```js
-var tunnel = require('tunnel');
-var myAgent = tunnel.httpOverHttp({
-  proxy: { host: 'localhost' }
-});
-
-needle.get('foobar.com', { agent: myAgent });
-```
-
-Regarding the 'Connection' header
----------------------------------
-
-Unless you're running an old version of Node (< 0.11.4), by default Needle won't set the Connection header on requests, yielding Node's default behaviour of keeping the connection alive with the target server. This speeds up inmensely the process of sending several requests to the same host.
-
-On older versions, however, this has the unwanted behaviour of preventing the runtime from exiting, either because of a bug or 'feature' that was changed on 0.11.4. To overcome this Needle does set the 'Connection' header to 'close' on those versions, however this also means that making new requests to the same host doesn't benefit from Keep-Alive.
-
-So if you're stuck on 0.10 or even lower and want full speed, you can simply set the Connection header to 'Keep-Alive' by using `{ connection: 'Keep-Alive' }`. Please note, though, that an event loop handler will prevent the runtime from exiting so you'll need to manually call `process.exit()` or the universe will collapse.
-
-Examples Galore
----------------
-
-### HTTPS GET with Basic Auth
-
-```js
-needle.get('https://api.server.com', { username: 'you', password: 'secret' },
-  function(err, resp) {
-    // used HTTP auth
-});
-```
-
-Or use [RFC-1738](http://tools.ietf.org/html/rfc1738#section-3.1) basic auth URL syntax:
-
-```js
-needle.get('https://username:password@api.server.com', function(err, resp) {
-    // used HTTP auth from URL
-});
-```
-
-### Digest Auth
-
-```js
-needle.get('other.server.com', { username: 'you', password: 'secret', auth: 'digest' },
-  function(err, resp, body) {
-    // needle prepends 'http://' to your URL, if missing
-});
-```
-
-### Custom Accept header, deflate
-
-```js
-var options = {
-  compressed : true,
-  follow     : 10,
-  accept     : 'application/vnd.github.full+json'
-}
-
-needle.get('api.github.com/users/tomas', options, function(err, resp, body) {
-  // body will contain a JSON.parse(d) object
-  // if parsing fails, you'll simply get the original body
-});
-```
-
-### GET XML object
-
-```js
-needle.get('https://news.ycombinator.com/rss', function(err, resp, body) {
-  // you'll get a nice object containing the nodes in the RSS
-});
-```
-
-### GET binary, output to file
-
-```js
-needle.get('http://upload.server.com/tux.png', { output: '/tmp/tux.png' }, function(err, resp, body) {
-  // you can dump any response to a file, not only binaries.
-});
-```
-
-### GET through proxy
-
-```js
-needle.get('http://search.npmjs.org', { proxy: 'http://localhost:1234' }, function(err, resp, body) {
-  // request passed through proxy
-});
-```
-
-### GET a very large document in a stream (from 0.7+)
-
-```js
-var stream = needle.get('http://www.as35662.net/100.log');
-
-stream.on('readable', function() {
-  var chunk;
-  while (chunk = this.read()) {
-    console.log('got data: ', chunk);
-  }
-});
-```
-
-### GET JSON object in a stream (from 0.7+)
-
-```js
-var stream = needle.get('http://jsonplaceholder.typicode.com/db', { parse: true });
-
-stream.on('readable', function() {
-  var node;
-
-  // our stream will only emit a single JSON root node.
-  while (node = this.read()) {
-    console.log('got data: ', node);
-  }
-});
-```
-
-### GET JSONStream flexible parser with search query (from 0.7+)
-
-```js
-
- // The 'data' element of this stream will be the string representation
- // of the titles of all posts.
-
-needle.get('http://jsonplaceholder.typicode.com/db', { parse: true })
-      .pipe(new JSONStream.parse('posts.*.title'));
-      .on('data', function (obj) {
-        console.log('got post title: %s', obj);
-      });
-```
-
-### File upload using multipart, passing file path
-
-```js
-var data = {
-  foo: 'bar',
-  image: { file: '/home/tomas/linux.png', content_type: 'image/png' }
-}
-
-needle.post('http://my.other.app.com', data, { multipart: true }, function(err, resp, body) {
-  // needle will read the file and include it in the form-data as binary
-});
-```
-
-### Stream upload, PUT or POST
-
-``` js
-needle.put('https://api.app.com/v2', fs.createReadStream('myfile.txt'), function(err, resp, body) {
-  // stream content is uploaded verbatim
-});
-```
-
-### Multipart POST, passing data buffer
-
-```js
-var buffer = fs.readFileSync('/path/to/package.zip');
-
-var data = {
-  zip_file: {
-    buffer       : buffer,
-    filename     : 'mypackage.zip',
-    content_type : 'application/octet-stream'
-  }
-}
-
-needle.post('http://somewhere.com/over/the/rainbow', data, { multipart: true }, function(err, resp, body) {
-  // if you see, when using buffers we need to pass the filename for the multipart body.
-  // you can also pass a filename when using the file path method, in case you want to override
-  // the default filename to be received on the other end.
-});
-```
-
-### Multipart with custom Content-Type
-
-```js
-var data = {
-  token: 'verysecret',
-  payload: {
-    value: JSON.stringify({ title: 'test', version: 1 }),
-    content_type: 'application/json'
-  }
-}
-
-needle.post('http://test.com/', data, { timeout: 5000, multipart: true }, function(err, resp, body) {
-  // in this case, if the request takes more than 5 seconds
-  // the callback will return a [Socket closed] error
-});
-```
-
-For even more examples, check out the examples directory in the repo.
-
-### Testing
-
-To run tests, you need to generate a self-signed SSL certificate in the `test` directory. After cloning the repository, run the following commands:
-
-    $ mkdir -p test/keys
-    $ openssl genrsa -out test/keys/ssl.key 2048
-    $ openssl req -new -key test/keys/ssl.key -x509 -days 999 -out test/keys/ssl.cert
-
-Then you should be able to run `npm test` once you have the dependencies in place.
-
-> Note: Tests currently only work on linux-based environments that have `/proc/self/fd`. They *do not* work on MacOS environments.
-> You can use Docker to run tests by creating a container and mounting the needle project directory on `/app`
-> `docker create --name Needle -v /app -w /app -v /app/node_modules -i node:argon`
-
-Credits
--------
-
-Written by Tomás Pollak, with the help of contributors.
-
-Copyright
----------
-
-(c) Fork Ltd. Licensed under the MIT license.
diff --git a/legacy-libs/grpc/node_modules/needle/bin/needle b/legacy-libs/grpc/node_modules/needle/bin/needle
deleted file mode 100644 (file)
index baaa79b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env node
-var needle = require('./../lib/needle');
-
-function exit(code, str) {
-  console.log(str) || process.exit(code);
-}
-
-function usage() {
-  var out = ['Usage: needle [get|head|post|put|delete] url [query]'];
-  out.push('Examples: \n needle get google.com\n needle post server.com/api foo=bar');
-  exit(1, out.join('\n'))
-}
-
-if (process.argv[2] == '-v' || process.argv[2] == '--version')
-  exit(0, needle.version);
-else if (process.argv[2] == null)
-  usage();
-
-var method   = process.argv[2],
-    url      = process.argv[3],
-    options  = { compressed: true, parse_response: true, follow_max: 5, timeout: 10000 };
-
-if (!needle[method]) {
-  url    = method;
-  method = 'get';
-}
-
-var callback = function(err, resp) {
-  if (err) return exit(1, "Error: " + err.message);
-
-  if (process.argv.indexOf('-i') != -1)
-    console.log(resp.headers) || console.log('');
-
-  console.log(resp.body.toString());
-};
-
-if (method == 'post' || method == 'put')
-  needle[method](url, process.argv[4], options, callback);
-else
-  needle[method](url, options, callback);
diff --git a/legacy-libs/grpc/node_modules/needle/examples/deflated-stream.js b/legacy-libs/grpc/node_modules/needle/examples/deflated-stream.js
deleted file mode 100644 (file)
index 4e771b7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-var fs     = require('fs'),
-    stream = require('stream'),
-    needle = require('./../');
-
-var url  = 'http://ibl.gamechaser.net/f/tagqfxtteucbuldhezkz/bt_level1.gz';
-
-var resp = needle.get(url, { compressed: true, follow_max: 10 });
-console.log('Downloading...');
-
-resp.on('readable', function() {
-
-  while (data = this.read()) {
-    var lines = data.toString().split('\n');
-    console.log('Got ' + lines.length + ' items.');
-    // console.log(lines);
-  }
-
-})
-
-resp.on('done', function(data) {
-  console.log('Done');
-})
diff --git a/legacy-libs/grpc/node_modules/needle/examples/digest-auth.js b/legacy-libs/grpc/node_modules/needle/examples/digest-auth.js
deleted file mode 100644 (file)
index 5b8e5d5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-var needle = require('./..');
-
-var opts = {
-  username: 'user3',
-  password: 'user3',
-  auth: 'digest'
-}
-
-needle.get('http://test.webdav.org/auth-digest/', opts, function(err, resp, body) {
-  console.log(resp.headers);
-
-  if (resp.statusCode == 401)
-    console.log('\nIt failed.')
-  else
-    console.log('\nIt worked!')
-});
diff --git a/legacy-libs/grpc/node_modules/needle/examples/download-to-file.js b/legacy-libs/grpc/node_modules/needle/examples/download-to-file.js
deleted file mode 100644 (file)
index 39d5af9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-var fs = require('fs'),
-    needle = require('./..'),
-    path = require('path');
-
-var url  = process.argv[2] || 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png';
-var file = path.basename(url);
-
-console.log('Downloading ' + file);
-
-needle.get(url, { output: file, follow: 3 }, function(err, resp, data){
-  console.log('File saved: ' + process.cwd() + '/' + file);
-
-  var size = fs.statSync(file).size;
-  if (size == resp.bytes)
-    console.log(resp.bytes + ' bytes written to file.');
-  else
-    throw new Error('File size mismatch: ' + size + ' != ' + resp.bytes);
-});
diff --git a/legacy-libs/grpc/node_modules/needle/examples/multipart-stream.js b/legacy-libs/grpc/node_modules/needle/examples/multipart-stream.js
deleted file mode 100644 (file)
index df1ada6..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-var needle = require('./../');
-
-var url  = 'http://posttestserver.com/post.php?dir=needle';
-
-var black_pixel = Buffer.from("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64');
-
-var data = {
-  foo: 'bar',
-  nested: {
-    test: 123
-  },
-  image: { buffer: black_pixel, content_type: 'image/gif' }
-}
-
-var resp = needle.post(url, data, { multipart: true });
-
-resp.on('readable', function() {
-  while (data = this.read()) {
-    console.log(data.toString());
-  }
-})
-
-resp.on('done', function(data) {
-  console.log('Done.');
-})
diff --git a/legacy-libs/grpc/node_modules/needle/examples/parsed-stream.js b/legacy-libs/grpc/node_modules/needle/examples/parsed-stream.js
deleted file mode 100644 (file)
index 89c22c6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-//////////////////////////////////////////
-// This example demonstrates what happends
-// when you use the built-in JSON parser.
-//////////////////////////////////////////
-
-var fs     = require('fs'),
-    stream = require('stream'),
-    needle = require('./../');
-
-var url    = 'http://ip.jsontest.com/',
-    resp   = needle.get(url, { parse: true });
-
-resp.on('readable', function(obj) {
-  var chunk;
-
-  while (chunk = this.read()) {
-    console.log('root = ', chunk);
-  }
-});
-
-resp.on('done', function() {
-  console.log('Done.');
-});
diff --git a/legacy-libs/grpc/node_modules/needle/examples/parsed-stream2.js b/legacy-libs/grpc/node_modules/needle/examples/parsed-stream2.js
deleted file mode 100644 (file)
index 5d9b79a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-//////////////////////////////////////////\r
-// This example illustrates a more complex\r
-// example of parsing a JSON stream.\r
-//////////////////////////////////////////\r
-\r
-var needle     = require('./../'),\r
-    JSONStream = require('JSONStream');\r
-\r
-var url  = 'http://jsonplaceholder.typicode.com/db';\r
-\r
-// Initialize our GET request with our default (JSON) \r
-// parsers disabled.\r
-\r
-var json = new needle.get(url, {parse: false})\r
-    // And now interpret the stream as JSON, returning only the\r
-    // title of all the posts.\r
-    .pipe(new JSONStream.parse('posts.*.title'));\r
-\r
-json.on('data', function (obj) {\r
-  console.log('got title: \'' + obj + '\'');\r
-})\r
diff --git a/legacy-libs/grpc/node_modules/needle/examples/stream-events.js b/legacy-libs/grpc/node_modules/needle/examples/stream-events.js
deleted file mode 100644 (file)
index 6230993..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-var needle = require('./..');
-
-var resp   = needle.get('google.com', { follow_max: 10, timeout: 5000 });
-
-resp.on('readable', function() {
-  var chunk;
-  while (chunk = this.read()) {
-    console.log('Got ' + chunk.length + ' bytes');
-  }
-})
-
-resp.on('headers', function(headers) {
-  console.log('Got headers', headers);
-})
-
-resp.on('redirect', function(url) {
-  console.log('Redirected to url ' + url);
-})
-
-resp.on('done', function(err) {
-  console.log('Finished. No more data to receive.');
-  if (err) console.log('With error', err)
-})
diff --git a/legacy-libs/grpc/node_modules/needle/examples/stream-to-file.js b/legacy-libs/grpc/node_modules/needle/examples/stream-to-file.js
deleted file mode 100644 (file)
index d261bee..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-var fs     = require('fs'),
-    needle = require('./..'),
-    path   = require('path');
-
-var url    = process.argv[2] || 'http://www.google.com/images/errors/robot.png';
-var file   = path.basename(url);
-
-console.log('Downloading ' + file + '...');
-needle
-  .get(url)
-  .pipe(fs.createWriteStream(file))
-  .on('done', function() {
-    console.log('Done!')
-  })
diff --git a/legacy-libs/grpc/node_modules/needle/examples/upload-image.js b/legacy-libs/grpc/node_modules/needle/examples/upload-image.js
deleted file mode 100644 (file)
index 090e3e3..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-var needle = require('../'),
-    path   = require('path');
-
-var image = 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png';
-
-function upload(obj, cb) {
-  console.log('Uploading image...');
-
-  var url = 'http://deviantsart.com';
-
-  var opts = {
-    timeout:  10000,
-    follow:    3,
-    multipart: true
-  };
-
-  var params = {
-    file: obj
-  }
-
-  needle.post(url, params, opts, function(err, resp) {
-    if (err || !resp.body.match('url'))
-      return cb(err || new Error('No image URL found.'))
-
-    cb(null, JSON.parse(resp.body).url)
-  })
-}
-
-function download(url, cb) {
-  console.log('Getting ' + url);
-  needle.get(url, function(err, resp) {
-    if (err) throw err;
-
-    cb(null, resp.body);
-  })
-}
-
-////////////////////////////////////////
-// ok, now go.
-
-download(image, function(err, buffer) {
-  if (err) throw err;
-
-  var obj = { buffer: buffer, content_type: 'image/png' };
-
-  upload(obj, function(err, url) {
-    if (err) throw err;
-
-    console.log('Image uploaded to ' + url);
-  })
-})
diff --git a/legacy-libs/grpc/node_modules/needle/lib/auth.js b/legacy-libs/grpc/node_modules/needle/lib/auth.js
deleted file mode 100644 (file)
index b7ed4ca..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-var createHash = require('crypto').createHash;
-
-function get_header(header, credentials, opts) {
-  var type = header.split(' ')[0],
-      user = credentials[0],
-      pass = credentials[1];
-
-  if (type == 'Digest') {
-    return digest.generate(header, user, pass, opts.method, opts.path);
-  } else if (type == 'Basic') {
-    return basic(user, pass);
-  }
-}
-
-////////////////////
-// basic
-
-function md5(string) {
-  return createHash('md5').update(string).digest('hex');
-}
-
-function basic(user, pass) {
-  var str  = typeof pass == 'undefined' ? user : [user, pass].join(':');
-  return 'Basic ' + Buffer.from(str).toString('base64');
-}
-
-////////////////////
-// digest
-// logic inspired from https://github.com/simme/node-http-digest-client
-
-var digest = {};
-
-digest.parse_header = function(header) {
-  var challenge = {},
-      matches   = header.match(/([a-z0-9_-]+)="?([a-z0-9=\/\.@\s-]+)"?/gi);
-
-  for (var i = 0, l = matches.length; i < l; i++) {
-    var parts = matches[i].split('='),
-        key   = parts.shift(),
-        val   = parts.join('=').replace(/^"/, '').replace(/"$/, '');
-
-    challenge[key] = val;
-  }
-
-  return challenge;
-}
-
-digest.update_nc = function(nc) {
-  var max = 99999999;
-  nc++;
-
-  if (nc > max)
-    nc = 1;
-
-  var padding = new Array(8).join('0') + '';
-  nc = nc + '';
-  return padding.substr(0, 8 - nc.length) + nc;
-}
-
-digest.generate = function(header, user, pass, method, path) {
-
-  var nc        = 1,
-      cnonce    = null,
-      challenge = digest.parse_header(header);
-
-  var ha1  = md5(user + ':' + challenge.realm + ':' + pass),
-      ha2  = md5(method.toUpperCase() + ':' + path),
-      resp = [ha1, challenge.nonce];
-
-  if (typeof challenge.qop === 'string') {
-    cnonce = md5(Math.random().toString(36)).substr(0, 8);
-    nc     = digest.update_nc(nc);
-    resp   = resp.concat(nc, cnonce);
-  }
-
-  resp = resp.concat(challenge.qop, ha2);
-
-  var params = {
-    uri      : path,
-    realm    : challenge.realm,
-    nonce    : challenge.nonce,
-    username : user,
-    response : md5(resp.join(':'))
-  }
-
-  if (challenge.qop) {
-    params.qop = challenge.qop;
-  }
-
-  if (challenge.opaque) {
-    params.opaque = challenge.opaque;
-  }
-
-  if (cnonce) {
-    params.nc = nc;
-    params.cnonce = cnonce;
-  }
-
-  header = []
-  for (var k in params)
-    header.push(k + '="' + params[k] + '"')
-
-  return 'Digest ' + header.join(', ');
-}
-
-module.exports = {
-  header : get_header,
-  basic  : basic,
-  digest : digest.generate
-}
diff --git a/legacy-libs/grpc/node_modules/needle/lib/cookies.js b/legacy-libs/grpc/node_modules/needle/lib/cookies.js
deleted file mode 100644 (file)
index 0f48afc..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-
-//  Simple cookie handling implementation based on the standard RFC 6265.
-//
-//  This module just has two functionalities:
-//    - Parse a set-cookie-header as a key value object
-//    - Write a cookie-string from a key value object
-//
-//  All cookie attributes are ignored.
-
-var unescape = require('querystring').unescape;
-
-var COOKIE_PAIR        = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
-var EXCLUDED_CHARS     = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g;
-var TRAILING_SEMICOLON = /\x3B+$/;
-var SEP_SEMICOLON      = /\s*\x3B\s*/;
-
-// i know these should be 'const', but I'd like to keep
-// supporting earlier node.js versions as long as I can. :)
-
-var KEY_INDEX   = 1; // index of key from COOKIE_PAIR match
-var VALUE_INDEX = 3; // index of value from COOKIE_PAIR match
-
-// Returns a copy str trimmed and without trainling semicolon.
-function cleanCookieString(str) {
-  return str.trim().replace(/\x3B+$/, '');
-}
-
-function getFirstPair(str) {
-  var index = str.indexOf('\x3B');
-  return index === -1 ? str : str.substr(0, index);
-}
-
-// Returns a encoded copy of str based on RFC6265 S4.1.1.
-function encodeCookieComponent(str) {
-  return str.toString().replace(EXCLUDED_CHARS, encodeURIComponent);
-}
-
-// Parses a set-cookie-string based on the standard defined in RFC6265 S4.1.1.
-function parseSetCookieString(str) {
-  str = cleanCookieString(str);
-  str = getFirstPair(str);
-
-  var res = COOKIE_PAIR.exec(str);
-  if (!res || !res[VALUE_INDEX]) return null;
-
-  return {
-    name  : unescape(res[KEY_INDEX]),
-    value : unescape(res[VALUE_INDEX])
-  };
-}
-
-// Parses a set-cookie-header and returns a key/value object.
-// Each key represents the name of a cookie.
-function parseSetCookieHeader(header) {
-  if (!header) return {};
-  header = Array.isArray(header) ? header : [header];
-
-  return header.reduce(function(res, str) {
-    var cookie = parseSetCookieString(str);
-    if (cookie) res[cookie.name] = cookie.value;
-    return res;
-  }, {});
-}
-
-// Writes a set-cookie-string based on the standard definded in RFC6265 S4.1.1.
-function writeCookieString(obj) {
-  return Object.keys(obj).reduce(function(str, name) {
-    var encodedName  = encodeCookieComponent(name);
-    var encodedValue = encodeCookieComponent(obj[name]);
-    str += (str ? '; ' : '') + encodedName + '=' + encodedValue;
-    return str;
-  }, '');
-}
-
-// returns a key/val object from an array of cookie strings
-exports.read = parseSetCookieHeader;
-
-// writes a cookie string header
-exports.write = writeCookieString;
diff --git a/legacy-libs/grpc/node_modules/needle/lib/decoder.js b/legacy-libs/grpc/node_modules/needle/lib/decoder.js
deleted file mode 100644 (file)
index d82bb5a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-var iconv,
-    inherits  = require('util').inherits,
-    stream    = require('stream');
-
-var regex = /(?:charset|encoding)\s*=\s*['"]? *([\w\-]+)/i;
-
-inherits(StreamDecoder, stream.Transform);
-
-function StreamDecoder(charset) {
-  if (!(this instanceof StreamDecoder))
-    return new StreamDecoder(charset);
-
-  stream.Transform.call(this, charset);
-  this.charset = charset;
-  this.parsed_chunk = false;
-}
-
-StreamDecoder.prototype._transform = function(chunk, encoding, done) {
-  var res, found;
-
-  // try get charset from chunk, just once
-  if (this.charset == 'iso-8859-1' && !this.parsed_chunk) {
-    this.parsed_chunk = true;
-
-    var matches = regex.exec(chunk.toString());
-    if (matches) {
-      found = matches[1].toLowerCase();
-      this.charset = found == 'utf-8' ? 'utf8' : found;
-    }
-  }
-
-  try {
-    res = iconv.decode(chunk, this.charset);
-  } catch(e) { // something went wrong, just return original chunk
-    res = chunk;
-  }
-
-  this.push(res);
-  done();
-}
-
-module.exports = function(charset) {
-  try {
-    if (!iconv) iconv = require('iconv-lite');
-  } catch(e) {
-    /* iconv not found */
-  }
-
-  if (iconv)
-    return new StreamDecoder(charset);
-  else
-    return new stream.PassThrough;
-}
diff --git a/legacy-libs/grpc/node_modules/needle/lib/multipart.js b/legacy-libs/grpc/node_modules/needle/lib/multipart.js
deleted file mode 100644 (file)
index d1e6e18..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-var readFile = require('fs').readFile,
-    basename = require('path').basename;
-
-exports.build = function(data, boundary, callback) {
-
-  if (typeof data != 'object' || typeof data.pipe == 'function')
-    return callback(new Error('Multipart builder expects data as key/val object.'));
-
-  var body   = '',
-      object = flatten(data),
-      count  = Object.keys(object).length;
-
-  if (count === 0)
-    return callback(new Error('Empty multipart body. Invalid data.'))
-
-  function done(err, section) {
-    if (err) return callback(err);
-    if (section) body += section;
-    --count || callback(null, body + '--' + boundary + '--');
-  };
-
-  for (var key in object) {
-    var value = object[key];
-    if (value === null || typeof value == 'undefined') {
-      done();
-    } else if (Buffer.isBuffer(value)) {
-      var part = { buffer: value, content_type: 'application/octet-stream' };
-      generate_part(key, part, boundary, done);
-    } else {
-      var part = (value.buffer || value.file || value.content_type) ? value : { value: value };
-      generate_part(key, part, boundary, done);
-    }
-  }
-
-}
-
-function generate_part(name, part, boundary, callback) {
-
-  var return_part = '--' + boundary + '\r\n';
-  return_part += 'Content-Disposition: form-data; name="' + name + '"';
-
-  function append(data, filename) {
-
-    if (data) {
-      var binary = part.content_type.indexOf('text') == -1;
-      return_part += '; filename="' + encodeURIComponent(filename) + '"\r\n';
-      if (binary) return_part += 'Content-Transfer-Encoding: binary\r\n';
-      return_part += 'Content-Type: ' + part.content_type + '\r\n\r\n';
-      return_part += binary ? data.toString('binary') : data.toString('utf8');
-    }
-
-    callback(null, return_part + '\r\n');
-  };
-
-  if ((part.file || part.buffer) && part.content_type) {
-
-    var filename = part.filename ? part.filename : part.file ? basename(part.file) : name;
-    if (part.buffer) return append(part.buffer, filename);
-
-    readFile(part.file, function(err, data) {
-      if (err) return callback(err);
-      append(data, filename);
-    });
-
-  } else {
-
-    if (typeof part.value == 'object')
-      return callback(new Error('Object received for ' + name + ', expected string.'))
-
-    if (part.content_type) {
-      return_part += '\r\n';
-      return_part += 'Content-Type: ' + part.content_type;
-    }
-
-    return_part += '\r\n\r\n';
-    return_part += Buffer.from(String(part.value), 'utf8').toString('binary');
-    append();
-
-  }
-
-}
-
-// flattens nested objects for multipart body
-function flatten(object, into, prefix) {
-  into = into || {};
-
-  for(var key in object) {
-    var prefix_key = prefix ? prefix + '[' + key + ']' : key;
-    var prop = object[key];
-
-    if (prop && typeof prop === 'object' && !(prop.buffer || prop.file || prop.content_type))
-      flatten(prop, into, prefix_key)
-    else
-      into[prefix_key] = prop;
-  }
-
-  return into;
-}
diff --git a/legacy-libs/grpc/node_modules/needle/lib/needle.js b/legacy-libs/grpc/node_modules/needle/lib/needle.js
deleted file mode 100644 (file)
index 001007c..0000000
+++ /dev/null
@@ -1,797 +0,0 @@
-//////////////////////////////////////////
-// Needle -- HTTP Client for Node.js
-// Written by Tomás Pollak <tomas@forkhq.com>
-// (c) 2012-2017 - Fork Ltd.
-// MIT Licensed
-//////////////////////////////////////////
-
-var fs          = require('fs'),
-    http        = require('http'),
-    https       = require('https'),
-    url         = require('url'),
-    stream      = require('stream'),
-    debug       = require('debug')('needle'),
-    stringify   = require('./querystring').build,
-    multipart   = require('./multipart'),
-    auth        = require('./auth'),
-    cookies     = require('./cookies'),
-    parsers     = require('./parsers'),
-    decoder     = require('./decoder');
-
-//////////////////////////////////////////
-// variabilia
-
-var version     = require('../package.json').version;
-
-var user_agent  = 'Needle/' + version;
-user_agent     += ' (Node.js ' + process.version + '; ' + process.platform + ' ' + process.arch + ')';
-
-var tls_options = 'agent pfx key passphrase cert ca ciphers rejectUnauthorized secureProtocol checkServerIdentity';
-
-// older versions of node (< 0.11.4) prevent the runtime from exiting
-// because of connections in keep-alive state. so if this is the case
-// we'll default new requests to set a Connection: close header.
-var close_by_default = !http.Agent || http.Agent.defaultMaxSockets != Infinity;
-
-// see if we have Object.assign. otherwise fall back to util._extend
-var extend = Object.assign ? Object.assign : require('util')._extend;
-
-// these are the status codes that Needle interprets as redirects.
-var redirect_codes = [301, 302, 303, 307];
-
-//////////////////////////////////////////
-// decompressors for gzip/deflate bodies
-
-var decompressors = {};
-
-try {
-
-  var zlib = require('zlib');
-  decompressors['x-deflate'] = zlib.Inflate;
-  decompressors['deflate']   = zlib.Inflate;
-  decompressors['x-gzip']    = zlib.Gunzip;
-  decompressors['gzip']      = zlib.Gunzip;
-
-  // Enable Z_SYNC_FLUSH to avoid Z_BUF_ERROR errors (Node PR #2595)
-  var zlib_options = {
-    flush: zlib.Z_SYNC_FLUSH,
-    finishFlush: zlib.Z_SYNC_FLUSH
-  }
-
-} catch(e) { /* zlib not available */ }
-
-//////////////////////////////////////////
-// options and aliases
-
-var defaults = {
-  // data
-  boundary                : '--------------------NODENEEDLEHTTPCLIENT',
-  encoding                : 'utf8',
-  parse_response          : 'all', // same as true. valid options: 'json', 'xml' or false/null
-  proxy                   : null,
-
-  // headers
-  accept                  : '*/*',
-  user_agent              : user_agent,
-
-  // numbers
-  open_timeout            : 10000,
-  response_timeout        : 0,
-  read_timeout            : 0,
-  follow_max              : 0,
-  stream_length           : -1,
-
-  // booleans
-  decode_response         : true,
-  parse_cookies           : true,
-  follow_set_cookies      : false,
-  follow_set_referer      : false,
-  follow_keep_method      : false,
-  follow_if_same_host     : false,
-  follow_if_same_protocol : false
-}
-
-var aliased = {
-  options: {
-    decode  : 'decode_response',
-    parse   : 'parse_response',
-    timeout : 'open_timeout',
-    follow  : 'follow_max'
-  },
-  inverted: {}
-}
-
-// only once, invert aliased keys so we can get passed options.
-Object.keys(aliased.options).map(function(k) {
-  var value = aliased.options[k];
-  aliased.inverted[value] = k;
-});
-
-//////////////////////////////////////////
-// helpers
-
-function keys_by_type(type) {
-  return Object.keys(defaults).map(function(el) {
-    if (defaults[el] !== null && defaults[el].constructor == type)
-      return el;
-  }).filter(function(el) { return el })
-}
-
-function parse_content_type(header) {
-  if (!header || header === '') return {};
-
-  var found, charset = 'iso-8859-1', arr = header.split(';');
-
-  if (arr.length > 1 && (found = arr[1].match(/charset=(.+)/)))
-    charset = found[1];
-
-  return { type: arr[0], charset: charset };
-}
-
-function is_stream(obj) {
-  return typeof obj.pipe === 'function';
-}
-
-function get_stream_length(stream, given_length, cb) {
-  if (given_length > 0)
-    return cb(given_length);
-
-  if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0)
-    return cb((stream.end + 1) - (stream.start || 0));
-
-  fs.stat(stream.path, function(err, stat) {
-    cb(stat ? stat.size - (stream.start || 0) : null);
-  });
-}
-
-//////////////////////////////////////////
-// the main act
-
-function Needle(method, uri, data, options, callback) {
-  // if (!(this instanceof Needle)) {
-  //   return new Needle(method, uri, data, options, callback);
-  // }
-
-  if (typeof uri !== 'string')
-    throw new TypeError('URL must be a string, not ' + uri);
-
-  this.method   = method;
-  this.uri      = uri;
-  this.data     = data;
-
-  if (typeof options == 'function') {
-    this.callback = options;
-    this.options  = {};
-  } else {
-    this.callback = callback;
-    this.options  = options;
-  }
-
-}
-
-Needle.prototype.setup = function(uri, options) {
-
-  function get_option(key, fallback) {
-    // if original is in options, return that value
-    if (typeof options[key] != 'undefined') return options[key];
-
-    // otherwise, return value from alias or fallback/undefined
-    return typeof options[aliased.inverted[key]] != 'undefined'
-                ? options[aliased.inverted[key]] : fallback;
-  }
-
-  function check_value(expected, key) {
-    var value = get_option(key),
-        type  = typeof value;
-
-    if (type != 'undefined' && type != expected)
-      throw new TypeError(type + ' received for ' + key + ', but expected a ' + expected);
-
-    return (type == expected) ? value : defaults[key];
-  }
-
-  //////////////////////////////////////////////////
-  // the basics
-
-  var config = {
-    http_opts : {
-      localAddress: get_option('localAddress', undefined)
-    }, // passed later to http.request() directly
-    output    : options.output,
-    proxy     : get_option('proxy', defaults.proxy),
-    parser    : get_option('parse_response', defaults.parse_response),
-    encoding  : options.encoding || (options.multipart ? 'binary' : defaults.encoding)
-  }
-
-  keys_by_type(Boolean).forEach(function(key) {
-    config[key] = check_value('boolean', key);
-  })
-
-  keys_by_type(Number).forEach(function(key) {
-    config[key] = check_value('number', key);
-  })
-
-  // populate http_opts with given TLS options
-  tls_options.split(' ').forEach(function(key) {
-    if (typeof options[key] != 'undefined') {
-      config.http_opts[key] = options[key];
-      if (typeof options.agent == 'undefined')
-        config.http_opts.agent = false; // otherwise tls options are skipped
-    }
-  });
-
-  //////////////////////////////////////////////////
-  // headers, cookies
-
-  config.headers = {
-    'accept'     : options.accept     || defaults.accept,
-    'user-agent' : options.user_agent || defaults.user_agent
-  }
-
-  if (options.content_type)
-    config.headers['content-type'] = options.content_type;
-
-  // set connection header if opts.connection was passed, or if node < 0.11.4 (close)
-  if (options.connection || close_by_default)
-    config.headers['connection'] = options.connection || 'close';
-
-  if ((options.compressed || defaults.compressed) && typeof zlib != 'undefined')
-    config.headers['accept-encoding'] = 'gzip,deflate';
-
-  if (options.cookies)
-    config.headers['cookie'] = cookies.write(options.cookies);
-
-  //////////////////////////////////////////////////
-  // basic/digest auth
-
-  if (uri.match(/[^\/]@/)) { // url contains user:pass@host, so parse it.
-    var parts = (url.parse(uri).auth || '').split(':');
-    options.username = parts[0];
-    options.password = parts[1];
-  }
-
-  if (options.username) {
-    if (options.auth && (options.auth == 'auto' || options.auth == 'digest')) {
-      config.credentials = [options.username, options.password];
-    } else {
-      config.headers['authorization'] = auth.basic(options.username, options.password);
-    }
-  }
-
-  // if proxy is present, set auth header from either url or proxy_user option.
-  if (config.proxy) {
-    if (config.proxy.indexOf('http') === -1)
-      config.proxy = 'http://' + config.proxy;
-
-    if (config.proxy.indexOf('@') !== -1) {
-      var proxy = (url.parse(config.proxy).auth || '').split(':');
-      options.proxy_user = proxy[0];
-      options.proxy_pass = proxy[1];
-    }
-
-    if (options.proxy_user)
-      config.headers['proxy-authorization'] = auth.basic(options.proxy_user, options.proxy_pass);
-  }
-
-  // now that all our headers are set, overwrite them if instructed.
-  for (var h in options.headers)
-    config.headers[h.toLowerCase()] = options.headers[h];
-
-  return config;
-}
-
-Needle.prototype.start = function() {
-
-  var out      = new stream.PassThrough({ objectMode: false }),
-      uri      = this.uri,
-      data     = this.data,
-      method   = this.method,
-      callback = (typeof this.options == 'function') ? this.options : this.callback,
-      options  = this.options || {};
-
-  // if no 'http' is found on URL, prepend it.
-  if (uri.indexOf('http') === -1)
-    uri = uri.replace(/^(\/\/)?/, 'http://');
-
-  var self = this, body, waiting = false, config = this.setup(uri, options);
-
-  // unless options.json was set to false, assume boss also wants JSON if content-type matches.
-  var json = options.json || (options.json !== false && config.headers['content-type'] == 'application/json');
-
-  if (data) {
-
-    if (options.multipart) { // boss says we do multipart. so we do it.
-      var boundary = options.boundary || defaults.boundary;
-
-      waiting = true;
-      multipart.build(data, boundary, function(err, parts) {
-        if (err) throw(err);
-
-        config.headers['content-type'] = 'multipart/form-data; boundary=' + boundary;
-        next(parts);
-      });
-
-    } else if (is_stream(data)) {
-
-      if (method.toUpperCase() == 'GET')
-        throw new Error('Refusing to pipe() a stream via GET. Did you mean .post?');
-
-      if (config.stream_length > 0 || (config.stream_length === 0 && data.path)) {
-        // ok, let's get the stream's length and set it as the content-length header.
-        // this prevents some servers from cutting us off before all the data is sent.
-        waiting = true;
-        get_stream_length(data, config.stream_length, function(length) {
-          data.length = length;
-          next(data);
-        })
-
-      } else {
-        // if the boss doesn't want us to get the stream's length, or if it doesn't
-        // have a file descriptor for that purpose, then just head on.
-        body = data;
-      }
-
-    } else if (Buffer.isBuffer(data)) {
-
-      body = data; // use the raw buffer as request body.
-
-    } else if (method.toUpperCase() == 'GET' && !json) {
-
-      // append the data to the URI as a querystring.
-      uri = uri.replace(/\?.*|$/, '?' + stringify(data));
-
-    } else { // string or object data, no multipart.
-
-      // if string, leave it as it is, otherwise, stringify.
-      body = (typeof(data) === 'string') ? data
-             : json ? JSON.stringify(data) : stringify(data);
-
-      // ensure we have a buffer so bytecount is correct.
-      body = Buffer.from(body, config.encoding);
-    }
-
-  }
-
-  function next(body) {
-    if (body) {
-      if (body.length) config.headers['content-length'] = body.length;
-
-      // if no content-type was passed, determine if json or not.
-      if (!config.headers['content-type']) {
-        config.headers['content-type'] = json
-        ? 'application/json; charset=utf-8'
-        : 'application/x-www-form-urlencoded'; // no charset says W3 spec.
-      }
-    }
-
-    // unless a specific accept header was set, assume json: true wants JSON back.
-    if (options.json && (!options.accept && !(options.headers || {}).accept))
-      config.headers['accept'] = 'application/json';
-
-    self.send_request(1, method, uri, config, body, out, callback);
-  }
-
-  if (!waiting) next(body);
-  return out;
-}
-
-Needle.prototype.get_request_opts = function(method, uri, config) {
-  var opts      = config.http_opts,
-      proxy     = config.proxy,
-      remote    = proxy ? url.parse(proxy) : url.parse(uri);
-
-  opts.protocol = remote.protocol;
-  opts.host     = remote.hostname;
-  opts.port     = remote.port || (remote.protocol == 'https:' ? 443 : 80);
-  opts.path     = proxy ? uri : remote.pathname + (remote.search || '');
-  opts.method   = method;
-  opts.headers  = config.headers;
-
-  if (!opts.headers['host']) {
-    // if using proxy, make sure the host header shows the final destination
-    var target = proxy ? url.parse(uri) : remote;
-    opts.headers['host'] = target.hostname;
-
-    // and if a non standard port was passed, append it to the port header
-    if (target.port && [80, 443].indexOf(target.port) === -1) {
-      opts.headers['host'] += ':' + target.port;
-    }
-  }
-
-  return opts;
-}
-
-Needle.prototype.should_follow = function(location, config, original) {
-  if (!location) return false;
-
-  // returns true if location contains matching property (host or protocol)
-  function matches(property) {
-    var property = original[property];
-    return location.indexOf(property) !== -1;
-  }
-
-  // first, check whether the requested location is actually different from the original
-  if (location === original)
-    return false;
-
-  if (config.follow_if_same_host && !matches('host'))
-    return false; // host does not match, so not following
-
-  if (config.follow_if_same_protocol && !matches('protocol'))
-    return false; // procotol does not match, so not following
-
-  return true;
-}
-
-Needle.prototype.send_request = function(count, method, uri, config, post_data, out, callback) {
-
-  var timer,
-      returned     = 0,
-      self         = this,
-      request_opts = this.get_request_opts(method, uri, config),
-      protocol     = request_opts.protocol == 'https:' ? https : http;
-
-  function done(err, resp) {
-    if (returned++ > 0)
-      return debug('Already finished, stopping here.');
-
-    if (timer) clearTimeout(timer);
-    request.removeListener('error', had_error);
-
-    if (callback)
-      return callback(err, resp, resp ? resp.body : undefined);
-
-    // NOTE: this event used to be called 'end', but the behaviour was confusing
-    // when errors ocurred, because the stream would still emit an 'end' event.
-    out.emit('done', err);
-  }
-
-  function had_error(err) {
-    debug('Request error', err);
-    out.emit('err', err);
-    done(err || new Error('Unknown error when making request.'));
-  }
-
-  function set_timeout(type, milisecs) {
-    if (timer) clearTimeout(timer);
-    if (milisecs <= 0) return;
-
-    timer = setTimeout(function() {
-      out.emit('timeout', type);
-      request.abort();
-      // also invoke done() to terminate job on read_timeout
-      if (type == 'read') done(new Error(type + ' timeout'));
-    }, milisecs);
-  }
-
-  // handle errors on the underlying socket, that may be closed while writing
-  // for an example case, see test/long_string_spec.js. we make sure this
-  // scenario ocurred by verifying the socket's writable & destroyed states.
-  function on_socket_end() {
-    if (!this.writable && this.destroyed === false) {
-      this.destroy();
-      had_error(new Error('Remote end closed socket abruptly.'))
-    }
-  }
-
-  debug('Making request #' + count, request_opts);
-  var request = protocol.request(request_opts, function(resp) {
-
-    var headers = resp.headers;
-    debug('Got response', resp.statusCode, headers);
-    out.emit('response', resp);
-
-    set_timeout('read', config.read_timeout);
-
-    // if we got cookies, parse them unless we were instructed not to. make sure to include any
-    // cookies that might have been set on previous redirects.
-    if (config.parse_cookies && (headers['set-cookie'] || config.stored_cookies)) {
-      resp.cookies = extend(config.stored_cookies || {}, cookies.read(headers['set-cookie']));
-      debug('Got cookies', resp.cookies);
-    }
-
-    // if redirect code is found, determine if we should follow it according to the given options.
-    if (redirect_codes.indexOf(resp.statusCode) !== -1 && self.should_follow(headers.location, config, uri)) {
-      // clear timer before following redirects to prevent unexpected setTimeout consequence
-      clearTimeout(timer);
-
-      if (count <= config.follow_max) {
-        out.emit('redirect', headers.location);
-
-        // unless 'follow_keep_method' is true, rewrite the request to GET before continuing.
-        if (!config.follow_keep_method) {
-          method    = 'GET';
-          post_data = null;
-          delete config.headers['content-length']; // in case the original was a multipart POST request.
-        }
-
-        // if follow_set_cookies is true, make sure to put any cookies in the next request's headers.
-        if (config.follow_set_cookies && resp.cookies) {
-          config.stored_cookies    = resp.cookies;
-          config.headers['cookie'] = cookies.write(resp.cookies);
-        }
-
-        if (config.follow_set_referer)
-          config.headers['referer'] = encodeURI(uri); // the original, not the destination URL.
-
-        config.headers['host'] = null; // clear previous Host header to avoid conflicts.
-
-        debug('Redirecting to ' + url.resolve(uri, headers.location));
-        return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, callback);
-      } else if (config.follow_max > 0) {
-        return done(new Error('Max redirects reached. Possible loop in: ' + headers.location));
-      }
-    }
-
-    // if auth is requested and credentials were not passed, resend request, provided we have user/pass.
-    if (resp.statusCode == 401 && headers['www-authenticate'] && config.credentials) {
-      if (!config.headers['authorization']) { // only if authentication hasn't been sent
-        var auth_header = auth.header(headers['www-authenticate'], config.credentials, request_opts);
-
-        if (auth_header) {
-          config.headers['authorization'] = auth_header;
-          return self.send_request(count, method, uri, config, post_data, out, callback);
-        }
-      }
-    }
-
-    // ok, so we got a valid (non-redirect & authorized) response. let's notify the stream guys.
-    out.emit('header', resp.statusCode, headers);
-    out.emit('headers', headers);
-
-    var pipeline      = [],
-        mime          = parse_content_type(headers['content-type']),
-        text_response = mime.type && mime.type.indexOf('text/') != -1;
-
-    // To start, if our body is compressed and we're able to inflate it, do it.
-    if (headers['content-encoding'] && decompressors[headers['content-encoding']]) {
-
-      var decompressor = decompressors[headers['content-encoding']](zlib_options);
-
-      // make sure we catch errors triggered by the decompressor.
-      decompressor.on('error', had_error);
-      pipeline.push(decompressor);
-    }
-
-    // If parse is enabled and we have a parser for it, then go for it.
-    if (config.parser && parsers[mime.type]) {
-
-      // If a specific parser was requested, make sure we don't parse other types.
-      var parser_name = config.parser.toString().toLowerCase();
-      if (['xml', 'json'].indexOf(parser_name) == -1 || parsers[mime.type].name == parser_name) {
-
-        // OK, so either we're parsing all content types or the one requested matches.
-        out.parser = parsers[mime.type].name;
-        pipeline.push(parsers[mime.type].fn());
-
-        // Set objectMode on out stream to improve performance.
-        out._writableState.objectMode = true;
-        out._readableState.objectMode = true;
-      }
-
-    // If we're not parsing, and unless decoding was disabled, we'll try
-    // decoding non UTF-8 bodies to UTF-8, using the iconv-lite library.
-    } else if (text_response && config.decode_response
-      && mime.charset && !mime.charset.match(/utf-?8$/i)) {
-        pipeline.push(decoder(mime.charset));
-    }
-
-    // And `out` is the stream we finally push the decoded/parsed output to.
-    pipeline.push(out);
-
-    // Now, release the kraken!
-    var tmp = resp;
-    while (pipeline.length) {
-      tmp = tmp.pipe(pipeline.shift());
-    }
-
-    // If the user has requested and output file, pipe the output stream to it.
-    // In stream mode, we will still get the response stream to play with.
-    if (config.output && resp.statusCode == 200) {
-
-      // for some reason, simply piping resp to the writable stream doesn't
-      // work all the time (stream gets cut in the middle with no warning).
-      // so we'll manually need to do the readable/write(chunk) trick.
-      var file = fs.createWriteStream(config.output);
-      file.on('error', had_error);
-
-      out.on('end', function() {
-        if (file.writable) file.end();
-      });
-
-      file.on('close', function() {
-        delete out.file;
-      })
-
-      out.on('readable', function() {
-        var chunk;
-        while ((chunk = this.read()) !== null) {
-          if (file.writable) file.write(chunk);
-
-          // if callback was requested, also push it to resp.body
-          if (resp.body) resp.body.push(chunk);
-        }
-      })
-
-      out.file = file;
-    }
-
-    // Only aggregate the full body if a callback was requested.
-    if (callback) {
-      resp.raw   = [];
-      resp.body  = [];
-      resp.bytes = 0;
-
-      // Gather and count the amount of (raw) bytes using a PassThrough stream.
-      var clean_pipe = new stream.PassThrough();
-      resp.pipe(clean_pipe);
-
-      clean_pipe.on('readable', function() {
-        var chunk;
-        while ((chunk = this.read()) != null) {
-          resp.bytes += chunk.length;
-          resp.raw.push(chunk);
-        }
-      })
-
-      // Listen on the 'readable' event to aggregate the chunks, but only if
-      // file output wasn't requested. Otherwise we'd have two stream readers.
-      if (!config.output || resp.statusCode != 200) {
-        out.on('readable', function() {
-          var chunk;
-          while ((chunk = this.read()) !== null) {
-            // We're either pushing buffers or objects, never strings.
-            if (typeof chunk == 'string') chunk = Buffer.from(chunk);
-
-            // Push all chunks to resp.body. We'll bind them in resp.end().
-            resp.body.push(chunk);
-          }
-        })
-      }
-    }
-
-    // And set the .body property once all data is in.
-    out.on('end', function() {
-      if (resp.body) { // callback mode
-
-        // we want to be able to access to the raw data later, so keep a reference.
-        resp.raw = Buffer.concat(resp.raw);
-
-        // if parse was successful, we should have an array with one object
-        if (resp.body[0] !== undefined && !Buffer.isBuffer(resp.body[0])) {
-
-          // that's our body right there.
-          resp.body = resp.body[0];
-
-          // set the parser property on our response. we may want to check.
-          if (out.parser) resp.parser = out.parser;
-
-        } else { // we got one or several buffers. string or binary.
-          resp.body = Buffer.concat(resp.body);
-
-          // if we're here and parsed is true, it means we tried to but it didn't work.
-          // so given that we got a text response, let's stringify it.
-          if (text_response || out.parser) {
-            resp.body = resp.body.toString();
-          }
-        }
-      }
-
-      // if an output file is being written to, make sure the callback
-      // is triggered after all data has been written to it.
-      if (out.file) {
-        out.file.on('close', function() {
-          done(null, resp, resp.body);
-        })
-      } else { // elvis has left the building.
-        done(null, resp, resp.body);
-      }
-
-    });
-
-  }); // end request call
-
-  // unless open_timeout was disabled, set a timeout to abort the request.
-  set_timeout('open', config.open_timeout);
-
-  // handle errors on the request object. things might get bumpy.
-  request.on('error', had_error);
-
-  // make sure timer is cleared if request is aborted (issue #257)
-  request.once('abort', function() {
-    if (timer) clearTimeout(timer);
-  })
-
-  // handle socket 'end' event to ensure we don't get delayed EPIPE errors.
-  request.once('socket', function(socket) {
-    if (socket.connecting) {
-      socket.once('connect', function() {
-        set_timeout('response', config.response_timeout);
-      })
-    } else {
-      set_timeout('response', config.response_timeout);
-    }
-
-    // console.log(socket);
-    if (!socket.on_socket_end) {
-      socket.on_socket_end = on_socket_end;
-      socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) });
-    }
-  })
-
-  if (post_data) {
-    if (is_stream(post_data)) {
-      post_data.pipe(request);
-    } else {
-      request.write(post_data, config.encoding);
-      request.end();
-    }
-  } else {
-    request.end();
-  }
-
-  out.request = request;
-  return out;
-}
-
-//////////////////////////////////////////
-// exports
-
-if (typeof Promise !== 'undefined') {
-  module.exports = function() {
-    var verb, args = [].slice.call(arguments);
-
-    if (args[0].match(/\.|\//)) // first argument looks like a URL
-      verb = (args.length > 2) ? 'post' : 'get';
-    else
-      verb = args.shift();
-
-    if (verb.match(/get|head/) && args.length == 2)
-      args.splice(1, 0, null); // assume no data if head/get with two args (url, options)
-
-    return new Promise(function(resolve, reject) {
-      module.exports.request(verb, args[0], args[1], args[2], function(err, resp) {
-        return err ? reject(err) : resolve(resp);
-      });
-    })
-  }
-}
-
-module.exports.version = version;
-
-module.exports.defaults = function(obj) {
-  for (var key in obj) {
-    var target_key = aliased.options[key] || key;
-
-    if (defaults.hasOwnProperty(target_key) && typeof obj[key] != 'undefined') {
-      if (target_key != 'parse_response' && target_key != 'proxy') {
-        // ensure type matches the original, except for proxy/parse_response that can be null/bool or string
-        var valid_type = defaults[target_key].constructor.name;
-
-        if (obj[key].constructor.name != valid_type)
-          throw new TypeError('Invalid type for ' + key + ', should be ' + valid_type);
-      }
-      defaults[target_key] = obj[key];
-    } else {
-      throw new Error('Invalid property for defaults:' + target_key);      
-    }
-  }
-
-  return defaults;
-}
-
-'head get'.split(' ').forEach(function(method) {
-  module.exports[method] = function(uri, options, callback) {
-    return new Needle(method, uri, null, options, callback).start();
-  }
-})
-
-'post put patch delete'.split(' ').forEach(function(method) {
-  module.exports[method] = function(uri, data, options, callback) {
-    return new Needle(method, uri, data, options, callback).start();
-  }
-})
-
-module.exports.request = function(method, uri, data, opts, callback) {
-  return new Needle(method, uri, data, opts, callback).start();
-};
diff --git a/legacy-libs/grpc/node_modules/needle/lib/parsers.js b/legacy-libs/grpc/node_modules/needle/lib/parsers.js
deleted file mode 100644 (file)
index 108b17b..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-//////////////////////////////////////////
-// Defines mappings between content-type
-// and the appropriate parsers.
-//////////////////////////////////////////
-
-var Transform = require('stream').Transform;
-var sax = require('sax');
-
-function parseXML(str, cb) {
-  var obj, current, parser = sax.parser(true, { trim: true, lowercase: true })
-  parser.onerror = parser.onend = done;
-
-  function done(err) {
-    parser.onerror = parser.onend = function() { }
-    cb(err, obj)
-  }
-
-  function newElement(name, attributes) {
-    return {
-      name: name || '',
-      value: '',
-      attributes: attributes || {},
-      children: []
-    }
-  }
-
-  parser.ontext = function(t) {
-    if (current) current.value += t
-  }
-
-  parser.onopentag = function(node) {
-    var element = newElement(node.name, node.attributes)
-    if (current) {
-      element.parent = current
-      current.children.push(element)
-    } else { // root object
-      obj = element
-    }
-
-    current = element
-  };
-
-  parser.onclosetag = function() {
-    if (typeof current.parent !== 'undefined') {
-      var just_closed = current
-      current = current.parent
-      delete just_closed.parent
-    }
-  }
-
-  parser.write(str).close()
-}
-
-function parserFactory(name, fn) {
-
-  function parser() {
-    var chunks = [],
-        stream = new Transform({ objectMode: true });
-
-    // Buffer all our data
-    stream._transform = function(chunk, encoding, done) {
-      chunks.push(chunk);
-      done();
-    }
-
-    // And call the parser when all is there.
-    stream._flush = function(done) {
-      var self = this,
-          data = Buffer.concat(chunks);
-
-      try {
-        fn(data, function(err, result) {
-          if (err) throw err;
-          self.push(result);
-        });
-      } catch (err) {
-        self.push(data); // just pass the original data
-      } finally {
-        done();
-      }
-    }
-
-    return stream;
-  }
-
-  return { fn: parser, name: name };
-}
-
-var parsers = {}
-
-function buildParser(name, types, fn) {
-  var parser = parserFactory(name, fn);
-  types.forEach(function(type) {
-    parsers[type] = parser;
-  })
-}
-
-buildParser('json', [
-  'application/json',
-  'text/javascript'
-], function(buffer, cb) {
-  var err, data;
-  try { data = JSON.parse(buffer); } catch (e) { err = e; }
-  cb(err, data);
-});
-
-buildParser('xml', [
-  'text/xml',
-  'application/xml',
-  'application/rdf+xml',
-  'application/rss+xml',
-  'application/atom+xml'
-], function(buffer, cb) {
-  parseXML(buffer.toString(), function(err, obj) {
-    cb(err, obj)
-  })
-});
-
-module.exports = parsers;
-module.exports.use = buildParser;
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/needle/lib/querystring.js b/legacy-libs/grpc/node_modules/needle/lib/querystring.js
deleted file mode 100644 (file)
index e58cc42..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// based on the qs module, but handles null objects as expected
-// fixes by Tomas Pollak.
-
-var toString = Object.prototype.toString;
-
-function stringify(obj, prefix) {
-  if (prefix && (obj === null || typeof obj == 'undefined')) {
-    return prefix + '=';
-  } else if (toString.call(obj) == '[object Array]') {
-    return stringifyArray(obj, prefix);
-  } else if (toString.call(obj) == '[object Object]') {
-    return stringifyObject(obj, prefix);
-  } else if (toString.call(obj) == '[object Date]') {
-    return obj.toISOString();
-  } else if (prefix) { // string inside array or hash
-    return prefix + '=' + encodeURIComponent(String(obj));
-  } else if (String(obj).indexOf('=') !== -1) { // string with equal sign
-    return String(obj);
-  } else {
-    throw new TypeError('Cannot build a querystring out of: ' + obj);
-  }
-};
-
-function stringifyArray(arr, prefix) {
-  var ret = [];
-
-  for (var i = 0, len = arr.length; i < len; i++) {
-    if (prefix)
-      ret.push(stringify(arr[i], prefix + '[]'));
-    else
-      ret.push(stringify(arr[i]));
-  }
-
-  return ret.join('&');
-}
-
-function stringifyObject(obj, prefix) {
-  var ret = [];
-
-  Object.keys(obj).forEach(function(key) {
-    ret.push(stringify(obj[key], prefix
-      ? prefix + '[' + encodeURIComponent(key) + ']'
-      : encodeURIComponent(key)));
-  })
-
-  return ret.join('&');
-}
-
-exports.build = stringify;
diff --git a/legacy-libs/grpc/node_modules/needle/license.txt b/legacy-libs/grpc/node_modules/needle/license.txt
deleted file mode 100644 (file)
index fb245f3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) Fork, Ltd.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/CHANGELOG.md b/legacy-libs/grpc/node_modules/needle/node_modules/debug/CHANGELOG.md
deleted file mode 100644 (file)
index 820d21e..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-
-3.1.0 / 2017-09-26
-==================
-
-  * Add `DEBUG_HIDE_DATE` env var (#486)
-  * Remove ReDoS regexp in %o formatter (#504)
-  * Remove "component" from package.json
-  * Remove `component.json`
-  * Ignore package-lock.json
-  * Examples: fix colors printout
-  * Fix: browser detection
-  * Fix: spelling mistake (#496, @EdwardBetts)
-
-3.0.1 / 2017-08-24
-==================
-
-  * Fix: Disable colors in Edge and Internet Explorer (#489)
-
-3.0.0 / 2017-08-08
-==================
-
-  * Breaking: Remove DEBUG_FD (#406)
-  * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418)
-  * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408)
-  * Addition: document `enabled` flag (#465)
-  * Addition: add 256 colors mode (#481)
-  * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440)
-  * Update: component: update "ms" to v2.0.0
-  * Update: separate the Node and Browser tests in Travis-CI
-  * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots
-  * Update: separate Node.js and web browser examples for organization
-  * Update: update "browserify" to v14.4.0
-  * Fix: fix Readme typo (#473)
-
-2.6.9 / 2017-09-22
-==================
-
-  * remove ReDoS regexp in %o formatter (#504)
-
-2.6.8 / 2017-05-18
-==================
-
-  * Fix: Check for undefined on browser globals (#462, @marbemac)
-
-2.6.7 / 2017-05-16
-==================
-
-  * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
-  * Fix: Inline extend function in node implementation (#452, @dougwilson)
-  * Docs: Fix typo (#455, @msasad)
-
-2.6.5 / 2017-04-27
-==================
-  
-  * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
-  * Misc: clean up browser reference checks (#447, @thebigredgeek)
-  * Misc: add npm-debug.log to .gitignore (@thebigredgeek)
-
-
-2.6.4 / 2017-04-20
-==================
-
-  * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
-  * Chore: ignore bower.json in npm installations. (#437, @joaovieira)
-  * Misc: update "ms" to v0.7.3 (@tootallnate)
-
-2.6.3 / 2017-03-13
-==================
-
-  * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
-  * Docs: Changelog fix (@thebigredgeek)
-
-2.6.2 / 2017-03-10
-==================
-
-  * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
-  * Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
-  * Docs: Add Slackin invite badge (@tootallnate)
-
-2.6.1 / 2017-02-10
-==================
-
-  * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
-  * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
-  * Fix: IE8 "Expected identifier" error (#414, @vgoma)
-  * Fix: Namespaces would not disable once enabled (#409, @musikov)
-
-2.6.0 / 2016-12-28
-==================
-
-  * Fix: added better null pointer checks for browser useColors (@thebigredgeek)
-  * Improvement: removed explicit `window.debug` export (#404, @tootallnate)
-  * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
-
-2.5.2 / 2016-12-25
-==================
-
-  * Fix: reference error on window within webworkers (#393, @KlausTrainer)
-  * Docs: fixed README typo (#391, @lurch)
-  * Docs: added notice about v3 api discussion (@thebigredgeek)
-
-2.5.1 / 2016-12-20
-==================
-
-  * Fix: babel-core compatibility
-
-2.5.0 / 2016-12-20
-==================
-
-  * Fix: wrong reference in bower file (@thebigredgeek)
-  * Fix: webworker compatibility (@thebigredgeek)
-  * Fix: output formatting issue (#388, @kribblo)
-  * Fix: babel-loader compatibility (#383, @escwald)
-  * Misc: removed built asset from repo and publications (@thebigredgeek)
-  * Misc: moved source files to /src (#378, @yamikuronue)
-  * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
-  * Test: coveralls integration (#378, @yamikuronue)
-  * Docs: simplified language in the opening paragraph (#373, @yamikuronue)
-
-2.4.5 / 2016-12-17
-==================
-
-  * Fix: `navigator` undefined in Rhino (#376, @jochenberger)
-  * Fix: custom log function (#379, @hsiliev)
-  * Improvement: bit of cleanup + linting fixes (@thebigredgeek)
-  * Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
-  * Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
-
-2.4.4 / 2016-12-14
-==================
-
-  * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
-
-2.4.3 / 2016-12-14
-==================
-
-  * Fix: navigation.userAgent error for react native (#364, @escwald)
-
-2.4.2 / 2016-12-14
-==================
-
-  * Fix: browser colors (#367, @tootallnate)
-  * Misc: travis ci integration (@thebigredgeek)
-  * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
-
-2.4.1 / 2016-12-13
-==================
-
-  * Fix: typo that broke the package (#356)
-
-2.4.0 / 2016-12-13
-==================
-
-  * Fix: bower.json references unbuilt src entry point (#342, @justmatt)
-  * Fix: revert "handle regex special characters" (@tootallnate)
-  * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
-  * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
-  * Improvement: allow colors in workers (#335, @botverse)
-  * Improvement: use same color for same namespace. (#338, @lchenay)
-
-2.3.3 / 2016-11-09
-==================
-
-  * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
-  * Fix: Returning `localStorage` saved values (#331, Levi Thomason)
-  * Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
-
-2.3.2 / 2016-11-09
-==================
-
-  * Fix: be super-safe in index.js as well (@TooTallNate)
-  * Fix: should check whether process exists (Tom Newby)
-
-2.3.1 / 2016-11-09
-==================
-
-  * Fix: Added electron compatibility (#324, @paulcbetts)
-  * Improvement: Added performance optimizations (@tootallnate)
-  * Readme: Corrected PowerShell environment variable example (#252, @gimre)
-  * Misc: Removed yarn lock file from source control (#321, @fengmk2)
-
-2.3.0 / 2016-11-07
-==================
-
-  * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
-  * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
-  * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
-  * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
-  * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
-  * Package: Update "ms" to 0.7.2 (#315, @DevSide)
-  * Package: removed superfluous version property from bower.json (#207 @kkirsche)
-  * Readme: fix USE_COLORS to DEBUG_COLORS
-  * Readme: Doc fixes for format string sugar (#269, @mlucool)
-  * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
-  * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
-  * Readme: better docs for browser support (#224, @matthewmueller)
-  * Tooling: Added yarn integration for development (#317, @thebigredgeek)
-  * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
-  * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
-  * Misc: Updated contributors (@thebigredgeek)
-
-2.2.0 / 2015-05-09
-==================
-
-  * package: update "ms" to v0.7.1 (#202, @dougwilson)
-  * README: add logging to file example (#193, @DanielOchoa)
-  * README: fixed a typo (#191, @amir-s)
-  * browser: expose `storage` (#190, @stephenmathieson)
-  * Makefile: add a `distclean` target (#189, @stephenmathieson)
-
-2.1.3 / 2015-03-13
-==================
-
-  * Updated stdout/stderr example (#186)
-  * Updated example/stdout.js to match debug current behaviour
-  * Renamed example/stderr.js to stdout.js
-  * Update Readme.md (#184)
-  * replace high intensity foreground color for bold (#182, #183)
-
-2.1.2 / 2015-03-01
-==================
-
-  * dist: recompile
-  * update "ms" to v0.7.0
-  * package: update "browserify" to v9.0.3
-  * component: fix "ms.js" repo location
-  * changed bower package name
-  * updated documentation about using debug in a browser
-  * fix: security error on safari (#167, #168, @yields)
-
-2.1.1 / 2014-12-29
-==================
-
-  * browser: use `typeof` to check for `console` existence
-  * browser: check for `console.log` truthiness (fix IE 8/9)
-  * browser: add support for Chrome apps
-  * Readme: added Windows usage remarks
-  * Add `bower.json` to properly support bower install
-
-2.1.0 / 2014-10-15
-==================
-
-  * node: implement `DEBUG_FD` env variable support
-  * package: update "browserify" to v6.1.0
-  * package: add "license" field to package.json (#135, @panuhorsmalahti)
-
-2.0.0 / 2014-09-01
-==================
-
-  * package: update "browserify" to v5.11.0
-  * node: use stderr rather than stdout for logging (#29, @stephenmathieson)
-
-1.0.4 / 2014-07-15
-==================
-
-  * dist: recompile
-  * example: remove `console.info()` log usage
-  * example: add "Content-Type" UTF-8 header to browser example
-  * browser: place %c marker after the space character
-  * browser: reset the "content" color via `color: inherit`
-  * browser: add colors support for Firefox >= v31
-  * debug: prefer an instance `log()` function over the global one (#119)
-  * Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
-
-1.0.3 / 2014-07-09
-==================
-
-  * Add support for multiple wildcards in namespaces (#122, @seegno)
-  * browser: fix lint
-
-1.0.2 / 2014-06-10
-==================
-
-  * browser: update color palette (#113, @gscottolson)
-  * common: make console logging function configurable (#108, @timoxley)
-  * node: fix %o colors on old node <= 0.8.x
-  * Makefile: find node path using shell/which (#109, @timoxley)
-
-1.0.1 / 2014-06-06
-==================
-
-  * browser: use `removeItem()` to clear localStorage
-  * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
-  * package: add "contributors" section
-  * node: fix comment typo
-  * README: list authors
-
-1.0.0 / 2014-06-04
-==================
-
-  * make ms diff be global, not be scope
-  * debug: ignore empty strings in enable()
-  * node: make DEBUG_COLORS able to disable coloring
-  * *: export the `colors` array
-  * npmignore: don't publish the `dist` dir
-  * Makefile: refactor to use browserify
-  * package: add "browserify" as a dev dependency
-  * Readme: add Web Inspector Colors section
-  * node: reset terminal color for the debug content
-  * node: map "%o" to `util.inspect()`
-  * browser: map "%j" to `JSON.stringify()`
-  * debug: add custom "formatters"
-  * debug: use "ms" module for humanizing the diff
-  * Readme: add "bash" syntax highlighting
-  * browser: add Firebug color support
-  * browser: add colors for WebKit browsers
-  * node: apply log to `console`
-  * rewrite: abstract common logic for Node & browsers
-  * add .jshintrc file
-
-0.8.1 / 2014-04-14
-==================
-
-  * package: re-add the "component" section
-
-0.8.0 / 2014-03-30
-==================
-
-  * add `enable()` method for nodejs. Closes #27
-  * change from stderr to stdout
-  * remove unnecessary index.js file
-
-0.7.4 / 2013-11-13
-==================
-
-  * remove "browserify" key from package.json (fixes something in browserify)
-
-0.7.3 / 2013-10-30
-==================
-
-  * fix: catch localStorage security error when cookies are blocked (Chrome)
-  * add debug(err) support. Closes #46
-  * add .browser prop to package.json. Closes #42
-
-0.7.2 / 2013-02-06
-==================
-
-  * fix package.json
-  * fix: Mobile Safari (private mode) is broken with debug
-  * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
-
-0.7.1 / 2013-02-05
-==================
-
-  * add repository URL to package.json
-  * add DEBUG_COLORED to force colored output
-  * add browserify support
-  * fix component. Closes #24
-
-0.7.0 / 2012-05-04
-==================
-
-  * Added .component to package.json
-  * Added debug.component.js build
-
-0.6.0 / 2012-03-16
-==================
-
-  * Added support for "-" prefix in DEBUG [Vinay Pulim]
-  * Added `.enabled` flag to the node version [TooTallNate]
-
-0.5.0 / 2012-02-02
-==================
-
-  * Added: humanize diffs. Closes #8
-  * Added `debug.disable()` to the CS variant
-  * Removed padding. Closes #10
-  * Fixed: persist client-side variant again. Closes #9
-
-0.4.0 / 2012-02-01
-==================
-
-  * Added browser variant support for older browsers [TooTallNate]
-  * Added `debug.enable('project:*')` to browser variant [TooTallNate]
-  * Added padding to diff (moved it to the right)
-
-0.3.0 / 2012-01-26
-==================
-
-  * Added millisecond diff when isatty, otherwise UTC string
-
-0.2.0 / 2012-01-22
-==================
-
-  * Added wildcard support
-
-0.1.0 / 2011-12-02
-==================
-
-  * Added: remove colors unless stderr isatty [TooTallNate]
-
-0.0.1 / 2010-01-03
-==================
-
-  * Initial release
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/LICENSE b/legacy-libs/grpc/node_modules/needle/node_modules/debug/LICENSE
deleted file mode 100644 (file)
index 658c933..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
-and associated documentation files (the 'Software'), to deal in the Software without restriction, 
-including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
-and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial 
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 
-LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/README.md b/legacy-libs/grpc/node_modules/needle/node_modules/debug/README.md
deleted file mode 100644 (file)
index 0ee7634..0000000
+++ /dev/null
@@ -1,437 +0,0 @@
-# debug
-[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug)  [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master)  [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
-[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
-
-<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
-
-A tiny JavaScript debugging utility modelled after Node.js core's debugging
-technique. Works in Node.js and web browsers.
-
-## Installation
-
-```bash
-$ npm install debug
-```
-
-## Usage
-
-`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
-
-Example [_app.js_](./examples/node/app.js):
-
-```js
-var debug = require('debug')('http')
-  , http = require('http')
-  , name = 'My App';
-
-// fake app
-
-debug('booting %o', name);
-
-http.createServer(function(req, res){
-  debug(req.method + ' ' + req.url);
-  res.end('hello\n');
-}).listen(3000, function(){
-  debug('listening');
-});
-
-// fake worker of some kind
-
-require('./worker');
-```
-
-Example [_worker.js_](./examples/node/worker.js):
-
-```js
-var a = require('debug')('worker:a')
-  , b = require('debug')('worker:b');
-
-function work() {
-  a('doing lots of uninteresting work');
-  setTimeout(work, Math.random() * 1000);
-}
-
-work();
-
-function workb() {
-  b('doing some work');
-  setTimeout(workb, Math.random() * 2000);
-}
-
-workb();
-```
-
-The `DEBUG` environment variable is then used to enable these based on space or
-comma-delimited names.
-
-Here are some examples:
-
-<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
-<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
-<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
-
-#### Windows command prompt notes
-
-##### CMD
-
-On Windows the environment variable is set using the `set` command.
-
-```cmd
-set DEBUG=*,-not_this
-```
-
-Example:
-
-```cmd
-set DEBUG=* & node app.js
-```
-
-##### PowerShell (VS Code default)
-
-PowerShell uses different syntax to set environment variables.
-
-```cmd
-$env:DEBUG = "*,-not_this"
-```
-
-Example:
-
-```cmd
-$env:DEBUG='app';node app.js
-```
-
-Then, run the program to be debugged as usual.
-
-npm script example:
-```js
-  "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
-```
-
-## Namespace Colors
-
-Every debug instance has a color generated for it based on its namespace name.
-This helps when visually parsing the debug output to identify which debug instance
-a debug line belongs to.
-
-#### Node.js
-
-In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
-the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
-otherwise debug will only use a small handful of basic colors.
-
-<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
-
-#### Web Browser
-
-Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
-option. These are WebKit web inspectors, Firefox ([since version
-31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
-and the Firebug plugin for Firefox (any version).
-
-<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
-
-
-## Millisecond diff
-
-When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
-
-<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
-
-When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
-
-<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
-
-
-## Conventions
-
-If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".  If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable.  You can then use it for normal output as well as debug output.
-
-## Wildcards
-
-The `*` character may be used as a wildcard. Suppose for example your library has
-debuggers named "connect:bodyParser", "connect:compress", "connect:session",
-instead of listing all three with
-`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
-`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
-
-You can also exclude specific debuggers by prefixing them with a "-" character.
-For example, `DEBUG=*,-connect:*` would include all debuggers except those
-starting with "connect:".
-
-## Environment Variables
-
-When running through Node.js, you can set a few environment variables that will
-change the behavior of the debug logging:
-
-| Name      | Purpose                                         |
-|-----------|-------------------------------------------------|
-| `DEBUG`   | Enables/disables specific debugging namespaces. |
-| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY).  |
-| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
-| `DEBUG_DEPTH` | Object inspection depth.                    |
-| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
-
-
-__Note:__ The environment variables beginning with `DEBUG_` end up being
-converted into an Options object that gets used with `%o`/`%O` formatters.
-See the Node.js documentation for
-[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
-for the complete list.
-
-## Formatters
-
-Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
-Below are the officially supported formatters:
-
-| Formatter | Representation |
-|-----------|----------------|
-| `%O`      | Pretty-print an Object on multiple lines. |
-| `%o`      | Pretty-print an Object all on a single line. |
-| `%s`      | String. |
-| `%d`      | Number (both integer and float). |
-| `%j`      | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
-| `%%`      | Single percent sign ('%'). This does not consume an argument. |
-
-
-### Custom formatters
-
-You can add custom formatters by extending the `debug.formatters` object.
-For example, if you wanted to add support for rendering a Buffer as hex with
-`%h`, you could do something like:
-
-```js
-const createDebug = require('debug')
-createDebug.formatters.h = (v) => {
-  return v.toString('hex')
-}
-
-// …elsewhere
-const debug = createDebug('foo')
-debug('this is hex: %h', new Buffer('hello world'))
-//   foo this is hex: 68656c6c6f20776f726c6421 +0ms
-```
-
-
-## Browser Support
-
-You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
-or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
-if you don't want to build it yourself.
-
-Debug's enable state is currently persisted by `localStorage`.
-Consider the situation shown below where you have `worker:a` and `worker:b`,
-and wish to debug both. You can enable this using `localStorage.debug`:
-
-```js
-localStorage.debug = 'worker:*'
-```
-
-And then refresh the page.
-
-```js
-a = debug('worker:a');
-b = debug('worker:b');
-
-setInterval(function(){
-  a('doing some work');
-}, 1000);
-
-setInterval(function(){
-  b('doing some work');
-}, 1200);
-```
-
-
-## Output streams
-
-  By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
-
-Example [_stdout.js_](./examples/node/stdout.js):
-
-```js
-var debug = require('debug');
-var error = debug('app:error');
-
-// by default stderr is used
-error('goes to stderr!');
-
-var log = debug('app:log');
-// set this namespace to log via console.log
-log.log = console.log.bind(console); // don't forget to bind to console!
-log('goes to stdout');
-error('still goes to stderr!');
-
-// set all output to go via console.info
-// overrides all per-namespace log settings
-debug.log = console.info.bind(console);
-error('now goes to stdout via console.info');
-log('still goes to stdout, but via console.info now');
-```
-
-## Extend
-You can simply extend debugger 
-```js
-const log = require('debug')('auth');
-
-//creates new debug instance with extended namespace
-const logSign = log.extend('sign');
-const logLogin = log.extend('login');
-
-log('hello'); // auth hello
-logSign('hello'); //auth:sign hello
-logLogin('hello'); //auth:login hello
-```
-
-## Set dynamically
-
-You can also enable debug dynamically by calling the `enable()` method :
-
-```js
-let debug = require('debug');
-
-console.log(1, debug.enabled('test'));
-
-debug.enable('test');
-console.log(2, debug.enabled('test'));
-
-debug.disable();
-console.log(3, debug.enabled('test'));
-
-```
-
-print :   
-```
-1 false
-2 true
-3 false
-```
-
-Usage :  
-`enable(namespaces)`  
-`namespaces` can include modes separated by a colon and wildcards.
-   
-Note that calling `enable()` completely overrides previously set DEBUG variable : 
-
-```
-$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
-=> false
-```
-
-## Checking whether a debug target is enabled
-
-After you've created a debug instance, you can determine whether or not it is
-enabled by checking the `enabled` property:
-
-```javascript
-const debug = require('debug')('http');
-
-if (debug.enabled) {
-  // do stuff...
-}
-```
-
-You can also manually toggle this property to force the debug instance to be
-enabled or disabled.
-
-
-## Authors
-
- - TJ Holowaychuk
- - Nathan Rajlich
- - Andrew Rhyne
-
-## Backers
-
-Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
-
-<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
-<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
-
-
-## Sponsors
-
-Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
-
-<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
-<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/node.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/node.js
deleted file mode 100644 (file)
index 7fc36fe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./src/node');
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/package.json b/legacy-libs/grpc/node_modules/needle/node_modules/debug/package.json
deleted file mode 100644 (file)
index 0b6ab5d..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-{
-  "_from": "debug@^3.2.6",
-  "_id": "debug@3.2.6",
-  "_inBundle": false,
-  "_integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
-  "_location": "/grpc/needle/debug",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "debug@^3.2.6",
-    "name": "debug",
-    "escapedName": "debug",
-    "rawSpec": "^3.2.6",
-    "saveSpec": null,
-    "fetchSpec": "^3.2.6"
-  },
-  "_requiredBy": [
-    "/grpc/needle"
-  ],
-  "_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
-  "_shasum": "e83d17de16d8a7efb7717edbe5fb10135eee629b",
-  "_shrinkwrap": null,
-  "_spec": "debug@^3.2.6",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/needle",
-  "author": {
-    "name": "TJ Holowaychuk",
-    "email": "tj@vision-media.ca"
-  },
-  "browser": "./src/browser.js",
-  "bugs": {
-    "url": "https://github.com/visionmedia/debug/issues"
-  },
-  "bundleDependencies": false,
-  "contributors": [
-    {
-      "name": "Nathan Rajlich",
-      "email": "nathan@tootallnate.net",
-      "url": "http://n8.io"
-    },
-    {
-      "name": "Andrew Rhyne",
-      "email": "rhyneandrew@gmail.com"
-    }
-  ],
-  "dependencies": {
-    "ms": "^2.1.1"
-  },
-  "deprecated": false,
-  "description": "small debugging utility",
-  "devDependencies": {
-    "@babel/cli": "^7.0.0",
-    "@babel/core": "^7.0.0",
-    "@babel/preset-env": "^7.0.0",
-    "browserify": "14.4.0",
-    "chai": "^3.5.0",
-    "concurrently": "^3.1.0",
-    "coveralls": "^3.0.2",
-    "istanbul": "^0.4.5",
-    "karma": "^3.0.0",
-    "karma-chai": "^0.1.0",
-    "karma-mocha": "^1.3.0",
-    "karma-phantomjs-launcher": "^1.0.2",
-    "mocha": "^5.2.0",
-    "mocha-lcov-reporter": "^1.2.0",
-    "rimraf": "^2.5.4",
-    "xo": "^0.23.0"
-  },
-  "files": [
-    "src",
-    "node.js",
-    "dist/debug.js",
-    "LICENSE",
-    "README.md"
-  ],
-  "homepage": "https://github.com/visionmedia/debug#readme",
-  "keywords": [
-    "debug",
-    "log",
-    "debugger"
-  ],
-  "license": "MIT",
-  "main": "./src/index.js",
-  "name": "debug",
-  "optionalDependencies": {},
-  "readme": "# debug\n[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug)  [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master)  [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)\n\n<img width=\"647\" src=\"https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png\">\n\nA tiny JavaScript debugging utility modelled after Node.js core's debugging\ntechnique. Works in Node.js and web browsers.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.\n\nExample [_app.js_](./examples/node/app.js):\n\n```js\nvar debug = require('debug')('http')\n  , http = require('http')\n  , name = 'My App';\n\n// fake app\n\ndebug('booting %o', name);\n\nhttp.createServer(function(req, res){\n  debug(req.method + ' ' + req.url);\n  res.end('hello\\n');\n}).listen(3000, function(){\n  debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample [_worker.js_](./examples/node/worker.js):\n\n```js\nvar a = require('debug')('worker:a')\n  , b = require('debug')('worker:b');\n\nfunction work() {\n  a('doing lots of uninteresting work');\n  setTimeout(work, Math.random() * 1000);\n}\n\nwork();\n\nfunction workb() {\n  b('doing some work');\n  setTimeout(workb, Math.random() * 2000);\n}\n\nworkb();\n```\n\nThe `DEBUG` environment variable is then used to enable these based on space or\ncomma-delimited names.\n\nHere are some examples:\n\n<img width=\"647\" alt=\"screen shot 2017-08-08 at 12 53 04 pm\" src=\"https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png\">\n<img width=\"647\" alt=\"screen shot 2017-08-08 at 12 53 38 pm\" src=\"https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png\">\n<img width=\"647\" alt=\"screen shot 2017-08-08 at 12 53 25 pm\" src=\"https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png\">\n\n#### Windows command prompt notes\n\n##### CMD\n\nOn Windows the environment variable is set using the `set` command.\n\n```cmd\nset DEBUG=*,-not_this\n```\n\nExample:\n\n```cmd\nset DEBUG=* & node app.js\n```\n\n##### PowerShell (VS Code default)\n\nPowerShell uses different syntax to set environment variables.\n\n```cmd\n$env:DEBUG = \"*,-not_this\"\n```\n\nExample:\n\n```cmd\n$env:DEBUG='app';node app.js\n```\n\nThen, run the program to be debugged as usual.\n\nnpm script example:\n```js\n  \"windowsDebug\": \"@powershell -Command $env:DEBUG='*';node app.js\",\n```\n\n## Namespace Colors\n\nEvery debug instance has a color generated for it based on its namespace name.\nThis helps when visually parsing the debug output to identify which debug instance\na debug line belongs to.\n\n#### Node.js\n\nIn Node.js, colors are enabled when stderr is a TTY. You also _should_ install\nthe [`supports-color`](https://npmjs.org/supports-color) module alongside debug,\notherwise debug will only use a small handful of basic colors.\n\n<img width=\"521\" src=\"https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png\">\n\n#### Web Browser\n\nColors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\noption. These are WebKit web inspectors, Firefox ([since version\n31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\nand the Firebug plugin for Firefox (any version).\n\n<img width=\"524\" src=\"https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png\">\n\n\n## Millisecond diff\n\nWhen actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n<img width=\"647\" src=\"https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png\">\n\nWhen stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:\n\n<img width=\"647\" src=\"https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png\">\n\n\n## Conventions\n\nIf you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\".  If you append a \"*\" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable.  You can then use it for normal output as well as debug output.\n\n## Wildcards\n\nThe `*` character may be used as a wildcard. Suppose for example your library has\ndebuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\",\ninstead of listing all three with\n`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do\n`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\nYou can also exclude specific debuggers by prefixing them with a \"-\" character.\nFor example, `DEBUG=*,-connect:*` would include all debuggers except those\nstarting with \"connect:\".\n\n## Environment Variables\n\nWhen running through Node.js, you can set a few environment variables that will\nchange the behavior of the debug logging:\n\n| Name      | Purpose                                         |\n|-----------|-------------------------------------------------|\n| `DEBUG`   | Enables/disables specific debugging namespaces. |\n| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY).  |\n| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |\n| `DEBUG_DEPTH` | Object inspection depth.                    |\n| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |\n\n\n__Note:__ The environment variables beginning with `DEBUG_` end up being\nconverted into an Options object that gets used with `%o`/`%O` formatters.\nSee the Node.js documentation for\n[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)\nfor the complete list.\n\n## Formatters\n\nDebug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.\nBelow are the officially supported formatters:\n\n| Formatter | Representation |\n|-----------|----------------|\n| `%O`      | Pretty-print an Object on multiple lines. |\n| `%o`      | Pretty-print an Object all on a single line. |\n| `%s`      | String. |\n| `%d`      | Number (both integer and float). |\n| `%j`      | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |\n| `%%`      | Single percent sign ('%'). This does not consume an argument. |\n\n\n### Custom formatters\n\nYou can add custom formatters by extending the `debug.formatters` object.\nFor example, if you wanted to add support for rendering a Buffer as hex with\n`%h`, you could do something like:\n\n```js\nconst createDebug = require('debug')\ncreateDebug.formatters.h = (v) => {\n  return v.toString('hex')\n}\n\n// …elsewhere\nconst debug = createDebug('foo')\ndebug('this is hex: %h', new Buffer('hello world'))\n//   foo this is hex: 68656c6c6f20776f726c6421 +0ms\n```\n\n\n## Browser Support\n\nYou can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),\nor just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),\nif you don't want to build it yourself.\n\nDebug's enable state is currently persisted by `localStorage`.\nConsider the situation shown below where you have `worker:a` and `worker:b`,\nand wish to debug both. You can enable this using `localStorage.debug`:\n\n```js\nlocalStorage.debug = 'worker:*'\n```\n\nAnd then refresh the page.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n  a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n  b('doing some work');\n}, 1200);\n```\n\n\n## Output streams\n\n  By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:\n\nExample [_stdout.js_](./examples/node/stdout.js):\n\n```js\nvar debug = require('debug');\nvar error = debug('app:error');\n\n// by default stderr is used\nerror('goes to stderr!');\n\nvar log = debug('app:log');\n// set this namespace to log via console.log\nlog.log = console.log.bind(console); // don't forget to bind to console!\nlog('goes to stdout');\nerror('still goes to stderr!');\n\n// set all output to go via console.info\n// overrides all per-namespace log settings\ndebug.log = console.info.bind(console);\nerror('now goes to stdout via console.info');\nlog('still goes to stdout, but via console.info now');\n```\n\n## Extend\nYou can simply extend debugger \n```js\nconst log = require('debug')('auth');\n\n//creates new debug instance with extended namespace\nconst logSign = log.extend('sign');\nconst logLogin = log.extend('login');\n\nlog('hello'); // auth hello\nlogSign('hello'); //auth:sign hello\nlogLogin('hello'); //auth:login hello\n```\n\n## Set dynamically\n\nYou can also enable debug dynamically by calling the `enable()` method :\n\n```js\nlet debug = require('debug');\n\nconsole.log(1, debug.enabled('test'));\n\ndebug.enable('test');\nconsole.log(2, debug.enabled('test'));\n\ndebug.disable();\nconsole.log(3, debug.enabled('test'));\n\n```\n\nprint :   \n```\n1 false\n2 true\n3 false\n```\n\nUsage :  \n`enable(namespaces)`  \n`namespaces` can include modes separated by a colon and wildcards.\n   \nNote that calling `enable()` completely overrides previously set DEBUG variable : \n\n```\n$ DEBUG=foo node -e 'var dbg = require(\"debug\"); dbg.enable(\"bar\"); console.log(dbg.enabled(\"foo\"))'\n=> false\n```\n\n## Checking whether a debug target is enabled\n\nAfter you've created a debug instance, you can determine whether or not it is\nenabled by checking the `enabled` property:\n\n```javascript\nconst debug = require('debug')('http');\n\nif (debug.enabled) {\n  // do stuff...\n}\n```\n\nYou can also manually toggle this property to force the debug instance to be\nenabled or disabled.\n\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n - Andrew Rhyne\n\n## Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]\n\n<a href=\"https://opencollective.com/debug/backer/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/9/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/10/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/10/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/11/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/11/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/12/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/12/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/13/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/13/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/14/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/14/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/15/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/15/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/16/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/16/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/17/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/17/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/18/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/18/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/19/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/19/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/20/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/20/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/21/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/21/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/22/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/22/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/23/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/23/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/24/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/24/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/25/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/25/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/26/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/26/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/27/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/27/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/28/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/28/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/backer/29/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/backer/29/avatar.svg\"></a>\n\n\n## Sponsors\n\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]\n\n<a href=\"https://opencollective.com/debug/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/9/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/10/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/10/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/11/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/11/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/12/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/12/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/13/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/13/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/14/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/14/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/15/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/15/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/16/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/16/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/17/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/17/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/18/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/18/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/19/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/19/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/20/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/20/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/21/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/21/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/22/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/22/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/23/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/23/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/24/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/24/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/25/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/25/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/26/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/26/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/27/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/27/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/28/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/28/avatar.svg\"></a>\n<a href=\"https://opencollective.com/debug/sponsor/29/website\" target=\"_blank\"><img src=\"https://opencollective.com/debug/sponsor/29/avatar.svg\"></a>\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/visionmedia/debug.git"
-  },
-  "unpkg": "./dist/debug.js",
-  "version": "3.2.6"
-}
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/browser.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/browser.js
deleted file mode 100644 (file)
index c924b0a..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-"use strict";
-
-function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-
-/* eslint-env browser */
-
-/**
- * This is the web browser implementation of `debug()`.
- */
-exports.log = log;
-exports.formatArgs = formatArgs;
-exports.save = save;
-exports.load = load;
-exports.useColors = useColors;
-exports.storage = localstorage();
-/**
- * Colors.
- */
-
-exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
-/**
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
- * and the Firebug extension (any Firefox version) are known
- * to support "%c" CSS customizations.
- *
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
- */
-// eslint-disable-next-line complexity
-
-function useColors() {
-  // NB: In an Electron preload script, document will be defined but not fully
-  // initialized. Since we know we're in Chrome, we'll just detect this case
-  // explicitly
-  if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
-    return true;
-  } // Internet Explorer and Edge do not support colors.
-
-
-  if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
-    return false;
-  } // Is webkit? http://stackoverflow.com/a/16459606/376773
-  // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
-
-
-  return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
-  typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
-  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
-  typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
-  typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
-}
-/**
- * Colorize log arguments if enabled.
- *
- * @api public
- */
-
-
-function formatArgs(args) {
-  args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
-
-  if (!this.useColors) {
-    return;
-  }
-
-  var c = 'color: ' + this.color;
-  args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
-  // arguments passed either before or after the %c, so we need to
-  // figure out the correct index to insert the CSS into
-
-  var index = 0;
-  var lastC = 0;
-  args[0].replace(/%[a-zA-Z%]/g, function (match) {
-    if (match === '%%') {
-      return;
-    }
-
-    index++;
-
-    if (match === '%c') {
-      // We only are interested in the *last* %c
-      // (the user may have provided their own)
-      lastC = index;
-    }
-  });
-  args.splice(lastC, 0, c);
-}
-/**
- * Invokes `console.log()` when available.
- * No-op when `console.log` is not a "function".
- *
- * @api public
- */
-
-
-function log() {
-  var _console;
-
-  // This hackery is required for IE8/9, where
-  // the `console.log` function doesn't have 'apply'
-  return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
-}
-/**
- * Save `namespaces`.
- *
- * @param {String} namespaces
- * @api private
- */
-
-
-function save(namespaces) {
-  try {
-    if (namespaces) {
-      exports.storage.setItem('debug', namespaces);
-    } else {
-      exports.storage.removeItem('debug');
-    }
-  } catch (error) {// Swallow
-    // XXX (@Qix-) should we be logging these?
-  }
-}
-/**
- * Load `namespaces`.
- *
- * @return {String} returns the previously persisted debug modes
- * @api private
- */
-
-
-function load() {
-  var r;
-
-  try {
-    r = exports.storage.getItem('debug');
-  } catch (error) {} // Swallow
-  // XXX (@Qix-) should we be logging these?
-  // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
-
-
-  if (!r && typeof process !== 'undefined' && 'env' in process) {
-    r = process.env.DEBUG;
-  }
-
-  return r;
-}
-/**
- * Localstorage attempts to return the localstorage.
- *
- * This is necessary because safari throws
- * when a user disables cookies/localstorage
- * and you attempt to access it.
- *
- * @return {LocalStorage}
- * @api private
- */
-
-
-function localstorage() {
-  try {
-    // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
-    // The Browser also has localStorage in the global context.
-    return localStorage;
-  } catch (error) {// Swallow
-    // XXX (@Qix-) should we be logging these?
-  }
-}
-
-module.exports = require('./common')(exports);
-var formatters = module.exports.formatters;
-/**
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
- */
-
-formatters.j = function (v) {
-  try {
-    return JSON.stringify(v);
-  } catch (error) {
-    return '[UnexpectedJSONParseError]: ' + error.message;
-  }
-};
-
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/common.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/common.js
deleted file mode 100644 (file)
index e0de3fb..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-"use strict";
-
-/**
- * This is the common logic for both the Node.js and web browser
- * implementations of `debug()`.
- */
-function setup(env) {
-  createDebug.debug = createDebug;
-  createDebug.default = createDebug;
-  createDebug.coerce = coerce;
-  createDebug.disable = disable;
-  createDebug.enable = enable;
-  createDebug.enabled = enabled;
-  createDebug.humanize = require('ms');
-  Object.keys(env).forEach(function (key) {
-    createDebug[key] = env[key];
-  });
-  /**
-  * Active `debug` instances.
-  */
-
-  createDebug.instances = [];
-  /**
-  * The currently active debug mode names, and names to skip.
-  */
-
-  createDebug.names = [];
-  createDebug.skips = [];
-  /**
-  * Map of special "%n" handling functions, for the debug "format" argument.
-  *
-  * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
-  */
-
-  createDebug.formatters = {};
-  /**
-  * Selects a color for a debug namespace
-  * @param {String} namespace The namespace string for the for the debug instance to be colored
-  * @return {Number|String} An ANSI color code for the given namespace
-  * @api private
-  */
-
-  function selectColor(namespace) {
-    var hash = 0;
-
-    for (var i = 0; i < namespace.length; i++) {
-      hash = (hash << 5) - hash + namespace.charCodeAt(i);
-      hash |= 0; // Convert to 32bit integer
-    }
-
-    return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
-  }
-
-  createDebug.selectColor = selectColor;
-  /**
-  * Create a debugger with the given `namespace`.
-  *
-  * @param {String} namespace
-  * @return {Function}
-  * @api public
-  */
-
-  function createDebug(namespace) {
-    var prevTime;
-
-    function debug() {
-      // Disabled?
-      if (!debug.enabled) {
-        return;
-      }
-
-      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
-        args[_key] = arguments[_key];
-      }
-
-      var self = debug; // Set `diff` timestamp
-
-      var curr = Number(new Date());
-      var ms = curr - (prevTime || curr);
-      self.diff = ms;
-      self.prev = prevTime;
-      self.curr = curr;
-      prevTime = curr;
-      args[0] = createDebug.coerce(args[0]);
-
-      if (typeof args[0] !== 'string') {
-        // Anything else let's inspect with %O
-        args.unshift('%O');
-      } // Apply any `formatters` transformations
-
-
-      var index = 0;
-      args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
-        // If we encounter an escaped % then don't increase the array index
-        if (match === '%%') {
-          return match;
-        }
-
-        index++;
-        var formatter = createDebug.formatters[format];
-
-        if (typeof formatter === 'function') {
-          var val = args[index];
-          match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
-
-          args.splice(index, 1);
-          index--;
-        }
-
-        return match;
-      }); // Apply env-specific formatting (colors, etc.)
-
-      createDebug.formatArgs.call(self, args);
-      var logFn = self.log || createDebug.log;
-      logFn.apply(self, args);
-    }
-
-    debug.namespace = namespace;
-    debug.enabled = createDebug.enabled(namespace);
-    debug.useColors = createDebug.useColors();
-    debug.color = selectColor(namespace);
-    debug.destroy = destroy;
-    debug.extend = extend; // Debug.formatArgs = formatArgs;
-    // debug.rawLog = rawLog;
-    // env-specific initialization logic for debug instances
-
-    if (typeof createDebug.init === 'function') {
-      createDebug.init(debug);
-    }
-
-    createDebug.instances.push(debug);
-    return debug;
-  }
-
-  function destroy() {
-    var index = createDebug.instances.indexOf(this);
-
-    if (index !== -1) {
-      createDebug.instances.splice(index, 1);
-      return true;
-    }
-
-    return false;
-  }
-
-  function extend(namespace, delimiter) {
-    return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
-  }
-  /**
-  * Enables a debug mode by namespaces. This can include modes
-  * separated by a colon and wildcards.
-  *
-  * @param {String} namespaces
-  * @api public
-  */
-
-
-  function enable(namespaces) {
-    createDebug.save(namespaces);
-    createDebug.names = [];
-    createDebug.skips = [];
-    var i;
-    var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
-    var len = split.length;
-
-    for (i = 0; i < len; i++) {
-      if (!split[i]) {
-        // ignore empty strings
-        continue;
-      }
-
-      namespaces = split[i].replace(/\*/g, '.*?');
-
-      if (namespaces[0] === '-') {
-        createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
-      } else {
-        createDebug.names.push(new RegExp('^' + namespaces + '$'));
-      }
-    }
-
-    for (i = 0; i < createDebug.instances.length; i++) {
-      var instance = createDebug.instances[i];
-      instance.enabled = createDebug.enabled(instance.namespace);
-    }
-  }
-  /**
-  * Disable debug output.
-  *
-  * @api public
-  */
-
-
-  function disable() {
-    createDebug.enable('');
-  }
-  /**
-  * Returns true if the given mode name is enabled, false otherwise.
-  *
-  * @param {String} name
-  * @return {Boolean}
-  * @api public
-  */
-
-
-  function enabled(name) {
-    if (name[name.length - 1] === '*') {
-      return true;
-    }
-
-    var i;
-    var len;
-
-    for (i = 0, len = createDebug.skips.length; i < len; i++) {
-      if (createDebug.skips[i].test(name)) {
-        return false;
-      }
-    }
-
-    for (i = 0, len = createDebug.names.length; i < len; i++) {
-      if (createDebug.names[i].test(name)) {
-        return true;
-      }
-    }
-
-    return false;
-  }
-  /**
-  * Coerce `val`.
-  *
-  * @param {Mixed} val
-  * @return {Mixed}
-  * @api private
-  */
-
-
-  function coerce(val) {
-    if (val instanceof Error) {
-      return val.stack || val.message;
-    }
-
-    return val;
-  }
-
-  createDebug.enable(createDebug.load());
-  return createDebug;
-}
-
-module.exports = setup;
-
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/index.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/index.js
deleted file mode 100644 (file)
index 0217315..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-"use strict";
-
-/**
- * Detect Electron renderer / nwjs process, which is node, but we should
- * treat as a browser.
- */
-if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
-  module.exports = require('./browser.js');
-} else {
-  module.exports = require('./node.js');
-}
-
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/node.js b/legacy-libs/grpc/node_modules/needle/node_modules/debug/src/node.js
deleted file mode 100644 (file)
index dbbb5f1..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-"use strict";
-
-/**
- * Module dependencies.
- */
-var tty = require('tty');
-
-var util = require('util');
-/**
- * This is the Node.js implementation of `debug()`.
- */
-
-
-exports.init = init;
-exports.log = log;
-exports.formatArgs = formatArgs;
-exports.save = save;
-exports.load = load;
-exports.useColors = useColors;
-/**
- * Colors.
- */
-
-exports.colors = [6, 2, 3, 4, 5, 1];
-
-try {
-  // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
-  // eslint-disable-next-line import/no-extraneous-dependencies
-  var supportsColor = require('supports-color');
-
-  if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
-    exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
-  }
-} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
-
-/**
- * Build up the default `inspectOpts` object from the environment variables.
- *
- *   $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
- */
-
-
-exports.inspectOpts = Object.keys(process.env).filter(function (key) {
-  return /^debug_/i.test(key);
-}).reduce(function (obj, key) {
-  // Camel-case
-  var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
-    return k.toUpperCase();
-  }); // Coerce string value into JS value
-
-  var val = process.env[key];
-
-  if (/^(yes|on|true|enabled)$/i.test(val)) {
-    val = true;
-  } else if (/^(no|off|false|disabled)$/i.test(val)) {
-    val = false;
-  } else if (val === 'null') {
-    val = null;
-  } else {
-    val = Number(val);
-  }
-
-  obj[prop] = val;
-  return obj;
-}, {});
-/**
- * Is stdout a TTY? Colored output is enabled when `true`.
- */
-
-function useColors() {
-  return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
-}
-/**
- * Adds ANSI color escape codes if enabled.
- *
- * @api public
- */
-
-
-function formatArgs(args) {
-  var name = this.namespace,
-      useColors = this.useColors;
-
-  if (useColors) {
-    var c = this.color;
-    var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
-    var prefix = "  ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
-    args[0] = prefix + args[0].split('\n').join('\n' + prefix);
-    args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
-  } else {
-    args[0] = getDate() + name + ' ' + args[0];
-  }
-}
-
-function getDate() {
-  if (exports.inspectOpts.hideDate) {
-    return '';
-  }
-
-  return new Date().toISOString() + ' ';
-}
-/**
- * Invokes `util.format()` with the specified arguments and writes to stderr.
- */
-
-
-function log() {
-  return process.stderr.write(util.format.apply(util, arguments) + '\n');
-}
-/**
- * Save `namespaces`.
- *
- * @param {String} namespaces
- * @api private
- */
-
-
-function save(namespaces) {
-  if (namespaces) {
-    process.env.DEBUG = namespaces;
-  } else {
-    // If you set a process.env field to null or undefined, it gets cast to the
-    // string 'null' or 'undefined'. Just delete instead.
-    delete process.env.DEBUG;
-  }
-}
-/**
- * Load `namespaces`.
- *
- * @return {String} returns the previously persisted debug modes
- * @api private
- */
-
-
-function load() {
-  return process.env.DEBUG;
-}
-/**
- * Init logic for `debug` instances.
- *
- * Create a new `inspectOpts` object in case `useColors` is set
- * differently for a particular `debug` instance.
- */
-
-
-function init(debug) {
-  debug.inspectOpts = {};
-  var keys = Object.keys(exports.inspectOpts);
-
-  for (var i = 0; i < keys.length; i++) {
-    debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
-  }
-}
-
-module.exports = require('./common')(exports);
-var formatters = module.exports.formatters;
-/**
- * Map %o to `util.inspect()`, all on a single line.
- */
-
-formatters.o = function (v) {
-  this.inspectOpts.colors = this.useColors;
-  return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' ');
-};
-/**
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
- */
-
-
-formatters.O = function (v) {
-  this.inspectOpts.colors = this.useColors;
-  return util.inspect(v, this.inspectOpts);
-};
-
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/ms/index.js b/legacy-libs/grpc/node_modules/needle/node_modules/ms/index.js
deleted file mode 100644 (file)
index c4498bc..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Helpers.
- */
-
-var s = 1000;
-var m = s * 60;
-var h = m * 60;
-var d = h * 24;
-var w = d * 7;
-var y = d * 365.25;
-
-/**
- * Parse or format the given `val`.
- *
- * Options:
- *
- *  - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} [options]
- * @throws {Error} throw an error if val is not a non-empty string or a number
- * @return {String|Number}
- * @api public
- */
-
-module.exports = function(val, options) {
-  options = options || {};
-  var type = typeof val;
-  if (type === 'string' && val.length > 0) {
-    return parse(val);
-  } else if (type === 'number' && isFinite(val)) {
-    return options.long ? fmtLong(val) : fmtShort(val);
-  }
-  throw new Error(
-    'val is not a non-empty string or a valid number. val=' +
-      JSON.stringify(val)
-  );
-};
-
-/**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function parse(str) {
-  str = String(str);
-  if (str.length > 100) {
-    return;
-  }
-  var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
-    str
-  );
-  if (!match) {
-    return;
-  }
-  var n = parseFloat(match[1]);
-  var type = (match[2] || 'ms').toLowerCase();
-  switch (type) {
-    case 'years':
-    case 'year':
-    case 'yrs':
-    case 'yr':
-    case 'y':
-      return n * y;
-    case 'weeks':
-    case 'week':
-    case 'w':
-      return n * w;
-    case 'days':
-    case 'day':
-    case 'd':
-      return n * d;
-    case 'hours':
-    case 'hour':
-    case 'hrs':
-    case 'hr':
-    case 'h':
-      return n * h;
-    case 'minutes':
-    case 'minute':
-    case 'mins':
-    case 'min':
-    case 'm':
-      return n * m;
-    case 'seconds':
-    case 'second':
-    case 'secs':
-    case 'sec':
-    case 's':
-      return n * s;
-    case 'milliseconds':
-    case 'millisecond':
-    case 'msecs':
-    case 'msec':
-    case 'ms':
-      return n;
-    default:
-      return undefined;
-  }
-}
-
-/**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
-
-function fmtShort(ms) {
-  var msAbs = Math.abs(ms);
-  if (msAbs >= d) {
-    return Math.round(ms / d) + 'd';
-  }
-  if (msAbs >= h) {
-    return Math.round(ms / h) + 'h';
-  }
-  if (msAbs >= m) {
-    return Math.round(ms / m) + 'm';
-  }
-  if (msAbs >= s) {
-    return Math.round(ms / s) + 's';
-  }
-  return ms + 'ms';
-}
-
-/**
- * Long format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
-
-function fmtLong(ms) {
-  var msAbs = Math.abs(ms);
-  if (msAbs >= d) {
-    return plural(ms, msAbs, d, 'day');
-  }
-  if (msAbs >= h) {
-    return plural(ms, msAbs, h, 'hour');
-  }
-  if (msAbs >= m) {
-    return plural(ms, msAbs, m, 'minute');
-  }
-  if (msAbs >= s) {
-    return plural(ms, msAbs, s, 'second');
-  }
-  return ms + ' ms';
-}
-
-/**
- * Pluralization helper.
- */
-
-function plural(ms, msAbs, n, name) {
-  var isPlural = msAbs >= n * 1.5;
-  return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
-}
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/ms/license.md b/legacy-libs/grpc/node_modules/needle/node_modules/ms/license.md
deleted file mode 100644 (file)
index 69b6125..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Zeit, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/ms/package.json b/legacy-libs/grpc/node_modules/needle/node_modules/ms/package.json
deleted file mode 100644 (file)
index 71ca8d8..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-{
-  "_from": "ms@^2.1.1",
-  "_id": "ms@2.1.2",
-  "_inBundle": false,
-  "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
-  "_location": "/grpc/needle/ms",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "ms@^2.1.1",
-    "name": "ms",
-    "escapedName": "ms",
-    "rawSpec": "^2.1.1",
-    "saveSpec": null,
-    "fetchSpec": "^2.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/needle/debug"
-  ],
-  "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-  "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009",
-  "_shrinkwrap": null,
-  "_spec": "ms@^2.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/needle/node_modules/debug",
-  "bugs": {
-    "url": "https://github.com/zeit/ms/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "Tiny millisecond conversion utility",
-  "devDependencies": {
-    "eslint": "4.12.1",
-    "expect.js": "0.3.1",
-    "husky": "0.14.3",
-    "lint-staged": "5.0.0",
-    "mocha": "4.0.1"
-  },
-  "eslintConfig": {
-    "extends": "eslint:recommended",
-    "env": {
-      "node": true,
-      "es6": true
-    }
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/zeit/ms#readme",
-  "license": "MIT",
-  "lint-staged": {
-    "*.js": [
-      "npm run lint",
-      "prettier --single-quote --write",
-      "git add"
-    ]
-  },
-  "main": "./index",
-  "name": "ms",
-  "optionalDependencies": {},
-  "readme": "# ms\n\n[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)\n[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)\n\nUse this package to easily convert various time formats to milliseconds.\n\n## Examples\n\n```js\nms('2 days')  // 172800000\nms('1d')      // 86400000\nms('10h')     // 36000000\nms('2.5 hrs') // 9000000\nms('2h')      // 7200000\nms('1m')      // 60000\nms('5s')      // 5000\nms('1y')      // 31557600000\nms('100')     // 100\nms('-3 days') // -259200000\nms('-1h')     // -3600000\nms('-200')    // -200\n```\n\n### Convert from Milliseconds\n\n```js\nms(60000)             // \"1m\"\nms(2 * 60000)         // \"2m\"\nms(-3 * 60000)        // \"-3m\"\nms(ms('10 hours'))    // \"10h\"\n```\n\n### Time Format Written-Out\n\n```js\nms(60000, { long: true })             // \"1 minute\"\nms(2 * 60000, { long: true })         // \"2 minutes\"\nms(-3 * 60000, { long: true })        // \"-3 minutes\"\nms(ms('10 hours'), { long: true })    // \"10 hours\"\n```\n\n## Features\n\n- Works both in [Node.js](https://nodejs.org) and in the browser\n- If a number is supplied to `ms`, a string with a unit is returned\n- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)\n- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned\n\n## Related Packages\n\n- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.\n\n## Caught a Bug?\n\n1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device\n2. Link the package to the global module directory: `npm link`\n3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!\n\nAs always, you can run the tests using: `npm test`\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/zeit/ms.git"
-  },
-  "scripts": {
-    "lint": "eslint lib/* bin/*",
-    "precommit": "lint-staged",
-    "test": "mocha tests.js"
-  },
-  "version": "2.1.2"
-}
diff --git a/legacy-libs/grpc/node_modules/needle/node_modules/ms/readme.md b/legacy-libs/grpc/node_modules/needle/node_modules/ms/readme.md
deleted file mode 100644 (file)
index 9a1996b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# ms
-
-[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
-[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
-
-Use this package to easily convert various time formats to milliseconds.
-
-## Examples
-
-```js
-ms('2 days')  // 172800000
-ms('1d')      // 86400000
-ms('10h')     // 36000000
-ms('2.5 hrs') // 9000000
-ms('2h')      // 7200000
-ms('1m')      // 60000
-ms('5s')      // 5000
-ms('1y')      // 31557600000
-ms('100')     // 100
-ms('-3 days') // -259200000
-ms('-1h')     // -3600000
-ms('-200')    // -200
-```
-
-### Convert from Milliseconds
-
-```js
-ms(60000)             // "1m"
-ms(2 * 60000)         // "2m"
-ms(-3 * 60000)        // "-3m"
-ms(ms('10 hours'))    // "10h"
-```
-
-### Time Format Written-Out
-
-```js
-ms(60000, { long: true })             // "1 minute"
-ms(2 * 60000, { long: true })         // "2 minutes"
-ms(-3 * 60000, { long: true })        // "-3 minutes"
-ms(ms('10 hours'), { long: true })    // "10 hours"
-```
-
-## Features
-
-- Works both in [Node.js](https://nodejs.org) and in the browser
-- If a number is supplied to `ms`, a string with a unit is returned
-- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
-- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
-
-## Related Packages
-
-- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
-
-## Caught a Bug?
-
-1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
-2. Link the package to the global module directory: `npm link`
-3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
-
-As always, you can run the tests using: `npm test`
diff --git a/legacy-libs/grpc/node_modules/needle/package.json b/legacy-libs/grpc/node_modules/needle/package.json
deleted file mode 100644 (file)
index 1527e38..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-{
-  "_from": "needle@^2.2.1",
-  "_id": "needle@2.4.0",
-  "_inBundle": false,
-  "_integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==",
-  "_location": "/grpc/needle",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "needle@^2.2.1",
-    "name": "needle",
-    "escapedName": "needle",
-    "rawSpec": "^2.2.1",
-    "saveSpec": null,
-    "fetchSpec": "^2.2.1"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz",
-  "_shasum": "6833e74975c444642590e15a750288c5f939b57c",
-  "_shrinkwrap": null,
-  "_spec": "needle@^2.2.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp",
-  "author": {
-    "name": "Tomás Pollak",
-    "email": "tomas@forkhq.com"
-  },
-  "bin": {
-    "needle": "./bin/needle"
-  },
-  "bugs": {
-    "url": "https://github.com/tomas/needle/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "debug": "^3.2.6",
-    "iconv-lite": "^0.4.4",
-    "sax": "^1.2.4"
-  },
-  "deprecated": false,
-  "description": "The leanest and most handsome HTTP client in the Nodelands.",
-  "devDependencies": {
-    "JSONStream": "^1.3.5",
-    "jschardet": "^1.6.0",
-    "mocha": "^5.2.0",
-    "q": "^1.5.1",
-    "should": "^13.2.3",
-    "sinon": "^2.3.0",
-    "xml2js": "^0.4.19"
-  },
-  "directories": {
-    "lib": "./lib"
-  },
-  "engines": {
-    "node": ">= 4.4.x"
-  },
-  "homepage": "https://github.com/tomas/needle#readme",
-  "keywords": [
-    "http",
-    "https",
-    "simple",
-    "request",
-    "client",
-    "multipart",
-    "upload",
-    "proxy",
-    "deflate",
-    "timeout",
-    "charset",
-    "iconv",
-    "cookie",
-    "redirect"
-  ],
-  "license": "MIT",
-  "main": "./lib/needle",
-  "name": "needle",
-  "optionalDependencies": {},
-  "readme": "Needle\n======\n\n[![NPM](https://nodei.co/npm/needle.png)](https://nodei.co/npm/needle/)\n\nThe leanest and most handsome HTTP client in the Nodelands.\n\n```js\nvar needle = require('needle');\n\nneedle.get('http://www.google.com', function(error, response) {\n  if (!error && response.statusCode == 200)\n    console.log(response.body);\n});\n```\n\nCallbacks not floating your boat? Needle got your back.\n\n``` js\nvar data = {\n  file: '/home/johnlennon/walrus.png',\n  content_type: 'image/png'\n};\n\n// the callback is optional, and needle returns a `readableStream` object\n// that triggers a 'done' event when the request/response process is complete.\nneedle\n  .post('https://my.server.com/foo', data, { multipart: true })\n  .on('readable', function() { /* eat your chunks */ })\n  .on('done', function(err, resp) {\n    console.log('Ready-o!');\n  })\n```\n\nFrom version 2.0.x up, Promises are also supported. Just call `needle()` directly and you'll get a native Promise object.\n\n```js\nneedle('put', 'https://hacking.the.gibson/login', { password: 'god' }, { json: true })\n  .then(function(response) {\n    return doSomethingWith(response)\n  })\n  .catch(function(err) {\n    console.log('Call the locksmith!')\n  })\n```\n\nWith only two real dependencies, Needle supports:\n\n - HTTP/HTTPS requests, with the usual verbs you would expect\n - All of Node's native TLS options, such as 'rejectUnauthorized' (see below)\n - Basic & Digest authentication with auto-detection\n - Multipart form-data (e.g. file uploads)\n - HTTP Proxy forwarding, optionally with authentication\n - Streaming gzip or deflate decompression\n - Automatic XML & JSON parsing\n - 301/302/303 redirect following, with fine-grained tuning, and\n - Streaming non-UTF-8 charset decoding, via `iconv-lite`\n\nAnd yes, Mr. Wayne, it does come in black.\n\nThis makes Needle an ideal alternative for performing quick HTTP requests in Node, either for API interaction, downloading or uploading streams of data, and so on. If you need OAuth, AWS support or anything fancier, you should check out mikeal's request module.\n\nInstall\n-------\n\n```\n$ npm install needle\n```\n\nUsage\n-----\n\n```js\n// using promises\nneedle('get', 'https://server.com/posts/12')\n  .then(function(resp) {\n    // ...\n  })\n  .catch(function(err) {\n    // ...\n  });\n\n// with callback\nneedle.get('ifconfig.me/all.json', function(error, response, body) {\n  if (error) throw error;\n\n  // body is an alias for `response.body`,\n  // that in this case holds a JSON-decoded object.\n  console.log(body.ip_addr);\n});\n\n// no callback, using streams\nvar out = fs.createWriteStream('logo.png');\nneedle.get('https://google.com/images/logo.png').pipe(out).on('finish', function() {\n  console.log('Pipe finished!');\n});\n```\n\nAs you can see, you can use Needle with Promises or without them. When using Promises or when a callback is passed, the response's body will be buffered and written to `response.body`, and the callback will be fired when all of the data has been collected and processed (e.g. decompressed, decoded and/or parsed).\n\nWhen no callback is passed, however, the buffering logic will be skipped but the response stream will still go through Needle's processing pipeline, so you get all the benefits of post-processing while keeping the streamishness we all love from Node.\n\nResponse pipeline\n-----------------\n\nDepending on the response's Content-Type, Needle will either attempt to parse JSON or XML streams, or, if a text response was received, will ensure that the final encoding you get is UTF-8.\n\nYou can also request a gzip/deflated response, which, if sent by the server, will be processed before parsing or decoding is performed.\n\n```js\nneedle.get('http://stackoverflow.com/feeds', { compressed: true }, function(err, resp) {\n  console.log(resp.body); // this little guy won't be a Gzipped binary blob\n                          // but a nice object containing all the latest entries\n});\n```\n\nOr in anti-callback mode, using a few other options:\n\n```js\nvar options = {\n  compressed         : true, // sets 'Accept-Encoding' to 'gzip,deflate'\n  follow_max         : 5,    // follow up to five redirects\n  rejectUnauthorized : true  // verify SSL certificate\n}\n\nvar stream = needle.get('https://backend.server.com/everything.html', options);\n\n// read the chunks from the 'readable' event, so the stream gets consumed.\nstream.on('readable', function() {\n  while (data = this.read()) {\n    console.log(data.toString());\n  }\n})\n\nstream.on('done', function(err) {\n  // if our request had an error, our 'done' event will tell us.\n  if (!err) console.log('Great success!');\n})\n```\n\nAPI\n---\n\n### needle(method, url[, data][, options][, callback]) `(> 2.0.x)`\n\nCalling `needle()` directly returns a Promise. Besides `method` and `url`, all parameters are optional, although when sending a `post`, `put` or `patch` request you will get an error if `data` is not present.\n\n```js\nneedle('get', 'http://some.url.com')\n  .then(function(resp) { console.log(resp.body) })\n  .catch(function(err) { console.error(err) })\n})\n```\n\nExcept from the above, all of Needle's request methods return a Readable stream, and both `options` and `callback` are optional. If passed, the callback will return three arguments: `error`, `response` and `body`, which is basically an alias for `response.body`.\n\n### needle.head(url[, options][, callback])\n\n```js\nneedle.head('https://my.backend.server.com', {\n  open_timeout: 5000 // if we're not able to open a connection in 5 seconds, boom.\n}, function(err, resp) {\n  if (err)\n    console.log('Shoot! Something is wrong: ' + err.message)\n  else\n    console.log('Yup, still alive.')\n})\n```\n\n### needle.get(url[, options][, callback])\n\n```js\nneedle.get('google.com/search?q=syd+barrett', function(err, resp) {\n  // if no http:// is found, Needle will automagically prepend it.\n});\n```\n\n### needle.post(url, data[, options][, callback])\n\n```js\nvar options = {\n  headers: { 'X-Custom-Header': 'Bumbaway atuna' }\n}\n\nneedle.post('https://my.app.com/endpoint', 'foo=bar', options, function(err, resp) {\n  // you can pass params as a string or as an object.\n});\n```\n\n### needle.put(url, data[, options][, callback])\n\n```js\nvar nested = {\n  params: {\n    are: {\n      also: 'supported'\n    }\n  }\n}\n\nneedle.put('https://api.app.com/v2', nested, function(err, resp) {\n  console.log('Got ' + resp.bytes + ' bytes.') // another nice treat from this handsome fella.\n});\n```\n\n### needle.patch(url, data[, options][, callback])\n\nSame behaviour as PUT.\n\n### needle.delete(url, data[, options][, callback])\n\n```js\nvar options = {\n  username: 'fidelio',\n  password: 'x'\n}\n\nneedle.delete('https://api.app.com/messages/123', null, options, function(err, resp) {\n  // in this case, data may be null, but you need to explicity pass it.\n});\n```\n\n### needle.request(method, url, data[, options][, callback])\n\nGeneric request. This not only allows for flexibility, but also lets you perform a GET request with data, in which case will be appended to the request as a query string, unless you pass a `json: true` option (read below).\n\n```js\nvar params = {\n  q    : 'a very smart query',\n  page : 2\n}\n\nneedle.request('get', 'forum.com/search', params, function(err, resp) {\n  if (!err && resp.statusCode == 200)\n    console.log(resp.body); // here you go, mister.\n});\n```\n\nNow, if you set pass `json: true` among the options, Needle won't set your params as a querystring but instead send a JSON representation of your data through the request's body, as well as set the `Content-Type` and `Accept` headers to `application/json`.\n\n```js\nneedle.request('get', 'forum.com/search', params, { json: true }, function(err, resp) {\n  if (resp.statusCode == 200) console.log('It worked!');\n});\n```\n\nEvents\n------\n\nThe [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) object returned by the above request methods emits the following events, in addition to the regular ones (e.g. `end`, `close`, `data`, `pipe`, `readable`).\n\n### Event: `'response'`\n\n - `response <http.IncomingMessage>`\n\nEmitted when the underlying [http.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest) emits a response event. This is after the connection is established and the header received, but before any of it is processed (e.g. authorization required or redirect to be followed). No data has been consumed at this point.\n\n### Event: `'redirect'`\n\n - `location <String>`\n\nIndicates that the a redirect is being followed. This means that the response code was a redirect (`301`, `302`, `303`, `307`) and the given [redirect options](#redirect-options) allowed following the URL received in the `Location` header.\n\n### Event: `'header'`\n\n - `statusCode <Integer>`\n - `headers <Object>`\n\nTriggered after the header has been processed, and just before the data is to be consumed. This implies that no redirect was followed and/or authentication header was received. In other words, we got a \"valid\" response.\n\n### Event: `'done'` (previously 'end')\n\n - `exception <Error>` (optional)\n\nEmitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. Unlike a regular stream's `end` event, Needle's `done` will be fired either on success or on failure, which is why the first argument may be an Error object. In other words:\n\n```js\nvar resp = needle.get('something.worthy/of/being/streamed/by/needle');\nresp.pipe(someWritableStream);\n\nresp.on('done', function(err) {\n  if (err) console.log('An error ocurred: ' + err.message);\n  else console.log('Great success!');\n})\n```\n\n### Event: `'err'`\n\n - `exception <Error>`\n\nEmitted when an error ocurrs. This should only happen once in the lifecycle of a Needle request.\n\n### Event: `'timeout'`\n\n - `type <String>`\n\nEmitted when an timeout error occurs. Type can be either 'open', 'response', or 'read'. This will called right before aborting the request, which will also trigger an `err` event, a described above, with an `ECONNRESET` (Socket hang up) exception.\n\nRequest options\n---------------\n\nFor information about options that've changed, there's always [the changelog](https://github.com/tomas/needle/releases).\n\n - `agent`       : Uses an [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent) of your choice, instead of the global, default one. Useful for tweaking the behaviour at the connection level, such as when doing tunneling (see below for an example).\n - `json`        : When `true`, sets content type to `application/json` and sends request body as JSON string, instead of a query string.\n - `open_timeout`: (or `timeout`) Returns error if connection takes longer than X milisecs to establish. Defaults to `10000` (10 secs). `0` means no timeout.\n - `response_timeout`: Returns error if no response headers are received in X milisecs, counting from when the connection is opened. Defaults to `0` (no response timeout).\n - `read_timeout`: Returns error if data transfer takes longer than X milisecs, once response headers are received. Defaults to `0` (no timeout).\n - `follow_max`  : (or `follow`) Number of redirects to follow. Defaults to `0`. See below for more redirect options.\n - `multipart`   : Enables multipart/form-data encoding. Defaults to `false`. Use it when uploading files.\n - `proxy`       : Forwards request through HTTP(s) proxy. Eg. `proxy: 'http://user:pass@proxy.server.com:3128'`. For more advanced proxying/tunneling use a custom `agent`, as described below.\n - `headers`     : Object containing custom HTTP headers for request. Overrides defaults described below.\n - `auth`        : Determines what to do with provided username/password. Options are `auto`, `digest` or `basic` (default). `auto` will detect the type of authentication depending on the response headers.\n - `stream_length`: When sending streams, this lets you manually set the Content-Length header --if the stream's bytecount is known beforehand--, preventing ECONNRESET (socket hang up) errors on some servers that misbehave when receiving payloads of unknown size. Set it to `0` and Needle will get and set the stream's length for you, or leave unset for the default behaviour, which is no Content-Length header for stream payloads.\n - `localAddress`     : <string>, IP address. Passed to http/https request. Local interface from witch the request should be emitted.\n\nResponse options\n----------------\n\n - `decode_response` : (or `decode`) Whether to decode the text responses to UTF-8, if Content-Type header shows a different charset. Defaults to `true`.\n - `parse_response`  : (or `parse`) Whether to parse XML or JSON response bodies automagically. Defaults to `true`. You can also set this to 'xml' or 'json' in which case Needle will *only* parse the response if the content type matches.\n - `output`          : Dump response output to file. This occurs after parsing and charset decoding is done.\n - `parse_cookies`   : Whether to parse response’s `Set-Cookie` header. Defaults to `true`. If parsed, response cookies will be available at `resp.cookies`.\n\nHTTP Header options\n-------------------\n\nThese are basically shortcuts to the `headers` option described above.\n\n - `cookies`   : Builds and sets a Cookie header from a `{ key: 'value' }` object.\n - `compressed`: If `true`, sets 'Accept-Encoding' header to 'gzip,deflate', and inflates content if zipped. Defaults to `false`.\n - `username`  : For HTTP basic auth.\n - `password`  : For HTTP basic auth. Requires username to be passed, but is optional.\n - `accept`    : Sets 'Accept' HTTP header. Defaults to `*/*`.\n - `connection`: Sets 'Connection' HTTP header. Not set by default, unless running Node < 0.11.4 in which case it defaults to `close`. More info about this below.\n - `user_agent`: Sets the 'User-Agent' HTTP header. Defaults to `Needle/{version} (Node.js {node_version})`.\n - `content_type`: Sets the 'Content-Type' header. Unset by default, unless you're sending data in which case it's set accordingly to whatever is being sent (`application/x-www-form-urlencoded`, `application/json` or `multipart/form-data`). That is, of course, unless the option is passed, either here or through `options.headers`. You're the boss.\n\nNode.js TLS Options\n-------------------\n\nThese options are passed directly to `https.request` if present. Taken from the [original documentation](http://nodejs.org/docs/latest/api/https.html):\n\n - `pfx`                : Certificate, Private key and CA certificates to use for SSL.\n - `key`                : Private key to use for SSL.\n - `passphrase`         : A string of passphrase for the private key or pfx.\n - `cert`               : Public x509 certificate to use.\n - `ca`                 : An authority certificate or array of authority certificates to check the remote host against.\n - `ciphers`            : A string describing the ciphers to use or exclude.\n - `rejectUnauthorized` : If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent.\n - `secureProtocol`     : The SSL method to use, e.g. SSLv3_method to force SSL version 3.\n\nRedirect options\n----------------\n\nThese options only apply if the `follow_max` (or `follow`) option is higher than 0.\n\n - `follow_set_cookies`      : Sends the cookies received in the `set-cookie` header as part of the following request. `false` by default.\n - `follow_set_referer`      : Sets the 'Referer' header to the requested URI when following a redirect. `false` by default.\n - `follow_keep_method`      : If enabled, resends the request using the original verb instead of being rewritten to `get` with no data. `false` by default.\n - `follow_if_same_host`     : When true, Needle will only follow redirects that point to the same host as the original request. `false` by default.\n - `follow_if_same_protocol` : When true, Needle will only follow redirects that point to the same protocol as the original request. `false` by default.\n\nOverriding Defaults\n-------------------\n\nYes sir, we have it. Needle includes a `defaults()` method, that lets you override some of the defaults for all future requests. Like this:\n\n```js\nneedle.defaults({\n  open_timeout: 60000,\n  user_agent: 'MyApp/1.2.3',\n  parse_response: false });\n```\n\nThis will override Needle's default user agent and 10-second timeout, and disable response parsing, so you don't need to pass those options in every other request.\n\nMore advanced Proxy support\n---------------------------\n\nSince you can pass a custom HTTPAgent to Needle you can do all sorts of neat stuff. For example, if you want to use the [`tunnel`](https://github.com/koichik/node-tunnel) module for HTTPS proxying, you can do this:\n\n```js\nvar tunnel = require('tunnel');\nvar myAgent = tunnel.httpOverHttp({\n  proxy: { host: 'localhost' }\n});\n\nneedle.get('foobar.com', { agent: myAgent });\n```\n\nRegarding the 'Connection' header\n---------------------------------\n\nUnless you're running an old version of Node (< 0.11.4), by default Needle won't set the Connection header on requests, yielding Node's default behaviour of keeping the connection alive with the target server. This speeds up inmensely the process of sending several requests to the same host.\n\nOn older versions, however, this has the unwanted behaviour of preventing the runtime from exiting, either because of a bug or 'feature' that was changed on 0.11.4. To overcome this Needle does set the 'Connection' header to 'close' on those versions, however this also means that making new requests to the same host doesn't benefit from Keep-Alive.\n\nSo if you're stuck on 0.10 or even lower and want full speed, you can simply set the Connection header to 'Keep-Alive' by using `{ connection: 'Keep-Alive' }`. Please note, though, that an event loop handler will prevent the runtime from exiting so you'll need to manually call `process.exit()` or the universe will collapse.\n\nExamples Galore\n---------------\n\n### HTTPS GET with Basic Auth\n\n```js\nneedle.get('https://api.server.com', { username: 'you', password: 'secret' },\n  function(err, resp) {\n    // used HTTP auth\n});\n```\n\nOr use [RFC-1738](http://tools.ietf.org/html/rfc1738#section-3.1) basic auth URL syntax:\n\n```js\nneedle.get('https://username:password@api.server.com', function(err, resp) {\n    // used HTTP auth from URL\n});\n```\n\n### Digest Auth\n\n```js\nneedle.get('other.server.com', { username: 'you', password: 'secret', auth: 'digest' },\n  function(err, resp, body) {\n    // needle prepends 'http://' to your URL, if missing\n});\n```\n\n### Custom Accept header, deflate\n\n```js\nvar options = {\n  compressed : true,\n  follow     : 10,\n  accept     : 'application/vnd.github.full+json'\n}\n\nneedle.get('api.github.com/users/tomas', options, function(err, resp, body) {\n  // body will contain a JSON.parse(d) object\n  // if parsing fails, you'll simply get the original body\n});\n```\n\n### GET XML object\n\n```js\nneedle.get('https://news.ycombinator.com/rss', function(err, resp, body) {\n  // you'll get a nice object containing the nodes in the RSS\n});\n```\n\n### GET binary, output to file\n\n```js\nneedle.get('http://upload.server.com/tux.png', { output: '/tmp/tux.png' }, function(err, resp, body) {\n  // you can dump any response to a file, not only binaries.\n});\n```\n\n### GET through proxy\n\n```js\nneedle.get('http://search.npmjs.org', { proxy: 'http://localhost:1234' }, function(err, resp, body) {\n  // request passed through proxy\n});\n```\n\n### GET a very large document in a stream (from 0.7+)\n\n```js\nvar stream = needle.get('http://www.as35662.net/100.log');\n\nstream.on('readable', function() {\n  var chunk;\n  while (chunk = this.read()) {\n    console.log('got data: ', chunk);\n  }\n});\n```\n\n### GET JSON object in a stream (from 0.7+)\n\n```js\nvar stream = needle.get('http://jsonplaceholder.typicode.com/db', { parse: true });\n\nstream.on('readable', function() {\n  var node;\n\n  // our stream will only emit a single JSON root node.\n  while (node = this.read()) {\n    console.log('got data: ', node);\n  }\n});\n```\n\n### GET JSONStream flexible parser with search query (from 0.7+)\n\n```js\n\n // The 'data' element of this stream will be the string representation\n // of the titles of all posts.\n\nneedle.get('http://jsonplaceholder.typicode.com/db', { parse: true })\n      .pipe(new JSONStream.parse('posts.*.title'));\n      .on('data', function (obj) {\n        console.log('got post title: %s', obj);\n      });\n```\n\n### File upload using multipart, passing file path\n\n```js\nvar data = {\n  foo: 'bar',\n  image: { file: '/home/tomas/linux.png', content_type: 'image/png' }\n}\n\nneedle.post('http://my.other.app.com', data, { multipart: true }, function(err, resp, body) {\n  // needle will read the file and include it in the form-data as binary\n});\n```\n\n### Stream upload, PUT or POST\n\n``` js\nneedle.put('https://api.app.com/v2', fs.createReadStream('myfile.txt'), function(err, resp, body) {\n  // stream content is uploaded verbatim\n});\n```\n\n### Multipart POST, passing data buffer\n\n```js\nvar buffer = fs.readFileSync('/path/to/package.zip');\n\nvar data = {\n  zip_file: {\n    buffer       : buffer,\n    filename     : 'mypackage.zip',\n    content_type : 'application/octet-stream'\n  }\n}\n\nneedle.post('http://somewhere.com/over/the/rainbow', data, { multipart: true }, function(err, resp, body) {\n  // if you see, when using buffers we need to pass the filename for the multipart body.\n  // you can also pass a filename when using the file path method, in case you want to override\n  // the default filename to be received on the other end.\n});\n```\n\n### Multipart with custom Content-Type\n\n```js\nvar data = {\n  token: 'verysecret',\n  payload: {\n    value: JSON.stringify({ title: 'test', version: 1 }),\n    content_type: 'application/json'\n  }\n}\n\nneedle.post('http://test.com/', data, { timeout: 5000, multipart: true }, function(err, resp, body) {\n  // in this case, if the request takes more than 5 seconds\n  // the callback will return a [Socket closed] error\n});\n```\n\nFor even more examples, check out the examples directory in the repo.\n\n### Testing\n\nTo run tests, you need to generate a self-signed SSL certificate in the `test` directory. After cloning the repository, run the following commands:\n\n    $ mkdir -p test/keys\n    $ openssl genrsa -out test/keys/ssl.key 2048\n    $ openssl req -new -key test/keys/ssl.key -x509 -days 999 -out test/keys/ssl.cert\n\nThen you should be able to run `npm test` once you have the dependencies in place.\n\n> Note: Tests currently only work on linux-based environments that have `/proc/self/fd`. They *do not* work on MacOS environments.\n> You can use Docker to run tests by creating a container and mounting the needle project directory on `/app`\n> `docker create --name Needle -v /app -w /app -v /app/node_modules -i node:argon`\n\nCredits\n-------\n\nWritten by Tomás Pollak, with the help of contributors.\n\nCopyright\n---------\n\n(c) Fork Ltd. Licensed under the MIT license.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/tomas/needle.git"
-  },
-  "scripts": {
-    "test": "mocha test"
-  },
-  "tags": [
-    "http",
-    "https",
-    "simple",
-    "request",
-    "client",
-    "multipart",
-    "upload",
-    "proxy",
-    "deflate",
-    "timeout",
-    "charset",
-    "iconv",
-    "cookie",
-    "redirect"
-  ],
-  "version": "2.4.0"
-}
diff --git a/legacy-libs/grpc/node_modules/needle/test/basic_auth_spec.js b/legacy-libs/grpc/node_modules/needle/test/basic_auth_spec.js
deleted file mode 100644 (file)
index 343f1db..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-var helpers = require('./helpers'),
-    should  = require('should'),
-    needle  = require('./../'),
-    server;
-
-var port = 7707;
-
-describe('Basic Auth', function() {
-
-  before(function(done) {
-    server = helpers.server({ port: port }, done);
-  })
-
-  after(function(done) {
-    server.close(done);
-  })
-
-  ///////////////// helpers
-
-  var get_auth = function(header) {
-    var token  = header.split(/\s+/).pop();
-    return token && Buffer.from(token, 'base64').toString().split(':');
-  }
-
-  describe('when neither username or password are passed', function() {
-
-    it('doesnt send any Authorization headers', function(done) {
-      needle.get('localhost:' + port, { parse: true }, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.not.containEql('authorization');
-        done();
-      })
-    })
-
-  })
-
-  describe('when username is an empty string, and password is a valid string', function() {
-
-    var opts = { username: '', password: 'foobar', parse: true };
-
-    it('doesnt send any Authorization headers', function(done) {
-      needle.get('localhost:' + port, { parse: true }, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.not.containEql('authorization');
-        done();
-      })
-    })
-
-  });
-
-  describe('when username is a valid string, but no username is passed', function() {
-
-    var opts = { username: 'foobar', parse: true };
-
-    it('sends Authorization header', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.containEql('authorization');
-        done();
-      })
-    })
-
-    it('Basic Auth only includes username, without colon', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        var auth = get_auth(sent_headers['authorization']);
-        auth[0].should.equal('foobar');
-        auth.should.have.lengthOf(1);
-        done();
-      })
-    })
-
-  })
-
-  describe('when username is a valid string, and password is null', function() {
-
-    var opts = { username: 'foobar', password: null, parse: true };
-
-    it('sends Authorization header', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.containEql('authorization');
-        done();
-      })
-    })
-
-    it('Basic Auth only includes both username and password', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        var auth = get_auth(sent_headers['authorization']);
-        auth[0].should.equal('foobar');
-        auth[1].should.equal('');
-        done();
-      })
-    })
-
-  })
-
-  describe('when username is a valid string, and password is an empty string', function() {
-
-    var opts = { username: 'foobar', password: '', parse: true };
-
-    it('sends Authorization header', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.containEql('authorization');
-        done();
-      })
-    })
-
-    it('Basic Auth only includes both username and password', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        var auth = get_auth(sent_headers['authorization']);
-        auth[0].should.equal('foobar');
-        auth[1].should.equal('');
-        auth.should.have.lengthOf(2);
-        done();
-      })
-    })
-
-  })
-
-  describe('when username AND password are non empty strings', function() {
-
-    var opts = { username: 'foobar', password: 'jakub', parse: true };
-
-    it('sends Authorization header', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.containEql('authorization');
-        done();
-      })
-    })
-
-    it('Basic Auth only includes both user and password', function(done) {
-      needle.get('localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        var auth = get_auth(sent_headers['authorization']);
-        auth[0].should.equal('foobar');
-        auth[1].should.equal('jakub');
-        auth.should.have.lengthOf(2);
-        done();
-      })
-    })
-
-  })
-
-  describe('URL with @ but not username/pass', function() {
-    it('doesnt send Authorization header', function(done) {
-      var url = 'localhost:' + port + '/abc/@def/xyz.zip';
-
-      needle.get(url, {}, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.not.containEql('authorization');
-        done();
-      })
-    })
-
-    it('sends user:pass headers if passed via options', function(done) {
-      var url = 'localhost:' + port + '/abc/@def/xyz.zip';
-
-      needle.get(url, { username: 'foo' }, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.containEql('authorization');
-        sent_headers['authorization'].should.eql('Basic Zm9v')
-        done();
-      })
-    })
-  })
-
-  describe('when username/password are included in URL', function() {
-    var opts = { parse: true };
-
-    it('sends Authorization header', function(done) {
-      needle.get('foobar:jakub@localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        Object.keys(sent_headers).should.containEql('authorization');
-        done();
-      })
-    })
-
-    it('Basic Auth only includes both user and password', function(done) {
-      needle.get('foobar:jakub@localhost:' + port, opts, function(err, resp) {
-        var sent_headers = resp.body.headers;
-        var auth = get_auth(sent_headers['authorization']);
-        auth[0].should.equal('foobar');
-        auth[1].should.equal('jakub');
-        auth.should.have.lengthOf(2);
-        done();
-      })
-    })
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/compression_spec.js b/legacy-libs/grpc/node_modules/needle/test/compression_spec.js
deleted file mode 100644 (file)
index ea5f3b1..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-var should = require('should'),\r
-    needle = require('./../'),\r
-    http   = require('http'),\r
-    zlib   = require('zlib'),\r
-    stream = require('stream'),\r
-    port   = 11123,\r
-    server;\r
-\r
-describe('compression', function(){\r
-\r
-  require.bind(null, 'zlib').should.not.throw()\r
-\r
-  var jsonData = '{"foo":"bar"}';\r
-\r
-  describe('when server supports compression', function(){\r
-\r
-    before(function(){\r
-      server = http.createServer(function(req, res) {\r
-        var raw = new stream.PassThrough();\r
-\r
-        var acceptEncoding = req.headers['accept-encoding'];\r
-        if (!acceptEncoding) {\r
-          acceptEncoding = '';\r
-        }\r
-\r
-        if (acceptEncoding.match(/\bdeflate\b/)) {\r
-          res.setHeader('Content-Encoding', 'deflate');\r
-          raw.pipe(zlib.createDeflate()).pipe(res);\r
-        } else if (acceptEncoding.match(/\bgzip\b/)) {\r
-          res.setHeader('Content-Encoding', 'gzip');\r
-          raw.pipe(zlib.createGzip()).pipe(res);\r
-        } else {\r
-          raw.pipe(res);\r
-        }\r
-\r
-        res.setHeader('Content-Type', 'application/json')\r
-        if (req.headers['with-bad']) {\r
-          res.end('foo'); // end, no deflate data\r
-        } else {\r
-          raw.end(jsonData)\r
-        }\r
-\r
-      })\r
-\r
-      server.listen(port);\r
-    });\r
-\r
-    after(function(done){\r
-      server.close(done);\r
-    })\r
-\r
-    describe('and client requests no compression', function() {\r
-      it('should have the body decompressed', function(done){\r
-        needle.get('localhost:' + port, function(err, response, body){\r
-          should.ifError(err);\r
-          body.should.have.property('foo', 'bar');\r
-          response.bytes.should.equal(jsonData.length);\r
-          done();\r
-        })\r
-      })\r
-    })\r
-\r
-    describe('and client requests gzip compression', function() {\r
-      it('should have the body decompressed', function(done){\r
-        needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'gzip'}}, function(err, response, body){\r
-          should.ifError(err);\r
-          body.should.have.property('foo', 'bar');\r
-          response.bytes.should.not.equal(jsonData.length);\r
-          done();\r
-        })\r
-      })\r
-    })\r
-\r
-    describe('and client requests deflate compression', function() {\r
-      it('should have the body decompressed', function(done){\r
-        needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate'}}, function(err, response, body){\r
-          should.ifError(err);\r
-          body.should.have.property('foo', 'bar');\r
-          response.bytes.should.not.equal(jsonData.length);\r
-          done();\r
-        })\r
-      })\r
-\r
-      it('should rethrow errors from decompressors', function(done){\r
-        needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate', 'With-Bad': 'true'}}, function(err, response, body) {\r
-          should.exist(err);\r
-          err.message.should.equal("incorrect header check");\r
-          err.code.should.equal("Z_DATA_ERROR")\r
-          done();\r
-        })\r
-      })\r
-    })\r
-  })\r
-})\r
diff --git a/legacy-libs/grpc/node_modules/needle/test/cookies_spec.js b/legacy-libs/grpc/node_modules/needle/test/cookies_spec.js
deleted file mode 100644 (file)
index 04b5f11..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-var needle  = require('../'),
-    cookies = require('../lib/cookies'),
-    sinon   = require('sinon'),
-    http    = require('http'),
-    should  = require('should'),
-    assert  = require('assert');
-
-var WEIRD_COOKIE_NAME      = 'wc',
-    BASE64_COOKIE_NAME     = 'bc',
-    FORBIDDEN_COOKIE_NAME  = 'fc',
-    NUMBER_COOKIE_NAME     = 'nc';
-
-var WEIRD_COOKIE_VALUE     = '!\'*+#()&-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~',
-    BASE64_COOKIE_VALUE    = 'Y29va2llCg==',
-    FORBIDDEN_COOKIE_VALUE = ' ;"\\,',
-    NUMBER_COOKIE_VALUE    = 12354342;
-
-var TEST_HOST = 'localhost',
-    NO_COOKIES_TEST_PORT   = 11112,
-    ALL_COOKIES_TEST_PORT  = 11113;
-
-describe('cookies', function() {
-
-  var setCookieHeader, headers, server, opts;
-
-  function decode(str) {
-    return decodeURIComponent(str);
-  }
-
-  function encode(str) {
-    str = str.toString().replace(/[\x00-\x1F\x7F]/g, encodeURIComponent);
-    return str.replace(/[\s\"\,;\\%]/g, encodeURIComponent);
-  }
-
-  before(function() {
-    setCookieHeader = [
-      WEIRD_COOKIE_NAME + '=' + encode(WEIRD_COOKIE_VALUE) + ';',
-      BASE64_COOKIE_NAME + '=' + encode(BASE64_COOKIE_VALUE) + ';',
-      FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE) + ';',
-      NUMBER_COOKIE_NAME + '=' + encode(NUMBER_COOKIE_VALUE) + ';'
-    ];
-  });
-
-  before(function(done) {
-    serverAllCookies = http.createServer(function(req, res) {
-      res.setHeader('Content-Type', 'text/html');
-      res.setHeader('Set-Cookie', setCookieHeader);
-      res.end('200');
-    }).listen(ALL_COOKIES_TEST_PORT, TEST_HOST, done);
-  });
-
-  after(function(done) {
-    serverAllCookies.close(done);
-  });
-
-  describe('with default options', function() {
-    it('no cookie header is set on request', function(done) {
-      needle.get(
-        TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(err, response) {
-          assert(!response.req._headers.cookie);
-          done();
-        });
-    });
-  });
-
-  describe('if response does not contain cookies', function() {
-    before(function(done) {
-      serverNoCookies = http.createServer(function(req, res) {
-        res.setHeader('Content-Type', 'text/html');
-        res.end('200');
-      }).listen(NO_COOKIES_TEST_PORT, TEST_HOST, done);
-    });
-
-    it('response.cookies is undefined', function(done) {
-      needle.get(
-        TEST_HOST + ':' + NO_COOKIES_TEST_PORT, function(error, response) {
-          assert(!response.cookies);
-          done();
-        });
-    });
-
-    after(function(done) {
-      serverNoCookies.close(done);
-    });
-  });
-
-  describe('if response contains cookies', function() {
-
-    it('puts them on resp.cookies', function(done) {
-      needle.get(
-        TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) {
-          response.should.have.property('cookies');
-          done();
-        });
-    });
-
-    it('parses them as a object', function(done) {
-      needle.get(
-        TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) {
-          response.cookies.should.be.an.instanceOf(Object)
-            .and.have.property(WEIRD_COOKIE_NAME);
-          response.cookies.should.have.property(BASE64_COOKIE_NAME);
-          response.cookies.should.have.property(FORBIDDEN_COOKIE_NAME);
-          response.cookies.should.have.property(NUMBER_COOKIE_NAME);
-          done();
-        });
-    });
-
-    it('must decode it', function(done) {
-      needle.get(
-        TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) {
-          response.cookies.wc.should.be.eql(WEIRD_COOKIE_VALUE);
-          response.cookies.bc.should.be.eql(BASE64_COOKIE_VALUE);
-          response.cookies.fc.should.be.eql(FORBIDDEN_COOKIE_VALUE);
-          response.cookies.nc.should.be.eql(NUMBER_COOKIE_VALUE.toString());
-          done();
-        });
-    });
-
-    describe('when a cookie value is invalid', function() {
-
-      before(function() {
-        setCookieHeader = [
-          'geo_city=%D1%E0%ED%EA%F2-%CF%E5%F2%E5%F0%E1%F3%F0%E3'
-        ];
-      })
-
-      it('doesnt blow up', function(done) {
-        needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, function(error, response) {
-          should.not.exist(error)
-          var whatever = 'efbfbdefbfbdefbfbdefbfbdefbfbd2defbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbdefbfbd';
-          Buffer.from(response.cookies.geo_city).toString('hex').should.eql(whatever)
-          done();
-        });
-      })
-
-    })
-
-    describe('and response is a redirect', function() {
-
-      var redirectServer, testPort = 22222;
-
-      var responseCookies = [
-        [ // first req
-          WEIRD_COOKIE_NAME + '=' + encode(WEIRD_COOKIE_VALUE) + ';',
-          BASE64_COOKIE_NAME + '=' + encode(BASE64_COOKIE_VALUE) + ';',
-          'FOO=123;'
-        ], [ // second req
-          FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE) + ';',
-          NUMBER_COOKIE_NAME + '=' + encode(NUMBER_COOKIE_VALUE) + ';'
-        ], [ // third red
-          'FOO=BAR;'
-        ]
-      ]
-
-      before(function() {
-        redirectServer = http.createServer(function(req, res) {
-          var number  = parseInt(req.url.replace('/', ''));
-          var nextUrl = 'http://' + TEST_HOST + ':' + testPort + '/' + (number + 1);
-
-          if (responseCookies[number]) { // got cookies
-            res.statusCode = 302;
-            res.setHeader('Set-Cookie', responseCookies[number]);
-            res.setHeader('Location', nextUrl);
-          } else if (number == 3) {
-            res.statusCode = 302; // redirect but without cookies
-            res.setHeader('Location', nextUrl);
-          }
-
-          res.end('OK');
-        }).listen(22222, TEST_HOST);
-      });
-
-      after(function(done) {
-        redirectServer.close(done);
-      })
-
-      describe('and follow_set_cookies is false', function() {
-
-        var opts = {
-          follow_set_cookies: false,
-          follow_max: 4
-        };
-
-        it('no cookie header set on redirection request', function(done) {
-          var spy = sinon.spy(cookies, 'write');
-
-          needle.get(TEST_HOST + ':' + testPort + '/0', opts, function(err, resp) {
-            spy.callCount.should.eql(0);
-            done();
-          });
-        });
-      });
-
-      describe('and follow_set_cookies is true', function() {
-        var opts = {
-          follow_set_cookies: true,
-          follow_max: 4
-        };
-
-        it('should have all the cookies', function(done) {
-          needle.get(TEST_HOST + ':' + testPort + '/0', opts, function(err, resp) {
-            resp.cookies.should.have.property(WEIRD_COOKIE_NAME);
-            resp.cookies.should.have.property(BASE64_COOKIE_NAME);
-            resp.cookies.should.have.property(FORBIDDEN_COOKIE_NAME);
-            resp.cookies.should.have.property(NUMBER_COOKIE_NAME);
-            resp.cookies.should.have.property('FOO');
-            resp.cookies.FOO.should.eql('BAR'); // should overwrite previous one
-            done();
-          });
-        });
-      });
-    });
-
-    describe('with parse_cookies = false', function() {
-      it('does not parse them', function(done) {
-        needle.get(
-          TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, { parse_cookies: false }, function(error, response) {
-            assert(!response.cookies);
-            done();
-          });
-      });
-    });
-  });
-
-  describe('if request contains cookie header', function() {
-    var opts = {
-      cookies: {}
-    };
-
-    before(function() {
-      opts.cookies[WEIRD_COOKIE_NAME] = WEIRD_COOKIE_VALUE;
-      opts.cookies[BASE64_COOKIE_NAME] = BASE64_COOKIE_VALUE;
-      opts.cookies[FORBIDDEN_COOKIE_NAME] = FORBIDDEN_COOKIE_VALUE;
-      opts.cookies[NUMBER_COOKIE_NAME] = NUMBER_COOKIE_VALUE;
-    });
-
-    it('must be a valid cookie string', function(done) {
-      var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
-
-      var full_header = [
-        WEIRD_COOKIE_NAME     + '=' + WEIRD_COOKIE_VALUE,
-        BASE64_COOKIE_NAME    + '=' + BASE64_COOKIE_VALUE,
-        FORBIDDEN_COOKIE_NAME + '=' + encode(FORBIDDEN_COOKIE_VALUE),
-        NUMBER_COOKIE_NAME    + '=' + NUMBER_COOKIE_VALUE
-      ].join('; ')
-
-      needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, opts, function(error, response) {
-        var cookieString = response.req._headers.cookie;
-        cookieString.should.be.type('string');
-
-        cookieString.split(/\s*;\s*/).forEach(function(pair) {
-          COOKIE_PAIR.test(pair).should.be.exactly(true);
-        });
-
-        cookieString.should.be.exactly(full_header);
-        done();
-      });
-    });
-
-    it('dont have to encode allowed characters', function(done) {
-      var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/,
-        KEY_INDEX = 1,
-        VALUE_INEX = 3;
-
-      needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, opts, function(error, response) {
-        var cookieObj = {},
-          cookieString = response.req._headers.cookie;
-
-        cookieString.split(/\s*;\s*/).forEach(function(str) {
-          var pair = COOKIE_PAIR.exec(str);
-          cookieObj[pair[KEY_INDEX]] = pair[VALUE_INEX];
-        });
-
-        cookieObj[WEIRD_COOKIE_NAME].should.be.exactly(WEIRD_COOKIE_VALUE);
-        cookieObj[BASE64_COOKIE_NAME].should.be.exactly(BASE64_COOKIE_VALUE);
-        done();
-      });
-    });
-
-    it('must encode forbidden characters', function(done) {
-      var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/,
-        KEY_INDEX = 1,
-        VALUE_INEX = 3;
-
-      needle.get(TEST_HOST + ':' + ALL_COOKIES_TEST_PORT, opts, function(error, response) {
-        var cookieObj = {},
-          cookieString = response.req._headers.cookie;
-
-        cookieString.split(/\s*;\s*/).forEach(function(str) {
-          var pair = COOKIE_PAIR.exec(str);
-          cookieObj[pair[KEY_INDEX]] = pair[VALUE_INEX];
-        });
-
-        cookieObj[FORBIDDEN_COOKIE_NAME].should.not.be.eql(
-          FORBIDDEN_COOKIE_VALUE);
-        cookieObj[FORBIDDEN_COOKIE_NAME].should.be.exactly(
-          encode(FORBIDDEN_COOKIE_VALUE));
-        cookieObj[FORBIDDEN_COOKIE_NAME].should.be.exactly(
-          encodeURIComponent(FORBIDDEN_COOKIE_VALUE));
-        done();
-      });
-    });
-  });
-});
diff --git a/legacy-libs/grpc/node_modules/needle/test/decoder_spec.js b/legacy-libs/grpc/node_modules/needle/test/decoder_spec.js
deleted file mode 100644 (file)
index 5225f6f..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-var should  = require('should'),
-    needle  = require('./../'),
-    Q       = require('q'),
-    chardet = require('jschardet');
-
-describe('character encoding', function() {
-
-  var url;
-  this.timeout(5000);
-
-  describe('test A', function() {
-
-    before(function() {
-      url = 'http://www.nina.jp/server/slackware/webapp/tomcat_charset.html';
-    })
-
-    describe('with decode = false', function() {
-
-      it('does not decode', function(done) {
-
-        needle.get(url, { decode: false }, function(err, resp) {
-          resp.body.should.be.a.String;
-          chardet.detect(resp.body).encoding.should.eql('windows-1252');
-          resp.body.indexOf('EUCを使う').should.eql(-1);
-          done();
-        })
-
-      })
-
-    })
-
-    describe('with decode = true', function() {
-
-      it('decodes', function(done) {
-
-        needle.get(url, { decode: true }, function(err, resp) {
-          resp.body.should.be.a.String;
-          chardet.detect(resp.body).encoding.should.eql('ascii');
-          resp.body.indexOf('EUCを使う').should.not.eql(-1);
-          done();
-        })
-
-      })
-
-    })
-
-  })
-
-  describe('test B', function() {
-
-    it('encodes to UTF-8', function(done) {
-
-      // Our Needle wrapper that requests a chinese website.
-      var task    = Q.nbind(needle.get, needle, 'http://www.chinesetop100.com/');
-
-      // Different instantiations of this task
-      var tasks   = [Q.fcall(task, {decode: true}),
-                     Q.fcall(task, {decode: false})];
-
-      var results = tasks.map(function(task) {
-        return task.then(function(obj) {
-          return obj[0].body;
-        });
-      });
-
-      // Execute all requests concurrently
-      Q.all(results).done(function(bodies) {
-
-        var charsets = [
-          chardet.detect(bodies[0]).encoding,
-          chardet.detect(bodies[1]).encoding,
-        ]
-
-        // We wanted to decode our first stream.
-        charsets[0].should.equal('ascii');
-        bodies[0].indexOf('全球中文网站前二十强').should.not.equal(-1);
-
-        // But not our second stream.
-        charsets[1].should.equal('windows-1252');
-        bodies[1].indexOf('全球中文网站前二十强').should.equal(-1);
-
-        done();
-      });
-    })
-  })
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/errors_spec.js b/legacy-libs/grpc/node_modules/needle/test/errors_spec.js
deleted file mode 100644 (file)
index 2f488f5..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-var needle  = require('../'),
-    sinon   = require('sinon'),
-    should  = require('should'),
-    http    = require('http'),
-    Emitter = require('events').EventEmitter,
-    helpers = require('./helpers');
-
-var get_catch = function(url, opts) {
-  var err;
-  try {
-    needle.get(url, opts);
-  } catch(e) {
-    err = e;
-  }
-  return err;
-}
-
-describe('errors', function() {
-
-  after(function(done) {
-    setTimeout(done, 100)
-  })
-
-  describe('when host does not exist', function() {
-
-    var url = 'http://unexistinghost/foo';
-
-    describe('with callback', function() {
-
-      it('does not throw', function() {
-        var ex = get_catch(url);
-        should.not.exist(ex);
-      })
-
-      it('callbacks an error', function(done) {
-        needle.get(url, function(err) {
-          err.should.be.a.Error;
-          done();
-        })
-      })
-
-      it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) {
-        needle.get(url, function(err) {
-          err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/)
-          done();
-        })
-      })
-
-      it('does not callback a response', function(done) {
-        needle.get(url, function(err, resp) {
-          should.not.exist(resp);
-          done();
-        })
-      })
-
-      it('does not emit an error event', function(done) {
-        var emitted = false;
-        var req = needle.get(url, function(err, resp) { })
-
-        req.on('error', function() {
-          emitted = true;
-        })
-
-        setTimeout(function() {
-          emitted.should.eql(false);
-          done();
-        }, 100);
-      })
-
-    })
-
-    describe('without callback', function() {
-
-      it('does not throw', function() {
-        var ex = get_catch(url);
-        should.not.exist(ex);
-      })
-
-      it('emits end event once, with error', function(done) {
-        var callcount = 0,
-            stream = needle.get(url);
-
-        stream.on('done', function(err) {
-          callcount++;
-        })
-
-        setTimeout(function() {
-          callcount.should.equal(1);
-          done();
-        }, 200)
-      })
-
-      it('error should be ENOTFOUND or EADDRINFO or EAI_AGAIN', function(done) {
-        var errorific,
-            stream = needle.get(url);
-
-        stream.on('done', function(err) {
-          errorific = err;
-        })
-
-        setTimeout(function() {
-          should.exist(errorific);
-          errorific.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/)
-          done();
-        }, 200)
-      })
-
-      it('does not emit a readable event', function(done) {
-        var called = false,
-            stream = needle.get(url);
-
-        stream.on('readable', function() {
-          called = true;
-        })
-
-        setTimeout(function() {
-          called.should.be.false;
-          done();
-        }, 50)
-      })
-
-      it('does not emit an error event', function(done) {
-        var emitted = false,
-            req = needle.get(url);
-
-        req.on('error', function() {
-          emitted = true;
-        })
-
-        setTimeout(function() {
-          emitted.should.eql(false);
-          done();
-        }, 100);
-      })
-
-    })
-
-  })
-
-  describe('when request times out waiting for response', function() {
-
-    var server,
-        url = 'http://localhost:3333/foo';
-
-    var send_request = function(cb) {
-      return needle.get(url, { response_timeout: 200 }, cb);
-    }
-
-    before(function() {
-      server = helpers.server({ port: 3333, wait: 1000 });
-    })
-
-    after(function() {
-      server.close();
-    })
-
-    describe('with callback', function() {
-
-      it('aborts the request', function(done) {
-
-        var time = new Date();
-
-        send_request(function(err) {
-          var timediff = (new Date() - time);
-          timediff.should.be.within(200, 300);
-          done();
-        })
-
-      })
-
-      it('callbacks an error', function(done) {
-        send_request(function(err) {
-          err.should.be.a.Error;
-          done();
-        })
-      })
-
-      it('error should be ECONNRESET', function(done) {
-        send_request(function(err) {
-          err.code.should.equal('ECONNRESET')
-          done();
-        })
-      })
-
-      it('does not callback a response', function(done) {
-        send_request(function(err, resp) {
-          should.not.exist(resp);
-          done();
-        })
-      })
-
-      it('does not emit an error event', function(done) {
-        var emitted = false;
-
-        var req = send_request(function(err, resp) {
-          should.not.exist(resp);
-        })
-
-        req.on('error', function() {
-          emitted = true;
-        })
-
-        setTimeout(function() {
-          emitted.should.eql(false);
-          done();
-        }, 350);
-      })
-
-    })
-
-    describe('without callback', function() {
-
-      it('emits done event once, with error', function(done) {
-        var called = 0,
-            stream = send_request();
-
-        stream.on('done', function(err) {
-          called++;
-        })
-
-        setTimeout(function() {
-          called.should.equal(1);
-          done();
-        }, 250)
-      })
-
-      it('aborts the request', function(done) {
-
-        var time = new Date();
-        var stream = send_request();
-
-        stream.on('done', function(err) {
-          var timediff = (new Date() - time);
-          timediff.should.be.within(200, 300);
-          done();
-        })
-
-      })
-
-      it('error should be ECONNRESET', function(done) {
-        var error,
-            stream = send_request();
-
-        stream.on('done', function(err) {
-          error = err;
-        })
-
-        setTimeout(function() {
-          error.code.should.equal('ECONNRESET')
-          done();
-        }, 250)
-      })
-
-      it('does not emit a readable event', function(done) {
-        var called = false,
-            stream = send_request();
-
-        stream.on('readable', function() {
-          called = true;
-        })
-
-        setTimeout(function() {
-          called.should.be.false;
-          done();
-        }, 250)
-      })
-
-      it('does not emit an error event', function(done) {
-        var emitted = false;
-        var req = send_request();
-
-        req.on('error', function() {
-          emitted = true;
-        })
-
-        setTimeout(function() {
-          emitted.should.eql(false);
-          done();
-        }, 100);
-      })
-
-    })
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/headers_spec.js b/legacy-libs/grpc/node_modules/needle/test/headers_spec.js
deleted file mode 100644 (file)
index e6693ef..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-var http    = require('http'),
-    helpers = require('./helpers'),
-    should  = require('should');
-
-var port = 54321;
-
-describe('request headers', function() {
-
-  var needle,
-      server,
-      existing_sockets,
-      original_defaultMaxSockets;
-
-  before(function(done) {
-    setTimeout(function() {
-      existing_sockets = get_active_sockets().length;
-      server = helpers.server({ port: port }, done);
-    }, 100);
-  })
-
-  after(function(done) {
-    server.close(done)
-  })
-
-  function send_request(opts, cb) {
-    needle.get('http://localhost:' + port, opts, cb);
-  }
-
-  function get_active_sockets() {
-    var handles = process._getActiveHandles();
-
-    // only return the ones that have a .end() function (like a socket)
-    return handles.filter(function(el) {
-      if (el.constructor.name.toString() == 'Socket') {
-        return el.destroyed !== true;
-      }
-    })
-  }
-
-  describe('old node versions (<0.11.4) with persistent keep-alive connections', function() {
-
-    before(function() {
-      delete require.cache[require.resolve('..')] // in case it was already loaded
-      original_defaultMaxSockets = http.Agent.defaultMaxSockets;
-      http.Agent.defaultMaxSockets = 5;
-      needle = require('..');
-    })
-
-    after(function() {
-      http.Agent.defaultMaxSockets = original_defaultMaxSockets;
-      delete require.cache[require.resolve('..')]
-    })
-
-    describe('default options', function() {
-
-      it('sends a Connection: close header', function(done) {
-        send_request({}, function(err, resp) {
-          resp.body.headers['connection'].should.eql('close');
-          done();
-        })
-      })
-
-      it('no open sockets remain after request', function(done) {
-        send_request({}, function(err, resp) {
-          get_active_sockets().length.should.eql(existing_sockets);
-          done();
-        });
-      })
-
-    })
-
-    describe('passing connection: close', function() {
-
-      it('sends a Connection: close header', function(done) {
-        send_request({ connection: 'close' }, function(err, resp) {
-          resp.body.headers['connection'].should.eql('close');
-          done();
-        })
-      })
-
-      it('no open sockets remain after request', function(done) {
-        send_request({ connection: 'close' }, function(err, resp) {
-          get_active_sockets().length.should.eql(existing_sockets);
-          done();
-        });
-      })
-
-    })
-
-    describe('passing connection: keep-alive', function() {
-
-      it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) {
-        send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) {
-          resp.body.headers['connection'].should.eql('keep-alive');
-          done();
-        })
-      })
-
-      it('sends a Connection: keep-alive header (using options.connection)', function(done) {
-        send_request({ connection: 'keep-alive' }, function(err, resp) {
-          resp.body.headers['connection'].should.eql('keep-alive');
-          done();
-        })
-      })
-
-      it('one open socket remain after request', function(done) {
-        send_request({ connection: 'keep-alive' }, function(err, resp) {
-          get_active_sockets().length.should.eql(existing_sockets + 1);
-          done();
-        });
-      })
-
-    })
-
-  })
-
-  describe('new node versions with smarter connection disposing', function() {
-
-    before(function() {
-      delete require.cache[require.resolve('..')]
-      original_defaultMaxSockets = http.Agent.defaultMaxSockets;
-      http.Agent.defaultMaxSockets = Infinity;
-      needle = require('..');
-    })
-
-    after(function() {
-      http.Agent.defaultMaxSockets = original_defaultMaxSockets;
-      delete require.cache[require.resolve('..')]
-    })
-
-    describe('default options', function() {
-
-      // TODO:
-      // this is weird. by default, new node versions set a 'close' header
-      // while older versions set a keep-alive header
-
-      it.skip('sets a Connection header', function(done) {
-        send_request({}, function(err, resp) {
-          // should.not.exist(resp.body.headers['connection']);
-          // done();
-        })
-      })
-
-      it.skip('one open sockets remain after request', function(done) {
-        send_request({}, function(err, resp) {
-          // get_active_sockets().length.should.eql(1);
-          // done();
-        });
-      })
-
-    })
-
-    describe('passing connection: close', function() {
-
-      it('sends a Connection: close header', function(done) {
-        send_request({ connection: 'close' }, function(err, resp) {
-          resp.body.headers['connection'].should.eql('close');
-          done();
-        })
-      })
-
-      it('no open sockets remain after request', function(done) {
-        send_request({ connection: 'close' }, function(err, resp) {
-          get_active_sockets().length.should.eql(existing_sockets);
-          done();
-        });
-      })
-
-    })
-
-    describe('passing connection: keep-alive', function() {
-
-      it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) {
-        send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) {
-          resp.body.headers['connection'].should.eql('keep-alive');
-          done();
-        })
-      })
-
-      it('sends a Connection: keep-alive header (using options.connection)', function(done) {
-        send_request({ connection: 'keep-alive' }, function(err, resp) {
-          resp.body.headers['connection'].should.eql('keep-alive');
-          done();
-        })
-      })
-
-      it('one open socket remain after request', function(done) {
-        send_request({ connection: 'keep-alive' }, function(err, resp) {
-          get_active_sockets().length.should.eql(existing_sockets + 1);
-          done();
-        });
-      })
-
-    })
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/helpers.js b/legacy-libs/grpc/node_modules/needle/test/helpers.js
deleted file mode 100644 (file)
index a85f548..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-var fs = require('fs');
-
-var protocols = {
-  http  : require('http'),
-  https : require('https')
-}
-
-var keys = {
-  cert : fs.readFileSync(__dirname + '/keys/ssl.cert'),
-  key  : fs.readFileSync(__dirname + '/keys/ssl.key')
-}
-
-var helpers = {};
-
-helpers.server = function(opts, cb) {
-
-  var defaults = {
-    code    : 200,
-    headers : {'Content-Type': 'application/json'}
-  }
-
-  var mirror_response = function(req) {
-    return JSON.stringify({
-      headers: req.headers,
-      body: req.body
-    })
-  }
-
-  var get = function(what) {
-    if (!opts[what])
-      return defaults[what];
-  
-    if (typeof opts[what] == 'function')
-      return opts[what](); // set them at runtime
-    else
-      return opts[what];
-  }
-
-  var finish = function(req, res) {
-    res.writeHead(get('code'), get('headers'));
-    res.end(opts.response || mirror_response(req));
-  }
-
-  var handler = function(req, res) {
-
-    req.setEncoding('utf8'); // get as string
-    req.body = '';
-    req.on('data', function(str) { req.body += str })
-    req.socket.on('error', function(e) { 
-      // res.writeHead(500, {'Content-Type': 'text/plain'});
-      // res.end('Error: ' + e.message);
-    })
-
-    setTimeout(function(){
-      finish(req, res);
-    }, opts.wait || 0);
-
-  };
-
-  var protocol = opts.protocol || 'http';
-  var server;
-
-  if (protocol == 'https')
-    server = protocols[protocol].createServer(keys, handler);
-  else
-    server = protocols[protocol].createServer(handler);
-
-  server.listen(opts.port, cb);
-  return server;
-}
-
-module.exports = helpers;
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/needle/test/long_string_spec.js b/legacy-libs/grpc/node_modules/needle/test/long_string_spec.js
deleted file mode 100644 (file)
index 4baa4fa..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-var needle = require('../'),
-    should = require('should');
-
-describe('when posting a very long string', function() {
-
-  this.timeout(20000);
-
-  function get_string(length) {
-    var str = '';
-    for (var i = 0; i < length; i++) {
-      str += 'x';
-    }
-    return str;
-  }
-
-  it("shouldn't throw an EPIPE error out of nowhere", function(done) {
-    var error;
-
-    function finished() {
-      setTimeout(function() {
-        should.not.exist(error);
-        done();
-      }, 300);
-    }
-
-    try {
-      needle.post('https://google.com', { data: get_string(Math.pow(2, 20)) }, finished)
-    } catch(e) {
-      error = e;
-    }
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/output_spec.js b/legacy-libs/grpc/node_modules/needle/test/output_spec.js
deleted file mode 100644 (file)
index 14fc5bb..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-var should = require('should'),
-    needle = require('./../'),
-    http   = require('http'),
-    sinon  = require('sinon'),
-    stream = require('stream'),
-    fs     = require('fs'),
-    port   = 11111,
-    server;
-
-describe('with output option', function() {
-
-  var server, handler, file = '/tmp/foobar.out';
-
-  function send_request_cb(where, cb) {
-    var url = 'http://localhost:' + port + '/whatever.file';
-    return needle.get(url, { output: where }, cb);
-  }
-
-  function send_request_stream(where, cb) {
-    var url = 'http://localhost:' + port + '/whatever.file';
-    var stream = needle.get(url, { output: where });
-    stream.on('end', cb);
-  }
-
-  // this will only work in UNICES
-  function get_open_file_descriptors() {
-    var list = fs.readdirSync('/proc/self/fd');
-    return list.length;
-  }
-
-  var send_request = send_request_cb;
-
-  before(function(){
-    server = http.createServer(function(req, res) {
-      handler(req, res);
-    }).listen(port);
-  });
-
-  after(function() {
-    server.close();
-  })
-
-  beforeEach(function() {
-      try { fs.unlinkSync(file) } catch(e) { };
-  })
-
-  describe('and a 404 response', function() {
-
-    before(function() {
-      handler = function(req, res) {
-        res.writeHead(404, {'Content-Type': 'text/plain' });
-        res.end();
-      }
-    })
-
-    it('doesnt attempt to write a file', function(done) {
-      var spy = sinon.spy(fs, 'createWriteStream');
-      send_request(file, function(err, resp) {
-        resp.statusCode.should.eql(404);
-        spy.called.should.eql(false);
-        spy.restore();
-        done();
-      })
-    })
-
-    it('doesnt actually write a file', function(done) {
-      send_request(file, function(err, resp) {
-        resp.statusCode.should.eql(404);
-        fs.existsSync(file).should.eql(false);
-        done();
-      })
-    })
-
-  })
-
-  describe('and a 200 response', function() {
-
-    describe('for an empty response', function() {
-
-      before(function() {
-        handler = function(req, res) {
-          res.writeHead(200, { 'Content-Type': 'text/plain' });
-          res.end();
-        }
-      })
-
-      it('uses a writableStream', function(done) {
-        var spy = sinon.spy(fs, 'createWriteStream');
-        send_request(file, function(err, resp) {
-          resp.statusCode.should.eql(200);
-          spy.called.should.eql(true);
-          spy.restore();
-          done();
-        })
-      })
-
-      it('writes a file', function(done) {
-        fs.existsSync(file).should.eql(false);
-        send_request(file, function(err, resp) {
-          fs.existsSync(file).should.eql(true);
-          done();
-        })
-      })
-
-      it('file is zero bytes in length', function(done) {
-        send_request(file, function(err, resp) {
-          fs.statSync(file).size.should.equal(0);
-          done();
-        })
-      })
-
-      if (process.platform != 'win32') {
-        it('closes the file descriptor', function(done) {
-          var open_descriptors = get_open_file_descriptors();
-          send_request(file + Math.random(), function(err, resp) {
-            var current_descriptors = get_open_file_descriptors();
-            open_descriptors.should.eql(current_descriptors);
-            done()
-          })
-        })
-      }
-
-    })
-
-    describe('for a JSON response', function() {
-
-      before(function() {
-        handler = function(req, res) {
-          res.writeHead(200, { 'Content-Type': 'application/javascript' });
-          res.end(JSON.stringify({foo: 'bar'}));
-        }
-      })
-
-      it('uses a writableStream', function(done) {
-        var spy = sinon.spy(fs, 'createWriteStream');
-        send_request(file, function(err, resp) {
-          resp.statusCode.should.eql(200);
-          spy.called.should.eql(true);
-          spy.restore();
-          done();
-        })
-      })
-
-      it('writes a file', function(done) {
-        fs.existsSync(file).should.eql(false);
-        send_request(file, function(err, resp) {
-          fs.existsSync(file).should.eql(true);
-          done();
-        })
-      })
-
-      it('file size equals response length', function(done) {
-        send_request(file, function(err, resp) {
-          fs.statSync(file).size.should.equal(resp.bytes);
-          done();
-        })
-      })
-
-      it('response pipeline is honoured (JSON is decoded by default)', function(done) {
-        send_request_stream(file, function(err, resp) {
-          // we need to wait a bit since writing to config.output
-          // happens independently of needle's callback logic.
-          setTimeout(function() {
-            fs.readFileSync(file).toString().should.eql('{\"foo\":\"bar\"}');
-            done();
-          }, 20);
-        })
-      })
-
-      it('closes the file descriptor', function(done) {
-        var open_descriptors = get_open_file_descriptors();
-        send_request(file + Math.random(), function(err, resp) {
-          var current_descriptors = get_open_file_descriptors();
-          open_descriptors.should.eql(current_descriptors);
-          done()
-        })
-      })
-
-    })
-
-    describe('for a binary file', function() {
-
-      var pixel = Buffer.from("base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs", "base64");
-
-      before(function() {
-        handler = function(req, res) {
-          res.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Transfer-Encoding': 'chunked' });
-          res.write(pixel.slice(0, 10));
-          res.write(pixel.slice(10, 20));
-          res.write(pixel.slice(20, 30));
-          res.write(pixel.slice(30));
-          res.end();
-        }
-      })
-
-      it('uses a writableStream', function(done) {
-        var spy = sinon.spy(fs, 'createWriteStream');
-        send_request(file, function(err, resp) {
-          resp.statusCode.should.eql(200);
-          spy.called.should.eql(true);
-          spy.restore();
-          done();
-        })
-      })
-
-      it('writes a file', function(done) {
-        fs.existsSync(file).should.eql(false);
-        send_request(file, function(err, resp) {
-          fs.existsSync(file).should.eql(true);
-          done();
-        })
-      })
-
-      it('file size equals response length', function(done) {
-        send_request(file, function(err, resp) {
-          fs.statSync(file).size.should.equal(resp.bytes);
-          done();
-        })
-      })
-
-      it('file is equal to original buffer', function(done) {
-        send_request(file, function(err, resp) {
-          // we need to wait a bit since writing to config.output
-          // happens independently of needle's callback logic.
-          setTimeout(function() {
-            fs.readFileSync(file).should.eql(pixel);
-            done();
-          }, 20);
-        })
-      })
-
-      it('returns the data in resp.body too', function(done) {
-        send_request(file, function(err, resp) {
-          resp.body.should.eql(pixel);
-          done();
-        })
-      })
-
-      if (process.platform != 'win32') {
-        it('closes the file descriptor', function(done) {
-          var open_descriptors = get_open_file_descriptors();
-          send_request(file + Math.random(), function(err, resp) {
-            var current_descriptors = get_open_file_descriptors();
-            open_descriptors.should.eql(current_descriptors);
-            done()
-          })
-        })
-      }
-
-    })
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/parsing_spec.js b/legacy-libs/grpc/node_modules/needle/test/parsing_spec.js
deleted file mode 100644 (file)
index 406a292..0000000
+++ /dev/null
@@ -1,494 +0,0 @@
-var should = require('should'),
-    needle = require('./../'),
-    http   = require('http'),
-    port   = 11111,
-    server;
-
-describe('parsing', function(){
-
-  describe('when response is an JSON string', function(){
-
-    var json_string = '{"foo":"bar"}';
-
-    before(function(done){
-      server = http.createServer(function(req, res) {
-        res.setHeader('Content-Type', 'application/json');
-        res.end(json_string);
-      }).listen(port, done);
-    });
-
-    after(function(done){
-      server.close(done);
-    })
-
-    describe('and parse option is not passed', function() {
-
-      describe('with default parse_response', function() {
-
-        before(function() {
-          needle.defaults().parse_response.should.eql('all')
-        })
-
-        it('should return object', function(done){
-          needle.get('localhost:' + port, function(err, response, body){
-            should.ifError(err);
-            body.should.have.property('foo', 'bar');
-            done();
-          })
-        })
-
-      })
-
-      describe('and default parse_response is set to false', function() {
-
-        it('does NOT return object when disabled using .defaults', function(done){
-          needle.defaults({ parse_response: false })
-
-          needle.get('localhost:' + port, function(err, response, body) {
-            should.not.exist(err);
-            body.should.be.an.instanceof(Buffer)
-            body.toString().should.eql('{"foo":"bar"}');
-
-            needle.defaults({ parse_response: 'all' });
-            done();
-          })
-        })
-
-
-      })
-
-    })
-
-    describe('and parse option is true', function() {
-
-      describe('and JSON is valid', function() {
-
-        it('should return object', function(done) {
-          needle.get('localhost:' + port, { parse: true }, function(err, response, body){
-            should.not.exist(err);
-            body.should.have.property('foo', 'bar')
-            done();
-          })
-        })
-
-        it('should have a .parser = json property', function(done) {
-          needle.get('localhost:' + port, { parse: true }, function(err, resp) {
-            should.not.exist(err);
-            resp.parser.should.eql('json');
-            done();
-          })
-        })
-
-      });
-
-      describe('and response is empty', function() {
-
-        var old_json_string;
-
-        before(function() {
-          old_json_string = json_string;
-          json_string = "";
-        });
-
-        after(function() {
-          json_string = old_json_string;
-        });
-
-        it('should return an empty string', function(done) {
-          needle.get('localhost:' + port, { parse: true }, function(err, resp) {
-            should.not.exist(err);
-            resp.body.should.equal('');
-            done();
-          })
-        })
-
-      })
-
-      describe('and JSON is invalid', function() {
-
-        var old_json_string;
-
-        before(function() {
-          old_json_string = json_string;
-          json_string = "this is not going to work";
-        });
-
-        after(function() {
-          json_string = old_json_string;
-        });
-
-        it('does not throw', function(done) {
-          (function(){
-            needle.get('localhost:' + port, { parse: true }, done);
-          }).should.not.throw();
-        });
-
-        it('does NOT return object', function(done) {
-          needle.get('localhost:' + port, { parse: true }, function(err, response, body) {
-            should.not.exist(err);
-            body.should.be.a.String;
-            body.toString().should.eql('this is not going to work');
-            done();
-          })
-        })
-
-      });
-
-    })
-
-    describe('and parse option is false', function() {
-
-      it('does NOT return object', function(done){
-        needle.get('localhost:' + port, { parse: false }, function(err, response, body) {
-          should.not.exist(err);
-          body.should.be.an.instanceof(Buffer)
-          body.toString().should.eql('{"foo":"bar"}');
-          done();
-        })
-      })
-
-      it('should NOT have a .parser = json property', function(done) {
-        needle.get('localhost:' + port, { parse: false }, function(err, resp) {
-          should.not.exist(err);
-          should.not.exist(resp.parser);
-          done();
-        })
-      })
-
-    })
-
-    describe('and parse option is "xml"', function() {
-
-      it('does NOT return object', function(done){
-        needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) {
-          should.not.exist(err);
-          body.should.be.an.instanceof(Buffer)
-          body.toString().should.eql('{"foo":"bar"}');
-          done();
-        })
-      })
-
-      it('should NOT have a .parser = json property', function(done) {
-        needle.get('localhost:' + port, { parse: 'xml' }, function(err, resp) {
-          should.not.exist(err);
-          should.not.exist(resp.parser);
-          done();
-        })
-      })
-
-    })
-
-  });
-
-  describe('when response is JSON \'false\'', function(){
-
-    var json_string = 'false';
-
-    before(function(done){
-      server = http.createServer(function(req, res) {
-        res.setHeader('Content-Type', 'application/json');
-        res.end(json_string);
-      }).listen(port, done);
-    });
-
-    after(function(done){
-      server.close(done);
-    })
-
-    describe('and parse option is not passed', function() {
-
-      it('should return object', function(done){
-        needle.get('localhost:' + port, function(err, response, body){
-          should.ifError(err);
-          body.should.equal(false);
-          done();
-        })
-      })
-
-    })
-
-    describe('and parse option is true', function() {
-
-      describe('and JSON is valid', function() {
-
-        it('should return object', function(done){
-          needle.get('localhost:' + port, { parse: true }, function(err, response, body){
-            should.not.exist(err);
-            body.should.equal(false)
-            done();
-          })
-        })
-
-      });
-
-      describe('and response is empty', function() {
-
-        var old_json_string;
-
-        before(function() {
-          old_json_string = json_string;
-          json_string = "";
-        });
-
-        after(function() {
-          json_string = old_json_string;
-        });
-
-        it('should return an empty string', function(done) {
-          needle.get('localhost:' + port, { parse: true }, function(err, resp) {
-            should.not.exist(err);
-            resp.body.should.equal('');
-            done();
-          })
-        })
-
-      })
-
-      describe('and JSON is invalid', function() {
-
-        var old_json_string;
-
-        before(function() {
-          old_json_string = json_string;
-          json_string = "this is not going to work";
-        });
-
-        after(function() {
-          json_string = old_json_string;
-        });
-
-        it('does not throw', function(done) {
-          (function(){
-            needle.get('localhost:' + port, { parse: true }, done);
-          }).should.not.throw();
-        });
-
-        it('does NOT return object', function(done) {
-          needle.get('localhost:' + port, { parse: true }, function(err, response, body) {
-            should.not.exist(err);
-            body.should.be.a.String;
-            body.toString().should.eql('this is not going to work');
-            done();
-          })
-        })
-
-      });
-
-    })
-
-    describe('and parse option is false', function() {
-
-      it('does NOT return object', function(done){
-        needle.get('localhost:' + port, { parse: false }, function(err, response, body) {
-          should.not.exist(err);
-          body.should.be.an.instanceof(Buffer)
-          body.toString().should.eql('false');
-          done();
-        })
-      })
-
-    })
-
-    describe('and parse option is "xml"', function() {
-
-      it('does NOT return object', function(done){
-        needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) {
-          should.not.exist(err);
-          body.should.be.an.instanceof(Buffer)
-          body.toString().should.eql('false');
-          done();
-        })
-      })
-
-    })
-
-
-  });
-
-  describe('when response is an invalid XML string', function(){
-
-    before(function(done){
-      server = http.createServer(function(req, res) {
-        res.writeHeader(200, {'Content-Type': 'application/xml'})
-        res.end("<post><body there11post>")
-      }).listen(port, done);
-    });
-
-    after(function(done){
-      server.close(done);
-    })
-
-    describe('and parse_response is true', function(){
-
-      it('should return original string', function(done) {
-        needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) {
-          should.not.exist(err);
-          body.should.eql('<post><body there11post>')
-          should.not.exist(body.name);
-          done();
-        })
-      })
-
-      it('should not have a .parser = xml property', function(done) {
-        needle.get('localhost:' + port, { parse_response: true }, function(err, resp) {
-          should.not.exist(err);
-          should.not.exist(resp.parser);
-          done();
-        })
-      })
-
-    })
-
-    describe('and parse response is false', function(){
-
-      it('should return valid object', function(done) {
-        needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){
-          should.not.exist(err);
-          body.toString().should.eql('<post><body there11post>')
-          done();
-        })
-      })
-
-      it('should not have a .parser property', function(done) {
-        needle.get('localhost:' + port, { parse_response: false }, function(err, resp) {
-          should.not.exist(err);
-          should.not.exist(resp.parser)
-          done();
-        })
-      })
-
-    })
-
-  })
-
-  describe('when response is a valid XML string', function(){
-
-    before(function(done) {
-      server = http.createServer(function(req, res) {
-        res.writeHeader(200, {'Content-Type': 'application/xml'})
-        res.end("<post><p>hello</p><p>world</p></post>")
-      }).listen(port, done);
-    });
-
-    after(function(done) {
-      server.close(done);
-    })
-
-    describe('and parse_response is true', function(){
-
-      it('should return valid object', function(done) {
-        needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) {
-          should.not.exist(err);
-          body.name.should.eql('post')
-          body.children[0].name.should.eql('p')
-          body.children[0].value.should.eql('hello')
-
-          body.children[1].name.should.eql('p')
-          body.children[1].value.should.eql('world')
-          done();
-        })
-      })
-
-      it('should have a .parser = xml property', function(done) {
-        needle.get('localhost:' + port, { parse_response: true }, function(err, resp) {
-          should.not.exist(err);
-          resp.parser.should.eql('xml');
-          done();
-        })
-      })
-
-    })
-
-    describe('and parse response is false', function(){
-
-      it('should return valid object', function(done) {
-        needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){
-          should.not.exist(err);
-          body.toString().should.eql('<post><p>hello</p><p>world</p></post>')
-          done();
-        })
-      })
-
-      it('should not have a .parser property', function(done) {
-        needle.get('localhost:' + port, { parse_response: false }, function(err, resp) {
-          should.not.exist(err);
-          should.not.exist(resp.parser)
-          done();
-        })
-      })
-
-    })
-
-  })
-
-
-  describe('valid XML, using xml2js', function() {
-
-    var parsers, origParser;
-
-    before(function(done) {
-      var xml2js = require('xml2js')
-      parsers = require('../lib/parsers');
-      origParser = parsers['application/xml'];
-
-      var customParser = require('xml2js').parseString;
-      parsers.use('xml2js', ['application/xml'], function(buff, cb) {
-        var opts = { explicitRoot: true, explicitArray: false };
-        customParser(buff, opts, cb);
-      })
-
-      server = http.createServer(function(req, res) {
-        res.writeHeader(200, {'Content-Type': 'application/xml'})
-        res.end("<post><p>hello</p><p>world</p></post>")
-      }).listen(port, done);
-    });
-
-    after(function(done) {
-      parsers['application/xml'] = origParser;
-      server.close(done);
-    })
-
-    describe('and parse_response is true', function(){
-
-      it('should return valid object', function(done) {
-        needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) {
-          should.not.exist(err);
-          body.should.eql({ post: { p: ['hello', 'world' ]}})
-          done();
-        })
-      })
-
-      it('should have a .parser = xml property', function(done) {
-        needle.get('localhost:' + port, { parse_response: true }, function(err, resp) {
-          should.not.exist(err);
-          resp.parser.should.eql('xml2js');
-          done();
-        })
-      })
-
-    })
-
-    describe('and parse response is false', function(){
-
-      it('should return valid object', function(done) {
-        needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){
-          should.not.exist(err);
-          body.toString().should.eql('<post><p>hello</p><p>world</p></post>')
-          done();
-        })
-      })
-
-      it('should not have a .parser property', function(done) {
-        needle.get('localhost:' + port, { parse_response: false }, function(err, resp) {
-          should.not.exist(err);
-          should.not.exist(resp.parser)
-          done();
-        })
-      })
-
-    })
-
-  })
-
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/post_data_spec.js b/legacy-libs/grpc/node_modules/needle/test/post_data_spec.js
deleted file mode 100644 (file)
index d9a28c6..0000000
+++ /dev/null
@@ -1,1021 +0,0 @@
-var needle  = require('..'),
-    http    = require('http'),
-    should  = require('should'),
-    sinon   = require('sinon'),
-    stream  = require('stream'),
-    helpers = require('./helpers');
-
-var multiparts = ['----------------------NODENEEDLEHTTPCLIENT'];
-multiparts.push(['Content-Disposition: form-data; name=\"foo\"'])
-multiparts.push(['\r\nbar\r\n----------------------NODENEEDLEHTTPCLIENT--'])
-// multiparts.push(['Content-Disposition: form-data; name=\"test\"'])
-// multiparts.push(['\r\næµè¯\r\n----------------------NODENEEDLEHTTPCLIENT--'])
-// multiparts.push(['\r\n' + Buffer.from('测试').toString() + '\r\n----------------------NODENEEDLEHTTPCLIENT--'])
-
-
-describe('post data (e.g. request body)', function() {
-
-  var stub, spy, server;
-
-  before(function(done) {
-    server = helpers.server({ port: 4321 }, done);
-  })
-
-  after(function(done) {
-    server.close(done);
-  })
-
-  afterEach(function() {
-    if (stub) stub.restore();
-    if (spy) spy.restore();
-  })
-
-  function get(data, opts, cb) {
-    return needle.request('get', 'http://localhost:' + 4321, data, opts, cb)
-  }
-
-  function post(data, opts, cb) {
-    return needle.request('post', 'http://localhost:' + 4321, data, opts, cb)
-  }
-
-  function spystub_request() {
-    var http_req = http.request;
-    stub = sinon.stub(http, 'request', function(opts, cb) {
-      var req = http_req(opts, cb);
-      spy = sinon.spy(req, 'write');
-      return req;
-    })
-  }
-
-  function check_request(method) {
-    stub.calledOnce.should.be.true;
-    stub.args[0][0]['headers']['host'].should.equal('localhost:4321');
-    stub.args[0][0]['method'].should.equal(method);
-  }
-
-  describe('with multipart: true', function() {
-
-    describe('when null', function() {
-
-      it('sends request (non multipart)', function(done) {
-        spystub_request();
-
-        post(null, { multipart: true }, function(err, resp) {
-          check_request('post');
-          done();
-        })
-      })
-
-      it('doesnt set Content-Type header', function(done) {
-        post(null, { multipart: true }, function(err, resp) {
-          should.not.exist(resp.body.headers['content-type']);
-          done();
-        })
-      })
-
-      it('doesnt change default Accept header', function(done) {
-        post(null, { multipart: true }, function(err, resp) {
-          // resp.body contains 'header' and 'body', mirroring what we sent
-          resp.body.headers['accept'].should.equal('*/*');
-          done();
-        })
-      })
-
-      it('doesnt write anything', function(done) {
-        spystub_request();
-
-        post(null, { multipart: true }, function(err, resp) {
-          spy.called.should.be.false;
-          resp.body.body.should.eql('');
-          done();
-        })
-      })
-
-    })
-
-    describe('when string', function() {
-
-      it('explodes', function() {
-        (function() {
-          post('foobar', { multipart: true })
-        }).should.throw()
-      })
-
-    })
-
-    describe('when object', function() {
-
-      describe('get request', function() {
-
-        it('sends request', function(done) {
-          spystub_request();
-
-          get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
-            check_request('get');
-            done();
-          })
-        })
-
-        it('sets Content-Type header', function(done) {
-          post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
-            resp.body.headers['content-type'].should.equal('multipart/form-data; boundary=--------------------NODENEEDLEHTTPCLIENT');
-            done();
-          })
-        })
-
-        it('doesnt change default Accept header', function(done) {
-          post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
-            resp.body.headers['accept'].should.equal('*/*');
-            done();
-          })
-        })
-
-        it('writes string as buffer', function(done) {
-          spystub_request();
-
-          get({ foo: 'bar' }, { multipart: true }, function(err, resp) {
-            spy.called.should.be.true;
-
-            spy.args[0][0].should.be.an.instanceof(String);
-            spy.args[0][0].toString().should.equal(multiparts.join('\r\n'));
-            resp.body.body.should.eql(multiparts.join('\r\n'));
-            done();
-          })
-        })
-
-        it('writes japanese chars correctly as binary', function(done) {
-          spystub_request();
-
-          get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
-            spy.called.should.be.true;
-
-            spy.args[0][0].should.be.an.instanceof(String);
-            Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d')
-            done();
-          })
-        })
-
-
-      })
-
-      describe('post request', function() {
-
-        it('sends request', function(done) {
-          spystub_request();
-
-          post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
-            check_request('post');
-            done();
-          })
-        })
-
-        it('writes string as buffer', function(done) {
-          spystub_request();
-
-          post({ foo: 'bar' }, { multipart: true }, function(err, resp) {
-            spy.called.should.be.true;
-            spy.args[0][0].should.be.an.instanceof(String);
-            spy.args[0][0].toString().should.equal(multiparts.join('\r\n'));
-            resp.body.body.should.eql(multiparts.join('\r\n'));
-            done();
-          })
-        })
-
-        it('writes japanese chars correctly as binary', function(done) {
-          spystub_request();
-
-          post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) {
-            spy.called.should.be.true;
-            spy.args[0][0].should.be.an.instanceof(String);
-            Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d')
-            done();
-          })
-        })
-
-      })
-
-    })
-
-    describe('when stream', function() {
-
-      var stream_for_multipart;
-
-      before(function() {
-        stream_for_multipart = new stream.Readable();
-        stream_for_multipart._read = function() {
-          this.push('foobar');
-          this.push(null);
-        }
-      })
-
-      it('explodes', function() {
-        (function() {
-          post(stream_for_multipart, { multipart: true })
-        }).should.throw()
-      })
-
-    })
-
-  })
-
-  describe('non multipart', function() {
-
-    describe('when null', function() {
-
-      describe('get request', function() {
-
-        it('sends request', function(done) {
-          spystub_request();
-
-          get(null, {}, function(err, resp) {
-            check_request('get');
-            done();
-          })
-        })
-
-        it('doesnt write anything', function(done) {
-          spystub_request();
-
-          get(null, {}, function(err, resp) {
-            spy.called.should.be.false;
-            resp.body.body.should.eql('');
-            done();
-          })
-        })
-
-      })
-
-      describe('post request', function() {
-
-        it('sends request', function(done) {
-          spystub_request();
-
-          post(null, {}, function(err, resp) {
-            check_request('post');
-            done();
-          })
-        })
-
-        it('doesnt write anything', function(done) {
-          spystub_request();
-
-          post(null, {}, function(err, resp) {
-            spy.called.should.be.false;
-            resp.body.body.should.eql('');
-            done();
-          })
-        })
-
-      })
-
-    })
-
-    describe('when string with no equal sign', function() {
-
-      describe('get request', function() {
-
-        it('explodes', function() {
-          (function() {
-            get('foobar', {})
-          }).should.throw()
-        })
-
-      })
-
-      describe('post request', function() {
-
-        it('sends request', function(done) {
-          spystub_request();
-
-          post('foobar', {}, function(err, resp) {
-            check_request('post');
-            done();
-          })
-        })
-
-        it('writes string as buffer', function(done) {
-          spystub_request();
-
-          post('foobar', {}, function(err, resp) {
-            spy.called.should.be.true;
-            spy.args[0][0].should.be.an.instanceof(Buffer);
-            spy.args[0][0].toString().should.equal('foobar');
-            resp.body.body.should.eql('foobar');
-            done();
-          })
-        })
-
-      })
-
-    })
-
-    describe('when string WITH equal sign', function() {
-
-      describe('get request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request, adding data as querystring', function(done) {
-            spystub_request();
-
-            get('foo=bar', { json: false }, function(err, resp) {
-              check_request('get');
-              stub.args[0][0]['path'].should.equal('/?foo=bar')
-              done();
-            })
-          })
-
-          it('doesnt set Content-Type header', function(done) {
-            get('foo=bar', { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              should.not.exist(resp.body.headers['content-type']);
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            get('foo=bar', { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('doesnt write anything', function(done) {
-            get('foo=bar', { json: false }, function(err, resp) {
-              spy.called.should.be.false;
-              resp.body.body.should.eql('');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request, without setting a querystring', function(done) {
-            spystub_request();
-
-            get('foo=bar', { json: true }, function(err, resp) {
-              check_request('get');
-              stub.args[0][0]['path'].should.equal('/')
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            get('foo=bar', { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            get('foo=bar', { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) {
-            get('foo=bar', { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].toString().should.eql('foo=bar')
-              resp.body.body.should.eql('foo=bar');
-              done();
-            })
-          })
-
-        })
-
-      })
-
-      describe('post request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post('foo=bar', { json: false }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header to www-form-urlencoded', function(done) {
-            post('foo=bar', { json: false }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            post('foo=bar', { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes as buffer', function(done) {
-            post('foo=bar', { json: false }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].should.be.an.instanceof(Buffer);
-              spy.args[0][0].toString().should.equal('foo=bar');
-              resp.body.body.should.eql('foo=bar');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post('foo=bar', { json: true }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            post('foo=bar', { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            post('foo=bar', { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) {
-            post('foo=bar', { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              var json = JSON.stringify('foo=bar');
-              spy.args[0][0].toString().should.eql('foo=bar')
-              resp.body.body.should.eql('foo=bar');
-              done();
-            })
-          })
-
-        })
-
-      })
-
-    })
-
-    describe('when object', function() {
-
-      describe('get request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request, adding data as querystring', function(done) {
-            spystub_request();
-
-            get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              check_request('get');
-              stub.args[0][0]['path'].should.equal('/?foo=bar&test=%E6%B5%8B%E8%AF%95')
-              done();
-            })
-          })
-
-          it('doesnt set Content-Type header', function(done) {
-            get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              should.not.exist(resp.body.headers['content-type']);
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('doesnt write anything', function(done) {
-            get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              spy.called.should.be.false;
-              resp.body.body.should.eql('');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request, without setting a querystring', function(done) {
-            spystub_request();
-
-            get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              check_request('get');
-              stub.args[0][0]['path'].should.equal('/')
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('writes JSON.stringify version of object', function(done) {
-            get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              var json = JSON.stringify({ foo: 'bar', test: '测试' })
-              spy.args[0][0].toString().should.eql(json)
-              resp.body.body.should.eql(json);
-              done();
-            })
-          })
-
-        })
-
-      })
-
-      describe('post request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header to www-form-urlencoded', function(done) {
-            post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes as buffer', function(done) {
-            post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].should.be.an.instanceof(Buffer);
-              spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95');
-              resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: false and content_type = "application/json"', function() {
-
-          var opts = { json: false, content_type: 'application/json' };
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header to application/json', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes as buffer', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].constructor.name.should.eql('Buffer');
-              spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95');
-              resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: undefined but content-type = application/json', function() {
-
-          var opts = { headers: { 'content-type': 'application/json' } };
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('doesnt change Content-Type header', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('leaves default Accept header', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes JSON.stringified object', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              spy.called.should.be.true;
-              var json = JSON.stringify({ foo: 'bar', test: '测试' })
-              spy.args[0][0].toString().should.eql(json)
-              resp.body.body.should.eql(json);
-              done();
-            })
-          })
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('writes JSON.stringified object', function(done) {
-            post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              var json = JSON.stringify({ foo: 'bar', test: '测试' })
-              spy.args[0][0].toString().should.eql(json)
-              resp.body.body.should.eql(json);
-              done();
-            })
-          })
-
-        })
-
-
-        describe('with json: true and content_type: */* (passed, not default)', function() {
-
-          var opts = { json: true, accept: '*/*' };
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header to application/json', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('respects Accept header set by user', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes JSON.stringified object', function(done) {
-            post({ foo: 'bar', test: '测试' }, opts, function(err, resp) {
-              spy.called.should.be.true;
-              var json = JSON.stringify({ foo: 'bar', test: '测试' })
-              spy.args[0][0].toString().should.eql(json)
-              resp.body.body.should.eql(json);
-              done();
-            })
-          })
-
-        })
-
-      })
-
-    })
-
-    describe('when buffer', function() {
-
-      describe('get request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            get(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              check_request('get');
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            get(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              // should.not.exist(resp.body.headers['content-type']);
-              resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
-
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            get(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes as buffer', function(done) {
-            get(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].should.be.an.instanceof(Buffer);
-              spy.args[0][0].toString().should.equal('foobar');
-              resp.body.body.should.eql('foobar');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request, without setting a querystring', function(done) {
-            spystub_request();
-
-            get(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              check_request('get');
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            get(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            get(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('writes JSON.stringify version of object', function(done) {
-            get(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].toString().should.eql('foobar')
-              resp.body.body.should.eql('foobar');
-              done();
-            })
-          })
-
-        })
-
-      })
-
-      describe('post request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header to www-form-urlencoded', function(done) {
-            post(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            post(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes as buffer', function(done) {
-            post(Buffer.from('foobar'), { json: false }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].should.be.an.instanceof(Buffer);
-              spy.args[0][0].toString().should.equal('foobar');
-              resp.body.body.should.eql('foobar');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            post(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            post(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('passes raw buffer (assuming its a JSON string beneath)', function(done) {
-            post(Buffer.from('foobar'), { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].toString().should.eql('foobar')
-              resp.body.body.should.eql('foobar');
-              done();
-            })
-          })
-
-        })
-
-      })
-
-    })
-
-    describe('when stream', function() {
-
-      var input_stream;
-
-      beforeEach(function() {
-        input_stream = new stream.Readable();
-        input_stream._read = function() {
-          this.push('foobar');
-          this.push(null);
-        }
-      })
-
-      describe('get request', function() {
-
-        it('explodes', function() {
-          (function() {
-            get(input_stream, {})
-          }).should.throw()
-        })
-
-      });
-
-      describe('post request', function() {
-
-        describe('with json: false (default)', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post(input_stream, { json: false }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header to www-form-urlencoded', function(done) {
-            post(input_stream, { json: false }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded');
-              done();
-            })
-          })
-
-          it('doesnt change default Accept header', function(done) {
-            post(input_stream, { json: false }, function(err, resp) {
-              // resp.body contains 'header' and 'body', mirroring what we sent
-              resp.body.headers['accept'].should.equal('*/*');
-              done();
-            })
-          })
-
-          it('writes as buffer', function(done) {
-            post(input_stream, { json: false }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].should.be.an.instanceof(Buffer);
-              spy.args[0][0].toString().should.equal('foobar');
-              resp.body.body.should.eql('foobar');
-              done();
-            })
-          })
-
-        })
-
-        describe('with json: true', function() {
-
-          it('sends request', function(done) {
-            spystub_request();
-
-            post(input_stream, { json: true }, function(err, resp) {
-              check_request('post');
-              done();
-            })
-          })
-
-          it('sets Content-Type header', function(done) {
-            post(input_stream, { json: true }, function(err, resp) {
-              resp.body.headers['content-type'].should.equal('application/json; charset=utf-8');
-              done();
-            })
-          })
-
-          it('set Accept header to application/json', function(done) {
-            post(input_stream, { json: true }, function(err, resp) {
-              resp.body.headers['accept'].should.equal('application/json');
-              done();
-            })
-          })
-
-          it('writes JSON.stringified object', function(done) {
-            post(input_stream, { json: true }, function(err, resp) {
-              spy.called.should.be.true;
-              spy.args[0][0].toString().should.eql('foobar')
-              resp.body.body.should.eql('foobar');
-              done();
-            })
-          })
-
-        })
-
-      })
-
-    })
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/proxy_spec.js b/legacy-libs/grpc/node_modules/needle/test/proxy_spec.js
deleted file mode 100644 (file)
index 9526e7f..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-var helpers = require('./helpers'),
-    should  = require('should'),
-    sinon   = require('sinon'),
-    http    = require('http'),
-    needle  = require('./../');
-
-var port = 7707;
-var url = 'localhost:' + port;
-var nonexisting_host = 'awepfokawepofawe.com';
-
-describe('proxy option', function() {
-
-  var spy, opts;
-
-  function send_request(opts, done) {
-    if (spy) spy.restore();
-    spy = sinon.spy(http, 'request');
-    needle.get(url, opts, done);
-  }
-
-  //////////////////////
-  // proxy opts helpers
-
-  function not_proxied(done) {
-    return function(err, resp) {
-      var path = spy.args[0][0].path;
-      path.should.eql('/'); // not the full original URI
-      spy.restore();
-      done();
-    }
-  }
-
-  function proxied(host, port, done) {
-    return function(err, resp) {
-      var path = spy.args[0][0].path;
-      path.should.eql('http://' + url); // the full original URI
-
-      var http_host = spy.args[0][0].host;
-      if (http_host) http_host.should.eql(host);
-
-      var http_port = spy.args[0][0].port;
-      if (http_port) http_port.should.eql(port);
-
-      spy.restore();
-      done();
-    }
-  }
-
-  //////////////////////
-  // auth helpers
-
-  function get_auth(header) {
-    var token  = header.split(/\s+/).pop();
-    return token && Buffer.from(token, 'base64').toString().split(':');
-  }
-
-  function no_proxy_auth(done) {
-    return function(err, resp) {
-      var headers = spy.args[0][0].headers;
-      Object.keys(headers).should.not.containEql('proxy-authorization');
-      done();
-    }
-  }
-
-  function header_set(name, user, pass, done) {
-    return function(err, resp) {
-      var headers = spy.args[0][0].headers;
-      var auth = get_auth(headers[name]);
-      auth[0].should.eql(user);
-      auth[1].should.eql(pass);
-      done();
-    }
-  }
-
-  function proxy_auth_set(user, pass, done) {
-    return header_set('proxy-authorization', user, pass, done);
-  }
-
-  function basic_auth_set(user, pass, done) {
-    return header_set('authorization', user, pass, done);
-  }
-
-  after(function() {
-    spy.restore();
-  })
-
-  describe('when null proxy is passed', function() {
-
-    it('does not proxy', function(done) {
-      send_request({ proxy: null }, not_proxied(done))
-    })
-
-    describe('but defaults has been set', function() {
-
-      before(function() {
-        needle.defaults({ proxy: 'foobar' });
-      })
-
-      after(function() {
-        needle.defaults({ proxy: null });
-      })
-
-      it('tries to proxy anyway', function(done) {
-        send_request({}, proxied('foobar', 80, done))
-      })
-
-    })
-
-  })
-
-  describe('when weird string is passed', function() {
-
-    it('tries to proxy anyway', function(done) {
-      send_request({ proxy: 'alfalfa' }, proxied('alfalfa', 80, done))
-    })
-  })
-
-  describe('when valid url is passed', function() {
-
-    it('proxies request', function(done) {
-      send_request({ proxy: nonexisting_host + ':123/done' }, proxied(nonexisting_host, '123', done))
-    })
-
-    it('does not set a Proxy-Authorization header', function(done) {
-      send_request({ proxy: nonexisting_host + ':123/done' }, no_proxy_auth(done));
-    })
-
-    describe('and proxy url contains user:pass', function() {
-
-      before(function() {
-        opts = {
-          proxy: 'http://mj:x@' + nonexisting_host + ':123/done'
-        }
-      })
-
-      it('proxies request', function(done) {
-        send_request(opts, proxied(nonexisting_host, '123', done))
-      })
-
-      it('sets Proxy-Authorization header', function(done) {
-        send_request(opts, proxy_auth_set('mj', 'x', done));
-      })
-
-    })
-
-    describe('and a proxy_user is passed', function() {
-
-      before(function() {
-        opts = {
-          proxy: nonexisting_host + ':123',
-          proxy_user: 'someone',
-          proxy_pass: 'else'
-        }
-      })
-
-      it('proxies request', function(done) {
-        send_request(opts, proxied(nonexisting_host, '123', done))
-      })
-
-      it('sets Proxy-Authorization header', function(done) {
-        send_request(opts, proxy_auth_set('someone', 'else', done));
-      })
-
-      describe('and url also contains user:pass', function() {
-
-        it('url user:pass wins', function(done) {
-          var opts = {
-            proxy: 'http://xxx:yyy@' + nonexisting_host + ':123',
-            proxy_user: 'someone',
-            proxy_pass: 'else'
-          }
-
-          send_request(opts, proxy_auth_set('xxx', 'yyy', done));
-        })
-
-      })
-
-      describe('and options.username is also present', function() {
-
-        before(function() {
-          opts = { proxy_user: 'foobar', username: 'someone' };
-        })
-
-        it('a separate Authorization header is set', function(done) {
-          var opts = {
-            proxy: nonexisting_host + ':123',
-            proxy_user: 'someone',
-            proxy_pass: 'else',
-            username: 'test',
-            password: 'X'
-          }
-
-          send_request(opts, basic_auth_set('test', 'X', done));
-        })
-
-      })
-
-    })
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/querystring_spec.js b/legacy-libs/grpc/node_modules/needle/test/querystring_spec.js
deleted file mode 100644 (file)
index 34c1748..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-var should    = require('should'),
-         stringify = require('../lib/querystring').build;
-
-describe('stringify', function() {
-
-       describe('with null', function() {
-
-               it('throws', function() {
-                       (function() {
-                               var res = stringify(null);
-                       }).should.throw();
-               })
-
-       })
-
-       describe('with a number', function() {
-
-               it('throws', function() {
-                       (function() {
-                               var res = stringify(100);
-                       }).should.throw();
-               })
-
-       })
-
-       describe('with a string', function() {
-
-               describe('that is empty', function() {
-
-                       it('throws', function() {
-                               (function() {
-                                       var res = stringify('');
-                               }).should.throw();
-                       })
-
-               })
-
-               describe('that doesnt contain an equal sign', function() {
-
-                       it('throws', function() {
-                               (function() {
-                                       var res = stringify('boomshagalaga');
-                               }).should.throw();
-                       })
-
-               })
-
-               describe('that contains an equal sign', function() {
-
-                       it('works', function() {
-                               var res = stringify('hello=123');
-                               res.should.eql('hello=123');
-                       })
-
-               })
-
-       })
-
-       describe('with an array', function() {
-
-               describe('with key val objects', function() {
-
-                       it('works', function() {
-                               var res = stringify([ {foo: 'bar'} ]);
-                               res.should.eql('foo=bar');
-                       })
-
-               })
-
-               describe('where all elements are strings with an equal sign', function() {
-
-                       it('works', function() {
-                               var res = stringify([ 'bar=123', 'quux=' ]);
-                               res.should.eql('bar=123&quux=');
-                       })
-
-               })
-
-               describe('with random words', function() {
-
-                       it('throws', function() {
-                               (function() {
-                                       var res = stringify(['hello', 'there']);
-                               }).should.throw();
-                       })
-
-               })
-
-               describe('with integers', function() {
-
-                       it('throws', function() {
-                               (function() {
-                                       var res = stringify([123, 432]);
-                               }).should.throw();
-                       })
-
-               })
-
-       })
-
-       describe('with an object', function() {
-
-                       it('works', function() {
-                               var res = stringify({ test: 100 });
-                               res.should.eql('test=100');
-                       })
-
-                       describe('with object where val is an array', function() {
-
-                               it('works', function() {
-                                       var res = stringify({ foo: ['bar', 'baz'] });
-                                       res.should.eql('foo[]=bar&foo[]=baz');
-                               })
-
-                       })
-
-                       describe('with object where val is an array of key val objects', function() {
-
-                               it('works', function() {
-                                       var res = stringify({ foo: [{'1': 'bar'}, {'2': 'baz'}] });
-                                       res.should.eql('foo[][1]=bar&foo[][2]=baz');
-                               })
-
-                       })
-
-       })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/redirect_spec.js b/legacy-libs/grpc/node_modules/needle/test/redirect_spec.js
deleted file mode 100644 (file)
index 9399c98..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-var helpers = require('./helpers'),
-    should  = require('should'),
-    sinon   = require('sinon'),
-    needle  = require('./../');
-
-var ports = {
-  http  : 8888,
-  https : 9999
-}
-
-var protocols = {
-  http  : require('http'),
-  https : require('https')
-}
-
-var code = 301;
-var location; // var to set the response location
-
-function response_code() {
-  return code;
-}
-
-function response_headers() {
-  return { 'Content-Type': 'text/plain', 'Location': location }
-}
-
-describe('redirects', function() {
-
-  var spies   = {},
-      servers = {};
-
-  var current_protocol;
-  var hostname = require('os').hostname();
-
-  // open two servers, one that responds to a redirect
-  before(function(done) {
-
-    var conf = {
-      port    : ports.http,
-      code    : response_code,
-      headers : response_headers
-    }
-
-    servers.http = helpers.server(conf, function() {
-      conf.port = ports.https;
-      conf.protocol = 'https';
-      servers.https = helpers.server(conf, done);
-    });
-  })
-
-  after(function(done) {
-    servers.http.close(function() {
-      servers.https.close(done);
-    });
-  })
-
-  var prots = {'http': 'https'};
-  Object.keys(prots).forEach(function(protocol) {
-
-    current_protocol = protocol;
-    var other_protocol = protocol == 'http' ? 'https' : 'http';
-
-    var opts, // each test will modify this
-        host = '127.0.0.1',
-        url  = protocol + '://' + host + ':' + ports[protocol] + '/hello';
-
-    function send_request(opts, cb) {
-      opts.rejectUnauthorized = false;
-      // console.log(' -- sending request ' + url + ' -- redirect to ' + location);
-      needle.post(url, { foo: 'bar' }, opts, cb);
-    }
-
-    function not_followed(done) {
-      send_request(opts, function(err, resp) {
-        resp.statusCode.should.eql(301);
-        if (current_protocol == 'http') {
-          spies.http.callCount.should.eql(1); // only original request
-          spies.https.callCount.should.eql(0);
-        } else {
-          spies.http.callCount.should.eql(0);
-          spies.https.callCount.should.eql(1); // only original request
-        }
-        done();
-      })
-    }
-
-    function followed_same_protocol(done) {
-      send_request(opts, function(err, resp) {
-        // the original request plus the redirect one
-        spies[current_protocol].callCount.should.eql(2);
-        done();
-      })
-
-    }
-
-    function followed_other_protocol(done) {
-      send_request(opts, function(err, resp) {
-        // on new node versions, https.request calls http.request internally,
-        // so we need to amount for that additional call.
-
-        var http_calls = protocols.http.Agent.defaultMaxSockets == Infinity ? 2 : 1;
-
-        spies.http.callCount.should.eql(http_calls); // the one(s) from http.request
-        spies.https.callCount.should.eql(1); // the one from https.request (redirect)
-        done();
-      })
-    }
-
-    // set a spy on [protocol].request
-    // so we can see how many times a request was made
-    before(function() {
-      spies.http  = sinon.spy(protocols.http, 'request');
-      spies.https = sinon.spy(protocols.https, 'request');
-    })
-
-    // and make sure it is restored after each test
-    afterEach(function() {
-      spies.http.reset();
-      spies.https.reset();
-    })
-
-    after(function() {
-      spies.http.restore();
-      spies.https.restore();
-    })
-
-    describe('when overriding defaults', function() {
-
-      before(function() {
-        needle.defaults({ follow_max: 10 });
-        opts = {};
-      })
-
-      after(function() {
-        // reset values to previous
-        needle.defaults({ follow_max: 0 });
-      })
-
-      describe('and redirected to the same path on same host and protocol', function() {
-        before(function() {
-          location = url;
-        })
-        it('does not follow redirect', not_followed);
-      })
-
-      describe('and redirected to the same path on same host and different protocol', function() {
-        before(function() {
-          location = url.replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]);
-        })
-
-        it('follows redirect', followed_other_protocol);
-      })
-
-      describe('and redirected to a different path on same host, same protocol', function() {
-        before(function() {
-          location = url.replace('/hello', '/goodbye');
-        })
-        it('follows redirect', followed_same_protocol);
-      })
-
-      describe('and redirected to a different path on same host, different protocol', function() {
-        before(function() {
-          location = url.replace('/hello', '/goodbye').replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]);
-        })
-        it('follows redirect', followed_other_protocol);
-      })
-
-      describe('and redirected to same path on another host, same protocol', function() {
-        before(function() {
-          location = url.replace(host, hostname);
-        })
-        it('follows redirect', followed_same_protocol);
-      })
-
-      describe('and redirected to same path on another host, different protocol', function() {
-        before(function() {
-          location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]);
-        })
-        it('follows redirect', followed_other_protocol);
-      })
-
-    })
-
-    // false and null have the same result
-    var values = [false, null];
-    values.forEach(function(value) {
-
-      describe('when follow is ' + value, function() {
-
-        before(function() {
-          opts = { follow: value };
-        })
-
-
-
-        describe('and redirected to the same path on same host and protocol', function() {
-          before(function() {
-            location = url;
-          })
-
-          it('throws an error', function() {
-            (function() {
-              send_request(opts, function() { });
-            }).should.throw;
-          })
-
-        })
-
-      })
-
-    })
-
-    describe('when follow is true', function() {
-
-      before(function() {
-        opts = { follow: true };
-      })
-
-      describe('and redirected to the same path on same host and protocol', function() {
-        before(function() { location = url })
-
-        it('throws an error', function() {
-          (function() {
-            send_request(opts, function() { });
-          }).should.throw;
-        })
-
-      })
-
-    })
-
-    describe('when follow is > 0', function() {
-
-      before(function() {
-        needle.defaults({ follow: 10 });
-      })
-
-      after(function() {
-        needle.defaults({ follow: 0 });
-      })
-
-      describe('when keep_method is false', function() {
-
-        before(function() {
-          opts = { follow_keep_method: false };
-        })
-
-        // defaults to follow host and protocol
-        describe('and redirected to the same path on same host and different protocol', function() {
-
-          before(function() {
-            location = url.replace(protocol, other_protocol);
-          })
-
-          it('follows redirect', followed_other_protocol);
-
-          it('sends a GET request with no data', function(done) {
-            send_request(opts, function(err, resp) {
-              spies.http.args[0][0].method.should.eql('GET');
-              // spy.args[0][3].should.eql(null);
-              done();
-            })
-          })
-
-        })
-
-      })
-
-      describe('and set_referer is true', function() {
-
-        before(function() {
-          opts = { follow_set_referer: true };
-        })
-
-        // defaults to follow host and protocol
-        describe('and redirected to the same path on same host and different protocol', function() {
-
-          before(function() {
-            location = url.replace(protocol, other_protocol);
-          })
-
-          it('follows redirect', followed_other_protocol);
-
-          it('sets Referer header when following redirect', function(done) {
-            send_request(opts, function(err, resp) {
-              spies.http.args[0][0].headers['referer'].should.eql("http://" + host + ":8888/hello");
-              // spies.http.args[0][3].should.eql({ foo: 'bar'});
-              done();
-            })
-          })
-
-        })
-
-      })
-
-      describe('and keep_method is true', function() {
-
-        before(function() {
-          opts = { follow_keep_method: true };
-        })
-
-        // defaults to follow host and protocol
-        describe('and redirected to the same path on same host and different protocol', function() {
-
-          before(function() {
-            location = url.replace(protocol, other_protocol);
-          })
-
-          it('follows redirect', followed_other_protocol);
-
-          it('sends a POST request with the original data', function(done) {
-            send_request(opts, function(err, resp) {
-              spies.http.args[0][0].method.should.eql('post');
-              // spies.http.args[0][3].should.eql({ foo: 'bar'});
-              done();
-            })
-          })
-
-        })
-
-      })
-
-      describe('and if_same_host is false', function() {
-
-        before(function() {
-          opts = { follow_if_same_host: false };
-        })
-
-        // by default it will follow other protocols
-        describe('and redirected to same path on another domain, same protocol', function() {
-          before(function() {
-            location = url.replace(host, hostname);
-          })
-          it('follows redirect', followed_same_protocol);
-        })
-
-      })
-
-      describe('and if_same_host is true', function() {
-
-        before(function() {
-          opts = { follow_if_same_host: true };
-        })
-
-        // by default it will follow other protocols
-        describe('and redirected to same path on another domain, same protocol', function() {
-          before(function() {
-            location = url.replace(host, hostname);
-          })
-
-          it('does not follow redirect', not_followed);
-        })
-
-      })
-
-      describe('and if_same_protocol is false', function() {
-
-        before(function() {
-          opts = { follow_if_same_protocol: false };
-        })
-
-        // by default it will follow other hosts
-        describe('and redirected to same path on another domain, different protocol', function() {
-          before(function() {
-            location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]);
-          })
-          it('follows redirect', followed_other_protocol);
-        })
-
-      })
-
-      describe('and if_same_protocol is true', function() {
-
-        before(function() {
-          opts = { follow_if_same_protocol: true };
-        })
-
-        // by default it will follow other hosts
-        describe('and redirected to same path on another domain, different protocol', function() {
-          before(function() {
-            location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]);
-          })
-          it('does not follow redirect', not_followed);
-        })
-
-      })
-
-    })
-
-  })
-
-});
diff --git a/legacy-libs/grpc/node_modules/needle/test/redirect_with_timeout.js b/legacy-libs/grpc/node_modules/needle/test/redirect_with_timeout.js
deleted file mode 100644 (file)
index 7e8e02e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-var should  = require('should')
-var needle  = require('./../')
-
-describe('follow redirects when read_timeout is set', function () {
-
-    it('clear timeout before following redirect', function (done) {
-        var opts = {
-            open_timeout: 1000,
-            read_timeout: 3000,
-            follow: 5,
-            user_agent: 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36'
-        }
-
-        var timedOut = 0
-        var redirects = 0
-
-        var timer = setTimeout(function () {
-            var hasRedirects = redirects > 0
-            hasRedirects.should.equal(true)
-            done()
-        }, opts.read_timeout || 3000)
-
-        var resp = needle.get('http://google.com/', opts, function (err, resp, body) {
-            var noErr = err === null
-            var hasBody = body.length > 0
-            noErr.should.equal(true);
-            hasBody.should.equal(true);
-        });
-
-        resp.on('redirect', function (location) {
-            redirects++
-            // console.info('    Redirected to ', location)
-        })
-
-        resp.on('timeout', function (type) {
-            timedOut++
-            timedOut.should.equal(0)
-            // console.error('   ', type, 'timeout')
-            clearTimeout(timer)
-            done()
-        })
-
-    }).timeout(30000)
-
-})
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/needle/test/request_stream_spec.js b/legacy-libs/grpc/node_modules/needle/test/request_stream_spec.js
deleted file mode 100644 (file)
index 1f02c8b..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-var fs     = require('fs'),
-    needle = require('..'),
-    stream = require('stream'),
-    http   = require('http'),
-    should = require('should'),
-    sinon  = require('sinon');
-
-var port   = 2233;
-
-describe('request stream length', function() {
-
-  var server, writable;
-
-  function createServer() {
-    return http.createServer(function(req, res) {
-
-      req.on('data', function(chunk) {
-        // console.log(chunk.length);
-      })
-
-      req.on('end', function() {
-        res.writeHeader(200, { 'Content-Type': 'application/json'})
-        res.end(JSON.stringify({ headers: req.headers }))
-      })
-
-    })
-  }
-
-  before(function(done) {
-    server = createServer();
-    server.listen(port, done)
-  })
-
-  beforeEach(function() {
-    writable = new stream.Readable();
-    writable._read = function() {
-      this.push('hello world');
-      this.push(null);
-    }
-  })
-
-  after(function(done) {
-    server.close(done)
-  })
-
-  function send_request(opts, cb) {
-    needle.post('http://localhost:' + port, writable, opts, function(err, resp) {
-      cb(err, resp)
-    })
-  }
-
-  describe('no stream_length set', function() {
-
-    it('doesnt set Content-Length header', function(done) {
-      send_request({}, function(err, resp) {
-        should.not.exist(resp.body.headers['content-length']);
-        done()
-      })
-    })
-
-    it('doesnt work if Transfer-Encoding is set to a blank string', function(done) {
-      send_request({ headers: { 'Transfer-Encoding': '' }}, function(err, resp) {
-        err.code.should.eql('ECONNRESET');
-        done()
-      })
-    })
-
-    it('works if Transfer-Encoding is not set', function(done) {
-      send_request({}, function(err, resp) {
-        should.not.exist(err);
-        resp.statusCode.should.eql(200);
-        done()
-      })
-    })
-
-  })
-
-  describe('stream_length set to invalid value', function() {
-
-    it('sets Content-Length header to that value', function(done) {
-      send_request({ stream_length: 5 }, function(err, resp) {
-        should.exist(err);
-        err.code.should.eql('ECONNRESET');
-        done()
-      })
-    })
-
-    it('doesnt work if Transfer-Encoding is set to a blank string', function(done) {
-      send_request({ stream_length: 5, headers: { 'Transfer-Encoding': '' }}, function(err, resp) {
-        err.code.should.eql('ECONNRESET');
-        done()
-      })
-    })
-
-    it('doesnt work if Transfer-Encoding is not set', function(done) {
-      send_request({ stream_length: 5 }, function(err, resp) {
-        err.code.should.eql('ECONNRESET');
-        done()
-      })
-    })
-
-  })
-
-  describe('stream_length is set to valid value', function() {
-
-    it('sets Content-Length header to that value', function(done) {
-      send_request({ stream_length: 11 }, function(err, resp) {
-        resp.body.headers['content-length'].should.eql('11');
-        done()
-      })
-    })
-
-    it('works if Transfer-Encoding is set to a blank string', function(done) {
-      send_request({ stream_length: 11, headers: { 'Transfer-Encoding': '' }}, function(err, resp) {
-        should.not.exist(err);
-        resp.statusCode.should.eql(200);
-        done()
-      })
-    })
-
-    it('works if Transfer-Encoding is not set', function(done) {
-      send_request({ stream_length: 11 }, function(err, resp) {
-        should.not.exist(err);
-        resp.statusCode.should.eql(200);
-        done()
-      })
-    })
-
-  })
-
-
-  describe('stream_length set to 0', function() {
-
-    describe('stream with path', function() {
-
-      var stub;
-
-      beforeEach(function() {
-        writable.path = '/foo/bar';
-        stub = sinon.stub(fs, 'stat', function(path, cb) {
-          cb(null, { size: 11 })
-        })
-      })
-
-      afterEach(function() {
-        stub.restore();
-      })
-
-      it('sets Content-Length header to streams length', function(done) {
-        send_request({ stream_length: 0 }, function(err, resp) {
-          resp.body.headers['content-length'].should.eql('11');
-          done()
-        })
-      })
-
-      it('works if Transfer-Encoding is set to a blank string', function(done) {
-        send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) {
-          should.not.exist(err);
-          resp.statusCode.should.eql(200);
-          done()
-        })
-      })
-
-      it('works if Transfer-Encoding is not set', function(done) {
-        send_request({ stream_length: 0 }, function(err, resp) {
-          should.not.exist(err);
-          resp.statusCode.should.eql(200);
-          done()
-        })
-      })
-
-    })
-
-    describe('stream without path', function() {
-      it('does not set Content-Length header', function(done) {
-        send_request({ stream_length: 0 }, function(err, resp) {
-          should.not.exist(resp.body.headers['content-length']);
-          done()
-        })
-      })
-
-      it('doesnt work if Transfer-Encoding is set to a blank string', function(done) {
-        send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) {
-          err.code.should.eql('ECONNRESET');
-          done()
-        })
-      })
-
-      it('works if Transfer-Encoding is not set', function(done) {
-        send_request({ stream_length: 0 }, function(err, resp) {
-          should.not.exist(err);
-          resp.statusCode.should.eql(200);
-          done()
-        })
-      })
-
-    })
-
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/response_stream_spec.js b/legacy-libs/grpc/node_modules/needle/test/response_stream_spec.js
deleted file mode 100644 (file)
index ef20e38..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-var should = require('should'),
-    needle = require('./../'),
-    http   = require('http'),
-    stream = require('stream'),
-    fs     = require('fs'),
-    port   = 11111,
-    server;
-
-describe('response streams', function() {
-
-  describe('when the server sends back json', function(){
-
-    before(function() {
-      server = http.createServer(function(req, res) {
-        res.setHeader('Content-Type', 'application/json')
-        res.end('{"foo":"bar"}')
-      }).listen(port);
-    });
-
-    after(function() {
-      server.close();
-    })
-
-    describe('and the client uses streams', function(){
-
-      it('should create a proper streams2 stream', function(done) {
-        var stream = needle.get('localhost:' + port)
-
-        // newer node versions set this to null instead of false
-        var bool = !!stream._readableState.flowing;
-        should.equal(false, bool);
-
-        var readableCalled = false;
-        stream.on('readable', function() {
-          readableCalled = true;
-        })
-
-        stream.on('done', function() {
-          readableCalled.should.be.true;
-          done();
-        });
-
-        stream.resume()
-
-      })
-
-      it('emits a single data item which is our JSON object', function(done) {
-        var stream = needle.get('localhost:' + port)
-
-        var chunks = [];
-        stream.on('readable', function () {
-          while (chunk = this.read()) {
-            chunk.should.be.an.Object;
-            chunks.push(chunk);
-          }
-        })
-
-        stream.on('done', function () {
-          chunks.should.have.length(1)
-          chunks[0].should.have.property('foo', 'bar');
-          done();
-        });
-      })
-
-      it('emits a raw buffer if we do not want to parse JSON', function(done) {
-        var stream  = needle.get('localhost:' + port, { parse: false })
-
-        var chunks = [];
-        stream.on('readable', function () {
-          while (chunk = this.read()) {
-            Buffer.isBuffer(chunk).should.be.true;
-            chunks.push(chunk);
-          }
-        })
-
-        stream.on('done', function() {
-          var body = Buffer.concat(chunks).toString();
-          body.should.equal('{"foo":"bar"}')
-          done();
-        });
-      })
-
-    })
-  })
-
-  describe('when the server sends back what was posted to it', function () {
-    var file = 'asdf.txt';
-
-    before(function(done){
-      server = http.createServer(function(req, res) {
-        res.setHeader('Content-Type', 'application/octet')
-        req.pipe(res);
-      }).listen(port);
-
-      fs.writeFile(file, 'contents of stream', done);
-    });
-
-    after(function(done){
-      server.close();
-      fs.unlink(file, done);
-    })
-
-    it('can PUT a stream', function (done) {
-      var stream = needle.put('localhost:' + port, fs.createReadStream(file), { stream: true });
-
-      var chunks = [];
-      stream.on('readable', function () {
-        while (chunk = this.read()) {
-          Buffer.isBuffer(chunk).should.be.true;
-          chunks.push(chunk);
-        }
-      })
-
-      stream.on('end', function () {
-        var body = Buffer.concat(chunks).toString();
-          body.should.equal('contents of stream')
-          done();
-      });
-    });
-
-    it('can PATCH a stream', function (done) {
-      var stream = needle.patch('localhost:' + port, fs.createReadStream(file), { stream: true });
-
-      var chunks = [];
-      stream.on('readable', function () {
-        while (chunk = this.read()) {
-          Buffer.isBuffer(chunk).should.be.true;
-          chunks.push(chunk);
-        }
-      })
-
-      stream.on('end', function () {
-        var body = Buffer.concat(chunks).toString();
-          body.should.equal('contents of stream')
-          done();
-      });
-    });
-  })
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/socket_pool_spec.js b/legacy-libs/grpc/node_modules/needle/test/socket_pool_spec.js
deleted file mode 100644 (file)
index 58ffa14..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-var needle  = require('../'),
-    should  = require('should'),
-    http    = require('http');
-
-var server, port = 11112;
-
-describe('socket reuse', function() {
-
-  before(function() {
-    server = http.createServer(function(req, res) {
-      res.setHeader('Content-Type', 'application/json');
-      setTimeout(function() {
-        res.end('{"foo":"bar"}');
-      }, 50);
-    }).listen(port);
-  });
-
-  after(function() {
-    server.close();
-  });
-
-  describe('when sockets are reused', function() {
-
-    var httpAgent = new http.Agent({
-      keepAlive  : true,
-      maxSockets : 1
-    });
-
-    it('does not duplicate listeners on .end', function(done) {
-
-      var last_error;
-      var count = 10;
-
-      function completed(err) {
-        --count || done(last_error);
-      }
-
-      function send() {
-        needle.get('localhost:' + port, { agent: httpAgent }, function(err, resp) {
-          if (err)
-            throw new Error("Unexpected error: " + err);
-
-          // lets go through all sockets and inspect all socket objects
-          for (hostTarget in httpAgent.sockets) {
-            httpAgent.sockets[hostTarget].forEach(function(socket) {
-              // normally, there are 2 internal listeners and 1 needle sets up,
-              // but to be sure the test does not fail even if newer node versions
-              // introduce additional listeners, we use a higher limit.
-              try {
-                socket.listeners('end').length.should.be.below(5, "too many listeners on the socket object's end event");
-              } catch (e) {
-                last_error = e;
-              }
-            });
-          }
-
-          completed();
-        });
-      }
-
-      for (var i = 0; i < count; i++) {
-        send();
-      }
-    });
-  });
-});
diff --git a/legacy-libs/grpc/node_modules/needle/test/url_spec.js b/legacy-libs/grpc/node_modules/needle/test/url_spec.js
deleted file mode 100644 (file)
index 8a0fa3e..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-var needle  = require('../'),
-    sinon   = require('sinon'),
-    should  = require('should'),
-    http    = require('http'),
-    helpers = require('./helpers');
-
-var port = 3456;
-
-describe('urls', function() {
-
-  var server, url;
-
-  function send_request(cb) {
-    return needle.get(url, cb);
-  }
-
-  before(function(done){
-    server = helpers.server({ port: port }, done);
-  })
-
-  after(function(done) {
-    server.close(done);
-  })
-
-  describe('null URL', function(){
-
-    it('throws', function(){
-      (function() {
-      send_request()
-      }).should.throw();
-    })
-
-  })
-
-  describe('invalid protocol', function(){
-
-    before(function() {
-      url = 'foo://google.com/what'
-    })
-
-    it('does not throw', function(done) {
-      (function() {
-        send_request(function(err) { 
-          done();
-        })
-      }).should.not.throw()
-    })
-
-    it('returns an error', function(done) {
-      send_request(function(err) {
-        err.should.be.an.Error;
-        err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/)
-        done();
-      })
-    })
-
-  })
-
-  describe('invalid host', function(){
-
-    before(function() {
-      url = 'http://s1\\\2.com/'
-    })
-
-    it('fails', function(done) {
-      (function() {
-        send_request(function(){ })
-      }.should.throw(TypeError))
-      done()
-    })
-
-  })
-
-/*
-  describe('invalid path', function(){
-
-    before(function() {
-      url = 'http://www.google.com\\\/x\\\   %^&*() /x2.com/'
-    })
-
-    it('fails', function(done) {
-      send_request(function(err) {
-        err.should.be.an.Error;
-        done();
-      })
-    })
-
-  })
-*/
-
-  describe('valid protocol and path', function() {
-
-    before(function() {
-      url = 'http://localhost:' + port + '/foo';
-    })
-
-    it('works', function(done) {
-      send_request(function(err){
-        should.not.exist(err);
-        done();
-      })
-    })
-
-  })
-
-  describe('no protocol but with slashes and valid path', function() {
-
-    before(function() {
-      url = '//localhost:' + port + '/foo';
-    })
-
-    it('works', function(done) {
-      send_request(function(err){
-        should.not.exist(err);
-        done();
-      })
-    })
-
-  })
-
-  describe('no protocol nor slashes and valid path', function() {
-
-    before(function() {
-      url = 'localhost:' + port + '/foo';
-    })
-
-    it('works', function(done) {
-      send_request(function(err){
-        should.not.exist(err);
-        done();
-      })
-    })
-
-  })
-
-  describe('double encoding', function() {
-
-    var path = '/foo?email=' + encodeURIComponent('what-ever@Example.Com');
-
-    before(function() {
-      url = 'localhost:' + port + path
-    });
-
-    it('should not occur', function(done) {
-      send_request(function(err, res) {
-        should.not.exist(err);
-        should(res.req.path).be.exactly(path);
-        done();
-      });
-
-    });
-
-  })
-
-})
diff --git a/legacy-libs/grpc/node_modules/needle/test/utils/formidable.js b/legacy-libs/grpc/node_modules/needle/test/utils/formidable.js
deleted file mode 100644 (file)
index ba1d983..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-var formidable = require('formidable'),
-    http = require('http'),
-    util = require('util');
-
-var port = process.argv[2] || 8888;
-
-http.createServer(function(req, res) {
-  var form = new formidable.IncomingForm();
-  form.parse(req, function(err, fields, files) {
-    res.writeHead(200, {'content-type': 'text/plain'});
-    res.write('received upload:\n\n');
-    console.log(util.inspect({fields: fields, files: files}))
-    res.end(util.inspect({fields: fields, files: files}));
-  });
-}).listen(port);
-
-console.log('HTTP server listening on port ' + port);
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/needle/test/utils/proxy.js b/legacy-libs/grpc/node_modules/needle/test/utils/proxy.js
deleted file mode 100644 (file)
index 531bf49..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-var http = require('http'),
-    https = require('https'),
-    url = require('url');
-    
-var port = 1234,
-    log  = true,
-    request_auth = false;
-
-http.createServer(function(request, response) {
-
-  console.log(request.headers);
-  console.log("Got request: " + request.url);
-  console.log("Forwarding request to " + request.headers['host']);
-
-  if (request_auth) {
-      if (!request.headers['proxy-authorization']) {
-        response.writeHead(407, {'Proxy-Authenticate': 'Basic realm="proxy.com"'})
-        return response.end('Hello.');        
-      }
-  }
-
-  var remote = url.parse(request.url);
-  var protocol = remote.protocol == 'https:' ? https : http;
-
-  var opts = {
-    host: request.headers['host'],
-    port: remote.port || (remote.protocol == 'https:' ? 443 : 80),
-    method: request.method,
-    path: remote.pathname,
-    headers: request.headers
-  }
-
-  var proxy_request = protocol.request(opts, function(proxy_response){
-
-    proxy_response.on('data', function(chunk) {
-      if (log) console.log(chunk.toString());
-      response.write(chunk, 'binary');
-    });
-    proxy_response.on('end', function() {
-      response.end();
-    });
-
-    response.writeHead(proxy_response.statusCode, proxy_response.headers);
-  });
-
-  request.on('data', function(chunk) {
-    if (log) console.log(chunk.toString());
-    proxy_request.write(chunk, 'binary');
-  });
-
-  request.on('end', function() {
-    proxy_request.end();
-  });
-
-}).listen(port);
-
-process.on('uncaughtException', function(err){
-  console.log('Uncaught exception!');
-  console.log(err);
-});
-
-console.log("Proxy server listening on port " + port);
diff --git a/legacy-libs/grpc/node_modules/needle/test/utils/test.js b/legacy-libs/grpc/node_modules/needle/test/utils/test.js
deleted file mode 100644 (file)
index 8d58d70..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-// TODO: write specs. :)
-
-var fs = require('fs'),
-    client = require('./../../');
-
-process.env.DEBUG = true;
-
-var response_callback = function(err, resp, body){
-       console.log(err);
-       if(resp) console.log("Got status code " + resp.statusCode)
-       console.log(body);
-}
-
-function simple_head(){
-       client.head('http://www.amazon.com', response_callback);
-}
-
-function simple_get(){
-       client.get('http://www.nodejs.org', response_callback);
-}
-
-function proxy_get(){
-       client.get('https://www.google.com/search?q=nodejs', {proxy: 'http://localhost:1234'}, response_callback);
-}
-
-function auth_get(){
-       client.get('https://www.twitter.com', {username: 'asd', password: '123'}, response_callback);
-}
-
-function simple_post(url){
-
-       var data = {
-               foo: 'bar',
-               baz: {
-                       nested: 'attribute'
-               }
-       }
-
-       client.post(url, data, response_callback);
-
-}
-
-function multipart_post(url){
-
-       var filename = 'test_file.txt';
-       var data = 'Plain text data.\nLorem ipsum dolor sit amet.\nBla bla bla.\n';
-       fs.writeFileSync(filename, data);
-
-       var black_pixel = Buffer.from("data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=".replace(/^data:image\/\w+;base64,/, ""), "base64");
-
-       var data = {
-               foo: 'bar',
-               bar: 'baz',
-               nested: {
-                       my_document: { file: filename, content_type: 'text/plain' },
-                       even: {
-                               more: 'nesting'
-                       }
-               },
-    pixel: { filename: 'black_pixel.gif', buffer: black_pixel, content_type: 'image/gif' },
-    field2: {value: JSON.stringify({"json":[ {"one":1}, {"two":2} ]}), content_type: 'application/json' }
-       }
-
-       client.post(url, data, {multipart: true}, function(err, resp, body){
-
-               console.log(err);
-               console.log("Got status code " + resp.statusCode)
-               console.log(body);
-               fs.unlink(filename);
-
-       });
-
-}
-
-switch(process.argv[2]){
-       case 'head':
-               simple_head();
-               break;
-       case 'get':
-               simple_get();
-               break;
-       case 'auth':
-               auth_get();
-               break;
-       case 'proxy':
-               proxy_get();
-               break;
-       case 'post':
-               simple_post(process.argv[3] || 'http://posttestserver.com/post.php');
-               break;
-       case 'multipart':
-               multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example');
-               break;
-       case 'all':
-               simple_head();
-               simple_get();
-               auth_get();
-               proxy_get();
-               simple_post(process.argv[3] || 'http://posttestserver.com/post.php');
-               multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example');
-               break;
-       default:
-               console.log("Usage: ./test.js [head|get|auth|proxy|multipart]")
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/CHANGELOG.md b/legacy-libs/grpc/node_modules/node-pre-gyp/CHANGELOG.md
deleted file mode 100644 (file)
index bed8edc..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-# node-pre-gyp changelog
-
-## 0.12.0
-
-- Fixed double-build problem with node v10 (https://github.com/mapbox/node-pre-gyp/pull/428)
-- Added node 11 support in the local database (https://github.com/mapbox/node-pre-gyp/pull/422)
-
-## 0.11.0
-
-- Fixed double-install problem with node v10
-- Significant N-API improvements (https://github.com/mapbox/node-pre-gyp/pull/405)
-
-## 0.10.3
-
-- Now will use `request` over `needle` if request is installed. By default `needle` is used for `https`. This should unbreak proxy support that regressed in v0.9.0
-
-## 0.10.2
-
-- Fixed rc/deep-extent security vulnerability
-- Fixed broken reinstall script do to incorrectly named get_best_napi_version
-
-## 0.10.1
-
-- Fix needle error event (@medns)
-
-## 0.10.0
-
-- Allow for a single-level module path when packing @allenluce (https://github.com/mapbox/node-pre-gyp/pull/371)
-- Log warnings instead of errors when falling back @xzyfer (https://github.com/mapbox/node-pre-gyp/pull/366)
-- Add Node.js v10 support to tests (https://github.com/mapbox/node-pre-gyp/pull/372)
-- Remove retire.js from CI (https://github.com/mapbox/node-pre-gyp/pull/372)
-- Remove support for Node.js v4 due to [EOL on April 30th, 2018](https://github.com/nodejs/Release/blob/7dd52354049cae99eed0e9fe01345b0722a86fde/schedule.json#L14)
-- Update appveyor tests to install default NPM version instead of NPM v2.x for all Windows builds (https://github.com/mapbox/node-pre-gyp/pull/375)
-
-## 0.9.1
-
-- Fixed regression (in v0.9.0) with support for http redirects @allenluce (https://github.com/mapbox/node-pre-gyp/pull/361)
-
-## 0.9.0
-
-- Switched from using `request` to `needle` to reduce size of module deps (https://github.com/mapbox/node-pre-gyp/pull/350)
-
-## 0.8.0
-
-- N-API support (@inspiredware)
-
-## 0.7.1
-
-- Upgraded to tar v4.x
-
-## 0.7.0
-
- - Updated request and hawk (#347)
- - Dropped node v0.10.x support
-
-## 0.6.40
-
- - Improved error reporting if an install fails
-
-## 0.6.39
-
- - Support for node v9
- - Support for versioning on `{libc}` to allow binaries to work on non-glic linux systems like alpine linux
-
-
-## 0.6.38
-
- - Maintaining compatibility (for v0.6.x series) with node v0.10.x
-
-## 0.6.37
-
- - Solved one part of #276: now now deduce the node ABI from the major version for node >= 2 even when not stored in the abi_crosswalk.json
- - Fixed docs to avoid mentioning the deprecated and dangerous `prepublish` in package.json (#291)
- - Add new node versions to crosswalk
- - Ported tests to use tape instead of mocha
- - Got appveyor tests passing by downgrading npm and node-gyp
-
-## 0.6.36
-
- - Removed the running of `testbinary` during install. Because this was regressed for so long, it is too dangerous to re-enable by default. Developers needing validation can call `node-pre-gyp testbinary` directory.
- - Fixed regression in v0.6.35 for electron installs (now skipping binary validation which is not yet supported for electron)
-
-## 0.6.35
-
- - No longer recommending `npm ls` in `prepublish` (#291)
- - Fixed testbinary command (#283) @szdavid92
-
-## 0.6.34
-
- - Added new node versions to crosswalk, including v8
- - Upgraded deps to latest versions, started using `^` instead of `~` for all deps.
-
-## 0.6.33
-
- - Improved support for yarn
-
-## 0.6.32
-
- - Honor npm configuration for CA bundles (@heikkipora)
- - Add node-pre-gyp and npm versions to user agent (@addaleax)
- - Updated various deps
- - Add known node version for v7.x
-
-## 0.6.31
-
- - Updated various deps
-
-## 0.6.30
-
- - Update to npmlog@4.x and semver@5.3.x
- - Add known node version for v6.5.0
-
-## 0.6.29
-
- - Add known node versions for v0.10.45, v0.12.14, v4.4.4, v5.11.1, and v6.1.0
-
-## 0.6.28
-
- - Now more verbose when remote binaries are not available. This is needed since npm is increasingly more quiet by default
-   and users need to know why builds are falling back to source compiles that might then error out.
-
-## 0.6.27
-
- - Add known node version for node v6
- - Stopped bundling dependencies
- - Documented method for module authors to avoid bundling node-pre-gyp
-   - See https://github.com/mapbox/node-pre-gyp/tree/master#configuring for details
-
-## 0.6.26
-
- - Skip validation for nw runtime (https://github.com/mapbox/node-pre-gyp/pull/181) via @fleg
-
-## 0.6.25
-
- - Improved support for auto-detection of electron runtime in `node-pre-gyp.find()`
-   - Pull request from @enlight - https://github.com/mapbox/node-pre-gyp/pull/187
- - Add known node version for 4.4.1 and 5.9.1
-
-## 0.6.24
-
- - Add known node version for 5.8.0, 5.9.0, and 4.4.0.
-
-## 0.6.23
-
- - Add known node version for 0.10.43, 0.12.11, 4.3.2, and 5.7.1.
-
-## 0.6.22
-
- - Add known node version for 4.3.1, and 5.7.0.
-
-## 0.6.21
-
- - Add known node version for 0.10.42, 0.12.10, 4.3.0, and 5.6.0.
-
-## 0.6.20
-
- - Add known node version for 4.2.5, 4.2.6, 5.4.0, 5.4.1,and 5.5.0.
-
-## 0.6.19
-
- - Add known node version for 4.2.4
-
-## 0.6.18
-
- - Add new known node versions for 0.10.x, 0.12.x, 4.x, and 5.x
-
-## 0.6.17
-
- - Re-tagged to fix packaging problem of `Error: Cannot find module 'isarray'`
-
-## 0.6.16
-
- - Added known version in crosswalk for 5.1.0.
-
-## 0.6.15
-
- - Upgraded tar-pack (https://github.com/mapbox/node-pre-gyp/issues/182)
- - Support custom binary hosting mirror (https://github.com/mapbox/node-pre-gyp/pull/170)
- - Added known version in crosswalk for 4.2.2.
-
-## 0.6.14
-
- - Added node 5.x version
-
-## 0.6.13
-
- - Added more known node 4.x versions
-
-## 0.6.12
-
- - Added support for [Electron](http://electron.atom.io/). Just pass the `--runtime=electron` flag when building/installing. Thanks @zcbenz
-
-## 0.6.11
-
- - Added known node and io.js versions including more 3.x and 4.x versions
-
-## 0.6.10
-
- - Added known node and io.js versions including 3.x and 4.x versions
- - Upgraded `tar` dep
-
-## 0.6.9
-
- - Upgraded `rc` dep
- - Updated known io.js version: v2.4.0
-
-## 0.6.8
-
- - Upgraded `semver` and `rimraf` deps
- - Updated known node and io.js versions
-
-## 0.6.7
-
- - Fixed `node_abi` versions for io.js 1.1.x -> 1.8.x (should be 43, but was stored as 42) (refs https://github.com/iojs/build/issues/94)
-
-## 0.6.6
-
- - Updated with known io.js 2.0.0 version
-
-## 0.6.5
-
- - Now respecting `npm_config_node_gyp` (https://github.com/npm/npm/pull/4887)
- - Updated to semver@4.3.2
- - Updated known node v0.12.x versions and io.js 1.x versions.
-
-## 0.6.4
-
- - Improved support for `io.js` (@fengmk2)
- - Test coverage improvements (@mikemorris)
- - Fixed support for `--dist-url` that regressed in 0.6.3
-
-## 0.6.3
-
- - Added support for passing raw options to node-gyp using `--` separator. Flags passed after
-   the `--` to `node-pre-gyp configure` will be passed directly to gyp while flags passed
-   after the `--` will be passed directly to make/visual studio.
- - Added `node-pre-gyp configure` command to be able to call `node-gyp configure` directly
- - Fix issue with require validation not working on windows 7 (@edgarsilva)
-
-## 0.6.2
-
- - Support for io.js >= v1.0.2
- - Deferred require of `request` and `tar` to help speed up command line usage of `node-pre-gyp`.
-
-## 0.6.1
-
- - Fixed bundled `tar` version
-
-## 0.6.0
-
- - BREAKING: node odd releases like v0.11.x now use `major.minor.patch` for `{node_abi}` instead of `NODE_MODULE_VERSION` (#124)
- - Added support for `toolset` option in versioning. By default is an empty string but `--toolset` can be passed to publish or install to select alternative binaries that target a custom toolset like C++11. For example to target Visual Studio 2014 modules like node-sqlite3 use `--toolset=v140`.
- - Added support for `--no-rollback` option to request that a failed binary test does not remove the binary module leaves it in place.
- - Added support for `--update-binary` option to request an existing binary be re-installed and the check for a valid local module be skipped.
- - Added support for passing build options from `npm` through `node-pre-gyp` to `node-gyp`: `--nodedir`, `--disturl`, `--python`, and `--msvs_version`
-
-## 0.5.31
-
- - Added support for deducing node_abi for node.js runtime from previous release if the series is even
- - Added support for --target=0.10.33
-
-## 0.5.30
-
- - Repackaged with latest bundled deps
-
-## 0.5.29
-
- - Added support for semver `build`.
- - Fixed support for downloading from urls that include `+`.
-
-## 0.5.28
-
- - Now reporting unix style paths only in reveal command
-
-## 0.5.27
-
- - Fixed support for auto-detecting s3 bucket name when it contains `.` - @taavo
- - Fixed support for installing when path contains a `'` - @halfdan
- - Ported tests to mocha
-
-## 0.5.26
-
- - Fix node-webkit support when `--target` option is not provided
-
-## 0.5.25
-
- - Fix bundling of deps
-
-## 0.5.24
-
- - Updated ABI crosswalk to incldue node v0.10.30 and v0.10.31
-
-## 0.5.23
-
- - Added `reveal` command. Pass no options to get all versioning data as json. Pass a second arg to grab a single versioned property value
- - Added support for `--silent` (shortcut for `--loglevel=silent`)
-
-## 0.5.22
-
- - Fixed node-webkit versioning name (NOTE: node-webkit support still experimental)
-
-## 0.5.21
-
- - New package to fix `shasum check failed` error with v0.5.20
-
-## 0.5.20
-
- - Now versioning node-webkit binaries based on major.minor.patch - assuming no compatible ABI across versions (#90)
-
-## 0.5.19
-
- - Updated to know about more node-webkit releases
-
-## 0.5.18
-
- - Updated to know about more node-webkit releases
-
-## 0.5.17
-
- - Updated to know about node v0.10.29 release
-
-## 0.5.16
-
- - Now supporting all aws-sdk configuration parameters (http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) (#86)
-
-## 0.5.15
-
- - Fixed installation of windows packages sub directories on unix systems (#84)
-
-## 0.5.14
-
- - Finished support for cross building using `--target_platform` option (#82)
- - Now skipping binary validation on install if target arch/platform do not match the host.
- - Removed multi-arch validing for OS X since it required a FAT node.js binary
-
-## 0.5.13
-
- - Fix problem in 0.5.12 whereby the wrong versions of mkdirp and semver where bundled.
-
-## 0.5.12
-
- - Improved support for node-webkit (@Mithgol)
-
-## 0.5.11
-
- - Updated target versions listing
-
-## 0.5.10
-
- - Fixed handling of `-debug` flag passed directory to node-pre-gyp (#72)
- - Added optional second arg to `node_pre_gyp.find` to customize the default versioning options used to locate the runtime binary
- - Failed install due to `testbinary` check failure no longer leaves behind binary (#70)
-
-## 0.5.9
-
- - Fixed regression in `testbinary` command causing installs to fail on windows with 0.5.7 (#60)
-
-## 0.5.8
-
- - Started bundling deps
-
-## 0.5.7
-
- - Fixed the `testbinary` check, which is used to determine whether to re-download or source compile, to work even in complex dependency situations (#63)
- - Exposed the internal `testbinary` command in node-pre-gyp command line tool
- - Fixed minor bug so that `fallback_to_build` option is always respected
-
-## 0.5.6
-
- - Added support for versioning on the `name` value in `package.json` (#57).
- - Moved to using streams for reading tarball when publishing (#52)
-
-## 0.5.5
-
- - Improved binary validation that also now works with node-webkit (@Mithgol)
- - Upgraded test apps to work with node v0.11.x
- - Improved test coverage
-
-## 0.5.4
-
- - No longer depends on external install of node-gyp for compiling builds.
-
-## 0.5.3
-
- - Reverted fix for debian/nodejs since it broke windows (#45)
-
-## 0.5.2
-
- - Support for debian systems where the node binary is named `nodejs` (#45)
- - Added `bin/node-pre-gyp.cmd` to be able to run command on windows locally (npm creates an .npm automatically when globally installed)
- - Updated abi-crosswalk with node v0.10.26 entry.
-
-## 0.5.1
-
- - Various minor bug fixes, several improving windows support for publishing.
-
-## 0.5.0
-
- - Changed property names in `binary` object: now required are `module_name`, `module_path`, and `host`.
- - Now `module_path` supports versioning, which allows developers to opt-in to using a versioned install path (#18).
- - Added `remote_path` which also supports versioning.
- - Changed `remote_uri` to `host`.
-
-## 0.4.2
-
- - Added support for `--target` flag to request cross-compile against a specific node/node-webkit version.
- - Added preliminary support for node-webkit
- - Fixed support for `--target_arch` option being respected in all cases.
-
-## 0.4.1
-
- - Fixed exception when only stderr is available in binary test (@bendi / #31)
-
-## 0.4.0
-
- - Enforce only `https:` based remote publishing access.
- - Added `node-pre-gyp info` command to display listing of published binaries
- - Added support for changing the directory node-pre-gyp should build in with the `-C/--directory` option.
- - Added support for S3 prefixes.
-
-## 0.3.1
-
- - Added `unpublish` command.
- - Fixed module path construction in tests.
- - Added ability to disable falling back to build behavior via `npm install --fallback-to-build=false` which overrides setting in a depedencies package.json `install` target.
-
-## 0.3.0
-
- - Support for packaging all files in `module_path` directory - see `app4` for example
- - Added `testpackage` command.
- - Changed `clean` command to only delete `.node` not entire `build` directory since node-gyp will handle that.
- - `.node` modules must be in a folder of there own since tar-pack will remove everything when it unpacks.
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/LICENSE b/legacy-libs/grpc/node_modules/node-pre-gyp/LICENSE
deleted file mode 100644 (file)
index 8f5fce9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c), Mapbox
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimer in the documentation
-      and/or other materials provided with the distribution.
-    * Neither the name of node-pre-gyp nor the names of its contributors
-      may be used to endorse or promote products derived from this software
-      without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/README.md b/legacy-libs/grpc/node_modules/node-pre-gyp/README.md
deleted file mode 100644 (file)
index 088f2af..0000000
+++ /dev/null
@@ -1,693 +0,0 @@
-# node-pre-gyp
-
-#### node-pre-gyp makes it easy to publish and install Node.js C++ addons from binaries
-
-[![NPM](https://nodei.co/npm/node-pre-gyp.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-pre-gyp/)
-
-[![Build Status](https://api.travis-ci.org/mapbox/node-pre-gyp.svg)](https://travis-ci.org/mapbox/node-pre-gyp)
-[![Build status](https://ci.appveyor.com/api/projects/status/3nxewb425y83c0gv)](https://ci.appveyor.com/project/Mapbox/node-pre-gyp)
-[![Dependencies](https://david-dm.org/mapbox/node-pre-gyp.svg)](https://david-dm.org/mapbox/node-pre-gyp)
-
-`node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp) and offers a cross-platform method of binary deployment.
-
-### Features
-
- - A command line tool called `node-pre-gyp` that can install your package's C++ module from a binary.
- - A variety of developer targeted commands for packaging, testing, and publishing binaries.
- - A JavaScript module that can dynamically require your installed binary: `require('node-pre-gyp').find`
-
-For a hello world example of a module packaged with `node-pre-gyp` see <https://github.com/springmeyer/node-addon-example> and [the wiki ](https://github.com/mapbox/node-pre-gyp/wiki/Modules-using-node-pre-gyp) for real world examples.
-
-## Credits
-
- - The module is modeled after [node-gyp](https://github.com/Tootallnate/node-gyp) by [@Tootallnate](https://github.com/Tootallnate)
- - Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost).
- - Development is sponsored by [Mapbox](https://www.mapbox.com/)
-
-## FAQ
-
-See the [Frequently Ask Questions](https://github.com/mapbox/node-pre-gyp/wiki/FAQ).
-
-## Depends
-
- - Node.js >= node v6.x
-
-## Install
-
-`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like:
-
-    ./node_modules/.bin/node-pre-gyp --help
-
-But you can also install it globally:
-
-    npm install node-pre-gyp -g
-
-## Usage
-
-### Commands
-
-View all possible commands:
-
-    node-pre-gyp --help
-
-- clean - Remove the entire folder containing the compiled .node module
-- install - Install pre-built binary for module
-- reinstall - Run "clean" and "install" at once
-- build - Compile the module by dispatching to node-gyp or nw-gyp
-- rebuild - Run "clean" and "build" at once
-- package - Pack binary into tarball
-- testpackage - Test that the staged package is valid
-- publish - Publish pre-built binary
-- unpublish - Unpublish pre-built binary
-- info - Fetch info on published binaries
-
-You can also chain commands:
-
-    node-pre-gyp clean build unpublish publish info
-
-### Options
-
-Options include:
-
- - `-C/--directory`: run the command in this directory
- - `--build-from-source`: build from source instead of using pre-built binary
- - `--update-binary`: reinstall by replacing previously installed local binary with remote binary
- - `--runtime=node-webkit`: customize the runtime: `node`, `electron` and `node-webkit` are the valid options
- - `--fallback-to-build`: fallback to building from source if pre-built binary is not available
- - `--target=0.4.0`: Pass the target node or node-webkit version to compile against
- - `--target_arch=ia32`: Pass the target arch and override the host `arch`. Valid values are 'ia32','x64', or `arm`.
- - `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`.
-
-Both `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module.
-
-For example: `npm install --build-from-source=myapp`. This is useful if:
-
- - `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependency with `npm install`.
- - The larger app also depends on other modules installed with `node-pre-gyp`
- - You only want to trigger a source compile for `myapp` and the other modules.
-
-### Configuring
-
-This is a guide to configuring your module to use node-pre-gyp.
-
-#### 1) Add new entries to your `package.json`
-
- - Add `node-pre-gyp` to `dependencies`
- - Add `aws-sdk` as a `devDependency`
- - Add a custom `install` script
- - Declare a `binary` object
-
-This looks like:
-
-```js
-    "dependencies"  : {
-      "node-pre-gyp": "0.6.x"
-    },
-    "devDependencies": {
-      "aws-sdk": "2.x"
-    }
-    "scripts": {
-        "install": "node-pre-gyp install --fallback-to-build"
-    },
-    "binary": {
-        "module_name": "your_module",
-        "module_path": "./lib/binding/",
-        "host": "https://your_module.s3-us-west-1.amazonaws.com"
-    }
-```
-
-For a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/master/package.json).
-
-Let's break this down:
-
- - Dependencies need to list `node-pre-gyp`
- - Your devDependencies should list `aws-sdk` so that you can run `node-pre-gyp publish` locally or a CI system. We recommend using `devDependencies` only since `aws-sdk` is large and not needed for `node-pre-gyp install` since it only uses http to fetch binaries
- - Your `scripts` section should override the `install` target with `"install": "node-pre-gyp install --fallback-to-build"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly.
- - Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below.
-
-Note: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `"preinstall": "npm install node-pre-gyp"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908.
-
-##### The `binary` object has three required properties
-
-###### module_name
-
-The name of your native node module. This value must:
-
- - Match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world)
- - Must be a valid C variable name (e.g. it cannot contain `-`)
- - Should not include the `.node` extension.
-
-###### module_path
-
-The location your native module is placed after a build. This should be an empty directory without other Javascript files. This entire directory will be packaged in the binary tarball. When installing from a remote package this directory will be overwritten with the contents of the tarball.
-
-Note: This property supports variables based on [Versioning](#versioning).
-
-###### host
-
-A url to the remote location where you've published tarball binaries (must be `https` not `http`).
-
-It is highly recommended that you use Amazon S3. The reasons are:
-
-  - Various node-pre-gyp commands like `publish` and `info` only work with an S3 host.
-  - S3 is a very solid hosting platform for distributing large files.
-  - We provide detail documentation for using [S3 hosting](#s3-hosting) with node-pre-gyp.
-
-Why then not require S3? Because while some applications using node-pre-gyp need to distribute binaries as large as 20-30 MB, others might have very small binaries and might wish to store them in a GitHub repo. This is not recommended, but if an author really wants to host in a non-S3 location then it should be possible.
-
-It should also be mentioned that there is an optional and entirely separate npm module called [node-pre-gyp-github](https://github.com/bchr02/node-pre-gyp-github) which is intended to complement node-pre-gyp and be installed along with it. It provides the ability to store and publish your binaries within your repositories GitHub Releases if you would rather not use S3 directly. Installation and usage instructions can be found [here](https://github.com/bchr02/node-pre-gyp-github), but the basic premise is that instead of using the ```node-pre-gyp publish``` command you would use ```node-pre-gyp-github publish```.
-
-##### The `binary` object has two optional properties
-
-###### remote_path
-
-It **is recommended** that you customize this property. This is an extra path to use for publishing and finding remote tarballs. The default value for `remote_path` is `""` meaning that if you do not provide it then all packages will be published at the base of the `host`. It is recommended to provide a value like `./{name}/v{version}` to help organize remote packages in the case that you choose to publish multiple node addons to the same `host`.
-
-Note: This property supports variables based on [Versioning](#versioning).
-
-###### package_name
-
-It is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`.
-
-Avoiding the version of your module in the `package_name` and instead only embedding in a directory name can be useful when you want to make a quick tag of your module that does not change any C++ code. In this case you can just copy binaries to the new version behind the scenes like:
-
-```sh
-aws s3 sync --acl public-read s3://mapbox-node-binary/sqlite3/v3.0.3/ s3://mapbox-node-binary/sqlite3/v3.0.4/
-```
-
-Note: This property supports variables based on [Versioning](#versioning).
-
-#### 2) Add a new target to binding.gyp
-
-`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path).
-
-A new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`.
-
-Add a target like this at the end of your `targets` list:
-
-```js
-    {
-      "target_name": "action_after_build",
-      "type": "none",
-      "dependencies": [ "<(module_name)" ],
-      "copies": [
-        {
-          "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
-          "destination": "<(module_path)"
-        }
-      ]
-    }
-```
-
-For a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp).
-
-#### 3) Dynamically require your `.node`
-
-Inside the main js file that requires your addon module you are likely currently doing:
-
-```js
-var binding = require('../build/Release/binding.node');
-```
-
-or:
-
-```js
-var bindings = require('./bindings')
-```
-
-Change those lines to:
-
-```js
-var binary = require('node-pre-gyp');
-var path = require('path');
-var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));
-var binding = require(binding_path);
-```
-
-For a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4)
-
-#### 4) Build and package your app
-
-Now build your module from source:
-
-    npm install --build-from-source
-
-The `--build-from-source` tells `node-pre-gyp` to not look for a remote package and instead dispatch to node-gyp to build.
-
-Now `node-pre-gyp` should now also be installed as a local dependency so the command line tool it offers can be found at `./node_modules/.bin/node-pre-gyp`.
-
-#### 5) Test
-
-Now `npm test` should work just as it did before.
-
-#### 6) Publish the tarball
-
-Then package your app:
-
-    ./node_modules/.bin/node-pre-gyp package
-
-Once packaged, now you can publish:
-
-    ./node_modules/.bin/node-pre-gyp publish
-
-Currently the `publish` command pushes your binary to S3. This requires:
-
- - You have installed `aws-sdk` with `npm install aws-sdk`
- - You have created a bucket already.
- - The `host` points to an S3 http or https endpoint.
- - You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details).
-
-You can also host your binaries elsewhere. To do this requires:
-
- - You manually publish the binary created by the `package` command to an `https` endpoint
- - Ensure that the `host` value points to your custom `https` endpoint.
-
-#### 7) Automate builds
-
-Now you need to publish builds for all the platforms and node versions you wish to support. This is best automated.
-
- - See [Appveyor Automation](#appveyor-automation) for how to auto-publish builds on Windows.
- - See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux.
-
-#### 8) You're done!
-
-Now publish your module to the npm registry. Users will now be able to install your module from a binary.
-
-What will happen is this:
-
-1. `npm install <your package>` will pull from the npm registry
-2. npm will run the `install` script which will call out to `node-pre-gyp`
-3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place
-4. Assuming that all worked, you are done
-
-If a a binary was not available for a given platform and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module.
-
-## N-API Considerations
-
-[N-API](https://nodejs.org/api/n-api.html#n_api_n_api) is an ABI-stable alternative to previous technologies such as [nan](https://github.com/nodejs/nan) which are tied to a specific Node runtime engine. N-API is Node runtime engine agnostic and guarantees modules created today will continue to run, without changes, into the future.
-
-Using `node-pre-gyp` with N-API projects requires a handful of additional configuration values and imposes some additional requirements.
-
-The most significant difference is that an N-API module can be coded to target multiple  N-API versions. Therefore, an N-API module must declare in its `package.json` file which N-API versions the module is designed to run against. In addition, since multiple builds may be required for a single module, path and file names must be specified in way that avoids naming conflicts.
-
-### The `napi_versions` array property
-
-An N-API modules must declare in its `package.json` file, the N-API versions the module is intended to support. This is accomplished by including an `napi-versions` array property in the `binary` object. For example:
-
-```js
-"binary": {
-    "module_name": "your_module",
-    "module_path": "your_module_path",
-    "host": "https://your_bucket.s3-us-west-1.amazonaws.com",
-    "napi_versions": [1,3]
-  }
-```
-
-If the `napi_versions` array property is *not* present, `node-pre-gyp` operates as it always has. Including the `napi_versions` array property instructs `node-pre-gyp` that this is a N-API module build.
-
-When the `napi_versions` array property is present, `node-pre-gyp` fires off multiple operations, one for each of the N-API versions in the array. In the example above, two operations are initiated, one for N-API version 1 and second for N-API version 3. How this version number is communicated is described next.
-
-### The `napi_build_version` value
-
-For each of the N-API module operations `node-pre-gyp` initiates, it ensures that the `napi_build_version` is set appropriately.
-
-This value is of importance in two areas:
-
-1. The C/C++ code which needs to know against which N-API version it should compile.
-2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions.
-
-### Defining `NAPI_VERSION` for the C/C++ code
-
-The `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file:
-
-```
-"defines": [
-    "NAPI_VERSION=<(napi_build_version)",
-]
-```
-
-This ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build.
-
-> Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is prefered because it used by the N-API C/C++ headers to configure the specific N-API veriosn being requested. 
-
-### Path and file naming requirements in `package.json`
-
-Since `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements.
-
-Specifically, when performing N-API builds, the `{napi_build_version}` text configuration value  *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value  *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.)
-
-Here's an example:
-
-```js
-"binary": {
-    "module_name": "your_module",
-    "module_path": "./lib/binding/napi-v{napi_build_version}",
-    "remote_path": "./{module_name}/v{version}/{configuration}/",
-    "package_name": "{platform}-{arch}-napi-v{napi_build_version}.tar.gz",
-    "host": "https://your_bucket.s3-us-west-1.amazonaws.com",
-    "napi_versions": [1,3]
-  }
-```
-
-## Supporting both N-API and NAN builds
-
-You may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support N-API, as you add N-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property. 
-
-Placing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, `node-pre-gyp` will request a traditional, non-N-API build. 
-
-The configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For N-API builds, the string contains the N-API version nad has values like `napi-v3`. For traditional, non-N-API builds, the string contains the ABI version with values like `node-v46`.
-
-Here's how the `binary` configuration above might be changed to support both N-API and NAN builds:
-
-```js
-"binary": {
-    "module_name": "your_module",
-    "module_path": "./lib/binding/{node_napi_label}",
-    "remote_path": "./{module_name}/v{version}/{configuration}/",
-    "package_name": "{platform}-{arch}-{node_napi_label}.tar.gz",
-    "host": "https://your_bucket.s3-us-west-1.amazonaws.com",
-    "napi_versions": [1,3]
-  }
-```
-
-The C/C++ symbol `NAPI_VERSION` can be used to distinguish N-API and non-N-API builds. The value of `NAPI_VERSION` is set to the integer N-API version for N-API builds and is set to `0` for non-N-API builds. 
-
-For example:
-```C
-#if NAPI_VERSION
-// N-API code goes here
-#else
-// NAN code goes here
-#endif
-```
-
-### Two additional configuration values
-
-The following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above.
-
-1. `napi_version` If N-API is supported by the currently executing Node instance, this value is the N-API version number supported by Node. If N-API is not supported, this value is an empty string.
-
-2. `node_abi_napi` If the value returned for `napi_version` is non empty, this value is `'napi'`. If the value returned for `napi_version` is empty, this value is the value returned for `node_abi`.
-
-These values are present for use in the `binding.gyp` file and may be used as `{napi_version}` and `{node_abi_napi}` for text substituion in the `binary` properties of the `package.json` file.
-
-## S3 Hosting
-
-You can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [Travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu, and with [Appveyor](http://appveyor.com) to automate builds for Windows. Here is an approach to do this:
-
-First, get setup locally and test the workflow:
-
-#### 1) Create an S3 bucket
-
-And have your **key** and **secret key** ready for writing to the bucket.
-
-It is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like:
-
-```js
-{
-  "Version": "2012-10-17",
-  "Statement": [
-    {
-      "Sid": "Stmt1394587197000",
-      "Effect": "Allow",
-      "Action": [
-        "s3:DeleteObject",
-        "s3:GetObject",
-        "s3:GetObjectAcl",
-        "s3:ListBucket",
-        "s3:PutObject",
-        "s3:PutObjectAcl"
-      ],
-      "Resource": [
-        "arn:aws:s3:::node-pre-gyp-tests/*"
-      ]
-    }
-  ]
-}
-```
-
-#### 2) Install node-pre-gyp
-
-Either install it globally:
-
-    npm install node-pre-gyp -g
-
-Or put the local version on your PATH
-
-    export PATH=`pwd`/node_modules/.bin/:$PATH
-
-#### 3) Configure AWS credentials
-
-There are several ways to do this.
-
-You can use any of the methods described at http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html.
-
-Or you can create a `~/.node_pre_gyprc`
-
-Or pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards)
-
-A `~/.node_pre_gyprc` looks like:
-
-```js
-{
-    "accessKeyId": "xxx",
-    "secretAccessKey": "xxx"
-}
-```
-
-Another way is to use your environment:
-
-    export node_pre_gyp_accessKeyId=xxx
-    export node_pre_gyp_secretAccessKey=xxx
-
-You may also need to specify the `region` if it is not explicit in the `host` value you use. The `bucket` can also be specified but it is optional because `node-pre-gyp` will detect it from the `host` value.
-
-#### 4) Package and publish your build
-
-Install the `aws-sdk`:
-
-    npm install aws-sdk
-
-Then publish:
-
-    node-pre-gyp package publish
-
-Note: if you hit an error like `Hostname/IP doesn't match certificate's altnames` it may mean that you need to provide the `region` option in your config.
-
-## Appveyor Automation
-
-[Appveyor](http://www.appveyor.com/) can build binaries and publish the results per commit and supports:
-
- - Windows Visual Studio 2013 and related compilers
- - Both 64 bit (x64) and 32 bit (x86) build configurations
- - Multiple Node.js versions
-
-For an example of doing this see [node-sqlite3's appveyor.yml](https://github.com/mapbox/node-sqlite3/blob/master/appveyor.yml).
-
-Below is a guide to getting set up:
-
-#### 1) Create a free Appveyor account
-
-Go to https://ci.appveyor.com/signup/free and sign in with your GitHub account.
-
-#### 2) Create a new project
-
-Go to https://ci.appveyor.com/projects/new and select the GitHub repo for your module
-
-#### 3) Add appveyor.yml and push it
-
-Once you have committed an `appveyor.yml` ([appveyor.yml reference](http://www.appveyor.com/docs/appveyor-yml)) to your GitHub repo and pushed it AppVeyor should automatically start building your project.
-
-#### 4) Create secure variables
-
-Encrypt your S3 AWS keys by going to <https://ci.appveyor.com/tools/encrypt> and hitting the `encrypt` button.
-
-Then paste the result into your `appveyor.yml`
-
-```yml
-environment:
-  node_pre_gyp_accessKeyId:
-    secure: Dn9HKdLNYvDgPdQOzRq/DqZ/MPhjknRHB1o+/lVU8MA=
-  node_pre_gyp_secretAccessKey:
-    secure: W1rwNoSnOku1r+28gnoufO8UA8iWADmL1LiiwH9IOkIVhDTNGdGPJqAlLjNqwLnL
-```
-
-NOTE: keys are per account but not per repo (this is difference than Travis where keys are per repo but not related to the account used to encrypt them).
-
-#### 5) Hook up publishing
-
-Just put `node-pre-gyp package publish` in your `appveyor.yml` after `npm install`.
-
-#### 6) Publish when you want
-
-You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:
-
-    SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
-    if not "%CM%" == "%CM:[publish binary]=%" node-pre-gyp --msvs_version=2013 publish
-
-If your commit message contains special characters (e.g. `&`) this method might fail. An alternative is to use PowerShell, which gives you additional possibilities, like ignoring case by using `ToLower()`:
-
-    ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]')) { node-pre-gyp --msvs_version=2013 publish }
-
-Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package.
-
-## Travis Automation
-
-[Travis](https://travis-ci.org/) can push to S3 after a successful build and supports both:
-
- - Ubuntu Precise and OS X (64 bit)
- - Multiple Node.js versions
-
-For an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml).
-
-Note: if you need 32 bit binaries, this can be done from a 64 bit Travis machine. See [the node-sqlite3 scripts for an example of doing this](https://github.com/mapbox/node-sqlite3/blob/bae122aa6a2b8a45f6b717fab24e207740e32b5d/scripts/build_against_node.sh#L54-L74).
-
-Below is a guide to getting set up:
-
-#### 1) Install the Travis gem
-
-    gem install travis
-
-#### 2) Create secure variables
-
-Make sure you run this command from within the directory of your module.
-
-Use `travis-encrypt` like:
-
-    travis encrypt node_pre_gyp_accessKeyId=${node_pre_gyp_accessKeyId}
-    travis encrypt node_pre_gyp_secretAccessKey=${node_pre_gyp_secretAccessKey}
-
-Then put those values in your `.travis.yml` like:
-
-```yaml
-env:
-  global:
-    - secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M=
-    - secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI=
-```
-
-More details on Travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/.
-
-#### 3) Hook up publishing
-
-Just put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`.
-
-##### OS X publishing
-
-If you want binaries for OS X in addition to linux you can enable [multi-os for Travis](http://docs.travis-ci.com/user/multi-os/#Setting-.travis.yml)
-
-Use a configuration like:
-
-```yml
-
-language: cpp
-
-os:
-- linux
-- osx
-
-env:
-  matrix:
-    - NODE_VERSION="4"
-    - NODE_VERSION="6"
-
-before_install:
-- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
-- source ~/.nvm/nvm.sh
-- nvm install $NODE_VERSION
-- nvm use $NODE_VERSION
-```
-
-See [Travis OS X Gotchas](#travis-os-x-gotchas) for why we replace `language: node_js` and `node_js:` sections with `language: cpp` and a custom matrix.
-
-Also create platform specific sections for any deps that need install. For example if you need libpng:
-
-```yml
-- if [ $(uname -s) == 'Linux' ]; then apt-get install libpng-dev; fi;
-- if [ $(uname -s) == 'Darwin' ]; then brew install libpng; fi;
-```
-
-For detailed multi-OS examples see [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/.travis.yml) and [node-sqlite3](https://github.com/mapbox/node-sqlite3/blob/master/.travis.yml).
-
-##### Travis OS X Gotchas
-
-First, unlike the Travis Linux machines, the OS X machines do not put `node-pre-gyp` on PATH by default. To do so you will need to:
-
-```sh
-export PATH=$(pwd)/node_modules/.bin:${PATH}
-```
-
-Second, the OS X machines do not support using a matrix for installing different Node.js versions. So you need to bootstrap the installation of Node.js in a cross platform way.
-
-By doing:
-
-```yml
-env:
-  matrix:
-    - NODE_VERSION="4"
-    - NODE_VERSION="6"
-
-before_install:
- - rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
- - source ~/.nvm/nvm.sh
- - nvm install $NODE_VERSION
- - nvm use $NODE_VERSION
-```
-
-You can easily recreate the previous behavior of this matrix:
-
-```yml
-node_js:
-  - "4"
-  - "6"
-```
-
-#### 4) Publish when you want
-
-You might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:
-
-    COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\n')
-    if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then node-pre-gyp publish; fi;
-
-Then you can trigger new binaries to be built like:
-
-    git commit -a -m "[publish binary]"
-
-Or, if you don't have any changes to make simply run:
-
-    git commit --allow-empty -m "[publish binary]"
-
-WARNING: if you are working in a pull request and publishing binaries from there then you will want to avoid double publishing when Travis CI builds both the `push` and `pr`. You only want to run the publish on the `push` commit. See https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/is_pr_merge.sh which is called from https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/publish.sh for an example of how to do this.
-
-Remember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. To automate the publishing of your entire package to npm on Travis see http://about.travis-ci.org/docs/user/deployment/npm/
-
-# Versioning
-
-The `binary` properties of `module_path`, `remote_path`, and `package_name` support variable substitution. The strings are evaluated by `node-pre-gyp` depending on your system and any custom build flags you passed.
-
- - `node_abi`: The node C++ `ABI` number. This value is available in Javascript as `process.versions.modules` as of [`>= v0.10.4 >= v0.11.7`](https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e) and in C++ as the `NODE_MODULE_VERSION` define much earlier. For versions of Node before this was available we fallback to the V8 major and minor version.
- - `platform` matches node's `process.platform` like `linux`, `darwin`, and `win32` unless the user passed the `--target_platform` option to override.
- - `arch` matches node's `process.arch` like `x64` or `ia32` unless the user passes the `--target_arch` option to override.
- - `libc` matches `require('detect-libc').family` like `glibc` or `musl` unless the user passes the `--target_libc` option to override.
- - `configuration` - Either 'Release' or 'Debug' depending on if `--debug` is passed during the build.
- - `module_name` - the `binary.module_name` attribute from `package.json`.
- - `version` - the semver `version` value for your module from `package.json` (NOTE: ignores the `semver.build` property).
- - `major`, `minor`, `patch`, and `prelease` match the individual semver values for your module's `version`
- - `build` - the sevmer `build` value. For example it would be `this.that` if your package.json `version` was `v1.0.0+this.that`
- - `prerelease` - the semver `prerelease` value. For example it would be `alpha.beta` if your package.json `version` was `v1.0.0-alpha.beta`
-
-
-The options are visible in the code at <https://github.com/mapbox/node-pre-gyp/blob/612b7bca2604508d881e1187614870ba19a7f0c5/lib/util/versioning.js#L114-L127>
-
-# Download binary files from a mirror
-
-S3 is broken in China for the well known reason.
-
-Using the `npm` config argument: `--{module_name}_binary_host_mirror` can download binary files through a mirror.
-
-e.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`.
-
-```bash
-$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
-```
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/appveyor.yml b/legacy-libs/grpc/node_modules/node-pre-gyp/appveyor.yml
deleted file mode 100644 (file)
index 2e74dbc..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-os: Visual Studio 2015
-
-environment:
-  matrix:
-    - nodejs_version: 6
-    - nodejs_version: 10
-
-platform:
-  - x64
-  - x86
-
-shallow_clone: true
-
-install:
-  - ps: Install-Product node $env:nodejs_version $env:Platform
-  - ps: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
-  - npm config get
-  - node --version
-  - npm --version
-  - node -e "console.log(process.arch);"
-  - IF /I "%PLATFORM%" == "x64" set PATH=C:\Python27-x64;%PATH%
-  - IF /I "%PLATFORM%" == "x86" SET PATH=C:\python27;%PATH%
-  - IF /I "%PLATFORM%" == "x64" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
-  - IF /I "%PLATFORM%" == "x86" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
-  - npm install
-  - npm test
-
-build: off
-test: off
-deploy: off
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp b/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp
deleted file mode 100644 (file)
index 737b002..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/env node
-
-"use strict";
-
-/**
- * Set the title.
- */
-
-process.title = 'node-pre-gyp';
-
-/**
- * Module dependencies.
- */
-
-var node_pre_gyp = require('../');
-var log = require('npmlog');
-
-/**
- * Process and execute the selected commands.
- */
-
-var prog = new node_pre_gyp.Run();
-var completed = false;
-prog.parseArgv(process.argv);
-
-if (prog.todo.length === 0) {
-  if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
-    console.log('v%s', prog.version);
-    return process.exit(0);
-  } else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) {
-    console.log('%s', prog.usage());
-    return process.exit(0);
-  }
-  console.log('%s', prog.usage());
-  return process.exit(1);
-}
-
-// if --no-color is passed
-if (prog.opts && prog.opts.hasOwnProperty('color') && !prog.opts.color) {
-  log.disableColor();
-}
-
-log.info('it worked if it ends with', 'ok');
-log.verbose('cli', process.argv);
-log.info('using', process.title + '@%s', prog.version);
-log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch);
-
-
-/**
- * Change dir if -C/--directory was passed.
- */
-
-var dir = prog.opts.directory;
-if (dir) {
-  var fs = require('fs');
-  try {
-    var stat = fs.statSync(dir);
-    if (stat.isDirectory()) {
-      log.info('chdir', dir);
-      process.chdir(dir);
-    } else {
-      log.warn('chdir', dir + ' is not a directory');
-    }
-  } catch (e) {
-    if (e.code === 'ENOENT') {
-      log.warn('chdir', dir + ' is not a directory');
-    } else {
-      log.warn('chdir', 'error during chdir() "%s"', e.message);
-    }
-  }
-}
-
-function run () {
-  var command = prog.todo.shift();
-  if (!command) {
-    // done!
-    completed = true;
-    log.info('ok');
-    return;
-  }
-
-  prog.commands[command.name](command.args, function (err) {
-    if (err) {
-      log.error(command.name + ' error');
-      log.error('stack', err.stack);
-      errorMessage();
-      log.error('not ok');
-      console.log(err.message);
-      return process.exit(1);
-    }
-    var args_array = [].slice.call(arguments, 1);
-    if (args_array.length) {
-      console.log.apply(console, args_array);
-    }
-    // now run the next command in the queue
-    process.nextTick(run);
-  });
-}
-
-process.on('exit', function (code) {
-  if (!completed && !code) {
-    log.error('Completion callback never invoked!');
-    issueMessage();
-    process.exit(6);
-  }
-});
-
-process.on('uncaughtException', function (err) {
-  log.error('UNCAUGHT EXCEPTION');
-  log.error('stack', err.stack);
-  issueMessage();
-  process.exit(7);
-});
-
-function errorMessage () {
-  // copied from npm's lib/util/error-handler.js
-  var os = require('os');
-  log.error('System', os.type() + ' ' + os.release());
-  log.error('command', process.argv.map(JSON.stringify).join(' '));
-  log.error('cwd', process.cwd());
-  log.error('node -v', process.version);
-  log.error(process.title+' -v', 'v' + prog.package.version);
-}
-
-function issueMessage () {
-  errorMessage();
-  log.error('', [ 'This is a bug in `'+process.title+'`.',
-                  'Try to update '+process.title+' and file an issue if it does not help:',
-                  '    <https://github.com/mapbox/'+process.title+'/issues>',
-                ].join('\n'));
-}
-
-// start running the given commands!
-run();
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd b/legacy-libs/grpc/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd
deleted file mode 100644 (file)
index 46e14b5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-node  "%~dp0\node-pre-gyp" %*
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/contributing.md b/legacy-libs/grpc/node_modules/node-pre-gyp/contributing.md
deleted file mode 100644 (file)
index 4038fa6..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# Contributing
-
-
-### Releasing a new version:
-
-- Ensure tests are passing on travis and appveyor
-- Run `node scripts/abi_crosswalk.js` and commit any changes
-- Update the changelog
-- Tag a new release like: `git tag -a v0.6.34 -m "tagging v0.6.34" && git push --tags`
-- Run `npm publish`
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/build.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/build.js
deleted file mode 100644 (file)
index 43c137e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-"use strict";
-
-module.exports = exports = build;
-
-exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp';
-
-var napi = require('./util/napi.js');
-var compile = require('./util/compile.js');
-var handle_gyp_opts = require('./util/handle_gyp_opts.js');
-var configure = require('./configure.js');
-
-function do_build(gyp,argv,callback) {
-    handle_gyp_opts(gyp,argv,function(err,result) {
-        var final_args = ['build'].concat(result.gyp).concat(result.pre);
-        if (result.unparsed.length > 0) {
-            final_args = final_args.
-                          concat(['--']).
-                          concat(result.unparsed);
-        }
-        if (!err && result.opts.napi_build_version) {
-            napi.swap_build_dir_in(result.opts.napi_build_version);
-        }
-        compile.run_gyp(final_args,result.opts,function(err) {
-            if (result.opts.napi_build_version) {
-                napi.swap_build_dir_out(result.opts.napi_build_version);
-            }
-            return callback(err);
-        });
-    });
-}
-
-function build(gyp, argv, callback) {
-
-    // Form up commands to pass to node-gyp:
-    // We map `node-pre-gyp build` to `node-gyp configure build` so that we do not
-    // trigger a clean and therefore do not pay the penalty of a full recompile
-    if (argv.length && (argv.indexOf('rebuild') > -1)) {
-        argv.shift(); // remove `rebuild`
-        // here we map `node-pre-gyp rebuild` to `node-gyp rebuild` which internally means
-        // "clean + configure + build" and triggers a full recompile
-        compile.run_gyp(['clean'],{},function(err) {
-            if (err) return callback(err);
-            configure(gyp,argv,function(err) {
-                if (err) return callback(err);
-                return do_build(gyp,argv,callback);
-            });
-        });
-    } else {
-        return do_build(gyp,argv,callback);        
-    }
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/clean.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/clean.js
deleted file mode 100644 (file)
index e2da17b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-"use strict";
-
-module.exports = exports = clean;
-
-exports.usage = 'Removes the entire folder containing the compiled .node module';
-
-var fs = require('fs');
-var rm = require('rimraf');
-var exists = require('fs').exists || require('path').exists;
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var path = require('path');
-
-function clean (gyp, argv, callback) {
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    var to_delete = opts.module_path;
-    if (!to_delete) {
-        return callback(new Error("module_path is empty, refusing to delete"));
-    } else if (path.normalize(to_delete) == path.normalize(process.cwd())) {
-        return callback(new Error("module_path is not set, refusing to delete"));
-    } else {
-        exists(to_delete, function(found) {
-            if (found) {
-                if (!gyp.opts.silent_clean) console.log('['+package_json.name+'] Removing "%s"', to_delete);
-                return rm(to_delete, callback);
-            }
-            return callback();
-        });
-    }
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/configure.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/configure.js
deleted file mode 100644 (file)
index a6e3438..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-
-module.exports = exports = configure;
-
-exports.usage = 'Attempts to configure node-gyp or nw-gyp build';
-
-var napi = require('./util/napi.js');
-var compile = require('./util/compile.js');
-var handle_gyp_opts = require('./util/handle_gyp_opts.js');
-
-function configure(gyp, argv, callback) {
-    handle_gyp_opts(gyp,argv,function(err,result) {
-        var final_args = result.gyp.concat(result.pre);
-        // pull select node-gyp configure options out of the npm environ
-        var known_gyp_args = ['dist-url','python','nodedir','msvs_version'];
-        known_gyp_args.forEach(function(key) {
-            var val = gyp.opts[key] || gyp.opts[key.replace('-','_')];
-            if (val) {
-               final_args.push('--'+key+'='+val);
-            }
-        });
-        // --ensure=false tell node-gyp to re-install node development headers
-        // but it is only respected by node-gyp install, so we have to call install
-        // as a separate step if the user passes it
-        if (gyp.opts.ensure === false) {
-            var install_args = final_args.concat(['install','--ensure=false']);
-            compile.run_gyp(install_args,result.opts,function(err) {
-                if (err) return callback(err);
-                if (result.unparsed.length > 0) {
-                    final_args = final_args.
-                                  concat(['--']).
-                                  concat(result.unparsed);
-                }
-                compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) {
-                    return callback(err);
-                });
-            });
-        } else {
-            if (result.unparsed.length > 0) {
-                final_args = final_args.
-                              concat(['--']).
-                              concat(result.unparsed);
-            }
-            compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) {
-                if (!err && result.opts.napi_build_version) {
-                    napi.swap_build_dir_out(result.opts.napi_build_version);
-                }
-                return callback(err);
-            });
-        }
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/info.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/info.js
deleted file mode 100644 (file)
index aff9bf8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-"use strict";
-
-module.exports = exports = unpublish;
-
-exports.usage = 'Lists all published binaries (requires aws-sdk)';
-
-var fs = require('fs');
-var log = require('npmlog');
-var versioning = require('./util/versioning.js');
-var s3_setup = require('./util/s3_setup.js');
-var config = require('rc')("node_pre_gyp",{acl:"public-read"});
-
-function unpublish(gyp, argv, callback) {
-    var AWS = require("aws-sdk");
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var opts = versioning.evaluate(package_json, gyp.opts);
-    s3_setup.detect(opts.hosted_path,config);
-    AWS.config.update(config);
-    var s3 =  new AWS.S3();
-    var s3_opts = {  Bucket: config.bucket,
-                     Prefix: config.prefix
-                  };
-    s3.listObjects(s3_opts, function(err, meta){
-        if (err && err.code == 'NotFound') {
-            return callback(new Error('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix));
-        } else if(err) {
-            return callback(err);
-        } else {
-            log.verbose(JSON.stringify(meta,null,1));
-            if (meta && meta.Contents) {
-                meta.Contents.forEach(function(obj) {
-                    console.log(obj.Key);
-                });
-            } else {
-                console.error('['+package_json.name+'] No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix );
-            }
-            return callback();
-        }
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/install.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/install.js
deleted file mode 100644 (file)
index cacce67..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-"use strict";
-
-module.exports = exports = install;
-
-exports.usage = 'Attempts to install pre-built binary for module';
-
-var fs = require('fs');
-var path = require('path');
-var log = require('npmlog');
-var existsAsync = fs.exists || path.exists;
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var mkdirp = require('mkdirp');
-
-var npgVersion = 'unknown';
-try {
-    // Read own package.json to get the current node-pre-pyp version.
-    var ownPackageJSON = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8');
-    npgVersion = JSON.parse(ownPackageJSON).version;
-} catch (e) {}
-
-var http_get = {
-    impl: undefined,
-    type: undefined
-};
-
-try {
-  http_get.impl = require('request');
-  http_get.type = 'request';
-  log.warn("Using request for node-pre-gyp https download");
-} catch (e) {
-  http_get.impl = require('needle');
-  http_get.type = 'needle';
-  log.warn("Using needle for node-pre-gyp https download");
-}
-
-function download(uri,opts,callback) {
-    log.http('GET', uri);
-
-    var req = null;
-
-    // Try getting version info from the currently running npm.
-    var envVersionInfo = process.env.npm_config_user_agent ||
-        'node ' + process.version;
-
-    var requestOpts = {
-        uri: uri.replace('+','%2B'),
-        headers: {
-          'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')'
-        },
-        follow_max: 10,
-    };
-
-    if (opts.cafile) {
-        try {
-            requestOpts.ca = fs.readFileSync(opts.cafile);
-        } catch (e) {
-            return callback(e);
-        }
-    } else if (opts.ca) {
-        requestOpts.ca = opts.ca;
-    }
-
-    var proxyUrl = opts.proxy ||
-                    process.env.http_proxy ||
-                    process.env.HTTP_PROXY ||
-                    process.env.npm_config_proxy;
-    if (proxyUrl) {
-      if (/^https?:\/\//i.test(proxyUrl)) {
-        log.verbose('download', 'using proxy url: "%s"', proxyUrl);
-        requestOpts.proxy = proxyUrl;
-      } else {
-        log.warn('download', 'ignoring invalid "proxy" config setting: "%s"', proxyUrl);
-      }
-    }
-    try {
-        req = http_get.impl.get(requestOpts.uri, requestOpts);
-    } catch (e) {
-        return callback(e);
-    }
-    if (req) {
-      req.on('response', function (res) {
-        log.http(res.statusCode, uri);
-      });
-    }
-    return callback(null,req);
-}
-
-function place_binary(from,to,opts,callback) {
-    download(from,opts,function(err,req) {
-        if (err) return callback(err);
-        if (!req) return callback(new Error("empty req"));
-        var badDownload = false;
-        var extractCount = 0;
-        var hasResponse = false;
-        var tar = require('tar');
-
-        function afterTarball(err) {
-            if (err) return callback(err);
-            if (badDownload) return callback(new Error("bad download"));
-            if (extractCount === 0) {
-                return callback(new Error('There was a fatal problem while downloading/extracting the tarball'));
-            }
-            log.info('tarball', 'done parsing tarball');
-            callback();
-        }
-
-        function filter_func(entry) {
-            log.info('install','unpacking ' + entry.path);
-            extractCount++;
-        }
-
-        // for request compatibility
-        req.on('error', function(err) {
-            badDownload = true;
-            if (!hasResponse) {
-                hasResponse = true;
-                return callback(err);
-            }
-        });
-
-        // for needle compatibility
-        req.on('err', function(err) {
-            badDownload = true;
-            if (!hasResponse) {
-                hasResponse = true;
-                return callback(err);
-            }
-        });
-
-        req.on('close', function () {
-            if (!hasResponse) {
-                hasResponse = true;
-                return callback(new Error('Connection closed while downloading tarball file'));
-            }
-        });
-
-      req.on('response', function(res) {
-            // ignore redirects, needle handles these automatically.
-            if (http_get.type === 'needle' && res.headers.hasOwnProperty('location') && res.headers.location !== '') {
-                return;
-            }
-            if (hasResponse) {
-                return;
-            }
-            hasResponse = true;
-            if (res.statusCode !== 200) {
-                badDownload = true;
-                var err = new Error(res.statusCode + ' status code downloading tarball ' + from);
-                err.statusCode = res.statusCode;
-                return callback(err);
-            }
-            // start unzipping and untaring
-            req.pipe(tar.extract({
-              cwd: to,
-              strip: 1,
-              onentry: filter_func
-            }).on('close', afterTarball).on('error', callback));
-        });
-    });
-}
-
-function do_build(gyp,argv,callback) {
-  var args = ['rebuild'].concat(argv);
-  gyp.todo.push( { name: 'build', args: args } );
-  process.nextTick(callback);
-}
-
-function print_fallback_error(err,opts,package_json) {
-    var fallback_message = ' (falling back to source compile with node-gyp)';
-    var full_message = '';
-    if (err.statusCode !== undefined) {
-        // If we got a network response it but failed to download
-        // it means remote binaries are not available, so let's try to help
-        // the user/developer with the info to debug why
-        full_message = "Pre-built binaries not found for " + package_json.name + "@" + package_json.version;
-        full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
-        full_message += fallback_message;
-        log.warn("Tried to download(" + err.statusCode + "): " + opts.hosted_tarball);
-        log.warn(full_message);
-        log.http(err.message);
-    } else {
-        // If we do not have a statusCode that means an unexpected error
-        // happened and prevented an http response, so we output the exact error
-        full_message = "Pre-built binaries not installable for " + package_json.name + "@" + package_json.version;
-        full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
-        full_message += fallback_message;
-        log.warn(full_message);
-        log.warn("Hit error " + err.message);
-    }
-}
-
-function install(gyp, argv, callback) {
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-       var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var source_build = gyp.opts['build-from-source'] || gyp.opts.build_from_source;
-    var update_binary = gyp.opts['update-binary'] || gyp.opts.update_binary;
-    var should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true');
-    if (should_do_source_build) {
-        log.info('build','requesting source compile');
-        return do_build(gyp,argv,callback);
-    } else {
-        var fallback_to_build = gyp.opts['fallback-to-build'] || gyp.opts.fallback_to_build;
-        var should_do_fallback_build = fallback_to_build === package_json.name || (fallback_to_build === true || fallback_to_build === 'true');
-        // but allow override from npm
-        if (process.env.npm_config_argv) {
-            var cooked = JSON.parse(process.env.npm_config_argv).cooked;
-            var match = cooked.indexOf("--fallback-to-build");
-            if (match > -1 && cooked.length > match && cooked[match+1] == "false") {
-                should_do_fallback_build = false;
-                log.info('install','Build fallback disabled via npm flag: --fallback-to-build=false');
-            }
-        }
-        var opts;
-        try {
-            opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-        } catch (err) {
-            return callback(err);
-        }
-
-        opts.ca = gyp.opts.ca;
-        opts.cafile = gyp.opts.cafile;
-
-        var from = opts.hosted_tarball;
-        var to = opts.module_path;
-        var binary_module = path.join(to,opts.module_name + '.node');
-        existsAsync(binary_module,function(found) {
-            if (found && !update_binary) {
-                console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed');
-                console.log('Pass --update-binary to reinstall or --build-from-source to recompile');
-                return callback();
-            } else {
-                if (!update_binary) log.info('check','checked for "' + binary_module + '" (not found)');
-                mkdirp(to,function(err) {
-                    if (err) {
-                        after_place(err);
-                    } else {
-                        place_binary(from,to,opts,after_place);
-                    }
-                });
-            }
-            function after_place(err) {
-                if (err && should_do_fallback_build) {
-                    print_fallback_error(err,opts,package_json);
-                    return do_build(gyp,argv,callback);
-                } else if (err) {
-                    return callback(err);
-                } else {
-                    console.log('['+package_json.name+'] Success: "' + binary_module + '" is installed via remote');
-                    return callback();
-                }
-            }
-        });
-    }
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/node-pre-gyp.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/node-pre-gyp.js
deleted file mode 100644 (file)
index 7d09b5f..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-"use strict";
-
-/**
- * Module exports.
- */
-
-module.exports = exports;
-
-/**
- * Module dependencies.
- */
-
-var fs = require('fs');
-var path = require('path');
-var nopt = require('nopt');
-var log = require('npmlog');
-log.disableProgress();
-var napi = require('./util/napi.js');
-
-var EE = require('events').EventEmitter;
-var inherits = require('util').inherits;
-var commands = [
-      'clean',
-      'install',
-      'reinstall',
-      'build',
-      'rebuild',
-      'package',
-      'testpackage',
-      'publish',
-      'unpublish',
-      'info',
-      'testbinary',
-      'reveal',
-      'configure'
-    ];
-var aliases = {};
-
-// differentiate node-pre-gyp's logs from npm's
-log.heading = 'node-pre-gyp';
-
-exports.find = require('./pre-binding').find;
-
-function Run() {
-  var self = this;
-
-  this.commands = {};
-
-  commands.forEach(function (command) {
-    self.commands[command] = function (argv, callback) {
-      log.verbose('command', command, argv);
-      return require('./' + command)(self, argv, callback);
-    };
-  });
-}
-inherits(Run, EE);
-exports.Run = Run;
-var proto = Run.prototype;
-
-/**
- * Export the contents of the package.json.
- */
-
-proto.package = require('../package.json');
-
-/**
- * nopt configuration definitions
- */
-
-proto.configDefs = {
-    help: Boolean,     // everywhere
-    arch: String,      // 'configure'
-    debug: Boolean,    // 'build'
-    directory: String, // bin
-    proxy: String,     // 'install'
-    loglevel: String,  // everywhere
-};
-
-/**
- * nopt shorthands
- */
-
-proto.shorthands = {
-    release: '--no-debug',
-    C: '--directory',
-    debug: '--debug',
-    j: '--jobs',
-    silent: '--loglevel=silent',
-    silly: '--loglevel=silly',
-    verbose: '--loglevel=verbose',
-};
-
-/**
- * expose the command aliases for the bin file to use.
- */
-
-proto.aliases = aliases;
-
-/**
- * Parses the given argv array and sets the 'opts',
- * 'argv' and 'command' properties.
- */
-
-proto.parseArgv = function parseOpts (argv) {
-  this.opts = nopt(this.configDefs, this.shorthands, argv);
-  this.argv = this.opts.argv.remain.slice();
-  var commands = this.todo = [];
-
-  // create a copy of the argv array with aliases mapped
-  argv = this.argv.map(function (arg) {
-    // is this an alias?
-    if (arg in this.aliases) {
-      arg = this.aliases[arg];
-    }
-    return arg;
-  }, this);
-
-  // process the mapped args into "command" objects ("name" and "args" props)
-  argv.slice().forEach(function (arg) {
-    if (arg in this.commands) {
-      var args = argv.splice(0, argv.indexOf(arg));
-      argv.shift();
-      if (commands.length > 0) {
-        commands[commands.length - 1].args = args;
-      }
-      commands.push({ name: arg, args: [] });
-    }
-  }, this);
-  if (commands.length > 0) {
-    commands[commands.length - 1].args = argv.splice(0);
-  }
-
-  // expand commands entries for multiple napi builds
-  var dir = this.opts.directory;
-  if (dir == null) dir = process.cwd();
-  var package_json = JSON.parse(fs.readFileSync(path.join(dir,'package.json')));
-
-  this.todo = napi.expand_commands (package_json, this.opts, commands);
-
-  // support for inheriting config env variables from npm
-  var npm_config_prefix = 'npm_config_';
-  Object.keys(process.env).forEach(function (name) {
-    if (name.indexOf(npm_config_prefix) !== 0) return;
-    var val = process.env[name];
-    if (name === npm_config_prefix + 'loglevel') {
-      log.level = val;
-    } else {
-      // add the user-defined options to the config
-      name = name.substring(npm_config_prefix.length);
-      // avoid npm argv clobber already present args
-      // which avoids problem of 'npm test' calling
-      // script that runs unique npm install commands
-      if (name === 'argv') {
-         if (this.opts.argv &&
-             this.opts.argv.remain &&
-             this.opts.argv.remain.length) {
-            // do nothing
-         } else {
-            this.opts[name] = val;
-         }
-      } else {
-        this.opts[name] = val;
-      }
-    }
-  }, this);
-
-  if (this.opts.loglevel) {
-    log.level = this.opts.loglevel;
-  }
-  log.resume();
-};
-
-/**
- * Returns the usage instructions for node-pre-gyp.
- */
-
-proto.usage = function usage () {
-  var str = [
-      '',
-      '  Usage: node-pre-gyp <command> [options]',
-      '',
-      '  where <command> is one of:',
-      commands.map(function (c) {
-        return '    - ' + c + ' - ' + require('./' + c).usage;
-      }).join('\n'),
-      '',
-      'node-pre-gyp@' + this.version + '  ' + path.resolve(__dirname, '..'),
-      'node@' + process.versions.node
-  ].join('\n');
-  return str;
-};
-
-/**
- * Version number getter.
- */
-
-Object.defineProperty(proto, 'version', {
-    get: function () {
-      return this.package.version;
-    },
-    enumerable: true
-});
-
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/package.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/package.js
deleted file mode 100644 (file)
index 4959265..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-"use strict";
-
-module.exports = exports = _package;
-
-exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball';
-
-var fs = require('fs');
-var path = require('path');
-var log = require('npmlog');
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var write = require('fs').createWriteStream;
-var existsAsync = fs.exists || path.exists;
-var mkdirp = require('mkdirp');
-var tar = require('tar');
-
-function _package(gyp, argv, callback) {
-    var packlist = require('npm-packlist');
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    var from = opts.module_path;
-    var binary_module = path.join(from,opts.module_name + '.node');
-    existsAsync(binary_module,function(found) {
-        if (!found) {
-            return callback(new Error("Cannot package because " + binary_module + " missing: run `node-pre-gyp rebuild` first"));
-        }
-        var tarball = opts.staged_tarball;
-        var filter_func = function(entry) {
-            // ensure directories are +x
-            // https://github.com/mapnik/node-mapnik/issues/262
-            log.info('package','packing ' + entry.path);
-            return true;
-        };
-        mkdirp(path.dirname(tarball),function(err) {
-            if (err) return callback(err);
-            packlist({ path: from }).then(function(files) {
-                var base = path.basename(from);
-                files = files.map(function(file) {
-                    return path.join(base, file);
-                });
-                tar.create({
-                    portable: true,
-                    gzip: true,
-                    onentry: filter_func,
-                    file: tarball,
-                    cwd: path.dirname(from)
-                }, files, function(err) {
-                    if (err)  console.error('['+package_json.name+'] ' + err.message);
-                    else log.info('package','Binary staged at "' + tarball + '"');
-                    return callback(err);
-                });
-            }, callback);
-        });
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/pre-binding.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
deleted file mode 100644 (file)
index 09e076d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-"use strict";
-
-var versioning = require('../lib/util/versioning.js');
-var napi = require('../lib/util/napi.js');
-var existsSync = require('fs').existsSync || require('path').existsSync;
-var path = require('path');
-
-module.exports = exports;
-
-exports.usage = 'Finds the require path for the node-pre-gyp installed module';
-
-exports.validate = function(package_json,opts) {
-    versioning.validate_config(package_json,opts);
-};
-
-exports.find = function(package_json_path,opts) {
-   if (!existsSync(package_json_path)) {
-        throw new Error("package.json does not exist at " + package_json_path);
-   }
-   var package_json = require(package_json_path);
-   versioning.validate_config(package_json,opts);
-   var napi_build_version;
-   if (napi.get_napi_build_versions (package_json, opts)) {
-       napi_build_version = napi.get_best_napi_build_version(package_json, opts);
-   }
-   opts = opts || {};
-   if (!opts.module_root) opts.module_root = path.dirname(package_json_path);
-   var meta = versioning.evaluate(package_json,opts,napi_build_version);
-   return meta.module;
-};
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/publish.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/publish.js
deleted file mode 100644 (file)
index 376e398..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-"use strict";
-
-module.exports = exports = publish;
-
-exports.usage = 'Publishes pre-built binary (requires aws-sdk)';
-
-var fs = require('fs');
-var path = require('path');
-var log = require('npmlog');
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var s3_setup = require('./util/s3_setup.js');
-var existsAsync = fs.exists || path.exists;
-var url = require('url');
-var config = require('rc')("node_pre_gyp",{acl:"public-read"});
-
-function publish(gyp, argv, callback) {
-    var AWS = require("aws-sdk");
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    var tarball = opts.staged_tarball;
-    existsAsync(tarball,function(found) {
-        if (!found) {
-            return callback(new Error("Cannot publish because " + tarball + " missing: run `node-pre-gyp package` first"));
-        }
-        log.info('publish', 'Detecting s3 credentials');
-        s3_setup.detect(opts.hosted_path,config);
-        var key_name = url.resolve(config.prefix,opts.package_name);
-        log.info('publish', 'Authenticating with s3');
-        AWS.config.update(config);
-        var s3 =  new AWS.S3();
-        var s3_opts = {  Bucket: config.bucket,
-                         Key: key_name
-                      };
-        var remote_package = 'https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key;
-        log.info('publish', 'Checking for existing binary at ' + remote_package);
-        s3.headObject(s3_opts, function(err, meta){
-            if (meta) log.info('publish', JSON.stringify(meta));
-            if (err && err.code == 'NotFound') {
-                // we are safe to publish because
-                // the object does not already exist
-                log.info('publish', 'Preparing to put object');
-                var s3_put = new AWS.S3();
-                var s3_put_opts = {  ACL: config.acl,
-                                     Body: fs.createReadStream(tarball),
-                                     Bucket: config.bucket,
-                                     Key: key_name
-                                  };
-                log.info('publish', 'Putting object');
-                try {
-                    s3_put.putObject(s3_put_opts, function(err, resp){
-                        log.info('publish', 'returned from putting object');
-                        if(err) {
-                           log.info('publish', 's3 putObject error: "' + err + '"');
-                           return callback(err);
-                        }
-                        if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"');
-                        log.info('publish', 'successfully put object');
-                        console.log('['+package_json.name+'] published to ' + remote_package);
-                        return callback();
-                    });
-              } catch (err) {
-                   log.info('publish', 's3 putObject error: "' + err + '"');
-                   return callback(err);
-              }
-            } else if (err) {
-                log.info('publish', 's3 headObject error: "' + err + '"');
-                return callback(err);
-            } else {
-                log.error('publish','Cannot publish over existing version');
-                log.error('publish',"Update the 'version' field in package.json and try again");
-                log.error('publish','If the previous version was published in error see:');
-                log.error('publish','\t node-pre-gyp unpublish');
-                return callback(new Error('Failed publishing to ' + remote_package));
-            }
-        });
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/rebuild.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/rebuild.js
deleted file mode 100644 (file)
index 615a524..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-"use strict";
-
-module.exports = exports = rebuild;
-
-exports.usage = 'Runs "clean" and "build" at once';
-
-var fs = require('fs');
-var napi = require('./util/napi.js');
-
-function rebuild (gyp, argv, callback) {
-  var package_json = JSON.parse(fs.readFileSync('./package.json'));
-  var commands = [
-    { name: 'clean', args: [] },
-    { name: 'build', args: ['rebuild'] }
-    ];
-  commands = napi.expand_commands(package_json, gyp.opts, commands);
-  for (var i = commands.length; i !== 0; i--) {
-    gyp.todo.unshift(commands[i-1]);
-  }
-  process.nextTick(callback);
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reinstall.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reinstall.js
deleted file mode 100644 (file)
index 10e85fc..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-"use strict";
-
-module.exports = exports = rebuild;
-
-exports.usage = 'Runs "clean" and "install" at once';
-
-var fs = require('fs');
-var napi = require('./util/napi.js');
-
-function rebuild (gyp, argv, callback) {
-  var package_json = JSON.parse(fs.readFileSync('./package.json'));
-  var installArgs = [];
-  var napi_build_version = napi.get_best_napi_build_version(package_json, gyp.opts);
-  if (napi_build_version != null) installArgs = [ napi.get_command_arg (napi_build_version) ];
-  gyp.todo.unshift(
-      { name: 'clean', args: [] },
-      { name: 'install', args: installArgs }
-  );
-  process.nextTick(callback);
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reveal.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/reveal.js
deleted file mode 100644 (file)
index 13d2f72..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-"use strict";
-
-module.exports = exports = reveal;
-
-exports.usage = 'Reveals data on the versioned binary';
-
-var fs = require('fs');
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-
-function unix_paths(key, val) {
-    return val && val.replace ? val.replace(/\\/g, '/') : val;
-}
-
-function reveal(gyp, argv, callback) {
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    var hit = false;
-    // if a second arg is passed look to see
-    // if it is a known option
-    //console.log(JSON.stringify(gyp.opts,null,1))
-    var remain = gyp.opts.argv.remain[gyp.opts.argv.remain.length-1];
-    if (remain && opts.hasOwnProperty(remain)) {
-        console.log(opts[remain].replace(/\\/g, '/'));
-        hit = true;
-    }
-    // otherwise return all options as json
-    if (!hit) {
-        console.log(JSON.stringify(opts,unix_paths,2));
-    }
-    return callback();
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testbinary.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testbinary.js
deleted file mode 100644 (file)
index 453987c..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-"use strict";
-
-module.exports = exports = testbinary;
-
-exports.usage = 'Tests that the binary.node can be required';
-
-var fs = require('fs');
-var path = require('path');
-var log = require('npmlog');
-var cp = require('child_process');
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var path = require('path');
-
-function testbinary(gyp, argv, callback) {
-    var args = [];
-    var options = {};
-    var shell_cmd = process.execPath;
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    // skip validation for runtimes we don't explicitly support (like electron)
-    if (opts.runtime &&
-        opts.runtime !== 'node-webkit' &&
-        opts.runtime !== 'node') {
-        return callback();
-    }
-    var nw = (opts.runtime && opts.runtime === 'node-webkit');
-    // ensure on windows that / are used for require path
-    var binary_module = opts.module.replace(/\\/g, '/');
-    if ((process.arch != opts.target_arch) ||
-        (process.platform != opts.target_platform)) {
-        var msg = "skipping validation since host platform/arch (";
-        msg += process.platform+'/'+process.arch+")";
-        msg += " does not match target (";
-        msg += opts.target_platform+'/'+opts.target_arch+")";
-        log.info('validate', msg);
-        return callback();
-    }
-    if (nw) {
-        options.timeout = 5000;
-        if (process.platform === 'darwin') {
-            shell_cmd = 'node-webkit';
-        } else if (process.platform === 'win32') {
-            shell_cmd = 'nw.exe';
-        } else {
-            shell_cmd = 'nw';
-        }
-        var modulePath = path.resolve(binary_module);
-        var appDir = path.join(__dirname, 'util', 'nw-pre-gyp');
-        args.push(appDir);
-        args.push(modulePath);
-        log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'");
-        cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) {
-            // check for normal timeout for node-webkit
-            if (err) {
-                if (err.killed === true && err.signal && err.signal.indexOf('SIG') > -1) {
-                    return callback();
-                }
-                var stderrLog = stderr.toString();
-                log.info('stderr', stderrLog);
-                if( /^\s*Xlib:\s*extension\s*"RANDR"\s*missing\s*on\s*display\s*":\d+\.\d+"\.\s*$/.test(stderrLog) ){
-                    log.info('RANDR', 'stderr contains only RANDR error, ignored');
-                    return callback();
-                }
-                return callback(err);
-            }
-            return callback();
-        });
-        return;
-    }
-    args.push('--eval');
-    args.push("require('" + binary_module.replace(/'/g, '\'') +"')");
-    log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'");
-    cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) {
-        if (err) {
-            return callback(err, { stdout:stdout, stderr:stderr});
-        }
-        return callback();
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testpackage.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/testpackage.js
deleted file mode 100644 (file)
index 9091bc3..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-"use strict";
-
-module.exports = exports = testpackage;
-
-exports.usage = 'Tests that the staged package is valid';
-
-var fs = require('fs');
-var path = require('path');
-var log = require('npmlog');
-var existsAsync = fs.exists || path.exists;
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var testbinary = require('./testbinary.js');
-var tar = require('tar');
-var mkdirp = require('mkdirp');
-
-function testpackage(gyp, argv, callback) {
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    var tarball = opts.staged_tarball;
-    existsAsync(tarball, function(found) {
-        if (!found) {
-            return callback(new Error("Cannot test package because " + tarball + " missing: run `node-pre-gyp package` first"));
-        }
-        var to = opts.module_path;
-        function filter_func(entry) {
-            log.info('install','unpacking [' + entry.path + ']');
-        }
-
-        mkdirp(to, function(err) {
-            if (err) {
-                return callback(err);
-            } else {
-                tar.extract({
-                    file: tarball,
-                    cwd: to,
-                    strip: 1,
-                    onentry: filter_func
-                }).then(after_extract, callback);
-            }
-        });
-
-        function after_extract() {
-            testbinary(gyp,argv,function(err) {
-                if (err) {
-                    return callback(err);
-                } else {
-                    console.log('['+package_json.name+'] Package appears valid');
-                    return callback();
-                }
-            });
-        }
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/unpublish.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/unpublish.js
deleted file mode 100644 (file)
index 94c93dd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-"use strict";
-
-module.exports = exports = unpublish;
-
-exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)';
-
-var fs = require('fs');
-var log = require('npmlog');
-var versioning = require('./util/versioning.js');
-var napi = require('./util/napi.js');
-var s3_setup = require('./util/s3_setup.js');
-var url = require('url');
-var config = require('rc')("node_pre_gyp",{acl:"public-read"});
-
-function unpublish(gyp, argv, callback) {
-    var AWS = require("aws-sdk");
-    var package_json = JSON.parse(fs.readFileSync('./package.json'));
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
-    s3_setup.detect(opts.hosted_path,config);
-    AWS.config.update(config);
-    var key_name = url.resolve(config.prefix,opts.package_name);
-    var s3 =  new AWS.S3();
-    var s3_opts = {  Bucket: config.bucket,
-                     Key: key_name
-                  };
-    s3.headObject(s3_opts, function(err, meta) {
-        if (err && err.code == 'NotFound') {
-            console.log('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
-            return callback();
-        } else if(err) {
-            return callback(err);
-        } else {
-            log.info('unpublish', JSON.stringify(meta));
-            s3.deleteObject(s3_opts, function(err, resp) {
-                if (err) return callback(err);
-                log.info(JSON.stringify(resp));
-                console.log('['+package_json.name+'] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
-                return callback();
-            });
-        }
-    });
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json
deleted file mode 100644 (file)
index a0c3af7..0000000
+++ /dev/null
@@ -1,1962 +0,0 @@
-{
-  "0.1.14": {
-    "node_abi": null,
-    "v8": "1.3"
-  },
-  "0.1.15": {
-    "node_abi": null,
-    "v8": "1.3"
-  },
-  "0.1.16": {
-    "node_abi": null,
-    "v8": "1.3"
-  },
-  "0.1.17": {
-    "node_abi": null,
-    "v8": "1.3"
-  },
-  "0.1.18": {
-    "node_abi": null,
-    "v8": "1.3"
-  },
-  "0.1.19": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.20": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.21": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.22": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.23": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.24": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.25": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.26": {
-    "node_abi": null,
-    "v8": "2.0"
-  },
-  "0.1.27": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.28": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.29": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.30": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.31": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.32": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.33": {
-    "node_abi": null,
-    "v8": "2.1"
-  },
-  "0.1.90": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.91": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.92": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.93": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.94": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.95": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.96": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.97": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.98": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.99": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.100": {
-    "node_abi": null,
-    "v8": "2.2"
-  },
-  "0.1.101": {
-    "node_abi": null,
-    "v8": "2.3"
-  },
-  "0.1.102": {
-    "node_abi": null,
-    "v8": "2.3"
-  },
-  "0.1.103": {
-    "node_abi": null,
-    "v8": "2.3"
-  },
-  "0.1.104": {
-    "node_abi": null,
-    "v8": "2.3"
-  },
-  "0.2.0": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.2.1": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.2.2": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.2.3": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.2.4": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.2.5": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.2.6": {
-    "node_abi": 1,
-    "v8": "2.3"
-  },
-  "0.3.0": {
-    "node_abi": 1,
-    "v8": "2.5"
-  },
-  "0.3.1": {
-    "node_abi": 1,
-    "v8": "2.5"
-  },
-  "0.3.2": {
-    "node_abi": 1,
-    "v8": "3.0"
-  },
-  "0.3.3": {
-    "node_abi": 1,
-    "v8": "3.0"
-  },
-  "0.3.4": {
-    "node_abi": 1,
-    "v8": "3.0"
-  },
-  "0.3.5": {
-    "node_abi": 1,
-    "v8": "3.0"
-  },
-  "0.3.6": {
-    "node_abi": 1,
-    "v8": "3.0"
-  },
-  "0.3.7": {
-    "node_abi": 1,
-    "v8": "3.0"
-  },
-  "0.3.8": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.0": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.1": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.2": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.3": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.4": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.5": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.6": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.7": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.8": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.9": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.10": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.11": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.4.12": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.5.0": {
-    "node_abi": 1,
-    "v8": "3.1"
-  },
-  "0.5.1": {
-    "node_abi": 1,
-    "v8": "3.4"
-  },
-  "0.5.2": {
-    "node_abi": 1,
-    "v8": "3.4"
-  },
-  "0.5.3": {
-    "node_abi": 1,
-    "v8": "3.4"
-  },
-  "0.5.4": {
-    "node_abi": 1,
-    "v8": "3.5"
-  },
-  "0.5.5": {
-    "node_abi": 1,
-    "v8": "3.5"
-  },
-  "0.5.6": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.5.7": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.5.8": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.5.9": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.5.10": {
-    "node_abi": 1,
-    "v8": "3.7"
-  },
-  "0.6.0": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.1": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.2": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.3": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.4": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.5": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.6": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.7": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.8": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.9": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.10": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.11": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.12": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.13": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.14": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.15": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.16": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.17": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.18": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.19": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.20": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.6.21": {
-    "node_abi": 1,
-    "v8": "3.6"
-  },
-  "0.7.0": {
-    "node_abi": 1,
-    "v8": "3.8"
-  },
-  "0.7.1": {
-    "node_abi": 1,
-    "v8": "3.8"
-  },
-  "0.7.2": {
-    "node_abi": 1,
-    "v8": "3.8"
-  },
-  "0.7.3": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.4": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.5": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.6": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.7": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.8": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.9": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.7.10": {
-    "node_abi": 1,
-    "v8": "3.9"
-  },
-  "0.7.11": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.7.12": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.0": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.1": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.2": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.3": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.4": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.5": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.6": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.7": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.8": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.9": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.10": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.11": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.12": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.13": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.14": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.15": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.16": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.17": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.18": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.19": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.20": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.21": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.22": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.23": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.24": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.25": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.26": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.27": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.8.28": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.9.0": {
-    "node_abi": 1,
-    "v8": "3.11"
-  },
-  "0.9.1": {
-    "node_abi": 10,
-    "v8": "3.11"
-  },
-  "0.9.2": {
-    "node_abi": 10,
-    "v8": "3.11"
-  },
-  "0.9.3": {
-    "node_abi": 10,
-    "v8": "3.13"
-  },
-  "0.9.4": {
-    "node_abi": 10,
-    "v8": "3.13"
-  },
-  "0.9.5": {
-    "node_abi": 10,
-    "v8": "3.13"
-  },
-  "0.9.6": {
-    "node_abi": 10,
-    "v8": "3.15"
-  },
-  "0.9.7": {
-    "node_abi": 10,
-    "v8": "3.15"
-  },
-  "0.9.8": {
-    "node_abi": 10,
-    "v8": "3.15"
-  },
-  "0.9.9": {
-    "node_abi": 11,
-    "v8": "3.15"
-  },
-  "0.9.10": {
-    "node_abi": 11,
-    "v8": "3.15"
-  },
-  "0.9.11": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.9.12": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.0": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.1": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.2": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.3": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.4": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.5": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.6": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.7": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.8": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.9": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.10": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.11": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.12": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.13": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.14": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.15": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.16": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.17": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.18": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.19": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.20": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.21": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.22": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.23": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.24": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.25": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.26": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.27": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.28": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.29": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.30": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.31": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.32": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.33": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.34": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.35": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.36": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.37": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.38": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.39": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.40": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.41": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.42": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.43": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.44": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.45": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.46": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.47": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.10.48": {
-    "node_abi": 11,
-    "v8": "3.14"
-  },
-  "0.11.0": {
-    "node_abi": 12,
-    "v8": "3.17"
-  },
-  "0.11.1": {
-    "node_abi": 12,
-    "v8": "3.18"
-  },
-  "0.11.2": {
-    "node_abi": 12,
-    "v8": "3.19"
-  },
-  "0.11.3": {
-    "node_abi": 12,
-    "v8": "3.19"
-  },
-  "0.11.4": {
-    "node_abi": 12,
-    "v8": "3.20"
-  },
-  "0.11.5": {
-    "node_abi": 12,
-    "v8": "3.20"
-  },
-  "0.11.6": {
-    "node_abi": 12,
-    "v8": "3.20"
-  },
-  "0.11.7": {
-    "node_abi": 12,
-    "v8": "3.20"
-  },
-  "0.11.8": {
-    "node_abi": 13,
-    "v8": "3.21"
-  },
-  "0.11.9": {
-    "node_abi": 13,
-    "v8": "3.22"
-  },
-  "0.11.10": {
-    "node_abi": 13,
-    "v8": "3.22"
-  },
-  "0.11.11": {
-    "node_abi": 14,
-    "v8": "3.22"
-  },
-  "0.11.12": {
-    "node_abi": 14,
-    "v8": "3.22"
-  },
-  "0.11.13": {
-    "node_abi": 14,
-    "v8": "3.25"
-  },
-  "0.11.14": {
-    "node_abi": 14,
-    "v8": "3.26"
-  },
-  "0.11.15": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.11.16": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.0": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.1": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.2": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.3": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.4": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.5": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.6": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.7": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.8": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.9": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.10": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.11": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.12": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.13": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.14": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.15": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.16": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.17": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "0.12.18": {
-    "node_abi": 14,
-    "v8": "3.28"
-  },
-  "1.0.0": {
-    "node_abi": 42,
-    "v8": "3.31"
-  },
-  "1.0.1": {
-    "node_abi": 42,
-    "v8": "3.31"
-  },
-  "1.0.2": {
-    "node_abi": 42,
-    "v8": "3.31"
-  },
-  "1.0.3": {
-    "node_abi": 42,
-    "v8": "4.1"
-  },
-  "1.0.4": {
-    "node_abi": 42,
-    "v8": "4.1"
-  },
-  "1.1.0": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.2.0": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.3.0": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.4.1": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.4.2": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.4.3": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.5.0": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.5.1": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.6.0": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.6.1": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.6.2": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.6.3": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.6.4": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.7.1": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.8.1": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.8.2": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.8.3": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "1.8.4": {
-    "node_abi": 43,
-    "v8": "4.1"
-  },
-  "2.0.0": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.0.1": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.0.2": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.1.0": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.2.0": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.2.1": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.3.0": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.3.1": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.3.2": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.3.3": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.3.4": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.4.0": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "2.5.0": {
-    "node_abi": 44,
-    "v8": "4.2"
-  },
-  "3.0.0": {
-    "node_abi": 45,
-    "v8": "4.4"
-  },
-  "3.1.0": {
-    "node_abi": 45,
-    "v8": "4.4"
-  },
-  "3.2.0": {
-    "node_abi": 45,
-    "v8": "4.4"
-  },
-  "3.3.0": {
-    "node_abi": 45,
-    "v8": "4.4"
-  },
-  "3.3.1": {
-    "node_abi": 45,
-    "v8": "4.4"
-  },
-  "4.0.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.1.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.1.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.1.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.3": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.4": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.5": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.2.6": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.3.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.3.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.3.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.3": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.4": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.5": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.6": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.4.7": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.5.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.6.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.6.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.6.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.7.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.7.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.7.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.7.3": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.2": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.3": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.4": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.5": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.6": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.8.7": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.9.0": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "4.9.1": {
-    "node_abi": 46,
-    "v8": "4.5"
-  },
-  "5.0.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.1.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.1.1": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.2.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.3.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.4.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.4.1": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.5.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.6.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.7.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.7.1": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.8.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.9.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.9.1": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.10.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.10.1": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.11.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.11.1": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "5.12.0": {
-    "node_abi": 47,
-    "v8": "4.6"
-  },
-  "6.0.0": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.1.0": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.2.0": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.2.1": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.2.2": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.3.0": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.3.1": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.4.0": {
-    "node_abi": 48,
-    "v8": "5.0"
-  },
-  "6.5.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.6.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.7.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.8.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.8.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.9.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.9.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.9.2": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.9.3": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.9.4": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.9.5": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.10.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.10.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.10.2": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.10.3": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.11.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.11.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.11.2": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.11.3": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.11.4": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.11.5": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.12.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.12.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.12.2": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.12.3": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.13.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.13.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.14.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.14.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.14.2": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.14.3": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.14.4": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.15.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.15.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.16.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.17.0": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "6.17.1": {
-    "node_abi": 48,
-    "v8": "5.1"
-  },
-  "7.0.0": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.1.0": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.2.0": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.2.1": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.3.0": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.4.0": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.5.0": {
-    "node_abi": 51,
-    "v8": "5.4"
-  },
-  "7.6.0": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.7.0": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.7.1": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.7.2": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.7.3": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.7.4": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.8.0": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.9.0": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.10.0": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "7.10.1": {
-    "node_abi": 51,
-    "v8": "5.5"
-  },
-  "8.0.0": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.1.0": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.1.1": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.1.2": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.1.3": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.1.4": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.2.0": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.2.1": {
-    "node_abi": 57,
-    "v8": "5.8"
-  },
-  "8.3.0": {
-    "node_abi": 57,
-    "v8": "6.0"
-  },
-  "8.4.0": {
-    "node_abi": 57,
-    "v8": "6.0"
-  },
-  "8.5.0": {
-    "node_abi": 57,
-    "v8": "6.0"
-  },
-  "8.6.0": {
-    "node_abi": 57,
-    "v8": "6.0"
-  },
-  "8.7.0": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.8.0": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.8.1": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.9.0": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.9.1": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.9.2": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.9.3": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.9.4": {
-    "node_abi": 57,
-    "v8": "6.1"
-  },
-  "8.10.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.11.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.11.1": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.11.2": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.11.3": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.11.4": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.12.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.13.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.14.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.14.1": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.15.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.15.1": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "8.16.0": {
-    "node_abi": 57,
-    "v8": "6.2"
-  },
-  "9.0.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.1.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.2.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.2.1": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.3.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.4.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.5.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.6.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.6.1": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.7.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.7.1": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.8.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.9.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.10.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.10.1": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.11.0": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.11.1": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "9.11.2": {
-    "node_abi": 59,
-    "v8": "6.2"
-  },
-  "10.0.0": {
-    "node_abi": 64,
-    "v8": "6.6"
-  },
-  "10.1.0": {
-    "node_abi": 64,
-    "v8": "6.6"
-  },
-  "10.2.0": {
-    "node_abi": 64,
-    "v8": "6.6"
-  },
-  "10.2.1": {
-    "node_abi": 64,
-    "v8": "6.6"
-  },
-  "10.3.0": {
-    "node_abi": 64,
-    "v8": "6.6"
-  },
-  "10.4.0": {
-    "node_abi": 64,
-    "v8": "6.7"
-  },
-  "10.4.1": {
-    "node_abi": 64,
-    "v8": "6.7"
-  },
-  "10.5.0": {
-    "node_abi": 64,
-    "v8": "6.7"
-  },
-  "10.6.0": {
-    "node_abi": 64,
-    "v8": "6.7"
-  },
-  "10.7.0": {
-    "node_abi": 64,
-    "v8": "6.7"
-  },
-  "10.8.0": {
-    "node_abi": 64,
-    "v8": "6.7"
-  },
-  "10.9.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.10.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.11.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.12.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.13.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.14.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.14.1": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.14.2": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.15.0": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.15.1": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.15.2": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "10.15.3": {
-    "node_abi": 64,
-    "v8": "6.8"
-  },
-  "11.0.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.1.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.2.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.3.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.4.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.5.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.6.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.7.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.8.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.9.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.10.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.10.1": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.11.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.12.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.13.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "11.14.0": {
-    "node_abi": 67,
-    "v8": "7.0"
-  },
-  "12.0.0": {
-    "node_abi": 72,
-    "v8": "7.4"
-  }
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/compile.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/compile.js
deleted file mode 100644 (file)
index 0dc460c..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-"use strict";
-
-module.exports = exports;
-
-var fs = require('fs');
-var path = require('path');
-var win = process.platform == 'win32';
-var existsSync = fs.existsSync || path.existsSync;
-var cp = require('child_process');
-
-// try to build up the complete path to node-gyp
-/* priority:
-  - node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887)
-  - node-gyp on NODE_PATH
-  - node-gyp inside npm on NODE_PATH (ignore on iojs)
-  - node-gyp inside npm beside node exe
-*/
-function which_node_gyp() {
-    var node_gyp_bin;
-    if (process.env.npm_config_node_gyp) {
-      try {
-          node_gyp_bin = process.env.npm_config_node_gyp;
-          if (existsSync(node_gyp_bin)) {
-              return node_gyp_bin;
-          }
-      } catch (err) { }
-    }
-    try {
-        var node_gyp_main = require.resolve('node-gyp');
-        node_gyp_bin = path.join(path.dirname(
-                                     path.dirname(node_gyp_main)),
-                                     'bin/node-gyp.js');
-        if (existsSync(node_gyp_bin)) {
-            return node_gyp_bin;
-        }
-    } catch (err) { }
-    if (process.execPath.indexOf('iojs') === -1) {
-        try {
-            var npm_main = require.resolve('npm');
-            node_gyp_bin = path.join(path.dirname(
-                                         path.dirname(npm_main)),
-                                         'node_modules/node-gyp/bin/node-gyp.js');
-            if (existsSync(node_gyp_bin)) {
-                return node_gyp_bin;
-            }
-        } catch (err) { }
-    }
-    var npm_base = path.join(path.dirname(
-                             path.dirname(process.execPath)),
-                             'lib/node_modules/npm/');
-    node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js');
-    if (existsSync(node_gyp_bin)) {
-        return node_gyp_bin;
-    }
-}
-
-module.exports.run_gyp = function(args,opts,callback) {
-    var shell_cmd = '';
-    var cmd_args = [];
-    if (opts.runtime && opts.runtime == 'node-webkit') {
-        shell_cmd = 'nw-gyp';
-        if (win) shell_cmd += '.cmd';
-    } else {
-        var node_gyp_path = which_node_gyp();
-        if (node_gyp_path) {
-            shell_cmd = process.execPath;
-            cmd_args.push(node_gyp_path);
-        } else {
-            shell_cmd = 'node-gyp';
-            if (win) shell_cmd += '.cmd';
-        }
-    }
-    var final_args = cmd_args.concat(args);
-    var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, stdio: [ 0, 1, 2]});
-    cmd.on('error', function (err) {
-        if (err) {
-            return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ")"));
-        }
-        callback(null,opts);
-    });
-    cmd.on('close', function (code) {
-        if (code && code !== 0) {
-            return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ")"));
-        }
-        callback(null,opts);
-    });
-};
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js
deleted file mode 100644 (file)
index 9f76ea3..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-"use strict";
-
-module.exports = exports = handle_gyp_opts;
-
-var fs = require('fs');
-var versioning = require('./versioning.js');
-var napi = require('./napi.js');
-
-/*
-
-Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp.
-
-We massage the args and options slightly to account for differences in what commands mean between
-node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below)
-
-Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether
-node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm.
-
-We also try to preserve any command line options that might have been passed to npm or node-pre-gyp.
-But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all
-the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have
-to be very selective about what we pass through.
-
-For example:
-
-`npm install --build-from-source` will give:
-
-argv == [ 'rebuild' ]
-gyp.opts.argv == { remain: [ 'install' ],
-  cooked: [ 'install', '--fallback-to-build' ],
-  original: [ 'install', '--fallback-to-build' ] }
-
-`./bin/node-pre-gyp build` will give:
-
-argv == []
-gyp.opts.argv == { remain: [ 'build' ],
-  cooked: [ 'build' ],
-  original: [ '-C', 'test/app1', 'build' ] }
-
-*/
-
-// select set of node-pre-gyp versioning info
-// to share with node-gyp
-var share_with_node_gyp = [
-  'module',
-  'module_name',
-  'module_path',
-  'napi_version',
-  'node_abi_napi',
-  'napi_build_version',
-  'node_napi_label'
-];
-
-function handle_gyp_opts(gyp, argv, callback) {
-
-    // Collect node-pre-gyp specific variables to pass to node-gyp
-    var node_pre_gyp_options = [];
-    // generate custom node-pre-gyp versioning info
-    var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
-    var opts = versioning.evaluate(JSON.parse(fs.readFileSync('./package.json')), gyp.opts, napi_build_version);
-    share_with_node_gyp.forEach(function(key) {
-        var val = opts[key];
-        if (val) {
-            node_pre_gyp_options.push('--' + key + '=' + val);
-        } else if (key === 'napi_build_version') {
-            node_pre_gyp_options.push('--' + key + '=0');
-        } else {
-            if (key !== 'napi_version' && key !== 'node_abi_napi')
-                return callback(new Error("Option " + key + " required but not found by node-pre-gyp"));
-        }
-    });
-
-    // Collect options that follow the special -- which disables nopt parsing
-    var unparsed_options = [];
-    var double_hyphen_found = false;
-    gyp.opts.argv.original.forEach(function(opt) {
-        if (double_hyphen_found) {
-            unparsed_options.push(opt);
-        }
-        if (opt == '--') {
-            double_hyphen_found = true;
-        }
-    });
-
-    // We try respect and pass through remaining command
-    // line options (like --foo=bar) to node-gyp
-    var cooked = gyp.opts.argv.cooked;
-    var node_gyp_options = [];
-    cooked.forEach(function(value) {
-        if (value.length > 2 && value.slice(0,2) == '--') {
-            var key = value.slice(2);
-            var val = cooked[cooked.indexOf(value)+1];
-            if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar']
-                node_gyp_options.push('--' + key + '=' + val);
-            } else { // pass through --foo
-                node_gyp_options.push(value);
-            }
-        }
-    });
-
-    var result = {'opts':opts,'gyp':node_gyp_options,'pre':node_pre_gyp_options,'unparsed':unparsed_options};
-    return callback(null,result);
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/napi.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/napi.js
deleted file mode 100644 (file)
index 1e45ca0..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-"use strict";
-
-var fs = require('fs');
-var rm = require('rimraf');
-var log = require('npmlog');
-
-module.exports = exports;
-
-var versionArray = process.version
-       .substr(1)
-       .replace(/-.*$/, '')
-       .split('.')
-       .map(function(item) {
-               return +item;
-       });
-
-var napi_multiple_commands = [
-       'build',
-       'clean',
-       'configure',
-       'package',
-       'publish',
-       'reveal',
-       'testbinary',
-       'testpackage',
-       'unpublish'
-];
-
-var napi_build_version_tag = 'napi_build_version=';
-
-module.exports.get_napi_version = function(target) { // target may be undefined
-       // returns the non-zero numeric napi version or undefined if napi is not supported.
-       // correctly supporting target requires an updated cross-walk
-       var version = process.versions.napi; // can be undefined
-       if (!version) { // this code should never need to be updated
-               if (versionArray[0] === 9 && versionArray[1] >= 3) version = 2; // 9.3.0+
-               else if (versionArray[0] === 8) version = 1; // 8.0.0+
-       }
-       return version;
-};
-
-module.exports.get_napi_version_as_string = function(target) {
-       // returns the napi version as a string or an empty string if napi is not supported.
-       var version = module.exports.get_napi_version(target);
-       return version ? ''+version : '';
-};
-
-module.exports.validate_package_json = function(package_json, opts) { // throws Error
-
-       var binary = package_json.binary;
-       var module_path_ok = pathOK(binary.module_path);
-       var remote_path_ok = pathOK(binary.remote_path);
-       var package_name_ok = pathOK(binary.package_name);
-       var napi_build_versions = module.exports.get_napi_build_versions(package_json,opts,true);
-       var napi_build_versions_raw = module.exports.get_napi_build_versions_raw(package_json);
-
-       if (napi_build_versions) {
-               napi_build_versions.forEach(function(napi_build_version){
-                       if (!(parseInt(napi_build_version,10) === napi_build_version && napi_build_version > 0)) {
-                               throw new Error("All values specified in napi_versions must be positive integers.");
-                       }
-               });
-       }
-
-       if (napi_build_versions && (!module_path_ok || (!remote_path_ok && !package_name_ok))) {
-               throw new Error("When napi_versions is specified; module_path and either remote_path or " +
-                       "package_name must contain the substitution string '{napi_build_version}`.");
-       }
-
-       if ((module_path_ok || remote_path_ok || package_name_ok) && !napi_build_versions_raw) {
-               throw new Error("When the substitution string '{napi_build_version}` is specified in " +
-                       "module_path, remote_path, or package_name; napi_versions must also be specified.");
-       }
-
-       if (napi_build_versions && !module.exports.get_best_napi_build_version(package_json, opts) && 
-       module.exports.build_napi_only(package_json)) {
-               throw new Error(
-                       'The N-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' +
-                       'This module supports N-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' +
-                       'This Node instance cannot run this module.');
-       }
-
-       if (napi_build_versions_raw && !napi_build_versions && module.exports.build_napi_only(package_json)) {
-               throw new Error(
-                       'The N-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' +
-                       'This module supports N-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' +
-                       'This Node instance cannot run this module.');
-       }
-
-};
-
-function pathOK (path) {
-       return path && (path.indexOf('{napi_build_version}') !== -1 || path.indexOf('{node_napi_label}') !== -1);
-}
-
-module.exports.expand_commands = function(package_json, opts, commands) {
-       var expanded_commands = [];
-       var napi_build_versions = module.exports.get_napi_build_versions(package_json, opts);
-       commands.forEach(function(command){
-               if (napi_build_versions && command.name === 'install') {
-                       var napi_build_version = module.exports.get_best_napi_build_version(package_json, opts);
-                       var args = napi_build_version ? [ napi_build_version_tag+napi_build_version ] : [ ];
-                       expanded_commands.push ({ name: command.name, args: args });
-               } else if (napi_build_versions && napi_multiple_commands.indexOf(command.name) !== -1) {
-                       napi_build_versions.forEach(function(napi_build_version){
-                               var args = command.args.slice();
-                               args.push (napi_build_version_tag+napi_build_version);
-                               expanded_commands.push ({ name: command.name, args: args });
-                       });
-               } else {
-                       expanded_commands.push (command);
-               }
-       });
-       return expanded_commands;
-};
-
-module.exports.get_napi_build_versions = function(package_json, opts, warnings) { // opts may be undefined
-       var napi_build_versions = [];
-       var supported_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined);
-       // remove duplicates, verify each napi version can actaully be built
-       if (package_json.binary && package_json.binary.napi_versions) {
-               package_json.binary.napi_versions.forEach(function(napi_version) {
-                       var duplicated = napi_build_versions.indexOf(napi_version) !== -1;
-                       if (!duplicated && supported_napi_version && napi_version <= supported_napi_version) {
-                               napi_build_versions.push(napi_version);
-                       } else if (warnings && !duplicated && supported_napi_version) {
-                               log.info('This Node instance does not support builds for N-API version', napi_version);
-                       }
-               });
-       }
-       if (opts && opts["build-latest-napi-version-only"]) {
-               var latest_version = 0;
-               napi_build_versions.forEach(function(napi_version) {
-                       if (napi_version > latest_version) latest_version = napi_version;
-               });
-               napi_build_versions = latest_version ? [ latest_version ] : [];
-       }
-       return napi_build_versions.length ? napi_build_versions : undefined;
-};
-
-module.exports.get_napi_build_versions_raw = function(package_json) {
-       var napi_build_versions = [];
-       // remove duplicates
-       if (package_json.binary && package_json.binary.napi_versions) {
-               package_json.binary.napi_versions.forEach(function(napi_version) {
-                       if (napi_build_versions.indexOf(napi_version) === -1) {
-                               napi_build_versions.push(napi_version);
-                       }
-               });
-       }
-       return napi_build_versions.length ? napi_build_versions : undefined;
-};
-
-module.exports.get_command_arg = function(napi_build_version) {
-       return napi_build_version_tag + napi_build_version;
-};
-
-module.exports.get_napi_build_version_from_command_args = function(command_args) {
-       for (var i = 0; i < command_args.length; i++) {
-               var arg = command_args[i];
-               if (arg.indexOf(napi_build_version_tag) === 0) {
-                       return parseInt(arg.substr(napi_build_version_tag.length),10);
-               }
-       }
-       return undefined;
-};
-
-module.exports.swap_build_dir_out = function(napi_build_version) {
-       if (napi_build_version) {
-               rm.sync(module.exports.get_build_dir(napi_build_version));
-               fs.renameSync('build', module.exports.get_build_dir(napi_build_version));
-       }
-};
-
-module.exports.swap_build_dir_in = function(napi_build_version) {
-       if (napi_build_version) {
-               rm.sync('build');
-               fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build');
-       }
-};
-
-module.exports.get_build_dir = function(napi_build_version) {
-       return 'build-tmp-napi-v'+napi_build_version;
-};
-
-module.exports.get_best_napi_build_version = function(package_json, opts) {
-       var best_napi_build_version = 0;
-       var napi_build_versions = module.exports.get_napi_build_versions (package_json, opts);
-       if (napi_build_versions) {
-               var our_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined);
-               napi_build_versions.forEach(function(napi_build_version){
-                       if (napi_build_version > best_napi_build_version &&
-                               napi_build_version <= our_napi_version) {
-                               best_napi_build_version = napi_build_version;
-                       }
-               });
-       }
-       return best_napi_build_version === 0 ? undefined : best_napi_build_version;
-};
-
-module.exports.build_napi_only = function(package_json) {
-       return package_json.binary && package_json.binary.package_name && 
-       package_json.binary.package_name.indexOf('{node_napi_label}') === -1;
-};
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html
deleted file mode 100644 (file)
index 244466c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Node-webkit-based module test</title>
-<script>
-function nwModuleTest(){
-   var util = require('util');
-   var moduleFolder = require('nw.gui').App.argv[0];
-   try {
-      require(moduleFolder);
-   } catch(e) {
-      if( process.platform !== 'win32' ){
-         util.log('nw-pre-gyp error:');
-         util.log(e.stack);
-      }
-      process.exit(1);
-   }
-   process.exit(0);
-}
-</script>
-</head>
-<body onload="nwModuleTest()">
-<h1>Node-webkit-based module test</h1>
-</body>
-</html>
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json
deleted file mode 100644 (file)
index 71d03f8..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-"main": "index.html",
-"name": "nw-pre-gyp-module-test",
-"description": "Node-webkit-based module test.",
-"version": "0.0.1",
-"window": {
-   "show": false
-}
-}
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/s3_setup.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/s3_setup.js
deleted file mode 100644 (file)
index 5bc42e9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-"use strict";
-
-module.exports = exports;
-
-var url = require('url');
-
-var URI_REGEX="^(.*)\.(s3(?:-.*)?)\.amazonaws\.com$";
-
-module.exports.detect = function(to,config) {
-    var uri = url.parse(to);
-    var hostname_matches = uri.hostname.match(URI_REGEX);
-    config.prefix = (!uri.pathname || uri.pathname == '/') ? '' : uri.pathname.replace('/','');
-    if(!hostname_matches) {
-        return;
-    }
-    if (!config.bucket) {
-        config.bucket = hostname_matches[1];
-    }
-    if (!config.region) {
-        var s3_domain = hostname_matches[2];
-        if (s3_domain.slice(0,3) == 's3-' &&
-            s3_domain.length >= 3) {
-            // it appears the region is explicit in the url
-            config.region = s3_domain.replace('s3-','');
-        }
-    }
-};
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/versioning.js b/legacy-libs/grpc/node_modules/node-pre-gyp/lib/util/versioning.js
deleted file mode 100644 (file)
index fafb0da..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-"use strict";
-
-module.exports = exports;
-
-var path = require('path');
-var semver = require('semver');
-var url = require('url');
-var detect_libc = require('detect-libc');
-var napi = require('./napi.js');
-
-var abi_crosswalk;
-
-// This is used for unit testing to provide a fake
-// ABI crosswalk that emulates one that is not updated
-// for the current version
-if (process.env.NODE_PRE_GYP_ABI_CROSSWALK) {
-    abi_crosswalk = require(process.env.NODE_PRE_GYP_ABI_CROSSWALK);
-} else {
-    abi_crosswalk = require('./abi_crosswalk.json');
-}
-
-var major_versions = {};
-Object.keys(abi_crosswalk).forEach(function(v) {
-    var major = v.split('.')[0];
-    if (!major_versions[major]) {
-        major_versions[major] = v;
-    }
-});
-
-function get_electron_abi(runtime, target_version) {
-    if (!runtime) {
-        throw new Error("get_electron_abi requires valid runtime arg");
-    }
-    if (typeof target_version === 'undefined') {
-        // erroneous CLI call
-        throw new Error("Empty target version is not supported if electron is the target.");
-    }
-    // Electron guarantees that patch version update won't break native modules.
-    var sem_ver = semver.parse(target_version);
-    return runtime + '-v' + sem_ver.major + '.' + sem_ver.minor;
-}
-module.exports.get_electron_abi = get_electron_abi;
-
-function get_node_webkit_abi(runtime, target_version) {
-    if (!runtime) {
-        throw new Error("get_node_webkit_abi requires valid runtime arg");
-    }
-    if (typeof target_version === 'undefined') {
-        // erroneous CLI call
-        throw new Error("Empty target version is not supported if node-webkit is the target.");
-    }
-    return runtime + '-v' + target_version;
-}
-module.exports.get_node_webkit_abi = get_node_webkit_abi;
-
-function get_node_abi(runtime, versions) {
-    if (!runtime) {
-        throw new Error("get_node_abi requires valid runtime arg");
-    }
-    if (!versions) {
-        throw new Error("get_node_abi requires valid process.versions object");
-    }
-    var sem_ver = semver.parse(versions.node);
-    if (sem_ver.major === 0 && sem_ver.minor % 2) { // odd series
-        // https://github.com/mapbox/node-pre-gyp/issues/124
-        return runtime+'-v'+versions.node;
-    } else {
-        // process.versions.modules added in >= v0.10.4 and v0.11.7
-        // https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e
-        return versions.modules ? runtime+'-v' + (+versions.modules) :
-            'v8-' + versions.v8.split('.').slice(0,2).join('.');
-    }
-}
-module.exports.get_node_abi = get_node_abi;
-
-function get_runtime_abi(runtime, target_version) {
-    if (!runtime) {
-        throw new Error("get_runtime_abi requires valid runtime arg");
-    }
-    if (runtime === 'node-webkit') {
-        return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']);
-    } else if (runtime === 'electron') {
-        return get_electron_abi(runtime, target_version || process.versions.electron);
-    } else {
-        if (runtime != 'node') {
-            throw new Error("Unknown Runtime: '" + runtime + "'");
-        }
-        if (!target_version) {
-            return get_node_abi(runtime,process.versions);
-        } else {
-            var cross_obj;
-            // abi_crosswalk generated with ./scripts/abi_crosswalk.js
-            if (abi_crosswalk[target_version]) {
-                cross_obj = abi_crosswalk[target_version];
-            } else {
-                var target_parts = target_version.split('.').map(function(i) { return +i; });
-                if (target_parts.length != 3) { // parse failed
-                    throw new Error("Unknown target version: " + target_version);
-                }
-                /*
-                    The below code tries to infer the last known ABI compatible version
-                    that we have recorded in the abi_crosswalk.json when an exact match
-                    is not possible. The reasons for this to exist are complicated:
-
-                       - We support passing --target to be able to allow developers to package binaries for versions of node
-                         that are not the same one as they are running. This might also be used in combination with the
-                         --target_arch or --target_platform flags to also package binaries for alternative platforms
-                       - When --target is passed we can't therefore determine the ABI (process.versions.modules) from the node
-                         version that is running in memory
-                       - So, therefore node-pre-gyp keeps an "ABI crosswalk" (lib/util/abi_crosswalk.json) to be able to look
-                         this info up for all versions
-                       - But we cannot easily predict what the future ABI will be for released versions
-                       - And node-pre-gyp needs to be a `bundledDependency` in apps that depend on it in order to work correctly
-                         by being fully available at install time.
-                       - So, the speed of node releases and the bundled nature of node-pre-gyp mean that a new node-pre-gyp release
-                         need to happen for every node.js/io.js/node-webkit/nw.js/atom-shell/etc release that might come online if
-                         you want the `--target` flag to keep working for the latest version
-                       - Which is impractical ^^
-                       - Hence the below code guesses about future ABI to make the need to update node-pre-gyp less demanding.
-
-                    In practice then you can have a dependency of your app like `node-sqlite3` that bundles a `node-pre-gyp` that
-                    only knows about node v0.10.33 in the `abi_crosswalk.json` but target node v0.10.34 (which is assumed to be
-                    ABI compatible with v0.10.33).
-
-                    TODO: use semver module instead of custom version parsing
-                */
-                var major = target_parts[0];
-                var minor = target_parts[1];
-                var patch = target_parts[2];
-                // io.js: yeah if node.js ever releases 1.x this will break
-                // but that is unlikely to happen: https://github.com/iojs/io.js/pull/253#issuecomment-69432616
-                if (major === 1) {
-                    // look for last release that is the same major version
-                    // e.g. we assume io.js 1.x is ABI compatible with >= 1.0.0
-                    while (true) {
-                        if (minor > 0) --minor;
-                        if (patch > 0) --patch;
-                        var new_iojs_target = '' + major + '.' + minor + '.' + patch;
-                        if (abi_crosswalk[new_iojs_target]) {
-                            cross_obj = abi_crosswalk[new_iojs_target];
-                            console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
-                            console.log('Warning: but node-pre-gyp successfully choose ' + new_iojs_target + ' as ABI compatible target');
-                            break;
-                        }
-                        if (minor === 0 && patch === 0) {
-                            break;
-                        }
-                    }
-                } else if (major >= 2) {
-                    // look for last release that is the same major version
-                    if (major_versions[major]) {
-                        cross_obj = abi_crosswalk[major_versions[major]];
-                        console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
-                        console.log('Warning: but node-pre-gyp successfully choose ' + major_versions[major] + ' as ABI compatible target');
-                    }
-                } else if (major === 0) { // node.js
-                    if (target_parts[1] % 2 === 0) { // for stable/even node.js series
-                        // look for the last release that is the same minor release
-                        // e.g. we assume node 0.10.x is ABI compatible with >= 0.10.0
-                        while (--patch > 0) {
-                            var new_node_target = '' + major + '.' + minor + '.' + patch;
-                            if (abi_crosswalk[new_node_target]) {
-                                cross_obj = abi_crosswalk[new_node_target];
-                                console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
-                                console.log('Warning: but node-pre-gyp successfully choose ' + new_node_target + ' as ABI compatible target');
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-            if (!cross_obj) {
-                throw new Error("Unsupported target version: " + target_version);
-            }
-            // emulate process.versions
-            var versions_obj = {
-                node: target_version,
-                v8: cross_obj.v8+'.0',
-                // abi_crosswalk uses 1 for node versions lacking process.versions.modules
-                // process.versions.modules added in >= v0.10.4 and v0.11.7
-                modules: cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined
-            };
-            return get_node_abi(runtime, versions_obj);
-        }
-    }
-}
-module.exports.get_runtime_abi = get_runtime_abi;
-
-var required_parameters = [
-    'module_name',
-    'module_path',
-    'host'
-];
-
-function validate_config(package_json,opts) {
-    var msg = package_json.name + ' package.json is not node-pre-gyp ready:\n';
-    var missing = [];
-    if (!package_json.main) {
-        missing.push('main');
-    }
-    if (!package_json.version) {
-        missing.push('version');
-    }
-    if (!package_json.name) {
-        missing.push('name');
-    }
-    if (!package_json.binary) {
-        missing.push('binary');
-    }
-    var o = package_json.binary;
-    required_parameters.forEach(function(p) {
-        if (missing.indexOf('binary') > -1) {
-            missing.pop('binary');
-        }
-        if (!o || o[p] === undefined || o[p] === "") {
-            missing.push('binary.' + p);
-        }
-    });
-    if (missing.length >= 1) {
-        throw new Error(msg+"package.json must declare these properties: \n" + missing.join('\n'));
-    }
-    if (o) {
-        // enforce https over http
-        var protocol = url.parse(o.host).protocol;
-        if (protocol === 'http:') {
-            throw new Error("'host' protocol ("+protocol+") is invalid - only 'https:' is accepted");
-        }
-    }
-    napi.validate_package_json(package_json,opts);
-}
-
-module.exports.validate_config = validate_config;
-
-function eval_template(template,opts) {
-    Object.keys(opts).forEach(function(key) {
-        var pattern = '{'+key+'}';
-        while (template.indexOf(pattern) > -1) {
-            template = template.replace(pattern,opts[key]);
-        }
-    });
-    return template;
-}
-
-// url.resolve needs single trailing slash
-// to behave correctly, otherwise a double slash
-// may end up in the url which breaks requests
-// and a lacking slash may not lead to proper joining
-function fix_slashes(pathname) {
-    if (pathname.slice(-1) != '/') {
-        return pathname + '/';
-    }
-    return pathname;
-}
-
-// remove double slashes
-// note: path.normalize will not work because
-// it will convert forward to back slashes
-function drop_double_slashes(pathname) {
-    return pathname.replace(/\/\//g,'/');
-}
-
-function get_process_runtime(versions) {
-    var runtime = 'node';
-    if (versions['node-webkit']) {
-        runtime = 'node-webkit';
-    } else if (versions.electron) {
-        runtime = 'electron';
-    }
-    return runtime;
-}
-
-module.exports.get_process_runtime = get_process_runtime;
-
-var default_package_name = '{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz';
-var default_remote_path = '';
-
-module.exports.evaluate = function(package_json,options,napi_build_version) {
-    options = options || {};
-    validate_config(package_json,options); // options is a suitable substitute for opts in this case
-    var v = package_json.version;
-    var module_version = semver.parse(v);
-    var runtime = options.runtime || get_process_runtime(process.versions);
-    var opts = {
-        name: package_json.name,
-        configuration: Boolean(options.debug) ? 'Debug' : 'Release',
-        debug: options.debug,
-        module_name: package_json.binary.module_name,
-        version: module_version.version,
-        prerelease: module_version.prerelease.length ? module_version.prerelease.join('.') : '',
-        build: module_version.build.length ? module_version.build.join('.') : '',
-        major: module_version.major,
-        minor: module_version.minor,
-        patch: module_version.patch,
-        runtime: runtime,
-        node_abi: get_runtime_abi(runtime,options.target),
-        node_abi_napi: napi.get_napi_version(options.target) ? 'napi' : get_runtime_abi(runtime,options.target),
-        napi_version: napi.get_napi_version(options.target), // non-zero numeric, undefined if unsupported
-        napi_build_version: napi_build_version || '',
-        node_napi_label: napi_build_version ? 'napi-v' + napi_build_version : get_runtime_abi(runtime,options.target),
-        target: options.target || '',
-        platform: options.target_platform || process.platform,
-        target_platform: options.target_platform || process.platform,
-        arch: options.target_arch || process.arch,
-        target_arch: options.target_arch || process.arch,
-        libc: options.target_libc || detect_libc.family || 'unknown',
-        module_main: package_json.main,
-        toolset : options.toolset || '' // address https://github.com/mapbox/node-pre-gyp/issues/119
-    };
-    // support host mirror with npm config `--{module_name}_binary_host_mirror`
-    // e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25
-    // > npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
-    var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host;
-    opts.host = fix_slashes(eval_template(host,opts));
-    opts.module_path = eval_template(package_json.binary.module_path,opts);
-    // now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably
-    if (options.module_root) {
-        // resolve relative to known module root: works for pre-binding require
-        opts.module_path = path.join(options.module_root,opts.module_path);
-    } else {
-        // resolve relative to current working directory: works for node-pre-gyp commands
-        opts.module_path = path.resolve(opts.module_path);
-    }
-    opts.module = path.join(opts.module_path,opts.module_name + '.node');
-    opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path,opts))) : default_remote_path;
-    var package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name;
-    opts.package_name = eval_template(package_name,opts);
-    opts.staged_tarball = path.join('build/stage',opts.remote_path,opts.package_name);
-    opts.hosted_path = url.resolve(opts.host,opts.remote_path);
-    opts.hosted_tarball = url.resolve(opts.hosted_path,opts.package_name);
-    return opts;
-};
diff --git a/legacy-libs/grpc/node_modules/node-pre-gyp/package.json b/legacy-libs/grpc/node_modules/node-pre-gyp/package.json
deleted file mode 100644 (file)
index 83f52c3..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-{
-  "_from": "node-pre-gyp@^0.13.0",
-  "_id": "node-pre-gyp@0.13.0",
-  "_inBundle": false,
-  "_integrity": "sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==",
-  "_location": "/grpc/node-pre-gyp",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "node-pre-gyp@^0.13.0",
-    "name": "node-pre-gyp",
-    "escapedName": "node-pre-gyp",
-    "rawSpec": "^0.13.0",
-    "saveSpec": null,
-    "fetchSpec": "^0.13.0"
-  },
-  "_requiredBy": [
-    "/grpc"
-  ],
-  "_resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz",
-  "_shasum": "df9ab7b68dd6498137717838e4f92a33fc9daa42",
-  "_shrinkwrap": null,
-  "_spec": "node-pre-gyp@^0.13.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Dane Springmeyer",
-    "email": "dane@mapbox.com"
-  },
-  "bin": {
-    "node-pre-gyp": "./bin/node-pre-gyp"
-  },
-  "bugs": {
-    "url": "https://github.com/mapbox/node-pre-gyp/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "detect-libc": "^1.0.2",
-    "mkdirp": "^0.5.1",
-    "needle": "^2.2.1",
-    "nopt": "^4.0.1",
-    "npm-packlist": "^1.1.6",
-    "npmlog": "^4.0.2",
-    "rc": "^1.2.7",
-    "rimraf": "^2.6.1",
-    "semver": "^5.3.0",
-    "tar": "^4"
-  },
-  "deprecated": false,
-  "description": "Node.js native addon binary install tool",
-  "devDependencies": {
-    "aws-sdk": "^2.28.0",
-    "jshint": "^2.9.5",
-    "nock": "^9.2.3",
-    "tape": "^4.6.3"
-  },
-  "homepage": "https://github.com/mapbox/node-pre-gyp#readme",
-  "jshintConfig": {
-    "node": true,
-    "globalstrict": true,
-    "undef": true,
-    "unused": false,
-    "noarg": true
-  },
-  "keywords": [
-    "native",
-    "addon",
-    "module",
-    "c",
-    "c++",
-    "bindings",
-    "binary"
-  ],
-  "license": "BSD-3-Clause",
-  "main": "./lib/node-pre-gyp.js",
-  "name": "node-pre-gyp",
-  "optionalDependencies": {},
-  "readme": "# node-pre-gyp\n\n#### node-pre-gyp makes it easy to publish and install Node.js C++ addons from binaries\n\n[![NPM](https://nodei.co/npm/node-pre-gyp.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-pre-gyp/)\n\n[![Build Status](https://api.travis-ci.org/mapbox/node-pre-gyp.svg)](https://travis-ci.org/mapbox/node-pre-gyp)\n[![Build status](https://ci.appveyor.com/api/projects/status/3nxewb425y83c0gv)](https://ci.appveyor.com/project/Mapbox/node-pre-gyp)\n[![Dependencies](https://david-dm.org/mapbox/node-pre-gyp.svg)](https://david-dm.org/mapbox/node-pre-gyp)\n\n`node-pre-gyp` stands between [npm](https://github.com/npm/npm) and [node-gyp](https://github.com/Tootallnate/node-gyp) and offers a cross-platform method of binary deployment.\n\n### Features\n\n - A command line tool called `node-pre-gyp` that can install your package's C++ module from a binary.\n - A variety of developer targeted commands for packaging, testing, and publishing binaries.\n - A JavaScript module that can dynamically require your installed binary: `require('node-pre-gyp').find`\n\nFor a hello world example of a module packaged with `node-pre-gyp` see <https://github.com/springmeyer/node-addon-example> and [the wiki ](https://github.com/mapbox/node-pre-gyp/wiki/Modules-using-node-pre-gyp) for real world examples.\n\n## Credits\n\n - The module is modeled after [node-gyp](https://github.com/Tootallnate/node-gyp) by [@Tootallnate](https://github.com/Tootallnate)\n - Motivation for initial development came from [@ErisDS](https://github.com/ErisDS) and the [Ghost Project](https://github.com/TryGhost/Ghost).\n - Development is sponsored by [Mapbox](https://www.mapbox.com/)\n\n## FAQ\n\nSee the [Frequently Ask Questions](https://github.com/mapbox/node-pre-gyp/wiki/FAQ).\n\n## Depends\n\n - Node.js >= node v6.x\n\n## Install\n\n`node-pre-gyp` is designed to be installed as a local dependency of your Node.js C++ addon and accessed like:\n\n    ./node_modules/.bin/node-pre-gyp --help\n\nBut you can also install it globally:\n\n    npm install node-pre-gyp -g\n\n## Usage\n\n### Commands\n\nView all possible commands:\n\n    node-pre-gyp --help\n\n- clean - Remove the entire folder containing the compiled .node module\n- install - Install pre-built binary for module\n- reinstall - Run \"clean\" and \"install\" at once\n- build - Compile the module by dispatching to node-gyp or nw-gyp\n- rebuild - Run \"clean\" and \"build\" at once\n- package - Pack binary into tarball\n- testpackage - Test that the staged package is valid\n- publish - Publish pre-built binary\n- unpublish - Unpublish pre-built binary\n- info - Fetch info on published binaries\n\nYou can also chain commands:\n\n    node-pre-gyp clean build unpublish publish info\n\n### Options\n\nOptions include:\n\n - `-C/--directory`: run the command in this directory\n - `--build-from-source`: build from source instead of using pre-built binary\n - `--update-binary`: reinstall by replacing previously installed local binary with remote binary\n - `--runtime=node-webkit`: customize the runtime: `node`, `electron` and `node-webkit` are the valid options\n - `--fallback-to-build`: fallback to building from source if pre-built binary is not available\n - `--target=0.4.0`: Pass the target node or node-webkit version to compile against\n - `--target_arch=ia32`: Pass the target arch and override the host `arch`. Valid values are 'ia32','x64', or `arm`.\n - `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`.\n\nBoth `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module.\n\nFor example: `npm install --build-from-source=myapp`. This is useful if:\n\n - `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependency with `npm install`.\n - The larger app also depends on other modules installed with `node-pre-gyp`\n - You only want to trigger a source compile for `myapp` and the other modules.\n\n### Configuring\n\nThis is a guide to configuring your module to use node-pre-gyp.\n\n#### 1) Add new entries to your `package.json`\n\n - Add `node-pre-gyp` to `dependencies`\n - Add `aws-sdk` as a `devDependency`\n - Add a custom `install` script\n - Declare a `binary` object\n\nThis looks like:\n\n```js\n    \"dependencies\"  : {\n      \"node-pre-gyp\": \"0.6.x\"\n    },\n    \"devDependencies\": {\n      \"aws-sdk\": \"2.x\"\n    }\n    \"scripts\": {\n        \"install\": \"node-pre-gyp install --fallback-to-build\"\n    },\n    \"binary\": {\n        \"module_name\": \"your_module\",\n        \"module_path\": \"./lib/binding/\",\n        \"host\": \"https://your_module.s3-us-west-1.amazonaws.com\"\n    }\n```\n\nFor a full example see [node-addon-examples's package.json](https://github.com/springmeyer/node-addon-example/blob/master/package.json).\n\nLet's break this down:\n\n - Dependencies need to list `node-pre-gyp`\n - Your devDependencies should list `aws-sdk` so that you can run `node-pre-gyp publish` locally or a CI system. We recommend using `devDependencies` only since `aws-sdk` is large and not needed for `node-pre-gyp install` since it only uses http to fetch binaries\n - Your `scripts` section should override the `install` target with `\"install\": \"node-pre-gyp install --fallback-to-build\"`. This allows node-pre-gyp to be used instead of the default npm behavior of always source compiling with `node-gyp` directly.\n - Your package.json should contain a `binary` section describing key properties you provide to allow node-pre-gyp to package optimally. They are detailed below.\n\nNote: in the past we recommended putting `node-pre-gyp` in the `bundledDependencies`, but we no longer recommend this. In the past there were npm bugs (with node versions 0.10.x) that could lead to node-pre-gyp not being available at the right time during install (unless we bundled). This should no longer be the case. Also, for a time we recommended using `\"preinstall\": \"npm install node-pre-gyp\"` as an alternative method to avoid needing to bundle. But this did not behave predictably across all npm versions - see https://github.com/mapbox/node-pre-gyp/issues/260 for the details. So we do not recommend using `preinstall` to install `node-pre-gyp`. More history on this at https://github.com/strongloop/fsevents/issues/157#issuecomment-265545908.\n\n##### The `binary` object has three required properties\n\n###### module_name\n\nThe name of your native node module. This value must:\n\n - Match the name passed to [the NODE_MODULE macro](http://nodejs.org/api/addons.html#addons_hello_world)\n - Must be a valid C variable name (e.g. it cannot contain `-`)\n - Should not include the `.node` extension.\n\n###### module_path\n\nThe location your native module is placed after a build. This should be an empty directory without other Javascript files. This entire directory will be packaged in the binary tarball. When installing from a remote package this directory will be overwritten with the contents of the tarball.\n\nNote: This property supports variables based on [Versioning](#versioning).\n\n###### host\n\nA url to the remote location where you've published tarball binaries (must be `https` not `http`).\n\nIt is highly recommended that you use Amazon S3. The reasons are:\n\n  - Various node-pre-gyp commands like `publish` and `info` only work with an S3 host.\n  - S3 is a very solid hosting platform for distributing large files.\n  - We provide detail documentation for using [S3 hosting](#s3-hosting) with node-pre-gyp.\n\nWhy then not require S3? Because while some applications using node-pre-gyp need to distribute binaries as large as 20-30 MB, others might have very small binaries and might wish to store them in a GitHub repo. This is not recommended, but if an author really wants to host in a non-S3 location then it should be possible.\n\nIt should also be mentioned that there is an optional and entirely separate npm module called [node-pre-gyp-github](https://github.com/bchr02/node-pre-gyp-github) which is intended to complement node-pre-gyp and be installed along with it. It provides the ability to store and publish your binaries within your repositories GitHub Releases if you would rather not use S3 directly. Installation and usage instructions can be found [here](https://github.com/bchr02/node-pre-gyp-github), but the basic premise is that instead of using the ```node-pre-gyp publish``` command you would use ```node-pre-gyp-github publish```.\n\n##### The `binary` object has two optional properties\n\n###### remote_path\n\nIt **is recommended** that you customize this property. This is an extra path to use for publishing and finding remote tarballs. The default value for `remote_path` is `\"\"` meaning that if you do not provide it then all packages will be published at the base of the `host`. It is recommended to provide a value like `./{name}/v{version}` to help organize remote packages in the case that you choose to publish multiple node addons to the same `host`.\n\nNote: This property supports variables based on [Versioning](#versioning).\n\n###### package_name\n\nIt is **not recommended** to override this property unless you are also overriding the `remote_path`. This is the versioned name of the remote tarball containing the binary `.node` module and any supporting files you've placed inside the `module_path` directory. Unless you specify `package_name` in your `package.json` then it defaults to `{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz` which allows your binary to work across node versions, platforms, and architectures. If you are using `remote_path` that is also versioned by `./{module_name}/v{version}` then you could remove these variables from the `package_name` and just use: `{node_abi}-{platform}-{arch}.tar.gz`. Then your remote tarball will be looked up at, for example, `https://example.com/your-module/v0.1.0/node-v11-linux-x64.tar.gz`.\n\nAvoiding the version of your module in the `package_name` and instead only embedding in a directory name can be useful when you want to make a quick tag of your module that does not change any C++ code. In this case you can just copy binaries to the new version behind the scenes like:\n\n```sh\naws s3 sync --acl public-read s3://mapbox-node-binary/sqlite3/v3.0.3/ s3://mapbox-node-binary/sqlite3/v3.0.4/\n```\n\nNote: This property supports variables based on [Versioning](#versioning).\n\n#### 2) Add a new target to binding.gyp\n\n`node-pre-gyp` calls out to `node-gyp` to compile the module and passes variables along like [module_name](#module_name) and [module_path](#module_path).\n\nA new target must be added to `binding.gyp` that moves the compiled `.node` module from `./build/Release/module_name.node` into the directory specified by `module_path`.\n\nAdd a target like this at the end of your `targets` list:\n\n```js\n    {\n      \"target_name\": \"action_after_build\",\n      \"type\": \"none\",\n      \"dependencies\": [ \"<(module_name)\" ],\n      \"copies\": [\n        {\n          \"files\": [ \"<(PRODUCT_DIR)/<(module_name).node\" ],\n          \"destination\": \"<(module_path)\"\n        }\n      ]\n    }\n```\n\nFor a full example see [node-addon-example's binding.gyp](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/binding.gyp).\n\n#### 3) Dynamically require your `.node`\n\nInside the main js file that requires your addon module you are likely currently doing:\n\n```js\nvar binding = require('../build/Release/binding.node');\n```\n\nor:\n\n```js\nvar bindings = require('./bindings')\n```\n\nChange those lines to:\n\n```js\nvar binary = require('node-pre-gyp');\nvar path = require('path');\nvar binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));\nvar binding = require(binding_path);\n```\n\nFor a full example see [node-addon-example's index.js](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/index.js#L1-L4)\n\n#### 4) Build and package your app\n\nNow build your module from source:\n\n    npm install --build-from-source\n\nThe `--build-from-source` tells `node-pre-gyp` to not look for a remote package and instead dispatch to node-gyp to build.\n\nNow `node-pre-gyp` should now also be installed as a local dependency so the command line tool it offers can be found at `./node_modules/.bin/node-pre-gyp`.\n\n#### 5) Test\n\nNow `npm test` should work just as it did before.\n\n#### 6) Publish the tarball\n\nThen package your app:\n\n    ./node_modules/.bin/node-pre-gyp package\n\nOnce packaged, now you can publish:\n\n    ./node_modules/.bin/node-pre-gyp publish\n\nCurrently the `publish` command pushes your binary to S3. This requires:\n\n - You have installed `aws-sdk` with `npm install aws-sdk`\n - You have created a bucket already.\n - The `host` points to an S3 http or https endpoint.\n - You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details).\n\nYou can also host your binaries elsewhere. To do this requires:\n\n - You manually publish the binary created by the `package` command to an `https` endpoint\n - Ensure that the `host` value points to your custom `https` endpoint.\n\n#### 7) Automate builds\n\nNow you need to publish builds for all the platforms and node versions you wish to support. This is best automated.\n\n - See [Appveyor Automation](#appveyor-automation) for how to auto-publish builds on Windows.\n - See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux.\n\n#### 8) You're done!\n\nNow publish your module to the npm registry. Users will now be able to install your module from a binary.\n\nWhat will happen is this:\n\n1. `npm install <your package>` will pull from the npm registry\n2. npm will run the `install` script which will call out to `node-pre-gyp`\n3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place\n4. Assuming that all worked, you are done\n\nIf a a binary was not available for a given platform and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module.\n\n## N-API Considerations\n\n[N-API](https://nodejs.org/api/n-api.html#n_api_n_api) is an ABI-stable alternative to previous technologies such as [nan](https://github.com/nodejs/nan) which are tied to a specific Node runtime engine. N-API is Node runtime engine agnostic and guarantees modules created today will continue to run, without changes, into the future.\n\nUsing `node-pre-gyp` with N-API projects requires a handful of additional configuration values and imposes some additional requirements.\n\nThe most significant difference is that an N-API module can be coded to target multiple  N-API versions. Therefore, an N-API module must declare in its `package.json` file which N-API versions the module is designed to run against. In addition, since multiple builds may be required for a single module, path and file names must be specified in way that avoids naming conflicts.\n\n### The `napi_versions` array property\n\nAn N-API modules must declare in its `package.json` file, the N-API versions the module is intended to support. This is accomplished by including an `napi-versions` array property in the `binary` object. For example:\n\n```js\n\"binary\": {\n    \"module_name\": \"your_module\",\n    \"module_path\": \"your_module_path\",\n    \"host\": \"https://your_bucket.s3-us-west-1.amazonaws.com\",\n    \"napi_versions\": [1,3]\n  }\n```\n\nIf the `napi_versions` array property is *not* present, `node-pre-gyp` operates as it always has. Including the `napi_versions` array property instructs `node-pre-gyp` that this is a N-API module build.\n\nWhen the `napi_versions` array property is present, `node-pre-gyp` fires off multiple operations, one for each of the N-API versions in the array. In the example above, two operations are initiated, one for N-API version 1 and second for N-API version 3. How this version number is communicated is described next.\n\n### The `napi_build_version` value\n\nFor each of the N-API module operations `node-pre-gyp` initiates, it ensures that the `napi_build_version` is set appropriately.\n\nThis value is of importance in two areas:\n\n1. The C/C++ code which needs to know against which N-API version it should compile.\n2. `node-pre-gyp` itself which must assign appropriate path and file names to avoid collisions.\n\n### Defining `NAPI_VERSION` for the C/C++ code\n\nThe `napi_build_version` value is communicated to the C/C++ code by adding this code to the `binding.gyp` file:\n\n```\n\"defines\": [\n    \"NAPI_VERSION=<(napi_build_version)\",\n]\n```\n\nThis ensures that `NAPI_VERSION`, an integer value, is declared appropriately to the C/C++ code for each build.\n\n> Note that earlier versions of this document recommended defining the symbol `NAPI_BUILD_VERSION`. `NAPI_VERSION` is prefered because it used by the N-API C/C++ headers to configure the specific N-API veriosn being requested. \n\n### Path and file naming requirements in `package.json`\n\nSince `node-pre-gyp` fires off multiple operations for each request, it is essential that path and file names be created in such a way as to avoid collisions. This is accomplished by imposing additional path and file naming requirements.\n\nSpecifically, when performing N-API builds, the `{napi_build_version}` text configuration value  *must* be present in the `module_path` property. In addition, the `{napi_build_version}` text configuration value  *must* be present in either the `remote_path` or `package_name` property. (No problem if it's in both.)\n\nHere's an example:\n\n```js\n\"binary\": {\n    \"module_name\": \"your_module\",\n    \"module_path\": \"./lib/binding/napi-v{napi_build_version}\",\n    \"remote_path\": \"./{module_name}/v{version}/{configuration}/\",\n    \"package_name\": \"{platform}-{arch}-napi-v{napi_build_version}.tar.gz\",\n    \"host\": \"https://your_bucket.s3-us-west-1.amazonaws.com\",\n    \"napi_versions\": [1,3]\n  }\n```\n\n## Supporting both N-API and NAN builds\n\nYou may have a legacy native add-on that you wish to continue supporting for those versions of Node that do not support N-API, as you add N-API support for later Node versions. This can be accomplished by specifying the `node_napi_label` configuration value in the package.json `binary.package_name` property. \n\nPlacing the configuration value `node_napi_label` in the package.json `binary.package_name` property instructs `node-pre-gyp` to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, `node-pre-gyp` will request a traditional, non-N-API build. \n\nThe configuration value `node_napi_label` is set by `node-pre-gyp` to the type of build created, `napi` or `node`, and the version number. For N-API builds, the string contains the N-API version nad has values like `napi-v3`. For traditional, non-N-API builds, the string contains the ABI version with values like `node-v46`.\n\nHere's how the `binary` configuration above might be changed to support both N-API and NAN builds:\n\n```js\n\"binary\": {\n    \"module_name\": \"your_module\",\n    \"module_path\": \"./lib/binding/{node_napi_label}\",\n    \"remote_path\": \"./{module_name}/v{version}/{configuration}/\",\n    \"package_name\": \"{platform}-{arch}-{node_napi_label}.tar.gz\",\n    \"host\": \"https://your_bucket.s3-us-west-1.amazonaws.com\",\n    \"napi_versions\": [1,3]\n  }\n```\n\nThe C/C++ symbol `NAPI_VERSION` can be used to distinguish N-API and non-N-API builds. The value of `NAPI_VERSION` is set to the integer N-API version for N-API builds and is set to `0` for non-N-API builds. \n\nFor example:\n \n```C\n#if NAPI_VERSION\n// N-API code goes here\n#else\n// NAN code goes here\n#endif\n```\n\n### Two additional configuration values\n\nThe following two configuration values, which were implemented in previous versions of `node-pre-gyp`, continue to exist, but have been replaced by the `node_napi_label` configuration value described above.\n\n1. `napi_version` If N-API is supported by the currently executing Node instance, this value is the N-API version number supported by Node. If N-API is not supported, this value is an empty string.\n\n2. `node_abi_napi` If the value returned for `napi_version` is non empty, this value is `'napi'`. If the value returned for `napi_version` is empty, this value is the value returned for `node_abi`.\n\nThese values are present for use in the `binding.gyp` file and may be used as `{napi_version}` and `{node_abi_napi}` for text substituion in the `binary` properties of the `package.json` file.\n\n## S3 Hosting\n\nYou can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [Travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu, and with [Appveyor](http://appveyor.com) to automate builds for Windows. Here is an approach to do this:\n\nFirst, get setup locally and test the workflow:\n\n#### 1) Create an S3 bucket\n\nAnd have your **key** and **secret key** ready for writing to the bucket.\n\nIt is recommended to create a IAM user with a policy that only gives permissions to the specific bucket you plan to publish to. This can be done in the [IAM console](https://console.aws.amazon.com/iam/) by: 1) adding a new user, 2) choosing `Attach User Policy`, 3) Using the `Policy Generator`, 4) selecting `Amazon S3` for the service, 5) adding the actions: `DeleteObject`, `GetObject`, `GetObjectAcl`, `ListBucket`, `PutObject`, `PutObjectAcl`, 6) adding an ARN of `arn:aws:s3:::bucket/*` (replacing `bucket` with your bucket name), and finally 7) clicking `Add Statement` and saving the policy. It should generate a policy like:\n\n```js\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"Stmt1394587197000\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:DeleteObject\",\n        \"s3:GetObject\",\n        \"s3:GetObjectAcl\",\n        \"s3:ListBucket\",\n        \"s3:PutObject\",\n        \"s3:PutObjectAcl\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::node-pre-gyp-tests/*\"\n      ]\n    }\n  ]\n}\n```\n\n#### 2) Install node-pre-gyp\n\nEither install it globally:\n\n    npm install node-pre-gyp -g\n\nOr put the local version on your PATH\n\n    export PATH=`pwd`/node_modules/.bin/:$PATH\n\n#### 3) Configure AWS credentials\n\nThere are several ways to do this.\n\nYou can use any of the methods described at http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html.\n\nOr you can create a `~/.node_pre_gyprc`\n\nOr pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards)\n\nA `~/.node_pre_gyprc` looks like:\n\n```js\n{\n    \"accessKeyId\": \"xxx\",\n    \"secretAccessKey\": \"xxx\"\n}\n```\n\nAnother way is to use your environment:\n\n    export node_pre_gyp_accessKeyId=xxx\n    export node_pre_gyp_secretAccessKey=xxx\n\nYou may also need to specify the `region` if it is not explicit in the `host` value you use. The `bucket` can also be specified but it is optional because `node-pre-gyp` will detect it from the `host` value.\n\n#### 4) Package and publish your build\n\nInstall the `aws-sdk`:\n\n    npm install aws-sdk\n\nThen publish:\n\n    node-pre-gyp package publish\n\nNote: if you hit an error like `Hostname/IP doesn't match certificate's altnames` it may mean that you need to provide the `region` option in your config.\n\n## Appveyor Automation\n\n[Appveyor](http://www.appveyor.com/) can build binaries and publish the results per commit and supports:\n\n - Windows Visual Studio 2013 and related compilers\n - Both 64 bit (x64) and 32 bit (x86) build configurations\n - Multiple Node.js versions\n\nFor an example of doing this see [node-sqlite3's appveyor.yml](https://github.com/mapbox/node-sqlite3/blob/master/appveyor.yml).\n\nBelow is a guide to getting set up:\n\n#### 1) Create a free Appveyor account\n\nGo to https://ci.appveyor.com/signup/free and sign in with your GitHub account.\n\n#### 2) Create a new project\n\nGo to https://ci.appveyor.com/projects/new and select the GitHub repo for your module\n\n#### 3) Add appveyor.yml and push it\n\nOnce you have committed an `appveyor.yml` ([appveyor.yml reference](http://www.appveyor.com/docs/appveyor-yml)) to your GitHub repo and pushed it AppVeyor should automatically start building your project.\n\n#### 4) Create secure variables\n\nEncrypt your S3 AWS keys by going to <https://ci.appveyor.com/tools/encrypt> and hitting the `encrypt` button.\n\nThen paste the result into your `appveyor.yml`\n\n```yml\nenvironment:\n  node_pre_gyp_accessKeyId:\n    secure: Dn9HKdLNYvDgPdQOzRq/DqZ/MPhjknRHB1o+/lVU8MA=\n  node_pre_gyp_secretAccessKey:\n    secure: W1rwNoSnOku1r+28gnoufO8UA8iWADmL1LiiwH9IOkIVhDTNGdGPJqAlLjNqwLnL\n```\n\nNOTE: keys are per account but not per repo (this is difference than Travis where keys are per repo but not related to the account used to encrypt them).\n\n#### 5) Hook up publishing\n\nJust put `node-pre-gyp package publish` in your `appveyor.yml` after `npm install`.\n\n#### 6) Publish when you want\n\nYou might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:\n\n    SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%\n    if not \"%CM%\" == \"%CM:[publish binary]=%\" node-pre-gyp --msvs_version=2013 publish\n\nIf your commit message contains special characters (e.g. `&`) this method might fail. An alternative is to use PowerShell, which gives you additional possibilities, like ignoring case by using `ToLower()`:\n\n    ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]')) { node-pre-gyp --msvs_version=2013 publish }\n\nRemember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package.\n\n## Travis Automation\n\n[Travis](https://travis-ci.org/) can push to S3 after a successful build and supports both:\n\n - Ubuntu Precise and OS X (64 bit)\n - Multiple Node.js versions\n\nFor an example of doing this see [node-add-example's .travis.yml](https://github.com/springmeyer/node-addon-example/blob/2ff60a8ded7f042864ad21db00c3a5a06cf47075/.travis.yml).\n\nNote: if you need 32 bit binaries, this can be done from a 64 bit Travis machine. See [the node-sqlite3 scripts for an example of doing this](https://github.com/mapbox/node-sqlite3/blob/bae122aa6a2b8a45f6b717fab24e207740e32b5d/scripts/build_against_node.sh#L54-L74).\n\nBelow is a guide to getting set up:\n\n#### 1) Install the Travis gem\n\n    gem install travis\n\n#### 2) Create secure variables\n\nMake sure you run this command from within the directory of your module.\n\nUse `travis-encrypt` like:\n\n    travis encrypt node_pre_gyp_accessKeyId=${node_pre_gyp_accessKeyId}\n    travis encrypt node_pre_gyp_secretAccessKey=${node_pre_gyp_secretAccessKey}\n\nThen put those values in your `.travis.yml` like:\n\n```yaml\nenv:\n  global:\n    - secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M=\n    - secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI=\n```\n\nMore details on Travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/.\n\n#### 3) Hook up publishing\n\nJust put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`.\n\n##### OS X publishing\n\nIf you want binaries for OS X in addition to linux you can enable [multi-os for Travis](http://docs.travis-ci.com/user/multi-os/#Setting-.travis.yml)\n\nUse a configuration like:\n\n```yml\n\nlanguage: cpp\n\nos:\n- linux\n- osx\n\nenv:\n  matrix:\n    - NODE_VERSION=\"4\"\n    - NODE_VERSION=\"6\"\n\nbefore_install:\n- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm\n- source ~/.nvm/nvm.sh\n- nvm install $NODE_VERSION\n- nvm use $NODE_VERSION\n```\n\nSee [Travis OS X Gotchas](#travis-os-x-gotchas) for why we replace `language: node_js` and `node_js:` sections with `language: cpp` and a custom matrix.\n\nAlso create platform specific sections for any deps that need install. For example if you need libpng:\n\n```yml\n- if [ $(uname -s) == 'Linux' ]; then apt-get install libpng-dev; fi;\n- if [ $(uname -s) == 'Darwin' ]; then brew install libpng; fi;\n```\n\nFor detailed multi-OS examples see [node-mapnik](https://github.com/mapnik/node-mapnik/blob/master/.travis.yml) and [node-sqlite3](https://github.com/mapbox/node-sqlite3/blob/master/.travis.yml).\n\n##### Travis OS X Gotchas\n\nFirst, unlike the Travis Linux machines, the OS X machines do not put `node-pre-gyp` on PATH by default. To do so you will need to:\n\n```sh\nexport PATH=$(pwd)/node_modules/.bin:${PATH}\n```\n\nSecond, the OS X machines do not support using a matrix for installing different Node.js versions. So you need to bootstrap the installation of Node.js in a cross platform way.\n\nBy doing:\n\n```yml\nenv:\n  matrix:\n    - NODE_VERSION=\"4\"\n    - NODE_VERSION=\"6\"\n\nbefore_install:\n - rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm\n - source ~/.nvm/nvm.sh\n - nvm install $NODE_VERSION\n - nvm use $NODE_VERSION\n```\n\nYou can easily recreate the previous behavior of this matrix:\n\n```yml\nnode_js:\n  - \"4\"\n  - \"6\"\n```\n\n#### 4) Publish when you want\n\nYou might wish to publish binaries only on a specific commit. To do this you could borrow from the [Travis CI idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish binary]`:\n\n    COMMIT_MESSAGE=$(git log --format=%B --no-merges -n 1 | tr -d '\\n')\n    if [[ ${COMMIT_MESSAGE} =~ \"[publish binary]\" ]]; then node-pre-gyp publish; fi;\n\nThen you can trigger new binaries to be built like:\n\n    git commit -a -m \"[publish binary]\"\n\nOr, if you don't have any changes to make simply run:\n\n    git commit --allow-empty -m \"[publish binary]\"\n\nWARNING: if you are working in a pull request and publishing binaries from there then you will want to avoid double publishing when Travis CI builds both the `push` and `pr`. You only want to run the publish on the `push` commit. See https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/is_pr_merge.sh which is called from https://github.com/Project-OSRM/node-osrm/blob/8eb837abe2e2e30e595093d16e5354bc5c573575/scripts/publish.sh for an example of how to do this.\n\nRemember this publishing is not the same as `npm publish`. We're just talking about the binary module here and not your entire npm package. To automate the publishing of your entire package to npm on Travis see http://about.travis-ci.org/docs/user/deployment/npm/\n\n# Versioning\n\nThe `binary` properties of `module_path`, `remote_path`, and `package_name` support variable substitution. The strings are evaluated by `node-pre-gyp` depending on your system and any custom build flags you passed.\n\n - `node_abi`: The node C++ `ABI` number. This value is available in Javascript as `process.versions.modules` as of [`>= v0.10.4 >= v0.11.7`](https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e) and in C++ as the `NODE_MODULE_VERSION` define much earlier. For versions of Node before this was available we fallback to the V8 major and minor version.\n - `platform` matches node's `process.platform` like `linux`, `darwin`, and `win32` unless the user passed the `--target_platform` option to override.\n - `arch` matches node's `process.arch` like `x64` or `ia32` unless the user passes the `--target_arch` option to override.\n - `libc` matches `require('detect-libc').family` like `glibc` or `musl` unless the user passes the `--target_libc` option to override.\n - `configuration` - Either 'Release' or 'Debug' depending on if `--debug` is passed during the build.\n - `module_name` - the `binary.module_name` attribute from `package.json`.\n - `version` - the semver `version` value for your module from `package.json` (NOTE: ignores the `semver.build` property).\n - `major`, `minor`, `patch`, and `prelease` match the individual semver values for your module's `version`\n - `build` - the sevmer `build` value. For example it would be `this.that` if your package.json `version` was `v1.0.0+this.that`\n - `prerelease` - the semver `prerelease` value. For example it would be `alpha.beta` if your package.json `version` was `v1.0.0-alpha.beta`\n\n\nThe options are visible in the code at <https://github.com/mapbox/node-pre-gyp/blob/612b7bca2604508d881e1187614870ba19a7f0c5/lib/util/versioning.js#L114-L127>\n\n# Download binary files from a mirror\n\nS3 is broken in China for the well known reason.\n\nUsing the `npm` config argument: `--{module_name}_binary_host_mirror` can download binary files through a mirror.\n\ne.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`.\n\n```bash\n$ npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/mapbox/node-pre-gyp.git"
-  },
-  "scripts": {
-    "pretest": "jshint test/build.test.js test/s3_setup.test.js test/versioning.test.js test/fetch.test.js lib lib/util scripts bin/node-pre-gyp",
-    "test": "jshint lib lib/util scripts bin/node-pre-gyp && tape test/*test.js",
-    "update-crosswalk": "node scripts/abi_crosswalk.js"
-  },
-  "version": "0.13.0"
-}
diff --git a/legacy-libs/grpc/node_modules/nopt/CHANGELOG.md b/legacy-libs/grpc/node_modules/nopt/CHANGELOG.md
deleted file mode 100644 (file)
index 82a09fb..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-### v4.0.1 (2016-12-14)
-
-#### WHOOPS
-
-* [`fb9b1ce`](https://github.com/npm/nopt/commit/fb9b1ce57b3c69b4f7819015be87719204f77ef6)
-  Merged so many patches at once that the code fencing
-  ([@adius](https://github.com/adius)) added got broken. Sorry,
-  ([@adius](https://github.com/adius))!
-  ([@othiym23](https://github.com/othiym23))
-
-### v4.0.0 (2016-12-13)
-
-#### BREAKING CHANGES
-
-* [`651d447`](https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa)
-  When parsing String-typed arguments, if the next value is `""`, don't simply
-  swallow it. ([@samjonester](https://github.com/samjonester))
-
-#### PERFORMANCE TWEAKS
-
-* [`3370ce8`](https://github.com/npm/nopt/commit/3370ce87a7618ba228883861db84ddbcdff252a9)
-  Simplify initialization. ([@elidoran](https://github.com/elidoran))
-* [`356e58e`](https://github.com/npm/nopt/commit/356e58e3b3b431a4b1af7fd7bdee44c2c0526a09)
-  Store `Array.isArray(types[arg])` for reuse.
-  ([@elidoran](https://github.com/elidoran))
-* [`0d95e90`](https://github.com/npm/nopt/commit/0d95e90515844f266015b56d2c80b94e5d14a07e)
-  Interpret single-item type arrays as a single type.
-  ([@samjonester](https://github.com/samjonester))
-* [`07c69d3`](https://github.com/npm/nopt/commit/07c69d38b5186450941fbb505550becb78a0e925)
-  Simplify key-value extraction. ([@elidoran](https://github.com/elidoran))
-* [`39b6e5c`](https://github.com/npm/nopt/commit/39b6e5c65ac47f60cd43a1fbeece5cd4c834c254)
-  Only call `Date.parse(val)` once. ([@elidoran](https://github.com/elidoran))
-* [`934943d`](https://github.com/npm/nopt/commit/934943dffecb55123a2b15959fe2a359319a5dbd)
-  Use `osenv.home()` to find a user's home directory instead of assuming it's
-  always `$HOME`. ([@othiym23](https://github.com/othiym23))
-
-#### TEST & CI IMPROVEMENTS
-
-* [`326ffff`](https://github.com/npm/nopt/commit/326ffff7f78a00bcd316adecf69075f8a8093619)
-  Fix `/tmp` test to work on Windows.
-  ([@elidoran](https://github.com/elidoran))
-* [`c89d31a`](https://github.com/npm/nopt/commit/c89d31a49d14f2238bc6672db08da697bbc57f1b)
-  Only run Windows tests on Windows, only run Unix tests on a Unix.
-  ([@elidoran](https://github.com/elidoran))
-* [`affd3d1`](https://github.com/npm/nopt/commit/affd3d1d0addffa93006397b2013b18447339366)
-  Refresh Travis to run the tests against the currently-supported batch of npm
-  versions. ([@helio](https://github.com/helio)-frota)
-* [`55f9449`](https://github.com/npm/nopt/commit/55f94497d163ed4d16dd55fd6c4fb95cc440e66d)
-  `tap@8.0.1` ([@othiym23](https://github.com/othiym23))
-
-#### DOC TWEAKS
-
-* [`5271229`](https://github.com/npm/nopt/commit/5271229ee7c810217dd51616c086f5d9ab224581)
-  Use JavaScript code block for syntax highlighting.
-  ([@adius](https://github.com/adius))
-* [`c0d156f`](https://github.com/npm/nopt/commit/c0d156f229f9994c5dfcec4a8886eceff7a07682)
-  The code sample in the README had `many2: [ oneThing ]`, and now it has
-  `many2: [ two, things ]`. ([@silkentrance](https://github.com/silkentrance))
diff --git a/legacy-libs/grpc/node_modules/nopt/LICENSE b/legacy-libs/grpc/node_modules/nopt/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/nopt/README.md b/legacy-libs/grpc/node_modules/nopt/README.md
deleted file mode 100644 (file)
index a99531c..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-If you want to write an option parser, and have it be good, there are
-two ways to do it.  The Right Way, and the Wrong Way.
-
-The Wrong Way is to sit down and write an option parser.  We've all done
-that.
-
-The Right Way is to write some complex configurable program with so many
-options that you hit the limit of your frustration just trying to
-manage them all, and defer it with duct-tape solutions until you see
-exactly to the core of the problem, and finally snap and write an
-awesome option parser.
-
-If you want to write an option parser, don't write an option parser.
-Write a package manager, or a source control system, or a service
-restarter, or an operating system.  You probably won't end up with a
-good one of those, but if you don't give up, and you are relentless and
-diligent enough in your procrastination, you may just end up with a very
-nice option parser.
-
-## USAGE
-
-```javascript
-// my-program.js
-var nopt = require("nopt")
-  , Stream = require("stream").Stream
-  , path = require("path")
-  , knownOpts = { "foo" : [String, null]
-                , "bar" : [Stream, Number]
-                , "baz" : path
-                , "bloo" : [ "big", "medium", "small" ]
-                , "flag" : Boolean
-                , "pick" : Boolean
-                , "many1" : [String, Array]
-                , "many2" : [path, Array]
-                }
-  , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
-                 , "b7" : ["--bar", "7"]
-                 , "m" : ["--bloo", "medium"]
-                 , "p" : ["--pick"]
-                 , "f" : ["--flag"]
-                 }
-             // everything is optional.
-             // knownOpts and shorthands default to {}
-             // arg list defaults to process.argv
-             // slice defaults to 2
-  , parsed = nopt(knownOpts, shortHands, process.argv, 2)
-console.log(parsed)
-```
-
-This would give you support for any of the following:
-
-```console
-$ node my-program.js --foo "blerp" --no-flag
-{ "foo" : "blerp", "flag" : false }
-
-$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
-{ bar: 7, foo: "Mr. Hand", flag: true }
-
-$ node my-program.js --foo "blerp" -f -----p
-{ foo: "blerp", flag: true, pick: true }
-
-$ node my-program.js -fp --foofoo
-{ foo: "Mr. Foo", flag: true, pick: true }
-
-$ node my-program.js --foofoo -- -fp  # -- stops the flag parsing.
-{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
-
-$ node my-program.js --blatzk -fp # unknown opts are ok.
-{ blatzk: true, flag: true, pick: true }
-
-$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value
-{ blatzk: 1000, flag: true, pick: true }
-
-$ node my-program.js --no-blatzk -fp # unless they start with "no-"
-{ blatzk: false, flag: true, pick: true }
-
-$ node my-program.js --baz b/a/z # known paths are resolved.
-{ baz: "/Users/isaacs/b/a/z" }
-
-# if Array is one of the types, then it can take many
-# values, and will always be an array.  The other types provided
-# specify what types are allowed in the list.
-
-$ node my-program.js --many1 5 --many1 null --many1 foo
-{ many1: ["5", "null", "foo"] }
-
-$ node my-program.js --many2 foo --many2 bar
-{ many2: ["/path/to/foo", "path/to/bar"] }
-```
-
-Read the tests at the bottom of `lib/nopt.js` for more examples of
-what this puppy can do.
-
-## Types
-
-The following types are supported, and defined on `nopt.typeDefs`
-
-* String: A normal string.  No parsing is done.
-* path: A file system path.  Gets resolved against cwd if not absolute.
-* url: A url.  If it doesn't parse, it isn't accepted.
-* Number: Must be numeric.
-* Date: Must parse as a date. If it does, and `Date` is one of the options,
-  then it will return a Date object, not a string.
-* Boolean: Must be either `true` or `false`.  If an option is a boolean,
-  then it does not need a value, and its presence will imply `true` as
-  the value.  To negate boolean flags, do `--no-whatever` or `--whatever
-  false`
-* NaN: Means that the option is strictly not allowed.  Any value will
-  fail.
-* Stream: An object matching the "Stream" class in node.  Valuable
-  for use when validating programmatically.  (npm uses this to let you
-  supply any WriteStream on the `outfd` and `logfd` config options.)
-* Array: If `Array` is specified as one of the types, then the value
-  will be parsed as a list of options.  This means that multiple values
-  can be specified, and that the value will always be an array.
-
-If a type is an array of values not on this list, then those are
-considered valid values.  For instance, in the example above, the
-`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
-and any other value will be rejected.
-
-When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
-interpreted as their JavaScript equivalents.
-
-You can also mix types and values, or multiple types, in a list.  For
-instance `{ blah: [Number, null] }` would allow a value to be set to
-either a Number or null.  When types are ordered, this implies a
-preference, and the first type that can be used to properly interpret
-the value will be used.
-
-To define a new type, add it to `nopt.typeDefs`.  Each item in that
-hash is an object with a `type` member and a `validate` method.  The
-`type` member is an object that matches what goes in the type list.  The
-`validate` method is a function that gets called with `validate(data,
-key, val)`.  Validate methods should assign `data[key]` to the valid
-value of `val` if it can be handled properly, or return boolean
-`false` if it cannot.
-
-You can also call `nopt.clean(data, types, typeDefs)` to clean up a
-config object and remove its invalid properties.
-
-## Error Handling
-
-By default, nopt outputs a warning to standard error when invalid values for
-known options are found.  You can change this behavior by assigning a method
-to `nopt.invalidHandler`.  This method will be called with
-the offending `nopt.invalidHandler(key, val, types)`.
-
-If no `nopt.invalidHandler` is assigned, then it will console.error
-its whining.  If it is assigned to boolean `false` then the warning is
-suppressed.
-
-## Abbreviations
-
-Yes, they are supported.  If you define options like this:
-
-```javascript
-{ "foolhardyelephants" : Boolean
-, "pileofmonkeys" : Boolean }
-```
-
-Then this will work:
-
-```bash
-node program.js --foolhar --pil
-node program.js --no-f --pileofmon
-# etc.
-```
-
-## Shorthands
-
-Shorthands are a hash of shorter option names to a snippet of args that
-they expand to.
-
-If multiple one-character shorthands are all combined, and the
-combination does not unambiguously match any other option or shorthand,
-then they will be broken up into their constituent parts.  For example:
-
-```json
-{ "s" : ["--loglevel", "silent"]
-, "g" : "--global"
-, "f" : "--force"
-, "p" : "--parseable"
-, "l" : "--long"
-}
-```
-
-```bash
-npm ls -sgflp
-# just like doing this:
-npm ls --loglevel silent --global --force --long --parseable
-```
-
-## The Rest of the args
-
-The config object returned by nopt is given a special member called
-`argv`, which is an object with the following fields:
-
-* `remain`: The remaining args after all the parsing has occurred.
-* `original`: The args as they originally appeared.
-* `cooked`: The args after flags and shorthands are expanded.
-
-## Slicing
-
-Node programs are called with more or less the exact argv as it appears
-in C land, after the v8 and node-specific options have been plucked off.
-As such, `argv[0]` is always `node` and `argv[1]` is always the
-JavaScript program being run.
-
-That's usually not very useful to you.  So they're sliced off by
-default.  If you want them, then you can pass in `0` as the last
-argument, or any other number that you'd like to slice off the start of
-the list.
diff --git a/legacy-libs/grpc/node_modules/nopt/bin/nopt.js b/legacy-libs/grpc/node_modules/nopt/bin/nopt.js
deleted file mode 100644 (file)
index 3232d4c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env node
-var nopt = require("../lib/nopt")
-  , path = require("path")
-  , types = { num: Number
-            , bool: Boolean
-            , help: Boolean
-            , list: Array
-            , "num-list": [Number, Array]
-            , "str-list": [String, Array]
-            , "bool-list": [Boolean, Array]
-            , str: String
-            , clear: Boolean
-            , config: Boolean
-            , length: Number
-            , file: path
-            }
-  , shorthands = { s: [ "--str", "astring" ]
-                 , b: [ "--bool" ]
-                 , nb: [ "--no-bool" ]
-                 , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
-                 , "?": ["--help"]
-                 , h: ["--help"]
-                 , H: ["--help"]
-                 , n: [ "--num", "125" ]
-                 , c: ["--config"]
-                 , l: ["--length"]
-                 , f: ["--file"]
-                 }
-  , parsed = nopt( types
-                 , shorthands
-                 , process.argv
-                 , 2 )
-
-console.log("parsed", parsed)
-
-if (parsed.help) {
-  console.log("")
-  console.log("nopt cli tester")
-  console.log("")
-  console.log("types")
-  console.log(Object.keys(types).map(function M (t) {
-    var type = types[t]
-    if (Array.isArray(type)) {
-      return [t, type.map(function (type) { return type.name })]
-    }
-    return [t, type && type.name]
-  }).reduce(function (s, i) {
-    s[i[0]] = i[1]
-    return s
-  }, {}))
-  console.log("")
-  console.log("shorthands")
-  console.log(shorthands)
-}
diff --git a/legacy-libs/grpc/node_modules/nopt/examples/my-program.js b/legacy-libs/grpc/node_modules/nopt/examples/my-program.js
deleted file mode 100644 (file)
index 142447e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env node
-
-//process.env.DEBUG_NOPT = 1
-
-// my-program.js
-var nopt = require("../lib/nopt")
-  , Stream = require("stream").Stream
-  , path = require("path")
-  , knownOpts = { "foo" : [String, null]
-                , "bar" : [Stream, Number]
-                , "baz" : path
-                , "bloo" : [ "big", "medium", "small" ]
-                , "flag" : Boolean
-                , "pick" : Boolean
-                }
-  , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
-                 , "b7" : ["--bar", "7"]
-                 , "m" : ["--bloo", "medium"]
-                 , "p" : ["--pick"]
-                 , "f" : ["--flag", "true"]
-                 , "g" : ["--flag"]
-                 , "s" : "--flag"
-                 }
-             // everything is optional.
-             // knownOpts and shorthands default to {}
-             // arg list defaults to process.argv
-             // slice defaults to 2
-  , parsed = nopt(knownOpts, shortHands, process.argv, 2)
-
-console.log("parsed =\n"+ require("util").inspect(parsed))
diff --git a/legacy-libs/grpc/node_modules/nopt/lib/nopt.js b/legacy-libs/grpc/node_modules/nopt/lib/nopt.js
deleted file mode 100644 (file)
index 1fb1135..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-// info about each config option.
-
-var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
-  ? function () { console.error.apply(console, arguments) }
-  : function () {}
-
-var url = require("url")
-  , path = require("path")
-  , Stream = require("stream").Stream
-  , abbrev = require("abbrev")
-  , osenv = require("osenv")
-
-module.exports = exports = nopt
-exports.clean = clean
-
-exports.typeDefs =
-  { String  : { type: String,  validate: validateString  }
-  , Boolean : { type: Boolean, validate: validateBoolean }
-  , url     : { type: url,     validate: validateUrl     }
-  , Number  : { type: Number,  validate: validateNumber  }
-  , path    : { type: path,    validate: validatePath    }
-  , Stream  : { type: Stream,  validate: validateStream  }
-  , Date    : { type: Date,    validate: validateDate    }
-  }
-
-function nopt (types, shorthands, args, slice) {
-  args = args || process.argv
-  types = types || {}
-  shorthands = shorthands || {}
-  if (typeof slice !== "number") slice = 2
-
-  debug(types, shorthands, args, slice)
-
-  args = args.slice(slice)
-  var data = {}
-    , key
-    , argv = {
-        remain: [],
-        cooked: args,
-        original: args.slice(0)
-      }
-
-  parse(args, data, argv.remain, types, shorthands)
-  // now data is full
-  clean(data, types, exports.typeDefs)
-  data.argv = argv
-  Object.defineProperty(data.argv, 'toString', { value: function () {
-    return this.original.map(JSON.stringify).join(" ")
-  }, enumerable: false })
-  return data
-}
-
-function clean (data, types, typeDefs) {
-  typeDefs = typeDefs || exports.typeDefs
-  var remove = {}
-    , typeDefault = [false, true, null, String, Array]
-
-  Object.keys(data).forEach(function (k) {
-    if (k === "argv") return
-    var val = data[k]
-      , isArray = Array.isArray(val)
-      , type = types[k]
-    if (!isArray) val = [val]
-    if (!type) type = typeDefault
-    if (type === Array) type = typeDefault.concat(Array)
-    if (!Array.isArray(type)) type = [type]
-
-    debug("val=%j", val)
-    debug("types=", type)
-    val = val.map(function (val) {
-      // if it's an unknown value, then parse false/true/null/numbers/dates
-      if (typeof val === "string") {
-        debug("string %j", val)
-        val = val.trim()
-        if ((val === "null" && ~type.indexOf(null))
-            || (val === "true" &&
-               (~type.indexOf(true) || ~type.indexOf(Boolean)))
-            || (val === "false" &&
-               (~type.indexOf(false) || ~type.indexOf(Boolean)))) {
-          val = JSON.parse(val)
-          debug("jsonable %j", val)
-        } else if (~type.indexOf(Number) && !isNaN(val)) {
-          debug("convert to number", val)
-          val = +val
-        } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) {
-          debug("convert to date", val)
-          val = new Date(val)
-        }
-      }
-
-      if (!types.hasOwnProperty(k)) {
-        return val
-      }
-
-      // allow `--no-blah` to set 'blah' to null if null is allowed
-      if (val === false && ~type.indexOf(null) &&
-          !(~type.indexOf(false) || ~type.indexOf(Boolean))) {
-        val = null
-      }
-
-      var d = {}
-      d[k] = val
-      debug("prevalidated val", d, val, types[k])
-      if (!validate(d, k, val, types[k], typeDefs)) {
-        if (exports.invalidHandler) {
-          exports.invalidHandler(k, val, types[k], data)
-        } else if (exports.invalidHandler !== false) {
-          debug("invalid: "+k+"="+val, types[k])
-        }
-        return remove
-      }
-      debug("validated val", d, val, types[k])
-      return d[k]
-    }).filter(function (val) { return val !== remove })
-
-    if (!val.length) delete data[k]
-    else if (isArray) {
-      debug(isArray, data[k], val)
-      data[k] = val
-    } else data[k] = val[0]
-
-    debug("k=%s val=%j", k, val, data[k])
-  })
-}
-
-function validateString (data, k, val) {
-  data[k] = String(val)
-}
-
-function validatePath (data, k, val) {
-  if (val === true) return false
-  if (val === null) return true
-
-  val = String(val)
-
-  var isWin       = process.platform === 'win32'
-    , homePattern = isWin ? /^~(\/|\\)/ : /^~\//
-    , home        = osenv.home()
-
-  if (home && val.match(homePattern)) {
-    data[k] = path.resolve(home, val.substr(2))
-  } else {
-    data[k] = path.resolve(val)
-  }
-  return true
-}
-
-function validateNumber (data, k, val) {
-  debug("validate Number %j %j %j", k, val, isNaN(val))
-  if (isNaN(val)) return false
-  data[k] = +val
-}
-
-function validateDate (data, k, val) {
-  var s = Date.parse(val)
-  debug("validate Date %j %j %j", k, val, s)
-  if (isNaN(s)) return false
-  data[k] = new Date(val)
-}
-
-function validateBoolean (data, k, val) {
-  if (val instanceof Boolean) val = val.valueOf()
-  else if (typeof val === "string") {
-    if (!isNaN(val)) val = !!(+val)
-    else if (val === "null" || val === "false") val = false
-    else val = true
-  } else val = !!val
-  data[k] = val
-}
-
-function validateUrl (data, k, val) {
-  val = url.parse(String(val))
-  if (!val.host) return false
-  data[k] = val.href
-}
-
-function validateStream (data, k, val) {
-  if (!(val instanceof Stream)) return false
-  data[k] = val
-}
-
-function validate (data, k, val, type, typeDefs) {
-  // arrays are lists of types.
-  if (Array.isArray(type)) {
-    for (var i = 0, l = type.length; i < l; i ++) {
-      if (type[i] === Array) continue
-      if (validate(data, k, val, type[i], typeDefs)) return true
-    }
-    delete data[k]
-    return false
-  }
-
-  // an array of anything?
-  if (type === Array) return true
-
-  // NaN is poisonous.  Means that something is not allowed.
-  if (type !== type) {
-    debug("Poison NaN", k, val, type)
-    delete data[k]
-    return false
-  }
-
-  // explicit list of values
-  if (val === type) {
-    debug("Explicitly allowed %j", val)
-    // if (isArray) (data[k] = data[k] || []).push(val)
-    // else data[k] = val
-    data[k] = val
-    return true
-  }
-
-  // now go through the list of typeDefs, validate against each one.
-  var ok = false
-    , types = Object.keys(typeDefs)
-  for (var i = 0, l = types.length; i < l; i ++) {
-    debug("test type %j %j %j", k, val, types[i])
-    var t = typeDefs[types[i]]
-    if (t &&
-      ((type && type.name && t.type && t.type.name) ? (type.name === t.type.name) : (type === t.type))) {
-      var d = {}
-      ok = false !== t.validate(d, k, val)
-      val = d[k]
-      if (ok) {
-        // if (isArray) (data[k] = data[k] || []).push(val)
-        // else data[k] = val
-        data[k] = val
-        break
-      }
-    }
-  }
-  debug("OK? %j (%j %j %j)", ok, k, val, types[i])
-
-  if (!ok) delete data[k]
-  return ok
-}
-
-function parse (args, data, remain, types, shorthands) {
-  debug("parse", args, data, remain)
-
-  var key = null
-    , abbrevs = abbrev(Object.keys(types))
-    , shortAbbr = abbrev(Object.keys(shorthands))
-
-  for (var i = 0; i < args.length; i ++) {
-    var arg = args[i]
-    debug("arg", arg)
-
-    if (arg.match(/^-{2,}$/)) {
-      // done with keys.
-      // the rest are args.
-      remain.push.apply(remain, args.slice(i + 1))
-      args[i] = "--"
-      break
-    }
-    var hadEq = false
-    if (arg.charAt(0) === "-" && arg.length > 1) {
-      var at = arg.indexOf('=')
-      if (at > -1) {
-        hadEq = true
-        var v = arg.substr(at + 1)
-        arg = arg.substr(0, at)
-        args.splice(i, 1, arg, v)
-      }
-
-      // see if it's a shorthand
-      // if so, splice and back up to re-parse it.
-      var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
-      debug("arg=%j shRes=%j", arg, shRes)
-      if (shRes) {
-        debug(arg, shRes)
-        args.splice.apply(args, [i, 1].concat(shRes))
-        if (arg !== shRes[0]) {
-          i --
-          continue
-        }
-      }
-      arg = arg.replace(/^-+/, "")
-      var no = null
-      while (arg.toLowerCase().indexOf("no-") === 0) {
-        no = !no
-        arg = arg.substr(3)
-      }
-
-      if (abbrevs[arg]) arg = abbrevs[arg]
-
-      var argType = types[arg]
-      var isTypeArray = Array.isArray(argType)
-      if (isTypeArray && argType.length === 1) {
-        isTypeArray = false
-        argType = argType[0]
-      }
-
-      var isArray = argType === Array ||
-        isTypeArray && argType.indexOf(Array) !== -1
-
-      // allow unknown things to be arrays if specified multiple times.
-      if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) {
-        if (!Array.isArray(data[arg]))
-          data[arg] = [data[arg]]
-        isArray = true
-      }
-
-      var val
-        , la = args[i + 1]
-
-      var isBool = typeof no === 'boolean' ||
-        argType === Boolean ||
-        isTypeArray && argType.indexOf(Boolean) !== -1 ||
-        (typeof argType === 'undefined' && !hadEq) ||
-        (la === "false" &&
-         (argType === null ||
-          isTypeArray && ~argType.indexOf(null)))
-
-      if (isBool) {
-        // just set and move along
-        val = !no
-        // however, also support --bool true or --bool false
-        if (la === "true" || la === "false") {
-          val = JSON.parse(la)
-          la = null
-          if (no) val = !val
-          i ++
-        }
-
-        // also support "foo":[Boolean, "bar"] and "--foo bar"
-        if (isTypeArray && la) {
-          if (~argType.indexOf(la)) {
-            // an explicit type
-            val = la
-            i ++
-          } else if ( la === "null" && ~argType.indexOf(null) ) {
-            // null allowed
-            val = null
-            i ++
-          } else if ( !la.match(/^-{2,}[^-]/) &&
-                      !isNaN(la) &&
-                      ~argType.indexOf(Number) ) {
-            // number
-            val = +la
-            i ++
-          } else if ( !la.match(/^-[^-]/) && ~argType.indexOf(String) ) {
-            // string
-            val = la
-            i ++
-          }
-        }
-
-        if (isArray) (data[arg] = data[arg] || []).push(val)
-        else data[arg] = val
-
-        continue
-      }
-
-      if (argType === String) {
-        if (la === undefined) {
-          la = ""
-        } else if (la.match(/^-{1,2}[^-]+/)) {
-          la = ""
-          i --
-        }
-      }
-
-      if (la && la.match(/^-{2,}$/)) {
-        la = undefined
-        i --
-      }
-
-      val = la === undefined ? true : la
-      if (isArray) (data[arg] = data[arg] || []).push(val)
-      else data[arg] = val
-
-      i ++
-      continue
-    }
-    remain.push(arg)
-  }
-}
-
-function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
-  // handle single-char shorthands glommed together, like
-  // npm ls -glp, but only if there is one dash, and only if
-  // all of the chars are single-char shorthands, and it's
-  // not a match to some other abbrev.
-  arg = arg.replace(/^-+/, '')
-
-  // if it's an exact known option, then don't go any further
-  if (abbrevs[arg] === arg)
-    return null
-
-  // if it's an exact known shortopt, same deal
-  if (shorthands[arg]) {
-    // make it an array, if it's a list of words
-    if (shorthands[arg] && !Array.isArray(shorthands[arg]))
-      shorthands[arg] = shorthands[arg].split(/\s+/)
-
-    return shorthands[arg]
-  }
-
-  // first check to see if this arg is a set of single-char shorthands
-  var singles = shorthands.___singles
-  if (!singles) {
-    singles = Object.keys(shorthands).filter(function (s) {
-      return s.length === 1
-    }).reduce(function (l,r) {
-      l[r] = true
-      return l
-    }, {})
-    shorthands.___singles = singles
-    debug('shorthand singles', singles)
-  }
-
-  var chrs = arg.split("").filter(function (c) {
-    return singles[c]
-  })
-
-  if (chrs.join("") === arg) return chrs.map(function (c) {
-    return shorthands[c]
-  }).reduce(function (l, r) {
-    return l.concat(r)
-  }, [])
-
-
-  // if it's an arg abbrev, and not a literal shorthand, then prefer the arg
-  if (abbrevs[arg] && !shorthands[arg])
-    return null
-
-  // if it's an abbr for a shorthand, then use that
-  if (shortAbbr[arg])
-    arg = shortAbbr[arg]
-
-  // make it an array, if it's a list of words
-  if (shorthands[arg] && !Array.isArray(shorthands[arg]))
-    shorthands[arg] = shorthands[arg].split(/\s+/)
-
-  return shorthands[arg]
-}
diff --git a/legacy-libs/grpc/node_modules/nopt/package.json b/legacy-libs/grpc/node_modules/nopt/package.json
deleted file mode 100644 (file)
index 2f94136..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "_args": [
-    [
-      "nopt@4.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "nopt@4.0.1",
-  "_id": "nopt@4.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
-  "_location": "/grpc/nopt",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "nopt@4.0.1",
-    "name": "nopt",
-    "escapedName": "nopt",
-    "rawSpec": "4.0.1",
-    "saveSpec": null,
-    "fetchSpec": "4.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "4.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bin": {
-    "nopt": "./bin/nopt.js"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/nopt/issues"
-  },
-  "dependencies": {
-    "abbrev": "1",
-    "osenv": "^0.1.4"
-  },
-  "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
-  "devDependencies": {
-    "tap": "^8.0.1"
-  },
-  "homepage": "https://github.com/npm/nopt#readme",
-  "license": "ISC",
-  "main": "lib/nopt.js",
-  "name": "nopt",
-  "optionalDependencies": {},
-  "readme": "If you want to write an option parser, and have it be good, there are\ntwo ways to do it.  The Right Way, and the Wrong Way.\n\nThe Wrong Way is to sit down and write an option parser.  We've all done\nthat.\n\nThe Right Way is to write some complex configurable program with so many\noptions that you hit the limit of your frustration just trying to\nmanage them all, and defer it with duct-tape solutions until you see\nexactly to the core of the problem, and finally snap and write an\nawesome option parser.\n\nIf you want to write an option parser, don't write an option parser.\nWrite a package manager, or a source control system, or a service\nrestarter, or an operating system.  You probably won't end up with a\ngood one of those, but if you don't give up, and you are relentless and\ndiligent enough in your procrastination, you may just end up with a very\nnice option parser.\n\n## USAGE\n\n```javascript\n// my-program.js\nvar nopt = require(\"nopt\")\n  , Stream = require(\"stream\").Stream\n  , path = require(\"path\")\n  , knownOpts = { \"foo\" : [String, null]\n                , \"bar\" : [Stream, Number]\n                , \"baz\" : path\n                , \"bloo\" : [ \"big\", \"medium\", \"small\" ]\n                , \"flag\" : Boolean\n                , \"pick\" : Boolean\n                , \"many1\" : [String, Array]\n                , \"many2\" : [path, Array]\n                }\n  , shortHands = { \"foofoo\" : [\"--foo\", \"Mr. Foo\"]\n                 , \"b7\" : [\"--bar\", \"7\"]\n                 , \"m\" : [\"--bloo\", \"medium\"]\n                 , \"p\" : [\"--pick\"]\n                 , \"f\" : [\"--flag\"]\n                 }\n             // everything is optional.\n             // knownOpts and shorthands default to {}\n             // arg list defaults to process.argv\n             // slice defaults to 2\n  , parsed = nopt(knownOpts, shortHands, process.argv, 2)\nconsole.log(parsed)\n```\n\nThis would give you support for any of the following:\n\n```console\n$ node my-program.js --foo \"blerp\" --no-flag\n{ \"foo\" : \"blerp\", \"flag\" : false }\n\n$ node my-program.js ---bar 7 --foo \"Mr. Hand\" --flag\n{ bar: 7, foo: \"Mr. Hand\", flag: true }\n\n$ node my-program.js --foo \"blerp\" -f -----p\n{ foo: \"blerp\", flag: true, pick: true }\n\n$ node my-program.js -fp --foofoo\n{ foo: \"Mr. Foo\", flag: true, pick: true }\n\n$ node my-program.js --foofoo -- -fp  # -- stops the flag parsing.\n{ foo: \"Mr. Foo\", argv: { remain: [\"-fp\"] } }\n\n$ node my-program.js --blatzk -fp # unknown opts are ok.\n{ blatzk: true, flag: true, pick: true }\n\n$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value\n{ blatzk: 1000, flag: true, pick: true }\n\n$ node my-program.js --no-blatzk -fp # unless they start with \"no-\"\n{ blatzk: false, flag: true, pick: true }\n\n$ node my-program.js --baz b/a/z # known paths are resolved.\n{ baz: \"/Users/isaacs/b/a/z\" }\n\n# if Array is one of the types, then it can take many\n# values, and will always be an array.  The other types provided\n# specify what types are allowed in the list.\n\n$ node my-program.js --many1 5 --many1 null --many1 foo\n{ many1: [\"5\", \"null\", \"foo\"] }\n\n$ node my-program.js --many2 foo --many2 bar\n{ many2: [\"/path/to/foo\", \"path/to/bar\"] }\n```\n\nRead the tests at the bottom of `lib/nopt.js` for more examples of\nwhat this puppy can do.\n\n## Types\n\nThe following types are supported, and defined on `nopt.typeDefs`\n\n* String: A normal string.  No parsing is done.\n* path: A file system path.  Gets resolved against cwd if not absolute.\n* url: A url.  If it doesn't parse, it isn't accepted.\n* Number: Must be numeric.\n* Date: Must parse as a date. If it does, and `Date` is one of the options,\n  then it will return a Date object, not a string.\n* Boolean: Must be either `true` or `false`.  If an option is a boolean,\n  then it does not need a value, and its presence will imply `true` as\n  the value.  To negate boolean flags, do `--no-whatever` or `--whatever\n  false`\n* NaN: Means that the option is strictly not allowed.  Any value will\n  fail.\n* Stream: An object matching the \"Stream\" class in node.  Valuable\n  for use when validating programmatically.  (npm uses this to let you\n  supply any WriteStream on the `outfd` and `logfd` config options.)\n* Array: If `Array` is specified as one of the types, then the value\n  will be parsed as a list of options.  This means that multiple values\n  can be specified, and that the value will always be an array.\n\nIf a type is an array of values not on this list, then those are\nconsidered valid values.  For instance, in the example above, the\n`--bloo` option can only be one of `\"big\"`, `\"medium\"`, or `\"small\"`,\nand any other value will be rejected.\n\nWhen parsing unknown fields, `\"true\"`, `\"false\"`, and `\"null\"` will be\ninterpreted as their JavaScript equivalents.\n\nYou can also mix types and values, or multiple types, in a list.  For\ninstance `{ blah: [Number, null] }` would allow a value to be set to\neither a Number or null.  When types are ordered, this implies a\npreference, and the first type that can be used to properly interpret\nthe value will be used.\n\nTo define a new type, add it to `nopt.typeDefs`.  Each item in that\nhash is an object with a `type` member and a `validate` method.  The\n`type` member is an object that matches what goes in the type list.  The\n`validate` method is a function that gets called with `validate(data,\nkey, val)`.  Validate methods should assign `data[key]` to the valid\nvalue of `val` if it can be handled properly, or return boolean\n`false` if it cannot.\n\nYou can also call `nopt.clean(data, types, typeDefs)` to clean up a\nconfig object and remove its invalid properties.\n\n## Error Handling\n\nBy default, nopt outputs a warning to standard error when invalid values for\nknown options are found.  You can change this behavior by assigning a method\nto `nopt.invalidHandler`.  This method will be called with\nthe offending `nopt.invalidHandler(key, val, types)`.\n\nIf no `nopt.invalidHandler` is assigned, then it will console.error\nits whining.  If it is assigned to boolean `false` then the warning is\nsuppressed.\n\n## Abbreviations\n\nYes, they are supported.  If you define options like this:\n\n```javascript\n{ \"foolhardyelephants\" : Boolean\n, \"pileofmonkeys\" : Boolean }\n```\n\nThen this will work:\n\n```bash\nnode program.js --foolhar --pil\nnode program.js --no-f --pileofmon\n# etc.\n```\n\n## Shorthands\n\nShorthands are a hash of shorter option names to a snippet of args that\nthey expand to.\n\nIf multiple one-character shorthands are all combined, and the\ncombination does not unambiguously match any other option or shorthand,\nthen they will be broken up into their constituent parts.  For example:\n\n```json\n{ \"s\" : [\"--loglevel\", \"silent\"]\n, \"g\" : \"--global\"\n, \"f\" : \"--force\"\n, \"p\" : \"--parseable\"\n, \"l\" : \"--long\"\n}\n```\n\n```bash\nnpm ls -sgflp\n# just like doing this:\nnpm ls --loglevel silent --global --force --long --parseable\n```\n\n## The Rest of the args\n\nThe config object returned by nopt is given a special member called\n`argv`, which is an object with the following fields:\n\n* `remain`: The remaining args after all the parsing has occurred.\n* `original`: The args as they originally appeared.\n* `cooked`: The args after flags and shorthands are expanded.\n\n## Slicing\n\nNode programs are called with more or less the exact argv as it appears\nin C land, after the v8 and node-specific options have been plucked off.\nAs such, `argv[0]` is always `node` and `argv[1]` is always the\nJavaScript program being run.\n\nThat's usually not very useful to you.  So they're sliced off by\ndefault.  If you want them, then you can pass in `0` as the last\nargument, or any other number that you'd like to slice off the start of\nthe list.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/nopt.git"
-  },
-  "scripts": {
-    "test": "tap test/*.js"
-  },
-  "version": "4.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/nopt/test/basic.js b/legacy-libs/grpc/node_modules/nopt/test/basic.js
deleted file mode 100644 (file)
index 5c18ac0..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-var nopt = require("../")
-  , test = require('tap').test
-  , isWin = process.platform === 'win32'
-
-test("passing a string results in a string", function (t) {
-  var parsed = nopt({ key: String }, {}, ["--key", "myvalue"], 0)
-  t.same(parsed.key, "myvalue")
-  t.end()
-})
-
-// https://github.com/npm/nopt/issues/31
-test("Empty String results in empty string, not true", function (t) {
-  var parsed = nopt({ empty: String }, {}, ["--empty"], 0)
-  t.same(parsed.empty, "")
-  t.end()
-})
-
-// https://github.com/npm/nopt/issues/65
-test("Empty String should not swallow next flag", function (t) {
-  var parsed = nopt({ empty: String, foo: String }, {}, ["--empty", "--foo"], 0)
-  t.same(parsed.empty, "")
-  t.same(parsed.foo, "")
-  t.end()
-})
-
-// https://github.com/npm/nopt/issues/66
-test("Empty String should not be true when type is single item Array", function (t) {
-  var parsed = nopt({  'foo': [String] }, {}, ["--foo"], 0)
-  t.same(parsed.foo, "")
-  t.end()
-})
-
-test("~ path is resolved to " + (isWin ? '%USERPROFILE%' : '$HOME'), function (t) {
-  var path = require("path")
-    , the
-
-  if (isWin) {
-    the = {
-      key: 'USERPROFILE',
-      dir: 'C:\\temp',
-      val: '~\\val'
-    }
-  } else {
-    the = {
-      key: 'HOME',
-      dir: '/tmp',
-      val: '~/val'
-    }
-  }
-  if (!process.env[the.key]) process.env[the.key] = v.dir
-  var parsed = nopt({key: path}, {}, ["--key=" + the.val], 0)
-  t.same(parsed.key, path.resolve(process.env[the.key], "val"))
-  t.end()
-})
-
-// https://github.com/npm/nopt/issues/24
-test("Unknown options are not parsed as numbers", function (t) {
-    var parsed = nopt({"parse-me": Number}, null, ['--leave-as-is=1.20', '--parse-me=1.20'], 0)
-    t.equal(parsed['leave-as-is'], '1.20')
-    t.equal(parsed['parse-me'], 1.2)
-    t.end()
-});
-
-// https://github.com/npm/nopt/issues/48
-test("Check types based on name of type", function (t) {
-  var parsed = nopt({"parse-me": {name: "Number"}}, null, ['--parse-me=1.20'], 0)
-  t.equal(parsed['parse-me'], 1.2)
-  t.end()
-})
-
-
-test("Missing types are not parsed", function (t) {
-  var parsed = nopt({"parse-me": {}}, null, ['--parse-me=1.20'], 0)
-  //should only contain argv
-  t.equal(Object.keys(parsed).length, 1)
-  t.end()
-})
-
-test("Types passed without a name are not parsed", function (t) {
-  var parsed = nopt({"parse-me": {}}, {}, ['--parse-me=1.20'], 0)
-  //should only contain argv
-  t.equal(Object.keys(parsed).length, 1)
-  t.end()
-})
-
-test("other tests", function (t) {
-
-  var util = require("util")
-    , Stream = require("stream")
-    , path = require("path")
-    , url = require("url")
-
-    , shorthands =
-      { s : ["--loglevel", "silent"]
-      , d : ["--loglevel", "info"]
-      , dd : ["--loglevel", "verbose"]
-      , ddd : ["--loglevel", "silly"]
-      , noreg : ["--no-registry"]
-      , reg : ["--registry"]
-      , "no-reg" : ["--no-registry"]
-      , silent : ["--loglevel", "silent"]
-      , verbose : ["--loglevel", "verbose"]
-      , h : ["--usage"]
-      , H : ["--usage"]
-      , "?" : ["--usage"]
-      , help : ["--usage"]
-      , v : ["--version"]
-      , f : ["--force"]
-      , desc : ["--description"]
-      , "no-desc" : ["--no-description"]
-      , "local" : ["--no-global"]
-      , l : ["--long"]
-      , p : ["--parseable"]
-      , porcelain : ["--parseable"]
-      , g : ["--global"]
-      }
-
-    , types =
-      { aoa: Array
-      , nullstream: [null, Stream]
-      , date: Date
-      , str: String
-      , browser : String
-      , cache : path
-      , color : ["always", Boolean]
-      , depth : Number
-      , description : Boolean
-      , dev : Boolean
-      , editor : path
-      , force : Boolean
-      , global : Boolean
-      , globalconfig : path
-      , group : [String, Number]
-      , gzipbin : String
-      , logfd : [Number, Stream]
-      , loglevel : ["silent","win","error","warn","info","verbose","silly"]
-      , long : Boolean
-      , "node-version" : [false, String]
-      , npaturl : url
-      , npat : Boolean
-      , "onload-script" : [false, String]
-      , outfd : [Number, Stream]
-      , parseable : Boolean
-      , pre: Boolean
-      , prefix: path
-      , proxy : url
-      , "rebuild-bundle" : Boolean
-      , registry : url
-      , searchopts : String
-      , searchexclude: [null, String]
-      , shell : path
-      , t: [Array, String]
-      , tag : String
-      , tar : String
-      , tmp : path
-      , "unsafe-perm" : Boolean
-      , usage : Boolean
-      , user : String
-      , username : String
-      , userconfig : path
-      , version : Boolean
-      , viewer: path
-      , _exit : Boolean
-      , path: path
-      }
-
-  ; [["-v", {version:true}, []]
-    ,["---v", {version:true}, []]
-    ,["ls -s --no-reg connect -d",
-      {loglevel:"info",registry:null},["ls","connect"]]
-    ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
-    ,["ls --registry blargle", {}, ["ls"]]
-    ,["--no-registry", {registry:null}, []]
-    ,["--no-color true", {color:false}, []]
-    ,["--no-color false", {color:true}, []]
-    ,["--no-color", {color:false}, []]
-    ,["--color false", {color:false}, []]
-    ,["--color --logfd 7", {logfd:7,color:true}, []]
-    ,["--color=true", {color:true}, []]
-    ,["--logfd=10", {logfd:10}, []]
-    ,["--tmp=/tmp -tar=gtar", {tmp: isWin ? "C:\\tmp" : "/tmp",tar:"gtar"},[]]
-    ,["--tmp=tmp -tar=gtar",
-      {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
-    ,["--logfd x", {}, []]
-    ,["a -true -- -no-false", {true:true},["a","-no-false"]]
-    ,["a -no-false", {false:false},["a"]]
-    ,["a -no-no-true", {true:true}, ["a"]]
-    ,["a -no-no-no-false", {false:false}, ["a"]]
-    ,["---NO-no-No-no-no-no-nO-no-no"+
-      "-No-no-no-no-no-no-no-no-no"+
-      "-no-no-no-no-NO-NO-no-no-no-no-no-no"+
-      "-no-body-can-do-the-boogaloo-like-I-do"
-     ,{"body-can-do-the-boogaloo-like-I-do":false}, []]
-    ,["we are -no-strangers-to-love "+
-      "--you-know=the-rules --and=so-do-i "+
-      "---im-thinking-of=a-full-commitment "+
-      "--no-you-would-get-this-from-any-other-guy "+
-      "--no-gonna-give-you-up "+
-      "-no-gonna-let-you-down=true "+
-      "--no-no-gonna-run-around false "+
-      "--desert-you=false "+
-      "--make-you-cry false "+
-      "--no-tell-a-lie "+
-      "--no-no-and-hurt-you false"
-     ,{"strangers-to-love":false
-      ,"you-know":"the-rules"
-      ,"and":"so-do-i"
-      ,"you-would-get-this-from-any-other-guy":false
-      ,"gonna-give-you-up":false
-      ,"gonna-let-you-down":false
-      ,"gonna-run-around":false
-      ,"desert-you":false
-      ,"make-you-cry":false
-      ,"tell-a-lie":false
-      ,"and-hurt-you":false
-      },["we", "are"]]
-    ,["-t one -t two -t three"
-     ,{t: ["one", "two", "three"]}
-     ,[]]
-    ,["-t one -t null -t three four five null"
-     ,{t: ["one", "null", "three"]}
-     ,["four", "five", "null"]]
-    ,["-t foo"
-     ,{t:["foo"]}
-     ,[]]
-    ,["--no-t"
-     ,{t:["false"]}
-     ,[]]
-    ,["-no-no-t"
-     ,{t:["true"]}
-     ,[]]
-    ,["-aoa one -aoa null -aoa 100"
-     ,{aoa:["one", null, '100']}
-     ,[]]
-    ,["-str 100"
-     ,{str:"100"}
-     ,[]]
-    ,["--color always"
-     ,{color:"always"}
-     ,[]]
-    ,["--no-nullstream"
-     ,{nullstream:null}
-     ,[]]
-    ,["--nullstream false"
-     ,{nullstream:null}
-     ,[]]
-    ,["--notadate=2011-01-25"
-     ,{notadate: "2011-01-25"}
-     ,[]]
-    ,["--date 2011-01-25"
-     ,{date: new Date("2011-01-25")}
-     ,[]]
-    ,["-cl 1"
-     ,{config: true, length: 1}
-     ,[]
-     ,{config: Boolean, length: Number, clear: Boolean}
-     ,{c: "--config", l: "--length"}]
-    ,["--acount bla"
-     ,{"acount":true}
-     ,["bla"]
-     ,{account: Boolean, credentials: Boolean, options: String}
-     ,{a:"--account", c:"--credentials",o:"--options"}]
-    ,["--clear"
-     ,{clear:true}
-     ,[]
-     ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean}
-     ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}]
-    ,["--file -"
-     ,{"file":"-"}
-     ,[]
-     ,{file:String}
-     ,{}]
-    ,["--file -"
-     ,{"file":true}
-     ,["-"]
-     ,{file:Boolean}
-     ,{}]
-    ,["--path"
-     ,{"path":null}
-     ,[]]
-    ,["--path ."
-     ,{"path":process.cwd()}
-     ,[]]
-    ].forEach(function (test) {
-      var argv = test[0].split(/\s+/)
-        , opts = test[1]
-        , rem = test[2]
-        , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0)
-        , parsed = actual.argv
-      delete actual.argv
-      for (var i in opts) {
-        var e = JSON.stringify(opts[i])
-          , a = JSON.stringify(actual[i] === undefined ? null : actual[i])
-        if (e && typeof e === "object") {
-          t.deepEqual(e, a)
-        } else {
-          t.equal(e, a)
-        }
-      }
-      t.deepEqual(rem, parsed.remain)
-    })
-  t.end()
-})
diff --git a/legacy-libs/grpc/node_modules/npm-bundled/LICENSE b/legacy-libs/grpc/node_modules/npm-bundled/LICENSE
deleted file mode 100644 (file)
index 20a4762..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) npm, Inc. and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/npm-bundled/README.md b/legacy-libs/grpc/node_modules/npm-bundled/README.md
deleted file mode 100644 (file)
index fcfb232..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# npm-bundled
-
-Run this in a node package, and it'll tell you which things in
-node_modules are bundledDependencies, or transitive dependencies of
-bundled dependencies.
-
-[![Build Status](https://travis-ci.org/npm/npm-bundled.svg?branch=master)](https://travis-ci.org/npm/npm-bundled)
-
-## USAGE
-
-To get the list of deps at the top level that are bundled (or
-transitive deps of a bundled dep) run this:
-
-```js
-const bundled = require('npm-bundled')
-
-// async version
-bundled({ path: '/path/to/pkg/defaults/to/cwd'}, (er, list) => {
-  // er means it had an error, which is _hella_ weird
-  // list is a list of package names, like `fooblz` or `@corp/blerg`
-  // the might not all be deps of the top level, because transitives
-})
-
-// async promise version
-bundled({ path: '/path/to/pkg/defaults/to/cwd'}).then(list => {
-  // so promisey!
-  // actually the callback version returns a promise, too, it just
-  // attaches the supplied callback to the promise
-})
-
-// sync version, throws if there's an error
-const list = bundled({ path: '/path/to/pkg/defaults/to/cwd'})
-```
-
-That's basically all you need to know.  If you care to dig into it,
-you can also use the `bundled.Walker` and `bundled.WalkerSync`
-classes to get fancy.
-
-This library does not write anything to the filesystem, but it _may_
-have undefined behavior if the structure of `node_modules` changes
-while it's reading deps.
-
-All symlinks are followed.  This means that it can lead to surprising
-results if a symlinked bundled dependency has a missing dependency
-that is satisfied at the top level.  Since package creation resolves
-symlinks as well, this is an edge case where package creation and
-development environment are not going to be aligned, and is best
-avoided.
diff --git a/legacy-libs/grpc/node_modules/npm-bundled/index.js b/legacy-libs/grpc/node_modules/npm-bundled/index.js
deleted file mode 100644 (file)
index bde0acd..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-'use strict'
-
-// walk the tree of deps starting from the top level list of bundled deps
-// Any deps at the top level that are depended on by a bundled dep that
-// does not have that dep in its own node_modules folder are considered
-// bundled deps as well.  This list of names can be passed to npm-packlist
-// as the "bundled" argument.  Additionally, packageJsonCache is shared so
-// packlist doesn't have to re-read files already consumed in this pass
-
-const fs = require('fs')
-const path = require('path')
-const EE = require('events').EventEmitter
-
-class BundleWalker extends EE {
-  constructor (opt) {
-    opt = opt || {}
-    super(opt)
-    this.path = path.resolve(opt.path || process.cwd())
-
-    this.parent = opt.parent || null
-    if (this.parent) {
-      this.result = this.parent.result
-      // only collect results in node_modules folders at the top level
-      // since the node_modules in a bundled dep is included always
-      if (!this.parent.parent) {
-        const base = path.basename(this.path)
-        const scope = path.basename(path.dirname(this.path))
-        this.result.add(/^@/.test(scope) ? scope + '/' + base : base)
-      }
-      this.root = this.parent.root
-      this.packageJsonCache = this.parent.packageJsonCache
-    } else {
-      this.result = new Set()
-      this.root = this.path
-      this.packageJsonCache = opt.packageJsonCache || new Map()
-    }
-
-    this.seen = new Set()
-    this.didDone = false
-    this.children = 0
-    this.node_modules = []
-    this.package = null
-    this.bundle = null
-  }
-
-  addListener (ev, fn) {
-    return this.on(ev, fn)
-  }
-
-  on (ev, fn) {
-    const ret = super.on(ev, fn)
-    if (ev === 'done' && this.didDone) {
-      this.emit('done', this.result)
-    }
-    return ret
-  }
-
-  done () {
-    if (!this.didDone) {
-      this.didDone = true
-      if (!this.parent) {
-        const res = Array.from(this.result)
-        this.result = res
-        this.emit('done', res)
-      } else {
-        this.emit('done')
-      }
-    }
-  }
-
-  start () {
-    const pj = path.resolve(this.path, 'package.json')
-    if (this.packageJsonCache.has(pj))
-      this.onPackage(this.packageJsonCache.get(pj))
-    else
-      this.readPackageJson(pj)
-    return this
-  }
-
-  readPackageJson (pj) {
-    fs.readFile(pj, (er, data) =>
-      er ? this.done() : this.onPackageJson(pj, data))
-  }
-
-  onPackageJson (pj, data) {
-    try {
-      this.package = JSON.parse(data + '')
-    } catch (er) {
-      return this.done()
-    }
-    this.packageJsonCache.set(pj, this.package)
-    this.onPackage(this.package)
-  }
-
-  onPackage (pkg) {
-    // all deps are bundled if we got here as a child.
-    // otherwise, only bundle bundledDeps
-    // Get a unique-ified array with a short-lived Set
-    const bdRaw = this.parent
-      ? Object.keys(pkg.dependencies || {}).concat(
-        Object.keys(pkg.optionalDependencies || {}))
-      : pkg.bundleDependencies || pkg.bundledDependencies || []
-
-    const bd = Array.from(new Set(
-      Array.isArray(bdRaw) ? bdRaw : Object.keys(bdRaw)))
-
-    if (!bd.length)
-      return this.done()
-
-    this.bundle = bd
-    const nm = this.path + '/node_modules'
-    this.readModules()
-  }
-
-  readModules () {
-    readdirNodeModules(this.path + '/node_modules', (er, nm) =>
-      er ? this.onReaddir([]) : this.onReaddir(nm))
-  }
-
-  onReaddir (nm) {
-    // keep track of what we have, in case children need it
-    this.node_modules = nm
-
-    this.bundle.forEach(dep => this.childDep(dep))
-    if (this.children === 0)
-      this.done()
-  }
-
-  childDep (dep) {
-    if (this.node_modules.indexOf(dep) !== -1 && !this.seen.has(dep)) {
-      this.seen.add(dep)
-      this.child(dep)
-    } else if (this.parent) {
-      this.parent.childDep(dep)
-    }
-  }
-
-  child (dep) {
-    const p = this.path + '/node_modules/' + dep
-    this.children += 1
-    const child = new BundleWalker({
-      path: p,
-      parent: this
-    })
-    child.on('done', _ => {
-      if (--this.children === 0)
-        this.done()
-    })
-    child.start()
-  }
-}
-
-class BundleWalkerSync extends BundleWalker {
-  constructor (opt) {
-    super(opt)
-  }
-
-  start () {
-    super.start()
-    this.done()
-    return this
-  }
-
-  readPackageJson (pj) {
-    try {
-      this.onPackageJson(pj, fs.readFileSync(pj))
-    } catch (er) {}
-    return this
-  }
-
-  readModules () {
-    try {
-      this.onReaddir(readdirNodeModulesSync(this.path + '/node_modules'))
-    } catch (er) {
-      this.onReaddir([])
-    }
-  }
-
-  child (dep) {
-    new BundleWalkerSync({
-      path: this.path + '/node_modules/' + dep,
-      parent: this
-    }).start()
-  }
-}
-
-const readdirNodeModules = (nm, cb) => {
-  fs.readdir(nm, (er, set) => {
-    if (er)
-      cb(er)
-    else {
-      const scopes = set.filter(f => /^@/.test(f))
-      if (!scopes.length)
-        cb(null, set)
-      else {
-        const unscoped = set.filter(f => !/^@/.test(f))
-        let count = scopes.length
-        scopes.forEach(scope => {
-          fs.readdir(nm + '/' + scope, (er, pkgs) => {
-            if (er || !pkgs.length)
-              unscoped.push(scope)
-            else
-              unscoped.push.apply(unscoped, pkgs.map(p => scope + '/' + p))
-            if (--count === 0)
-              cb(null, unscoped)
-          })
-        })
-      }
-    }
-  })
-}
-
-const readdirNodeModulesSync = nm => {
-  const set = fs.readdirSync(nm)
-  const unscoped = set.filter(f => !/^@/.test(f))
-  const scopes = set.filter(f => /^@/.test(f)).map(scope => {
-    try {
-      const pkgs = fs.readdirSync(nm + '/' + scope)
-      return pkgs.length ? pkgs.map(p => scope + '/' + p) : [scope]
-    } catch (er) {
-      return [scope]
-    }
-  }).reduce((a, b) => a.concat(b), [])
-  return unscoped.concat(scopes)
-}
-
-const walk = (options, callback) => {
-  const p = new Promise((resolve, reject) => {
-    new BundleWalker(options).on('done', resolve).on('error', reject).start()
-  })
-  return callback ? p.then(res => callback(null, res), callback) : p
-}
-
-const walkSync = options => {
-  return new BundleWalkerSync(options).start().result
-}
-
-module.exports = walk
-walk.sync = walkSync
-walk.BundleWalker = BundleWalker
-walk.BundleWalkerSync = BundleWalkerSync
diff --git a/legacy-libs/grpc/node_modules/npm-bundled/package.json b/legacy-libs/grpc/node_modules/npm-bundled/package.json
deleted file mode 100644 (file)
index 89e5388..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "_from": "npm-bundled@^1.0.1",
-  "_id": "npm-bundled@1.0.6",
-  "_inBundle": false,
-  "_integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==",
-  "_location": "/grpc/npm-bundled",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "npm-bundled@^1.0.1",
-    "name": "npm-bundled",
-    "escapedName": "npm-bundled",
-    "rawSpec": "^1.0.1",
-    "saveSpec": null,
-    "fetchSpec": "^1.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/npm-packlist"
-  ],
-  "_resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz",
-  "_shasum": "e7ba9aadcef962bb61248f91721cd932b3fe6bdd",
-  "_shrinkwrap": null,
-  "_spec": "npm-bundled@^1.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/npm-packlist",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/npm-bundled/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof",
-  "devDependencies": {
-    "mkdirp": "^0.5.1",
-    "mutate-fs": "^1.1.0",
-    "rimraf": "^2.6.1",
-    "tap": "^12.0.1"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/npm/npm-bundled#readme",
-  "license": "ISC",
-  "main": "index.js",
-  "name": "npm-bundled",
-  "optionalDependencies": {},
-  "readme": "# npm-bundled\n\nRun this in a node package, and it'll tell you which things in\nnode_modules are bundledDependencies, or transitive dependencies of\nbundled dependencies.\n\n[![Build Status](https://travis-ci.org/npm/npm-bundled.svg?branch=master)](https://travis-ci.org/npm/npm-bundled)\n\n## USAGE\n\nTo get the list of deps at the top level that are bundled (or\ntransitive deps of a bundled dep) run this:\n\n```js\nconst bundled = require('npm-bundled')\n\n// async version\nbundled({ path: '/path/to/pkg/defaults/to/cwd'}, (er, list) => {\n  // er means it had an error, which is _hella_ weird\n  // list is a list of package names, like `fooblz` or `@corp/blerg`\n  // the might not all be deps of the top level, because transitives\n})\n\n// async promise version\nbundled({ path: '/path/to/pkg/defaults/to/cwd'}).then(list => {\n  // so promisey!\n  // actually the callback version returns a promise, too, it just\n  // attaches the supplied callback to the promise\n})\n\n// sync version, throws if there's an error\nconst list = bundled({ path: '/path/to/pkg/defaults/to/cwd'})\n```\n\nThat's basically all you need to know.  If you care to dig into it,\nyou can also use the `bundled.Walker` and `bundled.WalkerSync`\nclasses to get fancy.\n\nThis library does not write anything to the filesystem, but it _may_\nhave undefined behavior if the structure of `node_modules` changes\nwhile it's reading deps.\n\nAll symlinks are followed.  This means that it can lead to surprising\nresults if a symlinked bundled dependency has a missing dependency\nthat is satisfied at the top level.  Since package creation resolves\nsymlinks as well, this is an edge case where package creation and\ndevelopment environment are not going to be aligned, and is best\navoided.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/npm-bundled.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js -J --100"
-  },
-  "version": "1.0.6"
-}
diff --git a/legacy-libs/grpc/node_modules/npm-packlist/LICENSE b/legacy-libs/grpc/node_modules/npm-packlist/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/npm-packlist/README.md b/legacy-libs/grpc/node_modules/npm-packlist/README.md
deleted file mode 100644 (file)
index ead5821..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-# npm-packlist
-
-[![Build Status](https://travis-ci.com/npm/npm-packlist.svg?token=hHeDp9pQmz9kvsgRNVHy&branch=master)](https://travis-ci.com/npm/npm-packlist)
-
-Get a list of the files to add from a folder into an npm package
-
-These can be handed to [tar](http://npm.im/tar) like so to make an npm
-package tarball:
-
-```js
-const packlist = require('npm-packlist')
-const tar = require('tar')
-const packageDir = '/path/to/package'
-const packageTarball = '/path/to/package.tgz'
-
-packlist({ path: packageDir })
-  .then(files => tar.create({
-    prefix: 'package/',
-    cwd: packageDir,
-    file: packageTarball,
-    gzip: true
-  }, files))
-  .then(_ => {
-    // tarball has been created, continue with your day
-  })
-```
-
-This uses the following rules:
-
-1. If a `package.json` file is found, and it has a `files` list,
-   then ignore everything that isn't in `files`.  Always include the
-   readme, license, notice, changes, changelog, and history files, if
-   they exist, and the package.json file itself.
-2. If there's no `package.json` file (or it has no `files` list), and
-   there is a `.npmignore` file, then ignore all the files in the
-   `.npmignore` file.
-3. If there's no `package.json` with a `files` list, and there's no
-   `.npmignore` file, but there is a `.gitignore` file, then ignore
-   all the files in the `.gitignore` file.
-4. Everything in the root `node_modules` is ignored, unless it's a
-   bundled dependency.  If it IS a bundled dependency, and it's a
-   symbolic link, then the target of the link is included, not the
-   symlink itself.
-4. Unless they're explicitly included (by being in a `files` list, or
-   a `!negated` rule in a relevant `.npmignore` or `.gitignore`),
-   always ignore certain common cruft files:
-
-    1. .npmignore and .gitignore files (their effect is in the package
-       already, there's no need to include them in the package)
-    2. editor junk like `.*.swp`, `._*` and `.*.orig` files
-    3. `.npmrc` files (these may contain private configs)
-    4. The `node_modules/.bin` folder
-    5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript`
-    6. Darwin's `.DS_Store` files because wtf are those even
-    7. `npm-debug.log` files at the root of a project
-
-    You can explicitly re-include any of these with a `files` list in
-    `package.json` or a negated ignore file rule.
-
-## API
-
-Same API as [ignore-walk](http://npm.im/ignore-walk), just hard-coded
-file list and rule sets.
-
-The `Walker` and `WalkerSync` classes take a `bundled` argument, which
-is a list of package names to include from node_modules.  When calling
-the top-level `packlist()` and `packlist.sync()` functions, this
-module calls into `npm-bundled` directly.
diff --git a/legacy-libs/grpc/node_modules/npm-packlist/index.js b/legacy-libs/grpc/node_modules/npm-packlist/index.js
deleted file mode 100644 (file)
index 777b585..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-'use strict'
-
-// Do a two-pass walk, first to get the list of packages that need to be
-// bundled, then again to get the actual files and folders.
-// Keep a cache of node_modules content and package.json data, so that the
-// second walk doesn't have to re-do all the same work.
-
-const bundleWalk = require('npm-bundled')
-const BundleWalker = bundleWalk.BundleWalker
-const BundleWalkerSync = bundleWalk.BundleWalkerSync
-
-const ignoreWalk = require('ignore-walk')
-const IgnoreWalker = ignoreWalk.Walker
-const IgnoreWalkerSync = ignoreWalk.WalkerSync
-
-const rootBuiltinRules = Symbol('root-builtin-rules')
-const packageNecessaryRules = Symbol('package-necessary-rules')
-const path = require('path')
-
-const defaultRules = [
-  '.npmignore',
-  '.gitignore',
-  '**/.git',
-  '**/.svn',
-  '**/.hg',
-  '**/CVS',
-  '**/.git/**',
-  '**/.svn/**',
-  '**/.hg/**',
-  '**/CVS/**',
-  '/.lock-wscript',
-  '/.wafpickle-*',
-  '/build/config.gypi',
-  'npm-debug.log',
-  '**/.npmrc',
-  '.*.swp',
-  '**/.DS_Store/**',
-  '._*',
-  '**/._*/**',
-  '*.orig',
-  '/package-lock.json',
-  '/yarn.lock',
-  'archived-packages/**',
-  'core',
-  '!core/',
-  '!**/core/',
-  '*.core',
-  '*.vgcore',
-  'vgcore.*',
-  'core.+([0-9])',
-]
-
-// a decorator that applies our custom rules to an ignore walker
-const npmWalker = Class => class Walker extends Class {
-  constructor (opt) {
-    opt = opt || {}
-
-    // the order in which rules are applied.
-    opt.ignoreFiles = [
-      rootBuiltinRules,
-      'package.json',
-      '.npmignore',
-      '.gitignore',
-      packageNecessaryRules
-    ]
-
-    opt.includeEmpty = false
-    opt.path = opt.path || process.cwd()
-    const dirName = path.basename(opt.path)
-    const parentName = path.basename(path.dirname(opt.path))
-    opt.follow =
-      dirName === 'node_modules' ||
-      (parentName === 'node_modules' && /^@/.test(dirName))
-    super(opt)
-
-    // ignore a bunch of things by default at the root level.
-    // also ignore anything in node_modules, except bundled dependencies
-    if (!this.parent) {
-      this.bundled = opt.bundled || []
-      this.bundledScopes = Array.from(new Set(
-        this.bundled.filter(f => /^@/.test(f))
-        .map(f => f.split('/')[0])))
-      const rules = defaultRules.join('\n') + '\n'
-      this.packageJsonCache = opt.packageJsonCache || new Map()
-      super.onReadIgnoreFile(rootBuiltinRules, rules, _=>_)
-    } else {
-      this.bundled = []
-      this.bundledScopes = []
-      this.packageJsonCache = this.parent.packageJsonCache
-    }
-  }
-
-  filterEntry (entry, partial) {
-    // get the partial path from the root of the walk
-    const p = this.path.substr(this.root.length + 1)
-    const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/
-    const isRoot = !this.parent
-    const pkg = isRoot && pkgre.test(entry) ?
-      entry.replace(pkgre, '$1') : null
-    const rootNM = isRoot && entry === 'node_modules'
-    const rootPJ = isRoot && entry === 'package.json'
-
-    return (
-      // if we're in a bundled package, check with the parent.
-      /^node_modules($|\/)/i.test(p) ? this.parent.filterEntry(
-          this.basename + '/' + entry, partial)
-
-      // if package is bundled, all files included
-      // also include @scope dirs for bundled scoped deps
-      // they'll be ignored if no files end up in them.
-      // However, this only matters if we're in the root.
-      // node_modules folders elsewhere, like lib/node_modules,
-      // should be included normally unless ignored.
-      : pkg ? -1 !== this.bundled.indexOf(pkg) ||
-        -1 !== this.bundledScopes.indexOf(pkg)
-
-      // only walk top node_modules if we want to bundle something
-      : rootNM ? !!this.bundled.length
-
-      // always include package.json at the root.
-      : rootPJ ? true
-
-      // otherwise, follow ignore-walk's logic
-      : super.filterEntry(entry, partial)
-    )
-  }
-
-  filterEntries () {
-    if (this.ignoreRules['package.json'])
-      this.ignoreRules['.gitignore'] = this.ignoreRules['.npmignore'] = null
-    else if (this.ignoreRules['.npmignore'])
-      this.ignoreRules['.gitignore'] = null
-    this.filterEntries = super.filterEntries
-    super.filterEntries()
-  }
-
-  addIgnoreFile (file, then) {
-    const ig = path.resolve(this.path, file)
-    if (this.packageJsonCache.has(ig))
-      this.onPackageJson(ig, this.packageJsonCache.get(ig), then)
-    else
-      super.addIgnoreFile(file, then)
-  }
-
-  onPackageJson (ig, pkg, then) {
-    this.packageJsonCache.set(ig, pkg)
-
-    // if there's a bin, browser or main, make sure we don't ignore it
-    // also, don't ignore the package.json itself!
-    const rules = [
-      pkg.browser ? '!' + pkg.browser : '',
-      pkg.main ? '!' + pkg.main : '',
-      '!package.json',
-      '!@(readme|copying|license|licence|notice|changes|changelog|history){,.*[^~$]}'
-    ]
-    if (pkg.bin)
-      if (typeof pkg.bin === "object")
-        for (const key in pkg.bin)
-          rules.push('!' + pkg.bin[key])
-      else
-        rules.push('!' + pkg.bin)
-
-    const data = rules.filter(f => f).join('\n') + '\n'
-    super.onReadIgnoreFile(packageNecessaryRules, data, _=>_)
-
-    if (Array.isArray(pkg.files))
-      super.onReadIgnoreFile('package.json', '*\n' + pkg.files.map(
-        f => '!' + f + '\n!' + f.replace(/\/+$/, '') + '/**'
-      ).join('\n') + '\n', then)
-    else
-      then()
-  }
-
-  // override parent onstat function to nix all symlinks
-  onstat (st, entry, file, dir, then) {
-    if (st.isSymbolicLink())
-      then()
-    else
-      super.onstat(st, entry, file, dir, then)
-  }
-
-  onReadIgnoreFile (file, data, then) {
-    if (file === 'package.json')
-      try {
-        const ig = path.resolve(this.path, file)
-        this.onPackageJson(ig, JSON.parse(data), then)
-      } catch (er) {
-        // ignore package.json files that are not json
-        then()
-      }
-    else
-      super.onReadIgnoreFile(file, data, then)
-  }
-
-  sort (a, b) {
-    return sort(a, b)
-  }
-}
-
-class Walker extends npmWalker(IgnoreWalker) {
-  walker (entry, then) {
-    new Walker(this.walkerOpt(entry)).on('done', then).start()
-  }
-}
-
-class WalkerSync extends npmWalker(IgnoreWalkerSync) {
-  walker (entry, then) {
-    new WalkerSync(this.walkerOpt(entry)).start()
-    then()
-  }
-}
-
-const walk = (options, callback) => {
-  options = options || {}
-  const p = new Promise((resolve, reject) => {
-    const bw = new BundleWalker(options)
-    bw.on('done', bundled => {
-      options.bundled = bundled
-      options.packageJsonCache = bw.packageJsonCache
-      new Walker(options).on('done', resolve).on('error', reject).start()
-    })
-    bw.start()
-  })
-  return callback ? p.then(res => callback(null, res), callback) : p
-}
-
-const walkSync = options => {
-  options = options || {}
-  const bw = new BundleWalkerSync(options).start()
-  options.bundled = bw.result
-  options.packageJsonCache = bw.packageJsonCache
-  const walker = new WalkerSync(options)
-  walker.start()
-  return walker.result
-}
-
-// package.json first, node_modules last, files before folders, alphasort
-const sort = (a, b) =>
-  a === 'package.json' ? -1
-  : b === 'package.json' ? 1
-  : /^node_modules/.test(a) && !/^node_modules/.test(b) ? 1
-  : /^node_modules/.test(b) && !/^node_modules/.test(a) ? -1
-  : path.dirname(a) === '.' && path.dirname(b) !== '.' ? -1
-  : path.dirname(b) === '.' && path.dirname(a) !== '.' ? 1
-  : a.localeCompare(b)
-
-module.exports = walk
-walk.sync = walkSync
-walk.Walker = Walker
-walk.WalkerSync = WalkerSync
diff --git a/legacy-libs/grpc/node_modules/npm-packlist/package.json b/legacy-libs/grpc/node_modules/npm-packlist/package.json
deleted file mode 100644 (file)
index 7304578..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_from": "npm-packlist@^1.1.6",
-  "_id": "npm-packlist@1.4.1",
-  "_inBundle": false,
-  "_integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==",
-  "_location": "/grpc/npm-packlist",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "npm-packlist@^1.1.6",
-    "name": "npm-packlist",
-    "escapedName": "npm-packlist",
-    "rawSpec": "^1.1.6",
-    "saveSpec": null,
-    "fetchSpec": "^1.1.6"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz",
-  "_shasum": "19064cdf988da80ea3cee45533879d90192bbfbc",
-  "_shrinkwrap": null,
-  "_spec": "npm-packlist@^1.1.6",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/npm-packlist/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "ignore-walk": "^3.0.1",
-    "npm-bundled": "^1.0.1"
-  },
-  "deprecated": false,
-  "description": "Get a list of the files to add from a folder into an npm package",
-  "devDependencies": {
-    "mkdirp": "^0.5.1",
-    "rimraf": "^2.6.1",
-    "tap": "^12.0.1"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://www.npmjs.com/package/npm-packlist",
-  "license": "ISC",
-  "main": "index.js",
-  "name": "npm-packlist",
-  "optionalDependencies": {},
-  "readme": "# npm-packlist\n\n[![Build Status](https://travis-ci.com/npm/npm-packlist.svg?token=hHeDp9pQmz9kvsgRNVHy&branch=master)](https://travis-ci.com/npm/npm-packlist)\n\nGet a list of the files to add from a folder into an npm package\n\nThese can be handed to [tar](http://npm.im/tar) like so to make an npm\npackage tarball:\n\n```js\nconst packlist = require('npm-packlist')\nconst tar = require('tar')\nconst packageDir = '/path/to/package'\nconst packageTarball = '/path/to/package.tgz'\n\npacklist({ path: packageDir })\n  .then(files => tar.create({\n    prefix: 'package/',\n    cwd: packageDir,\n    file: packageTarball,\n    gzip: true\n  }, files))\n  .then(_ => {\n    // tarball has been created, continue with your day\n  })\n```\n\nThis uses the following rules:\n\n1. If a `package.json` file is found, and it has a `files` list,\n   then ignore everything that isn't in `files`.  Always include the\n   readme, license, notice, changes, changelog, and history files, if\n   they exist, and the package.json file itself.\n2. If there's no `package.json` file (or it has no `files` list), and\n   there is a `.npmignore` file, then ignore all the files in the\n   `.npmignore` file.\n3. If there's no `package.json` with a `files` list, and there's no\n   `.npmignore` file, but there is a `.gitignore` file, then ignore\n   all the files in the `.gitignore` file.\n4. Everything in the root `node_modules` is ignored, unless it's a\n   bundled dependency.  If it IS a bundled dependency, and it's a\n   symbolic link, then the target of the link is included, not the\n   symlink itself.\n4. Unless they're explicitly included (by being in a `files` list, or\n   a `!negated` rule in a relevant `.npmignore` or `.gitignore`),\n   always ignore certain common cruft files:\n\n    1. .npmignore and .gitignore files (their effect is in the package\n       already, there's no need to include them in the package)\n    2. editor junk like `.*.swp`, `._*` and `.*.orig` files\n    3. `.npmrc` files (these may contain private configs)\n    4. The `node_modules/.bin` folder\n    5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript`\n    6. Darwin's `.DS_Store` files because wtf are those even\n    7. `npm-debug.log` files at the root of a project\n\n    You can explicitly re-include any of these with a `files` list in\n    `package.json` or a negated ignore file rule.\n\n## API\n\nSame API as [ignore-walk](http://npm.im/ignore-walk), just hard-coded\nfile list and rule sets.\n\nThe `Walker` and `WalkerSync` classes take a `bundled` argument, which\nis a list of package names to include from node_modules.  When calling\nthe top-level `packlist()` and `packlist.sync()` functions, this\nmodule calls into `npm-bundled` directly.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/npm-packlist.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --100 -J"
-  },
-  "version": "1.4.1"
-}
diff --git a/legacy-libs/grpc/node_modules/npmlog/CHANGELOG.md b/legacy-libs/grpc/node_modules/npmlog/CHANGELOG.md
deleted file mode 100644 (file)
index 51e4abc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-### v4.0.2
-
-* Added installation instructions.
-
-### v4.0.1
-
-* Fix bugs where `log.progressEnabled` got out of sync with how `gauge` kept
-  track of these things resulting in a progressbar that couldn't be disabled.
-
-### v4.0.0
-
-* Allow creating log levels that are an empty string or 0.
-
-### v3.1.2
-
-* Update to `gauge@1.6.0` adding support for default values for template
-  items.
-
-### v3.1.1
-
-* Update to `gauge@1.5.3` to fix to `1.x` compatibility when it comes to
-  when a progress bar is enabled.  In `1.x` if you didn't have a TTY the
-  progress bar was never shown.  In `2.x` it merely defaults to disabled,
-  but you can enable it explicitly if you still want progress updates.
-
-### v3.1.0
-
-* Update to `gauge@2.5.2`:
-  * Updates the `signal-exit` dependency which fixes an incompatibility with
-    the node profiler.
-  * Uses externalizes its ansi code generation in `console-control-strings`
-* Make the default progress bar include the last line printed, colored as it
-  would be when printing to a tty.
-
-### v3.0.0
-
-* Switch to `gauge@2.0.0`, for better performance, better look.
-* Set stderr/stdout blocking if they're tty's, so that we can hide a
-  progress bar going to stderr and then safely print to stdout.  Without
-  this the two can end up overlapping producing confusing and sometimes
-  corrupted output.
-
-### v2.0.0
-
-* Make the `error` event non-fatal so that folks can use it as a prefix.
-
-### v1.0.0
-
-* Add progress bar with `gauge@1.1.0`
diff --git a/legacy-libs/grpc/node_modules/npmlog/LICENSE b/legacy-libs/grpc/node_modules/npmlog/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/npmlog/README.md b/legacy-libs/grpc/node_modules/npmlog/README.md
deleted file mode 100644 (file)
index 268a4af..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-# npmlog
-
-The logger util that npm uses.
-
-This logger is very basic.  It does the logging for npm.  It supports
-custom levels and colored output.
-
-By default, logs are written to stderr.  If you want to send log messages
-to outputs other than streams, then you can change the `log.stream`
-member, or you can just listen to the events that it emits, and do
-whatever you want with them.
-
-# Installation
-
-```console
-npm install npmlog --save
-```
-
-# Basic Usage
-
-```javascript
-var log = require('npmlog')
-
-// additional stuff ---------------------------+
-// message ----------+                         |
-// prefix ----+      |                         |
-// level -+   |      |                         |
-//        v   v      v                         v
-    log.info('fyi', 'I have a kitty cat: %j', myKittyCat)
-```
-
-## log.level
-
-* {String}
-
-The level to display logs at.  Any logs at or above this level will be
-displayed.  The special level `silent` will prevent anything from being
-displayed ever.
-
-## log.record
-
-* {Array}
-
-An array of all the log messages that have been entered.
-
-## log.maxRecordSize
-
-* {Number}
-
-The maximum number of records to keep.  If log.record gets bigger than
-10% over this value, then it is sliced down to 90% of this value.
-
-The reason for the 10% window is so that it doesn't have to resize a
-large array on every log entry.
-
-## log.prefixStyle
-
-* {Object}
-
-A style object that specifies how prefixes are styled.  (See below)
-
-## log.headingStyle
-
-* {Object}
-
-A style object that specifies how the heading is styled.  (See below)
-
-## log.heading
-
-* {String} Default: ""
-
-If set, a heading that is printed at the start of every line.
-
-## log.stream
-
-* {Stream} Default: `process.stderr`
-
-The stream where output is written.
-
-## log.enableColor()
-
-Force colors to be used on all messages, regardless of the output
-stream.
-
-## log.disableColor()
-
-Disable colors on all messages.
-
-## log.enableProgress()
-
-Enable the display of log activity spinner and progress bar
-
-## log.disableProgress()
-
-Disable the display of a progress bar
-
-## log.enableUnicode()
-
-Force the unicode theme to be used for the progress bar.
-
-## log.disableUnicode()
-
-Disable the use of unicode in the progress bar.
-
-## log.setGaugeTemplate(template)
-
-Set a template for outputting the progress bar. See the [gauge documentation] for details.
-
-[gauge documentation]: https://npmjs.com/package/gauge
-
-## log.setGaugeThemeset(themes)
-
-Select a themeset to pick themes from for the progress bar. See the [gauge documentation] for details.
-
-## log.pause()
-
-Stop emitting messages to the stream, but do not drop them.
-
-## log.resume()
-
-Emit all buffered messages that were written while paused.
-
-## log.log(level, prefix, message, ...)
-
-* `level` {String} The level to emit the message at
-* `prefix` {String} A string prefix.  Set to "" to skip.
-* `message...` Arguments to `util.format`
-
-Emit a log message at the specified level.
-
-## log\[level](prefix, message, ...)
-
-For example,
-
-* log.silly(prefix, message, ...)
-* log.verbose(prefix, message, ...)
-* log.info(prefix, message, ...)
-* log.http(prefix, message, ...)
-* log.warn(prefix, message, ...)
-* log.error(prefix, message, ...)
-
-Like `log.log(level, prefix, message, ...)`.  In this way, each level is
-given a shorthand, so you can do `log.info(prefix, message)`.
-
-## log.addLevel(level, n, style, disp)
-
-* `level` {String} Level indicator
-* `n` {Number} The numeric level
-* `style` {Object} Object with fg, bg, inverse, etc.
-* `disp` {String} Optional replacement for `level` in the output.
-
-Sets up a new level with a shorthand function and so forth.
-
-Note that if the number is `Infinity`, then setting the level to that
-will cause all log messages to be suppressed.  If the number is
-`-Infinity`, then the only way to show it is to enable all log messages.
-
-## log.newItem(name, todo, weight)
-
-* `name` {String} Optional; progress item name.
-* `todo` {Number} Optional; total amount of work to be done. Default 0.
-* `weight` {Number} Optional; the weight of this item relative to others. Default 1.
-
-This adds a new `are-we-there-yet` item tracker to the progress tracker. The
-object returned has the `log[level]` methods but is otherwise an
-`are-we-there-yet` `Tracker` object.
-
-## log.newStream(name, todo, weight)
-
-This adds a new `are-we-there-yet` stream tracker to the progress tracker. The
-object returned has the `log[level]` methods but is otherwise an
-`are-we-there-yet` `TrackerStream` object.
-
-## log.newGroup(name, weight)
-
-This adds a new `are-we-there-yet` tracker group to the progress tracker. The
-object returned has the `log[level]` methods but is otherwise an
-`are-we-there-yet` `TrackerGroup` object.
-
-# Events
-
-Events are all emitted with the message object.
-
-* `log` Emitted for all messages
-* `log.<level>` Emitted for all messages with the `<level>` level.
-* `<prefix>` Messages with prefixes also emit their prefix as an event.
-
-# Style Objects
-
-Style objects can have the following fields:
-
-* `fg` {String} Color for the foreground text
-* `bg` {String} Color for the background
-* `bold`, `inverse`, `underline` {Boolean} Set the associated property
-* `bell` {Boolean} Make a noise (This is pretty annoying, probably.)
-
-# Message Objects
-
-Every log event is emitted with a message object, and the `log.record`
-list contains all of them that have been created.  They have the
-following fields:
-
-* `id` {Number}
-* `level` {String}
-* `prefix` {String}
-* `message` {String} Result of `util.format()`
-* `messageRaw` {Array} Arguments to `util.format()`
-
-# Blocking TTYs
-
-We use [`set-blocking`](https://npmjs.com/package/set-blocking) to set
-stderr and stdout blocking if they are tty's and have the setBlocking call.
-This is a work around for an issue in early versions of Node.js 6.x, which
-made stderr and stdout non-blocking on OSX. (They are always blocking
-Windows and were never blocking on Linux.) `npmlog` needs them to be blocking
-so that it can allow output to stdout and stderr to be interlaced.
diff --git a/legacy-libs/grpc/node_modules/npmlog/log.js b/legacy-libs/grpc/node_modules/npmlog/log.js
deleted file mode 100644 (file)
index 341f331..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-'use strict'
-var Progress = require('are-we-there-yet')
-var Gauge = require('gauge')
-var EE = require('events').EventEmitter
-var log = exports = module.exports = new EE()
-var util = require('util')
-
-var setBlocking = require('set-blocking')
-var consoleControl = require('console-control-strings')
-
-setBlocking(true)
-var stream = process.stderr
-Object.defineProperty(log, 'stream', {
-  set: function (newStream) {
-    stream = newStream
-    if (this.gauge) this.gauge.setWriteTo(stream, stream)
-  },
-  get: function () {
-    return stream
-  }
-})
-
-// by default, decide based on tty-ness.
-var colorEnabled
-log.useColor = function () {
-  return colorEnabled != null ? colorEnabled : stream.isTTY
-}
-
-log.enableColor = function () {
-  colorEnabled = true
-  this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
-}
-log.disableColor = function () {
-  colorEnabled = false
-  this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
-}
-
-// default level
-log.level = 'info'
-
-log.gauge = new Gauge(stream, {
-  enabled: false, // no progress bars unless asked
-  theme: {hasColor: log.useColor()},
-  template: [
-    {type: 'progressbar', length: 20},
-    {type: 'activityIndicator', kerning: 1, length: 1},
-    {type: 'section', default: ''},
-    ':',
-    {type: 'logline', kerning: 1, default: ''}
-  ]
-})
-
-log.tracker = new Progress.TrackerGroup()
-
-// we track this separately as we may need to temporarily disable the
-// display of the status bar for our own loggy purposes.
-log.progressEnabled = log.gauge.isEnabled()
-
-var unicodeEnabled
-
-log.enableUnicode = function () {
-  unicodeEnabled = true
-  this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
-}
-
-log.disableUnicode = function () {
-  unicodeEnabled = false
-  this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
-}
-
-log.setGaugeThemeset = function (themes) {
-  this.gauge.setThemeset(themes)
-}
-
-log.setGaugeTemplate = function (template) {
-  this.gauge.setTemplate(template)
-}
-
-log.enableProgress = function () {
-  if (this.progressEnabled) return
-  this.progressEnabled = true
-  this.tracker.on('change', this.showProgress)
-  if (this._pause) return
-  this.gauge.enable()
-}
-
-log.disableProgress = function () {
-  if (!this.progressEnabled) return
-  this.progressEnabled = false
-  this.tracker.removeListener('change', this.showProgress)
-  this.gauge.disable()
-}
-
-var trackerConstructors = ['newGroup', 'newItem', 'newStream']
-
-var mixinLog = function (tracker) {
-  // mixin the public methods from log into the tracker
-  // (except: conflicts and one's we handle specially)
-  Object.keys(log).forEach(function (P) {
-    if (P[0] === '_') return
-    if (trackerConstructors.filter(function (C) { return C === P }).length) return
-    if (tracker[P]) return
-    if (typeof log[P] !== 'function') return
-    var func = log[P]
-    tracker[P] = function () {
-      return func.apply(log, arguments)
-    }
-  })
-  // if the new tracker is a group, make sure any subtrackers get
-  // mixed in too
-  if (tracker instanceof Progress.TrackerGroup) {
-    trackerConstructors.forEach(function (C) {
-      var func = tracker[C]
-      tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) }
-    })
-  }
-  return tracker
-}
-
-// Add tracker constructors to the top level log object
-trackerConstructors.forEach(function (C) {
-  log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) }
-})
-
-log.clearProgress = function (cb) {
-  if (!this.progressEnabled) return cb && process.nextTick(cb)
-  this.gauge.hide(cb)
-}
-
-log.showProgress = function (name, completed) {
-  if (!this.progressEnabled) return
-  var values = {}
-  if (name) values.section = name
-  var last = log.record[log.record.length - 1]
-  if (last) {
-    values.subsection = last.prefix
-    var disp = log.disp[last.level] || last.level
-    var logline = this._format(disp, log.style[last.level])
-    if (last.prefix) logline += ' ' + this._format(last.prefix, this.prefixStyle)
-    logline += ' ' + last.message.split(/\r?\n/)[0]
-    values.logline = logline
-  }
-  values.completed = completed || this.tracker.completed()
-  this.gauge.show(values)
-}.bind(log) // bind for use in tracker's on-change listener
-
-// temporarily stop emitting, but don't drop
-log.pause = function () {
-  this._paused = true
-  if (this.progressEnabled) this.gauge.disable()
-}
-
-log.resume = function () {
-  if (!this._paused) return
-  this._paused = false
-
-  var b = this._buffer
-  this._buffer = []
-  b.forEach(function (m) {
-    this.emitLog(m)
-  }, this)
-  if (this.progressEnabled) this.gauge.enable()
-}
-
-log._buffer = []
-
-var id = 0
-log.record = []
-log.maxRecordSize = 10000
-log.log = function (lvl, prefix, message) {
-  var l = this.levels[lvl]
-  if (l === undefined) {
-    return this.emit('error', new Error(util.format(
-      'Undefined log level: %j', lvl)))
-  }
-
-  var a = new Array(arguments.length - 2)
-  var stack = null
-  for (var i = 2; i < arguments.length; i++) {
-    var arg = a[i - 2] = arguments[i]
-
-    // resolve stack traces to a plain string.
-    if (typeof arg === 'object' && arg &&
-        (arg instanceof Error) && arg.stack) {
-
-      Object.defineProperty(arg, 'stack', {
-        value: stack = arg.stack + '',
-        enumerable: true,
-        writable: true
-      })
-    }
-  }
-  if (stack) a.unshift(stack + '\n')
-  message = util.format.apply(util, a)
-
-  var m = { id: id++,
-            level: lvl,
-            prefix: String(prefix || ''),
-            message: message,
-            messageRaw: a }
-
-  this.emit('log', m)
-  this.emit('log.' + lvl, m)
-  if (m.prefix) this.emit(m.prefix, m)
-
-  this.record.push(m)
-  var mrs = this.maxRecordSize
-  var n = this.record.length - mrs
-  if (n > mrs / 10) {
-    var newSize = Math.floor(mrs * 0.9)
-    this.record = this.record.slice(-1 * newSize)
-  }
-
-  this.emitLog(m)
-}.bind(log)
-
-log.emitLog = function (m) {
-  if (this._paused) {
-    this._buffer.push(m)
-    return
-  }
-  if (this.progressEnabled) this.gauge.pulse(m.prefix)
-  var l = this.levels[m.level]
-  if (l === undefined) return
-  if (l < this.levels[this.level]) return
-  if (l > 0 && !isFinite(l)) return
-
-  // If 'disp' is null or undefined, use the lvl as a default
-  // Allows: '', 0 as valid disp
-  var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level
-  this.clearProgress()
-  m.message.split(/\r?\n/).forEach(function (line) {
-    if (this.heading) {
-      this.write(this.heading, this.headingStyle)
-      this.write(' ')
-    }
-    this.write(disp, log.style[m.level])
-    var p = m.prefix || ''
-    if (p) this.write(' ')
-    this.write(p, this.prefixStyle)
-    this.write(' ' + line + '\n')
-  }, this)
-  this.showProgress()
-}
-
-log._format = function (msg, style) {
-  if (!stream) return
-
-  var output = ''
-  if (this.useColor()) {
-    style = style || {}
-    var settings = []
-    if (style.fg) settings.push(style.fg)
-    if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
-    if (style.bold) settings.push('bold')
-    if (style.underline) settings.push('underline')
-    if (style.inverse) settings.push('inverse')
-    if (settings.length) output += consoleControl.color(settings)
-    if (style.beep) output += consoleControl.beep()
-  }
-  output += msg
-  if (this.useColor()) {
-    output += consoleControl.color('reset')
-  }
-  return output
-}
-
-log.write = function (msg, style) {
-  if (!stream) return
-
-  stream.write(this._format(msg, style))
-}
-
-log.addLevel = function (lvl, n, style, disp) {
-  // If 'disp' is null or undefined, use the lvl as a default
-  if (disp == null) disp = lvl
-  this.levels[lvl] = n
-  this.style[lvl] = style
-  if (!this[lvl]) {
-    this[lvl] = function () {
-      var a = new Array(arguments.length + 1)
-      a[0] = lvl
-      for (var i = 0; i < arguments.length; i++) {
-        a[i + 1] = arguments[i]
-      }
-      return this.log.apply(this, a)
-    }.bind(this)
-  }
-  this.disp[lvl] = disp
-}
-
-log.prefixStyle = { fg: 'magenta' }
-log.headingStyle = { fg: 'white', bg: 'black' }
-
-log.style = {}
-log.levels = {}
-log.disp = {}
-log.addLevel('silly', -Infinity, { inverse: true }, 'sill')
-log.addLevel('verbose', 1000, { fg: 'blue', bg: 'black' }, 'verb')
-log.addLevel('info', 2000, { fg: 'green' })
-log.addLevel('timing', 2500, { fg: 'green', bg: 'black' })
-log.addLevel('http', 3000, { fg: 'green', bg: 'black' })
-log.addLevel('notice', 3500, { fg: 'blue', bg: 'black' })
-log.addLevel('warn', 4000, { fg: 'black', bg: 'yellow' }, 'WARN')
-log.addLevel('error', 5000, { fg: 'red', bg: 'black' }, 'ERR!')
-log.addLevel('silent', Infinity)
-
-// allow 'error' prefix
-log.on('error', function () {})
diff --git a/legacy-libs/grpc/node_modules/npmlog/package.json b/legacy-libs/grpc/node_modules/npmlog/package.json
deleted file mode 100644 (file)
index 2cd8149..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-{
-  "_args": [
-    [
-      "npmlog@4.1.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "npmlog@4.1.2",
-  "_id": "npmlog@4.1.2",
-  "_inBundle": false,
-  "_integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
-  "_location": "/grpc/npmlog",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "npmlog@4.1.2",
-    "name": "npmlog",
-    "escapedName": "npmlog",
-    "rawSpec": "4.1.2",
-    "saveSpec": null,
-    "fetchSpec": "4.1.2"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "4.1.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/npmlog/issues"
-  },
-  "dependencies": {
-    "are-we-there-yet": "~1.1.2",
-    "console-control-strings": "~1.1.0",
-    "gauge": "~2.7.3",
-    "set-blocking": "~2.0.0"
-  },
-  "description": "logger for npm",
-  "devDependencies": {
-    "standard": "~7.1.2",
-    "tap": "~5.7.3"
-  },
-  "files": [
-    "log.js"
-  ],
-  "homepage": "https://github.com/npm/npmlog#readme",
-  "license": "ISC",
-  "main": "log.js",
-  "name": "npmlog",
-  "optionalDependencies": {},
-  "readme": "# npmlog\n\nThe logger util that npm uses.\n\nThis logger is very basic.  It does the logging for npm.  It supports\ncustom levels and colored output.\n\nBy default, logs are written to stderr.  If you want to send log messages\nto outputs other than streams, then you can change the `log.stream`\nmember, or you can just listen to the events that it emits, and do\nwhatever you want with them.\n\n# Installation\n\n```console\nnpm install npmlog --save\n```\n\n# Basic Usage\n\n```javascript\nvar log = require('npmlog')\n\n// additional stuff ---------------------------+\n// message ----------+                         |\n// prefix ----+      |                         |\n// level -+   |      |                         |\n//        v   v      v                         v\n    log.info('fyi', 'I have a kitty cat: %j', myKittyCat)\n```\n\n## log.level\n\n* {String}\n\nThe level to display logs at.  Any logs at or above this level will be\ndisplayed.  The special level `silent` will prevent anything from being\ndisplayed ever.\n\n## log.record\n\n* {Array}\n\nAn array of all the log messages that have been entered.\n\n## log.maxRecordSize\n\n* {Number}\n\nThe maximum number of records to keep.  If log.record gets bigger than\n10% over this value, then it is sliced down to 90% of this value.\n\nThe reason for the 10% window is so that it doesn't have to resize a\nlarge array on every log entry.\n\n## log.prefixStyle\n\n* {Object}\n\nA style object that specifies how prefixes are styled.  (See below)\n\n## log.headingStyle\n\n* {Object}\n\nA style object that specifies how the heading is styled.  (See below)\n\n## log.heading\n\n* {String} Default: \"\"\n\nIf set, a heading that is printed at the start of every line.\n\n## log.stream\n\n* {Stream} Default: `process.stderr`\n\nThe stream where output is written.\n\n## log.enableColor()\n\nForce colors to be used on all messages, regardless of the output\nstream.\n\n## log.disableColor()\n\nDisable colors on all messages.\n\n## log.enableProgress()\n\nEnable the display of log activity spinner and progress bar\n\n## log.disableProgress()\n\nDisable the display of a progress bar\n\n## log.enableUnicode()\n\nForce the unicode theme to be used for the progress bar.\n\n## log.disableUnicode()\n\nDisable the use of unicode in the progress bar.\n\n## log.setGaugeTemplate(template)\n\nSet a template for outputting the progress bar. See the [gauge documentation] for details.\n\n[gauge documentation]: https://npmjs.com/package/gauge\n\n## log.setGaugeThemeset(themes)\n\nSelect a themeset to pick themes from for the progress bar. See the [gauge documentation] for details.\n\n## log.pause()\n\nStop emitting messages to the stream, but do not drop them.\n\n## log.resume()\n\nEmit all buffered messages that were written while paused.\n\n## log.log(level, prefix, message, ...)\n\n* `level` {String} The level to emit the message at\n* `prefix` {String} A string prefix.  Set to \"\" to skip.\n* `message...` Arguments to `util.format`\n\nEmit a log message at the specified level.\n\n## log\\[level](prefix, message, ...)\n\nFor example,\n\n* log.silly(prefix, message, ...)\n* log.verbose(prefix, message, ...)\n* log.info(prefix, message, ...)\n* log.http(prefix, message, ...)\n* log.warn(prefix, message, ...)\n* log.error(prefix, message, ...)\n\nLike `log.log(level, prefix, message, ...)`.  In this way, each level is\ngiven a shorthand, so you can do `log.info(prefix, message)`.\n\n## log.addLevel(level, n, style, disp)\n\n* `level` {String} Level indicator\n* `n` {Number} The numeric level\n* `style` {Object} Object with fg, bg, inverse, etc.\n* `disp` {String} Optional replacement for `level` in the output.\n\nSets up a new level with a shorthand function and so forth.\n\nNote that if the number is `Infinity`, then setting the level to that\nwill cause all log messages to be suppressed.  If the number is\n`-Infinity`, then the only way to show it is to enable all log messages.\n\n## log.newItem(name, todo, weight)\n\n* `name` {String} Optional; progress item name.\n* `todo` {Number} Optional; total amount of work to be done. Default 0.\n* `weight` {Number} Optional; the weight of this item relative to others. Default 1.\n\nThis adds a new `are-we-there-yet` item tracker to the progress tracker. The\nobject returned has the `log[level]` methods but is otherwise an\n`are-we-there-yet` `Tracker` object.\n\n## log.newStream(name, todo, weight)\n\nThis adds a new `are-we-there-yet` stream tracker to the progress tracker. The\nobject returned has the `log[level]` methods but is otherwise an\n`are-we-there-yet` `TrackerStream` object.\n\n## log.newGroup(name, weight)\n\nThis adds a new `are-we-there-yet` tracker group to the progress tracker. The\nobject returned has the `log[level]` methods but is otherwise an\n`are-we-there-yet` `TrackerGroup` object.\n\n# Events\n\nEvents are all emitted with the message object.\n\n* `log` Emitted for all messages\n* `log.<level>` Emitted for all messages with the `<level>` level.\n* `<prefix>` Messages with prefixes also emit their prefix as an event.\n\n# Style Objects\n\nStyle objects can have the following fields:\n\n* `fg` {String} Color for the foreground text\n* `bg` {String} Color for the background\n* `bold`, `inverse`, `underline` {Boolean} Set the associated property\n* `bell` {Boolean} Make a noise (This is pretty annoying, probably.)\n\n# Message Objects\n\nEvery log event is emitted with a message object, and the `log.record`\nlist contains all of them that have been created.  They have the\nfollowing fields:\n\n* `id` {Number}\n* `level` {String}\n* `prefix` {String}\n* `message` {String} Result of `util.format()`\n* `messageRaw` {Array} Arguments to `util.format()`\n\n# Blocking TTYs\n\nWe use [`set-blocking`](https://npmjs.com/package/set-blocking) to set\nstderr and stdout blocking if they are tty's and have the setBlocking call.\nThis is a work around for an issue in early versions of Node.js 6.x, which\nmade stderr and stdout non-blocking on OSX. (They are always blocking\nWindows and were never blocking on Linux.) `npmlog` needs them to be blocking\nso that it can allow output to stdout and stderr to be interlaced.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/npmlog.git"
-  },
-  "scripts": {
-    "test": "standard && tap test/*.js"
-  },
-  "version": "4.1.2"
-}
diff --git a/legacy-libs/grpc/node_modules/number-is-nan/index.js b/legacy-libs/grpc/node_modules/number-is-nan/index.js
deleted file mode 100644 (file)
index 79be4b9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-'use strict';
-module.exports = Number.isNaN || function (x) {
-       return x !== x;
-};
diff --git a/legacy-libs/grpc/node_modules/number-is-nan/license b/legacy-libs/grpc/node_modules/number-is-nan/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/number-is-nan/package.json b/legacy-libs/grpc/node_modules/number-is-nan/package.json
deleted file mode 100644 (file)
index 48b5bde..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-{
-  "_args": [
-    [
-      "number-is-nan@1.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "number-is-nan@1.0.1",
-  "_id": "number-is-nan@1.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
-  "_location": "/grpc/number-is-nan",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "number-is-nan@1.0.1",
-    "name": "number-is-nan",
-    "escapedName": "number-is-nan",
-    "rawSpec": "1.0.1",
-    "saveSpec": null,
-    "fetchSpec": "1.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/is-fullwidth-code-point"
-  ],
-  "_resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/number-is-nan/issues"
-  },
-  "dependencies": {},
-  "description": "ES2015 Number.isNaN() ponyfill",
-  "devDependencies": {
-    "ava": "*"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/number-is-nan#readme",
-  "keywords": [
-    "es2015",
-    "ecmascript",
-    "ponyfill",
-    "polyfill",
-    "shim",
-    "number",
-    "is",
-    "nan",
-    "not"
-  ],
-  "license": "MIT",
-  "name": "number-is-nan",
-  "optionalDependencies": {},
-  "readme": "# number-is-nan [![Build Status](https://travis-ci.org/sindresorhus/number-is-nan.svg?branch=master)](https://travis-ci.org/sindresorhus/number-is-nan)\n\n> ES2015 [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save number-is-nan\n```\n\n\n## Usage\n\n```js\nvar numberIsNan = require('number-is-nan');\n\nnumberIsNan(NaN);\n//=> true\n\nnumberIsNan('unicorn');\n//=> false\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/number-is-nan.git"
-  },
-  "scripts": {
-    "test": "ava"
-  },
-  "version": "1.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/number-is-nan/readme.md b/legacy-libs/grpc/node_modules/number-is-nan/readme.md
deleted file mode 100644 (file)
index 2463508..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# number-is-nan [![Build Status](https://travis-ci.org/sindresorhus/number-is-nan.svg?branch=master)](https://travis-ci.org/sindresorhus/number-is-nan)
-
-> ES2015 [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) [ponyfill](https://ponyfill.com)
-
-
-## Install
-
-```
-$ npm install --save number-is-nan
-```
-
-
-## Usage
-
-```js
-var numberIsNan = require('number-is-nan');
-
-numberIsNan(NaN);
-//=> true
-
-numberIsNan('unicorn');
-//=> false
-```
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/object-assign/index.js b/legacy-libs/grpc/node_modules/object-assign/index.js
deleted file mode 100644 (file)
index 0930cf8..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-object-assign
-(c) Sindre Sorhus
-@license MIT
-*/
-
-'use strict';
-/* eslint-disable no-unused-vars */
-var getOwnPropertySymbols = Object.getOwnPropertySymbols;
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-var propIsEnumerable = Object.prototype.propertyIsEnumerable;
-
-function toObject(val) {
-       if (val === null || val === undefined) {
-               throw new TypeError('Object.assign cannot be called with null or undefined');
-       }
-
-       return Object(val);
-}
-
-function shouldUseNative() {
-       try {
-               if (!Object.assign) {
-                       return false;
-               }
-
-               // Detect buggy property enumeration order in older V8 versions.
-
-               // https://bugs.chromium.org/p/v8/issues/detail?id=4118
-               var test1 = new String('abc');  // eslint-disable-line no-new-wrappers
-               test1[5] = 'de';
-               if (Object.getOwnPropertyNames(test1)[0] === '5') {
-                       return false;
-               }
-
-               // https://bugs.chromium.org/p/v8/issues/detail?id=3056
-               var test2 = {};
-               for (var i = 0; i < 10; i++) {
-                       test2['_' + String.fromCharCode(i)] = i;
-               }
-               var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
-                       return test2[n];
-               });
-               if (order2.join('') !== '0123456789') {
-                       return false;
-               }
-
-               // https://bugs.chromium.org/p/v8/issues/detail?id=3056
-               var test3 = {};
-               'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
-                       test3[letter] = letter;
-               });
-               if (Object.keys(Object.assign({}, test3)).join('') !==
-                               'abcdefghijklmnopqrst') {
-                       return false;
-               }
-
-               return true;
-       } catch (err) {
-               // We don't expect any of the above to throw, but better to be safe.
-               return false;
-       }
-}
-
-module.exports = shouldUseNative() ? Object.assign : function (target, source) {
-       var from;
-       var to = toObject(target);
-       var symbols;
-
-       for (var s = 1; s < arguments.length; s++) {
-               from = Object(arguments[s]);
-
-               for (var key in from) {
-                       if (hasOwnProperty.call(from, key)) {
-                               to[key] = from[key];
-                       }
-               }
-
-               if (getOwnPropertySymbols) {
-                       symbols = getOwnPropertySymbols(from);
-                       for (var i = 0; i < symbols.length; i++) {
-                               if (propIsEnumerable.call(from, symbols[i])) {
-                                       to[symbols[i]] = from[symbols[i]];
-                               }
-                       }
-               }
-       }
-
-       return to;
-};
diff --git a/legacy-libs/grpc/node_modules/object-assign/license b/legacy-libs/grpc/node_modules/object-assign/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/object-assign/package.json b/legacy-libs/grpc/node_modules/object-assign/package.json
deleted file mode 100644 (file)
index 5475db3..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-{
-  "_args": [
-    [
-      "object-assign@4.1.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "object-assign@4.1.1",
-  "_id": "object-assign@4.1.1",
-  "_inBundle": false,
-  "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
-  "_location": "/grpc/object-assign",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "object-assign@4.1.1",
-    "name": "object-assign",
-    "escapedName": "object-assign",
-    "rawSpec": "4.1.1",
-    "saveSpec": null,
-    "fetchSpec": "4.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/gauge"
-  ],
-  "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "4.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/object-assign/issues"
-  },
-  "dependencies": {},
-  "description": "ES2015 `Object.assign()` ponyfill",
-  "devDependencies": {
-    "ava": "^0.16.0",
-    "lodash": "^4.16.4",
-    "matcha": "^0.7.0",
-    "xo": "^0.16.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/object-assign#readme",
-  "keywords": [
-    "object",
-    "assign",
-    "extend",
-    "properties",
-    "es2015",
-    "ecmascript",
-    "harmony",
-    "ponyfill",
-    "prollyfill",
-    "polyfill",
-    "shim",
-    "browser"
-  ],
-  "license": "MIT",
-  "name": "object-assign",
-  "optionalDependencies": {},
-  "readme": "# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)\n\n> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)\n\n\n## Use the built-in\n\nNode.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari),\nsupport `Object.assign()` :tada:. If you target only those environments, then by all\nmeans, use `Object.assign()` instead of this package.\n\n\n## Install\n\n```\n$ npm install --save object-assign\n```\n\n\n## Usage\n\n```js\nconst objectAssign = require('object-assign');\n\nobjectAssign({foo: 0}, {bar: 1});\n//=> {foo: 0, bar: 1}\n\n// multiple sources\nobjectAssign({foo: 0}, {bar: 1}, {baz: 2});\n//=> {foo: 0, bar: 1, baz: 2}\n\n// overwrites equal keys\nobjectAssign({foo: 0}, {foo: 1}, {foo: 2});\n//=> {foo: 2}\n\n// ignores null and undefined sources\nobjectAssign({foo: 0}, null, {bar: 1}, undefined);\n//=> {foo: 0, bar: 1}\n```\n\n\n## API\n\n### objectAssign(target, [source, ...])\n\nAssigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.\n\n\n## Resources\n\n- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)\n\n\n## Related\n\n- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/object-assign.git"
-  },
-  "scripts": {
-    "bench": "matcha bench.js",
-    "test": "xo && ava"
-  },
-  "version": "4.1.1"
-}
diff --git a/legacy-libs/grpc/node_modules/object-assign/readme.md b/legacy-libs/grpc/node_modules/object-assign/readme.md
deleted file mode 100644 (file)
index 1be09d3..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)
-
-> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)
-
-
-## Use the built-in
-
-Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari),
-support `Object.assign()` :tada:. If you target only those environments, then by all
-means, use `Object.assign()` instead of this package.
-
-
-## Install
-
-```
-$ npm install --save object-assign
-```
-
-
-## Usage
-
-```js
-const objectAssign = require('object-assign');
-
-objectAssign({foo: 0}, {bar: 1});
-//=> {foo: 0, bar: 1}
-
-// multiple sources
-objectAssign({foo: 0}, {bar: 1}, {baz: 2});
-//=> {foo: 0, bar: 1, baz: 2}
-
-// overwrites equal keys
-objectAssign({foo: 0}, {foo: 1}, {foo: 2});
-//=> {foo: 2}
-
-// ignores null and undefined sources
-objectAssign({foo: 0}, null, {bar: 1}, undefined);
-//=> {foo: 0, bar: 1}
-```
-
-
-## API
-
-### objectAssign(target, [source, ...])
-
-Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
-
-
-## Resources
-
-- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
-
-
-## Related
-
-- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/once/LICENSE b/legacy-libs/grpc/node_modules/once/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/once/README.md b/legacy-libs/grpc/node_modules/once/README.md
deleted file mode 100644 (file)
index 1f1ffca..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# once
-
-Only call a function once.
-
-## usage
-
-```javascript
-var once = require('once')
-
-function load (file, cb) {
-  cb = once(cb)
-  loader.load('file')
-  loader.once('load', cb)
-  loader.once('error', cb)
-}
-```
-
-Or add to the Function.prototype in a responsible way:
-
-```javascript
-// only has to be done once
-require('once').proto()
-
-function load (file, cb) {
-  cb = cb.once()
-  loader.load('file')
-  loader.once('load', cb)
-  loader.once('error', cb)
-}
-```
-
-Ironically, the prototype feature makes this module twice as
-complicated as necessary.
-
-To check whether you function has been called, use `fn.called`. Once the
-function is called for the first time the return value of the original
-function is saved in `fn.value` and subsequent calls will continue to
-return this value.
-
-```javascript
-var once = require('once')
-
-function load (cb) {
-  cb = once(cb)
-  var stream = createStream()
-  stream.once('data', cb)
-  stream.once('end', function () {
-    if (!cb.called) cb(new Error('not found'))
-  })
-}
-```
-
-## `once.strict(func)`
-
-Throw an error if the function is called twice.
-
-Some functions are expected to be called only once. Using `once` for them would
-potentially hide logical errors.
-
-In the example below, the `greet` function has to call the callback only once:
-
-```javascript
-function greet (name, cb) {
-  // return is missing from the if statement
-  // when no name is passed, the callback is called twice
-  if (!name) cb('Hello anonymous')
-  cb('Hello ' + name)
-}
-
-function log (msg) {
-  console.log(msg)
-}
-
-// this will print 'Hello anonymous' but the logical error will be missed
-greet(null, once(msg))
-
-// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
-greet(null, once.strict(msg))
-```
diff --git a/legacy-libs/grpc/node_modules/once/once.js b/legacy-libs/grpc/node_modules/once/once.js
deleted file mode 100644 (file)
index 2354067..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-var wrappy = require('wrappy')
-module.exports = wrappy(once)
-module.exports.strict = wrappy(onceStrict)
-
-once.proto = once(function () {
-  Object.defineProperty(Function.prototype, 'once', {
-    value: function () {
-      return once(this)
-    },
-    configurable: true
-  })
-
-  Object.defineProperty(Function.prototype, 'onceStrict', {
-    value: function () {
-      return onceStrict(this)
-    },
-    configurable: true
-  })
-})
-
-function once (fn) {
-  var f = function () {
-    if (f.called) return f.value
-    f.called = true
-    return f.value = fn.apply(this, arguments)
-  }
-  f.called = false
-  return f
-}
-
-function onceStrict (fn) {
-  var f = function () {
-    if (f.called)
-      throw new Error(f.onceError)
-    f.called = true
-    return f.value = fn.apply(this, arguments)
-  }
-  var name = fn.name || 'Function wrapped with `once`'
-  f.onceError = name + " shouldn't be called more than once"
-  f.called = false
-  return f
-}
diff --git a/legacy-libs/grpc/node_modules/once/package.json b/legacy-libs/grpc/node_modules/once/package.json
deleted file mode 100644 (file)
index 2788f96..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-{
-  "_args": [
-    [
-      "once@1.4.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "once@1.4.0",
-  "_id": "once@1.4.0",
-  "_inBundle": false,
-  "_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
-  "_location": "/grpc/once",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "once@1.4.0",
-    "name": "once",
-    "escapedName": "once",
-    "rawSpec": "1.4.0",
-    "saveSpec": null,
-    "fetchSpec": "1.4.0"
-  },
-  "_requiredBy": [
-    "/grpc/inflight",
-    "/grpc/rimraf/glob"
-  ],
-  "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.4.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/once/issues"
-  },
-  "dependencies": {
-    "wrappy": "1"
-  },
-  "description": "Run a function exactly one time",
-  "devDependencies": {
-    "tap": "^7.0.1"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "once.js"
-  ],
-  "homepage": "https://github.com/isaacs/once#readme",
-  "keywords": [
-    "once",
-    "function",
-    "one",
-    "single"
-  ],
-  "license": "ISC",
-  "main": "once.js",
-  "name": "once",
-  "optionalDependencies": {},
-  "readme": "# once\n\nOnly call a function once.\n\n## usage\n\n```javascript\nvar once = require('once')\n\nfunction load (file, cb) {\n  cb = once(cb)\n  loader.load('file')\n  loader.once('load', cb)\n  loader.once('error', cb)\n}\n```\n\nOr add to the Function.prototype in a responsible way:\n\n```javascript\n// only has to be done once\nrequire('once').proto()\n\nfunction load (file, cb) {\n  cb = cb.once()\n  loader.load('file')\n  loader.once('load', cb)\n  loader.once('error', cb)\n}\n```\n\nIronically, the prototype feature makes this module twice as\ncomplicated as necessary.\n\nTo check whether you function has been called, use `fn.called`. Once the\nfunction is called for the first time the return value of the original\nfunction is saved in `fn.value` and subsequent calls will continue to\nreturn this value.\n\n```javascript\nvar once = require('once')\n\nfunction load (cb) {\n  cb = once(cb)\n  var stream = createStream()\n  stream.once('data', cb)\n  stream.once('end', function () {\n    if (!cb.called) cb(new Error('not found'))\n  })\n}\n```\n\n## `once.strict(func)`\n\nThrow an error if the function is called twice.\n\nSome functions are expected to be called only once. Using `once` for them would\npotentially hide logical errors.\n\nIn the example below, the `greet` function has to call the callback only once:\n\n```javascript\nfunction greet (name, cb) {\n  // return is missing from the if statement\n  // when no name is passed, the callback is called twice\n  if (!name) cb('Hello anonymous')\n  cb('Hello ' + name)\n}\n\nfunction log (msg) {\n  console.log(msg)\n}\n\n// this will print 'Hello anonymous' but the logical error will be missed\ngreet(null, once(msg))\n\n// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time\ngreet(null, once.strict(msg))\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/once.git"
-  },
-  "scripts": {
-    "test": "tap test/*.js"
-  },
-  "version": "1.4.0"
-}
diff --git a/legacy-libs/grpc/node_modules/os-homedir/index.js b/legacy-libs/grpc/node_modules/os-homedir/index.js
deleted file mode 100644 (file)
index 3306616..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-var os = require('os');
-
-function homedir() {
-       var env = process.env;
-       var home = env.HOME;
-       var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
-
-       if (process.platform === 'win32') {
-               return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
-       }
-
-       if (process.platform === 'darwin') {
-               return home || (user ? '/Users/' + user : null);
-       }
-
-       if (process.platform === 'linux') {
-               return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null));
-       }
-
-       return home || null;
-}
-
-module.exports = typeof os.homedir === 'function' ? os.homedir : homedir;
diff --git a/legacy-libs/grpc/node_modules/os-homedir/license b/legacy-libs/grpc/node_modules/os-homedir/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/os-homedir/package.json b/legacy-libs/grpc/node_modules/os-homedir/package.json
deleted file mode 100644 (file)
index b9fdeec..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-{
-  "_args": [
-    [
-      "os-homedir@1.0.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "os-homedir@1.0.2",
-  "_id": "os-homedir@1.0.2",
-  "_inBundle": false,
-  "_integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
-  "_location": "/grpc/os-homedir",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "os-homedir@1.0.2",
-    "name": "os-homedir",
-    "escapedName": "os-homedir",
-    "rawSpec": "1.0.2",
-    "saveSpec": null,
-    "fetchSpec": "1.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/osenv"
-  ],
-  "_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/os-homedir/issues"
-  },
-  "dependencies": {},
-  "description": "Node.js 4 `os.homedir()` ponyfill",
-  "devDependencies": {
-    "ava": "*",
-    "path-exists": "^2.0.0",
-    "xo": "^0.16.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/os-homedir#readme",
-  "keywords": [
-    "builtin",
-    "core",
-    "ponyfill",
-    "polyfill",
-    "shim",
-    "os",
-    "homedir",
-    "home",
-    "dir",
-    "directory",
-    "folder",
-    "user",
-    "path"
-  ],
-  "license": "MIT",
-  "name": "os-homedir",
-  "optionalDependencies": {},
-  "readme": "# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir)\n\n> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save os-homedir\n```\n\n\n## Usage\n\n```js\nconst osHomedir = require('os-homedir');\n\nconsole.log(osHomedir());\n//=> '/Users/sindresorhus'\n```\n\n\n## Related\n\n- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result\n- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/os-homedir.git"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "version": "1.0.2"
-}
diff --git a/legacy-libs/grpc/node_modules/os-homedir/readme.md b/legacy-libs/grpc/node_modules/os-homedir/readme.md
deleted file mode 100644 (file)
index 856ae61..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir)
-
-> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com)
-
-
-## Install
-
-```
-$ npm install --save os-homedir
-```
-
-
-## Usage
-
-```js
-const osHomedir = require('os-homedir');
-
-console.log(osHomedir());
-//=> '/Users/sindresorhus'
-```
-
-
-## Related
-
-- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result
-- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/index.js b/legacy-libs/grpc/node_modules/os-tmpdir/index.js
deleted file mode 100644 (file)
index 2077b1c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-var isWindows = process.platform === 'win32';
-var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
-
-// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43
-module.exports = function () {
-       var path;
-
-       if (isWindows) {
-               path = process.env.TEMP ||
-                       process.env.TMP ||
-                       (process.env.SystemRoot || process.env.windir) + '\\temp';
-       } else {
-               path = process.env.TMPDIR ||
-                       process.env.TMP ||
-                       process.env.TEMP ||
-                       '/tmp';
-       }
-
-       if (trailingSlashRe.test(path)) {
-               path = path.slice(0, -1);
-       }
-
-       return path;
-};
diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/license b/legacy-libs/grpc/node_modules/os-tmpdir/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/package.json b/legacy-libs/grpc/node_modules/os-tmpdir/package.json
deleted file mode 100644 (file)
index f7dea91..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-{
-  "_args": [
-    [
-      "os-tmpdir@1.0.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "os-tmpdir@1.0.2",
-  "_id": "os-tmpdir@1.0.2",
-  "_inBundle": false,
-  "_integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
-  "_location": "/grpc/os-tmpdir",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "os-tmpdir@1.0.2",
-    "name": "os-tmpdir",
-    "escapedName": "os-tmpdir",
-    "rawSpec": "1.0.2",
-    "saveSpec": null,
-    "fetchSpec": "1.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/osenv"
-  ],
-  "_resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/os-tmpdir/issues"
-  },
-  "dependencies": {},
-  "description": "Node.js os.tmpdir() ponyfill",
-  "devDependencies": {
-    "ava": "*",
-    "xo": "^0.16.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/os-tmpdir#readme",
-  "keywords": [
-    "built-in",
-    "core",
-    "ponyfill",
-    "polyfill",
-    "shim",
-    "os",
-    "tmpdir",
-    "tempdir",
-    "tmp",
-    "temp",
-    "dir",
-    "directory",
-    "env",
-    "environment"
-  ],
-  "license": "MIT",
-  "name": "os-tmpdir",
-  "optionalDependencies": {},
-  "readme": "# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir)\n\n> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com)\n\nUse this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8).\n\n\n## Install\n\n```\n$ npm install --save os-tmpdir\n```\n\n\n## Usage\n\n```js\nconst osTmpdir = require('os-tmpdir');\n\nosTmpdir();\n//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T'\n```\n\n\n## API\n\nSee the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir).\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/os-tmpdir.git"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "version": "1.0.2"
-}
diff --git a/legacy-libs/grpc/node_modules/os-tmpdir/readme.md b/legacy-libs/grpc/node_modules/os-tmpdir/readme.md
deleted file mode 100644 (file)
index c09f7ed..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir)
-
-> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com)
-
-Use this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8).
-
-
-## Install
-
-```
-$ npm install --save os-tmpdir
-```
-
-
-## Usage
-
-```js
-const osTmpdir = require('os-tmpdir');
-
-osTmpdir();
-//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T'
-```
-
-
-## API
-
-See the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir).
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/osenv/LICENSE b/legacy-libs/grpc/node_modules/osenv/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/osenv/README.md b/legacy-libs/grpc/node_modules/osenv/README.md
deleted file mode 100644 (file)
index 08fd900..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# osenv
-
-Look up environment settings specific to different operating systems.
-
-## Usage
-
-```javascript
-var osenv = require('osenv')
-var path = osenv.path()
-var user = osenv.user()
-// etc.
-
-// Some things are not reliably in the env, and have a fallback command:
-var h = osenv.hostname(function (er, hostname) {
-  h = hostname
-})
-// This will still cause it to be memoized, so calling osenv.hostname()
-// is now an immediate operation.
-
-// You can always send a cb, which will get called in the nextTick
-// if it's been memoized, or wait for the fallback data if it wasn't
-// found in the environment.
-osenv.hostname(function (er, hostname) {
-  if (er) console.error('error looking up hostname')
-  else console.log('this machine calls itself %s', hostname)
-})
-```
-
-## osenv.hostname()
-
-The machine name.  Calls `hostname` if not found.
-
-## osenv.user()
-
-The currently logged-in user.  Calls `whoami` if not found.
-
-## osenv.prompt()
-
-Either PS1 on unix, or PROMPT on Windows.
-
-## osenv.tmpdir()
-
-The place where temporary files should be created.
-
-## osenv.home()
-
-No place like it.
-
-## osenv.path()
-
-An array of the places that the operating system will search for
-executables.
-
-## osenv.editor() 
-
-Return the executable name of the editor program.  This uses the EDITOR
-and VISUAL environment variables, and falls back to `vi` on Unix, or
-`notepad.exe` on Windows.
-
-## osenv.shell()
-
-The SHELL on Unix, which Windows calls the ComSpec.  Defaults to 'bash'
-or 'cmd'.
diff --git a/legacy-libs/grpc/node_modules/osenv/osenv.js b/legacy-libs/grpc/node_modules/osenv/osenv.js
deleted file mode 100644 (file)
index 702a95b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-var isWindows = process.platform === 'win32'
-var path = require('path')
-var exec = require('child_process').exec
-var osTmpdir = require('os-tmpdir')
-var osHomedir = require('os-homedir')
-
-// looking up envs is a bit costly.
-// Also, sometimes we want to have a fallback
-// Pass in a callback to wait for the fallback on failures
-// After the first lookup, always returns the same thing.
-function memo (key, lookup, fallback) {
-  var fell = false
-  var falling = false
-  exports[key] = function (cb) {
-    var val = lookup()
-    if (!val && !fell && !falling && fallback) {
-      fell = true
-      falling = true
-      exec(fallback, function (er, output, stderr) {
-        falling = false
-        if (er) return // oh well, we tried
-        val = output.trim()
-      })
-    }
-    exports[key] = function (cb) {
-      if (cb) process.nextTick(cb.bind(null, null, val))
-      return val
-    }
-    if (cb && !falling) process.nextTick(cb.bind(null, null, val))
-    return val
-  }
-}
-
-memo('user', function () {
-  return ( isWindows
-         ? process.env.USERDOMAIN + '\\' + process.env.USERNAME
-         : process.env.USER
-         )
-}, 'whoami')
-
-memo('prompt', function () {
-  return isWindows ? process.env.PROMPT : process.env.PS1
-})
-
-memo('hostname', function () {
-  return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME
-}, 'hostname')
-
-memo('tmpdir', function () {
-  return osTmpdir()
-})
-
-memo('home', function () {
-  return osHomedir()
-})
-
-memo('path', function () {
-  return (process.env.PATH ||
-          process.env.Path ||
-          process.env.path).split(isWindows ? ';' : ':')
-})
-
-memo('editor', function () {
-  return process.env.EDITOR ||
-         process.env.VISUAL ||
-         (isWindows ? 'notepad.exe' : 'vi')
-})
-
-memo('shell', function () {
-  return isWindows ? process.env.ComSpec || 'cmd'
-         : process.env.SHELL || 'bash'
-})
diff --git a/legacy-libs/grpc/node_modules/osenv/package.json b/legacy-libs/grpc/node_modules/osenv/package.json
deleted file mode 100644 (file)
index abd077a..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-{
-  "_args": [
-    [
-      "osenv@0.1.5",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "osenv@0.1.5",
-  "_id": "osenv@0.1.5",
-  "_inBundle": false,
-  "_integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
-  "_location": "/grpc/osenv",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "osenv@0.1.5",
-    "name": "osenv",
-    "escapedName": "osenv",
-    "rawSpec": "0.1.5",
-    "saveSpec": null,
-    "fetchSpec": "0.1.5"
-  },
-  "_requiredBy": [
-    "/grpc/nopt"
-  ],
-  "_resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
-  "_shrinkwrap": null,
-  "_spec": "0.1.5",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/osenv/issues"
-  },
-  "dependencies": {
-    "os-homedir": "^1.0.0",
-    "os-tmpdir": "^1.0.0"
-  },
-  "description": "Look up environment settings specific to different operating systems",
-  "devDependencies": {
-    "tap": "^11.1.0"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "osenv.js"
-  ],
-  "homepage": "https://github.com/npm/osenv#readme",
-  "keywords": [
-    "environment",
-    "variable",
-    "home",
-    "tmpdir",
-    "path",
-    "prompt",
-    "ps1"
-  ],
-  "license": "ISC",
-  "main": "osenv.js",
-  "name": "osenv",
-  "optionalDependencies": {},
-  "readme": "# osenv\n\nLook up environment settings specific to different operating systems.\n\n## Usage\n\n```javascript\nvar osenv = require('osenv')\nvar path = osenv.path()\nvar user = osenv.user()\n// etc.\n\n// Some things are not reliably in the env, and have a fallback command:\nvar h = osenv.hostname(function (er, hostname) {\n  h = hostname\n})\n// This will still cause it to be memoized, so calling osenv.hostname()\n// is now an immediate operation.\n\n// You can always send a cb, which will get called in the nextTick\n// if it's been memoized, or wait for the fallback data if it wasn't\n// found in the environment.\nosenv.hostname(function (er, hostname) {\n  if (er) console.error('error looking up hostname')\n  else console.log('this machine calls itself %s', hostname)\n})\n```\n\n## osenv.hostname()\n\nThe machine name.  Calls `hostname` if not found.\n\n## osenv.user()\n\nThe currently logged-in user.  Calls `whoami` if not found.\n\n## osenv.prompt()\n\nEither PS1 on unix, or PROMPT on Windows.\n\n## osenv.tmpdir()\n\nThe place where temporary files should be created.\n\n## osenv.home()\n\nNo place like it.\n\n## osenv.path()\n\nAn array of the places that the operating system will search for\nexecutables.\n\n## osenv.editor() \n\nReturn the executable name of the editor program.  This uses the EDITOR\nand VISUAL environment variables, and falls back to `vi` on Unix, or\n`notepad.exe` on Windows.\n\n## osenv.shell()\n\nThe SHELL on Unix, which Windows calls the ComSpec.  Defaults to 'bash'\nor 'cmd'.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/osenv.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js"
-  },
-  "version": "0.1.5"
-}
diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/index.js b/legacy-libs/grpc/node_modules/path-is-absolute/index.js
deleted file mode 100644 (file)
index 22aa6c3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-function posix(path) {
-       return path.charAt(0) === '/';
-}
-
-function win32(path) {
-       // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
-       var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
-       var result = splitDeviceRe.exec(path);
-       var device = result[1] || '';
-       var isUnc = Boolean(device && device.charAt(1) !== ':');
-
-       // UNC paths are always absolute
-       return Boolean(result[2] || isUnc);
-}
-
-module.exports = process.platform === 'win32' ? win32 : posix;
-module.exports.posix = posix;
-module.exports.win32 = win32;
diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/license b/legacy-libs/grpc/node_modules/path-is-absolute/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/package.json b/legacy-libs/grpc/node_modules/path-is-absolute/package.json
deleted file mode 100644 (file)
index 0e28975..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-{
-  "_args": [
-    [
-      "path-is-absolute@1.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "path-is-absolute@1.0.1",
-  "_id": "path-is-absolute@1.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
-  "_location": "/grpc/path-is-absolute",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "path-is-absolute@1.0.1",
-    "name": "path-is-absolute",
-    "escapedName": "path-is-absolute",
-    "rawSpec": "1.0.1",
-    "saveSpec": null,
-    "fetchSpec": "1.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/rimraf/glob"
-  ],
-  "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/path-is-absolute/issues"
-  },
-  "dependencies": {},
-  "description": "Node.js 0.12 path.isAbsolute() ponyfill",
-  "devDependencies": {
-    "xo": "^0.16.0"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/path-is-absolute#readme",
-  "keywords": [
-    "path",
-    "paths",
-    "file",
-    "dir",
-    "absolute",
-    "isabsolute",
-    "is-absolute",
-    "built-in",
-    "util",
-    "utils",
-    "core",
-    "ponyfill",
-    "polyfill",
-    "shim",
-    "is",
-    "detect",
-    "check"
-  ],
-  "license": "MIT",
-  "name": "path-is-absolute",
-  "optionalDependencies": {},
-  "readme": "# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute)\n\n> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com)\n\n\n## Install\n\n```\n$ npm install --save path-is-absolute\n```\n\n\n## Usage\n\n```js\nconst pathIsAbsolute = require('path-is-absolute');\n\n// Running on Linux\npathIsAbsolute('/home/foo');\n//=> true\npathIsAbsolute('C:/Users/foo');\n//=> false\n\n// Running on Windows\npathIsAbsolute('C:/Users/foo');\n//=> true\npathIsAbsolute('/home/foo');\n//=> false\n\n// Running on any OS\npathIsAbsolute.posix('/home/foo');\n//=> true\npathIsAbsolute.posix('C:/Users/foo');\n//=> false\npathIsAbsolute.win32('C:/Users/foo');\n//=> true\npathIsAbsolute.win32('/home/foo');\n//=> false\n```\n\n\n## API\n\nSee the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path).\n\n### pathIsAbsolute(path)\n\n### pathIsAbsolute.posix(path)\n\nPOSIX specific version.\n\n### pathIsAbsolute.win32(path)\n\nWindows specific version.\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/path-is-absolute.git"
-  },
-  "scripts": {
-    "test": "xo && node test.js"
-  },
-  "version": "1.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/path-is-absolute/readme.md b/legacy-libs/grpc/node_modules/path-is-absolute/readme.md
deleted file mode 100644 (file)
index 8dbdf5f..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute)
-
-> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com)
-
-
-## Install
-
-```
-$ npm install --save path-is-absolute
-```
-
-
-## Usage
-
-```js
-const pathIsAbsolute = require('path-is-absolute');
-
-// Running on Linux
-pathIsAbsolute('/home/foo');
-//=> true
-pathIsAbsolute('C:/Users/foo');
-//=> false
-
-// Running on Windows
-pathIsAbsolute('C:/Users/foo');
-//=> true
-pathIsAbsolute('/home/foo');
-//=> false
-
-// Running on any OS
-pathIsAbsolute.posix('/home/foo');
-//=> true
-pathIsAbsolute.posix('C:/Users/foo');
-//=> false
-pathIsAbsolute.win32('C:/Users/foo');
-//=> true
-pathIsAbsolute.win32('/home/foo');
-//=> false
-```
-
-
-## API
-
-See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path).
-
-### pathIsAbsolute(path)
-
-### pathIsAbsolute.posix(path)
-
-POSIX specific version.
-
-### pathIsAbsolute.win32(path)
-
-Windows specific version.
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/index.js b/legacy-libs/grpc/node_modules/process-nextick-args/index.js
deleted file mode 100644 (file)
index 3eecf11..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-'use strict';
-
-if (typeof process === 'undefined' ||
-    !process.version ||
-    process.version.indexOf('v0.') === 0 ||
-    process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
-  module.exports = { nextTick: nextTick };
-} else {
-  module.exports = process
-}
-
-function nextTick(fn, arg1, arg2, arg3) {
-  if (typeof fn !== 'function') {
-    throw new TypeError('"callback" argument must be a function');
-  }
-  var len = arguments.length;
-  var args, i;
-  switch (len) {
-  case 0:
-  case 1:
-    return process.nextTick(fn);
-  case 2:
-    return process.nextTick(function afterTickOne() {
-      fn.call(null, arg1);
-    });
-  case 3:
-    return process.nextTick(function afterTickTwo() {
-      fn.call(null, arg1, arg2);
-    });
-  case 4:
-    return process.nextTick(function afterTickThree() {
-      fn.call(null, arg1, arg2, arg3);
-    });
-  default:
-    args = new Array(len - 1);
-    i = 0;
-    while (i < args.length) {
-      args[i++] = arguments[i];
-    }
-    return process.nextTick(function afterTick() {
-      fn.apply(null, args);
-    });
-  }
-}
-
diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/license.md b/legacy-libs/grpc/node_modules/process-nextick-args/license.md
deleted file mode 100644 (file)
index c67e353..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2015 Calvin Metcalf
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.**
diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/package.json b/legacy-libs/grpc/node_modules/process-nextick-args/package.json
deleted file mode 100644 (file)
index d1bf0b2..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-{
-  "_from": "process-nextick-args@~2.0.0",
-  "_id": "process-nextick-args@2.0.1",
-  "_inBundle": false,
-  "_integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
-  "_location": "/grpc/process-nextick-args",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "process-nextick-args@~2.0.0",
-    "name": "process-nextick-args",
-    "escapedName": "process-nextick-args",
-    "rawSpec": "~2.0.0",
-    "saveSpec": null,
-    "fetchSpec": "~2.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/readable-stream"
-  ],
-  "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
-  "_shasum": "7820d9b16120cc55ca9ae7792680ae7dba6d7fe2",
-  "_shrinkwrap": null,
-  "_spec": "process-nextick-args@~2.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/readable-stream",
-  "author": "",
-  "bugs": {
-    "url": "https://github.com/calvinmetcalf/process-nextick-args/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "process.nextTick but always with args",
-  "devDependencies": {
-    "tap": "~0.2.6"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/calvinmetcalf/process-nextick-args",
-  "license": "MIT",
-  "main": "index.js",
-  "name": "process-nextick-args",
-  "optionalDependencies": {},
-  "readme": "process-nextick-args\n=====\n\n[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)\n\n```bash\nnpm install --save process-nextick-args\n```\n\nAlways be able to pass arguments to process.nextTick, no matter the platform\n\n```js\nvar pna = require('process-nextick-args');\n\npna.nextTick(function (a, b, c) {\n  console.log(a, b, c);\n}, 'step', 3,  'profit');\n```\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/calvinmetcalf/process-nextick-args.git"
-  },
-  "scripts": {
-    "test": "node test.js"
-  },
-  "version": "2.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/process-nextick-args/readme.md b/legacy-libs/grpc/node_modules/process-nextick-args/readme.md
deleted file mode 100644 (file)
index ecb432c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-process-nextick-args
-=====
-
-[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)
-
-```bash
-npm install --save process-nextick-args
-```
-
-Always be able to pass arguments to process.nextTick, no matter the platform
-
-```js
-var pna = require('process-nextick-args');
-
-pna.nextTick(function (a, b, c) {
-  console.log(a, b, c);
-}, 'step', 3,  'profit');
-```
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/README.md b/legacy-libs/grpc/node_modules/protobufjs/dist/README.md
new file mode 100644 (file)
index 0000000..62f3fc8
--- /dev/null
@@ -0,0 +1,35 @@
+Distributions\r
+=============\r
+\r
+ProtoBuf.js is available either with or without the .proto parser included.\r
+\r
+### Full build including .proto parser (.proto and JSON)\r
+\r
+* **[protobuf.js](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf.js)**\r
+  contains the commented source code.\r
+\r
+* **[protobuf.min.js](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf.min.js)**\r
+  has been compiled with Closure Compiler.\r
+  \r
+* **[protobuf.min.js.gz](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf.min.js.gz)**\r
+  has also been gzipped using `-9`.\r
+  \r
+* **[protobuf.min.map](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf.min.map)**\r
+  is the source map generated by Closure Compiler.\r
+  \r
+### Light build excluding .proto parser (JSON only) for use with [pbjs](https://github.com/dcodeIO/Protobuf.js/wiki/pbjs)\r
+\r
+* **[protobuf-light.js](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf-light.js)**\r
+  contains the commented source code.\r
+\r
+* **[protobuf-light.min.js](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf-light.min.js)**\r
+  has been compiled with Closure Compiler.\r
+  \r
+* **[protobuf-light.min.js.gz](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf-light.min.js.gz)**\r
+  has also been gzipped using `-9`.\r
+  \r
+* **[protobuf-light.min.map](https://raw.githubusercontent.com/dcodeIO/ProtoBuf.js/master/dist/protobuf-light.min.map)**\r
+  is the source map generated by Closure Compiler.\r
+  \r
+When sending pull requests, please note that these files have been automatically generated from the sources located in\r
+[src/](https://github.com/dcodeIO/protobuf.js/tree/master/src).\r
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.js b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.js
new file mode 100644 (file)
index 0000000..1696e64
--- /dev/null
@@ -0,0 +1,4275 @@
+/*\r
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+ */\r
+\r
+/**\r
+ * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>\r
+ * Released under the Apache License, Version 2.0\r
+ * see: https://github.com/dcodeIO/protobuf.js for details\r
+ */\r
+(function(global, factory) {\r
+\r
+    /* AMD */ if (typeof define === 'function' && define["amd"])\r
+        define(["bytebuffer"], factory);\r
+    /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])\r
+        module["exports"] = factory(require("bytebuffer"), true);\r
+    /* Global */ else\r
+        (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);\r
+\r
+})(this, function(ByteBuffer, isCommonJS) {\r
+    "use strict";\r
+\r
+    /**\r
+     * The ProtoBuf namespace.\r
+     * @exports ProtoBuf\r
+     * @namespace\r
+     * @expose\r
+     */\r
+    var ProtoBuf = {};\r
+\r
+    /**\r
+     * @type {!function(new: ByteBuffer, ...[*])}\r
+     * @expose\r
+     */\r
+    ProtoBuf.ByteBuffer = ByteBuffer;\r
+\r
+    /**\r
+     * @type {?function(new: Long, ...[*])}\r
+     * @expose\r
+     */\r
+    ProtoBuf.Long = ByteBuffer.Long || null;\r
+\r
+    /**\r
+     * ProtoBuf.js version.\r
+     * @type {string}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.VERSION = "5.0.3";\r
+\r
+    /**\r
+     * Wire types.\r
+     * @type {Object.<string,number>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES = {};\r
+\r
+    /**\r
+     * Varint wire type.\r
+     * @type {number}\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.VARINT = 0;\r
+\r
+    /**\r
+     * Fixed 64 bits wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.BITS64 = 1;\r
+\r
+    /**\r
+     * Length delimited wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.LDELIM = 2;\r
+\r
+    /**\r
+     * Start group wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.STARTGROUP = 3;\r
+\r
+    /**\r
+     * End group wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.ENDGROUP = 4;\r
+\r
+    /**\r
+     * Fixed 32 bits wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.BITS32 = 5;\r
+\r
+    /**\r
+     * Packable wire types.\r
+     * @type {!Array.<number>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.PACKABLE_WIRE_TYPES = [\r
+        ProtoBuf.WIRE_TYPES.VARINT,\r
+        ProtoBuf.WIRE_TYPES.BITS64,\r
+        ProtoBuf.WIRE_TYPES.BITS32\r
+    ];\r
+\r
+    /**\r
+     * Types.\r
+     * @dict\r
+     * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.TYPES = {\r
+        // According to the protobuf spec.\r
+        "int32": {\r
+            name: "int32",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "uint32": {\r
+            name: "uint32",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "sint32": {\r
+            name: "sint32",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "int64": {\r
+            name: "int64",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined\r
+        },\r
+        "uint64": {\r
+            name: "uint64",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined\r
+        },\r
+        "sint64": {\r
+            name: "sint64",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined\r
+        },\r
+        "bool": {\r
+            name: "bool",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: false\r
+        },\r
+        "double": {\r
+            name: "double",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,\r
+            defaultValue: 0\r
+        },\r
+        "string": {\r
+            name: "string",\r
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,\r
+            defaultValue: ""\r
+        },\r
+        "bytes": {\r
+            name: "bytes",\r
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,\r
+            defaultValue: null // overridden in the code, must be a unique instance\r
+        },\r
+        "fixed32": {\r
+            name: "fixed32",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,\r
+            defaultValue: 0\r
+        },\r
+        "sfixed32": {\r
+            name: "sfixed32",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,\r
+            defaultValue: 0\r
+        },\r
+        "fixed64": {\r
+            name: "fixed64",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,\r
+            defaultValue:  ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined\r
+        },\r
+        "sfixed64": {\r
+            name: "sfixed64",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined\r
+        },\r
+        "float": {\r
+            name: "float",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,\r
+            defaultValue: 0\r
+        },\r
+        "enum": {\r
+            name: "enum",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "message": {\r
+            name: "message",\r
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,\r
+            defaultValue: null\r
+        },\r
+        "group": {\r
+            name: "group",\r
+            wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,\r
+            defaultValue: null\r
+        }\r
+    };\r
+\r
+    /**\r
+     * Valid map key types.\r
+     * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.MAP_KEY_TYPES = [\r
+        ProtoBuf.TYPES["int32"],\r
+        ProtoBuf.TYPES["sint32"],\r
+        ProtoBuf.TYPES["sfixed32"],\r
+        ProtoBuf.TYPES["uint32"],\r
+        ProtoBuf.TYPES["fixed32"],\r
+        ProtoBuf.TYPES["int64"],\r
+        ProtoBuf.TYPES["sint64"],\r
+        ProtoBuf.TYPES["sfixed64"],\r
+        ProtoBuf.TYPES["uint64"],\r
+        ProtoBuf.TYPES["fixed64"],\r
+        ProtoBuf.TYPES["bool"],\r
+        ProtoBuf.TYPES["string"],\r
+        ProtoBuf.TYPES["bytes"]\r
+    ];\r
+\r
+    /**\r
+     * Minimum field id.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.ID_MIN = 1;\r
+\r
+    /**\r
+     * Maximum field id.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.ID_MAX = 0x1FFFFFFF;\r
+\r
+    /**\r
+     * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.\r
+     *  Must be set prior to parsing.\r
+     * @type {boolean}\r
+     * @expose\r
+     */\r
+    ProtoBuf.convertFieldsToCamelCase = false;\r
+\r
+    /**\r
+     * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by\r
+     *  setting this to `false` prior to building messages.\r
+     * @type {boolean}\r
+     * @expose\r
+     */\r
+    ProtoBuf.populateAccessors = true;\r
+\r
+    /**\r
+     * By default, messages are populated with default values if a field is not present on the wire. To disable\r
+     *  this behavior, set this setting to `false`.\r
+     * @type {boolean}\r
+     * @expose\r
+     */\r
+    ProtoBuf.populateDefaults = true;\r
+\r
+    /**\r
+     * @alias ProtoBuf.Util\r
+     * @expose\r
+     */\r
+    ProtoBuf.Util = (function() {\r
+        "use strict";\r
+\r
+        /**\r
+         * ProtoBuf utilities.\r
+         * @exports ProtoBuf.Util\r
+         * @namespace\r
+         */\r
+        var Util = {};\r
+\r
+        /**\r
+         * Flag if running in node or not.\r
+         * @type {boolean}\r
+         * @const\r
+         * @expose\r
+         */\r
+        Util.IS_NODE = !!(\r
+            typeof process === 'object' && process+'' === '[object process]' && !process['browser']\r
+        );\r
+\r
+        /**\r
+         * Constructs a XMLHttpRequest object.\r
+         * @return {XMLHttpRequest}\r
+         * @throws {Error} If XMLHttpRequest is not supported\r
+         * @expose\r
+         */\r
+        Util.XHR = function() {\r
+            // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html\r
+            var XMLHttpFactories = [\r
+                function () {return new XMLHttpRequest()},\r
+                function () {return new ActiveXObject("Msxml2.XMLHTTP")},\r
+                function () {return new ActiveXObject("Msxml3.XMLHTTP")},\r
+                function () {return new ActiveXObject("Microsoft.XMLHTTP")}\r
+            ];\r
+            /** @type {?XMLHttpRequest} */\r
+            var xhr = null;\r
+            for (var i=0;i<XMLHttpFactories.length;i++) {\r
+                try { xhr = XMLHttpFactories[i](); }\r
+                catch (e) { continue; }\r
+                break;\r
+            }\r
+            if (!xhr)\r
+                throw Error("XMLHttpRequest is not supported");\r
+            return xhr;\r
+        };\r
+\r
+        /**\r
+         * Fetches a resource.\r
+         * @param {string} path Resource path\r
+         * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will\r
+         *   be fetched synchronously. If the request failed, contents will be null.\r
+         * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.\r
+         * @expose\r
+         */\r
+        Util.fetch = function(path, callback) {\r
+            if (callback && typeof callback != 'function')\r
+                callback = null;\r
+            if (Util.IS_NODE) {\r
+                var fs = require("fs");\r
+                if (callback) {\r
+                    fs.readFile(path, function(err, data) {\r
+                        if (err)\r
+                            callback(null);\r
+                        else\r
+                            callback(""+data);\r
+                    });\r
+                } else\r
+                    try {\r
+                        return fs.readFileSync(path);\r
+                    } catch (e) {\r
+                        return null;\r
+                    }\r
+            } else {\r
+                var xhr = Util.XHR();\r
+                xhr.open('GET', path, callback ? true : false);\r
+                // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');\r
+                xhr.setRequestHeader('Accept', 'text/plain');\r
+                if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');\r
+                if (callback) {\r
+                    xhr.onreadystatechange = function() {\r
+                        if (xhr.readyState != 4) return;\r
+                        if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))\r
+                            callback(xhr.responseText);\r
+                        else\r
+                            callback(null);\r
+                    };\r
+                    if (xhr.readyState == 4)\r
+                        return;\r
+                    xhr.send(null);\r
+                } else {\r
+                    xhr.send(null);\r
+                    if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))\r
+                        return xhr.responseText;\r
+                    return null;\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Converts a string to camel case.\r
+         * @param {string} str\r
+         * @returns {string}\r
+         * @expose\r
+         */\r
+        Util.toCamelCase = function(str) {\r
+            return str.replace(/_([a-zA-Z])/g, function ($0, $1) {\r
+                return $1.toUpperCase();\r
+            });\r
+        };\r
+\r
+        return Util;\r
+    })();\r
+\r
+    /**\r
+     * Language expressions.\r
+     * @type {!Object.<string,!RegExp>}\r
+     * @expose\r
+     */\r
+    ProtoBuf.Lang = {\r
+\r
+        // Characters always ending a statement\r
+        DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,\r
+\r
+        // Field rules\r
+        RULE: /^(?:required|optional|repeated|map)$/,\r
+\r
+        // Field types\r
+        TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,\r
+\r
+        // Names\r
+        NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,\r
+\r
+        // Type definitions\r
+        TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,\r
+\r
+        // Type references\r
+        TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\r
+\r
+        // Fully qualified type references\r
+        FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,\r
+\r
+        // All numbers\r
+        NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,\r
+\r
+        // Decimal numbers\r
+        NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,\r
+\r
+        // Hexadecimal numbers\r
+        NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,\r
+\r
+        // Octal numbers\r
+        NUMBER_OCT: /^0[0-7]+$/,\r
+\r
+        // Floating point numbers\r
+        NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,\r
+\r
+        // Booleans\r
+        BOOL: /^(?:true|false)$/i,\r
+\r
+        // Id numbers\r
+        ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,\r
+\r
+        // Negative id numbers (enum values)\r
+        NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,\r
+\r
+        // Whitespaces\r
+        WHITESPACE: /\s/,\r
+\r
+        // All strings\r
+        STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,\r
+\r
+        // Double quoted strings\r
+        STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,\r
+\r
+        // Single quoted strings\r
+        STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g\r
+    };\r
+\r
+\r
+    /**\r
+     * @alias ProtoBuf.Reflect\r
+     * @expose\r
+     */\r
+    ProtoBuf.Reflect = (function(ProtoBuf) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Reflection types.\r
+         * @exports ProtoBuf.Reflect\r
+         * @namespace\r
+         */\r
+        var Reflect = {};\r
+\r
+        /**\r
+         * Constructs a Reflect base class.\r
+         * @exports ProtoBuf.Reflect.T\r
+         * @constructor\r
+         * @abstract\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {?ProtoBuf.Reflect.T} parent Parent object\r
+         * @param {string} name Object name\r
+         */\r
+        var T = function(builder, parent, name) {\r
+\r
+            /**\r
+             * Builder reference.\r
+             * @type {!ProtoBuf.Builder}\r
+             * @expose\r
+             */\r
+            this.builder = builder;\r
+\r
+            /**\r
+             * Parent object.\r
+             * @type {?ProtoBuf.Reflect.T}\r
+             * @expose\r
+             */\r
+            this.parent = parent;\r
+\r
+            /**\r
+             * Object name in namespace.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.name = name;\r
+\r
+            /**\r
+             * Fully qualified class name\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.className;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.T.prototype\r
+         * @inner\r
+         */\r
+        var TPrototype = T.prototype;\r
+\r
+        /**\r
+         * Returns the fully qualified name of this object.\r
+         * @returns {string} Fully qualified name as of ".PATH.TO.THIS"\r
+         * @expose\r
+         */\r
+        TPrototype.fqn = function() {\r
+            var name = this.name,\r
+                ptr = this;\r
+            do {\r
+                ptr = ptr.parent;\r
+                if (ptr == null)\r
+                    break;\r
+                name = ptr.name+"."+name;\r
+            } while (true);\r
+            return name;\r
+        };\r
+\r
+        /**\r
+         * Returns a string representation of this Reflect object (its fully qualified name).\r
+         * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.\r
+         * @return String representation\r
+         * @expose\r
+         */\r
+        TPrototype.toString = function(includeClass) {\r
+            return (includeClass ? this.className + " " : "") + this.fqn();\r
+        };\r
+\r
+        /**\r
+         * Builds this type.\r
+         * @throws {Error} If this type cannot be built directly\r
+         * @expose\r
+         */\r
+        TPrototype.build = function() {\r
+            throw Error(this.toString(true)+" cannot be built directly");\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.T\r
+         * @expose\r
+         */\r
+        Reflect.T = T;\r
+\r
+        /**\r
+         * Constructs a new Namespace.\r
+         * @exports ProtoBuf.Reflect.Namespace\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent\r
+         * @param {string} name Namespace name\r
+         * @param {Object.<string,*>=} options Namespace options\r
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Namespace = function(builder, parent, name, options, syntax) {\r
+            T.call(this, builder, parent, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Namespace";\r
+\r
+            /**\r
+             * Children inside the namespace.\r
+             * @type {!Array.<ProtoBuf.Reflect.T>}\r
+             */\r
+            this.children = [];\r
+\r
+            /**\r
+             * Options.\r
+             * @type {!Object.<string, *>}\r
+             */\r
+            this.options = options || {};\r
+\r
+            /**\r
+             * Syntax level (e.g., proto2 or proto3).\r
+             * @type {!string}\r
+             */\r
+            this.syntax = syntax || "proto2";\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Namespace.prototype\r
+         * @inner\r
+         */\r
+        var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * Returns an array of the namespace's children.\r
+         * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).\r
+         * @return {Array.<ProtoBuf.Reflect.T>}\r
+         * @expose\r
+         */\r
+        NamespacePrototype.getChildren = function(type) {\r
+            type = type || null;\r
+            if (type == null)\r
+                return this.children.slice();\r
+            var children = [];\r
+            for (var i=0, k=this.children.length; i<k; ++i)\r
+                if (this.children[i] instanceof type)\r
+                    children.push(this.children[i]);\r
+            return children;\r
+        };\r
+\r
+        /**\r
+         * Adds a child to the namespace.\r
+         * @param {ProtoBuf.Reflect.T} child Child\r
+         * @throws {Error} If the child cannot be added (duplicate)\r
+         * @expose\r
+         */\r
+        NamespacePrototype.addChild = function(child) {\r
+            var other;\r
+            if (other = this.getChild(child.name)) {\r
+                // Try to revert camelcase transformation on collision\r
+                if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)\r
+                    other.name = other.originalName; // Revert previous first (effectively keeps both originals)\r
+                else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)\r
+                    child.name = child.originalName;\r
+                else\r
+                    throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);\r
+            }\r
+            this.children.push(child);\r
+        };\r
+\r
+        /**\r
+         * Gets a child by its name or id.\r
+         * @param {string|number} nameOrId Child name or id\r
+         * @return {?ProtoBuf.Reflect.T} The child or null if not found\r
+         * @expose\r
+         */\r
+        NamespacePrototype.getChild = function(nameOrId) {\r
+            var key = typeof nameOrId === 'number' ? 'id' : 'name';\r
+            for (var i=0, k=this.children.length; i<k; ++i)\r
+                if (this.children[i][key] === nameOrId)\r
+                    return this.children[i];\r
+            return null;\r
+        };\r
+\r
+        /**\r
+         * Resolves a reflect object inside of this namespace.\r
+         * @param {string|!Array.<string>} qn Qualified name to resolve\r
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`\r
+         * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found\r
+         * @expose\r
+         */\r
+        NamespacePrototype.resolve = function(qn, excludeNonNamespace) {\r
+            var part = typeof qn === 'string' ? qn.split(".") : qn,\r
+                ptr = this,\r
+                i = 0;\r
+            if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'\r
+                while (ptr.parent !== null)\r
+                    ptr = ptr.parent;\r
+                i++;\r
+            }\r
+            var child;\r
+            do {\r
+                do {\r
+                    if (!(ptr instanceof Reflect.Namespace)) {\r
+                        ptr = null;\r
+                        break;\r
+                    }\r
+                    child = ptr.getChild(part[i]);\r
+                    if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {\r
+                        ptr = null;\r
+                        break;\r
+                    }\r
+                    ptr = child; i++;\r
+                } while (i < part.length);\r
+                if (ptr != null)\r
+                    break; // Found\r
+                // Else search the parent\r
+                if (this.parent !== null)\r
+                    return this.parent.resolve(qn, excludeNonNamespace);\r
+            } while (ptr != null);\r
+            return ptr;\r
+        };\r
+\r
+        /**\r
+         * Determines the shortest qualified name of the specified type, if any, relative to this namespace.\r
+         * @param {!ProtoBuf.Reflect.T} t Reflection type\r
+         * @returns {string} The shortest qualified name or, if there is none, the fqn\r
+         * @expose\r
+         */\r
+        NamespacePrototype.qn = function(t) {\r
+            var part = [], ptr = t;\r
+            do {\r
+                part.unshift(ptr.name);\r
+                ptr = ptr.parent;\r
+            } while (ptr !== null);\r
+            for (var len=1; len <= part.length; len++) {\r
+                var qn = part.slice(part.length-len);\r
+                if (t === this.resolve(qn, t instanceof Reflect.Namespace))\r
+                    return qn.join(".");\r
+            }\r
+            return t.fqn();\r
+        };\r
+\r
+        /**\r
+         * Builds the namespace and returns the runtime counterpart.\r
+         * @return {Object.<string,Function|Object>} Runtime namespace\r
+         * @expose\r
+         */\r
+        NamespacePrototype.build = function() {\r
+            /** @dict */\r
+            var ns = {};\r
+            var children = this.children;\r
+            for (var i=0, k=children.length, child; i<k; ++i) {\r
+                child = children[i];\r
+                if (child instanceof Namespace)\r
+                    ns[child.name] = child.build();\r
+            }\r
+            if (Object.defineProperty)\r
+                Object.defineProperty(ns, "$options", { "value": this.buildOpt() });\r
+            return ns;\r
+        };\r
+\r
+        /**\r
+         * Builds the namespace's '$options' property.\r
+         * @return {Object.<string,*>}\r
+         */\r
+        NamespacePrototype.buildOpt = function() {\r
+            var opt = {},\r
+                keys = Object.keys(this.options);\r
+            for (var i=0, k=keys.length; i<k; ++i) {\r
+                var key = keys[i],\r
+                    val = this.options[keys[i]];\r
+                // TODO: Options are not resolved, yet.\r
+                // if (val instanceof Namespace) {\r
+                //     opt[key] = val.build();\r
+                // } else {\r
+                opt[key] = val;\r
+                // }\r
+            }\r
+            return opt;\r
+        };\r
+\r
+        /**\r
+         * Gets the value assigned to the option with the specified name.\r
+         * @param {string=} name Returns the option value if specified, otherwise all options are returned.\r
+         * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option\r
+         */\r
+        NamespacePrototype.getOption = function(name) {\r
+            if (typeof name === 'undefined')\r
+                return this.options;\r
+            return typeof this.options[name] !== 'undefined' ? this.options[name] : null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Namespace\r
+         * @expose\r
+         */\r
+        Reflect.Namespace = Namespace;\r
+\r
+        /**\r
+         * Constructs a new Element implementation that checks and converts values for a\r
+         * particular field type, as appropriate.\r
+         *\r
+         * An Element represents a single value: either the value of a singular field,\r
+         * or a value contained in one entry of a repeated field or map field. This\r
+         * class does not implement these higher-level concepts; it only encapsulates\r
+         * the low-level typechecking and conversion.\r
+         *\r
+         * @exports ProtoBuf.Reflect.Element\r
+         * @param {{name: string, wireType: number}} type Resolved data type\r
+         * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant\r
+         * (e.g. submessage field).\r
+         * @param {boolean} isMapKey Is this element a Map key? The value will be\r
+         * converted to string form if so.\r
+         * @param {string} syntax Syntax level of defining message type, e.g.,\r
+         * proto2 or proto3.\r
+         * @param {string} name Name of the field containing this element (for error\r
+         * messages)\r
+         * @constructor\r
+         */\r
+        var Element = function(type, resolvedType, isMapKey, syntax, name) {\r
+\r
+            /**\r
+             * Element type, as a string (e.g., int32).\r
+             * @type {{name: string, wireType: number}}\r
+             */\r
+            this.type = type;\r
+\r
+            /**\r
+             * Element type reference to submessage or enum definition, if needed.\r
+             * @type {ProtoBuf.Reflect.T|null}\r
+             */\r
+            this.resolvedType = resolvedType;\r
+\r
+            /**\r
+             * Element is a map key.\r
+             * @type {boolean}\r
+             */\r
+            this.isMapKey = isMapKey;\r
+\r
+            /**\r
+             * Syntax level of defining message type, e.g., proto2 or proto3.\r
+             * @type {string}\r
+             */\r
+            this.syntax = syntax;\r
+\r
+            /**\r
+             * Name of the field containing this element (for error messages)\r
+             * @type {string}\r
+             */\r
+            this.name = name;\r
+\r
+            if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)\r
+                throw Error("Invalid map key type: " + type.name);\r
+        };\r
+\r
+        var ElementPrototype = Element.prototype;\r
+\r
+        /**\r
+         * Obtains a (new) default value for the specified type.\r
+         * @param type {string|{name: string, wireType: number}} Field type\r
+         * @returns {*} Default value\r
+         * @inner\r
+         */\r
+        function mkDefault(type) {\r
+            if (typeof type === 'string')\r
+                type = ProtoBuf.TYPES[type];\r
+            if (typeof type.defaultValue === 'undefined')\r
+                throw Error("default value for type "+type.name+" is not supported");\r
+            if (type == ProtoBuf.TYPES["bytes"])\r
+                return new ByteBuffer(0);\r
+            return type.defaultValue;\r
+        }\r
+\r
+        /**\r
+         * Returns the default value for this field in proto3.\r
+         * @function\r
+         * @param type {string|{name: string, wireType: number}} the field type\r
+         * @returns {*} Default value\r
+         */\r
+        Element.defaultFieldValue = mkDefault;\r
+\r
+        /**\r
+         * Makes a Long from a value.\r
+         * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value\r
+         * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for\r
+         *  strings and numbers\r
+         * @returns {!Long}\r
+         * @throws {Error} If the value cannot be converted to a Long\r
+         * @inner\r
+         */\r
+        function mkLong(value, unsigned) {\r
+            if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'\r
+                && value.low === value.low && value.high === value.high)\r
+                return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);\r
+            if (typeof value === 'string')\r
+                return ProtoBuf.Long.fromString(value, unsigned || false, 10);\r
+            if (typeof value === 'number')\r
+                return ProtoBuf.Long.fromNumber(value, unsigned || false);\r
+            throw Error("not convertible to Long");\r
+        }\r
+\r
+        ElementPrototype.toString = function() {\r
+            return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';\r
+        }\r
+\r
+        /**\r
+         * Checks if the given value can be set for an element of this type (singular\r
+         * field or one element of a repeated field or map).\r
+         * @param {*} value Value to check\r
+         * @return {*} Verified, maybe adjusted, value\r
+         * @throws {Error} If the value cannot be verified for this element slot\r
+         * @expose\r
+         */\r
+        ElementPrototype.verifyValue = function(value) {\r
+            var self = this;\r
+            function fail(val, msg) {\r
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");\r
+            }\r
+            switch (this.type) {\r
+                // Signed 32bit\r
+                case ProtoBuf.TYPES["int32"]:\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                    // Account for !NaN: value === value\r
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))\r
+                        fail(typeof value, "not an integer");\r
+                    return value > 4294967295 ? value | 0 : value;\r
+\r
+                // Unsigned 32bit\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))\r
+                        fail(typeof value, "not an integer");\r
+                    return value < 0 ? value >>> 0 : value;\r
+\r
+                // Signed 64bit\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]: {\r
+                    if (ProtoBuf.Long)\r
+                        try {\r
+                            return mkLong(value, false);\r
+                        } catch (e) {\r
+                            fail(typeof value, e.message);\r
+                        }\r
+                    else\r
+                        fail(typeof value, "requires Long.js");\r
+                }\r
+\r
+                // Unsigned 64bit\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                case ProtoBuf.TYPES["fixed64"]: {\r
+                    if (ProtoBuf.Long)\r
+                        try {\r
+                            return mkLong(value, true);\r
+                        } catch (e) {\r
+                            fail(typeof value, e.message);\r
+                        }\r
+                    else\r
+                        fail(typeof value, "requires Long.js");\r
+                }\r
+\r
+                // Bool\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    if (typeof value !== 'boolean')\r
+                        fail(typeof value, "not a boolean");\r
+                    return value;\r
+\r
+                // Float\r
+                case ProtoBuf.TYPES["float"]:\r
+                case ProtoBuf.TYPES["double"]:\r
+                    if (typeof value !== 'number')\r
+                        fail(typeof value, "not a number");\r
+                    return value;\r
+\r
+                // Length-delimited string\r
+                case ProtoBuf.TYPES["string"]:\r
+                    if (typeof value !== 'string' && !(value && value instanceof String))\r
+                        fail(typeof value, "not a string");\r
+                    return ""+value; // Convert String object to string\r
+\r
+                // Length-delimited bytes\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    if (ByteBuffer.isByteBuffer(value))\r
+                        return value;\r
+                    return ByteBuffer.wrap(value, "base64");\r
+\r
+                // Constant enum value\r
+                case ProtoBuf.TYPES["enum"]: {\r
+                    var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);\r
+                    for (i=0; i<values.length; i++)\r
+                        if (values[i].name == value)\r
+                            return values[i].id;\r
+                        else if (values[i].id == value)\r
+                            return values[i].id;\r
+\r
+                    if (this.syntax === 'proto3') {\r
+                        // proto3: just make sure it's an integer.\r
+                        if (typeof value !== 'number' || (value === value && value % 1 !== 0))\r
+                            fail(typeof value, "not an integer");\r
+                        if (value > 4294967295 || value < 0)\r
+                            fail(typeof value, "not in range for uint32")\r
+                        return value;\r
+                    } else {\r
+                        // proto2 requires enum values to be valid.\r
+                        fail(value, "not a valid enum value");\r
+                    }\r
+                }\r
+                // Embedded message\r
+                case ProtoBuf.TYPES["group"]:\r
+                case ProtoBuf.TYPES["message"]: {\r
+                    if (!value || typeof value !== 'object')\r
+                        fail(typeof value, "object expected");\r
+                    if (value instanceof this.resolvedType.clazz)\r
+                        return value;\r
+                    if (value instanceof ProtoBuf.Builder.Message) {\r
+                        // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)\r
+                        var obj = {};\r
+                        for (var i in value)\r
+                            if (value.hasOwnProperty(i))\r
+                                obj[i] = value[i];\r
+                        value = obj;\r
+                    }\r
+                    // Else let's try to construct one from a key-value object\r
+                    return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons\r
+                }\r
+            }\r
+\r
+            // We should never end here\r
+            throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");\r
+        };\r
+\r
+        /**\r
+         * Calculates the byte length of an element on the wire.\r
+         * @param {number} id Field number\r
+         * @param {*} value Field value\r
+         * @returns {number} Byte length\r
+         * @throws {Error} If the value cannot be calculated\r
+         * @expose\r
+         */\r
+        ElementPrototype.calculateLength = function(id, value) {\r
+            if (value === null) return 0; // Nothing to encode\r
+            // Tag has already been written\r
+            var n;\r
+            switch (this.type) {\r
+                case ProtoBuf.TYPES["int32"]:\r
+                    return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                    return ByteBuffer.calculateVarint32(value);\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                    return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                case ProtoBuf.TYPES["float"]:\r
+                    return 4;\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                    return ByteBuffer.calculateVarint64(value);\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                    return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                    return 8;\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    return 1;\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    return ByteBuffer.calculateVarint32(value);\r
+                case ProtoBuf.TYPES["double"]:\r
+                    return 8;\r
+                case ProtoBuf.TYPES["string"]:\r
+                    n = ByteBuffer.calculateUTF8Bytes(value);\r
+                    return ByteBuffer.calculateVarint32(n) + n;\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    if (value.remaining() < 0)\r
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");\r
+                    return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();\r
+                case ProtoBuf.TYPES["message"]:\r
+                    n = this.resolvedType.calculate(value);\r
+                    return ByteBuffer.calculateVarint32(n) + n;\r
+                case ProtoBuf.TYPES["group"]:\r
+                    n = this.resolvedType.calculate(value);\r
+                    return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);\r
+            }\r
+            // We should never end here\r
+            throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");\r
+        };\r
+\r
+        /**\r
+         * Encodes a value to the specified buffer. Does not encode the key.\r
+         * @param {number} id Field number\r
+         * @param {*} value Field value\r
+         * @param {ByteBuffer} buffer ByteBuffer to encode to\r
+         * @return {ByteBuffer} The ByteBuffer for chaining\r
+         * @throws {Error} If the value cannot be encoded\r
+         * @expose\r
+         */\r
+        ElementPrototype.encodeValue = function(id, value, buffer) {\r
+            if (value === null) return buffer; // Nothing to encode\r
+            // Tag has already been written\r
+\r
+            switch (this.type) {\r
+                // 32bit signed varint\r
+                case ProtoBuf.TYPES["int32"]:\r
+                    // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes\r
+                    // long – it is, effectively, treated like a very large unsigned integer." (see #122)\r
+                    if (value < 0)\r
+                        buffer.writeVarint64(value);\r
+                    else\r
+                        buffer.writeVarint32(value);\r
+                    break;\r
+\r
+                // 32bit unsigned varint\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                    buffer.writeVarint32(value);\r
+                    break;\r
+\r
+                // 32bit varint zig-zag\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                    buffer.writeVarint32ZigZag(value);\r
+                    break;\r
+\r
+                // Fixed unsigned 32bit\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    buffer.writeUint32(value);\r
+                    break;\r
+\r
+                // Fixed signed 32bit\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                    buffer.writeInt32(value);\r
+                    break;\r
+\r
+                // 64bit varint as-is\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                    buffer.writeVarint64(value); // throws\r
+                    break;\r
+\r
+                // 64bit varint zig-zag\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                    buffer.writeVarint64ZigZag(value); // throws\r
+                    break;\r
+\r
+                // Fixed unsigned 64bit\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                    buffer.writeUint64(value); // throws\r
+                    break;\r
+\r
+                // Fixed signed 64bit\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                    buffer.writeInt64(value); // throws\r
+                    break;\r
+\r
+                // Bool\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    if (typeof value === 'string')\r
+                        buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);\r
+                    else\r
+                        buffer.writeVarint32(value ? 1 : 0);\r
+                    break;\r
+\r
+                // Constant enum value\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    buffer.writeVarint32(value);\r
+                    break;\r
+\r
+                // 32bit float\r
+                case ProtoBuf.TYPES["float"]:\r
+                    buffer.writeFloat32(value);\r
+                    break;\r
+\r
+                // 64bit float\r
+                case ProtoBuf.TYPES["double"]:\r
+                    buffer.writeFloat64(value);\r
+                    break;\r
+\r
+                // Length-delimited string\r
+                case ProtoBuf.TYPES["string"]:\r
+                    buffer.writeVString(value);\r
+                    break;\r
+\r
+                // Length-delimited bytes\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    if (value.remaining() < 0)\r
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");\r
+                    var prevOffset = value.offset;\r
+                    buffer.writeVarint32(value.remaining());\r
+                    buffer.append(value);\r
+                    value.offset = prevOffset;\r
+                    break;\r
+\r
+                // Embedded message\r
+                case ProtoBuf.TYPES["message"]:\r
+                    var bb = new ByteBuffer().LE();\r
+                    this.resolvedType.encode(value, bb);\r
+                    buffer.writeVarint32(bb.offset);\r
+                    buffer.append(bb.flip());\r
+                    break;\r
+\r
+                // Legacy group\r
+                case ProtoBuf.TYPES["group"]:\r
+                    this.resolvedType.encode(value, buffer);\r
+                    buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);\r
+                    break;\r
+\r
+                default:\r
+                    // We should never end here\r
+                    throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");\r
+            }\r
+            return buffer;\r
+        };\r
+\r
+        /**\r
+         * Decode one element value from the specified buffer.\r
+         * @param {ByteBuffer} buffer ByteBuffer to decode from\r
+         * @param {number} wireType The field wire type\r
+         * @param {number} id The field number\r
+         * @return {*} Decoded value\r
+         * @throws {Error} If the field cannot be decoded\r
+         * @expose\r
+         */\r
+        ElementPrototype.decode = function(buffer, wireType, id) {\r
+            if (wireType != this.type.wireType)\r
+                throw Error("Unexpected wire type for element");\r
+\r
+            var value, nBytes;\r
+            switch (this.type) {\r
+                // 32bit signed varint\r
+                case ProtoBuf.TYPES["int32"]:\r
+                    return buffer.readVarint32() | 0;\r
+\r
+                // 32bit unsigned varint\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                    return buffer.readVarint32() >>> 0;\r
+\r
+                // 32bit signed varint zig-zag\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                    return buffer.readVarint32ZigZag() | 0;\r
+\r
+                // Fixed 32bit unsigned\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    return buffer.readUint32() >>> 0;\r
+\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                    return buffer.readInt32() | 0;\r
+\r
+                // 64bit signed varint\r
+                case ProtoBuf.TYPES["int64"]:\r
+                    return buffer.readVarint64();\r
+\r
+                // 64bit unsigned varint\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                    return buffer.readVarint64().toUnsigned();\r
+\r
+                // 64bit signed varint zig-zag\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                    return buffer.readVarint64ZigZag();\r
+\r
+                // Fixed 64bit unsigned\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                    return buffer.readUint64();\r
+\r
+                // Fixed 64bit signed\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                    return buffer.readInt64();\r
+\r
+                // Bool varint\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    return !!buffer.readVarint32();\r
+\r
+                // Constant enum value (varint)\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    // The following Builder.Message#set will already throw\r
+                    return buffer.readVarint32();\r
+\r
+                // 32bit float\r
+                case ProtoBuf.TYPES["float"]:\r
+                    return buffer.readFloat();\r
+\r
+                // 64bit float\r
+                case ProtoBuf.TYPES["double"]:\r
+                    return buffer.readDouble();\r
+\r
+                // Length-delimited string\r
+                case ProtoBuf.TYPES["string"]:\r
+                    return buffer.readVString();\r
+\r
+                // Length-delimited bytes\r
+                case ProtoBuf.TYPES["bytes"]: {\r
+                    nBytes = buffer.readVarint32();\r
+                    if (buffer.remaining() < nBytes)\r
+                        throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());\r
+                    value = buffer.clone(); // Offset already set\r
+                    value.limit = value.offset+nBytes;\r
+                    buffer.offset += nBytes;\r
+                    return value;\r
+                }\r
+\r
+                // Length-delimited embedded message\r
+                case ProtoBuf.TYPES["message"]: {\r
+                    nBytes = buffer.readVarint32();\r
+                    return this.resolvedType.decode(buffer, nBytes);\r
+                }\r
+\r
+                // Legacy group\r
+                case ProtoBuf.TYPES["group"]:\r
+                    return this.resolvedType.decode(buffer, -1, id);\r
+            }\r
+\r
+            // We should never end here\r
+            throw Error("[INTERNAL] Illegal decode type");\r
+        };\r
+\r
+        /**\r
+         * Converts a value from a string to the canonical element type.\r
+         *\r
+         * Legal only when isMapKey is true.\r
+         *\r
+         * @param {string} str The string value\r
+         * @returns {*} The value\r
+         */\r
+        ElementPrototype.valueFromString = function(str) {\r
+            if (!this.isMapKey) {\r
+                throw Error("valueFromString() called on non-map-key element");\r
+            }\r
+\r
+            switch (this.type) {\r
+                case ProtoBuf.TYPES["int32"]:\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    return this.verifyValue(parseInt(str));\r
+\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                      // Long-based fields support conversions from string already.\r
+                      return this.verifyValue(str);\r
+\r
+                case ProtoBuf.TYPES["bool"]:\r
+                      return str === "true";\r
+\r
+                case ProtoBuf.TYPES["string"]:\r
+                      return this.verifyValue(str);\r
+\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                      return ByteBuffer.fromBinary(str);\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Converts a value from the canonical element type to a string.\r
+         *\r
+         * It should be the case that `valueFromString(valueToString(val))` returns\r
+         * a value equivalent to `verifyValue(val)` for every legal value of `val`\r
+         * according to this element type.\r
+         *\r
+         * This may be used when the element must be stored or used as a string,\r
+         * e.g., as a map key on an Object.\r
+         *\r
+         * Legal only when isMapKey is true.\r
+         *\r
+         * @param {*} val The value\r
+         * @returns {string} The string form of the value.\r
+         */\r
+        ElementPrototype.valueToString = function(value) {\r
+            if (!this.isMapKey) {\r
+                throw Error("valueToString() called on non-map-key element");\r
+            }\r
+\r
+            if (this.type === ProtoBuf.TYPES["bytes"]) {\r
+                return value.toString("binary");\r
+            } else {\r
+                return value.toString();\r
+            }\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Element\r
+         * @expose\r
+         */\r
+        Reflect.Element = Element;\r
+\r
+        /**\r
+         * Constructs a new Message.\r
+         * @exports ProtoBuf.Reflect.Message\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace\r
+         * @param {string} name Message name\r
+         * @param {Object.<string,*>=} options Message options\r
+         * @param {boolean=} isGroup `true` if this is a legacy group\r
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Namespace\r
+         */\r
+        var Message = function(builder, parent, name, options, isGroup, syntax) {\r
+            Namespace.call(this, builder, parent, name, options, syntax);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Message";\r
+\r
+            /**\r
+             * Extensions range.\r
+             * @type {!Array.<number>|undefined}\r
+             * @expose\r
+             */\r
+            this.extensions = undefined;\r
+\r
+            /**\r
+             * Runtime message class.\r
+             * @type {?function(new:ProtoBuf.Builder.Message)}\r
+             * @expose\r
+             */\r
+            this.clazz = null;\r
+\r
+            /**\r
+             * Whether this is a legacy group or not.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.isGroup = !!isGroup;\r
+\r
+            // The following cached collections are used to efficiently iterate over or look up fields when decoding.\r
+\r
+            /**\r
+             * Cached fields.\r
+             * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}\r
+             * @private\r
+             */\r
+            this._fields = null;\r
+\r
+            /**\r
+             * Cached fields by id.\r
+             * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}\r
+             * @private\r
+             */\r
+            this._fieldsById = null;\r
+\r
+            /**\r
+             * Cached fields by name.\r
+             * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}\r
+             * @private\r
+             */\r
+            this._fieldsByName = null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.prototype\r
+         * @inner\r
+         */\r
+        var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);\r
+\r
+        /**\r
+         * Builds the message and returns the runtime counterpart, which is a fully functional class.\r
+         * @see ProtoBuf.Builder.Message\r
+         * @param {boolean=} rebuild Whether to rebuild or not, defaults to false\r
+         * @return {ProtoBuf.Reflect.Message} Message class\r
+         * @throws {Error} If the message cannot be built\r
+         * @expose\r
+         */\r
+        MessagePrototype.build = function(rebuild) {\r
+            if (this.clazz && !rebuild)\r
+                return this.clazz;\r
+\r
+            // Create the runtime Message class in its own scope\r
+            var clazz = (function(ProtoBuf, T) {\r
+\r
+                var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),\r
+                    oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);\r
+\r
+                /**\r
+                 * Constructs a new runtime Message.\r
+                 * @name ProtoBuf.Builder.Message\r
+                 * @class Barebone of all runtime messages.\r
+                 * @param {!Object.<string,*>|string} values Preset values\r
+                 * @param {...string} var_args\r
+                 * @constructor\r
+                 * @throws {Error} If the message cannot be created\r
+                 */\r
+                var Message = function(values, var_args) {\r
+                    ProtoBuf.Builder.Message.call(this);\r
+\r
+                    // Create virtual oneof properties\r
+                    for (var i=0, k=oneofs.length; i<k; ++i)\r
+                        this[oneofs[i].name] = null;\r
+                    // Create fields and set default values\r
+                    for (i=0, k=fields.length; i<k; ++i) {\r
+                        var field = fields[i];\r
+                        this[field.name] =\r
+                            field.repeated ? [] :\r
+                            (field.map ? new ProtoBuf.Map(field) : null);\r
+                        if ((field.required || T.syntax === 'proto3') &&\r
+                            field.defaultValue !== null)\r
+                            this[field.name] = field.defaultValue;\r
+                    }\r
+\r
+                    if (arguments.length > 0) {\r
+                        var value;\r
+                        // Set field values from a values object\r
+                        if (arguments.length === 1 && values !== null && typeof values === 'object' &&\r
+                            /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&\r
+                            /* not a repeated field */ !Array.isArray(values) &&\r
+                            /* not a Map */ !(values instanceof ProtoBuf.Map) &&\r
+                            /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&\r
+                            /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&\r
+                            /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {\r
+                            this.$set(values);\r
+                        } else // Set field values from arguments, in declaration order\r
+                            for (i=0, k=arguments.length; i<k; ++i)\r
+                                if (typeof (value = arguments[i]) !== 'undefined')\r
+                                    this.$set(fields[i].name, value); // May throw\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * @alias ProtoBuf.Builder.Message.prototype\r
+                 * @inner\r
+                 */\r
+                var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);\r
+\r
+                /**\r
+                 * Adds a value to a repeated field.\r
+                 * @name ProtoBuf.Builder.Message#add\r
+                 * @function\r
+                 * @param {string} key Field name\r
+                 * @param {*} value Value to add\r
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)\r
+                 * @returns {!ProtoBuf.Builder.Message} this\r
+                 * @throws {Error} If the value cannot be added\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.add = function(key, value, noAssert) {\r
+                    var field = T._fieldsByName[key];\r
+                    if (!noAssert) {\r
+                        if (!field)\r
+                            throw Error(this+"#"+key+" is undefined");\r
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                            throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message\r
+                        if (!field.repeated)\r
+                            throw Error(this+"#"+key+" is not a repeated field");\r
+                        value = field.verifyValue(value, true);\r
+                    }\r
+                    if (this[key] === null)\r
+                        this[key] = [];\r
+                    this[key].push(value);\r
+                    return this;\r
+                };\r
+\r
+                /**\r
+                 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.\r
+                 * @name ProtoBuf.Builder.Message#$add\r
+                 * @function\r
+                 * @param {string} key Field name\r
+                 * @param {*} value Value to add\r
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)\r
+                 * @returns {!ProtoBuf.Builder.Message} this\r
+                 * @throws {Error} If the value cannot be added\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.$add = MessagePrototype.add;\r
+\r
+                /**\r
+                 * Sets a field's value.\r
+                 * @name ProtoBuf.Builder.Message#set\r
+                 * @function\r
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values\r
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted\r
+                 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`\r
+                 * @returns {!ProtoBuf.Builder.Message} this\r
+                 * @throws {Error} If the value cannot be set\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.set = function(keyOrObj, value, noAssert) {\r
+                    if (keyOrObj && typeof keyOrObj === 'object') {\r
+                        noAssert = value;\r
+                        for (var ikey in keyOrObj) {\r
+                            // Check if virtual oneof field - don't set these\r
+                            if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)\r
+                                this.$set(ikey, value, noAssert);\r
+                        }\r
+                        return this;\r
+                    }\r
+                    var field = T._fieldsByName[keyOrObj];\r
+                    if (!noAssert) {\r
+                        if (!field)\r
+                            throw Error(this+"#"+keyOrObj+" is not a field: undefined");\r
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                            throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));\r
+                        this[field.name] = (value = field.verifyValue(value)); // May throw\r
+                    } else\r
+                        this[keyOrObj] = value;\r
+                    if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)\r
+                        var currentField = this[field.oneof.name]; // Virtual field references currently set field\r
+                        if (value !== null) {\r
+                            if (currentField !== null && currentField !== field.name)\r
+                                this[currentField] = null; // Clear currently set field\r
+                            this[field.oneof.name] = field.name; // Point virtual field at this field\r
+                        } else if (/* value === null && */currentField === keyOrObj)\r
+                            this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)\r
+                    }\r
+                    return this;\r
+                };\r
+\r
+                /**\r
+                 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.\r
+                 * @name ProtoBuf.Builder.Message#$set\r
+                 * @function\r
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values\r
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted\r
+                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`\r
+                 * @throws {Error} If the value cannot be set\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.$set = MessagePrototype.set;\r
+\r
+                /**\r
+                 * Gets a field's value.\r
+                 * @name ProtoBuf.Builder.Message#get\r
+                 * @function\r
+                 * @param {string} key Key\r
+                 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`\r
+                 * @return {*} Value\r
+                 * @throws {Error} If there is no such field\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.get = function(key, noAssert) {\r
+                    if (noAssert)\r
+                        return this[key];\r
+                    var field = T._fieldsByName[key];\r
+                    if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                        throw Error(this+"#"+key+" is not a field: undefined");\r
+                    if (!(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                        throw Error(this+"#"+key+" is not a field: "+field.toString(true));\r
+                    return this[field.name];\r
+                };\r
+\r
+                /**\r
+                 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.\r
+                 * @name ProtoBuf.Builder.Message#$get\r
+                 * @function\r
+                 * @param {string} key Key\r
+                 * @return {*} Value\r
+                 * @throws {Error} If there is no such field\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.$get = MessagePrototype.get;\r
+\r
+                // Getters and setters\r
+\r
+                for (var i=0; i<fields.length; i++) {\r
+                    var field = fields[i];\r
+                    // no setters for extension fields as these are named by their fqn\r
+                    if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)\r
+                        continue;\r
+\r
+                    if (T.builder.options['populateAccessors'])\r
+                        (function(field) {\r
+                            // set/get[SomeValue]\r
+                            var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {\r
+                                return match.toUpperCase().replace('_','');\r
+                            });\r
+                            Name = Name.substring(0,1).toUpperCase() + Name.substring(1);\r
+\r
+                            // set/get_[some_value] FIXME: Do we really need these?\r
+                            var name = field.originalName.replace(/([A-Z])/g, function(match) {\r
+                                return "_"+match;\r
+                            });\r
+\r
+                            /**\r
+                             * The current field's unbound setter function.\r
+                             * @function\r
+                             * @param {*} value\r
+                             * @param {boolean=} noAssert\r
+                             * @returns {!ProtoBuf.Builder.Message}\r
+                             * @inner\r
+                             */\r
+                            var setter = function(value, noAssert) {\r
+                                this[field.name] = noAssert ? value : field.verifyValue(value);\r
+                                return this;\r
+                            };\r
+\r
+                            /**\r
+                             * The current field's unbound getter function.\r
+                             * @function\r
+                             * @returns {*}\r
+                             * @inner\r
+                             */\r
+                            var getter = function() {\r
+                                return this[field.name];\r
+                            };\r
+\r
+                            if (T.getChild("set"+Name) === null)\r
+                                /**\r
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#set[SomeField]\r
+                                 * @function\r
+                                 * @param {*} value Value to set\r
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`\r
+                                 * @returns {!ProtoBuf.Builder.Message} this\r
+                                 * @abstract\r
+                                 * @throws {Error} If the value cannot be set\r
+                                 */\r
+                                MessagePrototype["set"+Name] = setter;\r
+\r
+                            if (T.getChild("set_"+name) === null)\r
+                                /**\r
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#set_[some_field]\r
+                                 * @function\r
+                                 * @param {*} value Value to set\r
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`\r
+                                 * @returns {!ProtoBuf.Builder.Message} this\r
+                                 * @abstract\r
+                                 * @throws {Error} If the value cannot be set\r
+                                 */\r
+                                MessagePrototype["set_"+name] = setter;\r
+\r
+                            if (T.getChild("get"+Name) === null)\r
+                                /**\r
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#get[SomeField]\r
+                                 * @function\r
+                                 * @abstract\r
+                                 * @return {*} The value\r
+                                 */\r
+                                MessagePrototype["get"+Name] = getter;\r
+\r
+                            if (T.getChild("get_"+name) === null)\r
+                                /**\r
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#get_[some_field]\r
+                                 * @function\r
+                                 * @return {*} The value\r
+                                 * @abstract\r
+                                 */\r
+                                MessagePrototype["get_"+name] = getter;\r
+\r
+                        })(field);\r
+                }\r
+\r
+                // En-/decoding\r
+\r
+                /**\r
+                 * Encodes the message.\r
+                 * @name ProtoBuf.Builder.Message#$encode\r
+                 * @function\r
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.\r
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 * @see ProtoBuf.Builder.Message#encode64\r
+                 * @see ProtoBuf.Builder.Message#encodeHex\r
+                 * @see ProtoBuf.Builder.Message#encodeAB\r
+                 */\r
+                MessagePrototype.encode = function(buffer, noVerify) {\r
+                    if (typeof buffer === 'boolean')\r
+                        noVerify = buffer,\r
+                        buffer = undefined;\r
+                    var isNew = false;\r
+                    if (!buffer)\r
+                        buffer = new ByteBuffer(),\r
+                        isNew = true;\r
+                    var le = buffer.littleEndian;\r
+                    try {\r
+                        T.encode(this, buffer.LE(), noVerify);\r
+                        return (isNew ? buffer.flip() : buffer).LE(le);\r
+                    } catch (e) {\r
+                        buffer.LE(le);\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Encodes a message using the specified data payload.\r
+                 * @param {!Object.<string,*>} data Data payload\r
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.\r
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer\r
+                 * @expose\r
+                 */\r
+                Message.encode = function(data, buffer, noVerify) {\r
+                    return new Message(data).encode(buffer, noVerify);\r
+                };\r
+\r
+                /**\r
+                 * Calculates the byte length of the message.\r
+                 * @name ProtoBuf.Builder.Message#calculate\r
+                 * @function\r
+                 * @returns {number} Byte length\r
+                 * @throws {Error} If the message cannot be calculated or if required fields are missing.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.calculate = function() {\r
+                    return T.calculate(this);\r
+                };\r
+\r
+                /**\r
+                 * Encodes the varint32 length-delimited message.\r
+                 * @name ProtoBuf.Builder.Message#encodeDelimited\r
+                 * @function\r
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.\r
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeDelimited = function(buffer, noVerify) {\r
+                    var isNew = false;\r
+                    if (!buffer)\r
+                        buffer = new ByteBuffer(),\r
+                        isNew = true;\r
+                    var enc = new ByteBuffer().LE();\r
+                    T.encode(this, enc, noVerify).flip();\r
+                    buffer.writeVarint32(enc.remaining());\r
+                    buffer.append(enc);\r
+                    return isNew ? buffer.flip() : buffer;\r
+                };\r
+\r
+                /**\r
+                 * Directly encodes the message to an ArrayBuffer.\r
+                 * @name ProtoBuf.Builder.Message#encodeAB\r
+                 * @function\r
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeAB = function() {\r
+                    try {\r
+                        return this.encode().toArrayBuffer();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.\r
+                 * @name ProtoBuf.Builder.Message#toArrayBuffer\r
+                 * @function\r
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;\r
+\r
+                /**\r
+                 * Directly encodes the message to a node Buffer.\r
+                 * @name ProtoBuf.Builder.Message#encodeNB\r
+                 * @function\r
+                 * @return {!Buffer}\r
+                 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are\r
+                 *  missing. The later still returns the encoded node Buffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeNB = function() {\r
+                    try {\r
+                        return this.encode().toBuffer();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.\r
+                 * @name ProtoBuf.Builder.Message#toBuffer\r
+                 * @function\r
+                 * @return {!Buffer}\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded node Buffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toBuffer = MessagePrototype.encodeNB;\r
+\r
+                /**\r
+                 * Directly encodes the message to a base64 encoded string.\r
+                 * @name ProtoBuf.Builder.Message#encode64\r
+                 * @function\r
+                 * @return {string} Base64 encoded string\r
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later\r
+                 *  still returns the encoded base64 string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encode64 = function() {\r
+                    try {\r
+                        return this.encode().toBase64();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.\r
+                 * @name ProtoBuf.Builder.Message#toBase64\r
+                 * @function\r
+                 * @return {string} Base64 encoded string\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded base64 string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toBase64 = MessagePrototype.encode64;\r
+\r
+                /**\r
+                 * Directly encodes the message to a hex encoded string.\r
+                 * @name ProtoBuf.Builder.Message#encodeHex\r
+                 * @function\r
+                 * @return {string} Hex encoded string\r
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later\r
+                 *  still returns the encoded hex string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeHex = function() {\r
+                    try {\r
+                        return this.encode().toHex();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toHex();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.\r
+                 * @name ProtoBuf.Builder.Message#toHex\r
+                 * @function\r
+                 * @return {string} Hex encoded string\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded hex string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toHex = MessagePrototype.encodeHex;\r
+\r
+                /**\r
+                 * Clones a message object or field value to a raw object.\r
+                 * @param {*} obj Object to clone\r
+                 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise\r
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings\r
+                 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field\r
+                 * @returns {*} Cloned object\r
+                 * @inner\r
+                 */\r
+                function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {\r
+                    if (obj === null || typeof obj !== 'object') {\r
+                        // Convert enum values to their respective names\r
+                        if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {\r
+                            var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);\r
+                            if (name !== null)\r
+                                return name;\r
+                        }\r
+                        // Pass-through string, number, boolean, null...\r
+                        return obj;\r
+                    }\r
+                    // Convert ByteBuffers to raw buffer or strings\r
+                    if (ByteBuffer.isByteBuffer(obj))\r
+                        return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();\r
+                    // Convert Longs to proper objects or strings\r
+                    if (ProtoBuf.Long.isLong(obj))\r
+                        return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);\r
+                    var clone;\r
+                    // Clone arrays\r
+                    if (Array.isArray(obj)) {\r
+                        clone = [];\r
+                        obj.forEach(function(v, k) {\r
+                            clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);\r
+                        });\r
+                        return clone;\r
+                    }\r
+                    clone = {};\r
+                    // Convert maps to objects\r
+                    if (obj instanceof ProtoBuf.Map) {\r
+                        var it = obj.entries();\r
+                        for (var e = it.next(); !e.done; e = it.next())\r
+                            clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);\r
+                        return clone;\r
+                    }\r
+                    // Everything else is a non-null object\r
+                    var type = obj.$type,\r
+                        field = undefined;\r
+                    for (var i in obj)\r
+                        if (obj.hasOwnProperty(i)) {\r
+                            if (type && (field = type.getChild(i)))\r
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);\r
+                            else\r
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);\r
+                        }\r
+                    return clone;\r
+                }\r
+\r
+                /**\r
+                 * Returns the message's raw payload.\r
+                 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`\r
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings\r
+                 * @returns {Object.<string,*>} Raw payload\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {\r
+                    return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);\r
+                };\r
+\r
+                /**\r
+                 * Encodes a message to JSON.\r
+                 * @returns {string} JSON string\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeJSON = function() {\r
+                    return JSON.stringify(\r
+                        cloneRaw(this,\r
+                             /* binary-as-base64 */ true,\r
+                             /* longs-as-strings */ true,\r
+                             this.$type\r
+                        )\r
+                    );\r
+                };\r
+\r
+                /**\r
+                 * Decodes a message from the specified buffer or string.\r
+                 * @name ProtoBuf.Builder.Message.decode\r
+                 * @function\r
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from\r
+                 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.\r
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 * @see ProtoBuf.Builder.Message.decode64\r
+                 * @see ProtoBuf.Builder.Message.decodeHex\r
+                 */\r
+                Message.decode = function(buffer, length, enc) {\r
+                    if (typeof length === 'string')\r
+                        enc = length,\r
+                        length = -1;\r
+                    if (typeof buffer === 'string')\r
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");\r
+                    else if (!ByteBuffer.isByteBuffer(buffer))\r
+                        buffer = ByteBuffer.wrap(buffer); // May throw\r
+                    var le = buffer.littleEndian;\r
+                    try {\r
+                        var msg = T.decode(buffer.LE(), length);\r
+                        buffer.LE(le);\r
+                        return msg;\r
+                    } catch (e) {\r
+                        buffer.LE(le);\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Decodes a varint32 length-delimited message from the specified buffer or string.\r
+                 * @name ProtoBuf.Builder.Message.decodeDelimited\r
+                 * @function\r
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from\r
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64\r
+                 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                Message.decodeDelimited = function(buffer, enc) {\r
+                    if (typeof buffer === 'string')\r
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");\r
+                    else if (!ByteBuffer.isByteBuffer(buffer))\r
+                        buffer = ByteBuffer.wrap(buffer); // May throw\r
+                    if (buffer.remaining() < 1)\r
+                        return null;\r
+                    var off = buffer.offset,\r
+                        len = buffer.readVarint32();\r
+                    if (buffer.remaining() < len) {\r
+                        buffer.offset = off;\r
+                        return null;\r
+                    }\r
+                    try {\r
+                        var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());\r
+                        buffer.offset += len;\r
+                        return msg;\r
+                    } catch (err) {\r
+                        buffer.offset += len;\r
+                        throw err;\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Decodes the message from the specified base64 encoded string.\r
+                 * @name ProtoBuf.Builder.Message.decode64\r
+                 * @function\r
+                 * @param {string} str String to decode from\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                Message.decode64 = function(str) {\r
+                    return Message.decode(str, "base64");\r
+                };\r
+\r
+                /**\r
+                 * Decodes the message from the specified hex encoded string.\r
+                 * @name ProtoBuf.Builder.Message.decodeHex\r
+                 * @function\r
+                 * @param {string} str String to decode from\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                Message.decodeHex = function(str) {\r
+                    return Message.decode(str, "hex");\r
+                };\r
+\r
+                /**\r
+                 * Decodes the message from a JSON string.\r
+                 * @name ProtoBuf.Builder.Message.decodeJSON\r
+                 * @function\r
+                 * @param {string} str String to decode from\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are\r
+                 * missing.\r
+                 * @expose\r
+                 */\r
+                Message.decodeJSON = function(str) {\r
+                    return new Message(JSON.parse(str));\r
+                };\r
+\r
+                // Utility\r
+\r
+                /**\r
+                 * Returns a string representation of this Message.\r
+                 * @name ProtoBuf.Builder.Message#toString\r
+                 * @function\r
+                 * @return {string} String representation as of ".Fully.Qualified.MessageName"\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toString = function() {\r
+                    return T.toString();\r
+                };\r
+\r
+                // Properties\r
+\r
+                /**\r
+                 * Message options.\r
+                 * @name ProtoBuf.Builder.Message.$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $optionsS; // cc needs this\r
+\r
+                /**\r
+                 * Message options.\r
+                 * @name ProtoBuf.Builder.Message#$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $options;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Message.$type\r
+                 * @type {!ProtoBuf.Reflect.Message}\r
+                 * @expose\r
+                 */\r
+                var $typeS;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Message#$type\r
+                 * @type {!ProtoBuf.Reflect.Message}\r
+                 * @expose\r
+                 */\r
+                var $type;\r
+\r
+                if (Object.defineProperty)\r
+                    Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),\r
+                    Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),\r
+                    Object.defineProperty(Message, "$type", { "value": T }),\r
+                    Object.defineProperty(MessagePrototype, "$type", { "value": T });\r
+\r
+                return Message;\r
+\r
+            })(ProtoBuf, this);\r
+\r
+            // Static enums and prototyped sub-messages / cached collections\r
+            this._fields = [];\r
+            this._fieldsById = {};\r
+            this._fieldsByName = {};\r
+            this._oneofsByName = {};\r
+            for (var i=0, k=this.children.length, child; i<k; i++) {\r
+                child = this.children[i];\r
+                if (child instanceof Enum || child instanceof Message || child instanceof Service) {\r
+                    if (clazz.hasOwnProperty(child.name))\r
+                        throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");\r
+                    clazz[child.name] = child.build();\r
+                } else if (child instanceof Message.Field)\r
+                    child.build(),\r
+                    this._fields.push(child),\r
+                    this._fieldsById[child.id] = child,\r
+                    this._fieldsByName[child.name] = child;\r
+                else if (child instanceof Message.OneOf) {\r
+                    this._oneofsByName[child.name] = child;\r
+                }\r
+                else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built\r
+                    throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));\r
+            }\r
+\r
+            return this.clazz = clazz;\r
+        };\r
+\r
+        /**\r
+         * Encodes a runtime message's contents to the specified buffer.\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode\r
+         * @param {ByteBuffer} buffer ByteBuffer to write to\r
+         * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+         * @return {ByteBuffer} The ByteBuffer for chaining\r
+         * @throws {Error} If required fields are missing or the message cannot be encoded for another reason\r
+         * @expose\r
+         */\r
+        MessagePrototype.encode = function(message, buffer, noVerify) {\r
+            var fieldMissing = null,\r
+                field;\r
+            for (var i=0, k=this._fields.length, val; i<k; ++i) {\r
+                field = this._fields[i];\r
+                val = message[field.name];\r
+                if (field.required && val === null) {\r
+                    if (fieldMissing === null)\r
+                        fieldMissing = field;\r
+                } else\r
+                    field.encode(noVerify ? val : field.verifyValue(val), buffer, message);\r
+            }\r
+            if (fieldMissing !== null) {\r
+                var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);\r
+                err["encoded"] = buffer; // Still expose what we got\r
+                throw(err);\r
+            }\r
+            return buffer;\r
+        };\r
+\r
+        /**\r
+         * Calculates a runtime message's byte length.\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode\r
+         * @returns {number} Byte length\r
+         * @throws {Error} If required fields are missing or the message cannot be calculated for another reason\r
+         * @expose\r
+         */\r
+        MessagePrototype.calculate = function(message) {\r
+            for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {\r
+                field = this._fields[i];\r
+                val = message[field.name];\r
+                if (field.required && val === null)\r
+                   throw Error("Missing at least one required field for "+this.toString(true)+": "+field);\r
+                else\r
+                    n += field.calculate(val, message);\r
+            }\r
+            return n;\r
+        };\r
+\r
+        /**\r
+         * Skips all data until the end of the specified group has been reached.\r
+         * @param {number} expectedId Expected GROUPEND id\r
+         * @param {!ByteBuffer} buf ByteBuffer\r
+         * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached\r
+         * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)\r
+         * @inner\r
+         */\r
+        function skipTillGroupEnd(expectedId, buf) {\r
+            var tag = buf.readVarint32(), // Throws on OOB\r
+                wireType = tag & 0x07,\r
+                id = tag >>> 3;\r
+            switch (wireType) {\r
+                case ProtoBuf.WIRE_TYPES.VARINT:\r
+                    do tag = buf.readUint8();\r
+                    while ((tag & 0x80) === 0x80);\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.BITS64:\r
+                    buf.offset += 8;\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.LDELIM:\r
+                    tag = buf.readVarint32(); // reads the varint\r
+                    buf.offset += tag;        // skips n bytes\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.STARTGROUP:\r
+                    skipTillGroupEnd(id, buf);\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.ENDGROUP:\r
+                    if (id === expectedId)\r
+                        return false;\r
+                    else\r
+                        throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");\r
+                case ProtoBuf.WIRE_TYPES.BITS32:\r
+                    buf.offset += 4;\r
+                    break;\r
+                default:\r
+                    throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);\r
+            }\r
+            return true;\r
+        }\r
+\r
+        /**\r
+         * Decodes an encoded message and returns the decoded message.\r
+         * @param {ByteBuffer} buffer ByteBuffer to decode from\r
+         * @param {number=} length Message length. Defaults to decode all remaining data.\r
+         * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group\r
+         * @return {ProtoBuf.Builder.Message} Decoded message\r
+         * @throws {Error} If the message cannot be decoded\r
+         * @expose\r
+         */\r
+        MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {\r
+            if (typeof length !== 'number')\r
+                length = -1;\r
+            var start = buffer.offset,\r
+                msg = new (this.clazz)(),\r
+                tag, wireType, id, field;\r
+            while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {\r
+                tag = buffer.readVarint32();\r
+                wireType = tag & 0x07;\r
+                id = tag >>> 3;\r
+                if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {\r
+                    if (id !== expectedGroupEndId)\r
+                        throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");\r
+                    break;\r
+                }\r
+                if (!(field = this._fieldsById[id])) {\r
+                    // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."\r
+                    switch (wireType) {\r
+                        case ProtoBuf.WIRE_TYPES.VARINT:\r
+                            buffer.readVarint32();\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.BITS32:\r
+                            buffer.offset += 4;\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.BITS64:\r
+                            buffer.offset += 8;\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.LDELIM:\r
+                            var len = buffer.readVarint32();\r
+                            buffer.offset += len;\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.STARTGROUP:\r
+                            while (skipTillGroupEnd(id, buffer)) {}\r
+                            break;\r
+                        default:\r
+                            throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);\r
+                    }\r
+                    continue;\r
+                }\r
+                if (field.repeated && !field.options["packed"]) {\r
+                    msg[field.name].push(field.decode(wireType, buffer));\r
+                } else if (field.map) {\r
+                    var keyval = field.decode(wireType, buffer);\r
+                    msg[field.name].set(keyval[0], keyval[1]);\r
+                } else {\r
+                    msg[field.name] = field.decode(wireType, buffer);\r
+                    if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)\r
+                        var currentField = msg[field.oneof.name]; // Virtual field references currently set field\r
+                        if (currentField !== null && currentField !== field.name)\r
+                            msg[currentField] = null; // Clear currently set field\r
+                        msg[field.oneof.name] = field.name; // Point virtual field at this field\r
+                    }\r
+                }\r
+            }\r
+\r
+            // Check if all required fields are present and set default values for optional fields that are not\r
+            for (var i=0, k=this._fields.length; i<k; ++i) {\r
+                field = this._fields[i];\r
+                if (msg[field.name] === null) {\r
+                    if (this.syntax === "proto3") { // Proto3 sets default values by specification\r
+                        msg[field.name] = field.defaultValue;\r
+                    } else if (field.required) {\r
+                        var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);\r
+                        err["decoded"] = msg; // Still expose what we got\r
+                        throw(err);\r
+                    } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)\r
+                        msg[field.name] = field.defaultValue;\r
+                }\r
+            }\r
+            return msg;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message\r
+         * @expose\r
+         */\r
+        Reflect.Message = Message;\r
+\r
+        /**\r
+         * Constructs a new Message Field.\r
+         * @exports ProtoBuf.Reflect.Message.Field\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Message} message Message reference\r
+         * @param {string} rule Rule, one of requried, optional, repeated\r
+         * @param {string?} keytype Key data type, if any.\r
+         * @param {string} type Data type, e.g. int32\r
+         * @param {string} name Field name\r
+         * @param {number} id Unique field id\r
+         * @param {Object.<string,*>=} options Options\r
+         * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf\r
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {\r
+            T.call(this, builder, message, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Message.Field";\r
+\r
+            /**\r
+             * Message field required flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.required = rule === "required";\r
+\r
+            /**\r
+             * Message field repeated flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.repeated = rule === "repeated";\r
+\r
+            /**\r
+             * Message field map flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.map = rule === "map";\r
+\r
+            /**\r
+             * Message field key type. Type reference string if unresolved, protobuf\r
+             * type if resolved. Valid only if this.map === true, null otherwise.\r
+             * @type {string|{name: string, wireType: number}|null}\r
+             * @expose\r
+             */\r
+            this.keyType = keytype || null;\r
+\r
+            /**\r
+             * Message field type. Type reference string if unresolved, protobuf type if\r
+             * resolved. In a map field, this is the value type.\r
+             * @type {string|{name: string, wireType: number}}\r
+             * @expose\r
+             */\r
+            this.type = type;\r
+\r
+            /**\r
+             * Resolved type reference inside the global namespace.\r
+             * @type {ProtoBuf.Reflect.T|null}\r
+             * @expose\r
+             */\r
+            this.resolvedType = null;\r
+\r
+            /**\r
+             * Unique message field id.\r
+             * @type {number}\r
+             * @expose\r
+             */\r
+            this.id = id;\r
+\r
+            /**\r
+             * Message field options.\r
+             * @type {!Object.<string,*>}\r
+             * @dict\r
+             * @expose\r
+             */\r
+            this.options = options || {};\r
+\r
+            /**\r
+             * Default value.\r
+             * @type {*}\r
+             * @expose\r
+             */\r
+            this.defaultValue = null;\r
+\r
+            /**\r
+             * Enclosing OneOf.\r
+             * @type {?ProtoBuf.Reflect.Message.OneOf}\r
+             * @expose\r
+             */\r
+            this.oneof = oneof || null;\r
+\r
+            /**\r
+             * Syntax level of this definition (e.g., proto3).\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.syntax = syntax || 'proto2';\r
+\r
+            /**\r
+             * Original field name.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.originalName = this.name; // Used to revert camelcase transformation on naming collisions\r
+\r
+            /**\r
+             * Element implementation. Created in build() after types are resolved.\r
+             * @type {ProtoBuf.Element}\r
+             * @expose\r
+             */\r
+            this.element = null;\r
+\r
+            /**\r
+             * Key element implementation, for map fields. Created in build() after\r
+             * types are resolved.\r
+             * @type {ProtoBuf.Element}\r
+             * @expose\r
+             */\r
+            this.keyElement = null;\r
+\r
+            // Convert field names to camel case notation if the override is set\r
+            if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))\r
+                this.name = ProtoBuf.Util.toCamelCase(this.name);\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.Field.prototype\r
+         * @inner\r
+         */\r
+        var FieldPrototype = Field.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * Builds the field.\r
+         * @override\r
+         * @expose\r
+         */\r
+        FieldPrototype.build = function() {\r
+            this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);\r
+            if (this.map)\r
+                this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);\r
+\r
+            // In proto3, fields do not have field presence, and every field is set to\r
+            // its type's default value ("", 0, 0.0, or false).\r
+            if (this.syntax === 'proto3' && !this.repeated && !this.map)\r
+                this.defaultValue = Element.defaultFieldValue(this.type);\r
+\r
+            // Otherwise, default values are present when explicitly specified\r
+            else if (typeof this.options['default'] !== 'undefined')\r
+                this.defaultValue = this.verifyValue(this.options['default']);\r
+        };\r
+\r
+        /**\r
+         * Checks if the given value can be set for this field.\r
+         * @param {*} value Value to check\r
+         * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.\r
+         * @return {*} Verified, maybe adjusted, value\r
+         * @throws {Error} If the value cannot be set for this field\r
+         * @expose\r
+         */\r
+        FieldPrototype.verifyValue = function(value, skipRepeated) {\r
+            skipRepeated = skipRepeated || false;\r
+            var self = this;\r
+            function fail(val, msg) {\r
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");\r
+            }\r
+            if (value === null) { // NULL values for optional fields\r
+                if (this.required)\r
+                    fail(typeof value, "required");\r
+                if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])\r
+                    fail(typeof value, "proto3 field without field presence cannot be null");\r
+                return null;\r
+            }\r
+            var i;\r
+            if (this.repeated && !skipRepeated) { // Repeated values as arrays\r
+                if (!Array.isArray(value))\r
+                    value = [value];\r
+                var res = [];\r
+                for (i=0; i<value.length; i++)\r
+                    res.push(this.element.verifyValue(value[i]));\r
+                return res;\r
+            }\r
+            if (this.map && !skipRepeated) { // Map values as objects\r
+                if (!(value instanceof ProtoBuf.Map)) {\r
+                    // If not already a Map, attempt to convert.\r
+                    if (!(value instanceof Object)) {\r
+                        fail(typeof value,\r
+                             "expected ProtoBuf.Map or raw object for map field");\r
+                    }\r
+                    return new ProtoBuf.Map(this, value);\r
+                } else {\r
+                    return value;\r
+                }\r
+            }\r
+            // All non-repeated fields expect no array\r
+            if (!this.repeated && Array.isArray(value))\r
+                fail(typeof value, "no array expected");\r
+\r
+            return this.element.verifyValue(value);\r
+        };\r
+\r
+        /**\r
+         * Determines whether the field will have a presence on the wire given its\r
+         * value.\r
+         * @param {*} value Verified field value\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message\r
+         * @return {boolean} Whether the field will be present on the wire\r
+         */\r
+        FieldPrototype.hasWirePresence = function(value, message) {\r
+            if (this.syntax !== 'proto3')\r
+                return (value !== null);\r
+            if (this.oneof && message[this.oneof.name] === this.name)\r
+                return true;\r
+            switch (this.type) {\r
+                case ProtoBuf.TYPES["int32"]:\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    return value !== 0;\r
+\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                    return value.low !== 0 || value.high !== 0;\r
+\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    return value;\r
+\r
+                case ProtoBuf.TYPES["float"]:\r
+                case ProtoBuf.TYPES["double"]:\r
+                    return value !== 0.0;\r
+\r
+                case ProtoBuf.TYPES["string"]:\r
+                    return value.length > 0;\r
+\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    return value.remaining() > 0;\r
+\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    return value !== 0;\r
+\r
+                case ProtoBuf.TYPES["message"]:\r
+                    return value !== null;\r
+                default:\r
+                    return true;\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Encodes the specified field value to the specified buffer.\r
+         * @param {*} value Verified field value\r
+         * @param {ByteBuffer} buffer ByteBuffer to encode to\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message\r
+         * @return {ByteBuffer} The ByteBuffer for chaining\r
+         * @throws {Error} If the field cannot be encoded\r
+         * @expose\r
+         */\r
+        FieldPrototype.encode = function(value, buffer, message) {\r
+            if (this.type === null || typeof this.type !== 'object')\r
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);\r
+            if (value === null || (this.repeated && value.length == 0))\r
+                return buffer; // Optional omitted\r
+            try {\r
+                if (this.repeated) {\r
+                    var i;\r
+                    // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire\r
+                    // types) can be declared 'packed'."\r
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {\r
+                        // "All of the elements of the field are packed into a single key-value pair with wire type 2\r
+                        // (length-delimited). Each element is encoded the same way it would be normally, except without a\r
+                        // tag preceding it."\r
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1\r
+                        var start = buffer.offset; // Remember where the contents begin\r
+                        for (i=0; i<value.length; i++)\r
+                            this.element.encodeValue(this.id, value[i], buffer);\r
+                        var len = buffer.offset-start,\r
+                            varintLen = ByteBuffer.calculateVarint32(len);\r
+                        if (varintLen > 1) { // We need to move the contents\r
+                            var contents = buffer.slice(start, buffer.offset);\r
+                            start += varintLen-1;\r
+                            buffer.offset = start;\r
+                            buffer.append(contents);\r
+                        }\r
+                        buffer.writeVarint32(len, start-varintLen);\r
+                    } else {\r
+                        // "If your message definition has repeated elements (without the [packed=true] option), the encoded\r
+                        // message has zero or more key-value pairs with the same tag number"\r
+                        for (i=0; i<value.length; i++)\r
+                            buffer.writeVarint32((this.id << 3) | this.type.wireType),\r
+                            this.element.encodeValue(this.id, value[i], buffer);\r
+                    }\r
+                } else if (this.map) {\r
+                    // Write out each map entry as a submessage.\r
+                    value.forEach(function(val, key, m) {\r
+                        // Compute the length of the submessage (key, val) pair.\r
+                        var length =\r
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +\r
+                            this.keyElement.calculateLength(1, key) +\r
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +\r
+                            this.element.calculateLength(2, val);\r
+\r
+                        // Submessage with wire type of length-delimited.\r
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        buffer.writeVarint32(length);\r
+\r
+                        // Write out the key and val.\r
+                        buffer.writeVarint32((1 << 3) | this.keyType.wireType);\r
+                        this.keyElement.encodeValue(1, key, buffer);\r
+                        buffer.writeVarint32((2 << 3) | this.type.wireType);\r
+                        this.element.encodeValue(2, val, buffer);\r
+                    }, this);\r
+                } else {\r
+                    if (this.hasWirePresence(value, message)) {\r
+                        buffer.writeVarint32((this.id << 3) | this.type.wireType);\r
+                        this.element.encodeValue(this.id, value, buffer);\r
+                    }\r
+                }\r
+            } catch (e) {\r
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");\r
+            }\r
+            return buffer;\r
+        };\r
+\r
+        /**\r
+         * Calculates the length of this field's value on the network level.\r
+         * @param {*} value Field value\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message\r
+         * @returns {number} Byte length\r
+         * @expose\r
+         */\r
+        FieldPrototype.calculate = function(value, message) {\r
+            value = this.verifyValue(value); // May throw\r
+            if (this.type === null || typeof this.type !== 'object')\r
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);\r
+            if (value === null || (this.repeated && value.length == 0))\r
+                return 0; // Optional omitted\r
+            var n = 0;\r
+            try {\r
+                if (this.repeated) {\r
+                    var i, ni;\r
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {\r
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        ni = 0;\r
+                        for (i=0; i<value.length; i++)\r
+                            ni += this.element.calculateLength(this.id, value[i]);\r
+                        n += ByteBuffer.calculateVarint32(ni);\r
+                        n += ni;\r
+                    } else {\r
+                        for (i=0; i<value.length; i++)\r
+                            n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),\r
+                            n += this.element.calculateLength(this.id, value[i]);\r
+                    }\r
+                } else if (this.map) {\r
+                    // Each map entry becomes a submessage.\r
+                    value.forEach(function(val, key, m) {\r
+                        // Compute the length of the submessage (key, val) pair.\r
+                        var length =\r
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +\r
+                            this.keyElement.calculateLength(1, key) +\r
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +\r
+                            this.element.calculateLength(2, val);\r
+\r
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        n += ByteBuffer.calculateVarint32(length);\r
+                        n += length;\r
+                    }, this);\r
+                } else {\r
+                    if (this.hasWirePresence(value, message)) {\r
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);\r
+                        n += this.element.calculateLength(this.id, value);\r
+                    }\r
+                }\r
+            } catch (e) {\r
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");\r
+            }\r
+            return n;\r
+        };\r
+\r
+        /**\r
+         * Decode the field value from the specified buffer.\r
+         * @param {number} wireType Leading wire type\r
+         * @param {ByteBuffer} buffer ByteBuffer to decode from\r
+         * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.\r
+         * @return {*} Decoded value: array for packed repeated fields, [key, value] for\r
+         *             map fields, or an individual value otherwise.\r
+         * @throws {Error} If the field cannot be decoded\r
+         * @expose\r
+         */\r
+        FieldPrototype.decode = function(wireType, buffer, skipRepeated) {\r
+            var value, nBytes;\r
+\r
+            // We expect wireType to match the underlying type's wireType unless we see\r
+            // a packed repeated field, or unless this is a map field.\r
+            var wireTypeOK =\r
+                (!this.map && wireType == this.type.wireType) ||\r
+                (!skipRepeated && this.repeated && this.options["packed"] &&\r
+                 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||\r
+                (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);\r
+            if (!wireTypeOK)\r
+                throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");\r
+\r
+            // Handle packed repeated fields.\r
+            if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {\r
+                if (!skipRepeated) {\r
+                    nBytes = buffer.readVarint32();\r
+                    nBytes = buffer.offset + nBytes; // Limit\r
+                    var values = [];\r
+                    while (buffer.offset < nBytes)\r
+                        values.push(this.decode(this.type.wireType, buffer, true));\r
+                    return values;\r
+                }\r
+                // Read the next value otherwise...\r
+            }\r
+\r
+            // Handle maps.\r
+            if (this.map) {\r
+                // Read one (key, value) submessage, and return [key, value]\r
+                var key = Element.defaultFieldValue(this.keyType);\r
+                value = Element.defaultFieldValue(this.type);\r
+\r
+                // Read the length\r
+                nBytes = buffer.readVarint32();\r
+                if (buffer.remaining() < nBytes)\r
+                    throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());\r
+\r
+                // Get a sub-buffer of this key/value submessage\r
+                var msgbuf = buffer.clone();\r
+                msgbuf.limit = msgbuf.offset + nBytes;\r
+                buffer.offset += nBytes;\r
+\r
+                while (msgbuf.remaining() > 0) {\r
+                    var tag = msgbuf.readVarint32();\r
+                    wireType = tag & 0x07;\r
+                    var id = tag >>> 3;\r
+                    if (id === 1) {\r
+                        key = this.keyElement.decode(msgbuf, wireType, id);\r
+                    } else if (id === 2) {\r
+                        value = this.element.decode(msgbuf, wireType, id);\r
+                    } else {\r
+                        throw Error("Unexpected tag in map field key/value submessage");\r
+                    }\r
+                }\r
+\r
+                return [key, value];\r
+            }\r
+\r
+            // Handle singular and non-packed repeated field values.\r
+            return this.element.decode(buffer, wireType, this.id);\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.Field\r
+         * @expose\r
+         */\r
+        Reflect.Message.Field = Field;\r
+\r
+        /**\r
+         * Constructs a new Message ExtensionField.\r
+         * @exports ProtoBuf.Reflect.Message.ExtensionField\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Message} message Message reference\r
+         * @param {string} rule Rule, one of requried, optional, repeated\r
+         * @param {string} type Data type, e.g. int32\r
+         * @param {string} name Field name\r
+         * @param {number} id Unique field id\r
+         * @param {!Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Message.Field\r
+         */\r
+        var ExtensionField = function(builder, message, rule, type, name, id, options) {\r
+            Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);\r
+\r
+            /**\r
+             * Extension reference.\r
+             * @type {!ProtoBuf.Reflect.Extension}\r
+             * @expose\r
+             */\r
+            this.extension;\r
+        };\r
+\r
+        // Extends Field\r
+        ExtensionField.prototype = Object.create(Field.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.ExtensionField\r
+         * @expose\r
+         */\r
+        Reflect.Message.ExtensionField = ExtensionField;\r
+\r
+        /**\r
+         * Constructs a new Message OneOf.\r
+         * @exports ProtoBuf.Reflect.Message.OneOf\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Message} message Message reference\r
+         * @param {string} name OneOf name\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var OneOf = function(builder, message, name) {\r
+            T.call(this, builder, message, name);\r
+\r
+            /**\r
+             * Enclosed fields.\r
+             * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}\r
+             * @expose\r
+             */\r
+            this.fields = [];\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.OneOf\r
+         * @expose\r
+         */\r
+        Reflect.Message.OneOf = OneOf;\r
+\r
+        /**\r
+         * Constructs a new Enum.\r
+         * @exports ProtoBuf.Reflect.Enum\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object\r
+         * @param {string} name Enum name\r
+         * @param {Object.<string,*>=} options Enum options\r
+         * @param {string?} syntax The syntax level (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Namespace\r
+         */\r
+        var Enum = function(builder, parent, name, options, syntax) {\r
+            Namespace.call(this, builder, parent, name, options, syntax);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Enum";\r
+\r
+            /**\r
+             * Runtime enum object.\r
+             * @type {Object.<string,number>|null}\r
+             * @expose\r
+             */\r
+            this.object = null;\r
+        };\r
+\r
+        /**\r
+         * Gets the string name of an enum value.\r
+         * @param {!ProtoBuf.Builder.Enum} enm Runtime enum\r
+         * @param {number} value Enum value\r
+         * @returns {?string} Name or `null` if not present\r
+         * @expose\r
+         */\r
+        Enum.getName = function(enm, value) {\r
+            var keys = Object.keys(enm);\r
+            for (var i=0, key; i<keys.length; ++i)\r
+                if (enm[key = keys[i]] === value)\r
+                    return key;\r
+            return null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Enum.prototype\r
+         * @inner\r
+         */\r
+        var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);\r
+\r
+        /**\r
+         * Builds this enum and returns the runtime counterpart.\r
+         * @param {boolean} rebuild Whether to rebuild or not, defaults to false\r
+         * @returns {!Object.<string,number>}\r
+         * @expose\r
+         */\r
+        EnumPrototype.build = function(rebuild) {\r
+            if (this.object && !rebuild)\r
+                return this.object;\r
+            var enm = new ProtoBuf.Builder.Enum(),\r
+                values = this.getChildren(Enum.Value);\r
+            for (var i=0, k=values.length; i<k; ++i)\r
+                enm[values[i]['name']] = values[i]['id'];\r
+            if (Object.defineProperty)\r
+                Object.defineProperty(enm, '$options', {\r
+                    "value": this.buildOpt(),\r
+                    "enumerable": false\r
+                });\r
+            return this.object = enm;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Enum\r
+         * @expose\r
+         */\r
+        Reflect.Enum = Enum;\r
+\r
+        /**\r
+         * Constructs a new Enum Value.\r
+         * @exports ProtoBuf.Reflect.Enum.Value\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Enum} enm Enum reference\r
+         * @param {string} name Field name\r
+         * @param {number} id Unique field id\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Value = function(builder, enm, name, id) {\r
+            T.call(this, builder, enm, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Enum.Value";\r
+\r
+            /**\r
+             * Unique enum value id.\r
+             * @type {number}\r
+             * @expose\r
+             */\r
+            this.id = id;\r
+        };\r
+\r
+        // Extends T\r
+        Value.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Enum.Value\r
+         * @expose\r
+         */\r
+        Reflect.Enum.Value = Value;\r
+\r
+        /**\r
+         * An extension (field).\r
+         * @exports ProtoBuf.Reflect.Extension\r
+         * @constructor\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.T} parent Parent object\r
+         * @param {string} name Object name\r
+         * @param {!ProtoBuf.Reflect.Message.Field} field Extension field\r
+         */\r
+        var Extension = function(builder, parent, name, field) {\r
+            T.call(this, builder, parent, name);\r
+\r
+            /**\r
+             * Extended message field.\r
+             * @type {!ProtoBuf.Reflect.Message.Field}\r
+             * @expose\r
+             */\r
+            this.field = field;\r
+        };\r
+\r
+        // Extends T\r
+        Extension.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Extension\r
+         * @expose\r
+         */\r
+        Reflect.Extension = Extension;\r
+\r
+        /**\r
+         * Constructs a new Service.\r
+         * @exports ProtoBuf.Reflect.Service\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Namespace} root Root\r
+         * @param {string} name Service name\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Namespace\r
+         */\r
+        var Service = function(builder, root, name, options) {\r
+            Namespace.call(this, builder, root, name, options);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Service";\r
+\r
+            /**\r
+             * Built runtime service class.\r
+             * @type {?function(new:ProtoBuf.Builder.Service)}\r
+             */\r
+            this.clazz = null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.prototype\r
+         * @inner\r
+         */\r
+        var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);\r
+\r
+        /**\r
+         * Builds the service and returns the runtime counterpart, which is a fully functional class.\r
+         * @see ProtoBuf.Builder.Service\r
+         * @param {boolean=} rebuild Whether to rebuild or not\r
+         * @return {Function} Service class\r
+         * @throws {Error} If the message cannot be built\r
+         * @expose\r
+         */\r
+        ServicePrototype.build = function(rebuild) {\r
+            if (this.clazz && !rebuild)\r
+                return this.clazz;\r
+\r
+            // Create the runtime Service class in its own scope\r
+            return this.clazz = (function(ProtoBuf, T) {\r
+\r
+                /**\r
+                 * Constructs a new runtime Service.\r
+                 * @name ProtoBuf.Builder.Service\r
+                 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message\r
+                 * @class Barebone of all runtime services.\r
+                 * @constructor\r
+                 * @throws {Error} If the service cannot be created\r
+                 */\r
+                var Service = function(rpcImpl) {\r
+                    ProtoBuf.Builder.Service.call(this);\r
+\r
+                    /**\r
+                     * Service implementation.\r
+                     * @name ProtoBuf.Builder.Service#rpcImpl\r
+                     * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}\r
+                     * @expose\r
+                     */\r
+                    this.rpcImpl = rpcImpl || function(name, msg, callback) {\r
+                        // This is what a user has to implement: A function receiving the method name, the actual message to\r
+                        // send (type checked) and the callback that's either provided with the error as its first\r
+                        // argument or null and the actual response message.\r
+                        setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!\r
+                    };\r
+                };\r
+\r
+                /**\r
+                 * @alias ProtoBuf.Builder.Service.prototype\r
+                 * @inner\r
+                 */\r
+                var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);\r
+\r
+                /**\r
+                 * Asynchronously performs an RPC call using the given RPC implementation.\r
+                 * @name ProtoBuf.Builder.Service.[Method]\r
+                 * @function\r
+                 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation\r
+                 * @param {ProtoBuf.Builder.Message} req Request\r
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving\r
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes\r
+                 * @abstract\r
+                 */\r
+\r
+                /**\r
+                 * Asynchronously performs an RPC call using the instance's RPC implementation.\r
+                 * @name ProtoBuf.Builder.Service#[Method]\r
+                 * @function\r
+                 * @param {ProtoBuf.Builder.Message} req Request\r
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving\r
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes\r
+                 * @abstract\r
+                 */\r
+\r
+                var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);\r
+                for (var i=0; i<rpc.length; i++) {\r
+                    (function(method) {\r
+\r
+                        // service#Method(message, callback)\r
+                        ServicePrototype[method.name] = function(req, callback) {\r
+                            try {\r
+                                try {\r
+                                    // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.\r
+                                    req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));\r
+                                } catch (err) {\r
+                                    if (!(err instanceof TypeError))\r
+                                        throw err;\r
+                                }\r
+                                if (req === null || typeof req !== 'object')\r
+                                    throw Error("Illegal arguments");\r
+                                if (!(req instanceof method.resolvedRequestType.clazz))\r
+                                    req = new method.resolvedRequestType.clazz(req);\r
+                                this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async\r
+                                    if (err) {\r
+                                        callback(err);\r
+                                        return;\r
+                                    }\r
+                                    // Coalesce to empty string when service response has empty content\r
+                                    if (res === null)\r
+                                        res = ''\r
+                                    try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}\r
+                                    if (!res || !(res instanceof method.resolvedResponseType.clazz)) {\r
+                                        callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));\r
+                                        return;\r
+                                    }\r
+                                    callback(null, res);\r
+                                });\r
+                            } catch (err) {\r
+                                setTimeout(callback.bind(this, err), 0);\r
+                            }\r
+                        };\r
+\r
+                        // Service.Method(rpcImpl, message, callback)\r
+                        Service[method.name] = function(rpcImpl, req, callback) {\r
+                            new Service(rpcImpl)[method.name](req, callback);\r
+                        };\r
+\r
+                        if (Object.defineProperty)\r
+                            Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),\r
+                            Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });\r
+                    })(rpc[i]);\r
+                }\r
+\r
+                // Properties\r
+\r
+                /**\r
+                 * Service options.\r
+                 * @name ProtoBuf.Builder.Service.$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $optionsS; // cc needs this\r
+\r
+                /**\r
+                 * Service options.\r
+                 * @name ProtoBuf.Builder.Service#$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $options;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Service.$type\r
+                 * @type {!ProtoBuf.Reflect.Service}\r
+                 * @expose\r
+                 */\r
+                var $typeS;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Service#$type\r
+                 * @type {!ProtoBuf.Reflect.Service}\r
+                 * @expose\r
+                 */\r
+                var $type;\r
+\r
+                if (Object.defineProperty)\r
+                    Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),\r
+                    Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),\r
+                    Object.defineProperty(Service, "$type", { "value": T }),\r
+                    Object.defineProperty(ServicePrototype, "$type", { "value": T });\r
+\r
+                return Service;\r
+\r
+            })(ProtoBuf, this);\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service\r
+         * @expose\r
+         */\r
+        Reflect.Service = Service;\r
+\r
+        /**\r
+         * Abstract service method.\r
+         * @exports ProtoBuf.Reflect.Service.Method\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Service} svc Service\r
+         * @param {string} name Method name\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Method = function(builder, svc, name, options) {\r
+            T.call(this, builder, svc, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Service.Method";\r
+\r
+            /**\r
+             * Options.\r
+             * @type {Object.<string, *>}\r
+             * @expose\r
+             */\r
+            this.options = options || {};\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.Method.prototype\r
+         * @inner\r
+         */\r
+        var MethodPrototype = Method.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * Builds the method's '$options' property.\r
+         * @name ProtoBuf.Reflect.Service.Method#buildOpt\r
+         * @function\r
+         * @return {Object.<string,*>}\r
+         */\r
+        MethodPrototype.buildOpt = NamespacePrototype.buildOpt;\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.Method\r
+         * @expose\r
+         */\r
+        Reflect.Service.Method = Method;\r
+\r
+        /**\r
+         * RPC service method.\r
+         * @exports ProtoBuf.Reflect.Service.RPCMethod\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Service} svc Service\r
+         * @param {string} name Method name\r
+         * @param {string} request Request message name\r
+         * @param {string} response Response message name\r
+         * @param {boolean} request_stream Whether requests are streamed\r
+         * @param {boolean} response_stream Whether responses are streamed\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Service.Method\r
+         */\r
+        var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {\r
+            Method.call(this, builder, svc, name, options);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Service.RPCMethod";\r
+\r
+            /**\r
+             * Request message name.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.requestName = request;\r
+\r
+            /**\r
+             * Response message name.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.responseName = response;\r
+\r
+            /**\r
+             * Whether requests are streamed\r
+             * @type {bool}\r
+             * @expose\r
+             */\r
+            this.requestStream = request_stream;\r
+\r
+            /**\r
+             * Whether responses are streamed\r
+             * @type {bool}\r
+             * @expose\r
+             */\r
+            this.responseStream = response_stream;\r
+\r
+            /**\r
+             * Resolved request message type.\r
+             * @type {ProtoBuf.Reflect.Message}\r
+             * @expose\r
+             */\r
+            this.resolvedRequestType = null;\r
+\r
+            /**\r
+             * Resolved response message type.\r
+             * @type {ProtoBuf.Reflect.Message}\r
+             * @expose\r
+             */\r
+            this.resolvedResponseType = null;\r
+        };\r
+\r
+        // Extends Method\r
+        RPCMethod.prototype = Object.create(Method.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.RPCMethod\r
+         * @expose\r
+         */\r
+        Reflect.Service.RPCMethod = RPCMethod;\r
+\r
+        return Reflect;\r
+\r
+    })(ProtoBuf);\r
+\r
+    /**\r
+     * @alias ProtoBuf.Builder\r
+     * @expose\r
+     */\r
+    ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Constructs a new Builder.\r
+         * @exports ProtoBuf.Builder\r
+         * @class Provides the functionality to build protocol messages.\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         */\r
+        var Builder = function(options) {\r
+\r
+            /**\r
+             * Namespace.\r
+             * @type {ProtoBuf.Reflect.Namespace}\r
+             * @expose\r
+             */\r
+            this.ns = new Reflect.Namespace(this, null, ""); // Global namespace\r
+\r
+            /**\r
+             * Namespace pointer.\r
+             * @type {ProtoBuf.Reflect.T}\r
+             * @expose\r
+             */\r
+            this.ptr = this.ns;\r
+\r
+            /**\r
+             * Resolved flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.resolved = false;\r
+\r
+            /**\r
+             * The current building result.\r
+             * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}\r
+             * @expose\r
+             */\r
+            this.result = null;\r
+\r
+            /**\r
+             * Imported files.\r
+             * @type {Array.<string>}\r
+             * @expose\r
+             */\r
+            this.files = {};\r
+\r
+            /**\r
+             * Import root override.\r
+             * @type {?string}\r
+             * @expose\r
+             */\r
+            this.importRoot = null;\r
+\r
+            /**\r
+             * Options.\r
+             * @type {!Object.<string, *>}\r
+             * @expose\r
+             */\r
+            this.options = options || {};\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.prototype\r
+         * @inner\r
+         */\r
+        var BuilderPrototype = Builder.prototype;\r
+\r
+        // ----- Definition tests -----\r
+\r
+        /**\r
+         * Tests if a definition most likely describes a message.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isMessage = function(def) {\r
+            // Messages require a string name\r
+            if (typeof def["name"] !== 'string')\r
+                return false;\r
+            // Messages do not contain values (enum) or rpc methods (service)\r
+            if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes a message field.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isMessageField = function(def) {\r
+            // Message fields require a string rule, name and type and an id\r
+            if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes an enum.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isEnum = function(def) {\r
+            // Enums require a string name\r
+            if (typeof def["name"] !== 'string')\r
+                return false;\r
+            // Enums require at least one value\r
+            if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes a service.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isService = function(def) {\r
+            // Services require a string name and an rpc object\r
+            if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes an extended message\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isExtend = function(def) {\r
+            // Extends rquire a string ref\r
+            if (typeof def["ref"] !== 'string')\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        // ----- Building -----\r
+\r
+        /**\r
+         * Resets the pointer to the root namespace.\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @expose\r
+         */\r
+        BuilderPrototype.reset = function() {\r
+            this.ptr = this.ns;\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Defines a namespace on top of the current pointer position and places the pointer on it.\r
+         * @param {string} namespace\r
+         * @return {!ProtoBuf.Builder} this\r
+         * @expose\r
+         */\r
+        BuilderPrototype.define = function(namespace) {\r
+            if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))\r
+                throw Error("illegal namespace: "+namespace);\r
+            namespace.split(".").forEach(function(part) {\r
+                var ns = this.ptr.getChild(part);\r
+                if (ns === null) // Keep existing\r
+                    this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));\r
+                this.ptr = ns;\r
+            }, this);\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Creates the specified definitions at the current pointer position.\r
+         * @param {!Array.<!Object>} defs Messages, enums or services to create\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @throws {Error} If a message definition is invalid\r
+         * @expose\r
+         */\r
+        BuilderPrototype.create = function(defs) {\r
+            if (!defs)\r
+                return this; // Nothing to create\r
+            if (!Array.isArray(defs))\r
+                defs = [defs];\r
+            else {\r
+                if (defs.length === 0)\r
+                    return this;\r
+                defs = defs.slice();\r
+            }\r
+\r
+            // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.\r
+            var stack = [defs];\r
+            while (stack.length > 0) {\r
+                defs = stack.pop();\r
+\r
+                if (!Array.isArray(defs)) // Stack always contains entire namespaces\r
+                    throw Error("not a valid namespace: "+JSON.stringify(defs));\r
+\r
+                while (defs.length > 0) {\r
+                    var def = defs.shift(); // Namespaces always contain an array of messages, enums and services\r
+\r
+                    if (Builder.isMessage(def)) {\r
+                        var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);\r
+\r
+                        // Create OneOfs\r
+                        var oneofs = {};\r
+                        if (def["oneofs"])\r
+                            Object.keys(def["oneofs"]).forEach(function(name) {\r
+                                obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));\r
+                            }, this);\r
+\r
+                        // Create fields\r
+                        if (def["fields"])\r
+                            def["fields"].forEach(function(fld) {\r
+                                if (obj.getChild(fld["id"]|0) !== null)\r
+                                    throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);\r
+                                if (fld["options"] && typeof fld["options"] !== 'object')\r
+                                    throw Error("illegal field options in "+obj.name+"#"+fld["name"]);\r
+                                var oneof = null;\r
+                                if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))\r
+                                    throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);\r
+                                fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);\r
+                                if (oneof)\r
+                                    oneof.fields.push(fld);\r
+                                obj.addChild(fld);\r
+                            }, this);\r
+\r
+                        // Push children to stack\r
+                        var subObj = [];\r
+                        if (def["enums"])\r
+                            def["enums"].forEach(function(enm) {\r
+                                subObj.push(enm);\r
+                            });\r
+                        if (def["messages"])\r
+                            def["messages"].forEach(function(msg) {\r
+                                subObj.push(msg);\r
+                            });\r
+                        if (def["services"])\r
+                            def["services"].forEach(function(svc) {\r
+                                subObj.push(svc);\r
+                            });\r
+\r
+                        // Set extension ranges\r
+                        if (def["extensions"]) {\r
+                            if (typeof def["extensions"][0] === 'number') // pre 5.0.1\r
+                                obj.extensions = [ def["extensions"] ];\r
+                            else\r
+                                obj.extensions = def["extensions"];\r
+                        }\r
+\r
+                        // Create on top of current namespace\r
+                        this.ptr.addChild(obj);\r
+                        if (subObj.length > 0) {\r
+                            stack.push(defs); // Push the current level back\r
+                            defs = subObj; // Continue processing sub level\r
+                            subObj = null;\r
+                            this.ptr = obj; // And move the pointer to this namespace\r
+                            obj = null;\r
+                            continue;\r
+                        }\r
+                        subObj = null;\r
+\r
+                    } else if (Builder.isEnum(def)) {\r
+\r
+                        obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);\r
+                        def["values"].forEach(function(val) {\r
+                            obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));\r
+                        }, this);\r
+                        this.ptr.addChild(obj);\r
+\r
+                    } else if (Builder.isService(def)) {\r
+\r
+                        obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);\r
+                        Object.keys(def["rpc"]).forEach(function(name) {\r
+                            var mtd = def["rpc"][name];\r
+                            obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));\r
+                        }, this);\r
+                        this.ptr.addChild(obj);\r
+\r
+                    } else if (Builder.isExtend(def)) {\r
+\r
+                        obj = this.ptr.resolve(def["ref"], true);\r
+                        if (obj) {\r
+                            def["fields"].forEach(function(fld) {\r
+                                if (obj.getChild(fld['id']|0) !== null)\r
+                                    throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);\r
+                                // Check if field id is allowed to be extended\r
+                                if (obj.extensions) {\r
+                                    var valid = false;\r
+                                    obj.extensions.forEach(function(range) {\r
+                                        if (fld["id"] >= range[0] && fld["id"] <= range[1])\r
+                                            valid = true;\r
+                                    });\r
+                                    if (!valid)\r
+                                        throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");\r
+                                }\r
+                                // Convert extension field names to camel case notation if the override is set\r
+                                var name = fld["name"];\r
+                                if (this.options['convertFieldsToCamelCase'])\r
+                                    name = ProtoBuf.Util.toCamelCase(name);\r
+                                // see #161: Extensions use their fully qualified name as their runtime key and...\r
+                                var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);\r
+                                // ...are added on top of the current namespace as an extension which is used for\r
+                                // resolving their type later on (the extension always keeps the original name to\r
+                                // prevent naming collisions)\r
+                                var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);\r
+                                field.extension = ext;\r
+                                this.ptr.addChild(ext);\r
+                                obj.addChild(field);\r
+                            }, this);\r
+\r
+                        } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions\r
+                            throw Error("extended message "+def["ref"]+" is not defined");\r
+\r
+                    } else\r
+                        throw Error("not a valid definition: "+JSON.stringify(def));\r
+\r
+                    def = null;\r
+                    obj = null;\r
+                }\r
+                // Break goes here\r
+                defs = null;\r
+                this.ptr = this.ptr.parent; // Namespace done, continue at parent\r
+            }\r
+            this.resolved = false; // Require re-resolve\r
+            this.result = null; // Require re-build\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Propagates syntax to all children.\r
+         * @param {!Object} parent\r
+         * @inner\r
+         */\r
+        function propagateSyntax(parent) {\r
+            if (parent['messages']) {\r
+                parent['messages'].forEach(function(child) {\r
+                    child["syntax"] = parent["syntax"];\r
+                    propagateSyntax(child);\r
+                });\r
+            }\r
+            if (parent['enums']) {\r
+                parent['enums'].forEach(function(child) {\r
+                    child["syntax"] = parent["syntax"];\r
+                });\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Imports another definition into this builder.\r
+         * @param {Object.<string,*>} json Parsed import\r
+         * @param {(string|{root: string, file: string})=} filename Imported file name\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @throws {Error} If the definition or file cannot be imported\r
+         * @expose\r
+         */\r
+        BuilderPrototype["import"] = function(json, filename) {\r
+            var delim = '/';\r
+\r
+            // Make sure to skip duplicate imports\r
+\r
+            if (typeof filename === 'string') {\r
+\r
+                if (ProtoBuf.Util.IS_NODE)\r
+                    filename = require("path")['resolve'](filename);\r
+                if (this.files[filename] === true)\r
+                    return this.reset();\r
+                this.files[filename] = true;\r
+\r
+            } else if (typeof filename === 'object') { // Object with root, file.\r
+\r
+                var root = filename.root;\r
+                if (ProtoBuf.Util.IS_NODE)\r
+                    root = require("path")['resolve'](root);\r
+                if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)\r
+                    delim = '\\';\r
+                var fname;\r
+                if (ProtoBuf.Util.IS_NODE)\r
+                    fname = require("path")['join'](root, filename.file);\r
+                else\r
+                    fname = root + delim + filename.file;\r
+                if (this.files[fname] === true)\r
+                    return this.reset();\r
+                this.files[fname] = true;\r
+            }\r
+\r
+            // Import imports\r
+\r
+            if (json['imports'] && json['imports'].length > 0) {\r
+                var importRoot,\r
+                    resetRoot = false;\r
+\r
+                if (typeof filename === 'object') { // If an import root is specified, override\r
+\r
+                    this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards\r
+                    importRoot = this.importRoot;\r
+                    filename = filename["file"];\r
+                    if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)\r
+                        delim = '\\';\r
+\r
+                } else if (typeof filename === 'string') {\r
+\r
+                    if (this.importRoot) // If import root is overridden, use it\r
+                        importRoot = this.importRoot;\r
+                    else { // Otherwise compute from filename\r
+                        if (filename.indexOf("/") >= 0) { // Unix\r
+                            importRoot = filename.replace(/\/[^\/]*$/, "");\r
+                            if (/* /file.proto */ importRoot === "")\r
+                                importRoot = "/";\r
+                        } else if (filename.indexOf("\\") >= 0) { // Windows\r
+                            importRoot = filename.replace(/\\[^\\]*$/, "");\r
+                            delim = '\\';\r
+                        } else\r
+                            importRoot = ".";\r
+                    }\r
+\r
+                } else\r
+                    importRoot = null;\r
+\r
+                for (var i=0; i<json['imports'].length; i++) {\r
+                    if (typeof json['imports'][i] === 'string') { // Import file\r
+                        if (!importRoot)\r
+                            throw Error("cannot determine import root");\r
+                        var importFilename = json['imports'][i];\r
+                        if (importFilename === "google/protobuf/descriptor.proto")\r
+                            continue; // Not needed and therefore not used\r
+                        if (ProtoBuf.Util.IS_NODE)\r
+                            importFilename = require("path")['join'](importRoot, importFilename);\r
+                        else\r
+                            importFilename = importRoot + delim + importFilename;\r
+                        if (this.files[importFilename] === true)\r
+                            continue; // Already imported\r
+                        if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto)       // If this is a light build\r
+                            importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file\r
+                        var contents = ProtoBuf.Util.fetch(importFilename);\r
+                        if (contents === null)\r
+                            throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");\r
+                        if (/\.json$/i.test(importFilename)) // Always possible\r
+                            this["import"](JSON.parse(contents+""), importFilename); // May throw\r
+                        else\r
+                            this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw\r
+                    } else // Import structure\r
+                        if (!filename)\r
+                            this["import"](json['imports'][i]);\r
+                        else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique\r
+                            this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));\r
+                        else // Without extension: Append _importN to make it unique\r
+                            this["import"](json['imports'][i], filename+"_import"+i);\r
+                }\r
+                if (resetRoot) // Reset import root override when all imports are done\r
+                    this.importRoot = null;\r
+            }\r
+\r
+            // Import structures\r
+\r
+            if (json['package'])\r
+                this.define(json['package']);\r
+            if (json['syntax'])\r
+                propagateSyntax(json);\r
+            var base = this.ptr;\r
+            if (json['options'])\r
+                Object.keys(json['options']).forEach(function(key) {\r
+                    base.options[key] = json['options'][key];\r
+                });\r
+            if (json['messages'])\r
+                this.create(json['messages']),\r
+                this.ptr = base;\r
+            if (json['enums'])\r
+                this.create(json['enums']),\r
+                this.ptr = base;\r
+            if (json['services'])\r
+                this.create(json['services']),\r
+                this.ptr = base;\r
+            if (json['extends'])\r
+                this.create(json['extends']);\r
+\r
+            return this.reset();\r
+        };\r
+\r
+        /**\r
+         * Resolves all namespace objects.\r
+         * @throws {Error} If a type cannot be resolved\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @expose\r
+         */\r
+        BuilderPrototype.resolveAll = function() {\r
+            // Resolve all reflected objects\r
+            var res;\r
+            if (this.ptr == null || typeof this.ptr.type === 'object')\r
+                return this; // Done (already resolved)\r
+\r
+            if (this.ptr instanceof Reflect.Namespace) { // Resolve children\r
+\r
+                this.ptr.children.forEach(function(child) {\r
+                    this.ptr = child;\r
+                    this.resolveAll();\r
+                }, this);\r
+\r
+            } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type\r
+\r
+                if (!Lang.TYPE.test(this.ptr.type)) {\r
+                    if (!Lang.TYPEREF.test(this.ptr.type))\r
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);\r
+                    res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);\r
+                    if (!res)\r
+                        throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);\r
+                    this.ptr.resolvedType = res;\r
+                    if (res instanceof Reflect.Enum) {\r
+                        this.ptr.type = ProtoBuf.TYPES["enum"];\r
+                        if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')\r
+                            throw Error("proto3 message cannot reference proto2 enum");\r
+                    }\r
+                    else if (res instanceof Reflect.Message)\r
+                        this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];\r
+                    else\r
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);\r
+                } else\r
+                    this.ptr.type = ProtoBuf.TYPES[this.ptr.type];\r
+\r
+                // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type\r
+                // (i.e., no enums or messages), so we don't need to resolve against the current namespace.\r
+                if (this.ptr.map) {\r
+                    if (!Lang.TYPE.test(this.ptr.keyType))\r
+                        throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);\r
+                    this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];\r
+                }\r
+\r
+                // If it's a repeated and packable field then proto3 mandates it should be packed by\r
+                // default\r
+                if (\r
+                  this.ptr.syntax === 'proto3' &&\r
+                  this.ptr.repeated && this.ptr.options.packed === undefined &&\r
+                  ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1\r
+                ) {\r
+                  this.ptr.options.packed = true;\r
+                }\r
+\r
+            } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {\r
+\r
+                if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {\r
+                    res = this.ptr.parent.resolve(this.ptr.requestName, true);\r
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))\r
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);\r
+                    this.ptr.resolvedRequestType = res;\r
+                    res = this.ptr.parent.resolve(this.ptr.responseName, true);\r
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))\r
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);\r
+                    this.ptr.resolvedResponseType = res;\r
+                } else // Should not happen as nothing else is implemented\r
+                    throw Error("illegal service type in "+this.ptr.toString(true));\r
+\r
+            } else if (\r
+                !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built\r
+                !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built\r
+                !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum\r
+            )\r
+                throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);\r
+\r
+            return this.reset();\r
+        };\r
+\r
+        /**\r
+         * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,\r
+         * return the built package.\r
+         * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.\r
+         * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}\r
+         * @throws {Error} If a type could not be resolved\r
+         * @expose\r
+         */\r
+        BuilderPrototype.build = function(path) {\r
+            this.reset();\r
+            if (!this.resolved)\r
+                this.resolveAll(),\r
+                this.resolved = true,\r
+                this.result = null; // Require re-build\r
+            if (this.result === null) // (Re-)Build\r
+                this.result = this.ns.build();\r
+            if (!path)\r
+                return this.result;\r
+            var part = typeof path === 'string' ? path.split(".") : path,\r
+                ptr = this.result; // Build namespace pointer (no hasChild etc.)\r
+            for (var i=0; i<part.length; i++)\r
+                if (ptr[part[i]])\r
+                    ptr = ptr[part[i]];\r
+                else {\r
+                    ptr = null;\r
+                    break;\r
+                }\r
+            return ptr;\r
+        };\r
+\r
+        /**\r
+         * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.\r
+         * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.\r
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`\r
+         * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found\r
+         */\r
+        BuilderPrototype.lookup = function(path, excludeNonNamespace) {\r
+            return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;\r
+        };\r
+\r
+        /**\r
+         * Returns a string representation of this object.\r
+         * @return {string} String representation as of "Builder"\r
+         * @expose\r
+         */\r
+        BuilderPrototype.toString = function() {\r
+            return "Builder";\r
+        };\r
+\r
+        // ----- Base classes -----\r
+        // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.Message\r
+         */\r
+        Builder.Message = function() {};\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.Enum\r
+         */\r
+        Builder.Enum = function() {};\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.Message\r
+         */\r
+        Builder.Service = function() {};\r
+\r
+        return Builder;\r
+\r
+    })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);\r
+\r
+    /**\r
+     * @alias ProtoBuf.Map\r
+     * @expose\r
+     */\r
+    ProtoBuf.Map = (function(ProtoBuf, Reflect) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Constructs a new Map. A Map is a container that is used to implement map\r
+         * fields on message objects. It closely follows the ES6 Map API; however,\r
+         * it is distinct because we do not want to depend on external polyfills or\r
+         * on ES6 itself.\r
+         *\r
+         * @exports ProtoBuf.Map\r
+         * @param {!ProtoBuf.Reflect.Field} field Map field\r
+         * @param {Object.<string,*>=} contents Initial contents\r
+         * @constructor\r
+         */\r
+        var Map = function(field, contents) {\r
+            if (!field.map)\r
+                throw Error("field is not a map");\r
+\r
+            /**\r
+             * The field corresponding to this map.\r
+             * @type {!ProtoBuf.Reflect.Field}\r
+             */\r
+            this.field = field;\r
+\r
+            /**\r
+             * Element instance corresponding to key type.\r
+             * @type {!ProtoBuf.Reflect.Element}\r
+             */\r
+            this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);\r
+\r
+            /**\r
+             * Element instance corresponding to value type.\r
+             * @type {!ProtoBuf.Reflect.Element}\r
+             */\r
+            this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);\r
+\r
+            /**\r
+             * Internal map: stores mapping of (string form of key) -> (key, value)\r
+             * pair.\r
+             *\r
+             * We provide map semantics for arbitrary key types, but we build on top\r
+             * of an Object, which has only string keys. In order to avoid the need\r
+             * to convert a string key back to its native type in many situations,\r
+             * we store the native key value alongside the value. Thus, we only need\r
+             * a one-way mapping from a key type to its string form that guarantees\r
+             * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1\r
+             * === K2).\r
+             *\r
+             * @type {!Object<string, {key: *, value: *}>}\r
+             */\r
+            this.map = {};\r
+\r
+            /**\r
+             * Returns the number of elements in the map.\r
+             */\r
+            Object.defineProperty(this, "size", {\r
+                get: function() { return Object.keys(this.map).length; }\r
+            });\r
+\r
+            // Fill initial contents from a raw object.\r
+            if (contents) {\r
+                var keys = Object.keys(contents);\r
+                for (var i = 0; i < keys.length; i++) {\r
+                    var key = this.keyElem.valueFromString(keys[i]);\r
+                    var val = this.valueElem.verifyValue(contents[keys[i]]);\r
+                    this.map[this.keyElem.valueToString(key)] =\r
+                        { key: key, value: val };\r
+                }\r
+            }\r
+        };\r
+\r
+        var MapPrototype = Map.prototype;\r
+\r
+        /**\r
+         * Helper: return an iterator over an array.\r
+         * @param {!Array<*>} arr the array\r
+         * @returns {!Object} an iterator\r
+         * @inner\r
+         */\r
+        function arrayIterator(arr) {\r
+            var idx = 0;\r
+            return {\r
+                next: function() {\r
+                    if (idx < arr.length)\r
+                        return { done: false, value: arr[idx++] };\r
+                    return { done: true };\r
+                }\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Clears the map.\r
+         */\r
+        MapPrototype.clear = function() {\r
+            this.map = {};\r
+        };\r
+\r
+        /**\r
+         * Deletes a particular key from the map.\r
+         * @returns {boolean} Whether any entry with this key was deleted.\r
+         */\r
+        MapPrototype["delete"] = function(key) {\r
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));\r
+            var hadKey = keyValue in this.map;\r
+            delete this.map[keyValue];\r
+            return hadKey;\r
+        };\r
+\r
+        /**\r
+         * Returns an iterator over [key, value] pairs in the map.\r
+         * @returns {Object} The iterator\r
+         */\r
+        MapPrototype.entries = function() {\r
+            var entries = [];\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0, entry; i < strKeys.length; i++)\r
+                entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);\r
+            return arrayIterator(entries);\r
+        };\r
+\r
+        /**\r
+         * Returns an iterator over keys in the map.\r
+         * @returns {Object} The iterator\r
+         */\r
+        MapPrototype.keys = function() {\r
+            var keys = [];\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0; i < strKeys.length; i++)\r
+                keys.push(this.map[strKeys[i]].key);\r
+            return arrayIterator(keys);\r
+        };\r
+\r
+        /**\r
+         * Returns an iterator over values in the map.\r
+         * @returns {!Object} The iterator\r
+         */\r
+        MapPrototype.values = function() {\r
+            var values = [];\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0; i < strKeys.length; i++)\r
+                values.push(this.map[strKeys[i]].value);\r
+            return arrayIterator(values);\r
+        };\r
+\r
+        /**\r
+         * Iterates over entries in the map, calling a function on each.\r
+         * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.\r
+         * @param {Object=} thisArg The `this` value for the callback\r
+         */\r
+        MapPrototype.forEach = function(cb, thisArg) {\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0, entry; i < strKeys.length; i++)\r
+                cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);\r
+        };\r
+\r
+        /**\r
+         * Sets a key in the map to the given value.\r
+         * @param {*} key The key\r
+         * @param {*} value The value\r
+         * @returns {!ProtoBuf.Map} The map instance\r
+         */\r
+        MapPrototype.set = function(key, value) {\r
+            var keyValue = this.keyElem.verifyValue(key);\r
+            var valValue = this.valueElem.verifyValue(value);\r
+            this.map[this.keyElem.valueToString(keyValue)] =\r
+                { key: keyValue, value: valValue };\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Gets the value corresponding to a key in the map.\r
+         * @param {*} key The key\r
+         * @returns {*|undefined} The value, or `undefined` if key not present\r
+         */\r
+        MapPrototype.get = function(key) {\r
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));\r
+            if (!(keyValue in this.map))\r
+                return undefined;\r
+            return this.map[keyValue].value;\r
+        };\r
+\r
+        /**\r
+         * Determines whether the given key is present in the map.\r
+         * @param {*} key The key\r
+         * @returns {boolean} `true` if the key is present\r
+         */\r
+        MapPrototype.has = function(key) {\r
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));\r
+            return (keyValue in this.map);\r
+        };\r
+\r
+        return Map;\r
+    })(ProtoBuf, ProtoBuf.Reflect);\r
+\r
+\r
+    /**\r
+     * Constructs a new empty Builder.\r
+     * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf\r
+     * @return {!ProtoBuf.Builder} Builder\r
+     * @expose\r
+     */\r
+    ProtoBuf.newBuilder = function(options) {\r
+        options = options || {};\r
+        if (typeof options['convertFieldsToCamelCase'] === 'undefined')\r
+            options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;\r
+        if (typeof options['populateAccessors'] === 'undefined')\r
+            options['populateAccessors'] = ProtoBuf.populateAccessors;\r
+        return new ProtoBuf.Builder(options);\r
+    };\r
+\r
+    /**\r
+     * Loads a .json definition and returns the Builder.\r
+     * @param {!*|string} json JSON definition\r
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.\r
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.\r
+     * @return {ProtoBuf.Builder} Builder to create new messages\r
+     * @throws {Error} If the definition cannot be parsed or built\r
+     * @expose\r
+     */\r
+    ProtoBuf.loadJson = function(json, builder, filename) {\r
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))\r
+            filename = builder,\r
+            builder = null;\r
+        if (!builder || typeof builder !== 'object')\r
+            builder = ProtoBuf.newBuilder();\r
+        if (typeof json === 'string')\r
+            json = JSON.parse(json);\r
+        builder["import"](json, filename);\r
+        builder.resolveAll();\r
+        return builder;\r
+    };\r
+\r
+    /**\r
+     * Loads a .json file and returns the Builder.\r
+     * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with\r
+     *  an overridden 'root' path for all imported files.\r
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and\r
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the\r
+     *  file will be read synchronously and this function will return the Builder.\r
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.\r
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the\r
+     *   request has failed), else undefined\r
+     * @expose\r
+     */\r
+    ProtoBuf.loadJsonFile = function(filename, callback, builder) {\r
+        if (callback && typeof callback === 'object')\r
+            builder = callback,\r
+            callback = null;\r
+        else if (!callback || typeof callback !== 'function')\r
+            callback = null;\r
+        if (callback)\r
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {\r
+                if (contents === null) {\r
+                    callback(Error("Failed to fetch file"));\r
+                    return;\r
+                }\r
+                try {\r
+                    callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));\r
+                } catch (e) {\r
+                    callback(e);\r
+                }\r
+            });\r
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);\r
+        return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);\r
+    };\r
+\r
+    return ProtoBuf;\r
+});\r
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js
new file mode 100644 (file)
index 0000000..f2503a6
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ Released under the Apache License, Version 2.0
+ see: https://github.com/dcodeIO/protobuf.js for details
+*/
+var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,p,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[p]=d.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
+$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};
+$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var p=0;return $jscomp.iteratorPrototype(function(){return p<e.length?{done:!1,value:e[p++]}:{done:!0}})};
+$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,p){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var d=0,c={next:function(){if(d<e.length){var t=d++;return{value:p(t,e[t]),done:!1}}c.next=function(){return{done:!0,value:void 0}};return c.next()}};c[Symbol.iterator]=function(){return c};return c};
+$jscomp.polyfill=function(e,p,d,c){if(p){d=$jscomp.global;e=e.split(".");for(c=0;c<e.length-1;c++){var t=e[c];t in d||(d[t]={});d=d[t]}e=e[e.length-1];c=d[e];p=p(c);p!=c&&null!=p&&$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:p})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");
+$jscomp.polyfill("Array.prototype.entries",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e,d){return[e,d]})}},"es6-impl","es3");$jscomp.polyfill("Array.prototype.values",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e,d){return d})}},"es6","es3");
+(function(e,p){"function"===typeof define&&define.amd?define(["bytebuffer"],p):"function"===typeof require&&"object"===typeof module&&module&&module.exports?module.exports=p(require("bytebuffer"),!0):(e.dcodeIO=e.dcodeIO||{}).ProtoBuf=p(e.dcodeIO.ByteBuffer)})(this,function(e,p){var d={};d.ByteBuffer=e;d.Long=e.Long||null;d.VERSION="5.0.3";d.WIRE_TYPES={};d.WIRE_TYPES.VARINT=0;d.WIRE_TYPES.BITS64=1;d.WIRE_TYPES.LDELIM=2;d.WIRE_TYPES.STARTGROUP=3;d.WIRE_TYPES.ENDGROUP=4;d.WIRE_TYPES.BITS32=5;d.PACKABLE_WIRE_TYPES=
+[d.WIRE_TYPES.VARINT,d.WIRE_TYPES.BITS64,d.WIRE_TYPES.BITS32];d.TYPES={int32:{name:"int32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:d.WIRE_TYPES.VARINT,defaultValue:d.Long?d.Long.ZERO:void 0},uint64:{name:"uint64",wireType:d.WIRE_TYPES.VARINT,defaultValue:d.Long?d.Long.UZERO:void 0},sint64:{name:"sint64",wireType:d.WIRE_TYPES.VARINT,
+defaultValue:d.Long?d.Long.ZERO:void 0},bool:{name:"bool",wireType:d.WIRE_TYPES.VARINT,defaultValue:!1},"double":{name:"double",wireType:d.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:d.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:d.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:d.WIRE_TYPES.BITS64,
+defaultValue:d.Long?d.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:d.WIRE_TYPES.BITS64,defaultValue:d.Long?d.Long.ZERO:void 0},"float":{name:"float",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},"enum":{name:"enum",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:d.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:d.WIRE_TYPES.STARTGROUP,defaultValue:null}};d.MAP_KEY_TYPES=[d.TYPES.int32,d.TYPES.sint32,d.TYPES.sfixed32,d.TYPES.uint32,d.TYPES.fixed32,
+d.TYPES.int64,d.TYPES.sint64,d.TYPES.sfixed64,d.TYPES.uint64,d.TYPES.fixed64,d.TYPES.bool,d.TYPES.string,d.TYPES.bytes];d.ID_MIN=1;d.ID_MAX=536870911;d.convertFieldsToCamelCase=!1;d.populateAccessors=!0;d.populateDefaults=!0;d.Util=function(){var c={};c.IS_NODE=!("object"!==typeof process||"[object process]"!==process+""||process.browser);c.XHR=function(){for(var c=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},
+function(){return new ActiveXObject("Microsoft.XMLHTTP")}],d=null,e=0;e<c.length;e++){try{d=c[e]()}catch(k){continue}break}if(!d)throw Error("XMLHttpRequest is not supported");return d};c.fetch=function(d,e){e&&"function"!=typeof e&&(e=null);if(c.IS_NODE){var t=require("fs");if(e)t.readFile(d,function(c,b){c?e(null):e(""+b)});else try{return t.readFileSync(d)}catch(l){return null}}else{var k=c.XHR();k.open("GET",d,e?!0:!1);k.setRequestHeader("Accept","text/plain");"function"===typeof k.overrideMimeType&&
+k.overrideMimeType("text/plain");if(e)k.onreadystatechange=function(){4==k.readyState&&(200==k.status||0==k.status&&"string"===typeof k.responseText?e(k.responseText):e(null))},4!=k.readyState&&k.send(null);else return k.send(null),200==k.status||0==k.status&&"string"===typeof k.responseText?k.responseText:null}};c.toCamelCase=function(c){return c.replace(/_([a-zA-Z])/g,function(c,e){return e.toUpperCase()})};return c}();d.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,
+TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
+BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g};d.Reflect=function(c){function d(a,g){if(a&&"number"===typeof a.low&&"number"===typeof a.high&&"boolean"===typeof a.unsigned&&a.low===a.low&&a.high===a.high)return new c.Long(a.low,a.high,"undefined"===
+typeof g?a.unsigned:g);if("string"===typeof a)return c.Long.fromString(a,g||!1,10);if("number"===typeof a)return c.Long.fromNumber(a,g||!1);throw Error("not convertible to Long");}function z(a,g){var h=g.readVarint32(),b=h&7,h=h>>>3;switch(b){case c.WIRE_TYPES.VARINT:do h=g.readUint8();while(128===(h&128));break;case c.WIRE_TYPES.BITS64:g.offset+=8;break;case c.WIRE_TYPES.LDELIM:h=g.readVarint32();g.offset+=h;break;case c.WIRE_TYPES.STARTGROUP:z(h,g);break;case c.WIRE_TYPES.ENDGROUP:if(h===a)return!1;
+throw Error("Illegal GROUPEND after unknown group: "+h+" ("+a+" expected)");case c.WIRE_TYPES.BITS32:g.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+a+": "+b);}return!0}var r={},k=function(a,g,c){this.builder=a;this.parent=g;this.name=c},l=k.prototype;l.fqn=function(){var a=this.name,g=this;do{g=g.parent;if(null==g)break;a=g.name+"."+a}while(1);return a};l.toString=function(a){return(a?this.className+" ":"")+this.fqn()};l.build=function(){throw Error(this.toString(!0)+
+" cannot be built directly");};r.T=k;var b=function(a,g,c,b,e){k.call(this,a,g,c);this.className="Namespace";this.children=[];this.options=b||{};this.syntax=e||"proto2"},l=b.prototype=Object.create(k.prototype);l.getChildren=function(a){a=a||null;if(null==a)return this.children.slice();for(var g=[],c=0,b=this.children.length;c<b;++c)this.children[c]instanceof a&&g.push(this.children[c]);return g};l.addChild=function(a){var c;if(c=this.getChild(a.name))if(c instanceof u.Field&&c.name!==c.originalName&&
+null===this.getChild(c.originalName))c.name=c.originalName;else if(a instanceof u.Field&&a.name!==a.originalName&&null===this.getChild(a.originalName))a.name=a.originalName;else throw Error("Duplicate name in namespace "+this.toString(!0)+": "+a.name);this.children.push(a)};l.getChild=function(a){for(var c="number"===typeof a?"id":"name",h=0,b=this.children.length;h<b;++h)if(this.children[h][c]===a)return this.children[h];return null};l.resolve=function(a,c){var g="string"===typeof a?a.split("."):
+a,b=this,e=0;if(""===g[e]){for(;null!==b.parent;)b=b.parent;e++}do{do{if(!(b instanceof r.Namespace)){b=null;break}b=b.getChild(g[e]);if(!(b&&b instanceof r.T)||c&&!(b instanceof r.Namespace)){b=null;break}e++}while(e<g.length);if(null!=b)break;if(null!==this.parent)return this.parent.resolve(a,c)}while(null!=b);return b};l.qn=function(a){var c=[],b=a;do c.unshift(b.name),b=b.parent;while(null!==b);for(b=1;b<=c.length;b++){var e=c.slice(c.length-b);if(a===this.resolve(e,a instanceof r.Namespace))return e.join(".")}return a.fqn()};
+l.build=function(){for(var a={},c=this.children,h=0,e=c.length,d;h<e;++h)d=c[h],d instanceof b&&(a[d.name]=d.build());Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt()});return a};l.buildOpt=function(){for(var a={},c=Object.keys(this.options),b=0,e=c.length;b<e;++b)a[c[b]]=this.options[c[b]];return a};l.getOption=function(a){return"undefined"===typeof a?this.options:"undefined"!==typeof this.options[a]?this.options[a]:null};r.Namespace=b;var m=function(a,g,b,e,d){this.type=
+a;this.resolvedType=g;this.isMapKey=b;this.syntax=e;this.name=d;if(b&&0>c.MAP_KEY_TYPES.indexOf(a))throw Error("Invalid map key type: "+a.name);},f=m.prototype;m.defaultFieldValue=function(a){"string"===typeof a&&(a=c.TYPES[a]);if("undefined"===typeof a.defaultValue)throw Error("default value for type "+a.name+" is not supported");return a==c.TYPES.bytes?new e(0):a.defaultValue};f.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"};f.verifyValue=function(a){function g(a,
+c){throw Error("Illegal value for "+b.toString(!0)+" of type "+b.type.name+": "+a+" ("+c+")");}var b=this;switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),4294967295<a?a|0:a;case c.TYPES.uint32:case c.TYPES.fixed32:return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),0>a?a>>>0:a;case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:if(c.Long)try{return d(a,!1)}catch(w){g(typeof a,
+w.message)}else g(typeof a,"requires Long.js");case c.TYPES.uint64:case c.TYPES.fixed64:if(c.Long)try{return d(a,!0)}catch(w){g(typeof a,w.message)}else g(typeof a,"requires Long.js");case c.TYPES.bool:return"boolean"!==typeof a&&g(typeof a,"not a boolean"),a;case c.TYPES["float"]:case c.TYPES["double"]:return"number"!==typeof a&&g(typeof a,"not a number"),a;case c.TYPES.string:return"string"===typeof a||a&&a instanceof String||g(typeof a,"not a string"),""+a;case c.TYPES.bytes:return e.isByteBuffer(a)?
+a:e.wrap(a,"base64");case c.TYPES["enum"]:for(var v=this.resolvedType.getChildren(c.Reflect.Enum.Value),q=0;q<v.length;q++)if(v[q].name==a||v[q].id==a)return v[q].id;if("proto3"===this.syntax)return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),(4294967295<a||0>a)&&g(typeof a,"not in range for uint32"),a;g(a,"not a valid enum value");case c.TYPES.group:case c.TYPES.message:a&&"object"===typeof a||g(typeof a,"object expected");if(a instanceof this.resolvedType.clazz)return a;if(a instanceof
+c.Builder.Message){var v={},q;for(q in a)a.hasOwnProperty(q)&&(v[q]=a[q]);a=v}return new this.resolvedType.clazz(a)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+a+" (undefined type "+this.type+")");};f.calculateLength=function(a,g){if(null===g)return 0;var b;switch(this.type){case c.TYPES.int32:return 0>g?e.calculateVarint64(g):e.calculateVarint32(g);case c.TYPES.uint32:return e.calculateVarint32(g);case c.TYPES.sint32:return e.calculateVarint32(e.zigZagEncode32(g));case c.TYPES.fixed32:case c.TYPES.sfixed32:case c.TYPES["float"]:return 4;
+case c.TYPES.int64:case c.TYPES.uint64:return e.calculateVarint64(g);case c.TYPES.sint64:return e.calculateVarint64(e.zigZagEncode64(g));case c.TYPES.fixed64:case c.TYPES.sfixed64:return 8;case c.TYPES.bool:return 1;case c.TYPES["enum"]:return e.calculateVarint32(g);case c.TYPES["double"]:return 8;case c.TYPES.string:return b=e.calculateUTF8Bytes(g),e.calculateVarint32(b)+b;case c.TYPES.bytes:if(0>g.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+g.remaining()+" bytes remaining");
+return e.calculateVarint32(g.remaining())+g.remaining();case c.TYPES.message:return b=this.resolvedType.calculate(g),e.calculateVarint32(b)+b;case c.TYPES.group:return b=this.resolvedType.calculate(g),b+e.calculateVarint32(a<<3|c.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+g+" (unknown type)");};f.encodeValue=function(a,g,b){if(null===g)return b;switch(this.type){case c.TYPES.int32:0>g?b.writeVarint64(g):b.writeVarint32(g);break;case c.TYPES.uint32:b.writeVarint32(g);
+break;case c.TYPES.sint32:b.writeVarint32ZigZag(g);break;case c.TYPES.fixed32:b.writeUint32(g);break;case c.TYPES.sfixed32:b.writeInt32(g);break;case c.TYPES.int64:case c.TYPES.uint64:b.writeVarint64(g);break;case c.TYPES.sint64:b.writeVarint64ZigZag(g);break;case c.TYPES.fixed64:b.writeUint64(g);break;case c.TYPES.sfixed64:b.writeInt64(g);break;case c.TYPES.bool:"string"===typeof g?b.writeVarint32("false"===g.toLowerCase()?0:!!g):b.writeVarint32(g?1:0);break;case c.TYPES["enum"]:b.writeVarint32(g);
+break;case c.TYPES["float"]:b.writeFloat32(g);break;case c.TYPES["double"]:b.writeFloat64(g);break;case c.TYPES.string:b.writeVString(g);break;case c.TYPES.bytes:if(0>g.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+g.remaining()+" bytes remaining");a=g.offset;b.writeVarint32(g.remaining());b.append(g);g.offset=a;break;case c.TYPES.message:a=(new e).LE();this.resolvedType.encode(g,a);b.writeVarint32(a.offset);b.append(a.flip());break;case c.TYPES.group:this.resolvedType.encode(g,
+b);b.writeVarint32(a<<3|c.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+g+" (unknown type)");}return b};f.decode=function(a,b,e){if(b!=this.type.wireType)throw Error("Unexpected wire type for element");switch(this.type){case c.TYPES.int32:return a.readVarint32()|0;case c.TYPES.uint32:return a.readVarint32()>>>0;case c.TYPES.sint32:return a.readVarint32ZigZag()|0;case c.TYPES.fixed32:return a.readUint32()>>>0;case c.TYPES.sfixed32:return a.readInt32()|
+0;case c.TYPES.int64:return a.readVarint64();case c.TYPES.uint64:return a.readVarint64().toUnsigned();case c.TYPES.sint64:return a.readVarint64ZigZag();case c.TYPES.fixed64:return a.readUint64();case c.TYPES.sfixed64:return a.readInt64();case c.TYPES.bool:return!!a.readVarint32();case c.TYPES["enum"]:return a.readVarint32();case c.TYPES["float"]:return a.readFloat();case c.TYPES["double"]:return a.readDouble();case c.TYPES.string:return a.readVString();case c.TYPES.bytes:e=a.readVarint32();if(a.remaining()<
+e)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+e+" required but got only "+a.remaining());b=a.clone();b.limit=b.offset+e;a.offset+=e;return b;case c.TYPES.message:return e=a.readVarint32(),this.resolvedType.decode(a,e);case c.TYPES.group:return this.resolvedType.decode(a,-1,e)}throw Error("[INTERNAL] Illegal decode type");};f.valueFromString=function(a){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:case c.TYPES.uint32:case c.TYPES.fixed32:return this.verifyValue(parseInt(a));
+case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:case c.TYPES.uint64:case c.TYPES.fixed64:return this.verifyValue(a);case c.TYPES.bool:return"true"===a;case c.TYPES.string:return this.verifyValue(a);case c.TYPES.bytes:return e.fromBinary(a)}};f.valueToString=function(a){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===c.TYPES.bytes?a.toString("binary"):a.toString()};r.Element=m;var u=function(a,c,e,d,q,f){b.call(this,a,c,e,d,f);this.className=
+"Message";this.extensions=void 0;this.clazz=null;this.isGroup=!!q;this._fieldsByName=this._fieldsById=this._fields=null},f=u.prototype=Object.create(b.prototype);f.build=function(a){if(this.clazz&&!a)return this.clazz;a=function(a,c){function b(c,g,f,d){if(null===c||"object"!==typeof c){if(d&&d instanceof a.Reflect.Enum){var h=a.Reflect.Enum.getName(d.object,c);if(null!==h)return h}return c}if(e.isByteBuffer(c))return g?c.toBase64():c.toBuffer();if(a.Long.isLong(c))return f?c.toString():a.Long.fromValue(c);
+var n;if(Array.isArray(c))return n=[],c.forEach(function(a,c){n[c]=b(a,g,f,d)}),n;n={};if(c instanceof a.Map){for(var h=c.entries(),m=h.next();!m.done;m=h.next())n[c.keyElem.valueToString(m.value[0])]=b(m.value[1],g,f,c.valueElem.resolvedType);return n}var h=c.$type,m=void 0,q;for(q in c)c.hasOwnProperty(q)&&(h&&(m=h.getChild(q))?n[q]=b(c[q],g,f,m.resolvedType):n[q]=b(c[q],g,f));return n}var g=c.getChildren(a.Reflect.Message.Field),d=c.getChildren(a.Reflect.Message.OneOf),f=function(b,h){a.Builder.Message.call(this);
+for(var n=0,m=d.length;n<m;++n)this[d[n].name]=null;n=0;for(m=g.length;n<m;++n){var q=g[n];this[q.name]=q.repeated?[]:q.map?new a.Map(q):null;!q.required&&"proto3"!==c.syntax||null===q.defaultValue||(this[q.name]=q.defaultValue)}if(0<arguments.length)if(1!==arguments.length||null===b||"object"!==typeof b||!("function"!==typeof b.encode||b instanceof f)||Array.isArray(b)||b instanceof a.Map||e.isByteBuffer(b)||b instanceof ArrayBuffer||a.Long&&b instanceof a.Long)for(n=0,m=arguments.length;n<m;++n)"undefined"!==
+typeof(q=arguments[n])&&this.$set(g[n].name,q);else this.$set(b)},h=f.prototype=Object.create(a.Builder.Message.prototype);h.add=function(b,g,e){var f=c._fieldsByName[b];if(!e){if(!f)throw Error(this+"#"+b+" is undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: "+f.toString(!0));if(!f.repeated)throw Error(this+"#"+b+" is not a repeated field");g=f.verifyValue(g,!0)}null===this[b]&&(this[b]=[]);this[b].push(g);return this};h.$add=h.add;h.set=function(b,
+g,e){if(b&&"object"===typeof b){e=g;for(var f in b)b.hasOwnProperty(f)&&"undefined"!==typeof(g=b[f])&&void 0===c._oneofsByName[f]&&this.$set(f,g,e);return this}f=c._fieldsByName[b];if(e)this[b]=g;else{if(!f)throw Error(this+"#"+b+" is not a field: undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: "+f.toString(!0));this[f.name]=g=f.verifyValue(g)}f&&f.oneof&&(e=this[f.oneof.name],null!==g?(null!==e&&e!==f.name&&(this[e]=null),this[f.oneof.name]=f.name):
+e===b&&(this[f.oneof.name]=null));return this};h.$set=h.set;h.get=function(b,g){if(g)return this[b];var f=c._fieldsByName[b];if(!(f&&f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: "+f.toString(!0));return this[f.name]};h.$get=h.get;for(var m=0;m<g.length;m++){var q=g[m];q instanceof a.Reflect.Message.ExtensionField||c.builder.options.populateAccessors&&function(a){var b=
+a.originalName.replace(/(_[a-zA-Z])/g,function(a){return a.toUpperCase().replace("_","")}),b=b.substring(0,1).toUpperCase()+b.substring(1),g=a.originalName.replace(/([A-Z])/g,function(a){return"_"+a}),f=function(c,b){this[a.name]=b?c:a.verifyValue(c);return this},e=function(){return this[a.name]};null===c.getChild("set"+b)&&(h["set"+b]=f);null===c.getChild("set_"+g)&&(h["set_"+g]=f);null===c.getChild("get"+b)&&(h["get"+b]=e);null===c.getChild("get_"+g)&&(h["get_"+g]=e)}(q)}h.encode=function(a,b){"boolean"===
+typeof a&&(b=a,a=void 0);var g=!1;a||(a=new e,g=!0);var f=a.littleEndian;try{return c.encode(this,a.LE(),b),(g?a.flip():a).LE(f)}catch(C){throw a.LE(f),C;}};f.encode=function(a,c,b){return(new f(a)).encode(c,b)};h.calculate=function(){return c.calculate(this)};h.encodeDelimited=function(a,b){var g=!1;a||(a=new e,g=!0);var f=(new e).LE();c.encode(this,f,b).flip();a.writeVarint32(f.remaining());a.append(f);return g?a.flip():a};h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(n){throw n.encoded&&
+(n.encoded=n.encoded.toArrayBuffer()),n;}};h.toArrayBuffer=h.encodeAB;h.encodeNB=function(){try{return this.encode().toBuffer()}catch(n){throw n.encoded&&(n.encoded=n.encoded.toBuffer()),n;}};h.toBuffer=h.encodeNB;h.encode64=function(){try{return this.encode().toBase64()}catch(n){throw n.encoded&&(n.encoded=n.encoded.toBase64()),n;}};h.toBase64=h.encode64;h.encodeHex=function(){try{return this.encode().toHex()}catch(n){throw n.encoded&&(n.encoded=n.encoded.toHex()),n;}};h.toHex=h.encodeHex;h.toRaw=
+function(a,c){return b(this,!!a,!!c,this.$type)};h.encodeJSON=function(){return JSON.stringify(b(this,!0,!0,this.$type))};f.decode=function(a,b,g){"string"===typeof b&&(g=b,b=-1);"string"===typeof a?a=e.wrap(a,g?g:"base64"):e.isByteBuffer(a)||(a=e.wrap(a));g=a.littleEndian;try{var f=c.decode(a.LE(),b);a.LE(g);return f}catch(C){throw a.LE(g),C;}};f.decodeDelimited=function(a,b){"string"===typeof a?a=e.wrap(a,b?b:"base64"):e.isByteBuffer(a)||(a=e.wrap(a));if(1>a.remaining())return null;var g=a.offset,
+f=a.readVarint32();if(a.remaining()<f)return a.offset=g,null;try{var h=c.decode(a.slice(a.offset,a.offset+f).LE());a.offset+=f;return h}catch(E){throw a.offset+=f,E;}};f.decode64=function(a){return f.decode(a,"base64")};f.decodeHex=function(a){return f.decode(a,"hex")};f.decodeJSON=function(a){return new f(JSON.parse(a))};h.toString=function(){return c.toString()};Object.defineProperty&&(Object.defineProperty(f,"$options",{value:c.buildOpt()}),Object.defineProperty(h,"$options",{value:f.$options}),
+Object.defineProperty(f,"$type",{value:c}),Object.defineProperty(h,"$type",{value:c}));return f}(c,this);this._fields=[];this._fieldsById={};this._fieldsByName={};this._oneofsByName={};for(var b=0,d=this.children.length,f;b<d;b++)if(f=this.children[b],f instanceof x||f instanceof u||f instanceof D){if(a.hasOwnProperty(f.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+f.toString(!0)+" cannot override static property '"+f.name+"'");a[f.name]=f.build()}else if(f instanceof u.Field)f.build(),
+this._fields.push(f),this._fieldsById[f.id]=f,this._fieldsByName[f.name]=f;else if(f instanceof u.OneOf)this._oneofsByName[f.name]=f;else if(!(f instanceof u.OneOf||f instanceof y))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[b].toString(!0));return this.clazz=a};f.encode=function(a,c,b){for(var g=null,f,e=0,h=this._fields.length,d;e<h;++e)f=this._fields[e],d=a[f.name],f.required&&null===d?null===g&&(g=f):f.encode(b?d:f.verifyValue(d),c,a);if(null!==g)throw a=Error("Missing at least one required field for "+
+this.toString(!0)+": "+g),a.encoded=c,a;return c};f.calculate=function(a){for(var c=0,b=0,f=this._fields.length,e,d;b<f;++b){e=this._fields[b];d=a[e.name];if(e.required&&null===d)throw Error("Missing at least one required field for "+this.toString(!0)+": "+e);c+=e.calculate(d,a)}return c};f.decode=function(a,b,f){"number"!==typeof b&&(b=-1);for(var g=a.offset,e=new this.clazz,d,h,m;a.offset<g+b||-1===b&&0<a.remaining();){d=a.readVarint32();h=d&7;m=d>>>3;if(h===c.WIRE_TYPES.ENDGROUP){if(m!==f)throw Error("Illegal group end indicator for "+
+this.toString(!0)+": "+m+" ("+(f?f+" expected":"not a group")+")");break}if(d=this._fieldsById[m])d.repeated&&!d.options.packed?e[d.name].push(d.decode(h,a)):d.map?(h=d.decode(h,a),e[d.name].set(h[0],h[1])):(e[d.name]=d.decode(h,a),d.oneof&&(h=e[d.oneof.name],null!==h&&h!==d.name&&(e[h]=null),e[d.oneof.name]=d.name));else switch(h){case c.WIRE_TYPES.VARINT:a.readVarint32();break;case c.WIRE_TYPES.BITS32:a.offset+=4;break;case c.WIRE_TYPES.BITS64:a.offset+=8;break;case c.WIRE_TYPES.LDELIM:d=a.readVarint32();
+a.offset+=d;break;case c.WIRE_TYPES.STARTGROUP:for(;z(m,a););break;default:throw Error("Illegal wire type for unknown field "+m+" in "+this.toString(!0)+"#decode: "+h);}}a=0;for(b=this._fields.length;a<b;++a)if(d=this._fields[a],null===e[d.name])if("proto3"===this.syntax)e[d.name]=d.defaultValue;else{if(d.required)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+d.name),a.decoded=e,a;c.populateDefaults&&null!==d.defaultValue&&(e[d.name]=d.defaultValue)}return e};r.Message=
+u;var p=function(a,b,f,e,d,m,l,y,t,z){k.call(this,a,b,m);this.className="Message.Field";this.required="required"===f;this.repeated="repeated"===f;this.map="map"===f;this.keyType=e||null;this.type=d;this.resolvedType=null;this.id=l;this.options=y||{};this.defaultValue=null;this.oneof=t||null;this.syntax=z||"proto2";this.originalName=this.name;this.keyElement=this.element=null;!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=c.Util.toCamelCase(this.name))},
+f=p.prototype=Object.create(k.prototype);f.build=function(){this.element=new m(this.type,this.resolvedType,!1,this.syntax,this.name);this.map&&(this.keyElement=new m(this.keyType,void 0,!0,this.syntax,this.name));"proto3"!==this.syntax||this.repeated||this.map?"undefined"!==typeof this.options["default"]&&(this.defaultValue=this.verifyValue(this.options["default"])):this.defaultValue=m.defaultFieldValue(this.type)};f.verifyValue=function(a,b){function g(a,c){throw Error("Illegal value for "+f.toString(!0)+
+" of type "+f.type.name+": "+a+" ("+c+")");}b=b||!1;var f=this;if(null===a)return this.required&&g(typeof a,"required"),"proto3"===this.syntax&&this.type!==c.TYPES.message&&g(typeof a,"proto3 field without field presence cannot be null"),null;var e;if(this.repeated&&!b){Array.isArray(a)||(a=[a]);var d=[];for(e=0;e<a.length;e++)d.push(this.element.verifyValue(a[e]));return d}if(this.map&&!b){if(a instanceof c.Map)return a;a instanceof Object||g(typeof a,"expected ProtoBuf.Map or raw object for map field");
+return new c.Map(this,a)}!this.repeated&&Array.isArray(a)&&g(typeof a,"no array expected");return this.element.verifyValue(a)};f.hasWirePresence=function(a,b){if("proto3"!==this.syntax)return null!==a;if(this.oneof&&b[this.oneof.name]===this.name)return!0;switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:case c.TYPES.uint32:case c.TYPES.fixed32:return 0!==a;case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:case c.TYPES.uint64:case c.TYPES.fixed64:return 0!==
+a.low||0!==a.high;case c.TYPES.bool:return a;case c.TYPES["float"]:case c.TYPES["double"]:return 0!==a;case c.TYPES.string:return 0<a.length;case c.TYPES.bytes:return 0<a.remaining();case c.TYPES["enum"]:return 0!==a;case c.TYPES.message:return null!==a;default:return!0}};f.encode=function(a,b,f){if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return b;try{if(this.repeated){var g;
+if(this.options.packed&&0<=c.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){b.writeVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);b.ensureCapacity(b.offset+=1);var d=b.offset;for(g=0;g<a.length;g++)this.element.encodeValue(this.id,a[g],b);var h=b.offset-d,m=e.calculateVarint32(h);if(1<m){var l=b.slice(d,b.offset),d=d+(m-1);b.offset=d;b.append(l)}b.writeVarint32(h,d-m)}else for(g=0;g<a.length;g++)b.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a[g],b)}else this.map?a.forEach(function(a,
+g,f){f=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,g)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);b.writeVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);b.writeVarint32(f);b.writeVarint32(8|this.keyType.wireType);this.keyElement.encodeValue(1,g,b);b.writeVarint32(16|this.type.wireType);this.element.encodeValue(2,a,b)},this):this.hasWirePresence(a,f)&&(b.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a,b))}catch(F){throw Error("Illegal value for "+
+this.toString(!0)+": "+a+" ("+F+")");}return b};f.calculate=function(a,b){a=this.verifyValue(a);if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return 0;var g=0;try{if(this.repeated){var f,d;if(this.options.packed&&0<=c.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){g+=e.calculateVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);for(f=d=0;f<a.length;f++)d+=this.element.calculateLength(this.id,
+a[f]);g+=e.calculateVarint32(d);g+=d}else for(f=0;f<a.length;f++)g+=e.calculateVarint32(this.id<<3|this.type.wireType),g+=this.element.calculateLength(this.id,a[f])}else this.map?a.forEach(function(a,b,f){a=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,b)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);g+=e.calculateVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);g+=e.calculateVarint32(a);g+=a},this):this.hasWirePresence(a,b)&&(g+=e.calculateVarint32(this.id<<
+3|this.type.wireType),g+=this.element.calculateLength(this.id,a))}catch(w){throw Error("Illegal value for "+this.toString(!0)+": "+a+" ("+w+")");}return g};f.decode=function(a,b,f){if(!(!this.map&&a==this.type.wireType||!f&&this.repeated&&this.options.packed&&a==c.WIRE_TYPES.LDELIM||this.map&&a==c.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+a+" ("+this.type.wireType+" expected)");if(a==c.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&0<=c.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)&&
+!f){a=b.readVarint32();a=b.offset+a;for(f=[];b.offset<a;)f.push(this.decode(this.type.wireType,b,!0));return f}if(this.map){var g=m.defaultFieldValue(this.keyType);f=m.defaultFieldValue(this.type);a=b.readVarint32();if(b.remaining()<a)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+a+" required but got only "+b.remaining());var d=b.clone();d.limit=d.offset+a;for(b.offset+=a;0<d.remaining();)if(b=d.readVarint32(),a=b&7,b>>>=3,1===b)g=this.keyElement.decode(d,a,b);else if(2===b)f=
+this.element.decode(d,a,b);else throw Error("Unexpected tag in map field key/value submessage");return[g,f]}return this.element.decode(b,a,this.id)};r.Message.Field=p;f=function(a,b,c,f,d,e,m){p.call(this,a,b,c,null,f,d,e,m)};f.prototype=Object.create(p.prototype);r.Message.ExtensionField=f;r.Message.OneOf=function(a,b,c){k.call(this,a,b,c);this.fields=[]};var x=function(a,c,f,d,e){b.call(this,a,c,f,d,e);this.className="Enum";this.object=null};x.getName=function(a,b){for(var c=Object.keys(a),f=0,
+g;f<c.length;++f)if(a[g=c[f]]===b)return g;return null};(x.prototype=Object.create(b.prototype)).build=function(a){if(this.object&&!a)return this.object;a=new c.Builder.Enum;for(var b=this.getChildren(x.Value),f=0,d=b.length;f<d;++f)a[b[f].name]=b[f].id;Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt(),enumerable:!1});return this.object=a};r.Enum=x;f=function(a,b,c,f){k.call(this,a,b,c);this.className="Enum.Value";this.id=f};f.prototype=Object.create(k.prototype);r.Enum.Value=
+f;var y=function(a,b,c,f){k.call(this,a,b,c);this.field=f};y.prototype=Object.create(k.prototype);r.Extension=y;var D=function(a,c,f,d){b.call(this,a,c,f,d);this.className="Service";this.clazz=null};(D.prototype=Object.create(b.prototype)).build=function(a){return this.clazz&&!a?this.clazz:this.clazz=function(a,b){for(var c=function(b){a.Builder.Service.call(this);this.rpcImpl=b||function(a,b,c){setTimeout(c.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),
+0)}},f=c.prototype=Object.create(a.Builder.Service.prototype),d=b.getChildren(a.Reflect.Service.RPCMethod),g=0;g<d.length;g++)(function(a){f[a.name]=function(c,f){try{try{c=a.resolvedRequestType.clazz.decode(e.wrap(c))}catch(A){if(!(A instanceof TypeError))throw A;}if(null===c||"object"!==typeof c)throw Error("Illegal arguments");c instanceof a.resolvedRequestType.clazz||(c=new a.resolvedRequestType.clazz(c));this.rpcImpl(a.fqn(),c,function(c,d){if(c)f(c);else{null===d&&(d="");try{d=a.resolvedResponseType.clazz.decode(d)}catch(G){}d&&
+d instanceof a.resolvedResponseType.clazz?f(null,d):f(Error("Illegal response type received in service method "+b.name+"#"+a.name))}})}catch(A){setTimeout(f.bind(this,A),0)}};c[a.name]=function(b,f,d){(new c(b))[a.name](f,d)};Object.defineProperty&&(Object.defineProperty(c[a.name],"$options",{value:a.buildOpt()}),Object.defineProperty(f[a.name],"$options",{value:c[a.name].$options}))})(d[g]);Object.defineProperty&&(Object.defineProperty(c,"$options",{value:b.buildOpt()}),Object.defineProperty(f,"$options",
+{value:c.$options}),Object.defineProperty(c,"$type",{value:b}),Object.defineProperty(f,"$type",{value:b}));return c}(c,this)};r.Service=D;var B=function(a,b,c,f){k.call(this,a,b,c);this.className="Service.Method";this.options=f||{}};(B.prototype=Object.create(k.prototype)).buildOpt=l.buildOpt;r.Service.Method=B;l=function(a,b,c,f,d,e,m,l){B.call(this,a,b,c,l);this.className="Service.RPCMethod";this.requestName=f;this.responseName=d;this.requestStream=e;this.responseStream=m;this.resolvedResponseType=
+this.resolvedRequestType=null};l.prototype=Object.create(B.prototype);r.Service.RPCMethod=l;return r}(d);d.Builder=function(c,d,e){function t(b){b.messages&&b.messages.forEach(function(c){c.syntax=b.syntax;t(c)});b.enums&&b.enums.forEach(function(c){c.syntax=b.syntax})}var k=function(b){this.ptr=this.ns=new e.Namespace(this,null,"");this.resolved=!1;this.result=null;this.files={};this.importRoot=null;this.options=b||{}},l=k.prototype;k.isMessage=function(b){return"string"!==typeof b.name||"undefined"!==
+typeof b.values||"undefined"!==typeof b.rpc?!1:!0};k.isMessageField=function(b){return"string"!==typeof b.rule||"string"!==typeof b.name||"string"!==typeof b.type||"undefined"===typeof b.id?!1:!0};k.isEnum=function(b){return"string"===typeof b.name&&"undefined"!==typeof b.values&&Array.isArray(b.values)&&0!==b.values.length?!0:!1};k.isService=function(b){return"string"===typeof b.name&&"object"===typeof b.rpc&&b.rpc?!0:!1};k.isExtend=function(b){return"string"!==typeof b.ref?!1:!0};l.reset=function(){this.ptr=
+this.ns;return this};l.define=function(b){if("string"!==typeof b||!d.TYPEREF.test(b))throw Error("illegal namespace: "+b);b.split(".").forEach(function(b){var c=this.ptr.getChild(b);null===c&&this.ptr.addChild(c=new e.Namespace(this,this.ptr,b));this.ptr=c},this);return this};l.create=function(b){if(!b)return this;if(Array.isArray(b)){if(0===b.length)return this;b=b.slice()}else b=[b];for(var d=[b];0<d.length;){b=d.pop();if(!Array.isArray(b))throw Error("not a valid namespace: "+JSON.stringify(b));
+for(;0<b.length;){var f=b.shift();if(k.isMessage(f)){var l=new e.Message(this,this.ptr,f.name,f.options,f.isGroup,f.syntax),t={};f.oneofs&&Object.keys(f.oneofs).forEach(function(b){l.addChild(t[b]=new e.Message.OneOf(this,l,b))},this);f.fields&&f.fields.forEach(function(b){if(null!==l.getChild(b.id|0))throw Error("duplicate or invalid field id in "+l.name+": "+b.id);if(b.options&&"object"!==typeof b.options)throw Error("illegal field options in "+l.name+"#"+b.name);var c=null;if("string"===typeof b.oneof&&
+!(c=t[b.oneof]))throw Error("illegal oneof in "+l.name+"#"+b.name+": "+b.oneof);b=new e.Message.Field(this,l,b.rule,b.keytype,b.type,b.name,b.id,b.options,c,f.syntax);c&&c.fields.push(b);l.addChild(b)},this);var r=[];f.enums&&f.enums.forEach(function(b){r.push(b)});f.messages&&f.messages.forEach(function(b){r.push(b)});f.services&&f.services.forEach(function(b){r.push(b)});f.extensions&&(l.extensions="number"===typeof f.extensions[0]?[f.extensions]:f.extensions);this.ptr.addChild(l);if(0<r.length){d.push(b);
+b=r;r=null;this.ptr=l;l=null;continue}r=null}else if(k.isEnum(f))l=new e.Enum(this,this.ptr,f.name,f.options,f.syntax),f.values.forEach(function(b){l.addChild(new e.Enum.Value(this,l,b.name,b.id))},this),this.ptr.addChild(l);else if(k.isService(f))l=new e.Service(this,this.ptr,f.name,f.options),Object.keys(f.rpc).forEach(function(b){var c=f.rpc[b];l.addChild(new e.Service.RPCMethod(this,l,b,c.request,c.response,!!c.request_stream,!!c.response_stream,c.options))},this),this.ptr.addChild(l);else if(k.isExtend(f))if(l=
+this.ptr.resolve(f.ref,!0))f.fields.forEach(function(b){if(null!==l.getChild(b.id|0))throw Error("duplicate extended field id in "+l.name+": "+b.id);if(l.extensions){var f=!1;l.extensions.forEach(function(a){b.id>=a[0]&&b.id<=a[1]&&(f=!0)});if(!f)throw Error("illegal extended field id in "+l.name+": "+b.id+" (not within valid ranges)");}var d=b.name;this.options.convertFieldsToCamelCase&&(d=c.Util.toCamelCase(d));var d=new e.Message.ExtensionField(this,l,b.rule,b.type,this.ptr.fqn()+"."+d,b.id,b.options),
+a=new e.Extension(this,this.ptr,b.name,d);d.extension=a;this.ptr.addChild(a);l.addChild(d)},this);else{if(!/\.?google\.protobuf\./.test(f.ref))throw Error("extended message "+f.ref+" is not defined");}else throw Error("not a valid definition: "+JSON.stringify(f));l=f=null}b=null;this.ptr=this.ptr.parent}this.resolved=!1;this.result=null;return this};l["import"]=function(b,d){var f="/";if("string"===typeof d){c.Util.IS_NODE&&(d=require("path").resolve(d));if(!0===this.files[d])return this.reset();
+this.files[d]=!0}else if("object"===typeof d){var e=d.root;c.Util.IS_NODE&&(e=require("path").resolve(e));if(0<=e.indexOf("\\")||0<=d.file.indexOf("\\"))f="\\";e=c.Util.IS_NODE?require("path").join(e,d.file):e+f+d.file;if(!0===this.files[e])return this.reset();this.files[e]=!0}if(b.imports&&0<b.imports.length){var l=!1;if("object"===typeof d){if(this.importRoot=d.root,l=!0,e=this.importRoot,d=d.file,0<=e.indexOf("\\")||0<=d.indexOf("\\"))f="\\"}else"string"===typeof d?this.importRoot?e=this.importRoot:
+0<=d.indexOf("/")?(e=d.replace(/\/[^\/]*$/,""),""===e&&(e="/")):0<=d.indexOf("\\")?(e=d.replace(/\\[^\\]*$/,""),f="\\"):e=".":e=null;for(var m=0;m<b.imports.length;m++)if("string"===typeof b.imports[m]){if(!e)throw Error("cannot determine import root");var k=b.imports[m];if("google/protobuf/descriptor.proto"!==k&&(k=c.Util.IS_NODE?require("path").join(e,k):e+f+k,!0!==this.files[k])){/\.proto$/i.test(k)&&!c.DotProto&&(k=k.replace(/\.proto$/,".json"));var r=c.Util.fetch(k);if(null===r)throw Error("failed to import '"+
+k+"' in '"+d+"': file not found");if(/\.json$/i.test(k))this["import"](JSON.parse(r+""),k);else this["import"](c.DotProto.Parser.parse(r),k)}}else if(d)if(/\.(\w+)$/.test(d))this["import"](b.imports[m],d.replace(/^(.+)\.(\w+)$/,function(a,b,c){return b+"_import"+m+"."+c}));else this["import"](b.imports[m],d+"_import"+m);else this["import"](b.imports[m]);l&&(this.importRoot=null)}b["package"]&&this.define(b["package"]);b.syntax&&t(b);var p=this.ptr;b.options&&Object.keys(b.options).forEach(function(a){p.options[a]=
+b.options[a]});b.messages&&(this.create(b.messages),this.ptr=p);b.enums&&(this.create(b.enums),this.ptr=p);b.services&&(this.create(b.services),this.ptr=p);b["extends"]&&this.create(b["extends"]);return this.reset()};l.resolveAll=function(){var b;if(null==this.ptr||"object"===typeof this.ptr.type)return this;if(this.ptr instanceof e.Namespace)this.ptr.children.forEach(function(b){this.ptr=b;this.resolveAll()},this);else if(this.ptr instanceof e.Message.Field){if(d.TYPE.test(this.ptr.type))this.ptr.type=
+c.TYPES[this.ptr.type];else{if(!d.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);b=(this.ptr instanceof e.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0);if(!b)throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.resolvedType=b;if(b instanceof e.Enum){if(this.ptr.type=c.TYPES["enum"],"proto3"===this.ptr.syntax&&"proto3"!==b.syntax)throw Error("proto3 message cannot reference proto2 enum");
+}else if(b instanceof e.Message)this.ptr.type=b.isGroup?c.TYPES.group:c.TYPES.message;else throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);}if(this.ptr.map){if(!d.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=c.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==c.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&
+(this.ptr.options.packed=!0)}else if(this.ptr instanceof c.Reflect.Service.Method)if(this.ptr instanceof c.Reflect.Service.RPCMethod){b=this.ptr.parent.resolve(this.ptr.requestName,!0);if(!(b&&b instanceof c.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);this.ptr.resolvedRequestType=b;b=this.ptr.parent.resolve(this.ptr.responseName,!0);if(!(b&&b instanceof c.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+
+": "+this.ptr.responseName);this.ptr.resolvedResponseType=b}else throw Error("illegal service type in "+this.ptr.toString(!0));else if(!(this.ptr instanceof c.Reflect.Message.OneOf||this.ptr instanceof c.Reflect.Extension||this.ptr instanceof c.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()};l.build=function(b){this.reset();this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null);null===this.result&&(this.result=this.ns.build());
+if(!b)return this.result;b="string"===typeof b?b.split("."):b;for(var c=this.result,f=0;f<b.length;f++)if(c[b[f]])c=c[b[f]];else{c=null;break}return c};l.lookup=function(b,c){return b?this.ns.resolve(b,c):this.ns};l.toString=function(){return"Builder"};k.Message=function(){};k.Enum=function(){};k.Service=function(){};return k}(d,d.Lang,d.Reflect);d.Map=function(c,d){function e(c){var b=0;return{next:function(){return b<c.length?{done:!1,value:c[b++]}:{done:!0}}}}var t=function(c,b){if(!c.map)throw Error("field is not a map");
+this.field=c;this.keyElem=new d.Element(c.keyType,null,!0,c.syntax);this.valueElem=new d.Element(c.type,c.resolvedType,!1,c.syntax);this.map={};Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}});if(b)for(var e=Object.keys(b),f=0;f<e.length;f++){var l=this.keyElem.valueFromString(e[f]),k=this.valueElem.verifyValue(b[e[f]]);this.map[this.keyElem.valueToString(l)]={key:l,value:k}}},k=t.prototype;k.clear=function(){this.map={}};k["delete"]=function(c){c=this.keyElem.valueToString(this.keyElem.verifyValue(c));
+var b=c in this.map;delete this.map[c];return b};k.entries=function(){for(var c=[],b=Object.keys(this.map),d=0,f;d<b.length;d++)c.push([(f=this.map[b[d]]).key,f.value]);return e(c)};k.keys=function(){for(var c=[],b=Object.keys(this.map),d=0;d<b.length;d++)c.push(this.map[b[d]].key);return e(c)};k.values=function(){for(var c=[],b=Object.keys(this.map),d=0;d<b.length;d++)c.push(this.map[b[d]].value);return e(c)};k.forEach=function(c,b){for(var d=Object.keys(this.map),f=0,e;f<d.length;f++)c.call(b,(e=
+this.map[d[f]]).value,e.key,this)};k.set=function(c,b){var d=this.keyElem.verifyValue(c),f=this.valueElem.verifyValue(b);this.map[this.keyElem.valueToString(d)]={key:d,value:f};return this};k.get=function(c){c=this.keyElem.valueToString(this.keyElem.verifyValue(c));if(c in this.map)return this.map[c].value};k.has=function(c){return this.keyElem.valueToString(this.keyElem.verifyValue(c))in this.map};return t}(d,d.Reflect);d.newBuilder=function(c){c=c||{};"undefined"===typeof c.convertFieldsToCamelCase&&
+(c.convertFieldsToCamelCase=d.convertFieldsToCamelCase);"undefined"===typeof c.populateAccessors&&(c.populateAccessors=d.populateAccessors);return new d.Builder(c)};d.loadJson=function(c,e,p){if("string"===typeof e||e&&"string"===typeof e.file&&"string"===typeof e.root)p=e,e=null;e&&"object"===typeof e||(e=d.newBuilder());"string"===typeof c&&(c=JSON.parse(c));e["import"](c,p);e.resolveAll();return e};d.loadJsonFile=function(c,e,p){e&&"object"===typeof e?(p=e,e=null):e&&"function"===typeof e||(e=
+null);if(e)return d.Util.fetch("string"===typeof c?c:c.root+"/"+c.file,function(k){if(null===k)e(Error("Failed to fetch file"));else try{e(null,d.loadJson(JSON.parse(k),p,c))}catch(l){e(l)}});var r=d.Util.fetch("object"===typeof c?c.root+"/"+c.file:c);return null===r?null:d.loadJson(JSON.parse(r),p,c)};return d});
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js.gz b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js.gz
new file mode 100644 (file)
index 0000000..66f48c3
Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.js.gz differ
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.map b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf-light.min.map
new file mode 100644 (file)
index 0000000..b9e3d6e
--- /dev/null
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"",
+"lineCount":94,
+"mappings":"A;;;;;AAyBA,IAAI,QAAU,CAGN,MAAQ,EAHF,CCWd,QAAA,eAAA,CACsC,UAAlC,EAAA,MAAO,OAAA,iBAAP,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAErC,GAAI,CAAA,IAAJ,EAAsB,CAAA,IAAtB,CACE,KAAM,KAAI,SAAJ,CAAc,2CAAd,CAAN,CAEE,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CACmB,CAAA,MADnB,CALqC,CCV3C,QAAA,UAAA,CAAoB,QAAQ,CAAC,CAAD,CAAc,CACxC,MAAyB,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAA4C,CAA5C,CACH,CADG,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CAAmD,MAAnD,CAA4D,CAHxB,CAc1C,QAAA,OAAA,CAAiB,OAAA,UAAA,CAAkB,IAAlB,CCvBjB,QAAA,cAAA,CAAwB,gBAOxB;OAAA,WAAA,CAAqB,QAAQ,EAAG,CAE9B,OAAA,WAAA,CAAqB,QAAQ,EAAG,EAE3B,QAAA,OAAA,OAAL,GACE,OAAA,OAAA,OADF,CAC0B,OAAA,OAD1B,CAJ8B,CAWhC,QAAA,eAAA,CAAyB,CASzB,QAAA,OAAA,CAAiB,QAAQ,CAAC,CAAD,CAAkB,CACzC,MACI,QAAA,cADJ,EAC6B,CAD7B,EACgD,EADhD,EACuD,OAAA,eAAA,EAFd,CAW3C;OAAA,mBAAA,CAA6B,QAAQ,EAAG,CACtC,OAAA,WAAA,EACA,KAAI,EAAiB,OAAA,OAAA,OAAA,SAChB,EAAL,GACE,CADF,CACmB,OAAA,OAAA,OAAA,SADnB,CAEM,OAAA,OAAA,OAAA,CAAsB,UAAtB,CAFN,CAK8C,WAA9C,EAAI,MAAO,MAAA,UAAA,CAAgB,CAAhB,CAAX,EACE,OAAA,eAAA,CACI,KAAA,UADJ,CACqB,CADrB,CACqC,CAC/B,aAAc,CAAA,CADiB,CAE/B,SAAU,CAAA,CAFqB,CAO/B,MAAO,QAAQ,EAAG,CAChB,MAAO,QAAA,cAAA,CAAsB,IAAtB,CADS,CAPa,CADrC,CAeF,QAAA,mBAAA,CAA6B,QAAQ,EAAG,EAxBF,CAkCxC,QAAA,cAAA,CAAwB,QAAQ,CAAC,CAAD,CAAQ,CACtC,IAAI,EAAQ,CACZ,OAAO,QAAA,kBAAA,CAA0B,QAAQ,EAAG,CAC1C,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPiC,CAArC,CAF+B,CA0BxC;OAAA,kBAAA,CAA4B,QAAQ,CAAC,CAAD,CAAO,CACzC,OAAA,mBAAA,EAEI,EAAA,CAAW,CAAC,KAAM,CAAP,CAKf,EAAA,CAAS,OAAA,OAAA,OAAA,SAAT,CAAA,CAA2C,QAAQ,EAAG,CAAE,MAAO,KAAT,CACtD,OAAyC,EATA,CChG3C,QAAA,MAAA,CAAgB,OAAA,MAAhB,EAAiC,EAWjC,QAAA,kBAAA,CAA4B,QAAQ,CAAC,CAAD,CAAQ,CAAR,CAAmB,CACrD,OAAA,mBAAA,EAEI,EAAJ,WAAqB,OAArB,GAAqC,CAArC,EAA6C,EAA7C,CACA,KAAI,EAAI,CAAR,CACI,EAAO,CACT,KAAM,QAAQ,EAAG,CACf,GAAI,CAAJ,CAAQ,CAAA,OAAR,CAAsB,CACpB,IAAI,EAAQ,CAAA,EACZ,OAAO,CAAC,MAAO,CAAA,CAAU,CAAV,CAAiB,CAAA,CAAM,CAAN,CAAjB,CAAR,CAAwC,KAAM,CAAA,CAA9C,CAFa,CAItB,CAAA,KAAA,CAAY,QAAQ,EAAG,CAAE,MAAO,CAAC,KAAM,CAAA,CAAP,CAAa,MAAO,IAAK,EAAzB,CAAT,CACvB,OAAO,EAAA,KAAA,EANQ,CADR,CAUX,EAAA,CAAK,MAAA,SAAL,CAAA,CAAwB,QAAQ,EAAG,CAAE,MAAO,EAAT,CACnC,OAAO,EAhB8C,CCJvD;OAAA,SAAA,CAAmB,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA6B,CAA7B,CAAqC,CAC9D,GAAK,CAAL,CAAA,CACI,CAAA,CAAM,OAAA,OACN,EAAA,CAAQ,CAAA,MAAA,CAAa,GAAb,CACZ,KAAS,CAAT,CAAa,CAAb,CAAgB,CAAhB,CAAoB,CAAA,OAApB,CAAmC,CAAnC,CAAsC,CAAA,EAAtC,CAA2C,CACzC,IAAI,EAAM,CAAA,CAAM,CAAN,CACJ,EAAN,GAAa,EAAb,GAAmB,CAAA,CAAI,CAAJ,CAAnB,CAA8B,EAA9B,CACA,EAAA,CAAM,CAAA,CAAI,CAAJ,CAHmC,CAKvC,CAAA,CAAW,CAAA,CAAM,CAAA,OAAN,CAAqB,CAArB,CACX,EAAA,CAAO,CAAA,CAAI,CAAJ,CACP,EAAA,CAAO,CAAA,CAAS,CAAT,CACP,EAAJ,EAAY,CAAZ,EAA4B,IAA5B,EAAoB,CAApB,EACA,OAAA,eAAA,CACI,CADJ,CACS,CADT,CACmB,CAAC,aAAc,CAAA,CAAf,CAAqB,SAAU,CAAA,CAA/B,CAAqC,MAAO,CAA5C,CADnB,CAZA,CAD8D,CCVhE,QAAA,SAAA,CAAiB,sBAAjB,CAAyC,QAAQ,CAAC,CAAD,CAAO,CACtD,MAAI,EAAJ,CAAiB,CAAjB,CAQe,QAAQ,EAAG,CACxB,MAAO,QAAA,kBAAA,CAA0B,IAA1B,CAAgC,QAAQ,CAAC,CAAD,CAAI,CAAE,MAAO,EAAT,CAA5C,CADiB,CAT4B,CAAxD,CAcG,UAdH,CAce,KAdf,CCAA;OAAA,SAAA,CAAiB,yBAAjB,CAA4C,QAAQ,CAAC,CAAD,CAAO,CACzD,MAAI,EAAJ,CAAiB,CAAjB,CAUe,QAAQ,EAAG,CACxB,MAAO,QAAA,kBAAA,CACH,IADG,CACG,QAAQ,CAAC,CAAD,CAAI,CAAJ,CAAO,CAAE,MAAO,CAAC,CAAD,CAAI,CAAJ,CAAT,CADlB,CADiB,CAX+B,CAA3D,CAiBG,UAjBH,CAiBe,KAjBf,CCAA,QAAA,SAAA,CAAiB,wBAAjB,CAA2C,QAAQ,CAAC,CAAD,CAAO,CACxD,MAAI,EAAJ,CAAiB,CAAjB,CASe,QAAQ,EAAG,CACxB,MAAO,QAAA,kBAAA,CAA0B,IAA1B,CAAgC,QAAQ,CAAC,CAAD,CAAI,CAAJ,CAAO,CAAE,MAAO,EAAT,CAA/C,CADiB,CAV8B,CAA1D,CAeG,KAfH,CAeU,KAfV,CCEC;SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkB,CAES,UAAtB,GAAI,MAAOC,OAAX,EAAoCA,MAAA,IAApC,CACNA,MAAA,CAAO,CAAC,YAAD,CAAP,CAAuBD,CAAvB,CADM,CAEiC,UAAvB,GAAI,MAAOE,QAAX,EAAuD,QAAvD,GAAqC,MAAOC,OAA5C,EAAmEA,MAAnE,EAA6EA,MAAA,QAA7E,CAChBA,MAAA,QADgB,CACIH,CAAA,CAAQE,OAAA,CAAQ,YAAR,CAAR,CAA+B,CAAA,CAA/B,CADJ,CAGhB,CAACH,CAAA,QAAD,CAAqBA,CAAA,QAArB,EAA0C,EAA1C,UAHgB,CAG4CC,CAAA,CAAQD,CAAA,QAAA,WAAR,CAPzC,CAA1B,CAAD,CASG,IATH,CASS,QAAQ,CAACK,CAAD,CAAaC,CAAb,CAAyB,CAStC,IAAIC,EAAW,EAMfA,EAAAF,WAAA,CAAsBA,CAMtBE,EAAAC,KAAA,CAAgBH,CAAAG,KAAhB,EAAmC,IAQnCD,EAAAE,QAAA,CAAmB,OAQnBF,EAAAG,WAAA,CAAsB,EAOtBH,EAAAG,WAAAC,OAAA,CAA6B,CAQ7BJ,EAAAG,WAAAE,OAAA,CAA6B,CAQ7BL,EAAAG,WAAAG,OAAA,CAA6B,CAQ7BN,EAAAG,WAAAI,WAAA,CAAiC,CAQjCP,EAAAG,WAAAK,SAAA,CAA+B,CAQ/BR,EAAAG,WAAAM,OAAA,CAA6B,CAQ7BT,EAAAU,oBAAA;AAA+B,CAC3BV,CAAAG,WAAAC,OAD2B,CAE3BJ,CAAAG,WAAAE,OAF2B,CAG3BL,CAAAG,WAAAM,OAH2B,CAa/BT,EAAAW,MAAA,CAAiB,CAEb,MAAS,CACLC,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAC,OAFL,CAGLU,aAAc,CAHT,CAFI,CAOb,OAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ,CAGNU,aAAc,CAHR,CAPG,CAYb,OAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ,CAGNU,aAAc,CAHR,CAZG,CAiBb,MAAS,CACLF,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAC,OAFL,CAGLU,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAc,KAAhB,CAAqCC,IAAAA,EAH9C,CAjBI,CAsBb,OAAU,CACNJ,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ,CAGNU,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAgB,MAAhB,CAAsCD,IAAAA,EAH9C,CAtBG,CA2Bb,OAAU,CACNJ,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ;AAGNU,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAc,KAAhB,CAAqCC,IAAAA,EAH7C,CA3BG,CAgCb,KAAQ,CACJJ,KAAM,MADF,CAEJC,SAAUb,CAAAG,WAAAC,OAFN,CAGJU,aAAc,CAAA,CAHV,CAhCK,CAqCb,SAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAE,OAFJ,CAGNS,aAAc,CAHR,CArCG,CA0Cb,OAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAG,OAFJ,CAGNQ,aAAc,EAHR,CA1CG,CA+Cb,MAAS,CACLF,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAG,OAFL,CAGLQ,aAAc,IAHT,CA/CI,CAoDb,QAAW,CACPF,KAAM,SADC,CAEPC,SAAUb,CAAAG,WAAAM,OAFH,CAGPK,aAAc,CAHP,CApDE,CAyDb,SAAY,CACRF,KAAM,UADE,CAERC,SAAUb,CAAAG,WAAAM,OAFF,CAGRK,aAAc,CAHN,CAzDC,CA8Db,QAAW,CACPF,KAAM,SADC,CAEPC,SAAUb,CAAAG,WAAAE,OAFH;AAGPS,aAAed,CAAAC,KAAA,CAAgBD,CAAAC,KAAAgB,MAAhB,CAAsCD,IAAAA,EAH9C,CA9DE,CAmEb,SAAY,CACRJ,KAAM,UADE,CAERC,SAAUb,CAAAG,WAAAE,OAFF,CAGRS,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAc,KAAhB,CAAqCC,IAAAA,EAH3C,CAnEC,CAwEb,QAAS,CACLJ,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAM,OAFL,CAGLK,aAAc,CAHT,CAxEI,CA6Eb,OAAQ,CACJF,KAAM,MADF,CAEJC,SAAUb,CAAAG,WAAAC,OAFN,CAGJU,aAAc,CAHV,CA7EK,CAkFb,QAAW,CACPF,KAAM,SADC,CAEPC,SAAUb,CAAAG,WAAAG,OAFH,CAGPQ,aAAc,IAHP,CAlFE,CAuFb,MAAS,CACLF,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAI,WAFL,CAGLO,aAAc,IAHT,CAvFI,CAoGjBd,EAAAkB,cAAA,CAAyB,CACrBlB,CAAAW,MAAA,MADqB,CAErBX,CAAAW,MAAA,OAFqB,CAGrBX,CAAAW,MAAA,SAHqB,CAIrBX,CAAAW,MAAA,OAJqB,CAKrBX,CAAAW,MAAA,QALqB;AAMrBX,CAAAW,MAAA,MANqB,CAOrBX,CAAAW,MAAA,OAPqB,CAQrBX,CAAAW,MAAA,SARqB,CASrBX,CAAAW,MAAA,OATqB,CAUrBX,CAAAW,MAAA,QAVqB,CAWrBX,CAAAW,MAAA,KAXqB,CAYrBX,CAAAW,MAAA,OAZqB,CAarBX,CAAAW,MAAA,MAbqB,CAsBzBX,EAAAmB,OAAA,CAAkB,CAQlBnB,EAAAoB,OAAA,CAAkB,SAQlBpB,EAAAqB,yBAAA,CAAoC,CAAA,CAQpCrB,EAAAsB,kBAAA,CAA6B,CAAA,CAQ7BtB,EAAAuB,iBAAA,CAA4B,CAAA,CAM5BvB,EAAAwB,KAAA,CAAiB,QAAQ,EAAG,CAQxB,IAAIA,EAAO,EAQXA,EAAAC,QAAA,CAAe,EACQ,QADR,GACX,MAAOC,QADI,EACmC,kBADnC,GACoBA,OADpB,CAC4B,EAD5B,EAC0DA,OAAA,QAD1D,CAUfF,EAAAG,IAAA,CAAWC,QAAQ,EAAG,CAUlB,IARA,IAAIC,EAAmB,CACnB,QAAS,EAAG,CAAC,MAAO,KAAIC,cAAZ,CADO,CAEnB,QAAS,EAAG,CAAC,MAAO,KAAIC,aAAJ,CAAkB,gBAAlB,CAAR,CAFO,CAGnB,QAAS,EAAG,CAAC,MAAO,KAAIA,aAAJ,CAAkB,gBAAlB,CAAR,CAHO;AAInB,QAAS,EAAG,CAAC,MAAO,KAAIA,aAAJ,CAAkB,mBAAlB,CAAR,CAJO,CAAvB,CAOIC,EAAM,IAPV,CAQSC,EAAE,CAAX,CAAaA,CAAb,CAAeJ,CAAAK,OAAf,CAAuCD,CAAA,EAAvC,CAA4C,CACxC,GAAI,CAAED,CAAA,CAAMH,CAAA,CAAiBI,CAAjB,CAAA,EAAR,CACJ,MAAOE,CAAP,CAAU,CAAE,QAAF,CACV,KAHwC,CAK5C,GAAKH,CAAAA,CAAL,CACI,KAAMI,MAAA,CAAM,iCAAN,CAAN,CACJ,MAAOJ,EAjBW,CA4BtBR,EAAAa,MAAA,CAAaC,QAAQ,CAACC,CAAD,CAAOC,CAAP,CAAiB,CAC9BA,CAAJ,EAAmC,UAAnC,EAAgB,MAAOA,EAAvB,GACIA,CADJ,CACe,IADf,CAEA,IAAIhB,CAAAC,QAAJ,CAAkB,CACd,IAAIgB,EAAK7C,OAAA,CAAQ,IAAR,CACT,IAAI4C,CAAJ,CACIC,CAAAC,SAAA,CAAYH,CAAZ,CAAkB,QAAQ,CAACI,CAAD,CAAMC,CAAN,CAAY,CAC9BD,CAAJ,CACIH,CAAA,CAAS,IAAT,CADJ,CAGIA,CAAA,CAAS,EAAT,CAAYI,CAAZ,CAJ8B,CAAtC,CADJ,KAQI,IAAI,CACA,MAAOH,EAAAI,aAAA,CAAgBN,CAAhB,CADP,CAEF,MAAOJ,CAAP,CAAU,CACR,MAAO,KADC,CAZF,CAAlB,IAeO,CACH,IAAIH,EAAMR,CAAAG,IAAA,EACVK,EAAAc,KAAA,CAAS,KAAT,CAAgBP,CAAhB,CAAsBC,CAAA,CAAW,CAAA,CAAX,CAAkB,CAAA,CAAxC,CAEAR,EAAAe,iBAAA,CAAqB,QAArB,CAA+B,YAA/B,CACoC,WAApC,GAAI,MAAOf,EAAAgB,iBAAX;AAAgDhB,CAAAgB,iBAAA,CAAqB,YAArB,CAChD,IAAIR,CAAJ,CACIR,CAAAiB,mBAOA,CAPyBC,QAAQ,EAAG,CACV,CAAtB,EAAIlB,CAAAmB,WAAJ,GAC+B,GAA/B,EAAiBnB,CAAAoB,OAAjB,EAAiE,CAAjE,EAAmDpB,CAAAoB,OAAnD,EAAkG,QAAlG,GAAsE,MAAOpB,EAAAqB,aAA7E,CACIb,CAAA,CAASR,CAAAqB,aAAT,CADJ,CAGIb,CAAA,CAAS,IAAT,CAJJ,CADgC,CAOpC,CAAsB,CAAtB,EAAIR,CAAAmB,WAAJ,EAEAnB,CAAAsB,KAAA,CAAS,IAAT,CAVJ,KAaI,OADAtB,EAAAsB,KAAA,CAAS,IAAT,CACA,CAA+B,GAA/B,EAAiBtB,CAAAoB,OAAjB,EAAiE,CAAjE,EAAmDpB,CAAAoB,OAAnD,EAAkG,QAAlG,GAAsE,MAAOpB,EAAAqB,aAA7E,CACWrB,CAAAqB,aADX,CAEO,IArBR,CAlB2B,CAkDtC7B,EAAA+B,YAAA,CAAmBC,QAAQ,CAACC,CAAD,CAAM,CAC7B,MAAOA,EAAAC,QAAA,CAAY,cAAZ,CAA4B,QAAS,CAACC,CAAD,CAAKC,CAAL,CAAS,CACjD,MAAOA,EAAAC,YAAA,EAD0C,CAA9C,CADsB,CAMjC,OAAOrC,EA9GiB,CAAZ,EAsHhBxB,EAAA8D,KAAA,CAAgB,CAGZC,MAAO,2BAHK,CAMZC,KAAM,sCANM;AASZC,KAAM,gHATM,CAYZC,KAAM,0BAZM,CAeZC,QAAS,yBAfG,CAkBZC,QAAS,8DAlBG,CAqBZC,UAAW,iCArBC,CAwBZC,OAAQ,+FAxBI,CA2BZC,WAAY,qBA3BA,CA8BZC,WAAY,qBA9BA,CAiCZC,WAAY,WAjCA,CAoCZC,WAAY,iDApCA;AAuCZC,KAAM,mBAvCM,CA0CZC,GAAI,+CA1CQ,CA6CZC,MAAO,kDA7CK,CAgDZC,WAAY,IAhDA,CAmDZC,OAAQ,gEAnDI,CAsDZC,UAAW,iCAtDC,CAyDZC,UAAW,iCAzDC,CAiEhBjF,EAAAkF,QAAA,CAAoB,QAAQ,CAAClF,CAAD,CAAW,CAgZnCmF,QAASA,EAAM,CAACC,CAAD,CAAQC,CAAR,CAAkB,CAC7B,GAAID,CAAJ,EAAkC,QAAlC,GAAa,MAAOA,EAAAE,IAApB,EAAoE,QAApE,GAA8C,MAAOF,EAAAG,KAArD,EAA0G,SAA1G,GAAgF,MAAOH,EAAAC,SAAvF,EACOD,CAAAE,IADP,GACqBF,CAAAE,IADrB,EACkCF,CAAAG,KADlC,GACiDH,CAAAG,KADjD,CAEI,MAAO,KAAIvF,CAAAC,KAAJ,CAAkBmF,CAAAE,IAAlB,CAA6BF,CAAAG,KAA7B,CAA6D,WAApB;AAAA,MAAOF,EAAP,CAAkCD,CAAAC,SAAlC,CAAmDA,CAA5F,CACX,IAAqB,QAArB,GAAI,MAAOD,EAAX,CACI,MAAOpF,EAAAC,KAAAuF,WAAA,CAAyBJ,CAAzB,CAAgCC,CAAhC,EAA4C,CAAA,CAA5C,CAAmD,EAAnD,CACX,IAAqB,QAArB,GAAI,MAAOD,EAAX,CACI,MAAOpF,EAAAC,KAAAwF,WAAA,CAAyBL,CAAzB,CAAgCC,CAAhC,EAA4C,CAAA,CAA5C,CACX,MAAMjD,MAAA,CAAM,yBAAN,CAAN,CAR6B,CAy2CjCsD,QAASA,EAAgB,CAACC,CAAD,CAAaC,CAAb,CAAkB,CAAA,IACnCC,EAAMD,CAAAE,aAAA,EAD6B,CAEnCjF,EAAWgF,CAAXhF,CAAiB,CAFkB,CAGnCkF,EAAKF,CAALE,GAAa,CACjB,QAAQlF,CAAR,EACI,KAAKb,CAAAG,WAAAC,OAAL,CACI,EAAGyF,EAAA,CAAMD,CAAAI,UAAA,EAAT,OACwB,GADxB,IACQH,CADR,CACc,GADd,EAEA,MACJ,MAAK7F,CAAAG,WAAAE,OAAL,CACIuF,CAAAK,OAAA,EAAc,CACd,MACJ,MAAKjG,CAAAG,WAAAG,OAAL,CACIuF,CAAA,CAAMD,CAAAE,aAAA,EACNF,EAAAK,OAAA,EAAcJ,CACd,MACJ,MAAK7F,CAAAG,WAAAI,WAAL,CACImF,CAAA,CAAiBK,CAAjB,CAAqBH,CAArB,CACA,MACJ,MAAK5F,CAAAG,WAAAK,SAAL,CACI,GAAIuF,CAAJ,GAAWJ,CAAX,CACI,MAAO,CAAA,CAEP;KAAMvD,MAAA,CAAM,wCAAN,CAA+C2D,CAA/C,CAAkD,IAAlD,CAAuDJ,CAAvD,CAAkE,YAAlE,CAAN,CACR,KAAK3F,CAAAG,WAAAM,OAAL,CACImF,CAAAK,OAAA,EAAc,CACd,MACJ,SACI,KAAM7D,MAAA,CAAM,qCAAN,CAA4CuD,CAA5C,CAAuD,IAAvD,CAA4D9E,CAA5D,CAAN,CAxBR,CA0BA,MAAO,CAAA,CA9BgC,CAjvD3C,IAAIqE,EAAU,EAAd,CAWIgB,EAAIA,QAAQ,CAACC,CAAD,CAAUC,CAAV,CAAkBxF,CAAlB,CAAwB,CAOpC,IAAAuF,QAAA,CAAeA,CAOf,KAAAC,OAAA,CAAcA,CAOd,KAAAxF,KAAA,CAAYA,CArBwB,CAXxC,CA8CIyF,EAAaH,CAAAI,UAOjBD,EAAAE,IAAA,CAAiBC,QAAQ,EAAG,CAAA,IACpB5F,EAAO,IAAAA,KADa,CAEpB6F,EAAM,IACV,GAAG,CACCA,CAAA,CAAMA,CAAAL,OACN,IAAW,IAAX,EAAIK,CAAJ,CACI,KACJ7F,EAAA,CAAO6F,CAAA7F,KAAP,CAAgB,GAAhB,CAAoBA,CAJrB,CAAH,MAKS,CALT,CAMA,OAAOA,EATiB,CAkB5ByF,EAAAK,SAAA,CAAsBC,QAAQ,CAACC,CAAD,CAAe,CACzC,OAAQA,CAAA,CAAe,IAAAC,UAAf,CAAgC,GAAhC,CAAsC,EAA9C,EAAoD,IAAAN,IAAA,EADX,CAS7CF,EAAAS,MAAA,CAAmBC,QAAQ,EAAG,CAC1B,KAAM3E,MAAA,CAAM,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAN;AAA0B,2BAA1B,CAAN,CAD0B,CAQ9BxB,EAAAgB,EAAA,CAAYA,CAaZ,KAAIc,EAAYA,QAAQ,CAACb,CAAD,CAAUC,CAAV,CAAkBxF,CAAlB,CAAwBqG,CAAxB,CAAiCC,CAAjC,CAAyC,CAC7DhB,CAAAiB,KAAA,CAAO,IAAP,CAAahB,CAAb,CAAsBC,CAAtB,CAA8BxF,CAA9B,CAKA,KAAAiG,UAAA,CAAiB,WAMjB,KAAAO,SAAA,CAAgB,EAMhB,KAAAH,QAAA,CAAeA,CAAf,EAA0B,EAM1B,KAAAC,OAAA,CAAcA,CAAd,EAAwB,QAxBqC,CAAjE,CA+BIG,EAAqBL,CAAAV,UAArBe,CAA2CC,MAAAC,OAAA,CAAcrB,CAAAI,UAAd,CAQ/Ce,EAAAG,YAAA,CAAiCC,QAAQ,CAACC,CAAD,CAAO,CAC5CA,CAAA,CAAOA,CAAP,EAAe,IACf,IAAY,IAAZ,EAAIA,CAAJ,CACI,MAAO,KAAAN,SAAAO,MAAA,EAEX,KADA,IAAIP,EAAW,EAAf,CACSnF,EAAE,CADX,CACc2F,EAAE,IAAAR,SAAAlF,OAAhB,CAAsCD,CAAtC,CAAwC2F,CAAxC,CAA2C,EAAE3F,CAA7C,CACQ,IAAAmF,SAAA,CAAcnF,CAAd,CAAJ,UAAgCyF,EAAhC,EACIN,CAAAS,KAAA,CAAc,IAAAT,SAAA,CAAcnF,CAAd,CAAd,CACR,OAAOmF,EARqC,CAiBhDC,EAAAS,SAAA,CAA8BC,QAAQ,CAACC,CAAD,CAAQ,CAC1C,IAAIC,CACJ,IAAIA,CAAJ,CAAY,IAAAC,SAAA,CAAcF,CAAApH,KAAd,CAAZ,CAEI,GAAIqH,CAAJ,WAAqBE,EAAAC,MAArB,EAAsCH,CAAArH,KAAtC,GAAqDqH,CAAAI,aAArD;AAAiH,IAAjH,GAA2E,IAAAH,SAAA,CAAcD,CAAAI,aAAd,CAA3E,CACIJ,CAAArH,KAAA,CAAaqH,CAAAI,aADjB,KAEK,IAAIL,CAAJ,WAAqBG,EAAAC,MAArB,EAAsCJ,CAAApH,KAAtC,GAAqDoH,CAAAK,aAArD,EAAiH,IAAjH,GAA2E,IAAAH,SAAA,CAAcF,CAAAK,aAAd,CAA3E,CACDL,CAAApH,KAAA,CAAaoH,CAAAK,aADZ,KAGD,MAAMjG,MAAA,CAAM,8BAAN,CAAqC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DsB,CAAApH,KAA9D,CAAN,CAER,IAAAwG,SAAAS,KAAA,CAAmBG,CAAnB,CAX0C,CAoB9CX,EAAAa,SAAA,CAA8BI,QAAQ,CAACC,CAAD,CAAW,CAE7C,IADA,IAAIC,EAA0B,QAApB,GAAA,MAAOD,EAAP,CAA+B,IAA/B,CAAsC,MAAhD,CACStG,EAAE,CADX,CACc2F,EAAE,IAAAR,SAAAlF,OAAhB,CAAsCD,CAAtC,CAAwC2F,CAAxC,CAA2C,EAAE3F,CAA7C,CACI,GAAI,IAAAmF,SAAA,CAAcnF,CAAd,CAAA,CAAiBuG,CAAjB,CAAJ,GAA8BD,CAA9B,CACI,MAAO,KAAAnB,SAAA,CAAcnF,CAAd,CACf,OAAO,KALsC,CAejDoF,EAAAoB,QAAA,CAA6BC,QAAQ,CAACC,CAAD,CAAKC,CAAL,CAA0B,CAAA,IACvDC,EAAqB,QAAd,GAAA,MAAOF,EAAP,CAAyBA,CAAAG,MAAA,CAAS,GAAT,CAAzB;AAAyCH,CADO,CAEvDlC,EAAM,IAFiD,CAGvDxE,EAAI,CACR,IAAgB,EAAhB,GAAI4G,CAAA,CAAK5G,CAAL,CAAJ,CAAoB,CAChB,IAAA,CAAsB,IAAtB,GAAOwE,CAAAL,OAAP,CAAA,CACIK,CAAA,CAAMA,CAAAL,OACVnE,EAAA,EAHgB,CAMpB,EAAG,CACC,EAAG,CACC,GAAM,EAAAwE,CAAA,WAAevB,EAAA8B,UAAf,CAAN,CAAyC,CACrCP,CAAA,CAAM,IACN,MAFqC,CAIzCuB,CAAA,CAAQvB,CAAAyB,SAAA,CAAaW,CAAA,CAAK5G,CAAL,CAAb,CACR,IAAI,EAAC+F,CAAD,EAAYA,CAAZ,WAA6B9C,EAAAgB,EAA7B,CAAJ,EAAgD0C,CAAhD,EAAyE,EAAAZ,CAAA,WAAiB9C,EAAA8B,UAAjB,CAAzE,CAA+G,CAC3GP,CAAA,CAAM,IACN,MAF2G,CAIlGxE,CAAA,EAVd,CAAH,MAWSA,CAXT,CAWa4G,CAAA3G,OAXb,CAYA,IAAW,IAAX,EAAIuE,CAAJ,CACI,KAEJ,IAAoB,IAApB,GAAI,IAAAL,OAAJ,CACI,MAAO,KAAAA,OAAAqC,QAAA,CAAoBE,CAApB,CAAwBC,CAAxB,CAjBZ,CAAH,MAkBgB,IAlBhB,EAkBSnC,CAlBT,CAmBA,OAAOA,EA7BoD,CAsC/DY,EAAAsB,GAAA,CAAwBI,QAAQ,CAACC,CAAD,CAAI,CAAA,IAC5BH,EAAO,EADqB,CACjBpC,EAAMuC,CACrB,GACIH,EAAAI,QAAA,CAAaxC,CAAA7F,KAAb,CACA,CAAA6F,CAAA,CAAMA,CAAAL,OAFV,OAGiB,IAHjB,GAGSK,CAHT,CAIA,KAASyC,CAAT,CAAa,CAAb,CAAgBA,CAAhB,EAAuBL,CAAA3G,OAAvB,CAAoCgH,CAAA,EAApC,CAA2C,CACvC,IAAIP,EAAKE,CAAAlB,MAAA,CAAWkB,CAAA3G,OAAX,CAAuBgH,CAAvB,CACT,IAAIF,CAAJ,GAAU,IAAAP,QAAA,CAAaE,CAAb,CAAiBK,CAAjB,WAA8B9D,EAAA8B,UAA9B,CAAV,CACI,MAAO2B,EAAAQ,KAAA,CAAQ,GAAR,CAH4B,CAK3C,MAAOH,EAAAzC,IAAA,EAXyB,CAmBpCc;CAAAP,MAAA,CAA2BsC,QAAQ,EAAG,CAIlC,IAFA,IAAIC,EAAK,EAAT,CACIjC,EAAW,IAAAA,SADf,CAESnF,EAAE,CAFX,CAEc2F,EAAER,CAAAlF,OAFhB,CAEiC8F,CAAjC,CAAwC/F,CAAxC,CAA0C2F,CAA1C,CAA6C,EAAE3F,CAA/C,CACI+F,CACA,CADQZ,CAAA,CAASnF,CAAT,CACR,CAAI+F,CAAJ,WAAqBhB,EAArB,GACIqC,CAAA,CAAGrB,CAAApH,KAAH,CADJ,CACqBoH,CAAAlB,MAAA,EADrB,CAGAQ,OAAAgC,eAAJ,EACIhC,MAAAgC,eAAA,CAAsBD,CAAtB,CAA0B,UAA1B,CAAsC,CAAE,MAAS,IAAAE,SAAA,EAAX,CAAtC,CACJ,OAAOF,EAX2B,CAkBtChC,EAAAkC,SAAA,CAA8BC,QAAQ,EAAG,CAGrC,IAHqC,IACjCC,EAAM,EAD2B,CAEjCC,EAAOpC,MAAAoC,KAAA,CAAY,IAAAzC,QAAZ,CAF0B,CAG5BhF,EAAE,CAH0B,CAGvB2F,EAAE8B,CAAAxH,OAAhB,CAA6BD,CAA7B,CAA+B2F,CAA/B,CAAkC,EAAE3F,CAApC,CAOIwH,CAAA,CANUC,CAAAlB,CAAKvG,CAALuG,CAMV,CAAA,CALU,IAAAvB,QAAA0C,CAAaD,CAAA,CAAKzH,CAAL,CAAb0H,CAQd,OAAOF,EAb8B,CAqBzCpC,EAAAuC,UAAA,CAA+BC,QAAQ,CAACjJ,CAAD,CAAO,CAC1C,MAAoB,WAApB,GAAI,MAAOA,EAAX,CACW,IAAAqG,QADX,CAEqC,WAA9B,GAAA,MAAO,KAAAA,QAAA,CAAarG,CAAb,CAAP,CAA4C,IAAAqG,QAAA,CAAarG,CAAb,CAA5C,CAAiE,IAH9B,CAU9CsE,EAAA8B,UAAA,CAAoBA,CAuBpB,KAAI8C,EAAUA,QAAQ,CAACpC,CAAD,CAAOqC,CAAP,CAAqBC,CAArB,CAA+B9C,CAA/B,CAAuCtG,CAAvC,CAA6C,CAM/D,IAAA8G,KAAA;AAAYA,CAMZ,KAAAqC,aAAA,CAAoBA,CAMpB,KAAAC,SAAA,CAAgBA,CAMhB,KAAA9C,OAAA,CAAcA,CAMd,KAAAtG,KAAA,CAAYA,CAEZ,IAAIoJ,CAAJ,EAAuD,CAAvD,CAAgBhK,CAAAkB,cAAA+I,QAAA,CAA+BvC,CAA/B,CAAhB,CACI,KAAMtF,MAAA,CAAM,wBAAN,CAAiCsF,CAAA9G,KAAjC,CAAN,CAjC2D,CAAnE,CAoCIsJ,EAAmBJ,CAAAxD,UAwBvBwD,EAAAK,kBAAA,CAhBAC,QAAkB,CAAC1C,CAAD,CAAO,CACD,QAApB,GAAI,MAAOA,EAAX,GACIA,CADJ,CACW1H,CAAAW,MAAA,CAAe+G,CAAf,CADX,CAEA,IAAiC,WAAjC,GAAI,MAAOA,EAAA5G,aAAX,CACI,KAAMsB,MAAA,CAAM,yBAAN,CAAgCsF,CAAA9G,KAAhC,CAA0C,mBAA1C,CAAN,CACJ,MAAI8G,EAAJ,EAAY1H,CAAAW,MAAA,MAAZ,CACW,IAAIb,CAAJ,CAAe,CAAf,CADX,CAEO4H,CAAA5G,aAPc,CAsCzBoJ,EAAAxD,SAAA,CAA4B2D,QAAQ,EAAG,CACnC,OAAQ,IAAAzJ,KAAR,EAAqB,EAArB,GAA4B,IAAAoJ,SAAA,CAAgB,KAAhB,CAAwB,OAApD,EAA+D,UAD5B,CAYvCE,EAAAI,YAAA,CAA+BC,QAAQ,CAACnF,CAAD,CAAQ,CAE3CoF,QAASA,EAAI,CAACb,CAAD;AAAMc,CAAN,CAAW,CACpB,KAAMrI,MAAA,CAAM,oBAAN,CAA2BsI,CAAAhE,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,WAA/C,CAA2DgE,CAAAhD,KAAA9G,KAA3D,CAA0E,IAA1E,CAA+E+I,CAA/E,CAAmF,IAAnF,CAAwFc,CAAxF,CAA4F,GAA5F,CAAN,CADoB,CADxB,IAAIC,EAAO,IAIX,QAAQ,IAAAhD,KAAR,EAEI,KAAK1H,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CAII,MAAO,CAFc,QAEd,GAFH,MAAOyE,EAEJ,EAF2BA,CAE3B,GAFqCA,CAErC,EAF4D,CAE5D,GAF8CA,CAE9C,CAFsD,CAEtD,GADHoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,gBAAnB,CACG,CAAQ,UAAR,CAAAA,CAAA,CAAqBA,CAArB,CAA6B,CAA7B,CAAiCA,CAG5C,MAAKpF,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CAGI,MAAO,CAFc,QAEd,GAFH,MAAOyE,EAEJ,EAF2BA,CAE3B,GAFqCA,CAErC,EAF4D,CAE5D,GAF8CA,CAE9C,CAFsD,CAEtD,GADHoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,gBAAnB,CACG,CAAQ,CAAR,CAAAA,CAAA,CAAYA,CAAZ,GAAsB,CAAtB,CAA0BA,CAGrC,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACI,GAAIX,CAAAC,KAAJ,CACI,GAAI,CACA,MAAOkF,EAAA,CAAOC,CAAP,CAAc,CAAA,CAAd,CADP,CAEF,MAAOjD,CAAP,CAAU,CACRqI,CAAA,CAAK,MAAOpF,EAAZ;AAAmBjD,CAAAwI,QAAnB,CADQ,CAHhB,IAOIH,EAAA,CAAK,MAAOpF,EAAZ,CAAmB,kBAAnB,CAIR,MAAKpF,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,GAAIX,CAAAC,KAAJ,CACI,GAAI,CACA,MAAOkF,EAAA,CAAOC,CAAP,CAAc,CAAA,CAAd,CADP,CAEF,MAAOjD,CAAP,CAAU,CACRqI,CAAA,CAAK,MAAOpF,EAAZ,CAAmBjD,CAAAwI,QAAnB,CADQ,CAHhB,IAOIH,EAAA,CAAK,MAAOpF,EAAZ,CAAmB,kBAAnB,CAIR,MAAKpF,CAAAW,MAAA,KAAL,CAGI,MAFqB,SAEdyE,GAFH,MAAOA,EAEJA,EADHoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,eAAnB,CACGA,CAAAA,CAGX,MAAKpF,CAAAW,MAAA,CAAe,OAAf,CAAL,CACA,KAAKX,CAAAW,MAAA,CAAe,QAAf,CAAL,CAGI,MAFqB,QAEdyE,GAFH,MAAOA,EAEJA,EADHoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,cAAnB,CACGA,CAAAA,CAGX,MAAKpF,CAAAW,MAAA,OAAL,CAGI,MAFqB,QAEd,GAFH,MAAOyE,EAEJ,EAF4BA,CAE5B,EAFqCA,CAErC,WAFsDwF,OAEtD,EADHJ,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,cAAnB,CACG,CAAA,EAAA,CAAGA,CAGd,MAAKpF,CAAAW,MAAA,MAAL,CACI,MAAIb,EAAA+K,aAAA,CAAwBzF,CAAxB,CAAJ;AACWA,CADX,CAEOtF,CAAAgL,KAAA,CAAgB1F,CAAhB,CAAuB,QAAvB,CAGX,MAAKpF,CAAAW,MAAA,CAAe,MAAf,CAAL,CAEI,IADA,IAAIoK,EAAS,IAAAhB,aAAAvC,YAAA,CAA8BxH,CAAAkF,QAAA8F,KAAAC,MAA9B,CAAb,CACKhJ,EAAE,CAAP,CAAUA,CAAV,CAAY8I,CAAA7I,OAAZ,CAA2BD,CAAA,EAA3B,CAGS,GAFD8I,CAAA,CAAO9I,CAAP,CAAArB,KAEC,EAFiBwE,CAEjB,EAAI2F,CAAA,CAAO9I,CAAP,CAAA8D,GAAJ,EAAoBX,CAApB,CACD,MAAO2F,EAAA,CAAO9I,CAAP,CAAA8D,GAEf,IAAoB,QAApB,GAAI,IAAAmB,OAAJ,CAMI,MAAO9B,CAJc,QAIdA,GAJH,MAAOA,EAIJA,EAJ2BA,CAI3BA,GAJqCA,CAIrCA,EAJ4D,CAI5DA,GAJ8CA,CAI9CA,CAJsD,CAItDA,GAHHoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,gBAAnB,CAGGA,EAFK,UAELA,CAFHA,CAEGA,EAF2B,CAE3BA,CAFmBA,CAEnBA,GADHoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,yBAAnB,CACGA,CAAAA,CAGPoF,EAAA,CAAKpF,CAAL,CAAY,wBAAZ,CAIR,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACSyE,CAAL,EAA+B,QAA/B,GAAc,MAAOA,EAArB,EACIoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,iBAAnB,CACJ,IAAIA,CAAJ,WAAqB,KAAA2E,aAAAmB,MAArB,CACI,MAAO9F,EACX,IAAIA,CAAJ;AAAqBpF,CAAAmL,QAAAhD,QAArB,CAA+C,CAEvCiD,IAAAA,EAAM,EAANA,CACKnJ,CAAT,KAASA,CAAT,GAAcmD,EAAd,CACQA,CAAAiG,eAAA,CAAqBpJ,CAArB,CAAJ,GACImJ,CAAA,CAAInJ,CAAJ,CADJ,CACamD,CAAA,CAAMnD,CAAN,CADb,CAEJmD,EAAA,CAAQgG,CANmC,CAS/C,MAAO,KAAK,IAAArB,aAAAmB,MAAL,CAA8B9F,CAA9B,CA1Gf,CA+GA,KAAMhD,MAAA,CAAM,+BAAN,CAAsC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAtC,CAA0D,IAA1D,CAA+DtB,CAA/D,CAAqE,mBAArE,CAAyF,IAAAsC,KAAzF,CAAmG,GAAnG,CAAN,CApH2C,CA+H/CwC,EAAAoB,gBAAA,CAAmCC,QAAQ,CAACxF,CAAD,CAAKX,CAAL,CAAY,CACnD,GAAc,IAAd,GAAIA,CAAJ,CAAoB,MAAO,EAE3B,KAAIoG,CACJ,QAAQ,IAAA9D,KAAR,EACI,KAAK1H,CAAAW,MAAA,MAAL,CACI,MAAe,EAAR,CAAAyE,CAAA,CAAYtF,CAAA2L,kBAAA,CAA6BrG,CAA7B,CAAZ,CAAkDtF,CAAA4L,kBAAA,CAA6BtG,CAA7B,CAC7D,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAA4L,kBAAA,CAA6BtG,CAA7B,CACX,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAA4L,kBAAA,CAA6B5L,CAAA6L,eAAA,CAA0BvG,CAA1B,CAA7B,CACX,MAAKpF,CAAAW,MAAA,QAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,CAAe,OAAf,CAAL,CACI,MAAO,EACX;KAAKX,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAA2L,kBAAA,CAA6BrG,CAA7B,CACX,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAA2L,kBAAA,CAA6B3L,CAAA8L,eAAA,CAA0BxG,CAA1B,CAA7B,CACX,MAAKpF,CAAAW,MAAA,QAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,KAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,CAAe,MAAf,CAAL,CACI,MAAOb,EAAA4L,kBAAA,CAA6BtG,CAA7B,CACX,MAAKpF,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,OAAL,CAEI,MADA6K,EACO,CADH1L,CAAA+L,mBAAA,CAA8BzG,CAA9B,CACG,CAAAtF,CAAA4L,kBAAA,CAA6BF,CAA7B,CAAA,CAAkCA,CAC7C,MAAKxL,CAAAW,MAAA,MAAL,CACI,GAAwB,CAAxB,CAAIyE,CAAA0G,UAAA,EAAJ,CACI,KAAM1J,MAAA,CAAM,oBAAN,CAA2B,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDtB,CAAA0G,UAAA,EAApD,CAAsE,kBAAtE,CAAN;AACJ,MAAOhM,EAAA4L,kBAAA,CAA6BtG,CAAA0G,UAAA,EAA7B,CAAP,CAAyD1G,CAAA0G,UAAA,EAC7D,MAAK9L,CAAAW,MAAA,QAAL,CAEI,MADA6K,EACO,CADH,IAAAzB,aAAAgC,UAAA,CAA4B3G,CAA5B,CACG,CAAAtF,CAAA4L,kBAAA,CAA6BF,CAA7B,CAAA,CAAkCA,CAC7C,MAAKxL,CAAAW,MAAA,MAAL,CAEI,MADA6K,EACO,CADH,IAAAzB,aAAAgC,UAAA,CAA4B3G,CAA5B,CACG,CAAAoG,CAAA,CAAI1L,CAAA4L,kBAAA,CAA8B3F,CAA9B,EAAoC,CAApC,CAAyC/F,CAAAG,WAAAK,SAAzC,CArCnB,CAwCA,KAAM4B,MAAA,CAAM,wCAAN,CAA+C,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAA/C,CAAmE,IAAnE,CAAwEtB,CAAxE,CAA8E,iBAA9E,CAAN,CA5CmD,CAwDvD8E,EAAA8B,YAAA,CAA+BC,QAAQ,CAAClG,CAAD,CAAKX,CAAL,CAAY8G,CAAZ,CAAoB,CACvD,GAAc,IAAd,GAAI9G,CAAJ,CAAoB,MAAO8G,EAG3B,QAAQ,IAAAxE,KAAR,EAEI,KAAK1H,CAAAW,MAAA,MAAL,CAGgB,CAAZ,CAAIyE,CAAJ,CACI8G,CAAAC,cAAA,CAAqB/G,CAArB,CADJ,CAGI8G,CAAAE,cAAA,CAAqBhH,CAArB,CACJ,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACIuL,CAAAE,cAAA,CAAqBhH,CAArB,CACA;KAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACIuL,CAAAG,oBAAA,CAA2BjH,CAA3B,CACA,MAGJ,MAAKpF,CAAAW,MAAA,QAAL,CACIuL,CAAAI,YAAA,CAAmBlH,CAAnB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,SAAL,CACIuL,CAAAK,WAAA,CAAkBnH,CAAlB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACIuL,CAAAC,cAAA,CAAqB/G,CAArB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACIuL,CAAAM,oBAAA,CAA2BpH,CAA3B,CACA,MAGJ,MAAKpF,CAAAW,MAAA,QAAL,CACIuL,CAAAO,YAAA,CAAmBrH,CAAnB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,SAAL,CACIuL,CAAAQ,WAAA,CAAkBtH,CAAlB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,KAAL,CACyB,QAArB,GAAI,MAAOyE,EAAX,CACI8G,CAAAE,cAAA,CAA6C,OAAxB,GAAAhH,CAAAuH,YAAA,EAAA,CAAkC,CAAlC,CAAsC,CAAEvH,CAAAA,CAA7D,CADJ,CAGI8G,CAAAE,cAAA,CAAqBhH,CAAA,CAAQ,CAAR,CAAY,CAAjC,CACJ,MAGJ,MAAKpF,CAAAW,MAAA,CAAe,MAAf,CAAL,CACIuL,CAAAE,cAAA,CAAqBhH,CAArB,CACA;KAGJ,MAAKpF,CAAAW,MAAA,CAAe,OAAf,CAAL,CACIuL,CAAAU,aAAA,CAAoBxH,CAApB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,CAAe,QAAf,CAAL,CACIuL,CAAAW,aAAA,CAAoBzH,CAApB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACIuL,CAAAY,aAAA,CAAoB1H,CAApB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,MAAL,CACI,GAAwB,CAAxB,CAAIyE,CAAA0G,UAAA,EAAJ,CACI,KAAM1J,MAAA,CAAM,oBAAN,CAA2B,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDtB,CAAA0G,UAAA,EAApD,CAAsE,kBAAtE,CAAN,CACAiB,CAAAA,CAAa3H,CAAAa,OACjBiG,EAAAE,cAAA,CAAqBhH,CAAA0G,UAAA,EAArB,CACAI,EAAAc,OAAA,CAAc5H,CAAd,CACAA,EAAAa,OAAA,CAAe8G,CACf,MAGJ,MAAK/M,CAAAW,MAAA,QAAL,CACQsM,CAAAA,CAAKC,CAAA,IAAIpN,CAAJoN,IAAA,EACT,KAAAnD,aAAAoD,OAAA,CAAyB/H,CAAzB,CAAgC6H,CAAhC,CACAf,EAAAE,cAAA,CAAqBa,CAAAhH,OAArB,CACAiG,EAAAc,OAAA,CAAcC,CAAAG,KAAA,EAAd,CACA,MAGJ,MAAKpN,CAAAW,MAAA,MAAL,CACI,IAAAoJ,aAAAoD,OAAA,CAAyB/H,CAAzB;AAAgC8G,CAAhC,CACAA,EAAAE,cAAA,CAAsBrG,CAAtB,EAA4B,CAA5B,CAAiC/F,CAAAG,WAAAK,SAAjC,CACA,MAEJ,SAEI,KAAM4B,MAAA,CAAM,wCAAN,CAA+C,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAA/C,CAAmE,IAAnE,CAAwEtB,CAAxE,CAA8E,iBAA9E,CAAN,CA1GR,CA4GA,MAAO8G,EAhHgD,CA4H3DhC,EAAAmD,OAAA,CAA0BC,QAAQ,CAACpB,CAAD,CAASrL,CAAT,CAAmBkF,CAAnB,CAAuB,CACrD,GAAIlF,CAAJ,EAAgB,IAAA6G,KAAA7G,SAAhB,CACI,KAAMuB,MAAA,CAAM,kCAAN,CAAN,CAGJ,OAAQ,IAAAsF,KAAR,EAEI,KAAK1H,CAAAW,MAAA,MAAL,CACI,MAAOuL,EAAApG,aAAA,EAAP,CAA+B,CAGnC,MAAK9F,CAAAW,MAAA,OAAL,CACI,MAAOuL,EAAApG,aAAA,EAAP,GAAiC,CAGrC,MAAK9F,CAAAW,MAAA,OAAL,CACI,MAAOuL,EAAAqB,mBAAA,EAAP,CAAqC,CAGzC,MAAKvN,CAAAW,MAAA,QAAL,CACI,MAAOuL,EAAAsB,WAAA,EAAP,GAA+B,CAEnC,MAAKxN,CAAAW,MAAA,SAAL,CACI,MAAOuL,EAAAuB,UAAA,EAAP;AAA4B,CAGhC,MAAKzN,CAAAW,MAAA,MAAL,CACI,MAAOuL,EAAAwB,aAAA,EAGX,MAAK1N,CAAAW,MAAA,OAAL,CACI,MAAOuL,EAAAwB,aAAA,EAAAC,WAAA,EAGX,MAAK3N,CAAAW,MAAA,OAAL,CACI,MAAOuL,EAAA0B,mBAAA,EAGX,MAAK5N,CAAAW,MAAA,QAAL,CACI,MAAOuL,EAAA2B,WAAA,EAGX,MAAK7N,CAAAW,MAAA,SAAL,CACI,MAAOuL,EAAA4B,UAAA,EAGX,MAAK9N,CAAAW,MAAA,KAAL,CACI,MAAO,CAAE,CAAAuL,CAAApG,aAAA,EAGb,MAAK9F,CAAAW,MAAA,CAAe,MAAf,CAAL,CAEI,MAAOuL,EAAApG,aAAA,EAGX,MAAK9F,CAAAW,MAAA,CAAe,OAAf,CAAL,CACI,MAAOuL,EAAA6B,UAAA,EAGX,MAAK/N,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI,MAAOuL,EAAA8B,WAAA,EAGX,MAAKhO,CAAAW,MAAA,OAAL,CACI,MAAOuL,EAAA+B,YAAA,EAGX,MAAKjO,CAAAW,MAAA,MAAL,CACIuN,CAAA,CAAShC,CAAApG,aAAA,EACT,IAAIoG,CAAAJ,UAAA,EAAJ;AAAyBoC,CAAzB,CACI,KAAM9L,MAAA,CAAM,8BAAN,CAAqC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DwH,CAA9D,CAAqE,yBAArE,CAA+FhC,CAAAJ,UAAA,EAA/F,CAAN,CACJ1G,CAAA,CAAQ8G,CAAAiC,MAAA,EACR/I,EAAAgJ,MAAA,CAAchJ,CAAAa,OAAd,CAA2BiI,CAC3BhC,EAAAjG,OAAA,EAAiBiI,CACjB,OAAO9I,EAIX,MAAKpF,CAAAW,MAAA,QAAL,CAEI,MADAuN,EACO,CADEhC,CAAApG,aAAA,EACF,CAAA,IAAAiE,aAAAsD,OAAA,CAAyBnB,CAAzB,CAAiCgC,CAAjC,CAIX,MAAKlO,CAAAW,MAAA,MAAL,CACI,MAAO,KAAAoJ,aAAAsD,OAAA,CAAyBnB,CAAzB,CAAkC,EAAlC,CAAqCnG,CAArC,CAhFf,CAoFA,KAAM3D,MAAA,CAAM,gCAAN,CAAN,CAzFqD,CAoGzD8H,EAAAmE,gBAAA,CAAmCC,QAAQ,CAAC7K,CAAD,CAAM,CAC7C,GAAKuG,CAAA,IAAAA,SAAL,CACI,KAAM5H,MAAA,CAAM,iDAAN,CAAN,CAGJ,OAAQ,IAAAsF,KAAR,EACI,KAAK1H,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,MAAO,KAAA2J,YAAA,CAAiBiE,QAAA,CAAS9K,CAAT,CAAjB,CAEX;KAAKzD,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CAEM,MAAO,KAAA2J,YAAA,CAAiB7G,CAAjB,CAEb,MAAKzD,CAAAW,MAAA,KAAL,CACM,MAAe,MAAf,GAAO8C,CAEb,MAAKzD,CAAAW,MAAA,OAAL,CACM,MAAO,KAAA2J,YAAA,CAAiB7G,CAAjB,CAEb,MAAKzD,CAAAW,MAAA,MAAL,CACM,MAAOb,EAAA0O,WAAA,CAAsB/K,CAAtB,CAvBjB,CAL6C,CA+CjDyG,EAAAuE,cAAA,CAAiCC,QAAQ,CAACtJ,CAAD,CAAQ,CAC7C,GAAK4E,CAAA,IAAAA,SAAL,CACI,KAAM5H,MAAA,CAAM,+CAAN,CAAN,CAGJ,MAAI,KAAAsF,KAAJ,GAAkB1H,CAAAW,MAAA,MAAlB,CACWyE,CAAAsB,SAAA,CAAe,QAAf,CADX,CAGWtB,CAAAsB,SAAA,EARkC,CAgBjDxB,EAAA4E,QAAA,CAAkBA,CAclB,KAAI3B,EAAUA,QAAQ,CAAChC,CAAD,CAAUC,CAAV,CAAkBxF,CAAlB,CAAwBqG,CAAxB,CAAiC0H,CAAjC,CAA0CzH,CAA1C,CAAkD,CACpEF,CAAAG,KAAA,CAAe,IAAf,CAAqBhB,CAArB,CAA8BC,CAA9B,CAAsCxF,CAAtC,CAA4CqG,CAA5C,CAAqDC,CAArD,CAKA,KAAAL,UAAA;AAAiB,SAOjB,KAAA+H,WAAA,CAAkB5N,IAAAA,EAOlB,KAAAkK,MAAA,CAAa,IAOb,KAAAyD,QAAA,CAAe,CAAEA,CAAAA,CAuBjB,KAAAE,cAAA,CAPA,IAAAC,YAOA,CAdA,IAAAC,QAcA,CAde,IApCqD,CAAxE,CAyDIC,EAAmB7G,CAAA7B,UAAnB0I,CAAuC1H,MAAAC,OAAA,CAAcP,CAAAV,UAAd,CAU3C0I,EAAAlI,MAAA,CAAyBmI,QAAQ,CAACC,CAAD,CAAU,CACvC,GAAI,IAAAhE,MAAJ,EAAmBgE,CAAAA,CAAnB,CACI,MAAO,KAAAhE,MAGPA,EAAAA,CAAS,QAAQ,CAAClL,CAAD,CAAWkG,CAAX,CAAc,CAqe/BiJ,QAASA,EAAQ,CAAC/D,CAAD,CAAMgE,CAAN,CAAsBC,CAAtB,CAAsCtF,CAAtC,CAAoD,CACjE,GAAY,IAAZ,GAAIqB,CAAJ,EAAmC,QAAnC,GAAoB,MAAOA,EAA3B,CAA6C,CAEzC,GAAIrB,CAAJ,EAAoBA,CAApB,WAA4C/J,EAAAkF,QAAA8F,KAA5C,CAAmE,CAC/D,IAAIpK,EAAOZ,CAAAkF,QAAA8F,KAAAsE,QAAA,CAA8BvF,CAAAwF,OAA9B,CAAmDnE,CAAnD,CACX,IAAa,IAAb,GAAIxK,CAAJ,CACI,MAAOA,EAHoD,CAMnE,MAAOwK,EARkC,CAW7C,GAAItL,CAAA+K,aAAA,CAAwBO,CAAxB,CAAJ,CACI,MAAOgE,EAAA,CAAiBhE,CAAAoE,SAAA,EAAjB,CAAkCpE,CAAAqE,SAAA,EAE7C,IAAIzP,CAAAC,KAAAyP,OAAA,CAAqBtE,CAArB,CAAJ,CACI,MAAOiE,EAAA,CAAiBjE,CAAA1E,SAAA,EAAjB,CAAkC1G,CAAAC,KAAA0P,UAAA,CAAwBvE,CAAxB,CAC7C;IAAI+C,CAEJ,IAAIyB,KAAAC,QAAA,CAAczE,CAAd,CAAJ,CAKI,MAJA+C,EAIOA,CAJC,EAIDA,CAHP/C,CAAA0E,QAAA,CAAY,QAAQ,CAACC,CAAD,CAAInI,CAAJ,CAAO,CACvBuG,CAAA,CAAMvG,CAAN,CAAA,CAAWuH,CAAA,CAASY,CAAT,CAAYX,CAAZ,CAA4BC,CAA5B,CAA4CtF,CAA5C,CADY,CAA3B,CAGOoE,CAAAA,CAEXA,EAAA,CAAQ,EAER,IAAI/C,CAAJ,WAAmBpL,EAAAgQ,IAAnB,CAAiC,CAE7B,IADIC,IAAAA,EAAK7E,CAAA8E,QAAA,EAALD,CACK9N,EAAI8N,CAAAE,KAAA,EAAb,CAAyBC,CAAAjO,CAAAiO,KAAzB,CAAiCjO,CAAjC,CAAqC8N,CAAAE,KAAA,EAArC,CACIhC,CAAA,CAAM/C,CAAAiF,QAAA5B,cAAA,CAA0BtM,CAAAiD,MAAA,CAAQ,CAAR,CAA1B,CAAN,CAAA,CAA+C+J,CAAA,CAAShN,CAAAiD,MAAA,CAAQ,CAAR,CAAT,CAAqBgK,CAArB,CAAqCC,CAArC,CAAqDjE,CAAAkF,UAAAvG,aAArD,CACnD,OAAOoE,EAJsB,CAO7BzG,IAAAA,EAAO0D,CAAAmF,MAAP7I,CACA8I,EAAQxP,IAAAA,EADR0G,CAEKzF,CAAT,KAASA,CAAT,GAAcmJ,EAAd,CACQA,CAAAC,eAAA,CAAmBpJ,CAAnB,CAAJ,GACQyF,CAAJ,GAAa8I,CAAb,CAAqB9I,CAAAQ,SAAA,CAAcjG,CAAd,CAArB,EACIkM,CAAA,CAAMlM,CAAN,CADJ,CACekN,CAAA,CAAS/D,CAAA,CAAInJ,CAAJ,CAAT,CAAiBmN,CAAjB,CAAiCC,CAAjC,CAAiDmB,CAAAzG,aAAjD,CADf,CAGIoE,CAAA,CAAMlM,CAAN,CAHJ,CAGekN,CAAA,CAAS/D,CAAA,CAAInJ,CAAJ,CAAT,CAAiBmN,CAAjB,CAAiCC,CAAjC,CAJnB,CAMJ,OAAOlB,EA5C0D,CAretC,IAE3BsC,EAASvK,CAAAsB,YAAA,CAAcxH,CAAAkF,QAAAiD,QAAAC,MAAd,CAFkB,CAG3BsI,EAASxK,CAAAsB,YAAA,CAAcxH,CAAAkF,QAAAiD,QAAAwI,MAAd,CAHkB,CAc3BxI,EAAUA,QAAQ,CAAC4C,CAAD,CAAS6F,CAAT,CAAmB,CACrC5Q,CAAAmL,QAAAhD,QAAAhB,KAAA,CAA8B,IAA9B,CAGA;IAJqC,IAI5BlF,EAAE,CAJ0B,CAIvB2F,EAAE8I,CAAAxO,OAAhB,CAA+BD,CAA/B,CAAiC2F,CAAjC,CAAoC,EAAE3F,CAAtC,CACI,IAAA,CAAKyO,CAAA,CAAOzO,CAAP,CAAArB,KAAL,CAAA,CAAuB,IAEtBqB,EAAA,CAAE,CAAP,KAAU2F,CAAV,CAAY6I,CAAAvO,OAAZ,CAA2BD,CAA3B,CAA6B2F,CAA7B,CAAgC,EAAE3F,CAAlC,CAAqC,CACjC,IAAIuO,EAAQC,CAAA,CAAOxO,CAAP,CACZ,KAAA,CAAKuO,CAAA5P,KAAL,CAAA,CACI4P,CAAAK,SAAA,CAAiB,EAAjB,CACCL,CAAAM,IAAA,CAAY,IAAI9Q,CAAAgQ,IAAJ,CAAiBQ,CAAjB,CAAZ,CAAsC,IACtCO,EAAAP,CAAAO,SAAL,EAAoC,QAApC,GAAuB7K,CAAAgB,OAAvB,EAC2B,IAD3B,GACIsJ,CAAA1P,aADJ,GAEI,IAAA,CAAK0P,CAAA5P,KAAL,CAFJ,CAEuB4P,CAAA1P,aAFvB,CALiC,CAUrC,GAAuB,CAAvB,CAAIkQ,SAAA9O,OAAJ,CAGI,GAAyB,CAAzB,GAAI8O,SAAA9O,OAAJ,EAAyC,IAAzC,GAA8B6I,CAA9B,EAAmE,QAAnE,GAAiD,MAAOA,EAAxD,EACiC,EAAyB,UAAzB,GAAA,MAAOA,EAAAoC,OAAP,EAAuCpC,CAAvC,WAAyD5C,EAAzD,CADjC,EAEgCyH,KAAAC,QAAA,CAAc9E,CAAd,CAFhC,EAGsBA,CAHtB,WAGwC/K,EAAAgQ,IAHxC,EAI4BlQ,CAAA+K,aAAA,CAAwBE,CAAxB,CAJ5B,EAK+BA,CAL/B,WAKiDkG,YALjD,EAMuBjR,CAAAC,KANvB,EAMwC8K,CANxC,WAM0D/K,EAAAC,KAN1D,CASI,IAAKgC,CAAK,CAAH,CAAG,CAAA2F,CAAA,CAAEoJ,SAAA9O,OAAZ,CAA8BD,CAA9B,CAAgC2F,CAAhC,CAAmC,EAAE3F,CAArC,CAC0C,WAAtC;AAAI,OAAQmD,CAAR,CAAgB4L,SAAA,CAAU/O,CAAV,CAAhB,CAAJ,EACI,IAAAiP,KAAA,CAAUT,CAAA,CAAOxO,CAAP,CAAArB,KAAV,CAA0BwE,CAA1B,CAXZ,KAOI,KAAA8L,KAAA,CAAUnG,CAAV,CA3B6B,CAdV,CAqD3BiE,EAAmB7G,CAAA7B,UAAnB0I,CAAuC1H,MAAAC,OAAA,CAAcvH,CAAAmL,QAAAhD,QAAA7B,UAAd,CAa3C0I,EAAAmC,IAAA,CAAuBC,QAAQ,CAAC5I,CAAD,CAAMpD,CAAN,CAAaiM,CAAb,CAAuB,CAClD,IAAIb,EAAQtK,CAAA2I,cAAA,CAAgBrG,CAAhB,CACZ,IAAK6I,CAAAA,CAAL,CAAe,CACX,GAAKb,CAAAA,CAAL,CACI,KAAMpO,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeoG,CAAf,CAAmB,eAAnB,CAAN,CACJ,GAAM,EAAAgI,CAAA,WAAiBxQ,EAAAkF,QAAAiD,QAAAC,MAAjB,CAAN,CACI,KAAMhG,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeoG,CAAf,CAAmB,mBAAnB,CAAuCgI,CAAA9J,SAAA,CAAe,CAAA,CAAf,CAAvC,CAAN,CACJ,GAAKmK,CAAAL,CAAAK,SAAL,CACI,KAAMzO,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeoG,CAAf,CAAmB,0BAAnB,CAAN,CACJpD,CAAA,CAAQoL,CAAAlG,YAAA,CAAkBlF,CAAlB,CAAyB,CAAA,CAAzB,CAPG,CASG,IAAlB,GAAI,IAAA,CAAKoD,CAAL,CAAJ,GACI,IAAA,CAAKA,CAAL,CADJ,CACgB,EADhB,CAEA,KAAA,CAAKA,CAAL,CAAAX,KAAA,CAAezC,CAAf,CACA,OAAO,KAd2C,CA4BtD4J,EAAAsC,KAAA,CAAwBtC,CAAAmC,IAaxBnC,EAAAuC,IAAA,CAAuBC,QAAQ,CAACC,CAAD;AAAWrM,CAAX,CAAkBiM,CAAlB,CAA4B,CACvD,GAAII,CAAJ,EAAoC,QAApC,GAAgB,MAAOA,EAAvB,CAA8C,CAC1CJ,CAAA,CAAWjM,CACX,KAAKsM,IAAIA,CAAT,GAAiBD,EAAjB,CAEQA,CAAApG,eAAA,CAAwBqG,CAAxB,CAAJ,EAAyE,WAAzE,GAAqC,OAAQtM,CAAR,CAAgBqM,CAAA,CAASC,CAAT,CAAhB,CAArC,EAAkH1Q,IAAAA,EAAlH,GAAwFkF,CAAAyL,cAAA,CAAgBD,CAAhB,CAAxF,EACI,IAAAR,KAAA,CAAUQ,CAAV,CAAgBtM,CAAhB,CAAuBiM,CAAvB,CAER,OAAO,KAPmC,CAS1Cb,CAAAA,CAAQtK,CAAA2I,cAAA,CAAgB4C,CAAhB,CACZ,IAAKJ,CAAL,CAOI,IAAA,CAAKI,CAAL,CAAA,CAAiBrM,CAPrB,KAAe,CACX,GAAKoL,CAAAA,CAAL,CACI,KAAMpO,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeqP,CAAf,CAAwB,4BAAxB,CAAN,CACJ,GAAM,EAAAjB,CAAA,WAAiBxQ,EAAAkF,QAAAiD,QAAAC,MAAjB,CAAN,CACI,KAAMhG,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeqP,CAAf,CAAwB,mBAAxB,CAA4CjB,CAAA9J,SAAA,CAAe,CAAA,CAAf,CAA5C,CAAN,CACJ,IAAA,CAAK8J,CAAA5P,KAAL,CAAA,CAAoBwE,CAApB,CAA4BoL,CAAAlG,YAAA,CAAkBlF,CAAlB,CALjB,CAQXoL,CAAJ,EAAaA,CAAAoB,MAAb,GACQC,CACJ,CADmB,IAAA,CAAKrB,CAAAoB,MAAAhR,KAAL,CACnB,CAAc,IAAd,GAAIwE,CAAJ,EACyB,IAErB,GAFIyM,CAEJ,EAF6BA,CAE7B,GAF8CrB,CAAA5P,KAE9C,GADI,IAAA,CAAKiR,CAAL,CACJ,CADyB,IACzB,EAAA,IAAA,CAAKrB,CAAAoB,MAAAhR,KAAL,CAAA,CAAyB4P,CAAA5P,KAH7B;AAIkCiR,CAJlC,GAImDJ,CAJnD,GAKI,IAAA,CAAKjB,CAAAoB,MAAAhR,KAAL,CALJ,CAK6B,IAL7B,CAFJ,CASA,OAAO,KA5BgD,CAyC3DoO,EAAAkC,KAAA,CAAwBlC,CAAAuC,IAYxBvC,EAAA8C,IAAA,CAAuBC,QAAQ,CAACvJ,CAAD,CAAM6I,CAAN,CAAgB,CAC3C,GAAIA,CAAJ,CACI,MAAO,KAAA,CAAK7I,CAAL,CACX,KAAIgI,EAAQtK,CAAA2I,cAAA,CAAgBrG,CAAhB,CACZ,IAAI,EAACgI,CAAD,EAAYA,CAAZ,WAA6BxQ,EAAAkF,QAAAiD,QAAAC,MAA7B,CAAJ,CACI,KAAMhG,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeoG,CAAf,CAAmB,4BAAnB,CAAN,CACJ,GAAM,EAAAgI,CAAA,WAAiBxQ,EAAAkF,QAAAiD,QAAAC,MAAjB,CAAN,CACI,KAAMhG,MAAA,CAAM,IAAN,CAAW,GAAX,CAAeoG,CAAf,CAAmB,mBAAnB,CAAuCgI,CAAA9J,SAAA,CAAe,CAAA,CAAf,CAAvC,CAAN,CACJ,MAAO,KAAA,CAAK8J,CAAA5P,KAAL,CARoC,CAoB/CoO,EAAAgD,KAAA,CAAwBhD,CAAA8C,IAIxB,KAAK,IAAI7P,EAAE,CAAX,CAAcA,CAAd,CAAgBwO,CAAAvO,OAAhB,CAA+BD,CAAA,EAA/B,CAAoC,CAChC,IAAIuO,EAAQC,CAAA,CAAOxO,CAAP,CAERuO,EAAJ,WAAqBxQ,EAAAkF,QAAAiD,QAAA8J,eAArB,EAGI/L,CAAAC,QAAAc,QAAA,kBAHJ,EAIK,QAAQ,CAACuJ,CAAD,CAAQ,CAEb,IAAI0B;AAAO1B,CAAAnI,aAAA3E,QAAA,CAA2B,cAA3B,CAA2C,QAAQ,CAACyO,CAAD,CAAQ,CAClE,MAAOA,EAAAtO,YAAA,EAAAH,QAAA,CAA4B,GAA5B,CAAgC,EAAhC,CAD2D,CAA3D,CAAX,CAGAwO,EAAOA,CAAAE,UAAA,CAAe,CAAf,CAAiB,CAAjB,CAAAvO,YAAA,EAAPqO,CAA2CA,CAAAE,UAAA,CAAe,CAAf,CAH3C,CAMIxR,EAAO4P,CAAAnI,aAAA3E,QAAA,CAA2B,UAA3B,CAAuC,QAAQ,CAACyO,CAAD,CAAQ,CAC9D,MAAO,GAAP,CAAWA,CADmD,CAAvD,CANX,CAkBIE,EAASA,QAAQ,CAACjN,CAAD,CAAQiM,CAAR,CAAkB,CACnC,IAAA,CAAKb,CAAA5P,KAAL,CAAA,CAAmByQ,CAAA,CAAWjM,CAAX,CAAmBoL,CAAAlG,YAAA,CAAkBlF,CAAlB,CACtC,OAAO,KAF4B,CAlBvC,CA6BIkN,EAASA,QAAQ,EAAG,CACpB,MAAO,KAAA,CAAK9B,CAAA5P,KAAL,CADa,CAIO,KAA/B,GAAIsF,CAAAgC,SAAA,CAAW,KAAX,CAAiBgK,CAAjB,CAAJ,GAYIlD,CAAA,CAAiB,KAAjB,CAAuBkD,CAAvB,CAZJ,CAYmCG,CAZnC,CAcgC,KAAhC,GAAInM,CAAAgC,SAAA,CAAW,MAAX,CAAkBtH,CAAlB,CAAJ,GAYIoO,CAAA,CAAiB,MAAjB,CAAwBpO,CAAxB,CAZJ,CAYoCyR,CAZpC,CAc+B,KAA/B,GAAInM,CAAAgC,SAAA,CAAW,KAAX,CAAiBgK,CAAjB,CAAJ,GASIlD,CAAA,CAAiB,KAAjB,CAAuBkD,CAAvB,CATJ,CASmCI,CATnC,CAWgC,KAAhC,GAAIpM,CAAAgC,SAAA,CAAW,MAAX,CAAkBtH,CAAlB,CAAJ,GASIoO,CAAA,CAAiB,MAAjB,CAAwBpO,CAAxB,CATJ,CASoC0R,CATpC,CA1Ea,CAAjB,CAqFG9B,CArFH,CAP4B,CA+GpCxB,CAAA7B,OAAA,CAA0BoF,QAAQ,CAACrG,CAAD,CAASsG,CAAT,CAAmB,CAC3B,SAAtB;AAAI,MAAOtG,EAAX,GACIsG,CACA,CADWtG,CACX,CAAAA,CAAA,CAASlL,IAAAA,EAFb,CAGA,KAAIyR,EAAQ,CAAA,CACPvG,EAAL,GACIA,CACA,CADS,IAAIpM,CACb,CAAA2S,CAAA,CAAQ,CAAA,CAFZ,CAGA,KAAIC,EAAKxG,CAAAyG,aACT,IAAI,CAEA,MADAzM,EAAAiH,OAAA,CAAS,IAAT,CAAejB,CAAAgB,GAAA,EAAf,CAA4BsF,CAA5B,CACO,CAAAtF,CAACuF,CAAA,CAAQvG,CAAAkB,KAAA,EAAR,CAAwBlB,CAAzBgB,IAAA,CAAoCwF,CAApC,CAFP,CAGF,MAAOvQ,CAAP,CAAU,CAER,KADA+J,EAAAgB,GAAA,CAAUwF,CAAV,CACMvQ,CAAAA,CAAN,CAFQ,CAZqC,CA0BrDgG,EAAAgF,OAAA,CAAiByF,QAAQ,CAAChQ,CAAD,CAAOsJ,CAAP,CAAesG,CAAf,CAAyB,CAC9C,MAAOrF,CAAA,IAAIhF,CAAJ,CAAYvF,CAAZ,CAAAuK,QAAA,CAAyBjB,CAAzB,CAAiCsG,CAAjC,CADuC,CAYlDxD,EAAAjD,UAAA,CAA6B8G,QAAQ,EAAG,CACpC,MAAO3M,EAAA6F,UAAA,CAAY,IAAZ,CAD6B,CAexCiD,EAAA8D,gBAAA,CAAmCC,QAAQ,CAAC7G,CAAD,CAASsG,CAAT,CAAmB,CAC1D,IAAIC,EAAQ,CAAA,CACPvG,EAAL,GACIA,CACA,CADS,IAAIpM,CACb,CAAA2S,CAAA,CAAQ,CAAA,CAFZ,CAGA,KAAIO,EAAM9F,CAAA,IAAIpN,CAAJoN,IAAA,EACVhH,EAAAiH,OAAA,CAAS,IAAT,CAAe6F,CAAf,CAAoBR,CAApB,CAAApF,KAAA,EACAlB,EAAAE,cAAA,CAAqB4G,CAAAlH,UAAA,EAArB,CACAI,EAAAc,OAAA,CAAcgG,CAAd,CACA,OAAOP,EAAA,CAAQvG,CAAAkB,KAAA,EAAR,CAAwBlB,CAT2B,CAqB9D8C,EAAAiE,SAAA,CAA4BC,QAAQ,EAAG,CACnC,GAAI,CACA,MAAO,KAAA/F,OAAA,EAAAgG,cAAA,EADP,CAEF,MAAOhR,CAAP,CAAU,CAER,KADIA,EAAA,QACEA;CADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAgR,cAAA,EAC3BhR,EAAAA,CAAN,CAFQ,CAHuB,CAkBvC6M,EAAAmE,cAAA,CAAiCnE,CAAAiE,SAWjCjE,EAAAoE,SAAA,CAA4BC,QAAQ,EAAG,CACnC,GAAI,CACA,MAAO,KAAAlG,OAAA,EAAAsC,SAAA,EADP,CAEF,MAAOtN,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAsN,SAAA,EAC3BtN,EAAAA,CAAN,CAFQ,CAHuB,CAkBvC6M,EAAAS,SAAA,CAA4BT,CAAAoE,SAW5BpE,EAAAsE,SAAA,CAA4BC,QAAQ,EAAG,CACnC,GAAI,CACA,MAAO,KAAApG,OAAA,EAAAqC,SAAA,EADP,CAEF,MAAOrN,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAqN,SAAA,EAC3BrN,EAAAA,CAAN,CAFQ,CAHuB,CAkBvC6M,EAAAQ,SAAA,CAA4BR,CAAAsE,SAW5BtE,EAAAwE,UAAA,CAA6BC,QAAQ,EAAG,CACpC,GAAI,CACA,MAAO,KAAAtG,OAAA,EAAAuG,MAAA,EADP,CAEF,MAAOvR,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAuR,MAAA,EAC3BvR,EAAAA,CAAN,CAFQ,CAHwB,CAkBxC6M,EAAA0E,MAAA,CAAyB1E,CAAAwE,UAiEzBxE,EAAA2E,MAAA;AAAyBC,QAAQ,CAACxE,CAAD,CAAiBC,CAAjB,CAAiC,CAC9D,MAAOF,EAAA,CAAS,IAAT,CAAe,CAAEC,CAAAA,CAAjB,CAAiC,CAAEC,CAAAA,CAAnC,CAAmD,IAAAkB,MAAnD,CADuD,CASlEvB,EAAA6E,WAAA,CAA8BC,QAAQ,EAAG,CACrC,MAAOC,KAAAC,UAAA,CACH7E,CAAA,CAAS,IAAT,CAC4B,CAAA,CAD5B,CAE4B,CAAA,CAF5B,CAGK,IAAAoB,MAHL,CADG,CAD8B,CAwBzCpI,EAAAkF,OAAA,CAAiB4G,QAAQ,CAAC/H,CAAD,CAAShK,CAAT,CAAiB8Q,CAAjB,CAAsB,CACrB,QAAtB,GAAI,MAAO9Q,EAAX,GACI8Q,CACA,CADM9Q,CACN,CAAAA,CAAA,CAAU,EAFd,CAGsB,SAAtB,GAAI,MAAOgK,EAAX,CACIA,CADJ,CACapM,CAAAgL,KAAA,CAAgBoB,CAAhB,CAAwB8G,CAAA,CAAMA,CAAN,CAAY,QAApC,CADb,CAEUlT,CAAA+K,aAAA,CAAwBqB,CAAxB,CAFV,GAGIA,CAHJ,CAGapM,CAAAgL,KAAA,CAAgBoB,CAAhB,CAHb,CAIIwG,EAAAA,CAAKxG,CAAAyG,aACT,IAAI,CACA,IAAIlI,EAAMvE,CAAAmH,OAAA,CAASnB,CAAAgB,GAAA,EAAT,CAAsBhL,CAAtB,CACVgK,EAAAgB,GAAA,CAAUwF,CAAV,CACA,OAAOjI,EAHP,CAIF,MAAOtI,CAAP,CAAU,CAER,KADA+J,EAAAgB,GAAA,CAAUwF,CAAV,CACMvQ,CAAAA,CAAN,CAFQ,CAb+B,CA8B/CgG,EAAA+L,gBAAA,CAA0BC,QAAQ,CAACjI,CAAD,CAAS8G,CAAT,CAAc,CACtB,QAAtB,GAAI,MAAO9G,EAAX,CACIA,CADJ,CACapM,CAAAgL,KAAA,CAAgBoB,CAAhB,CAAwB8G,CAAA,CAAMA,CAAN,CAAY,QAApC,CADb,CAEUlT,CAAA+K,aAAA,CAAwBqB,CAAxB,CAFV,GAGIA,CAHJ,CAGapM,CAAAgL,KAAA,CAAgBoB,CAAhB,CAHb,CAIA,IAAyB,CAAzB,CAAIA,CAAAJ,UAAA,EAAJ,CACI,MAAO,KANiC,KAOxCsI,EAAMlI,CAAAjG,OAPkC;AAQxCiD,EAAMgD,CAAApG,aAAA,EACV,IAAIoG,CAAAJ,UAAA,EAAJ,CAAyB5C,CAAzB,CAEI,MADAgD,EAAAjG,OACO,CADSmO,CACT,CAAA,IAEX,IAAI,CACA,IAAI3J,EAAMvE,CAAAmH,OAAA,CAASnB,CAAAvE,MAAA,CAAauE,CAAAjG,OAAb,CAA4BiG,CAAAjG,OAA5B,CAA4CiD,CAA5C,CAAAgE,GAAA,EAAT,CACVhB,EAAAjG,OAAA,EAAiBiD,CACjB,OAAOuB,EAHP,CAIF,MAAO9H,CAAP,CAAY,CAEV,KADAuJ,EAAAjG,OACMtD,EADWuG,CACXvG,CAAAA,CAAN,CAFU,CAjB8B,CAiChDwF,EAAAkM,SAAA,CAAmBC,QAAQ,CAAC7Q,CAAD,CAAM,CAC7B,MAAO0E,EAAAkF,OAAA,CAAe5J,CAAf,CAAoB,QAApB,CADsB,CAcjC0E,EAAAoM,UAAA,CAAoBC,QAAQ,CAAC/Q,CAAD,CAAM,CAC9B,MAAO0E,EAAAkF,OAAA,CAAe5J,CAAf,CAAoB,KAApB,CADuB,CAclC0E,EAAAsM,WAAA,CAAqBC,QAAQ,CAACjR,CAAD,CAAM,CAC/B,MAAO,KAAI0E,CAAJ,CAAY4L,IAAAY,MAAA,CAAWlR,CAAX,CAAZ,CADwB,CAanCuL,EAAAtI,SAAA,CAA4BkO,QAAQ,EAAG,CACnC,MAAO1O,EAAAQ,SAAA,EAD4B,CAsCnCY,OAAAgC,eAAJ,GACIhC,MAAAgC,eAAA,CAAsBnB,CAAtB,CAA+B,UAA/B,CAA2C,CAAE,MAASjC,CAAAqD,SAAA,EAAX,CAA3C,CAGA,CAFAjC,MAAAgC,eAAA,CAAsB0F,CAAtB,CAAwC,UAAxC,CAAoD,CAAE,MAAS7G,CAAA,SAAX,CAApD,CAEA;AADAb,MAAAgC,eAAA,CAAsBnB,CAAtB,CAA+B,OAA/B,CAAwC,CAAE,MAASjC,CAAX,CAAxC,CACA,CAAAoB,MAAAgC,eAAA,CAAsB0F,CAAtB,CAAwC,OAAxC,CAAiD,CAAE,MAAS9I,CAAX,CAAjD,CAJJ,CAMA,OAAOiC,EAhtBwB,CAAvB,CAktBTnI,CAltBS,CAktBC,IAltBD,CAqtBZ,KAAA+O,QAAA,CAAe,EACf,KAAAD,YAAA,CAAmB,EACnB,KAAAD,cAAA,CAAqB,EACrB,KAAA8C,cAAA,CAAqB,EACrB,KA9tBuC,IA8tB9B1P,EAAE,CA9tB4B,CA8tBzB2F,EAAE,IAAAR,SAAAlF,OA9tBuB,CA8tBD8F,CAAtC,CAA6C/F,CAA7C,CAA+C2F,CAA/C,CAAkD3F,CAAA,EAAlD,CAEI,GADA+F,CACI,CADI,IAAAZ,SAAA,CAAcnF,CAAd,CACJ,CAAA+F,CAAA,WAAiBgD,EAAjB,EAAyBhD,CAAzB,WAA0CG,EAA1C,EAAqDH,CAArD,WAAsE6M,EAA1E,CAAmF,CAC/E,GAAI3J,CAAAG,eAAA,CAAqBrD,CAAApH,KAArB,CAAJ,CACI,KAAMwB,MAAA,CAAM,2BAAN,CAAkC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAlC,CAAsD,IAAtD,CAA2DsB,CAAAtB,SAAA,CAAe,CAAA,CAAf,CAA3D,CAAgF,oCAAhF,CAAqHsB,CAAApH,KAArH,CAAgI,GAAhI,CAAN,CACJsK,CAAA,CAAMlD,CAAApH,KAAN,CAAA,CAAoBoH,CAAAlB,MAAA,EAH2D,CAAnF,IAIO,IAAIkB,CAAJ,WAAqBG,EAAAC,MAArB,CACHJ,CAAAlB,MAAA,EAGA;AAFA,IAAAiI,QAAAlH,KAAA,CAAkBG,CAAlB,CAEA,CADA,IAAA8G,YAAA,CAAiB9G,CAAAjC,GAAjB,CACA,CAD6BiC,CAC7B,CAAA,IAAA6G,cAAA,CAAmB7G,CAAApH,KAAnB,CAAA,CAAiCoH,CAJ9B,KAKF,IAAIA,CAAJ,WAAqBG,EAAAwI,MAArB,CACD,IAAAgB,cAAA,CAAmB3J,CAAApH,KAAnB,CAAA,CAAiCoH,CADhC,KAGA,IAAI,EAAEA,CAAF,WAAmBG,EAAAwI,MAAnB,EAAuC3I,CAAvC,WAAwD8M,EAAxD,CAAJ,CACD,KAAM1S,MAAA,CAAM,2BAAN,CAAkC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAlC,CAAsD,IAAtD,CAA2D,IAAAU,SAAA,CAAcnF,CAAd,CAAAyE,SAAA,CAA0B,CAAA,CAA1B,CAA3D,CAAN,CAGR,MAAO,KAAAwE,MAAP,CAAoBA,CAhvBmB,CA4vB3C8D,EAAA7B,OAAA,CAA0BoF,QAAQ,CAAC5H,CAAD,CAAUuB,CAAV,CAAkBsG,CAAlB,CAA4B,CAG1D,IAH0D,IACtDuC,EAAe,IADuC,CAEtDvE,CAFsD,CAGjDvO,EAAE,CAH+C,CAG5C2F,EAAE,IAAAmH,QAAA7M,OAH0C,CAGrByH,CAArC,CAA0C1H,CAA1C,CAA4C2F,CAA5C,CAA+C,EAAE3F,CAAjD,CACIuO,CAEA,CAFQ,IAAAzB,QAAA,CAAa9M,CAAb,CAER,CADA0H,CACA,CADMgB,CAAA,CAAQ6F,CAAA5P,KAAR,CACN,CAAI4P,CAAAO,SAAJ,EAA8B,IAA9B,GAAsBpH,CAAtB,CACyB,IADzB,GACQoL,CADR,GAEQA,CAFR,CAEuBvE,CAFvB,EAIIA,CAAArD,OAAA,CAAaqF,CAAA,CAAW7I,CAAX,CAAiB6G,CAAAlG,YAAA,CAAkBX,CAAlB,CAA9B,CAAsDuC,CAAtD,CAA8DvB,CAA9D,CAER,IAAqB,IAArB,GAAIoK,CAAJ,CAGI,KAFIpS,EAEEA,CAFIP,KAAA,CAAM,0CAAN;AAAiD,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAjD,CAAqE,IAArE,CAA0EqO,CAA1E,CAEJpS,CADNA,CAAA,QACMA,CADWuJ,CACXvJ,CAAAA,CAAN,CAEJ,MAAOuJ,EAjBmD,CA2B9D8C,EAAAjD,UAAA,CAA6B8G,QAAQ,CAAClI,CAAD,CAAU,CAC3C,IAD2C,IAClCa,EAAE,CADgC,CAC7BvJ,EAAE,CAD2B,CACxB2F,EAAE,IAAAmH,QAAA7M,OADsB,CACDsO,CADC,CACM7G,CAAjD,CAAsD1H,CAAtD,CAAwD2F,CAAxD,CAA2D,EAAE3F,CAA7D,CAAgE,CAC5DuO,CAAA,CAAQ,IAAAzB,QAAA,CAAa9M,CAAb,CACR0H,EAAA,CAAMgB,CAAA,CAAQ6F,CAAA5P,KAAR,CACN,IAAI4P,CAAAO,SAAJ,EAA8B,IAA9B,GAAsBpH,CAAtB,CACG,KAAMvH,MAAA,CAAM,0CAAN,CAAiD,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAjD,CAAqE,IAArE,CAA0E8J,CAA1E,CAAN,CAEChF,CAAA,EAAKgF,CAAAzE,UAAA,CAAgBpC,CAAhB,CAAqBgB,CAArB,CANmD,CAQhE,MAAOa,EAToC,CA8D/CwD,EAAA3B,OAAA,CAA0B2H,QAAQ,CAAC9I,CAAD,CAAShK,CAAT,CAAiB+S,CAAjB,CAAqC,CAC7C,QAAtB,GAAI,MAAO/S,EAAX,GACIA,CADJ,CACc,EADd,CAKA,KANmE,IAG/DgT,EAAQhJ,CAAAjG,OAHuD,CAI/DwE,EAAM,IAAK,IAAAS,MAJoD,CAK/DrF,CAL+D,CAK1DhF,CAL0D,CAKhDkF,CACnB,CAAOmG,CAAAjG,OAAP,CAAuBiP,CAAvB,CAA6BhT,CAA7B,EAAoD,EAApD,GAAwCA,CAAxC,EAA8E,CAA9E,CAAyDgK,CAAAJ,UAAA,EAAzD,CAAA,CAAkF,CAC9EjG,CAAA,CAAMqG,CAAApG,aAAA,EACNjF,EAAA,CAAWgF,CAAX,CAAiB,CACjBE,EAAA,CAAKF,CAAL,GAAa,CACb,IAAIhF,CAAJ,GAAiBb,CAAAG,WAAAK,SAAjB,CAA+C,CAC3C,GAAIuF,CAAJ,GAAWkP,CAAX,CACI,KAAM7S,MAAA,CAAM,kCAAN;AAAyC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAzC,CAA6D,IAA7D,CAAkEX,CAAlE,CAAqE,IAArE,EAA2EkP,CAAA,CAAqBA,CAArB,CAAwC,WAAxC,CAAsD,aAAjI,EAAgJ,GAAhJ,CAAN,CACJ,KAH2C,CAK/C,GAAMzE,CAAN,CAAc,IAAA1B,YAAA,CAAiB/I,CAAjB,CAAd,CAwBIyK,CAAAK,SAAJ,EAAuB,CAAAL,CAAAvJ,QAAA,OAAvB,CACIwD,CAAA,CAAI+F,CAAA5P,KAAJ,CAAAiH,KAAA,CAAqB2I,CAAAnD,OAAA,CAAaxM,CAAb,CAAuBqL,CAAvB,CAArB,CADJ,CAEWsE,CAAAM,IAAJ,EACCqE,CACJ,CADa3E,CAAAnD,OAAA,CAAaxM,CAAb,CAAuBqL,CAAvB,CACb,CAAAzB,CAAA,CAAI+F,CAAA5P,KAAJ,CAAA2Q,IAAA,CAAoB4D,CAAA,CAAO,CAAP,CAApB,CAA+BA,CAAA,CAAO,CAAP,CAA/B,CAFG,GAIH1K,CAAA,CAAI+F,CAAA5P,KAAJ,CACA,CADkB4P,CAAAnD,OAAA,CAAaxM,CAAb,CAAuBqL,CAAvB,CAClB,CAAIsE,CAAAoB,MAAJ,GACQC,CAGJ,CAHmBpH,CAAA,CAAI+F,CAAAoB,MAAAhR,KAAJ,CAGnB,CAFqB,IAErB,GAFIiR,CAEJ,EAF6BA,CAE7B,GAF8CrB,CAAA5P,KAE9C,GADI6J,CAAA,CAAIoH,CAAJ,CACJ,CADwB,IACxB,EAAApH,CAAA,CAAI+F,CAAAoB,MAAAhR,KAAJ,CAAA,CAAwB4P,CAAA5P,KAJ5B,CALG,CA1BP,KAEI,QAAQC,CAAR,EACI,KAAKb,CAAAG,WAAAC,OAAL,CACI8L,CAAApG,aAAA,EACA,MACJ,MAAK9F,CAAAG,WAAAM,OAAL,CACIyL,CAAAjG,OAAA,EAAiB,CACjB,MACJ,MAAKjG,CAAAG,WAAAE,OAAL,CACI6L,CAAAjG,OAAA,EAAiB,CACjB,MACJ,MAAKjG,CAAAG,WAAAG,OAAL,CACQ4I,CAAAA,CAAMgD,CAAApG,aAAA,EACVoG;CAAAjG,OAAA,EAAiBiD,CACjB,MACJ,MAAKlJ,CAAAG,WAAAI,WAAL,CACI,IAAA,CAAOmF,CAAA,CAAiBK,CAAjB,CAAqBmG,CAArB,CAAP,CAAA,EACA,KACJ,SACI,KAAM9J,MAAA,CAAM,sCAAN,CAA6C2D,CAA7C,CAAgD,MAAhD,CAAuD,IAAAW,SAAA,CAAc,CAAA,CAAd,CAAvD,CAA2E,WAA3E,CAAuF7F,CAAvF,CAAN,CAlBR,CAX0E,CAkDzEoB,CAAAA,CAAE,CAAX,KAAc2F,CAAd,CAAgB,IAAAmH,QAAA7M,OAAhB,CAAqCD,CAArC,CAAuC2F,CAAvC,CAA0C,EAAE3F,CAA5C,CAEI,GADAuO,CACI,CADI,IAAAzB,QAAA,CAAa9M,CAAb,CACJ,CAAoB,IAApB,GAAAwI,CAAA,CAAI+F,CAAA5P,KAAJ,CAAJ,CACI,GAAoB,QAApB,GAAI,IAAAsG,OAAJ,CACIuD,CAAA,CAAI+F,CAAA5P,KAAJ,CAAA,CAAkB4P,CAAA1P,aADtB,KAEO,CAAA,GAAI0P,CAAAO,SAAJ,CAGH,KAFIpO,EAEEA,CAFIP,KAAA,CAAM,0CAAN,CAAmD,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAnD,CAAyE,IAAzE,CAAgF8J,CAAA5P,KAAhF,CAEJ+B,CADNA,CAAA,QACMA,CADW8H,CACX9H,CAAAA,CAAN,CACO3C,CAAAuB,iBAAJ,EAAwD,IAAxD,GAAiCiP,CAAA1P,aAAjC,GACH2J,CAAA,CAAI+F,CAAA5P,KAAJ,CADG,CACe4P,CAAA1P,aADf,CAJA,CAQf,MAAO2J,EArE4D,CA4EvEvF,EAAAiD,QAAA;AAAkBA,CAkBlB,KAAIC,EAAQA,QAAQ,CAACjC,CAAD,CAAUwE,CAAV,CAAmByK,CAAnB,CAAyBC,CAAzB,CAAkC3N,CAAlC,CAAwC9G,CAAxC,CAA8CmF,CAA9C,CAAkDkB,CAAlD,CAA2D2K,CAA3D,CAAkE1K,CAAlE,CAA0E,CAC1FhB,CAAAiB,KAAA,CAAO,IAAP,CAAahB,CAAb,CAAsBwE,CAAtB,CAA+B/J,CAA/B,CAKA,KAAAiG,UAAA,CAAiB,eAOjB,KAAAkK,SAAA,CAAyB,UAAzB,GAAgBqE,CAOhB,KAAAvE,SAAA,CAAyB,UAAzB,GAAgBuE,CAOhB,KAAAtE,IAAA,CAAoB,KAApB,GAAWsE,CAQX,KAAAE,QAAA,CAAeD,CAAf,EAA0B,IAQ1B,KAAA3N,KAAA,CAAYA,CAOZ,KAAAqC,aAAA,CAAoB,IAOpB,KAAAhE,GAAA,CAAUA,CAQV,KAAAkB,QAAA,CAAeA,CAAf,EAA0B,EAO1B,KAAAnG,aAAA,CAAoB,IAOpB,KAAA8Q,MAAA,CAAaA,CAAb,EAAsB,IAOtB,KAAA1K,OAAA,CAAcA,CAAd,EAAwB,QAOxB,KAAAmB,aAAA,CAAoB,IAAAzH,KAepB,KAAA2U,WAAA,CARA,IAAAC,QAQA,CARe,IAWX,EAAA,IAAArP,QAAAc,QAAA,yBAAJ,EAA0D,IAA1D,WAA0EkB,EAAA8J,eAA1E,GACI,IAAArR,KADJ,CACgBZ,CAAAwB,KAAA+B,YAAA,CAA0B,IAAA3C,KAA1B,CADhB,CA/G0F,CAA9F;AAuHI6U,EAAiBrN,CAAA9B,UAAjBmP,CAAmCnO,MAAAC,OAAA,CAAcrB,CAAAI,UAAd,CAOvCmP,EAAA3O,MAAA,CAAuB4O,QAAQ,EAAG,CAC9B,IAAAF,QAAA,CAAe,IAAI1L,CAAJ,CAAY,IAAApC,KAAZ,CAAuB,IAAAqC,aAAvB,CAA0C,CAAA,CAA1C,CAAiD,IAAA7C,OAAjD,CAA8D,IAAAtG,KAA9D,CACX,KAAAkQ,IAAJ,GACI,IAAAyE,WADJ,CACsB,IAAIzL,CAAJ,CAAY,IAAAwL,QAAZ,CAA0BtU,IAAAA,EAA1B,CAAqC,CAAA,CAArC,CAA2C,IAAAkG,OAA3C,CAAwD,IAAAtG,KAAxD,CADtB,CAKoB,SAApB,GAAI,IAAAsG,OAAJ,EAAiC,IAAA2J,SAAjC,EAAmD,IAAAC,IAAnD,CAI4C,WAJ5C,GAIS,MAAO,KAAA7J,QAAA,CAAa,SAAb,CAJhB,GAKI,IAAAnG,aALJ,CAKwB,IAAAwJ,YAAA,CAAiB,IAAArD,QAAA,CAAa,SAAb,CAAjB,CALxB,EACI,IAAAnG,aADJ,CACwBgJ,CAAAK,kBAAA,CAA0B,IAAAzC,KAA1B,CARM,CAuBlC+N,EAAAnL,YAAA,CAA6BqL,QAAQ,CAACvQ,CAAD,CAAQwQ,CAAR,CAAsB,CAGvDpL,QAASA,EAAI,CAACb,CAAD,CAAMc,CAAN,CAAW,CACpB,KAAMrI,MAAA,CAAM,oBAAN,CAA2BsI,CAAAhE,SAAA,CAAc,CAAA,CAAd,CAA3B;AAA+C,WAA/C,CAA2DgE,CAAAhD,KAAA9G,KAA3D,CAA0E,IAA1E,CAA+E+I,CAA/E,CAAmF,IAAnF,CAAwFc,CAAxF,CAA4F,GAA5F,CAAN,CADoB,CAFxBmL,CAAA,CAAeA,CAAf,EAA+B,CAAA,CAC/B,KAAIlL,EAAO,IAIX,IAAc,IAAd,GAAItF,CAAJ,CAKI,MAJI,KAAA2L,SAIG,EAHHvG,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,UAAnB,CAGG,CAFa,QAEb,GAFH,IAAA8B,OAEG,EAFyB,IAAAQ,KAEzB,GAFuC1H,CAAAW,MAAA,QAEvC,EADH6J,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,oDAAnB,CACG,CAAA,IAEX,KAAInD,CACJ,IAAI,IAAA4O,SAAJ,EAAsB+E,CAAAA,CAAtB,CAAoC,CAC3BhG,KAAAC,QAAA,CAAczK,CAAd,CAAL,GACIA,CADJ,CACY,CAACA,CAAD,CADZ,CAEA,KAAIyQ,EAAM,EACV,KAAK5T,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACI4T,CAAAhO,KAAA,CAAS,IAAA2N,QAAAlL,YAAA,CAAyBlF,CAAA,CAAMnD,CAAN,CAAzB,CAAT,CACJ,OAAO4T,EANyB,CAQpC,GAAI,IAAA/E,IAAJ,EAAiB8E,CAAAA,CAAjB,CAA+B,CAC3B,GAAMxQ,CAAN,WAAuBpF,EAAAgQ,IAAvB,CAQI,MAAO5K,EANDA,EAAN,WAAuBkC,OAAvB,EACIkD,CAAA,CAAK,MAAOpF,EAAZ,CACK,mDADL,CAGJ;MAAO,KAAIpF,CAAAgQ,IAAJ,CAAiB,IAAjB,CAAuB5K,CAAvB,CAPgB,CAa1ByL,CAAA,IAAAA,SAAL,EAAsBjB,KAAAC,QAAA,CAAczK,CAAd,CAAtB,EACIoF,CAAA,CAAK,MAAOpF,EAAZ,CAAmB,mBAAnB,CAEJ,OAAO,KAAAoQ,QAAAlL,YAAA,CAAyBlF,CAAzB,CAtCgD,CAgD3DqQ,EAAAK,gBAAA,CAAiCC,QAAQ,CAAC3Q,CAAD,CAAQuF,CAAR,CAAiB,CACtD,GAAoB,QAApB,GAAI,IAAAzD,OAAJ,CACI,MAAkB,KAAlB,GAAQ9B,CACZ,IAAI,IAAAwM,MAAJ,EAAkBjH,CAAA,CAAQ,IAAAiH,MAAAhR,KAAR,CAAlB,GAA+C,IAAAA,KAA/C,CACI,MAAO,CAAA,CACX,QAAQ,IAAA8G,KAAR,EACI,KAAK1H,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,MAAiB,EAAjB,GAAOyE,CAEX,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,MAAqB,EAArB;AAAOyE,CAAAE,IAAP,EAAyC,CAAzC,GAA0BF,CAAAG,KAE9B,MAAKvF,CAAAW,MAAA,KAAL,CACI,MAAOyE,EAEX,MAAKpF,CAAAW,MAAA,CAAe,OAAf,CAAL,CACA,KAAKX,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI,MAAiB,EAAjB,GAAOyE,CAEX,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAsB,EAAtB,CAAOyE,CAAAlD,OAEX,MAAKlC,CAAAW,MAAA,MAAL,CACI,MAA2B,EAA3B,CAAOyE,CAAA0G,UAAA,EAEX,MAAK9L,CAAAW,MAAA,CAAe,MAAf,CAAL,CACI,MAAiB,EAAjB,GAAOyE,CAEX,MAAKpF,CAAAW,MAAA,QAAL,CACI,MAAiB,KAAjB,GAAOyE,CACX,SACI,MAAO,CAAA,CAlCf,CALsD,CAoD1DqQ,EAAAtI,OAAA,CAAwB6I,QAAQ,CAAC5Q,CAAD,CAAQ8G,CAAR,CAAgBvB,CAAhB,CAAyB,CACrD,GAAkB,IAAlB,GAAI,IAAAjD,KAAJ,EAA+C,QAA/C,GAA0B,MAAO,KAAAA,KAAjC,CACI,KAAMtF,MAAA,CAAM,gCAAN,CAAuC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAvC,CAA2D,IAA3D,CAAgE,IAAAgB,KAAhE,CAAN,CACJ,GAAc,IAAd,GAAItC,CAAJ,EAAuB,IAAAyL,SAAvB,EAAwD,CAAxD,EAAwCzL,CAAAlD,OAAxC,CACI,MAAOgK,EACX,IAAI,CACA,GAAI,IAAA2E,SAAJ,CAAmB,CACf,IAAI5O,CAGJ;GAAI,IAAAgF,QAAA,OAAJ,EAA0F,CAA1F,EAA8BjH,CAAAU,oBAAAuJ,QAAA,CAAqC,IAAAvC,KAAA7G,SAArC,CAA9B,CAA6F,CAIzFqL,CAAAE,cAAA,CAAsB,IAAArG,GAAtB,EAAiC,CAAjC,CAAsC/F,CAAAG,WAAAG,OAAtC,CACA4L,EAAA+J,eAAA,CAAsB/J,CAAAjG,OAAtB,EAAuC,CAAvC,CACA,KAAIiP,EAAQhJ,CAAAjG,OACZ,KAAKhE,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACI,IAAAuT,QAAAxJ,YAAA,CAAyB,IAAAjG,GAAzB,CAAkCX,CAAA,CAAMnD,CAAN,CAAlC,CAA4CiK,CAA5C,CARqF,KASrFhD,EAAMgD,CAAAjG,OAANiD,CAAoBgM,CATiE,CAUrFgB,EAAYpW,CAAA4L,kBAAA,CAA6BxC,CAA7B,CAChB,IAAgB,CAAhB,CAAIgN,CAAJ,CAAmB,CACf,IAAIC,EAAWjK,CAAAvE,MAAA,CAAauN,CAAb,CAAoBhJ,CAAAjG,OAApB,CAAf,CACAiP,EAAAA,CAAAA,EAASgB,CAAThB,CAAmB,CAAnBA,CACAhJ,EAAAjG,OAAA,CAAgBiP,CAChBhJ,EAAAc,OAAA,CAAcmJ,CAAd,CAJe,CAMnBjK,CAAAE,cAAA,CAAqBlD,CAArB,CAA0BgM,CAA1B,CAAgCgB,CAAhC,CAjByF,CAA7F,IAqBI,KAAKjU,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACIiK,CAAAE,cAAA,CAAsB,IAAArG,GAAtB,EAAiC,CAAjC,CAAsC,IAAA2B,KAAA7G,SAAtC,CACA,CAAA,IAAA2U,QAAAxJ,YAAA,CAAyB,IAAAjG,GAAzB,CAAkCX,CAAA,CAAMnD,CAAN,CAAlC,CAA4CiK,CAA5C,CA3BO,CAAnB,IA6BW,KAAA4E,IAAJ,CAEH1L,CAAA0K,QAAA,CAAc,QAAQ,CAACnG,CAAD;AAAMnB,CAAN,CAAW4N,CAAX,CAAc,CAE5BlU,CAAAA,CACApC,CAAA4L,kBAAA,CAA8B,CAA9B,CAAwC,IAAA4J,QAAAzU,SAAxC,CADAqB,CAEA,IAAAqT,WAAAjK,gBAAA,CAAgC,CAAhC,CAAmC9C,CAAnC,CAFAtG,CAGApC,CAAA4L,kBAAA,CAA8B,EAA9B,CAAwC,IAAAhE,KAAA7G,SAAxC,CAHAqB,CAIA,IAAAsT,QAAAlK,gBAAA,CAA6B,CAA7B,CAAgC3B,CAAhC,CAGJuC,EAAAE,cAAA,CAAsB,IAAArG,GAAtB,EAAiC,CAAjC,CAAsC/F,CAAAG,WAAAG,OAAtC,CACA4L,EAAAE,cAAA,CAAqBlK,CAArB,CAGAgK,EAAAE,cAAA,CAAsB,CAAtB,CAAgC,IAAAkJ,QAAAzU,SAAhC,CACA,KAAA0U,WAAAvJ,YAAA,CAA4B,CAA5B,CAA+BxD,CAA/B,CAAoC0D,CAApC,CACAA,EAAAE,cAAA,CAAsB,EAAtB,CAAgC,IAAA1E,KAAA7G,SAAhC,CACA,KAAA2U,QAAAxJ,YAAA,CAAyB,CAAzB,CAA4BrC,CAA5B,CAAiCuC,CAAjC,CAhBgC,CAApC,CAiBG,IAjBH,CAFG,CAqBC,IAAA4J,gBAAA,CAAqB1Q,CAArB,CAA4BuF,CAA5B,CArBD,GAsBCuB,CAAAE,cAAA,CAAsB,IAAArG,GAAtB,EAAiC,CAAjC,CAAsC,IAAA2B,KAAA7G,SAAtC,CACA,CAAA,IAAA2U,QAAAxJ,YAAA,CAAyB,IAAAjG,GAAzB,CAAkCX,CAAlC,CAAyC8G,CAAzC,CAvBD,CA9BP,CAwDF,MAAO/J,CAAP,CAAU,CACR,KAAMC,MAAA,CAAM,oBAAN;AAA2B,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDtB,CAApD,CAA0D,IAA1D,CAA+DjD,CAA/D,CAAiE,GAAjE,CAAN,CADQ,CAGZ,MAAO+J,EAhE8C,CA0EzDuJ,EAAA1J,UAAA,CAA2BsK,QAAQ,CAACjR,CAAD,CAAQuF,CAAR,CAAiB,CAChDvF,CAAA,CAAQ,IAAAkF,YAAA,CAAiBlF,CAAjB,CACR,IAAkB,IAAlB,GAAI,IAAAsC,KAAJ,EAA+C,QAA/C,GAA0B,MAAO,KAAAA,KAAjC,CACI,KAAMtF,MAAA,CAAM,gCAAN,CAAuC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAAvC,CAA2D,IAA3D,CAAgE,IAAAgB,KAAhE,CAAN,CACJ,GAAc,IAAd,GAAItC,CAAJ,EAAuB,IAAAyL,SAAvB,EAAwD,CAAxD,EAAwCzL,CAAAlD,OAAxC,CACI,MAAO,EACX,KAAIsJ,EAAI,CACR,IAAI,CACA,GAAI,IAAAqF,SAAJ,CAAmB,CAAA,IACX5O,CADW,CACRqU,CACP,IAAI,IAAArP,QAAA,OAAJ,EAA0F,CAA1F,EAA8BjH,CAAAU,oBAAAuJ,QAAA,CAAqC,IAAAvC,KAAA7G,SAArC,CAA9B,CAA6F,CACzF2K,CAAA,EAAK1L,CAAA4L,kBAAA,CAA8B,IAAA3F,GAA9B,EAAyC,CAAzC,CAA8C/F,CAAAG,WAAAG,OAA9C,CAEL,KAAK2B,CAAL,CADAqU,CACA,CADK,CACL,CAAUrU,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACIqU,CAAA,EAAM,IAAAd,QAAAlK,gBAAA,CAA6B,IAAAvF,GAA7B;AAAsCX,CAAA,CAAMnD,CAAN,CAAtC,CACVuJ,EAAA,EAAK1L,CAAA4L,kBAAA,CAA6B4K,CAA7B,CACL9K,EAAA,EAAK8K,CANoF,CAA7F,IAQI,KAAKrU,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACIuJ,CACA,EADK1L,CAAA4L,kBAAA,CAA8B,IAAA3F,GAA9B,EAAyC,CAAzC,CAA8C,IAAA2B,KAAA7G,SAA9C,CACL,CAAA2K,CAAA,EAAK,IAAAgK,QAAAlK,gBAAA,CAA6B,IAAAvF,GAA7B,CAAsCX,CAAA,CAAMnD,CAAN,CAAtC,CAZE,CAAnB,IAcW,KAAA6O,IAAJ,CAEH1L,CAAA0K,QAAA,CAAc,QAAQ,CAACnG,CAAD,CAAMnB,CAAN,CAAW4N,CAAX,CAAc,CAE5BlU,CAAAA,CACApC,CAAA4L,kBAAA,CAA8B,CAA9B,CAAwC,IAAA4J,QAAAzU,SAAxC,CADAqB,CAEA,IAAAqT,WAAAjK,gBAAA,CAAgC,CAAhC,CAAmC9C,CAAnC,CAFAtG,CAGApC,CAAA4L,kBAAA,CAA8B,EAA9B,CAAwC,IAAAhE,KAAA7G,SAAxC,CAHAqB,CAIA,IAAAsT,QAAAlK,gBAAA,CAA6B,CAA7B,CAAgC3B,CAAhC,CAEJ6B,EAAA,EAAK1L,CAAA4L,kBAAA,CAA8B,IAAA3F,GAA9B,EAAyC,CAAzC,CAA8C/F,CAAAG,WAAAG,OAA9C,CACLkL,EAAA,EAAK1L,CAAA4L,kBAAA,CAA6BxJ,CAA7B,CACLsJ,EAAA,EAAKtJ,CAV2B,CAApC,CAWG,IAXH,CAFG,CAeC,IAAA4T,gBAAA,CAAqB1Q,CAArB,CAA4BuF,CAA5B,CAfD,GAgBCa,CACA,EADK1L,CAAA4L,kBAAA,CAA8B,IAAA3F,GAA9B;AAAyC,CAAzC,CAA8C,IAAA2B,KAAA7G,SAA9C,CACL,CAAA2K,CAAA,EAAK,IAAAgK,QAAAlK,gBAAA,CAA6B,IAAAvF,GAA7B,CAAsCX,CAAtC,CAjBN,CAfP,CAmCF,MAAOjD,CAAP,CAAU,CACR,KAAMC,MAAA,CAAM,oBAAN,CAA2B,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDtB,CAApD,CAA0D,IAA1D,CAA+DjD,CAA/D,CAAiE,GAAjE,CAAN,CADQ,CAGZ,MAAOqJ,EA7CyC,CA0DpDiK,EAAApI,OAAA,CAAwBkJ,QAAQ,CAAC1V,CAAD,CAAWqL,CAAX,CAAmB0J,CAAnB,CAAiC,CAU7D,GAJIY,EAAE1F,CAAA,IAAAA,IAAF0F,EAAc3V,CAAd2V,EAA0B,IAAA9O,KAAA7G,SAA1B2V,EACEZ,CAAAA,CADFY,EACkB,IAAA3F,SADlB2F,EACmC,IAAAvP,QAAA,OADnCuP,EAEC3V,CAFD2V,EAEaxW,CAAAG,WAAAG,OAFbkW,EAGC,IAAA1F,IAHD0F,EAGa3V,CAHb2V,EAGyBxW,CAAAG,WAAAG,OAHzBkW,CAIJ,CACI,KAAMpU,MAAA,CAAM,8BAAN,CAAqC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8D7F,CAA9D,CAAuE,IAAvE,CAA4E,IAAA6G,KAAA7G,SAA5E,CAA+F,YAA/F,CAAN,CAGJ,GAAIA,CAAJ,EAAgBb,CAAAG,WAAAG,OAAhB,EAA8C,IAAAuQ,SAA9C,EAA+D,IAAA5J,QAAA,OAA/D,EAAqJ,CAArJ,EAAyFjH,CAAAU,oBAAAuJ,QAAA,CAAqC,IAAAvC,KAAA7G,SAArC,CAAzF;AACS+U,CAAAA,CADT,CACuB,CACf1H,CAAA,CAAShC,CAAApG,aAAA,EACToI,EAAA,CAAShC,CAAAjG,OAAT,CAAyBiI,CAEzB,KADInD,CACJ,CADa,EACb,CAAOmB,CAAAjG,OAAP,CAAuBiI,CAAvB,CAAA,CACInD,CAAAlD,KAAA,CAAY,IAAAwF,OAAA,CAAY,IAAA3F,KAAA7G,SAAZ,CAAgCqL,CAAhC,CAAwC,CAAA,CAAxC,CAAZ,CACJ,OAAOnB,EANQ,CAYvB,GAAI,IAAA+F,IAAJ,CAAc,CAEV,IAAItI,EAAMsB,CAAAK,kBAAA,CAA0B,IAAAmL,QAA1B,CACVlQ,EAAA,CAAQ0E,CAAAK,kBAAA,CAA0B,IAAAzC,KAA1B,CAGRwG,EAAA,CAAShC,CAAApG,aAAA,EACT,IAAIoG,CAAAJ,UAAA,EAAJ,CAAyBoC,CAAzB,CACI,KAAM9L,MAAA,CAAM,8BAAN,CAAqC,IAAAsE,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DwH,CAA9D,CAAqE,yBAArE,CAA+FhC,CAAAJ,UAAA,EAA/F,CAAN,CAGJ,IAAI2K,EAASvK,CAAAiC,MAAA,EACbsI,EAAArI,MAAA,CAAeqI,CAAAxQ,OAAf,CAA+BiI,CAG/B,KAFAhC,CAAAjG,OAEA,EAFiBiI,CAEjB,CAA4B,CAA5B,CAAOuI,CAAA3K,UAAA,EAAP,CAAA,CAII,GAHIjG,CAGA,CAHM4Q,CAAA3Q,aAAA,EAGN,CAFJjF,CAEI,CAFOgF,CAEP,CAFa,CAEb,CADKA,CACL,IADa,CACb,CAAO,CAAP,GAAAE,CAAJ,CACIyC,CAAA,CAAM,IAAA+M,WAAAlI,OAAA,CAAuBoJ,CAAvB,CAA+B5V,CAA/B,CAAyCkF,CAAzC,CADV,KAEO,IAAW,CAAX,GAAIA,CAAJ,CACHX,CAAA;AAAQ,IAAAoQ,QAAAnI,OAAA,CAAoBoJ,CAApB,CAA4B5V,CAA5B,CAAsCkF,CAAtC,CADL,KAGH,MAAM3D,MAAA,CAAM,kDAAN,CAAN,CAIR,MAAO,CAACoG,CAAD,CAAMpD,CAAN,CA5BG,CAgCd,MAAO,KAAAoQ,QAAAnI,OAAA,CAAoBnB,CAApB,CAA4BrL,CAA5B,CAAsC,IAAAkF,GAAtC,CA3DsD,CAkEjEb,EAAAiD,QAAAC,MAAA,CAAwBA,CAepB6J,EAAAA,CAAiBA,QAAQ,CAAC9L,CAAD,CAAUwE,CAAV,CAAmByK,CAAnB,CAAyB1N,CAAzB,CAA+B9G,CAA/B,CAAqCmF,CAArC,CAAyCkB,CAAzC,CAAkD,CAC3EmB,CAAAjB,KAAA,CAAW,IAAX,CAAiBhB,CAAjB,CAA0BwE,CAA1B,CAAmCyK,CAAnC,CAAyD,IAAzD,CAA+D1N,CAA/D,CAAqE9G,CAArE,CAA2EmF,CAA3E,CAA+EkB,CAA/E,CAD2E,CAY/EgL,EAAA3L,UAAA,CAA2BgB,MAAAC,OAAA,CAAca,CAAA9B,UAAd,CAM3BpB,EAAAiD,QAAA8J,eAAA,CAAiCA,CA0BjC/M,EAAAiD,QAAAwI,MAAA,CAfYA,QAAQ,CAACxK,CAAD,CAAUwE,CAAV,CAAmB/J,CAAnB,CAAyB,CACzCsF,CAAAiB,KAAA,CAAO,IAAP,CAAahB,CAAb,CAAsBwE,CAAtB,CAA+B/J,CAA/B,CAOA,KAAA6P,OAAA,CAAc,EAR2B,CA4B7C,KAAIzF,EAAOA,QAAQ,CAAC7E,CAAD,CAAUC,CAAV,CAAkBxF,CAAlB,CAAwBqG,CAAxB,CAAiCC,CAAjC,CAAyC,CACxDF,CAAAG,KAAA,CAAe,IAAf,CAAqBhB,CAArB,CAA8BC,CAA9B,CAAsCxF,CAAtC,CAA4CqG,CAA5C,CAAqDC,CAArD,CAKA,KAAAL,UAAA,CAAiB,MAOjB,KAAA0I,OAAA,CAAc,IAb0C,CAuB5DvE,EAAAsE,QAAA,CAAeoH,QAAQ,CAACC,CAAD,CAAMvR,CAAN,CAAa,CAEhC,IADA,IAAIsE,EAAOpC,MAAAoC,KAAA,CAAYiN,CAAZ,CAAX,CACS1U,EAAE,CADX;AACcuG,CAAd,CAAmBvG,CAAnB,CAAqByH,CAAAxH,OAArB,CAAkC,EAAED,CAApC,CACI,GAAI0U,CAAA,CAAInO,CAAJ,CAAUkB,CAAA,CAAKzH,CAAL,CAAV,CAAJ,GAA2BmD,CAA3B,CACI,MAAOoD,EACf,OAAO,KALyB,CAoBpC1B,EARoBkE,CAAA1E,UAQpBQ,CARqCQ,MAAAC,OAAA,CAAcP,CAAAV,UAAd,CAQrCQ,OAAA,CAAsB8P,QAAQ,CAAC1H,CAAD,CAAU,CACpC,GAAI,IAAAK,OAAJ,EAAoBL,CAAAA,CAApB,CACI,MAAO,KAAAK,OACPoH,EAAAA,CAAM,IAAI3W,CAAAmL,QAAAH,KAEd,KAFA,IACID,EAAS,IAAAvD,YAAA,CAAiBwD,CAAAC,MAAjB,CADb,CAEShJ,EAAE,CAFX,CAEc2F,EAAEmD,CAAA7I,OAAhB,CAA+BD,CAA/B,CAAiC2F,CAAjC,CAAoC,EAAE3F,CAAtC,CACI0U,CAAA,CAAI5L,CAAA,CAAO9I,CAAP,CAAA,KAAJ,CAAA,CAAyB8I,CAAA,CAAO9I,CAAP,CAAA,GACzBqF,OAAAgC,eAAJ,EACIhC,MAAAgC,eAAA,CAAsBqN,CAAtB,CAA2B,UAA3B,CAAuC,CACnC,MAAS,IAAApN,SAAA,EAD0B,CAEnC,WAAc,CAAA,CAFqB,CAAvC,CAIJ,OAAO,KAAAgG,OAAP,CAAqBoH,CAZe,CAmBxCzR,EAAA8F,KAAA,CAAeA,CAYXC,EAAAA,CAAQA,QAAQ,CAAC9E,CAAD,CAAUwQ,CAAV,CAAe/V,CAAf,CAAqBmF,CAArB,CAAyB,CACzCG,CAAAiB,KAAA,CAAO,IAAP,CAAahB,CAAb,CAAsBwQ,CAAtB,CAA2B/V,CAA3B,CAKA,KAAAiG,UAAA,CAAiB,YAOjB,KAAAd,GAAA,CAAUA,CAb+B,CAiB7CkF,EAAA3E,UAAA,CAAkBgB,MAAAC,OAAA,CAAcrB,CAAAI,UAAd,CAMlBpB,EAAA8F,KAAAC,MAAA;AAAqBA,CAWrB,KAAI6J,EAAYA,QAAQ,CAAC3O,CAAD,CAAUC,CAAV,CAAkBxF,CAAlB,CAAwB4P,CAAxB,CAA+B,CACnDtK,CAAAiB,KAAA,CAAO,IAAP,CAAahB,CAAb,CAAsBC,CAAtB,CAA8BxF,CAA9B,CAOA,KAAA4P,MAAA,CAAaA,CARsC,CAYvDsE,EAAAxO,UAAA,CAAsBgB,MAAAC,OAAA,CAAcrB,CAAAI,UAAd,CAMtBpB,EAAA4P,UAAA,CAAoBA,CAYpB,KAAID,EAAUA,QAAQ,CAAC1O,CAAD,CAAU0Q,CAAV,CAAgBjW,CAAhB,CAAsBqG,CAAtB,CAA+B,CACjDD,CAAAG,KAAA,CAAe,IAAf,CAAqBhB,CAArB,CAA8B0Q,CAA9B,CAAoCjW,CAApC,CAA0CqG,CAA1C,CAKA,KAAAJ,UAAA,CAAiB,SAMjB,KAAAqE,MAAA,CAAa,IAZoC,CA6BrDpE,EAVuB+N,CAAAvO,UAUvBQ,CAV2CQ,MAAAC,OAAA,CAAcP,CAAAV,UAAd,CAU3CQ,OAAA,CAAyBgQ,QAAQ,CAAC5H,CAAD,CAAU,CACvC,MAAI,KAAAhE,MAAJ,EAAmBgE,CAAAA,CAAnB,CACW,IAAAhE,MADX,CAIO,IAAAA,MAJP,CAIqB,QAAQ,CAAClL,CAAD,CAAWkG,CAAX,CAAc,CAuDvC,IA7CA,IAAI2O,EAAUA,QAAQ,CAACkC,CAAD,CAAU,CAC5B/W,CAAAmL,QAAA0J,QAAA1N,KAAA,CAA8B,IAA9B,CAQA,KAAA4P,QAAA,CAAeA,CAAf,EAA0B,QAAQ,CAACnW,CAAD,CAAO6J,CAAP,CAAYjI,CAAZ,CAAsB,CAIpDwU,UAAA,CAAWxU,CAAAyU,KAAA,CAAc,IAAd,CAAoB7U,KAAA,CAAM,4EAAN,CAApB,CAAX;AAAqH,CAArH,CAJoD,CAT5B,CAAhC,CAqBI8U,EAAmBrC,CAAAvO,UAAnB4Q,CAAuC5P,MAAAC,OAAA,CAAcvH,CAAAmL,QAAA0J,QAAAvO,UAAd,CArB3C,CA4CI6Q,EAAMjR,CAAAsB,YAAA,CAAcxH,CAAAkF,QAAA2P,QAAAuC,UAAd,CA5CV,CA6CSnV,EAAE,CAAX,CAAcA,CAAd,CAAgBkV,CAAAjV,OAAhB,CAA4BD,CAAA,EAA5B,CACK,SAAQ,CAACoV,CAAD,CAAS,CAGdH,CAAA,CAAiBG,CAAAzW,KAAjB,CAAA,CAAgC,QAAQ,CAAC0W,CAAD,CAAM9U,CAAN,CAAgB,CACpD,GAAI,CACA,GAAI,CAEA8U,CAAA,CAAMD,CAAAE,oBAAArM,MAAAmC,OAAA,CAAwCvN,CAAAgL,KAAA,CAAgBwM,CAAhB,CAAxC,CAFN,CAGF,MAAO3U,CAAP,CAAY,CACV,GAAM,EAAAA,CAAA,WAAe6U,UAAf,CAAN,CACI,KAAM7U,EAAN,CAFM,CAId,GAAY,IAAZ,GAAI2U,CAAJ,EAAmC,QAAnC,GAAoB,MAAOA,EAA3B,CACI,KAAMlV,MAAA,CAAM,mBAAN,CAAN,CACEkV,CAAN,WAAqBD,EAAAE,oBAAArM,MAArB,GACIoM,CADJ,CACU,IAAID,CAAAE,oBAAArM,MAAJ,CAAqCoM,CAArC,CADV,CAEA,KAAAP,QAAA,CAAaM,CAAA9Q,IAAA,EAAb,CAA2B+Q,CAA3B,CAAgC,QAAQ,CAAC3U,CAAD,CAAMkT,CAAN,CAAW,CAC/C,GAAIlT,CAAJ,CACIH,CAAA,CAASG,CAAT,CADJ,KAAA,CAKY,IAAZ,GAAIkT,CAAJ,GACIA,CADJ,CACU,EADV,CAEA,IAAI,CAAEA,CAAA,CAAMwB,CAAAI,qBAAAvM,MAAAmC,OAAA,CAAyCwI,CAAzC,CAAR,CAAyD,MAAO6B,CAAP,CAAmB,EAC3E7B,CAAL;AAAcA,CAAd,WAA6BwB,EAAAI,qBAAAvM,MAA7B,CAIA1I,CAAA,CAAS,IAAT,CAAeqT,CAAf,CAJA,CACIrT,CAAA,CAASJ,KAAA,CAAM,mDAAN,CAA2D8D,CAAAtF,KAA3D,CAAkE,GAAlE,CAAsEyW,CAAAzW,KAAtE,CAAT,CATJ,CAD+C,CAAnD,CAZA,CA2BF,MAAO+B,CAAP,CAAY,CACVqU,UAAA,CAAWxU,CAAAyU,KAAA,CAAc,IAAd,CAAoBtU,CAApB,CAAX,CAAqC,CAArC,CADU,CA5BsC,CAkCxDkS,EAAA,CAAQwC,CAAAzW,KAAR,CAAA,CAAuB,QAAQ,CAACmW,CAAD,CAAUO,CAAV,CAAe9U,CAAf,CAAyB,CACpD,CAAA,IAAIqS,CAAJ,CAAYkC,CAAZ,CAAA,EAAqBM,CAAAzW,KAArB,CAAA,CAAkC0W,CAAlC,CAAuC9U,CAAvC,CADoD,CAIpD8E,OAAAgC,eAAJ,GACIhC,MAAAgC,eAAA,CAAsBuL,CAAA,CAAQwC,CAAAzW,KAAR,CAAtB,CAA4C,UAA5C,CAAwD,CAAE,MAASyW,CAAA9N,SAAA,EAAX,CAAxD,CACA,CAAAjC,MAAAgC,eAAA,CAAsB4N,CAAA,CAAiBG,CAAAzW,KAAjB,CAAtB,CAAqD,UAArD,CAAiE,CAAE,MAASiU,CAAA,CAAQwC,CAAAzW,KAAR,CAAA,SAAX,CAAjE,CAFJ,CAzCc,CAAjB,CAAD,CA4CGuW,CAAA,CAAIlV,CAAJ,CA5CH,CAiFAqF,OAAAgC,eAAJ,GACIhC,MAAAgC,eAAA,CAAsBuL,CAAtB,CAA+B,UAA/B,CAA2C,CAAE,MAAS3O,CAAAqD,SAAA,EAAX,CAA3C,CAGA,CAFAjC,MAAAgC,eAAA,CAAsB4N,CAAtB,CAAwC,UAAxC;AAAoD,CAAE,MAASrC,CAAA,SAAX,CAApD,CAEA,CADAvN,MAAAgC,eAAA,CAAsBuL,CAAtB,CAA+B,OAA/B,CAAwC,CAAE,MAAS3O,CAAX,CAAxC,CACA,CAAAoB,MAAAgC,eAAA,CAAsB4N,CAAtB,CAAwC,OAAxC,CAAiD,CAAE,MAAShR,CAAX,CAAjD,CAJJ,CAMA,OAAO2O,EA/IgC,CAAvB,CAiJjB7U,CAjJiB,CAiJP,IAjJO,CALmB,CA6J3CkF,EAAA2P,QAAA,CAAkBA,CAYlB,KAAI8C,EAASA,QAAQ,CAACxR,CAAD,CAAUyR,CAAV,CAAehX,CAAf,CAAqBqG,CAArB,CAA8B,CAC/Cf,CAAAiB,KAAA,CAAO,IAAP,CAAahB,CAAb,CAAsByR,CAAtB,CAA2BhX,CAA3B,CAKA,KAAAiG,UAAA,CAAiB,gBAOjB,KAAAI,QAAA,CAAeA,CAAf,EAA0B,EAbqB,CA4BnDsC,EARsBoO,CAAArR,UAQtBiD,CARyCjC,MAAAC,OAAA,CAAcrB,CAAAI,UAAd,CAQzCiD,UAAA,CAA2BlC,CAAAkC,SAM3BrE,EAAA2P,QAAA8C,OAAA,CAAyBA,CAgBrBP,EAAAA,CAAYA,QAAQ,CAACjR,CAAD,CAAUyR,CAAV,CAAehX,CAAf,CAAqBiX,CAArB,CAA8BC,CAA9B,CAAwCC,CAAxC,CAAwDC,CAAxD,CAAyE/Q,CAAzE,CAAkF,CACtG0Q,CAAAxQ,KAAA,CAAY,IAAZ,CAAkBhB,CAAlB,CAA2ByR,CAA3B,CAAgChX,CAAhC,CAAsCqG,CAAtC,CAKA,KAAAJ,UAAA,CAAiB,mBAOjB,KAAAoR,YAAA,CAAmBJ,CAOnB,KAAAK,aAAA,CAAoBJ,CAOpB,KAAAK,cAAA,CAAqBJ,CAOrB,KAAAK,eAAA,CAAsBJ,CActB,KAAAP,qBAAA;AAPA,IAAAF,oBAOA,CAP2B,IAzC2E,CAoD1GH,EAAA9Q,UAAA,CAAsBgB,MAAAC,OAAA,CAAcoQ,CAAArR,UAAd,CAMtBpB,EAAA2P,QAAAuC,UAAA,CAA4BA,CAE5B,OAAOlS,EAt0F4B,CAApB,CAw0FhBlF,CAx0FgB,CA80FnBA,EAAAmL,QAAA,CAAoB,QAAQ,CAACnL,CAAD,CAAW8D,CAAX,CAAiBoB,CAAjB,CAA0B,CA6UlDmT,QAASA,EAAe,CAACjS,CAAD,CAAS,CACzBA,CAAA,SAAJ,EACIA,CAAA,SAAA0J,QAAA,CAA2B,QAAQ,CAAC9H,CAAD,CAAQ,CACvCA,CAAA,OAAA,CAAkB5B,CAAA,OAClBiS,EAAA,CAAgBrQ,CAAhB,CAFuC,CAA3C,CAKA5B,EAAA,MAAJ,EACIA,CAAA,MAAA0J,QAAA,CAAwB,QAAQ,CAAC9H,CAAD,CAAQ,CACpCA,CAAA,OAAA,CAAkB5B,CAAA,OADkB,CAAxC,CARyB,CAnUjC,IAAI+E,EAAUA,QAAQ,CAAClE,CAAD,CAAU,CAc5B,IAAAR,IAAA,CAPA,IAAA4C,GAOA,CAPU,IAAInE,CAAA8B,UAAJ,CAAsB,IAAtB,CAA4B,IAA5B,CAAkC,EAAlC,CAcV,KAAAsR,SAAA,CAAgB,CAAA,CAOhB,KAAAC,OAAA,CAAc,IAOd,KAAAC,MAAA,CAAa,EAOb,KAAAC,WAAA,CAAkB,IAOlB,KAAAxR,QAAA,CAAeA,CAAf,EAA0B,EAjDE,CAAhC,CAwDIyR,EAAmBvN,CAAA7E,UAUvB6E,EAAAwN,UAAA,CAAoBC,QAAQ,CAACC,CAAD,CAAM,CAK9B,MAH2B,QAG3B,GAHI,MAAOA,EAAA,KAGX,EAA6B,WAA7B;AAAI,MAAOA,EAAA,OAAX,EAAkE,WAAlE,GAA4C,MAAOA,EAAA,IAAnD,CACW,CAAA,CADX,CAEO,CAAA,CAPuB,CAgBlC1N,EAAA2N,eAAA,CAAyBC,QAAQ,CAACF,CAAD,CAAM,CAEnC,MAA2B,QAA3B,GAAI,MAAOA,EAAA,KAAX,EAA8D,QAA9D,GAAuC,MAAOA,EAAA,KAA9C,EAAiG,QAAjG,GAA0E,MAAOA,EAAA,KAAjF,EAAkI,WAAlI,GAA6G,MAAOA,EAAA,GAApH,CACW,CAAA,CADX,CAEO,CAAA,CAJ4B,CAavC1N,EAAA6N,OAAA,CAAiBC,QAAQ,CAACJ,CAAD,CAAM,CAK3B,MAH2B,QAG3B,GAHI,MAAOA,EAAA,KAGX,EAA6B,WAA7B,GAAI,MAAOA,EAAA,OAAX,EAA6CjJ,KAAAC,QAAA,CAAcgJ,CAAA,OAAd,CAA7C,EAAsG,CAAtG,GAA6EA,CAAA,OAAA3W,OAA7E,CAEO,CAAA,CAFP,CACW,CAAA,CANgB,CAgB/BiJ,EAAA+N,UAAA,CAAoBC,QAAQ,CAACN,CAAD,CAAM,CAE9B,MAA2B,QAA3B,GAAI,MAAOA,EAAA,KAAX,EAA6D,QAA7D,GAAuC,MAAOA,EAAA,IAA9C,EAA0EA,CAAA,IAA1E,CAEO,CAAA,CAFP,CACW,CAAA,CAHmB,CAalC1N,EAAAiO,SAAA,CAAmBC,QAAQ,CAACR,CAAD,CAAM,CAE7B,MAA0B,QAA1B,GAAI,MAAOA,EAAA,IAAX,CACW,CAAA,CADX,CAEO,CAAA,CAJsB,CAcjCH,EAAAY,MAAA,CAAyBC,QAAQ,EAAG,CAChC,IAAA9S,IAAA;AAAW,IAAA4C,GACX,OAAO,KAFyB,CAWpCqP,EAAA/Y,OAAA,CAA0B6Z,QAAQ,CAACC,CAAD,CAAY,CAC1C,GAAyB,QAAzB,GAAI,MAAOA,EAAX,EAAsC,CAAA3V,CAAAM,QAAAsV,KAAA,CAAkBD,CAAlB,CAAtC,CACI,KAAMrX,MAAA,CAAM,qBAAN,CAA4BqX,CAA5B,CAAN,CACJA,CAAA3Q,MAAA,CAAgB,GAAhB,CAAAgH,QAAA,CAA6B,QAAQ,CAACjH,CAAD,CAAO,CACxC,IAAIQ,EAAK,IAAA5C,IAAAyB,SAAA,CAAkBW,CAAlB,CACE,KAAX,GAAIQ,CAAJ,EACI,IAAA5C,IAAAqB,SAAA,CAAkBuB,CAAlB,CAAuB,IAAInE,CAAA8B,UAAJ,CAAsB,IAAtB,CAA4B,IAAAP,IAA5B,CAAsCoC,CAAtC,CAAvB,CACJ,KAAApC,IAAA,CAAW4C,CAJ6B,CAA5C,CAKG,IALH,CAMA,OAAO,KATmC,CAmB9CqP,EAAAnR,OAAA,CAA0BoS,QAAQ,CAACC,CAAD,CAAO,CACrC,GAAKA,CAAAA,CAAL,CACI,MAAO,KACX,IAAKhK,KAAAC,QAAA,CAAc+J,CAAd,CAAL,CAEK,CACD,GAAoB,CAApB,GAAIA,CAAA1X,OAAJ,CACI,MAAO,KACX0X,EAAA,CAAOA,CAAAjS,MAAA,EAHN,CAFL,IACIiS,EAAA,CAAO,CAACA,CAAD,CASX,KADA,IAAIC,EAAQ,CAACD,CAAD,CACZ,CAAsB,CAAtB,CAAOC,CAAA3X,OAAP,CAAA,CAAyB,CACrB0X,CAAA,CAAOC,CAAAC,IAAA,EAEP,IAAK,CAAAlK,KAAAC,QAAA,CAAc+J,CAAd,CAAL,CACI,KAAMxX,MAAA,CAAM,yBAAN,CAAgC2R,IAAAC,UAAA,CAAe4F,CAAf,CAAhC,CAAN;AAEJ,IAAA,CAAqB,CAArB,CAAOA,CAAA1X,OAAP,CAAA,CAAwB,CACpB,IAAI2W,EAAMe,CAAAG,MAAA,EAEV,IAAI5O,CAAAwN,UAAA,CAAkBE,CAAlB,CAAJ,CAA4B,CACxB,IAAIzN,EAAM,IAAIlG,CAAAiD,QAAJ,CAAoB,IAApB,CAA0B,IAAA1B,IAA1B,CAAoCoS,CAAA,KAApC,CAAiDA,CAAA,QAAjD,CAAiEA,CAAA,QAAjE,CAAiFA,CAAA,OAAjF,CAAV,CAGInI,EAAS,EACTmI,EAAA,OAAJ,EACIvR,MAAAoC,KAAA,CAAYmP,CAAA,OAAZ,CAAA/I,QAAA,CAAmC,QAAQ,CAAClP,CAAD,CAAO,CAC9CwK,CAAAtD,SAAA,CAAa4I,CAAA,CAAO9P,CAAP,CAAb,CAA4B,IAAIsE,CAAAiD,QAAAwI,MAAJ,CAA0B,IAA1B,CAAgCvF,CAAhC,CAAqCxK,CAArC,CAA5B,CAD8C,CAAlD,CAEG,IAFH,CAKAiY,EAAA,OAAJ,EACIA,CAAA,OAAA/I,QAAA,CAAsB,QAAQ,CAACkK,CAAD,CAAM,CAChC,GAAkC,IAAlC,GAAI5O,CAAAlD,SAAA,CAAa8R,CAAA,GAAb,CAAuB,CAAvB,CAAJ,CACI,KAAM5X,MAAA,CAAM,mCAAN,CAA0CgJ,CAAAxK,KAA1C,CAAmD,IAAnD,CAAwDoZ,CAAA,GAAxD,CAAN,CACJ,GAAIA,CAAA,QAAJ,EAAgD,QAAhD,GAAsB,MAAOA,EAAA,QAA7B,CACI,KAAM5X,MAAA,CAAM,2BAAN,CAAkCgJ,CAAAxK,KAAlC,CAA2C,GAA3C,CAA+CoZ,CAAA,KAA/C,CAAN,CACJ,IAAIpI,EAAQ,IACZ,IAA4B,QAA5B,GAAI,MAAOoI,EAAA,MAAX;AAA0C,EAAApI,CAAA,CAAQlB,CAAA,CAAOsJ,CAAA,MAAP,CAAR,CAA1C,CACI,KAAM5X,MAAA,CAAM,mBAAN,CAA0BgJ,CAAAxK,KAA1B,CAAmC,GAAnC,CAAuCoZ,CAAA,KAAvC,CAAmD,IAAnD,CAAwDA,CAAA,MAAxD,CAAN,CACJA,CAAA,CAAM,IAAI9U,CAAAiD,QAAAC,MAAJ,CAA0B,IAA1B,CAAgCgD,CAAhC,CAAqC4O,CAAA,KAArC,CAAkDA,CAAA,QAAlD,CAAkEA,CAAA,KAAlE,CAA+EA,CAAA,KAA/E,CAA4FA,CAAA,GAA5F,CAAuGA,CAAA,QAAvG,CAAuHpI,CAAvH,CAA8HiH,CAAA,OAA9H,CACFjH,EAAJ,EACIA,CAAAnB,OAAA5I,KAAA,CAAkBmS,CAAlB,CACJ5O,EAAAtD,SAAA,CAAakS,CAAb,CAXgC,CAApC,CAYG,IAZH,CAeJ,KAAIC,EAAS,EACTpB,EAAA,MAAJ,EACIA,CAAA,MAAA/I,QAAA,CAAqB,QAAQ,CAAC6G,CAAD,CAAM,CAC/BsD,CAAApS,KAAA,CAAY8O,CAAZ,CAD+B,CAAnC,CAGAkC,EAAA,SAAJ,EACIA,CAAA,SAAA/I,QAAA,CAAwB,QAAQ,CAACrF,CAAD,CAAM,CAClCwP,CAAApS,KAAA,CAAY4C,CAAZ,CADkC,CAAtC,CAGAoO,EAAA,SAAJ,EACIA,CAAA,SAAA/I,QAAA,CAAwB,QAAQ,CAAC8H,CAAD,CAAM,CAClCqC,CAAApS,KAAA,CAAY+P,CAAZ,CADkC,CAAtC,CAKAiB,EAAA,WAAJ,GAEQzN,CAAAwD,WAFR,CACwC,QAApC,GAAI,MAAOiK,EAAA,WAAA,CAAkB,CAAlB,CAAX,CACqB,CAAEA,CAAA,WAAF,CADrB,CAGqBA,CAAA,WAJzB,CAQA,KAAApS,IAAAqB,SAAA,CAAkBsD,CAAlB,CACA,IAAoB,CAApB,CAAI6O,CAAA/X,OAAJ,CAAuB,CACnB2X,CAAAhS,KAAA,CAAW+R,CAAX,CACAA;CAAA,CAAOK,CACPA,EAAA,CAAS,IACT,KAAAxT,IAAA,CAAW2E,CACXA,EAAA,CAAM,IACN,SANmB,CAQvB6O,CAAA,CAAS,IA3De,CAA5B,IA6DO,IAAI9O,CAAA6N,OAAA,CAAeH,CAAf,CAAJ,CAEHzN,CAIA,CAJM,IAAIlG,CAAA8F,KAAJ,CAAiB,IAAjB,CAAuB,IAAAvE,IAAvB,CAAiCoS,CAAA,KAAjC,CAA8CA,CAAA,QAA9C,CAA8DA,CAAA,OAA9D,CAIN,CAHAA,CAAA,OAAA/I,QAAA,CAAsB,QAAQ,CAACnG,CAAD,CAAM,CAChCyB,CAAAtD,SAAA,CAAa,IAAI5C,CAAA8F,KAAAC,MAAJ,CAAuB,IAAvB,CAA6BG,CAA7B,CAAkCzB,CAAA,KAAlC,CAA+CA,CAAA,GAA/C,CAAb,CADgC,CAApC,CAEG,IAFH,CAGA,CAAA,IAAAlD,IAAAqB,SAAA,CAAkBsD,CAAlB,CANG,KAQA,IAAID,CAAA+N,UAAA,CAAkBL,CAAlB,CAAJ,CAEHzN,CAKA,CALM,IAAIlG,CAAA2P,QAAJ,CAAoB,IAApB,CAA0B,IAAApO,IAA1B,CAAoCoS,CAAA,KAApC,CAAiDA,CAAA,QAAjD,CAKN,CAJAvR,MAAAoC,KAAA,CAAYmP,CAAA,IAAZ,CAAA/I,QAAA,CAAgC,QAAQ,CAAClP,CAAD,CAAO,CAC3C,IAAIsZ,EAAMrB,CAAA,IAAA,CAAWjY,CAAX,CACVwK,EAAAtD,SAAA,CAAa,IAAI5C,CAAA2P,QAAAuC,UAAJ,CAA8B,IAA9B,CAAoChM,CAApC,CAAyCxK,CAAzC,CAA+CsZ,CAAA,QAA/C,CAA+DA,CAAA,SAA/D,CAAgF,CAAE,CAAAA,CAAA,eAAlF,CAAyG,CAAE,CAAAA,CAAA,gBAA3G,CAAmIA,CAAA,QAAnI,CAAb,CAF2C,CAA/C,CAGG,IAHH,CAIA,CAAA,IAAAzT,IAAAqB,SAAA,CAAkBsD,CAAlB,CAPG,KASA,IAAID,CAAAiO,SAAA,CAAiBP,CAAjB,CAAJ,CAGH,GADAzN,CACA;AADM,IAAA3E,IAAAgC,QAAA,CAAiBoQ,CAAA,IAAjB,CAA6B,CAAA,CAA7B,CACN,CACIA,CAAA,OAAA/I,QAAA,CAAsB,QAAQ,CAACkK,CAAD,CAAM,CAChC,GAAkC,IAAlC,GAAI5O,CAAAlD,SAAA,CAAa8R,CAAA,GAAb,CAAuB,CAAvB,CAAJ,CACI,KAAM5X,MAAA,CAAM,iCAAN,CAAwCgJ,CAAAxK,KAAxC,CAAiD,IAAjD,CAAsDoZ,CAAA,GAAtD,CAAN,CAEJ,GAAI5O,CAAAwD,WAAJ,CAAoB,CAChB,IAAIuL,EAAQ,CAAA,CACZ/O,EAAAwD,WAAAkB,QAAA,CAAuB,QAAQ,CAACsK,CAAD,CAAQ,CAC/BJ,CAAA,GAAJ,EAAiBI,CAAA,CAAM,CAAN,CAAjB,EAA6BJ,CAAA,GAA7B,EAA0CI,CAAA,CAAM,CAAN,CAA1C,GACID,CADJ,CACY,CAAA,CADZ,CADmC,CAAvC,CAIA,IAAKA,CAAAA,CAAL,CACI,KAAM/X,MAAA,CAAM,+BAAN,CAAsCgJ,CAAAxK,KAAtC,CAA+C,IAA/C,CAAoDoZ,CAAA,GAApD,CAA8D,4BAA9D,CAAN,CAPY,CAUpB,IAAIpZ,EAAOoZ,CAAA,KACP,KAAA/S,QAAA,yBAAJ,GACIrG,CADJ,CACWZ,CAAAwB,KAAA+B,YAAA,CAA0B3C,CAA1B,CADX,CAGI4P,KAAAA,EAAQ,IAAItL,CAAAiD,QAAA8J,eAAJ,CAAmC,IAAnC,CAAyC7G,CAAzC,CAA8C4O,CAAA,KAA9C,CAA2DA,CAAA,KAA3D,CAAwE,IAAAvT,IAAAF,IAAA,EAAxE,CAAuF,GAAvF,CAA2F3F,CAA3F,CAAiGoZ,CAAA,GAAjG,CAA4GA,CAAA,QAA5G,CAARxJ;AAIA6J,EAAM,IAAInV,CAAA4P,UAAJ,CAAsB,IAAtB,CAA4B,IAAArO,IAA5B,CAAsCuT,CAAA,KAAtC,CAAmDxJ,CAAnD,CACVA,EAAA8J,UAAA,CAAkBD,CAClB,KAAA5T,IAAAqB,SAAA,CAAkBuS,CAAlB,CACAjP,EAAAtD,SAAA,CAAa0I,CAAb,CAzBgC,CAApC,CA0BG,IA1BH,CADJ,KA6BO,IAAK,CAAA,uBAAAkJ,KAAA,CAA6Bb,CAAA,IAA7B,CAAL,CACH,KAAMzW,MAAA,CAAM,mBAAN,CAA0ByW,CAAA,IAA1B,CAAqC,iBAArC,CAAN,CADG,CAhCJ,IAoCH,MAAMzW,MAAA,CAAM,0BAAN,CAAiC2R,IAAAC,UAAA,CAAe6E,CAAf,CAAjC,CAAN,CAGJzN,CAAA,CADAyN,CACA,CADM,IAvHc,CA2HxBe,CAAA,CAAO,IACP,KAAAnT,IAAA,CAAW,IAAAA,IAAAL,OAlIU,CAoIzB,IAAAkS,SAAA,CAAgB,CAAA,CAChB,KAAAC,OAAA,CAAc,IACd,OAAO,KAnJ8B,CAiLzCG,EAAA,CAAiB,QAAjB,CAAA,CAA6B,QAAQ,CAAC6B,CAAD,CAAOC,CAAP,CAAiB,CAClD,IAAIC,EAAQ,GAIZ,IAAwB,QAAxB,GAAI,MAAOD,EAAX,CAAkC,CAE1Bxa,CAAAwB,KAAAC,QAAJ,GACI+Y,CADJ,CACe5a,OAAA,CAAQ,MAAR,CAAA,QAAA,CAA2B4a,CAA3B,CADf,CAEA,IAA6B,CAAA,CAA7B,GAAI,IAAAhC,MAAA,CAAWgC,CAAX,CAAJ,CACI,MAAO,KAAAlB,MAAA,EACX;IAAAd,MAAA,CAAWgC,CAAX,CAAA,CAAuB,CAAA,CANO,CAAlC,IAQO,IAAwB,QAAxB,GAAI,MAAOA,EAAX,CAAkC,CAErC,IAAI3D,EAAO2D,CAAA3D,KACP7W,EAAAwB,KAAAC,QAAJ,GACIoV,CADJ,CACWjX,OAAA,CAAQ,MAAR,CAAA,QAAA,CAA2BiX,CAA3B,CADX,CAEA,IAA0B,CAA1B,EAAIA,CAAA5M,QAAA,CAAa,IAAb,CAAJ,EAA8D,CAA9D,EAA+BuQ,CAAAE,KAAAzQ,QAAA,CAAsB,IAAtB,CAA/B,CACIwQ,CAAA,CAAQ,IAGRE,EAAA,CADA3a,CAAAwB,KAAAC,QAAJ,CACY7B,OAAA,CAAQ,MAAR,CAAA,KAAA,CAAwBiX,CAAxB,CAA8B2D,CAAAE,KAA9B,CADZ,CAGY7D,CAHZ,CAGmB4D,CAHnB,CAG2BD,CAAAE,KAC3B,IAA0B,CAAA,CAA1B,GAAI,IAAAlC,MAAA,CAAWmC,CAAX,CAAJ,CACI,MAAO,KAAArB,MAAA,EACX,KAAAd,MAAA,CAAWmC,CAAX,CAAA,CAAoB,CAAA,CAdiB,CAmBzC,GAAIJ,CAAA,QAAJ,EAAgD,CAAhD,CAAuBA,CAAA,QAAArY,OAAvB,CAAmD,CAC/C,IACI0Y,EAAY,CAAA,CAEhB,IAAwB,QAAxB,GAAI,MAAOJ,EAAX,CAKI,IAHA,IAAA/B,WAGI,CAHc+B,CAAA,KAGd,CAHgCI,CAGhC,CAH4C,CAAA,CAG5C,CAFJnC,CAEI,CAFS,IAAAA,WAET,CADJ+B,CACI,CADOA,CAAA,KACP,CAA4B,CAA5B,EAAA/B,CAAAxO,QAAA,CAAmB,IAAnB,CAAA,EAA2D,CAA3D,EAAiCuQ,CAAAvQ,QAAA,CAAiB,IAAjB,CAArC,CACIwQ,CAAA,CAAQ,IADZ,CALJ,IAQ+B,QAAxB,GAAI,MAAOD,EAAX,CAEC,IAAA/B,WAAJ,CACIA,CADJ,CACiB,IAAAA,WADjB;AAGiC,CAA7B,EAAI+B,CAAAvQ,QAAA,CAAiB,GAAjB,CAAJ,EACIwO,CACA,CADa+B,CAAA9W,QAAA,CAAiB,WAAjB,CAA8B,EAA9B,CACb,CAAqC,EAArC,GAAsB+U,CAAtB,GACIA,CADJ,CACiB,GADjB,CAFJ,EAIqC,CAA9B,EAAI+B,CAAAvQ,QAAA,CAAiB,IAAjB,CAAJ,EACHwO,CACA,CADa+B,CAAA9W,QAAA,CAAiB,WAAjB,CAA8B,EAA9B,CACb,CAAA+W,CAAA,CAAQ,IAFL,EAIHhC,CAJG,CAIU,GAblB,CAiBHA,CAjBG,CAiBU,IAEjB,KAAK,IAAIxW,EAAE,CAAX,CAAcA,CAAd,CAAgBsY,CAAA,QAAArY,OAAhB,CAAwCD,CAAA,EAAxC,CACI,GAAkC,QAAlC,GAAI,MAAOsY,EAAA,QAAA,CAAgBtY,CAAhB,CAAX,CAA4C,CACxC,GAAKwW,CAAAA,CAAL,CACI,KAAMrW,MAAA,CAAM,8BAAN,CAAN,CACJ,IAAIyY,EAAiBN,CAAA,QAAA,CAAgBtY,CAAhB,CACrB,IAAuB,kCAAvB,GAAI4Y,CAAJ,GAGIA,CAGA,CAJA7a,CAAAwB,KAAAC,QAAJ,CACqB7B,OAAA,CAAQ,MAAR,CAAA,KAAA,CAAwB6Y,CAAxB,CAAoCoC,CAApC,CADrB,CAGqBpC,CAHrB,CAGkCgC,CAHlC,CAG0CI,CACtC,CAA+B,CAAA,CAA/B,GAAA,IAAArC,MAAA,CAAWqC,CAAX,CANJ,EAMA,CAEI,WAAAnB,KAAA,CAAiBmB,CAAjB,CAAJ,EAAyCC,CAAA9a,CAAA8a,SAAzC,GACID,CADJ,CACqBA,CAAAnX,QAAA,CAAuB,UAAvB,CAAmC,OAAnC,CADrB,CAEA,KAAIyS,EAAWnW,CAAAwB,KAAAa,MAAA,CAAoBwY,CAApB,CACf,IAAiB,IAAjB,GAAI1E,CAAJ,CACI,KAAM/T,MAAA,CAAM,oBAAN;AAA2ByY,CAA3B,CAA0C,QAA1C,CAAmDL,CAAnD,CAA4D,mBAA5D,CAAN,CACJ,GAAI,UAAAd,KAAA,CAAgBmB,CAAhB,CAAJ,CACI,IAAA,CAAK,QAAL,CAAA,CAAe9G,IAAAY,MAAA,CAAWwB,CAAX,CAAoB,EAApB,CAAf,CAAwC0E,CAAxC,CADJ,KAGI,KAAA,CAAK,QAAL,CAAA,CAAe7a,CAAA8a,SAAAC,OAAApG,MAAA,CAA+BwB,CAA/B,CAAf,CAAyD0E,CAAzD,CAVJ,CAVwC,CAA5C,IAsBI,IAAKL,CAAL,CAEK,GAAI,UAAAd,KAAA,CAAgBc,CAAhB,CAAJ,CACD,IAAA,CAAK,QAAL,CAAA,CAAeD,CAAA,QAAA,CAAgBtY,CAAhB,CAAf,CAAmCuY,CAAA9W,QAAA,CAAiB,eAAjB,CAAkC,QAAQ,CAACC,CAAD,CAAKC,CAAL,CAASoX,CAAT,CAAa,CAAE,MAAOpX,EAAP,CAAU,SAAV,CAAoB3B,CAApB,CAAsB,GAAtB,CAA0B+Y,CAA5B,CAAvD,CAAnC,CADC,KAGD,KAAA,CAAK,QAAL,CAAA,CAAeT,CAAA,QAAA,CAAgBtY,CAAhB,CAAf,CAAmCuY,CAAnC,CAA4C,SAA5C,CAAsDvY,CAAtD,CALJ,KACI,KAAA,CAAK,QAAL,CAAA,CAAesY,CAAA,QAAA,CAAgBtY,CAAhB,CAAf,CAMR2Y,EAAJ,GACI,IAAAnC,WADJ,CACsB,IADtB,CA7D+C,CAmE/C8B,CAAA,CAAK,SAAL,CAAJ,EACI,IAAA5a,OAAA,CAAY4a,CAAA,CAAK,SAAL,CAAZ,CACAA,EAAA,OAAJ,EACIlC,CAAA,CAAgBkC,CAAhB,CACJ,KAAIU,EAAO,IAAAxU,IACP8T,EAAA,QAAJ,EACIjT,MAAAoC,KAAA,CAAY6Q,CAAA,QAAZ,CAAAzK,QAAA,CAAqC,QAAQ,CAACtH,CAAD,CAAM,CAC/CyS,CAAAhU,QAAA,CAAauB,CAAb,CAAA;AAAoB+R,CAAA,QAAA,CAAgB/R,CAAhB,CAD2B,CAAnD,CAGA+R,EAAA,SAAJ,GACI,IAAAhT,OAAA,CAAYgT,CAAA,SAAZ,CACA,CAAA,IAAA9T,IAAA,CAAWwU,CAFf,CAGIV,EAAA,MAAJ,GACI,IAAAhT,OAAA,CAAYgT,CAAA,MAAZ,CACA,CAAA,IAAA9T,IAAA,CAAWwU,CAFf,CAGIV,EAAA,SAAJ,GACI,IAAAhT,OAAA,CAAYgT,CAAA,SAAZ,CACA,CAAA,IAAA9T,IAAA,CAAWwU,CAFf,CAGIV,EAAA,CAAK,SAAL,CAAJ,EACI,IAAAhT,OAAA,CAAYgT,CAAA,CAAK,SAAL,CAAZ,CAEJ,OAAO,KAAAjB,MAAA,EAxH2C,CAiItDZ,EAAAwC,WAAA,CAA8BC,QAAQ,EAAG,CAErC,IAAItF,CACJ,IAAgB,IAAhB,EAAI,IAAApP,IAAJ,EAAiD,QAAjD,GAAwB,MAAO,KAAAA,IAAAiB,KAA/B,CACI,MAAO,KAEX,IAAI,IAAAjB,IAAJ,WAAwBvB,EAAA8B,UAAxB,CAEI,IAAAP,IAAAW,SAAA0I,QAAA,CAA0B,QAAQ,CAAC9H,CAAD,CAAQ,CACtC,IAAAvB,IAAA,CAAWuB,CACX,KAAAkT,WAAA,EAFsC,CAA1C,CAGG,IAHH,CAFJ,KAOO,IAAI,IAAAzU,IAAJ,WAAwBvB,EAAAiD,QAAAC,MAAxB,CAA+C,CAElD,GAAKtE,CAAAG,KAAAyV,KAAA,CAAe,IAAAjT,IAAAiB,KAAf,CAAL,CAiBI,IAAAjB,IAAAiB,KAAA;AAAgB1H,CAAAW,MAAA,CAAe,IAAA8F,IAAAiB,KAAf,CAjBpB,KAAoC,CAChC,GAAK,CAAA5D,CAAAM,QAAAsV,KAAA,CAAkB,IAAAjT,IAAAiB,KAAlB,CAAL,CACI,KAAMtF,MAAA,CAAM,4BAAN,CAAmC,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAAnC,CAA2D,IAA3D,CAAgE,IAAAD,IAAAiB,KAAhE,CAAN,CACJmO,CAAA,CAAMpN,CAAC,IAAAhC,IAAA,WAAoBvB,EAAAiD,QAAA8J,eAApB,CAAqD,IAAAxL,IAAA6T,UAAAlU,OAArD,CAAiF,IAAAK,IAAAL,OAAlFqC,SAAA,CAA2G,IAAAhC,IAAAiB,KAA3G,CAA0H,CAAA,CAA1H,CACN,IAAKmO,CAAAA,CAAL,CACI,KAAMzT,MAAA,CAAM,iCAAN,CAAwC,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAAxC,CAAgE,IAAhE,CAAqE,IAAAD,IAAAiB,KAArE,CAAN,CACJ,IAAAjB,IAAAsD,aAAA,CAAwB8L,CACxB,IAAIA,CAAJ,WAAmB3Q,EAAA8F,KAAnB,CAEI,IADA,IAAAvE,IAAAiB,KACI,CADY1H,CAAAW,MAAA,CAAe,MAAf,CACZ,CAAoB,QAApB,GAAA,IAAA8F,IAAAS,OAAA,EAA+C,QAA/C,GAAgC2O,CAAA3O,OAApC,CACI,KAAM9E,MAAA,CAAM,6CAAN,CAAN;AADJ,CAFJ,IAKK,IAAIyT,CAAJ,WAAmB3Q,EAAAiD,QAAnB,CACD,IAAA1B,IAAAiB,KAAA,CAAgBmO,CAAAlH,QAAA,CAAc3O,CAAAW,MAAA,MAAd,CAAwCX,CAAAW,MAAA,QADvD,KAGD,MAAMyB,MAAA,CAAM,4BAAN,CAAmC,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAAnC,CAA2D,IAA3D,CAAgE,IAAAD,IAAAiB,KAAhE,CAAN,CAf4B,CAqBpC,GAAI,IAAAjB,IAAAqK,IAAJ,CAAkB,CACd,GAAK,CAAAhN,CAAAG,KAAAyV,KAAA,CAAe,IAAAjT,IAAA6O,QAAf,CAAL,CACI,KAAMlT,MAAA,CAAM,oCAAN,CAA2C,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAA3C,CAAmE,IAAnE,CAAwE,IAAAD,IAAA6O,QAAxE,CAAN,CACJ,IAAA7O,IAAA6O,QAAA,CAAmBtV,CAAAW,MAAA,CAAe,IAAA8F,IAAA6O,QAAf,CAHL,CASI,QADtB,GACE,IAAA7O,IAAAS,OADF,EAEE,IAAAT,IAAAoK,SAFF,EAEmD7P,IAAAA,EAFnD,GAEuB,IAAAyF,IAAAQ,QAAAmU,OAFvB,EAGoE,EAHpE,GAGEpb,CAAAU,oBAAAuJ,QAAA,CAAqC,IAAAxD,IAAAiB,KAAA7G,SAArC,CAHF;CAKE,IAAA4F,IAAAQ,QAAAmU,OALF,CAK4B,CAAA,CAL5B,CA/BkD,CAA/C,IAuCA,IAAI,IAAA3U,IAAJ,WAAwBzG,EAAAkF,QAAA2P,QAAA8C,OAAxB,CAEH,GAAI,IAAAlR,IAAJ,WAAwBzG,EAAAkF,QAAA2P,QAAAuC,UAAxB,CAA4D,CACxDvB,CAAA,CAAM,IAAApP,IAAAL,OAAAqC,QAAA,CAAwB,IAAAhC,IAAAwR,YAAxB,CAA8C,CAAA,CAA9C,CACN,IAAI,EAACpC,CAAD,EAAUA,CAAV,WAAyB7V,EAAAkF,QAAAiD,QAAzB,CAAJ,CACI,KAAM/F,MAAA,CAAM,4BAAN,CAAmC,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAAnC,CAA2D,IAA3D,CAAgE,IAAAD,IAAAwR,YAAhE,CAAN,CACJ,IAAAxR,IAAA8Q,oBAAA,CAA+B1B,CAC/BA,EAAA,CAAM,IAAApP,IAAAL,OAAAqC,QAAA,CAAwB,IAAAhC,IAAAyR,aAAxB,CAA+C,CAAA,CAA/C,CACN,IAAI,EAACrC,CAAD,EAAUA,CAAV,WAAyB7V,EAAAkF,QAAAiD,QAAzB,CAAJ,CACI,KAAM/F,MAAA,CAAM,4BAAN,CAAmC,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAAnC;AAA2D,IAA3D,CAAgE,IAAAD,IAAAyR,aAAhE,CAAN,CACJ,IAAAzR,IAAAgR,qBAAA,CAAgC5B,CARwB,CAA5D,IAUI,MAAMzT,MAAA,CAAM,0BAAN,CAAiC,IAAAqE,IAAAC,SAAA,CAAkB,CAAA,CAAlB,CAAjC,CAAN,CAZD,IAcA,IACH,EAAE,IAAAD,IAAF,WAAsBzG,EAAAkF,QAAAiD,QAAAwI,MAAtB,EACE,IAAAlK,IADF,WACsBzG,EAAAkF,QAAA4P,UADtB,EAEE,IAAArO,IAFF,WAEsBzG,EAAAkF,QAAA8F,KAAAC,MAFtB,CADG,CAKH,KAAM7I,MAAA,CAAM,+BAAN,CAAsC,MAAO,KAAAqE,IAA7C,CAAuD,IAAvD,CAA4D,IAAAA,IAA5D,CAAN,CAEJ,MAAO,KAAA6S,MAAA,EAzE8B,CAoFzCZ,EAAA5R,MAAA,CAAyBuU,QAAQ,CAAC9Y,CAAD,CAAO,CACpC,IAAA+W,MAAA,EACK,KAAAhB,SAAL,GACI,IAAA4C,WAAA,EAEA,CADA,IAAA5C,SACA,CADgB,CAAA,CAChB,CAAA,IAAAC,OAAA,CAAc,IAHlB,CAIoB,KAApB,GAAI,IAAAA,OAAJ,GACI,IAAAA,OADJ,CACkB,IAAAlP,GAAAvC,MAAA,EADlB,CAEA;GAAKvE,CAAAA,CAAL,CACI,MAAO,KAAAgW,OACP1P,EAAAA,CAAuB,QAAhB,GAAA,MAAOtG,EAAP,CAA2BA,CAAAuG,MAAA,CAAW,GAAX,CAA3B,CAA6CvG,CAExD,KAFA,IACIkE,EAAM,IAAA8R,OADV,CAEStW,EAAE,CAAX,CAAcA,CAAd,CAAgB4G,CAAA3G,OAAhB,CAA6BD,CAAA,EAA7B,CACI,GAAIwE,CAAA,CAAIoC,CAAA,CAAK5G,CAAL,CAAJ,CAAJ,CACIwE,CAAA,CAAMA,CAAA,CAAIoC,CAAA,CAAK5G,CAAL,CAAJ,CADV,KAEK,CACDwE,CAAA,CAAM,IACN,MAFC,CAIT,MAAOA,EAnB6B,CA4BxCiS,EAAA4C,OAAA,CAA0BC,QAAQ,CAAChZ,CAAD,CAAOqG,CAAP,CAA4B,CAC1D,MAAOrG,EAAA,CAAO,IAAA8G,GAAAZ,QAAA,CAAgBlG,CAAhB,CAAsBqG,CAAtB,CAAP,CAAoD,IAAAS,GADD,CAS9DqP,EAAAhS,SAAA,CAA4B8U,QAAQ,EAAG,CACnC,MAAO,SAD4B,CAUvCrQ,EAAAhD,QAAA,CAAkBsT,QAAQ,EAAG,EAK7BtQ,EAAAH,KAAA,CAAe0Q,QAAQ,EAAG,EAK1BvQ,EAAA0J,QAAA,CAAkB8G,QAAQ,EAAG,EAE7B,OAAOxQ,EAnnB2C,CAAnC,CAqnBhBnL,CArnBgB,CAqnBNA,CAAA8D,KArnBM,CAqnBS9D,CAAAkF,QArnBT,CA2nBnBlF,EAAAgQ,IAAA,CAAgB,QAAQ,CAAChQ,CAAD,CAAWkF,CAAX,CAAoB,CA+ExC0W,QAASA,EAAa,CAACC,CAAD,CAAM,CACxB,IAAIC,EAAM,CACV,OAAO,CACH3L,KAAMA,QAAQ,EAAG,CACb,MAAI2L,EAAJ,CAAUD,CAAA3Z,OAAV,CACW,CAAEkO,KAAM,CAAA,CAAR,CAAehL,MAAOyW,CAAA,CAAIC,CAAA,EAAJ,CAAtB,CADX,CAEO,CAAE1L,KAAM,CAAA,CAAR,CAHM,CADd,CAFiB,CAjE5B,IAAIJ,EAAMA,QAAQ,CAACQ,CAAD,CAAQ2F,CAAR,CAAkB,CAChC,GAAKrF,CAAAN,CAAAM,IAAL,CACI,KAAM1O,MAAA,CAAM,oBAAN,CAAN;AAMJ,IAAAoO,MAAA,CAAaA,CAMb,KAAAH,QAAA,CAAe,IAAInL,CAAA4E,QAAJ,CAAoB0G,CAAA8E,QAApB,CAAmC,IAAnC,CAAyC,CAAA,CAAzC,CAA+C9E,CAAAtJ,OAA/C,CAMf,KAAAoJ,UAAA,CAAiB,IAAIpL,CAAA4E,QAAJ,CAAoB0G,CAAA9I,KAApB,CAAgC8I,CAAAzG,aAAhC,CAAoD,CAAA,CAApD,CAA2DyG,CAAAtJ,OAA3D,CAgBjB,KAAA4J,IAAA,CAAW,EAKXxJ,OAAAgC,eAAA,CAAsB,IAAtB,CAA4B,MAA5B,CAAoC,CAChCwI,IAAKA,QAAQ,EAAG,CAAE,MAAOxK,OAAAoC,KAAA,CAAY,IAAAoH,IAAZ,CAAA5O,OAAT,CADgB,CAApC,CAKA,IAAIiU,CAAJ,CAEI,IADA,IAAIzM,EAAOpC,MAAAoC,KAAA,CAAYyM,CAAZ,CAAX,CACSlU,EAAI,CAAb,CAAgBA,CAAhB,CAAoByH,CAAAxH,OAApB,CAAiCD,CAAA,EAAjC,CAAsC,CAClC,IAAIuG,EAAM,IAAA6H,QAAAhC,gBAAA,CAA6B3E,CAAA,CAAKzH,CAAL,CAA7B,CAAV,CACI0H,EAAM,IAAA2G,UAAAhG,YAAA,CAA2B6L,CAAA,CAASzM,CAAA,CAAKzH,CAAL,CAAT,CAA3B,CACV,KAAA6O,IAAA,CAAS,IAAAT,QAAA5B,cAAA,CAA2BjG,CAA3B,CAAT,CAAA,CACI,CAAEA,IAAKA,CAAP,CAAYpD,MAAOuE,CAAnB,CAJ8B,CAhDV,CAApC,CAyDIoS,EAAe/L,CAAA1J,UAsBnByV,EAAAC,MAAA,CAAqBC,QAAQ,EAAG,CAC5B,IAAAnL,IAAA,CAAW,EADiB,CAQhCiL,EAAA,CAAa,QAAb,CAAA,CAAyB,QAAQ,CAACvT,CAAD,CAAM,CAC/B0T,CAAAA,CAAW,IAAA7L,QAAA5B,cAAA,CAA2B,IAAA4B,QAAA/F,YAAA,CAAyB9B,CAAzB,CAA3B,CACf;IAAI2T,EAASD,CAATC,GAAqB,KAAArL,IACzB,QAAO,IAAAA,IAAA,CAASoL,CAAT,CACP,OAAOC,EAJ4B,CAWvCJ,EAAA7L,QAAA,CAAuBkM,QAAQ,EAAG,CAG9B,IAFA,IAAIlM,EAAU,EAAd,CACImM,EAAU/U,MAAAoC,KAAA,CAAY,IAAAoH,IAAZ,CADd,CAES7O,EAAI,CAFb,CAEgBqa,CAAhB,CAAuBra,CAAvB,CAA2Boa,CAAAna,OAA3B,CAA2CD,CAAA,EAA3C,CACIiO,CAAArI,KAAA,CAAa,CAACW,CAAC8T,CAAD9T,CAAO,IAAAsI,IAAA,CAASuL,CAAA,CAAQpa,CAAR,CAAT,CAAPuG,KAAD,CAAmC8T,CAAAlX,MAAnC,CAAb,CACJ,OAAOwW,EAAA,CAAc1L,CAAd,CALuB,CAYlC6L,EAAArS,KAAA,CAAoB6S,QAAQ,EAAG,CAG3B,IAFA,IAAI7S,EAAO,EAAX,CACI2S,EAAU/U,MAAAoC,KAAA,CAAY,IAAAoH,IAAZ,CADd,CAES7O,EAAI,CAAb,CAAgBA,CAAhB,CAAoBoa,CAAAna,OAApB,CAAoCD,CAAA,EAApC,CACIyH,CAAA7B,KAAA,CAAU,IAAAiJ,IAAA,CAASuL,CAAA,CAAQpa,CAAR,CAAT,CAAAuG,IAAV,CACJ,OAAOoT,EAAA,CAAclS,CAAd,CALoB,CAY/BqS,EAAAhR,OAAA,CAAsByR,QAAQ,EAAG,CAG7B,IAFA,IAAIzR,EAAS,EAAb,CACIsR,EAAU/U,MAAAoC,KAAA,CAAY,IAAAoH,IAAZ,CADd,CAES7O,EAAI,CAAb,CAAgBA,CAAhB,CAAoBoa,CAAAna,OAApB,CAAoCD,CAAA,EAApC,CACI8I,CAAAlD,KAAA,CAAY,IAAAiJ,IAAA,CAASuL,CAAA,CAAQpa,CAAR,CAAT,CAAAmD,MAAZ,CACJ,OAAOwW,EAAA,CAAc7Q,CAAd,CALsB,CAajCgR,EAAAjM,QAAA,CAAuB2M,QAAQ,CAACC,CAAD,CAAKC,CAAL,CAAc,CAEzC,IADA,IAAIN,EAAU/U,MAAAoC,KAAA,CAAY,IAAAoH,IAAZ,CAAd,CACS7O,EAAI,CADb,CACgBqa,CAAhB,CAAuBra,CAAvB,CAA2Boa,CAAAna,OAA3B,CAA2CD,CAAA,EAA3C,CACIya,CAAAvV,KAAA,CAAQwV,CAAR,CAAiBvX,CAACkX,CAADlX;AAAO,IAAA0L,IAAA,CAASuL,CAAA,CAAQpa,CAAR,CAAT,CAAPmD,OAAjB,CAAqDkX,CAAA9T,IAArD,CAAgE,IAAhE,CAHqC,CAY7CuT,EAAAxK,IAAA,CAAmBqL,QAAQ,CAACpU,CAAD,CAAMpD,CAAN,CAAa,CACpC,IAAI8W,EAAW,IAAA7L,QAAA/F,YAAA,CAAyB9B,CAAzB,CAAf,CACIqU,EAAW,IAAAvM,UAAAhG,YAAA,CAA2BlF,CAA3B,CACf,KAAA0L,IAAA,CAAS,IAAAT,QAAA5B,cAAA,CAA2ByN,CAA3B,CAAT,CAAA,CACI,CAAE1T,IAAK0T,CAAP,CAAiB9W,MAAOyX,CAAxB,CACJ,OAAO,KAL6B,CAaxCd,EAAAjK,IAAA,CAAmBgL,QAAQ,CAACtU,CAAD,CAAM,CACzB0T,CAAAA,CAAW,IAAA7L,QAAA5B,cAAA,CAA2B,IAAA4B,QAAA/F,YAAA,CAAyB9B,CAAzB,CAA3B,CACf,IAAM0T,CAAN,GAAkB,KAAApL,IAAlB,CAEA,MAAO,KAAAA,IAAA,CAASoL,CAAT,CAAA9W,MAJsB,CAYjC2W,EAAAgB,IAAA,CAAmBC,QAAQ,CAACxU,CAAD,CAAM,CAE7B,MADe,KAAA6H,QAAA5B,cAAAyN,CAA2B,IAAA7L,QAAA/F,YAAA,CAAyB9B,CAAzB,CAA3B0T,CACf,EAAoB,KAAApL,IAFS,CAKjC,OAAOd,EA/LiC,CAA7B,CAgMZhQ,CAhMY,CAgMFA,CAAAkF,QAhME,CAyMflF,EAAAid,WAAA,CAAsBC,QAAQ,CAACjW,CAAD,CAAU,CACpCA,CAAA,CAAUA,CAAV,EAAqB,EAC8B,YAAnD,GAAI,MAAOA,EAAA,yBAAX;CACIA,CAAA,yBADJ,CAC0CjH,CAAAqB,yBAD1C,CAE4C,YAA5C,GAAI,MAAO4F,EAAA,kBAAX,GACIA,CAAA,kBADJ,CACmCjH,CAAAsB,kBADnC,CAEA,OAAO,KAAItB,CAAAmL,QAAJ,CAAqBlE,CAArB,CAN6B,CAkBxCjH,EAAAmd,SAAA,CAAoBC,QAAQ,CAAC7C,CAAD,CAAOpU,CAAP,CAAgBqU,CAAhB,CAA0B,CAClD,GAAuB,QAAvB,GAAI,MAAOrU,EAAX,EAAoCA,CAApC,EAA0E,QAA1E,GAA+C,MAAOA,EAAA,KAAtD,EAAiH,QAAjH,GAAsF,MAAOA,EAAA,KAA7F,CACIqU,CACA,CADWrU,CACX,CAAAA,CAAA,CAAU,IACTA,EAAL,EAAmC,QAAnC,GAAgB,MAAOA,EAAvB,GACIA,CADJ,CACcnG,CAAAid,WAAA,EADd,CAEoB,SAApB,GAAI,MAAO1C,EAAX,GACIA,CADJ,CACWxG,IAAAY,MAAA,CAAW4F,CAAX,CADX,CAEApU,EAAA,CAAQ,QAAR,CAAA,CAAkBoU,CAAlB,CAAwBC,CAAxB,CACArU,EAAA+U,WAAA,EACA,OAAO/U,EAV2C,CAyBtDnG,EAAAqd,aAAA,CAAwBC,QAAQ,CAAC9C,CAAD,CAAWhY,CAAX,CAAqB2D,CAArB,CAA8B,CACtD3D,CAAJ,EAAoC,QAApC,GAAgB,MAAOA,EAAvB,EACI2D,CACA,CADU3D,CACV,CAAAA,CAAA,CAAW,IAFf,EAGUA,CAHV,EAG0C,UAH1C,GAGsB,MAAOA,EAH7B,GAIIA,CAJJ;AAIe,IAJf,CAKA,IAAIA,CAAJ,CACI,MAAOxC,EAAAwB,KAAAa,MAAA,CAAwC,QAApB,GAAA,MAAOmY,EAAP,CAA+BA,CAA/B,CAA0CA,CAAA,KAA1C,CAA2D,GAA3D,CAA+DA,CAAA,KAAnF,CAAqG,QAAQ,CAACrE,CAAD,CAAW,CAC3H,GAAiB,IAAjB,GAAIA,CAAJ,CACI3T,CAAA,CAASJ,KAAA,CAAM,sBAAN,CAAT,CADJ,KAIA,IAAI,CACAI,CAAA,CAAS,IAAT,CAAexC,CAAAmd,SAAA,CAAkBpJ,IAAAY,MAAA,CAAWwB,CAAX,CAAlB,CAAwChQ,CAAxC,CAAiDqU,CAAjD,CAAf,CADA,CAEF,MAAOrY,CAAP,CAAU,CACRK,CAAA,CAASL,CAAT,CADQ,CAP+G,CAAxH,CAWX,KAAIgU,EAAWnW,CAAAwB,KAAAa,MAAA,CAAwC,QAApB,GAAA,MAAOmY,EAAP,CAA+BA,CAAA,KAA/B,CAAgD,GAAhD,CAAoDA,CAAA,KAApD,CAAuEA,CAA3F,CACf,OAAoB,KAAb,GAAArE,CAAA,CAAoB,IAApB,CAA2BnW,CAAAmd,SAAA,CAAkBpJ,IAAAY,MAAA,CAAWwB,CAAX,CAAlB,CAAwChQ,CAAxC,CAAiDqU,CAAjD,CAnBwB,CAsB9D,OAAOxa,EAnpI+B,CAT1C;",
+"sources":[" [synthetic:base] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:es6/symbol] "," [synthetic:es6/util/iteratorfromarray] "," [synthetic:util/polyfill] "," [synthetic:es6/array/keys] "," [synthetic:es6/array/entries] "," [synthetic:es6/array/values] ","dist/protobuf-light.js"],
+"names":["global","factory","define","require","module","ByteBuffer","isCommonJS","ProtoBuf","Long","VERSION","WIRE_TYPES","VARINT","BITS64","LDELIM","STARTGROUP","ENDGROUP","BITS32","PACKABLE_WIRE_TYPES","TYPES","name","wireType","defaultValue","ZERO","undefined","UZERO","MAP_KEY_TYPES","ID_MIN","ID_MAX","convertFieldsToCamelCase","populateAccessors","populateDefaults","Util","IS_NODE","process","XHR","Util.XHR","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xhr","i","length","e","Error","fetch","Util.fetch","path","callback","fs","readFile","err","data","readFileSync","open","setRequestHeader","overrideMimeType","onreadystatechange","xhr.onreadystatechange","readyState","status","responseText","send","toCamelCase","Util.toCamelCase","str","replace","$0","$1","toUpperCase","Lang","DELIM","RULE","TYPE","NAME","TYPEDEF","TYPEREF","FQTYPEREF","NUMBER","NUMBER_DEC","NUMBER_HEX","NUMBER_OCT","NUMBER_FLT","BOOL","ID","NEGID","WHITESPACE","STRING","STRING_DQ","STRING_SQ","Reflect","mkLong","value","unsigned","low","high","fromString","fromNumber","skipTillGroupEnd","expectedId","buf","tag","readVarint32","id","readUint8","offset","T","builder","parent","TPrototype","prototype","fqn","TPrototype.fqn","ptr","toString","TPrototype.toString","includeClass","className","build","TPrototype.build","Namespace","options","syntax","call","children","NamespacePrototype","Object","create","getChildren","NamespacePrototype.getChildren","type","slice","k","push","addChild","NamespacePrototype.addChild","child","other","getChild","Message","Field","originalName","NamespacePrototype.getChild","nameOrId","key","resolve","NamespacePrototype.resolve","qn","excludeNonNamespace","part","split","NamespacePrototype.qn","t","unshift","len","join","NamespacePrototype.build","ns","defineProperty","buildOpt","NamespacePrototype.buildOpt","opt","keys","val","getOption","NamespacePrototype.getOption","Element","resolvedType","isMapKey","indexOf","ElementPrototype","defaultFieldValue","mkDefault","ElementPrototype.toString","verifyValue","ElementPrototype.verifyValue","fail","msg","self","message","String","isByteBuffer","wrap","values","Enum","Value","clazz","Builder","obj","hasOwnProperty","calculateLength","ElementPrototype.calculateLength","n","calculateVarint64","calculateVarint32","zigZagEncode32","zigZagEncode64","calculateUTF8Bytes","remaining","calculate","encodeValue","ElementPrototype.encodeValue","buffer","writeVarint64","writeVarint32","writeVarint32ZigZag","writeUint32","writeInt32","writeVarint64ZigZag","writeUint64","writeInt64","toLowerCase","writeFloat32","writeFloat64","writeVString","prevOffset","append","bb","LE","encode","flip","decode","ElementPrototype.decode","readVarint32ZigZag","readUint32","readInt32","readVarint64","toUnsigned","readVarint64ZigZag","readUint64","readInt64","readFloat","readDouble","readVString","nBytes","clone","limit","valueFromString","ElementPrototype.valueFromString","parseInt","fromBinary","valueToString","ElementPrototype.valueToString","isGroup","extensions","_fieldsByName","_fieldsById","_fields","MessagePrototype","MessagePrototype.build","rebuild","cloneRaw","binaryAsBase64","longsAsStrings","getName","object","toBase64","toBuffer","isLong","fromValue","Array","isArray","forEach","v","Map","it","entries","next","done","keyElem","valueElem","$type","field","fields","oneofs","OneOf","var_args","repeated","map","required","arguments","ArrayBuffer","$set","add","MessagePrototype.add","noAssert","$add","set","MessagePrototype.set","keyOrObj","ikey","_oneofsByName","oneof","currentField","get","MessagePrototype.get","$get","ExtensionField","Name","match","substring","setter","getter","MessagePrototype.encode","noVerify","isNew","le","littleEndian","Message.encode","MessagePrototype.calculate","encodeDelimited","MessagePrototype.encodeDelimited","enc","encodeAB","MessagePrototype.encodeAB","toArrayBuffer","encodeNB","MessagePrototype.encodeNB","encode64","MessagePrototype.encode64","encodeHex","MessagePrototype.encodeHex","toHex","toRaw","MessagePrototype.toRaw","encodeJSON","MessagePrototype.encodeJSON","JSON","stringify","Message.decode","decodeDelimited","Message.decodeDelimited","off","decode64","Message.decode64","decodeHex","Message.decodeHex","decodeJSON","Message.decodeJSON","parse","MessagePrototype.toString","Service","Extension","fieldMissing","MessagePrototype.decode","expectedGroupEndId","start","keyval","rule","keytype","keyType","keyElement","element","FieldPrototype","FieldPrototype.build","FieldPrototype.verifyValue","skipRepeated","res","hasWirePresence","FieldPrototype.hasWirePresence","FieldPrototype.encode","ensureCapacity","varintLen","contents","m","FieldPrototype.calculate","ni","FieldPrototype.decode","wireTypeOK","msgbuf","Enum.getName","enm","EnumPrototype.build","root","ServicePrototype.build","rpcImpl","setTimeout","bind","ServicePrototype","rpc","RPCMethod","method","req","resolvedRequestType","TypeError","resolvedResponseType","notABuffer","Method","svc","request","response","request_stream","response_stream","requestName","responseName","requestStream","responseStream","propagateSyntax","resolved","result","files","importRoot","BuilderPrototype","isMessage","Builder.isMessage","def","isMessageField","Builder.isMessageField","isEnum","Builder.isEnum","isService","Builder.isService","isExtend","Builder.isExtend","reset","BuilderPrototype.reset","BuilderPrototype.define","namespace","test","BuilderPrototype.create","defs","stack","pop","shift","fld","subObj","mtd","valid","range","ext","extension","json","filename","delim","file","fname","resetRoot","importFilename","DotProto","Parser","$2","base","resolveAll","BuilderPrototype.resolveAll","packed","BuilderPrototype.build","lookup","BuilderPrototype.lookup","BuilderPrototype.toString","Builder.Message","Builder.Enum","Builder.Service","arrayIterator","arr","idx","MapPrototype","clear","MapPrototype.clear","keyValue","hadKey","MapPrototype.entries","strKeys","entry","MapPrototype.keys","MapPrototype.values","MapPrototype.forEach","cb","thisArg","MapPrototype.set","valValue","MapPrototype.get","has","MapPrototype.has","newBuilder","ProtoBuf.newBuilder","loadJson","ProtoBuf.loadJson","loadJsonFile","ProtoBuf.loadJsonFile"]
+}
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.js b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.js
new file mode 100644 (file)
index 0000000..44f4d9c
--- /dev/null
@@ -0,0 +1,5265 @@
+/*\r
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+ */\r
+\r
+/**\r
+ * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>\r
+ * Released under the Apache License, Version 2.0\r
+ * see: https://github.com/dcodeIO/protobuf.js for details\r
+ */\r
+(function(global, factory) {\r
+\r
+    /* AMD */ if (typeof define === 'function' && define["amd"])\r
+        define(["bytebuffer"], factory);\r
+    /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])\r
+        module["exports"] = factory(require("bytebuffer"), true);\r
+    /* Global */ else\r
+        (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);\r
+\r
+})(this, function(ByteBuffer, isCommonJS) {\r
+    "use strict";\r
+\r
+    /**\r
+     * The ProtoBuf namespace.\r
+     * @exports ProtoBuf\r
+     * @namespace\r
+     * @expose\r
+     */\r
+    var ProtoBuf = {};\r
+\r
+    /**\r
+     * @type {!function(new: ByteBuffer, ...[*])}\r
+     * @expose\r
+     */\r
+    ProtoBuf.ByteBuffer = ByteBuffer;\r
+\r
+    /**\r
+     * @type {?function(new: Long, ...[*])}\r
+     * @expose\r
+     */\r
+    ProtoBuf.Long = ByteBuffer.Long || null;\r
+\r
+    /**\r
+     * ProtoBuf.js version.\r
+     * @type {string}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.VERSION = "5.0.3";\r
+\r
+    /**\r
+     * Wire types.\r
+     * @type {Object.<string,number>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES = {};\r
+\r
+    /**\r
+     * Varint wire type.\r
+     * @type {number}\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.VARINT = 0;\r
+\r
+    /**\r
+     * Fixed 64 bits wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.BITS64 = 1;\r
+\r
+    /**\r
+     * Length delimited wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.LDELIM = 2;\r
+\r
+    /**\r
+     * Start group wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.STARTGROUP = 3;\r
+\r
+    /**\r
+     * End group wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.ENDGROUP = 4;\r
+\r
+    /**\r
+     * Fixed 32 bits wire type.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.WIRE_TYPES.BITS32 = 5;\r
+\r
+    /**\r
+     * Packable wire types.\r
+     * @type {!Array.<number>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.PACKABLE_WIRE_TYPES = [\r
+        ProtoBuf.WIRE_TYPES.VARINT,\r
+        ProtoBuf.WIRE_TYPES.BITS64,\r
+        ProtoBuf.WIRE_TYPES.BITS32\r
+    ];\r
+\r
+    /**\r
+     * Types.\r
+     * @dict\r
+     * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.TYPES = {\r
+        // According to the protobuf spec.\r
+        "int32": {\r
+            name: "int32",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "uint32": {\r
+            name: "uint32",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "sint32": {\r
+            name: "sint32",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "int64": {\r
+            name: "int64",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined\r
+        },\r
+        "uint64": {\r
+            name: "uint64",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined\r
+        },\r
+        "sint64": {\r
+            name: "sint64",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined\r
+        },\r
+        "bool": {\r
+            name: "bool",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: false\r
+        },\r
+        "double": {\r
+            name: "double",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,\r
+            defaultValue: 0\r
+        },\r
+        "string": {\r
+            name: "string",\r
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,\r
+            defaultValue: ""\r
+        },\r
+        "bytes": {\r
+            name: "bytes",\r
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,\r
+            defaultValue: null // overridden in the code, must be a unique instance\r
+        },\r
+        "fixed32": {\r
+            name: "fixed32",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,\r
+            defaultValue: 0\r
+        },\r
+        "sfixed32": {\r
+            name: "sfixed32",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,\r
+            defaultValue: 0\r
+        },\r
+        "fixed64": {\r
+            name: "fixed64",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,\r
+            defaultValue:  ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined\r
+        },\r
+        "sfixed64": {\r
+            name: "sfixed64",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS64,\r
+            defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined\r
+        },\r
+        "float": {\r
+            name: "float",\r
+            wireType: ProtoBuf.WIRE_TYPES.BITS32,\r
+            defaultValue: 0\r
+        },\r
+        "enum": {\r
+            name: "enum",\r
+            wireType: ProtoBuf.WIRE_TYPES.VARINT,\r
+            defaultValue: 0\r
+        },\r
+        "message": {\r
+            name: "message",\r
+            wireType: ProtoBuf.WIRE_TYPES.LDELIM,\r
+            defaultValue: null\r
+        },\r
+        "group": {\r
+            name: "group",\r
+            wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,\r
+            defaultValue: null\r
+        }\r
+    };\r
+\r
+    /**\r
+     * Valid map key types.\r
+     * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.MAP_KEY_TYPES = [\r
+        ProtoBuf.TYPES["int32"],\r
+        ProtoBuf.TYPES["sint32"],\r
+        ProtoBuf.TYPES["sfixed32"],\r
+        ProtoBuf.TYPES["uint32"],\r
+        ProtoBuf.TYPES["fixed32"],\r
+        ProtoBuf.TYPES["int64"],\r
+        ProtoBuf.TYPES["sint64"],\r
+        ProtoBuf.TYPES["sfixed64"],\r
+        ProtoBuf.TYPES["uint64"],\r
+        ProtoBuf.TYPES["fixed64"],\r
+        ProtoBuf.TYPES["bool"],\r
+        ProtoBuf.TYPES["string"],\r
+        ProtoBuf.TYPES["bytes"]\r
+    ];\r
+\r
+    /**\r
+     * Minimum field id.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.ID_MIN = 1;\r
+\r
+    /**\r
+     * Maximum field id.\r
+     * @type {number}\r
+     * @const\r
+     * @expose\r
+     */\r
+    ProtoBuf.ID_MAX = 0x1FFFFFFF;\r
+\r
+    /**\r
+     * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.\r
+     *  Must be set prior to parsing.\r
+     * @type {boolean}\r
+     * @expose\r
+     */\r
+    ProtoBuf.convertFieldsToCamelCase = false;\r
+\r
+    /**\r
+     * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by\r
+     *  setting this to `false` prior to building messages.\r
+     * @type {boolean}\r
+     * @expose\r
+     */\r
+    ProtoBuf.populateAccessors = true;\r
+\r
+    /**\r
+     * By default, messages are populated with default values if a field is not present on the wire. To disable\r
+     *  this behavior, set this setting to `false`.\r
+     * @type {boolean}\r
+     * @expose\r
+     */\r
+    ProtoBuf.populateDefaults = true;\r
+\r
+    /**\r
+     * @alias ProtoBuf.Util\r
+     * @expose\r
+     */\r
+    ProtoBuf.Util = (function() {\r
+        "use strict";\r
+\r
+        /**\r
+         * ProtoBuf utilities.\r
+         * @exports ProtoBuf.Util\r
+         * @namespace\r
+         */\r
+        var Util = {};\r
+\r
+        /**\r
+         * Flag if running in node or not.\r
+         * @type {boolean}\r
+         * @const\r
+         * @expose\r
+         */\r
+        Util.IS_NODE = !!(\r
+            typeof process === 'object' && process+'' === '[object process]' && !process['browser']\r
+        );\r
+\r
+        /**\r
+         * Constructs a XMLHttpRequest object.\r
+         * @return {XMLHttpRequest}\r
+         * @throws {Error} If XMLHttpRequest is not supported\r
+         * @expose\r
+         */\r
+        Util.XHR = function() {\r
+            // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html\r
+            var XMLHttpFactories = [\r
+                function () {return new XMLHttpRequest()},\r
+                function () {return new ActiveXObject("Msxml2.XMLHTTP")},\r
+                function () {return new ActiveXObject("Msxml3.XMLHTTP")},\r
+                function () {return new ActiveXObject("Microsoft.XMLHTTP")}\r
+            ];\r
+            /** @type {?XMLHttpRequest} */\r
+            var xhr = null;\r
+            for (var i=0;i<XMLHttpFactories.length;i++) {\r
+                try { xhr = XMLHttpFactories[i](); }\r
+                catch (e) { continue; }\r
+                break;\r
+            }\r
+            if (!xhr)\r
+                throw Error("XMLHttpRequest is not supported");\r
+            return xhr;\r
+        };\r
+\r
+        /**\r
+         * Fetches a resource.\r
+         * @param {string} path Resource path\r
+         * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will\r
+         *   be fetched synchronously. If the request failed, contents will be null.\r
+         * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.\r
+         * @expose\r
+         */\r
+        Util.fetch = function(path, callback) {\r
+            if (callback && typeof callback != 'function')\r
+                callback = null;\r
+            if (Util.IS_NODE) {\r
+                var fs = require("fs");\r
+                if (callback) {\r
+                    fs.readFile(path, function(err, data) {\r
+                        if (err)\r
+                            callback(null);\r
+                        else\r
+                            callback(""+data);\r
+                    });\r
+                } else\r
+                    try {\r
+                        return fs.readFileSync(path);\r
+                    } catch (e) {\r
+                        return null;\r
+                    }\r
+            } else {\r
+                var xhr = Util.XHR();\r
+                xhr.open('GET', path, callback ? true : false);\r
+                // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');\r
+                xhr.setRequestHeader('Accept', 'text/plain');\r
+                if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');\r
+                if (callback) {\r
+                    xhr.onreadystatechange = function() {\r
+                        if (xhr.readyState != 4) return;\r
+                        if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))\r
+                            callback(xhr.responseText);\r
+                        else\r
+                            callback(null);\r
+                    };\r
+                    if (xhr.readyState == 4)\r
+                        return;\r
+                    xhr.send(null);\r
+                } else {\r
+                    xhr.send(null);\r
+                    if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))\r
+                        return xhr.responseText;\r
+                    return null;\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Converts a string to camel case.\r
+         * @param {string} str\r
+         * @returns {string}\r
+         * @expose\r
+         */\r
+        Util.toCamelCase = function(str) {\r
+            return str.replace(/_([a-zA-Z])/g, function ($0, $1) {\r
+                return $1.toUpperCase();\r
+            });\r
+        };\r
+\r
+        return Util;\r
+    })();\r
+\r
+    /**\r
+     * Language expressions.\r
+     * @type {!Object.<string,!RegExp>}\r
+     * @expose\r
+     */\r
+    ProtoBuf.Lang = {\r
+\r
+        // Characters always ending a statement\r
+        DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,\r
+\r
+        // Field rules\r
+        RULE: /^(?:required|optional|repeated|map)$/,\r
+\r
+        // Field types\r
+        TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,\r
+\r
+        // Names\r
+        NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,\r
+\r
+        // Type definitions\r
+        TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,\r
+\r
+        // Type references\r
+        TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,\r
+\r
+        // Fully qualified type references\r
+        FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,\r
+\r
+        // All numbers\r
+        NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,\r
+\r
+        // Decimal numbers\r
+        NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,\r
+\r
+        // Hexadecimal numbers\r
+        NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,\r
+\r
+        // Octal numbers\r
+        NUMBER_OCT: /^0[0-7]+$/,\r
+\r
+        // Floating point numbers\r
+        NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,\r
+\r
+        // Booleans\r
+        BOOL: /^(?:true|false)$/i,\r
+\r
+        // Id numbers\r
+        ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,\r
+\r
+        // Negative id numbers (enum values)\r
+        NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,\r
+\r
+        // Whitespaces\r
+        WHITESPACE: /\s/,\r
+\r
+        // All strings\r
+        STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,\r
+\r
+        // Double quoted strings\r
+        STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,\r
+\r
+        // Single quoted strings\r
+        STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g\r
+    };\r
+\r
+    /**\r
+     * @alias ProtoBuf.DotProto\r
+     * @expose\r
+     */\r
+    ProtoBuf.DotProto = (function(ProtoBuf, Lang) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Utilities to parse .proto files.\r
+         * @exports ProtoBuf.DotProto\r
+         * @namespace\r
+         */\r
+        var DotProto = {};\r
+\r
+        /**\r
+         * Constructs a new Tokenizer.\r
+         * @exports ProtoBuf.DotProto.Tokenizer\r
+         * @class prototype tokenizer\r
+         * @param {string} proto Proto to tokenize\r
+         * @constructor\r
+         */\r
+        var Tokenizer = function(proto) {\r
+\r
+            /**\r
+             * Source to parse.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.source = proto+"";\r
+\r
+            /**\r
+             * Current index.\r
+             * @type {number}\r
+             * @expose\r
+             */\r
+            this.index = 0;\r
+\r
+            /**\r
+             * Current line.\r
+             * @type {number}\r
+             * @expose\r
+             */\r
+            this.line = 1;\r
+\r
+            /**\r
+             * Token stack.\r
+             * @type {!Array.<string>}\r
+             * @expose\r
+             */\r
+            this.stack = [];\r
+\r
+            /**\r
+             * Opening character of the current string read, if any.\r
+             * @type {?string}\r
+             * @private\r
+             */\r
+            this._stringOpen = null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.DotProto.Tokenizer.prototype\r
+         * @inner\r
+         */\r
+        var TokenizerPrototype = Tokenizer.prototype;\r
+\r
+        /**\r
+         * Reads a string beginning at the current index.\r
+         * @return {string}\r
+         * @private\r
+         */\r
+        TokenizerPrototype._readString = function() {\r
+            var re = this._stringOpen === '"'\r
+                ? Lang.STRING_DQ\r
+                : Lang.STRING_SQ;\r
+            re.lastIndex = this.index - 1; // Include the open quote\r
+            var match = re.exec(this.source);\r
+            if (!match)\r
+                throw Error("unterminated string");\r
+            this.index = re.lastIndex;\r
+            this.stack.push(this._stringOpen);\r
+            this._stringOpen = null;\r
+            return match[1];\r
+        };\r
+\r
+        /**\r
+         * Gets the next token and advances by one.\r
+         * @return {?string} Token or `null` on EOF\r
+         * @expose\r
+         */\r
+        TokenizerPrototype.next = function() {\r
+            if (this.stack.length > 0)\r
+                return this.stack.shift();\r
+            if (this.index >= this.source.length)\r
+                return null;\r
+            if (this._stringOpen !== null)\r
+                return this._readString();\r
+\r
+            var repeat,\r
+                prev,\r
+                next;\r
+            do {\r
+                repeat = false;\r
+\r
+                // Strip white spaces\r
+                while (Lang.WHITESPACE.test(next = this.source.charAt(this.index))) {\r
+                    if (next === '\n')\r
+                        ++this.line;\r
+                    if (++this.index === this.source.length)\r
+                        return null;\r
+                }\r
+\r
+                // Strip comments\r
+                if (this.source.charAt(this.index) === '/') {\r
+                    ++this.index;\r
+                    if (this.source.charAt(this.index) === '/') { // Line\r
+                        while (this.source.charAt(++this.index) !== '\n')\r
+                            if (this.index == this.source.length)\r
+                                return null;\r
+                        ++this.index;\r
+                        ++this.line;\r
+                        repeat = true;\r
+                    } else if ((next = this.source.charAt(this.index)) === '*') { /* Block */\r
+                        do {\r
+                            if (next === '\n')\r
+                                ++this.line;\r
+                            if (++this.index === this.source.length)\r
+                                return null;\r
+                            prev = next;\r
+                            next = this.source.charAt(this.index);\r
+                        } while (prev !== '*' || next !== '/');\r
+                        ++this.index;\r
+                        repeat = true;\r
+                    } else\r
+                        return '/';\r
+                }\r
+            } while (repeat);\r
+\r
+            if (this.index === this.source.length)\r
+                return null;\r
+\r
+            // Read the next token\r
+            var end = this.index;\r
+            Lang.DELIM.lastIndex = 0;\r
+            var delim = Lang.DELIM.test(this.source.charAt(end++));\r
+            if (!delim)\r
+                while(end < this.source.length && !Lang.DELIM.test(this.source.charAt(end)))\r
+                    ++end;\r
+            var token = this.source.substring(this.index, this.index = end);\r
+            if (token === '"' || token === "'")\r
+                this._stringOpen = token;\r
+            return token;\r
+        };\r
+\r
+        /**\r
+         * Peeks for the next token.\r
+         * @return {?string} Token or `null` on EOF\r
+         * @expose\r
+         */\r
+        TokenizerPrototype.peek = function() {\r
+            if (this.stack.length === 0) {\r
+                var token = this.next();\r
+                if (token === null)\r
+                    return null;\r
+                this.stack.push(token);\r
+            }\r
+            return this.stack[0];\r
+        };\r
+\r
+        /**\r
+         * Skips a specific token and throws if it differs.\r
+         * @param {string} expected Expected token\r
+         * @throws {Error} If the actual token differs\r
+         */\r
+        TokenizerPrototype.skip = function(expected) {\r
+            var actual = this.next();\r
+            if (actual !== expected)\r
+                throw Error("illegal '"+actual+"', '"+expected+"' expected");\r
+        };\r
+\r
+        /**\r
+         * Omits an optional token.\r
+         * @param {string} expected Expected optional token\r
+         * @returns {boolean} `true` if the token exists\r
+         */\r
+        TokenizerPrototype.omit = function(expected) {\r
+            if (this.peek() === expected) {\r
+                this.next();\r
+                return true;\r
+            }\r
+            return false;\r
+        };\r
+\r
+        /**\r
+         * Returns a string representation of this object.\r
+         * @return {string} String representation as of "Tokenizer(index/length)"\r
+         * @expose\r
+         */\r
+        TokenizerPrototype.toString = function() {\r
+            return "Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")";\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.DotProto.Tokenizer\r
+         * @expose\r
+         */\r
+        DotProto.Tokenizer = Tokenizer;\r
+\r
+        /**\r
+         * Constructs a new Parser.\r
+         * @exports ProtoBuf.DotProto.Parser\r
+         * @class prototype parser\r
+         * @param {string} source Source\r
+         * @constructor\r
+         */\r
+        var Parser = function(source) {\r
+\r
+            /**\r
+             * Tokenizer.\r
+             * @type {!ProtoBuf.DotProto.Tokenizer}\r
+             * @expose\r
+             */\r
+            this.tn = new Tokenizer(source);\r
+\r
+            /**\r
+             * Whether parsing proto3 or not.\r
+             * @type {boolean}\r
+             */\r
+            this.proto3 = false;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.DotProto.Parser.prototype\r
+         * @inner\r
+         */\r
+        var ParserPrototype = Parser.prototype;\r
+\r
+        /**\r
+         * Parses the source.\r
+         * @returns {!Object}\r
+         * @throws {Error} If the source cannot be parsed\r
+         * @expose\r
+         */\r
+        ParserPrototype.parse = function() {\r
+            var topLevel = {\r
+                "name": "[ROOT]", // temporary\r
+                "package": null,\r
+                "messages": [],\r
+                "enums": [],\r
+                "imports": [],\r
+                "options": {},\r
+                "services": []\r
+                // "syntax": undefined\r
+            };\r
+            var token,\r
+                head = true,\r
+                weak;\r
+            try {\r
+                while (token = this.tn.next()) {\r
+                    switch (token) {\r
+                        case 'package':\r
+                            if (!head || topLevel["package"] !== null)\r
+                                throw Error("unexpected 'package'");\r
+                            token = this.tn.next();\r
+                            if (!Lang.TYPEREF.test(token))\r
+                                throw Error("illegal package name: " + token);\r
+                            this.tn.skip(";");\r
+                            topLevel["package"] = token;\r
+                            break;\r
+                        case 'import':\r
+                            if (!head)\r
+                                throw Error("unexpected 'import'");\r
+                            token = this.tn.peek();\r
+                            if (token === "public" || (weak = token === "weak")) // token ignored\r
+                                this.tn.next();\r
+                            token = this._readString();\r
+                            this.tn.skip(";");\r
+                            if (!weak) // import ignored\r
+                                topLevel["imports"].push(token);\r
+                            break;\r
+                        case 'syntax':\r
+                            if (!head)\r
+                                throw Error("unexpected 'syntax'");\r
+                            this.tn.skip("=");\r
+                            if ((topLevel["syntax"] = this._readString()) === "proto3")\r
+                                this.proto3 = true;\r
+                            this.tn.skip(";");\r
+                            break;\r
+                        case 'message':\r
+                            this._parseMessage(topLevel, null);\r
+                            head = false;\r
+                            break;\r
+                        case 'enum':\r
+                            this._parseEnum(topLevel);\r
+                            head = false;\r
+                            break;\r
+                        case 'option':\r
+                            this._parseOption(topLevel);\r
+                            break;\r
+                        case 'service':\r
+                            this._parseService(topLevel);\r
+                            break;\r
+                        case 'extend':\r
+                            this._parseExtend(topLevel);\r
+                            break;\r
+                        default:\r
+                            throw Error("unexpected '" + token + "'");\r
+                    }\r
+                }\r
+            } catch (e) {\r
+                e.message = "Parse error at line "+this.tn.line+": " + e.message;\r
+                throw e;\r
+            }\r
+            delete topLevel["name"];\r
+            return topLevel;\r
+        };\r
+\r
+        /**\r
+         * Parses the specified source.\r
+         * @returns {!Object}\r
+         * @throws {Error} If the source cannot be parsed\r
+         * @expose\r
+         */\r
+        Parser.parse = function(source) {\r
+            return new Parser(source).parse();\r
+        };\r
+\r
+        // ----- Conversion ------\r
+\r
+        /**\r
+         * Converts a numerical string to an id.\r
+         * @param {string} value\r
+         * @param {boolean=} mayBeNegative\r
+         * @returns {number}\r
+         * @inner\r
+         */\r
+        function mkId(value, mayBeNegative) {\r
+            var id = -1,\r
+                sign = 1;\r
+            if (value.charAt(0) == '-') {\r
+                sign = -1;\r
+                value = value.substring(1);\r
+            }\r
+            if (Lang.NUMBER_DEC.test(value))\r
+                id = parseInt(value);\r
+            else if (Lang.NUMBER_HEX.test(value))\r
+                id = parseInt(value.substring(2), 16);\r
+            else if (Lang.NUMBER_OCT.test(value))\r
+                id = parseInt(value.substring(1), 8);\r
+            else\r
+                throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);\r
+            id = (sign*id)|0; // Force to 32bit\r
+            if (!mayBeNegative && id < 0)\r
+                throw Error("illegal id value: " + (sign < 0 ? '-' : '') + value);\r
+            return id;\r
+        }\r
+\r
+        /**\r
+         * Converts a numerical string to a number.\r
+         * @param {string} val\r
+         * @returns {number}\r
+         * @inner\r
+         */\r
+        function mkNumber(val) {\r
+            var sign = 1;\r
+            if (val.charAt(0) == '-') {\r
+                sign = -1;\r
+                val = val.substring(1);\r
+            }\r
+            if (Lang.NUMBER_DEC.test(val))\r
+                return sign * parseInt(val, 10);\r
+            else if (Lang.NUMBER_HEX.test(val))\r
+                return sign * parseInt(val.substring(2), 16);\r
+            else if (Lang.NUMBER_OCT.test(val))\r
+                return sign * parseInt(val.substring(1), 8);\r
+            else if (val === 'inf')\r
+                return sign * Infinity;\r
+            else if (val === 'nan')\r
+                return NaN;\r
+            else if (Lang.NUMBER_FLT.test(val))\r
+                return sign * parseFloat(val);\r
+            throw Error("illegal number value: " + (sign < 0 ? '-' : '') + val);\r
+        }\r
+\r
+        // ----- Reading ------\r
+\r
+        /**\r
+         * Reads a string.\r
+         * @returns {string}\r
+         * @private\r
+         */\r
+        ParserPrototype._readString = function() {\r
+            var value = "",\r
+                token,\r
+                delim;\r
+            do {\r
+                delim = this.tn.next();\r
+                if (delim !== "'" && delim !== '"')\r
+                    throw Error("illegal string delimiter: "+delim);\r
+                value += this.tn.next();\r
+                this.tn.skip(delim);\r
+                token = this.tn.peek();\r
+            } while (token === '"' || token === '"'); // multi line?\r
+            return value;\r
+        };\r
+\r
+        /**\r
+         * Reads a value.\r
+         * @param {boolean=} mayBeTypeRef\r
+         * @returns {number|boolean|string}\r
+         * @private\r
+         */\r
+        ParserPrototype._readValue = function(mayBeTypeRef) {\r
+            var token = this.tn.peek(),\r
+                value;\r
+            if (token === '"' || token === "'")\r
+                return this._readString();\r
+            this.tn.next();\r
+            if (Lang.NUMBER.test(token))\r
+                return mkNumber(token);\r
+            if (Lang.BOOL.test(token))\r
+                return (token.toLowerCase() === 'true');\r
+            if (mayBeTypeRef && Lang.TYPEREF.test(token))\r
+                return token;\r
+            throw Error("illegal value: "+token);\r
+\r
+        };\r
+\r
+        // ----- Parsing constructs -----\r
+\r
+        /**\r
+         * Parses a namespace option.\r
+         * @param {!Object} parent Parent definition\r
+         * @param {boolean=} isList\r
+         * @private\r
+         */\r
+        ParserPrototype._parseOption = function(parent, isList) {\r
+            var token = this.tn.next(),\r
+                custom = false;\r
+            if (token === '(') {\r
+                custom = true;\r
+                token = this.tn.next();\r
+            }\r
+            if (!Lang.TYPEREF.test(token))\r
+                // we can allow options of the form google.protobuf.* since they will just get ignored anyways\r
+                // if (!/google\.protobuf\./.test(token)) // FIXME: Why should that not be a valid typeref?\r
+                    throw Error("illegal option name: "+token);\r
+            var name = token;\r
+            if (custom) { // (my_method_option).foo, (my_method_option), some_method_option, (foo.my_option).bar\r
+                this.tn.skip(')');\r
+                name = '('+name+')';\r
+                token = this.tn.peek();\r
+                if (Lang.FQTYPEREF.test(token)) {\r
+                    name += token;\r
+                    this.tn.next();\r
+                }\r
+            }\r
+            this.tn.skip('=');\r
+            this._parseOptionValue(parent, name);\r
+            if (!isList)\r
+                this.tn.skip(";");\r
+        };\r
+\r
+        /**\r
+         * Sets an option on the specified options object.\r
+         * @param {!Object.<string,*>} options\r
+         * @param {string} name\r
+         * @param {string|number|boolean} value\r
+         * @inner\r
+         */\r
+        function setOption(options, name, value) {\r
+            if (typeof options[name] === 'undefined')\r
+                options[name] = value;\r
+            else {\r
+                if (!Array.isArray(options[name]))\r
+                    options[name] = [ options[name] ];\r
+                options[name].push(value);\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Parses an option value.\r
+         * @param {!Object} parent\r
+         * @param {string} name\r
+         * @private\r
+         */\r
+        ParserPrototype._parseOptionValue = function(parent, name) {\r
+            var token = this.tn.peek();\r
+            if (token !== '{') { // Plain value\r
+                setOption(parent["options"], name, this._readValue(true));\r
+            } else { // Aggregate options\r
+                this.tn.skip("{");\r
+                while ((token = this.tn.next()) !== '}') {\r
+                    if (!Lang.NAME.test(token))\r
+                        throw Error("illegal option name: " + name + "." + token);\r
+                    if (this.tn.omit(":"))\r
+                        setOption(parent["options"], name + "." + token, this._readValue(true));\r
+                    else\r
+                        this._parseOptionValue(parent, name + "." + token);\r
+                }\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Parses a service definition.\r
+         * @param {!Object} parent Parent definition\r
+         * @private\r
+         */\r
+        ParserPrototype._parseService = function(parent) {\r
+            var token = this.tn.next();\r
+            if (!Lang.NAME.test(token))\r
+                throw Error("illegal service name at line "+this.tn.line+": "+token);\r
+            var name = token;\r
+            var svc = {\r
+                "name": name,\r
+                "rpc": {},\r
+                "options": {}\r
+            };\r
+            this.tn.skip("{");\r
+            while ((token = this.tn.next()) !== '}') {\r
+                if (token === "option")\r
+                    this._parseOption(svc);\r
+                else if (token === 'rpc')\r
+                    this._parseServiceRPC(svc);\r
+                else\r
+                    throw Error("illegal service token: "+token);\r
+            }\r
+            this.tn.omit(";");\r
+            parent["services"].push(svc);\r
+        };\r
+\r
+        /**\r
+         * Parses a RPC service definition of the form ['rpc', name, (request), 'returns', (response)].\r
+         * @param {!Object} svc Service definition\r
+         * @private\r
+         */\r
+        ParserPrototype._parseServiceRPC = function(svc) {\r
+            var type = "rpc",\r
+                token = this.tn.next();\r
+            if (!Lang.NAME.test(token))\r
+                throw Error("illegal rpc service method name: "+token);\r
+            var name = token;\r
+            var method = {\r
+                "request": null,\r
+                "response": null,\r
+                "request_stream": false,\r
+                "response_stream": false,\r
+                "options": {}\r
+            };\r
+            this.tn.skip("(");\r
+            token = this.tn.next();\r
+            if (token.toLowerCase() === "stream") {\r
+              method["request_stream"] = true;\r
+              token = this.tn.next();\r
+            }\r
+            if (!Lang.TYPEREF.test(token))\r
+                throw Error("illegal rpc service request type: "+token);\r
+            method["request"] = token;\r
+            this.tn.skip(")");\r
+            token = this.tn.next();\r
+            if (token.toLowerCase() !== "returns")\r
+                throw Error("illegal rpc service request type delimiter: "+token);\r
+            this.tn.skip("(");\r
+            token = this.tn.next();\r
+            if (token.toLowerCase() === "stream") {\r
+              method["response_stream"] = true;\r
+              token = this.tn.next();\r
+            }\r
+            method["response"] = token;\r
+            this.tn.skip(")");\r
+            token = this.tn.peek();\r
+            if (token === '{') {\r
+                this.tn.next();\r
+                while ((token = this.tn.next()) !== '}') {\r
+                    if (token === 'option')\r
+                        this._parseOption(method);\r
+                    else\r
+                        throw Error("illegal rpc service token: " + token);\r
+                }\r
+                this.tn.omit(";");\r
+            } else\r
+                this.tn.skip(";");\r
+            if (typeof svc[type] === 'undefined')\r
+                svc[type] = {};\r
+            svc[type][name] = method;\r
+        };\r
+\r
+        /**\r
+         * Parses a message definition.\r
+         * @param {!Object} parent Parent definition\r
+         * @param {!Object=} fld Field definition if this is a group\r
+         * @returns {!Object}\r
+         * @private\r
+         */\r
+        ParserPrototype._parseMessage = function(parent, fld) {\r
+            var isGroup = !!fld,\r
+                token = this.tn.next();\r
+            var msg = {\r
+                "name": "",\r
+                "fields": [],\r
+                "enums": [],\r
+                "messages": [],\r
+                "options": {},\r
+                "services": [],\r
+                "oneofs": {}\r
+                // "extensions": undefined\r
+            };\r
+            if (!Lang.NAME.test(token))\r
+                throw Error("illegal "+(isGroup ? "group" : "message")+" name: "+token);\r
+            msg["name"] = token;\r
+            if (isGroup) {\r
+                this.tn.skip("=");\r
+                fld["id"] = mkId(this.tn.next());\r
+                msg["isGroup"] = true;\r
+            }\r
+            token = this.tn.peek();\r
+            if (token === '[' && fld)\r
+                this._parseFieldOptions(fld);\r
+            this.tn.skip("{");\r
+            while ((token = this.tn.next()) !== '}') {\r
+                if (Lang.RULE.test(token))\r
+                    this._parseMessageField(msg, token);\r
+                else if (token === "oneof")\r
+                    this._parseMessageOneOf(msg);\r
+                else if (token === "enum")\r
+                    this._parseEnum(msg);\r
+                else if (token === "message")\r
+                    this._parseMessage(msg);\r
+                else if (token === "option")\r
+                    this._parseOption(msg);\r
+                else if (token === "service")\r
+                    this._parseService(msg);\r
+                else if (token === "extensions")\r
+                    if (msg.hasOwnProperty("extensions")) {\r
+                        msg["extensions"] = msg["extensions"].concat(this._parseExtensionRanges())\r
+                    } else {\r
+                        msg["extensions"] = this._parseExtensionRanges();\r
+                    }\r
+                else if (token === "reserved")\r
+                    this._parseIgnored(); // TODO\r
+                else if (token === "extend")\r
+                    this._parseExtend(msg);\r
+                else if (Lang.TYPEREF.test(token)) {\r
+                    if (!this.proto3)\r
+                        throw Error("illegal field rule: "+token);\r
+                    this._parseMessageField(msg, "optional", token);\r
+                } else\r
+                    throw Error("illegal message token: "+token);\r
+            }\r
+            this.tn.omit(";");\r
+            parent["messages"].push(msg);\r
+            return msg;\r
+        };\r
+\r
+        /**\r
+         * Parses an ignored statement.\r
+         * @private\r
+         */\r
+        ParserPrototype._parseIgnored = function() {\r
+            while (this.tn.peek() !== ';')\r
+                this.tn.next();\r
+            this.tn.skip(";");\r
+        };\r
+\r
+        /**\r
+         * Parses a message field.\r
+         * @param {!Object} msg Message definition\r
+         * @param {string} rule Field rule\r
+         * @param {string=} type Field type if already known (never known for maps)\r
+         * @returns {!Object} Field descriptor\r
+         * @private\r
+         */\r
+        ParserPrototype._parseMessageField = function(msg, rule, type) {\r
+            if (!Lang.RULE.test(rule))\r
+                throw Error("illegal message field rule: "+rule);\r
+            var fld = {\r
+                "rule": rule,\r
+                "type": "",\r
+                "name": "",\r
+                "options": {},\r
+                "id": 0\r
+            };\r
+            var token;\r
+            if (rule === "map") {\r
+\r
+                if (type)\r
+                    throw Error("illegal type: " + type);\r
+                this.tn.skip('<');\r
+                token = this.tn.next();\r
+                if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))\r
+                    throw Error("illegal message field type: " + token);\r
+                fld["keytype"] = token;\r
+                this.tn.skip(',');\r
+                token = this.tn.next();\r
+                if (!Lang.TYPE.test(token) && !Lang.TYPEREF.test(token))\r
+                    throw Error("illegal message field: " + token);\r
+                fld["type"] = token;\r
+                this.tn.skip('>');\r
+                token = this.tn.next();\r
+                if (!Lang.NAME.test(token))\r
+                    throw Error("illegal message field name: " + token);\r
+                fld["name"] = token;\r
+                this.tn.skip("=");\r
+                fld["id"] = mkId(this.tn.next());\r
+                token = this.tn.peek();\r
+                if (token === '[')\r
+                    this._parseFieldOptions(fld);\r
+                this.tn.skip(";");\r
+\r
+            } else {\r
+\r
+                type = typeof type !== 'undefined' ? type : this.tn.next();\r
+\r
+                if (type === "group") {\r
+\r
+                    // "A [legacy] group simply combines a nested message type and a field into a single declaration. In your\r
+                    // code, you can treat this message just as if it had a Result type field called result (the latter name is\r
+                    // converted to lower-case so that it does not conflict with the former)."\r
+                    var grp = this._parseMessage(msg, fld);\r
+                    if (!/^[A-Z]/.test(grp["name"]))\r
+                        throw Error('illegal group name: '+grp["name"]);\r
+                    fld["type"] = grp["name"];\r
+                    fld["name"] = grp["name"].toLowerCase();\r
+                    this.tn.omit(";");\r
+\r
+                } else {\r
+\r
+                    if (!Lang.TYPE.test(type) && !Lang.TYPEREF.test(type))\r
+                        throw Error("illegal message field type: " + type);\r
+                    fld["type"] = type;\r
+                    token = this.tn.next();\r
+                    if (!Lang.NAME.test(token))\r
+                        throw Error("illegal message field name: " + token);\r
+                    fld["name"] = token;\r
+                    this.tn.skip("=");\r
+                    fld["id"] = mkId(this.tn.next());\r
+                    token = this.tn.peek();\r
+                    if (token === "[")\r
+                        this._parseFieldOptions(fld);\r
+                    this.tn.skip(";");\r
+\r
+                }\r
+            }\r
+            msg["fields"].push(fld);\r
+            return fld;\r
+        };\r
+\r
+        /**\r
+         * Parses a message oneof.\r
+         * @param {!Object} msg Message definition\r
+         * @private\r
+         */\r
+        ParserPrototype._parseMessageOneOf = function(msg) {\r
+            var token = this.tn.next();\r
+            if (!Lang.NAME.test(token))\r
+                throw Error("illegal oneof name: "+token);\r
+            var name = token,\r
+                fld;\r
+            var fields = [];\r
+            this.tn.skip("{");\r
+            while ((token = this.tn.next()) !== "}") {\r
+                fld = this._parseMessageField(msg, "optional", token);\r
+                fld["oneof"] = name;\r
+                fields.push(fld["id"]);\r
+            }\r
+            this.tn.omit(";");\r
+            msg["oneofs"][name] = fields;\r
+        };\r
+\r
+        /**\r
+         * Parses a set of field option definitions.\r
+         * @param {!Object} fld Field definition\r
+         * @private\r
+         */\r
+        ParserPrototype._parseFieldOptions = function(fld) {\r
+            this.tn.skip("[");\r
+            var token,\r
+                first = true;\r
+            while ((token = this.tn.peek()) !== ']') {\r
+                if (!first)\r
+                    this.tn.skip(",");\r
+                this._parseOption(fld, true);\r
+                first = false;\r
+            }\r
+            this.tn.next();\r
+        };\r
+\r
+        /**\r
+         * Parses an enum.\r
+         * @param {!Object} msg Message definition\r
+         * @private\r
+         */\r
+        ParserPrototype._parseEnum = function(msg) {\r
+            var enm = {\r
+                "name": "",\r
+                "values": [],\r
+                "options": {}\r
+            };\r
+            var token = this.tn.next();\r
+            if (!Lang.NAME.test(token))\r
+                throw Error("illegal name: "+token);\r
+            enm["name"] = token;\r
+            this.tn.skip("{");\r
+            while ((token = this.tn.next()) !== '}') {\r
+                if (token === "option")\r
+                    this._parseOption(enm);\r
+                else {\r
+                    if (!Lang.NAME.test(token))\r
+                        throw Error("illegal name: "+token);\r
+                    this.tn.skip("=");\r
+                    var val = {\r
+                        "name": token,\r
+                        "id": mkId(this.tn.next(), true)\r
+                    };\r
+                    token = this.tn.peek();\r
+                    if (token === "[")\r
+                        this._parseFieldOptions({ "options": {} });\r
+                    this.tn.skip(";");\r
+                    enm["values"].push(val);\r
+                }\r
+            }\r
+            this.tn.omit(";");\r
+            msg["enums"].push(enm);\r
+        };\r
+\r
+        /**\r
+         * Parses extension / reserved ranges.\r
+         * @returns {!Array.<!Array.<number>>}\r
+         * @private\r
+         */\r
+        ParserPrototype._parseExtensionRanges = function() {\r
+            var ranges = [];\r
+            var token,\r
+                range,\r
+                value;\r
+            do {\r
+                range = [];\r
+                while (true) {\r
+                    token = this.tn.next();\r
+                    switch (token) {\r
+                        case "min":\r
+                            value = ProtoBuf.ID_MIN;\r
+                            break;\r
+                        case "max":\r
+                            value = ProtoBuf.ID_MAX;\r
+                            break;\r
+                        default:\r
+                            value = mkNumber(token);\r
+                            break;\r
+                    }\r
+                    range.push(value);\r
+                    if (range.length === 2)\r
+                        break;\r
+                    if (this.tn.peek() !== "to") {\r
+                        range.push(value);\r
+                        break;\r
+                    }\r
+                    this.tn.next();\r
+                }\r
+                ranges.push(range);\r
+            } while (this.tn.omit(","));\r
+            this.tn.skip(";");\r
+            return ranges;\r
+        };\r
+\r
+        /**\r
+         * Parses an extend block.\r
+         * @param {!Object} parent Parent object\r
+         * @private\r
+         */\r
+        ParserPrototype._parseExtend = function(parent) {\r
+            var token = this.tn.next();\r
+            if (!Lang.TYPEREF.test(token))\r
+                throw Error("illegal extend reference: "+token);\r
+            var ext = {\r
+                "ref": token,\r
+                "fields": []\r
+            };\r
+            this.tn.skip("{");\r
+            while ((token = this.tn.next()) !== '}') {\r
+                if (Lang.RULE.test(token))\r
+                    this._parseMessageField(ext, token);\r
+                else if (Lang.TYPEREF.test(token)) {\r
+                    if (!this.proto3)\r
+                        throw Error("illegal field rule: "+token);\r
+                    this._parseMessageField(ext, "optional", token);\r
+                } else\r
+                    throw Error("illegal extend token: "+token);\r
+            }\r
+            this.tn.omit(";");\r
+            parent["messages"].push(ext);\r
+            return ext;\r
+        };\r
+\r
+        // ----- General -----\r
+\r
+        /**\r
+         * Returns a string representation of this parser.\r
+         * @returns {string}\r
+         */\r
+        ParserPrototype.toString = function() {\r
+            return "Parser at line "+this.tn.line;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.DotProto.Parser\r
+         * @expose\r
+         */\r
+        DotProto.Parser = Parser;\r
+\r
+        return DotProto;\r
+\r
+    })(ProtoBuf, ProtoBuf.Lang);\r
+\r
+    /**\r
+     * @alias ProtoBuf.Reflect\r
+     * @expose\r
+     */\r
+    ProtoBuf.Reflect = (function(ProtoBuf) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Reflection types.\r
+         * @exports ProtoBuf.Reflect\r
+         * @namespace\r
+         */\r
+        var Reflect = {};\r
+\r
+        /**\r
+         * Constructs a Reflect base class.\r
+         * @exports ProtoBuf.Reflect.T\r
+         * @constructor\r
+         * @abstract\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {?ProtoBuf.Reflect.T} parent Parent object\r
+         * @param {string} name Object name\r
+         */\r
+        var T = function(builder, parent, name) {\r
+\r
+            /**\r
+             * Builder reference.\r
+             * @type {!ProtoBuf.Builder}\r
+             * @expose\r
+             */\r
+            this.builder = builder;\r
+\r
+            /**\r
+             * Parent object.\r
+             * @type {?ProtoBuf.Reflect.T}\r
+             * @expose\r
+             */\r
+            this.parent = parent;\r
+\r
+            /**\r
+             * Object name in namespace.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.name = name;\r
+\r
+            /**\r
+             * Fully qualified class name\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.className;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.T.prototype\r
+         * @inner\r
+         */\r
+        var TPrototype = T.prototype;\r
+\r
+        /**\r
+         * Returns the fully qualified name of this object.\r
+         * @returns {string} Fully qualified name as of ".PATH.TO.THIS"\r
+         * @expose\r
+         */\r
+        TPrototype.fqn = function() {\r
+            var name = this.name,\r
+                ptr = this;\r
+            do {\r
+                ptr = ptr.parent;\r
+                if (ptr == null)\r
+                    break;\r
+                name = ptr.name+"."+name;\r
+            } while (true);\r
+            return name;\r
+        };\r
+\r
+        /**\r
+         * Returns a string representation of this Reflect object (its fully qualified name).\r
+         * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.\r
+         * @return String representation\r
+         * @expose\r
+         */\r
+        TPrototype.toString = function(includeClass) {\r
+            return (includeClass ? this.className + " " : "") + this.fqn();\r
+        };\r
+\r
+        /**\r
+         * Builds this type.\r
+         * @throws {Error} If this type cannot be built directly\r
+         * @expose\r
+         */\r
+        TPrototype.build = function() {\r
+            throw Error(this.toString(true)+" cannot be built directly");\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.T\r
+         * @expose\r
+         */\r
+        Reflect.T = T;\r
+\r
+        /**\r
+         * Constructs a new Namespace.\r
+         * @exports ProtoBuf.Reflect.Namespace\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent\r
+         * @param {string} name Namespace name\r
+         * @param {Object.<string,*>=} options Namespace options\r
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Namespace = function(builder, parent, name, options, syntax) {\r
+            T.call(this, builder, parent, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Namespace";\r
+\r
+            /**\r
+             * Children inside the namespace.\r
+             * @type {!Array.<ProtoBuf.Reflect.T>}\r
+             */\r
+            this.children = [];\r
+\r
+            /**\r
+             * Options.\r
+             * @type {!Object.<string, *>}\r
+             */\r
+            this.options = options || {};\r
+\r
+            /**\r
+             * Syntax level (e.g., proto2 or proto3).\r
+             * @type {!string}\r
+             */\r
+            this.syntax = syntax || "proto2";\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Namespace.prototype\r
+         * @inner\r
+         */\r
+        var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * Returns an array of the namespace's children.\r
+         * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).\r
+         * @return {Array.<ProtoBuf.Reflect.T>}\r
+         * @expose\r
+         */\r
+        NamespacePrototype.getChildren = function(type) {\r
+            type = type || null;\r
+            if (type == null)\r
+                return this.children.slice();\r
+            var children = [];\r
+            for (var i=0, k=this.children.length; i<k; ++i)\r
+                if (this.children[i] instanceof type)\r
+                    children.push(this.children[i]);\r
+            return children;\r
+        };\r
+\r
+        /**\r
+         * Adds a child to the namespace.\r
+         * @param {ProtoBuf.Reflect.T} child Child\r
+         * @throws {Error} If the child cannot be added (duplicate)\r
+         * @expose\r
+         */\r
+        NamespacePrototype.addChild = function(child) {\r
+            var other;\r
+            if (other = this.getChild(child.name)) {\r
+                // Try to revert camelcase transformation on collision\r
+                if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)\r
+                    other.name = other.originalName; // Revert previous first (effectively keeps both originals)\r
+                else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)\r
+                    child.name = child.originalName;\r
+                else\r
+                    throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);\r
+            }\r
+            this.children.push(child);\r
+        };\r
+\r
+        /**\r
+         * Gets a child by its name or id.\r
+         * @param {string|number} nameOrId Child name or id\r
+         * @return {?ProtoBuf.Reflect.T} The child or null if not found\r
+         * @expose\r
+         */\r
+        NamespacePrototype.getChild = function(nameOrId) {\r
+            var key = typeof nameOrId === 'number' ? 'id' : 'name';\r
+            for (var i=0, k=this.children.length; i<k; ++i)\r
+                if (this.children[i][key] === nameOrId)\r
+                    return this.children[i];\r
+            return null;\r
+        };\r
+\r
+        /**\r
+         * Resolves a reflect object inside of this namespace.\r
+         * @param {string|!Array.<string>} qn Qualified name to resolve\r
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`\r
+         * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found\r
+         * @expose\r
+         */\r
+        NamespacePrototype.resolve = function(qn, excludeNonNamespace) {\r
+            var part = typeof qn === 'string' ? qn.split(".") : qn,\r
+                ptr = this,\r
+                i = 0;\r
+            if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'\r
+                while (ptr.parent !== null)\r
+                    ptr = ptr.parent;\r
+                i++;\r
+            }\r
+            var child;\r
+            do {\r
+                do {\r
+                    if (!(ptr instanceof Reflect.Namespace)) {\r
+                        ptr = null;\r
+                        break;\r
+                    }\r
+                    child = ptr.getChild(part[i]);\r
+                    if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {\r
+                        ptr = null;\r
+                        break;\r
+                    }\r
+                    ptr = child; i++;\r
+                } while (i < part.length);\r
+                if (ptr != null)\r
+                    break; // Found\r
+                // Else search the parent\r
+                if (this.parent !== null)\r
+                    return this.parent.resolve(qn, excludeNonNamespace);\r
+            } while (ptr != null);\r
+            return ptr;\r
+        };\r
+\r
+        /**\r
+         * Determines the shortest qualified name of the specified type, if any, relative to this namespace.\r
+         * @param {!ProtoBuf.Reflect.T} t Reflection type\r
+         * @returns {string} The shortest qualified name or, if there is none, the fqn\r
+         * @expose\r
+         */\r
+        NamespacePrototype.qn = function(t) {\r
+            var part = [], ptr = t;\r
+            do {\r
+                part.unshift(ptr.name);\r
+                ptr = ptr.parent;\r
+            } while (ptr !== null);\r
+            for (var len=1; len <= part.length; len++) {\r
+                var qn = part.slice(part.length-len);\r
+                if (t === this.resolve(qn, t instanceof Reflect.Namespace))\r
+                    return qn.join(".");\r
+            }\r
+            return t.fqn();\r
+        };\r
+\r
+        /**\r
+         * Builds the namespace and returns the runtime counterpart.\r
+         * @return {Object.<string,Function|Object>} Runtime namespace\r
+         * @expose\r
+         */\r
+        NamespacePrototype.build = function() {\r
+            /** @dict */\r
+            var ns = {};\r
+            var children = this.children;\r
+            for (var i=0, k=children.length, child; i<k; ++i) {\r
+                child = children[i];\r
+                if (child instanceof Namespace)\r
+                    ns[child.name] = child.build();\r
+            }\r
+            if (Object.defineProperty)\r
+                Object.defineProperty(ns, "$options", { "value": this.buildOpt() });\r
+            return ns;\r
+        };\r
+\r
+        /**\r
+         * Builds the namespace's '$options' property.\r
+         * @return {Object.<string,*>}\r
+         */\r
+        NamespacePrototype.buildOpt = function() {\r
+            var opt = {},\r
+                keys = Object.keys(this.options);\r
+            for (var i=0, k=keys.length; i<k; ++i) {\r
+                var key = keys[i],\r
+                    val = this.options[keys[i]];\r
+                // TODO: Options are not resolved, yet.\r
+                // if (val instanceof Namespace) {\r
+                //     opt[key] = val.build();\r
+                // } else {\r
+                opt[key] = val;\r
+                // }\r
+            }\r
+            return opt;\r
+        };\r
+\r
+        /**\r
+         * Gets the value assigned to the option with the specified name.\r
+         * @param {string=} name Returns the option value if specified, otherwise all options are returned.\r
+         * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option\r
+         */\r
+        NamespacePrototype.getOption = function(name) {\r
+            if (typeof name === 'undefined')\r
+                return this.options;\r
+            return typeof this.options[name] !== 'undefined' ? this.options[name] : null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Namespace\r
+         * @expose\r
+         */\r
+        Reflect.Namespace = Namespace;\r
+\r
+        /**\r
+         * Constructs a new Element implementation that checks and converts values for a\r
+         * particular field type, as appropriate.\r
+         *\r
+         * An Element represents a single value: either the value of a singular field,\r
+         * or a value contained in one entry of a repeated field or map field. This\r
+         * class does not implement these higher-level concepts; it only encapsulates\r
+         * the low-level typechecking and conversion.\r
+         *\r
+         * @exports ProtoBuf.Reflect.Element\r
+         * @param {{name: string, wireType: number}} type Resolved data type\r
+         * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant\r
+         * (e.g. submessage field).\r
+         * @param {boolean} isMapKey Is this element a Map key? The value will be\r
+         * converted to string form if so.\r
+         * @param {string} syntax Syntax level of defining message type, e.g.,\r
+         * proto2 or proto3.\r
+         * @param {string} name Name of the field containing this element (for error\r
+         * messages)\r
+         * @constructor\r
+         */\r
+        var Element = function(type, resolvedType, isMapKey, syntax, name) {\r
+\r
+            /**\r
+             * Element type, as a string (e.g., int32).\r
+             * @type {{name: string, wireType: number}}\r
+             */\r
+            this.type = type;\r
+\r
+            /**\r
+             * Element type reference to submessage or enum definition, if needed.\r
+             * @type {ProtoBuf.Reflect.T|null}\r
+             */\r
+            this.resolvedType = resolvedType;\r
+\r
+            /**\r
+             * Element is a map key.\r
+             * @type {boolean}\r
+             */\r
+            this.isMapKey = isMapKey;\r
+\r
+            /**\r
+             * Syntax level of defining message type, e.g., proto2 or proto3.\r
+             * @type {string}\r
+             */\r
+            this.syntax = syntax;\r
+\r
+            /**\r
+             * Name of the field containing this element (for error messages)\r
+             * @type {string}\r
+             */\r
+            this.name = name;\r
+\r
+            if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)\r
+                throw Error("Invalid map key type: " + type.name);\r
+        };\r
+\r
+        var ElementPrototype = Element.prototype;\r
+\r
+        /**\r
+         * Obtains a (new) default value for the specified type.\r
+         * @param type {string|{name: string, wireType: number}} Field type\r
+         * @returns {*} Default value\r
+         * @inner\r
+         */\r
+        function mkDefault(type) {\r
+            if (typeof type === 'string')\r
+                type = ProtoBuf.TYPES[type];\r
+            if (typeof type.defaultValue === 'undefined')\r
+                throw Error("default value for type "+type.name+" is not supported");\r
+            if (type == ProtoBuf.TYPES["bytes"])\r
+                return new ByteBuffer(0);\r
+            return type.defaultValue;\r
+        }\r
+\r
+        /**\r
+         * Returns the default value for this field in proto3.\r
+         * @function\r
+         * @param type {string|{name: string, wireType: number}} the field type\r
+         * @returns {*} Default value\r
+         */\r
+        Element.defaultFieldValue = mkDefault;\r
+\r
+        /**\r
+         * Makes a Long from a value.\r
+         * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value\r
+         * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for\r
+         *  strings and numbers\r
+         * @returns {!Long}\r
+         * @throws {Error} If the value cannot be converted to a Long\r
+         * @inner\r
+         */\r
+        function mkLong(value, unsigned) {\r
+            if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'\r
+                && value.low === value.low && value.high === value.high)\r
+                return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);\r
+            if (typeof value === 'string')\r
+                return ProtoBuf.Long.fromString(value, unsigned || false, 10);\r
+            if (typeof value === 'number')\r
+                return ProtoBuf.Long.fromNumber(value, unsigned || false);\r
+            throw Error("not convertible to Long");\r
+        }\r
+\r
+        ElementPrototype.toString = function() {\r
+            return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';\r
+        }\r
+\r
+        /**\r
+         * Checks if the given value can be set for an element of this type (singular\r
+         * field or one element of a repeated field or map).\r
+         * @param {*} value Value to check\r
+         * @return {*} Verified, maybe adjusted, value\r
+         * @throws {Error} If the value cannot be verified for this element slot\r
+         * @expose\r
+         */\r
+        ElementPrototype.verifyValue = function(value) {\r
+            var self = this;\r
+            function fail(val, msg) {\r
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");\r
+            }\r
+            switch (this.type) {\r
+                // Signed 32bit\r
+                case ProtoBuf.TYPES["int32"]:\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                    // Account for !NaN: value === value\r
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))\r
+                        fail(typeof value, "not an integer");\r
+                    return value > 4294967295 ? value | 0 : value;\r
+\r
+                // Unsigned 32bit\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    if (typeof value !== 'number' || (value === value && value % 1 !== 0))\r
+                        fail(typeof value, "not an integer");\r
+                    return value < 0 ? value >>> 0 : value;\r
+\r
+                // Signed 64bit\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]: {\r
+                    if (ProtoBuf.Long)\r
+                        try {\r
+                            return mkLong(value, false);\r
+                        } catch (e) {\r
+                            fail(typeof value, e.message);\r
+                        }\r
+                    else\r
+                        fail(typeof value, "requires Long.js");\r
+                }\r
+\r
+                // Unsigned 64bit\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                case ProtoBuf.TYPES["fixed64"]: {\r
+                    if (ProtoBuf.Long)\r
+                        try {\r
+                            return mkLong(value, true);\r
+                        } catch (e) {\r
+                            fail(typeof value, e.message);\r
+                        }\r
+                    else\r
+                        fail(typeof value, "requires Long.js");\r
+                }\r
+\r
+                // Bool\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    if (typeof value !== 'boolean')\r
+                        fail(typeof value, "not a boolean");\r
+                    return value;\r
+\r
+                // Float\r
+                case ProtoBuf.TYPES["float"]:\r
+                case ProtoBuf.TYPES["double"]:\r
+                    if (typeof value !== 'number')\r
+                        fail(typeof value, "not a number");\r
+                    return value;\r
+\r
+                // Length-delimited string\r
+                case ProtoBuf.TYPES["string"]:\r
+                    if (typeof value !== 'string' && !(value && value instanceof String))\r
+                        fail(typeof value, "not a string");\r
+                    return ""+value; // Convert String object to string\r
+\r
+                // Length-delimited bytes\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    if (ByteBuffer.isByteBuffer(value))\r
+                        return value;\r
+                    return ByteBuffer.wrap(value, "base64");\r
+\r
+                // Constant enum value\r
+                case ProtoBuf.TYPES["enum"]: {\r
+                    var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);\r
+                    for (i=0; i<values.length; i++)\r
+                        if (values[i].name == value)\r
+                            return values[i].id;\r
+                        else if (values[i].id == value)\r
+                            return values[i].id;\r
+\r
+                    if (this.syntax === 'proto3') {\r
+                        // proto3: just make sure it's an integer.\r
+                        if (typeof value !== 'number' || (value === value && value % 1 !== 0))\r
+                            fail(typeof value, "not an integer");\r
+                        if (value > 4294967295 || value < 0)\r
+                            fail(typeof value, "not in range for uint32")\r
+                        return value;\r
+                    } else {\r
+                        // proto2 requires enum values to be valid.\r
+                        fail(value, "not a valid enum value");\r
+                    }\r
+                }\r
+                // Embedded message\r
+                case ProtoBuf.TYPES["group"]:\r
+                case ProtoBuf.TYPES["message"]: {\r
+                    if (!value || typeof value !== 'object')\r
+                        fail(typeof value, "object expected");\r
+                    if (value instanceof this.resolvedType.clazz)\r
+                        return value;\r
+                    if (value instanceof ProtoBuf.Builder.Message) {\r
+                        // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)\r
+                        var obj = {};\r
+                        for (var i in value)\r
+                            if (value.hasOwnProperty(i))\r
+                                obj[i] = value[i];\r
+                        value = obj;\r
+                    }\r
+                    // Else let's try to construct one from a key-value object\r
+                    return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons\r
+                }\r
+            }\r
+\r
+            // We should never end here\r
+            throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");\r
+        };\r
+\r
+        /**\r
+         * Calculates the byte length of an element on the wire.\r
+         * @param {number} id Field number\r
+         * @param {*} value Field value\r
+         * @returns {number} Byte length\r
+         * @throws {Error} If the value cannot be calculated\r
+         * @expose\r
+         */\r
+        ElementPrototype.calculateLength = function(id, value) {\r
+            if (value === null) return 0; // Nothing to encode\r
+            // Tag has already been written\r
+            var n;\r
+            switch (this.type) {\r
+                case ProtoBuf.TYPES["int32"]:\r
+                    return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                    return ByteBuffer.calculateVarint32(value);\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                    return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                case ProtoBuf.TYPES["float"]:\r
+                    return 4;\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                    return ByteBuffer.calculateVarint64(value);\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                    return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                    return 8;\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    return 1;\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    return ByteBuffer.calculateVarint32(value);\r
+                case ProtoBuf.TYPES["double"]:\r
+                    return 8;\r
+                case ProtoBuf.TYPES["string"]:\r
+                    n = ByteBuffer.calculateUTF8Bytes(value);\r
+                    return ByteBuffer.calculateVarint32(n) + n;\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    if (value.remaining() < 0)\r
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");\r
+                    return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();\r
+                case ProtoBuf.TYPES["message"]:\r
+                    n = this.resolvedType.calculate(value);\r
+                    return ByteBuffer.calculateVarint32(n) + n;\r
+                case ProtoBuf.TYPES["group"]:\r
+                    n = this.resolvedType.calculate(value);\r
+                    return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);\r
+            }\r
+            // We should never end here\r
+            throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");\r
+        };\r
+\r
+        /**\r
+         * Encodes a value to the specified buffer. Does not encode the key.\r
+         * @param {number} id Field number\r
+         * @param {*} value Field value\r
+         * @param {ByteBuffer} buffer ByteBuffer to encode to\r
+         * @return {ByteBuffer} The ByteBuffer for chaining\r
+         * @throws {Error} If the value cannot be encoded\r
+         * @expose\r
+         */\r
+        ElementPrototype.encodeValue = function(id, value, buffer) {\r
+            if (value === null) return buffer; // Nothing to encode\r
+            // Tag has already been written\r
+\r
+            switch (this.type) {\r
+                // 32bit signed varint\r
+                case ProtoBuf.TYPES["int32"]:\r
+                    // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes\r
+                    // long – it is, effectively, treated like a very large unsigned integer." (see #122)\r
+                    if (value < 0)\r
+                        buffer.writeVarint64(value);\r
+                    else\r
+                        buffer.writeVarint32(value);\r
+                    break;\r
+\r
+                // 32bit unsigned varint\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                    buffer.writeVarint32(value);\r
+                    break;\r
+\r
+                // 32bit varint zig-zag\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                    buffer.writeVarint32ZigZag(value);\r
+                    break;\r
+\r
+                // Fixed unsigned 32bit\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    buffer.writeUint32(value);\r
+                    break;\r
+\r
+                // Fixed signed 32bit\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                    buffer.writeInt32(value);\r
+                    break;\r
+\r
+                // 64bit varint as-is\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                    buffer.writeVarint64(value); // throws\r
+                    break;\r
+\r
+                // 64bit varint zig-zag\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                    buffer.writeVarint64ZigZag(value); // throws\r
+                    break;\r
+\r
+                // Fixed unsigned 64bit\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                    buffer.writeUint64(value); // throws\r
+                    break;\r
+\r
+                // Fixed signed 64bit\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                    buffer.writeInt64(value); // throws\r
+                    break;\r
+\r
+                // Bool\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    if (typeof value === 'string')\r
+                        buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);\r
+                    else\r
+                        buffer.writeVarint32(value ? 1 : 0);\r
+                    break;\r
+\r
+                // Constant enum value\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    buffer.writeVarint32(value);\r
+                    break;\r
+\r
+                // 32bit float\r
+                case ProtoBuf.TYPES["float"]:\r
+                    buffer.writeFloat32(value);\r
+                    break;\r
+\r
+                // 64bit float\r
+                case ProtoBuf.TYPES["double"]:\r
+                    buffer.writeFloat64(value);\r
+                    break;\r
+\r
+                // Length-delimited string\r
+                case ProtoBuf.TYPES["string"]:\r
+                    buffer.writeVString(value);\r
+                    break;\r
+\r
+                // Length-delimited bytes\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    if (value.remaining() < 0)\r
+                        throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");\r
+                    var prevOffset = value.offset;\r
+                    buffer.writeVarint32(value.remaining());\r
+                    buffer.append(value);\r
+                    value.offset = prevOffset;\r
+                    break;\r
+\r
+                // Embedded message\r
+                case ProtoBuf.TYPES["message"]:\r
+                    var bb = new ByteBuffer().LE();\r
+                    this.resolvedType.encode(value, bb);\r
+                    buffer.writeVarint32(bb.offset);\r
+                    buffer.append(bb.flip());\r
+                    break;\r
+\r
+                // Legacy group\r
+                case ProtoBuf.TYPES["group"]:\r
+                    this.resolvedType.encode(value, buffer);\r
+                    buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);\r
+                    break;\r
+\r
+                default:\r
+                    // We should never end here\r
+                    throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");\r
+            }\r
+            return buffer;\r
+        };\r
+\r
+        /**\r
+         * Decode one element value from the specified buffer.\r
+         * @param {ByteBuffer} buffer ByteBuffer to decode from\r
+         * @param {number} wireType The field wire type\r
+         * @param {number} id The field number\r
+         * @return {*} Decoded value\r
+         * @throws {Error} If the field cannot be decoded\r
+         * @expose\r
+         */\r
+        ElementPrototype.decode = function(buffer, wireType, id) {\r
+            if (wireType != this.type.wireType)\r
+                throw Error("Unexpected wire type for element");\r
+\r
+            var value, nBytes;\r
+            switch (this.type) {\r
+                // 32bit signed varint\r
+                case ProtoBuf.TYPES["int32"]:\r
+                    return buffer.readVarint32() | 0;\r
+\r
+                // 32bit unsigned varint\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                    return buffer.readVarint32() >>> 0;\r
+\r
+                // 32bit signed varint zig-zag\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                    return buffer.readVarint32ZigZag() | 0;\r
+\r
+                // Fixed 32bit unsigned\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    return buffer.readUint32() >>> 0;\r
+\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                    return buffer.readInt32() | 0;\r
+\r
+                // 64bit signed varint\r
+                case ProtoBuf.TYPES["int64"]:\r
+                    return buffer.readVarint64();\r
+\r
+                // 64bit unsigned varint\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                    return buffer.readVarint64().toUnsigned();\r
+\r
+                // 64bit signed varint zig-zag\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                    return buffer.readVarint64ZigZag();\r
+\r
+                // Fixed 64bit unsigned\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                    return buffer.readUint64();\r
+\r
+                // Fixed 64bit signed\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                    return buffer.readInt64();\r
+\r
+                // Bool varint\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    return !!buffer.readVarint32();\r
+\r
+                // Constant enum value (varint)\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    // The following Builder.Message#set will already throw\r
+                    return buffer.readVarint32();\r
+\r
+                // 32bit float\r
+                case ProtoBuf.TYPES["float"]:\r
+                    return buffer.readFloat();\r
+\r
+                // 64bit float\r
+                case ProtoBuf.TYPES["double"]:\r
+                    return buffer.readDouble();\r
+\r
+                // Length-delimited string\r
+                case ProtoBuf.TYPES["string"]:\r
+                    return buffer.readVString();\r
+\r
+                // Length-delimited bytes\r
+                case ProtoBuf.TYPES["bytes"]: {\r
+                    nBytes = buffer.readVarint32();\r
+                    if (buffer.remaining() < nBytes)\r
+                        throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());\r
+                    value = buffer.clone(); // Offset already set\r
+                    value.limit = value.offset+nBytes;\r
+                    buffer.offset += nBytes;\r
+                    return value;\r
+                }\r
+\r
+                // Length-delimited embedded message\r
+                case ProtoBuf.TYPES["message"]: {\r
+                    nBytes = buffer.readVarint32();\r
+                    return this.resolvedType.decode(buffer, nBytes);\r
+                }\r
+\r
+                // Legacy group\r
+                case ProtoBuf.TYPES["group"]:\r
+                    return this.resolvedType.decode(buffer, -1, id);\r
+            }\r
+\r
+            // We should never end here\r
+            throw Error("[INTERNAL] Illegal decode type");\r
+        };\r
+\r
+        /**\r
+         * Converts a value from a string to the canonical element type.\r
+         *\r
+         * Legal only when isMapKey is true.\r
+         *\r
+         * @param {string} str The string value\r
+         * @returns {*} The value\r
+         */\r
+        ElementPrototype.valueFromString = function(str) {\r
+            if (!this.isMapKey) {\r
+                throw Error("valueFromString() called on non-map-key element");\r
+            }\r
+\r
+            switch (this.type) {\r
+                case ProtoBuf.TYPES["int32"]:\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    return this.verifyValue(parseInt(str));\r
+\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                      // Long-based fields support conversions from string already.\r
+                      return this.verifyValue(str);\r
+\r
+                case ProtoBuf.TYPES["bool"]:\r
+                      return str === "true";\r
+\r
+                case ProtoBuf.TYPES["string"]:\r
+                      return this.verifyValue(str);\r
+\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                      return ByteBuffer.fromBinary(str);\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Converts a value from the canonical element type to a string.\r
+         *\r
+         * It should be the case that `valueFromString(valueToString(val))` returns\r
+         * a value equivalent to `verifyValue(val)` for every legal value of `val`\r
+         * according to this element type.\r
+         *\r
+         * This may be used when the element must be stored or used as a string,\r
+         * e.g., as a map key on an Object.\r
+         *\r
+         * Legal only when isMapKey is true.\r
+         *\r
+         * @param {*} val The value\r
+         * @returns {string} The string form of the value.\r
+         */\r
+        ElementPrototype.valueToString = function(value) {\r
+            if (!this.isMapKey) {\r
+                throw Error("valueToString() called on non-map-key element");\r
+            }\r
+\r
+            if (this.type === ProtoBuf.TYPES["bytes"]) {\r
+                return value.toString("binary");\r
+            } else {\r
+                return value.toString();\r
+            }\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Element\r
+         * @expose\r
+         */\r
+        Reflect.Element = Element;\r
+\r
+        /**\r
+         * Constructs a new Message.\r
+         * @exports ProtoBuf.Reflect.Message\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace\r
+         * @param {string} name Message name\r
+         * @param {Object.<string,*>=} options Message options\r
+         * @param {boolean=} isGroup `true` if this is a legacy group\r
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Namespace\r
+         */\r
+        var Message = function(builder, parent, name, options, isGroup, syntax) {\r
+            Namespace.call(this, builder, parent, name, options, syntax);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Message";\r
+\r
+            /**\r
+             * Extensions range.\r
+             * @type {!Array.<number>|undefined}\r
+             * @expose\r
+             */\r
+            this.extensions = undefined;\r
+\r
+            /**\r
+             * Runtime message class.\r
+             * @type {?function(new:ProtoBuf.Builder.Message)}\r
+             * @expose\r
+             */\r
+            this.clazz = null;\r
+\r
+            /**\r
+             * Whether this is a legacy group or not.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.isGroup = !!isGroup;\r
+\r
+            // The following cached collections are used to efficiently iterate over or look up fields when decoding.\r
+\r
+            /**\r
+             * Cached fields.\r
+             * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}\r
+             * @private\r
+             */\r
+            this._fields = null;\r
+\r
+            /**\r
+             * Cached fields by id.\r
+             * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}\r
+             * @private\r
+             */\r
+            this._fieldsById = null;\r
+\r
+            /**\r
+             * Cached fields by name.\r
+             * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}\r
+             * @private\r
+             */\r
+            this._fieldsByName = null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.prototype\r
+         * @inner\r
+         */\r
+        var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);\r
+\r
+        /**\r
+         * Builds the message and returns the runtime counterpart, which is a fully functional class.\r
+         * @see ProtoBuf.Builder.Message\r
+         * @param {boolean=} rebuild Whether to rebuild or not, defaults to false\r
+         * @return {ProtoBuf.Reflect.Message} Message class\r
+         * @throws {Error} If the message cannot be built\r
+         * @expose\r
+         */\r
+        MessagePrototype.build = function(rebuild) {\r
+            if (this.clazz && !rebuild)\r
+                return this.clazz;\r
+\r
+            // Create the runtime Message class in its own scope\r
+            var clazz = (function(ProtoBuf, T) {\r
+\r
+                var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),\r
+                    oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);\r
+\r
+                /**\r
+                 * Constructs a new runtime Message.\r
+                 * @name ProtoBuf.Builder.Message\r
+                 * @class Barebone of all runtime messages.\r
+                 * @param {!Object.<string,*>|string} values Preset values\r
+                 * @param {...string} var_args\r
+                 * @constructor\r
+                 * @throws {Error} If the message cannot be created\r
+                 */\r
+                var Message = function(values, var_args) {\r
+                    ProtoBuf.Builder.Message.call(this);\r
+\r
+                    // Create virtual oneof properties\r
+                    for (var i=0, k=oneofs.length; i<k; ++i)\r
+                        this[oneofs[i].name] = null;\r
+                    // Create fields and set default values\r
+                    for (i=0, k=fields.length; i<k; ++i) {\r
+                        var field = fields[i];\r
+                        this[field.name] =\r
+                            field.repeated ? [] :\r
+                            (field.map ? new ProtoBuf.Map(field) : null);\r
+                        if ((field.required || T.syntax === 'proto3') &&\r
+                            field.defaultValue !== null)\r
+                            this[field.name] = field.defaultValue;\r
+                    }\r
+\r
+                    if (arguments.length > 0) {\r
+                        var value;\r
+                        // Set field values from a values object\r
+                        if (arguments.length === 1 && values !== null && typeof values === 'object' &&\r
+                            /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&\r
+                            /* not a repeated field */ !Array.isArray(values) &&\r
+                            /* not a Map */ !(values instanceof ProtoBuf.Map) &&\r
+                            /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&\r
+                            /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&\r
+                            /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {\r
+                            this.$set(values);\r
+                        } else // Set field values from arguments, in declaration order\r
+                            for (i=0, k=arguments.length; i<k; ++i)\r
+                                if (typeof (value = arguments[i]) !== 'undefined')\r
+                                    this.$set(fields[i].name, value); // May throw\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * @alias ProtoBuf.Builder.Message.prototype\r
+                 * @inner\r
+                 */\r
+                var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);\r
+\r
+                /**\r
+                 * Adds a value to a repeated field.\r
+                 * @name ProtoBuf.Builder.Message#add\r
+                 * @function\r
+                 * @param {string} key Field name\r
+                 * @param {*} value Value to add\r
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)\r
+                 * @returns {!ProtoBuf.Builder.Message} this\r
+                 * @throws {Error} If the value cannot be added\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.add = function(key, value, noAssert) {\r
+                    var field = T._fieldsByName[key];\r
+                    if (!noAssert) {\r
+                        if (!field)\r
+                            throw Error(this+"#"+key+" is undefined");\r
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                            throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message\r
+                        if (!field.repeated)\r
+                            throw Error(this+"#"+key+" is not a repeated field");\r
+                        value = field.verifyValue(value, true);\r
+                    }\r
+                    if (this[key] === null)\r
+                        this[key] = [];\r
+                    this[key].push(value);\r
+                    return this;\r
+                };\r
+\r
+                /**\r
+                 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.\r
+                 * @name ProtoBuf.Builder.Message#$add\r
+                 * @function\r
+                 * @param {string} key Field name\r
+                 * @param {*} value Value to add\r
+                 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)\r
+                 * @returns {!ProtoBuf.Builder.Message} this\r
+                 * @throws {Error} If the value cannot be added\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.$add = MessagePrototype.add;\r
+\r
+                /**\r
+                 * Sets a field's value.\r
+                 * @name ProtoBuf.Builder.Message#set\r
+                 * @function\r
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values\r
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted\r
+                 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`\r
+                 * @returns {!ProtoBuf.Builder.Message} this\r
+                 * @throws {Error} If the value cannot be set\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.set = function(keyOrObj, value, noAssert) {\r
+                    if (keyOrObj && typeof keyOrObj === 'object') {\r
+                        noAssert = value;\r
+                        for (var ikey in keyOrObj) {\r
+                            // Check if virtual oneof field - don't set these\r
+                            if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)\r
+                                this.$set(ikey, value, noAssert);\r
+                        }\r
+                        return this;\r
+                    }\r
+                    var field = T._fieldsByName[keyOrObj];\r
+                    if (!noAssert) {\r
+                        if (!field)\r
+                            throw Error(this+"#"+keyOrObj+" is not a field: undefined");\r
+                        if (!(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                            throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));\r
+                        this[field.name] = (value = field.verifyValue(value)); // May throw\r
+                    } else\r
+                        this[keyOrObj] = value;\r
+                    if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)\r
+                        var currentField = this[field.oneof.name]; // Virtual field references currently set field\r
+                        if (value !== null) {\r
+                            if (currentField !== null && currentField !== field.name)\r
+                                this[currentField] = null; // Clear currently set field\r
+                            this[field.oneof.name] = field.name; // Point virtual field at this field\r
+                        } else if (/* value === null && */currentField === keyOrObj)\r
+                            this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)\r
+                    }\r
+                    return this;\r
+                };\r
+\r
+                /**\r
+                 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.\r
+                 * @name ProtoBuf.Builder.Message#$set\r
+                 * @function\r
+                 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values\r
+                 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted\r
+                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`\r
+                 * @throws {Error} If the value cannot be set\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.$set = MessagePrototype.set;\r
+\r
+                /**\r
+                 * Gets a field's value.\r
+                 * @name ProtoBuf.Builder.Message#get\r
+                 * @function\r
+                 * @param {string} key Key\r
+                 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`\r
+                 * @return {*} Value\r
+                 * @throws {Error} If there is no such field\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.get = function(key, noAssert) {\r
+                    if (noAssert)\r
+                        return this[key];\r
+                    var field = T._fieldsByName[key];\r
+                    if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                        throw Error(this+"#"+key+" is not a field: undefined");\r
+                    if (!(field instanceof ProtoBuf.Reflect.Message.Field))\r
+                        throw Error(this+"#"+key+" is not a field: "+field.toString(true));\r
+                    return this[field.name];\r
+                };\r
+\r
+                /**\r
+                 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.\r
+                 * @name ProtoBuf.Builder.Message#$get\r
+                 * @function\r
+                 * @param {string} key Key\r
+                 * @return {*} Value\r
+                 * @throws {Error} If there is no such field\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.$get = MessagePrototype.get;\r
+\r
+                // Getters and setters\r
+\r
+                for (var i=0; i<fields.length; i++) {\r
+                    var field = fields[i];\r
+                    // no setters for extension fields as these are named by their fqn\r
+                    if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)\r
+                        continue;\r
+\r
+                    if (T.builder.options['populateAccessors'])\r
+                        (function(field) {\r
+                            // set/get[SomeValue]\r
+                            var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {\r
+                                return match.toUpperCase().replace('_','');\r
+                            });\r
+                            Name = Name.substring(0,1).toUpperCase() + Name.substring(1);\r
+\r
+                            // set/get_[some_value] FIXME: Do we really need these?\r
+                            var name = field.originalName.replace(/([A-Z])/g, function(match) {\r
+                                return "_"+match;\r
+                            });\r
+\r
+                            /**\r
+                             * The current field's unbound setter function.\r
+                             * @function\r
+                             * @param {*} value\r
+                             * @param {boolean=} noAssert\r
+                             * @returns {!ProtoBuf.Builder.Message}\r
+                             * @inner\r
+                             */\r
+                            var setter = function(value, noAssert) {\r
+                                this[field.name] = noAssert ? value : field.verifyValue(value);\r
+                                return this;\r
+                            };\r
+\r
+                            /**\r
+                             * The current field's unbound getter function.\r
+                             * @function\r
+                             * @returns {*}\r
+                             * @inner\r
+                             */\r
+                            var getter = function() {\r
+                                return this[field.name];\r
+                            };\r
+\r
+                            if (T.getChild("set"+Name) === null)\r
+                                /**\r
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#set[SomeField]\r
+                                 * @function\r
+                                 * @param {*} value Value to set\r
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`\r
+                                 * @returns {!ProtoBuf.Builder.Message} this\r
+                                 * @abstract\r
+                                 * @throws {Error} If the value cannot be set\r
+                                 */\r
+                                MessagePrototype["set"+Name] = setter;\r
+\r
+                            if (T.getChild("set_"+name) === null)\r
+                                /**\r
+                                 * Sets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#set_[some_field]\r
+                                 * @function\r
+                                 * @param {*} value Value to set\r
+                                 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`\r
+                                 * @returns {!ProtoBuf.Builder.Message} this\r
+                                 * @abstract\r
+                                 * @throws {Error} If the value cannot be set\r
+                                 */\r
+                                MessagePrototype["set_"+name] = setter;\r
+\r
+                            if (T.getChild("get"+Name) === null)\r
+                                /**\r
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#get[SomeField]\r
+                                 * @function\r
+                                 * @abstract\r
+                                 * @return {*} The value\r
+                                 */\r
+                                MessagePrototype["get"+Name] = getter;\r
+\r
+                            if (T.getChild("get_"+name) === null)\r
+                                /**\r
+                                 * Gets a value. This method is present for each field, but only if there is no name conflict with\r
+                                 *  another field.\r
+                                 * @name ProtoBuf.Builder.Message#get_[some_field]\r
+                                 * @function\r
+                                 * @return {*} The value\r
+                                 * @abstract\r
+                                 */\r
+                                MessagePrototype["get_"+name] = getter;\r
+\r
+                        })(field);\r
+                }\r
+\r
+                // En-/decoding\r
+\r
+                /**\r
+                 * Encodes the message.\r
+                 * @name ProtoBuf.Builder.Message#$encode\r
+                 * @function\r
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.\r
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 * @see ProtoBuf.Builder.Message#encode64\r
+                 * @see ProtoBuf.Builder.Message#encodeHex\r
+                 * @see ProtoBuf.Builder.Message#encodeAB\r
+                 */\r
+                MessagePrototype.encode = function(buffer, noVerify) {\r
+                    if (typeof buffer === 'boolean')\r
+                        noVerify = buffer,\r
+                        buffer = undefined;\r
+                    var isNew = false;\r
+                    if (!buffer)\r
+                        buffer = new ByteBuffer(),\r
+                        isNew = true;\r
+                    var le = buffer.littleEndian;\r
+                    try {\r
+                        T.encode(this, buffer.LE(), noVerify);\r
+                        return (isNew ? buffer.flip() : buffer).LE(le);\r
+                    } catch (e) {\r
+                        buffer.LE(le);\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Encodes a message using the specified data payload.\r
+                 * @param {!Object.<string,*>} data Data payload\r
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.\r
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer\r
+                 * @expose\r
+                 */\r
+                Message.encode = function(data, buffer, noVerify) {\r
+                    return new Message(data).encode(buffer, noVerify);\r
+                };\r
+\r
+                /**\r
+                 * Calculates the byte length of the message.\r
+                 * @name ProtoBuf.Builder.Message#calculate\r
+                 * @function\r
+                 * @returns {number} Byte length\r
+                 * @throws {Error} If the message cannot be calculated or if required fields are missing.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.calculate = function() {\r
+                    return T.calculate(this);\r
+                };\r
+\r
+                /**\r
+                 * Encodes the varint32 length-delimited message.\r
+                 * @name ProtoBuf.Builder.Message#encodeDelimited\r
+                 * @function\r
+                 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.\r
+                 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+                 * @return {!ByteBuffer} Encoded message as a ByteBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ByteBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeDelimited = function(buffer, noVerify) {\r
+                    var isNew = false;\r
+                    if (!buffer)\r
+                        buffer = new ByteBuffer(),\r
+                        isNew = true;\r
+                    var enc = new ByteBuffer().LE();\r
+                    T.encode(this, enc, noVerify).flip();\r
+                    buffer.writeVarint32(enc.remaining());\r
+                    buffer.append(enc);\r
+                    return isNew ? buffer.flip() : buffer;\r
+                };\r
+\r
+                /**\r
+                 * Directly encodes the message to an ArrayBuffer.\r
+                 * @name ProtoBuf.Builder.Message#encodeAB\r
+                 * @function\r
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeAB = function() {\r
+                    try {\r
+                        return this.encode().toArrayBuffer();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.\r
+                 * @name ProtoBuf.Builder.Message#toArrayBuffer\r
+                 * @function\r
+                 * @return {ArrayBuffer} Encoded message as ArrayBuffer\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded ArrayBuffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;\r
+\r
+                /**\r
+                 * Directly encodes the message to a node Buffer.\r
+                 * @name ProtoBuf.Builder.Message#encodeNB\r
+                 * @function\r
+                 * @return {!Buffer}\r
+                 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are\r
+                 *  missing. The later still returns the encoded node Buffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeNB = function() {\r
+                    try {\r
+                        return this.encode().toBuffer();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.\r
+                 * @name ProtoBuf.Builder.Message#toBuffer\r
+                 * @function\r
+                 * @return {!Buffer}\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded node Buffer in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toBuffer = MessagePrototype.encodeNB;\r
+\r
+                /**\r
+                 * Directly encodes the message to a base64 encoded string.\r
+                 * @name ProtoBuf.Builder.Message#encode64\r
+                 * @function\r
+                 * @return {string} Base64 encoded string\r
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later\r
+                 *  still returns the encoded base64 string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encode64 = function() {\r
+                    try {\r
+                        return this.encode().toBase64();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.\r
+                 * @name ProtoBuf.Builder.Message#toBase64\r
+                 * @function\r
+                 * @return {string} Base64 encoded string\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded base64 string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toBase64 = MessagePrototype.encode64;\r
+\r
+                /**\r
+                 * Directly encodes the message to a hex encoded string.\r
+                 * @name ProtoBuf.Builder.Message#encodeHex\r
+                 * @function\r
+                 * @return {string} Hex encoded string\r
+                 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later\r
+                 *  still returns the encoded hex string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeHex = function() {\r
+                    try {\r
+                        return this.encode().toHex();\r
+                    } catch (e) {\r
+                        if (e["encoded"]) e["encoded"] = e["encoded"].toHex();\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.\r
+                 * @name ProtoBuf.Builder.Message#toHex\r
+                 * @function\r
+                 * @return {string} Hex encoded string\r
+                 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still\r
+                 *  returns the encoded hex string in the `encoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toHex = MessagePrototype.encodeHex;\r
+\r
+                /**\r
+                 * Clones a message object or field value to a raw object.\r
+                 * @param {*} obj Object to clone\r
+                 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise\r
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings\r
+                 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field\r
+                 * @returns {*} Cloned object\r
+                 * @inner\r
+                 */\r
+                function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {\r
+                    if (obj === null || typeof obj !== 'object') {\r
+                        // Convert enum values to their respective names\r
+                        if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {\r
+                            var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);\r
+                            if (name !== null)\r
+                                return name;\r
+                        }\r
+                        // Pass-through string, number, boolean, null...\r
+                        return obj;\r
+                    }\r
+                    // Convert ByteBuffers to raw buffer or strings\r
+                    if (ByteBuffer.isByteBuffer(obj))\r
+                        return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();\r
+                    // Convert Longs to proper objects or strings\r
+                    if (ProtoBuf.Long.isLong(obj))\r
+                        return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);\r
+                    var clone;\r
+                    // Clone arrays\r
+                    if (Array.isArray(obj)) {\r
+                        clone = [];\r
+                        obj.forEach(function(v, k) {\r
+                            clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);\r
+                        });\r
+                        return clone;\r
+                    }\r
+                    clone = {};\r
+                    // Convert maps to objects\r
+                    if (obj instanceof ProtoBuf.Map) {\r
+                        var it = obj.entries();\r
+                        for (var e = it.next(); !e.done; e = it.next())\r
+                            clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);\r
+                        return clone;\r
+                    }\r
+                    // Everything else is a non-null object\r
+                    var type = obj.$type,\r
+                        field = undefined;\r
+                    for (var i in obj)\r
+                        if (obj.hasOwnProperty(i)) {\r
+                            if (type && (field = type.getChild(i)))\r
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);\r
+                            else\r
+                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);\r
+                        }\r
+                    return clone;\r
+                }\r
+\r
+                /**\r
+                 * Returns the message's raw payload.\r
+                 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`\r
+                 * @param {boolean} longsAsStrings Whether to encode longs as strings\r
+                 * @returns {Object.<string,*>} Raw payload\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {\r
+                    return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);\r
+                };\r
+\r
+                /**\r
+                 * Encodes a message to JSON.\r
+                 * @returns {string} JSON string\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.encodeJSON = function() {\r
+                    return JSON.stringify(\r
+                        cloneRaw(this,\r
+                             /* binary-as-base64 */ true,\r
+                             /* longs-as-strings */ true,\r
+                             this.$type\r
+                        )\r
+                    );\r
+                };\r
+\r
+                /**\r
+                 * Decodes a message from the specified buffer or string.\r
+                 * @name ProtoBuf.Builder.Message.decode\r
+                 * @function\r
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from\r
+                 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.\r
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 * @see ProtoBuf.Builder.Message.decode64\r
+                 * @see ProtoBuf.Builder.Message.decodeHex\r
+                 */\r
+                Message.decode = function(buffer, length, enc) {\r
+                    if (typeof length === 'string')\r
+                        enc = length,\r
+                        length = -1;\r
+                    if (typeof buffer === 'string')\r
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");\r
+                    else if (!ByteBuffer.isByteBuffer(buffer))\r
+                        buffer = ByteBuffer.wrap(buffer); // May throw\r
+                    var le = buffer.littleEndian;\r
+                    try {\r
+                        var msg = T.decode(buffer.LE(), length);\r
+                        buffer.LE(le);\r
+                        return msg;\r
+                    } catch (e) {\r
+                        buffer.LE(le);\r
+                        throw(e);\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Decodes a varint32 length-delimited message from the specified buffer or string.\r
+                 * @name ProtoBuf.Builder.Message.decodeDelimited\r
+                 * @function\r
+                 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from\r
+                 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64\r
+                 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                Message.decodeDelimited = function(buffer, enc) {\r
+                    if (typeof buffer === 'string')\r
+                        buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");\r
+                    else if (!ByteBuffer.isByteBuffer(buffer))\r
+                        buffer = ByteBuffer.wrap(buffer); // May throw\r
+                    if (buffer.remaining() < 1)\r
+                        return null;\r
+                    var off = buffer.offset,\r
+                        len = buffer.readVarint32();\r
+                    if (buffer.remaining() < len) {\r
+                        buffer.offset = off;\r
+                        return null;\r
+                    }\r
+                    try {\r
+                        var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());\r
+                        buffer.offset += len;\r
+                        return msg;\r
+                    } catch (err) {\r
+                        buffer.offset += len;\r
+                        throw err;\r
+                    }\r
+                };\r
+\r
+                /**\r
+                 * Decodes the message from the specified base64 encoded string.\r
+                 * @name ProtoBuf.Builder.Message.decode64\r
+                 * @function\r
+                 * @param {string} str String to decode from\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                Message.decode64 = function(str) {\r
+                    return Message.decode(str, "base64");\r
+                };\r
+\r
+                /**\r
+                 * Decodes the message from the specified hex encoded string.\r
+                 * @name ProtoBuf.Builder.Message.decodeHex\r
+                 * @function\r
+                 * @param {string} str String to decode from\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still\r
+                 *  returns the decoded message with missing fields in the `decoded` property on the error.\r
+                 * @expose\r
+                 */\r
+                Message.decodeHex = function(str) {\r
+                    return Message.decode(str, "hex");\r
+                };\r
+\r
+                /**\r
+                 * Decodes the message from a JSON string.\r
+                 * @name ProtoBuf.Builder.Message.decodeJSON\r
+                 * @function\r
+                 * @param {string} str String to decode from\r
+                 * @return {!ProtoBuf.Builder.Message} Decoded message\r
+                 * @throws {Error} If the message cannot be decoded or if required fields are\r
+                 * missing.\r
+                 * @expose\r
+                 */\r
+                Message.decodeJSON = function(str) {\r
+                    return new Message(JSON.parse(str));\r
+                };\r
+\r
+                // Utility\r
+\r
+                /**\r
+                 * Returns a string representation of this Message.\r
+                 * @name ProtoBuf.Builder.Message#toString\r
+                 * @function\r
+                 * @return {string} String representation as of ".Fully.Qualified.MessageName"\r
+                 * @expose\r
+                 */\r
+                MessagePrototype.toString = function() {\r
+                    return T.toString();\r
+                };\r
+\r
+                // Properties\r
+\r
+                /**\r
+                 * Message options.\r
+                 * @name ProtoBuf.Builder.Message.$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $optionsS; // cc needs this\r
+\r
+                /**\r
+                 * Message options.\r
+                 * @name ProtoBuf.Builder.Message#$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $options;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Message.$type\r
+                 * @type {!ProtoBuf.Reflect.Message}\r
+                 * @expose\r
+                 */\r
+                var $typeS;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Message#$type\r
+                 * @type {!ProtoBuf.Reflect.Message}\r
+                 * @expose\r
+                 */\r
+                var $type;\r
+\r
+                if (Object.defineProperty)\r
+                    Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),\r
+                    Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),\r
+                    Object.defineProperty(Message, "$type", { "value": T }),\r
+                    Object.defineProperty(MessagePrototype, "$type", { "value": T });\r
+\r
+                return Message;\r
+\r
+            })(ProtoBuf, this);\r
+\r
+            // Static enums and prototyped sub-messages / cached collections\r
+            this._fields = [];\r
+            this._fieldsById = {};\r
+            this._fieldsByName = {};\r
+            this._oneofsByName = {};\r
+            for (var i=0, k=this.children.length, child; i<k; i++) {\r
+                child = this.children[i];\r
+                if (child instanceof Enum || child instanceof Message || child instanceof Service) {\r
+                    if (clazz.hasOwnProperty(child.name))\r
+                        throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");\r
+                    clazz[child.name] = child.build();\r
+                } else if (child instanceof Message.Field)\r
+                    child.build(),\r
+                    this._fields.push(child),\r
+                    this._fieldsById[child.id] = child,\r
+                    this._fieldsByName[child.name] = child;\r
+                else if (child instanceof Message.OneOf) {\r
+                    this._oneofsByName[child.name] = child;\r
+                }\r
+                else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built\r
+                    throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));\r
+            }\r
+\r
+            return this.clazz = clazz;\r
+        };\r
+\r
+        /**\r
+         * Encodes a runtime message's contents to the specified buffer.\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode\r
+         * @param {ByteBuffer} buffer ByteBuffer to write to\r
+         * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`\r
+         * @return {ByteBuffer} The ByteBuffer for chaining\r
+         * @throws {Error} If required fields are missing or the message cannot be encoded for another reason\r
+         * @expose\r
+         */\r
+        MessagePrototype.encode = function(message, buffer, noVerify) {\r
+            var fieldMissing = null,\r
+                field;\r
+            for (var i=0, k=this._fields.length, val; i<k; ++i) {\r
+                field = this._fields[i];\r
+                val = message[field.name];\r
+                if (field.required && val === null) {\r
+                    if (fieldMissing === null)\r
+                        fieldMissing = field;\r
+                } else\r
+                    field.encode(noVerify ? val : field.verifyValue(val), buffer, message);\r
+            }\r
+            if (fieldMissing !== null) {\r
+                var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);\r
+                err["encoded"] = buffer; // Still expose what we got\r
+                throw(err);\r
+            }\r
+            return buffer;\r
+        };\r
+\r
+        /**\r
+         * Calculates a runtime message's byte length.\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message to encode\r
+         * @returns {number} Byte length\r
+         * @throws {Error} If required fields are missing or the message cannot be calculated for another reason\r
+         * @expose\r
+         */\r
+        MessagePrototype.calculate = function(message) {\r
+            for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {\r
+                field = this._fields[i];\r
+                val = message[field.name];\r
+                if (field.required && val === null)\r
+                   throw Error("Missing at least one required field for "+this.toString(true)+": "+field);\r
+                else\r
+                    n += field.calculate(val, message);\r
+            }\r
+            return n;\r
+        };\r
+\r
+        /**\r
+         * Skips all data until the end of the specified group has been reached.\r
+         * @param {number} expectedId Expected GROUPEND id\r
+         * @param {!ByteBuffer} buf ByteBuffer\r
+         * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached\r
+         * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)\r
+         * @inner\r
+         */\r
+        function skipTillGroupEnd(expectedId, buf) {\r
+            var tag = buf.readVarint32(), // Throws on OOB\r
+                wireType = tag & 0x07,\r
+                id = tag >>> 3;\r
+            switch (wireType) {\r
+                case ProtoBuf.WIRE_TYPES.VARINT:\r
+                    do tag = buf.readUint8();\r
+                    while ((tag & 0x80) === 0x80);\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.BITS64:\r
+                    buf.offset += 8;\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.LDELIM:\r
+                    tag = buf.readVarint32(); // reads the varint\r
+                    buf.offset += tag;        // skips n bytes\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.STARTGROUP:\r
+                    skipTillGroupEnd(id, buf);\r
+                    break;\r
+                case ProtoBuf.WIRE_TYPES.ENDGROUP:\r
+                    if (id === expectedId)\r
+                        return false;\r
+                    else\r
+                        throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");\r
+                case ProtoBuf.WIRE_TYPES.BITS32:\r
+                    buf.offset += 4;\r
+                    break;\r
+                default:\r
+                    throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);\r
+            }\r
+            return true;\r
+        }\r
+\r
+        /**\r
+         * Decodes an encoded message and returns the decoded message.\r
+         * @param {ByteBuffer} buffer ByteBuffer to decode from\r
+         * @param {number=} length Message length. Defaults to decode all remaining data.\r
+         * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group\r
+         * @return {ProtoBuf.Builder.Message} Decoded message\r
+         * @throws {Error} If the message cannot be decoded\r
+         * @expose\r
+         */\r
+        MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {\r
+            if (typeof length !== 'number')\r
+                length = -1;\r
+            var start = buffer.offset,\r
+                msg = new (this.clazz)(),\r
+                tag, wireType, id, field;\r
+            while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {\r
+                tag = buffer.readVarint32();\r
+                wireType = tag & 0x07;\r
+                id = tag >>> 3;\r
+                if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {\r
+                    if (id !== expectedGroupEndId)\r
+                        throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");\r
+                    break;\r
+                }\r
+                if (!(field = this._fieldsById[id])) {\r
+                    // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."\r
+                    switch (wireType) {\r
+                        case ProtoBuf.WIRE_TYPES.VARINT:\r
+                            buffer.readVarint32();\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.BITS32:\r
+                            buffer.offset += 4;\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.BITS64:\r
+                            buffer.offset += 8;\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.LDELIM:\r
+                            var len = buffer.readVarint32();\r
+                            buffer.offset += len;\r
+                            break;\r
+                        case ProtoBuf.WIRE_TYPES.STARTGROUP:\r
+                            while (skipTillGroupEnd(id, buffer)) {}\r
+                            break;\r
+                        default:\r
+                            throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);\r
+                    }\r
+                    continue;\r
+                }\r
+                if (field.repeated && !field.options["packed"]) {\r
+                    msg[field.name].push(field.decode(wireType, buffer));\r
+                } else if (field.map) {\r
+                    var keyval = field.decode(wireType, buffer);\r
+                    msg[field.name].set(keyval[0], keyval[1]);\r
+                } else {\r
+                    msg[field.name] = field.decode(wireType, buffer);\r
+                    if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)\r
+                        var currentField = msg[field.oneof.name]; // Virtual field references currently set field\r
+                        if (currentField !== null && currentField !== field.name)\r
+                            msg[currentField] = null; // Clear currently set field\r
+                        msg[field.oneof.name] = field.name; // Point virtual field at this field\r
+                    }\r
+                }\r
+            }\r
+\r
+            // Check if all required fields are present and set default values for optional fields that are not\r
+            for (var i=0, k=this._fields.length; i<k; ++i) {\r
+                field = this._fields[i];\r
+                if (msg[field.name] === null) {\r
+                    if (this.syntax === "proto3") { // Proto3 sets default values by specification\r
+                        msg[field.name] = field.defaultValue;\r
+                    } else if (field.required) {\r
+                        var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);\r
+                        err["decoded"] = msg; // Still expose what we got\r
+                        throw(err);\r
+                    } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)\r
+                        msg[field.name] = field.defaultValue;\r
+                }\r
+            }\r
+            return msg;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message\r
+         * @expose\r
+         */\r
+        Reflect.Message = Message;\r
+\r
+        /**\r
+         * Constructs a new Message Field.\r
+         * @exports ProtoBuf.Reflect.Message.Field\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Message} message Message reference\r
+         * @param {string} rule Rule, one of requried, optional, repeated\r
+         * @param {string?} keytype Key data type, if any.\r
+         * @param {string} type Data type, e.g. int32\r
+         * @param {string} name Field name\r
+         * @param {number} id Unique field id\r
+         * @param {Object.<string,*>=} options Options\r
+         * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf\r
+         * @param {string?} syntax The syntax level of this definition (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {\r
+            T.call(this, builder, message, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Message.Field";\r
+\r
+            /**\r
+             * Message field required flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.required = rule === "required";\r
+\r
+            /**\r
+             * Message field repeated flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.repeated = rule === "repeated";\r
+\r
+            /**\r
+             * Message field map flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.map = rule === "map";\r
+\r
+            /**\r
+             * Message field key type. Type reference string if unresolved, protobuf\r
+             * type if resolved. Valid only if this.map === true, null otherwise.\r
+             * @type {string|{name: string, wireType: number}|null}\r
+             * @expose\r
+             */\r
+            this.keyType = keytype || null;\r
+\r
+            /**\r
+             * Message field type. Type reference string if unresolved, protobuf type if\r
+             * resolved. In a map field, this is the value type.\r
+             * @type {string|{name: string, wireType: number}}\r
+             * @expose\r
+             */\r
+            this.type = type;\r
+\r
+            /**\r
+             * Resolved type reference inside the global namespace.\r
+             * @type {ProtoBuf.Reflect.T|null}\r
+             * @expose\r
+             */\r
+            this.resolvedType = null;\r
+\r
+            /**\r
+             * Unique message field id.\r
+             * @type {number}\r
+             * @expose\r
+             */\r
+            this.id = id;\r
+\r
+            /**\r
+             * Message field options.\r
+             * @type {!Object.<string,*>}\r
+             * @dict\r
+             * @expose\r
+             */\r
+            this.options = options || {};\r
+\r
+            /**\r
+             * Default value.\r
+             * @type {*}\r
+             * @expose\r
+             */\r
+            this.defaultValue = null;\r
+\r
+            /**\r
+             * Enclosing OneOf.\r
+             * @type {?ProtoBuf.Reflect.Message.OneOf}\r
+             * @expose\r
+             */\r
+            this.oneof = oneof || null;\r
+\r
+            /**\r
+             * Syntax level of this definition (e.g., proto3).\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.syntax = syntax || 'proto2';\r
+\r
+            /**\r
+             * Original field name.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.originalName = this.name; // Used to revert camelcase transformation on naming collisions\r
+\r
+            /**\r
+             * Element implementation. Created in build() after types are resolved.\r
+             * @type {ProtoBuf.Element}\r
+             * @expose\r
+             */\r
+            this.element = null;\r
+\r
+            /**\r
+             * Key element implementation, for map fields. Created in build() after\r
+             * types are resolved.\r
+             * @type {ProtoBuf.Element}\r
+             * @expose\r
+             */\r
+            this.keyElement = null;\r
+\r
+            // Convert field names to camel case notation if the override is set\r
+            if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))\r
+                this.name = ProtoBuf.Util.toCamelCase(this.name);\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.Field.prototype\r
+         * @inner\r
+         */\r
+        var FieldPrototype = Field.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * Builds the field.\r
+         * @override\r
+         * @expose\r
+         */\r
+        FieldPrototype.build = function() {\r
+            this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);\r
+            if (this.map)\r
+                this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);\r
+\r
+            // In proto3, fields do not have field presence, and every field is set to\r
+            // its type's default value ("", 0, 0.0, or false).\r
+            if (this.syntax === 'proto3' && !this.repeated && !this.map)\r
+                this.defaultValue = Element.defaultFieldValue(this.type);\r
+\r
+            // Otherwise, default values are present when explicitly specified\r
+            else if (typeof this.options['default'] !== 'undefined')\r
+                this.defaultValue = this.verifyValue(this.options['default']);\r
+        };\r
+\r
+        /**\r
+         * Checks if the given value can be set for this field.\r
+         * @param {*} value Value to check\r
+         * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.\r
+         * @return {*} Verified, maybe adjusted, value\r
+         * @throws {Error} If the value cannot be set for this field\r
+         * @expose\r
+         */\r
+        FieldPrototype.verifyValue = function(value, skipRepeated) {\r
+            skipRepeated = skipRepeated || false;\r
+            var self = this;\r
+            function fail(val, msg) {\r
+                throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");\r
+            }\r
+            if (value === null) { // NULL values for optional fields\r
+                if (this.required)\r
+                    fail(typeof value, "required");\r
+                if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])\r
+                    fail(typeof value, "proto3 field without field presence cannot be null");\r
+                return null;\r
+            }\r
+            var i;\r
+            if (this.repeated && !skipRepeated) { // Repeated values as arrays\r
+                if (!Array.isArray(value))\r
+                    value = [value];\r
+                var res = [];\r
+                for (i=0; i<value.length; i++)\r
+                    res.push(this.element.verifyValue(value[i]));\r
+                return res;\r
+            }\r
+            if (this.map && !skipRepeated) { // Map values as objects\r
+                if (!(value instanceof ProtoBuf.Map)) {\r
+                    // If not already a Map, attempt to convert.\r
+                    if (!(value instanceof Object)) {\r
+                        fail(typeof value,\r
+                             "expected ProtoBuf.Map or raw object for map field");\r
+                    }\r
+                    return new ProtoBuf.Map(this, value);\r
+                } else {\r
+                    return value;\r
+                }\r
+            }\r
+            // All non-repeated fields expect no array\r
+            if (!this.repeated && Array.isArray(value))\r
+                fail(typeof value, "no array expected");\r
+\r
+            return this.element.verifyValue(value);\r
+        };\r
+\r
+        /**\r
+         * Determines whether the field will have a presence on the wire given its\r
+         * value.\r
+         * @param {*} value Verified field value\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message\r
+         * @return {boolean} Whether the field will be present on the wire\r
+         */\r
+        FieldPrototype.hasWirePresence = function(value, message) {\r
+            if (this.syntax !== 'proto3')\r
+                return (value !== null);\r
+            if (this.oneof && message[this.oneof.name] === this.name)\r
+                return true;\r
+            switch (this.type) {\r
+                case ProtoBuf.TYPES["int32"]:\r
+                case ProtoBuf.TYPES["sint32"]:\r
+                case ProtoBuf.TYPES["sfixed32"]:\r
+                case ProtoBuf.TYPES["uint32"]:\r
+                case ProtoBuf.TYPES["fixed32"]:\r
+                    return value !== 0;\r
+\r
+                case ProtoBuf.TYPES["int64"]:\r
+                case ProtoBuf.TYPES["sint64"]:\r
+                case ProtoBuf.TYPES["sfixed64"]:\r
+                case ProtoBuf.TYPES["uint64"]:\r
+                case ProtoBuf.TYPES["fixed64"]:\r
+                    return value.low !== 0 || value.high !== 0;\r
+\r
+                case ProtoBuf.TYPES["bool"]:\r
+                    return value;\r
+\r
+                case ProtoBuf.TYPES["float"]:\r
+                case ProtoBuf.TYPES["double"]:\r
+                    return value !== 0.0;\r
+\r
+                case ProtoBuf.TYPES["string"]:\r
+                    return value.length > 0;\r
+\r
+                case ProtoBuf.TYPES["bytes"]:\r
+                    return value.remaining() > 0;\r
+\r
+                case ProtoBuf.TYPES["enum"]:\r
+                    return value !== 0;\r
+\r
+                case ProtoBuf.TYPES["message"]:\r
+                    return value !== null;\r
+                default:\r
+                    return true;\r
+            }\r
+        };\r
+\r
+        /**\r
+         * Encodes the specified field value to the specified buffer.\r
+         * @param {*} value Verified field value\r
+         * @param {ByteBuffer} buffer ByteBuffer to encode to\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message\r
+         * @return {ByteBuffer} The ByteBuffer for chaining\r
+         * @throws {Error} If the field cannot be encoded\r
+         * @expose\r
+         */\r
+        FieldPrototype.encode = function(value, buffer, message) {\r
+            if (this.type === null || typeof this.type !== 'object')\r
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);\r
+            if (value === null || (this.repeated && value.length == 0))\r
+                return buffer; // Optional omitted\r
+            try {\r
+                if (this.repeated) {\r
+                    var i;\r
+                    // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire\r
+                    // types) can be declared 'packed'."\r
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {\r
+                        // "All of the elements of the field are packed into a single key-value pair with wire type 2\r
+                        // (length-delimited). Each element is encoded the same way it would be normally, except without a\r
+                        // tag preceding it."\r
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1\r
+                        var start = buffer.offset; // Remember where the contents begin\r
+                        for (i=0; i<value.length; i++)\r
+                            this.element.encodeValue(this.id, value[i], buffer);\r
+                        var len = buffer.offset-start,\r
+                            varintLen = ByteBuffer.calculateVarint32(len);\r
+                        if (varintLen > 1) { // We need to move the contents\r
+                            var contents = buffer.slice(start, buffer.offset);\r
+                            start += varintLen-1;\r
+                            buffer.offset = start;\r
+                            buffer.append(contents);\r
+                        }\r
+                        buffer.writeVarint32(len, start-varintLen);\r
+                    } else {\r
+                        // "If your message definition has repeated elements (without the [packed=true] option), the encoded\r
+                        // message has zero or more key-value pairs with the same tag number"\r
+                        for (i=0; i<value.length; i++)\r
+                            buffer.writeVarint32((this.id << 3) | this.type.wireType),\r
+                            this.element.encodeValue(this.id, value[i], buffer);\r
+                    }\r
+                } else if (this.map) {\r
+                    // Write out each map entry as a submessage.\r
+                    value.forEach(function(val, key, m) {\r
+                        // Compute the length of the submessage (key, val) pair.\r
+                        var length =\r
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +\r
+                            this.keyElement.calculateLength(1, key) +\r
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +\r
+                            this.element.calculateLength(2, val);\r
+\r
+                        // Submessage with wire type of length-delimited.\r
+                        buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        buffer.writeVarint32(length);\r
+\r
+                        // Write out the key and val.\r
+                        buffer.writeVarint32((1 << 3) | this.keyType.wireType);\r
+                        this.keyElement.encodeValue(1, key, buffer);\r
+                        buffer.writeVarint32((2 << 3) | this.type.wireType);\r
+                        this.element.encodeValue(2, val, buffer);\r
+                    }, this);\r
+                } else {\r
+                    if (this.hasWirePresence(value, message)) {\r
+                        buffer.writeVarint32((this.id << 3) | this.type.wireType);\r
+                        this.element.encodeValue(this.id, value, buffer);\r
+                    }\r
+                }\r
+            } catch (e) {\r
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");\r
+            }\r
+            return buffer;\r
+        };\r
+\r
+        /**\r
+         * Calculates the length of this field's value on the network level.\r
+         * @param {*} value Field value\r
+         * @param {!ProtoBuf.Builder.Message} message Runtime message\r
+         * @returns {number} Byte length\r
+         * @expose\r
+         */\r
+        FieldPrototype.calculate = function(value, message) {\r
+            value = this.verifyValue(value); // May throw\r
+            if (this.type === null || typeof this.type !== 'object')\r
+                throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);\r
+            if (value === null || (this.repeated && value.length == 0))\r
+                return 0; // Optional omitted\r
+            var n = 0;\r
+            try {\r
+                if (this.repeated) {\r
+                    var i, ni;\r
+                    if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {\r
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        ni = 0;\r
+                        for (i=0; i<value.length; i++)\r
+                            ni += this.element.calculateLength(this.id, value[i]);\r
+                        n += ByteBuffer.calculateVarint32(ni);\r
+                        n += ni;\r
+                    } else {\r
+                        for (i=0; i<value.length; i++)\r
+                            n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),\r
+                            n += this.element.calculateLength(this.id, value[i]);\r
+                    }\r
+                } else if (this.map) {\r
+                    // Each map entry becomes a submessage.\r
+                    value.forEach(function(val, key, m) {\r
+                        // Compute the length of the submessage (key, val) pair.\r
+                        var length =\r
+                            ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +\r
+                            this.keyElement.calculateLength(1, key) +\r
+                            ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +\r
+                            this.element.calculateLength(2, val);\r
+\r
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);\r
+                        n += ByteBuffer.calculateVarint32(length);\r
+                        n += length;\r
+                    }, this);\r
+                } else {\r
+                    if (this.hasWirePresence(value, message)) {\r
+                        n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);\r
+                        n += this.element.calculateLength(this.id, value);\r
+                    }\r
+                }\r
+            } catch (e) {\r
+                throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");\r
+            }\r
+            return n;\r
+        };\r
+\r
+        /**\r
+         * Decode the field value from the specified buffer.\r
+         * @param {number} wireType Leading wire type\r
+         * @param {ByteBuffer} buffer ByteBuffer to decode from\r
+         * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.\r
+         * @return {*} Decoded value: array for packed repeated fields, [key, value] for\r
+         *             map fields, or an individual value otherwise.\r
+         * @throws {Error} If the field cannot be decoded\r
+         * @expose\r
+         */\r
+        FieldPrototype.decode = function(wireType, buffer, skipRepeated) {\r
+            var value, nBytes;\r
+\r
+            // We expect wireType to match the underlying type's wireType unless we see\r
+            // a packed repeated field, or unless this is a map field.\r
+            var wireTypeOK =\r
+                (!this.map && wireType == this.type.wireType) ||\r
+                (!skipRepeated && this.repeated && this.options["packed"] &&\r
+                 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||\r
+                (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);\r
+            if (!wireTypeOK)\r
+                throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");\r
+\r
+            // Handle packed repeated fields.\r
+            if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {\r
+                if (!skipRepeated) {\r
+                    nBytes = buffer.readVarint32();\r
+                    nBytes = buffer.offset + nBytes; // Limit\r
+                    var values = [];\r
+                    while (buffer.offset < nBytes)\r
+                        values.push(this.decode(this.type.wireType, buffer, true));\r
+                    return values;\r
+                }\r
+                // Read the next value otherwise...\r
+            }\r
+\r
+            // Handle maps.\r
+            if (this.map) {\r
+                // Read one (key, value) submessage, and return [key, value]\r
+                var key = Element.defaultFieldValue(this.keyType);\r
+                value = Element.defaultFieldValue(this.type);\r
+\r
+                // Read the length\r
+                nBytes = buffer.readVarint32();\r
+                if (buffer.remaining() < nBytes)\r
+                    throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());\r
+\r
+                // Get a sub-buffer of this key/value submessage\r
+                var msgbuf = buffer.clone();\r
+                msgbuf.limit = msgbuf.offset + nBytes;\r
+                buffer.offset += nBytes;\r
+\r
+                while (msgbuf.remaining() > 0) {\r
+                    var tag = msgbuf.readVarint32();\r
+                    wireType = tag & 0x07;\r
+                    var id = tag >>> 3;\r
+                    if (id === 1) {\r
+                        key = this.keyElement.decode(msgbuf, wireType, id);\r
+                    } else if (id === 2) {\r
+                        value = this.element.decode(msgbuf, wireType, id);\r
+                    } else {\r
+                        throw Error("Unexpected tag in map field key/value submessage");\r
+                    }\r
+                }\r
+\r
+                return [key, value];\r
+            }\r
+\r
+            // Handle singular and non-packed repeated field values.\r
+            return this.element.decode(buffer, wireType, this.id);\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.Field\r
+         * @expose\r
+         */\r
+        Reflect.Message.Field = Field;\r
+\r
+        /**\r
+         * Constructs a new Message ExtensionField.\r
+         * @exports ProtoBuf.Reflect.Message.ExtensionField\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Message} message Message reference\r
+         * @param {string} rule Rule, one of requried, optional, repeated\r
+         * @param {string} type Data type, e.g. int32\r
+         * @param {string} name Field name\r
+         * @param {number} id Unique field id\r
+         * @param {!Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Message.Field\r
+         */\r
+        var ExtensionField = function(builder, message, rule, type, name, id, options) {\r
+            Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);\r
+\r
+            /**\r
+             * Extension reference.\r
+             * @type {!ProtoBuf.Reflect.Extension}\r
+             * @expose\r
+             */\r
+            this.extension;\r
+        };\r
+\r
+        // Extends Field\r
+        ExtensionField.prototype = Object.create(Field.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.ExtensionField\r
+         * @expose\r
+         */\r
+        Reflect.Message.ExtensionField = ExtensionField;\r
+\r
+        /**\r
+         * Constructs a new Message OneOf.\r
+         * @exports ProtoBuf.Reflect.Message.OneOf\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Message} message Message reference\r
+         * @param {string} name OneOf name\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var OneOf = function(builder, message, name) {\r
+            T.call(this, builder, message, name);\r
+\r
+            /**\r
+             * Enclosed fields.\r
+             * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}\r
+             * @expose\r
+             */\r
+            this.fields = [];\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Message.OneOf\r
+         * @expose\r
+         */\r
+        Reflect.Message.OneOf = OneOf;\r
+\r
+        /**\r
+         * Constructs a new Enum.\r
+         * @exports ProtoBuf.Reflect.Enum\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object\r
+         * @param {string} name Enum name\r
+         * @param {Object.<string,*>=} options Enum options\r
+         * @param {string?} syntax The syntax level (e.g., proto3)\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Namespace\r
+         */\r
+        var Enum = function(builder, parent, name, options, syntax) {\r
+            Namespace.call(this, builder, parent, name, options, syntax);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Enum";\r
+\r
+            /**\r
+             * Runtime enum object.\r
+             * @type {Object.<string,number>|null}\r
+             * @expose\r
+             */\r
+            this.object = null;\r
+        };\r
+\r
+        /**\r
+         * Gets the string name of an enum value.\r
+         * @param {!ProtoBuf.Builder.Enum} enm Runtime enum\r
+         * @param {number} value Enum value\r
+         * @returns {?string} Name or `null` if not present\r
+         * @expose\r
+         */\r
+        Enum.getName = function(enm, value) {\r
+            var keys = Object.keys(enm);\r
+            for (var i=0, key; i<keys.length; ++i)\r
+                if (enm[key = keys[i]] === value)\r
+                    return key;\r
+            return null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Enum.prototype\r
+         * @inner\r
+         */\r
+        var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);\r
+\r
+        /**\r
+         * Builds this enum and returns the runtime counterpart.\r
+         * @param {boolean} rebuild Whether to rebuild or not, defaults to false\r
+         * @returns {!Object.<string,number>}\r
+         * @expose\r
+         */\r
+        EnumPrototype.build = function(rebuild) {\r
+            if (this.object && !rebuild)\r
+                return this.object;\r
+            var enm = new ProtoBuf.Builder.Enum(),\r
+                values = this.getChildren(Enum.Value);\r
+            for (var i=0, k=values.length; i<k; ++i)\r
+                enm[values[i]['name']] = values[i]['id'];\r
+            if (Object.defineProperty)\r
+                Object.defineProperty(enm, '$options', {\r
+                    "value": this.buildOpt(),\r
+                    "enumerable": false\r
+                });\r
+            return this.object = enm;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Enum\r
+         * @expose\r
+         */\r
+        Reflect.Enum = Enum;\r
+\r
+        /**\r
+         * Constructs a new Enum Value.\r
+         * @exports ProtoBuf.Reflect.Enum.Value\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Enum} enm Enum reference\r
+         * @param {string} name Field name\r
+         * @param {number} id Unique field id\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Value = function(builder, enm, name, id) {\r
+            T.call(this, builder, enm, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Enum.Value";\r
+\r
+            /**\r
+             * Unique enum value id.\r
+             * @type {number}\r
+             * @expose\r
+             */\r
+            this.id = id;\r
+        };\r
+\r
+        // Extends T\r
+        Value.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Enum.Value\r
+         * @expose\r
+         */\r
+        Reflect.Enum.Value = Value;\r
+\r
+        /**\r
+         * An extension (field).\r
+         * @exports ProtoBuf.Reflect.Extension\r
+         * @constructor\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.T} parent Parent object\r
+         * @param {string} name Object name\r
+         * @param {!ProtoBuf.Reflect.Message.Field} field Extension field\r
+         */\r
+        var Extension = function(builder, parent, name, field) {\r
+            T.call(this, builder, parent, name);\r
+\r
+            /**\r
+             * Extended message field.\r
+             * @type {!ProtoBuf.Reflect.Message.Field}\r
+             * @expose\r
+             */\r
+            this.field = field;\r
+        };\r
+\r
+        // Extends T\r
+        Extension.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Extension\r
+         * @expose\r
+         */\r
+        Reflect.Extension = Extension;\r
+\r
+        /**\r
+         * Constructs a new Service.\r
+         * @exports ProtoBuf.Reflect.Service\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Namespace} root Root\r
+         * @param {string} name Service name\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Namespace\r
+         */\r
+        var Service = function(builder, root, name, options) {\r
+            Namespace.call(this, builder, root, name, options);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Service";\r
+\r
+            /**\r
+             * Built runtime service class.\r
+             * @type {?function(new:ProtoBuf.Builder.Service)}\r
+             */\r
+            this.clazz = null;\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.prototype\r
+         * @inner\r
+         */\r
+        var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);\r
+\r
+        /**\r
+         * Builds the service and returns the runtime counterpart, which is a fully functional class.\r
+         * @see ProtoBuf.Builder.Service\r
+         * @param {boolean=} rebuild Whether to rebuild or not\r
+         * @return {Function} Service class\r
+         * @throws {Error} If the message cannot be built\r
+         * @expose\r
+         */\r
+        ServicePrototype.build = function(rebuild) {\r
+            if (this.clazz && !rebuild)\r
+                return this.clazz;\r
+\r
+            // Create the runtime Service class in its own scope\r
+            return this.clazz = (function(ProtoBuf, T) {\r
+\r
+                /**\r
+                 * Constructs a new runtime Service.\r
+                 * @name ProtoBuf.Builder.Service\r
+                 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message\r
+                 * @class Barebone of all runtime services.\r
+                 * @constructor\r
+                 * @throws {Error} If the service cannot be created\r
+                 */\r
+                var Service = function(rpcImpl) {\r
+                    ProtoBuf.Builder.Service.call(this);\r
+\r
+                    /**\r
+                     * Service implementation.\r
+                     * @name ProtoBuf.Builder.Service#rpcImpl\r
+                     * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}\r
+                     * @expose\r
+                     */\r
+                    this.rpcImpl = rpcImpl || function(name, msg, callback) {\r
+                        // This is what a user has to implement: A function receiving the method name, the actual message to\r
+                        // send (type checked) and the callback that's either provided with the error as its first\r
+                        // argument or null and the actual response message.\r
+                        setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!\r
+                    };\r
+                };\r
+\r
+                /**\r
+                 * @alias ProtoBuf.Builder.Service.prototype\r
+                 * @inner\r
+                 */\r
+                var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);\r
+\r
+                /**\r
+                 * Asynchronously performs an RPC call using the given RPC implementation.\r
+                 * @name ProtoBuf.Builder.Service.[Method]\r
+                 * @function\r
+                 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation\r
+                 * @param {ProtoBuf.Builder.Message} req Request\r
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving\r
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes\r
+                 * @abstract\r
+                 */\r
+\r
+                /**\r
+                 * Asynchronously performs an RPC call using the instance's RPC implementation.\r
+                 * @name ProtoBuf.Builder.Service#[Method]\r
+                 * @function\r
+                 * @param {ProtoBuf.Builder.Message} req Request\r
+                 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving\r
+                 *  the error if any and the response either as a pre-parsed message or as its raw bytes\r
+                 * @abstract\r
+                 */\r
+\r
+                var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);\r
+                for (var i=0; i<rpc.length; i++) {\r
+                    (function(method) {\r
+\r
+                        // service#Method(message, callback)\r
+                        ServicePrototype[method.name] = function(req, callback) {\r
+                            try {\r
+                                try {\r
+                                    // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.\r
+                                    req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));\r
+                                } catch (err) {\r
+                                    if (!(err instanceof TypeError))\r
+                                        throw err;\r
+                                }\r
+                                if (req === null || typeof req !== 'object')\r
+                                    throw Error("Illegal arguments");\r
+                                if (!(req instanceof method.resolvedRequestType.clazz))\r
+                                    req = new method.resolvedRequestType.clazz(req);\r
+                                this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async\r
+                                    if (err) {\r
+                                        callback(err);\r
+                                        return;\r
+                                    }\r
+                                    // Coalesce to empty string when service response has empty content\r
+                                    if (res === null)\r
+                                        res = ''\r
+                                    try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}\r
+                                    if (!res || !(res instanceof method.resolvedResponseType.clazz)) {\r
+                                        callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));\r
+                                        return;\r
+                                    }\r
+                                    callback(null, res);\r
+                                });\r
+                            } catch (err) {\r
+                                setTimeout(callback.bind(this, err), 0);\r
+                            }\r
+                        };\r
+\r
+                        // Service.Method(rpcImpl, message, callback)\r
+                        Service[method.name] = function(rpcImpl, req, callback) {\r
+                            new Service(rpcImpl)[method.name](req, callback);\r
+                        };\r
+\r
+                        if (Object.defineProperty)\r
+                            Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),\r
+                            Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });\r
+                    })(rpc[i]);\r
+                }\r
+\r
+                // Properties\r
+\r
+                /**\r
+                 * Service options.\r
+                 * @name ProtoBuf.Builder.Service.$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $optionsS; // cc needs this\r
+\r
+                /**\r
+                 * Service options.\r
+                 * @name ProtoBuf.Builder.Service#$options\r
+                 * @type {Object.<string,*>}\r
+                 * @expose\r
+                 */\r
+                var $options;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Service.$type\r
+                 * @type {!ProtoBuf.Reflect.Service}\r
+                 * @expose\r
+                 */\r
+                var $typeS;\r
+\r
+                /**\r
+                 * Reflection type.\r
+                 * @name ProtoBuf.Builder.Service#$type\r
+                 * @type {!ProtoBuf.Reflect.Service}\r
+                 * @expose\r
+                 */\r
+                var $type;\r
+\r
+                if (Object.defineProperty)\r
+                    Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),\r
+                    Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),\r
+                    Object.defineProperty(Service, "$type", { "value": T }),\r
+                    Object.defineProperty(ServicePrototype, "$type", { "value": T });\r
+\r
+                return Service;\r
+\r
+            })(ProtoBuf, this);\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service\r
+         * @expose\r
+         */\r
+        Reflect.Service = Service;\r
+\r
+        /**\r
+         * Abstract service method.\r
+         * @exports ProtoBuf.Reflect.Service.Method\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Service} svc Service\r
+         * @param {string} name Method name\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.T\r
+         */\r
+        var Method = function(builder, svc, name, options) {\r
+            T.call(this, builder, svc, name);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Service.Method";\r
+\r
+            /**\r
+             * Options.\r
+             * @type {Object.<string, *>}\r
+             * @expose\r
+             */\r
+            this.options = options || {};\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.Method.prototype\r
+         * @inner\r
+         */\r
+        var MethodPrototype = Method.prototype = Object.create(T.prototype);\r
+\r
+        /**\r
+         * Builds the method's '$options' property.\r
+         * @name ProtoBuf.Reflect.Service.Method#buildOpt\r
+         * @function\r
+         * @return {Object.<string,*>}\r
+         */\r
+        MethodPrototype.buildOpt = NamespacePrototype.buildOpt;\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.Method\r
+         * @expose\r
+         */\r
+        Reflect.Service.Method = Method;\r
+\r
+        /**\r
+         * RPC service method.\r
+         * @exports ProtoBuf.Reflect.Service.RPCMethod\r
+         * @param {!ProtoBuf.Builder} builder Builder reference\r
+         * @param {!ProtoBuf.Reflect.Service} svc Service\r
+         * @param {string} name Method name\r
+         * @param {string} request Request message name\r
+         * @param {string} response Response message name\r
+         * @param {boolean} request_stream Whether requests are streamed\r
+         * @param {boolean} response_stream Whether responses are streamed\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         * @extends ProtoBuf.Reflect.Service.Method\r
+         */\r
+        var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {\r
+            Method.call(this, builder, svc, name, options);\r
+\r
+            /**\r
+             * @override\r
+             */\r
+            this.className = "Service.RPCMethod";\r
+\r
+            /**\r
+             * Request message name.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.requestName = request;\r
+\r
+            /**\r
+             * Response message name.\r
+             * @type {string}\r
+             * @expose\r
+             */\r
+            this.responseName = response;\r
+\r
+            /**\r
+             * Whether requests are streamed\r
+             * @type {bool}\r
+             * @expose\r
+             */\r
+            this.requestStream = request_stream;\r
+\r
+            /**\r
+             * Whether responses are streamed\r
+             * @type {bool}\r
+             * @expose\r
+             */\r
+            this.responseStream = response_stream;\r
+\r
+            /**\r
+             * Resolved request message type.\r
+             * @type {ProtoBuf.Reflect.Message}\r
+             * @expose\r
+             */\r
+            this.resolvedRequestType = null;\r
+\r
+            /**\r
+             * Resolved response message type.\r
+             * @type {ProtoBuf.Reflect.Message}\r
+             * @expose\r
+             */\r
+            this.resolvedResponseType = null;\r
+        };\r
+\r
+        // Extends Method\r
+        RPCMethod.prototype = Object.create(Method.prototype);\r
+\r
+        /**\r
+         * @alias ProtoBuf.Reflect.Service.RPCMethod\r
+         * @expose\r
+         */\r
+        Reflect.Service.RPCMethod = RPCMethod;\r
+\r
+        return Reflect;\r
+\r
+    })(ProtoBuf);\r
+\r
+    /**\r
+     * @alias ProtoBuf.Builder\r
+     * @expose\r
+     */\r
+    ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Constructs a new Builder.\r
+         * @exports ProtoBuf.Builder\r
+         * @class Provides the functionality to build protocol messages.\r
+         * @param {Object.<string,*>=} options Options\r
+         * @constructor\r
+         */\r
+        var Builder = function(options) {\r
+\r
+            /**\r
+             * Namespace.\r
+             * @type {ProtoBuf.Reflect.Namespace}\r
+             * @expose\r
+             */\r
+            this.ns = new Reflect.Namespace(this, null, ""); // Global namespace\r
+\r
+            /**\r
+             * Namespace pointer.\r
+             * @type {ProtoBuf.Reflect.T}\r
+             * @expose\r
+             */\r
+            this.ptr = this.ns;\r
+\r
+            /**\r
+             * Resolved flag.\r
+             * @type {boolean}\r
+             * @expose\r
+             */\r
+            this.resolved = false;\r
+\r
+            /**\r
+             * The current building result.\r
+             * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}\r
+             * @expose\r
+             */\r
+            this.result = null;\r
+\r
+            /**\r
+             * Imported files.\r
+             * @type {Array.<string>}\r
+             * @expose\r
+             */\r
+            this.files = {};\r
+\r
+            /**\r
+             * Import root override.\r
+             * @type {?string}\r
+             * @expose\r
+             */\r
+            this.importRoot = null;\r
+\r
+            /**\r
+             * Options.\r
+             * @type {!Object.<string, *>}\r
+             * @expose\r
+             */\r
+            this.options = options || {};\r
+        };\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.prototype\r
+         * @inner\r
+         */\r
+        var BuilderPrototype = Builder.prototype;\r
+\r
+        // ----- Definition tests -----\r
+\r
+        /**\r
+         * Tests if a definition most likely describes a message.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isMessage = function(def) {\r
+            // Messages require a string name\r
+            if (typeof def["name"] !== 'string')\r
+                return false;\r
+            // Messages do not contain values (enum) or rpc methods (service)\r
+            if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes a message field.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isMessageField = function(def) {\r
+            // Message fields require a string rule, name and type and an id\r
+            if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes an enum.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isEnum = function(def) {\r
+            // Enums require a string name\r
+            if (typeof def["name"] !== 'string')\r
+                return false;\r
+            // Enums require at least one value\r
+            if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes a service.\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isService = function(def) {\r
+            // Services require a string name and an rpc object\r
+            if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        /**\r
+         * Tests if a definition most likely describes an extended message\r
+         * @param {!Object} def\r
+         * @returns {boolean}\r
+         * @expose\r
+         */\r
+        Builder.isExtend = function(def) {\r
+            // Extends rquire a string ref\r
+            if (typeof def["ref"] !== 'string')\r
+                return false;\r
+            return true;\r
+        };\r
+\r
+        // ----- Building -----\r
+\r
+        /**\r
+         * Resets the pointer to the root namespace.\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @expose\r
+         */\r
+        BuilderPrototype.reset = function() {\r
+            this.ptr = this.ns;\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Defines a namespace on top of the current pointer position and places the pointer on it.\r
+         * @param {string} namespace\r
+         * @return {!ProtoBuf.Builder} this\r
+         * @expose\r
+         */\r
+        BuilderPrototype.define = function(namespace) {\r
+            if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))\r
+                throw Error("illegal namespace: "+namespace);\r
+            namespace.split(".").forEach(function(part) {\r
+                var ns = this.ptr.getChild(part);\r
+                if (ns === null) // Keep existing\r
+                    this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));\r
+                this.ptr = ns;\r
+            }, this);\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Creates the specified definitions at the current pointer position.\r
+         * @param {!Array.<!Object>} defs Messages, enums or services to create\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @throws {Error} If a message definition is invalid\r
+         * @expose\r
+         */\r
+        BuilderPrototype.create = function(defs) {\r
+            if (!defs)\r
+                return this; // Nothing to create\r
+            if (!Array.isArray(defs))\r
+                defs = [defs];\r
+            else {\r
+                if (defs.length === 0)\r
+                    return this;\r
+                defs = defs.slice();\r
+            }\r
+\r
+            // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.\r
+            var stack = [defs];\r
+            while (stack.length > 0) {\r
+                defs = stack.pop();\r
+\r
+                if (!Array.isArray(defs)) // Stack always contains entire namespaces\r
+                    throw Error("not a valid namespace: "+JSON.stringify(defs));\r
+\r
+                while (defs.length > 0) {\r
+                    var def = defs.shift(); // Namespaces always contain an array of messages, enums and services\r
+\r
+                    if (Builder.isMessage(def)) {\r
+                        var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);\r
+\r
+                        // Create OneOfs\r
+                        var oneofs = {};\r
+                        if (def["oneofs"])\r
+                            Object.keys(def["oneofs"]).forEach(function(name) {\r
+                                obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));\r
+                            }, this);\r
+\r
+                        // Create fields\r
+                        if (def["fields"])\r
+                            def["fields"].forEach(function(fld) {\r
+                                if (obj.getChild(fld["id"]|0) !== null)\r
+                                    throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);\r
+                                if (fld["options"] && typeof fld["options"] !== 'object')\r
+                                    throw Error("illegal field options in "+obj.name+"#"+fld["name"]);\r
+                                var oneof = null;\r
+                                if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))\r
+                                    throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);\r
+                                fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);\r
+                                if (oneof)\r
+                                    oneof.fields.push(fld);\r
+                                obj.addChild(fld);\r
+                            }, this);\r
+\r
+                        // Push children to stack\r
+                        var subObj = [];\r
+                        if (def["enums"])\r
+                            def["enums"].forEach(function(enm) {\r
+                                subObj.push(enm);\r
+                            });\r
+                        if (def["messages"])\r
+                            def["messages"].forEach(function(msg) {\r
+                                subObj.push(msg);\r
+                            });\r
+                        if (def["services"])\r
+                            def["services"].forEach(function(svc) {\r
+                                subObj.push(svc);\r
+                            });\r
+\r
+                        // Set extension ranges\r
+                        if (def["extensions"]) {\r
+                            if (typeof def["extensions"][0] === 'number') // pre 5.0.1\r
+                                obj.extensions = [ def["extensions"] ];\r
+                            else\r
+                                obj.extensions = def["extensions"];\r
+                        }\r
+\r
+                        // Create on top of current namespace\r
+                        this.ptr.addChild(obj);\r
+                        if (subObj.length > 0) {\r
+                            stack.push(defs); // Push the current level back\r
+                            defs = subObj; // Continue processing sub level\r
+                            subObj = null;\r
+                            this.ptr = obj; // And move the pointer to this namespace\r
+                            obj = null;\r
+                            continue;\r
+                        }\r
+                        subObj = null;\r
+\r
+                    } else if (Builder.isEnum(def)) {\r
+\r
+                        obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);\r
+                        def["values"].forEach(function(val) {\r
+                            obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));\r
+                        }, this);\r
+                        this.ptr.addChild(obj);\r
+\r
+                    } else if (Builder.isService(def)) {\r
+\r
+                        obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);\r
+                        Object.keys(def["rpc"]).forEach(function(name) {\r
+                            var mtd = def["rpc"][name];\r
+                            obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));\r
+                        }, this);\r
+                        this.ptr.addChild(obj);\r
+\r
+                    } else if (Builder.isExtend(def)) {\r
+\r
+                        obj = this.ptr.resolve(def["ref"], true);\r
+                        if (obj) {\r
+                            def["fields"].forEach(function(fld) {\r
+                                if (obj.getChild(fld['id']|0) !== null)\r
+                                    throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);\r
+                                // Check if field id is allowed to be extended\r
+                                if (obj.extensions) {\r
+                                    var valid = false;\r
+                                    obj.extensions.forEach(function(range) {\r
+                                        if (fld["id"] >= range[0] && fld["id"] <= range[1])\r
+                                            valid = true;\r
+                                    });\r
+                                    if (!valid)\r
+                                        throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");\r
+                                }\r
+                                // Convert extension field names to camel case notation if the override is set\r
+                                var name = fld["name"];\r
+                                if (this.options['convertFieldsToCamelCase'])\r
+                                    name = ProtoBuf.Util.toCamelCase(name);\r
+                                // see #161: Extensions use their fully qualified name as their runtime key and...\r
+                                var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);\r
+                                // ...are added on top of the current namespace as an extension which is used for\r
+                                // resolving their type later on (the extension always keeps the original name to\r
+                                // prevent naming collisions)\r
+                                var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);\r
+                                field.extension = ext;\r
+                                this.ptr.addChild(ext);\r
+                                obj.addChild(field);\r
+                            }, this);\r
+\r
+                        } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions\r
+                            throw Error("extended message "+def["ref"]+" is not defined");\r
+\r
+                    } else\r
+                        throw Error("not a valid definition: "+JSON.stringify(def));\r
+\r
+                    def = null;\r
+                    obj = null;\r
+                }\r
+                // Break goes here\r
+                defs = null;\r
+                this.ptr = this.ptr.parent; // Namespace done, continue at parent\r
+            }\r
+            this.resolved = false; // Require re-resolve\r
+            this.result = null; // Require re-build\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Propagates syntax to all children.\r
+         * @param {!Object} parent\r
+         * @inner\r
+         */\r
+        function propagateSyntax(parent) {\r
+            if (parent['messages']) {\r
+                parent['messages'].forEach(function(child) {\r
+                    child["syntax"] = parent["syntax"];\r
+                    propagateSyntax(child);\r
+                });\r
+            }\r
+            if (parent['enums']) {\r
+                parent['enums'].forEach(function(child) {\r
+                    child["syntax"] = parent["syntax"];\r
+                });\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Imports another definition into this builder.\r
+         * @param {Object.<string,*>} json Parsed import\r
+         * @param {(string|{root: string, file: string})=} filename Imported file name\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @throws {Error} If the definition or file cannot be imported\r
+         * @expose\r
+         */\r
+        BuilderPrototype["import"] = function(json, filename) {\r
+            var delim = '/';\r
+\r
+            // Make sure to skip duplicate imports\r
+\r
+            if (typeof filename === 'string') {\r
+\r
+                if (ProtoBuf.Util.IS_NODE)\r
+                    filename = require("path")['resolve'](filename);\r
+                if (this.files[filename] === true)\r
+                    return this.reset();\r
+                this.files[filename] = true;\r
+\r
+            } else if (typeof filename === 'object') { // Object with root, file.\r
+\r
+                var root = filename.root;\r
+                if (ProtoBuf.Util.IS_NODE)\r
+                    root = require("path")['resolve'](root);\r
+                if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)\r
+                    delim = '\\';\r
+                var fname;\r
+                if (ProtoBuf.Util.IS_NODE)\r
+                    fname = require("path")['join'](root, filename.file);\r
+                else\r
+                    fname = root + delim + filename.file;\r
+                if (this.files[fname] === true)\r
+                    return this.reset();\r
+                this.files[fname] = true;\r
+            }\r
+\r
+            // Import imports\r
+\r
+            if (json['imports'] && json['imports'].length > 0) {\r
+                var importRoot,\r
+                    resetRoot = false;\r
+\r
+                if (typeof filename === 'object') { // If an import root is specified, override\r
+\r
+                    this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards\r
+                    importRoot = this.importRoot;\r
+                    filename = filename["file"];\r
+                    if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)\r
+                        delim = '\\';\r
+\r
+                } else if (typeof filename === 'string') {\r
+\r
+                    if (this.importRoot) // If import root is overridden, use it\r
+                        importRoot = this.importRoot;\r
+                    else { // Otherwise compute from filename\r
+                        if (filename.indexOf("/") >= 0) { // Unix\r
+                            importRoot = filename.replace(/\/[^\/]*$/, "");\r
+                            if (/* /file.proto */ importRoot === "")\r
+                                importRoot = "/";\r
+                        } else if (filename.indexOf("\\") >= 0) { // Windows\r
+                            importRoot = filename.replace(/\\[^\\]*$/, "");\r
+                            delim = '\\';\r
+                        } else\r
+                            importRoot = ".";\r
+                    }\r
+\r
+                } else\r
+                    importRoot = null;\r
+\r
+                for (var i=0; i<json['imports'].length; i++) {\r
+                    if (typeof json['imports'][i] === 'string') { // Import file\r
+                        if (!importRoot)\r
+                            throw Error("cannot determine import root");\r
+                        var importFilename = json['imports'][i];\r
+                        if (importFilename === "google/protobuf/descriptor.proto")\r
+                            continue; // Not needed and therefore not used\r
+                        if (ProtoBuf.Util.IS_NODE)\r
+                            importFilename = require("path")['join'](importRoot, importFilename);\r
+                        else\r
+                            importFilename = importRoot + delim + importFilename;\r
+                        if (this.files[importFilename] === true)\r
+                            continue; // Already imported\r
+                        if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto)       // If this is a light build\r
+                            importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file\r
+                        var contents = ProtoBuf.Util.fetch(importFilename);\r
+                        if (contents === null)\r
+                            throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");\r
+                        if (/\.json$/i.test(importFilename)) // Always possible\r
+                            this["import"](JSON.parse(contents+""), importFilename); // May throw\r
+                        else\r
+                            this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw\r
+                    } else // Import structure\r
+                        if (!filename)\r
+                            this["import"](json['imports'][i]);\r
+                        else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique\r
+                            this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));\r
+                        else // Without extension: Append _importN to make it unique\r
+                            this["import"](json['imports'][i], filename+"_import"+i);\r
+                }\r
+                if (resetRoot) // Reset import root override when all imports are done\r
+                    this.importRoot = null;\r
+            }\r
+\r
+            // Import structures\r
+\r
+            if (json['package'])\r
+                this.define(json['package']);\r
+            if (json['syntax'])\r
+                propagateSyntax(json);\r
+            var base = this.ptr;\r
+            if (json['options'])\r
+                Object.keys(json['options']).forEach(function(key) {\r
+                    base.options[key] = json['options'][key];\r
+                });\r
+            if (json['messages'])\r
+                this.create(json['messages']),\r
+                this.ptr = base;\r
+            if (json['enums'])\r
+                this.create(json['enums']),\r
+                this.ptr = base;\r
+            if (json['services'])\r
+                this.create(json['services']),\r
+                this.ptr = base;\r
+            if (json['extends'])\r
+                this.create(json['extends']);\r
+\r
+            return this.reset();\r
+        };\r
+\r
+        /**\r
+         * Resolves all namespace objects.\r
+         * @throws {Error} If a type cannot be resolved\r
+         * @returns {!ProtoBuf.Builder} this\r
+         * @expose\r
+         */\r
+        BuilderPrototype.resolveAll = function() {\r
+            // Resolve all reflected objects\r
+            var res;\r
+            if (this.ptr == null || typeof this.ptr.type === 'object')\r
+                return this; // Done (already resolved)\r
+\r
+            if (this.ptr instanceof Reflect.Namespace) { // Resolve children\r
+\r
+                this.ptr.children.forEach(function(child) {\r
+                    this.ptr = child;\r
+                    this.resolveAll();\r
+                }, this);\r
+\r
+            } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type\r
+\r
+                if (!Lang.TYPE.test(this.ptr.type)) {\r
+                    if (!Lang.TYPEREF.test(this.ptr.type))\r
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);\r
+                    res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);\r
+                    if (!res)\r
+                        throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);\r
+                    this.ptr.resolvedType = res;\r
+                    if (res instanceof Reflect.Enum) {\r
+                        this.ptr.type = ProtoBuf.TYPES["enum"];\r
+                        if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')\r
+                            throw Error("proto3 message cannot reference proto2 enum");\r
+                    }\r
+                    else if (res instanceof Reflect.Message)\r
+                        this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];\r
+                    else\r
+                        throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);\r
+                } else\r
+                    this.ptr.type = ProtoBuf.TYPES[this.ptr.type];\r
+\r
+                // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type\r
+                // (i.e., no enums or messages), so we don't need to resolve against the current namespace.\r
+                if (this.ptr.map) {\r
+                    if (!Lang.TYPE.test(this.ptr.keyType))\r
+                        throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);\r
+                    this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];\r
+                }\r
+\r
+                // If it's a repeated and packable field then proto3 mandates it should be packed by\r
+                // default\r
+                if (\r
+                  this.ptr.syntax === 'proto3' &&\r
+                  this.ptr.repeated && this.ptr.options.packed === undefined &&\r
+                  ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1\r
+                ) {\r
+                  this.ptr.options.packed = true;\r
+                }\r
+\r
+            } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {\r
+\r
+                if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {\r
+                    res = this.ptr.parent.resolve(this.ptr.requestName, true);\r
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))\r
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);\r
+                    this.ptr.resolvedRequestType = res;\r
+                    res = this.ptr.parent.resolve(this.ptr.responseName, true);\r
+                    if (!res || !(res instanceof ProtoBuf.Reflect.Message))\r
+                        throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);\r
+                    this.ptr.resolvedResponseType = res;\r
+                } else // Should not happen as nothing else is implemented\r
+                    throw Error("illegal service type in "+this.ptr.toString(true));\r
+\r
+            } else if (\r
+                !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built\r
+                !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built\r
+                !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum\r
+            )\r
+                throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);\r
+\r
+            return this.reset();\r
+        };\r
+\r
+        /**\r
+         * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,\r
+         * return the built package.\r
+         * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.\r
+         * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}\r
+         * @throws {Error} If a type could not be resolved\r
+         * @expose\r
+         */\r
+        BuilderPrototype.build = function(path) {\r
+            this.reset();\r
+            if (!this.resolved)\r
+                this.resolveAll(),\r
+                this.resolved = true,\r
+                this.result = null; // Require re-build\r
+            if (this.result === null) // (Re-)Build\r
+                this.result = this.ns.build();\r
+            if (!path)\r
+                return this.result;\r
+            var part = typeof path === 'string' ? path.split(".") : path,\r
+                ptr = this.result; // Build namespace pointer (no hasChild etc.)\r
+            for (var i=0; i<part.length; i++)\r
+                if (ptr[part[i]])\r
+                    ptr = ptr[part[i]];\r
+                else {\r
+                    ptr = null;\r
+                    break;\r
+                }\r
+            return ptr;\r
+        };\r
+\r
+        /**\r
+         * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.\r
+         * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.\r
+         * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`\r
+         * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found\r
+         */\r
+        BuilderPrototype.lookup = function(path, excludeNonNamespace) {\r
+            return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;\r
+        };\r
+\r
+        /**\r
+         * Returns a string representation of this object.\r
+         * @return {string} String representation as of "Builder"\r
+         * @expose\r
+         */\r
+        BuilderPrototype.toString = function() {\r
+            return "Builder";\r
+        };\r
+\r
+        // ----- Base classes -----\r
+        // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.Message\r
+         */\r
+        Builder.Message = function() {};\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.Enum\r
+         */\r
+        Builder.Enum = function() {};\r
+\r
+        /**\r
+         * @alias ProtoBuf.Builder.Message\r
+         */\r
+        Builder.Service = function() {};\r
+\r
+        return Builder;\r
+\r
+    })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);\r
+\r
+    /**\r
+     * @alias ProtoBuf.Map\r
+     * @expose\r
+     */\r
+    ProtoBuf.Map = (function(ProtoBuf, Reflect) {\r
+        "use strict";\r
+\r
+        /**\r
+         * Constructs a new Map. A Map is a container that is used to implement map\r
+         * fields on message objects. It closely follows the ES6 Map API; however,\r
+         * it is distinct because we do not want to depend on external polyfills or\r
+         * on ES6 itself.\r
+         *\r
+         * @exports ProtoBuf.Map\r
+         * @param {!ProtoBuf.Reflect.Field} field Map field\r
+         * @param {Object.<string,*>=} contents Initial contents\r
+         * @constructor\r
+         */\r
+        var Map = function(field, contents) {\r
+            if (!field.map)\r
+                throw Error("field is not a map");\r
+\r
+            /**\r
+             * The field corresponding to this map.\r
+             * @type {!ProtoBuf.Reflect.Field}\r
+             */\r
+            this.field = field;\r
+\r
+            /**\r
+             * Element instance corresponding to key type.\r
+             * @type {!ProtoBuf.Reflect.Element}\r
+             */\r
+            this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);\r
+\r
+            /**\r
+             * Element instance corresponding to value type.\r
+             * @type {!ProtoBuf.Reflect.Element}\r
+             */\r
+            this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);\r
+\r
+            /**\r
+             * Internal map: stores mapping of (string form of key) -> (key, value)\r
+             * pair.\r
+             *\r
+             * We provide map semantics for arbitrary key types, but we build on top\r
+             * of an Object, which has only string keys. In order to avoid the need\r
+             * to convert a string key back to its native type in many situations,\r
+             * we store the native key value alongside the value. Thus, we only need\r
+             * a one-way mapping from a key type to its string form that guarantees\r
+             * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1\r
+             * === K2).\r
+             *\r
+             * @type {!Object<string, {key: *, value: *}>}\r
+             */\r
+            this.map = {};\r
+\r
+            /**\r
+             * Returns the number of elements in the map.\r
+             */\r
+            Object.defineProperty(this, "size", {\r
+                get: function() { return Object.keys(this.map).length; }\r
+            });\r
+\r
+            // Fill initial contents from a raw object.\r
+            if (contents) {\r
+                var keys = Object.keys(contents);\r
+                for (var i = 0; i < keys.length; i++) {\r
+                    var key = this.keyElem.valueFromString(keys[i]);\r
+                    var val = this.valueElem.verifyValue(contents[keys[i]]);\r
+                    this.map[this.keyElem.valueToString(key)] =\r
+                        { key: key, value: val };\r
+                }\r
+            }\r
+        };\r
+\r
+        var MapPrototype = Map.prototype;\r
+\r
+        /**\r
+         * Helper: return an iterator over an array.\r
+         * @param {!Array<*>} arr the array\r
+         * @returns {!Object} an iterator\r
+         * @inner\r
+         */\r
+        function arrayIterator(arr) {\r
+            var idx = 0;\r
+            return {\r
+                next: function() {\r
+                    if (idx < arr.length)\r
+                        return { done: false, value: arr[idx++] };\r
+                    return { done: true };\r
+                }\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Clears the map.\r
+         */\r
+        MapPrototype.clear = function() {\r
+            this.map = {};\r
+        };\r
+\r
+        /**\r
+         * Deletes a particular key from the map.\r
+         * @returns {boolean} Whether any entry with this key was deleted.\r
+         */\r
+        MapPrototype["delete"] = function(key) {\r
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));\r
+            var hadKey = keyValue in this.map;\r
+            delete this.map[keyValue];\r
+            return hadKey;\r
+        };\r
+\r
+        /**\r
+         * Returns an iterator over [key, value] pairs in the map.\r
+         * @returns {Object} The iterator\r
+         */\r
+        MapPrototype.entries = function() {\r
+            var entries = [];\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0, entry; i < strKeys.length; i++)\r
+                entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);\r
+            return arrayIterator(entries);\r
+        };\r
+\r
+        /**\r
+         * Returns an iterator over keys in the map.\r
+         * @returns {Object} The iterator\r
+         */\r
+        MapPrototype.keys = function() {\r
+            var keys = [];\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0; i < strKeys.length; i++)\r
+                keys.push(this.map[strKeys[i]].key);\r
+            return arrayIterator(keys);\r
+        };\r
+\r
+        /**\r
+         * Returns an iterator over values in the map.\r
+         * @returns {!Object} The iterator\r
+         */\r
+        MapPrototype.values = function() {\r
+            var values = [];\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0; i < strKeys.length; i++)\r
+                values.push(this.map[strKeys[i]].value);\r
+            return arrayIterator(values);\r
+        };\r
+\r
+        /**\r
+         * Iterates over entries in the map, calling a function on each.\r
+         * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.\r
+         * @param {Object=} thisArg The `this` value for the callback\r
+         */\r
+        MapPrototype.forEach = function(cb, thisArg) {\r
+            var strKeys = Object.keys(this.map);\r
+            for (var i = 0, entry; i < strKeys.length; i++)\r
+                cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);\r
+        };\r
+\r
+        /**\r
+         * Sets a key in the map to the given value.\r
+         * @param {*} key The key\r
+         * @param {*} value The value\r
+         * @returns {!ProtoBuf.Map} The map instance\r
+         */\r
+        MapPrototype.set = function(key, value) {\r
+            var keyValue = this.keyElem.verifyValue(key);\r
+            var valValue = this.valueElem.verifyValue(value);\r
+            this.map[this.keyElem.valueToString(keyValue)] =\r
+                { key: keyValue, value: valValue };\r
+            return this;\r
+        };\r
+\r
+        /**\r
+         * Gets the value corresponding to a key in the map.\r
+         * @param {*} key The key\r
+         * @returns {*|undefined} The value, or `undefined` if key not present\r
+         */\r
+        MapPrototype.get = function(key) {\r
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));\r
+            if (!(keyValue in this.map))\r
+                return undefined;\r
+            return this.map[keyValue].value;\r
+        };\r
+\r
+        /**\r
+         * Determines whether the given key is present in the map.\r
+         * @param {*} key The key\r
+         * @returns {boolean} `true` if the key is present\r
+         */\r
+        MapPrototype.has = function(key) {\r
+            var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));\r
+            return (keyValue in this.map);\r
+        };\r
+\r
+        return Map;\r
+    })(ProtoBuf, ProtoBuf.Reflect);\r
+\r
+\r
+    /**\r
+     * Loads a .proto string and returns the Builder.\r
+     * @param {string} proto .proto file contents\r
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.\r
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.\r
+     * @return {ProtoBuf.Builder} Builder to create new messages\r
+     * @throws {Error} If the definition cannot be parsed or built\r
+     * @expose\r
+     */\r
+    ProtoBuf.loadProto = function(proto, builder, filename) {\r
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))\r
+            filename = builder,\r
+            builder = undefined;\r
+        return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto), builder, filename);\r
+    };\r
+\r
+    /**\r
+     * Loads a .proto string and returns the Builder. This is an alias of {@link ProtoBuf.loadProto}.\r
+     * @function\r
+     * @param {string} proto .proto file contents\r
+     * @param {(ProtoBuf.Builder|string)=} builder Builder to append to. Will create a new one if omitted.\r
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.\r
+     * @return {ProtoBuf.Builder} Builder to create new messages\r
+     * @throws {Error} If the definition cannot be parsed or built\r
+     * @expose\r
+     */\r
+    ProtoBuf.protoFromString = ProtoBuf.loadProto; // Legacy\r
+\r
+    /**\r
+     * Loads a .proto file and returns the Builder.\r
+     * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with\r
+     *  an overridden 'root' path for all imported files.\r
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and\r
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the\r
+     *  file will be read synchronously and this function will return the Builder.\r
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.\r
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the\r
+     *   request has failed), else undefined\r
+     * @expose\r
+     */\r
+    ProtoBuf.loadProtoFile = function(filename, callback, builder) {\r
+        if (callback && typeof callback === 'object')\r
+            builder = callback,\r
+            callback = null;\r
+        else if (!callback || typeof callback !== 'function')\r
+            callback = null;\r
+        if (callback)\r
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {\r
+                if (contents === null) {\r
+                    callback(Error("Failed to fetch file"));\r
+                    return;\r
+                }\r
+                try {\r
+                    callback(null, ProtoBuf.loadProto(contents, builder, filename));\r
+                } catch (e) {\r
+                    callback(e);\r
+                }\r
+            });\r
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);\r
+        return contents === null ? null : ProtoBuf.loadProto(contents, builder, filename);\r
+    };\r
+\r
+    /**\r
+     * Loads a .proto file and returns the Builder. This is an alias of {@link ProtoBuf.loadProtoFile}.\r
+     * @function\r
+     * @param {string|{root: string, file: string}} filename Path to proto file or an object specifying 'file' with\r
+     *  an overridden 'root' path for all imported files.\r
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and\r
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the\r
+     *  file will be read synchronously and this function will return the Builder.\r
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.\r
+     * @return {!ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the\r
+     *   request has failed), else undefined\r
+     * @expose\r
+     */\r
+    ProtoBuf.protoFromFile = ProtoBuf.loadProtoFile; // Legacy\r
+\r
+\r
+    /**\r
+     * Constructs a new empty Builder.\r
+     * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf\r
+     * @return {!ProtoBuf.Builder} Builder\r
+     * @expose\r
+     */\r
+    ProtoBuf.newBuilder = function(options) {\r
+        options = options || {};\r
+        if (typeof options['convertFieldsToCamelCase'] === 'undefined')\r
+            options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;\r
+        if (typeof options['populateAccessors'] === 'undefined')\r
+            options['populateAccessors'] = ProtoBuf.populateAccessors;\r
+        return new ProtoBuf.Builder(options);\r
+    };\r
+\r
+    /**\r
+     * Loads a .json definition and returns the Builder.\r
+     * @param {!*|string} json JSON definition\r
+     * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.\r
+     * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.\r
+     * @return {ProtoBuf.Builder} Builder to create new messages\r
+     * @throws {Error} If the definition cannot be parsed or built\r
+     * @expose\r
+     */\r
+    ProtoBuf.loadJson = function(json, builder, filename) {\r
+        if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))\r
+            filename = builder,\r
+            builder = null;\r
+        if (!builder || typeof builder !== 'object')\r
+            builder = ProtoBuf.newBuilder();\r
+        if (typeof json === 'string')\r
+            json = JSON.parse(json);\r
+        builder["import"](json, filename);\r
+        builder.resolveAll();\r
+        return builder;\r
+    };\r
+\r
+    /**\r
+     * Loads a .json file and returns the Builder.\r
+     * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with\r
+     *  an overridden 'root' path for all imported files.\r
+     * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and\r
+     *  the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the\r
+     *  file will be read synchronously and this function will return the Builder.\r
+     * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.\r
+     * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the\r
+     *   request has failed), else undefined\r
+     * @expose\r
+     */\r
+    ProtoBuf.loadJsonFile = function(filename, callback, builder) {\r
+        if (callback && typeof callback === 'object')\r
+            builder = callback,\r
+            callback = null;\r
+        else if (!callback || typeof callback !== 'function')\r
+            callback = null;\r
+        if (callback)\r
+            return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {\r
+                if (contents === null) {\r
+                    callback(Error("Failed to fetch file"));\r
+                    return;\r
+                }\r
+                try {\r
+                    callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));\r
+                } catch (e) {\r
+                    callback(e);\r
+                }\r
+            });\r
+        var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);\r
+        return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);\r
+    };\r
+\r
+    return ProtoBuf;\r
+});\r
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js
new file mode 100644 (file)
index 0000000..245605e
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
+ Released under the Apache License, Version 2.0
+ see: https://github.com/dcodeIO/protobuf.js for details
+*/
+var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,p,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[p]=d.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
+$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};
+$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var p=0;return $jscomp.iteratorPrototype(function(){return p<e.length?{done:!1,value:e[p++]}:{done:!0}})};
+$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,p){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var d=0,b={next:function(){if(d<e.length){var t=d++;return{value:p(t,e[t]),done:!1}}b.next=function(){return{done:!0,value:void 0}};return b.next()}};b[Symbol.iterator]=function(){return b};return b};
+$jscomp.polyfill=function(e,p,d,b){if(p){d=$jscomp.global;e=e.split(".");for(b=0;b<e.length-1;b++){var t=e[b];t in d||(d[t]={});d=d[t]}e=e[e.length-1];b=d[e];p=p(b);p!=b&&null!=p&&$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:p})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");
+$jscomp.polyfill("Array.prototype.entries",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e,d){return[e,d]})}},"es6-impl","es3");$jscomp.polyfill("Array.prototype.values",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e,d){return d})}},"es6","es3");
+(function(e,p){"function"===typeof define&&define.amd?define(["bytebuffer"],p):"function"===typeof require&&"object"===typeof module&&module&&module.exports?module.exports=p(require("bytebuffer"),!0):(e.dcodeIO=e.dcodeIO||{}).ProtoBuf=p(e.dcodeIO.ByteBuffer)})(this,function(e,p){var d={};d.ByteBuffer=e;d.Long=e.Long||null;d.VERSION="5.0.3";d.WIRE_TYPES={};d.WIRE_TYPES.VARINT=0;d.WIRE_TYPES.BITS64=1;d.WIRE_TYPES.LDELIM=2;d.WIRE_TYPES.STARTGROUP=3;d.WIRE_TYPES.ENDGROUP=4;d.WIRE_TYPES.BITS32=5;d.PACKABLE_WIRE_TYPES=
+[d.WIRE_TYPES.VARINT,d.WIRE_TYPES.BITS64,d.WIRE_TYPES.BITS32];d.TYPES={int32:{name:"int32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:d.WIRE_TYPES.VARINT,defaultValue:d.Long?d.Long.ZERO:void 0},uint64:{name:"uint64",wireType:d.WIRE_TYPES.VARINT,defaultValue:d.Long?d.Long.UZERO:void 0},sint64:{name:"sint64",wireType:d.WIRE_TYPES.VARINT,
+defaultValue:d.Long?d.Long.ZERO:void 0},bool:{name:"bool",wireType:d.WIRE_TYPES.VARINT,defaultValue:!1},"double":{name:"double",wireType:d.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:d.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:d.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:d.WIRE_TYPES.BITS64,
+defaultValue:d.Long?d.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:d.WIRE_TYPES.BITS64,defaultValue:d.Long?d.Long.ZERO:void 0},"float":{name:"float",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},"enum":{name:"enum",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:d.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:d.WIRE_TYPES.STARTGROUP,defaultValue:null}};d.MAP_KEY_TYPES=[d.TYPES.int32,d.TYPES.sint32,d.TYPES.sfixed32,d.TYPES.uint32,d.TYPES.fixed32,
+d.TYPES.int64,d.TYPES.sint64,d.TYPES.sfixed64,d.TYPES.uint64,d.TYPES.fixed64,d.TYPES.bool,d.TYPES.string,d.TYPES.bytes];d.ID_MIN=1;d.ID_MAX=536870911;d.convertFieldsToCamelCase=!1;d.populateAccessors=!0;d.populateDefaults=!0;d.Util=function(){var b={};b.IS_NODE=!("object"!==typeof process||"[object process]"!==process+""||process.browser);b.XHR=function(){for(var b=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},
+function(){return new ActiveXObject("Microsoft.XMLHTTP")}],d=null,e=0;e<b.length;e++){try{d=b[e]()}catch(m){continue}break}if(!d)throw Error("XMLHttpRequest is not supported");return d};b.fetch=function(d,e){e&&"function"!=typeof e&&(e=null);if(b.IS_NODE){var t=require("fs");if(e)t.readFile(d,function(b,a){b?e(null):e(""+a)});else try{return t.readFileSync(d)}catch(n){return null}}else{var m=b.XHR();m.open("GET",d,e?!0:!1);m.setRequestHeader("Accept","text/plain");"function"===typeof m.overrideMimeType&&
+m.overrideMimeType("text/plain");if(e)m.onreadystatechange=function(){4==m.readyState&&(200==m.status||0==m.status&&"string"===typeof m.responseText?e(m.responseText):e(null))},4!=m.readyState&&m.send(null);else return m.send(null),200==m.status||0==m.status&&"string"===typeof m.responseText?m.responseText:null}};b.toCamelCase=function(b){return b.replace(/_([a-zA-Z])/g,function(b,d){return d.toUpperCase()})};return b}();d.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,
+TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
+BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g};d.DotProto=function(b,d){function e(b,c){var l,a=1;"-"==b.charAt(0)&&(a=-1,b=b.substring(1));if(d.NUMBER_DEC.test(b))l=parseInt(b);else if(d.NUMBER_HEX.test(b))l=parseInt(b.substring(2),16);else if(d.NUMBER_OCT.test(b))l=
+parseInt(b.substring(1),8);else throw Error("illegal id value: "+(0>a?"-":"")+b);l=a*l|0;if(!c&&0>l)throw Error("illegal id value: "+(0>a?"-":"")+b);return l}function t(b){var c=1;"-"==b.charAt(0)&&(c=-1,b=b.substring(1));if(d.NUMBER_DEC.test(b))return c*parseInt(b,10);if(d.NUMBER_HEX.test(b))return c*parseInt(b.substring(2),16);if(d.NUMBER_OCT.test(b))return c*parseInt(b.substring(1),8);if("inf"===b)return Infinity*c;if("nan"===b)return NaN;if(d.NUMBER_FLT.test(b))return c*parseFloat(b);throw Error("illegal number value: "+
+(0>c?"-":"")+b);}function m(b,c,d){"undefined"===typeof b[c]?b[c]=d:(Array.isArray(b[c])||(b[c]=[b[c]]),b[c].push(d))}var n={},a=function(b){this.source=b+"";this.index=0;this.line=1;this.stack=[];this._stringOpen=null},g=a.prototype;g._readString=function(){var b='"'===this._stringOpen?d.STRING_DQ:d.STRING_SQ;b.lastIndex=this.index-1;var c=b.exec(this.source);if(!c)throw Error("unterminated string");this.index=b.lastIndex;this.stack.push(this._stringOpen);this._stringOpen=null;return c[1]};g.next=
+function(){if(0<this.stack.length)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();var b,c;do{for(b=!1;d.WHITESPACE.test(c=this.source.charAt(this.index));)if("\n"===c&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index;
+++this.line;b=!0}else if("*"===(c=this.source.charAt(this.index))){do{"\n"===c&&++this.line;if(++this.index===this.source.length)return null;b=c;c=this.source.charAt(this.index)}while("*"!==b||"/"!==c);++this.index;b=!0}else return"/"}while(b);if(this.index===this.source.length)return null;c=this.index;d.DELIM.lastIndex=0;if(!d.DELIM.test(this.source.charAt(c++)))for(;c<this.source.length&&!d.DELIM.test(this.source.charAt(c));)++c;c=this.source.substring(this.index,this.index=c);if('"'===c||"'"===
+c)this._stringOpen=c;return c};g.peek=function(){if(0===this.stack.length){var b=this.next();if(null===b)return null;this.stack.push(b)}return this.stack[0]};g.skip=function(b){var c=this.next();if(c!==b)throw Error("illegal '"+c+"', '"+b+"' expected");};g.omit=function(b){return this.peek()===b?(this.next(),!0):!1};g.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"};n.Tokenizer=a;var h=function(b){this.tn=new a(b);this.proto3=!1},g=h.prototype;g.parse=
+function(){var b={name:"[ROOT]","package":null,messages:[],enums:[],imports:[],options:{},services:[]},c,a=!0,e;try{for(;c=this.tn.next();)switch(c){case "package":if(!a||null!==b["package"])throw Error("unexpected 'package'");c=this.tn.next();if(!d.TYPEREF.test(c))throw Error("illegal package name: "+c);this.tn.skip(";");b["package"]=c;break;case "import":if(!a)throw Error("unexpected 'import'");c=this.tn.peek();("public"===c||(e="weak"===c))&&this.tn.next();c=this._readString();this.tn.skip(";");
+e||b.imports.push(c);break;case "syntax":if(!a)throw Error("unexpected 'syntax'");this.tn.skip("=");"proto3"===(b.syntax=this._readString())&&(this.proto3=!0);this.tn.skip(";");break;case "message":this._parseMessage(b,null);a=!1;break;case "enum":this._parseEnum(b);a=!1;break;case "option":this._parseOption(b);break;case "service":this._parseService(b);break;case "extend":this._parseExtend(b);break;default:throw Error("unexpected '"+c+"'");}}catch(u){throw u.message="Parse error at line "+this.tn.line+
+": "+u.message,u;}delete b.name;return b};h.parse=function(b){return(new h(b)).parse()};g._readString=function(){var b="",c;do{c=this.tn.next();if("'"!==c&&'"'!==c)throw Error("illegal string delimiter: "+c);b+=this.tn.next();this.tn.skip(c);c=this.tn.peek()}while('"'===c||'"'===c);return b};g._readValue=function(b){var c=this.tn.peek();if('"'===c||"'"===c)return this._readString();this.tn.next();if(d.NUMBER.test(c))return t(c);if(d.BOOL.test(c))return"true"===c.toLowerCase();if(b&&d.TYPEREF.test(c))return c;
+throw Error("illegal value: "+c);};g._parseOption=function(b,c){var a=this.tn.next(),e=!1;"("===a&&(e=!0,a=this.tn.next());if(!d.TYPEREF.test(a))throw Error("illegal option name: "+a);var g=a;e&&(this.tn.skip(")"),g="("+g+")",a=this.tn.peek(),d.FQTYPEREF.test(a)&&(g+=a,this.tn.next()));this.tn.skip("=");this._parseOptionValue(b,g);c||this.tn.skip(";")};g._parseOptionValue=function(b,c){var a=this.tn.peek();if("{"!==a)m(b.options,c,this._readValue(!0));else for(this.tn.skip("{");"}"!==(a=this.tn.next());){if(!d.NAME.test(a))throw Error("illegal option name: "+
+c+"."+a);this.tn.omit(":")?m(b.options,c+"."+a,this._readValue(!0)):this._parseOptionValue(b,c+"."+a)}};g._parseService=function(b){var c=this.tn.next();if(!d.NAME.test(c))throw Error("illegal service name at line "+this.tn.line+": "+c);var a={name:c,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(c=this.tn.next());)if("option"===c)this._parseOption(a);else if("rpc"===c)this._parseServiceRPC(a);else throw Error("illegal service token: "+c);this.tn.omit(";");b.services.push(a)};g._parseServiceRPC=
+function(b){var c=this.tn.next();if(!d.NAME.test(c))throw Error("illegal rpc service method name: "+c);var a=c,e={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};this.tn.skip("(");c=this.tn.next();"stream"===c.toLowerCase()&&(e.request_stream=!0,c=this.tn.next());if(!d.TYPEREF.test(c))throw Error("illegal rpc service request type: "+c);e.request=c;this.tn.skip(")");c=this.tn.next();if("returns"!==c.toLowerCase())throw Error("illegal rpc service request type delimiter: "+
+c);this.tn.skip("(");c=this.tn.next();"stream"===c.toLowerCase()&&(e.response_stream=!0,c=this.tn.next());e.response=c;this.tn.skip(")");c=this.tn.peek();if("{"===c){for(this.tn.next();"}"!==(c=this.tn.next());)if("option"===c)this._parseOption(e);else throw Error("illegal rpc service token: "+c);this.tn.omit(";")}else this.tn.skip(";");"undefined"===typeof b.rpc&&(b.rpc={});b.rpc[a]=e};g._parseMessage=function(b,c){var a=!!c,g=this.tn.next(),h={name:"",fields:[],enums:[],messages:[],options:{},services:[],
+oneofs:{}};if(!d.NAME.test(g))throw Error("illegal "+(a?"group":"message")+" name: "+g);h.name=g;a&&(this.tn.skip("="),c.id=e(this.tn.next()),h.isGroup=!0);g=this.tn.peek();"["===g&&c&&this._parseFieldOptions(c);for(this.tn.skip("{");"}"!==(g=this.tn.next());)if(d.RULE.test(g))this._parseMessageField(h,g);else if("oneof"===g)this._parseMessageOneOf(h);else if("enum"===g)this._parseEnum(h);else if("message"===g)this._parseMessage(h);else if("option"===g)this._parseOption(h);else if("service"===g)this._parseService(h);
+else if("extensions"===g)h.hasOwnProperty("extensions")?h.extensions=h.extensions.concat(this._parseExtensionRanges()):h.extensions=this._parseExtensionRanges();else if("reserved"===g)this._parseIgnored();else if("extend"===g)this._parseExtend(h);else if(d.TYPEREF.test(g)){if(!this.proto3)throw Error("illegal field rule: "+g);this._parseMessageField(h,"optional",g)}else throw Error("illegal message token: "+g);this.tn.omit(";");b.messages.push(h);return h};g._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();
+this.tn.skip(";")};g._parseMessageField=function(b,c,a){if(!d.RULE.test(c))throw Error("illegal message field rule: "+c);var g={rule:c,type:"",name:"",options:{},id:0};if("map"===c){if(a)throw Error("illegal type: "+a);this.tn.skip("<");c=this.tn.next();if(!d.TYPE.test(c)&&!d.TYPEREF.test(c))throw Error("illegal message field type: "+c);g.keytype=c;this.tn.skip(",");c=this.tn.next();if(!d.TYPE.test(c)&&!d.TYPEREF.test(c))throw Error("illegal message field: "+c);g.type=c;this.tn.skip(">");c=this.tn.next();
+if(!d.NAME.test(c))throw Error("illegal message field name: "+c);g.name=c;this.tn.skip("=");g.id=e(this.tn.next());c=this.tn.peek();"["===c&&this._parseFieldOptions(g);this.tn.skip(";")}else if(a="undefined"!==typeof a?a:this.tn.next(),"group"===a){c=this._parseMessage(b,g);if(!/^[A-Z]/.test(c.name))throw Error("illegal group name: "+c.name);g.type=c.name;g.name=c.name.toLowerCase();this.tn.omit(";")}else{if(!d.TYPE.test(a)&&!d.TYPEREF.test(a))throw Error("illegal message field type: "+a);g.type=
+a;c=this.tn.next();if(!d.NAME.test(c))throw Error("illegal message field name: "+c);g.name=c;this.tn.skip("=");g.id=e(this.tn.next());c=this.tn.peek();"["===c&&this._parseFieldOptions(g);this.tn.skip(";")}b.fields.push(g);return g};g._parseMessageOneOf=function(b){var c=this.tn.next();if(!d.NAME.test(c))throw Error("illegal oneof name: "+c);var a=c,g=[];for(this.tn.skip("{");"}"!==(c=this.tn.next());)c=this._parseMessageField(b,"optional",c),c.oneof=a,g.push(c.id);this.tn.omit(";");b.oneofs[a]=g};
+g._parseFieldOptions=function(b){this.tn.skip("[");for(var c=!0;"]"!==this.tn.peek();)c||this.tn.skip(","),this._parseOption(b,!0),c=!1;this.tn.next()};g._parseEnum=function(b){var c={name:"",values:[],options:{}},a=this.tn.next();if(!d.NAME.test(a))throw Error("illegal name: "+a);c.name=a;for(this.tn.skip("{");"}"!==(a=this.tn.next());)if("option"===a)this._parseOption(c);else{if(!d.NAME.test(a))throw Error("illegal name: "+a);this.tn.skip("=");var g={name:a,id:e(this.tn.next(),!0)},a=this.tn.peek();
+"["===a&&this._parseFieldOptions({options:{}});this.tn.skip(";");c.values.push(g)}this.tn.omit(";");b.enums.push(c)};g._parseExtensionRanges=function(){var a=[],c,d;do{for(d=[];;){c=this.tn.next();switch(c){case "min":c=b.ID_MIN;break;case "max":c=b.ID_MAX;break;default:c=t(c)}d.push(c);if(2===d.length)break;if("to"!==this.tn.peek()){d.push(c);break}this.tn.next()}a.push(d)}while(this.tn.omit(","));this.tn.skip(";");return a};g._parseExtend=function(b){var a=this.tn.next();if(!d.TYPEREF.test(a))throw Error("illegal extend reference: "+
+a);var g={ref:a,fields:[]};for(this.tn.skip("{");"}"!==(a=this.tn.next());)if(d.RULE.test(a))this._parseMessageField(g,a);else if(d.TYPEREF.test(a)){if(!this.proto3)throw Error("illegal field rule: "+a);this._parseMessageField(g,"optional",a)}else throw Error("illegal extend token: "+a);this.tn.omit(";");b.messages.push(g);return g};g.toString=function(){return"Parser at line "+this.tn.line};n.Parser=h;return n}(d,d.Lang);d.Reflect=function(b){function d(f,k){if(f&&"number"===typeof f.low&&"number"===
+typeof f.high&&"boolean"===typeof f.unsigned&&f.low===f.low&&f.high===f.high)return new b.Long(f.low,f.high,"undefined"===typeof k?f.unsigned:k);if("string"===typeof f)return b.Long.fromString(f,k||!1,10);if("number"===typeof f)return b.Long.fromNumber(f,k||!1);throw Error("not convertible to Long");}function y(f,k){var a=k.readVarint32(),c=a&7,a=a>>>3;switch(c){case b.WIRE_TYPES.VARINT:do a=k.readUint8();while(128===(a&128));break;case b.WIRE_TYPES.BITS64:k.offset+=8;break;case b.WIRE_TYPES.LDELIM:a=
+k.readVarint32();k.offset+=a;break;case b.WIRE_TYPES.STARTGROUP:y(a,k);break;case b.WIRE_TYPES.ENDGROUP:if(a===f)return!1;throw Error("Illegal GROUPEND after unknown group: "+a+" ("+f+" expected)");case b.WIRE_TYPES.BITS32:k.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+f+": "+c);}return!0}var r={},m=function(b,k,a){this.builder=b;this.parent=k;this.name=a},n=m.prototype;n.fqn=function(){var b=this.name,k=this;do{k=k.parent;if(null==k)break;b=k.name+"."+b}while(1);return b};
+n.toString=function(b){return(b?this.className+" ":"")+this.fqn()};n.build=function(){throw Error(this.toString(!0)+" cannot be built directly");};r.T=m;var a=function(b,k,a,c,d){m.call(this,b,k,a);this.className="Namespace";this.children=[];this.options=c||{};this.syntax=d||"proto2"},n=a.prototype=Object.create(m.prototype);n.getChildren=function(b){b=b||null;if(null==b)return this.children.slice();for(var f=[],a=0,c=this.children.length;a<c;++a)this.children[a]instanceof b&&f.push(this.children[a]);
+return f};n.addChild=function(b){var f;if(f=this.getChild(b.name))if(f instanceof l.Field&&f.name!==f.originalName&&null===this.getChild(f.originalName))f.name=f.originalName;else if(b instanceof l.Field&&b.name!==b.originalName&&null===this.getChild(b.originalName))b.name=b.originalName;else throw Error("Duplicate name in namespace "+this.toString(!0)+": "+b.name);this.children.push(b)};n.getChild=function(b){for(var f="number"===typeof b?"id":"name",a=0,c=this.children.length;a<c;++a)if(this.children[a][f]===
+b)return this.children[a];return null};n.resolve=function(b,a){var f="string"===typeof b?b.split("."):b,k=this,c=0;if(""===f[c]){for(;null!==k.parent;)k=k.parent;c++}do{do{if(!(k instanceof r.Namespace)){k=null;break}k=k.getChild(f[c]);if(!(k&&k instanceof r.T)||a&&!(k instanceof r.Namespace)){k=null;break}c++}while(c<f.length);if(null!=k)break;if(null!==this.parent)return this.parent.resolve(b,a)}while(null!=k);return k};n.qn=function(b){var f=[],a=b;do f.unshift(a.name),a=a.parent;while(null!==
+a);for(a=1;a<=f.length;a++){var c=f.slice(f.length-a);if(b===this.resolve(c,b instanceof r.Namespace))return c.join(".")}return b.fqn()};n.build=function(){for(var b={},k=this.children,c=0,d=k.length,g;c<d;++c)g=k[c],g instanceof a&&(b[g.name]=g.build());Object.defineProperty&&Object.defineProperty(b,"$options",{value:this.buildOpt()});return b};n.buildOpt=function(){for(var b={},a=Object.keys(this.options),c=0,d=a.length;c<d;++c)b[a[c]]=this.options[a[c]];return b};n.getOption=function(b){return"undefined"===
+typeof b?this.options:"undefined"!==typeof this.options[b]?this.options[b]:null};r.Namespace=a;var g=function(f,a,c,d,g){this.type=f;this.resolvedType=a;this.isMapKey=c;this.syntax=d;this.name=g;if(c&&0>b.MAP_KEY_TYPES.indexOf(f))throw Error("Invalid map key type: "+f.name);},h=g.prototype;g.defaultFieldValue=function(f){"string"===typeof f&&(f=b.TYPES[f]);if("undefined"===typeof f.defaultValue)throw Error("default value for type "+f.name+" is not supported");return f==b.TYPES.bytes?new e(0):f.defaultValue};
+h.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"};h.verifyValue=function(f){function a(b,f){throw Error("Illegal value for "+c.toString(!0)+" of type "+c.type.name+": "+b+" ("+f+")");}var c=this;switch(this.type){case b.TYPES.int32:case b.TYPES.sint32:case b.TYPES.sfixed32:return("number"!==typeof f||f===f&&0!==f%1)&&a(typeof f,"not an integer"),4294967295<f?f|0:f;case b.TYPES.uint32:case b.TYPES.fixed32:return("number"!==typeof f||f===f&&0!==f%1)&&a(typeof f,"not an integer"),
+0>f?f>>>0:f;case b.TYPES.int64:case b.TYPES.sint64:case b.TYPES.sfixed64:if(b.Long)try{return d(f,!1)}catch(x){a(typeof f,x.message)}else a(typeof f,"requires Long.js");case b.TYPES.uint64:case b.TYPES.fixed64:if(b.Long)try{return d(f,!0)}catch(x){a(typeof f,x.message)}else a(typeof f,"requires Long.js");case b.TYPES.bool:return"boolean"!==typeof f&&a(typeof f,"not a boolean"),f;case b.TYPES["float"]:case b.TYPES["double"]:return"number"!==typeof f&&a(typeof f,"not a number"),f;case b.TYPES.string:return"string"===
+typeof f||f&&f instanceof String||a(typeof f,"not a string"),""+f;case b.TYPES.bytes:return e.isByteBuffer(f)?f:e.wrap(f,"base64");case b.TYPES["enum"]:for(var g=this.resolvedType.getChildren(b.Reflect.Enum.Value),h=0;h<g.length;h++)if(g[h].name==f||g[h].id==f)return g[h].id;if("proto3"===this.syntax)return("number"!==typeof f||f===f&&0!==f%1)&&a(typeof f,"not an integer"),(4294967295<f||0>f)&&a(typeof f,"not in range for uint32"),f;a(f,"not a valid enum value");case b.TYPES.group:case b.TYPES.message:f&&
+"object"===typeof f||a(typeof f,"object expected");if(f instanceof this.resolvedType.clazz)return f;if(f instanceof b.Builder.Message){var g={},h;for(h in f)f.hasOwnProperty(h)&&(g[h]=f[h]);f=g}return new this.resolvedType.clazz(f)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+f+" (undefined type "+this.type+")");};h.calculateLength=function(f,a){if(null===a)return 0;var c;switch(this.type){case b.TYPES.int32:return 0>a?e.calculateVarint64(a):e.calculateVarint32(a);case b.TYPES.uint32:return e.calculateVarint32(a);
+case b.TYPES.sint32:return e.calculateVarint32(e.zigZagEncode32(a));case b.TYPES.fixed32:case b.TYPES.sfixed32:case b.TYPES["float"]:return 4;case b.TYPES.int64:case b.TYPES.uint64:return e.calculateVarint64(a);case b.TYPES.sint64:return e.calculateVarint64(e.zigZagEncode64(a));case b.TYPES.fixed64:case b.TYPES.sfixed64:return 8;case b.TYPES.bool:return 1;case b.TYPES["enum"]:return e.calculateVarint32(a);case b.TYPES["double"]:return 8;case b.TYPES.string:return c=e.calculateUTF8Bytes(a),e.calculateVarint32(c)+
+c;case b.TYPES.bytes:if(0>a.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+a.remaining()+" bytes remaining");return e.calculateVarint32(a.remaining())+a.remaining();case b.TYPES.message:return c=this.resolvedType.calculate(a),e.calculateVarint32(c)+c;case b.TYPES.group:return c=this.resolvedType.calculate(a),c+e.calculateVarint32(f<<3|b.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+a+" (unknown type)");};h.encodeValue=function(f,
+a,c){if(null===a)return c;switch(this.type){case b.TYPES.int32:0>a?c.writeVarint64(a):c.writeVarint32(a);break;case b.TYPES.uint32:c.writeVarint32(a);break;case b.TYPES.sint32:c.writeVarint32ZigZag(a);break;case b.TYPES.fixed32:c.writeUint32(a);break;case b.TYPES.sfixed32:c.writeInt32(a);break;case b.TYPES.int64:case b.TYPES.uint64:c.writeVarint64(a);break;case b.TYPES.sint64:c.writeVarint64ZigZag(a);break;case b.TYPES.fixed64:c.writeUint64(a);break;case b.TYPES.sfixed64:c.writeInt64(a);break;case b.TYPES.bool:"string"===
+typeof a?c.writeVarint32("false"===a.toLowerCase()?0:!!a):c.writeVarint32(a?1:0);break;case b.TYPES["enum"]:c.writeVarint32(a);break;case b.TYPES["float"]:c.writeFloat32(a);break;case b.TYPES["double"]:c.writeFloat64(a);break;case b.TYPES.string:c.writeVString(a);break;case b.TYPES.bytes:if(0>a.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+a.remaining()+" bytes remaining");f=a.offset;c.writeVarint32(a.remaining());c.append(a);a.offset=f;break;case b.TYPES.message:f=(new e).LE();
+this.resolvedType.encode(a,f);c.writeVarint32(f.offset);c.append(f.flip());break;case b.TYPES.group:this.resolvedType.encode(a,c);c.writeVarint32(f<<3|b.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+a+" (unknown type)");}return c};h.decode=function(a,c,d){if(c!=this.type.wireType)throw Error("Unexpected wire type for element");switch(this.type){case b.TYPES.int32:return a.readVarint32()|0;case b.TYPES.uint32:return a.readVarint32()>>>
+0;case b.TYPES.sint32:return a.readVarint32ZigZag()|0;case b.TYPES.fixed32:return a.readUint32()>>>0;case b.TYPES.sfixed32:return a.readInt32()|0;case b.TYPES.int64:return a.readVarint64();case b.TYPES.uint64:return a.readVarint64().toUnsigned();case b.TYPES.sint64:return a.readVarint64ZigZag();case b.TYPES.fixed64:return a.readUint64();case b.TYPES.sfixed64:return a.readInt64();case b.TYPES.bool:return!!a.readVarint32();case b.TYPES["enum"]:return a.readVarint32();case b.TYPES["float"]:return a.readFloat();
+case b.TYPES["double"]:return a.readDouble();case b.TYPES.string:return a.readVString();case b.TYPES.bytes:d=a.readVarint32();if(a.remaining()<d)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+d+" required but got only "+a.remaining());c=a.clone();c.limit=c.offset+d;a.offset+=d;return c;case b.TYPES.message:return d=a.readVarint32(),this.resolvedType.decode(a,d);case b.TYPES.group:return this.resolvedType.decode(a,-1,d)}throw Error("[INTERNAL] Illegal decode type");};h.valueFromString=
+function(a){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case b.TYPES.int32:case b.TYPES.sint32:case b.TYPES.sfixed32:case b.TYPES.uint32:case b.TYPES.fixed32:return this.verifyValue(parseInt(a));case b.TYPES.int64:case b.TYPES.sint64:case b.TYPES.sfixed64:case b.TYPES.uint64:case b.TYPES.fixed64:return this.verifyValue(a);case b.TYPES.bool:return"true"===a;case b.TYPES.string:return this.verifyValue(a);case b.TYPES.bytes:return e.fromBinary(a)}};
+h.valueToString=function(a){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===b.TYPES.bytes?a.toString("binary"):a.toString()};r.Element=g;var l=function(b,c,d,g,e,h){a.call(this,b,c,d,g,h);this.className="Message";this.extensions=void 0;this.clazz=null;this.isGroup=!!e;this._fieldsByName=this._fieldsById=this._fields=null},h=l.prototype=Object.create(a.prototype);h.build=function(a){if(this.clazz&&!a)return this.clazz;a=function(b,a){function f(a,c,
+d,g){if(null===a||"object"!==typeof a){if(g&&g instanceof b.Reflect.Enum){var k=b.Reflect.Enum.getName(g.object,a);if(null!==k)return k}return a}if(e.isByteBuffer(a))return c?a.toBase64():a.toBuffer();if(b.Long.isLong(a))return d?a.toString():b.Long.fromValue(a);var h;if(Array.isArray(a))return h=[],a.forEach(function(b,a){h[a]=f(b,c,d,g)}),h;h={};if(a instanceof b.Map){for(var k=a.entries(),q=k.next();!q.done;q=k.next())h[a.keyElem.valueToString(q.value[0])]=f(q.value[1],c,d,a.valueElem.resolvedType);
+return h}var k=a.$type,q=void 0,l;for(l in a)a.hasOwnProperty(l)&&(k&&(q=k.getChild(l))?h[l]=f(a[l],c,d,q.resolvedType):h[l]=f(a[l],c,d));return h}var c=a.getChildren(b.Reflect.Message.Field),d=a.getChildren(b.Reflect.Message.OneOf),g=function(f,k){b.Builder.Message.call(this);for(var h=0,q=d.length;h<q;++h)this[d[h].name]=null;h=0;for(q=c.length;h<q;++h){var l=c[h];this[l.name]=l.repeated?[]:l.map?new b.Map(l):null;!l.required&&"proto3"!==a.syntax||null===l.defaultValue||(this[l.name]=l.defaultValue)}if(0<
+arguments.length)if(1!==arguments.length||null===f||"object"!==typeof f||!("function"!==typeof f.encode||f instanceof g)||Array.isArray(f)||f instanceof b.Map||e.isByteBuffer(f)||f instanceof ArrayBuffer||b.Long&&f instanceof b.Long)for(h=0,q=arguments.length;h<q;++h)"undefined"!==typeof(l=arguments[h])&&this.$set(c[h].name,l);else this.$set(f)},k=g.prototype=Object.create(b.Builder.Message.prototype);k.add=function(f,c,d){var g=a._fieldsByName[f];if(!d){if(!g)throw Error(this+"#"+f+" is undefined");
+if(!(g instanceof b.Reflect.Message.Field))throw Error(this+"#"+f+" is not a field: "+g.toString(!0));if(!g.repeated)throw Error(this+"#"+f+" is not a repeated field");c=g.verifyValue(c,!0)}null===this[f]&&(this[f]=[]);this[f].push(c);return this};k.$add=k.add;k.set=function(f,c,d){if(f&&"object"===typeof f){d=c;for(var g in f)f.hasOwnProperty(g)&&"undefined"!==typeof(c=f[g])&&void 0===a._oneofsByName[g]&&this.$set(g,c,d);return this}g=a._fieldsByName[f];if(d)this[f]=c;else{if(!g)throw Error(this+
+"#"+f+" is not a field: undefined");if(!(g instanceof b.Reflect.Message.Field))throw Error(this+"#"+f+" is not a field: "+g.toString(!0));this[g.name]=c=g.verifyValue(c)}g&&g.oneof&&(d=this[g.oneof.name],null!==c?(null!==d&&d!==g.name&&(this[d]=null),this[g.oneof.name]=g.name):d===f&&(this[g.oneof.name]=null));return this};k.$set=k.set;k.get=function(f,c){if(c)return this[f];var d=a._fieldsByName[f];if(!(d&&d instanceof b.Reflect.Message.Field))throw Error(this+"#"+f+" is not a field: undefined");
+if(!(d instanceof b.Reflect.Message.Field))throw Error(this+"#"+f+" is not a field: "+d.toString(!0));return this[d.name]};k.$get=k.get;for(var h=0;h<c.length;h++){var l=c[h];l instanceof b.Reflect.Message.ExtensionField||a.builder.options.populateAccessors&&function(b){var f=b.originalName.replace(/(_[a-zA-Z])/g,function(b){return b.toUpperCase().replace("_","")}),f=f.substring(0,1).toUpperCase()+f.substring(1),c=b.originalName.replace(/([A-Z])/g,function(b){return"_"+b}),d=function(a,f){this[b.name]=
+f?a:b.verifyValue(a);return this},g=function(){return this[b.name]};null===a.getChild("set"+f)&&(k["set"+f]=d);null===a.getChild("set_"+c)&&(k["set_"+c]=d);null===a.getChild("get"+f)&&(k["get"+f]=g);null===a.getChild("get_"+c)&&(k["get_"+c]=g)}(l)}k.encode=function(b,f){"boolean"===typeof b&&(f=b,b=void 0);var c=!1;b||(b=new e,c=!0);var d=b.littleEndian;try{return a.encode(this,b.LE(),f),(c?b.flip():b).LE(d)}catch(A){throw b.LE(d),A;}};g.encode=function(b,a,f){return(new g(b)).encode(a,f)};k.calculate=
+function(){return a.calculate(this)};k.encodeDelimited=function(b,f){var c=!1;b||(b=new e,c=!0);var d=(new e).LE();a.encode(this,d,f).flip();b.writeVarint32(d.remaining());b.append(d);return c?b.flip():b};k.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(q){throw q.encoded&&(q.encoded=q.encoded.toArrayBuffer()),q;}};k.toArrayBuffer=k.encodeAB;k.encodeNB=function(){try{return this.encode().toBuffer()}catch(q){throw q.encoded&&(q.encoded=q.encoded.toBuffer()),q;}};k.toBuffer=k.encodeNB;
+k.encode64=function(){try{return this.encode().toBase64()}catch(q){throw q.encoded&&(q.encoded=q.encoded.toBase64()),q;}};k.toBase64=k.encode64;k.encodeHex=function(){try{return this.encode().toHex()}catch(q){throw q.encoded&&(q.encoded=q.encoded.toHex()),q;}};k.toHex=k.encodeHex;k.toRaw=function(b,a){return f(this,!!b,!!a,this.$type)};k.encodeJSON=function(){return JSON.stringify(f(this,!0,!0,this.$type))};g.decode=function(b,f,c){"string"===typeof f&&(c=f,f=-1);"string"===typeof b?b=e.wrap(b,c?
+c:"base64"):e.isByteBuffer(b)||(b=e.wrap(b));c=b.littleEndian;try{var d=a.decode(b.LE(),f);b.LE(c);return d}catch(A){throw b.LE(c),A;}};g.decodeDelimited=function(b,f){"string"===typeof b?b=e.wrap(b,f?f:"base64"):e.isByteBuffer(b)||(b=e.wrap(b));if(1>b.remaining())return null;var c=b.offset,d=b.readVarint32();if(b.remaining()<d)return b.offset=c,null;try{var g=a.decode(b.slice(b.offset,b.offset+d).LE());b.offset+=d;return g}catch(B){throw b.offset+=d,B;}};g.decode64=function(b){return g.decode(b,
+"base64")};g.decodeHex=function(b){return g.decode(b,"hex")};g.decodeJSON=function(b){return new g(JSON.parse(b))};k.toString=function(){return a.toString()};Object.defineProperty&&(Object.defineProperty(g,"$options",{value:a.buildOpt()}),Object.defineProperty(k,"$options",{value:g.$options}),Object.defineProperty(g,"$type",{value:a}),Object.defineProperty(k,"$type",{value:a}));return g}(b,this);this._fields=[];this._fieldsById={};this._fieldsByName={};this._oneofsByName={};for(var f=0,c=this.children.length,
+d;f<c;f++)if(d=this.children[f],d instanceof v||d instanceof l||d instanceof u){if(a.hasOwnProperty(d.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+d.toString(!0)+" cannot override static property '"+d.name+"'");a[d.name]=d.build()}else if(d instanceof l.Field)d.build(),this._fields.push(d),this._fieldsById[d.id]=d,this._fieldsByName[d.name]=d;else if(d instanceof l.OneOf)this._oneofsByName[d.name]=d;else if(!(d instanceof l.OneOf||d instanceof w))throw Error("Illegal reflect child of "+
+this.toString(!0)+": "+this.children[f].toString(!0));return this.clazz=a};h.encode=function(b,a,c){for(var f=null,d,g=0,k=this._fields.length,h;g<k;++g)d=this._fields[g],h=b[d.name],d.required&&null===h?null===f&&(f=d):d.encode(c?h:d.verifyValue(h),a,b);if(null!==f)throw b=Error("Missing at least one required field for "+this.toString(!0)+": "+f),b.encoded=a,b;return a};h.calculate=function(b){for(var a=0,f=0,c=this._fields.length,d,g;f<c;++f){d=this._fields[f];g=b[d.name];if(d.required&&null===
+g)throw Error("Missing at least one required field for "+this.toString(!0)+": "+d);a+=d.calculate(g,b)}return a};h.decode=function(a,c,d){"number"!==typeof c&&(c=-1);for(var f=a.offset,g=new this.clazz,k,h,e;a.offset<f+c||-1===c&&0<a.remaining();){k=a.readVarint32();h=k&7;e=k>>>3;if(h===b.WIRE_TYPES.ENDGROUP){if(e!==d)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+e+" ("+(d?d+" expected":"not a group")+")");break}if(k=this._fieldsById[e])k.repeated&&!k.options.packed?g[k.name].push(k.decode(h,
+a)):k.map?(h=k.decode(h,a),g[k.name].set(h[0],h[1])):(g[k.name]=k.decode(h,a),k.oneof&&(h=g[k.oneof.name],null!==h&&h!==k.name&&(g[h]=null),g[k.oneof.name]=k.name));else switch(h){case b.WIRE_TYPES.VARINT:a.readVarint32();break;case b.WIRE_TYPES.BITS32:a.offset+=4;break;case b.WIRE_TYPES.BITS64:a.offset+=8;break;case b.WIRE_TYPES.LDELIM:k=a.readVarint32();a.offset+=k;break;case b.WIRE_TYPES.STARTGROUP:for(;y(e,a););break;default:throw Error("Illegal wire type for unknown field "+e+" in "+this.toString(!0)+
+"#decode: "+h);}}a=0;for(c=this._fields.length;a<c;++a)if(k=this._fields[a],null===g[k.name])if("proto3"===this.syntax)g[k.name]=k.defaultValue;else{if(k.required)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+k.name),a.decoded=g,a;b.populateDefaults&&null!==k.defaultValue&&(g[k.name]=k.defaultValue)}return g};r.Message=l;var c=function(a,c,d,g,h,e,n,t,w,y){m.call(this,a,c,e);this.className="Message.Field";this.required="required"===d;this.repeated="repeated"===d;
+this.map="map"===d;this.keyType=g||null;this.type=h;this.resolvedType=null;this.id=n;this.options=t||{};this.defaultValue=null;this.oneof=w||null;this.syntax=y||"proto2";this.originalName=this.name;this.keyElement=this.element=null;!this.builder.options.convertFieldsToCamelCase||this instanceof l.ExtensionField||(this.name=b.Util.toCamelCase(this.name))},h=c.prototype=Object.create(m.prototype);h.build=function(){this.element=new g(this.type,this.resolvedType,!1,this.syntax,this.name);this.map&&(this.keyElement=
+new g(this.keyType,void 0,!0,this.syntax,this.name));"proto3"!==this.syntax||this.repeated||this.map?"undefined"!==typeof this.options["default"]&&(this.defaultValue=this.verifyValue(this.options["default"])):this.defaultValue=g.defaultFieldValue(this.type)};h.verifyValue=function(a,c){function f(b,a){throw Error("Illegal value for "+d.toString(!0)+" of type "+d.type.name+": "+b+" ("+a+")");}c=c||!1;var d=this;if(null===a)return this.required&&f(typeof a,"required"),"proto3"===this.syntax&&this.type!==
+b.TYPES.message&&f(typeof a,"proto3 field without field presence cannot be null"),null;var g;if(this.repeated&&!c){Array.isArray(a)||(a=[a]);var k=[];for(g=0;g<a.length;g++)k.push(this.element.verifyValue(a[g]));return k}if(this.map&&!c){if(a instanceof b.Map)return a;a instanceof Object||f(typeof a,"expected ProtoBuf.Map or raw object for map field");return new b.Map(this,a)}!this.repeated&&Array.isArray(a)&&f(typeof a,"no array expected");return this.element.verifyValue(a)};h.hasWirePresence=function(a,
+c){if("proto3"!==this.syntax)return null!==a;if(this.oneof&&c[this.oneof.name]===this.name)return!0;switch(this.type){case b.TYPES.int32:case b.TYPES.sint32:case b.TYPES.sfixed32:case b.TYPES.uint32:case b.TYPES.fixed32:return 0!==a;case b.TYPES.int64:case b.TYPES.sint64:case b.TYPES.sfixed64:case b.TYPES.uint64:case b.TYPES.fixed64:return 0!==a.low||0!==a.high;case b.TYPES.bool:return a;case b.TYPES["float"]:case b.TYPES["double"]:return 0!==a;case b.TYPES.string:return 0<a.length;case b.TYPES.bytes:return 0<
+a.remaining();case b.TYPES["enum"]:return 0!==a;case b.TYPES.message:return null!==a;default:return!0}};h.encode=function(a,c,d){if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return c;try{if(this.repeated){var f;if(this.options.packed&&0<=b.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){c.writeVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);c.ensureCapacity(c.offset+=1);var g=c.offset;
+for(f=0;f<a.length;f++)this.element.encodeValue(this.id,a[f],c);var h=c.offset-g,k=e.calculateVarint32(h);if(1<k){var l=c.slice(g,c.offset),g=g+(k-1);c.offset=g;c.append(l)}c.writeVarint32(h,g-k)}else for(f=0;f<a.length;f++)c.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a[f],c)}else this.map?a.forEach(function(a,d,f){f=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,d)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,
+a);c.writeVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);c.writeVarint32(f);c.writeVarint32(8|this.keyType.wireType);this.keyElement.encodeValue(1,d,c);c.writeVarint32(16|this.type.wireType);this.element.encodeValue(2,a,c)},this):this.hasWirePresence(a,d)&&(c.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a,c))}catch(C){throw Error("Illegal value for "+this.toString(!0)+": "+a+" ("+C+")");}return c};h.calculate=function(a,c){a=this.verifyValue(a);if(null===this.type||"object"!==
+typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return 0;var d=0;try{if(this.repeated){var f,g;if(this.options.packed&&0<=b.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){d+=e.calculateVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);for(f=g=0;f<a.length;f++)g+=this.element.calculateLength(this.id,a[f]);d+=e.calculateVarint32(g);d+=g}else for(f=0;f<a.length;f++)d+=e.calculateVarint32(this.id<<3|this.type.wireType),d+=
+this.element.calculateLength(this.id,a[f])}else this.map?a.forEach(function(a,c,f){a=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,c)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);d+=e.calculateVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);d+=e.calculateVarint32(a);d+=a},this):this.hasWirePresence(a,c)&&(d+=e.calculateVarint32(this.id<<3|this.type.wireType),d+=this.element.calculateLength(this.id,a))}catch(x){throw Error("Illegal value for "+
+this.toString(!0)+": "+a+" ("+x+")");}return d};h.decode=function(a,c,d){if(!(!this.map&&a==this.type.wireType||!d&&this.repeated&&this.options.packed&&a==b.WIRE_TYPES.LDELIM||this.map&&a==b.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+a+" ("+this.type.wireType+" expected)");if(a==b.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&0<=b.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)&&!d){a=c.readVarint32();a=c.offset+a;for(d=[];c.offset<a;)d.push(this.decode(this.type.wireType,
+c,!0));return d}if(this.map){var f=g.defaultFieldValue(this.keyType);d=g.defaultFieldValue(this.type);a=c.readVarint32();if(c.remaining()<a)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+a+" required but got only "+c.remaining());var h=c.clone();h.limit=h.offset+a;for(c.offset+=a;0<h.remaining();)if(c=h.readVarint32(),a=c&7,c>>>=3,1===c)f=this.keyElement.decode(h,a,c);else if(2===c)d=this.element.decode(h,a,c);else throw Error("Unexpected tag in map field key/value submessage");
+return[f,d]}return this.element.decode(c,a,this.id)};r.Message.Field=c;h=function(a,b,d,g,h,e,l){c.call(this,a,b,d,null,g,h,e,l)};h.prototype=Object.create(c.prototype);r.Message.ExtensionField=h;r.Message.OneOf=function(a,b,c){m.call(this,a,b,c);this.fields=[]};var v=function(b,c,d,g,h){a.call(this,b,c,d,g,h);this.className="Enum";this.object=null};v.getName=function(a,b){for(var c=Object.keys(a),d=0,g;d<c.length;++d)if(a[g=c[d]]===b)return g;return null};(v.prototype=Object.create(a.prototype)).build=
+function(a){if(this.object&&!a)return this.object;a=new b.Builder.Enum;for(var c=this.getChildren(v.Value),d=0,g=c.length;d<g;++d)a[c[d].name]=c[d].id;Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt(),enumerable:!1});return this.object=a};r.Enum=v;h=function(a,b,c,d){m.call(this,a,b,c);this.className="Enum.Value";this.id=d};h.prototype=Object.create(m.prototype);r.Enum.Value=h;var w=function(a,b,c,d){m.call(this,a,b,c);this.field=d};w.prototype=Object.create(m.prototype);
+r.Extension=w;var u=function(b,c,d,g){a.call(this,b,c,d,g);this.className="Service";this.clazz=null};(u.prototype=Object.create(a.prototype)).build=function(a){return this.clazz&&!a?this.clazz:this.clazz=function(a,b){for(var c=function(b){a.Builder.Service.call(this);this.rpcImpl=b||function(a,b,c){setTimeout(c.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},d=c.prototype=Object.create(a.Builder.Service.prototype),g=b.getChildren(a.Reflect.Service.RPCMethod),
+f=0;f<g.length;f++)(function(a){d[a.name]=function(c,d){try{try{c=a.resolvedRequestType.clazz.decode(e.wrap(c))}catch(z){if(!(z instanceof TypeError))throw z;}if(null===c||"object"!==typeof c)throw Error("Illegal arguments");c instanceof a.resolvedRequestType.clazz||(c=new a.resolvedRequestType.clazz(c));this.rpcImpl(a.fqn(),c,function(c,g){if(c)d(c);else{null===g&&(g="");try{g=a.resolvedResponseType.clazz.decode(g)}catch(D){}g&&g instanceof a.resolvedResponseType.clazz?d(null,g):d(Error("Illegal response type received in service method "+
+b.name+"#"+a.name))}})}catch(z){setTimeout(d.bind(this,z),0)}};c[a.name]=function(b,d,g){(new c(b))[a.name](d,g)};Object.defineProperty&&(Object.defineProperty(c[a.name],"$options",{value:a.buildOpt()}),Object.defineProperty(d[a.name],"$options",{value:c[a.name].$options}))})(g[f]);Object.defineProperty&&(Object.defineProperty(c,"$options",{value:b.buildOpt()}),Object.defineProperty(d,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:b}),Object.defineProperty(d,"$type",{value:b}));
+return c}(b,this)};r.Service=u;var p=function(a,b,c,d){m.call(this,a,b,c);this.className="Service.Method";this.options=d||{}};(p.prototype=Object.create(m.prototype)).buildOpt=n.buildOpt;r.Service.Method=p;n=function(a,b,c,d,g,h,e,l){p.call(this,a,b,c,l);this.className="Service.RPCMethod";this.requestName=d;this.responseName=g;this.requestStream=h;this.responseStream=e;this.resolvedResponseType=this.resolvedRequestType=null};n.prototype=Object.create(p.prototype);r.Service.RPCMethod=n;return r}(d);
+d.Builder=function(b,d,e){function t(a){a.messages&&a.messages.forEach(function(b){b.syntax=a.syntax;t(b)});a.enums&&a.enums.forEach(function(b){b.syntax=a.syntax})}var m=function(a){this.ptr=this.ns=new e.Namespace(this,null,"");this.resolved=!1;this.result=null;this.files={};this.importRoot=null;this.options=a||{}},n=m.prototype;m.isMessage=function(a){return"string"!==typeof a.name||"undefined"!==typeof a.values||"undefined"!==typeof a.rpc?!1:!0};m.isMessageField=function(a){return"string"!==typeof a.rule||
+"string"!==typeof a.name||"string"!==typeof a.type||"undefined"===typeof a.id?!1:!0};m.isEnum=function(a){return"string"===typeof a.name&&"undefined"!==typeof a.values&&Array.isArray(a.values)&&0!==a.values.length?!0:!1};m.isService=function(a){return"string"===typeof a.name&&"object"===typeof a.rpc&&a.rpc?!0:!1};m.isExtend=function(a){return"string"!==typeof a.ref?!1:!0};n.reset=function(){this.ptr=this.ns;return this};n.define=function(a){if("string"!==typeof a||!d.TYPEREF.test(a))throw Error("illegal namespace: "+
+a);a.split(".").forEach(function(a){var b=this.ptr.getChild(a);null===b&&this.ptr.addChild(b=new e.Namespace(this,this.ptr,a));this.ptr=b},this);return this};n.create=function(a){if(!a)return this;if(Array.isArray(a)){if(0===a.length)return this;a=a.slice()}else a=[a];for(var d=[a];0<d.length;){a=d.pop();if(!Array.isArray(a))throw Error("not a valid namespace: "+JSON.stringify(a));for(;0<a.length;){var h=a.shift();if(m.isMessage(h)){var l=new e.Message(this,this.ptr,h.name,h.options,h.isGroup,h.syntax),
+c={};h.oneofs&&Object.keys(h.oneofs).forEach(function(a){l.addChild(c[a]=new e.Message.OneOf(this,l,a))},this);h.fields&&h.fields.forEach(function(a){if(null!==l.getChild(a.id|0))throw Error("duplicate or invalid field id in "+l.name+": "+a.id);if(a.options&&"object"!==typeof a.options)throw Error("illegal field options in "+l.name+"#"+a.name);var b=null;if("string"===typeof a.oneof&&!(b=c[a.oneof]))throw Error("illegal oneof in "+l.name+"#"+a.name+": "+a.oneof);a=new e.Message.Field(this,l,a.rule,
+a.keytype,a.type,a.name,a.id,a.options,b,h.syntax);b&&b.fields.push(a);l.addChild(a)},this);var n=[];h.enums&&h.enums.forEach(function(a){n.push(a)});h.messages&&h.messages.forEach(function(a){n.push(a)});h.services&&h.services.forEach(function(a){n.push(a)});h.extensions&&(l.extensions="number"===typeof h.extensions[0]?[h.extensions]:h.extensions);this.ptr.addChild(l);if(0<n.length){d.push(a);a=n;n=null;this.ptr=l;l=null;continue}n=null}else if(m.isEnum(h))l=new e.Enum(this,this.ptr,h.name,h.options,
+h.syntax),h.values.forEach(function(a){l.addChild(new e.Enum.Value(this,l,a.name,a.id))},this),this.ptr.addChild(l);else if(m.isService(h))l=new e.Service(this,this.ptr,h.name,h.options),Object.keys(h.rpc).forEach(function(a){var b=h.rpc[a];l.addChild(new e.Service.RPCMethod(this,l,a,b.request,b.response,!!b.request_stream,!!b.response_stream,b.options))},this),this.ptr.addChild(l);else if(m.isExtend(h))if(l=this.ptr.resolve(h.ref,!0))h.fields.forEach(function(a){if(null!==l.getChild(a.id|0))throw Error("duplicate extended field id in "+
+l.name+": "+a.id);if(l.extensions){var c=!1;l.extensions.forEach(function(b){a.id>=b[0]&&a.id<=b[1]&&(c=!0)});if(!c)throw Error("illegal extended field id in "+l.name+": "+a.id+" (not within valid ranges)");}var d=a.name;this.options.convertFieldsToCamelCase&&(d=b.Util.toCamelCase(d));var d=new e.Message.ExtensionField(this,l,a.rule,a.type,this.ptr.fqn()+"."+d,a.id,a.options),g=new e.Extension(this,this.ptr,a.name,d);d.extension=g;this.ptr.addChild(g);l.addChild(d)},this);else{if(!/\.?google\.protobuf\./.test(h.ref))throw Error("extended message "+
+h.ref+" is not defined");}else throw Error("not a valid definition: "+JSON.stringify(h));l=h=null}a=null;this.ptr=this.ptr.parent}this.resolved=!1;this.result=null;return this};n["import"]=function(a,d){var g="/";if("string"===typeof d){b.Util.IS_NODE&&(d=require("path").resolve(d));if(!0===this.files[d])return this.reset();this.files[d]=!0}else if("object"===typeof d){var e=d.root;b.Util.IS_NODE&&(e=require("path").resolve(e));if(0<=e.indexOf("\\")||0<=d.file.indexOf("\\"))g="\\";e=b.Util.IS_NODE?
+require("path").join(e,d.file):e+g+d.file;if(!0===this.files[e])return this.reset();this.files[e]=!0}if(a.imports&&0<a.imports.length){var c=!1;if("object"===typeof d){if(this.importRoot=d.root,c=!0,e=this.importRoot,d=d.file,0<=e.indexOf("\\")||0<=d.indexOf("\\"))g="\\"}else"string"===typeof d?this.importRoot?e=this.importRoot:0<=d.indexOf("/")?(e=d.replace(/\/[^\/]*$/,""),""===e&&(e="/")):0<=d.indexOf("\\")?(e=d.replace(/\\[^\\]*$/,""),g="\\"):e=".":e=null;for(var n=0;n<a.imports.length;n++)if("string"===
+typeof a.imports[n]){if(!e)throw Error("cannot determine import root");var m=a.imports[n];if("google/protobuf/descriptor.proto"!==m&&(m=b.Util.IS_NODE?require("path").join(e,m):e+g+m,!0!==this.files[m])){/\.proto$/i.test(m)&&!b.DotProto&&(m=m.replace(/\.proto$/,".json"));var r=b.Util.fetch(m);if(null===r)throw Error("failed to import '"+m+"' in '"+d+"': file not found");if(/\.json$/i.test(m))this["import"](JSON.parse(r+""),m);else this["import"](b.DotProto.Parser.parse(r),m)}}else if(d)if(/\.(\w+)$/.test(d))this["import"](a.imports[n],
+d.replace(/^(.+)\.(\w+)$/,function(a,b,c){return b+"_import"+n+"."+c}));else this["import"](a.imports[n],d+"_import"+n);else this["import"](a.imports[n]);c&&(this.importRoot=null)}a["package"]&&this.define(a["package"]);a.syntax&&t(a);var p=this.ptr;a.options&&Object.keys(a.options).forEach(function(b){p.options[b]=a.options[b]});a.messages&&(this.create(a.messages),this.ptr=p);a.enums&&(this.create(a.enums),this.ptr=p);a.services&&(this.create(a.services),this.ptr=p);a["extends"]&&this.create(a["extends"]);
+return this.reset()};n.resolveAll=function(){var a;if(null==this.ptr||"object"===typeof this.ptr.type)return this;if(this.ptr instanceof e.Namespace)this.ptr.children.forEach(function(a){this.ptr=a;this.resolveAll()},this);else if(this.ptr instanceof e.Message.Field){if(d.TYPE.test(this.ptr.type))this.ptr.type=b.TYPES[this.ptr.type];else{if(!d.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);a=(this.ptr instanceof e.Message.ExtensionField?
+this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0);if(!a)throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.resolvedType=a;if(a instanceof e.Enum){if(this.ptr.type=b.TYPES["enum"],"proto3"===this.ptr.syntax&&"proto3"!==a.syntax)throw Error("proto3 message cannot reference proto2 enum");}else if(a instanceof e.Message)this.ptr.type=a.isGroup?b.TYPES.group:b.TYPES.message;else throw Error("illegal type reference in "+this.ptr.toString(!0)+
+": "+this.ptr.type);}if(this.ptr.map){if(!d.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=b.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==b.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&(this.ptr.options.packed=!0)}else if(this.ptr instanceof b.Reflect.Service.Method)if(this.ptr instanceof b.Reflect.Service.RPCMethod){a=this.ptr.parent.resolve(this.ptr.requestName,
+!0);if(!(a&&a instanceof b.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);this.ptr.resolvedRequestType=a;a=this.ptr.parent.resolve(this.ptr.responseName,!0);if(!(a&&a instanceof b.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=a}else throw Error("illegal service type in "+this.ptr.toString(!0));else if(!(this.ptr instanceof b.Reflect.Message.OneOf||
+this.ptr instanceof b.Reflect.Extension||this.ptr instanceof b.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()};n.build=function(a){this.reset();this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null);null===this.result&&(this.result=this.ns.build());if(!a)return this.result;a="string"===typeof a?a.split("."):a;for(var b=this.result,d=0;d<a.length;d++)if(b[a[d]])b=b[a[d]];else{b=null;break}return b};n.lookup=function(a,
+b){return a?this.ns.resolve(a,b):this.ns};n.toString=function(){return"Builder"};m.Message=function(){};m.Enum=function(){};m.Service=function(){};return m}(d,d.Lang,d.Reflect);d.Map=function(b,d){function e(b){var a=0;return{next:function(){return a<b.length?{done:!1,value:b[a++]}:{done:!0}}}}var t=function(b,a){if(!b.map)throw Error("field is not a map");this.field=b;this.keyElem=new d.Element(b.keyType,null,!0,b.syntax);this.valueElem=new d.Element(b.type,b.resolvedType,!1,b.syntax);this.map={};
+Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}});if(a)for(var g=Object.keys(a),e=0;e<g.length;e++){var l=this.keyElem.valueFromString(g[e]),c=this.valueElem.verifyValue(a[g[e]]);this.map[this.keyElem.valueToString(l)]={key:l,value:c}}},m=t.prototype;m.clear=function(){this.map={}};m["delete"]=function(b){b=this.keyElem.valueToString(this.keyElem.verifyValue(b));var a=b in this.map;delete this.map[b];return a};m.entries=function(){for(var b=[],a=Object.keys(this.map),
+d=0,h;d<a.length;d++)b.push([(h=this.map[a[d]]).key,h.value]);return e(b)};m.keys=function(){for(var b=[],a=Object.keys(this.map),d=0;d<a.length;d++)b.push(this.map[a[d]].key);return e(b)};m.values=function(){for(var b=[],a=Object.keys(this.map),d=0;d<a.length;d++)b.push(this.map[a[d]].value);return e(b)};m.forEach=function(b,a){for(var d=Object.keys(this.map),e=0,l;e<d.length;e++)b.call(a,(l=this.map[d[e]]).value,l.key,this)};m.set=function(b,a){var d=this.keyElem.verifyValue(b),e=this.valueElem.verifyValue(a);
+this.map[this.keyElem.valueToString(d)]={key:d,value:e};return this};m.get=function(b){b=this.keyElem.valueToString(this.keyElem.verifyValue(b));if(b in this.map)return this.map[b].value};m.has=function(b){return this.keyElem.valueToString(this.keyElem.verifyValue(b))in this.map};return t}(d,d.Reflect);d.loadProto=function(b,e,p){if("string"===typeof e||e&&"string"===typeof e.file&&"string"===typeof e.root)p=e,e=void 0;return d.loadJson(d.DotProto.Parser.parse(b),e,p)};d.protoFromString=d.loadProto;
+d.loadProtoFile=function(b,e,p){e&&"object"===typeof e?(p=e,e=null):e&&"function"===typeof e||(e=null);if(e)return d.Util.fetch("string"===typeof b?b:b.root+"/"+b.file,function(m){if(null===m)e(Error("Failed to fetch file"));else try{e(null,d.loadProto(m,p,b))}catch(n){e(n)}});var t=d.Util.fetch("object"===typeof b?b.root+"/"+b.file:b);return null===t?null:d.loadProto(t,p,b)};d.protoFromFile=d.loadProtoFile;d.newBuilder=function(b){b=b||{};"undefined"===typeof b.convertFieldsToCamelCase&&(b.convertFieldsToCamelCase=
+d.convertFieldsToCamelCase);"undefined"===typeof b.populateAccessors&&(b.populateAccessors=d.populateAccessors);return new d.Builder(b)};d.loadJson=function(b,e,p){if("string"===typeof e||e&&"string"===typeof e.file&&"string"===typeof e.root)p=e,e=null;e&&"object"===typeof e||(e=d.newBuilder());"string"===typeof b&&(b=JSON.parse(b));e["import"](b,p);e.resolveAll();return e};d.loadJsonFile=function(b,e,p){e&&"object"===typeof e?(p=e,e=null):e&&"function"===typeof e||(e=null);if(e)return d.Util.fetch("string"===
+typeof b?b:b.root+"/"+b.file,function(m){if(null===m)e(Error("Failed to fetch file"));else try{e(null,d.loadJson(JSON.parse(m),p,b))}catch(n){e(n)}});var r=d.Util.fetch("object"===typeof b?b.root+"/"+b.file:b);return null===r?null:d.loadJson(JSON.parse(r),p,b)};return d});
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js.gz b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js.gz
new file mode 100644 (file)
index 0000000..fdb954a
Binary files /dev/null and b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.js.gz differ
diff --git a/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.map b/legacy-libs/grpc/node_modules/protobufjs/dist/protobuf.min.map
new file mode 100644 (file)
index 0000000..ebc412f
--- /dev/null
@@ -0,0 +1,8 @@
+{
+"version":3,
+"file":"",
+"lineCount":116,
+"mappings":"A;;;;;AAyBA,IAAI,QAAU,CAGN,MAAQ,EAHF,CCWd,QAAA,eAAA,CACsC,UAAlC,EAAA,MAAO,OAAA,iBAAP,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAErC,GAAI,CAAA,IAAJ,EAAsB,CAAA,IAAtB,CACE,KAAM,KAAI,SAAJ,CAAc,2CAAd,CAAN,CAEE,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CACmB,CAAA,MADnB,CALqC,CCV3C,QAAA,UAAA,CAAoB,QAAQ,CAAC,CAAD,CAAc,CACxC,MAAyB,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAA4C,CAA5C,CACH,CADG,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CAAmD,MAAnD,CAA4D,CAHxB,CAc1C,QAAA,OAAA,CAAiB,OAAA,UAAA,CAAkB,IAAlB,CCvBjB,QAAA,cAAA,CAAwB,gBAOxB;OAAA,WAAA,CAAqB,QAAQ,EAAG,CAE9B,OAAA,WAAA,CAAqB,QAAQ,EAAG,EAE3B,QAAA,OAAA,OAAL,GACE,OAAA,OAAA,OADF,CAC0B,OAAA,OAD1B,CAJ8B,CAWhC,QAAA,eAAA,CAAyB,CASzB,QAAA,OAAA,CAAiB,QAAQ,CAAC,CAAD,CAAkB,CACzC,MACI,QAAA,cADJ,EAC6B,CAD7B,EACgD,EADhD,EACuD,OAAA,eAAA,EAFd,CAW3C;OAAA,mBAAA,CAA6B,QAAQ,EAAG,CACtC,OAAA,WAAA,EACA,KAAI,EAAiB,OAAA,OAAA,OAAA,SAChB,EAAL,GACE,CADF,CACmB,OAAA,OAAA,OAAA,SADnB,CAEM,OAAA,OAAA,OAAA,CAAsB,UAAtB,CAFN,CAK8C,WAA9C,EAAI,MAAO,MAAA,UAAA,CAAgB,CAAhB,CAAX,EACE,OAAA,eAAA,CACI,KAAA,UADJ,CACqB,CADrB,CACqC,CAC/B,aAAc,CAAA,CADiB,CAE/B,SAAU,CAAA,CAFqB,CAO/B,MAAO,QAAQ,EAAG,CAChB,MAAO,QAAA,cAAA,CAAsB,IAAtB,CADS,CAPa,CADrC,CAeF,QAAA,mBAAA,CAA6B,QAAQ,EAAG,EAxBF,CAkCxC,QAAA,cAAA,CAAwB,QAAQ,CAAC,CAAD,CAAQ,CACtC,IAAI,EAAQ,CACZ,OAAO,QAAA,kBAAA,CAA0B,QAAQ,EAAG,CAC1C,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPiC,CAArC,CAF+B,CA0BxC;OAAA,kBAAA,CAA4B,QAAQ,CAAC,CAAD,CAAO,CACzC,OAAA,mBAAA,EAEI,EAAA,CAAW,CAAC,KAAM,CAAP,CAKf,EAAA,CAAS,OAAA,OAAA,OAAA,SAAT,CAAA,CAA2C,QAAQ,EAAG,CAAE,MAAO,KAAT,CACtD,OAAyC,EATA,CChG3C,QAAA,MAAA,CAAgB,OAAA,MAAhB,EAAiC,EAWjC,QAAA,kBAAA,CAA4B,QAAQ,CAAC,CAAD,CAAQ,CAAR,CAAmB,CACrD,OAAA,mBAAA,EAEI,EAAJ,WAAqB,OAArB,GAAqC,CAArC,EAA6C,EAA7C,CACA,KAAI,EAAI,CAAR,CACI,EAAO,CACT,KAAM,QAAQ,EAAG,CACf,GAAI,CAAJ,CAAQ,CAAA,OAAR,CAAsB,CACpB,IAAI,EAAQ,CAAA,EACZ,OAAO,CAAC,MAAO,CAAA,CAAU,CAAV,CAAiB,CAAA,CAAM,CAAN,CAAjB,CAAR,CAAwC,KAAM,CAAA,CAA9C,CAFa,CAItB,CAAA,KAAA,CAAY,QAAQ,EAAG,CAAE,MAAO,CAAC,KAAM,CAAA,CAAP,CAAa,MAAO,IAAK,EAAzB,CAAT,CACvB,OAAO,EAAA,KAAA,EANQ,CADR,CAUX,EAAA,CAAK,MAAA,SAAL,CAAA,CAAwB,QAAQ,EAAG,CAAE,MAAO,EAAT,CACnC,OAAO,EAhB8C,CCJvD;OAAA,SAAA,CAAmB,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA6B,CAA7B,CAAqC,CAC9D,GAAK,CAAL,CAAA,CACI,CAAA,CAAM,OAAA,OACN,EAAA,CAAQ,CAAA,MAAA,CAAa,GAAb,CACZ,KAAS,CAAT,CAAa,CAAb,CAAgB,CAAhB,CAAoB,CAAA,OAApB,CAAmC,CAAnC,CAAsC,CAAA,EAAtC,CAA2C,CACzC,IAAI,EAAM,CAAA,CAAM,CAAN,CACJ,EAAN,GAAa,EAAb,GAAmB,CAAA,CAAI,CAAJ,CAAnB,CAA8B,EAA9B,CACA,EAAA,CAAM,CAAA,CAAI,CAAJ,CAHmC,CAKvC,CAAA,CAAW,CAAA,CAAM,CAAA,OAAN,CAAqB,CAArB,CACX,EAAA,CAAO,CAAA,CAAI,CAAJ,CACP,EAAA,CAAO,CAAA,CAAS,CAAT,CACP,EAAJ,EAAY,CAAZ,EAA4B,IAA5B,EAAoB,CAApB,EACA,OAAA,eAAA,CACI,CADJ,CACS,CADT,CACmB,CAAC,aAAc,CAAA,CAAf,CAAqB,SAAU,CAAA,CAA/B,CAAqC,MAAO,CAA5C,CADnB,CAZA,CAD8D,CCVhE,QAAA,SAAA,CAAiB,sBAAjB,CAAyC,QAAQ,CAAC,CAAD,CAAO,CACtD,MAAI,EAAJ,CAAiB,CAAjB,CAQe,QAAQ,EAAG,CACxB,MAAO,QAAA,kBAAA,CAA0B,IAA1B,CAAgC,QAAQ,CAAC,CAAD,CAAI,CAAE,MAAO,EAAT,CAA5C,CADiB,CAT4B,CAAxD,CAcG,UAdH,CAce,KAdf,CCAA;OAAA,SAAA,CAAiB,yBAAjB,CAA4C,QAAQ,CAAC,CAAD,CAAO,CACzD,MAAI,EAAJ,CAAiB,CAAjB,CAUe,QAAQ,EAAG,CACxB,MAAO,QAAA,kBAAA,CACH,IADG,CACG,QAAQ,CAAC,CAAD,CAAI,CAAJ,CAAO,CAAE,MAAO,CAAC,CAAD,CAAI,CAAJ,CAAT,CADlB,CADiB,CAX+B,CAA3D,CAiBG,UAjBH,CAiBe,KAjBf,CCAA,QAAA,SAAA,CAAiB,wBAAjB,CAA2C,QAAQ,CAAC,CAAD,CAAO,CACxD,MAAI,EAAJ,CAAiB,CAAjB,CASe,QAAQ,EAAG,CACxB,MAAO,QAAA,kBAAA,CAA0B,IAA1B,CAAgC,QAAQ,CAAC,CAAD,CAAI,CAAJ,CAAO,CAAE,MAAO,EAAT,CAA/C,CADiB,CAV8B,CAA1D,CAeG,KAfH,CAeU,KAfV,CCEC;SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkB,CAES,UAAtB,GAAI,MAAOC,OAAX,EAAoCA,MAAA,IAApC,CACNA,MAAA,CAAO,CAAC,YAAD,CAAP,CAAuBD,CAAvB,CADM,CAEiC,UAAvB,GAAI,MAAOE,QAAX,EAAuD,QAAvD,GAAqC,MAAOC,OAA5C,EAAmEA,MAAnE,EAA6EA,MAAA,QAA7E,CAChBA,MAAA,QADgB,CACIH,CAAA,CAAQE,OAAA,CAAQ,YAAR,CAAR,CAA+B,CAAA,CAA/B,CADJ,CAGhB,CAACH,CAAA,QAAD,CAAqBA,CAAA,QAArB,EAA0C,EAA1C,UAHgB,CAG4CC,CAAA,CAAQD,CAAA,QAAA,WAAR,CAPzC,CAA1B,CAAD,CASG,IATH,CASS,QAAQ,CAACK,CAAD,CAAaC,CAAb,CAAyB,CAStC,IAAIC,EAAW,EAMfA,EAAAF,WAAA,CAAsBA,CAMtBE,EAAAC,KAAA,CAAgBH,CAAAG,KAAhB,EAAmC,IAQnCD,EAAAE,QAAA,CAAmB,OAQnBF,EAAAG,WAAA,CAAsB,EAOtBH,EAAAG,WAAAC,OAAA,CAA6B,CAQ7BJ,EAAAG,WAAAE,OAAA,CAA6B,CAQ7BL,EAAAG,WAAAG,OAAA,CAA6B,CAQ7BN,EAAAG,WAAAI,WAAA,CAAiC,CAQjCP,EAAAG,WAAAK,SAAA,CAA+B,CAQ/BR,EAAAG,WAAAM,OAAA,CAA6B,CAQ7BT,EAAAU,oBAAA;AAA+B,CAC3BV,CAAAG,WAAAC,OAD2B,CAE3BJ,CAAAG,WAAAE,OAF2B,CAG3BL,CAAAG,WAAAM,OAH2B,CAa/BT,EAAAW,MAAA,CAAiB,CAEb,MAAS,CACLC,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAC,OAFL,CAGLU,aAAc,CAHT,CAFI,CAOb,OAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ,CAGNU,aAAc,CAHR,CAPG,CAYb,OAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ,CAGNU,aAAc,CAHR,CAZG,CAiBb,MAAS,CACLF,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAC,OAFL,CAGLU,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAc,KAAhB,CAAqCC,IAAAA,EAH9C,CAjBI,CAsBb,OAAU,CACNJ,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ,CAGNU,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAgB,MAAhB,CAAsCD,IAAAA,EAH9C,CAtBG,CA2Bb,OAAU,CACNJ,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAC,OAFJ;AAGNU,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAc,KAAhB,CAAqCC,IAAAA,EAH7C,CA3BG,CAgCb,KAAQ,CACJJ,KAAM,MADF,CAEJC,SAAUb,CAAAG,WAAAC,OAFN,CAGJU,aAAc,CAAA,CAHV,CAhCK,CAqCb,SAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAE,OAFJ,CAGNS,aAAc,CAHR,CArCG,CA0Cb,OAAU,CACNF,KAAM,QADA,CAENC,SAAUb,CAAAG,WAAAG,OAFJ,CAGNQ,aAAc,EAHR,CA1CG,CA+Cb,MAAS,CACLF,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAG,OAFL,CAGLQ,aAAc,IAHT,CA/CI,CAoDb,QAAW,CACPF,KAAM,SADC,CAEPC,SAAUb,CAAAG,WAAAM,OAFH,CAGPK,aAAc,CAHP,CApDE,CAyDb,SAAY,CACRF,KAAM,UADE,CAERC,SAAUb,CAAAG,WAAAM,OAFF,CAGRK,aAAc,CAHN,CAzDC,CA8Db,QAAW,CACPF,KAAM,SADC,CAEPC,SAAUb,CAAAG,WAAAE,OAFH;AAGPS,aAAed,CAAAC,KAAA,CAAgBD,CAAAC,KAAAgB,MAAhB,CAAsCD,IAAAA,EAH9C,CA9DE,CAmEb,SAAY,CACRJ,KAAM,UADE,CAERC,SAAUb,CAAAG,WAAAE,OAFF,CAGRS,aAAcd,CAAAC,KAAA,CAAgBD,CAAAC,KAAAc,KAAhB,CAAqCC,IAAAA,EAH3C,CAnEC,CAwEb,QAAS,CACLJ,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAM,OAFL,CAGLK,aAAc,CAHT,CAxEI,CA6Eb,OAAQ,CACJF,KAAM,MADF,CAEJC,SAAUb,CAAAG,WAAAC,OAFN,CAGJU,aAAc,CAHV,CA7EK,CAkFb,QAAW,CACPF,KAAM,SADC,CAEPC,SAAUb,CAAAG,WAAAG,OAFH,CAGPQ,aAAc,IAHP,CAlFE,CAuFb,MAAS,CACLF,KAAM,OADD,CAELC,SAAUb,CAAAG,WAAAI,WAFL,CAGLO,aAAc,IAHT,CAvFI,CAoGjBd,EAAAkB,cAAA,CAAyB,CACrBlB,CAAAW,MAAA,MADqB,CAErBX,CAAAW,MAAA,OAFqB,CAGrBX,CAAAW,MAAA,SAHqB,CAIrBX,CAAAW,MAAA,OAJqB,CAKrBX,CAAAW,MAAA,QALqB;AAMrBX,CAAAW,MAAA,MANqB,CAOrBX,CAAAW,MAAA,OAPqB,CAQrBX,CAAAW,MAAA,SARqB,CASrBX,CAAAW,MAAA,OATqB,CAUrBX,CAAAW,MAAA,QAVqB,CAWrBX,CAAAW,MAAA,KAXqB,CAYrBX,CAAAW,MAAA,OAZqB,CAarBX,CAAAW,MAAA,MAbqB,CAsBzBX,EAAAmB,OAAA,CAAkB,CAQlBnB,EAAAoB,OAAA,CAAkB,SAQlBpB,EAAAqB,yBAAA,CAAoC,CAAA,CAQpCrB,EAAAsB,kBAAA,CAA6B,CAAA,CAQ7BtB,EAAAuB,iBAAA,CAA4B,CAAA,CAM5BvB,EAAAwB,KAAA,CAAiB,QAAQ,EAAG,CAQxB,IAAIA,EAAO,EAQXA,EAAAC,QAAA,CAAe,EACQ,QADR,GACX,MAAOC,QADI,EACmC,kBADnC,GACoBA,OADpB,CAC4B,EAD5B,EAC0DA,OAAA,QAD1D,CAUfF,EAAAG,IAAA,CAAWC,QAAQ,EAAG,CAUlB,IARA,IAAIC,EAAmB,CACnB,QAAS,EAAG,CAAC,MAAO,KAAIC,cAAZ,CADO,CAEnB,QAAS,EAAG,CAAC,MAAO,KAAIC,aAAJ,CAAkB,gBAAlB,CAAR,CAFO,CAGnB,QAAS,EAAG,CAAC,MAAO,KAAIA,aAAJ,CAAkB,gBAAlB,CAAR,CAHO;AAInB,QAAS,EAAG,CAAC,MAAO,KAAIA,aAAJ,CAAkB,mBAAlB,CAAR,CAJO,CAAvB,CAOIC,EAAM,IAPV,CAQSC,EAAE,CAAX,CAAaA,CAAb,CAAeJ,CAAAK,OAAf,CAAuCD,CAAA,EAAvC,CAA4C,CACxC,GAAI,CAAED,CAAA,CAAMH,CAAA,CAAiBI,CAAjB,CAAA,EAAR,CACJ,MAAOE,CAAP,CAAU,CAAE,QAAF,CACV,KAHwC,CAK5C,GAAKH,CAAAA,CAAL,CACI,KAAMI,MAAA,CAAM,iCAAN,CAAN,CACJ,MAAOJ,EAjBW,CA4BtBR,EAAAa,MAAA,CAAaC,QAAQ,CAACC,CAAD,CAAOC,CAAP,CAAiB,CAC9BA,CAAJ,EAAmC,UAAnC,EAAgB,MAAOA,EAAvB,GACIA,CADJ,CACe,IADf,CAEA,IAAIhB,CAAAC,QAAJ,CAAkB,CACd,IAAIgB,EAAK7C,OAAA,CAAQ,IAAR,CACT,IAAI4C,CAAJ,CACIC,CAAAC,SAAA,CAAYH,CAAZ,CAAkB,QAAQ,CAACI,CAAD,CAAMC,CAAN,CAAY,CAC9BD,CAAJ,CACIH,CAAA,CAAS,IAAT,CADJ,CAGIA,CAAA,CAAS,EAAT,CAAYI,CAAZ,CAJ8B,CAAtC,CADJ,KAQI,IAAI,CACA,MAAOH,EAAAI,aAAA,CAAgBN,CAAhB,CADP,CAEF,MAAOJ,CAAP,CAAU,CACR,MAAO,KADC,CAZF,CAAlB,IAeO,CACH,IAAIH,EAAMR,CAAAG,IAAA,EACVK,EAAAc,KAAA,CAAS,KAAT,CAAgBP,CAAhB,CAAsBC,CAAA,CAAW,CAAA,CAAX,CAAkB,CAAA,CAAxC,CAEAR,EAAAe,iBAAA,CAAqB,QAArB,CAA+B,YAA/B,CACoC,WAApC,GAAI,MAAOf,EAAAgB,iBAAX;AAAgDhB,CAAAgB,iBAAA,CAAqB,YAArB,CAChD,IAAIR,CAAJ,CACIR,CAAAiB,mBAOA,CAPyBC,QAAQ,EAAG,CACV,CAAtB,EAAIlB,CAAAmB,WAAJ,GAC+B,GAA/B,EAAiBnB,CAAAoB,OAAjB,EAAiE,CAAjE,EAAmDpB,CAAAoB,OAAnD,EAAkG,QAAlG,GAAsE,MAAOpB,EAAAqB,aAA7E,CACIb,CAAA,CAASR,CAAAqB,aAAT,CADJ,CAGIb,CAAA,CAAS,IAAT,CAJJ,CADgC,CAOpC,CAAsB,CAAtB,EAAIR,CAAAmB,WAAJ,EAEAnB,CAAAsB,KAAA,CAAS,IAAT,CAVJ,KAaI,OADAtB,EAAAsB,KAAA,CAAS,IAAT,CACA,CAA+B,GAA/B,EAAiBtB,CAAAoB,OAAjB,EAAiE,CAAjE,EAAmDpB,CAAAoB,OAAnD,EAAkG,QAAlG,GAAsE,MAAOpB,EAAAqB,aAA7E,CACWrB,CAAAqB,aADX,CAEO,IArBR,CAlB2B,CAkDtC7B,EAAA+B,YAAA,CAAmBC,QAAQ,CAACC,CAAD,CAAM,CAC7B,MAAOA,EAAAC,QAAA,CAAY,cAAZ,CAA4B,QAAS,CAACC,CAAD,CAAKC,CAAL,CAAS,CACjD,MAAOA,EAAAC,YAAA,EAD0C,CAA9C,CADsB,CAMjC,OAAOrC,EA9GiB,CAAZ,EAsHhBxB,EAAA8D,KAAA,CAAgB,CAGZC,MAAO,2BAHK,CAMZC,KAAM,sCANM;AASZC,KAAM,gHATM,CAYZC,KAAM,0BAZM,CAeZC,QAAS,yBAfG,CAkBZC,QAAS,8DAlBG,CAqBZC,UAAW,iCArBC,CAwBZC,OAAQ,+FAxBI,CA2BZC,WAAY,qBA3BA,CA8BZC,WAAY,qBA9BA,CAiCZC,WAAY,WAjCA,CAoCZC,WAAY,iDApCA;AAuCZC,KAAM,mBAvCM,CA0CZC,GAAI,+CA1CQ,CA6CZC,MAAO,kDA7CK,CAgDZC,WAAY,IAhDA,CAmDZC,OAAQ,gEAnDI,CAsDZC,UAAW,iCAtDC,CAyDZC,UAAW,iCAzDC,CAgEhBjF,EAAAkF,SAAA,CAAqB,QAAQ,CAAClF,CAAD,CAAW8D,CAAX,CAAiB,CA2U1CqB,QAASA,EAAI,CAACC,CAAD,CAAQC,CAAR,CAAuB,CAAA,IAC5BC,CAD4B,CAE5BC,EAAO,CACY,IAAvB,EAAIH,CAAAI,OAAA,CAAa,CAAb,CAAJ,GACID,CACA,CADQ,EACR,CAAAH,CAAA,CAAQA,CAAAK,UAAA,CAAgB,CAAhB,CAFZ,CAIA,IAAI3B,CAAAS,WAAAmB,KAAA,CAAqBN,CAArB,CAAJ,CACIE,CAAA,CAAKK,QAAA,CAASP,CAAT,CADT,KAEK,IAAItB,CAAAU,WAAAkB,KAAA,CAAqBN,CAArB,CAAJ,CACDE,CAAA,CAAKK,QAAA,CAASP,CAAAK,UAAA,CAAgB,CAAhB,CAAT,CAA6B,EAA7B,CADJ,KAEA,IAAI3B,CAAAW,WAAAiB,KAAA,CAAqBN,CAArB,CAAJ,CACDE,CAAA;AAAKK,QAAA,CAASP,CAAAK,UAAA,CAAgB,CAAhB,CAAT,CAA6B,CAA7B,CADJ,KAGD,MAAMrD,MAAA,CAAM,oBAAN,EAAqC,CAAP,CAAAmD,CAAA,CAAW,GAAX,CAAiB,EAA/C,EAAqDH,CAArD,CAAN,CACJE,CAAA,CAAMC,CAAN,CAAWD,CAAX,CAAe,CACf,IAAKD,CAAAA,CAAL,EAA2B,CAA3B,CAAsBC,CAAtB,CACI,KAAMlD,MAAA,CAAM,oBAAN,EAAqC,CAAP,CAAAmD,CAAA,CAAW,GAAX,CAAiB,EAA/C,EAAqDH,CAArD,CAAN,CACJ,MAAOE,EAlByB,CA2BpCM,QAASA,EAAQ,CAACC,CAAD,CAAM,CACnB,IAAIN,EAAO,CACU,IAArB,EAAIM,CAAAL,OAAA,CAAW,CAAX,CAAJ,GACID,CACA,CADQ,EACR,CAAAM,CAAA,CAAMA,CAAAJ,UAAA,CAAc,CAAd,CAFV,CAIA,IAAI3B,CAAAS,WAAAmB,KAAA,CAAqBG,CAArB,CAAJ,CACI,MAAON,EAAP,CAAcI,QAAA,CAASE,CAAT,CAAc,EAAd,CACb,IAAI/B,CAAAU,WAAAkB,KAAA,CAAqBG,CAArB,CAAJ,CACD,MAAON,EAAP,CAAcI,QAAA,CAASE,CAAAJ,UAAA,CAAc,CAAd,CAAT,CAA2B,EAA3B,CACb,IAAI3B,CAAAW,WAAAiB,KAAA,CAAqBG,CAArB,CAAJ,CACD,MAAON,EAAP,CAAcI,QAAA,CAASE,CAAAJ,UAAA,CAAc,CAAd,CAAT,CAA2B,CAA3B,CACb,IAAY,KAAZ,GAAII,CAAJ,CACD,MAAcC,SAAd,CAAOP,CACN,IAAY,KAAZ,GAAIM,CAAJ,CACD,MAAOE,IACN,IAAIjC,CAAAY,WAAAgB,KAAA,CAAqBG,CAArB,CAAJ,CACD,MAAON,EAAP,CAAcS,UAAA,CAAWH,CAAX,CAClB,MAAMzD,MAAA,CAAM,wBAAN;CAAyC,CAAP,CAAAmD,CAAA,CAAW,GAAX,CAAiB,EAAnD,EAAyDM,CAAzD,CAAN,CAlBmB,CA2GvBI,QAASA,EAAS,CAACC,CAAD,CAAUtF,CAAV,CAAgBwE,CAAhB,CAAuB,CACR,WAA7B,GAAI,MAAOc,EAAA,CAAQtF,CAAR,CAAX,CACIsF,CAAA,CAAQtF,CAAR,CADJ,CACoBwE,CADpB,EAGSe,KAAAC,QAAA,CAAcF,CAAA,CAAQtF,CAAR,CAAd,CAEL,GADIsF,CAAA,CAAQtF,CAAR,CACJ,CADoB,CAAEsF,CAAA,CAAQtF,CAAR,CAAF,CACpB,EAAAsF,CAAA,CAAQtF,CAAR,CAAAyF,KAAA,CAAmBjB,CAAnB,CALJ,CADqC,CAzczC,IAAIF,EAAW,EAAf,CASIoB,EAAYA,QAAQ,CAACC,CAAD,CAAQ,CAO5B,IAAAC,OAAA,CAAcD,CAAd,CAAoB,EAOpB,KAAAE,MAAA,CAAa,CAOb,KAAAC,KAAA,CAAY,CAOZ,KAAAC,MAAA,CAAa,EAOb,KAAAC,YAAA,CAAmB,IAnCS,CAThC,CAmDIC,EAAqBP,CAAAQ,UAOzBD,EAAAE,YAAA,CAAiCC,QAAQ,EAAG,CACxC,IAAIC,EAA0B,GAArB,GAAA,IAAAL,YAAA,CACH9C,CAAAkB,UADG,CAEHlB,CAAAmB,UACNgC,EAAAC,UAAA,CAAe,IAAAT,MAAf,CAA4B,CAC5B,KAAIU,EAAQF,CAAAG,KAAA,CAAQ,IAAAZ,OAAR,CACZ,IAAKW,CAAAA,CAAL,CACI,KAAM/E,MAAA,CAAM,qBAAN,CAAN,CACJ,IAAAqE,MAAA,CAAaQ,CAAAC,UACb,KAAAP,MAAAN,KAAA,CAAgB,IAAAO,YAAhB,CACA,KAAAA,YAAA,CAAmB,IACnB,OAAOO,EAAA,CAAM,CAAN,CAXiC,CAmB5CN,EAAAQ,KAAA;AAA0BC,QAAQ,EAAG,CACjC,GAAwB,CAAxB,CAAI,IAAAX,MAAAzE,OAAJ,CACI,MAAO,KAAAyE,MAAAY,MAAA,EACX,IAAI,IAAAd,MAAJ,EAAkB,IAAAD,OAAAtE,OAAlB,CACI,MAAO,KACX,IAAyB,IAAzB,GAAI,IAAA0E,YAAJ,CACI,MAAO,KAAAG,YAAA,EANsB,KAQ7BS,CAR6B,CAU7BH,CACJ,GAAG,CAIC,IAHAG,CAGA,CAHS,CAAA,CAGT,CAAO1D,CAAAgB,WAAAY,KAAA,CAAqB2B,CAArB,CAA4B,IAAAb,OAAAhB,OAAA,CAAmB,IAAAiB,MAAnB,CAA5B,CAAP,CAAA,CAGI,GAFa,IAET,GAFAY,CAEA,EADA,EAAE,IAAAX,KACF,CAAA,EAAE,IAAAD,MAAF,GAAiB,IAAAD,OAAAtE,OAArB,CACI,MAAO,KAIf,IAAuC,GAAvC,GAAI,IAAAsE,OAAAhB,OAAA,CAAmB,IAAAiB,MAAnB,CAAJ,CAEI,GADA,EAAE,IAAAA,MACE,CAAmC,GAAnC,GAAA,IAAAD,OAAAhB,OAAA,CAAmB,IAAAiB,MAAnB,CAAJ,CAA4C,CACxC,IAAA,CAA4C,IAA5C,GAAO,IAAAD,OAAAhB,OAAA,CAAmB,EAAE,IAAAiB,MAArB,CAAP,CAAA,CACI,GAAI,IAAAA,MAAJ,EAAkB,IAAAD,OAAAtE,OAAlB,CACI,MAAO,KACf,GAAE,IAAAuE,MACF;EAAE,IAAAC,KACFc,EAAA,CAAS,CAAA,CAN+B,CAA5C,IAOO,IAAgD,GAAhD,IAAKH,CAAL,CAAY,IAAAb,OAAAhB,OAAA,CAAmB,IAAAiB,MAAnB,CAAZ,EAAqD,CACxD,EAAG,CACc,IAAb,GAAIY,CAAJ,EACI,EAAE,IAAAX,KACN,IAAI,EAAE,IAAAD,MAAN,GAAqB,IAAAD,OAAAtE,OAArB,CACI,MAAO,KACXuF,EAAA,CAAOJ,CACPA,EAAA,CAAO,IAAAb,OAAAhB,OAAA,CAAmB,IAAAiB,MAAnB,CANR,CAAH,MAOkB,GAPlB,GAOSgB,CAPT,EAOkC,GAPlC,GAOyBJ,CAPzB,CAQA,GAAE,IAAAZ,MACFe,EAAA,CAAS,CAAA,CAV+C,CAArD,IAYH,OAAO,GAjChB,CAAH,MAmCSA,CAnCT,CAqCA,IAAI,IAAAf,MAAJ,GAAmB,IAAAD,OAAAtE,OAAnB,CACI,MAAO,KAGPwF,EAAAA,CAAM,IAAAjB,MACV3C,EAAAC,MAAAmD,UAAA,CAAuB,CAEvB,IADYS,CAAA7D,CAAAC,MAAA2B,KAAAiC,CAAgB,IAAAnB,OAAAhB,OAAA,CAAmBkC,CAAA,EAAnB,CAAhBC,CACZ,CACI,IAAA,CAAMD,CAAN,CAAY,IAAAlB,OAAAtE,OAAZ,EAAmC,CAAA4B,CAAAC,MAAA2B,KAAA,CAAgB,IAAAc,OAAAhB,OAAA,CAAmBkC,CAAnB,CAAhB,CAAnC,CAAA,CACI,EAAEA,CACNE,EAAAA,CAAQ,IAAApB,OAAAf,UAAA,CAAsB,IAAAgB,MAAtB,CAAkC,IAAAA,MAAlC,CAA+CiB,CAA/C,CACZ,IAAc,GAAd,GAAIE,CAAJ,EAA+B,GAA/B;AAAqBA,CAArB,CACI,IAAAhB,YAAA,CAAmBgB,CACvB,OAAOA,EA7D0B,CAqErCf,EAAAgB,KAAA,CAA0BC,QAAQ,EAAG,CACjC,GAA0B,CAA1B,GAAI,IAAAnB,MAAAzE,OAAJ,CAA6B,CACzB,IAAI0F,EAAQ,IAAAP,KAAA,EACZ,IAAc,IAAd,GAAIO,CAAJ,CACI,MAAO,KACX,KAAAjB,MAAAN,KAAA,CAAgBuB,CAAhB,CAJyB,CAM7B,MAAO,KAAAjB,MAAA,CAAW,CAAX,CAP0B,CAerCE,EAAAkB,KAAA,CAA0BC,QAAQ,CAACC,CAAD,CAAW,CACzC,IAAIC,EAAS,IAAAb,KAAA,EACb,IAAIa,CAAJ,GAAeD,CAAf,CACI,KAAM7F,MAAA,CAAM,WAAN,CAAkB8F,CAAlB,CAAyB,MAAzB,CAAgCD,CAAhC,CAAyC,YAAzC,CAAN,CAHqC,CAW7CpB,EAAAsB,KAAA,CAA0BC,QAAQ,CAACH,CAAD,CAAW,CACzC,MAAI,KAAAJ,KAAA,EAAJ,GAAoBI,CAApB,EACI,IAAAZ,KAAA,EACO,CAAA,CAAA,CAFX,EAIO,CAAA,CALkC,CAa7CR,EAAAwB,SAAA,CAA8BC,QAAQ,EAAG,CACrC,MAAO,aAAP,CAAqB,IAAA7B,MAArB,CAAgC,GAAhC,CAAoC,IAAAD,OAAAtE,OAApC,CAAuD,WAAvD,CAAmE,IAAAwE,KAAnE,CAA6E,GADxC,CAQzCxB,EAAAoB,UAAA,CAAqBA,CASrB,KAAIiC,EAASA,QAAQ,CAAC/B,CAAD,CAAS,CAO1B,IAAAgC,GAAA,CAAU,IAAIlC,CAAJ,CAAcE,CAAd,CAMV,KAAAiC,OAAA,CAAc,CAAA,CAbY,CAA9B,CAoBIC,EAAkBH,CAAAzB,UAQtB4B,EAAAC,MAAA;AAAwBC,QAAQ,EAAG,CAC/B,IAAIC,EAAW,CACX,KAAQ,QADG,CAEX,UAAW,IAFA,CAGX,SAAY,EAHD,CAIX,MAAS,EAJE,CAKX,QAAW,EALA,CAMX,QAAW,EANA,CAOX,SAAY,EAPD,CAAf,CAUIjB,CAVJ,CAWIkB,EAAO,CAAA,CAXX,CAYIC,CACJ,IAAI,CACA,IAAA,CAAOnB,CAAP,CAAe,IAAAY,GAAAnB,KAAA,EAAf,CAAA,CACI,OAAQO,CAAR,EACI,KAAK,SAAL,CACI,GAAKkB,CAAAA,CAAL,EAAqC,IAArC,GAAaD,CAAA,CAAS,SAAT,CAAb,CACI,KAAMzG,MAAA,CAAM,sBAAN,CAAN,CACJwF,CAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR,IAAK,CAAAvD,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAAL,CACI,KAAMxF,MAAA,CAAM,wBAAN,CAAiCwF,CAAjC,CAAN,CACJ,IAAAY,GAAAT,KAAA,CAAa,GAAb,CACAc,EAAA,CAAS,SAAT,CAAA,CAAsBjB,CACtB,MACJ,MAAK,QAAL,CACI,GAAKkB,CAAAA,CAAL,CACI,KAAM1G,MAAA,CAAM,qBAAN,CAAN,CACJwF,CAAA,CAAQ,IAAAY,GAAAX,KAAA,EACR,EAAc,QAAd,GAAID,CAAJ,GAA2BmB,CAA3B,CAA4C,MAA5C,GAAkCnB,CAAlC,IACI,IAAAY,GAAAnB,KAAA,EACJO,EAAA,CAAQ,IAAAb,YAAA,EACR,KAAAyB,GAAAT,KAAA,CAAa,GAAb,CACKgB;CAAL,EACIF,CAAA,QAAAxC,KAAA,CAAyBuB,CAAzB,CACJ,MACJ,MAAK,QAAL,CACI,GAAKkB,CAAAA,CAAL,CACI,KAAM1G,MAAA,CAAM,qBAAN,CAAN,CACJ,IAAAoG,GAAAT,KAAA,CAAa,GAAb,CACkD,SAAlD,IAAKc,CAAA,OAAL,CAA0B,IAAA9B,YAAA,EAA1B,IACI,IAAA0B,OADJ,CACkB,CAAA,CADlB,CAEA,KAAAD,GAAAT,KAAA,CAAa,GAAb,CACA,MACJ,MAAK,SAAL,CACI,IAAAiB,cAAA,CAAmBH,CAAnB,CAA6B,IAA7B,CACAC,EAAA,CAAO,CAAA,CACP,MACJ,MAAK,MAAL,CACI,IAAAG,WAAA,CAAgBJ,CAAhB,CACAC,EAAA,CAAO,CAAA,CACP,MACJ,MAAK,QAAL,CACI,IAAAI,aAAA,CAAkBL,CAAlB,CACA,MACJ,MAAK,SAAL,CACI,IAAAM,cAAA,CAAmBN,CAAnB,CACA,MACJ,MAAK,QAAL,CACI,IAAAO,aAAA,CAAkBP,CAAlB,CACA,MACJ,SACI,KAAMzG,MAAA,CAAM,cAAN,CAAuBwF,CAAvB,CAA+B,GAA/B,CAAN,CA/CR,CAFJ,CAoDF,MAAOzF,CAAP,CAAU,CAER,KADAA,EAAAkH,QACMlH,CADM,sBACNA,CAD6B,IAAAqG,GAAA9B,KAC7BvE;AAD0C,IAC1CA,CADiDA,CAAAkH,QACjDlH,CAAAA,CAAN,CAFQ,CAIZ,OAAO0G,CAAA,KACP,OAAOA,EAvEwB,CAgFnCN,EAAAI,MAAA,CAAeW,QAAQ,CAAC9C,CAAD,CAAS,CAC5B,MAAOmC,CAAA,IAAIJ,CAAJ,CAAW/B,CAAX,CAAAmC,OAAA,EADqB,CAoEhCD,EAAA3B,YAAA,CAA8BwC,QAAQ,EAAG,CAAA,IACjCnE,EAAQ,EADyB,CAEjCwC,CAEJ,GAAG,CACCD,CAAA,CAAQ,IAAAa,GAAAnB,KAAA,EACR,IAAc,GAAd,GAAIM,CAAJ,EAA+B,GAA/B,GAAqBA,CAArB,CACI,KAAMvF,MAAA,CAAM,4BAAN,CAAmCuF,CAAnC,CAAN,CACJvC,CAAA,EAAS,IAAAoD,GAAAnB,KAAA,EACT,KAAAmB,GAAAT,KAAA,CAAaJ,CAAb,CACAC,EAAA,CAAQ,IAAAY,GAAAX,KAAA,EANT,CAAH,MAOmB,GAPnB,GAOSD,CAPT,EAOoC,GAPpC,GAO0BA,CAP1B,CAQA,OAAOxC,EAZ8B,CAqBzCsD,EAAAc,WAAA,CAA6BC,QAAQ,CAACC,CAAD,CAAe,CAAA,IAC5C9B,EAAQ,IAAAY,GAAAX,KAAA,EAEZ,IAAc,GAAd,GAAID,CAAJ,EAA+B,GAA/B,GAAqBA,CAArB,CACI,MAAO,KAAAb,YAAA,EACX,KAAAyB,GAAAnB,KAAA,EACA,IAAIvD,CAAAQ,OAAAoB,KAAA,CAAiBkC,CAAjB,CAAJ,CACI,MAAOhC,EAAA,CAASgC,CAAT,CACX,IAAI9D,CAAAa,KAAAe,KAAA,CAAekC,CAAf,CAAJ,CACI,MAAgC,MAAhC,GAAQA,CAAA+B,YAAA,EACZ,IAAID,CAAJ,EAAoB5F,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAApB,CACI,MAAOA,EACX;KAAMxF,MAAA,CAAM,iBAAN,CAAwBwF,CAAxB,CAAN,CAZgD,CAwBpDc,EAAAQ,aAAA,CAA+BU,QAAQ,CAACC,CAAD,CAASC,CAAT,CAAiB,CAAA,IAChDlC,EAAQ,IAAAY,GAAAnB,KAAA,EADwC,CAEhD0C,EAAS,CAAA,CACC,IAAd,GAAInC,CAAJ,GACImC,CACA,CADS,CAAA,CACT,CAAAnC,CAAA,CAAQ,IAAAY,GAAAnB,KAAA,EAFZ,CAIA,IAAK,CAAAvD,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAAL,CAGQ,KAAMxF,MAAA,CAAM,uBAAN,CAA8BwF,CAA9B,CAAN,CACR,IAAIhH,EAAOgH,CACPmC,EAAJ,GACI,IAAAvB,GAAAT,KAAA,CAAa,GAAb,CAGA,CAFAnH,CAEA,CAFO,GAEP,CAFWA,CAEX,CAFgB,GAEhB,CADAgH,CACA,CADQ,IAAAY,GAAAX,KAAA,EACR,CAAI/D,CAAAO,UAAAqB,KAAA,CAAoBkC,CAApB,CAAJ,GACIhH,CACA,EADQgH,CACR,CAAA,IAAAY,GAAAnB,KAAA,EAFJ,CAJJ,CASA,KAAAmB,GAAAT,KAAA,CAAa,GAAb,CACA,KAAAiC,kBAAA,CAAuBH,CAAvB,CAA+BjJ,CAA/B,CACKkJ,EAAL,EACI,IAAAtB,GAAAT,KAAA,CAAa,GAAb,CAxBgD,CAkDxDW,EAAAsB,kBAAA,CAAoCC,QAAQ,CAACJ,CAAD,CAASjJ,CAAT,CAAe,CACvD,IAAIgH,EAAQ,IAAAY,GAAAX,KAAA,EACZ,IAAc,GAAd,GAAID,CAAJ,CACI3B,CAAA,CAAU4D,CAAA,QAAV,CAA6BjJ,CAA7B,CAAmC,IAAA4I,WAAA,CAAgB,CAAA,CAAhB,CAAnC,CADJ,KAII,KADA,IAAAhB,GAAAT,KAAA,CAAa,GAAb,CACA,CAAoC,GAApC,IAAQH,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CAAyC,CACrC,GAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,uBAAN;AAAgCxB,CAAhC,CAAuC,GAAvC,CAA6CgH,CAA7C,CAAN,CACA,IAAAY,GAAAL,KAAA,CAAa,GAAb,CAAJ,CACIlC,CAAA,CAAU4D,CAAA,QAAV,CAA6BjJ,CAA7B,CAAoC,GAApC,CAA0CgH,CAA1C,CAAiD,IAAA4B,WAAA,CAAgB,CAAA,CAAhB,CAAjD,CADJ,CAGI,IAAAQ,kBAAA,CAAuBH,CAAvB,CAA+BjJ,CAA/B,CAAsC,GAAtC,CAA4CgH,CAA5C,CANiC,CANU,CAsB3Dc,EAAAS,cAAA,CAAgCe,QAAQ,CAACL,CAAD,CAAS,CAC7C,IAAIjC,EAAQ,IAAAY,GAAAnB,KAAA,EACZ,IAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,+BAAN,CAAsC,IAAAoG,GAAA9B,KAAtC,CAAmD,IAAnD,CAAwDkB,CAAxD,CAAN,CAEJ,IAAIuC,EAAM,CACN,KAFOvC,CACD,CAEN,IAAO,EAFD,CAGN,QAAW,EAHL,CAMV,KADA,IAAAY,GAAAT,KAAA,CAAa,GAAb,CACA,CAAoC,GAApC,IAAQH,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CACI,GAAc,QAAd,GAAIO,CAAJ,CACI,IAAAsB,aAAA,CAAkBiB,CAAlB,CADJ,KAEK,IAAc,KAAd,GAAIvC,CAAJ,CACD,IAAAwC,iBAAA,CAAsBD,CAAtB,CADC,KAGD,MAAM/H,MAAA,CAAM,yBAAN,CAAgCwF,CAAhC,CAAN,CAER,IAAAY,GAAAL,KAAA,CAAa,GAAb,CACA0B,EAAA,SAAAxD,KAAA,CAAwB8D,CAAxB,CApB6C,CA4BjDzB,EAAA0B,iBAAA;AAAmCC,QAAQ,CAACF,CAAD,CAAM,CAC7C,IACIvC,EAAQ,IAAAY,GAAAnB,KAAA,EACZ,IAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,mCAAN,CAA0CwF,CAA1C,CAAN,CACJ,IAAIhH,EAAOgH,CAAX,CACI0C,EAAS,CACT,QAAW,IADF,CAET,SAAY,IAFH,CAGT,eAAkB,CAAA,CAHT,CAIT,gBAAmB,CAAA,CAJV,CAKT,QAAW,EALF,CAOb,KAAA9B,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACoB,SAA5B,GAAIO,CAAA+B,YAAA,EAAJ,GACEW,CAAA,eACA,CAD2B,CAAA,CAC3B,CAAA1C,CAAA,CAAQ,IAAAY,GAAAnB,KAAA,EAFV,CAIA,IAAK,CAAAvD,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAAL,CACI,KAAMxF,MAAA,CAAM,oCAAN,CAA2CwF,CAA3C,CAAN,CACJ0C,CAAA,QAAA,CAAoB1C,CACpB,KAAAY,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR,IAA4B,SAA5B,GAAIO,CAAA+B,YAAA,EAAJ,CACI,KAAMvH,MAAA,CAAM,8CAAN;AAAqDwF,CAArD,CAAN,CACJ,IAAAY,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACoB,SAA5B,GAAIO,CAAA+B,YAAA,EAAJ,GACEW,CAAA,gBACA,CAD4B,CAAA,CAC5B,CAAA1C,CAAA,CAAQ,IAAAY,GAAAnB,KAAA,EAFV,CAIAiD,EAAA,SAAA,CAAqB1C,CACrB,KAAAY,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAX,KAAA,EACR,IAAc,GAAd,GAAID,CAAJ,CAAmB,CAEf,IADA,IAAAY,GAAAnB,KAAA,EACA,CAAoC,GAApC,IAAQO,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CACI,GAAc,QAAd,GAAIO,CAAJ,CACI,IAAAsB,aAAA,CAAkBoB,CAAlB,CADJ,KAGI,MAAMlI,MAAA,CAAM,6BAAN,CAAsCwF,CAAtC,CAAN,CAER,IAAAY,GAAAL,KAAA,CAAa,GAAb,CARe,CAAnB,IAUI,KAAAK,GAAAT,KAAA,CAAa,GAAb,CACqB,YAAzB,GAAI,MAAOoC,EAAA,IAAX,GACIA,CAAA,IADJ,CACgB,EADhB,CAEAA,EAAA,IAAA,CAAUvJ,CAAV,CAAA,CAAkB0J,CAhD2B,CA0DjD5B,EAAAM,cAAA,CAAgCuB,QAAQ,CAACV,CAAD,CAASW,CAAT,CAAc,CAAA,IAC9CC,EAAU,CAAED,CAAAA,CADkC,CAE9C5C,EAAQ,IAAAY,GAAAnB,KAAA,EAFsC,CAG9CqD,EAAM,CACN,KAAQ,EADF,CAEN,OAAU,EAFJ,CAGN,MAAS,EAHH,CAIN,SAAY,EAJN,CAKN,QAAW,EALL,CAMN,SAAY,EANN;AAON,OAAU,EAPJ,CAUV,IAAK,CAAA5G,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,UAAN,EAAkBqI,CAAA,CAAU,OAAV,CAAoB,SAAtC,EAAiD,SAAjD,CAA2D7C,CAA3D,CAAN,CACJ8C,CAAA,KAAA,CAAc9C,CACV6C,EAAJ,GACI,IAAAjC,GAAAT,KAAA,CAAa,GAAb,CAEA,CADAyC,CAAA,GACA,CADYrF,CAAA,CAAK,IAAAqD,GAAAnB,KAAA,EAAL,CACZ,CAAAqD,CAAA,QAAA,CAAiB,CAAA,CAHrB,CAKA9C,EAAA,CAAQ,IAAAY,GAAAX,KAAA,EACM,IAAd,GAAID,CAAJ,EAAqB4C,CAArB,EACI,IAAAG,mBAAA,CAAwBH,CAAxB,CAEJ,KADA,IAAAhC,GAAAT,KAAA,CAAa,GAAb,CACA,CAAoC,GAApC,IAAQH,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CACI,GAAIvD,CAAAE,KAAA0B,KAAA,CAAekC,CAAf,CAAJ,CACI,IAAAgD,mBAAA,CAAwBF,CAAxB,CAA6B9C,CAA7B,CADJ,KAEK,IAAc,OAAd,GAAIA,CAAJ,CACD,IAAAiD,mBAAA,CAAwBH,CAAxB,CADC,KAEA,IAAc,MAAd,GAAI9C,CAAJ,CACD,IAAAqB,WAAA,CAAgByB,CAAhB,CADC,KAEA,IAAc,SAAd,GAAI9C,CAAJ,CACD,IAAAoB,cAAA,CAAmB0B,CAAnB,CADC,KAEA,IAAc,QAAd,GAAI9C,CAAJ,CACD,IAAAsB,aAAA,CAAkBwB,CAAlB,CADC,KAEA,IAAc,SAAd,GAAI9C,CAAJ,CACD,IAAAuB,cAAA,CAAmBuB,CAAnB,CADC;IAEA,IAAc,YAAd,GAAI9C,CAAJ,CACG8C,CAAAI,eAAA,CAAmB,YAAnB,CAAJ,CACIJ,CAAA,WADJ,CACwBA,CAAA,WAAAK,OAAA,CAAyB,IAAAC,sBAAA,EAAzB,CADxB,CAGIN,CAAA,WAHJ,CAGwB,IAAAM,sBAAA,EAJvB,KAMA,IAAc,UAAd,GAAIpD,CAAJ,CACD,IAAAqD,cAAA,EADC,KAEA,IAAc,QAAd,GAAIrD,CAAJ,CACD,IAAAwB,aAAA,CAAkBsB,CAAlB,CADC,KAEA,IAAI5G,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAAJ,CAA8B,CAC/B,GAAKa,CAAA,IAAAA,OAAL,CACI,KAAMrG,MAAA,CAAM,sBAAN,CAA6BwF,CAA7B,CAAN,CACJ,IAAAgD,mBAAA,CAAwBF,CAAxB,CAA6B,UAA7B,CAAyC9C,CAAzC,CAH+B,CAA9B,IAKD,MAAMxF,MAAA,CAAM,yBAAN,CAAgCwF,CAAhC,CAAN,CAER,IAAAY,GAAAL,KAAA,CAAa,GAAb,CACA0B,EAAA,SAAAxD,KAAA,CAAwBqE,CAAxB,CACA,OAAOA,EAzD2C,CAgEtDhC,EAAAuC,cAAA,CAAgCC,QAAQ,EAAG,CACvC,IAAA,CAA0B,GAA1B,GAAO,IAAA1C,GAAAX,KAAA,EAAP,CAAA,CACI,IAAAW,GAAAnB,KAAA,EACJ;IAAAmB,GAAAT,KAAA,CAAa,GAAb,CAHuC,CAc3CW,EAAAkC,mBAAA,CAAqCO,QAAQ,CAACT,CAAD,CAAMU,CAAN,CAAYC,CAAZ,CAAkB,CAC3D,GAAK,CAAAvH,CAAAE,KAAA0B,KAAA,CAAe0F,CAAf,CAAL,CACI,KAAMhJ,MAAA,CAAM,8BAAN,CAAqCgJ,CAArC,CAAN,CACJ,IAAIZ,EAAM,CACN,KAAQY,CADF,CAEN,KAAQ,EAFF,CAGN,KAAQ,EAHF,CAIN,QAAW,EAJL,CAKN,GAAM,CALA,CAQV,IAAa,KAAb,GAAIA,CAAJ,CAAoB,CAEhB,GAAIC,CAAJ,CACI,KAAMjJ,MAAA,CAAM,gBAAN,CAAyBiJ,CAAzB,CAAN,CACJ,IAAA7C,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR,IAAK,CAAAvD,CAAAG,KAAAyB,KAAA,CAAekC,CAAf,CAAL,EAA+B,CAAA9D,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAA/B,CACI,KAAMxF,MAAA,CAAM,8BAAN,CAAuCwF,CAAvC,CAAN,CACJ4C,CAAA,QAAA,CAAiB5C,CACjB,KAAAY,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR,IAAK,CAAAvD,CAAAG,KAAAyB,KAAA,CAAekC,CAAf,CAAL,EAA+B,CAAA9D,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAA/B,CACI,KAAMxF,MAAA,CAAM,yBAAN,CAAkCwF,CAAlC,CAAN,CACJ4C,CAAA,KAAA,CAAc5C,CACd,KAAAY,GAAAT,KAAA,CAAa,GAAb,CACAH,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR;GAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,8BAAN,CAAuCwF,CAAvC,CAAN,CACJ4C,CAAA,KAAA,CAAc5C,CACd,KAAAY,GAAAT,KAAA,CAAa,GAAb,CACAyC,EAAA,GAAA,CAAYrF,CAAA,CAAK,IAAAqD,GAAAnB,KAAA,EAAL,CACZO,EAAA,CAAQ,IAAAY,GAAAX,KAAA,EACM,IAAd,GAAID,CAAJ,EACI,IAAA+C,mBAAA,CAAwBH,CAAxB,CACJ,KAAAhC,GAAAT,KAAA,CAAa,GAAb,CAxBgB,CAApB,IA8BI,IAFAsD,CAEI,CAFmB,WAAhB,GAAA,MAAOA,EAAP,CAA8BA,CAA9B,CAAqC,IAAA7C,GAAAnB,KAAA,EAExC,CAAS,OAAT,GAAAgE,CAAJ,CAAsB,CAKdC,CAAAA,CAAM,IAAAtC,cAAA,CAAmB0B,CAAnB,CAAwBF,CAAxB,CACV,IAAK,CAAA,QAAA9E,KAAA,CAAc4F,CAAA,KAAd,CAAL,CACI,KAAMlJ,MAAA,CAAM,sBAAN,CAA6BkJ,CAAA,KAA7B,CAAN,CACJd,CAAA,KAAA,CAAcc,CAAA,KACdd,EAAA,KAAA,CAAcc,CAAA,KAAA3B,YAAA,EACd,KAAAnB,GAAAL,KAAA,CAAa,GAAb,CAVkB,CAAtB,IAYO,CAEH,GAAK,CAAArE,CAAAG,KAAAyB,KAAA,CAAe2F,CAAf,CAAL,EAA8B,CAAAvH,CAAAM,QAAAsB,KAAA,CAAkB2F,CAAlB,CAA9B,CACI,KAAMjJ,MAAA,CAAM,8BAAN,CAAuCiJ,CAAvC,CAAN,CACJb,CAAA,KAAA;AAAca,CACdzD,EAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR,IAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,8BAAN,CAAuCwF,CAAvC,CAAN,CACJ4C,CAAA,KAAA,CAAc5C,CACd,KAAAY,GAAAT,KAAA,CAAa,GAAb,CACAyC,EAAA,GAAA,CAAYrF,CAAA,CAAK,IAAAqD,GAAAnB,KAAA,EAAL,CACZO,EAAA,CAAQ,IAAAY,GAAAX,KAAA,EACM,IAAd,GAAID,CAAJ,EACI,IAAA+C,mBAAA,CAAwBH,CAAxB,CACJ,KAAAhC,GAAAT,KAAA,CAAa,GAAb,CAdG,CAkBX2C,CAAA,OAAArE,KAAA,CAAmBmE,CAAnB,CACA,OAAOA,EAxEoD,CAgF/D9B,EAAAmC,mBAAA,CAAqCU,QAAQ,CAACb,CAAD,CAAM,CAC/C,IAAI9C,EAAQ,IAAAY,GAAAnB,KAAA,EACZ,IAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,sBAAN,CAA6BwF,CAA7B,CAAN,CAH2C,IAI3ChH,EAAOgH,CAJoC,CAM3C4D,EAAS,EAEb,KADA,IAAAhD,GAAAT,KAAA,CAAa,GAAb,CACA,CAAoC,GAApC,IAAQH,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CACImD,CAEA,CAFM,IAAAI,mBAAA,CAAwBF,CAAxB,CAA6B,UAA7B,CAAyC9C,CAAzC,CAEN,CADA4C,CAAA,MACA,CADe5J,CACf,CAAA4K,CAAAnF,KAAA,CAAYmE,CAAA,GAAZ,CAEJ,KAAAhC,GAAAL,KAAA,CAAa,GAAb,CACAuC,EAAA,OAAA,CAAc9J,CAAd,CAAA,CAAsB4K,CAdyB,CAsBnD9C;CAAAiC,mBAAA,CAAqCc,QAAQ,CAACjB,CAAD,CAAM,CAC/C,IAAAhC,GAAAT,KAAA,CAAa,GAAb,CAGA,KAFA,IACI2D,EAAQ,CAAA,CACZ,CAAoC,GAApC,GAAgB,IAAAlD,GAAAX,KAAA,EAAhB,CAAA,CACS6D,CAGL,EAFI,IAAAlD,GAAAT,KAAA,CAAa,GAAb,CAEJ,CADA,IAAAmB,aAAA,CAAkBsB,CAAlB,CAAuB,CAAA,CAAvB,CACA,CAAAkB,CAAA,CAAQ,CAAA,CAEZ,KAAAlD,GAAAnB,KAAA,EAV+C,CAkBnDqB,EAAAO,WAAA,CAA6B0C,QAAQ,CAACjB,CAAD,CAAM,CACvC,IAAIkB,EAAM,CACN,KAAQ,EADF,CAEN,OAAU,EAFJ,CAGN,QAAW,EAHL,CAAV,CAKIhE,EAAQ,IAAAY,GAAAnB,KAAA,EACZ,IAAK,CAAAvD,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,gBAAN,CAAuBwF,CAAvB,CAAN,CACJgE,CAAA,KAAA,CAAchE,CAEd,KADA,IAAAY,GAAAT,KAAA,CAAa,GAAb,CACA,CAAoC,GAApC,IAAQH,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CACI,GAAc,QAAd,GAAIO,CAAJ,CACI,IAAAsB,aAAA,CAAkB0C,CAAlB,CADJ,KAEK,CACD,GAAK,CAAA9H,CAAAI,KAAAwB,KAAA,CAAekC,CAAf,CAAL,CACI,KAAMxF,MAAA,CAAM,gBAAN,CAAuBwF,CAAvB,CAAN,CACJ,IAAAY,GAAAT,KAAA,CAAa,GAAb,CACA,KAAIlC,EAAM,CACN,KAAQ+B,CADF,CAEN,GAAMzC,CAAA,CAAK,IAAAqD,GAAAnB,KAAA,EAAL,CAAqB,CAAA,CAArB,CAFA,CAAV,CAIAO,EAAQ,IAAAY,GAAAX,KAAA,EACM;GAAd,GAAID,CAAJ,EACI,IAAA+C,mBAAA,CAAwB,CAAE,QAAW,EAAb,CAAxB,CACJ,KAAAnC,GAAAT,KAAA,CAAa,GAAb,CACA6D,EAAA,OAAAvF,KAAA,CAAmBR,CAAnB,CAZC,CAeT,IAAA2C,GAAAL,KAAA,CAAa,GAAb,CACAuC,EAAA,MAAArE,KAAA,CAAkBuF,CAAlB,CA9BuC,CAsC3ClD,EAAAsC,sBAAA,CAAwCa,QAAQ,EAAG,CAC/C,IAAIC,EAAS,EAAb,CACIlE,CADJ,CAEImE,CAEJ,GAAG,CAEC,IADAA,CACA,CADQ,EACR,CAAA,CAAA,CAAa,CACTnE,CAAA,CAAQ,IAAAY,GAAAnB,KAAA,EACR,QAAQO,CAAR,EACI,KAAK,KAAL,CACIxC,CAAA,CAAQpF,CAAAmB,OACR,MACJ,MAAK,KAAL,CACIiE,CAAA,CAAQpF,CAAAoB,OACR,MACJ,SACIgE,CAAA,CAAQQ,CAAA,CAASgC,CAAT,CARhB,CAWAmE,CAAA1F,KAAA,CAAWjB,CAAX,CACA,IAAqB,CAArB,GAAI2G,CAAA7J,OAAJ,CACI,KACJ,IAAuB,IAAvB,GAAI,IAAAsG,GAAAX,KAAA,EAAJ,CAA6B,CACzBkE,CAAA1F,KAAA,CAAWjB,CAAX,CACA,MAFyB,CAI7B,IAAAoD,GAAAnB,KAAA,EApBS,CAsBbyE,CAAAzF,KAAA,CAAY0F,CAAZ,CAxBD,CAAH,MAyBS,IAAAvD,GAAAL,KAAA,CAAa,GAAb,CAzBT,CA0BA,KAAAK,GAAAT,KAAA,CAAa,GAAb,CACA,OAAO+D,EAhCwC,CAwCnDpD,EAAAU,aAAA,CAA+B4C,QAAQ,CAACnC,CAAD,CAAS,CAC5C,IAAIjC,EAAQ,IAAAY,GAAAnB,KAAA,EACZ,IAAK,CAAAvD,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAAL,CACI,KAAMxF,MAAA,CAAM,4BAAN;AAAmCwF,CAAnC,CAAN,CACJ,IAAIqE,EAAM,CACN,IAAOrE,CADD,CAEN,OAAU,EAFJ,CAKV,KADA,IAAAY,GAAAT,KAAA,CAAa,GAAb,CACA,CAAoC,GAApC,IAAQH,CAAR,CAAgB,IAAAY,GAAAnB,KAAA,EAAhB,EAAA,CACI,GAAIvD,CAAAE,KAAA0B,KAAA,CAAekC,CAAf,CAAJ,CACI,IAAAgD,mBAAA,CAAwBqB,CAAxB,CAA6BrE,CAA7B,CADJ,KAEK,IAAI9D,CAAAM,QAAAsB,KAAA,CAAkBkC,CAAlB,CAAJ,CAA8B,CAC/B,GAAKa,CAAA,IAAAA,OAAL,CACI,KAAMrG,MAAA,CAAM,sBAAN,CAA6BwF,CAA7B,CAAN,CACJ,IAAAgD,mBAAA,CAAwBqB,CAAxB,CAA6B,UAA7B,CAAyCrE,CAAzC,CAH+B,CAA9B,IAKD,MAAMxF,MAAA,CAAM,wBAAN,CAA+BwF,CAA/B,CAAN,CAER,IAAAY,GAAAL,KAAA,CAAa,GAAb,CACA0B,EAAA,SAAAxD,KAAA,CAAwB4F,CAAxB,CACA,OAAOA,EArBqC,CA8BhDvD,EAAAL,SAAA,CAA2B6D,QAAQ,EAAG,CAClC,MAAO,iBAAP,CAAyB,IAAA1D,GAAA9B,KADS,CAQtCxB,EAAAqD,OAAA,CAAkBA,CAElB,OAAOrD,EAz4BmC,CAA1B,CA24BjBlF,CA34BiB,CA24BPA,CAAA8D,KA34BO,CAi5BpB9D,EAAAmM,QAAA,CAAoB,QAAQ,CAACnM,CAAD,CAAW,CAgZnCoM,QAASA,EAAM,CAAChH,CAAD,CAAQiH,CAAR,CAAkB,CAC7B,GAAIjH,CAAJ,EAAkC,QAAlC,GAAa,MAAOA,EAAAkH,IAApB,EAAoE,QAApE;AAA8C,MAAOlH,EAAAmH,KAArD,EAA0G,SAA1G,GAAgF,MAAOnH,EAAAiH,SAAvF,EACOjH,CAAAkH,IADP,GACqBlH,CAAAkH,IADrB,EACkClH,CAAAmH,KADlC,GACiDnH,CAAAmH,KADjD,CAEI,MAAO,KAAIvM,CAAAC,KAAJ,CAAkBmF,CAAAkH,IAAlB,CAA6BlH,CAAAmH,KAA7B,CAA6D,WAApB,GAAA,MAAOF,EAAP,CAAkCjH,CAAAiH,SAAlC,CAAmDA,CAA5F,CACX,IAAqB,QAArB,GAAI,MAAOjH,EAAX,CACI,MAAOpF,EAAAC,KAAAuM,WAAA,CAAyBpH,CAAzB,CAAgCiH,CAAhC,EAA4C,CAAA,CAA5C,CAAmD,EAAnD,CACX,IAAqB,QAArB,GAAI,MAAOjH,EAAX,CACI,MAAOpF,EAAAC,KAAAwM,WAAA,CAAyBrH,CAAzB,CAAgCiH,CAAhC,EAA4C,CAAA,CAA5C,CACX,MAAMjK,MAAA,CAAM,yBAAN,CAAN,CAR6B,CAy2CjCsK,QAASA,EAAgB,CAACC,CAAD,CAAaC,CAAb,CAAkB,CAAA,IACnCC,EAAMD,CAAAE,aAAA,EAD6B,CAEnCjM,EAAWgM,CAAXhM,CAAiB,CAFkB,CAGnCyE,EAAKuH,CAALvH,GAAa,CACjB,QAAQzE,CAAR,EACI,KAAKb,CAAAG,WAAAC,OAAL,CACI,EAAGyM,EAAA,CAAMD,CAAAG,UAAA,EAAT,OACwB,GADxB,IACQF,CADR,CACc,GADd,EAEA,MACJ,MAAK7M,CAAAG,WAAAE,OAAL,CACIuM,CAAAI,OAAA,EAAc,CACd,MACJ,MAAKhN,CAAAG,WAAAG,OAAL,CACIuM,CAAA;AAAMD,CAAAE,aAAA,EACNF,EAAAI,OAAA,EAAcH,CACd,MACJ,MAAK7M,CAAAG,WAAAI,WAAL,CACImM,CAAA,CAAiBpH,CAAjB,CAAqBsH,CAArB,CACA,MACJ,MAAK5M,CAAAG,WAAAK,SAAL,CACI,GAAI8E,CAAJ,GAAWqH,CAAX,CACI,MAAO,CAAA,CAEP,MAAMvK,MAAA,CAAM,wCAAN,CAA+CkD,CAA/C,CAAkD,IAAlD,CAAuDqH,CAAvD,CAAkE,YAAlE,CAAN,CACR,KAAK3M,CAAAG,WAAAM,OAAL,CACImM,CAAAI,OAAA,EAAc,CACd,MACJ,SACI,KAAM5K,MAAA,CAAM,qCAAN,CAA4CuK,CAA5C,CAAuD,IAAvD,CAA4D9L,CAA5D,CAAN,CAxBR,CA0BA,MAAO,CAAA,CA9BgC,CAjvD3C,IAAIsL,EAAU,EAAd,CAWIc,EAAIA,QAAQ,CAACC,CAAD,CAAUrD,CAAV,CAAkBjJ,CAAlB,CAAwB,CAOpC,IAAAsM,QAAA,CAAeA,CAOf,KAAArD,OAAA,CAAcA,CAOd,KAAAjJ,KAAA,CAAYA,CArBwB,CAXxC,CA8CIuM,EAAaF,CAAAnG,UAOjBqG,EAAAC,IAAA,CAAiBC,QAAQ,EAAG,CAAA,IACpBzM,EAAO,IAAAA,KADa,CAEpB0M,EAAM,IACV,GAAG,CACCA,CAAA,CAAMA,CAAAzD,OACN,IAAW,IAAX,EAAIyD,CAAJ,CACI,KACJ1M,EAAA,CAAO0M,CAAA1M,KAAP,CAAgB,GAAhB,CAAoBA,CAJrB,CAAH,MAKS,CALT,CAMA,OAAOA,EATiB,CAkB5BuM;CAAA9E,SAAA,CAAsBkF,QAAQ,CAACC,CAAD,CAAe,CACzC,OAAQA,CAAA,CAAe,IAAAC,UAAf,CAAgC,GAAhC,CAAsC,EAA9C,EAAoD,IAAAL,IAAA,EADX,CAS7CD,EAAAO,MAAA,CAAmBC,QAAQ,EAAG,CAC1B,KAAMvL,MAAA,CAAM,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAN,CAA0B,2BAA1B,CAAN,CAD0B,CAQ9B8D,EAAAc,EAAA,CAAYA,CAaZ,KAAIW,EAAYA,QAAQ,CAACV,CAAD,CAAUrD,CAAV,CAAkBjJ,CAAlB,CAAwBsF,CAAxB,CAAiC2H,CAAjC,CAAyC,CAC7DZ,CAAAa,KAAA,CAAO,IAAP,CAAaZ,CAAb,CAAsBrD,CAAtB,CAA8BjJ,CAA9B,CAKA,KAAA6M,UAAA,CAAiB,WAMjB,KAAAM,SAAA,CAAgB,EAMhB,KAAA7H,QAAA,CAAeA,CAAf,EAA0B,EAM1B,KAAA2H,OAAA,CAAcA,CAAd,EAAwB,QAxBqC,CAAjE,CA+BIG,EAAqBJ,CAAA9G,UAArBkH,CAA2CC,MAAAC,OAAA,CAAcjB,CAAAnG,UAAd,CAQ/CkH,EAAAG,YAAA,CAAiCC,QAAQ,CAAC/C,CAAD,CAAO,CAC5CA,CAAA,CAAOA,CAAP,EAAe,IACf,IAAY,IAAZ,EAAIA,CAAJ,CACI,MAAO,KAAA0C,SAAAM,MAAA,EAEX,KADA,IAAIN,EAAW,EAAf,CACS9L,EAAE,CADX,CACcqM,EAAE,IAAAP,SAAA7L,OAAhB,CAAsCD,CAAtC,CAAwCqM,CAAxC,CAA2C,EAAErM,CAA7C,CACQ,IAAA8L,SAAA,CAAc9L,CAAd,CAAJ,UAAgCoJ,EAAhC,EACI0C,CAAA1H,KAAA,CAAc,IAAA0H,SAAA,CAAc9L,CAAd,CAAd,CACR;MAAO8L,EARqC,CAiBhDC,EAAAO,SAAA,CAA8BC,QAAQ,CAACC,CAAD,CAAQ,CAC1C,IAAIC,CACJ,IAAIA,CAAJ,CAAY,IAAAC,SAAA,CAAcF,CAAA7N,KAAd,CAAZ,CAEI,GAAI8N,CAAJ,WAAqBE,EAAAC,MAArB,EAAsCH,CAAA9N,KAAtC,GAAqD8N,CAAAI,aAArD,EAAiH,IAAjH,GAA2E,IAAAH,SAAA,CAAcD,CAAAI,aAAd,CAA3E,CACIJ,CAAA9N,KAAA,CAAa8N,CAAAI,aADjB,KAEK,IAAIL,CAAJ,WAAqBG,EAAAC,MAArB,EAAsCJ,CAAA7N,KAAtC,GAAqD6N,CAAAK,aAArD,EAAiH,IAAjH,GAA2E,IAAAH,SAAA,CAAcF,CAAAK,aAAd,CAA3E,CACDL,CAAA7N,KAAA,CAAa6N,CAAAK,aADZ,KAGD,MAAM1M,MAAA,CAAM,8BAAN,CAAqC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DoG,CAAA7N,KAA9D,CAAN,CAER,IAAAmN,SAAA1H,KAAA,CAAmBoI,CAAnB,CAX0C,CAoB9CT,EAAAW,SAAA,CAA8BI,QAAQ,CAACC,CAAD,CAAW,CAE7C,IADA,IAAIC,EAA0B,QAApB,GAAA,MAAOD,EAAP,CAA+B,IAA/B,CAAsC,MAAhD,CACS/M,EAAE,CADX,CACcqM,EAAE,IAAAP,SAAA7L,OAAhB,CAAsCD,CAAtC,CAAwCqM,CAAxC,CAA2C,EAAErM,CAA7C,CACI,GAAI,IAAA8L,SAAA,CAAc9L,CAAd,CAAA,CAAiBgN,CAAjB,CAAJ;AAA8BD,CAA9B,CACI,MAAO,KAAAjB,SAAA,CAAc9L,CAAd,CACf,OAAO,KALsC,CAejD+L,EAAAkB,QAAA,CAA6BC,QAAQ,CAACC,CAAD,CAAKC,CAAL,CAA0B,CAAA,IACvDC,EAAqB,QAAd,GAAA,MAAOF,EAAP,CAAyBA,CAAAG,MAAA,CAAS,GAAT,CAAzB,CAAyCH,CADO,CAEvD9B,EAAM,IAFiD,CAGvDrL,EAAI,CACR,IAAgB,EAAhB,GAAIqN,CAAA,CAAKrN,CAAL,CAAJ,CAAoB,CAChB,IAAA,CAAsB,IAAtB,GAAOqL,CAAAzD,OAAP,CAAA,CACIyD,CAAA,CAAMA,CAAAzD,OACV5H,EAAA,EAHgB,CAMpB,EAAG,CACC,EAAG,CACC,GAAM,EAAAqL,CAAA,WAAenB,EAAAyB,UAAf,CAAN,CAAyC,CACrCN,CAAA,CAAM,IACN,MAFqC,CAIzCmB,CAAA,CAAQnB,CAAAqB,SAAA,CAAaW,CAAA,CAAKrN,CAAL,CAAb,CACR,IAAI,EAACwM,CAAD,EAAYA,CAAZ,WAA6BtC,EAAAc,EAA7B,CAAJ,EAAgDoC,CAAhD,EAAyE,EAAAZ,CAAA,WAAiBtC,EAAAyB,UAAjB,CAAzE,CAA+G,CAC3GN,CAAA,CAAM,IACN,MAF2G,CAIlGrL,CAAA,EAVd,CAAH,MAWSA,CAXT,CAWaqN,CAAApN,OAXb,CAYA,IAAW,IAAX,EAAIoL,CAAJ,CACI,KAEJ,IAAoB,IAApB,GAAI,IAAAzD,OAAJ,CACI,MAAO,KAAAA,OAAAqF,QAAA,CAAoBE,CAApB,CAAwBC,CAAxB,CAjBZ,CAAH,MAkBgB,IAlBhB,EAkBS/B,CAlBT,CAmBA,OAAOA,EA7BoD,CAsC/DU,EAAAoB,GAAA,CAAwBI,QAAQ,CAACC,CAAD,CAAI,CAAA,IAC5BH,EAAO,EADqB,CACjBhC,EAAMmC,CACrB,GACIH,EAAAI,QAAA,CAAapC,CAAA1M,KAAb,CACA,CAAA0M,CAAA,CAAMA,CAAAzD,OAFV,OAGiB,IAHjB;AAGSyD,CAHT,CAIA,KAASqC,CAAT,CAAa,CAAb,CAAgBA,CAAhB,EAAuBL,CAAApN,OAAvB,CAAoCyN,CAAA,EAApC,CAA2C,CACvC,IAAIP,EAAKE,CAAAjB,MAAA,CAAWiB,CAAApN,OAAX,CAAuByN,CAAvB,CACT,IAAIF,CAAJ,GAAU,IAAAP,QAAA,CAAaE,CAAb,CAAiBK,CAAjB,WAA8BtD,EAAAyB,UAA9B,CAAV,CACI,MAAOwB,EAAAQ,KAAA,CAAQ,GAAR,CAH4B,CAK3C,MAAOH,EAAArC,IAAA,EAXyB,CAmBpCY,EAAAN,MAAA,CAA2BmC,QAAQ,EAAG,CAIlC,IAFA,IAAIC,EAAK,EAAT,CACI/B,EAAW,IAAAA,SADf,CAES9L,EAAE,CAFX,CAEcqM,EAAEP,CAAA7L,OAFhB,CAEiCuM,CAAjC,CAAwCxM,CAAxC,CAA0CqM,CAA1C,CAA6C,EAAErM,CAA/C,CACIwM,CACA,CADQV,CAAA,CAAS9L,CAAT,CACR,CAAIwM,CAAJ,WAAqBb,EAArB,GACIkC,CAAA,CAAGrB,CAAA7N,KAAH,CADJ,CACqB6N,CAAAf,MAAA,EADrB,CAGAO,OAAA8B,eAAJ,EACI9B,MAAA8B,eAAA,CAAsBD,CAAtB,CAA0B,UAA1B,CAAsC,CAAE,MAAS,IAAAE,SAAA,EAAX,CAAtC,CACJ,OAAOF,EAX2B,CAkBtC9B,EAAAgC,SAAA,CAA8BC,QAAQ,EAAG,CAGrC,IAHqC,IACjCC,EAAM,EAD2B,CAEjCC,EAAOlC,MAAAkC,KAAA,CAAY,IAAAjK,QAAZ,CAF0B,CAG5BjE,EAAE,CAH0B,CAGvBqM,EAAE6B,CAAAjO,OAAhB,CAA6BD,CAA7B,CAA+BqM,CAA/B,CAAkC,EAAErM,CAApC,CAOIiO,CAAA,CANUC,CAAAlB,CAAKhN,CAALgN,CAMV,CAAA,CALU,IAAA/I,QAAAL,CAAasK,CAAA,CAAKlO,CAAL,CAAb4D,CAQd,OAAOqK,EAb8B,CAqBzClC,EAAAoC,UAAA,CAA+BC,QAAQ,CAACzP,CAAD,CAAO,CAC1C,MAAoB,WAApB;AAAI,MAAOA,EAAX,CACW,IAAAsF,QADX,CAEqC,WAA9B,GAAA,MAAO,KAAAA,QAAA,CAAatF,CAAb,CAAP,CAA4C,IAAAsF,QAAA,CAAatF,CAAb,CAA5C,CAAiE,IAH9B,CAU9CuL,EAAAyB,UAAA,CAAoBA,CAuBpB,KAAI0C,EAAUA,QAAQ,CAACjF,CAAD,CAAOkF,CAAP,CAAqBC,CAArB,CAA+B3C,CAA/B,CAAuCjN,CAAvC,CAA6C,CAM/D,IAAAyK,KAAA,CAAYA,CAMZ,KAAAkF,aAAA,CAAoBA,CAMpB,KAAAC,SAAA,CAAgBA,CAMhB,KAAA3C,OAAA,CAAcA,CAMd,KAAAjN,KAAA,CAAYA,CAEZ,IAAI4P,CAAJ,EAAuD,CAAvD,CAAgBxQ,CAAAkB,cAAAuP,QAAA,CAA+BpF,CAA/B,CAAhB,CACI,KAAMjJ,MAAA,CAAM,wBAAN,CAAiCiJ,CAAAzK,KAAjC,CAAN,CAjC2D,CAAnE,CAoCI8P,EAAmBJ,CAAAxJ,UAwBvBwJ,EAAAK,kBAAA,CAhBAC,QAAkB,CAACvF,CAAD,CAAO,CACD,QAApB,GAAI,MAAOA,EAAX,GACIA,CADJ,CACWrL,CAAAW,MAAA,CAAe0K,CAAf,CADX,CAEA,IAAiC,WAAjC,GAAI,MAAOA,EAAAvK,aAAX,CACI,KAAMsB,MAAA,CAAM,yBAAN,CAAgCiJ,CAAAzK,KAAhC,CAA0C,mBAA1C,CAAN,CACJ,MAAIyK,EAAJ,EAAYrL,CAAAW,MAAA,MAAZ,CACW,IAAIb,CAAJ,CAAe,CAAf,CADX,CAEOuL,CAAAvK,aAPc,CAsCzB4P;CAAArI,SAAA,CAA4BwI,QAAQ,EAAG,CACnC,OAAQ,IAAAjQ,KAAR,EAAqB,EAArB,GAA4B,IAAA4P,SAAA,CAAgB,KAAhB,CAAwB,OAApD,EAA+D,UAD5B,CAYvCE,EAAAI,YAAA,CAA+BC,QAAQ,CAAC3L,CAAD,CAAQ,CAE3C4L,QAASA,EAAI,CAACnL,CAAD,CAAM6E,CAAN,CAAW,CACpB,KAAMtI,MAAA,CAAM,oBAAN,CAA2B6O,CAAA5I,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,WAA/C,CAA2D4I,CAAA5F,KAAAzK,KAA3D,CAA0E,IAA1E,CAA+EiF,CAA/E,CAAmF,IAAnF,CAAwF6E,CAAxF,CAA4F,GAA5F,CAAN,CADoB,CADxB,IAAIuG,EAAO,IAIX,QAAQ,IAAA5F,KAAR,EAEI,KAAKrL,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CAII,MAAO,CAFc,QAEd,GAFH,MAAOyE,EAEJ,EAF2BA,CAE3B,GAFqCA,CAErC,EAF4D,CAE5D,GAF8CA,CAE9C,CAFsD,CAEtD,GADH4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,gBAAnB,CACG,CAAQ,UAAR,CAAAA,CAAA,CAAqBA,CAArB,CAA6B,CAA7B,CAAiCA,CAG5C,MAAKpF,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CAGI,MAAO,CAFc,QAEd,GAFH,MAAOyE,EAEJ,EAF2BA,CAE3B,GAFqCA,CAErC,EAF4D,CAE5D,GAF8CA,CAE9C,CAFsD,CAEtD,GADH4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,gBAAnB,CACG;AAAQ,CAAR,CAAAA,CAAA,CAAYA,CAAZ,GAAsB,CAAtB,CAA0BA,CAGrC,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACI,GAAIX,CAAAC,KAAJ,CACI,GAAI,CACA,MAAOmM,EAAA,CAAOhH,CAAP,CAAc,CAAA,CAAd,CADP,CAEF,MAAOjD,CAAP,CAAU,CACR6O,CAAA,CAAK,MAAO5L,EAAZ,CAAmBjD,CAAAkH,QAAnB,CADQ,CAHhB,IAOI2H,EAAA,CAAK,MAAO5L,EAAZ,CAAmB,kBAAnB,CAIR,MAAKpF,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,GAAIX,CAAAC,KAAJ,CACI,GAAI,CACA,MAAOmM,EAAA,CAAOhH,CAAP,CAAc,CAAA,CAAd,CADP,CAEF,MAAOjD,CAAP,CAAU,CACR6O,CAAA,CAAK,MAAO5L,EAAZ,CAAmBjD,CAAAkH,QAAnB,CADQ,CAHhB,IAOI2H,EAAA,CAAK,MAAO5L,EAAZ,CAAmB,kBAAnB,CAIR,MAAKpF,CAAAW,MAAA,KAAL,CAGI,MAFqB,SAEdyE,GAFH,MAAOA,EAEJA,EADH4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,eAAnB,CACGA,CAAAA,CAGX,MAAKpF,CAAAW,MAAA,CAAe,OAAf,CAAL,CACA,KAAKX,CAAAW,MAAA,CAAe,QAAf,CAAL,CAGI,MAFqB,QAEdyE,GAFH,MAAOA,EAEJA,EADH4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,cAAnB,CACGA,CAAAA,CAGX,MAAKpF,CAAAW,MAAA,OAAL,CAGI,MAFqB,QAEd;AAFH,MAAOyE,EAEJ,EAF4BA,CAE5B,EAFqCA,CAErC,WAFsD8L,OAEtD,EADHF,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,cAAnB,CACG,CAAA,EAAA,CAAGA,CAGd,MAAKpF,CAAAW,MAAA,MAAL,CACI,MAAIb,EAAAqR,aAAA,CAAwB/L,CAAxB,CAAJ,CACWA,CADX,CAEOtF,CAAAsR,KAAA,CAAgBhM,CAAhB,CAAuB,QAAvB,CAGX,MAAKpF,CAAAW,MAAA,CAAe,MAAf,CAAL,CAEI,IADA,IAAI0Q,EAAS,IAAAd,aAAApC,YAAA,CAA8BnO,CAAAmM,QAAAmF,KAAAC,MAA9B,CAAb,CACKtP,EAAE,CAAP,CAAUA,CAAV,CAAYoP,CAAAnP,OAAZ,CAA2BD,CAAA,EAA3B,CAGS,GAFDoP,CAAA,CAAOpP,CAAP,CAAArB,KAEC,EAFiBwE,CAEjB,EAAIiM,CAAA,CAAOpP,CAAP,CAAAqD,GAAJ,EAAoBF,CAApB,CACD,MAAOiM,EAAA,CAAOpP,CAAP,CAAAqD,GAEf,IAAoB,QAApB,GAAI,IAAAuI,OAAJ,CAMI,MAAOzI,CAJc,QAIdA,GAJH,MAAOA,EAIJA,EAJ2BA,CAI3BA,GAJqCA,CAIrCA,EAJ4D,CAI5DA,GAJ8CA,CAI9CA,CAJsD,CAItDA,GAHH4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,gBAAnB,CAGGA,EAFK,UAELA,CAFHA,CAEGA,EAF2B,CAE3BA,CAFmBA,CAEnBA,GADH4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,yBAAnB,CACGA,CAAAA,CAGP4L,EAAA,CAAK5L,CAAL,CAAY,wBAAZ,CAIR,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACSyE,CAAL;AAA+B,QAA/B,GAAc,MAAOA,EAArB,EACI4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,iBAAnB,CACJ,IAAIA,CAAJ,WAAqB,KAAAmL,aAAAiB,MAArB,CACI,MAAOpM,EACX,IAAIA,CAAJ,WAAqBpF,EAAAyR,QAAA7C,QAArB,CAA+C,CAEvC8C,IAAAA,EAAM,EAANA,CACKzP,CAAT,KAASA,CAAT,GAAcmD,EAAd,CACQA,CAAA0F,eAAA,CAAqB7I,CAArB,CAAJ,GACIyP,CAAA,CAAIzP,CAAJ,CADJ,CACamD,CAAA,CAAMnD,CAAN,CADb,CAEJmD,EAAA,CAAQsM,CANmC,CAS/C,MAAO,KAAK,IAAAnB,aAAAiB,MAAL,CAA8BpM,CAA9B,CA1Gf,CA+GA,KAAMhD,MAAA,CAAM,+BAAN,CAAsC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAtC,CAA0D,IAA1D,CAA+DjD,CAA/D,CAAqE,mBAArE,CAAyF,IAAAiG,KAAzF,CAAmG,GAAnG,CAAN,CApH2C,CA+H/CqF,EAAAiB,gBAAA,CAAmCC,QAAQ,CAACtM,CAAD,CAAKF,CAAL,CAAY,CACnD,GAAc,IAAd,GAAIA,CAAJ,CAAoB,MAAO,EAE3B,KAAIyM,CACJ,QAAQ,IAAAxG,KAAR,EACI,KAAKrL,CAAAW,MAAA,MAAL,CACI,MAAe,EAAR,CAAAyE,CAAA,CAAYtF,CAAAgS,kBAAA,CAA6B1M,CAA7B,CAAZ,CAAkDtF,CAAAiS,kBAAA,CAA6B3M,CAA7B,CAC7D,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAAiS,kBAAA,CAA6B3M,CAA7B,CACX;KAAKpF,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAAiS,kBAAA,CAA6BjS,CAAAkS,eAAA,CAA0B5M,CAA1B,CAA7B,CACX,MAAKpF,CAAAW,MAAA,QAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,CAAe,OAAf,CAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAAgS,kBAAA,CAA6B1M,CAA7B,CACX,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAOb,EAAAgS,kBAAA,CAA6BhS,CAAAmS,eAAA,CAA0B7M,CAA1B,CAA7B,CACX,MAAKpF,CAAAW,MAAA,QAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,KAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,CAAe,MAAf,CAAL,CACI,MAAOb,EAAAiS,kBAAA,CAA6B3M,CAA7B,CACX,MAAKpF,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI,MAAO,EACX,MAAKX,CAAAW,MAAA,OAAL,CAEI,MADAkR,EACO,CADH/R,CAAAoS,mBAAA,CAA8B9M,CAA9B,CACG,CAAAtF,CAAAiS,kBAAA,CAA6BF,CAA7B,CAAA;AAAkCA,CAC7C,MAAK7R,CAAAW,MAAA,MAAL,CACI,GAAwB,CAAxB,CAAIyE,CAAA+M,UAAA,EAAJ,CACI,KAAM/P,MAAA,CAAM,oBAAN,CAA2B,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDjD,CAAA+M,UAAA,EAApD,CAAsE,kBAAtE,CAAN,CACJ,MAAOrS,EAAAiS,kBAAA,CAA6B3M,CAAA+M,UAAA,EAA7B,CAAP,CAAyD/M,CAAA+M,UAAA,EAC7D,MAAKnS,CAAAW,MAAA,QAAL,CAEI,MADAkR,EACO,CADH,IAAAtB,aAAA6B,UAAA,CAA4BhN,CAA5B,CACG,CAAAtF,CAAAiS,kBAAA,CAA6BF,CAA7B,CAAA,CAAkCA,CAC7C,MAAK7R,CAAAW,MAAA,MAAL,CAEI,MADAkR,EACO,CADH,IAAAtB,aAAA6B,UAAA,CAA4BhN,CAA5B,CACG,CAAAyM,CAAA,CAAI/R,CAAAiS,kBAAA,CAA8BzM,CAA9B,EAAoC,CAApC,CAAyCtF,CAAAG,WAAAK,SAAzC,CArCnB,CAwCA,KAAM4B,MAAA,CAAM,wCAAN,CAA+C,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAA/C,CAAmE,IAAnE,CAAwEjD,CAAxE,CAA8E,iBAA9E,CAAN,CA5CmD,CAwDvDsL,EAAA2B,YAAA,CAA+BC,QAAQ,CAAChN,CAAD;AAAKF,CAAL,CAAYmN,CAAZ,CAAoB,CACvD,GAAc,IAAd,GAAInN,CAAJ,CAAoB,MAAOmN,EAG3B,QAAQ,IAAAlH,KAAR,EAEI,KAAKrL,CAAAW,MAAA,MAAL,CAGgB,CAAZ,CAAIyE,CAAJ,CACImN,CAAAC,cAAA,CAAqBpN,CAArB,CADJ,CAGImN,CAAAE,cAAA,CAAqBrN,CAArB,CACJ,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACI4R,CAAAE,cAAA,CAAqBrN,CAArB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACI4R,CAAAG,oBAAA,CAA2BtN,CAA3B,CACA,MAGJ,MAAKpF,CAAAW,MAAA,QAAL,CACI4R,CAAAI,YAAA,CAAmBvN,CAAnB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,SAAL,CACI4R,CAAAK,WAAA,CAAkBxN,CAAlB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACI4R,CAAAC,cAAA,CAAqBpN,CAArB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACI4R,CAAAM,oBAAA,CAA2BzN,CAA3B,CACA,MAGJ,MAAKpF,CAAAW,MAAA,QAAL,CACI4R,CAAAO,YAAA,CAAmB1N,CAAnB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,SAAL,CACI4R,CAAAQ,WAAA,CAAkB3N,CAAlB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,KAAL,CACyB,QAArB;AAAI,MAAOyE,EAAX,CACImN,CAAAE,cAAA,CAA6C,OAAxB,GAAArN,CAAAuE,YAAA,EAAA,CAAkC,CAAlC,CAAsC,CAAEvE,CAAAA,CAA7D,CADJ,CAGImN,CAAAE,cAAA,CAAqBrN,CAAA,CAAQ,CAAR,CAAY,CAAjC,CACJ,MAGJ,MAAKpF,CAAAW,MAAA,CAAe,MAAf,CAAL,CACI4R,CAAAE,cAAA,CAAqBrN,CAArB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,CAAe,OAAf,CAAL,CACI4R,CAAAS,aAAA,CAAoB5N,CAApB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI4R,CAAAU,aAAA,CAAoB7N,CAApB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,OAAL,CACI4R,CAAAW,aAAA,CAAoB9N,CAApB,CACA,MAGJ,MAAKpF,CAAAW,MAAA,MAAL,CACI,GAAwB,CAAxB,CAAIyE,CAAA+M,UAAA,EAAJ,CACI,KAAM/P,MAAA,CAAM,oBAAN,CAA2B,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDjD,CAAA+M,UAAA,EAApD,CAAsE,kBAAtE,CAAN,CACAgB,CAAAA,CAAa/N,CAAA4H,OACjBuF,EAAAE,cAAA,CAAqBrN,CAAA+M,UAAA,EAArB,CACAI,EAAAa,OAAA,CAAchO,CAAd,CACAA,EAAA4H,OAAA,CAAemG,CACf,MAGJ,MAAKnT,CAAAW,MAAA,QAAL,CACQ0S,CAAAA,CAAKC,CAAA,IAAIxT,CAAJwT,IAAA,EACT;IAAA/C,aAAAgD,OAAA,CAAyBnO,CAAzB,CAAgCiO,CAAhC,CACAd,EAAAE,cAAA,CAAqBY,CAAArG,OAArB,CACAuF,EAAAa,OAAA,CAAcC,CAAAG,KAAA,EAAd,CACA,MAGJ,MAAKxT,CAAAW,MAAA,MAAL,CACI,IAAA4P,aAAAgD,OAAA,CAAyBnO,CAAzB,CAAgCmN,CAAhC,CACAA,EAAAE,cAAA,CAAsBnN,CAAtB,EAA4B,CAA5B,CAAiCtF,CAAAG,WAAAK,SAAjC,CACA,MAEJ,SAEI,KAAM4B,MAAA,CAAM,wCAAN,CAA+C,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAA/C,CAAmE,IAAnE,CAAwEjD,CAAxE,CAA8E,iBAA9E,CAAN,CA1GR,CA4GA,MAAOmN,EAhHgD,CA4H3D7B,EAAA+C,OAAA,CAA0BC,QAAQ,CAACnB,CAAD,CAAS1R,CAAT,CAAmByE,CAAnB,CAAuB,CACrD,GAAIzE,CAAJ,EAAgB,IAAAwK,KAAAxK,SAAhB,CACI,KAAMuB,MAAA,CAAM,kCAAN,CAAN,CAGJ,OAAQ,IAAAiJ,KAAR,EAEI,KAAKrL,CAAAW,MAAA,MAAL,CACI,MAAO4R,EAAAzF,aAAA,EAAP,CAA+B,CAGnC,MAAK9M,CAAAW,MAAA,OAAL,CACI,MAAO4R,EAAAzF,aAAA,EAAP;AAAiC,CAGrC,MAAK9M,CAAAW,MAAA,OAAL,CACI,MAAO4R,EAAAoB,mBAAA,EAAP,CAAqC,CAGzC,MAAK3T,CAAAW,MAAA,QAAL,CACI,MAAO4R,EAAAqB,WAAA,EAAP,GAA+B,CAEnC,MAAK5T,CAAAW,MAAA,SAAL,CACI,MAAO4R,EAAAsB,UAAA,EAAP,CAA4B,CAGhC,MAAK7T,CAAAW,MAAA,MAAL,CACI,MAAO4R,EAAAuB,aAAA,EAGX,MAAK9T,CAAAW,MAAA,OAAL,CACI,MAAO4R,EAAAuB,aAAA,EAAAC,WAAA,EAGX,MAAK/T,CAAAW,MAAA,OAAL,CACI,MAAO4R,EAAAyB,mBAAA,EAGX,MAAKhU,CAAAW,MAAA,QAAL,CACI,MAAO4R,EAAA0B,WAAA,EAGX,MAAKjU,CAAAW,MAAA,SAAL,CACI,MAAO4R,EAAA2B,UAAA,EAGX,MAAKlU,CAAAW,MAAA,KAAL,CACI,MAAO,CAAE,CAAA4R,CAAAzF,aAAA,EAGb,MAAK9M,CAAAW,MAAA,CAAe,MAAf,CAAL,CAEI,MAAO4R,EAAAzF,aAAA,EAGX,MAAK9M,CAAAW,MAAA,CAAe,OAAf,CAAL,CACI,MAAO4R,EAAA4B,UAAA,EAGX;KAAKnU,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI,MAAO4R,EAAA6B,WAAA,EAGX,MAAKpU,CAAAW,MAAA,OAAL,CACI,MAAO4R,EAAA8B,YAAA,EAGX,MAAKrU,CAAAW,MAAA,MAAL,CACI2T,CAAA,CAAS/B,CAAAzF,aAAA,EACT,IAAIyF,CAAAJ,UAAA,EAAJ,CAAyBmC,CAAzB,CACI,KAAMlS,MAAA,CAAM,8BAAN,CAAqC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DiM,CAA9D,CAAqE,yBAArE,CAA+F/B,CAAAJ,UAAA,EAA/F,CAAN,CACJ/M,CAAA,CAAQmN,CAAAgC,MAAA,EACRnP,EAAAoP,MAAA,CAAcpP,CAAA4H,OAAd,CAA2BsH,CAC3B/B,EAAAvF,OAAA,EAAiBsH,CACjB,OAAOlP,EAIX,MAAKpF,CAAAW,MAAA,QAAL,CAEI,MADA2T,EACO,CADE/B,CAAAzF,aAAA,EACF,CAAA,IAAAyD,aAAAkD,OAAA,CAAyBlB,CAAzB,CAAiC+B,CAAjC,CAIX,MAAKtU,CAAAW,MAAA,MAAL,CACI,MAAO,KAAA4P,aAAAkD,OAAA,CAAyBlB,CAAzB,CAAkC,EAAlC,CAAqCjN,CAArC,CAhFf,CAoFA,KAAMlD,MAAA,CAAM,gCAAN,CAAN,CAzFqD,CAoGzDsO,EAAA+D,gBAAA;AAAmCC,QAAQ,CAACjR,CAAD,CAAM,CAC7C,GAAK+M,CAAA,IAAAA,SAAL,CACI,KAAMpO,MAAA,CAAM,iDAAN,CAAN,CAGJ,OAAQ,IAAAiJ,KAAR,EACI,KAAKrL,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,MAAO,KAAAmQ,YAAA,CAAiBnL,QAAA,CAASlC,CAAT,CAAjB,CAEX,MAAKzD,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CAEM,MAAO,KAAAmQ,YAAA,CAAiBrN,CAAjB,CAEb,MAAKzD,CAAAW,MAAA,KAAL,CACM,MAAe,MAAf,GAAO8C,CAEb,MAAKzD,CAAAW,MAAA,OAAL,CACM,MAAO,KAAAmQ,YAAA,CAAiBrN,CAAjB,CAEb,MAAKzD,CAAAW,MAAA,MAAL,CACM,MAAOb,EAAA6U,WAAA,CAAsBlR,CAAtB,CAvBjB,CAL6C,CA+CjDiN;CAAAkE,cAAA,CAAiCC,QAAQ,CAACzP,CAAD,CAAQ,CAC7C,GAAKoL,CAAA,IAAAA,SAAL,CACI,KAAMpO,MAAA,CAAM,+CAAN,CAAN,CAGJ,MAAI,KAAAiJ,KAAJ,GAAkBrL,CAAAW,MAAA,MAAlB,CACWyE,CAAAiD,SAAA,CAAe,QAAf,CADX,CAGWjD,CAAAiD,SAAA,EARkC,CAgBjD8D,EAAAmE,QAAA,CAAkBA,CAclB,KAAI1B,EAAUA,QAAQ,CAAC1B,CAAD,CAAUrD,CAAV,CAAkBjJ,CAAlB,CAAwBsF,CAAxB,CAAiCuE,CAAjC,CAA0CoD,CAA1C,CAAkD,CACpED,CAAAE,KAAA,CAAe,IAAf,CAAqBZ,CAArB,CAA8BrD,CAA9B,CAAsCjJ,CAAtC,CAA4CsF,CAA5C,CAAqD2H,CAArD,CAKA,KAAAJ,UAAA,CAAiB,SAOjB,KAAAqH,WAAA,CAAkB9T,IAAAA,EAOlB,KAAAwQ,MAAA,CAAa,IAOb,KAAA/G,QAAA,CAAe,CAAEA,CAAAA,CAuBjB,KAAAsK,cAAA,CAPA,IAAAC,YAOA,CAdA,IAAAC,QAcA,CAde,IApCqD,CAAxE,CAyDIC,EAAmBtG,CAAA9H,UAAnBoO,CAAuCjH,MAAAC,OAAA,CAAcN,CAAA9G,UAAd,CAU3CoO,EAAAxH,MAAA,CAAyByH,QAAQ,CAACC,CAAD,CAAU,CACvC,GAAI,IAAA5D,MAAJ,EAAmB4D,CAAAA,CAAnB,CACI,MAAO,KAAA5D,MAGPA,EAAAA,CAAS,QAAQ,CAACxR,CAAD,CAAWiN,CAAX,CAAc,CAqe/BoI,QAASA,EAAQ,CAAC3D,CAAD,CAAM4D,CAAN;AAAsBC,CAAtB,CAAsChF,CAAtC,CAAoD,CACjE,GAAY,IAAZ,GAAImB,CAAJ,EAAmC,QAAnC,GAAoB,MAAOA,EAA3B,CAA6C,CAEzC,GAAInB,CAAJ,EAAoBA,CAApB,WAA4CvQ,EAAAmM,QAAAmF,KAA5C,CAAmE,CAC/D,IAAI1Q,EAAOZ,CAAAmM,QAAAmF,KAAAkE,QAAA,CAA8BjF,CAAAkF,OAA9B,CAAmD/D,CAAnD,CACX,IAAa,IAAb,GAAI9Q,CAAJ,CACI,MAAOA,EAHoD,CAMnE,MAAO8Q,EARkC,CAW7C,GAAI5R,CAAAqR,aAAA,CAAwBO,CAAxB,CAAJ,CACI,MAAO4D,EAAA,CAAiB5D,CAAAgE,SAAA,EAAjB,CAAkChE,CAAAiE,SAAA,EAE7C,IAAI3V,CAAAC,KAAA2V,OAAA,CAAqBlE,CAArB,CAAJ,CACI,MAAO6D,EAAA,CAAiB7D,CAAArJ,SAAA,EAAjB,CAAkCrI,CAAAC,KAAA4V,UAAA,CAAwBnE,CAAxB,CAC7C,KAAI6C,CAEJ,IAAIpO,KAAAC,QAAA,CAAcsL,CAAd,CAAJ,CAKI,MAJA6C,EAIOA,CAJC,EAIDA,CAHP7C,CAAAoE,QAAA,CAAY,QAAQ,CAACC,CAAD,CAAIzH,CAAJ,CAAO,CACvBiG,CAAA,CAAMjG,CAAN,CAAA,CAAW+G,CAAA,CAASU,CAAT,CAAYT,CAAZ,CAA4BC,CAA5B,CAA4ChF,CAA5C,CADY,CAA3B,CAGOgE,CAAAA,CAEXA,EAAA,CAAQ,EAER,IAAI7C,CAAJ,WAAmB1R,EAAAgW,IAAnB,CAAiC,CAE7B,IADIC,IAAAA,EAAKvE,CAAAwE,QAAA,EAALD,CACK9T,EAAI8T,CAAA5O,KAAA,EAAb,CAAyB8O,CAAAhU,CAAAgU,KAAzB,CAAiChU,CAAjC,CAAqC8T,CAAA5O,KAAA,EAArC,CACIkN,CAAA,CAAM7C,CAAA0E,QAAAxB,cAAA,CAA0BzS,CAAAiD,MAAA,CAAQ,CAAR,CAA1B,CAAN,CAAA,CAA+CiQ,CAAA,CAASlT,CAAAiD,MAAA,CAAQ,CAAR,CAAT,CAAqBkQ,CAArB,CAAqCC,CAArC,CAAqD7D,CAAA2E,UAAA9F,aAArD,CACnD;MAAOgE,EAJsB,CAO7BlJ,IAAAA,EAAOqG,CAAA4E,MAAPjL,CACAkL,EAAQvV,IAAAA,EADRqK,CAEKpJ,CAAT,KAASA,CAAT,GAAcyP,EAAd,CACQA,CAAA5G,eAAA,CAAmB7I,CAAnB,CAAJ,GACQoJ,CAAJ,GAAakL,CAAb,CAAqBlL,CAAAsD,SAAA,CAAc1M,CAAd,CAArB,EACIsS,CAAA,CAAMtS,CAAN,CADJ,CACeoT,CAAA,CAAS3D,CAAA,CAAIzP,CAAJ,CAAT,CAAiBqT,CAAjB,CAAiCC,CAAjC,CAAiDgB,CAAAhG,aAAjD,CADf,CAGIgE,CAAA,CAAMtS,CAAN,CAHJ,CAGeoT,CAAA,CAAS3D,CAAA,CAAIzP,CAAJ,CAAT,CAAiBqT,CAAjB,CAAiCC,CAAjC,CAJnB,CAMJ,OAAOhB,EA5C0D,CAretC,IAE3B/I,EAASyB,CAAAkB,YAAA,CAAcnO,CAAAmM,QAAAyC,QAAAC,MAAd,CAFkB,CAG3B2H,EAASvJ,CAAAkB,YAAA,CAAcnO,CAAAmM,QAAAyC,QAAA6H,MAAd,CAHkB,CAc3B7H,EAAUA,QAAQ,CAACyC,CAAD,CAASqF,CAAT,CAAmB,CACrC1W,CAAAyR,QAAA7C,QAAAd,KAAA,CAA8B,IAA9B,CAGA,KAJqC,IAI5B7L,EAAE,CAJ0B,CAIvBqM,EAAEkI,CAAAtU,OAAhB,CAA+BD,CAA/B,CAAiCqM,CAAjC,CAAoC,EAAErM,CAAtC,CACI,IAAA,CAAKuU,CAAA,CAAOvU,CAAP,CAAArB,KAAL,CAAA,CAAuB,IAEtBqB,EAAA,CAAE,CAAP,KAAUqM,CAAV,CAAY9C,CAAAtJ,OAAZ,CAA2BD,CAA3B,CAA6BqM,CAA7B,CAAgC,EAAErM,CAAlC,CAAqC,CACjC,IAAIsU,EAAQ/K,CAAA,CAAOvJ,CAAP,CACZ,KAAA,CAAKsU,CAAA3V,KAAL,CAAA,CACI2V,CAAAI,SAAA,CAAiB,EAAjB,CACCJ,CAAAK,IAAA,CAAY,IAAI5W,CAAAgW,IAAJ,CAAiBO,CAAjB,CAAZ,CAAsC,IACtCM,EAAAN,CAAAM,SAAL,EAAoC,QAApC,GAAuB5J,CAAAY,OAAvB,EAC2B,IAD3B,GACI0I,CAAAzV,aADJ,GAEI,IAAA,CAAKyV,CAAA3V,KAAL,CAFJ,CAEuB2V,CAAAzV,aAFvB,CALiC,CAUrC,GAAuB,CAAvB;AAAIgW,SAAA5U,OAAJ,CAGI,GAAyB,CAAzB,GAAI4U,SAAA5U,OAAJ,EAAyC,IAAzC,GAA8BmP,CAA9B,EAAmE,QAAnE,GAAiD,MAAOA,EAAxD,EACiC,EAAyB,UAAzB,GAAA,MAAOA,EAAAkC,OAAP,EAAuClC,CAAvC,WAAyDzC,EAAzD,CADjC,EAEgCzI,KAAAC,QAAA,CAAciL,CAAd,CAFhC,EAGsBA,CAHtB,WAGwCrR,EAAAgW,IAHxC,EAI4BlW,CAAAqR,aAAA,CAAwBE,CAAxB,CAJ5B,EAK+BA,CAL/B,WAKiD0F,YALjD,EAMuB/W,CAAAC,KANvB,EAMwCoR,CANxC,WAM0DrR,EAAAC,KAN1D,CASI,IAAKgC,CAAK,CAAH,CAAG,CAAAqM,CAAA,CAAEwI,SAAA5U,OAAZ,CAA8BD,CAA9B,CAAgCqM,CAAhC,CAAmC,EAAErM,CAArC,CAC0C,WAAtC,GAAI,OAAQmD,CAAR,CAAgB0R,SAAA,CAAU7U,CAAV,CAAhB,CAAJ,EACI,IAAA+U,KAAA,CAAUxL,CAAA,CAAOvJ,CAAP,CAAArB,KAAV,CAA0BwE,CAA1B,CAXZ,KAOI,KAAA4R,KAAA,CAAU3F,CAAV,CA3B6B,CAdV,CAqD3B6D,EAAmBtG,CAAA9H,UAAnBoO,CAAuCjH,MAAAC,OAAA,CAAclO,CAAAyR,QAAA7C,QAAA9H,UAAd,CAa3CoO,EAAA+B,IAAA,CAAuBC,QAAQ,CAACjI,CAAD,CAAM7J,CAAN,CAAa+R,CAAb,CAAuB,CAClD,IAAIZ,EAAQtJ,CAAA8H,cAAA,CAAgB9F,CAAhB,CACZ,IAAKkI,CAAAA,CAAL,CAAe,CACX,GAAKZ,CAAAA,CAAL,CACI,KAAMnU,MAAA,CAAM,IAAN,CAAW,GAAX,CAAe6M,CAAf,CAAmB,eAAnB,CAAN;AACJ,GAAM,EAAAsH,CAAA,WAAiBvW,EAAAmM,QAAAyC,QAAAC,MAAjB,CAAN,CACI,KAAMzM,MAAA,CAAM,IAAN,CAAW,GAAX,CAAe6M,CAAf,CAAmB,mBAAnB,CAAuCsH,CAAAlO,SAAA,CAAe,CAAA,CAAf,CAAvC,CAAN,CACJ,GAAKsO,CAAAJ,CAAAI,SAAL,CACI,KAAMvU,MAAA,CAAM,IAAN,CAAW,GAAX,CAAe6M,CAAf,CAAmB,0BAAnB,CAAN,CACJ7J,CAAA,CAAQmR,CAAAzF,YAAA,CAAkB1L,CAAlB,CAAyB,CAAA,CAAzB,CAPG,CASG,IAAlB,GAAI,IAAA,CAAK6J,CAAL,CAAJ,GACI,IAAA,CAAKA,CAAL,CADJ,CACgB,EADhB,CAEA,KAAA,CAAKA,CAAL,CAAA5I,KAAA,CAAejB,CAAf,CACA,OAAO,KAd2C,CA4BtD8P,EAAAkC,KAAA,CAAwBlC,CAAA+B,IAaxB/B,EAAAmC,IAAA,CAAuBC,QAAQ,CAACC,CAAD,CAAWnS,CAAX,CAAkB+R,CAAlB,CAA4B,CACvD,GAAII,CAAJ,EAAoC,QAApC,GAAgB,MAAOA,EAAvB,CAA8C,CAC1CJ,CAAA,CAAW/R,CACX,KAAKoS,IAAIA,CAAT,GAAiBD,EAAjB,CAEQA,CAAAzM,eAAA,CAAwB0M,CAAxB,CAAJ,EAAyE,WAAzE,GAAqC,OAAQpS,CAAR,CAAgBmS,CAAA,CAASC,CAAT,CAAhB,CAArC,EAAkHxW,IAAAA,EAAlH,GAAwFiM,CAAAwK,cAAA,CAAgBD,CAAhB,CAAxF,EACI,IAAAR,KAAA,CAAUQ,CAAV,CAAgBpS,CAAhB,CAAuB+R,CAAvB,CAER,OAAO,KAPmC,CAS1CZ,CAAAA,CAAQtJ,CAAA8H,cAAA,CAAgBwC,CAAhB,CACZ,IAAKJ,CAAL,CAOI,IAAA,CAAKI,CAAL,CAAA,CAAiBnS,CAPrB,KAAe,CACX,GAAKmR,CAAAA,CAAL,CACI,KAAMnU,MAAA,CAAM,IAAN;AAAW,GAAX,CAAemV,CAAf,CAAwB,4BAAxB,CAAN,CACJ,GAAM,EAAAhB,CAAA,WAAiBvW,EAAAmM,QAAAyC,QAAAC,MAAjB,CAAN,CACI,KAAMzM,MAAA,CAAM,IAAN,CAAW,GAAX,CAAemV,CAAf,CAAwB,mBAAxB,CAA4ChB,CAAAlO,SAAA,CAAe,CAAA,CAAf,CAA5C,CAAN,CACJ,IAAA,CAAKkO,CAAA3V,KAAL,CAAA,CAAoBwE,CAApB,CAA4BmR,CAAAzF,YAAA,CAAkB1L,CAAlB,CALjB,CAQXmR,CAAJ,EAAaA,CAAAmB,MAAb,GACQC,CACJ,CADmB,IAAA,CAAKpB,CAAAmB,MAAA9W,KAAL,CACnB,CAAc,IAAd,GAAIwE,CAAJ,EACyB,IAErB,GAFIuS,CAEJ,EAF6BA,CAE7B,GAF8CpB,CAAA3V,KAE9C,GADI,IAAA,CAAK+W,CAAL,CACJ,CADyB,IACzB,EAAA,IAAA,CAAKpB,CAAAmB,MAAA9W,KAAL,CAAA,CAAyB2V,CAAA3V,KAH7B,EAIkC+W,CAJlC,GAImDJ,CAJnD,GAKI,IAAA,CAAKhB,CAAAmB,MAAA9W,KAAL,CALJ,CAK6B,IAL7B,CAFJ,CASA,OAAO,KA5BgD,CAyC3DsU,EAAA8B,KAAA,CAAwB9B,CAAAmC,IAYxBnC,EAAA0C,IAAA,CAAuBC,QAAQ,CAAC5I,CAAD,CAAMkI,CAAN,CAAgB,CAC3C,GAAIA,CAAJ,CACI,MAAO,KAAA,CAAKlI,CAAL,CACX,KAAIsH,EAAQtJ,CAAA8H,cAAA,CAAgB9F,CAAhB,CACZ,IAAI,EAACsH,CAAD,EAAYA,CAAZ,WAA6BvW,EAAAmM,QAAAyC,QAAAC,MAA7B,CAAJ,CACI,KAAMzM,MAAA,CAAM,IAAN,CAAW,GAAX,CAAe6M,CAAf,CAAmB,4BAAnB,CAAN;AACJ,GAAM,EAAAsH,CAAA,WAAiBvW,EAAAmM,QAAAyC,QAAAC,MAAjB,CAAN,CACI,KAAMzM,MAAA,CAAM,IAAN,CAAW,GAAX,CAAe6M,CAAf,CAAmB,mBAAnB,CAAuCsH,CAAAlO,SAAA,CAAe,CAAA,CAAf,CAAvC,CAAN,CACJ,MAAO,KAAA,CAAKkO,CAAA3V,KAAL,CARoC,CAoB/CsU,EAAA4C,KAAA,CAAwB5C,CAAA0C,IAIxB,KAAK,IAAI3V,EAAE,CAAX,CAAcA,CAAd,CAAgBuJ,CAAAtJ,OAAhB,CAA+BD,CAAA,EAA/B,CAAoC,CAChC,IAAIsU,EAAQ/K,CAAA,CAAOvJ,CAAP,CAERsU,EAAJ,WAAqBvW,EAAAmM,QAAAyC,QAAAmJ,eAArB,EAGI9K,CAAAC,QAAAhH,QAAA,kBAHJ,EAIK,QAAQ,CAACqQ,CAAD,CAAQ,CAEb,IAAIyB,EAAOzB,CAAAzH,aAAApL,QAAA,CAA2B,cAA3B,CAA2C,QAAQ,CAACyD,CAAD,CAAQ,CAClE,MAAOA,EAAAtD,YAAA,EAAAH,QAAA,CAA4B,GAA5B,CAAgC,EAAhC,CAD2D,CAA3D,CAAX,CAGAsU,EAAOA,CAAAvS,UAAA,CAAe,CAAf,CAAiB,CAAjB,CAAA5B,YAAA,EAAPmU,CAA2CA,CAAAvS,UAAA,CAAe,CAAf,CAH3C,CAMI7E,EAAO2V,CAAAzH,aAAApL,QAAA,CAA2B,UAA3B,CAAuC,QAAQ,CAACyD,CAAD,CAAQ,CAC9D,MAAO,GAAP,CAAWA,CADmD,CAAvD,CANX,CAkBI8Q,EAASA,QAAQ,CAAC7S,CAAD,CAAQ+R,CAAR,CAAkB,CACnC,IAAA,CAAKZ,CAAA3V,KAAL,CAAA;AAAmBuW,CAAA,CAAW/R,CAAX,CAAmBmR,CAAAzF,YAAA,CAAkB1L,CAAlB,CACtC,OAAO,KAF4B,CAlBvC,CA6BI8S,EAASA,QAAQ,EAAG,CACpB,MAAO,KAAA,CAAK3B,CAAA3V,KAAL,CADa,CAIO,KAA/B,GAAIqM,CAAA0B,SAAA,CAAW,KAAX,CAAiBqJ,CAAjB,CAAJ,GAYI9C,CAAA,CAAiB,KAAjB,CAAuB8C,CAAvB,CAZJ,CAYmCC,CAZnC,CAcgC,KAAhC,GAAIhL,CAAA0B,SAAA,CAAW,MAAX,CAAkB/N,CAAlB,CAAJ,GAYIsU,CAAA,CAAiB,MAAjB,CAAwBtU,CAAxB,CAZJ,CAYoCqX,CAZpC,CAc+B,KAA/B,GAAIhL,CAAA0B,SAAA,CAAW,KAAX,CAAiBqJ,CAAjB,CAAJ,GASI9C,CAAA,CAAiB,KAAjB,CAAuB8C,CAAvB,CATJ,CASmCE,CATnC,CAWgC,KAAhC,GAAIjL,CAAA0B,SAAA,CAAW,MAAX,CAAkB/N,CAAlB,CAAJ,GASIsU,CAAA,CAAiB,MAAjB,CAAwBtU,CAAxB,CATJ,CASoCsX,CATpC,CA1Ea,CAAjB,CAqFG3B,CArFH,CAP4B,CA+GpCrB,CAAA3B,OAAA,CAA0B4E,QAAQ,CAAC5F,CAAD,CAAS6F,CAAT,CAAmB,CAC3B,SAAtB,GAAI,MAAO7F,EAAX,GACI6F,CACA,CADW7F,CACX,CAAAA,CAAA,CAASvR,IAAAA,EAFb,CAGA,KAAIqX,EAAQ,CAAA,CACP9F,EAAL,GACIA,CACA,CADS,IAAIzS,CACb,CAAAuY,CAAA,CAAQ,CAAA,CAFZ,CAGA,KAAIC,EAAK/F,CAAAgG,aACT,IAAI,CAEA,MADAtL,EAAAsG,OAAA,CAAS,IAAT,CAAehB,CAAAe,GAAA,EAAf,CAA4B8E,CAA5B,CACO,CAAA9E,CAAC+E,CAAA,CAAQ9F,CAAAiB,KAAA,EAAR,CAAwBjB,CAAzBe,IAAA,CAAoCgF,CAApC,CAFP,CAGF,MAAOnW,CAAP,CAAU,CAER,KADAoQ,EAAAe,GAAA,CAAUgF,CAAV,CACMnW,CAAAA,CAAN,CAFQ,CAZqC,CA0BrDyM,EAAA2E,OAAA,CAAiBiF,QAAQ,CAAC5V,CAAD,CAAO2P,CAAP,CAAe6F,CAAf,CAAyB,CAC9C,MAAO7E,CAAA,IAAI3E,CAAJ,CAAYhM,CAAZ,CAAA2Q,QAAA,CAAyBhB,CAAzB,CAAiC6F,CAAjC,CADuC,CAYlDlD,EAAA9C,UAAA;AAA6BqG,QAAQ,EAAG,CACpC,MAAOxL,EAAAmF,UAAA,CAAY,IAAZ,CAD6B,CAexC8C,EAAAwD,gBAAA,CAAmCC,QAAQ,CAACpG,CAAD,CAAS6F,CAAT,CAAmB,CAC1D,IAAIC,EAAQ,CAAA,CACP9F,EAAL,GACIA,CACA,CADS,IAAIzS,CACb,CAAAuY,CAAA,CAAQ,CAAA,CAFZ,CAGA,KAAIO,EAAMtF,CAAA,IAAIxT,CAAJwT,IAAA,EACVrG,EAAAsG,OAAA,CAAS,IAAT,CAAeqF,CAAf,CAAoBR,CAApB,CAAA5E,KAAA,EACAjB,EAAAE,cAAA,CAAqBmG,CAAAzG,UAAA,EAArB,CACAI,EAAAa,OAAA,CAAcwF,CAAd,CACA,OAAOP,EAAA,CAAQ9F,CAAAiB,KAAA,EAAR,CAAwBjB,CAT2B,CAqB9D2C,EAAA2D,SAAA,CAA4BC,QAAQ,EAAG,CACnC,GAAI,CACA,MAAO,KAAAvF,OAAA,EAAAwF,cAAA,EADP,CAEF,MAAO5W,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAA4W,cAAA,EAC3B5W,EAAAA,CAAN,CAFQ,CAHuB,CAkBvC+S,EAAA6D,cAAA,CAAiC7D,CAAA2D,SAWjC3D,EAAA8D,SAAA,CAA4BC,QAAQ,EAAG,CACnC,GAAI,CACA,MAAO,KAAA1F,OAAA,EAAAoC,SAAA,EADP,CAEF,MAAOxT,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAwT,SAAA,EAC3BxT,EAAAA,CAAN,CAFQ,CAHuB,CAkBvC+S,EAAAS,SAAA,CAA4BT,CAAA8D,SAW5B9D;CAAAgE,SAAA,CAA4BC,QAAQ,EAAG,CACnC,GAAI,CACA,MAAO,KAAA5F,OAAA,EAAAmC,SAAA,EADP,CAEF,MAAOvT,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAuT,SAAA,EAC3BvT,EAAAA,CAAN,CAFQ,CAHuB,CAkBvC+S,EAAAQ,SAAA,CAA4BR,CAAAgE,SAW5BhE,EAAAkE,UAAA,CAA6BC,QAAQ,EAAG,CACpC,GAAI,CACA,MAAO,KAAA9F,OAAA,EAAA+F,MAAA,EADP,CAEF,MAAOnX,CAAP,CAAU,CAER,KADIA,EAAA,QACEA,GADYA,CAAA,QACZA,CAD2BA,CAAA,QAAAmX,MAAA,EAC3BnX,EAAAA,CAAN,CAFQ,CAHwB,CAkBxC+S,EAAAoE,MAAA,CAAyBpE,CAAAkE,UAiEzBlE,EAAAqE,MAAA,CAAyBC,QAAQ,CAAClE,CAAD,CAAiBC,CAAjB,CAAiC,CAC9D,MAAOF,EAAA,CAAS,IAAT,CAAe,CAAEC,CAAAA,CAAjB,CAAiC,CAAEC,CAAAA,CAAnC,CAAmD,IAAAe,MAAnD,CADuD,CASlEpB,EAAAuE,WAAA,CAA8BC,QAAQ,EAAG,CACrC,MAAOC,KAAAC,UAAA,CACHvE,CAAA,CAAS,IAAT,CAC4B,CAAA,CAD5B,CAE4B,CAAA,CAF5B,CAGK,IAAAiB,MAHL,CADG,CAD8B,CAwBzC1H,EAAA6E,OAAA,CAAiBoG,QAAQ,CAACtH,CAAD,CAASrQ,CAAT,CAAiB0W,CAAjB,CAAsB,CACrB,QAAtB,GAAI,MAAO1W,EAAX,GACI0W,CACA,CADM1W,CACN,CAAAA,CAAA,CAAU,EAFd,CAGsB,SAAtB,GAAI,MAAOqQ,EAAX,CACIA,CADJ,CACazS,CAAAsR,KAAA,CAAgBmB,CAAhB,CAAwBqG,CAAA;AAAMA,CAAN,CAAY,QAApC,CADb,CAEU9Y,CAAAqR,aAAA,CAAwBoB,CAAxB,CAFV,GAGIA,CAHJ,CAGazS,CAAAsR,KAAA,CAAgBmB,CAAhB,CAHb,CAII+F,EAAAA,CAAK/F,CAAAgG,aACT,IAAI,CACA,IAAI7N,EAAMuC,CAAAwG,OAAA,CAASlB,CAAAe,GAAA,EAAT,CAAsBpR,CAAtB,CACVqQ,EAAAe,GAAA,CAAUgF,CAAV,CACA,OAAO5N,EAHP,CAIF,MAAOvI,CAAP,CAAU,CAER,KADAoQ,EAAAe,GAAA,CAAUgF,CAAV,CACMnW,CAAAA,CAAN,CAFQ,CAb+B,CA8B/CyM,EAAAkL,gBAAA,CAA0BC,QAAQ,CAACxH,CAAD,CAASqG,CAAT,CAAc,CACtB,QAAtB,GAAI,MAAOrG,EAAX,CACIA,CADJ,CACazS,CAAAsR,KAAA,CAAgBmB,CAAhB,CAAwBqG,CAAA,CAAMA,CAAN,CAAY,QAApC,CADb,CAEU9Y,CAAAqR,aAAA,CAAwBoB,CAAxB,CAFV,GAGIA,CAHJ,CAGazS,CAAAsR,KAAA,CAAgBmB,CAAhB,CAHb,CAIA,IAAyB,CAAzB,CAAIA,CAAAJ,UAAA,EAAJ,CACI,MAAO,KANiC,KAOxC6H,EAAMzH,CAAAvF,OAPkC,CAQxC2C,EAAM4C,CAAAzF,aAAA,EACV,IAAIyF,CAAAJ,UAAA,EAAJ,CAAyBxC,CAAzB,CAEI,MADA4C,EAAAvF,OACO,CADSgN,CACT,CAAA,IAEX,IAAI,CACA,IAAItP,EAAMuC,CAAAwG,OAAA,CAASlB,CAAAlE,MAAA,CAAakE,CAAAvF,OAAb,CAA4BuF,CAAAvF,OAA5B,CAA4C2C,CAA5C,CAAA2D,GAAA,EAAT,CACVf,EAAAvF,OAAA,EAAiB2C,CACjB,OAAOjF,EAHP,CAIF,MAAO/H,CAAP,CAAY,CAEV,KADA4P,EAAAvF,OACMrK,EADWgN,CACXhN,CAAAA,CAAN,CAFU,CAjB8B,CAiChDiM,EAAAqL,SAAA,CAAmBC,QAAQ,CAACzW,CAAD,CAAM,CAC7B,MAAOmL,EAAA6E,OAAA,CAAehQ,CAAf;AAAoB,QAApB,CADsB,CAcjCmL,EAAAuL,UAAA,CAAoBC,QAAQ,CAAC3W,CAAD,CAAM,CAC9B,MAAOmL,EAAA6E,OAAA,CAAehQ,CAAf,CAAoB,KAApB,CADuB,CAclCmL,EAAAyL,WAAA,CAAqBC,QAAQ,CAAC7W,CAAD,CAAM,CAC/B,MAAO,KAAImL,CAAJ,CAAY+K,IAAAhR,MAAA,CAAWlF,CAAX,CAAZ,CADwB,CAanCyR,EAAA7M,SAAA,CAA4BkS,QAAQ,EAAG,CACnC,MAAOtN,EAAA5E,SAAA,EAD4B,CAsCnC4F,OAAA8B,eAAJ,GACI9B,MAAA8B,eAAA,CAAsBnB,CAAtB,CAA+B,UAA/B,CAA2C,CAAE,MAAS3B,CAAA+C,SAAA,EAAX,CAA3C,CAGA,CAFA/B,MAAA8B,eAAA,CAAsBmF,CAAtB,CAAwC,UAAxC,CAAoD,CAAE,MAAStG,CAAA,SAAX,CAApD,CAEA,CADAX,MAAA8B,eAAA,CAAsBnB,CAAtB,CAA+B,OAA/B,CAAwC,CAAE,MAAS3B,CAAX,CAAxC,CACA,CAAAgB,MAAA8B,eAAA,CAAsBmF,CAAtB,CAAwC,OAAxC,CAAiD,CAAE,MAASjI,CAAX,CAAjD,CAJJ,CAMA,OAAO2B,EAhtBwB,CAAvB,CAktBT5O,CAltBS,CAktBC,IAltBD,CAqtBZ,KAAAiV,QAAA,CAAe,EACf,KAAAD,YAAA,CAAmB,EACnB,KAAAD,cAAA,CAAqB,EACrB,KAAA0C,cAAA,CAAqB,EACrB,KA9tBuC,IA8tB9BxV,EAAE,CA9tB4B,CA8tBzBqM,EAAE,IAAAP,SAAA7L,OA9tBuB;AA8tBDuM,CAAtC,CAA6CxM,CAA7C,CAA+CqM,CAA/C,CAAkDrM,CAAA,EAAlD,CAEI,GADAwM,CACI,CADI,IAAAV,SAAA,CAAc9L,CAAd,CACJ,CAAAwM,CAAA,WAAiB6C,EAAjB,EAAyB7C,CAAzB,WAA0CG,EAA1C,EAAqDH,CAArD,WAAsE+L,EAA1E,CAAmF,CAC/E,GAAIhJ,CAAA1G,eAAA,CAAqB2D,CAAA7N,KAArB,CAAJ,CACI,KAAMwB,MAAA,CAAM,2BAAN,CAAkC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAlC,CAAsD,IAAtD,CAA2DoG,CAAApG,SAAA,CAAe,CAAA,CAAf,CAA3D,CAAgF,oCAAhF,CAAqHoG,CAAA7N,KAArH,CAAgI,GAAhI,CAAN,CACJ4Q,CAAA,CAAM/C,CAAA7N,KAAN,CAAA,CAAoB6N,CAAAf,MAAA,EAH2D,CAAnF,IAIO,IAAIe,CAAJ,WAAqBG,EAAAC,MAArB,CACHJ,CAAAf,MAAA,EAGA,CAFA,IAAAuH,QAAA5O,KAAA,CAAkBoI,CAAlB,CAEA,CADA,IAAAuG,YAAA,CAAiBvG,CAAAnJ,GAAjB,CACA,CAD6BmJ,CAC7B,CAAA,IAAAsG,cAAA,CAAmBtG,CAAA7N,KAAnB,CAAA,CAAiC6N,CAJ9B,KAKF,IAAIA,CAAJ,WAAqBG,EAAA6H,MAArB,CACD,IAAAgB,cAAA,CAAmBhJ,CAAA7N,KAAnB,CAAA,CAAiC6N,CADhC,KAGA,IAAI,EAAEA,CAAF,WAAmBG,EAAA6H,MAAnB,EAAuChI,CAAvC,WAAwDgM,EAAxD,CAAJ,CACD,KAAMrY,MAAA,CAAM,2BAAN;AAAkC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAlC,CAAsD,IAAtD,CAA2D,IAAA0F,SAAA,CAAc9L,CAAd,CAAAoG,SAAA,CAA0B,CAAA,CAA1B,CAA3D,CAAN,CAGR,MAAO,KAAAmJ,MAAP,CAAoBA,CAhvBmB,CA4vB3C0D,EAAA3B,OAAA,CAA0B4E,QAAQ,CAAC9O,CAAD,CAAUkJ,CAAV,CAAkB6F,CAAlB,CAA4B,CAG1D,IAH0D,IACtDsC,EAAe,IADuC,CAEtDnE,CAFsD,CAGjDtU,EAAE,CAH+C,CAG5CqM,EAAE,IAAA2G,QAAA/S,OAH0C,CAGrB2D,CAArC,CAA0C5D,CAA1C,CAA4CqM,CAA5C,CAA+C,EAAErM,CAAjD,CACIsU,CAEA,CAFQ,IAAAtB,QAAA,CAAahT,CAAb,CAER,CADA4D,CACA,CADMwD,CAAA,CAAQkN,CAAA3V,KAAR,CACN,CAAI2V,CAAAM,SAAJ,EAA8B,IAA9B,GAAsBhR,CAAtB,CACyB,IADzB,GACQ6U,CADR,GAEQA,CAFR,CAEuBnE,CAFvB,EAIIA,CAAAhD,OAAA,CAAa6E,CAAA,CAAWvS,CAAX,CAAiB0Q,CAAAzF,YAAA,CAAkBjL,CAAlB,CAA9B,CAAsD0M,CAAtD,CAA8DlJ,CAA9D,CAER,IAAqB,IAArB,GAAIqR,CAAJ,CAGI,KAFI/X,EAEEA,CAFIP,KAAA,CAAM,0CAAN,CAAiD,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAjD,CAAqE,IAArE,CAA0EqS,CAA1E,CAEJ/X,CADNA,CAAA,QACMA,CADW4P,CACX5P,CAAAA,CAAN,CAEJ,MAAO4P,EAjBmD,CA2B9D2C,EAAA9C,UAAA,CAA6BqG,QAAQ,CAACpP,CAAD,CAAU,CAC3C,IAD2C,IAClCwI,EAAE,CADgC,CAC7B5P,EAAE,CAD2B,CACxBqM,EAAE,IAAA2G,QAAA/S,OADsB,CACDqU,CADC,CACM1Q,CAAjD,CAAsD5D,CAAtD,CAAwDqM,CAAxD,CAA2D,EAAErM,CAA7D,CAAgE,CAC5DsU,CAAA,CAAQ,IAAAtB,QAAA,CAAahT,CAAb,CACR4D,EAAA,CAAMwD,CAAA,CAAQkN,CAAA3V,KAAR,CACN,IAAI2V,CAAAM,SAAJ,EAA8B,IAA9B;AAAsBhR,CAAtB,CACG,KAAMzD,MAAA,CAAM,0CAAN,CAAiD,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAjD,CAAqE,IAArE,CAA0EkO,CAA1E,CAAN,CAEC1E,CAAA,EAAK0E,CAAAnE,UAAA,CAAgBvM,CAAhB,CAAqBwD,CAArB,CANmD,CAQhE,MAAOwI,EAToC,CA8D/CqD,EAAAzB,OAAA,CAA0BkH,QAAQ,CAACpI,CAAD,CAASrQ,CAAT,CAAiB0Y,CAAjB,CAAqC,CAC7C,QAAtB,GAAI,MAAO1Y,EAAX,GACIA,CADJ,CACc,EADd,CAKA,KANmE,IAG/D2Y,EAAQtI,CAAAvF,OAHuD,CAI/DtC,EAAM,IAAK,IAAA8G,MAJoD,CAK/D3E,CAL+D,CAK1DhM,CAL0D,CAKhDyE,CACnB,CAAOiN,CAAAvF,OAAP,CAAuB6N,CAAvB,CAA6B3Y,CAA7B,EAAoD,EAApD,GAAwCA,CAAxC,EAA8E,CAA9E,CAAyDqQ,CAAAJ,UAAA,EAAzD,CAAA,CAAkF,CAC9EtF,CAAA,CAAM0F,CAAAzF,aAAA,EACNjM,EAAA,CAAWgM,CAAX,CAAiB,CACjBvH,EAAA,CAAKuH,CAAL,GAAa,CACb,IAAIhM,CAAJ,GAAiBb,CAAAG,WAAAK,SAAjB,CAA+C,CAC3C,GAAI8E,CAAJ,GAAWsV,CAAX,CACI,KAAMxY,MAAA,CAAM,kCAAN,CAAyC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAzC,CAA6D,IAA7D,CAAkE/C,CAAlE,CAAqE,IAArE,EAA2EsV,CAAA,CAAqBA,CAArB,CAAwC,WAAxC,CAAsD,aAAjI,EAAgJ,GAAhJ,CAAN,CACJ,KAH2C,CAK/C,GAAMrE,CAAN,CAAc,IAAAvB,YAAA,CAAiB1P,CAAjB,CAAd,CAwBIiR,CAAAI,SAAJ,EAAuB,CAAAJ,CAAArQ,QAAA,OAAvB,CACIwE,CAAA,CAAI6L,CAAA3V,KAAJ,CAAAyF,KAAA,CAAqBkQ,CAAA9C,OAAA,CAAa5S,CAAb;AAAuB0R,CAAvB,CAArB,CADJ,CAEWgE,CAAAK,IAAJ,EACCkE,CACJ,CADavE,CAAA9C,OAAA,CAAa5S,CAAb,CAAuB0R,CAAvB,CACb,CAAA7H,CAAA,CAAI6L,CAAA3V,KAAJ,CAAAyW,IAAA,CAAoByD,CAAA,CAAO,CAAP,CAApB,CAA+BA,CAAA,CAAO,CAAP,CAA/B,CAFG,GAIHpQ,CAAA,CAAI6L,CAAA3V,KAAJ,CACA,CADkB2V,CAAA9C,OAAA,CAAa5S,CAAb,CAAuB0R,CAAvB,CAClB,CAAIgE,CAAAmB,MAAJ,GACQC,CAGJ,CAHmBjN,CAAA,CAAI6L,CAAAmB,MAAA9W,KAAJ,CAGnB,CAFqB,IAErB,GAFI+W,CAEJ,EAF6BA,CAE7B,GAF8CpB,CAAA3V,KAE9C,GADI8J,CAAA,CAAIiN,CAAJ,CACJ,CADwB,IACxB,EAAAjN,CAAA,CAAI6L,CAAAmB,MAAA9W,KAAJ,CAAA,CAAwB2V,CAAA3V,KAJ5B,CALG,CA1BP,KAEI,QAAQC,CAAR,EACI,KAAKb,CAAAG,WAAAC,OAAL,CACImS,CAAAzF,aAAA,EACA,MACJ,MAAK9M,CAAAG,WAAAM,OAAL,CACI8R,CAAAvF,OAAA,EAAiB,CACjB,MACJ,MAAKhN,CAAAG,WAAAE,OAAL,CACIkS,CAAAvF,OAAA,EAAiB,CACjB,MACJ,MAAKhN,CAAAG,WAAAG,OAAL,CACQqP,CAAAA,CAAM4C,CAAAzF,aAAA,EACVyF,EAAAvF,OAAA,EAAiB2C,CACjB,MACJ,MAAK3P,CAAAG,WAAAI,WAAL,CACI,IAAA,CAAOmM,CAAA,CAAiBpH,CAAjB,CAAqBiN,CAArB,CAAP,CAAA,EACA,KACJ,SACI,KAAMnQ,MAAA,CAAM,sCAAN,CAA6CkD,CAA7C,CAAgD,MAAhD,CAAuD,IAAA+C,SAAA,CAAc,CAAA,CAAd,CAAvD;AAA2E,WAA3E,CAAuFxH,CAAvF,CAAN,CAlBR,CAX0E,CAkDzEoB,CAAAA,CAAE,CAAX,KAAcqM,CAAd,CAAgB,IAAA2G,QAAA/S,OAAhB,CAAqCD,CAArC,CAAuCqM,CAAvC,CAA0C,EAAErM,CAA5C,CAEI,GADAsU,CACI,CADI,IAAAtB,QAAA,CAAahT,CAAb,CACJ,CAAoB,IAApB,GAAAyI,CAAA,CAAI6L,CAAA3V,KAAJ,CAAJ,CACI,GAAoB,QAApB,GAAI,IAAAiN,OAAJ,CACInD,CAAA,CAAI6L,CAAA3V,KAAJ,CAAA,CAAkB2V,CAAAzV,aADtB,KAEO,CAAA,GAAIyV,CAAAM,SAAJ,CAGH,KAFIlU,EAEEA,CAFIP,KAAA,CAAM,0CAAN,CAAmD,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAnD,CAAyE,IAAzE,CAAgFkO,CAAA3V,KAAhF,CAEJ+B,CADNA,CAAA,QACMA,CADW+H,CACX/H,CAAAA,CAAN,CACO3C,CAAAuB,iBAAJ,EAAwD,IAAxD,GAAiCgV,CAAAzV,aAAjC,GACH4J,CAAA,CAAI6L,CAAA3V,KAAJ,CADG,CACe2V,CAAAzV,aADf,CAJA,CAQf,MAAO4J,EArE4D,CA4EvEyB,EAAAyC,QAAA,CAAkBA,CAkBlB,KAAIC,EAAQA,QAAQ,CAAC3B,CAAD,CAAU7D,CAAV,CAAmB+B,CAAnB,CAAyB2P,CAAzB,CAAkC1P,CAAlC,CAAwCzK,CAAxC,CAA8C0E,CAA9C,CAAkDY,CAAlD,CAA2DwR,CAA3D,CAAkE7J,CAAlE,CAA0E,CAC1FZ,CAAAa,KAAA,CAAO,IAAP,CAAaZ,CAAb,CAAsB7D,CAAtB,CAA+BzI,CAA/B,CAKA,KAAA6M,UAAA,CAAiB,eAOjB,KAAAoJ,SAAA,CAAyB,UAAzB,GAAgBzL,CAOhB,KAAAuL,SAAA,CAAyB,UAAzB,GAAgBvL,CAOhB;IAAAwL,IAAA,CAAoB,KAApB,GAAWxL,CAQX,KAAA4P,QAAA,CAAeD,CAAf,EAA0B,IAQ1B,KAAA1P,KAAA,CAAYA,CAOZ,KAAAkF,aAAA,CAAoB,IAOpB,KAAAjL,GAAA,CAAUA,CAQV,KAAAY,QAAA,CAAeA,CAAf,EAA0B,EAO1B,KAAApF,aAAA,CAAoB,IAOpB,KAAA4W,MAAA,CAAaA,CAAb,EAAsB,IAOtB,KAAA7J,OAAA,CAAcA,CAAd,EAAwB,QAOxB,KAAAiB,aAAA,CAAoB,IAAAlO,KAepB,KAAAqa,WAAA,CARA,IAAAC,QAQA,CARe,IAWX,EAAA,IAAAhO,QAAAhH,QAAA,yBAAJ,EAA0D,IAA1D,WAA0E0I,EAAAmJ,eAA1E,GACI,IAAAnX,KADJ,CACgBZ,CAAAwB,KAAA+B,YAAA,CAA0B,IAAA3C,KAA1B,CADhB,CA/G0F,CAA9F,CAuHIua,EAAiBtM,CAAA/H,UAAjBqU,CAAmClN,MAAAC,OAAA,CAAcjB,CAAAnG,UAAd,CAOvCqU,EAAAzN,MAAA,CAAuB0N,QAAQ,EAAG,CAC9B,IAAAF,QAAA,CAAe,IAAI5K,CAAJ,CAAY,IAAAjF,KAAZ,CAAuB,IAAAkF,aAAvB,CAA0C,CAAA,CAA1C,CAAiD,IAAA1C,OAAjD,CAA8D,IAAAjN,KAA9D,CACX,KAAAgW,IAAJ,GACI,IAAAqE,WADJ;AACsB,IAAI3K,CAAJ,CAAY,IAAA0K,QAAZ,CAA0Bha,IAAAA,EAA1B,CAAqC,CAAA,CAArC,CAA2C,IAAA6M,OAA3C,CAAwD,IAAAjN,KAAxD,CADtB,CAKoB,SAApB,GAAI,IAAAiN,OAAJ,EAAiC,IAAA8I,SAAjC,EAAmD,IAAAC,IAAnD,CAI4C,WAJ5C,GAIS,MAAO,KAAA1Q,QAAA,CAAa,SAAb,CAJhB,GAKI,IAAApF,aALJ,CAKwB,IAAAgQ,YAAA,CAAiB,IAAA5K,QAAA,CAAa,SAAb,CAAjB,CALxB,EACI,IAAApF,aADJ,CACwBwP,CAAAK,kBAAA,CAA0B,IAAAtF,KAA1B,CARM,CAuBlC8P,EAAArK,YAAA,CAA6BuK,QAAQ,CAACjW,CAAD,CAAQkW,CAAR,CAAsB,CAGvDtK,QAASA,EAAI,CAACnL,CAAD,CAAM6E,CAAN,CAAW,CACpB,KAAMtI,MAAA,CAAM,oBAAN,CAA2B6O,CAAA5I,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,WAA/C,CAA2D4I,CAAA5F,KAAAzK,KAA3D,CAA0E,IAA1E,CAA+EiF,CAA/E,CAAmF,IAAnF,CAAwF6E,CAAxF,CAA4F,GAA5F,CAAN,CADoB,CAFxB4Q,CAAA,CAAeA,CAAf,EAA+B,CAAA,CAC/B,KAAIrK,EAAO,IAIX,IAAc,IAAd,GAAI7L,CAAJ,CAKI,MAJI,KAAAyR,SAIG,EAHH7F,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,UAAnB,CAGG,CAFa,QAEb,GAFH,IAAAyI,OAEG,EAFyB,IAAAxC,KAEzB;AAFuCrL,CAAAW,MAAA,QAEvC,EADHqQ,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,oDAAnB,CACG,CAAA,IAEX,KAAInD,CACJ,IAAI,IAAA0U,SAAJ,EAAsB2E,CAAAA,CAAtB,CAAoC,CAC3BnV,KAAAC,QAAA,CAAchB,CAAd,CAAL,GACIA,CADJ,CACY,CAACA,CAAD,CADZ,CAEA,KAAImW,EAAM,EACV,KAAKtZ,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACIsZ,CAAAlV,KAAA,CAAS,IAAA6U,QAAApK,YAAA,CAAyB1L,CAAA,CAAMnD,CAAN,CAAzB,CAAT,CACJ,OAAOsZ,EANyB,CAQpC,GAAI,IAAA3E,IAAJ,EAAiB0E,CAAAA,CAAjB,CAA+B,CAC3B,GAAMlW,CAAN,WAAuBpF,EAAAgW,IAAvB,CAQI,MAAO5Q,EANDA,EAAN,WAAuB6I,OAAvB,EACI+C,CAAA,CAAK,MAAO5L,EAAZ,CACK,mDADL,CAGJ,OAAO,KAAIpF,CAAAgW,IAAJ,CAAiB,IAAjB,CAAuB5Q,CAAvB,CAPgB,CAa1BuR,CAAA,IAAAA,SAAL,EAAsBxQ,KAAAC,QAAA,CAAchB,CAAd,CAAtB,EACI4L,CAAA,CAAK,MAAO5L,EAAZ,CAAmB,mBAAnB,CAEJ,OAAO,KAAA8V,QAAApK,YAAA,CAAyB1L,CAAzB,CAtCgD,CAgD3D+V,EAAAK,gBAAA,CAAiCC,QAAQ,CAACrW,CAAD;AAAQiE,CAAR,CAAiB,CACtD,GAAoB,QAApB,GAAI,IAAAwE,OAAJ,CACI,MAAkB,KAAlB,GAAQzI,CACZ,IAAI,IAAAsS,MAAJ,EAAkBrO,CAAA,CAAQ,IAAAqO,MAAA9W,KAAR,CAAlB,GAA+C,IAAAA,KAA/C,CACI,MAAO,CAAA,CACX,QAAQ,IAAAyK,KAAR,EACI,KAAKrL,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,MAAiB,EAAjB,GAAOyE,CAEX,MAAKpF,CAAAW,MAAA,MAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,SAAL,CACA,KAAKX,CAAAW,MAAA,OAAL,CACA,KAAKX,CAAAW,MAAA,QAAL,CACI,MAAqB,EAArB,GAAOyE,CAAAkH,IAAP,EAAyC,CAAzC,GAA0BlH,CAAAmH,KAE9B,MAAKvM,CAAAW,MAAA,KAAL,CACI,MAAOyE,EAEX,MAAKpF,CAAAW,MAAA,CAAe,OAAf,CAAL,CACA,KAAKX,CAAAW,MAAA,CAAe,QAAf,CAAL,CACI,MAAiB,EAAjB,GAAOyE,CAEX,MAAKpF,CAAAW,MAAA,OAAL,CACI,MAAsB,EAAtB,CAAOyE,CAAAlD,OAEX,MAAKlC,CAAAW,MAAA,MAAL,CACI,MAA2B,EAA3B;AAAOyE,CAAA+M,UAAA,EAEX,MAAKnS,CAAAW,MAAA,CAAe,MAAf,CAAL,CACI,MAAiB,EAAjB,GAAOyE,CAEX,MAAKpF,CAAAW,MAAA,QAAL,CACI,MAAiB,KAAjB,GAAOyE,CACX,SACI,MAAO,CAAA,CAlCf,CALsD,CAoD1D+V,EAAA5H,OAAA,CAAwBmI,QAAQ,CAACtW,CAAD,CAAQmN,CAAR,CAAgBlJ,CAAhB,CAAyB,CACrD,GAAkB,IAAlB,GAAI,IAAAgC,KAAJ,EAA+C,QAA/C,GAA0B,MAAO,KAAAA,KAAjC,CACI,KAAMjJ,MAAA,CAAM,gCAAN,CAAuC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAvC,CAA2D,IAA3D,CAAgE,IAAAgD,KAAhE,CAAN,CACJ,GAAc,IAAd,GAAIjG,CAAJ,EAAuB,IAAAuR,SAAvB,EAAwD,CAAxD,EAAwCvR,CAAAlD,OAAxC,CACI,MAAOqQ,EACX,IAAI,CACA,GAAI,IAAAoE,SAAJ,CAAmB,CACf,IAAI1U,CAGJ,IAAI,IAAAiE,QAAA,OAAJ,EAA0F,CAA1F,EAA8BlG,CAAAU,oBAAA+P,QAAA,CAAqC,IAAApF,KAAAxK,SAArC,CAA9B,CAA6F,CAIzF0R,CAAAE,cAAA,CAAsB,IAAAnN,GAAtB,EAAiC,CAAjC,CAAsCtF,CAAAG,WAAAG,OAAtC,CACAiS,EAAAoJ,eAAA,CAAsBpJ,CAAAvF,OAAtB,EAAuC,CAAvC,CACA,KAAI6N,EAAQtI,CAAAvF,OACZ;IAAK/K,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACI,IAAAiZ,QAAA7I,YAAA,CAAyB,IAAA/M,GAAzB,CAAkCF,CAAA,CAAMnD,CAAN,CAAlC,CAA4CsQ,CAA5C,CARqF,KASrF5C,EAAM4C,CAAAvF,OAAN2C,CAAoBkL,CATiE,CAUrFe,EAAY9b,CAAAiS,kBAAA,CAA6BpC,CAA7B,CAChB,IAAgB,CAAhB,CAAIiM,CAAJ,CAAmB,CACf,IAAIC,EAAWtJ,CAAAlE,MAAA,CAAawM,CAAb,CAAoBtI,CAAAvF,OAApB,CAAf,CACA6N,EAAAA,CAAAA,EAASe,CAATf,CAAmB,CAAnBA,CACAtI,EAAAvF,OAAA,CAAgB6N,CAChBtI,EAAAa,OAAA,CAAcyI,CAAd,CAJe,CAMnBtJ,CAAAE,cAAA,CAAqB9C,CAArB,CAA0BkL,CAA1B,CAAgCe,CAAhC,CAjByF,CAA7F,IAqBI,KAAK3Z,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACIsQ,CAAAE,cAAA,CAAsB,IAAAnN,GAAtB,EAAiC,CAAjC,CAAsC,IAAA+F,KAAAxK,SAAtC,CACA,CAAA,IAAAqa,QAAA7I,YAAA,CAAyB,IAAA/M,GAAzB,CAAkCF,CAAA,CAAMnD,CAAN,CAAlC,CAA4CsQ,CAA5C,CA3BO,CAAnB,IA6BW,KAAAqE,IAAJ,CAEHxR,CAAA0Q,QAAA,CAAc,QAAQ,CAACjQ,CAAD,CAAMoJ,CAAN,CAAW6M,CAAX,CAAc,CAE5B5Z,CAAAA,CACApC,CAAAiS,kBAAA,CAA8B,CAA9B,CAAwC,IAAAiJ,QAAAna,SAAxC,CADAqB,CAEA,IAAA+Y,WAAAtJ,gBAAA,CAAgC,CAAhC,CAAmC1C,CAAnC,CAFA/M,CAGApC,CAAAiS,kBAAA,CAA8B,EAA9B,CAAwC,IAAA1G,KAAAxK,SAAxC,CAHAqB,CAIA,IAAAgZ,QAAAvJ,gBAAA,CAA6B,CAA7B;AAAgC9L,CAAhC,CAGJ0M,EAAAE,cAAA,CAAsB,IAAAnN,GAAtB,EAAiC,CAAjC,CAAsCtF,CAAAG,WAAAG,OAAtC,CACAiS,EAAAE,cAAA,CAAqBvQ,CAArB,CAGAqQ,EAAAE,cAAA,CAAsB,CAAtB,CAAgC,IAAAuI,QAAAna,SAAhC,CACA,KAAAoa,WAAA5I,YAAA,CAA4B,CAA5B,CAA+BpD,CAA/B,CAAoCsD,CAApC,CACAA,EAAAE,cAAA,CAAsB,EAAtB,CAAgC,IAAApH,KAAAxK,SAAhC,CACA,KAAAqa,QAAA7I,YAAA,CAAyB,CAAzB,CAA4BxM,CAA5B,CAAiC0M,CAAjC,CAhBgC,CAApC,CAiBG,IAjBH,CAFG,CAqBC,IAAAiJ,gBAAA,CAAqBpW,CAArB,CAA4BiE,CAA5B,CArBD,GAsBCkJ,CAAAE,cAAA,CAAsB,IAAAnN,GAAtB,EAAiC,CAAjC,CAAsC,IAAA+F,KAAAxK,SAAtC,CACA,CAAA,IAAAqa,QAAA7I,YAAA,CAAyB,IAAA/M,GAAzB,CAAkCF,CAAlC,CAAyCmN,CAAzC,CAvBD,CA9BP,CAwDF,MAAOpQ,CAAP,CAAU,CACR,KAAMC,MAAA,CAAM,oBAAN,CAA2B,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDjD,CAApD,CAA0D,IAA1D,CAA+DjD,CAA/D,CAAiE,GAAjE,CAAN,CADQ,CAGZ,MAAOoQ,EAhE8C,CA0EzD4I,EAAA/I,UAAA,CAA2B2J,QAAQ,CAAC3W,CAAD,CAAQiE,CAAR,CAAiB,CAChDjE,CAAA,CAAQ,IAAA0L,YAAA,CAAiB1L,CAAjB,CACR,IAAkB,IAAlB,GAAI,IAAAiG,KAAJ,EAA+C,QAA/C;AAA0B,MAAO,KAAAA,KAAjC,CACI,KAAMjJ,MAAA,CAAM,gCAAN,CAAuC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAAvC,CAA2D,IAA3D,CAAgE,IAAAgD,KAAhE,CAAN,CACJ,GAAc,IAAd,GAAIjG,CAAJ,EAAuB,IAAAuR,SAAvB,EAAwD,CAAxD,EAAwCvR,CAAAlD,OAAxC,CACI,MAAO,EACX,KAAI2P,EAAI,CACR,IAAI,CACA,GAAI,IAAA8E,SAAJ,CAAmB,CAAA,IACX1U,CADW,CACR+Z,CACP,IAAI,IAAA9V,QAAA,OAAJ,EAA0F,CAA1F,EAA8BlG,CAAAU,oBAAA+P,QAAA,CAAqC,IAAApF,KAAAxK,SAArC,CAA9B,CAA6F,CACzFgR,CAAA,EAAK/R,CAAAiS,kBAAA,CAA8B,IAAAzM,GAA9B,EAAyC,CAAzC,CAA8CtF,CAAAG,WAAAG,OAA9C,CAEL,KAAK2B,CAAL,CADA+Z,CACA,CADK,CACL,CAAU/Z,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACI+Z,CAAA,EAAM,IAAAd,QAAAvJ,gBAAA,CAA6B,IAAArM,GAA7B,CAAsCF,CAAA,CAAMnD,CAAN,CAAtC,CACV4P,EAAA,EAAK/R,CAAAiS,kBAAA,CAA6BiK,CAA7B,CACLnK,EAAA,EAAKmK,CANoF,CAA7F,IAQI,KAAK/Z,CAAL,CAAO,CAAP,CAAUA,CAAV,CAAYmD,CAAAlD,OAAZ,CAA0BD,CAAA,EAA1B,CACI4P,CACA,EADK/R,CAAAiS,kBAAA,CAA8B,IAAAzM,GAA9B,EAAyC,CAAzC,CAA8C,IAAA+F,KAAAxK,SAA9C,CACL,CAAAgR,CAAA;AAAK,IAAAqJ,QAAAvJ,gBAAA,CAA6B,IAAArM,GAA7B,CAAsCF,CAAA,CAAMnD,CAAN,CAAtC,CAZE,CAAnB,IAcW,KAAA2U,IAAJ,CAEHxR,CAAA0Q,QAAA,CAAc,QAAQ,CAACjQ,CAAD,CAAMoJ,CAAN,CAAW6M,CAAX,CAAc,CAE5B5Z,CAAAA,CACApC,CAAAiS,kBAAA,CAA8B,CAA9B,CAAwC,IAAAiJ,QAAAna,SAAxC,CADAqB,CAEA,IAAA+Y,WAAAtJ,gBAAA,CAAgC,CAAhC,CAAmC1C,CAAnC,CAFA/M,CAGApC,CAAAiS,kBAAA,CAA8B,EAA9B,CAAwC,IAAA1G,KAAAxK,SAAxC,CAHAqB,CAIA,IAAAgZ,QAAAvJ,gBAAA,CAA6B,CAA7B,CAAgC9L,CAAhC,CAEJgM,EAAA,EAAK/R,CAAAiS,kBAAA,CAA8B,IAAAzM,GAA9B,EAAyC,CAAzC,CAA8CtF,CAAAG,WAAAG,OAA9C,CACLuR,EAAA,EAAK/R,CAAAiS,kBAAA,CAA6B7P,CAA7B,CACL2P,EAAA,EAAK3P,CAV2B,CAApC,CAWG,IAXH,CAFG,CAeC,IAAAsZ,gBAAA,CAAqBpW,CAArB,CAA4BiE,CAA5B,CAfD,GAgBCwI,CACA,EADK/R,CAAAiS,kBAAA,CAA8B,IAAAzM,GAA9B,EAAyC,CAAzC,CAA8C,IAAA+F,KAAAxK,SAA9C,CACL,CAAAgR,CAAA,EAAK,IAAAqJ,QAAAvJ,gBAAA,CAA6B,IAAArM,GAA7B,CAAsCF,CAAtC,CAjBN,CAfP,CAmCF,MAAOjD,CAAP,CAAU,CACR,KAAMC,MAAA,CAAM,oBAAN;AAA2B,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAA3B,CAA+C,IAA/C,CAAoDjD,CAApD,CAA0D,IAA1D,CAA+DjD,CAA/D,CAAiE,GAAjE,CAAN,CADQ,CAGZ,MAAO0P,EA7CyC,CA0DpDsJ,EAAA1H,OAAA,CAAwBwI,QAAQ,CAACpb,CAAD,CAAW0R,CAAX,CAAmB+I,CAAnB,CAAiC,CAU7D,GAJIY,EAAEtF,CAAA,IAAAA,IAAFsF,EAAcrb,CAAdqb,EAA0B,IAAA7Q,KAAAxK,SAA1Bqb,EACEZ,CAAAA,CADFY,EACkB,IAAAvF,SADlBuF,EACmC,IAAAhW,QAAA,OADnCgW,EAECrb,CAFDqb,EAEalc,CAAAG,WAAAG,OAFb4b,EAGC,IAAAtF,IAHDsF,EAGarb,CAHbqb,EAGyBlc,CAAAG,WAAAG,OAHzB4b,CAIJ,CACI,KAAM9Z,MAAA,CAAM,8BAAN,CAAqC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DxH,CAA9D,CAAuE,IAAvE,CAA4E,IAAAwK,KAAAxK,SAA5E,CAA+F,YAA/F,CAAN,CAGJ,GAAIA,CAAJ,EAAgBb,CAAAG,WAAAG,OAAhB,EAA8C,IAAAqW,SAA9C,EAA+D,IAAAzQ,QAAA,OAA/D,EAAqJ,CAArJ,EAAyFlG,CAAAU,oBAAA+P,QAAA,CAAqC,IAAApF,KAAAxK,SAArC,CAAzF,EACSya,CAAAA,CADT,CACuB,CACfhH,CAAA,CAAS/B,CAAAzF,aAAA,EACTwH,EAAA,CAAS/B,CAAAvF,OAAT,CAAyBsH,CAEzB,KADIjD,CACJ,CADa,EACb,CAAOkB,CAAAvF,OAAP,CAAuBsH,CAAvB,CAAA,CACIjD,CAAAhL,KAAA,CAAY,IAAAoN,OAAA,CAAY,IAAApI,KAAAxK,SAAZ;AAAgC0R,CAAhC,CAAwC,CAAA,CAAxC,CAAZ,CACJ,OAAOlB,EANQ,CAYvB,GAAI,IAAAuF,IAAJ,CAAc,CAEV,IAAI3H,EAAMqB,CAAAK,kBAAA,CAA0B,IAAAqK,QAA1B,CACV5V,EAAA,CAAQkL,CAAAK,kBAAA,CAA0B,IAAAtF,KAA1B,CAGRiJ,EAAA,CAAS/B,CAAAzF,aAAA,EACT,IAAIyF,CAAAJ,UAAA,EAAJ,CAAyBmC,CAAzB,CACI,KAAMlS,MAAA,CAAM,8BAAN,CAAqC,IAAAiG,SAAA,CAAc,CAAA,CAAd,CAArC,CAAyD,IAAzD,CAA8DiM,CAA9D,CAAqE,yBAArE,CAA+F/B,CAAAJ,UAAA,EAA/F,CAAN,CAGJ,IAAIgK,EAAS5J,CAAAgC,MAAA,EACb4H,EAAA3H,MAAA,CAAe2H,CAAAnP,OAAf,CAA+BsH,CAG/B,KAFA/B,CAAAvF,OAEA,EAFiBsH,CAEjB,CAA4B,CAA5B,CAAO6H,CAAAhK,UAAA,EAAP,CAAA,CAII,GAHItF,CAGA,CAHMsP,CAAArP,aAAA,EAGN,CAFJjM,CAEI,CAFOgM,CAEP,CAFa,CAEb,CADKA,CACL,IADa,CACb,CAAO,CAAP,GAAAvH,CAAJ,CACI2J,CAAA,CAAM,IAAAgM,WAAAxH,OAAA,CAAuB0I,CAAvB,CAA+Btb,CAA/B,CAAyCyE,CAAzC,CADV,KAEO,IAAW,CAAX,GAAIA,CAAJ,CACHF,CAAA,CAAQ,IAAA8V,QAAAzH,OAAA,CAAoB0I,CAApB,CAA4Btb,CAA5B,CAAsCyE,CAAtC,CADL,KAGH,MAAMlD,MAAA,CAAM,kDAAN,CAAN;AAIR,MAAO,CAAC6M,CAAD,CAAM7J,CAAN,CA5BG,CAgCd,MAAO,KAAA8V,QAAAzH,OAAA,CAAoBlB,CAApB,CAA4B1R,CAA5B,CAAsC,IAAAyE,GAAtC,CA3DsD,CAkEjE6G,EAAAyC,QAAAC,MAAA,CAAwBA,CAepBkJ,EAAAA,CAAiBA,QAAQ,CAAC7K,CAAD,CAAU7D,CAAV,CAAmB+B,CAAnB,CAAyBC,CAAzB,CAA+BzK,CAA/B,CAAqC0E,CAArC,CAAyCY,CAAzC,CAAkD,CAC3E2I,CAAAf,KAAA,CAAW,IAAX,CAAiBZ,CAAjB,CAA0B7D,CAA1B,CAAmC+B,CAAnC,CAAyD,IAAzD,CAA+DC,CAA/D,CAAqEzK,CAArE,CAA2E0E,CAA3E,CAA+EY,CAA/E,CAD2E,CAY/E6R,EAAAjR,UAAA,CAA2BmH,MAAAC,OAAA,CAAcW,CAAA/H,UAAd,CAM3BqF,EAAAyC,QAAAmJ,eAAA,CAAiCA,CA0BjC5L,EAAAyC,QAAA6H,MAAA,CAfYA,QAAQ,CAACvJ,CAAD,CAAU7D,CAAV,CAAmBzI,CAAnB,CAAyB,CACzCqM,CAAAa,KAAA,CAAO,IAAP,CAAaZ,CAAb,CAAsB7D,CAAtB,CAA+BzI,CAA/B,CAOA,KAAA4K,OAAA,CAAc,EAR2B,CA4B7C,KAAI8F,EAAOA,QAAQ,CAACpE,CAAD,CAAUrD,CAAV,CAAkBjJ,CAAlB,CAAwBsF,CAAxB,CAAiC2H,CAAjC,CAAyC,CACxDD,CAAAE,KAAA,CAAe,IAAf,CAAqBZ,CAArB,CAA8BrD,CAA9B,CAAsCjJ,CAAtC,CAA4CsF,CAA5C,CAAqD2H,CAArD,CAKA,KAAAJ,UAAA,CAAiB,MAOjB,KAAAgI,OAAA,CAAc,IAb0C,CAuB5DnE,EAAAkE,QAAA,CAAe4G,QAAQ,CAACxQ,CAAD,CAAMxG,CAAN,CAAa,CAEhC,IADA,IAAI+K,EAAOlC,MAAAkC,KAAA,CAAYvE,CAAZ,CAAX,CACS3J,EAAE,CADX,CACcgN,CAAd,CAAmBhN,CAAnB,CAAqBkO,CAAAjO,OAArB,CAAkC,EAAED,CAApC,CACI,GAAI2J,CAAA,CAAIqD,CAAJ,CAAUkB,CAAA,CAAKlO,CAAL,CAAV,CAAJ,GAA2BmD,CAA3B,CACI,MAAO6J,EACf,OAAO,KALyB,CAoBpCvB,EARoB4D,CAAAxK,UAQpB4G,CARqCO,MAAAC,OAAA,CAAcN,CAAA9G,UAAd,CAQrC4G,OAAA;AAAsB2O,QAAQ,CAACjH,CAAD,CAAU,CACpC,GAAI,IAAAK,OAAJ,EAAoBL,CAAAA,CAApB,CACI,MAAO,KAAAK,OACP7J,EAAAA,CAAM,IAAI5L,CAAAyR,QAAAH,KAEd,KAFA,IACID,EAAS,IAAAlD,YAAA,CAAiBmD,CAAAC,MAAjB,CADb,CAEStP,EAAE,CAFX,CAEcqM,EAAE+C,CAAAnP,OAAhB,CAA+BD,CAA/B,CAAiCqM,CAAjC,CAAoC,EAAErM,CAAtC,CACI2J,CAAA,CAAIyF,CAAA,CAAOpP,CAAP,CAAA,KAAJ,CAAA,CAAyBoP,CAAA,CAAOpP,CAAP,CAAA,GACzBgM,OAAA8B,eAAJ,EACI9B,MAAA8B,eAAA,CAAsBnE,CAAtB,CAA2B,UAA3B,CAAuC,CACnC,MAAS,IAAAoE,SAAA,EAD0B,CAEnC,WAAc,CAAA,CAFqB,CAAvC,CAIJ,OAAO,KAAAyF,OAAP,CAAqB7J,CAZe,CAmBxCO,EAAAmF,KAAA,CAAeA,CAYXC,EAAAA,CAAQA,QAAQ,CAACrE,CAAD,CAAUtB,CAAV,CAAehL,CAAf,CAAqB0E,CAArB,CAAyB,CACzC2H,CAAAa,KAAA,CAAO,IAAP,CAAaZ,CAAb,CAAsBtB,CAAtB,CAA2BhL,CAA3B,CAKA,KAAA6M,UAAA,CAAiB,YAOjB,KAAAnI,GAAA,CAAUA,CAb+B,CAiB7CiM,EAAAzK,UAAA,CAAkBmH,MAAAC,OAAA,CAAcjB,CAAAnG,UAAd,CAMlBqF,EAAAmF,KAAAC,MAAA,CAAqBA,CAWrB,KAAIkJ,EAAYA,QAAQ,CAACvN,CAAD,CAAUrD,CAAV,CAAkBjJ,CAAlB,CAAwB2V,CAAxB,CAA+B,CACnDtJ,CAAAa,KAAA,CAAO,IAAP,CAAaZ,CAAb,CAAsBrD,CAAtB,CAA8BjJ,CAA9B,CAOA,KAAA2V,MAAA,CAAaA,CARsC,CAYvDkE,EAAA3T,UAAA,CAAsBmH,MAAAC,OAAA,CAAcjB,CAAAnG,UAAd,CAMtBqF;CAAAsO,UAAA,CAAoBA,CAYpB,KAAID,EAAUA,QAAQ,CAACtN,CAAD,CAAUoP,CAAV,CAAgB1b,CAAhB,CAAsBsF,CAAtB,CAA+B,CACjD0H,CAAAE,KAAA,CAAe,IAAf,CAAqBZ,CAArB,CAA8BoP,CAA9B,CAAoC1b,CAApC,CAA0CsF,CAA1C,CAKA,KAAAuH,UAAA,CAAiB,SAMjB,KAAA+D,MAAA,CAAa,IAZoC,CA6BrD9D,EAVuB8M,CAAA1T,UAUvB4G,CAV2CO,MAAAC,OAAA,CAAcN,CAAA9G,UAAd,CAU3C4G,OAAA,CAAyB6O,QAAQ,CAACnH,CAAD,CAAU,CACvC,MAAI,KAAA5D,MAAJ,EAAmB4D,CAAAA,CAAnB,CACW,IAAA5D,MADX,CAIO,IAAAA,MAJP,CAIqB,QAAQ,CAACxR,CAAD,CAAWiN,CAAX,CAAc,CAuDvC,IA7CA,IAAIuN,EAAUA,QAAQ,CAACgC,CAAD,CAAU,CAC5Bxc,CAAAyR,QAAA+I,QAAA1M,KAAA,CAA8B,IAA9B,CAQA,KAAA0O,QAAA,CAAeA,CAAf,EAA0B,QAAQ,CAAC5b,CAAD,CAAO8J,CAAP,CAAYlI,CAAZ,CAAsB,CAIpDia,UAAA,CAAWja,CAAAka,KAAA,CAAc,IAAd,CAAoBta,KAAA,CAAM,4EAAN,CAApB,CAAX,CAAqH,CAArH,CAJoD,CAT5B,CAAhC,CAqBIua,EAAmBnC,CAAA1T,UAAnB6V,CAAuC1O,MAAAC,OAAA,CAAclO,CAAAyR,QAAA+I,QAAA1T,UAAd,CArB3C,CA4CI8V,EAAM3P,CAAAkB,YAAA,CAAcnO,CAAAmM,QAAAqO,QAAAqC,UAAd,CA5CV;AA6CS5a,EAAE,CAAX,CAAcA,CAAd,CAAgB2a,CAAA1a,OAAhB,CAA4BD,CAAA,EAA5B,CACK,SAAQ,CAACqI,CAAD,CAAS,CAGdqS,CAAA,CAAiBrS,CAAA1J,KAAjB,CAAA,CAAgC,QAAQ,CAACkc,CAAD,CAAMta,CAAN,CAAgB,CACpD,GAAI,CACA,GAAI,CAEAsa,CAAA,CAAMxS,CAAAyS,oBAAAvL,MAAAiC,OAAA,CAAwC3T,CAAAsR,KAAA,CAAgB0L,CAAhB,CAAxC,CAFN,CAGF,MAAOna,CAAP,CAAY,CACV,GAAM,EAAAA,CAAA,WAAeqa,UAAf,CAAN,CACI,KAAMra,EAAN,CAFM,CAId,GAAY,IAAZ,GAAIma,CAAJ,EAAmC,QAAnC,GAAoB,MAAOA,EAA3B,CACI,KAAM1a,MAAA,CAAM,mBAAN,CAAN,CACE0a,CAAN,WAAqBxS,EAAAyS,oBAAAvL,MAArB,GACIsL,CADJ,CACU,IAAIxS,CAAAyS,oBAAAvL,MAAJ,CAAqCsL,CAArC,CADV,CAEA,KAAAN,QAAA,CAAalS,CAAA8C,IAAA,EAAb,CAA2B0P,CAA3B,CAAgC,QAAQ,CAACna,CAAD,CAAM4Y,CAAN,CAAW,CAC/C,GAAI5Y,CAAJ,CACIH,CAAA,CAASG,CAAT,CADJ,KAAA,CAKY,IAAZ,GAAI4Y,CAAJ,GACIA,CADJ,CACU,EADV,CAEA,IAAI,CAAEA,CAAA,CAAMjR,CAAA2S,qBAAAzL,MAAAiC,OAAA,CAAyC8H,CAAzC,CAAR,CAAyD,MAAO2B,CAAP,CAAmB,EAC3E3B,CAAL,EAAcA,CAAd,WAA6BjR,EAAA2S,qBAAAzL,MAA7B,CAIAhP,CAAA,CAAS,IAAT,CAAe+Y,CAAf,CAJA,CACI/Y,CAAA,CAASJ,KAAA,CAAM,mDAAN;AAA2D6K,CAAArM,KAA3D,CAAkE,GAAlE,CAAsE0J,CAAA1J,KAAtE,CAAT,CATJ,CAD+C,CAAnD,CAZA,CA2BF,MAAO+B,CAAP,CAAY,CACV8Z,UAAA,CAAWja,CAAAka,KAAA,CAAc,IAAd,CAAoB/Z,CAApB,CAAX,CAAqC,CAArC,CADU,CA5BsC,CAkCxD6X,EAAA,CAAQlQ,CAAA1J,KAAR,CAAA,CAAuB,QAAQ,CAAC4b,CAAD,CAAUM,CAAV,CAAeta,CAAf,CAAyB,CACpD,CAAA,IAAIgY,CAAJ,CAAYgC,CAAZ,CAAA,EAAqBlS,CAAA1J,KAArB,CAAA,CAAkCkc,CAAlC,CAAuCta,CAAvC,CADoD,CAIpDyL,OAAA8B,eAAJ,GACI9B,MAAA8B,eAAA,CAAsByK,CAAA,CAAQlQ,CAAA1J,KAAR,CAAtB,CAA4C,UAA5C,CAAwD,CAAE,MAAS0J,CAAA0F,SAAA,EAAX,CAAxD,CACA,CAAA/B,MAAA8B,eAAA,CAAsB4M,CAAA,CAAiBrS,CAAA1J,KAAjB,CAAtB,CAAqD,UAArD,CAAiE,CAAE,MAAS4Z,CAAA,CAAQlQ,CAAA1J,KAAR,CAAA,SAAX,CAAjE,CAFJ,CAzCc,CAAjB,CAAD,CA4CGgc,CAAA,CAAI3a,CAAJ,CA5CH,CAiFAgM,OAAA8B,eAAJ,GACI9B,MAAA8B,eAAA,CAAsByK,CAAtB,CAA+B,UAA/B,CAA2C,CAAE,MAASvN,CAAA+C,SAAA,EAAX,CAA3C,CAGA,CAFA/B,MAAA8B,eAAA,CAAsB4M,CAAtB,CAAwC,UAAxC,CAAoD,CAAE,MAASnC,CAAA,SAAX,CAApD,CAEA,CADAvM,MAAA8B,eAAA,CAAsByK,CAAtB,CAA+B,OAA/B,CAAwC,CAAE,MAASvN,CAAX,CAAxC,CACA,CAAAgB,MAAA8B,eAAA,CAAsB4M,CAAtB,CAAwC,OAAxC,CAAiD,CAAE,MAAS1P,CAAX,CAAjD,CAJJ,CAMA;MAAOuN,EA/IgC,CAAvB,CAiJjBxa,CAjJiB,CAiJP,IAjJO,CALmB,CA6J3CmM,EAAAqO,QAAA,CAAkBA,CAYlB,KAAI2C,EAASA,QAAQ,CAACjQ,CAAD,CAAU/C,CAAV,CAAevJ,CAAf,CAAqBsF,CAArB,CAA8B,CAC/C+G,CAAAa,KAAA,CAAO,IAAP,CAAaZ,CAAb,CAAsB/C,CAAtB,CAA2BvJ,CAA3B,CAKA,KAAA6M,UAAA,CAAiB,gBAOjB,KAAAvH,QAAA,CAAeA,CAAf,EAA0B,EAbqB,CA4BnD8J,EARsBmN,CAAArW,UAQtBkJ,CARyC/B,MAAAC,OAAA,CAAcjB,CAAAnG,UAAd,CAQzCkJ,UAAA,CAA2BhC,CAAAgC,SAM3B7D,EAAAqO,QAAA2C,OAAA,CAAyBA,CAgBrBN,EAAAA,CAAYA,QAAQ,CAAC3P,CAAD,CAAU/C,CAAV,CAAevJ,CAAf,CAAqBwc,CAArB,CAA8BC,CAA9B,CAAwCC,CAAxC,CAAwDC,CAAxD,CAAyErX,CAAzE,CAAkF,CACtGiX,CAAArP,KAAA,CAAY,IAAZ,CAAkBZ,CAAlB,CAA2B/C,CAA3B,CAAgCvJ,CAAhC,CAAsCsF,CAAtC,CAKA,KAAAuH,UAAA,CAAiB,mBAOjB,KAAA+P,YAAA,CAAmBJ,CAOnB,KAAAK,aAAA,CAAoBJ,CAOpB,KAAAK,cAAA,CAAqBJ,CAOrB,KAAAK,eAAA,CAAsBJ,CActB,KAAAN,qBAAA,CAPA,IAAAF,oBAOA,CAP2B,IAzC2E,CAoD1GF,EAAA/V,UAAA,CAAsBmH,MAAAC,OAAA,CAAciP,CAAArW,UAAd,CAMtBqF,EAAAqO,QAAAqC,UAAA,CAA4BA,CAE5B,OAAO1Q,EAt0F4B,CAApB,CAw0FhBnM,CAx0FgB,CA80FnBA;CAAAyR,QAAA,CAAoB,QAAQ,CAACzR,CAAD,CAAW8D,CAAX,CAAiBqI,CAAjB,CAA0B,CA6UlDyR,QAASA,EAAe,CAAC/T,CAAD,CAAS,CACzBA,CAAA,SAAJ,EACIA,CAAA,SAAAiM,QAAA,CAA2B,QAAQ,CAACrH,CAAD,CAAQ,CACvCA,CAAA,OAAA,CAAkB5E,CAAA,OAClB+T,EAAA,CAAgBnP,CAAhB,CAFuC,CAA3C,CAKA5E,EAAA,MAAJ,EACIA,CAAA,MAAAiM,QAAA,CAAwB,QAAQ,CAACrH,CAAD,CAAQ,CACpCA,CAAA,OAAA,CAAkB5E,CAAA,OADkB,CAAxC,CARyB,CAnUjC,IAAI4H,EAAUA,QAAQ,CAACvL,CAAD,CAAU,CAc5B,IAAAoH,IAAA,CAPA,IAAAwC,GAOA,CAPU,IAAI3D,CAAAyB,UAAJ,CAAsB,IAAtB,CAA4B,IAA5B,CAAkC,EAAlC,CAcV,KAAAiQ,SAAA,CAAgB,CAAA,CAOhB,KAAAC,OAAA,CAAc,IAOd,KAAAC,MAAA,CAAa,EAOb,KAAAC,WAAA,CAAkB,IAOlB,KAAA9X,QAAA,CAAeA,CAAf,EAA0B,EAjDE,CAAhC,CAwDI+X,EAAmBxM,CAAA3K,UAUvB2K,EAAAyM,UAAA,CAAoBC,QAAQ,CAACC,CAAD,CAAM,CAK9B,MAH2B,QAG3B,GAHI,MAAOA,EAAA,KAGX,EAA6B,WAA7B,GAAI,MAAOA,EAAA,OAAX,EAAkE,WAAlE,GAA4C,MAAOA,EAAA,IAAnD,CACW,CAAA,CADX,CAEO,CAAA,CAPuB,CAgBlC3M,EAAA4M,eAAA,CAAyBC,QAAQ,CAACF,CAAD,CAAM,CAEnC,MAA2B,QAA3B,GAAI,MAAOA,EAAA,KAAX;AAA8D,QAA9D,GAAuC,MAAOA,EAAA,KAA9C,EAAiG,QAAjG,GAA0E,MAAOA,EAAA,KAAjF,EAAkI,WAAlI,GAA6G,MAAOA,EAAA,GAApH,CACW,CAAA,CADX,CAEO,CAAA,CAJ4B,CAavC3M,EAAA8M,OAAA,CAAiBC,QAAQ,CAACJ,CAAD,CAAM,CAK3B,MAH2B,QAG3B,GAHI,MAAOA,EAAA,KAGX,EAA6B,WAA7B,GAAI,MAAOA,EAAA,OAAX,EAA6CjY,KAAAC,QAAA,CAAcgY,CAAA,OAAd,CAA7C,EAAsG,CAAtG,GAA6EA,CAAA,OAAAlc,OAA7E,CAEO,CAAA,CAFP,CACW,CAAA,CANgB,CAgB/BuP,EAAAgN,UAAA,CAAoBC,QAAQ,CAACN,CAAD,CAAM,CAE9B,MAA2B,QAA3B,GAAI,MAAOA,EAAA,KAAX,EAA6D,QAA7D,GAAuC,MAAOA,EAAA,IAA9C,EAA0EA,CAAA,IAA1E,CAEO,CAAA,CAFP,CACW,CAAA,CAHmB,CAalC3M,EAAAkN,SAAA,CAAmBC,QAAQ,CAACR,CAAD,CAAM,CAE7B,MAA0B,QAA1B,GAAI,MAAOA,EAAA,IAAX,CACW,CAAA,CADX,CAEO,CAAA,CAJsB,CAcjCH,EAAAY,MAAA,CAAyBC,QAAQ,EAAG,CAChC,IAAAxR,IAAA,CAAW,IAAAwC,GACX,OAAO,KAFyB,CAWpCmO,EAAAte,OAAA,CAA0Bof,QAAQ,CAACC,CAAD,CAAY,CAC1C,GAAyB,QAAzB,GAAI,MAAOA,EAAX,EAAsC,CAAAlb,CAAAM,QAAAsB,KAAA,CAAkBsZ,CAAlB,CAAtC,CACI,KAAM5c,MAAA,CAAM,qBAAN;AAA4B4c,CAA5B,CAAN,CACJA,CAAAzP,MAAA,CAAgB,GAAhB,CAAAuG,QAAA,CAA6B,QAAQ,CAACxG,CAAD,CAAO,CACxC,IAAIQ,EAAK,IAAAxC,IAAAqB,SAAA,CAAkBW,CAAlB,CACE,KAAX,GAAIQ,CAAJ,EACI,IAAAxC,IAAAiB,SAAA,CAAkBuB,CAAlB,CAAuB,IAAI3D,CAAAyB,UAAJ,CAAsB,IAAtB,CAA4B,IAAAN,IAA5B,CAAsCgC,CAAtC,CAAvB,CACJ,KAAAhC,IAAA,CAAWwC,CAJ6B,CAA5C,CAKG,IALH,CAMA,OAAO,KATmC,CAmB9CmO,EAAA/P,OAAA,CAA0B+Q,QAAQ,CAACC,CAAD,CAAO,CACrC,GAAKA,CAAAA,CAAL,CACI,MAAO,KACX,IAAK/Y,KAAAC,QAAA,CAAc8Y,CAAd,CAAL,CAEK,CACD,GAAoB,CAApB,GAAIA,CAAAhd,OAAJ,CACI,MAAO,KACXgd,EAAA,CAAOA,CAAA7Q,MAAA,EAHN,CAFL,IACI6Q,EAAA,CAAO,CAACA,CAAD,CASX,KADA,IAAIvY,EAAQ,CAACuY,CAAD,CACZ,CAAsB,CAAtB,CAAOvY,CAAAzE,OAAP,CAAA,CAAyB,CACrBgd,CAAA,CAAOvY,CAAAwY,IAAA,EAEP,IAAK,CAAAhZ,KAAAC,QAAA,CAAc8Y,CAAd,CAAL,CACI,KAAM9c,MAAA,CAAM,yBAAN,CAAgCuX,IAAAC,UAAA,CAAesF,CAAf,CAAhC,CAAN,CAEJ,IAAA,CAAqB,CAArB,CAAOA,CAAAhd,OAAP,CAAA,CAAwB,CACpB,IAAIkc,EAAMc,CAAA3X,MAAA,EAEV,IAAIkK,CAAAyM,UAAA,CAAkBE,CAAlB,CAAJ,CAA4B,CACxB,IAAI1M,EAAM,IAAIvF,CAAAyC,QAAJ,CAAoB,IAApB,CAA0B,IAAAtB,IAA1B,CAAoC8Q,CAAA,KAApC,CAAiDA,CAAA,QAAjD,CAAiEA,CAAA,QAAjE,CAAiFA,CAAA,OAAjF,CAAV;AAGI5H,EAAS,EACT4H,EAAA,OAAJ,EACInQ,MAAAkC,KAAA,CAAYiO,CAAA,OAAZ,CAAAtI,QAAA,CAAmC,QAAQ,CAAClV,CAAD,CAAO,CAC9C8Q,CAAAnD,SAAA,CAAaiI,CAAA,CAAO5V,CAAP,CAAb,CAA4B,IAAIuL,CAAAyC,QAAA6H,MAAJ,CAA0B,IAA1B,CAAgC/E,CAAhC,CAAqC9Q,CAArC,CAA5B,CAD8C,CAAlD,CAEG,IAFH,CAKAwd,EAAA,OAAJ,EACIA,CAAA,OAAAtI,QAAA,CAAsB,QAAQ,CAACtL,CAAD,CAAM,CAChC,GAAkC,IAAlC,GAAIkH,CAAA/C,SAAA,CAAanE,CAAA,GAAb,CAAuB,CAAvB,CAAJ,CACI,KAAMpI,MAAA,CAAM,mCAAN,CAA0CsP,CAAA9Q,KAA1C,CAAmD,IAAnD,CAAwD4J,CAAA,GAAxD,CAAN,CACJ,GAAIA,CAAA,QAAJ,EAAgD,QAAhD,GAAsB,MAAOA,EAAA,QAA7B,CACI,KAAMpI,MAAA,CAAM,2BAAN,CAAkCsP,CAAA9Q,KAAlC,CAA2C,GAA3C,CAA+C4J,CAAA,KAA/C,CAAN,CACJ,IAAIkN,EAAQ,IACZ,IAA4B,QAA5B,GAAI,MAAOlN,EAAA,MAAX,EAA0C,EAAAkN,CAAA,CAAQlB,CAAA,CAAOhM,CAAA,MAAP,CAAR,CAA1C,CACI,KAAMpI,MAAA,CAAM,mBAAN,CAA0BsP,CAAA9Q,KAA1B,CAAmC,GAAnC,CAAuC4J,CAAA,KAAvC,CAAmD,IAAnD,CAAwDA,CAAA,MAAxD,CAAN,CACJA,CAAA,CAAM,IAAI2B,CAAAyC,QAAAC,MAAJ,CAA0B,IAA1B,CAAgC6C,CAAhC,CAAqClH,CAAA,KAArC;AAAkDA,CAAA,QAAlD,CAAkEA,CAAA,KAAlE,CAA+EA,CAAA,KAA/E,CAA4FA,CAAA,GAA5F,CAAuGA,CAAA,QAAvG,CAAuHkN,CAAvH,CAA8H0G,CAAA,OAA9H,CACF1G,EAAJ,EACIA,CAAAlM,OAAAnF,KAAA,CAAkBmE,CAAlB,CACJkH,EAAAnD,SAAA,CAAa/D,CAAb,CAXgC,CAApC,CAYG,IAZH,CAeJ,KAAI4U,EAAS,EACThB,EAAA,MAAJ,EACIA,CAAA,MAAAtI,QAAA,CAAqB,QAAQ,CAAClK,CAAD,CAAM,CAC/BwT,CAAA/Y,KAAA,CAAYuF,CAAZ,CAD+B,CAAnC,CAGAwS,EAAA,SAAJ,EACIA,CAAA,SAAAtI,QAAA,CAAwB,QAAQ,CAACpL,CAAD,CAAM,CAClC0U,CAAA/Y,KAAA,CAAYqE,CAAZ,CADkC,CAAtC,CAGA0T,EAAA,SAAJ,EACIA,CAAA,SAAAtI,QAAA,CAAwB,QAAQ,CAAC3L,CAAD,CAAM,CAClCiV,CAAA/Y,KAAA,CAAY8D,CAAZ,CADkC,CAAtC,CAKAiU,EAAA,WAAJ,GAEQ1M,CAAAoD,WAFR,CACwC,QAApC,GAAI,MAAOsJ,EAAA,WAAA,CAAkB,CAAlB,CAAX,CACqB,CAAEA,CAAA,WAAF,CADrB,CAGqBA,CAAA,WAJzB,CAQA,KAAA9Q,IAAAiB,SAAA,CAAkBmD,CAAlB,CACA,IAAoB,CAApB,CAAI0N,CAAAld,OAAJ,CAAuB,CACnByE,CAAAN,KAAA,CAAW6Y,CAAX,CACAA,EAAA,CAAOE,CACPA,EAAA,CAAS,IACT,KAAA9R,IAAA,CAAWoE,CACXA,EAAA,CAAM,IACN,SANmB,CAQvB0N,CAAA,CAAS,IA3De,CAA5B,IA6DO,IAAI3N,CAAA8M,OAAA,CAAeH,CAAf,CAAJ,CAEH1M,CAIA,CAJM,IAAIvF,CAAAmF,KAAJ,CAAiB,IAAjB,CAAuB,IAAAhE,IAAvB,CAAiC8Q,CAAA,KAAjC,CAA8CA,CAAA,QAA9C;AAA8DA,CAAA,OAA9D,CAIN,CAHAA,CAAA,OAAAtI,QAAA,CAAsB,QAAQ,CAACjQ,CAAD,CAAM,CAChC6L,CAAAnD,SAAA,CAAa,IAAIpC,CAAAmF,KAAAC,MAAJ,CAAuB,IAAvB,CAA6BG,CAA7B,CAAkC7L,CAAA,KAAlC,CAA+CA,CAAA,GAA/C,CAAb,CADgC,CAApC,CAEG,IAFH,CAGA,CAAA,IAAAyH,IAAAiB,SAAA,CAAkBmD,CAAlB,CANG,KAQA,IAAID,CAAAgN,UAAA,CAAkBL,CAAlB,CAAJ,CAEH1M,CAKA,CALM,IAAIvF,CAAAqO,QAAJ,CAAoB,IAApB,CAA0B,IAAAlN,IAA1B,CAAoC8Q,CAAA,KAApC,CAAiDA,CAAA,QAAjD,CAKN,CAJAnQ,MAAAkC,KAAA,CAAYiO,CAAA,IAAZ,CAAAtI,QAAA,CAAgC,QAAQ,CAAClV,CAAD,CAAO,CAC3C,IAAIye,EAAMjB,CAAA,IAAA,CAAWxd,CAAX,CACV8Q,EAAAnD,SAAA,CAAa,IAAIpC,CAAAqO,QAAAqC,UAAJ,CAA8B,IAA9B,CAAoCnL,CAApC,CAAyC9Q,CAAzC,CAA+Cye,CAAA,QAA/C,CAA+DA,CAAA,SAA/D,CAAgF,CAAE,CAAAA,CAAA,eAAlF,CAAyG,CAAE,CAAAA,CAAA,gBAA3G,CAAmIA,CAAA,QAAnI,CAAb,CAF2C,CAA/C,CAGG,IAHH,CAIA,CAAA,IAAA/R,IAAAiB,SAAA,CAAkBmD,CAAlB,CAPG,KASA,IAAID,CAAAkN,SAAA,CAAiBP,CAAjB,CAAJ,CAGH,GADA1M,CACA,CADM,IAAApE,IAAA4B,QAAA,CAAiBkP,CAAA,IAAjB,CAA6B,CAAA,CAA7B,CACN,CACIA,CAAA,OAAAtI,QAAA,CAAsB,QAAQ,CAACtL,CAAD,CAAM,CAChC,GAAkC,IAAlC,GAAIkH,CAAA/C,SAAA,CAAanE,CAAA,GAAb,CAAuB,CAAvB,CAAJ,CACI,KAAMpI,MAAA,CAAM,iCAAN;AAAwCsP,CAAA9Q,KAAxC,CAAiD,IAAjD,CAAsD4J,CAAA,GAAtD,CAAN,CAEJ,GAAIkH,CAAAoD,WAAJ,CAAoB,CAChB,IAAIwK,EAAQ,CAAA,CACZ5N,EAAAoD,WAAAgB,QAAA,CAAuB,QAAQ,CAAC/J,CAAD,CAAQ,CAC/BvB,CAAA,GAAJ,EAAiBuB,CAAA,CAAM,CAAN,CAAjB,EAA6BvB,CAAA,GAA7B,EAA0CuB,CAAA,CAAM,CAAN,CAA1C,GACIuT,CADJ,CACY,CAAA,CADZ,CADmC,CAAvC,CAIA,IAAKA,CAAAA,CAAL,CACI,KAAMld,MAAA,CAAM,+BAAN,CAAsCsP,CAAA9Q,KAAtC,CAA+C,IAA/C,CAAoD4J,CAAA,GAApD,CAA8D,4BAA9D,CAAN,CAPY,CAUpB,IAAI5J,EAAO4J,CAAA,KACP,KAAAtE,QAAA,yBAAJ,GACItF,CADJ,CACWZ,CAAAwB,KAAA+B,YAAA,CAA0B3C,CAA1B,CADX,CAGI2V,KAAAA,EAAQ,IAAIpK,CAAAyC,QAAAmJ,eAAJ,CAAmC,IAAnC,CAAyCrG,CAAzC,CAA8ClH,CAAA,KAA9C,CAA2DA,CAAA,KAA3D,CAAwE,IAAA8C,IAAAF,IAAA,EAAxE,CAAuF,GAAvF,CAA2FxM,CAA3F,CAAiG4J,CAAA,GAAjG,CAA4GA,CAAA,QAA5G,CAAR+L,CAIAtK,EAAM,IAAIE,CAAAsO,UAAJ,CAAsB,IAAtB,CAA4B,IAAAnN,IAA5B,CAAsC9C,CAAA,KAAtC,CAAmD+L,CAAnD,CACVA,EAAAgJ,UAAA,CAAkBtT,CAClB,KAAAqB,IAAAiB,SAAA,CAAkBtC,CAAlB,CACAyF,EAAAnD,SAAA,CAAagI,CAAb,CAzBgC,CAApC,CA0BG,IA1BH,CADJ,KA6BO,IAAK,CAAA,uBAAA7Q,KAAA,CAA6B0Y,CAAA,IAA7B,CAAL,CACH,KAAMhc,MAAA,CAAM,mBAAN;AAA0Bgc,CAAA,IAA1B,CAAqC,iBAArC,CAAN,CADG,CAhCJ,IAoCH,MAAMhc,MAAA,CAAM,0BAAN,CAAiCuX,IAAAC,UAAA,CAAewE,CAAf,CAAjC,CAAN,CAGJ1M,CAAA,CADA0M,CACA,CADM,IAvHc,CA2HxBc,CAAA,CAAO,IACP,KAAA5R,IAAA,CAAW,IAAAA,IAAAzD,OAlIU,CAoIzB,IAAAgU,SAAA,CAAgB,CAAA,CAChB,KAAAC,OAAA,CAAc,IACd,OAAO,KAnJ8B,CAiLzCG,EAAA,CAAiB,QAAjB,CAAA,CAA6B,QAAQ,CAACuB,CAAD,CAAOC,CAAP,CAAiB,CAClD,IAAI9X,EAAQ,GAIZ,IAAwB,QAAxB,GAAI,MAAO8X,EAAX,CAAkC,CAE1Bzf,CAAAwB,KAAAC,QAAJ,GACIge,CADJ,CACe7f,OAAA,CAAQ,MAAR,CAAA,QAAA,CAA2B6f,CAA3B,CADf,CAEA,IAA6B,CAAA,CAA7B,GAAI,IAAA1B,MAAA,CAAW0B,CAAX,CAAJ,CACI,MAAO,KAAAZ,MAAA,EACX,KAAAd,MAAA,CAAW0B,CAAX,CAAA,CAAuB,CAAA,CANO,CAAlC,IAQO,IAAwB,QAAxB,GAAI,MAAOA,EAAX,CAAkC,CAErC,IAAInD,EAAOmD,CAAAnD,KACPtc,EAAAwB,KAAAC,QAAJ,GACI6a,CADJ,CACW1c,OAAA,CAAQ,MAAR,CAAA,QAAA,CAA2B0c,CAA3B,CADX,CAEA,IAA0B,CAA1B,EAAIA,CAAA7L,QAAA,CAAa,IAAb,CAAJ,EAA8D,CAA9D,EAA+BgP,CAAAC,KAAAjP,QAAA,CAAsB,IAAtB,CAA/B,CACI9I,CAAA,CAAQ,IAGRgY,EAAA,CADA3f,CAAAwB,KAAAC,QAAJ;AACY7B,OAAA,CAAQ,MAAR,CAAA,KAAA,CAAwB0c,CAAxB,CAA8BmD,CAAAC,KAA9B,CADZ,CAGYpD,CAHZ,CAGmB3U,CAHnB,CAG2B8X,CAAAC,KAC3B,IAA0B,CAAA,CAA1B,GAAI,IAAA3B,MAAA,CAAW4B,CAAX,CAAJ,CACI,MAAO,KAAAd,MAAA,EACX,KAAAd,MAAA,CAAW4B,CAAX,CAAA,CAAoB,CAAA,CAdiB,CAmBzC,GAAIH,CAAA,QAAJ,EAAgD,CAAhD,CAAuBA,CAAA,QAAAtd,OAAvB,CAAmD,CAC/C,IACI0d,EAAY,CAAA,CAEhB,IAAwB,QAAxB,GAAI,MAAOH,EAAX,CAKI,IAHA,IAAAzB,WAGI,CAHcyB,CAAA,KAGd,CAHgCG,CAGhC,CAH4C,CAAA,CAG5C,CAFJ5B,CAEI,CAFS,IAAAA,WAET,CADJyB,CACI,CADOA,CAAA,KACP,CAA4B,CAA5B,EAAAzB,CAAAvN,QAAA,CAAmB,IAAnB,CAAA,EAA2D,CAA3D,EAAiCgP,CAAAhP,QAAA,CAAiB,IAAjB,CAArC,CACI9I,CAAA,CAAQ,IADZ,CALJ,IAQ+B,QAAxB,GAAI,MAAO8X,EAAX,CAEC,IAAAzB,WAAJ,CACIA,CADJ,CACiB,IAAAA,WADjB,CAGiC,CAA7B,EAAIyB,CAAAhP,QAAA,CAAiB,GAAjB,CAAJ,EACIuN,CACA,CADayB,CAAA/b,QAAA,CAAiB,WAAjB,CAA8B,EAA9B,CACb,CAAqC,EAArC,GAAsBsa,CAAtB,GACIA,CADJ,CACiB,GADjB,CAFJ,EAIqC,CAA9B,EAAIyB,CAAAhP,QAAA,CAAiB,IAAjB,CAAJ,EACHuN,CACA,CADayB,CAAA/b,QAAA,CAAiB,WAAjB,CAA8B,EAA9B,CACb,CAAAiE,CAAA,CAAQ,IAFL,EAIHqW,CAJG,CAIU,GAblB,CAiBHA,CAjBG,CAiBU,IAEjB,KAAK,IAAI/b,EAAE,CAAX,CAAcA,CAAd,CAAgBud,CAAA,QAAAtd,OAAhB,CAAwCD,CAAA,EAAxC,CACI,GAAkC,QAAlC;AAAI,MAAOud,EAAA,QAAA,CAAgBvd,CAAhB,CAAX,CAA4C,CACxC,GAAK+b,CAAAA,CAAL,CACI,KAAM5b,MAAA,CAAM,8BAAN,CAAN,CACJ,IAAIyd,EAAiBL,CAAA,QAAA,CAAgBvd,CAAhB,CACrB,IAAuB,kCAAvB,GAAI4d,CAAJ,GAGIA,CAGA,CAJA7f,CAAAwB,KAAAC,QAAJ,CACqB7B,OAAA,CAAQ,MAAR,CAAA,KAAA,CAAwBoe,CAAxB,CAAoC6B,CAApC,CADrB,CAGqB7B,CAHrB,CAGkCrW,CAHlC,CAG0CkY,CACtC,CAA+B,CAAA,CAA/B,GAAA,IAAA9B,MAAA,CAAW8B,CAAX,CANJ,EAMA,CAEI,WAAAna,KAAA,CAAiBma,CAAjB,CAAJ,EAAyC3a,CAAAlF,CAAAkF,SAAzC,GACI2a,CADJ,CACqBA,CAAAnc,QAAA,CAAuB,UAAvB,CAAmC,OAAnC,CADrB,CAEA,KAAImY,EAAW7b,CAAAwB,KAAAa,MAAA,CAAoBwd,CAApB,CACf,IAAiB,IAAjB,GAAIhE,CAAJ,CACI,KAAMzZ,MAAA,CAAM,oBAAN,CAA2Byd,CAA3B,CAA0C,QAA1C,CAAmDJ,CAAnD,CAA4D,mBAA5D,CAAN,CACJ,GAAI,UAAA/Z,KAAA,CAAgBma,CAAhB,CAAJ,CACI,IAAA,CAAK,QAAL,CAAA,CAAelG,IAAAhR,MAAA,CAAWkT,CAAX,CAAoB,EAApB,CAAf,CAAwCgE,CAAxC,CADJ,KAGI,KAAA,CAAK,QAAL,CAAA,CAAe7f,CAAAkF,SAAAqD,OAAAI,MAAA,CAA+BkT,CAA/B,CAAf,CAAyDgE,CAAzD,CAVJ,CAVwC,CAA5C,IAsBI,IAAKJ,CAAL,CAEK,GAAI,UAAA/Z,KAAA,CAAgB+Z,CAAhB,CAAJ,CACD,IAAA,CAAK,QAAL,CAAA,CAAeD,CAAA,QAAA,CAAgBvd,CAAhB,CAAf;AAAmCwd,CAAA/b,QAAA,CAAiB,eAAjB,CAAkC,QAAQ,CAACC,CAAD,CAAKC,CAAL,CAASkc,CAAT,CAAa,CAAE,MAAOlc,EAAP,CAAU,SAAV,CAAoB3B,CAApB,CAAsB,GAAtB,CAA0B6d,CAA5B,CAAvD,CAAnC,CADC,KAGD,KAAA,CAAK,QAAL,CAAA,CAAeN,CAAA,QAAA,CAAgBvd,CAAhB,CAAf,CAAmCwd,CAAnC,CAA4C,SAA5C,CAAsDxd,CAAtD,CALJ,KACI,KAAA,CAAK,QAAL,CAAA,CAAeud,CAAA,QAAA,CAAgBvd,CAAhB,CAAf,CAMR2d,EAAJ,GACI,IAAA5B,WADJ,CACsB,IADtB,CA7D+C,CAmE/CwB,CAAA,CAAK,SAAL,CAAJ,EACI,IAAA7f,OAAA,CAAY6f,CAAA,CAAK,SAAL,CAAZ,CACAA,EAAA,OAAJ,EACI5B,CAAA,CAAgB4B,CAAhB,CACJ,KAAIO,EAAO,IAAAzS,IACPkS,EAAA,QAAJ,EACIvR,MAAAkC,KAAA,CAAYqP,CAAA,QAAZ,CAAA1J,QAAA,CAAqC,QAAQ,CAAC7G,CAAD,CAAM,CAC/C8Q,CAAA7Z,QAAA,CAAa+I,CAAb,CAAA,CAAoBuQ,CAAA,QAAA,CAAgBvQ,CAAhB,CAD2B,CAAnD,CAGAuQ,EAAA,SAAJ,GACI,IAAAtR,OAAA,CAAYsR,CAAA,SAAZ,CACA,CAAA,IAAAlS,IAAA,CAAWyS,CAFf,CAGIP,EAAA,MAAJ,GACI,IAAAtR,OAAA,CAAYsR,CAAA,MAAZ,CACA,CAAA,IAAAlS,IAAA,CAAWyS,CAFf,CAGIP,EAAA,SAAJ,GACI,IAAAtR,OAAA,CAAYsR,CAAA,SAAZ,CACA,CAAA,IAAAlS,IAAA,CAAWyS,CAFf,CAGIP,EAAA,CAAK,SAAL,CAAJ,EACI,IAAAtR,OAAA,CAAYsR,CAAA,CAAK,SAAL,CAAZ,CAEJ;MAAO,KAAAX,MAAA,EAxH2C,CAiItDZ,EAAA+B,WAAA,CAA8BC,QAAQ,EAAG,CAErC,IAAI1E,CACJ,IAAgB,IAAhB,EAAI,IAAAjO,IAAJ,EAAiD,QAAjD,GAAwB,MAAO,KAAAA,IAAAjC,KAA/B,CACI,MAAO,KAEX,IAAI,IAAAiC,IAAJ,WAAwBnB,EAAAyB,UAAxB,CAEI,IAAAN,IAAAS,SAAA+H,QAAA,CAA0B,QAAQ,CAACrH,CAAD,CAAQ,CACtC,IAAAnB,IAAA,CAAWmB,CACX,KAAAuR,WAAA,EAFsC,CAA1C,CAGG,IAHH,CAFJ,KAOO,IAAI,IAAA1S,IAAJ,WAAwBnB,EAAAyC,QAAAC,MAAxB,CAA+C,CAElD,GAAK/K,CAAAG,KAAAyB,KAAA,CAAe,IAAA4H,IAAAjC,KAAf,CAAL,CAiBI,IAAAiC,IAAAjC,KAAA,CAAgBrL,CAAAW,MAAA,CAAe,IAAA2M,IAAAjC,KAAf,CAjBpB,KAAoC,CAChC,GAAK,CAAAvH,CAAAM,QAAAsB,KAAA,CAAkB,IAAA4H,IAAAjC,KAAlB,CAAL,CACI,KAAMjJ,MAAA,CAAM,4BAAN,CAAmC,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAAnC,CAA2D,IAA3D,CAAgE,IAAAiF,IAAAjC,KAAhE,CAAN,CACJkQ,CAAA,CAAMrM,CAAC,IAAA5B,IAAA,WAAoBnB,EAAAyC,QAAAmJ,eAApB;AAAqD,IAAAzK,IAAAiS,UAAA1V,OAArD,CAAiF,IAAAyD,IAAAzD,OAAlFqF,SAAA,CAA2G,IAAA5B,IAAAjC,KAA3G,CAA0H,CAAA,CAA1H,CACN,IAAKkQ,CAAAA,CAAL,CACI,KAAMnZ,MAAA,CAAM,iCAAN,CAAwC,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAAxC,CAAgE,IAAhE,CAAqE,IAAAiF,IAAAjC,KAArE,CAAN,CACJ,IAAAiC,IAAAiD,aAAA,CAAwBgL,CACxB,IAAIA,CAAJ,WAAmBpP,EAAAmF,KAAnB,CAEI,IADA,IAAAhE,IAAAjC,KACI,CADYrL,CAAAW,MAAA,CAAe,MAAf,CACZ,CAAoB,QAApB,GAAA,IAAA2M,IAAAO,OAAA,EAA+C,QAA/C,GAAgC0N,CAAA1N,OAApC,CACI,KAAMzL,MAAA,CAAM,6CAAN,CAAN,CADJ,CAFJ,IAKK,IAAImZ,CAAJ,WAAmBpP,EAAAyC,QAAnB,CACD,IAAAtB,IAAAjC,KAAA,CAAgBkQ,CAAA9Q,QAAA,CAAczK,CAAAW,MAAA,MAAd,CAAwCX,CAAAW,MAAA,QADvD,KAGD,MAAMyB,MAAA,CAAM,4BAAN,CAAmC,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAAnC;AAA2D,IAA3D,CAAgE,IAAAiF,IAAAjC,KAAhE,CAAN,CAf4B,CAqBpC,GAAI,IAAAiC,IAAAsJ,IAAJ,CAAkB,CACd,GAAK,CAAA9S,CAAAG,KAAAyB,KAAA,CAAe,IAAA4H,IAAA0N,QAAf,CAAL,CACI,KAAM5Y,MAAA,CAAM,oCAAN,CAA2C,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAA3C,CAAmE,IAAnE,CAAwE,IAAAiF,IAAA0N,QAAxE,CAAN,CACJ,IAAA1N,IAAA0N,QAAA,CAAmBhb,CAAAW,MAAA,CAAe,IAAA2M,IAAA0N,QAAf,CAHL,CASI,QADtB,GACE,IAAA1N,IAAAO,OADF,EAEE,IAAAP,IAAAqJ,SAFF,EAEmD3V,IAAAA,EAFnD,GAEuB,IAAAsM,IAAApH,QAAAga,OAFvB,EAGoE,EAHpE,GAGElgB,CAAAU,oBAAA+P,QAAA,CAAqC,IAAAnD,IAAAjC,KAAAxK,SAArC,CAHF,GAKE,IAAAyM,IAAApH,QAAAga,OALF,CAK4B,CAAA,CAL5B,CA/BkD,CAA/C,IAuCA,IAAI,IAAA5S,IAAJ,WAAwBtN,EAAAmM,QAAAqO,QAAA2C,OAAxB,CAEH,GAAI,IAAA7P,IAAJ,WAAwBtN,EAAAmM,QAAAqO,QAAAqC,UAAxB,CAA4D,CACxDtB,CAAA,CAAM,IAAAjO,IAAAzD,OAAAqF,QAAA,CAAwB,IAAA5B,IAAAkQ,YAAxB;AAA8C,CAAA,CAA9C,CACN,IAAI,EAACjC,CAAD,EAAUA,CAAV,WAAyBvb,EAAAmM,QAAAyC,QAAzB,CAAJ,CACI,KAAMxM,MAAA,CAAM,4BAAN,CAAmC,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAAnC,CAA2D,IAA3D,CAAgE,IAAAiF,IAAAkQ,YAAhE,CAAN,CACJ,IAAAlQ,IAAAyP,oBAAA,CAA+BxB,CAC/BA,EAAA,CAAM,IAAAjO,IAAAzD,OAAAqF,QAAA,CAAwB,IAAA5B,IAAAmQ,aAAxB,CAA+C,CAAA,CAA/C,CACN,IAAI,EAAClC,CAAD,EAAUA,CAAV,WAAyBvb,EAAAmM,QAAAyC,QAAzB,CAAJ,CACI,KAAMxM,MAAA,CAAM,4BAAN,CAAmC,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAAnC,CAA2D,IAA3D,CAAgE,IAAAiF,IAAAmQ,aAAhE,CAAN,CACJ,IAAAnQ,IAAA2P,qBAAA,CAAgC1B,CARwB,CAA5D,IAUI,MAAMnZ,MAAA,CAAM,0BAAN,CAAiC,IAAAkL,IAAAjF,SAAA,CAAkB,CAAA,CAAlB,CAAjC,CAAN,CAZD,IAcA,IACH,EAAE,IAAAiF,IAAF,WAAsBtN,EAAAmM,QAAAyC,QAAA6H,MAAtB;AACE,IAAAnJ,IADF,WACsBtN,EAAAmM,QAAAsO,UADtB,EAEE,IAAAnN,IAFF,WAEsBtN,EAAAmM,QAAAmF,KAAAC,MAFtB,CADG,CAKH,KAAMnP,MAAA,CAAM,+BAAN,CAAsC,MAAO,KAAAkL,IAA7C,CAAuD,IAAvD,CAA4D,IAAAA,IAA5D,CAAN,CAEJ,MAAO,KAAAuR,MAAA,EAzE8B,CAoFzCZ,EAAAvQ,MAAA,CAAyByS,QAAQ,CAAC5d,CAAD,CAAO,CACpC,IAAAsc,MAAA,EACK,KAAAhB,SAAL,GACI,IAAAmC,WAAA,EAEA,CADA,IAAAnC,SACA,CADgB,CAAA,CAChB,CAAA,IAAAC,OAAA,CAAc,IAHlB,CAIoB,KAApB,GAAI,IAAAA,OAAJ,GACI,IAAAA,OADJ,CACkB,IAAAhO,GAAApC,MAAA,EADlB,CAEA,IAAKnL,CAAAA,CAAL,CACI,MAAO,KAAAub,OACPxO,EAAAA,CAAuB,QAAhB,GAAA,MAAO/M,EAAP,CAA2BA,CAAAgN,MAAA,CAAW,GAAX,CAA3B,CAA6ChN,CAExD,KAFA,IACI+K,EAAM,IAAAwQ,OADV,CAES7b,EAAE,CAAX,CAAcA,CAAd,CAAgBqN,CAAApN,OAAhB,CAA6BD,CAAA,EAA7B,CACI,GAAIqL,CAAA,CAAIgC,CAAA,CAAKrN,CAAL,CAAJ,CAAJ,CACIqL,CAAA,CAAMA,CAAA,CAAIgC,CAAA,CAAKrN,CAAL,CAAJ,CADV,KAEK,CACDqL,CAAA,CAAM,IACN,MAFC,CAIT,MAAOA,EAnB6B,CA4BxC2Q,EAAAmC,OAAA,CAA0BC,QAAQ,CAAC9d,CAAD;AAAO8M,CAAP,CAA4B,CAC1D,MAAO9M,EAAA,CAAO,IAAAuN,GAAAZ,QAAA,CAAgB3M,CAAhB,CAAsB8M,CAAtB,CAAP,CAAoD,IAAAS,GADD,CAS9DmO,EAAA5V,SAAA,CAA4BiY,QAAQ,EAAG,CACnC,MAAO,SAD4B,CAUvC7O,EAAA7C,QAAA,CAAkB2R,QAAQ,EAAG,EAK7B9O,EAAAH,KAAA,CAAekP,QAAQ,EAAG,EAK1B/O,EAAA+I,QAAA,CAAkBiG,QAAQ,EAAG,EAE7B,OAAOhP,EAnnB2C,CAAnC,CAqnBhBzR,CArnBgB,CAqnBNA,CAAA8D,KArnBM,CAqnBS9D,CAAAmM,QArnBT,CA2nBnBnM,EAAAgW,IAAA,CAAgB,QAAQ,CAAChW,CAAD,CAAWmM,CAAX,CAAoB,CA+ExCuU,QAASA,EAAa,CAACC,CAAD,CAAM,CACxB,IAAIC,EAAM,CACV,OAAO,CACHvZ,KAAMA,QAAQ,EAAG,CACb,MAAIuZ,EAAJ,CAAUD,CAAAze,OAAV,CACW,CAAEiU,KAAM,CAAA,CAAR,CAAe/Q,MAAOub,CAAA,CAAIC,CAAA,EAAJ,CAAtB,CADX,CAEO,CAAEzK,KAAM,CAAA,CAAR,CAHM,CADd,CAFiB,CAjE5B,IAAIH,EAAMA,QAAQ,CAACO,CAAD,CAAQsF,CAAR,CAAkB,CAChC,GAAKjF,CAAAL,CAAAK,IAAL,CACI,KAAMxU,MAAA,CAAM,oBAAN,CAAN,CAMJ,IAAAmU,MAAA,CAAaA,CAMb,KAAAH,QAAA,CAAe,IAAIjK,CAAAmE,QAAJ,CAAoBiG,CAAAyE,QAApB,CAAmC,IAAnC,CAAyC,CAAA,CAAzC,CAA+CzE,CAAA1I,OAA/C,CAMf,KAAAwI,UAAA,CAAiB,IAAIlK,CAAAmE,QAAJ,CAAoBiG,CAAAlL,KAApB,CAAgCkL,CAAAhG,aAAhC,CAAoD,CAAA,CAApD,CAA2DgG,CAAA1I,OAA3D,CAgBjB,KAAA+I,IAAA,CAAW,EAKX3I;MAAA8B,eAAA,CAAsB,IAAtB,CAA4B,MAA5B,CAAoC,CAChC6H,IAAKA,QAAQ,EAAG,CAAE,MAAO3J,OAAAkC,KAAA,CAAY,IAAAyG,IAAZ,CAAA1U,OAAT,CADgB,CAApC,CAKA,IAAI2Z,CAAJ,CAEI,IADA,IAAI1L,EAAOlC,MAAAkC,KAAA,CAAY0L,CAAZ,CAAX,CACS5Z,EAAI,CAAb,CAAgBA,CAAhB,CAAoBkO,CAAAjO,OAApB,CAAiCD,CAAA,EAAjC,CAAsC,CAClC,IAAIgN,EAAM,IAAAmH,QAAA3B,gBAAA,CAA6BtE,CAAA,CAAKlO,CAAL,CAA7B,CAAV,CACI4D,EAAM,IAAAwQ,UAAAvF,YAAA,CAA2B+K,CAAA,CAAS1L,CAAA,CAAKlO,CAAL,CAAT,CAA3B,CACV,KAAA2U,IAAA,CAAS,IAAAR,QAAAxB,cAAA,CAA2B3F,CAA3B,CAAT,CAAA,CACI,CAAEA,IAAKA,CAAP,CAAY7J,MAAOS,CAAnB,CAJ8B,CAhDV,CAApC,CAyDIgb,EAAe7K,CAAAlP,UAsBnB+Z,EAAAC,MAAA,CAAqBC,QAAQ,EAAG,CAC5B,IAAAnK,IAAA,CAAW,EADiB,CAQhCiK,EAAA,CAAa,QAAb,CAAA,CAAyB,QAAQ,CAAC5R,CAAD,CAAM,CAC/B+R,CAAAA,CAAW,IAAA5K,QAAAxB,cAAA,CAA2B,IAAAwB,QAAAtF,YAAA,CAAyB7B,CAAzB,CAA3B,CACf,KAAIgS,EAASD,CAATC,GAAqB,KAAArK,IACzB,QAAO,IAAAA,IAAA,CAASoK,CAAT,CACP,OAAOC,EAJ4B,CAWvCJ,EAAA3K,QAAA,CAAuBgL,QAAQ,EAAG,CAG9B,IAFA,IAAIhL,EAAU,EAAd,CACIiL,EAAUlT,MAAAkC,KAAA,CAAY,IAAAyG,IAAZ,CADd;AAES3U,EAAI,CAFb,CAEgBmf,CAAhB,CAAuBnf,CAAvB,CAA2Bkf,CAAAjf,OAA3B,CAA2CD,CAAA,EAA3C,CACIiU,CAAA7P,KAAA,CAAa,CAAC4I,CAACmS,CAADnS,CAAO,IAAA2H,IAAA,CAASuK,CAAA,CAAQlf,CAAR,CAAT,CAAPgN,KAAD,CAAmCmS,CAAAhc,MAAnC,CAAb,CACJ,OAAOsb,EAAA,CAAcxK,CAAd,CALuB,CAYlC2K,EAAA1Q,KAAA,CAAoBkR,QAAQ,EAAG,CAG3B,IAFA,IAAIlR,EAAO,EAAX,CACIgR,EAAUlT,MAAAkC,KAAA,CAAY,IAAAyG,IAAZ,CADd,CAES3U,EAAI,CAAb,CAAgBA,CAAhB,CAAoBkf,CAAAjf,OAApB,CAAoCD,CAAA,EAApC,CACIkO,CAAA9J,KAAA,CAAU,IAAAuQ,IAAA,CAASuK,CAAA,CAAQlf,CAAR,CAAT,CAAAgN,IAAV,CACJ,OAAOyR,EAAA,CAAcvQ,CAAd,CALoB,CAY/B0Q,EAAAxP,OAAA,CAAsBiQ,QAAQ,EAAG,CAG7B,IAFA,IAAIjQ,EAAS,EAAb,CACI8P,EAAUlT,MAAAkC,KAAA,CAAY,IAAAyG,IAAZ,CADd,CAES3U,EAAI,CAAb,CAAgBA,CAAhB,CAAoBkf,CAAAjf,OAApB,CAAoCD,CAAA,EAApC,CACIoP,CAAAhL,KAAA,CAAY,IAAAuQ,IAAA,CAASuK,CAAA,CAAQlf,CAAR,CAAT,CAAAmD,MAAZ,CACJ,OAAOsb,EAAA,CAAcrP,CAAd,CALsB,CAajCwP,EAAA/K,QAAA,CAAuByL,QAAQ,CAACC,CAAD,CAAKC,CAAL,CAAc,CAEzC,IADA,IAAIN,EAAUlT,MAAAkC,KAAA,CAAY,IAAAyG,IAAZ,CAAd,CACS3U,EAAI,CADb,CACgBmf,CAAhB,CAAuBnf,CAAvB,CAA2Bkf,CAAAjf,OAA3B,CAA2CD,CAAA,EAA3C,CACIuf,CAAA1T,KAAA,CAAQ2T,CAAR,CAAiBrc,CAACgc,CAADhc,CAAO,IAAAwR,IAAA,CAASuK,CAAA,CAAQlf,CAAR,CAAT,CAAPmD,OAAjB,CAAqDgc,CAAAnS,IAArD,CAAgE,IAAhE,CAHqC,CAY7C4R,EAAAxJ,IAAA,CAAmBqK,QAAQ,CAACzS,CAAD,CAAM7J,CAAN,CAAa,CACpC,IAAI4b,EAAW,IAAA5K,QAAAtF,YAAA,CAAyB7B,CAAzB,CAAf,CACI0S,EAAW,IAAAtL,UAAAvF,YAAA,CAA2B1L,CAA3B,CACf;IAAAwR,IAAA,CAAS,IAAAR,QAAAxB,cAAA,CAA2BoM,CAA3B,CAAT,CAAA,CACI,CAAE/R,IAAK+R,CAAP,CAAiB5b,MAAOuc,CAAxB,CACJ,OAAO,KAL6B,CAaxCd,EAAAjJ,IAAA,CAAmBgK,QAAQ,CAAC3S,CAAD,CAAM,CACzB+R,CAAAA,CAAW,IAAA5K,QAAAxB,cAAA,CAA2B,IAAAwB,QAAAtF,YAAA,CAAyB7B,CAAzB,CAA3B,CACf,IAAM+R,CAAN,GAAkB,KAAApK,IAAlB,CAEA,MAAO,KAAAA,IAAA,CAASoK,CAAT,CAAA5b,MAJsB,CAYjCyb,EAAAgB,IAAA,CAAmBC,QAAQ,CAAC7S,CAAD,CAAM,CAE7B,MADe,KAAAmH,QAAAxB,cAAAoM,CAA2B,IAAA5K,QAAAtF,YAAA,CAAyB7B,CAAzB,CAA3B+R,CACf,EAAoB,KAAApK,IAFS,CAKjC,OAAOZ,EA/LiC,CAA7B,CAgMZhW,CAhMY,CAgMFA,CAAAmM,QAhME,CA4MfnM,EAAA+hB,UAAA,CAAqBC,QAAQ,CAACzb,CAAD,CAAQ2G,CAAR,CAAiBuS,CAAjB,CAA2B,CACpD,GAAuB,QAAvB,GAAI,MAAOvS,EAAX,EAAoCA,CAApC,EAA0E,QAA1E,GAA+C,MAAOA,EAAA,KAAtD,EAAiH,QAAjH,GAAsF,MAAOA,EAAA,KAA7F,CACIuS,CACA,CADWvS,CACX,CAAAA,CAAA,CAAUlM,IAAAA,EACd,OAAOhB,EAAAiiB,SAAA,CAAkBjiB,CAAAkF,SAAAqD,OAAAI,MAAA,CAA+BpC,CAA/B,CAAlB,CAAyD2G,CAAzD,CAAkEuS,CAAlE,CAJ6C,CAiBxDzf,EAAAkiB,gBAAA,CAA2BliB,CAAA+hB,UAc3B/hB;CAAAmiB,cAAA,CAAyBC,QAAQ,CAAC3C,CAAD,CAAWjd,CAAX,CAAqB0K,CAArB,CAA8B,CACvD1K,CAAJ,EAAoC,QAApC,GAAgB,MAAOA,EAAvB,EACI0K,CACA,CADU1K,CACV,CAAAA,CAAA,CAAW,IAFf,EAGUA,CAHV,EAG0C,UAH1C,GAGsB,MAAOA,EAH7B,GAIIA,CAJJ,CAIe,IAJf,CAKA,IAAIA,CAAJ,CACI,MAAOxC,EAAAwB,KAAAa,MAAA,CAAwC,QAApB,GAAA,MAAOod,EAAP,CAA+BA,CAA/B,CAA0CA,CAAA,KAA1C,CAA2D,GAA3D,CAA+DA,CAAA,KAAnF,CAAqG,QAAQ,CAAC5D,CAAD,CAAW,CAC3H,GAAiB,IAAjB,GAAIA,CAAJ,CACIrZ,CAAA,CAASJ,KAAA,CAAM,sBAAN,CAAT,CADJ,KAIA,IAAI,CACAI,CAAA,CAAS,IAAT,CAAexC,CAAA+hB,UAAA,CAAmBlG,CAAnB,CAA6B3O,CAA7B,CAAsCuS,CAAtC,CAAf,CADA,CAEF,MAAOtd,CAAP,CAAU,CACRK,CAAA,CAASL,CAAT,CADQ,CAP+G,CAAxH,CAWX,KAAI0Z,EAAW7b,CAAAwB,KAAAa,MAAA,CAAwC,QAApB,GAAA,MAAOod,EAAP,CAA+BA,CAAA,KAA/B,CAAgD,GAAhD,CAAoDA,CAAA,KAApD,CAAuEA,CAA3F,CACf,OAAoB,KAAb,GAAA5D,CAAA,CAAoB,IAApB,CAA2B7b,CAAA+hB,UAAA,CAAmBlG,CAAnB,CAA6B3O,CAA7B,CAAsCuS,CAAtC,CAnByB,CAmC/Dzf,EAAAqiB,cAAA,CAAyBriB,CAAAmiB,cASzBniB,EAAAsiB,WAAA,CAAsBC,QAAQ,CAACrc,CAAD,CAAU,CACpCA,CAAA,CAAUA,CAAV,EAAqB,EAC8B,YAAnD,GAAI,MAAOA,EAAA,yBAAX,GACIA,CAAA,yBADJ;AAC0ClG,CAAAqB,yBAD1C,CAE4C,YAA5C,GAAI,MAAO6E,EAAA,kBAAX,GACIA,CAAA,kBADJ,CACmClG,CAAAsB,kBADnC,CAEA,OAAO,KAAItB,CAAAyR,QAAJ,CAAqBvL,CAArB,CAN6B,CAkBxClG,EAAAiiB,SAAA,CAAoBO,QAAQ,CAAChD,CAAD,CAAOtS,CAAP,CAAgBuS,CAAhB,CAA0B,CAClD,GAAuB,QAAvB,GAAI,MAAOvS,EAAX,EAAoCA,CAApC,EAA0E,QAA1E,GAA+C,MAAOA,EAAA,KAAtD,EAAiH,QAAjH,GAAsF,MAAOA,EAAA,KAA7F,CACIuS,CACA,CADWvS,CACX,CAAAA,CAAA,CAAU,IACTA,EAAL,EAAmC,QAAnC,GAAgB,MAAOA,EAAvB,GACIA,CADJ,CACclN,CAAAsiB,WAAA,EADd,CAEoB,SAApB,GAAI,MAAO9C,EAAX,GACIA,CADJ,CACW7F,IAAAhR,MAAA,CAAW6W,CAAX,CADX,CAEAtS,EAAA,CAAQ,QAAR,CAAA,CAAkBsS,CAAlB,CAAwBC,CAAxB,CACAvS,EAAA8S,WAAA,EACA,OAAO9S,EAV2C,CAyBtDlN,EAAAyiB,aAAA,CAAwBC,QAAQ,CAACjD,CAAD,CAAWjd,CAAX,CAAqB0K,CAArB,CAA8B,CACtD1K,CAAJ,EAAoC,QAApC,GAAgB,MAAOA,EAAvB,EACI0K,CACA,CADU1K,CACV,CAAAA,CAAA,CAAW,IAFf,EAGUA,CAHV,EAG0C,UAH1C,GAGsB,MAAOA,EAH7B,GAIIA,CAJJ,CAIe,IAJf,CAKA,IAAIA,CAAJ,CACI,MAAOxC,EAAAwB,KAAAa,MAAA,CAAwC,QAApB;AAAA,MAAOod,EAAP,CAA+BA,CAA/B,CAA0CA,CAAA,KAA1C,CAA2D,GAA3D,CAA+DA,CAAA,KAAnF,CAAqG,QAAQ,CAAC5D,CAAD,CAAW,CAC3H,GAAiB,IAAjB,GAAIA,CAAJ,CACIrZ,CAAA,CAASJ,KAAA,CAAM,sBAAN,CAAT,CADJ,KAIA,IAAI,CACAI,CAAA,CAAS,IAAT,CAAexC,CAAAiiB,SAAA,CAAkBtI,IAAAhR,MAAA,CAAWkT,CAAX,CAAlB,CAAwC3O,CAAxC,CAAiDuS,CAAjD,CAAf,CADA,CAEF,MAAOtd,CAAP,CAAU,CACRK,CAAA,CAASL,CAAT,CADQ,CAP+G,CAAxH,CAWX,KAAI0Z,EAAW7b,CAAAwB,KAAAa,MAAA,CAAwC,QAApB,GAAA,MAAOod,EAAP,CAA+BA,CAAA,KAA/B,CAAgD,GAAhD,CAAoDA,CAAA,KAApD,CAAuEA,CAA3F,CACf,OAAoB,KAAb,GAAA5D,CAAA,CAAoB,IAApB,CAA2B7b,CAAAiiB,SAAA,CAAkBtI,IAAAhR,MAAA,CAAWkT,CAAX,CAAlB,CAAwC3O,CAAxC,CAAiDuS,CAAjD,CAnBwB,CAsB9D,OAAOzf,EAjnK+B,CAT1C;",
+"sources":[" [synthetic:base] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:es6/symbol] "," [synthetic:es6/util/iteratorfromarray] "," [synthetic:util/polyfill] "," [synthetic:es6/array/keys] "," [synthetic:es6/array/entries] "," [synthetic:es6/array/values] ","dist/protobuf.js"],
+"names":["global","factory","define","require","module","ByteBuffer","isCommonJS","ProtoBuf","Long","VERSION","WIRE_TYPES","VARINT","BITS64","LDELIM","STARTGROUP","ENDGROUP","BITS32","PACKABLE_WIRE_TYPES","TYPES","name","wireType","defaultValue","ZERO","undefined","UZERO","MAP_KEY_TYPES","ID_MIN","ID_MAX","convertFieldsToCamelCase","populateAccessors","populateDefaults","Util","IS_NODE","process","XHR","Util.XHR","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xhr","i","length","e","Error","fetch","Util.fetch","path","callback","fs","readFile","err","data","readFileSync","open","setRequestHeader","overrideMimeType","onreadystatechange","xhr.onreadystatechange","readyState","status","responseText","send","toCamelCase","Util.toCamelCase","str","replace","$0","$1","toUpperCase","Lang","DELIM","RULE","TYPE","NAME","TYPEDEF","TYPEREF","FQTYPEREF","NUMBER","NUMBER_DEC","NUMBER_HEX","NUMBER_OCT","NUMBER_FLT","BOOL","ID","NEGID","WHITESPACE","STRING","STRING_DQ","STRING_SQ","DotProto","mkId","value","mayBeNegative","id","sign","charAt","substring","test","parseInt","mkNumber","val","Infinity","NaN","parseFloat","setOption","options","Array","isArray","push","Tokenizer","proto","source","index","line","stack","_stringOpen","TokenizerPrototype","prototype","_readString","TokenizerPrototype._readString","re","lastIndex","match","exec","next","TokenizerPrototype.next","shift","repeat","prev","end","delim","token","peek","TokenizerPrototype.peek","skip","TokenizerPrototype.skip","expected","actual","omit","TokenizerPrototype.omit","toString","TokenizerPrototype.toString","Parser","tn","proto3","ParserPrototype","parse","ParserPrototype.parse","topLevel","head","weak","_parseMessage","_parseEnum","_parseOption","_parseService","_parseExtend","message","Parser.parse","ParserPrototype._readString","_readValue","ParserPrototype._readValue","mayBeTypeRef","toLowerCase","ParserPrototype._parseOption","parent","isList","custom","_parseOptionValue","ParserPrototype._parseOptionValue","ParserPrototype._parseService","svc","_parseServiceRPC","ParserPrototype._parseServiceRPC","method","ParserPrototype._parseMessage","fld","isGroup","msg","_parseFieldOptions","_parseMessageField","_parseMessageOneOf","hasOwnProperty","concat","_parseExtensionRanges","_parseIgnored","ParserPrototype._parseIgnored","ParserPrototype._parseMessageField","rule","type","grp","ParserPrototype._parseMessageOneOf","fields","ParserPrototype._parseFieldOptions","first","ParserPrototype._parseEnum","enm","ParserPrototype._parseExtensionRanges","ranges","range","ParserPrototype._parseExtend","ext","ParserPrototype.toString","Reflect","mkLong","unsigned","low","high","fromString","fromNumber","skipTillGroupEnd","expectedId","buf","tag","readVarint32","readUint8","offset","T","builder","TPrototype","fqn","TPrototype.fqn","ptr","TPrototype.toString","includeClass","className","build","TPrototype.build","Namespace","syntax","call","children","NamespacePrototype","Object","create","getChildren","NamespacePrototype.getChildren","slice","k","addChild","NamespacePrototype.addChild","child","other","getChild","Message","Field","originalName","NamespacePrototype.getChild","nameOrId","key","resolve","NamespacePrototype.resolve","qn","excludeNonNamespace","part","split","NamespacePrototype.qn","t","unshift","len","join","NamespacePrototype.build","ns","defineProperty","buildOpt","NamespacePrototype.buildOpt","opt","keys","getOption","NamespacePrototype.getOption","Element","resolvedType","isMapKey","indexOf","ElementPrototype","defaultFieldValue","mkDefault","ElementPrototype.toString","verifyValue","ElementPrototype.verifyValue","fail","self","String","isByteBuffer","wrap","values","Enum","Value","clazz","Builder","obj","calculateLength","ElementPrototype.calculateLength","n","calculateVarint64","calculateVarint32","zigZagEncode32","zigZagEncode64","calculateUTF8Bytes","remaining","calculate","encodeValue","ElementPrototype.encodeValue","buffer","writeVarint64","writeVarint32","writeVarint32ZigZag","writeUint32","writeInt32","writeVarint64ZigZag","writeUint64","writeInt64","writeFloat32","writeFloat64","writeVString","prevOffset","append","bb","LE","encode","flip","decode","ElementPrototype.decode","readVarint32ZigZag","readUint32","readInt32","readVarint64","toUnsigned","readVarint64ZigZag","readUint64","readInt64","readFloat","readDouble","readVString","nBytes","clone","limit","valueFromString","ElementPrototype.valueFromString","fromBinary","valueToString","ElementPrototype.valueToString","extensions","_fieldsByName","_fieldsById","_fields","MessagePrototype","MessagePrototype.build","rebuild","cloneRaw","binaryAsBase64","longsAsStrings","getName","object","toBase64","toBuffer","isLong","fromValue","forEach","v","Map","it","entries","done","keyElem","valueElem","$type","field","oneofs","OneOf","var_args","repeated","map","required","arguments","ArrayBuffer","$set","add","MessagePrototype.add","noAssert","$add","set","MessagePrototype.set","keyOrObj","ikey","_oneofsByName","oneof","currentField","get","MessagePrototype.get","$get","ExtensionField","Name","setter","getter","MessagePrototype.encode","noVerify","isNew","le","littleEndian","Message.encode","MessagePrototype.calculate","encodeDelimited","MessagePrototype.encodeDelimited","enc","encodeAB","MessagePrototype.encodeAB","toArrayBuffer","encodeNB","MessagePrototype.encodeNB","encode64","MessagePrototype.encode64","encodeHex","MessagePrototype.encodeHex","toHex","toRaw","MessagePrototype.toRaw","encodeJSON","MessagePrototype.encodeJSON","JSON","stringify","Message.decode","decodeDelimited","Message.decodeDelimited","off","decode64","Message.decode64","decodeHex","Message.decodeHex","decodeJSON","Message.decodeJSON","MessagePrototype.toString","Service","Extension","fieldMissing","MessagePrototype.decode","expectedGroupEndId","start","keyval","keytype","keyType","keyElement","element","FieldPrototype","FieldPrototype.build","FieldPrototype.verifyValue","skipRepeated","res","hasWirePresence","FieldPrototype.hasWirePresence","FieldPrototype.encode","ensureCapacity","varintLen","contents","m","FieldPrototype.calculate","ni","FieldPrototype.decode","wireTypeOK","msgbuf","Enum.getName","EnumPrototype.build","root","ServicePrototype.build","rpcImpl","setTimeout","bind","ServicePrototype","rpc","RPCMethod","req","resolvedRequestType","TypeError","resolvedResponseType","notABuffer","Method","request","response","request_stream","response_stream","requestName","responseName","requestStream","responseStream","propagateSyntax","resolved","result","files","importRoot","BuilderPrototype","isMessage","Builder.isMessage","def","isMessageField","Builder.isMessageField","isEnum","Builder.isEnum","isService","Builder.isService","isExtend","Builder.isExtend","reset","BuilderPrototype.reset","BuilderPrototype.define","namespace","BuilderPrototype.create","defs","pop","subObj","mtd","valid","extension","json","filename","file","fname","resetRoot","importFilename","$2","base","resolveAll","BuilderPrototype.resolveAll","packed","BuilderPrototype.build","lookup","BuilderPrototype.lookup","BuilderPrototype.toString","Builder.Message","Builder.Enum","Builder.Service","arrayIterator","arr","idx","MapPrototype","clear","MapPrototype.clear","keyValue","hadKey","MapPrototype.entries","strKeys","entry","MapPrototype.keys","MapPrototype.values","MapPrototype.forEach","cb","thisArg","MapPrototype.set","valValue","MapPrototype.get","has","MapPrototype.has","loadProto","ProtoBuf.loadProto","loadJson","protoFromString","loadProtoFile","ProtoBuf.loadProtoFile","protoFromFile","newBuilder","ProtoBuf.newBuilder","ProtoBuf.loadJson","loadJsonFile","ProtoBuf.loadJsonFile"]
+}
index f775a72..0b6a196 100644 (file)
@@ -1,4 +1,50 @@
 {
+  "_args": [
+    [
+      {
+        "raw": "protobufjs@^5.0.3",
+        "scope": null,
+        "escapedName": "protobufjs",
+        "name": "protobufjs",
+        "rawSpec": "^5.0.3",
+        "spec": ">=5.0.3 <6.0.0",
+        "type": "range"
+      },
+      "/var/opt/motion2/node_modules/grpc"
+    ]
+  ],
+  "_from": "protobufjs@>=5.0.3 <6.0.0",
+  "_id": "protobufjs@5.0.3",
+  "_inCache": true,
+  "_location": "/grpc/protobufjs",
+  "_nodeVersion": "8.9.1",
+  "_npmOperationalInternal": {
+    "host": "s3://npm-registry-packages",
+    "tmp": "tmp/protobufjs_5.0.3_1526462497935_0.23118861557345283"
+  },
+  "_npmUser": {
+    "name": "dcode",
+    "email": "dcode+npm@dcode.io"
+  },
+  "_npmVersion": "5.5.1",
+  "_phantomChildren": {},
+  "_requested": {
+    "raw": "protobufjs@^5.0.3",
+    "scope": null,
+    "escapedName": "protobufjs",
+    "name": "protobufjs",
+    "rawSpec": "^5.0.3",
+    "spec": ">=5.0.3 <6.0.0",
+    "type": "range"
+  },
+  "_requiredBy": [
+    "/grpc"
+  ],
+  "_resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz",
+  "_shasum": "e4dfe9fb67c90b2630d15868249bcc4961467a17",
+  "_shrinkwrap": null,
+  "_spec": "protobufjs@^5.0.3",
+  "_where": "/var/opt/motion2/node_modules/grpc",
   "author": {
     "name": "Daniel Wirtz",
     "email": "dcode@dcode.io"
     "tarball": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz",
     "fileCount": 189,
     "unpackedSize": 3128808,
-    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+/gjCRA9TVsSAnZWagAA4lAQAIQu/R1fQv2iN0SAWNaR\nDe6nwKeB3BTkxeIB/HNfwzhVEmSepbskJrzx4ZSGlnSKLI/R/RPjh1yvx6dG\nQ1+1ddWcSTbAj85enFcR1WIb3/rV92W+61sba8vh8+yYlPs/HO2aXc7RqjuH\nnWAHJ/WgQItMdiOLbXxtm1s0oFiK2/l9tLVU+xzIIjADzNjPSD/tHZkc4S1a\n7b+6AX0lviG2A9AxyQgF/WLoY8sY7xEHiukE6mFfu0l8c9u0IeM9zx/wtzyB\nPKaBjzjDgEkqbrLGVARuYTOT5oFd/DNESLfkpYRJWsYgTHluY+RUyxCM2n61\nRRSqNedYavPi602su160AQnANLH8wyQG+KSdaPPR9TmCYE+5+B1TZU77jYKL\nyCmwoNi/SV8U9HNESFrgh/lMqizYOyLjfmhdeegEw4+p6fDBcW6//JWRBo2k\no5hQgsgmcSDV3wPrZoRMOC5z1x0hm9DlojZ7lJk5fuoVYjT1/K4BhcM4OFFu\ndy77gZl9MSEQWxMDp8VHPYVCsnEjJtKdqPJgiB9sD9qqM+b9BxC2eiGjh5rw\n5/3zecpFTtdJ0zn4XlFk/JrBTF9+WNTI4akHqWmzOkFmrqdn8d+JgPD+FJph\nfPHLENcZ+AqwDhZhMxV4LKHZ8t2XlhCfvFu26nQ6sfXmpPUfo/Qj5gj5DIcS\nUf1W\r\n=4WLx\r\n-----END PGP SIGNATURE-----\r\n",
-    "signatures": [
-      {
-        "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
-        "sig": "MEYCIQCNjjw2GRdwG2F1J+hRI7YlyVJLp0awdgnwPxYsNu2SAQIhAJPM4WJeeyQWZfqlB8MzoC+Pk9qBCiFiYBX6WSwTVgIk"
-      }
-    ]
+    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+/gjCRA9TVsSAnZWagAA4lAQAIQu/R1fQv2iN0SAWNaR\nDe6nwKeB3BTkxeIB/HNfwzhVEmSepbskJrzx4ZSGlnSKLI/R/RPjh1yvx6dG\nQ1+1ddWcSTbAj85enFcR1WIb3/rV92W+61sba8vh8+yYlPs/HO2aXc7RqjuH\nnWAHJ/WgQItMdiOLbXxtm1s0oFiK2/l9tLVU+xzIIjADzNjPSD/tHZkc4S1a\n7b+6AX0lviG2A9AxyQgF/WLoY8sY7xEHiukE6mFfu0l8c9u0IeM9zx/wtzyB\nPKaBjzjDgEkqbrLGVARuYTOT5oFd/DNESLfkpYRJWsYgTHluY+RUyxCM2n61\nRRSqNedYavPi602su160AQnANLH8wyQG+KSdaPPR9TmCYE+5+B1TZU77jYKL\nyCmwoNi/SV8U9HNESFrgh/lMqizYOyLjfmhdeegEw4+p6fDBcW6//JWRBo2k\no5hQgsgmcSDV3wPrZoRMOC5z1x0hm9DlojZ7lJk5fuoVYjT1/K4BhcM4OFFu\ndy77gZl9MSEQWxMDp8VHPYVCsnEjJtKdqPJgiB9sD9qqM+b9BxC2eiGjh5rw\n5/3zecpFTtdJ0zn4XlFk/JrBTF9+WNTI4akHqWmzOkFmrqdn8d+JgPD+FJph\nfPHLENcZ+AqwDhZhMxV4LKHZ8t2XlhCfvFu26nQ6sfXmpPUfo/Qj5gj5DIcS\nUf1W\r\n=4WLx\r\n-----END PGP SIGNATURE-----\r\n"
   },
   "engines": {
     "node": ">=0.8"
diff --git a/legacy-libs/grpc/node_modules/rc/LICENSE.APACHE2 b/legacy-libs/grpc/node_modules/rc/LICENSE.APACHE2
deleted file mode 100644 (file)
index 6366c04..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Apache License, Version 2.0
-
-Copyright (c) 2011 Dominic Tarr
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/legacy-libs/grpc/node_modules/rc/LICENSE.BSD b/legacy-libs/grpc/node_modules/rc/LICENSE.BSD
deleted file mode 100644 (file)
index 96bb796..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2013, Dominic Tarr
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met: 
-
-1. Redistributions of source code must retain the above copyright notice, this
-   list of conditions and the following disclaimer. 
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution. 
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those
-of the authors and should not be interpreted as representing official policies, 
-either expressed or implied, of the FreeBSD Project.
diff --git a/legacy-libs/grpc/node_modules/rc/LICENSE.MIT b/legacy-libs/grpc/node_modules/rc/LICENSE.MIT
deleted file mode 100644 (file)
index 6eafbd7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-The MIT License
-
-Copyright (c) 2011 Dominic Tarr
-
-Permission is hereby granted, free of charge, 
-to any person obtaining a copy of this software and 
-associated documentation files (the "Software"), to 
-deal in the Software without restriction, including 
-without limitation the rights to use, copy, modify, 
-merge, publish, distribute, sublicense, and/or sell 
-copies of the Software, and to permit persons to whom 
-the Software is furnished to do so, 
-subject to the following conditions:
-
-The above copyright notice and this permission notice 
-shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/rc/README.md b/legacy-libs/grpc/node_modules/rc/README.md
deleted file mode 100644 (file)
index e6522e2..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-# rc
-
-The non-configurable configuration loader for lazy people.
-
-## Usage
-
-The only option is to pass rc the name of your app, and your default configuration.
-
-```javascript
-var conf = require('rc')(appname, {
-  //defaults go here.
-  port: 2468,
-
-  //defaults which are objects will be merged, not replaced
-  views: {
-    engine: 'jade'
-  }
-});
-```
-
-`rc` will return your configuration options merged with the defaults you specify.
-If you pass in a predefined defaults object, it will be mutated:
-
-```javascript
-var conf = {};
-require('rc')(appname, conf);
-```
-
-If `rc` finds any config files for your app, the returned config object will have
-a `configs` array containing their paths:
-
-```javascript
-var appCfg = require('rc')(appname, conf);
-appCfg.configs[0] // /etc/appnamerc
-appCfg.configs[1] // /home/dominictarr/.config/appname
-appCfg.config // same as appCfg.configs[appCfg.configs.length - 1]
-```
-
-## Standards
-
-Given your application name (`appname`), rc will look in all the obvious places for configuration.
-
-  * command line arguments, parsed by minimist _(e.g. `--foo baz`, also nested: `--foo.bar=baz`)_
-  * environment variables prefixed with `${appname}_`
-    * or use "\_\_" to indicate nested properties <br/> _(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_
-  * if you passed an option `--config file` then from that file
-  * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc.
-  * `$HOME/.${appname}rc`
-  * `$HOME/.${appname}/config`
-  * `$HOME/.config/${appname}`
-  * `$HOME/.config/${appname}/config`
-  * `/etc/${appname}rc`
-  * `/etc/${appname}/config`
-  * the defaults object you passed in.
-
-All configuration sources that were found will be flattened into one object,
-so that sources **earlier** in this list override later ones.
-
-
-## Configuration File Formats
-
-Configuration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. **No** file extension (`.json` or `.ini`) should be used. The example configurations below are equivalent:
-
-
-#### Formatted as `ini`
-
-```
-; You can include comments in `ini` format if you want.
-
-dependsOn=0.10.0
-
-
-; `rc` has built-in support for ini sections, see?
-
-[commands]
-  www     = ./commands/www
-  console = ./commands/repl
-
-
-; You can even do nested sections
-
-[generators.options]
-  engine  = ejs
-
-[generators.modules]
-  new     = generate-new
-  engine  = generate-backend
-
-```
-
-#### Formatted as `json`
-
-```javascript
-{
-  // You can even comment your JSON, if you want
-  "dependsOn": "0.10.0",
-  "commands": {
-    "www": "./commands/www",
-    "console": "./commands/repl"
-  },
-  "generators": {
-    "options": {
-      "engine": "ejs"
-    },
-    "modules": {
-      "new": "generate-new",
-      "backend": "generate-backend"
-    }
-  }
-}
-```
-
-Comments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).
-
-> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings.
-
-To ensure that string representations of booleans and numbers are always converted into their proper types (especially useful if you intend to do strict `===` comparisons), consider using a module such as [parse-strings-in-object](https://github.com/anselanza/parse-strings-in-object) to wrap the config object returned from rc.
-
-
-## Simple example demonstrating precedence
-Assume you have an application like this (notice the hard-coded defaults passed to rc):
-```
-const conf = require('rc')('myapp', {
-    port: 12345,
-    mode: 'test'
-});
-
-console.log(JSON.stringify(conf, null, 2));
-```
-You also have a file `config.json`, with these contents:
-```
-{
-  "port": 9000,
-  "foo": "from config json",
-  "something": "else"
-}
-```
-And a file `.myapprc` in the same folder, with these contents:
-```
-{
-  "port": "3001",
-  "foo": "bar"
-}
-```
-Here is the expected output from various commands:
-
-`node .`
-```
-{
-  "port": "3001",
-  "mode": "test",
-  "foo": "bar",
-  "_": [],
-  "configs": [
-    "/Users/stephen/repos/conftest/.myapprc"
-  ],
-  "config": "/Users/stephen/repos/conftest/.myapprc"
-}
-```
-*Default `mode` from hard-coded object is retained, but port is overridden by `.myapprc` file (automatically found based on appname match), and `foo` is added.*
-
-
-`node . --foo baz`
-```
-{
-  "port": "3001",
-  "mode": "test",
-  "foo": "baz",
-  "_": [],
-  "configs": [
-    "/Users/stephen/repos/conftest/.myapprc"
-  ],
-  "config": "/Users/stephen/repos/conftest/.myapprc"
-}
-```
-*Same result as above but `foo` is overridden because command-line arguments take precedence over `.myapprc` file.*
-
-`node . --foo barbar --config config.json`
-```
-{
-  "port": 9000,
-  "mode": "test",
-  "foo": "barbar",
-  "something": "else",
-  "_": [],
-  "config": "config.json",
-  "configs": [
-    "/Users/stephen/repos/conftest/.myapprc",
-    "config.json"
-  ]
-}
-```
-*Now the `port` comes from the `config.json` file specified (overriding the value from `.myapprc`), and `foo` value is overriden by command-line despite also being specified in the `config.json` file.*
-
-
-## Advanced Usage
-
-#### Pass in your own `argv`
-
-You may pass in your own `argv` as the third argument to `rc`.  This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12).
-
-```javascript
-require('rc')(appname, defaults, customArgvParser);
-```
-
-## Pass in your own parser
-
-If you have a special need to use a non-standard parser,
-you can do so by passing in the parser as the 4th argument.
-(leave the 3rd as null to get the default args parser)
-
-```javascript
-require('rc')(appname, defaults, null, parser);
-```
-
-This may also be used to force a more strict format,
-such as strict, valid JSON only.
-
-## Note on Performance
-
-`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) 
-
-
-## License
-
-Multi-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0
diff --git a/legacy-libs/grpc/node_modules/rc/browser.js b/legacy-libs/grpc/node_modules/rc/browser.js
deleted file mode 100644 (file)
index 8c230c5..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-// when this is loaded into the browser, 
-// just use the defaults...
-
-module.exports = function (name, defaults) {
-  return defaults
-}
diff --git a/legacy-libs/grpc/node_modules/rc/cli.js b/legacy-libs/grpc/node_modules/rc/cli.js
deleted file mode 100644 (file)
index ab05b60..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /usr/bin/env node
-var rc = require('./index')
-
-console.log(JSON.stringify(rc(process.argv[2]), false, 2))
diff --git a/legacy-libs/grpc/node_modules/rc/index.js b/legacy-libs/grpc/node_modules/rc/index.js
deleted file mode 100644 (file)
index 65eb47a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-var cc   = require('./lib/utils')
-var join = require('path').join
-var deepExtend = require('deep-extend')
-var etc = '/etc'
-var win = process.platform === "win32"
-var home = win
-           ? process.env.USERPROFILE
-           : process.env.HOME
-
-module.exports = function (name, defaults, argv, parse) {
-  if('string' !== typeof name)
-    throw new Error('rc(name): name *must* be string')
-  if(!argv)
-    argv = require('minimist')(process.argv.slice(2))
-  defaults = (
-      'string' === typeof defaults
-    ? cc.json(defaults) : defaults
-    ) || {}
-
-  parse = parse || cc.parse
-
-  var env = cc.env(name + '_')
-
-  var configs = [defaults]
-  var configFiles = []
-  function addConfigFile (file) {
-    if (configFiles.indexOf(file) >= 0) return
-    var fileConfig = cc.file(file)
-    if (fileConfig) {
-      configs.push(parse(fileConfig))
-      configFiles.push(file)
-    }
-  }
-
-  // which files do we look at?
-  if (!win)
-   [join(etc, name, 'config'),
-    join(etc, name + 'rc')].forEach(addConfigFile)
-  if (home)
-   [join(home, '.config', name, 'config'),
-    join(home, '.config', name),
-    join(home, '.' + name, 'config'),
-    join(home, '.' + name + 'rc')].forEach(addConfigFile)
-  addConfigFile(cc.find('.'+name+'rc'))
-  if (env.config) addConfigFile(env.config)
-  if (argv.config) addConfigFile(argv.config)
-
-  return deepExtend.apply(null, configs.concat([
-    env,
-    argv,
-    configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
-  ]))
-}
diff --git a/legacy-libs/grpc/node_modules/rc/lib/utils.js b/legacy-libs/grpc/node_modules/rc/lib/utils.js
deleted file mode 100644 (file)
index 8b3beff..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-'use strict';
-var fs   = require('fs')
-var ini  = require('ini')
-var path = require('path')
-var stripJsonComments = require('strip-json-comments')
-
-var parse = exports.parse = function (content) {
-
-  //if it ends in .json or starts with { then it must be json.
-  //must be done this way, because ini accepts everything.
-  //can't just try and parse it and let it throw if it's not ini.
-  //everything is ini. even json with a syntax error.
-
-  if(/^\s*{/.test(content))
-    return JSON.parse(stripJsonComments(content))
-  return ini.parse(content)
-
-}
-
-var file = exports.file = function () {
-  var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
-
-  //path.join breaks if it's a not a string, so just skip this.
-  for(var i in args)
-    if('string' !== typeof args[i])
-      return
-
-  var file = path.join.apply(null, args)
-  var content
-  try {
-    return fs.readFileSync(file,'utf-8')
-  } catch (err) {
-    return
-  }
-}
-
-var json = exports.json = function () {
-  var content = file.apply(null, arguments)
-  return content ? parse(content) : null
-}
-
-var env = exports.env = function (prefix, env) {
-  env = env || process.env
-  var obj = {}
-  var l = prefix.length
-  for(var k in env) {
-    if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
-
-      var keypath = k.substring(l).split('__')
-
-      // Trim empty strings from keypath array
-      var _emptyStringIndex
-      while ((_emptyStringIndex=keypath.indexOf('')) > -1) {
-        keypath.splice(_emptyStringIndex, 1)
-      }
-
-      var cursor = obj
-      keypath.forEach(function _buildSubObj(_subkey,i){
-
-        // (check for _subkey first so we ignore empty strings)
-        // (check for cursor to avoid assignment to primitive objects)
-        if (!_subkey || typeof cursor !== 'object')
-          return
-
-        // If this is the last key, just stuff the value in there
-        // Assigns actual value from env variable to final key
-        // (unless it's just an empty string- in that case use the last valid key)
-        if (i === keypath.length-1)
-          cursor[_subkey] = env[k]
-
-
-        // Build sub-object if nothing already exists at the keypath
-        if (cursor[_subkey] === undefined)
-          cursor[_subkey] = {}
-
-        // Increment cursor used to track the object at the current depth
-        cursor = cursor[_subkey]
-
-      })
-
-    }
-
-  }
-
-  return obj
-}
-
-var find = exports.find = function () {
-  var rel = path.join.apply(null, [].slice.call(arguments))
-
-  function find(start, rel) {
-    var file = path.join(start, rel)
-    try {
-      fs.statSync(file)
-      return file
-    } catch (err) {
-      if(path.dirname(start) !== start) // root
-        return find(path.dirname(start), rel)
-    }
-  }
-  return find(process.cwd(), rel)
-}
-
-
diff --git a/legacy-libs/grpc/node_modules/rc/package.json b/legacy-libs/grpc/node_modules/rc/package.json
deleted file mode 100644 (file)
index 12ee566..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-{
-  "_args": [
-    [
-      "rc@1.2.8",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "rc@1.2.8",
-  "_id": "rc@1.2.8",
-  "_inBundle": false,
-  "_integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
-  "_location": "/grpc/rc",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "rc@1.2.8",
-    "name": "rc",
-    "escapedName": "rc",
-    "rawSpec": "1.2.8",
-    "saveSpec": null,
-    "fetchSpec": "1.2.8"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.2.8",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Dominic Tarr",
-    "email": "dominic.tarr@gmail.com",
-    "url": "dominictarr.com"
-  },
-  "bin": {
-    "rc": "./cli.js"
-  },
-  "browser": "browser.js",
-  "bugs": {
-    "url": "https://github.com/dominictarr/rc/issues"
-  },
-  "dependencies": {
-    "deep-extend": "^0.6.0",
-    "ini": "~1.3.0",
-    "minimist": "^1.2.0",
-    "strip-json-comments": "~2.0.1"
-  },
-  "description": "hardwired configuration loader",
-  "devDependencies": {},
-  "homepage": "https://github.com/dominictarr/rc#readme",
-  "keywords": [
-    "config",
-    "rc",
-    "unix",
-    "defaults"
-  ],
-  "license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
-  "main": "index.js",
-  "name": "rc",
-  "optionalDependencies": {},
-  "readme": "# rc\n\nThe non-configurable configuration loader for lazy people.\n\n## Usage\n\nThe only option is to pass rc the name of your app, and your default configuration.\n\n```javascript\nvar conf = require('rc')(appname, {\n  //defaults go here.\n  port: 2468,\n\n  //defaults which are objects will be merged, not replaced\n  views: {\n    engine: 'jade'\n  }\n});\n```\n\n`rc` will return your configuration options merged with the defaults you specify.\nIf you pass in a predefined defaults object, it will be mutated:\n\n```javascript\nvar conf = {};\nrequire('rc')(appname, conf);\n```\n\nIf `rc` finds any config files for your app, the returned config object will have\na `configs` array containing their paths:\n\n```javascript\nvar appCfg = require('rc')(appname, conf);\nappCfg.configs[0] // /etc/appnamerc\nappCfg.configs[1] // /home/dominictarr/.config/appname\nappCfg.config // same as appCfg.configs[appCfg.configs.length - 1]\n```\n\n## Standards\n\nGiven your application name (`appname`), rc will look in all the obvious places for configuration.\n\n  * command line arguments, parsed by minimist _(e.g. `--foo baz`, also nested: `--foo.bar=baz`)_\n  * environment variables prefixed with `${appname}_`\n    * or use \"\\_\\_\" to indicate nested properties <br/> _(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_\n  * if you passed an option `--config file` then from that file\n  * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc.\n  * `$HOME/.${appname}rc`\n  * `$HOME/.${appname}/config`\n  * `$HOME/.config/${appname}`\n  * `$HOME/.config/${appname}/config`\n  * `/etc/${appname}rc`\n  * `/etc/${appname}/config`\n  * the defaults object you passed in.\n\nAll configuration sources that were found will be flattened into one object,\nso that sources **earlier** in this list override later ones.\n\n\n## Configuration File Formats\n\nConfiguration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. **No** file extension (`.json` or `.ini`) should be used. The example configurations below are equivalent:\n\n\n#### Formatted as `ini`\n\n```\n; You can include comments in `ini` format if you want.\n\ndependsOn=0.10.0\n\n\n; `rc` has built-in support for ini sections, see?\n\n[commands]\n  www     = ./commands/www\n  console = ./commands/repl\n\n\n; You can even do nested sections\n\n[generators.options]\n  engine  = ejs\n\n[generators.modules]\n  new     = generate-new\n  engine  = generate-backend\n\n```\n\n#### Formatted as `json`\n\n```javascript\n{\n  // You can even comment your JSON, if you want\n  \"dependsOn\": \"0.10.0\",\n  \"commands\": {\n    \"www\": \"./commands/www\",\n    \"console\": \"./commands/repl\"\n  },\n  \"generators\": {\n    \"options\": {\n      \"engine\": \"ejs\"\n    },\n    \"modules\": {\n      \"new\": \"generate-new\",\n      \"backend\": \"generate-backend\"\n    }\n  }\n}\n```\n\nComments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).\n\n> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings.\n\nTo ensure that string representations of booleans and numbers are always converted into their proper types (especially useful if you intend to do strict `===` comparisons), consider using a module such as [parse-strings-in-object](https://github.com/anselanza/parse-strings-in-object) to wrap the config object returned from rc.\n\n\n## Simple example demonstrating precedence\nAssume you have an application like this (notice the hard-coded defaults passed to rc):\n```\nconst conf = require('rc')('myapp', {\n    port: 12345,\n    mode: 'test'\n});\n\nconsole.log(JSON.stringify(conf, null, 2));\n```\nYou also have a file `config.json`, with these contents:\n```\n{\n  \"port\": 9000,\n  \"foo\": \"from config json\",\n  \"something\": \"else\"\n}\n```\nAnd a file `.myapprc` in the same folder, with these contents:\n```\n{\n  \"port\": \"3001\",\n  \"foo\": \"bar\"\n}\n```\nHere is the expected output from various commands:\n\n`node .`\n```\n{\n  \"port\": \"3001\",\n  \"mode\": \"test\",\n  \"foo\": \"bar\",\n  \"_\": [],\n  \"configs\": [\n    \"/Users/stephen/repos/conftest/.myapprc\"\n  ],\n  \"config\": \"/Users/stephen/repos/conftest/.myapprc\"\n}\n```\n*Default `mode` from hard-coded object is retained, but port is overridden by `.myapprc` file (automatically found based on appname match), and `foo` is added.*\n\n\n`node . --foo baz`\n```\n{\n  \"port\": \"3001\",\n  \"mode\": \"test\",\n  \"foo\": \"baz\",\n  \"_\": [],\n  \"configs\": [\n    \"/Users/stephen/repos/conftest/.myapprc\"\n  ],\n  \"config\": \"/Users/stephen/repos/conftest/.myapprc\"\n}\n```\n*Same result as above but `foo` is overridden because command-line arguments take precedence over `.myapprc` file.*\n\n`node . --foo barbar --config config.json`\n```\n{\n  \"port\": 9000,\n  \"mode\": \"test\",\n  \"foo\": \"barbar\",\n  \"something\": \"else\",\n  \"_\": [],\n  \"config\": \"config.json\",\n  \"configs\": [\n    \"/Users/stephen/repos/conftest/.myapprc\",\n    \"config.json\"\n  ]\n}\n```\n*Now the `port` comes from the `config.json` file specified (overriding the value from `.myapprc`), and `foo` value is overriden by command-line despite also being specified in the `config.json` file.*\n \n\n\n## Advanced Usage\n\n#### Pass in your own `argv`\n\nYou may pass in your own `argv` as the third argument to `rc`.  This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12).\n\n```javascript\nrequire('rc')(appname, defaults, customArgvParser);\n```\n\n## Pass in your own parser\n\nIf you have a special need to use a non-standard parser,\nyou can do so by passing in the parser as the 4th argument.\n(leave the 3rd as null to get the default args parser)\n\n```javascript\nrequire('rc')(appname, defaults, null, parser);\n```\n\nThis may also be used to force a more strict format,\nsuch as strict, valid JSON only.\n\n## Note on Performance\n\n`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) \n\n\n## License\n\nMulti-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/dominictarr/rc.git"
-  },
-  "scripts": {
-    "test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js"
-  },
-  "version": "1.2.8"
-}
diff --git a/legacy-libs/grpc/node_modules/rc/test/ini.js b/legacy-libs/grpc/node_modules/rc/test/ini.js
deleted file mode 100644 (file)
index e6857f8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-var cc =require('../lib/utils')
-var INI = require('ini')
-var assert = require('assert')
-
-function test(obj) {
-
-  var _json, _ini
-  var json = cc.parse (_json = JSON.stringify(obj))
-  var ini = cc.parse (_ini = INI.stringify(obj))
-  console.log(_ini, _json)
-  assert.deepEqual(json, ini)
-}
-
-
-test({hello: true})
-
diff --git a/legacy-libs/grpc/node_modules/rc/test/nested-env-vars.js b/legacy-libs/grpc/node_modules/rc/test/nested-env-vars.js
deleted file mode 100644 (file)
index 0ecd176..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-
-var seed = Math.random();
-var n = 'rc'+ seed;
-var N = 'RC'+ seed;
-var assert = require('assert')
-
-
-// Basic usage
-process.env[n+'_someOpt__a'] = 42
-process.env[n+'_someOpt__x__'] = 99
-process.env[n+'_someOpt__a__b'] = 186
-process.env[n+'_someOpt__a__b__c'] = 243
-process.env[n+'_someOpt__x__y'] = 1862
-process.env[n+'_someOpt__z'] = 186577
-
-// Should ignore empty strings from orphaned '__'
-process.env[n+'_someOpt__z__x__'] = 18629
-process.env[n+'_someOpt__w__w__'] = 18629
-
-// Leading '__' should ignore everything up to 'z'
-process.env[n+'___z__i__'] = 9999
-
-// should ignore case for config name section.
-process.env[N+'_test_upperCase'] = 187
-
-function testPrefix(prefix) {
-       var config = require('../')(prefix, {
-         option: true
-       })
-
-       console.log('\n\n------ nested-env-vars ------\n',{prefix: prefix}, '\n', config);
-
-       assert.equal(config.option, true)
-       assert.equal(config.someOpt.a, 42)
-       assert.equal(config.someOpt.x, 99)
-       // Should not override `a` once it's been set
-       assert.equal(config.someOpt.a/*.b*/, 42)
-       // Should not override `x` once it's been set
-       assert.equal(config.someOpt.x/*.y*/, 99)
-       assert.equal(config.someOpt.z, 186577)
-       // Should not override `z` once it's been set
-       assert.equal(config.someOpt.z/*.x*/, 186577)
-       assert.equal(config.someOpt.w.w, 18629)
-       assert.equal(config.z.i, 9999)
-
-       assert.equal(config.test_upperCase, 187)
-}
-
-testPrefix(n);
-testPrefix(N);
diff --git a/legacy-libs/grpc/node_modules/rc/test/test.js b/legacy-libs/grpc/node_modules/rc/test/test.js
deleted file mode 100644 (file)
index 4f63351..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-
-var n = 'rc'+Math.random()
-var assert = require('assert')
-
-process.env[n+'_envOption'] = 42
-
-var config = require('../')(n, {
-  option: true
-})
-
-console.log(config)
-
-assert.equal(config.option, true)
-assert.equal(config.envOption, 42)
-
-var customArgv = require('../')(n, {
-  option: true
-}, { // nopt-like argv
-  option: false,
-  envOption: 24,
-  argv: {
-    remain: [],
-    cooked: ['--no-option', '--envOption', '24'],
-    original: ['--no-option', '--envOption=24']
-  }
-})
-
-console.log(customArgv)
-
-assert.equal(customArgv.option, false)
-assert.equal(customArgv.envOption, 24)
-
-var fs = require('fs')
-var path = require('path')
-var jsonrc = path.resolve('.' + n + 'rc');
-
-fs.writeFileSync(jsonrc, [
-  '{',
-    '// json overrides default',
-    '"option": false,',
-    '/* env overrides json */',
-    '"envOption": 24',
-  '}'
-].join('\n'));
-
-var commentedJSON = require('../')(n, {
-  option: true
-})
-
-fs.unlinkSync(jsonrc);
-
-console.log(commentedJSON)
-
-assert.equal(commentedJSON.option, false)
-assert.equal(commentedJSON.envOption, 42)
-
-assert.equal(commentedJSON.config, jsonrc)
-assert.equal(commentedJSON.configs.length, 1)
-assert.equal(commentedJSON.configs[0], jsonrc)
diff --git a/legacy-libs/grpc/node_modules/readable-stream/CONTRIBUTING.md b/legacy-libs/grpc/node_modules/readable-stream/CONTRIBUTING.md
deleted file mode 100644 (file)
index f478d58..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-* (a) The contribution was created in whole or in part by me and I
-  have the right to submit it under the open source license
-  indicated in the file; or
-
-* (b) The contribution is based upon previous work that, to the best
-  of my knowledge, is covered under an appropriate open source
-  license and I have the right under that license to submit that
-  work with modifications, whether created in whole or in part
-  by me, under the same open source license (unless I am
-  permitted to submit under a different license), as indicated
-  in the file; or
-
-* (c) The contribution was provided directly to me by some other
-  person who certified (a), (b) or (c) and I have not modified
-  it.
-
-* (d) I understand and agree that this project and the contribution
-  are public and that a record of the contribution (including all
-  personal information I submit with it, including my sign-off) is
-  maintained indefinitely and may be redistributed consistent with
-  this project or the open source license(s) involved.
-
-## Moderation Policy
-
-The [Node.js Moderation Policy] applies to this WG.
-
-## Code of Conduct
-
-The [Node.js Code of Conduct][] applies to this WG.
-
-[Node.js Code of Conduct]:
-https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
-[Node.js Moderation Policy]:
-https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
diff --git a/legacy-libs/grpc/node_modules/readable-stream/GOVERNANCE.md b/legacy-libs/grpc/node_modules/readable-stream/GOVERNANCE.md
deleted file mode 100644 (file)
index 16ffb93..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-### Streams Working Group
-
-The Node.js Streams is jointly governed by a Working Group
-(WG)
-that is responsible for high-level guidance of the project.
-
-The WG has final authority over this project including:
-
-* Technical direction
-* Project governance and process (including this policy)
-* Contribution policy
-* GitHub repository hosting
-* Conduct guidelines
-* Maintaining the list of additional Collaborators
-
-For the current list of WG members, see the project
-[README.md](./README.md#current-project-team-members).
-
-### Collaborators
-
-The readable-stream GitHub repository is
-maintained by the WG and additional Collaborators who are added by the
-WG on an ongoing basis.
-
-Individuals making significant and valuable contributions are made
-Collaborators and given commit-access to the project. These
-individuals are identified by the WG and their addition as
-Collaborators is discussed during the WG meeting.
-
-_Note:_ If you make a significant contribution and are not considered
-for commit-access log an issue or contact a WG member directly and it
-will be brought up in the next WG meeting.
-
-Modifications of the contents of the readable-stream repository are
-made on
-a collaborative basis. Anybody with a GitHub account may propose a
-modification via pull request and it will be considered by the project
-Collaborators. All pull requests must be reviewed and accepted by a
-Collaborator with sufficient expertise who is able to take full
-responsibility for the change. In the case of pull requests proposed
-by an existing Collaborator, an additional Collaborator is required
-for sign-off. Consensus should be sought if additional Collaborators
-participate and there is disagreement around a particular
-modification. See _Consensus Seeking Process_ below for further detail
-on the consensus model used for governance.
-
-Collaborators may opt to elevate significant or controversial
-modifications, or modifications that have not found consensus to the
-WG for discussion by assigning the ***WG-agenda*** tag to a pull
-request or issue. The WG should serve as the final arbiter where
-required.
-
-For the current list of Collaborators, see the project
-[README.md](./README.md#members).
-
-### WG Membership
-
-WG seats are not time-limited.  There is no fixed size of the WG.
-However, the expected target is between 6 and 12, to ensure adequate
-coverage of important areas of expertise, balanced with the ability to
-make decisions efficiently.
-
-There is no specific set of requirements or qualifications for WG
-membership beyond these rules.
-
-The WG may add additional members to the WG by unanimous consensus.
-
-A WG member may be removed from the WG by voluntary resignation, or by
-unanimous consensus of all other WG members.
-
-Changes to WG membership should be posted in the agenda, and may be
-suggested as any other agenda item (see "WG Meetings" below).
-
-If an addition or removal is proposed during a meeting, and the full
-WG is not in attendance to participate, then the addition or removal
-is added to the agenda for the subsequent meeting.  This is to ensure
-that all members are given the opportunity to participate in all
-membership decisions.  If a WG member is unable to attend a meeting
-where a planned membership decision is being made, then their consent
-is assumed.
-
-No more than 1/3 of the WG members may be affiliated with the same
-employer.  If removal or resignation of a WG member, or a change of
-employment by a WG member, creates a situation where more than 1/3 of
-the WG membership shares an employer, then the situation must be
-immediately remedied by the resignation or removal of one or more WG
-members affiliated with the over-represented employer(s).
-
-### WG Meetings
-
-The WG meets occasionally on a Google Hangout On Air. A designated moderator
-approved by the WG runs the meeting. Each meeting should be
-published to YouTube.
-
-Items are added to the WG agenda that are considered contentious or
-are modifications of governance, contribution policy, WG membership,
-or release process.
-
-The intention of the agenda is not to approve or review all patches;
-that should happen continuously on GitHub and be handled by the larger
-group of Collaborators.
-
-Any community member or contributor can ask that something be added to
-the next meeting's agenda by logging a GitHub Issue. Any Collaborator,
-WG member or the moderator can add the item to the agenda by adding
-the ***WG-agenda*** tag to the issue.
-
-Prior to each WG meeting the moderator will share the Agenda with
-members of the WG. WG members can add any items they like to the
-agenda at the beginning of each meeting. The moderator and the WG
-cannot veto or remove items.
-
-The WG may invite persons or representatives from certain projects to
-participate in a non-voting capacity.
-
-The moderator is responsible for summarizing the discussion of each
-agenda item and sends it as a pull request after the meeting.
-
-### Consensus Seeking Process
-
-The WG follows a
-[Consensus
-Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making)
-decision-making model.
-
-When an agenda item has appeared to reach a consensus the moderator
-will ask "Does anyone object?" as a final call for dissent from the
-consensus.
-
-If an agenda item cannot reach a consensus a WG member can call for
-either a closing vote or a vote to table the issue to the next
-meeting. The call for a vote must be seconded by a majority of the WG
-or else the discussion will continue. Simple majority wins.
-
-Note that changes to WG membership require a majority consensus.  See
-"WG Membership" above.
diff --git a/legacy-libs/grpc/node_modules/readable-stream/LICENSE b/legacy-libs/grpc/node_modules/readable-stream/LICENSE
deleted file mode 100644 (file)
index 2873b3b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-Node.js is licensed for use as follows:
-
-"""
-Copyright Node.js contributors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-"""
-
-This license applies to parts of Node.js originating from the
-https://github.com/joyent/node repository:
-
-"""
-Copyright Joyent, Inc. and other Node contributors. All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-"""
diff --git a/legacy-libs/grpc/node_modules/readable-stream/README.md b/legacy-libs/grpc/node_modules/readable-stream/README.md
deleted file mode 100644 (file)
index 23fe3f3..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# readable-stream
-
-***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
-
-
-[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
-[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
-
-
-[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)
-
-```bash
-npm install --save readable-stream
-```
-
-***Node-core streams for userland***
-
-This package is a mirror of the Streams2 and Streams3 implementations in
-Node-core.
-
-Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html).
-
-If you want to guarantee a stable streams base, regardless of what version of
-Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
-
-As of version 2.0.0 **readable-stream** uses semantic versioning.
-
-# Streams Working Group
-
-`readable-stream` is maintained by the Streams Working Group, which
-oversees the development and maintenance of the Streams API within
-Node.js. The responsibilities of the Streams Working Group include:
-
-* Addressing stream issues on the Node.js issue tracker.
-* Authoring and editing stream documentation within the Node.js project.
-* Reviewing changes to stream subclasses within the Node.js project.
-* Redirecting changes to streams from the Node.js project to this
-  project.
-* Assisting in the implementation of stream providers within Node.js.
-* Recommending versions of `readable-stream` to be included in Node.js.
-* Messaging about the future of streams to give the community advance
-  notice of changes.
-
-<a name="members"></a>
-## Team Members
-
-* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
-  - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
-* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;
-  - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
-* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;
-  - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
-* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
-* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
-* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
-* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) &lt;matteo.collina@gmail.com&gt;
-  - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
-* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) &lt;shestak.irina@gmail.com&gt;
diff --git a/legacy-libs/grpc/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/legacy-libs/grpc/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
deleted file mode 100644 (file)
index 83275f1..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# streams WG Meeting 2015-01-30
-
-## Links
-
-* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg
-* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106
-* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/
-
-## Agenda
-
-Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting.
-
-* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105)
-* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101)
-* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102)
-* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99)
-
-## Minutes
-
-### adopt a charter
-
-* group: +1's all around
-
-### What versioning scheme should be adopted?
-* group: +1’s 3.0.0
-* domenic+group: pulling in patches from other sources where appropriate
-* mikeal: version independently, suggesting versions for io.js
-* mikeal+domenic: work with TC to notify in advance of changes
-simpler stream creation
-
-### streamline creation of streams
-* sam: streamline creation of streams
-* domenic: nice simple solution posted
-  but, we lose the opportunity to change the model
-  may not be backwards incompatible (double check keys)
-
-  **action item:** domenic will check
-
-### remove implicit flowing of streams on(‘data’)
-* add isFlowing / isPaused
-* mikeal: worrying that we’re documenting polyfill methods – confuses users
-* domenic: more reflective API is probably good, with warning labels for users
-* new section for mad scientists (reflective stream access)
-* calvin: name the “third state”
-* mikeal: maybe borrow the name from whatwg?
-* domenic: we’re missing the “third state”
-* consensus: kind of difficult to name the third state
-* mikeal: figure out differences in states / compat
-* mathias: always flow on data – eliminates third state
-  * explore what it breaks
-
-**action items:**
-* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream)
-* ask rod/build for infrastructure
-* **chris**: explore the “flow on data” approach
-* add isPaused/isFlowing
-* add new docs section
-* move isPaused to that section
-
-
diff --git a/legacy-libs/grpc/node_modules/readable-stream/duplex-browser.js b/legacy-libs/grpc/node_modules/readable-stream/duplex-browser.js
deleted file mode 100644 (file)
index f8b2db8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib/_stream_duplex.js');
diff --git a/legacy-libs/grpc/node_modules/readable-stream/duplex.js b/legacy-libs/grpc/node_modules/readable-stream/duplex.js
deleted file mode 100644 (file)
index 46924cb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./readable').Duplex
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_duplex.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_duplex.js
deleted file mode 100644 (file)
index a1ca813..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// a duplex stream is just a stream that is both readable and writable.
-// Since JS doesn't have multiple prototypal inheritance, this class
-// prototypally inherits from Readable, and then parasitically from
-// Writable.
-
-'use strict';
-
-/*<replacement>*/
-
-var pna = require('process-nextick-args');
-/*</replacement>*/
-
-/*<replacement>*/
-var objectKeys = Object.keys || function (obj) {
-  var keys = [];
-  for (var key in obj) {
-    keys.push(key);
-  }return keys;
-};
-/*</replacement>*/
-
-module.exports = Duplex;
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-var Readable = require('./_stream_readable');
-var Writable = require('./_stream_writable');
-
-util.inherits(Duplex, Readable);
-
-{
-  // avoid scope creep, the keys array can then be collected
-  var keys = objectKeys(Writable.prototype);
-  for (var v = 0; v < keys.length; v++) {
-    var method = keys[v];
-    if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
-  }
-}
-
-function Duplex(options) {
-  if (!(this instanceof Duplex)) return new Duplex(options);
-
-  Readable.call(this, options);
-  Writable.call(this, options);
-
-  if (options && options.readable === false) this.readable = false;
-
-  if (options && options.writable === false) this.writable = false;
-
-  this.allowHalfOpen = true;
-  if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
-
-  this.once('end', onend);
-}
-
-Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
-  // making it explicit this property is not enumerable
-  // because otherwise some prototype manipulation in
-  // userland will fail
-  enumerable: false,
-  get: function () {
-    return this._writableState.highWaterMark;
-  }
-});
-
-// the no-half-open enforcer
-function onend() {
-  // if we allow half-open state, or if the writable side ended,
-  // then we're ok.
-  if (this.allowHalfOpen || this._writableState.ended) return;
-
-  // no more data can be written.
-  // But allow more writes to happen in this tick.
-  pna.nextTick(onEndNT, this);
-}
-
-function onEndNT(self) {
-  self.end();
-}
-
-Object.defineProperty(Duplex.prototype, 'destroyed', {
-  get: function () {
-    if (this._readableState === undefined || this._writableState === undefined) {
-      return false;
-    }
-    return this._readableState.destroyed && this._writableState.destroyed;
-  },
-  set: function (value) {
-    // we ignore the value if the stream
-    // has not been initialized yet
-    if (this._readableState === undefined || this._writableState === undefined) {
-      return;
-    }
-
-    // backward compatibility, the user is explicitly
-    // managing destroyed
-    this._readableState.destroyed = value;
-    this._writableState.destroyed = value;
-  }
-});
-
-Duplex.prototype._destroy = function (err, cb) {
-  this.push(null);
-  this.end();
-
-  pna.nextTick(cb, err);
-};
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_passthrough.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_passthrough.js
deleted file mode 100644 (file)
index a9c8358..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// a passthrough stream.
-// basically just the most minimal sort of Transform stream.
-// Every written chunk gets output as-is.
-
-'use strict';
-
-module.exports = PassThrough;
-
-var Transform = require('./_stream_transform');
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-util.inherits(PassThrough, Transform);
-
-function PassThrough(options) {
-  if (!(this instanceof PassThrough)) return new PassThrough(options);
-
-  Transform.call(this, options);
-}
-
-PassThrough.prototype._transform = function (chunk, encoding, cb) {
-  cb(null, chunk);
-};
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_readable.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_readable.js
deleted file mode 100644 (file)
index bf34ac6..0000000
+++ /dev/null
@@ -1,1019 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-
-/*<replacement>*/
-
-var pna = require('process-nextick-args');
-/*</replacement>*/
-
-module.exports = Readable;
-
-/*<replacement>*/
-var isArray = require('isarray');
-/*</replacement>*/
-
-/*<replacement>*/
-var Duplex;
-/*</replacement>*/
-
-Readable.ReadableState = ReadableState;
-
-/*<replacement>*/
-var EE = require('events').EventEmitter;
-
-var EElistenerCount = function (emitter, type) {
-  return emitter.listeners(type).length;
-};
-/*</replacement>*/
-
-/*<replacement>*/
-var Stream = require('./internal/streams/stream');
-/*</replacement>*/
-
-/*<replacement>*/
-
-var Buffer = require('safe-buffer').Buffer;
-var OurUint8Array = global.Uint8Array || function () {};
-function _uint8ArrayToBuffer(chunk) {
-  return Buffer.from(chunk);
-}
-function _isUint8Array(obj) {
-  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
-}
-
-/*</replacement>*/
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-/*<replacement>*/
-var debugUtil = require('util');
-var debug = void 0;
-if (debugUtil && debugUtil.debuglog) {
-  debug = debugUtil.debuglog('stream');
-} else {
-  debug = function () {};
-}
-/*</replacement>*/
-
-var BufferList = require('./internal/streams/BufferList');
-var destroyImpl = require('./internal/streams/destroy');
-var StringDecoder;
-
-util.inherits(Readable, Stream);
-
-var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
-
-function prependListener(emitter, event, fn) {
-  // Sadly this is not cacheable as some libraries bundle their own
-  // event emitter implementation with them.
-  if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
-
-  // This is a hack to make sure that our error handler is attached before any
-  // userland ones.  NEVER DO THIS. This is here only because this code needs
-  // to continue to work with older versions of Node.js that do not include
-  // the prependListener() method. The goal is to eventually remove this hack.
-  if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
-}
-
-function ReadableState(options, stream) {
-  Duplex = Duplex || require('./_stream_duplex');
-
-  options = options || {};
-
-  // Duplex streams are both readable and writable, but share
-  // the same options object.
-  // However, some cases require setting options to different
-  // values for the readable and the writable sides of the duplex stream.
-  // These options can be provided separately as readableXXX and writableXXX.
-  var isDuplex = stream instanceof Duplex;
-
-  // object stream flag. Used to make read(n) ignore n and to
-  // make all the buffer merging and length checks go away
-  this.objectMode = !!options.objectMode;
-
-  if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
-
-  // the point at which it stops calling _read() to fill the buffer
-  // Note: 0 is a valid value, means "don't call _read preemptively ever"
-  var hwm = options.highWaterMark;
-  var readableHwm = options.readableHighWaterMark;
-  var defaultHwm = this.objectMode ? 16 : 16 * 1024;
-
-  if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
-
-  // cast to ints.
-  this.highWaterMark = Math.floor(this.highWaterMark);
-
-  // A linked list is used to store data chunks instead of an array because the
-  // linked list can remove elements from the beginning faster than
-  // array.shift()
-  this.buffer = new BufferList();
-  this.length = 0;
-  this.pipes = null;
-  this.pipesCount = 0;
-  this.flowing = null;
-  this.ended = false;
-  this.endEmitted = false;
-  this.reading = false;
-
-  // a flag to be able to tell if the event 'readable'/'data' is emitted
-  // immediately, or on a later tick.  We set this to true at first, because
-  // any actions that shouldn't happen until "later" should generally also
-  // not happen before the first read call.
-  this.sync = true;
-
-  // whenever we return null, then we set a flag to say
-  // that we're awaiting a 'readable' event emission.
-  this.needReadable = false;
-  this.emittedReadable = false;
-  this.readableListening = false;
-  this.resumeScheduled = false;
-
-  // has it been destroyed
-  this.destroyed = false;
-
-  // Crypto is kind of old and crusty.  Historically, its default string
-  // encoding is 'binary' so we have to make this configurable.
-  // Everything else in the universe uses 'utf8', though.
-  this.defaultEncoding = options.defaultEncoding || 'utf8';
-
-  // the number of writers that are awaiting a drain event in .pipe()s
-  this.awaitDrain = 0;
-
-  // if true, a maybeReadMore has been scheduled
-  this.readingMore = false;
-
-  this.decoder = null;
-  this.encoding = null;
-  if (options.encoding) {
-    if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
-    this.decoder = new StringDecoder(options.encoding);
-    this.encoding = options.encoding;
-  }
-}
-
-function Readable(options) {
-  Duplex = Duplex || require('./_stream_duplex');
-
-  if (!(this instanceof Readable)) return new Readable(options);
-
-  this._readableState = new ReadableState(options, this);
-
-  // legacy
-  this.readable = true;
-
-  if (options) {
-    if (typeof options.read === 'function') this._read = options.read;
-
-    if (typeof options.destroy === 'function') this._destroy = options.destroy;
-  }
-
-  Stream.call(this);
-}
-
-Object.defineProperty(Readable.prototype, 'destroyed', {
-  get: function () {
-    if (this._readableState === undefined) {
-      return false;
-    }
-    return this._readableState.destroyed;
-  },
-  set: function (value) {
-    // we ignore the value if the stream
-    // has not been initialized yet
-    if (!this._readableState) {
-      return;
-    }
-
-    // backward compatibility, the user is explicitly
-    // managing destroyed
-    this._readableState.destroyed = value;
-  }
-});
-
-Readable.prototype.destroy = destroyImpl.destroy;
-Readable.prototype._undestroy = destroyImpl.undestroy;
-Readable.prototype._destroy = function (err, cb) {
-  this.push(null);
-  cb(err);
-};
-
-// Manually shove something into the read() buffer.
-// This returns true if the highWaterMark has not been hit yet,
-// similar to how Writable.write() returns true if you should
-// write() some more.
-Readable.prototype.push = function (chunk, encoding) {
-  var state = this._readableState;
-  var skipChunkCheck;
-
-  if (!state.objectMode) {
-    if (typeof chunk === 'string') {
-      encoding = encoding || state.defaultEncoding;
-      if (encoding !== state.encoding) {
-        chunk = Buffer.from(chunk, encoding);
-        encoding = '';
-      }
-      skipChunkCheck = true;
-    }
-  } else {
-    skipChunkCheck = true;
-  }
-
-  return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
-};
-
-// Unshift should *always* be something directly out of read()
-Readable.prototype.unshift = function (chunk) {
-  return readableAddChunk(this, chunk, null, true, false);
-};
-
-function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
-  var state = stream._readableState;
-  if (chunk === null) {
-    state.reading = false;
-    onEofChunk(stream, state);
-  } else {
-    var er;
-    if (!skipChunkCheck) er = chunkInvalid(state, chunk);
-    if (er) {
-      stream.emit('error', er);
-    } else if (state.objectMode || chunk && chunk.length > 0) {
-      if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
-        chunk = _uint8ArrayToBuffer(chunk);
-      }
-
-      if (addToFront) {
-        if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
-      } else if (state.ended) {
-        stream.emit('error', new Error('stream.push() after EOF'));
-      } else {
-        state.reading = false;
-        if (state.decoder && !encoding) {
-          chunk = state.decoder.write(chunk);
-          if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
-        } else {
-          addChunk(stream, state, chunk, false);
-        }
-      }
-    } else if (!addToFront) {
-      state.reading = false;
-    }
-  }
-
-  return needMoreData(state);
-}
-
-function addChunk(stream, state, chunk, addToFront) {
-  if (state.flowing && state.length === 0 && !state.sync) {
-    stream.emit('data', chunk);
-    stream.read(0);
-  } else {
-    // update the buffer info.
-    state.length += state.objectMode ? 1 : chunk.length;
-    if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
-
-    if (state.needReadable) emitReadable(stream);
-  }
-  maybeReadMore(stream, state);
-}
-
-function chunkInvalid(state, chunk) {
-  var er;
-  if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
-    er = new TypeError('Invalid non-string/buffer chunk');
-  }
-  return er;
-}
-
-// if it's past the high water mark, we can push in some more.
-// Also, if we have no data yet, we can stand some
-// more bytes.  This is to work around cases where hwm=0,
-// such as the repl.  Also, if the push() triggered a
-// readable event, and the user called read(largeNumber) such that
-// needReadable was set, then we ought to push more, so that another
-// 'readable' event will be triggered.
-function needMoreData(state) {
-  return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
-}
-
-Readable.prototype.isPaused = function () {
-  return this._readableState.flowing === false;
-};
-
-// backwards compatibility.
-Readable.prototype.setEncoding = function (enc) {
-  if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
-  this._readableState.decoder = new StringDecoder(enc);
-  this._readableState.encoding = enc;
-  return this;
-};
-
-// Don't raise the hwm > 8MB
-var MAX_HWM = 0x800000;
-function computeNewHighWaterMark(n) {
-  if (n >= MAX_HWM) {
-    n = MAX_HWM;
-  } else {
-    // Get the next highest power of 2 to prevent increasing hwm excessively in
-    // tiny amounts
-    n--;
-    n |= n >>> 1;
-    n |= n >>> 2;
-    n |= n >>> 4;
-    n |= n >>> 8;
-    n |= n >>> 16;
-    n++;
-  }
-  return n;
-}
-
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function howMuchToRead(n, state) {
-  if (n <= 0 || state.length === 0 && state.ended) return 0;
-  if (state.objectMode) return 1;
-  if (n !== n) {
-    // Only flow one buffer at a time
-    if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
-  }
-  // If we're asking for more than the current hwm, then raise the hwm.
-  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
-  if (n <= state.length) return n;
-  // Don't have enough
-  if (!state.ended) {
-    state.needReadable = true;
-    return 0;
-  }
-  return state.length;
-}
-
-// you can override either this method, or the async _read(n) below.
-Readable.prototype.read = function (n) {
-  debug('read', n);
-  n = parseInt(n, 10);
-  var state = this._readableState;
-  var nOrig = n;
-
-  if (n !== 0) state.emittedReadable = false;
-
-  // if we're doing read(0) to trigger a readable event, but we
-  // already have a bunch of data in the buffer, then just trigger
-  // the 'readable' event and move on.
-  if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
-    debug('read: emitReadable', state.length, state.ended);
-    if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
-    return null;
-  }
-
-  n = howMuchToRead(n, state);
-
-  // if we've ended, and we're now clear, then finish it up.
-  if (n === 0 && state.ended) {
-    if (state.length === 0) endReadable(this);
-    return null;
-  }
-
-  // All the actual chunk generation logic needs to be
-  // *below* the call to _read.  The reason is that in certain
-  // synthetic stream cases, such as passthrough streams, _read
-  // may be a completely synchronous operation which may change
-  // the state of the read buffer, providing enough data when
-  // before there was *not* enough.
-  //
-  // So, the steps are:
-  // 1. Figure out what the state of things will be after we do
-  // a read from the buffer.
-  //
-  // 2. If that resulting state will trigger a _read, then call _read.
-  // Note that this may be asynchronous, or synchronous.  Yes, it is
-  // deeply ugly to write APIs this way, but that still doesn't mean
-  // that the Readable class should behave improperly, as streams are
-  // designed to be sync/async agnostic.
-  // Take note if the _read call is sync or async (ie, if the read call
-  // has returned yet), so that we know whether or not it's safe to emit
-  // 'readable' etc.
-  //
-  // 3. Actually pull the requested chunks out of the buffer and return.
-
-  // if we need a readable event, then we need to do some reading.
-  var doRead = state.needReadable;
-  debug('need readable', doRead);
-
-  // if we currently have less than the highWaterMark, then also read some
-  if (state.length === 0 || state.length - n < state.highWaterMark) {
-    doRead = true;
-    debug('length less than watermark', doRead);
-  }
-
-  // however, if we've ended, then there's no point, and if we're already
-  // reading, then it's unnecessary.
-  if (state.ended || state.reading) {
-    doRead = false;
-    debug('reading or ended', doRead);
-  } else if (doRead) {
-    debug('do read');
-    state.reading = true;
-    state.sync = true;
-    // if the length is currently zero, then we *need* a readable event.
-    if (state.length === 0) state.needReadable = true;
-    // call internal read method
-    this._read(state.highWaterMark);
-    state.sync = false;
-    // If _read pushed data synchronously, then `reading` will be false,
-    // and we need to re-evaluate how much data we can return to the user.
-    if (!state.reading) n = howMuchToRead(nOrig, state);
-  }
-
-  var ret;
-  if (n > 0) ret = fromList(n, state);else ret = null;
-
-  if (ret === null) {
-    state.needReadable = true;
-    n = 0;
-  } else {
-    state.length -= n;
-  }
-
-  if (state.length === 0) {
-    // If we have nothing in the buffer, then we want to know
-    // as soon as we *do* get something into the buffer.
-    if (!state.ended) state.needReadable = true;
-
-    // If we tried to read() past the EOF, then emit end on the next tick.
-    if (nOrig !== n && state.ended) endReadable(this);
-  }
-
-  if (ret !== null) this.emit('data', ret);
-
-  return ret;
-};
-
-function onEofChunk(stream, state) {
-  if (state.ended) return;
-  if (state.decoder) {
-    var chunk = state.decoder.end();
-    if (chunk && chunk.length) {
-      state.buffer.push(chunk);
-      state.length += state.objectMode ? 1 : chunk.length;
-    }
-  }
-  state.ended = true;
-
-  // emit 'readable' now to make sure it gets picked up.
-  emitReadable(stream);
-}
-
-// Don't emit readable right away in sync mode, because this can trigger
-// another read() call => stack overflow.  This way, it might trigger
-// a nextTick recursion warning, but that's not so bad.
-function emitReadable(stream) {
-  var state = stream._readableState;
-  state.needReadable = false;
-  if (!state.emittedReadable) {
-    debug('emitReadable', state.flowing);
-    state.emittedReadable = true;
-    if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
-  }
-}
-
-function emitReadable_(stream) {
-  debug('emit readable');
-  stream.emit('readable');
-  flow(stream);
-}
-
-// at this point, the user has presumably seen the 'readable' event,
-// and called read() to consume some data.  that may have triggered
-// in turn another _read(n) call, in which case reading = true if
-// it's in progress.
-// However, if we're not ended, or reading, and the length < hwm,
-// then go ahead and try to read some more preemptively.
-function maybeReadMore(stream, state) {
-  if (!state.readingMore) {
-    state.readingMore = true;
-    pna.nextTick(maybeReadMore_, stream, state);
-  }
-}
-
-function maybeReadMore_(stream, state) {
-  var len = state.length;
-  while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
-    debug('maybeReadMore read 0');
-    stream.read(0);
-    if (len === state.length)
-      // didn't get any data, stop spinning.
-      break;else len = state.length;
-  }
-  state.readingMore = false;
-}
-
-// abstract method.  to be overridden in specific implementation classes.
-// call cb(er, data) where data is <= n in length.
-// for virtual (non-string, non-buffer) streams, "length" is somewhat
-// arbitrary, and perhaps not very meaningful.
-Readable.prototype._read = function (n) {
-  this.emit('error', new Error('_read() is not implemented'));
-};
-
-Readable.prototype.pipe = function (dest, pipeOpts) {
-  var src = this;
-  var state = this._readableState;
-
-  switch (state.pipesCount) {
-    case 0:
-      state.pipes = dest;
-      break;
-    case 1:
-      state.pipes = [state.pipes, dest];
-      break;
-    default:
-      state.pipes.push(dest);
-      break;
-  }
-  state.pipesCount += 1;
-  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
-
-  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
-
-  var endFn = doEnd ? onend : unpipe;
-  if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
-
-  dest.on('unpipe', onunpipe);
-  function onunpipe(readable, unpipeInfo) {
-    debug('onunpipe');
-    if (readable === src) {
-      if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
-        unpipeInfo.hasUnpiped = true;
-        cleanup();
-      }
-    }
-  }
-
-  function onend() {
-    debug('onend');
-    dest.end();
-  }
-
-  // when the dest drains, it reduces the awaitDrain counter
-  // on the source.  This would be more elegant with a .once()
-  // handler in flow(), but adding and removing repeatedly is
-  // too slow.
-  var ondrain = pipeOnDrain(src);
-  dest.on('drain', ondrain);
-
-  var cleanedUp = false;
-  function cleanup() {
-    debug('cleanup');
-    // cleanup event handlers once the pipe is broken
-    dest.removeListener('close', onclose);
-    dest.removeListener('finish', onfinish);
-    dest.removeListener('drain', ondrain);
-    dest.removeListener('error', onerror);
-    dest.removeListener('unpipe', onunpipe);
-    src.removeListener('end', onend);
-    src.removeListener('end', unpipe);
-    src.removeListener('data', ondata);
-
-    cleanedUp = true;
-
-    // if the reader is waiting for a drain event from this
-    // specific writer, then it would cause it to never start
-    // flowing again.
-    // So, if this is awaiting a drain, then we just call it now.
-    // If we don't know, then assume that we are waiting for one.
-    if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
-  }
-
-  // If the user pushes more data while we're writing to dest then we'll end up
-  // in ondata again. However, we only want to increase awaitDrain once because
-  // dest will only emit one 'drain' event for the multiple writes.
-  // => Introduce a guard on increasing awaitDrain.
-  var increasedAwaitDrain = false;
-  src.on('data', ondata);
-  function ondata(chunk) {
-    debug('ondata');
-    increasedAwaitDrain = false;
-    var ret = dest.write(chunk);
-    if (false === ret && !increasedAwaitDrain) {
-      // If the user unpiped during `dest.write()`, it is possible
-      // to get stuck in a permanently paused state if that write
-      // also returned false.
-      // => Check whether `dest` is still a piping destination.
-      if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
-        debug('false write response, pause', src._readableState.awaitDrain);
-        src._readableState.awaitDrain++;
-        increasedAwaitDrain = true;
-      }
-      src.pause();
-    }
-  }
-
-  // if the dest has an error, then stop piping into it.
-  // however, don't suppress the throwing behavior for this.
-  function onerror(er) {
-    debug('onerror', er);
-    unpipe();
-    dest.removeListener('error', onerror);
-    if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
-  }
-
-  // Make sure our error handler is attached before userland ones.
-  prependListener(dest, 'error', onerror);
-
-  // Both close and finish should trigger unpipe, but only once.
-  function onclose() {
-    dest.removeListener('finish', onfinish);
-    unpipe();
-  }
-  dest.once('close', onclose);
-  function onfinish() {
-    debug('onfinish');
-    dest.removeListener('close', onclose);
-    unpipe();
-  }
-  dest.once('finish', onfinish);
-
-  function unpipe() {
-    debug('unpipe');
-    src.unpipe(dest);
-  }
-
-  // tell the dest that it's being piped to
-  dest.emit('pipe', src);
-
-  // start the flow if it hasn't been started already.
-  if (!state.flowing) {
-    debug('pipe resume');
-    src.resume();
-  }
-
-  return dest;
-};
-
-function pipeOnDrain(src) {
-  return function () {
-    var state = src._readableState;
-    debug('pipeOnDrain', state.awaitDrain);
-    if (state.awaitDrain) state.awaitDrain--;
-    if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
-      state.flowing = true;
-      flow(src);
-    }
-  };
-}
-
-Readable.prototype.unpipe = function (dest) {
-  var state = this._readableState;
-  var unpipeInfo = { hasUnpiped: false };
-
-  // if we're not piping anywhere, then do nothing.
-  if (state.pipesCount === 0) return this;
-
-  // just one destination.  most common case.
-  if (state.pipesCount === 1) {
-    // passed in one, but it's not the right one.
-    if (dest && dest !== state.pipes) return this;
-
-    if (!dest) dest = state.pipes;
-
-    // got a match.
-    state.pipes = null;
-    state.pipesCount = 0;
-    state.flowing = false;
-    if (dest) dest.emit('unpipe', this, unpipeInfo);
-    return this;
-  }
-
-  // slow case. multiple pipe destinations.
-
-  if (!dest) {
-    // remove all.
-    var dests = state.pipes;
-    var len = state.pipesCount;
-    state.pipes = null;
-    state.pipesCount = 0;
-    state.flowing = false;
-
-    for (var i = 0; i < len; i++) {
-      dests[i].emit('unpipe', this, unpipeInfo);
-    }return this;
-  }
-
-  // try to find the right one.
-  var index = indexOf(state.pipes, dest);
-  if (index === -1) return this;
-
-  state.pipes.splice(index, 1);
-  state.pipesCount -= 1;
-  if (state.pipesCount === 1) state.pipes = state.pipes[0];
-
-  dest.emit('unpipe', this, unpipeInfo);
-
-  return this;
-};
-
-// set up data events if they are asked for
-// Ensure readable listeners eventually get something
-Readable.prototype.on = function (ev, fn) {
-  var res = Stream.prototype.on.call(this, ev, fn);
-
-  if (ev === 'data') {
-    // Start flowing on next tick if stream isn't explicitly paused
-    if (this._readableState.flowing !== false) this.resume();
-  } else if (ev === 'readable') {
-    var state = this._readableState;
-    if (!state.endEmitted && !state.readableListening) {
-      state.readableListening = state.needReadable = true;
-      state.emittedReadable = false;
-      if (!state.reading) {
-        pna.nextTick(nReadingNextTick, this);
-      } else if (state.length) {
-        emitReadable(this);
-      }
-    }
-  }
-
-  return res;
-};
-Readable.prototype.addListener = Readable.prototype.on;
-
-function nReadingNextTick(self) {
-  debug('readable nexttick read 0');
-  self.read(0);
-}
-
-// pause() and resume() are remnants of the legacy readable stream API
-// If the user uses them, then switch into old mode.
-Readable.prototype.resume = function () {
-  var state = this._readableState;
-  if (!state.flowing) {
-    debug('resume');
-    state.flowing = true;
-    resume(this, state);
-  }
-  return this;
-};
-
-function resume(stream, state) {
-  if (!state.resumeScheduled) {
-    state.resumeScheduled = true;
-    pna.nextTick(resume_, stream, state);
-  }
-}
-
-function resume_(stream, state) {
-  if (!state.reading) {
-    debug('resume read 0');
-    stream.read(0);
-  }
-
-  state.resumeScheduled = false;
-  state.awaitDrain = 0;
-  stream.emit('resume');
-  flow(stream);
-  if (state.flowing && !state.reading) stream.read(0);
-}
-
-Readable.prototype.pause = function () {
-  debug('call pause flowing=%j', this._readableState.flowing);
-  if (false !== this._readableState.flowing) {
-    debug('pause');
-    this._readableState.flowing = false;
-    this.emit('pause');
-  }
-  return this;
-};
-
-function flow(stream) {
-  var state = stream._readableState;
-  debug('flow', state.flowing);
-  while (state.flowing && stream.read() !== null) {}
-}
-
-// wrap an old-style stream as the async data source.
-// This is *not* part of the readable stream interface.
-// It is an ugly unfortunate mess of history.
-Readable.prototype.wrap = function (stream) {
-  var _this = this;
-
-  var state = this._readableState;
-  var paused = false;
-
-  stream.on('end', function () {
-    debug('wrapped end');
-    if (state.decoder && !state.ended) {
-      var chunk = state.decoder.end();
-      if (chunk && chunk.length) _this.push(chunk);
-    }
-
-    _this.push(null);
-  });
-
-  stream.on('data', function (chunk) {
-    debug('wrapped data');
-    if (state.decoder) chunk = state.decoder.write(chunk);
-
-    // don't skip over falsy values in objectMode
-    if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
-
-    var ret = _this.push(chunk);
-    if (!ret) {
-      paused = true;
-      stream.pause();
-    }
-  });
-
-  // proxy all the other methods.
-  // important when wrapping filters and duplexes.
-  for (var i in stream) {
-    if (this[i] === undefined && typeof stream[i] === 'function') {
-      this[i] = function (method) {
-        return function () {
-          return stream[method].apply(stream, arguments);
-        };
-      }(i);
-    }
-  }
-
-  // proxy certain important events.
-  for (var n = 0; n < kProxyEvents.length; n++) {
-    stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
-  }
-
-  // when we try to consume some more bytes, simply unpause the
-  // underlying stream.
-  this._read = function (n) {
-    debug('wrapped _read', n);
-    if (paused) {
-      paused = false;
-      stream.resume();
-    }
-  };
-
-  return this;
-};
-
-Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
-  // making it explicit this property is not enumerable
-  // because otherwise some prototype manipulation in
-  // userland will fail
-  enumerable: false,
-  get: function () {
-    return this._readableState.highWaterMark;
-  }
-});
-
-// exposed for testing purposes only.
-Readable._fromList = fromList;
-
-// Pluck off n bytes from an array of buffers.
-// Length is the combined lengths of all the buffers in the list.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromList(n, state) {
-  // nothing buffered
-  if (state.length === 0) return null;
-
-  var ret;
-  if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
-    // read it all, truncate the list
-    if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
-    state.buffer.clear();
-  } else {
-    // read part of list
-    ret = fromListPartial(n, state.buffer, state.decoder);
-  }
-
-  return ret;
-}
-
-// Extracts only enough buffered data to satisfy the amount requested.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromListPartial(n, list, hasStrings) {
-  var ret;
-  if (n < list.head.data.length) {
-    // slice is the same for buffers and strings
-    ret = list.head.data.slice(0, n);
-    list.head.data = list.head.data.slice(n);
-  } else if (n === list.head.data.length) {
-    // first chunk is a perfect match
-    ret = list.shift();
-  } else {
-    // result spans more than one buffer
-    ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
-  }
-  return ret;
-}
-
-// Copies a specified amount of characters from the list of buffered data
-// chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBufferString(n, list) {
-  var p = list.head;
-  var c = 1;
-  var ret = p.data;
-  n -= ret.length;
-  while (p = p.next) {
-    var str = p.data;
-    var nb = n > str.length ? str.length : n;
-    if (nb === str.length) ret += str;else ret += str.slice(0, n);
-    n -= nb;
-    if (n === 0) {
-      if (nb === str.length) {
-        ++c;
-        if (p.next) list.head = p.next;else list.head = list.tail = null;
-      } else {
-        list.head = p;
-        p.data = str.slice(nb);
-      }
-      break;
-    }
-    ++c;
-  }
-  list.length -= c;
-  return ret;
-}
-
-// Copies a specified amount of bytes from the list of buffered data chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBuffer(n, list) {
-  var ret = Buffer.allocUnsafe(n);
-  var p = list.head;
-  var c = 1;
-  p.data.copy(ret);
-  n -= p.data.length;
-  while (p = p.next) {
-    var buf = p.data;
-    var nb = n > buf.length ? buf.length : n;
-    buf.copy(ret, ret.length - n, 0, nb);
-    n -= nb;
-    if (n === 0) {
-      if (nb === buf.length) {
-        ++c;
-        if (p.next) list.head = p.next;else list.head = list.tail = null;
-      } else {
-        list.head = p;
-        p.data = buf.slice(nb);
-      }
-      break;
-    }
-    ++c;
-  }
-  list.length -= c;
-  return ret;
-}
-
-function endReadable(stream) {
-  var state = stream._readableState;
-
-  // If we get here before consuming all the bytes, then that is a
-  // bug in node.  Should never happen.
-  if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
-
-  if (!state.endEmitted) {
-    state.ended = true;
-    pna.nextTick(endReadableNT, state, stream);
-  }
-}
-
-function endReadableNT(state, stream) {
-  // Check that we didn't get one last unshift.
-  if (!state.endEmitted && state.length === 0) {
-    state.endEmitted = true;
-    stream.readable = false;
-    stream.emit('end');
-  }
-}
-
-function indexOf(xs, x) {
-  for (var i = 0, l = xs.length; i < l; i++) {
-    if (xs[i] === x) return i;
-  }
-  return -1;
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_transform.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_transform.js
deleted file mode 100644 (file)
index 5d1f8b8..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// a transform stream is a readable/writable stream where you do
-// something with the data.  Sometimes it's called a "filter",
-// but that's not a great name for it, since that implies a thing where
-// some bits pass through, and others are simply ignored.  (That would
-// be a valid example of a transform, of course.)
-//
-// While the output is causally related to the input, it's not a
-// necessarily symmetric or synchronous transformation.  For example,
-// a zlib stream might take multiple plain-text writes(), and then
-// emit a single compressed chunk some time in the future.
-//
-// Here's how this works:
-//
-// The Transform stream has all the aspects of the readable and writable
-// stream classes.  When you write(chunk), that calls _write(chunk,cb)
-// internally, and returns false if there's a lot of pending writes
-// buffered up.  When you call read(), that calls _read(n) until
-// there's enough pending readable data buffered up.
-//
-// In a transform stream, the written data is placed in a buffer.  When
-// _read(n) is called, it transforms the queued up data, calling the
-// buffered _write cb's as it consumes chunks.  If consuming a single
-// written chunk would result in multiple output chunks, then the first
-// outputted bit calls the readcb, and subsequent chunks just go into
-// the read buffer, and will cause it to emit 'readable' if necessary.
-//
-// This way, back-pressure is actually determined by the reading side,
-// since _read has to be called to start processing a new chunk.  However,
-// a pathological inflate type of transform can cause excessive buffering
-// here.  For example, imagine a stream where every byte of input is
-// interpreted as an integer from 0-255, and then results in that many
-// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
-// 1kb of data being output.  In this case, you could write a very small
-// amount of input, and end up with a very large amount of output.  In
-// such a pathological inflating mechanism, there'd be no way to tell
-// the system to stop doing the transform.  A single 4MB write could
-// cause the system to run out of memory.
-//
-// However, even in such a pathological case, only a single written chunk
-// would be consumed, and then the rest would wait (un-transformed) until
-// the results of the previous transformed chunk were consumed.
-
-'use strict';
-
-module.exports = Transform;
-
-var Duplex = require('./_stream_duplex');
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-util.inherits(Transform, Duplex);
-
-function afterTransform(er, data) {
-  var ts = this._transformState;
-  ts.transforming = false;
-
-  var cb = ts.writecb;
-
-  if (!cb) {
-    return this.emit('error', new Error('write callback called multiple times'));
-  }
-
-  ts.writechunk = null;
-  ts.writecb = null;
-
-  if (data != null) // single equals check for both `null` and `undefined`
-    this.push(data);
-
-  cb(er);
-
-  var rs = this._readableState;
-  rs.reading = false;
-  if (rs.needReadable || rs.length < rs.highWaterMark) {
-    this._read(rs.highWaterMark);
-  }
-}
-
-function Transform(options) {
-  if (!(this instanceof Transform)) return new Transform(options);
-
-  Duplex.call(this, options);
-
-  this._transformState = {
-    afterTransform: afterTransform.bind(this),
-    needTransform: false,
-    transforming: false,
-    writecb: null,
-    writechunk: null,
-    writeencoding: null
-  };
-
-  // start out asking for a readable event once data is transformed.
-  this._readableState.needReadable = true;
-
-  // we have implemented the _read method, and done the other things
-  // that Readable wants before the first _read call, so unset the
-  // sync guard flag.
-  this._readableState.sync = false;
-
-  if (options) {
-    if (typeof options.transform === 'function') this._transform = options.transform;
-
-    if (typeof options.flush === 'function') this._flush = options.flush;
-  }
-
-  // When the writable side finishes, then flush out anything remaining.
-  this.on('prefinish', prefinish);
-}
-
-function prefinish() {
-  var _this = this;
-
-  if (typeof this._flush === 'function') {
-    this._flush(function (er, data) {
-      done(_this, er, data);
-    });
-  } else {
-    done(this, null, null);
-  }
-}
-
-Transform.prototype.push = function (chunk, encoding) {
-  this._transformState.needTransform = false;
-  return Duplex.prototype.push.call(this, chunk, encoding);
-};
-
-// This is the part where you do stuff!
-// override this function in implementation classes.
-// 'chunk' is an input chunk.
-//
-// Call `push(newChunk)` to pass along transformed output
-// to the readable side.  You may call 'push' zero or more times.
-//
-// Call `cb(err)` when you are done with this chunk.  If you pass
-// an error, then that'll put the hurt on the whole operation.  If you
-// never call cb(), then you'll never get another chunk.
-Transform.prototype._transform = function (chunk, encoding, cb) {
-  throw new Error('_transform() is not implemented');
-};
-
-Transform.prototype._write = function (chunk, encoding, cb) {
-  var ts = this._transformState;
-  ts.writecb = cb;
-  ts.writechunk = chunk;
-  ts.writeencoding = encoding;
-  if (!ts.transforming) {
-    var rs = this._readableState;
-    if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
-  }
-};
-
-// Doesn't matter what the args are here.
-// _transform does all the work.
-// That we got here means that the readable side wants more data.
-Transform.prototype._read = function (n) {
-  var ts = this._transformState;
-
-  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
-    ts.transforming = true;
-    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
-  } else {
-    // mark that we need a transform, so that any data that comes in
-    // will get processed, now that we've asked for it.
-    ts.needTransform = true;
-  }
-};
-
-Transform.prototype._destroy = function (err, cb) {
-  var _this2 = this;
-
-  Duplex.prototype._destroy.call(this, err, function (err2) {
-    cb(err2);
-    _this2.emit('close');
-  });
-};
-
-function done(stream, er, data) {
-  if (er) return stream.emit('error', er);
-
-  if (data != null) // single equals check for both `null` and `undefined`
-    stream.push(data);
-
-  // if there's nothing in the write buffer, then that means
-  // that nothing more will ever be provided
-  if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
-
-  if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
-
-  return stream.push(null);
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_writable.js b/legacy-libs/grpc/node_modules/readable-stream/lib/_stream_writable.js
deleted file mode 100644 (file)
index b3f4e85..0000000
+++ /dev/null
@@ -1,687 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// A bit simpler than readable streams.
-// Implement an async ._write(chunk, encoding, cb), and it'll handle all
-// the drain event emission and buffering.
-
-'use strict';
-
-/*<replacement>*/
-
-var pna = require('process-nextick-args');
-/*</replacement>*/
-
-module.exports = Writable;
-
-/* <replacement> */
-function WriteReq(chunk, encoding, cb) {
-  this.chunk = chunk;
-  this.encoding = encoding;
-  this.callback = cb;
-  this.next = null;
-}
-
-// It seems a linked list but it is not
-// there will be only 2 of these for each stream
-function CorkedRequest(state) {
-  var _this = this;
-
-  this.next = null;
-  this.entry = null;
-  this.finish = function () {
-    onCorkedFinish(_this, state);
-  };
-}
-/* </replacement> */
-
-/*<replacement>*/
-var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
-/*</replacement>*/
-
-/*<replacement>*/
-var Duplex;
-/*</replacement>*/
-
-Writable.WritableState = WritableState;
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-/*<replacement>*/
-var internalUtil = {
-  deprecate: require('util-deprecate')
-};
-/*</replacement>*/
-
-/*<replacement>*/
-var Stream = require('./internal/streams/stream');
-/*</replacement>*/
-
-/*<replacement>*/
-
-var Buffer = require('safe-buffer').Buffer;
-var OurUint8Array = global.Uint8Array || function () {};
-function _uint8ArrayToBuffer(chunk) {
-  return Buffer.from(chunk);
-}
-function _isUint8Array(obj) {
-  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
-}
-
-/*</replacement>*/
-
-var destroyImpl = require('./internal/streams/destroy');
-
-util.inherits(Writable, Stream);
-
-function nop() {}
-
-function WritableState(options, stream) {
-  Duplex = Duplex || require('./_stream_duplex');
-
-  options = options || {};
-
-  // Duplex streams are both readable and writable, but share
-  // the same options object.
-  // However, some cases require setting options to different
-  // values for the readable and the writable sides of the duplex stream.
-  // These options can be provided separately as readableXXX and writableXXX.
-  var isDuplex = stream instanceof Duplex;
-
-  // object stream flag to indicate whether or not this stream
-  // contains buffers or objects.
-  this.objectMode = !!options.objectMode;
-
-  if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
-
-  // the point at which write() starts returning false
-  // Note: 0 is a valid value, means that we always return false if
-  // the entire buffer is not flushed immediately on write()
-  var hwm = options.highWaterMark;
-  var writableHwm = options.writableHighWaterMark;
-  var defaultHwm = this.objectMode ? 16 : 16 * 1024;
-
-  if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
-
-  // cast to ints.
-  this.highWaterMark = Math.floor(this.highWaterMark);
-
-  // if _final has been called
-  this.finalCalled = false;
-
-  // drain event flag.
-  this.needDrain = false;
-  // at the start of calling end()
-  this.ending = false;
-  // when end() has been called, and returned
-  this.ended = false;
-  // when 'finish' is emitted
-  this.finished = false;
-
-  // has it been destroyed
-  this.destroyed = false;
-
-  // should we decode strings into buffers before passing to _write?
-  // this is here so that some node-core streams can optimize string
-  // handling at a lower level.
-  var noDecode = options.decodeStrings === false;
-  this.decodeStrings = !noDecode;
-
-  // Crypto is kind of old and crusty.  Historically, its default string
-  // encoding is 'binary' so we have to make this configurable.
-  // Everything else in the universe uses 'utf8', though.
-  this.defaultEncoding = options.defaultEncoding || 'utf8';
-
-  // not an actual buffer we keep track of, but a measurement
-  // of how much we're waiting to get pushed to some underlying
-  // socket or file.
-  this.length = 0;
-
-  // a flag to see when we're in the middle of a write.
-  this.writing = false;
-
-  // when true all writes will be buffered until .uncork() call
-  this.corked = 0;
-
-  // a flag to be able to tell if the onwrite cb is called immediately,
-  // or on a later tick.  We set this to true at first, because any
-  // actions that shouldn't happen until "later" should generally also
-  // not happen before the first write call.
-  this.sync = true;
-
-  // a flag to know if we're processing previously buffered items, which
-  // may call the _write() callback in the same tick, so that we don't
-  // end up in an overlapped onwrite situation.
-  this.bufferProcessing = false;
-
-  // the callback that's passed to _write(chunk,cb)
-  this.onwrite = function (er) {
-    onwrite(stream, er);
-  };
-
-  // the callback that the user supplies to write(chunk,encoding,cb)
-  this.writecb = null;
-
-  // the amount that is being written when _write is called.
-  this.writelen = 0;
-
-  this.bufferedRequest = null;
-  this.lastBufferedRequest = null;
-
-  // number of pending user-supplied write callbacks
-  // this must be 0 before 'finish' can be emitted
-  this.pendingcb = 0;
-
-  // emit prefinish if the only thing we're waiting for is _write cbs
-  // This is relevant for synchronous Transform streams
-  this.prefinished = false;
-
-  // True if the error was already emitted and should not be thrown again
-  this.errorEmitted = false;
-
-  // count buffered requests
-  this.bufferedRequestCount = 0;
-
-  // allocate the first CorkedRequest, there is always
-  // one allocated and free to use, and we maintain at most two
-  this.corkedRequestsFree = new CorkedRequest(this);
-}
-
-WritableState.prototype.getBuffer = function getBuffer() {
-  var current = this.bufferedRequest;
-  var out = [];
-  while (current) {
-    out.push(current);
-    current = current.next;
-  }
-  return out;
-};
-
-(function () {
-  try {
-    Object.defineProperty(WritableState.prototype, 'buffer', {
-      get: internalUtil.deprecate(function () {
-        return this.getBuffer();
-      }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
-    });
-  } catch (_) {}
-})();
-
-// Test _writableState for inheritance to account for Duplex streams,
-// whose prototype chain only points to Readable.
-var realHasInstance;
-if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
-  realHasInstance = Function.prototype[Symbol.hasInstance];
-  Object.defineProperty(Writable, Symbol.hasInstance, {
-    value: function (object) {
-      if (realHasInstance.call(this, object)) return true;
-      if (this !== Writable) return false;
-
-      return object && object._writableState instanceof WritableState;
-    }
-  });
-} else {
-  realHasInstance = function (object) {
-    return object instanceof this;
-  };
-}
-
-function Writable(options) {
-  Duplex = Duplex || require('./_stream_duplex');
-
-  // Writable ctor is applied to Duplexes, too.
-  // `realHasInstance` is necessary because using plain `instanceof`
-  // would return false, as no `_writableState` property is attached.
-
-  // Trying to use the custom `instanceof` for Writable here will also break the
-  // Node.js LazyTransform implementation, which has a non-trivial getter for
-  // `_writableState` that would lead to infinite recursion.
-  if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
-    return new Writable(options);
-  }
-
-  this._writableState = new WritableState(options, this);
-
-  // legacy.
-  this.writable = true;
-
-  if (options) {
-    if (typeof options.write === 'function') this._write = options.write;
-
-    if (typeof options.writev === 'function') this._writev = options.writev;
-
-    if (typeof options.destroy === 'function') this._destroy = options.destroy;
-
-    if (typeof options.final === 'function') this._final = options.final;
-  }
-
-  Stream.call(this);
-}
-
-// Otherwise people can pipe Writable streams, which is just wrong.
-Writable.prototype.pipe = function () {
-  this.emit('error', new Error('Cannot pipe, not readable'));
-};
-
-function writeAfterEnd(stream, cb) {
-  var er = new Error('write after end');
-  // TODO: defer error events consistently everywhere, not just the cb
-  stream.emit('error', er);
-  pna.nextTick(cb, er);
-}
-
-// Checks that a user-supplied chunk is valid, especially for the particular
-// mode the stream is in. Currently this means that `null` is never accepted
-// and undefined/non-string values are only allowed in object mode.
-function validChunk(stream, state, chunk, cb) {
-  var valid = true;
-  var er = false;
-
-  if (chunk === null) {
-    er = new TypeError('May not write null values to stream');
-  } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
-    er = new TypeError('Invalid non-string/buffer chunk');
-  }
-  if (er) {
-    stream.emit('error', er);
-    pna.nextTick(cb, er);
-    valid = false;
-  }
-  return valid;
-}
-
-Writable.prototype.write = function (chunk, encoding, cb) {
-  var state = this._writableState;
-  var ret = false;
-  var isBuf = !state.objectMode && _isUint8Array(chunk);
-
-  if (isBuf && !Buffer.isBuffer(chunk)) {
-    chunk = _uint8ArrayToBuffer(chunk);
-  }
-
-  if (typeof encoding === 'function') {
-    cb = encoding;
-    encoding = null;
-  }
-
-  if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
-
-  if (typeof cb !== 'function') cb = nop;
-
-  if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
-    state.pendingcb++;
-    ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
-  }
-
-  return ret;
-};
-
-Writable.prototype.cork = function () {
-  var state = this._writableState;
-
-  state.corked++;
-};
-
-Writable.prototype.uncork = function () {
-  var state = this._writableState;
-
-  if (state.corked) {
-    state.corked--;
-
-    if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
-  }
-};
-
-Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
-  // node::ParseEncoding() requires lower case.
-  if (typeof encoding === 'string') encoding = encoding.toLowerCase();
-  if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
-  this._writableState.defaultEncoding = encoding;
-  return this;
-};
-
-function decodeChunk(state, chunk, encoding) {
-  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
-    chunk = Buffer.from(chunk, encoding);
-  }
-  return chunk;
-}
-
-Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
-  // making it explicit this property is not enumerable
-  // because otherwise some prototype manipulation in
-  // userland will fail
-  enumerable: false,
-  get: function () {
-    return this._writableState.highWaterMark;
-  }
-});
-
-// if we're already writing something, then just put this
-// in the queue, and wait our turn.  Otherwise, call _write
-// If we return false, then we need a drain event, so set that flag.
-function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
-  if (!isBuf) {
-    var newChunk = decodeChunk(state, chunk, encoding);
-    if (chunk !== newChunk) {
-      isBuf = true;
-      encoding = 'buffer';
-      chunk = newChunk;
-    }
-  }
-  var len = state.objectMode ? 1 : chunk.length;
-
-  state.length += len;
-
-  var ret = state.length < state.highWaterMark;
-  // we must ensure that previous needDrain will not be reset to false.
-  if (!ret) state.needDrain = true;
-
-  if (state.writing || state.corked) {
-    var last = state.lastBufferedRequest;
-    state.lastBufferedRequest = {
-      chunk: chunk,
-      encoding: encoding,
-      isBuf: isBuf,
-      callback: cb,
-      next: null
-    };
-    if (last) {
-      last.next = state.lastBufferedRequest;
-    } else {
-      state.bufferedRequest = state.lastBufferedRequest;
-    }
-    state.bufferedRequestCount += 1;
-  } else {
-    doWrite(stream, state, false, len, chunk, encoding, cb);
-  }
-
-  return ret;
-}
-
-function doWrite(stream, state, writev, len, chunk, encoding, cb) {
-  state.writelen = len;
-  state.writecb = cb;
-  state.writing = true;
-  state.sync = true;
-  if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
-  state.sync = false;
-}
-
-function onwriteError(stream, state, sync, er, cb) {
-  --state.pendingcb;
-
-  if (sync) {
-    // defer the callback if we are being called synchronously
-    // to avoid piling up things on the stack
-    pna.nextTick(cb, er);
-    // this can emit finish, and it will always happen
-    // after error
-    pna.nextTick(finishMaybe, stream, state);
-    stream._writableState.errorEmitted = true;
-    stream.emit('error', er);
-  } else {
-    // the caller expect this to happen before if
-    // it is async
-    cb(er);
-    stream._writableState.errorEmitted = true;
-    stream.emit('error', er);
-    // this can emit finish, but finish must
-    // always follow error
-    finishMaybe(stream, state);
-  }
-}
-
-function onwriteStateUpdate(state) {
-  state.writing = false;
-  state.writecb = null;
-  state.length -= state.writelen;
-  state.writelen = 0;
-}
-
-function onwrite(stream, er) {
-  var state = stream._writableState;
-  var sync = state.sync;
-  var cb = state.writecb;
-
-  onwriteStateUpdate(state);
-
-  if (er) onwriteError(stream, state, sync, er, cb);else {
-    // Check if we're actually ready to finish, but don't emit yet
-    var finished = needFinish(state);
-
-    if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
-      clearBuffer(stream, state);
-    }
-
-    if (sync) {
-      /*<replacement>*/
-      asyncWrite(afterWrite, stream, state, finished, cb);
-      /*</replacement>*/
-    } else {
-      afterWrite(stream, state, finished, cb);
-    }
-  }
-}
-
-function afterWrite(stream, state, finished, cb) {
-  if (!finished) onwriteDrain(stream, state);
-  state.pendingcb--;
-  cb();
-  finishMaybe(stream, state);
-}
-
-// Must force callback to be called on nextTick, so that we don't
-// emit 'drain' before the write() consumer gets the 'false' return
-// value, and has a chance to attach a 'drain' listener.
-function onwriteDrain(stream, state) {
-  if (state.length === 0 && state.needDrain) {
-    state.needDrain = false;
-    stream.emit('drain');
-  }
-}
-
-// if there's something in the buffer waiting, then process it
-function clearBuffer(stream, state) {
-  state.bufferProcessing = true;
-  var entry = state.bufferedRequest;
-
-  if (stream._writev && entry && entry.next) {
-    // Fast case, write everything using _writev()
-    var l = state.bufferedRequestCount;
-    var buffer = new Array(l);
-    var holder = state.corkedRequestsFree;
-    holder.entry = entry;
-
-    var count = 0;
-    var allBuffers = true;
-    while (entry) {
-      buffer[count] = entry;
-      if (!entry.isBuf) allBuffers = false;
-      entry = entry.next;
-      count += 1;
-    }
-    buffer.allBuffers = allBuffers;
-
-    doWrite(stream, state, true, state.length, buffer, '', holder.finish);
-
-    // doWrite is almost always async, defer these to save a bit of time
-    // as the hot path ends with doWrite
-    state.pendingcb++;
-    state.lastBufferedRequest = null;
-    if (holder.next) {
-      state.corkedRequestsFree = holder.next;
-      holder.next = null;
-    } else {
-      state.corkedRequestsFree = new CorkedRequest(state);
-    }
-    state.bufferedRequestCount = 0;
-  } else {
-    // Slow case, write chunks one-by-one
-    while (entry) {
-      var chunk = entry.chunk;
-      var encoding = entry.encoding;
-      var cb = entry.callback;
-      var len = state.objectMode ? 1 : chunk.length;
-
-      doWrite(stream, state, false, len, chunk, encoding, cb);
-      entry = entry.next;
-      state.bufferedRequestCount--;
-      // if we didn't call the onwrite immediately, then
-      // it means that we need to wait until it does.
-      // also, that means that the chunk and cb are currently
-      // being processed, so move the buffer counter past them.
-      if (state.writing) {
-        break;
-      }
-    }
-
-    if (entry === null) state.lastBufferedRequest = null;
-  }
-
-  state.bufferedRequest = entry;
-  state.bufferProcessing = false;
-}
-
-Writable.prototype._write = function (chunk, encoding, cb) {
-  cb(new Error('_write() is not implemented'));
-};
-
-Writable.prototype._writev = null;
-
-Writable.prototype.end = function (chunk, encoding, cb) {
-  var state = this._writableState;
-
-  if (typeof chunk === 'function') {
-    cb = chunk;
-    chunk = null;
-    encoding = null;
-  } else if (typeof encoding === 'function') {
-    cb = encoding;
-    encoding = null;
-  }
-
-  if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
-
-  // .end() fully uncorks
-  if (state.corked) {
-    state.corked = 1;
-    this.uncork();
-  }
-
-  // ignore unnecessary end() calls.
-  if (!state.ending && !state.finished) endWritable(this, state, cb);
-};
-
-function needFinish(state) {
-  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
-}
-function callFinal(stream, state) {
-  stream._final(function (err) {
-    state.pendingcb--;
-    if (err) {
-      stream.emit('error', err);
-    }
-    state.prefinished = true;
-    stream.emit('prefinish');
-    finishMaybe(stream, state);
-  });
-}
-function prefinish(stream, state) {
-  if (!state.prefinished && !state.finalCalled) {
-    if (typeof stream._final === 'function') {
-      state.pendingcb++;
-      state.finalCalled = true;
-      pna.nextTick(callFinal, stream, state);
-    } else {
-      state.prefinished = true;
-      stream.emit('prefinish');
-    }
-  }
-}
-
-function finishMaybe(stream, state) {
-  var need = needFinish(state);
-  if (need) {
-    prefinish(stream, state);
-    if (state.pendingcb === 0) {
-      state.finished = true;
-      stream.emit('finish');
-    }
-  }
-  return need;
-}
-
-function endWritable(stream, state, cb) {
-  state.ending = true;
-  finishMaybe(stream, state);
-  if (cb) {
-    if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
-  }
-  state.ended = true;
-  stream.writable = false;
-}
-
-function onCorkedFinish(corkReq, state, err) {
-  var entry = corkReq.entry;
-  corkReq.entry = null;
-  while (entry) {
-    var cb = entry.callback;
-    state.pendingcb--;
-    cb(err);
-    entry = entry.next;
-  }
-  if (state.corkedRequestsFree) {
-    state.corkedRequestsFree.next = corkReq;
-  } else {
-    state.corkedRequestsFree = corkReq;
-  }
-}
-
-Object.defineProperty(Writable.prototype, 'destroyed', {
-  get: function () {
-    if (this._writableState === undefined) {
-      return false;
-    }
-    return this._writableState.destroyed;
-  },
-  set: function (value) {
-    // we ignore the value if the stream
-    // has not been initialized yet
-    if (!this._writableState) {
-      return;
-    }
-
-    // backward compatibility, the user is explicitly
-    // managing destroyed
-    this._writableState.destroyed = value;
-  }
-});
-
-Writable.prototype.destroy = destroyImpl.destroy;
-Writable.prototype._undestroy = destroyImpl.undestroy;
-Writable.prototype._destroy = function (err, cb) {
-  this.end();
-  cb(err);
-};
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/BufferList.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/BufferList.js
deleted file mode 100644 (file)
index aefc68b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-'use strict';
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var Buffer = require('safe-buffer').Buffer;
-var util = require('util');
-
-function copyBuffer(src, target, offset) {
-  src.copy(target, offset);
-}
-
-module.exports = function () {
-  function BufferList() {
-    _classCallCheck(this, BufferList);
-
-    this.head = null;
-    this.tail = null;
-    this.length = 0;
-  }
-
-  BufferList.prototype.push = function push(v) {
-    var entry = { data: v, next: null };
-    if (this.length > 0) this.tail.next = entry;else this.head = entry;
-    this.tail = entry;
-    ++this.length;
-  };
-
-  BufferList.prototype.unshift = function unshift(v) {
-    var entry = { data: v, next: this.head };
-    if (this.length === 0) this.tail = entry;
-    this.head = entry;
-    ++this.length;
-  };
-
-  BufferList.prototype.shift = function shift() {
-    if (this.length === 0) return;
-    var ret = this.head.data;
-    if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
-    --this.length;
-    return ret;
-  };
-
-  BufferList.prototype.clear = function clear() {
-    this.head = this.tail = null;
-    this.length = 0;
-  };
-
-  BufferList.prototype.join = function join(s) {
-    if (this.length === 0) return '';
-    var p = this.head;
-    var ret = '' + p.data;
-    while (p = p.next) {
-      ret += s + p.data;
-    }return ret;
-  };
-
-  BufferList.prototype.concat = function concat(n) {
-    if (this.length === 0) return Buffer.alloc(0);
-    if (this.length === 1) return this.head.data;
-    var ret = Buffer.allocUnsafe(n >>> 0);
-    var p = this.head;
-    var i = 0;
-    while (p) {
-      copyBuffer(p.data, ret, i);
-      i += p.data.length;
-      p = p.next;
-    }
-    return ret;
-  };
-
-  return BufferList;
-}();
-
-if (util && util.inspect && util.inspect.custom) {
-  module.exports.prototype[util.inspect.custom] = function () {
-    var obj = util.inspect({ length: this.length });
-    return this.constructor.name + ' ' + obj;
-  };
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/destroy.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/destroy.js
deleted file mode 100644 (file)
index 5a0a0d8..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-'use strict';
-
-/*<replacement>*/
-
-var pna = require('process-nextick-args');
-/*</replacement>*/
-
-// undocumented cb() API, needed for core, not for public API
-function destroy(err, cb) {
-  var _this = this;
-
-  var readableDestroyed = this._readableState && this._readableState.destroyed;
-  var writableDestroyed = this._writableState && this._writableState.destroyed;
-
-  if (readableDestroyed || writableDestroyed) {
-    if (cb) {
-      cb(err);
-    } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
-      pna.nextTick(emitErrorNT, this, err);
-    }
-    return this;
-  }
-
-  // we set destroyed to true before firing error callbacks in order
-  // to make it re-entrance safe in case destroy() is called within callbacks
-
-  if (this._readableState) {
-    this._readableState.destroyed = true;
-  }
-
-  // if this is a duplex stream mark the writable part as destroyed as well
-  if (this._writableState) {
-    this._writableState.destroyed = true;
-  }
-
-  this._destroy(err || null, function (err) {
-    if (!cb && err) {
-      pna.nextTick(emitErrorNT, _this, err);
-      if (_this._writableState) {
-        _this._writableState.errorEmitted = true;
-      }
-    } else if (cb) {
-      cb(err);
-    }
-  });
-
-  return this;
-}
-
-function undestroy() {
-  if (this._readableState) {
-    this._readableState.destroyed = false;
-    this._readableState.reading = false;
-    this._readableState.ended = false;
-    this._readableState.endEmitted = false;
-  }
-
-  if (this._writableState) {
-    this._writableState.destroyed = false;
-    this._writableState.ended = false;
-    this._writableState.ending = false;
-    this._writableState.finished = false;
-    this._writableState.errorEmitted = false;
-  }
-}
-
-function emitErrorNT(self, err) {
-  self.emit('error', err);
-}
-
-module.exports = {
-  destroy: destroy,
-  undestroy: undestroy
-};
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream-browser.js
deleted file mode 100644 (file)
index 9332a3f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('events').EventEmitter;
diff --git a/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream.js b/legacy-libs/grpc/node_modules/readable-stream/lib/internal/streams/stream.js
deleted file mode 100644 (file)
index ce2ad5b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('stream');
diff --git a/legacy-libs/grpc/node_modules/readable-stream/package.json b/legacy-libs/grpc/node_modules/readable-stream/package.json
deleted file mode 100644 (file)
index 3c5aac2..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-{
-  "_args": [
-    [
-      "readable-stream@2.3.6",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "readable-stream@2.3.6",
-  "_id": "readable-stream@2.3.6",
-  "_inBundle": false,
-  "_integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
-  "_location": "/grpc/readable-stream",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "readable-stream@2.3.6",
-    "name": "readable-stream",
-    "escapedName": "readable-stream",
-    "rawSpec": "2.3.6",
-    "saveSpec": null,
-    "fetchSpec": "2.3.6"
-  },
-  "_requiredBy": [
-    "/grpc/are-we-there-yet"
-  ],
-  "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.3.6",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "browser": {
-    "util": false,
-    "./readable.js": "./readable-browser.js",
-    "./writable.js": "./writable-browser.js",
-    "./duplex.js": "./duplex-browser.js",
-    "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js"
-  },
-  "bugs": {
-    "url": "https://github.com/nodejs/readable-stream/issues"
-  },
-  "dependencies": {
-    "core-util-is": "~1.0.0",
-    "inherits": "~2.0.3",
-    "isarray": "~1.0.0",
-    "process-nextick-args": "~2.0.0",
-    "safe-buffer": "~5.1.1",
-    "string_decoder": "~1.1.1",
-    "util-deprecate": "~1.0.1"
-  },
-  "description": "Streams3, a user-land copy of the stream library from Node.js",
-  "devDependencies": {
-    "assert": "^1.4.0",
-    "babel-polyfill": "^6.9.1",
-    "buffer": "^4.9.0",
-    "lolex": "^2.3.2",
-    "nyc": "^6.4.0",
-    "tap": "^0.7.0",
-    "tape": "^4.8.0"
-  },
-  "homepage": "https://github.com/nodejs/readable-stream#readme",
-  "keywords": [
-    "readable",
-    "stream",
-    "pipe"
-  ],
-  "license": "MIT",
-  "main": "readable.js",
-  "name": "readable-stream",
-  "nyc": {
-    "include": [
-      "lib/**.js"
-    ]
-  },
-  "optionalDependencies": {},
-  "readme": "# readable-stream\n\n***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)\n\n\n[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)\n[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)\n\n\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)\n\n```bash\nnpm install --save readable-stream\n```\n\n***Node-core streams for userland***\n\nThis package is a mirror of the Streams2 and Streams3 implementations in\nNode-core.\n\nFull documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html).\n\nIf you want to guarantee a stable streams base, regardless of what version of\nNode you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *\"stream\"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).\n\nAs of version 2.0.0 **readable-stream** uses semantic versioning.\n\n# Streams Working Group\n\n`readable-stream` is maintained by the Streams Working Group, which\noversees the development and maintenance of the Streams API within\nNode.js. The responsibilities of the Streams Working Group include:\n\n* Addressing stream issues on the Node.js issue tracker.\n* Authoring and editing stream documentation within the Node.js project.\n* Reviewing changes to stream subclasses within the Node.js project.\n* Redirecting changes to streams from the Node.js project to this\n  project.\n* Assisting in the implementation of stream providers within Node.js.\n* Recommending versions of `readable-stream` to be included in Node.js.\n* Messaging about the future of streams to give the community advance\n  notice of changes.\n\n<a name=\"members\"></a>\n## Team Members\n\n* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;\n  - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B\n* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;\n  - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242\n* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;\n  - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D\n* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;\n* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;\n* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;\n* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) &lt;matteo.collina@gmail.com&gt;\n  - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E\n* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) &lt;shestak.irina@gmail.com&gt;\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/nodejs/readable-stream.git"
-  },
-  "scripts": {
-    "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js",
-    "cover": "nyc npm test",
-    "report": "nyc report --reporter=lcov",
-    "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js"
-  },
-  "version": "2.3.6"
-}
diff --git a/legacy-libs/grpc/node_modules/readable-stream/passthrough.js b/legacy-libs/grpc/node_modules/readable-stream/passthrough.js
deleted file mode 100644 (file)
index ffd791d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./readable').PassThrough
diff --git a/legacy-libs/grpc/node_modules/readable-stream/readable-browser.js b/legacy-libs/grpc/node_modules/readable-stream/readable-browser.js
deleted file mode 100644 (file)
index e503725..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-exports = module.exports = require('./lib/_stream_readable.js');
-exports.Stream = exports;
-exports.Readable = exports;
-exports.Writable = require('./lib/_stream_writable.js');
-exports.Duplex = require('./lib/_stream_duplex.js');
-exports.Transform = require('./lib/_stream_transform.js');
-exports.PassThrough = require('./lib/_stream_passthrough.js');
diff --git a/legacy-libs/grpc/node_modules/readable-stream/readable.js b/legacy-libs/grpc/node_modules/readable-stream/readable.js
deleted file mode 100644 (file)
index ec89ec5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-var Stream = require('stream');
-if (process.env.READABLE_STREAM === 'disable' && Stream) {
-  module.exports = Stream;
-  exports = module.exports = Stream.Readable;
-  exports.Readable = Stream.Readable;
-  exports.Writable = Stream.Writable;
-  exports.Duplex = Stream.Duplex;
-  exports.Transform = Stream.Transform;
-  exports.PassThrough = Stream.PassThrough;
-  exports.Stream = Stream;
-} else {
-  exports = module.exports = require('./lib/_stream_readable.js');
-  exports.Stream = Stream || exports;
-  exports.Readable = exports;
-  exports.Writable = require('./lib/_stream_writable.js');
-  exports.Duplex = require('./lib/_stream_duplex.js');
-  exports.Transform = require('./lib/_stream_transform.js');
-  exports.PassThrough = require('./lib/_stream_passthrough.js');
-}
diff --git a/legacy-libs/grpc/node_modules/readable-stream/transform.js b/legacy-libs/grpc/node_modules/readable-stream/transform.js
deleted file mode 100644 (file)
index b1baba2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./readable').Transform
diff --git a/legacy-libs/grpc/node_modules/readable-stream/writable-browser.js b/legacy-libs/grpc/node_modules/readable-stream/writable-browser.js
deleted file mode 100644 (file)
index ebdde6a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib/_stream_writable.js');
diff --git a/legacy-libs/grpc/node_modules/readable-stream/writable.js b/legacy-libs/grpc/node_modules/readable-stream/writable.js
deleted file mode 100644 (file)
index 3211a6f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-var Stream = require("stream")
-var Writable = require("./lib/_stream_writable.js")
-
-if (process.env.READABLE_STREAM === 'disable') {
-  module.exports = Stream && Stream.Writable || Writable
-} else {
-  module.exports = Writable
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/LICENSE b/legacy-libs/grpc/node_modules/rimraf/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/rimraf/README.md b/legacy-libs/grpc/node_modules/rimraf/README.md
deleted file mode 100644 (file)
index 423b8cf..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies)
-
-The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
-
-Install with `npm install rimraf`, or just drop rimraf.js somewhere.
-
-## API
-
-`rimraf(f, [opts], callback)`
-
-The first parameter will be interpreted as a globbing pattern for files. If you
-want to disable globbing you can do so with `opts.disableGlob` (defaults to
-`false`). This might be handy, for instance, if you have filenames that contain
-globbing wildcard characters.
-
-The callback will be called with an error if there is one.  Certain
-errors are handled for you:
-
-* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
-  `opts.maxBusyTries` times before giving up, adding 100ms of wait
-  between each attempt.  The default `maxBusyTries` is 3.
-* `ENOENT` - If the file doesn't exist, rimraf will return
-  successfully, since your desired outcome is already the case.
-* `EMFILE` - Since `readdir` requires opening a file descriptor, it's
-  possible to hit `EMFILE` if too many file descriptors are in use.
-  In the sync case, there's nothing to be done for this.  But in the
-  async case, rimraf will gradually back off with timeouts up to
-  `opts.emfileWait` ms, which defaults to 1000.
-
-## options
-
-* unlink, chmod, stat, lstat, rmdir, readdir,
-  unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync
-
-    In order to use a custom file system library, you can override
-    specific fs functions on the options object.
-
-    If any of these functions are present on the options object, then
-    the supplied function will be used instead of the default fs
-    method.
-
-    Sync methods are only relevant for `rimraf.sync()`, of course.
-
-    For example:
-
-    ```javascript
-    var myCustomFS = require('some-custom-fs')
-
-    rimraf('some-thing', myCustomFS, callback)
-    ```
-
-* maxBusyTries
-
-    If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered
-    on Windows systems, then rimraf will retry with a linear backoff
-    wait of 100ms longer on each try.  The default maxBusyTries is 3.
-
-    Only relevant for async usage.
-
-* emfileWait
-
-    If an `EMFILE` error is encountered, then rimraf will retry
-    repeatedly with a linear backoff of 1ms longer on each try, until
-    the timeout counter hits this max.  The default limit is 1000.
-
-    If you repeatedly encounter `EMFILE` errors, then consider using
-    [graceful-fs](http://npm.im/graceful-fs) in your program.
-
-    Only relevant for async usage.
-
-* glob
-
-    Set to `false` to disable [glob](http://npm.im/glob) pattern
-    matching.
-
-    Set to an object to pass options to the glob module.  The default
-    glob options are `{ nosort: true, silent: true }`.
-
-    Glob version 6 is used in this module.
-
-    Relevant for both sync and async usage.
-
-* disableGlob
-
-    Set to any non-falsey value to disable globbing entirely.
-    (Equivalent to setting `glob: false`.)
-
-## rimraf.sync
-
-It can remove stuff synchronously, too.  But that's not so good.  Use
-the async API.  It's better.
-
-## CLI
-
-If installed with `npm install rimraf -g` it can be used as a global
-command `rimraf <path> [<path> ...]` which is useful for cross platform support.
-
-## mkdirp
-
-If you need to create a directory recursively, check out
-[mkdirp](https://github.com/substack/node-mkdirp).
diff --git a/legacy-libs/grpc/node_modules/rimraf/bin.js b/legacy-libs/grpc/node_modules/rimraf/bin.js
deleted file mode 100644 (file)
index 0d1e17b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env node
-
-var rimraf = require('./')
-
-var help = false
-var dashdash = false
-var noglob = false
-var args = process.argv.slice(2).filter(function(arg) {
-  if (dashdash)
-    return !!arg
-  else if (arg === '--')
-    dashdash = true
-  else if (arg === '--no-glob' || arg === '-G')
-    noglob = true
-  else if (arg === '--glob' || arg === '-g')
-    noglob = false
-  else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
-    help = true
-  else
-    return !!arg
-})
-
-if (help || args.length === 0) {
-  // If they didn't ask for help, then this is not a "success"
-  var log = help ? console.log : console.error
-  log('Usage: rimraf <path> [<path> ...]')
-  log('')
-  log('  Deletes all files and folders at "path" recursively.')
-  log('')
-  log('Options:')
-  log('')
-  log('  -h, --help     Display this usage info')
-  log('  -G, --no-glob  Do not expand glob patterns in arguments')
-  log('  -g, --glob     Expand glob patterns in arguments (default)')
-  process.exit(help ? 0 : 1)
-} else
-  go(0)
-
-function go (n) {
-  if (n >= args.length)
-    return
-  var options = {}
-  if (noglob)
-    options = { glob: false }
-  rimraf(args[n], options, function (er) {
-    if (er)
-      throw er
-    go(n+1)
-  })
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/LICENSE b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/LICENSE
deleted file mode 100644 (file)
index 42ca266..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-## Glob Logo
-
-Glob's logo created by Tanya Brassie <http://tanyabrassie.com/>, licensed
-under a Creative Commons Attribution-ShareAlike 4.0 International License
-https://creativecommons.org/licenses/by-sa/4.0/
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/README.md b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/README.md
deleted file mode 100644 (file)
index e71b967..0000000
+++ /dev/null
@@ -1,373 +0,0 @@
-# Glob
-
-Match files using the patterns the shell uses, like stars and stuff.
-
-[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master)
-
-This is a glob implementation in JavaScript.  It uses the `minimatch`
-library to do its matching.
-
-![](logo/glob.png)
-
-## Usage
-
-Install with npm
-
-```
-npm i glob
-```
-
-```javascript
-var glob = require("glob")
-
-// options is optional
-glob("**/*.js", options, function (er, files) {
-  // files is an array of filenames.
-  // If the `nonull` option is set, and nothing
-  // was found, then files is ["**/*.js"]
-  // er is an error object or null.
-})
-```
-
-## Glob Primer
-
-"Globs" are the patterns you type when you do stuff like `ls *.js` on
-the command line, or put `build/*` in a `.gitignore` file.
-
-Before parsing the path part patterns, braced sections are expanded
-into a set.  Braced sections start with `{` and end with `}`, with any
-number of comma-delimited sections within.  Braced sections may contain
-slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
-
-The following characters have special magic meaning when used in a
-path portion:
-
-* `*` Matches 0 or more characters in a single path portion
-* `?` Matches 1 character
-* `[...]` Matches a range of characters, similar to a RegExp range.
-  If the first character of the range is `!` or `^` then it matches
-  any character not in the range.
-* `!(pattern|pattern|pattern)` Matches anything that does not match
-  any of the patterns provided.
-* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
-  patterns provided.
-* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
-  patterns provided.
-* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
-* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
-  provided
-* `**` If a "globstar" is alone in a path portion, then it matches
-  zero or more directories and subdirectories searching for matches.
-  It does not crawl symlinked directories.
-
-### Dots
-
-If a file or directory path portion has a `.` as the first character,
-then it will not match any glob pattern unless that pattern's
-corresponding path part also has a `.` as its first character.
-
-For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
-However the pattern `a/*/c` would not, because `*` does not start with
-a dot character.
-
-You can make glob treat dots as normal characters by setting
-`dot:true` in the options.
-
-### Basename Matching
-
-If you set `matchBase:true` in the options, and the pattern has no
-slashes in it, then it will seek for any file anywhere in the tree
-with a matching basename.  For example, `*.js` would match
-`test/simple/basic.js`.
-
-### Empty Sets
-
-If no matching files are found, then an empty array is returned.  This
-differs from the shell, where the pattern itself is returned.  For
-example:
-
-    $ echo a*s*d*f
-    a*s*d*f
-
-To get the bash-style behavior, set the `nonull:true` in the options.
-
-### See Also:
-
-* `man sh`
-* `man bash` (Search for "Pattern Matching")
-* `man 3 fnmatch`
-* `man 5 gitignore`
-* [minimatch documentation](https://github.com/isaacs/minimatch)
-
-## glob.hasMagic(pattern, [options])
-
-Returns `true` if there are any special characters in the pattern, and
-`false` otherwise.
-
-Note that the options affect the results.  If `noext:true` is set in
-the options object, then `+(a|b)` will not be considered a magic
-pattern.  If the pattern has a brace expansion, like `a/{b/c,x/y}`
-then that is considered magical, unless `nobrace:true` is set in the
-options.
-
-## glob(pattern, [options], cb)
-
-* `pattern` `{String}` Pattern to be matched
-* `options` `{Object}`
-* `cb` `{Function}`
-  * `err` `{Error | null}`
-  * `matches` `{Array<String>}` filenames found matching the pattern
-
-Perform an asynchronous glob search.
-
-## glob.sync(pattern, [options])
-
-* `pattern` `{String}` Pattern to be matched
-* `options` `{Object}`
-* return: `{Array<String>}` filenames found matching the pattern
-
-Perform a synchronous glob search.
-
-## Class: glob.Glob
-
-Create a Glob object by instantiating the `glob.Glob` class.
-
-```javascript
-var Glob = require("glob").Glob
-var mg = new Glob(pattern, options, cb)
-```
-
-It's an EventEmitter, and starts walking the filesystem to find matches
-immediately.
-
-### new glob.Glob(pattern, [options], [cb])
-
-* `pattern` `{String}` pattern to search for
-* `options` `{Object}`
-* `cb` `{Function}` Called when an error occurs, or matches are found
-  * `err` `{Error | null}`
-  * `matches` `{Array<String>}` filenames found matching the pattern
-
-Note that if the `sync` flag is set in the options, then matches will
-be immediately available on the `g.found` member.
-
-### Properties
-
-* `minimatch` The minimatch object that the glob uses.
-* `options` The options object passed in.
-* `aborted` Boolean which is set to true when calling `abort()`.  There
-  is no way at this time to continue a glob search after aborting, but
-  you can re-use the statCache to avoid having to duplicate syscalls.
-* `cache` Convenience object.  Each field has the following possible
-  values:
-  * `false` - Path does not exist
-  * `true` - Path exists
-  * `'FILE'` - Path exists, and is not a directory
-  * `'DIR'` - Path exists, and is a directory
-  * `[file, entries, ...]` - Path exists, is a directory, and the
-    array value is the results of `fs.readdir`
-* `statCache` Cache of `fs.stat` results, to prevent statting the same
-  path multiple times.
-* `symlinks` A record of which paths are symbolic links, which is
-  relevant in resolving `**` patterns.
-* `realpathCache` An optional object which is passed to `fs.realpath`
-  to minimize unnecessary syscalls.  It is stored on the instantiated
-  Glob object, and may be re-used.
-
-### Events
-
-* `end` When the matching is finished, this is emitted with all the
-  matches found.  If the `nonull` option is set, and no match was found,
-  then the `matches` list contains the original pattern.  The matches
-  are sorted, unless the `nosort` flag is set.
-* `match` Every time a match is found, this is emitted with the specific
-  thing that matched. It is not deduplicated or resolved to a realpath.
-* `error` Emitted when an unexpected error is encountered, or whenever
-  any fs error occurs if `options.strict` is set.
-* `abort` When `abort()` is called, this event is raised.
-
-### Methods
-
-* `pause` Temporarily stop the search
-* `resume` Resume the search
-* `abort` Stop the search forever
-
-### Options
-
-All the options that can be passed to Minimatch can also be passed to
-Glob to change pattern matching behavior.  Also, some have been added,
-or have glob-specific ramifications.
-
-All options are false by default, unless otherwise noted.
-
-All options are added to the Glob object, as well.
-
-If you are running many `glob` operations, you can pass a Glob object
-as the `options` argument to a subsequent operation to shortcut some
-`stat` and `readdir` calls.  At the very least, you may pass in shared
-`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
-parallel glob operations will be sped up by sharing information about
-the filesystem.
-
-* `cwd` The current working directory in which to search.  Defaults
-  to `process.cwd()`.
-* `root` The place where patterns starting with `/` will be mounted
-  onto.  Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
-  systems, and `C:\` or some such on Windows.)
-* `dot` Include `.dot` files in normal matches and `globstar` matches.
-  Note that an explicit dot in a portion of the pattern will always
-  match dot files.
-* `nomount` By default, a pattern starting with a forward-slash will be
-  "mounted" onto the root setting, so that a valid filesystem path is
-  returned.  Set this flag to disable that behavior.
-* `mark` Add a `/` character to directory matches.  Note that this
-  requires additional stat calls.
-* `nosort` Don't sort the results.
-* `stat` Set to true to stat *all* results.  This reduces performance
-  somewhat, and is completely unnecessary, unless `readdir` is presumed
-  to be an untrustworthy indicator of file existence.
-* `silent` When an unusual error is encountered when attempting to
-  read a directory, a warning will be printed to stderr.  Set the
-  `silent` option to true to suppress these warnings.
-* `strict` When an unusual error is encountered when attempting to
-  read a directory, the process will just continue on in search of
-  other matches.  Set the `strict` option to raise an error in these
-  cases.
-* `cache` See `cache` property above.  Pass in a previously generated
-  cache object to save some fs calls.
-* `statCache` A cache of results of filesystem information, to prevent
-  unnecessary stat calls.  While it should not normally be necessary
-  to set this, you may pass the statCache from one glob() call to the
-  options object of another, if you know that the filesystem will not
-  change between calls.  (See "Race Conditions" below.)
-* `symlinks` A cache of known symbolic links.  You may pass in a
-  previously generated `symlinks` object to save `lstat` calls when
-  resolving `**` matches.
-* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
-* `nounique` In some cases, brace-expanded patterns can result in the
-  same file showing up multiple times in the result set.  By default,
-  this implementation prevents duplicates in the result set.  Set this
-  flag to disable that behavior.
-* `nonull` Set to never return an empty set, instead returning a set
-  containing the pattern itself.  This is the default in glob(3).
-* `debug` Set to enable debug logging in minimatch and glob.
-* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
-* `noglobstar` Do not match `**` against multiple filenames.  (Ie,
-  treat it as a normal `*` instead.)
-* `noext` Do not match `+(a|b)` "extglob" patterns.
-* `nocase` Perform a case-insensitive match.  Note: on
-  case-insensitive filesystems, non-magic patterns will match by
-  default, since `stat` and `readdir` will not raise errors.
-* `matchBase` Perform a basename-only match if the pattern does not
-  contain any slash characters.  That is, `*.js` would be treated as
-  equivalent to `**/*.js`, matching all js files in all directories.
-* `nodir` Do not match directories, only files.  (Note: to match
-  *only* directories, simply put a `/` at the end of the pattern.)
-* `ignore` Add a pattern or an array of glob patterns to exclude matches.
-  Note: `ignore` patterns are *always* in `dot:true` mode, regardless
-  of any other settings.
-* `follow` Follow symlinked directories when expanding `**` patterns.
-  Note that this can result in a lot of duplicate references in the
-  presence of cyclic links.
-* `realpath` Set to true to call `fs.realpath` on all of the results.
-  In the case of a symlink that cannot be resolved, the full absolute
-  path to the matched entry is returned (though it will usually be a
-  broken symlink)
-* `absolute` Set to true to always receive absolute paths for matched
-  files.  Unlike `realpath`, this also affects the values returned in
-  the `match` event.
-
-## Comparisons to other fnmatch/glob implementations
-
-While strict compliance with the existing standards is a worthwhile
-goal, some discrepancies exist between node-glob and other
-implementations, and are intentional.
-
-The double-star character `**` is supported by default, unless the
-`noglobstar` flag is set.  This is supported in the manner of bsdglob
-and bash 4.3, where `**` only has special significance if it is the only
-thing in a path part.  That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not.
-
-Note that symlinked directories are not crawled as part of a `**`,
-though their contents may match against subsequent portions of the
-pattern.  This prevents infinite loops and duplicates and the like.
-
-If an escaped pattern has no matches, and the `nonull` flag is set,
-then glob returns the pattern as-provided, rather than
-interpreting the character escapes.  For example,
-`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
-`"*a?"`.  This is akin to setting the `nullglob` option in bash, except
-that it does not resolve escaped pattern characters.
-
-If brace expansion is not disabled, then it is performed before any
-other interpretation of the glob pattern.  Thus, a pattern like
-`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
-**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
-checked for validity.  Since those two are valid, matching proceeds.
-
-### Comments and Negation
-
-Previously, this module let you mark a pattern as a "comment" if it
-started with a `#` character, or a "negated" pattern if it started
-with a `!` character.
-
-These options were deprecated in version 5, and removed in version 6.
-
-To specify things that should not match, use the `ignore` option.
-
-## Windows
-
-**Please only use forward-slashes in glob expressions.**
-
-Though windows uses either `/` or `\` as its path separator, only `/`
-characters are used by this glob implementation.  You must use
-forward-slashes **only** in glob expressions.  Back-slashes will always
-be interpreted as escape characters, not path separators.
-
-Results from absolute patterns such as `/foo/*` are mounted onto the
-root setting using `path.join`.  On windows, this will by default result
-in `/foo/*` matching `C:\foo\bar.txt`.
-
-## Race Conditions
-
-Glob searching, by its very nature, is susceptible to race conditions,
-since it relies on directory walking and such.
-
-As a result, it is possible that a file that exists when glob looks for
-it may have been deleted or modified by the time it returns the result.
-
-As part of its internal implementation, this program caches all stat
-and readdir calls that it makes, in order to cut down on system
-overhead.  However, this also makes it even more susceptible to races,
-especially if the cache or statCache objects are reused between glob
-calls.
-
-Users are thus advised not to use a glob result as a guarantee of
-filesystem state in the face of rapid changes.  For the vast majority
-of operations, this is never a problem.
-
-## Glob Logo
-Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo).
-
-The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).
-
-## Contributing
-
-Any change to behavior (including bugfixes) must come with a test.
-
-Patches that fail tests or reduce performance will be rejected.
-
-```
-# to run tests
-npm test
-
-# to re-generate test fixtures
-npm run test-regen
-
-# to benchmark against bash/zsh
-npm run bench
-
-# to profile javascript
-npm run prof
-```
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/changelog.md b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/changelog.md
deleted file mode 100644 (file)
index 4163677..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-## 7.0
-
-- Raise error if `options.cwd` is specified, and not a directory
-
-## 6.0
-
-- Remove comment and negation pattern support
-- Ignore patterns are always in `dot:true` mode
-
-## 5.0
-
-- Deprecate comment and negation patterns
-- Fix regression in `mark` and `nodir` options from making all cache
-  keys absolute path.
-- Abort if `fs.readdir` returns an error that's unexpected
-- Don't emit `match` events for ignored items
-- Treat ENOTSUP like ENOTDIR in readdir
-
-## 4.5
-
-- Add `options.follow` to always follow directory symlinks in globstar
-- Add `options.realpath` to call `fs.realpath` on all results
-- Always cache based on absolute path
-
-## 4.4
-
-- Add `options.ignore`
-- Fix handling of broken symlinks
-
-## 4.3
-
-- Bump minimatch to 2.x
-- Pass all tests on Windows
-
-## 4.2
-
-- Add `glob.hasMagic` function
-- Add `options.nodir` flag
-
-## 4.1
-
-- Refactor sync and async implementations for performance
-- Throw if callback provided to sync glob function
-- Treat symbolic links in globstar results the same as Bash 4.3
-
-## 4.0
-
-- Use `^` for dependency versions (bumped major because this breaks
-  older npm versions)
-- Ensure callbacks are only ever called once
-- switch to ISC license
-
-## 3.x
-
-- Rewrite in JavaScript
-- Add support for setting root, cwd, and windows support
-- Cache many fs calls
-- Add globstar support
-- emit match events
-
-## 2.x
-
-- Use `glob.h` and `fnmatch.h` from NetBSD
-
-## 1.x
-
-- `glob.h` static binding.
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/common.js b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/common.js
deleted file mode 100644 (file)
index 66651bb..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-exports.alphasort = alphasort
-exports.alphasorti = alphasorti
-exports.setopts = setopts
-exports.ownProp = ownProp
-exports.makeAbs = makeAbs
-exports.finish = finish
-exports.mark = mark
-exports.isIgnored = isIgnored
-exports.childrenIgnored = childrenIgnored
-
-function ownProp (obj, field) {
-  return Object.prototype.hasOwnProperty.call(obj, field)
-}
-
-var path = require("path")
-var minimatch = require("minimatch")
-var isAbsolute = require("path-is-absolute")
-var Minimatch = minimatch.Minimatch
-
-function alphasorti (a, b) {
-  return a.toLowerCase().localeCompare(b.toLowerCase())
-}
-
-function alphasort (a, b) {
-  return a.localeCompare(b)
-}
-
-function setupIgnores (self, options) {
-  self.ignore = options.ignore || []
-
-  if (!Array.isArray(self.ignore))
-    self.ignore = [self.ignore]
-
-  if (self.ignore.length) {
-    self.ignore = self.ignore.map(ignoreMap)
-  }
-}
-
-// ignore patterns are always in dot:true mode.
-function ignoreMap (pattern) {
-  var gmatcher = null
-  if (pattern.slice(-3) === '/**') {
-    var gpattern = pattern.replace(/(\/\*\*)+$/, '')
-    gmatcher = new Minimatch(gpattern, { dot: true })
-  }
-
-  return {
-    matcher: new Minimatch(pattern, { dot: true }),
-    gmatcher: gmatcher
-  }
-}
-
-function setopts (self, pattern, options) {
-  if (!options)
-    options = {}
-
-  // base-matching: just use globstar for that.
-  if (options.matchBase && -1 === pattern.indexOf("/")) {
-    if (options.noglobstar) {
-      throw new Error("base matching requires globstar")
-    }
-    pattern = "**/" + pattern
-  }
-
-  self.silent = !!options.silent
-  self.pattern = pattern
-  self.strict = options.strict !== false
-  self.realpath = !!options.realpath
-  self.realpathCache = options.realpathCache || Object.create(null)
-  self.follow = !!options.follow
-  self.dot = !!options.dot
-  self.mark = !!options.mark
-  self.nodir = !!options.nodir
-  if (self.nodir)
-    self.mark = true
-  self.sync = !!options.sync
-  self.nounique = !!options.nounique
-  self.nonull = !!options.nonull
-  self.nosort = !!options.nosort
-  self.nocase = !!options.nocase
-  self.stat = !!options.stat
-  self.noprocess = !!options.noprocess
-  self.absolute = !!options.absolute
-
-  self.maxLength = options.maxLength || Infinity
-  self.cache = options.cache || Object.create(null)
-  self.statCache = options.statCache || Object.create(null)
-  self.symlinks = options.symlinks || Object.create(null)
-
-  setupIgnores(self, options)
-
-  self.changedCwd = false
-  var cwd = process.cwd()
-  if (!ownProp(options, "cwd"))
-    self.cwd = cwd
-  else {
-    self.cwd = path.resolve(options.cwd)
-    self.changedCwd = self.cwd !== cwd
-  }
-
-  self.root = options.root || path.resolve(self.cwd, "/")
-  self.root = path.resolve(self.root)
-  if (process.platform === "win32")
-    self.root = self.root.replace(/\\/g, "/")
-
-  // TODO: is an absolute `cwd` supposed to be resolved against `root`?
-  // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
-  self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
-  if (process.platform === "win32")
-    self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
-  self.nomount = !!options.nomount
-
-  // disable comments and negation in Minimatch.
-  // Note that they are not supported in Glob itself anyway.
-  options.nonegate = true
-  options.nocomment = true
-
-  self.minimatch = new Minimatch(pattern, options)
-  self.options = self.minimatch.options
-}
-
-function finish (self) {
-  var nou = self.nounique
-  var all = nou ? [] : Object.create(null)
-
-  for (var i = 0, l = self.matches.length; i < l; i ++) {
-    var matches = self.matches[i]
-    if (!matches || Object.keys(matches).length === 0) {
-      if (self.nonull) {
-        // do like the shell, and spit out the literal glob
-        var literal = self.minimatch.globSet[i]
-        if (nou)
-          all.push(literal)
-        else
-          all[literal] = true
-      }
-    } else {
-      // had matches
-      var m = Object.keys(matches)
-      if (nou)
-        all.push.apply(all, m)
-      else
-        m.forEach(function (m) {
-          all[m] = true
-        })
-    }
-  }
-
-  if (!nou)
-    all = Object.keys(all)
-
-  if (!self.nosort)
-    all = all.sort(self.nocase ? alphasorti : alphasort)
-
-  // at *some* point we statted all of these
-  if (self.mark) {
-    for (var i = 0; i < all.length; i++) {
-      all[i] = self._mark(all[i])
-    }
-    if (self.nodir) {
-      all = all.filter(function (e) {
-        var notDir = !(/\/$/.test(e))
-        var c = self.cache[e] || self.cache[makeAbs(self, e)]
-        if (notDir && c)
-          notDir = c !== 'DIR' && !Array.isArray(c)
-        return notDir
-      })
-    }
-  }
-
-  if (self.ignore.length)
-    all = all.filter(function(m) {
-      return !isIgnored(self, m)
-    })
-
-  self.found = all
-}
-
-function mark (self, p) {
-  var abs = makeAbs(self, p)
-  var c = self.cache[abs]
-  var m = p
-  if (c) {
-    var isDir = c === 'DIR' || Array.isArray(c)
-    var slash = p.slice(-1) === '/'
-
-    if (isDir && !slash)
-      m += '/'
-    else if (!isDir && slash)
-      m = m.slice(0, -1)
-
-    if (m !== p) {
-      var mabs = makeAbs(self, m)
-      self.statCache[mabs] = self.statCache[abs]
-      self.cache[mabs] = self.cache[abs]
-    }
-  }
-
-  return m
-}
-
-// lotta situps...
-function makeAbs (self, f) {
-  var abs = f
-  if (f.charAt(0) === '/') {
-    abs = path.join(self.root, f)
-  } else if (isAbsolute(f) || f === '') {
-    abs = f
-  } else if (self.changedCwd) {
-    abs = path.resolve(self.cwd, f)
-  } else {
-    abs = path.resolve(f)
-  }
-
-  if (process.platform === 'win32')
-    abs = abs.replace(/\\/g, '/')
-
-  return abs
-}
-
-
-// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
-// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
-function isIgnored (self, path) {
-  if (!self.ignore.length)
-    return false
-
-  return self.ignore.some(function(item) {
-    return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
-  })
-}
-
-function childrenIgnored (self, path) {
-  if (!self.ignore.length)
-    return false
-
-  return self.ignore.some(function(item) {
-    return !!(item.gmatcher && item.gmatcher.match(path))
-  })
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/glob.js b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/glob.js
deleted file mode 100644 (file)
index 58dec0f..0000000
+++ /dev/null
@@ -1,790 +0,0 @@
-// Approach:
-//
-// 1. Get the minimatch set
-// 2. For each pattern in the set, PROCESS(pattern, false)
-// 3. Store matches per-set, then uniq them
-//
-// PROCESS(pattern, inGlobStar)
-// Get the first [n] items from pattern that are all strings
-// Join these together.  This is PREFIX.
-//   If there is no more remaining, then stat(PREFIX) and
-//   add to matches if it succeeds.  END.
-//
-// If inGlobStar and PREFIX is symlink and points to dir
-//   set ENTRIES = []
-// else readdir(PREFIX) as ENTRIES
-//   If fail, END
-//
-// with ENTRIES
-//   If pattern[n] is GLOBSTAR
-//     // handle the case where the globstar match is empty
-//     // by pruning it out, and testing the resulting pattern
-//     PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
-//     // handle other cases.
-//     for ENTRY in ENTRIES (not dotfiles)
-//       // attach globstar + tail onto the entry
-//       // Mark that this entry is a globstar match
-//       PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
-//
-//   else // not globstar
-//     for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
-//       Test ENTRY against pattern[n]
-//       If fails, continue
-//       If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
-//
-// Caveat:
-//   Cache all stats and readdirs results to minimize syscall.  Since all
-//   we ever care about is existence and directory-ness, we can just keep
-//   `true` for files, and [children,...] for directories, or `false` for
-//   things that don't exist.
-
-module.exports = glob
-
-var fs = require('fs')
-var rp = require('fs.realpath')
-var minimatch = require('minimatch')
-var Minimatch = minimatch.Minimatch
-var inherits = require('inherits')
-var EE = require('events').EventEmitter
-var path = require('path')
-var assert = require('assert')
-var isAbsolute = require('path-is-absolute')
-var globSync = require('./sync.js')
-var common = require('./common.js')
-var alphasort = common.alphasort
-var alphasorti = common.alphasorti
-var setopts = common.setopts
-var ownProp = common.ownProp
-var inflight = require('inflight')
-var util = require('util')
-var childrenIgnored = common.childrenIgnored
-var isIgnored = common.isIgnored
-
-var once = require('once')
-
-function glob (pattern, options, cb) {
-  if (typeof options === 'function') cb = options, options = {}
-  if (!options) options = {}
-
-  if (options.sync) {
-    if (cb)
-      throw new TypeError('callback provided to sync glob')
-    return globSync(pattern, options)
-  }
-
-  return new Glob(pattern, options, cb)
-}
-
-glob.sync = globSync
-var GlobSync = glob.GlobSync = globSync.GlobSync
-
-// old api surface
-glob.glob = glob
-
-function extend (origin, add) {
-  if (add === null || typeof add !== 'object') {
-    return origin
-  }
-
-  var keys = Object.keys(add)
-  var i = keys.length
-  while (i--) {
-    origin[keys[i]] = add[keys[i]]
-  }
-  return origin
-}
-
-glob.hasMagic = function (pattern, options_) {
-  var options = extend({}, options_)
-  options.noprocess = true
-
-  var g = new Glob(pattern, options)
-  var set = g.minimatch.set
-
-  if (!pattern)
-    return false
-
-  if (set.length > 1)
-    return true
-
-  for (var j = 0; j < set[0].length; j++) {
-    if (typeof set[0][j] !== 'string')
-      return true
-  }
-
-  return false
-}
-
-glob.Glob = Glob
-inherits(Glob, EE)
-function Glob (pattern, options, cb) {
-  if (typeof options === 'function') {
-    cb = options
-    options = null
-  }
-
-  if (options && options.sync) {
-    if (cb)
-      throw new TypeError('callback provided to sync glob')
-    return new GlobSync(pattern, options)
-  }
-
-  if (!(this instanceof Glob))
-    return new Glob(pattern, options, cb)
-
-  setopts(this, pattern, options)
-  this._didRealPath = false
-
-  // process each pattern in the minimatch set
-  var n = this.minimatch.set.length
-
-  // The matches are stored as {<filename>: true,...} so that
-  // duplicates are automagically pruned.
-  // Later, we do an Object.keys() on these.
-  // Keep them as a list so we can fill in when nonull is set.
-  this.matches = new Array(n)
-
-  if (typeof cb === 'function') {
-    cb = once(cb)
-    this.on('error', cb)
-    this.on('end', function (matches) {
-      cb(null, matches)
-    })
-  }
-
-  var self = this
-  this._processing = 0
-
-  this._emitQueue = []
-  this._processQueue = []
-  this.paused = false
-
-  if (this.noprocess)
-    return this
-
-  if (n === 0)
-    return done()
-
-  var sync = true
-  for (var i = 0; i < n; i ++) {
-    this._process(this.minimatch.set[i], i, false, done)
-  }
-  sync = false
-
-  function done () {
-    --self._processing
-    if (self._processing <= 0) {
-      if (sync) {
-        process.nextTick(function () {
-          self._finish()
-        })
-      } else {
-        self._finish()
-      }
-    }
-  }
-}
-
-Glob.prototype._finish = function () {
-  assert(this instanceof Glob)
-  if (this.aborted)
-    return
-
-  if (this.realpath && !this._didRealpath)
-    return this._realpath()
-
-  common.finish(this)
-  this.emit('end', this.found)
-}
-
-Glob.prototype._realpath = function () {
-  if (this._didRealpath)
-    return
-
-  this._didRealpath = true
-
-  var n = this.matches.length
-  if (n === 0)
-    return this._finish()
-
-  var self = this
-  for (var i = 0; i < this.matches.length; i++)
-    this._realpathSet(i, next)
-
-  function next () {
-    if (--n === 0)
-      self._finish()
-  }
-}
-
-Glob.prototype._realpathSet = function (index, cb) {
-  var matchset = this.matches[index]
-  if (!matchset)
-    return cb()
-
-  var found = Object.keys(matchset)
-  var self = this
-  var n = found.length
-
-  if (n === 0)
-    return cb()
-
-  var set = this.matches[index] = Object.create(null)
-  found.forEach(function (p, i) {
-    // If there's a problem with the stat, then it means that
-    // one or more of the links in the realpath couldn't be
-    // resolved.  just return the abs value in that case.
-    p = self._makeAbs(p)
-    rp.realpath(p, self.realpathCache, function (er, real) {
-      if (!er)
-        set[real] = true
-      else if (er.syscall === 'stat')
-        set[p] = true
-      else
-        self.emit('error', er) // srsly wtf right here
-
-      if (--n === 0) {
-        self.matches[index] = set
-        cb()
-      }
-    })
-  })
-}
-
-Glob.prototype._mark = function (p) {
-  return common.mark(this, p)
-}
-
-Glob.prototype._makeAbs = function (f) {
-  return common.makeAbs(this, f)
-}
-
-Glob.prototype.abort = function () {
-  this.aborted = true
-  this.emit('abort')
-}
-
-Glob.prototype.pause = function () {
-  if (!this.paused) {
-    this.paused = true
-    this.emit('pause')
-  }
-}
-
-Glob.prototype.resume = function () {
-  if (this.paused) {
-    this.emit('resume')
-    this.paused = false
-    if (this._emitQueue.length) {
-      var eq = this._emitQueue.slice(0)
-      this._emitQueue.length = 0
-      for (var i = 0; i < eq.length; i ++) {
-        var e = eq[i]
-        this._emitMatch(e[0], e[1])
-      }
-    }
-    if (this._processQueue.length) {
-      var pq = this._processQueue.slice(0)
-      this._processQueue.length = 0
-      for (var i = 0; i < pq.length; i ++) {
-        var p = pq[i]
-        this._processing--
-        this._process(p[0], p[1], p[2], p[3])
-      }
-    }
-  }
-}
-
-Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
-  assert(this instanceof Glob)
-  assert(typeof cb === 'function')
-
-  if (this.aborted)
-    return
-
-  this._processing++
-  if (this.paused) {
-    this._processQueue.push([pattern, index, inGlobStar, cb])
-    return
-  }
-
-  //console.error('PROCESS %d', this._processing, pattern)
-
-  // Get the first [n] parts of pattern that are all strings.
-  var n = 0
-  while (typeof pattern[n] === 'string') {
-    n ++
-  }
-  // now n is the index of the first one that is *not* a string.
-
-  // see if there's anything else
-  var prefix
-  switch (n) {
-    // if not, then this is rather simple
-    case pattern.length:
-      this._processSimple(pattern.join('/'), index, cb)
-      return
-
-    case 0:
-      // pattern *starts* with some non-trivial item.
-      // going to readdir(cwd), but not include the prefix in matches.
-      prefix = null
-      break
-
-    default:
-      // pattern has some string bits in the front.
-      // whatever it starts with, whether that's 'absolute' like /foo/bar,
-      // or 'relative' like '../baz'
-      prefix = pattern.slice(0, n).join('/')
-      break
-  }
-
-  var remain = pattern.slice(n)
-
-  // get the list of entries.
-  var read
-  if (prefix === null)
-    read = '.'
-  else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
-    if (!prefix || !isAbsolute(prefix))
-      prefix = '/' + prefix
-    read = prefix
-  } else
-    read = prefix
-
-  var abs = this._makeAbs(read)
-
-  //if ignored, skip _processing
-  if (childrenIgnored(this, read))
-    return cb()
-
-  var isGlobStar = remain[0] === minimatch.GLOBSTAR
-  if (isGlobStar)
-    this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
-  else
-    this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
-}
-
-Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
-  var self = this
-  this._readdir(abs, inGlobStar, function (er, entries) {
-    return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
-  })
-}
-
-Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-
-  // if the abs isn't a dir, then nothing can match!
-  if (!entries)
-    return cb()
-
-  // It will only match dot entries if it starts with a dot, or if
-  // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
-  var pn = remain[0]
-  var negate = !!this.minimatch.negate
-  var rawGlob = pn._glob
-  var dotOk = this.dot || rawGlob.charAt(0) === '.'
-
-  var matchedEntries = []
-  for (var i = 0; i < entries.length; i++) {
-    var e = entries[i]
-    if (e.charAt(0) !== '.' || dotOk) {
-      var m
-      if (negate && !prefix) {
-        m = !e.match(pn)
-      } else {
-        m = e.match(pn)
-      }
-      if (m)
-        matchedEntries.push(e)
-    }
-  }
-
-  //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
-
-  var len = matchedEntries.length
-  // If there are no matched entries, then nothing matches.
-  if (len === 0)
-    return cb()
-
-  // if this is the last remaining pattern bit, then no need for
-  // an additional stat *unless* the user has specified mark or
-  // stat explicitly.  We know they exist, since readdir returned
-  // them.
-
-  if (remain.length === 1 && !this.mark && !this.stat) {
-    if (!this.matches[index])
-      this.matches[index] = Object.create(null)
-
-    for (var i = 0; i < len; i ++) {
-      var e = matchedEntries[i]
-      if (prefix) {
-        if (prefix !== '/')
-          e = prefix + '/' + e
-        else
-          e = prefix + e
-      }
-
-      if (e.charAt(0) === '/' && !this.nomount) {
-        e = path.join(this.root, e)
-      }
-      this._emitMatch(index, e)
-    }
-    // This was the last one, and no stats were needed
-    return cb()
-  }
-
-  // now test all matched entries as stand-ins for that part
-  // of the pattern.
-  remain.shift()
-  for (var i = 0; i < len; i ++) {
-    var e = matchedEntries[i]
-    var newPattern
-    if (prefix) {
-      if (prefix !== '/')
-        e = prefix + '/' + e
-      else
-        e = prefix + e
-    }
-    this._process([e].concat(remain), index, inGlobStar, cb)
-  }
-  cb()
-}
-
-Glob.prototype._emitMatch = function (index, e) {
-  if (this.aborted)
-    return
-
-  if (isIgnored(this, e))
-    return
-
-  if (this.paused) {
-    this._emitQueue.push([index, e])
-    return
-  }
-
-  var abs = isAbsolute(e) ? e : this._makeAbs(e)
-
-  if (this.mark)
-    e = this._mark(e)
-
-  if (this.absolute)
-    e = abs
-
-  if (this.matches[index][e])
-    return
-
-  if (this.nodir) {
-    var c = this.cache[abs]
-    if (c === 'DIR' || Array.isArray(c))
-      return
-  }
-
-  this.matches[index][e] = true
-
-  var st = this.statCache[abs]
-  if (st)
-    this.emit('stat', e, st)
-
-  this.emit('match', e)
-}
-
-Glob.prototype._readdirInGlobStar = function (abs, cb) {
-  if (this.aborted)
-    return
-
-  // follow all symlinked directories forever
-  // just proceed as if this is a non-globstar situation
-  if (this.follow)
-    return this._readdir(abs, false, cb)
-
-  var lstatkey = 'lstat\0' + abs
-  var self = this
-  var lstatcb = inflight(lstatkey, lstatcb_)
-
-  if (lstatcb)
-    fs.lstat(abs, lstatcb)
-
-  function lstatcb_ (er, lstat) {
-    if (er && er.code === 'ENOENT')
-      return cb()
-
-    var isSym = lstat && lstat.isSymbolicLink()
-    self.symlinks[abs] = isSym
-
-    // If it's not a symlink or a dir, then it's definitely a regular file.
-    // don't bother doing a readdir in that case.
-    if (!isSym && lstat && !lstat.isDirectory()) {
-      self.cache[abs] = 'FILE'
-      cb()
-    } else
-      self._readdir(abs, false, cb)
-  }
-}
-
-Glob.prototype._readdir = function (abs, inGlobStar, cb) {
-  if (this.aborted)
-    return
-
-  cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
-  if (!cb)
-    return
-
-  //console.error('RD %j %j', +inGlobStar, abs)
-  if (inGlobStar && !ownProp(this.symlinks, abs))
-    return this._readdirInGlobStar(abs, cb)
-
-  if (ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-    if (!c || c === 'FILE')
-      return cb()
-
-    if (Array.isArray(c))
-      return cb(null, c)
-  }
-
-  var self = this
-  fs.readdir(abs, readdirCb(this, abs, cb))
-}
-
-function readdirCb (self, abs, cb) {
-  return function (er, entries) {
-    if (er)
-      self._readdirError(abs, er, cb)
-    else
-      self._readdirEntries(abs, entries, cb)
-  }
-}
-
-Glob.prototype._readdirEntries = function (abs, entries, cb) {
-  if (this.aborted)
-    return
-
-  // if we haven't asked to stat everything, then just
-  // assume that everything in there exists, so we can avoid
-  // having to stat it a second time.
-  if (!this.mark && !this.stat) {
-    for (var i = 0; i < entries.length; i ++) {
-      var e = entries[i]
-      if (abs === '/')
-        e = abs + e
-      else
-        e = abs + '/' + e
-      this.cache[e] = true
-    }
-  }
-
-  this.cache[abs] = entries
-  return cb(null, entries)
-}
-
-Glob.prototype._readdirError = function (f, er, cb) {
-  if (this.aborted)
-    return
-
-  // handle errors, and cache the information
-  switch (er.code) {
-    case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
-    case 'ENOTDIR': // totally normal. means it *does* exist.
-      var abs = this._makeAbs(f)
-      this.cache[abs] = 'FILE'
-      if (abs === this.cwdAbs) {
-        var error = new Error(er.code + ' invalid cwd ' + this.cwd)
-        error.path = this.cwd
-        error.code = er.code
-        this.emit('error', error)
-        this.abort()
-      }
-      break
-
-    case 'ENOENT': // not terribly unusual
-    case 'ELOOP':
-    case 'ENAMETOOLONG':
-    case 'UNKNOWN':
-      this.cache[this._makeAbs(f)] = false
-      break
-
-    default: // some unusual error.  Treat as failure.
-      this.cache[this._makeAbs(f)] = false
-      if (this.strict) {
-        this.emit('error', er)
-        // If the error is handled, then we abort
-        // if not, we threw out of here
-        this.abort()
-      }
-      if (!this.silent)
-        console.error('glob error', er)
-      break
-  }
-
-  return cb()
-}
-
-Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
-  var self = this
-  this._readdir(abs, inGlobStar, function (er, entries) {
-    self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
-  })
-}
-
-
-Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
-  //console.error('pgs2', prefix, remain[0], entries)
-
-  // no entries means not a dir, so it can never have matches
-  // foo.txt/** doesn't match foo.txt
-  if (!entries)
-    return cb()
-
-  // test without the globstar, and with every child both below
-  // and replacing the globstar.
-  var remainWithoutGlobStar = remain.slice(1)
-  var gspref = prefix ? [ prefix ] : []
-  var noGlobStar = gspref.concat(remainWithoutGlobStar)
-
-  // the noGlobStar pattern exits the inGlobStar state
-  this._process(noGlobStar, index, false, cb)
-
-  var isSym = this.symlinks[abs]
-  var len = entries.length
-
-  // If it's a symlink, and we're in a globstar, then stop
-  if (isSym && inGlobStar)
-    return cb()
-
-  for (var i = 0; i < len; i++) {
-    var e = entries[i]
-    if (e.charAt(0) === '.' && !this.dot)
-      continue
-
-    // these two cases enter the inGlobStar state
-    var instead = gspref.concat(entries[i], remainWithoutGlobStar)
-    this._process(instead, index, true, cb)
-
-    var below = gspref.concat(entries[i], remain)
-    this._process(below, index, true, cb)
-  }
-
-  cb()
-}
-
-Glob.prototype._processSimple = function (prefix, index, cb) {
-  // XXX review this.  Shouldn't it be doing the mounting etc
-  // before doing stat?  kinda weird?
-  var self = this
-  this._stat(prefix, function (er, exists) {
-    self._processSimple2(prefix, index, er, exists, cb)
-  })
-}
-Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
-
-  //console.error('ps2', prefix, exists)
-
-  if (!this.matches[index])
-    this.matches[index] = Object.create(null)
-
-  // If it doesn't exist, then just mark the lack of results
-  if (!exists)
-    return cb()
-
-  if (prefix && isAbsolute(prefix) && !this.nomount) {
-    var trail = /[\/\\]$/.test(prefix)
-    if (prefix.charAt(0) === '/') {
-      prefix = path.join(this.root, prefix)
-    } else {
-      prefix = path.resolve(this.root, prefix)
-      if (trail)
-        prefix += '/'
-    }
-  }
-
-  if (process.platform === 'win32')
-    prefix = prefix.replace(/\\/g, '/')
-
-  // Mark this as a match
-  this._emitMatch(index, prefix)
-  cb()
-}
-
-// Returns either 'DIR', 'FILE', or false
-Glob.prototype._stat = function (f, cb) {
-  var abs = this._makeAbs(f)
-  var needDir = f.slice(-1) === '/'
-
-  if (f.length > this.maxLength)
-    return cb()
-
-  if (!this.stat && ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-
-    if (Array.isArray(c))
-      c = 'DIR'
-
-    // It exists, but maybe not how we need it
-    if (!needDir || c === 'DIR')
-      return cb(null, c)
-
-    if (needDir && c === 'FILE')
-      return cb()
-
-    // otherwise we have to stat, because maybe c=true
-    // if we know it exists, but not what it is.
-  }
-
-  var exists
-  var stat = this.statCache[abs]
-  if (stat !== undefined) {
-    if (stat === false)
-      return cb(null, stat)
-    else {
-      var type = stat.isDirectory() ? 'DIR' : 'FILE'
-      if (needDir && type === 'FILE')
-        return cb()
-      else
-        return cb(null, type, stat)
-    }
-  }
-
-  var self = this
-  var statcb = inflight('stat\0' + abs, lstatcb_)
-  if (statcb)
-    fs.lstat(abs, statcb)
-
-  function lstatcb_ (er, lstat) {
-    if (lstat && lstat.isSymbolicLink()) {
-      // If it's a symlink, then treat it as the target, unless
-      // the target does not exist, then treat it as a file.
-      return fs.stat(abs, function (er, stat) {
-        if (er)
-          self._stat2(f, abs, null, lstat, cb)
-        else
-          self._stat2(f, abs, er, stat, cb)
-      })
-    } else {
-      self._stat2(f, abs, er, lstat, cb)
-    }
-  }
-}
-
-Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
-  if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
-    this.statCache[abs] = false
-    return cb()
-  }
-
-  var needDir = f.slice(-1) === '/'
-  this.statCache[abs] = stat
-
-  if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
-    return cb(null, false, stat)
-
-  var c = true
-  if (stat)
-    c = stat.isDirectory() ? 'DIR' : 'FILE'
-  this.cache[abs] = this.cache[abs] || c
-
-  if (needDir && c === 'FILE')
-    return cb()
-
-  return cb(null, c, stat)
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/package.json b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/package.json
deleted file mode 100644 (file)
index 02962a6..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-{
-  "_from": "glob@^7.1.3",
-  "_id": "glob@7.1.4",
-  "_inBundle": false,
-  "_integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
-  "_location": "/grpc/rimraf/glob",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "glob@^7.1.3",
-    "name": "glob",
-    "escapedName": "glob",
-    "rawSpec": "^7.1.3",
-    "saveSpec": null,
-    "fetchSpec": "^7.1.3"
-  },
-  "_requiredBy": [
-    "/grpc/rimraf"
-  ],
-  "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
-  "_shasum": "aa608a2f6c577ad357e1ae5a5c26d9a8d1969255",
-  "_shrinkwrap": null,
-  "_spec": "glob@^7.1.3",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/rimraf",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/node-glob/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "fs.realpath": "^1.0.0",
-    "inflight": "^1.0.4",
-    "inherits": "2",
-    "minimatch": "^3.0.4",
-    "once": "^1.3.0",
-    "path-is-absolute": "^1.0.0"
-  },
-  "deprecated": false,
-  "description": "a little globber",
-  "devDependencies": {
-    "mkdirp": "0",
-    "rimraf": "^2.2.8",
-    "tap": "^12.0.1",
-    "tick": "0.0.6"
-  },
-  "engines": {
-    "node": "*"
-  },
-  "files": [
-    "glob.js",
-    "sync.js",
-    "common.js"
-  ],
-  "homepage": "https://github.com/isaacs/node-glob#readme",
-  "license": "ISC",
-  "main": "glob.js",
-  "name": "glob",
-  "optionalDependencies": {},
-  "readme": "# Glob\n\nMatch files using the patterns the shell uses, like stars and stuff.\n\n[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master)\n\nThis is a glob implementation in JavaScript.  It uses the `minimatch`\nlibrary to do its matching.\n\n![](logo/glob.png)\n\n## Usage\n\nInstall with npm\n\n```\nnpm i glob\n```\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n  // files is an array of filenames.\n  // If the `nonull` option is set, and nothing\n  // was found, then files is [\"**/*.js\"]\n  // er is an error object or null.\n})\n```\n\n## Glob Primer\n\n\"Globs\" are the patterns you type when you do stuff like `ls *.js` on\nthe command line, or put `build/*` in a `.gitignore` file.\n\nBefore parsing the path part patterns, braced sections are expanded\ninto a set.  Braced sections start with `{` and end with `}`, with any\nnumber of comma-delimited sections within.  Braced sections may contain\nslash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.\n\nThe following characters have special magic meaning when used in a\npath portion:\n\n* `*` Matches 0 or more characters in a single path portion\n* `?` Matches 1 character\n* `[...]` Matches a range of characters, similar to a RegExp range.\n  If the first character of the range is `!` or `^` then it matches\n  any character not in the range.\n* `!(pattern|pattern|pattern)` Matches anything that does not match\n  any of the patterns provided.\n* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the\n  patterns provided.\n* `+(pattern|pattern|pattern)` Matches one or more occurrences of the\n  patterns provided.\n* `*(a|b|c)` Matches zero or more occurrences of the patterns provided\n* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns\n  provided\n* `**` If a \"globstar\" is alone in a path portion, then it matches\n  zero or more directories and subdirectories searching for matches.\n  It does not crawl symlinked directories.\n\n### Dots\n\nIf a file or directory path portion has a `.` as the first character,\nthen it will not match any glob pattern unless that pattern's\ncorresponding path part also has a `.` as its first character.\n\nFor example, the pattern `a/.*/c` would match the file at `a/.b/c`.\nHowever the pattern `a/*/c` would not, because `*` does not start with\na dot character.\n\nYou can make glob treat dots as normal characters by setting\n`dot:true` in the options.\n\n### Basename Matching\n\nIf you set `matchBase:true` in the options, and the pattern has no\nslashes in it, then it will seek for any file anywhere in the tree\nwith a matching basename.  For example, `*.js` would match\n`test/simple/basic.js`.\n\n### Empty Sets\n\nIf no matching files are found, then an empty array is returned.  This\ndiffers from the shell, where the pattern itself is returned.  For\nexample:\n\n    $ echo a*s*d*f\n    a*s*d*f\n\nTo get the bash-style behavior, set the `nonull:true` in the options.\n\n### See Also:\n\n* `man sh`\n* `man bash` (Search for \"Pattern Matching\")\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob.hasMagic(pattern, [options])\n\nReturns `true` if there are any special characters in the pattern, and\n`false` otherwise.\n\nNote that the options affect the results.  If `noext:true` is set in\nthe options object, then `+(a|b)` will not be considered a magic\npattern.  If the pattern has a brace expansion, like `a/{b/c,x/y}`\nthen that is considered magical, unless `nobrace:true` is set in the\noptions.\n\n## glob(pattern, [options], cb)\n\n* `pattern` `{String}` Pattern to be matched\n* `options` `{Object}`\n* `cb` `{Function}`\n  * `err` `{Error | null}`\n  * `matches` `{Array<String>}` filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options])\n\n* `pattern` `{String}` Pattern to be matched\n* `options` `{Object}`\n* return: `{Array<String>}` filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instantiating the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` `{String}` pattern to search for\n* `options` `{Object}`\n* `cb` `{Function}` Called when an error occurs, or matches are found\n  * `err` `{Error | null}`\n  * `matches` `{Array<String>}` filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `aborted` Boolean which is set to true when calling `abort()`.  There\n  is no way at this time to continue a glob search after aborting, but\n  you can re-use the statCache to avoid having to duplicate syscalls.\n* `cache` Convenience object.  Each field has the following possible\n  values:\n  * `false` - Path does not exist\n  * `true` - Path exists\n  * `'FILE'` - Path exists, and is not a directory\n  * `'DIR'` - Path exists, and is a directory\n  * `[file, entries, ...]` - Path exists, is a directory, and the\n    array value is the results of `fs.readdir`\n* `statCache` Cache of `fs.stat` results, to prevent statting the same\n  path multiple times.\n* `symlinks` A record of which paths are symbolic links, which is\n  relevant in resolving `**` patterns.\n* `realpathCache` An optional object which is passed to `fs.realpath`\n  to minimize unnecessary syscalls.  It is stored on the instantiated\n  Glob object, and may be re-used.\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n  matches found.  If the `nonull` option is set, and no match was found,\n  then the `matches` list contains the original pattern.  The matches\n  are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the specific\n  thing that matched. It is not deduplicated or resolved to a realpath.\n* `error` Emitted when an unexpected error is encountered, or whenever\n  any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `pause` Temporarily stop the search\n* `resume` Resume the search\n* `abort` Stop the search forever\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior.  Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the Glob object, as well.\n\nIf you are running many `glob` operations, you can pass a Glob object\nas the `options` argument to a subsequent operation to shortcut some\n`stat` and `readdir` calls.  At the very least, you may pass in shared\n`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that\nparallel glob operations will be sped up by sharing information about\nthe filesystem.\n\n* `cwd` The current working directory in which to search.  Defaults\n  to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n  onto.  Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n  systems, and `C:\\` or some such on Windows.)\n* `dot` Include `.dot` files in normal matches and `globstar` matches.\n  Note that an explicit dot in a portion of the pattern will always\n  match dot files.\n* `nomount` By default, a pattern starting with a forward-slash will be\n  \"mounted\" onto the root setting, so that a valid filesystem path is\n  returned.  Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches.  Note that this\n  requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results.  This reduces performance\n  somewhat, and is completely unnecessary, unless `readdir` is presumed\n  to be an untrustworthy indicator of file existence.\n* `silent` When an unusual error is encountered when attempting to\n  read a directory, a warning will be printed to stderr.  Set the\n  `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered when attempting to\n  read a directory, the process will just continue on in search of\n  other matches.  Set the `strict` option to raise an error in these\n  cases.\n* `cache` See `cache` property above.  Pass in a previously generated\n  cache object to save some fs calls.\n* `statCache` A cache of results of filesystem information, to prevent\n  unnecessary stat calls.  While it should not normally be necessary\n  to set this, you may pass the statCache from one glob() call to the\n  options object of another, if you know that the filesystem will not\n  change between calls.  (See \"Race Conditions\" below.)\n* `symlinks` A cache of known symbolic links.  You may pass in a\n  previously generated `symlinks` object to save `lstat` calls when\n  resolving `**` matches.\n* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.\n* `nounique` In some cases, brace-expanded patterns can result in the\n  same file showing up multiple times in the result set.  By default,\n  this implementation prevents duplicates in the result set.  Set this\n  flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n  containing the pattern itself.  This is the default in glob(3).\n* `debug` Set to enable debug logging in minimatch and glob.\n* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.\n* `noglobstar` Do not match `**` against multiple filenames.  (Ie,\n  treat it as a normal `*` instead.)\n* `noext` Do not match `+(a|b)` \"extglob\" patterns.\n* `nocase` Perform a case-insensitive match.  Note: on\n  case-insensitive filesystems, non-magic patterns will match by\n  default, since `stat` and `readdir` will not raise errors.\n* `matchBase` Perform a basename-only match if the pattern does not\n  contain any slash characters.  That is, `*.js` would be treated as\n  equivalent to `**/*.js`, matching all js files in all directories.\n* `nodir` Do not match directories, only files.  (Note: to match\n  *only* directories, simply put a `/` at the end of the pattern.)\n* `ignore` Add a pattern or an array of glob patterns to exclude matches.\n  Note: `ignore` patterns are *always* in `dot:true` mode, regardless\n  of any other settings.\n* `follow` Follow symlinked directories when expanding `**` patterns.\n  Note that this can result in a lot of duplicate references in the\n  presence of cyclic links.\n* `realpath` Set to true to call `fs.realpath` on all of the results.\n  In the case of a symlink that cannot be resolved, the full absolute\n  path to the matched entry is returned (though it will usually be a\n  broken symlink)\n* `absolute` Set to true to always receive absolute paths for matched\n  files.  Unlike `realpath`, this also affects the values returned in\n  the `match` event.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set.  This is supported in the manner of bsdglob\nand bash 4.3, where `**` only has special significance if it is the only\nthing in a path part.  That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nNote that symlinked directories are not crawled as part of a `**`,\nthough their contents may match against subsequent portions of the\npattern.  This prevents infinite loops and duplicates and the like.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes.  For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`.  This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern.  Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity.  Since those two are valid, matching proceeds.\n\n### Comments and Negation\n\nPreviously, this module let you mark a pattern as a \"comment\" if it\nstarted with a `#` character, or a \"negated\" pattern if it started\nwith a `!` character.\n\nThese options were deprecated in version 5, and removed in version 6.\n\nTo specify things that should not match, use the `ignore` option.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation.  You must use\nforward-slashes **only** in glob expressions.  Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`.  On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead.  However, this also makes it even more susceptible to races,\nespecially if the cache or statCache objects are reused between glob\ncalls.\n\nUsers are thus advised not to use a glob result as a guarantee of\nfilesystem state in the face of rapid changes.  For the vast majority\nof operations, this is never a problem.\n\n## Glob Logo\nGlob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo).\n\nThe logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).\n\n## Contributing\n\nAny change to behavior (including bugfixes) must come with a test.\n\nPatches that fail tests or reduce performance will be rejected.\n\n```\n# to run tests\nnpm test\n\n# to re-generate test fixtures\nnpm run test-regen\n\n# to benchmark against bash/zsh\nnpm run bench\n\n# to profile javascript\nnpm run prof\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/node-glob.git"
-  },
-  "scripts": {
-    "bench": "bash benchmark.sh",
-    "benchclean": "node benchclean.js",
-    "prepublish": "npm run benchclean",
-    "prof": "bash prof.sh && cat profile.txt",
-    "profclean": "rm -f v8.log profile.txt",
-    "test": "tap test/*.js --cov",
-    "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js"
-  },
-  "version": "7.1.4"
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/sync.js b/legacy-libs/grpc/node_modules/rimraf/node_modules/glob/sync.js
deleted file mode 100644 (file)
index c952134..0000000
+++ /dev/null
@@ -1,486 +0,0 @@
-module.exports = globSync
-globSync.GlobSync = GlobSync
-
-var fs = require('fs')
-var rp = require('fs.realpath')
-var minimatch = require('minimatch')
-var Minimatch = minimatch.Minimatch
-var Glob = require('./glob.js').Glob
-var util = require('util')
-var path = require('path')
-var assert = require('assert')
-var isAbsolute = require('path-is-absolute')
-var common = require('./common.js')
-var alphasort = common.alphasort
-var alphasorti = common.alphasorti
-var setopts = common.setopts
-var ownProp = common.ownProp
-var childrenIgnored = common.childrenIgnored
-var isIgnored = common.isIgnored
-
-function globSync (pattern, options) {
-  if (typeof options === 'function' || arguments.length === 3)
-    throw new TypeError('callback provided to sync glob\n'+
-                        'See: https://github.com/isaacs/node-glob/issues/167')
-
-  return new GlobSync(pattern, options).found
-}
-
-function GlobSync (pattern, options) {
-  if (!pattern)
-    throw new Error('must provide pattern')
-
-  if (typeof options === 'function' || arguments.length === 3)
-    throw new TypeError('callback provided to sync glob\n'+
-                        'See: https://github.com/isaacs/node-glob/issues/167')
-
-  if (!(this instanceof GlobSync))
-    return new GlobSync(pattern, options)
-
-  setopts(this, pattern, options)
-
-  if (this.noprocess)
-    return this
-
-  var n = this.minimatch.set.length
-  this.matches = new Array(n)
-  for (var i = 0; i < n; i ++) {
-    this._process(this.minimatch.set[i], i, false)
-  }
-  this._finish()
-}
-
-GlobSync.prototype._finish = function () {
-  assert(this instanceof GlobSync)
-  if (this.realpath) {
-    var self = this
-    this.matches.forEach(function (matchset, index) {
-      var set = self.matches[index] = Object.create(null)
-      for (var p in matchset) {
-        try {
-          p = self._makeAbs(p)
-          var real = rp.realpathSync(p, self.realpathCache)
-          set[real] = true
-        } catch (er) {
-          if (er.syscall === 'stat')
-            set[self._makeAbs(p)] = true
-          else
-            throw er
-        }
-      }
-    })
-  }
-  common.finish(this)
-}
-
-
-GlobSync.prototype._process = function (pattern, index, inGlobStar) {
-  assert(this instanceof GlobSync)
-
-  // Get the first [n] parts of pattern that are all strings.
-  var n = 0
-  while (typeof pattern[n] === 'string') {
-    n ++
-  }
-  // now n is the index of the first one that is *not* a string.
-
-  // See if there's anything else
-  var prefix
-  switch (n) {
-    // if not, then this is rather simple
-    case pattern.length:
-      this._processSimple(pattern.join('/'), index)
-      return
-
-    case 0:
-      // pattern *starts* with some non-trivial item.
-      // going to readdir(cwd), but not include the prefix in matches.
-      prefix = null
-      break
-
-    default:
-      // pattern has some string bits in the front.
-      // whatever it starts with, whether that's 'absolute' like /foo/bar,
-      // or 'relative' like '../baz'
-      prefix = pattern.slice(0, n).join('/')
-      break
-  }
-
-  var remain = pattern.slice(n)
-
-  // get the list of entries.
-  var read
-  if (prefix === null)
-    read = '.'
-  else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
-    if (!prefix || !isAbsolute(prefix))
-      prefix = '/' + prefix
-    read = prefix
-  } else
-    read = prefix
-
-  var abs = this._makeAbs(read)
-
-  //if ignored, skip processing
-  if (childrenIgnored(this, read))
-    return
-
-  var isGlobStar = remain[0] === minimatch.GLOBSTAR
-  if (isGlobStar)
-    this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
-  else
-    this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
-}
-
-
-GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
-  var entries = this._readdir(abs, inGlobStar)
-
-  // if the abs isn't a dir, then nothing can match!
-  if (!entries)
-    return
-
-  // It will only match dot entries if it starts with a dot, or if
-  // dot is set.  Stuff like @(.foo|.bar) isn't allowed.
-  var pn = remain[0]
-  var negate = !!this.minimatch.negate
-  var rawGlob = pn._glob
-  var dotOk = this.dot || rawGlob.charAt(0) === '.'
-
-  var matchedEntries = []
-  for (var i = 0; i < entries.length; i++) {
-    var e = entries[i]
-    if (e.charAt(0) !== '.' || dotOk) {
-      var m
-      if (negate && !prefix) {
-        m = !e.match(pn)
-      } else {
-        m = e.match(pn)
-      }
-      if (m)
-        matchedEntries.push(e)
-    }
-  }
-
-  var len = matchedEntries.length
-  // If there are no matched entries, then nothing matches.
-  if (len === 0)
-    return
-
-  // if this is the last remaining pattern bit, then no need for
-  // an additional stat *unless* the user has specified mark or
-  // stat explicitly.  We know they exist, since readdir returned
-  // them.
-
-  if (remain.length === 1 && !this.mark && !this.stat) {
-    if (!this.matches[index])
-      this.matches[index] = Object.create(null)
-
-    for (var i = 0; i < len; i ++) {
-      var e = matchedEntries[i]
-      if (prefix) {
-        if (prefix.slice(-1) !== '/')
-          e = prefix + '/' + e
-        else
-          e = prefix + e
-      }
-
-      if (e.charAt(0) === '/' && !this.nomount) {
-        e = path.join(this.root, e)
-      }
-      this._emitMatch(index, e)
-    }
-    // This was the last one, and no stats were needed
-    return
-  }
-
-  // now test all matched entries as stand-ins for that part
-  // of the pattern.
-  remain.shift()
-  for (var i = 0; i < len; i ++) {
-    var e = matchedEntries[i]
-    var newPattern
-    if (prefix)
-      newPattern = [prefix, e]
-    else
-      newPattern = [e]
-    this._process(newPattern.concat(remain), index, inGlobStar)
-  }
-}
-
-
-GlobSync.prototype._emitMatch = function (index, e) {
-  if (isIgnored(this, e))
-    return
-
-  var abs = this._makeAbs(e)
-
-  if (this.mark)
-    e = this._mark(e)
-
-  if (this.absolute) {
-    e = abs
-  }
-
-  if (this.matches[index][e])
-    return
-
-  if (this.nodir) {
-    var c = this.cache[abs]
-    if (c === 'DIR' || Array.isArray(c))
-      return
-  }
-
-  this.matches[index][e] = true
-
-  if (this.stat)
-    this._stat(e)
-}
-
-
-GlobSync.prototype._readdirInGlobStar = function (abs) {
-  // follow all symlinked directories forever
-  // just proceed as if this is a non-globstar situation
-  if (this.follow)
-    return this._readdir(abs, false)
-
-  var entries
-  var lstat
-  var stat
-  try {
-    lstat = fs.lstatSync(abs)
-  } catch (er) {
-    if (er.code === 'ENOENT') {
-      // lstat failed, doesn't exist
-      return null
-    }
-  }
-
-  var isSym = lstat && lstat.isSymbolicLink()
-  this.symlinks[abs] = isSym
-
-  // If it's not a symlink or a dir, then it's definitely a regular file.
-  // don't bother doing a readdir in that case.
-  if (!isSym && lstat && !lstat.isDirectory())
-    this.cache[abs] = 'FILE'
-  else
-    entries = this._readdir(abs, false)
-
-  return entries
-}
-
-GlobSync.prototype._readdir = function (abs, inGlobStar) {
-  var entries
-
-  if (inGlobStar && !ownProp(this.symlinks, abs))
-    return this._readdirInGlobStar(abs)
-
-  if (ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-    if (!c || c === 'FILE')
-      return null
-
-    if (Array.isArray(c))
-      return c
-  }
-
-  try {
-    return this._readdirEntries(abs, fs.readdirSync(abs))
-  } catch (er) {
-    this._readdirError(abs, er)
-    return null
-  }
-}
-
-GlobSync.prototype._readdirEntries = function (abs, entries) {
-  // if we haven't asked to stat everything, then just
-  // assume that everything in there exists, so we can avoid
-  // having to stat it a second time.
-  if (!this.mark && !this.stat) {
-    for (var i = 0; i < entries.length; i ++) {
-      var e = entries[i]
-      if (abs === '/')
-        e = abs + e
-      else
-        e = abs + '/' + e
-      this.cache[e] = true
-    }
-  }
-
-  this.cache[abs] = entries
-
-  // mark and cache dir-ness
-  return entries
-}
-
-GlobSync.prototype._readdirError = function (f, er) {
-  // handle errors, and cache the information
-  switch (er.code) {
-    case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
-    case 'ENOTDIR': // totally normal. means it *does* exist.
-      var abs = this._makeAbs(f)
-      this.cache[abs] = 'FILE'
-      if (abs === this.cwdAbs) {
-        var error = new Error(er.code + ' invalid cwd ' + this.cwd)
-        error.path = this.cwd
-        error.code = er.code
-        throw error
-      }
-      break
-
-    case 'ENOENT': // not terribly unusual
-    case 'ELOOP':
-    case 'ENAMETOOLONG':
-    case 'UNKNOWN':
-      this.cache[this._makeAbs(f)] = false
-      break
-
-    default: // some unusual error.  Treat as failure.
-      this.cache[this._makeAbs(f)] = false
-      if (this.strict)
-        throw er
-      if (!this.silent)
-        console.error('glob error', er)
-      break
-  }
-}
-
-GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
-
-  var entries = this._readdir(abs, inGlobStar)
-
-  // no entries means not a dir, so it can never have matches
-  // foo.txt/** doesn't match foo.txt
-  if (!entries)
-    return
-
-  // test without the globstar, and with every child both below
-  // and replacing the globstar.
-  var remainWithoutGlobStar = remain.slice(1)
-  var gspref = prefix ? [ prefix ] : []
-  var noGlobStar = gspref.concat(remainWithoutGlobStar)
-
-  // the noGlobStar pattern exits the inGlobStar state
-  this._process(noGlobStar, index, false)
-
-  var len = entries.length
-  var isSym = this.symlinks[abs]
-
-  // If it's a symlink, and we're in a globstar, then stop
-  if (isSym && inGlobStar)
-    return
-
-  for (var i = 0; i < len; i++) {
-    var e = entries[i]
-    if (e.charAt(0) === '.' && !this.dot)
-      continue
-
-    // these two cases enter the inGlobStar state
-    var instead = gspref.concat(entries[i], remainWithoutGlobStar)
-    this._process(instead, index, true)
-
-    var below = gspref.concat(entries[i], remain)
-    this._process(below, index, true)
-  }
-}
-
-GlobSync.prototype._processSimple = function (prefix, index) {
-  // XXX review this.  Shouldn't it be doing the mounting etc
-  // before doing stat?  kinda weird?
-  var exists = this._stat(prefix)
-
-  if (!this.matches[index])
-    this.matches[index] = Object.create(null)
-
-  // If it doesn't exist, then just mark the lack of results
-  if (!exists)
-    return
-
-  if (prefix && isAbsolute(prefix) && !this.nomount) {
-    var trail = /[\/\\]$/.test(prefix)
-    if (prefix.charAt(0) === '/') {
-      prefix = path.join(this.root, prefix)
-    } else {
-      prefix = path.resolve(this.root, prefix)
-      if (trail)
-        prefix += '/'
-    }
-  }
-
-  if (process.platform === 'win32')
-    prefix = prefix.replace(/\\/g, '/')
-
-  // Mark this as a match
-  this._emitMatch(index, prefix)
-}
-
-// Returns either 'DIR', 'FILE', or false
-GlobSync.prototype._stat = function (f) {
-  var abs = this._makeAbs(f)
-  var needDir = f.slice(-1) === '/'
-
-  if (f.length > this.maxLength)
-    return false
-
-  if (!this.stat && ownProp(this.cache, abs)) {
-    var c = this.cache[abs]
-
-    if (Array.isArray(c))
-      c = 'DIR'
-
-    // It exists, but maybe not how we need it
-    if (!needDir || c === 'DIR')
-      return c
-
-    if (needDir && c === 'FILE')
-      return false
-
-    // otherwise we have to stat, because maybe c=true
-    // if we know it exists, but not what it is.
-  }
-
-  var exists
-  var stat = this.statCache[abs]
-  if (!stat) {
-    var lstat
-    try {
-      lstat = fs.lstatSync(abs)
-    } catch (er) {
-      if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
-        this.statCache[abs] = false
-        return false
-      }
-    }
-
-    if (lstat && lstat.isSymbolicLink()) {
-      try {
-        stat = fs.statSync(abs)
-      } catch (er) {
-        stat = lstat
-      }
-    } else {
-      stat = lstat
-    }
-  }
-
-  this.statCache[abs] = stat
-
-  var c = true
-  if (stat)
-    c = stat.isDirectory() ? 'DIR' : 'FILE'
-
-  this.cache[abs] = this.cache[abs] || c
-
-  if (needDir && c === 'FILE')
-    return false
-
-  return c
-}
-
-GlobSync.prototype._mark = function (p) {
-  return common.mark(this, p)
-}
-
-GlobSync.prototype._makeAbs = function (f) {
-  return common.makeAbs(this, f)
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/package.json b/legacy-libs/grpc/node_modules/rimraf/package.json
deleted file mode 100644 (file)
index 1896924..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "_from": "rimraf@^2.6.1",
-  "_id": "rimraf@2.6.3",
-  "_inBundle": false,
-  "_integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
-  "_location": "/grpc/rimraf",
-  "_phantomChildren": {
-    "fs.realpath": "1.0.0",
-    "inflight": "1.0.6",
-    "inherits": "2.0.3",
-    "minimatch": "3.0.4",
-    "once": "1.4.0",
-    "path-is-absolute": "1.0.1"
-  },
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "rimraf@^2.6.1",
-    "name": "rimraf",
-    "escapedName": "rimraf",
-    "rawSpec": "^2.6.1",
-    "saveSpec": null,
-    "fetchSpec": "^2.6.1"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
-  "_shasum": "b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab",
-  "_shrinkwrap": null,
-  "_spec": "rimraf@^2.6.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bin": {
-    "rimraf": "./bin.js"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/rimraf/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "glob": "^7.1.3"
-  },
-  "deprecated": false,
-  "description": "A deep deletion module for node (like `rm -rf`)",
-  "devDependencies": {
-    "mkdirp": "^0.5.1",
-    "tap": "^12.1.1"
-  },
-  "files": [
-    "LICENSE",
-    "README.md",
-    "bin.js",
-    "rimraf.js"
-  ],
-  "homepage": "https://github.com/isaacs/rimraf#readme",
-  "license": "ISC",
-  "main": "rimraf.js",
-  "name": "rimraf",
-  "optionalDependencies": {},
-  "readme": "[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies)\n\nThe [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.\n\nInstall with `npm install rimraf`, or just drop rimraf.js somewhere.\n\n## API\n\n`rimraf(f, [opts], callback)`\n\nThe first parameter will be interpreted as a globbing pattern for files. If you\nwant to disable globbing you can do so with `opts.disableGlob` (defaults to\n`false`). This might be handy, for instance, if you have filenames that contain\nglobbing wildcard characters.\n\nThe callback will be called with an error if there is one.  Certain\nerrors are handled for you:\n\n* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of\n  `opts.maxBusyTries` times before giving up, adding 100ms of wait\n  between each attempt.  The default `maxBusyTries` is 3.\n* `ENOENT` - If the file doesn't exist, rimraf will return\n  successfully, since your desired outcome is already the case.\n* `EMFILE` - Since `readdir` requires opening a file descriptor, it's\n  possible to hit `EMFILE` if too many file descriptors are in use.\n  In the sync case, there's nothing to be done for this.  But in the\n  async case, rimraf will gradually back off with timeouts up to\n  `opts.emfileWait` ms, which defaults to 1000.\n\n## options\n\n* unlink, chmod, stat, lstat, rmdir, readdir,\n  unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync\n\n    In order to use a custom file system library, you can override\n    specific fs functions on the options object.\n\n    If any of these functions are present on the options object, then\n    the supplied function will be used instead of the default fs\n    method.\n\n    Sync methods are only relevant for `rimraf.sync()`, of course.\n\n    For example:\n\n    ```javascript\n    var myCustomFS = require('some-custom-fs')\n\n    rimraf('some-thing', myCustomFS, callback)\n    ```\n\n* maxBusyTries\n\n    If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered\n    on Windows systems, then rimraf will retry with a linear backoff\n    wait of 100ms longer on each try.  The default maxBusyTries is 3.\n\n    Only relevant for async usage.\n\n* emfileWait\n\n    If an `EMFILE` error is encountered, then rimraf will retry\n    repeatedly with a linear backoff of 1ms longer on each try, until\n    the timeout counter hits this max.  The default limit is 1000.\n\n    If you repeatedly encounter `EMFILE` errors, then consider using\n    [graceful-fs](http://npm.im/graceful-fs) in your program.\n\n    Only relevant for async usage.\n\n* glob\n\n    Set to `false` to disable [glob](http://npm.im/glob) pattern\n    matching.\n\n    Set to an object to pass options to the glob module.  The default\n    glob options are `{ nosort: true, silent: true }`.\n\n    Glob version 6 is used in this module.\n\n    Relevant for both sync and async usage.\n\n* disableGlob\n\n    Set to any non-falsey value to disable globbing entirely.\n    (Equivalent to setting `glob: false`.)\n\n## rimraf.sync\n\nIt can remove stuff synchronously, too.  But that's not so good.  Use\nthe async API.  It's better.\n\n## CLI\n\nIf installed with `npm install rimraf -g` it can be used as a global\ncommand `rimraf <path> [<path> ...]` which is useful for cross platform support.\n\n## mkdirp\n\nIf you need to create a directory recursively, check out\n[mkdirp](https://github.com/substack/node-mkdirp).\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/rimraf.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js"
-  },
-  "version": "2.6.3"
-}
diff --git a/legacy-libs/grpc/node_modules/rimraf/rimraf.js b/legacy-libs/grpc/node_modules/rimraf/rimraf.js
deleted file mode 100644 (file)
index e80dd10..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-module.exports = rimraf
-rimraf.sync = rimrafSync
-
-var assert = require("assert")
-var path = require("path")
-var fs = require("fs")
-var glob = require("glob")
-var _0666 = parseInt('666', 8)
-
-var defaultGlobOpts = {
-  nosort: true,
-  silent: true
-}
-
-// for EMFILE handling
-var timeout = 0
-
-var isWindows = (process.platform === "win32")
-
-function defaults (options) {
-  var methods = [
-    'unlink',
-    'chmod',
-    'stat',
-    'lstat',
-    'rmdir',
-    'readdir'
-  ]
-  methods.forEach(function(m) {
-    options[m] = options[m] || fs[m]
-    m = m + 'Sync'
-    options[m] = options[m] || fs[m]
-  })
-
-  options.maxBusyTries = options.maxBusyTries || 3
-  options.emfileWait = options.emfileWait || 1000
-  if (options.glob === false) {
-    options.disableGlob = true
-  }
-  options.disableGlob = options.disableGlob || false
-  options.glob = options.glob || defaultGlobOpts
-}
-
-function rimraf (p, options, cb) {
-  if (typeof options === 'function') {
-    cb = options
-    options = {}
-  }
-
-  assert(p, 'rimraf: missing path')
-  assert.equal(typeof p, 'string', 'rimraf: path should be a string')
-  assert.equal(typeof cb, 'function', 'rimraf: callback function required')
-  assert(options, 'rimraf: invalid options argument provided')
-  assert.equal(typeof options, 'object', 'rimraf: options should be object')
-
-  defaults(options)
-
-  var busyTries = 0
-  var errState = null
-  var n = 0
-
-  if (options.disableGlob || !glob.hasMagic(p))
-    return afterGlob(null, [p])
-
-  options.lstat(p, function (er, stat) {
-    if (!er)
-      return afterGlob(null, [p])
-
-    glob(p, options.glob, afterGlob)
-  })
-
-  function next (er) {
-    errState = errState || er
-    if (--n === 0)
-      cb(errState)
-  }
-
-  function afterGlob (er, results) {
-    if (er)
-      return cb(er)
-
-    n = results.length
-    if (n === 0)
-      return cb()
-
-    results.forEach(function (p) {
-      rimraf_(p, options, function CB (er) {
-        if (er) {
-          if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
-              busyTries < options.maxBusyTries) {
-            busyTries ++
-            var time = busyTries * 100
-            // try again, with the same exact callback as this one.
-            return setTimeout(function () {
-              rimraf_(p, options, CB)
-            }, time)
-          }
-
-          // this one won't happen if graceful-fs is used.
-          if (er.code === "EMFILE" && timeout < options.emfileWait) {
-            return setTimeout(function () {
-              rimraf_(p, options, CB)
-            }, timeout ++)
-          }
-
-          // already gone
-          if (er.code === "ENOENT") er = null
-        }
-
-        timeout = 0
-        next(er)
-      })
-    })
-  }
-}
-
-// Two possible strategies.
-// 1. Assume it's a file.  unlink it, then do the dir stuff on EPERM or EISDIR
-// 2. Assume it's a directory.  readdir, then do the file stuff on ENOTDIR
-//
-// Both result in an extra syscall when you guess wrong.  However, there
-// are likely far more normal files in the world than directories.  This
-// is based on the assumption that a the average number of files per
-// directory is >= 1.
-//
-// If anyone ever complains about this, then I guess the strategy could
-// be made configurable somehow.  But until then, YAGNI.
-function rimraf_ (p, options, cb) {
-  assert(p)
-  assert(options)
-  assert(typeof cb === 'function')
-
-  // sunos lets the root user unlink directories, which is... weird.
-  // so we have to lstat here and make sure it's not a dir.
-  options.lstat(p, function (er, st) {
-    if (er && er.code === "ENOENT")
-      return cb(null)
-
-    // Windows can EPERM on stat.  Life is suffering.
-    if (er && er.code === "EPERM" && isWindows)
-      fixWinEPERM(p, options, er, cb)
-
-    if (st && st.isDirectory())
-      return rmdir(p, options, er, cb)
-
-    options.unlink(p, function (er) {
-      if (er) {
-        if (er.code === "ENOENT")
-          return cb(null)
-        if (er.code === "EPERM")
-          return (isWindows)
-            ? fixWinEPERM(p, options, er, cb)
-            : rmdir(p, options, er, cb)
-        if (er.code === "EISDIR")
-          return rmdir(p, options, er, cb)
-      }
-      return cb(er)
-    })
-  })
-}
-
-function fixWinEPERM (p, options, er, cb) {
-  assert(p)
-  assert(options)
-  assert(typeof cb === 'function')
-  if (er)
-    assert(er instanceof Error)
-
-  options.chmod(p, _0666, function (er2) {
-    if (er2)
-      cb(er2.code === "ENOENT" ? null : er)
-    else
-      options.stat(p, function(er3, stats) {
-        if (er3)
-          cb(er3.code === "ENOENT" ? null : er)
-        else if (stats.isDirectory())
-          rmdir(p, options, er, cb)
-        else
-          options.unlink(p, cb)
-      })
-  })
-}
-
-function fixWinEPERMSync (p, options, er) {
-  assert(p)
-  assert(options)
-  if (er)
-    assert(er instanceof Error)
-
-  try {
-    options.chmodSync(p, _0666)
-  } catch (er2) {
-    if (er2.code === "ENOENT")
-      return
-    else
-      throw er
-  }
-
-  try {
-    var stats = options.statSync(p)
-  } catch (er3) {
-    if (er3.code === "ENOENT")
-      return
-    else
-      throw er
-  }
-
-  if (stats.isDirectory())
-    rmdirSync(p, options, er)
-  else
-    options.unlinkSync(p)
-}
-
-function rmdir (p, options, originalEr, cb) {
-  assert(p)
-  assert(options)
-  if (originalEr)
-    assert(originalEr instanceof Error)
-  assert(typeof cb === 'function')
-
-  // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
-  // if we guessed wrong, and it's not a directory, then
-  // raise the original error.
-  options.rmdir(p, function (er) {
-    if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
-      rmkids(p, options, cb)
-    else if (er && er.code === "ENOTDIR")
-      cb(originalEr)
-    else
-      cb(er)
-  })
-}
-
-function rmkids(p, options, cb) {
-  assert(p)
-  assert(options)
-  assert(typeof cb === 'function')
-
-  options.readdir(p, function (er, files) {
-    if (er)
-      return cb(er)
-    var n = files.length
-    if (n === 0)
-      return options.rmdir(p, cb)
-    var errState
-    files.forEach(function (f) {
-      rimraf(path.join(p, f), options, function (er) {
-        if (errState)
-          return
-        if (er)
-          return cb(errState = er)
-        if (--n === 0)
-          options.rmdir(p, cb)
-      })
-    })
-  })
-}
-
-// this looks simpler, and is strictly *faster*, but will
-// tie up the JavaScript thread and fail on excessively
-// deep directory trees.
-function rimrafSync (p, options) {
-  options = options || {}
-  defaults(options)
-
-  assert(p, 'rimraf: missing path')
-  assert.equal(typeof p, 'string', 'rimraf: path should be a string')
-  assert(options, 'rimraf: missing options')
-  assert.equal(typeof options, 'object', 'rimraf: options should be object')
-
-  var results
-
-  if (options.disableGlob || !glob.hasMagic(p)) {
-    results = [p]
-  } else {
-    try {
-      options.lstatSync(p)
-      results = [p]
-    } catch (er) {
-      results = glob.sync(p, options.glob)
-    }
-  }
-
-  if (!results.length)
-    return
-
-  for (var i = 0; i < results.length; i++) {
-    var p = results[i]
-
-    try {
-      var st = options.lstatSync(p)
-    } catch (er) {
-      if (er.code === "ENOENT")
-        return
-
-      // Windows can EPERM on stat.  Life is suffering.
-      if (er.code === "EPERM" && isWindows)
-        fixWinEPERMSync(p, options, er)
-    }
-
-    try {
-      // sunos lets the root user unlink directories, which is... weird.
-      if (st && st.isDirectory())
-        rmdirSync(p, options, null)
-      else
-        options.unlinkSync(p)
-    } catch (er) {
-      if (er.code === "ENOENT")
-        return
-      if (er.code === "EPERM")
-        return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
-      if (er.code !== "EISDIR")
-        throw er
-
-      rmdirSync(p, options, er)
-    }
-  }
-}
-
-function rmdirSync (p, options, originalEr) {
-  assert(p)
-  assert(options)
-  if (originalEr)
-    assert(originalEr instanceof Error)
-
-  try {
-    options.rmdirSync(p)
-  } catch (er) {
-    if (er.code === "ENOENT")
-      return
-    if (er.code === "ENOTDIR")
-      throw originalEr
-    if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
-      rmkidsSync(p, options)
-  }
-}
-
-function rmkidsSync (p, options) {
-  assert(p)
-  assert(options)
-  options.readdirSync(p).forEach(function (f) {
-    rimrafSync(path.join(p, f), options)
-  })
-
-  // We only end up here once we got ENOTEMPTY at least once, and
-  // at this point, we are guaranteed to have removed all the kids.
-  // So, we know that it won't be ENOENT or ENOTDIR or anything else.
-  // try really hard to delete stuff on windows, because it has a
-  // PROFOUNDLY annoying habit of not closing handles promptly when
-  // files are deleted, resulting in spurious ENOTEMPTY errors.
-  var retries = isWindows ? 100 : 1
-  var i = 0
-  do {
-    var threw = true
-    try {
-      var ret = options.rmdirSync(p, options)
-      threw = false
-      return ret
-    } finally {
-      if (++i < retries && threw)
-        continue
-    }
-  } while (true)
-}
diff --git a/legacy-libs/grpc/node_modules/safe-buffer/LICENSE b/legacy-libs/grpc/node_modules/safe-buffer/LICENSE
deleted file mode 100644 (file)
index 0c068ce..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Feross Aboukhadijeh
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/safe-buffer/README.md b/legacy-libs/grpc/node_modules/safe-buffer/README.md
deleted file mode 100644 (file)
index e9a81af..0000000
+++ /dev/null
@@ -1,584 +0,0 @@
-# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
-
-[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg
-[travis-url]: https://travis-ci.org/feross/safe-buffer
-[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg
-[npm-url]: https://npmjs.org/package/safe-buffer
-[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg
-[downloads-url]: https://npmjs.org/package/safe-buffer
-[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
-[standard-url]: https://standardjs.com
-
-#### Safer Node.js Buffer API
-
-**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,
-`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**
-
-**Uses the built-in implementation when available.**
-
-## install
-
-```
-npm install safe-buffer
-```
-
-## usage
-
-The goal of this package is to provide a safe replacement for the node.js `Buffer`.
-
-It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to
-the top of your node.js modules:
-
-```js
-var Buffer = require('safe-buffer').Buffer
-
-// Existing buffer code will continue to work without issues:
-
-new Buffer('hey', 'utf8')
-new Buffer([1, 2, 3], 'utf8')
-new Buffer(obj)
-new Buffer(16) // create an uninitialized buffer (potentially unsafe)
-
-// But you can use these new explicit APIs to make clear what you want:
-
-Buffer.from('hey', 'utf8') // convert from many types to a Buffer
-Buffer.alloc(16) // create a zero-filled buffer (safe)
-Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)
-```
-
-## api
-
-### Class Method: Buffer.from(array)
-<!-- YAML
-added: v3.0.0
--->
-
-* `array` {Array}
-
-Allocates a new `Buffer` using an `array` of octets.
-
-```js
-const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);
-  // creates a new Buffer containing ASCII bytes
-  // ['b','u','f','f','e','r']
-```
-
-A `TypeError` will be thrown if `array` is not an `Array`.
-
-### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])
-<!-- YAML
-added: v5.10.0
--->
-
-* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or
-  a `new ArrayBuffer()`
-* `byteOffset` {Number} Default: `0`
-* `length` {Number} Default: `arrayBuffer.length - byteOffset`
-
-When passed a reference to the `.buffer` property of a `TypedArray` instance,
-the newly created `Buffer` will share the same allocated memory as the
-TypedArray.
-
-```js
-const arr = new Uint16Array(2);
-arr[0] = 5000;
-arr[1] = 4000;
-
-const buf = Buffer.from(arr.buffer); // shares the memory with arr;
-
-console.log(buf);
-  // Prints: <Buffer 88 13 a0 0f>
-
-// changing the TypedArray changes the Buffer also
-arr[1] = 6000;
-
-console.log(buf);
-  // Prints: <Buffer 88 13 70 17>
-```
-
-The optional `byteOffset` and `length` arguments specify a memory range within
-the `arrayBuffer` that will be shared by the `Buffer`.
-
-```js
-const ab = new ArrayBuffer(10);
-const buf = Buffer.from(ab, 0, 2);
-console.log(buf.length);
-  // Prints: 2
-```
-
-A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.
-
-### Class Method: Buffer.from(buffer)
-<!-- YAML
-added: v3.0.0
--->
-
-* `buffer` {Buffer}
-
-Copies the passed `buffer` data onto a new `Buffer` instance.
-
-```js
-const buf1 = Buffer.from('buffer');
-const buf2 = Buffer.from(buf1);
-
-buf1[0] = 0x61;
-console.log(buf1.toString());
-  // 'auffer'
-console.log(buf2.toString());
-  // 'buffer' (copy is not changed)
-```
-
-A `TypeError` will be thrown if `buffer` is not a `Buffer`.
-
-### Class Method: Buffer.from(str[, encoding])
-<!-- YAML
-added: v5.10.0
--->
-
-* `str` {String} String to encode.
-* `encoding` {String} Encoding to use, Default: `'utf8'`
-
-Creates a new `Buffer` containing the given JavaScript string `str`. If
-provided, the `encoding` parameter identifies the character encoding.
-If not provided, `encoding` defaults to `'utf8'`.
-
-```js
-const buf1 = Buffer.from('this is a tést');
-console.log(buf1.toString());
-  // prints: this is a tést
-console.log(buf1.toString('ascii'));
-  // prints: this is a tC)st
-
-const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
-console.log(buf2.toString());
-  // prints: this is a tést
-```
-
-A `TypeError` will be thrown if `str` is not a string.
-
-### Class Method: Buffer.alloc(size[, fill[, encoding]])
-<!-- YAML
-added: v5.10.0
--->
-
-* `size` {Number}
-* `fill` {Value} Default: `undefined`
-* `encoding` {String} Default: `utf8`
-
-Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
-`Buffer` will be *zero-filled*.
-
-```js
-const buf = Buffer.alloc(5);
-console.log(buf);
-  // <Buffer 00 00 00 00 00>
-```
-
-The `size` must be less than or equal to the value of
-`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
-`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
-be created if a `size` less than or equal to 0 is specified.
-
-If `fill` is specified, the allocated `Buffer` will be initialized by calling
-`buf.fill(fill)`. See [`buf.fill()`][] for more information.
-
-```js
-const buf = Buffer.alloc(5, 'a');
-console.log(buf);
-  // <Buffer 61 61 61 61 61>
-```
-
-If both `fill` and `encoding` are specified, the allocated `Buffer` will be
-initialized by calling `buf.fill(fill, encoding)`. For example:
-
-```js
-const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
-console.log(buf);
-  // <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
-```
-
-Calling `Buffer.alloc(size)` can be significantly slower than the alternative
-`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance
-contents will *never contain sensitive data*.
-
-A `TypeError` will be thrown if `size` is not a number.
-
-### Class Method: Buffer.allocUnsafe(size)
-<!-- YAML
-added: v5.10.0
--->
-
-* `size` {Number}
-
-Allocates a new *non-zero-filled* `Buffer` of `size` bytes.  The `size` must
-be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit
-architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
-thrown. A zero-length Buffer will be created if a `size` less than or equal to
-0 is specified.
-
-The underlying memory for `Buffer` instances created in this way is *not
-initialized*. The contents of the newly created `Buffer` are unknown and
-*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
-`Buffer` instances to zeroes.
-
-```js
-const buf = Buffer.allocUnsafe(5);
-console.log(buf);
-  // <Buffer 78 e0 82 02 01>
-  // (octets will be different, every time)
-buf.fill(0);
-console.log(buf);
-  // <Buffer 00 00 00 00 00>
-```
-
-A `TypeError` will be thrown if `size` is not a number.
-
-Note that the `Buffer` module pre-allocates an internal `Buffer` instance of
-size `Buffer.poolSize` that is used as a pool for the fast allocation of new
-`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated
-`new Buffer(size)` constructor) only when `size` is less than or equal to
-`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default
-value of `Buffer.poolSize` is `8192` but can be modified.
-
-Use of this pre-allocated internal memory pool is a key difference between
-calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
-Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer
-pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal
-Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The
-difference is subtle but can be important when an application requires the
-additional performance that `Buffer.allocUnsafe(size)` provides.
-
-### Class Method: Buffer.allocUnsafeSlow(size)
-<!-- YAML
-added: v5.10.0
--->
-
-* `size` {Number}
-
-Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes.  The
-`size` must be less than or equal to the value of
-`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
-`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
-be created if a `size` less than or equal to 0 is specified.
-
-The underlying memory for `Buffer` instances created in this way is *not
-initialized*. The contents of the newly created `Buffer` are unknown and
-*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
-`Buffer` instances to zeroes.
-
-When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
-allocations under 4KB are, by default, sliced from a single pre-allocated
-`Buffer`. This allows applications to avoid the garbage collection overhead of
-creating many individually allocated Buffers. This approach improves both
-performance and memory usage by eliminating the need to track and cleanup as
-many `Persistent` objects.
-
-However, in the case where a developer may need to retain a small chunk of
-memory from a pool for an indeterminate amount of time, it may be appropriate
-to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then
-copy out the relevant bits.
-
-```js
-// need to keep around a few small chunks of memory
-const store = [];
-
-socket.on('readable', () => {
-  const data = socket.read();
-  // allocate for retained data
-  const sb = Buffer.allocUnsafeSlow(10);
-  // copy the data into the new allocation
-  data.copy(sb, 0, 0, 10);
-  store.push(sb);
-});
-```
-
-Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*
-a developer has observed undue memory retention in their applications.
-
-A `TypeError` will be thrown if `size` is not a number.
-
-### All the Rest
-
-The rest of the `Buffer` API is exactly the same as in node.js.
-[See the docs](https://nodejs.org/api/buffer.html).
-
-
-## Related links
-
-- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)
-- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)
-
-## Why is `Buffer` unsafe?
-
-Today, the node.js `Buffer` constructor is overloaded to handle many different argument
-types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),
-`ArrayBuffer`, and also `Number`.
-
-The API is optimized for convenience: you can throw any type at it, and it will try to do
-what you want.
-
-Because the Buffer constructor is so powerful, you often see code like this:
-
-```js
-// Convert UTF-8 strings to hex
-function toHex (str) {
-  return new Buffer(str).toString('hex')
-}
-```
-
-***But what happens if `toHex` is called with a `Number` argument?***
-
-### Remote Memory Disclosure
-
-If an attacker can make your program call the `Buffer` constructor with a `Number`
-argument, then they can make it allocate uninitialized memory from the node.js process.
-This could potentially disclose TLS private keys, user data, or database passwords.
-
-When the `Buffer` constructor is passed a `Number` argument, it returns an
-**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like
-this, you **MUST** overwrite the contents before returning it to the user.
-
-From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):
-
-> `new Buffer(size)`
->
-> - `size` Number
->
-> The underlying memory for `Buffer` instances created in this way is not initialized.
-> **The contents of a newly created `Buffer` are unknown and could contain sensitive
-> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.
-
-(Emphasis our own.)
-
-Whenever the programmer intended to create an uninitialized `Buffer` you often see code
-like this:
-
-```js
-var buf = new Buffer(16)
-
-// Immediately overwrite the uninitialized buffer with data from another buffer
-for (var i = 0; i < buf.length; i++) {
-  buf[i] = otherBuf[i]
-}
-```
-
-
-### Would this ever be a problem in real code?
-
-Yes. It's surprisingly common to forget to check the type of your variables in a
-dynamically-typed language like JavaScript.
-
-Usually the consequences of assuming the wrong type is that your program crashes with an
-uncaught exception. But the failure mode for forgetting to check the type of arguments to
-the `Buffer` constructor is more catastrophic.
-
-Here's an example of a vulnerable service that takes a JSON payload and converts it to
-hex:
-
-```js
-// Take a JSON payload {str: "some string"} and convert it to hex
-var server = http.createServer(function (req, res) {
-  var data = ''
-  req.setEncoding('utf8')
-  req.on('data', function (chunk) {
-    data += chunk
-  })
-  req.on('end', function () {
-    var body = JSON.parse(data)
-    res.end(new Buffer(body.str).toString('hex'))
-  })
-})
-
-server.listen(8080)
-```
-
-In this example, an http client just has to send:
-
-```json
-{
-  "str": 1000
-}
-```
-
-and it will get back 1,000 bytes of uninitialized memory from the server.
-
-This is a very serious bug. It's similar in severity to the
-[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process
-memory by remote attackers.
-
-
-### Which real-world packages were vulnerable?
-
-#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)
-
-[Mathias Buus](https://github.com/mafintosh) and I
-([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,
-[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow
-anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get
-them to reveal 20 bytes at a time of uninitialized memory from the node.js process.
-
-Here's
-[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)
-that fixed it. We released a new fixed version, created a
-[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all
-vulnerable versions on npm so users will get a warning to upgrade to a newer version.
-
-#### [`ws`](https://www.npmjs.com/package/ws)
-
-That got us wondering if there were other vulnerable packages. Sure enough, within a short
-period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the
-most popular WebSocket implementation in node.js.
-
-If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as
-expected, then uninitialized server memory would be disclosed to the remote peer.
-
-These were the vulnerable methods:
-
-```js
-socket.send(number)
-socket.ping(number)
-socket.pong(number)
-```
-
-Here's a vulnerable socket server with some echo functionality:
-
-```js
-server.on('connection', function (socket) {
-  socket.on('message', function (message) {
-    message = JSON.parse(message)
-    if (message.type === 'echo') {
-      socket.send(message.data) // send back the user's message
-    }
-  })
-})
-```
-
-`socket.send(number)` called on the server, will disclose server memory.
-
-Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue
-was fixed, with a more detailed explanation. Props to
-[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the
-[Node Security Project disclosure](https://nodesecurity.io/advisories/67).
-
-
-### What's the solution?
-
-It's important that node.js offers a fast way to get memory otherwise performance-critical
-applications would needlessly get a lot slower.
-
-But we need a better way to *signal our intent* as programmers. **When we want
-uninitialized memory, we should request it explicitly.**
-
-Sensitive functionality should not be packed into a developer-friendly API that loosely
-accepts many different types. This type of API encourages the lazy practice of passing
-variables in without checking the type very carefully.
-
-#### A new API: `Buffer.allocUnsafe(number)`
-
-The functionality of creating buffers with uninitialized memory should be part of another
-API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that
-frequently gets user input of all sorts of different types passed into it.
-
-```js
-var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!
-
-// Immediately overwrite the uninitialized buffer with data from another buffer
-for (var i = 0; i < buf.length; i++) {
-  buf[i] = otherBuf[i]
-}
-```
-
-
-### How do we fix node.js core?
-
-We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as
-`semver-major`) which defends against one case:
-
-```js
-var str = 16
-new Buffer(str, 'utf8')
-```
-
-In this situation, it's implied that the programmer intended the first argument to be a
-string, since they passed an encoding as a second argument. Today, node.js will allocate
-uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not
-what the programmer intended.
-
-But this is only a partial solution, since if the programmer does `new Buffer(variable)`
-(without an `encoding` parameter) there's no way to know what they intended. If `variable`
-is sometimes a number, then uninitialized memory will sometimes be returned.
-
-### What's the real long-term fix?
-
-We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when
-we need uninitialized memory. But that would break 1000s of packages.
-
-~~We believe the best solution is to:~~
-
-~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~
-
-~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~
-
-#### Update
-
-We now support adding three new APIs:
-
-- `Buffer.from(value)` - convert from any type to a buffer
-- `Buffer.alloc(size)` - create a zero-filled buffer
-- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size
-
-This solves the core problem that affected `ws` and `bittorrent-dht` which is
-`Buffer(variable)` getting tricked into taking a number argument.
-
-This way, existing code continues working and the impact on the npm ecosystem will be
-minimal. Over time, npm maintainers can migrate performance-critical code to use
-`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.
-
-
-### Conclusion
-
-We think there's a serious design issue with the `Buffer` API as it exists today. It
-promotes insecure software by putting high-risk functionality into a convenient API
-with friendly "developer ergonomics".
-
-This wasn't merely a theoretical exercise because we found the issue in some of the
-most popular npm packages.
-
-Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of
-`buffer`.
-
-```js
-var Buffer = require('safe-buffer').Buffer
-```
-
-Eventually, we hope that node.js core can switch to this new, safer behavior. We believe
-the impact on the ecosystem would be minimal since it's not a breaking change.
-Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while
-older, insecure packages would magically become safe from this attack vector.
-
-
-## links
-
-- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)
-- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)
-- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)
-
-
-## credit
-
-The original issues in `bittorrent-dht`
-([disclosure](https://nodesecurity.io/advisories/68)) and
-`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by
-[Mathias Buus](https://github.com/mafintosh) and
-[Feross Aboukhadijeh](http://feross.org/).
-
-Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues
-and for his work running the [Node Security Project](https://nodesecurity.io/).
-
-Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and
-auditing the code.
-
-
-## license
-
-MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)
diff --git a/legacy-libs/grpc/node_modules/safe-buffer/index.d.ts b/legacy-libs/grpc/node_modules/safe-buffer/index.d.ts
deleted file mode 100644 (file)
index e9fed80..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-declare module "safe-buffer" {
-  export class Buffer {
-    length: number
-    write(string: string, offset?: number, length?: number, encoding?: string): number;
-    toString(encoding?: string, start?: number, end?: number): string;
-    toJSON(): { type: 'Buffer', data: any[] };
-    equals(otherBuffer: Buffer): boolean;
-    compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
-    copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
-    slice(start?: number, end?: number): Buffer;
-    writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
-    writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
-    writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
-    writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
-    readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
-    readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
-    readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
-    readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
-    readUInt8(offset: number, noAssert?: boolean): number;
-    readUInt16LE(offset: number, noAssert?: boolean): number;
-    readUInt16BE(offset: number, noAssert?: boolean): number;
-    readUInt32LE(offset: number, noAssert?: boolean): number;
-    readUInt32BE(offset: number, noAssert?: boolean): number;
-    readInt8(offset: number, noAssert?: boolean): number;
-    readInt16LE(offset: number, noAssert?: boolean): number;
-    readInt16BE(offset: number, noAssert?: boolean): number;
-    readInt32LE(offset: number, noAssert?: boolean): number;
-    readInt32BE(offset: number, noAssert?: boolean): number;
-    readFloatLE(offset: number, noAssert?: boolean): number;
-    readFloatBE(offset: number, noAssert?: boolean): number;
-    readDoubleLE(offset: number, noAssert?: boolean): number;
-    readDoubleBE(offset: number, noAssert?: boolean): number;
-    swap16(): Buffer;
-    swap32(): Buffer;
-    swap64(): Buffer;
-    writeUInt8(value: number, offset: number, noAssert?: boolean): number;
-    writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
-    writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
-    writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
-    writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
-    writeInt8(value: number, offset: number, noAssert?: boolean): number;
-    writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
-    writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
-    writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
-    writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
-    writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
-    writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
-    writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
-    writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
-    fill(value: any, offset?: number, end?: number): this;
-    indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
-    lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
-    includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
-
-    /**
-     * Allocates a new buffer containing the given {str}.
-     *
-     * @param str String to store in buffer.
-     * @param encoding encoding to use, optional.  Default is 'utf8'
-     */
-     constructor (str: string, encoding?: string);
-    /**
-     * Allocates a new buffer of {size} octets.
-     *
-     * @param size count of octets to allocate.
-     */
-    constructor (size: number);
-    /**
-     * Allocates a new buffer containing the given {array} of octets.
-     *
-     * @param array The octets to store.
-     */
-    constructor (array: Uint8Array);
-    /**
-     * Produces a Buffer backed by the same allocated memory as
-     * the given {ArrayBuffer}.
-     *
-     *
-     * @param arrayBuffer The ArrayBuffer with which to share memory.
-     */
-    constructor (arrayBuffer: ArrayBuffer);
-    /**
-     * Allocates a new buffer containing the given {array} of octets.
-     *
-     * @param array The octets to store.
-     */
-    constructor (array: any[]);
-    /**
-     * Copies the passed {buffer} data onto a new {Buffer} instance.
-     *
-     * @param buffer The buffer to copy.
-     */
-    constructor (buffer: Buffer);
-    prototype: Buffer;
-    /**
-     * Allocates a new Buffer using an {array} of octets.
-     *
-     * @param array
-     */
-    static from(array: any[]): Buffer;
-    /**
-     * When passed a reference to the .buffer property of a TypedArray instance,
-     * the newly created Buffer will share the same allocated memory as the TypedArray.
-     * The optional {byteOffset} and {length} arguments specify a memory range
-     * within the {arrayBuffer} that will be shared by the Buffer.
-     *
-     * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
-     * @param byteOffset
-     * @param length
-     */
-    static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
-    /**
-     * Copies the passed {buffer} data onto a new Buffer instance.
-     *
-     * @param buffer
-     */
-    static from(buffer: Buffer): Buffer;
-    /**
-     * Creates a new Buffer containing the given JavaScript string {str}.
-     * If provided, the {encoding} parameter identifies the character encoding.
-     * If not provided, {encoding} defaults to 'utf8'.
-     *
-     * @param str
-     */
-    static from(str: string, encoding?: string): Buffer;
-    /**
-     * Returns true if {obj} is a Buffer
-     *
-     * @param obj object to test.
-     */
-    static isBuffer(obj: any): obj is Buffer;
-    /**
-     * Returns true if {encoding} is a valid encoding argument.
-     * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
-     *
-     * @param encoding string to test.
-     */
-    static isEncoding(encoding: string): boolean;
-    /**
-     * Gives the actual byte length of a string. encoding defaults to 'utf8'.
-     * This is not the same as String.prototype.length since that returns the number of characters in a string.
-     *
-     * @param string string to test.
-     * @param encoding encoding used to evaluate (defaults to 'utf8')
-     */
-    static byteLength(string: string, encoding?: string): number;
-    /**
-     * Returns a buffer which is the result of concatenating all the buffers in the list together.
-     *
-     * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
-     * If the list has exactly one item, then the first item of the list is returned.
-     * If the list has more than one item, then a new Buffer is created.
-     *
-     * @param list An array of Buffer objects to concatenate
-     * @param totalLength Total length of the buffers when concatenated.
-     *   If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
-     */
-    static concat(list: Buffer[], totalLength?: number): Buffer;
-    /**
-     * The same as buf1.compare(buf2).
-     */
-    static compare(buf1: Buffer, buf2: Buffer): number;
-    /**
-     * Allocates a new buffer of {size} octets.
-     *
-     * @param size count of octets to allocate.
-     * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
-     *    If parameter is omitted, buffer will be filled with zeros.
-     * @param encoding encoding used for call to buf.fill while initalizing
-     */
-    static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
-    /**
-     * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
-     * of the newly created Buffer are unknown and may contain sensitive data.
-     *
-     * @param size count of octets to allocate
-     */
-    static allocUnsafe(size: number): Buffer;
-    /**
-     * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
-     * of the newly created Buffer are unknown and may contain sensitive data.
-     *
-     * @param size count of octets to allocate
-     */
-    static allocUnsafeSlow(size: number): Buffer;
-  }
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/safe-buffer/index.js b/legacy-libs/grpc/node_modules/safe-buffer/index.js
deleted file mode 100644 (file)
index 22438da..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* eslint-disable node/no-deprecated-api */
-var buffer = require('buffer')
-var Buffer = buffer.Buffer
-
-// alternative to using Object.keys for old browsers
-function copyProps (src, dst) {
-  for (var key in src) {
-    dst[key] = src[key]
-  }
-}
-if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
-  module.exports = buffer
-} else {
-  // Copy properties from require('buffer')
-  copyProps(buffer, exports)
-  exports.Buffer = SafeBuffer
-}
-
-function SafeBuffer (arg, encodingOrOffset, length) {
-  return Buffer(arg, encodingOrOffset, length)
-}
-
-// Copy static methods from Buffer
-copyProps(Buffer, SafeBuffer)
-
-SafeBuffer.from = function (arg, encodingOrOffset, length) {
-  if (typeof arg === 'number') {
-    throw new TypeError('Argument must not be a number')
-  }
-  return Buffer(arg, encodingOrOffset, length)
-}
-
-SafeBuffer.alloc = function (size, fill, encoding) {
-  if (typeof size !== 'number') {
-    throw new TypeError('Argument must be a number')
-  }
-  var buf = Buffer(size)
-  if (fill !== undefined) {
-    if (typeof encoding === 'string') {
-      buf.fill(fill, encoding)
-    } else {
-      buf.fill(fill)
-    }
-  } else {
-    buf.fill(0)
-  }
-  return buf
-}
-
-SafeBuffer.allocUnsafe = function (size) {
-  if (typeof size !== 'number') {
-    throw new TypeError('Argument must be a number')
-  }
-  return Buffer(size)
-}
-
-SafeBuffer.allocUnsafeSlow = function (size) {
-  if (typeof size !== 'number') {
-    throw new TypeError('Argument must be a number')
-  }
-  return buffer.SlowBuffer(size)
-}
diff --git a/legacy-libs/grpc/node_modules/safe-buffer/package.json b/legacy-libs/grpc/node_modules/safe-buffer/package.json
deleted file mode 100644 (file)
index 5ec6350..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-{
-  "_args": [
-    [
-      "safe-buffer@5.1.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "safe-buffer@5.1.2",
-  "_id": "safe-buffer@5.1.2",
-  "_inBundle": false,
-  "_integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
-  "_location": "/grpc/safe-buffer",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "safe-buffer@5.1.2",
-    "name": "safe-buffer",
-    "escapedName": "safe-buffer",
-    "rawSpec": "5.1.2",
-    "saveSpec": null,
-    "fetchSpec": "5.1.2"
-  },
-  "_requiredBy": [
-    "/grpc/minipass",
-    "/grpc/readable-stream",
-    "/grpc/string_decoder",
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "5.1.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Feross Aboukhadijeh",
-    "email": "feross@feross.org",
-    "url": "http://feross.org"
-  },
-  "bugs": {
-    "url": "https://github.com/feross/safe-buffer/issues"
-  },
-  "dependencies": {},
-  "description": "Safer Node.js Buffer API",
-  "devDependencies": {
-    "standard": "*",
-    "tape": "^4.0.0"
-  },
-  "homepage": "https://github.com/feross/safe-buffer",
-  "keywords": [
-    "buffer",
-    "buffer allocate",
-    "node security",
-    "safe",
-    "safe-buffer",
-    "security",
-    "uninitialized"
-  ],
-  "license": "MIT",
-  "main": "index.js",
-  "name": "safe-buffer",
-  "optionalDependencies": {},
-  "readme": "# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]\n\n[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg\n[travis-url]: https://travis-ci.org/feross/safe-buffer\n[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg\n[npm-url]: https://npmjs.org/package/safe-buffer\n[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg\n[downloads-url]: https://npmjs.org/package/safe-buffer\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n\n#### Safer Node.js Buffer API\n\n**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,\n`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**\n\n**Uses the built-in implementation when available.**\n\n## install\n\n```\nnpm install safe-buffer\n```\n\n## usage\n\nThe goal of this package is to provide a safe replacement for the node.js `Buffer`.\n\nIt's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to\nthe top of your node.js modules:\n\n```js\nvar Buffer = require('safe-buffer').Buffer\n\n// Existing buffer code will continue to work without issues:\n\nnew Buffer('hey', 'utf8')\nnew Buffer([1, 2, 3], 'utf8')\nnew Buffer(obj)\nnew Buffer(16) // create an uninitialized buffer (potentially unsafe)\n\n// But you can use these new explicit APIs to make clear what you want:\n\nBuffer.from('hey', 'utf8') // convert from many types to a Buffer\nBuffer.alloc(16) // create a zero-filled buffer (safe)\nBuffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)\n```\n\n## api\n\n### Class Method: Buffer.from(array)\n<!-- YAML\nadded: v3.0.0\n-->\n\n* `array` {Array}\n\nAllocates a new `Buffer` using an `array` of octets.\n\n```js\nconst buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);\n  // creates a new Buffer containing ASCII bytes\n  // ['b','u','f','f','e','r']\n```\n\nA `TypeError` will be thrown if `array` is not an `Array`.\n\n### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])\n<!-- YAML\nadded: v5.10.0\n-->\n\n* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or\n  a `new ArrayBuffer()`\n* `byteOffset` {Number} Default: `0`\n* `length` {Number} Default: `arrayBuffer.length - byteOffset`\n\nWhen passed a reference to the `.buffer` property of a `TypedArray` instance,\nthe newly created `Buffer` will share the same allocated memory as the\nTypedArray.\n\n```js\nconst arr = new Uint16Array(2);\narr[0] = 5000;\narr[1] = 4000;\n\nconst buf = Buffer.from(arr.buffer); // shares the memory with arr;\n\nconsole.log(buf);\n  // Prints: <Buffer 88 13 a0 0f>\n\n// changing the TypedArray changes the Buffer also\narr[1] = 6000;\n\nconsole.log(buf);\n  // Prints: <Buffer 88 13 70 17>\n```\n\nThe optional `byteOffset` and `length` arguments specify a memory range within\nthe `arrayBuffer` that will be shared by the `Buffer`.\n\n```js\nconst ab = new ArrayBuffer(10);\nconst buf = Buffer.from(ab, 0, 2);\nconsole.log(buf.length);\n  // Prints: 2\n```\n\nA `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.\n\n### Class Method: Buffer.from(buffer)\n<!-- YAML\nadded: v3.0.0\n-->\n\n* `buffer` {Buffer}\n\nCopies the passed `buffer` data onto a new `Buffer` instance.\n\n```js\nconst buf1 = Buffer.from('buffer');\nconst buf2 = Buffer.from(buf1);\n\nbuf1[0] = 0x61;\nconsole.log(buf1.toString());\n  // 'auffer'\nconsole.log(buf2.toString());\n  // 'buffer' (copy is not changed)\n```\n\nA `TypeError` will be thrown if `buffer` is not a `Buffer`.\n\n### Class Method: Buffer.from(str[, encoding])\n<!-- YAML\nadded: v5.10.0\n-->\n\n* `str` {String} String to encode.\n* `encoding` {String} Encoding to use, Default: `'utf8'`\n\nCreates a new `Buffer` containing the given JavaScript string `str`. If\nprovided, the `encoding` parameter identifies the character encoding.\nIf not provided, `encoding` defaults to `'utf8'`.\n\n```js\nconst buf1 = Buffer.from('this is a tést');\nconsole.log(buf1.toString());\n  // prints: this is a tést\nconsole.log(buf1.toString('ascii'));\n  // prints: this is a tC)st\n\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\nconsole.log(buf2.toString());\n  // prints: this is a tést\n```\n\nA `TypeError` will be thrown if `str` is not a string.\n\n### Class Method: Buffer.alloc(size[, fill[, encoding]])\n<!-- YAML\nadded: v5.10.0\n-->\n\n* `size` {Number}\n* `fill` {Value} Default: `undefined`\n* `encoding` {String} Default: `utf8`\n\nAllocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the\n`Buffer` will be *zero-filled*.\n\n```js\nconst buf = Buffer.alloc(5);\nconsole.log(buf);\n  // <Buffer 00 00 00 00 00>\n```\n\nThe `size` must be less than or equal to the value of\n`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is\n`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will\nbe created if a `size` less than or equal to 0 is specified.\n\nIf `fill` is specified, the allocated `Buffer` will be initialized by calling\n`buf.fill(fill)`. See [`buf.fill()`][] for more information.\n\n```js\nconst buf = Buffer.alloc(5, 'a');\nconsole.log(buf);\n  // <Buffer 61 61 61 61 61>\n```\n\nIf both `fill` and `encoding` are specified, the allocated `Buffer` will be\ninitialized by calling `buf.fill(fill, encoding)`. For example:\n\n```js\nconst buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');\nconsole.log(buf);\n  // <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>\n```\n\nCalling `Buffer.alloc(size)` can be significantly slower than the alternative\n`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance\ncontents will *never contain sensitive data*.\n\nA `TypeError` will be thrown if `size` is not a number.\n\n### Class Method: Buffer.allocUnsafe(size)\n<!-- YAML\nadded: v5.10.0\n-->\n\n* `size` {Number}\n\nAllocates a new *non-zero-filled* `Buffer` of `size` bytes.  The `size` must\nbe less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit\narchitectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is\nthrown. A zero-length Buffer will be created if a `size` less than or equal to\n0 is specified.\n\nThe underlying memory for `Buffer` instances created in this way is *not\ninitialized*. The contents of the newly created `Buffer` are unknown and\n*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such\n`Buffer` instances to zeroes.\n\n```js\nconst buf = Buffer.allocUnsafe(5);\nconsole.log(buf);\n  // <Buffer 78 e0 82 02 01>\n  // (octets will be different, every time)\nbuf.fill(0);\nconsole.log(buf);\n  // <Buffer 00 00 00 00 00>\n```\n\nA `TypeError` will be thrown if `size` is not a number.\n\nNote that the `Buffer` module pre-allocates an internal `Buffer` instance of\nsize `Buffer.poolSize` that is used as a pool for the fast allocation of new\n`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated\n`new Buffer(size)` constructor) only when `size` is less than or equal to\n`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default\nvalue of `Buffer.poolSize` is `8192` but can be modified.\n\nUse of this pre-allocated internal memory pool is a key difference between\ncalling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.\nSpecifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer\npool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal\nBuffer pool if `size` is less than or equal to half `Buffer.poolSize`. The\ndifference is subtle but can be important when an application requires the\nadditional performance that `Buffer.allocUnsafe(size)` provides.\n\n### Class Method: Buffer.allocUnsafeSlow(size)\n<!-- YAML\nadded: v5.10.0\n-->\n\n* `size` {Number}\n\nAllocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes.  The\n`size` must be less than or equal to the value of\n`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is\n`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will\nbe created if a `size` less than or equal to 0 is specified.\n\nThe underlying memory for `Buffer` instances created in this way is *not\ninitialized*. The contents of the newly created `Buffer` are unknown and\n*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such\n`Buffer` instances to zeroes.\n\nWhen using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,\nallocations under 4KB are, by default, sliced from a single pre-allocated\n`Buffer`. This allows applications to avoid the garbage collection overhead of\ncreating many individually allocated Buffers. This approach improves both\nperformance and memory usage by eliminating the need to track and cleanup as\nmany `Persistent` objects.\n\nHowever, in the case where a developer may need to retain a small chunk of\nmemory from a pool for an indeterminate amount of time, it may be appropriate\nto create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then\ncopy out the relevant bits.\n\n```js\n// need to keep around a few small chunks of memory\nconst store = [];\n\nsocket.on('readable', () => {\n  const data = socket.read();\n  // allocate for retained data\n  const sb = Buffer.allocUnsafeSlow(10);\n  // copy the data into the new allocation\n  data.copy(sb, 0, 0, 10);\n  store.push(sb);\n});\n```\n\nUse of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*\na developer has observed undue memory retention in their applications.\n\nA `TypeError` will be thrown if `size` is not a number.\n\n### All the Rest\n\nThe rest of the `Buffer` API is exactly the same as in node.js.\n[See the docs](https://nodejs.org/api/buffer.html).\n\n\n## Related links\n\n- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)\n- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)\n\n## Why is `Buffer` unsafe?\n\nToday, the node.js `Buffer` constructor is overloaded to handle many different argument\ntypes like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),\n`ArrayBuffer`, and also `Number`.\n\nThe API is optimized for convenience: you can throw any type at it, and it will try to do\nwhat you want.\n\nBecause the Buffer constructor is so powerful, you often see code like this:\n\n```js\n// Convert UTF-8 strings to hex\nfunction toHex (str) {\n  return new Buffer(str).toString('hex')\n}\n```\n\n***But what happens if `toHex` is called with a `Number` argument?***\n\n### Remote Memory Disclosure\n\nIf an attacker can make your program call the `Buffer` constructor with a `Number`\nargument, then they can make it allocate uninitialized memory from the node.js process.\nThis could potentially disclose TLS private keys, user data, or database passwords.\n\nWhen the `Buffer` constructor is passed a `Number` argument, it returns an\n**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like\nthis, you **MUST** overwrite the contents before returning it to the user.\n\nFrom the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):\n\n> `new Buffer(size)`\n>\n> - `size` Number\n>\n> The underlying memory for `Buffer` instances created in this way is not initialized.\n> **The contents of a newly created `Buffer` are unknown and could contain sensitive\n> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.\n\n(Emphasis our own.)\n\nWhenever the programmer intended to create an uninitialized `Buffer` you often see code\nlike this:\n\n```js\nvar buf = new Buffer(16)\n\n// Immediately overwrite the uninitialized buffer with data from another buffer\nfor (var i = 0; i < buf.length; i++) {\n  buf[i] = otherBuf[i]\n}\n```\n\n\n### Would this ever be a problem in real code?\n\nYes. It's surprisingly common to forget to check the type of your variables in a\ndynamically-typed language like JavaScript.\n\nUsually the consequences of assuming the wrong type is that your program crashes with an\nuncaught exception. But the failure mode for forgetting to check the type of arguments to\nthe `Buffer` constructor is more catastrophic.\n\nHere's an example of a vulnerable service that takes a JSON payload and converts it to\nhex:\n\n```js\n// Take a JSON payload {str: \"some string\"} and convert it to hex\nvar server = http.createServer(function (req, res) {\n  var data = ''\n  req.setEncoding('utf8')\n  req.on('data', function (chunk) {\n    data += chunk\n  })\n  req.on('end', function () {\n    var body = JSON.parse(data)\n    res.end(new Buffer(body.str).toString('hex'))\n  })\n})\n\nserver.listen(8080)\n```\n\nIn this example, an http client just has to send:\n\n```json\n{\n  \"str\": 1000\n}\n```\n\nand it will get back 1,000 bytes of uninitialized memory from the server.\n\nThis is a very serious bug. It's similar in severity to the\n[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process\nmemory by remote attackers.\n\n\n### Which real-world packages were vulnerable?\n\n#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)\n\n[Mathias Buus](https://github.com/mafintosh) and I\n([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,\n[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow\nanyone on the internet to send a series of messages to a user of `bittorrent-dht` and get\nthem to reveal 20 bytes at a time of uninitialized memory from the node.js process.\n\nHere's\n[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)\nthat fixed it. We released a new fixed version, created a\n[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all\nvulnerable versions on npm so users will get a warning to upgrade to a newer version.\n\n#### [`ws`](https://www.npmjs.com/package/ws)\n\nThat got us wondering if there were other vulnerable packages. Sure enough, within a short\nperiod of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the\nmost popular WebSocket implementation in node.js.\n\nIf certain APIs were called with `Number` parameters instead of `String` or `Buffer` as\nexpected, then uninitialized server memory would be disclosed to the remote peer.\n\nThese were the vulnerable methods:\n\n```js\nsocket.send(number)\nsocket.ping(number)\nsocket.pong(number)\n```\n\nHere's a vulnerable socket server with some echo functionality:\n\n```js\nserver.on('connection', function (socket) {\n  socket.on('message', function (message) {\n    message = JSON.parse(message)\n    if (message.type === 'echo') {\n      socket.send(message.data) // send back the user's message\n    }\n  })\n})\n```\n\n`socket.send(number)` called on the server, will disclose server memory.\n\nHere's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue\nwas fixed, with a more detailed explanation. Props to\n[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the\n[Node Security Project disclosure](https://nodesecurity.io/advisories/67).\n\n\n### What's the solution?\n\nIt's important that node.js offers a fast way to get memory otherwise performance-critical\napplications would needlessly get a lot slower.\n\nBut we need a better way to *signal our intent* as programmers. **When we want\nuninitialized memory, we should request it explicitly.**\n\nSensitive functionality should not be packed into a developer-friendly API that loosely\naccepts many different types. This type of API encourages the lazy practice of passing\nvariables in without checking the type very carefully.\n\n#### A new API: `Buffer.allocUnsafe(number)`\n\nThe functionality of creating buffers with uninitialized memory should be part of another\nAPI. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that\nfrequently gets user input of all sorts of different types passed into it.\n\n```js\nvar buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!\n\n// Immediately overwrite the uninitialized buffer with data from another buffer\nfor (var i = 0; i < buf.length; i++) {\n  buf[i] = otherBuf[i]\n}\n```\n\n\n### How do we fix node.js core?\n\nWe sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as\n`semver-major`) which defends against one case:\n\n```js\nvar str = 16\nnew Buffer(str, 'utf8')\n```\n\nIn this situation, it's implied that the programmer intended the first argument to be a\nstring, since they passed an encoding as a second argument. Today, node.js will allocate\nuninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not\nwhat the programmer intended.\n\nBut this is only a partial solution, since if the programmer does `new Buffer(variable)`\n(without an `encoding` parameter) there's no way to know what they intended. If `variable`\nis sometimes a number, then uninitialized memory will sometimes be returned.\n\n### What's the real long-term fix?\n\nWe could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when\nwe need uninitialized memory. But that would break 1000s of packages.\n\n~~We believe the best solution is to:~~\n\n~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~\n\n~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~\n\n#### Update\n\nWe now support adding three new APIs:\n\n- `Buffer.from(value)` - convert from any type to a buffer\n- `Buffer.alloc(size)` - create a zero-filled buffer\n- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size\n\nThis solves the core problem that affected `ws` and `bittorrent-dht` which is\n`Buffer(variable)` getting tricked into taking a number argument.\n\nThis way, existing code continues working and the impact on the npm ecosystem will be\nminimal. Over time, npm maintainers can migrate performance-critical code to use\n`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.\n\n\n### Conclusion\n\nWe think there's a serious design issue with the `Buffer` API as it exists today. It\npromotes insecure software by putting high-risk functionality into a convenient API\nwith friendly \"developer ergonomics\".\n\nThis wasn't merely a theoretical exercise because we found the issue in some of the\nmost popular npm packages.\n\nFortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of\n`buffer`.\n\n```js\nvar Buffer = require('safe-buffer').Buffer\n```\n\nEventually, we hope that node.js core can switch to this new, safer behavior. We believe\nthe impact on the ecosystem would be minimal since it's not a breaking change.\nWell-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while\nolder, insecure packages would magically become safe from this attack vector.\n\n\n## links\n\n- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)\n- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)\n- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)\n\n\n## credit\n\nThe original issues in `bittorrent-dht`\n([disclosure](https://nodesecurity.io/advisories/68)) and\n`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by\n[Mathias Buus](https://github.com/mafintosh) and\n[Feross Aboukhadijeh](http://feross.org/).\n\nThanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues\nand for his work running the [Node Security Project](https://nodesecurity.io/).\n\nThanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and\nauditing the code.\n\n\n## license\n\nMIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/feross/safe-buffer.git"
-  },
-  "scripts": {
-    "test": "standard && tape test/*.js"
-  },
-  "types": "index.d.ts",
-  "version": "5.1.2"
-}
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/LICENSE b/legacy-libs/grpc/node_modules/safer-buffer/LICENSE
deleted file mode 100644 (file)
index 4fe9e6f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2018 Nikita Skovoroda <chalkerx@gmail.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/Porting-Buffer.md b/legacy-libs/grpc/node_modules/safer-buffer/Porting-Buffer.md
deleted file mode 100644 (file)
index 68d86ba..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-# Porting to the Buffer.from/Buffer.alloc API
-
-<a id="overview"></a>
-## Overview
-
-- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*)
-- [Variant 2: Use a polyfill](#variant-2)
-- [Variant 3: manual detection, with safeguards](#variant-3)
-
-### Finding problematic bits of code using grep
-
-Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`.
-
-It will find all the potentially unsafe places in your own code (with some considerably unlikely
-exceptions).
-
-### Finding problematic bits of code using Node.js 8
-
-If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code:
-
-- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js.
-- `--trace-deprecation` does the same thing, but only for deprecation warnings.
-- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8.
-
-You can set these flags using an environment variable:
-
-```console
-$ export NODE_OPTIONS='--trace-warnings --pending-deprecation'
-$ cat example.js
-'use strict';
-const foo = new Buffer('foo');
-$ node example.js
-(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead.
-    at showFlaggedDeprecation (buffer.js:127:13)
-    at new Buffer (buffer.js:148:3)
-    at Object.<anonymous> (/path/to/example.js:2:13)
-    [... more stack trace lines ...]
-```
-
-### Finding problematic bits of code using linters
-
-Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor)
-or
-[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)
-also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets.
-
-There is a drawback, though, that it doesn't always
-[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is
-overriden e.g. with a polyfill, so recommended is a combination of this and some other method
-described above.
-
-<a id="variant-1"></a>
-## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.
-
-This is the recommended solution nowadays that would imply only minimal overhead.
-
-The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible.
-
-What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way:
-
-- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`.
-- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`).
-- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`.
-
-Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than
-`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling.
-
-Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor)
-or
-[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)
-is recommended to avoid accidential unsafe Buffer API usage.
-
-There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005)
-for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`.
-Note that it currently only works with cases where the arguments are literals or where the
-constructor is invoked with two arguments.
-
-_If you currently support those older Node.js versions and dropping them would be a semver-major change
-for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2)
-or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive
-the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and
-your users will not observe a runtime deprecation warning when running your code on Node.js 10._
-
-<a id="variant-2"></a>
-## Variant 2: Use a polyfill
-
-Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older
-Node.js versions.
-
-You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill
-`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api.
-
-Make sure that you do not use old `new Buffer` API — in any files where the line above is added,
-using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though.
-
-Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or
-[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) —
-those are great, the only downsides being 4 deps in the tree and slightly more code changes to
-migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only
-`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies.
-
-_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also
-provides a polyfill, but takes a different approach which has
-[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you
-to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as
-it is problematic, can cause issues in your code, and will start emitting runtime deprecation
-warnings starting with Node.js 10._
-
-Note that in either case, it is important that you also remove all calls to the old Buffer
-API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides
-a polyfill for the new API. I have seen people doing that mistake.
-
-Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor)
-or
-[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)
-is recommended.
-
-_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._
-
-<a id="variant-3"></a>
-## Variant 3 — manual detection, with safeguards
-
-This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own
-wrapper around them.
-
-### Buffer(0)
-
-This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which
-returns the same result all the way down to Node.js 0.8.x.
-
-### Buffer(notNumber)
-
-Before:
-
-```js
-var buf = new Buffer(notNumber, encoding);
-```
-
-After:
-
-```js
-var buf;
-if (Buffer.from && Buffer.from !== Uint8Array.from) {
-  buf = Buffer.from(notNumber, encoding);
-} else {
-  if (typeof notNumber === 'number')
-    throw new Error('The "size" argument must be of type number.');
-  buf = new Buffer(notNumber, encoding);
-}
-```
-
-`encoding` is optional.
-
-Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not
-hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the
-Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous
-security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create
-problems ranging from DoS to leaking sensitive information to the attacker from the process memory.
-
-When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can
-be omitted.
-
-Also note that using TypeScript does not fix this problem for you — when libs written in
-`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as
-all type checks are translation-time only and are not present in the actual JS code which TS
-compiles to.
-
-### Buffer(number)
-
-For Node.js 0.10.x (and below) support:
-
-```js
-var buf;
-if (Buffer.alloc) {
-  buf = Buffer.alloc(number);
-} else {
-  buf = new Buffer(number);
-  buf.fill(0);
-}
-```
-
-Otherwise (Node.js ≥ 0.12.x):
-
-```js
-const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0);
-```
-
-## Regarding Buffer.allocUnsafe
-
-Be extra cautious when using `Buffer.allocUnsafe`:
- * Don't use it if you don't have a good reason to
-   * e.g. you probably won't ever see a performance difference for small buffers, in fact, those
-     might be even faster with `Buffer.alloc()`,
-   * if your code is not in the hot code path — you also probably won't notice a difference,
-   * keep in mind that zero-filling minimizes the potential risks.
- * If you use it, make sure that you never return the buffer in a partially-filled state,
-   * if you are writing to it sequentially — always truncate it to the actuall written length
-
-Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues,
-ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs)
-leaking to the remote attacker.
-
-_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js
-version (and lacking type checks also adds DoS to the list of potential problems)._
-
-<a id="faq"></a>
-## FAQ
-
-<a id="design-flaws"></a>
-### What is wrong with the `Buffer` constructor?
-
-The `Buffer` constructor could be used to create a buffer in many different ways:
-
-- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained
-  *arbitrary memory* for performance reasons, which could include anything ranging from
-  program source code to passwords and encryption keys.
-- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of
-  the string `'abc'`. A second argument could specify another encoding: For example,
-  `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original
-  sequence of bytes that it represents.
-- There are several other combinations of arguments.
-
-This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell
-what exactly the contents of the generated buffer are* without knowing the type of `foo`.
-
-Sometimes, the value of `foo` comes from an external source. For example, this function
-could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form:
-
-```
-function stringToBase64(req, res) {
-  // The request body should have the format of `{ string: 'foobar' }`
-  const rawBytes = new Buffer(req.body.string)
-  const encoded = rawBytes.toString('base64')
-  res.end({ encoded: encoded })
-}
-```
-
-Note that this code does *not* validate the type of `req.body.string`:
-
-- `req.body.string` is expected to be a string. If this is the case, all goes well.
-- `req.body.string` is controlled by the client that sends the request.
-- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes:
-  - Before Node.js 8, the content would be uninitialized
-  - After Node.js 8, the content would be `50` bytes with the value `0`
-
-Because of the missing type check, an attacker could intentionally send a number
-as part of the request. Using this, they can either:
-
-- Read uninitialized memory. This **will** leak passwords, encryption keys and other
-  kinds of sensitive information. (Information leak)
-- Force the program to allocate a large amount of memory. For example, when specifying
-  `500000000` as the input value, each request will allocate 500MB of memory.
-  This can be used to either exhaust the memory available of a program completely
-  and make it crash, or slow it down significantly. (Denial of Service)
-
-Both of these scenarios are considered serious security issues in a real-world
-web server context.
-
-when using `Buffer.from(req.body.string)` instead, passing a number will always
-throw an exception instead, giving a controlled behaviour that can always be
-handled by the program.
-
-<a id="ecosystem-usage"></a>
-### The `Buffer()` constructor has been deprecated for a while. Is this really an issue?
-
-Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still
-widely used. This includes new code, and overall usage of such code has actually been
-*increasing*.
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/Readme.md b/legacy-libs/grpc/node_modules/safer-buffer/Readme.md
deleted file mode 100644 (file)
index 14b0822..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url]
-
-[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master
-[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer
-[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg
-[npm-url]: https://npmjs.org/package/safer-buffer
-[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
-[standard-url]: https://standardjs.com
-[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg
-[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md
-
-Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current.
-
-## How to use?
-
-First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API.
-
-Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use
-`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new
-Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._
-
-Also, see the
-[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide.
-
-## Do I need it?
-
-Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that
-is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()`
-though.
-
-See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md)
-for a better description.
-
-## Why not [safe-buffer](https://npmjs.com/safe-buffer)?
-
-_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and
-itself contains footguns._
-
-`safe-buffer` could be used safely to get the new API while still keeping support for older
-Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API
-I found out that `safe-buffer` is itself causing problems in some cases.
-
-For example, consider the following snippet:
-
-```console
-$ cat example.unsafe.js
-console.log(Buffer(20))
-$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js
-<Buffer 0a 00 00 00 00 00 00 00 28 13 de 02 00 00 00 00 05 00 00 00>
-$ standard example.unsafe.js
-standard: Use JavaScript Standard Style (https://standardjs.com)
-  /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead.
-```
-
-This is allocates and writes to console an uninitialized chunk of memory.
-[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people
-to avoid using unsafe API.
-
-Let's now throw in `safe-buffer`!
-
-```console
-$ cat example.safe-buffer.js
-const Buffer = require('safe-buffer').Buffer
-console.log(Buffer(20))
-$ standard example.safe-buffer.js
-$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js
-<Buffer 08 00 00 00 00 00 00 00 28 58 01 82 fe 7f 00 00 00 00 00 00>
-```
-
-See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior
-remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out
-chunks of uninitialized memory.
-_And this code will still emit runtime warnings on Node.js 10.x and above._
-
-That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or
-emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some
-discussion, it was decided to move my approach into a separate package, and _this is that separate
-package_.
-
-This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing,
-«fixing» the lint warning by blindly including `safe-buffer` without any actual changes.
-
-Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request
-can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go
-unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even
-pass CI. _I also observed that being done in popular packages._
-
-Some examples:
- * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31)
-   (a module with 548 759 downloads/month),
- * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61)
-   (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)),
- * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c)
-   (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)),
- * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec)
-   (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)),
- * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1)
-   (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)).
- * And there are a lot more over the ecosystem.
-
-I filed a PR at
-[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to
-partially fix that (for cases when that lint rule is used), but it is a semver-major change for
-linter rules and presets, so it would take significant time for that to reach actual setups.
-_It also hasn't been released yet (2018-03-20)._
-
-Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake.
-It still supports it with an explicit concern barier, by placing it under
-`require('safer-buffer/dangereous')`.
-
-## But isn't throwing bad?
-
-Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like
-unguarded `new Buffer()` calls that end up receiving user input can do.
-
-This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so
-it is really simple to keep track of things and make sure that you don't mix old API usage with that.
-Also, CI should hint anything that you might have missed.
-
-New commits, if tested, won't land new usage of unsafe Buffer API this way.
-_Node.js 10.x also deals with that by printing a runtime depecation warning._
-
-### Would it affect third-party modules?
-
-No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`.
-Don't do that.
-
-### But I don't want throwing…
-
-That is also fine!
-
-Also, it could be better in some cases when you don't comprehensive enough test coverage.
-
-In that case — just don't override `Buffer` and use
-`var SaferBuffer = require('safer-buffer').Buffer` instead.
-
-That way, everything using `Buffer` natively would still work, but there would be two drawbacks:
-
-* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and
-  `SaferBuffer.alloc` instead.
-* You are still open to accidentally using the insecure deprecated API — use a linter to catch that.
-
-Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly
-recommended. `Buffer` is not overriden in this usecase, so linters won't get confused.
-
-## «Without footguns»?
-
-Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property
-on older versions and duping things from there. You shouldn't do that in your code, probabably.
-
-The intention is to remove the most significant footguns that affect lots of packages in the
-ecosystem, and to do it in the proper way.
-
-Also, this package doesn't protect against security issues affecting some Node.js versions, so for
-usage in your own production code, it is still recommended to update to a Node.js version
-[supported by upstream](https://github.com/nodejs/release#release-schedule).
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/dangerous.js b/legacy-libs/grpc/node_modules/safer-buffer/dangerous.js
deleted file mode 100644 (file)
index ca41fdc..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* eslint-disable node/no-deprecated-api */
-
-'use strict'
-
-var buffer = require('buffer')
-var Buffer = buffer.Buffer
-var safer = require('./safer.js')
-var Safer = safer.Buffer
-
-var dangerous = {}
-
-var key
-
-for (key in safer) {
-  if (!safer.hasOwnProperty(key)) continue
-  dangerous[key] = safer[key]
-}
-
-var Dangereous = dangerous.Buffer = {}
-
-// Copy Safer API
-for (key in Safer) {
-  if (!Safer.hasOwnProperty(key)) continue
-  Dangereous[key] = Safer[key]
-}
-
-// Copy those missing unsafe methods, if they are present
-for (key in Buffer) {
-  if (!Buffer.hasOwnProperty(key)) continue
-  if (Dangereous.hasOwnProperty(key)) continue
-  Dangereous[key] = Buffer[key]
-}
-
-if (!Dangereous.allocUnsafe) {
-  Dangereous.allocUnsafe = function (size) {
-    if (typeof size !== 'number') {
-      throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
-    }
-    if (size < 0 || size >= 2 * (1 << 30)) {
-      throw new RangeError('The value "' + size + '" is invalid for option "size"')
-    }
-    return Buffer(size)
-  }
-}
-
-if (!Dangereous.allocUnsafeSlow) {
-  Dangereous.allocUnsafeSlow = function (size) {
-    if (typeof size !== 'number') {
-      throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
-    }
-    if (size < 0 || size >= 2 * (1 << 30)) {
-      throw new RangeError('The value "' + size + '" is invalid for option "size"')
-    }
-    return buffer.SlowBuffer(size)
-  }
-}
-
-module.exports = dangerous
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/package.json b/legacy-libs/grpc/node_modules/safer-buffer/package.json
deleted file mode 100644 (file)
index b517537..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-{
-  "_args": [
-    [
-      "safer-buffer@2.1.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "safer-buffer@2.1.2",
-  "_id": "safer-buffer@2.1.2",
-  "_inBundle": false,
-  "_integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
-  "_location": "/grpc/safer-buffer",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "safer-buffer@2.1.2",
-    "name": "safer-buffer",
-    "escapedName": "safer-buffer",
-    "rawSpec": "2.1.2",
-    "saveSpec": null,
-    "fetchSpec": "2.1.2"
-  },
-  "_requiredBy": [
-    "/grpc/iconv-lite"
-  ],
-  "_resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.1.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Nikita Skovoroda",
-    "email": "chalkerx@gmail.com",
-    "url": "https://github.com/ChALkeR"
-  },
-  "bugs": {
-    "url": "https://github.com/ChALkeR/safer-buffer/issues"
-  },
-  "dependencies": {},
-  "description": "Modern Buffer API polyfill without footguns",
-  "devDependencies": {
-    "standard": "^11.0.1",
-    "tape": "^4.9.0"
-  },
-  "files": [
-    "Porting-Buffer.md",
-    "Readme.md",
-    "tests.js",
-    "dangerous.js",
-    "safer.js"
-  ],
-  "homepage": "https://github.com/ChALkeR/safer-buffer#readme",
-  "license": "MIT",
-  "main": "safer.js",
-  "name": "safer-buffer",
-  "optionalDependencies": {},
-  "readme": "# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url]\n\n[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master\n[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer\n[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg\n[npm-url]: https://npmjs.org/package/safer-buffer\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg\n[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md\n\nModern Buffer API polyfill without footguns, working on Node.js from 0.8 to current.\n\n## How to use?\n\nFirst, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API.\n\nThen, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use\n`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new\nBuffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._\n\nAlso, see the\n[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide.\n\n## Do I need it?\n\nHopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that\nis the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()`\nthough.\n\nSee the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md)\nfor a better description.\n\n## Why not [safe-buffer](https://npmjs.com/safe-buffer)?\n\n_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and\nitself contains footguns._\n\n`safe-buffer` could be used safely to get the new API while still keeping support for older\nNode.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API\nI found out that `safe-buffer` is itself causing problems in some cases.\n\nFor example, consider the following snippet:\n\n```console\n$ cat example.unsafe.js\nconsole.log(Buffer(20))\n$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js\n<Buffer 0a 00 00 00 00 00 00 00 28 13 de 02 00 00 00 00 05 00 00 00>\n$ standard example.unsafe.js\nstandard: Use JavaScript Standard Style (https://standardjs.com)\n  /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead.\n```\n\nThis is allocates and writes to console an uninitialized chunk of memory.\n[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people\nto avoid using unsafe API.\n\nLet's now throw in `safe-buffer`!\n\n```console\n$ cat example.safe-buffer.js\nconst Buffer = require('safe-buffer').Buffer\nconsole.log(Buffer(20))\n$ standard example.safe-buffer.js\n$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js\n<Buffer 08 00 00 00 00 00 00 00 28 58 01 82 fe 7f 00 00 00 00 00 00>\n```\n\nSee the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior\nremains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out\nchunks of uninitialized memory.\n_And this code will still emit runtime warnings on Node.js 10.x and above._\n\nThat was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or\nemitting warnings on it, but that significantly diverges from `safe-buffer` design. After some\ndiscussion, it was decided to move my approach into a separate package, and _this is that separate\npackage_.\n\nThis footgun is not imaginary — I observed top-downloaded packages doing that kind of thing,\n«fixing» the lint warning by blindly including `safe-buffer` without any actual changes.\n\nAlso in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request\ncan bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go\nunnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even\npass CI. _I also observed that being done in popular packages._\n\nSome examples:\n * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31)\n   (a module with 548 759 downloads/month),\n * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61)\n   (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)),\n * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c)\n   (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)),\n * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec)\n   (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)),\n * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1)\n   (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)).\n * And there are a lot more over the ecosystem.\n\nI filed a PR at\n[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to\npartially fix that (for cases when that lint rule is used), but it is a semver-major change for\nlinter rules and presets, so it would take significant time for that to reach actual setups.\n_It also hasn't been released yet (2018-03-20)._\n\nAlso, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake.\nIt still supports it with an explicit concern barier, by placing it under\n`require('safer-buffer/dangereous')`.\n\n## But isn't throwing bad?\n\nNot really. It's an error that could be noticed and fixed early, instead of causing havoc later like\nunguarded `new Buffer()` calls that end up receiving user input can do.\n\nThis package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so\nit is really simple to keep track of things and make sure that you don't mix old API usage with that.\nAlso, CI should hint anything that you might have missed.\n\nNew commits, if tested, won't land new usage of unsafe Buffer API this way.\n_Node.js 10.x also deals with that by printing a runtime depecation warning._\n\n### Would it affect third-party modules?\n\nNo, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`.\nDon't do that.\n\n### But I don't want throwing…\n\nThat is also fine!\n\nAlso, it could be better in some cases when you don't comprehensive enough test coverage.\n\nIn that case — just don't override `Buffer` and use\n`var SaferBuffer = require('safer-buffer').Buffer` instead.\n\nThat way, everything using `Buffer` natively would still work, but there would be two drawbacks:\n\n* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and\n  `SaferBuffer.alloc` instead.\n* You are still open to accidentally using the insecure deprecated API — use a linter to catch that.\n\nNote that using a linter to catch accidential `Buffer` constructor usage in this case is strongly\nrecommended. `Buffer` is not overriden in this usecase, so linters won't get confused.\n\n## «Without footguns»?\n\nWell, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property\non older versions and duping things from there. You shouldn't do that in your code, probabably.\n\nThe intention is to remove the most significant footguns that affect lots of packages in the\necosystem, and to do it in the proper way.\n\nAlso, this package doesn't protect against security issues affecting some Node.js versions, so for\nusage in your own production code, it is still recommended to update to a Node.js version\n[supported by upstream](https://github.com/nodejs/release#release-schedule).\n",
-  "readmeFilename": "Readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/ChALkeR/safer-buffer.git"
-  },
-  "scripts": {
-    "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js",
-    "test": "standard && tape tests.js"
-  },
-  "version": "2.1.2"
-}
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/safer.js b/legacy-libs/grpc/node_modules/safer-buffer/safer.js
deleted file mode 100644 (file)
index 37c7e1a..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* eslint-disable node/no-deprecated-api */
-
-'use strict'
-
-var buffer = require('buffer')
-var Buffer = buffer.Buffer
-
-var safer = {}
-
-var key
-
-for (key in buffer) {
-  if (!buffer.hasOwnProperty(key)) continue
-  if (key === 'SlowBuffer' || key === 'Buffer') continue
-  safer[key] = buffer[key]
-}
-
-var Safer = safer.Buffer = {}
-for (key in Buffer) {
-  if (!Buffer.hasOwnProperty(key)) continue
-  if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
-  Safer[key] = Buffer[key]
-}
-
-safer.Buffer.prototype = Buffer.prototype
-
-if (!Safer.from || Safer.from === Uint8Array.from) {
-  Safer.from = function (value, encodingOrOffset, length) {
-    if (typeof value === 'number') {
-      throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
-    }
-    if (value && typeof value.length === 'undefined') {
-      throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
-    }
-    return Buffer(value, encodingOrOffset, length)
-  }
-}
-
-if (!Safer.alloc) {
-  Safer.alloc = function (size, fill, encoding) {
-    if (typeof size !== 'number') {
-      throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
-    }
-    if (size < 0 || size >= 2 * (1 << 30)) {
-      throw new RangeError('The value "' + size + '" is invalid for option "size"')
-    }
-    var buf = Buffer(size)
-    if (!fill || fill.length === 0) {
-      buf.fill(0)
-    } else if (typeof encoding === 'string') {
-      buf.fill(fill, encoding)
-    } else {
-      buf.fill(fill)
-    }
-    return buf
-  }
-}
-
-if (!safer.kStringMaxLength) {
-  try {
-    safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
-  } catch (e) {
-    // we can't determine kStringMaxLength in environments where process.binding
-    // is unsupported, so let's not set it
-  }
-}
-
-if (!safer.constants) {
-  safer.constants = {
-    MAX_LENGTH: safer.kMaxLength
-  }
-  if (safer.kStringMaxLength) {
-    safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
-  }
-}
-
-module.exports = safer
diff --git a/legacy-libs/grpc/node_modules/safer-buffer/tests.js b/legacy-libs/grpc/node_modules/safer-buffer/tests.js
deleted file mode 100644 (file)
index 7ed2777..0000000
+++ /dev/null
@@ -1,406 +0,0 @@
-/* eslint-disable node/no-deprecated-api */
-
-'use strict'
-
-var test = require('tape')
-
-var buffer = require('buffer')
-
-var index = require('./')
-var safer = require('./safer')
-var dangerous = require('./dangerous')
-
-/* Inheritance tests */
-
-test('Default is Safer', function (t) {
-  t.equal(index, safer)
-  t.notEqual(safer, dangerous)
-  t.notEqual(index, dangerous)
-  t.end()
-})
-
-test('Is not a function', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.equal(typeof impl, 'object')
-    t.equal(typeof impl.Buffer, 'object')
-  });
-  [buffer].forEach(function (impl) {
-    t.equal(typeof impl, 'object')
-    t.equal(typeof impl.Buffer, 'function')
-  })
-  t.end()
-})
-
-test('Constructor throws', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.throws(function () { impl.Buffer() })
-    t.throws(function () { impl.Buffer(0) })
-    t.throws(function () { impl.Buffer('a') })
-    t.throws(function () { impl.Buffer('a', 'utf-8') })
-    t.throws(function () { return new impl.Buffer() })
-    t.throws(function () { return new impl.Buffer(0) })
-    t.throws(function () { return new impl.Buffer('a') })
-    t.throws(function () { return new impl.Buffer('a', 'utf-8') })
-  })
-  t.end()
-})
-
-test('Safe methods exist', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.equal(typeof impl.Buffer.alloc, 'function', 'alloc')
-    t.equal(typeof impl.Buffer.from, 'function', 'from')
-  })
-  t.end()
-})
-
-test('Unsafe methods exist only in Dangerous', function (t) {
-  [index, safer].forEach(function (impl) {
-    t.equal(typeof impl.Buffer.allocUnsafe, 'undefined')
-    t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined')
-  });
-  [dangerous].forEach(function (impl) {
-    t.equal(typeof impl.Buffer.allocUnsafe, 'function')
-    t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function')
-  })
-  t.end()
-})
-
-test('Generic methods/properties are defined and equal', function (t) {
-  ['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) {
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl.Buffer[method], buffer.Buffer[method], method)
-      t.notEqual(typeof impl.Buffer[method], 'undefined', method)
-    })
-  })
-  t.end()
-})
-
-test('Built-in buffer static methods/properties are inherited', function (t) {
-  Object.keys(buffer).forEach(function (method) {
-    if (method === 'SlowBuffer' || method === 'Buffer') return;
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl[method], buffer[method], method)
-      t.notEqual(typeof impl[method], 'undefined', method)
-    })
-  })
-  t.end()
-})
-
-test('Built-in Buffer static methods/properties are inherited', function (t) {
-  Object.keys(buffer.Buffer).forEach(function (method) {
-    if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl.Buffer[method], buffer.Buffer[method], method)
-      t.notEqual(typeof impl.Buffer[method], 'undefined', method)
-    })
-  })
-  t.end()
-})
-
-test('.prototype property of Buffer is inherited', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype')
-    t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype')
-  })
-  t.end()
-})
-
-test('All Safer methods are present in Dangerous', function (t) {
-  Object.keys(safer).forEach(function (method) {
-    if (method === 'Buffer') return;
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl[method], safer[method], method)
-      if (method !== 'kStringMaxLength') {
-        t.notEqual(typeof impl[method], 'undefined', method)
-      }
-    })
-  })
-  Object.keys(safer.Buffer).forEach(function (method) {
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl.Buffer[method], safer.Buffer[method], method)
-      t.notEqual(typeof impl.Buffer[method], 'undefined', method)
-    })
-  })
-  t.end()
-})
-
-test('Safe methods from Dangerous methods are present in Safer', function (t) {
-  Object.keys(dangerous).forEach(function (method) {
-    if (method === 'Buffer') return;
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl[method], dangerous[method], method)
-      if (method !== 'kStringMaxLength') {
-        t.notEqual(typeof impl[method], 'undefined', method)
-      }
-    })
-  })
-  Object.keys(dangerous.Buffer).forEach(function (method) {
-    if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
-    [index, safer, dangerous].forEach(function (impl) {
-      t.equal(impl.Buffer[method], dangerous.Buffer[method], method)
-      t.notEqual(typeof impl.Buffer[method], 'undefined', method)
-    })
-  })
-  t.end()
-})
-
-/* Behaviour tests */
-
-test('Methods return Buffers', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0)))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10)))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10)))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64')))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3])))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3]))))
-    t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([])))
-  });
-  ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
-    t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0)))
-    t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10)))
-  })
-  t.end()
-})
-
-test('Constructor is buffer.Buffer', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer)
-    t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer)
-    t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer)
-    t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from('').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from('string').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer)
-    t.equal(impl.Buffer.from([]).constructor, buffer.Buffer)
-  });
-  [0, 10, 100].forEach(function (arg) {
-    t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer)
-    t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor)
-  })
-  t.end()
-})
-
-test('Invalid calls throw', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.throws(function () { impl.Buffer.from(0) })
-    t.throws(function () { impl.Buffer.from(10) })
-    t.throws(function () { impl.Buffer.from(10, 'utf-8') })
-    t.throws(function () { impl.Buffer.from('string', 'invalid encoding') })
-    t.throws(function () { impl.Buffer.from(-10) })
-    t.throws(function () { impl.Buffer.from(1e90) })
-    t.throws(function () { impl.Buffer.from(Infinity) })
-    t.throws(function () { impl.Buffer.from(-Infinity) })
-    t.throws(function () { impl.Buffer.from(NaN) })
-    t.throws(function () { impl.Buffer.from(null) })
-    t.throws(function () { impl.Buffer.from(undefined) })
-    t.throws(function () { impl.Buffer.from() })
-    t.throws(function () { impl.Buffer.from({}) })
-    t.throws(function () { impl.Buffer.alloc('') })
-    t.throws(function () { impl.Buffer.alloc('string') })
-    t.throws(function () { impl.Buffer.alloc('string', 'utf-8') })
-    t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') })
-    t.throws(function () { impl.Buffer.alloc(-10) })
-    t.throws(function () { impl.Buffer.alloc(1e90) })
-    t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) })
-    t.throws(function () { impl.Buffer.alloc(Infinity) })
-    t.throws(function () { impl.Buffer.alloc(-Infinity) })
-    t.throws(function () { impl.Buffer.alloc(null) })
-    t.throws(function () { impl.Buffer.alloc(undefined) })
-    t.throws(function () { impl.Buffer.alloc() })
-    t.throws(function () { impl.Buffer.alloc([]) })
-    t.throws(function () { impl.Buffer.alloc([0, 42, 3]) })
-    t.throws(function () { impl.Buffer.alloc({}) })
-  });
-  ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
-    t.throws(function () { dangerous.Buffer[method]('') })
-    t.throws(function () { dangerous.Buffer[method]('string') })
-    t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') })
-    t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) })
-    t.throws(function () { dangerous.Buffer[method](Infinity) })
-    if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) {
-      t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0')
-    } else {
-      t.throws(function () { dangerous.Buffer[method](-10) })
-      t.throws(function () { dangerous.Buffer[method](-1e90) })
-      t.throws(function () { dangerous.Buffer[method](-Infinity) })
-    }
-    t.throws(function () { dangerous.Buffer[method](null) })
-    t.throws(function () { dangerous.Buffer[method](undefined) })
-    t.throws(function () { dangerous.Buffer[method]() })
-    t.throws(function () { dangerous.Buffer[method]([]) })
-    t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) })
-    t.throws(function () { dangerous.Buffer[method]({}) })
-  })
-  t.end()
-})
-
-test('Buffers have appropriate lengths', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.equal(impl.Buffer.alloc(0).length, 0)
-    t.equal(impl.Buffer.alloc(10).length, 10)
-    t.equal(impl.Buffer.from('').length, 0)
-    t.equal(impl.Buffer.from('string').length, 6)
-    t.equal(impl.Buffer.from('string', 'utf-8').length, 6)
-    t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11)
-    t.equal(impl.Buffer.from([0, 42, 3]).length, 3)
-    t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3)
-    t.equal(impl.Buffer.from([]).length, 0)
-  });
-  ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
-    t.equal(dangerous.Buffer[method](0).length, 0)
-    t.equal(dangerous.Buffer[method](10).length, 10)
-  })
-  t.end()
-})
-
-test('Buffers have appropriate lengths (2)', function (t) {
-  t.equal(index.Buffer.alloc, safer.Buffer.alloc)
-  t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
-  var ok = true;
-  [ safer.Buffer.alloc,
-    dangerous.Buffer.allocUnsafe,
-    dangerous.Buffer.allocUnsafeSlow
-  ].forEach(function (method) {
-    for (var i = 0; i < 1e2; i++) {
-      var length = Math.round(Math.random() * 1e5)
-      var buf = method(length)
-      if (!buffer.Buffer.isBuffer(buf)) ok = false
-      if (buf.length !== length) ok = false
-    }
-  })
-  t.ok(ok)
-  t.end()
-})
-
-test('.alloc(size) is zero-filled and has correct length', function (t) {
-  t.equal(index.Buffer.alloc, safer.Buffer.alloc)
-  t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
-  var ok = true
-  for (var i = 0; i < 1e2; i++) {
-    var length = Math.round(Math.random() * 2e6)
-    var buf = index.Buffer.alloc(length)
-    if (!buffer.Buffer.isBuffer(buf)) ok = false
-    if (buf.length !== length) ok = false
-    var j
-    for (j = 0; j < length; j++) {
-      if (buf[j] !== 0) ok = false
-    }
-    buf.fill(1)
-    for (j = 0; j < length; j++) {
-      if (buf[j] !== 1) ok = false
-    }
-  }
-  t.ok(ok)
-  t.end()
-})
-
-test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) {
-  ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
-    var ok = true
-    for (var i = 0; i < 1e2; i++) {
-      var length = Math.round(Math.random() * 2e6)
-      var buf = dangerous.Buffer[method](length)
-      if (!buffer.Buffer.isBuffer(buf)) ok = false
-      if (buf.length !== length) ok = false
-      buf.fill(0, 0, length)
-      var j
-      for (j = 0; j < length; j++) {
-        if (buf[j] !== 0) ok = false
-      }
-      buf.fill(1, 0, length)
-      for (j = 0; j < length; j++) {
-        if (buf[j] !== 1) ok = false
-      }
-    }
-    t.ok(ok, method)
-  })
-  t.end()
-})
-
-test('.alloc(size, fill) is `fill`-filled', function (t) {
-  t.equal(index.Buffer.alloc, safer.Buffer.alloc)
-  t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
-  var ok = true
-  for (var i = 0; i < 1e2; i++) {
-    var length = Math.round(Math.random() * 2e6)
-    var fill = Math.round(Math.random() * 255)
-    var buf = index.Buffer.alloc(length, fill)
-    if (!buffer.Buffer.isBuffer(buf)) ok = false
-    if (buf.length !== length) ok = false
-    for (var j = 0; j < length; j++) {
-      if (buf[j] !== fill) ok = false
-    }
-  }
-  t.ok(ok)
-  t.end()
-})
-
-test('.alloc(size, fill) is `fill`-filled', function (t) {
-  t.equal(index.Buffer.alloc, safer.Buffer.alloc)
-  t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
-  var ok = true
-  for (var i = 0; i < 1e2; i++) {
-    var length = Math.round(Math.random() * 2e6)
-    var fill = Math.round(Math.random() * 255)
-    var buf = index.Buffer.alloc(length, fill)
-    if (!buffer.Buffer.isBuffer(buf)) ok = false
-    if (buf.length !== length) ok = false
-    for (var j = 0; j < length; j++) {
-      if (buf[j] !== fill) ok = false
-    }
-  }
-  t.ok(ok)
-  t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97))
-  t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98))
-
-  var tmp = new buffer.Buffer(2)
-  tmp.fill('ok')
-  if (tmp[1] === tmp[0]) {
-    // Outdated Node.js
-    t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo'))
-  } else {
-    t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko'))
-  }
-  t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok'))
-
-  t.end()
-})
-
-test('safer.Buffer.from returns results same as Buffer constructor', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.deepEqual(impl.Buffer.from(''), new buffer.Buffer(''))
-    t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string'))
-    t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8'))
-    t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64'))
-    t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3]))
-    t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3])))
-    t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([]))
-  })
-  t.end()
-})
-
-test('safer.Buffer.from returns consistent results', function (t) {
-  [index, safer, dangerous].forEach(function (impl) {
-    t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0))
-    t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0))
-    t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0))
-    t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string'))
-    t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103]))
-    t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string')))
-    t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree'))
-    t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree'))
-  })
-  t.end()
-})
diff --git a/legacy-libs/grpc/node_modules/sax/LICENSE b/legacy-libs/grpc/node_modules/sax/LICENSE
deleted file mode 100644 (file)
index ccffa08..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-====
-
-`String.fromCodePoint` by Mathias Bynens used according to terms of MIT
-License, as follows:
-
-    Copyright Mathias Bynens <https://mathiasbynens.be/>
-
-    Permission is hereby granted, free of charge, to any person obtaining
-    a copy of this software and associated documentation files (the
-    "Software"), to deal in the Software without restriction, including
-    without limitation the rights to use, copy, modify, merge, publish,
-    distribute, sublicense, and/or sell copies of the Software, and to
-    permit persons to whom the Software is furnished to do so, subject to
-    the following conditions:
-
-    The above copyright notice and this permission notice shall be
-    included in all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/sax/README.md b/legacy-libs/grpc/node_modules/sax/README.md
deleted file mode 100644 (file)
index afcd3f3..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-# sax js
-
-A sax-style parser for XML and HTML.
-
-Designed with [node](http://nodejs.org/) in mind, but should work fine in
-the browser or other CommonJS implementations.
-
-## What This Is
-
-* A very simple tool to parse through an XML string.
-* A stepping stone to a streaming HTML parser.
-* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML
-  docs.
-
-## What This Is (probably) Not
-
-* An HTML Parser - That's a fine goal, but this isn't it.  It's just
-  XML.
-* A DOM Builder - You can use it to build an object model out of XML,
-  but it doesn't do that out of the box.
-* XSLT - No DOM = no querying.
-* 100% Compliant with (some other SAX implementation) - Most SAX
-  implementations are in Java and do a lot more than this does.
-* An XML Validator - It does a little validation when in strict mode, but
-  not much.
-* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic
-  masochism.
-* A DTD-aware Thing - Fetching DTDs is a much bigger job.
-
-## Regarding `<!DOCTYPE`s and `<!ENTITY`s
-
-The parser will handle the basic XML entities in text nodes and attribute
-values: `&amp; &lt; &gt; &apos; &quot;`. It's possible to define additional
-entities in XML by putting them in the DTD. This parser doesn't do anything
-with that. If you want to listen to the `ondoctype` event, and then fetch
-the doctypes, and read the entities and add them to `parser.ENTITIES`, then
-be my guest.
-
-Unknown entities will fail in strict mode, and in loose mode, will pass
-through unmolested.
-
-## Usage
-
-```javascript
-var sax = require("./lib/sax"),
-  strict = true, // set to false for html-mode
-  parser = sax.parser(strict);
-
-parser.onerror = function (e) {
-  // an error happened.
-};
-parser.ontext = function (t) {
-  // got some text.  t is the string of text.
-};
-parser.onopentag = function (node) {
-  // opened a tag.  node has "name" and "attributes"
-};
-parser.onattribute = function (attr) {
-  // an attribute.  attr has "name" and "value"
-};
-parser.onend = function () {
-  // parser stream is done, and ready to have more stuff written to it.
-};
-
-parser.write('<xml>Hello, <who name="world">world</who>!</xml>').close();
-
-// stream usage
-// takes the same options as the parser
-var saxStream = require("sax").createStream(strict, options)
-saxStream.on("error", function (e) {
-  // unhandled errors will throw, since this is a proper node
-  // event emitter.
-  console.error("error!", e)
-  // clear the error
-  this._parser.error = null
-  this._parser.resume()
-})
-saxStream.on("opentag", function (node) {
-  // same object as above
-})
-// pipe is supported, and it's readable/writable
-// same chunks coming in also go out.
-fs.createReadStream("file.xml")
-  .pipe(saxStream)
-  .pipe(fs.createWriteStream("file-copy.xml"))
-```
-
-
-## Arguments
-
-Pass the following arguments to the parser function.  All are optional.
-
-`strict` - Boolean. Whether or not to be a jerk. Default: `false`.
-
-`opt` - Object bag of settings regarding string formatting.  All default to `false`.
-
-Settings supported:
-
-* `trim` - Boolean. Whether or not to trim text and comment nodes.
-* `normalize` - Boolean. If true, then turn any whitespace into a single
-  space.
-* `lowercase` - Boolean. If true, then lowercase tag names and attribute names
-  in loose mode, rather than uppercasing them.
-* `xmlns` - Boolean. If true, then namespaces are supported.
-* `position` - Boolean. If false, then don't track line/col/position.
-* `strictEntities` - Boolean. If true, only parse [predefined XML
-  entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent)
-  (`&amp;`, `&apos;`, `&gt;`, `&lt;`, and `&quot;`)
-
-## Methods
-
-`write` - Write bytes onto the stream. You don't have to do this all at
-once. You can keep writing as much as you want.
-
-`close` - Close the stream. Once closed, no more data may be written until
-it is done processing the buffer, which is signaled by the `end` event.
-
-`resume` - To gracefully handle errors, assign a listener to the `error`
-event. Then, when the error is taken care of, you can call `resume` to
-continue parsing. Otherwise, the parser will not continue while in an error
-state.
-
-## Members
-
-At all times, the parser object will have the following members:
-
-`line`, `column`, `position` - Indications of the position in the XML
-document where the parser currently is looking.
-
-`startTagPosition` - Indicates the position where the current tag starts.
-
-`closed` - Boolean indicating whether or not the parser can be written to.
-If it's `true`, then wait for the `ready` event to write again.
-
-`strict` - Boolean indicating whether or not the parser is a jerk.
-
-`opt` - Any options passed into the constructor.
-
-`tag` - The current tag being dealt with.
-
-And a bunch of other stuff that you probably shouldn't touch.
-
-## Events
-
-All events emit with a single argument. To listen to an event, assign a
-function to `on<eventname>`. Functions get executed in the this-context of
-the parser object. The list of supported events are also in the exported
-`EVENTS` array.
-
-When using the stream interface, assign handlers using the EventEmitter
-`on` function in the normal fashion.
-
-`error` - Indication that something bad happened. The error will be hanging
-out on `parser.error`, and must be deleted before parsing can continue. By
-listening to this event, you can keep an eye on that kind of stuff. Note:
-this happens *much* more in strict mode. Argument: instance of `Error`.
-
-`text` - Text node. Argument: string of text.
-
-`doctype` - The `<!DOCTYPE` declaration. Argument: doctype string.
-
-`processinginstruction` - Stuff like `<?xml foo="blerg" ?>`. Argument:
-object with `name` and `body` members. Attributes are not parsed, as
-processing instructions have implementation dependent semantics.
-
-`sgmldeclaration` - Random SGML declarations. Stuff like `<!ENTITY p>`
-would trigger this kind of event. This is a weird thing to support, so it
-might go away at some point. SAX isn't intended to be used to parse SGML,
-after all.
-
-`opentagstart` - Emitted immediately when the tag name is available,
-but before any attributes are encountered.  Argument: object with a
-`name` field and an empty `attributes` set.  Note that this is the
-same object that will later be emitted in the `opentag` event.
-
-`opentag` - An opening tag. Argument: object with `name` and `attributes`.
-In non-strict mode, tag names are uppercased, unless the `lowercase`
-option is set.  If the `xmlns` option is set, then it will contain
-namespace binding information on the `ns` member, and will have a
-`local`, `prefix`, and `uri` member.
-
-`closetag` - A closing tag. In loose mode, tags are auto-closed if their
-parent closes. In strict mode, well-formedness is enforced. Note that
-self-closing tags will have `closeTag` emitted immediately after `openTag`.
-Argument: tag name.
-
-`attribute` - An attribute node.  Argument: object with `name` and `value`.
-In non-strict mode, attribute names are uppercased, unless the `lowercase`
-option is set.  If the `xmlns` option is set, it will also contains namespace
-information.
-
-`comment` - A comment node.  Argument: the string of the comment.
-
-`opencdata` - The opening tag of a `<![CDATA[` block.
-
-`cdata` - The text of a `<![CDATA[` block. Since `<![CDATA[` blocks can get
-quite large, this event may fire multiple times for a single block, if it
-is broken up into multiple `write()`s. Argument: the string of random
-character data.
-
-`closecdata` - The closing tag (`]]>`) of a `<![CDATA[` block.
-
-`opennamespace` - If the `xmlns` option is set, then this event will
-signal the start of a new namespace binding.
-
-`closenamespace` - If the `xmlns` option is set, then this event will
-signal the end of a namespace binding.
-
-`end` - Indication that the closed stream has ended.
-
-`ready` - Indication that the stream has reset, and is ready to be written
-to.
-
-`noscript` - In non-strict mode, `<script>` tags trigger a `"script"`
-event, and their contents are not checked for special xml characters.
-If you pass `noscript: true`, then this behavior is suppressed.
-
-## Reporting Problems
-
-It's best to write a failing test if you find an issue.  I will always
-accept pull requests with failing tests if they demonstrate intended
-behavior, but it is very hard to figure out what issue you're describing
-without a test.  Writing a test is also the best way for you yourself
-to figure out if you really understand the issue you think you have with
-sax-js.
diff --git a/legacy-libs/grpc/node_modules/sax/lib/sax.js b/legacy-libs/grpc/node_modules/sax/lib/sax.js
deleted file mode 100644 (file)
index 795d607..0000000
+++ /dev/null
@@ -1,1565 +0,0 @@
-;(function (sax) { // wrapper for non-node envs
-  sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }
-  sax.SAXParser = SAXParser
-  sax.SAXStream = SAXStream
-  sax.createStream = createStream
-
-  // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.
-  // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
-  // since that's the earliest that a buffer overrun could occur.  This way, checks are
-  // as rare as required, but as often as necessary to ensure never crossing this bound.
-  // Furthermore, buffers are only tested at most once per write(), so passing a very
-  // large string into write() might have undesirable effects, but this is manageable by
-  // the caller, so it is assumed to be safe.  Thus, a call to write() may, in the extreme
-  // edge case, result in creating at most one complete copy of the string passed in.
-  // Set to Infinity to have unlimited buffers.
-  sax.MAX_BUFFER_LENGTH = 64 * 1024
-
-  var buffers = [
-    'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',
-    'procInstName', 'procInstBody', 'entity', 'attribName',
-    'attribValue', 'cdata', 'script'
-  ]
-
-  sax.EVENTS = [
-    'text',
-    'processinginstruction',
-    'sgmldeclaration',
-    'doctype',
-    'comment',
-    'opentagstart',
-    'attribute',
-    'opentag',
-    'closetag',
-    'opencdata',
-    'cdata',
-    'closecdata',
-    'error',
-    'end',
-    'ready',
-    'script',
-    'opennamespace',
-    'closenamespace'
-  ]
-
-  function SAXParser (strict, opt) {
-    if (!(this instanceof SAXParser)) {
-      return new SAXParser(strict, opt)
-    }
-
-    var parser = this
-    clearBuffers(parser)
-    parser.q = parser.c = ''
-    parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
-    parser.opt = opt || {}
-    parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
-    parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'
-    parser.tags = []
-    parser.closed = parser.closedRoot = parser.sawRoot = false
-    parser.tag = parser.error = null
-    parser.strict = !!strict
-    parser.noscript = !!(strict || parser.opt.noscript)
-    parser.state = S.BEGIN
-    parser.strictEntities = parser.opt.strictEntities
-    parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)
-    parser.attribList = []
-
-    // namespaces form a prototype chain.
-    // it always points at the current tag,
-    // which protos to its parent tag.
-    if (parser.opt.xmlns) {
-      parser.ns = Object.create(rootNS)
-    }
-
-    // mostly just for error reporting
-    parser.trackPosition = parser.opt.position !== false
-    if (parser.trackPosition) {
-      parser.position = parser.line = parser.column = 0
-    }
-    emit(parser, 'onready')
-  }
-
-  if (!Object.create) {
-    Object.create = function (o) {
-      function F () {}
-      F.prototype = o
-      var newf = new F()
-      return newf
-    }
-  }
-
-  if (!Object.keys) {
-    Object.keys = function (o) {
-      var a = []
-      for (var i in o) if (o.hasOwnProperty(i)) a.push(i)
-      return a
-    }
-  }
-
-  function checkBufferLength (parser) {
-    var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)
-    var maxActual = 0
-    for (var i = 0, l = buffers.length; i < l; i++) {
-      var len = parser[buffers[i]].length
-      if (len > maxAllowed) {
-        // Text/cdata nodes can get big, and since they're buffered,
-        // we can get here under normal conditions.
-        // Avoid issues by emitting the text node now,
-        // so at least it won't get any bigger.
-        switch (buffers[i]) {
-          case 'textNode':
-            closeText(parser)
-            break
-
-          case 'cdata':
-            emitNode(parser, 'oncdata', parser.cdata)
-            parser.cdata = ''
-            break
-
-          case 'script':
-            emitNode(parser, 'onscript', parser.script)
-            parser.script = ''
-            break
-
-          default:
-            error(parser, 'Max buffer length exceeded: ' + buffers[i])
-        }
-      }
-      maxActual = Math.max(maxActual, len)
-    }
-    // schedule the next check for the earliest possible buffer overrun.
-    var m = sax.MAX_BUFFER_LENGTH - maxActual
-    parser.bufferCheckPosition = m + parser.position
-  }
-
-  function clearBuffers (parser) {
-    for (var i = 0, l = buffers.length; i < l; i++) {
-      parser[buffers[i]] = ''
-    }
-  }
-
-  function flushBuffers (parser) {
-    closeText(parser)
-    if (parser.cdata !== '') {
-      emitNode(parser, 'oncdata', parser.cdata)
-      parser.cdata = ''
-    }
-    if (parser.script !== '') {
-      emitNode(parser, 'onscript', parser.script)
-      parser.script = ''
-    }
-  }
-
-  SAXParser.prototype = {
-    end: function () { end(this) },
-    write: write,
-    resume: function () { this.error = null; return this },
-    close: function () { return this.write(null) },
-    flush: function () { flushBuffers(this) }
-  }
-
-  var Stream
-  try {
-    Stream = require('stream').Stream
-  } catch (ex) {
-    Stream = function () {}
-  }
-
-  var streamWraps = sax.EVENTS.filter(function (ev) {
-    return ev !== 'error' && ev !== 'end'
-  })
-
-  function createStream (strict, opt) {
-    return new SAXStream(strict, opt)
-  }
-
-  function SAXStream (strict, opt) {
-    if (!(this instanceof SAXStream)) {
-      return new SAXStream(strict, opt)
-    }
-
-    Stream.apply(this)
-
-    this._parser = new SAXParser(strict, opt)
-    this.writable = true
-    this.readable = true
-
-    var me = this
-
-    this._parser.onend = function () {
-      me.emit('end')
-    }
-
-    this._parser.onerror = function (er) {
-      me.emit('error', er)
-
-      // if didn't throw, then means error was handled.
-      // go ahead and clear error, so we can write again.
-      me._parser.error = null
-    }
-
-    this._decoder = null
-
-    streamWraps.forEach(function (ev) {
-      Object.defineProperty(me, 'on' + ev, {
-        get: function () {
-          return me._parser['on' + ev]
-        },
-        set: function (h) {
-          if (!h) {
-            me.removeAllListeners(ev)
-            me._parser['on' + ev] = h
-            return h
-          }
-          me.on(ev, h)
-        },
-        enumerable: true,
-        configurable: false
-      })
-    })
-  }
-
-  SAXStream.prototype = Object.create(Stream.prototype, {
-    constructor: {
-      value: SAXStream
-    }
-  })
-
-  SAXStream.prototype.write = function (data) {
-    if (typeof Buffer === 'function' &&
-      typeof Buffer.isBuffer === 'function' &&
-      Buffer.isBuffer(data)) {
-      if (!this._decoder) {
-        var SD = require('string_decoder').StringDecoder
-        this._decoder = new SD('utf8')
-      }
-      data = this._decoder.write(data)
-    }
-
-    this._parser.write(data.toString())
-    this.emit('data', data)
-    return true
-  }
-
-  SAXStream.prototype.end = function (chunk) {
-    if (chunk && chunk.length) {
-      this.write(chunk)
-    }
-    this._parser.end()
-    return true
-  }
-
-  SAXStream.prototype.on = function (ev, handler) {
-    var me = this
-    if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
-      me._parser['on' + ev] = function () {
-        var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
-        args.splice(0, 0, ev)
-        me.emit.apply(me, args)
-      }
-    }
-
-    return Stream.prototype.on.call(me, ev, handler)
-  }
-
-  // this really needs to be replaced with character classes.
-  // XML allows all manner of ridiculous numbers and digits.
-  var CDATA = '[CDATA['
-  var DOCTYPE = 'DOCTYPE'
-  var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
-  var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
-  var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
-
-  // http://www.w3.org/TR/REC-xml/#NT-NameStartChar
-  // This implementation works on strings, a single character at a time
-  // as such, it cannot ever support astral-plane characters (10000-EFFFF)
-  // without a significant breaking change to either this  parser, or the
-  // JavaScript language.  Implementation of an emoji-capable xml parser
-  // is left as an exercise for the reader.
-  var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
-
-  var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
-
-  var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
-  var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
-
-  function isWhitespace (c) {
-    return c === ' ' || c === '\n' || c === '\r' || c === '\t'
-  }
-
-  function isQuote (c) {
-    return c === '"' || c === '\''
-  }
-
-  function isAttribEnd (c) {
-    return c === '>' || isWhitespace(c)
-  }
-
-  function isMatch (regex, c) {
-    return regex.test(c)
-  }
-
-  function notMatch (regex, c) {
-    return !isMatch(regex, c)
-  }
-
-  var S = 0
-  sax.STATE = {
-    BEGIN: S++, // leading byte order mark or whitespace
-    BEGIN_WHITESPACE: S++, // leading whitespace
-    TEXT: S++, // general stuff
-    TEXT_ENTITY: S++, // &amp and such.
-    OPEN_WAKA: S++, // <
-    SGML_DECL: S++, // <!BLARG
-    SGML_DECL_QUOTED: S++, // <!BLARG foo "bar
-    DOCTYPE: S++, // <!DOCTYPE
-    DOCTYPE_QUOTED: S++, // <!DOCTYPE "//blah
-    DOCTYPE_DTD: S++, // <!DOCTYPE "//blah" [ ...
-    DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE "//blah" [ "foo
-    COMMENT_STARTING: S++, // <!-
-    COMMENT: S++, // <!--
-    COMMENT_ENDING: S++, // <!-- blah -
-    COMMENT_ENDED: S++, // <!-- blah --
-    CDATA: S++, // <![CDATA[ something
-    CDATA_ENDING: S++, // ]
-    CDATA_ENDING_2: S++, // ]]
-    PROC_INST: S++, // <?hi
-    PROC_INST_BODY: S++, // <?hi there
-    PROC_INST_ENDING: S++, // <?hi "there" ?
-    OPEN_TAG: S++, // <strong
-    OPEN_TAG_SLASH: S++, // <strong /
-    ATTRIB: S++, // <a
-    ATTRIB_NAME: S++, // <a foo
-    ATTRIB_NAME_SAW_WHITE: S++, // <a foo _
-    ATTRIB_VALUE: S++, // <a foo=
-    ATTRIB_VALUE_QUOTED: S++, // <a foo="bar
-    ATTRIB_VALUE_CLOSED: S++, // <a foo="bar"
-    ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar
-    ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar="&quot;"
-    ATTRIB_VALUE_ENTITY_U: S++, // <foo bar=&quot
-    CLOSE_TAG: S++, // </a
-    CLOSE_TAG_SAW_WHITE: S++, // </a   >
-    SCRIPT: S++, // <script> ...
-    SCRIPT_ENDING: S++ // <script> ... <
-  }
-
-  sax.XML_ENTITIES = {
-    'amp': '&',
-    'gt': '>',
-    'lt': '<',
-    'quot': '"',
-    'apos': "'"
-  }
-
-  sax.ENTITIES = {
-    'amp': '&',
-    'gt': '>',
-    'lt': '<',
-    'quot': '"',
-    'apos': "'",
-    'AElig': 198,
-    'Aacute': 193,
-    'Acirc': 194,
-    'Agrave': 192,
-    'Aring': 197,
-    'Atilde': 195,
-    'Auml': 196,
-    'Ccedil': 199,
-    'ETH': 208,
-    'Eacute': 201,
-    'Ecirc': 202,
-    'Egrave': 200,
-    'Euml': 203,
-    'Iacute': 205,
-    'Icirc': 206,
-    'Igrave': 204,
-    'Iuml': 207,
-    'Ntilde': 209,
-    'Oacute': 211,
-    'Ocirc': 212,
-    'Ograve': 210,
-    'Oslash': 216,
-    'Otilde': 213,
-    'Ouml': 214,
-    'THORN': 222,
-    'Uacute': 218,
-    'Ucirc': 219,
-    'Ugrave': 217,
-    'Uuml': 220,
-    'Yacute': 221,
-    'aacute': 225,
-    'acirc': 226,
-    'aelig': 230,
-    'agrave': 224,
-    'aring': 229,
-    'atilde': 227,
-    'auml': 228,
-    'ccedil': 231,
-    'eacute': 233,
-    'ecirc': 234,
-    'egrave': 232,
-    'eth': 240,
-    'euml': 235,
-    'iacute': 237,
-    'icirc': 238,
-    'igrave': 236,
-    'iuml': 239,
-    'ntilde': 241,
-    'oacute': 243,
-    'ocirc': 244,
-    'ograve': 242,
-    'oslash': 248,
-    'otilde': 245,
-    'ouml': 246,
-    'szlig': 223,
-    'thorn': 254,
-    'uacute': 250,
-    'ucirc': 251,
-    'ugrave': 249,
-    'uuml': 252,
-    'yacute': 253,
-    'yuml': 255,
-    'copy': 169,
-    'reg': 174,
-    'nbsp': 160,
-    'iexcl': 161,
-    'cent': 162,
-    'pound': 163,
-    'curren': 164,
-    'yen': 165,
-    'brvbar': 166,
-    'sect': 167,
-    'uml': 168,
-    'ordf': 170,
-    'laquo': 171,
-    'not': 172,
-    'shy': 173,
-    'macr': 175,
-    'deg': 176,
-    'plusmn': 177,
-    'sup1': 185,
-    'sup2': 178,
-    'sup3': 179,
-    'acute': 180,
-    'micro': 181,
-    'para': 182,
-    'middot': 183,
-    'cedil': 184,
-    'ordm': 186,
-    'raquo': 187,
-    'frac14': 188,
-    'frac12': 189,
-    'frac34': 190,
-    'iquest': 191,
-    'times': 215,
-    'divide': 247,
-    'OElig': 338,
-    'oelig': 339,
-    'Scaron': 352,
-    'scaron': 353,
-    'Yuml': 376,
-    'fnof': 402,
-    'circ': 710,
-    'tilde': 732,
-    'Alpha': 913,
-    'Beta': 914,
-    'Gamma': 915,
-    'Delta': 916,
-    'Epsilon': 917,
-    'Zeta': 918,
-    'Eta': 919,
-    'Theta': 920,
-    'Iota': 921,
-    'Kappa': 922,
-    'Lambda': 923,
-    'Mu': 924,
-    'Nu': 925,
-    'Xi': 926,
-    'Omicron': 927,
-    'Pi': 928,
-    'Rho': 929,
-    'Sigma': 931,
-    'Tau': 932,
-    'Upsilon': 933,
-    'Phi': 934,
-    'Chi': 935,
-    'Psi': 936,
-    'Omega': 937,
-    'alpha': 945,
-    'beta': 946,
-    'gamma': 947,
-    'delta': 948,
-    'epsilon': 949,
-    'zeta': 950,
-    'eta': 951,
-    'theta': 952,
-    'iota': 953,
-    'kappa': 954,
-    'lambda': 955,
-    'mu': 956,
-    'nu': 957,
-    'xi': 958,
-    'omicron': 959,
-    'pi': 960,
-    'rho': 961,
-    'sigmaf': 962,
-    'sigma': 963,
-    'tau': 964,
-    'upsilon': 965,
-    'phi': 966,
-    'chi': 967,
-    'psi': 968,
-    'omega': 969,
-    'thetasym': 977,
-    'upsih': 978,
-    'piv': 982,
-    'ensp': 8194,
-    'emsp': 8195,
-    'thinsp': 8201,
-    'zwnj': 8204,
-    'zwj': 8205,
-    'lrm': 8206,
-    'rlm': 8207,
-    'ndash': 8211,
-    'mdash': 8212,
-    'lsquo': 8216,
-    'rsquo': 8217,
-    'sbquo': 8218,
-    'ldquo': 8220,
-    'rdquo': 8221,
-    'bdquo': 8222,
-    'dagger': 8224,
-    'Dagger': 8225,
-    'bull': 8226,
-    'hellip': 8230,
-    'permil': 8240,
-    'prime': 8242,
-    'Prime': 8243,
-    'lsaquo': 8249,
-    'rsaquo': 8250,
-    'oline': 8254,
-    'frasl': 8260,
-    'euro': 8364,
-    'image': 8465,
-    'weierp': 8472,
-    'real': 8476,
-    'trade': 8482,
-    'alefsym': 8501,
-    'larr': 8592,
-    'uarr': 8593,
-    'rarr': 8594,
-    'darr': 8595,
-    'harr': 8596,
-    'crarr': 8629,
-    'lArr': 8656,
-    'uArr': 8657,
-    'rArr': 8658,
-    'dArr': 8659,
-    'hArr': 8660,
-    'forall': 8704,
-    'part': 8706,
-    'exist': 8707,
-    'empty': 8709,
-    'nabla': 8711,
-    'isin': 8712,
-    'notin': 8713,
-    'ni': 8715,
-    'prod': 8719,
-    'sum': 8721,
-    'minus': 8722,
-    'lowast': 8727,
-    'radic': 8730,
-    'prop': 8733,
-    'infin': 8734,
-    'ang': 8736,
-    'and': 8743,
-    'or': 8744,
-    'cap': 8745,
-    'cup': 8746,
-    'int': 8747,
-    'there4': 8756,
-    'sim': 8764,
-    'cong': 8773,
-    'asymp': 8776,
-    'ne': 8800,
-    'equiv': 8801,
-    'le': 8804,
-    'ge': 8805,
-    'sub': 8834,
-    'sup': 8835,
-    'nsub': 8836,
-    'sube': 8838,
-    'supe': 8839,
-    'oplus': 8853,
-    'otimes': 8855,
-    'perp': 8869,
-    'sdot': 8901,
-    'lceil': 8968,
-    'rceil': 8969,
-    'lfloor': 8970,
-    'rfloor': 8971,
-    'lang': 9001,
-    'rang': 9002,
-    'loz': 9674,
-    'spades': 9824,
-    'clubs': 9827,
-    'hearts': 9829,
-    'diams': 9830
-  }
-
-  Object.keys(sax.ENTITIES).forEach(function (key) {
-    var e = sax.ENTITIES[key]
-    var s = typeof e === 'number' ? String.fromCharCode(e) : e
-    sax.ENTITIES[key] = s
-  })
-
-  for (var s in sax.STATE) {
-    sax.STATE[sax.STATE[s]] = s
-  }
-
-  // shorthand
-  S = sax.STATE
-
-  function emit (parser, event, data) {
-    parser[event] && parser[event](data)
-  }
-
-  function emitNode (parser, nodeType, data) {
-    if (parser.textNode) closeText(parser)
-    emit(parser, nodeType, data)
-  }
-
-  function closeText (parser) {
-    parser.textNode = textopts(parser.opt, parser.textNode)
-    if (parser.textNode) emit(parser, 'ontext', parser.textNode)
-    parser.textNode = ''
-  }
-
-  function textopts (opt, text) {
-    if (opt.trim) text = text.trim()
-    if (opt.normalize) text = text.replace(/\s+/g, ' ')
-    return text
-  }
-
-  function error (parser, er) {
-    closeText(parser)
-    if (parser.trackPosition) {
-      er += '\nLine: ' + parser.line +
-        '\nColumn: ' + parser.column +
-        '\nChar: ' + parser.c
-    }
-    er = new Error(er)
-    parser.error = er
-    emit(parser, 'onerror', er)
-    return parser
-  }
-
-  function end (parser) {
-    if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')
-    if ((parser.state !== S.BEGIN) &&
-      (parser.state !== S.BEGIN_WHITESPACE) &&
-      (parser.state !== S.TEXT)) {
-      error(parser, 'Unexpected end')
-    }
-    closeText(parser)
-    parser.c = ''
-    parser.closed = true
-    emit(parser, 'onend')
-    SAXParser.call(parser, parser.strict, parser.opt)
-    return parser
-  }
-
-  function strictFail (parser, message) {
-    if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {
-      throw new Error('bad call to strictFail')
-    }
-    if (parser.strict) {
-      error(parser, message)
-    }
-  }
-
-  function newTag (parser) {
-    if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
-    var parent = parser.tags[parser.tags.length - 1] || parser
-    var tag = parser.tag = { name: parser.tagName, attributes: {} }
-
-    // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
-    if (parser.opt.xmlns) {
-      tag.ns = parent.ns
-    }
-    parser.attribList.length = 0
-    emitNode(parser, 'onopentagstart', tag)
-  }
-
-  function qname (name, attribute) {
-    var i = name.indexOf(':')
-    var qualName = i < 0 ? [ '', name ] : name.split(':')
-    var prefix = qualName[0]
-    var local = qualName[1]
-
-    // <x "xmlns"="http://foo">
-    if (attribute && name === 'xmlns') {
-      prefix = 'xmlns'
-      local = ''
-    }
-
-    return { prefix: prefix, local: local }
-  }
-
-  function attrib (parser) {
-    if (!parser.strict) {
-      parser.attribName = parser.attribName[parser.looseCase]()
-    }
-
-    if (parser.attribList.indexOf(parser.attribName) !== -1 ||
-      parser.tag.attributes.hasOwnProperty(parser.attribName)) {
-      parser.attribName = parser.attribValue = ''
-      return
-    }
-
-    if (parser.opt.xmlns) {
-      var qn = qname(parser.attribName, true)
-      var prefix = qn.prefix
-      var local = qn.local
-
-      if (prefix === 'xmlns') {
-        // namespace binding attribute. push the binding into scope
-        if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
-          strictFail(parser,
-            'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' +
-            'Actual: ' + parser.attribValue)
-        } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
-          strictFail(parser,
-            'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' +
-            'Actual: ' + parser.attribValue)
-        } else {
-          var tag = parser.tag
-          var parent = parser.tags[parser.tags.length - 1] || parser
-          if (tag.ns === parent.ns) {
-            tag.ns = Object.create(parent.ns)
-          }
-          tag.ns[local] = parser.attribValue
-        }
-      }
-
-      // defer onattribute events until all attributes have been seen
-      // so any new bindings can take effect. preserve attribute order
-      // so deferred events can be emitted in document order
-      parser.attribList.push([parser.attribName, parser.attribValue])
-    } else {
-      // in non-xmlns mode, we can emit the event right away
-      parser.tag.attributes[parser.attribName] = parser.attribValue
-      emitNode(parser, 'onattribute', {
-        name: parser.attribName,
-        value: parser.attribValue
-      })
-    }
-
-    parser.attribName = parser.attribValue = ''
-  }
-
-  function openTag (parser, selfClosing) {
-    if (parser.opt.xmlns) {
-      // emit namespace binding events
-      var tag = parser.tag
-
-      // add namespace info to tag
-      var qn = qname(parser.tagName)
-      tag.prefix = qn.prefix
-      tag.local = qn.local
-      tag.uri = tag.ns[qn.prefix] || ''
-
-      if (tag.prefix && !tag.uri) {
-        strictFail(parser, 'Unbound namespace prefix: ' +
-          JSON.stringify(parser.tagName))
-        tag.uri = qn.prefix
-      }
-
-      var parent = parser.tags[parser.tags.length - 1] || parser
-      if (tag.ns && parent.ns !== tag.ns) {
-        Object.keys(tag.ns).forEach(function (p) {
-          emitNode(parser, 'onopennamespace', {
-            prefix: p,
-            uri: tag.ns[p]
-          })
-        })
-      }
-
-      // handle deferred onattribute events
-      // Note: do not apply default ns to attributes:
-      //   http://www.w3.org/TR/REC-xml-names/#defaulting
-      for (var i = 0, l = parser.attribList.length; i < l; i++) {
-        var nv = parser.attribList[i]
-        var name = nv[0]
-        var value = nv[1]
-        var qualName = qname(name, true)
-        var prefix = qualName.prefix
-        var local = qualName.local
-        var uri = prefix === '' ? '' : (tag.ns[prefix] || '')
-        var a = {
-          name: name,
-          value: value,
-          prefix: prefix,
-          local: local,
-          uri: uri
-        }
-
-        // if there's any attributes with an undefined namespace,
-        // then fail on them now.
-        if (prefix && prefix !== 'xmlns' && !uri) {
-          strictFail(parser, 'Unbound namespace prefix: ' +
-            JSON.stringify(prefix))
-          a.uri = prefix
-        }
-        parser.tag.attributes[name] = a
-        emitNode(parser, 'onattribute', a)
-      }
-      parser.attribList.length = 0
-    }
-
-    parser.tag.isSelfClosing = !!selfClosing
-
-    // process the tag
-    parser.sawRoot = true
-    parser.tags.push(parser.tag)
-    emitNode(parser, 'onopentag', parser.tag)
-    if (!selfClosing) {
-      // special case for <script> in non-strict mode.
-      if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
-        parser.state = S.SCRIPT
-      } else {
-        parser.state = S.TEXT
-      }
-      parser.tag = null
-      parser.tagName = ''
-    }
-    parser.attribName = parser.attribValue = ''
-    parser.attribList.length = 0
-  }
-
-  function closeTag (parser) {
-    if (!parser.tagName) {
-      strictFail(parser, 'Weird empty close tag.')
-      parser.textNode += '</>'
-      parser.state = S.TEXT
-      return
-    }
-
-    if (parser.script) {
-      if (parser.tagName !== 'script') {
-        parser.script += '</' + parser.tagName + '>'
-        parser.tagName = ''
-        parser.state = S.SCRIPT
-        return
-      }
-      emitNode(parser, 'onscript', parser.script)
-      parser.script = ''
-    }
-
-    // first make sure that the closing tag actually exists.
-    // <a><b></c></b></a> will close everything, otherwise.
-    var t = parser.tags.length
-    var tagName = parser.tagName
-    if (!parser.strict) {
-      tagName = tagName[parser.looseCase]()
-    }
-    var closeTo = tagName
-    while (t--) {
-      var close = parser.tags[t]
-      if (close.name !== closeTo) {
-        // fail the first time in strict mode
-        strictFail(parser, 'Unexpected close tag')
-      } else {
-        break
-      }
-    }
-
-    // didn't find it.  we already failed for strict, so just abort.
-    if (t < 0) {
-      strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)
-      parser.textNode += '</' + parser.tagName + '>'
-      parser.state = S.TEXT
-      return
-    }
-    parser.tagName = tagName
-    var s = parser.tags.length
-    while (s-- > t) {
-      var tag = parser.tag = parser.tags.pop()
-      parser.tagName = parser.tag.name
-      emitNode(parser, 'onclosetag', parser.tagName)
-
-      var x = {}
-      for (var i in tag.ns) {
-        x[i] = tag.ns[i]
-      }
-
-      var parent = parser.tags[parser.tags.length - 1] || parser
-      if (parser.opt.xmlns && tag.ns !== parent.ns) {
-        // remove namespace bindings introduced by tag
-        Object.keys(tag.ns).forEach(function (p) {
-          var n = tag.ns[p]
-          emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })
-        })
-      }
-    }
-    if (t === 0) parser.closedRoot = true
-    parser.tagName = parser.attribValue = parser.attribName = ''
-    parser.attribList.length = 0
-    parser.state = S.TEXT
-  }
-
-  function parseEntity (parser) {
-    var entity = parser.entity
-    var entityLC = entity.toLowerCase()
-    var num
-    var numStr = ''
-
-    if (parser.ENTITIES[entity]) {
-      return parser.ENTITIES[entity]
-    }
-    if (parser.ENTITIES[entityLC]) {
-      return parser.ENTITIES[entityLC]
-    }
-    entity = entityLC
-    if (entity.charAt(0) === '#') {
-      if (entity.charAt(1) === 'x') {
-        entity = entity.slice(2)
-        num = parseInt(entity, 16)
-        numStr = num.toString(16)
-      } else {
-        entity = entity.slice(1)
-        num = parseInt(entity, 10)
-        numStr = num.toString(10)
-      }
-    }
-    entity = entity.replace(/^0+/, '')
-    if (isNaN(num) || numStr.toLowerCase() !== entity) {
-      strictFail(parser, 'Invalid character entity')
-      return '&' + parser.entity + ';'
-    }
-
-    return String.fromCodePoint(num)
-  }
-
-  function beginWhiteSpace (parser, c) {
-    if (c === '<') {
-      parser.state = S.OPEN_WAKA
-      parser.startTagPosition = parser.position
-    } else if (!isWhitespace(c)) {
-      // have to process this as a text node.
-      // weird, but happens.
-      strictFail(parser, 'Non-whitespace before first tag.')
-      parser.textNode = c
-      parser.state = S.TEXT
-    }
-  }
-
-  function charAt (chunk, i) {
-    var result = ''
-    if (i < chunk.length) {
-      result = chunk.charAt(i)
-    }
-    return result
-  }
-
-  function write (chunk) {
-    var parser = this
-    if (this.error) {
-      throw this.error
-    }
-    if (parser.closed) {
-      return error(parser,
-        'Cannot write after close. Assign an onready handler.')
-    }
-    if (chunk === null) {
-      return end(parser)
-    }
-    if (typeof chunk === 'object') {
-      chunk = chunk.toString()
-    }
-    var i = 0
-    var c = ''
-    while (true) {
-      c = charAt(chunk, i++)
-      parser.c = c
-
-      if (!c) {
-        break
-      }
-
-      if (parser.trackPosition) {
-        parser.position++
-        if (c === '\n') {
-          parser.line++
-          parser.column = 0
-        } else {
-          parser.column++
-        }
-      }
-
-      switch (parser.state) {
-        case S.BEGIN:
-          parser.state = S.BEGIN_WHITESPACE
-          if (c === '\uFEFF') {
-            continue
-          }
-          beginWhiteSpace(parser, c)
-          continue
-
-        case S.BEGIN_WHITESPACE:
-          beginWhiteSpace(parser, c)
-          continue
-
-        case S.TEXT:
-          if (parser.sawRoot && !parser.closedRoot) {
-            var starti = i - 1
-            while (c && c !== '<' && c !== '&') {
-              c = charAt(chunk, i++)
-              if (c && parser.trackPosition) {
-                parser.position++
-                if (c === '\n') {
-                  parser.line++
-                  parser.column = 0
-                } else {
-                  parser.column++
-                }
-              }
-            }
-            parser.textNode += chunk.substring(starti, i - 1)
-          }
-          if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
-            parser.state = S.OPEN_WAKA
-            parser.startTagPosition = parser.position
-          } else {
-            if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
-              strictFail(parser, 'Text data outside of root node.')
-            }
-            if (c === '&') {
-              parser.state = S.TEXT_ENTITY
-            } else {
-              parser.textNode += c
-            }
-          }
-          continue
-
-        case S.SCRIPT:
-          // only non-strict
-          if (c === '<') {
-            parser.state = S.SCRIPT_ENDING
-          } else {
-            parser.script += c
-          }
-          continue
-
-        case S.SCRIPT_ENDING:
-          if (c === '/') {
-            parser.state = S.CLOSE_TAG
-          } else {
-            parser.script += '<' + c
-            parser.state = S.SCRIPT
-          }
-          continue
-
-        case S.OPEN_WAKA:
-          // either a /, ?, !, or text is coming next.
-          if (c === '!') {
-            parser.state = S.SGML_DECL
-            parser.sgmlDecl = ''
-          } else if (isWhitespace(c)) {
-            // wait for it...
-          } else if (isMatch(nameStart, c)) {
-            parser.state = S.OPEN_TAG
-            parser.tagName = c
-          } else if (c === '/') {
-            parser.state = S.CLOSE_TAG
-            parser.tagName = ''
-          } else if (c === '?') {
-            parser.state = S.PROC_INST
-            parser.procInstName = parser.procInstBody = ''
-          } else {
-            strictFail(parser, 'Unencoded <')
-            // if there was some whitespace, then add that in.
-            if (parser.startTagPosition + 1 < parser.position) {
-              var pad = parser.position - parser.startTagPosition
-              c = new Array(pad).join(' ') + c
-            }
-            parser.textNode += '<' + c
-            parser.state = S.TEXT
-          }
-          continue
-
-        case S.SGML_DECL:
-          if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
-            emitNode(parser, 'onopencdata')
-            parser.state = S.CDATA
-            parser.sgmlDecl = ''
-            parser.cdata = ''
-          } else if (parser.sgmlDecl + c === '--') {
-            parser.state = S.COMMENT
-            parser.comment = ''
-            parser.sgmlDecl = ''
-          } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
-            parser.state = S.DOCTYPE
-            if (parser.doctype || parser.sawRoot) {
-              strictFail(parser,
-                'Inappropriately located doctype declaration')
-            }
-            parser.doctype = ''
-            parser.sgmlDecl = ''
-          } else if (c === '>') {
-            emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
-            parser.sgmlDecl = ''
-            parser.state = S.TEXT
-          } else if (isQuote(c)) {
-            parser.state = S.SGML_DECL_QUOTED
-            parser.sgmlDecl += c
-          } else {
-            parser.sgmlDecl += c
-          }
-          continue
-
-        case S.SGML_DECL_QUOTED:
-          if (c === parser.q) {
-            parser.state = S.SGML_DECL
-            parser.q = ''
-          }
-          parser.sgmlDecl += c
-          continue
-
-        case S.DOCTYPE:
-          if (c === '>') {
-            parser.state = S.TEXT
-            emitNode(parser, 'ondoctype', parser.doctype)
-            parser.doctype = true // just remember that we saw it.
-          } else {
-            parser.doctype += c
-            if (c === '[') {
-              parser.state = S.DOCTYPE_DTD
-            } else if (isQuote(c)) {
-              parser.state = S.DOCTYPE_QUOTED
-              parser.q = c
-            }
-          }
-          continue
-
-        case S.DOCTYPE_QUOTED:
-          parser.doctype += c
-          if (c === parser.q) {
-            parser.q = ''
-            parser.state = S.DOCTYPE
-          }
-          continue
-
-        case S.DOCTYPE_DTD:
-          parser.doctype += c
-          if (c === ']') {
-            parser.state = S.DOCTYPE
-          } else if (isQuote(c)) {
-            parser.state = S.DOCTYPE_DTD_QUOTED
-            parser.q = c
-          }
-          continue
-
-        case S.DOCTYPE_DTD_QUOTED:
-          parser.doctype += c
-          if (c === parser.q) {
-            parser.state = S.DOCTYPE_DTD
-            parser.q = ''
-          }
-          continue
-
-        case S.COMMENT:
-          if (c === '-') {
-            parser.state = S.COMMENT_ENDING
-          } else {
-            parser.comment += c
-          }
-          continue
-
-        case S.COMMENT_ENDING:
-          if (c === '-') {
-            parser.state = S.COMMENT_ENDED
-            parser.comment = textopts(parser.opt, parser.comment)
-            if (parser.comment) {
-              emitNode(parser, 'oncomment', parser.comment)
-            }
-            parser.comment = ''
-          } else {
-            parser.comment += '-' + c
-            parser.state = S.COMMENT
-          }
-          continue
-
-        case S.COMMENT_ENDED:
-          if (c !== '>') {
-            strictFail(parser, 'Malformed comment')
-            // allow <!-- blah -- bloo --> in non-strict mode,
-            // which is a comment of " blah -- bloo "
-            parser.comment += '--' + c
-            parser.state = S.COMMENT
-          } else {
-            parser.state = S.TEXT
-          }
-          continue
-
-        case S.CDATA:
-          if (c === ']') {
-            parser.state = S.CDATA_ENDING
-          } else {
-            parser.cdata += c
-          }
-          continue
-
-        case S.CDATA_ENDING:
-          if (c === ']') {
-            parser.state = S.CDATA_ENDING_2
-          } else {
-            parser.cdata += ']' + c
-            parser.state = S.CDATA
-          }
-          continue
-
-        case S.CDATA_ENDING_2:
-          if (c === '>') {
-            if (parser.cdata) {
-              emitNode(parser, 'oncdata', parser.cdata)
-            }
-            emitNode(parser, 'onclosecdata')
-            parser.cdata = ''
-            parser.state = S.TEXT
-          } else if (c === ']') {
-            parser.cdata += ']'
-          } else {
-            parser.cdata += ']]' + c
-            parser.state = S.CDATA
-          }
-          continue
-
-        case S.PROC_INST:
-          if (c === '?') {
-            parser.state = S.PROC_INST_ENDING
-          } else if (isWhitespace(c)) {
-            parser.state = S.PROC_INST_BODY
-          } else {
-            parser.procInstName += c
-          }
-          continue
-
-        case S.PROC_INST_BODY:
-          if (!parser.procInstBody && isWhitespace(c)) {
-            continue
-          } else if (c === '?') {
-            parser.state = S.PROC_INST_ENDING
-          } else {
-            parser.procInstBody += c
-          }
-          continue
-
-        case S.PROC_INST_ENDING:
-          if (c === '>') {
-            emitNode(parser, 'onprocessinginstruction', {
-              name: parser.procInstName,
-              body: parser.procInstBody
-            })
-            parser.procInstName = parser.procInstBody = ''
-            parser.state = S.TEXT
-          } else {
-            parser.procInstBody += '?' + c
-            parser.state = S.PROC_INST_BODY
-          }
-          continue
-
-        case S.OPEN_TAG:
-          if (isMatch(nameBody, c)) {
-            parser.tagName += c
-          } else {
-            newTag(parser)
-            if (c === '>') {
-              openTag(parser)
-            } else if (c === '/') {
-              parser.state = S.OPEN_TAG_SLASH
-            } else {
-              if (!isWhitespace(c)) {
-                strictFail(parser, 'Invalid character in tag name')
-              }
-              parser.state = S.ATTRIB
-            }
-          }
-          continue
-
-        case S.OPEN_TAG_SLASH:
-          if (c === '>') {
-            openTag(parser, true)
-            closeTag(parser)
-          } else {
-            strictFail(parser, 'Forward-slash in opening tag not followed by >')
-            parser.state = S.ATTRIB
-          }
-          continue
-
-        case S.ATTRIB:
-          // haven't read the attribute name yet.
-          if (isWhitespace(c)) {
-            continue
-          } else if (c === '>') {
-            openTag(parser)
-          } else if (c === '/') {
-            parser.state = S.OPEN_TAG_SLASH
-          } else if (isMatch(nameStart, c)) {
-            parser.attribName = c
-            parser.attribValue = ''
-            parser.state = S.ATTRIB_NAME
-          } else {
-            strictFail(parser, 'Invalid attribute name')
-          }
-          continue
-
-        case S.ATTRIB_NAME:
-          if (c === '=') {
-            parser.state = S.ATTRIB_VALUE
-          } else if (c === '>') {
-            strictFail(parser, 'Attribute without value')
-            parser.attribValue = parser.attribName
-            attrib(parser)
-            openTag(parser)
-          } else if (isWhitespace(c)) {
-            parser.state = S.ATTRIB_NAME_SAW_WHITE
-          } else if (isMatch(nameBody, c)) {
-            parser.attribName += c
-          } else {
-            strictFail(parser, 'Invalid attribute name')
-          }
-          continue
-
-        case S.ATTRIB_NAME_SAW_WHITE:
-          if (c === '=') {
-            parser.state = S.ATTRIB_VALUE
-          } else if (isWhitespace(c)) {
-            continue
-          } else {
-            strictFail(parser, 'Attribute without value')
-            parser.tag.attributes[parser.attribName] = ''
-            parser.attribValue = ''
-            emitNode(parser, 'onattribute', {
-              name: parser.attribName,
-              value: ''
-            })
-            parser.attribName = ''
-            if (c === '>') {
-              openTag(parser)
-            } else if (isMatch(nameStart, c)) {
-              parser.attribName = c
-              parser.state = S.ATTRIB_NAME
-            } else {
-              strictFail(parser, 'Invalid attribute name')
-              parser.state = S.ATTRIB
-            }
-          }
-          continue
-
-        case S.ATTRIB_VALUE:
-          if (isWhitespace(c)) {
-            continue
-          } else if (isQuote(c)) {
-            parser.q = c
-            parser.state = S.ATTRIB_VALUE_QUOTED
-          } else {
-            strictFail(parser, 'Unquoted attribute value')
-            parser.state = S.ATTRIB_VALUE_UNQUOTED
-            parser.attribValue = c
-          }
-          continue
-
-        case S.ATTRIB_VALUE_QUOTED:
-          if (c !== parser.q) {
-            if (c === '&') {
-              parser.state = S.ATTRIB_VALUE_ENTITY_Q
-            } else {
-              parser.attribValue += c
-            }
-            continue
-          }
-          attrib(parser)
-          parser.q = ''
-          parser.state = S.ATTRIB_VALUE_CLOSED
-          continue
-
-        case S.ATTRIB_VALUE_CLOSED:
-          if (isWhitespace(c)) {
-            parser.state = S.ATTRIB
-          } else if (c === '>') {
-            openTag(parser)
-          } else if (c === '/') {
-            parser.state = S.OPEN_TAG_SLASH
-          } else if (isMatch(nameStart, c)) {
-            strictFail(parser, 'No whitespace between attributes')
-            parser.attribName = c
-            parser.attribValue = ''
-            parser.state = S.ATTRIB_NAME
-          } else {
-            strictFail(parser, 'Invalid attribute name')
-          }
-          continue
-
-        case S.ATTRIB_VALUE_UNQUOTED:
-          if (!isAttribEnd(c)) {
-            if (c === '&') {
-              parser.state = S.ATTRIB_VALUE_ENTITY_U
-            } else {
-              parser.attribValue += c
-            }
-            continue
-          }
-          attrib(parser)
-          if (c === '>') {
-            openTag(parser)
-          } else {
-            parser.state = S.ATTRIB
-          }
-          continue
-
-        case S.CLOSE_TAG:
-          if (!parser.tagName) {
-            if (isWhitespace(c)) {
-              continue
-            } else if (notMatch(nameStart, c)) {
-              if (parser.script) {
-                parser.script += '</' + c
-                parser.state = S.SCRIPT
-              } else {
-                strictFail(parser, 'Invalid tagname in closing tag.')
-              }
-            } else {
-              parser.tagName = c
-            }
-          } else if (c === '>') {
-            closeTag(parser)
-          } else if (isMatch(nameBody, c)) {
-            parser.tagName += c
-          } else if (parser.script) {
-            parser.script += '</' + parser.tagName
-            parser.tagName = ''
-            parser.state = S.SCRIPT
-          } else {
-            if (!isWhitespace(c)) {
-              strictFail(parser, 'Invalid tagname in closing tag')
-            }
-            parser.state = S.CLOSE_TAG_SAW_WHITE
-          }
-          continue
-
-        case S.CLOSE_TAG_SAW_WHITE:
-          if (isWhitespace(c)) {
-            continue
-          }
-          if (c === '>') {
-            closeTag(parser)
-          } else {
-            strictFail(parser, 'Invalid characters in closing tag')
-          }
-          continue
-
-        case S.TEXT_ENTITY:
-        case S.ATTRIB_VALUE_ENTITY_Q:
-        case S.ATTRIB_VALUE_ENTITY_U:
-          var returnState
-          var buffer
-          switch (parser.state) {
-            case S.TEXT_ENTITY:
-              returnState = S.TEXT
-              buffer = 'textNode'
-              break
-
-            case S.ATTRIB_VALUE_ENTITY_Q:
-              returnState = S.ATTRIB_VALUE_QUOTED
-              buffer = 'attribValue'
-              break
-
-            case S.ATTRIB_VALUE_ENTITY_U:
-              returnState = S.ATTRIB_VALUE_UNQUOTED
-              buffer = 'attribValue'
-              break
-          }
-
-          if (c === ';') {
-            parser[buffer] += parseEntity(parser)
-            parser.entity = ''
-            parser.state = returnState
-          } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
-            parser.entity += c
-          } else {
-            strictFail(parser, 'Invalid character in entity name')
-            parser[buffer] += '&' + parser.entity + c
-            parser.entity = ''
-            parser.state = returnState
-          }
-
-          continue
-
-        default:
-          throw new Error(parser, 'Unknown state: ' + parser.state)
-      }
-    } // while
-
-    if (parser.position >= parser.bufferCheckPosition) {
-      checkBufferLength(parser)
-    }
-    return parser
-  }
-
-  /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
-  /* istanbul ignore next */
-  if (!String.fromCodePoint) {
-    (function () {
-      var stringFromCharCode = String.fromCharCode
-      var floor = Math.floor
-      var fromCodePoint = function () {
-        var MAX_SIZE = 0x4000
-        var codeUnits = []
-        var highSurrogate
-        var lowSurrogate
-        var index = -1
-        var length = arguments.length
-        if (!length) {
-          return ''
-        }
-        var result = ''
-        while (++index < length) {
-          var codePoint = Number(arguments[index])
-          if (
-            !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
-            codePoint < 0 || // not a valid Unicode code point
-            codePoint > 0x10FFFF || // not a valid Unicode code point
-            floor(codePoint) !== codePoint // not an integer
-          ) {
-            throw RangeError('Invalid code point: ' + codePoint)
-          }
-          if (codePoint <= 0xFFFF) { // BMP code point
-            codeUnits.push(codePoint)
-          } else { // Astral code point; split in surrogate halves
-            // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
-            codePoint -= 0x10000
-            highSurrogate = (codePoint >> 10) + 0xD800
-            lowSurrogate = (codePoint % 0x400) + 0xDC00
-            codeUnits.push(highSurrogate, lowSurrogate)
-          }
-          if (index + 1 === length || codeUnits.length > MAX_SIZE) {
-            result += stringFromCharCode.apply(null, codeUnits)
-            codeUnits.length = 0
-          }
-        }
-        return result
-      }
-      /* istanbul ignore next */
-      if (Object.defineProperty) {
-        Object.defineProperty(String, 'fromCodePoint', {
-          value: fromCodePoint,
-          configurable: true,
-          writable: true
-        })
-      } else {
-        String.fromCodePoint = fromCodePoint
-      }
-    }())
-  }
-})(typeof exports === 'undefined' ? this.sax = {} : exports)
diff --git a/legacy-libs/grpc/node_modules/sax/package.json b/legacy-libs/grpc/node_modules/sax/package.json
deleted file mode 100644 (file)
index 9d32b4e..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-{
-  "_args": [
-    [
-      "sax@1.2.4",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "sax@1.2.4",
-  "_id": "sax@1.2.4",
-  "_inBundle": false,
-  "_integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
-  "_location": "/grpc/sax",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "sax@1.2.4",
-    "name": "sax",
-    "escapedName": "sax",
-    "rawSpec": "1.2.4",
-    "saveSpec": null,
-    "fetchSpec": "1.2.4"
-  },
-  "_requiredBy": [
-    "/grpc/needle"
-  ],
-  "_resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.2.4",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/sax-js/issues"
-  },
-  "dependencies": {},
-  "description": "An evented streaming XML parser in JavaScript",
-  "devDependencies": {
-    "standard": "^8.6.0",
-    "tap": "^10.5.1"
-  },
-  "files": [
-    "lib/sax.js",
-    "LICENSE",
-    "README.md"
-  ],
-  "homepage": "https://github.com/isaacs/sax-js#readme",
-  "license": "ISC",
-  "main": "lib/sax.js",
-  "name": "sax",
-  "optionalDependencies": {},
-  "readme": "# sax js\n\nA sax-style parser for XML and HTML.\n\nDesigned with [node](http://nodejs.org/) in mind, but should work fine in\nthe browser or other CommonJS implementations.\n\n## What This Is\n\n* A very simple tool to parse through an XML string.\n* A stepping stone to a streaming HTML parser.\n* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML\n  docs.\n\n## What This Is (probably) Not\n\n* An HTML Parser - That's a fine goal, but this isn't it.  It's just\n  XML.\n* A DOM Builder - You can use it to build an object model out of XML,\n  but it doesn't do that out of the box.\n* XSLT - No DOM = no querying.\n* 100% Compliant with (some other SAX implementation) - Most SAX\n  implementations are in Java and do a lot more than this does.\n* An XML Validator - It does a little validation when in strict mode, but\n  not much.\n* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic\n  masochism.\n* A DTD-aware Thing - Fetching DTDs is a much bigger job.\n\n## Regarding `<!DOCTYPE`s and `<!ENTITY`s\n\nThe parser will handle the basic XML entities in text nodes and attribute\nvalues: `&amp; &lt; &gt; &apos; &quot;`. It's possible to define additional\nentities in XML by putting them in the DTD. This parser doesn't do anything\nwith that. If you want to listen to the `ondoctype` event, and then fetch\nthe doctypes, and read the entities and add them to `parser.ENTITIES`, then\nbe my guest.\n\nUnknown entities will fail in strict mode, and in loose mode, will pass\nthrough unmolested.\n\n## Usage\n\n```javascript\nvar sax = require(\"./lib/sax\"),\n  strict = true, // set to false for html-mode\n  parser = sax.parser(strict);\n\nparser.onerror = function (e) {\n  // an error happened.\n};\nparser.ontext = function (t) {\n  // got some text.  t is the string of text.\n};\nparser.onopentag = function (node) {\n  // opened a tag.  node has \"name\" and \"attributes\"\n};\nparser.onattribute = function (attr) {\n  // an attribute.  attr has \"name\" and \"value\"\n};\nparser.onend = function () {\n  // parser stream is done, and ready to have more stuff written to it.\n};\n\nparser.write('<xml>Hello, <who name=\"world\">world</who>!</xml>').close();\n\n// stream usage\n// takes the same options as the parser\nvar saxStream = require(\"sax\").createStream(strict, options)\nsaxStream.on(\"error\", function (e) {\n  // unhandled errors will throw, since this is a proper node\n  // event emitter.\n  console.error(\"error!\", e)\n  // clear the error\n  this._parser.error = null\n  this._parser.resume()\n})\nsaxStream.on(\"opentag\", function (node) {\n  // same object as above\n})\n// pipe is supported, and it's readable/writable\n// same chunks coming in also go out.\nfs.createReadStream(\"file.xml\")\n  .pipe(saxStream)\n  .pipe(fs.createWriteStream(\"file-copy.xml\"))\n```\n\n\n## Arguments\n\nPass the following arguments to the parser function.  All are optional.\n\n`strict` - Boolean. Whether or not to be a jerk. Default: `false`.\n\n`opt` - Object bag of settings regarding string formatting.  All default to `false`.\n\nSettings supported:\n\n* `trim` - Boolean. Whether or not to trim text and comment nodes.\n* `normalize` - Boolean. If true, then turn any whitespace into a single\n  space.\n* `lowercase` - Boolean. If true, then lowercase tag names and attribute names\n  in loose mode, rather than uppercasing them.\n* `xmlns` - Boolean. If true, then namespaces are supported.\n* `position` - Boolean. If false, then don't track line/col/position.\n* `strictEntities` - Boolean. If true, only parse [predefined XML\n  entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent)\n  (`&amp;`, `&apos;`, `&gt;`, `&lt;`, and `&quot;`)\n\n## Methods\n\n`write` - Write bytes onto the stream. You don't have to do this all at\nonce. You can keep writing as much as you want.\n\n`close` - Close the stream. Once closed, no more data may be written until\nit is done processing the buffer, which is signaled by the `end` event.\n\n`resume` - To gracefully handle errors, assign a listener to the `error`\nevent. Then, when the error is taken care of, you can call `resume` to\ncontinue parsing. Otherwise, the parser will not continue while in an error\nstate.\n\n## Members\n\nAt all times, the parser object will have the following members:\n\n`line`, `column`, `position` - Indications of the position in the XML\ndocument where the parser currently is looking.\n\n`startTagPosition` - Indicates the position where the current tag starts.\n\n`closed` - Boolean indicating whether or not the parser can be written to.\nIf it's `true`, then wait for the `ready` event to write again.\n\n`strict` - Boolean indicating whether or not the parser is a jerk.\n\n`opt` - Any options passed into the constructor.\n\n`tag` - The current tag being dealt with.\n\nAnd a bunch of other stuff that you probably shouldn't touch.\n\n## Events\n\nAll events emit with a single argument. To listen to an event, assign a\nfunction to `on<eventname>`. Functions get executed in the this-context of\nthe parser object. The list of supported events are also in the exported\n`EVENTS` array.\n\nWhen using the stream interface, assign handlers using the EventEmitter\n`on` function in the normal fashion.\n\n`error` - Indication that something bad happened. The error will be hanging\nout on `parser.error`, and must be deleted before parsing can continue. By\nlistening to this event, you can keep an eye on that kind of stuff. Note:\nthis happens *much* more in strict mode. Argument: instance of `Error`.\n\n`text` - Text node. Argument: string of text.\n\n`doctype` - The `<!DOCTYPE` declaration. Argument: doctype string.\n\n`processinginstruction` - Stuff like `<?xml foo=\"blerg\" ?>`. Argument:\nobject with `name` and `body` members. Attributes are not parsed, as\nprocessing instructions have implementation dependent semantics.\n\n`sgmldeclaration` - Random SGML declarations. Stuff like `<!ENTITY p>`\nwould trigger this kind of event. This is a weird thing to support, so it\nmight go away at some point. SAX isn't intended to be used to parse SGML,\nafter all.\n\n`opentagstart` - Emitted immediately when the tag name is available,\nbut before any attributes are encountered.  Argument: object with a\n`name` field and an empty `attributes` set.  Note that this is the\nsame object that will later be emitted in the `opentag` event.\n\n`opentag` - An opening tag. Argument: object with `name` and `attributes`.\nIn non-strict mode, tag names are uppercased, unless the `lowercase`\noption is set.  If the `xmlns` option is set, then it will contain\nnamespace binding information on the `ns` member, and will have a\n`local`, `prefix`, and `uri` member.\n\n`closetag` - A closing tag. In loose mode, tags are auto-closed if their\nparent closes. In strict mode, well-formedness is enforced. Note that\nself-closing tags will have `closeTag` emitted immediately after `openTag`.\nArgument: tag name.\n\n`attribute` - An attribute node.  Argument: object with `name` and `value`.\nIn non-strict mode, attribute names are uppercased, unless the `lowercase`\noption is set.  If the `xmlns` option is set, it will also contains namespace\ninformation.\n\n`comment` - A comment node.  Argument: the string of the comment.\n\n`opencdata` - The opening tag of a `<![CDATA[` block.\n\n`cdata` - The text of a `<![CDATA[` block. Since `<![CDATA[` blocks can get\nquite large, this event may fire multiple times for a single block, if it\nis broken up into multiple `write()`s. Argument: the string of random\ncharacter data.\n\n`closecdata` - The closing tag (`]]>`) of a `<![CDATA[` block.\n\n`opennamespace` - If the `xmlns` option is set, then this event will\nsignal the start of a new namespace binding.\n\n`closenamespace` - If the `xmlns` option is set, then this event will\nsignal the end of a namespace binding.\n\n`end` - Indication that the closed stream has ended.\n\n`ready` - Indication that the stream has reset, and is ready to be written\nto.\n\n`noscript` - In non-strict mode, `<script>` tags trigger a `\"script\"`\nevent, and their contents are not checked for special xml characters.\nIf you pass `noscript: true`, then this behavior is suppressed.\n\n## Reporting Problems\n\nIt's best to write a failing test if you find an issue.  I will always\naccept pull requests with failing tests if they demonstrate intended\nbehavior, but it is very hard to figure out what issue you're describing\nwithout a test.  Writing a test is also the best way for you yourself\nto figure out if you really understand the issue you think you have with\nsax-js.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/isaacs/sax-js.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "posttest": "standard -F test/*.js lib/*.js",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --cov -j4"
-  },
-  "version": "1.2.4"
-}
diff --git a/legacy-libs/grpc/node_modules/semver/CHANGELOG.md b/legacy-libs/grpc/node_modules/semver/CHANGELOG.md
deleted file mode 100644 (file)
index 66304fd..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# changes log
-
-## 5.7
-
-* Add `minVersion` method
-
-## 5.6
-
-* Move boolean `loose` param to an options object, with
-  backwards-compatibility protection.
-* Add ability to opt out of special prerelease version handling with
-  the `includePrerelease` option flag.
-
-## 5.5
-
-* Add version coercion capabilities
-
-## 5.4
-
-* Add intersection checking
-
-## 5.3
-
-* Add `minSatisfying` method
-
-## 5.2
-
-* Add `prerelease(v)` that returns prerelease components
-
-## 5.1
-
-* Add Backus-Naur for ranges
-* Remove excessively cute inspection methods
-
-## 5.0
-
-* Remove AMD/Browserified build artifacts
-* Fix ltr and gtr when using the `*` range
-* Fix for range `*` with a prerelease identifier
diff --git a/legacy-libs/grpc/node_modules/semver/LICENSE b/legacy-libs/grpc/node_modules/semver/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/semver/README.md b/legacy-libs/grpc/node_modules/semver/README.md
deleted file mode 100644 (file)
index e5ccece..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-semver(1) -- The semantic versioner for npm
-===========================================
-
-## Install
-
-```bash
-npm install --save semver
-````
-
-## Usage
-
-As a node module:
-
-```js
-const semver = require('semver')
-
-semver.valid('1.2.3') // '1.2.3'
-semver.valid('a.b.c') // null
-semver.clean('  =v1.2.3   ') // '1.2.3'
-semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
-semver.gt('1.2.3', '9.8.7') // false
-semver.lt('1.2.3', '9.8.7') // true
-semver.minVersion('>=1.0.0') // '1.0.0'
-semver.valid(semver.coerce('v2')) // '2.0.0'
-semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
-```
-
-As a command-line utility:
-
-```
-$ semver -h
-
-A JavaScript implementation of the https://semver.org/ specification
-Copyright Isaac Z. Schlueter
-
-Usage: semver [options] <version> [<version> [...]]
-Prints valid versions sorted by SemVer precedence
-
-Options:
--r --range <range>
-        Print versions that match the specified range.
-
--i --increment [<level>]
-        Increment a version by the specified level.  Level can
-        be one of: major, minor, patch, premajor, preminor,
-        prepatch, or prerelease.  Default level is 'patch'.
-        Only one version may be specified.
-
---preid <identifier>
-        Identifier to be used to prefix premajor, preminor,
-        prepatch or prerelease version increments.
-
--l --loose
-        Interpret versions and ranges loosely
-
--p --include-prerelease
-        Always include prerelease versions in range matching
-
--c --coerce
-        Coerce a string into SemVer if possible
-        (does not imply --loose)
-
-Program exits successfully if any valid version satisfies
-all supplied ranges, and prints all satisfying versions.
-
-If no satisfying versions are found, then exits failure.
-
-Versions are printed in ascending order, so supplying
-multiple versions to the utility will just sort them.
-```
-
-## Versions
-
-A "version" is described by the `v2.0.0` specification found at
-<https://semver.org/>.
-
-A leading `"="` or `"v"` character is stripped off and ignored.
-
-## Ranges
-
-A `version range` is a set of `comparators` which specify versions
-that satisfy the range.
-
-A `comparator` is composed of an `operator` and a `version`.  The set
-of primitive `operators` is:
-
-* `<` Less than
-* `<=` Less than or equal to
-* `>` Greater than
-* `>=` Greater than or equal to
-* `=` Equal.  If no operator is specified, then equality is assumed,
-  so this operator is optional, but MAY be included.
-
-For example, the comparator `>=1.2.7` would match the versions
-`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
-or `1.1.0`.
-
-Comparators can be joined by whitespace to form a `comparator set`,
-which is satisfied by the **intersection** of all of the comparators
-it includes.
-
-A range is composed of one or more comparator sets, joined by `||`.  A
-version matches a range if and only if every comparator in at least
-one of the `||`-separated comparator sets is satisfied by the version.
-
-For example, the range `>=1.2.7 <1.3.0` would match the versions
-`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
-or `1.1.0`.
-
-The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
-`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
-
-### Prerelease Tags
-
-If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
-it will only be allowed to satisfy comparator sets if at least one
-comparator with the same `[major, minor, patch]` tuple also has a
-prerelease tag.
-
-For example, the range `>1.2.3-alpha.3` would be allowed to match the
-version `1.2.3-alpha.7`, but it would *not* be satisfied by
-`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
-than" `1.2.3-alpha.3` according to the SemVer sort rules.  The version
-range only accepts prerelease tags on the `1.2.3` version.  The
-version `3.4.5` *would* satisfy the range, because it does not have a
-prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
-
-The purpose for this behavior is twofold.  First, prerelease versions
-frequently are updated very quickly, and contain many breaking changes
-that are (by the author's design) not yet fit for public consumption.
-Therefore, by default, they are excluded from range matching
-semantics.
-
-Second, a user who has opted into using a prerelease version has
-clearly indicated the intent to use *that specific* set of
-alpha/beta/rc versions.  By including a prerelease tag in the range,
-the user is indicating that they are aware of the risk.  However, it
-is still not appropriate to assume that they have opted into taking a
-similar risk on the *next* set of prerelease versions.
-
-Note that this behavior can be suppressed (treating all prerelease
-versions as if they were normal versions, for the purpose of range
-matching) by setting the `includePrerelease` flag on the options
-object to any
-[functions](https://github.com/npm/node-semver#functions) that do
-range matching.
-
-#### Prerelease Identifiers
-
-The method `.inc` takes an additional `identifier` string argument that
-will append the value of the string as a prerelease identifier:
-
-```javascript
-semver.inc('1.2.3', 'prerelease', 'beta')
-// '1.2.4-beta.0'
-```
-
-command-line example:
-
-```bash
-$ semver 1.2.3 -i prerelease --preid beta
-1.2.4-beta.0
-```
-
-Which then can be used to increment further:
-
-```bash
-$ semver 1.2.4-beta.0 -i prerelease
-1.2.4-beta.1
-```
-
-### Advanced Range Syntax
-
-Advanced range syntax desugars to primitive comparators in
-deterministic ways.
-
-Advanced ranges may be combined in the same way as primitive
-comparators using white space or `||`.
-
-#### Hyphen Ranges `X.Y.Z - A.B.C`
-
-Specifies an inclusive set.
-
-* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
-
-If a partial version is provided as the first version in the inclusive
-range, then the missing pieces are replaced with zeroes.
-
-* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
-
-If a partial version is provided as the second version in the
-inclusive range, then all versions that start with the supplied parts
-of the tuple are accepted, but nothing that would be greater than the
-provided tuple parts.
-
-* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
-* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
-
-#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
-
-Any of `X`, `x`, or `*` may be used to "stand in" for one of the
-numeric values in the `[major, minor, patch]` tuple.
-
-* `*` := `>=0.0.0` (Any version satisfies)
-* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
-* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
-
-A partial version range is treated as an X-Range, so the special
-character is in fact optional.
-
-* `""` (empty string) := `*` := `>=0.0.0`
-* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
-* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
-
-#### Tilde Ranges `~1.2.3` `~1.2` `~1`
-
-Allows patch-level changes if a minor version is specified on the
-comparator.  Allows minor-level changes if not.
-
-* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
-* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
-* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
-* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
-* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
-* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
-* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
-  the `1.2.3` version will be allowed, if they are greater than or
-  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but
-  `1.2.4-beta.2` would not, because it is a prerelease of a
-  different `[major, minor, patch]` tuple.
-
-#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
-
-Allows changes that do not modify the left-most non-zero digit in the
-`[major, minor, patch]` tuple.  In other words, this allows patch and
-minor updates for versions `1.0.0` and above, patch updates for
-versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
-
-Many authors treat a `0.x` version as if the `x` were the major
-"breaking-change" indicator.
-
-Caret ranges are ideal when an author may make breaking changes
-between `0.2.4` and `0.3.0` releases, which is a common practice.
-However, it presumes that there will *not* be breaking changes between
-`0.2.4` and `0.2.5`.  It allows for changes that are presumed to be
-additive (but non-breaking), according to commonly observed practices.
-
-* `^1.2.3` := `>=1.2.3 <2.0.0`
-* `^0.2.3` := `>=0.2.3 <0.3.0`
-* `^0.0.3` := `>=0.0.3 <0.0.4`
-* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
-  the `1.2.3` version will be allowed, if they are greater than or
-  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but
-  `1.2.4-beta.2` would not, because it is a prerelease of a
-  different `[major, minor, patch]` tuple.
-* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4`  Note that prereleases in the
-  `0.0.3` version *only* will be allowed, if they are greater than or
-  equal to `beta`.  So, `0.0.3-pr.2` would be allowed.
-
-When parsing caret ranges, a missing `patch` value desugars to the
-number `0`, but will allow flexibility within that value, even if the
-major and minor versions are both `0`.
-
-* `^1.2.x` := `>=1.2.0 <2.0.0`
-* `^0.0.x` := `>=0.0.0 <0.1.0`
-* `^0.0` := `>=0.0.0 <0.1.0`
-
-A missing `minor` and `patch` values will desugar to zero, but also
-allow flexibility within those values, even if the major version is
-zero.
-
-* `^1.x` := `>=1.0.0 <2.0.0`
-* `^0.x` := `>=0.0.0 <1.0.0`
-
-### Range Grammar
-
-Putting all this together, here is a Backus-Naur grammar for ranges,
-for the benefit of parser authors:
-
-```bnf
-range-set  ::= range ( logical-or range ) *
-logical-or ::= ( ' ' ) * '||' ( ' ' ) *
-range      ::= hyphen | simple ( ' ' simple ) * | ''
-hyphen     ::= partial ' - ' partial
-simple     ::= primitive | partial | tilde | caret
-primitive  ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
-partial    ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
-xr         ::= 'x' | 'X' | '*' | nr
-nr         ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
-tilde      ::= '~' partial
-caret      ::= '^' partial
-qualifier  ::= ( '-' pre )? ( '+' build )?
-pre        ::= parts
-build      ::= parts
-parts      ::= part ( '.' part ) *
-part       ::= nr | [-0-9A-Za-z]+
-```
-
-## Functions
-
-All methods and classes take a final `options` object argument.  All
-options in this object are `false` by default.  The options supported
-are:
-
-- `loose`  Be more forgiving about not-quite-valid semver strings.
-  (Any resulting output will always be 100% strict compliant, of
-  course.)  For backwards compatibility reasons, if the `options`
-  argument is a boolean value instead of an object, it is interpreted
-  to be the `loose` param.
-- `includePrerelease`  Set to suppress the [default
-  behavior](https://github.com/npm/node-semver#prerelease-tags) of
-  excluding prerelease tagged versions from ranges unless they are
-  explicitly opted into.
-
-Strict-mode Comparators and Ranges will be strict about the SemVer
-strings that they parse.
-
-* `valid(v)`: Return the parsed version, or null if it's not valid.
-* `inc(v, release)`: Return the version incremented by the release
-  type (`major`,   `premajor`, `minor`, `preminor`, `patch`,
-  `prepatch`, or `prerelease`), or null if it's not valid
-  * `premajor` in one call will bump the version up to the next major
-    version and down to a prerelease of that major version.
-    `preminor`, and `prepatch` work the same way.
-  * If called from a non-prerelease version, the `prerelease` will work the
-    same as `prepatch`. It increments the patch version, then makes a
-    prerelease. If the input version is already a prerelease it simply
-    increments it.
-* `prerelease(v)`: Returns an array of prerelease components, or null
-  if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
-* `major(v)`: Return the major version number.
-* `minor(v)`: Return the minor version number.
-* `patch(v)`: Return the patch version number.
-* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
-  or comparators intersect.
-* `parse(v)`: Attempt to parse a string as a semantic version, returning either
-  a `SemVer` object or `null`.
-
-### Comparison
-
-* `gt(v1, v2)`: `v1 > v2`
-* `gte(v1, v2)`: `v1 >= v2`
-* `lt(v1, v2)`: `v1 < v2`
-* `lte(v1, v2)`: `v1 <= v2`
-* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
-  even if they're not the exact same string.  You already know how to
-  compare strings.
-* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
-* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
-  the corresponding function above.  `"==="` and `"!=="` do simple
-  string comparison, but are included for completeness.  Throws if an
-  invalid comparison string is provided.
-* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
-  `v2` is greater.  Sorts in ascending order if passed to `Array.sort()`.
-* `rcompare(v1, v2)`: The reverse of compare.  Sorts an array of versions
-  in descending order when passed to `Array.sort()`.
-* `diff(v1, v2)`: Returns difference between two versions by the release type
-  (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
-  or null if the versions are the same.
-
-### Comparators
-
-* `intersects(comparator)`: Return true if the comparators intersect
-
-### Ranges
-
-* `validRange(range)`: Return the valid range or null if it's not valid
-* `satisfies(version, range)`: Return true if the version satisfies the
-  range.
-* `maxSatisfying(versions, range)`: Return the highest version in the list
-  that satisfies the range, or `null` if none of them do.
-* `minSatisfying(versions, range)`: Return the lowest version in the list
-  that satisfies the range, or `null` if none of them do.
-* `minVersion(range)`: Return the lowest version that can possibly match
-  the given range.
-* `gtr(version, range)`: Return `true` if version is greater than all the
-  versions possible in the range.
-* `ltr(version, range)`: Return `true` if version is less than all the
-  versions possible in the range.
-* `outside(version, range, hilo)`: Return true if the version is outside
-  the bounds of the range in either the high or low direction.  The
-  `hilo` argument must be either the string `'>'` or `'<'`.  (This is
-  the function called by `gtr` and `ltr`.)
-* `intersects(range)`: Return true if any of the ranges comparators intersect
-
-Note that, since ranges may be non-contiguous, a version might not be
-greater than a range, less than a range, *or* satisfy a range!  For
-example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
-until `2.0.0`, so the version `1.2.10` would not be greater than the
-range (because `2.0.1` satisfies, which is higher), nor less than the
-range (since `1.2.8` satisfies, which is lower), and it also does not
-satisfy the range.
-
-If you want to know if a version satisfies or does not satisfy a
-range, use the `satisfies(version, range)` function.
-
-### Coercion
-
-* `coerce(version)`: Coerces a string to semver if possible
-
-This aims to provide a very forgiving translation of a non-semver
-string to semver. It looks for the first digit in a string, and
-consumes all remaining characters which satisfy at least a partial semver
-(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).
-Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
-All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).
-Only text which lacks digits will fail coercion (`version one` is not valid).
-The maximum  length for any semver component considered for coercion is 16 characters;
-longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).
-The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
-higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
diff --git a/legacy-libs/grpc/node_modules/semver/bin/semver b/legacy-libs/grpc/node_modules/semver/bin/semver
deleted file mode 100644 (file)
index 801e77f..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env node
-// Standalone semver comparison program.
-// Exits successfully and prints matching version(s) if
-// any supplied version is valid and passes all tests.
-
-var argv = process.argv.slice(2)
-
-var versions = []
-
-var range = []
-
-var inc = null
-
-var version = require('../package.json').version
-
-var loose = false
-
-var includePrerelease = false
-
-var coerce = false
-
-var identifier
-
-var semver = require('../semver')
-
-var reverse = false
-
-var options = {}
-
-main()
-
-function main () {
-  if (!argv.length) return help()
-  while (argv.length) {
-    var a = argv.shift()
-    var indexOfEqualSign = a.indexOf('=')
-    if (indexOfEqualSign !== -1) {
-      a = a.slice(0, indexOfEqualSign)
-      argv.unshift(a.slice(indexOfEqualSign + 1))
-    }
-    switch (a) {
-      case '-rv': case '-rev': case '--rev': case '--reverse':
-        reverse = true
-        break
-      case '-l': case '--loose':
-        loose = true
-        break
-      case '-p': case '--include-prerelease':
-        includePrerelease = true
-        break
-      case '-v': case '--version':
-        versions.push(argv.shift())
-        break
-      case '-i': case '--inc': case '--increment':
-        switch (argv[0]) {
-          case 'major': case 'minor': case 'patch': case 'prerelease':
-          case 'premajor': case 'preminor': case 'prepatch':
-            inc = argv.shift()
-            break
-          default:
-            inc = 'patch'
-            break
-        }
-        break
-      case '--preid':
-        identifier = argv.shift()
-        break
-      case '-r': case '--range':
-        range.push(argv.shift())
-        break
-      case '-c': case '--coerce':
-        coerce = true
-        break
-      case '-h': case '--help': case '-?':
-        return help()
-      default:
-        versions.push(a)
-        break
-    }
-  }
-
-  var options = { loose: loose, includePrerelease: includePrerelease }
-
-  versions = versions.map(function (v) {
-    return coerce ? (semver.coerce(v) || { version: v }).version : v
-  }).filter(function (v) {
-    return semver.valid(v)
-  })
-  if (!versions.length) return fail()
-  if (inc && (versions.length !== 1 || range.length)) { return failInc() }
-
-  for (var i = 0, l = range.length; i < l; i++) {
-    versions = versions.filter(function (v) {
-      return semver.satisfies(v, range[i], options)
-    })
-    if (!versions.length) return fail()
-  }
-  return success(versions)
-}
-
-function failInc () {
-  console.error('--inc can only be used on a single version with no range')
-  fail()
-}
-
-function fail () { process.exit(1) }
-
-function success () {
-  var compare = reverse ? 'rcompare' : 'compare'
-  versions.sort(function (a, b) {
-    return semver[compare](a, b, options)
-  }).map(function (v) {
-    return semver.clean(v, options)
-  }).map(function (v) {
-    return inc ? semver.inc(v, inc, options, identifier) : v
-  }).forEach(function (v, i, _) { console.log(v) })
-}
-
-function help () {
-  console.log(['SemVer ' + version,
-    '',
-    'A JavaScript implementation of the https://semver.org/ specification',
-    'Copyright Isaac Z. Schlueter',
-    '',
-    'Usage: semver [options] <version> [<version> [...]]',
-    'Prints valid versions sorted by SemVer precedence',
-    '',
-    'Options:',
-    '-r --range <range>',
-    '        Print versions that match the specified range.',
-    '',
-    '-i --increment [<level>]',
-    '        Increment a version by the specified level.  Level can',
-    '        be one of: major, minor, patch, premajor, preminor,',
-    "        prepatch, or prerelease.  Default level is 'patch'.",
-    '        Only one version may be specified.',
-    '',
-    '--preid <identifier>',
-    '        Identifier to be used to prefix premajor, preminor,',
-    '        prepatch or prerelease version increments.',
-    '',
-    '-l --loose',
-    '        Interpret versions and ranges loosely',
-    '',
-    '-p --include-prerelease',
-    '        Always include prerelease versions in range matching',
-    '',
-    '-c --coerce',
-    '        Coerce a string into SemVer if possible',
-    '        (does not imply --loose)',
-    '',
-    'Program exits successfully if any valid version satisfies',
-    'all supplied ranges, and prints all satisfying versions.',
-    '',
-    'If no satisfying versions are found, then exits failure.',
-    '',
-    'Versions are printed in ascending order, so supplying',
-    'multiple versions to the utility will just sort them.'
-  ].join('\n'))
-}
diff --git a/legacy-libs/grpc/node_modules/semver/package.json b/legacy-libs/grpc/node_modules/semver/package.json
deleted file mode 100644 (file)
index a97b859..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "_from": "semver@^5.3.0",
-  "_id": "semver@5.7.0",
-  "_inBundle": false,
-  "_integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
-  "_location": "/grpc/semver",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "semver@^5.3.0",
-    "name": "semver",
-    "escapedName": "semver",
-    "rawSpec": "^5.3.0",
-    "saveSpec": null,
-    "fetchSpec": "^5.3.0"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
-  "_shasum": "790a7cf6fea5459bac96110b29b60412dc8ff96b",
-  "_shrinkwrap": null,
-  "_spec": "semver@^5.3.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp",
-  "bin": {
-    "semver": "./bin/semver"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/node-semver/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "The semantic version parser used by npm.",
-  "devDependencies": {
-    "tap": "^13.0.0-rc.18"
-  },
-  "files": [
-    "bin",
-    "range.bnf",
-    "semver.js"
-  ],
-  "homepage": "https://github.com/npm/node-semver#readme",
-  "license": "ISC",
-  "main": "semver.js",
-  "name": "semver",
-  "optionalDependencies": {},
-  "readme": "semver(1) -- The semantic versioner for npm\n===========================================\n\n## Install\n\n```bash\nnpm install --save semver\n````\n\n## Usage\n\nAs a node module:\n\n```js\nconst semver = require('semver')\n\nsemver.valid('1.2.3') // '1.2.3'\nsemver.valid('a.b.c') // null\nsemver.clean('  =v1.2.3   ') // '1.2.3'\nsemver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true\nsemver.gt('1.2.3', '9.8.7') // false\nsemver.lt('1.2.3', '9.8.7') // true\nsemver.minVersion('>=1.0.0') // '1.0.0'\nsemver.valid(semver.coerce('v2')) // '2.0.0'\nsemver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'\n```\n\nAs a command-line utility:\n\n```\n$ semver -h\n\nA JavaScript implementation of the https://semver.org/ specification\nCopyright Isaac Z. Schlueter\n\nUsage: semver [options] <version> [<version> [...]]\nPrints valid versions sorted by SemVer precedence\n\nOptions:\n-r --range <range>\n        Print versions that match the specified range.\n\n-i --increment [<level>]\n        Increment a version by the specified level.  Level can\n        be one of: major, minor, patch, premajor, preminor,\n        prepatch, or prerelease.  Default level is 'patch'.\n        Only one version may be specified.\n\n--preid <identifier>\n        Identifier to be used to prefix premajor, preminor,\n        prepatch or prerelease version increments.\n\n-l --loose\n        Interpret versions and ranges loosely\n\n-p --include-prerelease\n        Always include prerelease versions in range matching\n\n-c --coerce\n        Coerce a string into SemVer if possible\n        (does not imply --loose)\n\nProgram exits successfully if any valid version satisfies\nall supplied ranges, and prints all satisfying versions.\n\nIf no satisfying versions are found, then exits failure.\n\nVersions are printed in ascending order, so supplying\nmultiple versions to the utility will just sort them.\n```\n\n## Versions\n\nA \"version\" is described by the `v2.0.0` specification found at\n<https://semver.org/>.\n\nA leading `\"=\"` or `\"v\"` character is stripped off and ignored.\n\n## Ranges\n\nA `version range` is a set of `comparators` which specify versions\nthat satisfy the range.\n\nA `comparator` is composed of an `operator` and a `version`.  The set\nof primitive `operators` is:\n\n* `<` Less than\n* `<=` Less than or equal to\n* `>` Greater than\n* `>=` Greater than or equal to\n* `=` Equal.  If no operator is specified, then equality is assumed,\n  so this operator is optional, but MAY be included.\n\nFor example, the comparator `>=1.2.7` would match the versions\n`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`\nor `1.1.0`.\n\nComparators can be joined by whitespace to form a `comparator set`,\nwhich is satisfied by the **intersection** of all of the comparators\nit includes.\n\nA range is composed of one or more comparator sets, joined by `||`.  A\nversion matches a range if and only if every comparator in at least\none of the `||`-separated comparator sets is satisfied by the version.\n\nFor example, the range `>=1.2.7 <1.3.0` would match the versions\n`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,\nor `1.1.0`.\n\nThe range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,\n`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.\n\n### Prerelease Tags\n\nIf a version has a prerelease tag (for example, `1.2.3-alpha.3`) then\nit will only be allowed to satisfy comparator sets if at least one\ncomparator with the same `[major, minor, patch]` tuple also has a\nprerelease tag.\n\nFor example, the range `>1.2.3-alpha.3` would be allowed to match the\nversion `1.2.3-alpha.7`, but it would *not* be satisfied by\n`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically \"greater\nthan\" `1.2.3-alpha.3` according to the SemVer sort rules.  The version\nrange only accepts prerelease tags on the `1.2.3` version.  The\nversion `3.4.5` *would* satisfy the range, because it does not have a\nprerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.\n\nThe purpose for this behavior is twofold.  First, prerelease versions\nfrequently are updated very quickly, and contain many breaking changes\nthat are (by the author's design) not yet fit for public consumption.\nTherefore, by default, they are excluded from range matching\nsemantics.\n\nSecond, a user who has opted into using a prerelease version has\nclearly indicated the intent to use *that specific* set of\nalpha/beta/rc versions.  By including a prerelease tag in the range,\nthe user is indicating that they are aware of the risk.  However, it\nis still not appropriate to assume that they have opted into taking a\nsimilar risk on the *next* set of prerelease versions.\n\nNote that this behavior can be suppressed (treating all prerelease\nversions as if they were normal versions, for the purpose of range\nmatching) by setting the `includePrerelease` flag on the options\nobject to any\n[functions](https://github.com/npm/node-semver#functions) that do\nrange matching.\n\n#### Prerelease Identifiers\n\nThe method `.inc` takes an additional `identifier` string argument that\nwill append the value of the string as a prerelease identifier:\n\n```javascript\nsemver.inc('1.2.3', 'prerelease', 'beta')\n// '1.2.4-beta.0'\n```\n\ncommand-line example:\n\n```bash\n$ semver 1.2.3 -i prerelease --preid beta\n1.2.4-beta.0\n```\n\nWhich then can be used to increment further:\n\n```bash\n$ semver 1.2.4-beta.0 -i prerelease\n1.2.4-beta.1\n```\n\n### Advanced Range Syntax\n\nAdvanced range syntax desugars to primitive comparators in\ndeterministic ways.\n\nAdvanced ranges may be combined in the same way as primitive\ncomparators using white space or `||`.\n\n#### Hyphen Ranges `X.Y.Z - A.B.C`\n\nSpecifies an inclusive set.\n\n* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`\n\nIf a partial version is provided as the first version in the inclusive\nrange, then the missing pieces are replaced with zeroes.\n\n* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`\n\nIf a partial version is provided as the second version in the\ninclusive range, then all versions that start with the supplied parts\nof the tuple are accepted, but nothing that would be greater than the\nprovided tuple parts.\n\n* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`\n* `1.2.3 - 2` := `>=1.2.3 <3.0.0`\n\n#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`\n\nAny of `X`, `x`, or `*` may be used to \"stand in\" for one of the\nnumeric values in the `[major, minor, patch]` tuple.\n\n* `*` := `>=0.0.0` (Any version satisfies)\n* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)\n* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)\n\nA partial version range is treated as an X-Range, so the special\ncharacter is in fact optional.\n\n* `\"\"` (empty string) := `*` := `>=0.0.0`\n* `1` := `1.x.x` := `>=1.0.0 <2.0.0`\n* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`\n\n#### Tilde Ranges `~1.2.3` `~1.2` `~1`\n\nAllows patch-level changes if a minor version is specified on the\ncomparator.  Allows minor-level changes if not.\n\n* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`\n* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)\n* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)\n* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`\n* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)\n* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)\n* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in\n  the `1.2.3` version will be allowed, if they are greater than or\n  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but\n  `1.2.4-beta.2` would not, because it is a prerelease of a\n  different `[major, minor, patch]` tuple.\n\n#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`\n\nAllows changes that do not modify the left-most non-zero digit in the\n`[major, minor, patch]` tuple.  In other words, this allows patch and\nminor updates for versions `1.0.0` and above, patch updates for\nversions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.\n\nMany authors treat a `0.x` version as if the `x` were the major\n\"breaking-change\" indicator.\n\nCaret ranges are ideal when an author may make breaking changes\nbetween `0.2.4` and `0.3.0` releases, which is a common practice.\nHowever, it presumes that there will *not* be breaking changes between\n`0.2.4` and `0.2.5`.  It allows for changes that are presumed to be\nadditive (but non-breaking), according to commonly observed practices.\n\n* `^1.2.3` := `>=1.2.3 <2.0.0`\n* `^0.2.3` := `>=0.2.3 <0.3.0`\n* `^0.0.3` := `>=0.0.3 <0.0.4`\n* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in\n  the `1.2.3` version will be allowed, if they are greater than or\n  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but\n  `1.2.4-beta.2` would not, because it is a prerelease of a\n  different `[major, minor, patch]` tuple.\n* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4`  Note that prereleases in the\n  `0.0.3` version *only* will be allowed, if they are greater than or\n  equal to `beta`.  So, `0.0.3-pr.2` would be allowed.\n\nWhen parsing caret ranges, a missing `patch` value desugars to the\nnumber `0`, but will allow flexibility within that value, even if the\nmajor and minor versions are both `0`.\n\n* `^1.2.x` := `>=1.2.0 <2.0.0`\n* `^0.0.x` := `>=0.0.0 <0.1.0`\n* `^0.0` := `>=0.0.0 <0.1.0`\n\nA missing `minor` and `patch` values will desugar to zero, but also\nallow flexibility within those values, even if the major version is\nzero.\n\n* `^1.x` := `>=1.0.0 <2.0.0`\n* `^0.x` := `>=0.0.0 <1.0.0`\n\n### Range Grammar\n\nPutting all this together, here is a Backus-Naur grammar for ranges,\nfor the benefit of parser authors:\n\n```bnf\nrange-set  ::= range ( logical-or range ) *\nlogical-or ::= ( ' ' ) * '||' ( ' ' ) *\nrange      ::= hyphen | simple ( ' ' simple ) * | ''\nhyphen     ::= partial ' - ' partial\nsimple     ::= primitive | partial | tilde | caret\nprimitive  ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial\npartial    ::= xr ( '.' xr ( '.' xr qualifier ? )? )?\nxr         ::= 'x' | 'X' | '*' | nr\nnr         ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *\ntilde      ::= '~' partial\ncaret      ::= '^' partial\nqualifier  ::= ( '-' pre )? ( '+' build )?\npre        ::= parts\nbuild      ::= parts\nparts      ::= part ( '.' part ) *\npart       ::= nr | [-0-9A-Za-z]+\n```\n\n## Functions\n\nAll methods and classes take a final `options` object argument.  All\noptions in this object are `false` by default.  The options supported\nare:\n\n- `loose`  Be more forgiving about not-quite-valid semver strings.\n  (Any resulting output will always be 100% strict compliant, of\n  course.)  For backwards compatibility reasons, if the `options`\n  argument is a boolean value instead of an object, it is interpreted\n  to be the `loose` param.\n- `includePrerelease`  Set to suppress the [default\n  behavior](https://github.com/npm/node-semver#prerelease-tags) of\n  excluding prerelease tagged versions from ranges unless they are\n  explicitly opted into.\n\nStrict-mode Comparators and Ranges will be strict about the SemVer\nstrings that they parse.\n\n* `valid(v)`: Return the parsed version, or null if it's not valid.\n* `inc(v, release)`: Return the version incremented by the release\n  type (`major`,   `premajor`, `minor`, `preminor`, `patch`,\n  `prepatch`, or `prerelease`), or null if it's not valid\n  * `premajor` in one call will bump the version up to the next major\n    version and down to a prerelease of that major version.\n    `preminor`, and `prepatch` work the same way.\n  * If called from a non-prerelease version, the `prerelease` will work the\n    same as `prepatch`. It increments the patch version, then makes a\n    prerelease. If the input version is already a prerelease it simply\n    increments it.\n* `prerelease(v)`: Returns an array of prerelease components, or null\n  if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`\n* `major(v)`: Return the major version number.\n* `minor(v)`: Return the minor version number.\n* `patch(v)`: Return the patch version number.\n* `intersects(r1, r2, loose)`: Return true if the two supplied ranges\n  or comparators intersect.\n* `parse(v)`: Attempt to parse a string as a semantic version, returning either\n  a `SemVer` object or `null`.\n\n### Comparison\n\n* `gt(v1, v2)`: `v1 > v2`\n* `gte(v1, v2)`: `v1 >= v2`\n* `lt(v1, v2)`: `v1 < v2`\n* `lte(v1, v2)`: `v1 <= v2`\n* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,\n  even if they're not the exact same string.  You already know how to\n  compare strings.\n* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.\n* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call\n  the corresponding function above.  `\"===\"` and `\"!==\"` do simple\n  string comparison, but are included for completeness.  Throws if an\n  invalid comparison string is provided.\n* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if\n  `v2` is greater.  Sorts in ascending order if passed to `Array.sort()`.\n* `rcompare(v1, v2)`: The reverse of compare.  Sorts an array of versions\n  in descending order when passed to `Array.sort()`.\n* `diff(v1, v2)`: Returns difference between two versions by the release type\n  (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),\n  or null if the versions are the same.\n\n### Comparators\n\n* `intersects(comparator)`: Return true if the comparators intersect\n\n### Ranges\n\n* `validRange(range)`: Return the valid range or null if it's not valid\n* `satisfies(version, range)`: Return true if the version satisfies the\n  range.\n* `maxSatisfying(versions, range)`: Return the highest version in the list\n  that satisfies the range, or `null` if none of them do.\n* `minSatisfying(versions, range)`: Return the lowest version in the list\n  that satisfies the range, or `null` if none of them do.\n* `minVersion(range)`: Return the lowest version that can possibly match\n  the given range.\n* `gtr(version, range)`: Return `true` if version is greater than all the\n  versions possible in the range.\n* `ltr(version, range)`: Return `true` if version is less than all the\n  versions possible in the range.\n* `outside(version, range, hilo)`: Return true if the version is outside\n  the bounds of the range in either the high or low direction.  The\n  `hilo` argument must be either the string `'>'` or `'<'`.  (This is\n  the function called by `gtr` and `ltr`.)\n* `intersects(range)`: Return true if any of the ranges comparators intersect\n\nNote that, since ranges may be non-contiguous, a version might not be\ngreater than a range, less than a range, *or* satisfy a range!  For\nexample, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`\nuntil `2.0.0`, so the version `1.2.10` would not be greater than the\nrange (because `2.0.1` satisfies, which is higher), nor less than the\nrange (since `1.2.8` satisfies, which is lower), and it also does not\nsatisfy the range.\n\nIf you want to know if a version satisfies or does not satisfy a\nrange, use the `satisfies(version, range)` function.\n\n### Coercion\n\n* `coerce(version)`: Coerces a string to semver if possible\n\nThis aims to provide a very forgiving translation of a non-semver\nstring to semver. It looks for the first digit in a string, and\nconsumes all remaining characters which satisfy at least a partial semver\n(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).\nLonger versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).\nAll surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).\nOnly text which lacks digits will fail coercion (`version one` is not valid).\nThe maximum  length for any semver component considered for coercion is 16 characters;\nlonger components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).\nThe maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;\nhigher value components are invalid (`9999999999999999.4.7.4` is likely invalid).\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/node-semver.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap"
-  },
-  "tap": {
-    "check-coverage": true
-  },
-  "version": "5.7.0"
-}
diff --git a/legacy-libs/grpc/node_modules/semver/range.bnf b/legacy-libs/grpc/node_modules/semver/range.bnf
deleted file mode 100644 (file)
index d4c6ae0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-range-set  ::= range ( logical-or range ) *
-logical-or ::= ( ' ' ) * '||' ( ' ' ) *
-range      ::= hyphen | simple ( ' ' simple ) * | ''
-hyphen     ::= partial ' - ' partial
-simple     ::= primitive | partial | tilde | caret
-primitive  ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
-partial    ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
-xr         ::= 'x' | 'X' | '*' | nr
-nr         ::= '0' | [1-9] ( [0-9] ) *
-tilde      ::= '~' partial
-caret      ::= '^' partial
-qualifier  ::= ( '-' pre )? ( '+' build )?
-pre        ::= parts
-build      ::= parts
-parts      ::= part ( '.' part ) *
-part       ::= nr | [-0-9A-Za-z]+
diff --git a/legacy-libs/grpc/node_modules/semver/semver.js b/legacy-libs/grpc/node_modules/semver/semver.js
deleted file mode 100644 (file)
index d315d5d..0000000
+++ /dev/null
@@ -1,1483 +0,0 @@
-exports = module.exports = SemVer
-
-var debug
-/* istanbul ignore next */
-if (typeof process === 'object' &&
-    process.env &&
-    process.env.NODE_DEBUG &&
-    /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
-  debug = function () {
-    var args = Array.prototype.slice.call(arguments, 0)
-    args.unshift('SEMVER')
-    console.log.apply(console, args)
-  }
-} else {
-  debug = function () {}
-}
-
-// Note: this is the semver.org version of the spec that it implements
-// Not necessarily the package version of this code.
-exports.SEMVER_SPEC_VERSION = '2.0.0'
-
-var MAX_LENGTH = 256
-var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
-  /* istanbul ignore next */ 9007199254740991
-
-// Max safe segment length for coercion.
-var MAX_SAFE_COMPONENT_LENGTH = 16
-
-// The actual regexps go on exports.re
-var re = exports.re = []
-var src = exports.src = []
-var R = 0
-
-// The following Regular Expressions can be used for tokenizing,
-// validating, and parsing SemVer version strings.
-
-// ## Numeric Identifier
-// A single `0`, or a non-zero digit followed by zero or more digits.
-
-var NUMERICIDENTIFIER = R++
-src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'
-var NUMERICIDENTIFIERLOOSE = R++
-src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'
-
-// ## Non-numeric Identifier
-// Zero or more digits, followed by a letter or hyphen, and then zero or
-// more letters, digits, or hyphens.
-
-var NONNUMERICIDENTIFIER = R++
-src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
-
-// ## Main Version
-// Three dot-separated numeric identifiers.
-
-var MAINVERSION = R++
-src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
-                   '(' + src[NUMERICIDENTIFIER] + ')\\.' +
-                   '(' + src[NUMERICIDENTIFIER] + ')'
-
-var MAINVERSIONLOOSE = R++
-src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
-                        '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
-                        '(' + src[NUMERICIDENTIFIERLOOSE] + ')'
-
-// ## Pre-release Version Identifier
-// A numeric identifier, or a non-numeric identifier.
-
-var PRERELEASEIDENTIFIER = R++
-src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
-                            '|' + src[NONNUMERICIDENTIFIER] + ')'
-
-var PRERELEASEIDENTIFIERLOOSE = R++
-src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
-                                 '|' + src[NONNUMERICIDENTIFIER] + ')'
-
-// ## Pre-release Version
-// Hyphen, followed by one or more dot-separated pre-release version
-// identifiers.
-
-var PRERELEASE = R++
-src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
-                  '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'
-
-var PRERELEASELOOSE = R++
-src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
-                       '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'
-
-// ## Build Metadata Identifier
-// Any combination of digits, letters, or hyphens.
-
-var BUILDIDENTIFIER = R++
-src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
-
-// ## Build Metadata
-// Plus sign, followed by one or more period-separated build metadata
-// identifiers.
-
-var BUILD = R++
-src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
-             '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'
-
-// ## Full Version String
-// A main version, followed optionally by a pre-release version and
-// build metadata.
-
-// Note that the only major, minor, patch, and pre-release sections of
-// the version string are capturing groups.  The build metadata is not a
-// capturing group, because it should not ever be used in version
-// comparison.
-
-var FULL = R++
-var FULLPLAIN = 'v?' + src[MAINVERSION] +
-                src[PRERELEASE] + '?' +
-                src[BUILD] + '?'
-
-src[FULL] = '^' + FULLPLAIN + '$'
-
-// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
-// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
-// common in the npm registry.
-var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
-                 src[PRERELEASELOOSE] + '?' +
-                 src[BUILD] + '?'
-
-var LOOSE = R++
-src[LOOSE] = '^' + LOOSEPLAIN + '$'
-
-var GTLT = R++
-src[GTLT] = '((?:<|>)?=?)'
-
-// Something like "2.*" or "1.2.x".
-// Note that "x.x" is a valid xRange identifer, meaning "any version"
-// Only the first item is strictly required.
-var XRANGEIDENTIFIERLOOSE = R++
-src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
-var XRANGEIDENTIFIER = R++
-src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'
-
-var XRANGEPLAIN = R++
-src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
-                   '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
-                   '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
-                   '(?:' + src[PRERELEASE] + ')?' +
-                   src[BUILD] + '?' +
-                   ')?)?'
-
-var XRANGEPLAINLOOSE = R++
-src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
-                        '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
-                        '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
-                        '(?:' + src[PRERELEASELOOSE] + ')?' +
-                        src[BUILD] + '?' +
-                        ')?)?'
-
-var XRANGE = R++
-src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'
-var XRANGELOOSE = R++
-src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'
-
-// Coercion.
-// Extract anything that could conceivably be a part of a valid semver
-var COERCE = R++
-src[COERCE] = '(?:^|[^\\d])' +
-              '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
-              '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
-              '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
-              '(?:$|[^\\d])'
-
-// Tilde ranges.
-// Meaning is "reasonably at or greater than"
-var LONETILDE = R++
-src[LONETILDE] = '(?:~>?)'
-
-var TILDETRIM = R++
-src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'
-re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')
-var tildeTrimReplace = '$1~'
-
-var TILDE = R++
-src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'
-var TILDELOOSE = R++
-src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'
-
-// Caret ranges.
-// Meaning is "at least and backwards compatible with"
-var LONECARET = R++
-src[LONECARET] = '(?:\\^)'
-
-var CARETTRIM = R++
-src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'
-re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')
-var caretTrimReplace = '$1^'
-
-var CARET = R++
-src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'
-var CARETLOOSE = R++
-src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'
-
-// A simple gt/lt/eq thing, or just "" to indicate "any version"
-var COMPARATORLOOSE = R++
-src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'
-var COMPARATOR = R++
-src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'
-
-// An expression to strip any whitespace between the gtlt and the thing
-// it modifies, so that `> 1.2.3` ==> `>1.2.3`
-var COMPARATORTRIM = R++
-src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
-                      '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'
-
-// this one has to use the /g flag
-re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')
-var comparatorTrimReplace = '$1$2$3'
-
-// Something like `1.2.3 - 1.2.4`
-// Note that these all use the loose form, because they'll be
-// checked against either the strict or loose comparator form
-// later.
-var HYPHENRANGE = R++
-src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
-                   '\\s+-\\s+' +
-                   '(' + src[XRANGEPLAIN] + ')' +
-                   '\\s*$'
-
-var HYPHENRANGELOOSE = R++
-src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
-                        '\\s+-\\s+' +
-                        '(' + src[XRANGEPLAINLOOSE] + ')' +
-                        '\\s*$'
-
-// Star ranges basically just allow anything at all.
-var STAR = R++
-src[STAR] = '(<|>)?=?\\s*\\*'
-
-// Compile to actual regexp objects.
-// All are flag-free, unless they were created above with a flag.
-for (var i = 0; i < R; i++) {
-  debug(i, src[i])
-  if (!re[i]) {
-    re[i] = new RegExp(src[i])
-  }
-}
-
-exports.parse = parse
-function parse (version, options) {
-  if (!options || typeof options !== 'object') {
-    options = {
-      loose: !!options,
-      includePrerelease: false
-    }
-  }
-
-  if (version instanceof SemVer) {
-    return version
-  }
-
-  if (typeof version !== 'string') {
-    return null
-  }
-
-  if (version.length > MAX_LENGTH) {
-    return null
-  }
-
-  var r = options.loose ? re[LOOSE] : re[FULL]
-  if (!r.test(version)) {
-    return null
-  }
-
-  try {
-    return new SemVer(version, options)
-  } catch (er) {
-    return null
-  }
-}
-
-exports.valid = valid
-function valid (version, options) {
-  var v = parse(version, options)
-  return v ? v.version : null
-}
-
-exports.clean = clean
-function clean (version, options) {
-  var s = parse(version.trim().replace(/^[=v]+/, ''), options)
-  return s ? s.version : null
-}
-
-exports.SemVer = SemVer
-
-function SemVer (version, options) {
-  if (!options || typeof options !== 'object') {
-    options = {
-      loose: !!options,
-      includePrerelease: false
-    }
-  }
-  if (version instanceof SemVer) {
-    if (version.loose === options.loose) {
-      return version
-    } else {
-      version = version.version
-    }
-  } else if (typeof version !== 'string') {
-    throw new TypeError('Invalid Version: ' + version)
-  }
-
-  if (version.length > MAX_LENGTH) {
-    throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
-  }
-
-  if (!(this instanceof SemVer)) {
-    return new SemVer(version, options)
-  }
-
-  debug('SemVer', version, options)
-  this.options = options
-  this.loose = !!options.loose
-
-  var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])
-
-  if (!m) {
-    throw new TypeError('Invalid Version: ' + version)
-  }
-
-  this.raw = version
-
-  // these are actually numbers
-  this.major = +m[1]
-  this.minor = +m[2]
-  this.patch = +m[3]
-
-  if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
-    throw new TypeError('Invalid major version')
-  }
-
-  if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
-    throw new TypeError('Invalid minor version')
-  }
-
-  if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
-    throw new TypeError('Invalid patch version')
-  }
-
-  // numberify any prerelease numeric ids
-  if (!m[4]) {
-    this.prerelease = []
-  } else {
-    this.prerelease = m[4].split('.').map(function (id) {
-      if (/^[0-9]+$/.test(id)) {
-        var num = +id
-        if (num >= 0 && num < MAX_SAFE_INTEGER) {
-          return num
-        }
-      }
-      return id
-    })
-  }
-
-  this.build = m[5] ? m[5].split('.') : []
-  this.format()
-}
-
-SemVer.prototype.format = function () {
-  this.version = this.major + '.' + this.minor + '.' + this.patch
-  if (this.prerelease.length) {
-    this.version += '-' + this.prerelease.join('.')
-  }
-  return this.version
-}
-
-SemVer.prototype.toString = function () {
-  return this.version
-}
-
-SemVer.prototype.compare = function (other) {
-  debug('SemVer.compare', this.version, this.options, other)
-  if (!(other instanceof SemVer)) {
-    other = new SemVer(other, this.options)
-  }
-
-  return this.compareMain(other) || this.comparePre(other)
-}
-
-SemVer.prototype.compareMain = function (other) {
-  if (!(other instanceof SemVer)) {
-    other = new SemVer(other, this.options)
-  }
-
-  return compareIdentifiers(this.major, other.major) ||
-         compareIdentifiers(this.minor, other.minor) ||
-         compareIdentifiers(this.patch, other.patch)
-}
-
-SemVer.prototype.comparePre = function (other) {
-  if (!(other instanceof SemVer)) {
-    other = new SemVer(other, this.options)
-  }
-
-  // NOT having a prerelease is > having one
-  if (this.prerelease.length && !other.prerelease.length) {
-    return -1
-  } else if (!this.prerelease.length && other.prerelease.length) {
-    return 1
-  } else if (!this.prerelease.length && !other.prerelease.length) {
-    return 0
-  }
-
-  var i = 0
-  do {
-    var a = this.prerelease[i]
-    var b = other.prerelease[i]
-    debug('prerelease compare', i, a, b)
-    if (a === undefined && b === undefined) {
-      return 0
-    } else if (b === undefined) {
-      return 1
-    } else if (a === undefined) {
-      return -1
-    } else if (a === b) {
-      continue
-    } else {
-      return compareIdentifiers(a, b)
-    }
-  } while (++i)
-}
-
-// preminor will bump the version up to the next minor release, and immediately
-// down to pre-release. premajor and prepatch work the same way.
-SemVer.prototype.inc = function (release, identifier) {
-  switch (release) {
-    case 'premajor':
-      this.prerelease.length = 0
-      this.patch = 0
-      this.minor = 0
-      this.major++
-      this.inc('pre', identifier)
-      break
-    case 'preminor':
-      this.prerelease.length = 0
-      this.patch = 0
-      this.minor++
-      this.inc('pre', identifier)
-      break
-    case 'prepatch':
-      // If this is already a prerelease, it will bump to the next version
-      // drop any prereleases that might already exist, since they are not
-      // relevant at this point.
-      this.prerelease.length = 0
-      this.inc('patch', identifier)
-      this.inc('pre', identifier)
-      break
-    // If the input is a non-prerelease version, this acts the same as
-    // prepatch.
-    case 'prerelease':
-      if (this.prerelease.length === 0) {
-        this.inc('patch', identifier)
-      }
-      this.inc('pre', identifier)
-      break
-
-    case 'major':
-      // If this is a pre-major version, bump up to the same major version.
-      // Otherwise increment major.
-      // 1.0.0-5 bumps to 1.0.0
-      // 1.1.0 bumps to 2.0.0
-      if (this.minor !== 0 ||
-          this.patch !== 0 ||
-          this.prerelease.length === 0) {
-        this.major++
-      }
-      this.minor = 0
-      this.patch = 0
-      this.prerelease = []
-      break
-    case 'minor':
-      // If this is a pre-minor version, bump up to the same minor version.
-      // Otherwise increment minor.
-      // 1.2.0-5 bumps to 1.2.0
-      // 1.2.1 bumps to 1.3.0
-      if (this.patch !== 0 || this.prerelease.length === 0) {
-        this.minor++
-      }
-      this.patch = 0
-      this.prerelease = []
-      break
-    case 'patch':
-      // If this is not a pre-release version, it will increment the patch.
-      // If it is a pre-release it will bump up to the same patch version.
-      // 1.2.0-5 patches to 1.2.0
-      // 1.2.0 patches to 1.2.1
-      if (this.prerelease.length === 0) {
-        this.patch++
-      }
-      this.prerelease = []
-      break
-    // This probably shouldn't be used publicly.
-    // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
-    case 'pre':
-      if (this.prerelease.length === 0) {
-        this.prerelease = [0]
-      } else {
-        var i = this.prerelease.length
-        while (--i >= 0) {
-          if (typeof this.prerelease[i] === 'number') {
-            this.prerelease[i]++
-            i = -2
-          }
-        }
-        if (i === -1) {
-          // didn't increment anything
-          this.prerelease.push(0)
-        }
-      }
-      if (identifier) {
-        // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
-        // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
-        if (this.prerelease[0] === identifier) {
-          if (isNaN(this.prerelease[1])) {
-            this.prerelease = [identifier, 0]
-          }
-        } else {
-          this.prerelease = [identifier, 0]
-        }
-      }
-      break
-
-    default:
-      throw new Error('invalid increment argument: ' + release)
-  }
-  this.format()
-  this.raw = this.version
-  return this
-}
-
-exports.inc = inc
-function inc (version, release, loose, identifier) {
-  if (typeof (loose) === 'string') {
-    identifier = loose
-    loose = undefined
-  }
-
-  try {
-    return new SemVer(version, loose).inc(release, identifier).version
-  } catch (er) {
-    return null
-  }
-}
-
-exports.diff = diff
-function diff (version1, version2) {
-  if (eq(version1, version2)) {
-    return null
-  } else {
-    var v1 = parse(version1)
-    var v2 = parse(version2)
-    var prefix = ''
-    if (v1.prerelease.length || v2.prerelease.length) {
-      prefix = 'pre'
-      var defaultResult = 'prerelease'
-    }
-    for (var key in v1) {
-      if (key === 'major' || key === 'minor' || key === 'patch') {
-        if (v1[key] !== v2[key]) {
-          return prefix + key
-        }
-      }
-    }
-    return defaultResult // may be undefined
-  }
-}
-
-exports.compareIdentifiers = compareIdentifiers
-
-var numeric = /^[0-9]+$/
-function compareIdentifiers (a, b) {
-  var anum = numeric.test(a)
-  var bnum = numeric.test(b)
-
-  if (anum && bnum) {
-    a = +a
-    b = +b
-  }
-
-  return a === b ? 0
-    : (anum && !bnum) ? -1
-    : (bnum && !anum) ? 1
-    : a < b ? -1
-    : 1
-}
-
-exports.rcompareIdentifiers = rcompareIdentifiers
-function rcompareIdentifiers (a, b) {
-  return compareIdentifiers(b, a)
-}
-
-exports.major = major
-function major (a, loose) {
-  return new SemVer(a, loose).major
-}
-
-exports.minor = minor
-function minor (a, loose) {
-  return new SemVer(a, loose).minor
-}
-
-exports.patch = patch
-function patch (a, loose) {
-  return new SemVer(a, loose).patch
-}
-
-exports.compare = compare
-function compare (a, b, loose) {
-  return new SemVer(a, loose).compare(new SemVer(b, loose))
-}
-
-exports.compareLoose = compareLoose
-function compareLoose (a, b) {
-  return compare(a, b, true)
-}
-
-exports.rcompare = rcompare
-function rcompare (a, b, loose) {
-  return compare(b, a, loose)
-}
-
-exports.sort = sort
-function sort (list, loose) {
-  return list.sort(function (a, b) {
-    return exports.compare(a, b, loose)
-  })
-}
-
-exports.rsort = rsort
-function rsort (list, loose) {
-  return list.sort(function (a, b) {
-    return exports.rcompare(a, b, loose)
-  })
-}
-
-exports.gt = gt
-function gt (a, b, loose) {
-  return compare(a, b, loose) > 0
-}
-
-exports.lt = lt
-function lt (a, b, loose) {
-  return compare(a, b, loose) < 0
-}
-
-exports.eq = eq
-function eq (a, b, loose) {
-  return compare(a, b, loose) === 0
-}
-
-exports.neq = neq
-function neq (a, b, loose) {
-  return compare(a, b, loose) !== 0
-}
-
-exports.gte = gte
-function gte (a, b, loose) {
-  return compare(a, b, loose) >= 0
-}
-
-exports.lte = lte
-function lte (a, b, loose) {
-  return compare(a, b, loose) <= 0
-}
-
-exports.cmp = cmp
-function cmp (a, op, b, loose) {
-  switch (op) {
-    case '===':
-      if (typeof a === 'object')
-        a = a.version
-      if (typeof b === 'object')
-        b = b.version
-      return a === b
-
-    case '!==':
-      if (typeof a === 'object')
-        a = a.version
-      if (typeof b === 'object')
-        b = b.version
-      return a !== b
-
-    case '':
-    case '=':
-    case '==':
-      return eq(a, b, loose)
-
-    case '!=':
-      return neq(a, b, loose)
-
-    case '>':
-      return gt(a, b, loose)
-
-    case '>=':
-      return gte(a, b, loose)
-
-    case '<':
-      return lt(a, b, loose)
-
-    case '<=':
-      return lte(a, b, loose)
-
-    default:
-      throw new TypeError('Invalid operator: ' + op)
-  }
-}
-
-exports.Comparator = Comparator
-function Comparator (comp, options) {
-  if (!options || typeof options !== 'object') {
-    options = {
-      loose: !!options,
-      includePrerelease: false
-    }
-  }
-
-  if (comp instanceof Comparator) {
-    if (comp.loose === !!options.loose) {
-      return comp
-    } else {
-      comp = comp.value
-    }
-  }
-
-  if (!(this instanceof Comparator)) {
-    return new Comparator(comp, options)
-  }
-
-  debug('comparator', comp, options)
-  this.options = options
-  this.loose = !!options.loose
-  this.parse(comp)
-
-  if (this.semver === ANY) {
-    this.value = ''
-  } else {
-    this.value = this.operator + this.semver.version
-  }
-
-  debug('comp', this)
-}
-
-var ANY = {}
-Comparator.prototype.parse = function (comp) {
-  var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
-  var m = comp.match(r)
-
-  if (!m) {
-    throw new TypeError('Invalid comparator: ' + comp)
-  }
-
-  this.operator = m[1]
-  if (this.operator === '=') {
-    this.operator = ''
-  }
-
-  // if it literally is just '>' or '' then allow anything.
-  if (!m[2]) {
-    this.semver = ANY
-  } else {
-    this.semver = new SemVer(m[2], this.options.loose)
-  }
-}
-
-Comparator.prototype.toString = function () {
-  return this.value
-}
-
-Comparator.prototype.test = function (version) {
-  debug('Comparator.test', version, this.options.loose)
-
-  if (this.semver === ANY) {
-    return true
-  }
-
-  if (typeof version === 'string') {
-    version = new SemVer(version, this.options)
-  }
-
-  return cmp(version, this.operator, this.semver, this.options)
-}
-
-Comparator.prototype.intersects = function (comp, options) {
-  if (!(comp instanceof Comparator)) {
-    throw new TypeError('a Comparator is required')
-  }
-
-  if (!options || typeof options !== 'object') {
-    options = {
-      loose: !!options,
-      includePrerelease: false
-    }
-  }
-
-  var rangeTmp
-
-  if (this.operator === '') {
-    rangeTmp = new Range(comp.value, options)
-    return satisfies(this.value, rangeTmp, options)
-  } else if (comp.operator === '') {
-    rangeTmp = new Range(this.value, options)
-    return satisfies(comp.semver, rangeTmp, options)
-  }
-
-  var sameDirectionIncreasing =
-    (this.operator === '>=' || this.operator === '>') &&
-    (comp.operator === '>=' || comp.operator === '>')
-  var sameDirectionDecreasing =
-    (this.operator === '<=' || this.operator === '<') &&
-    (comp.operator === '<=' || comp.operator === '<')
-  var sameSemVer = this.semver.version === comp.semver.version
-  var differentDirectionsInclusive =
-    (this.operator === '>=' || this.operator === '<=') &&
-    (comp.operator === '>=' || comp.operator === '<=')
-  var oppositeDirectionsLessThan =
-    cmp(this.semver, '<', comp.semver, options) &&
-    ((this.operator === '>=' || this.operator === '>') &&
-    (comp.operator === '<=' || comp.operator === '<'))
-  var oppositeDirectionsGreaterThan =
-    cmp(this.semver, '>', comp.semver, options) &&
-    ((this.operator === '<=' || this.operator === '<') &&
-    (comp.operator === '>=' || comp.operator === '>'))
-
-  return sameDirectionIncreasing || sameDirectionDecreasing ||
-    (sameSemVer && differentDirectionsInclusive) ||
-    oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
-}
-
-exports.Range = Range
-function Range (range, options) {
-  if (!options || typeof options !== 'object') {
-    options = {
-      loose: !!options,
-      includePrerelease: false
-    }
-  }
-
-  if (range instanceof Range) {
-    if (range.loose === !!options.loose &&
-        range.includePrerelease === !!options.includePrerelease) {
-      return range
-    } else {
-      return new Range(range.raw, options)
-    }
-  }
-
-  if (range instanceof Comparator) {
-    return new Range(range.value, options)
-  }
-
-  if (!(this instanceof Range)) {
-    return new Range(range, options)
-  }
-
-  this.options = options
-  this.loose = !!options.loose
-  this.includePrerelease = !!options.includePrerelease
-
-  // First, split based on boolean or ||
-  this.raw = range
-  this.set = range.split(/\s*\|\|\s*/).map(function (range) {
-    return this.parseRange(range.trim())
-  }, this).filter(function (c) {
-    // throw out any that are not relevant for whatever reason
-    return c.length
-  })
-
-  if (!this.set.length) {
-    throw new TypeError('Invalid SemVer Range: ' + range)
-  }
-
-  this.format()
-}
-
-Range.prototype.format = function () {
-  this.range = this.set.map(function (comps) {
-    return comps.join(' ').trim()
-  }).join('||').trim()
-  return this.range
-}
-
-Range.prototype.toString = function () {
-  return this.range
-}
-
-Range.prototype.parseRange = function (range) {
-  var loose = this.options.loose
-  range = range.trim()
-  // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
-  var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]
-  range = range.replace(hr, hyphenReplace)
-  debug('hyphen replace', range)
-  // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
-  range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)
-  debug('comparator trim', range, re[COMPARATORTRIM])
-
-  // `~ 1.2.3` => `~1.2.3`
-  range = range.replace(re[TILDETRIM], tildeTrimReplace)
-
-  // `^ 1.2.3` => `^1.2.3`
-  range = range.replace(re[CARETTRIM], caretTrimReplace)
-
-  // normalize spaces
-  range = range.split(/\s+/).join(' ')
-
-  // At this point, the range is completely trimmed and
-  // ready to be split into comparators.
-
-  var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
-  var set = range.split(' ').map(function (comp) {
-    return parseComparator(comp, this.options)
-  }, this).join(' ').split(/\s+/)
-  if (this.options.loose) {
-    // in loose mode, throw out any that are not valid comparators
-    set = set.filter(function (comp) {
-      return !!comp.match(compRe)
-    })
-  }
-  set = set.map(function (comp) {
-    return new Comparator(comp, this.options)
-  }, this)
-
-  return set
-}
-
-Range.prototype.intersects = function (range, options) {
-  if (!(range instanceof Range)) {
-    throw new TypeError('a Range is required')
-  }
-
-  return this.set.some(function (thisComparators) {
-    return thisComparators.every(function (thisComparator) {
-      return range.set.some(function (rangeComparators) {
-        return rangeComparators.every(function (rangeComparator) {
-          return thisComparator.intersects(rangeComparator, options)
-        })
-      })
-    })
-  })
-}
-
-// Mostly just for testing and legacy API reasons
-exports.toComparators = toComparators
-function toComparators (range, options) {
-  return new Range(range, options).set.map(function (comp) {
-    return comp.map(function (c) {
-      return c.value
-    }).join(' ').trim().split(' ')
-  })
-}
-
-// comprised of xranges, tildes, stars, and gtlt's at this point.
-// already replaced the hyphen ranges
-// turn into a set of JUST comparators.
-function parseComparator (comp, options) {
-  debug('comp', comp, options)
-  comp = replaceCarets(comp, options)
-  debug('caret', comp)
-  comp = replaceTildes(comp, options)
-  debug('tildes', comp)
-  comp = replaceXRanges(comp, options)
-  debug('xrange', comp)
-  comp = replaceStars(comp, options)
-  debug('stars', comp)
-  return comp
-}
-
-function isX (id) {
-  return !id || id.toLowerCase() === 'x' || id === '*'
-}
-
-// ~, ~> --> * (any, kinda silly)
-// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
-// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
-// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
-// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
-// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
-function replaceTildes (comp, options) {
-  return comp.trim().split(/\s+/).map(function (comp) {
-    return replaceTilde(comp, options)
-  }).join(' ')
-}
-
-function replaceTilde (comp, options) {
-  var r = options.loose ? re[TILDELOOSE] : re[TILDE]
-  return comp.replace(r, function (_, M, m, p, pr) {
-    debug('tilde', comp, _, M, m, p, pr)
-    var ret
-
-    if (isX(M)) {
-      ret = ''
-    } else if (isX(m)) {
-      ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
-    } else if (isX(p)) {
-      // ~1.2 == >=1.2.0 <1.3.0
-      ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
-    } else if (pr) {
-      debug('replaceTilde pr', pr)
-      ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
-            ' <' + M + '.' + (+m + 1) + '.0'
-    } else {
-      // ~1.2.3 == >=1.2.3 <1.3.0
-      ret = '>=' + M + '.' + m + '.' + p +
-            ' <' + M + '.' + (+m + 1) + '.0'
-    }
-
-    debug('tilde return', ret)
-    return ret
-  })
-}
-
-// ^ --> * (any, kinda silly)
-// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
-// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
-// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
-// ^1.2.3 --> >=1.2.3 <2.0.0
-// ^1.2.0 --> >=1.2.0 <2.0.0
-function replaceCarets (comp, options) {
-  return comp.trim().split(/\s+/).map(function (comp) {
-    return replaceCaret(comp, options)
-  }).join(' ')
-}
-
-function replaceCaret (comp, options) {
-  debug('caret', comp, options)
-  var r = options.loose ? re[CARETLOOSE] : re[CARET]
-  return comp.replace(r, function (_, M, m, p, pr) {
-    debug('caret', comp, _, M, m, p, pr)
-    var ret
-
-    if (isX(M)) {
-      ret = ''
-    } else if (isX(m)) {
-      ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
-    } else if (isX(p)) {
-      if (M === '0') {
-        ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
-      } else {
-        ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'
-      }
-    } else if (pr) {
-      debug('replaceCaret pr', pr)
-      if (M === '0') {
-        if (m === '0') {
-          ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
-                ' <' + M + '.' + m + '.' + (+p + 1)
-        } else {
-          ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
-                ' <' + M + '.' + (+m + 1) + '.0'
-        }
-      } else {
-        ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
-              ' <' + (+M + 1) + '.0.0'
-      }
-    } else {
-      debug('no pr')
-      if (M === '0') {
-        if (m === '0') {
-          ret = '>=' + M + '.' + m + '.' + p +
-                ' <' + M + '.' + m + '.' + (+p + 1)
-        } else {
-          ret = '>=' + M + '.' + m + '.' + p +
-                ' <' + M + '.' + (+m + 1) + '.0'
-        }
-      } else {
-        ret = '>=' + M + '.' + m + '.' + p +
-              ' <' + (+M + 1) + '.0.0'
-      }
-    }
-
-    debug('caret return', ret)
-    return ret
-  })
-}
-
-function replaceXRanges (comp, options) {
-  debug('replaceXRanges', comp, options)
-  return comp.split(/\s+/).map(function (comp) {
-    return replaceXRange(comp, options)
-  }).join(' ')
-}
-
-function replaceXRange (comp, options) {
-  comp = comp.trim()
-  var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]
-  return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
-    debug('xRange', comp, ret, gtlt, M, m, p, pr)
-    var xM = isX(M)
-    var xm = xM || isX(m)
-    var xp = xm || isX(p)
-    var anyX = xp
-
-    if (gtlt === '=' && anyX) {
-      gtlt = ''
-    }
-
-    if (xM) {
-      if (gtlt === '>' || gtlt === '<') {
-        // nothing is allowed
-        ret = '<0.0.0'
-      } else {
-        // nothing is forbidden
-        ret = '*'
-      }
-    } else if (gtlt && anyX) {
-      // we know patch is an x, because we have any x at all.
-      // replace X with 0
-      if (xm) {
-        m = 0
-      }
-      p = 0
-
-      if (gtlt === '>') {
-        // >1 => >=2.0.0
-        // >1.2 => >=1.3.0
-        // >1.2.3 => >= 1.2.4
-        gtlt = '>='
-        if (xm) {
-          M = +M + 1
-          m = 0
-          p = 0
-        } else {
-          m = +m + 1
-          p = 0
-        }
-      } else if (gtlt === '<=') {
-        // <=0.7.x is actually <0.8.0, since any 0.7.x should
-        // pass.  Similarly, <=7.x is actually <8.0.0, etc.
-        gtlt = '<'
-        if (xm) {
-          M = +M + 1
-        } else {
-          m = +m + 1
-        }
-      }
-
-      ret = gtlt + M + '.' + m + '.' + p
-    } else if (xm) {
-      ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
-    } else if (xp) {
-      ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
-    }
-
-    debug('xRange return', ret)
-
-    return ret
-  })
-}
-
-// Because * is AND-ed with everything else in the comparator,
-// and '' means "any version", just remove the *s entirely.
-function replaceStars (comp, options) {
-  debug('replaceStars', comp, options)
-  // Looseness is ignored here.  star is always as loose as it gets!
-  return comp.trim().replace(re[STAR], '')
-}
-
-// This function is passed to string.replace(re[HYPHENRANGE])
-// M, m, patch, prerelease, build
-// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
-// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
-// 1.2 - 3.4 => >=1.2.0 <3.5.0
-function hyphenReplace ($0,
-  from, fM, fm, fp, fpr, fb,
-  to, tM, tm, tp, tpr, tb) {
-  if (isX(fM)) {
-    from = ''
-  } else if (isX(fm)) {
-    from = '>=' + fM + '.0.0'
-  } else if (isX(fp)) {
-    from = '>=' + fM + '.' + fm + '.0'
-  } else {
-    from = '>=' + from
-  }
-
-  if (isX(tM)) {
-    to = ''
-  } else if (isX(tm)) {
-    to = '<' + (+tM + 1) + '.0.0'
-  } else if (isX(tp)) {
-    to = '<' + tM + '.' + (+tm + 1) + '.0'
-  } else if (tpr) {
-    to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr
-  } else {
-    to = '<=' + to
-  }
-
-  return (from + ' ' + to).trim()
-}
-
-// if ANY of the sets match ALL of its comparators, then pass
-Range.prototype.test = function (version) {
-  if (!version) {
-    return false
-  }
-
-  if (typeof version === 'string') {
-    version = new SemVer(version, this.options)
-  }
-
-  for (var i = 0; i < this.set.length; i++) {
-    if (testSet(this.set[i], version, this.options)) {
-      return true
-    }
-  }
-  return false
-}
-
-function testSet (set, version, options) {
-  for (var i = 0; i < set.length; i++) {
-    if (!set[i].test(version)) {
-      return false
-    }
-  }
-
-  if (version.prerelease.length && !options.includePrerelease) {
-    // Find the set of versions that are allowed to have prereleases
-    // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
-    // That should allow `1.2.3-pr.2` to pass.
-    // However, `1.2.4-alpha.notready` should NOT be allowed,
-    // even though it's within the range set by the comparators.
-    for (i = 0; i < set.length; i++) {
-      debug(set[i].semver)
-      if (set[i].semver === ANY) {
-        continue
-      }
-
-      if (set[i].semver.prerelease.length > 0) {
-        var allowed = set[i].semver
-        if (allowed.major === version.major &&
-            allowed.minor === version.minor &&
-            allowed.patch === version.patch) {
-          return true
-        }
-      }
-    }
-
-    // Version has a -pre, but it's not one of the ones we like.
-    return false
-  }
-
-  return true
-}
-
-exports.satisfies = satisfies
-function satisfies (version, range, options) {
-  try {
-    range = new Range(range, options)
-  } catch (er) {
-    return false
-  }
-  return range.test(version)
-}
-
-exports.maxSatisfying = maxSatisfying
-function maxSatisfying (versions, range, options) {
-  var max = null
-  var maxSV = null
-  try {
-    var rangeObj = new Range(range, options)
-  } catch (er) {
-    return null
-  }
-  versions.forEach(function (v) {
-    if (rangeObj.test(v)) {
-      // satisfies(v, range, options)
-      if (!max || maxSV.compare(v) === -1) {
-        // compare(max, v, true)
-        max = v
-        maxSV = new SemVer(max, options)
-      }
-    }
-  })
-  return max
-}
-
-exports.minSatisfying = minSatisfying
-function minSatisfying (versions, range, options) {
-  var min = null
-  var minSV = null
-  try {
-    var rangeObj = new Range(range, options)
-  } catch (er) {
-    return null
-  }
-  versions.forEach(function (v) {
-    if (rangeObj.test(v)) {
-      // satisfies(v, range, options)
-      if (!min || minSV.compare(v) === 1) {
-        // compare(min, v, true)
-        min = v
-        minSV = new SemVer(min, options)
-      }
-    }
-  })
-  return min
-}
-
-exports.minVersion = minVersion
-function minVersion (range, loose) {
-  range = new Range(range, loose)
-
-  var minver = new SemVer('0.0.0')
-  if (range.test(minver)) {
-    return minver
-  }
-
-  minver = new SemVer('0.0.0-0')
-  if (range.test(minver)) {
-    return minver
-  }
-
-  minver = null
-  for (var i = 0; i < range.set.length; ++i) {
-    var comparators = range.set[i]
-
-    comparators.forEach(function (comparator) {
-      // Clone to avoid manipulating the comparator's semver object.
-      var compver = new SemVer(comparator.semver.version)
-      switch (comparator.operator) {
-        case '>':
-          if (compver.prerelease.length === 0) {
-            compver.patch++
-          } else {
-            compver.prerelease.push(0)
-          }
-          compver.raw = compver.format()
-          /* fallthrough */
-        case '':
-        case '>=':
-          if (!minver || gt(minver, compver)) {
-            minver = compver
-          }
-          break
-        case '<':
-        case '<=':
-          /* Ignore maximum versions */
-          break
-        /* istanbul ignore next */
-        default:
-          throw new Error('Unexpected operation: ' + comparator.operator)
-      }
-    })
-  }
-
-  if (minver && range.test(minver)) {
-    return minver
-  }
-
-  return null
-}
-
-exports.validRange = validRange
-function validRange (range, options) {
-  try {
-    // Return '*' instead of '' so that truthiness works.
-    // This will throw if it's invalid anyway
-    return new Range(range, options).range || '*'
-  } catch (er) {
-    return null
-  }
-}
-
-// Determine if version is less than all the versions possible in the range
-exports.ltr = ltr
-function ltr (version, range, options) {
-  return outside(version, range, '<', options)
-}
-
-// Determine if version is greater than all the versions possible in the range.
-exports.gtr = gtr
-function gtr (version, range, options) {
-  return outside(version, range, '>', options)
-}
-
-exports.outside = outside
-function outside (version, range, hilo, options) {
-  version = new SemVer(version, options)
-  range = new Range(range, options)
-
-  var gtfn, ltefn, ltfn, comp, ecomp
-  switch (hilo) {
-    case '>':
-      gtfn = gt
-      ltefn = lte
-      ltfn = lt
-      comp = '>'
-      ecomp = '>='
-      break
-    case '<':
-      gtfn = lt
-      ltefn = gte
-      ltfn = gt
-      comp = '<'
-      ecomp = '<='
-      break
-    default:
-      throw new TypeError('Must provide a hilo val of "<" or ">"')
-  }
-
-  // If it satisifes the range it is not outside
-  if (satisfies(version, range, options)) {
-    return false
-  }
-
-  // From now on, variable terms are as if we're in "gtr" mode.
-  // but note that everything is flipped for the "ltr" function.
-
-  for (var i = 0; i < range.set.length; ++i) {
-    var comparators = range.set[i]
-
-    var high = null
-    var low = null
-
-    comparators.forEach(function (comparator) {
-      if (comparator.semver === ANY) {
-        comparator = new Comparator('>=0.0.0')
-      }
-      high = high || comparator
-      low = low || comparator
-      if (gtfn(comparator.semver, high.semver, options)) {
-        high = comparator
-      } else if (ltfn(comparator.semver, low.semver, options)) {
-        low = comparator
-      }
-    })
-
-    // If the edge version comparator has a operator then our version
-    // isn't outside it
-    if (high.operator === comp || high.operator === ecomp) {
-      return false
-    }
-
-    // If the lowest version comparator has an operator and our version
-    // is less than it then it isn't higher than the range
-    if ((!low.operator || low.operator === comp) &&
-        ltefn(version, low.semver)) {
-      return false
-    } else if (low.operator === ecomp && ltfn(version, low.semver)) {
-      return false
-    }
-  }
-  return true
-}
-
-exports.prerelease = prerelease
-function prerelease (version, options) {
-  var parsed = parse(version, options)
-  return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
-}
-
-exports.intersects = intersects
-function intersects (r1, r2, options) {
-  r1 = new Range(r1, options)
-  r2 = new Range(r2, options)
-  return r1.intersects(r2)
-}
-
-exports.coerce = coerce
-function coerce (version) {
-  if (version instanceof SemVer) {
-    return version
-  }
-
-  if (typeof version !== 'string') {
-    return null
-  }
-
-  var match = version.match(re[COERCE])
-
-  if (match == null) {
-    return null
-  }
-
-  return parse(match[1] +
-    '.' + (match[2] || '0') +
-    '.' + (match[3] || '0'))
-}
diff --git a/legacy-libs/grpc/node_modules/set-blocking/CHANGELOG.md b/legacy-libs/grpc/node_modules/set-blocking/CHANGELOG.md
deleted file mode 100644 (file)
index 03bf591..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Change Log
-
-All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
-
-<a name="2.0.0"></a>
-# [2.0.0](https://github.com/yargs/set-blocking/compare/v1.0.0...v2.0.0) (2016-05-17)
-
-
-### Features
-
-* add an isTTY check ([#3](https://github.com/yargs/set-blocking/issues/3)) ([66ce277](https://github.com/yargs/set-blocking/commit/66ce277))
-
-
-### BREAKING CHANGES
-
-* stdio/stderr will not be set to blocking if isTTY === false
-
-
-
-<a name="1.0.0"></a>
-# 1.0.0 (2016-05-14)
-
-
-### Features
-
-* implemented shim for stream._handle.setBlocking ([6bde0c0](https://github.com/yargs/set-blocking/commit/6bde0c0))
diff --git a/legacy-libs/grpc/node_modules/set-blocking/LICENSE.txt b/legacy-libs/grpc/node_modules/set-blocking/LICENSE.txt
deleted file mode 100644 (file)
index 836440b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Copyright (c) 2016, Contributors
-
-Permission to use, copy, modify, and/or distribute this software
-for any purpose with or without fee is hereby granted, provided
-that the above copyright notice and this permission notice
-appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
-LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
-OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/set-blocking/README.md b/legacy-libs/grpc/node_modules/set-blocking/README.md
deleted file mode 100644 (file)
index e93b420..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# set-blocking
-
-[![Build Status](https://travis-ci.org/yargs/set-blocking.svg)](https://travis-ci.org/yargs/set-blocking)
-[![NPM version](https://img.shields.io/npm/v/set-blocking.svg)](https://www.npmjs.com/package/set-blocking)
-[![Coverage Status](https://coveralls.io/repos/yargs/set-blocking/badge.svg?branch=)](https://coveralls.io/r/yargs/set-blocking?branch=master)
-[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
-
-set blocking `stdio` and `stderr` ensuring that terminal output does not truncate.
-
-```js
-const setBlocking = require('set-blocking')
-setBlocking(true)
-console.log(someLargeStringToOutput)
-```
-
-## Historical Context/Word of Warning
-
-This was created as a shim to address the bug discussed in [node #6456](https://github.com/nodejs/node/issues/6456). This bug crops up on
-newer versions of Node.js (`0.12+`), truncating terminal output.
-
-You should be mindful of the side-effects caused by using `set-blocking`:
-
-* if your module sets blocking to `true`, it will effect other modules
-  consuming your library. In [yargs](https://github.com/yargs/yargs/blob/master/yargs.js#L653) we only call
-  `setBlocking(true)` once we already know we are about to call `process.exit(code)`.
-* this patch will not apply to subprocesses spawned with `isTTY = true`, this is
-  the [default `spawn()` behavior](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
-
-## License
-
-ISC
diff --git a/legacy-libs/grpc/node_modules/set-blocking/index.js b/legacy-libs/grpc/node_modules/set-blocking/index.js
deleted file mode 100644 (file)
index 6f78774..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = function (blocking) {
-  [process.stdout, process.stderr].forEach(function (stream) {
-    if (stream._handle && stream.isTTY && typeof stream._handle.setBlocking === 'function') {
-      stream._handle.setBlocking(blocking)
-    }
-  })
-}
diff --git a/legacy-libs/grpc/node_modules/set-blocking/package.json b/legacy-libs/grpc/node_modules/set-blocking/package.json
deleted file mode 100644 (file)
index f9d586a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "_args": [
-    [
-      "set-blocking@2.0.0",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "set-blocking@2.0.0",
-  "_id": "set-blocking@2.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
-  "_location": "/grpc/set-blocking",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "set-blocking@2.0.0",
-    "name": "set-blocking",
-    "escapedName": "set-blocking",
-    "rawSpec": "2.0.0",
-    "saveSpec": null,
-    "fetchSpec": "2.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/npmlog"
-  ],
-  "_resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Ben Coe",
-    "email": "ben@npmjs.com"
-  },
-  "bugs": {
-    "url": "https://github.com/yargs/set-blocking/issues"
-  },
-  "dependencies": {},
-  "description": "set blocking stdio and stderr ensuring that terminal output does not truncate",
-  "devDependencies": {
-    "chai": "^3.5.0",
-    "coveralls": "^2.11.9",
-    "mocha": "^2.4.5",
-    "nyc": "^6.4.4",
-    "standard": "^7.0.1",
-    "standard-version": "^2.2.1"
-  },
-  "files": [
-    "index.js",
-    "LICENSE.txt"
-  ],
-  "homepage": "https://github.com/yargs/set-blocking#readme",
-  "keywords": [
-    "flush",
-    "terminal",
-    "blocking",
-    "shim",
-    "stdio",
-    "stderr"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "set-blocking",
-  "optionalDependencies": {},
-  "readme": "# set-blocking\n\n[![Build Status](https://travis-ci.org/yargs/set-blocking.svg)](https://travis-ci.org/yargs/set-blocking)\n[![NPM version](https://img.shields.io/npm/v/set-blocking.svg)](https://www.npmjs.com/package/set-blocking)\n[![Coverage Status](https://coveralls.io/repos/yargs/set-blocking/badge.svg?branch=)](https://coveralls.io/r/yargs/set-blocking?branch=master)\n[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)\n\nset blocking `stdio` and `stderr` ensuring that terminal output does not truncate.\n\n```js\nconst setBlocking = require('set-blocking')\nsetBlocking(true)\nconsole.log(someLargeStringToOutput)\n```\n\n## Historical Context/Word of Warning\n\nThis was created as a shim to address the bug discussed in [node #6456](https://github.com/nodejs/node/issues/6456). This bug crops up on\nnewer versions of Node.js (`0.12+`), truncating terminal output.\n\nYou should be mindful of the side-effects caused by using `set-blocking`:\n\n* if your module sets blocking to `true`, it will effect other modules\n  consuming your library. In [yargs](https://github.com/yargs/yargs/blob/master/yargs.js#L653) we only call\n  `setBlocking(true)` once we already know we are about to call `process.exit(code)`.\n* this patch will not apply to subprocesses spawned with `isTTY = true`, this is\n  the [default `spawn()` behavior](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).\n\n## License\n\nISC\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/yargs/set-blocking.git"
-  },
-  "scripts": {
-    "coverage": "nyc report --reporter=text-lcov | coveralls",
-    "pretest": "standard",
-    "test": "nyc mocha ./test/*.js",
-    "version": "standard-version"
-  },
-  "version": "2.0.0"
-}
diff --git a/legacy-libs/grpc/node_modules/signal-exit/CHANGELOG.md b/legacy-libs/grpc/node_modules/signal-exit/CHANGELOG.md
deleted file mode 100644 (file)
index e2f70d2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# Change Log
-
-All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
-
-<a name="3.0.1"></a>
-## [3.0.1](https://github.com/tapjs/signal-exit/compare/v3.0.0...v3.0.1) (2016-09-08)
-
-
-### Bug Fixes
-
-* do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL ([#40](https://github.com/tapjs/signal-exit/issues/40)) ([5b105fb](https://github.com/tapjs/signal-exit/commit/5b105fb))
-
-
-
-<a name="3.0.0"></a>
-# [3.0.0](https://github.com/tapjs/signal-exit/compare/v2.1.2...v3.0.0) (2016-06-13)
-
-
-### Bug Fixes
-
-* get our test suite running on Windows ([#23](https://github.com/tapjs/signal-exit/issues/23)) ([6f3eda8](https://github.com/tapjs/signal-exit/commit/6f3eda8))
-* hooking SIGPROF was interfering with profilers see [#21](https://github.com/tapjs/signal-exit/issues/21) ([#24](https://github.com/tapjs/signal-exit/issues/24)) ([1248a4c](https://github.com/tapjs/signal-exit/commit/1248a4c))
-
-
-### BREAKING CHANGES
-
-* signal-exit no longer wires into SIGPROF
diff --git a/legacy-libs/grpc/node_modules/signal-exit/LICENSE.txt b/legacy-libs/grpc/node_modules/signal-exit/LICENSE.txt
deleted file mode 100644 (file)
index eead04a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-The ISC License
-
-Copyright (c) 2015, Contributors
-
-Permission to use, copy, modify, and/or distribute this software
-for any purpose with or without fee is hereby granted, provided
-that the above copyright notice and this permission notice
-appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
-LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
-OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/signal-exit/README.md b/legacy-libs/grpc/node_modules/signal-exit/README.md
deleted file mode 100644 (file)
index 8ebccab..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# signal-exit
-
-[![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit)
-[![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master)
-[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)
-[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/signal-exit/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/signal-exit)
-[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
-
-When you want to fire an event no matter how a process exits:
-
-* reaching the end of execution.
-* explicitly having `process.exit(code)` called.
-* having `process.kill(pid, sig)` called.
-* receiving a fatal signal from outside the process
-
-Use `signal-exit`.
-
-```js
-var onExit = require('signal-exit')
-
-onExit(function (code, signal) {
-  console.log('process exited!')
-})
-```
-
-## API
-
-`var remove = onExit(function (code, signal) {}, options)`
-
-The return value of the function is a function that will remove the
-handler.
-
-Note that the function *only* fires for signals if the signal would
-cause the proces to exit.  That is, there are no other listeners, and
-it is a fatal signal.
-
-## Options
-
-* `alwaysLast`: Run this handler after any other signal or exit
-  handlers.  This causes `process.emit` to be monkeypatched.
diff --git a/legacy-libs/grpc/node_modules/signal-exit/index.js b/legacy-libs/grpc/node_modules/signal-exit/index.js
deleted file mode 100644 (file)
index 7dd8d91..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-// Note: since nyc uses this module to output coverage, any lines
-// that are in the direct sync flow of nyc's outputCoverage are
-// ignored, since we can never get coverage for them.
-var assert = require('assert')
-var signals = require('./signals.js')
-
-var EE = require('events')
-/* istanbul ignore if */
-if (typeof EE !== 'function') {
-  EE = EE.EventEmitter
-}
-
-var emitter
-if (process.__signal_exit_emitter__) {
-  emitter = process.__signal_exit_emitter__
-} else {
-  emitter = process.__signal_exit_emitter__ = new EE()
-  emitter.count = 0
-  emitter.emitted = {}
-}
-
-module.exports = function (cb, opts) {
-  assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
-
-  if (loaded === false) {
-    load()
-  }
-
-  var ev = 'exit'
-  if (opts && opts.alwaysLast) {
-    ev = 'afterexit'
-  }
-
-  var remove = function () {
-    emitter.removeListener(ev, cb)
-    if (emitter.listeners('exit').length === 0 &&
-        emitter.listeners('afterexit').length === 0) {
-      unload()
-    }
-  }
-  emitter.on(ev, cb)
-
-  return remove
-}
-
-module.exports.unload = unload
-function unload () {
-  if (!loaded) {
-    return
-  }
-  loaded = false
-
-  signals.forEach(function (sig) {
-    try {
-      process.removeListener(sig, sigListeners[sig])
-    } catch (er) {}
-  })
-  process.emit = originalProcessEmit
-  process.reallyExit = originalProcessReallyExit
-  emitter.count -= 1
-}
-
-function emit (event, code, signal) {
-  if (emitter.emitted[event]) {
-    return
-  }
-  emitter.emitted[event] = true
-  emitter.emit(event, code, signal)
-}
-
-// { <signal>: <listener fn>, ... }
-var sigListeners = {}
-signals.forEach(function (sig) {
-  sigListeners[sig] = function listener () {
-    // If there are no other listeners, an exit is coming!
-    // Simplest way: remove us and then re-send the signal.
-    // We know that this will kill the process, so we can
-    // safely emit now.
-    var listeners = process.listeners(sig)
-    if (listeners.length === emitter.count) {
-      unload()
-      emit('exit', null, sig)
-      /* istanbul ignore next */
-      emit('afterexit', null, sig)
-      /* istanbul ignore next */
-      process.kill(process.pid, sig)
-    }
-  }
-})
-
-module.exports.signals = function () {
-  return signals
-}
-
-module.exports.load = load
-
-var loaded = false
-
-function load () {
-  if (loaded) {
-    return
-  }
-  loaded = true
-
-  // This is the number of onSignalExit's that are in play.
-  // It's important so that we can count the correct number of
-  // listeners on signals, and don't wait for the other one to
-  // handle it instead of us.
-  emitter.count += 1
-
-  signals = signals.filter(function (sig) {
-    try {
-      process.on(sig, sigListeners[sig])
-      return true
-    } catch (er) {
-      return false
-    }
-  })
-
-  process.emit = processEmit
-  process.reallyExit = processReallyExit
-}
-
-var originalProcessReallyExit = process.reallyExit
-function processReallyExit (code) {
-  process.exitCode = code || 0
-  emit('exit', process.exitCode, null)
-  /* istanbul ignore next */
-  emit('afterexit', process.exitCode, null)
-  /* istanbul ignore next */
-  originalProcessReallyExit.call(process, process.exitCode)
-}
-
-var originalProcessEmit = process.emit
-function processEmit (ev, arg) {
-  if (ev === 'exit') {
-    if (arg !== undefined) {
-      process.exitCode = arg
-    }
-    var ret = originalProcessEmit.apply(this, arguments)
-    emit('exit', process.exitCode, null)
-    /* istanbul ignore next */
-    emit('afterexit', process.exitCode, null)
-    return ret
-  } else {
-    return originalProcessEmit.apply(this, arguments)
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/signal-exit/package.json b/legacy-libs/grpc/node_modules/signal-exit/package.json
deleted file mode 100644 (file)
index 3ba3818..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-{
-  "_from": "signal-exit@^3.0.0",
-  "_id": "signal-exit@3.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-WkyISZK2OnrNm623iUw+6c/MrYE=",
-  "_location": "/grpc/signal-exit",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "signal-exit@^3.0.0",
-    "name": "signal-exit",
-    "escapedName": "signal-exit",
-    "rawSpec": "^3.0.0",
-    "saveSpec": null,
-    "fetchSpec": "^3.0.0"
-  },
-  "_requiredBy": [
-    "/grpc/gauge"
-  ],
-  "_resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz",
-  "_shasum": "5a4c884992b63a7acd9badb7894c3ee9cfccad81",
-  "_shrinkwrap": null,
-  "_spec": "signal-exit@^3.0.0",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/gauge",
-  "author": {
-    "name": "Ben Coe",
-    "email": "ben@npmjs.com"
-  },
-  "bugs": {
-    "url": "https://github.com/tapjs/signal-exit/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "when you want to fire an event no matter how a process exits.",
-  "devDependencies": {
-    "chai": "^3.5.0",
-    "coveralls": "^2.11.10",
-    "nyc": "^8.1.0",
-    "standard": "^7.1.2",
-    "standard-version": "^2.3.0",
-    "tap": "^7.1.0"
-  },
-  "files": [
-    "index.js",
-    "signals.js"
-  ],
-  "homepage": "https://github.com/tapjs/signal-exit",
-  "keywords": [
-    "signal",
-    "exit"
-  ],
-  "license": "ISC",
-  "main": "index.js",
-  "name": "signal-exit",
-  "optionalDependencies": {},
-  "readme": "# signal-exit\n\n[![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit)\n[![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master)\n[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)\n[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/signal-exit/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/signal-exit)\n[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)\n\nWhen you want to fire an event no matter how a process exits:\n\n* reaching the end of execution.\n* explicitly having `process.exit(code)` called.\n* having `process.kill(pid, sig)` called.\n* receiving a fatal signal from outside the process\n\nUse `signal-exit`.\n\n```js\nvar onExit = require('signal-exit')\n\nonExit(function (code, signal) {\n  console.log('process exited!')\n})\n```\n\n## API\n\n`var remove = onExit(function (code, signal) {}, options)`\n\nThe return value of the function is a function that will remove the\nhandler.\n\nNote that the function *only* fires for signals if the signal would\ncause the proces to exit.  That is, there are no other listeners, and\nit is a fatal signal.\n\n## Options\n\n* `alwaysLast`: Run this handler after any other signal or exit\n  handlers.  This causes `process.emit` to be monkeypatched.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/tapjs/signal-exit.git"
-  },
-  "scripts": {
-    "coverage": "nyc report --reporter=text-lcov | coveralls",
-    "pretest": "standard",
-    "release": "standard-version",
-    "test": "tap --timeout=240 ./test/*.js --cov"
-  },
-  "version": "3.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/signal-exit/signals.js b/legacy-libs/grpc/node_modules/signal-exit/signals.js
deleted file mode 100644 (file)
index 3bd67a8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// This is not the set of all possible signals.
-//
-// It IS, however, the set of all signals that trigger
-// an exit on either Linux or BSD systems.  Linux is a
-// superset of the signal names supported on BSD, and
-// the unknown signals just fail to register, so we can
-// catch that easily enough.
-//
-// Don't bother with SIGKILL.  It's uncatchable, which
-// means that we can't fire any callbacks anyway.
-//
-// If a user does happen to register a handler on a non-
-// fatal signal like SIGWINCH or something, and then
-// exit, it'll end up firing `process.emit('exit')`, so
-// the handler will be fired anyway.
-//
-// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
-// artificially, inherently leave the process in a
-// state from which it is not safe to try and enter JS
-// listeners.
-module.exports = [
-  'SIGABRT',
-  'SIGALRM',
-  'SIGHUP',
-  'SIGINT',
-  'SIGTERM'
-]
-
-if (process.platform !== 'win32') {
-  module.exports.push(
-    'SIGVTALRM',
-    'SIGXCPU',
-    'SIGXFSZ',
-    'SIGUSR2',
-    'SIGTRAP',
-    'SIGSYS',
-    'SIGQUIT',
-    'SIGIOT'
-    // should detect profiler and enable/disable accordingly.
-    // see #21
-    // 'SIGPROF'
-  )
-}
-
-if (process.platform === 'linux') {
-  module.exports.push(
-    'SIGIO',
-    'SIGPOLL',
-    'SIGPWR',
-    'SIGSTKFLT',
-    'SIGUNUSED'
-  )
-}
diff --git a/legacy-libs/grpc/node_modules/string-width/index.js b/legacy-libs/grpc/node_modules/string-width/index.js
deleted file mode 100644 (file)
index b9bec62..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-var stripAnsi = require('strip-ansi');
-var codePointAt = require('code-point-at');
-var isFullwidthCodePoint = require('is-fullwidth-code-point');
-
-// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
-module.exports = function (str) {
-       if (typeof str !== 'string' || str.length === 0) {
-               return 0;
-       }
-
-       var width = 0;
-
-       str = stripAnsi(str);
-
-       for (var i = 0; i < str.length; i++) {
-               var code = codePointAt(str, i);
-
-               // ignore control characters
-               if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {
-                       continue;
-               }
-
-               // surrogates
-               if (code >= 0x10000) {
-                       i++;
-               }
-
-               if (isFullwidthCodePoint(code)) {
-                       width += 2;
-               } else {
-                       width++;
-               }
-       }
-
-       return width;
-};
diff --git a/legacy-libs/grpc/node_modules/string-width/license b/legacy-libs/grpc/node_modules/string-width/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/string-width/package.json b/legacy-libs/grpc/node_modules/string-width/package.json
deleted file mode 100644 (file)
index bff8141..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-{
-  "_args": [
-    [
-      "string-width@1.0.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "string-width@1.0.2",
-  "_id": "string-width@1.0.2",
-  "_inBundle": false,
-  "_integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
-  "_location": "/grpc/string-width",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "string-width@1.0.2",
-    "name": "string-width",
-    "escapedName": "string-width",
-    "rawSpec": "1.0.2",
-    "saveSpec": null,
-    "fetchSpec": "1.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/gauge",
-    "/grpc/wide-align"
-  ],
-  "_resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/string-width/issues"
-  },
-  "dependencies": {
-    "code-point-at": "^1.0.0",
-    "is-fullwidth-code-point": "^1.0.0",
-    "strip-ansi": "^3.0.0"
-  },
-  "description": "Get the visual width of a string - the number of columns required to display it",
-  "devDependencies": {
-    "ava": "*",
-    "xo": "*"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/string-width#readme",
-  "keywords": [
-    "string",
-    "str",
-    "character",
-    "char",
-    "unicode",
-    "width",
-    "visual",
-    "column",
-    "columns",
-    "fullwidth",
-    "full-width",
-    "full",
-    "ansi",
-    "escape",
-    "codes",
-    "cli",
-    "command-line",
-    "terminal",
-    "console",
-    "cjk",
-    "chinese",
-    "japanese",
-    "korean",
-    "fixed-width"
-  ],
-  "license": "MIT",
-  "name": "string-width",
-  "optionalDependencies": {},
-  "readme": "# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width)\n\n> Get the visual width of a string - the number of columns required to display it\n\nSome Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.\n\nUseful to be able to measure the actual width of command-line output.\n\n\n## Install\n\n```\n$ npm install --save string-width\n```\n\n\n## Usage\n\n```js\nconst stringWidth = require('string-width');\n\nstringWidth('古');\n//=> 2\n\nstringWidth('\\u001b[1m古\\u001b[22m');\n//=> 2\n\nstringWidth('a');\n//=> 1\n```\n\n\n## Related\n\n- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module\n- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string\n- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/string-width.git"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "version": "1.0.2"
-}
diff --git a/legacy-libs/grpc/node_modules/string-width/readme.md b/legacy-libs/grpc/node_modules/string-width/readme.md
deleted file mode 100644 (file)
index 1ab42c9..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width)
-
-> Get the visual width of a string - the number of columns required to display it
-
-Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
-
-Useful to be able to measure the actual width of command-line output.
-
-
-## Install
-
-```
-$ npm install --save string-width
-```
-
-
-## Usage
-
-```js
-const stringWidth = require('string-width');
-
-stringWidth('古');
-//=> 2
-
-stringWidth('\u001b[1m古\u001b[22m');
-//=> 2
-
-stringWidth('a');
-//=> 1
-```
-
-
-## Related
-
-- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
-- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
-- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/string_decoder/LICENSE b/legacy-libs/grpc/node_modules/string_decoder/LICENSE
deleted file mode 100644 (file)
index 778edb2..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-Node.js is licensed for use as follows:
-
-"""
-Copyright Node.js contributors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-"""
-
-This license applies to parts of Node.js originating from the
-https://github.com/joyent/node repository:
-
-"""
-Copyright Joyent, Inc. and other Node contributors. All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-"""
-
diff --git a/legacy-libs/grpc/node_modules/string_decoder/README.md b/legacy-libs/grpc/node_modules/string_decoder/README.md
deleted file mode 100644 (file)
index 5fd5831..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# string_decoder
-
-***Node-core v8.9.4 string_decoder for userland***
-
-
-[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/)
-[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/)
-
-
-```bash
-npm install --save string_decoder
-```
-
-***Node-core string_decoder for userland***
-
-This package is a mirror of the string_decoder implementation in Node-core.
-
-Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/).
-
-As of version 1.0.0 **string_decoder** uses semantic versioning.
-
-## Previous versions
-
-Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10.
-
-## Update
-
-The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version.
-
-## Streams Working Group
-
-`string_decoder` is maintained by the Streams Working Group, which
-oversees the development and maintenance of the Streams API within
-Node.js. The responsibilities of the Streams Working Group include:
-
-* Addressing stream issues on the Node.js issue tracker.
-* Authoring and editing stream documentation within the Node.js project.
-* Reviewing changes to stream subclasses within the Node.js project.
-* Redirecting changes to streams from the Node.js project to this
-  project.
-* Assisting in the implementation of stream providers within Node.js.
-* Recommending versions of `readable-stream` to be included in Node.js.
-* Messaging about the future of streams to give the community advance
-  notice of changes.
-
-See [readable-stream](https://github.com/nodejs/readable-stream) for
-more details.
diff --git a/legacy-libs/grpc/node_modules/string_decoder/lib/string_decoder.js b/legacy-libs/grpc/node_modules/string_decoder/lib/string_decoder.js
deleted file mode 100644 (file)
index 2e89e63..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-
-/*<replacement>*/
-
-var Buffer = require('safe-buffer').Buffer;
-/*</replacement>*/
-
-var isEncoding = Buffer.isEncoding || function (encoding) {
-  encoding = '' + encoding;
-  switch (encoding && encoding.toLowerCase()) {
-    case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
-      return true;
-    default:
-      return false;
-  }
-};
-
-function _normalizeEncoding(enc) {
-  if (!enc) return 'utf8';
-  var retried;
-  while (true) {
-    switch (enc) {
-      case 'utf8':
-      case 'utf-8':
-        return 'utf8';
-      case 'ucs2':
-      case 'ucs-2':
-      case 'utf16le':
-      case 'utf-16le':
-        return 'utf16le';
-      case 'latin1':
-      case 'binary':
-        return 'latin1';
-      case 'base64':
-      case 'ascii':
-      case 'hex':
-        return enc;
-      default:
-        if (retried) return; // undefined
-        enc = ('' + enc).toLowerCase();
-        retried = true;
-    }
-  }
-};
-
-// Do not cache `Buffer.isEncoding` when checking encoding names as some
-// modules monkey-patch it to support additional encodings
-function normalizeEncoding(enc) {
-  var nenc = _normalizeEncoding(enc);
-  if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
-  return nenc || enc;
-}
-
-// StringDecoder provides an interface for efficiently splitting a series of
-// buffers into a series of JS strings without breaking apart multi-byte
-// characters.
-exports.StringDecoder = StringDecoder;
-function StringDecoder(encoding) {
-  this.encoding = normalizeEncoding(encoding);
-  var nb;
-  switch (this.encoding) {
-    case 'utf16le':
-      this.text = utf16Text;
-      this.end = utf16End;
-      nb = 4;
-      break;
-    case 'utf8':
-      this.fillLast = utf8FillLast;
-      nb = 4;
-      break;
-    case 'base64':
-      this.text = base64Text;
-      this.end = base64End;
-      nb = 3;
-      break;
-    default:
-      this.write = simpleWrite;
-      this.end = simpleEnd;
-      return;
-  }
-  this.lastNeed = 0;
-  this.lastTotal = 0;
-  this.lastChar = Buffer.allocUnsafe(nb);
-}
-
-StringDecoder.prototype.write = function (buf) {
-  if (buf.length === 0) return '';
-  var r;
-  var i;
-  if (this.lastNeed) {
-    r = this.fillLast(buf);
-    if (r === undefined) return '';
-    i = this.lastNeed;
-    this.lastNeed = 0;
-  } else {
-    i = 0;
-  }
-  if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
-  return r || '';
-};
-
-StringDecoder.prototype.end = utf8End;
-
-// Returns only complete characters in a Buffer
-StringDecoder.prototype.text = utf8Text;
-
-// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
-StringDecoder.prototype.fillLast = function (buf) {
-  if (this.lastNeed <= buf.length) {
-    buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
-    return this.lastChar.toString(this.encoding, 0, this.lastTotal);
-  }
-  buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
-  this.lastNeed -= buf.length;
-};
-
-// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
-// continuation byte. If an invalid byte is detected, -2 is returned.
-function utf8CheckByte(byte) {
-  if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
-  return byte >> 6 === 0x02 ? -1 : -2;
-}
-
-// Checks at most 3 bytes at the end of a Buffer in order to detect an
-// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
-// needed to complete the UTF-8 character (if applicable) are returned.
-function utf8CheckIncomplete(self, buf, i) {
-  var j = buf.length - 1;
-  if (j < i) return 0;
-  var nb = utf8CheckByte(buf[j]);
-  if (nb >= 0) {
-    if (nb > 0) self.lastNeed = nb - 1;
-    return nb;
-  }
-  if (--j < i || nb === -2) return 0;
-  nb = utf8CheckByte(buf[j]);
-  if (nb >= 0) {
-    if (nb > 0) self.lastNeed = nb - 2;
-    return nb;
-  }
-  if (--j < i || nb === -2) return 0;
-  nb = utf8CheckByte(buf[j]);
-  if (nb >= 0) {
-    if (nb > 0) {
-      if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
-    }
-    return nb;
-  }
-  return 0;
-}
-
-// Validates as many continuation bytes for a multi-byte UTF-8 character as
-// needed or are available. If we see a non-continuation byte where we expect
-// one, we "replace" the validated continuation bytes we've seen so far with
-// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
-// behavior. The continuation byte check is included three times in the case
-// where all of the continuation bytes for a character exist in the same buffer.
-// It is also done this way as a slight performance increase instead of using a
-// loop.
-function utf8CheckExtraBytes(self, buf, p) {
-  if ((buf[0] & 0xC0) !== 0x80) {
-    self.lastNeed = 0;
-    return '\ufffd';
-  }
-  if (self.lastNeed > 1 && buf.length > 1) {
-    if ((buf[1] & 0xC0) !== 0x80) {
-      self.lastNeed = 1;
-      return '\ufffd';
-    }
-    if (self.lastNeed > 2 && buf.length > 2) {
-      if ((buf[2] & 0xC0) !== 0x80) {
-        self.lastNeed = 2;
-        return '\ufffd';
-      }
-    }
-  }
-}
-
-// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
-function utf8FillLast(buf) {
-  var p = this.lastTotal - this.lastNeed;
-  var r = utf8CheckExtraBytes(this, buf, p);
-  if (r !== undefined) return r;
-  if (this.lastNeed <= buf.length) {
-    buf.copy(this.lastChar, p, 0, this.lastNeed);
-    return this.lastChar.toString(this.encoding, 0, this.lastTotal);
-  }
-  buf.copy(this.lastChar, p, 0, buf.length);
-  this.lastNeed -= buf.length;
-}
-
-// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
-// partial character, the character's bytes are buffered until the required
-// number of bytes are available.
-function utf8Text(buf, i) {
-  var total = utf8CheckIncomplete(this, buf, i);
-  if (!this.lastNeed) return buf.toString('utf8', i);
-  this.lastTotal = total;
-  var end = buf.length - (total - this.lastNeed);
-  buf.copy(this.lastChar, 0, end);
-  return buf.toString('utf8', i, end);
-}
-
-// For UTF-8, a replacement character is added when ending on a partial
-// character.
-function utf8End(buf) {
-  var r = buf && buf.length ? this.write(buf) : '';
-  if (this.lastNeed) return r + '\ufffd';
-  return r;
-}
-
-// UTF-16LE typically needs two bytes per character, but even if we have an even
-// number of bytes available, we need to check if we end on a leading/high
-// surrogate. In that case, we need to wait for the next two bytes in order to
-// decode the last character properly.
-function utf16Text(buf, i) {
-  if ((buf.length - i) % 2 === 0) {
-    var r = buf.toString('utf16le', i);
-    if (r) {
-      var c = r.charCodeAt(r.length - 1);
-      if (c >= 0xD800 && c <= 0xDBFF) {
-        this.lastNeed = 2;
-        this.lastTotal = 4;
-        this.lastChar[0] = buf[buf.length - 2];
-        this.lastChar[1] = buf[buf.length - 1];
-        return r.slice(0, -1);
-      }
-    }
-    return r;
-  }
-  this.lastNeed = 1;
-  this.lastTotal = 2;
-  this.lastChar[0] = buf[buf.length - 1];
-  return buf.toString('utf16le', i, buf.length - 1);
-}
-
-// For UTF-16LE we do not explicitly append special replacement characters if we
-// end on a partial character, we simply let v8 handle that.
-function utf16End(buf) {
-  var r = buf && buf.length ? this.write(buf) : '';
-  if (this.lastNeed) {
-    var end = this.lastTotal - this.lastNeed;
-    return r + this.lastChar.toString('utf16le', 0, end);
-  }
-  return r;
-}
-
-function base64Text(buf, i) {
-  var n = (buf.length - i) % 3;
-  if (n === 0) return buf.toString('base64', i);
-  this.lastNeed = 3 - n;
-  this.lastTotal = 3;
-  if (n === 1) {
-    this.lastChar[0] = buf[buf.length - 1];
-  } else {
-    this.lastChar[0] = buf[buf.length - 2];
-    this.lastChar[1] = buf[buf.length - 1];
-  }
-  return buf.toString('base64', i, buf.length - n);
-}
-
-function base64End(buf) {
-  var r = buf && buf.length ? this.write(buf) : '';
-  if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
-  return r;
-}
-
-// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
-function simpleWrite(buf) {
-  return buf.toString(this.encoding);
-}
-
-function simpleEnd(buf) {
-  return buf && buf.length ? this.write(buf) : '';
-}
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/string_decoder/package.json b/legacy-libs/grpc/node_modules/string_decoder/package.json
deleted file mode 100644 (file)
index 7ca48cb..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-{
-  "_args": [
-    [
-      "string_decoder@1.1.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "string_decoder@1.1.1",
-  "_id": "string_decoder@1.1.1",
-  "_inBundle": false,
-  "_integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
-  "_location": "/grpc/string_decoder",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "string_decoder@1.1.1",
-    "name": "string_decoder",
-    "escapedName": "string_decoder",
-    "rawSpec": "1.1.1",
-    "saveSpec": null,
-    "fetchSpec": "1.1.1"
-  },
-  "_requiredBy": [
-    "/grpc/readable-stream"
-  ],
-  "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "bugs": {
-    "url": "https://github.com/nodejs/string_decoder/issues"
-  },
-  "dependencies": {
-    "safe-buffer": "~5.1.0"
-  },
-  "description": "The string_decoder module from Node core",
-  "devDependencies": {
-    "babel-polyfill": "^6.23.0",
-    "core-util-is": "^1.0.2",
-    "inherits": "^2.0.3",
-    "tap": "~0.4.8"
-  },
-  "homepage": "https://github.com/nodejs/string_decoder",
-  "keywords": [
-    "string",
-    "decoder",
-    "browser",
-    "browserify"
-  ],
-  "license": "MIT",
-  "main": "lib/string_decoder.js",
-  "name": "string_decoder",
-  "optionalDependencies": {},
-  "readme": "# string_decoder\n\n***Node-core v8.9.4 string_decoder for userland***\n\n\n[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/)\n[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/)\n\n\n```bash\nnpm install --save string_decoder\n```\n\n***Node-core string_decoder for userland***\n\nThis package is a mirror of the string_decoder implementation in Node-core.\n\nFull documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/).\n\nAs of version 1.0.0 **string_decoder** uses semantic versioning.\n\n## Previous versions\n\nPrevious version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10.\n\n## Update\n\nThe *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version.\n\n## Streams Working Group\n\n`string_decoder` is maintained by the Streams Working Group, which\noversees the development and maintenance of the Streams API within\nNode.js. The responsibilities of the Streams Working Group include:\n\n* Addressing stream issues on the Node.js issue tracker.\n* Authoring and editing stream documentation within the Node.js project.\n* Reviewing changes to stream subclasses within the Node.js project.\n* Redirecting changes to streams from the Node.js project to this\n  project.\n* Assisting in the implementation of stream providers within Node.js.\n* Recommending versions of `readable-stream` to be included in Node.js.\n* Messaging about the future of streams to give the community advance\n  notice of changes.\n\nSee [readable-stream](https://github.com/nodejs/readable-stream) for\nmore details.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/nodejs/string_decoder.git"
-  },
-  "scripts": {
-    "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js",
-    "test": "tap test/parallel/*.js && node test/verify-dependencies"
-  },
-  "version": "1.1.1"
-}
diff --git a/legacy-libs/grpc/node_modules/strip-ansi/index.js b/legacy-libs/grpc/node_modules/strip-ansi/index.js
deleted file mode 100644 (file)
index 099480f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-var ansiRegex = require('ansi-regex')();
-
-module.exports = function (str) {
-       return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
-};
diff --git a/legacy-libs/grpc/node_modules/strip-ansi/license b/legacy-libs/grpc/node_modules/strip-ansi/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/strip-ansi/package.json b/legacy-libs/grpc/node_modules/strip-ansi/package.json
deleted file mode 100644 (file)
index 6747da8..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-{
-  "_args": [
-    [
-      "strip-ansi@3.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "strip-ansi@3.0.1",
-  "_id": "strip-ansi@3.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
-  "_location": "/grpc/strip-ansi",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "strip-ansi@3.0.1",
-    "name": "strip-ansi",
-    "escapedName": "strip-ansi",
-    "rawSpec": "3.0.1",
-    "saveSpec": null,
-    "fetchSpec": "3.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/gauge",
-    "/grpc/string-width"
-  ],
-  "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "3.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/chalk/strip-ansi/issues"
-  },
-  "dependencies": {
-    "ansi-regex": "^2.0.0"
-  },
-  "description": "Strip ANSI escape codes",
-  "devDependencies": {
-    "ava": "*",
-    "xo": "*"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/chalk/strip-ansi#readme",
-  "keywords": [
-    "strip",
-    "trim",
-    "remove",
-    "ansi",
-    "styles",
-    "color",
-    "colour",
-    "colors",
-    "terminal",
-    "console",
-    "string",
-    "tty",
-    "escape",
-    "formatting",
-    "rgb",
-    "256",
-    "shell",
-    "xterm",
-    "log",
-    "logging",
-    "command-line",
-    "text"
-  ],
-  "license": "MIT",
-  "maintainers": [
-    {
-      "name": "Sindre Sorhus",
-      "email": "sindresorhus@gmail.com",
-      "url": "sindresorhus.com"
-    },
-    {
-      "name": "Joshua Boy Nicolai Appelman",
-      "email": "joshua@jbna.nl",
-      "url": "jbna.nl"
-    },
-    {
-      "name": "JD Ballard",
-      "email": "i.am.qix@gmail.com",
-      "url": "github.com/qix-"
-    }
-  ],
-  "name": "strip-ansi",
-  "optionalDependencies": {},
-  "readme": "# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)\n\n> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)\n\n\n## Install\n\n```\n$ npm install --save strip-ansi\n```\n\n\n## Usage\n\n```js\nvar stripAnsi = require('strip-ansi');\n\nstripAnsi('\\u001b[4mcake\\u001b[0m');\n//=> 'cake'\n```\n\n\n## Related\n\n- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module\n- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes\n- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes\n- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/chalk/strip-ansi.git"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "version": "3.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/strip-ansi/readme.md b/legacy-libs/grpc/node_modules/strip-ansi/readme.md
deleted file mode 100644 (file)
index cb7d9ff..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)
-
-> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
-
-
-## Install
-
-```
-$ npm install --save strip-ansi
-```
-
-
-## Usage
-
-```js
-var stripAnsi = require('strip-ansi');
-
-stripAnsi('\u001b[4mcake\u001b[0m');
-//=> 'cake'
-```
-
-
-## Related
-
-- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
-- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
-- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
-- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/strip-json-comments/index.js b/legacy-libs/grpc/node_modules/strip-json-comments/index.js
deleted file mode 100644 (file)
index 4e6576e..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-'use strict';
-var singleComment = 1;
-var multiComment = 2;
-
-function stripWithoutWhitespace() {
-       return '';
-}
-
-function stripWithWhitespace(str, start, end) {
-       return str.slice(start, end).replace(/\S/g, ' ');
-}
-
-module.exports = function (str, opts) {
-       opts = opts || {};
-
-       var currentChar;
-       var nextChar;
-       var insideString = false;
-       var insideComment = false;
-       var offset = 0;
-       var ret = '';
-       var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
-
-       for (var i = 0; i < str.length; i++) {
-               currentChar = str[i];
-               nextChar = str[i + 1];
-
-               if (!insideComment && currentChar === '"') {
-                       var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
-                       if (!escaped) {
-                               insideString = !insideString;
-                       }
-               }
-
-               if (insideString) {
-                       continue;
-               }
-
-               if (!insideComment && currentChar + nextChar === '//') {
-                       ret += str.slice(offset, i);
-                       offset = i;
-                       insideComment = singleComment;
-                       i++;
-               } else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
-                       i++;
-                       insideComment = false;
-                       ret += strip(str, offset, i);
-                       offset = i;
-                       continue;
-               } else if (insideComment === singleComment && currentChar === '\n') {
-                       insideComment = false;
-                       ret += strip(str, offset, i);
-                       offset = i;
-               } else if (!insideComment && currentChar + nextChar === '/*') {
-                       ret += str.slice(offset, i);
-                       offset = i;
-                       insideComment = multiComment;
-                       i++;
-                       continue;
-               } else if (insideComment === multiComment && currentChar + nextChar === '*/') {
-                       i++;
-                       insideComment = false;
-                       ret += strip(str, offset, i + 1);
-                       offset = i + 1;
-                       continue;
-               }
-       }
-
-       return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
-};
diff --git a/legacy-libs/grpc/node_modules/strip-json-comments/license b/legacy-libs/grpc/node_modules/strip-json-comments/license
deleted file mode 100644 (file)
index 654d0bf..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/strip-json-comments/package.json b/legacy-libs/grpc/node_modules/strip-json-comments/package.json
deleted file mode 100644 (file)
index 7eb39a9..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-{
-  "_args": [
-    [
-      "strip-json-comments@2.0.1",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "strip-json-comments@2.0.1",
-  "_id": "strip-json-comments@2.0.1",
-  "_inBundle": false,
-  "_integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
-  "_location": "/grpc/strip-json-comments",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "strip-json-comments@2.0.1",
-    "name": "strip-json-comments",
-    "escapedName": "strip-json-comments",
-    "rawSpec": "2.0.1",
-    "saveSpec": null,
-    "fetchSpec": "2.0.1"
-  },
-  "_requiredBy": [
-    "/grpc/rc"
-  ],
-  "_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
-  "_shrinkwrap": null,
-  "_spec": "2.0.1",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/strip-json-comments/issues"
-  },
-  "dependencies": {},
-  "description": "Strip comments from JSON. Lets you use comments in your JSON files!",
-  "devDependencies": {
-    "ava": "*",
-    "xo": "*"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/strip-json-comments#readme",
-  "keywords": [
-    "json",
-    "strip",
-    "remove",
-    "delete",
-    "trim",
-    "comments",
-    "multiline",
-    "parse",
-    "config",
-    "configuration",
-    "conf",
-    "settings",
-    "util",
-    "env",
-    "environment"
-  ],
-  "license": "MIT",
-  "name": "strip-json-comments",
-  "optionalDependencies": {},
-  "readme": "# strip-json-comments [![Build Status](https://travis-ci.org/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-json-comments)\n\n> Strip comments from JSON. Lets you use comments in your JSON files!\n\nThis is now possible:\n\n```js\n{\n\t// rainbows\n\t\"unicorn\": /* ❤ */ \"cake\"\n}\n```\n\nIt will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source.\n\nAlso available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin.\n\n\n## Install\n\n```\n$ npm install --save strip-json-comments\n```\n\n\n## Usage\n\n```js\nconst json = '{/*rainbows*/\"unicorn\":\"cake\"}';\n\nJSON.parse(stripJsonComments(json));\n//=> {unicorn: 'cake'}\n```\n\n\n## API\n\n### stripJsonComments(input, [options])\n\n#### input\n\nType: `string`\n\nAccepts a string with JSON and returns a string without comments.\n\n#### options\n\n##### whitespace\n\nType: `boolean`  \nDefault: `true`\n\nReplace comments with whitespace instead of stripping them entirely.\n\n\n## Related\n\n- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module\n- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
-  "readmeFilename": "readme.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/strip-json-comments.git"
-  },
-  "scripts": {
-    "test": "xo && ava"
-  },
-  "version": "2.0.1"
-}
diff --git a/legacy-libs/grpc/node_modules/strip-json-comments/readme.md b/legacy-libs/grpc/node_modules/strip-json-comments/readme.md
deleted file mode 100644 (file)
index 0ee58df..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# strip-json-comments [![Build Status](https://travis-ci.org/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-json-comments)
-
-> Strip comments from JSON. Lets you use comments in your JSON files!
-
-This is now possible:
-
-```js
-{
-       // rainbows
-       "unicorn": /* ❤ */ "cake"
-}
-```
-
-It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source.
-
-Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin.
-
-
-## Install
-
-```
-$ npm install --save strip-json-comments
-```
-
-
-## Usage
-
-```js
-const json = '{/*rainbows*/"unicorn":"cake"}';
-
-JSON.parse(stripJsonComments(json));
-//=> {unicorn: 'cake'}
-```
-
-
-## API
-
-### stripJsonComments(input, [options])
-
-#### input
-
-Type: `string`
-
-Accepts a string with JSON and returns a string without comments.
-
-#### options
-
-##### whitespace
-
-Type: `boolean`  
-Default: `true`
-
-Replace comments with whitespace instead of stripping them entirely.
-
-
-## Related
-
-- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module
-- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/legacy-libs/grpc/node_modules/tar/LICENSE b/legacy-libs/grpc/node_modules/tar/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/tar/README.md b/legacy-libs/grpc/node_modules/tar/README.md
deleted file mode 100644 (file)
index 034e486..0000000
+++ /dev/null
@@ -1,954 +0,0 @@
-# node-tar
-
-[![Build Status](https://travis-ci.org/npm/node-tar.svg?branch=master)](https://travis-ci.org/npm/node-tar)
-
-[Fast](./benchmarks) and full-featured Tar for Node.js
-
-The API is designed to mimic the behavior of `tar(1)` on unix systems.
-If you are familiar with how tar works, most of this will hopefully be
-straightforward for you.  If not, then hopefully this module can teach
-you useful unix skills that may come in handy someday :)
-
-## Background
-
-A "tar file" or "tarball" is an archive of file system entries
-(directories, files, links, etc.)  The name comes from "tape archive".
-If you run `man tar` on almost any Unix command line, you'll learn
-quite a bit about what it can do, and its history.
-
-Tar has 5 main top-level commands:
-
-* `c` Create an archive
-* `r` Replace entries within an archive
-* `u` Update entries within an archive (ie, replace if they're newer)
-* `t` List out the contents of an archive
-* `x` Extract an archive to disk
-
-The other flags and options modify how this top level function works.
-
-## High-Level API
-
-These 5 functions are the high-level API.  All of them have a
-single-character name (for unix nerds familiar with `tar(1)`) as well
-as a long name (for everyone else).
-
-All the high-level functions take the following arguments, all three
-of which are optional and may be omitted.
-
-1. `options` - An optional object specifying various options
-2. `paths` - An array of paths to add or extract
-3. `callback` - Called when the command is completed, if async.  (If
-   sync or no file specified, providing a callback throws a
-   `TypeError`.)
-
-If the command is sync (ie, if `options.sync=true`), then the
-callback is not allowed, since the action will be completed immediately.
-
-If a `file` argument is specified, and the command is async, then a
-`Promise` is returned.  In this case, if async, a callback may be
-provided which is called when the command is completed.
-
-If a `file` option is not specified, then a stream is returned.  For
-`create`, this is a readable stream of the generated archive.  For
-`list` and `extract` this is a writable stream that an archive should
-be written into.  If a file is not specified, then a callback is not
-allowed, because you're already getting a stream to work with.
-
-`replace` and `update` only work on existing archives, and so require
-a `file` argument.
-
-Sync commands without a file argument return a stream that acts on its
-input immediately in the same tick.  For readable streams, this means
-that all of the data is immediately available by calling
-`stream.read()`.  For writable streams, it will be acted upon as soon
-as it is provided, but this can be at any time.
-
-### Warnings
-
-Some things cause tar to emit a warning, but should usually not cause
-the entire operation to fail.  There are three ways to handle
-warnings:
-
-1. **Ignore them** (default) Invalid entries won't be put in the
-   archive, and invalid entries won't be unpacked.  This is usually
-   fine, but can hide failures that you might care about.
-2. **Notice them**  Add an `onwarn` function to the options, or listen
-   to the `'warn'` event on any tar stream.  The function will get
-   called as `onwarn(message, data)`.  Handle as appropriate.
-3. **Explode them.**  Set `strict: true` in the options object, and
-   `warn` messages will be emitted as `'error'` events instead.  If
-   there's no `error` handler, this causes the program to crash.  If
-   used with a promise-returning/callback-taking method, then it'll
-   send the error to the promise/callback.
-
-### Examples
-
-The API mimics the `tar(1)` command line functionality, with aliases
-for more human-readable option and function names.  The goal is that
-if you know how to use `tar(1)` in Unix, then you know how to use
-`require('tar')` in JavaScript.
-
-To replicate `tar czf my-tarball.tgz files and folders`, you'd do:
-
-```js
-tar.c(
-  {
-    gzip: <true|gzip options>,
-    file: 'my-tarball.tgz'
-  },
-  ['some', 'files', 'and', 'folders']
-).then(_ => { .. tarball has been created .. })
-```
-
-To replicate `tar cz files and folders > my-tarball.tgz`, you'd do:
-
-```js
-tar.c( // or tar.create
-  {
-    gzip: <true|gzip options>
-  },
-  ['some', 'files', 'and', 'folders']
-).pipe(fs.createWriteStream('my-tarball.tgz'))
-```
-
-To replicate `tar xf my-tarball.tgz` you'd do:
-
-```js
-tar.x(  // or tar.extract(
-  {
-    file: 'my-tarball.tgz'
-  }
-).then(_=> { .. tarball has been dumped in cwd .. })
-```
-
-To replicate `cat my-tarball.tgz | tar x -C some-dir --strip=1`:
-
-```js
-fs.createReadStream('my-tarball.tgz').pipe(
-  tar.x({
-    strip: 1,
-    C: 'some-dir' // alias for cwd:'some-dir', also ok
-  })
-)
-```
-
-To replicate `tar tf my-tarball.tgz`, do this:
-
-```js
-tar.t({
-  file: 'my-tarball.tgz',
-  onentry: entry => { .. do whatever with it .. }
-})
-```
-
-To replicate `cat my-tarball.tgz | tar t` do:
-
-```js
-fs.createReadStream('my-tarball.tgz')
-  .pipe(tar.t())
-  .on('entry', entry => { .. do whatever with it .. })
-```
-
-To do anything synchronous, add `sync: true` to the options.  Note
-that sync functions don't take a callback and don't return a promise.
-When the function returns, it's already done.  Sync methods without a
-file argument return a sync stream, which flushes immediately.  But,
-of course, it still won't be done until you `.end()` it.
-
-To filter entries, add `filter: <function>` to the options.
-Tar-creating methods call the filter with `filter(path, stat)`.
-Tar-reading methods (including extraction) call the filter with
-`filter(path, entry)`.  The filter is called in the `this`-context of
-the `Pack` or `Unpack` stream object.
-
-The arguments list to `tar t` and `tar x` specify a list of filenames
-to extract or list, so they're equivalent to a filter that tests if
-the file is in the list.
-
-For those who _aren't_ fans of tar's single-character command names:
-
-```
-tar.c === tar.create
-tar.r === tar.replace (appends to archive, file is required)
-tar.u === tar.update (appends if newer, file is required)
-tar.x === tar.extract
-tar.t === tar.list
-```
-
-Keep reading for all the command descriptions and options, as well as
-the low-level API that they are built on.
-
-### tar.c(options, fileList, callback) [alias: tar.create]
-
-Create a tarball archive.
-
-The `fileList` is an array of paths to add to the tarball.  Adding a
-directory also adds its children recursively.
-
-An entry in `fileList` that starts with an `@` symbol is a tar archive
-whose entries will be added.  To add a file that starts with `@`,
-prepend it with `./`.
-
-The following options are supported:
-
-- `file` Write the tarball archive to the specified filename.  If this
-  is specified, then the callback will be fired when the file has been
-  written, and a promise will be returned that resolves when the file
-  is written.  If a filename is not specified, then a Readable Stream
-  will be returned which will emit the file data. [Alias: `f`]
-- `sync` Act synchronously.  If this is set, then any provided file
-  will be fully written after the call to `tar.c`.  If this is set,
-  and a file is not provided, then the resulting stream will already
-  have the data ready to `read` or `emit('data')` as soon as you
-  request it.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `cwd` The current working directory for creating the archive.
-  Defaults to `process.cwd()`.  [Alias: `C`]
-- `prefix` A path portion to prefix onto the entries in the archive.
-- `gzip` Set to any truthy value to create a gzipped archive, or an
-  object with settings for `zlib.Gzip()` [Alias: `z`]
-- `filter` A function that gets called with `(path, stat)` for each
-  entry being added.  Return `true` to add the entry to the archive,
-  or `false` to omit it.
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths. [Alias: `P`]
-- `mode` The mode to set on the created file archive
-- `noDirRecurse` Do not recursively archive the contents of
-  directories. [Alias: `n`]
-- `follow` Set to true to pack the targets of symbolic links.  Without
-  this option, symbolic links are archived as such. [Alias: `L`, `h`]
-- `noPax` Suppress pax extended headers.  Note that this means that
-  long paths and linkpaths will be truncated, and large or negative
-  numeric values may be interpreted incorrectly.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-  [Alias: `m`, `no-mtime`]
-- `mtime` Set to a `Date` object to force a specific `mtime` for
-  everything added to the archive.  Overridden by `noMtime`.
-
-
-The following options are mostly internal, but can be modified in some
-advanced use cases, such as re-using caches between runs.
-
-- `linkCache` A Map object containing the device and inode value for
-  any file whose nlink is > 1, to identify hard links.
-- `statCache` A Map object that caches calls `lstat`.
-- `readdirCache` A Map object that caches calls to `readdir`.
-- `jobs` A number specifying how many concurrent jobs to run.
-  Defaults to 4.
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 16 MB.
-
-### tar.x(options, fileList, callback) [alias: tar.extract]
-
-Extract a tarball archive.
-
-The `fileList` is an array of paths to extract from the tarball.  If
-no paths are provided, then all the entries are extracted.
-
-If the archive is gzipped, then tar will detect this and unzip it.
-
-Note that all directories that are created will be forced to be
-writable, readable, and listable by their owner, to avoid cases where
-a directory prevents extraction of child entries by virtue of its
-mode.
-
-Most extraction errors will cause a `warn` event to be emitted.  If
-the `cwd` is missing, or not a directory, then the extraction will
-fail completely.
-
-The following options are supported:
-
-- `cwd` Extract files relative to the specified directory.  Defaults
-  to `process.cwd()`.  If provided, this must exist and must be a
-  directory. [Alias: `C`]
-- `file` The archive file to extract.  If not specified, then a
-  Writable stream is returned where the archive data should be
-  written. [Alias: `f`]
-- `sync` Create files and directories synchronously.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `filter` A function that gets called with `(path, entry)` for each
-  entry being unpacked.  Return `true` to unpack the entry from the
-  archive, or `false` to skip it.
-- `newer` Set to true to keep the existing file on disk if it's newer
-  than the file in the archive. [Alias: `keep-newer`,
-  `keep-newer-files`]
-- `keep` Do not overwrite existing files.  In particular, if a file
-  appears more than once in an archive, later copies will not
-  overwrite earlier copies. [Alias: `k`, `keep-existing`]
-- `preservePaths` Allow absolute paths, paths containing `..`, and
-  extracting through symbolic links.  By default, `/` is stripped from
-  absolute paths, `..` paths are not extracted, and any file whose
-  location would be modified by a symbolic link is not extracted.
-  [Alias: `P`]
-- `unlink` Unlink files before creating them.  Without this option,
-  tar overwrites existing files, which preserves existing hardlinks.
-  With this option, existing hardlinks will be broken, as will any
-  symlink that would affect the location of an extracted file. [Alias:
-  `U`]
-- `strip` Remove the specified number of leading path elements.
-  Pathnames with fewer elements will be silently skipped.  Note that
-  the pathname is edited after applying the filter, but before
-  security checks. [Alias: `strip-components`, `stripComponents`]
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `preserveOwner` If true, tar will set the `uid` and `gid` of
-  extracted entries to the `uid` and `gid` fields in the archive.
-  This defaults to true when run as root, and false otherwise.  If
-  false, then files and directories will be set with the owner and
-  group of the user running the process.  This is similar to `-p` in
-  `tar(1)`, but ACLs and other system-specific data is never unpacked
-  in this implementation, and modes are set by default already.
-  [Alias: `p`]
-- `uid` Set to a number to force ownership of all extracted files and
-  folders, and all implicitly created directories, to be owned by the
-  specified user id, regardless of the `uid` field in the archive.
-  Cannot be used along with `preserveOwner`.  Requires also setting a
-  `gid` option.
-- `gid` Set to a number to force ownership of all extracted files and
-  folders, and all implicitly created directories, to be owned by the
-  specified group id, regardless of the `gid` field in the archive.
-  Cannot be used along with `preserveOwner`.  Requires also setting a
-  `uid` option.
-- `noMtime` Set to true to omit writing `mtime` value for extracted
-  entries. [Alias: `m`, `no-mtime`]
-- `transform` Provide a function that takes an `entry` object, and
-  returns a stream, or any falsey value.  If a stream is provided,
-  then that stream's data will be written instead of the contents of
-  the archive entry.  If a falsey value is provided, then the entry is
-  written to disk as normal.  (To exclude items from extraction, use
-  the `filter` option described above.)
-- `onentry` A function that gets called with `(entry)` for each entry
-  that passes the filter.
-
-The following options are mostly internal, but can be modified in some
-advanced use cases, such as re-using caches between runs.
-
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 16 MB.
-- `umask` Filter the modes of entries like `process.umask()`.
-- `dmode` Default mode for directories
-- `fmode` Default mode for files
-- `dirCache` A Map object of which directories exist.
-- `maxMetaEntrySize` The maximum size of meta entries that is
-  supported.  Defaults to 1 MB.
-
-Note that using an asynchronous stream type with the `transform`
-option will cause undefined behavior in sync extractions.
-[MiniPass](http://npm.im/minipass)-based streams are designed for this
-use case.
-
-### tar.t(options, fileList, callback) [alias: tar.list]
-
-List the contents of a tarball archive.
-
-The `fileList` is an array of paths to list from the tarball.  If
-no paths are provided, then all the entries are listed.
-
-If the archive is gzipped, then tar will detect this and unzip it.
-
-Returns an event emitter that emits `entry` events with
-`tar.ReadEntry` objects.  However, they don't emit `'data'` or `'end'`
-events.  (If you want to get actual readable entries, use the
-`tar.Parse` class instead.)
-
-The following options are supported:
-
-- `cwd` Extract files relative to the specified directory.  Defaults
-  to `process.cwd()`. [Alias: `C`]
-- `file` The archive file to list.  If not specified, then a
-  Writable stream is returned where the archive data should be
-  written. [Alias: `f`]
-- `sync` Read the specified file synchronously.  (This has no effect
-  when a file option isn't specified, because entries are emitted as
-  fast as they are parsed from the stream anyway.)
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `filter` A function that gets called with `(path, entry)` for each
-  entry being listed.  Return `true` to emit the entry from the
-  archive, or `false` to skip it.
-- `onentry` A function that gets called with `(entry)` for each entry
-  that passes the filter.  This is important for when both `file` and
-  `sync` are set, because it will be called synchronously.
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 16 MB.
-- `noResume` By default, `entry` streams are resumed immediately after
-  the call to `onentry`.  Set `noResume: true` to suppress this
-  behavior.  Note that by opting into this, the stream will never
-  complete until the entry data is consumed.
-
-### tar.u(options, fileList, callback) [alias: tar.update]
-
-Add files to an archive if they are newer than the entry already in
-the tarball archive.
-
-The `fileList` is an array of paths to add to the tarball.  Adding a
-directory also adds its children recursively.
-
-An entry in `fileList` that starts with an `@` symbol is a tar archive
-whose entries will be added.  To add a file that starts with `@`,
-prepend it with `./`.
-
-The following options are supported:
-
-- `file` Required. Write the tarball archive to the specified
-  filename. [Alias: `f`]
-- `sync` Act synchronously.  If this is set, then any provided file
-  will be fully written after the call to `tar.c`.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `cwd` The current working directory for adding entries to the
-  archive.  Defaults to `process.cwd()`.  [Alias: `C`]
-- `prefix` A path portion to prefix onto the entries in the archive.
-- `gzip` Set to any truthy value to create a gzipped archive, or an
-  object with settings for `zlib.Gzip()` [Alias: `z`]
-- `filter` A function that gets called with `(path, stat)` for each
-  entry being added.  Return `true` to add the entry to the archive,
-  or `false` to omit it.
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths. [Alias: `P`]
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 16 MB.
-- `noDirRecurse` Do not recursively archive the contents of
-  directories. [Alias: `n`]
-- `follow` Set to true to pack the targets of symbolic links.  Without
-  this option, symbolic links are archived as such. [Alias: `L`, `h`]
-- `noPax` Suppress pax extended headers.  Note that this means that
-  long paths and linkpaths will be truncated, and large or negative
-  numeric values may be interpreted incorrectly.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-  [Alias: `m`, `no-mtime`]
-- `mtime` Set to a `Date` object to force a specific `mtime` for
-  everything added to the archive.  Overridden by `noMtime`.
-
-### tar.r(options, fileList, callback) [alias: tar.replace]
-
-Add files to an existing archive.  Because later entries override
-earlier entries, this effectively replaces any existing entries.
-
-The `fileList` is an array of paths to add to the tarball.  Adding a
-directory also adds its children recursively.
-
-An entry in `fileList` that starts with an `@` symbol is a tar archive
-whose entries will be added.  To add a file that starts with `@`,
-prepend it with `./`.
-
-The following options are supported:
-
-- `file` Required. Write the tarball archive to the specified
-  filename. [Alias: `f`]
-- `sync` Act synchronously.  If this is set, then any provided file
-  will be fully written after the call to `tar.c`.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `cwd` The current working directory for adding entries to the
-  archive.  Defaults to `process.cwd()`.  [Alias: `C`]
-- `prefix` A path portion to prefix onto the entries in the archive.
-- `gzip` Set to any truthy value to create a gzipped archive, or an
-  object with settings for `zlib.Gzip()` [Alias: `z`]
-- `filter` A function that gets called with `(path, stat)` for each
-  entry being added.  Return `true` to add the entry to the archive,
-  or `false` to omit it.
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths. [Alias: `P`]
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 16 MB.
-- `noDirRecurse` Do not recursively archive the contents of
-  directories. [Alias: `n`]
-- `follow` Set to true to pack the targets of symbolic links.  Without
-  this option, symbolic links are archived as such. [Alias: `L`, `h`]
-- `noPax` Suppress pax extended headers.  Note that this means that
-  long paths and linkpaths will be truncated, and large or negative
-  numeric values may be interpreted incorrectly.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-  [Alias: `m`, `no-mtime`]
-- `mtime` Set to a `Date` object to force a specific `mtime` for
-  everything added to the archive.  Overridden by `noMtime`.
-
-
-## Low-Level API
-
-### class tar.Pack
-
-A readable tar stream.
-
-Has all the standard readable stream interface stuff.  `'data'` and
-`'end'` events, `read()` method, `pause()` and `resume()`, etc.
-
-#### constructor(options)
-
-The following options are supported:
-
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `cwd` The current working directory for creating the archive.
-  Defaults to `process.cwd()`.
-- `prefix` A path portion to prefix onto the entries in the archive.
-- `gzip` Set to any truthy value to create a gzipped archive, or an
-  object with settings for `zlib.Gzip()`
-- `filter` A function that gets called with `(path, stat)` for each
-  entry being added.  Return `true` to add the entry to the archive,
-  or `false` to omit it.
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths.
-- `linkCache` A Map object containing the device and inode value for
-  any file whose nlink is > 1, to identify hard links.
-- `statCache` A Map object that caches calls `lstat`.
-- `readdirCache` A Map object that caches calls to `readdir`.
-- `jobs` A number specifying how many concurrent jobs to run.
-  Defaults to 4.
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 16 MB.
-- `noDirRecurse` Do not recursively archive the contents of
-  directories.
-- `follow` Set to true to pack the targets of symbolic links.  Without
-  this option, symbolic links are archived as such.
-- `noPax` Suppress pax extended headers.  Note that this means that
-  long paths and linkpaths will be truncated, and large or negative
-  numeric values may be interpreted incorrectly.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-- `mtime` Set to a `Date` object to force a specific `mtime` for
-  everything added to the archive.  Overridden by `noMtime`.
-
-#### add(path)
-
-Adds an entry to the archive.  Returns the Pack stream.
-
-#### write(path)
-
-Adds an entry to the archive.  Returns true if flushed.
-
-#### end()
-
-Finishes the archive.
-
-### class tar.Pack.Sync
-
-Synchronous version of `tar.Pack`.
-
-### class tar.Unpack
-
-A writable stream that unpacks a tar archive onto the file system.
-
-All the normal writable stream stuff is supported.  `write()` and
-`end()` methods, `'drain'` events, etc.
-
-Note that all directories that are created will be forced to be
-writable, readable, and listable by their owner, to avoid cases where
-a directory prevents extraction of child entries by virtue of its
-mode.
-
-`'close'` is emitted when it's done writing stuff to the file system.
-
-Most unpack errors will cause a `warn` event to be emitted.  If the
-`cwd` is missing, or not a directory, then an error will be emitted.
-
-#### constructor(options)
-
-- `cwd` Extract files relative to the specified directory.  Defaults
-  to `process.cwd()`.  If provided, this must exist and must be a
-  directory.
-- `filter` A function that gets called with `(path, entry)` for each
-  entry being unpacked.  Return `true` to unpack the entry from the
-  archive, or `false` to skip it.
-- `newer` Set to true to keep the existing file on disk if it's newer
-  than the file in the archive.
-- `keep` Do not overwrite existing files.  In particular, if a file
-  appears more than once in an archive, later copies will not
-  overwrite earlier copies.
-- `preservePaths` Allow absolute paths, paths containing `..`, and
-  extracting through symbolic links.  By default, `/` is stripped from
-  absolute paths, `..` paths are not extracted, and any file whose
-  location would be modified by a symbolic link is not extracted.
-- `unlink` Unlink files before creating them.  Without this option,
-  tar overwrites existing files, which preserves existing hardlinks.
-  With this option, existing hardlinks will be broken, as will any
-  symlink that would affect the location of an extracted file.
-- `strip` Remove the specified number of leading path elements.
-  Pathnames with fewer elements will be silently skipped.  Note that
-  the pathname is edited after applying the filter, but before
-  security checks.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `umask` Filter the modes of entries like `process.umask()`.
-- `dmode` Default mode for directories
-- `fmode` Default mode for files
-- `dirCache` A Map object of which directories exist.
-- `maxMetaEntrySize` The maximum size of meta entries that is
-  supported.  Defaults to 1 MB.
-- `preserveOwner` If true, tar will set the `uid` and `gid` of
-  extracted entries to the `uid` and `gid` fields in the archive.
-  This defaults to true when run as root, and false otherwise.  If
-  false, then files and directories will be set with the owner and
-  group of the user running the process.  This is similar to `-p` in
-  `tar(1)`, but ACLs and other system-specific data is never unpacked
-  in this implementation, and modes are set by default already.
-- `win32` True if on a windows platform.  Causes behavior where
-  filenames containing `<|>?` chars are converted to
-  windows-compatible values while being unpacked.
-- `uid` Set to a number to force ownership of all extracted files and
-  folders, and all implicitly created directories, to be owned by the
-  specified user id, regardless of the `uid` field in the archive.
-  Cannot be used along with `preserveOwner`.  Requires also setting a
-  `gid` option.
-- `gid` Set to a number to force ownership of all extracted files and
-  folders, and all implicitly created directories, to be owned by the
-  specified group id, regardless of the `gid` field in the archive.
-  Cannot be used along with `preserveOwner`.  Requires also setting a
-  `uid` option.
-- `noMtime` Set to true to omit writing `mtime` value for extracted
-  entries.
-- `transform` Provide a function that takes an `entry` object, and
-  returns a stream, or any falsey value.  If a stream is provided,
-  then that stream's data will be written instead of the contents of
-  the archive entry.  If a falsey value is provided, then the entry is
-  written to disk as normal.  (To exclude items from extraction, use
-  the `filter` option described above.)
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `onentry` A function that gets called with `(entry)` for each entry
-  that passes the filter.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-
-### class tar.Unpack.Sync
-
-Synchronous version of `tar.Unpack`.
-
-Note that using an asynchronous stream type with the `transform`
-option will cause undefined behavior in sync unpack streams.
-[MiniPass](http://npm.im/minipass)-based streams are designed for this
-use case.
-
-### class tar.Parse
-
-A writable stream that parses a tar archive stream.  All the standard
-writable stream stuff is supported.
-
-If the archive is gzipped, then tar will detect this and unzip it.
-
-Emits `'entry'` events with `tar.ReadEntry` objects, which are
-themselves readable streams that you can pipe wherever.
-
-Each `entry` will not emit until the one before it is flushed through,
-so make sure to either consume the data (with `on('data', ...)` or
-`.pipe(...)`) or throw it away with `.resume()` to keep the stream
-flowing.
-
-#### constructor(options)
-
-Returns an event emitter that emits `entry` events with
-`tar.ReadEntry` objects.
-
-The following options are supported:
-
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `filter` A function that gets called with `(path, entry)` for each
-  entry being listed.  Return `true` to emit the entry from the
-  archive, or `false` to skip it.
-- `onentry` A function that gets called with `(entry)` for each entry
-  that passes the filter.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-
-#### abort(message, error)
-
-Stop all parsing activities.  This is called when there are zlib
-errors.  It also emits a warning with the message and error provided.
-
-### class tar.ReadEntry extends [MiniPass](http://npm.im/minipass)
-
-A representation of an entry that is being read out of a tar archive.
-
-It has the following fields:
-
-- `extended` The extended metadata object provided to the constructor.
-- `globalExtended` The global extended metadata object provided to the
-  constructor.
-- `remain` The number of bytes remaining to be written into the
-  stream.
-- `blockRemain` The number of 512-byte blocks remaining to be written
-  into the stream.
-- `ignore` Whether this entry should be ignored.
-- `meta` True if this represents metadata about the next entry, false
-  if it represents a filesystem object.
-- All the fields from the header, extended header, and global extended
-  header are added to the ReadEntry object.  So it has `path`, `type`,
-  `size, `mode`, and so on.
-
-#### constructor(header, extended, globalExtended)
-
-Create a new ReadEntry object with the specified header, extended
-header, and global extended header values.
-
-### class tar.WriteEntry extends [MiniPass](http://npm.im/minipass)
-
-A representation of an entry that is being written from the file
-system into a tar archive.
-
-Emits data for the Header, and for the Pax Extended Header if one is
-required, as well as any body data.
-
-Creating a WriteEntry for a directory does not also create
-WriteEntry objects for all of the directory contents.
-
-It has the following fields:
-
-- `path` The path field that will be written to the archive.  By
-  default, this is also the path from the cwd to the file system
-  object.
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `myuid` If supported, the uid of the user running the current
-  process.
-- `myuser` The `env.USER` string if set, or `''`.  Set as the entry
-  `uname` field if the file's `uid` matches `this.myuid`.
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 1 MB.
-- `linkCache` A Map object containing the device and inode value for
-  any file whose nlink is > 1, to identify hard links.
-- `statCache` A Map object that caches calls `lstat`.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths.
-- `cwd` The current working directory for creating the archive.
-  Defaults to `process.cwd()`.
-- `absolute` The absolute path to the entry on the filesystem.  By
-  default, this is `path.resolve(this.cwd, this.path)`, but it can be
-  overridden explicitly.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `win32` True if on a windows platform.  Causes behavior where paths
-  replace `\` with `/` and filenames containing the windows-compatible
-  forms of `<|>?:` characters are converted to actual `<|>?:` characters
-  in the archive.
-- `noPax` Suppress pax extended headers.  Note that this means that
-  long paths and linkpaths will be truncated, and large or negative
-  numeric values may be interpreted incorrectly.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-
-
-#### constructor(path, options)
-
-`path` is the path of the entry as it is written in the archive.
-
-The following options are supported:
-
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `maxReadSize` The maximum buffer size for `fs.read()` operations.
-  Defaults to 1 MB.
-- `linkCache` A Map object containing the device and inode value for
-  any file whose nlink is > 1, to identify hard links.
-- `statCache` A Map object that caches calls `lstat`.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths.
-- `cwd` The current working directory for creating the archive.
-  Defaults to `process.cwd()`.
-- `absolute` The absolute path to the entry on the filesystem.  By
-  default, this is `path.resolve(this.cwd, this.path)`, but it can be
-  overridden explicitly.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `win32` True if on a windows platform.  Causes behavior where paths
-  replace `\` with `/`.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-- `umask` Set to restrict the modes on the entries in the archive,
-  somewhat like how umask works on file creation.  Defaults to
-  `process.umask()` on unix systems, or `0o22` on Windows.
-
-#### warn(message, data)
-
-If strict, emit an error with the provided message.
-
-Othewise, emit a `'warn'` event with the provided message and data.
-
-### class tar.WriteEntry.Sync
-
-Synchronous version of tar.WriteEntry
-
-### class tar.WriteEntry.Tar
-
-A version of tar.WriteEntry that gets its data from a tar.ReadEntry
-instead of from the filesystem.
-
-#### constructor(readEntry, options)
-
-`readEntry` is the entry being read out of another archive.
-
-The following options are supported:
-
-- `portable` Omit metadata that is system-specific: `ctime`, `atime`,
-  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note
-  that `mtime` is still included, because this is necessary other
-  time-based operations.
-- `preservePaths` Allow absolute paths.  By default, `/` is stripped
-  from absolute paths.
-- `strict` Treat warnings as crash-worthy errors.  Default false.
-- `onwarn` A function that will get called with `(message, data)` for
-  any warnings encountered.
-- `noMtime` Set to true to omit writing `mtime` values for entries.
-  Note that this prevents using other mtime-based features like
-  `tar.update` or the `keepNewer` option with the resulting tar archive.
-
-### class tar.Header
-
-A class for reading and writing header blocks.
-
-It has the following fields:
-
-- `nullBlock` True if decoding a block which is entirely composed of
-  `0x00` null bytes.  (Useful because tar files are terminated by
-  at least 2 null blocks.)
-- `cksumValid` True if the checksum in the header is valid, false
-  otherwise.
-- `needPax` True if the values, as encoded, will require a Pax
-  extended header.
-- `path` The path of the entry.
-- `mode` The 4 lowest-order octal digits of the file mode.  That is,
-  read/write/execute permissions for world, group, and owner, and the
-  setuid, setgid, and sticky bits.
-- `uid` Numeric user id of the file owner
-- `gid` Numeric group id of the file owner
-- `size` Size of the file in bytes
-- `mtime` Modified time of the file
-- `cksum` The checksum of the header.  This is generated by adding all
-  the bytes of the header block, treating the checksum field itself as
-  all ascii space characters (that is, `0x20`).
-- `type` The human-readable name of the type of entry this represents,
-  or the alphanumeric key if unknown.
-- `typeKey` The alphanumeric key for the type of entry this header
-  represents.
-- `linkpath` The target of Link and SymbolicLink entries.
-- `uname` Human-readable user name of the file owner
-- `gname` Human-readable group name of the file owner
-- `devmaj` The major portion of the device number.  Always `0` for
-  files, directories, and links.
-- `devmin` The minor portion of the device number.  Always `0` for
-  files, directories, and links.
-- `atime` File access time.
-- `ctime` File change time.
-
-#### constructor(data, [offset=0])
-
-`data` is optional.  It is either a Buffer that should be interpreted
-as a tar Header starting at the specified offset and continuing for
-512 bytes, or a data object of keys and values to set on the header
-object, and eventually encode as a tar Header.
-
-#### decode(block, offset)
-
-Decode the provided buffer starting at the specified offset.
-
-Buffer length must be greater than 512 bytes.
-
-#### set(data)
-
-Set the fields in the data object.
-
-#### encode(buffer, offset)
-
-Encode the header fields into the buffer at the specified offset.
-
-Returns `this.needPax` to indicate whether a Pax Extended Header is
-required to properly encode the specified data.
-
-### class tar.Pax
-
-An object representing a set of key-value pairs in an Pax extended
-header entry.
-
-It has the following fields.  Where the same name is used, they have
-the same semantics as the tar.Header field of the same name.
-
-- `global` True if this represents a global extended header, or false
-  if it is for a single entry.
-- `atime`
-- `charset`
-- `comment`
-- `ctime`
-- `gid`
-- `gname`
-- `linkpath`
-- `mtime`
-- `path`
-- `size`
-- `uid`
-- `uname`
-- `dev`
-- `ino`
-- `nlink`
-
-#### constructor(object, global)
-
-Set the fields set in the object.  `global` is a boolean that defaults
-to false.
-
-#### encode()
-
-Return a Buffer containing the header and body for the Pax extended
-header entry, or `null` if there is nothing to encode.
-
-#### encodeBody()
-
-Return a string representing the body of the pax extended header
-entry.
-
-#### encodeField(fieldName)
-
-Return a string representing the key/value encoding for the specified
-fieldName, or `''` if the field is unset.
-
-### tar.Pax.parse(string, extended, global)
-
-Return a new Pax object created by parsing the contents of the string
-provided.
-
-If the `extended` object is set, then also add the fields from that
-object.  (This is necessary because multiple metadata entries can
-occur in sequence.)
-
-### tar.types
-
-A translation table for the `type` field in tar headers.
-
-#### tar.types.name.get(code)
-
-Get the human-readable name for a given alphanumeric code.
-
-#### tar.types.code.get(name)
-
-Get the alphanumeric code for a given human-readable name.
diff --git a/legacy-libs/grpc/node_modules/tar/index.js b/legacy-libs/grpc/node_modules/tar/index.js
deleted file mode 100644 (file)
index c9ae06e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-
-// high-level commands
-exports.c = exports.create = require('./lib/create.js')
-exports.r = exports.replace = require('./lib/replace.js')
-exports.t = exports.list = require('./lib/list.js')
-exports.u = exports.update = require('./lib/update.js')
-exports.x = exports.extract = require('./lib/extract.js')
-
-// classes
-exports.Pack = require('./lib/pack.js')
-exports.Unpack = require('./lib/unpack.js')
-exports.Parse = require('./lib/parse.js')
-exports.ReadEntry = require('./lib/read-entry.js')
-exports.WriteEntry = require('./lib/write-entry.js')
-exports.Header = require('./lib/header.js')
-exports.Pax = require('./lib/pax.js')
-exports.types = require('./lib/types.js')
diff --git a/legacy-libs/grpc/node_modules/tar/lib/buffer.js b/legacy-libs/grpc/node_modules/tar/lib/buffer.js
deleted file mode 100644 (file)
index 7876d5b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-// Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from
-// or Buffer.alloc, and Buffer in node 10 deprecated the ctor.
-// .M, this is fine .\^/M..
-let B = Buffer
-/* istanbul ignore next */
-if (!B.alloc) {
-  B = require('safe-buffer').Buffer
-}
-module.exports = B
diff --git a/legacy-libs/grpc/node_modules/tar/lib/create.js b/legacy-libs/grpc/node_modules/tar/lib/create.js
deleted file mode 100644 (file)
index a37aa52..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-'use strict'
-
-// tar -c
-const hlo = require('./high-level-opt.js')
-
-const Pack = require('./pack.js')
-const fs = require('fs')
-const fsm = require('fs-minipass')
-const t = require('./list.js')
-const path = require('path')
-
-const c = module.exports = (opt_, files, cb) => {
-  if (typeof files === 'function')
-    cb = files
-
-  if (Array.isArray(opt_))
-    files = opt_, opt_ = {}
-
-  if (!files || !Array.isArray(files) || !files.length)
-    throw new TypeError('no files or directories specified')
-
-  files = Array.from(files)
-
-  const opt = hlo(opt_)
-
-  if (opt.sync && typeof cb === 'function')
-    throw new TypeError('callback not supported for sync tar functions')
-
-  if (!opt.file && typeof cb === 'function')
-    throw new TypeError('callback only supported with file option')
-
-  return opt.file && opt.sync ? createFileSync(opt, files)
-    : opt.file ? createFile(opt, files, cb)
-    : opt.sync ? createSync(opt, files)
-    : create(opt, files)
-}
-
-const createFileSync = (opt, files) => {
-  const p = new Pack.Sync(opt)
-  const stream = new fsm.WriteStreamSync(opt.file, {
-    mode: opt.mode || 0o666
-  })
-  p.pipe(stream)
-  addFilesSync(p, files)
-}
-
-const createFile = (opt, files, cb) => {
-  const p = new Pack(opt)
-  const stream = new fsm.WriteStream(opt.file, {
-    mode: opt.mode || 0o666
-  })
-  p.pipe(stream)
-
-  const promise = new Promise((res, rej) => {
-    stream.on('error', rej)
-    stream.on('close', res)
-    p.on('error', rej)
-  })
-
-  addFilesAsync(p, files)
-
-  return cb ? promise.then(cb, cb) : promise
-}
-
-const addFilesSync = (p, files) => {
-  files.forEach(file => {
-    if (file.charAt(0) === '@')
-      t({
-        file: path.resolve(p.cwd, file.substr(1)),
-        sync: true,
-        noResume: true,
-        onentry: entry => p.add(entry)
-      })
-    else
-      p.add(file)
-  })
-  p.end()
-}
-
-const addFilesAsync = (p, files) => {
-  while (files.length) {
-    const file = files.shift()
-    if (file.charAt(0) === '@')
-      return t({
-        file: path.resolve(p.cwd, file.substr(1)),
-        noResume: true,
-        onentry: entry => p.add(entry)
-      }).then(_ => addFilesAsync(p, files))
-    else
-      p.add(file)
-  }
-  p.end()
-}
-
-const createSync = (opt, files) => {
-  const p = new Pack.Sync(opt)
-  addFilesSync(p, files)
-  return p
-}
-
-const create = (opt, files) => {
-  const p = new Pack(opt)
-  addFilesAsync(p, files)
-  return p
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/extract.js b/legacy-libs/grpc/node_modules/tar/lib/extract.js
deleted file mode 100644 (file)
index cbb458a..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-'use strict'
-
-// tar -x
-const hlo = require('./high-level-opt.js')
-const Unpack = require('./unpack.js')
-const fs = require('fs')
-const fsm = require('fs-minipass')
-const path = require('path')
-
-const x = module.exports = (opt_, files, cb) => {
-  if (typeof opt_ === 'function')
-    cb = opt_, files = null, opt_ = {}
-  else if (Array.isArray(opt_))
-    files = opt_, opt_ = {}
-
-  if (typeof files === 'function')
-    cb = files, files = null
-
-  if (!files)
-    files = []
-  else
-    files = Array.from(files)
-
-  const opt = hlo(opt_)
-
-  if (opt.sync && typeof cb === 'function')
-    throw new TypeError('callback not supported for sync tar functions')
-
-  if (!opt.file && typeof cb === 'function')
-    throw new TypeError('callback only supported with file option')
-
-  if (files.length)
-    filesFilter(opt, files)
-
-  return opt.file && opt.sync ? extractFileSync(opt)
-    : opt.file ? extractFile(opt, cb)
-    : opt.sync ? extractSync(opt)
-    : extract(opt)
-}
-
-// construct a filter that limits the file entries listed
-// include child entries if a dir is included
-const filesFilter = (opt, files) => {
-  const map = new Map(files.map(f => [f.replace(/\/+$/, ''), true]))
-  const filter = opt.filter
-
-  const mapHas = (file, r) => {
-    const root = r || path.parse(file).root || '.'
-    const ret = file === root ? false
-      : map.has(file) ? map.get(file)
-      : mapHas(path.dirname(file), root)
-
-    map.set(file, ret)
-    return ret
-  }
-
-  opt.filter = filter
-    ? (file, entry) => filter(file, entry) && mapHas(file.replace(/\/+$/, ''))
-    : file => mapHas(file.replace(/\/+$/, ''))
-}
-
-const extractFileSync = opt => {
-  const u = new Unpack.Sync(opt)
-
-  const file = opt.file
-  let threw = true
-  let fd
-  const stat = fs.statSync(file)
-  // This trades a zero-byte read() syscall for a stat
-  // However, it will usually result in less memory allocation
-  const readSize = opt.maxReadSize || 16*1024*1024
-  const stream = new fsm.ReadStreamSync(file, {
-    readSize: readSize,
-    size: stat.size
-  })
-  stream.pipe(u)
-}
-
-const extractFile = (opt, cb) => {
-  const u = new Unpack(opt)
-  const readSize = opt.maxReadSize || 16*1024*1024
-
-  const file = opt.file
-  const p = new Promise((resolve, reject) => {
-    u.on('error', reject)
-    u.on('close', resolve)
-
-    // This trades a zero-byte read() syscall for a stat
-    // However, it will usually result in less memory allocation
-    fs.stat(file, (er, stat) => {
-      if (er)
-        reject(er)
-      else {
-        const stream = new fsm.ReadStream(file, {
-          readSize: readSize,
-          size: stat.size
-        })
-        stream.on('error', reject)
-        stream.pipe(u)
-      }
-    })
-  })
-  return cb ? p.then(cb, cb) : p
-}
-
-const extractSync = opt => {
-  return new Unpack.Sync(opt)
-}
-
-const extract = opt => {
-  return new Unpack(opt)
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/header.js b/legacy-libs/grpc/node_modules/tar/lib/header.js
deleted file mode 100644 (file)
index d29c3b9..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-'use strict'
-// parse a 512-byte header block to a data object, or vice-versa
-// encode returns `true` if a pax extended header is needed, because
-// the data could not be faithfully encoded in a simple header.
-// (Also, check header.needPax to see if it needs a pax header.)
-
-const Buffer = require('./buffer.js')
-const types = require('./types.js')
-const pathModule = require('path').posix
-const large = require('./large-numbers.js')
-
-const SLURP = Symbol('slurp')
-const TYPE = Symbol('type')
-
-class Header {
-  constructor (data, off, ex, gex) {
-    this.cksumValid = false
-    this.needPax = false
-    this.nullBlock = false
-
-    this.block = null
-    this.path = null
-    this.mode = null
-    this.uid = null
-    this.gid = null
-    this.size = null
-    this.mtime = null
-    this.cksum = null
-    this[TYPE] = '0'
-    this.linkpath = null
-    this.uname = null
-    this.gname = null
-    this.devmaj = 0
-    this.devmin = 0
-    this.atime = null
-    this.ctime = null
-
-    if (Buffer.isBuffer(data))
-      this.decode(data, off || 0, ex, gex)
-    else if (data)
-      this.set(data)
-  }
-
-  decode (buf, off, ex, gex) {
-    if (!off)
-      off = 0
-
-    if (!buf || !(buf.length >= off + 512))
-      throw new Error('need 512 bytes for header')
-
-    this.path = decString(buf, off, 100)
-    this.mode = decNumber(buf, off + 100, 8)
-    this.uid = decNumber(buf, off + 108, 8)
-    this.gid = decNumber(buf, off + 116, 8)
-    this.size = decNumber(buf, off + 124, 12)
-    this.mtime = decDate(buf, off + 136, 12)
-    this.cksum = decNumber(buf, off + 148, 12)
-
-    // if we have extended or global extended headers, apply them now
-    // See https://github.com/npm/node-tar/pull/187
-    this[SLURP](ex)
-    this[SLURP](gex, true)
-
-    // old tar versions marked dirs as a file with a trailing /
-    this[TYPE] = decString(buf, off + 156, 1)
-    if (this[TYPE] === '')
-      this[TYPE] = '0'
-    if (this[TYPE] === '0' && this.path.substr(-1) === '/')
-      this[TYPE] = '5'
-
-    // tar implementations sometimes incorrectly put the stat(dir).size
-    // as the size in the tarball, even though Directory entries are
-    // not able to have any body at all.  In the very rare chance that
-    // it actually DOES have a body, we weren't going to do anything with
-    // it anyway, and it'll just be a warning about an invalid header.
-    if (this[TYPE] === '5')
-      this.size = 0
-
-    this.linkpath = decString(buf, off + 157, 100)
-    if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') {
-      this.uname = decString(buf, off + 265, 32)
-      this.gname = decString(buf, off + 297, 32)
-      this.devmaj = decNumber(buf, off + 329, 8)
-      this.devmin = decNumber(buf, off + 337, 8)
-      if (buf[off + 475] !== 0) {
-        // definitely a prefix, definitely >130 chars.
-        const prefix = decString(buf, off + 345, 155)
-        this.path = prefix + '/' + this.path
-      } else {
-        const prefix = decString(buf, off + 345, 130)
-        if (prefix)
-          this.path = prefix + '/' + this.path
-        this.atime = decDate(buf, off + 476, 12)
-        this.ctime = decDate(buf, off + 488, 12)
-      }
-    }
-
-    let sum = 8 * 0x20
-    for (let i = off; i < off + 148; i++) {
-      sum += buf[i]
-    }
-    for (let i = off + 156; i < off + 512; i++) {
-      sum += buf[i]
-    }
-    this.cksumValid = sum === this.cksum
-    if (this.cksum === null && sum === 8 * 0x20)
-      this.nullBlock = true
-  }
-
-  [SLURP] (ex, global) {
-    for (let k in ex) {
-      // we slurp in everything except for the path attribute in
-      // a global extended header, because that's weird.
-      if (ex[k] !== null && ex[k] !== undefined &&
-          !(global && k === 'path'))
-        this[k] = ex[k]
-    }
-  }
-
-  encode (buf, off) {
-    if (!buf) {
-      buf = this.block = Buffer.alloc(512)
-      off = 0
-    }
-
-    if (!off)
-      off = 0
-
-    if (!(buf.length >= off + 512))
-      throw new Error('need 512 bytes for header')
-
-    const prefixSize = this.ctime || this.atime ? 130 : 155
-    const split = splitPrefix(this.path || '', prefixSize)
-    const path = split[0]
-    const prefix = split[1]
-    this.needPax = split[2]
-
-    this.needPax = encString(buf, off, 100, path) || this.needPax
-    this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax
-    this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax
-    this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax
-    this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax
-    this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax
-    buf[off + 156] = this[TYPE].charCodeAt(0)
-    this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax
-    buf.write('ustar\u000000', off + 257, 8)
-    this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax
-    this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax
-    this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax
-    this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax
-    this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax
-    if (buf[off + 475] !== 0)
-      this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax
-    else {
-      this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax
-      this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax
-      this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax
-    }
-
-    let sum = 8 * 0x20
-    for (let i = off; i < off + 148; i++) {
-      sum += buf[i]
-    }
-    for (let i = off + 156; i < off + 512; i++) {
-      sum += buf[i]
-    }
-    this.cksum = sum
-    encNumber(buf, off + 148, 8, this.cksum)
-    this.cksumValid = true
-
-    return this.needPax
-  }
-
-  set (data) {
-    for (let i in data) {
-      if (data[i] !== null && data[i] !== undefined)
-        this[i] = data[i]
-    }
-  }
-
-  get type () {
-    return types.name.get(this[TYPE]) || this[TYPE]
-  }
-
-  get typeKey () {
-    return this[TYPE]
-  }
-
-  set type (type) {
-    if (types.code.has(type))
-      this[TYPE] = types.code.get(type)
-    else
-      this[TYPE] = type
-  }
-}
-
-const splitPrefix = (p, prefixSize) => {
-  const pathSize = 100
-  let pp = p
-  let prefix = ''
-  let ret
-  const root = pathModule.parse(p).root || '.'
-
-  if (Buffer.byteLength(pp) < pathSize)
-    ret = [pp, prefix, false]
-  else {
-    // first set prefix to the dir, and path to the base
-    prefix = pathModule.dirname(pp)
-    pp = pathModule.basename(pp)
-
-    do {
-      // both fit!
-      if (Buffer.byteLength(pp) <= pathSize &&
-          Buffer.byteLength(prefix) <= prefixSize)
-        ret = [pp, prefix, false]
-
-      // prefix fits in prefix, but path doesn't fit in path
-      else if (Buffer.byteLength(pp) > pathSize &&
-          Buffer.byteLength(prefix) <= prefixSize)
-        ret = [pp.substr(0, pathSize - 1), prefix, true]
-
-      else {
-        // make path take a bit from prefix
-        pp = pathModule.join(pathModule.basename(prefix), pp)
-        prefix = pathModule.dirname(prefix)
-      }
-    } while (prefix !== root && !ret)
-
-    // at this point, found no resolution, just truncate
-    if (!ret)
-      ret = [p.substr(0, pathSize - 1), '', true]
-  }
-  return ret
-}
-
-const decString = (buf, off, size) =>
-  buf.slice(off, off + size).toString('utf8').replace(/\0.*/, '')
-
-const decDate = (buf, off, size) =>
-  numToDate(decNumber(buf, off, size))
-
-const numToDate = num => num === null ? null : new Date(num * 1000)
-
-const decNumber = (buf, off, size) =>
-  buf[off] & 0x80 ? large.parse(buf.slice(off, off + size))
-    : decSmallNumber(buf, off, size)
-
-const nanNull = value => isNaN(value) ? null : value
-
-const decSmallNumber = (buf, off, size) =>
-  nanNull(parseInt(
-    buf.slice(off, off + size)
-      .toString('utf8').replace(/\0.*$/, '').trim(), 8))
-
-// the maximum encodable as a null-terminated octal, by field size
-const MAXNUM = {
-  12: 0o77777777777,
-  8 : 0o7777777
-}
-
-const encNumber = (buf, off, size, number) =>
-  number === null ? false :
-  number > MAXNUM[size] || number < 0
-    ? (large.encode(number, buf.slice(off, off + size)), true)
-    : (encSmallNumber(buf, off, size, number), false)
-
-const encSmallNumber = (buf, off, size, number) =>
-  buf.write(octalString(number, size), off, size, 'ascii')
-
-const octalString = (number, size) =>
-  padOctal(Math.floor(number).toString(8), size)
-
-const padOctal = (string, size) =>
-  (string.length === size - 1 ? string
-  : new Array(size - string.length - 1).join('0') + string + ' ') + '\0'
-
-const encDate = (buf, off, size, date) =>
-  date === null ? false :
-  encNumber(buf, off, size, date.getTime() / 1000)
-
-// enough to fill the longest string we've got
-const NULLS = new Array(156).join('\0')
-// pad with nulls, return true if it's longer or non-ascii
-const encString = (buf, off, size, string) =>
-  string === null ? false :
-  (buf.write(string + NULLS, off, size, 'utf8'),
-   string.length !== Buffer.byteLength(string) || string.length > size)
-
-module.exports = Header
diff --git a/legacy-libs/grpc/node_modules/tar/lib/high-level-opt.js b/legacy-libs/grpc/node_modules/tar/lib/high-level-opt.js
deleted file mode 100644 (file)
index 7333db9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-'use strict'
-
-// turn tar(1) style args like `C` into the more verbose things like `cwd`
-
-const argmap = new Map([
-  ['C', 'cwd'],
-  ['f', 'file'],
-  ['z', 'gzip'],
-  ['P', 'preservePaths'],
-  ['U', 'unlink'],
-  ['strip-components', 'strip'],
-  ['stripComponents', 'strip'],
-  ['keep-newer', 'newer'],
-  ['keepNewer', 'newer'],
-  ['keep-newer-files', 'newer'],
-  ['keepNewerFiles', 'newer'],
-  ['k', 'keep'],
-  ['keep-existing', 'keep'],
-  ['keepExisting', 'keep'],
-  ['m', 'noMtime'],
-  ['no-mtime', 'noMtime'],
-  ['p', 'preserveOwner'],
-  ['L', 'follow'],
-  ['h', 'follow']
-])
-
-const parse = module.exports = opt => opt ? Object.keys(opt).map(k => [
-  argmap.has(k) ? argmap.get(k) : k, opt[k]
-]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/large-numbers.js b/legacy-libs/grpc/node_modules/tar/lib/large-numbers.js
deleted file mode 100644 (file)
index 3e5c992..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-'use strict'
-// Tar can encode large and negative numbers using a leading byte of
-// 0xff for negative, and 0x80 for positive.
-
-const encode = exports.encode = (num, buf) => {
-  if (!Number.isSafeInteger(num))
-    // The number is so large that javascript cannot represent it with integer
-    // precision.
-    throw TypeError('cannot encode number outside of javascript safe integer range')
-  else if (num < 0)
-    encodeNegative(num, buf)
-  else
-    encodePositive(num, buf)
-  return buf
-}
-
-const encodePositive = (num, buf) => {
-  buf[0] = 0x80
-
-  for (var i = buf.length; i > 1; i--) {
-    buf[i-1] = num & 0xff
-    num = Math.floor(num / 0x100)
-  }
-}
-
-const encodeNegative = (num, buf) => {
-  buf[0] = 0xff
-  var flipped = false
-  num = num * -1
-  for (var i = buf.length; i > 1; i--) {
-    var byte = num & 0xff
-    num = Math.floor(num / 0x100)
-    if (flipped)
-      buf[i-1] = onesComp(byte)
-    else if (byte === 0)
-      buf[i-1] = 0
-    else {
-      flipped = true
-      buf[i-1] = twosComp(byte)
-    }
-  }
-}
-
-const parse = exports.parse = (buf) => {
-  var post = buf[buf.length - 1]
-  var pre = buf[0]
-  var value;
-  if (pre === 0x80)
-    value = pos(buf.slice(1, buf.length))
-  else if (pre === 0xff)
-    value = twos(buf)
-  else
-    throw TypeError('invalid base256 encoding')
-
-  if (!Number.isSafeInteger(value))
-    // The number is so large that javascript cannot represent it with integer
-    // precision.
-    throw TypeError('parsed number outside of javascript safe integer range')
-
-  return value
-}
-
-const twos = (buf) => {
-  var len = buf.length
-  var sum = 0
-  var flipped = false
-  for (var i = len - 1; i > -1; i--) {
-    var byte = buf[i]
-    var f
-    if (flipped)
-      f = onesComp(byte)
-    else if (byte === 0)
-      f = byte
-    else {
-      flipped = true
-      f = twosComp(byte)
-    }
-    if (f !== 0)
-      sum -= f * Math.pow(256, len - i - 1)
-  }
-  return sum
-}
-
-const pos = (buf) => {
-  var len = buf.length
-  var sum = 0
-  for (var i = len - 1; i > -1; i--) {
-    var byte = buf[i]
-    if (byte !== 0)
-      sum += byte * Math.pow(256, len - i - 1)
-  }
-  return sum
-}
-
-const onesComp = byte => (0xff ^ byte) & 0xff
-
-const twosComp = byte => ((0xff ^ byte) + 1) & 0xff
diff --git a/legacy-libs/grpc/node_modules/tar/lib/list.js b/legacy-libs/grpc/node_modules/tar/lib/list.js
deleted file mode 100644 (file)
index 250ebe0..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-'use strict'
-
-const Buffer = require('./buffer.js')
-
-// XXX: This shares a lot in common with extract.js
-// maybe some DRY opportunity here?
-
-// tar -t
-const hlo = require('./high-level-opt.js')
-const Parser = require('./parse.js')
-const fs = require('fs')
-const fsm = require('fs-minipass')
-const path = require('path')
-
-const t = module.exports = (opt_, files, cb) => {
-  if (typeof opt_ === 'function')
-    cb = opt_, files = null, opt_ = {}
-  else if (Array.isArray(opt_))
-    files = opt_, opt_ = {}
-
-  if (typeof files === 'function')
-    cb = files, files = null
-
-  if (!files)
-    files = []
-  else
-    files = Array.from(files)
-
-  const opt = hlo(opt_)
-
-  if (opt.sync && typeof cb === 'function')
-    throw new TypeError('callback not supported for sync tar functions')
-
-  if (!opt.file && typeof cb === 'function')
-    throw new TypeError('callback only supported with file option')
-
-  if (files.length)
-    filesFilter(opt, files)
-
-  if (!opt.noResume)
-    onentryFunction(opt)
-
-  return opt.file && opt.sync ? listFileSync(opt)
-    : opt.file ? listFile(opt, cb)
-    : list(opt)
-}
-
-const onentryFunction = opt => {
-  const onentry = opt.onentry
-  opt.onentry = onentry ? e => {
-    onentry(e)
-    e.resume()
-  } : e => e.resume()
-}
-
-// construct a filter that limits the file entries listed
-// include child entries if a dir is included
-const filesFilter = (opt, files) => {
-  const map = new Map(files.map(f => [f.replace(/\/+$/, ''), true]))
-  const filter = opt.filter
-
-  const mapHas = (file, r) => {
-    const root = r || path.parse(file).root || '.'
-    const ret = file === root ? false
-      : map.has(file) ? map.get(file)
-      : mapHas(path.dirname(file), root)
-
-    map.set(file, ret)
-    return ret
-  }
-
-  opt.filter = filter
-    ? (file, entry) => filter(file, entry) && mapHas(file.replace(/\/+$/, ''))
-    : file => mapHas(file.replace(/\/+$/, ''))
-}
-
-const listFileSync = opt => {
-  const p = list(opt)
-  const file = opt.file
-  let threw = true
-  let fd
-  try {
-    const stat = fs.statSync(file)
-    const readSize = opt.maxReadSize || 16*1024*1024
-    if (stat.size < readSize) {
-      p.end(fs.readFileSync(file))
-    } else {
-      let pos = 0
-      const buf = Buffer.allocUnsafe(readSize)
-      fd = fs.openSync(file, 'r')
-      while (pos < stat.size) {
-        let bytesRead = fs.readSync(fd, buf, 0, readSize, pos)
-        pos += bytesRead
-        p.write(buf.slice(0, bytesRead))
-      }
-      p.end()
-    }
-    threw = false
-  } finally {
-    if (threw && fd)
-      try { fs.closeSync(fd) } catch (er) {}
-  }
-}
-
-const listFile = (opt, cb) => {
-  const parse = new Parser(opt)
-  const readSize = opt.maxReadSize || 16*1024*1024
-
-  const file = opt.file
-  const p = new Promise((resolve, reject) => {
-    parse.on('error', reject)
-    parse.on('end', resolve)
-
-    fs.stat(file, (er, stat) => {
-      if (er)
-        reject(er)
-      else {
-        const stream = new fsm.ReadStream(file, {
-          readSize: readSize,
-          size: stat.size
-        })
-        stream.on('error', reject)
-        stream.pipe(parse)
-      }
-    })
-  })
-  return cb ? p.then(cb, cb) : p
-}
-
-const list = opt => new Parser(opt)
diff --git a/legacy-libs/grpc/node_modules/tar/lib/mkdir.js b/legacy-libs/grpc/node_modules/tar/lib/mkdir.js
deleted file mode 100644 (file)
index c6a154c..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-'use strict'
-// wrapper around mkdirp for tar's needs.
-
-// TODO: This should probably be a class, not functionally
-// passing around state in a gazillion args.
-
-const mkdirp = require('mkdirp')
-const fs = require('fs')
-const path = require('path')
-const chownr = require('chownr')
-
-class SymlinkError extends Error {
-  constructor (symlink, path) {
-    super('Cannot extract through symbolic link')
-    this.path = path
-    this.symlink = symlink
-  }
-
-  get name () {
-    return 'SylinkError'
-  }
-}
-
-class CwdError extends Error {
-  constructor (path, code) {
-    super(code + ': Cannot cd into \'' + path + '\'')
-    this.path = path
-    this.code = code
-  }
-
-  get name () {
-    return 'CwdError'
-  }
-}
-
-const mkdir = module.exports = (dir, opt, cb) => {
-  // if there's any overlap between mask and mode,
-  // then we'll need an explicit chmod
-  const umask = opt.umask
-  const mode = opt.mode | 0o0700
-  const needChmod = (mode & umask) !== 0
-
-  const uid = opt.uid
-  const gid = opt.gid
-  const doChown = typeof uid === 'number' &&
-    typeof gid === 'number' &&
-    ( uid !== opt.processUid || gid !== opt.processGid )
-
-  const preserve = opt.preserve
-  const unlink = opt.unlink
-  const cache = opt.cache
-  const cwd = opt.cwd
-
-  const done = (er, created) => {
-    if (er)
-      cb(er)
-    else {
-      cache.set(dir, true)
-      if (created && doChown)
-        chownr(created, uid, gid, er => done(er))
-      else if (needChmod)
-        fs.chmod(dir, mode, cb)
-      else
-        cb()
-    }
-  }
-
-  if (cache && cache.get(dir) === true)
-    return done()
-
-  if (dir === cwd)
-    return fs.stat(dir, (er, st) => {
-      if (er || !st.isDirectory())
-        er = new CwdError(dir, er && er.code || 'ENOTDIR')
-      done(er)
-    })
-
-  if (preserve)
-    return mkdirp(dir, mode, done)
-
-  const sub = path.relative(cwd, dir)
-  const parts = sub.split(/\/|\\/)
-  mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done)
-}
-
-const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => {
-  if (!parts.length)
-    return cb(null, created)
-  const p = parts.shift()
-  const part = base + '/' + p
-  if (cache.get(part))
-    return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
-  fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
-}
-
-const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => {
-  if (er) {
-    if (er.path && path.dirname(er.path) === cwd &&
-        (er.code === 'ENOTDIR' || er.code === 'ENOENT'))
-      return cb(new CwdError(cwd, er.code))
-
-    fs.lstat(part, (statEr, st) => {
-      if (statEr)
-        cb(statEr)
-      else if (st.isDirectory())
-        mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
-      else if (unlink)
-        fs.unlink(part, er => {
-          if (er)
-            return cb(er)
-          fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
-        })
-      else if (st.isSymbolicLink())
-        return cb(new SymlinkError(part, part + '/' + parts.join('/')))
-      else
-        cb(er)
-    })
-  } else {
-    created = created || part
-    mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
-  }
-}
-
-const mkdirSync = module.exports.sync = (dir, opt) => {
-  // if there's any overlap between mask and mode,
-  // then we'll need an explicit chmod
-  const umask = opt.umask
-  const mode = opt.mode | 0o0700
-  const needChmod = (mode & umask) !== 0
-
-  const uid = opt.uid
-  const gid = opt.gid
-  const doChown = typeof uid === 'number' &&
-    typeof gid === 'number' &&
-    ( uid !== opt.processUid || gid !== opt.processGid )
-
-  const preserve = opt.preserve
-  const unlink = opt.unlink
-  const cache = opt.cache
-  const cwd = opt.cwd
-
-  const done = (created) => {
-    cache.set(dir, true)
-    if (created && doChown)
-      chownr.sync(created, uid, gid)
-    if (needChmod)
-      fs.chmodSync(dir, mode)
-  }
-
-  if (cache && cache.get(dir) === true)
-    return done()
-
-  if (dir === cwd) {
-    let ok = false
-    let code = 'ENOTDIR'
-    try {
-      ok = fs.statSync(dir).isDirectory()
-    } catch (er) {
-      code = er.code
-    } finally {
-      if (!ok)
-        throw new CwdError(dir, code)
-    }
-    done()
-    return
-  }
-
-  if (preserve)
-    return done(mkdirp.sync(dir, mode))
-
-  const sub = path.relative(cwd, dir)
-  const parts = sub.split(/\/|\\/)
-  let created = null
-  for (let p = parts.shift(), part = cwd;
-       p && (part += '/' + p);
-       p = parts.shift()) {
-
-    if (cache.get(part))
-      continue
-
-    try {
-      fs.mkdirSync(part, mode)
-      created = created || part
-      cache.set(part, true)
-    } catch (er) {
-      if (er.path && path.dirname(er.path) === cwd &&
-          (er.code === 'ENOTDIR' || er.code === 'ENOENT'))
-        return new CwdError(cwd, er.code)
-
-      const st = fs.lstatSync(part)
-      if (st.isDirectory()) {
-        cache.set(part, true)
-        continue
-      } else if (unlink) {
-        fs.unlinkSync(part)
-        fs.mkdirSync(part, mode)
-        created = created || part
-        cache.set(part, true)
-        continue
-      } else if (st.isSymbolicLink())
-        return new SymlinkError(part, part + '/' + parts.join('/'))
-    }
-  }
-
-  return done(created)
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/mode-fix.js b/legacy-libs/grpc/node_modules/tar/lib/mode-fix.js
deleted file mode 100644 (file)
index 3363a3b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-module.exports = (mode, isDir) => {
-  mode &= 0o7777
-  // if dirs are readable, then they should be listable
-  if (isDir) {
-    if (mode & 0o400)
-      mode |= 0o100
-    if (mode & 0o40)
-      mode |= 0o10
-    if (mode & 0o4)
-      mode |= 0o1
-  }
-  return mode
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/pack.js b/legacy-libs/grpc/node_modules/tar/lib/pack.js
deleted file mode 100644 (file)
index 857cea9..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-'use strict'
-
-const Buffer = require('./buffer.js')
-
-// A readable tar stream creator
-// Technically, this is a transform stream that you write paths into,
-// and tar format comes out of.
-// The `add()` method is like `write()` but returns this,
-// and end() return `this` as well, so you can
-// do `new Pack(opt).add('files').add('dir').end().pipe(output)
-// You could also do something like:
-// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))
-
-class PackJob {
-  constructor (path, absolute) {
-    this.path = path || './'
-    this.absolute = absolute
-    this.entry = null
-    this.stat = null
-    this.readdir = null
-    this.pending = false
-    this.ignore = false
-    this.piped = false
-  }
-}
-
-const MiniPass = require('minipass')
-const zlib = require('minizlib')
-const ReadEntry = require('./read-entry.js')
-const WriteEntry = require('./write-entry.js')
-const WriteEntrySync = WriteEntry.Sync
-const WriteEntryTar = WriteEntry.Tar
-const Yallist = require('yallist')
-const EOF = Buffer.alloc(1024)
-const ONSTAT = Symbol('onStat')
-const ENDED = Symbol('ended')
-const QUEUE = Symbol('queue')
-const CURRENT = Symbol('current')
-const PROCESS = Symbol('process')
-const PROCESSING = Symbol('processing')
-const PROCESSJOB = Symbol('processJob')
-const JOBS = Symbol('jobs')
-const JOBDONE = Symbol('jobDone')
-const ADDFSENTRY = Symbol('addFSEntry')
-const ADDTARENTRY = Symbol('addTarEntry')
-const STAT = Symbol('stat')
-const READDIR = Symbol('readdir')
-const ONREADDIR = Symbol('onreaddir')
-const PIPE = Symbol('pipe')
-const ENTRY = Symbol('entry')
-const ENTRYOPT = Symbol('entryOpt')
-const WRITEENTRYCLASS = Symbol('writeEntryClass')
-const WRITE = Symbol('write')
-const ONDRAIN = Symbol('ondrain')
-
-const fs = require('fs')
-const path = require('path')
-const warner = require('./warn-mixin.js')
-
-const Pack = warner(class Pack extends MiniPass {
-  constructor (opt) {
-    super(opt)
-    opt = opt || Object.create(null)
-    this.opt = opt
-    this.cwd = opt.cwd || process.cwd()
-    this.maxReadSize = opt.maxReadSize
-    this.preservePaths = !!opt.preservePaths
-    this.strict = !!opt.strict
-    this.noPax = !!opt.noPax
-    this.prefix = (opt.prefix || '').replace(/(\\|\/)+$/, '')
-    this.linkCache = opt.linkCache || new Map()
-    this.statCache = opt.statCache || new Map()
-    this.readdirCache = opt.readdirCache || new Map()
-
-    this[WRITEENTRYCLASS] = WriteEntry
-    if (typeof opt.onwarn === 'function')
-      this.on('warn', opt.onwarn)
-
-    this.zip = null
-    if (opt.gzip) {
-      if (typeof opt.gzip !== 'object')
-        opt.gzip = {}
-      this.zip = new zlib.Gzip(opt.gzip)
-      this.zip.on('data', chunk => super.write(chunk))
-      this.zip.on('end', _ => super.end())
-      this.zip.on('drain', _ => this[ONDRAIN]())
-      this.on('resume', _ => this.zip.resume())
-    } else
-      this.on('drain', this[ONDRAIN])
-
-    this.portable = !!opt.portable
-    this.noDirRecurse = !!opt.noDirRecurse
-    this.follow = !!opt.follow
-    this.noMtime = !!opt.noMtime
-    this.mtime = opt.mtime || null
-
-    this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true
-
-    this[QUEUE] = new Yallist
-    this[JOBS] = 0
-    this.jobs = +opt.jobs || 4
-    this[PROCESSING] = false
-    this[ENDED] = false
-  }
-
-  [WRITE] (chunk) {
-    return super.write(chunk)
-  }
-
-  add (path) {
-    this.write(path)
-    return this
-  }
-
-  end (path) {
-    if (path)
-      this.write(path)
-    this[ENDED] = true
-    this[PROCESS]()
-    return this
-  }
-
-  write (path) {
-    if (this[ENDED])
-      throw new Error('write after end')
-
-    if (path instanceof ReadEntry)
-      this[ADDTARENTRY](path)
-    else
-      this[ADDFSENTRY](path)
-    return this.flowing
-  }
-
-  [ADDTARENTRY] (p) {
-    const absolute = path.resolve(this.cwd, p.path)
-    if (this.prefix)
-      p.path = this.prefix + '/' + p.path.replace(/^\.(\/+|$)/, '')
-
-    // in this case, we don't have to wait for the stat
-    if (!this.filter(p.path, p))
-      p.resume()
-    else {
-      const job = new PackJob(p.path, absolute, false)
-      job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))
-      job.entry.on('end', _ => this[JOBDONE](job))
-      this[JOBS] += 1
-      this[QUEUE].push(job)
-    }
-
-    this[PROCESS]()
-  }
-
-  [ADDFSENTRY] (p) {
-    const absolute = path.resolve(this.cwd, p)
-    if (this.prefix)
-      p = this.prefix + '/' + p.replace(/^\.(\/+|$)/, '')
-
-    this[QUEUE].push(new PackJob(p, absolute))
-    this[PROCESS]()
-  }
-
-  [STAT] (job) {
-    job.pending = true
-    this[JOBS] += 1
-    const stat = this.follow ? 'stat' : 'lstat'
-    fs[stat](job.absolute, (er, stat) => {
-      job.pending = false
-      this[JOBS] -= 1
-      if (er)
-        this.emit('error', er)
-      else
-        this[ONSTAT](job, stat)
-    })
-  }
-
-  [ONSTAT] (job, stat) {
-    this.statCache.set(job.absolute, stat)
-    job.stat = stat
-
-    // now we have the stat, we can filter it.
-    if (!this.filter(job.path, stat))
-      job.ignore = true
-
-    this[PROCESS]()
-  }
-
-  [READDIR] (job) {
-    job.pending = true
-    this[JOBS] += 1
-    fs.readdir(job.absolute, (er, entries) => {
-      job.pending = false
-      this[JOBS] -= 1
-      if (er)
-        return this.emit('error', er)
-      this[ONREADDIR](job, entries)
-    })
-  }
-
-  [ONREADDIR] (job, entries) {
-    this.readdirCache.set(job.absolute, entries)
-    job.readdir = entries
-    this[PROCESS]()
-  }
-
-  [PROCESS] () {
-    if (this[PROCESSING])
-      return
-
-    this[PROCESSING] = true
-    for (let w = this[QUEUE].head;
-         w !== null && this[JOBS] < this.jobs;
-         w = w.next) {
-      this[PROCESSJOB](w.value)
-      if (w.value.ignore) {
-        const p = w.next
-        this[QUEUE].removeNode(w)
-        w.next = p
-      }
-    }
-
-    this[PROCESSING] = false
-
-    if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {
-      if (this.zip)
-        this.zip.end(EOF)
-      else {
-        super.write(EOF)
-        super.end()
-      }
-    }
-  }
-
-  get [CURRENT] () {
-    return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value
-  }
-
-  [JOBDONE] (job) {
-    this[QUEUE].shift()
-    this[JOBS] -= 1
-    this[PROCESS]()
-  }
-
-  [PROCESSJOB] (job) {
-    if (job.pending)
-      return
-
-    if (job.entry) {
-      if (job === this[CURRENT] && !job.piped)
-        this[PIPE](job)
-      return
-    }
-
-    if (!job.stat) {
-      if (this.statCache.has(job.absolute))
-        this[ONSTAT](job, this.statCache.get(job.absolute))
-      else
-        this[STAT](job)
-    }
-    if (!job.stat)
-      return
-
-    // filtered out!
-    if (job.ignore)
-      return
-
-    if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) {
-      if (this.readdirCache.has(job.absolute))
-        this[ONREADDIR](job, this.readdirCache.get(job.absolute))
-      else
-        this[READDIR](job)
-      if (!job.readdir)
-        return
-    }
-
-    // we know it doesn't have an entry, because that got checked above
-    job.entry = this[ENTRY](job)
-    if (!job.entry) {
-      job.ignore = true
-      return
-    }
-
-    if (job === this[CURRENT] && !job.piped)
-      this[PIPE](job)
-  }
-
-  [ENTRYOPT] (job) {
-    return {
-      onwarn: (msg, data) => {
-        this.warn(msg, data)
-      },
-      noPax: this.noPax,
-      cwd: this.cwd,
-      absolute: job.absolute,
-      preservePaths: this.preservePaths,
-      maxReadSize: this.maxReadSize,
-      strict: this.strict,
-      portable: this.portable,
-      linkCache: this.linkCache,
-      statCache: this.statCache,
-      noMtime: this.noMtime,
-      mtime: this.mtime
-    }
-  }
-
-  [ENTRY] (job) {
-    this[JOBS] += 1
-    try {
-      return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job))
-        .on('end', () => this[JOBDONE](job))
-        .on('error', er => this.emit('error', er))
-    } catch (er) {
-      this.emit('error', er)
-    }
-  }
-
-  [ONDRAIN] () {
-    if (this[CURRENT] && this[CURRENT].entry)
-      this[CURRENT].entry.resume()
-  }
-
-  // like .pipe() but using super, because our write() is special
-  [PIPE] (job) {
-    job.piped = true
-
-    if (job.readdir)
-      job.readdir.forEach(entry => {
-        const p = this.prefix ?
-          job.path.slice(this.prefix.length + 1) || './'
-          : job.path
-
-        const base = p === './' ? '' : p.replace(/\/*$/, '/')
-        this[ADDFSENTRY](base + entry)
-      })
-
-    const source = job.entry
-    const zip = this.zip
-
-    if (zip)
-      source.on('data', chunk => {
-        if (!zip.write(chunk))
-          source.pause()
-      })
-    else
-      source.on('data', chunk => {
-        if (!super.write(chunk))
-          source.pause()
-      })
-  }
-
-  pause () {
-    if (this.zip)
-      this.zip.pause()
-    return super.pause()
-  }
-})
-
-class PackSync extends Pack {
-  constructor (opt) {
-    super(opt)
-    this[WRITEENTRYCLASS] = WriteEntrySync
-  }
-
-  // pause/resume are no-ops in sync streams.
-  pause () {}
-  resume () {}
-
-  [STAT] (job) {
-    const stat = this.follow ? 'statSync' : 'lstatSync'
-    this[ONSTAT](job, fs[stat](job.absolute))
-  }
-
-  [READDIR] (job, stat) {
-    this[ONREADDIR](job, fs.readdirSync(job.absolute))
-  }
-
-  // gotta get it all in this tick
-  [PIPE] (job) {
-    const source = job.entry
-    const zip = this.zip
-
-    if (job.readdir)
-      job.readdir.forEach(entry => {
-        const p = this.prefix ?
-          job.path.slice(this.prefix.length + 1) || './'
-          : job.path
-
-        const base = p === './' ? '' : p.replace(/\/*$/, '/')
-        this[ADDFSENTRY](base + entry)
-      })
-
-    if (zip)
-      source.on('data', chunk => {
-        zip.write(chunk)
-      })
-    else
-      source.on('data', chunk => {
-        super[WRITE](chunk)
-      })
-  }
-}
-
-Pack.Sync = PackSync
-
-module.exports = Pack
diff --git a/legacy-libs/grpc/node_modules/tar/lib/parse.js b/legacy-libs/grpc/node_modules/tar/lib/parse.js
deleted file mode 100644 (file)
index 34e3cd7..0000000
+++ /dev/null
@@ -1,423 +0,0 @@
-'use strict'
-
-// this[BUFFER] is the remainder of a chunk if we're waiting for
-// the full 512 bytes of a header to come in.  We will Buffer.concat()
-// it to the next write(), which is a mem copy, but a small one.
-//
-// this[QUEUE] is a Yallist of entries that haven't been emitted
-// yet this can only get filled up if the user keeps write()ing after
-// a write() returns false, or does a write() with more than one entry
-//
-// We don't buffer chunks, we always parse them and either create an
-// entry, or push it into the active entry.  The ReadEntry class knows
-// to throw data away if .ignore=true
-//
-// Shift entry off the buffer when it emits 'end', and emit 'entry' for
-// the next one in the list.
-//
-// At any time, we're pushing body chunks into the entry at WRITEENTRY,
-// and waiting for 'end' on the entry at READENTRY
-//
-// ignored entries get .resume() called on them straight away
-
-const warner = require('./warn-mixin.js')
-const path = require('path')
-const Header = require('./header.js')
-const EE = require('events')
-const Yallist = require('yallist')
-const maxMetaEntrySize = 1024 * 1024
-const Entry = require('./read-entry.js')
-const Pax = require('./pax.js')
-const zlib = require('minizlib')
-const Buffer = require('./buffer.js')
-
-const gzipHeader = Buffer.from([0x1f, 0x8b])
-const STATE = Symbol('state')
-const WRITEENTRY = Symbol('writeEntry')
-const READENTRY = Symbol('readEntry')
-const NEXTENTRY = Symbol('nextEntry')
-const PROCESSENTRY = Symbol('processEntry')
-const EX = Symbol('extendedHeader')
-const GEX = Symbol('globalExtendedHeader')
-const META = Symbol('meta')
-const EMITMETA = Symbol('emitMeta')
-const BUFFER = Symbol('buffer')
-const QUEUE = Symbol('queue')
-const ENDED = Symbol('ended')
-const EMITTEDEND = Symbol('emittedEnd')
-const EMIT = Symbol('emit')
-const UNZIP = Symbol('unzip')
-const CONSUMECHUNK = Symbol('consumeChunk')
-const CONSUMECHUNKSUB = Symbol('consumeChunkSub')
-const CONSUMEBODY = Symbol('consumeBody')
-const CONSUMEMETA = Symbol('consumeMeta')
-const CONSUMEHEADER = Symbol('consumeHeader')
-const CONSUMING = Symbol('consuming')
-const BUFFERCONCAT = Symbol('bufferConcat')
-const MAYBEEND = Symbol('maybeEnd')
-const WRITING = Symbol('writing')
-const ABORTED = Symbol('aborted')
-const DONE = Symbol('onDone')
-
-const noop = _ => true
-
-module.exports = warner(class Parser extends EE {
-  constructor (opt) {
-    opt = opt || {}
-    super(opt)
-
-    if (opt.ondone)
-      this.on(DONE, opt.ondone)
-    else
-      this.on(DONE, _ => {
-        this.emit('prefinish')
-        this.emit('finish')
-        this.emit('end')
-        this.emit('close')
-      })
-
-    this.strict = !!opt.strict
-    this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize
-    this.filter = typeof opt.filter === 'function' ? opt.filter : noop
-
-    // have to set this so that streams are ok piping into it
-    this.writable = true
-    this.readable = false
-
-    this[QUEUE] = new Yallist()
-    this[BUFFER] = null
-    this[READENTRY] = null
-    this[WRITEENTRY] = null
-    this[STATE] = 'begin'
-    this[META] = ''
-    this[EX] = null
-    this[GEX] = null
-    this[ENDED] = false
-    this[UNZIP] = null
-    this[ABORTED] = false
-    if (typeof opt.onwarn === 'function')
-      this.on('warn', opt.onwarn)
-    if (typeof opt.onentry === 'function')
-      this.on('entry', opt.onentry)
-  }
-
-  [CONSUMEHEADER] (chunk, position) {
-    const header = new Header(chunk, position, this[EX], this[GEX])
-
-    if (header.nullBlock)
-      this[EMIT]('nullBlock')
-    else if (!header.cksumValid)
-      this.warn('invalid entry', header)
-    else if (!header.path)
-      this.warn('invalid: path is required', header)
-    else {
-      const type = header.type
-      if (/^(Symbolic)?Link$/.test(type) && !header.linkpath)
-        this.warn('invalid: linkpath required', header)
-      else if (!/^(Symbolic)?Link$/.test(type) && header.linkpath)
-        this.warn('invalid: linkpath forbidden', header)
-      else {
-        const entry = this[WRITEENTRY] = new Entry(header, this[EX], this[GEX])
-
-        if (entry.meta) {
-          if (entry.size > this.maxMetaEntrySize) {
-            entry.ignore = true
-            this[EMIT]('ignoredEntry', entry)
-            this[STATE] = 'ignore'
-          } else if (entry.size > 0) {
-            this[META] = ''
-            entry.on('data', c => this[META] += c)
-            this[STATE] = 'meta'
-          }
-        } else {
-
-          this[EX] = null
-          entry.ignore = entry.ignore || !this.filter(entry.path, entry)
-          if (entry.ignore) {
-            this[EMIT]('ignoredEntry', entry)
-            this[STATE] = entry.remain ? 'ignore' : 'begin'
-          } else {
-            if (entry.remain)
-              this[STATE] = 'body'
-            else {
-              this[STATE] = 'begin'
-              entry.end()
-            }
-
-            if (!this[READENTRY]) {
-              this[QUEUE].push(entry)
-              this[NEXTENTRY]()
-            } else
-              this[QUEUE].push(entry)
-          }
-        }
-      }
-    }
-  }
-
-  [PROCESSENTRY] (entry) {
-    let go = true
-
-    if (!entry) {
-      this[READENTRY] = null
-      go = false
-    } else if (Array.isArray(entry))
-      this.emit.apply(this, entry)
-    else {
-      this[READENTRY] = entry
-      this.emit('entry', entry)
-      if (!entry.emittedEnd) {
-        entry.on('end', _ => this[NEXTENTRY]())
-        go = false
-      }
-    }
-
-    return go
-  }
-
-  [NEXTENTRY] () {
-    do {} while (this[PROCESSENTRY](this[QUEUE].shift()))
-
-    if (!this[QUEUE].length) {
-      // At this point, there's nothing in the queue, but we may have an
-      // entry which is being consumed (readEntry).
-      // If we don't, then we definitely can handle more data.
-      // If we do, and either it's flowing, or it has never had any data
-      // written to it, then it needs more.
-      // The only other possibility is that it has returned false from a
-      // write() call, so we wait for the next drain to continue.
-      const re = this[READENTRY]
-      const drainNow = !re || re.flowing || re.size === re.remain
-      if (drainNow) {
-        if (!this[WRITING])
-          this.emit('drain')
-      } else
-        re.once('drain', _ => this.emit('drain'))
-     }
-  }
-
-  [CONSUMEBODY] (chunk, position) {
-    // write up to but no  more than writeEntry.blockRemain
-    const entry = this[WRITEENTRY]
-    const br = entry.blockRemain
-    const c = (br >= chunk.length && position === 0) ? chunk
-      : chunk.slice(position, position + br)
-
-    entry.write(c)
-
-    if (!entry.blockRemain) {
-      this[STATE] = 'begin'
-      this[WRITEENTRY] = null
-      entry.end()
-    }
-
-    return c.length
-  }
-
-  [CONSUMEMETA] (chunk, position) {
-    const entry = this[WRITEENTRY]
-    const ret = this[CONSUMEBODY](chunk, position)
-
-    // if we finished, then the entry is reset
-    if (!this[WRITEENTRY])
-      this[EMITMETA](entry)
-
-    return ret
-  }
-
-  [EMIT] (ev, data, extra) {
-    if (!this[QUEUE].length && !this[READENTRY])
-      this.emit(ev, data, extra)
-    else
-      this[QUEUE].push([ev, data, extra])
-  }
-
-  [EMITMETA] (entry) {
-    this[EMIT]('meta', this[META])
-    switch (entry.type) {
-      case 'ExtendedHeader':
-      case 'OldExtendedHeader':
-        this[EX] = Pax.parse(this[META], this[EX], false)
-        break
-
-      case 'GlobalExtendedHeader':
-        this[GEX] = Pax.parse(this[META], this[GEX], true)
-        break
-
-      case 'NextFileHasLongPath':
-      case 'OldGnuLongPath':
-        this[EX] = this[EX] || Object.create(null)
-        this[EX].path = this[META].replace(/\0.*/, '')
-        break
-
-      case 'NextFileHasLongLinkpath':
-        this[EX] = this[EX] || Object.create(null)
-        this[EX].linkpath = this[META].replace(/\0.*/, '')
-        break
-
-      /* istanbul ignore next */
-      default: throw new Error('unknown meta: ' + entry.type)
-    }
-  }
-
-  abort (msg, error) {
-    this[ABORTED] = true
-    this.warn(msg, error)
-    this.emit('abort', error)
-    this.emit('error', error)
-  }
-
-  write (chunk) {
-    if (this[ABORTED])
-      return
-
-    // first write, might be gzipped
-    if (this[UNZIP] === null && chunk) {
-      if (this[BUFFER]) {
-        chunk = Buffer.concat([this[BUFFER], chunk])
-        this[BUFFER] = null
-      }
-      if (chunk.length < gzipHeader.length) {
-        this[BUFFER] = chunk
-        return true
-      }
-      for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
-        if (chunk[i] !== gzipHeader[i])
-          this[UNZIP] = false
-      }
-      if (this[UNZIP] === null) {
-        const ended = this[ENDED]
-        this[ENDED] = false
-        this[UNZIP] = new zlib.Unzip()
-        this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))
-        this[UNZIP].on('error', er =>
-          this.abort(er.message, er))
-        this[UNZIP].on('end', _ => {
-          this[ENDED] = true
-          this[CONSUMECHUNK]()
-        })
-        this[WRITING] = true
-        const ret = this[UNZIP][ended ? 'end' : 'write' ](chunk)
-        this[WRITING] = false
-        return ret
-      }
-    }
-
-    this[WRITING] = true
-    if (this[UNZIP])
-      this[UNZIP].write(chunk)
-    else
-      this[CONSUMECHUNK](chunk)
-    this[WRITING] = false
-
-    // return false if there's a queue, or if the current entry isn't flowing
-    const ret =
-      this[QUEUE].length ? false :
-      this[READENTRY] ? this[READENTRY].flowing :
-      true
-
-    // if we have no queue, then that means a clogged READENTRY
-    if (!ret && !this[QUEUE].length)
-      this[READENTRY].once('drain', _ => this.emit('drain'))
-
-    return ret
-  }
-
-  [BUFFERCONCAT] (c) {
-    if (c && !this[ABORTED])
-      this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c
-  }
-
-  [MAYBEEND] () {
-    if (this[ENDED] &&
-        !this[EMITTEDEND] &&
-        !this[ABORTED] &&
-        !this[CONSUMING]) {
-      this[EMITTEDEND] = true
-      const entry = this[WRITEENTRY]
-      if (entry && entry.blockRemain) {
-        const have = this[BUFFER] ? this[BUFFER].length : 0
-        this.warn('Truncated input (needed ' + entry.blockRemain +
-                  ' more bytes, only ' + have + ' available)', entry)
-        if (this[BUFFER])
-          entry.write(this[BUFFER])
-        entry.end()
-      }
-      this[EMIT](DONE)
-    }
-  }
-
-  [CONSUMECHUNK] (chunk) {
-    if (this[CONSUMING]) {
-      this[BUFFERCONCAT](chunk)
-    } else if (!chunk && !this[BUFFER]) {
-      this[MAYBEEND]()
-    } else {
-      this[CONSUMING] = true
-      if (this[BUFFER]) {
-        this[BUFFERCONCAT](chunk)
-        const c = this[BUFFER]
-        this[BUFFER] = null
-        this[CONSUMECHUNKSUB](c)
-      } else {
-        this[CONSUMECHUNKSUB](chunk)
-      }
-
-      while (this[BUFFER] && this[BUFFER].length >= 512 && !this[ABORTED]) {
-        const c = this[BUFFER]
-        this[BUFFER] = null
-        this[CONSUMECHUNKSUB](c)
-      }
-      this[CONSUMING] = false
-    }
-
-    if (!this[BUFFER] || this[ENDED])
-      this[MAYBEEND]()
-  }
-
-  [CONSUMECHUNKSUB] (chunk) {
-    // we know that we are in CONSUMING mode, so anything written goes into
-    // the buffer.  Advance the position and put any remainder in the buffer.
-    let position = 0
-    let length = chunk.length
-    while (position + 512 <= length && !this[ABORTED]) {
-      switch (this[STATE]) {
-        case 'begin':
-          this[CONSUMEHEADER](chunk, position)
-          position += 512
-          break
-
-        case 'ignore':
-        case 'body':
-          position += this[CONSUMEBODY](chunk, position)
-          break
-
-        case 'meta':
-          position += this[CONSUMEMETA](chunk, position)
-          break
-
-        /* istanbul ignore next */
-        default:
-          throw new Error('invalid state: ' + this[STATE])
-      }
-    }
-
-    if (position < length) {
-      if (this[BUFFER])
-        this[BUFFER] = Buffer.concat([chunk.slice(position), this[BUFFER]])
-      else
-        this[BUFFER] = chunk.slice(position)
-    }
-  }
-
-  end (chunk) {
-    if (!this[ABORTED]) {
-      if (this[UNZIP])
-        this[UNZIP].end(chunk)
-      else {
-        this[ENDED] = true
-        this.write(chunk)
-      }
-    }
-  }
-})
diff --git a/legacy-libs/grpc/node_modules/tar/lib/pax.js b/legacy-libs/grpc/node_modules/tar/lib/pax.js
deleted file mode 100644 (file)
index 9d7e4ab..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-'use strict'
-const Buffer = require('./buffer.js')
-const Header = require('./header.js')
-const path = require('path')
-
-class Pax {
-  constructor (obj, global) {
-    this.atime = obj.atime || null
-    this.charset = obj.charset || null
-    this.comment = obj.comment || null
-    this.ctime = obj.ctime || null
-    this.gid = obj.gid || null
-    this.gname = obj.gname || null
-    this.linkpath = obj.linkpath || null
-    this.mtime = obj.mtime || null
-    this.path = obj.path || null
-    this.size = obj.size || null
-    this.uid = obj.uid || null
-    this.uname = obj.uname || null
-    this.dev = obj.dev || null
-    this.ino = obj.ino || null
-    this.nlink = obj.nlink || null
-    this.global = global || false
-  }
-
-  encode () {
-    const body = this.encodeBody()
-    if (body === '')
-      return null
-
-    const bodyLen = Buffer.byteLength(body)
-    // round up to 512 bytes
-    // add 512 for header
-    const bufLen = 512 * Math.ceil(1 + bodyLen / 512)
-    const buf = Buffer.allocUnsafe(bufLen)
-
-    // 0-fill the header section, it might not hit every field
-    for (let i = 0; i < 512; i++) {
-      buf[i] = 0
-    }
-
-    new Header({
-      // XXX split the path
-      // then the path should be PaxHeader + basename, but less than 99,
-      // prepend with the dirname
-      path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99),
-      mode: this.mode || 0o644,
-      uid: this.uid || null,
-      gid: this.gid || null,
-      size: bodyLen,
-      mtime: this.mtime || null,
-      type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
-      linkpath: '',
-      uname: this.uname || '',
-      gname: this.gname || '',
-      devmaj: 0,
-      devmin: 0,
-      atime: this.atime || null,
-      ctime: this.ctime || null
-    }).encode(buf)
-
-    buf.write(body, 512, bodyLen, 'utf8')
-
-    // null pad after the body
-    for (let i = bodyLen + 512; i < buf.length; i++) {
-      buf[i] = 0
-    }
-
-    return buf
-  }
-
-  encodeBody () {
-    return (
-      this.encodeField('path') +
-      this.encodeField('ctime') +
-      this.encodeField('atime') +
-      this.encodeField('dev') +
-      this.encodeField('ino') +
-      this.encodeField('nlink') +
-      this.encodeField('charset') +
-      this.encodeField('comment') +
-      this.encodeField('gid') +
-      this.encodeField('gname') +
-      this.encodeField('linkpath') +
-      this.encodeField('mtime') +
-      this.encodeField('size') +
-      this.encodeField('uid') +
-      this.encodeField('uname')
-    )
-  }
-
-  encodeField (field) {
-    if (this[field] === null || this[field] === undefined)
-      return ''
-    const v = this[field] instanceof Date ? this[field].getTime() / 1000
-      : this[field]
-    const s = ' ' +
-      (field === 'dev' || field === 'ino' || field === 'nlink'
-       ? 'SCHILY.' : '') +
-      field + '=' + v + '\n'
-    const byteLen = Buffer.byteLength(s)
-    // the digits includes the length of the digits in ascii base-10
-    // so if it's 9 characters, then adding 1 for the 9 makes it 10
-    // which makes it 11 chars.
-    let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1
-    if (byteLen + digits >= Math.pow(10, digits))
-      digits += 1
-    const len = digits + byteLen
-    return len + s
-  }
-}
-
-Pax.parse = (string, ex, g) => new Pax(merge(parseKV(string), ex), g)
-
-const merge = (a, b) =>
-  b ? Object.keys(a).reduce((s, k) => (s[k] = a[k], s), b) : a
-
-const parseKV = string =>
-  string
-    .replace(/\n$/, '')
-    .split('\n')
-    .reduce(parseKVLine, Object.create(null))
-
-const parseKVLine = (set, line) => {
-  const n = parseInt(line, 10)
-
-  // XXX Values with \n in them will fail this.
-  // Refactor to not be a naive line-by-line parse.
-  if (n !== Buffer.byteLength(line) + 1)
-    return set
-
-  line = line.substr((n + ' ').length)
-  const kv = line.split('=')
-  const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1')
-  if (!k)
-    return set
-
-  const v = kv.join('=')
-  set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k)
-    ?  new Date(v * 1000)
-    : /^[0-9]+$/.test(v) ? +v
-    : v
-  return set
-}
-
-module.exports = Pax
diff --git a/legacy-libs/grpc/node_modules/tar/lib/read-entry.js b/legacy-libs/grpc/node_modules/tar/lib/read-entry.js
deleted file mode 100644 (file)
index aa369c7..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-'use strict'
-const types = require('./types.js')
-const MiniPass = require('minipass')
-
-const SLURP = Symbol('slurp')
-module.exports = class ReadEntry extends MiniPass {
-  constructor (header, ex, gex) {
-    super()
-    this.extended = ex
-    this.globalExtended = gex
-    this.header = header
-    this.startBlockSize = 512 * Math.ceil(header.size / 512)
-    this.blockRemain = this.startBlockSize
-    this.remain = header.size
-    this.type = header.type
-    this.meta = false
-    this.ignore = false
-    switch (this.type) {
-      case 'File':
-      case 'OldFile':
-      case 'Link':
-      case 'SymbolicLink':
-      case 'CharacterDevice':
-      case 'BlockDevice':
-      case 'Directory':
-      case 'FIFO':
-      case 'ContiguousFile':
-      case 'GNUDumpDir':
-        break
-
-      case 'NextFileHasLongLinkpath':
-      case 'NextFileHasLongPath':
-      case 'OldGnuLongPath':
-      case 'GlobalExtendedHeader':
-      case 'ExtendedHeader':
-      case 'OldExtendedHeader':
-        this.meta = true
-        break
-
-      // NOTE: gnutar and bsdtar treat unrecognized types as 'File'
-      // it may be worth doing the same, but with a warning.
-      default:
-        this.ignore = true
-    }
-
-    this.path = header.path
-    this.mode = header.mode
-    if (this.mode)
-      this.mode = this.mode & 0o7777
-    this.uid = header.uid
-    this.gid = header.gid
-    this.uname = header.uname
-    this.gname = header.gname
-    this.size = header.size
-    this.mtime = header.mtime
-    this.atime = header.atime
-    this.ctime = header.ctime
-    this.linkpath = header.linkpath
-    this.uname = header.uname
-    this.gname = header.gname
-
-    if (ex) this[SLURP](ex)
-    if (gex) this[SLURP](gex, true)
-  }
-
-  write (data) {
-    const writeLen = data.length
-    if (writeLen > this.blockRemain)
-      throw new Error('writing more to entry than is appropriate')
-
-    const r = this.remain
-    const br = this.blockRemain
-    this.remain = Math.max(0, r - writeLen)
-    this.blockRemain = Math.max(0, br - writeLen)
-    if (this.ignore)
-      return true
-
-    if (r >= writeLen)
-      return super.write(data)
-
-    // r < writeLen
-    return super.write(data.slice(0, r))
-  }
-
-  [SLURP] (ex, global) {
-    for (let k in ex) {
-      // we slurp in everything except for the path attribute in
-      // a global extended header, because that's weird.
-      if (ex[k] !== null && ex[k] !== undefined &&
-          !(global && k === 'path'))
-        this[k] = ex[k]
-    }
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/replace.js b/legacy-libs/grpc/node_modules/tar/lib/replace.js
deleted file mode 100644 (file)
index 571cee9..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-'use strict'
-const Buffer = require('./buffer.js')
-
-// tar -r
-const hlo = require('./high-level-opt.js')
-const Pack = require('./pack.js')
-const Parse = require('./parse.js')
-const fs = require('fs')
-const fsm = require('fs-minipass')
-const t = require('./list.js')
-const path = require('path')
-
-// starting at the head of the file, read a Header
-// If the checksum is invalid, that's our position to start writing
-// If it is, jump forward by the specified size (round up to 512)
-// and try again.
-// Write the new Pack stream starting there.
-
-const Header = require('./header.js')
-
-const r = module.exports = (opt_, files, cb) => {
-  const opt = hlo(opt_)
-
-  if (!opt.file)
-    throw new TypeError('file is required')
-
-  if (opt.gzip)
-    throw new TypeError('cannot append to compressed archives')
-
-  if (!files || !Array.isArray(files) || !files.length)
-    throw new TypeError('no files or directories specified')
-
-  files = Array.from(files)
-
-  return opt.sync ? replaceSync(opt, files)
-    : replace(opt, files, cb)
-}
-
-const replaceSync = (opt, files) => {
-  const p = new Pack.Sync(opt)
-
-  let threw = true
-  let fd
-  let position
-
-  try {
-    try {
-      fd = fs.openSync(opt.file, 'r+')
-    } catch (er) {
-      if (er.code === 'ENOENT')
-        fd = fs.openSync(opt.file, 'w+')
-      else
-        throw er
-    }
-
-    const st = fs.fstatSync(fd)
-    const headBuf = Buffer.alloc(512)
-
-    POSITION: for (position = 0; position < st.size; position += 512) {
-      for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {
-        bytes = fs.readSync(
-          fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos
-        )
-
-        if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b)
-          throw new Error('cannot append to compressed archives')
-
-        if (!bytes)
-          break POSITION
-      }
-
-      let h = new Header(headBuf)
-      if (!h.cksumValid)
-        break
-      let entryBlockSize = 512 * Math.ceil(h.size / 512)
-      if (position + entryBlockSize + 512 > st.size)
-        break
-      // the 512 for the header we just parsed will be added as well
-      // also jump ahead all the blocks for the body
-      position += entryBlockSize
-      if (opt.mtimeCache)
-        opt.mtimeCache.set(h.path, h.mtime)
-    }
-    threw = false
-
-    streamSync(opt, p, position, fd, files)
-  } finally {
-    if (threw)
-      try { fs.closeSync(fd) } catch (er) {}
-  }
-}
-
-const streamSync = (opt, p, position, fd, files) => {
-  const stream = new fsm.WriteStreamSync(opt.file, {
-    fd: fd,
-    start: position
-  })
-  p.pipe(stream)
-  addFilesSync(p, files)
-}
-
-const replace = (opt, files, cb) => {
-  files = Array.from(files)
-  const p = new Pack(opt)
-
-  const getPos = (fd, size, cb_) => {
-    const cb = (er, pos) => {
-      if (er)
-        fs.close(fd, _ => cb_(er))
-      else
-        cb_(null, pos)
-    }
-
-    let position = 0
-    if (size === 0)
-      return cb(null, 0)
-
-    let bufPos = 0
-    const headBuf = Buffer.alloc(512)
-    const onread = (er, bytes) => {
-      if (er)
-        return cb(er)
-      bufPos += bytes
-      if (bufPos < 512 && bytes)
-        return fs.read(
-          fd, headBuf, bufPos, headBuf.length - bufPos,
-          position + bufPos, onread
-        )
-
-      if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b)
-        return cb(new Error('cannot append to compressed archives'))
-
-      // truncated header
-      if (bufPos < 512)
-        return cb(null, position)
-
-      const h = new Header(headBuf)
-      if (!h.cksumValid)
-        return cb(null, position)
-
-      const entryBlockSize = 512 * Math.ceil(h.size / 512)
-      if (position + entryBlockSize + 512 > size)
-        return cb(null, position)
-
-      position += entryBlockSize + 512
-      if (position >= size)
-        return cb(null, position)
-
-      if (opt.mtimeCache)
-        opt.mtimeCache.set(h.path, h.mtime)
-      bufPos = 0
-      fs.read(fd, headBuf, 0, 512, position, onread)
-    }
-    fs.read(fd, headBuf, 0, 512, position, onread)
-  }
-
-  const promise = new Promise((resolve, reject) => {
-    p.on('error', reject)
-    let flag = 'r+'
-    const onopen = (er, fd) => {
-      if (er && er.code === 'ENOENT' && flag === 'r+') {
-        flag = 'w+'
-        return fs.open(opt.file, flag, onopen)
-      }
-
-      if (er)
-        return reject(er)
-
-      fs.fstat(fd, (er, st) => {
-        if (er)
-          return reject(er)
-        getPos(fd, st.size, (er, position) => {
-          if (er)
-            return reject(er)
-          const stream = new fsm.WriteStream(opt.file, {
-            fd: fd,
-            start: position
-          })
-          p.pipe(stream)
-          stream.on('error', reject)
-          stream.on('close', resolve)
-          addFilesAsync(p, files)
-        })
-      })
-    }
-    fs.open(opt.file, flag, onopen)
-  })
-
-  return cb ? promise.then(cb, cb) : promise
-}
-
-const addFilesSync = (p, files) => {
-  files.forEach(file => {
-    if (file.charAt(0) === '@')
-      t({
-        file: path.resolve(p.cwd, file.substr(1)),
-        sync: true,
-        noResume: true,
-        onentry: entry => p.add(entry)
-      })
-    else
-      p.add(file)
-  })
-  p.end()
-}
-
-const addFilesAsync = (p, files) => {
-  while (files.length) {
-    const file = files.shift()
-    if (file.charAt(0) === '@')
-      return t({
-        file: path.resolve(p.cwd, file.substr(1)),
-        noResume: true,
-        onentry: entry => p.add(entry)
-      }).then(_ => addFilesAsync(p, files))
-    else
-      p.add(file)
-  }
-  p.end()
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/types.js b/legacy-libs/grpc/node_modules/tar/lib/types.js
deleted file mode 100644 (file)
index df42565..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict'
-// map types from key to human-friendly name
-exports.name = new Map([
-  ['0', 'File'],
-  // same as File
-  ['', 'OldFile'],
-  ['1', 'Link'],
-  ['2', 'SymbolicLink'],
-  // Devices and FIFOs aren't fully supported
-  // they are parsed, but skipped when unpacking
-  ['3', 'CharacterDevice'],
-  ['4', 'BlockDevice'],
-  ['5', 'Directory'],
-  ['6', 'FIFO'],
-  // same as File
-  ['7', 'ContiguousFile'],
-  // pax headers
-  ['g', 'GlobalExtendedHeader'],
-  ['x', 'ExtendedHeader'],
-  // vendor-specific stuff
-  // skip
-  ['A', 'SolarisACL'],
-  // like 5, but with data, which should be skipped
-  ['D', 'GNUDumpDir'],
-  // metadata only, skip
-  ['I', 'Inode'],
-  // data = link path of next file
-  ['K', 'NextFileHasLongLinkpath'],
-  // data = path of next file
-  ['L', 'NextFileHasLongPath'],
-  // skip
-  ['M', 'ContinuationFile'],
-  // like L
-  ['N', 'OldGnuLongPath'],
-  // skip
-  ['S', 'SparseFile'],
-  // skip
-  ['V', 'TapeVolumeHeader'],
-  // like x
-  ['X', 'OldExtendedHeader']
-])
-
-// map the other direction
-exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]]))
diff --git a/legacy-libs/grpc/node_modules/tar/lib/unpack.js b/legacy-libs/grpc/node_modules/tar/lib/unpack.js
deleted file mode 100644 (file)
index fc76509..0000000
+++ /dev/null
@@ -1,621 +0,0 @@
-'use strict'
-
-const assert = require('assert')
-const EE = require('events').EventEmitter
-const Parser = require('./parse.js')
-const fs = require('fs')
-const fsm = require('fs-minipass')
-const path = require('path')
-const mkdir = require('./mkdir.js')
-const mkdirSync = mkdir.sync
-const wc = require('./winchars.js')
-
-const ONENTRY = Symbol('onEntry')
-const CHECKFS = Symbol('checkFs')
-const ISREUSABLE = Symbol('isReusable')
-const MAKEFS = Symbol('makeFs')
-const FILE = Symbol('file')
-const DIRECTORY = Symbol('directory')
-const LINK = Symbol('link')
-const SYMLINK = Symbol('symlink')
-const HARDLINK = Symbol('hardlink')
-const UNSUPPORTED = Symbol('unsupported')
-const UNKNOWN = Symbol('unknown')
-const CHECKPATH = Symbol('checkPath')
-const MKDIR = Symbol('mkdir')
-const ONERROR = Symbol('onError')
-const PENDING = Symbol('pending')
-const PEND = Symbol('pend')
-const UNPEND = Symbol('unpend')
-const ENDED = Symbol('ended')
-const MAYBECLOSE = Symbol('maybeClose')
-const SKIP = Symbol('skip')
-const DOCHOWN = Symbol('doChown')
-const UID = Symbol('uid')
-const GID = Symbol('gid')
-const crypto = require('crypto')
-
-// Unlinks on Windows are not atomic.
-//
-// This means that if you have a file entry, followed by another
-// file entry with an identical name, and you cannot re-use the file
-// (because it's a hardlink, or because unlink:true is set, or it's
-// Windows, which does not have useful nlink values), then the unlink
-// will be committed to the disk AFTER the new file has been written
-// over the old one, deleting the new file.
-//
-// To work around this, on Windows systems, we rename the file and then
-// delete the renamed file.  It's a sloppy kludge, but frankly, I do not
-// know of a better way to do this, given windows' non-atomic unlink
-// semantics.
-//
-// See: https://github.com/npm/node-tar/issues/183
-/* istanbul ignore next */
-const unlinkFile = (path, cb) => {
-  if (process.platform !== 'win32')
-    return fs.unlink(path, cb)
-
-  const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex')
-  fs.rename(path, name, er => {
-    if (er)
-      return cb(er)
-    fs.unlink(name, cb)
-  })
-}
-
-/* istanbul ignore next */
-const unlinkFileSync = path => {
-  if (process.platform !== 'win32')
-    return fs.unlinkSync(path)
-
-  const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex')
-  fs.renameSync(path, name)
-  fs.unlinkSync(name)
-}
-
-// this.gid, entry.gid, this.processUid
-const uint32 = (a, b, c) =>
-  a === a >>> 0 ? a
-  : b === b >>> 0 ? b
-  : c
-
-class Unpack extends Parser {
-  constructor (opt) {
-    if (!opt)
-      opt = {}
-
-    opt.ondone = _ => {
-      this[ENDED] = true
-      this[MAYBECLOSE]()
-    }
-
-    super(opt)
-
-    this.transform = typeof opt.transform === 'function' ? opt.transform : null
-
-    this.writable = true
-    this.readable = false
-
-    this[PENDING] = 0
-    this[ENDED] = false
-
-    this.dirCache = opt.dirCache || new Map()
-
-    if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {
-      // need both or neither
-      if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number')
-        throw new TypeError('cannot set owner without number uid and gid')
-      if (opt.preserveOwner)
-        throw new TypeError(
-          'cannot preserve owner in archive and also set owner explicitly')
-      this.uid = opt.uid
-      this.gid = opt.gid
-      this.setOwner = true
-    } else {
-      this.uid = null
-      this.gid = null
-      this.setOwner = false
-    }
-
-    // default true for root
-    if (opt.preserveOwner === undefined && typeof opt.uid !== 'number')
-      this.preserveOwner = process.getuid && process.getuid() === 0
-    else
-      this.preserveOwner = !!opt.preserveOwner
-
-    this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ?
-      process.getuid() : null
-    this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ?
-      process.getgid() : null
-
-    // mostly just for testing, but useful in some cases.
-    // Forcibly trigger a chown on every entry, no matter what
-    this.forceChown = opt.forceChown === true
-
-    // turn ><?| in filenames into 0xf000-higher encoded forms
-    this.win32 = !!opt.win32 || process.platform === 'win32'
-
-    // do not unpack over files that are newer than what's in the archive
-    this.newer = !!opt.newer
-
-    // do not unpack over ANY files
-    this.keep = !!opt.keep
-
-    // do not set mtime/atime of extracted entries
-    this.noMtime = !!opt.noMtime
-
-    // allow .., absolute path entries, and unpacking through symlinks
-    // without this, warn and skip .., relativize absolutes, and error
-    // on symlinks in extraction path
-    this.preservePaths = !!opt.preservePaths
-
-    // unlink files and links before writing. This breaks existing hard
-    // links, and removes symlink directories rather than erroring
-    this.unlink = !!opt.unlink
-
-    this.cwd = path.resolve(opt.cwd || process.cwd())
-    this.strip = +opt.strip || 0
-    this.processUmask = process.umask()
-    this.umask = typeof opt.umask === 'number' ? opt.umask : this.processUmask
-    // default mode for dirs created as parents
-    this.dmode = opt.dmode || (0o0777 & (~this.umask))
-    this.fmode = opt.fmode || (0o0666 & (~this.umask))
-    this.on('entry', entry => this[ONENTRY](entry))
-  }
-
-  [MAYBECLOSE] () {
-    if (this[ENDED] && this[PENDING] === 0) {
-      this.emit('prefinish')
-      this.emit('finish')
-      this.emit('end')
-      this.emit('close')
-    }
-  }
-
-  [CHECKPATH] (entry) {
-    if (this.strip) {
-      const parts = entry.path.split(/\/|\\/)
-      if (parts.length < this.strip)
-        return false
-      entry.path = parts.slice(this.strip).join('/')
-
-      if (entry.type === 'Link') {
-        const linkparts = entry.linkpath.split(/\/|\\/)
-        if (linkparts.length >= this.strip)
-          entry.linkpath = linkparts.slice(this.strip).join('/')
-      }
-    }
-
-    if (!this.preservePaths) {
-      const p = entry.path
-      if (p.match(/(^|\/|\\)\.\.(\\|\/|$)/)) {
-        this.warn('path contains \'..\'', p)
-        return false
-      }
-
-      // absolutes on posix are also absolutes on win32
-      // so we only need to test this one to get both
-      if (path.win32.isAbsolute(p)) {
-        const parsed = path.win32.parse(p)
-        this.warn('stripping ' + parsed.root + ' from absolute path', p)
-        entry.path = p.substr(parsed.root.length)
-      }
-    }
-
-    // only encode : chars that aren't drive letter indicators
-    if (this.win32) {
-      const parsed = path.win32.parse(entry.path)
-      entry.path = parsed.root === '' ? wc.encode(entry.path)
-        : parsed.root + wc.encode(entry.path.substr(parsed.root.length))
-    }
-
-    if (path.isAbsolute(entry.path))
-      entry.absolute = entry.path
-    else
-      entry.absolute = path.resolve(this.cwd, entry.path)
-
-    return true
-  }
-
-  [ONENTRY] (entry) {
-    if (!this[CHECKPATH](entry))
-      return entry.resume()
-
-    assert.equal(typeof entry.absolute, 'string')
-
-    switch (entry.type) {
-      case 'Directory':
-      case 'GNUDumpDir':
-        if (entry.mode)
-          entry.mode = entry.mode | 0o700
-
-      case 'File':
-      case 'OldFile':
-      case 'ContiguousFile':
-      case 'Link':
-      case 'SymbolicLink':
-        return this[CHECKFS](entry)
-
-      case 'CharacterDevice':
-      case 'BlockDevice':
-      case 'FIFO':
-        return this[UNSUPPORTED](entry)
-    }
-  }
-
-  [ONERROR] (er, entry) {
-    // Cwd has to exist, or else nothing works. That's serious.
-    // Other errors are warnings, which raise the error in strict
-    // mode, but otherwise continue on.
-    if (er.name === 'CwdError')
-      this.emit('error', er)
-    else {
-      this.warn(er.message, er)
-      this[UNPEND]()
-      entry.resume()
-    }
-  }
-
-  [MKDIR] (dir, mode, cb) {
-    mkdir(dir, {
-      uid: this.uid,
-      gid: this.gid,
-      processUid: this.processUid,
-      processGid: this.processGid,
-      umask: this.processUmask,
-      preserve: this.preservePaths,
-      unlink: this.unlink,
-      cache: this.dirCache,
-      cwd: this.cwd,
-      mode: mode
-    }, cb)
-  }
-
-  [DOCHOWN] (entry) {
-    // in preserve owner mode, chown if the entry doesn't match process
-    // in set owner mode, chown if setting doesn't match process
-    return this.forceChown ||
-      this.preserveOwner &&
-      ( typeof entry.uid === 'number' && entry.uid !== this.processUid ||
-        typeof entry.gid === 'number' && entry.gid !== this.processGid )
-      ||
-      ( typeof this.uid === 'number' && this.uid !== this.processUid ||
-        typeof this.gid === 'number' && this.gid !== this.processGid )
-  }
-
-  [UID] (entry) {
-    return uint32(this.uid, entry.uid, this.processUid)
-  }
-
-  [GID] (entry) {
-    return uint32(this.gid, entry.gid, this.processGid)
-  }
-
-  [FILE] (entry) {
-    const mode = entry.mode & 0o7777 || this.fmode
-    const stream = new fsm.WriteStream(entry.absolute, {
-      mode: mode,
-      autoClose: false
-    })
-    stream.on('error', er => this[ONERROR](er, entry))
-
-    let actions = 1
-    const done = er => {
-      if (er)
-        return this[ONERROR](er, entry)
-
-      if (--actions === 0)
-        fs.close(stream.fd, _ => this[UNPEND]())
-    }
-
-    stream.on('finish', _ => {
-      // if futimes fails, try utimes
-      // if utimes fails, fail with the original error
-      // same for fchown/chown
-      const abs = entry.absolute
-      const fd = stream.fd
-
-      if (entry.mtime && !this.noMtime) {
-        actions++
-        const atime = entry.atime || new Date()
-        const mtime = entry.mtime
-        fs.futimes(fd, atime, mtime, er =>
-          er ? fs.utimes(abs, atime, mtime, er2 => done(er2 && er))
-          : done())
-      }
-
-      if (this[DOCHOWN](entry)) {
-        actions++
-        const uid = this[UID](entry)
-        const gid = this[GID](entry)
-        fs.fchown(fd, uid, gid, er =>
-          er ? fs.chown(abs, uid, gid, er2 => done(er2 && er))
-          : done())
-      }
-
-      done()
-    })
-
-    const tx = this.transform ? this.transform(entry) || entry : entry
-    if (tx !== entry) {
-      tx.on('error', er => this[ONERROR](er, entry))
-      entry.pipe(tx)
-    }
-    tx.pipe(stream)
-  }
-
-  [DIRECTORY] (entry) {
-    const mode = entry.mode & 0o7777 || this.dmode
-    this[MKDIR](entry.absolute, mode, er => {
-      if (er)
-        return this[ONERROR](er, entry)
-
-      let actions = 1
-      const done = _ => {
-        if (--actions === 0) {
-          this[UNPEND]()
-          entry.resume()
-        }
-      }
-
-      if (entry.mtime && !this.noMtime) {
-        actions++
-        fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done)
-      }
-
-      if (this[DOCHOWN](entry)) {
-        actions++
-        fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done)
-      }
-
-      done()
-    })
-  }
-
-  [UNSUPPORTED] (entry) {
-    this.warn('unsupported entry type: ' + entry.type, entry)
-    entry.resume()
-  }
-
-  [SYMLINK] (entry) {
-    this[LINK](entry, entry.linkpath, 'symlink')
-  }
-
-  [HARDLINK] (entry) {
-    this[LINK](entry, path.resolve(this.cwd, entry.linkpath), 'link')
-  }
-
-  [PEND] () {
-    this[PENDING]++
-  }
-
-  [UNPEND] () {
-    this[PENDING]--
-    this[MAYBECLOSE]()
-  }
-
-  [SKIP] (entry) {
-    this[UNPEND]()
-    entry.resume()
-  }
-
-  // Check if we can reuse an existing filesystem entry safely and
-  // overwrite it, rather than unlinking and recreating
-  // Windows doesn't report a useful nlink, so we just never reuse entries
-  [ISREUSABLE] (entry, st) {
-    return entry.type === 'File' &&
-      !this.unlink &&
-      st.isFile() &&
-      st.nlink <= 1 &&
-      process.platform !== 'win32'
-  }
-
-  // check if a thing is there, and if so, try to clobber it
-  [CHECKFS] (entry) {
-    this[PEND]()
-    this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
-      if (er)
-        return this[ONERROR](er, entry)
-      fs.lstat(entry.absolute, (er, st) => {
-        if (st && (this.keep || this.newer && st.mtime > entry.mtime))
-          this[SKIP](entry)
-        else if (er || this[ISREUSABLE](entry, st))
-          this[MAKEFS](null, entry)
-        else if (st.isDirectory()) {
-          if (entry.type === 'Directory') {
-            if (!entry.mode || (st.mode & 0o7777) === entry.mode)
-              this[MAKEFS](null, entry)
-            else
-              fs.chmod(entry.absolute, entry.mode, er => this[MAKEFS](er, entry))
-          } else
-            fs.rmdir(entry.absolute, er => this[MAKEFS](er, entry))
-        } else
-          unlinkFile(entry.absolute, er => this[MAKEFS](er, entry))
-      })
-    })
-  }
-
-  [MAKEFS] (er, entry) {
-    if (er)
-      return this[ONERROR](er, entry)
-
-    switch (entry.type) {
-      case 'File':
-      case 'OldFile':
-      case 'ContiguousFile':
-        return this[FILE](entry)
-
-      case 'Link':
-        return this[HARDLINK](entry)
-
-      case 'SymbolicLink':
-        return this[SYMLINK](entry)
-
-      case 'Directory':
-      case 'GNUDumpDir':
-        return this[DIRECTORY](entry)
-    }
-  }
-
-  [LINK] (entry, linkpath, link) {
-    // XXX: get the type ('file' or 'dir') for windows
-    fs[link](linkpath, entry.absolute, er => {
-      if (er)
-        return this[ONERROR](er, entry)
-      this[UNPEND]()
-      entry.resume()
-    })
-  }
-}
-
-class UnpackSync extends Unpack {
-  constructor (opt) {
-    super(opt)
-  }
-
-  [CHECKFS] (entry) {
-    const er = this[MKDIR](path.dirname(entry.absolute), this.dmode)
-    if (er)
-      return this[ONERROR](er, entry)
-    try {
-      const st = fs.lstatSync(entry.absolute)
-      if (this.keep || this.newer && st.mtime > entry.mtime)
-        return this[SKIP](entry)
-      else if (this[ISREUSABLE](entry, st))
-        return this[MAKEFS](null, entry)
-      else {
-        try {
-          if (st.isDirectory()) {
-            if (entry.type === 'Directory') {
-              if (entry.mode && (st.mode & 0o7777) !== entry.mode)
-                fs.chmodSync(entry.absolute, entry.mode)
-            } else
-              fs.rmdirSync(entry.absolute)
-          } else
-            unlinkFileSync(entry.absolute)
-          return this[MAKEFS](null, entry)
-        } catch (er) {
-          return this[ONERROR](er, entry)
-        }
-      }
-    } catch (er) {
-      return this[MAKEFS](null, entry)
-    }
-  }
-
-  [FILE] (entry) {
-    const mode = entry.mode & 0o7777 || this.fmode
-
-    const oner = er => {
-      try { fs.closeSync(fd) } catch (_) {}
-      if (er)
-        this[ONERROR](er, entry)
-    }
-
-    let stream
-    let fd
-    try {
-      fd = fs.openSync(entry.absolute, 'w', mode)
-    } catch (er) {
-      return oner(er)
-    }
-    const tx = this.transform ? this.transform(entry) || entry : entry
-    if (tx !== entry) {
-      tx.on('error', er => this[ONERROR](er, entry))
-      entry.pipe(tx)
-    }
-
-    tx.on('data', chunk => {
-      try {
-        fs.writeSync(fd, chunk, 0, chunk.length)
-      } catch (er) {
-        oner(er)
-      }
-    })
-
-    tx.on('end', _ => {
-      let er = null
-      // try both, falling futimes back to utimes
-      // if either fails, handle the first error
-      if (entry.mtime && !this.noMtime) {
-        const atime = entry.atime || new Date()
-        const mtime = entry.mtime
-        try {
-          fs.futimesSync(fd, atime, mtime)
-        } catch (futimeser) {
-          try {
-            fs.utimesSync(entry.absolute, atime, mtime)
-          } catch (utimeser) {
-            er = futimeser
-          }
-        }
-      }
-
-      if (this[DOCHOWN](entry)) {
-        const uid = this[UID](entry)
-        const gid = this[GID](entry)
-
-        try {
-          fs.fchownSync(fd, uid, gid)
-        } catch (fchowner) {
-          try {
-            fs.chownSync(entry.absolute, uid, gid)
-          } catch (chowner) {
-            er = er || fchowner
-          }
-        }
-      }
-
-      oner(er)
-    })
-  }
-
-  [DIRECTORY] (entry) {
-    const mode = entry.mode & 0o7777 || this.dmode
-    const er = this[MKDIR](entry.absolute, mode)
-    if (er)
-      return this[ONERROR](er, entry)
-    if (entry.mtime && !this.noMtime) {
-      try {
-        fs.utimesSync(entry.absolute, entry.atime || new Date(), entry.mtime)
-      } catch (er) {}
-    }
-    if (this[DOCHOWN](entry)) {
-      try {
-        fs.chownSync(entry.absolute, this[UID](entry), this[GID](entry))
-      } catch (er) {}
-    }
-    entry.resume()
-  }
-
-  [MKDIR] (dir, mode) {
-    try {
-      return mkdir.sync(dir, {
-        uid: this.uid,
-        gid: this.gid,
-        processUid: this.processUid,
-        processGid: this.processGid,
-        umask: this.processUmask,
-        preserve: this.preservePaths,
-        unlink: this.unlink,
-        cache: this.dirCache,
-        cwd: this.cwd,
-        mode: mode
-      })
-    } catch (er) {
-      return er
-    }
-  }
-
-  [LINK] (entry, linkpath, link) {
-    try {
-      fs[link + 'Sync'](linkpath, entry.absolute)
-      entry.resume()
-    } catch (er) {
-      return this[ONERROR](er, entry)
-    }
-  }
-}
-
-Unpack.Sync = UnpackSync
-module.exports = Unpack
diff --git a/legacy-libs/grpc/node_modules/tar/lib/update.js b/legacy-libs/grpc/node_modules/tar/lib/update.js
deleted file mode 100644 (file)
index 16c3e93..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict'
-
-// tar -u
-
-const hlo = require('./high-level-opt.js')
-const r = require('./replace.js')
-// just call tar.r with the filter and mtimeCache
-
-const u = module.exports = (opt_, files, cb) => {
-  const opt = hlo(opt_)
-
-  if (!opt.file)
-    throw new TypeError('file is required')
-
-  if (opt.gzip)
-    throw new TypeError('cannot append to compressed archives')
-
-  if (!files || !Array.isArray(files) || !files.length)
-    throw new TypeError('no files or directories specified')
-
-  files = Array.from(files)
-
-  mtimeFilter(opt)
-  return r(opt, files, cb)
-}
-
-const mtimeFilter = opt => {
-  const filter = opt.filter
-
-  if (!opt.mtimeCache)
-    opt.mtimeCache = new Map()
-
-  opt.filter = filter ? (path, stat) =>
-    filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime)
-    : (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime)
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/warn-mixin.js b/legacy-libs/grpc/node_modules/tar/lib/warn-mixin.js
deleted file mode 100644 (file)
index 94a4b9b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-module.exports = Base => class extends Base {
-  warn (msg, data) {
-    if (!this.strict)
-      this.emit('warn', msg, data)
-    else if (data instanceof Error)
-      this.emit('error', data)
-    else {
-      const er = new Error(msg)
-      er.data = data
-      this.emit('error', er)
-    }
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/winchars.js b/legacy-libs/grpc/node_modules/tar/lib/winchars.js
deleted file mode 100644 (file)
index cf6ea06..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict'
-
-// When writing files on Windows, translate the characters to their
-// 0xf000 higher-encoded versions.
-
-const raw = [
-  '|',
-  '<',
-  '>',
-  '?',
-  ':'
-]
-
-const win = raw.map(char =>
-  String.fromCharCode(0xf000 + char.charCodeAt(0)))
-
-const toWin = new Map(raw.map((char, i) => [char, win[i]]))
-const toRaw = new Map(win.map((char, i) => [char, raw[i]]))
-
-module.exports = {
-  encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s),
-  decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)
-}
diff --git a/legacy-libs/grpc/node_modules/tar/lib/write-entry.js b/legacy-libs/grpc/node_modules/tar/lib/write-entry.js
deleted file mode 100644 (file)
index 63f7494..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-'use strict'
-const Buffer = require('./buffer.js')
-const MiniPass = require('minipass')
-const Pax = require('./pax.js')
-const Header = require('./header.js')
-const ReadEntry = require('./read-entry.js')
-const fs = require('fs')
-const path = require('path')
-
-const types = require('./types.js')
-const maxReadSize = 16 * 1024 * 1024
-const PROCESS = Symbol('process')
-const FILE = Symbol('file')
-const DIRECTORY = Symbol('directory')
-const SYMLINK = Symbol('symlink')
-const HARDLINK = Symbol('hardlink')
-const HEADER = Symbol('header')
-const READ = Symbol('read')
-const LSTAT = Symbol('lstat')
-const ONLSTAT = Symbol('onlstat')
-const ONREAD = Symbol('onread')
-const ONREADLINK = Symbol('onreadlink')
-const OPENFILE = Symbol('openfile')
-const ONOPENFILE = Symbol('onopenfile')
-const CLOSE = Symbol('close')
-const MODE = Symbol('mode')
-const warner = require('./warn-mixin.js')
-const winchars = require('./winchars.js')
-
-const modeFix = require('./mode-fix.js')
-
-const WriteEntry = warner(class WriteEntry extends MiniPass {
-  constructor (p, opt) {
-    opt = opt || {}
-    super(opt)
-    if (typeof p !== 'string')
-      throw new TypeError('path is required')
-    this.path = p
-    // suppress atime, ctime, uid, gid, uname, gname
-    this.portable = !!opt.portable
-    // until node has builtin pwnam functions, this'll have to do
-    this.myuid = process.getuid && process.getuid()
-    this.myuser = process.env.USER || ''
-    this.maxReadSize = opt.maxReadSize || maxReadSize
-    this.linkCache = opt.linkCache || new Map()
-    this.statCache = opt.statCache || new Map()
-    this.preservePaths = !!opt.preservePaths
-    this.cwd = opt.cwd || process.cwd()
-    this.strict = !!opt.strict
-    this.noPax = !!opt.noPax
-    this.noMtime = !!opt.noMtime
-    this.mtime = opt.mtime || null
-
-    if (typeof opt.onwarn === 'function')
-      this.on('warn', opt.onwarn)
-
-    if (!this.preservePaths && path.win32.isAbsolute(p)) {
-      // absolutes on posix are also absolutes on win32
-      // so we only need to test this one to get both
-      const parsed = path.win32.parse(p)
-      this.warn('stripping ' + parsed.root + ' from absolute path', p)
-      this.path = p.substr(parsed.root.length)
-    }
-
-    this.win32 = !!opt.win32 || process.platform === 'win32'
-    if (this.win32) {
-      this.path = winchars.decode(this.path.replace(/\\/g, '/'))
-      p = p.replace(/\\/g, '/')
-    }
-
-    this.absolute = opt.absolute || path.resolve(this.cwd, p)
-
-    if (this.path === '')
-      this.path = './'
-
-    if (this.statCache.has(this.absolute))
-      this[ONLSTAT](this.statCache.get(this.absolute))
-    else
-      this[LSTAT]()
-  }
-
-  [LSTAT] () {
-    fs.lstat(this.absolute, (er, stat) => {
-      if (er)
-        return this.emit('error', er)
-      this[ONLSTAT](stat)
-    })
-  }
-
-  [ONLSTAT] (stat) {
-    this.statCache.set(this.absolute, stat)
-    this.stat = stat
-    if (!stat.isFile())
-      stat.size = 0
-    this.type = getType(stat)
-    this.emit('stat', stat)
-    this[PROCESS]()
-  }
-
-  [PROCESS] () {
-    switch (this.type) {
-      case 'File': return this[FILE]()
-      case 'Directory': return this[DIRECTORY]()
-      case 'SymbolicLink': return this[SYMLINK]()
-      // unsupported types are ignored.
-      default: return this.end()
-    }
-  }
-
-  [MODE] (mode) {
-    return modeFix(mode, this.type === 'Directory')
-  }
-
-  [HEADER] () {
-    if (this.type === 'Directory' && this.portable)
-      this.noMtime = true
-
-    this.header = new Header({
-      path: this.path,
-      linkpath: this.linkpath,
-      // only the permissions and setuid/setgid/sticky bitflags
-      // not the higher-order bits that specify file type
-      mode: this[MODE](this.stat.mode),
-      uid: this.portable ? null : this.stat.uid,
-      gid: this.portable ? null : this.stat.gid,
-      size: this.stat.size,
-      mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
-      type: this.type,
-      uname: this.portable ? null :
-        this.stat.uid === this.myuid ? this.myuser : '',
-      atime: this.portable ? null : this.stat.atime,
-      ctime: this.portable ? null : this.stat.ctime
-    })
-
-    if (this.header.encode() && !this.noPax)
-      this.write(new Pax({
-        atime: this.portable ? null : this.header.atime,
-        ctime: this.portable ? null : this.header.ctime,
-        gid: this.portable ? null : this.header.gid,
-        mtime: this.noMtime ? null : this.mtime || this.header.mtime,
-        path: this.path,
-        linkpath: this.linkpath,
-        size: this.header.size,
-        uid: this.portable ? null : this.header.uid,
-        uname: this.portable ? null : this.header.uname,
-        dev: this.portable ? null : this.stat.dev,
-        ino: this.portable ? null : this.stat.ino,
-        nlink: this.portable ? null : this.stat.nlink
-      }).encode())
-    this.write(this.header.block)
-  }
-
-  [DIRECTORY] () {
-    if (this.path.substr(-1) !== '/')
-      this.path += '/'
-    this.stat.size = 0
-    this[HEADER]()
-    this.end()
-  }
-
-  [SYMLINK] () {
-    fs.readlink(this.absolute, (er, linkpath) => {
-      if (er)
-        return this.emit('error', er)
-      this[ONREADLINK](linkpath)
-    })
-  }
-
-  [ONREADLINK] (linkpath) {
-    this.linkpath = linkpath
-    this[HEADER]()
-    this.end()
-  }
-
-  [HARDLINK] (linkpath) {
-    this.type = 'Link'
-    this.linkpath = path.relative(this.cwd, linkpath)
-    this.stat.size = 0
-    this[HEADER]()
-    this.end()
-  }
-
-  [FILE] () {
-    if (this.stat.nlink > 1) {
-      const linkKey = this.stat.dev + ':' + this.stat.ino
-      if (this.linkCache.has(linkKey)) {
-        const linkpath = this.linkCache.get(linkKey)
-        if (linkpath.indexOf(this.cwd) === 0)
-          return this[HARDLINK](linkpath)
-      }
-      this.linkCache.set(linkKey, this.absolute)
-    }
-
-    this[HEADER]()
-    if (this.stat.size === 0)
-      return this.end()
-
-    this[OPENFILE]()
-  }
-
-  [OPENFILE] () {
-    fs.open(this.absolute, 'r', (er, fd) => {
-      if (er)
-        return this.emit('error', er)
-      this[ONOPENFILE](fd)
-    })
-  }
-
-  [ONOPENFILE] (fd) {
-    const blockLen = 512 * Math.ceil(this.stat.size / 512)
-    const bufLen = Math.min(blockLen, this.maxReadSize)
-    const buf = Buffer.allocUnsafe(bufLen)
-    this[READ](fd, buf, 0, buf.length, 0, this.stat.size, blockLen)
-  }
-
-  [READ] (fd, buf, offset, length, pos, remain, blockRemain) {
-    fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {
-      if (er)
-        return this[CLOSE](fd, _ => this.emit('error', er))
-      this[ONREAD](fd, buf, offset, length, pos, remain, blockRemain, bytesRead)
-    })
-  }
-
-  [CLOSE] (fd, cb) {
-    fs.close(fd, cb)
-  }
-
-  [ONREAD] (fd, buf, offset, length, pos, remain, blockRemain, bytesRead) {
-    if (bytesRead <= 0 && remain > 0) {
-      const er = new Error('encountered unexpected EOF')
-      er.path = this.absolute
-      er.syscall = 'read'
-      er.code = 'EOF'
-      this[CLOSE](fd)
-      return this.emit('error', er)
-    }
-
-    if (bytesRead > remain) {
-      const er = new Error('did not encounter expected EOF')
-      er.path = this.absolute
-      er.syscall = 'read'
-      er.code = 'EOF'
-      this[CLOSE](fd)
-      return this.emit('error', er)
-    }
-
-    // null out the rest of the buffer, if we could fit the block padding
-    if (bytesRead === remain) {
-      for (let i = bytesRead; i < length && bytesRead < blockRemain; i++) {
-        buf[i + offset] = 0
-        bytesRead ++
-        remain ++
-      }
-    }
-
-    const writeBuf = offset === 0 && bytesRead === buf.length ?
-      buf : buf.slice(offset, offset + bytesRead)
-    remain -= bytesRead
-    blockRemain -= bytesRead
-    pos += bytesRead
-    offset += bytesRead
-
-    this.write(writeBuf)
-
-    if (!remain) {
-      if (blockRemain)
-        this.write(Buffer.alloc(blockRemain))
-      this.end()
-      this[CLOSE](fd, _ => _)
-      return
-    }
-
-    if (offset >= length) {
-      buf = Buffer.allocUnsafe(length)
-      offset = 0
-    }
-    length = buf.length - offset
-    this[READ](fd, buf, offset, length, pos, remain, blockRemain)
-  }
-})
-
-class WriteEntrySync extends WriteEntry {
-  constructor (path, opt) {
-    super(path, opt)
-  }
-
-  [LSTAT] () {
-    this[ONLSTAT](fs.lstatSync(this.absolute))
-  }
-
-  [SYMLINK] () {
-    this[ONREADLINK](fs.readlinkSync(this.absolute))
-  }
-
-  [OPENFILE] () {
-    this[ONOPENFILE](fs.openSync(this.absolute, 'r'))
-  }
-
-  [READ] (fd, buf, offset, length, pos, remain, blockRemain) {
-    let threw = true
-    try {
-      const bytesRead = fs.readSync(fd, buf, offset, length, pos)
-      this[ONREAD](fd, buf, offset, length, pos, remain, blockRemain, bytesRead)
-      threw = false
-    } finally {
-      if (threw)
-        try { this[CLOSE](fd) } catch (er) {}
-    }
-  }
-
-  [CLOSE] (fd) {
-    fs.closeSync(fd)
-  }
-}
-
-const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
-  constructor (readEntry, opt) {
-    opt = opt || {}
-    super(opt)
-    this.preservePaths = !!opt.preservePaths
-    this.portable = !!opt.portable
-    this.strict = !!opt.strict
-    this.noPax = !!opt.noPax
-    this.noMtime = !!opt.noMtime
-
-    this.readEntry = readEntry
-    this.type = readEntry.type
-    if (this.type === 'Directory' && this.portable)
-      this.noMtime = true
-
-    this.path = readEntry.path
-    this.mode = this[MODE](readEntry.mode)
-    this.uid = this.portable ? null : readEntry.uid
-    this.gid = this.portable ? null : readEntry.gid
-    this.uname = this.portable ? null : readEntry.uname
-    this.gname = this.portable ? null : readEntry.gname
-    this.size = readEntry.size
-    this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime
-    this.atime = this.portable ? null : readEntry.atime
-    this.ctime = this.portable ? null : readEntry.ctime
-    this.linkpath = readEntry.linkpath
-
-    if (typeof opt.onwarn === 'function')
-      this.on('warn', opt.onwarn)
-
-    if (path.isAbsolute(this.path) && !this.preservePaths) {
-      const parsed = path.parse(this.path)
-      this.warn(
-        'stripping ' + parsed.root + ' from absolute path',
-        this.path
-      )
-      this.path = this.path.substr(parsed.root.length)
-    }
-
-    this.remain = readEntry.size
-    this.blockRemain = readEntry.startBlockSize
-
-    this.header = new Header({
-      path: this.path,
-      linkpath: this.linkpath,
-      // only the permissions and setuid/setgid/sticky bitflags
-      // not the higher-order bits that specify file type
-      mode: this.mode,
-      uid: this.portable ? null : this.uid,
-      gid: this.portable ? null : this.gid,
-      size: this.size,
-      mtime: this.noMtime ? null : this.mtime,
-      type: this.type,
-      uname: this.portable ? null : this.uname,
-      atime: this.portable ? null : this.atime,
-      ctime: this.portable ? null : this.ctime
-    })
-
-    if (this.header.encode() && !this.noPax)
-      super.write(new Pax({
-        atime: this.portable ? null : this.atime,
-        ctime: this.portable ? null : this.ctime,
-        gid: this.portable ? null : this.gid,
-        mtime: this.noMtime ? null : this.mtime,
-        path: this.path,
-        linkpath: this.linkpath,
-        size: this.size,
-        uid: this.portable ? null : this.uid,
-        uname: this.portable ? null : this.uname,
-        dev: this.portable ? null : this.readEntry.dev,
-        ino: this.portable ? null : this.readEntry.ino,
-        nlink: this.portable ? null : this.readEntry.nlink
-      }).encode())
-
-    super.write(this.header.block)
-    readEntry.pipe(this)
-  }
-
-  [MODE] (mode) {
-    return modeFix(mode, this.type === 'Directory')
-  }
-
-  write (data) {
-    const writeLen = data.length
-    if (writeLen > this.blockRemain)
-      throw new Error('writing more to entry than is appropriate')
-    this.blockRemain -= writeLen
-    return super.write(data)
-  }
-
-  end () {
-    if (this.blockRemain)
-      this.write(Buffer.alloc(this.blockRemain))
-    return super.end()
-  }
-})
-
-WriteEntry.Sync = WriteEntrySync
-WriteEntry.Tar = WriteEntryTar
-
-const getType = stat =>
-  stat.isFile() ? 'File'
-  : stat.isDirectory() ? 'Directory'
-  : stat.isSymbolicLink() ? 'SymbolicLink'
-  : 'Unsupported'
-
-module.exports = WriteEntry
diff --git a/legacy-libs/grpc/node_modules/tar/package.json b/legacy-libs/grpc/node_modules/tar/package.json
deleted file mode 100644 (file)
index cc12992..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-{
-  "_from": "tar@^4",
-  "_id": "tar@4.4.10",
-  "_inBundle": false,
-  "_integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==",
-  "_location": "/grpc/tar",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "tar@^4",
-    "name": "tar",
-    "escapedName": "tar",
-    "rawSpec": "^4",
-    "saveSpec": null,
-    "fetchSpec": "^4"
-  },
-  "_requiredBy": [
-    "/grpc/node-pre-gyp"
-  ],
-  "_resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz",
-  "_shasum": "946b2810b9a5e0b26140cf78bea6b0b0d689eba1",
-  "_shrinkwrap": null,
-  "_spec": "tar@^4",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/node-pre-gyp",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/node-tar/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {
-    "chownr": "^1.1.1",
-    "fs-minipass": "^1.2.5",
-    "minipass": "^2.3.5",
-    "minizlib": "^1.2.1",
-    "mkdirp": "^0.5.0",
-    "safe-buffer": "^5.1.2",
-    "yallist": "^3.0.3"
-  },
-  "deprecated": false,
-  "description": "tar for node",
-  "devDependencies": {
-    "chmodr": "^1.2.0",
-    "end-of-stream": "^1.4.1",
-    "events-to-array": "^1.1.2",
-    "mutate-fs": "^2.1.1",
-    "rimraf": "^2.6.3",
-    "tap": "^14.2.0",
-    "tar-fs": "^1.16.3",
-    "tar-stream": "^1.6.2"
-  },
-  "engines": {
-    "node": ">=4.5"
-  },
-  "files": [
-    "index.js",
-    "lib/"
-  ],
-  "homepage": "https://github.com/npm/node-tar#readme",
-  "license": "ISC",
-  "name": "tar",
-  "optionalDependencies": {},
-  "readme": "# node-tar\n\n[![Build Status](https://travis-ci.org/npm/node-tar.svg?branch=master)](https://travis-ci.org/npm/node-tar)\n\n[Fast](./benchmarks) and full-featured Tar for Node.js\n\nThe API is designed to mimic the behavior of `tar(1)` on unix systems.\nIf you are familiar with how tar works, most of this will hopefully be\nstraightforward for you.  If not, then hopefully this module can teach\nyou useful unix skills that may come in handy someday :)\n\n## Background\n\nA \"tar file\" or \"tarball\" is an archive of file system entries\n(directories, files, links, etc.)  The name comes from \"tape archive\".\nIf you run `man tar` on almost any Unix command line, you'll learn\nquite a bit about what it can do, and its history.\n\nTar has 5 main top-level commands:\n\n* `c` Create an archive\n* `r` Replace entries within an archive\n* `u` Update entries within an archive (ie, replace if they're newer)\n* `t` List out the contents of an archive\n* `x` Extract an archive to disk\n\nThe other flags and options modify how this top level function works.\n\n## High-Level API\n\nThese 5 functions are the high-level API.  All of them have a\nsingle-character name (for unix nerds familiar with `tar(1)`) as well\nas a long name (for everyone else).\n\nAll the high-level functions take the following arguments, all three\nof which are optional and may be omitted.\n\n1. `options` - An optional object specifying various options\n2. `paths` - An array of paths to add or extract\n3. `callback` - Called when the command is completed, if async.  (If\n   sync or no file specified, providing a callback throws a\n   `TypeError`.)\n\nIf the command is sync (ie, if `options.sync=true`), then the\ncallback is not allowed, since the action will be completed immediately.\n\nIf a `file` argument is specified, and the command is async, then a\n`Promise` is returned.  In this case, if async, a callback may be\nprovided which is called when the command is completed.\n\nIf a `file` option is not specified, then a stream is returned.  For\n`create`, this is a readable stream of the generated archive.  For\n`list` and `extract` this is a writable stream that an archive should\nbe written into.  If a file is not specified, then a callback is not\nallowed, because you're already getting a stream to work with.\n\n`replace` and `update` only work on existing archives, and so require\na `file` argument.\n\nSync commands without a file argument return a stream that acts on its\ninput immediately in the same tick.  For readable streams, this means\nthat all of the data is immediately available by calling\n`stream.read()`.  For writable streams, it will be acted upon as soon\nas it is provided, but this can be at any time.\n\n### Warnings\n\nSome things cause tar to emit a warning, but should usually not cause\nthe entire operation to fail.  There are three ways to handle\nwarnings:\n\n1. **Ignore them** (default) Invalid entries won't be put in the\n   archive, and invalid entries won't be unpacked.  This is usually\n   fine, but can hide failures that you might care about.\n2. **Notice them**  Add an `onwarn` function to the options, or listen\n   to the `'warn'` event on any tar stream.  The function will get\n   called as `onwarn(message, data)`.  Handle as appropriate.\n3. **Explode them.**  Set `strict: true` in the options object, and\n   `warn` messages will be emitted as `'error'` events instead.  If\n   there's no `error` handler, this causes the program to crash.  If\n   used with a promise-returning/callback-taking method, then it'll\n   send the error to the promise/callback.\n\n### Examples\n\nThe API mimics the `tar(1)` command line functionality, with aliases\nfor more human-readable option and function names.  The goal is that\nif you know how to use `tar(1)` in Unix, then you know how to use\n`require('tar')` in JavaScript.\n\nTo replicate `tar czf my-tarball.tgz files and folders`, you'd do:\n\n```js\ntar.c(\n  {\n    gzip: <true|gzip options>,\n    file: 'my-tarball.tgz'\n  },\n  ['some', 'files', 'and', 'folders']\n).then(_ => { .. tarball has been created .. })\n```\n\nTo replicate `tar cz files and folders > my-tarball.tgz`, you'd do:\n\n```js\ntar.c( // or tar.create\n  {\n    gzip: <true|gzip options>\n  },\n  ['some', 'files', 'and', 'folders']\n).pipe(fs.createWriteStream('my-tarball.tgz'))\n```\n\nTo replicate `tar xf my-tarball.tgz` you'd do:\n\n```js\ntar.x(  // or tar.extract(\n  {\n    file: 'my-tarball.tgz'\n  }\n).then(_=> { .. tarball has been dumped in cwd .. })\n```\n\nTo replicate `cat my-tarball.tgz | tar x -C some-dir --strip=1`:\n\n```js\nfs.createReadStream('my-tarball.tgz').pipe(\n  tar.x({\n    strip: 1,\n    C: 'some-dir' // alias for cwd:'some-dir', also ok\n  })\n)\n```\n\nTo replicate `tar tf my-tarball.tgz`, do this:\n\n```js\ntar.t({\n  file: 'my-tarball.tgz',\n  onentry: entry => { .. do whatever with it .. }\n})\n```\n\nTo replicate `cat my-tarball.tgz | tar t` do:\n\n```js\nfs.createReadStream('my-tarball.tgz')\n  .pipe(tar.t())\n  .on('entry', entry => { .. do whatever with it .. })\n```\n\nTo do anything synchronous, add `sync: true` to the options.  Note\nthat sync functions don't take a callback and don't return a promise.\nWhen the function returns, it's already done.  Sync methods without a\nfile argument return a sync stream, which flushes immediately.  But,\nof course, it still won't be done until you `.end()` it.\n\nTo filter entries, add `filter: <function>` to the options.\nTar-creating methods call the filter with `filter(path, stat)`.\nTar-reading methods (including extraction) call the filter with\n`filter(path, entry)`.  The filter is called in the `this`-context of\nthe `Pack` or `Unpack` stream object.\n\nThe arguments list to `tar t` and `tar x` specify a list of filenames\nto extract or list, so they're equivalent to a filter that tests if\nthe file is in the list.\n\nFor those who _aren't_ fans of tar's single-character command names:\n\n```\ntar.c === tar.create\ntar.r === tar.replace (appends to archive, file is required)\ntar.u === tar.update (appends if newer, file is required)\ntar.x === tar.extract\ntar.t === tar.list\n```\n\nKeep reading for all the command descriptions and options, as well as\nthe low-level API that they are built on.\n\n### tar.c(options, fileList, callback) [alias: tar.create]\n\nCreate a tarball archive.\n\nThe `fileList` is an array of paths to add to the tarball.  Adding a\ndirectory also adds its children recursively.\n\nAn entry in `fileList` that starts with an `@` symbol is a tar archive\nwhose entries will be added.  To add a file that starts with `@`,\nprepend it with `./`.\n\nThe following options are supported:\n\n- `file` Write the tarball archive to the specified filename.  If this\n  is specified, then the callback will be fired when the file has been\n  written, and a promise will be returned that resolves when the file\n  is written.  If a filename is not specified, then a Readable Stream\n  will be returned which will emit the file data. [Alias: `f`]\n- `sync` Act synchronously.  If this is set, then any provided file\n  will be fully written after the call to `tar.c`.  If this is set,\n  and a file is not provided, then the resulting stream will already\n  have the data ready to `read` or `emit('data')` as soon as you\n  request it.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `cwd` The current working directory for creating the archive.\n  Defaults to `process.cwd()`.  [Alias: `C`]\n- `prefix` A path portion to prefix onto the entries in the archive.\n- `gzip` Set to any truthy value to create a gzipped archive, or an\n  object with settings for `zlib.Gzip()` [Alias: `z`]\n- `filter` A function that gets called with `(path, stat)` for each\n  entry being added.  Return `true` to add the entry to the archive,\n  or `false` to omit it.\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths. [Alias: `P`]\n- `mode` The mode to set on the created file archive\n- `noDirRecurse` Do not recursively archive the contents of\n  directories. [Alias: `n`]\n- `follow` Set to true to pack the targets of symbolic links.  Without\n  this option, symbolic links are archived as such. [Alias: `L`, `h`]\n- `noPax` Suppress pax extended headers.  Note that this means that\n  long paths and linkpaths will be truncated, and large or negative\n  numeric values may be interpreted incorrectly.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n  [Alias: `m`, `no-mtime`]\n- `mtime` Set to a `Date` object to force a specific `mtime` for\n  everything added to the archive.  Overridden by `noMtime`.\n\n\nThe following options are mostly internal, but can be modified in some\nadvanced use cases, such as re-using caches between runs.\n\n- `linkCache` A Map object containing the device and inode value for\n  any file whose nlink is > 1, to identify hard links.\n- `statCache` A Map object that caches calls `lstat`.\n- `readdirCache` A Map object that caches calls to `readdir`.\n- `jobs` A number specifying how many concurrent jobs to run.\n  Defaults to 4.\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 16 MB.\n\n### tar.x(options, fileList, callback) [alias: tar.extract]\n\nExtract a tarball archive.\n\nThe `fileList` is an array of paths to extract from the tarball.  If\nno paths are provided, then all the entries are extracted.\n\nIf the archive is gzipped, then tar will detect this and unzip it.\n\nNote that all directories that are created will be forced to be\nwritable, readable, and listable by their owner, to avoid cases where\na directory prevents extraction of child entries by virtue of its\nmode.\n\nMost extraction errors will cause a `warn` event to be emitted.  If\nthe `cwd` is missing, or not a directory, then the extraction will\nfail completely.\n\nThe following options are supported:\n\n- `cwd` Extract files relative to the specified directory.  Defaults\n  to `process.cwd()`.  If provided, this must exist and must be a\n  directory. [Alias: `C`]\n- `file` The archive file to extract.  If not specified, then a\n  Writable stream is returned where the archive data should be\n  written. [Alias: `f`]\n- `sync` Create files and directories synchronously.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `filter` A function that gets called with `(path, entry)` for each\n  entry being unpacked.  Return `true` to unpack the entry from the\n  archive, or `false` to skip it.\n- `newer` Set to true to keep the existing file on disk if it's newer\n  than the file in the archive. [Alias: `keep-newer`,\n  `keep-newer-files`]\n- `keep` Do not overwrite existing files.  In particular, if a file\n  appears more than once in an archive, later copies will not\n  overwrite earlier copies. [Alias: `k`, `keep-existing`]\n- `preservePaths` Allow absolute paths, paths containing `..`, and\n  extracting through symbolic links.  By default, `/` is stripped from\n  absolute paths, `..` paths are not extracted, and any file whose\n  location would be modified by a symbolic link is not extracted.\n  [Alias: `P`]\n- `unlink` Unlink files before creating them.  Without this option,\n  tar overwrites existing files, which preserves existing hardlinks.\n  With this option, existing hardlinks will be broken, as will any\n  symlink that would affect the location of an extracted file. [Alias:\n  `U`]\n- `strip` Remove the specified number of leading path elements.\n  Pathnames with fewer elements will be silently skipped.  Note that\n  the pathname is edited after applying the filter, but before\n  security checks. [Alias: `strip-components`, `stripComponents`]\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `preserveOwner` If true, tar will set the `uid` and `gid` of\n  extracted entries to the `uid` and `gid` fields in the archive.\n  This defaults to true when run as root, and false otherwise.  If\n  false, then files and directories will be set with the owner and\n  group of the user running the process.  This is similar to `-p` in\n  `tar(1)`, but ACLs and other system-specific data is never unpacked\n  in this implementation, and modes are set by default already.\n  [Alias: `p`]\n- `uid` Set to a number to force ownership of all extracted files and\n  folders, and all implicitly created directories, to be owned by the\n  specified user id, regardless of the `uid` field in the archive.\n  Cannot be used along with `preserveOwner`.  Requires also setting a\n  `gid` option.\n- `gid` Set to a number to force ownership of all extracted files and\n  folders, and all implicitly created directories, to be owned by the\n  specified group id, regardless of the `gid` field in the archive.\n  Cannot be used along with `preserveOwner`.  Requires also setting a\n  `uid` option.\n- `noMtime` Set to true to omit writing `mtime` value for extracted\n  entries. [Alias: `m`, `no-mtime`]\n- `transform` Provide a function that takes an `entry` object, and\n  returns a stream, or any falsey value.  If a stream is provided,\n  then that stream's data will be written instead of the contents of\n  the archive entry.  If a falsey value is provided, then the entry is\n  written to disk as normal.  (To exclude items from extraction, use\n  the `filter` option described above.)\n- `onentry` A function that gets called with `(entry)` for each entry\n  that passes the filter.\n\nThe following options are mostly internal, but can be modified in some\nadvanced use cases, such as re-using caches between runs.\n\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 16 MB.\n- `umask` Filter the modes of entries like `process.umask()`.\n- `dmode` Default mode for directories\n- `fmode` Default mode for files\n- `dirCache` A Map object of which directories exist.\n- `maxMetaEntrySize` The maximum size of meta entries that is\n  supported.  Defaults to 1 MB.\n\nNote that using an asynchronous stream type with the `transform`\noption will cause undefined behavior in sync extractions.\n[MiniPass](http://npm.im/minipass)-based streams are designed for this\nuse case.\n\n### tar.t(options, fileList, callback) [alias: tar.list]\n\nList the contents of a tarball archive.\n\nThe `fileList` is an array of paths to list from the tarball.  If\nno paths are provided, then all the entries are listed.\n\nIf the archive is gzipped, then tar will detect this and unzip it.\n\nReturns an event emitter that emits `entry` events with\n`tar.ReadEntry` objects.  However, they don't emit `'data'` or `'end'`\nevents.  (If you want to get actual readable entries, use the\n`tar.Parse` class instead.)\n\nThe following options are supported:\n\n- `cwd` Extract files relative to the specified directory.  Defaults\n  to `process.cwd()`. [Alias: `C`]\n- `file` The archive file to list.  If not specified, then a\n  Writable stream is returned where the archive data should be\n  written. [Alias: `f`]\n- `sync` Read the specified file synchronously.  (This has no effect\n  when a file option isn't specified, because entries are emitted as\n  fast as they are parsed from the stream anyway.)\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `filter` A function that gets called with `(path, entry)` for each\n  entry being listed.  Return `true` to emit the entry from the\n  archive, or `false` to skip it.\n- `onentry` A function that gets called with `(entry)` for each entry\n  that passes the filter.  This is important for when both `file` and\n  `sync` are set, because it will be called synchronously.\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 16 MB.\n- `noResume` By default, `entry` streams are resumed immediately after\n  the call to `onentry`.  Set `noResume: true` to suppress this\n  behavior.  Note that by opting into this, the stream will never\n  complete until the entry data is consumed.\n\n### tar.u(options, fileList, callback) [alias: tar.update]\n\nAdd files to an archive if they are newer than the entry already in\nthe tarball archive.\n\nThe `fileList` is an array of paths to add to the tarball.  Adding a\ndirectory also adds its children recursively.\n\nAn entry in `fileList` that starts with an `@` symbol is a tar archive\nwhose entries will be added.  To add a file that starts with `@`,\nprepend it with `./`.\n\nThe following options are supported:\n\n- `file` Required. Write the tarball archive to the specified\n  filename. [Alias: `f`]\n- `sync` Act synchronously.  If this is set, then any provided file\n  will be fully written after the call to `tar.c`.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `cwd` The current working directory for adding entries to the\n  archive.  Defaults to `process.cwd()`.  [Alias: `C`]\n- `prefix` A path portion to prefix onto the entries in the archive.\n- `gzip` Set to any truthy value to create a gzipped archive, or an\n  object with settings for `zlib.Gzip()` [Alias: `z`]\n- `filter` A function that gets called with `(path, stat)` for each\n  entry being added.  Return `true` to add the entry to the archive,\n  or `false` to omit it.\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths. [Alias: `P`]\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 16 MB.\n- `noDirRecurse` Do not recursively archive the contents of\n  directories. [Alias: `n`]\n- `follow` Set to true to pack the targets of symbolic links.  Without\n  this option, symbolic links are archived as such. [Alias: `L`, `h`]\n- `noPax` Suppress pax extended headers.  Note that this means that\n  long paths and linkpaths will be truncated, and large or negative\n  numeric values may be interpreted incorrectly.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n  [Alias: `m`, `no-mtime`]\n- `mtime` Set to a `Date` object to force a specific `mtime` for\n  everything added to the archive.  Overridden by `noMtime`.\n\n### tar.r(options, fileList, callback) [alias: tar.replace]\n\nAdd files to an existing archive.  Because later entries override\nearlier entries, this effectively replaces any existing entries.\n\nThe `fileList` is an array of paths to add to the tarball.  Adding a\ndirectory also adds its children recursively.\n\nAn entry in `fileList` that starts with an `@` symbol is a tar archive\nwhose entries will be added.  To add a file that starts with `@`,\nprepend it with `./`.\n\nThe following options are supported:\n\n- `file` Required. Write the tarball archive to the specified\n  filename. [Alias: `f`]\n- `sync` Act synchronously.  If this is set, then any provided file\n  will be fully written after the call to `tar.c`.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `cwd` The current working directory for adding entries to the\n  archive.  Defaults to `process.cwd()`.  [Alias: `C`]\n- `prefix` A path portion to prefix onto the entries in the archive.\n- `gzip` Set to any truthy value to create a gzipped archive, or an\n  object with settings for `zlib.Gzip()` [Alias: `z`]\n- `filter` A function that gets called with `(path, stat)` for each\n  entry being added.  Return `true` to add the entry to the archive,\n  or `false` to omit it.\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths. [Alias: `P`]\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 16 MB.\n- `noDirRecurse` Do not recursively archive the contents of\n  directories. [Alias: `n`]\n- `follow` Set to true to pack the targets of symbolic links.  Without\n  this option, symbolic links are archived as such. [Alias: `L`, `h`]\n- `noPax` Suppress pax extended headers.  Note that this means that\n  long paths and linkpaths will be truncated, and large or negative\n  numeric values may be interpreted incorrectly.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n  [Alias: `m`, `no-mtime`]\n- `mtime` Set to a `Date` object to force a specific `mtime` for\n  everything added to the archive.  Overridden by `noMtime`.\n\n\n## Low-Level API\n\n### class tar.Pack\n\nA readable tar stream.\n\nHas all the standard readable stream interface stuff.  `'data'` and\n`'end'` events, `read()` method, `pause()` and `resume()`, etc.\n\n#### constructor(options)\n\nThe following options are supported:\n\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `cwd` The current working directory for creating the archive.\n  Defaults to `process.cwd()`.\n- `prefix` A path portion to prefix onto the entries in the archive.\n- `gzip` Set to any truthy value to create a gzipped archive, or an\n  object with settings for `zlib.Gzip()`\n- `filter` A function that gets called with `(path, stat)` for each\n  entry being added.  Return `true` to add the entry to the archive,\n  or `false` to omit it.\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths.\n- `linkCache` A Map object containing the device and inode value for\n  any file whose nlink is > 1, to identify hard links.\n- `statCache` A Map object that caches calls `lstat`.\n- `readdirCache` A Map object that caches calls to `readdir`.\n- `jobs` A number specifying how many concurrent jobs to run.\n  Defaults to 4.\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 16 MB.\n- `noDirRecurse` Do not recursively archive the contents of\n  directories.\n- `follow` Set to true to pack the targets of symbolic links.  Without\n  this option, symbolic links are archived as such.\n- `noPax` Suppress pax extended headers.  Note that this means that\n  long paths and linkpaths will be truncated, and large or negative\n  numeric values may be interpreted incorrectly.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n- `mtime` Set to a `Date` object to force a specific `mtime` for\n  everything added to the archive.  Overridden by `noMtime`.\n\n#### add(path)\n\nAdds an entry to the archive.  Returns the Pack stream.\n\n#### write(path)\n\nAdds an entry to the archive.  Returns true if flushed.\n\n#### end()\n\nFinishes the archive.\n\n### class tar.Pack.Sync\n\nSynchronous version of `tar.Pack`.\n\n### class tar.Unpack\n\nA writable stream that unpacks a tar archive onto the file system.\n\nAll the normal writable stream stuff is supported.  `write()` and\n`end()` methods, `'drain'` events, etc.\n\nNote that all directories that are created will be forced to be\nwritable, readable, and listable by their owner, to avoid cases where\na directory prevents extraction of child entries by virtue of its\nmode.\n\n`'close'` is emitted when it's done writing stuff to the file system.\n\nMost unpack errors will cause a `warn` event to be emitted.  If the\n`cwd` is missing, or not a directory, then an error will be emitted.\n\n#### constructor(options)\n\n- `cwd` Extract files relative to the specified directory.  Defaults\n  to `process.cwd()`.  If provided, this must exist and must be a\n  directory.\n- `filter` A function that gets called with `(path, entry)` for each\n  entry being unpacked.  Return `true` to unpack the entry from the\n  archive, or `false` to skip it.\n- `newer` Set to true to keep the existing file on disk if it's newer\n  than the file in the archive.\n- `keep` Do not overwrite existing files.  In particular, if a file\n  appears more than once in an archive, later copies will not\n  overwrite earlier copies.\n- `preservePaths` Allow absolute paths, paths containing `..`, and\n  extracting through symbolic links.  By default, `/` is stripped from\n  absolute paths, `..` paths are not extracted, and any file whose\n  location would be modified by a symbolic link is not extracted.\n- `unlink` Unlink files before creating them.  Without this option,\n  tar overwrites existing files, which preserves existing hardlinks.\n  With this option, existing hardlinks will be broken, as will any\n  symlink that would affect the location of an extracted file.\n- `strip` Remove the specified number of leading path elements.\n  Pathnames with fewer elements will be silently skipped.  Note that\n  the pathname is edited after applying the filter, but before\n  security checks.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `umask` Filter the modes of entries like `process.umask()`.\n- `dmode` Default mode for directories\n- `fmode` Default mode for files\n- `dirCache` A Map object of which directories exist.\n- `maxMetaEntrySize` The maximum size of meta entries that is\n  supported.  Defaults to 1 MB.\n- `preserveOwner` If true, tar will set the `uid` and `gid` of\n  extracted entries to the `uid` and `gid` fields in the archive.\n  This defaults to true when run as root, and false otherwise.  If\n  false, then files and directories will be set with the owner and\n  group of the user running the process.  This is similar to `-p` in\n  `tar(1)`, but ACLs and other system-specific data is never unpacked\n  in this implementation, and modes are set by default already.\n- `win32` True if on a windows platform.  Causes behavior where\n  filenames containing `<|>?` chars are converted to\n  windows-compatible values while being unpacked.\n- `uid` Set to a number to force ownership of all extracted files and\n  folders, and all implicitly created directories, to be owned by the\n  specified user id, regardless of the `uid` field in the archive.\n  Cannot be used along with `preserveOwner`.  Requires also setting a\n  `gid` option.\n- `gid` Set to a number to force ownership of all extracted files and\n  folders, and all implicitly created directories, to be owned by the\n  specified group id, regardless of the `gid` field in the archive.\n  Cannot be used along with `preserveOwner`.  Requires also setting a\n  `uid` option.\n- `noMtime` Set to true to omit writing `mtime` value for extracted\n  entries.\n- `transform` Provide a function that takes an `entry` object, and\n  returns a stream, or any falsey value.  If a stream is provided,\n  then that stream's data will be written instead of the contents of\n  the archive entry.  If a falsey value is provided, then the entry is\n  written to disk as normal.  (To exclude items from extraction, use\n  the `filter` option described above.)\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `onentry` A function that gets called with `(entry)` for each entry\n  that passes the filter.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n\n### class tar.Unpack.Sync\n\nSynchronous version of `tar.Unpack`.\n\nNote that using an asynchronous stream type with the `transform`\noption will cause undefined behavior in sync unpack streams.\n[MiniPass](http://npm.im/minipass)-based streams are designed for this\nuse case.\n\n### class tar.Parse\n\nA writable stream that parses a tar archive stream.  All the standard\nwritable stream stuff is supported.\n\nIf the archive is gzipped, then tar will detect this and unzip it.\n\nEmits `'entry'` events with `tar.ReadEntry` objects, which are\nthemselves readable streams that you can pipe wherever.\n\nEach `entry` will not emit until the one before it is flushed through,\nso make sure to either consume the data (with `on('data', ...)` or\n`.pipe(...)`) or throw it away with `.resume()` to keep the stream\nflowing.\n\n#### constructor(options)\n\nReturns an event emitter that emits `entry` events with\n`tar.ReadEntry` objects.\n\nThe following options are supported:\n\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `filter` A function that gets called with `(path, entry)` for each\n  entry being listed.  Return `true` to emit the entry from the\n  archive, or `false` to skip it.\n- `onentry` A function that gets called with `(entry)` for each entry\n  that passes the filter.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n\n#### abort(message, error)\n\nStop all parsing activities.  This is called when there are zlib\nerrors.  It also emits a warning with the message and error provided.\n\n### class tar.ReadEntry extends [MiniPass](http://npm.im/minipass)\n\nA representation of an entry that is being read out of a tar archive.\n\nIt has the following fields:\n\n- `extended` The extended metadata object provided to the constructor.\n- `globalExtended` The global extended metadata object provided to the\n  constructor.\n- `remain` The number of bytes remaining to be written into the\n  stream.\n- `blockRemain` The number of 512-byte blocks remaining to be written\n  into the stream.\n- `ignore` Whether this entry should be ignored.\n- `meta` True if this represents metadata about the next entry, false\n  if it represents a filesystem object.\n- All the fields from the header, extended header, and global extended\n  header are added to the ReadEntry object.  So it has `path`, `type`,\n  `size, `mode`, and so on.\n\n#### constructor(header, extended, globalExtended)\n\nCreate a new ReadEntry object with the specified header, extended\nheader, and global extended header values.\n\n### class tar.WriteEntry extends [MiniPass](http://npm.im/minipass)\n\nA representation of an entry that is being written from the file\nsystem into a tar archive.\n\nEmits data for the Header, and for the Pax Extended Header if one is\nrequired, as well as any body data.\n\nCreating a WriteEntry for a directory does not also create\nWriteEntry objects for all of the directory contents.\n\nIt has the following fields:\n\n- `path` The path field that will be written to the archive.  By\n  default, this is also the path from the cwd to the file system\n  object.\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `myuid` If supported, the uid of the user running the current\n  process.\n- `myuser` The `env.USER` string if set, or `''`.  Set as the entry\n  `uname` field if the file's `uid` matches `this.myuid`.\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 1 MB.\n- `linkCache` A Map object containing the device and inode value for\n  any file whose nlink is > 1, to identify hard links.\n- `statCache` A Map object that caches calls `lstat`.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths.\n- `cwd` The current working directory for creating the archive.\n  Defaults to `process.cwd()`.\n- `absolute` The absolute path to the entry on the filesystem.  By\n  default, this is `path.resolve(this.cwd, this.path)`, but it can be\n  overridden explicitly.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `win32` True if on a windows platform.  Causes behavior where paths\n  replace `\\` with `/` and filenames containing the windows-compatible\n  forms of `<|>?:` characters are converted to actual `<|>?:` characters\n  in the archive.\n- `noPax` Suppress pax extended headers.  Note that this means that\n  long paths and linkpaths will be truncated, and large or negative\n  numeric values may be interpreted incorrectly.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n\n\n#### constructor(path, options)\n\n`path` is the path of the entry as it is written in the archive.\n\nThe following options are supported:\n\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `maxReadSize` The maximum buffer size for `fs.read()` operations.\n  Defaults to 1 MB.\n- `linkCache` A Map object containing the device and inode value for\n  any file whose nlink is > 1, to identify hard links.\n- `statCache` A Map object that caches calls `lstat`.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths.\n- `cwd` The current working directory for creating the archive.\n  Defaults to `process.cwd()`.\n- `absolute` The absolute path to the entry on the filesystem.  By\n  default, this is `path.resolve(this.cwd, this.path)`, but it can be\n  overridden explicitly.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `win32` True if on a windows platform.  Causes behavior where paths\n  replace `\\` with `/`.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n- `umask` Set to restrict the modes on the entries in the archive,\n  somewhat like how umask works on file creation.  Defaults to\n  `process.umask()` on unix systems, or `0o22` on Windows.\n\n#### warn(message, data)\n\nIf strict, emit an error with the provided message.\n\nOthewise, emit a `'warn'` event with the provided message and data.\n\n### class tar.WriteEntry.Sync\n\nSynchronous version of tar.WriteEntry\n\n### class tar.WriteEntry.Tar\n\nA version of tar.WriteEntry that gets its data from a tar.ReadEntry\ninstead of from the filesystem.\n\n#### constructor(readEntry, options)\n\n`readEntry` is the entry being read out of another archive.\n\nThe following options are supported:\n\n- `portable` Omit metadata that is system-specific: `ctime`, `atime`,\n  `uid`, `gid`, `uname`, `gname`, `dev`, `ino`, and `nlink`.  Note\n  that `mtime` is still included, because this is necessary other\n  time-based operations.\n- `preservePaths` Allow absolute paths.  By default, `/` is stripped\n  from absolute paths.\n- `strict` Treat warnings as crash-worthy errors.  Default false.\n- `onwarn` A function that will get called with `(message, data)` for\n  any warnings encountered.\n- `noMtime` Set to true to omit writing `mtime` values for entries.\n  Note that this prevents using other mtime-based features like\n  `tar.update` or the `keepNewer` option with the resulting tar archive.\n\n### class tar.Header\n\nA class for reading and writing header blocks.\n\nIt has the following fields:\n\n- `nullBlock` True if decoding a block which is entirely composed of\n  `0x00` null bytes.  (Useful because tar files are terminated by\n  at least 2 null blocks.)\n- `cksumValid` True if the checksum in the header is valid, false\n  otherwise.\n- `needPax` True if the values, as encoded, will require a Pax\n  extended header.\n- `path` The path of the entry.\n- `mode` The 4 lowest-order octal digits of the file mode.  That is,\n  read/write/execute permissions for world, group, and owner, and the\n  setuid, setgid, and sticky bits.\n- `uid` Numeric user id of the file owner\n- `gid` Numeric group id of the file owner\n- `size` Size of the file in bytes\n- `mtime` Modified time of the file\n- `cksum` The checksum of the header.  This is generated by adding all\n  the bytes of the header block, treating the checksum field itself as\n  all ascii space characters (that is, `0x20`).\n- `type` The human-readable name of the type of entry this represents,\n  or the alphanumeric key if unknown.\n- `typeKey` The alphanumeric key for the type of entry this header\n  represents.\n- `linkpath` The target of Link and SymbolicLink entries.\n- `uname` Human-readable user name of the file owner\n- `gname` Human-readable group name of the file owner\n- `devmaj` The major portion of the device number.  Always `0` for\n  files, directories, and links.\n- `devmin` The minor portion of the device number.  Always `0` for\n  files, directories, and links.\n- `atime` File access time.\n- `ctime` File change time.\n\n#### constructor(data, [offset=0])\n\n`data` is optional.  It is either a Buffer that should be interpreted\nas a tar Header starting at the specified offset and continuing for\n512 bytes, or a data object of keys and values to set on the header\nobject, and eventually encode as a tar Header.\n\n#### decode(block, offset)\n\nDecode the provided buffer starting at the specified offset.\n\nBuffer length must be greater than 512 bytes.\n\n#### set(data)\n\nSet the fields in the data object.\n\n#### encode(buffer, offset)\n\nEncode the header fields into the buffer at the specified offset.\n\nReturns `this.needPax` to indicate whether a Pax Extended Header is\nrequired to properly encode the specified data.\n\n### class tar.Pax\n\nAn object representing a set of key-value pairs in an Pax extended\nheader entry.\n\nIt has the following fields.  Where the same name is used, they have\nthe same semantics as the tar.Header field of the same name.\n\n- `global` True if this represents a global extended header, or false\n  if it is for a single entry.\n- `atime`\n- `charset`\n- `comment`\n- `ctime`\n- `gid`\n- `gname`\n- `linkpath`\n- `mtime`\n- `path`\n- `size`\n- `uid`\n- `uname`\n- `dev`\n- `ino`\n- `nlink`\n\n#### constructor(object, global)\n\nSet the fields set in the object.  `global` is a boolean that defaults\nto false.\n\n#### encode()\n\nReturn a Buffer containing the header and body for the Pax extended\nheader entry, or `null` if there is nothing to encode.\n\n#### encodeBody()\n\nReturn a string representing the body of the pax extended header\nentry.\n\n#### encodeField(fieldName)\n\nReturn a string representing the key/value encoding for the specified\nfieldName, or `''` if the field is unset.\n\n### tar.Pax.parse(string, extended, global)\n\nReturn a new Pax object created by parsing the contents of the string\nprovided.\n\nIf the `extended` object is set, then also add the fields from that\nobject.  (This is necessary because multiple metadata entries can\noccur in sequence.)\n\n### tar.types\n\nA translation table for the `type` field in tar headers.\n\n#### tar.types.name.get(code)\n\nGet the human-readable name for a given alphanumeric code.\n\n#### tar.types.code.get(name)\n\nGet the alphanumeric code for a given human-readable name.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/node-tar.git"
-  },
-  "scripts": {
-    "bench": "for i in benchmarks/*/*.js; do echo $i; for j in {1..5}; do node $i || break; done; done",
-    "genparse": "node scripts/generate-parse-fixtures.js",
-    "postpublish": "git push origin --follow-tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap"
-  },
-  "tap": {
-    "coverage-map": "map.js",
-    "check-coverage": true
-  },
-  "version": "4.4.10"
-}
diff --git a/legacy-libs/grpc/node_modules/util-deprecate/History.md b/legacy-libs/grpc/node_modules/util-deprecate/History.md
deleted file mode 100644 (file)
index acc8675..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-
-1.0.2 / 2015-10-07
-==================
-
-  * use try/catch when checking `localStorage` (#3, @kumavis)
-
-1.0.1 / 2014-11-25
-==================
-
-  * browser: use `console.warn()` for deprecation calls
-  * browser: more jsdocs
-
-1.0.0 / 2014-04-30
-==================
-
-  * initial commit
diff --git a/legacy-libs/grpc/node_modules/util-deprecate/LICENSE b/legacy-libs/grpc/node_modules/util-deprecate/LICENSE
deleted file mode 100644 (file)
index 6a60e8c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/util-deprecate/README.md b/legacy-libs/grpc/node_modules/util-deprecate/README.md
deleted file mode 100644 (file)
index 75622fa..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-util-deprecate
-==============
-### The Node.js `util.deprecate()` function with browser support
-
-In Node.js, this module simply re-exports the `util.deprecate()` function.
-
-In the web browser (i.e. via browserify), a browser-specific implementation
-of the `util.deprecate()` function is used.
-
-
-## API
-
-A `deprecate()` function is the only thing exposed by this module.
-
-``` javascript
-// setup:
-exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead');
-
-
-// users see:
-foo();
-// foo() is deprecated, use bar() instead
-foo();
-foo();
-```
-
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/util-deprecate/browser.js b/legacy-libs/grpc/node_modules/util-deprecate/browser.js
deleted file mode 100644 (file)
index 549ae2f..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/**
- * Module exports.
- */
-
-module.exports = deprecate;
-
-/**
- * Mark that a method should not be used.
- * Returns a modified function which warns once by default.
- *
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
- *
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
- * will throw an Error when invoked.
- *
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
- * will invoke `console.trace()` instead of `console.error()`.
- *
- * @param {Function} fn - the function to deprecate
- * @param {String} msg - the string to print to the console when `fn` is invoked
- * @returns {Function} a new "deprecated" version of `fn`
- * @api public
- */
-
-function deprecate (fn, msg) {
-  if (config('noDeprecation')) {
-    return fn;
-  }
-
-  var warned = false;
-  function deprecated() {
-    if (!warned) {
-      if (config('throwDeprecation')) {
-        throw new Error(msg);
-      } else if (config('traceDeprecation')) {
-        console.trace(msg);
-      } else {
-        console.warn(msg);
-      }
-      warned = true;
-    }
-    return fn.apply(this, arguments);
-  }
-
-  return deprecated;
-}
-
-/**
- * Checks `localStorage` for boolean values for the given `name`.
- *
- * @param {String} name
- * @returns {Boolean}
- * @api private
- */
-
-function config (name) {
-  // accessing global.localStorage can trigger a DOMException in sandboxed iframes
-  try {
-    if (!global.localStorage) return false;
-  } catch (_) {
-    return false;
-  }
-  var val = global.localStorage[name];
-  if (null == val) return false;
-  return String(val).toLowerCase() === 'true';
-}
diff --git a/legacy-libs/grpc/node_modules/util-deprecate/node.js b/legacy-libs/grpc/node_modules/util-deprecate/node.js
deleted file mode 100644 (file)
index 5e6fcff..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-/**
- * For Node.js, simply re-export the core `util.deprecate` function.
- */
-
-module.exports = require('util').deprecate;
diff --git a/legacy-libs/grpc/node_modules/util-deprecate/package.json b/legacy-libs/grpc/node_modules/util-deprecate/package.json
deleted file mode 100644 (file)
index 7695504..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "_args": [
-    [
-      "util-deprecate@1.0.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "util-deprecate@1.0.2",
-  "_id": "util-deprecate@1.0.2",
-  "_inBundle": false,
-  "_integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
-  "_location": "/grpc/util-deprecate",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "util-deprecate@1.0.2",
-    "name": "util-deprecate",
-    "escapedName": "util-deprecate",
-    "rawSpec": "1.0.2",
-    "saveSpec": null,
-    "fetchSpec": "1.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/readable-stream"
-  ],
-  "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Nathan Rajlich",
-    "email": "nathan@tootallnate.net",
-    "url": "http://n8.io/"
-  },
-  "browser": "browser.js",
-  "bugs": {
-    "url": "https://github.com/TooTallNate/util-deprecate/issues"
-  },
-  "dependencies": {},
-  "description": "The Node.js `util.deprecate()` function with browser support",
-  "devDependencies": {},
-  "homepage": "https://github.com/TooTallNate/util-deprecate",
-  "keywords": [
-    "util",
-    "deprecate",
-    "browserify",
-    "browser",
-    "node"
-  ],
-  "license": "MIT",
-  "main": "node.js",
-  "name": "util-deprecate",
-  "optionalDependencies": {},
-  "readme": "util-deprecate\n==============\n### The Node.js `util.deprecate()` function with browser support\n\nIn Node.js, this module simply re-exports the `util.deprecate()` function.\n\nIn the web browser (i.e. via browserify), a browser-specific implementation\nof the `util.deprecate()` function is used.\n\n\n## API\n\nA `deprecate()` function is the only thing exposed by this module.\n\n``` javascript\n// setup:\nexports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead');\n\n\n// users see:\nfoo();\n// foo() is deprecated, use bar() instead\nfoo();\nfoo();\n```\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/TooTallNate/util-deprecate.git"
-  },
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "version": "1.0.2"
-}
diff --git a/legacy-libs/grpc/node_modules/wide-align/LICENSE b/legacy-libs/grpc/node_modules/wide-align/LICENSE
deleted file mode 100644 (file)
index f4be44d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Copyright (c) 2015, Rebecca Turner <me@re-becca.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
diff --git a/legacy-libs/grpc/node_modules/wide-align/README.md b/legacy-libs/grpc/node_modules/wide-align/README.md
deleted file mode 100644 (file)
index 32f1be0..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-wide-align
-----------
-
-A wide-character aware text alignment function for use in terminals / on the
-console.
-
-### Usage
-
-```
-var align = require('wide-align')
-
-// Note that if you view this on a unicode console, all of the slashes are
-// aligned. This is because on a console, all narrow characters are
-// an en wide and all wide characters are an em. In browsers, this isn't
-// held to and wide characters like "古" can be less than two narrow
-// characters even with a fixed width font.
-
-console.log(align.center('abc', 10))     // '   abc    '
-console.log(align.center('古古古', 10))  // '  古古古  '
-console.log(align.left('abc', 10))       // 'abc       '
-console.log(align.left('古古古', 10))    // '古古古    '
-console.log(align.right('abc', 10))      // '       abc'
-console.log(align.right('古古古', 10))   // '    古古古'
-```
-
-### Functions
-
-#### `align.center(str, length)` → `str`
-
-Returns *str* with spaces added to both sides such that that it is *length*
-chars long and centered in the spaces.
-
-#### `align.left(str, length)` → `str`
-
-Returns *str* with spaces to the right such that it is *length* chars long.
-
-### `align.right(str, length)` → `str`
-
-Returns *str* with spaces to the left such that it is *length* chars long.
-
-### Origins
-
-These functions were originally taken from 
-[cliui](https://npmjs.com/package/cliui). Changes include switching to the
-MUCH faster pad generation function from
-[lodash](https://npmjs.com/package/lodash), making center alignment pad
-both sides and adding left alignment.
diff --git a/legacy-libs/grpc/node_modules/wide-align/align.js b/legacy-libs/grpc/node_modules/wide-align/align.js
deleted file mode 100644 (file)
index 4f94ca4..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-'use strict'
-var stringWidth = require('string-width')
-
-exports.center = alignCenter
-exports.left = alignLeft
-exports.right = alignRight
-
-// lodash's way of generating pad characters.
-
-function createPadding (width) {
-  var result = ''
-  var string = ' '
-  var n = width
-  do {
-    if (n % 2) {
-      result += string;
-    }
-    n = Math.floor(n / 2);
-    string += string;
-  } while (n);
-
-  return result;
-}
-
-function alignLeft (str, width) {
-  var trimmed = str.trimRight()
-  if (trimmed.length === 0 && str.length >= width) return str
-  var padding = ''
-  var strWidth = stringWidth(trimmed)
-
-  if (strWidth < width) {
-    padding = createPadding(width - strWidth)
-  }
-
-  return trimmed + padding
-}
-
-function alignRight (str, width) {
-  var trimmed = str.trimLeft()
-  if (trimmed.length === 0 && str.length >= width) return str
-  var padding = ''
-  var strWidth = stringWidth(trimmed)
-
-  if (strWidth < width) {
-    padding = createPadding(width - strWidth)
-  }
-
-  return padding + trimmed
-}
-
-function alignCenter (str, width) {
-  var trimmed = str.trim()
-  if (trimmed.length === 0 && str.length >= width) return str
-  var padLeft = ''
-  var padRight = ''
-  var strWidth = stringWidth(trimmed)
-
-  if (strWidth < width) {
-    var padLeftBy = parseInt((width - strWidth) / 2, 10) 
-    padLeft = createPadding(padLeftBy)
-    padRight = createPadding(width - (strWidth + padLeftBy))
-  }
-
-  return padLeft + trimmed + padRight
-}
diff --git a/legacy-libs/grpc/node_modules/wide-align/package.json b/legacy-libs/grpc/node_modules/wide-align/package.json
deleted file mode 100644 (file)
index 5df8f7e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-{
-  "_args": [
-    [
-      "wide-align@1.1.3",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "wide-align@1.1.3",
-  "_id": "wide-align@1.1.3",
-  "_inBundle": false,
-  "_integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
-  "_location": "/grpc/wide-align",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "wide-align@1.1.3",
-    "name": "wide-align",
-    "escapedName": "wide-align",
-    "rawSpec": "1.1.3",
-    "saveSpec": null,
-    "fetchSpec": "1.1.3"
-  },
-  "_requiredBy": [
-    "/grpc/gauge"
-  ],
-  "_resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.1.3",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Rebecca Turner",
-    "email": "me@re-becca.org",
-    "url": "http://re-becca.org/"
-  },
-  "bugs": {
-    "url": "https://github.com/iarna/wide-align/issues"
-  },
-  "dependencies": {
-    "string-width": "^1.0.2 || 2"
-  },
-  "description": "A wide-character aware text alignment function for use on the console or with fixed width fonts.",
-  "devDependencies": {
-    "tap": "10 || 11 || 12"
-  },
-  "files": [
-    "align.js"
-  ],
-  "homepage": "https://github.com/iarna/wide-align#readme",
-  "keywords": [
-    "wide",
-    "double",
-    "unicode",
-    "cjkv",
-    "pad",
-    "align"
-  ],
-  "license": "ISC",
-  "main": "align.js",
-  "name": "wide-align",
-  "optionalDependencies": {},
-  "readme": "wide-align\n----------\n\nA wide-character aware text alignment function for use in terminals / on the\nconsole.\n\n### Usage\n\n```\nvar align = require('wide-align')\n\n// Note that if you view this on a unicode console, all of the slashes are\n// aligned. This is because on a console, all narrow characters are\n// an en wide and all wide characters are an em. In browsers, this isn't\n// held to and wide characters like \"古\" can be less than two narrow\n// characters even with a fixed width font.\n\nconsole.log(align.center('abc', 10))     // '   abc    '\nconsole.log(align.center('古古古', 10))  // '  古古古  '\nconsole.log(align.left('abc', 10))       // 'abc       '\nconsole.log(align.left('古古古', 10))    // '古古古    '\nconsole.log(align.right('abc', 10))      // '       abc'\nconsole.log(align.right('古古古', 10))   // '    古古古'\n```\n\n### Functions\n\n#### `align.center(str, length)` → `str`\n\nReturns *str* with spaces added to both sides such that that it is *length*\nchars long and centered in the spaces.\n\n#### `align.left(str, length)` → `str`\n\nReturns *str* with spaces to the right such that it is *length* chars long.\n\n### `align.right(str, length)` → `str`\n\nReturns *str* with spaces to the left such that it is *length* chars long.\n\n### Origins\n\nThese functions were originally taken from \n[cliui](https://npmjs.com/package/cliui). Changes include switching to the\nMUCH faster pad generation function from\n[lodash](https://npmjs.com/package/lodash), making center alignment pad\nboth sides and adding left alignment.\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/iarna/wide-align.git"
-  },
-  "scripts": {
-    "test": "tap --coverage test/*.js",
-    "version": "perl -pi -e 's/^(  \"version\": $ENV{npm_config_node_version}\").*?\",/$1abc\",/' package-lock.json ; git add package-lock.json"
-  },
-  "version": "1.1.3"
-}
diff --git a/legacy-libs/grpc/node_modules/window-size/LICENSE b/legacy-libs/grpc/node_modules/window-size/LICENSE
new file mode 100644 (file)
index 0000000..65f90ac
--- /dev/null
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015, Jon Schlinkert.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/window-size/README.md b/legacy-libs/grpc/node_modules/window-size/README.md
new file mode 100644 (file)
index 0000000..0985bd6
--- /dev/null
@@ -0,0 +1,45 @@
+# window-size [![NPM version](https://badge.fury.io/js/window-size.svg)](http://badge.fury.io/js/window-size)  [![Build Status](https://travis-ci.org/jonschlinkert/window-size.svg)](https://travis-ci.org/jonschlinkert/window-size)
+
+> Reliable way to to get the height and width of the terminal/console in a node.js environment.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/)
+
+```sh
+$ npm i window-size --save
+```
+
+## Usage
+
+```js
+var size = require('window-size');
+size.height; // "25" (rows)
+size.width; // "80" (columns)
+```
+
+## Other projects
+
+* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://www.npmjs.com/package/base-cli) | [homepage](https://github.com/jonschlinkert/base-cli)
+* [lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps)
+* [yargs](https://www.npmjs.com/package/yargs): Light-weight option parsing with an argv hash. No optstrings attached. | [homepage](https://github.com/bcoe/yargs#readme)
+
+## Contributing
+
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/window-size/issues/new).
+
+## Author
+
+**Jon Schlinkert**
+
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+## License
+
+Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
+Released under the MIT license.
+
+***
+
+_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 15, 2015._
\ No newline at end of file
diff --git a/legacy-libs/grpc/node_modules/window-size/cli.js b/legacy-libs/grpc/node_modules/window-size/cli.js
new file mode 100644 (file)
index 0000000..dd8d0e5
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env node
+'use strict';
+var helpText = ['Usage',
+'  $ window-size',
+'',
+'Example',
+'  $ window-size',
+'  height: 40 ',
+'  width : 145',
+''].join('\n');
+
+function showSize () {
+  var size = require('./');
+  console.log('height: ' + size.height);
+  console.log('width : ' + size.width);
+}
+
+if (process.argv.length > 2) {
+  switch (process.argv[2]) {
+    case 'help':
+    case '--help':
+    case '-h':
+      console.log(helpText);
+      break;
+    default:
+      showSize();
+  }
+} else {
+  showSize();
+}
diff --git a/legacy-libs/grpc/node_modules/window-size/index.js b/legacy-libs/grpc/node_modules/window-size/index.js
new file mode 100644 (file)
index 0000000..eba89c9
--- /dev/null
@@ -0,0 +1,32 @@
+'use strict';
+
+/*!
+ * window-size <https://github.com/jonschlinkert/window-size>
+ *
+ * Copyright (c) 2014-2015 Jon Schlinkert
+ * Licensed under the MIT license.
+ */
+
+var tty = require('tty');
+
+module.exports = (function () {
+  var width;
+  var height;
+
+  if (tty.isatty(1) && tty.isatty(2)) {
+    if (process.stdout.getWindowSize) {
+      width = process.stdout.getWindowSize(1)[0];
+      height = process.stdout.getWindowSize(1)[1];
+    } else if (tty.getWindowSize) {
+      width = tty.getWindowSize()[1];
+      height = tty.getWindowSize()[0];
+    } else if (process.stdout.columns && process.stdout.rows) {
+      height = process.stdout.columns;
+      width = process.stdout.rows;
+    }
+  } else {
+    Error('window-size could not get size with tty or process.stdout.');
+  }
+
+  return {height: height, width: width};
+})();
diff --git a/legacy-libs/grpc/node_modules/window-size/package.json b/legacy-libs/grpc/node_modules/window-size/package.json
new file mode 100644 (file)
index 0000000..adf5ee8
--- /dev/null
@@ -0,0 +1,117 @@
+{
+  "_args": [
+    [
+      {
+        "raw": "window-size@^0.1.4",
+        "scope": null,
+        "escapedName": "window-size",
+        "name": "window-size",
+        "rawSpec": "^0.1.4",
+        "spec": ">=0.1.4 <0.2.0",
+        "type": "range"
+      },
+      "/var/opt/motion2/node_modules/grpc/node_modules/yargs"
+    ]
+  ],
+  "_from": "window-size@>=0.1.4 <0.2.0",
+  "_id": "window-size@0.1.4",
+  "_inCache": true,
+  "_location": "/grpc/window-size",
+  "_nodeVersion": "5.0.0",
+  "_npmUser": {
+    "name": "jonschlinkert",
+    "email": "github@sellside.com"
+  },
+  "_npmVersion": "3.3.6",
+  "_phantomChildren": {},
+  "_requested": {
+    "raw": "window-size@^0.1.4",
+    "scope": null,
+    "escapedName": "window-size",
+    "name": "window-size",
+    "rawSpec": "^0.1.4",
+    "spec": ">=0.1.4 <0.2.0",
+    "type": "range"
+  },
+  "_requiredBy": [
+    "/grpc/yargs"
+  ],
+  "_resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz",
+  "_shasum": "f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876",
+  "_shrinkwrap": null,
+  "_spec": "window-size@^0.1.4",
+  "_where": "/var/opt/motion2/node_modules/grpc/node_modules/yargs",
+  "author": {
+    "name": "Jon Schlinkert",
+    "url": "https://github.com/jonschlinkert"
+  },
+  "bin": {
+    "window-size": "cli.js"
+  },
+  "bugs": {
+    "url": "https://github.com/jonschlinkert/window-size/issues"
+  },
+  "dependencies": {},
+  "description": "Reliable way to to get the height and width of the terminal/console in a node.js environment.",
+  "devDependencies": {
+    "semistandard": "^7.0.2",
+    "tap": "^2.2.1"
+  },
+  "directories": {},
+  "dist": {
+    "shasum": "f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876",
+    "tarball": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz"
+  },
+  "engines": {
+    "node": ">= 0.10.0"
+  },
+  "files": [
+    "index.js",
+    "cli.js"
+  ],
+  "gitHead": "619d0da99254adc5c6059c84e3ec2b24564add46",
+  "homepage": "https://github.com/jonschlinkert/window-size",
+  "keywords": [
+    "console",
+    "height",
+    "resize",
+    "size",
+    "terminal",
+    "tty",
+    "width",
+    "window"
+  ],
+  "license": "MIT",
+  "main": "index.js",
+  "maintainers": [
+    {
+      "name": "jonschlinkert",
+      "email": "github@sellside.com"
+    },
+    {
+      "name": "doowb",
+      "email": "brian.woodward@gmail.com"
+    }
+  ],
+  "name": "window-size",
+  "optionalDependencies": {},
+  "readme": "ERROR: No README data found!",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/jonschlinkert/window-size.git"
+  },
+  "scripts": {
+    "pretest": "semistandard",
+    "test": "tap --coverage test.js"
+  },
+  "verb": {
+    "related": {
+      "list": [
+        "yargs",
+        "lint-deps",
+        "base-cli"
+      ]
+    }
+  },
+  "version": "0.1.4"
+}
diff --git a/legacy-libs/grpc/node_modules/wrappy/LICENSE b/legacy-libs/grpc/node_modules/wrappy/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/wrappy/README.md b/legacy-libs/grpc/node_modules/wrappy/README.md
deleted file mode 100644 (file)
index 98eab25..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# wrappy
-
-Callback wrapping utility
-
-## USAGE
-
-```javascript
-var wrappy = require("wrappy")
-
-// var wrapper = wrappy(wrapperFunction)
-
-// make sure a cb is called only once
-// See also: http://npm.im/once for this specific use case
-var once = wrappy(function (cb) {
-  var called = false
-  return function () {
-    if (called) return
-    called = true
-    return cb.apply(this, arguments)
-  }
-})
-
-function printBoo () {
-  console.log('boo')
-}
-// has some rando property
-printBoo.iAmBooPrinter = true
-
-var onlyPrintOnce = once(printBoo)
-
-onlyPrintOnce() // prints 'boo'
-onlyPrintOnce() // does nothing
-
-// random property is retained!
-assert.equal(onlyPrintOnce.iAmBooPrinter, true)
-```
diff --git a/legacy-libs/grpc/node_modules/wrappy/package.json b/legacy-libs/grpc/node_modules/wrappy/package.json
deleted file mode 100644 (file)
index d4b163d..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-{
-  "_args": [
-    [
-      "wrappy@1.0.2",
-      "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core"
-    ]
-  ],
-  "_from": "wrappy@1.0.2",
-  "_id": "wrappy@1.0.2",
-  "_inBundle": false,
-  "_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
-  "_location": "/grpc/wrappy",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "wrappy@1.0.2",
-    "name": "wrappy",
-    "escapedName": "wrappy",
-    "rawSpec": "1.0.2",
-    "saveSpec": null,
-    "fetchSpec": "1.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/inflight",
-    "/grpc/once"
-  ],
-  "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
-  "_shrinkwrap": null,
-  "_spec": "1.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/npm/wrappy/issues"
-  },
-  "dependencies": {},
-  "description": "Callback wrapping utility",
-  "devDependencies": {
-    "tap": "^2.3.1"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "wrappy.js"
-  ],
-  "homepage": "https://github.com/npm/wrappy",
-  "license": "ISC",
-  "main": "wrappy.js",
-  "name": "wrappy",
-  "optionalDependencies": {},
-  "readme": "# wrappy\n\nCallback wrapping utility\n\n## USAGE\n\n```javascript\nvar wrappy = require(\"wrappy\")\n\n// var wrapper = wrappy(wrapperFunction)\n\n// make sure a cb is called only once\n// See also: http://npm.im/once for this specific use case\nvar once = wrappy(function (cb) {\n  var called = false\n  return function () {\n    if (called) return\n    called = true\n    return cb.apply(this, arguments)\n  }\n})\n\nfunction printBoo () {\n  console.log('boo')\n}\n// has some rando property\nprintBoo.iAmBooPrinter = true\n\nvar onlyPrintOnce = once(printBoo)\n\nonlyPrintOnce() // prints 'boo'\nonlyPrintOnce() // does nothing\n\n// random property is retained!\nassert.equal(onlyPrintOnce.iAmBooPrinter, true)\n```\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/npm/wrappy.git"
-  },
-  "scripts": {
-    "test": "tap --coverage test/*.js"
-  },
-  "version": "1.0.2"
-}
diff --git a/legacy-libs/grpc/node_modules/wrappy/wrappy.js b/legacy-libs/grpc/node_modules/wrappy/wrappy.js
deleted file mode 100644 (file)
index bb7e7d6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Returns a wrapper function that returns a wrapped callback
-// The wrapper function should do some stuff, and return a
-// presumably different callback function.
-// This makes sure that own properties are retained, so that
-// decorations and such are not lost along the way.
-module.exports = wrappy
-function wrappy (fn, cb) {
-  if (fn && cb) return wrappy(fn)(cb)
-
-  if (typeof fn !== 'function')
-    throw new TypeError('need wrapper function')
-
-  Object.keys(fn).forEach(function (k) {
-    wrapper[k] = fn[k]
-  })
-
-  return wrapper
-
-  function wrapper() {
-    var args = new Array(arguments.length)
-    for (var i = 0; i < args.length; i++) {
-      args[i] = arguments[i]
-    }
-    var ret = fn.apply(this, args)
-    var cb = args[args.length-1]
-    if (typeof ret === 'function' && ret !== cb) {
-      Object.keys(cb).forEach(function (k) {
-        ret[k] = cb[k]
-      })
-    }
-    return ret
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/yallist/LICENSE b/legacy-libs/grpc/node_modules/yallist/LICENSE
deleted file mode 100644 (file)
index 19129e3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/legacy-libs/grpc/node_modules/yallist/README.md b/legacy-libs/grpc/node_modules/yallist/README.md
deleted file mode 100644 (file)
index f586101..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-# yallist
-
-Yet Another Linked List
-
-There are many doubly-linked list implementations like it, but this
-one is mine.
-
-For when an array would be too big, and a Map can't be iterated in
-reverse order.
-
-
-[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist)
-
-## basic usage
-
-```javascript
-var yallist = require('yallist')
-var myList = yallist.create([1, 2, 3])
-myList.push('foo')
-myList.unshift('bar')
-// of course pop() and shift() are there, too
-console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']
-myList.forEach(function (k) {
-  // walk the list head to tail
-})
-myList.forEachReverse(function (k, index, list) {
-  // walk the list tail to head
-})
-var myDoubledList = myList.map(function (k) {
-  return k + k
-})
-// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']
-// mapReverse is also a thing
-var myDoubledListReverse = myList.mapReverse(function (k) {
-  return k + k
-}) // ['foofoo', 6, 4, 2, 'barbar']
-
-var reduced = myList.reduce(function (set, entry) {
-  set += entry
-  return set
-}, 'start')
-console.log(reduced) // 'startfoo123bar'
-```
-
-## api
-
-The whole API is considered "public".
-
-Functions with the same name as an Array method work more or less the
-same way.
-
-There's reverse versions of most things because that's the point.
-
-### Yallist
-
-Default export, the class that holds and manages a list.
-
-Call it with either a forEach-able (like an array) or a set of
-arguments, to initialize the list.
-
-The Array-ish methods all act like you'd expect.  No magic length,
-though, so if you change that it won't automatically prune or add
-empty spots.
-
-### Yallist.create(..)
-
-Alias for Yallist function.  Some people like factories.
-
-#### yallist.head
-
-The first node in the list
-
-#### yallist.tail
-
-The last node in the list
-
-#### yallist.length
-
-The number of nodes in the list.  (Change this at your peril.  It is
-not magic like Array length.)
-
-#### yallist.toArray()
-
-Convert the list to an array.
-
-#### yallist.forEach(fn, [thisp])
-
-Call a function on each item in the list.
-
-#### yallist.forEachReverse(fn, [thisp])
-
-Call a function on each item in the list, in reverse order.
-
-#### yallist.get(n)
-
-Get the data at position `n` in the list.  If you use this a lot,
-probably better off just using an Array.
-
-#### yallist.getReverse(n)
-
-Get the data at position `n`, counting from the tail.
-
-#### yallist.map(fn, thisp)
-
-Create a new Yallist with the result of calling the function on each
-item.
-
-#### yallist.mapReverse(fn, thisp)
-
-Same as `map`, but in reverse.
-
-#### yallist.pop()
-
-Get the data from the list tail, and remove the tail from the list.
-
-#### yallist.push(item, ...)
-
-Insert one or more items to the tail of the list.
-
-#### yallist.reduce(fn, initialValue)
-
-Like Array.reduce.
-
-#### yallist.reduceReverse
-
-Like Array.reduce, but in reverse.
-
-#### yallist.reverse
-
-Reverse the list in place.
-
-#### yallist.shift()
-
-Get the data from the list head, and remove the head from the list.
-
-#### yallist.slice([from], [to])
-
-Just like Array.slice, but returns a new Yallist.
-
-#### yallist.sliceReverse([from], [to])
-
-Just like yallist.slice, but the result is returned in reverse.
-
-#### yallist.toArray()
-
-Create an array representation of the list.
-
-#### yallist.toArrayReverse()
-
-Create a reversed array representation of the list.
-
-#### yallist.unshift(item, ...)
-
-Insert one or more items to the head of the list.
-
-#### yallist.unshiftNode(node)
-
-Move a Node object to the front of the list.  (That is, pull it out of
-wherever it lives, and make it the new head.)
-
-If the node belongs to a different list, then that list will remove it
-first.
-
-#### yallist.pushNode(node)
-
-Move a Node object to the end of the list.  (That is, pull it out of
-wherever it lives, and make it the new tail.)
-
-If the node belongs to a list already, then that list will remove it
-first.
-
-#### yallist.removeNode(node)
-
-Remove a node from the list, preserving referential integrity of head
-and tail and other nodes.
-
-Will throw an error if you try to have a list remove a node that
-doesn't belong to it.
-
-### Yallist.Node
-
-The class that holds the data and is actually the list.
-
-Call with `var n = new Node(value, previousNode, nextNode)`
-
-Note that if you do direct operations on Nodes themselves, it's very
-easy to get into weird states where the list is broken.  Be careful :)
-
-#### node.next
-
-The next node in the list.
-
-#### node.prev
-
-The previous node in the list.
-
-#### node.value
-
-The data the node contains.
-
-#### node.list
-
-The list to which this node belongs.  (Null if it does not belong to
-any list.)
diff --git a/legacy-libs/grpc/node_modules/yallist/iterator.js b/legacy-libs/grpc/node_modules/yallist/iterator.js
deleted file mode 100644 (file)
index d41c97a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-module.exports = function (Yallist) {
-  Yallist.prototype[Symbol.iterator] = function* () {
-    for (let walker = this.head; walker; walker = walker.next) {
-      yield walker.value
-    }
-  }
-}
diff --git a/legacy-libs/grpc/node_modules/yallist/package.json b/legacy-libs/grpc/node_modules/yallist/package.json
deleted file mode 100644 (file)
index 7ea729d..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-{
-  "_from": "yallist@^3.0.2",
-  "_id": "yallist@3.0.3",
-  "_inBundle": false,
-  "_integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
-  "_location": "/grpc/yallist",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "range",
-    "registry": true,
-    "raw": "yallist@^3.0.2",
-    "name": "yallist",
-    "escapedName": "yallist",
-    "rawSpec": "^3.0.2",
-    "saveSpec": null,
-    "fetchSpec": "^3.0.2"
-  },
-  "_requiredBy": [
-    "/grpc/minipass",
-    "/grpc/tar"
-  ],
-  "_resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
-  "_shasum": "b4b049e314be545e3ce802236d6cd22cd91c3de9",
-  "_shrinkwrap": null,
-  "_spec": "yallist@^3.0.2",
-  "_where": "/usr/local/google/home/mlumish/grpc-node/packages/grpc-native-core/node_modules/tar",
-  "author": {
-    "name": "Isaac Z. Schlueter",
-    "email": "i@izs.me",
-    "url": "http://blog.izs.me/"
-  },
-  "bugs": {
-    "url": "https://github.com/isaacs/yallist/issues"
-  },
-  "bundleDependencies": false,
-  "dependencies": {},
-  "deprecated": false,
-  "description": "Yet Another Linked List",
-  "devDependencies": {
-    "tap": "^12.1.0"
-  },
-  "directories": {
-    "test": "test"
-  },
-  "files": [
-    "yallist.js",
-    "iterator.js"
-  ],
-  "homepage": "https://github.com/isaacs/yallist#readme",
-  "license": "ISC",
-  "main": "yallist.js",
-  "name": "yallist",
-  "optionalDependencies": {},
-  "readme": "# yallist\n\nYet Another Linked List\n\nThere are many doubly-linked list implementations like it, but this\none is mine.\n\nFor when an array would be too big, and a Map can't be iterated in\nreverse order.\n\n\n[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist)\n\n## basic usage\n\n```javascript\nvar yallist = require('yallist')\nvar myList = yallist.create([1, 2, 3])\nmyList.push('foo')\nmyList.unshift('bar')\n// of course pop() and shift() are there, too\nconsole.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']\nmyList.forEach(function (k) {\n  // walk the list head to tail\n})\nmyList.forEachReverse(function (k, index, list) {\n  // walk the list tail to head\n})\nvar myDoubledList = myList.map(function (k) {\n  return k + k\n})\n// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']\n// mapReverse is also a thing\nvar myDoubledListReverse = myList.mapReverse(function (k) {\n  return k + k\n}) // ['foofoo', 6, 4, 2, 'barbar']\n\nvar reduced = myList.reduce(function (set, entry) {\n  set += entry\n  return set\n}, 'start')\nconsole.log(reduced) // 'startfoo123bar'\n```\n\n## api\n\nThe whole API is considered \"public\".\n\nFunctions with the same name as an Array method work more or less the\nsame way.\n\nThere's reverse versions of most things because that's the point.\n\n### Yallist\n\nDefault export, the class that holds and manages a list.\n\nCall it with either a forEach-able (like an array) or a set of\narguments, to initialize the list.\n\nThe Array-ish methods all act like you'd expect.  No magic length,\nthough, so if you change that it won't automatically prune or add\nempty spots.\n\n### Yallist.create(..)\n\nAlias for Yallist function.  Some people like factories.\n\n#### yallist.head\n\nThe first node in the list\n\n#### yallist.tail\n\nThe last node in the list\n\n#### yallist.length\n\nThe number of nodes in the list.  (Change this at your peril.  It is\nnot magic like Array length.)\n\n#### yallist.toArray()\n\nConvert the list to an array.\n\n#### yallist.forEach(fn, [thisp])\n\nCall a function on each item in the list.\n\n#### yallist.forEachReverse(fn, [thisp])\n\nCall a function on each item in the list, in reverse order.\n\n#### yallist.get(n)\n\nGet the data at position `n` in the list.  If you use this a lot,\nprobably better off just using an Array.\n\n#### yallist.getReverse(n)\n\nGet the data at position `n`, counting from the tail.\n\n#### yallist.map(fn, thisp)\n\nCreate a new Yallist with the result of calling the function on each\nitem.\n\n#### yallist.mapReverse(fn, thisp)\n\nSame as `map`, but in reverse.\n\n#### yallist.pop()\n\nGet the data from the list tail, and remove the tail from the list.\n\n#### yallist.push(item, ...)\n\nInsert one or more items to the tail of the list.\n\n#### yallist.reduce(fn, initialValue)\n\nLike Array.reduce.\n\n#### yallist.reduceReverse\n\nLike Array.reduce, but in reverse.\n\n#### yallist.reverse\n\nReverse the list in place.\n\n#### yallist.shift()\n\nGet the data from the list head, and remove the head from the list.\n\n#### yallist.slice([from], [to])\n\nJust like Array.slice, but returns a new Yallist.\n\n#### yallist.sliceReverse([from], [to])\n\nJust like yallist.slice, but the result is returned in reverse.\n\n#### yallist.toArray()\n\nCreate an array representation of the list.\n\n#### yallist.toArrayReverse()\n\nCreate a reversed array representation of the list.\n\n#### yallist.unshift(item, ...)\n\nInsert one or more items to the head of the list.\n\n#### yallist.unshiftNode(node)\n\nMove a Node object to the front of the list.  (That is, pull it out of\nwherever it lives, and make it the new head.)\n\nIf the node belongs to a different list, then that list will remove it\nfirst.\n\n#### yallist.pushNode(node)\n\nMove a Node object to the end of the list.  (That is, pull it out of\nwherever it lives, and make it the new tail.)\n\nIf the node belongs to a list already, then that list will remove it\nfirst.\n\n#### yallist.removeNode(node)\n\nRemove a node from the list, preserving referential integrity of head\nand tail and other nodes.\n\nWill throw an error if you try to have a list remove a node that\ndoesn't belong to it.\n\n### Yallist.Node\n\nThe class that holds the data and is actually the list.\n\nCall with `var n = new Node(value, previousNode, nextNode)`\n\nNote that if you do direct operations on Nodes themselves, it's very\neasy to get into weird states where the list is broken.  Be careful :)\n\n#### node.next\n\nThe next node in the list.\n\n#### node.prev\n\nThe previous node in the list.\n\n#### node.value\n\nThe data the node contains.\n\n#### node.list\n\nThe list to which this node belongs.  (Null if it does not belong to\nany list.)\n",
-  "readmeFilename": "README.md",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/isaacs/yallist.git"
-  },
-  "scripts": {
-    "postpublish": "git push origin --all; git push origin --tags",
-    "postversion": "npm publish",
-    "preversion": "npm test",
-    "test": "tap test/*.js --100"
-  },
-  "version": "3.0.3"
-}
diff --git a/legacy-libs/grpc/node_modules/yallist/yallist.js b/legacy-libs/grpc/node_modules/yallist/yallist.js
deleted file mode 100644 (file)
index b0ab36c..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-'use strict'
-module.exports = Yallist
-
-Yallist.Node = Node
-Yallist.create = Yallist
-
-function Yallist (list) {
-  var self = this
-  if (!(self instanceof Yallist)) {
-    self = new Yallist()
-  }
-
-  self.tail = null
-  self.head = null
-  self.length = 0
-
-  if (list && typeof list.forEach === 'function') {
-    list.forEach(function (item) {
-      self.push(item)
-    })
-  } else if (arguments.length > 0) {
-    for (var i = 0, l = arguments.length; i < l; i++) {
-      self.push(arguments[i])
-    }
-  }
-
-  return self
-}
-
-Yallist.prototype.removeNode = function (node) {
-  if (node.list !== this) {
-    throw new Error('removing node which does not belong to this list')
-  }
-
-  var next = node.next
-  var prev = node.prev
-
-  if (next) {
-    next.prev = prev
-  }
-
-  if (prev) {
-    prev.next = next
-  }
-
-  if (node === this.head) {
-    this.head = next
-  }
-  if (node === this.tail) {
-    this.tail = prev
-  }
-
-  node.list.length--
-  node.next = null
-  node.prev = null
-  node.list = null
-}
-
-Yallist.prototype.unshiftNode = function (node) {
-  if (node === this.head) {
-    return
-  }
-
-  if (node.list) {
-    node.list.removeNode(node)
-  }
-
-  var head = this.head
-  node.list = this
-  node.next = head
-  if (head) {
-    head.prev = node
-  }
-
-  this.head = node
-  if (!this.tail) {
-    this.tail = node
-  }
-  this.length++
-}
-
-Yallist.prototype.pushNode = function (node) {
-  if (node === this.tail) {
-    return
-  }
-
-  if (node.list) {
-    node.list.removeNode(node)
-  }
-
-  var tail = this.tail
-  node.list = this
-  node.prev = tail
-  if (tail) {
-    tail.next = node
-  }
-
-  this.tail = node
-  if (!this.head) {
-    this.head = node
-  }
-  this.length++
-}
-
-Yallist.prototype.push = function () {
-  for (var i = 0, l = arguments.length; i < l; i++) {
-    push(this, arguments[i])
-  }
-  return this.length
-}
-
-Yallist.prototype.unshift = function () {
-  for (var i = 0, l = arguments.length; i < l; i++) {
-    unshift(this, arguments[i])
-  }
-  return this.length
-}
-
-Yallist.prototype.pop = function () {
-  if (!this.tail) {
-    return undefined
-  }
-
-  var res = this.tail.value
-  this.tail = this.tail.prev
-  if (this.tail) {
-    this.tail.next = null
-  } else {
-    this.head = null
-  }
-  this.length--
-  return res
-}
-
-Yallist.prototype.shift = function () {
-  if (!this.head) {
-    return undefined
-  }
-
-  var res = this.head.value
-  this.head = this.head.next
-  if (this.head) {
-    this.head.prev = null
-  } else {
-    this.tail = null
-  }
-  this.length--
-  return res
-}
-
-Yallist.prototype.forEach = function (fn, thisp) {
-  thisp = thisp || this
-  for (var walker = this.head, i = 0; walker !== null; i++) {
-    fn.call(thisp, walker.value, i, this)
-    walker = walker.next
-  }
-}
-
-Yallist.prototype.forEachReverse = function (fn, thisp) {
-  thisp = thisp || this
-  for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
-    fn.call(thisp, walker.value, i, this)
-    walker = walker.prev
-  }
-}
-
-Yallist.prototype.get = function (n) {
-  for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
-    // abort out of the list early if we hit a cycle
-    walker = walker.next
-  }
-  if (i === n && walker !== null) {
-    return walker.value
-  }
-}
-
-Yallist.prototype.getReverse = function (n) {
-  for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
-    // abort out of the list early if we hit a cycle
-    walker = walker.prev
-  }
-  if (i === n && walker !== null) {
-    return walker.value
-  }
-}
-
-Yallist.prototype.map = function (fn, thisp) {
-  thisp = thisp || this
-  var res = new Yallist()
-  for (var walker = this.head; walker !== null;) {
-    res.push(fn.call(thisp, walker.value, this))
-    walker = walker.next
-  }
-  return res
-}
-
-Yallist.prototype.mapReverse = function (fn, thisp) {
-  thisp = thisp || this
-  var res = new Yallist()
-  for (var walker = this.tail; walker !== null;) {
-    res.push(fn.call(thisp, walker.value, this))
-    walker = walker.prev
-  }
-  return res
-}
-
-Yallist.prototype.reduce = function (fn, initial) {
-  var acc
-  var walker = this.head
-  if (arguments.length > 1) {
-    acc = initial
-  } else if (this.head) {
-    walker = this.head.next
-    acc = this.head.value
-  } else {
-    throw new TypeError('Reduce of empty list with no initial value')
-  }
-
-  for (var i = 0; walker !== null; i++) {
-    acc = fn(acc, walker.value, i)
-    walker = walker.next
-  }
-
-  return acc
-}
-
-Yallist.prototype.reduceReverse = function (fn, initial) {
-  var acc
-  var walker = this.tail
-  if (arguments.length > 1) {
-    acc = initial
-  } else if (this.tail) {
-    walker = this.tail.prev
-    acc = this.tail.value
-  } else {
-    throw new TypeError('Reduce of empty list with no initial value')
-  }
-
-  for (var i = this.length - 1; walker !== null; i--) {
-    acc = fn(acc, walker.value, i)
-    walker = walker.prev
-  }
-
-  return acc
-}
-
-Yallist.prototype.toArray = function () {
-  var arr = new Array(this.length)
-  for (var i = 0, walker = this.head; walker !== null; i++) {
-    arr[i] = walker.value
-    walker = walker.next
-  }
-  return arr
-}
-
-Yallist.prototype.toArrayReverse = function () {
-  var arr = new Array(this.length)
-  for (var i = 0, walker = this.tail; walker !== null; i++) {
-    arr[i] = walker.value
-    walker = walker.prev
-  }
-  return arr
-}
-
-Yallist.prototype.slice = function (from, to) {
-  to = to || this.length
-  if (to < 0) {
-    to += this.length
-  }
-  from = from || 0
-  if (from < 0) {
-    from += this.length
-  }
-  var ret = new Yallist()
-  if (to < from || to < 0) {
-    return ret
-  }
-  if (from < 0) {
-    from = 0
-  }
-  if (to > this.length) {
-    to = this.length
-  }
-  for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
-    walker = walker.next
-  }
-  for (; walker !== null && i < to; i++, walker = walker.next) {
-    ret.push(walker.value)
-  }
-  return ret
-}
-
-Yallist.prototype.sliceReverse = function (from, to) {
-  to = to || this.length
-  if (to < 0) {
-    to += this.length
-  }
-  from = from || 0
-  if (from < 0) {
-    from += this.length
-  }
-  var ret = new Yallist()
-  if (to < from || to < 0) {
-    return ret
-  }
-  if (from < 0) {
-    from = 0
-  }
-  if (to > this.length) {
-    to = this.length
-  }
-  for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
-    walker = walker.prev
-  }
-  for (; walker !== null && i > from; i--, walker = walker.prev) {
-    ret.push(walker.value)
-  }
-  return ret
-}
-
-Yallist.prototype.reverse = function () {
-  var head = this.head
-  var tail = this.tail
-  for (var walker = head; walker !== null; walker = walker.prev) {
-    var p = walker.prev
-    walker.prev = walker.next
-    walker.next = p
-  }
-  this.head = tail
-  this.tail = head
-  return this
-}
-
-function push (self, item) {
-  self.tail = new Node(item, self.tail, null, self)
-  if (!self.head) {
-    self.head = self.tail
-  }
-  self.length++
-}
-
-function unshift (self, item) {
-  self.head = new Node(item, null, self.head, self)
-  if (!self.tail) {
-    self.tail = self.head
-  }
-  self.length++
-}
-
-function Node (value, prev, next, list) {
-  if (!(this instanceof Node)) {
-    return new Node(value, prev, next, list)
-  }
-
-  this.list = list
-  this.value = value
-
-  if (prev) {
-    prev.next = this
-    this.prev = prev
-  } else {
-    this.prev = null
-  }
-
-  if (next) {
-    next.prev = this
-    this.next = next
-  } else {
-    this.next = null
-  }
-}
-
-try {
-  // add if support for Symbol.iterator is present
-  require('./iterator.js')(Yallist)
-} catch (er) {}
diff --git a/legacy-libs/grpc/node_modules/yargs/CHANGELOG.md b/legacy-libs/grpc/node_modules/yargs/CHANGELOG.md
new file mode 100644 (file)
index 0000000..6c0cb51
--- /dev/null
@@ -0,0 +1,508 @@
+## Change Log
+
+### v3.32.0 (2016/1/14 10:13 +07:00)
+
+- [#344](https://github.com/bcoe/yargs/pull/344) yargs now has a code of conduct and contributor guidelines (@bcoe)
+- [#341](https://github.com/bcoe/yargs/issues/341) Fix edge-case with camel-case arguments (@davibe)
+- [#331](https://github.com/bcoe/yargs/pull/331) Handle parsing a raw argument string (@kellyselden)
+- [#325](https://github.com/bcoe/yargs/pull/325) Tweaks to make tests pass again on Windows (@isaacs)
+- [#321](https://github.com/bcoe/yargs/pull/321) Custom config parsing function (@bcoe)
+
+### v3.31.0 (2015/12/03 10:15 +07:00)
+
+- [#239](https://github.com/bcoe/yargs/pull/239) Pass argv to commands (@bcoe)
+- [#308](https://github.com/bcoe/yargs/pull/308) Yargs now handles environment variables (@nexdrew)
+- [#302](https://github.com/bcoe/yargs/pull/302) Add Indonesian translation (@rilut)
+- [#300](https://github.com/bcoe/yargs/pull/300) Add Turkish translation (@feyzo)
+- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus)
+- [#297](https://github.com/bcoe/yargs/pull/297) Fix for layout of cjk characters (@disjukr)
+- [#296](https://github.com/bcoe/yargs/pull/296) Add Korean translation (@disjukr)
+
+### v3.30.0 (2015/11/13 16:29 +07:00)
+
+- [#293](https://github.com/bcoe/yargs/pull/293) Polish language support (@kamilogorek)
+- [#291](https://github.com/bcoe/yargs/pull/291) fix edge-cases with `.alias()` (@bcoe)
+- [#289](https://github.com/bcoe/yargs/pull/289) group options in custom groups (@bcoe)
+
+### v3.29.0 (2015/10/16 21:51 +07:00)
+
+- [#282](https://github.com/bcoe/yargs/pull/282) completions now accept promises (@LinusU)
+- [#281](https://github.com/bcoe/yargs/pull/281) fix parsing issues with dot notation (@bcoe)
+
+### v3.28.0 (2015/10/16 1:55 +07:00)
+
+- [#277](https://github.com/bcoe/yargs/pull/277) adds support for ansi escape codes (@bcoe)
+
+### v3.27.0 (2015/10/08 1:55 +00:00)
+
+- [#271](https://github.com/bcoe/yargs/pull/273) skips validation for help or version flags with exitProcess(false) (@tepez)
+- [#273](https://github.com/bcoe/yargs/pull/273) implements single output for errors with exitProcess(false) (@nexdrew)
+- [#269](https://github.com/bcoe/yargs/pull/269) verifies single output for errors with exitProcess(false) (@tepez)
+- [#268](https://github.com/bcoe/yargs/pull/268) adds Chinese translation (@qiu8310)
+- [#266](https://github.com/bcoe/yargs/pull/266) adds case for -- after -- in parser test (@geophree)
+
+### v3.26.0 (2015/09/25 2:14 +00:00)
+
+- [#263](https://github.com/bcoe/yargs/pull/263) document count() and option() object keys (@nexdrew)
+- [#259](https://github.com/bcoe/yargs/pull/259) remove util in readme (@38elements)
+- [#258](https://github.com/bcoe/yargs/pull/258) node v4 builds, update deps (@nexdrew)
+- [#257](https://github.com/bcoe/yargs/pull/257) fix spelling errors (@dkoleary88)
+
+### v3.25.0 (2015/09/13 7:38 -07:00)
+
+- [#254](https://github.com/bcoe/yargs/pull/254) adds Japanese translation (@oti)
+- [#253](https://github.com/bcoe/yargs/pull/253) fixes for tests on Windows (@bcoe)
+
+### v3.24.0 (2015/09/04 12:02 +00:00)
+
+- [#248](https://github.com/bcoe/yargs/pull/248) reinstate os-locale, no spawning (@nexdrew)
+- [#249](https://github.com/bcoe/yargs/pull/249) use travis container-based infrastructure (@nexdrew)
+- [#247](https://github.com/bcoe/yargs/pull/247) upgrade standard (@nexdrew)
+
+### v3.23.0 (2015/08/30 23:00 +00:00)
+
+- [#246](https://github.com/bcoe/yargs/pull/246) detect locale based only on environment variables (@bcoe)
+- [#244](https://github.com/bcoe/yargs/pull/244) adds Windows CI testing (@bcoe)
+- [#245](https://github.com/bcoe/yargs/pull/245) adds OSX CI testing (@bcoe, @nexdrew)
+
+### v3.22.0 (2015/08/28 22:26 +00:00)
+- [#242](https://github.com/bcoe/yargs/pull/242) adds detectLocale config option (@bcoe)
+
+### v3.21.1 (2015/08/28 20:58 +00:00)
+- [#240](https://github.com/bcoe/yargs/pull/240) hot-fix for Atom on Windows (@bcoe)
+
+### v3.21.0 (2015/08/21 21:20 +00:00)
+- [#238](https://github.com/bcoe/yargs/pull/238) upgrade camelcase, window-size, chai, mocha (@nexdrew)
+- [#237](https://github.com/bcoe/yargs/pull/237) adds defaultDescription to option() (@nexdrew)
+
+### v3.20.0 (2015/08/20 01:29 +00:00)
+- [#231](https://github.com/bcoe/yargs/pull/231) Merge pull request #231 from bcoe/detect-locale (@sindresorhus)
+- [#235](https://github.com/bcoe/yargs/pull/235) adds german translation to yargs (@maxrimue)
+
+### v3.19.0 (2015/08/14 05:12 +00:00)
+- [#224](https://github.com/bcoe/yargs/pull/224) added Portuguese translation (@codemonkey3045)
+
+### v3.18.1 (2015/08/12 05:53 +00:00)
+
+- [#228](https://github.com/bcoe/yargs/pull/228) notes about embedding yargs in Electron (@etiktin)
+- [#223](https://github.com/bcoe/yargs/pull/223) make booleans work in config files (@sgentle)
+
+### v3.18.0 (2015/08/06 20:05 +00:00)
+- [#222](https://github.com/bcoe/yargs/pull/222) updates fr locale (@nexdrew)
+- [#221](https://github.com/bcoe/yargs/pull/221) adds missing locale strings (@nexdrew)
+- [#220](https://github.com/bcoe/yargs/pull/220) adds es locale (@zkat)
+
+### v3.17.1 (2015/08/02 19:35 +00:00)
+- [#218](https://github.com/bcoe/yargs/pull/218) upgrades nyc (@bcoe)
+
+### v3.17.0 (2015/08/02 18:39 +00:00)
+- [#217](https://github.com/bcoe/yargs/pull/217) sort methods in README.md (@nexdrew)
+- [#215](https://github.com/bcoe/yargs/pull/215) adds fr locale (@LoicMahieu)
+
+### v3.16.0 (2015/07/30 04:35 +00:00)
+- [#210](https://github.com/bcoe/yargs/pull/210) adds i18n support to yargs (@bcoe)
+- [#209](https://github.com/bcoe/yargs/pull/209) adds choices type to yargs (@nexdrew)
+- [#207](https://github.com/bcoe/yargs/pull/207) pretty new shields from shields.io (@SimenB)
+- [#208](https://github.com/bcoe/yargs/pull/208) improvements to README.md (@nexdrew)
+- [#205](https://github.com/bcoe/yargs/pull/205) faster build times on Travis (@ChristianMurphy)
+
+### v3.15.0 (2015/07/06 06:01 +00:00)
+- [#197](https://github.com/bcoe/yargs/pull/197) tweaks to how errors bubble up from parser.js (@bcoe)
+- [#193](https://github.com/bcoe/yargs/pull/193) upgraded nyc, reporting now happens by default (@bcoe)
+
+### v3.14.0 (2015/06/28 02:12 +00:00)
+
+- [#192](https://github.com/bcoe/yargs/pull/192) standard style nits (@bcoe)
+- [#190](https://github.com/bcoe/yargs/pull/190) allow for hidden commands, e.g.,
+  .completion('completion', false) (@tschaub)
+
+### v3.13.0 (2015/06/24 04:12 +00:00)
+
+- [#187](https://github.com/bcoe/yargs/pull/187) completion now behaves differently
+  if it is being run in the context of a command (@tschaub)
+- [#186](https://github.com/bcoe/yargs/pull/186) if no matches are found for a completion
+  default to filename completion (@tschaub)
+
+### v3.12.0 (2015/06/19 03:23 +00:00)
+- [#183](https://github.com/bcoe/yargs/pull/183) don't complete commands if they've already been completed (@tschaub)
+- [#181](https://github.com/bcoe/yargs/pull/181) various fixes for completion. (@bcoe, @tschaub)
+- [#182](https://github.com/bcoe/yargs/pull/182) you can now set a maximum # of of required arguments (@bcoe)
+
+### v3.11.0 (2015/06/15 05:15 +00:00)
+
+- [#173](https://github.com/bcoe/yargs/pull/173) update standard, window-size, chai (@bcoe)
+- [#171](https://github.com/bcoe/yargs/pull/171) a description can now be set
+  when providing a config option. (@5c077yP)
+
+### v3.10.0 (2015/05/29 04:25 +00:00)
+
+- [#165](https://github.com/bcoe/yargs/pull/165) expose yargs.terminalWidth() thanks @ensonic (@bcoe)
+- [#164](https://github.com/bcoe/yargs/pull/164) better array handling thanks @getify (@bcoe)
+
+### v3.9.1 (2015/05/20 05:14 +00:00)
+- [b6662b6](https://github.com/bcoe/yargs/commit/b6662b6774cfeab4876f41ec5e2f67b7698f4e2f) clarify .config() docs (@linclark)
+- [0291360](https://github.com/bcoe/yargs/commit/02913606285ce31ce81d7f12c48d8a3029776ec7) fixed tests, switched to nyc for coverage, fixed security issue, added Lin as collaborator (@bcoe)
+
+### v3.9.0 (2015/05/10 18:32 +00:00)
+- [#157](https://github.com/bcoe/yargs/pull/157) Merge pull request #157 from bcoe/command-yargs. allows handling of command specific arguments. Thanks for the suggestion @ohjames (@bcoe)
+- [#158](https://github.com/bcoe/yargs/pull/158) Merge pull request #158 from kemitchell/spdx-license. Update license format (@kemitchell)
+
+### v3.8.0 (2015/04/24 23:10 +00:00)
+- [#154](https://github.com/bcoe/yargs/pull/154) showHelp's method signature was misleading fixes #153 (@bcoe)
+- [#151](https://github.com/bcoe/yargs/pull/151) refactor yargs' table layout logic to use new helper library (@bcoe)
+- [#150](https://github.com/bcoe/yargs/pull/150) Fix README example in argument requirements (@annonymouse)
+
+### v3.7.2 (2015/04/13 11:52 -07:00)
+
+* [679fbbf](https://github.com/bcoe/yargs/commit/679fbbf55904030ccee8a2635e8e5f46551ab2f0) updated yargs to use the [standard](https://github.com/feross/standard) style guide (agokjr)
+* [22382ee](https://github.com/bcoe/yargs/commit/22382ee9f5b495bc2586c1758cd1091cec3647f9 various bug fixes for $0 (@nylen)
+
+### v3.7.1 (2015/04/10 11:06 -07:00)
+
+* [89e1992](https://github.com/bcoe/yargs/commit/89e1992a004ba73609b5f9ee6890c4060857aba4) detect iojs bin along with node bin. (@bcoe)
+* [755509e](https://github.com/bcoe/yargs/commit/755509ea90041e5f7833bba3b8c5deffe56f0aab) improvements to example documentation in README.md (@rstacruz)
+* [0d2dfc8](https://github.com/bcoe/yargs/commit/0d2dfc822a43418242908ad97ddd5291a1b35dc6) showHelp() no longer requires that .argv has been called (@bcoe)
+
+### v3.7.0 (2015/04/04 02:29 -07:00)
+
+* [56cbe2d](https://github.com/bcoe/yargs/commit/56cbe2ddd33dc176dcbf97ba40559864a9f114e4) make .requiresArg() work with type hints. (@bcoe).
+* [2f5d562](https://github.com/bcoe/yargs/commit/2f5d5624f736741deeedf6a664d57bc4d857bdd0) serialize arrays and objects in usage strings. (@bcoe).
+* [5126304](https://github.com/bcoe/yargs/commit/5126304dd18351fc28f10530616fdd9361e0af98) be more lenient about alias/primary key ordering in chaining API. (@bcoe)
+
+### v3.6.0 (2015/03/21 01:00 +00:00)
+- [4e24e22](https://github.com/bcoe/yargs/commit/4e24e22e6a195e55ab943ede704a0231ac33b99c) support for .js configuration files. (@pirxpilot)
+
+### v3.5.4 (2015/03/12 05:56 +00:00)
+- [c16cc08](https://github.com/bcoe/yargs/commit/c16cc085501155cf7fd853ccdf8584b05ab92b78) message for non-option arguments is now optional, thanks to (@raine)
+
+### v3.5.3 (2015/03/09 06:14 +00:00)
+- [870b428](https://github.com/bcoe/yargs/commit/870b428cf515d560926ca392555b7ad57dba9e3d) completion script was missing in package.json (@bcoe)
+
+### v3.5.2 (2015/03/09 06:11 +00:00)
+- [58a4b24](https://github.com/bcoe/yargs/commit/58a4b2473ebbb326713d522be53e32d3aabb08d2) parse was being called multiple times, resulting in strange behavior (@bcoe)
+
+### v3.5.1 (2015/03/09 04:55 +00:00)
+- [4e588e0](https://github.com/bcoe/yargs/commit/4e588e055afbeb9336533095f051496e3977f515) accidentally left testing logic in (@bcoe)
+
+### v3.5.0 (2015/03/09 04:49 +00:00)
+- [718bacd](https://github.com/bcoe/yargs/commit/718bacd81b9b44f786af76b2afe491fe06274f19) added support for bash completions see #4 (@bcoe)
+- [a192882](https://github.com/bcoe/yargs/commit/a19288270fc431396c42af01125eeb4443664528) downgrade to mocha 2.1.0 until https://github.com/mochajs/mocha/issues/1585 can be sorted out (@bcoe)
+
+### v3.4.7 (2015/03/09 04:09 +00:00)
+- [9845e5c](https://github.com/bcoe/yargs/commit/9845e5c1a9c684ba0be3f0bfb40e7b62ab49d9c8) the Argv singleton was not being updated when manually parsing arguments, fixes #114 (@bcoe)
+
+### v3.4.6 (2015/03/09 04:01 +00:00)
+- [45b4c80](https://github.com/bcoe/yargs/commit/45b4c80b890d02770b0a94f326695a8a566e8fe9) set placeholders for all keys fixes #115 (@bcoe)
+
+### v3.4.5 (2015/03/01 20:31 +00:00)
+- [a758e0b](https://github.com/bcoe/yargs/commit/a758e0b2556184f067cf3d9c4ef886d39817ebd2) fix for count consuming too many arguments (@bcoe)
+
+### v3.4.4 (2015/02/28 04:52 +00:00)
+- [0476af7](https://github.com/bcoe/yargs/commit/0476af757966acf980d998b45108221d4888cfcb) added nargs feature, allowing you to specify the number of arguments after an option (@bcoe)
+- [092477d](https://github.com/bcoe/yargs/commit/092477d7ab3efbf0ba11cede57f7d8cfc70b024f) updated README with full example of v3.0 API (@bcoe)
+
+### v3.3.3 (2015/02/28 04:23 +00:00)
+- [0c4b769](https://github.com/bcoe/yargs/commit/0c4b769516cd8d93a7c4e5e675628ae0049aa9a8) remove string dependency, which conflicted with other libraries see #106 (@bcoe)
+
+### v3.3.2 (2015/02/28 04:11 +00:00)
+- [2a98906](https://github.com/bcoe/yargs/commit/2a9890675821c0e7a12f146ce008b0562cb8ec9a) add $0 to epilog (@schnittstabil)
+
+### v3.3.1 (2015/02/24 03:28 +00:00)
+- [ad485ce](https://github.com/bcoe/yargs/commit/ad485ce748ebdfce25b88ef9d6e83d97a2f68987) fix for applying defaults to camel-case args (@bcoe)
+
+### v3.3.0 (2015/02/24 00:49 +00:00)
+- [8bfe36d](https://github.com/bcoe/yargs/commit/8bfe36d7fb0f93a799ea3f4c756a7467c320f8c0) fix and document restart() command, as a tool for building nested CLIs (@bcoe)
+
+### v3.2.1 (2015/02/22 05:45 +00:00)
+- [49a6d18](https://github.com/bcoe/yargs/commit/49a6d1822a4ef9b1ea6f90cc366be60912628885) you can now provide a function that generates a default value (@bcoe)
+
+### v3.2.0 (2015/02/22 05:24 +00:00)
+- [7a55886](https://github.com/bcoe/yargs/commit/7a55886c9343cf71a20744ca5cdd56d2ea7412d5) improvements to yargs two-column text layout (@bcoe)
+- [b6ab513](https://github.com/bcoe/yargs/commit/b6ab5136a4c3fa6aa496f6b6360382e403183989) Tweak NPM version badge (@nylen)
+
+### v3.1.0 (2015/02/19 19:37 +00:00)
+- [9bd2379](https://github.com/bcoe/yargs/commit/9bd237921cf1b61fd9f32c0e6d23f572fc225861) version now accepts a function, making it easy to load version #s from a package.json (@bcoe)
+
+### v3.0.4 (2015/02/14 01:40 +00:00)
+- [0b7c19b](https://github.com/bcoe/yargs/commit/0b7c19beaecb747267ca4cc10e5cb2a8550bc4b7) various fixes for dot-notation handling (@bcoe)
+
+### v3.0.3 (2015/02/14 00:59 +00:00)
+- [c3f35e9](https://github.com/bcoe/yargs/commit/c3f35e99bd5a0d278073fcadd95e2d778616cc17) make sure dot-notation is applied to aliases (@bcoe)
+
+### 3.0.2 (2015/02/13 16:50 +00:00)
+- [74c8967](https://github.com/bcoe/yargs/commit/74c8967c340c204a0a7edf8a702b6f46c2705435) document epilog shorthand of epilogue. (@bcoe)
+- [670110f](https://github.com/bcoe/yargs/commit/670110fc01bedc4831b6fec6afac54517d5a71bc) any non-truthy value now causes check to fail see #76 (@bcoe)
+- [0d8f791](https://github.com/bcoe/yargs/commit/0d8f791a33c11ced4cd431ea8d3d3a337d456b56) finished implementing my wish-list of fetures for yargs 3.0. see #88 (@bcoe)
+- [5768447](https://github.com/bcoe/yargs/commit/5768447447c4c8e8304f178846206ce86540f063) fix coverage. (@bcoe)
+- [82e793f](https://github.com/bcoe/yargs/commit/82e793f3f61c41259eaacb67f0796aea2cf2aaa0) detect console width and perform word-wrapping. (@bcoe)
+- [67476b3](https://github.com/bcoe/yargs/commit/67476b37eea07fee55f23f35b9e0c7d76682b86d) refactor two-column table layout so that we can use it for examples and usage (@bcoe)
+- [4724cdf](https://github.com/bcoe/yargs/commit/4724cdfcc8e37ae1ca3dcce9d762f476e9ef4bb4) major refactor of index.js, in prep for 3.x release. (@bcoe)
+
+### v2.3.0 (2015/02/08 20:41 +00:00)
+- [d824620](https://github.com/bcoe/yargs/commit/d824620493df4e63664af1fe320764dd1a9244e6) allow for undefined boolean defaults (@ashi009)
+
+### v2.2.0 (2015/02/08 20:07 +00:00)
+- [d6edd98](https://github.com/bcoe/yargs/commit/d6edd9848826e7389ed1393858c45d03961365fd) in-prep for further refactoring, and a 3.x release I've shuffled some things around and gotten test-coverage to 100%. (@bcoe)
+
+### v2.1.2 (2015/02/08 06:05 +00:00)
+- [d640745](https://github.com/bcoe/yargs/commit/d640745a7b9f8d476e0223879d056d18d9c265c4) switch to path.relative (@bcoe)
+- [3bfd41f](https://github.com/bcoe/yargs/commit/3bfd41ff262a041f29d828b88936a79c63cad594) remove mocha.opts. (@bcoe)
+- [47a2f35](https://github.com/bcoe/yargs/commit/47a2f357091db70903a402d6765501c1d63f15fe) document using .string('_') for string ids. see #56 (@bcoe)
+- [#57](https://github.com/bcoe/yargs/pull/57) Merge pull request #57 from eush77/option-readme (@eush77)
+
+### v2.1.1 (2015/02/06 08:08 +00:00)
+- [01c6c61](https://github.com/bcoe/yargs/commit/01c6c61d67b4ebf88f41f0b32a345ec67f0ac17d) fix for #71, 'newAliases' of undefined (@bcoe)
+
+### v2.1.0 (2015/02/06 07:59 +00:00)
+- [6a1a3fa](https://github.com/bcoe/yargs/commit/6a1a3fa731958e26ccd56885f183dd8985cc828f) try to guess argument types, and apply sensible defaults see #73 (@bcoe)
+
+### v2.0.1 (2015/02/06 07:54 +00:00)
+- [96a06b2](https://github.com/bcoe/yargs/commit/96a06b2650ff1d085a52b7328d8bba614c20cc12) Fix for strange behavior with --sort option, see #51 (@bcoe)
+
+### v2.0.0 (2015/02/06 07:45 +00:00)
+- [0250517](https://github.com/bcoe/yargs/commit/0250517c9643e53f431b824e8ccfa54937414011) - [108fb84](https://github.com/bcoe/yargs/commit/108fb8409a3a63dcaf99d917fe4dfcfaa1de236d) fixed bug with boolean parsing, when bools separated by = see #66 (@bcoe)
+- [a465a59](https://github.com/bcoe/yargs/commit/a465a5915f912715738de890982e4f8395958b10) Add `files` field to the package.json (@shinnn)
+- [31043de](https://github.com/bcoe/yargs/commit/31043de7a38a17c4c97711f1099f5fb164334db3) fix for yargs.argv having the same keys added multiple times see #63 (@bcoe)
+- [2d68c5b](https://github.com/bcoe/yargs/commit/2d68c5b91c976431001c4863ce47c9297850f1ad) Disable process.exit calls using .exitProcess(false) (@cianclarke)
+- [45da9ec](https://github.com/bcoe/yargs/commit/45da9ec4c55a7bd394721bc6a1db0dabad7bc52a) Mention .option in README (@eush77)
+
+### v1.3.2 (2014/10/06 21:56 +00:00)
+- [b8d3472](https://github.com/bcoe/yargs/commit/b8d34725482e5821a3cc809c0df71378f282f526) 1.3.2 (@chevex)
+
+### list (2014/08/30 18:41 +00:00)
+- [fbc777f](https://github.com/bcoe/yargs/commit/fbc777f416eeefd37c84e44d27d7dfc7c1925721) Now that yargs is the successor to optimist, I'm changing the README language to be more universal. Pirate speak isn't very accessible to non-native speakers. (@chevex)
+- [a54d068](https://github.com/bcoe/yargs/commit/a54d0682ae2efc2394d407ab171cc8a8bbd135ea) version output will not print extra newline (@boneskull)
+- [1cef5d6](https://github.com/bcoe/yargs/commit/1cef5d62a9d6d61a3948a49574892e01932cc6ae) Added contributors section to package.json (@chrisn)
+- [cc295c0](https://github.com/bcoe/yargs/commit/cc295c0a80a2de267e0155b60d315fc4b6f7c709) Added 'require' and 'required' as synonyms for 'demand' (@chrisn)
+- [d0bf951](https://github.com/bcoe/yargs/commit/d0bf951d949066b6280101ed606593d079ee15c8) Updating minimist. (@chevex)
+- [c15f8e7](https://github.com/bcoe/yargs/commit/c15f8e7f245b261e542cf205ce4f4313630cbdb4) Fix #31 (bad interaction between camelCase options and strict mode) (@nylen)
+- [d991b9b](https://github.com/bcoe/yargs/commit/d991b9be687a68812dee1e3b185ba64b7778b82d) Added .help() and .version() methods (@chrisn)
+- [e8c8aa4](https://github.com/bcoe/yargs/commit/e8c8aa46268379357cb11e9fc34b8c403037724b) Added .showHelpOnFail() method (@chrisn)
+- [e855af4](https://github.com/bcoe/yargs/commit/e855af4a933ea966b5bbdd3c4c6397a4bac1a053) Allow boolean flag with .demand() (@chrisn)
+- [14dbec2](https://github.com/bcoe/yargs/commit/14dbec24fb7380683198e2b20c4deb8423e64bea) Fixes issue #22. Arguments are no longer printed to the console when using .config. (@chevex)
+- [bef74fc](https://github.com/bcoe/yargs/commit/bef74fcddc1544598a804f80d0a3728459f196bf) Informing users that Yargs is the official optimist successor. (@chevex)
+- [#24](https://github.com/bcoe/yargs/pull/24) Merge pull request #24 from chrisn/strict (@chrisn)
+- [889a2b2](https://github.com/bcoe/yargs/commit/889a2b28eb9768801b05163360a470d0fd6c8b79) Added requiresArg option, for options that require values (@chrisn)
+- [eb16369](https://github.com/bcoe/yargs/commit/eb163692262be1fe80b992fd8803d5923c5a9b18) Added .strict() method, to report error if unknown arguments are given (@chrisn)
+- [0471c3f](https://github.com/bcoe/yargs/commit/0471c3fd999e1ad4e6cded88b8aa02013b66d14f) Changed optimist to yargs in usage-options.js example (@chrisn)
+- [5c88f74](https://github.com/bcoe/yargs/commit/5c88f74e3cf031b17c54b4b6606c83e485ff520e) Change optimist to yargs in examples (@chrisn)
+- [66f12c8](https://github.com/bcoe/yargs/commit/66f12c82ba3c943e4de8ca862980e835da8ecb3a) Fix a couple of bad interactions between aliases and defaults (@nylen)
+- [8fa1d80](https://github.com/bcoe/yargs/commit/8fa1d80f14b03eb1f2898863a61f1d1615bceb50) Document second argument of usage(message, opts) (@Gobie)
+- [56e6528](https://github.com/bcoe/yargs/commit/56e6528cf674ff70d63083fb044ff240f608448e) For "--some-option", also set argv.someOption (@nylen)
+- [ed5f6d3](https://github.com/bcoe/yargs/commit/ed5f6d33f57ad1086b11c91b51100f7c6c7fa8ee) Finished porting unit tests to Mocha. (@chevex)
+
+### v1.0.15 (2014/02/05 23:18 +00:00)
+- [e2b1fc0](https://github.com/bcoe/yargs/commit/e2b1fc0c4a59cf532ae9b01b275e1ef57eeb64d2) 1.0.15 update to badges (@chevex)
+
+### v1.0.14 (2014/02/05 23:17 +00:00)
+- [f33bbb0](https://github.com/bcoe/yargs/commit/f33bbb0f00fe18960f849cc8e15a7428a4cd59b8) Revert "Fixed issue which caused .demand function not to work correctly." (@chevex)
+
+### v1.0.13 (2014/02/05 22:13 +00:00)
+- [6509e5e](https://github.com/bcoe/yargs/commit/6509e5e7dee6ef1a1f60eea104be0faa1a045075) Fixed issue which caused .demand function not to work correctly. (@chevex)
+
+### v1.0.12 (2013/12/13 00:09 +00:00)
+- [05eb267](https://github.com/bcoe/yargs/commit/05eb26741c9ce446b33ff006e5d33221f53eaceb) 1.0.12 (@chevex)
+
+### v1.0.11 (2013/12/13 00:07 +00:00)
+- [c1bde46](https://github.com/bcoe/yargs/commit/c1bde46e37318a68b87d17a50c130c861d6ce4a9) 1.0.11 (@chevex)
+
+### v1.0.10 (2013/12/12 23:57 +00:00)
+- [dfebf81](https://github.com/bcoe/yargs/commit/dfebf8164c25c650701528ee581ca483a99dc21c) Fixed formatting in README (@chevex)
+
+### v1.0.9 (2013/12/12 23:47 +00:00)
+- [0b4e34a](https://github.com/bcoe/yargs/commit/0b4e34af5e6d84a9dbb3bb6d02cd87588031c182) Update README.md (@chevex)
+
+### v1.0.8 (2013/12/06 16:36 +00:00)
+- [#1](https://github.com/bcoe/yargs/pull/1) fix error caused by check() see #1 (@martinheidegger)
+
+### v1.0.7 (2013/11/24 18:01 +00:00)
+- [a247d88](https://github.com/bcoe/yargs/commit/a247d88d6e46644cbb7303c18b1bb678fc132d72) Modified Pirate Joe image. (@chevex)
+
+### v1.0.6 (2013/11/23 19:21 +00:00)
+- [d7f69e1](https://github.com/bcoe/yargs/commit/d7f69e1d34bc929736a8bdccdc724583e21b7eab) Updated Pirate Joe image. (@chevex)
+
+### v1.0.5 (2013/11/23 19:09 +00:00)
+- [ece809c](https://github.com/bcoe/yargs/commit/ece809cf317cc659175e1d66d87f3ca68c2760be) Updated readme notice again. (@chevex)
+
+### v1.0.4 (2013/11/23 19:05 +00:00)
+- [9e81e81](https://github.com/bcoe/yargs/commit/9e81e81654028f83ba86ffc3ac772a0476084e5e) Updated README with a notice about yargs being a fork of optimist and what that implies. (@chevex)
+
+### v1.0.3 (2013/11/23 17:43 +00:00)
+- [65e7a78](https://github.com/bcoe/yargs/commit/65e7a782c86764944d63d084416aba9ee6019c5f) Changed some small wording in README.md. (@chevex)
+- [459e20e](https://github.com/bcoe/yargs/commit/459e20e539b366b85128dd281ccd42221e96c7da) Fix a bug in the options function, when string and boolean options weren't applied to aliases. (@shockone)
+
+### v1.0.2 (2013/11/23 09:46 +00:00)
+- [3d80ebe](https://github.com/bcoe/yargs/commit/3d80ebed866d3799224b6f7d596247186a3898a9) 1.0.2 (@chevex)
+
+### v1.0.1 (2013/11/23 09:39 +00:00)
+- [f80ff36](https://github.com/bcoe/yargs/commit/f80ff3642d580d4b68bf9f5a94277481bd027142) Updated image. (@chevex)
+
+### v1.0.0 (2013/11/23 09:33 +00:00)
+- [54e31d5](https://github.com/bcoe/yargs/commit/54e31d505f820b80af13644e460894b320bf25a3) Rebranded from optimist to yargs in the spirit of the fork :D (@chevex)
+- [4ebb6c5](https://github.com/bcoe/yargs/commit/4ebb6c59f44787db7c24c5b8fe2680f01a23f498) Added documentation for demandCount(). (@chevex)
+- [4561ce6](https://github.com/bcoe/yargs/commit/4561ce66dcffa95f49e8b4449b25b94cd68acb25) Simplified the error messages returned by .check(). (@chevex)
+- [661c678](https://github.com/bcoe/yargs/commit/661c67886f479b16254a830b7e1db3be29e6b7a6) Fixed an issue with demand not accepting a zero value. (@chevex)
+- [731dd3c](https://github.com/bcoe/yargs/commit/731dd3c37624790490bd6df4d5f1da8f4348279e) Add .fail(fn) so death isn't the only option. Should fix issue #39. (@chevex)
+- [fa15417](https://github.com/bcoe/yargs/commit/fa15417ff9e70dace0d726627a5818654824c1d8) Added a few missing 'return self' (@chevex)
+- [e655e4d](https://github.com/bcoe/yargs/commit/e655e4d99d1ae1d3695ef755d51c2de08d669761) Fix showing help in certain JS environments. (@chevex)
+- [a746a31](https://github.com/bcoe/yargs/commit/a746a31cd47c87327028e6ea33762d6187ec5c87) Better string representation of default values. (@chevex)
+- [6134619](https://github.com/bcoe/yargs/commit/6134619a7e90b911d5443230b644c5d447c1a68c) Implies: conditional demands (@chevex)
+- [046b93b](https://github.com/bcoe/yargs/commit/046b93b5d40a27367af4cb29726e4d781d934639) Added support for JSON config files. (@chevex)
+- [a677ec0](https://github.com/bcoe/yargs/commit/a677ec0a0ecccd99c75e571d03323f950688da03) Add .example(cmd, desc) feature. (@chevex)
+- [1bd4375](https://github.com/bcoe/yargs/commit/1bd4375e11327ba1687d4bb6e5e9f3c30c1be2af) Added 'defaults' as alias to 'default' so as to avoid usage of a reserved keyword. (@chevex)
+- [6b753c1](https://github.com/bcoe/yargs/commit/6b753c16ca09e723060e70b773b430323b29c45c) add .normalize(args..) support for normalizing paths (@chevex)
+- [33d7d59](https://github.com/bcoe/yargs/commit/33d7d59341d364f03d3a25f0a55cb99004dbbe4b) Customize error messages with demand(key, msg) (@chevex)
+- [647d37f](https://github.com/bcoe/yargs/commit/647d37f164c20f4bafbf67dd9db6cd6e2cd3b49f) Merge branch 'rewrite-duplicate-test' of github.com:isbadawi/node-optimist (@chevex)
+- [9059d1a](https://github.com/bcoe/yargs/commit/9059d1ad5e8aea686c2a01c89a23efdf929fff2e) Pass aliases object to check functions for greater versatility. (@chevex)
+- [623dc26](https://github.com/bcoe/yargs/commit/623dc26c7331abff2465ef8532e3418996d42fe6) Added ability to count boolean options and rolled minimist library back into project. (@chevex)
+- [49f0dce](https://github.com/bcoe/yargs/commit/49f0dcef35de4db544c3966350d36eb5838703f6) Fixed small typo. (@chevex)
+- [79ec980](https://github.com/bcoe/yargs/commit/79ec9806d9ca6eb0014cfa4b6d1849f4f004baf2) Removed dependency on wordwrap module. (@chevex)
+- [ea14630](https://github.com/bcoe/yargs/commit/ea14630feddd69d1de99dd8c0e08948f4c91f00a) Merge branch 'master' of github.com:chbrown/node-optimist (@chevex)
+- [2b75da2](https://github.com/bcoe/yargs/commit/2b75da2624061e0f4f3107d20303c06ec9054906) Merge branch 'master' of github.com:seanzhou1023/node-optimist (@chevex)
+- [d9bda11](https://github.com/bcoe/yargs/commit/d9bda1116e26f3b40e833ca9ca19263afea53565) Merge branch 'patch-1' of github.com:thefourtheye/node-optimist (@chevex)
+- [d6cc606](https://github.com/bcoe/yargs/commit/d6cc6064a4f1bea38a16a4430b8a1334832fbeff) Renamed README. (@chevex)
+- [9498d3f](https://github.com/bcoe/yargs/commit/9498d3f59acfb5e102826503e681623c3a64b178) Renamed readme and added .gitignore. (@chevex)
+- [bbd1fe3](https://github.com/bcoe/yargs/commit/bbd1fe37fefa366dde0fb3dc44d91fe8b28f57f5) Included examples for ```help``` and ```showHelp``` functions and fixed few formatting issues (@thefourtheye)
+- [37fea04](https://github.com/bcoe/yargs/commit/37fea0470a5796a0294c1dcfff68d8041650e622) .alias({}) behaves differently based on mapping direction when generating descriptions (@chbrown)
+- [855b20d](https://github.com/bcoe/yargs/commit/855b20d0be567ca121d06b30bea64001b74f3d6d) Documented function signatures are useful for dynamically typed languages. (@chbrown)
+
+### 0.6.0 (2013/06/25 08:48 +00:00)
+- [d37bfe0](https://github.com/bcoe/yargs/commit/d37bfe05ae6d295a0ab481efe4881222412791f4) all tests passing using minimist (@substack)
+- [76f1352](https://github.com/bcoe/yargs/commit/76f135270399d01f2bbc621e524a5966e5c422fd) all parse tests now passing (@substack)
+- [a7b6754](https://github.com/bcoe/yargs/commit/a7b6754276c38d1565479a5685c3781aeb947816) using minimist, some tests passing (@substack)
+- [6655688](https://github.com/bcoe/yargs/commit/66556882aa731cbbbe16cc4d42c85740a2e98099) Give credit where its due (@DeadAlready)
+- [602a2a9](https://github.com/bcoe/yargs/commit/602a2a92a459f93704794ad51b115bbb08b535ce) v0.5.3 - Remove wordwrap as dependency (@DeadAlready)
+
+### 0.5.2 (2013/05/31 03:46 +00:00)
+- [4497ca5](https://github.com/bcoe/yargs/commit/4497ca55e332760a37b866ec119ded347ca27a87) fixed the whitespace bug without breaking anything else (@substack)
+- [5a3dd1a](https://github.com/bcoe/yargs/commit/5a3dd1a4e0211a38613c6e02f61328e1031953fa) failing test for whitespace arg (@substack)
+
+### 0.5.1 (2013/05/30 07:17 +00:00)
+- [a20228f](https://github.com/bcoe/yargs/commit/a20228f62a454755dd07f628a7c5759113918327) fix parse() to work with functions before it (@substack)
+- [b13bd4c](https://github.com/bcoe/yargs/commit/b13bd4cac856a9821d42fa173bdb58f089365a7d) failing test for parse() with modifiers (@substack)
+
+### 0.5.0 (2013/05/18 21:59 +00:00)
+- [c474a64](https://github.com/bcoe/yargs/commit/c474a649231527915c222156e3b40806d365a87c) fixes for dash (@substack)
+
+### 0.4.0 (2013/04/13 19:03 +00:00)
+- [dafe3e1](https://github.com/bcoe/yargs/commit/dafe3e18d7c6e7c2d68e06559df0e5cbea3adb14) failing short test (@substack)
+
+### 0.3.7 (2013/04/04 04:07 +00:00)
+- [6c7a0ec](https://github.com/bcoe/yargs/commit/6c7a0ec94ce4199a505f0518b4d6635d4e47cc81) Fix for windows. On windows there is no _ in environment. (@hdf)
+
+### 0.3.6 (2013/04/04 04:04 +00:00)
+- [e72346a](https://github.com/bcoe/yargs/commit/e72346a727b7267af5aa008b418db89970873f05) Add support for newlines in -a="" arguments (@danielbeardsley)
+- [71e1fb5](https://github.com/bcoe/yargs/commit/71e1fb55ea9987110a669ac6ec12338cfff3821c) drop 0.4, add 0.8 to travis (@substack)
+
+### 0.3.5 (2012/10/10 11:09 +00:00)
+- [ee692b3](https://github.com/bcoe/yargs/commit/ee692b37554c70a0bb16389a50a26b66745cbbea) Fix parsing booleans (@vojtajina)
+- [5045122](https://github.com/bcoe/yargs/commit/5045122664c3f5b4805addf1be2148d5856f7ce8) set $0 properly in the tests (@substack)
+
+### 0.3.4 (2012/04/30 06:54 +00:00)
+- [f28c0e6](https://github.com/bcoe/yargs/commit/f28c0e62ca94f6e0bb2e6d82fc3d91a55e69b903) bump for string "true" params (@substack)
+- [8f44aeb](https://github.com/bcoe/yargs/commit/8f44aeb74121ddd689580e2bf74ef86a605e9bf2) Fix failing test for aliased booleans. (@coderarity)
+- [b9f7b61](https://github.com/bcoe/yargs/commit/b9f7b613b1e68e11e6c23fbda9e555a517dcc976) Add failing test for short aliased booleans. (@coderarity)
+
+### 0.3.3 (2012/04/30 06:45 +00:00)
+- [541bac8](https://github.com/bcoe/yargs/commit/541bac8dd787a5f1a5d28f6d8deb1627871705e7) Fixes #37.
+
+### 0.3.2 (2012/04/12 20:28 +00:00)
+- [3a0f014](https://github.com/bcoe/yargs/commit/3a0f014c1451280ac1c9caa1f639d31675586eec) travis badge (@substack)
+- [4fb60bf](https://github.com/bcoe/yargs/commit/4fb60bf17845f4ce3293f8ca49c9a1a7c736cfce) Fix boolean aliases. (@coderarity)
+- [f14dda5](https://github.com/bcoe/yargs/commit/f14dda546efc4fe06ace04d36919bfbb7634f79b) Adjusted package.json to use tap (@jfhbrook)
+- [88e5d32](https://github.com/bcoe/yargs/commit/88e5d32295be6e544c8d355ff84e355af38a1c74) test/usage.js no longer hangs (@jfhbrook)
+- [e1e740c](https://github.com/bcoe/yargs/commit/e1e740c27082f3ce84deca2093d9db2ef735d0e5) two tests for combined boolean/alias opts parsing (@jfhbrook)
+
+### 0.3.1 (2011/12/31 08:44 +00:00)
+- [d09b719](https://github.com/bcoe/yargs/commit/d09b71980ef711b6cf3918cd19beec8257e40e82) If "default" is set to false it was not passed on, fixed. (@wolframkriesing)
+
+### 0.3.0 (2011/12/09 06:03 +00:00)
+- [6e74aa7](https://github.com/bcoe/yargs/commit/6e74aa7b46a65773e20c0cb68d2d336d4a0d553d) bump and documented dot notation (@substack)
+
+### 0.2.7 (2011/10/20 02:25 +00:00)
+- [94adee2](https://github.com/bcoe/yargs/commit/94adee20e17b58d0836f80e8b9cdbe9813800916) argv._ can be told 'Hey! argv._! Don't be messing with my args.', and it WILL obey (@colinta)
+- [c46fdd5](https://github.com/bcoe/yargs/commit/c46fdd56a05410ae4a1e724a4820c82e77ff5469) optimistic critter image (@substack)
+- [5c95c73](https://github.com/bcoe/yargs/commit/5c95c73aedf4c7482bd423e10c545e86d7c8a125) alias options() to option() (@substack)
+- [f7692ea](https://github.com/bcoe/yargs/commit/f7692ea8da342850af819367833abb685fde41d8) [fix] Fix for parsing boolean edge case (@indexzero)
+- [d1f92d1](https://github.com/bcoe/yargs/commit/d1f92d1425bd7f356055e78621b30cdf9741a3c2)
+- [b01bda8](https://github.com/bcoe/yargs/commit/b01bda8d86e455bbf74ce497864cb8ab5b9fb847) [fix test] Update to ensure optimist is aware of default booleans. Associated tests included (@indexzero)
+- [aa753e7](https://github.com/bcoe/yargs/commit/aa753e7c54fb3a12f513769a0ff6d54aa0f63943) [dist test] Update devDependencies in package.json. Update test pathing to be more npm and require.paths future-proof (@indexzero)
+- [7bfce2f](https://github.com/bcoe/yargs/commit/7bfce2f3b3c98e6539e7549d35fbabced7e9341e) s/sys/util/ (@substack)
+- [d420a7a](https://github.com/bcoe/yargs/commit/d420a7a9c890d2cdb11acfaf3ea3f43bc3e39f41) update usage output (@substack)
+- [cf86eed](https://github.com/bcoe/yargs/commit/cf86eede2e5fc7495b6ec15e6d137d9ac814f075) some sage readme protips about parsing rules (@substack)
+- [5da9f7a](https://github.com/bcoe/yargs/commit/5da9f7a5c0e1758ec7c5801fb3e94d3f6e970513) documented all the methods finally (@substack)
+- [8ca6879](https://github.com/bcoe/yargs/commit/8ca6879311224b25933642987300f6a29de5c21b) fenced syntax highlighting (@substack)
+- [b72bacf](https://github.com/bcoe/yargs/commit/b72bacf1d02594778c1935405bc8137eb61761dc) right-alignment of wrapped extra params (@substack)
+- [2b980bf](https://github.com/bcoe/yargs/commit/2b980bf2656b4ee8fc5134dc5f56a48855c35198) now with .wrap() (@substack)
+- [d614f63](https://github.com/bcoe/yargs/commit/d614f639654057d1b7e35e3f5a306e88ec2ad1e4) don't show 'Options:' when there aren't any (@substack)
+- [691eda3](https://github.com/bcoe/yargs/commit/691eda354df97b5a86168317abcbcaabdc08a0fb) failing test for multi-aliasing (@substack)
+- [0826c9f](https://github.com/bcoe/yargs/commit/0826c9f462109feab2bc7a99346d22e72bf774b7) "Options:" > "options:" (@substack)
+- [72f7490](https://github.com/bcoe/yargs/commit/72f749025d01b7f295738ed370a669d885fbada0) [minor] Update formatting for `.showHelp()` (@indexzero)
+- [75aecce](https://github.com/bcoe/yargs/commit/75aeccea74329094072f95800e02c275e7d999aa) options works again, too lazy to write a proper test right now (@substack)
+- [f742e54](https://github.com/bcoe/yargs/commit/f742e5439817c662dc3bd8734ddd6467e6018cfd) line_count_options example, which breaks (@substack)
+- [4ca06b8](https://github.com/bcoe/yargs/commit/4ca06b8b4ea99b5d5714b315a2a8576bee6e5537) line count example (@substack)
+- [eeb8423](https://github.com/bcoe/yargs/commit/eeb8423e0a5ecc9dc3eb1e6df9f3f8c1c88f920b) remove self.argv setting in boolean (@substack)
+- [6903412](https://github.com/bcoe/yargs/commit/69034126804660af9cc20ea7f4457b50338ee3d7) removed camel case for now (@substack)
+- [5a0d88b](https://github.com/bcoe/yargs/commit/5a0d88bf23e9fa79635dd034e2a1aa992acc83cd) remove dead longest checking code (@substack)
+- [d782170](https://github.com/bcoe/yargs/commit/d782170babf7284b1aa34f5350df0dd49c373fa8) .help() too (@substack)
+- [622ec17](https://github.com/bcoe/yargs/commit/622ec17379bb5374fdbb190404c82bc600975791) rm old help generator (@substack)
+- [7c8baac](https://github.com/bcoe/yargs/commit/7c8baac4d66195e9f5158503ea9ebfb61153dab7) nub keys (@substack)
+- [8197785](https://github.com/bcoe/yargs/commit/8197785ad4762465084485b041abd722f69bf344) generate help message based on the previous calls, todo: nub (@substack)
+- [3ffbdc3](https://github.com/bcoe/yargs/commit/3ffbdc33c8f5e83d4ea2ac60575ce119570c7ede) stub out new showHelp, better checks (@substack)
+- [d4e21f5](https://github.com/bcoe/yargs/commit/d4e21f56a4830f7de841900d3c79756fb9886184) let .options() take single options too (@substack)
+- [3c4cf29](https://github.com/bcoe/yargs/commit/3c4cf2901a29bac119cca8e983028d8669230ec6) .options() is now heaps simpler (@substack)
+- [89f0d04](https://github.com/bcoe/yargs/commit/89f0d043cbccd302f10ab30c2069e05d2bf817c9) defaults work again, all tests pass (@substack)
+- [dd87333](https://github.com/bcoe/yargs/commit/dd8733365423006a6e4156372ebb55f98323af58) update test error messages, down to 2 failing tests (@substack)
+- [53f7bc6](https://github.com/bcoe/yargs/commit/53f7bc626b9875f2abdfc5dd7a80bde7f14143a3) fix for bools doubling up, passes the parse test again, others fail (@substack)
+- [2213e2d](https://github.com/bcoe/yargs/commit/2213e2ddc7263226fba717fb041dc3fde9bc2ee4) refactored for an argv getter, failing several tests (@substack)
+- [d1e7379](https://github.com/bcoe/yargs/commit/d1e737970f15c6c006bebdd8917706827ff2f0f2) just rescan for now, alias test passes (@substack)
+- [b2f8c99](https://github.com/bcoe/yargs/commit/b2f8c99cc477a8eb0fdf4cf178e1785b63185cfd) failing alias test (@substack)
+- [d0c0174](https://github.com/bcoe/yargs/commit/d0c0174daa144bfb6dc7290fdc448c393c475e15) .alias() (@substack)
+- [d85f431](https://github.com/bcoe/yargs/commit/d85f431ad7d07b058af3f2a57daa51495576c164) [api] Remove `.describe()` in favor of building upon the existing `.usage()` API (@indexzero)
+- [edbd527](https://github.com/bcoe/yargs/commit/edbd5272a8e213e71acd802782135c7f9699913a) [doc api] Add `.describe()`, `.options()`, and `.showHelp()` methods along with example. (@indexzero)
+- [be4902f](https://github.com/bcoe/yargs/commit/be4902ff0961ae8feb9093f2c0a4066463ded2cf) updates for coffee since it now does argv the node way (@substack)
+- [e24cb23](https://github.com/bcoe/yargs/commit/e24cb23798ee64e53b60815e7fda78b87f42390c) more general coffeescript detection (@substack)
+- [78ac753](https://github.com/bcoe/yargs/commit/78ac753e5d0ec32a96d39d893272afe989e42a4d) Don't trigger the CoffeeScript hack when running under node_g. (@papandreou)
+- [bcfe973](https://github.com/bcoe/yargs/commit/bcfe9731d7f90d4632281b8a52e8d76eb0195ae6) .string() but failing test (@substack)
+- [1987aca](https://github.com/bcoe/yargs/commit/1987aca28c7ba4e8796c07bbc547cb984804c826) test hex strings (@substack)
+- [ef36db3](https://github.com/bcoe/yargs/commit/ef36db32259b0b0d62448dc907c760e5554fb7e7) more keywords (@substack)
+- [cc53c56](https://github.com/bcoe/yargs/commit/cc53c56329960bed6ab077a79798e991711ba01d) Added camelCase function that converts --multi-word-option to camel case (so it becomes argv.multiWordOption). (@papandreou)
+- [60b57da](https://github.com/bcoe/yargs/commit/60b57da36797716e5783a633c6d5c79099016d45) fixed boolean bug by rescanning (@substack)
+- [dff6d07](https://github.com/bcoe/yargs/commit/dff6d078d97f8ac503c7d18dcc7b7a8c364c2883) boolean examples (@substack)
+- [0e380b9](https://github.com/bcoe/yargs/commit/0e380b92c4ef4e3c8dac1da18b5c31d85b1d02c9) boolean() with passing test (@substack)
+- [62644d4](https://github.com/bcoe/yargs/commit/62644d4bffbb8d1bbf0c2baf58a1d14a6359ef07) coffee compatibility with node regex for versions too (@substack)
+- [430fafc](https://github.com/bcoe/yargs/commit/430fafcf1683d23774772826581acff84b456827) argv._ fixed by fixing the coffee detection (@substack)
+- [343b8af](https://github.com/bcoe/yargs/commit/343b8afefd98af274ebe21b5a16b3a949ec5429f) whichNodeArgs test fails too (@substack)
+- [63df2f3](https://github.com/bcoe/yargs/commit/63df2f371f31e63d7f1dec2cbf0022a5f08da9d2) replicated mnot's bug in whichNodeEmpty test (@substack)
+- [35473a4](https://github.com/bcoe/yargs/commit/35473a4d93a45e5e7e512af8bb54ebb532997ae1) test for ./bin usage (@substack)
+- [13df151](https://github.com/bcoe/yargs/commit/13df151e44228eed10e5441c7cd163e086c458a4) don't coerce booleans to numbers (@substack)
+- [85f8007](https://github.com/bcoe/yargs/commit/85f8007e93b8be7124feea64b1f1916d8ba1894a) package bump for automatic number conversion (@substack)
+- [8f17014](https://github.com/bcoe/yargs/commit/8f170141cded4ccc0c6d67a849c5bf996aa29643) updated readme and examples with new auto-numberification goodness (@substack)
+- [73dc901](https://github.com/bcoe/yargs/commit/73dc9011ac968e39b55e19e916084a839391b506) auto number conversion works yay (@substack)
+- [bcec56b](https://github.com/bcoe/yargs/commit/bcec56b3d031e018064cbb691539ccc4f28c14ad) failing test for not-implemented auto numification (@substack)
+- [ebd2844](https://github.com/bcoe/yargs/commit/ebd2844d683feeac583df79af0e5124a7a7db04e) odd that eql doesn't check types careflly (@substack)
+- [fd854b0](https://github.com/bcoe/yargs/commit/fd854b02e512ce854b76386d395672a7969c1bc4) package author + keywords (@substack)
+- [656a1d5](https://github.com/bcoe/yargs/commit/656a1d5a1b7c0e49d72e80cb13f20671d56f76c6) updated readme with .default() stuff (@substack)
+- [cd7f8c5](https://github.com/bcoe/yargs/commit/cd7f8c55f0b82b79b690d14c5f806851236998a1) passing tests for new .default() behavior (@substack)
+- [932725e](https://github.com/bcoe/yargs/commit/932725e39ce65bc91a0385a5fab659a5fa976ac2) new default() thing for setting default key/values (@substack)
+- [4e6c7ab](https://github.com/bcoe/yargs/commit/4e6c7aba6374ac9ebc6259ecf91f13af7bce40e3) test for coffee usage (@substack)
+- [d54ffcc](https://github.com/bcoe/yargs/commit/d54ffccf2a5a905f51ed5108f7c647f35d64ae23) new --key value style with passing tests. NOTE: changes existing behavior (@substack)
+- [ed2a2d5](https://github.com/bcoe/yargs/commit/ed2a2d5d828100ebeef6385c0fb88d146a5cfe9b) package bump for summatix's coffee script fix (@substack)
+- [75a975e](https://github.com/bcoe/yargs/commit/75a975eed8430d28e2a79dc9e6d819ad545f4587) Added support for CoffeeScript (@summatix)
+- [56b2b1d](https://github.com/bcoe/yargs/commit/56b2b1de8d11f8a2b91979d8ae2d6db02d8fe64d) test coverage for the falsy check() usage (@substack)
+- [a4843a9](https://github.com/bcoe/yargs/commit/a4843a9f0e69ffb4afdf6a671d89eb6f218be35d) check bug fixed plus a handy string (@substack)
+- [857bd2d](https://github.com/bcoe/yargs/commit/857bd2db933a5aaa9cfecba0ced2dc9b415f8111) tests for demandCount, back up to 100% coverage (@substack)
+- [073b776](https://github.com/bcoe/yargs/commit/073b7768ebd781668ef05c13f9003aceca2f5c35) call demandCount from demand (@substack)
+- [4bd4b7a](https://github.com/bcoe/yargs/commit/4bd4b7a085c8b6ce1d885a0f486cc9865cee2db1) add demandCount to check for the number of arguments in the _ list (@marshall)
+- [b8689ac](https://github.com/bcoe/yargs/commit/b8689ac68dacf248119d242bba39a41cb0adfa07) Rebase checks. That will be its own module eventually. (@substack)
+- [e688370](https://github.com/bcoe/yargs/commit/e688370b576f0aa733c3f46183df69e1b561668e) a $0 like in perl (@substack)
+- [2e5e196](https://github.com/bcoe/yargs/commit/2e5e1960fc19afb21fb3293752316eaa8bcd3609) usage test hacking around process and console (@substack)
+- [fcc3521](https://github.com/bcoe/yargs/commit/fcc352163fbec6a1dfe8caf47a0df39de24fe016) description pun (@substack)
+- [87a1fe2](https://github.com/bcoe/yargs/commit/87a1fe29037ca2ca5fefda85141aaeb13e8ce761) mit/x11 license (@substack)
+- [8d089d2](https://github.com/bcoe/yargs/commit/8d089d24cd687c0bde3640a96c09b78f884900dd) bool example is more consistent and also shows off short option grouping (@substack)
+- [448d747](https://github.com/bcoe/yargs/commit/448d7473ac68e8e03d8befc9457b0d9e21725be0) start of the readme and examples (@substack)
+- [da74dea](https://github.com/bcoe/yargs/commit/da74dea799a9b59dbf022cbb8001bfdb0d52eec9) more tests for long and short captures (@substack)
+- [ab6387e](https://github.com/bcoe/yargs/commit/ab6387e6769ca4af82ca94c4c67c7319f0d9fcfa) silly bug in the tests with s/not/no/, all tests pass now (@substack)
+- [102496a](https://github.com/bcoe/yargs/commit/102496a319e8e06f6550d828fc2f72992c7d9ecc) hack an instance for process.argv onto Argv so the export can be called to create an instance or used for argv, which is the most common case (@substack)
+- [a01caeb](https://github.com/bcoe/yargs/commit/a01caeb532546d19f68f2b2b87f7036cfe1aaedd) divide example (@substack)
+- [443da55](https://github.com/bcoe/yargs/commit/443da55736acbaf8ff8b04d1b9ce19ab016ddda2) start of the lib with a package.json (@substack)
diff --git a/legacy-libs/grpc/node_modules/yargs/README.md b/legacy-libs/grpc/node_modules/yargs/README.md
new file mode 100644 (file)
index 0000000..3649538
--- /dev/null
@@ -0,0 +1,1243 @@
+yargs
+========
+
+Yargs be a node.js library fer hearties tryin' ter parse optstrings.
+
+With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash.
+
+[![Build Status][travis-image]][travis-url]
+[![Dependency Status][gemnasium-image]][gemnasium-url]
+[![Coverage Status][coveralls-image]][coveralls-url]
+[![NPM version][npm-image]][npm-url]
+[![Windows Tests][windows-image]][windows-url]
+
+> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :)
+
+examples
+========
+
+With yargs, the options be just a hash!
+-------------------------------------------------------------------
+
+plunder.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+
+if (argv.ships > 3 && argv.distance < 53.5) {
+    console.log('Plunder more riffiwobbles!');
+}
+else {
+    console.log('Retreat from the xupptumblers!');
+}
+````
+
+***
+
+    $ ./plunder.js --ships=4 --distance=22
+    Plunder more riffiwobbles!
+
+    $ ./plunder.js --ships 12 --distance 98.7
+    Retreat from the xupptumblers!
+
+![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png)
+
+But don't walk the plank just yet! There be more! You can do short options:
+-------------------------------------------------
+
+short.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+console.log('(%d,%d)', argv.x, argv.y);
+````
+
+***
+
+    $ ./short.js -x 10 -y 21
+    (10,21)
+
+And booleans, both long, short, and even grouped:
+----------------------------------
+
+bool.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+
+if (argv.s) {
+    process.stdout.write(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: ');
+}
+console.log(
+    (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '')
+);
+````
+
+***
+
+    $ ./bool.js -s
+    The parrot says: squawk
+
+    $ ./bool.js -sp
+    The parrot says: squawk!
+
+    $ ./bool.js -sp --fr
+    Le perroquet dit: couac!
+
+And non-hyphenated options too! Just use `argv._`!
+-------------------------------------------------
+
+nonopt.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+console.log('(%d,%d)', argv.x, argv.y);
+console.log(argv._);
+````
+
+***
+
+    $ ./nonopt.js -x 6.82 -y 3.35 rum
+    (6.82,3.35)
+    [ 'rum' ]
+
+    $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho
+    (0.54,1.12)
+    [ 'me hearties', 'yo', 'ho' ]
+
+Yargs even counts your booleans!
+----------------------------------------------------------------------
+
+count.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .count('verbose')
+    .alias('v', 'verbose')
+    .argv;
+
+VERBOSE_LEVEL = argv.verbose;
+
+function WARN()  { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); }
+function INFO()  { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); }
+function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); }
+
+WARN("Showing only important stuff");
+INFO("Showing semi-important stuff too");
+DEBUG("Extra chatty mode");
+````
+
+***
+    $ node count.js
+    Showing only important stuff
+
+    $ node count.js -v
+    Showing only important stuff
+    Showing semi-important stuff too
+
+    $ node count.js -vv
+    Showing only important stuff
+    Showing semi-important stuff too
+    Extra chatty mode
+
+    $ node count.js -v --verbose
+    Showing only important stuff
+    Showing semi-important stuff too
+    Extra chatty mode
+
+Tell users how to use yer options and make demands.
+-------------------------------------------------
+
+area.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Usage: $0 -w [num] -h [num]')
+    .demand(['w','h'])
+    .argv;
+
+console.log("The area is:", argv.w * argv.h);
+````
+
+***
+
+    $ ./area.js -w 55 -h 11
+    The area is: 605
+
+    $ node ./area.js -w 4.91 -w 2.51
+    Usage: area.js -w [num] -h [num]
+
+    Options:
+      -w  [required]
+      -h  [required]
+
+    Missing required arguments: h
+
+After yer demands have been met, demand more! Ask for non-hyphenated arguments!
+-----------------------------------------
+
+demand_count.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .demand(2)
+    .argv;
+console.dir(argv);
+````
+
+***
+
+       $ ./demand_count.js a
+
+       Not enough non-option arguments: got 1, need at least 2
+
+       $ ./demand_count.js a b
+       { _: [ 'a', 'b' ], '$0': 'demand_count.js' }
+
+       $ ./demand_count.js a b c
+       { _: [ 'a', 'b', 'c' ], '$0': 'demand_count.js' }
+
+EVEN MORE SHIVER ME TIMBERS!
+------------------
+
+default_singles.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .default('x', 10)
+    .default('y', 10)
+    .argv
+;
+console.log(argv.x + argv.y);
+````
+
+***
+
+    $ ./default_singles.js -x 5
+    15
+
+default_hash.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .default({ x : 10, y : 10 })
+    .argv
+;
+console.log(argv.x + argv.y);
+````
+
+***
+
+    $ ./default_hash.js -y 7
+    17
+
+And if you really want to get all descriptive about it...
+---------------------------------------------------------
+
+boolean_single.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .boolean('v')
+    .argv
+;
+console.dir(argv.v);
+console.dir(argv._);
+````
+
+***
+
+    $ ./boolean_single.js -v "me hearties" yo ho
+    true
+    [ 'me hearties', 'yo', 'ho' ]
+
+
+boolean_double.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .boolean(['x','y','z'])
+    .argv
+;
+console.dir([ argv.x, argv.y, argv.z ]);
+console.dir(argv._);
+````
+
+***
+
+    $ ./boolean_double.js -x -z one two three
+    [ true, false, true ]
+    [ 'one', 'two', 'three' ]
+
+Yargs is here to help you...
+---------------------------
+
+Ye can describe parameters fer help messages and set aliases. Yargs figures
+out how ter format a handy help string automatically.
+
+line_count.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Usage: $0 <command> [options]')
+    .command('count', 'Count the lines in a file')
+    .demand(1)
+    .example('$0 count -f foo.js', 'count the lines in the given file')
+    .demand('f')
+    .alias('f', 'file')
+    .nargs('f', 1)
+    .describe('f', 'Load a file')
+    .help('h')
+    .alias('h', 'help')
+    .epilog('copyright 2015')
+    .argv;
+
+var fs = require('fs');
+var s = fs.createReadStream(argv.file);
+
+var lines = 0;
+s.on('data', function (buf) {
+    lines += buf.toString().match(/\n/g).length;
+});
+
+s.on('end', function () {
+    console.log(lines);
+});
+````
+
+***
+    $ node line_count.js count
+    Usage: line_count.js <command> [options]
+
+    Commands:
+      count    Count the lines in a file
+
+    Options:
+      -f, --file  Load a file        [required]
+      -h, --help  Show help           [boolean]
+
+    Examples:
+      line_count.js count -f foo.js  count the lines in the given file
+
+    copyright 2015
+
+    Missing required arguments: f
+
+    $ node line_count.js count --file line_count.js
+    26
+
+    $ node line_count.js count -f line_count.js
+    26
+
+methods
+=======
+
+By itself,
+
+````javascript
+require('yargs').argv
+````
+
+will use the `process.argv` array to construct the `argv` object.
+
+You can pass in the `process.argv` yourself:
+
+````javascript
+require('yargs')([ '-x', '1', '-y', '2' ]).argv
+````
+
+or use `.parse()` to do the same thing:
+
+````javascript
+require('yargs').parse([ '-x', '1', '-y', '2' ])
+````
+
+The rest of these methods below come in just before the terminating `.argv`.
+
+<a name="alias"></a>.alias(key, alias)
+------------------
+
+Set key names as equivalent such that updates to a key will propagate to aliases
+and vice-versa.
+
+Optionally `.alias()` can take an object that maps keys to aliases.
+Each key of this object should be the canonical version of the option, and each
+value should be a string or an array of strings.
+
+.argv
+-----
+
+Get the arguments as a plain old object.
+
+Arguments without a corresponding flag show up in the `argv._` array.
+
+The script name or node command is available at `argv.$0` similarly to how `$0`
+works in bash or perl.
+
+If `yargs` is executed in an environment that embeds node and there's no script name (e.g.
+[Electron](http://electron.atom.io/) or [nw.js](http://nwjs.io/)), it will ignore the first parameter since it
+expects it to be the script name. In order to override this behavior, use `.parse(process.argv.slice(1))`
+instead of `.argv` and the first parameter won't be ignored.
+
+<a name="array"></a>.array(key)
+----------
+
+Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
+`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`.
+
+<a name="boolean"></a>.boolean(key)
+-------------
+
+Interpret `key` as a boolean. If a non-flag option follows `key` in
+`process.argv`, that string won't get set as the value of `key`.
+
+`key` will default to `false`, unless a `default(key, undefined)` is
+explicitly set.
+
+If `key` is an array, interpret all the elements as booleans.
+
+.check(fn)
+----------
+
+Check that certain conditions are met in the provided arguments.
+
+`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases.
+
+If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and
+exit.
+
+<a name="choices"></a>.choices(key, choices)
+----------------------
+
+Limit valid values for `key` to a predefined set of `choices`, given as an array
+or as an individual value.
+
+```js
+var argv = require('yargs')
+  .alias('i', 'ingredient')
+  .describe('i', 'choose your sandwich ingredients')
+  .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles'])
+  .help('help')
+  .argv
+```
+
+If this method is called multiple times, all enumerated values will be merged
+together. Choices are generally strings or numbers, and value matching is
+case-sensitive.
+
+Optionally `.choices()` can take an object that maps multiple keys to their
+choices.
+
+Choices can also be specified as `choices` in the object given to `option()`.
+
+```js
+var argv = require('yargs')
+  .option('size', {
+    alias: 's',
+    describe: 'choose a size',
+    choices: ['xs', 's', 'm', 'l', 'xl']
+  })
+  .argv
+```
+
+.command(cmd, desc, [fn])
+-------------------
+
+Document the commands exposed by your application.
+
+Use `desc` to provide a description for each command your application accepts (the
+values stored in `argv._`).  Set `desc` to `false` to create a hidden command.
+Hidden commands don't show up in the help output and aren't available for
+completion.
+
+Optionally, you can provide a handler `fn` which will be executed when
+a given command is provided. The handler will be called with `yargs` and
+`argv` as arguments.
+
+`yargs` is a blank instance of yargs, which can be used to compose a nested
+hierarchy of options handlers.
+
+`argv` represents the arguments parsed prior to the
+command being executed (those described in the outer yargs instance).
+
+Here's an example of top-level and nested commands in action:
+
+```js
+var argv = require('yargs')
+  .usage('npm <command>')
+  .command('install', 'tis a mighty fine package to install')
+  .command('publish', 'shiver me timbers, should you be sharing all that', function (yargs, argv) {
+    argv = yargs.option('f', {
+      alias: 'force',
+      description: 'yar, it usually be a bad idea'
+    })
+    .help('help')
+    .argv
+  })
+  .help('help')
+  .argv;
+```
+
+.completion(cmd, [description], [fn]);
+-------------
+
+Enable bash-completion shortcuts for commands and options.
+
+`cmd`: When present in `argv._`, will result in the `.bashrc` completion script
+being outputted. To enable bash completions, concat the generated script to your
+`.bashrc` or `.bash_profile`.
+
+`description`: Provide a description in your usage instructions for the command
+that generates bash completion scripts.
+
+`fn`: Rather than relying on yargs' default completion functionality, which
+shiver me timbers is pretty awesome, you can provide your own completion
+method.
+
+```js
+var argv = require('yargs')
+  .completion('completion', function(current, argv) {
+    // 'current' is the current command being completed.
+    // 'argv' is the parsed arguments so far.
+    // simply return an array of completions.
+    return [
+      'foo',
+      'bar'
+    ];
+  })
+  .argv;
+```
+
+You can also provide asynchronous completions.
+
+```js
+var argv = require('yargs')
+  .completion('completion', function(current, argv, done) {
+    setTimeout(function() {
+      done([
+        'apple',
+        'banana'
+      ]);
+    }, 500);
+  })
+  .argv;
+```
+
+But wait, there's more! You can return an asynchronous promise.
+
+```js
+var argv = require('yargs')
+  .completion('completion', function(current, argv, done) {
+    return new Promise(function (resolve, reject) {
+      setTimeout(function () {
+        resolve(['apple', 'banana'])
+      }, 10)
+    })
+  })
+  .argv;
+```
+
+<a name="config"></a>.config(key, [description], [parseFn])
+------------
+
+Tells the parser that if the option specified by `key` is passed in, it
+should be interpreted as a path to a JSON config file. The file is loaded
+and parsed, and its properties are set as arguments.
+
+An optional `description` can be provided to customize the config (`key`) option
+in the usage string.
+
+An optional `parseFn` can be used to provide a custom parser. The parsing
+function must be synchronous, and should return an object containing
+key value pairs or an error.
+
+```js
+var argv = require('yargs')
+  .config('settings', function (configPath) {
+    return JSON.parse(fs.readFileSync(configPath, 'utf-8'))
+  })
+  .argv
+```
+
+<a name="count"></a>.count(key)
+------------
+
+Interpret `key` as a boolean flag, but set its parsed value to the number of
+flag occurrences rather than `true` or `false`. Default value is thus `0`.
+
+<a name="default"></a>.default(key, value, [description])
+--------------------
+
+Set `argv[key]` to `value` if no option was specified in `process.argv`.
+
+Optionally `.default()` can take an object that maps keys to default values.
+
+But wait, there's more! The default value can be a `function` which returns
+a value. The name of the function will be used in the usage string:
+
+```js
+var argv = require('yargs')
+  .default('random', function randomValue() {
+    return Math.random() * 256;
+  }).argv;
+```
+
+Optionally, `description` can also be provided and will take precedence over
+displaying the value in the usage instructions:
+
+```js
+.default('timeout', 60000, '(one-minute)')
+```
+
+<a name="demand"></a>.demand(key, [msg | boolean])
+------------------------------
+.demand(count, [max], [msg])
+------------------------------
+
+If `key` is a string, show the usage information and exit if `key` wasn't
+specified in `process.argv`.
+
+If `key` is a number, demand at least as many non-option arguments, which show
+up in `argv._`. A second number can also optionally be provided, which indicates
+the maximum number of non-option arguments.
+
+If `key` is an array, demand each element.
+
+If a `msg` string is given, it will be printed when the argument is missing,
+instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`.
+
+If a `boolean` value is given, it controls whether the option is demanded;
+this is useful when using `.options()` to specify command line parameters.
+
+<a name="describe"></a>.describe(key, desc)
+--------------------
+
+Describe a `key` for the generated usage information.
+
+Optionally `.describe()` can take an object that maps keys to descriptions.
+
+.detectLocale(boolean)
+-----------
+
+Should yargs attempt to detect the os' locale? Defaults to `true`.
+
+.env([prefix])
+--------------
+
+Tell yargs to parse environment variables matching the given prefix and apply
+them to argv as though they were command line arguments.
+
+If this method is called with no argument or with an empty string or with `true`,
+then all env vars will be applied to argv.
+
+Program arguments are defined in this order of precedence:
+
+1. Command line args
+2. Config file
+3. Env var
+4. Configured defaults
+
+```js
+var argv = require('yargs')
+  .env('MY_PROGRAM')
+  .option('f', {
+    alias: 'fruit-thing',
+    default: 'apple'
+  })
+  .argv
+console.log(argv)
+```
+
+```
+$ node fruity.js
+{ _: [],
+  f: 'apple',
+  'fruit-thing': 'apple',
+  fruitThing: 'apple',
+  '$0': 'fruity.js' }
+```
+
+```
+$ MY_PROGRAM_FRUIT_THING=banana node fruity.js
+{ _: [],
+  fruitThing: 'banana',
+  f: 'banana',
+  'fruit-thing': 'banana',
+  '$0': 'fruity.js' }
+```
+
+```
+$ MY_PROGRAM_FRUIT_THING=banana node fruity.js -f cat
+{ _: [],
+  f: 'cat',
+  'fruit-thing': 'cat',
+  fruitThing: 'cat',
+  '$0': 'fruity.js' }
+```
+
+Env var parsing is disabled by default, but you can also explicitly disable it
+by calling `.env(false)`, e.g. if you need to undo previous configuration.
+
+.epilog(str)
+------------
+.epilogue(str)
+--------------
+
+A message to print at the end of the usage instructions, e.g.
+
+```js
+var argv = require('yargs')
+  .epilogue('for more information, find our manual at http://example.com');
+```
+
+.example(cmd, desc)
+-------------------
+
+Give some example invocations of your program. Inside `cmd`, the string
+`$0` will get interpolated to the current script name or node command for the
+present script similar to how `$0` works in bash or perl.
+Examples will be printed out as part of the help message.
+
+.exitProcess(enable)
+----------------------------------
+
+By default, yargs exits the process when the user passes a help flag, uses the
+`.version` functionality, or when validation fails. Calling
+`.exitProcess(false)` disables this behavior, enabling further actions after
+yargs have been validated.
+
+.fail(fn)
+---------
+
+Method to execute when a failure occurs, rather than printing the failure message.
+
+`fn` is called with the failure message that would have been printed.
+
+<a name="group"></a>.group(key(s), groupName)
+--------------------
+
+Given a key, or an array of keys, places options under an alternative heading
+when displaying usage instructions, e.g.,
+
+```js
+var yargs = require('yargs')(['--help'])
+  .help('help')
+  .group('batman', 'Heroes:')
+  .describe('batman', "world's greatest detective")
+  .wrap(null)
+  .argv
+```
+***
+    Heroes:
+      --batman  world's greatest detective
+
+    Options:
+      --help  Show help  [boolean]
+
+.help([option, [description]])
+------------------------------
+
+Add an option (e.g. `--help`) that displays the usage string and exits the
+process. If present, the `description` parameter customizes the description of
+the help option in the usage string.
+
+If invoked without parameters, `.help()` returns the generated usage string.
+
+Example:
+
+```js
+var yargs = require("yargs")
+  .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
+console.log(yargs.help());
+```
+
+Later on, `argv` can be retrieved with `yargs.argv`.
+
+.implies(x, y)
+--------------
+
+Given the key `x` is set, it is required that the key `y` is set.
+
+Optionally `.implies()` can accept an object specifying multiple implications.
+
+.locale()
+---------
+
+Return the locale that yargs is currently using.
+
+By default, yargs will auto-detect the operating system's locale so that
+yargs-generated help content will display in the user's language.
+
+To override this behavior with a static locale, pass the desired locale as a
+string to this method (see below).
+
+.locale(locale)
+---------------
+
+Override the auto-detected locale from the user's operating system with a static
+locale. Note that the OS locale can be modified by setting/exporting the `LC_ALL`
+environment variable.
+
+```js
+var argv = require('yargs')
+  .usage('./$0 - follow ye instructions true')
+  .option('option', {
+    alias: 'o',
+    describe: "'tis a mighty fine option",
+    demand: true
+  })
+  .command('run', "Arrr, ya best be knowin' what yer doin'")
+  .example('$0 run foo', "shiver me timbers, here's an example for ye")
+  .help('help')
+  .wrap(70)
+  .locale('pirate')
+  .argv
+```
+
+***
+
+```shell
+./test.js - follow ye instructions true
+
+Choose yer command:
+  run  Arrr, ya best be knowin' what yer doin'
+
+Options for me hearties!
+  --option, -o  'tis a mighty fine option               [requi-yar-ed]
+  --help        Parlay this here code of conduct             [boolean]
+
+Ex. marks the spot:
+  test.js run foo  shiver me timbers, here's an example for ye
+
+Ye be havin' to set the followin' argument land lubber: option
+```
+
+Locales currently supported:
+
+* **de:** German.
+* **en:** American English.
+* **es:** Spanish.
+* **fr:** French.
+* **id:** Indonesian.
+* **ja:** Japanese.
+* **ko:** Korean.
+* **nb:** Norwegian Bokmål.
+* **pirate:** American Pirate.
+* **pt:** Portuguese.
+* **pt_BR:** Brazilian Portuguese.
+* **tr:** Turkish.
+* **zh:** Chinese.
+
+To submit a new translation for yargs:
+
+1. use `./locales/en.json` as a starting point.
+2. submit a pull request with the new locale file.
+
+*The [Microsoft Terminology Search](http://www.microsoft.com/Language/en-US/Search.aspx) can be useful for finding the correct terminology in your locale.*
+
+<a name="nargs"></a>.nargs(key, count)
+-----------
+
+The number of arguments that should be consumed after a key. This can be a
+useful hint to prevent parsing ambiguity. For example:
+
+```js
+var argv = require('yargs')
+  .nargs('token', 1)
+  .parse(['--token', '-my-token']);
+```
+
+parses as:
+
+`{ _: [], token: '-my-token', '$0': 'node test' }`
+
+Optionally `.nargs()` can take an object of `key`/`narg` pairs.
+
+.option(key, opt)
+-----------------
+.options(key, opt)
+------------------
+
+Instead of chaining together `.alias().demand().default().describe().string()`, you can specify
+keys in `opt` for each of the chainable methods.
+
+For example:
+
+````javascript
+var argv = require('yargs')
+    .option('f', {
+        alias: 'file',
+        demand: true,
+        default: '/etc/passwd',
+        describe: 'x marks the spot',
+        type: 'string'
+    })
+    .argv
+;
+````
+
+is the same as
+
+````javascript
+var argv = require('yargs')
+    .alias('f', 'file')
+    .demand('f')
+    .default('f', '/etc/passwd')
+    .describe('f', 'x marks the spot')
+    .string('f')
+    .argv
+;
+````
+
+Optionally `.options()` can take an object that maps keys to `opt` parameters.
+
+````javascript
+var argv = require('yargs')
+    .options({
+      'f': {
+        alias: 'file',
+        demand: true,
+        default: '/etc/passwd',
+        describe: 'x marks the spot',
+        type: 'string'
+      }
+    })
+    .argv
+;
+````
+
+Valid `opt` keys include:
+
+- `alias`: string or array of strings, alias(es) for the canonical option key, see [`alias()`](#alias)
+- `array`: boolean, interpret option as an array, see [`array()`](#array)
+- `boolean`: boolean, interpret option as a boolean flag, see [`boolean()`](#boolean)
+- `choices`: value or array of values, limit valid option arguments to a predefined set, see [`choices()`](#choices)
+- `config`: boolean, interpret option as a path to a JSON config file, see [`config()`](#config)
+- `configParser`: function, provide a custom config parsing function, see [`config()`](#config)
+- `count`: boolean, interpret option as a count of boolean flags, see [`count()`](#count)
+- `default`: value, set a default value for the option, see [`default()`](#default)
+- `defaultDescription`: string, use this description for the default value in help content, see [`default()`](#default)
+- `demand`/`require`/`required`: boolean or string, demand the option be given, with optional error message, see [`demand()`](#demand)
+- `desc`/`describe`/`description`: string, the option description for help content, see [`describe()`](#describe)
+- `group`: string, when displaying usage instructions place the option under an alternative group heading, see [`group()`](#group)
+- `nargs`: number, specify how many arguments should be consumed for the option, see [`nargs()`](#nargs)
+- `requiresArg`: boolean, require the option be specified with a value, see [`requiresArg()`](#requiresArg)
+- `string`: boolean, interpret option as a string, see [`string()`](#string)
+- `type`: one of the following strings
+    - `'array'`: synonymous for `array: true`, see [`array()`](#array)
+    - `'boolean'`: synonymous for `boolean: true`, see [`boolean()`](#boolean)
+    - `'count'`: synonymous for `count: true`, see [`count()`](#count)
+    - `'string'`: synonymous for `string: true`, see [`string()`](#string)
+
+.parse(args)
+------------
+
+Parse `args` instead of `process.argv`. Returns the `argv` object.
+
+`args` may either be a pre-processed argv array, or a raw argument string.
+
+.require(key, [msg | boolean])
+------------------------------
+.required(key, [msg | boolean])
+------------------------------
+
+An alias for [`demand()`](#demand). See docs there.
+
+<a name="requiresArg"></a>.requiresArg(key)
+-----------------
+
+Specifies either a single option key (string), or an array of options that
+must be followed by option values. If any option value is missing, show the
+usage information and exit.
+
+The default behavior is to set the value of any key not followed by an
+option value to `true`.
+
+.reset()
+--------
+
+Reset the argument object built up so far. This is useful for
+creating nested command line interfaces.
+
+```js
+var yargs = require('yargs')
+  .usage('$0 command')
+  .command('hello', 'hello command')
+  .command('world', 'world command')
+  .demand(1, 'must provide a valid command'),
+  argv = yargs.argv,
+  command = argv._[0];
+
+if (command === 'hello') {
+  yargs.reset()
+    .usage('$0 hello')
+    .help('h')
+    .example('$0 hello', 'print the hello message!')
+    .argv
+
+  console.log('hello!');
+} else if (command === 'world'){
+  yargs.reset()
+    .usage('$0 world')
+    .help('h')
+    .example('$0 world', 'print the world message!')
+    .argv
+
+  console.log('world!');
+} else {
+  yargs.showHelp();
+}
+```
+
+.showCompletionScript()
+----------------------
+
+Generate a bash completion script. Users of your application can install this
+script in their `.bashrc`, and yargs will provide completion shortcuts for
+commands and options.
+
+.showHelp(consoleLevel='error')
+---------------------------
+
+Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing.
+
+Example:
+
+```js
+var yargs = require("yargs")
+  .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
+yargs.showHelp(); //prints to stderr using console.error()
+```
+
+Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`:
+
+```js
+yargs.showHelp("log"); //prints to stdout using console.log()
+```
+
+Later on, `argv` can be retrieved with `yargs.argv`.
+
+.showHelpOnFail(enable, [message])
+----------------------------------
+
+By default, yargs outputs a usage string if any error is detected. Use the
+`.showHelpOnFail()` method to customize this behavior. If `enable` is `false`,
+the usage string is not output. If the `message` parameter is present, this
+message is output after the error message.
+
+line_count.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Count the lines in a file.\nUsage: $0 -f <file>')
+    .demand('f')
+    .alias('f', 'file')
+    .describe('f', 'Load a file')
+    .string('f')
+    .showHelpOnFail(false, 'Specify --help for available options')
+    .help('help')
+    .argv;
+
+// etc.
+````
+
+***
+
+```
+$ node line_count.js
+Missing argument value: f
+
+Specify --help for available options
+```
+
+.strict()
+---------
+
+Any command-line argument given that is not demanded, or does not have a
+corresponding description, will be reported as an error.
+
+<a name="string"></a>.string(key)
+------------
+
+Tell the parser logic not to interpret `key` as a number or boolean.
+This can be useful if you need to preserve leading zeros in an input.
+
+If `key` is an array, interpret all the elements as strings.
+
+`.string('_')` will result in non-hyphenated arguments being interpreted as strings,
+regardless of whether they resemble numbers.
+
+.updateLocale(obj)
+------------------
+.updateStrings(obj)
+------------------
+
+Override the default strings used by yargs with the key/value
+pairs provided in `obj`:
+
+```js
+var argv = require('yargs')
+  .command('run', 'the run command')
+  .help('help')
+  .updateStrings({
+    'Commands:': 'My Commands -->\n'
+  })
+  .wrap(null)
+  .argv
+```
+
+***
+
+```shell
+My Commands -->
+
+  run  the run command
+
+Options:
+  --help  Show help  [boolean]
+```
+
+If you explicitly specify a `locale()`, you should do so *before* calling
+`updateStrings()`.
+
+.usage(message, [opts])
+---------------------
+
+Set a usage message to show which commands to use. Inside `message`, the string
+`$0` will get interpolated to the current script name or node command for the
+present script similar to how `$0` works in bash or perl.
+
+`opts` is optional and acts like calling `.options(opts)`.
+
+.version(version, [option], [description])
+----------------------------------------
+
+Add an option (e.g. `--version`) that displays the version number (given by the
+`version` parameter) and exits the process. If present, the `description`
+parameter customizes the description of the version option in the usage string.
+
+You can provide a `function` for version, rather than a string.
+This is useful if you want to use the version from your package.json:
+
+```js
+var argv = require('yargs')
+  .version(function() {
+    return require('../package').version;
+  })
+  .argv;
+```
+
+.wrap(columns)
+--------------
+
+Format usage output to wrap at `columns` many columns.
+
+By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to
+specify no column limit (no right-align). Use `.wrap(yargs.terminalWidth())` to
+maximize the width of yargs' usage instructions.
+
+parsing tricks
+==============
+
+stop parsing
+------------
+
+Use `--` to stop parsing flags and stuff the remainder into `argv._`.
+
+    $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4
+    { _: [ '-c', '3', '-d', '4' ],
+      a: 1,
+      b: 2,
+      '$0': 'examples/reflect.js' }
+
+negate fields
+-------------
+
+If you want to explicitly set a field to false instead of just leaving it
+undefined or to override a default you can do `--no-key`.
+
+    $ node examples/reflect.js -a --no-b
+    { _: [], a: true, b: false, '$0': 'examples/reflect.js' }
+
+numbers
+-------
+
+Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to
+one. This way you can just `net.createConnection(argv.port)` and you can add
+numbers out of `argv` with `+` without having that mean concatenation,
+which is super frustrating.
+
+duplicates
+----------
+
+If you specify a flag multiple times it will get turned into an array containing
+all the values in order.
+
+    $ node examples/reflect.js -x 5 -x 8 -x 0
+    { _: [], x: [ 5, 8, 0 ], '$0': 'examples/reflect.js' }
+
+dot notation
+------------
+
+When you use dots (`.`s) in argument names, an implicit object path is assumed.
+This lets you organize arguments into nested objects.
+
+    $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5
+    { _: [],
+      foo: { bar: { baz: 33 }, quux: 5 },
+      '$0': 'examples/reflect.js' }
+
+short numbers
+-------------
+
+Short numeric `-n5` style arguments work too:
+
+    $ node examples/reflect.js -n123 -m456
+    { _: [], n: 123, m: 456, '$0': 'examples/reflect.js' }
+
+installation
+============
+
+With [npm](https://github.com/npm/npm), just do:
+
+    npm install yargs
+
+or clone this project on github:
+
+    git clone http://github.com/bcoe/yargs.git
+
+To run the tests with npm, just do:
+
+    npm test
+
+inspired by
+===========
+
+This module is loosely inspired by Perl's
+[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm).
+
+
+
+[travis-url]: https://travis-ci.org/bcoe/yargs
+[travis-image]: https://img.shields.io/travis/bcoe/yargs.svg
+[gemnasium-url]: https://gemnasium.com/bcoe/yargs
+[gemnasium-image]: https://img.shields.io/gemnasium/bcoe/yargs.svg
+[coveralls-url]: https://coveralls.io/github/bcoe/yargs
+[coveralls-image]: https://img.shields.io/coveralls/bcoe/yargs.svg
+[npm-url]: https://www.npmjs.com/package/yargs
+[npm-image]: https://img.shields.io/npm/v/yargs.svg
+[windows-url]: https://ci.appveyor.com/project/bcoe/yargs
+[windows-image]: https://img.shields.io/appveyor/ci/bcoe/yargs/master.svg?label=Windows%20Tests
diff --git a/legacy-libs/grpc/node_modules/yargs/completion.sh.hbs b/legacy-libs/grpc/node_modules/yargs/completion.sh.hbs
new file mode 100644 (file)
index 0000000..8392ad5
--- /dev/null
@@ -0,0 +1,28 @@
+###-begin-{{app_name}}-completions-###
+#
+# yargs command completion script
+#
+# Installation: {{app_path}} completion >> ~/.bashrc
+#    or {{app_path}} completion >> ~/.bash_profile on OSX.
+#
+_yargs_completions()
+{
+    local cur_word args type_list
+
+    cur_word="${COMP_WORDS[COMP_CWORD]}"
+    args=$(printf "%s " "${COMP_WORDS[@]}")
+
+    # ask yargs to generate completions.
+    type_list=`{{app_path}} --get-yargs-completions $args`
+
+    COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )
+
+    # if no match was found, fall back to filename completion
+    if [ ${#COMPREPLY[@]} -eq 0 ]; then
+      COMPREPLY=( $(compgen -f -- "${cur_word}" ) )
+    fi
+
+    return 0
+}
+complete -F _yargs_completions {{app_name}}
+###-end-{{app_name}}-completions-###
diff --git a/legacy-libs/grpc/node_modules/yargs/index.js b/legacy-libs/grpc/node_modules/yargs/index.js
new file mode 100644 (file)
index 0000000..7b6a343
--- /dev/null
@@ -0,0 +1,665 @@
+var assert = require('assert')
+var Completion = require('./lib/completion')
+var Parser = require('./lib/parser')
+var path = require('path')
+var tokenizeArgString = require('./lib/tokenize-arg-string')
+var Usage = require('./lib/usage')
+var Validation = require('./lib/validation')
+var Y18n = require('y18n')
+
+Argv(process.argv.slice(2))
+
+var exports = module.exports = Argv
+function Argv (processArgs, cwd) {
+  processArgs = processArgs || [] // handle calling yargs().
+
+  var self = {}
+  var completion = null
+  var usage = null
+  var validation = null
+  var y18n = Y18n({
+    directory: path.resolve(__dirname, './locales'),
+    updateFiles: false
+  })
+
+  if (!cwd) cwd = process.cwd()
+
+  self.$0 = process.argv
+    .slice(0, 2)
+    .map(function (x, i) {
+      // ignore the node bin, specify this in your
+      // bin file with #!/usr/bin/env node
+      if (i === 0 && /\b(node|iojs)$/.test(x)) return
+      var b = rebase(cwd, x)
+      return x.match(/^\//) && b.length < x.length ? b : x
+    })
+    .join(' ').trim()
+
+  if (process.env._ !== undefined && process.argv[1] === process.env._) {
+    self.$0 = process.env._.replace(
+      path.dirname(process.execPath) + '/', ''
+    )
+  }
+
+  var options
+  self.resetOptions = self.reset = function () {
+    // put yargs back into its initial
+    // state, this is useful for creating a
+    // nested CLI.
+    options = {
+      array: [],
+      boolean: [],
+      string: [],
+      narg: {},
+      key: {},
+      alias: {},
+      default: {},
+      defaultDescription: {},
+      choices: {},
+      requiresArg: [],
+      count: [],
+      normalize: [],
+      config: {},
+      envPrefix: undefined
+    }
+
+    usage = Usage(self, y18n) // handle usage output.
+    validation = Validation(self, usage, y18n) // handle arg validation.
+    completion = Completion(self, usage)
+
+    demanded = {}
+    groups = {}
+
+    exitProcess = true
+    strict = false
+    helpOpt = null
+    versionOpt = null
+    commandHandlers = {}
+    self.parsed = false
+
+    return self
+  }
+  self.resetOptions()
+
+  self.boolean = function (bools) {
+    options.boolean.push.apply(options.boolean, [].concat(bools))
+    return self
+  }
+
+  self.array = function (arrays) {
+    options.array.push.apply(options.array, [].concat(arrays))
+    return self
+  }
+
+  self.nargs = function (key, n) {
+    if (typeof key === 'object') {
+      Object.keys(key).forEach(function (k) {
+        self.nargs(k, key[k])
+      })
+    } else {
+      options.narg[key] = n
+    }
+    return self
+  }
+
+  self.choices = function (key, values) {
+    if (typeof key === 'object') {
+      Object.keys(key).forEach(function (k) {
+        self.choices(k, key[k])
+      })
+    } else {
+      options.choices[key] = (options.choices[key] || []).concat(values)
+    }
+    return self
+  }
+
+  self.normalize = function (strings) {
+    options.normalize.push.apply(options.normalize, [].concat(strings))
+    return self
+  }
+
+  self.config = function (key, msg, parseFn) {
+    if (typeof msg === 'function') {
+      parseFn = msg
+      msg = null
+    }
+    self.describe(key, msg || usage.deferY18nLookup('Path to JSON config file'))
+    ;(Array.isArray(key) ? key : [key]).forEach(function (k) {
+      options.config[k] = parseFn || true
+    })
+    return self
+  }
+
+  self.example = function (cmd, description) {
+    usage.example(cmd, description)
+    return self
+  }
+
+  self.command = function (cmd, description, fn) {
+    if (description !== false) {
+      usage.command(cmd, description)
+    }
+    if (fn) commandHandlers[cmd] = fn
+    return self
+  }
+
+  var commandHandlers = {}
+  self.getCommandHandlers = function () {
+    return commandHandlers
+  }
+
+  self.string = function (strings) {
+    options.string.push.apply(options.string, [].concat(strings))
+    return self
+  }
+
+  self.default = function (key, value, defaultDescription) {
+    if (typeof key === 'object') {
+      Object.keys(key).forEach(function (k) {
+        self.default(k, key[k])
+      })
+    } else {
+      if (defaultDescription) options.defaultDescription[key] = defaultDescription
+      if (typeof value === 'function') {
+        if (!options.defaultDescription[key]) options.defaultDescription[key] = usage.functionDescription(value)
+        value = value.call()
+      }
+      options.default[key] = value
+    }
+    return self
+  }
+
+  self.alias = function (x, y) {
+    if (typeof x === 'object') {
+      Object.keys(x).forEach(function (key) {
+        self.alias(key, x[key])
+      })
+    } else {
+      // perhaps 'x' is already an alias in another list?
+      // if so we should append to x's list.
+      var aliases = null
+      Object.keys(options.alias).forEach(function (key) {
+        if (~options.alias[key].indexOf(x)) aliases = options.alias[key]
+      })
+
+      if (aliases) { // x was an alias itself.
+        aliases.push(y)
+      } else { // x is a new alias key.
+        options.alias[x] = (options.alias[x] || []).concat(y)
+      }
+
+      // wait! perhaps we've created two lists of aliases
+      // that reference each other?
+      if (options.alias[y]) {
+        Array.prototype.push.apply((options.alias[x] || aliases), options.alias[y])
+        delete options.alias[y]
+      }
+    }
+    return self
+  }
+
+  self.count = function (counts) {
+    options.count.push.apply(options.count, [].concat(counts))
+    return self
+  }
+
+  var demanded = {}
+  self.demand = self.required = self.require = function (keys, max, msg) {
+    // you can optionally provide a 'max' key,
+    // which will raise an exception if too many '_'
+    // options are provided.
+    if (typeof max !== 'number') {
+      msg = max
+      max = Infinity
+    }
+
+    if (typeof keys === 'number') {
+      if (!demanded._) demanded._ = { count: 0, msg: null, max: max }
+      demanded._.count = keys
+      demanded._.msg = msg
+    } else if (Array.isArray(keys)) {
+      keys.forEach(function (key) {
+        self.demand(key, msg)
+      })
+    } else {
+      if (typeof msg === 'string') {
+        demanded[keys] = { msg: msg }
+      } else if (msg === true || typeof msg === 'undefined') {
+        demanded[keys] = { msg: undefined }
+      }
+    }
+
+    return self
+  }
+  self.getDemanded = function () {
+    return demanded
+  }
+
+  self.requiresArg = function (requiresArgs) {
+    options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs))
+    return self
+  }
+
+  self.implies = function (key, value) {
+    validation.implies(key, value)
+    return self
+  }
+
+  self.usage = function (msg, opts) {
+    if (!opts && typeof msg === 'object') {
+      opts = msg
+      msg = null
+    }
+
+    usage.usage(msg)
+
+    if (opts) self.options(opts)
+
+    return self
+  }
+
+  self.epilogue = self.epilog = function (msg) {
+    usage.epilog(msg)
+    return self
+  }
+
+  self.fail = function (f) {
+    usage.failFn(f)
+    return self
+  }
+
+  self.check = function (f) {
+    validation.check(f)
+    return self
+  }
+
+  self.defaults = self.default
+
+  self.describe = function (key, desc) {
+    options.key[key] = true
+    usage.describe(key, desc)
+    return self
+  }
+
+  self.parse = function (args) {
+    return parseArgs(args)
+  }
+
+  self.option = self.options = function (key, opt) {
+    if (typeof key === 'object') {
+      Object.keys(key).forEach(function (k) {
+        self.options(k, key[k])
+      })
+    } else {
+      assert(typeof opt === 'object', 'second argument to option must be an object')
+
+      options.key[key] = true // track manually set keys.
+
+      if (opt.alias) self.alias(key, opt.alias)
+
+      var demand = opt.demand || opt.required || opt.require
+
+      if (demand) {
+        self.demand(key, demand)
+      } if ('config' in opt) {
+        self.config(key, opt.configParser)
+      } if ('default' in opt) {
+        self.default(key, opt.default)
+      } if ('nargs' in opt) {
+        self.nargs(key, opt.nargs)
+      } if ('choices' in opt) {
+        self.choices(key, opt.choices)
+      } if ('group' in opt) {
+        self.group(key, opt.group)
+      } if (opt.boolean || opt.type === 'boolean') {
+        self.boolean(key)
+        if (opt.alias) self.boolean(opt.alias)
+      } if (opt.array || opt.type === 'array') {
+        self.array(key)
+        if (opt.alias) self.array(opt.alias)
+      } if (opt.string || opt.type === 'string') {
+        self.string(key)
+        if (opt.alias) self.string(opt.alias)
+      } if (opt.count || opt.type === 'count') {
+        self.count(key)
+      } if (opt.defaultDescription) {
+        options.defaultDescription[key] = opt.defaultDescription
+      }
+
+      var desc = opt.describe || opt.description || opt.desc
+      if (desc) {
+        self.describe(key, desc)
+      }
+
+      if (opt.requiresArg) {
+        self.requiresArg(key)
+      }
+    }
+
+    return self
+  }
+  self.getOptions = function () {
+    return options
+  }
+
+  var groups = {}
+  self.group = function (opts, groupName) {
+    var seen = {}
+    groups[groupName] = (groups[groupName] || []).concat(opts).filter(function (key) {
+      if (seen[key]) return false
+      return (seen[key] = true)
+    })
+    return self
+  }
+  self.getGroups = function () {
+    return groups
+  }
+
+  // as long as options.envPrefix is not undefined,
+  // parser will apply env vars matching prefix to argv
+  self.env = function (prefix) {
+    if (prefix === false) options.envPrefix = undefined
+    else options.envPrefix = prefix || ''
+    return self
+  }
+
+  self.wrap = function (cols) {
+    usage.wrap(cols)
+    return self
+  }
+
+  var strict = false
+  self.strict = function () {
+    strict = true
+    return self
+  }
+  self.getStrict = function () {
+    return strict
+  }
+
+  self.showHelp = function (level) {
+    if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
+    usage.showHelp(level)
+    return self
+  }
+
+  var versionOpt = null
+  self.version = function (ver, opt, msg) {
+    versionOpt = opt || 'version'
+    usage.version(ver)
+    self.boolean(versionOpt)
+    self.describe(versionOpt, msg || usage.deferY18nLookup('Show version number'))
+    return self
+  }
+
+  var helpOpt = null
+  self.addHelpOpt = function (opt, msg) {
+    helpOpt = opt
+    self.boolean(opt)
+    self.describe(opt, msg || usage.deferY18nLookup('Show help'))
+    return self
+  }
+
+  self.showHelpOnFail = function (enabled, message) {
+    usage.showHelpOnFail(enabled, message)
+    return self
+  }
+
+  var exitProcess = true
+  self.exitProcess = function (enabled) {
+    if (typeof enabled !== 'boolean') {
+      enabled = true
+    }
+    exitProcess = enabled
+    return self
+  }
+  self.getExitProcess = function () {
+    return exitProcess
+  }
+
+  self.help = function () {
+    if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments)
+
+    if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
+
+    return usage.help()
+  }
+
+  var completionCommand = null
+  self.completion = function (cmd, desc, fn) {
+    // a function to execute when generating
+    // completions can be provided as the second
+    // or third argument to completion.
+    if (typeof desc === 'function') {
+      fn = desc
+      desc = null
+    }
+
+    // register the completion command.
+    completionCommand = cmd || 'completion'
+    if (!desc && desc !== false) {
+      desc = 'generate bash completion script'
+    }
+    self.command(completionCommand, desc)
+
+    // a function can be provided
+    if (fn) completion.registerFunction(fn)
+
+    return self
+  }
+
+  self.showCompletionScript = function ($0) {
+    $0 = $0 || self.$0
+    console.log(completion.generateCompletionScript($0))
+    return self
+  }
+
+  self.locale = function (locale) {
+    if (arguments.length === 0) {
+      guessLocale()
+      return y18n.getLocale()
+    }
+    detectLocale = false
+    y18n.setLocale(locale)
+    return self
+  }
+
+  self.updateStrings = self.updateLocale = function (obj) {
+    detectLocale = false
+    y18n.updateLocale(obj)
+    return self
+  }
+
+  var detectLocale = true
+  self.detectLocale = function (detect) {
+    detectLocale = detect
+    return self
+  }
+  self.getDetectLocale = function () {
+    return detectLocale
+  }
+
+  self.getUsageInstance = function () {
+    return usage
+  }
+
+  self.getValidationInstance = function () {
+    return validation
+  }
+
+  self.terminalWidth = function () {
+    return require('window-size').width
+  }
+
+  Object.defineProperty(self, 'argv', {
+    get: function () {
+      var args = null
+
+      try {
+        args = parseArgs(processArgs)
+      } catch (err) {
+        usage.fail(err.message)
+      }
+
+      return args
+    },
+    enumerable: true
+  })
+
+  function parseArgs (args) {
+    args = normalizeArgs(args)
+
+    var parsed = Parser(args, options, y18n)
+    var argv = parsed.argv
+    var aliases = parsed.aliases
+
+    argv.$0 = self.$0
+
+    self.parsed = parsed
+
+    guessLocale() // guess locale lazily, so that it can be turned off in chain.
+
+    // while building up the argv object, there
+    // are two passes through the parser. If completion
+    // is being performed short-circuit on the first pass.
+    if (completionCommand &&
+      (process.argv.join(' ')).indexOf(completion.completionKey) !== -1 &&
+      !argv[completion.completionKey]) {
+      return argv
+    }
+
+    // if there's a handler associated with a
+    // command defer processing to it.
+    var handlerKeys = Object.keys(self.getCommandHandlers())
+    for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) {
+      if (~argv._.indexOf(command)) {
+        runCommand(command, self, argv)
+        return self.argv
+      }
+    }
+
+    // generate a completion script for adding to ~/.bashrc.
+    if (completionCommand && ~argv._.indexOf(completionCommand) && !argv[completion.completionKey]) {
+      self.showCompletionScript()
+      if (exitProcess) {
+        process.exit(0)
+      }
+    }
+
+    // we must run completions first, a user might
+    // want to complete the --help or --version option.
+    if (completion.completionKey in argv) {
+      // we allow for asynchronous completions,
+      // e.g., loading in a list of commands from an API.
+      completion.getCompletion(function (completions) {
+        ;(completions || []).forEach(function (completion) {
+          console.log(completion)
+        })
+
+        if (exitProcess) {
+          process.exit(0)
+        }
+      })
+      return
+    }
+
+    var helpOrVersion = false
+    Object.keys(argv).forEach(function (key) {
+      if (key === helpOpt && argv[key]) {
+        helpOrVersion = true
+        self.showHelp('log')
+        if (exitProcess) {
+          process.exit(0)
+        }
+      } else if (key === versionOpt && argv[key]) {
+        helpOrVersion = true
+        usage.showVersion()
+        if (exitProcess) {
+          process.exit(0)
+        }
+      }
+    })
+
+    // If the help or version options where used and exitProcess is false,
+    // we won't run validations
+    if (!helpOrVersion) {
+      if (parsed.error) throw parsed.error
+
+      // if we're executed via bash completion, don't
+      // bother with validation.
+      if (!argv[completion.completionKey]) {
+        validation.nonOptionCount(argv)
+        validation.missingArgumentValue(argv)
+        validation.requiredArguments(argv)
+        if (strict) validation.unknownArguments(argv, aliases)
+        validation.customChecks(argv, aliases)
+        validation.limitedChoices(argv)
+        validation.implications(argv)
+      }
+    }
+
+    setPlaceholderKeys(argv)
+
+    return argv
+  }
+
+  function guessLocale () {
+    if (!detectLocale) return
+
+    try {
+      var osLocale = require('os-locale')
+      self.locale(osLocale.sync({ spawn: false }))
+    } catch (err) {
+      // if we explode looking up locale just noop
+      // we'll keep using the default language 'en'.
+    }
+  }
+
+  function runCommand (command, yargs, argv) {
+    setPlaceholderKeys(argv)
+    yargs.getCommandHandlers()[command](yargs.reset(), argv)
+  }
+
+  function setPlaceholderKeys (argv) {
+    Object.keys(options.key).forEach(function (key) {
+      // don't set placeholder keys for dot
+      // notation options 'foo.bar'.
+      if (~key.indexOf('.')) return
+      if (typeof argv[key] === 'undefined') argv[key] = undefined
+    })
+  }
+
+  function normalizeArgs (args) {
+    if (typeof args === 'string') {
+      return tokenizeArgString(args)
+    }
+    return args
+  }
+
+  singletonify(self)
+  return self
+}
+
+// rebase an absolute path to a relative one with respect to a base directory
+// exported for tests
+exports.rebase = rebase
+function rebase (base, dir) {
+  return path.relative(base, dir)
+}
+
+/*  Hack an instance of Argv with process.argv into Argv
+    so people can do
+    require('yargs')(['--beeble=1','-z','zizzle']).argv
+    to parse a list of args and
+    require('yargs').argv
+    to get a parsed version of process.argv.
+*/
+function singletonify (inst) {
+  Object.keys(inst).forEach(function (key) {
+    if (key === 'argv') {
+      Argv.__defineGetter__(key, inst.__lookupGetter__(key))
+    } else {
+      Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
+    }
+  })
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/lib/completion.js b/legacy-libs/grpc/node_modules/yargs/lib/completion.js
new file mode 100644 (file)
index 0000000..576012f
--- /dev/null
@@ -0,0 +1,91 @@
+var fs = require('fs')
+var path = require('path')
+
+// add bash completions to your
+//  yargs-powered applications.
+module.exports = function (yargs, usage) {
+  var self = {
+    completionKey: 'get-yargs-completions'
+  }
+
+  // get a list of completion commands.
+  self.getCompletion = function (done) {
+    var completions = []
+    var current = process.argv[process.argv.length - 1]
+    var previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1)
+    var argv = yargs.parse(previous)
+
+    // a custom completion function can be provided
+    // to completion().
+    if (completionFunction) {
+      if (completionFunction.length < 3) {
+        var result = completionFunction(current, argv)
+
+        // promise based completion function.
+        if (typeof result.then === 'function') {
+          return result.then(function (list) {
+            process.nextTick(function () { done(list) })
+          }).catch(function (err) {
+            process.nextTick(function () { throw err })
+          })
+        }
+
+        // synchronous completion function.
+        return done(result)
+      } else {
+        // asynchronous completion function
+        return completionFunction(current, argv, function (completions) {
+          done(completions)
+        })
+      }
+    }
+
+    var handlers = yargs.getCommandHandlers()
+    for (var i = 0, ii = previous.length; i < ii; ++i) {
+      if (handlers[previous[i]]) {
+        return handlers[previous[i]](yargs.reset())
+      }
+    }
+
+    if (!current.match(/^-/)) {
+      usage.getCommands().forEach(function (command) {
+        if (previous.indexOf(command[0]) === -1) {
+          completions.push(command[0])
+        }
+      })
+    }
+
+    if (current.match(/^-/)) {
+      Object.keys(yargs.getOptions().key).forEach(function (key) {
+        completions.push('--' + key)
+      })
+    }
+
+    done(completions)
+  }
+
+  // generate the completion script to add to your .bashrc.
+  self.generateCompletionScript = function ($0) {
+    var script = fs.readFileSync(
+      path.resolve(__dirname, '../completion.sh.hbs'),
+      'utf-8'
+    )
+    var name = path.basename($0)
+
+    // add ./to applications not yet installed as bin.
+    if ($0.match(/\.js$/)) $0 = './' + $0
+
+    script = script.replace(/{{app_name}}/g, name)
+    return script.replace(/{{app_path}}/g, $0)
+  }
+
+  // register a function to perform your own custom
+  // completions., this function can be either
+  // synchrnous or asynchronous.
+  var completionFunction = null
+  self.registerFunction = function (fn) {
+    completionFunction = fn
+  }
+
+  return self
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/lib/parser.js b/legacy-libs/grpc/node_modules/yargs/lib/parser.js
new file mode 100644 (file)
index 0000000..f5f68e9
--- /dev/null
@@ -0,0 +1,520 @@
+// fancy-pants parsing of argv, originally forked
+// from minimist: https://www.npmjs.com/package/minimist
+var camelCase = require('camelcase')
+var path = require('path')
+
+function increment (orig) {
+  return orig !== undefined ? orig + 1 : 0
+}
+
+module.exports = function (args, opts, y18n) {
+  if (!opts) opts = {}
+
+  var __ = y18n.__
+  var error = null
+  var flags = { arrays: {}, bools: {}, strings: {}, counts: {}, normalize: {}, configs: {}, defaulted: {} }
+
+  ;[].concat(opts['array']).filter(Boolean).forEach(function (key) {
+    flags.arrays[key] = true
+  })
+
+  ;[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
+    flags.bools[key] = true
+  })
+
+  ;[].concat(opts.string).filter(Boolean).forEach(function (key) {
+    flags.strings[key] = true
+  })
+
+  ;[].concat(opts.count).filter(Boolean).forEach(function (key) {
+    flags.counts[key] = true
+  })
+
+  ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) {
+    flags.normalize[key] = true
+  })
+
+  Object.keys(opts.config).forEach(function (k) {
+    flags.configs[k] = opts.config[k]
+  })
+
+  var aliases = {}
+  var newAliases = {}
+
+  extendAliases(opts.key)
+  extendAliases(opts.alias)
+  extendAliases(opts.default)
+
+  var defaults = opts['default'] || {}
+  Object.keys(defaults).forEach(function (key) {
+    if (/-/.test(key) && !opts.alias[key]) {
+      aliases[key] = aliases[key] || []
+    }
+    (aliases[key] || []).forEach(function (alias) {
+      defaults[alias] = defaults[key]
+    })
+  })
+
+  var argv = { _: [] }
+
+  Object.keys(flags.bools).forEach(function (key) {
+    setArg(key, !(key in defaults) ? false : defaults[key])
+    setDefaulted(key)
+  })
+
+  var notFlags = []
+  if (args.indexOf('--') !== -1) {
+    notFlags = args.slice(args.indexOf('--') + 1)
+    args = args.slice(0, args.indexOf('--'))
+  }
+
+  for (var i = 0; i < args.length; i++) {
+    var arg = args[i]
+    var broken
+    var key
+    var letters
+    var m
+    var next
+    var value
+
+    // -- seperated by =
+    if (arg.match(/^--.+=/)) {
+      // Using [\s\S] instead of . because js doesn't support the
+      // 'dotall' regex modifier. See:
+      // http://stackoverflow.com/a/1068308/13216
+      m = arg.match(/^--([^=]+)=([\s\S]*)$/)
+
+      // nargs format = '--f=monkey washing cat'
+      if (checkAllAliases(m[1], opts.narg)) {
+        args.splice(i + 1, m[1], m[2])
+        i = eatNargs(i, m[1], args)
+      // arrays format = '--f=a b c'
+      } else if (checkAllAliases(m[1], flags.arrays) && args.length > i + 1) {
+        args.splice(i + 1, m[1], m[2])
+        i = eatArray(i, m[1], args)
+      } else {
+        setArg(m[1], m[2])
+      }
+    } else if (arg.match(/^--no-.+/)) {
+      key = arg.match(/^--no-(.+)/)[1]
+      setArg(key, false)
+
+    // -- seperated by space.
+    } else if (arg.match(/^--.+/)) {
+      key = arg.match(/^--(.+)/)[1]
+
+      // nargs format = '--foo a b c'
+      if (checkAllAliases(key, opts.narg)) {
+        i = eatNargs(i, key, args)
+      // array format = '--foo a b c'
+      } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
+        i = eatArray(i, key, args)
+      } else {
+        next = args[i + 1]
+
+        if (next !== undefined && !next.match(/^-/) &&
+          !checkAllAliases(key, flags.bools) &&
+          !checkAllAliases(key, flags.counts)) {
+          setArg(key, next)
+          i++
+        } else if (/^(true|false)$/.test(next)) {
+          setArg(key, next)
+          i++
+        } else {
+          setArg(key, defaultForType(guessType(key, flags)))
+        }
+      }
+
+    // dot-notation flag seperated by '='.
+    } else if (arg.match(/^-.\..+=/)) {
+      m = arg.match(/^-([^=]+)=([\s\S]*)$/)
+      setArg(m[1], m[2])
+
+    // dot-notation flag seperated by space.
+    } else if (arg.match(/^-.\..+/)) {
+      next = args[i + 1]
+      key = arg.match(/^-(.\..+)/)[1]
+
+      if (next !== undefined && !next.match(/^-/) &&
+        !checkAllAliases(key, flags.bools) &&
+        !checkAllAliases(key, flags.counts)) {
+        setArg(key, next)
+        i++
+      } else {
+        setArg(key, defaultForType(guessType(key, flags)))
+      }
+    } else if (arg.match(/^-[^-]+/)) {
+      letters = arg.slice(1, -1).split('')
+      broken = false
+
+      for (var j = 0; j < letters.length; j++) {
+        next = arg.slice(j + 2)
+
+        if (letters[j + 1] && letters[j + 1] === '=') {
+          value = arg.slice(j + 3)
+          key = letters[j]
+
+          // nargs format = '-f=monkey washing cat'
+          if (checkAllAliases(letters[j], opts.narg)) {
+            args.splice(i + 1, 0, value)
+            i = eatNargs(i, key, args)
+          // array format = '-f=a b c'
+          } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
+            args.splice(i + 1, 0, value)
+            i = eatArray(i, key, args)
+          } else {
+            setArg(key, value)
+          }
+
+          broken = true
+          break
+        }
+
+        if (next === '-') {
+          setArg(letters[j], next)
+          continue
+        }
+
+        if (/[A-Za-z]/.test(letters[j]) &&
+          /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
+          setArg(letters[j], next)
+          broken = true
+          break
+        }
+
+        if (letters[j + 1] && letters[j + 1].match(/\W/)) {
+          setArg(letters[j], arg.slice(j + 2))
+          broken = true
+          break
+        } else {
+          setArg(letters[j], defaultForType(guessType(letters[j], flags)))
+        }
+      }
+
+      key = arg.slice(-1)[0]
+
+      if (!broken && key !== '-') {
+        // nargs format = '-f a b c'
+        if (checkAllAliases(key, opts.narg)) {
+          i = eatNargs(i, key, args)
+        // array format = '-f a b c'
+        } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
+          i = eatArray(i, key, args)
+        } else {
+          if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) &&
+            !checkAllAliases(key, flags.bools) &&
+            !checkAllAliases(key, flags.counts)) {
+            setArg(key, args[i + 1])
+            i++
+          } else if (args[i + 1] && /true|false/.test(args[i + 1])) {
+            setArg(key, args[i + 1])
+            i++
+          } else {
+            setArg(key, defaultForType(guessType(key, flags)))
+          }
+        }
+      }
+    } else {
+      argv._.push(
+        flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
+      )
+    }
+  }
+
+  // order of precedence:
+  // 1. command line arg
+  // 2. value from config file
+  // 3. value from env var
+  // 4. configured default value
+  applyEnvVars(opts, argv, true) // special case: check env vars that point to config file
+  setConfig(argv)
+  applyEnvVars(opts, argv, false)
+  applyDefaultsAndAliases(argv, aliases, defaults)
+
+  Object.keys(flags.counts).forEach(function (key) {
+    setArg(key, defaults[key])
+  })
+
+  notFlags.forEach(function (key) {
+    argv._.push(key)
+  })
+
+  // how many arguments should we consume, based
+  // on the nargs option?
+  function eatNargs (i, key, args) {
+    var toEat = checkAllAliases(key, opts.narg)
+
+    if (args.length - (i + 1) < toEat) error = Error(__('Not enough arguments following: %s', key))
+
+    for (var ii = i + 1; ii < (toEat + i + 1); ii++) {
+      setArg(key, args[ii])
+    }
+
+    return (i + toEat)
+  }
+
+  // if an option is an array, eat all non-hyphenated arguments
+  // following it... YUM!
+  // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
+  function eatArray (i, key, args) {
+    for (var ii = i + 1; ii < args.length; ii++) {
+      if (/^-/.test(args[ii])) break
+      i = ii
+      setArg(key, args[ii])
+    }
+
+    return i
+  }
+
+  function setArg (key, val) {
+    unsetDefaulted(key)
+
+    // handle parsing boolean arguments --foo=true --bar false.
+    if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
+      if (typeof val === 'string') val = val === 'true'
+    }
+
+    if (/-/.test(key) && !(aliases[key] && aliases[key].length)) {
+      var c = camelCase(key)
+      aliases[key] = [c]
+      newAliases[c] = true
+    }
+
+    var value = !checkAllAliases(key, flags.strings) && isNumber(val) ? Number(val) : val
+
+    if (checkAllAliases(key, flags.counts)) {
+      value = increment
+    }
+
+    var splitKey = key.split('.')
+    setKey(argv, splitKey, value)
+
+    // alias references an inner-value within
+    // a dot-notation object. see #279.
+    if (~key.indexOf('.') && aliases[key]) {
+      aliases[key].forEach(function (x) {
+        x = x.split('.')
+        setKey(argv, x, value)
+      })
+    }
+
+    ;(aliases[splitKey[0]] || []).forEach(function (x) {
+      x = x.split('.')
+
+      // handle populating dot notation for both
+      // the key and its aliases.
+      if (splitKey.length > 1) {
+        var a = [].concat(splitKey)
+        a.shift() // nuke the old key.
+        x = x.concat(a)
+      }
+
+      setKey(argv, x, value)
+    })
+
+    var keys = [key].concat(aliases[key] || [])
+    for (var i = 0, l = keys.length; i < l; i++) {
+      if (flags.normalize[keys[i]]) {
+        keys.forEach(function (key) {
+          argv.__defineSetter__(key, function (v) {
+            val = path.normalize(v)
+          })
+
+          argv.__defineGetter__(key, function () {
+            return typeof val === 'string' ? path.normalize(val) : val
+          })
+        })
+        break
+      }
+    }
+  }
+
+  // set args from config.json file, this should be
+  // applied last so that defaults can be applied.
+  function setConfig (argv) {
+    var configLookup = {}
+
+    // expand defaults/aliases, in-case any happen to reference
+    // the config.json file.
+    applyDefaultsAndAliases(configLookup, aliases, defaults)
+
+    Object.keys(flags.configs).forEach(function (configKey) {
+      var configPath = argv[configKey] || configLookup[configKey]
+      if (configPath) {
+        try {
+          var config = null
+          var resolvedConfigPath = path.resolve(process.cwd(), configPath)
+
+          if (typeof flags.configs[configKey] === 'function') {
+            try {
+              config = flags.configs[configKey](resolvedConfigPath)
+            } catch (e) {
+              config = e
+            }
+            if (config instanceof Error) {
+              error = config
+              return
+            }
+          } else {
+            config = require(resolvedConfigPath)
+          }
+
+          Object.keys(config).forEach(function (key) {
+            // setting arguments via CLI takes precedence over
+            // values within the config file.
+            if (argv[key] === undefined || (flags.defaulted[key])) {
+              delete argv[key]
+              setArg(key, config[key])
+            }
+          })
+        } catch (ex) {
+          if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath))
+        }
+      }
+    })
+  }
+
+  function applyEnvVars (opts, argv, configOnly) {
+    if (typeof opts.envPrefix === 'undefined') return
+
+    var prefix = typeof opts.envPrefix === 'string' ? opts.envPrefix : ''
+    Object.keys(process.env).forEach(function (envVar) {
+      if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
+        var key = camelCase(envVar.substring(prefix.length))
+        if (((configOnly && flags.configs[key]) || !configOnly) && (!(key in argv) || flags.defaulted[key])) {
+          setArg(key, process.env[envVar])
+        }
+      }
+    })
+  }
+
+  function applyDefaultsAndAliases (obj, aliases, defaults) {
+    Object.keys(defaults).forEach(function (key) {
+      if (!hasKey(obj, key.split('.'))) {
+        setKey(obj, key.split('.'), defaults[key])
+
+        ;(aliases[key] || []).forEach(function (x) {
+          if (hasKey(obj, x.split('.'))) return
+          setKey(obj, x.split('.'), defaults[key])
+        })
+      }
+    })
+  }
+
+  function hasKey (obj, keys) {
+    var o = obj
+    keys.slice(0, -1).forEach(function (key) {
+      o = (o[key] || {})
+    })
+
+    var key = keys[keys.length - 1]
+
+    if (typeof o !== 'object') return false
+    else return key in o
+  }
+
+  function setKey (obj, keys, value) {
+    var o = obj
+    keys.slice(0, -1).forEach(function (key) {
+      if (o[key] === undefined) o[key] = {}
+      o = o[key]
+    })
+
+    var key = keys[keys.length - 1]
+    if (value === increment) {
+      o[key] = increment(o[key])
+    } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) {
+      o[key] = Array.isArray(value) ? value : [value]
+    } else if (o[key] === undefined || typeof o[key] === 'boolean') {
+      o[key] = value
+    } else if (Array.isArray(o[key])) {
+      o[key].push(value)
+    } else {
+      o[key] = [ o[key], value ]
+    }
+  }
+
+  // extend the aliases list with inferred aliases.
+  function extendAliases (obj) {
+    Object.keys(obj || {}).forEach(function (key) {
+      // short-circuit if we've already added a key
+      // to the aliases array, for example it might
+      // exist in both 'opts.default' and 'opts.key'.
+      if (aliases[key]) return
+
+      aliases[key] = [].concat(opts.alias[key] || [])
+      // For "--option-name", also set argv.optionName
+      aliases[key].concat(key).forEach(function (x) {
+        if (/-/.test(x)) {
+          var c = camelCase(x)
+          aliases[key].push(c)
+          newAliases[c] = true
+        }
+      })
+      aliases[key].forEach(function (x) {
+        aliases[x] = [key].concat(aliases[key].filter(function (y) {
+          return x !== y
+        }))
+      })
+    })
+  }
+
+  // check if a flag is set for any of a key's aliases.
+  function checkAllAliases (key, flag) {
+    var isSet = false
+    var toCheck = [].concat(aliases[key] || [], key)
+
+    toCheck.forEach(function (key) {
+      if (flag[key]) isSet = flag[key]
+    })
+
+    return isSet
+  }
+
+  function setDefaulted (key) {
+    [].concat(aliases[key] || [], key).forEach(function (k) {
+      flags.defaulted[k] = true
+    })
+  }
+
+  function unsetDefaulted (key) {
+    [].concat(aliases[key] || [], key).forEach(function (k) {
+      delete flags.defaulted[k]
+    })
+  }
+
+  // return a default value, given the type of a flag.,
+  // e.g., key of type 'string' will default to '', rather than 'true'.
+  function defaultForType (type) {
+    var def = {
+      boolean: true,
+      string: '',
+      array: []
+    }
+
+    return def[type]
+  }
+
+  // given a flag, enforce a default type.
+  function guessType (key, flags) {
+    var type = 'boolean'
+
+    if (flags.strings && flags.strings[key]) type = 'string'
+    else if (flags.arrays && flags.arrays[key]) type = 'array'
+
+    return type
+  }
+
+  function isNumber (x) {
+    if (typeof x === 'number') return true
+    if (/^0x[0-9a-f]+$/i.test(x)) return true
+    return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
+  }
+
+  return {
+    argv: argv,
+    aliases: aliases,
+    error: error,
+    newAliases: newAliases
+  }
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/lib/tokenize-arg-string.js b/legacy-libs/grpc/node_modules/yargs/lib/tokenize-arg-string.js
new file mode 100644 (file)
index 0000000..df43fa5
--- /dev/null
@@ -0,0 +1,32 @@
+// take an un-split argv string and tokenize it.
+module.exports = function (argString) {
+  var i = 0
+  var c = null
+  var opening = null
+  var args = []
+
+  for (var ii = 0; ii < argString.length; ii++) {
+    c = argString.charAt(ii)
+
+    // split on spaces unless we're in quotes.
+    if (c === ' ' && !opening) {
+      i++
+      continue
+    }
+
+    // don't split the string if we're in matching
+    // opening or closing single and double quotes.
+    if (c === opening) {
+      opening = null
+      continue
+    } else if ((c === "'" || c === '"') && !opening) {
+      opening = c
+      continue
+    }
+
+    if (!args[i]) args[i] = ''
+    args[i] += c
+  }
+
+  return args
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/lib/usage.js b/legacy-libs/grpc/node_modules/yargs/lib/usage.js
new file mode 100644 (file)
index 0000000..b1b59bc
--- /dev/null
@@ -0,0 +1,383 @@
+// this file handles outputting usage instructions,
+// failures, etc. keeps logging in one place.
+var cliui = require('cliui')
+var decamelize = require('decamelize')
+var stringWidth = require('string-width')
+var wsize = require('window-size')
+
+module.exports = function (yargs, y18n) {
+  var __ = y18n.__
+  var self = {}
+
+  // methods for ouputting/building failure message.
+  var fails = []
+  self.failFn = function (f) {
+    fails.push(f)
+  }
+
+  var failMessage = null
+  var showHelpOnFail = true
+  self.showHelpOnFail = function (enabled, message) {
+    if (typeof enabled === 'string') {
+      message = enabled
+      enabled = true
+    } else if (typeof enabled === 'undefined') {
+      enabled = true
+    }
+    failMessage = message
+    showHelpOnFail = enabled
+    return self
+  }
+
+  var failureOutput = false
+  self.fail = function (msg) {
+    if (fails.length) {
+      fails.forEach(function (f) {
+        f(msg)
+      })
+    } else {
+      // don't output failure message more than once
+      if (!failureOutput) {
+        failureOutput = true
+        if (showHelpOnFail) yargs.showHelp('error')
+        if (msg) console.error(msg)
+        if (failMessage) {
+          if (msg) console.error('')
+          console.error(failMessage)
+        }
+      }
+      if (yargs.getExitProcess()) {
+        process.exit(1)
+      } else {
+        throw new Error(msg)
+      }
+    }
+  }
+
+  // methods for ouputting/building help (usage) message.
+  var usage
+  self.usage = function (msg) {
+    usage = msg
+  }
+
+  var examples = []
+  self.example = function (cmd, description) {
+    examples.push([cmd, description || ''])
+  }
+
+  var commands = []
+  self.command = function (cmd, description) {
+    commands.push([cmd, description || ''])
+  }
+  self.getCommands = function () {
+    return commands
+  }
+
+  var descriptions = {}
+  self.describe = function (key, desc) {
+    if (typeof key === 'object') {
+      Object.keys(key).forEach(function (k) {
+        self.describe(k, key[k])
+      })
+    } else {
+      descriptions[key] = desc
+    }
+  }
+  self.getDescriptions = function () {
+    return descriptions
+  }
+
+  var epilog
+  self.epilog = function (msg) {
+    epilog = msg
+  }
+
+  var wrap = windowWidth()
+  self.wrap = function (cols) {
+    wrap = cols
+  }
+
+  var deferY18nLookupPrefix = '__yargsString__:'
+  self.deferY18nLookup = function (str) {
+    return deferY18nLookupPrefix + str
+  }
+
+  var defaultGroup = 'Options:'
+  self.help = function () {
+    normalizeAliases()
+
+    var demanded = yargs.getDemanded()
+    var groups = yargs.getGroups()
+    var options = yargs.getOptions()
+    var keys = Object.keys(
+      Object.keys(descriptions)
+      .concat(Object.keys(demanded))
+      .concat(Object.keys(options.default))
+      .reduce(function (acc, key) {
+        if (key !== '_') acc[key] = true
+        return acc
+      }, {})
+    )
+    var ui = cliui({
+      width: wrap,
+      wrap: !!wrap
+    })
+
+    // the usage string.
+    if (usage) {
+      var u = usage.replace(/\$0/g, yargs.$0)
+      ui.div(u + '\n')
+    }
+
+    // your application's commands, i.e., non-option
+    // arguments populated in '_'.
+    if (commands.length) {
+      ui.div(__('Commands:'))
+
+      commands.forEach(function (command) {
+        ui.div(
+          {text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands) + 4},
+          {text: command[1]}
+        )
+      })
+
+      ui.div()
+    }
+
+    // perform some cleanup on the keys array, making it
+    // only include top-level keys not their aliases.
+    var aliasKeys = (Object.keys(options.alias) || [])
+      .concat(Object.keys(yargs.parsed.newAliases) || [])
+
+    keys = keys.filter(function (key) {
+      return !yargs.parsed.newAliases[key] && aliasKeys.every(function (alias) {
+        return (options.alias[alias] || []).indexOf(key) === -1
+      })
+    })
+
+    // populate 'Options:' group with any keys that have not
+    // explicitly had a group set.
+    if (!groups[defaultGroup]) groups[defaultGroup] = []
+    addUngroupedKeys(keys, options.alias, groups)
+
+    // display 'Options:' table along with any custom tables:
+    Object.keys(groups).forEach(function (groupName) {
+      if (!groups[groupName].length) return
+
+      ui.div(__(groupName))
+
+      // if we've grouped the key 'f', but 'f' aliases 'foobar',
+      // normalizedKeys should contain only 'foobar'.
+      var normalizedKeys = groups[groupName].map(function (key) {
+        if (~aliasKeys.indexOf(key)) return key
+        for (var i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
+          if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey
+        }
+        return key
+      })
+
+      // actually generate the switches string --foo, -f, --bar.
+      var switches = normalizedKeys.reduce(function (acc, key) {
+        acc[key] = [ key ].concat(options.alias[key] || [])
+          .map(function (sw) {
+            return (sw.length > 1 ? '--' : '-') + sw
+          })
+          .join(', ')
+
+        return acc
+      }, {})
+
+      normalizedKeys.forEach(function (key) {
+        var kswitch = switches[key]
+        var desc = descriptions[key] || ''
+        var type = null
+
+        if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length))
+
+        if (~options.boolean.indexOf(key)) type = '[' + __('boolean') + ']'
+        if (~options.count.indexOf(key)) type = '[' + __('count') + ']'
+        if (~options.string.indexOf(key)) type = '[' + __('string') + ']'
+        if (~options.normalize.indexOf(key)) type = '[' + __('string') + ']'
+        if (~options.array.indexOf(key)) type = '[' + __('array') + ']'
+
+        var extra = [
+          type,
+          demanded[key] ? '[' + __('required') + ']' : null,
+          options.choices && options.choices[key] ? '[' + __('choices:') + ' ' +
+            self.stringifiedValues(options.choices[key]) + ']' : null,
+          defaultString(options.default[key], options.defaultDescription[key])
+        ].filter(Boolean).join(' ')
+
+        ui.span(
+          {text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches) + 4},
+          desc
+        )
+
+        if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'})
+        else ui.div()
+      })
+
+      ui.div()
+    })
+
+    // describe some common use-cases for your application.
+    if (examples.length) {
+      ui.div(__('Examples:'))
+
+      examples.forEach(function (example) {
+        example[0] = example[0].replace(/\$0/g, yargs.$0)
+      })
+
+      examples.forEach(function (example) {
+        ui.div(
+          {text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples) + 4},
+          example[1]
+        )
+      })
+
+      ui.div()
+    }
+
+    // the usage string.
+    if (epilog) {
+      var e = epilog.replace(/\$0/g, yargs.$0)
+      ui.div(e + '\n')
+    }
+
+    return ui.toString()
+  }
+
+  // return the maximum width of a string
+  // in the left-hand column of a table.
+  function maxWidth (table) {
+    var width = 0
+
+    // table might be of the form [leftColumn],
+    // or {key: leftColumn}}
+    if (!Array.isArray(table)) {
+      table = Object.keys(table).map(function (key) {
+        return [table[key]]
+      })
+    }
+
+    table.forEach(function (v) {
+      width = Math.max(stringWidth(v[0]), width)
+    })
+
+    // if we've enabled 'wrap' we should limit
+    // the max-width of the left-column.
+    if (wrap) width = Math.min(width, parseInt(wrap * 0.5, 10))
+
+    return width
+  }
+
+  // make sure any options set for aliases,
+  // are copied to the keys being aliased.
+  function normalizeAliases () {
+    var demanded = yargs.getDemanded()
+    var options = yargs.getOptions()
+
+    ;(Object.keys(options.alias) || []).forEach(function (key) {
+      options.alias[key].forEach(function (alias) {
+        // copy descriptions.
+        if (descriptions[alias]) self.describe(key, descriptions[alias])
+        // copy demanded.
+        if (demanded[alias]) yargs.demand(key, demanded[alias].msg)
+        // type messages.
+        if (~options.boolean.indexOf(alias)) yargs.boolean(key)
+        if (~options.count.indexOf(alias)) yargs.count(key)
+        if (~options.string.indexOf(alias)) yargs.string(key)
+        if (~options.normalize.indexOf(alias)) yargs.normalize(key)
+        if (~options.array.indexOf(alias)) yargs.array(key)
+      })
+    })
+  }
+
+  // given a set of keys, place any keys that are
+  // ungrouped under the 'Options:' grouping.
+  function addUngroupedKeys (keys, aliases, groups) {
+    var groupedKeys = []
+    var toCheck = null
+    Object.keys(groups).forEach(function (group) {
+      groupedKeys = groupedKeys.concat(groups[group])
+    })
+
+    keys.forEach(function (key) {
+      toCheck = [key].concat(aliases[key])
+      if (!toCheck.some(function (k) {
+        return groupedKeys.indexOf(k) !== -1
+      })) {
+        groups[defaultGroup].push(key)
+      }
+    })
+    return groupedKeys
+  }
+
+  self.showHelp = function (level) {
+    level = level || 'error'
+    console[level](self.help())
+  }
+
+  self.functionDescription = function (fn) {
+    var description = fn.name ? decamelize(fn.name, '-') : __('generated-value')
+    return ['(', description, ')'].join('')
+  }
+
+  self.stringifiedValues = function (values, separator) {
+    var string = ''
+    var sep = separator || ', '
+    var array = [].concat(values)
+
+    if (!values || !array.length) return string
+
+    array.forEach(function (value) {
+      if (string.length) string += sep
+      string += JSON.stringify(value)
+    })
+
+    return string
+  }
+
+  // format the default-value-string displayed in
+  // the right-hand column.
+  function defaultString (value, defaultDescription) {
+    var string = '[' + __('default:') + ' '
+
+    if (value === undefined && !defaultDescription) return null
+
+    if (defaultDescription) {
+      string += defaultDescription
+    } else {
+      switch (typeof value) {
+        case 'string':
+          string += JSON.stringify(value)
+          break
+        case 'object':
+          string += JSON.stringify(value)
+          break
+        default:
+          string += value
+      }
+    }
+
+    return string + ']'
+  }
+
+  // guess the width of the console window, max-width 80.
+  function windowWidth () {
+    return wsize.width ? Math.min(80, wsize.width) : null
+  }
+
+  // logic for displaying application version.
+  var version = null
+  self.version = function (ver, opt, msg) {
+    version = ver
+  }
+
+  self.showVersion = function () {
+    if (typeof version === 'function') console.log(version())
+    else console.log(version)
+  }
+
+  return self
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/lib/validation.js b/legacy-libs/grpc/node_modules/yargs/lib/validation.js
new file mode 100644 (file)
index 0000000..514bbff
--- /dev/null
@@ -0,0 +1,249 @@
+// validation-type-stuff, missing params,
+// bad implications, custom checks.
+module.exports = function (yargs, usage, y18n) {
+  var __ = y18n.__
+  var __n = y18n.__n
+  var self = {}
+
+  // validate appropriate # of non-option
+  // arguments were provided, i.e., '_'.
+  self.nonOptionCount = function (argv) {
+    var demanded = yargs.getDemanded()
+    var _s = argv._.length
+
+    if (demanded._ && (_s < demanded._.count || _s > demanded._.max)) {
+      if (demanded._.msg !== undefined) {
+        usage.fail(demanded._.msg)
+      } else if (_s < demanded._.count) {
+        usage.fail(
+          __('Not enough non-option arguments: got %s, need at least %s', argv._.length, demanded._.count)
+        )
+      } else {
+        usage.fail(
+          __('Too many non-option arguments: got %s, maximum of %s', argv._.length, demanded._.max)
+        )
+      }
+    }
+  }
+
+  // make sure that any args that require an
+  // value (--foo=bar), have a value.
+  self.missingArgumentValue = function (argv) {
+    var defaultValues = [true, false, '']
+    var options = yargs.getOptions()
+
+    if (options.requiresArg.length > 0) {
+      var missingRequiredArgs = []
+
+      options.requiresArg.forEach(function (key) {
+        var value = argv[key]
+
+        // if a value is explicitly requested,
+        // flag argument as missing if it does not
+        // look like foo=bar was entered.
+        if (~defaultValues.indexOf(value) ||
+          (Array.isArray(value) && !value.length)) {
+          missingRequiredArgs.push(key)
+        }
+      })
+
+      if (missingRequiredArgs.length > 0) {
+        usage.fail(__n(
+          'Missing argument value: %s',
+          'Missing argument values: %s',
+          missingRequiredArgs.length,
+          missingRequiredArgs.join(', ')
+        ))
+      }
+    }
+  }
+
+  // make sure all the required arguments are present.
+  self.requiredArguments = function (argv) {
+    var demanded = yargs.getDemanded()
+    var missing = null
+
+    Object.keys(demanded).forEach(function (key) {
+      if (!argv.hasOwnProperty(key)) {
+        missing = missing || {}
+        missing[key] = demanded[key]
+      }
+    })
+
+    if (missing) {
+      var customMsgs = []
+      Object.keys(missing).forEach(function (key) {
+        var msg = missing[key].msg
+        if (msg && customMsgs.indexOf(msg) < 0) {
+          customMsgs.push(msg)
+        }
+      })
+
+      var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : ''
+
+      usage.fail(__n(
+        'Missing required argument: %s',
+        'Missing required arguments: %s',
+        Object.keys(missing).length,
+        Object.keys(missing).join(', ') + customMsg
+      ))
+    }
+  }
+
+  // check for unknown arguments (strict-mode).
+  self.unknownArguments = function (argv, aliases) {
+    var aliasLookup = {}
+    var descriptions = usage.getDescriptions()
+    var demanded = yargs.getDemanded()
+    var unknown = []
+
+    Object.keys(aliases).forEach(function (key) {
+      aliases[key].forEach(function (alias) {
+        aliasLookup[alias] = key
+      })
+    })
+
+    Object.keys(argv).forEach(function (key) {
+      if (key !== '$0' && key !== '_' &&
+        !descriptions.hasOwnProperty(key) &&
+        !demanded.hasOwnProperty(key) &&
+        !aliasLookup.hasOwnProperty(key)) {
+        unknown.push(key)
+      }
+    })
+
+    if (unknown.length > 0) {
+      usage.fail(__n(
+        'Unknown argument: %s',
+        'Unknown arguments: %s',
+        unknown.length,
+        unknown.join(', ')
+      ))
+    }
+  }
+
+  // validate arguments limited to enumerated choices
+  self.limitedChoices = function (argv) {
+    var options = yargs.getOptions()
+    var invalid = {}
+
+    if (!Object.keys(options.choices).length) return
+
+    Object.keys(argv).forEach(function (key) {
+      if (key !== '$0' && key !== '_' &&
+        options.choices.hasOwnProperty(key)) {
+        [].concat(argv[key]).forEach(function (value) {
+          // TODO case-insensitive configurability
+          if (options.choices[key].indexOf(value) === -1) {
+            invalid[key] = (invalid[key] || []).concat(value)
+          }
+        })
+      }
+    })
+
+    var invalidKeys = Object.keys(invalid)
+
+    if (!invalidKeys.length) return
+
+    var msg = __('Invalid values:')
+    invalidKeys.forEach(function (key) {
+      msg += '\n  ' + __(
+        'Argument: %s, Given: %s, Choices: %s',
+        key,
+        usage.stringifiedValues(invalid[key]),
+        usage.stringifiedValues(options.choices[key])
+      )
+    })
+    usage.fail(msg)
+  }
+
+  // custom checks, added using the `check` option on yargs.
+  var checks = []
+  self.check = function (f) {
+    checks.push(f)
+  }
+
+  self.customChecks = function (argv, aliases) {
+    checks.forEach(function (f) {
+      try {
+        var result = f(argv, aliases)
+        if (!result) {
+          usage.fail(__('Argument check failed: %s', f.toString()))
+        } else if (typeof result === 'string') {
+          usage.fail(result)
+        }
+      } catch (err) {
+        usage.fail(err.message ? err.message : err)
+      }
+    })
+  }
+
+  // check implications, argument foo implies => argument bar.
+  var implied = {}
+  self.implies = function (key, value) {
+    if (typeof key === 'object') {
+      Object.keys(key).forEach(function (k) {
+        self.implies(k, key[k])
+      })
+    } else {
+      implied[key] = value
+    }
+  }
+  self.getImplied = function () {
+    return implied
+  }
+
+  self.implications = function (argv) {
+    var implyFail = []
+
+    Object.keys(implied).forEach(function (key) {
+      var num
+      var origKey = key
+      var value = implied[key]
+
+      // convert string '1' to number 1
+      num = Number(key)
+      key = isNaN(num) ? key : num
+
+      if (typeof key === 'number') {
+        // check length of argv._
+        key = argv._.length >= key
+      } else if (key.match(/^--no-.+/)) {
+        // check if key doesn't exist
+        key = key.match(/^--no-(.+)/)[1]
+        key = !argv[key]
+      } else {
+        // check if key exists
+        key = argv[key]
+      }
+
+      num = Number(value)
+      value = isNaN(num) ? value : num
+
+      if (typeof value === 'number') {
+        value = argv._.length >= value
+      } else if (value.match(/^--no-.+/)) {
+        value = value.match(/^--no-(.+)/)[1]
+        value = !argv[value]
+      } else {
+        value = argv[value]
+      }
+
+      if (key && !value) {
+        implyFail.push(origKey)
+      }
+    })
+
+    if (implyFail.length) {
+      var msg = __('Implications failed:') + '\n'
+
+      implyFail.forEach(function (key) {
+        msg += ('  ' + key + ' -> ' + implied[key])
+      })
+
+      usage.fail(msg)
+    }
+  }
+
+  return self
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/de.json b/legacy-libs/grpc/node_modules/yargs/locales/de.json
new file mode 100644 (file)
index 0000000..00b3907
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Kommandos:",
+  "Options:": "Optionen:",
+  "Examples:": "Beispiele:",
+  "boolean": "boolean",
+  "count": "Zähler",
+  "string": "string",
+  "array": "array",
+  "required": "erforderlich",
+  "default:": "Standard:",
+  "choices:": "Möglichkeiten:",
+  "generated-value": "Generierter-Wert",
+  "Not enough non-option arguments: got %s, need at least %s": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt",
+  "Too many non-option arguments: got %s, maximum of %s": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt",
+  "Missing argument value: %s": {
+    "one": "Fehlender Argumentwert: %s",
+    "other": "Fehlende Argumentwerte: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Fehlendes Argument: %s",
+    "other": "Fehlende Argumente: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Unbekanntes Argument: %s",
+    "other": "Unbekannte Argumente: %s"
+  },
+  "Invalid values:": "Unzulässige Werte:",
+  "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s",
+  "Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s",
+  "Implications failed:": "Implikationen fehlgeschlagen:",
+  "Not enough arguments following: %s": "Nicht genügend Argumente nach: %s",
+  "Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s",
+  "Path to JSON config file": "Pfad zur JSON-Config Datei",
+  "Show help": "Hilfe anzeigen",
+  "Show version number": "Version anzeigen"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/en.json b/legacy-libs/grpc/node_modules/yargs/locales/en.json
new file mode 100644 (file)
index 0000000..ce19199
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Commands:",
+  "Options:": "Options:",
+  "Examples:": "Examples:",
+  "boolean": "boolean",
+  "count": "count",
+  "string": "string",
+  "array": "array",
+  "required": "required",
+  "default:": "default:",
+  "choices:": "choices:",
+  "generated-value": "generated-value",
+  "Not enough non-option arguments: got %s, need at least %s": "Not enough non-option arguments: got %s, need at least %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Too many non-option arguments: got %s, maximum of %s",
+  "Missing argument value: %s": {
+    "one": "Missing argument value: %s",
+    "other": "Missing argument values: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Missing required argument: %s",
+    "other": "Missing required arguments: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Unknown argument: %s",
+    "other": "Unknown arguments: %s"
+  },
+  "Invalid values:": "Invalid values:",
+  "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s",
+  "Argument check failed: %s": "Argument check failed: %s",
+  "Implications failed:": "Implications failed:",
+  "Not enough arguments following: %s": "Not enough arguments following: %s",
+  "Invalid JSON config file: %s": "Invalid JSON config file: %s",
+  "Path to JSON config file": "Path to JSON config file",
+  "Show help": "Show help",
+  "Show version number": "Show version number"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/es.json b/legacy-libs/grpc/node_modules/yargs/locales/es.json
new file mode 100644 (file)
index 0000000..c4f1917
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Comandos:",
+  "Options:": "Opciones:",
+  "Examples:": "Ejemplos:",
+  "boolean": "boolean",
+  "count": "cuenta",
+  "string": "cadena de caracteres",
+  "array": "tabla",
+  "required": "requisito",
+  "default:": "defecto:",
+  "choices:": "selección:",
+  "generated-value": "valor-generado",
+  "Not enough non-option arguments: got %s, need at least %s": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
+  "Missing argument value: %s": {
+    "one": "Falta argumento: %s",
+    "other": "Faltan argumentos: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Falta argumento requerido: %s",
+    "other": "Faltan argumentos requeridos: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Argumento desconocido: %s",
+    "other": "Argumentos desconocidos: %s"
+  },
+  "Invalid values:": "Valores inválidos:",
+  "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Selección: %s",
+  "Argument check failed: %s": "Verificación de argumento ha fracasado: %s",
+  "Implications failed:": "Implicaciones fracasadas:",
+  "Not enough arguments following: %s": "No hay suficientes argumentos después de: %s",
+  "Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s",
+  "Path to JSON config file": "Ruta al archivo de configuración JSON",
+  "Show help": "Muestra ayuda",
+  "Show version number": "Muestra número de versión"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/fr.json b/legacy-libs/grpc/node_modules/yargs/locales/fr.json
new file mode 100644 (file)
index 0000000..49d068b
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Commandes:",
+  "Options:": "Options:",
+  "Examples:": "Exemples:",
+  "boolean": "booléen",
+  "count": "comptage",
+  "string": "chaine de caractère",
+  "array": "tableau",
+  "required": "requis",
+  "default:": "défaut:",
+  "choices:": "choix:",
+  "generated-value": "valeur générée",
+  "Not enough non-option arguments: got %s, need at least %s": "Pas assez d'arguments non-option: reçu %s, besoin d'au moins %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Trop d'arguments non-option: reçu %s, maximum %s",
+  "Missing argument value: %s": {
+    "one": "Argument manquant: %s",
+    "other": "Arguments manquants: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Argument requis manquant: %s",
+    "other": "Arguments requis manquants: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Argument inconnu: %s",
+    "other": "Arguments inconnus: %s"
+  },
+  "Invalid values:": "Valeurs invalides:",
+  "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Donné: %s, Choix: %s",
+  "Argument check failed: %s": "Echec de la vérification de l'argument: %s",
+  "Implications failed:": "Implications échouées:",
+  "Not enough arguments following: %s": "Pas assez d'arguments suivant: %s",
+  "Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s",
+  "Path to JSON config file": "Chemin du fichier de configuration JSON",
+  "Show help": "Affiche de l'aide",
+  "Show version number": "Affiche le numéro de version"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/id.json b/legacy-libs/grpc/node_modules/yargs/locales/id.json
new file mode 100644 (file)
index 0000000..7cb7e56
--- /dev/null
@@ -0,0 +1,37 @@
+
+{
+  "Commands:": "Perintah:",
+  "Options:": "Pilihan:",
+  "Examples:": "Contoh:",
+  "boolean": "boolean",
+  "count": "jumlah",
+  "string": "string",
+  "array": "larik",
+  "required": "diperlukan",
+  "default:": "bawaan:",
+  "choices:": "pilihan:",
+  "generated-value": "nilai-yang-dihasilkan",
+  "Not enough non-option arguments: got %s, need at least %s": "Argumen wajib kurang: hanya %s, minimal %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Terlalu banyak argumen wajib: ada %s, maksimal %s",
+  "Missing argument value: %s": {
+    "one": "Kurang argumen: %s",
+    "other": "Kurang argumen: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Kurang argumen wajib: %s",
+    "other": "Kurang argumen wajib: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Argumen tak diketahui: %s",
+    "other": "Argumen tak diketahui: %s"
+  },
+  "Invalid values:": "Nilai-nilai tidak valid:",
+  "Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s",
+  "Argument check failed: %s": "Pemeriksaan argument gagal: %s",
+  "Implications failed:": "Implikasi gagal:",
+  "Not enough arguments following: %s": "Kurang argumen untuk: %s",
+  "Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s",
+  "Path to JSON config file": "Alamat berkas konfigurasi JSON",
+  "Show help": "Lihat bantuan",
+  "Show version number": "Lihat nomor versi"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/ja.json b/legacy-libs/grpc/node_modules/yargs/locales/ja.json
new file mode 100644 (file)
index 0000000..21b8e52
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "コマンド:",
+  "Options:": "オプション:",
+  "Examples:": "例:",
+  "boolean": "真偽",
+  "count": "カウント",
+  "string": "文字列",
+  "array": "配列",
+  "required": "必須",
+  "default:": "デフォルト:",
+  "choices:": "選択してください:",
+  "generated-value": "生成された値",
+  "Not enough non-option arguments: got %s, need at least %s": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
+  "Too many non-option arguments: got %s, maximum of %s": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
+  "Missing argument value: %s": {
+    "one": "引数が見つかりません: %s",
+    "other": "引数が見つかりません: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "必須の引数が見つかりません: %s",
+    "other": "必須の引数が見つかりません: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "未知の引数です: %s",
+    "other": "未知の引数です: %s"
+  },
+  "Invalid values:": "不正な値です:",
+  "Argument: %s, Given: %s, Choices: %s": "引数は %s です。指定できるのは %s つです。選択してください: %s",
+  "Argument check failed: %s": "引数のチェックに失敗しました: %s",
+  "Implications failed:": "オプションの組み合わせで不正が生じました:",
+  "Not enough arguments following: %s": "次の引数が不足しています。: %s",
+  "Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s",
+  "Path to JSON config file": "JSONの設定ファイルまでのpath",
+  "Show help": "ヘルプを表示",
+  "Show version number": "バージョンを表示"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/ko.json b/legacy-libs/grpc/node_modules/yargs/locales/ko.json
new file mode 100644 (file)
index 0000000..a16971a
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "명령:",
+  "Options:": "옵션:",
+  "Examples:": "예시:",
+  "boolean": "여부",
+  "count": "개수",
+  "string": "문자열",
+  "array": "배열",
+  "required": "필수",
+  "default:": "기본:",
+  "choices:": "선택:",
+  "generated-value": "생성된 값",
+  "Not enough non-option arguments: got %s, need at least %s": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다",
+  "Too many non-option arguments: got %s, maximum of %s": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다",
+  "Missing argument value: %s": {
+    "one": "인자값을 받지 못했습니다: %s",
+    "other": "인자값들을 받지 못했습니다: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "필수 인자를 받지 못했습니다: %s",
+    "other": "필수 인자들을 받지 못했습니다: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "알 수 없는 인자입니다: %s",
+    "other": "알 수 없는 인자들입니다: %s"
+  },
+  "Invalid values:": "잘못된 값입니다:",
+  "Argument: %s, Given: %s, Choices: %s": "인자: %s, 입력받은 값: %s, 선택지: %s",
+  "Argument check failed: %s": "유효하지 않은 인자입니다: %s",
+  "Implications failed:": "옵션의 조합이 잘못되었습니다:",
+  "Not enough arguments following: %s": "인자가 충분하게 주어지지 않았습니다: %s",
+  "Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s",
+  "Path to JSON config file": "JSON 설정파일 경로",
+  "Show help": "도움말을 보여줍니다",
+  "Show version number": "버전 넘버를 보여줍니다"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/nb.json b/legacy-libs/grpc/node_modules/yargs/locales/nb.json
new file mode 100644 (file)
index 0000000..65fa6ae
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Kommandoer:",
+  "Options:": "Alternativer:",
+  "Examples:": "Eksempler:",
+  "boolean": "boolsk",
+  "count": "antall",
+  "string": "streng",
+  "array": "matrise",
+  "required": "obligatorisk",
+  "default:": "standard:",
+  "choices:": "valg:",
+  "generated-value": "generert-verdi",
+  "Not enough non-option arguments: got %s, need at least %s": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s",
+  "Too many non-option arguments: got %s, maximum of %s": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s",
+  "Missing argument value: %s": {
+    "one": "Mangler argument verdi: %s",
+    "other": "Mangler argument verdier: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Mangler obligatorisk argument: %s",
+    "other": "Mangler obligatoriske argumenter: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Ukjent argument: %s",
+    "other": "Ukjente argumenter: %s"
+  },
+  "Invalid values:": "Ugyldige verdier:",
+  "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s",
+  "Argument check failed: %s": "Argument sjekk mislyktes: %s",
+  "Implications failed:": "Konsekvensene mislyktes:",
+  "Not enough arguments following: %s": "Ikke nok følgende argumenter: %s",
+  "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s",
+  "Path to JSON config file": "Bane til JSON konfigurasjonsfil",
+  "Show help": "Vis hjelp",
+  "Show version number": "Vis versjonsnummer"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/pirate.json b/legacy-libs/grpc/node_modules/yargs/locales/pirate.json
new file mode 100644 (file)
index 0000000..1f4e19e
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "Commands:": "Choose yer command:",
+  "Options:": "Options for me hearties!",
+  "Examples:": "Ex. marks the spot:",
+  "required": "requi-yar-ed",
+  "Missing required argument: %s": {
+    "one": "Ye be havin' to set the followin' argument land lubber: %s",
+    "other": "Ye be havin' to set the followin' arguments land lubber: %s"
+  },
+  "Show help": "Parlay this here code of conduct",
+  "Show version number": "'Tis the version ye be askin' fer"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/pl.json b/legacy-libs/grpc/node_modules/yargs/locales/pl.json
new file mode 100644 (file)
index 0000000..7d4c5be
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Polecenia:",
+  "Options:": "Opcje:",
+  "Examples:": "Przykłady:",
+  "boolean": "boolean",
+  "count": "ilość",
+  "string": "ciąg znaków",
+  "array": "tablica",
+  "required": "wymagany",
+  "default:": "domyślny:",
+  "choices:": "dostępne:",
+  "generated-value": "wygenerowana-wartość",
+  "Not enough non-option arguments: got %s, need at least %s": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s",
+  "Missing argument value: %s": {
+    "one": "Brak wartości dla argumentu: %s",
+    "other": "Brak wartości dla argumentów: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Brak wymaganego argumentu: %s",
+    "other": "Brak wymaganych argumentów: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Nieznany argument: %s",
+    "other": "Nieznane argumenty: %s"
+  },
+  "Invalid values:": "Nieprawidłowe wartości:",
+  "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s",
+  "Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s",
+  "Implications failed:": "Założenia nie zostały spełnione:",
+  "Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s",
+  "Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s",
+  "Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON",
+  "Show help": "Pokaż pomoc",
+  "Show version number": "Pokaż numer wersji"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/pt.json b/legacy-libs/grpc/node_modules/yargs/locales/pt.json
new file mode 100644 (file)
index 0000000..6abbcd4
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Comandos:",
+  "Options:": "Opções:",
+  "Examples:": "Exemplos:",
+  "boolean": "boolean",
+  "count": "contagem",
+  "string": "cadeia de caracteres",
+  "array": "arranjo",
+  "required": "requerido",
+  "default:": "padrão:",
+  "choices:": "escolhas:",
+  "generated-value": "valor-gerado",
+  "Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos não opcionais: recebido %s, máximo de %s",
+  "Missing argument value: %s": {
+    "one": "Falta valor de argumento: %s",
+    "other": "Falta valores de argumento: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Falta argumento obrigatório: %s",
+    "other": "Faltando argumentos obrigatórios: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Argumento desconhecido: %s",
+    "other": "Argumentos desconhecidos: %s"
+  },
+  "Invalid values:": "Valores inválidos:",
+  "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s",
+  "Argument check failed: %s": "Verificação de argumento falhou: %s",
+  "Implications failed:": "Implicações falharam:",
+  "Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s",
+  "Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s",
+  "Path to JSON config file": "Caminho para o arquivo de configuração em JSON",
+  "Show help": "Mostra ajuda",
+  "Show version number": "Mostra número de versão"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/pt_BR.json b/legacy-libs/grpc/node_modules/yargs/locales/pt_BR.json
new file mode 100644 (file)
index 0000000..eb7544e
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Comandos:",
+  "Options:": "Opções:",
+  "Examples:": "Exemplos:",
+  "boolean": "boolean",
+  "count": "contagem",
+  "string": "string",
+  "array": "array",
+  "required": "obrigatório",
+  "default:": "padrão:",
+  "choices:": "opções:",
+  "generated-value": "valor-gerado",
+  "Not enough non-option arguments: got %s, need at least %s": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
+  "Too many non-option arguments: got %s, maximum of %s": "Excesso de argumentos: recebido %s, máximo de %s",
+  "Missing argument value: %s": {
+    "one": "Falta valor de argumento: %s",
+    "other": "Falta valores de argumento: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Falta argumento obrigatório: %s",
+    "other": "Faltando argumentos obrigatórios: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Argumento desconhecido: %s",
+    "other": "Argumentos desconhecidos: %s"
+  },
+  "Invalid values:": "Valores inválidos:",
+  "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s",
+  "Argument check failed: %s": "Verificação de argumento falhou: %s",
+  "Implications failed:": "Implicações falharam:",
+  "Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s",
+  "Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s",
+  "Path to JSON config file": "Caminho para o arquivo JSON de configuração",
+  "Show help": "Exibe ajuda",
+  "Show version number": "Exibe a versão"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/tr.json b/legacy-libs/grpc/node_modules/yargs/locales/tr.json
new file mode 100644 (file)
index 0000000..cef09d2
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "Komutlar:",
+  "Options:": "Seçenekler:",
+  "Examples:": "Örnekler:",
+  "boolean": "boolean",
+  "count": "sayı",
+  "string": "string",
+  "array": "array",
+  "required": "zorunlu",
+  "default:": "varsayılan:",
+  "choices:": "seçimler:",
+  "generated-value": "oluşturulan-değer",
+  "Not enough non-option arguments: got %s, need at least %s": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli",
+  "Too many non-option arguments: got %s, maximum of %s": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s",
+  "Missing argument value: %s": {
+    "one": "Eksik argüman değeri: %s",
+    "other": "Eksik argüman değerleri: %s"
+  },
+  "Missing required argument: %s": {
+    "one": "Eksik zorunlu argüman: %s",
+    "other": "Eksik zorunlu argümanlar: %s"
+  },
+  "Unknown argument: %s": {
+    "one": "Bilinmeyen argüman: %s",
+    "other": "Bilinmeyen argümanlar: %s"
+  },
+  "Invalid values:": "Geçersiz değerler:",
+  "Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s",
+  "Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s",
+  "Implications failed:": "Sonuçlar başarısız oldu:",
+  "Not enough arguments following: %s": "%s için yeterli argüman bulunamadı",
+  "Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s",
+  "Path to JSON config file": "JSON yapılandırma dosya konumu",
+  "Show help": "Yardım detaylarını göster",
+  "Show version number": "Versiyon detaylarını göster"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/locales/zh.json b/legacy-libs/grpc/node_modules/yargs/locales/zh.json
new file mode 100644 (file)
index 0000000..7b01d71
--- /dev/null
@@ -0,0 +1,36 @@
+{
+  "Commands:": "命令:",
+  "Options:": "选项:",
+  "Examples:": "示例:",
+  "boolean": "boolean",
+  "count": "count",
+  "string": "string",
+  "array": "array",
+  "required": "required",
+  "default:": "默认值:",
+  "choices:": "可选值:",
+  "generated-value": "生成的值",
+  "Not enough non-option arguments: got %s, need at least %s": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个",
+  "Too many non-option arguments: got %s, maximum of %s": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个",
+  "Missing argument value: %s": {
+    "one": "没有给此选项指定值:%s",
+    "other": "没有给这些选项指定值:%s"
+  },
+  "Missing required argument: %s": {
+    "one": "缺少必须的选项:%s",
+    "other": "缺少这些必须的选项:%s"
+  },
+  "Unknown argument: %s": {
+    "one": "无法识别的选项:%s",
+    "other": "无法识别这些选项:%s"
+  },
+  "Invalid values:": "无效的选项值:",
+  "Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s",
+  "Argument check failed: %s": "选项值验证失败:%s",
+  "Implications failed:": "缺少依赖的选项:",
+  "Not enough arguments following: %s": "没有提供足够的值给此选项:%s",
+  "Invalid JSON config file: %s": "无效的 JSON 配置文件:%s",
+  "Path to JSON config file": "JSON 配置文件的路径",
+  "Show help": "显示帮助信息",
+  "Show version number": "显示版本号"
+}
diff --git a/legacy-libs/grpc/node_modules/yargs/package.json b/legacy-libs/grpc/node_modules/yargs/package.json
new file mode 100644 (file)
index 0000000..953d8bc
--- /dev/null
@@ -0,0 +1,174 @@
+{
+  "_args": [
+    [
+      {
+        "raw": "yargs@^3.10.0",
+        "scope": null,
+        "escapedName": "yargs",
+        "name": "yargs",
+        "rawSpec": "^3.10.0",
+        "spec": ">=3.10.0 <4.0.0",
+        "type": "range"
+      },
+      "/var/opt/motion2/node_modules/grpc/node_modules/protobufjs"
+    ]
+  ],
+  "_from": "yargs@>=3.10.0 <4.0.0",
+  "_id": "yargs@3.32.0",
+  "_inCache": true,
+  "_location": "/grpc/yargs",
+  "_nodeVersion": "3.2.0",
+  "_npmUser": {
+    "name": "bcoe",
+    "email": "ben@npmjs.com"
+  },
+  "_npmVersion": "3.3.0",
+  "_phantomChildren": {},
+  "_requested": {
+    "raw": "yargs@^3.10.0",
+    "scope": null,
+    "escapedName": "yargs",
+    "name": "yargs",
+    "rawSpec": "^3.10.0",
+    "spec": ">=3.10.0 <4.0.0",
+    "type": "range"
+  },
+  "_requiredBy": [
+    "/grpc/protobufjs"
+  ],
+  "_resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz",
+  "_shasum": "03088e9ebf9e756b69751611d2a5ef591482c995",
+  "_shrinkwrap": null,
+  "_spec": "yargs@^3.10.0",
+  "_where": "/var/opt/motion2/node_modules/grpc/node_modules/protobufjs",
+  "author": {
+    "name": "Alex Ford",
+    "email": "Alex.Ford@CodeTunnel.com",
+    "url": "http://CodeTunnel.com"
+  },
+  "bugs": {
+    "url": "https://github.com/bcoe/yargs/issues"
+  },
+  "contributors": [
+    {
+      "name": "Benjamin Coe",
+      "email": "ben@npmjs.com",
+      "url": "https://github.com/bcoe"
+    },
+    {
+      "name": "Andrew Goode",
+      "url": "https://github.com/nexdrew"
+    },
+    {
+      "name": "Chris Needham",
+      "email": "chris@chrisneedham.com",
+      "url": "http://chrisneedham.com"
+    },
+    {
+      "name": "James Nylen",
+      "email": "jnylen@gmail.com",
+      "url": "https://github.com/nylen"
+    },
+    {
+      "name": "Benjamin Horsleben",
+      "url": "https://github.com/fizker"
+    },
+    {
+      "name": "Lin Clark",
+      "url": "https://github.com/linclark"
+    },
+    {
+      "name": "Tim Schaub",
+      "url": "https://github.com/tschaub"
+    }
+  ],
+  "dependencies": {
+    "camelcase": "^2.0.1",
+    "cliui": "^3.0.3",
+    "decamelize": "^1.1.1",
+    "os-locale": "^1.4.0",
+    "string-width": "^1.0.1",
+    "window-size": "^0.1.4",
+    "y18n": "^3.2.0"
+  },
+  "description": "Light-weight option parsing with an argv hash. No optstrings attached.",
+  "devDependencies": {
+    "chai": "^3.4.1",
+    "chalk": "^1.1.1",
+    "coveralls": "^2.11.4",
+    "es6-promise": "^3.0.2",
+    "hashish": "0.0.4",
+    "mocha": "^2.3.4",
+    "nyc": "^5.2.0",
+    "standard": "^5.4.1",
+    "which": "^1.1.2",
+    "win-spawn": "^2.0.0"
+  },
+  "directories": {},
+  "dist": {
+    "shasum": "03088e9ebf9e756b69751611d2a5ef591482c995",
+    "tarball": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz"
+  },
+  "engine": {
+    "node": ">=0.10"
+  },
+  "files": [
+    "index.js",
+    "lib",
+    "locales",
+    "completion.sh.hbs",
+    "LICENSE"
+  ],
+  "gitHead": "e6eaddf457c27e71a0bbe156f17d2f82087f0d6f",
+  "homepage": "https://github.com/bcoe/yargs#readme",
+  "keywords": [
+    "argument",
+    "args",
+    "option",
+    "parser",
+    "parsing",
+    "cli",
+    "command"
+  ],
+  "license": "MIT",
+  "main": "./index.js",
+  "maintainers": [
+    {
+      "name": "bcoe",
+      "email": "ben@npmjs.com"
+    },
+    {
+      "name": "chevex",
+      "email": "alex.ford@codetunnel.com"
+    },
+    {
+      "name": "nexdrew",
+      "email": "andrew@npmjs.com"
+    },
+    {
+      "name": "nylen",
+      "email": "jnylen@gmail.com"
+    }
+  ],
+  "name": "yargs",
+  "optionalDependencies": {},
+  "readme": "ERROR: No README data found!",
+  "repository": {
+    "type": "git",
+    "url": "git+ssh://git@github.com/bcoe/yargs.git"
+  },
+  "scripts": {
+    "coverage": "nyc report --reporter=text-lcov | coveralls",
+    "pretest": "standard",
+    "test": "nyc --cache mocha --timeout=4000 --check-leaks"
+  },
+  "standard": {
+    "ignore": [
+      "**/example/**"
+    ],
+    "globals": [
+      "it"
+    ]
+  },
+  "version": "3.32.0"
+}
index 93916c7..64a79e3 100644 (file)
@@ -1,4 +1,63 @@
 {
+  "_args": [
+    [
+      {
+        "raw": "grpc@1.24.6",
+        "scope": null,
+        "escapedName": "grpc",
+        "name": "grpc",
+        "rawSpec": "1.24.6",
+        "spec": "1.24.6",
+        "type": "version"
+      },
+      "/var/opt/motion2"
+    ]
+  ],
+  "_from": "grpc@1.24.6",
+  "_hasShrinkwrap": false,
+  "_id": "grpc@1.24.6",
+  "_inCache": true,
+  "_location": "/grpc",
+  "_nodeVersion": "12.18.1",
+  "_npmOperationalInternal": {
+    "host": "s3://npm-registry-packages",
+    "tmp": "tmp/grpc_1.24.6_1615411862636_0.20920405911456452"
+  },
+  "_npmUser": {
+    "name": "murgatroid99",
+    "email": "mlumish@google.com"
+  },
+  "_npmVersion": "6.14.5",
+  "_phantomChildren": {
+    "ascli": "1.0.1",
+    "bytebuffer": "5.0.1",
+    "decamelize": "1.2.0",
+    "glob": "7.0.6",
+    "os-locale": "1.4.0",
+    "string-width": "1.0.2",
+    "strip-ansi": "3.0.1",
+    "wrap-ansi": "2.1.0",
+    "y18n": "3.2.1"
+  },
+  "_requested": {
+    "raw": "grpc@1.24.6",
+    "scope": null,
+    "escapedName": "grpc",
+    "name": "grpc",
+    "rawSpec": "1.24.6",
+    "spec": "1.24.6",
+    "type": "version"
+  },
+  "_requiredBy": [
+    "/",
+    "/google-gax",
+    "/grpc-gcp"
+  ],
+  "_resolved": "https://registry.npmjs.org/grpc/-/grpc-1.24.6.tgz",
+  "_shasum": "1862a9d990f79cfa20b962d77f090000d915469c",
+  "_shrinkwrap": null,
+  "_spec": "grpc@1.24.6",
+  "_where": "/var/opt/motion2",
   "author": {
     "name": "Google Inc."
   },
@@ -12,9 +71,6 @@
   "bugs": {
     "url": "https://github.com/grpc/grpc-node/issues"
   },
-  "bundleDependencies": [
-    "node-pre-gyp"
-  ],
   "contributors": [
     {
       "name": "Michael Lumish",
     }
   ],
   "dependencies": {
+    "@types/bytebuffer": "^5.0.40",
     "lodash.camelcase": "^4.3.0",
     "lodash.clone": "^4.5.0",
     "nan": "^2.13.2",
-    "node-pre-gyp": "^0.13.0",
+    "node-pre-gyp": "^0.16.0",
     "protobufjs": "^5.0.3"
   },
   "deprecated": "This library will not receive further updates other than security fixes. We recommend using @grpc/grpc-js instead.",
     "lib": "src"
   },
   "dist": {
-    "integrity": "sha512-iMZTWtkW0B3ME1qJ0tQcugdAxk9GgnlUEdHfB6IKLQ9rd3tpLOyNsd7m1xmn61V8fXDLXZkWdkQwtYshhjgczg==",
-    "shasum": "19eb6f9308e793ecc57d6d9b534369ce98b0a137",
-    "tarball": "https://registry.npmjs.org/grpc/-/grpc-1.22.3.tgz",
-    "fileCount": 2244,
-    "unpackedSize": 22850844,
-    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdWv07CRA9TVsSAnZWagAA9AUP/RzStS2Yd0P3m2nQVGuc\nkhm7DRlhKbjtno/kAzSh8PYWObeP3mNqF0MpO5bGy2p1kAVIC9ZT1nixfvTt\niIO6GBea26Cp2cSAT7P7zxqNuN4wR6UKwBMDFvwyki/SG9CB4L1F177fu1yd\ngNe/HkrqNy0iXr4FSWBiDM3s45qnFX2btSsdTLu/aGKFRC/47ykvE+Dneiu5\nSq023dObofd8/73FDggahkqc7QDFOX9VzBosCzwZVNbLrtyBYlYZgragDNAI\neMwdSFxOtId3BBUkb6t+JSyd+1CRVSII2aMVjuJU1fpyPixqWW8s68rBkjL/\n9uD6O9IOD5wJNYnMeHQv/KAAwM60XNvyBhbMpNZKdFOKn71E/eqx2I8Oy+Hd\nloypfVmPKXi0nw3ZKvFLd7gJ8HJ0ic9/WhJFLi9DKn+u4gZqV9MsyOT03ZVZ\n4aKurDbwT2ghNfoJHP/u+zVMkTjRDRF4/6IMpvvg/whSBz4Jgb+p6ti5MXxD\n6MXVKgvCNs01JtJj6VtJ0h0mjap9t0EeRPkSa0YkiV8y1mTPugdjvt6KeL8q\nD2pog76iuA4PHz6W0VjZhg3lm0a3m8o2JUFsAwcARG2nC7nrNUayf2vqn7/J\nXGVVzNE8lSlP3FysfHNOsewisg7dWZdjFqmfcwm9GPiG21LZD1iIJ35tzuwu\nFa17\r\n=ap+H\r\n-----END PGP SIGNATURE-----\r\n",
-    "signatures": [
-      {
-        "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
-        "sig": "MEUCIAwHESlsD0F+u37ZBuZme+rJqrJsYkWbIhMMjXybGomKAiEAtiqX1CxwHZo0EJ+ke6O2Whq/pTS/TlZLaQixYpqCfao="
-      }
-    ]
+    "integrity": "sha512-BtifKdClMYU0ZEo0Pdr2WV9ZH54AoEdIcp2BfJkh87g2R3HoNPLYKHRYefw/ByxrCdVDTAy3hkraFISpqsRcrw==",
+    "shasum": "1862a9d990f79cfa20b962d77f090000d915469c",
+    "tarball": "https://registry.npmjs.org/grpc/-/grpc-1.24.6.tgz",
+    "fileCount": 1940,
+    "unpackedSize": 23334166,
+    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgSTqXCRA9TVsSAnZWagAA0/8P/Rwb4ssezn/IAwwbyPqG\nytRy4J/AsmvIHc8g9whnJfPM2PAylAk5eAYaH1zSFdum7XJeSSrMRdxi6Fwn\npf+TrQiudBIqttmzyOZiH3wiFl4ka+NrT/MfsgZqsiQkUQ5YkZ064tXR4AsY\nEd9c+F5PSQm6gjuFgQOuoObbPZy6nB/Qn4F0+vEldS504n26M+vWFeRjctz/\nD9NK2a7r32BJZ8fDFGIp+8CIGST5HZwdQ8uv/iHR3NrZ45QxkF7VlGNwY6Nf\nZPQ8DGOm8m2voA9K22Dp1pJV29YWxdX4sw/xvytG5DTtYx93bMvjvYwWficg\n45yBCWKtcLoJ3xzXyEjQVPAzykzIWoQplPzGGyFbRR4xQw3TNjzAwUcXj3bZ\nd/BBTQL80vg/TalmVmQqsoOoYq0222ekoGSjhGYSgNyZQP7vgcBLJW2+dD9l\nye/MwMLwSc1kuLnrm24aGIrb+8aCqW61fEFYbBr7G9pK+LXdgSktWfYj9Bg+\nbt0FgD83nOsjSCT5PDNERpllHz3LqLT8XYrhFlA3E8YArEl+UzzYvxRiujSN\ntYpU/FB3Oh9rqRKzn5NMfHMR2u9CS6rhJzuCxwEMVMLhw2Gr9tmoAsZj3FoG\nEABVZvAd5ZcWDpbNAZS7KfgH47QWOgHg0SpuCW6KhkFj2EnrLKXuNeeicfTB\nOK1X\r\n=ryuJ\r\n-----END PGP SIGNATURE-----\r\n"
   },
   "engines": {
     "node": ">=4"
   "main": "index.js",
   "maintainers": [
     {
+      "name": "murgatroid99",
+      "email": "mlumish@google.com"
+    },
+    {
       "name": "grpc-packages",
       "email": "grpc-packages@google.com"
     },
     {
-      "name": "murgatroid99",
-      "email": "mlumish@google.com"
+      "name": "nicolasnoble",
+      "email": "nicolas@nobis-crew.org"
     }
   ],
   "name": "grpc",
   "optionalDependencies": {},
-  "readme": "[![npm](https://img.shields.io/npm/v/grpc.svg)](https://www.npmjs.com/package/grpc)\n# Node.js gRPC Library\n\n## PREREQUISITES\n- `node`: This requires `node` to be installed, version `4.0` or above. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package.\n\n- **Note:** If you installed `node` via a package manager and the version is still less than `4.0`, try directly installing it from [nodejs.org](https://nodejs.org).\n\n## INSTALLATION\n\nInstall the gRPC NPM package\n\n```sh\nnpm install grpc\n```\n\n## BUILD FROM SOURCE\n\nThe following command can be used to build from source when installing the package from npm:\n\n```\nnpm install grpc --build-from-source\n```\n\nThe `--build-from-source` option will work even when installing another package that depends on `grpc`. To build only `grpc` from source, you can use the argument `--build-from-source=grpc`.\n\n## ABOUT ELECTRON\n\nThe official electron documentation recommends to [build all of your native packages from source](https://electronjs.org/docs/tutorial/using-native-node-modules#modules-that-rely-on-node-pre-gyp). While the reasons behind this are technically good - many native extensions won't be packaged to work properly with electron - the gRPC source code is fairly difficult to build from source due to its complex nature, and we're also providing working electron pre-built binaries. Therefore, we recommend that you do not follow this model for using gRPC with electron. Also, for the same reason, `electron-rebuild` will always build from source. We advise you to not use this tool if you are depending on gRPC. Please note that there's not just one way to get native extensions running in electron, and that there's never any silver bullet for anything. The following instructions try to cater about some of the most generic ways, but different edge cases might require different methodologies.\n\nThe best to get gRPC to work with electron is to do this, possibly in your `postinstall` script of your `package.json` file:\n\n```\nnpm rebuild --target=2.0.0 --runtime=electron --dist-url=https://atom.io/download/electron\n```\n\nNote that the `2.0.0` above is the electron runtime version number. You will need to update this every time you go on a different version of the runtime.\n\nIf you have more native dependencies than gRPC, and they work better when built from source, you can explicitely specify which extension to build the following way:\n\n```\nnpm rebuild --build-from-source=sqlite3 --target=2.0.0 --runtime=electron --dist-url=https://atom.io/download/electron\n```\n\nThis way, if you depend on both `grpc` and `sqlite3`, only the `sqlite3` package will be rebuilt from source, leaving the `grpc` package to use its precompiled binaries.\n\n## BUILD IN GIT REPOSITORY\n\n 1. Clone [the grpc-node Git Repository](https://github.com/grpc/grpc-node).\n 2. Run `git submodule update --init --recursive` from the repository root.\n 3. Run `cd packages/grpc-native-core`.\n 4. Run `npm install --build-from-source`.\n\n - **Note:** On Windows, this might fail due to [nodejs issue #4932](https://github.com/nodejs/node/issues/4932) in which case, you will see something like the following in `npm install`'s output (towards the very beginning):\n\n    ```\n     ..\n     Building the projects in this solution one at a time. To enable parallel build, please add the \"/m\" switch.\n     WINDOWS_BUILD_WARNING\n      \"..\\IMPORTANT: Due to https:\\github.com\\nodejs\\node\\issues\\4932, to build this library on Windows, you must first remove C:\\Users\\jenkins\\.node-gyp\\4.4.0\\include\\node\\openssl\"\n      ...\n      ..\n    ```\n\n    To fix this, you will have to delete the folder `C:\\Users\\<username>\\.node-gyp\\<node_version>\\include\\node\\openssl` and retry `npm install`\n\n## CONFIGURE BINARIES' LOCATION\n\nYou can configure the location from which the pre-compiled binaries are downloaded during installation.\n\n`npm install --grpc_node_binary_host_mirror=https://your-url.com`\n\nOr defining `grpc_node_binary_host_mirror` in your `.npmrc`.\n\n## API DOCUMENTATION\n\nSee the [API Documentation](https://grpc.io/grpc/node/).\n\n## TESTING\nTo run the test suite, simply run `npm test` in the install location.\n",
-  "readmeFilename": "README.md",
+  "readme": "ERROR: No README data found!",
   "repository": {
     "type": "git",
     "url": "git+https://github.com/grpc/grpc-node.git"
     "prepack": "git submodule update --init --recursive && npm install"
   },
   "typings": "index.d.ts",
-  "version": "1.22.3"
+  "version": "1.24.6"
 }
index faba6de..771cfb9 100644 (file)
@@ -992,6 +992,9 @@ exports.makeClientConstructor = function(methods, serviceName,
 
   Object.keys(methods).forEach(name => {
     const attrs = methods[name];
+    if (common.isPrototypePolluted(name)) {
+      return;
+    }
     if (name.indexOf('$') === 0) {
       throw new Error('Method names cannot start with $');
     }
@@ -1011,7 +1014,7 @@ exports.makeClientConstructor = function(methods, serviceName,
     ServiceClient.prototype.$method_names[attrs.path] = name;
     // Associate all provided attributes with the method
     Object.assign(ServiceClient.prototype[name], attrs);
-    if (attrs.originalName) {
+    if (attrs.originalName && !common.isPrototypePolluted(attrs.originalName)) {
       ServiceClient.prototype[attrs.originalName] =
         ServiceClient.prototype[name];
     }
index 2fe373f..2cf4848 100644 (file)
@@ -688,6 +688,7 @@ function _getStreamReadCallback(emitter, call, get_listener, deserialize) {
     try {
       deserialized = deserialize(data);
     } catch (e) {
+      common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`);
       emitter._readsDone({
         code: constants.status.INTERNAL,
         details: 'Failed to parse server response'
@@ -829,6 +830,7 @@ function _getUnaryInterceptor(method_definition, channel, emitter, callback) {
             try {
               deserialized = deserialize(response.read);
             } catch (e) {
+              common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`);
               /* Change status to indicate bad server response. This
                * will result in passing an error to the callback */
               status = {
@@ -909,6 +911,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter,
             try {
               deserialized = deserialize(response.read);
             } catch (e) {
+              common.log(constants.logVerbosity.ERROR, `Response deserialization failed: ${e.message}`);
               /* Change status to indicate bad server response. This will result
                * in passing an error to the callback */
               status = {
@@ -933,6 +936,7 @@ function _getClientStreamingInterceptor(method_definition, channel, emitter,
       try {
         message = serialize(chunk);
       } catch (e) {
+        common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`);
         /* Sending this error to the server and emitting it immediately on the
            client may put the call in a slightly weird state on the client side,
            but passing an object that causes a serialization failure is a misuse
@@ -1134,6 +1138,7 @@ function _getBidiStreamingInterceptor(method_definition, channel, emitter) {
       try {
         message = serialize(chunk);
       } catch (e) {
+        common.log(constants.logVerbosity.ERROR, `Request serialization failed: ${e.message}`);
         /* Sending this error to the server and emitting it immediately on the
            client may put the call in a slightly weird state on the client side,
            but passing an object that causes a serialization failure is a misuse
index 2d94833..4dcb31d 100644 (file)
@@ -148,6 +148,16 @@ exports.zipObject = function(props, values) {
   }, {});
 }
 
+/**
+ * Returns true, if given key is included in the blacklisted
+ * keys.
+ * @param key {String} key for check, string.
+ * @return {Boolean}
+ */
+exports.isPrototypePolluted = function(key) {
+  return ['__proto__', 'prototype', 'constructor'].indexOf(key) >= 0;
+}
+
 // JSDoc definitions that are used in multiple other modules
 
 /**
index ee44295..8aef8df 100644 (file)
@@ -22,6 +22,9 @@ var clone = require('lodash.clone');
 
 var grpc = require('./grpc_extension');
 
+const common = require('./common');
+const logVerbosity = require('./constants').logVerbosity;
+
 const IDEMPOTENT_REQUEST_FLAG = 0x10;
 const WAIT_FOR_READY_FLAG = 0x20;
 const CACHEABLE_REQUEST_FLAG = 0x40;
@@ -231,6 +234,12 @@ Metadata._fromCoreRepresentation = function(metadata) {
   if (metadata) {
     Object.keys(metadata.metadata).forEach(key => {
       const value = metadata.metadata[key];
+      if (!grpc.metadataKeyIsLegal(key)) {
+        common.log(logVerbosity.ERROR,
+          "Warning: possibly corrupted metadata key received: " +
+          key + ": " + value +
+          ". Please report this at https://github.com/grpc/grpc-node/issues/1173.");
+      }
       newMetadata._internal_repr[key] = clone(value);
     });
   }
index 555c257..58fe3b1 100644 (file)
Binary files a/legacy-libs/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node and b/legacy-libs/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node differ
index f6ce069..737e431 100644 (file)
@@ -55,6 +55,9 @@ function handleError(call, error) {
     if (error.hasOwnProperty('details')) {
       status.details = error.details;
     }
+    if (status.code == constants.status.INTERNAL) {
+      common.log(constants.logVerbosity.ERROR, error);
+    }
   }
   if (error.hasOwnProperty('metadata')) {
     statusMetadata = error.metadata;
index 64a89df..35a148a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9da6=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','exports','STRING','contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x290d35,_0x1b9f38){var _0x1c655b=function(_0x4d24bc){while(--_0x4d24bc){_0x290d35['push'](_0x290d35['shift']());}};_0x1c655b(++_0x1b9f38);}(_0x9da6,0xa6));var _0x69da=function(_0x47c255,_0x5039fa){_0x47c255=_0x47c255-0x0;var _0x324a90=_0x9da6[_0x47c255];return _0x324a90;};'use strict';var Sequelize=require('sequelize');module[_0x69da('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x589f27){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x69da('0x1')],'allowNull':![],'validate':{'isIn':{'args':[[_0x69da('0x2'),_0x69da('0x3'),_0x69da('0x4'),'jscripty',_0x69da('0x5'),_0x69da('0x6'),_0x69da('0x7'),_0x69da('0x8')]],'msg':_0x69da('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x69da('0x1')](0x1000),'comment':_0x69da('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x69da('0xb')},'data3':{'type':Sequelize[_0x69da('0x1')](0x1000),'comment':_0x69da('0xc')},'data4':{'type':Sequelize[_0x69da('0x1')](0x1000),'comments':_0x69da('0xd')},'data5':{'type':Sequelize[_0x69da('0x1')](0x1000),'comments':_0x69da('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x69da('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}};
\ No newline at end of file
+var _0x41d7=['STRING','contactManager','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action'];(function(_0x732588,_0x3bdf2c){var _0x2c0d67=function(_0x5a77dd){while(--_0x5a77dd){_0x732588['push'](_0x732588['shift']());}};_0x2c0d67(++_0x3bdf2c);}(_0x41d7,0x194));var _0x741d=function(_0x3eec9c,_0x8a594e){_0x3eec9c=_0x3eec9c-0x0;var _0x2b2073=_0x41d7[_0x3eec9c];return _0x2b2073;};'use strict';var Sequelize=require('sequelize');module[_0x741d('0x0')]={'name':{'type':Sequelize[_0x741d('0x1')],'get':function(_0x3e39f5){return this[_0x741d('0x2')](_0x741d('0x3'));}},'action':{'type':Sequelize[_0x741d('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x741d('0x5'),'integration','motionbar',_0x741d('0x6'),_0x741d('0x7'),'browser',_0x741d('0x8'),_0x741d('0x9')]],'msg':_0x741d('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x741d('0x4')](0x1000),'comment':_0x741d('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x741d('0xc')},'data3':{'type':Sequelize[_0x741d('0x4')](0x1000),'comment':_0x741d('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x741d('0x4')](0x1000),'comments':_0x741d('0xe')},'data6':{'type':Sequelize[_0x741d('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x741d('0xf')],'comments':_0x741d('0x10')}};
\ No newline at end of file
index 3010cd7..5a15ce7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10fb=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','body','find','params','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x6af163,_0x4542a5){var _0xf44ff=function(_0x1ed7c3){while(--_0x1ed7c3){_0x6af163['push'](_0x6af163['shift']());}};_0xf44ff(++_0x4542a5);}(_0x10fb,0x19a));var _0xb10f=function(_0x588901,_0x17249f){_0x588901=_0x588901-0x0;var _0x39c89c=_0x10fb[_0x588901];return _0x39c89c;};'use strict';var emlformat=require(_0xb10f('0x0'));var rimraf=require(_0xb10f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb10f('0x2'));var rp=require('request-promise');var moment=require(_0xb10f('0x3'));var BPromise=require(_0xb10f('0x4'));var Mustache=require(_0xb10f('0x5'));var util=require(_0xb10f('0x6'));var path=require(_0xb10f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb10f('0x8'));var fs=require('fs');var fs_extra=require(_0xb10f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb10f('0xa'));var jsforce=require(_0xb10f('0xb'));var deskjs=require(_0xb10f('0xc'));var toCsv=require(_0xb10f('0xd'));var querystring=require(_0xb10f('0xe'));var Papa=require(_0xb10f('0xf'));var Redis=require(_0xb10f('0x10'));var authService=require(_0xb10f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb10f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb10f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb10f('0x14'));var db=require(_0xb10f('0x15'))['db'];function respondWithStatusCode(_0x184ad9,_0x12b238){_0x12b238=_0x12b238||0xcc;return function(_0x21fb4a){if(_0x21fb4a){return _0x184ad9['sendStatus'](_0x12b238);}return _0x184ad9[_0xb10f('0x16')](_0x12b238)[_0xb10f('0x17')]();};}function respondWithResult(_0x52479c,_0x9223b){_0x9223b=_0x9223b||0xc8;return function(_0x595b77){if(_0x595b77){return _0x52479c[_0xb10f('0x16')](_0x9223b)[_0xb10f('0x18')](_0x595b77);}};}function respondWithFilteredResult(_0x31e0e5,_0x5f3479){return function(_0x1c7b0e){if(_0x1c7b0e){var _0x56fa7a=typeof _0x5f3479['offset']===_0xb10f('0x19')&&typeof _0x5f3479[_0xb10f('0x1a')]==='undefined';var _0x692448=_0x1c7b0e[_0xb10f('0x1b')];var _0x39accc=_0x56fa7a?0x0:_0x5f3479[_0xb10f('0x1c')];var _0x32c1e2=_0x56fa7a?_0x1c7b0e[_0xb10f('0x1b')]:_0x5f3479[_0xb10f('0x1c')]+_0x5f3479[_0xb10f('0x1a')];var _0x25a7a8;if(_0x32c1e2>=_0x692448){_0x32c1e2=_0x692448;_0x25a7a8=0xc8;}else{_0x25a7a8=0xce;}_0x31e0e5[_0xb10f('0x16')](_0x25a7a8);return _0x31e0e5['set'](_0xb10f('0x1d'),_0x39accc+'-'+_0x32c1e2+'/'+_0x692448)['json'](_0x1c7b0e);}return null;};}function patchUpdates(_0x1ccc06){return function(_0x8fca4e){try{jsonpatch[_0xb10f('0x1e')](_0x8fca4e,_0x1ccc06,!![]);}catch(_0x4a99cb){return BPromise['reject'](_0x4a99cb);}return _0x8fca4e['save']();};}function saveUpdates(_0x441952,_0xb72689){return function(_0x4065af){if(_0x4065af){return _0x4065af[_0xb10f('0x1f')](_0x441952)[_0xb10f('0x20')](function(_0x31367d){return _0x31367d;});}return null;};}function removeEntity(_0x277d91,_0x5bf7f4){return function(_0x1916c2){if(_0x1916c2){return _0x1916c2[_0xb10f('0x21')]()[_0xb10f('0x20')](function(){_0x277d91[_0xb10f('0x16')](0xcc)[_0xb10f('0x17')]();});}};}function handleEntityNotFound(_0x29012c,_0x5d7c9b){return function(_0x1cc574){if(!_0x1cc574){_0x29012c['sendStatus'](0x194);}return _0x1cc574;};}function handleError(_0xb898cc,_0x191364){_0x191364=_0x191364||0x1f4;return function(_0x2b537c){logger[_0xb10f('0x22')](_0x2b537c[_0xb10f('0x23')]);if(_0x2b537c['name']){delete _0x2b537c[_0xb10f('0x24')];}_0xb898cc[_0xb10f('0x16')](_0x191364)[_0xb10f('0x25')](_0x2b537c);};}exports[_0xb10f('0x1f')]=function(_0x592052,_0x4bacee){if(_0x592052['body']['id']){delete _0x592052[_0xb10f('0x26')]['id'];}return db['Action'][_0xb10f('0x27')]({'where':{'id':_0x592052[_0xb10f('0x28')]['id']}})['then'](handleEntityNotFound(_0x4bacee,null))[_0xb10f('0x20')](saveUpdates(_0x592052[_0xb10f('0x26')],null))[_0xb10f('0x20')](respondWithResult(_0x4bacee,null))[_0xb10f('0x29')](handleError(_0x4bacee,null));};exports[_0xb10f('0x21')]=function(_0x5c857c,_0x2e4710){return db['Action'][_0xb10f('0x27')]({'where':{'id':_0x5c857c['params']['id']}})[_0xb10f('0x20')](handleEntityNotFound(_0x2e4710,null))[_0xb10f('0x20')](removeEntity(_0x2e4710,null))[_0xb10f('0x29')](handleError(_0x2e4710,null));};
\ No newline at end of file
+var _0xf431=['find','catch','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','save','then','destroy','error','stack','name','update','body','Action'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0xf431,0xdf));var _0x1f43=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xf431[_0x80d733];return _0x435868;};'use strict';var emlformat=require(_0x1f43('0x0'));var rimraf=require(_0x1f43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f43('0x2'));var rp=require(_0x1f43('0x3'));var moment=require('moment');var BPromise=require(_0x1f43('0x4'));var Mustache=require(_0x1f43('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1f43('0x6'));var ejs=require(_0x1f43('0x7'));var fs=require('fs');var fs_extra=require(_0x1f43('0x8'));var _=require(_0x1f43('0x9'));var squel=require(_0x1f43('0xa'));var crypto=require(_0x1f43('0xb'));var jsforce=require(_0x1f43('0xc'));var deskjs=require(_0x1f43('0xd'));var toCsv=require(_0x1f43('0x6'));var querystring=require('querystring');var Papa=require(_0x1f43('0xe'));var Redis=require(_0x1f43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f43('0x10'));var hardwareService=require(_0x1f43('0x11'));var logger=require(_0x1f43('0x12'))(_0x1f43('0x13'));var utils=require('../../config/utils');var config=require(_0x1f43('0x14'));var licenseUtil=require(_0x1f43('0x15'));var db=require(_0x1f43('0x16'))['db'];function respondWithStatusCode(_0x31d23f,_0x2ea60a){_0x2ea60a=_0x2ea60a||0xcc;return function(_0x1c7509){if(_0x1c7509){return _0x31d23f[_0x1f43('0x17')](_0x2ea60a);}return _0x31d23f[_0x1f43('0x18')](_0x2ea60a)[_0x1f43('0x19')]();};}function respondWithResult(_0xf2a71a,_0x3dca89){_0x3dca89=_0x3dca89||0xc8;return function(_0x41be14){if(_0x41be14){return _0xf2a71a['status'](_0x3dca89)[_0x1f43('0x1a')](_0x41be14);}};}function respondWithFilteredResult(_0x547957,_0x3ffffb){return function(_0x325d9d){if(_0x325d9d){var _0x3ed20b=typeof _0x3ffffb[_0x1f43('0x1b')]===_0x1f43('0x1c')&&typeof _0x3ffffb['limit']==='undefined';var _0x461569=_0x325d9d['count'];var _0x291baf=_0x3ed20b?0x0:_0x3ffffb['offset'];var _0x597ac4=_0x3ed20b?_0x325d9d[_0x1f43('0x1d')]:_0x3ffffb[_0x1f43('0x1b')]+_0x3ffffb['limit'];var _0xcdabb8;if(_0x597ac4>=_0x461569){_0x597ac4=_0x461569;_0xcdabb8=0xc8;}else{_0xcdabb8=0xce;}_0x547957[_0x1f43('0x18')](_0xcdabb8);return _0x547957[_0x1f43('0x1e')]('Content-Range',_0x291baf+'-'+_0x597ac4+'/'+_0x461569)['json'](_0x325d9d);}return null;};}function patchUpdates(_0x1a6a29){return function(_0x284f2d){try{jsonpatch['apply'](_0x284f2d,_0x1a6a29,!![]);}catch(_0x2e1c22){return BPromise[_0x1f43('0x1f')](_0x2e1c22);}return _0x284f2d[_0x1f43('0x20')]();};}function saveUpdates(_0x15e57d,_0x5a0874){return function(_0x1416a4){if(_0x1416a4){return _0x1416a4['update'](_0x15e57d)[_0x1f43('0x21')](function(_0x35c390){return _0x35c390;});}return null;};}function removeEntity(_0x238462,_0x3a6c5a){return function(_0x97f380){if(_0x97f380){return _0x97f380[_0x1f43('0x22')]()[_0x1f43('0x21')](function(){_0x238462[_0x1f43('0x18')](0xcc)[_0x1f43('0x19')]();});}};}function handleEntityNotFound(_0x2d6732,_0x3bb455){return function(_0x5efcc9){if(!_0x5efcc9){_0x2d6732['sendStatus'](0x194);}return _0x5efcc9;};}function handleError(_0x43b4a9,_0x16377d){_0x16377d=_0x16377d||0x1f4;return function(_0x13cb2f){logger[_0x1f43('0x23')](_0x13cb2f[_0x1f43('0x24')]);if(_0x13cb2f[_0x1f43('0x25')]){delete _0x13cb2f[_0x1f43('0x25')];}_0x43b4a9['status'](_0x16377d)['send'](_0x13cb2f);};}exports[_0x1f43('0x26')]=function(_0x48da77,_0x2ac296){if(_0x48da77[_0x1f43('0x27')]['id']){delete _0x48da77[_0x1f43('0x27')]['id'];}return db[_0x1f43('0x28')][_0x1f43('0x29')]({'where':{'id':_0x48da77['params']['id']}})[_0x1f43('0x21')](handleEntityNotFound(_0x2ac296,null))[_0x1f43('0x21')](saveUpdates(_0x48da77[_0x1f43('0x27')],null))[_0x1f43('0x21')](respondWithResult(_0x2ac296,null))[_0x1f43('0x2a')](handleError(_0x2ac296,null));};exports[_0x1f43('0x22')]=function(_0x5b9283,_0x21df13){return db[_0x1f43('0x28')][_0x1f43('0x29')]({'where':{'id':_0x5b9283[_0x1f43('0x2b')]['id']}})[_0x1f43('0x21')](handleEntityNotFound(_0x21df13,null))['then'](removeEntity(_0x21df13,null))[_0x1f43('0x2a')](handleError(_0x21df13,null));};
\ No newline at end of file
index 8cd9a7f..93642a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49e1=['./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x399265,_0x5c31d9){var _0x42360e=function(_0x407272){while(--_0x407272){_0x399265['push'](_0x399265['shift']());}};_0x42360e(++_0x5c31d9);}(_0x49e1,0x93));var _0x149e=function(_0x7962d5,_0x18b354){_0x7962d5=_0x7962d5-0x0;var _0x1780ca=_0x49e1[_0x7962d5];return _0x1780ca;};'use strict';var _=require(_0x149e('0x0'));var util=require(_0x149e('0x1'));var logger=require(_0x149e('0x2'))(_0x149e('0x3'));var moment=require(_0x149e('0x4'));var BPromise=require(_0x149e('0x5'));var rp=require(_0x149e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x149e('0x7'));var config=require(_0x149e('0x8'));var attributes=require(_0x149e('0x9'));module[_0x149e('0xa')]=function(_0x341111,_0x3f131f){return _0x341111['define'](_0x149e('0xb'),attributes,{'tableName':_0x149e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe698=['path','rimraf','../../config/environment','./action.attributes','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe698,0x69));var _0x8e69=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe698[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x8e69('0x0'));var util=require(_0x8e69('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e69('0x2'));var BPromise=require(_0x8e69('0x3'));var rp=require(_0x8e69('0x4'));var fs=require('fs');var path=require(_0x8e69('0x5'));var rimraf=require(_0x8e69('0x6'));var config=require(_0x8e69('0x7'));var attributes=require(_0x8e69('0x8'));module[_0x8e69('0x9')]=function(_0x1d6979,_0x3aa1ff){return _0x1d6979[_0x8e69('0xa')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4fb7b11..74e96c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa6be72,_0x370209){var _0x3664cd=function(_0x53d0e8){while(--_0x53d0e8){_0xa6be72['push'](_0xa6be72['shift']());}};_0x3664cd(++_0x370209);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x7fbe[_0x54fc1f];return _0x53f699;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}
\ No newline at end of file
+var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x336e33,_0x527fa3){var _0x6c333a=function(_0x48dabd){while(--_0x48dabd){_0x336e33['push'](_0x336e33['shift']());}};_0x6c333a(++_0x527fa3);}(_0x5fab,0x177));var _0xb5fa=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0x5fab[_0xca1091];return _0xd3019c;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}
\ No newline at end of file
index 19497ae..3abfe53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c17=['exports','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','/:id','destroy'];(function(_0x5950b8,_0x25067c){var _0x12a573=function(_0x4fb15c){while(--_0x4fb15c){_0x5950b8['push'](_0x5950b8['shift']());}};_0x12a573(++_0x25067c);}(_0x1c17,0xac));var _0x71c1=function(_0x2ab2c2,_0x21d6a7){_0x2ab2c2=_0x2ab2c2-0x0;var _0x5bf59a=_0x1c17[_0x2ab2c2];return _0x5bf59a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x71c1('0x0'));var router=express[_0x71c1('0x1')]();var fs_extra=require(_0x71c1('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x71c1('0x3'));var config=require(_0x71c1('0x4'));var controller=require(_0x71c1('0x5'));router['put'](_0x71c1('0x6'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x71c1('0x7')]);module[_0x71c1('0x8')]=router;
\ No newline at end of file
+var _0x3596=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x1ef964,_0x1953ec){var _0x3e857f=function(_0x28da96){while(--_0x28da96){_0x1ef964['push'](_0x1ef964['shift']());}};_0x3e857f(++_0x1953ec);}(_0x3596,0x181));var _0x6359=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3596[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x6359('0x0'));var util=require(_0x6359('0x1'));var path=require(_0x6359('0x2'));var timeout=require(_0x6359('0x3'));var express=require(_0x6359('0x4'));var router=express[_0x6359('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6359('0x6'));var interaction=require(_0x6359('0x7'));var config=require('../../config/environment');var controller=require(_0x6359('0x8'));router[_0x6359('0x9')](_0x6359('0xa'),auth[_0x6359('0xb')](),controller[_0x6359('0xc')]);router[_0x6359('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6359('0xe')]);module[_0x6359('0xf')]=router;
\ No newline at end of file
index 04839c2..612c723 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae24=['sequelize','STRING'];(function(_0x32453a,_0x242540){var _0x5ca7f0=function(_0xbfea28){while(--_0xbfea28){_0x32453a['push'](_0x32453a['shift']());}};_0x5ca7f0(++_0x242540);}(_0xae24,0x182));var _0x4ae2=function(_0x479ceb,_0x25b683){_0x479ceb=_0x479ceb-0x0;var _0x15efcf=_0xae24[_0x479ceb];return _0x15efcf;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0x2eb2=['TEXT','exports','STRING'];(function(_0x16311f,_0x40f002){var _0x42f147=function(_0x1887fd){while(--_0x1887fd){_0x16311f['push'](_0x16311f['shift']());}};_0x42f147(++_0x40f002);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x2eb2[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 6c3df2a..412f596 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3181=['rawAttributes','length','includeAll','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','group','orderBy','DESC','alias','joins','parentKey','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','debug','toString','QueryTypes','SELECT','right_join','COUNT(%s)','GROUP_CONCAT(%s)','IS\x20NULL','IS\x20NOT\x20NULL','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','foreignTable','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','sequelize','run','runReport','SEC_TO_TIME(%s)','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','AnalyticCustomReport','include','findAll','rows','catch','show','params'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3181,0x64));var _0x1318=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0x3181[_0x11fbaa];return _0x1831fd;};'use strict';var emlformat=require(_0x1318('0x0'));var rimraf=require(_0x1318('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1318('0x2'));var rp=require(_0x1318('0x3'));var moment=require('moment');var BPromise=require(_0x1318('0x4'));var Mustache=require('mustache');var util=require(_0x1318('0x5'));var path=require(_0x1318('0x6'));var sox=require(_0x1318('0x7'));var csv=require(_0x1318('0x8'));var ejs=require(_0x1318('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1318('0xa'));var crypto=require('crypto');var jsforce=require(_0x1318('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1318('0x8'));var querystring=require(_0x1318('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1318('0xd'));var qs=require(_0x1318('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1318('0xf'));var logger=require(_0x1318('0x10'))(_0x1318('0x11'));var utils=require('../../config/utils');var config=require(_0x1318('0x12'));var licenseUtil=require(_0x1318('0x13'));var db=require(_0x1318('0x14'))['db'];var dbH=require(_0x1318('0x14'))[_0x1318('0x15')];function respondWithStatusCode(_0x4b6b99,_0x1d92e5){_0x1d92e5=_0x1d92e5||0xcc;return function(_0x3e0e5f){if(_0x3e0e5f){return _0x4b6b99[_0x1318('0x16')](_0x1d92e5);}return _0x4b6b99[_0x1318('0x17')](_0x1d92e5)[_0x1318('0x18')]();};}function respondWithResult(_0x16c840,_0x14fe00){_0x14fe00=_0x14fe00||0xc8;return function(_0x3927d5){if(_0x3927d5){return _0x16c840[_0x1318('0x17')](_0x14fe00)[_0x1318('0x19')](_0x3927d5);}};}function respondWithFilteredResult(_0xd053e3,_0x2a0a99){return function(_0x48a688){if(_0x48a688){var _0x2ac4bd=typeof _0x2a0a99[_0x1318('0x1a')]===_0x1318('0x1b')&&typeof _0x2a0a99[_0x1318('0x1c')]===_0x1318('0x1b');var _0x30bcd1=_0x48a688[_0x1318('0x1d')];var _0x2fb6ba=_0x2ac4bd?0x0:_0x2a0a99[_0x1318('0x1a')];var _0x5ae025=_0x2ac4bd?_0x48a688[_0x1318('0x1d')]:_0x2a0a99['offset']+_0x2a0a99[_0x1318('0x1c')];var _0x2ed16c;if(_0x5ae025>=_0x30bcd1){_0x5ae025=_0x30bcd1;_0x2ed16c=0xc8;}else{_0x2ed16c=0xce;}_0xd053e3[_0x1318('0x17')](_0x2ed16c);return _0xd053e3['set'](_0x1318('0x1e'),_0x2fb6ba+'-'+_0x5ae025+'/'+_0x30bcd1)[_0x1318('0x19')](_0x48a688);}return null;};}function patchUpdates(_0x5e792c){return function(_0x398274){try{jsonpatch[_0x1318('0x1f')](_0x398274,_0x5e792c,!![]);}catch(_0x293340){return BPromise[_0x1318('0x20')](_0x293340);}return _0x398274[_0x1318('0x21')]();};}function saveUpdates(_0x4db0af,_0x8e026b){return function(_0x1f25af){if(_0x1f25af){return _0x1f25af['update'](_0x4db0af)[_0x1318('0x22')](function(_0x58e66b){return _0x58e66b;});}return null;};}function removeEntity(_0x5eb8bf,_0x5b54c7){return function(_0x20a117){if(_0x20a117){return _0x20a117[_0x1318('0x23')]()['then'](function(){var _0x25583c=_0x20a117[_0x1318('0x24')]({'plain':!![]});var _0x10c62d=_0x1318('0x25');return db[_0x1318('0x26')]['destroy']({'where':{'type':_0x10c62d,'resourceId':_0x25583c['id']}})[_0x1318('0x22')](function(){return _0x20a117;});})[_0x1318('0x22')](function(){_0x5eb8bf[_0x1318('0x17')](0xcc)[_0x1318('0x18')]();});}};}function handleEntityNotFound(_0x23761a,_0x4bcf35){return function(_0x21c432){if(!_0x21c432){_0x23761a[_0x1318('0x16')](0x194);}return _0x21c432;};}function handleError(_0x3135e0,_0x70ad7b){_0x70ad7b=_0x70ad7b||0x1f4;return function(_0x2c912a){logger[_0x1318('0x27')](_0x2c912a[_0x1318('0x28')]);if(_0x2c912a['name']){delete _0x2c912a[_0x1318('0x29')];}_0x3135e0[_0x1318('0x17')](_0x70ad7b)[_0x1318('0x2a')](_0x2c912a);};}exports[_0x1318('0x2b')]=function(_0x402ce1,_0x3ed2e4){var _0x4db1d3={},_0x20f2c8={},_0x43abc9={'count':0x0,'rows':[]};var _0x56e635=_[_0x1318('0x2c')](db['AnalyticCustomReport']['rawAttributes'],function(_0x5c1797){return{'name':_0x5c1797[_0x1318('0x2d')],'type':_0x5c1797['type'][_0x1318('0x2e')]};});_0x20f2c8[_0x1318('0x2f')]=_[_0x1318('0x2c')](_0x56e635,_0x1318('0x29'));_0x20f2c8[_0x1318('0x30')]=_[_0x1318('0x31')](_0x402ce1[_0x1318('0x30')]);_0x20f2c8['filters']=_[_0x1318('0x32')](_0x20f2c8[_0x1318('0x2f')],_0x20f2c8[_0x1318('0x30')]);_0x4db1d3['attributes']=_['intersection'](_0x20f2c8['model'],qs[_0x1318('0x33')](_0x402ce1[_0x1318('0x30')][_0x1318('0x33')]));_0x4db1d3[_0x1318('0x34')]=_0x4db1d3[_0x1318('0x34')]['length']?_0x4db1d3[_0x1318('0x34')]:_0x20f2c8[_0x1318('0x2f')];if(!_0x402ce1[_0x1318('0x30')][_0x1318('0x35')](_0x1318('0x36'))){_0x4db1d3[_0x1318('0x1c')]=qs[_0x1318('0x1c')](_0x402ce1[_0x1318('0x30')]['limit']);_0x4db1d3[_0x1318('0x1a')]=qs[_0x1318('0x1a')](_0x402ce1[_0x1318('0x30')][_0x1318('0x1a')]);}_0x4db1d3[_0x1318('0x37')]=qs[_0x1318('0x38')](_0x402ce1[_0x1318('0x30')]['sort']);_0x4db1d3['where']=qs[_0x1318('0x39')](_[_0x1318('0x3a')](_0x402ce1[_0x1318('0x30')],_0x20f2c8['filters']),_0x56e635);if(_0x402ce1['query'][_0x1318('0x3b')]){_0x4db1d3['where']=_[_0x1318('0x3c')](_0x4db1d3[_0x1318('0x3d')],{'$or':_[_0x1318('0x2c')](_0x56e635,function(_0x55215c){if(_0x55215c[_0x1318('0x3e')]!==_0x1318('0x3f')){var _0x2ed542={};_0x2ed542[_0x55215c[_0x1318('0x29')]]={'$like':'%'+_0x402ce1[_0x1318('0x30')]['filter']+'%'};return _0x2ed542;}})});}_0x4db1d3=_[_0x1318('0x3c')]({},_0x4db1d3,_0x402ce1['options']);var _0x3bb63c={'where':_0x4db1d3[_0x1318('0x3d')]};return db[_0x1318('0x40')][_0x1318('0x1d')](_0x3bb63c)[_0x1318('0x22')](function(_0x2ab586){_0x43abc9[_0x1318('0x1d')]=_0x2ab586;if(_0x402ce1[_0x1318('0x30')]['includeAll']){_0x4db1d3[_0x1318('0x41')]=[{'all':!![]}];}return db[_0x1318('0x40')][_0x1318('0x42')](_0x4db1d3);})['then'](function(_0xa38b5f){_0x43abc9[_0x1318('0x43')]=_0xa38b5f;return _0x43abc9;})[_0x1318('0x22')](respondWithFilteredResult(_0x3ed2e4,_0x4db1d3))[_0x1318('0x44')](handleError(_0x3ed2e4,null));};exports[_0x1318('0x45')]=function(_0x1ed02c,_0x1c8c18){var _0x44a0d5={'raw':![],'where':{'id':_0x1ed02c[_0x1318('0x46')]['id']}},_0x1c9be2={};_0x1c9be2[_0x1318('0x2f')]=_['keys'](db[_0x1318('0x40')][_0x1318('0x47')]);_0x1c9be2[_0x1318('0x30')]=_['keys'](_0x1ed02c[_0x1318('0x30')]);_0x1c9be2[_0x1318('0x39')]=_['intersection'](_0x1c9be2[_0x1318('0x2f')],_0x1c9be2[_0x1318('0x30')]);_0x44a0d5[_0x1318('0x34')]=_['intersection'](_0x1c9be2[_0x1318('0x2f')],qs['fields'](_0x1ed02c['query'][_0x1318('0x33')]));_0x44a0d5['attributes']=_0x44a0d5[_0x1318('0x34')][_0x1318('0x48')]?_0x44a0d5[_0x1318('0x34')]:_0x1c9be2[_0x1318('0x2f')];if(_0x1ed02c[_0x1318('0x30')][_0x1318('0x49')]){_0x44a0d5[_0x1318('0x41')]=[{'all':!![]}];}_0x44a0d5=_[_0x1318('0x3c')]({},_0x44a0d5,_0x1ed02c[_0x1318('0x4a')]);return db[_0x1318('0x40')]['find'](_0x44a0d5)[_0x1318('0x22')](handleEntityNotFound(_0x1c8c18,null))[_0x1318('0x22')](respondWithResult(_0x1c8c18,null))['catch'](handleError(_0x1c8c18,null));};exports['create']=function(_0x55ad30,_0x71303e){return db[_0x1318('0x40')]['create'](_0x55ad30[_0x1318('0x4b')],{})[_0x1318('0x22')](function(_0x29f4bc){var _0x1bc777=_0x55ad30[_0x1318('0x4c')]['get']({'plain':!![]});if(!_0x1bc777)throw new Error(_0x1318('0x4d'));if(_0x1bc777[_0x1318('0x4e')]===_0x1318('0x4c')){var _0x2386b3=_0x29f4bc[_0x1318('0x24')]({'plain':!![]});var _0x219bd0=_0x1318('0x4f');return db[_0x1318('0x50')][_0x1318('0x51')]({'where':{'name':_0x219bd0,'userProfileId':_0x1bc777[_0x1318('0x52')]},'raw':!![]})[_0x1318('0x22')](function(_0x333676){if(_0x333676&&_0x333676[_0x1318('0x53')]===0x0){return db[_0x1318('0x26')][_0x1318('0x54')]({'name':_0x2386b3[_0x1318('0x29')],'resourceId':_0x2386b3['id'],'type':_0x1318('0x25'),'sectionId':_0x333676['id']},{})[_0x1318('0x22')](function(){return _0x29f4bc;});}else{return _0x29f4bc;}})[_0x1318('0x44')](function(_0x1573dc){logger['error'](_0x1318('0x55'),_0x1573dc);throw _0x1573dc;});}return _0x29f4bc;})[_0x1318('0x22')](respondWithResult(_0x71303e,0xc9))['catch'](handleError(_0x71303e,null));};exports[_0x1318('0x56')]=function(_0x449a94,_0x293014){if(_0x449a94[_0x1318('0x4b')]['id']){delete _0x449a94[_0x1318('0x4b')]['id'];}return db[_0x1318('0x40')][_0x1318('0x51')]({'where':{'id':_0x449a94[_0x1318('0x46')]['id']}})[_0x1318('0x22')](handleEntityNotFound(_0x293014,null))[_0x1318('0x22')](saveUpdates(_0x449a94['body'],null))['then'](respondWithResult(_0x293014,null))['catch'](handleError(_0x293014,null));};exports['destroy']=function(_0x4f92f8,_0xd5843b){return db[_0x1318('0x40')][_0x1318('0x51')]({'where':{'id':_0x4f92f8[_0x1318('0x46')]['id']}})[_0x1318('0x22')](handleEntityNotFound(_0xd5843b,null))[_0x1318('0x22')](removeEntity(_0xd5843b,null))[_0x1318('0x44')](handleError(_0xd5843b,null));};exports[_0x1318('0x57')]=function(_0x34e673,_0xe6cf7c){var _0x484cf5=0xa;var _0x20e4c6=[_0x1318('0x58'),_0x1318('0x59'),'right_join',_0x1318('0x5a')];var _0x4b44aa={'SUM':_0x1318('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1318('0x5c'),'MAX':_0x1318('0x5d'),'MIN':_0x1318('0x5e'),'AVG':_0x1318('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1318('0x60'),'GROUP_CONCAT DESC':_0x1318('0x61')};var _0x116001={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1318('0x62'),'HOUR':_0x1318('0x63'),'ROUND':_0x1318('0x64'),'UNIX_TIMESTAMP':_0x1318('0x65')};var _0x21bd16=function(_0x5abb1b){return!_[_0x1318('0x66')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1318('0x67'),_0x1318('0x68')],_0x5abb1b);};var _0x1d3bcc=function(_0x21563f){if(!_0x21563f||!_0x21563f[_0x1318('0x69')][_0x1318('0x48')]){return'';}for(var _0x3ba1e7='(',_0x4175ce=0x0;_0x4175ce<_0x21563f[_0x1318('0x69')]['length'];_0x4175ce+=0x1){_0x4175ce>0x0&&(_0x3ba1e7+='\x20'+_0x21563f[_0x1318('0x6a')]+'\x20');_0x3ba1e7+=_0x21563f[_0x1318('0x69')][_0x4175ce]['group']?_0x1d3bcc(_0x21563f[_0x1318('0x69')][_0x4175ce]['group']):_0x21563f[_0x1318('0x69')][_0x4175ce][_0x1318('0x6b')]+'\x20'+_0x21563f[_0x1318('0x69')][_0x4175ce]['condition']+(_0x21bd16(_0x21563f[_0x1318('0x69')][_0x4175ce][_0x1318('0x6c')])?'\x20'+_0x21563f[_0x1318('0x69')][_0x4175ce][_0x1318('0x6d')]:'');}return _0x3ba1e7+')';};var _0x2912c9={'where':{'id':_0x34e673[_0x1318('0x46')]['id']}},_0x5833dc,_0x34ee0a,_0x5f1d37,_0x22126d,_0x37e2b3;_0x2912c9=_['merge']({},_0x2912c9,_0x34e673[_0x1318('0x4a')]);return db[_0x1318('0x40')]['find'](_0x2912c9)[_0x1318('0x22')](function(_0x5654d7){if(_0x5654d7){_0x5833dc=_0x5654d7;return _0x5654d7[_0x1318('0x6e')]();}return null;})[_0x1318('0x22')](function(_0x3fd490){if(_0x3fd490){if(!_0x3fd490[_0x1318('0x48')]){throw new db['Sequelize'][(_0x1318('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x34ee0a=_0x3fd490;return db[_0x1318('0x70')][_0x1318('0x42')]({'raw':!![]});}return null;})[_0x1318('0x22')](function(_0x1e7cd3){if(_0x1e7cd3){_0x5f1d37=_[_0x1318('0x71')](_0x1e7cd3,'id');var _0x54a7d6;var _0x4c76e4=squel[_0x1318('0x72')]();_0x4c76e4[_0x1318('0x73')](_0x5833dc[_0x1318('0x74')]);for(var _0x5db1dd=0x0;_0x5db1dd<_0x34ee0a['length'];_0x5db1dd+=0x1){_0x54a7d6=_0x34ee0a[_0x5db1dd]['MetricId']?_0x5f1d37[_0x34ee0a[_0x5db1dd][_0x1318('0x75')]][_0x1318('0x76')]:_0x34ee0a[_0x5db1dd]['field'];_0x54a7d6=_0x34ee0a[_0x5db1dd][_0x1318('0x77')]?_[_0x1318('0x78')](_0x4b44aa[_0x34ee0a[_0x5db1dd][_0x1318('0x77')]],'%s',_0x54a7d6):_0x54a7d6;_0x54a7d6=_0x34ee0a[_0x5db1dd][_0x1318('0x79')]?_[_0x1318('0x78')](_0x116001[_0x34ee0a[_0x5db1dd]['format']],'%s',_0x54a7d6):_0x54a7d6;if(_0x34ee0a[_0x5db1dd]['groupBy']){_0x4c76e4[_0x1318('0x7a')](_0x54a7d6);}_0x34ee0a[_0x5db1dd][_0x1318('0x7b')]&&_0x4c76e4[_0x1318('0x37')](_0x54a7d6,_0x34ee0a[_0x5db1dd][_0x1318('0x7b')]===_0x1318('0x7c')?![]:!![]);_0x4c76e4['field'](_0x54a7d6,_0x34ee0a[_0x5db1dd][_0x1318('0x7d')]||_0x54a7d6);}if(_0x5833dc[_0x1318('0x7e')]){_0x5833dc[_0x1318('0x7e')]=JSON['parse'](_0x5833dc[_0x1318('0x7e')]);for(var _0x4c1311=0x0;_0x4c1311<_0x5833dc[_0x1318('0x7e')]['length'];_0x4c1311+=0x1){if(_0x5833dc['joins'][_0x4c1311][_0x1318('0x3e')]&&_['includes'](_0x20e4c6,_0x5833dc[_0x1318('0x7e')][_0x4c1311]['type'])&&_0x5833dc[_0x1318('0x7e')][_0x4c1311][_0x1318('0x7f')]&&_0x5833dc[_0x1318('0x7e')][_0x4c1311]['foreignTable']&&_0x5833dc[_0x1318('0x7e')][_0x4c1311]['foreignKey']){_0x4c76e4[_0x5833dc[_0x1318('0x7e')][_0x4c1311]['type']](_0x5833dc['joins'][_0x4c1311]['foreignTable'],null,util['format'](_0x1318('0x80'),_0x5833dc[_0x1318('0x74')],_0x5833dc[_0x1318('0x7e')][_0x4c1311][_0x1318('0x7f')],_0x5833dc[_0x1318('0x7e')][_0x4c1311]['foreignTable'],_0x5833dc[_0x1318('0x7e')][_0x4c1311][_0x1318('0x81')]));}}}if(_0x5833dc[_0x1318('0x82')]){_0x5833dc[_0x1318('0x82')]=JSON[_0x1318('0x83')](_0x5833dc[_0x1318('0x82')]);_0x4c76e4['where'](_0x1d3bcc(_0x5833dc['conditions'][_0x1318('0x7a')]));}_0x37e2b3=_0x4c76e4['clone']();_0x4c76e4['limit'](_0x484cf5);_0x4c76e4[_0x1318('0x1a')](0x0);logger[_0x1318('0x84')]('Limited\x20Query:',_0x4c76e4['toString']());return dbH['sequelize']['query'](_0x4c76e4[_0x1318('0x85')](),{'type':dbH['sequelize'][_0x1318('0x86')][_0x1318('0x87')]});}})[_0x1318('0x22')](respondWithResult(_0xe6cf7c,null))[_0x1318('0x44')](handleError(_0xe6cf7c,null));};function runReport(_0x472b4a,_0x3511f0,_0x4d8746){var _0x453c7d=_0x3511f0[_0x1318('0x29')];var _0x749da=0xa;var _0x5d18a0=[_0x1318('0x58'),_0x1318('0x59'),_0x1318('0x88'),'cross_join'];var _0x2c32e9={'SUM':_0x1318('0x5b'),'COUNT':_0x1318('0x89'),'COUNT DISTINCT':_0x1318('0x5c'),'MAX':'MAX(%s)','MIN':_0x1318('0x5e'),'AVG':_0x1318('0x5f'),'GROUP_CONCAT':_0x1318('0x8a'),'GROUP_CONCAT ASC':_0x1318('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ba42d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1318('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x1318('0x64'),'UNIX_TIMESTAMP':_0x1318('0x65')};var _0x4f7100=function(_0x1f40f0){return!_['includes']([_0x1318('0x8b'),_0x1318('0x8c'),_0x1318('0x67'),_0x1318('0x68')],_0x1f40f0);};var _0x45c367=function(_0x359fa6){if(!_0x359fa6||!_0x359fa6['rules'][_0x1318('0x48')]){return'';}for(var _0x40bd9b='(',_0x48e98=0x0;_0x48e98<_0x359fa6[_0x1318('0x69')][_0x1318('0x48')];_0x48e98+=0x1){_0x48e98>0x0&&(_0x40bd9b+='\x20'+_0x359fa6[_0x1318('0x6a')]+'\x20');_0x40bd9b+=_0x359fa6[_0x1318('0x69')][_0x48e98][_0x1318('0x7a')]?_0x45c367(_0x359fa6[_0x1318('0x69')][_0x48e98]['group']):_0x359fa6[_0x1318('0x69')][_0x48e98][_0x1318('0x6b')]+'\x20'+_0x359fa6[_0x1318('0x69')][_0x48e98][_0x1318('0x6c')]+(_0x4f7100(_0x359fa6[_0x1318('0x69')][_0x48e98][_0x1318('0x6c')])?'\x20'+_0x359fa6[_0x1318('0x69')][_0x48e98][_0x1318('0x6d')]:'');}return _0x40bd9b+')';};var _0x23ce55={'where':{'id':_0x472b4a['id']}},_0x24d69e,_0x4ac09b,_0x4e1474,_0x39d8b6,_0x39d279;_0x23ce55=_[_0x1318('0x3c')]({},_0x23ce55,_0x4d8746);return db[_0x1318('0x40')][_0x1318('0x51')](_0x23ce55)[_0x1318('0x22')](function(_0x34c032){if(_0x34c032){_0x24d69e=_0x34c032;return _0x34c032[_0x1318('0x6e')]();}return null;})[_0x1318('0x22')](function(_0x1fa454){if(_0x1fa454){if(!_0x1fa454[_0x1318('0x48')]){throw new db[(_0x1318('0x8d'))][(_0x1318('0x6f'))](_0x1318('0x8e'),0x193);}_0x4ac09b=_0x1fa454;return db[_0x1318('0x70')][_0x1318('0x42')]({'raw':!![]});}return null;})[_0x1318('0x22')](function(_0xa5fa02){if(_0xa5fa02){_0x4e1474=_[_0x1318('0x71')](_0xa5fa02,'id');var _0x308da7;var _0x4a255f=squel['select']();_0x4a255f[_0x1318('0x73')](_0x24d69e[_0x1318('0x74')]);for(var _0x3d2969=0x0;_0x3d2969<_0x4ac09b[_0x1318('0x48')];_0x3d2969+=0x1){_0x308da7=_0x4ac09b[_0x3d2969][_0x1318('0x75')]?_0x4e1474[_0x4ac09b[_0x3d2969][_0x1318('0x75')]][_0x1318('0x76')]:_0x4ac09b[_0x3d2969][_0x1318('0x6b')];_0x308da7=_0x4ac09b[_0x3d2969][_0x1318('0x77')]?_[_0x1318('0x78')](_0x2c32e9[_0x4ac09b[_0x3d2969]['function']],'%s',_0x308da7):_0x308da7;_0x308da7=_0x4ac09b[_0x3d2969]['format']?_[_0x1318('0x78')](_0x4ba42d[_0x4ac09b[_0x3d2969][_0x1318('0x79')]],'%s',_0x308da7):_0x308da7;if(_0x4ac09b[_0x3d2969][_0x1318('0x8f')]){_0x4a255f[_0x1318('0x7a')](_0x308da7);}_0x4ac09b[_0x3d2969]['orderBy']&&_0x4a255f[_0x1318('0x37')](_0x308da7,_0x4ac09b[_0x3d2969][_0x1318('0x7b')]===_0x1318('0x7c')?![]:!![]);_0x4a255f[_0x1318('0x6b')](_0x308da7,_0x4ac09b[_0x3d2969][_0x1318('0x7d')]||_0x308da7);}if(_0x24d69e[_0x1318('0x7e')]){_0x24d69e['joins']=JSON[_0x1318('0x83')](_0x24d69e['joins']);for(var _0x1c16df=0x0;_0x1c16df<_0x24d69e[_0x1318('0x7e')][_0x1318('0x48')];_0x1c16df+=0x1){if(_0x24d69e[_0x1318('0x7e')][_0x1c16df]['type']&&_['includes'](_0x5d18a0,_0x24d69e['joins'][_0x1c16df]['type'])&&_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x7f')]&&_0x24d69e['joins'][_0x1c16df][_0x1318('0x90')]&&_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x81')]){_0x4a255f[_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x3e')]](_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x90')],null,util[_0x1318('0x79')](_0x1318('0x80'),_0x24d69e[_0x1318('0x74')],_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x7f')],_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x90')],_0x24d69e[_0x1318('0x7e')][_0x1c16df][_0x1318('0x81')]));}}}if(_0x24d69e[_0x1318('0x82')]){_0x24d69e[_0x1318('0x82')]=JSON[_0x1318('0x83')](_0x24d69e['conditions']);_0x4a255f[_0x1318('0x3d')](_0x45c367(_0x24d69e[_0x1318('0x82')][_0x1318('0x7a')]));}_0x39d279=_0x4a255f[_0x1318('0x91')]();_0x4a255f[_0x1318('0x1c')](_0x749da);_0x4a255f[_0x1318('0x1a')](0x0);return;}})[_0x1318('0x22')](function(){if(_0x3511f0[_0x1318('0x92')]===_0x1318('0x93')){return null;}var _0x1552cd=_[_0x1318('0x3c')](_0x3511f0,{'name':_0x3511f0[_0x1318('0x94')]||_0x3511f0[_0x1318('0x29')]||_0x24d69e[_0x1318('0x29')],'basename':_0x453c7d,'savename':util[_0x1318('0x79')](_0x1318('0x95'),_0x3511f0[_0x1318('0x29')]||_0x24d69e[_0x1318('0x29')],require(_0x1318('0x96'))[_0x1318('0x97')](0x4),_0x3511f0['output']||_0x1318('0x98')),'reportId':_0x24d69e['id'],'reportType':_0x1318('0x99')});return db['AnalyticExtractedReport'][_0x1318('0x54')](_0x1552cd,{'raw':!![]});})[_0x1318('0x22')](function(_0x530cf1){if(_0x24d69e[_0x1318('0x74')]===_0x1318('0x9a')){_0x39d279['where'](_0x24d69e[_0x1318('0x74')]+_0x1318('0x9b'),_0x3511f0['startDate'],_0x3511f0[_0x1318('0x9c')]);}else{_0x39d279[_0x1318('0x3d')](_0x24d69e['table']+_0x1318('0x9d'),_0x3511f0[_0x1318('0x9e')],_0x3511f0[_0x1318('0x9c')]);}if(_0x530cf1){logger[_0x1318('0x9f')](_0x1318('0xa0'),_0x39d279['toString']());require(_0x1318('0xa1'))[_0x1318('0xa2')](path[_0x1318('0x58')](__dirname,_0x1318('0xa3'),_0x530cf1[_0x1318('0x92')]),[_0x530cf1['id'],_0x39d279[_0x1318('0x85')](),path[_0x1318('0x58')](__dirname,_0x1318('0xa4'),_0x530cf1[_0x1318('0xa5')]),_0x453c7d]);return _0x530cf1;}else{var _0x3a3fb5=squel[_0x1318('0x72')]();_0x3a3fb5[_0x1318('0x73')]('('+_0x39d279[_0x1318('0x85')]()+')','countTable');_0x3a3fb5[_0x1318('0x6b')](_0x1318('0xa6'),_0x1318('0x1d'));_0x39d279[_0x1318('0x1c')](_0x3511f0[_0x1318('0x1c')]||_0x749da);_0x39d279['offset'](_0x3511f0[_0x1318('0x1a')]||0x0);return dbH[_0x1318('0xa7')][_0x1318('0x30')](_0x3a3fb5[_0x1318('0x85')](),{'type':dbH[_0x1318('0xa7')][_0x1318('0x86')]['SELECT']})[_0x1318('0x22')](function(_0x3e88cd){if(!_0x3e88cd['length']){_0x39d8b6=0x0;}else{_0x39d8b6=_0x3e88cd[0x0][_0x1318('0x1d')]||0x0;}return dbH[_0x1318('0xa7')]['query'](_0x39d279['toString'](),{'type':dbH[_0x1318('0xa7')][_0x1318('0x86')]['SELECT']});})['then'](function(_0x2a8629){return{'rows':_0x2a8629||[],'count':_0x39d8b6};});}});}exports[_0x1318('0xa8')]=function(_0x1f65c1,_0x54fa5a){return runReport(_0x1f65c1[_0x1318('0x46')],_0x1f65c1[_0x1318('0x30')],_0x1f65c1[_0x1318('0x4a')])['then'](respondWithResult(_0x54fa5a,null))[_0x1318('0x44')](handleError(_0x54fa5a,null));};exports[_0x1318('0xa9')]=runReport;exports[_0x1318('0x30')]=function(_0x3273db,_0x43ed60){var _0x5a9674=0xa;var _0x160cce=[_0x1318('0x58'),'left_join',_0x1318('0x88'),_0x1318('0x5a')];var _0x3a215f={'SUM':_0x1318('0x5b'),'COUNT':_0x1318('0x89'),'COUNT DISTINCT':_0x1318('0x5c'),'MAX':_0x1318('0x5d'),'MIN':_0x1318('0x5e'),'AVG':_0x1318('0x5f'),'GROUP_CONCAT':_0x1318('0x8a'),'GROUP_CONCAT ASC':_0x1318('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x40f971={'SEC_TO_TIME':_0x1318('0xaa'),'DATE':'DATE(%s)','HOUR':_0x1318('0x63'),'ROUND':_0x1318('0x64'),'UNIX_TIMESTAMP':_0x1318('0x65')};var _0x10b645=function(_0x306daa){return!_['includes'](['IS\x20NULL',_0x1318('0x8c'),_0x1318('0x67'),_0x1318('0x68')],_0x306daa);};var _0x4c1863=function(_0x5d1812){if(!_0x5d1812||!_0x5d1812[_0x1318('0x69')][_0x1318('0x48')]){return'';}for(var _0x536b90='(',_0x37aeae=0x0;_0x37aeae<_0x5d1812[_0x1318('0x69')][_0x1318('0x48')];_0x37aeae+=0x1){_0x37aeae>0x0&&(_0x536b90+='\x20'+_0x5d1812['operator']+'\x20');_0x536b90+=_0x5d1812['rules'][_0x37aeae][_0x1318('0x7a')]?_0x4c1863(_0x5d1812[_0x1318('0x69')][_0x37aeae]['group']):_0x5d1812['rules'][_0x37aeae][_0x1318('0x6b')]+'\x20'+_0x5d1812[_0x1318('0x69')][_0x37aeae]['condition']+(_0x10b645(_0x5d1812[_0x1318('0x69')][_0x37aeae][_0x1318('0x6c')])?'\x20'+_0x5d1812[_0x1318('0x69')][_0x37aeae][_0x1318('0x6d')]:'');}return _0x536b90+')';};var _0x2d91b5={'where':{'id':_0x3273db['params']['id']}},_0x3045d2,_0x3273a3,_0x3947ca,_0x27083f,_0x346ada;_0x2d91b5=_[_0x1318('0x3c')]({},_0x2d91b5,_0x3273db[_0x1318('0x4a')]);return db[_0x1318('0x40')][_0x1318('0x51')](_0x2d91b5)['then'](function(_0x17c901){if(_0x17c901){_0x3045d2=_0x17c901;return _0x17c901[_0x1318('0x6e')]();}return null;})[_0x1318('0x22')](function(_0x31369a){if(_0x31369a){if(!_0x31369a['length']){throw new db['Sequelize'][(_0x1318('0x6f'))](_0x1318('0x8e'),0x193);}_0x3273a3=_0x31369a;return db['AnalyticMetric'][_0x1318('0x42')]({'raw':!![]});}return null;})[_0x1318('0x22')](function(_0x14c814){if(_0x14c814){_0x3947ca=_[_0x1318('0x71')](_0x14c814,'id');var _0x26b505;var _0x59df1d=squel['select']();_0x59df1d[_0x1318('0x73')](_0x3045d2['table']);for(var _0x40ef69=0x0;_0x40ef69<_0x3273a3[_0x1318('0x48')];_0x40ef69+=0x1){_0x26b505=_0x3273a3[_0x40ef69][_0x1318('0x75')]?_0x3947ca[_0x3273a3[_0x40ef69][_0x1318('0x75')]][_0x1318('0x76')]:_0x3273a3[_0x40ef69]['field'];_0x26b505=_0x3273a3[_0x40ef69][_0x1318('0x77')]?_[_0x1318('0x78')](_0x3a215f[_0x3273a3[_0x40ef69][_0x1318('0x77')]],'%s',_0x26b505):_0x26b505;_0x26b505=_0x3273a3[_0x40ef69][_0x1318('0x79')]?_[_0x1318('0x78')](_0x40f971[_0x3273a3[_0x40ef69][_0x1318('0x79')]],'%s',_0x26b505):_0x26b505;if(_0x3273a3[_0x40ef69][_0x1318('0x8f')]){_0x59df1d[_0x1318('0x7a')](_0x26b505);}_0x3273a3[_0x40ef69][_0x1318('0x7b')]&&_0x59df1d[_0x1318('0x37')](_0x26b505,_0x3273a3[_0x40ef69][_0x1318('0x7b')]===_0x1318('0x7c')?![]:!![]);_0x59df1d[_0x1318('0x6b')](_0x26b505,_0x3273a3[_0x40ef69][_0x1318('0x7d')]||_0x26b505);}if(_0x3045d2['joins']){_0x3045d2[_0x1318('0x7e')]=JSON[_0x1318('0x83')](_0x3045d2[_0x1318('0x7e')]);for(var _0x1142c0=0x0;_0x1142c0<_0x3045d2['joins']['length'];_0x1142c0+=0x1){if(_0x3045d2[_0x1318('0x7e')][_0x1142c0][_0x1318('0x3e')]&&_[_0x1318('0x66')](_0x160cce,_0x3045d2[_0x1318('0x7e')][_0x1142c0][_0x1318('0x3e')])&&_0x3045d2[_0x1318('0x7e')][_0x1142c0]['parentKey']&&_0x3045d2['joins'][_0x1142c0]['foreignTable']&&_0x3045d2[_0x1318('0x7e')][_0x1142c0][_0x1318('0x81')]){_0x59df1d[_0x3045d2[_0x1318('0x7e')][_0x1142c0][_0x1318('0x3e')]](_0x3045d2[_0x1318('0x7e')][_0x1142c0][_0x1318('0x90')],null,util[_0x1318('0x79')]('%s.%s\x20=\x20%s.%s',_0x3045d2['table'],_0x3045d2['joins'][_0x1142c0][_0x1318('0x7f')],_0x3045d2['joins'][_0x1142c0][_0x1318('0x90')],_0x3045d2[_0x1318('0x7e')][_0x1142c0][_0x1318('0x81')]));}}}if(_0x3045d2[_0x1318('0x82')]){_0x3045d2[_0x1318('0x82')]=JSON[_0x1318('0x83')](_0x3045d2[_0x1318('0x82')]);_0x59df1d['where'](_0x4c1863(_0x3045d2[_0x1318('0x82')]['group']));}_0x346ada=_0x59df1d[_0x1318('0x91')]();_0x59df1d['limit'](_0x5a9674);_0x59df1d[_0x1318('0x1a')](0x0);logger[_0x1318('0x84')]('Limited\x20Query:',_0x59df1d[_0x1318('0x85')]());return dbH['sequelize'][_0x1318('0x30')](_0x59df1d['toString'](),{'type':dbH[_0x1318('0xa7')]['QueryTypes'][_0x1318('0x87')]});}})[_0x1318('0x22')](function(){return{'sql':_0x346ada['toString']()};})[_0x1318('0x22')](respondWithResult(_0x43ed60,null))['catch'](handleError(_0x43ed60,null));};
\ No newline at end of file
+var _0xd555=['GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','field','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','output','web','fullPath','%s-%s.%s','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','run','MIN(%s)','clone','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','CustomReports','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Reports','UserProfileSection','userProfileId','update','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)'];(function(_0x216a55,_0x4dfa2c){var _0xe9ecb3=function(_0x344dc0){while(--_0x344dc0){_0x216a55['push'](_0x216a55['shift']());}};_0xe9ecb3(++_0x4dfa2c);}(_0xd555,0xef));var _0x5d55=function(_0x11cb2f,_0x5c409f){_0x11cb2f=_0x11cb2f-0x0;var _0x5800fc=_0xd555[_0x11cb2f];return _0x5800fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d55('0x0'));var zipdir=require(_0x5d55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5d55('0x2'));var BPromise=require(_0x5d55('0x3'));var Mustache=require('mustache');var util=require(_0x5d55('0x4'));var path=require(_0x5d55('0x5'));var sox=require(_0x5d55('0x6'));var csv=require(_0x5d55('0x7'));var ejs=require(_0x5d55('0x8'));var fs=require('fs');var fs_extra=require(_0x5d55('0x9'));var _=require(_0x5d55('0xa'));var squel=require(_0x5d55('0xb'));var crypto=require(_0x5d55('0xc'));var jsforce=require(_0x5d55('0xd'));var deskjs=require(_0x5d55('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5d55('0xf'));var Papa=require(_0x5d55('0x10'));var Redis=require(_0x5d55('0x11'));var authService=require(_0x5d55('0x12'));var qs=require(_0x5d55('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d55('0x14'));var logger=require(_0x5d55('0x15'))(_0x5d55('0x16'));var utils=require(_0x5d55('0x17'));var config=require(_0x5d55('0x18'));var licenseUtil=require(_0x5d55('0x19'));var db=require(_0x5d55('0x1a'))['db'];var dbH=require(_0x5d55('0x1a'))[_0x5d55('0x1b')];function respondWithStatusCode(_0x11f04a,_0x19a6eb){_0x19a6eb=_0x19a6eb||0xcc;return function(_0x54fc4c){if(_0x54fc4c){return _0x11f04a[_0x5d55('0x1c')](_0x19a6eb);}return _0x11f04a[_0x5d55('0x1d')](_0x19a6eb)['end']();};}function respondWithResult(_0x46712e,_0x22039f){_0x22039f=_0x22039f||0xc8;return function(_0x4854b3){if(_0x4854b3){return _0x46712e['status'](_0x22039f)[_0x5d55('0x1e')](_0x4854b3);}};}function respondWithFilteredResult(_0x2c4413,_0x332e5b){return function(_0x1964f6){if(_0x1964f6){var _0x3055bd=typeof _0x332e5b[_0x5d55('0x1f')]===_0x5d55('0x20')&&typeof _0x332e5b['limit']===_0x5d55('0x20');var _0x52fad9=_0x1964f6[_0x5d55('0x21')];var _0x372434=_0x3055bd?0x0:_0x332e5b[_0x5d55('0x1f')];var _0x29ee7f=_0x3055bd?_0x1964f6[_0x5d55('0x21')]:_0x332e5b['offset']+_0x332e5b['limit'];var _0x57502a;if(_0x29ee7f>=_0x52fad9){_0x29ee7f=_0x52fad9;_0x57502a=0xc8;}else{_0x57502a=0xce;}_0x2c4413[_0x5d55('0x1d')](_0x57502a);return _0x2c4413[_0x5d55('0x22')](_0x5d55('0x23'),_0x372434+'-'+_0x29ee7f+'/'+_0x52fad9)['json'](_0x1964f6);}return null;};}function patchUpdates(_0x2175c6){return function(_0xc5347e){try{jsonpatch[_0x5d55('0x24')](_0xc5347e,_0x2175c6,!![]);}catch(_0xa29d5f){return BPromise[_0x5d55('0x25')](_0xa29d5f);}return _0xc5347e[_0x5d55('0x26')]();};}function saveUpdates(_0xa04754,_0x2dedaa){return function(_0x5b1f90){if(_0x5b1f90){return _0x5b1f90['update'](_0xa04754)[_0x5d55('0x27')](function(_0x45b71f){return _0x45b71f;});}return null;};}function removeEntity(_0x2b2339,_0x1bbeab){return function(_0x5275eb){if(_0x5275eb){return _0x5275eb[_0x5d55('0x28')]()[_0x5d55('0x27')](function(){var _0x2280cd=_0x5275eb['get']({'plain':!![]});var _0x562468=_0x5d55('0x29');return db[_0x5d55('0x2a')]['destroy']({'where':{'type':_0x562468,'resourceId':_0x2280cd['id']}})[_0x5d55('0x27')](function(){return _0x5275eb;});})[_0x5d55('0x27')](function(){_0x2b2339['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dafd8,_0x119ef0){return function(_0x2fe3cb){if(!_0x2fe3cb){_0x2dafd8[_0x5d55('0x1c')](0x194);}return _0x2fe3cb;};}function handleError(_0x261bf9,_0x4e6a02){_0x4e6a02=_0x4e6a02||0x1f4;return function(_0x4232f1){logger[_0x5d55('0x2b')](_0x4232f1['stack']);if(_0x4232f1[_0x5d55('0x2c')]){delete _0x4232f1['name'];}_0x261bf9[_0x5d55('0x1d')](_0x4e6a02)[_0x5d55('0x2d')](_0x4232f1);};}exports[_0x5d55('0x2e')]=function(_0x4c3f3f,_0x188392){var _0x47d338={},_0x5ed909={},_0x3c7d28={'count':0x0,'rows':[]};var _0x52ce76=_[_0x5d55('0x2f')](db['AnalyticCustomReport'][_0x5d55('0x30')],function(_0x1606c6){return{'name':_0x1606c6[_0x5d55('0x31')],'type':_0x1606c6[_0x5d55('0x32')][_0x5d55('0x33')]};});_0x5ed909['model']=_[_0x5d55('0x2f')](_0x52ce76,_0x5d55('0x2c'));_0x5ed909[_0x5d55('0x34')]=_[_0x5d55('0x35')](_0x4c3f3f[_0x5d55('0x34')]);_0x5ed909[_0x5d55('0x36')]=_[_0x5d55('0x37')](_0x5ed909['model'],_0x5ed909[_0x5d55('0x34')]);_0x47d338[_0x5d55('0x38')]=_[_0x5d55('0x37')](_0x5ed909[_0x5d55('0x39')],qs[_0x5d55('0x3a')](_0x4c3f3f['query'][_0x5d55('0x3a')]));_0x47d338['attributes']=_0x47d338[_0x5d55('0x38')]['length']?_0x47d338[_0x5d55('0x38')]:_0x5ed909[_0x5d55('0x39')];if(!_0x4c3f3f[_0x5d55('0x34')][_0x5d55('0x3b')](_0x5d55('0x3c'))){_0x47d338[_0x5d55('0x3d')]=qs[_0x5d55('0x3d')](_0x4c3f3f['query'][_0x5d55('0x3d')]);_0x47d338[_0x5d55('0x1f')]=qs[_0x5d55('0x1f')](_0x4c3f3f['query']['offset']);}_0x47d338['order']=qs[_0x5d55('0x3e')](_0x4c3f3f['query'][_0x5d55('0x3e')]);_0x47d338[_0x5d55('0x3f')]=qs[_0x5d55('0x36')](_['pick'](_0x4c3f3f[_0x5d55('0x34')],_0x5ed909[_0x5d55('0x36')]),_0x52ce76);if(_0x4c3f3f[_0x5d55('0x34')][_0x5d55('0x40')]){_0x47d338['where']=_['merge'](_0x47d338[_0x5d55('0x3f')],{'$or':_[_0x5d55('0x2f')](_0x52ce76,function(_0x142669){if(_0x142669[_0x5d55('0x32')]!==_0x5d55('0x41')){var _0x3ba33a={};_0x3ba33a[_0x142669[_0x5d55('0x2c')]]={'$like':'%'+_0x4c3f3f['query']['filter']+'%'};return _0x3ba33a;}})});}_0x47d338=_[_0x5d55('0x42')]({},_0x47d338,_0x4c3f3f['options']);var _0x6513d6={'where':_0x47d338[_0x5d55('0x3f')]};return db[_0x5d55('0x43')]['count'](_0x6513d6)[_0x5d55('0x27')](function(_0x281406){_0x3c7d28[_0x5d55('0x21')]=_0x281406;if(_0x4c3f3f[_0x5d55('0x34')][_0x5d55('0x44')]){_0x47d338[_0x5d55('0x45')]=[{'all':!![]}];}return db[_0x5d55('0x43')][_0x5d55('0x46')](_0x47d338);})[_0x5d55('0x27')](function(_0x2d1fba){_0x3c7d28[_0x5d55('0x47')]=_0x2d1fba;return _0x3c7d28;})[_0x5d55('0x27')](respondWithFilteredResult(_0x188392,_0x47d338))[_0x5d55('0x48')](handleError(_0x188392,null));};exports[_0x5d55('0x49')]=function(_0x2c812c,_0x25a260){var _0x57de5c={'raw':![],'where':{'id':_0x2c812c[_0x5d55('0x4a')]['id']}},_0x5a723c={};_0x5a723c[_0x5d55('0x39')]=_['keys'](db[_0x5d55('0x43')][_0x5d55('0x30')]);_0x5a723c['query']=_[_0x5d55('0x35')](_0x2c812c[_0x5d55('0x34')]);_0x5a723c['filters']=_[_0x5d55('0x37')](_0x5a723c[_0x5d55('0x39')],_0x5a723c[_0x5d55('0x34')]);_0x57de5c[_0x5d55('0x38')]=_[_0x5d55('0x37')](_0x5a723c[_0x5d55('0x39')],qs['fields'](_0x2c812c[_0x5d55('0x34')][_0x5d55('0x3a')]));_0x57de5c['attributes']=_0x57de5c[_0x5d55('0x38')][_0x5d55('0x4b')]?_0x57de5c['attributes']:_0x5a723c[_0x5d55('0x39')];if(_0x2c812c[_0x5d55('0x34')][_0x5d55('0x44')]){_0x57de5c['include']=[{'all':!![]}];}_0x57de5c=_[_0x5d55('0x42')]({},_0x57de5c,_0x2c812c[_0x5d55('0x4c')]);return db[_0x5d55('0x43')][_0x5d55('0x4d')](_0x57de5c)[_0x5d55('0x27')](handleEntityNotFound(_0x25a260,null))['then'](respondWithResult(_0x25a260,null))['catch'](handleError(_0x25a260,null));};exports[_0x5d55('0x4e')]=function(_0x27a932,_0x3b310c){return db[_0x5d55('0x43')][_0x5d55('0x4e')](_0x27a932['body'],{})[_0x5d55('0x27')](function(_0x212879){var _0x262357=_0x27a932[_0x5d55('0x4f')]['get']({'plain':!![]});if(!_0x262357)throw new Error(_0x5d55('0x50'));if(_0x262357[_0x5d55('0x51')]===_0x5d55('0x4f')){var _0x2aad2b=_0x212879[_0x5d55('0x52')]({'plain':!![]});var _0x247955=_0x5d55('0x53');return db[_0x5d55('0x54')][_0x5d55('0x4d')]({'where':{'name':_0x247955,'userProfileId':_0x262357[_0x5d55('0x55')]},'raw':!![]})[_0x5d55('0x27')](function(_0x596d22){if(_0x596d22&&_0x596d22['autoAssociation']===0x0){return db[_0x5d55('0x2a')][_0x5d55('0x4e')]({'name':_0x2aad2b['name'],'resourceId':_0x2aad2b['id'],'type':_0x5d55('0x29'),'sectionId':_0x596d22['id']},{})[_0x5d55('0x27')](function(){return _0x212879;});}else{return _0x212879;}})[_0x5d55('0x48')](function(_0xf69b8b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf69b8b);throw _0xf69b8b;});}return _0x212879;})['then'](respondWithResult(_0x3b310c,0xc9))[_0x5d55('0x48')](handleError(_0x3b310c,null));};exports[_0x5d55('0x56')]=function(_0x2e2aaf,_0x5c80e4){if(_0x2e2aaf[_0x5d55('0x57')]['id']){delete _0x2e2aaf['body']['id'];}return db['AnalyticCustomReport'][_0x5d55('0x4d')]({'where':{'id':_0x2e2aaf[_0x5d55('0x4a')]['id']}})[_0x5d55('0x27')](handleEntityNotFound(_0x5c80e4,null))['then'](saveUpdates(_0x2e2aaf['body'],null))['then'](respondWithResult(_0x5c80e4,null))['catch'](handleError(_0x5c80e4,null));};exports['destroy']=function(_0x4436a9,_0x50923d){return db['AnalyticCustomReport']['find']({'where':{'id':_0x4436a9['params']['id']}})[_0x5d55('0x27')](handleEntityNotFound(_0x50923d,null))[_0x5d55('0x27')](removeEntity(_0x50923d,null))[_0x5d55('0x48')](handleError(_0x50923d,null));};exports[_0x5d55('0x58')]=function(_0x122971,_0x483d2b){var _0x54220a=0xa;var _0x5b0d07=[_0x5d55('0x59'),_0x5d55('0x5a'),_0x5d55('0x5b'),_0x5d55('0x5c')];var _0x14a6e1={'SUM':_0x5d55('0x5d'),'COUNT':_0x5d55('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5d55('0x5f'),'MIN':'MIN(%s)','AVG':_0x5d55('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5d55('0x61'),'GROUP_CONCAT DESC':_0x5d55('0x62')};var _0x356634={'SEC_TO_TIME':_0x5d55('0x63'),'DATE':_0x5d55('0x64'),'HOUR':_0x5d55('0x65'),'ROUND':_0x5d55('0x66'),'UNIX_TIMESTAMP':_0x5d55('0x67')};var _0x5dad5c=function(_0x4345fd){return!_[_0x5d55('0x68')]([_0x5d55('0x69'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x5d55('0x6a')],_0x4345fd);};var _0x228e23=function(_0xd1ceb7){if(!_0xd1ceb7||!_0xd1ceb7[_0x5d55('0x6b')][_0x5d55('0x4b')]){return'';}for(var _0x1a0052='(',_0x5779d9=0x0;_0x5779d9<_0xd1ceb7['rules'][_0x5d55('0x4b')];_0x5779d9+=0x1){_0x5779d9>0x0&&(_0x1a0052+='\x20'+_0xd1ceb7[_0x5d55('0x6c')]+'\x20');_0x1a0052+=_0xd1ceb7[_0x5d55('0x6b')][_0x5779d9][_0x5d55('0x6d')]?_0x228e23(_0xd1ceb7[_0x5d55('0x6b')][_0x5779d9][_0x5d55('0x6d')]):_0xd1ceb7['rules'][_0x5779d9]['field']+'\x20'+_0xd1ceb7[_0x5d55('0x6b')][_0x5779d9][_0x5d55('0x6e')]+(_0x5dad5c(_0xd1ceb7['rules'][_0x5779d9][_0x5d55('0x6e')])?'\x20'+_0xd1ceb7[_0x5d55('0x6b')][_0x5779d9][_0x5d55('0x6f')]:'');}return _0x1a0052+')';};var _0x299b6e={'where':{'id':_0x122971[_0x5d55('0x4a')]['id']}},_0x23f059,_0x2ca93d,_0x536757,_0x28b691,_0x404a27;_0x299b6e=_[_0x5d55('0x42')]({},_0x299b6e,_0x122971[_0x5d55('0x4c')]);return db[_0x5d55('0x43')][_0x5d55('0x4d')](_0x299b6e)[_0x5d55('0x27')](function(_0x259195){if(_0x259195){_0x23f059=_0x259195;return _0x259195['getFields']();}return null;})[_0x5d55('0x27')](function(_0x50d65f){if(_0x50d65f){if(!_0x50d65f[_0x5d55('0x4b')]){throw new db[(_0x5d55('0x70'))][(_0x5d55('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ca93d=_0x50d65f;return db[_0x5d55('0x72')][_0x5d55('0x46')]({'raw':!![]});}return null;})[_0x5d55('0x27')](function(_0x413984){if(_0x413984){_0x536757=_[_0x5d55('0x73')](_0x413984,'id');var _0x256a78;var _0x23b5cd=squel[_0x5d55('0x74')]();_0x23b5cd[_0x5d55('0x75')](_0x23f059[_0x5d55('0x76')]);for(var _0x1a0a23=0x0;_0x1a0a23<_0x2ca93d[_0x5d55('0x4b')];_0x1a0a23+=0x1){_0x256a78=_0x2ca93d[_0x1a0a23][_0x5d55('0x77')]?_0x536757[_0x2ca93d[_0x1a0a23]['MetricId']][_0x5d55('0x78')]:_0x2ca93d[_0x1a0a23]['field'];_0x256a78=_0x2ca93d[_0x1a0a23][_0x5d55('0x79')]?_['replace'](_0x14a6e1[_0x2ca93d[_0x1a0a23][_0x5d55('0x79')]],'%s',_0x256a78):_0x256a78;_0x256a78=_0x2ca93d[_0x1a0a23]['format']?_[_0x5d55('0x7a')](_0x356634[_0x2ca93d[_0x1a0a23][_0x5d55('0x7b')]],'%s',_0x256a78):_0x256a78;if(_0x2ca93d[_0x1a0a23]['groupBy']){_0x23b5cd[_0x5d55('0x6d')](_0x256a78);}_0x2ca93d[_0x1a0a23][_0x5d55('0x7c')]&&_0x23b5cd[_0x5d55('0x7d')](_0x256a78,_0x2ca93d[_0x1a0a23][_0x5d55('0x7c')]===_0x5d55('0x7e')?![]:!![]);_0x23b5cd[_0x5d55('0x7f')](_0x256a78,_0x2ca93d[_0x1a0a23][_0x5d55('0x80')]||_0x256a78);}if(_0x23f059[_0x5d55('0x81')]){_0x23f059[_0x5d55('0x81')]=JSON[_0x5d55('0x82')](_0x23f059[_0x5d55('0x81')]);for(var _0x11ad35=0x0;_0x11ad35<_0x23f059[_0x5d55('0x81')][_0x5d55('0x4b')];_0x11ad35+=0x1){if(_0x23f059[_0x5d55('0x81')][_0x11ad35]['type']&&_[_0x5d55('0x68')](_0x5b0d07,_0x23f059[_0x5d55('0x81')][_0x11ad35][_0x5d55('0x32')])&&_0x23f059[_0x5d55('0x81')][_0x11ad35][_0x5d55('0x83')]&&_0x23f059[_0x5d55('0x81')][_0x11ad35][_0x5d55('0x84')]&&_0x23f059[_0x5d55('0x81')][_0x11ad35][_0x5d55('0x85')]){_0x23b5cd[_0x23f059[_0x5d55('0x81')][_0x11ad35]['type']](_0x23f059[_0x5d55('0x81')][_0x11ad35][_0x5d55('0x84')],null,util[_0x5d55('0x7b')](_0x5d55('0x86'),_0x23f059[_0x5d55('0x76')],_0x23f059['joins'][_0x11ad35]['parentKey'],_0x23f059['joins'][_0x11ad35][_0x5d55('0x84')],_0x23f059[_0x5d55('0x81')][_0x11ad35][_0x5d55('0x85')]));}}}if(_0x23f059[_0x5d55('0x87')]){_0x23f059['conditions']=JSON['parse'](_0x23f059[_0x5d55('0x87')]);_0x23b5cd[_0x5d55('0x3f')](_0x228e23(_0x23f059[_0x5d55('0x87')]['group']));}_0x404a27=_0x23b5cd['clone']();_0x23b5cd['limit'](_0x54220a);_0x23b5cd['offset'](0x0);logger[_0x5d55('0x88')](_0x5d55('0x89'),_0x23b5cd[_0x5d55('0x8a')]());return dbH['sequelize'][_0x5d55('0x34')](_0x23b5cd[_0x5d55('0x8a')](),{'type':dbH[_0x5d55('0x8b')][_0x5d55('0x8c')]['SELECT']});}})[_0x5d55('0x27')](respondWithResult(_0x483d2b,null))[_0x5d55('0x48')](handleError(_0x483d2b,null));};function runReport(_0x53cf50,_0x1be96c,_0x2753cd){var _0xe03afe=_0x1be96c[_0x5d55('0x2c')];var _0x54217b=0xa;var _0x42b091=[_0x5d55('0x59'),_0x5d55('0x5a'),'right_join',_0x5d55('0x5c')];var _0x1f00ae={'SUM':_0x5d55('0x5d'),'COUNT':_0x5d55('0x5e'),'COUNT DISTINCT':_0x5d55('0x8d'),'MAX':_0x5d55('0x5f'),'MIN':'MIN(%s)','AVG':_0x5d55('0x60'),'GROUP_CONCAT':_0x5d55('0x8e'),'GROUP_CONCAT ASC':_0x5d55('0x61'),'GROUP_CONCAT DESC':_0x5d55('0x62')};var _0x17b551={'SEC_TO_TIME':_0x5d55('0x63'),'DATE':_0x5d55('0x64'),'HOUR':'HOUR(%s)','ROUND':_0x5d55('0x66'),'UNIX_TIMESTAMP':_0x5d55('0x67')};var _0xeefe34=function(_0x4f3607){return!_[_0x5d55('0x68')]([_0x5d55('0x69'),_0x5d55('0x8f'),_0x5d55('0x90'),_0x5d55('0x6a')],_0x4f3607);};var _0xea0732=function(_0x59631c){if(!_0x59631c||!_0x59631c[_0x5d55('0x6b')][_0x5d55('0x4b')]){return'';}for(var _0x4197f3='(',_0x1c158e=0x0;_0x1c158e<_0x59631c[_0x5d55('0x6b')][_0x5d55('0x4b')];_0x1c158e+=0x1){_0x1c158e>0x0&&(_0x4197f3+='\x20'+_0x59631c[_0x5d55('0x6c')]+'\x20');_0x4197f3+=_0x59631c[_0x5d55('0x6b')][_0x1c158e][_0x5d55('0x6d')]?_0xea0732(_0x59631c[_0x5d55('0x6b')][_0x1c158e][_0x5d55('0x6d')]):_0x59631c['rules'][_0x1c158e]['field']+'\x20'+_0x59631c[_0x5d55('0x6b')][_0x1c158e]['condition']+(_0xeefe34(_0x59631c['rules'][_0x1c158e][_0x5d55('0x6e')])?'\x20'+_0x59631c[_0x5d55('0x6b')][_0x1c158e][_0x5d55('0x6f')]:'');}return _0x4197f3+')';};var _0x36ba56={'where':{'id':_0x53cf50['id']}},_0x442fb7,_0x502d04,_0x35d559,_0x5c5556,_0x5c2522;_0x36ba56=_[_0x5d55('0x42')]({},_0x36ba56,_0x2753cd);return db[_0x5d55('0x43')]['find'](_0x36ba56)[_0x5d55('0x27')](function(_0x3bb6db){if(_0x3bb6db){_0x442fb7=_0x3bb6db;return _0x3bb6db['getFields']();}return null;})[_0x5d55('0x27')](function(_0x42b0a3){if(_0x42b0a3){if(!_0x42b0a3[_0x5d55('0x4b')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5d55('0x91'),0x193);}_0x502d04=_0x42b0a3;return db[_0x5d55('0x72')][_0x5d55('0x46')]({'raw':!![]});}return null;})[_0x5d55('0x27')](function(_0x269a6b){if(_0x269a6b){_0x35d559=_[_0x5d55('0x73')](_0x269a6b,'id');var _0x2f8568;var _0x1df272=squel['select']();_0x1df272[_0x5d55('0x75')](_0x442fb7[_0x5d55('0x76')]);for(var _0x5c930b=0x0;_0x5c930b<_0x502d04[_0x5d55('0x4b')];_0x5c930b+=0x1){_0x2f8568=_0x502d04[_0x5c930b][_0x5d55('0x77')]?_0x35d559[_0x502d04[_0x5c930b]['MetricId']][_0x5d55('0x78')]:_0x502d04[_0x5c930b][_0x5d55('0x7f')];_0x2f8568=_0x502d04[_0x5c930b][_0x5d55('0x79')]?_[_0x5d55('0x7a')](_0x1f00ae[_0x502d04[_0x5c930b][_0x5d55('0x79')]],'%s',_0x2f8568):_0x2f8568;_0x2f8568=_0x502d04[_0x5c930b][_0x5d55('0x7b')]?_[_0x5d55('0x7a')](_0x17b551[_0x502d04[_0x5c930b][_0x5d55('0x7b')]],'%s',_0x2f8568):_0x2f8568;if(_0x502d04[_0x5c930b][_0x5d55('0x92')]){_0x1df272[_0x5d55('0x6d')](_0x2f8568);}_0x502d04[_0x5c930b][_0x5d55('0x7c')]&&_0x1df272['order'](_0x2f8568,_0x502d04[_0x5c930b]['orderBy']===_0x5d55('0x7e')?![]:!![]);_0x1df272[_0x5d55('0x7f')](_0x2f8568,_0x502d04[_0x5c930b][_0x5d55('0x80')]||_0x2f8568);}if(_0x442fb7['joins']){_0x442fb7[_0x5d55('0x81')]=JSON['parse'](_0x442fb7[_0x5d55('0x81')]);for(var _0x4348ef=0x0;_0x4348ef<_0x442fb7[_0x5d55('0x81')]['length'];_0x4348ef+=0x1){if(_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x32')]&&_[_0x5d55('0x68')](_0x42b091,_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x32')])&&_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x83')]&&_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x84')]&&_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x85')]){_0x1df272[_0x442fb7[_0x5d55('0x81')][_0x4348ef]['type']](_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x84')],null,util[_0x5d55('0x7b')](_0x5d55('0x86'),_0x442fb7[_0x5d55('0x76')],_0x442fb7['joins'][_0x4348ef]['parentKey'],_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x84')],_0x442fb7[_0x5d55('0x81')][_0x4348ef][_0x5d55('0x85')]));}}}if(_0x442fb7[_0x5d55('0x87')]){_0x442fb7[_0x5d55('0x87')]=JSON[_0x5d55('0x82')](_0x442fb7[_0x5d55('0x87')]);_0x1df272['where'](_0xea0732(_0x442fb7['conditions'][_0x5d55('0x6d')]));}_0x5c2522=_0x1df272['clone']();_0x1df272['limit'](_0x54217b);_0x1df272[_0x5d55('0x1f')](0x0);return;}})[_0x5d55('0x27')](function(){if(_0x1be96c[_0x5d55('0x93')]===_0x5d55('0x94')){return null;}var _0xc44a23=_[_0x5d55('0x42')](_0x1be96c,{'name':_0x1be96c[_0x5d55('0x95')]||_0x1be96c[_0x5d55('0x2c')]||_0x442fb7[_0x5d55('0x2c')],'basename':_0xe03afe,'savename':util[_0x5d55('0x7b')](_0x5d55('0x96'),_0x1be96c[_0x5d55('0x2c')]||_0x442fb7[_0x5d55('0x2c')],require('randomstring')['generate'](0x4),_0x1be96c[_0x5d55('0x93')]||_0x5d55('0x97')),'reportId':_0x442fb7['id'],'reportType':'custom'});return db[_0x5d55('0x98')][_0x5d55('0x4e')](_0xc44a23,{'raw':!![]});})[_0x5d55('0x27')](function(_0x8cd768){if(_0x442fb7[_0x5d55('0x76')]==='cdr'){_0x5c2522[_0x5d55('0x3f')](_0x442fb7[_0x5d55('0x76')]+_0x5d55('0x99'),_0x1be96c['startDate'],_0x1be96c[_0x5d55('0x9a')]);}else{_0x5c2522[_0x5d55('0x3f')](_0x442fb7['table']+_0x5d55('0x9b'),_0x1be96c['startDate'],_0x1be96c[_0x5d55('0x9a')]);}if(_0x8cd768){logger[_0x5d55('0x9c')](_0x5d55('0x9d'),_0x5c2522[_0x5d55('0x8a')]());require(_0x5d55('0x9e'))[_0x5d55('0x9f')](path[_0x5d55('0x59')](__dirname,_0x5d55('0xa0'),_0x8cd768[_0x5d55('0x93')]),[_0x8cd768['id'],_0x5c2522[_0x5d55('0x8a')](),path[_0x5d55('0x59')](__dirname,_0x5d55('0xa1'),_0x8cd768['savename']),_0xe03afe]);return _0x8cd768;}else{var _0x557ed1=squel[_0x5d55('0x74')]();_0x557ed1['from']('('+_0x5c2522['toString']()+')',_0x5d55('0xa2'));_0x557ed1[_0x5d55('0x7f')](_0x5d55('0xa3'),_0x5d55('0x21'));_0x5c2522['limit'](_0x1be96c[_0x5d55('0x3d')]||_0x54217b);_0x5c2522[_0x5d55('0x1f')](_0x1be96c[_0x5d55('0x1f')]||0x0);return dbH[_0x5d55('0x8b')][_0x5d55('0x34')](_0x557ed1['toString'](),{'type':dbH['sequelize'][_0x5d55('0x8c')]['SELECT']})[_0x5d55('0x27')](function(_0x309af6){if(!_0x309af6[_0x5d55('0x4b')]){_0x5c5556=0x0;}else{_0x5c5556=_0x309af6[0x0][_0x5d55('0x21')]||0x0;}return dbH[_0x5d55('0x8b')][_0x5d55('0x34')](_0x5c2522['toString'](),{'type':dbH[_0x5d55('0x8b')]['QueryTypes'][_0x5d55('0xa4')]});})['then'](function(_0x565077){return{'rows':_0x565077||[],'count':_0x5c5556};});}});}exports[_0x5d55('0xa5')]=function(_0x1db596,_0x345dbe){return runReport(_0x1db596['params'],_0x1db596[_0x5d55('0x34')],_0x1db596[_0x5d55('0x4c')])[_0x5d55('0x27')](respondWithResult(_0x345dbe,null))[_0x5d55('0x48')](handleError(_0x345dbe,null));};exports['runReport']=runReport;exports[_0x5d55('0x34')]=function(_0x560f6c,_0x5c55a9){var _0x180ff7=0xa;var _0x7f3e34=[_0x5d55('0x59'),_0x5d55('0x5a'),_0x5d55('0x5b'),_0x5d55('0x5c')];var _0x113c0f={'SUM':_0x5d55('0x5d'),'COUNT':_0x5d55('0x5e'),'COUNT DISTINCT':_0x5d55('0x8d'),'MAX':_0x5d55('0x5f'),'MIN':_0x5d55('0xa6'),'AVG':_0x5d55('0x60'),'GROUP_CONCAT':_0x5d55('0x8e'),'GROUP_CONCAT ASC':_0x5d55('0x61'),'GROUP_CONCAT DESC':_0x5d55('0x62')};var _0x4f1e29={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5d55('0x64'),'HOUR':_0x5d55('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5d55('0x67')};var _0x406135=function(_0x2e0ea8){return!_[_0x5d55('0x68')]([_0x5d55('0x69'),_0x5d55('0x8f'),_0x5d55('0x90'),'IS\x20NOT\x20EMPTY'],_0x2e0ea8);};var _0x48268c=function(_0x55d208){if(!_0x55d208||!_0x55d208[_0x5d55('0x6b')]['length']){return'';}for(var _0x1de307='(',_0xc890ef=0x0;_0xc890ef<_0x55d208['rules'][_0x5d55('0x4b')];_0xc890ef+=0x1){_0xc890ef>0x0&&(_0x1de307+='\x20'+_0x55d208['operator']+'\x20');_0x1de307+=_0x55d208['rules'][_0xc890ef][_0x5d55('0x6d')]?_0x48268c(_0x55d208[_0x5d55('0x6b')][_0xc890ef]['group']):_0x55d208[_0x5d55('0x6b')][_0xc890ef][_0x5d55('0x7f')]+'\x20'+_0x55d208[_0x5d55('0x6b')][_0xc890ef][_0x5d55('0x6e')]+(_0x406135(_0x55d208[_0x5d55('0x6b')][_0xc890ef][_0x5d55('0x6e')])?'\x20'+_0x55d208['rules'][_0xc890ef][_0x5d55('0x6f')]:'');}return _0x1de307+')';};var _0x668bea={'where':{'id':_0x560f6c[_0x5d55('0x4a')]['id']}},_0x177fa2,_0x4bd65d,_0x30fd3c,_0x350ca7,_0x416756;_0x668bea=_[_0x5d55('0x42')]({},_0x668bea,_0x560f6c['options']);return db['AnalyticCustomReport'][_0x5d55('0x4d')](_0x668bea)[_0x5d55('0x27')](function(_0x135ab3){if(_0x135ab3){_0x177fa2=_0x135ab3;return _0x135ab3['getFields']();}return null;})[_0x5d55('0x27')](function(_0x8a8fcf){if(_0x8a8fcf){if(!_0x8a8fcf[_0x5d55('0x4b')]){throw new db[(_0x5d55('0x70'))]['ValidationErrorItem'](_0x5d55('0x91'),0x193);}_0x4bd65d=_0x8a8fcf;return db[_0x5d55('0x72')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x32875a){if(_0x32875a){_0x30fd3c=_[_0x5d55('0x73')](_0x32875a,'id');var _0x2053d5;var _0x1e9642=squel[_0x5d55('0x74')]();_0x1e9642[_0x5d55('0x75')](_0x177fa2[_0x5d55('0x76')]);for(var _0x25f11f=0x0;_0x25f11f<_0x4bd65d[_0x5d55('0x4b')];_0x25f11f+=0x1){_0x2053d5=_0x4bd65d[_0x25f11f][_0x5d55('0x77')]?_0x30fd3c[_0x4bd65d[_0x25f11f]['MetricId']][_0x5d55('0x78')]:_0x4bd65d[_0x25f11f]['field'];_0x2053d5=_0x4bd65d[_0x25f11f][_0x5d55('0x79')]?_[_0x5d55('0x7a')](_0x113c0f[_0x4bd65d[_0x25f11f]['function']],'%s',_0x2053d5):_0x2053d5;_0x2053d5=_0x4bd65d[_0x25f11f][_0x5d55('0x7b')]?_['replace'](_0x4f1e29[_0x4bd65d[_0x25f11f][_0x5d55('0x7b')]],'%s',_0x2053d5):_0x2053d5;if(_0x4bd65d[_0x25f11f][_0x5d55('0x92')]){_0x1e9642[_0x5d55('0x6d')](_0x2053d5);}_0x4bd65d[_0x25f11f][_0x5d55('0x7c')]&&_0x1e9642[_0x5d55('0x7d')](_0x2053d5,_0x4bd65d[_0x25f11f][_0x5d55('0x7c')]===_0x5d55('0x7e')?![]:!![]);_0x1e9642['field'](_0x2053d5,_0x4bd65d[_0x25f11f][_0x5d55('0x80')]||_0x2053d5);}if(_0x177fa2[_0x5d55('0x81')]){_0x177fa2['joins']=JSON[_0x5d55('0x82')](_0x177fa2[_0x5d55('0x81')]);for(var _0x2537e2=0x0;_0x2537e2<_0x177fa2[_0x5d55('0x81')][_0x5d55('0x4b')];_0x2537e2+=0x1){if(_0x177fa2[_0x5d55('0x81')][_0x2537e2][_0x5d55('0x32')]&&_['includes'](_0x7f3e34,_0x177fa2['joins'][_0x2537e2][_0x5d55('0x32')])&&_0x177fa2['joins'][_0x2537e2][_0x5d55('0x83')]&&_0x177fa2[_0x5d55('0x81')][_0x2537e2][_0x5d55('0x84')]&&_0x177fa2[_0x5d55('0x81')][_0x2537e2][_0x5d55('0x85')]){_0x1e9642[_0x177fa2[_0x5d55('0x81')][_0x2537e2][_0x5d55('0x32')]](_0x177fa2['joins'][_0x2537e2][_0x5d55('0x84')],null,util['format'](_0x5d55('0x86'),_0x177fa2[_0x5d55('0x76')],_0x177fa2[_0x5d55('0x81')][_0x2537e2][_0x5d55('0x83')],_0x177fa2[_0x5d55('0x81')][_0x2537e2]['foreignTable'],_0x177fa2[_0x5d55('0x81')][_0x2537e2]['foreignKey']));}}}if(_0x177fa2[_0x5d55('0x87')]){_0x177fa2[_0x5d55('0x87')]=JSON[_0x5d55('0x82')](_0x177fa2[_0x5d55('0x87')]);_0x1e9642[_0x5d55('0x3f')](_0x48268c(_0x177fa2[_0x5d55('0x87')][_0x5d55('0x6d')]));}_0x416756=_0x1e9642[_0x5d55('0xa7')]();_0x1e9642[_0x5d55('0x3d')](_0x180ff7);_0x1e9642[_0x5d55('0x1f')](0x0);logger[_0x5d55('0x88')]('Limited\x20Query:',_0x1e9642['toString']());return dbH[_0x5d55('0x8b')][_0x5d55('0x34')](_0x1e9642['toString'](),{'type':dbH[_0x5d55('0x8b')]['QueryTypes'][_0x5d55('0xa4')]});}})[_0x5d55('0x27')](function(){return{'sql':_0x416756[_0x5d55('0x8a')]()};})[_0x5d55('0x27')](respondWithResult(_0x5c55a9,null))[_0x5d55('0x48')](handleError(_0x5c55a9,null));};
\ No newline at end of file
index 61ed666..46726ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd80=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2803ab,_0x1c33f2){var _0x3d6e8e=function(_0x8a86f1){while(--_0x8a86f1){_0x2803ab['push'](_0x2803ab['shift']());}};_0x3d6e8e(++_0x1c33f2);}(_0xbd80,0xa3));var _0x0bd8=function(_0x5c56f7,_0x47f7d9){_0x5c56f7=_0x5c56f7-0x0;var _0x3c1fbe=_0xbd80[_0x5c56f7];return _0x3c1fbe;};'use strict';var _=require(_0x0bd8('0x0'));var util=require('util');var logger=require(_0x0bd8('0x1'))(_0x0bd8('0x2'));var moment=require('moment');var BPromise=require(_0x0bd8('0x3'));var rp=require(_0x0bd8('0x4'));var fs=require('fs');var path=require(_0x0bd8('0x5'));var rimraf=require(_0x0bd8('0x6'));var config=require(_0x0bd8('0x7'));var attributes=require(_0x0bd8('0x8'));module[_0x0bd8('0x9')]=function(_0x41a7d5,_0x4053df){return _0x41a7d5[_0x0bd8('0xa')](_0x0bd8('0xb'),attributes,{'tableName':_0x0bd8('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcc15=['exports','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x363ced,_0x33988f){var _0x147fa2=function(_0x3c7e28){while(--_0x3c7e28){_0x363ced['push'](_0x363ced['shift']());}};_0x147fa2(++_0x33988f);}(_0xcc15,0x9e));var _0x5cc1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xcc15[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x5cc1('0x0'));var util=require(_0x5cc1('0x1'));var logger=require(_0x5cc1('0x2'))(_0x5cc1('0x3'));var moment=require(_0x5cc1('0x4'));var BPromise=require(_0x5cc1('0x5'));var rp=require(_0x5cc1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cc1('0x7'));var config=require(_0x5cc1('0x8'));var attributes=require(_0x5cc1('0x9'));module[_0x5cc1('0xa')]=function(_0x15d43e,_0x32840b){return _0x15d43e['define'](_0x5cc1('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 825c9ca..4c55165 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6678=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch'];(function(_0x542560,_0x491653){var _0x4b6f20=function(_0x2a08ba){while(--_0x2a08ba){_0x542560['push'](_0x542560['shift']());}};_0x4b6f20(++_0x491653);}(_0x6678,0x159));var _0x8667=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x6678[_0x10d0f0];return _0x93e308;};'use strict';var _=require(_0x8667('0x0'));var util=require('util');var moment=require(_0x8667('0x1'));var BPromise=require(_0x8667('0x2'));var rs=require(_0x8667('0x3'));var fs=require('fs');var Redis=require(_0x8667('0x4'));var db=require(_0x8667('0x5'))['db'];var utils=require(_0x8667('0x6'));var logger=require(_0x8667('0x7'))('rpc');var config=require(_0x8667('0x8'));var jayson=require(_0x8667('0x9'));var client=jayson['client'][_0x8667('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaf141a,_0x969c9c,_0x24c405){return new BPromise(function(_0x195e20,_0x406f2d){return client[_0x8667('0xb')](_0xaf141a,_0x24c405)[_0x8667('0xc')](function(_0x686764){logger[_0x8667('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x969c9c,_0x8667('0xe'));logger['debug'](_0x8667('0xf'),_0x969c9c,'request\x20sent',JSON[_0x8667('0x10')](_0x686764));if(_0x686764[_0x8667('0x11')]){if(_0x686764[_0x8667('0x11')][_0x8667('0x12')]===0x1f4){logger[_0x8667('0x11')](_0x8667('0x13'),_0x969c9c,_0x686764['error'][_0x8667('0x14')]);return _0x406f2d(_0x686764[_0x8667('0x11')][_0x8667('0x14')]);}logger[_0x8667('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x969c9c,_0x686764[_0x8667('0x11')][_0x8667('0x14')]);return _0x195e20(_0x686764[_0x8667('0x11')]['message']);}else{logger[_0x8667('0xd')](_0x8667('0x13'),_0x969c9c,'request\x20sent');_0x195e20(_0x686764[_0x8667('0x15')][_0x8667('0x14')]);}})[_0x8667('0x16')](function(_0x55a885){logger[_0x8667('0x11')](_0x8667('0x13'),_0x969c9c,_0x55a885);_0x406f2d(_0x55a885);});});}
\ No newline at end of file
+var _0x9f22=['result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x259cb6,_0x546595){var _0x3b67bd=function(_0x24f8cb){while(--_0x24f8cb){_0x259cb6['push'](_0x259cb6['shift']());}};_0x3b67bd(++_0x546595);}(_0x9f22,0xf4));var _0x29f2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9f22[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x29f2('0x0'));var util=require(_0x29f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29f2('0x2'));var fs=require('fs');var Redis=require(_0x29f2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x29f2('0x4'));var logger=require('../../config/logger')(_0x29f2('0x5'));var config=require(_0x29f2('0x6'));var jayson=require(_0x29f2('0x7'));var client=jayson[_0x29f2('0x8')][_0x29f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ddd27,_0xdf12f3,_0xa0e766){return new BPromise(function(_0x15fed0,_0x39ff66){return client[_0x29f2('0xa')](_0x1ddd27,_0xa0e766)[_0x29f2('0xb')](function(_0x477dcd){logger[_0x29f2('0xc')](_0x29f2('0xd'),_0xdf12f3,_0x29f2('0xe'));logger[_0x29f2('0xf')](_0x29f2('0x10'),_0xdf12f3,_0x29f2('0xe'),JSON[_0x29f2('0x11')](_0x477dcd));if(_0x477dcd[_0x29f2('0x12')]){if(_0x477dcd[_0x29f2('0x12')]['code']===0x1f4){logger[_0x29f2('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xdf12f3,_0x477dcd[_0x29f2('0x12')]['message']);return _0x39ff66(_0x477dcd[_0x29f2('0x12')][_0x29f2('0x13')]);}logger[_0x29f2('0x12')](_0x29f2('0xd'),_0xdf12f3,_0x477dcd[_0x29f2('0x12')][_0x29f2('0x13')]);return _0x15fed0(_0x477dcd['error'][_0x29f2('0x13')]);}else{logger[_0x29f2('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0xdf12f3,_0x29f2('0xe'));_0x15fed0(_0x477dcd[_0x29f2('0x14')]['message']);}})[_0x29f2('0x15')](function(_0x52e0c4){logger[_0x29f2('0x12')](_0x29f2('0xd'),_0xdf12f3,_0x52e0c4);_0x39ff66(_0x52e0c4);});});}
\ No newline at end of file
index 2c038c2..e887946 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x153c=['isAuthenticated','show','preview','/:id/run','run','/:id/query','query','put','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get'];(function(_0x6f65d,_0x3221ba){var _0x3c7554=function(_0x4be102){while(--_0x4be102){_0x6f65d['push'](_0x6f65d['shift']());}};_0x3c7554(++_0x3221ba);}(_0x153c,0x9e));var _0xc153=function(_0x55eea1,_0x55fa52){_0x55eea1=_0x55eea1-0x0;var _0x229c87=_0x153c[_0x55eea1];return _0x229c87;};'use strict';var multer=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var path=require('path');var timeout=require(_0xc153('0x2'));var express=require(_0xc153('0x3'));var router=express[_0xc153('0x4')]();var fs_extra=require(_0xc153('0x5'));var auth=require(_0xc153('0x6'));var interaction=require(_0xc153('0x7'));var config=require('../../config/environment');var controller=require(_0xc153('0x8'));router[_0xc153('0x9')]('/',auth[_0xc153('0xa')](),controller['index']);router[_0xc153('0x9')]('/:id',auth[_0xc153('0xa')](),controller[_0xc153('0xb')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xc153('0xc')]);router[_0xc153('0x9')](_0xc153('0xd'),auth[_0xc153('0xa')](),controller[_0xc153('0xe')]);router[_0xc153('0x9')](_0xc153('0xf'),auth[_0xc153('0xa')](),controller[_0xc153('0x10')]);router['post']('/',auth[_0xc153('0xa')](),controller['create']);router[_0xc153('0x11')](_0xc153('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xc153('0x13')](_0xc153('0x12'),auth[_0xc153('0xa')](),controller[_0xc153('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0x48a0=['exports','multer','path','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','delete','destroy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x48a0,0xdd));var _0x048a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x48a0[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x048a('0x0'));var util=require('util');var path=require(_0x048a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x048a('0x2'));var auth=require(_0x048a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x048a('0x4'));var controller=require(_0x048a('0x5'));router['get']('/',auth[_0x048a('0x6')](),controller['index']);router[_0x048a('0x7')](_0x048a('0x8'),auth[_0x048a('0x6')](),controller[_0x048a('0x9')]);router[_0x048a('0x7')](_0x048a('0xa'),auth[_0x048a('0x6')](),controller[_0x048a('0xb')]);router['get'](_0x048a('0xc'),auth[_0x048a('0x6')](),controller[_0x048a('0xd')]);router[_0x048a('0x7')](_0x048a('0xe'),auth[_0x048a('0x6')](),controller[_0x048a('0xf')]);router['post']('/',auth[_0x048a('0x6')](),controller['create']);router[_0x048a('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x048a('0x11')](_0x048a('0x8'),auth[_0x048a('0x6')](),controller[_0x048a('0x12')]);module[_0x048a('0x13')]=router;
\ No newline at end of file
index e0d3d70..e18b88a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x3d11be,_0x1b9a8c){var _0x4b657b=function(_0x4a96f2){while(--_0x4a96f2){_0x3d11be['push'](_0x3d11be['shift']());}};_0x4b657b(++_0x1b9a8c);}(_0xf494,0x1c6));var _0x4f49=function(_0x279643,_0xa4e19b){_0x279643=_0x279643-0x0;var _0x292d3d=_0xf494[_0x279643];return _0x292d3d;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}};
\ No newline at end of file
+var _0x2eb2=['TEXT','exports','STRING'];(function(_0x333b9a,_0x14ce97){var _0x18670e=function(_0x21ce86){while(--_0x21ce86){_0x333b9a['push'](_0x333b9a['shift']());}};_0x18670e(++_0x14ce97);}(_0x2eb2,0x19f));var _0x22eb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2eb2[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 263a39d..55c3960 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x331945,_0x4ac379){var _0x114e81=function(_0x306bb6){while(--_0x306bb6){_0x331945['push'](_0x331945['shift']());}};_0x114e81(++_0x4ac379);}(_0x1cb9,0x14e));var _0x91cb=function(_0x7cf4cd,_0x574595){_0x7cf4cd=_0x7cf4cd-0x0;var _0x1dd8a2=_0x1cb9[_0x7cf4cd];return _0x1dd8a2;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));};
\ No newline at end of file
+var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x389c56,_0x1c524d){var _0x3f0dba=function(_0x45effe){while(--_0x45effe){_0x389c56['push'](_0x389c56['shift']());}};_0x3f0dba(++_0x1c524d);}(_0x4975,0x86));var _0x5497=function(_0x106221,_0x556583){_0x106221=_0x106221-0x0;var _0x24f6f7=_0x4975[_0x106221];return _0x24f6f7;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));};
\ No newline at end of file
index 0f1de08..7da1d0c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f0d=['util','bluebird','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x47457c,_0x3c7325){var _0x294fab=function(_0x22f5c3){while(--_0x22f5c3){_0x47457c['push'](_0x47457c['shift']());}};_0x294fab(++_0x3c7325);}(_0x1f0d,0x10d));var _0xd1f0=function(_0x24320d,_0x3086ee){_0x24320d=_0x24320d-0x0;var _0x361c0e=_0x1f0d[_0x24320d];return _0x361c0e;};'use strict';var _=require(_0xd1f0('0x0'));var util=require(_0xd1f0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd1f0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1f0('0x3'));var rimraf=require('rimraf');var config=require(_0xd1f0('0x4'));var attributes=require(_0xd1f0('0x5'));module[_0xd1f0('0x6')]=function(_0x4a43cd,_0x595102){return _0x4a43cd[_0xd1f0('0x7')](_0xd1f0('0x8'),attributes,{'tableName':_0xd1f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x054e=['request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x386fba,_0x282850){var _0x311b84=function(_0x345c21){while(--_0x345c21){_0x386fba['push'](_0x386fba['shift']());}};_0x311b84(++_0x282850);}(_0x054e,0x1f2));var _0xe054=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x054e[_0x134827];return _0x366671;};'use strict';var _=require(_0xe054('0x0'));var util=require(_0xe054('0x1'));var logger=require(_0xe054('0x2'))(_0xe054('0x3'));var moment=require(_0xe054('0x4'));var BPromise=require(_0xe054('0x5'));var rp=require(_0xe054('0x6'));var fs=require('fs');var path=require(_0xe054('0x7'));var rimraf=require('rimraf');var config=require(_0xe054('0x8'));var attributes=require(_0xe054('0x9'));module[_0xe054('0xa')]=function(_0x543cda,_0x33032a){return _0x543cda[_0xe054('0xb')](_0xe054('0xc'),attributes,{'tableName':_0xe054('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ef5a4aa..4a087ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79ec=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x79ec,0xc4));var _0xc79e=function(_0x45964b,_0xe849e5){_0x45964b=_0x45964b-0x0;var _0x4dc863=_0x79ec[_0x45964b];return _0x4dc863;};'use strict';var _=require('lodash');var util=require(_0xc79e('0x0'));var moment=require('moment');var BPromise=require(_0xc79e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc79e('0x2'));var db=require(_0xc79e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc79e('0x4'))('rpc');var config=require(_0xc79e('0x5'));var jayson=require(_0xc79e('0x6'));var client=jayson['client'][_0xc79e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x306a18,_0x5e8cb9,_0x208df0){return new BPromise(function(_0x2bf959,_0x4ce7c6){return client[_0xc79e('0x8')](_0x306a18,_0x208df0)[_0xc79e('0x9')](function(_0x3d2b2c){logger[_0xc79e('0xa')](_0xc79e('0xb'),_0x5e8cb9,'request\x20sent');logger[_0xc79e('0xc')](_0xc79e('0xd'),_0x5e8cb9,_0xc79e('0xe'),JSON['stringify'](_0x3d2b2c));if(_0x3d2b2c[_0xc79e('0xf')]){if(_0x3d2b2c[_0xc79e('0xf')]['code']===0x1f4){logger['error'](_0xc79e('0xb'),_0x5e8cb9,_0x3d2b2c['error'][_0xc79e('0x10')]);return _0x4ce7c6(_0x3d2b2c[_0xc79e('0xf')][_0xc79e('0x10')]);}logger[_0xc79e('0xf')](_0xc79e('0xb'),_0x5e8cb9,_0x3d2b2c[_0xc79e('0xf')][_0xc79e('0x10')]);return _0x2bf959(_0x3d2b2c[_0xc79e('0xf')][_0xc79e('0x10')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e8cb9,'request\x20sent');_0x2bf959(_0x3d2b2c[_0xc79e('0x11')][_0xc79e('0x10')]);}})[_0xc79e('0x12')](function(_0x419268){logger[_0xc79e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e8cb9,_0x419268);_0x4ce7c6(_0x419268);});});}
\ No newline at end of file
+var _0xa713=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a1f09,_0x1482f6){var _0xe26c79=function(_0x35c7b4){while(--_0x35c7b4){_0x3a1f09['push'](_0x3a1f09['shift']());}};_0xe26c79(++_0x1482f6);}(_0xa713,0xe7));var _0x3a71=function(_0xcbed8a,_0x1ea709){_0xcbed8a=_0xcbed8a-0x0;var _0x174d7a=_0xa713[_0xcbed8a];return _0x174d7a;};'use strict';var _=require(_0x3a71('0x0'));var util=require('util');var moment=require(_0x3a71('0x1'));var BPromise=require(_0x3a71('0x2'));var rs=require(_0x3a71('0x3'));var fs=require('fs');var Redis=require(_0x3a71('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a71('0x5'));var logger=require(_0x3a71('0x6'))(_0x3a71('0x7'));var config=require(_0x3a71('0x8'));var jayson=require(_0x3a71('0x9'));var client=jayson[_0x3a71('0xa')][_0x3a71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5427f8,_0x29ffb6,_0x107819){return new BPromise(function(_0x500efe,_0x3b13d8){return client[_0x3a71('0xc')](_0x5427f8,_0x107819)[_0x3a71('0xd')](function(_0x5b081e){logger[_0x3a71('0xe')](_0x3a71('0xf'),_0x29ffb6,'request\x20sent');logger['debug'](_0x3a71('0x10'),_0x29ffb6,_0x3a71('0x11'),JSON[_0x3a71('0x12')](_0x5b081e));if(_0x5b081e[_0x3a71('0x13')]){if(_0x5b081e['error'][_0x3a71('0x14')]===0x1f4){logger[_0x3a71('0x13')](_0x3a71('0xf'),_0x29ffb6,_0x5b081e[_0x3a71('0x13')][_0x3a71('0x15')]);return _0x3b13d8(_0x5b081e['error'][_0x3a71('0x15')]);}logger[_0x3a71('0x13')](_0x3a71('0xf'),_0x29ffb6,_0x5b081e['error'][_0x3a71('0x15')]);return _0x500efe(_0x5b081e[_0x3a71('0x13')][_0x3a71('0x15')]);}else{logger[_0x3a71('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x29ffb6,_0x3a71('0x11'));_0x500efe(_0x5b081e[_0x3a71('0x16')][_0x3a71('0x15')]);}})[_0x3a71('0x17')](function(_0x493d3e){logger[_0x3a71('0x13')](_0x3a71('0xf'),_0x29ffb6,_0x493d3e);_0x3b13d8(_0x493d3e);});});}
\ No newline at end of file
index 73d590b..05ac9aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb67=['./analyticDefaultReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x186964,_0x42b190){var _0x4e66d8=function(_0x23f48a){while(--_0x23f48a){_0x186964['push'](_0x186964['shift']());}};_0x4e66d8(++_0x42b190);}(_0xfb67,0xdd));var _0x7fb6=function(_0x5abd7b,_0x33cca5){_0x5abd7b=_0x5abd7b-0x0;var _0x52424e=_0xfb67[_0x5abd7b];return _0x52424e;};'use strict';var multer=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var path=require(_0x7fb6('0x2'));var timeout=require(_0x7fb6('0x3'));var express=require(_0x7fb6('0x4'));var router=express[_0x7fb6('0x5')]();var fs_extra=require(_0x7fb6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7fb6('0x7'));var config=require(_0x7fb6('0x8'));var controller=require(_0x7fb6('0x9'));router[_0x7fb6('0xa')]('/',auth[_0x7fb6('0xb')](),controller['index']);router[_0x7fb6('0xa')](_0x7fb6('0xc'),auth[_0x7fb6('0xb')](),controller['show']);router[_0x7fb6('0xa')](_0x7fb6('0xd'),auth['isAuthenticated'](),controller[_0x7fb6('0xe')]);router[_0x7fb6('0xa')](_0x7fb6('0xf'),auth['isAuthenticated'](),controller[_0x7fb6('0x10')]);router['get'](_0x7fb6('0x11'),auth[_0x7fb6('0xb')](),controller[_0x7fb6('0x12')]);router[_0x7fb6('0x13')]('/',auth['isAuthenticated'](),controller[_0x7fb6('0x14')]);router[_0x7fb6('0x15')](_0x7fb6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7fb6('0x16')]=router;
\ No newline at end of file
+var _0x22a7=['/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show'];(function(_0x4a23c6,_0x43da0b){var _0xf1c5e3=function(_0x417623){while(--_0x417623){_0x4a23c6['push'](_0x4a23c6['shift']());}};_0xf1c5e3(++_0x43da0b);}(_0x22a7,0xe4));var _0x722a=function(_0x49d907,_0x4edca7){_0x49d907=_0x49d907-0x0;var _0x2528ef=_0x22a7[_0x49d907];return _0x2528ef;};'use strict';var multer=require(_0x722a('0x0'));var util=require(_0x722a('0x1'));var path=require(_0x722a('0x2'));var timeout=require(_0x722a('0x3'));var express=require(_0x722a('0x4'));var router=express[_0x722a('0x5')]();var fs_extra=require(_0x722a('0x6'));var auth=require(_0x722a('0x7'));var interaction=require(_0x722a('0x8'));var config=require(_0x722a('0x9'));var controller=require(_0x722a('0xa'));router['get']('/',auth[_0x722a('0xb')](),controller[_0x722a('0xc')]);router[_0x722a('0xd')]('/:id',auth[_0x722a('0xb')](),controller[_0x722a('0xe')]);router[_0x722a('0xd')](_0x722a('0xf'),auth[_0x722a('0xb')](),controller['preview']);router[_0x722a('0xd')](_0x722a('0x10'),auth[_0x722a('0xb')](),controller[_0x722a('0x11')]);router[_0x722a('0xd')](_0x722a('0x12'),auth[_0x722a('0xb')](),controller['query']);router[_0x722a('0x13')]('/',auth[_0x722a('0xb')](),controller[_0x722a('0x14')]);router[_0x722a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x722a('0x16')]);router[_0x722a('0x17')](_0x722a('0x18'),auth[_0x722a('0xb')](),controller[_0x722a('0x19')]);module[_0x722a('0x1a')]=router;
\ No newline at end of file
index 804333f..4e3465f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x135a=['moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize'];(function(_0x26b3a6,_0x37121d){var _0x4b28a6=function(_0x33d688){while(--_0x33d688){_0x26b3a6['push'](_0x26b3a6['shift']());}};_0x4b28a6(++_0x37121d);}(_0x135a,0x1d3));var _0xa135=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x135a[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xa135('0x0'));var moment=require(_0xa135('0x1'));module['exports']={'name':{'type':Sequelize[_0xa135('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xa135('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xa135('0x3')](_0xa135('0x4'),_0xa135('0x5'),_0xa135('0x6')),'allowNull':![],'defaultValue':_0xa135('0x4')},'savename':{'type':Sequelize[_0xa135('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa135('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xa135('0x8')},'type':{'type':Sequelize[_0xa135('0x3')](_0xa135('0x9'),_0xa135('0xa')),'allowNull':![],'defaultValue':_0xa135('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xa135('0xb')]},'reportType':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x2e18=['STRING','ENUM','pdf','xlsx','csv','DATE','manual','UNSIGNED','sequelize'];(function(_0x11ecf4,_0x3742dd){var _0x552b7c=function(_0x47952e){while(--_0x47952e){_0x11ecf4['push'](_0x11ecf4['shift']());}};_0x552b7c(++_0x3742dd);}(_0x2e18,0x179));var _0x82e1=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x2e18[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x82e1('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x82e1('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x82e1('0x2')]('csv',_0x82e1('0x3'),_0x82e1('0x4')),'allowNull':![],'defaultValue':_0x82e1('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x82e1('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x82e1('0x2')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x82e1('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x82e1('0x8')]},'reportType':{'type':Sequelize[_0x82e1('0x1')]}};
\ No newline at end of file
index 069db15..7cd5e0b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb6c3=['then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','length','include','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','body','download','savename','output','existsSync','join','root','server/files/reports','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','update'];(function(_0x17b542,_0x4fabe7){var _0x1792b4=function(_0xdef90f){while(--_0xdef90f){_0x17b542['push'](_0x17b542['shift']());}};_0x1792b4(++_0x4fabe7);}(_0xb6c3,0xf4));var _0x3b6c=function(_0x9fcff7,_0x435935){_0x9fcff7=_0x9fcff7-0x0;var _0x1e12a9=_0xb6c3[_0x9fcff7];return _0x1e12a9;};'use strict';var emlformat=require(_0x3b6c('0x0'));var rimraf=require(_0x3b6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b6c('0x2'));var moment=require(_0x3b6c('0x3'));var BPromise=require(_0x3b6c('0x4'));var Mustache=require(_0x3b6c('0x5'));var util=require('util');var path=require(_0x3b6c('0x6'));var sox=require(_0x3b6c('0x7'));var csv=require('to-csv');var ejs=require(_0x3b6c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b6c('0x9'));var squel=require(_0x3b6c('0xa'));var crypto=require(_0x3b6c('0xb'));var jsforce=require(_0x3b6c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3b6c('0xd'));var querystring=require(_0x3b6c('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b6c('0xf'));var authService=require(_0x3b6c('0x10'));var qs=require(_0x3b6c('0x11'));var as=require(_0x3b6c('0x12'));var hardwareService=require(_0x3b6c('0x13'));var logger=require(_0x3b6c('0x14'))(_0x3b6c('0x15'));var utils=require(_0x3b6c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b6c('0x17'));var db=require(_0x3b6c('0x18'))['db'];function respondWithStatusCode(_0x42234c,_0x2eefc7){_0x2eefc7=_0x2eefc7||0xcc;return function(_0xbdc9e){if(_0xbdc9e){return _0x42234c['sendStatus'](_0x2eefc7);}return _0x42234c[_0x3b6c('0x19')](_0x2eefc7)['end']();};}function respondWithResult(_0x33ec32,_0x1b019d){_0x1b019d=_0x1b019d||0xc8;return function(_0x129dc0){if(_0x129dc0){return _0x33ec32[_0x3b6c('0x19')](_0x1b019d)[_0x3b6c('0x1a')](_0x129dc0);}};}function respondWithFilteredResult(_0x4d95c3,_0x55b8ca){return function(_0x3535d4){if(_0x3535d4){var _0x1567c4=typeof _0x55b8ca['offset']===_0x3b6c('0x1b')&&typeof _0x55b8ca[_0x3b6c('0x1c')]==='undefined';var _0x4cd799=_0x3535d4[_0x3b6c('0x1d')];var _0x5f0edf=_0x1567c4?0x0:_0x55b8ca[_0x3b6c('0x1e')];var _0x25be7f=_0x1567c4?_0x3535d4[_0x3b6c('0x1d')]:_0x55b8ca[_0x3b6c('0x1e')]+_0x55b8ca[_0x3b6c('0x1c')];var _0x296fba;if(_0x25be7f>=_0x4cd799){_0x25be7f=_0x4cd799;_0x296fba=0xc8;}else{_0x296fba=0xce;}_0x4d95c3[_0x3b6c('0x19')](_0x296fba);return _0x4d95c3[_0x3b6c('0x1f')](_0x3b6c('0x20'),_0x5f0edf+'-'+_0x25be7f+'/'+_0x4cd799)[_0x3b6c('0x1a')](_0x3535d4);}return null;};}function patchUpdates(_0x140c32){return function(_0x44c375){try{jsonpatch[_0x3b6c('0x21')](_0x44c375,_0x140c32,!![]);}catch(_0x2cc81c){return BPromise['reject'](_0x2cc81c);}return _0x44c375['save']();};}function saveUpdates(_0x43f116,_0x557bdb){return function(_0x249c35){if(_0x249c35){return _0x249c35[_0x3b6c('0x22')](_0x43f116)[_0x3b6c('0x23')](function(_0x1b0291){return _0x1b0291;});}return null;};}function removeEntity(_0x54023d,_0x44729f){return function(_0x14d1fd){if(_0x14d1fd){return _0x14d1fd[_0x3b6c('0x24')]()[_0x3b6c('0x23')](function(){var _0x10bcd1=_0x14d1fd[_0x3b6c('0x25')]({'plain':!![]});var _0x4e31ba=_0x3b6c('0x26');return db[_0x3b6c('0x27')]['destroy']({'where':{'type':_0x4e31ba,'resourceId':_0x10bcd1['id']}})[_0x3b6c('0x23')](function(){return _0x14d1fd;});})[_0x3b6c('0x23')](function(){_0x54023d[_0x3b6c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f75f1,_0x458148){return function(_0x1e6b34){if(!_0x1e6b34){_0x1f75f1[_0x3b6c('0x28')](0x194);}return _0x1e6b34;};}function handleError(_0x18191a,_0x35d363){_0x35d363=_0x35d363||0x1f4;return function(_0x3fe436){logger[_0x3b6c('0x29')](_0x3fe436['stack']);if(_0x3fe436[_0x3b6c('0x2a')]){delete _0x3fe436[_0x3b6c('0x2a')];}_0x18191a[_0x3b6c('0x19')](_0x35d363)[_0x3b6c('0x2b')](_0x3fe436);};}exports[_0x3b6c('0x2c')]=function(_0x31885c,_0x36227e){var _0x3d8149={},_0xde1e55={},_0x5778de={'count':0x0,'rows':[]};var _0x37cdf8=_[_0x3b6c('0x2d')](db[_0x3b6c('0x2e')][_0x3b6c('0x2f')],function(_0x3e9b77){return{'name':_0x3e9b77['fieldName'],'type':_0x3e9b77[_0x3b6c('0x30')]['key']};});_0xde1e55[_0x3b6c('0x31')]=_[_0x3b6c('0x2d')](_0x37cdf8,'name');_0xde1e55[_0x3b6c('0x32')]=_[_0x3b6c('0x33')](_0x31885c[_0x3b6c('0x32')]);_0xde1e55[_0x3b6c('0x34')]=_[_0x3b6c('0x35')](_0xde1e55['model'],_0xde1e55['query']);_0x3d8149[_0x3b6c('0x36')]=_[_0x3b6c('0x35')](_0xde1e55[_0x3b6c('0x31')],qs[_0x3b6c('0x37')](_0x31885c[_0x3b6c('0x32')][_0x3b6c('0x37')]));_0x3d8149[_0x3b6c('0x36')]=_0x3d8149[_0x3b6c('0x36')]['length']?_0x3d8149[_0x3b6c('0x36')]:_0xde1e55['model'];if(!_0x31885c['query']['hasOwnProperty'](_0x3b6c('0x38'))){_0x3d8149['limit']=qs[_0x3b6c('0x1c')](_0x31885c[_0x3b6c('0x32')][_0x3b6c('0x1c')]);_0x3d8149[_0x3b6c('0x1e')]=qs[_0x3b6c('0x1e')](_0x31885c[_0x3b6c('0x32')][_0x3b6c('0x1e')]);}_0x3d8149[_0x3b6c('0x39')]=qs[_0x3b6c('0x3a')](_0x31885c['query']['sort']);_0x3d8149[_0x3b6c('0x3b')]=qs[_0x3b6c('0x34')](_[_0x3b6c('0x3c')](_0x31885c[_0x3b6c('0x32')],_0xde1e55[_0x3b6c('0x34')]),_0x37cdf8);if(_0x31885c[_0x3b6c('0x32')][_0x3b6c('0x3d')]){_0x3d8149[_0x3b6c('0x3b')]=_[_0x3b6c('0x3e')](_0x3d8149[_0x3b6c('0x3b')],{'$or':_['map'](_0x37cdf8,function(_0x2c1c67){if(_0x2c1c67[_0x3b6c('0x30')]!==_0x3b6c('0x3f')){var _0x5a539e={};_0x5a539e[_0x2c1c67[_0x3b6c('0x2a')]]={'$like':'%'+_0x31885c[_0x3b6c('0x32')][_0x3b6c('0x3d')]+'%'};return _0x5a539e;}})});}_0x3d8149=_[_0x3b6c('0x3e')]({},_0x3d8149,_0x31885c['options']);var _0x2d196b={'where':_0x3d8149[_0x3b6c('0x3b')]};return db[_0x3b6c('0x2e')][_0x3b6c('0x1d')](_0x2d196b)[_0x3b6c('0x23')](function(_0x4758e7){_0x5778de[_0x3b6c('0x1d')]=_0x4758e7;if(_0x31885c[_0x3b6c('0x32')][_0x3b6c('0x40')]){_0x3d8149['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x3d8149);})[_0x3b6c('0x23')](function(_0xe3cf33){_0x5778de[_0x3b6c('0x41')]=_0xe3cf33;return _0x5778de;})[_0x3b6c('0x23')](respondWithFilteredResult(_0x36227e,_0x3d8149))[_0x3b6c('0x42')](handleError(_0x36227e,null));};exports[_0x3b6c('0x43')]=function(_0x3dde9a,_0x562919){var _0x15da74={'raw':!![],'where':{'id':_0x3dde9a[_0x3b6c('0x44')]['id']}},_0x365eae={};_0x365eae[_0x3b6c('0x31')]=_[_0x3b6c('0x33')](db[_0x3b6c('0x2e')][_0x3b6c('0x2f')]);_0x365eae['query']=_[_0x3b6c('0x33')](_0x3dde9a['query']);_0x365eae[_0x3b6c('0x34')]=_['intersection'](_0x365eae[_0x3b6c('0x31')],_0x365eae[_0x3b6c('0x32')]);_0x15da74['attributes']=_[_0x3b6c('0x35')](_0x365eae['model'],qs[_0x3b6c('0x37')](_0x3dde9a['query']['fields']));_0x15da74[_0x3b6c('0x36')]=_0x15da74[_0x3b6c('0x36')][_0x3b6c('0x45')]?_0x15da74[_0x3b6c('0x36')]:_0x365eae[_0x3b6c('0x31')];if(_0x3dde9a[_0x3b6c('0x32')]['includeAll']){_0x15da74[_0x3b6c('0x46')]=[{'all':!![]}];}_0x15da74=_[_0x3b6c('0x3e')]({},_0x15da74,_0x3dde9a[_0x3b6c('0x47')]);return db['AnalyticExtractedReport'][_0x3b6c('0x48')](_0x15da74)[_0x3b6c('0x23')](handleEntityNotFound(_0x562919,null))['then'](respondWithResult(_0x562919,null))['catch'](handleError(_0x562919,null));};exports['create']=function(_0x50f290,_0x431b85){return db['AnalyticExtractedReport']['create'](_0x50f290['body'],{})[_0x3b6c('0x23')](function(_0x5e7dde){var _0x1dae43=_0x50f290[_0x3b6c('0x49')][_0x3b6c('0x25')]({'plain':!![]});if(!_0x1dae43)throw new Error(_0x3b6c('0x4a'));if(_0x1dae43[_0x3b6c('0x4b')]===_0x3b6c('0x49')){var _0x3766e7=_0x5e7dde[_0x3b6c('0x25')]({'plain':!![]});var _0x5fd50d=_0x3b6c('0x26');return db[_0x3b6c('0x4c')][_0x3b6c('0x48')]({'where':{'name':_0x5fd50d,'userProfileId':_0x1dae43[_0x3b6c('0x4d')]},'raw':!![]})[_0x3b6c('0x23')](function(_0x516352){if(_0x516352&&_0x516352[_0x3b6c('0x4e')]===0x0){return db[_0x3b6c('0x27')][_0x3b6c('0x4f')]({'name':_0x3766e7[_0x3b6c('0x2a')],'resourceId':_0x3766e7['id'],'type':_0x516352['name'],'sectionId':_0x516352['id']},{})[_0x3b6c('0x23')](function(){return _0x5e7dde;});}else{return _0x5e7dde;}})[_0x3b6c('0x42')](function(_0xca1ad0){logger[_0x3b6c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xca1ad0);throw _0xca1ad0;});}return _0x5e7dde;})[_0x3b6c('0x23')](respondWithResult(_0x431b85,0xc9))[_0x3b6c('0x42')](handleError(_0x431b85,null));};exports[_0x3b6c('0x22')]=function(_0x3910e0,_0x35525c){if(_0x3910e0[_0x3b6c('0x50')]['id']){delete _0x3910e0[_0x3b6c('0x50')]['id'];}return db[_0x3b6c('0x2e')][_0x3b6c('0x48')]({'where':{'id':_0x3910e0[_0x3b6c('0x44')]['id']}})[_0x3b6c('0x23')](handleEntityNotFound(_0x35525c,null))[_0x3b6c('0x23')](saveUpdates(_0x3910e0['body'],null))['then'](respondWithResult(_0x35525c,null))['catch'](handleError(_0x35525c,null));};exports['destroy']=function(_0x5596c3,_0x24b3b5){return db['AnalyticExtractedReport'][_0x3b6c('0x48')]({'where':{'id':_0x5596c3[_0x3b6c('0x44')]['id']}})[_0x3b6c('0x23')](handleEntityNotFound(_0x24b3b5,null))[_0x3b6c('0x23')](removeEntity(_0x24b3b5,null))[_0x3b6c('0x42')](handleError(_0x24b3b5,null));};exports[_0x3b6c('0x51')]=function(_0x2cc08d,_0xe30337,_0x58bc91){return db[_0x3b6c('0x2e')][_0x3b6c('0x48')]({'where':{'id':_0x2cc08d[_0x3b6c('0x44')]['id']},'attributes':[_0x3b6c('0x2a'),'basename',_0x3b6c('0x52'),_0x3b6c('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0xe30337,null))['then'](function(_0x304204){if(_0x304204){if(!fs[_0x3b6c('0x54')](path[_0x3b6c('0x55')](config[_0x3b6c('0x56')],_0x3b6c('0x57'),_0x304204['savename']))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x2cc08d[_0x3b6c('0x32')][_0x3b6c('0x58')]){return _0xe30337[_0x3b6c('0x28')](0xc8);}return _0xe30337['download'](path['join'](config[_0x3b6c('0x56')],_0x3b6c('0x57'),_0x304204[_0x3b6c('0x52')]),util[_0x3b6c('0x59')](_0x3b6c('0x5a'),_0x304204[_0x3b6c('0x5b')]||_0x304204[_0x3b6c('0x2a')],_0x304204['output'][_0x3b6c('0x5c')]()));}})[_0x3b6c('0x42')](handleError(_0xe30337,null));};
\ No newline at end of file
+var _0x4881=['undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','map','AnalyticExtractedReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x1f6ce1,_0x2c90d3){var _0x610f88=function(_0x3a5d4c){while(--_0x3a5d4c){_0x1f6ce1['push'](_0x1f6ce1['shift']());}};_0x610f88(++_0x2c90d3);}(_0x4881,0x1bf));var _0x1488=function(_0x3dbc7b,_0x516da5){_0x3dbc7b=_0x3dbc7b-0x0;var _0x217508=_0x4881[_0x3dbc7b];return _0x217508;};'use strict';var emlformat=require(_0x1488('0x0'));var rimraf=require(_0x1488('0x1'));var zipdir=require(_0x1488('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1488('0x3'));var moment=require(_0x1488('0x4'));var BPromise=require(_0x1488('0x5'));var Mustache=require(_0x1488('0x6'));var util=require('util');var path=require(_0x1488('0x7'));var sox=require(_0x1488('0x8'));var csv=require(_0x1488('0x9'));var ejs=require(_0x1488('0xa'));var fs=require('fs');var fs_extra=require(_0x1488('0xb'));var _=require(_0x1488('0xc'));var squel=require(_0x1488('0xd'));var crypto=require(_0x1488('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1488('0xf'));var toCsv=require(_0x1488('0x9'));var querystring=require(_0x1488('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1488('0x11'));var qs=require(_0x1488('0x12'));var as=require(_0x1488('0x13'));var hardwareService=require(_0x1488('0x14'));var logger=require('../../config/logger')(_0x1488('0x15'));var utils=require('../../config/utils');var config=require(_0x1488('0x16'));var licenseUtil=require(_0x1488('0x17'));var db=require(_0x1488('0x18'))['db'];function respondWithStatusCode(_0x5e8414,_0x4d89ad){_0x4d89ad=_0x4d89ad||0xcc;return function(_0x5ea666){if(_0x5ea666){return _0x5e8414['sendStatus'](_0x4d89ad);}return _0x5e8414[_0x1488('0x19')](_0x4d89ad)[_0x1488('0x1a')]();};}function respondWithResult(_0x4d1854,_0x2f3e22){_0x2f3e22=_0x2f3e22||0xc8;return function(_0x2630ee){if(_0x2630ee){return _0x4d1854[_0x1488('0x19')](_0x2f3e22)[_0x1488('0x1b')](_0x2630ee);}};}function respondWithFilteredResult(_0x21bfe5,_0x3b1d34){return function(_0xa412b){if(_0xa412b){var _0x58dba4=typeof _0x3b1d34['offset']===_0x1488('0x1c')&&typeof _0x3b1d34['limit']==='undefined';var _0x177bc6=_0xa412b[_0x1488('0x1d')];var _0xc10086=_0x58dba4?0x0:_0x3b1d34[_0x1488('0x1e')];var _0x5dac18=_0x58dba4?_0xa412b[_0x1488('0x1d')]:_0x3b1d34['offset']+_0x3b1d34[_0x1488('0x1f')];var _0xd2b21d;if(_0x5dac18>=_0x177bc6){_0x5dac18=_0x177bc6;_0xd2b21d=0xc8;}else{_0xd2b21d=0xce;}_0x21bfe5[_0x1488('0x19')](_0xd2b21d);return _0x21bfe5[_0x1488('0x20')](_0x1488('0x21'),_0xc10086+'-'+_0x5dac18+'/'+_0x177bc6)[_0x1488('0x1b')](_0xa412b);}return null;};}function patchUpdates(_0x1b1944){return function(_0x3527a8){try{jsonpatch[_0x1488('0x22')](_0x3527a8,_0x1b1944,!![]);}catch(_0x3754fe){return BPromise[_0x1488('0x23')](_0x3754fe);}return _0x3527a8[_0x1488('0x24')]();};}function saveUpdates(_0xf9c76a,_0x233207){return function(_0xad6cad){if(_0xad6cad){return _0xad6cad[_0x1488('0x25')](_0xf9c76a)[_0x1488('0x26')](function(_0x1cee7c){return _0x1cee7c;});}return null;};}function removeEntity(_0xd030c3,_0xc8fdea){return function(_0x45a27b){if(_0x45a27b){return _0x45a27b[_0x1488('0x27')]()['then'](function(){var _0x5c99b7=_0x45a27b[_0x1488('0x28')]({'plain':!![]});var _0x366197=_0x1488('0x29');return db[_0x1488('0x2a')][_0x1488('0x27')]({'where':{'type':_0x366197,'resourceId':_0x5c99b7['id']}})[_0x1488('0x26')](function(){return _0x45a27b;});})['then'](function(){_0xd030c3[_0x1488('0x19')](0xcc)[_0x1488('0x1a')]();});}};}function handleEntityNotFound(_0x831ed9,_0x356ebf){return function(_0x10d709){if(!_0x10d709){_0x831ed9[_0x1488('0x2b')](0x194);}return _0x10d709;};}function handleError(_0x2c835d,_0x180549){_0x180549=_0x180549||0x1f4;return function(_0x5d29c5){logger[_0x1488('0x2c')](_0x5d29c5[_0x1488('0x2d')]);if(_0x5d29c5['name']){delete _0x5d29c5[_0x1488('0x2e')];}_0x2c835d[_0x1488('0x19')](_0x180549)['send'](_0x5d29c5);};}exports['index']=function(_0x811f0e,_0x20f087){var _0x3ade78={},_0x4c8c71={},_0x41f768={'count':0x0,'rows':[]};var _0x54c2ea=_[_0x1488('0x2f')](db[_0x1488('0x30')][_0x1488('0x31')],function(_0x2a3a5b){return{'name':_0x2a3a5b['fieldName'],'type':_0x2a3a5b[_0x1488('0x32')][_0x1488('0x33')]};});_0x4c8c71['model']=_[_0x1488('0x2f')](_0x54c2ea,_0x1488('0x2e'));_0x4c8c71[_0x1488('0x34')]=_[_0x1488('0x35')](_0x811f0e['query']);_0x4c8c71[_0x1488('0x36')]=_[_0x1488('0x37')](_0x4c8c71[_0x1488('0x38')],_0x4c8c71[_0x1488('0x34')]);_0x3ade78[_0x1488('0x39')]=_['intersection'](_0x4c8c71[_0x1488('0x38')],qs[_0x1488('0x3a')](_0x811f0e[_0x1488('0x34')][_0x1488('0x3a')]));_0x3ade78[_0x1488('0x39')]=_0x3ade78[_0x1488('0x39')][_0x1488('0x3b')]?_0x3ade78[_0x1488('0x39')]:_0x4c8c71[_0x1488('0x38')];if(!_0x811f0e[_0x1488('0x34')]['hasOwnProperty']('nolimit')){_0x3ade78['limit']=qs[_0x1488('0x1f')](_0x811f0e['query'][_0x1488('0x1f')]);_0x3ade78[_0x1488('0x1e')]=qs[_0x1488('0x1e')](_0x811f0e[_0x1488('0x34')][_0x1488('0x1e')]);}_0x3ade78[_0x1488('0x3c')]=qs[_0x1488('0x3d')](_0x811f0e['query'][_0x1488('0x3d')]);_0x3ade78[_0x1488('0x3e')]=qs[_0x1488('0x36')](_[_0x1488('0x3f')](_0x811f0e[_0x1488('0x34')],_0x4c8c71[_0x1488('0x36')]),_0x54c2ea);if(_0x811f0e['query'][_0x1488('0x40')]){_0x3ade78[_0x1488('0x3e')]=_[_0x1488('0x41')](_0x3ade78[_0x1488('0x3e')],{'$or':_[_0x1488('0x2f')](_0x54c2ea,function(_0xef8ec1){if(_0xef8ec1[_0x1488('0x32')]!==_0x1488('0x42')){var _0x5dae07={};_0x5dae07[_0xef8ec1[_0x1488('0x2e')]]={'$like':'%'+_0x811f0e[_0x1488('0x34')]['filter']+'%'};return _0x5dae07;}})});}_0x3ade78=_[_0x1488('0x41')]({},_0x3ade78,_0x811f0e['options']);var _0x2b151a={'where':_0x3ade78[_0x1488('0x3e')]};return db[_0x1488('0x30')][_0x1488('0x1d')](_0x2b151a)[_0x1488('0x26')](function(_0x34854a){_0x41f768[_0x1488('0x1d')]=_0x34854a;if(_0x811f0e[_0x1488('0x34')]['includeAll']){_0x3ade78[_0x1488('0x43')]=[{'all':!![]}];}return db[_0x1488('0x30')][_0x1488('0x44')](_0x3ade78);})[_0x1488('0x26')](function(_0x1bf105){_0x41f768[_0x1488('0x45')]=_0x1bf105;return _0x41f768;})[_0x1488('0x26')](respondWithFilteredResult(_0x20f087,_0x3ade78))[_0x1488('0x46')](handleError(_0x20f087,null));};exports[_0x1488('0x47')]=function(_0x1555ca,_0x44a4cb){var _0x38e88a={'raw':!![],'where':{'id':_0x1555ca[_0x1488('0x48')]['id']}},_0x1d6d85={};_0x1d6d85[_0x1488('0x38')]=_[_0x1488('0x35')](db[_0x1488('0x30')][_0x1488('0x31')]);_0x1d6d85[_0x1488('0x34')]=_[_0x1488('0x35')](_0x1555ca[_0x1488('0x34')]);_0x1d6d85[_0x1488('0x36')]=_[_0x1488('0x37')](_0x1d6d85['model'],_0x1d6d85['query']);_0x38e88a['attributes']=_['intersection'](_0x1d6d85[_0x1488('0x38')],qs[_0x1488('0x3a')](_0x1555ca[_0x1488('0x34')][_0x1488('0x3a')]));_0x38e88a[_0x1488('0x39')]=_0x38e88a[_0x1488('0x39')][_0x1488('0x3b')]?_0x38e88a[_0x1488('0x39')]:_0x1d6d85['model'];if(_0x1555ca[_0x1488('0x34')][_0x1488('0x49')]){_0x38e88a[_0x1488('0x43')]=[{'all':!![]}];}_0x38e88a=_[_0x1488('0x41')]({},_0x38e88a,_0x1555ca['options']);return db[_0x1488('0x30')][_0x1488('0x4a')](_0x38e88a)[_0x1488('0x26')](handleEntityNotFound(_0x44a4cb,null))['then'](respondWithResult(_0x44a4cb,null))[_0x1488('0x46')](handleError(_0x44a4cb,null));};exports[_0x1488('0x4b')]=function(_0x2b2926,_0x232e9e){return db[_0x1488('0x30')]['create'](_0x2b2926['body'],{})['then'](function(_0x239b8e){var _0xd796e4=_0x2b2926['user'][_0x1488('0x28')]({'plain':!![]});if(!_0xd796e4)throw new Error(_0x1488('0x4c'));if(_0xd796e4[_0x1488('0x4d')]===_0x1488('0x4e')){var _0x3d5621=_0x239b8e[_0x1488('0x28')]({'plain':!![]});var _0x4aa3db=_0x1488('0x29');return db['UserProfileSection'][_0x1488('0x4a')]({'where':{'name':_0x4aa3db,'userProfileId':_0xd796e4['userProfileId']},'raw':!![]})[_0x1488('0x26')](function(_0x47f01b){if(_0x47f01b&&_0x47f01b[_0x1488('0x4f')]===0x0){return db['UserProfileResource'][_0x1488('0x4b')]({'name':_0x3d5621[_0x1488('0x2e')],'resourceId':_0x3d5621['id'],'type':_0x47f01b[_0x1488('0x2e')],'sectionId':_0x47f01b['id']},{})['then'](function(){return _0x239b8e;});}else{return _0x239b8e;}})[_0x1488('0x46')](function(_0x24276e){logger['error'](_0x1488('0x50'),_0x24276e);throw _0x24276e;});}return _0x239b8e;})[_0x1488('0x26')](respondWithResult(_0x232e9e,0xc9))[_0x1488('0x46')](handleError(_0x232e9e,null));};exports[_0x1488('0x25')]=function(_0x5bed8f,_0x1d2868){if(_0x5bed8f[_0x1488('0x51')]['id']){delete _0x5bed8f[_0x1488('0x51')]['id'];}return db['AnalyticExtractedReport'][_0x1488('0x4a')]({'where':{'id':_0x5bed8f['params']['id']}})[_0x1488('0x26')](handleEntityNotFound(_0x1d2868,null))[_0x1488('0x26')](saveUpdates(_0x5bed8f[_0x1488('0x51')],null))[_0x1488('0x26')](respondWithResult(_0x1d2868,null))[_0x1488('0x46')](handleError(_0x1d2868,null));};exports[_0x1488('0x27')]=function(_0x9eb994,_0x1358d7){return db[_0x1488('0x30')]['find']({'where':{'id':_0x9eb994[_0x1488('0x48')]['id']}})['then'](handleEntityNotFound(_0x1358d7,null))[_0x1488('0x26')](removeEntity(_0x1358d7,null))['catch'](handleError(_0x1358d7,null));};exports[_0x1488('0x52')]=function(_0x182103,_0x39c2c9,_0xe826ca){return db[_0x1488('0x30')]['find']({'where':{'id':_0x182103['params']['id']},'attributes':[_0x1488('0x2e'),_0x1488('0x53'),_0x1488('0x54'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x39c2c9,null))[_0x1488('0x26')](function(_0x3bd622){if(_0x3bd622){if(!fs['existsSync'](path[_0x1488('0x55')](config[_0x1488('0x56')],_0x1488('0x57'),_0x3bd622['savename']))){throw new db[(_0x1488('0x58'))][(_0x1488('0x59'))](_0x1488('0x5a'));}if(_0x182103['query'][_0x1488('0x5b')]){return _0x39c2c9[_0x1488('0x2b')](0xc8);}return _0x39c2c9[_0x1488('0x52')](path['join'](config[_0x1488('0x56')],_0x1488('0x57'),_0x3bd622['savename']),util[_0x1488('0x5c')](_0x1488('0x5d'),_0x3bd622[_0x1488('0x53')]||_0x3bd622[_0x1488('0x2e')],_0x3bd622['output'][_0x1488('0x5e')]()));}})[_0x1488('0x46')](handleError(_0x39c2c9,null));};
\ No newline at end of file
index d079aaf..21eb022 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7e2=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x567946,_0x387c8d){var _0x5bae51=function(_0x6b4357){while(--_0x6b4357){_0x567946['push'](_0x567946['shift']());}};_0x5bae51(++_0x387c8d);}(_0xc7e2,0x185));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2c7e('0x0'));var logger=require(_0x2c7e('0x1'))(_0x2c7e('0x2'));var moment=require('moment');var BPromise=require(_0x2c7e('0x3'));var rp=require(_0x2c7e('0x4'));var fs=require('fs');var path=require(_0x2c7e('0x5'));var rimraf=require(_0x2c7e('0x6'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x2c7e('0x7')]=function(_0x40f44e,_0x2f53db){return _0x40f44e[_0x2c7e('0x8')](_0x2c7e('0x9'),attributes,{'tableName':_0x2c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5ab3=['path','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','bluebird','request-promise'];(function(_0x3c7292,_0x9f32b1){var _0x1b66f6=function(_0x2965d8){while(--_0x2965d8){_0x3c7292['push'](_0x3c7292['shift']());}};_0x1b66f6(++_0x9f32b1);}(_0x5ab3,0x177));var _0x35ab=function(_0xb1daa5,_0x24a164){_0xb1daa5=_0xb1daa5-0x0;var _0x31107e=_0x5ab3[_0xb1daa5];return _0x31107e;};'use strict';var _=require(_0x35ab('0x0'));var util=require(_0x35ab('0x1'));var logger=require('../../config/logger')(_0x35ab('0x2'));var moment=require('moment');var BPromise=require(_0x35ab('0x3'));var rp=require(_0x35ab('0x4'));var fs=require('fs');var path=require(_0x35ab('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x35ab('0x6')]=function(_0x1d462e,_0x4559d8){return _0x1d462e[_0x35ab('0x7')](_0x35ab('0x8'),attributes,{'tableName':_0x35ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5da5c83..e67b038 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7fd=['error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe7fd,0x148));var _0xde7f=function(_0xe07e75,_0x11cf89){_0xe07e75=_0xe07e75-0x0;var _0x52dbe0=_0xe7fd[_0xe07e75];return _0x52dbe0;};'use strict';var _=require('lodash');var util=require(_0xde7f('0x0'));var moment=require(_0xde7f('0x1'));var BPromise=require('bluebird');var rs=require(_0xde7f('0x2'));var fs=require('fs');var Redis=require(_0xde7f('0x3'));var db=require(_0xde7f('0x4'))['db'];var utils=require(_0xde7f('0x5'));var logger=require(_0xde7f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35961d,_0xee9e53,_0x5a1c90){return new BPromise(function(_0x4c390b,_0xf08ff1){return client[_0xde7f('0x7')](_0x35961d,_0x5a1c90)[_0xde7f('0x8')](function(_0x876cca){logger[_0xde7f('0x9')](_0xde7f('0xa'),_0xee9e53,_0xde7f('0xb'));logger[_0xde7f('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xee9e53,_0xde7f('0xb'),JSON[_0xde7f('0xd')](_0x876cca));if(_0x876cca[_0xde7f('0xe')]){if(_0x876cca[_0xde7f('0xe')][_0xde7f('0xf')]===0x1f4){logger[_0xde7f('0xe')](_0xde7f('0xa'),_0xee9e53,_0x876cca[_0xde7f('0xe')]['message']);return _0xf08ff1(_0x876cca[_0xde7f('0xe')][_0xde7f('0x10')]);}logger[_0xde7f('0xe')](_0xde7f('0xa'),_0xee9e53,_0x876cca['error'][_0xde7f('0x10')]);return _0x4c390b(_0x876cca[_0xde7f('0xe')][_0xde7f('0x10')]);}else{logger['info'](_0xde7f('0xa'),_0xee9e53,'request\x20sent');_0x4c390b(_0x876cca[_0xde7f('0x11')][_0xde7f('0x10')]);}})[_0xde7f('0x12')](function(_0x2730e8){logger[_0xde7f('0xe')](_0xde7f('0xa'),_0xee9e53,_0x2730e8);_0xf08ff1(_0x2730e8);});});}
\ No newline at end of file
+var _0x93f7=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x93f7,0x140));var _0x793f=function(_0x9f91e9,_0x163b58){_0x9f91e9=_0x9f91e9-0x0;var _0x516900=_0x93f7[_0x9f91e9];return _0x516900;};'use strict';var _=require('lodash');var util=require(_0x793f('0x0'));var moment=require(_0x793f('0x1'));var BPromise=require('bluebird');var rs=require(_0x793f('0x2'));var fs=require('fs');var Redis=require(_0x793f('0x3'));var db=require(_0x793f('0x4'))['db'];var utils=require(_0x793f('0x5'));var logger=require('../../config/logger')(_0x793f('0x6'));var config=require(_0x793f('0x7'));var jayson=require(_0x793f('0x8'));var client=jayson['client'][_0x793f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5574aa,_0x5b2108,_0x467a0d){return new BPromise(function(_0x17a914,_0x5622a){return client[_0x793f('0xa')](_0x5574aa,_0x467a0d)[_0x793f('0xb')](function(_0x34d88a){logger[_0x793f('0xc')](_0x793f('0xd'),_0x5b2108,_0x793f('0xe'));logger[_0x793f('0xf')](_0x793f('0x10'),_0x5b2108,_0x793f('0xe'),JSON[_0x793f('0x11')](_0x34d88a));if(_0x34d88a[_0x793f('0x12')]){if(_0x34d88a[_0x793f('0x12')][_0x793f('0x13')]===0x1f4){logger[_0x793f('0x12')](_0x793f('0xd'),_0x5b2108,_0x34d88a['error'][_0x793f('0x14')]);return _0x5622a(_0x34d88a[_0x793f('0x12')][_0x793f('0x14')]);}logger['error'](_0x793f('0xd'),_0x5b2108,_0x34d88a[_0x793f('0x12')]['message']);return _0x17a914(_0x34d88a['error'][_0x793f('0x14')]);}else{logger[_0x793f('0xc')](_0x793f('0xd'),_0x5b2108,_0x793f('0xe'));_0x17a914(_0x34d88a[_0x793f('0x15')][_0x793f('0x14')]);}})['catch'](function(_0x326532){logger[_0x793f('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5b2108,_0x326532);_0x5622a(_0x326532);});});}
\ No newline at end of file
index 046d425..b62c9d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a7c=['download','put','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x7a7c,0x136));var _0xc7a7=function(_0x51f54f,_0x3dff31){_0x51f54f=_0x51f54f-0x0;var _0x58bacb=_0x7a7c[_0x51f54f];return _0x58bacb;};'use strict';var multer=require(_0xc7a7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc7a7('0x1'));var router=express[_0xc7a7('0x2')]();var fs_extra=require(_0xc7a7('0x3'));var auth=require(_0xc7a7('0x4'));var interaction=require(_0xc7a7('0x5'));var config=require(_0xc7a7('0x6'));var controller=require(_0xc7a7('0x7'));router[_0xc7a7('0x8')]('/',auth[_0xc7a7('0x9')](),controller[_0xc7a7('0xa')]);router['get'](_0xc7a7('0xb'),auth[_0xc7a7('0x9')](),controller[_0xc7a7('0xc')]);router[_0xc7a7('0x8')](_0xc7a7('0xd'),auth[_0xc7a7('0x9')](),controller[_0xc7a7('0xe')]);router['post']('/',auth[_0xc7a7('0x9')](),controller['create']);router[_0xc7a7('0xf')](_0xc7a7('0xb'),auth[_0xc7a7('0x9')](),controller['update']);router[_0xc7a7('0x10')](_0xc7a7('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xc7a7('0x11')]=router;
\ No newline at end of file
+var _0x7121=['/:id/download','download','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7121,0x12f));var _0x1712=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7121[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x1712('0x0'));var util=require(_0x1712('0x1'));var path=require(_0x1712('0x2'));var timeout=require(_0x1712('0x3'));var express=require(_0x1712('0x4'));var router=express[_0x1712('0x5')]();var fs_extra=require(_0x1712('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1712('0x7'));var config=require(_0x1712('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x1712('0x9')]('/',auth[_0x1712('0xa')](),controller['index']);router[_0x1712('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1712('0xb')]);router[_0x1712('0x9')](_0x1712('0xc'),auth[_0x1712('0xa')](),controller[_0x1712('0xd')]);router[_0x1712('0xe')]('/',auth[_0x1712('0xa')](),controller[_0x1712('0xf')]);router[_0x1712('0x10')](_0x1712('0x11'),auth['isAuthenticated'](),controller[_0x1712('0x12')]);router['delete'](_0x1712('0x11'),auth[_0x1712('0xa')](),controller[_0x1712('0x13')]);module[_0x1712('0x14')]=router;
\ No newline at end of file
index 74af1fd..bc3dad5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x83a6=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x3845c2,_0x5d2b3a){var _0x1c0773=function(_0x136d08){while(--_0x136d08){_0x3845c2['push'](_0x3845c2['shift']());}};_0x1c0773(++_0x5d2b3a);}(_0x83a6,0xc8));var _0x683a=function(_0x16b3b2,_0x2cfc43){_0x16b3b2=_0x16b3b2-0x0;var _0x306791=_0x83a6[_0x16b3b2];return _0x306791;};'use strict';var Sequelize=require(_0x683a('0x0'));module[_0x683a('0x1')]={'field':{'type':Sequelize[_0x683a('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x683a('0x3')]},'format':{'type':Sequelize[_0x683a('0x3')]},'groupBy':{'type':Sequelize[_0x683a('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x683a('0x3')]},'custom':{'type':Sequelize[_0x683a('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0x05db=['exports','STRING','BOOLEAN','sequelize'];(function(_0x41beb0,_0x2298de){var _0x77cc6f=function(_0x2f2cce){while(--_0x2f2cce){_0x41beb0['push'](_0x41beb0['shift']());}};_0x77cc6f(++_0x2298de);}(_0x05db,0x83));var _0xb05d=function(_0x5b406e,_0xcd06bc){_0x5b406e=_0x5b406e-0x0;var _0xe7d242=_0x05db[_0x5b406e];return _0xe7d242;};'use strict';var Sequelize=require(_0xb05d('0x0'));module[_0xb05d('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xb05d('0x2')]},'function':{'type':Sequelize[_0xb05d('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xb05d('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb05d('0x2')]},'custom':{'type':Sequelize[_0xb05d('0x3')],'defaultValue':![]}};
\ No newline at end of file
index 0232c9a..375cc5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c42=['api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','AnalyticFieldReport','findAll','rows','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','CustomReportId','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5da8f2,_0x4e3180){var _0x788625=function(_0x4ccc2e){while(--_0x4ccc2e){_0x5da8f2['push'](_0x5da8f2['shift']());}};_0x788625(++_0x4e3180);}(_0x6c42,0xd0));var _0x26c4=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x6c42[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26c4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26c4('0x1'));var rp=require('request-promise');var moment=require(_0x26c4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x26c4('0x3'));var util=require('util');var path=require(_0x26c4('0x4'));var sox=require('sox');var csv=require(_0x26c4('0x5'));var ejs=require(_0x26c4('0x6'));var fs=require('fs');var fs_extra=require(_0x26c4('0x7'));var _=require(_0x26c4('0x8'));var squel=require(_0x26c4('0x9'));var crypto=require(_0x26c4('0xa'));var jsforce=require(_0x26c4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x26c4('0x5'));var querystring=require('querystring');var Papa=require(_0x26c4('0xc'));var Redis=require(_0x26c4('0xd'));var authService=require(_0x26c4('0xe'));var qs=require(_0x26c4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26c4('0x10'));var logger=require('../../config/logger')(_0x26c4('0x11'));var utils=require(_0x26c4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x26c4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20af35,_0x5347cc){_0x5347cc=_0x5347cc||0xcc;return function(_0x30bfa1){if(_0x30bfa1){return _0x20af35[_0x26c4('0x14')](_0x5347cc);}return _0x20af35['status'](_0x5347cc)[_0x26c4('0x15')]();};}function respondWithResult(_0x516d82,_0x1c9c56){_0x1c9c56=_0x1c9c56||0xc8;return function(_0x180c1a){if(_0x180c1a){return _0x516d82[_0x26c4('0x16')](_0x1c9c56)[_0x26c4('0x17')](_0x180c1a);}};}function respondWithFilteredResult(_0x24dca8,_0x30e278){return function(_0x7cb640){if(_0x7cb640){var _0x204897=typeof _0x30e278[_0x26c4('0x18')]===_0x26c4('0x19')&&typeof _0x30e278[_0x26c4('0x1a')]===_0x26c4('0x19');var _0x4b2d2d=_0x7cb640[_0x26c4('0x1b')];var _0x4b48b5=_0x204897?0x0:_0x30e278[_0x26c4('0x18')];var _0x1da559=_0x204897?_0x7cb640['count']:_0x30e278[_0x26c4('0x18')]+_0x30e278['limit'];var _0x3976ae;if(_0x1da559>=_0x4b2d2d){_0x1da559=_0x4b2d2d;_0x3976ae=0xc8;}else{_0x3976ae=0xce;}_0x24dca8[_0x26c4('0x16')](_0x3976ae);return _0x24dca8[_0x26c4('0x1c')](_0x26c4('0x1d'),_0x4b48b5+'-'+_0x1da559+'/'+_0x4b2d2d)[_0x26c4('0x17')](_0x7cb640);}return null;};}function patchUpdates(_0x5cc58e){return function(_0x4a1d2b){try{jsonpatch[_0x26c4('0x1e')](_0x4a1d2b,_0x5cc58e,!![]);}catch(_0xccf601){return BPromise[_0x26c4('0x1f')](_0xccf601);}return _0x4a1d2b[_0x26c4('0x20')]();};}function saveUpdates(_0x3b032e,_0x81beaa){return function(_0x226650){if(_0x226650){return _0x226650[_0x26c4('0x21')](_0x3b032e)[_0x26c4('0x22')](function(_0x51d306){return _0x51d306;});}return null;};}function removeEntity(_0x548ddd,_0x31a6c1){return function(_0x85a319){if(_0x85a319){return _0x85a319[_0x26c4('0x23')]()['then'](function(){_0x548ddd['status'](0xcc)[_0x26c4('0x15')]();});}};}function handleEntityNotFound(_0x106aef,_0x2ce1d6){return function(_0x35c754){if(!_0x35c754){_0x106aef[_0x26c4('0x14')](0x194);}return _0x35c754;};}function handleError(_0x2fd09b,_0x41643e){_0x41643e=_0x41643e||0x1f4;return function(_0x42ee4b){logger['error'](_0x42ee4b['stack']);if(_0x42ee4b[_0x26c4('0x24')]){delete _0x42ee4b['name'];}_0x2fd09b[_0x26c4('0x16')](_0x41643e)[_0x26c4('0x25')](_0x42ee4b);};}exports[_0x26c4('0x26')]=function(_0x1ff981,_0x4dd0bb){var _0x27b6c0={},_0x491f15={},_0x109965={'count':0x0,'rows':[]};var _0x4eb6aa=_[_0x26c4('0x27')](db['AnalyticFieldReport'][_0x26c4('0x28')],function(_0x1ec460){return{'name':_0x1ec460['fieldName'],'type':_0x1ec460['type']['key']};});_0x491f15['model']=_[_0x26c4('0x27')](_0x4eb6aa,_0x26c4('0x24'));_0x491f15['query']=_[_0x26c4('0x29')](_0x1ff981[_0x26c4('0x2a')]);_0x491f15[_0x26c4('0x2b')]=_[_0x26c4('0x2c')](_0x491f15[_0x26c4('0x2d')],_0x491f15['query']);_0x27b6c0['attributes']=_[_0x26c4('0x2c')](_0x491f15[_0x26c4('0x2d')],qs[_0x26c4('0x2e')](_0x1ff981[_0x26c4('0x2a')][_0x26c4('0x2e')]));_0x27b6c0[_0x26c4('0x2f')]=_0x27b6c0['attributes'][_0x26c4('0x30')]?_0x27b6c0['attributes']:_0x491f15[_0x26c4('0x2d')];if(!_0x1ff981[_0x26c4('0x2a')][_0x26c4('0x31')](_0x26c4('0x32'))){_0x27b6c0['limit']=qs[_0x26c4('0x1a')](_0x1ff981[_0x26c4('0x2a')][_0x26c4('0x1a')]);_0x27b6c0['offset']=qs['offset'](_0x1ff981[_0x26c4('0x2a')]['offset']);}_0x27b6c0[_0x26c4('0x33')]=qs[_0x26c4('0x34')](_0x1ff981['query']['sort']);_0x27b6c0[_0x26c4('0x35')]=qs[_0x26c4('0x2b')](_['pick'](_0x1ff981['query'],_0x491f15[_0x26c4('0x2b')]),_0x4eb6aa);if(_0x1ff981[_0x26c4('0x2a')][_0x26c4('0x36')]){_0x27b6c0[_0x26c4('0x35')]=_[_0x26c4('0x37')](_0x27b6c0[_0x26c4('0x35')],{'$or':_[_0x26c4('0x27')](_0x4eb6aa,function(_0x177d8d){if(_0x177d8d['type']!==_0x26c4('0x38')){var _0x397248={};_0x397248[_0x177d8d['name']]={'$like':'%'+_0x1ff981[_0x26c4('0x2a')]['filter']+'%'};return _0x397248;}})});}_0x27b6c0=_[_0x26c4('0x37')]({},_0x27b6c0,_0x1ff981[_0x26c4('0x39')]);var _0x47e11f={'where':_0x27b6c0[_0x26c4('0x35')]};return db['AnalyticFieldReport'][_0x26c4('0x1b')](_0x47e11f)[_0x26c4('0x22')](function(_0x39c2e9){_0x109965[_0x26c4('0x1b')]=_0x39c2e9;if(_0x1ff981[_0x26c4('0x2a')][_0x26c4('0x3a')]){_0x27b6c0['include']=[{'all':!![]}];}return db[_0x26c4('0x3b')][_0x26c4('0x3c')](_0x27b6c0);})[_0x26c4('0x22')](function(_0x42b7ba){_0x109965[_0x26c4('0x3d')]=_0x42b7ba;return _0x109965;})[_0x26c4('0x22')](respondWithFilteredResult(_0x4dd0bb,_0x27b6c0))[_0x26c4('0x3e')](handleError(_0x4dd0bb,null));};exports[_0x26c4('0x3f')]=function(_0x23b925,_0xb77ca9){var _0x470ac7={'raw':![],'where':{'id':_0x23b925['params']['id']}},_0x23c0d8={};_0x23c0d8['model']=_['keys'](db['AnalyticFieldReport'][_0x26c4('0x28')]);_0x23c0d8[_0x26c4('0x2a')]=_[_0x26c4('0x29')](_0x23b925[_0x26c4('0x2a')]);_0x23c0d8['filters']=_[_0x26c4('0x2c')](_0x23c0d8['model'],_0x23c0d8['query']);_0x470ac7[_0x26c4('0x2f')]=_[_0x26c4('0x2c')](_0x23c0d8[_0x26c4('0x2d')],qs[_0x26c4('0x2e')](_0x23b925[_0x26c4('0x2a')][_0x26c4('0x2e')]));_0x470ac7[_0x26c4('0x2f')]=_0x470ac7[_0x26c4('0x2f')]['length']?_0x470ac7[_0x26c4('0x2f')]:_0x23c0d8[_0x26c4('0x2d')];if(_0x23b925[_0x26c4('0x2a')][_0x26c4('0x3a')]){_0x470ac7['include']=[{'all':!![]}];}_0x470ac7=_[_0x26c4('0x37')]({},_0x470ac7,_0x23b925['options']);return db[_0x26c4('0x3b')][_0x26c4('0x40')](_0x470ac7)['then'](handleEntityNotFound(_0xb77ca9,null))[_0x26c4('0x22')](respondWithResult(_0xb77ca9,null))[_0x26c4('0x3e')](handleError(_0xb77ca9,null));};exports[_0x26c4('0x41')]=function(_0x2d4981,_0x20daba){return db['AnalyticFieldReport'][_0x26c4('0x41')](_0x2d4981[_0x26c4('0x42')],{})[_0x26c4('0x22')](respondWithResult(_0x20daba,0xc9))[_0x26c4('0x3e')](handleError(_0x20daba,null));};exports[_0x26c4('0x43')]=function(_0x2701e2,_0x5a0dad){return db[_0x26c4('0x3b')][_0x26c4('0x43')](_0x2701e2[_0x26c4('0x42')],{'raw':![],'individualHooks':!![]})[_0x26c4('0x22')](respondWithResult(_0x5a0dad,0xc9))[_0x26c4('0x3e')](handleError(_0x5a0dad,null));};exports[_0x26c4('0x21')]=function(_0x28ceb2,_0xca0888){if(_0x28ceb2[_0x26c4('0x42')]['id']){delete _0x28ceb2[_0x26c4('0x42')]['id'];}return db[_0x26c4('0x3b')]['find']({'where':{'id':_0x28ceb2[_0x26c4('0x44')]['id']}})[_0x26c4('0x22')](handleEntityNotFound(_0xca0888,null))[_0x26c4('0x22')](saveUpdates(_0x28ceb2['body'],null))[_0x26c4('0x22')](respondWithResult(_0xca0888,null))[_0x26c4('0x3e')](handleError(_0xca0888,null));};exports[_0x26c4('0x23')]=function(_0x4927fb,_0x1f5976){return db[_0x26c4('0x3b')]['find']({'where':{'id':_0x4927fb[_0x26c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5976,null))[_0x26c4('0x22')](removeEntity(_0x1f5976,null))[_0x26c4('0x3e')](handleError(_0x1f5976,null));};exports[_0x26c4('0x45')]=function(_0x3c9efb,_0x183459){return db['AnalyticFieldReport'][_0x26c4('0x23')]({'where':{'id':_0x3c9efb[_0x26c4('0x2a')][_0x26c4('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x26c4('0x22')](respondWithResult(_0x183459,0xcc))[_0x26c4('0x3e')](handleError(_0x183459,null));};exports['addFields']=function(_0x31ea30,_0x54df94,_0x28e6f6){return db[_0x26c4('0x47')][_0x26c4('0x48')]({'where':{'id':_0x31ea30[_0x26c4('0x44')]['id']}})[_0x26c4('0x22')](handleEntityNotFound(_0x54df94,null))[_0x26c4('0x22')](function(_0x5de481){if(_0x5de481){return db[_0x26c4('0x49')]['transaction'](function(_0x528e27){return db['AnalyticFieldReport'][_0x26c4('0x23')]({'where':{'CustomReportId':_0x31ea30[_0x26c4('0x44')]['id']},'transaction':_0x528e27})[_0x26c4('0x22')](function(_0xc62043){var _0x4e405d=_[_0x26c4('0x27')](_0x31ea30[_0x26c4('0x42')],function(_0x383056){delete _0x383056['id'];_0x383056[_0x26c4('0x4a')]=_0x31ea30[_0x26c4('0x44')]['id'];return _0x383056;});return db[_0x26c4('0x3b')][_0x26c4('0x43')](_0x4e405d,{'transaction':_0x528e27});});})[_0x26c4('0x22')](function(){return db['AnalyticFieldReport'][_0x26c4('0x3c')]({'where':{'CustomReportId':_0x31ea30['params']['id']}});});}})['then'](respondWithResult(_0x54df94,null))[_0x26c4('0x3e')](handleError(_0x54df94,null));};
\ No newline at end of file
+var _0x0282=['to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','addFields','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x441b5f,_0x3ee529){var _0x3fc66f=function(_0xd7b2af){while(--_0xd7b2af){_0x441b5f['push'](_0x441b5f['shift']());}};_0x3fc66f(++_0x3ee529);}(_0x0282,0xd6));var _0x2028=function(_0x114733,_0x566111){_0x114733=_0x114733-0x0;var _0x2654d7=_0x0282[_0x114733];return _0x2654d7;};'use strict';var emlformat=require(_0x2028('0x0'));var rimraf=require(_0x2028('0x1'));var zipdir=require(_0x2028('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2028('0x3'));var moment=require(_0x2028('0x4'));var BPromise=require(_0x2028('0x5'));var Mustache=require('mustache');var util=require(_0x2028('0x6'));var path=require(_0x2028('0x7'));var sox=require(_0x2028('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2028('0x9'));var _=require(_0x2028('0xa'));var squel=require('squel');var crypto=require(_0x2028('0xb'));var jsforce=require(_0x2028('0xc'));var deskjs=require(_0x2028('0xd'));var toCsv=require(_0x2028('0xe'));var querystring=require(_0x2028('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2028('0x10'));var qs=require(_0x2028('0x11'));var as=require(_0x2028('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2028('0x13'));var licenseUtil=require(_0x2028('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6dfb8e,_0x3e2fe8){_0x3e2fe8=_0x3e2fe8||0xcc;return function(_0x178634){if(_0x178634){return _0x6dfb8e[_0x2028('0x15')](_0x3e2fe8);}return _0x6dfb8e[_0x2028('0x16')](_0x3e2fe8)['end']();};}function respondWithResult(_0x1edadb,_0x5678cf){_0x5678cf=_0x5678cf||0xc8;return function(_0x5e078a){if(_0x5e078a){return _0x1edadb['status'](_0x5678cf)[_0x2028('0x17')](_0x5e078a);}};}function respondWithFilteredResult(_0x44f199,_0x2478af){return function(_0x1425df){if(_0x1425df){var _0x5755db=typeof _0x2478af[_0x2028('0x18')]===_0x2028('0x19')&&typeof _0x2478af[_0x2028('0x1a')]===_0x2028('0x19');var _0x3c205d=_0x1425df[_0x2028('0x1b')];var _0x1b6c52=_0x5755db?0x0:_0x2478af['offset'];var _0x2785cb=_0x5755db?_0x1425df[_0x2028('0x1b')]:_0x2478af[_0x2028('0x18')]+_0x2478af['limit'];var _0x455fba;if(_0x2785cb>=_0x3c205d){_0x2785cb=_0x3c205d;_0x455fba=0xc8;}else{_0x455fba=0xce;}_0x44f199['status'](_0x455fba);return _0x44f199['set'](_0x2028('0x1c'),_0x1b6c52+'-'+_0x2785cb+'/'+_0x3c205d)[_0x2028('0x17')](_0x1425df);}return null;};}function patchUpdates(_0x5c9c97){return function(_0x4af690){try{jsonpatch[_0x2028('0x1d')](_0x4af690,_0x5c9c97,!![]);}catch(_0x323a8d){return BPromise[_0x2028('0x1e')](_0x323a8d);}return _0x4af690['save']();};}function saveUpdates(_0x403ac5,_0x4c51d1){return function(_0x128339){if(_0x128339){return _0x128339[_0x2028('0x1f')](_0x403ac5)[_0x2028('0x20')](function(_0x85ae8f){return _0x85ae8f;});}return null;};}function removeEntity(_0x412740,_0x3489bf){return function(_0x4af8db){if(_0x4af8db){return _0x4af8db[_0x2028('0x21')]()[_0x2028('0x20')](function(){_0x412740[_0x2028('0x16')](0xcc)[_0x2028('0x22')]();});}};}function handleEntityNotFound(_0x8358f7,_0x4e75e3){return function(_0x2ebf78){if(!_0x2ebf78){_0x8358f7[_0x2028('0x15')](0x194);}return _0x2ebf78;};}function handleError(_0x47d80b,_0x5d28f9){_0x5d28f9=_0x5d28f9||0x1f4;return function(_0x252200){logger['error'](_0x252200['stack']);if(_0x252200[_0x2028('0x23')]){delete _0x252200[_0x2028('0x23')];}_0x47d80b[_0x2028('0x16')](_0x5d28f9)['send'](_0x252200);};}exports[_0x2028('0x24')]=function(_0x403ae2,_0x585860){var _0x51cae2={},_0x11e3e8={},_0x4bb457={'count':0x0,'rows':[]};var _0x57ad34=_[_0x2028('0x25')](db[_0x2028('0x26')][_0x2028('0x27')],function(_0x33b616){return{'name':_0x33b616[_0x2028('0x28')],'type':_0x33b616[_0x2028('0x29')][_0x2028('0x2a')]};});_0x11e3e8[_0x2028('0x2b')]=_[_0x2028('0x25')](_0x57ad34,_0x2028('0x23'));_0x11e3e8[_0x2028('0x2c')]=_[_0x2028('0x2d')](_0x403ae2[_0x2028('0x2c')]);_0x11e3e8[_0x2028('0x2e')]=_[_0x2028('0x2f')](_0x11e3e8[_0x2028('0x2b')],_0x11e3e8[_0x2028('0x2c')]);_0x51cae2[_0x2028('0x30')]=_[_0x2028('0x2f')](_0x11e3e8[_0x2028('0x2b')],qs['fields'](_0x403ae2[_0x2028('0x2c')][_0x2028('0x31')]));_0x51cae2[_0x2028('0x30')]=_0x51cae2[_0x2028('0x30')]['length']?_0x51cae2[_0x2028('0x30')]:_0x11e3e8[_0x2028('0x2b')];if(!_0x403ae2[_0x2028('0x2c')][_0x2028('0x32')](_0x2028('0x33'))){_0x51cae2[_0x2028('0x1a')]=qs[_0x2028('0x1a')](_0x403ae2[_0x2028('0x2c')][_0x2028('0x1a')]);_0x51cae2[_0x2028('0x18')]=qs['offset'](_0x403ae2[_0x2028('0x2c')][_0x2028('0x18')]);}_0x51cae2[_0x2028('0x34')]=qs[_0x2028('0x35')](_0x403ae2[_0x2028('0x2c')][_0x2028('0x35')]);_0x51cae2['where']=qs[_0x2028('0x2e')](_[_0x2028('0x36')](_0x403ae2[_0x2028('0x2c')],_0x11e3e8[_0x2028('0x2e')]),_0x57ad34);if(_0x403ae2[_0x2028('0x2c')][_0x2028('0x37')]){_0x51cae2[_0x2028('0x38')]=_[_0x2028('0x39')](_0x51cae2['where'],{'$or':_[_0x2028('0x25')](_0x57ad34,function(_0x2d912e){if(_0x2d912e[_0x2028('0x29')]!==_0x2028('0x3a')){var _0x261210={};_0x261210[_0x2d912e[_0x2028('0x23')]]={'$like':'%'+_0x403ae2['query'][_0x2028('0x37')]+'%'};return _0x261210;}})});}_0x51cae2=_[_0x2028('0x39')]({},_0x51cae2,_0x403ae2[_0x2028('0x3b')]);var _0x5cac44={'where':_0x51cae2[_0x2028('0x38')]};return db[_0x2028('0x26')]['count'](_0x5cac44)[_0x2028('0x20')](function(_0x2be572){_0x4bb457['count']=_0x2be572;if(_0x403ae2[_0x2028('0x2c')][_0x2028('0x3c')]){_0x51cae2[_0x2028('0x3d')]=[{'all':!![]}];}return db[_0x2028('0x26')][_0x2028('0x3e')](_0x51cae2);})['then'](function(_0x46daf8){_0x4bb457[_0x2028('0x3f')]=_0x46daf8;return _0x4bb457;})['then'](respondWithFilteredResult(_0x585860,_0x51cae2))[_0x2028('0x40')](handleError(_0x585860,null));};exports[_0x2028('0x41')]=function(_0x377d60,_0x551998){var _0x393c6c={'raw':![],'where':{'id':_0x377d60[_0x2028('0x42')]['id']}},_0x3466b7={};_0x3466b7[_0x2028('0x2b')]=_[_0x2028('0x2d')](db[_0x2028('0x26')][_0x2028('0x27')]);_0x3466b7['query']=_[_0x2028('0x2d')](_0x377d60[_0x2028('0x2c')]);_0x3466b7['filters']=_[_0x2028('0x2f')](_0x3466b7['model'],_0x3466b7[_0x2028('0x2c')]);_0x393c6c[_0x2028('0x30')]=_[_0x2028('0x2f')](_0x3466b7[_0x2028('0x2b')],qs['fields'](_0x377d60[_0x2028('0x2c')][_0x2028('0x31')]));_0x393c6c[_0x2028('0x30')]=_0x393c6c[_0x2028('0x30')][_0x2028('0x43')]?_0x393c6c[_0x2028('0x30')]:_0x3466b7['model'];if(_0x377d60[_0x2028('0x2c')][_0x2028('0x3c')]){_0x393c6c[_0x2028('0x3d')]=[{'all':!![]}];}_0x393c6c=_[_0x2028('0x39')]({},_0x393c6c,_0x377d60[_0x2028('0x3b')]);return db['AnalyticFieldReport'][_0x2028('0x44')](_0x393c6c)[_0x2028('0x20')](handleEntityNotFound(_0x551998,null))[_0x2028('0x20')](respondWithResult(_0x551998,null))['catch'](handleError(_0x551998,null));};exports[_0x2028('0x45')]=function(_0x5728cb,_0x3ef3fc){return db[_0x2028('0x26')]['create'](_0x5728cb[_0x2028('0x46')],{})[_0x2028('0x20')](respondWithResult(_0x3ef3fc,0xc9))[_0x2028('0x40')](handleError(_0x3ef3fc,null));};exports[_0x2028('0x47')]=function(_0x265d90,_0x14b344){return db['AnalyticFieldReport']['bulkCreate'](_0x265d90['body'],{'raw':![],'individualHooks':!![]})[_0x2028('0x20')](respondWithResult(_0x14b344,0xc9))['catch'](handleError(_0x14b344,null));};exports[_0x2028('0x1f')]=function(_0x1d6794,_0x35b5d0){if(_0x1d6794['body']['id']){delete _0x1d6794[_0x2028('0x46')]['id'];}return db['AnalyticFieldReport'][_0x2028('0x44')]({'where':{'id':_0x1d6794[_0x2028('0x42')]['id']}})[_0x2028('0x20')](handleEntityNotFound(_0x35b5d0,null))[_0x2028('0x20')](saveUpdates(_0x1d6794[_0x2028('0x46')],null))[_0x2028('0x20')](respondWithResult(_0x35b5d0,null))[_0x2028('0x40')](handleError(_0x35b5d0,null));};exports['destroy']=function(_0x1d2c50,_0x1436f0){return db[_0x2028('0x26')][_0x2028('0x44')]({'where':{'id':_0x1d2c50[_0x2028('0x42')]['id']}})['then'](handleEntityNotFound(_0x1436f0,null))['then'](removeEntity(_0x1436f0,null))['catch'](handleError(_0x1436f0,null));};exports[_0x2028('0x48')]=function(_0x42bc36,_0x3d806d){return db[_0x2028('0x26')][_0x2028('0x21')]({'where':{'id':_0x42bc36[_0x2028('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3d806d,0xcc))['catch'](handleError(_0x3d806d,null));};exports[_0x2028('0x49')]=function(_0x580785,_0x411ced,_0x14a6a3){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x580785['params']['id']}})[_0x2028('0x20')](handleEntityNotFound(_0x411ced,null))[_0x2028('0x20')](function(_0x4b685d){if(_0x4b685d){return db['sequelize'][_0x2028('0x4a')](function(_0x1a8367){return db[_0x2028('0x26')][_0x2028('0x21')]({'where':{'CustomReportId':_0x580785[_0x2028('0x42')]['id']},'transaction':_0x1a8367})[_0x2028('0x20')](function(_0x3623e9){var _0x4e0c7a=_[_0x2028('0x25')](_0x580785[_0x2028('0x46')],function(_0xb51771){delete _0xb51771['id'];_0xb51771[_0x2028('0x4b')]=_0x580785[_0x2028('0x42')]['id'];return _0xb51771;});return db['AnalyticFieldReport'][_0x2028('0x47')](_0x4e0c7a,{'transaction':_0x1a8367});});})['then'](function(){return db['AnalyticFieldReport'][_0x2028('0x3e')]({'where':{'CustomReportId':_0x580785['params']['id']}});});}})[_0x2028('0x20')](respondWithResult(_0x411ced,null))['catch'](handleError(_0x411ced,null));};
\ No newline at end of file
index 4eb51fa..d0395ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3405=['moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','analytics_report_fields','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3405,0x1b7));var _0x5340=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x3405[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x5340('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5340('0x1'));var BPromise=require(_0x5340('0x2'));var rp=require(_0x5340('0x3'));var fs=require('fs');var path=require(_0x5340('0x4'));var rimraf=require('rimraf');var config=require(_0x5340('0x5'));var attributes=require(_0x5340('0x6'));module['exports']=function(_0x59d585,_0x25d1ef){return _0x59d585['define']('AnalyticFieldReport',attributes,{'tableName':_0x5340('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa77f=['define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x487d6e,_0x590ce7){var _0x3d0a2e=function(_0x4d559f){while(--_0x4d559f){_0x487d6e['push'](_0x487d6e['shift']());}};_0x3d0a2e(++_0x590ce7);}(_0xa77f,0xc7));var _0xfa77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa77f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xfa77('0x0'));var logger=require(_0xfa77('0x1'))(_0xfa77('0x2'));var moment=require(_0xfa77('0x3'));var BPromise=require(_0xfa77('0x4'));var rp=require(_0xfa77('0x5'));var fs=require('fs');var path=require(_0xfa77('0x6'));var rimraf=require(_0xfa77('0x7'));var config=require(_0xfa77('0x8'));var attributes=require(_0xfa77('0x9'));module[_0xfa77('0xa')]=function(_0x363a7f,_0x167c6c){return _0x363a7f[_0xfa77('0xb')](_0xfa77('0xc'),attributes,{'tableName':_0xfa77('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2c87d2e..d0546f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfab7=['code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0xfab7,0x193));var _0x7fab=function(_0x3a1d75,_0x54e3e1){_0x3a1d75=_0x3a1d75-0x0;var _0x48abb8=_0xfab7[_0x3a1d75];return _0x48abb8;};'use strict';var _=require('lodash');var util=require(_0x7fab('0x0'));var moment=require(_0x7fab('0x1'));var BPromise=require(_0x7fab('0x2'));var rs=require(_0x7fab('0x3'));var fs=require('fs');var Redis=require(_0x7fab('0x4'));var db=require(_0x7fab('0x5'))['db'];var utils=require(_0x7fab('0x6'));var logger=require('../../config/logger')(_0x7fab('0x7'));var config=require(_0x7fab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7fab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x234ddf,_0x283ecd,_0x4464fc){return new BPromise(function(_0x91f69d,_0x2d2ae1){return client[_0x7fab('0xa')](_0x234ddf,_0x4464fc)[_0x7fab('0xb')](function(_0x2b7f38){logger[_0x7fab('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x283ecd,_0x7fab('0xd'));logger[_0x7fab('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x283ecd,_0x7fab('0xd'),JSON[_0x7fab('0xf')](_0x2b7f38));if(_0x2b7f38[_0x7fab('0x10')]){if(_0x2b7f38[_0x7fab('0x10')][_0x7fab('0x11')]===0x1f4){logger[_0x7fab('0x10')](_0x7fab('0x12'),_0x283ecd,_0x2b7f38[_0x7fab('0x10')][_0x7fab('0x13')]);return _0x2d2ae1(_0x2b7f38['error']['message']);}logger['error'](_0x7fab('0x12'),_0x283ecd,_0x2b7f38[_0x7fab('0x10')][_0x7fab('0x13')]);return _0x91f69d(_0x2b7f38[_0x7fab('0x10')][_0x7fab('0x13')]);}else{logger['info'](_0x7fab('0x12'),_0x283ecd,_0x7fab('0xd'));_0x91f69d(_0x2b7f38['result'][_0x7fab('0x13')]);}})[_0x7fab('0x14')](function(_0x5227c0){logger[_0x7fab('0x10')](_0x7fab('0x12'),_0x283ecd,_0x5227c0);_0x2d2ae1(_0x5227c0);});});}
\ No newline at end of file
+var _0x1041=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x1041,0x164));var _0x1104=function(_0x475be2,_0xf0639){_0x475be2=_0x475be2-0x0;var _0x4ff8b1=_0x1041[_0x475be2];return _0x4ff8b1;};'use strict';var _=require(_0x1104('0x0'));var util=require(_0x1104('0x1'));var moment=require(_0x1104('0x2'));var BPromise=require(_0x1104('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1104('0x4'));var db=require(_0x1104('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1104('0x6'))('rpc');var config=require(_0x1104('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1104('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6d21,_0x26ed0e,_0x1dc875){return new BPromise(function(_0x14262d,_0x4be036){return client[_0x1104('0x9')](_0x3b6d21,_0x1dc875)[_0x1104('0xa')](function(_0x2d568c){logger[_0x1104('0xb')](_0x1104('0xc'),_0x26ed0e,_0x1104('0xd'));logger['debug'](_0x1104('0xe'),_0x26ed0e,_0x1104('0xd'),JSON[_0x1104('0xf')](_0x2d568c));if(_0x2d568c[_0x1104('0x10')]){if(_0x2d568c[_0x1104('0x10')][_0x1104('0x11')]===0x1f4){logger[_0x1104('0x10')](_0x1104('0xc'),_0x26ed0e,_0x2d568c['error'][_0x1104('0x12')]);return _0x4be036(_0x2d568c[_0x1104('0x10')][_0x1104('0x12')]);}logger[_0x1104('0x10')](_0x1104('0xc'),_0x26ed0e,_0x2d568c[_0x1104('0x10')][_0x1104('0x12')]);return _0x14262d(_0x2d568c['error']['message']);}else{logger['info'](_0x1104('0xc'),_0x26ed0e,_0x1104('0xd'));_0x14262d(_0x2d568c[_0x1104('0x13')][_0x1104('0x12')]);}})[_0x1104('0x14')](function(_0x50d27f){logger[_0x1104('0x10')](_0x1104('0xc'),_0x26ed0e,_0x50d27f);_0x4be036(_0x50d27f);});});}
\ No newline at end of file
index 2e300b3..aba39fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x20bf44,_0x159acc){var _0x4543b1=function(_0x1fe631){while(--_0x1fe631){_0x20bf44['push'](_0x20bf44['shift']());}};_0x4543b1(++_0x159acc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
+var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x59a18e,_0x546652){var _0x27ab29=function(_0xe47dcc){while(--_0xe47dcc){_0x59a18e['push'](_0x59a18e['shift']());}};_0x27ab29(++_0x546652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
index d384a3f..1a6b0ab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9434=['sequelize','exports','STRING','name','TEXT'];(function(_0x53724f,_0x127ee4){var _0x4b280c=function(_0x552b18){while(--_0x552b18){_0x53724f['push'](_0x53724f['shift']());}};_0x4b280c(++_0x127ee4);}(_0x9434,0x168));var _0x4943=function(_0xed89bd,_0x524322){_0xed89bd=_0xed89bd-0x0;var _0x9632b6=_0x9434[_0xed89bd];return _0x9632b6;};'use strict';var Sequelize=require(_0x4943('0x0'));module[_0x4943('0x1')]={'name':{'type':Sequelize[_0x4943('0x2')],'allowNull':![],'unique':_0x4943('0x3')},'table':{'type':Sequelize[_0x4943('0x2')]},'metric':{'type':Sequelize[_0x4943('0x4')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xc7a7=['TEXT','sequelize','exports','STRING'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xc7a7,0x171));var _0x7c7a=function(_0x44a470,_0x118027){_0x44a470=_0x44a470-0x0;var _0x3a5d72=_0xc7a7[_0x44a470];return _0x3a5d72;};'use strict';var Sequelize=require(_0x7c7a('0x0'));module[_0x7c7a('0x1')]={'name':{'type':Sequelize[_0x7c7a('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7c7a('0x2')]},'metric':{'type':Sequelize[_0x7c7a('0x3')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index f9211b0..a3cc3ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x4a0b86,_0x484fa8){var _0x37ee69=function(_0x262e2f){while(--_0x262e2f){_0x4a0b86['push'](_0x4a0b86['shift']());}};_0x37ee69(++_0x484fa8);}(_0x3e74,0x175));var _0x43e7=function(_0x24069b,_0x3b48a5){_0x24069b=_0x24069b-0x0;var _0x358cf1=_0x3e74[_0x24069b];return _0x358cf1;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));};
\ No newline at end of file
+var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x4fcc99,_0x285125){var _0x2ca5bd=function(_0x3b006f){while(--_0x3b006f){_0x4fcc99['push'](_0x4fcc99['shift']());}};_0x2ca5bd(++_0x285125);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x5fc3[_0x1d426f];return _0x17f71a;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));};
\ No newline at end of file
index 0baa656..4b7523d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd05=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','moment','bluebird','request-promise','path'];(function(_0x4782eb,_0x1dafc9){var _0x9f1353=function(_0x1b74b4){while(--_0x1b74b4){_0x4782eb['push'](_0x4782eb['shift']());}};_0x9f1353(++_0x1dafc9);}(_0xcd05,0x163));var _0x5cd0=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0xcd05[_0xa4c85];return _0x172c1f;};'use strict';var _=require(_0x5cd0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5cd0('0x1'));var BPromise=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var fs=require('fs');var path=require(_0x5cd0('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd0('0x5'));var attributes=require(_0x5cd0('0x6'));module['exports']=function(_0x47c141,_0x4eea17){return _0x47c141[_0x5cd0('0x7')](_0x5cd0('0x8'),attributes,{'tableName':_0x5cd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x714c=['define','util','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x714c,0x18d));var _0xc714=function(_0x11c090,_0x7d8e4e){_0x11c090=_0x11c090-0x0;var _0x444c13=_0x714c[_0x11c090];return _0x444c13;};'use strict';var _=require('lodash');var util=require(_0xc714('0x0'));var logger=require(_0xc714('0x1'))(_0xc714('0x2'));var moment=require(_0xc714('0x3'));var BPromise=require(_0xc714('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc714('0x5'));var rimraf=require(_0xc714('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xc714('0x7')]=function(_0xf624fc,_0x1c4a3b){return _0xf624fc[_0xc714('0x8')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a43c456..5cd4cf9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2b0=['../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x242575,_0x57a331){var _0x2ff352=function(_0x2bb24b){while(--_0x2bb24b){_0x242575['push'](_0x242575['shift']());}};_0x2ff352(++_0x57a331);}(_0xf2b0,0x1b1));var _0x0f2b=function(_0x48ef06,_0x3ce392){_0x48ef06=_0x48ef06-0x0;var _0x1e783b=_0xf2b0[_0x48ef06];return _0x1e783b;};'use strict';var _=require(_0x0f2b('0x0'));var util=require(_0x0f2b('0x1'));var moment=require('moment');var BPromise=require(_0x0f2b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f2b('0x3'));var db=require(_0x0f2b('0x4'))['db'];var utils=require(_0x0f2b('0x5'));var logger=require(_0x0f2b('0x6'))(_0x0f2b('0x7'));var config=require(_0x0f2b('0x8'));var jayson=require(_0x0f2b('0x9'));var client=jayson[_0x0f2b('0xa')][_0x0f2b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43fb70,_0x5acb85,_0x1e6399){return new BPromise(function(_0x46d267,_0x348fc7){return client['request'](_0x43fb70,_0x1e6399)[_0x0f2b('0xc')](function(_0x36def9){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5acb85,'request\x20sent');logger[_0x0f2b('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5acb85,_0x0f2b('0xe'),JSON[_0x0f2b('0xf')](_0x36def9));if(_0x36def9[_0x0f2b('0x10')]){if(_0x36def9[_0x0f2b('0x10')][_0x0f2b('0x11')]===0x1f4){logger[_0x0f2b('0x10')](_0x0f2b('0x12'),_0x5acb85,_0x36def9[_0x0f2b('0x10')]['message']);return _0x348fc7(_0x36def9[_0x0f2b('0x10')][_0x0f2b('0x13')]);}logger[_0x0f2b('0x10')](_0x0f2b('0x12'),_0x5acb85,_0x36def9[_0x0f2b('0x10')]['message']);return _0x46d267(_0x36def9['error']['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5acb85,_0x0f2b('0xe'));_0x46d267(_0x36def9['result'][_0x0f2b('0x13')]);}})[_0x0f2b('0x14')](function(_0x1abf88){logger[_0x0f2b('0x10')](_0x0f2b('0x12'),_0x5acb85,_0x1abf88);_0x348fc7(_0x1abf88);});});}
\ No newline at end of file
+var _0xcbed=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbed,0xc9));var _0xdcbe=function(_0x18070a,_0x2ee80a){_0x18070a=_0x18070a-0x0;var _0x20f3d0=_0xcbed[_0x18070a];return _0x20f3d0;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var moment=require(_0xdcbe('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcbe('0x3'));var fs=require('fs');var Redis=require(_0xdcbe('0x4'));var db=require(_0xdcbe('0x5'))['db'];var utils=require(_0xdcbe('0x6'));var logger=require(_0xdcbe('0x7'))(_0xdcbe('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdcbe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31fea9,_0x8116dd,_0x33b8cf){return new BPromise(function(_0x319233,_0x2d78c3){return client['request'](_0x31fea9,_0x33b8cf)[_0xdcbe('0xa')](function(_0x5baf53){logger[_0xdcbe('0xb')](_0xdcbe('0xc'),_0x8116dd,'request\x20sent');logger[_0xdcbe('0xd')](_0xdcbe('0xe'),_0x8116dd,_0xdcbe('0xf'),JSON[_0xdcbe('0x10')](_0x5baf53));if(_0x5baf53[_0xdcbe('0x11')]){if(_0x5baf53['error'][_0xdcbe('0x12')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x8116dd,_0x5baf53[_0xdcbe('0x11')][_0xdcbe('0x13')]);return _0x2d78c3(_0x5baf53[_0xdcbe('0x11')][_0xdcbe('0x13')]);}logger[_0xdcbe('0x11')](_0xdcbe('0xc'),_0x8116dd,_0x5baf53['error']['message']);return _0x319233(_0x5baf53['error']['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x8116dd,'request\x20sent');_0x319233(_0x5baf53[_0xdcbe('0x14')][_0xdcbe('0x13')]);}})[_0xdcbe('0x15')](function(_0x3f20c4){logger[_0xdcbe('0x11')](_0xdcbe('0xc'),_0x8116dd,_0x3f20c4);_0x2d78c3(_0x3f20c4);});});}
\ No newline at end of file
index 0ffe981..c7b01d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce1a=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','get','/:id','put','update','exports','multer','express','Router','fs-extra'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xce1a,0xbf));var _0xace1=function(_0x1b7aa2,_0x570bf6){_0x1b7aa2=_0x1b7aa2-0x0;var _0x5ad2c8=_0xce1a[_0x1b7aa2];return _0x5ad2c8;};'use strict';var multer=require(_0xace1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace1('0x1'));var router=express[_0xace1('0x2')]();var fs_extra=require(_0xace1('0x3'));var auth=require(_0xace1('0x4'));var interaction=require(_0xace1('0x5'));var config=require('../../config/environment');var controller=require(_0xace1('0x6'));router['get']('/',auth[_0xace1('0x7')](),controller['index']);router[_0xace1('0x8')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['show']);router['post']('/',auth[_0xace1('0x7')](),controller['create']);router[_0xace1('0xa')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller[_0xace1('0xb')]);router['delete'](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['destroy']);module[_0xace1('0xc')]=router;
\ No newline at end of file
+var _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x472063,_0x11a264){var _0x17a1bf=function(_0x21f9d4){while(--_0x21f9d4){_0x472063['push'](_0x472063['shift']());}};_0x17a1bf(++_0x11a264);}(_0x814b,0x1a2));var _0xb814=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0x814b[_0x308dcc];return _0x361717;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['destroy']);module[_0xb814('0x13')]=router;
\ No newline at end of file
index a8c1693..ebf4ebd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9de5=['exports','sequelize'];(function(_0x1d4712,_0x4156e6){var _0x5ef8ec=function(_0x421374){while(--_0x421374){_0x1d4712['push'](_0x1d4712['shift']());}};_0x5ef8ec(++_0x4156e6);}(_0x9de5,0x169));var _0x59de=function(_0x21ab2c,_0x7cf04a){_0x21ab2c=_0x21ab2c-0x0;var _0x25ad1f=_0x9de5[_0x21ab2c];return _0x25ad1f;};'use strict';var Sequelize=require(_0x59de('0x0'));module[_0x59de('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}};
\ No newline at end of file
+var _0x2639=['sequelize','exports','TEXT'];(function(_0x195e57,_0x102797){var _0x34f4fd=function(_0x42489e){while(--_0x42489e){_0x195e57['push'](_0x195e57['shift']());}};_0x34f4fd(++_0x102797);}(_0x2639,0xd5));var _0x9263=function(_0x1acf8f,_0x124105){_0x1acf8f=_0x1acf8f-0x0;var _0x458b6a=_0x2639[_0x1acf8f];return _0x458b6a;};'use strict';var Sequelize=require(_0x9263('0x0'));module[_0x9263('0x1')]={'tree':{'type':Sequelize[_0x9263('0x2')],'allowNull':![]}};
\ No newline at end of file
index 6b2c371..eb00599 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x117b=['intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','then','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters'];(function(_0xd6e343,_0x41a619){var _0x5c0e4a=function(_0x2a8e6a){while(--_0x2a8e6a){_0xd6e343['push'](_0xd6e343['shift']());}};_0x5c0e4a(++_0x41a619);}(_0x117b,0x1e8));var _0xb117=function(_0x53288a,_0x4182de){_0x53288a=_0x53288a-0x0;var _0x17a80d=_0x117b[_0x53288a];return _0x17a80d;};'use strict';var emlformat=require(_0xb117('0x0'));var rimraf=require(_0xb117('0x1'));var zipdir=require(_0xb117('0x2'));var jsonpatch=require(_0xb117('0x3'));var rp=require(_0xb117('0x4'));var moment=require(_0xb117('0x5'));var BPromise=require(_0xb117('0x6'));var Mustache=require(_0xb117('0x7'));var util=require(_0xb117('0x8'));var path=require('path');var sox=require(_0xb117('0x9'));var csv=require(_0xb117('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb117('0xb'));var _=require(_0xb117('0xc'));var squel=require(_0xb117('0xd'));var crypto=require(_0xb117('0xe'));var jsforce=require(_0xb117('0xf'));var deskjs=require(_0xb117('0x10'));var toCsv=require(_0xb117('0xa'));var querystring=require('querystring');var Papa=require(_0xb117('0x11'));var Redis=require('ioredis');var authService=require(_0xb117('0x12'));var qs=require(_0xb117('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb117('0x14'));var logger=require('../../config/logger')(_0xb117('0x15'));var utils=require(_0xb117('0x16'));var config=require(_0xb117('0x17'));var licenseUtil=require(_0xb117('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18126b,_0x1811e9){_0x1811e9=_0x1811e9||0xcc;return function(_0x4239af){if(_0x4239af){return _0x18126b[_0xb117('0x19')](_0x1811e9);}return _0x18126b[_0xb117('0x1a')](_0x1811e9)[_0xb117('0x1b')]();};}function respondWithResult(_0x224b7b,_0x2c0e39){_0x2c0e39=_0x2c0e39||0xc8;return function(_0x3c6ba5){if(_0x3c6ba5){return _0x224b7b['status'](_0x2c0e39)[_0xb117('0x1c')](_0x3c6ba5);}};}function respondWithFilteredResult(_0x50ddb7,_0x3bff3b){return function(_0x298cf3){if(_0x298cf3){var _0xf255d2=typeof _0x3bff3b['offset']===_0xb117('0x1d')&&typeof _0x3bff3b[_0xb117('0x1e')]===_0xb117('0x1d');var _0x9dfc93=_0x298cf3[_0xb117('0x1f')];var _0x359ce7=_0xf255d2?0x0:_0x3bff3b[_0xb117('0x20')];var _0x408bbc=_0xf255d2?_0x298cf3[_0xb117('0x1f')]:_0x3bff3b[_0xb117('0x20')]+_0x3bff3b[_0xb117('0x1e')];var _0x265306;if(_0x408bbc>=_0x9dfc93){_0x408bbc=_0x9dfc93;_0x265306=0xc8;}else{_0x265306=0xce;}_0x50ddb7[_0xb117('0x1a')](_0x265306);return _0x50ddb7[_0xb117('0x21')](_0xb117('0x22'),_0x359ce7+'-'+_0x408bbc+'/'+_0x9dfc93)[_0xb117('0x1c')](_0x298cf3);}return null;};}function patchUpdates(_0x714de1){return function(_0x51f668){try{jsonpatch['apply'](_0x51f668,_0x714de1,!![]);}catch(_0x3eb6f6){return BPromise['reject'](_0x3eb6f6);}return _0x51f668[_0xb117('0x23')]();};}function saveUpdates(_0x57cb5b,_0x5c960f){return function(_0x50d9dd){if(_0x50d9dd){return _0x50d9dd[_0xb117('0x24')](_0x57cb5b)['then'](function(_0x1f0d23){return _0x1f0d23;});}return null;};}function removeEntity(_0x11be36,_0x3949b4){return function(_0x1b19ca){if(_0x1b19ca){return _0x1b19ca[_0xb117('0x25')]()['then'](function(){_0x11be36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x652e0,_0x304756){return function(_0x10297a){if(!_0x10297a){_0x652e0[_0xb117('0x19')](0x194);}return _0x10297a;};}function handleError(_0xb10c0b,_0x35fe03){_0x35fe03=_0x35fe03||0x1f4;return function(_0x48dc1e){logger[_0xb117('0x26')](_0x48dc1e[_0xb117('0x27')]);if(_0x48dc1e[_0xb117('0x28')]){delete _0x48dc1e[_0xb117('0x28')];}_0xb10c0b[_0xb117('0x1a')](_0x35fe03)[_0xb117('0x29')](_0x48dc1e);};}exports[_0xb117('0x2a')]=function(_0x1a9340,_0x954e54){var _0x32ab93={},_0x4c0535={},_0x454933={'count':0x0,'rows':[]};var _0x2eb1fe=_['map'](db['AnalyticTreeReport'][_0xb117('0x2b')],function(_0xe047c4){return{'name':_0xe047c4[_0xb117('0x2c')],'type':_0xe047c4[_0xb117('0x2d')][_0xb117('0x2e')]};});_0x4c0535[_0xb117('0x2f')]=_[_0xb117('0x30')](_0x2eb1fe,_0xb117('0x28'));_0x4c0535['query']=_[_0xb117('0x31')](_0x1a9340['query']);_0x4c0535[_0xb117('0x32')]=_[_0xb117('0x33')](_0x4c0535['model'],_0x4c0535['query']);_0x32ab93[_0xb117('0x34')]=_[_0xb117('0x33')](_0x4c0535[_0xb117('0x2f')],qs[_0xb117('0x35')](_0x1a9340[_0xb117('0x36')][_0xb117('0x35')]));_0x32ab93['attributes']=_0x32ab93[_0xb117('0x34')]['length']?_0x32ab93['attributes']:_0x4c0535[_0xb117('0x2f')];if(!_0x1a9340[_0xb117('0x36')][_0xb117('0x37')](_0xb117('0x38'))){_0x32ab93[_0xb117('0x1e')]=qs[_0xb117('0x1e')](_0x1a9340[_0xb117('0x36')]['limit']);_0x32ab93[_0xb117('0x20')]=qs[_0xb117('0x20')](_0x1a9340[_0xb117('0x36')][_0xb117('0x20')]);}_0x32ab93[_0xb117('0x39')]=qs[_0xb117('0x3a')](_0x1a9340[_0xb117('0x36')][_0xb117('0x3a')]);_0x32ab93[_0xb117('0x3b')]=qs[_0xb117('0x32')](_[_0xb117('0x3c')](_0x1a9340[_0xb117('0x36')],_0x4c0535[_0xb117('0x32')]),_0x2eb1fe);if(_0x1a9340[_0xb117('0x36')][_0xb117('0x3d')]){_0x32ab93['where']=_[_0xb117('0x3e')](_0x32ab93[_0xb117('0x3b')],{'$or':_[_0xb117('0x30')](_0x2eb1fe,function(_0x4b9c06){if(_0x4b9c06[_0xb117('0x2d')]!==_0xb117('0x3f')){var _0x2bc23e={};_0x2bc23e[_0x4b9c06[_0xb117('0x28')]]={'$like':'%'+_0x1a9340[_0xb117('0x36')][_0xb117('0x3d')]+'%'};return _0x2bc23e;}})});}_0x32ab93=_['merge']({},_0x32ab93,_0x1a9340[_0xb117('0x40')]);var _0x40c662={'where':_0x32ab93[_0xb117('0x3b')]};return db[_0xb117('0x41')][_0xb117('0x1f')](_0x40c662)['then'](function(_0x4d546d){_0x454933[_0xb117('0x1f')]=_0x4d546d;if(_0x1a9340[_0xb117('0x36')][_0xb117('0x42')]){_0x32ab93[_0xb117('0x43')]=[{'all':!![]}];}return db[_0xb117('0x41')][_0xb117('0x44')](_0x32ab93);})[_0xb117('0x45')](function(_0x4d0cf6){_0x454933[_0xb117('0x46')]=_0x4d0cf6;return _0x454933;})[_0xb117('0x45')](respondWithFilteredResult(_0x954e54,_0x32ab93))['catch'](handleError(_0x954e54,null));};exports[_0xb117('0x47')]=function(_0x461558,_0xef69c0){var _0x2ee515={'raw':!![],'where':{'id':_0x461558[_0xb117('0x48')]['id']}},_0x81586a={};_0x81586a[_0xb117('0x2f')]=_[_0xb117('0x31')](db['AnalyticTreeReport'][_0xb117('0x2b')]);_0x81586a[_0xb117('0x36')]=_['keys'](_0x461558[_0xb117('0x36')]);_0x81586a[_0xb117('0x32')]=_['intersection'](_0x81586a['model'],_0x81586a[_0xb117('0x36')]);_0x2ee515[_0xb117('0x34')]=_['intersection'](_0x81586a[_0xb117('0x2f')],qs[_0xb117('0x35')](_0x461558[_0xb117('0x36')][_0xb117('0x35')]));_0x2ee515['attributes']=_0x2ee515[_0xb117('0x34')]['length']?_0x2ee515[_0xb117('0x34')]:_0x81586a[_0xb117('0x2f')];if(_0x461558[_0xb117('0x36')][_0xb117('0x42')]){_0x2ee515[_0xb117('0x43')]=[{'all':!![]}];}_0x2ee515=_[_0xb117('0x3e')]({},_0x2ee515,_0x461558[_0xb117('0x40')]);return db['AnalyticTreeReport'][_0xb117('0x49')](_0x2ee515)['then'](handleEntityNotFound(_0xef69c0,null))[_0xb117('0x45')](respondWithResult(_0xef69c0,null))['catch'](handleError(_0xef69c0,null));};exports[_0xb117('0x4a')]=function(_0x117746,_0x2c85ff){return db[_0xb117('0x41')][_0xb117('0x4a')](_0x117746[_0xb117('0x4b')],{})[_0xb117('0x45')](respondWithResult(_0x2c85ff,0xc9))[_0xb117('0x4c')](handleError(_0x2c85ff,null));};exports[_0xb117('0x24')]=function(_0x235965,_0x34bdbd){if(_0x235965[_0xb117('0x4b')]['id']){delete _0x235965['body']['id'];}return db[_0xb117('0x41')][_0xb117('0x49')]({'where':{'id':_0x235965[_0xb117('0x48')]['id']}})['then'](handleEntityNotFound(_0x34bdbd,null))[_0xb117('0x45')](saveUpdates(_0x235965[_0xb117('0x4b')],null))['then'](respondWithResult(_0x34bdbd,null))[_0xb117('0x4c')](handleError(_0x34bdbd,null));};exports[_0xb117('0x25')]=function(_0x5cdad9,_0x2293b){return db[_0xb117('0x41')][_0xb117('0x49')]({'where':{'id':_0x5cdad9[_0xb117('0x48')]['id']}})['then'](handleEntityNotFound(_0x2293b,null))['then'](removeEntity(_0x2293b,null))[_0xb117('0x4c')](handleError(_0x2293b,null));};
\ No newline at end of file
+var _0x5a92=['send','index','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','merge','where','map','VIRTUAL','options','count','include','AnalyticTreeReport','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','then','destroy','error','stack'];(function(_0x4f37d6,_0x455d45){var _0x333b31=function(_0x4ee89e){while(--_0x4ee89e){_0x4f37d6['push'](_0x4f37d6['shift']());}};_0x333b31(++_0x455d45);}(_0x5a92,0x1ab));var _0x25a9=function(_0x352274,_0x357438){_0x352274=_0x352274-0x0;var _0x1d3e8a=_0x5a92[_0x352274];return _0x1d3e8a;};'use strict';var emlformat=require(_0x25a9('0x0'));var rimraf=require(_0x25a9('0x1'));var zipdir=require(_0x25a9('0x2'));var jsonpatch=require(_0x25a9('0x3'));var rp=require(_0x25a9('0x4'));var moment=require(_0x25a9('0x5'));var BPromise=require(_0x25a9('0x6'));var Mustache=require(_0x25a9('0x7'));var util=require(_0x25a9('0x8'));var path=require(_0x25a9('0x9'));var sox=require(_0x25a9('0xa'));var csv=require(_0x25a9('0xb'));var ejs=require(_0x25a9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25a9('0xd'));var squel=require('squel');var crypto=require(_0x25a9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x25a9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x25a9('0x10'));var Papa=require(_0x25a9('0x11'));var Redis=require(_0x25a9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x25a9('0x13'));var as=require(_0x25a9('0x14'));var hardwareService=require(_0x25a9('0x15'));var logger=require(_0x25a9('0x16'))('api');var utils=require(_0x25a9('0x17'));var config=require(_0x25a9('0x18'));var licenseUtil=require(_0x25a9('0x19'));var db=require(_0x25a9('0x1a'))['db'];function respondWithStatusCode(_0x10f213,_0xd15536){_0xd15536=_0xd15536||0xcc;return function(_0x13a5e5){if(_0x13a5e5){return _0x10f213[_0x25a9('0x1b')](_0xd15536);}return _0x10f213[_0x25a9('0x1c')](_0xd15536)[_0x25a9('0x1d')]();};}function respondWithResult(_0x1aa78b,_0x5e4c86){_0x5e4c86=_0x5e4c86||0xc8;return function(_0x4962af){if(_0x4962af){return _0x1aa78b[_0x25a9('0x1c')](_0x5e4c86)[_0x25a9('0x1e')](_0x4962af);}};}function respondWithFilteredResult(_0x57450c,_0x3ccce5){return function(_0x440ad0){if(_0x440ad0){var _0xfe8a96=typeof _0x3ccce5['offset']===_0x25a9('0x1f')&&typeof _0x3ccce5[_0x25a9('0x20')]==='undefined';var _0x43408c=_0x440ad0['count'];var _0x5f1880=_0xfe8a96?0x0:_0x3ccce5[_0x25a9('0x21')];var _0x3a69da=_0xfe8a96?_0x440ad0['count']:_0x3ccce5[_0x25a9('0x21')]+_0x3ccce5[_0x25a9('0x20')];var _0x1efc2b;if(_0x3a69da>=_0x43408c){_0x3a69da=_0x43408c;_0x1efc2b=0xc8;}else{_0x1efc2b=0xce;}_0x57450c['status'](_0x1efc2b);return _0x57450c[_0x25a9('0x22')](_0x25a9('0x23'),_0x5f1880+'-'+_0x3a69da+'/'+_0x43408c)[_0x25a9('0x1e')](_0x440ad0);}return null;};}function patchUpdates(_0x2c9208){return function(_0x7d281f){try{jsonpatch[_0x25a9('0x24')](_0x7d281f,_0x2c9208,!![]);}catch(_0xcf43f2){return BPromise['reject'](_0xcf43f2);}return _0x7d281f['save']();};}function saveUpdates(_0x5732e5,_0x2b5720){return function(_0x20a4c4){if(_0x20a4c4){return _0x20a4c4['update'](_0x5732e5)[_0x25a9('0x25')](function(_0x31927a){return _0x31927a;});}return null;};}function removeEntity(_0x5c1462,_0x11d2d6){return function(_0x189a20){if(_0x189a20){return _0x189a20[_0x25a9('0x26')]()[_0x25a9('0x25')](function(){_0x5c1462[_0x25a9('0x1c')](0xcc)[_0x25a9('0x1d')]();});}};}function handleEntityNotFound(_0x2610d6,_0x511007){return function(_0x29727c){if(!_0x29727c){_0x2610d6[_0x25a9('0x1b')](0x194);}return _0x29727c;};}function handleError(_0x26d178,_0x1b5f3e){_0x1b5f3e=_0x1b5f3e||0x1f4;return function(_0x191a52){logger[_0x25a9('0x27')](_0x191a52[_0x25a9('0x28')]);if(_0x191a52['name']){delete _0x191a52['name'];}_0x26d178[_0x25a9('0x1c')](_0x1b5f3e)[_0x25a9('0x29')](_0x191a52);};}exports[_0x25a9('0x2a')]=function(_0x30ca01,_0x35675a){var _0x3c0c85={},_0x500d0={},_0x40dd96={'count':0x0,'rows':[]};var _0xbd160=_['map'](db['AnalyticTreeReport'][_0x25a9('0x2b')],function(_0x294bf7){return{'name':_0x294bf7[_0x25a9('0x2c')],'type':_0x294bf7[_0x25a9('0x2d')][_0x25a9('0x2e')]};});_0x500d0['model']=_['map'](_0xbd160,_0x25a9('0x2f'));_0x500d0[_0x25a9('0x30')]=_['keys'](_0x30ca01[_0x25a9('0x30')]);_0x500d0[_0x25a9('0x31')]=_[_0x25a9('0x32')](_0x500d0[_0x25a9('0x33')],_0x500d0[_0x25a9('0x30')]);_0x3c0c85[_0x25a9('0x34')]=_[_0x25a9('0x32')](_0x500d0[_0x25a9('0x33')],qs[_0x25a9('0x35')](_0x30ca01[_0x25a9('0x30')][_0x25a9('0x35')]));_0x3c0c85[_0x25a9('0x34')]=_0x3c0c85[_0x25a9('0x34')]['length']?_0x3c0c85['attributes']:_0x500d0['model'];if(!_0x30ca01['query'][_0x25a9('0x36')]('nolimit')){_0x3c0c85[_0x25a9('0x20')]=qs['limit'](_0x30ca01[_0x25a9('0x30')]['limit']);_0x3c0c85[_0x25a9('0x21')]=qs[_0x25a9('0x21')](_0x30ca01['query']['offset']);}_0x3c0c85['order']=qs[_0x25a9('0x37')](_0x30ca01[_0x25a9('0x30')][_0x25a9('0x37')]);_0x3c0c85['where']=qs[_0x25a9('0x31')](_[_0x25a9('0x38')](_0x30ca01[_0x25a9('0x30')],_0x500d0['filters']),_0xbd160);if(_0x30ca01[_0x25a9('0x30')][_0x25a9('0x39')]){_0x3c0c85['where']=_[_0x25a9('0x3a')](_0x3c0c85[_0x25a9('0x3b')],{'$or':_[_0x25a9('0x3c')](_0xbd160,function(_0x53eb8c){if(_0x53eb8c['type']!==_0x25a9('0x3d')){var _0x40b3a7={};_0x40b3a7[_0x53eb8c[_0x25a9('0x2f')]]={'$like':'%'+_0x30ca01[_0x25a9('0x30')]['filter']+'%'};return _0x40b3a7;}})});}_0x3c0c85=_[_0x25a9('0x3a')]({},_0x3c0c85,_0x30ca01[_0x25a9('0x3e')]);var _0x5ded69={'where':_0x3c0c85[_0x25a9('0x3b')]};return db['AnalyticTreeReport'][_0x25a9('0x3f')](_0x5ded69)[_0x25a9('0x25')](function(_0xd3b854){_0x40dd96[_0x25a9('0x3f')]=_0xd3b854;if(_0x30ca01[_0x25a9('0x30')]['includeAll']){_0x3c0c85[_0x25a9('0x40')]=[{'all':!![]}];}return db[_0x25a9('0x41')][_0x25a9('0x42')](_0x3c0c85);})[_0x25a9('0x25')](function(_0x3a85c5){_0x40dd96[_0x25a9('0x43')]=_0x3a85c5;return _0x40dd96;})[_0x25a9('0x25')](respondWithFilteredResult(_0x35675a,_0x3c0c85))[_0x25a9('0x44')](handleError(_0x35675a,null));};exports[_0x25a9('0x45')]=function(_0x1bb287,_0x177fac){var _0x5cdda1={'raw':!![],'where':{'id':_0x1bb287[_0x25a9('0x46')]['id']}},_0xe2518f={};_0xe2518f['model']=_[_0x25a9('0x47')](db[_0x25a9('0x41')][_0x25a9('0x2b')]);_0xe2518f[_0x25a9('0x30')]=_['keys'](_0x1bb287[_0x25a9('0x30')]);_0xe2518f[_0x25a9('0x31')]=_[_0x25a9('0x32')](_0xe2518f[_0x25a9('0x33')],_0xe2518f[_0x25a9('0x30')]);_0x5cdda1[_0x25a9('0x34')]=_[_0x25a9('0x32')](_0xe2518f[_0x25a9('0x33')],qs[_0x25a9('0x35')](_0x1bb287[_0x25a9('0x30')]['fields']));_0x5cdda1[_0x25a9('0x34')]=_0x5cdda1[_0x25a9('0x34')][_0x25a9('0x48')]?_0x5cdda1[_0x25a9('0x34')]:_0xe2518f[_0x25a9('0x33')];if(_0x1bb287['query'][_0x25a9('0x49')]){_0x5cdda1['include']=[{'all':!![]}];}_0x5cdda1=_[_0x25a9('0x3a')]({},_0x5cdda1,_0x1bb287[_0x25a9('0x3e')]);return db['AnalyticTreeReport'][_0x25a9('0x4a')](_0x5cdda1)[_0x25a9('0x25')](handleEntityNotFound(_0x177fac,null))[_0x25a9('0x25')](respondWithResult(_0x177fac,null))[_0x25a9('0x44')](handleError(_0x177fac,null));};exports['create']=function(_0x5eade1,_0x2240d3){return db['AnalyticTreeReport'][_0x25a9('0x4b')](_0x5eade1[_0x25a9('0x4c')],{})[_0x25a9('0x25')](respondWithResult(_0x2240d3,0xc9))['catch'](handleError(_0x2240d3,null));};exports[_0x25a9('0x4d')]=function(_0x353971,_0x5ab790){if(_0x353971[_0x25a9('0x4c')]['id']){delete _0x353971[_0x25a9('0x4c')]['id'];}return db[_0x25a9('0x41')][_0x25a9('0x4a')]({'where':{'id':_0x353971[_0x25a9('0x46')]['id']}})[_0x25a9('0x25')](handleEntityNotFound(_0x5ab790,null))[_0x25a9('0x25')](saveUpdates(_0x353971['body'],null))[_0x25a9('0x25')](respondWithResult(_0x5ab790,null))['catch'](handleError(_0x5ab790,null));};exports[_0x25a9('0x26')]=function(_0xba3cae,_0x3354c6){return db[_0x25a9('0x41')][_0x25a9('0x4a')]({'where':{'id':_0xba3cae[_0x25a9('0x46')]['id']}})[_0x25a9('0x25')](handleEntityNotFound(_0x3354c6,null))[_0x25a9('0x25')](removeEntity(_0x3354c6,null))[_0x25a9('0x44')](handleError(_0x3354c6,null));};
\ No newline at end of file
index c931458..1d96d67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x768b=['define','lodash','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x228fdd,_0x1856fe){var _0x36ab64=function(_0x53b004){while(--_0x53b004){_0x228fdd['push'](_0x228fdd['shift']());}};_0x36ab64(++_0x1856fe);}(_0x768b,0x1b3));var _0xb768=function(_0x5bf28e,_0x41af9d){_0x5bf28e=_0x5bf28e-0x0;var _0x4317d3=_0x768b[_0x5bf28e];return _0x4317d3;};'use strict';var _=require(_0xb768('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb768('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb768('0x2'));var config=require(_0xb768('0x3'));var attributes=require(_0xb768('0x4'));module[_0xb768('0x5')]=function(_0x49ef4e,_0x48c706){return _0x49ef4e[_0xb768('0x6')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc4e7=['../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','util','moment','bluebird','request-promise','path','rimraf'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0xc4e7,0x9f));var _0x7c4e=function(_0x2d753a,_0x50cf79){_0x2d753a=_0x2d753a-0x0;var _0x2bd3a6=_0xc4e7[_0x2d753a];return _0x2bd3a6;};'use strict';var _=require('lodash');var util=require(_0x7c4e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7c4e('0x1'));var BPromise=require(_0x7c4e('0x2'));var rp=require(_0x7c4e('0x3'));var fs=require('fs');var path=require(_0x7c4e('0x4'));var rimraf=require(_0x7c4e('0x5'));var config=require(_0x7c4e('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x7c4e('0x7')]=function(_0x12978d,_0x1a37fb){return _0x12978d[_0x7c4e('0x8')](_0x7c4e('0x9'),attributes,{'tableName':_0x7c4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c07d399..bd526a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x29e7fb,_0x5b2ff3){var _0x171dad=function(_0x3ddce4){while(--_0x3ddce4){_0x29e7fb['push'](_0x29e7fb['shift']());}};_0x171dad(++_0x5b2ff3);}(_0xadb5,0xad));var _0x5adb=function(_0x1647ae,_0x5a3f5a){_0x1647ae=_0x1647ae-0x0;var _0x793049=_0xadb5[_0x1647ae];return _0x793049;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}
\ No newline at end of file
+var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x2aeadc,_0x48f2d6){var _0x34ea3f=function(_0xba0971){while(--_0xba0971){_0x2aeadc['push'](_0x2aeadc['shift']());}};_0x34ea3f(++_0x48f2d6);}(_0xdb28,0x106));var _0x8db2=function(_0x3db842,_0x181671){_0x3db842=_0x3db842-0x0;var _0x3a1674=_0xdb28[_0x3db842];return _0x3a1674;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}
\ No newline at end of file
index 1424b53..1576f5f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe4ba=['index','get','show','post','isAuthenticated','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x3c04d7,_0x472801){var _0x2fb24=function(_0x335b91){while(--_0x335b91){_0x3c04d7['push'](_0x3c04d7['shift']());}};_0x2fb24(++_0x472801);}(_0xe4ba,0x6d));var _0xae4b=function(_0x568b91,_0x3ee330){_0x568b91=_0x568b91-0x0;var _0x3b5812=_0xe4ba[_0x568b91];return _0x3b5812;};'use strict';var multer=require(_0xae4b('0x0'));var util=require(_0xae4b('0x1'));var path=require(_0xae4b('0x2'));var timeout=require(_0xae4b('0x3'));var express=require(_0xae4b('0x4'));var router=express[_0xae4b('0x5')]();var fs_extra=require(_0xae4b('0x6'));var auth=require(_0xae4b('0x7'));var interaction=require(_0xae4b('0x8'));var config=require(_0xae4b('0x9'));var controller=require(_0xae4b('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xae4b('0xb')]);router[_0xae4b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xae4b('0xd')]);router[_0xae4b('0xe')]('/',auth[_0xae4b('0xf')](),controller[_0xae4b('0x10')]);router[_0xae4b('0x11')](_0xae4b('0x12'),auth[_0xae4b('0xf')](),controller['update']);router['delete'](_0xae4b('0x12'),auth[_0xae4b('0xf')](),controller['destroy']);module[_0xae4b('0x13')]=router;
\ No newline at end of file
+var _0x1038=['./analyticTreeReport.controller','isAuthenticated','get','/:id','show','create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x500896,_0x39a5ed){var _0x2a3c21=function(_0x21e2f8){while(--_0x21e2f8){_0x500896['push'](_0x500896['shift']());}};_0x2a3c21(++_0x39a5ed);}(_0x1038,0x1d4));var _0x8103=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x1038[_0x1399d6];return _0x4a9db4;};'use strict';var multer=require(_0x8103('0x0'));var util=require('util');var path=require(_0x8103('0x1'));var timeout=require(_0x8103('0x2'));var express=require(_0x8103('0x3'));var router=express[_0x8103('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8103('0x5'));var interaction=require(_0x8103('0x6'));var config=require(_0x8103('0x7'));var controller=require(_0x8103('0x8'));router['get']('/',auth[_0x8103('0x9')](),controller['index']);router[_0x8103('0xa')](_0x8103('0xb'),auth[_0x8103('0x9')](),controller[_0x8103('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8103('0xd')]);router[_0x8103('0xe')]('/:id',auth[_0x8103('0x9')](),controller['update']);router[_0x8103('0xf')]('/:id',auth[_0x8103('0x9')](),controller[_0x8103('0x10')]);module['exports']=router;
\ No newline at end of file
index 0459095..4d21015 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x59c3=['STRING','sequelize','exports'];(function(_0x1ba691,_0x59087e){var _0xa6091c=function(_0x17d848){while(--_0x17d848){_0x1ba691['push'](_0x1ba691['shift']());}};_0xa6091c(++_0x59087e);}(_0x59c3,0x133));var _0x359c=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x59c3[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x359c('0x0'));module[_0x359c('0x1')]={'name':{'type':Sequelize[_0x359c('0x2')]},'basename':{'type':Sequelize[_0x359c('0x2')]},'type':{'type':Sequelize[_0x359c('0x2')]}};
\ No newline at end of file
+var _0x0851=['sequelize','exports','STRING'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x0851,0x8a));var _0x1085=function(_0x43db86,_0x34184b){_0x43db86=_0x43db86-0x0;var _0x27bda2=_0x0851[_0x43db86];return _0x27bda2;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'name':{'type':Sequelize[_0x1085('0x2')]},'basename':{'type':Sequelize[_0x1085('0x2')]},'type':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 3e6a532..d0e69be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9bf=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','filter','merge','options','includeAll','findAll','catch','params','keys','clone','include','find','get','omit','body','updatedAt','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','model','query','filters'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xd9bf,0x189));var _0xfd9b=function(_0x329437,_0x16ab00){_0x329437=_0x329437-0x0;var _0x2c6057=_0xd9bf[_0x329437];return _0x2c6057;};'use strict';var emlformat=require(_0xfd9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd9b('0x1'));var jsonpatch=require(_0xfd9b('0x2'));var rp=require(_0xfd9b('0x3'));var moment=require(_0xfd9b('0x4'));var BPromise=require(_0xfd9b('0x5'));var Mustache=require('mustache');var util=require(_0xfd9b('0x6'));var path=require('path');var sox=require(_0xfd9b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd9b('0x8'));var squel=require(_0xfd9b('0x9'));var crypto=require(_0xfd9b('0xa'));var jsforce=require(_0xfd9b('0xb'));var deskjs=require(_0xfd9b('0xc'));var toCsv=require(_0xfd9b('0xd'));var querystring=require(_0xfd9b('0xe'));var Papa=require('papaparse');var Redis=require(_0xfd9b('0xf'));var authService=require(_0xfd9b('0x10'));var qs=require(_0xfd9b('0x11'));var as=require(_0xfd9b('0x12'));var hardwareService=require(_0xfd9b('0x13'));var logger=require(_0xfd9b('0x14'))(_0xfd9b('0x15'));var utils=require(_0xfd9b('0x16'));var config=require(_0xfd9b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140d2f,_0x1dbceb){_0x1dbceb=_0x1dbceb||0xcc;return function(_0x814908){if(_0x814908){return _0x140d2f[_0xfd9b('0x18')](_0x1dbceb);}return _0x140d2f['status'](_0x1dbceb)['end']();};}function respondWithResult(_0x2782e3,_0x44ca23){_0x44ca23=_0x44ca23||0xc8;return function(_0x28d6cf){if(_0x28d6cf){return _0x2782e3[_0xfd9b('0x19')](_0x44ca23)[_0xfd9b('0x1a')](_0x28d6cf);}};}function respondWithFilteredResult(_0xd21d9a,_0x53e205){return function(_0x5a1217){if(_0x5a1217){var _0x10a435=typeof _0x53e205[_0xfd9b('0x1b')]===_0xfd9b('0x1c')&&typeof _0x53e205[_0xfd9b('0x1d')]===_0xfd9b('0x1c');var _0xbac914=_0x5a1217[_0xfd9b('0x1e')];var _0x5201c0=_0x10a435?0x0:_0x53e205[_0xfd9b('0x1b')];var _0x6dd39a=_0x10a435?_0x5a1217[_0xfd9b('0x1e')]:_0x53e205[_0xfd9b('0x1b')]+_0x53e205[_0xfd9b('0x1d')];var _0x48dbc6;if(_0x6dd39a>=_0xbac914){_0x6dd39a=_0xbac914;_0x48dbc6=0xc8;}else{_0x48dbc6=0xce;}_0xd21d9a[_0xfd9b('0x19')](_0x48dbc6);return _0xd21d9a[_0xfd9b('0x1f')](_0xfd9b('0x20'),_0x5201c0+'-'+_0x6dd39a+'/'+_0xbac914)['json'](_0x5a1217);}return null;};}function patchUpdates(_0x32b938){return function(_0x238f68){try{jsonpatch[_0xfd9b('0x21')](_0x238f68,_0x32b938,!![]);}catch(_0x23b43b){return BPromise[_0xfd9b('0x22')](_0x23b43b);}return _0x238f68[_0xfd9b('0x23')]();};}function saveUpdates(_0x388ed7,_0x4a029b){return function(_0x3184cc){if(_0x3184cc){return _0x3184cc[_0xfd9b('0x24')](_0x388ed7)[_0xfd9b('0x25')](function(_0x269100){return _0x269100;});}return null;};}function removeEntity(_0x2e1a38,_0x399cd3){return function(_0x4c08f5){if(_0x4c08f5){return _0x4c08f5[_0xfd9b('0x26')]()[_0xfd9b('0x25')](function(){_0x2e1a38[_0xfd9b('0x19')](0xcc)[_0xfd9b('0x27')]();});}};}function handleEntityNotFound(_0x2e998a,_0x3808db){return function(_0x44fb7c){if(!_0x44fb7c){_0x2e998a[_0xfd9b('0x18')](0x194);}return _0x44fb7c;};}function handleError(_0x8e1bf,_0x2c7314){_0x2c7314=_0x2c7314||0x1f4;return function(_0x147e02){logger[_0xfd9b('0x28')](_0x147e02[_0xfd9b('0x29')]);if(_0x147e02['name']){delete _0x147e02[_0xfd9b('0x2a')];}_0x8e1bf['status'](_0x2c7314)[_0xfd9b('0x2b')](_0x147e02);};}exports[_0xfd9b('0x2c')]=function(_0x628097,_0xd12952){var _0x22dd68={},_0x3ac3e8={},_0x2c1a6a={'count':0x0,'rows':[]};var _0x3858d8=_[_0xfd9b('0x2d')](db[_0xfd9b('0x2e')][_0xfd9b('0x2f')],function(_0x5dab6f){return{'name':_0x5dab6f[_0xfd9b('0x30')],'type':_0x5dab6f['type']['key']};});_0x3ac3e8[_0xfd9b('0x31')]=_[_0xfd9b('0x2d')](_0x3858d8,_0xfd9b('0x2a'));_0x3ac3e8[_0xfd9b('0x32')]=_['keys'](_0x628097[_0xfd9b('0x32')]);_0x3ac3e8[_0xfd9b('0x33')]=_[_0xfd9b('0x34')](_0x3ac3e8['model'],_0x3ac3e8[_0xfd9b('0x32')]);_0x22dd68[_0xfd9b('0x35')]=_[_0xfd9b('0x34')](_0x3ac3e8[_0xfd9b('0x31')],qs[_0xfd9b('0x36')](_0x628097[_0xfd9b('0x32')][_0xfd9b('0x36')]));_0x22dd68[_0xfd9b('0x35')]=_0x22dd68[_0xfd9b('0x35')][_0xfd9b('0x37')]?_0x22dd68[_0xfd9b('0x35')]:_0x3ac3e8['model'];if(!_0x628097[_0xfd9b('0x32')][_0xfd9b('0x38')]('nolimit')){_0x22dd68[_0xfd9b('0x1d')]=qs[_0xfd9b('0x1d')](_0x628097['query'][_0xfd9b('0x1d')]);_0x22dd68[_0xfd9b('0x1b')]=qs['offset'](_0x628097[_0xfd9b('0x32')][_0xfd9b('0x1b')]);}_0x22dd68[_0xfd9b('0x39')]=qs[_0xfd9b('0x3a')](_0x628097[_0xfd9b('0x32')][_0xfd9b('0x3a')]);_0x22dd68[_0xfd9b('0x3b')]=qs['filters'](_[_0xfd9b('0x3c')](_0x628097[_0xfd9b('0x32')],_0x3ac3e8['filters']),_0x3858d8);if(_0x628097[_0xfd9b('0x32')]['filter']){_0x22dd68[_0xfd9b('0x3b')]=_['merge'](_0x22dd68[_0xfd9b('0x3b')],{'$or':_['map'](_0x3858d8,function(_0x4085e8){if(_0x4085e8[_0xfd9b('0x3d')]!=='VIRTUAL'){var _0x33b20e={};_0x33b20e[_0x4085e8[_0xfd9b('0x2a')]]={'$like':'%'+_0x628097['query'][_0xfd9b('0x3e')]+'%'};return _0x33b20e;}})});}_0x22dd68=_[_0xfd9b('0x3f')]({},_0x22dd68,_0x628097[_0xfd9b('0x40')]);var _0x1897a0={'where':_0x22dd68[_0xfd9b('0x3b')]};return db[_0xfd9b('0x2e')][_0xfd9b('0x1e')](_0x1897a0)[_0xfd9b('0x25')](function(_0xd00a22){_0x2c1a6a[_0xfd9b('0x1e')]=_0xd00a22;if(_0x628097[_0xfd9b('0x32')][_0xfd9b('0x41')]){_0x22dd68['include']=[{'all':!![]}];}return db[_0xfd9b('0x2e')][_0xfd9b('0x42')](_0x22dd68);})[_0xfd9b('0x25')](function(_0x5f38b7){_0x2c1a6a['rows']=_0x5f38b7;return _0x2c1a6a;})['then'](respondWithFilteredResult(_0xd12952,_0x22dd68))[_0xfd9b('0x43')](handleError(_0xd12952,null));};exports['show']=function(_0x3c2f96,_0x1a094d){var _0x4fee00={'raw':!![],'where':{'id':_0x3c2f96[_0xfd9b('0x44')]['id']}},_0x20cfef={};_0x20cfef[_0xfd9b('0x31')]=_[_0xfd9b('0x45')](db[_0xfd9b('0x2e')][_0xfd9b('0x2f')]);_0x20cfef['query']=_[_0xfd9b('0x45')](_0x3c2f96[_0xfd9b('0x32')]);_0x20cfef[_0xfd9b('0x33')]=_[_0xfd9b('0x34')](_0x20cfef[_0xfd9b('0x31')],_0x20cfef[_0xfd9b('0x32')]);_0x4fee00[_0xfd9b('0x35')]=_[_0xfd9b('0x34')](_0x20cfef['model'],qs[_0xfd9b('0x36')](_0x3c2f96['query'][_0xfd9b('0x36')]));_0x4fee00['attributes']=_0x4fee00[_0xfd9b('0x35')][_0xfd9b('0x37')]?_0x4fee00[_0xfd9b('0x35')]:_0x20cfef['model'];if(_0x3c2f96['query'][_0xfd9b('0x41')]){_0x4fee00['include']=[{'all':!![]}];}_0x4fee00=_[_0xfd9b('0x3f')]({},_0x4fee00,_0x3c2f96['options']);return db[_0xfd9b('0x2e')]['find'](_0x4fee00)['then'](handleEntityNotFound(_0x1a094d,null))[_0xfd9b('0x25')](respondWithResult(_0x1a094d,null))[_0xfd9b('0x43')](handleError(_0x1a094d,null));};exports[_0xfd9b('0x46')]=function(_0x10ccb5,_0x3ddb8f){var _0x396908={'where':{'id':_0x10ccb5[_0xfd9b('0x44')]['id']}},_0x37d006={};_0x37d006[_0xfd9b('0x31')]=_[_0xfd9b('0x45')](db['Attachment'][_0xfd9b('0x2f')]);_0x396908[_0xfd9b('0x35')]=_['intersection'](_0x37d006[_0xfd9b('0x31')],qs[_0xfd9b('0x36')](_0x10ccb5[_0xfd9b('0x32')]['fields']));_0x396908['attributes']=_0x396908[_0xfd9b('0x35')]['length']?_0x396908['attributes']:_0x37d006[_0xfd9b('0x31')];if(_0x10ccb5[_0xfd9b('0x32')][_0xfd9b('0x41')]){_0x396908[_0xfd9b('0x47')]=[{'all':!![]}];}_0x396908=_[_0xfd9b('0x3f')]({},_0x396908,_0x10ccb5['options']);return db['Attachment'][_0xfd9b('0x48')](_0x396908)[_0xfd9b('0x25')](handleEntityNotFound(_0x3ddb8f,null))[_0xfd9b('0x25')](function(_0x26895a){if(_0x26895a){var _0x22a913=_0x26895a[_0xfd9b('0x49')]({'plain':!![]});_0x22a913=qs['omit'](_0x22a913,['id','createdAt','updatedAt']);_0x10ccb5['body']=_[_0xfd9b('0x4a')](_0x10ccb5[_0xfd9b('0x4b')],['id','createdAt',_0xfd9b('0x4c')]);return db[_0xfd9b('0x2e')][_0xfd9b('0x4d')](_['merge'](_0x22a913,_0x10ccb5[_0xfd9b('0x4b')]),{'include':_0x10ccb5[_0xfd9b('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xfd9b('0x25')](respondWithResult(_0x3ddb8f,0xc9))[_0xfd9b('0x43')](handleError(_0x3ddb8f,null));};exports[_0xfd9b('0x24')]=function(_0x2863da,_0x3f7dbd){if(_0x2863da['body']['id']){delete _0x2863da[_0xfd9b('0x4b')]['id'];}return db[_0xfd9b('0x2e')][_0xfd9b('0x48')]({'where':{'id':_0x2863da['params']['id']}})[_0xfd9b('0x25')](handleEntityNotFound(_0x3f7dbd,null))['then'](saveUpdates(_0x2863da[_0xfd9b('0x4b')],null))[_0xfd9b('0x25')](respondWithResult(_0x3f7dbd,null))['catch'](handleError(_0x3f7dbd,null));};exports['destroy']=function(_0x2f5a57,_0x1ff1c6){return db[_0xfd9b('0x2e')]['find']({'where':{'id':_0x2f5a57[_0xfd9b('0x44')]['id']}})[_0xfd9b('0x25')](handleEntityNotFound(_0x1ff1c6,null))['then'](removeEntity(_0x1ff1c6,null))[_0xfd9b('0x43')](handleError(_0x1ff1c6,null));};exports[_0xfd9b('0x4d')]=function(_0x2942f2,_0x18f69d,_0x4c6478){_0x2942f2[_0xfd9b('0x4b')][_0xfd9b('0x2a')]=_0x2942f2[_0xfd9b('0x4e')][_0xfd9b('0x4f')];_0x2942f2['body'][_0xfd9b('0x50')]=_0x2942f2[_0xfd9b('0x4e')]['filename'];_0x2942f2[_0xfd9b('0x4b')][_0xfd9b('0x3d')]=_0x2942f2[_0xfd9b('0x4e')][_0xfd9b('0x51')];return db[_0xfd9b('0x2e')][_0xfd9b('0x4d')](_0x2942f2['body'])['then'](respondWithResult(_0x18f69d,0xc9))['catch'](handleError(_0x18f69d,null));};exports[_0xfd9b('0x52')]=function(_0x4aa78f,_0x597893,_0x5be9bf){return db['Attachment'][_0xfd9b('0x53')]({'where':{'id':_0x4aa78f[_0xfd9b('0x44')]['id']},'raw':!![]})[_0xfd9b('0x25')](handleEntityNotFound(_0x597893,null))['then'](function(_0xb49c6e){if(_0xb49c6e){var _0x2b4d8d=_0xb49c6e[_0xfd9b('0x54')]!==null;var _0x5346ae=path[_0xfd9b('0x55')](config[_0xfd9b('0x56')],_0xfd9b('0x57'));if(_0x2b4d8d){_0x5346ae=path[_0xfd9b('0x55')](_0x5346ae,_0xfd9b('0x58'));}var _0x5324f6=path[_0xfd9b('0x55')](_0x5346ae,_0xb49c6e['basename']);return _0x597893['download'](_0x5324f6);}})[_0xfd9b('0x43')](handleError(_0x597893,null));};
\ No newline at end of file
+var _0x81e2=['update','then','error','stack','name','index','map','Attachment','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','rawAttributes','find','catch','clone','params','omit','createdAt','body','updatedAt','create','destroy','originalname','basename','file','filename','download','findOne','root','server/files/attachments/','join','offline-chat/','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x81e2,0x8e));var _0x281e=function(_0x599d71,_0x5d1b02){_0x599d71=_0x599d71-0x0;var _0x1152d2=_0x81e2[_0x599d71];return _0x1152d2;};'use strict';var emlformat=require(_0x281e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x281e('0x1'));var rp=require(_0x281e('0x2'));var moment=require(_0x281e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x281e('0x4'));var util=require(_0x281e('0x5'));var path=require(_0x281e('0x6'));var sox=require(_0x281e('0x7'));var csv=require(_0x281e('0x8'));var ejs=require(_0x281e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x281e('0xa'));var squel=require(_0x281e('0xb'));var crypto=require(_0x281e('0xc'));var jsforce=require(_0x281e('0xd'));var deskjs=require(_0x281e('0xe'));var toCsv=require(_0x281e('0x8'));var querystring=require(_0x281e('0xf'));var Papa=require('papaparse');var Redis=require(_0x281e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x281e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x281e('0x12'));var logger=require(_0x281e('0x13'))(_0x281e('0x14'));var utils=require(_0x281e('0x15'));var config=require(_0x281e('0x16'));var licenseUtil=require(_0x281e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20aaa2,_0x42133d){_0x42133d=_0x42133d||0xcc;return function(_0x8dc274){if(_0x8dc274){return _0x20aaa2[_0x281e('0x18')](_0x42133d);}return _0x20aaa2[_0x281e('0x19')](_0x42133d)[_0x281e('0x1a')]();};}function respondWithResult(_0x177f1f,_0x27a290){_0x27a290=_0x27a290||0xc8;return function(_0x314b2e){if(_0x314b2e){return _0x177f1f[_0x281e('0x19')](_0x27a290)[_0x281e('0x1b')](_0x314b2e);}};}function respondWithFilteredResult(_0x334981,_0x1b468d){return function(_0x1a7abe){if(_0x1a7abe){var _0x33895b=typeof _0x1b468d['offset']===_0x281e('0x1c')&&typeof _0x1b468d[_0x281e('0x1d')]==='undefined';var _0x2bfb4e=_0x1a7abe[_0x281e('0x1e')];var _0xfc3663=_0x33895b?0x0:_0x1b468d['offset'];var _0x4b9cf0=_0x33895b?_0x1a7abe[_0x281e('0x1e')]:_0x1b468d[_0x281e('0x1f')]+_0x1b468d['limit'];var _0xdb8d38;if(_0x4b9cf0>=_0x2bfb4e){_0x4b9cf0=_0x2bfb4e;_0xdb8d38=0xc8;}else{_0xdb8d38=0xce;}_0x334981[_0x281e('0x19')](_0xdb8d38);return _0x334981[_0x281e('0x20')]('Content-Range',_0xfc3663+'-'+_0x4b9cf0+'/'+_0x2bfb4e)['json'](_0x1a7abe);}return null;};}function patchUpdates(_0xfcad21){return function(_0x2bfac3){try{jsonpatch[_0x281e('0x21')](_0x2bfac3,_0xfcad21,!![]);}catch(_0x1c787c){return BPromise[_0x281e('0x22')](_0x1c787c);}return _0x2bfac3[_0x281e('0x23')]();};}function saveUpdates(_0x8c4cfd,_0x492973){return function(_0xfc6815){if(_0xfc6815){return _0xfc6815[_0x281e('0x24')](_0x8c4cfd)[_0x281e('0x25')](function(_0x1a8c12){return _0x1a8c12;});}return null;};}function removeEntity(_0x5965bb,_0x2ee2b7){return function(_0x3a9f17){if(_0x3a9f17){return _0x3a9f17['destroy']()[_0x281e('0x25')](function(){_0x5965bb[_0x281e('0x19')](0xcc)[_0x281e('0x1a')]();});}};}function handleEntityNotFound(_0xbd1add,_0x52a874){return function(_0x500498){if(!_0x500498){_0xbd1add[_0x281e('0x18')](0x194);}return _0x500498;};}function handleError(_0x49dc9f,_0x1592ac){_0x1592ac=_0x1592ac||0x1f4;return function(_0x46045b){logger[_0x281e('0x26')](_0x46045b[_0x281e('0x27')]);if(_0x46045b[_0x281e('0x28')]){delete _0x46045b[_0x281e('0x28')];}_0x49dc9f['status'](_0x1592ac)['send'](_0x46045b);};}exports[_0x281e('0x29')]=function(_0x1bdaa7,_0xbc1512){var _0x519d16={},_0x4e0637={},_0x14682a={'count':0x0,'rows':[]};var _0x14b0ca=_[_0x281e('0x2a')](db[_0x281e('0x2b')]['rawAttributes'],function(_0x20e7f9){return{'name':_0x20e7f9[_0x281e('0x2c')],'type':_0x20e7f9[_0x281e('0x2d')][_0x281e('0x2e')]};});_0x4e0637[_0x281e('0x2f')]=_['map'](_0x14b0ca,_0x281e('0x28'));_0x4e0637[_0x281e('0x30')]=_[_0x281e('0x31')](_0x1bdaa7[_0x281e('0x30')]);_0x4e0637[_0x281e('0x32')]=_[_0x281e('0x33')](_0x4e0637[_0x281e('0x2f')],_0x4e0637[_0x281e('0x30')]);_0x519d16[_0x281e('0x34')]=_['intersection'](_0x4e0637[_0x281e('0x2f')],qs[_0x281e('0x35')](_0x1bdaa7[_0x281e('0x30')]['fields']));_0x519d16[_0x281e('0x34')]=_0x519d16[_0x281e('0x34')][_0x281e('0x36')]?_0x519d16['attributes']:_0x4e0637[_0x281e('0x2f')];if(!_0x1bdaa7[_0x281e('0x30')][_0x281e('0x37')](_0x281e('0x38'))){_0x519d16['limit']=qs[_0x281e('0x1d')](_0x1bdaa7['query'][_0x281e('0x1d')]);_0x519d16[_0x281e('0x1f')]=qs['offset'](_0x1bdaa7['query'][_0x281e('0x1f')]);}_0x519d16[_0x281e('0x39')]=qs['sort'](_0x1bdaa7[_0x281e('0x30')]['sort']);_0x519d16[_0x281e('0x3a')]=qs[_0x281e('0x32')](_[_0x281e('0x3b')](_0x1bdaa7[_0x281e('0x30')],_0x4e0637[_0x281e('0x32')]),_0x14b0ca);if(_0x1bdaa7[_0x281e('0x30')][_0x281e('0x3c')]){_0x519d16[_0x281e('0x3a')]=_['merge'](_0x519d16[_0x281e('0x3a')],{'$or':_[_0x281e('0x2a')](_0x14b0ca,function(_0x290bca){if(_0x290bca[_0x281e('0x2d')]!==_0x281e('0x3d')){var _0x203155={};_0x203155[_0x290bca[_0x281e('0x28')]]={'$like':'%'+_0x1bdaa7[_0x281e('0x30')][_0x281e('0x3c')]+'%'};return _0x203155;}})});}_0x519d16=_[_0x281e('0x3e')]({},_0x519d16,_0x1bdaa7[_0x281e('0x3f')]);var _0x2feb3a={'where':_0x519d16[_0x281e('0x3a')]};return db[_0x281e('0x2b')][_0x281e('0x1e')](_0x2feb3a)[_0x281e('0x25')](function(_0x5255fb){_0x14682a['count']=_0x5255fb;if(_0x1bdaa7[_0x281e('0x30')][_0x281e('0x40')]){_0x519d16[_0x281e('0x41')]=[{'all':!![]}];}return db[_0x281e('0x2b')][_0x281e('0x42')](_0x519d16);})[_0x281e('0x25')](function(_0x45af6d){_0x14682a[_0x281e('0x43')]=_0x45af6d;return _0x14682a;})[_0x281e('0x25')](respondWithFilteredResult(_0xbc1512,_0x519d16))['catch'](handleError(_0xbc1512,null));};exports['show']=function(_0x5c7a2a,_0x15e7fd){var _0x364a26={'raw':!![],'where':{'id':_0x5c7a2a['params']['id']}},_0x5b0dba={};_0x5b0dba[_0x281e('0x2f')]=_[_0x281e('0x31')](db[_0x281e('0x2b')][_0x281e('0x44')]);_0x5b0dba[_0x281e('0x30')]=_[_0x281e('0x31')](_0x5c7a2a[_0x281e('0x30')]);_0x5b0dba[_0x281e('0x32')]=_['intersection'](_0x5b0dba[_0x281e('0x2f')],_0x5b0dba['query']);_0x364a26[_0x281e('0x34')]=_['intersection'](_0x5b0dba[_0x281e('0x2f')],qs['fields'](_0x5c7a2a[_0x281e('0x30')][_0x281e('0x35')]));_0x364a26[_0x281e('0x34')]=_0x364a26[_0x281e('0x34')]['length']?_0x364a26['attributes']:_0x5b0dba[_0x281e('0x2f')];if(_0x5c7a2a[_0x281e('0x30')][_0x281e('0x40')]){_0x364a26[_0x281e('0x41')]=[{'all':!![]}];}_0x364a26=_[_0x281e('0x3e')]({},_0x364a26,_0x5c7a2a['options']);return db[_0x281e('0x2b')][_0x281e('0x45')](_0x364a26)[_0x281e('0x25')](handleEntityNotFound(_0x15e7fd,null))[_0x281e('0x25')](respondWithResult(_0x15e7fd,null))[_0x281e('0x46')](handleError(_0x15e7fd,null));};exports[_0x281e('0x47')]=function(_0x23c818,_0x1bd319){var _0x424d68={'where':{'id':_0x23c818[_0x281e('0x48')]['id']}},_0x203188={};_0x203188[_0x281e('0x2f')]=_['keys'](db[_0x281e('0x2b')]['rawAttributes']);_0x424d68[_0x281e('0x34')]=_[_0x281e('0x33')](_0x203188[_0x281e('0x2f')],qs[_0x281e('0x35')](_0x23c818[_0x281e('0x30')]['fields']));_0x424d68[_0x281e('0x34')]=_0x424d68[_0x281e('0x34')][_0x281e('0x36')]?_0x424d68[_0x281e('0x34')]:_0x203188[_0x281e('0x2f')];if(_0x23c818[_0x281e('0x30')]['includeAll']){_0x424d68[_0x281e('0x41')]=[{'all':!![]}];}_0x424d68=_[_0x281e('0x3e')]({},_0x424d68,_0x23c818['options']);return db[_0x281e('0x2b')][_0x281e('0x45')](_0x424d68)['then'](handleEntityNotFound(_0x1bd319,null))[_0x281e('0x25')](function(_0x2153a1){if(_0x2153a1){var _0x169af8=_0x2153a1['get']({'plain':!![]});_0x169af8=qs[_0x281e('0x49')](_0x169af8,['id',_0x281e('0x4a'),'updatedAt']);_0x23c818[_0x281e('0x4b')]=_['omit'](_0x23c818[_0x281e('0x4b')],['id',_0x281e('0x4a'),_0x281e('0x4c')]);return db['Attachment'][_0x281e('0x4d')](_[_0x281e('0x3e')](_0x169af8,_0x23c818[_0x281e('0x4b')]),{'include':_0x23c818[_0x281e('0x30')][_0x281e('0x40')]?[{'all':!![]}]:undefined});}})[_0x281e('0x25')](respondWithResult(_0x1bd319,0xc9))[_0x281e('0x46')](handleError(_0x1bd319,null));};exports[_0x281e('0x24')]=function(_0x55b987,_0x4e7fab){if(_0x55b987[_0x281e('0x4b')]['id']){delete _0x55b987[_0x281e('0x4b')]['id'];}return db[_0x281e('0x2b')][_0x281e('0x45')]({'where':{'id':_0x55b987[_0x281e('0x48')]['id']}})[_0x281e('0x25')](handleEntityNotFound(_0x4e7fab,null))[_0x281e('0x25')](saveUpdates(_0x55b987[_0x281e('0x4b')],null))[_0x281e('0x25')](respondWithResult(_0x4e7fab,null))[_0x281e('0x46')](handleError(_0x4e7fab,null));};exports[_0x281e('0x4e')]=function(_0x5007e6,_0x18b9bf){return db['Attachment'][_0x281e('0x45')]({'where':{'id':_0x5007e6[_0x281e('0x48')]['id']}})['then'](handleEntityNotFound(_0x18b9bf,null))[_0x281e('0x25')](removeEntity(_0x18b9bf,null))[_0x281e('0x46')](handleError(_0x18b9bf,null));};exports[_0x281e('0x4d')]=function(_0x55b8e3,_0x76b313,_0x4a034c){_0x55b8e3[_0x281e('0x4b')]['name']=_0x55b8e3['file'][_0x281e('0x4f')];_0x55b8e3[_0x281e('0x4b')][_0x281e('0x50')]=_0x55b8e3[_0x281e('0x51')][_0x281e('0x52')];_0x55b8e3[_0x281e('0x4b')][_0x281e('0x2d')]=_0x55b8e3[_0x281e('0x51')]['mimetype'];return db[_0x281e('0x2b')][_0x281e('0x4d')](_0x55b8e3[_0x281e('0x4b')])[_0x281e('0x25')](respondWithResult(_0x76b313,0xc9))[_0x281e('0x46')](handleError(_0x76b313,null));};exports[_0x281e('0x53')]=function(_0x29cc6c,_0x43a706,_0x1a821c){return db[_0x281e('0x2b')][_0x281e('0x54')]({'where':{'id':_0x29cc6c['params']['id']},'raw':!![]})[_0x281e('0x25')](handleEntityNotFound(_0x43a706,null))[_0x281e('0x25')](function(_0x23978f){if(_0x23978f){var _0x3fa686=_0x23978f['ChatOfflineMessageId']!==null;var _0x5ea192=path['join'](config[_0x281e('0x55')],_0x281e('0x56'));if(_0x3fa686){_0x5ea192=path[_0x281e('0x57')](_0x5ea192,_0x281e('0x58'));}var _0x1ba0ed=path['join'](_0x5ea192,_0x23978f[_0x281e('0x50')]);return _0x43a706[_0x281e('0x53')](_0x1ba0ed);}})[_0x281e('0x46')](handleError(_0x43a706,null));};
\ No newline at end of file
index 81f753d..4ec83f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb6cb=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./attachment.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb6cb,0x19a));var _0xbb6c=function(_0x513835,_0x93de04){_0x513835=_0x513835-0x0;var _0x567b24=_0xb6cb[_0x513835];return _0x567b24;};'use strict';var _=require(_0xbb6c('0x0'));var util=require('util');var logger=require(_0xbb6c('0x1'))(_0xbb6c('0x2'));var moment=require(_0xbb6c('0x3'));var BPromise=require(_0xbb6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb6c('0x5'));var rimraf=require('rimraf');var config=require(_0xbb6c('0x6'));var attributes=require(_0xbb6c('0x7'));module[_0xbb6c('0x8')]=function(_0x2211f4,_0x5d89e8){return _0x2211f4[_0xbb6c('0x9')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x76a0=['exports','define','attachments','lodash','../../config/logger','api','moment','bluebird','path','./attachment.attributes'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x76a0,0xad));var _0x076a=function(_0x2adc55,_0x1e1565){_0x2adc55=_0x2adc55-0x0;var _0x735331=_0x76a0[_0x2adc55];return _0x735331;};'use strict';var _=require(_0x076a('0x0'));var util=require('util');var logger=require(_0x076a('0x1'))(_0x076a('0x2'));var moment=require(_0x076a('0x3'));var BPromise=require(_0x076a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x076a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x076a('0x6'));module[_0x076a('0x7')]=function(_0x32cc6e,_0x1dacee){return _0x32cc6e[_0x076a('0x8')]('Attachment',attributes,{'tableName':_0x076a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index cf870f8..01dfd11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe829=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','catch','Attachment','create','options','raw','CreateAttachment','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe829,0x1d8));var _0x9e82=function(_0x1f49d5,_0x178592){_0x1f49d5=_0x1f49d5-0x0;var _0x2fbcda=_0xe829[_0x1f49d5];return _0x2fbcda;};'use strict';var _=require(_0x9e82('0x0'));var util=require(_0x9e82('0x1'));var moment=require(_0x9e82('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e82('0x3'));var db=require(_0x9e82('0x4'))['db'];var utils=require(_0x9e82('0x5'));var logger=require(_0x9e82('0x6'))(_0x9e82('0x7'));var config=require(_0x9e82('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e82('0x9')][_0x9e82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a63b3,_0x7cebd4,_0x2d91ba){return new BPromise(function(_0x5c4c57,_0x149f39){return client['request'](_0x1a63b3,_0x2d91ba)[_0x9e82('0xb')](function(_0x13070b){logger['info']('Attachment,\x20%s,\x20%s',_0x7cebd4,_0x9e82('0xc'));logger[_0x9e82('0xd')](_0x9e82('0xe'),_0x7cebd4,_0x9e82('0xc'),JSON[_0x9e82('0xf')](_0x13070b));if(_0x13070b[_0x9e82('0x10')]){if(_0x13070b[_0x9e82('0x10')][_0x9e82('0x11')]===0x1f4){logger[_0x9e82('0x10')](_0x9e82('0x12'),_0x7cebd4,_0x13070b[_0x9e82('0x10')][_0x9e82('0x13')]);return _0x149f39(_0x13070b['error']['message']);}logger[_0x9e82('0x10')](_0x9e82('0x12'),_0x7cebd4,_0x13070b[_0x9e82('0x10')][_0x9e82('0x13')]);return _0x5c4c57(_0x13070b['error'][_0x9e82('0x13')]);}else{logger[_0x9e82('0x14')](_0x9e82('0x12'),_0x7cebd4,_0x9e82('0xc'));_0x5c4c57(_0x13070b['result'][_0x9e82('0x13')]);}})[_0x9e82('0x15')](function(_0x3f70a3){logger[_0x9e82('0x10')]('Attachment,\x20%s,\x20%s',_0x7cebd4,_0x3f70a3);_0x149f39(_0x3f70a3);});});}exports['CreateAttachment']=function(_0x4815d8){var _0x40757e=this;return new Promise(function(_0x2de033,_0xdb5e7b){return db[_0x9e82('0x16')][_0x9e82('0x17')](_0x4815d8['body'],{'raw':_0x4815d8[_0x9e82('0x18')]?_0x4815d8[_0x9e82('0x18')][_0x9e82('0x19')]===undefined?!![]:![]:!![]})[_0x9e82('0xb')](function(_0x528ff4){logger['info'](_0x9e82('0x1a'),_0x4815d8);logger[_0x9e82('0xd')](_0x9e82('0x1a'),_0x4815d8,JSON[_0x9e82('0xf')](_0x528ff4));_0x2de033(_0x528ff4);})[_0x9e82('0x15')](function(_0x10c3d6){logger['error'](_0x9e82('0x1a'),_0x10c3d6[_0x9e82('0x13')],_0x4815d8);_0xdb5e7b(_0x40757e[_0x9e82('0x10')](0x1f4,_0x10c3d6[_0x9e82('0x13')]));});});};
\ No newline at end of file
+var _0x99e9=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','body','raw','CreateAttachment','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5177ac,_0x22ce5a){var _0x1e27ff=function(_0x43759f){while(--_0x43759f){_0x5177ac['push'](_0x5177ac['shift']());}};_0x1e27ff(++_0x22ce5a);}(_0x99e9,0xb4));var _0x999e=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x99e9[_0x291d3f];return _0x242080;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('Attachment,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});}exports['CreateAttachment']=function(_0x4fcdfb){var _0x3153ce=this;return new Promise(function(_0x43b09e,_0xc4ef74){return db[_0x999e('0x17')][_0x999e('0x18')](_0x4fcdfb[_0x999e('0x19')],{'raw':_0x4fcdfb['options']?_0x4fcdfb['options'][_0x999e('0x1a')]===undefined?!![]:![]:!![]})[_0x999e('0xb')](function(_0x3b3642){logger['info'](_0x999e('0x1b'),_0x4fcdfb);logger[_0x999e('0xf')](_0x999e('0x1b'),_0x4fcdfb,JSON[_0x999e('0x11')](_0x3b3642));_0x43b09e(_0x3b3642);})[_0x999e('0x16')](function(_0x3750a0){logger[_0x999e('0x12')]('CreateAttachment',_0x3750a0['message'],_0x4fcdfb);_0xc4ef74(_0x3153ce[_0x999e('0x12')](0x1f4,_0x3750a0[_0x999e('0x14')]));});});};
\ No newline at end of file
index f373ff5..4840fb4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x6671,_0x2cb555){var _0x29cc3f=function(_0x5e21bb){while(--_0x5e21bb){_0x6671['push'](_0x6671['shift']());}};_0x29cc3f(++_0x2cb555);}(_0xadb5,0xad));var _0x5adb=function(_0x327b04,_0xe72707){_0x327b04=_0x327b04-0x0;var _0x2c1826=_0xadb5[_0x327b04];return _0x2c1826;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router;
\ No newline at end of file
+var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x3f1842,_0x1e1a6f){var _0x23cad2=function(_0x1447b8){while(--_0x1447b8){_0x3f1842['push'](_0x3f1842['shift']());}};_0x23cad2(++_0x1e1a6f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b2c9b,_0x4363cb){_0x2b2c9b=_0x2b2c9b-0x0;var _0x1a312e=_0x5f2f[_0x2b2c9b];return _0x1a312e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router;
\ No newline at end of file
index ade6a12..4aa1574 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf424=['moment','activedirectory2','util','../../components/auth/service','../../config/environment','activedirectory','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','name','password','salt','disabled','online','admin','user','blockedAt','add','minutes','clearBlockUser','getLicense','status','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','ad-login','User','passport-local','Strategy'];(function(_0x1da46b,_0x109ac4){var _0x3a94ef=function(_0x31a2b4){while(--_0x31a2b4){_0x1da46b['push'](_0x1da46b['shift']());}};_0x3a94ef(++_0x109ac4);}(_0xf424,0x15d));var _0x4f42=function(_0x3a980f,_0x49e4d6){_0x3a980f=_0x3a980f-0x0;var _0x36010f=_0xf424[_0x3a980f];return _0x36010f;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x4f42('0x0'))[_0x4f42('0x1')];var moment=require(_0x4f42('0x2'));var ActiveDirectory=require(_0x4f42('0x3'));var BPromise=require('bluebird');var util=require(_0x4f42('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x4f42('0x5'));var utils=require('../../config/utils');var config=require(_0x4f42('0x6'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x5955aa){var _0x2a53ae=![];if(typeof _0x5955aa[_0x4f42('0x7')]!=='undefined'){_0x2a53ae=_0x5955aa[_0x4f42('0x7')]['baseDN']&&_0x5955aa[_0x4f42('0x7')]['url']&&_0x5955aa['activedirectory'][_0x4f42('0x8')];}return _0x2a53ae;}function adAuthenticate(_0x34d23a,_0xd192b1,_0x4121e2){return new BPromise(function(_0x4901e1,_0x493e91){try{var _0x5c5fee=new ActiveDirectory(_0x34d23a);_0x5c5fee[_0x4f42('0x9')](_0xd192b1,_0x4121e2,function(_0x504589,_0x566ee3){if(_0x504589){logger[_0x4f42('0xa')](_0x4f42('0xb'),_0xd192b1,util['inspect'](_0x504589,{'showHidden':![],'depth':null}));_0x493e91(_0x4f42('0xc'));}else if(!_0x566ee3){logger[_0x4f42('0xa')](_0x4f42('0xd'),_0xd192b1);_0x493e91(_0x4f42('0xc'));}else{_0x4901e1(_0x566ee3);}});}catch(_0x4a0e47){_0x493e91(_0x4a0e47);}});}function ActiveDirectoryAuthenticate(_0xbca6fc,_0x3540cc,_0x493396,_0x4c5596){var _0x53cf38,_0x337884;if(!isActiveDirectoryConfigured(config)){logger[_0x4f42('0xa')](_0x4f42('0xe'),_0x3540cc);return _0x4c5596(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x4f42('0xf')]({'where':{'id':0x1},'attributes':[_0x4f42('0x10'),_0x4f42('0x11')],'raw':!![]})[_0x4f42('0x12')](function(_0x498d7e){_0x53cf38=_0x498d7e;if(!_0x53cf38[_0x4f42('0x10')]){logger[_0x4f42('0xa')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3540cc);throw new Error(_0x4f42('0xc'));}return _0xbca6fc[_0x4f42('0xf')]({'attributes':['id',_0x4f42('0x13'),_0x4f42('0x14'),_0x4f42('0x15'),'role',_0x4f42('0x16'),'blocked','blockedAt',_0x4f42('0x17')],'where':{'name':_0x3540cc,'role':{'$or':[_0x4f42('0x18'),_0x4f42('0x19'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x57ea8e){if(!_0x57ea8e||_0x57ea8e&&_0x57ea8e['name']!==_0x3540cc){throw new Error(_0x4f42('0xc'));}_0x337884=_0x57ea8e;var _0x4dcb80=_0x337884['name']+'@'+config[_0x4f42('0x7')][_0x4f42('0x8')];return adAuthenticate(config[_0x4f42('0x7')],_0x4dcb80,_0x493396);})[_0x4f42('0x12')](function(_0x523ae1){if(_0x337884[_0x4f42('0x16')]){throw new Error(_0x4f42('0xc'));}if(_0x53cf38['blockDuration']>0x0){if(_0x337884['blocked']){if(moment(_0x337884[_0x4f42('0x1a')])[_0x4f42('0x1b')](_0x53cf38[_0x4f42('0x11')],_0x4f42('0x1c'))>moment()){throw new Error(_0x4f42('0xc'));}return utils[_0x4f42('0x1d')](_0x337884,0x0,![],null)[_0x4f42('0x12')](function(){return utils['getLicense'](_0x337884);})[_0x4f42('0x12')](function(){return _0x4c5596(null,_0x337884);});}else{return utils['getLicense'](_0x337884)[_0x4f42('0x12')](function(){return _0x4c5596(null,_0x337884);});}}else{return utils[_0x4f42('0x1e')](_0x337884)['then'](function(){return _0x4c5596(null,_0x337884);});}})['catch'](function(_0x2a75ab){return _0x4c5596(null,![],_0x2a75ab);});}function handleError(_0x5f22c6,_0x519fad,_0x3b28ba){return _0x5f22c6[_0x4f42('0x1f')](_0x519fad||0x1f4)['send']({'message':_0x3b28ba?_0x3b28ba[_0x4f42('0x20')]||_0x3b28ba:''});}exports[_0x4f42('0x21')]=function(_0x36d09f,_0x2ddc51,_0xdb3c01){passport[_0x4f42('0x9')]('ad-login',function(_0x2d832d,_0x598420,_0x792839){var _0x173847=_0x2d832d||_0x792839;if(_0x173847){return handleError(_0x2ddc51,0x191,_0x173847);}if(!_0x598420){return handleError(_0x2ddc51,0x194,{'message':_0x4f42('0x22')});}else{var _0x23c463={'payload':{'id':_0x598420['id'],'role':_0x598420['role']},'options':{'expiresIn':0x15180}};return authService[_0x4f42('0x23')](_0x23c463)[_0x4f42('0x12')](function(_0x77edb7){_0x2ddc51['json']({'id':_0x598420['id'],'token':_0x77edb7,'statusCall':'','isAlreadyLogged':_0x598420[_0x4f42('0x17')]});});}})(_0x36d09f,_0x2ddc51,_0xdb3c01);};passport[_0x4f42('0x24')](_0x4f42('0x25'),new LocalStrategy({'usernameField':'name','passwordField':_0x4f42('0x14')},function(_0x284d55,_0x4e0884,_0x5ca6a0){return ActiveDirectoryAuthenticate(db[_0x4f42('0x26')],_0x284d55,_0x4e0884,_0x5ca6a0);}));
\ No newline at end of file
+var _0xe84b=['salt','role','disabled','blocked','blockedAt','online','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','api','activedirectory','undefined','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name'];(function(_0x2e4bf3,_0x2ba175){var _0x48c5ce=function(_0x1bfd25){while(--_0x1bfd25){_0x2e4bf3['push'](_0x2e4bf3['shift']());}};_0x48c5ce(++_0x2ba175);}(_0xe84b,0x1b0));var _0xbe84=function(_0x3e43c8,_0x516592){_0x3e43c8=_0x3e43c8-0x0;var _0x17b9b0=_0xe84b[_0x3e43c8];return _0x17b9b0;};'use strict';var passport=require(_0xbe84('0x0'));var LocalStrategy=require(_0xbe84('0x1'))[_0xbe84('0x2')];var moment=require(_0xbe84('0x3'));var ActiveDirectory=require(_0xbe84('0x4'));var BPromise=require(_0xbe84('0x5'));var util=require(_0xbe84('0x6'));var db=require(_0xbe84('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xbe84('0x8'));var config=require(_0xbe84('0x9'));var logger=require('../../config/logger')(_0xbe84('0xa'));function isActiveDirectoryConfigured(_0x5e3f9c){var _0x3e9528=![];if(typeof _0x5e3f9c[_0xbe84('0xb')]!==_0xbe84('0xc')){_0x3e9528=_0x5e3f9c['activedirectory']['baseDN']&&_0x5e3f9c[_0xbe84('0xb')]['url']&&_0x5e3f9c[_0xbe84('0xb')][_0xbe84('0xd')];}return _0x3e9528;}function adAuthenticate(_0x459339,_0x2f1ace,_0x336bd2){return new BPromise(function(_0x39823b,_0x327db6){try{var _0x3f9096=new ActiveDirectory(_0x459339);_0x3f9096[_0xbe84('0xe')](_0x2f1ace,_0x336bd2,function(_0xb26e85,_0x44a2e3){if(_0xb26e85){logger[_0xbe84('0xf')](_0xbe84('0x10'),_0x2f1ace,util['inspect'](_0xb26e85,{'showHidden':![],'depth':null}));_0x327db6(_0xbe84('0x11'));}else if(!_0x44a2e3){logger[_0xbe84('0xf')](_0xbe84('0x12'),_0x2f1ace);_0x327db6(_0xbe84('0x11'));}else{_0x39823b(_0x44a2e3);}});}catch(_0x5eeded){_0x327db6(_0x5eeded);}});}function ActiveDirectoryAuthenticate(_0x3df25e,_0x4ecc6c,_0xd43525,_0x285b43){var _0x3958e4,_0x716df5;if(!isActiveDirectoryConfigured(config)){logger[_0xbe84('0xf')](_0xbe84('0x13'),_0x4ecc6c);return _0x285b43(null,![],{'message':_0xbe84('0x11')});}return db[_0xbe84('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xbe84('0x15'),_0xbe84('0x16')],'raw':!![]})[_0xbe84('0x17')](function(_0x38663b){_0x3958e4=_0x38663b;if(!_0x3958e4[_0xbe84('0x15')]){logger[_0xbe84('0xf')](_0xbe84('0x18'),_0x4ecc6c);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3df25e[_0xbe84('0x19')]({'attributes':['id',_0xbe84('0x1a'),'password',_0xbe84('0x1b'),_0xbe84('0x1c'),_0xbe84('0x1d'),_0xbe84('0x1e'),_0xbe84('0x1f'),_0xbe84('0x20')],'where':{'name':_0x4ecc6c,'role':{'$or':[_0xbe84('0x21'),_0xbe84('0x22'),_0xbe84('0x23')]},'adSsoEnabled':!![]}});})[_0xbe84('0x17')](function(_0x6420a8){if(!_0x6420a8||_0x6420a8&&_0x6420a8['name']!==_0x4ecc6c){throw new Error(_0xbe84('0x11'));}_0x716df5=_0x6420a8;var _0x526073=_0x716df5[_0xbe84('0x1a')]+'@'+config[_0xbe84('0xb')]['domain'];return adAuthenticate(config[_0xbe84('0xb')],_0x526073,_0xd43525);})[_0xbe84('0x17')](function(_0x91d695){if(_0x716df5[_0xbe84('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3958e4[_0xbe84('0x16')]>0x0){if(_0x716df5[_0xbe84('0x1e')]){if(moment(_0x716df5[_0xbe84('0x1f')])[_0xbe84('0x24')](_0x3958e4[_0xbe84('0x16')],_0xbe84('0x25'))>moment()){throw new Error(_0xbe84('0x11'));}return utils[_0xbe84('0x26')](_0x716df5,0x0,![],null)[_0xbe84('0x17')](function(){return utils[_0xbe84('0x27')](_0x716df5);})[_0xbe84('0x17')](function(){return _0x285b43(null,_0x716df5);});}else{return utils['getLicense'](_0x716df5)[_0xbe84('0x17')](function(){return _0x285b43(null,_0x716df5);});}}else{return utils[_0xbe84('0x27')](_0x716df5)[_0xbe84('0x17')](function(){return _0x285b43(null,_0x716df5);});}})[_0xbe84('0x28')](function(_0x419d6f){return _0x285b43(null,![],_0x419d6f);});}function handleError(_0x48306f,_0x6c2515,_0x90d5df){return _0x48306f[_0xbe84('0x29')](_0x6c2515||0x1f4)[_0xbe84('0x2a')]({'message':_0x90d5df?_0x90d5df[_0xbe84('0x2b')]||_0x90d5df:''});}exports[_0xbe84('0x2c')]=function(_0xefbb06,_0x5563da,_0x4dd37d){passport['authenticate'](_0xbe84('0x2d'),function(_0x91934,_0x30afd6,_0x38b6d2){var _0x19a048=_0x91934||_0x38b6d2;if(_0x19a048){return handleError(_0x5563da,0x191,_0x19a048);}if(!_0x30afd6){return handleError(_0x5563da,0x194,{'message':_0xbe84('0x2e')});}else{var _0x3680a3={'payload':{'id':_0x30afd6['id'],'role':_0x30afd6['role']},'options':{'expiresIn':0x15180}};return authService[_0xbe84('0x2f')](_0x3680a3)[_0xbe84('0x17')](function(_0x6d1272){_0x5563da[_0xbe84('0x30')]({'id':_0x30afd6['id'],'token':_0x6d1272,'statusCall':'','isAlreadyLogged':_0x30afd6[_0xbe84('0x20')]});});}})(_0xefbb06,_0x5563da,_0x4dd37d);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0xbe84('0x1a'),'passwordField':_0xbe84('0x31')},function(_0x5456ca,_0x2a5513,_0x5027fd){return ActiveDirectoryAuthenticate(db[_0xbe84('0x32')],_0x5456ca,_0x2a5513,_0x5027fd);}));
\ No newline at end of file
index 0d86cc5..fa98391 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10be=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x146994,_0x26e478){var _0xcf1fb=function(_0x239977){while(--_0x239977){_0x146994['push'](_0x146994['shift']());}};_0xcf1fb(++_0x26e478);}(_0x10be,0x155));var _0xe10b=function(_0x3482ca,_0x84bd61){_0x3482ca=_0x3482ca-0x0;var _0x4956ac=_0x10be[_0x3482ca];return _0x4956ac;};'use strict';var express=require(_0xe10b('0x0'));var router=express[_0xe10b('0x1')]();var controller=require(_0xe10b('0x2'));router[_0xe10b('0x3')]('/',controller[_0xe10b('0x4')]);module[_0xe10b('0x5')]=router;
\ No newline at end of file
+var _0x011f=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x5e3ac9,_0x4aa831){var _0x2d90bd=function(_0x49176){while(--_0x49176){_0x5e3ac9['push'](_0x5e3ac9['shift']());}};_0x2d90bd(++_0x4aa831);}(_0x011f,0xca));var _0xf011=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x011f[_0x588011];return _0x3b3773;};'use strict';var express=require(_0xf011('0x0'));var router=express[_0xf011('0x1')]();var controller=require(_0xf011('0x2'));router[_0xf011('0x3')]('/',controller[_0xf011('0x4')]);module[_0xf011('0x5')]=router;
\ No newline at end of file
index 9e7d398..5834170 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x154f66,_0x116f85){var _0x3f947a=function(_0x1f671e){while(--_0x1f671e){_0x154f66['push'](_0x154f66['shift']());}};_0x3f947a(++_0x116f85);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});}));
\ No newline at end of file
+var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x1b0c67,_0x8db591){var _0x43c8bd=function(_0x48d028){while(--_0x48d028){_0x1b0c67['push'](_0x1b0c67['shift']());}};_0x43c8bd(++_0x8db591);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});}));
\ No newline at end of file
index 28140b9..36c61ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa179=['login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa179,0x191));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x9a17('0x0'));var passport=require(_0x9a17('0x1'));var router=express[_0x9a17('0x2')]();var controller=require(_0x9a17('0x3'));var userController=require(_0x9a17('0x4'));var authService=require(_0x9a17('0x5'));router[_0x9a17('0x6')]('/',controller[_0x9a17('0x7')]);router[_0x9a17('0x6')]('/callback',controller[_0x9a17('0x8')],authService[_0x9a17('0x9')],userController[_0x9a17('0x7')],authService[_0x9a17('0xa')]);module[_0x9a17('0xb')]=router;
\ No newline at end of file
+var _0xceb3=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x17b4d7,_0x28f0f4){var _0x467379=function(_0x1dc3db){while(--_0x1dc3db){_0x17b4d7['push'](_0x17b4d7['shift']());}};_0x467379(++_0x28f0f4);}(_0xceb3,0xf5));var _0x3ceb=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xceb3[_0x174a72];return _0x32cecd;};'use strict';var express=require(_0x3ceb('0x0'));var passport=require(_0x3ceb('0x1'));var router=express[_0x3ceb('0x2')]();var controller=require(_0x3ceb('0x3'));var userController=require(_0x3ceb('0x4'));var authService=require('../../components/auth/service');router[_0x3ceb('0x5')]('/',controller[_0x3ceb('0x6')]);router[_0x3ceb('0x5')](_0x3ceb('0x7'),controller[_0x3ceb('0x8')],authService[_0x3ceb('0x9')],userController[_0x3ceb('0x6')],authService[_0x3ceb('0xa')]);module[_0x3ceb('0xb')]=router;
\ No newline at end of file
index 21d2db7..ef083aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76e4=['json','online','forgot','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','blockedAt','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','util','passport','passport-local','jayson/promise','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','blockDuration','name','password','salt','role','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','disabled','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','status','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x14c9f3,_0x303a11){var _0x347b6c=function(_0x4ecf47){while(--_0x4ecf47){_0x14c9f3['push'](_0x14c9f3['shift']());}};_0x347b6c(++_0x303a11);}(_0x76e4,0x117));var _0x476e=function(_0x4c807e,_0x12e32a){_0x4c807e=_0x4c807e-0x0;var _0x56e739=_0x76e4[_0x4c807e];return _0x56e739;};'use strict';var util=require(_0x476e('0x0'));var passport=require(_0x476e('0x1'));var LocalStrategy=require(_0x476e('0x2'))['Strategy'];var jayson=require(_0x476e('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x476e('0x4'));var db=require(_0x476e('0x5'))['db'];var authService=require(_0x476e('0x6'));var utils=require('../../config/utils');var client=jayson[_0x476e('0x7')][_0x476e('0x8')]({'port':0x232b});function localAuthenticate(_0x344cb3,_0x4b4dfe,_0x214d31,_0x3e166a){var _0x1263d,_0x182648;return db[_0x476e('0x9')][_0x476e('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x476e('0xb')],'raw':!![]})['then'](function(_0x41c1f0){_0x1263d=_0x41c1f0;return _0x344cb3[_0x476e('0xa')]({'attributes':['id',_0x476e('0xc'),_0x476e('0xd'),_0x476e('0xe'),_0x476e('0xf'),'disabled',_0x476e('0x10'),'blockedAt',_0x476e('0x11')],'where':{'name':_0x4b4dfe,'role':{'$or':[_0x476e('0x12'),_0x476e('0x13'),_0x476e('0x14')]}}});})[_0x476e('0x15')](function(_0x50f03d){if(!_0x50f03d||_0x50f03d&&_0x50f03d[_0x476e('0xc')]!==_0x4b4dfe){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x182648=_0x50f03d;return _0x182648;}})[_0x476e('0x15')](function(){_0x182648['authenticate'](_0x214d31,function(_0x3b1a55,_0x427fc1){var _0x45dc92=_0x182648[_0x476e('0x11')]+0x1;if(_0x3b1a55){return _0x3e166a(_0x3b1a55);}else if(!_0x427fc1){if(_0x182648['disabled']){return _0x3e166a(null,![],{'message':_0x476e('0x16')});}else if(_0x1263d[_0x476e('0x17')]>0x0){if(_0x182648[_0x476e('0x10')]){if(_0x1263d[_0x476e('0xb')]>0x0){if(moment(_0x182648['blockedAt'])['add'](_0x1263d[_0x476e('0xb')],_0x476e('0x18'))>moment()){return _0x3e166a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x182648,_0x45dc92,![],null)[_0x476e('0x15')](function(){return _0x3e166a(null,![],{'message':_0x476e('0x16')});});}}else{return _0x3e166a(null,![],{'message':_0x476e('0x16')});}}else{if(_0x45dc92>=_0x1263d[_0x476e('0x17')]){return utils[_0x476e('0x19')](_0x182648,0x0,!![],moment())[_0x476e('0x15')](function(){return _0x3e166a(null,![],{'message':_0x476e('0x16')});});}else{return utils[_0x476e('0x19')](_0x182648,_0x45dc92,![],null)[_0x476e('0x15')](function(){return _0x3e166a(null,![],{'message':_0x476e('0x16')});});}}}else{return _0x3e166a(null,![],{'message':_0x476e('0x16')});}}else{if(_0x182648[_0x476e('0x1a')]){return _0x3e166a(null,![],{'message':_0x476e('0x16')});}else if(_0x1263d[_0x476e('0x17')]>0x0){if(_0x182648[_0x476e('0x10')]){if(_0x1263d[_0x476e('0xb')]>0x0){if(moment(_0x182648['blockedAt'])[_0x476e('0x1b')](_0x1263d[_0x476e('0xb')],_0x476e('0x18'))>moment()){return _0x3e166a(null,![],{'message':_0x476e('0x16')});}else{return utils[_0x476e('0x19')](_0x182648,0x0,![],null)[_0x476e('0x15')](function(){return utils[_0x476e('0x1c')](_0x182648);})[_0x476e('0x15')](function(){return _0x3e166a(null,_0x182648);});}}else{return _0x3e166a(null,![],{'message':_0x476e('0x16')});}}else{return utils[_0x476e('0x19')](_0x182648,0x0,![],null)[_0x476e('0x15')](function(){return utils[_0x476e('0x1c')](_0x182648);})['then'](function(){return _0x3e166a(null,_0x182648);})['catch'](function(_0x554056){return _0x3e166a(null,![],_0x554056);});}}else{if(_0x182648[_0x476e('0x10')]){return _0x3e166a(null,![],{'message':_0x476e('0x16')});}else{return utils[_0x476e('0x1c')](_0x182648)['then'](function(){return _0x3e166a(null,_0x182648);});}}}});})[_0x476e('0x1d')](function(_0x578dd9){return _0x3e166a(null,![],_0x578dd9);});}function sendServiceMail(_0x568d6a){return db['MailAccount'][_0x476e('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x476e('0xc'),_0x476e('0x1f')],'include':[{'model':db[_0x476e('0x20')],'as':_0x476e('0x21'),'include':[{'model':db['CloudProvider'],'as':_0x476e('0x22')}]}]})[_0x476e('0x15')](function(_0x5d9e5e){if(!_0x5d9e5e){throw new Error(_0x476e('0x23'));}var _0x262e39=_0x5d9e5e[_0x476e('0x24')]();var _0x3c686f={'account':_0x262e39,'message':_[_0x476e('0x25')]({'from':util[_0x476e('0x26')]('\x22%s\x22\x20<%s>',_0x5d9e5e[_0x476e('0xc')],_0x5d9e5e[_0x476e('0x1f')]||_0x5d9e5e[_0x476e('0x21')][_0x476e('0x13')])},_0x568d6a)};return client[_0x476e('0x27')]('SendMail',_0x3c686f);})['then'](function(_0x1c2cd8){if(_0x1c2cd8['error']){throw new Error(util[_0x476e('0x26')](_0x476e('0x28'),_0x1c2cd8[_0x476e('0x29')][_0x476e('0x2a')]||JSON['stringify'](_0x1c2cd8[_0x476e('0x29')])));}return!![];});}function handleError(_0xba18b9,_0x705ebd,_0x16c315){return _0xba18b9[_0x476e('0x2b')](_0x705ebd||0x1f4)['send']({'message':_0x16c315?_0x16c315[_0x476e('0x2a')]||_0x16c315:''});}exports[_0x476e('0x2c')]=function(_0xefb290,_0x15d8f4,_0x27b727){passport[_0x476e('0x2d')](_0x476e('0x2e'),function(_0x35d394,_0x48140e,_0x3d496a){var _0x418332=_0x35d394||_0x3d496a;if(_0x418332){return handleError(_0x15d8f4,0x191,_0x418332);}if(!_0x48140e){return handleError(_0x15d8f4,0x194,{'message':_0x476e('0x2f')});}else{var _0x55aeb8={'payload':{'id':_0x48140e['id'],'role':_0x48140e[_0x476e('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x476e('0x30')](_0x55aeb8)[_0x476e('0x15')](function(_0x2a2c6d){_0x15d8f4[_0x476e('0x31')]({'id':_0x48140e['id'],'token':_0x2a2c6d,'statusCall':'','isAlreadyLogged':_0x48140e[_0x476e('0x32')]});});}})(_0xefb290,_0x15d8f4,_0x27b727);};exports[_0x476e('0x33')]=function(_0x45a7ac,_0x2e6fc0){if(!_0x45a7ac[_0x476e('0x34')][_0x476e('0x1f')]){return handleError(_0x2e6fc0,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x52cabb=rs[_0x476e('0x35')]();_0x45a7ac[_0x476e('0x34')]['email']=_0x45a7ac[_0x476e('0x34')][_0x476e('0x1f')][_0x476e('0x36')]()[_0x476e('0x37')]();var _0x13faf5;return db[_0x476e('0x9')][_0x476e('0xa')]({'where':{'id':0x1},'attributes':[_0x476e('0x17'),_0x476e('0xb')],'raw':!![]})[_0x476e('0x15')](function(_0x343d31){_0x13faf5=_0x343d31;return db[_0x476e('0x38')][_0x476e('0x1e')]({'where':{'email':_0x45a7ac[_0x476e('0x34')][_0x476e('0x1f')]}});})[_0x476e('0x15')](function(_0x1582d0){if(!_0x1582d0){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x1582d0['disabled']){throw new Error(_0x476e('0x39'));}if(_0x1582d0[_0x476e('0x10')]){if(moment(_0x1582d0['blockedAt'])['add'](_0x13faf5[_0x476e('0xb')],'minutes')>moment()){throw new Error(_0x476e('0x3a'));}else{_0x1582d0[_0x476e('0x10')]=![];_0x1582d0[_0x476e('0x3b')]=null;}}_0x1582d0[_0x476e('0x3c')]=_0x52cabb;_0x1582d0[_0x476e('0x3d')]=Date[_0x476e('0x3e')]()+0x36ee80;return _0x1582d0[_0x476e('0x3f')]();})[_0x476e('0x15')](function(){return sendServiceMail({'to':_0x45a7ac[_0x476e('0x34')][_0x476e('0x1f')],'subject':_0x476e('0x40'),'text':_0x476e('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x476e('0x42')+_0x45a7ac[_0x476e('0x43')]['host']+_0x476e('0x44')+_0x52cabb+'\x0a\x0a'+_0x476e('0x45')});})[_0x476e('0x15')](function(){_0x2e6fc0['status'](0xc8)[_0x476e('0x46')]({'message':_0x476e('0x47')});})['catch'](function(_0x26c28d){return handleError(_0x2e6fc0,0x1f4,_0x26c28d);});};exports[_0x476e('0x48')]=function(_0x51b4ec,_0x5e8144){return db[_0x476e('0x38')][_0x476e('0x1e')]({'where':{'resetPasswordToken':_0x51b4ec[_0x476e('0x49')][_0x476e('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x476e('0x3e')]()}}})[_0x476e('0x15')](function(_0x3f6f20){if(!_0x3f6f20){throw new Error(_0x476e('0x4b'));}return db[_0x476e('0x9')][_0x476e('0xa')]({'attributes':['id',_0x476e('0x4c'),_0x476e('0x4d'),'passwordHistoryLimit']})['then'](function(_0x24d6e4){if(_0x24d6e4['securePassword'])authService[_0x476e('0x4e')](_0x51b4ec[_0x476e('0x34')][_0x476e('0xd')]);if(!_0x24d6e4[_0x476e('0x4d')]||!_0x3f6f20[_0x476e('0x4f')])return _0x3f6f20;authService[_0x476e('0x50')](_0x51b4ec['body'][_0x476e('0xd')],_0x3f6f20[_0x476e('0x4f')],_0x24d6e4[_0x476e('0x51')]);return _0x3f6f20;})[_0x476e('0x15')](function(){_0x3f6f20[_0x476e('0xd')]=_0x51b4ec[_0x476e('0x34')][_0x476e('0xd')];_0x3f6f20['resetPasswordToken']=null;_0x3f6f20[_0x476e('0x3d')]=null;return _0x3f6f20[_0x476e('0x3f')]();});})[_0x476e('0x15')](function(){_0x5e8144[_0x476e('0x2b')](0xc8)[_0x476e('0x46')]({'message':'Password\x20reset!'});})[_0x476e('0x1d')](function(_0x4bcbd0){return handleError(_0x5e8144,0x1f4,_0x4bcbd0);});};passport['use'](_0x476e('0x2e'),new LocalStrategy({'usernameField':_0x476e('0xc'),'passwordField':_0x476e('0xd')},function(_0x5aef85,_0x333153,_0x2989a5){return localAuthenticate(db['User'],_0x5aef85,_0x333153,_0x2989a5);}));
\ No newline at end of file
+var _0xc82b=['Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','resetPasswordToken','use','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','then','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','error','message','stringify','status','send','login','local-login','role','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'];(function(_0x1df785,_0x49e58f){var _0x536b69=function(_0x397a45){while(--_0x397a45){_0x1df785['push'](_0x1df785['shift']());}};_0x536b69(++_0x49e58f);}(_0xc82b,0x1f2));var _0xbc82=function(_0x3e40db,_0x42a899){_0x3e40db=_0x3e40db-0x0;var _0x5b3ff2=_0xc82b[_0x3e40db];return _0x5b3ff2;};'use strict';var util=require(_0xbc82('0x0'));var passport=require(_0xbc82('0x1'));var LocalStrategy=require('passport-local')[_0xbc82('0x2')];var jayson=require(_0xbc82('0x3'));var _=require(_0xbc82('0x4'));var rs=require(_0xbc82('0x5'));var moment=require(_0xbc82('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xbc82('0x7')][_0xbc82('0x8')]({'port':0x232b});function localAuthenticate(_0x1e414a,_0x5e10de,_0x7354e8,_0x34ae02){var _0x31ab18,_0x5352e5;return db[_0xbc82('0x9')][_0xbc82('0xa')]({'where':{'id':0x1},'attributes':[_0xbc82('0xb'),_0xbc82('0xc')],'raw':!![]})['then'](function(_0x4f4c5a){_0x31ab18=_0x4f4c5a;return _0x1e414a[_0xbc82('0xa')]({'attributes':['id',_0xbc82('0xd'),_0xbc82('0xe'),_0xbc82('0xf'),'role',_0xbc82('0x10'),_0xbc82('0x11'),_0xbc82('0x12'),_0xbc82('0x13')],'where':{'name':_0x5e10de,'role':{'$or':[_0xbc82('0x14'),_0xbc82('0x15'),_0xbc82('0x16')]}}});})['then'](function(_0x2eb661){if(!_0x2eb661||_0x2eb661&&_0x2eb661['name']!==_0x5e10de){throw new Error(_0xbc82('0x17'));}else{_0x5352e5=_0x2eb661;return _0x5352e5;}})['then'](function(){_0x5352e5['authenticate'](_0x7354e8,function(_0x9a24b6,_0x134160){var _0x5f19a0=_0x5352e5[_0xbc82('0x13')]+0x1;if(_0x9a24b6){return _0x34ae02(_0x9a24b6);}else if(!_0x134160){if(_0x5352e5[_0xbc82('0x10')]){return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}else if(_0x31ab18[_0xbc82('0xb')]>0x0){if(_0x5352e5[_0xbc82('0x11')]){if(_0x31ab18[_0xbc82('0xc')]>0x0){if(moment(_0x5352e5[_0xbc82('0x12')])[_0xbc82('0x18')](_0x31ab18['blockDuration'],_0xbc82('0x19'))>moment()){return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}else{return utils[_0xbc82('0x1a')](_0x5352e5,_0x5f19a0,![],null)[_0xbc82('0x1b')](function(){return _0x34ae02(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}}else{if(_0x5f19a0>=_0x31ab18[_0xbc82('0xb')]){return utils[_0xbc82('0x1a')](_0x5352e5,0x0,!![],moment())[_0xbc82('0x1b')](function(){return _0x34ae02(null,![],{'message':_0xbc82('0x17')});});}else{return utils['clearBlockUser'](_0x5352e5,_0x5f19a0,![],null)[_0xbc82('0x1b')](function(){return _0x34ae02(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}}else{if(_0x5352e5[_0xbc82('0x10')]){return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}else if(_0x31ab18[_0xbc82('0xb')]>0x0){if(_0x5352e5[_0xbc82('0x11')]){if(_0x31ab18[_0xbc82('0xc')]>0x0){if(moment(_0x5352e5['blockedAt'])[_0xbc82('0x18')](_0x31ab18[_0xbc82('0xc')],'minutes')>moment()){return _0x34ae02(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xbc82('0x1a')](_0x5352e5,0x0,![],null)[_0xbc82('0x1b')](function(){return utils[_0xbc82('0x1c')](_0x5352e5);})[_0xbc82('0x1b')](function(){return _0x34ae02(null,_0x5352e5);});}}else{return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}}else{return utils[_0xbc82('0x1a')](_0x5352e5,0x0,![],null)[_0xbc82('0x1b')](function(){return utils['getLicense'](_0x5352e5);})[_0xbc82('0x1b')](function(){return _0x34ae02(null,_0x5352e5);})[_0xbc82('0x1d')](function(_0x251de2){return _0x34ae02(null,![],_0x251de2);});}}else{if(_0x5352e5[_0xbc82('0x11')]){return _0x34ae02(null,![],{'message':_0xbc82('0x17')});}else{return utils[_0xbc82('0x1c')](_0x5352e5)[_0xbc82('0x1b')](function(){return _0x34ae02(null,_0x5352e5);});}}}});})[_0xbc82('0x1d')](function(_0x3b7784){return _0x34ae02(null,![],_0x3b7784);});}function sendServiceMail(_0x541a05){return db[_0xbc82('0x1e')][_0xbc82('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xbc82('0x20')],'include':[{'model':db[_0xbc82('0x21')],'as':_0xbc82('0x22'),'include':[{'model':db[_0xbc82('0x23')],'as':_0xbc82('0x23')}]}]})[_0xbc82('0x1b')](function(_0x401b5c){if(!_0x401b5c){throw new Error(_0xbc82('0x24'));}var _0x24286e=_0x401b5c[_0xbc82('0x25')]();var _0x244ff1={'account':_0x24286e,'message':_['merge']({'from':util[_0xbc82('0x26')](_0xbc82('0x27'),_0x401b5c['name'],_0x401b5c[_0xbc82('0x20')]||_0x401b5c['Smtp'][_0xbc82('0x15')])},_0x541a05)};return client[_0xbc82('0x28')]('SendMail',_0x244ff1);})[_0xbc82('0x1b')](function(_0x3a466f){if(_0x3a466f['error']){throw new Error(util[_0xbc82('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3a466f[_0xbc82('0x29')][_0xbc82('0x2a')]||JSON[_0xbc82('0x2b')](_0x3a466f[_0xbc82('0x29')])));}return!![];});}function handleError(_0x1b6c4b,_0x5bdfa8,_0x2ac02c){return _0x1b6c4b[_0xbc82('0x2c')](_0x5bdfa8||0x1f4)[_0xbc82('0x2d')]({'message':_0x2ac02c?_0x2ac02c[_0xbc82('0x2a')]||_0x2ac02c:''});}exports[_0xbc82('0x2e')]=function(_0x25bfa7,_0x27d48e,_0x317642){passport['authenticate'](_0xbc82('0x2f'),function(_0xf92004,_0x8dfee4,_0x24db66){var _0x5a5c59=_0xf92004||_0x24db66;if(_0x5a5c59){return handleError(_0x27d48e,0x191,_0x5a5c59);}if(!_0x8dfee4){return handleError(_0x27d48e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2ef595={'payload':{'id':_0x8dfee4['id'],'role':_0x8dfee4[_0xbc82('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0xbc82('0x31')](_0x2ef595)[_0xbc82('0x1b')](function(_0x13373f){_0x27d48e[_0xbc82('0x32')]({'id':_0x8dfee4['id'],'token':_0x13373f,'statusCall':'','isAlreadyLogged':_0x8dfee4[_0xbc82('0x33')]});});}})(_0x25bfa7,_0x27d48e,_0x317642);};exports['forgot']=function(_0x5585c5,_0x5d6bdf){if(!_0x5585c5[_0xbc82('0x34')][_0xbc82('0x20')]){return handleError(_0x5d6bdf,0x1f4,{'message':_0xbc82('0x35')});}var _0x167c5f=rs[_0xbc82('0x36')]();_0x5585c5[_0xbc82('0x34')][_0xbc82('0x20')]=_0x5585c5[_0xbc82('0x34')]['email']['trim']()[_0xbc82('0x37')]();var _0x504aec;return db[_0xbc82('0x9')][_0xbc82('0xa')]({'where':{'id':0x1},'attributes':[_0xbc82('0xb'),_0xbc82('0xc')],'raw':!![]})[_0xbc82('0x1b')](function(_0x3e2010){_0x504aec=_0x3e2010;return db['User'][_0xbc82('0x1f')]({'where':{'email':_0x5585c5[_0xbc82('0x34')][_0xbc82('0x20')]}});})[_0xbc82('0x1b')](function(_0x53f4f9){if(!_0x53f4f9){throw new Error(_0xbc82('0x38'));}if(_0x53f4f9[_0xbc82('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x53f4f9[_0xbc82('0x11')]){if(moment(_0x53f4f9[_0xbc82('0x12')])[_0xbc82('0x18')](_0x504aec[_0xbc82('0xc')],_0xbc82('0x19'))>moment()){throw new Error(_0xbc82('0x39'));}else{_0x53f4f9['blocked']=![];_0x53f4f9['blockedAt']=null;}}_0x53f4f9['resetPasswordToken']=_0x167c5f;_0x53f4f9[_0xbc82('0x3a')]=Date[_0xbc82('0x3b')]()+0x36ee80;return _0x53f4f9[_0xbc82('0x3c')]();})[_0xbc82('0x1b')](function(){return sendServiceMail({'to':_0x5585c5[_0xbc82('0x34')][_0xbc82('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xbc82('0x3d')+_0xbc82('0x3e')+_0xbc82('0x3f')+_0x5585c5[_0xbc82('0x40')][_0xbc82('0x41')]+_0xbc82('0x42')+_0x167c5f+'\x0a\x0a'+_0xbc82('0x43')});})[_0xbc82('0x1b')](function(){_0x5d6bdf['status'](0xc8)[_0xbc82('0x2d')]({'message':_0xbc82('0x44')});})[_0xbc82('0x1d')](function(_0x2d2d22){return handleError(_0x5d6bdf,0x1f4,_0x2d2d22);});};exports['reset']=function(_0x582ed9,_0x5001d3){return db[_0xbc82('0x45')][_0xbc82('0x1f')]({'where':{'resetPasswordToken':_0x582ed9[_0xbc82('0x46')][_0xbc82('0x47')],'resetPasswordExpires':{'$gt':Date[_0xbc82('0x3b')]()}}})['then'](function(_0x527991){if(!_0x527991){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xbc82('0x9')][_0xbc82('0xa')]({'attributes':['id','securePassword',_0xbc82('0x48'),_0xbc82('0x49')]})[_0xbc82('0x1b')](function(_0x1a0114){if(_0x1a0114[_0xbc82('0x4a')])authService[_0xbc82('0x4b')](_0x582ed9[_0xbc82('0x34')]['password']);if(!_0x1a0114[_0xbc82('0x48')]||!_0x527991['previousPasswords'])return _0x527991;authService[_0xbc82('0x4c')](_0x582ed9[_0xbc82('0x34')][_0xbc82('0xe')],_0x527991[_0xbc82('0x4d')],_0x1a0114[_0xbc82('0x49')]);return _0x527991;})['then'](function(){_0x527991[_0xbc82('0xe')]=_0x582ed9[_0xbc82('0x34')][_0xbc82('0xe')];_0x527991[_0xbc82('0x4e')]=null;_0x527991[_0xbc82('0x3a')]=null;return _0x527991['save']();});})['then'](function(){_0x5001d3['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0xbc82('0x1d')](function(_0x3d8877){return handleError(_0x5001d3,0x1f4,_0x3d8877);});};passport[_0xbc82('0x4f')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xbc82('0xe')},function(_0x3c815f,_0x3ee35b,_0x1140e7){return localAuthenticate(db[_0xbc82('0x45')],_0x3c815f,_0x3ee35b,_0x1140e7);}));
\ No newline at end of file
index 4d59a7c..258932e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbf5=['exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0xdbf5,0xf1));var _0x5dbf=function(_0x38d161,_0x53f9e7){_0x38d161=_0x38d161-0x0;var _0x54ca68=_0xdbf5[_0x38d161];return _0x54ca68;};'use strict';var express=require(_0x5dbf('0x0'));var router=express[_0x5dbf('0x1')]();var controller=require(_0x5dbf('0x2'));router[_0x5dbf('0x3')]('/',controller['login']);router[_0x5dbf('0x3')](_0x5dbf('0x4'),controller[_0x5dbf('0x5')]);router[_0x5dbf('0x3')](_0x5dbf('0x6'),controller['reset']);module[_0x5dbf('0x7')]=router;
\ No newline at end of file
+var _0x8964=['exports','express','post','/forgot','forgot','/reset/:token'];(function(_0x11d4b1,_0x6f58ca){var _0x1302ba=function(_0x4c75c1){while(--_0x4c75c1){_0x11d4b1['push'](_0x11d4b1['shift']());}};_0x1302ba(++_0x6f58ca);}(_0x8964,0xf7));var _0x4896=function(_0x24aa5c,_0x4ee4d3){_0x24aa5c=_0x24aa5c-0x0;var _0x19eb18=_0x8964[_0x24aa5c];return _0x19eb18;};'use strict';var express=require(_0x4896('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x4896('0x1')]('/',controller['login']);router[_0x4896('0x1')](_0x4896('0x2'),controller[_0x4896('0x3')]);router['post'](_0x4896('0x4'),controller['reset']);module[_0x4896('0x5')]=router;
\ No newline at end of file
index bc83dc1..5f3587e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe87c=['STRING','sequelize'];(function(_0x1b81b9,_0x15d051){var _0x48d256=function(_0x4a2f91){while(--_0x4a2f91){_0x1b81b9['push'](_0x1b81b9['shift']());}};_0x48d256(++_0x15d051);}(_0xe87c,0x1c9));var _0xce87=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xe87c[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0xce87('0x0'));module['exports']={'name':{'type':Sequelize[_0xce87('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xce87('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}};
\ No newline at end of file
+var _0xcace=['INTEGER','sequelize','exports','STRING'];(function(_0xc1f995,_0x22e33c){var _0x2f7370=function(_0x3a9c06){while(--_0x3a9c06){_0xc1f995['push'](_0xc1f995['shift']());}};_0x2f7370(++_0x22e33c);}(_0xcace,0x6d));var _0xecac=function(_0x264609,_0x7609b9){_0x264609=_0x264609-0x0;var _0x1f38b9=_0xcace[_0x264609];return _0x1f38b9;};'use strict';var Sequelize=require(_0xecac('0x0'));module[_0xecac('0x1')]={'name':{'type':Sequelize[_0xecac('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xecac('0x2')]},'description':{'type':Sequelize[_0xecac('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xecac('0x3')],'defaultValue':0xa}};
\ No newline at end of file
index 2b7fcc5..862506c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x59ed=['merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','update','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','stack','send','map','Automation','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x59ed,0xbc));var _0xd59e=function(_0x1b591b,_0x6d2e2b){_0x1b591b=_0x1b591b-0x0;var _0x3c24f0=_0x59ed[_0x1b591b];return _0x3c24f0;};'use strict';var emlformat=require(_0xd59e('0x0'));var rimraf=require(_0xd59e('0x1'));var zipdir=require(_0xd59e('0x2'));var jsonpatch=require(_0xd59e('0x3'));var rp=require('request-promise');var moment=require(_0xd59e('0x4'));var BPromise=require(_0xd59e('0x5'));var Mustache=require(_0xd59e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd59e('0x7'));var ejs=require(_0xd59e('0x8'));var fs=require('fs');var fs_extra=require(_0xd59e('0x9'));var _=require('lodash');var squel=require(_0xd59e('0xa'));var crypto=require(_0xd59e('0xb'));var jsforce=require(_0xd59e('0xc'));var deskjs=require(_0xd59e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd59e('0xe'));var Papa=require(_0xd59e('0xf'));var Redis=require('ioredis');var authService=require(_0xd59e('0x10'));var qs=require(_0xd59e('0x11'));var as=require(_0xd59e('0x12'));var hardwareService=require(_0xd59e('0x13'));var logger=require(_0xd59e('0x14'))(_0xd59e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd59e('0x16'));var db=require(_0xd59e('0x17'))['db'];function respondWithStatusCode(_0x254657,_0x309b7b){_0x309b7b=_0x309b7b||0xcc;return function(_0x597c98){if(_0x597c98){return _0x254657[_0xd59e('0x18')](_0x309b7b);}return _0x254657[_0xd59e('0x19')](_0x309b7b)[_0xd59e('0x1a')]();};}function respondWithResult(_0x31ef84,_0x51edc3){_0x51edc3=_0x51edc3||0xc8;return function(_0xd45b28){if(_0xd45b28){return _0x31ef84[_0xd59e('0x19')](_0x51edc3)['json'](_0xd45b28);}};}function respondWithFilteredResult(_0x2dff32,_0x145868){return function(_0x5b37fc){if(_0x5b37fc){var _0x1e82d0=typeof _0x145868[_0xd59e('0x1b')]===_0xd59e('0x1c')&&typeof _0x145868[_0xd59e('0x1d')]==='undefined';var _0x28e39e=_0x5b37fc[_0xd59e('0x1e')];var _0x1399ca=_0x1e82d0?0x0:_0x145868[_0xd59e('0x1b')];var _0x52bb37=_0x1e82d0?_0x5b37fc[_0xd59e('0x1e')]:_0x145868[_0xd59e('0x1b')]+_0x145868[_0xd59e('0x1d')];var _0x28bcc5;if(_0x52bb37>=_0x28e39e){_0x52bb37=_0x28e39e;_0x28bcc5=0xc8;}else{_0x28bcc5=0xce;}_0x2dff32['status'](_0x28bcc5);return _0x2dff32[_0xd59e('0x1f')](_0xd59e('0x20'),_0x1399ca+'-'+_0x52bb37+'/'+_0x28e39e)[_0xd59e('0x21')](_0x5b37fc);}return null;};}function patchUpdates(_0x19a71b){return function(_0x114b98){try{jsonpatch[_0xd59e('0x22')](_0x114b98,_0x19a71b,!![]);}catch(_0x4f9d73){return BPromise['reject'](_0x4f9d73);}return _0x114b98[_0xd59e('0x23')]();};}function saveUpdates(_0x44117b,_0xabfd8a){return function(_0x35d804){if(_0x35d804){return _0x35d804['update'](_0x44117b)['then'](function(_0x4eb9f4){return _0x4eb9f4;});}return null;};}function removeEntity(_0x4c6d27,_0x320c30){return function(_0x49a6c4){if(_0x49a6c4){return _0x49a6c4[_0xd59e('0x24')]()[_0xd59e('0x25')](function(){_0x4c6d27[_0xd59e('0x19')](0xcc)[_0xd59e('0x1a')]();});}};}function handleEntityNotFound(_0x4b7f70,_0x2301a3){return function(_0x45111){if(!_0x45111){_0x4b7f70[_0xd59e('0x18')](0x194);}return _0x45111;};}function handleError(_0x3db024,_0x4456d8){_0x4456d8=_0x4456d8||0x1f4;return function(_0x401307){logger['error'](_0x401307[_0xd59e('0x26')]);if(_0x401307['name']){delete _0x401307['name'];}_0x3db024[_0xd59e('0x19')](_0x4456d8)[_0xd59e('0x27')](_0x401307);};}exports['index']=function(_0x4e6333,_0x21466c){var _0x54f6ce={},_0x4b50c7={},_0x3e31c8={'count':0x0,'rows':[]};var _0x2635dc=_[_0xd59e('0x28')](db[_0xd59e('0x29')][_0xd59e('0x2a')],function(_0x20bf9f){return{'name':_0x20bf9f[_0xd59e('0x2b')],'type':_0x20bf9f[_0xd59e('0x2c')][_0xd59e('0x2d')]};});_0x4b50c7[_0xd59e('0x2e')]=_[_0xd59e('0x28')](_0x2635dc,_0xd59e('0x2f'));_0x4b50c7[_0xd59e('0x30')]=_[_0xd59e('0x31')](_0x4e6333[_0xd59e('0x30')]);_0x4b50c7[_0xd59e('0x32')]=_[_0xd59e('0x33')](_0x4b50c7[_0xd59e('0x2e')],_0x4b50c7[_0xd59e('0x30')]);_0x54f6ce[_0xd59e('0x34')]=_[_0xd59e('0x33')](_0x4b50c7[_0xd59e('0x2e')],qs[_0xd59e('0x35')](_0x4e6333[_0xd59e('0x30')][_0xd59e('0x35')]));_0x54f6ce[_0xd59e('0x34')]=_0x54f6ce[_0xd59e('0x34')][_0xd59e('0x36')]?_0x54f6ce[_0xd59e('0x34')]:_0x4b50c7[_0xd59e('0x2e')];if(!_0x4e6333['query'][_0xd59e('0x37')](_0xd59e('0x38'))){_0x54f6ce[_0xd59e('0x1d')]=qs[_0xd59e('0x1d')](_0x4e6333[_0xd59e('0x30')][_0xd59e('0x1d')]);_0x54f6ce[_0xd59e('0x1b')]=qs[_0xd59e('0x1b')](_0x4e6333['query'][_0xd59e('0x1b')]);}_0x54f6ce[_0xd59e('0x39')]=qs[_0xd59e('0x3a')](_0x4e6333[_0xd59e('0x30')]['sort']);_0x54f6ce[_0xd59e('0x3b')]=qs[_0xd59e('0x32')](_[_0xd59e('0x3c')](_0x4e6333[_0xd59e('0x30')],_0x4b50c7['filters']),_0x2635dc);if(_0x4e6333[_0xd59e('0x30')]['filter']){_0x54f6ce[_0xd59e('0x3b')]=_[_0xd59e('0x3d')](_0x54f6ce['where'],{'$or':_[_0xd59e('0x28')](_0x2635dc,function(_0xf8cb7b){if(_0xf8cb7b[_0xd59e('0x2c')]!=='VIRTUAL'){var _0x1bc990={};_0x1bc990[_0xf8cb7b['name']]={'$like':'%'+_0x4e6333['query'][_0xd59e('0x3e')]+'%'};return _0x1bc990;}})});}_0x54f6ce=_[_0xd59e('0x3d')]({},_0x54f6ce,_0x4e6333[_0xd59e('0x3f')]);var _0x1cea87={'where':_0x54f6ce[_0xd59e('0x3b')]};return db[_0xd59e('0x29')]['count'](_0x1cea87)['then'](function(_0x4a0e73){_0x3e31c8['count']=_0x4a0e73;if(_0x4e6333[_0xd59e('0x30')][_0xd59e('0x40')]){_0x54f6ce['include']=[{'all':!![]}];}return db[_0xd59e('0x29')][_0xd59e('0x41')](_0x54f6ce);})['then'](function(_0x5583a1){_0x3e31c8[_0xd59e('0x42')]=_0x5583a1;return _0x3e31c8;})[_0xd59e('0x25')](respondWithFilteredResult(_0x21466c,_0x54f6ce))[_0xd59e('0x43')](handleError(_0x21466c,null));};exports[_0xd59e('0x44')]=function(_0x32fa5e,_0xf73545){var _0x521f14={'raw':![],'where':{'id':_0x32fa5e[_0xd59e('0x45')]['id']}},_0x1b36bb={};_0x1b36bb[_0xd59e('0x2e')]=_[_0xd59e('0x31')](db[_0xd59e('0x29')]['rawAttributes']);_0x1b36bb['query']=_['keys'](_0x32fa5e[_0xd59e('0x30')]);_0x1b36bb[_0xd59e('0x32')]=_[_0xd59e('0x33')](_0x1b36bb[_0xd59e('0x2e')],_0x1b36bb[_0xd59e('0x30')]);_0x521f14[_0xd59e('0x34')]=_[_0xd59e('0x33')](_0x1b36bb[_0xd59e('0x2e')],qs[_0xd59e('0x35')](_0x32fa5e['query'][_0xd59e('0x35')]));_0x521f14[_0xd59e('0x34')]=_0x521f14[_0xd59e('0x34')][_0xd59e('0x36')]?_0x521f14[_0xd59e('0x34')]:_0x1b36bb[_0xd59e('0x2e')];if(_0x32fa5e['query'][_0xd59e('0x40')]){_0x521f14['include']=[{'all':!![]}];}_0x521f14=_['merge']({},_0x521f14,_0x32fa5e[_0xd59e('0x3f')]);return db[_0xd59e('0x29')][_0xd59e('0x46')](_0x521f14)[_0xd59e('0x25')](handleEntityNotFound(_0xf73545,null))[_0xd59e('0x25')](respondWithResult(_0xf73545,null))[_0xd59e('0x43')](handleError(_0xf73545,null));};exports['create']=function(_0x19a92b,_0x5358fd){return db[_0xd59e('0x29')][_0xd59e('0x47')](_0x19a92b['body'],{})[_0xd59e('0x25')](respondWithResult(_0x5358fd,0xc9))[_0xd59e('0x43')](handleError(_0x5358fd,null));};exports[_0xd59e('0x48')]=function(_0x5f454c,_0x3dccd6){if(_0x5f454c[_0xd59e('0x49')]['id']){delete _0x5f454c[_0xd59e('0x49')]['id'];}return db[_0xd59e('0x29')][_0xd59e('0x46')]({'where':{'id':_0x5f454c[_0xd59e('0x45')]['id']}})[_0xd59e('0x25')](handleEntityNotFound(_0x3dccd6,null))[_0xd59e('0x25')](saveUpdates(_0x5f454c[_0xd59e('0x49')],null))[_0xd59e('0x25')](respondWithResult(_0x3dccd6,null))['catch'](handleError(_0x3dccd6,null));};exports[_0xd59e('0x24')]=function(_0x3bf925,_0x53df1e){return db['Automation'][_0xd59e('0x46')]({'where':{'id':_0x3bf925['params']['id']}})['then'](handleEntityNotFound(_0x53df1e,null))[_0xd59e('0x25')](removeEntity(_0x53df1e,null))[_0xd59e('0x43')](handleError(_0x53df1e,null));};exports[_0xd59e('0x4a')]=function(_0x19a048,_0x46866a,_0x1d1321){return db[_0xd59e('0x4b')][_0xd59e('0x46')]({'where':{'id':_0x19a048['params']['id']}})[_0xd59e('0x25')](handleEntityNotFound(_0x46866a,null))[_0xd59e('0x25')](function(_0x241f5a){if(_0x241f5a){return _0x241f5a[_0xd59e('0x4a')](_0x19a048[_0xd59e('0x49')][_0xd59e('0x4c')],_[_0xd59e('0x4d')](_0x19a048[_0xd59e('0x49')],[_0xd59e('0x4c'),'id'])||{});}})[_0xd59e('0x25')](respondWithResult(_0x46866a,null))[_0xd59e('0x43')](handleError(_0x46866a,null));};exports[_0xd59e('0x4e')]=function(_0x2fab32,_0x3bab65,_0x92c425){var _0xa03912={};var _0x1d6961={};var _0x181ab5;var _0x47edf0;return db[_0xd59e('0x29')][_0xd59e('0x4f')]({'where':{'id':_0x2fab32[_0xd59e('0x45')]['id']}})[_0xd59e('0x25')](handleEntityNotFound(_0x3bab65,null))[_0xd59e('0x25')](function(_0x1ff224){if(_0x1ff224){_0x181ab5=_0x1ff224;_0x1d6961[_0xd59e('0x2e')]=_[_0xd59e('0x31')](db[_0xd59e('0x4b')][_0xd59e('0x2a')]);_0x1d6961['query']=_[_0xd59e('0x31')](_0x2fab32['query']);_0x1d6961[_0xd59e('0x32')]=_['intersection'](_0x1d6961[_0xd59e('0x2e')],_0x1d6961[_0xd59e('0x30')]);_0xa03912[_0xd59e('0x34')]=_[_0xd59e('0x33')](_0x1d6961[_0xd59e('0x2e')],qs[_0xd59e('0x35')](_0x2fab32['query']['fields']));_0xa03912[_0xd59e('0x34')]=_0xa03912[_0xd59e('0x34')][_0xd59e('0x36')]?_0xa03912[_0xd59e('0x34')]:_0x1d6961[_0xd59e('0x2e')];_0xa03912[_0xd59e('0x39')]=qs[_0xd59e('0x3a')](_0x2fab32['query']['sort']);_0xa03912[_0xd59e('0x3b')]=qs[_0xd59e('0x32')](_[_0xd59e('0x3c')](_0x2fab32['query'],_0x1d6961['filters']));if(_0x2fab32[_0xd59e('0x30')][_0xd59e('0x3e')]){_0xa03912[_0xd59e('0x3b')]=_[_0xd59e('0x3d')](_0xa03912[_0xd59e('0x3b')],{'$or':_[_0xd59e('0x28')](_0xa03912[_0xd59e('0x34')],function(_0x4066be){var _0x161b2d={};_0x161b2d[_0x4066be]={'$like':'%'+_0x2fab32[_0xd59e('0x30')][_0xd59e('0x3e')]+'%'};return _0x161b2d;})});}_0xa03912=_[_0xd59e('0x3d')]({},_0xa03912,_0x2fab32[_0xd59e('0x3f')]);return _0x181ab5[_0xd59e('0x4e')](_0xa03912);}})[_0xd59e('0x25')](function(_0x355bbe){if(_0x355bbe){_0x47edf0=_0x355bbe[_0xd59e('0x36')];if(!_0x2fab32[_0xd59e('0x30')][_0xd59e('0x37')](_0xd59e('0x38'))){_0xa03912['limit']=qs[_0xd59e('0x1d')](_0x2fab32[_0xd59e('0x30')][_0xd59e('0x1d')]);_0xa03912[_0xd59e('0x1b')]=qs[_0xd59e('0x1b')](_0x2fab32[_0xd59e('0x30')][_0xd59e('0x1b')]);}return _0x181ab5[_0xd59e('0x4e')](_0xa03912);}})['then'](function(_0x152009){if(_0x152009){return _0x152009?{'count':_0x47edf0,'rows':_0x152009}:null;}})['then'](respondWithResult(_0x3bab65,null))[_0xd59e('0x43')](handleError(_0x3bab65,null));};exports[_0xd59e('0x50')]=function(_0x4b8264,_0x4d0d54,_0x9de6f){return db[_0xd59e('0x51')][_0xd59e('0x46')]({'where':{'id':_0x4b8264[_0xd59e('0x45')]['id']}})[_0xd59e('0x25')](handleEntityNotFound(_0x4d0d54,null))[_0xd59e('0x25')](function(_0x669211){if(_0x669211){return _0x669211['addActions'](_0x4b8264[_0xd59e('0x49')][_0xd59e('0x4c')],_[_0xd59e('0x4d')](_0x4b8264[_0xd59e('0x49')],[_0xd59e('0x4c'),'id'])||{});}})[_0xd59e('0x25')](respondWithResult(_0x4d0d54,null))[_0xd59e('0x43')](handleError(_0x4d0d54,null));};exports[_0xd59e('0x52')]=function(_0x16b5d4,_0x38f4db,_0xf8bbfd){var _0x23c5e4={};var _0x2f568d={};var _0x13f3e5;var _0xbabdcd;return db[_0xd59e('0x29')]['findOne']({'where':{'id':_0x16b5d4['params']['id']}})[_0xd59e('0x25')](handleEntityNotFound(_0x38f4db,null))[_0xd59e('0x25')](function(_0x457cb8){if(_0x457cb8){_0x13f3e5=_0x457cb8;_0x2f568d[_0xd59e('0x2e')]=_[_0xd59e('0x31')](db[_0xd59e('0x51')]['rawAttributes']);_0x2f568d[_0xd59e('0x30')]=_[_0xd59e('0x31')](_0x16b5d4['query']);_0x2f568d[_0xd59e('0x32')]=_[_0xd59e('0x33')](_0x2f568d[_0xd59e('0x2e')],_0x2f568d['query']);_0x23c5e4[_0xd59e('0x34')]=_[_0xd59e('0x33')](_0x2f568d['model'],qs[_0xd59e('0x35')](_0x16b5d4[_0xd59e('0x30')][_0xd59e('0x35')]));_0x23c5e4['attributes']=_0x23c5e4[_0xd59e('0x34')][_0xd59e('0x36')]?_0x23c5e4['attributes']:_0x2f568d[_0xd59e('0x2e')];_0x23c5e4[_0xd59e('0x39')]=qs[_0xd59e('0x3a')](_0x16b5d4[_0xd59e('0x30')][_0xd59e('0x3a')]);_0x23c5e4[_0xd59e('0x3b')]=qs[_0xd59e('0x32')](_[_0xd59e('0x3c')](_0x16b5d4['query'],_0x2f568d[_0xd59e('0x32')]));if(_0x16b5d4[_0xd59e('0x30')][_0xd59e('0x3e')]){_0x23c5e4[_0xd59e('0x3b')]=_[_0xd59e('0x3d')](_0x23c5e4[_0xd59e('0x3b')],{'$or':_['map'](_0x23c5e4[_0xd59e('0x34')],function(_0x1803fd){var _0x5491cb={};_0x5491cb[_0x1803fd]={'$like':'%'+_0x16b5d4[_0xd59e('0x30')]['filter']+'%'};return _0x5491cb;})});}_0x23c5e4=_[_0xd59e('0x3d')]({},_0x23c5e4,_0x16b5d4[_0xd59e('0x3f')]);return _0x13f3e5[_0xd59e('0x52')](_0x23c5e4);}})[_0xd59e('0x25')](function(_0x41a21a){if(_0x41a21a){_0xbabdcd=_0x41a21a[_0xd59e('0x36')];if(!_0x16b5d4[_0xd59e('0x30')][_0xd59e('0x37')](_0xd59e('0x38'))){_0x23c5e4['limit']=qs['limit'](_0x16b5d4['query'][_0xd59e('0x1d')]);_0x23c5e4[_0xd59e('0x1b')]=qs[_0xd59e('0x1b')](_0x16b5d4[_0xd59e('0x30')][_0xd59e('0x1b')]);}return _0x13f3e5[_0xd59e('0x52')](_0x23c5e4);}})['then'](function(_0x2a6785){if(_0x2a6785){return _0x2a6785?{'count':_0xbabdcd,'rows':_0x2a6785}:null;}})[_0xd59e('0x25')](respondWithResult(_0x38f4db,null))['catch'](handleError(_0x38f4db,null));};
\ No newline at end of file
+var _0xa7b9=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','Automation','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','query','keys','filters'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa7b9,0x76));var _0x9a7b=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0xa7b9[_0xcbe787];return _0x4c78fa;};'use strict';var emlformat=require(_0x9a7b('0x0'));var rimraf=require(_0x9a7b('0x1'));var zipdir=require(_0x9a7b('0x2'));var jsonpatch=require(_0x9a7b('0x3'));var rp=require(_0x9a7b('0x4'));var moment=require('moment');var BPromise=require(_0x9a7b('0x5'));var Mustache=require('mustache');var util=require(_0x9a7b('0x6'));var path=require(_0x9a7b('0x7'));var sox=require(_0x9a7b('0x8'));var csv=require(_0x9a7b('0x9'));var ejs=require(_0x9a7b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a7b('0xb'));var _=require(_0x9a7b('0xc'));var squel=require(_0x9a7b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a7b('0x9'));var querystring=require(_0x9a7b('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a7b('0xf'));var authService=require(_0x9a7b('0x10'));var qs=require(_0x9a7b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a7b('0x12'))(_0x9a7b('0x13'));var utils=require('../../config/utils');var config=require(_0x9a7b('0x14'));var licenseUtil=require(_0x9a7b('0x15'));var db=require(_0x9a7b('0x16'))['db'];function respondWithStatusCode(_0x246718,_0x358893){_0x358893=_0x358893||0xcc;return function(_0x5d9e7b){if(_0x5d9e7b){return _0x246718['sendStatus'](_0x358893);}return _0x246718[_0x9a7b('0x17')](_0x358893)[_0x9a7b('0x18')]();};}function respondWithResult(_0x2bf0fd,_0xf22471){_0xf22471=_0xf22471||0xc8;return function(_0x110460){if(_0x110460){return _0x2bf0fd[_0x9a7b('0x17')](_0xf22471)[_0x9a7b('0x19')](_0x110460);}};}function respondWithFilteredResult(_0x3a9d4f,_0x55a284){return function(_0x56c9ad){if(_0x56c9ad){var _0x504b8c=typeof _0x55a284[_0x9a7b('0x1a')]==='undefined'&&typeof _0x55a284['limit']===_0x9a7b('0x1b');var _0x58b03a=_0x56c9ad['count'];var _0x4da0c4=_0x504b8c?0x0:_0x55a284[_0x9a7b('0x1a')];var _0x193f74=_0x504b8c?_0x56c9ad[_0x9a7b('0x1c')]:_0x55a284['offset']+_0x55a284[_0x9a7b('0x1d')];var _0x5e6777;if(_0x193f74>=_0x58b03a){_0x193f74=_0x58b03a;_0x5e6777=0xc8;}else{_0x5e6777=0xce;}_0x3a9d4f['status'](_0x5e6777);return _0x3a9d4f[_0x9a7b('0x1e')](_0x9a7b('0x1f'),_0x4da0c4+'-'+_0x193f74+'/'+_0x58b03a)[_0x9a7b('0x19')](_0x56c9ad);}return null;};}function patchUpdates(_0x2469ad){return function(_0x514fd9){try{jsonpatch[_0x9a7b('0x20')](_0x514fd9,_0x2469ad,!![]);}catch(_0x6ef3e1){return BPromise['reject'](_0x6ef3e1);}return _0x514fd9['save']();};}function saveUpdates(_0x260066,_0x2cd90d){return function(_0x5f2ace){if(_0x5f2ace){return _0x5f2ace[_0x9a7b('0x21')](_0x260066)[_0x9a7b('0x22')](function(_0x498fa9){return _0x498fa9;});}return null;};}function removeEntity(_0x522fe2,_0x5f1f28){return function(_0x2b42cc){if(_0x2b42cc){return _0x2b42cc[_0x9a7b('0x23')]()[_0x9a7b('0x22')](function(){_0x522fe2['status'](0xcc)[_0x9a7b('0x18')]();});}};}function handleEntityNotFound(_0x51aa23,_0x941cd9){return function(_0x318552){if(!_0x318552){_0x51aa23[_0x9a7b('0x24')](0x194);}return _0x318552;};}function handleError(_0x4eb5f6,_0x43ad1e){_0x43ad1e=_0x43ad1e||0x1f4;return function(_0x50bc1c){logger[_0x9a7b('0x25')](_0x50bc1c['stack']);if(_0x50bc1c[_0x9a7b('0x26')]){delete _0x50bc1c[_0x9a7b('0x26')];}_0x4eb5f6[_0x9a7b('0x17')](_0x43ad1e)[_0x9a7b('0x27')](_0x50bc1c);};}exports[_0x9a7b('0x28')]=function(_0x2fbf11,_0x52e4c6){var _0xced8e8={},_0xfcb437={},_0x52e57c={'count':0x0,'rows':[]};var _0x940d87=_[_0x9a7b('0x29')](db['Automation']['rawAttributes'],function(_0x3f4980){return{'name':_0x3f4980[_0x9a7b('0x2a')],'type':_0x3f4980[_0x9a7b('0x2b')][_0x9a7b('0x2c')]};});_0xfcb437['model']=_[_0x9a7b('0x29')](_0x940d87,_0x9a7b('0x26'));_0xfcb437[_0x9a7b('0x2d')]=_[_0x9a7b('0x2e')](_0x2fbf11[_0x9a7b('0x2d')]);_0xfcb437[_0x9a7b('0x2f')]=_[_0x9a7b('0x30')](_0xfcb437[_0x9a7b('0x31')],_0xfcb437[_0x9a7b('0x2d')]);_0xced8e8[_0x9a7b('0x32')]=_['intersection'](_0xfcb437[_0x9a7b('0x31')],qs[_0x9a7b('0x33')](_0x2fbf11[_0x9a7b('0x2d')][_0x9a7b('0x33')]));_0xced8e8[_0x9a7b('0x32')]=_0xced8e8[_0x9a7b('0x32')][_0x9a7b('0x34')]?_0xced8e8[_0x9a7b('0x32')]:_0xfcb437[_0x9a7b('0x31')];if(!_0x2fbf11[_0x9a7b('0x2d')][_0x9a7b('0x35')]('nolimit')){_0xced8e8['limit']=qs['limit'](_0x2fbf11[_0x9a7b('0x2d')]['limit']);_0xced8e8[_0x9a7b('0x1a')]=qs[_0x9a7b('0x1a')](_0x2fbf11[_0x9a7b('0x2d')][_0x9a7b('0x1a')]);}_0xced8e8[_0x9a7b('0x36')]=qs[_0x9a7b('0x37')](_0x2fbf11['query'][_0x9a7b('0x37')]);_0xced8e8['where']=qs[_0x9a7b('0x2f')](_[_0x9a7b('0x38')](_0x2fbf11[_0x9a7b('0x2d')],_0xfcb437[_0x9a7b('0x2f')]),_0x940d87);if(_0x2fbf11[_0x9a7b('0x2d')]['filter']){_0xced8e8[_0x9a7b('0x39')]=_[_0x9a7b('0x3a')](_0xced8e8[_0x9a7b('0x39')],{'$or':_[_0x9a7b('0x29')](_0x940d87,function(_0x4e5beb){if(_0x4e5beb[_0x9a7b('0x2b')]!==_0x9a7b('0x3b')){var _0x448511={};_0x448511[_0x4e5beb[_0x9a7b('0x26')]]={'$like':'%'+_0x2fbf11[_0x9a7b('0x2d')][_0x9a7b('0x3c')]+'%'};return _0x448511;}})});}_0xced8e8=_[_0x9a7b('0x3a')]({},_0xced8e8,_0x2fbf11['options']);var _0x1841ef={'where':_0xced8e8['where']};return db[_0x9a7b('0x3d')][_0x9a7b('0x1c')](_0x1841ef)[_0x9a7b('0x22')](function(_0x8c8f7b){_0x52e57c[_0x9a7b('0x1c')]=_0x8c8f7b;if(_0x2fbf11[_0x9a7b('0x2d')][_0x9a7b('0x3e')]){_0xced8e8[_0x9a7b('0x3f')]=[{'all':!![]}];}return db[_0x9a7b('0x3d')][_0x9a7b('0x40')](_0xced8e8);})[_0x9a7b('0x22')](function(_0x5f35a3){_0x52e57c['rows']=_0x5f35a3;return _0x52e57c;})['then'](respondWithFilteredResult(_0x52e4c6,_0xced8e8))[_0x9a7b('0x41')](handleError(_0x52e4c6,null));};exports[_0x9a7b('0x42')]=function(_0x286056,_0x4160d5){var _0x172238={'raw':![],'where':{'id':_0x286056[_0x9a7b('0x43')]['id']}},_0x3f6939={};_0x3f6939[_0x9a7b('0x31')]=_['keys'](db[_0x9a7b('0x3d')][_0x9a7b('0x44')]);_0x3f6939[_0x9a7b('0x2d')]=_[_0x9a7b('0x2e')](_0x286056['query']);_0x3f6939['filters']=_[_0x9a7b('0x30')](_0x3f6939[_0x9a7b('0x31')],_0x3f6939['query']);_0x172238[_0x9a7b('0x32')]=_[_0x9a7b('0x30')](_0x3f6939[_0x9a7b('0x31')],qs['fields'](_0x286056[_0x9a7b('0x2d')][_0x9a7b('0x33')]));_0x172238['attributes']=_0x172238['attributes'][_0x9a7b('0x34')]?_0x172238[_0x9a7b('0x32')]:_0x3f6939[_0x9a7b('0x31')];if(_0x286056[_0x9a7b('0x2d')]['includeAll']){_0x172238['include']=[{'all':!![]}];}_0x172238=_[_0x9a7b('0x3a')]({},_0x172238,_0x286056[_0x9a7b('0x45')]);return db[_0x9a7b('0x3d')][_0x9a7b('0x46')](_0x172238)['then'](handleEntityNotFound(_0x4160d5,null))[_0x9a7b('0x22')](respondWithResult(_0x4160d5,null))[_0x9a7b('0x41')](handleError(_0x4160d5,null));};exports[_0x9a7b('0x47')]=function(_0x3f9b92,_0x31fefb){return db[_0x9a7b('0x3d')][_0x9a7b('0x47')](_0x3f9b92[_0x9a7b('0x48')],{})['then'](respondWithResult(_0x31fefb,0xc9))['catch'](handleError(_0x31fefb,null));};exports[_0x9a7b('0x21')]=function(_0x155b47,_0x38f832){if(_0x155b47[_0x9a7b('0x48')]['id']){delete _0x155b47['body']['id'];}return db[_0x9a7b('0x3d')][_0x9a7b('0x46')]({'where':{'id':_0x155b47[_0x9a7b('0x43')]['id']}})[_0x9a7b('0x22')](handleEntityNotFound(_0x38f832,null))[_0x9a7b('0x22')](saveUpdates(_0x155b47[_0x9a7b('0x48')],null))[_0x9a7b('0x22')](respondWithResult(_0x38f832,null))[_0x9a7b('0x41')](handleError(_0x38f832,null));};exports[_0x9a7b('0x23')]=function(_0x423c01,_0x4d6e88){return db[_0x9a7b('0x3d')]['find']({'where':{'id':_0x423c01[_0x9a7b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d6e88,null))['then'](removeEntity(_0x4d6e88,null))[_0x9a7b('0x41')](handleError(_0x4d6e88,null));};exports[_0x9a7b('0x49')]=function(_0x3206e9,_0x3318fd,_0x31d338){return db[_0x9a7b('0x4a')][_0x9a7b('0x46')]({'where':{'id':_0x3206e9['params']['id']}})['then'](handleEntityNotFound(_0x3318fd,null))['then'](function(_0x4b8a17){if(_0x4b8a17){return _0x4b8a17[_0x9a7b('0x49')](_0x3206e9[_0x9a7b('0x48')][_0x9a7b('0x4b')],_[_0x9a7b('0x4c')](_0x3206e9[_0x9a7b('0x48')],[_0x9a7b('0x4b'),'id'])||{});}})[_0x9a7b('0x22')](respondWithResult(_0x3318fd,null))[_0x9a7b('0x41')](handleError(_0x3318fd,null));};exports[_0x9a7b('0x4d')]=function(_0x1b121b,_0x41699a,_0x48a75d){var _0x173059={};var _0x283dde={};var _0x2a6616;var _0x4b7d7a;return db[_0x9a7b('0x3d')][_0x9a7b('0x4e')]({'where':{'id':_0x1b121b[_0x9a7b('0x43')]['id']}})[_0x9a7b('0x22')](handleEntityNotFound(_0x41699a,null))[_0x9a7b('0x22')](function(_0x4ea1db){if(_0x4ea1db){_0x2a6616=_0x4ea1db;_0x283dde[_0x9a7b('0x31')]=_['keys'](db[_0x9a7b('0x4a')]['rawAttributes']);_0x283dde[_0x9a7b('0x2d')]=_[_0x9a7b('0x2e')](_0x1b121b[_0x9a7b('0x2d')]);_0x283dde['filters']=_['intersection'](_0x283dde[_0x9a7b('0x31')],_0x283dde['query']);_0x173059[_0x9a7b('0x32')]=_['intersection'](_0x283dde[_0x9a7b('0x31')],qs[_0x9a7b('0x33')](_0x1b121b[_0x9a7b('0x2d')][_0x9a7b('0x33')]));_0x173059[_0x9a7b('0x32')]=_0x173059['attributes']['length']?_0x173059[_0x9a7b('0x32')]:_0x283dde[_0x9a7b('0x31')];_0x173059['order']=qs[_0x9a7b('0x37')](_0x1b121b[_0x9a7b('0x2d')][_0x9a7b('0x37')]);_0x173059[_0x9a7b('0x39')]=qs[_0x9a7b('0x2f')](_[_0x9a7b('0x38')](_0x1b121b['query'],_0x283dde[_0x9a7b('0x2f')]));if(_0x1b121b[_0x9a7b('0x2d')][_0x9a7b('0x3c')]){_0x173059[_0x9a7b('0x39')]=_[_0x9a7b('0x3a')](_0x173059[_0x9a7b('0x39')],{'$or':_['map'](_0x173059[_0x9a7b('0x32')],function(_0x295a7a){var _0x46effe={};_0x46effe[_0x295a7a]={'$like':'%'+_0x1b121b[_0x9a7b('0x2d')][_0x9a7b('0x3c')]+'%'};return _0x46effe;})});}_0x173059=_[_0x9a7b('0x3a')]({},_0x173059,_0x1b121b[_0x9a7b('0x45')]);return _0x2a6616[_0x9a7b('0x4d')](_0x173059);}})['then'](function(_0x2373f7){if(_0x2373f7){_0x4b7d7a=_0x2373f7[_0x9a7b('0x34')];if(!_0x1b121b['query'][_0x9a7b('0x35')](_0x9a7b('0x4f'))){_0x173059[_0x9a7b('0x1d')]=qs['limit'](_0x1b121b[_0x9a7b('0x2d')]['limit']);_0x173059[_0x9a7b('0x1a')]=qs[_0x9a7b('0x1a')](_0x1b121b[_0x9a7b('0x2d')]['offset']);}return _0x2a6616[_0x9a7b('0x4d')](_0x173059);}})['then'](function(_0x44baff){if(_0x44baff){return _0x44baff?{'count':_0x4b7d7a,'rows':_0x44baff}:null;}})['then'](respondWithResult(_0x41699a,null))[_0x9a7b('0x41')](handleError(_0x41699a,null));};exports[_0x9a7b('0x50')]=function(_0x565115,_0x17cbec,_0x15257f){return db[_0x9a7b('0x51')]['find']({'where':{'id':_0x565115[_0x9a7b('0x43')]['id']}})['then'](handleEntityNotFound(_0x17cbec,null))[_0x9a7b('0x22')](function(_0x2089fa){if(_0x2089fa){return _0x2089fa[_0x9a7b('0x50')](_0x565115[_0x9a7b('0x48')][_0x9a7b('0x4b')],_[_0x9a7b('0x4c')](_0x565115[_0x9a7b('0x48')],[_0x9a7b('0x4b'),'id'])||{});}})[_0x9a7b('0x22')](respondWithResult(_0x17cbec,null))[_0x9a7b('0x41')](handleError(_0x17cbec,null));};exports[_0x9a7b('0x52')]=function(_0x5ce570,_0x59fa10,_0x3f69fd){var _0x284116={};var _0xf8e5d9={};var _0x3b0c99;var _0x555998;return db['Automation'][_0x9a7b('0x4e')]({'where':{'id':_0x5ce570[_0x9a7b('0x43')]['id']}})['then'](handleEntityNotFound(_0x59fa10,null))[_0x9a7b('0x22')](function(_0x351fe4){if(_0x351fe4){_0x3b0c99=_0x351fe4;_0xf8e5d9[_0x9a7b('0x31')]=_[_0x9a7b('0x2e')](db[_0x9a7b('0x51')][_0x9a7b('0x44')]);_0xf8e5d9[_0x9a7b('0x2d')]=_[_0x9a7b('0x2e')](_0x5ce570[_0x9a7b('0x2d')]);_0xf8e5d9['filters']=_[_0x9a7b('0x30')](_0xf8e5d9['model'],_0xf8e5d9[_0x9a7b('0x2d')]);_0x284116[_0x9a7b('0x32')]=_['intersection'](_0xf8e5d9[_0x9a7b('0x31')],qs['fields'](_0x5ce570[_0x9a7b('0x2d')][_0x9a7b('0x33')]));_0x284116['attributes']=_0x284116[_0x9a7b('0x32')][_0x9a7b('0x34')]?_0x284116[_0x9a7b('0x32')]:_0xf8e5d9[_0x9a7b('0x31')];_0x284116[_0x9a7b('0x36')]=qs[_0x9a7b('0x37')](_0x5ce570['query'][_0x9a7b('0x37')]);_0x284116[_0x9a7b('0x39')]=qs[_0x9a7b('0x2f')](_['pick'](_0x5ce570[_0x9a7b('0x2d')],_0xf8e5d9['filters']));if(_0x5ce570[_0x9a7b('0x2d')]['filter']){_0x284116['where']=_[_0x9a7b('0x3a')](_0x284116[_0x9a7b('0x39')],{'$or':_['map'](_0x284116[_0x9a7b('0x32')],function(_0x4e1381){var _0x4f5dd2={};_0x4f5dd2[_0x4e1381]={'$like':'%'+_0x5ce570[_0x9a7b('0x2d')][_0x9a7b('0x3c')]+'%'};return _0x4f5dd2;})});}_0x284116=_[_0x9a7b('0x3a')]({},_0x284116,_0x5ce570[_0x9a7b('0x45')]);return _0x3b0c99['getActions'](_0x284116);}})['then'](function(_0xc2d694){if(_0xc2d694){_0x555998=_0xc2d694[_0x9a7b('0x34')];if(!_0x5ce570[_0x9a7b('0x2d')][_0x9a7b('0x35')](_0x9a7b('0x4f'))){_0x284116[_0x9a7b('0x1d')]=qs[_0x9a7b('0x1d')](_0x5ce570[_0x9a7b('0x2d')][_0x9a7b('0x1d')]);_0x284116[_0x9a7b('0x1a')]=qs[_0x9a7b('0x1a')](_0x5ce570[_0x9a7b('0x2d')][_0x9a7b('0x1a')]);}return _0x3b0c99['getActions'](_0x284116);}})[_0x9a7b('0x22')](function(_0x1af15f){if(_0x1af15f){return _0x1af15f?{'count':_0x555998,'rows':_0x1af15f}:null;}})['then'](respondWithResult(_0x59fa10,null))[_0x9a7b('0x41')](handleError(_0x59fa10,null));};
\ No newline at end of file
index 68df583..07d2304 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49e8=['lodash','util','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x4dab41,_0x3a0c5c){var _0xe31cde=function(_0x3f223d){while(--_0x3f223d){_0x4dab41['push'](_0x4dab41['shift']());}};_0xe31cde(++_0x3a0c5c);}(_0x49e8,0x105));var _0x849e=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x49e8[_0x16539a];return _0x200796;};'use strict';var _=require(_0x849e('0x0'));var util=require(_0x849e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x849e('0x2'));var config=require(_0x849e('0x3'));var attributes=require(_0x849e('0x4'));module[_0x849e('0x5')]=function(_0x4a823a,_0x2df9f3){return _0x4a823a[_0x849e('0x6')](_0x849e('0x7'),attributes,{'tableName':_0x849e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7619=['exports','define','Automation','tools_automations','util','../../config/logger','bluebird','request-promise','path','./automation.attributes'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x7619,0xb8));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9761('0x0'));var logger=require(_0x9761('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9761('0x2'));var rp=require(_0x9761('0x3'));var fs=require('fs');var path=require(_0x9761('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9761('0x5'));module[_0x9761('0x6')]=function(_0x335c73,_0x188d11){return _0x335c73[_0x9761('0x7')](_0x9761('0x8'),attributes,{'tableName':_0x9761('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9646313..6889f8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30fc=['Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x417a08,_0x13f6a5){var _0x245b2e=function(_0x30675f){while(--_0x30675f){_0x417a08['push'](_0x417a08['shift']());}};_0x245b2e(++_0x13f6a5);}(_0x30fc,0x64));var _0xc30f=function(_0x4c6e4a,_0x263ab8){_0x4c6e4a=_0x4c6e4a-0x0;var _0x3d69f4=_0x30fc[_0x4c6e4a];return _0x3d69f4;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require('moment');var BPromise=require(_0xc30f('0x2'));var rs=require(_0xc30f('0x3'));var fs=require('fs');var Redis=require(_0xc30f('0x4'));var db=require(_0xc30f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc30f('0x6'))(_0xc30f('0x7'));var config=require(_0xc30f('0x8'));var jayson=require(_0xc30f('0x9'));var client=jayson[_0xc30f('0xa')][_0xc30f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c174,_0x23528c,_0x325a64){return new BPromise(function(_0x33a769,_0x3d2167){return client[_0xc30f('0xc')](_0x54c174,_0x325a64)[_0xc30f('0xd')](function(_0x436059){logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,'request\x20sent');logger[_0xc30f('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x23528c,_0xc30f('0x11'),JSON[_0xc30f('0x12')](_0x436059));if(_0x436059[_0xc30f('0x13')]){if(_0x436059[_0xc30f('0x13')][_0xc30f('0x14')]===0x1f4){logger[_0xc30f('0x13')]('Automation,\x20%s,\x20%s',_0x23528c,_0x436059['error'][_0xc30f('0x15')]);return _0x3d2167(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}logger[_0xc30f('0x13')]('Automation,\x20%s,\x20%s',_0x23528c,_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);return _0x33a769(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}else{logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,_0xc30f('0x11'));_0x33a769(_0x436059['result']['message']);}})[_0xc30f('0x16')](function(_0x1b02c5){logger[_0xc30f('0x13')](_0xc30f('0xf'),_0x23528c,_0x1b02c5);_0x3d2167(_0x1b02c5);});});}
\ No newline at end of file
+var _0x6337=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s'];(function(_0x30e1cd,_0x445ae0){var _0x5cb403=function(_0x53021e){while(--_0x53021e){_0x30e1cd['push'](_0x30e1cd['shift']());}};_0x5cb403(++_0x445ae0);}(_0x6337,0x18a));var _0x7633=function(_0x155495,_0x1e6e63){_0x155495=_0x155495-0x0;var _0x5813f4=_0x6337[_0x155495];return _0x5813f4;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var moment=require(_0x7633('0x1'));var BPromise=require(_0x7633('0x2'));var rs=require(_0x7633('0x3'));var fs=require('fs');var Redis=require(_0x7633('0x4'));var db=require(_0x7633('0x5'))['db'];var utils=require(_0x7633('0x6'));var logger=require(_0x7633('0x7'))(_0x7633('0x8'));var config=require('../../config/environment');var jayson=require(_0x7633('0x9'));var client=jayson[_0x7633('0xa')][_0x7633('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539d69,_0x1fee41,_0x4b9491){return new BPromise(function(_0x27baac,_0x14742c){return client['request'](_0x539d69,_0x4b9491)[_0x7633('0xc')](function(_0x547874){logger[_0x7633('0xd')]('Automation,\x20%s,\x20%s',_0x1fee41,_0x7633('0xe'));logger[_0x7633('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x1fee41,_0x7633('0xe'),JSON[_0x7633('0x10')](_0x547874));if(_0x547874[_0x7633('0x11')]){if(_0x547874['error'][_0x7633('0x12')]===0x1f4){logger[_0x7633('0x11')](_0x7633('0x13'),_0x1fee41,_0x547874['error'][_0x7633('0x14')]);return _0x14742c(_0x547874[_0x7633('0x11')][_0x7633('0x14')]);}logger['error']('Automation,\x20%s,\x20%s',_0x1fee41,_0x547874['error'][_0x7633('0x14')]);return _0x27baac(_0x547874[_0x7633('0x11')][_0x7633('0x14')]);}else{logger[_0x7633('0xd')](_0x7633('0x13'),_0x1fee41,_0x7633('0xe'));_0x27baac(_0x547874[_0x7633('0x15')][_0x7633('0x14')]);}})[_0x7633('0x16')](function(_0x5cbd62){logger[_0x7633('0x11')](_0x7633('0x13'),_0x1fee41,_0x5cbd62);_0x14742c(_0x5cbd62);});});}
\ No newline at end of file
index 8475518..d815e1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8137=['index','/:id','show','/:id/actions','post','/:id/conditions','addConditions','put','update','delete','destroy','multer','Router','fs-extra','get','isAuthenticated'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x8137,0x16b));var _0x7813=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x8137[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x7813('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7813('0x1')]();var fs_extra=require(_0x7813('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x7813('0x3')]('/',auth[_0x7813('0x4')](),controller[_0x7813('0x5')]);router[_0x7813('0x3')](_0x7813('0x6'),auth[_0x7813('0x4')](),controller[_0x7813('0x7')]);router[_0x7813('0x3')]('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0x7813('0x3')](_0x7813('0x8'),auth[_0x7813('0x4')](),controller['getActions']);router[_0x7813('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7813('0xa'),auth['isAuthenticated'](),controller[_0x7813('0xb')]);router[_0x7813('0x9')](_0x7813('0x8'),auth[_0x7813('0x4')](),controller['addActions']);router[_0x7813('0xc')](_0x7813('0x6'),auth[_0x7813('0x4')](),controller[_0x7813('0xd')]);router[_0x7813('0xe')](_0x7813('0x6'),auth[_0x7813('0x4')](),controller[_0x7813('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0x8a9c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','addConditions','/:id/actions','addActions','put','delete','destroy'];(function(_0x138d8e,_0x5752b3){var _0x3f1bd8=function(_0x23ff61){while(--_0x23ff61){_0x138d8e['push'](_0x138d8e['shift']());}};_0x3f1bd8(++_0x5752b3);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var path=require(_0xc8a9('0x2'));var timeout=require(_0xc8a9('0x3'));var express=require(_0xc8a9('0x4'));var router=express['Router']();var fs_extra=require(_0xc8a9('0x5'));var auth=require(_0xc8a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8a9('0x7'));var controller=require(_0xc8a9('0x8'));router[_0xc8a9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8a9('0xa')]);router[_0xc8a9('0x9')](_0xc8a9('0xb'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0xd')]);router[_0xc8a9('0x9')](_0xc8a9('0xe'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0xf')]);router['get']('/:id/actions',auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x10')]);router['post']('/',auth[_0xc8a9('0xc')](),controller['create']);router[_0xc8a9('0x11')](_0xc8a9('0xe'),auth['isAuthenticated'](),controller[_0xc8a9('0x12')]);router['post'](_0xc8a9('0x13'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x14')]);router[_0xc8a9('0x15')](_0xc8a9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc8a9('0x16')]('/:id',auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x17')]);module[_0xc8a9('0x18')]=router;
\ No newline at end of file
index 5aab8ef..448b058 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7913=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x207532,_0x44ad95){var _0x24eb07=function(_0x1bcca0){while(--_0x1bcca0){_0x207532['push'](_0x207532['shift']());}};_0x24eb07(++_0x44ad95);}(_0x7913,0xe8));var _0x3791=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7913[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3791('0x0'));module[_0x3791('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3791('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x3791('0x3')},'description':{'type':Sequelize[_0x3791('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3791('0x5')},'limitCalls':{'type':Sequelize[_0x3791('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3791('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3791('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3791('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3791('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)[_0x3791('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3791('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3791('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3791('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3791('0xd')},'dialTimezone':{'type':Sequelize[_0x3791('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3791('0x4')],'defaultValue':_0x3791('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x3791('0xf')](_0x3791('0x10'),_0x3791('0x11'),_0x3791('0x12')),'defaultValue':_0x3791('0x10')},'dialAMDActive':{'type':Sequelize[_0x3791('0x13')],'defaultValue':0x0,'comment':_0x3791('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x3791('0x6')](0x9)[_0x3791('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3791('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x3791('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3791('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3791('0x6')](0x9)[_0x3791('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3791('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3791('0x6')](0x9)[_0x3791('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3791('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x3791('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3791('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3791('0x6')](0x9)[_0x3791('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3791('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3791('0x6')](0x9)[_0x3791('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3791('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3791('0x6')](0x5)[_0x3791('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3791('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3791('0x6')](0x9)[_0x3791('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3791('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3791('0xf')](_0x3791('0x1e'),_0x3791('0x1f')),'defaultValue':_0x3791('0x1e')},'dialPrefix':{'type':Sequelize[_0x3791('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3791('0x6')](0x3)[_0x3791('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3791('0x20')},'dialCutDigit':{'type':Sequelize[_0x3791('0x6')](0x3)[_0x3791('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3791('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3791('0x6')](0x3)[_0x3791('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)[_0x3791('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0x22')},'dialDropMaxRetry':{'type':Sequelize[_0x3791('0x6')](0x3)[_0x3791('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)[_0x3791('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3791('0x6')](0x3)[_0x3791('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)[_0x3791('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x3791('0x6')](0x3)[_0x3791('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3791('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3791('0x6')](0x5)[_0x3791('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3791('0x2a')}};
\ No newline at end of file
+var _0xd7bf=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC'];(function(_0x3ff61b,_0xe602a4){var _0x561d5c=function(_0x1c1e3){while(--_0x1c1e3){_0x3ff61b['push'](_0x3ff61b['shift']());}};_0x561d5c(++_0xe602a4);}(_0xd7bf,0x72));var _0xfd7b=function(_0x12262f,_0x395c79){_0x12262f=_0x12262f-0x0;var _0x48ceff=_0xd7bf[_0x12262f];return _0x48ceff;};'use strict';var Sequelize=require('sequelize');module[_0xfd7b('0x0')]={'name':{'type':Sequelize[_0xfd7b('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfd7b('0x2')](_0xfd7b('0x3')),'allowNull':![],'defaultValue':_0xfd7b('0x3')},'description':{'type':Sequelize[_0xfd7b('0x1')]},'active':{'type':Sequelize[_0xfd7b('0x4')],'defaultValue':0x0,'comment':_0xfd7b('0x5')},'limitCalls':{'type':Sequelize[_0xfd7b('0x6')](0x4)[_0xfd7b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfd7b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfd7b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfd7b('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfd7b('0xe')},'dialTimezone':{'type':Sequelize[_0xfd7b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xfd7b('0x2')](_0xfd7b('0xf'),_0xfd7b('0x10'),_0xfd7b('0x11')),'defaultValue':_0xfd7b('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfd7b('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfd7b('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfd7b('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfd7b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfd7b('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xfd7b('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfd7b('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xfd7b('0x2')]('DESC',_0xfd7b('0x18')),'defaultValue':_0xfd7b('0x19')},'dialPrefix':{'type':Sequelize[_0xfd7b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xfd7b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd7b('0x1a')},'dialCutDigit':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd7b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)[_0xfd7b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x22')}};
\ No newline at end of file
index 13a3621..efdf9e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d3d=['removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','sendStatus','error','name','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','merge','omit','updatedAt','createdAt','UserProfileSection','find','UserProfileResource','getHoppers','findOne','CmHopper','findAll','rows','getHopperHistories','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all'];(function(_0x51b5c4,_0x17a3a8){var _0x5d1ad1=function(_0x29347d){while(--_0x29347d){_0x51b5c4['push'](_0x51b5c4['shift']());}};_0x5d1ad1(++_0x17a3a8);}(_0x9d3d,0x96));var _0xd9d3=function(_0x11bd03,_0x47f79e){_0x11bd03=_0x11bd03-0x0;var _0x490615=_0x9d3d[_0x11bd03];return _0x490615;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9d3('0x0'));var zipdir=require(_0xd9d3('0x1'));var jsonpatch=require(_0xd9d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd9d3('0x3'));var Mustache=require(_0xd9d3('0x4'));var util=require(_0xd9d3('0x5'));var path=require(_0xd9d3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9d3('0x7'));var fs=require('fs');var fs_extra=require(_0xd9d3('0x8'));var _=require(_0xd9d3('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9d3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd9d3('0xb'));var querystring=require(_0xd9d3('0xc'));var Papa=require(_0xd9d3('0xd'));var Redis=require(_0xd9d3('0xe'));var authService=require(_0xd9d3('0xf'));var qs=require(_0xd9d3('0x10'));var as=require(_0xd9d3('0x11'));var hardwareService=require(_0xd9d3('0x12'));var logger=require('../../config/logger')(_0xd9d3('0x13'));var utils=require(_0xd9d3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d3('0x15'));var db=require(_0xd9d3('0x16'))['db'];function respondWithStatusCode(_0x3624d0,_0x1448e3){_0x1448e3=_0x1448e3||0xcc;return function(_0x3a7bf4){if(_0x3a7bf4){return _0x3624d0['sendStatus'](_0x1448e3);}return _0x3624d0[_0xd9d3('0x17')](_0x1448e3)[_0xd9d3('0x18')]();};}function respondWithResult(_0x59d448,_0x1823d0){_0x1823d0=_0x1823d0||0xc8;return function(_0x36500a){if(_0x36500a){return _0x59d448[_0xd9d3('0x17')](_0x1823d0)[_0xd9d3('0x19')](_0x36500a);}};}function respondWithFilteredResult(_0x566e19,_0x57c410){return function(_0x1272b3){if(_0x1272b3){var _0x1c3007=typeof _0x57c410['offset']==='undefined'&&typeof _0x57c410[_0xd9d3('0x1a')]===_0xd9d3('0x1b');var _0xffd5d0=_0x1272b3[_0xd9d3('0x1c')];var _0x3569b2=_0x1c3007?0x0:_0x57c410[_0xd9d3('0x1d')];var _0x8c5d5c=_0x1c3007?_0x1272b3['count']:_0x57c410[_0xd9d3('0x1d')]+_0x57c410['limit'];var _0x2425f7;if(_0x8c5d5c>=_0xffd5d0){_0x8c5d5c=_0xffd5d0;_0x2425f7=0xc8;}else{_0x2425f7=0xce;}_0x566e19[_0xd9d3('0x17')](_0x2425f7);return _0x566e19['set'](_0xd9d3('0x1e'),_0x3569b2+'-'+_0x8c5d5c+'/'+_0xffd5d0)[_0xd9d3('0x19')](_0x1272b3);}return null;};}function patchUpdates(_0x4ea46d){return function(_0x5b9091){try{jsonpatch[_0xd9d3('0x1f')](_0x5b9091,_0x4ea46d,!![]);}catch(_0x2d0b81){return BPromise[_0xd9d3('0x20')](_0x2d0b81);}return _0x5b9091[_0xd9d3('0x21')]();};}function saveUpdates(_0x5d1299,_0x3ecf5b){return function(_0x4473f5){if(_0x4473f5){return _0x4473f5[_0xd9d3('0x22')](_0x5d1299)['then'](function(_0x568e4d){return _0x568e4d;});}return null;};}function removeEntity(_0x588629,_0x30d0be){return function(_0x1673dc){if(_0x1673dc){return _0x1673dc[_0xd9d3('0x23')]()[_0xd9d3('0x24')](function(){var _0x2639bc=_0x1673dc[_0xd9d3('0x25')]({'plain':!![]});var _0x218fec='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x218fec,'resourceId':_0x2639bc['id']}})['then'](function(){return _0x1673dc;});})[_0xd9d3('0x24')](function(){_0x588629[_0xd9d3('0x17')](0xcc)[_0xd9d3('0x18')]();});}};}function handleEntityNotFound(_0x334956,_0x159f20){return function(_0x5356c9){if(!_0x5356c9){_0x334956[_0xd9d3('0x26')](0x194);}return _0x5356c9;};}function handleError(_0xaf8c,_0x2f3699){_0x2f3699=_0x2f3699||0x1f4;return function(_0x5ef35a){logger[_0xd9d3('0x27')](_0x5ef35a['stack']);if(_0x5ef35a[_0xd9d3('0x28')]){delete _0x5ef35a[_0xd9d3('0x28')];}_0xaf8c[_0xd9d3('0x17')](_0x2f3699)['send'](_0x5ef35a);};}exports['index']=function(_0x4f3b3e,_0x3f8dc4){var _0x4fee87={},_0x3021f9={},_0x10c3b5={'count':0x0,'rows':[]};var _0x267083=_[_0xd9d3('0x29')](db[_0xd9d3('0x2a')][_0xd9d3('0x2b')],function(_0x2eeac3){return{'name':_0x2eeac3[_0xd9d3('0x2c')],'type':_0x2eeac3[_0xd9d3('0x2d')][_0xd9d3('0x2e')]};});_0x3021f9[_0xd9d3('0x2f')]=_[_0xd9d3('0x29')](_0x267083,_0xd9d3('0x28'));_0x3021f9[_0xd9d3('0x30')]=_['keys'](_0x4f3b3e[_0xd9d3('0x30')]);_0x3021f9[_0xd9d3('0x31')]=_['intersection'](_0x3021f9[_0xd9d3('0x2f')],_0x3021f9[_0xd9d3('0x30')]);_0x4fee87[_0xd9d3('0x32')]=_[_0xd9d3('0x33')](_0x3021f9[_0xd9d3('0x2f')],qs['fields'](_0x4f3b3e['query'][_0xd9d3('0x34')]));_0x4fee87[_0xd9d3('0x32')]=_0x4fee87['attributes'][_0xd9d3('0x35')]?_0x4fee87[_0xd9d3('0x32')]:_0x3021f9[_0xd9d3('0x2f')];if(!_0x4f3b3e[_0xd9d3('0x30')][_0xd9d3('0x36')](_0xd9d3('0x37'))){_0x4fee87[_0xd9d3('0x1a')]=qs[_0xd9d3('0x1a')](_0x4f3b3e['query']['limit']);_0x4fee87[_0xd9d3('0x1d')]=qs['offset'](_0x4f3b3e['query']['offset']);}_0x4fee87[_0xd9d3('0x38')]=qs[_0xd9d3('0x39')](_0x4f3b3e[_0xd9d3('0x30')]['sort']);_0x4fee87[_0xd9d3('0x3a')]=qs['filters'](_[_0xd9d3('0x3b')](_0x4f3b3e[_0xd9d3('0x30')],_0x3021f9[_0xd9d3('0x31')]),_0x267083);if(_0x4f3b3e[_0xd9d3('0x30')][_0xd9d3('0x3c')]){_0x4fee87[_0xd9d3('0x3a')]=_['merge'](_0x4fee87[_0xd9d3('0x3a')],{'$or':_[_0xd9d3('0x29')](_0x267083,function(_0x570c61){if(_0x570c61['type']!==_0xd9d3('0x3d')){var _0x241286={};_0x241286[_0x570c61[_0xd9d3('0x28')]]={'$like':'%'+_0x4f3b3e[_0xd9d3('0x30')][_0xd9d3('0x3c')]+'%'};return _0x241286;}})});}_0x4fee87=_['merge']({},_0x4fee87,_0x4f3b3e[_0xd9d3('0x3e')]);var _0x24b184={'where':_0x4fee87['where']};return db[_0xd9d3('0x2a')]['count'](_0x24b184)[_0xd9d3('0x24')](function(_0x55d980){_0x10c3b5[_0xd9d3('0x1c')]=_0x55d980;if(_0x4f3b3e[_0xd9d3('0x30')][_0xd9d3('0x3f')]){_0x4fee87[_0xd9d3('0x40')]=[{'all':!![]}];}return db[_0xd9d3('0x2a')]['findAll'](_0x4fee87);})[_0xd9d3('0x24')](function(_0x98c778){_0x10c3b5['rows']=_0x98c778;return _0x10c3b5;})[_0xd9d3('0x24')](respondWithFilteredResult(_0x3f8dc4,_0x4fee87))[_0xd9d3('0x41')](handleError(_0x3f8dc4,null));};exports['show']=function(_0x64ce3e,_0x5aee7d){var _0x304404={'raw':![],'where':{'id':_0x64ce3e[_0xd9d3('0x42')]['id']}},_0x279e95={};_0x279e95[_0xd9d3('0x2f')]=_['keys'](db[_0xd9d3('0x2a')][_0xd9d3('0x2b')]);_0x279e95[_0xd9d3('0x30')]=_['keys'](_0x64ce3e[_0xd9d3('0x30')]);_0x279e95['filters']=_[_0xd9d3('0x33')](_0x279e95[_0xd9d3('0x2f')],_0x279e95['query']);_0x304404[_0xd9d3('0x32')]=_[_0xd9d3('0x33')](_0x279e95['model'],qs['fields'](_0x64ce3e[_0xd9d3('0x30')][_0xd9d3('0x34')]));_0x304404[_0xd9d3('0x32')]=_0x304404[_0xd9d3('0x32')][_0xd9d3('0x35')]?_0x304404[_0xd9d3('0x32')]:_0x279e95[_0xd9d3('0x2f')];if(_0x64ce3e[_0xd9d3('0x30')][_0xd9d3('0x3f')]){_0x304404[_0xd9d3('0x40')]=[{'all':!![]}];}_0x304404=_['merge']({},_0x304404,_0x64ce3e[_0xd9d3('0x3e')]);return db['Campaign']['find'](_0x304404)[_0xd9d3('0x24')](handleEntityNotFound(_0x5aee7d,null))['then'](respondWithResult(_0x5aee7d,null))[_0xd9d3('0x41')](handleError(_0x5aee7d,null));};exports[_0xd9d3('0x43')]=function(_0x3b8fed,_0x4a0cd5){return db[_0xd9d3('0x2a')]['create'](_0x3b8fed[_0xd9d3('0x44')],{})[_0xd9d3('0x24')](function(_0x532c24){var _0x47f2e6=_0x3b8fed[_0xd9d3('0x45')][_0xd9d3('0x25')]({'plain':!![]});if(!_0x47f2e6)throw new Error(_0xd9d3('0x46'));if(_0x47f2e6[_0xd9d3('0x47')]===_0xd9d3('0x45')){var _0xc9ac74=_0x532c24[_0xd9d3('0x25')]({'plain':!![]});var _0x213ad=_0xd9d3('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x213ad,'userProfileId':_0x47f2e6[_0xd9d3('0x49')]},'raw':!![]})['then'](function(_0x2a7bfd){if(_0x2a7bfd&&_0x2a7bfd[_0xd9d3('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0xc9ac74[_0xd9d3('0x28')],'resourceId':_0xc9ac74['id'],'type':_0x2a7bfd['name'],'sectionId':_0x2a7bfd['id']},{})['then'](function(){return _0x532c24;});}else{return _0x532c24;}})['catch'](function(_0x597eab){logger[_0xd9d3('0x27')](_0xd9d3('0x4b'),_0x597eab);throw _0x597eab;});}return _0x532c24;})['then'](respondWithResult(_0x4a0cd5,0xc9))[_0xd9d3('0x41')](handleError(_0x4a0cd5,null));};exports[_0xd9d3('0x4c')]=function(_0x56b1f3,_0x5127e0){var _0x50855a={'where':{'id':_0x56b1f3[_0xd9d3('0x42')]['id']}},_0x290be3={};_0x290be3[_0xd9d3('0x2f')]=_[_0xd9d3('0x4d')](db[_0xd9d3('0x2a')][_0xd9d3('0x2b')]);_0x50855a['attributes']=_['intersection'](_0x290be3[_0xd9d3('0x2f')],qs[_0xd9d3('0x34')](_0x56b1f3[_0xd9d3('0x30')][_0xd9d3('0x34')]));_0x50855a[_0xd9d3('0x32')]=_0x50855a[_0xd9d3('0x32')][_0xd9d3('0x35')]?_0x50855a['attributes']:_0x290be3['model'];if(_0x56b1f3[_0xd9d3('0x30')][_0xd9d3('0x3f')]){_0x50855a[_0xd9d3('0x40')]=[{'all':!![]}];}_0x50855a=_[_0xd9d3('0x4e')]({},_0x50855a,_0x56b1f3[_0xd9d3('0x3e')]);return db[_0xd9d3('0x2a')]['find'](_0x50855a)[_0xd9d3('0x24')](handleEntityNotFound(_0x5127e0,null))[_0xd9d3('0x24')](function(_0xe765ae){if(_0xe765ae){var _0x288cdc=_0xe765ae[_0xd9d3('0x25')]({'plain':!![]});_0x288cdc=qs[_0xd9d3('0x4f')](_0x288cdc,['id','createdAt',_0xd9d3('0x50')]);_0x56b1f3['body']=_[_0xd9d3('0x4f')](_0x56b1f3['body'],['id',_0xd9d3('0x51'),'updatedAt']);return db[_0xd9d3('0x2a')][_0xd9d3('0x43')](_[_0xd9d3('0x4e')](_0x288cdc,_0x56b1f3[_0xd9d3('0x44')]),{'include':_0x56b1f3[_0xd9d3('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0xd9d3('0x24')](function(_0x258c80){var _0x569494=_0x56b1f3['user'][_0xd9d3('0x25')]({'plain':!![]});if(!_0x569494)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x569494[_0xd9d3('0x47')]==='user'){var _0x479eba=_0x258c80['get']({'plain':!![]});var _0x3f9219='IvrCampaigns';return db[_0xd9d3('0x52')][_0xd9d3('0x53')]({'where':{'name':_0x3f9219,'userProfileId':_0x569494['userProfileId']},'raw':!![]})[_0xd9d3('0x24')](function(_0x2f5bad){if(_0x2f5bad&&_0x2f5bad[_0xd9d3('0x4a')]===0x0){return db[_0xd9d3('0x54')][_0xd9d3('0x43')]({'name':_0x479eba[_0xd9d3('0x28')],'resourceId':_0x479eba['id'],'type':_0x2f5bad[_0xd9d3('0x28')],'sectionId':_0x2f5bad['id']},{})[_0xd9d3('0x24')](function(){return _0x258c80;});}else{return _0x258c80;}})[_0xd9d3('0x41')](function(_0x29d394){logger[_0xd9d3('0x27')](_0xd9d3('0x4b'),_0x29d394);throw _0x29d394;});}return _0x258c80;});}})[_0xd9d3('0x24')](respondWithResult(_0x5127e0,0xc9))[_0xd9d3('0x41')](handleError(_0x5127e0,null));};exports[_0xd9d3('0x22')]=function(_0x530b26,_0x12292a){if(_0x530b26['body']['id']){delete _0x530b26[_0xd9d3('0x44')]['id'];}return db[_0xd9d3('0x2a')][_0xd9d3('0x53')]({'where':{'id':_0x530b26['params']['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x12292a,null))[_0xd9d3('0x24')](saveUpdates(_0x530b26[_0xd9d3('0x44')],null))[_0xd9d3('0x24')](respondWithResult(_0x12292a,null))[_0xd9d3('0x41')](handleError(_0x12292a,null));};exports['destroy']=function(_0x10cdae,_0x57cc4b){return db['Campaign'][_0xd9d3('0x53')]({'where':{'id':_0x10cdae[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x57cc4b,null))[_0xd9d3('0x24')](removeEntity(_0x57cc4b,null))[_0xd9d3('0x41')](handleError(_0x57cc4b,null));};exports[_0xd9d3('0x55')]=function(_0x4d168a,_0x4ba3aa,_0x480b1f){var _0x43737c={'raw':!![],'where':{}};var _0x22fd8f={};var _0x364982={'count':0x0,'rows':[]};return db['Campaign'][_0xd9d3('0x56')]({'where':{'id':_0x4d168a['params']['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x4ba3aa,null))[_0xd9d3('0x24')](function(_0x438172){if(_0x438172){_0x22fd8f[_0xd9d3('0x2f')]=_['keys'](db[_0xd9d3('0x57')]['rawAttributes']);_0x22fd8f[_0xd9d3('0x30')]=_[_0xd9d3('0x4d')](_0x4d168a['query']);_0x22fd8f[_0xd9d3('0x31')]=_[_0xd9d3('0x33')](_0x22fd8f['model'],_0x22fd8f[_0xd9d3('0x30')]);_0x43737c['attributes']=_[_0xd9d3('0x33')](_0x22fd8f[_0xd9d3('0x2f')],qs[_0xd9d3('0x34')](_0x4d168a[_0xd9d3('0x30')]['fields']));_0x43737c[_0xd9d3('0x32')]=_0x43737c[_0xd9d3('0x32')][_0xd9d3('0x35')]?_0x43737c[_0xd9d3('0x32')]:_0x22fd8f[_0xd9d3('0x2f')];if(!_0x4d168a[_0xd9d3('0x30')]['hasOwnProperty']('nolimit')){_0x43737c['limit']=qs[_0xd9d3('0x1a')](_0x4d168a[_0xd9d3('0x30')][_0xd9d3('0x1a')]);_0x43737c[_0xd9d3('0x1d')]=qs[_0xd9d3('0x1d')](_0x4d168a[_0xd9d3('0x30')][_0xd9d3('0x1d')]);}_0x43737c[_0xd9d3('0x38')]=qs[_0xd9d3('0x39')](_0x4d168a[_0xd9d3('0x30')]['sort']);_0x43737c[_0xd9d3('0x3a')]=qs[_0xd9d3('0x31')](_[_0xd9d3('0x3b')](_0x4d168a[_0xd9d3('0x30')],_0x22fd8f[_0xd9d3('0x31')]));_0x43737c[_0xd9d3('0x3a')]['CampaignId']=_0x438172['id'];if(_0x4d168a[_0xd9d3('0x30')][_0xd9d3('0x3c')]){_0x43737c[_0xd9d3('0x3a')]=_['merge'](_0x43737c[_0xd9d3('0x3a')],{'$or':_['map'](_0x43737c[_0xd9d3('0x32')],function(_0x167c87){var _0x2dd3e5={};_0x2dd3e5[_0x167c87]={'$like':'%'+_0x4d168a[_0xd9d3('0x30')][_0xd9d3('0x3c')]+'%'};return _0x2dd3e5;})});}_0x43737c=_[_0xd9d3('0x4e')]({},_0x43737c,_0x4d168a['options']);return db[_0xd9d3('0x57')][_0xd9d3('0x1c')]({'where':_0x43737c['where']})[_0xd9d3('0x24')](function(_0x2142b9){_0x364982['count']=_0x2142b9;if(_0x4d168a[_0xd9d3('0x30')][_0xd9d3('0x3f')]){_0x43737c[_0xd9d3('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xd9d3('0x58')](_0x43737c);})[_0xd9d3('0x24')](function(_0x4a8a13){_0x364982[_0xd9d3('0x59')]=_0x4a8a13;return _0x364982;});}})['then'](respondWithFilteredResult(_0x4ba3aa,_0x43737c))[_0xd9d3('0x41')](handleError(_0x4ba3aa,null));};exports[_0xd9d3('0x5a')]=function(_0x23d4f4,_0x42191e,_0x4495c0){var _0x4abb87={'raw':!![],'where':{}};var _0x2b98cb={};var _0x383b38={'count':0x0,'rows':[]};return db[_0xd9d3('0x2a')]['findOne']({'where':{'id':_0x23d4f4[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x42191e,null))[_0xd9d3('0x24')](function(_0x51d03e){if(_0x51d03e){_0x2b98cb[_0xd9d3('0x2f')]=_[_0xd9d3('0x4d')](db['CmHopperHistory'][_0xd9d3('0x2b')]);_0x2b98cb[_0xd9d3('0x30')]=_[_0xd9d3('0x4d')](_0x23d4f4[_0xd9d3('0x30')]);_0x2b98cb[_0xd9d3('0x31')]=_[_0xd9d3('0x33')](_0x2b98cb['model'],_0x2b98cb['query']);_0x4abb87[_0xd9d3('0x32')]=_[_0xd9d3('0x33')](_0x2b98cb[_0xd9d3('0x2f')],qs['fields'](_0x23d4f4['query'][_0xd9d3('0x34')]));_0x4abb87['attributes']=_0x4abb87[_0xd9d3('0x32')][_0xd9d3('0x35')]?_0x4abb87['attributes']:_0x2b98cb[_0xd9d3('0x2f')];if(!_0x23d4f4['query'][_0xd9d3('0x36')]('nolimit')){_0x4abb87[_0xd9d3('0x1a')]=qs['limit'](_0x23d4f4[_0xd9d3('0x30')]['limit']);_0x4abb87[_0xd9d3('0x1d')]=qs[_0xd9d3('0x1d')](_0x23d4f4[_0xd9d3('0x30')][_0xd9d3('0x1d')]);}_0x4abb87[_0xd9d3('0x38')]=qs['sort'](_0x23d4f4[_0xd9d3('0x30')][_0xd9d3('0x39')]);_0x4abb87[_0xd9d3('0x3a')]=qs[_0xd9d3('0x31')](_['pick'](_0x23d4f4[_0xd9d3('0x30')],_0x2b98cb[_0xd9d3('0x31')]));_0x4abb87['where'][_0xd9d3('0x5b')]=_0x51d03e['id'];if(_0x23d4f4[_0xd9d3('0x30')][_0xd9d3('0x3c')]){_0x4abb87[_0xd9d3('0x3a')]=_[_0xd9d3('0x4e')](_0x4abb87[_0xd9d3('0x3a')],{'$or':_['map'](_0x4abb87[_0xd9d3('0x32')],function(_0x5ee305){var _0x53d21c={};_0x53d21c[_0x5ee305]={'$like':'%'+_0x23d4f4[_0xd9d3('0x30')][_0xd9d3('0x3c')]+'%'};return _0x53d21c;})});}_0x4abb87=_[_0xd9d3('0x4e')]({},_0x4abb87,_0x23d4f4['options']);return db[_0xd9d3('0x5c')][_0xd9d3('0x1c')]({'where':_0x4abb87['where']})['then'](function(_0x573e57){_0x383b38[_0xd9d3('0x1c')]=_0x573e57;if(_0x23d4f4[_0xd9d3('0x30')][_0xd9d3('0x3f')]){_0x4abb87[_0xd9d3('0x40')]=[{'all':!![]}];}return db[_0xd9d3('0x5c')][_0xd9d3('0x58')](_0x4abb87);})[_0xd9d3('0x24')](function(_0x4264a0){_0x383b38[_0xd9d3('0x59')]=_0x4264a0;return _0x383b38;});}})[_0xd9d3('0x24')](respondWithFilteredResult(_0x42191e,_0x4abb87))['catch'](handleError(_0x42191e,null));};exports['getHopperFinals']=function(_0x1d1353,_0x28c6b6,_0x5872d2){var _0x5c5b9a={'raw':!![],'where':{}};var _0x4c3a80={};var _0x1f3492={'count':0x0,'rows':[]};return db[_0xd9d3('0x2a')][_0xd9d3('0x56')]({'where':{'id':_0x1d1353['params']['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x28c6b6,null))[_0xd9d3('0x24')](function(_0xe4cba1){if(_0xe4cba1){_0x4c3a80['model']=_[_0xd9d3('0x4d')](db[_0xd9d3('0x5d')][_0xd9d3('0x2b')]);_0x4c3a80['query']=_[_0xd9d3('0x4d')](_0x1d1353[_0xd9d3('0x30')]);_0x4c3a80['filters']=_['intersection'](_0x4c3a80[_0xd9d3('0x2f')],_0x4c3a80[_0xd9d3('0x30')]);_0x5c5b9a[_0xd9d3('0x32')]=_[_0xd9d3('0x33')](_0x4c3a80[_0xd9d3('0x2f')],qs[_0xd9d3('0x34')](_0x1d1353['query'][_0xd9d3('0x34')]));_0x5c5b9a['attributes']=_0x5c5b9a[_0xd9d3('0x32')]['length']?_0x5c5b9a[_0xd9d3('0x32')]:_0x4c3a80[_0xd9d3('0x2f')];if(!_0x1d1353[_0xd9d3('0x30')][_0xd9d3('0x36')](_0xd9d3('0x37'))){_0x5c5b9a[_0xd9d3('0x1a')]=qs[_0xd9d3('0x1a')](_0x1d1353['query']['limit']);_0x5c5b9a['offset']=qs['offset'](_0x1d1353[_0xd9d3('0x30')][_0xd9d3('0x1d')]);}_0x5c5b9a[_0xd9d3('0x38')]=qs['sort'](_0x1d1353['query'][_0xd9d3('0x39')]);_0x5c5b9a['where']=qs[_0xd9d3('0x31')](_[_0xd9d3('0x3b')](_0x1d1353[_0xd9d3('0x30')],_0x4c3a80[_0xd9d3('0x31')]));_0x5c5b9a[_0xd9d3('0x3a')][_0xd9d3('0x5b')]=_0xe4cba1['id'];if(_0x1d1353['query'][_0xd9d3('0x3c')]){_0x5c5b9a[_0xd9d3('0x3a')]=_['merge'](_0x5c5b9a['where'],{'$or':_['map'](_0x5c5b9a[_0xd9d3('0x32')],function(_0x36e097){var _0x10f456={};_0x10f456[_0x36e097]={'$like':'%'+_0x1d1353[_0xd9d3('0x30')]['filter']+'%'};return _0x10f456;})});}_0x5c5b9a=_['merge']({},_0x5c5b9a,_0x1d1353[_0xd9d3('0x3e')]);return db[_0xd9d3('0x5d')][_0xd9d3('0x1c')]({'where':_0x5c5b9a['where']})[_0xd9d3('0x24')](function(_0x1f25d0){_0x1f3492[_0xd9d3('0x1c')]=_0x1f25d0;if(_0x1d1353['query']['includeAll']){_0x5c5b9a[_0xd9d3('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd9d3('0x58')](_0x5c5b9a);})[_0xd9d3('0x24')](function(_0x164cbd){_0x1f3492['rows']=_0x164cbd;return _0x1f3492;});}})[_0xd9d3('0x24')](respondWithFilteredResult(_0x28c6b6,_0x5c5b9a))[_0xd9d3('0x41')](handleError(_0x28c6b6,null));};exports[_0xd9d3('0x5e')]=function(_0x310854,_0x58e679,_0x372ae6){var _0x3c6450={'raw':!![],'where':{}};var _0x48718a={};var _0x2760ec={'count':0x0,'rows':[]};return db[_0xd9d3('0x2a')]['findOne']({'where':{'id':_0x310854['params']['id']}})['then'](handleEntityNotFound(_0x58e679,null))[_0xd9d3('0x24')](function(_0x1f6e37){if(_0x1f6e37){_0x48718a[_0xd9d3('0x2f')]=_['keys'](db['CmHopperBlack'][_0xd9d3('0x2b')]);_0x48718a[_0xd9d3('0x30')]=_[_0xd9d3('0x4d')](_0x310854[_0xd9d3('0x30')]);_0x48718a[_0xd9d3('0x31')]=_[_0xd9d3('0x33')](_0x48718a[_0xd9d3('0x2f')],_0x48718a['query']);_0x3c6450[_0xd9d3('0x32')]=_[_0xd9d3('0x33')](_0x48718a[_0xd9d3('0x2f')],qs[_0xd9d3('0x34')](_0x310854[_0xd9d3('0x30')][_0xd9d3('0x34')]));_0x3c6450['attributes']=_0x3c6450['attributes'][_0xd9d3('0x35')]?_0x3c6450[_0xd9d3('0x32')]:_0x48718a[_0xd9d3('0x2f')];if(!_0x310854[_0xd9d3('0x30')]['hasOwnProperty']('nolimit')){_0x3c6450[_0xd9d3('0x1a')]=qs[_0xd9d3('0x1a')](_0x310854[_0xd9d3('0x30')][_0xd9d3('0x1a')]);_0x3c6450['offset']=qs[_0xd9d3('0x1d')](_0x310854[_0xd9d3('0x30')][_0xd9d3('0x1d')]);}_0x3c6450[_0xd9d3('0x38')]=qs[_0xd9d3('0x39')](_0x310854[_0xd9d3('0x30')][_0xd9d3('0x39')]);_0x3c6450[_0xd9d3('0x3a')]=qs[_0xd9d3('0x31')](_[_0xd9d3('0x3b')](_0x310854['query'],_0x48718a['filters']));_0x3c6450[_0xd9d3('0x3a')][_0xd9d3('0x5b')]=_0x1f6e37['id'];if(_0x310854['query'][_0xd9d3('0x3c')]){_0x3c6450[_0xd9d3('0x3a')]=_['merge'](_0x3c6450[_0xd9d3('0x3a')],{'$or':_[_0xd9d3('0x29')](_0x3c6450['attributes'],function(_0x5ddbce){var _0x40d4e9={};_0x40d4e9[_0x5ddbce]={'$like':'%'+_0x310854['query'][_0xd9d3('0x3c')]+'%'};return _0x40d4e9;})});}_0x3c6450=_[_0xd9d3('0x4e')]({},_0x3c6450,_0x310854['options']);return db['CmHopperBlack'][_0xd9d3('0x1c')]({'where':_0x3c6450[_0xd9d3('0x3a')]})[_0xd9d3('0x24')](function(_0x5344c2){_0x2760ec[_0xd9d3('0x1c')]=_0x5344c2;if(_0x310854[_0xd9d3('0x30')][_0xd9d3('0x3f')]){_0x3c6450['include']=[{'all':!![]}];}return db[_0xd9d3('0x5f')][_0xd9d3('0x58')](_0x3c6450);})['then'](function(_0x59e265){_0x2760ec[_0xd9d3('0x59')]=_0x59e265;return _0x2760ec;});}})[_0xd9d3('0x24')](respondWithFilteredResult(_0x58e679,_0x3c6450))['catch'](handleError(_0x58e679,null));};exports[_0xd9d3('0x60')]=function(_0x3cb9a1,_0x28eb3e,_0x51a979){var _0xf99a02={};var _0x4b8238={};var _0x4b8e8d;var _0x10f603;return db[_0xd9d3('0x2a')]['findOne']({'where':{'id':_0x3cb9a1[_0xd9d3('0x42')]['id']}})['then'](handleEntityNotFound(_0x28eb3e,null))[_0xd9d3('0x24')](function(_0x8f4fbe){if(_0x8f4fbe){_0x4b8e8d=_0x8f4fbe;_0x4b8238[_0xd9d3('0x2f')]=_[_0xd9d3('0x4d')](db[_0xd9d3('0x61')][_0xd9d3('0x2b')]);_0x4b8238[_0xd9d3('0x30')]=_[_0xd9d3('0x4d')](_0x3cb9a1[_0xd9d3('0x30')]);_0x4b8238['filters']=_[_0xd9d3('0x33')](_0x4b8238[_0xd9d3('0x2f')],_0x4b8238[_0xd9d3('0x30')]);_0xf99a02['attributes']=_[_0xd9d3('0x33')](_0x4b8238['model'],qs['fields'](_0x3cb9a1[_0xd9d3('0x30')][_0xd9d3('0x34')]));_0xf99a02[_0xd9d3('0x32')]=_0xf99a02[_0xd9d3('0x32')][_0xd9d3('0x35')]?_0xf99a02['attributes']:_0x4b8238[_0xd9d3('0x2f')];_0xf99a02[_0xd9d3('0x38')]=qs[_0xd9d3('0x39')](_0x3cb9a1[_0xd9d3('0x30')][_0xd9d3('0x39')]);_0xf99a02[_0xd9d3('0x3a')]=qs[_0xd9d3('0x31')](_[_0xd9d3('0x3b')](_0x3cb9a1[_0xd9d3('0x30')],_0x4b8238['filters']));if(_0x3cb9a1[_0xd9d3('0x30')]['filter']){_0xf99a02[_0xd9d3('0x3a')]=_[_0xd9d3('0x4e')](_0xf99a02[_0xd9d3('0x3a')],{'$or':_[_0xd9d3('0x29')](_0xf99a02[_0xd9d3('0x32')],function(_0x3b7328){var _0x38b4a9={};_0x38b4a9[_0x3b7328]={'$like':'%'+_0x3cb9a1[_0xd9d3('0x30')][_0xd9d3('0x3c')]+'%'};return _0x38b4a9;})});}_0xf99a02=_[_0xd9d3('0x4e')]({},_0xf99a02,_0x3cb9a1[_0xd9d3('0x3e')]);return _0x4b8e8d[_0xd9d3('0x60')](_0xf99a02);}})['then'](function(_0x42bd53){if(_0x42bd53){_0x10f603=_0x42bd53[_0xd9d3('0x35')];if(!_0x3cb9a1[_0xd9d3('0x30')][_0xd9d3('0x36')](_0xd9d3('0x37'))){_0xf99a02[_0xd9d3('0x1a')]=qs[_0xd9d3('0x1a')](_0x3cb9a1['query'][_0xd9d3('0x1a')]);_0xf99a02[_0xd9d3('0x1d')]=qs[_0xd9d3('0x1d')](_0x3cb9a1[_0xd9d3('0x30')]['offset']);}return _0x4b8e8d[_0xd9d3('0x60')](_0xf99a02);}})[_0xd9d3('0x24')](function(_0x12b666){if(_0x12b666){return _0x12b666?{'count':_0x10f603,'rows':_0x12b666}:null;}})['then'](respondWithResult(_0x28eb3e,null))['catch'](handleError(_0x28eb3e,null));};exports[_0xd9d3('0x62')]=function(_0x53062c,_0x5d4422,_0x54f894){var _0x2e37ae,_0x5a84c8;var _0x2f6eba=[];var _0x570077=moment()[_0xd9d3('0x63')](_0xd9d3('0x64'));return db[_0xd9d3('0x2a')][_0xd9d3('0x53')]({'where':{'id':_0x53062c[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x5d4422,null))['then'](function(_0x331d5b){if(_0x331d5b){_0x5a84c8=_0x331d5b;return _0x331d5b[_0xd9d3('0x62')](_0x53062c[_0xd9d3('0x44')][_0xd9d3('0x65')],_['omit'](_0x53062c['body'],['ids','id'])||{});}return null;})[_0xd9d3('0x66')](function(_0x45026c){var _0x2117a3;var _0x5d5875;_0x2e37ae=_0x45026c||[];var _0x22d13d=[];if(_0x45026c){for(var _0x5a147c=0x0;_0x5a147c<_0x45026c[_0xd9d3('0x35')];_0x5a147c+=0x1){var _0x4fa98b=_0x45026c[_0x5a147c][_0xd9d3('0x25')]({'plain':!![]});_0x5a84c8[_0xd9d3('0x67')]=_0x53062c[_0xd9d3('0x44')][_0xd9d3('0x67')]?_0x53062c[_0xd9d3('0x44')]['dialCheckDuplicateType']:_0x5a84c8[_0xd9d3('0x67')];switch(_0x5a84c8[_0xd9d3('0x67')]){case _0xd9d3('0x68'):_0x2117a3=squel[_0xd9d3('0x69')]()['into'](_0xd9d3('0x6a'))[_0xd9d3('0x6b')]([_0xd9d3('0x6c'),_0xd9d3('0x6d'),_0xd9d3('0x6e'),_0xd9d3('0x6f'),_0xd9d3('0x5b'),'createdAt',_0xd9d3('0x50')],squel['select']()[_0xd9d3('0x70')](_0xd9d3('0x6c'),_0xd9d3('0x6c'))[_0xd9d3('0x70')](_0xd9d3('0x71'),_0xd9d3('0x6d'))[_0xd9d3('0x70')]('id',_0xd9d3('0x6e'))[_0xd9d3('0x70')](_0x4fa98b[_0xd9d3('0x72')]['toString'](),'ListId')[_0xd9d3('0x70')](_0x53062c[_0xd9d3('0x42')]['id']['toString'](),_0xd9d3('0x5b'))['field']('\x27'+_0x570077+'\x27',_0xd9d3('0x51'))[_0xd9d3('0x70')]('\x27'+_0x570077+'\x27',_0xd9d3('0x50'))[_0xd9d3('0x73')](_0xd9d3('0x74'))[_0xd9d3('0x3a')](_0xd9d3('0x75'))['where'](_0xd9d3('0x76'),_0x4fa98b[_0xd9d3('0x72')][_0xd9d3('0x77')]())[_0xd9d3('0x3a')](_0xd9d3('0x78'))[_0xd9d3('0x3a')](_0xd9d3('0x79'),squel[_0xd9d3('0x7a')]()['field'](_0xd9d3('0x7b'))[_0xd9d3('0x73')](_0xd9d3('0x7c'))[_0xd9d3('0x3a')](_0xd9d3('0x7d'),_0x53062c[_0xd9d3('0x42')]['id']['toString']()))[_0xd9d3('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd9d3('0x70')]('COALESCE(phone,\x27\x27)')['from'](_0xd9d3('0x6a'))[_0xd9d3('0x3a')](_0xd9d3('0x7d'),_0x53062c['params']['id'][_0xd9d3('0x77')]())))[_0xd9d3('0x77')]();break;case'onlyIfOpen':_0x2117a3=squel['insert']()[_0xd9d3('0x7e')](_0xd9d3('0x6a'))[_0xd9d3('0x6b')]([_0xd9d3('0x6c'),'scheduledAt',_0xd9d3('0x6e'),_0xd9d3('0x6f'),_0xd9d3('0x5b'),_0xd9d3('0x51'),_0xd9d3('0x50')],squel[_0xd9d3('0x7a')]()[_0xd9d3('0x70')](_0xd9d3('0x6c'),_0xd9d3('0x6c'))[_0xd9d3('0x70')](_0xd9d3('0x71'),_0xd9d3('0x6d'))[_0xd9d3('0x70')]('id',_0xd9d3('0x6e'))[_0xd9d3('0x70')](_0x4fa98b['CmListId'][_0xd9d3('0x77')](),_0xd9d3('0x6f'))[_0xd9d3('0x70')](_0x53062c[_0xd9d3('0x42')]['id']['toString'](),_0xd9d3('0x5b'))[_0xd9d3('0x70')]('\x27'+_0x570077+'\x27','createdAt')['field']('\x27'+_0x570077+'\x27',_0xd9d3('0x50'))[_0xd9d3('0x73')](_0xd9d3('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0xd9d3('0x3a')](_0xd9d3('0x76'),_0x4fa98b[_0xd9d3('0x72')][_0xd9d3('0x77')]())[_0xd9d3('0x3a')](_0xd9d3('0x78'))[_0xd9d3('0x3a')](_0xd9d3('0x79'),squel[_0xd9d3('0x7a')]()[_0xd9d3('0x70')]('COALESCE(phone,\x27\x27)')['from'](_0xd9d3('0x6a'))[_0xd9d3('0x3a')](_0xd9d3('0x7d'),_0x53062c[_0xd9d3('0x42')]['id']['toString']())))['toString']();break;default:_0x2117a3=squel['insert']()[_0xd9d3('0x7e')](_0xd9d3('0x6a'))['fromQuery']([_0xd9d3('0x6c'),_0xd9d3('0x6d'),_0xd9d3('0x6e'),'ListId','CampaignId',_0xd9d3('0x51'),_0xd9d3('0x50')],squel[_0xd9d3('0x7a')]()[_0xd9d3('0x70')]('phone',_0xd9d3('0x6c'))[_0xd9d3('0x70')](_0xd9d3('0x71'),'scheduledAt')['field']('id',_0xd9d3('0x6e'))[_0xd9d3('0x70')](_0x4fa98b[_0xd9d3('0x72')]['toString'](),_0xd9d3('0x6f'))[_0xd9d3('0x70')](_0x53062c[_0xd9d3('0x42')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x570077+'\x27','createdAt')[_0xd9d3('0x70')]('\x27'+_0x570077+'\x27',_0xd9d3('0x50'))[_0xd9d3('0x73')]('cm_contacts')[_0xd9d3('0x3a')](_0xd9d3('0x75'))[_0xd9d3('0x3a')]('ListId\x20=\x20?',_0x4fa98b[_0xd9d3('0x72')][_0xd9d3('0x77')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xd9d3('0x77')]();}_0x5d5875=squel['insert']()['into'](_0xd9d3('0x7f'))[_0xd9d3('0x6b')]([_0xd9d3('0x80'),_0xd9d3('0x6d'),'phone',_0xd9d3('0x81'),'createdAt',_0xd9d3('0x50')],squel[_0xd9d3('0x7a')]()['field'](_0xd9d3('0x82'),'id')['field'](_0xd9d3('0x71'),_0xd9d3('0x6d'))['field'](_0xd9d3('0x83'),_0xd9d3('0x6c'))[_0xd9d3('0x70')]('ci.OrderBY','OrderBy')[_0xd9d3('0x70')]('\x27'+_0x570077+'\x27','createdAt')['field']('\x27'+_0x570077+'\x27',_0xd9d3('0x50'))[_0xd9d3('0x73')](_0xd9d3('0x84'),'ci')[_0xd9d3('0x85')]('cm_hopper','h',_0xd9d3('0x86'))[_0xd9d3('0x3a')](_0xd9d3('0x87'),_0x4fa98b[_0xd9d3('0x72')][_0xd9d3('0x77')]())[_0xd9d3('0x3a')]('h.CampaignId=?',_0x53062c[_0xd9d3('0x42')]['id'][_0xd9d3('0x77')]())[_0xd9d3('0x3a')](_0xd9d3('0x88'),_0x570077))['toString']();_0x22d13d[_0xd9d3('0x89')](db[_0xd9d3('0x8a')][_0xd9d3('0x30')](_0x2117a3));_0x2f6eba[_0xd9d3('0x89')](db[_0xd9d3('0x8a')][_0xd9d3('0x30')](_0x5d5875));}return BPromise[_0xd9d3('0x8b')](_0x22d13d);}})[_0xd9d3('0x24')](function(){return BPromise[_0xd9d3('0x8b')](_0x2f6eba);})[_0xd9d3('0x24')](function(){return _0x2e37ae;})[_0xd9d3('0x24')](respondWithResult(_0x5d4422,null))[_0xd9d3('0x41')](handleError(_0x5d4422,null));};exports[_0xd9d3('0x8c')]=function(_0x35d81e,_0xd0037a,_0x426882){return db[_0xd9d3('0x2a')][_0xd9d3('0x53')]({'where':{'id':_0x35d81e[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0xd0037a,null))['then'](function(_0x940f05){if(_0x940f05){return _0x940f05['removeLists'](_0x35d81e[_0xd9d3('0x30')][_0xd9d3('0x65')]);}})['then'](function(_0x5b0fff){if(_0x5b0fff){return db['CmHopper'][_0xd9d3('0x23')]({'where':{'ListId':_0x35d81e[_0xd9d3('0x30')][_0xd9d3('0x65')],'CampaignId':_0x35d81e[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](function(){return _0x5b0fff;});}})[_0xd9d3('0x24')](respondWithStatusCode(_0xd0037a,null))[_0xd9d3('0x41')](handleError(_0xd0037a,null));};exports['getBlackLists']=function(_0x104c8f,_0x1e6bca,_0x1dd828){var _0x5579d1={};var _0x1c5c2c={};var _0xa6079a;var _0xaaa4f9;return db[_0xd9d3('0x2a')][_0xd9d3('0x56')]({'where':{'id':_0x104c8f[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x1e6bca,null))[_0xd9d3('0x24')](function(_0x31aec7){if(_0x31aec7){_0xa6079a=_0x31aec7;_0x1c5c2c[_0xd9d3('0x2f')]=_[_0xd9d3('0x4d')](db[_0xd9d3('0x61')][_0xd9d3('0x2b')]);_0x1c5c2c[_0xd9d3('0x30')]=_['keys'](_0x104c8f[_0xd9d3('0x30')]);_0x1c5c2c[_0xd9d3('0x31')]=_['intersection'](_0x1c5c2c[_0xd9d3('0x2f')],_0x1c5c2c[_0xd9d3('0x30')]);_0x5579d1['attributes']=_[_0xd9d3('0x33')](_0x1c5c2c['model'],qs[_0xd9d3('0x34')](_0x104c8f['query'][_0xd9d3('0x34')]));_0x5579d1[_0xd9d3('0x32')]=_0x5579d1[_0xd9d3('0x32')][_0xd9d3('0x35')]?_0x5579d1[_0xd9d3('0x32')]:_0x1c5c2c['model'];_0x5579d1[_0xd9d3('0x38')]=qs['sort'](_0x104c8f['query'][_0xd9d3('0x39')]);_0x5579d1[_0xd9d3('0x3a')]=qs[_0xd9d3('0x31')](_[_0xd9d3('0x3b')](_0x104c8f[_0xd9d3('0x30')],_0x1c5c2c[_0xd9d3('0x31')]));if(_0x104c8f[_0xd9d3('0x30')][_0xd9d3('0x3c')]){_0x5579d1[_0xd9d3('0x3a')]=_['merge'](_0x5579d1[_0xd9d3('0x3a')],{'$or':_['map'](_0x5579d1[_0xd9d3('0x32')],function(_0x4ac0c2){var _0x488779={};_0x488779[_0x4ac0c2]={'$like':'%'+_0x104c8f[_0xd9d3('0x30')]['filter']+'%'};return _0x488779;})});}_0x5579d1=_[_0xd9d3('0x4e')]({},_0x5579d1,_0x104c8f[_0xd9d3('0x3e')]);return _0xa6079a[_0xd9d3('0x8d')](_0x5579d1);}})[_0xd9d3('0x24')](function(_0x4694d9){if(_0x4694d9){_0xaaa4f9=_0x4694d9[_0xd9d3('0x35')];if(!_0x104c8f['query'][_0xd9d3('0x36')](_0xd9d3('0x37'))){_0x5579d1[_0xd9d3('0x1a')]=qs[_0xd9d3('0x1a')](_0x104c8f[_0xd9d3('0x30')][_0xd9d3('0x1a')]);_0x5579d1[_0xd9d3('0x1d')]=qs[_0xd9d3('0x1d')](_0x104c8f[_0xd9d3('0x30')][_0xd9d3('0x1d')]);}return _0xa6079a[_0xd9d3('0x8d')](_0x5579d1);}})['then'](function(_0x1b5c02){if(_0x1b5c02){return _0x1b5c02?{'count':_0xaaa4f9,'rows':_0x1b5c02}:null;}})[_0xd9d3('0x24')](respondWithResult(_0x1e6bca,null))[_0xd9d3('0x41')](handleError(_0x1e6bca,null));};exports[_0xd9d3('0x8e')]=function(_0x361ab3,_0x4b799a,_0x2f0482){var _0x16b4b2,_0x68774f;var _0x414dec=[];var _0x33eb89=moment()[_0xd9d3('0x63')](_0xd9d3('0x64'));return db['Campaign'][_0xd9d3('0x53')]({'where':{'id':_0x361ab3[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](handleEntityNotFound(_0x4b799a,null))['then'](function(_0x52e9f7){if(_0x52e9f7){_0x68774f=_0x52e9f7;return _0x52e9f7[_0xd9d3('0x8e')](_0x361ab3[_0xd9d3('0x44')][_0xd9d3('0x65')],_[_0xd9d3('0x4f')](_0x361ab3[_0xd9d3('0x44')],[_0xd9d3('0x65'),'id'])||{});}return null;})[_0xd9d3('0x66')](function(_0x9a22e){var _0x2845a1;var _0x1dd761;_0x16b4b2=_0x9a22e||[];var _0x44370f=[];if(_0x9a22e){for(var _0x27c236=0x0;_0x27c236<_0x9a22e[_0xd9d3('0x35')];_0x27c236+=0x1){var _0x5adf60=_0x9a22e[_0x27c236][_0xd9d3('0x25')]({'plain':!![]});_0x2845a1=squel[_0xd9d3('0x69')]()['into'](_0xd9d3('0x8f'))[_0xd9d3('0x6b')]([_0xd9d3('0x6c'),_0xd9d3('0x6e'),_0xd9d3('0x6f'),_0xd9d3('0x5b'),_0xd9d3('0x51'),_0xd9d3('0x50')],squel[_0xd9d3('0x7a')]()['field'](_0xd9d3('0x6c'),_0xd9d3('0x6c'))[_0xd9d3('0x70')]('id','ContactId')[_0xd9d3('0x70')](_0x5adf60[_0xd9d3('0x72')][_0xd9d3('0x77')](),_0xd9d3('0x6f'))[_0xd9d3('0x70')](_0x361ab3[_0xd9d3('0x42')]['id'][_0xd9d3('0x77')](),_0xd9d3('0x5b'))[_0xd9d3('0x70')](_0xd9d3('0x71'),_0xd9d3('0x51'))[_0xd9d3('0x70')](_0xd9d3('0x71'),'updatedAt')[_0xd9d3('0x73')]('cm_contacts')['where'](_0xd9d3('0x75'))[_0xd9d3('0x3a')](_0xd9d3('0x76'),_0x5adf60[_0xd9d3('0x72')][_0xd9d3('0x77')]())[_0xd9d3('0x3a')](_0xd9d3('0x78')))[_0xd9d3('0x77')]();_0x44370f['push'](db[_0xd9d3('0x8a')][_0xd9d3('0x30')](_0x2845a1));}return BPromise['all'](_0x44370f);}})[_0xd9d3('0x24')](function(){return _0x16b4b2;})[_0xd9d3('0x24')](respondWithResult(_0x4b799a,null))['catch'](handleError(_0x4b799a,null));};exports[_0xd9d3('0x90')]=function(_0x5ee6f9,_0x23e3be,_0x52ac0e){return db['Campaign']['find']({'where':{'id':_0x5ee6f9[_0xd9d3('0x42')]['id']}})['then'](handleEntityNotFound(_0x23e3be,null))[_0xd9d3('0x24')](function(_0x44b9ac){if(_0x44b9ac){return _0x44b9ac[_0xd9d3('0x90')](_0x5ee6f9[_0xd9d3('0x30')][_0xd9d3('0x65')]);}})['then'](function(_0xac9477){if(_0xac9477){return db[_0xd9d3('0x5f')][_0xd9d3('0x23')]({'where':{'ListId':_0x5ee6f9[_0xd9d3('0x30')][_0xd9d3('0x65')],'CampaignId':_0x5ee6f9[_0xd9d3('0x42')]['id']}})[_0xd9d3('0x24')](function(){return _0xac9477;});}})[_0xd9d3('0x24')](respondWithStatusCode(_0x23e3be,null))[_0xd9d3('0x41')](handleError(_0x23e3be,null));};
\ No newline at end of file
+var _0x2d93=['fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','role','error','update','CmHopper','nolimit','pick','getHopperHistories','CmHopperHistory','CampaignId','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','createdAt','select','field','scheduledAt','ListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','get','UserProfileResource','destroy','name','send','map','Campaign','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x2f7571,_0x352fab){var _0x45245d=function(_0x377ec8){while(--_0x377ec8){_0x2f7571['push'](_0x2f7571['shift']());}};_0x45245d(++_0x352fab);}(_0x2d93,0xf3));var _0x32d9=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x2d93[_0x30faec];return _0x29484f;};'use strict';var emlformat=require(_0x32d9('0x0'));var rimraf=require(_0x32d9('0x1'));var zipdir=require(_0x32d9('0x2'));var jsonpatch=require(_0x32d9('0x3'));var rp=require(_0x32d9('0x4'));var moment=require(_0x32d9('0x5'));var BPromise=require(_0x32d9('0x6'));var Mustache=require(_0x32d9('0x7'));var util=require(_0x32d9('0x8'));var path=require(_0x32d9('0x9'));var sox=require(_0x32d9('0xa'));var csv=require(_0x32d9('0xb'));var ejs=require(_0x32d9('0xc'));var fs=require('fs');var fs_extra=require(_0x32d9('0xd'));var _=require('lodash');var squel=require(_0x32d9('0xe'));var crypto=require(_0x32d9('0xf'));var jsforce=require(_0x32d9('0x10'));var deskjs=require(_0x32d9('0x11'));var toCsv=require(_0x32d9('0xb'));var querystring=require('querystring');var Papa=require(_0x32d9('0x12'));var Redis=require(_0x32d9('0x13'));var authService=require(_0x32d9('0x14'));var qs=require(_0x32d9('0x15'));var as=require(_0x32d9('0x16'));var hardwareService=require(_0x32d9('0x17'));var logger=require(_0x32d9('0x18'))(_0x32d9('0x19'));var utils=require(_0x32d9('0x1a'));var config=require(_0x32d9('0x1b'));var licenseUtil=require(_0x32d9('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5afced,_0x16e983){_0x16e983=_0x16e983||0xcc;return function(_0x3ae057){if(_0x3ae057){return _0x5afced[_0x32d9('0x1d')](_0x16e983);}return _0x5afced[_0x32d9('0x1e')](_0x16e983)[_0x32d9('0x1f')]();};}function respondWithResult(_0x3b1d99,_0x9a0f21){_0x9a0f21=_0x9a0f21||0xc8;return function(_0x209a5c){if(_0x209a5c){return _0x3b1d99[_0x32d9('0x1e')](_0x9a0f21)[_0x32d9('0x20')](_0x209a5c);}};}function respondWithFilteredResult(_0x427433,_0x428821){return function(_0x5ebcab){if(_0x5ebcab){var _0x251b58=typeof _0x428821[_0x32d9('0x21')]==='undefined'&&typeof _0x428821[_0x32d9('0x22')]===_0x32d9('0x23');var _0x25fe2c=_0x5ebcab[_0x32d9('0x24')];var _0xd3e7a3=_0x251b58?0x0:_0x428821[_0x32d9('0x21')];var _0x33bb0b=_0x251b58?_0x5ebcab[_0x32d9('0x24')]:_0x428821[_0x32d9('0x21')]+_0x428821[_0x32d9('0x22')];var _0x543607;if(_0x33bb0b>=_0x25fe2c){_0x33bb0b=_0x25fe2c;_0x543607=0xc8;}else{_0x543607=0xce;}_0x427433['status'](_0x543607);return _0x427433[_0x32d9('0x25')](_0x32d9('0x26'),_0xd3e7a3+'-'+_0x33bb0b+'/'+_0x25fe2c)['json'](_0x5ebcab);}return null;};}function patchUpdates(_0x13f8b0){return function(_0x55b7a8){try{jsonpatch[_0x32d9('0x27')](_0x55b7a8,_0x13f8b0,!![]);}catch(_0x298cb6){return BPromise['reject'](_0x298cb6);}return _0x55b7a8['save']();};}function saveUpdates(_0x3e2ef3,_0xcd2cec){return function(_0x56b703){if(_0x56b703){return _0x56b703['update'](_0x3e2ef3)[_0x32d9('0x28')](function(_0x4162bc){return _0x4162bc;});}return null;};}function removeEntity(_0x339697,_0x37a0ce){return function(_0x3cb824){if(_0x3cb824){return _0x3cb824['destroy']()[_0x32d9('0x28')](function(){var _0x1c51a8=_0x3cb824[_0x32d9('0x29')]({'plain':!![]});var _0x215440='IvrCampaigns';return db[_0x32d9('0x2a')][_0x32d9('0x2b')]({'where':{'type':_0x215440,'resourceId':_0x1c51a8['id']}})[_0x32d9('0x28')](function(){return _0x3cb824;});})['then'](function(){_0x339697[_0x32d9('0x1e')](0xcc)[_0x32d9('0x1f')]();});}};}function handleEntityNotFound(_0x2dbc8c,_0xca2f14){return function(_0x5bd3f3){if(!_0x5bd3f3){_0x2dbc8c[_0x32d9('0x1d')](0x194);}return _0x5bd3f3;};}function handleError(_0x3cf5f2,_0x3d4258){_0x3d4258=_0x3d4258||0x1f4;return function(_0x7e7582){logger['error'](_0x7e7582['stack']);if(_0x7e7582['name']){delete _0x7e7582[_0x32d9('0x2c')];}_0x3cf5f2[_0x32d9('0x1e')](_0x3d4258)[_0x32d9('0x2d')](_0x7e7582);};}exports['index']=function(_0x272449,_0xda0f8f){var _0x56a7ab={},_0x28dc4={},_0x11909b={'count':0x0,'rows':[]};var _0x1b0dfb=_[_0x32d9('0x2e')](db[_0x32d9('0x2f')]['rawAttributes'],function(_0x28165e){return{'name':_0x28165e[_0x32d9('0x30')],'type':_0x28165e[_0x32d9('0x31')][_0x32d9('0x32')]};});_0x28dc4['model']=_[_0x32d9('0x2e')](_0x1b0dfb,'name');_0x28dc4[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x272449[_0x32d9('0x33')]);_0x28dc4[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x28dc4[_0x32d9('0x37')],_0x28dc4[_0x32d9('0x33')]);_0x56a7ab[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x28dc4['model'],qs[_0x32d9('0x39')](_0x272449[_0x32d9('0x33')][_0x32d9('0x39')]));_0x56a7ab[_0x32d9('0x38')]=_0x56a7ab[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x56a7ab[_0x32d9('0x38')]:_0x28dc4[_0x32d9('0x37')];if(!_0x272449[_0x32d9('0x33')][_0x32d9('0x3b')]('nolimit')){_0x56a7ab['limit']=qs[_0x32d9('0x22')](_0x272449[_0x32d9('0x33')][_0x32d9('0x22')]);_0x56a7ab[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x272449[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x56a7ab[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x272449[_0x32d9('0x33')]['sort']);_0x56a7ab[_0x32d9('0x3e')]=qs['filters'](_['pick'](_0x272449[_0x32d9('0x33')],_0x28dc4[_0x32d9('0x35')]),_0x1b0dfb);if(_0x272449['query'][_0x32d9('0x3f')]){_0x56a7ab['where']=_[_0x32d9('0x40')](_0x56a7ab[_0x32d9('0x3e')],{'$or':_[_0x32d9('0x2e')](_0x1b0dfb,function(_0x4a15af){if(_0x4a15af[_0x32d9('0x31')]!==_0x32d9('0x41')){var _0x2649d8={};_0x2649d8[_0x4a15af[_0x32d9('0x2c')]]={'$like':'%'+_0x272449[_0x32d9('0x33')][_0x32d9('0x3f')]+'%'};return _0x2649d8;}})});}_0x56a7ab=_[_0x32d9('0x40')]({},_0x56a7ab,_0x272449[_0x32d9('0x42')]);var _0x5eabdb={'where':_0x56a7ab['where']};return db[_0x32d9('0x2f')][_0x32d9('0x24')](_0x5eabdb)['then'](function(_0x2eeb32){_0x11909b[_0x32d9('0x24')]=_0x2eeb32;if(_0x272449[_0x32d9('0x33')][_0x32d9('0x43')]){_0x56a7ab['include']=[{'all':!![]}];}return db['Campaign'][_0x32d9('0x44')](_0x56a7ab);})[_0x32d9('0x28')](function(_0x12c469){_0x11909b[_0x32d9('0x45')]=_0x12c469;return _0x11909b;})[_0x32d9('0x28')](respondWithFilteredResult(_0xda0f8f,_0x56a7ab))[_0x32d9('0x46')](handleError(_0xda0f8f,null));};exports[_0x32d9('0x47')]=function(_0x15f42f,_0x2edc21){var _0x4344dc={'raw':![],'where':{'id':_0x15f42f[_0x32d9('0x48')]['id']}},_0x56c419={};_0x56c419['model']=_[_0x32d9('0x34')](db[_0x32d9('0x2f')][_0x32d9('0x49')]);_0x56c419['query']=_['keys'](_0x15f42f['query']);_0x56c419[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x56c419['model'],_0x56c419[_0x32d9('0x33')]);_0x4344dc['attributes']=_[_0x32d9('0x36')](_0x56c419['model'],qs[_0x32d9('0x39')](_0x15f42f[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4344dc[_0x32d9('0x38')]=_0x4344dc[_0x32d9('0x38')]['length']?_0x4344dc[_0x32d9('0x38')]:_0x56c419[_0x32d9('0x37')];if(_0x15f42f[_0x32d9('0x33')]['includeAll']){_0x4344dc[_0x32d9('0x4a')]=[{'all':!![]}];}_0x4344dc=_[_0x32d9('0x40')]({},_0x4344dc,_0x15f42f[_0x32d9('0x42')]);return db[_0x32d9('0x2f')][_0x32d9('0x4b')](_0x4344dc)['then'](handleEntityNotFound(_0x2edc21,null))[_0x32d9('0x28')](respondWithResult(_0x2edc21,null))[_0x32d9('0x46')](handleError(_0x2edc21,null));};exports[_0x32d9('0x4c')]=function(_0x433d90,_0x4f0df5){return db['Campaign'][_0x32d9('0x4c')](_0x433d90[_0x32d9('0x4d')],{})[_0x32d9('0x28')](function(_0x39eee9){var _0x26959d=_0x433d90[_0x32d9('0x4e')][_0x32d9('0x29')]({'plain':!![]});if(!_0x26959d)throw new Error(_0x32d9('0x4f'));if(_0x26959d['role']===_0x32d9('0x4e')){var _0x1d7425=_0x39eee9[_0x32d9('0x29')]({'plain':!![]});var _0x4d1197='IvrCampaigns';return db[_0x32d9('0x50')][_0x32d9('0x4b')]({'where':{'name':_0x4d1197,'userProfileId':_0x26959d[_0x32d9('0x51')]},'raw':!![]})[_0x32d9('0x28')](function(_0x144dac){if(_0x144dac&&_0x144dac[_0x32d9('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d7425[_0x32d9('0x2c')],'resourceId':_0x1d7425['id'],'type':_0x144dac[_0x32d9('0x2c')],'sectionId':_0x144dac['id']},{})['then'](function(){return _0x39eee9;});}else{return _0x39eee9;}})[_0x32d9('0x46')](function(_0x284127){logger['error'](_0x32d9('0x53'),_0x284127);throw _0x284127;});}return _0x39eee9;})[_0x32d9('0x28')](respondWithResult(_0x4f0df5,0xc9))[_0x32d9('0x46')](handleError(_0x4f0df5,null));};exports[_0x32d9('0x54')]=function(_0x1900da,_0xc3b38d){var _0x5a88a2={'where':{'id':_0x1900da[_0x32d9('0x48')]['id']}},_0x25d06b={};_0x25d06b[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x2f')]['rawAttributes']);_0x5a88a2[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x25d06b[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x1900da[_0x32d9('0x33')][_0x32d9('0x39')]));_0x5a88a2[_0x32d9('0x38')]=_0x5a88a2['attributes'][_0x32d9('0x3a')]?_0x5a88a2[_0x32d9('0x38')]:_0x25d06b[_0x32d9('0x37')];if(_0x1900da[_0x32d9('0x33')]['includeAll']){_0x5a88a2['include']=[{'all':!![]}];}_0x5a88a2=_[_0x32d9('0x40')]({},_0x5a88a2,_0x1900da[_0x32d9('0x42')]);return db[_0x32d9('0x2f')][_0x32d9('0x4b')](_0x5a88a2)['then'](handleEntityNotFound(_0xc3b38d,null))[_0x32d9('0x28')](function(_0x26e5bb){if(_0x26e5bb){var _0x5930dd=_0x26e5bb[_0x32d9('0x29')]({'plain':!![]});_0x5930dd=qs['omit'](_0x5930dd,['id','createdAt',_0x32d9('0x55')]);_0x1900da[_0x32d9('0x4d')]=_[_0x32d9('0x56')](_0x1900da[_0x32d9('0x4d')],['id','createdAt',_0x32d9('0x55')]);return db[_0x32d9('0x2f')]['create'](_['merge'](_0x5930dd,_0x1900da[_0x32d9('0x4d')]),{'include':_0x1900da[_0x32d9('0x33')][_0x32d9('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x29f194){var _0x144d16=_0x1900da[_0x32d9('0x4e')][_0x32d9('0x29')]({'plain':!![]});if(!_0x144d16)throw new Error(_0x32d9('0x4f'));if(_0x144d16[_0x32d9('0x57')]==='user'){var _0x371922=_0x29f194[_0x32d9('0x29')]({'plain':!![]});var _0x5127d8='IvrCampaigns';return db[_0x32d9('0x50')][_0x32d9('0x4b')]({'where':{'name':_0x5127d8,'userProfileId':_0x144d16[_0x32d9('0x51')]},'raw':!![]})[_0x32d9('0x28')](function(_0x2f3f19){if(_0x2f3f19&&_0x2f3f19[_0x32d9('0x52')]===0x0){return db['UserProfileResource'][_0x32d9('0x4c')]({'name':_0x371922[_0x32d9('0x2c')],'resourceId':_0x371922['id'],'type':_0x2f3f19[_0x32d9('0x2c')],'sectionId':_0x2f3f19['id']},{})[_0x32d9('0x28')](function(){return _0x29f194;});}else{return _0x29f194;}})['catch'](function(_0x38a176){logger[_0x32d9('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a176);throw _0x38a176;});}return _0x29f194;});}})['then'](respondWithResult(_0xc3b38d,0xc9))[_0x32d9('0x46')](handleError(_0xc3b38d,null));};exports[_0x32d9('0x59')]=function(_0x2e0601,_0x17f450){if(_0x2e0601['body']['id']){delete _0x2e0601['body']['id'];}return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x2e0601[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x17f450,null))[_0x32d9('0x28')](saveUpdates(_0x2e0601[_0x32d9('0x4d')],null))[_0x32d9('0x28')](respondWithResult(_0x17f450,null))['catch'](handleError(_0x17f450,null));};exports[_0x32d9('0x2b')]=function(_0x4a2dfe,_0x1aab0d){return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x4a2dfe['params']['id']}})['then'](handleEntityNotFound(_0x1aab0d,null))[_0x32d9('0x28')](removeEntity(_0x1aab0d,null))[_0x32d9('0x46')](handleError(_0x1aab0d,null));};exports['getHoppers']=function(_0x12fbc3,_0x5331c7,_0x17e95e){var _0x4d854d={'raw':!![],'where':{}};var _0x12bd39={};var _0x50f93f={'count':0x0,'rows':[]};return db[_0x32d9('0x2f')]['findOne']({'where':{'id':_0x12fbc3[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x5331c7,null))['then'](function(_0x510ffc){if(_0x510ffc){_0x12bd39[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x5a')][_0x32d9('0x49')]);_0x12bd39[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x12fbc3[_0x32d9('0x33')]);_0x12bd39[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x12bd39['model'],_0x12bd39['query']);_0x4d854d[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x12bd39[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4d854d[_0x32d9('0x38')]=_0x4d854d['attributes'][_0x32d9('0x3a')]?_0x4d854d[_0x32d9('0x38')]:_0x12bd39[_0x32d9('0x37')];if(!_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x4d854d[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x12fbc3['query'][_0x32d9('0x22')]);_0x4d854d['offset']=qs['offset'](_0x12fbc3[_0x32d9('0x33')]['offset']);}_0x4d854d[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x4d854d[_0x32d9('0x3e')]=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x12fbc3[_0x32d9('0x33')],_0x12bd39['filters']));_0x4d854d[_0x32d9('0x3e')]['CampaignId']=_0x510ffc['id'];if(_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x4d854d['where']=_['merge'](_0x4d854d['where'],{'$or':_[_0x32d9('0x2e')](_0x4d854d['attributes'],function(_0x41bc2b){var _0x554a36={};_0x554a36[_0x41bc2b]={'$like':'%'+_0x12fbc3[_0x32d9('0x33')]['filter']+'%'};return _0x554a36;})});}_0x4d854d=_['merge']({},_0x4d854d,_0x12fbc3['options']);return db[_0x32d9('0x5a')][_0x32d9('0x24')]({'where':_0x4d854d['where']})[_0x32d9('0x28')](function(_0xd3fd19){_0x50f93f['count']=_0xd3fd19;if(_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x43')]){_0x4d854d[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x5a')]['findAll'](_0x4d854d);})[_0x32d9('0x28')](function(_0x874bb0){_0x50f93f[_0x32d9('0x45')]=_0x874bb0;return _0x50f93f;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x5331c7,_0x4d854d))[_0x32d9('0x46')](handleError(_0x5331c7,null));};exports[_0x32d9('0x5d')]=function(_0x13aff0,_0x157cbf,_0x4d916e){var _0x72cdce={'raw':!![],'where':{}};var _0x4bdb42={};var _0x5d6ddf={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x13aff0[_0x32d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x157cbf,null))[_0x32d9('0x28')](function(_0x12b96a){if(_0x12b96a){_0x4bdb42[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x5e')][_0x32d9('0x49')]);_0x4bdb42[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x13aff0['query']);_0x4bdb42[_0x32d9('0x35')]=_['intersection'](_0x4bdb42[_0x32d9('0x37')],_0x4bdb42[_0x32d9('0x33')]);_0x72cdce[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x4bdb42[_0x32d9('0x37')],qs['fields'](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x39')]));_0x72cdce[_0x32d9('0x38')]=_0x72cdce[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x72cdce[_0x32d9('0x38')]:_0x4bdb42[_0x32d9('0x37')];if(!_0x13aff0['query'][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x72cdce[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x22')]);_0x72cdce[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x72cdce[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x72cdce[_0x32d9('0x3e')]=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x13aff0['query'],_0x4bdb42[_0x32d9('0x35')]));_0x72cdce[_0x32d9('0x3e')][_0x32d9('0x5f')]=_0x12b96a['id'];if(_0x13aff0[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x72cdce[_0x32d9('0x3e')]=_[_0x32d9('0x40')](_0x72cdce['where'],{'$or':_[_0x32d9('0x2e')](_0x72cdce['attributes'],function(_0x28dffd){var _0x78fcbf={};_0x78fcbf[_0x28dffd]={'$like':'%'+_0x13aff0[_0x32d9('0x33')]['filter']+'%'};return _0x78fcbf;})});}_0x72cdce=_[_0x32d9('0x40')]({},_0x72cdce,_0x13aff0[_0x32d9('0x42')]);return db['CmHopperHistory'][_0x32d9('0x24')]({'where':_0x72cdce[_0x32d9('0x3e')]})[_0x32d9('0x28')](function(_0x38ac3e){_0x5d6ddf[_0x32d9('0x24')]=_0x38ac3e;if(_0x13aff0[_0x32d9('0x33')][_0x32d9('0x43')]){_0x72cdce[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x5e')][_0x32d9('0x44')](_0x72cdce);})[_0x32d9('0x28')](function(_0x44ef70){_0x5d6ddf[_0x32d9('0x45')]=_0x44ef70;return _0x5d6ddf;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x157cbf,_0x72cdce))[_0x32d9('0x46')](handleError(_0x157cbf,null));};exports['getHopperFinals']=function(_0x36307e,_0x448e2d,_0x27bc3e){var _0x3c4d00={'raw':!![],'where':{}};var _0x5bef97={};var _0x173c0d={'count':0x0,'rows':[]};return db[_0x32d9('0x2f')][_0x32d9('0x60')]({'where':{'id':_0x36307e[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x448e2d,null))[_0x32d9('0x28')](function(_0x4fe8ee){if(_0x4fe8ee){_0x5bef97[_0x32d9('0x37')]=_[_0x32d9('0x34')](db['CmHopperFinal']['rawAttributes']);_0x5bef97[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x36307e[_0x32d9('0x33')]);_0x5bef97['filters']=_[_0x32d9('0x36')](_0x5bef97[_0x32d9('0x37')],_0x5bef97[_0x32d9('0x33')]);_0x3c4d00[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x5bef97[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x36307e['query'][_0x32d9('0x39')]));_0x3c4d00['attributes']=_0x3c4d00['attributes'][_0x32d9('0x3a')]?_0x3c4d00[_0x32d9('0x38')]:_0x5bef97['model'];if(!_0x36307e['query'][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x3c4d00[_0x32d9('0x22')]=qs['limit'](_0x36307e[_0x32d9('0x33')][_0x32d9('0x22')]);_0x3c4d00[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x36307e[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x3c4d00['order']=qs[_0x32d9('0x3d')](_0x36307e[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x3c4d00['where']=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x36307e['query'],_0x5bef97['filters']));_0x3c4d00[_0x32d9('0x3e')][_0x32d9('0x5f')]=_0x4fe8ee['id'];if(_0x36307e[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x3c4d00[_0x32d9('0x3e')]=_[_0x32d9('0x40')](_0x3c4d00[_0x32d9('0x3e')],{'$or':_[_0x32d9('0x2e')](_0x3c4d00[_0x32d9('0x38')],function(_0xcabef5){var _0x356fed={};_0x356fed[_0xcabef5]={'$like':'%'+_0x36307e[_0x32d9('0x33')][_0x32d9('0x3f')]+'%'};return _0x356fed;})});}_0x3c4d00=_[_0x32d9('0x40')]({},_0x3c4d00,_0x36307e[_0x32d9('0x42')]);return db[_0x32d9('0x61')][_0x32d9('0x24')]({'where':_0x3c4d00[_0x32d9('0x3e')]})[_0x32d9('0x28')](function(_0x3add4b){_0x173c0d[_0x32d9('0x24')]=_0x3add4b;if(_0x36307e[_0x32d9('0x33')]['includeAll']){_0x3c4d00[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x61')]['findAll'](_0x3c4d00);})[_0x32d9('0x28')](function(_0x35fe87){_0x173c0d['rows']=_0x35fe87;return _0x173c0d;});}})['then'](respondWithFilteredResult(_0x448e2d,_0x3c4d00))[_0x32d9('0x46')](handleError(_0x448e2d,null));};exports[_0x32d9('0x62')]=function(_0x36d678,_0x81bde8,_0x57a314){var _0x4ee997={'raw':!![],'where':{}};var _0x5d086f={};var _0x43104e={'count':0x0,'rows':[]};return db[_0x32d9('0x2f')]['findOne']({'where':{'id':_0x36d678[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x81bde8,null))[_0x32d9('0x28')](function(_0x55aa22){if(_0x55aa22){_0x5d086f[_0x32d9('0x37')]=_['keys'](db[_0x32d9('0x63')][_0x32d9('0x49')]);_0x5d086f['query']=_['keys'](_0x36d678[_0x32d9('0x33')]);_0x5d086f[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x5d086f['model'],_0x5d086f['query']);_0x4ee997[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x5d086f[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x36d678[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4ee997[_0x32d9('0x38')]=_0x4ee997[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x4ee997[_0x32d9('0x38')]:_0x5d086f[_0x32d9('0x37')];if(!_0x36d678[_0x32d9('0x33')][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x4ee997[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x36d678[_0x32d9('0x33')][_0x32d9('0x22')]);_0x4ee997[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x36d678[_0x32d9('0x33')]['offset']);}_0x4ee997['order']=qs[_0x32d9('0x3d')](_0x36d678[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x4ee997[_0x32d9('0x3e')]=qs['filters'](_[_0x32d9('0x5c')](_0x36d678['query'],_0x5d086f[_0x32d9('0x35')]));_0x4ee997[_0x32d9('0x3e')][_0x32d9('0x5f')]=_0x55aa22['id'];if(_0x36d678['query'][_0x32d9('0x3f')]){_0x4ee997['where']=_[_0x32d9('0x40')](_0x4ee997['where'],{'$or':_[_0x32d9('0x2e')](_0x4ee997[_0x32d9('0x38')],function(_0x550a28){var _0x3acec2={};_0x3acec2[_0x550a28]={'$like':'%'+_0x36d678[_0x32d9('0x33')][_0x32d9('0x3f')]+'%'};return _0x3acec2;})});}_0x4ee997=_[_0x32d9('0x40')]({},_0x4ee997,_0x36d678[_0x32d9('0x42')]);return db[_0x32d9('0x63')][_0x32d9('0x24')]({'where':_0x4ee997[_0x32d9('0x3e')]})['then'](function(_0x402244){_0x43104e[_0x32d9('0x24')]=_0x402244;if(_0x36d678['query']['includeAll']){_0x4ee997[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x63')][_0x32d9('0x44')](_0x4ee997);})['then'](function(_0x5f40d5){_0x43104e[_0x32d9('0x45')]=_0x5f40d5;return _0x43104e;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x81bde8,_0x4ee997))[_0x32d9('0x46')](handleError(_0x81bde8,null));};exports[_0x32d9('0x64')]=function(_0x3c451,_0x10a0f4,_0x469afc){var _0x37f1de={};var _0x5bf416={};var _0x2e0ded;var _0x5123f3;return db[_0x32d9('0x2f')][_0x32d9('0x60')]({'where':{'id':_0x3c451[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x10a0f4,null))[_0x32d9('0x28')](function(_0x16edce){if(_0x16edce){_0x2e0ded=_0x16edce;_0x5bf416[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x65')][_0x32d9('0x49')]);_0x5bf416[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x3c451[_0x32d9('0x33')]);_0x5bf416[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x5bf416[_0x32d9('0x37')],_0x5bf416[_0x32d9('0x33')]);_0x37f1de[_0x32d9('0x38')]=_['intersection'](_0x5bf416[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x3c451[_0x32d9('0x33')][_0x32d9('0x39')]));_0x37f1de[_0x32d9('0x38')]=_0x37f1de[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x37f1de[_0x32d9('0x38')]:_0x5bf416[_0x32d9('0x37')];_0x37f1de[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x3c451['query'][_0x32d9('0x3d')]);_0x37f1de['where']=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x3c451[_0x32d9('0x33')],_0x5bf416[_0x32d9('0x35')]));if(_0x3c451['query'][_0x32d9('0x3f')]){_0x37f1de['where']=_[_0x32d9('0x40')](_0x37f1de[_0x32d9('0x3e')],{'$or':_['map'](_0x37f1de[_0x32d9('0x38')],function(_0x48ad55){var _0x487931={};_0x487931[_0x48ad55]={'$like':'%'+_0x3c451[_0x32d9('0x33')]['filter']+'%'};return _0x487931;})});}_0x37f1de=_[_0x32d9('0x40')]({},_0x37f1de,_0x3c451[_0x32d9('0x42')]);return _0x2e0ded['getLists'](_0x37f1de);}})[_0x32d9('0x28')](function(_0xa797db){if(_0xa797db){_0x5123f3=_0xa797db['length'];if(!_0x3c451[_0x32d9('0x33')][_0x32d9('0x3b')]('nolimit')){_0x37f1de[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x3c451[_0x32d9('0x33')]['limit']);_0x37f1de[_0x32d9('0x21')]=qs['offset'](_0x3c451[_0x32d9('0x33')][_0x32d9('0x21')]);}return _0x2e0ded[_0x32d9('0x64')](_0x37f1de);}})[_0x32d9('0x28')](function(_0x258c45){if(_0x258c45){return _0x258c45?{'count':_0x5123f3,'rows':_0x258c45}:null;}})[_0x32d9('0x28')](respondWithResult(_0x10a0f4,null))['catch'](handleError(_0x10a0f4,null));};exports[_0x32d9('0x66')]=function(_0x7da7dd,_0x173357,_0xab4efe){var _0x7de90d,_0x5e2ee5;var _0x4cad65=[];var _0xa9b008=moment()[_0x32d9('0x67')](_0x32d9('0x68'));return db[_0x32d9('0x2f')]['find']({'where':{'id':_0x7da7dd[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x173357,null))[_0x32d9('0x28')](function(_0x1fcb19){if(_0x1fcb19){_0x5e2ee5=_0x1fcb19;return _0x1fcb19[_0x32d9('0x66')](_0x7da7dd[_0x32d9('0x4d')]['ids'],_[_0x32d9('0x56')](_0x7da7dd[_0x32d9('0x4d')],[_0x32d9('0x69'),'id'])||{});}return null;})[_0x32d9('0x6a')](function(_0xaafb5d){var _0x11df73;var _0x3d687c;_0x7de90d=_0xaafb5d||[];var _0x5786f0=[];if(_0xaafb5d){for(var _0x2335db=0x0;_0x2335db<_0xaafb5d[_0x32d9('0x3a')];_0x2335db+=0x1){var _0x4bc6bf=_0xaafb5d[_0x2335db]['get']({'plain':!![]});_0x5e2ee5[_0x32d9('0x6b')]=_0x7da7dd['body'][_0x32d9('0x6b')]?_0x7da7dd['body'][_0x32d9('0x6b')]:_0x5e2ee5['dialCheckDuplicateType'];switch(_0x5e2ee5['dialCheckDuplicateType']){case _0x32d9('0x6c'):_0x11df73=squel[_0x32d9('0x6d')]()[_0x32d9('0x6e')](_0x32d9('0x6f'))[_0x32d9('0x70')]([_0x32d9('0x71'),'scheduledAt',_0x32d9('0x72'),'ListId',_0x32d9('0x5f'),_0x32d9('0x73'),_0x32d9('0x55')],squel[_0x32d9('0x74')]()['field'](_0x32d9('0x71'),_0x32d9('0x71'))[_0x32d9('0x75')]('NOW()',_0x32d9('0x76'))['field']('id',_0x32d9('0x72'))[_0x32d9('0x75')](_0x4bc6bf['CmListId']['toString'](),_0x32d9('0x77'))['field'](_0x7da7dd['params']['id'][_0x32d9('0x78')](),'CampaignId')[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x73'))[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x55'))['from'](_0x32d9('0x79'))[_0x32d9('0x3e')](_0x32d9('0x7a'))[_0x32d9('0x3e')]('ListId\x20=\x20?',_0x4bc6bf[_0x32d9('0x7b')][_0x32d9('0x78')]())[_0x32d9('0x3e')](_0x32d9('0x7c'))[_0x32d9('0x3e')](_0x32d9('0x7d'),squel[_0x32d9('0x74')]()['field'](_0x32d9('0x7e'))['from'](_0x32d9('0x7f'))[_0x32d9('0x3e')](_0x32d9('0x80'),_0x7da7dd[_0x32d9('0x48')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x32d9('0x74')]()[_0x32d9('0x75')](_0x32d9('0x81'))[_0x32d9('0x82')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x7da7dd[_0x32d9('0x48')]['id'][_0x32d9('0x78')]())))[_0x32d9('0x78')]();break;case _0x32d9('0x83'):_0x11df73=squel[_0x32d9('0x6d')]()['into'](_0x32d9('0x6f'))['fromQuery']([_0x32d9('0x71'),_0x32d9('0x76'),_0x32d9('0x72'),_0x32d9('0x77'),'CampaignId',_0x32d9('0x73'),_0x32d9('0x55')],squel[_0x32d9('0x74')]()[_0x32d9('0x75')](_0x32d9('0x71'),_0x32d9('0x71'))[_0x32d9('0x75')]('NOW()',_0x32d9('0x76'))['field']('id',_0x32d9('0x72'))['field'](_0x4bc6bf[_0x32d9('0x7b')][_0x32d9('0x78')](),_0x32d9('0x77'))[_0x32d9('0x75')](_0x7da7dd[_0x32d9('0x48')]['id']['toString'](),_0x32d9('0x5f'))[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x73'))[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x55'))['from'](_0x32d9('0x79'))[_0x32d9('0x3e')]('deletedAt\x20IS\x20NULL')[_0x32d9('0x3e')]('ListId\x20=\x20?',_0x4bc6bf[_0x32d9('0x7b')][_0x32d9('0x78')]())[_0x32d9('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x32d9('0x3e')](_0x32d9('0x7d'),squel['select']()['field'](_0x32d9('0x81'))['from'](_0x32d9('0x6f'))[_0x32d9('0x3e')](_0x32d9('0x80'),_0x7da7dd[_0x32d9('0x48')]['id'][_0x32d9('0x78')]())))[_0x32d9('0x78')]();break;default:_0x11df73=squel[_0x32d9('0x6d')]()[_0x32d9('0x6e')](_0x32d9('0x6f'))[_0x32d9('0x70')](['phone','scheduledAt',_0x32d9('0x72'),_0x32d9('0x77'),'CampaignId',_0x32d9('0x73'),_0x32d9('0x55')],squel[_0x32d9('0x74')]()['field'](_0x32d9('0x71'),_0x32d9('0x71'))[_0x32d9('0x75')](_0x32d9('0x84'),'scheduledAt')[_0x32d9('0x75')]('id',_0x32d9('0x72'))['field'](_0x4bc6bf[_0x32d9('0x7b')][_0x32d9('0x78')](),_0x32d9('0x77'))['field'](_0x7da7dd[_0x32d9('0x48')]['id'][_0x32d9('0x78')](),'CampaignId')[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x73'))['field']('\x27'+_0xa9b008+'\x27',_0x32d9('0x55'))['from']('cm_contacts')[_0x32d9('0x3e')](_0x32d9('0x7a'))[_0x32d9('0x3e')]('ListId\x20=\x20?',_0x4bc6bf[_0x32d9('0x7b')]['toString']())[_0x32d9('0x3e')](_0x32d9('0x7c')))['toString']();}_0x3d687c=squel[_0x32d9('0x6d')]()[_0x32d9('0x6e')](_0x32d9('0x85'))['fromQuery']([_0x32d9('0x86'),_0x32d9('0x76'),_0x32d9('0x71'),_0x32d9('0x87'),_0x32d9('0x73'),_0x32d9('0x55')],squel[_0x32d9('0x74')]()[_0x32d9('0x75')](_0x32d9('0x88'),'id')['field'](_0x32d9('0x84'),_0x32d9('0x76'))[_0x32d9('0x75')](_0x32d9('0x89'),'phone')[_0x32d9('0x75')](_0x32d9('0x8a'),'OrderBy')[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x73'))[_0x32d9('0x75')]('\x27'+_0xa9b008+'\x27',_0x32d9('0x55'))['from']('cm_contact_has_items','ci')['join']('cm_hopper','h',_0x32d9('0x8b'))['where']('h.ListId\x20=\x20?',_0x4bc6bf[_0x32d9('0x7b')]['toString']())[_0x32d9('0x3e')](_0x32d9('0x8c'),_0x7da7dd[_0x32d9('0x48')]['id'][_0x32d9('0x78')]())[_0x32d9('0x3e')](_0x32d9('0x8d'),_0xa9b008))[_0x32d9('0x78')]();_0x5786f0['push'](db[_0x32d9('0x8e')][_0x32d9('0x33')](_0x11df73));_0x4cad65[_0x32d9('0x8f')](db['sequelize'][_0x32d9('0x33')](_0x3d687c));}return BPromise[_0x32d9('0x90')](_0x5786f0);}})[_0x32d9('0x28')](function(){return BPromise[_0x32d9('0x90')](_0x4cad65);})['then'](function(){return _0x7de90d;})[_0x32d9('0x28')](respondWithResult(_0x173357,null))[_0x32d9('0x46')](handleError(_0x173357,null));};exports['removeLists']=function(_0x4a80af,_0x3ef361,_0x340371){return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x4a80af[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x3ef361,null))['then'](function(_0x52299d){if(_0x52299d){return _0x52299d[_0x32d9('0x91')](_0x4a80af['query'][_0x32d9('0x69')]);}})['then'](function(_0x12bd60){if(_0x12bd60){return db[_0x32d9('0x5a')][_0x32d9('0x2b')]({'where':{'ListId':_0x4a80af[_0x32d9('0x33')][_0x32d9('0x69')],'CampaignId':_0x4a80af[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](function(){return _0x12bd60;});}})[_0x32d9('0x28')](respondWithStatusCode(_0x3ef361,null))[_0x32d9('0x46')](handleError(_0x3ef361,null));};exports[_0x32d9('0x92')]=function(_0x2223b0,_0x453aff,_0x3aaf4a){var _0x428d48={};var _0x1ac7fa={};var _0x31fb09;var _0x5ed849;return db[_0x32d9('0x2f')][_0x32d9('0x60')]({'where':{'id':_0x2223b0[_0x32d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x453aff,null))[_0x32d9('0x28')](function(_0x150ceb){if(_0x150ceb){_0x31fb09=_0x150ceb;_0x1ac7fa[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x65')][_0x32d9('0x49')]);_0x1ac7fa[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x2223b0[_0x32d9('0x33')]);_0x1ac7fa[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x1ac7fa[_0x32d9('0x37')],_0x1ac7fa[_0x32d9('0x33')]);_0x428d48[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x1ac7fa[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x2223b0['query']['fields']));_0x428d48[_0x32d9('0x38')]=_0x428d48[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x428d48[_0x32d9('0x38')]:_0x1ac7fa[_0x32d9('0x37')];_0x428d48[_0x32d9('0x3c')]=qs['sort'](_0x2223b0[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x428d48[_0x32d9('0x3e')]=qs['filters'](_[_0x32d9('0x5c')](_0x2223b0[_0x32d9('0x33')],_0x1ac7fa[_0x32d9('0x35')]));if(_0x2223b0['query'][_0x32d9('0x3f')]){_0x428d48['where']=_[_0x32d9('0x40')](_0x428d48[_0x32d9('0x3e')],{'$or':_[_0x32d9('0x2e')](_0x428d48[_0x32d9('0x38')],function(_0x20f8ae){var _0x4239e3={};_0x4239e3[_0x20f8ae]={'$like':'%'+_0x2223b0[_0x32d9('0x33')]['filter']+'%'};return _0x4239e3;})});}_0x428d48=_['merge']({},_0x428d48,_0x2223b0[_0x32d9('0x42')]);return _0x31fb09['getBlackLists'](_0x428d48);}})['then'](function(_0x2c5d81){if(_0x2c5d81){_0x5ed849=_0x2c5d81[_0x32d9('0x3a')];if(!_0x2223b0[_0x32d9('0x33')][_0x32d9('0x3b')]('nolimit')){_0x428d48[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x2223b0[_0x32d9('0x33')][_0x32d9('0x22')]);_0x428d48['offset']=qs[_0x32d9('0x21')](_0x2223b0[_0x32d9('0x33')]['offset']);}return _0x31fb09[_0x32d9('0x92')](_0x428d48);}})[_0x32d9('0x28')](function(_0x2d9793){if(_0x2d9793){return _0x2d9793?{'count':_0x5ed849,'rows':_0x2d9793}:null;}})[_0x32d9('0x28')](respondWithResult(_0x453aff,null))[_0x32d9('0x46')](handleError(_0x453aff,null));};exports[_0x32d9('0x93')]=function(_0xf0d31c,_0x5814db,_0x101225){var _0xd03dc1,_0x1894c3;var _0x12e0ef=[];var _0x39d1a6=moment()[_0x32d9('0x67')](_0x32d9('0x68'));return db['Campaign'][_0x32d9('0x4b')]({'where':{'id':_0xf0d31c[_0x32d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x5814db,null))[_0x32d9('0x28')](function(_0x3a614b){if(_0x3a614b){_0x1894c3=_0x3a614b;return _0x3a614b['addBlackLists'](_0xf0d31c[_0x32d9('0x4d')][_0x32d9('0x69')],_['omit'](_0xf0d31c['body'],[_0x32d9('0x69'),'id'])||{});}return null;})[_0x32d9('0x6a')](function(_0x3af376){var _0x258d61;var _0x4b3577;_0xd03dc1=_0x3af376||[];var _0x50c867=[];if(_0x3af376){for(var _0x57da0e=0x0;_0x57da0e<_0x3af376[_0x32d9('0x3a')];_0x57da0e+=0x1){var _0x2ca451=_0x3af376[_0x57da0e][_0x32d9('0x29')]({'plain':!![]});_0x258d61=squel[_0x32d9('0x6d')]()[_0x32d9('0x6e')](_0x32d9('0x94'))[_0x32d9('0x70')]([_0x32d9('0x71'),_0x32d9('0x72'),_0x32d9('0x77'),_0x32d9('0x5f'),_0x32d9('0x73'),'updatedAt'],squel[_0x32d9('0x74')]()[_0x32d9('0x75')](_0x32d9('0x71'),'phone')[_0x32d9('0x75')]('id',_0x32d9('0x72'))['field'](_0x2ca451[_0x32d9('0x7b')][_0x32d9('0x78')](),_0x32d9('0x77'))[_0x32d9('0x75')](_0xf0d31c[_0x32d9('0x48')]['id'][_0x32d9('0x78')](),_0x32d9('0x5f'))[_0x32d9('0x75')]('NOW()',_0x32d9('0x73'))['field'](_0x32d9('0x84'),_0x32d9('0x55'))[_0x32d9('0x82')](_0x32d9('0x79'))[_0x32d9('0x3e')](_0x32d9('0x7a'))['where']('ListId\x20=\x20?',_0x2ca451[_0x32d9('0x7b')]['toString']())[_0x32d9('0x3e')](_0x32d9('0x7c')))[_0x32d9('0x78')]();_0x50c867[_0x32d9('0x8f')](db[_0x32d9('0x8e')][_0x32d9('0x33')](_0x258d61));}return BPromise[_0x32d9('0x90')](_0x50c867);}})[_0x32d9('0x28')](function(){return _0xd03dc1;})['then'](respondWithResult(_0x5814db,null))[_0x32d9('0x46')](handleError(_0x5814db,null));};exports[_0x32d9('0x95')]=function(_0x20911c,_0x4821e6,_0xb0db18){return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x20911c[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x4821e6,null))['then'](function(_0xaa1f53){if(_0xaa1f53){return _0xaa1f53['removeBlackLists'](_0x20911c[_0x32d9('0x33')][_0x32d9('0x69')]);}})[_0x32d9('0x28')](function(_0xea2c91){if(_0xea2c91){return db[_0x32d9('0x63')][_0x32d9('0x2b')]({'where':{'ListId':_0x20911c[_0x32d9('0x33')][_0x32d9('0x69')],'CampaignId':_0x20911c['params']['id']}})[_0x32d9('0x28')](function(){return _0xea2c91;});}})[_0x32d9('0x28')](respondWithStatusCode(_0x4821e6,null))[_0x32d9('0x46')](handleError(_0x4821e6,null));};
\ No newline at end of file
index 0dfb8b3..81b6698 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x360ec,_0x585d47){var _0xf03953=function(_0xf081db){while(--_0xf081db){_0x360ec['push'](_0x360ec['shift']());}};_0xf03953(++_0x585d47);}(_0x7a54,0x106));var _0x47a5=function(_0x243051,_0x9e8bdf){_0x243051=_0x243051-0x0;var _0x49178a=_0x7a54[_0x243051];return _0x49178a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b5eff9d..0e7f32b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2121=['request\x20sent','stringify','error','message','GetCampaign','Campaign','options','raw','where','limit','include','map','model','attributes','debug','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x2121,0x1b4));var _0x1212=function(_0x39dae1,_0x168688){_0x39dae1=_0x39dae1-0x0;var _0x3f4c46=_0x2121[_0x39dae1];return _0x3f4c46;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1212('0x2'));var fs=require('fs');var Redis=require(_0x1212('0x3'));var db=require(_0x1212('0x4'))['db'];var utils=require(_0x1212('0x5'));var logger=require(_0x1212('0x6'))('rpc');var config=require(_0x1212('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1212('0x8')][_0x1212('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fadc,_0x1b1ef5,_0x233a53){return new BPromise(function(_0x642ed5,_0x4a3d2a){return client[_0x1212('0xa')](_0x20fadc,_0x233a53)[_0x1212('0xb')](function(_0x434d23){logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x1b1ef5,_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));if(_0x434d23[_0x1212('0x10')]){if(_0x434d23[_0x1212('0x10')]['code']===0x1f4){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x4a3d2a(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x642ed5(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}else{logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));_0x642ed5(_0x434d23['result']['message']);}})['catch'](function(_0x3cfe21){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x3cfe21);_0x4a3d2a(_0x3cfe21);});});}exports[_0x1212('0x12')]=function(_0x3cf284){var _0x3face0=this;return new Promise(function(_0xb0dc88,_0x22eefb){return db[_0x1212('0x13')]['findAll']({'raw':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x15')]===undefined?!![]:![]:!![],'where':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x16')]||null:null,'attributes':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')]['attributes']||null:null,'limit':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x17')]||null:null,'include':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x18')]?_[_0x1212('0x19')](_0x3cf284[_0x1212('0x14')]['include'],function(_0x58ab5b){return{'model':db[_0x58ab5b['model']],'as':_0x58ab5b['as'],'attributes':_0x58ab5b['attributes'],'include':_0x58ab5b['include']?_[_0x1212('0x19')](_0x58ab5b[_0x1212('0x18')],function(_0x4c32a7){return{'model':db[_0x4c32a7[_0x1212('0x1a')]],'as':_0x4c32a7['as'],'attributes':_0x4c32a7[_0x1212('0x1b')],'include':_0x4c32a7['include']?_[_0x1212('0x19')](_0x4c32a7[_0x1212('0x18')],function(_0x4630b4){return{'model':db[_0x4630b4[_0x1212('0x1a')]],'as':_0x4630b4['as'],'attributes':_0x4630b4[_0x1212('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1212('0xb')](function(_0x2750b0){logger[_0x1212('0xc')]('GetCampaign',_0x3cf284);logger[_0x1212('0x1c')](_0x1212('0x12'),_0x3cf284,JSON[_0x1212('0xf')](_0x2750b0));_0xb0dc88(_0x2750b0);})[_0x1212('0x1d')](function(_0x17d0f6){logger[_0x1212('0x10')](_0x1212('0x12'),_0x17d0f6[_0x1212('0x11')],_0x3cf284);_0x22eefb(_0x3face0[_0x1212('0x10')](0x1f4,_0x17d0f6[_0x1212('0x11')]));});});};
\ No newline at end of file
+var _0xfdb5=['model','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','findAll','options','raw','where','include','map'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xfdb5[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x5fdb('0x0'));var util=require(_0x5fdb('0x1'));var moment=require(_0x5fdb('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fdb('0x3'));var fs=require('fs');var Redis=require(_0x5fdb('0x4'));var db=require(_0x5fdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5fdb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5fdb('0x7'));var client=jayson['client'][_0x5fdb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xda053e,_0x4b6fe0,_0x542bbc){return new BPromise(function(_0x5a556e,_0x340588){return client[_0x5fdb('0x9')](_0xda053e,_0x542bbc)[_0x5fdb('0xa')](function(_0x25cef8){logger[_0x5fdb('0xb')](_0x5fdb('0xc'),_0x4b6fe0,_0x5fdb('0xd'));logger['debug'](_0x5fdb('0xe'),_0x4b6fe0,'request\x20sent',JSON[_0x5fdb('0xf')](_0x25cef8));if(_0x25cef8[_0x5fdb('0x10')]){if(_0x25cef8[_0x5fdb('0x10')]['code']===0x1f4){logger[_0x5fdb('0x10')]('Campaign,\x20%s,\x20%s',_0x4b6fe0,_0x25cef8[_0x5fdb('0x10')][_0x5fdb('0x11')]);return _0x340588(_0x25cef8['error'][_0x5fdb('0x11')]);}logger[_0x5fdb('0x10')](_0x5fdb('0xc'),_0x4b6fe0,_0x25cef8['error'][_0x5fdb('0x11')]);return _0x5a556e(_0x25cef8[_0x5fdb('0x10')][_0x5fdb('0x11')]);}else{logger[_0x5fdb('0xb')](_0x5fdb('0xc'),_0x4b6fe0,_0x5fdb('0xd'));_0x5a556e(_0x25cef8['result']['message']);}})[_0x5fdb('0x12')](function(_0x5f1ddc){logger[_0x5fdb('0x10')](_0x5fdb('0xc'),_0x4b6fe0,_0x5f1ddc);_0x340588(_0x5f1ddc);});});}exports[_0x5fdb('0x13')]=function(_0x47a10f){var _0x15fa3e=this;return new Promise(function(_0xb8c99f,_0xf27e5d){return db[_0x5fdb('0x14')][_0x5fdb('0x15')]({'raw':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f['options'][_0x5fdb('0x17')]===undefined?!![]:![]:!![],'where':_0x47a10f['options']?_0x47a10f['options'][_0x5fdb('0x18')]||null:null,'attributes':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f[_0x5fdb('0x16')]['attributes']||null:null,'limit':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f[_0x5fdb('0x16')]['limit']||null:null,'include':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f[_0x5fdb('0x16')]['include']?_['map'](_0x47a10f['options']['include'],function(_0x15d2ec){return{'model':db[_0x15d2ec['model']],'as':_0x15d2ec['as'],'attributes':_0x15d2ec['attributes'],'include':_0x15d2ec[_0x5fdb('0x19')]?_[_0x5fdb('0x1a')](_0x15d2ec[_0x5fdb('0x19')],function(_0x49e795){return{'model':db[_0x49e795[_0x5fdb('0x1b')]],'as':_0x49e795['as'],'attributes':_0x49e795[_0x5fdb('0x1c')],'include':_0x49e795[_0x5fdb('0x19')]?_[_0x5fdb('0x1a')](_0x49e795['include'],function(_0x200eaf){return{'model':db[_0x200eaf['model']],'as':_0x200eaf['as'],'attributes':_0x200eaf[_0x5fdb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5fdb('0xa')](function(_0x488843){logger[_0x5fdb('0xb')]('GetCampaign',_0x47a10f);logger[_0x5fdb('0x1d')](_0x5fdb('0x13'),_0x47a10f,JSON['stringify'](_0x488843));_0xb8c99f(_0x488843);})['catch'](function(_0xa5c0e2){logger[_0x5fdb('0x10')](_0x5fdb('0x13'),_0xa5c0e2[_0x5fdb('0x11')],_0x47a10f);_0xf27e5d(_0x15fa3e[_0x5fdb('0x10')](0x1f4,_0xa5c0e2['message']));});});};
\ No newline at end of file
index 8ccee1b..ca75948 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85d3=['index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated'];(function(_0x83865f,_0x207fd3){var _0x4162c2=function(_0x58e29){while(--_0x58e29){_0x83865f['push'](_0x83865f['shift']());}};_0x4162c2(++_0x207fd3);}(_0x85d3,0x141));var _0x385d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x85d3[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var path=require(_0x385d('0x2'));var timeout=require(_0x385d('0x3'));var express=require(_0x385d('0x4'));var router=express[_0x385d('0x5')]();var fs_extra=require(_0x385d('0x6'));var auth=require(_0x385d('0x7'));var interaction=require(_0x385d('0x8'));var config=require('../../config/environment');var controller=require(_0x385d('0x9'));router[_0x385d('0xa')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0xc')]);router[_0x385d('0xa')](_0x385d('0xd'),auth[_0x385d('0xb')](),controller[_0x385d('0xe')]);router[_0x385d('0xa')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x385d('0xf')]);router[_0x385d('0xa')](_0x385d('0x10'),auth['isAuthenticated'](),controller[_0x385d('0x11')]);router[_0x385d('0xa')](_0x385d('0x12'),auth[_0x385d('0xb')](),controller[_0x385d('0x13')]);router[_0x385d('0xa')](_0x385d('0x14'),auth[_0x385d('0xb')](),controller['getHopperBlacks']);router['get'](_0x385d('0x15'),auth[_0x385d('0xb')](),controller[_0x385d('0x16')]);router[_0x385d('0xa')](_0x385d('0x17'),auth['isAuthenticated'](),controller[_0x385d('0x18')]);router[_0x385d('0x19')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0x1a')]);router[_0x385d('0x19')]('/:id/clone',auth[_0x385d('0xb')](),controller[_0x385d('0x1b')]);router[_0x385d('0x19')](_0x385d('0x15'),auth[_0x385d('0xb')](),controller[_0x385d('0x1c')]);router[_0x385d('0x19')](_0x385d('0x17'),auth[_0x385d('0xb')](),controller[_0x385d('0x1d')]);router[_0x385d('0x1e')](_0x385d('0xd'),auth[_0x385d('0xb')](),controller[_0x385d('0x1f')]);router[_0x385d('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x385d('0x21')]);router[_0x385d('0x20')](_0x385d('0x15'),auth[_0x385d('0xb')](),controller[_0x385d('0x22')]);router[_0x385d('0x20')](_0x385d('0x17'),auth[_0x385d('0xb')](),controller[_0x385d('0x23')]);module[_0x385d('0x24')]=router;
\ No newline at end of file
+var _0x7ea8=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','update','delete','destroy','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories'];(function(_0x8d65d2,_0x17511d){var _0x109850=function(_0x2a1d84){while(--_0x2a1d84){_0x8d65d2['push'](_0x8d65d2['shift']());}};_0x109850(++_0x17511d);}(_0x7ea8,0x1d1));var _0x87ea=function(_0x3edfa0,_0x5c56b0){_0x3edfa0=_0x3edfa0-0x0;var _0x161427=_0x7ea8[_0x3edfa0];return _0x161427;};'use strict';var multer=require(_0x87ea('0x0'));var util=require(_0x87ea('0x1'));var path=require(_0x87ea('0x2'));var timeout=require(_0x87ea('0x3'));var express=require(_0x87ea('0x4'));var router=express['Router']();var fs_extra=require(_0x87ea('0x5'));var auth=require(_0x87ea('0x6'));var interaction=require(_0x87ea('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x87ea('0x8')]('/',auth[_0x87ea('0x9')](),controller[_0x87ea('0xa')]);router[_0x87ea('0x8')](_0x87ea('0xb'),auth[_0x87ea('0x9')](),controller[_0x87ea('0xc')]);router[_0x87ea('0x8')]('/:id/hoppers',auth[_0x87ea('0x9')](),controller[_0x87ea('0xd')]);router[_0x87ea('0x8')](_0x87ea('0xe'),auth[_0x87ea('0x9')](),controller['getHopperHistories']);router[_0x87ea('0x8')]('/:id/hopper_finals',auth[_0x87ea('0x9')](),controller[_0x87ea('0xf')]);router[_0x87ea('0x8')](_0x87ea('0x10'),auth['isAuthenticated'](),controller[_0x87ea('0x11')]);router['get'](_0x87ea('0x12'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x13')]);router[_0x87ea('0x8')](_0x87ea('0x14'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x15')]);router[_0x87ea('0x16')]('/',auth['isAuthenticated'](),controller[_0x87ea('0x17')]);router[_0x87ea('0x16')]('/:id/clone',auth[_0x87ea('0x9')](),controller[_0x87ea('0x18')]);router['post'](_0x87ea('0x12'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x19')]);router[_0x87ea('0x16')](_0x87ea('0x14'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x1a')]);router['put'](_0x87ea('0xb'),auth['isAuthenticated'](),controller[_0x87ea('0x1b')]);router[_0x87ea('0x1c')](_0x87ea('0xb'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x1d')]);router['delete'](_0x87ea('0x12'),auth[_0x87ea('0x9')](),controller['removeLists']);router[_0x87ea('0x1c')](_0x87ea('0x14'),auth[_0x87ea('0x9')](),controller[_0x87ea('0x1e')]);module[_0x87ea('0x1f')]=router;
\ No newline at end of file
index a82890a..1a1d53c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcfd6=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x5c1d32,_0x19dd05){var _0x5a1e7d=function(_0xbee65e){while(--_0xbee65e){_0x5c1d32['push'](_0x5c1d32['shift']());}};_0x5a1e7d(++_0x19dd05);}(_0xcfd6,0x117));var _0x6cfd=function(_0x16b2a3,_0x14ae95){_0x16b2a3=_0x16b2a3-0x0;var _0x5ee973=_0xcfd6[_0x16b2a3];return _0x5ee973;};'use strict';var Sequelize=require(_0x6cfd('0x0'));module[_0x6cfd('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6cfd('0x2')]},'name':{'type':Sequelize[_0x6cfd('0x3')],'get':function(){return this[_0x6cfd('0x4')](_0x6cfd('0x5'));}}};
\ No newline at end of file
+var _0x13bf=['key','sequelize','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x39503d,_0x234d7f){var _0x418a75=function(_0x5bcd19){while(--_0x5bcd19){_0x39503d['push'](_0x39503d['shift']());}};_0x418a75(++_0x234d7f);}(_0x13bf,0xd9));var _0xf13b=function(_0xf065da,_0x2b8b75){_0xf065da=_0xf065da-0x0;var _0x1cb515=_0x13bf[_0xf065da];return _0x1cb515;};'use strict';var Sequelize=require(_0xf13b('0x0'));module['exports']={'key':{'type':Sequelize[_0xf13b('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xf13b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf13b('0x1')]},'name':{'type':Sequelize[_0xf13b('0x3')],'get':function(){return this[_0xf13b('0x4')](_0xf13b('0x5'));}}};
\ No newline at end of file
index 939c46b..70942ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc936=['includeAll','include','findAll','rows','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','CannedAnswer'];(function(_0x5bf85a,_0x4360fe){var _0x31fbc2=function(_0x130c74){while(--_0x130c74){_0x5bf85a['push'](_0x5bf85a['shift']());}};_0x31fbc2(++_0x4360fe);}(_0xc936,0x1cc));var _0x6c93=function(_0x5eb2b4,_0x2fb1f1){_0x5eb2b4=_0x5eb2b4-0x0;var _0x4b434a=_0xc936[_0x5eb2b4];return _0x4b434a;};'use strict';var emlformat=require(_0x6c93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c93('0x1'));var jsonpatch=require(_0x6c93('0x2'));var rp=require(_0x6c93('0x3'));var moment=require(_0x6c93('0x4'));var BPromise=require(_0x6c93('0x5'));var Mustache=require('mustache');var util=require(_0x6c93('0x6'));var path=require('path');var sox=require(_0x6c93('0x7'));var csv=require(_0x6c93('0x8'));var ejs=require(_0x6c93('0x9'));var fs=require('fs');var fs_extra=require(_0x6c93('0xa'));var _=require('lodash');var squel=require(_0x6c93('0xb'));var crypto=require(_0x6c93('0xc'));var jsforce=require(_0x6c93('0xd'));var deskjs=require(_0x6c93('0xe'));var toCsv=require(_0x6c93('0x8'));var querystring=require(_0x6c93('0xf'));var Papa=require(_0x6c93('0x10'));var Redis=require(_0x6c93('0x11'));var authService=require(_0x6c93('0x12'));var qs=require(_0x6c93('0x13'));var as=require(_0x6c93('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c93('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6c93('0x16'));var licenseUtil=require(_0x6c93('0x17'));var db=require(_0x6c93('0x18'))['db'];function respondWithStatusCode(_0x3243d8,_0x43c52d){_0x43c52d=_0x43c52d||0xcc;return function(_0x59bc39){if(_0x59bc39){return _0x3243d8[_0x6c93('0x19')](_0x43c52d);}return _0x3243d8['status'](_0x43c52d)[_0x6c93('0x1a')]();};}function respondWithResult(_0x7da011,_0xdd53e9){_0xdd53e9=_0xdd53e9||0xc8;return function(_0x1cb86f){if(_0x1cb86f){return _0x7da011['status'](_0xdd53e9)[_0x6c93('0x1b')](_0x1cb86f);}};}function respondWithFilteredResult(_0x3b3424,_0x1258ee){return function(_0x8cb9d5){if(_0x8cb9d5){var _0x2a1ff9=typeof _0x1258ee[_0x6c93('0x1c')]===_0x6c93('0x1d')&&typeof _0x1258ee['limit']===_0x6c93('0x1d');var _0x4881ed=_0x8cb9d5['count'];var _0x30a53a=_0x2a1ff9?0x0:_0x1258ee[_0x6c93('0x1c')];var _0xd41cca=_0x2a1ff9?_0x8cb9d5[_0x6c93('0x1e')]:_0x1258ee['offset']+_0x1258ee['limit'];var _0x2968e5;if(_0xd41cca>=_0x4881ed){_0xd41cca=_0x4881ed;_0x2968e5=0xc8;}else{_0x2968e5=0xce;}_0x3b3424[_0x6c93('0x1f')](_0x2968e5);return _0x3b3424['set'](_0x6c93('0x20'),_0x30a53a+'-'+_0xd41cca+'/'+_0x4881ed)[_0x6c93('0x1b')](_0x8cb9d5);}return null;};}function patchUpdates(_0x461313){return function(_0x3b8c28){try{jsonpatch[_0x6c93('0x21')](_0x3b8c28,_0x461313,!![]);}catch(_0x1ce48f){return BPromise['reject'](_0x1ce48f);}return _0x3b8c28[_0x6c93('0x22')]();};}function saveUpdates(_0x5186e8,_0x55e9f2){return function(_0x1a2d8e){if(_0x1a2d8e){return _0x1a2d8e[_0x6c93('0x23')](_0x5186e8)[_0x6c93('0x24')](function(_0x480dc5){return _0x480dc5;});}return null;};}function removeEntity(_0x45fd9d,_0x132558){return function(_0x47cf07){if(_0x47cf07){return _0x47cf07[_0x6c93('0x25')]()[_0x6c93('0x24')](function(){var _0x271333=_0x47cf07[_0x6c93('0x26')]({'plain':!![]});var _0x2e5a60=_0x6c93('0x27');return db[_0x6c93('0x28')][_0x6c93('0x25')]({'where':{'type':_0x2e5a60,'resourceId':_0x271333['id']}})[_0x6c93('0x24')](function(){return _0x47cf07;});})['then'](function(){_0x45fd9d[_0x6c93('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1680ba,_0x4ca4a0){return function(_0x23876f){if(!_0x23876f){_0x1680ba[_0x6c93('0x19')](0x194);}return _0x23876f;};}function handleError(_0x3d823f,_0x1983a3){_0x1983a3=_0x1983a3||0x1f4;return function(_0x4da25a){logger['error'](_0x4da25a['stack']);if(_0x4da25a['name']){delete _0x4da25a[_0x6c93('0x29')];}_0x3d823f['status'](_0x1983a3)[_0x6c93('0x2a')](_0x4da25a);};}exports[_0x6c93('0x2b')]=function(_0x2fe03b,_0x3846f8){var _0x1e1121={},_0x31e89a={},_0xd8f5da={'count':0x0,'rows':[]};var _0xee864f=_[_0x6c93('0x2c')](db['CannedAnswer'][_0x6c93('0x2d')],function(_0x3fdc49){return{'name':_0x3fdc49[_0x6c93('0x2e')],'type':_0x3fdc49[_0x6c93('0x2f')][_0x6c93('0x30')]};});_0x31e89a[_0x6c93('0x31')]=_['map'](_0xee864f,_0x6c93('0x29'));_0x31e89a['query']=_[_0x6c93('0x32')](_0x2fe03b[_0x6c93('0x33')]);_0x31e89a[_0x6c93('0x34')]=_[_0x6c93('0x35')](_0x31e89a[_0x6c93('0x31')],_0x31e89a[_0x6c93('0x33')]);_0x1e1121[_0x6c93('0x36')]=_['intersection'](_0x31e89a[_0x6c93('0x31')],qs[_0x6c93('0x37')](_0x2fe03b[_0x6c93('0x33')][_0x6c93('0x37')]));_0x1e1121[_0x6c93('0x36')]=_0x1e1121[_0x6c93('0x36')][_0x6c93('0x38')]?_0x1e1121[_0x6c93('0x36')]:_0x31e89a['model'];if(!_0x2fe03b[_0x6c93('0x33')][_0x6c93('0x39')](_0x6c93('0x3a'))){_0x1e1121[_0x6c93('0x3b')]=qs[_0x6c93('0x3b')](_0x2fe03b['query'][_0x6c93('0x3b')]);_0x1e1121[_0x6c93('0x1c')]=qs['offset'](_0x2fe03b['query']['offset']);}_0x1e1121[_0x6c93('0x3c')]=qs['sort'](_0x2fe03b['query'][_0x6c93('0x3d')]);_0x1e1121[_0x6c93('0x3e')]=qs[_0x6c93('0x34')](_[_0x6c93('0x3f')](_0x2fe03b[_0x6c93('0x33')],_0x31e89a[_0x6c93('0x34')]),_0xee864f);if(_0x2fe03b[_0x6c93('0x33')][_0x6c93('0x40')]){_0x1e1121[_0x6c93('0x3e')]=_[_0x6c93('0x41')](_0x1e1121[_0x6c93('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2fe03b['query'][_0x6c93('0x40')]+'%'}},{'value':{'$like':'%'+_0x2fe03b['query'][_0x6c93('0x40')]+'%'}}]});}_0x1e1121=_[_0x6c93('0x41')]({},_0x1e1121,_0x2fe03b[_0x6c93('0x42')]);var _0x2cab16={'where':_0x1e1121['where']};return db[_0x6c93('0x43')][_0x6c93('0x1e')](_0x2cab16)[_0x6c93('0x24')](function(_0x488ac2){_0xd8f5da[_0x6c93('0x1e')]=_0x488ac2;if(_0x2fe03b[_0x6c93('0x33')][_0x6c93('0x44')]){_0x1e1121[_0x6c93('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6c93('0x46')](_0x1e1121);})[_0x6c93('0x24')](function(_0x1dd5ff){_0xd8f5da[_0x6c93('0x47')]=_0x1dd5ff;return _0xd8f5da;})[_0x6c93('0x24')](respondWithFilteredResult(_0x3846f8,_0x1e1121))[_0x6c93('0x48')](handleError(_0x3846f8,null));};exports['show']=function(_0x3bafb1,_0x4f90f0){var _0x2fcb4c={'raw':!![],'where':{'id':_0x3bafb1[_0x6c93('0x49')]['id']}},_0x21c26b={};_0x21c26b[_0x6c93('0x31')]=_[_0x6c93('0x32')](db[_0x6c93('0x43')]['rawAttributes']);_0x21c26b[_0x6c93('0x33')]=_[_0x6c93('0x32')](_0x3bafb1['query']);_0x21c26b['filters']=_[_0x6c93('0x35')](_0x21c26b[_0x6c93('0x31')],_0x21c26b[_0x6c93('0x33')]);_0x2fcb4c['attributes']=_[_0x6c93('0x35')](_0x21c26b[_0x6c93('0x31')],qs['fields'](_0x3bafb1[_0x6c93('0x33')][_0x6c93('0x37')]));_0x2fcb4c[_0x6c93('0x36')]=_0x2fcb4c[_0x6c93('0x36')][_0x6c93('0x38')]?_0x2fcb4c[_0x6c93('0x36')]:_0x21c26b[_0x6c93('0x31')];if(_0x3bafb1[_0x6c93('0x33')][_0x6c93('0x44')]){_0x2fcb4c['include']=[{'all':!![]}];}_0x2fcb4c=_[_0x6c93('0x41')]({},_0x2fcb4c,_0x3bafb1[_0x6c93('0x42')]);return db[_0x6c93('0x43')][_0x6c93('0x4a')](_0x2fcb4c)[_0x6c93('0x24')](handleEntityNotFound(_0x4f90f0,null))[_0x6c93('0x24')](respondWithResult(_0x4f90f0,null))['catch'](handleError(_0x4f90f0,null));};exports[_0x6c93('0x23')]=function(_0x311614,_0x2924e8){if(_0x311614[_0x6c93('0x4b')]['id']){delete _0x311614[_0x6c93('0x4b')]['id'];}return db[_0x6c93('0x43')][_0x6c93('0x4a')]({'where':{'id':_0x311614['params']['id']}})[_0x6c93('0x24')](handleEntityNotFound(_0x2924e8,null))[_0x6c93('0x24')](saveUpdates(_0x311614[_0x6c93('0x4b')],null))['then'](respondWithResult(_0x2924e8,null))[_0x6c93('0x48')](handleError(_0x2924e8,null));};exports[_0x6c93('0x25')]=function(_0x3189c7,_0x2d659d){return db[_0x6c93('0x43')][_0x6c93('0x4a')]({'where':{'id':_0x3189c7['params']['id']}})[_0x6c93('0x24')](handleEntityNotFound(_0x2d659d,null))[_0x6c93('0x24')](removeEntity(_0x2d659d,null))[_0x6c93('0x48')](handleError(_0x2d659d,null));};exports[_0x6c93('0x4c')]=function(_0x2b58ae,_0x44bb9e){var _0x35ac23={'key':_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x30')]};if(_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x4d')]){_0x35ac23[_0x6c93('0x4d')]=_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x4d')];}else if(_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x4e')]){_0x35ac23[_0x6c93('0x4e')]=_0x2b58ae['body']['SmsAccountId'];}else if(_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x4f')]){_0x35ac23[_0x6c93('0x4f')]=_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x4f')];}else if(_0x2b58ae['body'][_0x6c93('0x50')]){_0x35ac23[_0x6c93('0x50')]=_0x2b58ae[_0x6c93('0x4b')][_0x6c93('0x50')];}return db[_0x6c93('0x43')]['find']({'where':_0x35ac23})[_0x6c93('0x24')](function(_0x159e22){if(_0x159e22){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x6c93('0x43')]['create'](_0x2b58ae[_0x6c93('0x4b')]);})[_0x6c93('0x24')](function(_0x11e398){var _0x158f97=_0x2b58ae[_0x6c93('0x51')][_0x6c93('0x26')]({'plain':!![]});if(!_0x158f97)throw new Error(_0x6c93('0x52'));if(_0x158f97[_0x6c93('0x53')]===_0x6c93('0x51')){var _0x1d7dc1=_0x11e398[_0x6c93('0x26')]({'plain':!![]});return db[_0x6c93('0x54')][_0x6c93('0x4a')]({'where':{'name':_0x6c93('0x27'),'userProfileId':_0x158f97[_0x6c93('0x55')]},'raw':!![]})[_0x6c93('0x24')](function(_0x469c15){if(_0x469c15&&_0x469c15[_0x6c93('0x56')]===0x0){return db[_0x6c93('0x28')][_0x6c93('0x4c')]({'name':_0x1d7dc1[_0x6c93('0x29')],'resourceId':_0x1d7dc1['id'],'type':_0x469c15['name'],'sectionId':_0x469c15['id']},{})[_0x6c93('0x24')](function(){return _0x11e398;});}else{return _0x11e398;}})[_0x6c93('0x48')](function(_0x2bb122){logger[_0x6c93('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bb122);throw _0x2bb122;});}return _0x11e398;})['then'](respondWithResult(_0x44bb9e,0xc9))[_0x6c93('0x48')](handleError(_0x44bb9e,null));};
\ No newline at end of file
+var _0xdd48=['then','error','stack','name','send','CannedAnswer','fieldName','key','map','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','reject','save','update','destroy','get','CannedAnswers'];(function(_0x3f825c,_0x6e92e4){var _0x5cd0cf=function(_0x98fac6){while(--_0x98fac6){_0x3f825c['push'](_0x3f825c['shift']());}};_0x5cd0cf(++_0x6e92e4);}(_0xdd48,0xd9));var _0x8dd4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdd48[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x8dd4('0x0'));var rimraf=require(_0x8dd4('0x1'));var zipdir=require(_0x8dd4('0x2'));var jsonpatch=require(_0x8dd4('0x3'));var rp=require('request-promise');var moment=require(_0x8dd4('0x4'));var BPromise=require(_0x8dd4('0x5'));var Mustache=require(_0x8dd4('0x6'));var util=require(_0x8dd4('0x7'));var path=require(_0x8dd4('0x8'));var sox=require(_0x8dd4('0x9'));var csv=require(_0x8dd4('0xa'));var ejs=require(_0x8dd4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8dd4('0xc'));var squel=require(_0x8dd4('0xd'));var crypto=require(_0x8dd4('0xe'));var jsforce=require(_0x8dd4('0xf'));var deskjs=require(_0x8dd4('0x10'));var toCsv=require(_0x8dd4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8dd4('0x11'));var authService=require(_0x8dd4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8dd4('0x13'));var hardwareService=require(_0x8dd4('0x14'));var logger=require(_0x8dd4('0x15'))(_0x8dd4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8dd4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d0dd,_0x46cde9){_0x46cde9=_0x46cde9||0xcc;return function(_0x3d9ea4){if(_0x3d9ea4){return _0x59d0dd[_0x8dd4('0x18')](_0x46cde9);}return _0x59d0dd[_0x8dd4('0x19')](_0x46cde9)[_0x8dd4('0x1a')]();};}function respondWithResult(_0x426e8a,_0x8ce728){_0x8ce728=_0x8ce728||0xc8;return function(_0x2d3ce2){if(_0x2d3ce2){return _0x426e8a[_0x8dd4('0x19')](_0x8ce728)['json'](_0x2d3ce2);}};}function respondWithFilteredResult(_0x2d0cba,_0x2a5525){return function(_0x4e218f){if(_0x4e218f){var _0x5bcb14=typeof _0x2a5525[_0x8dd4('0x1b')]===_0x8dd4('0x1c')&&typeof _0x2a5525['limit']===_0x8dd4('0x1c');var _0x10c7e4=_0x4e218f[_0x8dd4('0x1d')];var _0x4689e6=_0x5bcb14?0x0:_0x2a5525[_0x8dd4('0x1b')];var _0x9d9142=_0x5bcb14?_0x4e218f['count']:_0x2a5525[_0x8dd4('0x1b')]+_0x2a5525[_0x8dd4('0x1e')];var _0x3f4d7e;if(_0x9d9142>=_0x10c7e4){_0x9d9142=_0x10c7e4;_0x3f4d7e=0xc8;}else{_0x3f4d7e=0xce;}_0x2d0cba['status'](_0x3f4d7e);return _0x2d0cba[_0x8dd4('0x1f')]('Content-Range',_0x4689e6+'-'+_0x9d9142+'/'+_0x10c7e4)['json'](_0x4e218f);}return null;};}function patchUpdates(_0x28a6f3){return function(_0x31fdda){try{jsonpatch['apply'](_0x31fdda,_0x28a6f3,!![]);}catch(_0x4d35b5){return BPromise[_0x8dd4('0x20')](_0x4d35b5);}return _0x31fdda[_0x8dd4('0x21')]();};}function saveUpdates(_0x4eaad8,_0x5ef613){return function(_0x37c919){if(_0x37c919){return _0x37c919[_0x8dd4('0x22')](_0x4eaad8)['then'](function(_0x530db3){return _0x530db3;});}return null;};}function removeEntity(_0x4b3c0a,_0x19cc37){return function(_0x4be65c){if(_0x4be65c){return _0x4be65c[_0x8dd4('0x23')]()['then'](function(){var _0x47b90a=_0x4be65c[_0x8dd4('0x24')]({'plain':!![]});var _0x542ab5=_0x8dd4('0x25');return db['UserProfileResource'][_0x8dd4('0x23')]({'where':{'type':_0x542ab5,'resourceId':_0x47b90a['id']}})[_0x8dd4('0x26')](function(){return _0x4be65c;});})[_0x8dd4('0x26')](function(){_0x4b3c0a[_0x8dd4('0x19')](0xcc)[_0x8dd4('0x1a')]();});}};}function handleEntityNotFound(_0x5df441,_0x4a187a){return function(_0x36c3ac){if(!_0x36c3ac){_0x5df441[_0x8dd4('0x18')](0x194);}return _0x36c3ac;};}function handleError(_0x19331f,_0x2818b2){_0x2818b2=_0x2818b2||0x1f4;return function(_0x4883a9){logger[_0x8dd4('0x27')](_0x4883a9[_0x8dd4('0x28')]);if(_0x4883a9[_0x8dd4('0x29')]){delete _0x4883a9[_0x8dd4('0x29')];}_0x19331f['status'](_0x2818b2)[_0x8dd4('0x2a')](_0x4883a9);};}exports['index']=function(_0x156303,_0xbd18a6){var _0x533a63={},_0x36c500={},_0x12a4a0={'count':0x0,'rows':[]};var _0x3b26c0=_['map'](db[_0x8dd4('0x2b')]['rawAttributes'],function(_0x341c61){return{'name':_0x341c61[_0x8dd4('0x2c')],'type':_0x341c61['type'][_0x8dd4('0x2d')]};});_0x36c500['model']=_[_0x8dd4('0x2e')](_0x3b26c0,_0x8dd4('0x29'));_0x36c500[_0x8dd4('0x2f')]=_['keys'](_0x156303['query']);_0x36c500[_0x8dd4('0x30')]=_['intersection'](_0x36c500['model'],_0x36c500[_0x8dd4('0x2f')]);_0x533a63[_0x8dd4('0x31')]=_[_0x8dd4('0x32')](_0x36c500['model'],qs[_0x8dd4('0x33')](_0x156303['query']['fields']));_0x533a63[_0x8dd4('0x31')]=_0x533a63[_0x8dd4('0x31')][_0x8dd4('0x34')]?_0x533a63[_0x8dd4('0x31')]:_0x36c500[_0x8dd4('0x35')];if(!_0x156303['query'][_0x8dd4('0x36')](_0x8dd4('0x37'))){_0x533a63[_0x8dd4('0x1e')]=qs[_0x8dd4('0x1e')](_0x156303[_0x8dd4('0x2f')][_0x8dd4('0x1e')]);_0x533a63['offset']=qs[_0x8dd4('0x1b')](_0x156303[_0x8dd4('0x2f')][_0x8dd4('0x1b')]);}_0x533a63['order']=qs[_0x8dd4('0x38')](_0x156303[_0x8dd4('0x2f')][_0x8dd4('0x38')]);_0x533a63[_0x8dd4('0x39')]=qs[_0x8dd4('0x30')](_[_0x8dd4('0x3a')](_0x156303['query'],_0x36c500[_0x8dd4('0x30')]),_0x3b26c0);if(_0x156303[_0x8dd4('0x2f')][_0x8dd4('0x3b')]){_0x533a63[_0x8dd4('0x39')]=_[_0x8dd4('0x3c')](_0x533a63[_0x8dd4('0x39')],{'$or':[{'key':{'$like':'%'+_0x156303[_0x8dd4('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0x156303[_0x8dd4('0x2f')][_0x8dd4('0x3b')]+'%'}}]});}_0x533a63=_[_0x8dd4('0x3c')]({},_0x533a63,_0x156303['options']);var _0x39f32c={'where':_0x533a63['where']};return db['CannedAnswer'][_0x8dd4('0x1d')](_0x39f32c)['then'](function(_0x316f25){_0x12a4a0[_0x8dd4('0x1d')]=_0x316f25;if(_0x156303[_0x8dd4('0x2f')][_0x8dd4('0x3d')]){_0x533a63[_0x8dd4('0x3e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8dd4('0x3f')](_0x533a63);})[_0x8dd4('0x26')](function(_0x39837f){_0x12a4a0[_0x8dd4('0x40')]=_0x39837f;return _0x12a4a0;})['then'](respondWithFilteredResult(_0xbd18a6,_0x533a63))[_0x8dd4('0x41')](handleError(_0xbd18a6,null));};exports[_0x8dd4('0x42')]=function(_0x44a314,_0x459f0c){var _0x2cf9ef={'raw':!![],'where':{'id':_0x44a314['params']['id']}},_0x5a5331={};_0x5a5331[_0x8dd4('0x35')]=_['keys'](db[_0x8dd4('0x2b')][_0x8dd4('0x43')]);_0x5a5331[_0x8dd4('0x2f')]=_[_0x8dd4('0x44')](_0x44a314[_0x8dd4('0x2f')]);_0x5a5331[_0x8dd4('0x30')]=_['intersection'](_0x5a5331[_0x8dd4('0x35')],_0x5a5331['query']);_0x2cf9ef['attributes']=_[_0x8dd4('0x32')](_0x5a5331[_0x8dd4('0x35')],qs[_0x8dd4('0x33')](_0x44a314['query'][_0x8dd4('0x33')]));_0x2cf9ef['attributes']=_0x2cf9ef[_0x8dd4('0x31')]['length']?_0x2cf9ef[_0x8dd4('0x31')]:_0x5a5331['model'];if(_0x44a314[_0x8dd4('0x2f')][_0x8dd4('0x3d')]){_0x2cf9ef[_0x8dd4('0x3e')]=[{'all':!![]}];}_0x2cf9ef=_['merge']({},_0x2cf9ef,_0x44a314['options']);return db[_0x8dd4('0x2b')][_0x8dd4('0x45')](_0x2cf9ef)[_0x8dd4('0x26')](handleEntityNotFound(_0x459f0c,null))['then'](respondWithResult(_0x459f0c,null))[_0x8dd4('0x41')](handleError(_0x459f0c,null));};exports[_0x8dd4('0x22')]=function(_0x4a0321,_0xe05a0c){if(_0x4a0321[_0x8dd4('0x46')]['id']){delete _0x4a0321[_0x8dd4('0x46')]['id'];}return db[_0x8dd4('0x2b')][_0x8dd4('0x45')]({'where':{'id':_0x4a0321['params']['id']}})[_0x8dd4('0x26')](handleEntityNotFound(_0xe05a0c,null))[_0x8dd4('0x26')](saveUpdates(_0x4a0321[_0x8dd4('0x46')],null))['then'](respondWithResult(_0xe05a0c,null))['catch'](handleError(_0xe05a0c,null));};exports[_0x8dd4('0x23')]=function(_0x5c8fb6,_0x3dba63){return db[_0x8dd4('0x2b')][_0x8dd4('0x45')]({'where':{'id':_0x5c8fb6['params']['id']}})[_0x8dd4('0x26')](handleEntityNotFound(_0x3dba63,null))[_0x8dd4('0x26')](removeEntity(_0x3dba63,null))[_0x8dd4('0x41')](handleError(_0x3dba63,null));};exports[_0x8dd4('0x47')]=function(_0x55d366,_0x54c34e){var _0x37feca={'key':_0x55d366[_0x8dd4('0x46')][_0x8dd4('0x2d')]};if(_0x55d366['body']['MailAccountId']){_0x37feca['MailAccountId']=_0x55d366[_0x8dd4('0x46')][_0x8dd4('0x48')];}else if(_0x55d366['body']['SmsAccountId']){_0x37feca[_0x8dd4('0x49')]=_0x55d366['body'][_0x8dd4('0x49')];}else if(_0x55d366[_0x8dd4('0x46')]['OpenchannelAccountId']){_0x37feca[_0x8dd4('0x4a')]=_0x55d366[_0x8dd4('0x46')][_0x8dd4('0x4a')];}else if(_0x55d366['body'][_0x8dd4('0x4b')]){_0x37feca[_0x8dd4('0x4b')]=_0x55d366['body'][_0x8dd4('0x4b')];}return db[_0x8dd4('0x2b')][_0x8dd4('0x45')]({'where':_0x37feca})[_0x8dd4('0x26')](function(_0x15195b){if(_0x15195b){throw new db['Sequelize'][(_0x8dd4('0x4c'))](_0x8dd4('0x4d'));}return db[_0x8dd4('0x2b')][_0x8dd4('0x47')](_0x55d366[_0x8dd4('0x46')]);})[_0x8dd4('0x26')](function(_0x53bdef){var _0xd8ab09=_0x55d366[_0x8dd4('0x4e')][_0x8dd4('0x24')]({'plain':!![]});if(!_0xd8ab09)throw new Error(_0x8dd4('0x4f'));if(_0xd8ab09[_0x8dd4('0x50')]==='user'){var _0x49664c=_0x53bdef[_0x8dd4('0x24')]({'plain':!![]});return db[_0x8dd4('0x51')][_0x8dd4('0x45')]({'where':{'name':_0x8dd4('0x25'),'userProfileId':_0xd8ab09[_0x8dd4('0x52')]},'raw':!![]})[_0x8dd4('0x26')](function(_0xe76cd0){if(_0xe76cd0&&_0xe76cd0[_0x8dd4('0x53')]===0x0){return db['UserProfileResource'][_0x8dd4('0x47')]({'name':_0x49664c['name'],'resourceId':_0x49664c['id'],'type':_0xe76cd0[_0x8dd4('0x29')],'sectionId':_0xe76cd0['id']},{})['then'](function(){return _0x53bdef;});}else{return _0x53bdef;}})[_0x8dd4('0x41')](function(_0xb355c3){logger[_0x8dd4('0x27')](_0x8dd4('0x54'),_0xb355c3);throw _0xb355c3;});}return _0x53bdef;})[_0x8dd4('0x26')](respondWithResult(_0x54c34e,0xc9))[_0x8dd4('0x41')](handleError(_0x54c34e,null));};
\ No newline at end of file
index df4b17a..3f6089e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac85=['../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x26c2ed,_0x385ba9){var _0x28c9fa=function(_0xf91911){while(--_0xf91911){_0x26c2ed['push'](_0x26c2ed['shift']());}};_0x28c9fa(++_0x385ba9);}(_0xac85,0xbd));var _0x5ac8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xac85[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var logger=require(_0x5ac8('0x2'))(_0x5ac8('0x3'));var moment=require('moment');var BPromise=require(_0x5ac8('0x4'));var rp=require(_0x5ac8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac8('0x6'));var config=require(_0x5ac8('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x5ac8('0x8')]=function(_0x2c3e60,_0x1dd588){return _0x2c3e60[_0x5ac8('0x9')](_0x5ac8('0xa'),attributes,{'tableName':_0x5ac8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ac8('0xc'),'collate':_0x5ac8('0xd')});};
\ No newline at end of file
+var _0x1ee7=['util','../../config/logger','request-promise','path','rimraf','./cannedAnswer.attributes','exports','utf8mb4_unicode_ci','lodash'];(function(_0x12e830,_0x980832){var _0x463d60=function(_0x12aafc){while(--_0x12aafc){_0x12e830['push'](_0x12e830['shift']());}};_0x463d60(++_0x980832);}(_0x1ee7,0xce));var _0x71ee=function(_0x3731d2,_0xaaf8f9){_0x3731d2=_0x3731d2-0x0;var _0xa3894f=_0x1ee7[_0x3731d2];return _0xa3894f;};'use strict';var _=require(_0x71ee('0x0'));var util=require(_0x71ee('0x1'));var logger=require(_0x71ee('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x71ee('0x3'));var fs=require('fs');var path=require(_0x71ee('0x4'));var rimraf=require(_0x71ee('0x5'));var config=require('../../config/environment');var attributes=require(_0x71ee('0x6'));module[_0x71ee('0x7')]=function(_0x39e402,_0x5d7d53){return _0x39e402['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x71ee('0x8')});};
\ No newline at end of file
index e249e4c..c524d53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x472aa6,_0x443557){var _0x2b55ed=function(_0x2afa1d){while(--_0x2afa1d){_0x472aa6['push'](_0x472aa6['shift']());}};_0x2b55ed(++_0x443557);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cd9ba,_0x27252f){var _0x235dc7=function(_0x3c1b87){while(--_0x3c1b87){_0x4cd9ba['push'](_0x4cd9ba['shift']());}};_0x235dc7(++_0x27252f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index d9f5213..281e6d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d88=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','update','delete','exports','multer','util','connect-timeout'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x3d88,0x16d));var _0x83d8=function(_0x2c1c5b,_0x1c0e99){_0x2c1c5b=_0x2c1c5b-0x0;var _0x2ecb6a=_0x3d88[_0x2c1c5b];return _0x2ecb6a;};'use strict';var multer=require(_0x83d8('0x0'));var util=require(_0x83d8('0x1'));var path=require('path');var timeout=require(_0x83d8('0x2'));var express=require('express');var router=express[_0x83d8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x83d8('0x4'));var interaction=require(_0x83d8('0x5'));var config=require(_0x83d8('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x83d8('0x7')](),controller[_0x83d8('0x8')]);router[_0x83d8('0x9')](_0x83d8('0xa'),auth[_0x83d8('0x7')](),controller[_0x83d8('0xb')]);router['post']('/',auth[_0x83d8('0x7')](),controller[_0x83d8('0xc')]);router['put'](_0x83d8('0xa'),auth[_0x83d8('0x7')](),controller[_0x83d8('0xd')]);router[_0x83d8('0xe')](_0x83d8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x83d8('0xf')]=router;
\ No newline at end of file
+var _0xc61d=['isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xc61d,0x16e));var _0xdc61=function(_0x527d77,_0x3afd3a){_0x527d77=_0x527d77-0x0;var _0x2884cf=_0xc61d[_0x527d77];return _0x2884cf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc61('0x0'));var timeout=require(_0xdc61('0x1'));var express=require('express');var router=express[_0xdc61('0x2')]();var fs_extra=require(_0xdc61('0x3'));var auth=require(_0xdc61('0x4'));var interaction=require(_0xdc61('0x5'));var config=require(_0xdc61('0x6'));var controller=require('./cannedAnswer.controller');router[_0xdc61('0x7')]('/',auth[_0xdc61('0x8')](),controller[_0xdc61('0x9')]);router[_0xdc61('0x7')](_0xdc61('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xdc61('0xb')]('/',auth[_0xdc61('0x8')](),controller[_0xdc61('0xc')]);router['put'](_0xdc61('0xa'),auth['isAuthenticated'](),controller[_0xdc61('0xd')]);router[_0xdc61('0xe')](_0xdc61('0xa'),auth[_0xdc61('0x8')](),controller[_0xdc61('0xf')]);module[_0xdc61('0x10')]=router;
\ No newline at end of file
index 4ee5ed5..64ed21c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e3f=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x441235,_0x46ad88){var _0x1e12c5=function(_0x2e8ed5){while(--_0x2e8ed5){_0x441235['push'](_0x441235['shift']());}};_0x1e12c5(++_0x46ad88);}(_0x9e3f,0x1f0));var _0xf9e3=function(_0x4de51f,_0x5eb593){_0x4de51f=_0x4de51f-0x0;var _0x343048=_0x9e3f[_0x4de51f];return _0x343048;};'use strict';var Sequelize=require(_0xf9e3('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf9e3('0x1')],'allowNull':![],'defaultValue':_0xf9e3('0x2')},'clid':{'type':Sequelize[_0xf9e3('0x3')]},'src':{'type':Sequelize[_0xf9e3('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xf9e3('0x3')]},'channel':{'type':Sequelize[_0xf9e3('0x3')]},'dstchannel':{'type':Sequelize[_0xf9e3('0x3')]},'lastapp':{'type':Sequelize[_0xf9e3('0x3')]},'lastdata':{'type':Sequelize[_0xf9e3('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf9e3('0x3')]},'amaflags':{'type':Sequelize[_0xf9e3('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf9e3('0x3')]},'userfield':{'type':Sequelize[_0xf9e3('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf9e3('0x3')]},'sequence':{'type':Sequelize[_0xf9e3('0x3')]},'peeraccount':{'type':Sequelize[_0xf9e3('0x3')]},'type':{'type':Sequelize[_0xf9e3('0x3')]},'tag':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x89e3=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x535986,_0x5f325b){var _0x2a3f4c=function(_0x4f165f){while(--_0x4f165f){_0x535986['push'](_0x535986['shift']());}};_0x2a3f4c(++_0x5f325b);}(_0x89e3,0x66));var _0x389e=function(_0x150fcf,_0x411fd9){_0x150fcf=_0x150fcf-0x0;var _0xd8d383=_0x89e3[_0x150fcf];return _0xd8d383;};'use strict';var Sequelize=require('sequelize');module[_0x389e('0x0')]={'calldate':{'type':Sequelize[_0x389e('0x1')],'allowNull':![],'defaultValue':_0x389e('0x2')},'clid':{'type':Sequelize[_0x389e('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x389e('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x389e('0x3')]},'lastapp':{'type':Sequelize[_0x389e('0x3')]},'lastdata':{'type':Sequelize[_0x389e('0x3')]},'duration':{'type':Sequelize[_0x389e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x389e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x389e('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x389e('0x3')]},'uniqueid':{'type':Sequelize[_0x389e('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x389e('0x3')]},'peeraccount':{'type':Sequelize[_0x389e('0x3')]},'type':{'type':Sequelize[_0x389e('0x3')]},'tag':{'type':Sequelize[_0x389e('0x3')]}};
\ No newline at end of file
index 200f842..d9f172b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0618=['catch','show','intersection','options','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','end','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows'];(function(_0x58df3b,_0x182132){var _0x1c82d6=function(_0x48b1a2){while(--_0x48b1a2){_0x58df3b['push'](_0x58df3b['shift']());}};_0x1c82d6(++_0x182132);}(_0x0618,0x1c6));var _0x8061=function(_0x52793e,_0x1e7bb4){_0x52793e=_0x52793e-0x0;var _0x5357bb=_0x0618[_0x52793e];return _0x5357bb;};'use strict';var emlformat=require(_0x8061('0x0'));var rimraf=require(_0x8061('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8061('0x2'));var rp=require(_0x8061('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8061('0x4'));var util=require(_0x8061('0x5'));var path=require(_0x8061('0x6'));var sox=require(_0x8061('0x7'));var csv=require(_0x8061('0x8'));var ejs=require(_0x8061('0x9'));var fs=require('fs');var fs_extra=require(_0x8061('0xa'));var _=require(_0x8061('0xb'));var squel=require(_0x8061('0xc'));var crypto=require(_0x8061('0xd'));var jsforce=require(_0x8061('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8061('0x8'));var querystring=require('querystring');var Papa=require(_0x8061('0xf'));var Redis=require(_0x8061('0x10'));var authService=require(_0x8061('0x11'));var qs=require(_0x8061('0x12'));var as=require(_0x8061('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8061('0x14'));var utils=require(_0x8061('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8061('0x16'))['db'];function respondWithStatusCode(_0x141707,_0x724e64){_0x724e64=_0x724e64||0xcc;return function(_0x3537f0){if(_0x3537f0){return _0x141707[_0x8061('0x17')](_0x724e64);}return _0x141707[_0x8061('0x18')](_0x724e64)['end']();};}function respondWithResult(_0x4df59c,_0x19ea89){_0x19ea89=_0x19ea89||0xc8;return function(_0x4da339){if(_0x4da339){return _0x4df59c[_0x8061('0x18')](_0x19ea89)[_0x8061('0x19')](_0x4da339);}};}function respondWithFilteredResult(_0x567988,_0x483af8){return function(_0x460dfd){if(_0x460dfd){var _0x3264ff=typeof _0x483af8[_0x8061('0x1a')]===_0x8061('0x1b')&&typeof _0x483af8[_0x8061('0x1c')]===_0x8061('0x1b');var _0x280f9b=_0x460dfd[_0x8061('0x1d')];var _0x2b0eab=_0x3264ff?0x0:_0x483af8[_0x8061('0x1a')];var _0x14230e=_0x3264ff?_0x460dfd[_0x8061('0x1d')]:_0x483af8[_0x8061('0x1a')]+_0x483af8['limit'];var _0x4d254d;if(_0x14230e>=_0x280f9b){_0x14230e=_0x280f9b;_0x4d254d=0xc8;}else{_0x4d254d=0xce;}_0x567988[_0x8061('0x18')](_0x4d254d);return _0x567988[_0x8061('0x1e')](_0x8061('0x1f'),_0x2b0eab+'-'+_0x14230e+'/'+_0x280f9b)['json'](_0x460dfd);}return null;};}function patchUpdates(_0x53f869){return function(_0x36ccd5){try{jsonpatch[_0x8061('0x20')](_0x36ccd5,_0x53f869,!![]);}catch(_0x2bc509){return BPromise[_0x8061('0x21')](_0x2bc509);}return _0x36ccd5['save']();};}function saveUpdates(_0x49f708,_0x1cd5ed){return function(_0x12e73d){if(_0x12e73d){return _0x12e73d['update'](_0x49f708)['then'](function(_0x3dbaea){return _0x3dbaea;});}return null;};}function removeEntity(_0x554faa,_0x535cc9){return function(_0x37bff0){if(_0x37bff0){return _0x37bff0[_0x8061('0x22')]()['then'](function(){_0x554faa['status'](0xcc)[_0x8061('0x23')]();});}};}function handleEntityNotFound(_0x3f2765,_0x4e0860){return function(_0x1b0ec7){if(!_0x1b0ec7){_0x3f2765[_0x8061('0x17')](0x194);}return _0x1b0ec7;};}function handleError(_0x39fb5c,_0x2f7544){_0x2f7544=_0x2f7544||0x1f4;return function(_0x5f0822){logger['error'](_0x5f0822[_0x8061('0x24')]);if(_0x5f0822[_0x8061('0x25')]){delete _0x5f0822[_0x8061('0x25')];}_0x39fb5c[_0x8061('0x18')](_0x2f7544)[_0x8061('0x26')](_0x5f0822);};}exports['index']=function(_0x4c9202,_0x518700){var _0x59a65d={},_0xfb9138={},_0x38317c={'count':0x0,'rows':[]};var _0x36714f=_[_0x8061('0x27')](db[_0x8061('0x28')][_0x8061('0x29')],function(_0x2d1537){return{'name':_0x2d1537[_0x8061('0x2a')],'type':_0x2d1537[_0x8061('0x2b')][_0x8061('0x2c')]};});_0xfb9138['model']=_['map'](_0x36714f,_0x8061('0x25'));_0xfb9138[_0x8061('0x2d')]=_[_0x8061('0x2e')](_0x4c9202[_0x8061('0x2d')]);_0xfb9138[_0x8061('0x2f')]=_['intersection'](_0xfb9138[_0x8061('0x30')],_0xfb9138[_0x8061('0x2d')]);_0x59a65d['attributes']=_['intersection'](_0xfb9138[_0x8061('0x30')],qs[_0x8061('0x31')](_0x4c9202['query'][_0x8061('0x31')]));_0x59a65d[_0x8061('0x32')]=_0x59a65d[_0x8061('0x32')][_0x8061('0x33')]?_0x59a65d[_0x8061('0x32')]:_0xfb9138[_0x8061('0x30')];if(!_0x4c9202[_0x8061('0x2d')][_0x8061('0x34')](_0x8061('0x35'))){_0x59a65d['limit']=qs[_0x8061('0x1c')](_0x4c9202[_0x8061('0x2d')][_0x8061('0x1c')]);_0x59a65d[_0x8061('0x1a')]=qs['offset'](_0x4c9202['query']['offset']);}_0x59a65d['order']=qs['sort'](_0x4c9202[_0x8061('0x2d')]['sort']);_0x59a65d[_0x8061('0x36')]=qs[_0x8061('0x2f')](_[_0x8061('0x37')](_0x4c9202[_0x8061('0x2d')],_0xfb9138[_0x8061('0x2f')]),_0x36714f);if(_0x4c9202['query'][_0x8061('0x38')]){_0x59a65d[_0x8061('0x36')]=_[_0x8061('0x39')](_0x59a65d[_0x8061('0x36')],{'$or':_[_0x8061('0x27')](_0x36714f,function(_0x31ed9d){if(_0x31ed9d[_0x8061('0x2b')]!==_0x8061('0x3a')){var _0x714833={};_0x714833[_0x31ed9d[_0x8061('0x25')]]={'$like':'%'+_0x4c9202[_0x8061('0x2d')][_0x8061('0x38')]+'%'};return _0x714833;}})});}_0x59a65d=_['merge']({},_0x59a65d,_0x4c9202['options']);var _0xb72481={'where':_0x59a65d['where']};return db[_0x8061('0x28')]['count'](_0xb72481)['then'](function(_0x105747){_0x38317c[_0x8061('0x1d')]=_0x105747;if(_0x4c9202[_0x8061('0x2d')][_0x8061('0x3b')]){_0x59a65d[_0x8061('0x3c')]=[{'all':!![]}];}return db[_0x8061('0x28')][_0x8061('0x3d')](_0x59a65d);})[_0x8061('0x3e')](function(_0x1475b1){_0x38317c[_0x8061('0x3f')]=_0x1475b1;return _0x38317c;})['then'](respondWithFilteredResult(_0x518700,_0x59a65d))[_0x8061('0x40')](handleError(_0x518700,null));};exports[_0x8061('0x41')]=function(_0x177ab1,_0x2675e3){var _0x4435b8={'raw':!![],'where':{'id':_0x177ab1['params']['id']}},_0x4ea342={};_0x4ea342[_0x8061('0x30')]=_[_0x8061('0x2e')](db[_0x8061('0x28')][_0x8061('0x29')]);_0x4ea342[_0x8061('0x2d')]=_[_0x8061('0x2e')](_0x177ab1[_0x8061('0x2d')]);_0x4ea342['filters']=_[_0x8061('0x42')](_0x4ea342[_0x8061('0x30')],_0x4ea342[_0x8061('0x2d')]);_0x4435b8[_0x8061('0x32')]=_[_0x8061('0x42')](_0x4ea342[_0x8061('0x30')],qs[_0x8061('0x31')](_0x177ab1['query'][_0x8061('0x31')]));_0x4435b8['attributes']=_0x4435b8[_0x8061('0x32')][_0x8061('0x33')]?_0x4435b8[_0x8061('0x32')]:_0x4ea342['model'];if(_0x177ab1['query'][_0x8061('0x3b')]){_0x4435b8[_0x8061('0x3c')]=[{'all':!![]}];}_0x4435b8=_[_0x8061('0x39')]({},_0x4435b8,_0x177ab1[_0x8061('0x43')]);return db[_0x8061('0x28')]['find'](_0x4435b8)['then'](handleEntityNotFound(_0x2675e3,null))[_0x8061('0x3e')](respondWithResult(_0x2675e3,null))['catch'](handleError(_0x2675e3,null));};exports[_0x8061('0x44')]=function(_0x393bc9,_0x54546a){return db[_0x8061('0x28')][_0x8061('0x44')](_0x393bc9[_0x8061('0x45')],{})[_0x8061('0x3e')](respondWithResult(_0x54546a,0xc9))['catch'](handleError(_0x54546a,null));};exports[_0x8061('0x46')]=function(_0xb1cc9d,_0x2eaab6){if(_0xb1cc9d[_0x8061('0x45')]['id']){delete _0xb1cc9d[_0x8061('0x45')]['id'];}return db[_0x8061('0x28')][_0x8061('0x47')]({'where':{'id':_0xb1cc9d[_0x8061('0x48')]['id']}})[_0x8061('0x3e')](handleEntityNotFound(_0x2eaab6,null))[_0x8061('0x3e')](saveUpdates(_0xb1cc9d[_0x8061('0x45')],null))[_0x8061('0x3e')](respondWithResult(_0x2eaab6,null))[_0x8061('0x40')](handleError(_0x2eaab6,null));};exports[_0x8061('0x22')]=function(_0x291c8b,_0x30771f){return db[_0x8061('0x28')]['find']({'where':{'id':_0x291c8b[_0x8061('0x48')]['id']}})[_0x8061('0x3e')](handleEntityNotFound(_0x30771f,null))[_0x8061('0x3e')](removeEntity(_0x30771f,null))[_0x8061('0x40')](handleError(_0x30771f,null));};exports['describe']=function(_0x2be970,_0xd63f0e){return db[_0x8061('0x28')][_0x8061('0x49')]()[_0x8061('0x3e')](respondWithResult(_0xd63f0e,null))[_0x8061('0x40')](handleError(_0xd63f0e,null));};
\ No newline at end of file
+var _0xa9b1=['where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter'];(function(_0x4c403d,_0x5ef49f){var _0x5a0c35=function(_0x40ba5a){while(--_0x40ba5a){_0x4c403d['push'](_0x4c403d['shift']());}};_0x5a0c35(++_0x5ef49f);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a9b('0x0'));var jsonpatch=require(_0x1a9b('0x1'));var rp=require(_0x1a9b('0x2'));var moment=require(_0x1a9b('0x3'));var BPromise=require(_0x1a9b('0x4'));var Mustache=require(_0x1a9b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a9b('0x6'));var ejs=require(_0x1a9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a9b('0x8'));var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x6'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=typeof _0x2a7d72[_0x1a9b('0x1a')]===_0x1a9b('0x1b')&&typeof _0x2a7d72[_0x1a9b('0x1c')]===_0x1a9b('0x1b');var _0x20b8dc=_0x57ca87[_0x1a9b('0x1d')];var _0x205a0d=_0x439acd?0x0:_0x2a7d72[_0x1a9b('0x1a')];var _0x1281c2=_0x439acd?_0x57ca87['count']:_0x2a7d72[_0x1a9b('0x1a')]+_0x2a7d72[_0x1a9b('0x1c')];var _0x3df7d2;if(_0x1281c2>=_0x20b8dc){_0x1281c2=_0x20b8dc;_0x3df7d2=0xc8;}else{_0x3df7d2=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3df7d2);return _0x55a00d['set'](_0x1a9b('0x1e'),_0x205a0d+'-'+_0x1281c2+'/'+_0x20b8dc)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x4b3cd3){return function(_0x23e327){try{jsonpatch[_0x1a9b('0x1f')](_0x23e327,_0x4b3cd3,!![]);}catch(_0x44cebf){return BPromise[_0x1a9b('0x20')](_0x44cebf);}return _0x23e327[_0x1a9b('0x21')]();};}function saveUpdates(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x22')](_0x590568)[_0x1a9b('0x23')](function(_0x36391a){return _0x36391a;});}return null;};}function removeEntity(_0x2e42f1,_0x28f937){return function(_0x488a33){if(_0x488a33){return _0x488a33[_0x1a9b('0x24')]()['then'](function(){_0x2e42f1[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0xad6541,_0x4e7234){return function(_0x213841){if(!_0x213841){_0xad6541[_0x1a9b('0x16')](0x194);}return _0x213841;};}function handleError(_0x1521f4,_0x181331){_0x181331=_0x181331||0x1f4;return function(_0x18c9dd){logger[_0x1a9b('0x25')](_0x18c9dd['stack']);if(_0x18c9dd[_0x1a9b('0x26')]){delete _0x18c9dd[_0x1a9b('0x26')];}_0x1521f4['status'](_0x181331)[_0x1a9b('0x27')](_0x18c9dd);};}exports[_0x1a9b('0x28')]=function(_0x5d70dc,_0x5d7e8c){var _0x3f8e98={},_0x1d981e={},_0x5362b8={'count':0x0,'rows':[]};var _0x30278b=_[_0x1a9b('0x29')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')],function(_0x1a5085){return{'name':_0x1a5085[_0x1a9b('0x2c')],'type':_0x1a5085[_0x1a9b('0x2d')]['key']};});_0x1d981e[_0x1a9b('0x2e')]=_[_0x1a9b('0x29')](_0x30278b,_0x1a9b('0x26'));_0x1d981e[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x5d70dc[_0x1a9b('0x2f')]);_0x1d981e[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x1d981e[_0x1a9b('0x2e')],_0x1d981e[_0x1a9b('0x2f')]);_0x3f8e98[_0x1a9b('0x33')]=_['intersection'](_0x1d981e['model'],qs[_0x1a9b('0x34')](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x3f8e98['attributes']=_0x3f8e98[_0x1a9b('0x33')]['length']?_0x3f8e98[_0x1a9b('0x33')]:_0x1d981e['model'];if(!_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x35')]('nolimit')){_0x3f8e98[_0x1a9b('0x1c')]=qs['limit'](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x1c')]);_0x3f8e98[_0x1a9b('0x1a')]=qs[_0x1a9b('0x1a')](_0x5d70dc['query'][_0x1a9b('0x1a')]);}_0x3f8e98[_0x1a9b('0x36')]=qs[_0x1a9b('0x37')](_0x5d70dc['query'][_0x1a9b('0x37')]);_0x3f8e98['where']=qs['filters'](_[_0x1a9b('0x38')](_0x5d70dc[_0x1a9b('0x2f')],_0x1d981e[_0x1a9b('0x31')]),_0x30278b);if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]){_0x3f8e98[_0x1a9b('0x3a')]=_[_0x1a9b('0x3b')](_0x3f8e98['where'],{'$or':_[_0x1a9b('0x29')](_0x30278b,function(_0x230fc6){if(_0x230fc6[_0x1a9b('0x2d')]!=='VIRTUAL'){var _0x466827={};_0x466827[_0x230fc6[_0x1a9b('0x26')]]={'$like':'%'+_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]+'%'};return _0x466827;}})});}_0x3f8e98=_['merge']({},_0x3f8e98,_0x5d70dc['options']);var _0x10e80f={'where':_0x3f8e98[_0x1a9b('0x3a')]};return db[_0x1a9b('0x2a')]['count'](_0x10e80f)['then'](function(_0x2b9bcf){_0x5362b8[_0x1a9b('0x1d')]=_0x2b9bcf;if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x3f8e98[_0x1a9b('0x3d')]=[{'all':!![]}];}return db[_0x1a9b('0x2a')][_0x1a9b('0x3e')](_0x3f8e98);})['then'](function(_0x313921){_0x5362b8[_0x1a9b('0x3f')]=_0x313921;return _0x5362b8;})[_0x1a9b('0x23')](respondWithFilteredResult(_0x5d7e8c,_0x3f8e98))[_0x1a9b('0x40')](handleError(_0x5d7e8c,null));};exports[_0x1a9b('0x41')]=function(_0x1decb8,_0xb4cbf4){var _0x398db3={'raw':!![],'where':{'id':_0x1decb8[_0x1a9b('0x42')]['id']}},_0x35f6d8={};_0x35f6d8[_0x1a9b('0x2e')]=_[_0x1a9b('0x30')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')]);_0x35f6d8[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x1decb8['query']);_0x35f6d8[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x35f6d8['model'],_0x35f6d8[_0x1a9b('0x2f')]);_0x398db3['attributes']=_['intersection'](_0x35f6d8[_0x1a9b('0x2e')],qs[_0x1a9b('0x34')](_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x398db3[_0x1a9b('0x33')]=_0x398db3[_0x1a9b('0x33')][_0x1a9b('0x43')]?_0x398db3['attributes']:_0x35f6d8[_0x1a9b('0x2e')];if(_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x398db3[_0x1a9b('0x3d')]=[{'all':!![]}];}_0x398db3=_['merge']({},_0x398db3,_0x1decb8[_0x1a9b('0x44')]);return db[_0x1a9b('0x2a')][_0x1a9b('0x45')](_0x398db3)[_0x1a9b('0x23')](handleEntityNotFound(_0xb4cbf4,null))['then'](respondWithResult(_0xb4cbf4,null))[_0x1a9b('0x40')](handleError(_0xb4cbf4,null));};exports[_0x1a9b('0x46')]=function(_0x41e9fc,_0x1e93df){return db[_0x1a9b('0x2a')]['create'](_0x41e9fc['body'],{})[_0x1a9b('0x23')](respondWithResult(_0x1e93df,0xc9))[_0x1a9b('0x40')](handleError(_0x1e93df,null));};exports['update']=function(_0x52b06e,_0x252140){if(_0x52b06e[_0x1a9b('0x47')]['id']){delete _0x52b06e[_0x1a9b('0x47')]['id'];}return db['Cdr'][_0x1a9b('0x45')]({'where':{'id':_0x52b06e[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x252140,null))[_0x1a9b('0x23')](saveUpdates(_0x52b06e[_0x1a9b('0x47')],null))[_0x1a9b('0x23')](respondWithResult(_0x252140,null))[_0x1a9b('0x40')](handleError(_0x252140,null));};exports['destroy']=function(_0x54b9ac,_0x5465d0){return db[_0x1a9b('0x2a')][_0x1a9b('0x45')]({'where':{'id':_0x54b9ac[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x5465d0,null))[_0x1a9b('0x23')](removeEntity(_0x5465d0,null))['catch'](handleError(_0x5465d0,null));};exports[_0x1a9b('0x48')]=function(_0x222bba,_0x3b1fdf){return db[_0x1a9b('0x2a')][_0x1a9b('0x48')]()[_0x1a9b('0x23')](respondWithResult(_0x3b1fdf,null))[_0x1a9b('0x40')](handleError(_0x3b1fdf,null));};
\ No newline at end of file
index 850b78f..3807ce2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x41a184,_0x4437ea){var _0x43e0a0=function(_0x2a3569){while(--_0x2a3569){_0x41a184['push'](_0x41a184['shift']());}};_0x43e0a0(++_0x4437ea);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x432e38,_0x1aae1a){var _0x1070ac=function(_0x3ddeed){while(--_0x3ddeed){_0x432e38['push'](_0x432e38['shift']());}};_0x1070ac(++_0x1aae1a);}(_0x7a54,0x106));var _0x47a5=function(_0x2d027b,_0x4a913b){_0x2d027b=_0x2d027b-0x0;var _0x2cf6c9=_0x7a54[_0x2d027b];return _0x2cf6c9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
index 025a55a..35db8af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2ef=['ioredis','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xf2ef,0x65));var _0xff2e=function(_0x370588,_0x7cae9b){_0x370588=_0x370588-0x0;var _0x820d1b=_0xf2ef[_0x370588];return _0x820d1b;};'use strict';var _=require(_0xff2e('0x0'));var util=require(_0xff2e('0x1'));var moment=require('moment');var BPromise=require(_0xff2e('0x2'));var rs=require(_0xff2e('0x3'));var fs=require('fs');var Redis=require(_0xff2e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xff2e('0x5'));var jayson=require(_0xff2e('0x6'));var client=jayson[_0xff2e('0x7')][_0xff2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502ddc,_0x1f8910,_0x1753cf){return new BPromise(function(_0x532e69,_0x5dbee7){return client[_0xff2e('0x9')](_0x502ddc,_0x1753cf)[_0xff2e('0xa')](function(_0x4f01a7){logger[_0xff2e('0xb')](_0xff2e('0xc'),_0x1f8910,_0xff2e('0xd'));logger[_0xff2e('0xe')](_0xff2e('0xf'),_0x1f8910,_0xff2e('0xd'),JSON['stringify'](_0x4f01a7));if(_0x4f01a7[_0xff2e('0x10')]){if(_0x4f01a7[_0xff2e('0x10')][_0xff2e('0x11')]===0x1f4){logger[_0xff2e('0x10')]('Cdr,\x20%s,\x20%s',_0x1f8910,_0x4f01a7[_0xff2e('0x10')][_0xff2e('0x12')]);return _0x5dbee7(_0x4f01a7[_0xff2e('0x10')][_0xff2e('0x12')]);}logger['error'](_0xff2e('0xc'),_0x1f8910,_0x4f01a7['error'][_0xff2e('0x12')]);return _0x532e69(_0x4f01a7['error'][_0xff2e('0x12')]);}else{logger[_0xff2e('0xb')](_0xff2e('0xc'),_0x1f8910,'request\x20sent');_0x532e69(_0x4f01a7[_0xff2e('0x13')][_0xff2e('0x12')]);}})[_0xff2e('0x14')](function(_0x1109b3){logger[_0xff2e('0x10')](_0xff2e('0xc'),_0x1f8910,_0x1109b3);_0x5dbee7(_0x1109b3);});});}
\ No newline at end of file
+var _0xc78f=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc78f,0x17b));var _0xfc78=function(_0x414596,_0x6b3f54){_0x414596=_0x414596-0x0;var _0xd7bbe1=_0xc78f[_0x414596];return _0xd7bbe1;};'use strict';var _=require('lodash');var util=require(_0xfc78('0x0'));var moment=require(_0xfc78('0x1'));var BPromise=require(_0xfc78('0x2'));var rs=require(_0xfc78('0x3'));var fs=require('fs');var Redis=require(_0xfc78('0x4'));var db=require(_0xfc78('0x5'))['db'];var utils=require(_0xfc78('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc78('0x7'));var jayson=require(_0xfc78('0x8'));var client=jayson['client'][_0xfc78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x356538,_0x571b61,_0x6d6900){return new BPromise(function(_0x5dc484,_0x915f6a){return client[_0xfc78('0xa')](_0x356538,_0x6d6900)[_0xfc78('0xb')](function(_0x457563){logger[_0xfc78('0xc')](_0xfc78('0xd'),_0x571b61,_0xfc78('0xe'));logger['debug'](_0xfc78('0xf'),_0x571b61,_0xfc78('0xe'),JSON[_0xfc78('0x10')](_0x457563));if(_0x457563[_0xfc78('0x11')]){if(_0x457563[_0xfc78('0x11')]['code']===0x1f4){logger[_0xfc78('0x11')](_0xfc78('0xd'),_0x571b61,_0x457563[_0xfc78('0x11')][_0xfc78('0x12')]);return _0x915f6a(_0x457563[_0xfc78('0x11')]['message']);}logger['error'](_0xfc78('0xd'),_0x571b61,_0x457563[_0xfc78('0x11')][_0xfc78('0x12')]);return _0x5dc484(_0x457563[_0xfc78('0x11')][_0xfc78('0x12')]);}else{logger[_0xfc78('0xc')]('Cdr,\x20%s,\x20%s',_0x571b61,_0xfc78('0xe'));_0x5dc484(_0x457563[_0xfc78('0x13')][_0xfc78('0x12')]);}})[_0xfc78('0x14')](function(_0x39c54a){logger[_0xfc78('0x11')]('Cdr,\x20%s,\x20%s',_0x571b61,_0x39c54a);_0x915f6a(_0x39c54a);});});}
\ No newline at end of file
index a37c969..4320fd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router;
\ No newline at end of file
+var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router;
\ No newline at end of file
index ba21ae3..bdf8518 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2611=['noop','sequelize','STRING'];(function(_0x809ea0,_0xbff89f){var _0x245147=function(_0x4f962c){while(--_0x4f962c){_0x809ea0['push'](_0x809ea0['shift']());}};_0x245147(++_0xbff89f);}(_0x2611,0x175));var _0x1261=function(_0x13467a,_0x144782){_0x13467a=_0x13467a-0x0;var _0x48672b=_0x2611[_0x13467a];return _0x48672b;};'use strict';var Sequelize=require(_0x1261('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1261('0x1')],'allowNull':![],'defaultValue':_0x1261('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1261('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0x38fe=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x38fe,0xfa));var _0xe38f=function(_0x52321b,_0x5cf2be){_0x52321b=_0x52321b-0x0;var _0x562a3f=_0x38fe[_0x52321b];return _0x562a3f;};'use strict';var Sequelize=require(_0xe38f('0x0'));module[_0xe38f('0x1')]={'priority':{'type':Sequelize[_0xe38f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe38f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe38f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe38f('0x3')],'defaultValue':_0xe38f('0x5')}};
\ No newline at end of file
index 2229e08..5877bac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb264=['set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','merge','catch','body','find','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x227cc7,_0x3fa15c){var _0x5afd41=function(_0x474ba0){while(--_0x474ba0){_0x227cc7['push'](_0x227cc7['shift']());}};_0x5afd41(++_0x3fa15c);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4b26('0x0'));var rimraf=require(_0x4b26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b26('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b26('0x3'));var Mustache=require(_0x4b26('0x4'));var util=require(_0x4b26('0x5'));var path=require(_0x4b26('0x6'));var sox=require(_0x4b26('0x7'));var csv=require(_0x4b26('0x8'));var ejs=require(_0x4b26('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b26('0xa'));var squel=require(_0x4b26('0xb'));var crypto=require('crypto');var jsforce=require(_0x4b26('0xc'));var deskjs=require(_0x4b26('0xd'));var toCsv=require(_0x4b26('0x8'));var querystring=require('querystring');var Papa=require(_0x4b26('0xe'));var Redis=require(_0x4b26('0xf'));var authService=require(_0x4b26('0x10'));var qs=require(_0x4b26('0x11'));var as=require(_0x4b26('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b26('0x13'))('api');var utils=require(_0x4b26('0x14'));var config=require(_0x4b26('0x15'));var licenseUtil=require(_0x4b26('0x16'));var db=require(_0x4b26('0x17'))['db'];function respondWithStatusCode(_0x46f945,_0x56f690){_0x56f690=_0x56f690||0xcc;return function(_0x25eaa9){if(_0x25eaa9){return _0x46f945[_0x4b26('0x18')](_0x56f690);}return _0x46f945['status'](_0x56f690)['end']();};}function respondWithResult(_0x18286d,_0x5d8306){_0x5d8306=_0x5d8306||0xc8;return function(_0x166b4e){if(_0x166b4e){return _0x18286d[_0x4b26('0x19')](_0x5d8306)[_0x4b26('0x1a')](_0x166b4e);}};}function respondWithFilteredResult(_0x5930eb,_0x157847){return function(_0x2811bc){if(_0x2811bc){var _0x278a8d=typeof _0x157847[_0x4b26('0x1b')]===_0x4b26('0x1c')&&typeof _0x157847[_0x4b26('0x1d')]===_0x4b26('0x1c');var _0x3105ed=_0x2811bc[_0x4b26('0x1e')];var _0x16e451=_0x278a8d?0x0:_0x157847[_0x4b26('0x1b')];var _0x501278=_0x278a8d?_0x2811bc[_0x4b26('0x1e')]:_0x157847['offset']+_0x157847['limit'];var _0x338ac4;if(_0x501278>=_0x3105ed){_0x501278=_0x3105ed;_0x338ac4=0xc8;}else{_0x338ac4=0xce;}_0x5930eb[_0x4b26('0x19')](_0x338ac4);return _0x5930eb[_0x4b26('0x1f')](_0x4b26('0x20'),_0x16e451+'-'+_0x501278+'/'+_0x3105ed)['json'](_0x2811bc);}return null;};}function patchUpdates(_0xe5f818){return function(_0x3769ed){try{jsonpatch[_0x4b26('0x21')](_0x3769ed,_0xe5f818,!![]);}catch(_0x302b14){return BPromise['reject'](_0x302b14);}return _0x3769ed['save']();};}function saveUpdates(_0x2b77d9,_0x3785f8){return function(_0x5b42d6){if(_0x5b42d6){return _0x5b42d6[_0x4b26('0x22')](_0x2b77d9)[_0x4b26('0x23')](function(_0x410af6){return _0x410af6;});}return null;};}function removeEntity(_0x328419,_0x291000){return function(_0x175bec){if(_0x175bec){return _0x175bec[_0x4b26('0x24')]()[_0x4b26('0x23')](function(){_0x328419[_0x4b26('0x19')](0xcc)[_0x4b26('0x25')]();});}};}function handleEntityNotFound(_0x141ac8,_0x26e3d1){return function(_0x2eb4bf){if(!_0x2eb4bf){_0x141ac8[_0x4b26('0x18')](0x194);}return _0x2eb4bf;};}function handleError(_0x5ddf42,_0x5914e2){_0x5914e2=_0x5914e2||0x1f4;return function(_0x48a05f){logger[_0x4b26('0x26')](_0x48a05f[_0x4b26('0x27')]);if(_0x48a05f['name']){delete _0x48a05f[_0x4b26('0x28')];}_0x5ddf42['status'](_0x5914e2)[_0x4b26('0x29')](_0x48a05f);};}exports[_0x4b26('0x2a')]=function(_0x54a2cc,_0x514874){var _0x34b0d2={'raw':!![],'where':{'id':_0x54a2cc['params']['id']}},_0x1c98ac={};_0x1c98ac[_0x4b26('0x2b')]=_[_0x4b26('0x2c')](db[_0x4b26('0x2d')][_0x4b26('0x2e')]);_0x1c98ac[_0x4b26('0x2f')]=_[_0x4b26('0x2c')](_0x54a2cc['query']);_0x1c98ac[_0x4b26('0x30')]=_[_0x4b26('0x31')](_0x1c98ac[_0x4b26('0x2b')],_0x1c98ac['query']);_0x34b0d2['attributes']=_['intersection'](_0x1c98ac[_0x4b26('0x2b')],qs[_0x4b26('0x32')](_0x54a2cc[_0x4b26('0x2f')][_0x4b26('0x32')]));_0x34b0d2[_0x4b26('0x33')]=_0x34b0d2['attributes'][_0x4b26('0x34')]?_0x34b0d2[_0x4b26('0x33')]:_0x1c98ac[_0x4b26('0x2b')];if(_0x54a2cc[_0x4b26('0x2f')][_0x4b26('0x35')]){_0x34b0d2['include']=[{'all':!![]}];}_0x34b0d2=_[_0x4b26('0x36')]({},_0x34b0d2,_0x54a2cc['options']);return db[_0x4b26('0x2d')]['find'](_0x34b0d2)[_0x4b26('0x23')](handleEntityNotFound(_0x514874,null))[_0x4b26('0x23')](respondWithResult(_0x514874,null))[_0x4b26('0x37')](handleError(_0x514874,null));};exports[_0x4b26('0x22')]=function(_0x23bed8,_0x1c8833){if(_0x23bed8[_0x4b26('0x38')]['id']){delete _0x23bed8['body']['id'];}return db[_0x4b26('0x2d')][_0x4b26('0x39')]({'where':{'id':_0x23bed8['params']['id']}})['then'](handleEntityNotFound(_0x1c8833,null))[_0x4b26('0x23')](saveUpdates(_0x23bed8['body'],null))[_0x4b26('0x23')](respondWithResult(_0x1c8833,null))[_0x4b26('0x37')](handleError(_0x1c8833,null));};exports[_0x4b26('0x24')]=function(_0x51a3b6,_0x2fbd3a){return db[_0x4b26('0x2d')]['find']({'where':{'id':_0x51a3b6[_0x4b26('0x3a')]['id']}})[_0x4b26('0x23')](handleEntityNotFound(_0x2fbd3a,null))['then'](removeEntity(_0x2fbd3a,null))['catch'](handleError(_0x2fbd3a,null));};
\ No newline at end of file
+var _0x049e=['json','reject','save','update','then','error','stack','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range'];(function(_0x3b3dd3,_0x16b375){var _0x719a79=function(_0xaaa279){while(--_0xaaa279){_0x3b3dd3['push'](_0x3b3dd3['shift']());}};_0x719a79(++_0x16b375);}(_0x049e,0x16a));var _0xe049=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x049e[_0x350343];return _0x9afc1c;};'use strict';var emlformat=require(_0xe049('0x0'));var rimraf=require(_0xe049('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe049('0x2'));var rp=require('request-promise');var moment=require(_0xe049('0x3'));var BPromise=require(_0xe049('0x4'));var Mustache=require(_0xe049('0x5'));var util=require(_0xe049('0x6'));var path=require(_0xe049('0x7'));var sox=require('sox');var csv=require(_0xe049('0x8'));var ejs=require(_0xe049('0x9'));var fs=require('fs');var fs_extra=require(_0xe049('0xa'));var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x8'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var licenseUtil=require(_0xe049('0x15'));var db=require(_0xe049('0x16'))['db'];function respondWithStatusCode(_0x359931,_0x301c7e){_0x301c7e=_0x301c7e||0xcc;return function(_0x1021e7){if(_0x1021e7){return _0x359931[_0xe049('0x17')](_0x301c7e);}return _0x359931[_0xe049('0x18')](_0x301c7e)['end']();};}function respondWithResult(_0x20c286,_0x3f4a57){_0x3f4a57=_0x3f4a57||0xc8;return function(_0x3924a4){if(_0x3924a4){return _0x20c286[_0xe049('0x18')](_0x3f4a57)['json'](_0x3924a4);}};}function respondWithFilteredResult(_0x3a539b,_0xcc35b6){return function(_0x5c90fd){if(_0x5c90fd){var _0x388be0=typeof _0xcc35b6[_0xe049('0x19')]==='undefined'&&typeof _0xcc35b6[_0xe049('0x1a')]===_0xe049('0x1b');var _0x5d435b=_0x5c90fd[_0xe049('0x1c')];var _0x54c303=_0x388be0?0x0:_0xcc35b6['offset'];var _0x3cbbeb=_0x388be0?_0x5c90fd['count']:_0xcc35b6['offset']+_0xcc35b6[_0xe049('0x1a')];var _0x1092ec;if(_0x3cbbeb>=_0x5d435b){_0x3cbbeb=_0x5d435b;_0x1092ec=0xc8;}else{_0x1092ec=0xce;}_0x3a539b['status'](_0x1092ec);return _0x3a539b['set'](_0xe049('0x1d'),_0x54c303+'-'+_0x3cbbeb+'/'+_0x5d435b)[_0xe049('0x1e')](_0x5c90fd);}return null;};}function patchUpdates(_0x1d2f5b){return function(_0x430421){try{jsonpatch['apply'](_0x430421,_0x1d2f5b,!![]);}catch(_0x572f29){return BPromise[_0xe049('0x1f')](_0x572f29);}return _0x430421[_0xe049('0x20')]();};}function saveUpdates(_0x572a80,_0x36a03b){return function(_0x3f14eb){if(_0x3f14eb){return _0x3f14eb[_0xe049('0x21')](_0x572a80)['then'](function(_0x197358){return _0x197358;});}return null;};}function removeEntity(_0x3b0f54,_0x4c7492){return function(_0x4848c9){if(_0x4848c9){return _0x4848c9['destroy']()[_0xe049('0x22')](function(){_0x3b0f54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aafd1,_0x1efbbe){return function(_0x53620b){if(!_0x53620b){_0x1aafd1[_0xe049('0x17')](0x194);}return _0x53620b;};}function handleError(_0x181432,_0x3e5c7f){_0x3e5c7f=_0x3e5c7f||0x1f4;return function(_0x423ba4){logger[_0xe049('0x23')](_0x423ba4[_0xe049('0x24')]);if(_0x423ba4['name']){delete _0x423ba4['name'];}_0x181432[_0xe049('0x18')](_0x3e5c7f)['send'](_0x423ba4);};}exports[_0xe049('0x25')]=function(_0x495d33,_0x3c50c3){var _0x2b79dc={'raw':!![],'where':{'id':_0x495d33[_0xe049('0x26')]['id']}},_0x5adcd6={};_0x5adcd6[_0xe049('0x27')]=_[_0xe049('0x28')](db[_0xe049('0x29')][_0xe049('0x2a')]);_0x5adcd6[_0xe049('0x2b')]=_[_0xe049('0x28')](_0x495d33[_0xe049('0x2b')]);_0x5adcd6[_0xe049('0x2c')]=_[_0xe049('0x2d')](_0x5adcd6[_0xe049('0x27')],_0x5adcd6['query']);_0x2b79dc[_0xe049('0x2e')]=_[_0xe049('0x2d')](_0x5adcd6['model'],qs['fields'](_0x495d33['query']['fields']));_0x2b79dc[_0xe049('0x2e')]=_0x2b79dc[_0xe049('0x2e')][_0xe049('0x2f')]?_0x2b79dc[_0xe049('0x2e')]:_0x5adcd6[_0xe049('0x27')];if(_0x495d33['query'][_0xe049('0x30')]){_0x2b79dc[_0xe049('0x31')]=[{'all':!![]}];}_0x2b79dc=_[_0xe049('0x32')]({},_0x2b79dc,_0x495d33[_0xe049('0x33')]);return db[_0xe049('0x29')]['find'](_0x2b79dc)[_0xe049('0x22')](handleEntityNotFound(_0x3c50c3,null))['then'](respondWithResult(_0x3c50c3,null))[_0xe049('0x34')](handleError(_0x3c50c3,null));};exports['update']=function(_0x1162d6,_0x374dc5){if(_0x1162d6[_0xe049('0x35')]['id']){delete _0x1162d6[_0xe049('0x35')]['id'];}return db[_0xe049('0x29')][_0xe049('0x36')]({'where':{'id':_0x1162d6[_0xe049('0x26')]['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x374dc5,null))[_0xe049('0x22')](saveUpdates(_0x1162d6[_0xe049('0x35')],null))[_0xe049('0x22')](respondWithResult(_0x374dc5,null))['catch'](handleError(_0x374dc5,null));};exports[_0xe049('0x37')]=function(_0x1b21d9,_0x78e33d){return db[_0xe049('0x29')][_0xe049('0x36')]({'where':{'id':_0x1b21d9[_0xe049('0x26')]['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x78e33d,null))[_0xe049('0x22')](removeEntity(_0x78e33d,null))['catch'](handleError(_0x78e33d,null));};
\ No newline at end of file
index 2460e21..9844af4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x663e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','util','api'];(function(_0x24a51e,_0x328dde){var _0x51ead6=function(_0x2f915c){while(--_0x2f915c){_0x24a51e['push'](_0x24a51e['shift']());}};_0x51ead6(++_0x328dde);}(_0x663e,0x1d2));var _0xe663=function(_0x19b066,_0x7a9a22){_0x19b066=_0x19b066-0x0;var _0x2133fa=_0x663e[_0x19b066];return _0x2133fa;};'use strict';var _=require('lodash');var util=require(_0xe663('0x0'));var logger=require('../../config/logger')(_0xe663('0x1'));var moment=require(_0xe663('0x2'));var BPromise=require(_0xe663('0x3'));var rp=require(_0xe663('0x4'));var fs=require('fs');var path=require(_0xe663('0x5'));var rimraf=require(_0xe663('0x6'));var config=require(_0xe663('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0xabf02e,_0x354af7){return _0xabf02e[_0xe663('0x8')](_0xe663('0x9'),attributes,{'tableName':_0xe663('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe663('0xb')});};
\ No newline at end of file
+var _0xb8b7=['./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','bluebird','request-promise','path','../../config/environment'];(function(_0x541641,_0x5ee02a){var _0x53766b=function(_0x151f72){while(--_0x151f72){_0x541641['push'](_0x541641['shift']());}};_0x53766b(++_0x5ee02a);}(_0xb8b7,0x114));var _0x7b8b=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb8b7[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b8b('0x0'));var rp=require(_0x7b8b('0x1'));var fs=require('fs');var path=require(_0x7b8b('0x2'));var rimraf=require('rimraf');var config=require(_0x7b8b('0x3'));var attributes=require(_0x7b8b('0x4'));module['exports']=function(_0x58a059,_0x43e2b4){return _0x58a059[_0x7b8b('0x5')](_0x7b8b('0x6'),attributes,{'tableName':_0x7b8b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b8b('0x8'),'collate':_0x7b8b('0x9')});};
\ No newline at end of file
index 210cf78..92ba81e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x115b=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x50f88a,_0x57cb22){var _0x2fc675=function(_0xbbeaa8){while(--_0xbbeaa8){_0x50f88a['push'](_0x50f88a['shift']());}};_0x2fc675(++_0x57cb22);}(_0x115b,0x1be));var _0xb115=function(_0x294d76,_0x38c8ac){_0x294d76=_0x294d76-0x0;var _0x1de3f4=_0x115b[_0x294d76];return _0x1de3f4;};'use strict';var _=require(_0xb115('0x0'));var util=require(_0xb115('0x1'));var moment=require('moment');var BPromise=require(_0xb115('0x2'));var rs=require(_0xb115('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb115('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb115('0x5'))('rpc');var config=require(_0xb115('0x6'));var jayson=require(_0xb115('0x7'));var client=jayson['client'][_0xb115('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x246bc7,_0x18313d,_0x5bed48){return new BPromise(function(_0x2fd154,_0x58982b){return client['request'](_0x246bc7,_0x5bed48)[_0xb115('0x9')](function(_0xce0162){logger['info'](_0xb115('0xa'),_0x18313d,_0xb115('0xb'));logger[_0xb115('0xc')](_0xb115('0xd'),_0x18313d,_0xb115('0xb'),JSON[_0xb115('0xe')](_0xce0162));if(_0xce0162['error']){if(_0xce0162[_0xb115('0xf')][_0xb115('0x10')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x18313d,_0xce0162[_0xb115('0xf')][_0xb115('0x11')]);return _0x58982b(_0xce0162['error']['message']);}logger['error'](_0xb115('0xa'),_0x18313d,_0xce0162[_0xb115('0xf')][_0xb115('0x11')]);return _0x2fd154(_0xce0162[_0xb115('0xf')][_0xb115('0x11')]);}else{logger['info'](_0xb115('0xa'),_0x18313d,_0xb115('0xb'));_0x2fd154(_0xce0162[_0xb115('0x12')][_0xb115('0x11')]);}})[_0xb115('0x13')](function(_0x5cdbd7){logger[_0xb115('0xf')](_0xb115('0xa'),_0x18313d,_0x5cdbd7);_0x58982b(_0x5cdbd7);});});}
\ No newline at end of file
+var _0xb9c2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird'];(function(_0x218bed,_0xf947ed){var _0x161203=function(_0x331f53){while(--_0x331f53){_0x218bed['push'](_0x218bed['shift']());}};_0x161203(++_0xf947ed);}(_0xb9c2,0x107));var _0x2b9c=function(_0x4cfce3,_0x5cfba0){_0x4cfce3=_0x4cfce3-0x0;var _0xd71772=_0xb9c2[_0x4cfce3];return _0xd71772;};'use strict';var _=require(_0x2b9c('0x0'));var util=require(_0x2b9c('0x1'));var moment=require('moment');var BPromise=require(_0x2b9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b9c('0x3'));var db=require(_0x2b9c('0x4'))['db'];var utils=require(_0x2b9c('0x5'));var logger=require(_0x2b9c('0x6'))(_0x2b9c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2b9c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a8681,_0x212551,_0x44b6d0){return new BPromise(function(_0x4f1fca,_0x217b05){return client['request'](_0x5a8681,_0x44b6d0)[_0x2b9c('0x9')](function(_0xefc713){logger[_0x2b9c('0xa')](_0x2b9c('0xb'),_0x212551,_0x2b9c('0xc'));logger[_0x2b9c('0xd')](_0x2b9c('0xe'),_0x212551,_0x2b9c('0xc'),JSON[_0x2b9c('0xf')](_0xefc713));if(_0xefc713[_0x2b9c('0x10')]){if(_0xefc713[_0x2b9c('0x10')]['code']===0x1f4){logger['error'](_0x2b9c('0xb'),_0x212551,_0xefc713[_0x2b9c('0x10')][_0x2b9c('0x11')]);return _0x217b05(_0xefc713[_0x2b9c('0x10')][_0x2b9c('0x11')]);}logger['error'](_0x2b9c('0xb'),_0x212551,_0xefc713[_0x2b9c('0x10')][_0x2b9c('0x11')]);return _0x4f1fca(_0xefc713[_0x2b9c('0x10')][_0x2b9c('0x11')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x212551,'request\x20sent');_0x4f1fca(_0xefc713['result'][_0x2b9c('0x11')]);}})[_0x2b9c('0x12')](function(_0x158a58){logger['error'](_0x2b9c('0xb'),_0x212551,_0x158a58);_0x217b05(_0x158a58);});});}
\ No newline at end of file
index 296defa..dec55c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd958=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','show','/:id','delete','isAuthenticated','destroy'];(function(_0x69f5b2,_0x3803d5){var _0x49290d=function(_0x553083){while(--_0x553083){_0x69f5b2['push'](_0x69f5b2['shift']());}};_0x49290d(++_0x3803d5);}(_0xd958,0x12c));var _0x8d95=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xd958[_0x44bcb0];return _0xfaf881;};'use strict';var multer=require(_0x8d95('0x0'));var util=require(_0x8d95('0x1'));var path=require('path');var timeout=require(_0x8d95('0x2'));var express=require(_0x8d95('0x3'));var router=express[_0x8d95('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d95('0x5'));var interaction=require(_0x8d95('0x6'));var config=require(_0x8d95('0x7'));var controller=require(_0x8d95('0x8'));router[_0x8d95('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8d95('0xa')]);router['put'](_0x8d95('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8d95('0xc')]('/:id',auth[_0x8d95('0xd')](),controller[_0x8d95('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0x2fe5=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','put','/:id','isAuthenticated','update','destroy','exports','multer','util'];(function(_0x2db905,_0x3a00a7){var _0x598f85=function(_0x46ccd6){while(--_0x46ccd6){_0x2db905['push'](_0x2db905['shift']());}};_0x598f85(++_0x3a00a7);}(_0x2fe5,0x12a));var _0x52fe=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2fe5[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var path=require(_0x52fe('0x2'));var timeout=require(_0x52fe('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x52fe('0x4'));var auth=require(_0x52fe('0x5'));var interaction=require(_0x52fe('0x6'));var config=require('../../config/environment');var controller=require(_0x52fe('0x7'));router[_0x52fe('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x52fe('0x9')](_0x52fe('0xa'),auth[_0x52fe('0xb')](),controller[_0x52fe('0xc')]);router['delete'](_0x52fe('0xa'),auth[_0x52fe('0xb')](),controller[_0x52fe('0xd')]);module[_0x52fe('0xe')]=router;
\ No newline at end of file
index 2d98b6c..6ede63f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d62=['STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0d62,0x1df));var _0x20d6=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0x0d62[_0xd73d53];return _0x560148;};'use strict';var Sequelize=require(_0x20d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x20d6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x20d6('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
+var _0xc405=['sequelize','STRING','BOOLEAN'];(function(_0x4db6bb,_0x1ff1d4){var _0x69ae44=function(_0x5d350c){while(--_0x5d350c){_0x4db6bb['push'](_0x4db6bb['shift']());}};_0x69ae44(++_0x1ff1d4);}(_0xc405,0x69));var _0x5c40=function(_0x1abaf7,_0x43e010){_0x1abaf7=_0x1abaf7-0x0;var _0x3ec6f8=_0xc405[_0x1abaf7];return _0x3ec6f8;};'use strict';var Sequelize=require(_0x5c40('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5c40('0x1')]},'write':{'type':Sequelize[_0x5c40('0x2')],'defaultValue':!![]}};
\ No newline at end of file
index 783f4d1..8392910 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x035c=['filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','User','order','getMembers','nolimit','removeMembers','addMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','sort','where'];(function(_0x20e77c,_0x5db846){var _0x5ed0d1=function(_0x5c9914){while(--_0x5c9914){_0x20e77c['push'](_0x20e77c['shift']());}};_0x5ed0d1(++_0x5db846);}(_0x035c,0x81));var _0xc035=function(_0xf228f8,_0x433fdc){_0xf228f8=_0xf228f8-0x0;var _0x1a4b47=_0x035c[_0xf228f8];return _0x1a4b47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc035('0x0'));var zipdir=require(_0xc035('0x1'));var jsonpatch=require(_0xc035('0x2'));var rp=require(_0xc035('0x3'));var moment=require(_0xc035('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc035('0x5'));var util=require(_0xc035('0x6'));var path=require(_0xc035('0x7'));var sox=require(_0xc035('0x8'));var csv=require(_0xc035('0x9'));var ejs=require(_0xc035('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc035('0xb'));var squel=require('squel');var crypto=require(_0xc035('0xc'));var jsforce=require(_0xc035('0xd'));var deskjs=require(_0xc035('0xe'));var toCsv=require(_0xc035('0x9'));var querystring=require('querystring');var Papa=require(_0xc035('0xf'));var Redis=require(_0xc035('0x10'));var authService=require(_0xc035('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc035('0x12'))(_0xc035('0x13'));var utils=require(_0xc035('0x14'));var config=require(_0xc035('0x15'));var licenseUtil=require(_0xc035('0x16'));var db=require(_0xc035('0x17'))['db'];config[_0xc035('0x18')]=_[_0xc035('0x19')](config[_0xc035('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc035('0x1a'))(new Redis(config[_0xc035('0x18')]));require(_0xc035('0x1b'))[_0xc035('0x1c')](socket);function respondWithStatusCode(_0x4c0e0c,_0x5a5ec4){_0x5a5ec4=_0x5a5ec4||0xcc;return function(_0x5a7b8c){if(_0x5a7b8c){return _0x4c0e0c[_0xc035('0x1d')](_0x5a5ec4);}return _0x4c0e0c[_0xc035('0x1e')](_0x5a5ec4)['end']();};}function respondWithResult(_0x4cd927,_0x4cff05){_0x4cff05=_0x4cff05||0xc8;return function(_0x2dce8b){if(_0x2dce8b){return _0x4cd927['status'](_0x4cff05)[_0xc035('0x1f')](_0x2dce8b);}};}function respondWithFilteredResult(_0x3d7911,_0x5e52a1){return function(_0x24e06b){if(_0x24e06b){var _0x3277bf=typeof _0x5e52a1['offset']===_0xc035('0x20')&&typeof _0x5e52a1[_0xc035('0x21')]===_0xc035('0x20');var _0x5f5256=_0x24e06b['count'];var _0x50290e=_0x3277bf?0x0:_0x5e52a1['offset'];var _0x4b4cf4=_0x3277bf?_0x24e06b[_0xc035('0x22')]:_0x5e52a1[_0xc035('0x23')]+_0x5e52a1['limit'];var _0x55afcf;if(_0x4b4cf4>=_0x5f5256){_0x4b4cf4=_0x5f5256;_0x55afcf=0xc8;}else{_0x55afcf=0xce;}_0x3d7911['status'](_0x55afcf);return _0x3d7911[_0xc035('0x24')](_0xc035('0x25'),_0x50290e+'-'+_0x4b4cf4+'/'+_0x5f5256)[_0xc035('0x1f')](_0x24e06b);}return null;};}function patchUpdates(_0xf2332b){return function(_0x1141ee){try{jsonpatch[_0xc035('0x26')](_0x1141ee,_0xf2332b,!![]);}catch(_0x23f226){return BPromise[_0xc035('0x27')](_0x23f226);}return _0x1141ee[_0xc035('0x28')]();};}function saveUpdates(_0x5cc2a7,_0x216b87){return function(_0x4b5bb4){if(_0x4b5bb4){return _0x4b5bb4[_0xc035('0x29')](_0x5cc2a7)[_0xc035('0x2a')](function(_0x4b2dec){return _0x4b2dec;});}return null;};}function removeEntity(_0x194a47,_0x113329){return function(_0x1ba0ab){if(_0x1ba0ab){return _0x1ba0ab[_0xc035('0x2b')]()['then'](function(){_0x194a47['status'](0xcc)[_0xc035('0x2c')]();});}};}function handleEntityNotFound(_0x11a61a,_0x1378be){return function(_0x6cf650){if(!_0x6cf650){_0x11a61a[_0xc035('0x1d')](0x194);}return _0x6cf650;};}function handleError(_0x27632e,_0x419f7d){_0x419f7d=_0x419f7d||0x1f4;return function(_0x35b11d){logger[_0xc035('0x2d')](_0x35b11d[_0xc035('0x2e')]);if(_0x35b11d[_0xc035('0x2f')]){delete _0x35b11d['name'];}_0x27632e['status'](_0x419f7d)[_0xc035('0x30')](_0x35b11d);};}exports['index']=function(_0x1aa0cc,_0x4c82c1){var _0x3caf6f={},_0x5aa0d9={},_0x17d925={'count':0x0,'rows':[]};var _0x3fd496=_[_0xc035('0x31')](db[_0xc035('0x32')][_0xc035('0x33')],function(_0x4a874d){return{'name':_0x4a874d[_0xc035('0x34')],'type':_0x4a874d[_0xc035('0x35')]['key']};});_0x5aa0d9[_0xc035('0x36')]=_['map'](_0x3fd496,_0xc035('0x2f'));_0x5aa0d9[_0xc035('0x37')]=_[_0xc035('0x38')](_0x1aa0cc[_0xc035('0x37')]);_0x5aa0d9['filters']=_[_0xc035('0x39')](_0x5aa0d9[_0xc035('0x36')],_0x5aa0d9[_0xc035('0x37')]);_0x3caf6f['attributes']=_['intersection'](_0x5aa0d9[_0xc035('0x36')],qs[_0xc035('0x3a')](_0x1aa0cc[_0xc035('0x37')][_0xc035('0x3a')]));_0x3caf6f[_0xc035('0x3b')]=_0x3caf6f[_0xc035('0x3b')][_0xc035('0x3c')]?_0x3caf6f[_0xc035('0x3b')]:_0x5aa0d9[_0xc035('0x36')];if(!_0x1aa0cc[_0xc035('0x37')]['hasOwnProperty']('nolimit')){_0x3caf6f[_0xc035('0x21')]=qs[_0xc035('0x21')](_0x1aa0cc[_0xc035('0x37')][_0xc035('0x21')]);_0x3caf6f[_0xc035('0x23')]=qs['offset'](_0x1aa0cc[_0xc035('0x37')][_0xc035('0x23')]);}_0x3caf6f['order']=qs[_0xc035('0x3d')](_0x1aa0cc['query'][_0xc035('0x3d')]);_0x3caf6f[_0xc035('0x3e')]=qs[_0xc035('0x3f')](_['pick'](_0x1aa0cc[_0xc035('0x37')],_0x5aa0d9[_0xc035('0x3f')]),_0x3fd496);if(_0x1aa0cc['query'][_0xc035('0x40')]){_0x3caf6f[_0xc035('0x3e')]=_[_0xc035('0x41')](_0x3caf6f[_0xc035('0x3e')],{'$or':_['map'](_0x3fd496,function(_0x50ecb7){if(_0x50ecb7[_0xc035('0x35')]!==_0xc035('0x42')){var _0x1286b9={};_0x1286b9[_0x50ecb7[_0xc035('0x2f')]]={'$like':'%'+_0x1aa0cc[_0xc035('0x37')][_0xc035('0x40')]+'%'};return _0x1286b9;}})});}_0x3caf6f=_[_0xc035('0x41')]({},_0x3caf6f,_0x1aa0cc[_0xc035('0x43')]);var _0x1e810a={'where':_0x3caf6f['where']};return db[_0xc035('0x32')]['count'](_0x1e810a)[_0xc035('0x2a')](function(_0x31e58c){_0x17d925['count']=_0x31e58c;if(_0x1aa0cc[_0xc035('0x37')]['includeAll']){_0x3caf6f[_0xc035('0x44')]=[{'all':!![]}];}return db[_0xc035('0x32')][_0xc035('0x45')](_0x3caf6f);})[_0xc035('0x2a')](function(_0x4c3be5){_0x17d925[_0xc035('0x46')]=_0x4c3be5;return _0x17d925;})['then'](respondWithFilteredResult(_0x4c82c1,_0x3caf6f))[_0xc035('0x47')](handleError(_0x4c82c1,null));};exports[_0xc035('0x48')]=function(_0x50170e,_0x529849){var _0xc6023={'raw':!![],'where':{'id':_0x50170e[_0xc035('0x49')]['id']}},_0x307b23={};_0x307b23[_0xc035('0x36')]=_[_0xc035('0x38')](db['ChatGroup'][_0xc035('0x33')]);_0x307b23['query']=_[_0xc035('0x38')](_0x50170e['query']);_0x307b23['filters']=_['intersection'](_0x307b23[_0xc035('0x36')],_0x307b23['query']);_0xc6023[_0xc035('0x3b')]=_['intersection'](_0x307b23[_0xc035('0x36')],qs[_0xc035('0x3a')](_0x50170e[_0xc035('0x37')][_0xc035('0x3a')]));_0xc6023[_0xc035('0x3b')]=_0xc6023[_0xc035('0x3b')][_0xc035('0x3c')]?_0xc6023[_0xc035('0x3b')]:_0x307b23['model'];if(_0x50170e[_0xc035('0x37')][_0xc035('0x4a')]){_0xc6023[_0xc035('0x44')]=[{'all':!![]}];}_0xc6023=_[_0xc035('0x41')]({},_0xc6023,_0x50170e[_0xc035('0x43')]);return db[_0xc035('0x32')][_0xc035('0x4b')](_0xc6023)[_0xc035('0x2a')](handleEntityNotFound(_0x529849,null))[_0xc035('0x2a')](respondWithResult(_0x529849,null))[_0xc035('0x47')](handleError(_0x529849,null));};exports[_0xc035('0x4c')]=function(_0x411a3f,_0x443f1c){return db['ChatGroup'][_0xc035('0x4c')](_0x411a3f[_0xc035('0x4d')],{})[_0xc035('0x2a')](respondWithResult(_0x443f1c,0xc9))[_0xc035('0x47')](handleError(_0x443f1c,null));};exports[_0xc035('0x29')]=function(_0x37dd9a,_0x3e2a3f){if(_0x37dd9a[_0xc035('0x4d')]['id']){delete _0x37dd9a[_0xc035('0x4d')]['id'];}return db[_0xc035('0x32')][_0xc035('0x4b')]({'where':{'id':_0x37dd9a['params']['id']}})['then'](handleEntityNotFound(_0x3e2a3f,null))[_0xc035('0x2a')](saveUpdates(_0x37dd9a[_0xc035('0x4d')],null))[_0xc035('0x2a')](respondWithResult(_0x3e2a3f,null))[_0xc035('0x47')](handleError(_0x3e2a3f,null));};exports['destroy']=function(_0xa9eada,_0x1c4cc5){return db[_0xc035('0x32')]['find']({'where':{'id':_0xa9eada[_0xc035('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c4cc5,null))['then'](removeEntity(_0x1c4cc5,null))[_0xc035('0x47')](handleError(_0x1c4cc5,null));};exports['describe']=function(_0x2977da,_0x342021){return db[_0xc035('0x32')]['describe']()['then'](respondWithResult(_0x342021,null))[_0xc035('0x47')](handleError(_0x342021,null));};exports[_0xc035('0x4e')]=function(_0x2ef64b,_0x1a9bf8,_0x41cc44){return db[_0xc035('0x4f')][_0xc035('0x22')]({'where':{'ChatGroupId':_0x2ef64b[_0xc035('0x49')]['id'],'ToId':_0x2ef64b[_0xc035('0x50')]['id'],'read':![]}})['then'](function(_0x355f7e){return{'id':_[_0xc035('0x51')](_0x2ef64b[_0xc035('0x49')]['id']),'count':_0x355f7e};})[_0xc035('0x2a')](respondWithResult(_0x1a9bf8,null))['catch'](handleError(_0x1a9bf8,null));};exports[_0xc035('0x52')]=function(_0x33565b,_0x14035c,_0x2a4917){return db['ChatGroup'][_0xc035('0x4b')]({'where':{'id':_0x33565b['params']['id']}})['then'](handleEntityNotFound(_0x14035c,null))['then'](function(_0x4732bf){if(_0x4732bf){return _0x4732bf['addMembers'](_0x33565b[_0xc035('0x4d')]['ids'],_[_0xc035('0x53')](_0x33565b[_0xc035('0x4d')],[_0xc035('0x54'),'id'])||{});}})[_0xc035('0x2a')](respondWithResult(_0x14035c,null))['catch'](handleError(_0x14035c,null));};exports['getMembers']=function(_0x469dff,_0x186699,_0x5e3fa7){var _0x22da9e={};var _0x390658={};var _0x4d9dea;var _0x1771aa;return db[_0xc035('0x32')][_0xc035('0x55')]({'where':{'id':_0x469dff[_0xc035('0x49')]['id']}})[_0xc035('0x2a')](handleEntityNotFound(_0x186699,null))['then'](function(_0x332fb1){if(_0x332fb1){_0x4d9dea=_0x332fb1;_0x390658[_0xc035('0x36')]=_[_0xc035('0x38')](db[_0xc035('0x56')][_0xc035('0x33')]);_0x390658[_0xc035('0x37')]=_[_0xc035('0x38')](_0x469dff[_0xc035('0x37')]);_0x390658[_0xc035('0x3f')]=_[_0xc035('0x39')](_0x390658[_0xc035('0x36')],_0x390658[_0xc035('0x37')]);_0x22da9e[_0xc035('0x3b')]=_[_0xc035('0x39')](_0x390658[_0xc035('0x36')],qs[_0xc035('0x3a')](_0x469dff[_0xc035('0x37')][_0xc035('0x3a')]));_0x22da9e[_0xc035('0x3b')]=_0x22da9e[_0xc035('0x3b')][_0xc035('0x3c')]?_0x22da9e['attributes']:_0x390658[_0xc035('0x36')];_0x22da9e[_0xc035('0x57')]=qs[_0xc035('0x3d')](_0x469dff[_0xc035('0x37')][_0xc035('0x3d')]);_0x22da9e[_0xc035('0x3e')]=qs['filters'](_['pick'](_0x469dff[_0xc035('0x37')],_0x390658[_0xc035('0x3f')]));if(_0x469dff['query'][_0xc035('0x40')]){_0x22da9e[_0xc035('0x3e')]=_[_0xc035('0x41')](_0x22da9e[_0xc035('0x3e')],{'$or':_['map'](_0x22da9e[_0xc035('0x3b')],function(_0x556840){var _0x13c0a0={};_0x13c0a0[_0x556840]={'$like':'%'+_0x469dff['query'][_0xc035('0x40')]+'%'};return _0x13c0a0;})});}_0x22da9e=_[_0xc035('0x41')]({},_0x22da9e,_0x469dff[_0xc035('0x43')]);return _0x4d9dea[_0xc035('0x58')](_0x22da9e);}})[_0xc035('0x2a')](function(_0x1f0c2b){if(_0x1f0c2b){_0x1771aa=_0x1f0c2b[_0xc035('0x3c')];if(!_0x469dff[_0xc035('0x37')]['hasOwnProperty'](_0xc035('0x59'))){_0x22da9e[_0xc035('0x21')]=qs[_0xc035('0x21')](_0x469dff[_0xc035('0x37')]['limit']);_0x22da9e[_0xc035('0x23')]=qs[_0xc035('0x23')](_0x469dff['query'][_0xc035('0x23')]);}return _0x4d9dea[_0xc035('0x58')](_0x22da9e);}})[_0xc035('0x2a')](function(_0x244b8c){if(_0x244b8c){return _0x244b8c?{'count':_0x1771aa,'rows':_0x244b8c}:null;}})[_0xc035('0x2a')](respondWithResult(_0x186699,null))[_0xc035('0x47')](handleError(_0x186699,null));};exports['removeMembers']=function(_0x380cd9,_0x3b3391,_0x497d7c){return db['ChatGroup'][_0xc035('0x4b')]({'where':{'id':_0x380cd9[_0xc035('0x49')]['id']}})[_0xc035('0x2a')](handleEntityNotFound(_0x3b3391,null))['then'](function(_0x597792){if(_0x597792){return _0x597792[_0xc035('0x5a')](_0x380cd9[_0xc035('0x37')][_0xc035('0x54')]);}})[_0xc035('0x2a')](respondWithStatusCode(_0x3b3391,null))[_0xc035('0x47')](handleError(_0x3b3391,null));};exports[_0xc035('0x5b')]=function(_0x404016,_0x37ed15,_0x3ef531){if(_0x404016[_0xc035('0x4d')]['id']){delete _0x404016['body']['id'];}return db[_0xc035('0x32')][_0xc035('0x4b')]({'where':{'id':_0x404016['params']['id']}})['then'](handleEntityNotFound(_0x37ed15,null))[_0xc035('0x2a')](function(_0x16b688){if(_0x16b688){_0x404016[_0xc035('0x4d')]['ChatGroupId']=_0x16b688['id'];return db['ChatInternalMessage'][_0xc035('0x4c')](_0x404016[_0xc035('0x4d')]);}})[_0xc035('0x2a')](respondWithResult(_0x37ed15,null))[_0xc035('0x47')](handleError(_0x37ed15,null));};exports['getMessages']=function(_0x52f87d,_0x475253,_0x4a4779){var _0x26d96b={};var _0xca95bd={};var _0x44e1be;var _0x1ca6eb;return db[_0xc035('0x32')][_0xc035('0x55')]({'where':{'id':_0x52f87d[_0xc035('0x49')]['id']}})[_0xc035('0x2a')](handleEntityNotFound(_0x475253,null))[_0xc035('0x2a')](function(_0x35b791){if(_0x35b791){_0x44e1be=_0x35b791;_0xca95bd[_0xc035('0x36')]=_[_0xc035('0x38')](db[_0xc035('0x4f')][_0xc035('0x33')]);_0xca95bd[_0xc035('0x37')]=_[_0xc035('0x38')](_0x52f87d[_0xc035('0x37')]);_0xca95bd['filters']=_[_0xc035('0x39')](_0xca95bd[_0xc035('0x36')],_0xca95bd['query']);_0x26d96b[_0xc035('0x3b')]=_[_0xc035('0x39')](_0xca95bd[_0xc035('0x36')],qs[_0xc035('0x3a')](_0x52f87d[_0xc035('0x37')][_0xc035('0x3a')]));_0x26d96b['attributes']=_0x26d96b[_0xc035('0x3b')]['length']?_0x26d96b[_0xc035('0x3b')]:_0xca95bd[_0xc035('0x36')];_0x26d96b['order']=qs['sort'](_0x52f87d[_0xc035('0x37')][_0xc035('0x3d')]);_0x26d96b[_0xc035('0x3e')]=qs[_0xc035('0x3f')](_['pick'](_0x52f87d[_0xc035('0x37')],_0xca95bd[_0xc035('0x3f')]));if(_0x52f87d['query'][_0xc035('0x40')]){_0x26d96b[_0xc035('0x3e')]=_[_0xc035('0x41')](_0x26d96b[_0xc035('0x3e')],{'$or':_[_0xc035('0x31')](_0x26d96b[_0xc035('0x3b')],function(_0x4824e3){var _0x553406={};_0x553406[_0x4824e3]={'$like':'%'+_0x52f87d['query'][_0xc035('0x40')]+'%'};return _0x553406;})});}if(_0x52f87d[_0xc035('0x37')][_0xc035('0x5c')]){var _0x5b10a2=_0x52f87d[_0xc035('0x37')]['$gte']['split'](',');var _0x1c8771={};_0x1c8771[_0x5b10a2[0x0]]={'$gte':moment(_0x5b10a2[0x1])[_0xc035('0x5d')](_0xc035('0x5e'))};_0x26d96b['where']=_['merge'](_0x26d96b[_0xc035('0x3e')],_0x1c8771);}_0x26d96b=_[_0xc035('0x41')]({},_0x26d96b,_0x52f87d[_0xc035('0x43')]);return _0x44e1be['getMessages'](_0x26d96b);}})[_0xc035('0x2a')](function(_0x5ad5e6){if(_0x5ad5e6){_0x1ca6eb=_0x5ad5e6['length'];if(!_0x52f87d[_0xc035('0x37')]['hasOwnProperty'](_0xc035('0x59'))){_0x26d96b[_0xc035('0x21')]=qs['limit'](_0x52f87d['query'][_0xc035('0x21')]);_0x26d96b[_0xc035('0x23')]=qs['offset'](_0x52f87d[_0xc035('0x37')][_0xc035('0x23')]);}return _0x44e1be[_0xc035('0x5f')](_0x26d96b);}})[_0xc035('0x2a')](function(_0x37384b){if(_0x37384b){return _0x37384b?{'count':_0x1ca6eb,'rows':_0x37384b}:null;}})[_0xc035('0x2a')](respondWithResult(_0x475253,null))['catch'](handleError(_0x475253,null));};
\ No newline at end of file
+var _0xcff1=['save','error','stack','name','index','ChatGroup','fieldName','type','key','map','query','keys','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','params','rawAttributes','create','body','update','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers','findOne','User','pick','filter','removeMembers','addMessage','getMessages','$gte','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject'];(function(_0xcb2bbe,_0x782e6d){var _0x2dd38d=function(_0x17fb61){while(--_0x17fb61){_0xcb2bbe['push'](_0xcb2bbe['shift']());}};_0x2dd38d(++_0x782e6d);}(_0xcff1,0x1a6));var _0x1cff=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcff1[_0x59c301];return _0x3866b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cff('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1cff('0x1'));var BPromise=require(_0x1cff('0x2'));var Mustache=require(_0x1cff('0x3'));var util=require(_0x1cff('0x4'));var path=require('path');var sox=require(_0x1cff('0x5'));var csv=require(_0x1cff('0x6'));var ejs=require(_0x1cff('0x7'));var fs=require('fs');var fs_extra=require(_0x1cff('0x8'));var _=require(_0x1cff('0x9'));var squel=require(_0x1cff('0xa'));var crypto=require('crypto');var jsforce=require(_0x1cff('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cff('0x6'));var querystring=require(_0x1cff('0xc'));var Papa=require('papaparse');var Redis=require(_0x1cff('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1cff('0xe'));var hardwareService=require(_0x1cff('0xf'));var logger=require(_0x1cff('0x10'))(_0x1cff('0x11'));var utils=require(_0x1cff('0x12'));var config=require(_0x1cff('0x13'));var licenseUtil=require(_0x1cff('0x14'));var db=require(_0x1cff('0x15'))['db'];config['redis']=_[_0x1cff('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1cff('0x17'))(new Redis(config[_0x1cff('0x18')]));require(_0x1cff('0x19'))[_0x1cff('0x1a')](socket);function respondWithStatusCode(_0x4a3d5c,_0x303cf1){_0x303cf1=_0x303cf1||0xcc;return function(_0x483962){if(_0x483962){return _0x4a3d5c[_0x1cff('0x1b')](_0x303cf1);}return _0x4a3d5c[_0x1cff('0x1c')](_0x303cf1)[_0x1cff('0x1d')]();};}function respondWithResult(_0x40c7ec,_0x102ed4){_0x102ed4=_0x102ed4||0xc8;return function(_0x375187){if(_0x375187){return _0x40c7ec['status'](_0x102ed4)['json'](_0x375187);}};}function respondWithFilteredResult(_0x1c6079,_0x3b9dda){return function(_0xce7f51){if(_0xce7f51){var _0x9f8ac1=typeof _0x3b9dda[_0x1cff('0x1e')]===_0x1cff('0x1f')&&typeof _0x3b9dda[_0x1cff('0x20')]==='undefined';var _0x267a5b=_0xce7f51['count'];var _0x39a299=_0x9f8ac1?0x0:_0x3b9dda['offset'];var _0x51a751=_0x9f8ac1?_0xce7f51[_0x1cff('0x21')]:_0x3b9dda[_0x1cff('0x1e')]+_0x3b9dda[_0x1cff('0x20')];var _0x11a571;if(_0x51a751>=_0x267a5b){_0x51a751=_0x267a5b;_0x11a571=0xc8;}else{_0x11a571=0xce;}_0x1c6079[_0x1cff('0x1c')](_0x11a571);return _0x1c6079[_0x1cff('0x22')]('Content-Range',_0x39a299+'-'+_0x51a751+'/'+_0x267a5b)[_0x1cff('0x23')](_0xce7f51);}return null;};}function patchUpdates(_0x1ee735){return function(_0x5f2dee){try{jsonpatch[_0x1cff('0x24')](_0x5f2dee,_0x1ee735,!![]);}catch(_0x2cd102){return BPromise[_0x1cff('0x25')](_0x2cd102);}return _0x5f2dee[_0x1cff('0x26')]();};}function saveUpdates(_0x3d3309,_0x28a7b7){return function(_0x3f735e){if(_0x3f735e){return _0x3f735e['update'](_0x3d3309)['then'](function(_0x5c1064){return _0x5c1064;});}return null;};}function removeEntity(_0x188f7d,_0x138b63){return function(_0x4ca1c2){if(_0x4ca1c2){return _0x4ca1c2['destroy']()['then'](function(){_0x188f7d[_0x1cff('0x1c')](0xcc)[_0x1cff('0x1d')]();});}};}function handleEntityNotFound(_0xad5a42,_0x11de0c){return function(_0x21ef76){if(!_0x21ef76){_0xad5a42[_0x1cff('0x1b')](0x194);}return _0x21ef76;};}function handleError(_0x206109,_0x25d628){_0x25d628=_0x25d628||0x1f4;return function(_0x546d36){logger[_0x1cff('0x27')](_0x546d36[_0x1cff('0x28')]);if(_0x546d36[_0x1cff('0x29')]){delete _0x546d36[_0x1cff('0x29')];}_0x206109[_0x1cff('0x1c')](_0x25d628)['send'](_0x546d36);};}exports[_0x1cff('0x2a')]=function(_0x7b0c4d,_0x43a884){var _0x299e43={},_0x2e4034={},_0x321bfa={'count':0x0,'rows':[]};var _0x3c56f8=_['map'](db[_0x1cff('0x2b')]['rawAttributes'],function(_0x1715e5){return{'name':_0x1715e5[_0x1cff('0x2c')],'type':_0x1715e5[_0x1cff('0x2d')][_0x1cff('0x2e')]};});_0x2e4034['model']=_[_0x1cff('0x2f')](_0x3c56f8,_0x1cff('0x29'));_0x2e4034[_0x1cff('0x30')]=_[_0x1cff('0x31')](_0x7b0c4d['query']);_0x2e4034['filters']=_['intersection'](_0x2e4034['model'],_0x2e4034[_0x1cff('0x30')]);_0x299e43[_0x1cff('0x32')]=_[_0x1cff('0x33')](_0x2e4034['model'],qs[_0x1cff('0x34')](_0x7b0c4d[_0x1cff('0x30')]['fields']));_0x299e43[_0x1cff('0x32')]=_0x299e43['attributes'][_0x1cff('0x35')]?_0x299e43[_0x1cff('0x32')]:_0x2e4034[_0x1cff('0x36')];if(!_0x7b0c4d[_0x1cff('0x30')][_0x1cff('0x37')](_0x1cff('0x38'))){_0x299e43[_0x1cff('0x20')]=qs[_0x1cff('0x20')](_0x7b0c4d[_0x1cff('0x30')]['limit']);_0x299e43['offset']=qs[_0x1cff('0x1e')](_0x7b0c4d[_0x1cff('0x30')][_0x1cff('0x1e')]);}_0x299e43[_0x1cff('0x39')]=qs[_0x1cff('0x3a')](_0x7b0c4d[_0x1cff('0x30')][_0x1cff('0x3a')]);_0x299e43[_0x1cff('0x3b')]=qs[_0x1cff('0x3c')](_['pick'](_0x7b0c4d[_0x1cff('0x30')],_0x2e4034[_0x1cff('0x3c')]),_0x3c56f8);if(_0x7b0c4d[_0x1cff('0x30')]['filter']){_0x299e43[_0x1cff('0x3b')]=_['merge'](_0x299e43[_0x1cff('0x3b')],{'$or':_[_0x1cff('0x2f')](_0x3c56f8,function(_0x2d534b){if(_0x2d534b[_0x1cff('0x2d')]!==_0x1cff('0x3d')){var _0x4d216b={};_0x4d216b[_0x2d534b[_0x1cff('0x29')]]={'$like':'%'+_0x7b0c4d[_0x1cff('0x30')]['filter']+'%'};return _0x4d216b;}})});}_0x299e43=_[_0x1cff('0x3e')]({},_0x299e43,_0x7b0c4d[_0x1cff('0x3f')]);var _0x33e4bf={'where':_0x299e43['where']};return db[_0x1cff('0x2b')][_0x1cff('0x21')](_0x33e4bf)[_0x1cff('0x40')](function(_0x23d3c8){_0x321bfa[_0x1cff('0x21')]=_0x23d3c8;if(_0x7b0c4d[_0x1cff('0x30')][_0x1cff('0x41')]){_0x299e43[_0x1cff('0x42')]=[{'all':!![]}];}return db[_0x1cff('0x2b')][_0x1cff('0x43')](_0x299e43);})['then'](function(_0x5b4291){_0x321bfa['rows']=_0x5b4291;return _0x321bfa;})[_0x1cff('0x40')](respondWithFilteredResult(_0x43a884,_0x299e43))[_0x1cff('0x44')](handleError(_0x43a884,null));};exports['show']=function(_0x2a513a,_0x3c8e7e){var _0x1cc8c6={'raw':!![],'where':{'id':_0x2a513a[_0x1cff('0x45')]['id']}},_0x2aba4c={};_0x2aba4c[_0x1cff('0x36')]=_[_0x1cff('0x31')](db[_0x1cff('0x2b')][_0x1cff('0x46')]);_0x2aba4c[_0x1cff('0x30')]=_[_0x1cff('0x31')](_0x2a513a[_0x1cff('0x30')]);_0x2aba4c[_0x1cff('0x3c')]=_[_0x1cff('0x33')](_0x2aba4c[_0x1cff('0x36')],_0x2aba4c['query']);_0x1cc8c6[_0x1cff('0x32')]=_['intersection'](_0x2aba4c[_0x1cff('0x36')],qs[_0x1cff('0x34')](_0x2a513a[_0x1cff('0x30')][_0x1cff('0x34')]));_0x1cc8c6['attributes']=_0x1cc8c6[_0x1cff('0x32')][_0x1cff('0x35')]?_0x1cc8c6[_0x1cff('0x32')]:_0x2aba4c[_0x1cff('0x36')];if(_0x2a513a[_0x1cff('0x30')][_0x1cff('0x41')]){_0x1cc8c6['include']=[{'all':!![]}];}_0x1cc8c6=_[_0x1cff('0x3e')]({},_0x1cc8c6,_0x2a513a['options']);return db[_0x1cff('0x2b')]['find'](_0x1cc8c6)[_0x1cff('0x40')](handleEntityNotFound(_0x3c8e7e,null))[_0x1cff('0x40')](respondWithResult(_0x3c8e7e,null))[_0x1cff('0x44')](handleError(_0x3c8e7e,null));};exports[_0x1cff('0x47')]=function(_0x597f23,_0x28d5fd){return db['ChatGroup'][_0x1cff('0x47')](_0x597f23[_0x1cff('0x48')],{})[_0x1cff('0x40')](respondWithResult(_0x28d5fd,0xc9))[_0x1cff('0x44')](handleError(_0x28d5fd,null));};exports[_0x1cff('0x49')]=function(_0x40b3f7,_0xff668e){if(_0x40b3f7[_0x1cff('0x48')]['id']){delete _0x40b3f7[_0x1cff('0x48')]['id'];}return db[_0x1cff('0x2b')][_0x1cff('0x4a')]({'where':{'id':_0x40b3f7[_0x1cff('0x45')]['id']}})[_0x1cff('0x40')](handleEntityNotFound(_0xff668e,null))['then'](saveUpdates(_0x40b3f7[_0x1cff('0x48')],null))[_0x1cff('0x40')](respondWithResult(_0xff668e,null))[_0x1cff('0x44')](handleError(_0xff668e,null));};exports[_0x1cff('0x4b')]=function(_0x2c69d5,_0x4cc6ee){return db['ChatGroup'][_0x1cff('0x4a')]({'where':{'id':_0x2c69d5[_0x1cff('0x45')]['id']}})[_0x1cff('0x40')](handleEntityNotFound(_0x4cc6ee,null))[_0x1cff('0x40')](removeEntity(_0x4cc6ee,null))['catch'](handleError(_0x4cc6ee,null));};exports[_0x1cff('0x4c')]=function(_0x2042d6,_0x51f7bd){return db['ChatGroup'][_0x1cff('0x4c')]()[_0x1cff('0x40')](respondWithResult(_0x51f7bd,null))[_0x1cff('0x44')](handleError(_0x51f7bd,null));};exports[_0x1cff('0x4d')]=function(_0x401785,_0x3b603a,_0x1c0a14){return db[_0x1cff('0x4e')][_0x1cff('0x21')]({'where':{'ChatGroupId':_0x401785[_0x1cff('0x45')]['id'],'ToId':_0x401785[_0x1cff('0x4f')]['id'],'read':![]}})[_0x1cff('0x40')](function(_0x4bdb56){return{'id':_[_0x1cff('0x50')](_0x401785[_0x1cff('0x45')]['id']),'count':_0x4bdb56};})[_0x1cff('0x40')](respondWithResult(_0x3b603a,null))['catch'](handleError(_0x3b603a,null));};exports['addMembers']=function(_0x2a7f85,_0x382435,_0x39e257){return db[_0x1cff('0x2b')][_0x1cff('0x4a')]({'where':{'id':_0x2a7f85[_0x1cff('0x45')]['id']}})[_0x1cff('0x40')](handleEntityNotFound(_0x382435,null))[_0x1cff('0x40')](function(_0x166996){if(_0x166996){return _0x166996['addMembers'](_0x2a7f85[_0x1cff('0x48')][_0x1cff('0x51')],_[_0x1cff('0x52')](_0x2a7f85['body'],['ids','id'])||{});}})[_0x1cff('0x40')](respondWithResult(_0x382435,null))[_0x1cff('0x44')](handleError(_0x382435,null));};exports[_0x1cff('0x53')]=function(_0x52c143,_0x251357,_0x301638){var _0x19c6b9={};var _0x14afff={};var _0xb25a1f;var _0x43948a;return db['ChatGroup'][_0x1cff('0x54')]({'where':{'id':_0x52c143['params']['id']}})[_0x1cff('0x40')](handleEntityNotFound(_0x251357,null))[_0x1cff('0x40')](function(_0x5b4b46){if(_0x5b4b46){_0xb25a1f=_0x5b4b46;_0x14afff[_0x1cff('0x36')]=_[_0x1cff('0x31')](db[_0x1cff('0x55')][_0x1cff('0x46')]);_0x14afff[_0x1cff('0x30')]=_[_0x1cff('0x31')](_0x52c143[_0x1cff('0x30')]);_0x14afff[_0x1cff('0x3c')]=_[_0x1cff('0x33')](_0x14afff[_0x1cff('0x36')],_0x14afff['query']);_0x19c6b9[_0x1cff('0x32')]=_[_0x1cff('0x33')](_0x14afff['model'],qs[_0x1cff('0x34')](_0x52c143[_0x1cff('0x30')][_0x1cff('0x34')]));_0x19c6b9[_0x1cff('0x32')]=_0x19c6b9[_0x1cff('0x32')]['length']?_0x19c6b9['attributes']:_0x14afff[_0x1cff('0x36')];_0x19c6b9['order']=qs[_0x1cff('0x3a')](_0x52c143[_0x1cff('0x30')][_0x1cff('0x3a')]);_0x19c6b9[_0x1cff('0x3b')]=qs['filters'](_[_0x1cff('0x56')](_0x52c143[_0x1cff('0x30')],_0x14afff[_0x1cff('0x3c')]));if(_0x52c143[_0x1cff('0x30')][_0x1cff('0x57')]){_0x19c6b9[_0x1cff('0x3b')]=_[_0x1cff('0x3e')](_0x19c6b9[_0x1cff('0x3b')],{'$or':_['map'](_0x19c6b9[_0x1cff('0x32')],function(_0x40ae2f){var _0x52963c={};_0x52963c[_0x40ae2f]={'$like':'%'+_0x52c143[_0x1cff('0x30')][_0x1cff('0x57')]+'%'};return _0x52963c;})});}_0x19c6b9=_[_0x1cff('0x3e')]({},_0x19c6b9,_0x52c143[_0x1cff('0x3f')]);return _0xb25a1f[_0x1cff('0x53')](_0x19c6b9);}})['then'](function(_0x1a6ba9){if(_0x1a6ba9){_0x43948a=_0x1a6ba9['length'];if(!_0x52c143[_0x1cff('0x30')][_0x1cff('0x37')]('nolimit')){_0x19c6b9[_0x1cff('0x20')]=qs['limit'](_0x52c143[_0x1cff('0x30')]['limit']);_0x19c6b9[_0x1cff('0x1e')]=qs['offset'](_0x52c143[_0x1cff('0x30')][_0x1cff('0x1e')]);}return _0xb25a1f[_0x1cff('0x53')](_0x19c6b9);}})[_0x1cff('0x40')](function(_0xea6294){if(_0xea6294){return _0xea6294?{'count':_0x43948a,'rows':_0xea6294}:null;}})[_0x1cff('0x40')](respondWithResult(_0x251357,null))[_0x1cff('0x44')](handleError(_0x251357,null));};exports[_0x1cff('0x58')]=function(_0x2f5d24,_0x3c5151,_0xedf31c){return db['ChatGroup'][_0x1cff('0x4a')]({'where':{'id':_0x2f5d24[_0x1cff('0x45')]['id']}})[_0x1cff('0x40')](handleEntityNotFound(_0x3c5151,null))[_0x1cff('0x40')](function(_0x3881ea){if(_0x3881ea){return _0x3881ea[_0x1cff('0x58')](_0x2f5d24[_0x1cff('0x30')]['ids']);}})['then'](respondWithStatusCode(_0x3c5151,null))[_0x1cff('0x44')](handleError(_0x3c5151,null));};exports[_0x1cff('0x59')]=function(_0x1ad8f0,_0x2b7871,_0x27a47e){if(_0x1ad8f0[_0x1cff('0x48')]['id']){delete _0x1ad8f0[_0x1cff('0x48')]['id'];}return db[_0x1cff('0x2b')][_0x1cff('0x4a')]({'where':{'id':_0x1ad8f0[_0x1cff('0x45')]['id']}})[_0x1cff('0x40')](handleEntityNotFound(_0x2b7871,null))[_0x1cff('0x40')](function(_0xa72b78){if(_0xa72b78){_0x1ad8f0[_0x1cff('0x48')]['ChatGroupId']=_0xa72b78['id'];return db[_0x1cff('0x4e')][_0x1cff('0x47')](_0x1ad8f0[_0x1cff('0x48')]);}})[_0x1cff('0x40')](respondWithResult(_0x2b7871,null))['catch'](handleError(_0x2b7871,null));};exports[_0x1cff('0x5a')]=function(_0x351cb5,_0x24783c,_0x5c7468){var _0x1e30de={};var _0x43b453={};var _0x455b51;var _0x2ef5b8;return db[_0x1cff('0x2b')][_0x1cff('0x54')]({'where':{'id':_0x351cb5[_0x1cff('0x45')]['id']}})['then'](handleEntityNotFound(_0x24783c,null))[_0x1cff('0x40')](function(_0x1edc0c){if(_0x1edc0c){_0x455b51=_0x1edc0c;_0x43b453[_0x1cff('0x36')]=_[_0x1cff('0x31')](db[_0x1cff('0x4e')][_0x1cff('0x46')]);_0x43b453['query']=_[_0x1cff('0x31')](_0x351cb5[_0x1cff('0x30')]);_0x43b453['filters']=_[_0x1cff('0x33')](_0x43b453[_0x1cff('0x36')],_0x43b453['query']);_0x1e30de[_0x1cff('0x32')]=_['intersection'](_0x43b453[_0x1cff('0x36')],qs[_0x1cff('0x34')](_0x351cb5[_0x1cff('0x30')][_0x1cff('0x34')]));_0x1e30de[_0x1cff('0x32')]=_0x1e30de[_0x1cff('0x32')][_0x1cff('0x35')]?_0x1e30de[_0x1cff('0x32')]:_0x43b453[_0x1cff('0x36')];_0x1e30de[_0x1cff('0x39')]=qs[_0x1cff('0x3a')](_0x351cb5[_0x1cff('0x30')]['sort']);_0x1e30de[_0x1cff('0x3b')]=qs['filters'](_[_0x1cff('0x56')](_0x351cb5['query'],_0x43b453[_0x1cff('0x3c')]));if(_0x351cb5[_0x1cff('0x30')]['filter']){_0x1e30de['where']=_[_0x1cff('0x3e')](_0x1e30de['where'],{'$or':_[_0x1cff('0x2f')](_0x1e30de[_0x1cff('0x32')],function(_0x198e0a){var _0x2aa255={};_0x2aa255[_0x198e0a]={'$like':'%'+_0x351cb5[_0x1cff('0x30')][_0x1cff('0x57')]+'%'};return _0x2aa255;})});}if(_0x351cb5['query'][_0x1cff('0x5b')]){var _0x272a3a=_0x351cb5[_0x1cff('0x30')][_0x1cff('0x5b')]['split'](',');var _0x61ac61={};_0x61ac61[_0x272a3a[0x0]]={'$gte':moment(_0x272a3a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1e30de[_0x1cff('0x3b')]=_['merge'](_0x1e30de[_0x1cff('0x3b')],_0x61ac61);}_0x1e30de=_['merge']({},_0x1e30de,_0x351cb5[_0x1cff('0x3f')]);return _0x455b51['getMessages'](_0x1e30de);}})[_0x1cff('0x40')](function(_0x4ee67a){if(_0x4ee67a){_0x2ef5b8=_0x4ee67a[_0x1cff('0x35')];if(!_0x351cb5[_0x1cff('0x30')][_0x1cff('0x37')](_0x1cff('0x38'))){_0x1e30de[_0x1cff('0x20')]=qs[_0x1cff('0x20')](_0x351cb5[_0x1cff('0x30')][_0x1cff('0x20')]);_0x1e30de['offset']=qs[_0x1cff('0x1e')](_0x351cb5[_0x1cff('0x30')][_0x1cff('0x1e')]);}return _0x455b51[_0x1cff('0x5a')](_0x1e30de);}})[_0x1cff('0x40')](function(_0xf81065){if(_0xf81065){return _0xf81065?{'count':_0x2ef5b8,'rows':_0xf81065}:null;}})[_0x1cff('0x40')](respondWithResult(_0x24783c,null))[_0x1cff('0x44')](handleError(_0x24783c,null));};
\ No newline at end of file
index d3bf312..32d51a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb79=['ChatGroup','update','hook','exports','events','../../mysqldb'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdb79,0x1e4));var _0x9db7=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xdb79[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require(_0x9db7('0x0'));var ChatGroup=require(_0x9db7('0x1'))['db'][_0x9db7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9db7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x9ed17){return function(_0x4cce35,_0x158a1b,_0x18c74a){ChatGroupEvents['emit'](_0x9ed17+':'+_0x4cce35['id'],_0x4cce35);ChatGroupEvents['emit'](_0x9ed17,_0x4cce35);_0x18c74a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9db7('0x4')](e,emitEvent(event));}}module[_0x9db7('0x5')]=ChatGroupEvents;
\ No newline at end of file
+var _0xb016=['remove','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb016,0x159));var _0x6b01=function(_0x28649b,_0x2c8706){_0x28649b=_0x28649b-0x0;var _0x25e9ac=_0xb016[_0x28649b];return _0x25e9ac;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var ChatGroup=require(_0x6b01('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x2'),'afterUpdate':'update','afterDestroy':_0x6b01('0x3')};function emitEvent(_0x464e83){return function(_0x161b59,_0x3b9de1,_0x5964ca){ChatGroupEvents[_0x6b01('0x4')](_0x464e83+':'+_0x161b59['id'],_0x161b59);ChatGroupEvents[_0x6b01('0x4')](_0x464e83,_0x161b59);_0x5964ca(null);};}for(var e in events){if(events[_0x6b01('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents;
\ No newline at end of file
index 2cedca6..710a5d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c1f=['chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatGroup'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x4c1f,0xcd));var _0xf4c1=function(_0x83bdf1,_0x3126e3){_0x83bdf1=_0x83bdf1-0x0;var _0x45c311=_0x4c1f[_0x83bdf1];return _0x45c311;};'use strict';var _=require(_0xf4c1('0x0'));var util=require('util');var logger=require(_0xf4c1('0x1'))(_0xf4c1('0x2'));var moment=require(_0xf4c1('0x3'));var BPromise=require(_0xf4c1('0x4'));var rp=require(_0xf4c1('0x5'));var fs=require('fs');var path=require(_0xf4c1('0x6'));var rimraf=require('rimraf');var config=require(_0xf4c1('0x7'));var attributes=require('./chatGroup.attributes');module[_0xf4c1('0x8')]=function(_0x41bb7b,_0x21d394){return _0x41bb7b[_0xf4c1('0x9')](_0xf4c1('0xa'),attributes,{'tableName':_0xf4c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xca6d=['rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1954a2,_0x92b724){var _0x32eab4=function(_0x48910a){while(--_0x48910a){_0x1954a2['push'](_0x1954a2['shift']());}};_0x32eab4(++_0x92b724);}(_0xca6d,0x117));var _0xdca6=function(_0x13cf5e,_0x216f0b){_0x13cf5e=_0x13cf5e-0x0;var _0xb26f15=_0xca6d[_0x13cf5e];return _0xb26f15;};'use strict';var _=require(_0xdca6('0x0'));var util=require(_0xdca6('0x1'));var logger=require(_0xdca6('0x2'))(_0xdca6('0x3'));var moment=require(_0xdca6('0x4'));var BPromise=require(_0xdca6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdca6('0x6'));var rimraf=require(_0xdca6('0x7'));var config=require('../../config/environment');var attributes=require(_0xdca6('0x8'));module[_0xdca6('0x9')]=function(_0x50a5ab,_0x4418f8){return _0x50a5ab[_0xdca6('0xa')](_0xdca6('0xb'),attributes,{'tableName':_0xdca6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e93985f..cb02752 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3685=['error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x33adeb,_0x2a9393){var _0x579bed=function(_0x429cde){while(--_0x429cde){_0x33adeb['push'](_0x33adeb['shift']());}};_0x579bed(++_0x2a9393);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var moment=require(_0x5368('0x1'));var BPromise=require(_0x5368('0x2'));var rs=require(_0x5368('0x3'));var fs=require('fs');var Redis=require(_0x5368('0x4'));var db=require(_0x5368('0x5'))['db'];var utils=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var jayson=require(_0x5368('0xa'));var client=jayson['client'][_0x5368('0xb')]({'port':0x232a});config[_0x5368('0xc')]=_[_0x5368('0xd')](config[_0x5368('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5368('0xe'))(new Redis(config[_0x5368('0xc')]));require(_0x5368('0xf'))[_0x5368('0x10')](socket);function respondWithRpcPromise(_0x14949b,_0x169e4a,_0xc001de){return new BPromise(function(_0x9823c9,_0x521e25){return client[_0x5368('0x11')](_0x14949b,_0xc001de)[_0x5368('0x12')](function(_0x27fc4f){logger['info'](_0x5368('0x13'),_0x169e4a,_0x5368('0x14'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x169e4a,'request\x20sent',JSON[_0x5368('0x15')](_0x27fc4f));if(_0x27fc4f[_0x5368('0x16')]){if(_0x27fc4f[_0x5368('0x16')][_0x5368('0x17')]===0x1f4){logger[_0x5368('0x16')](_0x5368('0x13'),_0x169e4a,_0x27fc4f[_0x5368('0x16')][_0x5368('0x18')]);return _0x521e25(_0x27fc4f[_0x5368('0x16')][_0x5368('0x18')]);}logger['error'](_0x5368('0x13'),_0x169e4a,_0x27fc4f[_0x5368('0x16')]['message']);return _0x9823c9(_0x27fc4f[_0x5368('0x16')][_0x5368('0x18')]);}else{logger[_0x5368('0x19')](_0x5368('0x13'),_0x169e4a,'request\x20sent');_0x9823c9(_0x27fc4f[_0x5368('0x1a')]['message']);}})['catch'](function(_0x996434){logger['error']('ChatGroup,\x20%s,\x20%s',_0x169e4a,_0x996434);_0x521e25(_0x996434);});});}
\ No newline at end of file
+var _0xdbad=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xdbad,0x8d));var _0xddba=function(_0x52cea2,_0x11d06a){_0x52cea2=_0x52cea2-0x0;var _0x5f04c1=_0xdbad[_0x52cea2];return _0x5f04c1;};'use strict';var _=require(_0xddba('0x0'));var util=require(_0xddba('0x1'));var moment=require(_0xddba('0x2'));var BPromise=require(_0xddba('0x3'));var rs=require(_0xddba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddba('0x5'))['db'];var utils=require(_0xddba('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xddba('0x7'));var jayson=require(_0xddba('0x8'));var client=jayson['client'][_0xddba('0x9')]({'port':0x232a});config[_0xddba('0xa')]=_[_0xddba('0xb')](config[_0xddba('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xddba('0xa')]));require(_0xddba('0xc'))[_0xddba('0xd')](socket);function respondWithRpcPromise(_0x160a84,_0x44e767,_0x100421){return new BPromise(function(_0x2cda01,_0x27a30b){return client['request'](_0x160a84,_0x100421)[_0xddba('0xe')](function(_0x124cce){logger['info'](_0xddba('0xf'),_0x44e767,_0xddba('0x10'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x44e767,_0xddba('0x10'),JSON[_0xddba('0x11')](_0x124cce));if(_0x124cce['error']){if(_0x124cce[_0xddba('0x12')][_0xddba('0x13')]===0x1f4){logger[_0xddba('0x12')](_0xddba('0xf'),_0x44e767,_0x124cce[_0xddba('0x12')][_0xddba('0x14')]);return _0x27a30b(_0x124cce['error'][_0xddba('0x14')]);}logger[_0xddba('0x12')](_0xddba('0xf'),_0x44e767,_0x124cce[_0xddba('0x12')][_0xddba('0x14')]);return _0x2cda01(_0x124cce[_0xddba('0x12')][_0xddba('0x14')]);}else{logger['info'](_0xddba('0xf'),_0x44e767,'request\x20sent');_0x2cda01(_0x124cce[_0xddba('0x15')]['message']);}})[_0xddba('0x16')](function(_0x7772f2){logger['error'](_0xddba('0xf'),_0x44e767,_0x7772f2);_0x27a30b(_0x7772f2);});});}
\ No newline at end of file
index f606f19..86568b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b3d=['remove','update','removeListener','register','length','./chatGroup.events','save'];(function(_0xcedf4,_0x4a0de2){var _0x5dde6b=function(_0x3f5aa8){while(--_0x3f5aa8){_0xcedf4['push'](_0xcedf4['shift']());}};_0x5dde6b(++_0x4a0de2);}(_0x0b3d,0x1cc));var _0xd0b3=function(_0x189d12,_0x17aafc){_0x189d12=_0x189d12-0x0;var _0x39b0ad=_0x0b3d[_0x189d12];return _0x39b0ad;};'use strict';var ChatGroupEvents=require(_0xd0b3('0x0'));var events=[_0xd0b3('0x1'),_0xd0b3('0x2'),_0xd0b3('0x3')];function createListener(_0x12cb2f,_0x36eb31){return function(_0x3703e7){_0x36eb31['emit'](_0x12cb2f,_0x3703e7);};}function removeListener(_0x22787d,_0x3ffa95){return function(){ChatGroupEvents[_0xd0b3('0x4')](_0x22787d,_0x3ffa95);};}exports[_0xd0b3('0x5')]=function(_0x23039a){for(var _0x162d78=0x0,_0x23508b=events[_0xd0b3('0x6')];_0x162d78<_0x23508b;_0x162d78++){var _0x4fa9b8=events[_0x162d78];var _0x4660ba=createListener('chatGroup:'+_0x4fa9b8,_0x23039a);ChatGroupEvents['on'](_0x4fa9b8,_0x4660ba);}};
\ No newline at end of file
+var _0x8e0d=['./chatGroup.events','update','emit','length','chatGroup:'];(function(_0x508ef9,_0x5563ce){var _0x46fcb7=function(_0x2a6a3a){while(--_0x2a6a3a){_0x508ef9['push'](_0x508ef9['shift']());}};_0x46fcb7(++_0x5563ce);}(_0x8e0d,0x82));var _0xd8e0=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x8e0d[_0x179e11];return _0x549f04;};'use strict';var ChatGroupEvents=require(_0xd8e0('0x0'));var events=['save','remove',_0xd8e0('0x1')];function createListener(_0x11f7df,_0x549e82){return function(_0x3ee520){_0x549e82[_0xd8e0('0x2')](_0x11f7df,_0x3ee520);};}function removeListener(_0x14598d,_0xe9c59f){return function(){ChatGroupEvents['removeListener'](_0x14598d,_0xe9c59f);};}exports['register']=function(_0x2e79ab){for(var _0x33ff41=0x0,_0x42d42b=events[_0xd8e0('0x3')];_0x33ff41<_0x42d42b;_0x33ff41++){var _0x5e9735=events[_0x33ff41];var _0xd0c45c=createListener(_0xd8e0('0x4')+_0x5e9735,_0x2e79ab);ChatGroupEvents['on'](_0x5e9735,_0xd0c45c);}};
\ No newline at end of file
index 8fc91e6..ba87962 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69fd=['put','/:id','delete','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','describe','get','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage'];(function(_0x381ce1,_0x1e9357){var _0x5c6c70=function(_0x57ede8){while(--_0x57ede8){_0x381ce1['push'](_0x381ce1['shift']());}};_0x5c6c70(++_0x1e9357);}(_0x69fd,0x79));var _0xd69f=function(_0x28f948,_0x39235e){_0x28f948=_0x28f948-0x0;var _0x45d8b0=_0x69fd[_0x28f948];return _0x45d8b0;};'use strict';var multer=require(_0xd69f('0x0'));var util=require(_0xd69f('0x1'));var path=require(_0xd69f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd69f('0x3'));var router=express[_0xd69f('0x4')]();var fs_extra=require(_0xd69f('0x5'));var auth=require(_0xd69f('0x6'));var interaction=require(_0xd69f('0x7'));var config=require(_0xd69f('0x8'));var controller=require(_0xd69f('0x9'));router['get']('/',auth[_0xd69f('0xa')](),controller[_0xd69f('0xb')]);router['get']('/describe',auth[_0xd69f('0xa')](),controller[_0xd69f('0xc')]);router[_0xd69f('0xd')]('/:id',auth[_0xd69f('0xa')](),controller[_0xd69f('0xe')]);router[_0xd69f('0xd')](_0xd69f('0xf'),auth[_0xd69f('0xa')](),controller[_0xd69f('0x10')]);router[_0xd69f('0xd')](_0xd69f('0x11'),auth[_0xd69f('0xa')](),controller[_0xd69f('0x12')]);router[_0xd69f('0xd')](_0xd69f('0x13'),auth[_0xd69f('0xa')](),controller['getMessages']);router[_0xd69f('0x14')]('/',auth['isAuthenticated'](),controller[_0xd69f('0x15')]);router[_0xd69f('0x14')](_0xd69f('0x11'),auth[_0xd69f('0xa')](),controller[_0xd69f('0x16')]);router[_0xd69f('0x14')](_0xd69f('0x13'),auth[_0xd69f('0xa')](),controller[_0xd69f('0x17')]);router[_0xd69f('0x18')](_0xd69f('0x19'),auth[_0xd69f('0xa')](),controller['update']);router[_0xd69f('0x1a')](_0xd69f('0x19'),auth[_0xd69f('0xa')](),controller['destroy']);router['delete'](_0xd69f('0x11'),auth['isAuthenticated'](),controller[_0xd69f('0x1b')]);module[_0xd69f('0x1c')]=router;
\ No newline at end of file
+var _0xbd24=['/:id','show','/:id/unread','/:id/messages','getMessages','post','create','addMessage','put','update','delete','destroy','/:id/members','removeMembers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbd24,0x138));var _0x4bd2=function(_0x5b8608,_0x527731){_0x5b8608=_0x5b8608-0x0;var _0x3f8d3d=_0xbd24[_0x5b8608];return _0x3f8d3d;};'use strict';var multer=require('multer');var util=require(_0x4bd2('0x0'));var path=require(_0x4bd2('0x1'));var timeout=require(_0x4bd2('0x2'));var express=require(_0x4bd2('0x3'));var router=express[_0x4bd2('0x4')]();var fs_extra=require(_0x4bd2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4bd2('0x6'));var config=require(_0x4bd2('0x7'));var controller=require(_0x4bd2('0x8'));router['get']('/',auth[_0x4bd2('0x9')](),controller[_0x4bd2('0xa')]);router[_0x4bd2('0xb')]('/describe',auth[_0x4bd2('0x9')](),controller['describe']);router[_0x4bd2('0xb')](_0x4bd2('0xc'),auth['isAuthenticated'](),controller[_0x4bd2('0xd')]);router[_0x4bd2('0xb')](_0x4bd2('0xe'),auth['isAuthenticated'](),controller['getUnread']);router[_0x4bd2('0xb')]('/:id/members',auth[_0x4bd2('0x9')](),controller['getMembers']);router[_0x4bd2('0xb')](_0x4bd2('0xf'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x10')]);router[_0x4bd2('0x11')]('/',auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x12')]);router[_0x4bd2('0x11')]('/:id/members',auth[_0x4bd2('0x9')](),controller['addMembers']);router[_0x4bd2('0x11')]('/:id/messages',auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x13')]);router[_0x4bd2('0x14')](_0x4bd2('0xc'),auth['isAuthenticated'](),controller[_0x4bd2('0x15')]);router[_0x4bd2('0x16')](_0x4bd2('0xc'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x17')]);router[_0x4bd2('0x16')](_0x4bd2('0x18'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x19')]);module[_0x4bd2('0x1a')]=router;
\ No newline at end of file
index bb3e1c4..b9f99b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4dd3=['DATE','STRING','long','ENUM','out','sequelize','exports','BOOLEAN','star','TEXT'];(function(_0x1e4f33,_0x3d0af1){var _0x335ea5=function(_0x11cb80){while(--_0x11cb80){_0x1e4f33['push'](_0x1e4f33['shift']());}};_0x335ea5(++_0x3d0af1);}(_0x4dd3,0xf5));var _0x34dd=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x4dd3[_0x547456];return _0xc1fd7b;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'closed':{'type':Sequelize[_0x34dd('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x34dd('0x3'),'thumb'),'defaultValue':_0x34dd('0x3')},'ratingMessage':{'type':Sequelize[_0x34dd('0x4')]},'pathTranscript':{'type':Sequelize[_0x34dd('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x34dd('0x5')]},'disposition':{'type':Sequelize[_0x34dd('0x6')]},'secondDisposition':{'type':Sequelize[_0x34dd('0x6')]},'thirdDisposition':{'type':Sequelize[_0x34dd('0x6')]},'note':{'type':Sequelize[_0x34dd('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x34dd('0x6')]},'osVersion':{'type':Sequelize[_0x34dd('0x6')]},'deviceModel':{'type':Sequelize[_0x34dd('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x34dd('0x6')]},'referer':{'type':Sequelize[_0x34dd('0x4')]},'customerIp':{'type':Sequelize[_0x34dd('0x6')]},'formData':{'type':Sequelize[_0x34dd('0x4')](_0x34dd('0x7'))},'read1stAt':{'type':Sequelize[_0x34dd('0x5')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x34dd('0x8')]('in',_0x34dd('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x34dd('0x6')]},'customerPort':{'type':Sequelize[_0x34dd('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x34dd('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x6075=['DATE','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star','STRING','TEXT','long'];(function(_0x4e0e36,_0x5ded03){var _0x44943b=function(_0x47cd25){while(--_0x47cd25){_0x4e0e36['push'](_0x4e0e36['shift']());}};_0x44943b(++_0x5ded03);}(_0x6075,0x142));var _0x5607=function(_0x20acf6,_0x4d1465){_0x20acf6=_0x20acf6-0x0;var _0x232681=_0x6075[_0x20acf6];return _0x232681;};'use strict';var Sequelize=require(_0x5607('0x0'));module[_0x5607('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5607('0x2')]},'ratingType':{'type':Sequelize[_0x5607('0x3')]('star','thumb'),'defaultValue':_0x5607('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x5607('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5607('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5607('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x5607('0x5')]},'browserVersion':{'type':Sequelize[_0x5607('0x5')]},'osName':{'type':Sequelize[_0x5607('0x5')]},'osVersion':{'type':Sequelize[_0x5607('0x5')]},'deviceModel':{'type':Sequelize[_0x5607('0x5')]},'deviceVendor':{'type':Sequelize[_0x5607('0x5')]},'deviceType':{'type':Sequelize[_0x5607('0x5')]},'referer':{'type':Sequelize[_0x5607('0x6')]},'customerIp':{'type':Sequelize[_0x5607('0x5')]},'formData':{'type':Sequelize[_0x5607('0x6')](_0x5607('0x7'))},'read1stAt':{'type':Sequelize[_0x5607('0x8')]},'lastMsgAt':{'type':Sequelize[_0x5607('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5607('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5607('0x5')]},'customerPort':{'type':Sequelize[_0x5607('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x5607('0xa')],'defaultValue':![]}};
\ No newline at end of file
index 380058c..e77df63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf197=['Messages','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','rows','getMyMessages','nolimit','pick','push','addTags','setTags','color','chatInteractionTags:save','removeTags','toString','server','tmp','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','browserName','osName','referer','customerIp','customerPort','N.A.','tail','pipe','createWriteStream','renderFile','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','http','client','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','stack','name','send','merge','body','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','vidaooEscalation','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','User','ChatWebsiteId'];(function(_0x5e871f,_0x4acf6e){var _0x18d9fc=function(_0x260115){while(--_0x260115){_0x5e871f['push'](_0x5e871f['shift']());}};_0x18d9fc(++_0x4acf6e);}(_0xf197,0x1e6));var _0x7f19=function(_0x4ee450,_0x56c699){_0x4ee450=_0x4ee450-0x0;var _0x597b52=_0xf197[_0x4ee450];return _0x597b52;};'use strict';var rimraf=require(_0x7f19('0x0'));var zipdir=require(_0x7f19('0x1'));var rp=require(_0x7f19('0x2'));var moment=require(_0x7f19('0x3'));var BPromise=require(_0x7f19('0x4'));var Mustache=require(_0x7f19('0x5'));var util=require(_0x7f19('0x6'));var path=require(_0x7f19('0x7'));var ejs=require(_0x7f19('0x8'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7f19('0x9'));var interaction=require(_0x7f19('0xa'));var qs=require(_0x7f19('0xb'));var pdf=require(_0x7f19('0xc'));var logger=require(_0x7f19('0xd'))('api');var config=require(_0x7f19('0xe'));var db=require(_0x7f19('0xf'))['db'];config['redis']=_['defaults'](config[_0x7f19('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f19('0x11'))(new Redis(config[_0x7f19('0x10')]));require(_0x7f19('0x12'))[_0x7f19('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7f19('0x14')]({'port':0x232b});var client9004=jayson[_0x7f19('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2688c9,_0x9ef628,_0x4fc5f5,_0x52004c){return new BPromise(function(_0x33c2b0,_0x3c9f05){var _0x213505=_0x52004c||client;return _0x213505['request'](_0x2688c9,_0x4fc5f5)[_0x7f19('0x16')](function(_0x43b4c8){logger[_0x7f19('0x17')](_0x7f19('0x18'),_0x9ef628,'request\x20sent');logger[_0x7f19('0x19')](_0x7f19('0x1a'),_0x9ef628,_0x7f19('0x1b'),JSON['stringify'](_0x43b4c8));if(_0x43b4c8[_0x7f19('0x1c')]){if(_0x43b4c8[_0x7f19('0x1c')][_0x7f19('0x1d')]===0x1f4){logger[_0x7f19('0x1c')](_0x7f19('0x18'),_0x9ef628,_0x43b4c8[_0x7f19('0x1c')][_0x7f19('0x1e')]);return _0x3c9f05(_0x43b4c8['error'][_0x7f19('0x1e')]);}logger[_0x7f19('0x1c')](_0x7f19('0x18'),_0x9ef628,_0x43b4c8[_0x7f19('0x1c')][_0x7f19('0x1e')]);return _0x33c2b0(_0x43b4c8[_0x7f19('0x1c')][_0x7f19('0x1e')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x9ef628,'request\x20sent');_0x33c2b0(_0x43b4c8['result'][_0x7f19('0x1e')]);}})[_0x7f19('0x1f')](function(_0x4ad8d1){logger['error'](_0x7f19('0x18'),_0x9ef628,_0x4ad8d1);_0x3c9f05(_0x4ad8d1);});});}function respondWithStatusCode(_0x228cb8,_0x317183){_0x317183=_0x317183||0xcc;return function(_0x1e5241){if(_0x1e5241){return _0x228cb8[_0x7f19('0x20')](_0x317183);}return _0x228cb8[_0x7f19('0x21')](_0x317183)[_0x7f19('0x22')]();};}function respondWithResult(_0x612605,_0x3a0211){_0x3a0211=_0x3a0211||0xc8;return function(_0xb897a9){if(_0xb897a9){return _0x612605[_0x7f19('0x21')](_0x3a0211)[_0x7f19('0x23')](_0xb897a9);}};}function respondWithFilteredResult(_0x2f489f,_0x32fb05){return function(_0x17e07b){if(_0x17e07b){var _0x2f8bcb=typeof _0x32fb05[_0x7f19('0x24')]===_0x7f19('0x25')&&typeof _0x32fb05[_0x7f19('0x26')]===_0x7f19('0x25');var _0x20172e=_0x17e07b['count'];var _0x4db537=_0x2f8bcb?0x0:_0x32fb05[_0x7f19('0x24')];var _0x3f6452=_0x2f8bcb?_0x17e07b['count']:_0x32fb05['offset']+_0x32fb05[_0x7f19('0x26')];var _0x2c933f;if(_0x3f6452>=_0x20172e){_0x3f6452=_0x20172e;_0x2c933f=0xc8;}else{_0x2c933f=0xce;}_0x2f489f[_0x7f19('0x21')](_0x2c933f);return _0x2f489f[_0x7f19('0x27')](_0x7f19('0x28'),_0x4db537+'-'+_0x3f6452+'/'+_0x20172e)['json'](_0x17e07b);}return null;};}function saveUpdates(_0x20ecbc){return function(_0x1367c5){if(_0x1367c5){return _0x1367c5[_0x7f19('0x29')](_0x20ecbc)[_0x7f19('0x16')](function(_0x30c0b6){return _0x30c0b6;});}return null;};}function removeEntity(_0x53f303){return function(_0x2377c4){if(_0x2377c4){return _0x2377c4[_0x7f19('0x2a')]()[_0x7f19('0x16')](function(){_0x53f303['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c92be){return function(_0x336230){if(!_0x336230){_0x4c92be[_0x7f19('0x20')](0x194);}return _0x336230;};}function handleError(_0x38bbc2,_0x4faa5a){_0x4faa5a=_0x4faa5a||0x1f4;return function(_0x21b748){logger['error'](_0x21b748[_0x7f19('0x2b')]);if(_0x21b748['name']){delete _0x21b748[_0x7f19('0x2c')];}_0x38bbc2[_0x7f19('0x21')](_0x4faa5a)[_0x7f19('0x2d')](_0x21b748);};}function getMustacheRender(_0x4339c1,_0x5e99bf){return Mustache['render'](_0x4339c1,_[_0x7f19('0x2e')](_0x5e99bf[_0x7f19('0x2f')],{'contact':_0x5e99bf['contact'],'message':_0x5e99bf['message'],'agent':_0x5e99bf['agent'],'interaction':_0x5e99bf[_0x7f19('0x30')],'account':_0x5e99bf[_0x7f19('0x31')]}))||'';}exports[_0x7f19('0x32')]=function(_0xa9abde,_0x112f5d){var _0x367685={};var _0x29b67e=_[_0x7f19('0x33')](db[_0x7f19('0x34')][_0x7f19('0x35')],function(_0x1d86b2){return{'name':_0x1d86b2[_0x7f19('0x36')],'type':_0x1d86b2[_0x7f19('0x37')][_0x7f19('0x38')]};});_0x367685=qs[_0x7f19('0x39')](_0x29b67e,_0xa9abde);return interaction[_0x7f19('0x3a')](_0x7f19('0x3b'),_0xa9abde['query'],_0xa9abde[_0x7f19('0x3c')],_0x367685,_0x29b67e)[_0x7f19('0x16')](respondWithFilteredResult(_0x112f5d,_0x367685))[_0x7f19('0x1f')](handleError(_0x112f5d,null));};exports['show']=function(_0x2d5319,_0x134549){var _0x2b2c7a={'raw':![],'where':{'id':_0x2d5319[_0x7f19('0x3d')]['id']}},_0x1cfb74={};_0x1cfb74[_0x7f19('0x3e')]=_[_0x7f19('0x3f')](db[_0x7f19('0x34')][_0x7f19('0x35')]);_0x1cfb74[_0x7f19('0x40')]=_[_0x7f19('0x3f')](_0x2d5319['query']);_0x1cfb74[_0x7f19('0x41')]=_[_0x7f19('0x42')](_0x1cfb74['model'],_0x1cfb74[_0x7f19('0x40')]);_0x2b2c7a[_0x7f19('0x43')]=_[_0x7f19('0x42')](_0x1cfb74[_0x7f19('0x3e')],qs[_0x7f19('0x44')](_0x2d5319['query'][_0x7f19('0x44')]));_0x2b2c7a[_0x7f19('0x43')]=_0x2b2c7a[_0x7f19('0x43')][_0x7f19('0x45')]?_0x2b2c7a[_0x7f19('0x43')]:_0x1cfb74[_0x7f19('0x3e')];if(_0x2d5319[_0x7f19('0x40')][_0x7f19('0x46')]){_0x2b2c7a[_0x7f19('0x47')]=[{'all':!![]}];}_0x2b2c7a=_[_0x7f19('0x2e')]({},_0x2b2c7a,_0x2d5319[_0x7f19('0x48')]);return db[_0x7f19('0x34')]['find'](_0x2b2c7a)[_0x7f19('0x16')](handleEntityNotFound(_0x134549,null))[_0x7f19('0x16')](respondWithResult(_0x134549,null))[_0x7f19('0x1f')](handleError(_0x134549,null));};exports['create']=function(_0x2d920d,_0x41b54c){return db[_0x7f19('0x34')][_0x7f19('0x49')](_0x2d920d[_0x7f19('0x2f')],{})[_0x7f19('0x16')](respondWithResult(_0x41b54c,0xc9))[_0x7f19('0x1f')](handleError(_0x41b54c,null));};exports['update']=function(_0x4c1515,_0x50b7d2){if(_0x4c1515[_0x7f19('0x2f')]['id']){delete _0x4c1515[_0x7f19('0x2f')]['id'];}return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x4c1515[_0x7f19('0x3d')]['id']}})[_0x7f19('0x16')](handleEntityNotFound(_0x50b7d2,null))[_0x7f19('0x16')](saveUpdates(_0x4c1515[_0x7f19('0x2f')],null))[_0x7f19('0x16')](respondWithResult(_0x50b7d2,null))[_0x7f19('0x1f')](handleError(_0x50b7d2,null));};exports['destroy']=function(_0x55faf4,_0xe47aa0){return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x55faf4['params']['id']}})[_0x7f19('0x16')](handleEntityNotFound(_0xe47aa0,null))['then'](removeEntity(_0xe47aa0,null))[_0x7f19('0x1f')](handleError(_0xe47aa0,null));};exports['describe']=function(_0x70f91b,_0x4ec8a9){return db[_0x7f19('0x34')][_0x7f19('0x4b')]()['then'](respondWithResult(_0x4ec8a9,null))[_0x7f19('0x1f')](handleError(_0x4ec8a9,null));};exports[_0x7f19('0x4c')]=function(_0x19fc73,_0x353f87){var _0x4acea4=_0x19fc73[_0x7f19('0x3d')]['id'];var _0x586d90;var _0x3db497;var _0x18a267;return db[_0x7f19('0x34')][_0x7f19('0x4d')]({'where':{'id':_0x4acea4}})[_0x7f19('0x16')](function(_0x4f3fd6){_0x586d90=_0x4f3fd6;return db[_0x7f19('0x4e')][_0x7f19('0x4d')]({'where':{'id':_0x4f3fd6['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x7f19('0x4f'),_0x7f19('0x50'),_0x7f19('0x51')],'raw':!![]});})['then'](function(_0x49af2a){if(_0x49af2a&&_0x49af2a[_0x7f19('0x52')]&&_0x49af2a[_0x7f19('0x53')]){_0x3db497=_0x49af2a;var _0x4c95b6={'interaction':{'id':_0x4acea4},'agent':{'id':_0x19fc73[_0x7f19('0x3c')]['id'],'name':_0x19fc73['user'][_0x7f19('0x2c')],'fullname':_0x19fc73[_0x7f19('0x3c')][_0x7f19('0x54')],'email':_0x19fc73['user'][_0x7f19('0x55')]},'contact':_0x19fc73[_0x7f19('0x2f')]['contact'],'account':_0x19fc73['body'][_0x7f19('0x31')]};var _0x7f3503={'rejectUnauthorized':![],'method':'POST','url':_0x7f19('0x56'),'headers':{'X-APIKEY':_0x49af2a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x19fc73[_0x7f19('0x3c')]['email']],'buttons':null,'topic':_0x3db497['vidaooTopic'],'note':_[_0x7f19('0x57')](_0x3db497['vidaooNote'])?null:getMustacheRender(_0x3db497[_0x7f19('0x50')],_0x4c95b6),'metadata':null},'redirect':_0x7f19('0x58'),'json':!![]};try{if(!_[_0x7f19('0x57')](_0x3db497[_0x7f19('0x51')])){var _0x1db39b=getMustacheRender(_0x3db497['vidaooMetadata'],_0x4c95b6);var _0x57dc71=JSON[_0x7f19('0x59')](_0x1db39b);_0x7f3503[_0x7f19('0x2f')][_0x7f19('0x5a')]=_0x57dc71;}}catch(_0x54f512){throw new db[(_0x7f19('0x5b'))][(_0x7f19('0x5c'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x7f3503);}else{throw new db['Sequelize'][(_0x7f19('0x5c'))](_0x7f19('0x5d'));}})['then'](function(_0x1567d6){_0x18a267=_0x1567d6;if(_0x18a267['id']){var _0x8a68ee={'body':_0x18a267[_0x7f19('0x5e')],'ChatWebsiteId':_0x3db497['id'],'ChatInteractionId':_0x586d90['id'],'direction':_0x7f19('0x5f'),'UserId':_0x19fc73[_0x7f19('0x3c')]['id']};return db['ChatMessage']['create'](_0x8a68ee,{});}else{throw new db[(_0x7f19('0x5b'))]['ValidationError'](_0x7f19('0x60'));}})[_0x7f19('0x16')](function(){return _0x586d90[_0x7f19('0x61')]({'vidaooSessionId':_0x18a267['id']});})['then'](respondWithResult(_0x353f87,null))[_0x7f19('0x1f')](handleError(_0x353f87,null));};exports[_0x7f19('0x62')]=function(_0x418b19,_0x56cb39){if(_0x418b19['body']['id']){delete _0x418b19['body']['id'];}return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x418b19['params']['id']},'include':[{'model':db[_0x7f19('0x63')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x56cb39,null))[_0x7f19('0x16')](saveUpdates(_0x418b19[_0x7f19('0x2f')],null))[_0x7f19('0x16')](respondWithResult(_0x56cb39,null))['catch'](handleError(_0x56cb39,null));};exports[_0x7f19('0x64')]=function(_0x372712,_0x4f7019){if(_0x372712[_0x7f19('0x2f')]['id']){delete _0x372712[_0x7f19('0x2f')]['id'];}return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x372712[_0x7f19('0x3d')]['id']}})[_0x7f19('0x16')](function(_0x4a0469){if(!_0x4a0469){logger['error'](_0x7f19('0x65'),_0x7f19('0x64'),0x194,_0x7f19('0x66'));_0x4f7019[_0x7f19('0x20')](0x194);}else{if(_0x4a0469[_0x7f19('0x67')]){throw new db[(_0x7f19('0x5b'))][(_0x7f19('0x5c'))](_0x7f19('0x68'));}}return _0x4a0469;})[_0x7f19('0x16')](function(_0x37be03){if(_0x37be03){return _0x37be03[_0x7f19('0x29')]({'closed':_0x372712[_0x7f19('0x2f')][_0x7f19('0x69')],'disposition':_0x372712['body'][_0x7f19('0x6a')]})['then'](function(_0x3a5fcb){return _0x3a5fcb;});}})[_0x7f19('0x16')](function(){return respondWithRpcPromise(_0x7f19('0x6b'),_0x7f19('0x64'),_0x372712[_0x7f19('0x2f')],client9004);})[_0x7f19('0x16')](respondWithResult(_0x4f7019,null))[_0x7f19('0x1f')](handleError(_0x4f7019,null));};exports['attachmentUpload']=function(_0x2b647f,_0x1de629){_0x2b647f[_0x7f19('0x2f')][_0x7f19('0x2c')]=_0x2b647f[_0x7f19('0x6c')][_0x7f19('0x6d')];_0x2b647f['body'][_0x7f19('0x6e')]=_0x2b647f[_0x7f19('0x6c')][_0x7f19('0x6f')];_0x2b647f[_0x7f19('0x2f')][_0x7f19('0x37')]=_0x2b647f[_0x7f19('0x6c')]['mimetype'];return db[_0x7f19('0x70')]['create'](_0x2b647f['body'])[_0x7f19('0x16')](respondWithResult(_0x1de629,0xc9))[_0x7f19('0x1f')](handleError(_0x1de629,null));};exports[_0x7f19('0x71')]=function(_0x473239,_0x2f7839){return db[_0x7f19('0x34')]['findOne']({'where':{'id':_0x473239['params']['id']},'raw':!![]})[_0x7f19('0x16')](handleEntityNotFound(_0x2f7839,null))[_0x7f19('0x16')](function(_0x53bb29){if(_0x53bb29){if(_0x53bb29[_0x7f19('0x69')]){return _0x2f7839['status'](0x193)[_0x7f19('0x23')]({'status':0x193,'message':_0x7f19('0x72')});}return db[_0x7f19('0x70')]['findOne']({'where':{'id':_0x473239['query']['attachId']},'raw':!![]})[_0x7f19('0x16')](handleEntityNotFound(_0x2f7839,null));}})[_0x7f19('0x16')](function(_0xaf6d3c){if(_0xaf6d3c){var _0x454c81=_0xaf6d3c['ChatOfflineMessageId']!==null;var _0x6246f7=path[_0x7f19('0x73')](config[_0x7f19('0x74')],_0x7f19('0x75'));if(_0x454c81){_0x6246f7=path[_0x7f19('0x73')](_0x6246f7,_0x7f19('0x76'));}var _0x40baff=path['join'](_0x6246f7,_0xaf6d3c[_0x7f19('0x6e')]);return _0x2f7839[_0x7f19('0x77')](_0x40baff);}})['catch'](handleError(_0x2f7839,null));};exports['close']=function(_0x26f56f,_0x48634b){var _0x2a01a2=null;var _0x1477c2=null;var _0x41040a=null;if(_0x26f56f['body']['id']){delete _0x26f56f[_0x7f19('0x2f')]['id'];}if(_0x26f56f['body'][_0x7f19('0x78')]){_0x41040a=path[_0x7f19('0x73')](config[_0x7f19('0x74')],_0x7f19('0x79'),util[_0x7f19('0x7a')](_0x7f19('0x7b'),Date[_0x7f19('0x7c')]()));_0x26f56f['body'][_0x7f19('0x7d')]=_0x41040a;}return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x26f56f[_0x7f19('0x3d')]['id']},'include':[{'model':db[_0x7f19('0x7e')],'as':'Messages','include':[{'model':db[_0x7f19('0x7f')],'as':_0x7f19('0x7f')}]}]})[_0x7f19('0x16')](handleEntityNotFound(_0x48634b,null))[_0x7f19('0x16')](saveUpdates(_0x26f56f[_0x7f19('0x2f')],null))[_0x7f19('0x16')](function(_0x3e501d){if(_0x3e501d){_0x2a01a2=_0x3e501d;return db['ChatWebsite']['find']({'where':{'id':_0x2a01a2[_0x7f19('0x80')]}});}})[_0x7f19('0x16')](function(_0x2f7dae){if(_0x2f7dae){_0x1477c2=_0x2f7dae;return db[_0x7f19('0x63')][_0x7f19('0x4a')]({'where':{'id':_0x2a01a2['ContactId']}});}})[_0x7f19('0x16')](function(_0xc9c7b4){if(_0xc9c7b4){if(_0x41040a){var _0x3c06b2=null;for(var _0x10332d=0x1;_0x10332d<_0x2a01a2[_0x7f19('0x81')][_0x7f19('0x45')];++_0x10332d){_0x3c06b2=_0x2a01a2['Messages'][_0x10332d];var _0x38d3a5=_0x3c06b2[_0x7f19('0x67')]?util['format']('%s%d',_0x1477c2[_0x7f19('0x82')],_0x3c06b2[_0x7f19('0x67')]):_0x7f19('0x83');var _0x1869ad=_0x26f56f[_0x7f19('0x2f')][_0x7f19('0x84')]||util[_0x7f19('0x7a')](_0x7f19('0x85'),_0x7f19('0x86'),_0x3c06b2['ContactId']);switch(_0x1477c2[_0x7f19('0x87')]){case'website_alias':_0x38d3a5=_0x3c06b2['UserId']?util[_0x7f19('0x7a')](_0x7f19('0x85'),_0x1477c2['agentAlias'],_0x3c06b2['UserId']):_0x7f19('0x83');break;case _0x7f19('0x88'):_0x38d3a5=_0x3c06b2[_0x7f19('0x67')]?_0x3c06b2['User'][_0x7f19('0x89')]||_0x3c06b2[_0x7f19('0x7f')]['fullname']:'System';break;case _0x7f19('0x8a'):_0x38d3a5=_0x3c06b2[_0x7f19('0x67')]?_0x3c06b2[_0x7f19('0x7f')][_0x7f19('0x54')]:'System';break;default:_0x38d3a5=_0x3c06b2[_0x7f19('0x67')]?util[_0x7f19('0x7a')](_0x7f19('0x85'),_0x1477c2[_0x7f19('0x82')],_0x3c06b2['UserId']):_0x7f19('0x83');}var _0x5d7c90=util[_0x7f19('0x7a')](_0x7f19('0x8b'),moment(_0x3c06b2[_0x7f19('0x8c')])[_0x7f19('0x7a')](_0x7f19('0x8d')),_0x3c06b2[_0x7f19('0x8e')]==='in'?_0x1869ad:_0x38d3a5,_0x3c06b2[_0x7f19('0x2f')]);if(!_0x3c06b2[_0x7f19('0x8f')]){fs[_0x7f19('0x90')](_0x41040a,_0x5d7c90);}}return db[_0x7f19('0x91')][_0x7f19('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x7f19('0x92')],'as':_0x7f19('0x93'),'raw':!![],'include':[{'model':db[_0x7f19('0x94')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x7f19('0x16')](function(_0x508b56){if(!_0x508b56||!_0x508b56[_0x7f19('0x93')]||!_0x26f56f[_0x7f19('0x2f')])return _0x2a01a2;var _0x480322=_0x508b56[_0x7f19('0x95')]();return respondWithRpcPromise(_0x7f19('0x96'),_0x7f19('0x97'),{'account':_0x480322,'message':{'from':util[_0x7f19('0x7a')](_0x7f19('0x98'),_0x508b56['name'],_0x508b56[_0x7f19('0x55')]||_0x508b56[_0x7f19('0x93')]['user']),'to':_0x26f56f[_0x7f19('0x2f')][_0x7f19('0x78')],'subject':'Mail\x20Transcript','text':util[_0x7f19('0x7a')](_0x7f19('0x99'),_0x26f56f['body'][_0x7f19('0x78')]),'attachments':[{'path':_0x41040a}]}})[_0x7f19('0x16')](function(){return _0x2a01a2;})['catch'](function(_0xedf4f8){logger[_0x7f19('0x1c')](_0xedf4f8);});})[_0x7f19('0x16')](respondWithStatusCode(_0x48634b,0xc8))['catch'](handleError(_0x48634b,null));};exports[_0x7f19('0x9a')]=function(_0x1bb445,_0xf8e2c0){return db[_0x7f19('0x7e')]['find']({'where':{'id':_0x1bb445['params']['id']}})[_0x7f19('0x16')](handleEntityNotFound(_0xf8e2c0,null))[_0x7f19('0x16')](function(_0x439d38){if(_0x439d38){return _0x439d38[_0x7f19('0x9a')](_0x1bb445[_0x7f19('0x2f')][_0x7f19('0x9b')],_[_0x7f19('0x9c')](_0x1bb445[_0x7f19('0x2f')],[_0x7f19('0x9b'),'id'])||{});}})[_0x7f19('0x16')](respondWithResult(_0xf8e2c0,null))[_0x7f19('0x1f')](handleError(_0xf8e2c0,null));};exports[_0x7f19('0x9d')]=function(_0x15acfb,_0x3fb2a9){var _0xc14335={'raw':![],'where':{}};var _0x10ef4f={};var _0x1a45c2={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x15acfb[_0x7f19('0x3d')]['id']}})[_0x7f19('0x16')](handleEntityNotFound(_0x3fb2a9,null))[_0x7f19('0x16')](function(_0x146716){if(_0x146716){_0x10ef4f[_0x7f19('0x3e')]=_[_0x7f19('0x3f')](db[_0x7f19('0x7e')][_0x7f19('0x35')]);_0x10ef4f[_0x7f19('0x40')]=_[_0x7f19('0x3f')](_0x15acfb['query']);_0x10ef4f[_0x7f19('0x41')]=_[_0x7f19('0x42')](_0x10ef4f['model'],_0x10ef4f['query']);_0xc14335[_0x7f19('0x43')]=_['intersection'](_0x10ef4f[_0x7f19('0x3e')],qs[_0x7f19('0x44')](_0x15acfb[_0x7f19('0x40')][_0x7f19('0x44')]));_0xc14335['attributes']=_0xc14335['attributes'][_0x7f19('0x45')]?_0xc14335[_0x7f19('0x43')]:_0x10ef4f[_0x7f19('0x3e')];if(!_0x15acfb[_0x7f19('0x40')][_0x7f19('0x9e')]('nolimit')){_0xc14335[_0x7f19('0x26')]=qs['limit'](_0x15acfb[_0x7f19('0x40')][_0x7f19('0x26')]);_0xc14335['offset']=qs[_0x7f19('0x24')](_0x15acfb[_0x7f19('0x40')][_0x7f19('0x24')]);}_0xc14335['order']=qs[_0x7f19('0x9f')](_0x15acfb[_0x7f19('0x40')][_0x7f19('0x9f')]);_0xc14335[_0x7f19('0xa0')]=qs['filters'](_['pick'](_0x15acfb[_0x7f19('0x40')],_0x10ef4f[_0x7f19('0x41')]));_0xc14335['where'][_0x7f19('0xa1')]=_0x146716['id'];if(_0x15acfb[_0x7f19('0x40')][_0x7f19('0xa2')]){_0xc14335[_0x7f19('0xa0')]=_[_0x7f19('0x2e')](_0xc14335[_0x7f19('0xa0')],{'$or':_[_0x7f19('0x33')](_0xc14335[_0x7f19('0x43')],function(_0x5cec4a){var _0x3d9df7={};_0x3d9df7[_0x5cec4a]={'$like':'%'+_0x15acfb[_0x7f19('0x40')][_0x7f19('0xa2')]+'%'};return _0x3d9df7;})});}if(_0x15acfb['query'][_0x7f19('0xa3')]){var _0x4cb414=_0x15acfb['query'][_0x7f19('0xa3')][_0x7f19('0xa4')](',');var _0x2c6543={};_0x2c6543[_0x4cb414[0x0]]={'$gte':moment(_0x4cb414[0x1])['format'](_0x7f19('0xa5'))};_0xc14335['where']=_[_0x7f19('0x2e')](_0xc14335[_0x7f19('0xa0')],_0x2c6543);}_0xc14335=_[_0x7f19('0x2e')]({},_0xc14335,_0x15acfb[_0x7f19('0x48')]);return db[_0x7f19('0x7e')][_0x7f19('0xa6')]({'where':_0xc14335[_0x7f19('0xa0')]})['then'](function(_0x591ac9){_0x1a45c2[_0x7f19('0xa6')]=_0x591ac9;if(_0x15acfb['query'][_0x7f19('0x46')]){_0xc14335[_0x7f19('0x47')]=[{'all':!![]}];}return db[_0x7f19('0x7e')][_0x7f19('0x3a')](_0xc14335);})[_0x7f19('0x16')](function(_0x20dd14){_0x1a45c2[_0x7f19('0xa7')]=_0x20dd14;return _0x1a45c2;});}})[_0x7f19('0x16')](respondWithFilteredResult(_0x3fb2a9,_0xc14335))[_0x7f19('0x1f')](handleError(_0x3fb2a9,null));};exports[_0x7f19('0xa8')]=function(_0x2d2a34,_0x579fbf){var _0x6f1951={'where':{}},_0x351046={},_0x4d521c={'count':0x0,'rows':[]};return db[_0x7f19('0x34')][_0x7f19('0x4d')]({'where':{'id':_0x2d2a34[_0x7f19('0x3d')]['id']}})['then'](handleEntityNotFound(_0x579fbf,null))['then'](function(_0x5c5ffd){if(_0x5c5ffd){_0x351046[_0x7f19('0x3e')]=_[_0x7f19('0x3f')](db[_0x7f19('0x7e')][_0x7f19('0x35')]);_0x351046[_0x7f19('0x40')]=_[_0x7f19('0x3f')](_0x2d2a34[_0x7f19('0x40')]);_0x351046[_0x7f19('0x41')]=_[_0x7f19('0x42')](_0x351046[_0x7f19('0x3e')],_0x351046['query']);_0x6f1951[_0x7f19('0x43')]=_[_0x7f19('0x42')](_0x351046[_0x7f19('0x3e')],qs[_0x7f19('0x44')](_0x2d2a34[_0x7f19('0x40')]['fields']));_0x6f1951[_0x7f19('0x43')]=_0x6f1951[_0x7f19('0x43')][_0x7f19('0x45')]?_0x6f1951[_0x7f19('0x43')]:_0x351046[_0x7f19('0x3e')];if(!_0x2d2a34[_0x7f19('0x40')][_0x7f19('0x9e')](_0x7f19('0xa9'))){_0x6f1951[_0x7f19('0x26')]=qs['limit'](_0x2d2a34[_0x7f19('0x40')][_0x7f19('0x26')]);_0x6f1951[_0x7f19('0x24')]=qs[_0x7f19('0x24')](_0x2d2a34[_0x7f19('0x40')]['offset']);}_0x6f1951['order']=qs[_0x7f19('0x9f')](_0x2d2a34[_0x7f19('0x40')][_0x7f19('0x9f')]);_0x6f1951[_0x7f19('0xa0')]=qs['filters'](_[_0x7f19('0xaa')](_0x2d2a34[_0x7f19('0x40')],_0x351046[_0x7f19('0x41')]));_0x6f1951[_0x7f19('0xa0')]['ChatInteractionId']=_0x5c5ffd['id'];if(_0x2d2a34['query']['filter']){_0x6f1951['where']=_[_0x7f19('0x2e')](_0x6f1951['where'],{'$or':_[_0x7f19('0x33')](_0x6f1951[_0x7f19('0x43')],function(_0xa43a10){var _0x1689e1={};_0x1689e1[_0xa43a10]={'$like':'%'+_0x2d2a34[_0x7f19('0x40')][_0x7f19('0xa2')]+'%'};return _0x1689e1;})});}_0x6f1951[_0x7f19('0xa0')][_0x7f19('0x8f')]=![];if(_0x2d2a34[_0x7f19('0x40')]['id']){_0x6f1951[_0x7f19('0xa0')]['id']={'$gt':_0x2d2a34[_0x7f19('0x40')]['id']};}_0x6f1951=_[_0x7f19('0x2e')]({},_0x6f1951,_0x2d2a34[_0x7f19('0x48')]);return db['ChatMessage']['count']({'where':_0x6f1951[_0x7f19('0xa0')]})[_0x7f19('0x16')](function(_0x4fe011){_0x4d521c[_0x7f19('0xa6')]=_0x4fe011;_0x6f1951[_0x7f19('0x47')]=[];if(_0x2d2a34[_0x7f19('0x40')]['includeAgent']){_0x6f1951[_0x7f19('0x47')][_0x7f19('0xab')]({'model':db['User'],'as':_0x7f19('0x7f'),'attributes':['id',_0x7f19('0x54'),_0x7f19('0x89')]});}if(_0x2d2a34['query'][_0x7f19('0x46')]){_0x6f1951['include']=[{'all':!![]}];}return db[_0x7f19('0x7e')][_0x7f19('0x3a')](_0x6f1951);})['then'](function(_0x14aec4){_0x4d521c['rows']=_0x14aec4;return _0x4d521c;});}})['then'](respondWithFilteredResult(_0x579fbf,_0x6f1951))[_0x7f19('0x1f')](handleError(_0x579fbf,null));};exports[_0x7f19('0xac')]=function(_0x3759a0,_0x2bf228){return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x3759a0['params']['id']}})['then'](handleEntityNotFound(_0x2bf228,null))[_0x7f19('0x16')](function(_0x3555f7){if(_0x3555f7){return _0x3555f7[_0x7f19('0xad')](_0x3759a0['body']['ids'],_[_0x7f19('0x9c')](_0x3759a0[_0x7f19('0x2f')],[_0x7f19('0x9b'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x7f19('0x2c'),_0x7f19('0xae')],'where':{'id':_0x3759a0[_0x7f19('0x2f')]['ids']}});})[_0x7f19('0x16')](function(_0x5563dd){socket['emit'](_0x7f19('0xaf'),{'id':Number(_0x3759a0[_0x7f19('0x3d')]['id']),'tags':_0x5563dd||[]});return{'id':Number(_0x3759a0[_0x7f19('0x3d')]['id']),'tags':_0x5563dd||[]};});}})[_0x7f19('0x16')](respondWithResult(_0x2bf228,null))[_0x7f19('0x1f')](handleError(_0x2bf228,null));};exports['removeTags']=function(_0x1160c8,_0x5d6f30){return db[_0x7f19('0x34')]['find']({'where':{'id':_0x1160c8[_0x7f19('0x3d')]['id']}})[_0x7f19('0x16')](handleEntityNotFound(_0x5d6f30,null))[_0x7f19('0x16')](function(_0x3dad1b){if(_0x3dad1b){return _0x3dad1b[_0x7f19('0xb0')](_0x1160c8[_0x7f19('0x40')]['ids']);}})[_0x7f19('0x16')](respondWithStatusCode(_0x5d6f30,null))[_0x7f19('0x1f')](handleError(_0x5d6f30,null));};exports[_0x7f19('0x77')]=function(_0x2138f3,_0x227c55){var _0x5215f0=moment()['unix']()[_0x7f19('0xb1')]();var _0x183048=path[_0x7f19('0x73')](config[_0x7f19('0x74')],_0x7f19('0xb2'),'files',_0x7f19('0xb3'));var _0x5eb49f=path[_0x7f19('0x73')](config[_0x7f19('0x74')],_0x7f19('0xb2'),_0x7f19('0xb4'),_0x7f19('0xb5'));var _0x2fe78a=path[_0x7f19('0x73')](_0x183048,_0x5215f0);var _0x262769=util[_0x7f19('0x7a')](_0x7f19('0xb6'),_0x2138f3[_0x7f19('0x3d')]['id'],_0x5215f0);var _0x2de9a3=path[_0x7f19('0x73')](_0x183048,_0x262769);var _0x5d605a=[];_0x5d605a[_0x7f19('0xab')]({'model':db[_0x7f19('0x7f')],'as':_0x7f19('0x7f'),'attributes':['id',_0x7f19('0x54')],'raw':!![]});_0x5d605a[_0x7f19('0xab')]({'model':db['CmContact'],'as':_0x7f19('0xb7'),'attributes':['id',_0x7f19('0xb8'),_0x7f19('0xb9')],'raw':!![]});if(_0x2138f3['query']['attachments']){_0x5d605a[_0x7f19('0xab')]({'model':db[_0x7f19('0x70')],'as':_0x7f19('0x70'),'raw':!![]});}var _0x194a87=[{'model':db['ChatMessage'],'as':_0x7f19('0x81'),'attributes':['id',_0x7f19('0x2f'),_0x7f19('0x8c'),_0x7f19('0x8e'),'secret',_0x7f19('0xba')],'include':_0x5d605a}];_0x194a87['push']({'model':db['ChatWebsite'],'as':_0x7f19('0xbb'),'attributes':['id',_0x7f19('0x2c')]});_0x194a87[_0x7f19('0xab')]({'model':db[_0x7f19('0x7f')],'as':_0x7f19('0xbc'),'attributes':['id','fullname']});return db[_0x7f19('0x34')][_0x7f19('0x4a')]({'where':{'id':_0x2138f3[_0x7f19('0x3d')]['id']},'include':_0x194a87})[_0x7f19('0x16')](handleEntityNotFound(_0x227c55,null))[_0x7f19('0x16')](function(_0x108ca3){if(_0x108ca3){var _0x5406a3=_0x108ca3[_0x7f19('0xbd')]({'plain':!![]});fs[_0x7f19('0xbe')](_0x2fe78a);var _0x57d891={'channel':_0x7f19('0xbf'),'account':_0x5406a3['Account'][_0x7f19('0x2c')],'agent':_0x5406a3[_0x7f19('0xbc')]?_0x5406a3[_0x7f19('0xbc')][_0x7f19('0x54')]:'N.A.','createdAt':moment(_0x5406a3[_0x7f19('0x8c')])[_0x7f19('0x7a')](_0x7f19('0xa5'))[_0x7f19('0xb1')](),'closedAt':_0x5406a3['closed']?moment(_0x5406a3['closedAt'])[_0x7f19('0x7a')](_0x7f19('0xa5'))[_0x7f19('0xb1')]():'','disposition':_0x5406a3[_0x7f19('0x6a')],'chatInfo':{'browser':_0x5406a3[_0x7f19('0xc0')],'os':_0x5406a3[_0x7f19('0xc1')],'referer':_0x5406a3[_0x7f19('0xc2')],'customerIp':_0x5406a3[_0x7f19('0xc3')],'customerPort':_0x5406a3[_0x7f19('0xc4')]?_0x5406a3[_0x7f19('0xc4')]:_0x7f19('0xc5')},'messages':_(_0x5406a3[_0x7f19('0x81')])[_0x7f19('0xc6')]()['filter']({'secret':![]})[_0x7f19('0x33')](function(_0x14162f){if(_0x14162f[_0x7f19('0x70')]){var _0x32b3ba=path[_0x7f19('0x73')](_0x5eb49f,_0x14162f['Attachment']['basename']);if(fs['existsSync'](_0x32b3ba)){fs['createReadStream'](_0x32b3ba)[_0x7f19('0xc7')](fs[_0x7f19('0xc8')](path[_0x7f19('0x73')](_0x2fe78a,_0x14162f[_0x7f19('0x70')][_0x7f19('0x6e')])));}}return{'date':moment(_0x14162f['createdAt'])[_0x7f19('0x7a')](_0x7f19('0xa5'))[_0x7f19('0xb1')](),'sender':_0x14162f[_0x7f19('0x8e')]===_0x7f19('0x5f')?_0x14162f[_0x7f19('0x7f')]?_0x14162f['User'][_0x7f19('0x54')]:_0x7f19('0x83'):_0x14162f[_0x7f19('0xb7')]['firstName']+(_0x14162f[_0x7f19('0xb7')][_0x7f19('0xb9')]?'\x20'+_0x14162f['Contact']['lastName']:''),'body':_0x14162f[_0x7f19('0x70')]?_0x14162f['Attachment'][_0x7f19('0x6e')]:_0x14162f[_0x7f19('0x2f')],'direction':_0x14162f['direction']===_0x7f19('0x5f')?'A':'C','secret':_0x14162f[_0x7f19('0x8f')],'read':_0x14162f[_0x7f19('0xba')],'attachment':_0x14162f[_0x7f19('0x70')]};})['value']()};return ejs[_0x7f19('0xc9')](path[_0x7f19('0x73')](config[_0x7f19('0x74')],_0x7f19('0xb2'),'views','downloadInteraction.ejs'),{'interaction':_0x57d891})[_0x7f19('0x16')](function(_0x1ede73){var _0x4ce6dc=path['join'](_0x2fe78a,_0x7f19('0xca')+_0x5406a3['id']+'-'+_0x5215f0+_0x7f19('0xcb'));var _0x50ea05={'path':_0x4ce6dc,'channel':_0x7f19('0xbf'),'interactionId':_0x5406a3['id']};return pdf[_0x7f19('0xcc')](_0x1ede73,_0x50ea05);})[_0x7f19('0x16')](function(){return new Promise(function(_0x580f5f,_0x56cbaa){zipdir(_0x2fe78a,{'saveTo':_0x2de9a3},function(_0x171cf0,_0x4d7dd3){if(_0x171cf0)return _0x56cbaa(_0x171cf0);return _0x580f5f(_0x4d7dd3);});})[_0x7f19('0x16')](function(){return new BPromise(function(_0x3a784c,_0x7718fb){rimraf(_0x2fe78a,function(_0x570560){if(_0x570560)_0x7718fb(_0x570560);return _0x3a784c();});});})[_0x7f19('0x16')](function(){return _0x227c55['download'](_0x2de9a3,_0x262769,function(_0x5d8465){if(_0x5d8465){logger['error']('err',_0x5d8465);}else{fs['unlinkSync'](_0x2de9a3);}});});});}else{return _0x227c55['sendStatus'](0xc8);}})[_0x7f19('0x1f')](handleError(_0x227c55,null));};
\ No newline at end of file
+var _0xcbe6=['end','status','json','undefined','limit','count','offset','set','update','destroy','name','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','key','getOptions','findAll','query','user','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','find','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','file','originalname','filename','type','Attachment','attachmentDownload','Unauthorized','attachId','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','User','ChatWebsite','ChatWebsiteId','ContactId','%s%d','agentAlias','customer','website_alias','System','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','pick','where','filter','$gte','options','getMyMessages','order','includeAgent','push','alias','rows','addTags','setTags','spread','Tag','emit','removeTags','unix','toString','files','tmp','server','attachments','transcript-%d-%s.zip','lastName','read','Owner','mkdirSync','Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','firstName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus'];(function(_0x1f2d1b,_0x29f3be){var _0x1c6216=function(_0x560538){while(--_0x560538){_0x1f2d1b['push'](_0x1f2d1b['shift']());}};_0x1c6216(++_0x29f3be);}(_0xcbe6,0x183));var _0x6cbe=function(_0x26fea4,_0x16ccdf){_0x26fea4=_0x26fea4-0x0;var _0x53451e=_0xcbe6[_0x26fea4];return _0x53451e;};'use strict';var rimraf=require(_0x6cbe('0x0'));var zipdir=require('zip-dir');var rp=require(_0x6cbe('0x1'));var moment=require(_0x6cbe('0x2'));var BPromise=require(_0x6cbe('0x3'));var Mustache=require(_0x6cbe('0x4'));var util=require(_0x6cbe('0x5'));var path=require('path');var ejs=require(_0x6cbe('0x6'));var fs=require('fs');var _=require(_0x6cbe('0x7'));var Redis=require(_0x6cbe('0x8'));var interaction=require(_0x6cbe('0x9'));var qs=require(_0x6cbe('0xa'));var pdf=require(_0x6cbe('0xb'));var logger=require(_0x6cbe('0xc'))('api');var config=require(_0x6cbe('0xd'));var db=require('../../mysqldb')['db'];config[_0x6cbe('0xe')]=_['defaults'](config['redis'],{'host':_0x6cbe('0xf'),'port':0x18eb});var socket=require(_0x6cbe('0x10'))(new Redis(config[_0x6cbe('0xe')]));require(_0x6cbe('0x11'))[_0x6cbe('0x12')](socket);var jayson=require(_0x6cbe('0x13'));var client=jayson['client'][_0x6cbe('0x14')]({'port':0x232b});var client9004=jayson[_0x6cbe('0x15')][_0x6cbe('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x4be328,_0x116b70,_0x4f01c8,_0x3e80d6){return new BPromise(function(_0x160cf9,_0xb6676f){var _0x2c38c2=_0x3e80d6||client;return _0x2c38c2['request'](_0x4be328,_0x4f01c8)[_0x6cbe('0x16')](function(_0xe755d6){logger['info'](_0x6cbe('0x17'),_0x116b70,_0x6cbe('0x18'));logger[_0x6cbe('0x19')](_0x6cbe('0x1a'),_0x116b70,_0x6cbe('0x18'),JSON[_0x6cbe('0x1b')](_0xe755d6));if(_0xe755d6[_0x6cbe('0x1c')]){if(_0xe755d6[_0x6cbe('0x1c')][_0x6cbe('0x1d')]===0x1f4){logger[_0x6cbe('0x1c')](_0x6cbe('0x17'),_0x116b70,_0xe755d6[_0x6cbe('0x1c')][_0x6cbe('0x1e')]);return _0xb6676f(_0xe755d6[_0x6cbe('0x1c')][_0x6cbe('0x1e')]);}logger[_0x6cbe('0x1c')](_0x6cbe('0x17'),_0x116b70,_0xe755d6[_0x6cbe('0x1c')][_0x6cbe('0x1e')]);return _0x160cf9(_0xe755d6[_0x6cbe('0x1c')][_0x6cbe('0x1e')]);}else{logger[_0x6cbe('0x1f')](_0x6cbe('0x17'),_0x116b70,'request\x20sent');_0x160cf9(_0xe755d6[_0x6cbe('0x20')][_0x6cbe('0x1e')]);}})[_0x6cbe('0x21')](function(_0x860bfb){logger['error'](_0x6cbe('0x17'),_0x116b70,_0x860bfb);_0xb6676f(_0x860bfb);});});}function respondWithStatusCode(_0x50690e,_0x51dc6c){_0x51dc6c=_0x51dc6c||0xcc;return function(_0x55b150){if(_0x55b150){return _0x50690e[_0x6cbe('0x22')](_0x51dc6c);}return _0x50690e['status'](_0x51dc6c)[_0x6cbe('0x23')]();};}function respondWithResult(_0x1e2587,_0x52f84c){_0x52f84c=_0x52f84c||0xc8;return function(_0x437e28){if(_0x437e28){return _0x1e2587[_0x6cbe('0x24')](_0x52f84c)[_0x6cbe('0x25')](_0x437e28);}};}function respondWithFilteredResult(_0x16521e,_0x5eab5f){return function(_0x3e5fbe){if(_0x3e5fbe){var _0x28bbda=typeof _0x5eab5f['offset']===_0x6cbe('0x26')&&typeof _0x5eab5f[_0x6cbe('0x27')]===_0x6cbe('0x26');var _0x36ad6a=_0x3e5fbe[_0x6cbe('0x28')];var _0x513f5f=_0x28bbda?0x0:_0x5eab5f[_0x6cbe('0x29')];var _0x5e3f52=_0x28bbda?_0x3e5fbe['count']:_0x5eab5f['offset']+_0x5eab5f['limit'];var _0x2e4fc5;if(_0x5e3f52>=_0x36ad6a){_0x5e3f52=_0x36ad6a;_0x2e4fc5=0xc8;}else{_0x2e4fc5=0xce;}_0x16521e[_0x6cbe('0x24')](_0x2e4fc5);return _0x16521e[_0x6cbe('0x2a')]('Content-Range',_0x513f5f+'-'+_0x5e3f52+'/'+_0x36ad6a)['json'](_0x3e5fbe);}return null;};}function saveUpdates(_0xda4485){return function(_0x1f5bb2){if(_0x1f5bb2){return _0x1f5bb2[_0x6cbe('0x2b')](_0xda4485)['then'](function(_0x5e9c2f){return _0x5e9c2f;});}return null;};}function removeEntity(_0x2585ac){return function(_0x6b3cd2){if(_0x6b3cd2){return _0x6b3cd2[_0x6cbe('0x2c')]()[_0x6cbe('0x16')](function(){_0x2585ac[_0x6cbe('0x24')](0xcc)[_0x6cbe('0x23')]();});}};}function handleEntityNotFound(_0x3496c7){return function(_0x2c6215){if(!_0x2c6215){_0x3496c7[_0x6cbe('0x22')](0x194);}return _0x2c6215;};}function handleError(_0x34f7e5,_0x191a3b){_0x191a3b=_0x191a3b||0x1f4;return function(_0x5be9d5){logger['error'](_0x5be9d5['stack']);if(_0x5be9d5[_0x6cbe('0x2d')]){delete _0x5be9d5['name'];}_0x34f7e5[_0x6cbe('0x24')](_0x191a3b)[_0x6cbe('0x2e')](_0x5be9d5);};}function getMustacheRender(_0x4e1b4b,_0x125ffa){return Mustache[_0x6cbe('0x2f')](_0x4e1b4b,_[_0x6cbe('0x30')](_0x125ffa[_0x6cbe('0x31')],{'contact':_0x125ffa['contact'],'message':_0x125ffa['message'],'agent':_0x125ffa[_0x6cbe('0x32')],'interaction':_0x125ffa[_0x6cbe('0x33')],'account':_0x125ffa[_0x6cbe('0x34')]}))||'';}exports[_0x6cbe('0x35')]=function(_0x140c35,_0x5bca91){var _0x19a388={};var _0x12a5b1=_[_0x6cbe('0x36')](db[_0x6cbe('0x37')][_0x6cbe('0x38')],function(_0x3aa377){return{'name':_0x3aa377['fieldName'],'type':_0x3aa377['type'][_0x6cbe('0x39')]};});_0x19a388=qs[_0x6cbe('0x3a')](_0x12a5b1,_0x140c35);return interaction[_0x6cbe('0x3b')]('chat',_0x140c35[_0x6cbe('0x3c')],_0x140c35[_0x6cbe('0x3d')],_0x19a388,_0x12a5b1)[_0x6cbe('0x16')](respondWithFilteredResult(_0x5bca91,_0x19a388))[_0x6cbe('0x21')](handleError(_0x5bca91,null));};exports[_0x6cbe('0x3e')]=function(_0x822a4b,_0x5e8337){var _0x23ab9f={'raw':![],'where':{'id':_0x822a4b[_0x6cbe('0x3f')]['id']}},_0x1119dd={};_0x1119dd['model']=_[_0x6cbe('0x40')](db[_0x6cbe('0x37')]['rawAttributes']);_0x1119dd[_0x6cbe('0x3c')]=_[_0x6cbe('0x40')](_0x822a4b[_0x6cbe('0x3c')]);_0x1119dd[_0x6cbe('0x41')]=_[_0x6cbe('0x42')](_0x1119dd[_0x6cbe('0x43')],_0x1119dd[_0x6cbe('0x3c')]);_0x23ab9f[_0x6cbe('0x44')]=_['intersection'](_0x1119dd[_0x6cbe('0x43')],qs['fields'](_0x822a4b['query'][_0x6cbe('0x45')]));_0x23ab9f[_0x6cbe('0x44')]=_0x23ab9f[_0x6cbe('0x44')][_0x6cbe('0x46')]?_0x23ab9f[_0x6cbe('0x44')]:_0x1119dd['model'];if(_0x822a4b[_0x6cbe('0x3c')][_0x6cbe('0x47')]){_0x23ab9f[_0x6cbe('0x48')]=[{'all':!![]}];}_0x23ab9f=_[_0x6cbe('0x30')]({},_0x23ab9f,_0x822a4b['options']);return db[_0x6cbe('0x37')][_0x6cbe('0x49')](_0x23ab9f)[_0x6cbe('0x16')](handleEntityNotFound(_0x5e8337,null))[_0x6cbe('0x16')](respondWithResult(_0x5e8337,null))[_0x6cbe('0x21')](handleError(_0x5e8337,null));};exports[_0x6cbe('0x4a')]=function(_0x20c1f9,_0xd08688){return db[_0x6cbe('0x37')][_0x6cbe('0x4a')](_0x20c1f9['body'],{})[_0x6cbe('0x16')](respondWithResult(_0xd08688,0xc9))['catch'](handleError(_0xd08688,null));};exports[_0x6cbe('0x2b')]=function(_0x290191,_0x3143cf){if(_0x290191[_0x6cbe('0x31')]['id']){delete _0x290191[_0x6cbe('0x31')]['id'];}return db[_0x6cbe('0x37')][_0x6cbe('0x49')]({'where':{'id':_0x290191[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](handleEntityNotFound(_0x3143cf,null))['then'](saveUpdates(_0x290191[_0x6cbe('0x31')],null))['then'](respondWithResult(_0x3143cf,null))['catch'](handleError(_0x3143cf,null));};exports['destroy']=function(_0x55088a,_0x30bc53){return db[_0x6cbe('0x37')]['find']({'where':{'id':_0x55088a[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](handleEntityNotFound(_0x30bc53,null))['then'](removeEntity(_0x30bc53,null))[_0x6cbe('0x21')](handleError(_0x30bc53,null));};exports[_0x6cbe('0x4b')]=function(_0x4f399a,_0x363d17){return db[_0x6cbe('0x37')]['describe']()[_0x6cbe('0x16')](respondWithResult(_0x363d17,null))[_0x6cbe('0x21')](handleError(_0x363d17,null));};exports[_0x6cbe('0x4c')]=function(_0x1c1a2d,_0x2c2843){var _0x3ce4df=_0x1c1a2d[_0x6cbe('0x3f')]['id'];var _0x5b0f4e;var _0x18b793;var _0x1d87d7;return db[_0x6cbe('0x37')][_0x6cbe('0x4d')]({'where':{'id':_0x3ce4df}})['then'](function(_0x15aa50){_0x5b0f4e=_0x15aa50;return db['ChatWebsite'][_0x6cbe('0x4d')]({'where':{'id':_0x15aa50['ChatWebsiteId']},'attributes':['id',_0x6cbe('0x4e'),_0x6cbe('0x4f'),_0x6cbe('0x50'),'vidaooNote',_0x6cbe('0x51')],'raw':!![]});})[_0x6cbe('0x16')](function(_0x500256){if(_0x500256&&_0x500256['vidaooApiKey']&&_0x500256[_0x6cbe('0x4f')]){_0x18b793=_0x500256;var _0x187b44={'interaction':{'id':_0x3ce4df},'agent':{'id':_0x1c1a2d[_0x6cbe('0x3d')]['id'],'name':_0x1c1a2d[_0x6cbe('0x3d')][_0x6cbe('0x2d')],'fullname':_0x1c1a2d[_0x6cbe('0x3d')]['fullname'],'email':_0x1c1a2d['user'][_0x6cbe('0x52')]},'contact':_0x1c1a2d[_0x6cbe('0x31')][_0x6cbe('0x53')],'account':_0x1c1a2d[_0x6cbe('0x31')][_0x6cbe('0x34')]};var _0x51cc42={'rejectUnauthorized':![],'method':'POST','url':_0x6cbe('0x54'),'headers':{'X-APIKEY':_0x500256['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1c1a2d[_0x6cbe('0x3d')]['email']],'buttons':null,'topic':_0x18b793[_0x6cbe('0x50')],'note':_[_0x6cbe('0x55')](_0x18b793[_0x6cbe('0x56')])?null:getMustacheRender(_0x18b793['vidaooNote'],_0x187b44),'metadata':null},'redirect':_0x6cbe('0x57'),'json':!![]};try{if(!_['isNull'](_0x18b793[_0x6cbe('0x51')])){var _0x2e5c21=getMustacheRender(_0x18b793['vidaooMetadata'],_0x187b44);var _0x34fda5=JSON[_0x6cbe('0x58')](_0x2e5c21);_0x51cc42[_0x6cbe('0x31')][_0x6cbe('0x59')]=_0x34fda5;}}catch(_0x22ac37){throw new db[(_0x6cbe('0x5a'))][(_0x6cbe('0x5b'))](_0x6cbe('0x5c'));}return rp(_0x51cc42);}else{throw new db[(_0x6cbe('0x5a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0xa9c3ca){_0x1d87d7=_0xa9c3ca;if(_0x1d87d7['id']){var _0x9f1140={'body':_0x1d87d7[_0x6cbe('0x5d')],'ChatWebsiteId':_0x18b793['id'],'ChatInteractionId':_0x5b0f4e['id'],'direction':_0x6cbe('0x5e'),'UserId':_0x1c1a2d[_0x6cbe('0x3d')]['id']};return db['ChatMessage']['create'](_0x9f1140,{});}else{throw new db[(_0x6cbe('0x5a'))]['ValidationError'](_0x6cbe('0x5f'));}})[_0x6cbe('0x16')](function(){return _0x5b0f4e[_0x6cbe('0x60')]({'vidaooSessionId':_0x1d87d7['id']});})[_0x6cbe('0x16')](respondWithResult(_0x2c2843,null))[_0x6cbe('0x21')](handleError(_0x2c2843,null));};exports[_0x6cbe('0x61')]=function(_0x175795,_0x5b775a){if(_0x175795[_0x6cbe('0x31')]['id']){delete _0x175795[_0x6cbe('0x31')]['id'];}return db['ChatInteraction'][_0x6cbe('0x49')]({'where':{'id':_0x175795[_0x6cbe('0x3f')]['id']},'include':[{'model':db[_0x6cbe('0x62')],'as':_0x6cbe('0x63')}]})[_0x6cbe('0x16')](handleEntityNotFound(_0x5b775a,null))['then'](saveUpdates(_0x175795[_0x6cbe('0x31')],null))[_0x6cbe('0x16')](respondWithResult(_0x5b775a,null))['catch'](handleError(_0x5b775a,null));};exports['abandon']=function(_0x54da26,_0x2d0ee1){if(_0x54da26[_0x6cbe('0x31')]['id']){delete _0x54da26[_0x6cbe('0x31')]['id'];}return db['ChatInteraction'][_0x6cbe('0x49')]({'where':{'id':_0x54da26[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](function(_0x6113e2){if(!_0x6113e2){logger[_0x6cbe('0x1c')](_0x6cbe('0x64'),'abandon',0x194,_0x6cbe('0x65'));_0x2d0ee1[_0x6cbe('0x22')](0x194);}else{if(_0x6113e2[_0x6cbe('0x66')]){throw new db[(_0x6cbe('0x5a'))]['ValidationError'](_0x6cbe('0x67'));}}return _0x6113e2;})['then'](function(_0x177700){if(_0x177700){return _0x177700[_0x6cbe('0x2b')]({'closed':_0x54da26['body'][_0x6cbe('0x68')],'disposition':_0x54da26['body'][_0x6cbe('0x69')]})[_0x6cbe('0x16')](function(_0x4e171c){return _0x4e171c;});}})['then'](function(){return respondWithRpcPromise(_0x6cbe('0x6a'),_0x6cbe('0x6b'),_0x54da26[_0x6cbe('0x31')],client9004);})[_0x6cbe('0x16')](respondWithResult(_0x2d0ee1,null))[_0x6cbe('0x21')](handleError(_0x2d0ee1,null));};exports['attachmentUpload']=function(_0x58c377,_0x17019b){_0x58c377[_0x6cbe('0x31')]['name']=_0x58c377[_0x6cbe('0x6c')][_0x6cbe('0x6d')];_0x58c377['body']['basename']=_0x58c377[_0x6cbe('0x6c')][_0x6cbe('0x6e')];_0x58c377['body'][_0x6cbe('0x6f')]=_0x58c377[_0x6cbe('0x6c')]['mimetype'];return db[_0x6cbe('0x70')][_0x6cbe('0x4a')](_0x58c377[_0x6cbe('0x31')])[_0x6cbe('0x16')](respondWithResult(_0x17019b,0xc9))[_0x6cbe('0x21')](handleError(_0x17019b,null));};exports[_0x6cbe('0x71')]=function(_0x23dbfc,_0x3f57f3){return db[_0x6cbe('0x37')]['findOne']({'where':{'id':_0x23dbfc[_0x6cbe('0x3f')]['id']},'raw':!![]})[_0x6cbe('0x16')](handleEntityNotFound(_0x3f57f3,null))[_0x6cbe('0x16')](function(_0x8a32a1){if(_0x8a32a1){if(_0x8a32a1[_0x6cbe('0x68')]){return _0x3f57f3[_0x6cbe('0x24')](0x193)[_0x6cbe('0x25')]({'status':0x193,'message':_0x6cbe('0x72')});}return db[_0x6cbe('0x70')]['findOne']({'where':{'id':_0x23dbfc[_0x6cbe('0x3c')][_0x6cbe('0x73')]},'raw':!![]})[_0x6cbe('0x16')](handleEntityNotFound(_0x3f57f3,null));}})[_0x6cbe('0x16')](function(_0x177f29){if(_0x177f29){var _0x1b9cfa=_0x177f29['ChatOfflineMessageId']!==null;var _0x38174d=path['join'](config['root'],_0x6cbe('0x74'));if(_0x1b9cfa){_0x38174d=path[_0x6cbe('0x75')](_0x38174d,_0x6cbe('0x76'));}var _0x33885c=path[_0x6cbe('0x75')](_0x38174d,_0x177f29[_0x6cbe('0x77')]);return _0x3f57f3[_0x6cbe('0x78')](_0x33885c);}})[_0x6cbe('0x21')](handleError(_0x3f57f3,null));};exports['close']=function(_0x3e0c6f,_0x3487fe){var _0x553760=null;var _0x18e633=null;var _0x17d191=null;if(_0x3e0c6f['body']['id']){delete _0x3e0c6f['body']['id'];}if(_0x3e0c6f[_0x6cbe('0x31')][_0x6cbe('0x79')]){_0x17d191=path['join'](config[_0x6cbe('0x7a')],_0x6cbe('0x7b'),util[_0x6cbe('0x7c')](_0x6cbe('0x7d'),Date[_0x6cbe('0x7e')]()));_0x3e0c6f['body']['pathTranscript']=_0x17d191;}return db['ChatInteraction'][_0x6cbe('0x49')]({'where':{'id':_0x3e0c6f['params']['id']},'include':[{'model':db[_0x6cbe('0x7f')],'as':_0x6cbe('0x80'),'include':[{'model':db[_0x6cbe('0x81')],'as':_0x6cbe('0x81')}]}]})[_0x6cbe('0x16')](handleEntityNotFound(_0x3487fe,null))[_0x6cbe('0x16')](saveUpdates(_0x3e0c6f['body'],null))['then'](function(_0x40e424){if(_0x40e424){_0x553760=_0x40e424;return db[_0x6cbe('0x82')]['find']({'where':{'id':_0x553760[_0x6cbe('0x83')]}});}})[_0x6cbe('0x16')](function(_0x1d743e){if(_0x1d743e){_0x18e633=_0x1d743e;return db[_0x6cbe('0x62')][_0x6cbe('0x49')]({'where':{'id':_0x553760[_0x6cbe('0x84')]}});}})[_0x6cbe('0x16')](function(_0x3a3024){if(_0x3a3024){if(_0x17d191){var _0xf6025f=null;for(var _0x580b38=0x1;_0x580b38<_0x553760[_0x6cbe('0x80')][_0x6cbe('0x46')];++_0x580b38){_0xf6025f=_0x553760[_0x6cbe('0x80')][_0x580b38];var _0x54edc4=_0xf6025f[_0x6cbe('0x66')]?util[_0x6cbe('0x7c')](_0x6cbe('0x85'),_0x18e633[_0x6cbe('0x86')],_0xf6025f[_0x6cbe('0x66')]):'System';var _0x42230c=_0x3e0c6f[_0x6cbe('0x31')][_0x6cbe('0x87')]||util[_0x6cbe('0x7c')](_0x6cbe('0x85'),'Visitor',_0xf6025f[_0x6cbe('0x84')]);switch(_0x18e633['agentIdentifier']){case _0x6cbe('0x88'):_0x54edc4=_0xf6025f[_0x6cbe('0x66')]?util[_0x6cbe('0x7c')]('%s%d',_0x18e633[_0x6cbe('0x86')],_0xf6025f[_0x6cbe('0x66')]):_0x6cbe('0x89');break;case'agent_alias':_0x54edc4=_0xf6025f[_0x6cbe('0x66')]?_0xf6025f[_0x6cbe('0x81')]['alias']||_0xf6025f['User'][_0x6cbe('0x8a')]:_0x6cbe('0x89');break;case _0x6cbe('0x8b'):_0x54edc4=_0xf6025f[_0x6cbe('0x66')]?_0xf6025f[_0x6cbe('0x81')][_0x6cbe('0x8a')]:_0x6cbe('0x89');break;default:_0x54edc4=_0xf6025f[_0x6cbe('0x66')]?util[_0x6cbe('0x7c')]('%s%d',_0x18e633[_0x6cbe('0x86')],_0xf6025f[_0x6cbe('0x66')]):_0x6cbe('0x89');}var _0x5a1fe5=util[_0x6cbe('0x7c')](_0x6cbe('0x8c'),moment(_0xf6025f[_0x6cbe('0x8d')])[_0x6cbe('0x7c')](_0x6cbe('0x8e')),_0xf6025f[_0x6cbe('0x8f')]==='in'?_0x42230c:_0x54edc4,_0xf6025f['body']);if(!_0xf6025f[_0x6cbe('0x90')]){fs[_0x6cbe('0x91')](_0x17d191,_0x5a1fe5);}}return db[_0x6cbe('0x92')][_0x6cbe('0x4d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x6cbe('0x93'),'raw':!![],'include':[{'model':db[_0x6cbe('0x94')],'as':_0x6cbe('0x94'),'raw':!![]}]}]});}}})[_0x6cbe('0x16')](function(_0x2b5121){if(!_0x2b5121||!_0x2b5121['Smtp']||!_0x3e0c6f[_0x6cbe('0x31')])return _0x553760;var _0x411493=_0x2b5121[_0x6cbe('0x95')]();return respondWithRpcPromise(_0x6cbe('0x96'),_0x6cbe('0x97'),{'account':_0x411493,'message':{'from':util['format'](_0x6cbe('0x98'),_0x2b5121[_0x6cbe('0x2d')],_0x2b5121[_0x6cbe('0x52')]||_0x2b5121[_0x6cbe('0x93')][_0x6cbe('0x3d')]),'to':_0x3e0c6f[_0x6cbe('0x31')][_0x6cbe('0x79')],'subject':_0x6cbe('0x99'),'text':util['format'](_0x6cbe('0x9a'),_0x3e0c6f[_0x6cbe('0x31')][_0x6cbe('0x79')]),'attachments':[{'path':_0x17d191}]}})[_0x6cbe('0x16')](function(){return _0x553760;})[_0x6cbe('0x21')](function(_0x50f7b0){logger[_0x6cbe('0x1c')](_0x50f7b0);});})[_0x6cbe('0x16')](respondWithStatusCode(_0x3487fe,0xc8))[_0x6cbe('0x21')](handleError(_0x3487fe,null));};exports[_0x6cbe('0x9b')]=function(_0x290978,_0x3f6f89){return db['ChatMessage'][_0x6cbe('0x49')]({'where':{'id':_0x290978[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](handleEntityNotFound(_0x3f6f89,null))[_0x6cbe('0x16')](function(_0x2e3fc0){if(_0x2e3fc0){return _0x2e3fc0['addMessage'](_0x290978[_0x6cbe('0x31')][_0x6cbe('0x9c')],_[_0x6cbe('0x9d')](_0x290978[_0x6cbe('0x31')],[_0x6cbe('0x9c'),'id'])||{});}})[_0x6cbe('0x16')](respondWithResult(_0x3f6f89,null))[_0x6cbe('0x21')](handleError(_0x3f6f89,null));};exports[_0x6cbe('0x9e')]=function(_0x135b72,_0x206aa8){var _0x4bc24c={'raw':![],'where':{}};var _0x36ab3b={};var _0x6e31f4={'count':0x0,'rows':[]};return db[_0x6cbe('0x37')][_0x6cbe('0x4d')]({'where':{'id':_0x135b72['params']['id']}})['then'](handleEntityNotFound(_0x206aa8,null))[_0x6cbe('0x16')](function(_0x3a5610){if(_0x3a5610){_0x36ab3b[_0x6cbe('0x43')]=_[_0x6cbe('0x40')](db[_0x6cbe('0x7f')][_0x6cbe('0x38')]);_0x36ab3b[_0x6cbe('0x3c')]=_[_0x6cbe('0x40')](_0x135b72[_0x6cbe('0x3c')]);_0x36ab3b[_0x6cbe('0x41')]=_[_0x6cbe('0x42')](_0x36ab3b['model'],_0x36ab3b['query']);_0x4bc24c[_0x6cbe('0x44')]=_[_0x6cbe('0x42')](_0x36ab3b[_0x6cbe('0x43')],qs[_0x6cbe('0x45')](_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0x45')]));_0x4bc24c[_0x6cbe('0x44')]=_0x4bc24c[_0x6cbe('0x44')][_0x6cbe('0x46')]?_0x4bc24c[_0x6cbe('0x44')]:_0x36ab3b[_0x6cbe('0x43')];if(!_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0x9f')](_0x6cbe('0xa0'))){_0x4bc24c[_0x6cbe('0x27')]=qs['limit'](_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0x27')]);_0x4bc24c[_0x6cbe('0x29')]=qs[_0x6cbe('0x29')](_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0x29')]);}_0x4bc24c['order']=qs[_0x6cbe('0xa1')](_0x135b72[_0x6cbe('0x3c')]['sort']);_0x4bc24c['where']=qs['filters'](_[_0x6cbe('0xa2')](_0x135b72[_0x6cbe('0x3c')],_0x36ab3b[_0x6cbe('0x41')]));_0x4bc24c[_0x6cbe('0xa3')]['ChatInteractionId']=_0x3a5610['id'];if(_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0xa4')]){_0x4bc24c[_0x6cbe('0xa3')]=_[_0x6cbe('0x30')](_0x4bc24c['where'],{'$or':_['map'](_0x4bc24c[_0x6cbe('0x44')],function(_0x4f346e){var _0x503a92={};_0x503a92[_0x4f346e]={'$like':'%'+_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0xa4')]+'%'};return _0x503a92;})});}if(_0x135b72['query'][_0x6cbe('0xa5')]){var _0x2a77d8=_0x135b72['query'][_0x6cbe('0xa5')]['split'](',');var _0x4f8666={};_0x4f8666[_0x2a77d8[0x0]]={'$gte':moment(_0x2a77d8[0x1])[_0x6cbe('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4bc24c[_0x6cbe('0xa3')]=_[_0x6cbe('0x30')](_0x4bc24c[_0x6cbe('0xa3')],_0x4f8666);}_0x4bc24c=_['merge']({},_0x4bc24c,_0x135b72[_0x6cbe('0xa6')]);return db[_0x6cbe('0x7f')]['count']({'where':_0x4bc24c['where']})[_0x6cbe('0x16')](function(_0x29e5d5){_0x6e31f4['count']=_0x29e5d5;if(_0x135b72[_0x6cbe('0x3c')][_0x6cbe('0x47')]){_0x4bc24c['include']=[{'all':!![]}];}return db[_0x6cbe('0x7f')][_0x6cbe('0x3b')](_0x4bc24c);})[_0x6cbe('0x16')](function(_0x262e18){_0x6e31f4['rows']=_0x262e18;return _0x6e31f4;});}})[_0x6cbe('0x16')](respondWithFilteredResult(_0x206aa8,_0x4bc24c))[_0x6cbe('0x21')](handleError(_0x206aa8,null));};exports[_0x6cbe('0xa7')]=function(_0x526ff8,_0x3a301a){var _0x7e9cf7={'where':{}},_0x541826={},_0x121f85={'count':0x0,'rows':[]};return db[_0x6cbe('0x37')][_0x6cbe('0x4d')]({'where':{'id':_0x526ff8[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](handleEntityNotFound(_0x3a301a,null))[_0x6cbe('0x16')](function(_0x5e77a7){if(_0x5e77a7){_0x541826[_0x6cbe('0x43')]=_[_0x6cbe('0x40')](db[_0x6cbe('0x7f')][_0x6cbe('0x38')]);_0x541826[_0x6cbe('0x3c')]=_[_0x6cbe('0x40')](_0x526ff8['query']);_0x541826[_0x6cbe('0x41')]=_[_0x6cbe('0x42')](_0x541826[_0x6cbe('0x43')],_0x541826['query']);_0x7e9cf7[_0x6cbe('0x44')]=_[_0x6cbe('0x42')](_0x541826['model'],qs[_0x6cbe('0x45')](_0x526ff8['query']['fields']));_0x7e9cf7['attributes']=_0x7e9cf7[_0x6cbe('0x44')][_0x6cbe('0x46')]?_0x7e9cf7[_0x6cbe('0x44')]:_0x541826[_0x6cbe('0x43')];if(!_0x526ff8[_0x6cbe('0x3c')][_0x6cbe('0x9f')](_0x6cbe('0xa0'))){_0x7e9cf7[_0x6cbe('0x27')]=qs['limit'](_0x526ff8[_0x6cbe('0x3c')][_0x6cbe('0x27')]);_0x7e9cf7[_0x6cbe('0x29')]=qs[_0x6cbe('0x29')](_0x526ff8[_0x6cbe('0x3c')][_0x6cbe('0x29')]);}_0x7e9cf7[_0x6cbe('0xa8')]=qs['sort'](_0x526ff8['query']['sort']);_0x7e9cf7[_0x6cbe('0xa3')]=qs[_0x6cbe('0x41')](_[_0x6cbe('0xa2')](_0x526ff8['query'],_0x541826[_0x6cbe('0x41')]));_0x7e9cf7[_0x6cbe('0xa3')]['ChatInteractionId']=_0x5e77a7['id'];if(_0x526ff8['query'][_0x6cbe('0xa4')]){_0x7e9cf7[_0x6cbe('0xa3')]=_[_0x6cbe('0x30')](_0x7e9cf7[_0x6cbe('0xa3')],{'$or':_[_0x6cbe('0x36')](_0x7e9cf7[_0x6cbe('0x44')],function(_0x5b00a0){var _0x44be8f={};_0x44be8f[_0x5b00a0]={'$like':'%'+_0x526ff8['query'][_0x6cbe('0xa4')]+'%'};return _0x44be8f;})});}_0x7e9cf7['where'][_0x6cbe('0x90')]=![];if(_0x526ff8[_0x6cbe('0x3c')]['id']){_0x7e9cf7['where']['id']={'$gt':_0x526ff8[_0x6cbe('0x3c')]['id']};}_0x7e9cf7=_[_0x6cbe('0x30')]({},_0x7e9cf7,_0x526ff8[_0x6cbe('0xa6')]);return db[_0x6cbe('0x7f')][_0x6cbe('0x28')]({'where':_0x7e9cf7[_0x6cbe('0xa3')]})[_0x6cbe('0x16')](function(_0x31ad8b){_0x121f85['count']=_0x31ad8b;_0x7e9cf7[_0x6cbe('0x48')]=[];if(_0x526ff8[_0x6cbe('0x3c')][_0x6cbe('0xa9')]){_0x7e9cf7[_0x6cbe('0x48')][_0x6cbe('0xaa')]({'model':db[_0x6cbe('0x81')],'as':_0x6cbe('0x81'),'attributes':['id',_0x6cbe('0x8a'),_0x6cbe('0xab')]});}if(_0x526ff8[_0x6cbe('0x3c')][_0x6cbe('0x47')]){_0x7e9cf7['include']=[{'all':!![]}];}return db[_0x6cbe('0x7f')][_0x6cbe('0x3b')](_0x7e9cf7);})[_0x6cbe('0x16')](function(_0x43809e){_0x121f85[_0x6cbe('0xac')]=_0x43809e;return _0x121f85;});}})[_0x6cbe('0x16')](respondWithFilteredResult(_0x3a301a,_0x7e9cf7))[_0x6cbe('0x21')](handleError(_0x3a301a,null));};exports[_0x6cbe('0xad')]=function(_0x3a6222,_0x51481e){return db[_0x6cbe('0x37')][_0x6cbe('0x49')]({'where':{'id':_0x3a6222[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](handleEntityNotFound(_0x51481e,null))['then'](function(_0x281eec){if(_0x281eec){return _0x281eec[_0x6cbe('0xae')](_0x3a6222[_0x6cbe('0x31')]['ids'],_[_0x6cbe('0x9d')](_0x3a6222['body'],[_0x6cbe('0x9c'),'id'])||{})[_0x6cbe('0xaf')](function(){return db[_0x6cbe('0xb0')][_0x6cbe('0x3b')]({'attributes':['id',_0x6cbe('0x2d'),'color'],'where':{'id':_0x3a6222[_0x6cbe('0x31')][_0x6cbe('0x9c')]}});})[_0x6cbe('0x16')](function(_0x12a207){socket[_0x6cbe('0xb1')]('chatInteractionTags:save',{'id':Number(_0x3a6222[_0x6cbe('0x3f')]['id']),'tags':_0x12a207||[]});return{'id':Number(_0x3a6222[_0x6cbe('0x3f')]['id']),'tags':_0x12a207||[]};});}})[_0x6cbe('0x16')](respondWithResult(_0x51481e,null))[_0x6cbe('0x21')](handleError(_0x51481e,null));};exports[_0x6cbe('0xb2')]=function(_0xb8a450,_0x55192d){return db[_0x6cbe('0x37')][_0x6cbe('0x49')]({'where':{'id':_0xb8a450[_0x6cbe('0x3f')]['id']}})[_0x6cbe('0x16')](handleEntityNotFound(_0x55192d,null))[_0x6cbe('0x16')](function(_0x3e6f70){if(_0x3e6f70){return _0x3e6f70[_0x6cbe('0xb2')](_0xb8a450[_0x6cbe('0x3c')][_0x6cbe('0x9c')]);}})[_0x6cbe('0x16')](respondWithStatusCode(_0x55192d,null))[_0x6cbe('0x21')](handleError(_0x55192d,null));};exports['download']=function(_0x176984,_0x134baf){var _0x13e2fd=moment()[_0x6cbe('0xb3')]()[_0x6cbe('0xb4')]();var _0x52d801=path[_0x6cbe('0x75')](config[_0x6cbe('0x7a')],'server',_0x6cbe('0xb5'),_0x6cbe('0xb6'));var _0x51bc3e=path[_0x6cbe('0x75')](config['root'],_0x6cbe('0xb7'),_0x6cbe('0xb5'),_0x6cbe('0xb8'));var _0x431130=path[_0x6cbe('0x75')](_0x52d801,_0x13e2fd);var _0x5152fc=util[_0x6cbe('0x7c')](_0x6cbe('0xb9'),_0x176984[_0x6cbe('0x3f')]['id'],_0x13e2fd);var _0x5b2722=path['join'](_0x52d801,_0x5152fc);var _0x3dc560=[];_0x3dc560[_0x6cbe('0xaa')]({'model':db['User'],'as':_0x6cbe('0x81'),'attributes':['id',_0x6cbe('0x8a')],'raw':!![]});_0x3dc560[_0x6cbe('0xaa')]({'model':db[_0x6cbe('0x62')],'as':'Contact','attributes':['id','firstName',_0x6cbe('0xba')],'raw':!![]});if(_0x176984[_0x6cbe('0x3c')]['attachments']){_0x3dc560[_0x6cbe('0xaa')]({'model':db[_0x6cbe('0x70')],'as':_0x6cbe('0x70'),'raw':!![]});}var _0x2d29b7=[{'model':db[_0x6cbe('0x7f')],'as':_0x6cbe('0x80'),'attributes':['id','body',_0x6cbe('0x8d'),_0x6cbe('0x8f'),_0x6cbe('0x90'),_0x6cbe('0xbb')],'include':_0x3dc560}];_0x2d29b7[_0x6cbe('0xaa')]({'model':db[_0x6cbe('0x82')],'as':'Account','attributes':['id','name']});_0x2d29b7[_0x6cbe('0xaa')]({'model':db[_0x6cbe('0x81')],'as':_0x6cbe('0xbc'),'attributes':['id',_0x6cbe('0x8a')]});return db[_0x6cbe('0x37')][_0x6cbe('0x49')]({'where':{'id':_0x176984[_0x6cbe('0x3f')]['id']},'include':_0x2d29b7})[_0x6cbe('0x16')](handleEntityNotFound(_0x134baf,null))[_0x6cbe('0x16')](function(_0x46dc63){if(_0x46dc63){var _0x4324e5=_0x46dc63['get']({'plain':!![]});fs[_0x6cbe('0xbd')](_0x431130);var _0x53bb03={'channel':_0x6cbe('0xbe'),'account':_0x4324e5[_0x6cbe('0xbf')][_0x6cbe('0x2d')],'agent':_0x4324e5[_0x6cbe('0xbc')]?_0x4324e5[_0x6cbe('0xbc')][_0x6cbe('0x8a')]:_0x6cbe('0xc0'),'createdAt':moment(_0x4324e5[_0x6cbe('0x8d')])[_0x6cbe('0x7c')](_0x6cbe('0xc1'))['toString'](),'closedAt':_0x4324e5[_0x6cbe('0x68')]?moment(_0x4324e5['closedAt'])[_0x6cbe('0x7c')](_0x6cbe('0xc1'))[_0x6cbe('0xb4')]():'','disposition':_0x4324e5[_0x6cbe('0x69')],'chatInfo':{'browser':_0x4324e5[_0x6cbe('0xc2')],'os':_0x4324e5[_0x6cbe('0xc3')],'referer':_0x4324e5[_0x6cbe('0xc4')],'customerIp':_0x4324e5[_0x6cbe('0xc5')],'customerPort':_0x4324e5['customerPort']?_0x4324e5[_0x6cbe('0xc6')]:_0x6cbe('0xc0')},'messages':_(_0x4324e5[_0x6cbe('0x80')])[_0x6cbe('0xc7')]()[_0x6cbe('0xa4')]({'secret':![]})[_0x6cbe('0x36')](function(_0x356574){if(_0x356574['Attachment']){var _0xf2d986=path[_0x6cbe('0x75')](_0x51bc3e,_0x356574[_0x6cbe('0x70')][_0x6cbe('0x77')]);if(fs[_0x6cbe('0xc8')](_0xf2d986)){fs[_0x6cbe('0xc9')](_0xf2d986)[_0x6cbe('0xca')](fs['createWriteStream'](path[_0x6cbe('0x75')](_0x431130,_0x356574[_0x6cbe('0x70')][_0x6cbe('0x77')])));}}return{'date':moment(_0x356574['createdAt'])[_0x6cbe('0x7c')](_0x6cbe('0xc1'))['toString'](),'sender':_0x356574['direction']===_0x6cbe('0x5e')?_0x356574[_0x6cbe('0x81')]?_0x356574['User'][_0x6cbe('0x8a')]:_0x6cbe('0x89'):_0x356574[_0x6cbe('0x63')][_0x6cbe('0xcb')]+(_0x356574[_0x6cbe('0x63')][_0x6cbe('0xba')]?'\x20'+_0x356574[_0x6cbe('0x63')][_0x6cbe('0xba')]:''),'body':_0x356574[_0x6cbe('0x70')]?_0x356574[_0x6cbe('0x70')][_0x6cbe('0x77')]:_0x356574[_0x6cbe('0x31')],'direction':_0x356574[_0x6cbe('0x8f')]===_0x6cbe('0x5e')?'A':'C','secret':_0x356574['secret'],'read':_0x356574[_0x6cbe('0xbb')],'attachment':_0x356574['Attachment']};})[_0x6cbe('0xcc')]()};return ejs['renderFile'](path['join'](config[_0x6cbe('0x7a')],_0x6cbe('0xb7'),_0x6cbe('0xcd'),_0x6cbe('0xce')),{'interaction':_0x53bb03})['then'](function(_0x4994c6){var _0x593bc1=path[_0x6cbe('0x75')](_0x431130,_0x6cbe('0xcf')+_0x4324e5['id']+'-'+_0x13e2fd+_0x6cbe('0xd0'));var _0x89d177={'path':_0x593bc1,'channel':_0x6cbe('0xbe'),'interactionId':_0x4324e5['id']};return pdf[_0x6cbe('0xd1')](_0x4994c6,_0x89d177);})[_0x6cbe('0x16')](function(){return new Promise(function(_0x5c5da4,_0x22583f){zipdir(_0x431130,{'saveTo':_0x5b2722},function(_0xdc15f4,_0x37c5b6){if(_0xdc15f4)return _0x22583f(_0xdc15f4);return _0x5c5da4(_0x37c5b6);});})['then'](function(){return new BPromise(function(_0x1fff94,_0x1870b9){rimraf(_0x431130,function(_0x5ddd71){if(_0x5ddd71)_0x1870b9(_0x5ddd71);return _0x1fff94();});});})['then'](function(){return _0x134baf[_0x6cbe('0x78')](_0x5b2722,_0x5152fc,function(_0x1eba9b){if(_0x1eba9b){logger[_0x6cbe('0x1c')]('err',_0x1eba9b);}else{fs[_0x6cbe('0xd2')](_0x5b2722);}});});});}else{return _0x134baf[_0x6cbe('0x22')](0xc8);}})[_0x6cbe('0x21')](handleError(_0x134baf,null));};
\ No newline at end of file
index 8214a36..46401c0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa39=['map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','setDataValue'];(function(_0x595378,_0x2d3a80){var _0x43eac1=function(_0x1f7181){while(--_0x1f7181){_0x595378['push'](_0x595378['shift']());}};_0x43eac1(++_0x2d3a80);}(_0xaa39,0x133));var _0x9aa3=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xaa39[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0x9aa3('0x0'));var ChatInteraction=require(_0x9aa3('0x1'))['db'][_0x9aa3('0x2')];var ChatMessage=require(_0x9aa3('0x1'))['db'][_0x9aa3('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9aa3('0x4'),'afterUpdate':_0x9aa3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2255bd){return function(_0x49d125,_0x4927a7,_0x48ccb0){_0x49d125[_0x9aa3('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4539c2){_0x49d125[_0x9aa3('0x7')]('Users',_0x4539c2[_0x9aa3('0x8')](function(_0x175b87){return{'id':_0x175b87['id']};}));return ChatMessage[_0x9aa3('0x9')]({'where':{'ChatInteractionId':_0x49d125['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x36ba0a){_0x49d125[_0x9aa3('0x7')]('unreadMessages',_0x36ba0a['length']);ChatInteractionEvents[_0x9aa3('0xa')](_0x2255bd+':'+_0x49d125['id'],_0x49d125);ChatInteractionEvents[_0x9aa3('0xa')](_0x2255bd,_0x49d125);_0x48ccb0(null);})[_0x9aa3('0xb')](_0x48ccb0(null));};}for(var e in events){if(events[_0x9aa3('0xc')](e)){var event=events[e];ChatInteraction[_0x9aa3('0xd')](e,emitEvent(event));}}module[_0x9aa3('0xe')]=ChatInteractionEvents;
\ No newline at end of file
+var _0x568e=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','setDataValue','Users','map','then','length','emit','catch'];(function(_0x42b1f6,_0x3df91b){var _0x37ee4f=function(_0x55df2){while(--_0x55df2){_0x42b1f6['push'](_0x42b1f6['shift']());}};_0x37ee4f(++_0x3df91b);}(_0x568e,0x1e9));var _0xe568=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x568e[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require(_0xe568('0x0'));var ChatInteraction=require(_0xe568('0x1'))['db'][_0xe568('0x2')];var ChatMessage=require(_0xe568('0x1'))['db'][_0xe568('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe568('0x4'),'afterUpdate':_0xe568('0x5'),'afterDestroy':_0xe568('0x6')};function emitEvent(_0x58cdd2){return function(_0x36a875,_0x1ee99f,_0x2de294){_0x36a875[_0xe568('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x232d63){_0x36a875[_0xe568('0x8')](_0xe568('0x9'),_0x232d63[_0xe568('0xa')](function(_0x1e17ec){return{'id':_0x1e17ec['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x36a875['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe568('0xb')](function(_0x1276b3){_0x36a875[_0xe568('0x8')]('unreadMessages',_0x1276b3[_0xe568('0xc')]);ChatInteractionEvents['emit'](_0x58cdd2+':'+_0x36a875['id'],_0x36a875);ChatInteractionEvents[_0xe568('0xd')](_0x58cdd2,_0x36a875);_0x2de294(null);})[_0xe568('0xe')](_0x2de294(null));};}for(var e in events){if(events[_0xe568('0xf')](e)){var event=events[e];ChatInteraction[_0xe568('0x10')](e,emitEvent(event));}}module[_0xe568('0x11')]=ChatInteractionEvents;
\ No newline at end of file
index 9620149..dfb0435 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4684=['moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','changed','closed','format','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x36b48f,_0x3d1e2c){var _0x20e644=function(_0x48e25f){while(--_0x48e25f){_0x36b48f['push'](_0x36b48f['shift']());}};_0x20e644(++_0x3d1e2c);}(_0x4684,0xb4));var _0x4468=function(_0x1b7442,_0x392128){_0x1b7442=_0x1b7442-0x0;var _0x15ef34=_0x4684[_0x1b7442];return _0x15ef34;};'use strict';var _=require('lodash');var util=require(_0x4468('0x0'));var logger=require(_0x4468('0x1'))('api');var moment=require(_0x4468('0x2'));var BPromise=require(_0x4468('0x3'));var rp=require(_0x4468('0x4'));var fs=require('fs');var path=require(_0x4468('0x5'));var rimraf=require(_0x4468('0x6'));var config=require('../../config/environment');var attributes=require(_0x4468('0x7'));module[_0x4468('0x8')]=function(_0x167a40,_0x51645d){return _0x167a40['define'](_0x4468('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b5be8,_0x355196,_0x12b944){if(_0x3b5be8[_0x4468('0xa')](_0x4468('0xb'))){_0x3b5be8['closedAt']=moment()[_0x4468('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x12b944(null,_0x3b5be8);}},'charset':'utf8mb4','collate':_0x4468('0xd')});};
\ No newline at end of file
+var _0x6b97=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x11ccb2,_0x3c3c09){var _0x5e59dd=function(_0x1a3c76){while(--_0x1a3c76){_0x11ccb2['push'](_0x11ccb2['shift']());}};_0x5e59dd(++_0x3c3c09);}(_0x6b97,0x112));var _0x76b9=function(_0x5d184b,_0x1b04c5){_0x5d184b=_0x5d184b-0x0;var _0x5cee64=_0x6b97[_0x5d184b];return _0x5cee64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x76b9('0x0'))(_0x76b9('0x1'));var moment=require(_0x76b9('0x2'));var BPromise=require(_0x76b9('0x3'));var rp=require(_0x76b9('0x4'));var fs=require('fs');var path=require(_0x76b9('0x5'));var rimraf=require('rimraf');var config=require(_0x76b9('0x6'));var attributes=require(_0x76b9('0x7'));module['exports']=function(_0x1e4be8,_0x2d28a0){return _0x1e4be8[_0x76b9('0x8')](_0x76b9('0x9'),attributes,{'tableName':_0x76b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x566133,_0x387863,_0xb85f78){if(_0x566133[_0x76b9('0xb')](_0x76b9('0xc'))){_0x566133[_0x76b9('0xd')]=moment()[_0x76b9('0xe')](_0x76b9('0xf'));}_0xb85f78(null,_0x566133);}},'charset':_0x76b9('0x10'),'collate':_0x76b9('0x11')});};
\ No newline at end of file
index 7ff85c4..e5942e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x56ec=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','where','attributes','AddTagsToChatInteraction','addTags','omit','body','ids','spread','AddTags','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x56ec,0x79));var _0xc56e=function(_0x586245,_0x132942){_0x586245=_0x586245-0x0;var _0x25b16a=_0x56ec[_0x586245];return _0x25b16a;};'use strict';var _=require(_0xc56e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc56e('0x1'));var rs=require(_0xc56e('0x2'));var fs=require('fs');var Redis=require(_0xc56e('0x3'));var db=require(_0xc56e('0x4'))['db'];var utils=require(_0xc56e('0x5'));var logger=require(_0xc56e('0x6'))(_0xc56e('0x7'));var config=require(_0xc56e('0x8'));var jayson=require(_0xc56e('0x9'));var client=jayson['client'][_0xc56e('0xa')]({'port':0x232a});config[_0xc56e('0xb')]=_[_0xc56e('0xc')](config[_0xc56e('0xb')],{'host':_0xc56e('0xd'),'port':0x18eb});var socket=require(_0xc56e('0xe'))(new Redis(config[_0xc56e('0xb')]));require(_0xc56e('0xf'))['register'](socket);function respondWithRpcPromise(_0x45bafd,_0x3863a1,_0x1f0b92){return new BPromise(function(_0x2877b6,_0xf72cc5){return client[_0xc56e('0x10')](_0x45bafd,_0x1f0b92)[_0xc56e('0x11')](function(_0x487bb8){logger[_0xc56e('0x12')](_0xc56e('0x13'),_0x3863a1,_0xc56e('0x14'));logger['debug'](_0xc56e('0x15'),_0x3863a1,_0xc56e('0x14'),JSON[_0xc56e('0x16')](_0x487bb8));if(_0x487bb8[_0xc56e('0x17')]){if(_0x487bb8['error'][_0xc56e('0x18')]===0x1f4){logger[_0xc56e('0x17')](_0xc56e('0x13'),_0x3863a1,_0x487bb8[_0xc56e('0x17')][_0xc56e('0x19')]);return _0xf72cc5(_0x487bb8[_0xc56e('0x17')]['message']);}logger[_0xc56e('0x17')](_0xc56e('0x13'),_0x3863a1,_0x487bb8[_0xc56e('0x17')][_0xc56e('0x19')]);return _0x2877b6(_0x487bb8[_0xc56e('0x17')][_0xc56e('0x19')]);}else{logger['info'](_0xc56e('0x13'),_0x3863a1,_0xc56e('0x14'));_0x2877b6(_0x487bb8[_0xc56e('0x1a')]['message']);}})[_0xc56e('0x1b')](function(_0x3b5d8f){logger[_0xc56e('0x17')](_0xc56e('0x13'),_0x3863a1,_0x3b5d8f);_0xf72cc5(_0x3b5d8f);});});}exports[_0xc56e('0x1c')]=function(_0x514c6c){var _0x744e49=this;return new Promise(function(_0x7198a3,_0x554a1c){return db[_0xc56e('0x1d')][_0xc56e('0x1e')](_0x514c6c['body'],{'raw':_0x514c6c['options']?_0x514c6c[_0xc56e('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514c6c[_0xc56e('0x1f')]?_0x514c6c[_0xc56e('0x1f')][_0xc56e('0x20')]||null:null,'attributes':_0x514c6c[_0xc56e('0x1f')]?_0x514c6c[_0xc56e('0x1f')][_0xc56e('0x21')]||null:null,'limit':_0x514c6c[_0xc56e('0x1f')]?_0x514c6c[_0xc56e('0x1f')]['limit']||null:null})[_0xc56e('0x11')](function(_0x2de51c){logger[_0xc56e('0x12')]('UpdateChatInteraction',_0x514c6c);logger['debug'](_0xc56e('0x1c'),_0x514c6c,JSON[_0xc56e('0x16')](_0x2de51c));_0x7198a3(_0x2de51c);})[_0xc56e('0x1b')](function(_0x27add3){logger[_0xc56e('0x17')](_0xc56e('0x1c'),_0x27add3[_0xc56e('0x19')],_0x514c6c);_0x554a1c(_0x744e49[_0xc56e('0x17')](0x1f4,_0x27add3[_0xc56e('0x19')]));});});};exports[_0xc56e('0x22')]=function(_0x3def3e){return new Promise(function(_0x3c6c53,_0x5d20c5){return db[_0xc56e('0x1d')]['find']({'where':_0x3def3e[_0xc56e('0x1f')]?_0x3def3e[_0xc56e('0x1f')][_0xc56e('0x20')]||null:null})['then'](function(_0x1e518e){if(_0x1e518e){return _0x1e518e[_0xc56e('0x23')](_0x3def3e['body']['ids'],_[_0xc56e('0x24')](_0x3def3e[_0xc56e('0x25')],[_0xc56e('0x26'),'id'])||{});}})[_0xc56e('0x27')](function(_0x1df120){logger[_0xc56e('0x12')](_0xc56e('0x28'),_0x3def3e);logger[_0xc56e('0x29')](_0xc56e('0x28'),_0x3def3e,JSON[_0xc56e('0x16')](_0x1df120));_0x3c6c53(_0x1df120);})[_0xc56e('0x1b')](function(_0x3c88be){logger[_0xc56e('0x17')](_0xc56e('0x28'),_0x3c88be[_0xc56e('0x19')],_0x3def3e);_0x5d20c5(_this[_0xc56e('0x17')](0x1f4,_0x3c88be[_0xc56e('0x19')]));});});};
\ No newline at end of file
+var _0xcded=['info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xcded,0x101));var _0xdcde=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0xcded[_0x3b2244];return _0x2dcc14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdcde('0x0'));var BPromise=require(_0xdcde('0x1'));var rs=require(_0xdcde('0x2'));var fs=require('fs');var Redis=require(_0xdcde('0x3'));var db=require(_0xdcde('0x4'))['db'];var utils=require(_0xdcde('0x5'));var logger=require(_0xdcde('0x6'))('rpc');var config=require(_0xdcde('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdcde('0x8')]({'port':0x232a});config[_0xdcde('0x9')]=_[_0xdcde('0xa')](config[_0xdcde('0x9')],{'host':_0xdcde('0xb'),'port':0x18eb});var socket=require(_0xdcde('0xc'))(new Redis(config[_0xdcde('0x9')]));require('./chatInteraction.socket')[_0xdcde('0xd')](socket);function respondWithRpcPromise(_0x2249f3,_0x4e8762,_0x22155c){return new BPromise(function(_0x447182,_0x334a41){return client['request'](_0x2249f3,_0x22155c)[_0xdcde('0xe')](function(_0x4801ef){logger['info'](_0xdcde('0xf'),_0x4e8762,_0xdcde('0x10'));logger[_0xdcde('0x11')](_0xdcde('0x12'),_0x4e8762,_0xdcde('0x10'),JSON[_0xdcde('0x13')](_0x4801ef));if(_0x4801ef['error']){if(_0x4801ef[_0xdcde('0x14')][_0xdcde('0x15')]===0x1f4){logger[_0xdcde('0x14')](_0xdcde('0xf'),_0x4e8762,_0x4801ef[_0xdcde('0x14')][_0xdcde('0x16')]);return _0x334a41(_0x4801ef[_0xdcde('0x14')][_0xdcde('0x16')]);}logger[_0xdcde('0x14')](_0xdcde('0xf'),_0x4e8762,_0x4801ef[_0xdcde('0x14')][_0xdcde('0x16')]);return _0x447182(_0x4801ef[_0xdcde('0x14')][_0xdcde('0x16')]);}else{logger[_0xdcde('0x17')](_0xdcde('0xf'),_0x4e8762,_0xdcde('0x10'));_0x447182(_0x4801ef['result']['message']);}})[_0xdcde('0x18')](function(_0x315077){logger[_0xdcde('0x14')](_0xdcde('0xf'),_0x4e8762,_0x315077);_0x334a41(_0x315077);});});}exports[_0xdcde('0x19')]=function(_0x3788b2){var _0x2e40ae=this;return new Promise(function(_0x347503,_0x2759b2){return db[_0xdcde('0x1a')][_0xdcde('0x1b')](_0x3788b2[_0xdcde('0x1c')],{'raw':_0x3788b2[_0xdcde('0x1d')]?_0x3788b2[_0xdcde('0x1d')][_0xdcde('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3788b2[_0xdcde('0x1d')]?_0x3788b2[_0xdcde('0x1d')][_0xdcde('0x1f')]||null:null,'attributes':_0x3788b2[_0xdcde('0x1d')]?_0x3788b2[_0xdcde('0x1d')]['attributes']||null:null,'limit':_0x3788b2[_0xdcde('0x1d')]?_0x3788b2['options'][_0xdcde('0x20')]||null:null})[_0xdcde('0xe')](function(_0x8c4326){logger[_0xdcde('0x17')](_0xdcde('0x19'),_0x3788b2);logger['debug'](_0xdcde('0x19'),_0x3788b2,JSON['stringify'](_0x8c4326));_0x347503(_0x8c4326);})['catch'](function(_0x37fe7c){logger['error']('UpdateChatInteraction',_0x37fe7c[_0xdcde('0x16')],_0x3788b2);_0x2759b2(_0x2e40ae[_0xdcde('0x14')](0x1f4,_0x37fe7c[_0xdcde('0x16')]));});});};exports[_0xdcde('0x21')]=function(_0x5bdfcc){return new Promise(function(_0x303509,_0x3ec2e8){return db[_0xdcde('0x1a')][_0xdcde('0x22')]({'where':_0x5bdfcc['options']?_0x5bdfcc['options'][_0xdcde('0x1f')]||null:null})[_0xdcde('0xe')](function(_0x20b884){if(_0x20b884){return _0x20b884[_0xdcde('0x23')](_0x5bdfcc['body'][_0xdcde('0x24')],_[_0xdcde('0x25')](_0x5bdfcc[_0xdcde('0x1c')],[_0xdcde('0x24'),'id'])||{});}})[_0xdcde('0x26')](function(_0x28c144){logger[_0xdcde('0x17')](_0xdcde('0x27'),_0x5bdfcc);logger[_0xdcde('0x11')](_0xdcde('0x27'),_0x5bdfcc,JSON[_0xdcde('0x13')](_0x28c144));_0x303509(_0x28c144);})[_0xdcde('0x18')](function(_0x837fa9){logger[_0xdcde('0x14')](_0xdcde('0x27'),_0x837fa9[_0xdcde('0x16')],_0x5bdfcc);_0x3ec2e8(_this[_0xdcde('0x14')](0x1f4,_0x837fa9[_0xdcde('0x16')]));});});};
\ No newline at end of file
index 8989238..daee561 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f5c=['./chatInteraction.events','save','remove','update','emit','register','length','chatInteraction:'];(function(_0xdddc26,_0x3db7b4){var _0x26f844=function(_0x201eb6){while(--_0x201eb6){_0xdddc26['push'](_0xdddc26['shift']());}};_0x26f844(++_0x3db7b4);}(_0x1f5c,0xb0));var _0xc1f5=function(_0x431265,_0x20d088){_0x431265=_0x431265-0x0;var _0x4a4484=_0x1f5c[_0x431265];return _0x4a4484;};'use strict';var ChatInteractionEvents=require(_0xc1f5('0x0'));var events=[_0xc1f5('0x1'),_0xc1f5('0x2'),_0xc1f5('0x3')];function createListener(_0x493fd3,_0x147cd7){return function(_0x75190a){_0x147cd7[_0xc1f5('0x4')](_0x493fd3,_0x75190a);};}function removeListener(_0x5689ec,_0x43868b){return function(){ChatInteractionEvents['removeListener'](_0x5689ec,_0x43868b);};}exports[_0xc1f5('0x5')]=function(_0x2dce24){for(var _0x264f8d=0x0,_0x17910d=events[_0xc1f5('0x6')];_0x264f8d<_0x17910d;_0x264f8d++){var _0x45cd04=events[_0x264f8d];var _0x24a1df=createListener(_0xc1f5('0x7')+_0x45cd04,_0x2dce24);ChatInteractionEvents['on'](_0x45cd04,_0x24a1df);}};
\ No newline at end of file
+var _0x566c=['removeListener','register','length','chatInteraction:','save','remove','emit'];(function(_0x1aecf8,_0x3c94a3){var _0x49afe1=function(_0x5a3212){while(--_0x5a3212){_0x1aecf8['push'](_0x1aecf8['shift']());}};_0x49afe1(++_0x3c94a3);}(_0x566c,0x1e0));var _0xc566=function(_0x405b24,_0x2a9264){_0x405b24=_0x405b24-0x0;var _0x1a799b=_0x566c[_0x405b24];return _0x1a799b;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xc566('0x0'),_0xc566('0x1'),'update'];function createListener(_0x3aaa22,_0x23ae4f){return function(_0x2c1210){_0x23ae4f[_0xc566('0x2')](_0x3aaa22,_0x2c1210);};}function removeListener(_0x52c817,_0x4e1dad){return function(){ChatInteractionEvents[_0xc566('0x3')](_0x52c817,_0x4e1dad);};}exports[_0xc566('0x4')]=function(_0x10e281){for(var _0x42876c=0x0,_0x1c7f66=events[_0xc566('0x5')];_0x42876c<_0x1c7f66;_0x42876c++){var _0x375780=events[_0x42876c];var _0x1cfc3f=createListener(_0xc566('0x6')+_0x375780,_0x10e281);ChatInteractionEvents['on'](_0x375780,_0x1cfc3f);}};
\ No newline at end of file
index 89d5d72..7bed3df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54be=['download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','originalname','single','addMessage','/:id/tags','chat','put','tracked','chatinteraction:update','customUpdate','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x4a30b7,_0x3dabc8){var _0xe48f3c=function(_0x391568){while(--_0x391568){_0x4a30b7['push'](_0x4a30b7['shift']());}};_0xe48f3c(++_0x3dabc8);}(_0x54be,0x135));var _0xe54b=function(_0x3a8d90,_0xe96556){_0x3a8d90=_0x3a8d90-0x0;var _0x34fb54=_0x54be[_0x3a8d90];return _0x34fb54;};'use strict';var multer=require(_0xe54b('0x0'));var util=require(_0xe54b('0x1'));var path=require('path');var timeout=require(_0xe54b('0x2'));var express=require(_0xe54b('0x3'));var router=express['Router']();var fs_extra=require(_0xe54b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe54b('0x5'));var config=require(_0xe54b('0x6'));var controller=require(_0xe54b('0x7'));router[_0xe54b('0x8')]('/',auth[_0xe54b('0x9')](),controller[_0xe54b('0xa')]);router[_0xe54b('0x8')]('/describe',auth[_0xe54b('0x9')](),controller['describe']);router['get'](_0xe54b('0xb'),auth[_0xe54b('0xc')](),controller[_0xe54b('0xd')]);router[_0xe54b('0x8')]('/:id/attachment_download',auth[_0xe54b('0xc')](),controller[_0xe54b('0xe')]);router[_0xe54b('0x8')](_0xe54b('0xf'),auth['isAuthenticated'](),controller[_0xe54b('0x10')]);router[_0xe54b('0x8')](_0xe54b('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xe54b('0x12')]);router[_0xe54b('0x8')](_0xe54b('0x13'),auth[_0xe54b('0x9')](),controller[_0xe54b('0x14')]);router[_0xe54b('0x15')]('/',auth[_0xe54b('0x9')](),controller[_0xe54b('0x16')]);router[_0xe54b('0x15')](_0xe54b('0x17'),auth[_0xe54b('0x9')](),controller[_0xe54b('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5293cf,_0x52e7e0,_0x11c552){_0x11c552(null,path[_0xe54b('0x19')](config[_0xe54b('0x1a')],_0xe54b('0x1b')));},'filename':function(_0x4003ad,_0x521657,_0x4237b3){_0x4237b3(null,util[_0xe54b('0x1c')](_0xe54b('0x1d'),Date['now'](),_0x521657[_0xe54b('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe54b('0x15')]('/:id/attachment_upload',upload[_0xe54b('0x1f')]('file'),controller['attachmentUpload']);router[_0xe54b('0x15')](_0xe54b('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xe54b('0x20')]);router[_0xe54b('0x15')](_0xe54b('0x21'),auth[_0xe54b('0x9')](),interaction['tracked'](_0xe54b('0x22'),'chatinteraction:addtags'),controller['addTags']);router[_0xe54b('0x23')](_0xe54b('0xb'),auth['isAuthenticated'](),interaction[_0xe54b('0x24')](_0xe54b('0x22'),_0xe54b('0x25')),controller['update']);router[_0xe54b('0x23')]('/:id/custom_update',controller[_0xe54b('0x26')]);router[_0xe54b('0x23')]('/:id/abandon',auth[_0xe54b('0xc')](),controller[_0xe54b('0x27')]);router[_0xe54b('0x23')](_0xe54b('0x28'),controller[_0xe54b('0x29')]);router['delete']('/:id',auth[_0xe54b('0x9')](),interaction[_0xe54b('0x24')]('chat',_0xe54b('0x2a')),controller[_0xe54b('0x2b')]);router[_0xe54b('0x2c')]('/:id/tags',auth['isAuthenticated'](),controller[_0xe54b('0x2d')]);module[_0xe54b('0x2e')]=router;
\ No newline at end of file
+var _0x65e3=['isAuthenticated','index','/describe','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get'];(function(_0x2de121,_0x14107d){var _0x3ff9aa=function(_0x55ba54){while(--_0x55ba54){_0x2de121['push'](_0x2de121['shift']());}};_0x3ff9aa(++_0x14107d);}(_0x65e3,0x12f));var _0x365e=function(_0x54d3ad,_0x4bb204){_0x54d3ad=_0x54d3ad-0x0;var _0x7c1cb2=_0x65e3[_0x54d3ad];return _0x7c1cb2;};'use strict';var multer=require(_0x365e('0x0'));var util=require(_0x365e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x365e('0x2'));var router=express[_0x365e('0x3')]();var fs_extra=require(_0x365e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x365e('0x5'));var config=require(_0x365e('0x6'));var controller=require(_0x365e('0x7'));router[_0x365e('0x8')]('/',auth[_0x365e('0x9')](),controller[_0x365e('0xa')]);router['get'](_0x365e('0xb'),auth[_0x365e('0x9')](),controller['describe']);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router[_0x365e('0x8')](_0x365e('0xc'),auth[_0x365e('0xd')](),controller[_0x365e('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x365e('0xf')]);router[_0x365e('0x8')](_0x365e('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x365e('0x11')]);router[_0x365e('0x8')](_0x365e('0x12'),auth[_0x365e('0x9')](),controller[_0x365e('0x13')]);router[_0x365e('0x14')]('/',auth[_0x365e('0x9')](),controller[_0x365e('0x15')]);router[_0x365e('0x14')](_0x365e('0x16'),auth['isAuthenticated'](),controller[_0x365e('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f0878,_0x233ebf,_0xe3c32a){_0xe3c32a(null,path[_0x365e('0x18')](config['root'],_0x365e('0x19')));},'filename':function(_0x2119e2,_0x360222,_0x26083d){_0x26083d(null,util[_0x365e('0x1a')](_0x365e('0x1b'),Date[_0x365e('0x1c')](),_0x360222[_0x365e('0x1d')][_0x365e('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x365e('0x14')](_0x365e('0x1f'),upload[_0x365e('0x20')](_0x365e('0x21')),controller[_0x365e('0x22')]);router['post'](_0x365e('0x23'),auth[_0x365e('0xd')](),controller[_0x365e('0x24')]);router['post'](_0x365e('0x25'),auth[_0x365e('0x9')](),interaction[_0x365e('0x26')](_0x365e('0x27'),'chatinteraction:addtags'),controller[_0x365e('0x28')]);router[_0x365e('0x29')](_0x365e('0x2a'),auth[_0x365e('0x9')](),interaction[_0x365e('0x26')](_0x365e('0x27'),_0x365e('0x2b')),controller[_0x365e('0x2c')]);router['put']('/:id/custom_update',controller[_0x365e('0x2d')]);router['put']('/:id/abandon',auth[_0x365e('0xd')](),controller[_0x365e('0x2e')]);router[_0x365e('0x29')](_0x365e('0x2f'),controller[_0x365e('0x30')]);router[_0x365e('0x31')]('/:id',auth[_0x365e('0x9')](),interaction[_0x365e('0x26')]('chat',_0x365e('0x32')),controller['destroy']);router[_0x365e('0x31')](_0x365e('0x25'),auth[_0x365e('0x9')](),controller['removeTags']);module[_0x365e('0x33')]=router;
\ No newline at end of file
index af27797..0b92552 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a76=['sequelize','exports','TEXT','medium','INTEGER'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x2a76,0x96));var _0x62a7=function(_0x1cbc1b,_0x2a88fd){_0x1cbc1b=_0x1cbc1b-0x0;var _0x409acd=_0x2a76[_0x1cbc1b];return _0x409acd;};'use strict';var Sequelize=require(_0x62a7('0x0'));module[_0x62a7('0x1')]={'body':{'type':Sequelize[_0x62a7('0x2')](_0x62a7('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x62a7('0x4')]}};
\ No newline at end of file
+var _0xadc0=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x2f7784,_0x28a499){var _0x2843cd=function(_0xaa1341){while(--_0xaa1341){_0x2f7784['push'](_0x2f7784['shift']());}};_0x2843cd(++_0x28a499);}(_0xadc0,0x100));var _0x0adc=function(_0x164a23,_0x1787cf){_0x164a23=_0x164a23-0x0;var _0x4135c3=_0xadc0[_0x164a23];return _0x4135c3;};'use strict';var Sequelize=require(_0x0adc('0x0'));module['exports']={'body':{'type':Sequelize[_0x0adc('0x1')](_0x0adc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0adc('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0adc('0x4')]}};
\ No newline at end of file
index f6f52d6..dcac6c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x56fc=['moment','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','name','send','index','fieldName','type','model','map','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','ChatInternalMessage','findAll','rows','show','rawAttributes','includeAll','options','find','catch','create','body','params','describe','messages','lastMessageAt','lastMessage','format','getUsers','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','get','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0x56fc,0x64));var _0xc56f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x56fc[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xc56f('0x0'));var rimraf=require(_0xc56f('0x1'));var zipdir=require(_0xc56f('0x2'));var jsonpatch=require(_0xc56f('0x3'));var rp=require(_0xc56f('0x4'));var moment=require(_0xc56f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc56f('0x6'));var sox=require(_0xc56f('0x7'));var csv=require(_0xc56f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc56f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc56f('0xa'));var jsforce=require(_0xc56f('0xb'));var deskjs=require(_0xc56f('0xc'));var toCsv=require(_0xc56f('0x8'));var querystring=require(_0xc56f('0xd'));var Papa=require('papaparse');var Redis=require(_0xc56f('0xe'));var authService=require(_0xc56f('0xf'));var qs=require(_0xc56f('0x10'));var as=require(_0xc56f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc56f('0x12'))(_0xc56f('0x13'));var utils=require('../../config/utils');var config=require(_0xc56f('0x14'));var licenseUtil=require(_0xc56f('0x15'));var db=require('../../mysqldb')['db'];config[_0xc56f('0x16')]=_['defaults'](config['redis'],{'host':_0xc56f('0x17'),'port':0x18eb});var socket=require(_0xc56f('0x18'))(new Redis(config[_0xc56f('0x16')]));require(_0xc56f('0x19'))['register'](socket);function respondWithStatusCode(_0x5a0819,_0x4a2060){_0x4a2060=_0x4a2060||0xcc;return function(_0x593b87){if(_0x593b87){return _0x5a0819[_0xc56f('0x1a')](_0x4a2060);}return _0x5a0819[_0xc56f('0x1b')](_0x4a2060)[_0xc56f('0x1c')]();};}function respondWithResult(_0x42f51f,_0x575ac2){_0x575ac2=_0x575ac2||0xc8;return function(_0x1ed946){if(_0x1ed946){return _0x42f51f[_0xc56f('0x1b')](_0x575ac2)[_0xc56f('0x1d')](_0x1ed946);}};}function respondWithFilteredResult(_0x2a9fe7,_0x43b3dd){return function(_0x45f5ec){if(_0x45f5ec){var _0x3d3b22=typeof _0x43b3dd['offset']===_0xc56f('0x1e')&&typeof _0x43b3dd[_0xc56f('0x1f')]===_0xc56f('0x1e');var _0x44b06d=_0x45f5ec[_0xc56f('0x20')];var _0x3a95b8=_0x3d3b22?0x0:_0x43b3dd[_0xc56f('0x21')];var _0x2e1056=_0x3d3b22?_0x45f5ec[_0xc56f('0x20')]:_0x43b3dd[_0xc56f('0x21')]+_0x43b3dd[_0xc56f('0x1f')];var _0x3ff1a0;if(_0x2e1056>=_0x44b06d){_0x2e1056=_0x44b06d;_0x3ff1a0=0xc8;}else{_0x3ff1a0=0xce;}_0x2a9fe7['status'](_0x3ff1a0);return _0x2a9fe7[_0xc56f('0x22')](_0xc56f('0x23'),_0x3a95b8+'-'+_0x2e1056+'/'+_0x44b06d)[_0xc56f('0x1d')](_0x45f5ec);}return null;};}function patchUpdates(_0x1e4d9a){return function(_0x3b453c){try{jsonpatch[_0xc56f('0x24')](_0x3b453c,_0x1e4d9a,!![]);}catch(_0x558994){return BPromise[_0xc56f('0x25')](_0x558994);}return _0x3b453c['save']();};}function saveUpdates(_0x579e32,_0x19d76a){return function(_0x413a76){if(_0x413a76){return _0x413a76[_0xc56f('0x26')](_0x579e32)['then'](function(_0x60f98f){return _0x60f98f;});}return null;};}function removeEntity(_0x2973b4,_0x52e8a7){return function(_0x9ad259){if(_0x9ad259){return _0x9ad259[_0xc56f('0x27')]()[_0xc56f('0x28')](function(){_0x2973b4[_0xc56f('0x1b')](0xcc)[_0xc56f('0x1c')]();});}};}function handleEntityNotFound(_0xe9fb21,_0x3182c6){return function(_0x2c0d1d){if(!_0x2c0d1d){_0xe9fb21[_0xc56f('0x1a')](0x194);}return _0x2c0d1d;};}function handleError(_0x25a839,_0x1fcc4c){_0x1fcc4c=_0x1fcc4c||0x1f4;return function(_0xcdaf4e){logger['error'](_0xcdaf4e['stack']);if(_0xcdaf4e[_0xc56f('0x29')]){delete _0xcdaf4e[_0xc56f('0x29')];}_0x25a839['status'](_0x1fcc4c)[_0xc56f('0x2a')](_0xcdaf4e);};}exports[_0xc56f('0x2b')]=function(_0x56dc2c,_0x5c3044){var _0x3aa79c={},_0x2c6b41={},_0x45f73d={'count':0x0,'rows':[]};var _0x140d9b=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x257aad){return{'name':_0x257aad[_0xc56f('0x2c')],'type':_0x257aad[_0xc56f('0x2d')]['key']};});_0x2c6b41[_0xc56f('0x2e')]=_[_0xc56f('0x2f')](_0x140d9b,'name');_0x2c6b41['query']=_[_0xc56f('0x30')](_0x56dc2c['query']);_0x2c6b41[_0xc56f('0x31')]=_[_0xc56f('0x32')](_0x2c6b41[_0xc56f('0x2e')],_0x2c6b41['query']);_0x3aa79c[_0xc56f('0x33')]=_['intersection'](_0x2c6b41['model'],qs['fields'](_0x56dc2c[_0xc56f('0x34')][_0xc56f('0x35')]));_0x3aa79c[_0xc56f('0x33')]=_0x3aa79c[_0xc56f('0x33')][_0xc56f('0x36')]?_0x3aa79c[_0xc56f('0x33')]:_0x2c6b41[_0xc56f('0x2e')];if(!_0x56dc2c[_0xc56f('0x34')][_0xc56f('0x37')](_0xc56f('0x38'))){_0x3aa79c[_0xc56f('0x1f')]=qs['limit'](_0x56dc2c['query']['limit']);_0x3aa79c[_0xc56f('0x21')]=qs[_0xc56f('0x21')](_0x56dc2c[_0xc56f('0x34')][_0xc56f('0x21')]);}_0x3aa79c[_0xc56f('0x39')]=qs['sort'](_0x56dc2c['query'][_0xc56f('0x3a')]);_0x3aa79c[_0xc56f('0x3b')]=qs['filters'](_['pick'](_0x56dc2c['query'],_0x2c6b41['filters']),_0x140d9b);if(_0x56dc2c[_0xc56f('0x34')][_0xc56f('0x3c')]){_0x3aa79c[_0xc56f('0x3b')]=_[_0xc56f('0x3d')](_0x3aa79c[_0xc56f('0x3b')],{'$or':_[_0xc56f('0x2f')](_0x140d9b,function(_0x3f27fd){if(_0x3f27fd[_0xc56f('0x2d')]!=='VIRTUAL'){var _0x4e2935={};_0x4e2935[_0x3f27fd[_0xc56f('0x29')]]={'$like':'%'+_0x56dc2c[_0xc56f('0x34')][_0xc56f('0x3c')]+'%'};return _0x4e2935;}})});}_0x3aa79c=_[_0xc56f('0x3d')]({},_0x3aa79c,_0x56dc2c['options']);var _0x2dbb8c={'where':_0x3aa79c[_0xc56f('0x3b')]};return db[_0xc56f('0x3e')][_0xc56f('0x20')](_0x2dbb8c)[_0xc56f('0x28')](function(_0x4e94b9){_0x45f73d[_0xc56f('0x20')]=_0x4e94b9;if(_0x56dc2c[_0xc56f('0x34')]['includeAll']){_0x3aa79c['include']=[{'all':!![]}];}return db[_0xc56f('0x3e')][_0xc56f('0x3f')](_0x3aa79c);})[_0xc56f('0x28')](function(_0x3ecf44){_0x45f73d[_0xc56f('0x40')]=_0x3ecf44;return _0x45f73d;})[_0xc56f('0x28')](respondWithFilteredResult(_0x5c3044,_0x3aa79c))['catch'](handleError(_0x5c3044,null));};exports[_0xc56f('0x41')]=function(_0x32ee73,_0x4abeba){var _0x258786={'raw':!![],'where':{'id':_0x32ee73['params']['id']}},_0x5d7072={};_0x5d7072['model']=_[_0xc56f('0x30')](db[_0xc56f('0x3e')][_0xc56f('0x42')]);_0x5d7072[_0xc56f('0x34')]=_[_0xc56f('0x30')](_0x32ee73[_0xc56f('0x34')]);_0x5d7072[_0xc56f('0x31')]=_['intersection'](_0x5d7072[_0xc56f('0x2e')],_0x5d7072[_0xc56f('0x34')]);_0x258786[_0xc56f('0x33')]=_[_0xc56f('0x32')](_0x5d7072[_0xc56f('0x2e')],qs[_0xc56f('0x35')](_0x32ee73[_0xc56f('0x34')]['fields']));_0x258786[_0xc56f('0x33')]=_0x258786[_0xc56f('0x33')][_0xc56f('0x36')]?_0x258786[_0xc56f('0x33')]:_0x5d7072[_0xc56f('0x2e')];if(_0x32ee73[_0xc56f('0x34')][_0xc56f('0x43')]){_0x258786['include']=[{'all':!![]}];}_0x258786=_[_0xc56f('0x3d')]({},_0x258786,_0x32ee73[_0xc56f('0x44')]);return db[_0xc56f('0x3e')][_0xc56f('0x45')](_0x258786)[_0xc56f('0x28')](handleEntityNotFound(_0x4abeba,null))['then'](respondWithResult(_0x4abeba,null))[_0xc56f('0x46')](handleError(_0x4abeba,null));};exports[_0xc56f('0x47')]=function(_0x562ca5,_0x1a59b9){return db[_0xc56f('0x3e')]['create'](_0x562ca5['body'],{})[_0xc56f('0x28')](respondWithResult(_0x1a59b9,0xc9))[_0xc56f('0x46')](handleError(_0x1a59b9,null));};exports['update']=function(_0x8bb9bc,_0x18b0ca){if(_0x8bb9bc[_0xc56f('0x48')]['id']){delete _0x8bb9bc[_0xc56f('0x48')]['id'];}return db['ChatInternalMessage'][_0xc56f('0x45')]({'where':{'id':_0x8bb9bc['params']['id']}})['then'](handleEntityNotFound(_0x18b0ca,null))[_0xc56f('0x28')](saveUpdates(_0x8bb9bc[_0xc56f('0x48')],null))[_0xc56f('0x28')](respondWithResult(_0x18b0ca,null))['catch'](handleError(_0x18b0ca,null));};exports[_0xc56f('0x27')]=function(_0x159a28,_0x120a6a){return db['ChatInternalMessage']['find']({'where':{'id':_0x159a28[_0xc56f('0x49')]['id']}})[_0xc56f('0x28')](handleEntityNotFound(_0x120a6a,null))[_0xc56f('0x28')](removeEntity(_0x120a6a,null))['catch'](handleError(_0x120a6a,null));};exports[_0xc56f('0x4a')]=function(_0x5efb31,_0x3d2fe2){return db['ChatInternalMessage'][_0xc56f('0x4a')]()['then'](respondWithResult(_0x3d2fe2,null))[_0xc56f('0x46')](handleError(_0x3d2fe2,null));};function wrapUser(_0x130e90){return function(_0x43de34){var _0xdd1dd6=_0x130e90['get']({'plain':!![]});_0xdd1dd6[_0xc56f('0x4b')]=[];if(_0x43de34){_0xdd1dd6[_0xc56f('0x4c')]=_0x43de34['createdAt'];_0xdd1dd6[_0xc56f('0x4d')]=_0x43de34;}else{_0xdd1dd6['lastMessageAt']=moment(0x0)[_0xc56f('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0xdd1dd6['lastMessage']={};}return _0xdd1dd6;};}exports[_0xc56f('0x4f')]=function(_0x4060fc,_0x19d207,_0x10ea10){var _0x7d9b1b=[];return db['User'][_0xc56f('0x3f')]({'where':{'role':[_0xc56f('0x50'),'admin',_0xc56f('0x51')]},'attributes':['id',_0xc56f('0x52'),_0xc56f('0x29'),_0xc56f('0x53'),_0xc56f('0x54'),_0xc56f('0x55'),_0xc56f('0x56'),_0xc56f('0x57'),_0xc56f('0x58'),'showWebBar'],'order':qs[_0xc56f('0x3a')](_0xc56f('0x59')),'include':[{'model':db[_0xc56f('0x5a')],'as':_0xc56f('0x5b'),'attributes':['id',_0xc56f('0x29'),_0xc56f('0x2d')],'through':{'attributes':[]}}]})[_0xc56f('0x28')](function(_0x81bb9f){if(_0x81bb9f){var _0x2ef31b=_0x4060fc['user'][_0xc56f('0x5c')]({'plain':!![]});if(!_0x2ef31b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ef31b['role']==='user'){return db['UserProfileSection'][_0xc56f('0x45')]({'where':{'name':_0xc56f('0x5d'),'userProfileId':_0x2ef31b[_0xc56f('0x5e')]},'raw':!![]})['then'](function(_0x45fc05){if(_0x45fc05){if(_0x45fc05['autoAssociation']===0x0){return db[_0xc56f('0x5f')][_0xc56f('0x3f')]({'where':{'sectionId':_0x45fc05['id']},'raw':!![]})[_0xc56f('0x28')](function(_0xec96fd){var _0x10a98b=[];if(_[_0xc56f('0x60')](_0xec96fd)){_0x10a98b=_[_0xc56f('0x3c')](_0x81bb9f,function(_0x19396b){if(_0x19396b['role']!=='agent'){return _0x19396b;}});return _0x10a98b;}else{for(var _0x523e09=0x0;_0x523e09<_0x81bb9f[_0xc56f('0x36')];_0x523e09++){var _0x53cb8d=_0x81bb9f[_0x523e09];if(_0x53cb8d['role']===_0xc56f('0x50')){var _0x41baad=_[_0xc56f('0x45')](_0xec96fd,function(_0x21b58b){return _0x21b58b[_0xc56f('0x61')]===_0x53cb8d['id'];});if(_0x41baad)_0x10a98b[_0xc56f('0x62')](_0x53cb8d);}else{_0x10a98b[_0xc56f('0x62')](_0x53cb8d);}}return _0x10a98b;}});}else{return _0x81bb9f;}}else{var _0xec4389=_['filter'](_0x81bb9f,function(_0x3c8055){if(_0x3c8055[_0xc56f('0x53')]!==_0xc56f('0x50')){return _0x3c8055;}});return _0xec4389;}});}else{return _0x81bb9f;}}})[_0xc56f('0x28')](function(_0xabdd57){var _0x3f0d84=[];if(_0xabdd57){_0x7d9b1b=_0xabdd57;for(var _0xf2451d=0x0;_0xf2451d<_0xabdd57[_0xc56f('0x36')];_0xf2451d+=0x1){_0x7d9b1b[_0xf2451d][_0xc56f('0x4b')]=[];_0x3f0d84['push'](db[_0xc56f('0x3e')]['find']({'where':{'FromId':[_0x4060fc[_0xc56f('0x51')]['id'],_0xabdd57[_0xf2451d]['id']],'ToId':[_0x4060fc['user']['id'],_0xabdd57[_0xf2451d]['id']],'ChatGroupId':null},'attributes':['id',_0xc56f('0x63'),_0xc56f('0x64'),_0xc56f('0x65'),_0xc56f('0x66'),'body'],'order':qs[_0xc56f('0x3a')](_0xc56f('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xabdd57[_0xf2451d])));}return BPromise[_0xc56f('0x68')](_0x3f0d84);}return[];})['then'](function(_0x5c85e8){return{'rows':_0x5c85e8,'count':_0x5c85e8[_0xc56f('0x36')]};})[_0xc56f('0x28')](respondWithResult(_0x19d207,null))[_0xc56f('0x46')](handleError(_0x19d207,null));};
\ No newline at end of file
+var _0x9dbe=['status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','params','find','catch','create','body','update','destroy','describe','get','messages','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x1704f7,_0x5e0ca3){var _0x5c20b4=function(_0x50175d){while(--_0x50175d){_0x1704f7['push'](_0x1704f7['shift']());}};_0x5c20b4(++_0x5e0ca3);}(_0x9dbe,0xc2));var _0xe9db=function(_0x29a580,_0xc0cfbb){_0x29a580=_0x29a580-0x0;var _0x196b8c=_0x9dbe[_0x29a580];return _0x196b8c;};'use strict';var emlformat=require(_0xe9db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9db('0x1'));var jsonpatch=require(_0xe9db('0x2'));var rp=require(_0xe9db('0x3'));var moment=require(_0xe9db('0x4'));var BPromise=require(_0xe9db('0x5'));var Mustache=require(_0xe9db('0x6'));var util=require('util');var path=require(_0xe9db('0x7'));var sox=require(_0xe9db('0x8'));var csv=require(_0xe9db('0x9'));var ejs=require(_0xe9db('0xa'));var fs=require('fs');var fs_extra=require(_0xe9db('0xb'));var _=require('lodash');var squel=require(_0xe9db('0xc'));var crypto=require(_0xe9db('0xd'));var jsforce=require(_0xe9db('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe9db('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9db('0xf'));var authService=require(_0xe9db('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9db('0x11'))(_0xe9db('0x12'));var utils=require(_0xe9db('0x13'));var config=require(_0xe9db('0x14'));var licenseUtil=require(_0xe9db('0x15'));var db=require('../../mysqldb')['db'];config[_0xe9db('0x16')]=_[_0xe9db('0x17')](config['redis'],{'host':_0xe9db('0x18'),'port':0x18eb});var socket=require(_0xe9db('0x19'))(new Redis(config[_0xe9db('0x16')]));require(_0xe9db('0x1a'))[_0xe9db('0x1b')](socket);function respondWithStatusCode(_0x543155,_0x10aadc){_0x10aadc=_0x10aadc||0xcc;return function(_0x30f782){if(_0x30f782){return _0x543155['sendStatus'](_0x10aadc);}return _0x543155[_0xe9db('0x1c')](_0x10aadc)[_0xe9db('0x1d')]();};}function respondWithResult(_0x9f5e83,_0x5c1691){_0x5c1691=_0x5c1691||0xc8;return function(_0x4a53d9){if(_0x4a53d9){return _0x9f5e83[_0xe9db('0x1c')](_0x5c1691)[_0xe9db('0x1e')](_0x4a53d9);}};}function respondWithFilteredResult(_0x55c357,_0x56716f){return function(_0x522705){if(_0x522705){var _0x1ec863=typeof _0x56716f['offset']===_0xe9db('0x1f')&&typeof _0x56716f['limit']===_0xe9db('0x1f');var _0x38df36=_0x522705['count'];var _0xe40f58=_0x1ec863?0x0:_0x56716f[_0xe9db('0x20')];var _0x18b720=_0x1ec863?_0x522705[_0xe9db('0x21')]:_0x56716f[_0xe9db('0x20')]+_0x56716f[_0xe9db('0x22')];var _0x477cfd;if(_0x18b720>=_0x38df36){_0x18b720=_0x38df36;_0x477cfd=0xc8;}else{_0x477cfd=0xce;}_0x55c357[_0xe9db('0x1c')](_0x477cfd);return _0x55c357[_0xe9db('0x23')](_0xe9db('0x24'),_0xe40f58+'-'+_0x18b720+'/'+_0x38df36)['json'](_0x522705);}return null;};}function patchUpdates(_0x5320e6){return function(_0x535f84){try{jsonpatch[_0xe9db('0x25')](_0x535f84,_0x5320e6,!![]);}catch(_0x44c7e8){return BPromise[_0xe9db('0x26')](_0x44c7e8);}return _0x535f84[_0xe9db('0x27')]();};}function saveUpdates(_0x459817,_0x38e452){return function(_0xe5a7cc){if(_0xe5a7cc){return _0xe5a7cc['update'](_0x459817)[_0xe9db('0x28')](function(_0x240552){return _0x240552;});}return null;};}function removeEntity(_0x22ebc6,_0x1f3f60){return function(_0xf6f256){if(_0xf6f256){return _0xf6f256['destroy']()[_0xe9db('0x28')](function(){_0x22ebc6[_0xe9db('0x1c')](0xcc)[_0xe9db('0x1d')]();});}};}function handleEntityNotFound(_0x2efa9d,_0x9b11f2){return function(_0x4f7eb3){if(!_0x4f7eb3){_0x2efa9d['sendStatus'](0x194);}return _0x4f7eb3;};}function handleError(_0x43cf01,_0x495ba6){_0x495ba6=_0x495ba6||0x1f4;return function(_0x5538b0){logger[_0xe9db('0x29')](_0x5538b0[_0xe9db('0x2a')]);if(_0x5538b0[_0xe9db('0x2b')]){delete _0x5538b0[_0xe9db('0x2b')];}_0x43cf01[_0xe9db('0x1c')](_0x495ba6)[_0xe9db('0x2c')](_0x5538b0);};}exports[_0xe9db('0x2d')]=function(_0x3b0683,_0x47eaef){var _0x44c29b={},_0x24e71c={},_0x457e93={'count':0x0,'rows':[]};var _0x1aeb5d=_[_0xe9db('0x2e')](db['ChatInternalMessage'][_0xe9db('0x2f')],function(_0x349ea){return{'name':_0x349ea[_0xe9db('0x30')],'type':_0x349ea[_0xe9db('0x31')][_0xe9db('0x32')]};});_0x24e71c[_0xe9db('0x33')]=_[_0xe9db('0x2e')](_0x1aeb5d,_0xe9db('0x2b'));_0x24e71c[_0xe9db('0x34')]=_[_0xe9db('0x35')](_0x3b0683['query']);_0x24e71c[_0xe9db('0x36')]=_[_0xe9db('0x37')](_0x24e71c[_0xe9db('0x33')],_0x24e71c['query']);_0x44c29b[_0xe9db('0x38')]=_[_0xe9db('0x37')](_0x24e71c['model'],qs[_0xe9db('0x39')](_0x3b0683[_0xe9db('0x34')][_0xe9db('0x39')]));_0x44c29b[_0xe9db('0x38')]=_0x44c29b[_0xe9db('0x38')][_0xe9db('0x3a')]?_0x44c29b[_0xe9db('0x38')]:_0x24e71c[_0xe9db('0x33')];if(!_0x3b0683[_0xe9db('0x34')]['hasOwnProperty'](_0xe9db('0x3b'))){_0x44c29b['limit']=qs[_0xe9db('0x22')](_0x3b0683['query'][_0xe9db('0x22')]);_0x44c29b['offset']=qs[_0xe9db('0x20')](_0x3b0683[_0xe9db('0x34')]['offset']);}_0x44c29b[_0xe9db('0x3c')]=qs[_0xe9db('0x3d')](_0x3b0683[_0xe9db('0x34')]['sort']);_0x44c29b[_0xe9db('0x3e')]=qs[_0xe9db('0x36')](_[_0xe9db('0x3f')](_0x3b0683['query'],_0x24e71c[_0xe9db('0x36')]),_0x1aeb5d);if(_0x3b0683['query'][_0xe9db('0x40')]){_0x44c29b[_0xe9db('0x3e')]=_[_0xe9db('0x41')](_0x44c29b[_0xe9db('0x3e')],{'$or':_[_0xe9db('0x2e')](_0x1aeb5d,function(_0x4d96b1){if(_0x4d96b1['type']!==_0xe9db('0x42')){var _0x254cae={};_0x254cae[_0x4d96b1[_0xe9db('0x2b')]]={'$like':'%'+_0x3b0683[_0xe9db('0x34')][_0xe9db('0x40')]+'%'};return _0x254cae;}})});}_0x44c29b=_['merge']({},_0x44c29b,_0x3b0683[_0xe9db('0x43')]);var _0x3bc466={'where':_0x44c29b[_0xe9db('0x3e')]};return db[_0xe9db('0x44')][_0xe9db('0x21')](_0x3bc466)['then'](function(_0x3929d5){_0x457e93[_0xe9db('0x21')]=_0x3929d5;if(_0x3b0683[_0xe9db('0x34')][_0xe9db('0x45')]){_0x44c29b[_0xe9db('0x46')]=[{'all':!![]}];}return db[_0xe9db('0x44')][_0xe9db('0x47')](_0x44c29b);})[_0xe9db('0x28')](function(_0x372aa5){_0x457e93['rows']=_0x372aa5;return _0x457e93;})[_0xe9db('0x28')](respondWithFilteredResult(_0x47eaef,_0x44c29b))['catch'](handleError(_0x47eaef,null));};exports['show']=function(_0x7b23d1,_0x21ddf1){var _0x31c96a={'raw':!![],'where':{'id':_0x7b23d1[_0xe9db('0x48')]['id']}},_0x10e518={};_0x10e518[_0xe9db('0x33')]=_[_0xe9db('0x35')](db[_0xe9db('0x44')][_0xe9db('0x2f')]);_0x10e518[_0xe9db('0x34')]=_[_0xe9db('0x35')](_0x7b23d1[_0xe9db('0x34')]);_0x10e518[_0xe9db('0x36')]=_[_0xe9db('0x37')](_0x10e518['model'],_0x10e518[_0xe9db('0x34')]);_0x31c96a['attributes']=_[_0xe9db('0x37')](_0x10e518[_0xe9db('0x33')],qs[_0xe9db('0x39')](_0x7b23d1[_0xe9db('0x34')][_0xe9db('0x39')]));_0x31c96a[_0xe9db('0x38')]=_0x31c96a['attributes'][_0xe9db('0x3a')]?_0x31c96a[_0xe9db('0x38')]:_0x10e518[_0xe9db('0x33')];if(_0x7b23d1[_0xe9db('0x34')][_0xe9db('0x45')]){_0x31c96a[_0xe9db('0x46')]=[{'all':!![]}];}_0x31c96a=_[_0xe9db('0x41')]({},_0x31c96a,_0x7b23d1['options']);return db[_0xe9db('0x44')][_0xe9db('0x49')](_0x31c96a)[_0xe9db('0x28')](handleEntityNotFound(_0x21ddf1,null))[_0xe9db('0x28')](respondWithResult(_0x21ddf1,null))[_0xe9db('0x4a')](handleError(_0x21ddf1,null));};exports[_0xe9db('0x4b')]=function(_0x26cf1a,_0x1de6e8){return db[_0xe9db('0x44')]['create'](_0x26cf1a[_0xe9db('0x4c')],{})['then'](respondWithResult(_0x1de6e8,0xc9))[_0xe9db('0x4a')](handleError(_0x1de6e8,null));};exports[_0xe9db('0x4d')]=function(_0x5cb6d4,_0x3b44f0){if(_0x5cb6d4[_0xe9db('0x4c')]['id']){delete _0x5cb6d4['body']['id'];}return db[_0xe9db('0x44')][_0xe9db('0x49')]({'where':{'id':_0x5cb6d4['params']['id']}})[_0xe9db('0x28')](handleEntityNotFound(_0x3b44f0,null))[_0xe9db('0x28')](saveUpdates(_0x5cb6d4['body'],null))[_0xe9db('0x28')](respondWithResult(_0x3b44f0,null))[_0xe9db('0x4a')](handleError(_0x3b44f0,null));};exports[_0xe9db('0x4e')]=function(_0x135c4f,_0x21c156){return db['ChatInternalMessage'][_0xe9db('0x49')]({'where':{'id':_0x135c4f[_0xe9db('0x48')]['id']}})[_0xe9db('0x28')](handleEntityNotFound(_0x21c156,null))[_0xe9db('0x28')](removeEntity(_0x21c156,null))[_0xe9db('0x4a')](handleError(_0x21c156,null));};exports[_0xe9db('0x4f')]=function(_0x9cdb9d,_0xfc55fc){return db[_0xe9db('0x44')][_0xe9db('0x4f')]()[_0xe9db('0x28')](respondWithResult(_0xfc55fc,null))[_0xe9db('0x4a')](handleError(_0xfc55fc,null));};function wrapUser(_0x5ea94c){return function(_0x33c9cd){var _0x4e6749=_0x5ea94c[_0xe9db('0x50')]({'plain':!![]});_0x4e6749[_0xe9db('0x51')]=[];if(_0x33c9cd){_0x4e6749['lastMessageAt']=_0x33c9cd[_0xe9db('0x52')];_0x4e6749[_0xe9db('0x53')]=_0x33c9cd;}else{_0x4e6749['lastMessageAt']=moment(0x0)[_0xe9db('0x54')](_0xe9db('0x55'));_0x4e6749[_0xe9db('0x53')]={};}return _0x4e6749;};}exports[_0xe9db('0x56')]=function(_0x520c59,_0x550e90,_0x240d58){var _0x5dd205=[];return db[_0xe9db('0x57')][_0xe9db('0x47')]({'where':{'role':[_0xe9db('0x58'),_0xe9db('0x59'),_0xe9db('0x5a')]},'attributes':['id',_0xe9db('0x5b'),_0xe9db('0x2b'),_0xe9db('0x5c'),_0xe9db('0x5d'),_0xe9db('0x5e'),_0xe9db('0x5f'),_0xe9db('0x60'),'allowmessenger','showWebBar'],'order':qs['sort'](_0xe9db('0x61')),'include':[{'model':db[_0xe9db('0x62')],'as':_0xe9db('0x63'),'attributes':['id',_0xe9db('0x2b'),'type'],'through':{'attributes':[]}}]})[_0xe9db('0x28')](function(_0x3dec3d){if(_0x3dec3d){var _0x401a0b=_0x520c59[_0xe9db('0x5a')]['get']({'plain':!![]});if(!_0x401a0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x401a0b[_0xe9db('0x5c')]===_0xe9db('0x5a')){return db[_0xe9db('0x64')][_0xe9db('0x49')]({'where':{'name':_0xe9db('0x65'),'userProfileId':_0x401a0b['userProfileId']},'raw':!![]})[_0xe9db('0x28')](function(_0x3c8828){if(_0x3c8828){if(_0x3c8828[_0xe9db('0x66')]===0x0){return db[_0xe9db('0x67')]['findAll']({'where':{'sectionId':_0x3c8828['id']},'raw':!![]})[_0xe9db('0x28')](function(_0x4db750){var _0x3e7446=[];if(_[_0xe9db('0x68')](_0x4db750)){_0x3e7446=_[_0xe9db('0x40')](_0x3dec3d,function(_0x45e9ca){if(_0x45e9ca[_0xe9db('0x5c')]!==_0xe9db('0x58')){return _0x45e9ca;}});return _0x3e7446;}else{for(var _0x5c6c0a=0x0;_0x5c6c0a<_0x3dec3d[_0xe9db('0x3a')];_0x5c6c0a++){var _0x508e9d=_0x3dec3d[_0x5c6c0a];if(_0x508e9d['role']===_0xe9db('0x58')){var _0x351580=_[_0xe9db('0x49')](_0x4db750,function(_0x1288c6){return _0x1288c6[_0xe9db('0x69')]===_0x508e9d['id'];});if(_0x351580)_0x3e7446[_0xe9db('0x6a')](_0x508e9d);}else{_0x3e7446['push'](_0x508e9d);}}return _0x3e7446;}});}else{return _0x3dec3d;}}else{var _0x370467=_[_0xe9db('0x40')](_0x3dec3d,function(_0x156561){if(_0x156561[_0xe9db('0x5c')]!==_0xe9db('0x58')){return _0x156561;}});return _0x370467;}});}else{return _0x3dec3d;}}})['then'](function(_0x17e3a7){var _0x46f7a5=[];if(_0x17e3a7){_0x5dd205=_0x17e3a7;for(var _0x408958=0x0;_0x408958<_0x17e3a7[_0xe9db('0x3a')];_0x408958+=0x1){_0x5dd205[_0x408958][_0xe9db('0x51')]=[];_0x46f7a5[_0xe9db('0x6a')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x520c59[_0xe9db('0x5a')]['id'],_0x17e3a7[_0x408958]['id']],'ToId':[_0x520c59[_0xe9db('0x5a')]['id'],_0x17e3a7[_0x408958]['id']],'ChatGroupId':null},'attributes':['id',_0xe9db('0x52'),_0xe9db('0x6b'),_0xe9db('0x6c'),'read',_0xe9db('0x4c')],'order':qs[_0xe9db('0x3d')](_0xe9db('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe9db('0x28')](wrapUser(_0x17e3a7[_0x408958])));}return BPromise[_0xe9db('0x6e')](_0x46f7a5);}return[];})['then'](function(_0x2703ab){return{'rows':_0x2703ab,'count':_0x2703ab[_0xe9db('0x3a')]};})[_0xe9db('0x28')](respondWithResult(_0x550e90,null))[_0xe9db('0x4a')](handleError(_0x550e90,null));};
\ No newline at end of file
index 45db35e..7ed2867 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc5f=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x40c2b2,_0x91bd6e){var _0x35e372=function(_0x4e03ce){while(--_0x4e03ce){_0x40c2b2['push'](_0x40c2b2['shift']());}};_0x35e372(++_0x91bd6e);}(_0xbc5f,0x120));var _0xfbc5=function(_0x4ef730,_0x1b0eeb){_0x4ef730=_0x4ef730-0x0;var _0x2e24fe=_0xbc5f[_0x4ef730];return _0x2e24fe;};'use strict';var EventEmitter=require(_0xfbc5('0x0'));var ChatInternalMessage=require(_0xfbc5('0x1'))['db'][_0xfbc5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfbc5('0x3')](0x0);var events={'afterCreate':_0xfbc5('0x4'),'afterUpdate':_0xfbc5('0x5'),'afterDestroy':_0xfbc5('0x6')};function emitEvent(_0x2ecc73){return function(_0x1ce74a,_0x3da70a,_0x106a6d){ChatInternalMessageEvents[_0xfbc5('0x7')](_0x2ecc73+':'+_0x1ce74a['id'],_0x1ce74a);ChatInternalMessageEvents['emit'](_0x2ecc73,_0x1ce74a);_0x106a6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xfbc5('0x8')]=ChatInternalMessageEvents;
\ No newline at end of file
+var _0x6271=['ChatInternalMessage','save','update','hook','exports','events','../../mysqldb'];(function(_0x566f63,_0x637556){var _0x4e9fbd=function(_0x4afde7){while(--_0x4afde7){_0x566f63['push'](_0x566f63['shift']());}};_0x4e9fbd(++_0x637556);}(_0x6271,0x10f));var _0x1627=function(_0x3ae2a3,_0x2e629e){_0x3ae2a3=_0x3ae2a3-0x0;var _0x4809dc=_0x6271[_0x3ae2a3];return _0x4809dc;};'use strict';var EventEmitter=require(_0x1627('0x0'));var ChatInternalMessage=require(_0x1627('0x1'))['db'][_0x1627('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1627('0x3'),'afterUpdate':_0x1627('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29af0c){return function(_0x938bee,_0x4bf95e,_0x415bae){ChatInternalMessageEvents['emit'](_0x29af0c+':'+_0x938bee['id'],_0x938bee);ChatInternalMessageEvents['emit'](_0x29af0c,_0x938bee);_0x415bae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x1627('0x5')](e,emitEvent(event));}}module[_0x1627('0x6')]=ChatInternalMessageEvents;
\ No newline at end of file
index 1ae3e42..de786b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e39=['api','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x51b6c4,_0x496a07){var _0x2a563d=function(_0x409288){while(--_0x409288){_0x51b6c4['push'](_0x51b6c4['shift']());}};_0x2a563d(++_0x496a07);}(_0x6e39,0x15e));var _0x96e3=function(_0x45f616,_0x25f951){_0x45f616=_0x45f616-0x0;var _0x52562b=_0x6e39[_0x45f616];return _0x52562b;};'use strict';var _=require('lodash');var util=require(_0x96e3('0x0'));var logger=require(_0x96e3('0x1'))(_0x96e3('0x2'));var moment=require('moment');var BPromise=require(_0x96e3('0x3'));var rp=require(_0x96e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x96e3('0x5'));var attributes=require(_0x96e3('0x6'));module[_0x96e3('0x7')]=function(_0x1fcc3a,_0x61868c){return _0x1fcc3a[_0x96e3('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96e3('0x9'),'collate':_0x96e3('0xa')});};
\ No newline at end of file
+var _0xa59c=['moment','bluebird','request-promise','path','rimraf','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa59c,0x8b));var _0xca59=function(_0x43f2da,_0x33b3c6){_0x43f2da=_0x43f2da-0x0;var _0x3c99f4=_0xa59c[_0x43f2da];return _0x3c99f4;};'use strict';var _=require(_0xca59('0x0'));var util=require(_0xca59('0x1'));var logger=require(_0xca59('0x2'))(_0xca59('0x3'));var moment=require(_0xca59('0x4'));var BPromise=require(_0xca59('0x5'));var rp=require(_0xca59('0x6'));var fs=require('fs');var path=require(_0xca59('0x7'));var rimraf=require(_0xca59('0x8'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xca59('0x9')]=function(_0x882920,_0x36b8ab){return _0x882920['define'](_0xca59('0xa'),attributes,{'tableName':_0xca59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xca59('0xc')});};
\ No newline at end of file
index 4a4395a..52b4444 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8250=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x464493,_0x3ac700){var _0x4f0097=function(_0x1458c8){while(--_0x1458c8){_0x464493['push'](_0x464493['shift']());}};_0x4f0097(++_0x3ac700);}(_0x8250,0xfa));var _0x0825=function(_0x1df170,_0x5b9a15){_0x1df170=_0x1df170-0x0;var _0x38d4df=_0x8250[_0x1df170];return _0x38d4df;};'use strict';var _=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var moment=require(_0x0825('0x2'));var BPromise=require(_0x0825('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0825('0x4'));var db=require(_0x0825('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0825('0x6'))('rpc');var config=require(_0x0825('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0825('0x8')][_0x0825('0x9')]({'port':0x232a});config[_0x0825('0xa')]=_['defaults'](config[_0x0825('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0825('0xb'))(new Redis(config[_0x0825('0xa')]));require(_0x0825('0xc'))[_0x0825('0xd')](socket);function respondWithRpcPromise(_0xf1e504,_0x4adf19,_0x1e627d){return new BPromise(function(_0x5f3a3d,_0x470501){return client[_0x0825('0xe')](_0xf1e504,_0x1e627d)[_0x0825('0xf')](function(_0x5b2821){logger[_0x0825('0x10')](_0x0825('0x11'),_0x4adf19,'request\x20sent');logger[_0x0825('0x12')](_0x0825('0x13'),_0x4adf19,_0x0825('0x14'),JSON[_0x0825('0x15')](_0x5b2821));if(_0x5b2821[_0x0825('0x16')]){if(_0x5b2821[_0x0825('0x16')][_0x0825('0x17')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4adf19,_0x5b2821['error'][_0x0825('0x18')]);return _0x470501(_0x5b2821['error'][_0x0825('0x18')]);}logger[_0x0825('0x16')](_0x0825('0x11'),_0x4adf19,_0x5b2821[_0x0825('0x16')][_0x0825('0x18')]);return _0x5f3a3d(_0x5b2821['error']['message']);}else{logger[_0x0825('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x4adf19,'request\x20sent');_0x5f3a3d(_0x5b2821[_0x0825('0x19')][_0x0825('0x18')]);}})[_0x0825('0x1a')](function(_0xae7b83){logger[_0x0825('0x16')](_0x0825('0x11'),_0x4adf19,_0xae7b83);_0x470501(_0xae7b83);});});}
\ No newline at end of file
+var _0xb905=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb905,0xa7));var _0x5b90=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb905[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5b90('0x0'));var util=require('util');var moment=require(_0x5b90('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b90('0x2'));var fs=require('fs');var Redis=require(_0x5b90('0x3'));var db=require(_0x5b90('0x4'))['db'];var utils=require(_0x5b90('0x5'));var logger=require(_0x5b90('0x6'))(_0x5b90('0x7'));var config=require(_0x5b90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b90('0x9')]['http']({'port':0x232a});config[_0x5b90('0xa')]=_[_0x5b90('0xb')](config['redis'],{'host':_0x5b90('0xc'),'port':0x18eb});var socket=require(_0x5b90('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5b90('0xe')](socket);function respondWithRpcPromise(_0xb237d0,_0x1ff893,_0x2a7532){return new BPromise(function(_0x73a586,_0x22f563){return client[_0x5b90('0xf')](_0xb237d0,_0x2a7532)[_0x5b90('0x10')](function(_0x117c4a){logger[_0x5b90('0x11')](_0x5b90('0x12'),_0x1ff893,_0x5b90('0x13'));logger['debug'](_0x5b90('0x14'),_0x1ff893,_0x5b90('0x13'),JSON[_0x5b90('0x15')](_0x117c4a));if(_0x117c4a[_0x5b90('0x16')]){if(_0x117c4a['error'][_0x5b90('0x17')]===0x1f4){logger[_0x5b90('0x16')](_0x5b90('0x12'),_0x1ff893,_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);return _0x22f563(_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);}logger[_0x5b90('0x16')](_0x5b90('0x12'),_0x1ff893,_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);return _0x73a586(_0x117c4a[_0x5b90('0x16')][_0x5b90('0x18')]);}else{logger[_0x5b90('0x11')](_0x5b90('0x12'),_0x1ff893,'request\x20sent');_0x73a586(_0x117c4a[_0x5b90('0x19')]['message']);}})[_0x5b90('0x1a')](function(_0x57c742){logger[_0x5b90('0x16')](_0x5b90('0x12'),_0x1ff893,_0x57c742);_0x22f563(_0x57c742);});});}
\ No newline at end of file
index e973f69..be35630 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f5e=['chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x4f5e,0xd9));var _0xe4f5=function(_0x2dd885,_0x539fc2){_0x2dd885=_0x2dd885-0x0;var _0x2bbc94=_0x4f5e[_0x2dd885];return _0x2bbc94;};'use strict';var ChatInternalMessageEvents=require(_0xe4f5('0x0'));var events=[_0xe4f5('0x1'),'remove',_0xe4f5('0x2')];function createListener(_0x3aa853,_0x2c3755){return function(_0x26e534){_0x2c3755[_0xe4f5('0x3')](_0x3aa853,_0x26e534);};}function removeListener(_0x493b05,_0x3c9609){return function(){ChatInternalMessageEvents[_0xe4f5('0x4')](_0x493b05,_0x3c9609);};}exports['register']=function(_0x48d85f){for(var _0x1594dc=0x0,_0x3c167c=events['length'];_0x1594dc<_0x3c167c;_0x1594dc++){var _0x8788b6=events[_0x1594dc];var _0x2c1d76=createListener(_0xe4f5('0x5')+_0x8788b6,_0x48d85f);ChatInternalMessageEvents['on'](_0x8788b6,_0x2c1d76);}};
\ No newline at end of file
+var _0xfc4d=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x2af8bd,_0x27dacf){var _0x551c44=function(_0xfc9d5c){while(--_0xfc9d5c){_0x2af8bd['push'](_0x2af8bd['shift']());}};_0x551c44(++_0x27dacf);}(_0xfc4d,0x119));var _0xdfc4=function(_0xd3e16a,_0x28517e){_0xd3e16a=_0xd3e16a-0x0;var _0x449538=_0xfc4d[_0xd3e16a];return _0x449538;};'use strict';var ChatInternalMessageEvents=require(_0xdfc4('0x0'));var events=[_0xdfc4('0x1'),_0xdfc4('0x2'),_0xdfc4('0x3')];function createListener(_0x5c3db2,_0x35c49b){return function(_0xe2a8f3){_0x35c49b[_0xdfc4('0x4')](_0x5c3db2,_0xe2a8f3);};}function removeListener(_0x2dcbaf,_0x2258a0){return function(){ChatInternalMessageEvents[_0xdfc4('0x5')](_0x2dcbaf,_0x2258a0);};}exports[_0xdfc4('0x6')]=function(_0x4fc1e5){for(var _0x2d628b=0x0,_0x3be064=events['length'];_0x2d628b<_0x3be064;_0x2d628b++){var _0x339d24=events[_0x2d628b];var _0x209af7=createListener(_0xdfc4('0x7')+_0x339d24,_0x4fc1e5);ChatInternalMessageEvents['on'](_0x339d24,_0x209af7);}};
\ No newline at end of file
index 5ba8afd..3fc57ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfaa9=['get','isAuthenticated','index','describe','/users','getUsers','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x53ef61,_0x44cda6){var _0x4e4207=function(_0x50af1b){while(--_0x50af1b){_0x53ef61['push'](_0x53ef61['shift']());}};_0x4e4207(++_0x44cda6);}(_0xfaa9,0x177));var _0x9faa=function(_0x20d667,_0x39d534){_0x20d667=_0x20d667-0x0;var _0x5b76cd=_0xfaa9[_0x20d667];return _0x5b76cd;};'use strict';var multer=require('multer');var util=require(_0x9faa('0x0'));var path=require(_0x9faa('0x1'));var timeout=require(_0x9faa('0x2'));var express=require(_0x9faa('0x3'));var router=express['Router']();var fs_extra=require(_0x9faa('0x4'));var auth=require(_0x9faa('0x5'));var interaction=require(_0x9faa('0x6'));var config=require(_0x9faa('0x7'));var controller=require(_0x9faa('0x8'));router[_0x9faa('0x9')]('/',auth[_0x9faa('0xa')](),controller[_0x9faa('0xb')]);router[_0x9faa('0x9')]('/describe',auth[_0x9faa('0xa')](),controller[_0x9faa('0xc')]);router[_0x9faa('0x9')](_0x9faa('0xd'),auth[_0x9faa('0xa')](),controller[_0x9faa('0xe')]);router[_0x9faa('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9faa('0xf')]);router[_0x9faa('0x10')]('/',auth[_0x9faa('0xa')](),controller[_0x9faa('0x11')]);router[_0x9faa('0x12')](_0x9faa('0x13'),controller[_0x9faa('0x14')]);router[_0x9faa('0x15')]('/:id',auth[_0x9faa('0xa')](),controller[_0x9faa('0x16')]);module[_0x9faa('0x17')]=router;
\ No newline at end of file
+var _0x51a2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getUsers','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1374e3,_0x5143cc){var _0x5e29b7=function(_0x460242){while(--_0x460242){_0x1374e3['push'](_0x1374e3['shift']());}};_0x5e29b7(++_0x5143cc);}(_0x51a2,0xd4));var _0x251a=function(_0x2e8874,_0x13cd6c){_0x2e8874=_0x2e8874-0x0;var _0x4ca0cb=_0x51a2[_0x2e8874];return _0x4ca0cb;};'use strict';var multer=require(_0x251a('0x0'));var util=require('util');var path=require(_0x251a('0x1'));var timeout=require(_0x251a('0x2'));var express=require(_0x251a('0x3'));var router=express[_0x251a('0x4')]();var fs_extra=require(_0x251a('0x5'));var auth=require(_0x251a('0x6'));var interaction=require(_0x251a('0x7'));var config=require(_0x251a('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x251a('0x9')]('/',auth[_0x251a('0xa')](),controller[_0x251a('0xb')]);router[_0x251a('0x9')](_0x251a('0xc'),auth[_0x251a('0xa')](),controller[_0x251a('0xd')]);router[_0x251a('0x9')]('/users',auth[_0x251a('0xa')](),controller[_0x251a('0xe')]);router['get']('/:id',auth[_0x251a('0xa')](),controller[_0x251a('0xf')]);router[_0x251a('0x10')]('/',auth[_0x251a('0xa')](),controller[_0x251a('0x11')]);router[_0x251a('0x12')]('/:id',controller[_0x251a('0x13')]);router[_0x251a('0x14')](_0x251a('0x15'),auth['isAuthenticated'](),controller[_0x251a('0x16')]);module[_0x251a('0x17')]=router;
\ No newline at end of file
index 0e75185..689c05a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbdd=['out','TEXT','exports','medium','BOOLEAN'];(function(_0x56770b,_0x3be08a){var _0x1da57a=function(_0x2113a1){while(--_0x2113a1){_0x56770b['push'](_0x56770b['shift']());}};_0x1da57a(++_0x3be08a);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xbbdd[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require('sequelize');module[_0xdbbd('0x0')]={'body':{'type':Sequelize['TEXT'](_0xdbbd('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xdbbd('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdbbd('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdbbd('0x4')]}};
\ No newline at end of file
+var _0x6f2f=['BOOLEAN','out','DATE','STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x6f2f[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require(_0xf6f2('0x0'));module[_0xf6f2('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf6f2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf6f2('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf6f2('0x4')]},'providerName':{'type':Sequelize[_0xf6f2('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 0da5db8..0937274 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68c6=['offset','limit','count','Content-Range','apply','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','body','find','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','email','internal','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json'];(function(_0x2f2ddd,_0x224bd2){var _0x164d8f=function(_0x4213b3){while(--_0x4213b3){_0x2f2ddd['push'](_0x2f2ddd['shift']());}};_0x164d8f(++_0x224bd2);}(_0x68c6,0xe1));var _0x668c=function(_0x5ba46a,_0x582fe0){_0x5ba46a=_0x5ba46a-0x0;var _0x5cbf4f=_0x68c6[_0x5ba46a];return _0x5cbf4f;};'use strict';var emlformat=require(_0x668c('0x0'));var rimraf=require(_0x668c('0x1'));var zipdir=require(_0x668c('0x2'));var jsonpatch=require(_0x668c('0x3'));var rp=require('request-promise');var moment=require(_0x668c('0x4'));var BPromise=require(_0x668c('0x5'));var Mustache=require(_0x668c('0x6'));var util=require('util');var path=require(_0x668c('0x7'));var sox=require(_0x668c('0x8'));var csv=require(_0x668c('0x9'));var ejs=require(_0x668c('0xa'));var fs=require('fs');var fs_extra=require(_0x668c('0xb'));var _=require(_0x668c('0xc'));var squel=require(_0x668c('0xd'));var crypto=require(_0x668c('0xe'));var jsforce=require(_0x668c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x668c('0x9'));var querystring=require(_0x668c('0x10'));var Papa=require('papaparse');var Redis=require(_0x668c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x668c('0x12'));var hardwareService=require(_0x668c('0x13'));var logger=require(_0x668c('0x14'))(_0x668c('0x15'));var utils=require(_0x668c('0x16'));var config=require(_0x668c('0x17'));var licenseUtil=require(_0x668c('0x18'));var db=require(_0x668c('0x19'))['db'];config[_0x668c('0x1a')]=_[_0x668c('0x1b')](config[_0x668c('0x1a')],{'host':_0x668c('0x1c'),'port':0x18eb});var socket=require(_0x668c('0x1d'))(new Redis(config[_0x668c('0x1a')]));require('./chatMessage.socket')[_0x668c('0x1e')](socket);var jayson=require(_0x668c('0x1f'));var client=jayson[_0x668c('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x668c('0x20')][_0x668c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3d30a1,_0x29456b,_0x236fda,_0x153874){return new BPromise(function(_0x4140d9,_0x181b37){var _0x19abad=_0x153874||client;return _0x19abad[_0x668c('0x22')](_0x3d30a1,_0x236fda)[_0x668c('0x23')](function(_0x15df62){logger['info']('ChatMessage,\x20%s,\x20%s',_0x29456b,_0x668c('0x24'));logger[_0x668c('0x25')](_0x668c('0x26'),_0x29456b,_0x668c('0x24'),JSON[_0x668c('0x27')](_0x15df62));if(_0x15df62[_0x668c('0x28')]){if(_0x15df62[_0x668c('0x28')][_0x668c('0x29')]===0x1f4){logger[_0x668c('0x28')]('ChatMessage,\x20%s,\x20%s',_0x29456b,_0x15df62[_0x668c('0x28')][_0x668c('0x2a')]);return _0x181b37(_0x15df62['error']['message']);}logger[_0x668c('0x28')](_0x668c('0x2b'),_0x29456b,_0x15df62[_0x668c('0x28')]['message']);return _0x4140d9(_0x15df62['error'][_0x668c('0x2a')]);}else{logger[_0x668c('0x2c')](_0x668c('0x2b'),_0x29456b,'request\x20sent');_0x4140d9(_0x15df62[_0x668c('0x2d')][_0x668c('0x2a')]);}})[_0x668c('0x2e')](function(_0x2c0f1c){logger['error']('ChatMessage,\x20%s,\x20%s',_0x29456b,_0x2c0f1c);_0x181b37(_0x2c0f1c);});});}function respondWithStatusCode(_0x3917df,_0x5ca4a0){_0x5ca4a0=_0x5ca4a0||0xcc;return function(_0x492767){if(_0x492767){return _0x3917df[_0x668c('0x2f')](_0x5ca4a0);}return _0x3917df[_0x668c('0x30')](_0x5ca4a0)[_0x668c('0x31')]();};}function respondWithResult(_0x3f1b22,_0x2c4527){_0x2c4527=_0x2c4527||0xc8;return function(_0x319013){if(_0x319013){return _0x3f1b22[_0x668c('0x30')](_0x2c4527)[_0x668c('0x32')](_0x319013);}};}function respondWithFilteredResult(_0x3edce8,_0x4ffca1){return function(_0xbaf7d9){if(_0xbaf7d9){var _0x399999=typeof _0x4ffca1[_0x668c('0x33')]==='undefined'&&typeof _0x4ffca1[_0x668c('0x34')]==='undefined';var _0x37f02b=_0xbaf7d9[_0x668c('0x35')];var _0x554f0e=_0x399999?0x0:_0x4ffca1[_0x668c('0x33')];var _0x338f27=_0x399999?_0xbaf7d9['count']:_0x4ffca1[_0x668c('0x33')]+_0x4ffca1[_0x668c('0x34')];var _0x33b0a2;if(_0x338f27>=_0x37f02b){_0x338f27=_0x37f02b;_0x33b0a2=0xc8;}else{_0x33b0a2=0xce;}_0x3edce8[_0x668c('0x30')](_0x33b0a2);return _0x3edce8['set'](_0x668c('0x36'),_0x554f0e+'-'+_0x338f27+'/'+_0x37f02b)['json'](_0xbaf7d9);}return null;};}function patchUpdates(_0x424661){return function(_0x1c540e){try{jsonpatch[_0x668c('0x37')](_0x1c540e,_0x424661,!![]);}catch(_0x1d8366){return BPromise['reject'](_0x1d8366);}return _0x1c540e['save']();};}function saveUpdates(_0x133228,_0x5c3bd7){return function(_0x2285ac){if(_0x2285ac){return _0x2285ac['update'](_0x133228)['then'](function(_0xa08278){return _0xa08278;});}return null;};}function removeEntity(_0x48f9d5,_0xc7e52){return function(_0x4d99f2){if(_0x4d99f2){return _0x4d99f2[_0x668c('0x38')]()[_0x668c('0x23')](function(){_0x48f9d5[_0x668c('0x30')](0xcc)[_0x668c('0x31')]();});}};}function handleEntityNotFound(_0x206030,_0x2ae6e5){return function(_0x102803){if(!_0x102803){_0x206030[_0x668c('0x2f')](0x194);}return _0x102803;};}function handleError(_0xeaa407,_0x220ab7){_0x220ab7=_0x220ab7||0x1f4;return function(_0x25fcd5){logger[_0x668c('0x28')](_0x25fcd5[_0x668c('0x39')]);if(_0x25fcd5[_0x668c('0x3a')]){delete _0x25fcd5[_0x668c('0x3a')];}_0xeaa407[_0x668c('0x30')](_0x220ab7)[_0x668c('0x3b')](_0x25fcd5);};}exports[_0x668c('0x3c')]=function(_0x396345,_0x8f0069){var _0x11a8f1={},_0x1e1f2f={},_0x4a6f68={'count':0x0,'rows':[]};var _0xe9eb4c=_[_0x668c('0x3d')](db[_0x668c('0x3e')][_0x668c('0x3f')],function(_0x3cab06){return{'name':_0x3cab06[_0x668c('0x40')],'type':_0x3cab06[_0x668c('0x41')][_0x668c('0x42')]};});_0x1e1f2f[_0x668c('0x43')]=_[_0x668c('0x3d')](_0xe9eb4c,_0x668c('0x3a'));_0x1e1f2f[_0x668c('0x44')]=_[_0x668c('0x45')](_0x396345[_0x668c('0x44')]);_0x1e1f2f[_0x668c('0x46')]=_['intersection'](_0x1e1f2f[_0x668c('0x43')],_0x1e1f2f['query']);_0x11a8f1[_0x668c('0x47')]=_[_0x668c('0x48')](_0x1e1f2f[_0x668c('0x43')],qs[_0x668c('0x49')](_0x396345[_0x668c('0x44')][_0x668c('0x49')]));_0x11a8f1[_0x668c('0x47')]=_0x11a8f1[_0x668c('0x47')][_0x668c('0x4a')]?_0x11a8f1[_0x668c('0x47')]:_0x1e1f2f[_0x668c('0x43')];if(!_0x396345[_0x668c('0x44')][_0x668c('0x4b')](_0x668c('0x4c'))){_0x11a8f1[_0x668c('0x34')]=qs[_0x668c('0x34')](_0x396345[_0x668c('0x44')]['limit']);_0x11a8f1['offset']=qs[_0x668c('0x33')](_0x396345[_0x668c('0x44')][_0x668c('0x33')]);}_0x11a8f1['order']=qs[_0x668c('0x4d')](_0x396345[_0x668c('0x44')]['sort']);_0x11a8f1[_0x668c('0x4e')]=qs['filters'](_[_0x668c('0x4f')](_0x396345[_0x668c('0x44')],_0x1e1f2f['filters']),_0xe9eb4c);if(_0x396345['query'][_0x668c('0x50')]){_0x11a8f1[_0x668c('0x4e')]=_[_0x668c('0x51')](_0x11a8f1[_0x668c('0x4e')],{'$or':_['map'](_0xe9eb4c,function(_0x417abd){if(_0x417abd[_0x668c('0x41')]!==_0x668c('0x52')){var _0x719b1d={};_0x719b1d[_0x417abd['name']]={'$like':'%'+_0x396345['query'][_0x668c('0x50')]+'%'};return _0x719b1d;}})});}_0x11a8f1=_[_0x668c('0x51')]({},_0x11a8f1,_0x396345[_0x668c('0x53')]);var _0x1e25bb={'where':_0x11a8f1[_0x668c('0x4e')]};return db[_0x668c('0x3e')][_0x668c('0x35')](_0x1e25bb)[_0x668c('0x23')](function(_0xb5ea1){_0x4a6f68['count']=_0xb5ea1;if(_0x396345[_0x668c('0x44')]['includeAll']){_0x11a8f1[_0x668c('0x54')]=[{'all':!![]}];}return db[_0x668c('0x3e')][_0x668c('0x55')](_0x11a8f1);})['then'](function(_0x388d07){_0x4a6f68[_0x668c('0x56')]=_0x388d07;return _0x4a6f68;})[_0x668c('0x23')](respondWithFilteredResult(_0x8f0069,_0x11a8f1))['catch'](handleError(_0x8f0069,null));};exports[_0x668c('0x57')]=function(_0xba002,_0x3bb73d){var _0x2eb23f={'raw':!![],'where':{'id':_0xba002[_0x668c('0x58')]['id']}},_0x3d144b={};_0x3d144b['model']=_[_0x668c('0x45')](db['ChatMessage']['rawAttributes']);_0x3d144b[_0x668c('0x44')]=_[_0x668c('0x45')](_0xba002[_0x668c('0x44')]);_0x3d144b[_0x668c('0x46')]=_[_0x668c('0x48')](_0x3d144b[_0x668c('0x43')],_0x3d144b[_0x668c('0x44')]);_0x2eb23f[_0x668c('0x47')]=_[_0x668c('0x48')](_0x3d144b['model'],qs[_0x668c('0x49')](_0xba002[_0x668c('0x44')]['fields']));_0x2eb23f[_0x668c('0x47')]=_0x2eb23f[_0x668c('0x47')][_0x668c('0x4a')]?_0x2eb23f['attributes']:_0x3d144b[_0x668c('0x43')];if(_0xba002['query'][_0x668c('0x59')]){_0x2eb23f[_0x668c('0x54')]=[{'all':!![]}];}_0x2eb23f=_[_0x668c('0x51')]({},_0x2eb23f,_0xba002['options']);return db[_0x668c('0x3e')]['find'](_0x2eb23f)[_0x668c('0x23')](handleEntityNotFound(_0x3bb73d,null))[_0x668c('0x23')](respondWithResult(_0x3bb73d,null))[_0x668c('0x2e')](handleError(_0x3bb73d,null));};exports[_0x668c('0x5a')]=function(_0xc878dc,_0x1d7ceb){return db[_0x668c('0x3e')]['create'](_0xc878dc['body'],{})['then'](respondWithResult(_0x1d7ceb,0xc9))[_0x668c('0x2e')](handleError(_0x1d7ceb,null));};exports['update']=function(_0xcaed5,_0x4dddef){if(_0xcaed5[_0x668c('0x5b')]['id']){delete _0xcaed5['body']['id'];}return db[_0x668c('0x3e')][_0x668c('0x5c')]({'where':{'id':_0xcaed5['params']['id']}})['then'](handleEntityNotFound(_0x4dddef,null))[_0x668c('0x23')](saveUpdates(_0xcaed5[_0x668c('0x5b')],null))[_0x668c('0x23')](respondWithResult(_0x4dddef,null))[_0x668c('0x2e')](handleError(_0x4dddef,null));};exports[_0x668c('0x38')]=function(_0x21d451,_0x1d1480){return db[_0x668c('0x3e')][_0x668c('0x5c')]({'where':{'id':_0x21d451[_0x668c('0x58')]['id']}})[_0x668c('0x23')](handleEntityNotFound(_0x1d1480,null))[_0x668c('0x23')](removeEntity(_0x1d1480,null))[_0x668c('0x2e')](handleError(_0x1d1480,null));};exports[_0x668c('0x5d')]=function(_0x5b23d2,_0x351e22){return db[_0x668c('0x3e')][_0x668c('0x5d')]()['then'](respondWithResult(_0x351e22,null))[_0x668c('0x2e')](handleError(_0x351e22,null));};var interaction_log=require(_0x668c('0x14'))('chat-interactions');exports['accept']=function(_0x4f0869,_0x492530,_0x8b45b1){var _0x10b6d2={'agent':{},'channel':_0x668c('0x5e')};if(_0x4f0869['body']['id']){delete _0x4f0869[_0x668c('0x5b')]['id'];}_0x4f0869['body'][_0x668c('0x5f')]=!![];_0x4f0869['body'][_0x668c('0x60')]=moment()[_0x668c('0x61')](_0x668c('0x62'));_0x4f0869[_0x668c('0x5b')][_0x668c('0x63')]=_0x4f0869[_0x668c('0x5b')]['UserId']||_0x4f0869[_0x668c('0x64')]['id'];_0x10b6d2['agent']['id']=_0x4f0869['body'][_0x668c('0x63')];return db['ChatMessage']['find']({'where':{'id':_0x4f0869['params']['id'],'UserId':null}})[_0x668c('0x23')](handleEntityNotFound(_0x492530,null))[_0x668c('0x23')](saveUpdates(_0x4f0869[_0x668c('0x5b')],null))[_0x668c('0x23')](function(_0x433171){if(_0x433171){_0x10b6d2['message']=_0x433171['get']({'plain':!![]});return db[_0x668c('0x65')][_0x668c('0x5c')]({'where':{'id':_0x433171[_0x668c('0x66')]}});}return null;})[_0x668c('0x23')](handleEntityNotFound(_0x492530,null))[_0x668c('0x23')](function(_0x285e3d){if(_0x285e3d){return _0x285e3d['update']({'UserId':_0x4f0869[_0x668c('0x5b')][_0x668c('0x63')],'read1stAt':_[_0x668c('0x67')](_0x285e3d[_0x668c('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x668c('0x23')](function(_0x1eb947){if(_0x1eb947){_0x10b6d2[_0x668c('0x69')]=_0x1eb947[_0x668c('0x6a')]({'plain':!![]});interaction_log[_0x668c('0x2c')](_0x668c('0x6b'),_0x4f0869[_0x668c('0x64')]['id'],_0x4f0869[_0x668c('0x64')]['name'],_0x4f0869[_0x668c('0x64')][_0x668c('0x6c')],_0x10b6d2[_0x668c('0x69')]['id'],_0x4f0869['body']?JSON[_0x668c('0x27')](_0x4f0869[_0x668c('0x5b')]):_0x668c('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x668c('0x6e'),_0x10b6d2);}return null;})[_0x668c('0x23')](function(_0x14c238){var _0x1a56fa=_0x668c('0x6f')+_0x14c238[_0x668c('0x2a')][_0x668c('0x70')];return db[_0x668c('0x71')]['query'](_0x1a56fa,{'type':db[_0x668c('0x72')]['QueryTypes'][_0x668c('0x73')],'raw':!![]})['then'](function(_0x3bd20c){return _0x3bd20c;});})[_0x668c('0x23')](function(_0x370c7f){if(_0x370c7f){_0x10b6d2[_0x668c('0x2a')]['contact']=_0x370c7f[0x0];if(!_0x4f0869[_0x668c('0x5b')][_0x668c('0x63')])return;return db[_0x668c('0x74')]['find']({'where':{'id':_0x4f0869[_0x668c('0x5b')][_0x668c('0x63')],'role':_0x668c('0x75')},'attributes':['id',_0x668c('0x3a'),_0x668c('0x76'),'email','internal'],'raw':!![]});}return null;})[_0x668c('0x23')](function(_0x4f1855){if(!_0x4f1855)return null;_0x10b6d2['message'][_0x668c('0x75')]=_0x4f1855;return _0x10b6d2;})['then'](function(_0x21eb27){if(_0x21eb27){if(_0x4f0869[_0x668c('0x5b')][_0x668c('0x77')]){_0x10b6d2[_0x668c('0x2a')][_0x668c('0x78')]=util['format'](_0x668c('0x79'),_0x4f0869[_0x668c('0x64')]['name']);_0x10b6d2[_0x668c('0x2a')][_0x668c('0x7a')]=_0x10b6d2['channel'];_0x10b6d2[_0x668c('0x2a')][_0x668c('0x7b')]=_0x10b6d2['channel'];_0x10b6d2[_0x668c('0x2a')][_0x668c('0x7c')]='accept';return respondWithRpcPromise(_0x668c('0x7d'),_0x668c('0x7d'),{'event':_0x668c('0x7e'),'message':_[_0x668c('0x51')](_0x10b6d2[_0x668c('0x2a')],JSON['parse'](_0x10b6d2[_0x668c('0x69')][_0x668c('0x7f')]))},client9002)[_0x668c('0x23')](function(){return _0x10b6d2;});}return _0x10b6d2;}return null;})[_0x668c('0x23')](respondWithResult(_0x492530,null))[_0x668c('0x2e')](handleError(_0x492530,null));};var interaction_log=require(_0x668c('0x14'))(_0x668c('0x80'));exports[_0x668c('0x81')]=function(_0x2e9d9c,_0x586a28,_0x5b4002){var _0x4a6b72={'agent':{},'channel':'chat'};if(_0x2e9d9c[_0x668c('0x5b')]['id']){delete _0x2e9d9c[_0x668c('0x5b')]['id'];}_0x2e9d9c['body'][_0x668c('0x63')]=_0x2e9d9c[_0x668c('0x5b')][_0x668c('0x63')]||_0x2e9d9c[_0x668c('0x64')]['id'];_0x4a6b72[_0x668c('0x75')]['id']=_0x2e9d9c[_0x668c('0x5b')][_0x668c('0x63')];return db[_0x668c('0x3e')][_0x668c('0x5c')]({'where':{'id':_0x2e9d9c[_0x668c('0x58')]['id'],'UserId':null}})[_0x668c('0x23')](handleEntityNotFound(_0x586a28,null))[_0x668c('0x23')](function(_0x443ef6){if(_0x443ef6){_0x4a6b72['message']=_0x443ef6[_0x668c('0x6a')]({'plain':!![]});return db[_0x668c('0x65')][_0x668c('0x5c')]({'where':{'id':_0x443ef6[_0x668c('0x66')]}});}return null;})[_0x668c('0x23')](handleEntityNotFound(_0x586a28,null))['then'](function(_0x4c1821){if(_0x4c1821){_0x4a6b72[_0x668c('0x69')]=_0x4c1821[_0x668c('0x6a')]({'plain':!![]});interaction_log[_0x668c('0x2c')](_0x668c('0x82'),_0x2e9d9c['user']['id'],_0x2e9d9c[_0x668c('0x64')][_0x668c('0x3a')],_0x2e9d9c[_0x668c('0x64')][_0x668c('0x6c')],_0x4a6b72['interaction']['id'],_0x2e9d9c[_0x668c('0x5b')]?JSON['stringify'](_0x2e9d9c['body']):_0x668c('0x6d'));return respondWithRpcPromise(_0x668c('0x83'),_0x668c('0x84'),_0x4a6b72);}return null;})['then'](function(_0x115c2c){var _0x176d85=_0x668c('0x6f')+_0x115c2c[_0x668c('0x2a')][_0x668c('0x70')];return db[_0x668c('0x71')][_0x668c('0x44')](_0x176d85,{'type':db['Sequelize']['QueryTypes'][_0x668c('0x73')],'raw':!![]})[_0x668c('0x23')](function(_0x4744ff){return _0x4744ff;});})[_0x668c('0x23')](function(_0x428561){if(_0x428561){_0x4a6b72['message'][_0x668c('0x85')]=_0x428561[0x0];if(!_0x2e9d9c[_0x668c('0x5b')][_0x668c('0x63')])return;return db[_0x668c('0x74')][_0x668c('0x5c')]({'where':{'id':_0x2e9d9c['body'][_0x668c('0x63')],'role':_0x668c('0x75')},'attributes':['id',_0x668c('0x3a'),_0x668c('0x76'),_0x668c('0x86'),_0x668c('0x87')],'raw':!![]});}return null;})[_0x668c('0x23')](function(_0x4fa29c){if(!_0x4fa29c)return null;_0x4a6b72[_0x668c('0x2a')][_0x668c('0x75')]=_0x4fa29c;return _0x4a6b72;})[_0x668c('0x23')](function(_0x293f92){if(_0x293f92){_0x293f92[_0x668c('0x2a')][_0x668c('0x78')]=util[_0x668c('0x61')](_0x668c('0x79'),_0x2e9d9c[_0x668c('0x64')][_0x668c('0x3a')]);_0x293f92[_0x668c('0x2a')][_0x668c('0x7a')]=_0x4a6b72[_0x668c('0x7a')];_0x293f92[_0x668c('0x2a')][_0x668c('0x7b')]=_0x4a6b72[_0x668c('0x7a')];_0x293f92['message'][_0x668c('0x7c')]=_0x668c('0x81');respondWithRpcPromise(_0x668c('0x7d'),_0x668c('0x7d'),{'event':_0x668c('0x88'),'message':_[_0x668c('0x51')](_0x4a6b72['message'],JSON[_0x668c('0x89')](_0x4a6b72['interaction'][_0x668c('0x7f')]))},client9002);return _0x4a6b72;}return null;})[_0x668c('0x23')](respondWithResult(_0x586a28,null))[_0x668c('0x2e')](handleError(_0x586a28,null));};
\ No newline at end of file
+var _0x7f77=['parse','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','event','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','merge','where','filter','count','includeAll','include','rows','show','params','keys','options','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','get','ChatInteraction','ChatInteractionId','UserId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage'];(function(_0x202d56,_0x4b78af){var _0x2390cc=function(_0x2536ed){while(--_0x2536ed){_0x202d56['push'](_0x202d56['shift']());}};_0x2390cc(++_0x4b78af);}(_0x7f77,0x10b));var _0x77f7=function(_0xbd451b,_0x20417d){_0xbd451b=_0xbd451b-0x0;var _0xf5dd35=_0x7f77[_0xbd451b];return _0xf5dd35;};'use strict';var emlformat=require(_0x77f7('0x0'));var rimraf=require(_0x77f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77f7('0x2'));var rp=require(_0x77f7('0x3'));var moment=require(_0x77f7('0x4'));var BPromise=require(_0x77f7('0x5'));var Mustache=require(_0x77f7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x77f7('0x7'));var csv=require('to-csv');var ejs=require(_0x77f7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77f7('0x9'));var squel=require(_0x77f7('0xa'));var crypto=require('crypto');var jsforce=require(_0x77f7('0xb'));var deskjs=require(_0x77f7('0xc'));var toCsv=require(_0x77f7('0xd'));var querystring=require(_0x77f7('0xe'));var Papa=require(_0x77f7('0xf'));var Redis=require('ioredis');var authService=require(_0x77f7('0x10'));var qs=require(_0x77f7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77f7('0x12'))(_0x77f7('0x13'));var utils=require(_0x77f7('0x14'));var config=require(_0x77f7('0x15'));var licenseUtil=require(_0x77f7('0x16'));var db=require(_0x77f7('0x17'))['db'];config[_0x77f7('0x18')]=_[_0x77f7('0x19')](config['redis'],{'host':_0x77f7('0x1a'),'port':0x18eb});var socket=require(_0x77f7('0x1b'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x77f7('0x1c')](socket);var jayson=require(_0x77f7('0x1d'));var client=jayson['client'][_0x77f7('0x1e')]({'port':0x232c});var client9002=jayson[_0x77f7('0x1f')][_0x77f7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1948e2,_0x4821c1,_0x3e242b,_0xed96b5){return new BPromise(function(_0x4e31c1,_0x270b90){var _0x9d82e8=_0xed96b5||client;return _0x9d82e8[_0x77f7('0x20')](_0x1948e2,_0x3e242b)[_0x77f7('0x21')](function(_0x8a74e){logger[_0x77f7('0x22')]('ChatMessage,\x20%s,\x20%s',_0x4821c1,_0x77f7('0x23'));logger[_0x77f7('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4821c1,_0x77f7('0x23'),JSON[_0x77f7('0x25')](_0x8a74e));if(_0x8a74e['error']){if(_0x8a74e[_0x77f7('0x26')]['code']===0x1f4){logger[_0x77f7('0x26')](_0x77f7('0x27'),_0x4821c1,_0x8a74e[_0x77f7('0x26')][_0x77f7('0x28')]);return _0x270b90(_0x8a74e[_0x77f7('0x26')][_0x77f7('0x28')]);}logger[_0x77f7('0x26')](_0x77f7('0x27'),_0x4821c1,_0x8a74e[_0x77f7('0x26')][_0x77f7('0x28')]);return _0x4e31c1(_0x8a74e[_0x77f7('0x26')][_0x77f7('0x28')]);}else{logger[_0x77f7('0x22')]('ChatMessage,\x20%s,\x20%s',_0x4821c1,_0x77f7('0x23'));_0x4e31c1(_0x8a74e[_0x77f7('0x29')][_0x77f7('0x28')]);}})[_0x77f7('0x2a')](function(_0x534834){logger[_0x77f7('0x26')](_0x77f7('0x27'),_0x4821c1,_0x534834);_0x270b90(_0x534834);});});}function respondWithStatusCode(_0x5ccb87,_0x396a32){_0x396a32=_0x396a32||0xcc;return function(_0x1c42d3){if(_0x1c42d3){return _0x5ccb87[_0x77f7('0x2b')](_0x396a32);}return _0x5ccb87[_0x77f7('0x2c')](_0x396a32)['end']();};}function respondWithResult(_0xd020ea,_0x1a417b){_0x1a417b=_0x1a417b||0xc8;return function(_0x51ca5e){if(_0x51ca5e){return _0xd020ea[_0x77f7('0x2c')](_0x1a417b)[_0x77f7('0x2d')](_0x51ca5e);}};}function respondWithFilteredResult(_0x48bb98,_0x1b3f05){return function(_0x311b38){if(_0x311b38){var _0x43993d=typeof _0x1b3f05[_0x77f7('0x2e')]===_0x77f7('0x2f')&&typeof _0x1b3f05[_0x77f7('0x30')]===_0x77f7('0x2f');var _0x1da22c=_0x311b38['count'];var _0x5eafae=_0x43993d?0x0:_0x1b3f05[_0x77f7('0x2e')];var _0x4c32cd=_0x43993d?_0x311b38['count']:_0x1b3f05[_0x77f7('0x2e')]+_0x1b3f05[_0x77f7('0x30')];var _0x2fe3b3;if(_0x4c32cd>=_0x1da22c){_0x4c32cd=_0x1da22c;_0x2fe3b3=0xc8;}else{_0x2fe3b3=0xce;}_0x48bb98[_0x77f7('0x2c')](_0x2fe3b3);return _0x48bb98['set'](_0x77f7('0x31'),_0x5eafae+'-'+_0x4c32cd+'/'+_0x1da22c)[_0x77f7('0x2d')](_0x311b38);}return null;};}function patchUpdates(_0x684810){return function(_0x36f3d0){try{jsonpatch[_0x77f7('0x32')](_0x36f3d0,_0x684810,!![]);}catch(_0x50e74f){return BPromise[_0x77f7('0x33')](_0x50e74f);}return _0x36f3d0['save']();};}function saveUpdates(_0x31585d,_0x37de12){return function(_0x23b785){if(_0x23b785){return _0x23b785[_0x77f7('0x34')](_0x31585d)[_0x77f7('0x21')](function(_0x2cfd07){return _0x2cfd07;});}return null;};}function removeEntity(_0x35f3d9,_0x3bb0b5){return function(_0x40d9d7){if(_0x40d9d7){return _0x40d9d7[_0x77f7('0x35')]()[_0x77f7('0x21')](function(){_0x35f3d9[_0x77f7('0x2c')](0xcc)[_0x77f7('0x36')]();});}};}function handleEntityNotFound(_0x4d8394,_0x54093f){return function(_0x4e256c){if(!_0x4e256c){_0x4d8394[_0x77f7('0x2b')](0x194);}return _0x4e256c;};}function handleError(_0x12f1e0,_0x2dd014){_0x2dd014=_0x2dd014||0x1f4;return function(_0x440291){logger[_0x77f7('0x26')](_0x440291[_0x77f7('0x37')]);if(_0x440291[_0x77f7('0x38')]){delete _0x440291['name'];}_0x12f1e0[_0x77f7('0x2c')](_0x2dd014)[_0x77f7('0x39')](_0x440291);};}exports[_0x77f7('0x3a')]=function(_0x3bc8c9,_0x15ae6d){var _0x266105={},_0x59072f={},_0x2ff3ad={'count':0x0,'rows':[]};var _0x9d2ec9=_['map'](db[_0x77f7('0x3b')][_0x77f7('0x3c')],function(_0x6253fe){return{'name':_0x6253fe[_0x77f7('0x3d')],'type':_0x6253fe[_0x77f7('0x3e')]['key']};});_0x59072f[_0x77f7('0x3f')]=_[_0x77f7('0x40')](_0x9d2ec9,_0x77f7('0x38'));_0x59072f[_0x77f7('0x41')]=_['keys'](_0x3bc8c9[_0x77f7('0x41')]);_0x59072f[_0x77f7('0x42')]=_[_0x77f7('0x43')](_0x59072f[_0x77f7('0x3f')],_0x59072f[_0x77f7('0x41')]);_0x266105['attributes']=_['intersection'](_0x59072f[_0x77f7('0x3f')],qs['fields'](_0x3bc8c9['query'][_0x77f7('0x44')]));_0x266105[_0x77f7('0x45')]=_0x266105[_0x77f7('0x45')]['length']?_0x266105[_0x77f7('0x45')]:_0x59072f[_0x77f7('0x3f')];if(!_0x3bc8c9[_0x77f7('0x41')]['hasOwnProperty'](_0x77f7('0x46'))){_0x266105[_0x77f7('0x30')]=qs[_0x77f7('0x30')](_0x3bc8c9['query']['limit']);_0x266105[_0x77f7('0x2e')]=qs[_0x77f7('0x2e')](_0x3bc8c9[_0x77f7('0x41')][_0x77f7('0x2e')]);}_0x266105[_0x77f7('0x47')]=qs[_0x77f7('0x48')](_0x3bc8c9['query']['sort']);_0x266105['where']=qs[_0x77f7('0x42')](_[_0x77f7('0x49')](_0x3bc8c9[_0x77f7('0x41')],_0x59072f[_0x77f7('0x42')]),_0x9d2ec9);if(_0x3bc8c9[_0x77f7('0x41')]['filter']){_0x266105['where']=_[_0x77f7('0x4a')](_0x266105[_0x77f7('0x4b')],{'$or':_['map'](_0x9d2ec9,function(_0x59cb84){if(_0x59cb84[_0x77f7('0x3e')]!=='VIRTUAL'){var _0x1e565b={};_0x1e565b[_0x59cb84[_0x77f7('0x38')]]={'$like':'%'+_0x3bc8c9['query'][_0x77f7('0x4c')]+'%'};return _0x1e565b;}})});}_0x266105=_[_0x77f7('0x4a')]({},_0x266105,_0x3bc8c9['options']);var _0xee2648={'where':_0x266105['where']};return db[_0x77f7('0x3b')][_0x77f7('0x4d')](_0xee2648)['then'](function(_0x463d92){_0x2ff3ad[_0x77f7('0x4d')]=_0x463d92;if(_0x3bc8c9[_0x77f7('0x41')][_0x77f7('0x4e')]){_0x266105[_0x77f7('0x4f')]=[{'all':!![]}];}return db[_0x77f7('0x3b')]['findAll'](_0x266105);})[_0x77f7('0x21')](function(_0x395c1c){_0x2ff3ad[_0x77f7('0x50')]=_0x395c1c;return _0x2ff3ad;})[_0x77f7('0x21')](respondWithFilteredResult(_0x15ae6d,_0x266105))[_0x77f7('0x2a')](handleError(_0x15ae6d,null));};exports[_0x77f7('0x51')]=function(_0x3e794f,_0xcb7e68){var _0x166da7={'raw':!![],'where':{'id':_0x3e794f[_0x77f7('0x52')]['id']}},_0x1d74da={};_0x1d74da[_0x77f7('0x3f')]=_[_0x77f7('0x53')](db[_0x77f7('0x3b')][_0x77f7('0x3c')]);_0x1d74da[_0x77f7('0x41')]=_[_0x77f7('0x53')](_0x3e794f['query']);_0x1d74da[_0x77f7('0x42')]=_['intersection'](_0x1d74da[_0x77f7('0x3f')],_0x1d74da[_0x77f7('0x41')]);_0x166da7[_0x77f7('0x45')]=_['intersection'](_0x1d74da[_0x77f7('0x3f')],qs[_0x77f7('0x44')](_0x3e794f[_0x77f7('0x41')][_0x77f7('0x44')]));_0x166da7[_0x77f7('0x45')]=_0x166da7['attributes']['length']?_0x166da7[_0x77f7('0x45')]:_0x1d74da['model'];if(_0x3e794f[_0x77f7('0x41')][_0x77f7('0x4e')]){_0x166da7['include']=[{'all':!![]}];}_0x166da7=_['merge']({},_0x166da7,_0x3e794f[_0x77f7('0x54')]);return db[_0x77f7('0x3b')][_0x77f7('0x55')](_0x166da7)[_0x77f7('0x21')](handleEntityNotFound(_0xcb7e68,null))[_0x77f7('0x21')](respondWithResult(_0xcb7e68,null))['catch'](handleError(_0xcb7e68,null));};exports[_0x77f7('0x56')]=function(_0x5b0dc0,_0x4c3b50){return db[_0x77f7('0x3b')][_0x77f7('0x56')](_0x5b0dc0[_0x77f7('0x57')],{})['then'](respondWithResult(_0x4c3b50,0xc9))['catch'](handleError(_0x4c3b50,null));};exports['update']=function(_0x44165b,_0x918739){if(_0x44165b['body']['id']){delete _0x44165b[_0x77f7('0x57')]['id'];}return db[_0x77f7('0x3b')][_0x77f7('0x55')]({'where':{'id':_0x44165b[_0x77f7('0x52')]['id']}})[_0x77f7('0x21')](handleEntityNotFound(_0x918739,null))['then'](saveUpdates(_0x44165b['body'],null))[_0x77f7('0x21')](respondWithResult(_0x918739,null))[_0x77f7('0x2a')](handleError(_0x918739,null));};exports[_0x77f7('0x35')]=function(_0x71b033,_0x13be20){return db[_0x77f7('0x3b')][_0x77f7('0x55')]({'where':{'id':_0x71b033[_0x77f7('0x52')]['id']}})['then'](handleEntityNotFound(_0x13be20,null))['then'](removeEntity(_0x13be20,null))['catch'](handleError(_0x13be20,null));};exports[_0x77f7('0x58')]=function(_0x3ff771,_0x1a561d){return db[_0x77f7('0x3b')]['describe']()[_0x77f7('0x21')](respondWithResult(_0x1a561d,null))['catch'](handleError(_0x1a561d,null));};var interaction_log=require(_0x77f7('0x12'))('chat-interactions');exports[_0x77f7('0x59')]=function(_0x1d20c9,_0x5346be,_0x5ea95f){var _0x4c4f48={'agent':{},'channel':'chat'};if(_0x1d20c9['body']['id']){delete _0x1d20c9[_0x77f7('0x57')]['id'];}_0x1d20c9[_0x77f7('0x57')][_0x77f7('0x5a')]=!![];_0x1d20c9[_0x77f7('0x57')][_0x77f7('0x5b')]=moment()[_0x77f7('0x5c')](_0x77f7('0x5d'));_0x1d20c9['body']['UserId']=_0x1d20c9[_0x77f7('0x57')]['UserId']||_0x1d20c9[_0x77f7('0x5e')]['id'];_0x4c4f48[_0x77f7('0x5f')]['id']=_0x1d20c9[_0x77f7('0x57')]['UserId'];return db[_0x77f7('0x3b')]['find']({'where':{'id':_0x1d20c9['params']['id'],'UserId':null}})[_0x77f7('0x21')](handleEntityNotFound(_0x5346be,null))[_0x77f7('0x21')](saveUpdates(_0x1d20c9[_0x77f7('0x57')],null))[_0x77f7('0x21')](function(_0x344843){if(_0x344843){_0x4c4f48[_0x77f7('0x28')]=_0x344843[_0x77f7('0x60')]({'plain':!![]});return db[_0x77f7('0x61')]['find']({'where':{'id':_0x344843[_0x77f7('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x5346be,null))['then'](function(_0x321921){if(_0x321921){return _0x321921[_0x77f7('0x34')]({'UserId':_0x1d20c9[_0x77f7('0x57')][_0x77f7('0x63')],'read1stAt':_[_0x77f7('0x64')](_0x321921[_0x77f7('0x65')])?moment()['format'](_0x77f7('0x5d')):undefined});}return null;})[_0x77f7('0x21')](function(_0x4a42cb){if(_0x4a42cb){_0x4c4f48[_0x77f7('0x66')]=_0x4a42cb[_0x77f7('0x60')]({'plain':!![]});interaction_log[_0x77f7('0x22')](_0x77f7('0x67'),_0x1d20c9[_0x77f7('0x5e')]['id'],_0x1d20c9[_0x77f7('0x5e')][_0x77f7('0x38')],_0x1d20c9[_0x77f7('0x5e')][_0x77f7('0x68')],_0x4c4f48[_0x77f7('0x66')]['id'],_0x1d20c9[_0x77f7('0x57')]?JSON['stringify'](_0x1d20c9[_0x77f7('0x57')]):_0x77f7('0x69'));return respondWithRpcPromise(_0x77f7('0x6a'),_0x77f7('0x6b'),_0x4c4f48);}return null;})[_0x77f7('0x21')](function(_0x48b4f7){var _0x2c0b02=_0x77f7('0x6c')+_0x48b4f7['message'][_0x77f7('0x6d')];return db['sequelize'][_0x77f7('0x41')](_0x2c0b02,{'type':db[_0x77f7('0x6e')][_0x77f7('0x6f')][_0x77f7('0x70')],'raw':!![]})[_0x77f7('0x21')](function(_0x23a5df){return _0x23a5df;});})['then'](function(_0x23ca77){if(_0x23ca77){_0x4c4f48[_0x77f7('0x28')][_0x77f7('0x71')]=_0x23ca77[0x0];if(!_0x1d20c9[_0x77f7('0x57')]['UserId'])return;return db[_0x77f7('0x72')][_0x77f7('0x55')]({'where':{'id':_0x1d20c9[_0x77f7('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0x77f7('0x38'),_0x77f7('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x77f7('0x21')](function(_0x3f8a6c){if(!_0x3f8a6c)return null;_0x4c4f48[_0x77f7('0x28')][_0x77f7('0x5f')]=_0x3f8a6c;return _0x4c4f48;})[_0x77f7('0x21')](function(_0x37383f){if(_0x37383f){if(_0x1d20c9[_0x77f7('0x57')][_0x77f7('0x74')]){_0x4c4f48[_0x77f7('0x28')][_0x77f7('0x75')]=util[_0x77f7('0x5c')](_0x77f7('0x76'),_0x1d20c9[_0x77f7('0x5e')]['name']);_0x4c4f48[_0x77f7('0x28')][_0x77f7('0x77')]=_0x4c4f48[_0x77f7('0x77')];_0x4c4f48['message'][_0x77f7('0x78')]=_0x4c4f48[_0x77f7('0x77')];_0x4c4f48['message']['event']=_0x77f7('0x59');return respondWithRpcPromise(_0x77f7('0x79'),_0x77f7('0x79'),{'event':_0x77f7('0x7a'),'message':_[_0x77f7('0x4a')](_0x4c4f48['message'],JSON[_0x77f7('0x7b')](_0x4c4f48[_0x77f7('0x66')][_0x77f7('0x7c')]))},client9002)[_0x77f7('0x21')](function(){return _0x4c4f48;});}return _0x4c4f48;}return null;})[_0x77f7('0x21')](respondWithResult(_0x5346be,null))[_0x77f7('0x2a')](handleError(_0x5346be,null));};var interaction_log=require(_0x77f7('0x12'))(_0x77f7('0x7d'));exports['reject']=function(_0x16ad06,_0x4a92da,_0x78bccf){var _0x9998f5={'agent':{},'channel':_0x77f7('0x7e')};if(_0x16ad06[_0x77f7('0x57')]['id']){delete _0x16ad06[_0x77f7('0x57')]['id'];}_0x16ad06[_0x77f7('0x57')][_0x77f7('0x63')]=_0x16ad06[_0x77f7('0x57')][_0x77f7('0x63')]||_0x16ad06[_0x77f7('0x5e')]['id'];_0x9998f5[_0x77f7('0x5f')]['id']=_0x16ad06['body']['UserId'];return db[_0x77f7('0x3b')][_0x77f7('0x55')]({'where':{'id':_0x16ad06[_0x77f7('0x52')]['id'],'UserId':null}})[_0x77f7('0x21')](handleEntityNotFound(_0x4a92da,null))[_0x77f7('0x21')](function(_0x52a2ca){if(_0x52a2ca){_0x9998f5[_0x77f7('0x28')]=_0x52a2ca[_0x77f7('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x77f7('0x55')]({'where':{'id':_0x52a2ca[_0x77f7('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x4a92da,null))['then'](function(_0x29ee6a){if(_0x29ee6a){_0x9998f5['interaction']=_0x29ee6a['get']({'plain':!![]});interaction_log[_0x77f7('0x22')](_0x77f7('0x7f'),_0x16ad06[_0x77f7('0x5e')]['id'],_0x16ad06[_0x77f7('0x5e')][_0x77f7('0x38')],_0x16ad06[_0x77f7('0x5e')][_0x77f7('0x68')],_0x9998f5[_0x77f7('0x66')]['id'],_0x16ad06[_0x77f7('0x57')]?JSON[_0x77f7('0x25')](_0x16ad06['body']):_0x77f7('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x9998f5);}return null;})['then'](function(_0x3a89df){var _0xb6b6a3=_0x77f7('0x6c')+_0x3a89df[_0x77f7('0x28')]['ContactId'];return db[_0x77f7('0x80')]['query'](_0xb6b6a3,{'type':db[_0x77f7('0x6e')][_0x77f7('0x6f')]['SELECT'],'raw':!![]})[_0x77f7('0x21')](function(_0x7b76ed){return _0x7b76ed;});})[_0x77f7('0x21')](function(_0xd1b30f){if(_0xd1b30f){_0x9998f5['message']['contact']=_0xd1b30f[0x0];if(!_0x16ad06[_0x77f7('0x57')][_0x77f7('0x63')])return;return db[_0x77f7('0x72')]['find']({'where':{'id':_0x16ad06[_0x77f7('0x57')]['UserId'],'role':_0x77f7('0x5f')},'attributes':['id',_0x77f7('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x3eee33){if(!_0x3eee33)return null;_0x9998f5[_0x77f7('0x28')][_0x77f7('0x5f')]=_0x3eee33;return _0x9998f5;})[_0x77f7('0x21')](function(_0x866153){if(_0x866153){_0x866153[_0x77f7('0x28')][_0x77f7('0x75')]=util[_0x77f7('0x5c')](_0x77f7('0x76'),_0x16ad06['user'][_0x77f7('0x38')]);_0x866153[_0x77f7('0x28')]['channel']=_0x9998f5[_0x77f7('0x77')];_0x866153['message'][_0x77f7('0x78')]=_0x9998f5[_0x77f7('0x77')];_0x866153[_0x77f7('0x28')][_0x77f7('0x81')]='reject';respondWithRpcPromise(_0x77f7('0x79'),_0x77f7('0x79'),{'event':'rejectmessage','message':_['merge'](_0x9998f5[_0x77f7('0x28')],JSON[_0x77f7('0x7b')](_0x9998f5[_0x77f7('0x66')][_0x77f7('0x7c')]))},client9002);return _0x9998f5;}return null;})[_0x77f7('0x21')](respondWithResult(_0x4a92da,null))[_0x77f7('0x2a')](handleError(_0x4a92da,null));};
\ No newline at end of file
index 968e7fb..305fdbd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7dee=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatMessage','save'];(function(_0x16e747,_0x26f24a){var _0x497a4a=function(_0x2ed2b0){while(--_0x2ed2b0){_0x16e747['push'](_0x16e747['shift']());}};_0x497a4a(++_0x26f24a);}(_0x7dee,0xd5));var _0xe7de=function(_0x39dee4,_0x5349c1){_0x39dee4=_0x39dee4-0x0;var _0x574dd3=_0x7dee[_0x39dee4];return _0x574dd3;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xe7de('0x0'))['db'][_0xe7de('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7de('0x2'),'afterUpdate':_0xe7de('0x3'),'afterDestroy':_0xe7de('0x4')};function emitEvent(_0x3685f9){return function(_0x223d73,_0x206a8f,_0x53117d){ChatMessageEvents['emit'](_0x3685f9+':'+_0x223d73['id'],_0x223d73);ChatMessageEvents[_0xe7de('0x5')](_0x3685f9,_0x223d73);_0x53117d(null);};}for(var e in events){if(events[_0xe7de('0x6')](e)){var event=events[e];ChatMessage[_0xe7de('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents;
\ No newline at end of file
+var _0x30c8=['hasOwnProperty','events','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x36b081,_0x2be9d1){var _0x5d31b1=function(_0x14308d){while(--_0x14308d){_0x36b081['push'](_0x36b081['shift']());}};_0x5d31b1(++_0x2be9d1);}(_0x30c8,0xc9));var _0x830c=function(_0x20ebbd,_0x1178ae){_0x20ebbd=_0x20ebbd-0x0;var _0x1e1d6f=_0x30c8[_0x20ebbd];return _0x1e1d6f;};'use strict';var EventEmitter=require(_0x830c('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x830c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x830c('0x2')](0x0);var events={'afterCreate':_0x830c('0x3'),'afterUpdate':_0x830c('0x4'),'afterDestroy':_0x830c('0x5')};function emitEvent(_0x3cd6bf){return function(_0x4436e4,_0x1bda1c,_0x128c0b){ChatMessageEvents[_0x830c('0x6')](_0x3cd6bf+':'+_0x4436e4['id'],_0x4436e4);ChatMessageEvents[_0x830c('0x6')](_0x3cd6bf,_0x4436e4);_0x128c0b(null);};}for(var e in events){if(events[_0x830c('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents;
\ No newline at end of file
index bafbb88..c982971 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c55=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4'];(function(_0x13bd5f,_0x196142){var _0x401983=function(_0xe87766){while(--_0xe87766){_0x13bd5f['push'](_0x13bd5f['shift']());}};_0x401983(++_0x196142);}(_0x9c55,0x156));var _0x59c5=function(_0x2ec5b9,_0x56e0a3){_0x2ec5b9=_0x2ec5b9-0x0;var _0x10dcea=_0x9c55[_0x2ec5b9];return _0x10dcea;};'use strict';var _=require(_0x59c5('0x0'));var util=require('util');var logger=require(_0x59c5('0x1'))(_0x59c5('0x2'));var moment=require(_0x59c5('0x3'));var BPromise=require(_0x59c5('0x4'));var rp=require(_0x59c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59c5('0x6'));var config=require(_0x59c5('0x7'));var attributes=require(_0x59c5('0x8'));module['exports']=function(_0x5458a9,_0x1f1070){return _0x5458a9[_0x59c5('0x9')](_0x59c5('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x59c5('0xb'),'fields':[_0x59c5('0xc')],'type':_0x59c5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36f3ca,_0x470ffe,_0x4430ce){var _0x1f872c=_0x5458a9['models'];var _0x18ee1c=_0x36f3ca[_0x59c5('0xe')]({'plain':!![]});if(_0x18ee1c[_0x59c5('0xf')]['toLowerCase']()==='in'||_0x18ee1c[_0x59c5('0xf')][_0x59c5('0x10')]()===_0x59c5('0x11')&&!_0x18ee1c[_0x59c5('0x12')]&&!_[_0x59c5('0x13')](_0x18ee1c[_0x59c5('0x14')])){_0x1f872c[_0x59c5('0x15')][_0x59c5('0x16')]({'where':{'id':_0x18ee1c[_0x59c5('0x17')]}})[_0x59c5('0x18')](function(_0x350d2c){if(_0x350d2c){_0x350d2c[_0x59c5('0x19')]({'lastMsgAt':_0x18ee1c[_0x59c5('0x1a')],'lastMsgDirection':_0x18ee1c[_0x59c5('0xf')][_0x59c5('0x10')]()});}})[_0x59c5('0x1b')](function(_0x45aea3){console[_0x59c5('0x1c')](_0x45aea3);});}_0x4430ce();}},'charset':_0x59c5('0x1d'),'collate':_0x59c5('0x1e')});};
\ No newline at end of file
+var _0x518b=['findOne','then','update','direction','catch','error','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','models','get','toLowerCase','secret','isNil','UserId','ChatInteraction'];(function(_0x1427ce,_0x463119){var _0x349e10=function(_0x239913){while(--_0x239913){_0x1427ce['push'](_0x1427ce['shift']());}};_0x349e10(++_0x463119);}(_0x518b,0x6e));var _0xb518=function(_0x1b4695,_0x3a90e3){_0x1b4695=_0x1b4695-0x0;var _0x376a90=_0x518b[_0x1b4695];return _0x376a90;};'use strict';var _=require(_0xb518('0x0'));var util=require(_0xb518('0x1'));var logger=require(_0xb518('0x2'))(_0xb518('0x3'));var moment=require('moment');var BPromise=require(_0xb518('0x4'));var rp=require(_0xb518('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb518('0x6'));var config=require('../../config/environment');var attributes=require(_0xb518('0x7'));module[_0xb518('0x8')]=function(_0x568331,_0x3f0f04){return _0x568331['define'](_0xb518('0x9'),attributes,{'tableName':_0xb518('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xb518('0xb')],'type':_0xb518('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x201739,_0x23f0ba,_0x1f36c8){var _0x380a5c=_0x568331[_0xb518('0xd')];var _0x4da300=_0x201739[_0xb518('0xe')]({'plain':!![]});if(_0x4da300['direction'][_0xb518('0xf')]()==='in'||_0x4da300['direction'][_0xb518('0xf')]()==='out'&&!_0x4da300[_0xb518('0x10')]&&!_[_0xb518('0x11')](_0x4da300[_0xb518('0x12')])){_0x380a5c[_0xb518('0x13')][_0xb518('0x14')]({'where':{'id':_0x4da300['ChatInteractionId']}})[_0xb518('0x15')](function(_0x5e84b0){if(_0x5e84b0){_0x5e84b0[_0xb518('0x16')]({'lastMsgAt':_0x4da300['createdAt'],'lastMsgDirection':_0x4da300[_0xb518('0x17')][_0xb518('0xf')]()});}})[_0xb518('0x18')](function(_0x10ca6d){console[_0xb518('0x19')](_0x10ca6d);});}_0x1f36c8();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index ff10f07..bcd068d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d14=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x8d14,0x1a7));var _0x48d1=function(_0x29e755,_0x11a6bf){_0x29e755=_0x29e755-0x0;var _0x51f16e=_0x8d14[_0x29e755];return _0x51f16e;};'use strict';var _=require(_0x48d1('0x0'));var util=require('util');var moment=require(_0x48d1('0x1'));var BPromise=require(_0x48d1('0x2'));var rs=require(_0x48d1('0x3'));var fs=require('fs');var Redis=require(_0x48d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x48d1('0x5'));var config=require(_0x48d1('0x6'));var jayson=require(_0x48d1('0x7'));var client=jayson[_0x48d1('0x8')][_0x48d1('0x9')]({'port':0x232a});config[_0x48d1('0xa')]=_[_0x48d1('0xb')](config['redis'],{'host':_0x48d1('0xc'),'port':0x18eb});var socket=require(_0x48d1('0xd'))(new Redis(config[_0x48d1('0xa')]));require('./chatMessage.socket')[_0x48d1('0xe')](socket);function respondWithRpcPromise(_0x5a8a97,_0x14fee3,_0x214a3f){return new BPromise(function(_0x4ef105,_0x98612f){return client[_0x48d1('0xf')](_0x5a8a97,_0x214a3f)[_0x48d1('0x10')](function(_0x1c0619){logger[_0x48d1('0x11')](_0x48d1('0x12'),_0x14fee3,'request\x20sent');logger[_0x48d1('0x13')](_0x48d1('0x14'),_0x14fee3,_0x48d1('0x15'),JSON[_0x48d1('0x16')](_0x1c0619));if(_0x1c0619[_0x48d1('0x17')]){if(_0x1c0619[_0x48d1('0x17')][_0x48d1('0x18')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x14fee3,_0x1c0619[_0x48d1('0x17')][_0x48d1('0x19')]);return _0x98612f(_0x1c0619[_0x48d1('0x17')]['message']);}logger[_0x48d1('0x17')](_0x48d1('0x12'),_0x14fee3,_0x1c0619[_0x48d1('0x17')][_0x48d1('0x19')]);return _0x4ef105(_0x1c0619['error'][_0x48d1('0x19')]);}else{logger['info'](_0x48d1('0x12'),_0x14fee3,_0x48d1('0x15'));_0x4ef105(_0x1c0619[_0x48d1('0x1a')][_0x48d1('0x19')]);}})[_0x48d1('0x1b')](function(_0x1036fc){logger[_0x48d1('0x17')](_0x48d1('0x12'),_0x14fee3,_0x1036fc);_0x98612f(_0x1036fc);});});}exports[_0x48d1('0x1c')]=function(_0x3554ae){var _0x43b0e7=this;return new Promise(function(_0x5c70,_0xcc7b){return db[_0x48d1('0x1d')][_0x48d1('0x1e')](_0x3554ae[_0x48d1('0x1f')],{'raw':_0x3554ae[_0x48d1('0x20')]?_0x3554ae[_0x48d1('0x20')][_0x48d1('0x21')]===undefined?!![]:![]:!![]})[_0x48d1('0x10')](function(_0x5cb7de){logger[_0x48d1('0x11')](_0x48d1('0x1c'),_0x3554ae);logger[_0x48d1('0x13')](_0x48d1('0x1c'),_0x3554ae,JSON[_0x48d1('0x16')](_0x5cb7de));_0x5c70(_0x5cb7de);})[_0x48d1('0x1b')](function(_0x4a3209){logger['error'](_0x48d1('0x1c'),_0x4a3209['message'],_0x3554ae);_0xcc7b(_0x43b0e7[_0x48d1('0x17')](0x1f4,_0x4a3209[_0x48d1('0x19')]));});});};
\ No newline at end of file
+var _0x5a4a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b6560,_0xde16b){var _0x1ad742=function(_0x3836b6){while(--_0x3836b6){_0x3b6560['push'](_0x3b6560['shift']());}};_0x1ad742(++_0xde16b);}(_0x5a4a,0xfc));var _0xa5a4=function(_0x59f100,_0x2f53a3){_0x59f100=_0x59f100-0x0;var _0x58e476=_0x5a4a[_0x59f100];return _0x58e476;};'use strict';var _=require(_0xa5a4('0x0'));var util=require(_0xa5a4('0x1'));var moment=require(_0xa5a4('0x2'));var BPromise=require(_0xa5a4('0x3'));var rs=require(_0xa5a4('0x4'));var fs=require('fs');var Redis=require(_0xa5a4('0x5'));var db=require(_0xa5a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5a4('0x7'))(_0xa5a4('0x8'));var config=require(_0xa5a4('0x9'));var jayson=require(_0xa5a4('0xa'));var client=jayson[_0xa5a4('0xb')][_0xa5a4('0xc')]({'port':0x232a});config[_0xa5a4('0xd')]=_[_0xa5a4('0xe')](config[_0xa5a4('0xd')],{'host':_0xa5a4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5a4('0xd')]));require(_0xa5a4('0x10'))[_0xa5a4('0x11')](socket);function respondWithRpcPromise(_0x27eef3,_0x32d856,_0x427718){return new BPromise(function(_0x25ec93,_0x7cabd){return client[_0xa5a4('0x12')](_0x27eef3,_0x427718)['then'](function(_0x3c1d50){logger[_0xa5a4('0x13')](_0xa5a4('0x14'),_0x32d856,_0xa5a4('0x15'));logger['debug'](_0xa5a4('0x16'),_0x32d856,'request\x20sent',JSON[_0xa5a4('0x17')](_0x3c1d50));if(_0x3c1d50[_0xa5a4('0x18')]){if(_0x3c1d50['error'][_0xa5a4('0x19')]===0x1f4){logger[_0xa5a4('0x18')](_0xa5a4('0x14'),_0x32d856,_0x3c1d50[_0xa5a4('0x18')]['message']);return _0x7cabd(_0x3c1d50['error'][_0xa5a4('0x1a')]);}logger[_0xa5a4('0x18')]('ChatMessage,\x20%s,\x20%s',_0x32d856,_0x3c1d50[_0xa5a4('0x18')]['message']);return _0x25ec93(_0x3c1d50['error'][_0xa5a4('0x1a')]);}else{logger[_0xa5a4('0x13')]('ChatMessage,\x20%s,\x20%s',_0x32d856,_0xa5a4('0x15'));_0x25ec93(_0x3c1d50[_0xa5a4('0x1b')][_0xa5a4('0x1a')]);}})[_0xa5a4('0x1c')](function(_0x34bd15){logger[_0xa5a4('0x18')](_0xa5a4('0x14'),_0x32d856,_0x34bd15);_0x7cabd(_0x34bd15);});});}exports[_0xa5a4('0x1d')]=function(_0xcf9a10){var _0x227fe8=this;return new Promise(function(_0x152ff4,_0x1099a3){return db[_0xa5a4('0x1e')][_0xa5a4('0x1f')](_0xcf9a10[_0xa5a4('0x20')],{'raw':_0xcf9a10[_0xa5a4('0x21')]?_0xcf9a10[_0xa5a4('0x21')][_0xa5a4('0x22')]===undefined?!![]:![]:!![]})[_0xa5a4('0x23')](function(_0x2ccd7c){logger[_0xa5a4('0x13')](_0xa5a4('0x1d'),_0xcf9a10);logger[_0xa5a4('0x24')](_0xa5a4('0x1d'),_0xcf9a10,JSON[_0xa5a4('0x17')](_0x2ccd7c));_0x152ff4(_0x2ccd7c);})[_0xa5a4('0x1c')](function(_0x1ee959){logger[_0xa5a4('0x18')]('CreateChatMessage',_0x1ee959[_0xa5a4('0x1a')],_0xcf9a10);_0x1099a3(_0x227fe8[_0xa5a4('0x18')](0x1f4,_0x1ee959[_0xa5a4('0x1a')]));});});};
\ No newline at end of file
index b30e108..dceb039 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6596=['update','emit','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x538239,_0x156746){var _0x353ac3=function(_0x1bd5cc){while(--_0x1bd5cc){_0x538239['push'](_0x538239['shift']());}};_0x353ac3(++_0x156746);}(_0x6596,0x1d3));var _0x6659=function(_0x1d547d,_0x258166){_0x1d547d=_0x1d547d-0x0;var _0x37b456=_0x6596[_0x1d547d];return _0x37b456;};'use strict';var ChatMessageEvents=require(_0x6659('0x0'));var events=[_0x6659('0x1'),'remove',_0x6659('0x2')];function createListener(_0x114579,_0x3b1b74){return function(_0x2c58e1){_0x3b1b74[_0x6659('0x3')](_0x114579,_0x2c58e1);};}function removeListener(_0x67ac1d,_0x4bfd3c){return function(){ChatMessageEvents['removeListener'](_0x67ac1d,_0x4bfd3c);};}exports[_0x6659('0x4')]=function(_0x3091f1){for(var _0xd6bf59=0x0,_0x1ed458=events[_0x6659('0x5')];_0xd6bf59<_0x1ed458;_0xd6bf59++){var _0x4a900d=events[_0xd6bf59];var _0x485ea0=createListener(_0x6659('0x6')+_0x4a900d,_0x3091f1);ChatMessageEvents['on'](_0x4a900d,_0x485ea0);}};
\ No newline at end of file
+var _0xfc17=['emit','removeListener','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x1f7951,_0x492727){var _0x43ce4d=function(_0x29dec3){while(--_0x29dec3){_0x1f7951['push'](_0x1f7951['shift']());}};_0x43ce4d(++_0x492727);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x557890,_0x50e2f9){_0x557890=_0x557890-0x0;var _0x4aa144=_0xfc17[_0x557890];return _0x4aa144;};'use strict';var ChatMessageEvents=require(_0x7fc1('0x0'));var events=[_0x7fc1('0x1'),_0x7fc1('0x2'),_0x7fc1('0x3')];function createListener(_0x524e76,_0x184a4d){return function(_0x3bbf44){_0x184a4d[_0x7fc1('0x4')](_0x524e76,_0x3bbf44);};}function removeListener(_0x1f6079,_0x44101d){return function(){ChatMessageEvents[_0x7fc1('0x5')](_0x1f6079,_0x44101d);};}exports['register']=function(_0x30f5f8){for(var _0x1867ea=0x0,_0x2267ea=events[_0x7fc1('0x6')];_0x1867ea<_0x2267ea;_0x1867ea++){var _0x24c678=events[_0x1867ea];var _0x1b7106=createListener(_0x7fc1('0x7')+_0x24c678,_0x30f5f8);ChatMessageEvents['on'](_0x24c678,_0x1b7106);}};
\ No newline at end of file
index be865e1..e536367 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c07=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get'];(function(_0x471799,_0x18895b){var _0x4c0d5d=function(_0x397ab7){while(--_0x397ab7){_0x471799['push'](_0x471799['shift']());}};_0x4c0d5d(++_0x18895b);}(_0x6c07,0x10c));var _0x76c0=function(_0x497f5d,_0x23f5fa){_0x497f5d=_0x497f5d-0x0;var _0x5a0c01=_0x6c07[_0x497f5d];return _0x5a0c01;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x76c0('0x0'));var router=express[_0x76c0('0x1')]();var fs_extra=require(_0x76c0('0x2'));var auth=require(_0x76c0('0x3'));var interaction=require(_0x76c0('0x4'));var config=require('../../config/environment');var controller=require(_0x76c0('0x5'));router[_0x76c0('0x6')]('/',auth[_0x76c0('0x7')](),controller[_0x76c0('0x8')]);router[_0x76c0('0x6')](_0x76c0('0x9'),auth[_0x76c0('0x7')](),controller[_0x76c0('0xa')]);router[_0x76c0('0x6')](_0x76c0('0xb'),auth[_0x76c0('0x7')](),controller[_0x76c0('0xc')]);router[_0x76c0('0xd')]('/',auth[_0x76c0('0x7')](),interaction[_0x76c0('0xe')](_0x76c0('0xf'),_0x76c0('0x10')),controller[_0x76c0('0x11')]);router[_0x76c0('0x12')]('/:id',controller[_0x76c0('0x13')]);router[_0x76c0('0x12')](_0x76c0('0x14'),auth['isAuthenticated'](),controller[_0x76c0('0x15')]);router[_0x76c0('0x12')](_0x76c0('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x76c0('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x76c0('0x18')]=router;
\ No newline at end of file
+var _0x5c13=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','get','/describe','describe','show','create','/:id','put','accept','/:id/reject','reject','delete'];(function(_0x2d35d8,_0x23367f){var _0x4248ec=function(_0x1b7918){while(--_0x1b7918){_0x2d35d8['push'](_0x2d35d8['shift']());}};_0x4248ec(++_0x23367f);}(_0x5c13,0x7e));var _0x35c1=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0x5c13[_0xf91841];return _0x4b9c44;};'use strict';var multer=require(_0x35c1('0x0'));var util=require(_0x35c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35c1('0x2'));var router=express[_0x35c1('0x3')]();var fs_extra=require(_0x35c1('0x4'));var auth=require(_0x35c1('0x5'));var interaction=require(_0x35c1('0x6'));var config=require(_0x35c1('0x7'));var controller=require(_0x35c1('0x8'));router['get']('/',auth[_0x35c1('0x9')](),controller['index']);router[_0x35c1('0xa')](_0x35c1('0xb'),auth[_0x35c1('0x9')](),controller[_0x35c1('0xc')]);router[_0x35c1('0xa')]('/:id',auth[_0x35c1('0x9')](),controller[_0x35c1('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('chat','chatmessage:create'),controller[_0x35c1('0xe')]);router['put'](_0x35c1('0xf'),controller['update']);router[_0x35c1('0x10')]('/:id/accept',auth[_0x35c1('0x9')](),controller[_0x35c1('0x11')]);router['put'](_0x35c1('0x12'),auth[_0x35c1('0x9')](),controller[_0x35c1('0x13')]);router[_0x35c1('0x14')](_0x35c1('0xf'),auth[_0x35c1('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 9fc00e8..6d9f14f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2032=['medium','exports','TEXT'];(function(_0x5a6983,_0x38627f){var _0x516234=function(_0x22fcdc){while(--_0x22fcdc){_0x5a6983['push'](_0x5a6983['shift']());}};_0x516234(++_0x38627f);}(_0x2032,0xd9));var _0x2203=function(_0x43e638,_0x2d898c){_0x43e638=_0x43e638-0x0;var _0x88d9ad=_0x2032[_0x43e638];return _0x88d9ad;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}};
\ No newline at end of file
+var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x5f305d,_0x30f146){var _0x39a87e=function(_0x11b635){while(--_0x11b635){_0x5f305d['push'](_0x5f305d['shift']());}};_0x39a87e(++_0x30f146);}(_0xdb28,0x106));var _0x8db2=function(_0x4d4f54,_0x1df8b1){_0x4d4f54=_0x4d4f54-0x0;var _0x43b089=_0xdb28[_0x4d4f54];return _0x43b089;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}};
\ No newline at end of file
index 3253fb7..0043788 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x12a608,_0x42f3b6){var _0x19855a=function(_0x4747ce){while(--_0x4747ce){_0x12a608['push'](_0x12a608['shift']());}};_0x19855a(++_0x42f3b6);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));};
\ No newline at end of file
+var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7a54,0x106));var _0x47a5=function(_0x388319,_0x4d24af){_0x388319=_0x388319-0x0;var _0x4caa76=_0x7a54[_0x388319];return _0x4caa76;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));};
\ No newline at end of file
index bd60df5..f8c5224 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c23=['update','remove','emit','hook','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x66462e,_0x39ed96){var _0x29e88f=function(_0x47eb3d){while(--_0x47eb3d){_0x66462e['push'](_0x66462e['shift']());}};_0x29e88f(++_0x39ed96);}(_0x7c23,0xad));var _0x37c2=function(_0x179b7e,_0x438a3e){_0x179b7e=_0x179b7e-0x0;var _0x33d28f=_0x7c23[_0x179b7e];return _0x33d28f;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x37c2('0x0'))['db'][_0x37c2('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x37c2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x37c2('0x3'),'afterDestroy':_0x37c2('0x4')};function emitEvent(_0x4e44bd){return function(_0x230aeb,_0x4f354a,_0x379b53){ChatOfflineMessageEvents[_0x37c2('0x5')](_0x4e44bd+':'+_0x230aeb['id'],_0x230aeb);ChatOfflineMessageEvents[_0x37c2('0x5')](_0x4e44bd,_0x230aeb);_0x379b53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x37c2('0x6')](e,emitEvent(event));}}module[_0x37c2('0x7')]=ChatOfflineMessageEvents;
\ No newline at end of file
+var _0xe367=['ChatOfflineMessage','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x1169ec,_0x592493){var _0x334838=function(_0x3ab056){while(--_0x3ab056){_0x1169ec['push'](_0x1169ec['shift']());}};_0x334838(++_0x592493);}(_0xe367,0x116));var _0x7e36=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe367[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0x7e36('0x0'));var ChatOfflineMessage=require(_0x7e36('0x1'))['db'][_0x7e36('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7e36('0x3'),'afterUpdate':_0x7e36('0x4'),'afterDestroy':_0x7e36('0x5')};function emitEvent(_0x3ca3a8){return function(_0xe1068b,_0x1f5176,_0x33669d){ChatOfflineMessageEvents[_0x7e36('0x6')](_0x3ca3a8+':'+_0xe1068b['id'],_0xe1068b);ChatOfflineMessageEvents[_0x7e36('0x6')](_0x3ca3a8,_0xe1068b);_0x33669d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x7e36('0x7')]=ChatOfflineMessageEvents;
\ No newline at end of file
index 68d5e06..28c6ba7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa46e=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x50bc41,_0x494f99){var _0x92afea=function(_0x29e774){while(--_0x29e774){_0x50bc41['push'](_0x50bc41['shift']());}};_0x92afea(++_0x494f99);}(_0xa46e,0x12a));var _0xea46=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xa46e[_0x3b231a];return _0x18d67a;};'use strict';var attributes=require(_0xea46('0x0'));module[_0xea46('0x1')]=function(_0x261ca){return _0x261ca['define'](_0xea46('0x2'),attributes,{'tableName':_0xea46('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea46('0x4'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x49c9=['define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports'];(function(_0x205255,_0x36b8c8){var _0x2a36a5=function(_0x3d8906){while(--_0x3d8906){_0x205255['push'](_0x205255['shift']());}};_0x2a36a5(++_0x36b8c8);}(_0x49c9,0x158));var _0x949c=function(_0xb2e367,_0x2c6b86){_0xb2e367=_0xb2e367-0x0;var _0x320b08=_0x49c9[_0xb2e367];return _0x320b08;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x949c('0x0')]=function(_0x3d9a9a){return _0x3d9a9a[_0x949c('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0x949c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x949c('0x3'),'collate':_0x949c('0x4')});};
\ No newline at end of file
index 57f267b..e900652 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb33=['http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5d058f,_0x5ceea6){var _0x1819d8=function(_0x5ee594){while(--_0x5ee594){_0x5d058f['push'](_0x5d058f['shift']());}};_0x1819d8(++_0x5ceea6);}(_0xcb33,0xae));var _0x3cb3=function(_0x3f9fbb,_0x1b0857){_0x3f9fbb=_0x3f9fbb-0x0;var _0xbe958f=_0xcb33[_0x3f9fbb];return _0xbe958f;};'use strict';var _=require(_0x3cb3('0x0'));var util=require(_0x3cb3('0x1'));var moment=require(_0x3cb3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3cb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cb3('0x4'))['db'];var utils=require(_0x3cb3('0x5'));var logger=require(_0x3cb3('0x6'))(_0x3cb3('0x7'));var config=require('../../config/environment');var jayson=require(_0x3cb3('0x8'));var client=jayson[_0x3cb3('0x9')][_0x3cb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeef6e3,_0x96383e,_0x438a58){return new BPromise(function(_0x2b14f6,_0x57ba10){return client['request'](_0xeef6e3,_0x438a58)[_0x3cb3('0xb')](function(_0x142337){logger[_0x3cb3('0xc')](_0x3cb3('0xd'),_0x96383e,_0x3cb3('0xe'));logger[_0x3cb3('0xf')](_0x3cb3('0x10'),_0x96383e,'request\x20sent',JSON[_0x3cb3('0x11')](_0x142337));if(_0x142337[_0x3cb3('0x12')]){if(_0x142337[_0x3cb3('0x12')][_0x3cb3('0x13')]===0x1f4){logger[_0x3cb3('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x96383e,_0x142337[_0x3cb3('0x12')][_0x3cb3('0x14')]);return _0x57ba10(_0x142337['error']['message']);}logger['error'](_0x3cb3('0xd'),_0x96383e,_0x142337['error']['message']);return _0x2b14f6(_0x142337[_0x3cb3('0x12')][_0x3cb3('0x14')]);}else{logger[_0x3cb3('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x96383e,_0x3cb3('0xe'));_0x2b14f6(_0x142337[_0x3cb3('0x15')]['message']);}})[_0x3cb3('0x16')](function(_0x1f7833){logger[_0x3cb3('0x12')](_0x3cb3('0xd'),_0x96383e,_0x1f7833);_0x57ba10(_0x1f7833);});});}
\ No newline at end of file
+var _0x08e9=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3fc8f2,_0x54b438){var _0x4325f2=function(_0x156e6c){while(--_0x156e6c){_0x3fc8f2['push'](_0x3fc8f2['shift']());}};_0x4325f2(++_0x54b438);}(_0x08e9,0xd1));var _0x908e=function(_0x1d630f,_0x343a35){_0x1d630f=_0x1d630f-0x0;var _0x327b13=_0x08e9[_0x1d630f];return _0x327b13;};'use strict';var _=require(_0x908e('0x0'));var util=require(_0x908e('0x1'));var moment=require(_0x908e('0x2'));var BPromise=require(_0x908e('0x3'));var rs=require(_0x908e('0x4'));var fs=require('fs');var Redis=require(_0x908e('0x5'));var db=require(_0x908e('0x6'))['db'];var utils=require(_0x908e('0x7'));var logger=require(_0x908e('0x8'))(_0x908e('0x9'));var config=require(_0x908e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x908e('0xb')][_0x908e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x412275,_0x1eed47,_0x181fa8){return new BPromise(function(_0x4e2d63,_0x3a8f88){return client[_0x908e('0xd')](_0x412275,_0x181fa8)[_0x908e('0xe')](function(_0x10c315){logger[_0x908e('0xf')](_0x908e('0x10'),_0x1eed47,_0x908e('0x11'));logger[_0x908e('0x12')](_0x908e('0x13'),_0x1eed47,_0x908e('0x11'),JSON[_0x908e('0x14')](_0x10c315));if(_0x10c315[_0x908e('0x15')]){if(_0x10c315[_0x908e('0x15')][_0x908e('0x16')]===0x1f4){logger[_0x908e('0x15')](_0x908e('0x10'),_0x1eed47,_0x10c315['error'][_0x908e('0x17')]);return _0x3a8f88(_0x10c315[_0x908e('0x15')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1eed47,_0x10c315[_0x908e('0x15')][_0x908e('0x17')]);return _0x4e2d63(_0x10c315[_0x908e('0x15')][_0x908e('0x17')]);}else{logger[_0x908e('0xf')](_0x908e('0x10'),_0x1eed47,_0x908e('0x11'));_0x4e2d63(_0x10c315[_0x908e('0x18')][_0x908e('0x17')]);}})[_0x908e('0x19')](function(_0x48229e){logger[_0x908e('0x15')](_0x908e('0x10'),_0x1eed47,_0x48229e);_0x3a8f88(_0x48229e);});});}
\ No newline at end of file
index e66d814..00345f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5433=['get','isAuthenticated','/describe','/:id','post','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./chatOfflineMessage.controller'];(function(_0x348700,_0x512121){var _0x1b2496=function(_0x5e5cc2){while(--_0x5e5cc2){_0x348700['push'](_0x348700['shift']());}};_0x1b2496(++_0x512121);}(_0x5433,0x1b9));var _0x3543=function(_0x64b851,_0x4a8c0c){_0x64b851=_0x64b851-0x0;var _0x5217aa=_0x5433[_0x64b851];return _0x5217aa;};'use strict';var multer=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var path=require('path');var timeout=require(_0x3543('0x2'));var express=require('express');var router=express[_0x3543('0x3')]();var fs_extra=require(_0x3543('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3543('0x5'));var controller=require(_0x3543('0x6'));router[_0x3543('0x7')]('/',auth[_0x3543('0x8')](),controller['index']);router[_0x3543('0x7')](_0x3543('0x9'),auth[_0x3543('0x8')](),controller['describe']);router[_0x3543('0x7')](_0x3543('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3543('0xb')]('/',auth[_0x3543('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3543('0xc')]);router[_0x3543('0xd')](_0x3543('0xa'),auth[_0x3543('0x8')](),controller[_0x3543('0xe')]);module[_0x3543('0xf')]=router;
\ No newline at end of file
+var _0x69ba=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x4ca12e,_0x3bd8c7){var _0x3123a2=function(_0x4ae3da){while(--_0x4ae3da){_0x4ca12e['push'](_0x4ca12e['shift']());}};_0x3123a2(++_0x3bd8c7);}(_0x69ba,0x109));var _0xa69b=function(_0x4d3f81,_0x5cae96){_0x4d3f81=_0x4d3f81-0x0;var _0x27ba5c=_0x69ba[_0x4d3f81];return _0x27ba5c;};'use strict';var multer=require(_0xa69b('0x0'));var util=require(_0xa69b('0x1'));var path=require(_0xa69b('0x2'));var timeout=require(_0xa69b('0x3'));var express=require(_0xa69b('0x4'));var router=express['Router']();var fs_extra=require(_0xa69b('0x5'));var auth=require(_0xa69b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa69b('0x7'));var controller=require(_0xa69b('0x8'));router[_0xa69b('0x9')]('/',auth[_0xa69b('0xa')](),controller[_0xa69b('0xb')]);router['get'](_0xa69b('0xc'),auth[_0xa69b('0xa')](),controller[_0xa69b('0xd')]);router[_0xa69b('0x9')](_0xa69b('0xe'),auth[_0xa69b('0xa')](),controller['show']);router[_0xa69b('0xf')]('/',auth['isAuthenticated'](),controller[_0xa69b('0x10')]);router[_0xa69b('0x11')](_0xa69b('0xe'),auth[_0xa69b('0xa')](),controller[_0xa69b('0x12')]);router[_0xa69b('0x13')]('/:id',auth[_0xa69b('0xa')](),controller[_0xa69b('0x14')]);module[_0xa69b('0x15')]=router;
\ No newline at end of file
index 771ab27..e4ae0ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c23=['STRING','ENUM','mouseOver','timeout','exports'];(function(_0x48f3b8,_0x22693e){var _0x46b12a=function(_0x4fbe89){while(--_0x4fbe89){_0x48f3b8['push'](_0x48f3b8['shift']());}};_0x46b12a(++_0x22693e);}(_0x8c23,0x90));var _0x38c2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8c23[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x38c2('0x0')]={'name':{'type':Sequelize[_0x38c2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x38c2('0x2')](_0x38c2('0x3'),_0x38c2('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x38c2('0x1')]},'timeout':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x2661=['mouseOver','timeout','sequelize','exports','STRING','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2661,0x152));var _0x1266=function(_0x3d6a13,_0x38deb6){_0x3d6a13=_0x3d6a13-0x0;var _0x49ac0a=_0x2661[_0x3d6a13];return _0x49ac0a;};'use strict';var Sequelize=require(_0x1266('0x0'));module[_0x1266('0x1')]={'name':{'type':Sequelize[_0x1266('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1266('0x3')](_0x1266('0x4'),_0x1266('0x5')),'defaultValue':_0x1266('0x4')},'selector':{'type':Sequelize[_0x1266('0x2')]},'timeout':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index fcdf5de..9c8fab8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x277c=['undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset'];(function(_0x26b1b8,_0x35bfd4){var _0x401762=function(_0x49b4f4){while(--_0x49b4f4){_0x26b1b8['push'](_0x26b1b8['shift']());}};_0x401762(++_0x35bfd4);}(_0x277c,0x153));var _0xc277=function(_0x5ab39e,_0x25efc3){_0x5ab39e=_0x5ab39e-0x0;var _0x1f4b9d=_0x277c[_0x5ab39e];return _0x1f4b9d;};'use strict';var emlformat=require(_0xc277('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc277('0x1'));var jsonpatch=require(_0xc277('0x2'));var rp=require(_0xc277('0x3'));var moment=require(_0xc277('0x4'));var BPromise=require(_0xc277('0x5'));var Mustache=require(_0xc277('0x6'));var util=require(_0xc277('0x7'));var path=require(_0xc277('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc277('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc277('0xa'));var squel=require('squel');var crypto=require(_0xc277('0xb'));var jsforce=require(_0xc277('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc277('0xd'));var querystring=require(_0xc277('0xe'));var Papa=require(_0xc277('0xf'));var Redis=require(_0xc277('0x10'));var authService=require(_0xc277('0x11'));var qs=require(_0xc277('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc277('0x13'))(_0xc277('0x14'));var utils=require(_0xc277('0x15'));var config=require(_0xc277('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc277('0x17'))['db'];function respondWithStatusCode(_0x4a7700,_0xb6b933){_0xb6b933=_0xb6b933||0xcc;return function(_0x2bba87){if(_0x2bba87){return _0x4a7700[_0xc277('0x18')](_0xb6b933);}return _0x4a7700[_0xc277('0x19')](_0xb6b933)['end']();};}function respondWithResult(_0x222bc8,_0x182d35){_0x182d35=_0x182d35||0xc8;return function(_0x8895bd){if(_0x8895bd){return _0x222bc8['status'](_0x182d35)['json'](_0x8895bd);}};}function respondWithFilteredResult(_0x178e6d,_0x5c212c){return function(_0x46d20c){if(_0x46d20c){var _0x5d73f8=typeof _0x5c212c[_0xc277('0x1a')]===_0xc277('0x1b')&&typeof _0x5c212c[_0xc277('0x1c')]==='undefined';var _0x5cdb4b=_0x46d20c[_0xc277('0x1d')];var _0x4d23a7=_0x5d73f8?0x0:_0x5c212c['offset'];var _0x1e1a9b=_0x5d73f8?_0x46d20c[_0xc277('0x1d')]:_0x5c212c[_0xc277('0x1a')]+_0x5c212c[_0xc277('0x1c')];var _0xe2b7c1;if(_0x1e1a9b>=_0x5cdb4b){_0x1e1a9b=_0x5cdb4b;_0xe2b7c1=0xc8;}else{_0xe2b7c1=0xce;}_0x178e6d[_0xc277('0x19')](_0xe2b7c1);return _0x178e6d[_0xc277('0x1e')]('Content-Range',_0x4d23a7+'-'+_0x1e1a9b+'/'+_0x5cdb4b)['json'](_0x46d20c);}return null;};}function patchUpdates(_0x697d6f){return function(_0x28900e){try{jsonpatch[_0xc277('0x1f')](_0x28900e,_0x697d6f,!![]);}catch(_0x28b7b1){return BPromise[_0xc277('0x20')](_0x28b7b1);}return _0x28900e[_0xc277('0x21')]();};}function saveUpdates(_0xb4685f,_0x42cb0b){return function(_0x1bc888){if(_0x1bc888){return _0x1bc888[_0xc277('0x22')](_0xb4685f)[_0xc277('0x23')](function(_0x57a198){return _0x57a198;});}return null;};}function removeEntity(_0x2b9936,_0x21af1b){return function(_0x54b2e1){if(_0x54b2e1){return _0x54b2e1[_0xc277('0x24')]()['then'](function(){_0x2b9936['status'](0xcc)[_0xc277('0x25')]();});}};}function handleEntityNotFound(_0x57b03,_0x1583b6){return function(_0x436784){if(!_0x436784){_0x57b03[_0xc277('0x18')](0x194);}return _0x436784;};}function handleError(_0x3aa598,_0x37b893){_0x37b893=_0x37b893||0x1f4;return function(_0x9ad1c5){logger[_0xc277('0x26')](_0x9ad1c5[_0xc277('0x27')]);if(_0x9ad1c5[_0xc277('0x28')]){delete _0x9ad1c5['name'];}_0x3aa598['status'](_0x37b893)[_0xc277('0x29')](_0x9ad1c5);};}exports[_0xc277('0x2a')]=function(_0x4ebb0f,_0x4efc1e){var _0x388717={'raw':!![],'where':{'id':_0x4ebb0f[_0xc277('0x2b')]['id']}},_0x3bc773={};_0x3bc773[_0xc277('0x2c')]=_[_0xc277('0x2d')](db['ChatProactiveAction'][_0xc277('0x2e')]);_0x3bc773['query']=_[_0xc277('0x2d')](_0x4ebb0f[_0xc277('0x2f')]);_0x3bc773[_0xc277('0x30')]=_[_0xc277('0x31')](_0x3bc773['model'],_0x3bc773[_0xc277('0x2f')]);_0x388717['attributes']=_[_0xc277('0x31')](_0x3bc773[_0xc277('0x2c')],qs[_0xc277('0x32')](_0x4ebb0f[_0xc277('0x2f')]['fields']));_0x388717[_0xc277('0x33')]=_0x388717[_0xc277('0x33')]['length']?_0x388717[_0xc277('0x33')]:_0x3bc773['model'];if(_0x4ebb0f[_0xc277('0x2f')][_0xc277('0x34')]){_0x388717[_0xc277('0x35')]=[{'all':!![]}];}_0x388717=_[_0xc277('0x36')]({},_0x388717,_0x4ebb0f[_0xc277('0x37')]);return db[_0xc277('0x38')][_0xc277('0x39')](_0x388717)[_0xc277('0x23')](handleEntityNotFound(_0x4efc1e,null))[_0xc277('0x23')](respondWithResult(_0x4efc1e,null))[_0xc277('0x3a')](handleError(_0x4efc1e,null));};exports[_0xc277('0x3b')]=function(_0x5b2329,_0x18ebe8){return db[_0xc277('0x38')][_0xc277('0x3b')](_0x5b2329['body'],{})[_0xc277('0x23')](respondWithResult(_0x18ebe8,0xc9))[_0xc277('0x3a')](handleError(_0x18ebe8,null));};exports[_0xc277('0x22')]=function(_0x3e9701,_0x3522ee){if(_0x3e9701['body']['id']){delete _0x3e9701['body']['id'];}return db[_0xc277('0x38')]['find']({'where':{'id':_0x3e9701[_0xc277('0x2b')]['id']}})[_0xc277('0x23')](handleEntityNotFound(_0x3522ee,null))[_0xc277('0x23')](saveUpdates(_0x3e9701[_0xc277('0x3c')],null))[_0xc277('0x23')](respondWithResult(_0x3522ee,null))[_0xc277('0x3a')](handleError(_0x3522ee,null));};exports[_0xc277('0x24')]=function(_0x28a2a1,_0x2e35b5){return db[_0xc277('0x38')][_0xc277('0x39')]({'where':{'id':_0x28a2a1['params']['id']}})[_0xc277('0x23')](handleEntityNotFound(_0x2e35b5,null))[_0xc277('0x23')](removeEntity(_0x2e35b5,null))[_0xc277('0x3a')](handleError(_0x2e35b5,null));};
\ No newline at end of file
+var _0xf483=['query','attributes','intersection','model','fields','length','includeAll','merge','options','find','catch','update','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','stack','name','show','params','keys','ChatProactiveAction'];(function(_0x480bc0,_0x3eb7d2){var _0x4c0970=function(_0x396fe6){while(--_0x396fe6){_0x480bc0['push'](_0x480bc0['shift']());}};_0x4c0970(++_0x3eb7d2);}(_0xf483,0xf2));var _0x3f48=function(_0x47b7c4,_0x41d72b){_0x47b7c4=_0x47b7c4-0x0;var _0x544129=_0xf483[_0x47b7c4];return _0x544129;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f48('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f48('0x1'));var rp=require(_0x3f48('0x2'));var moment=require(_0x3f48('0x3'));var BPromise=require(_0x3f48('0x4'));var Mustache=require(_0x3f48('0x5'));var util=require(_0x3f48('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f48('0x7'));var fs=require('fs');var fs_extra=require(_0x3f48('0x8'));var _=require('lodash');var squel=require(_0x3f48('0x9'));var crypto=require(_0x3f48('0xa'));var jsforce=require(_0x3f48('0xb'));var deskjs=require(_0x3f48('0xc'));var toCsv=require(_0x3f48('0xd'));var querystring=require(_0x3f48('0xe'));var Papa=require(_0x3f48('0xf'));var Redis=require('ioredis');var authService=require(_0x3f48('0x10'));var qs=require(_0x3f48('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f48('0x12'));var logger=require('../../config/logger')(_0x3f48('0x13'));var utils=require(_0x3f48('0x14'));var config=require(_0x3f48('0x15'));var licenseUtil=require(_0x3f48('0x16'));var db=require(_0x3f48('0x17'))['db'];function respondWithStatusCode(_0x1e9563,_0x38502b){_0x38502b=_0x38502b||0xcc;return function(_0x5867db){if(_0x5867db){return _0x1e9563[_0x3f48('0x18')](_0x38502b);}return _0x1e9563[_0x3f48('0x19')](_0x38502b)['end']();};}function respondWithResult(_0x27ca72,_0x4e1f66){_0x4e1f66=_0x4e1f66||0xc8;return function(_0x101139){if(_0x101139){return _0x27ca72['status'](_0x4e1f66)[_0x3f48('0x1a')](_0x101139);}};}function respondWithFilteredResult(_0x57c489,_0x2a2083){return function(_0x2013b9){if(_0x2013b9){var _0x364032=typeof _0x2a2083['offset']===_0x3f48('0x1b')&&typeof _0x2a2083[_0x3f48('0x1c')]===_0x3f48('0x1b');var _0x6b97bf=_0x2013b9['count'];var _0x211b22=_0x364032?0x0:_0x2a2083[_0x3f48('0x1d')];var _0x14133f=_0x364032?_0x2013b9[_0x3f48('0x1e')]:_0x2a2083[_0x3f48('0x1d')]+_0x2a2083[_0x3f48('0x1c')];var _0x7a962f;if(_0x14133f>=_0x6b97bf){_0x14133f=_0x6b97bf;_0x7a962f=0xc8;}else{_0x7a962f=0xce;}_0x57c489[_0x3f48('0x19')](_0x7a962f);return _0x57c489[_0x3f48('0x1f')](_0x3f48('0x20'),_0x211b22+'-'+_0x14133f+'/'+_0x6b97bf)[_0x3f48('0x1a')](_0x2013b9);}return null;};}function patchUpdates(_0x353a23){return function(_0x108c6e){try{jsonpatch[_0x3f48('0x21')](_0x108c6e,_0x353a23,!![]);}catch(_0x323230){return BPromise[_0x3f48('0x22')](_0x323230);}return _0x108c6e[_0x3f48('0x23')]();};}function saveUpdates(_0x285462,_0x12fcde){return function(_0x12ef86){if(_0x12ef86){return _0x12ef86['update'](_0x285462)['then'](function(_0x3c9d93){return _0x3c9d93;});}return null;};}function removeEntity(_0xa85425,_0x2e569d){return function(_0x56ad7b){if(_0x56ad7b){return _0x56ad7b['destroy']()[_0x3f48('0x24')](function(){_0xa85425[_0x3f48('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a5f1,_0x2e101d){return function(_0xe2bcb0){if(!_0xe2bcb0){_0x30a5f1[_0x3f48('0x18')](0x194);}return _0xe2bcb0;};}function handleError(_0xd01529,_0x108852){_0x108852=_0x108852||0x1f4;return function(_0x2cf7a9){logger['error'](_0x2cf7a9[_0x3f48('0x25')]);if(_0x2cf7a9[_0x3f48('0x26')]){delete _0x2cf7a9[_0x3f48('0x26')];}_0xd01529[_0x3f48('0x19')](_0x108852)['send'](_0x2cf7a9);};}exports[_0x3f48('0x27')]=function(_0x1e6297,_0x562001){var _0x2a5e3f={'raw':!![],'where':{'id':_0x1e6297[_0x3f48('0x28')]['id']}},_0x33201e={};_0x33201e['model']=_[_0x3f48('0x29')](db[_0x3f48('0x2a')]['rawAttributes']);_0x33201e[_0x3f48('0x2b')]=_[_0x3f48('0x29')](_0x1e6297[_0x3f48('0x2b')]);_0x33201e['filters']=_['intersection'](_0x33201e['model'],_0x33201e[_0x3f48('0x2b')]);_0x2a5e3f[_0x3f48('0x2c')]=_[_0x3f48('0x2d')](_0x33201e[_0x3f48('0x2e')],qs[_0x3f48('0x2f')](_0x1e6297[_0x3f48('0x2b')][_0x3f48('0x2f')]));_0x2a5e3f[_0x3f48('0x2c')]=_0x2a5e3f[_0x3f48('0x2c')][_0x3f48('0x30')]?_0x2a5e3f[_0x3f48('0x2c')]:_0x33201e[_0x3f48('0x2e')];if(_0x1e6297[_0x3f48('0x2b')][_0x3f48('0x31')]){_0x2a5e3f['include']=[{'all':!![]}];}_0x2a5e3f=_[_0x3f48('0x32')]({},_0x2a5e3f,_0x1e6297[_0x3f48('0x33')]);return db['ChatProactiveAction'][_0x3f48('0x34')](_0x2a5e3f)['then'](handleEntityNotFound(_0x562001,null))['then'](respondWithResult(_0x562001,null))['catch'](handleError(_0x562001,null));};exports['create']=function(_0x54d1c8,_0x54a59c){return db[_0x3f48('0x2a')]['create'](_0x54d1c8['body'],{})[_0x3f48('0x24')](respondWithResult(_0x54a59c,0xc9))[_0x3f48('0x35')](handleError(_0x54a59c,null));};exports[_0x3f48('0x36')]=function(_0x2b7935,_0x49d885){if(_0x2b7935[_0x3f48('0x37')]['id']){delete _0x2b7935['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x2b7935[_0x3f48('0x28')]['id']}})[_0x3f48('0x24')](handleEntityNotFound(_0x49d885,null))['then'](saveUpdates(_0x2b7935[_0x3f48('0x37')],null))[_0x3f48('0x24')](respondWithResult(_0x49d885,null))[_0x3f48('0x35')](handleError(_0x49d885,null));};exports[_0x3f48('0x38')]=function(_0x4779af,_0x481b82){return db[_0x3f48('0x2a')][_0x3f48('0x34')]({'where':{'id':_0x4779af[_0x3f48('0x28')]['id']}})[_0x3f48('0x24')](handleEntityNotFound(_0x481b82,null))[_0x3f48('0x24')](removeEntity(_0x481b82,null))[_0x3f48('0x35')](handleError(_0x481b82,null));};
\ No newline at end of file
index 2bdb52c..a94f7b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x93b0=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction'];(function(_0x2490a6,_0x18b0ce){var _0x4a0e07=function(_0x3528a0){while(--_0x3528a0){_0x2490a6['push'](_0x2490a6['shift']());}};_0x4a0e07(++_0x18b0ce);}(_0x93b0,0x119));var _0x093b=function(_0x4319b7,_0x460d0b){_0x4319b7=_0x4319b7-0x0;var _0x167f1e=_0x93b0[_0x4319b7];return _0x167f1e;};'use strict';var _=require(_0x093b('0x0'));var util=require(_0x093b('0x1'));var logger=require(_0x093b('0x2'))(_0x093b('0x3'));var moment=require(_0x093b('0x4'));var BPromise=require(_0x093b('0x5'));var rp=require(_0x093b('0x6'));var fs=require('fs');var path=require(_0x093b('0x7'));var rimraf=require(_0x093b('0x8'));var config=require(_0x093b('0x9'));var attributes=require(_0x093b('0xa'));module['exports']=function(_0x97308c,_0xd7d3cf){return _0x97308c[_0x093b('0xb')](_0x093b('0xc'),attributes,{'tableName':_0x093b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x650b=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatProactiveAction'];(function(_0x19e21d,_0x21b638){var _0x4834a2=function(_0xbf3a6){while(--_0xbf3a6){_0x19e21d['push'](_0x19e21d['shift']());}};_0x4834a2(++_0x21b638);}(_0x650b,0x1e2));var _0xb650=function(_0xaf114d,_0x2bf02f){_0xaf114d=_0xaf114d-0x0;var _0x3fa697=_0x650b[_0xaf114d];return _0x3fa697;};'use strict';var _=require(_0xb650('0x0'));var util=require(_0xb650('0x1'));var logger=require(_0xb650('0x2'))(_0xb650('0x3'));var moment=require(_0xb650('0x4'));var BPromise=require(_0xb650('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb650('0x6'));var rimraf=require(_0xb650('0x7'));var config=require(_0xb650('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xb650('0x9')]=function(_0x1349a4,_0x934540){return _0x1349a4[_0xb650('0xa')](_0xb650('0xb'),attributes,{'tableName':_0xb650('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 64c366f..2635f44 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x393f=['../../config/logger','../../config/environment','jayson/promise','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x393f,0x18b));var _0xf393=function(_0x18e214,_0x5d08c7){_0x18e214=_0x18e214-0x0;var _0xb3338a=_0x393f[_0x18e214];return _0xb3338a;};'use strict';var _=require(_0xf393('0x0'));var util=require('util');var moment=require(_0xf393('0x1'));var BPromise=require(_0xf393('0x2'));var rs=require(_0xf393('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf393('0x4'));var logger=require(_0xf393('0x5'))('rpc');var config=require(_0xf393('0x6'));var jayson=require(_0xf393('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2601e9,_0x431884,_0x1025b1){return new BPromise(function(_0x2119e7,_0x1195c6){return client[_0xf393('0x8')](_0x2601e9,_0x1025b1)[_0xf393('0x9')](function(_0x292cb4){logger['info'](_0xf393('0xa'),_0x431884,'request\x20sent');logger[_0xf393('0xb')](_0xf393('0xc'),_0x431884,_0xf393('0xd'),JSON[_0xf393('0xe')](_0x292cb4));if(_0x292cb4[_0xf393('0xf')]){if(_0x292cb4[_0xf393('0xf')][_0xf393('0x10')]===0x1f4){logger['error'](_0xf393('0xa'),_0x431884,_0x292cb4['error']['message']);return _0x1195c6(_0x292cb4[_0xf393('0xf')][_0xf393('0x11')]);}logger[_0xf393('0xf')](_0xf393('0xa'),_0x431884,_0x292cb4['error'][_0xf393('0x11')]);return _0x2119e7(_0x292cb4[_0xf393('0xf')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x431884,_0xf393('0xd'));_0x2119e7(_0x292cb4[_0xf393('0x12')][_0xf393('0x11')]);}})[_0xf393('0x13')](function(_0x52c471){logger[_0xf393('0xf')](_0xf393('0xa'),_0x431884,_0x52c471);_0x1195c6(_0x52c471);});});}
\ No newline at end of file
+var _0xfca2=['http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfca2,0x6d));var _0x2fca=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0xfca2[_0x1e393b];return _0x3d0bfe;};'use strict';var _=require(_0x2fca('0x0'));var util=require('util');var moment=require(_0x2fca('0x1'));var BPromise=require(_0x2fca('0x2'));var rs=require(_0x2fca('0x3'));var fs=require('fs');var Redis=require(_0x2fca('0x4'));var db=require(_0x2fca('0x5'))['db'];var utils=require(_0x2fca('0x6'));var logger=require(_0x2fca('0x7'))(_0x2fca('0x8'));var config=require('../../config/environment');var jayson=require(_0x2fca('0x9'));var client=jayson[_0x2fca('0xa')][_0x2fca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x459131,_0x3d0d36,_0x54bb89){return new BPromise(function(_0x34151b,_0x1b6b6c){return client['request'](_0x459131,_0x54bb89)[_0x2fca('0xc')](function(_0xb49d9d){logger[_0x2fca('0xd')](_0x2fca('0xe'),_0x3d0d36,'request\x20sent');logger[_0x2fca('0xf')](_0x2fca('0x10'),_0x3d0d36,_0x2fca('0x11'),JSON[_0x2fca('0x12')](_0xb49d9d));if(_0xb49d9d[_0x2fca('0x13')]){if(_0xb49d9d[_0x2fca('0x13')][_0x2fca('0x14')]===0x1f4){logger[_0x2fca('0x13')](_0x2fca('0xe'),_0x3d0d36,_0xb49d9d['error'][_0x2fca('0x15')]);return _0x1b6b6c(_0xb49d9d[_0x2fca('0x13')]['message']);}logger[_0x2fca('0x13')](_0x2fca('0xe'),_0x3d0d36,_0xb49d9d[_0x2fca('0x13')]['message']);return _0x34151b(_0xb49d9d['error']['message']);}else{logger[_0x2fca('0xd')](_0x2fca('0xe'),_0x3d0d36,_0x2fca('0x11'));_0x34151b(_0xb49d9d[_0x2fca('0x16')]['message']);}})[_0x2fca('0x17')](function(_0x6ddb8){logger[_0x2fca('0x13')](_0x2fca('0xe'),_0x3d0d36,_0x6ddb8);_0x1b6b6c(_0x6ddb8);});});}
\ No newline at end of file
index 8be50a5..d409d92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d17=['create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0x5437ae,_0x22f60f){var _0x58ce2d=function(_0x5821cc){while(--_0x5821cc){_0x5437ae['push'](_0x5437ae['shift']());}};_0x58ce2d(++_0x22f60f);}(_0x5d17,0x114));var _0x75d1=function(_0xb68695,_0x1881a4){_0xb68695=_0xb68695-0x0;var _0x15a817=_0x5d17[_0xb68695];return _0x15a817;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/:id',auth[_0x75d1('0x9')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x9')](),controller[_0x75d1('0xc')]);router[_0x75d1('0xd')](_0x75d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x75d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module[_0x75d1('0x11')]=router;
\ No newline at end of file
+var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x2b3b3a,_0x3226e0){var _0x4b1b2c=function(_0x53b585){while(--_0x53b585){_0x2b3b3a['push'](_0x2b3b3a['shift']());}};_0x4b1b2c(++_0x3226e0);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router;
\ No newline at end of file
index ec43d9a..fe0b928 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabbb=['roundrobin','exports','STRING','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabbb,0x14b));var _0xbabb=function(_0x1c10ef,_0x54645e){_0x1c10ef=_0x1c10ef-0x0;var _0x1598da=_0xabbb[_0x1c10ef];return _0x1598da;};'use strict';var Sequelize=require('sequelize');module[_0xbabb('0x0')]={'name':{'type':Sequelize[_0xbabb('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbabb('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbabb('0x2')](_0xbabb('0x3'),'beepall',_0xbabb('0x4'))}};
\ No newline at end of file
+var _0x8e80=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2cb943,_0x2b1e5e){var _0x640a9c=function(_0x46cd4a){while(--_0x46cd4a){_0x2cb943['push'](_0x2cb943['shift']());}};_0x640a9c(++_0x2b1e5e);}(_0x8e80,0x1d1));var _0x08e8=function(_0x4dd15b,_0x1d880a){_0x4dd15b=_0x4dd15b-0x0;var _0x2445f2=_0x8e80[_0x4dd15b];return _0x2445f2;};'use strict';var Sequelize=require(_0x08e8('0x0'));module[_0x08e8('0x1')]={'name':{'type':Sequelize[_0x08e8('0x2')],'unique':_0x08e8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x08e8('0x2')]},'timeout':{'type':Sequelize[_0x08e8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x08e8('0x5')](_0x08e8('0x6'),_0x08e8('0x7'),'roundrobin')}};
\ No newline at end of file
index 7b630fc..0479154 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee86=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','get','UserProfileResource','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','ChatQueue','includeAll','include','findAll','rows','show','params','find','body','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userChatQueue:remove','omit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x13b20d,_0x3cae04){var _0x1f56db=function(_0x37dc72){while(--_0x37dc72){_0x13b20d['push'](_0x13b20d['shift']());}};_0x1f56db(++_0x3cae04);}(_0xee86,0x87));var _0x6ee8=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xee86[_0x45783c];return _0x1161da;};'use strict';var emlformat=require(_0x6ee8('0x0'));var rimraf=require(_0x6ee8('0x1'));var zipdir=require(_0x6ee8('0x2'));var jsonpatch=require(_0x6ee8('0x3'));var rp=require(_0x6ee8('0x4'));var moment=require('moment');var BPromise=require(_0x6ee8('0x5'));var Mustache=require(_0x6ee8('0x6'));var util=require(_0x6ee8('0x7'));var path=require(_0x6ee8('0x8'));var sox=require(_0x6ee8('0x9'));var csv=require(_0x6ee8('0xa'));var ejs=require(_0x6ee8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ee8('0xc'));var squel=require(_0x6ee8('0xd'));var crypto=require(_0x6ee8('0xe'));var jsforce=require(_0x6ee8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6ee8('0xa'));var querystring=require(_0x6ee8('0x10'));var Papa=require('papaparse');var Redis=require(_0x6ee8('0x11'));var authService=require(_0x6ee8('0x12'));var qs=require(_0x6ee8('0x13'));var as=require(_0x6ee8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ee8('0x15'))(_0x6ee8('0x16'));var utils=require(_0x6ee8('0x17'));var config=require(_0x6ee8('0x18'));var licenseUtil=require(_0x6ee8('0x19'));var db=require(_0x6ee8('0x1a'))['db'];config[_0x6ee8('0x1b')]=_['defaults'](config[_0x6ee8('0x1b')],{'host':_0x6ee8('0x1c'),'port':0x18eb});var socket=require(_0x6ee8('0x1d'))(new Redis(config[_0x6ee8('0x1b')]));require(_0x6ee8('0x1e'))[_0x6ee8('0x1f')](socket);var jayson=require(_0x6ee8('0x20'));var client=jayson[_0x6ee8('0x21')][_0x6ee8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x288449,_0x5dfa2e,_0x65f88f,_0x39d756){return new BPromise(function(_0x3b7df1,_0x50de28){var _0x14c141=_0x39d756||client;return _0x14c141[_0x6ee8('0x23')](_0x288449,_0x65f88f)['then'](function(_0x58a361){logger[_0x6ee8('0x24')]('ChatQueue,\x20%s,\x20%s',_0x5dfa2e,_0x6ee8('0x25'));logger[_0x6ee8('0x26')](_0x6ee8('0x27'),_0x5dfa2e,'request\x20sent',JSON[_0x6ee8('0x28')](_0x58a361));if(_0x58a361['error']){if(_0x58a361[_0x6ee8('0x29')][_0x6ee8('0x2a')]===0x1f4){logger[_0x6ee8('0x29')](_0x6ee8('0x2b'),_0x5dfa2e,_0x58a361[_0x6ee8('0x29')][_0x6ee8('0x2c')]);return _0x50de28(_0x58a361['error'][_0x6ee8('0x2c')]);}logger[_0x6ee8('0x29')](_0x6ee8('0x2b'),_0x5dfa2e,_0x58a361[_0x6ee8('0x29')][_0x6ee8('0x2c')]);return _0x3b7df1(_0x58a361[_0x6ee8('0x29')][_0x6ee8('0x2c')]);}else{logger[_0x6ee8('0x24')](_0x6ee8('0x2b'),_0x5dfa2e,_0x6ee8('0x25'));_0x3b7df1(_0x58a361[_0x6ee8('0x2d')][_0x6ee8('0x2c')]);}})[_0x6ee8('0x2e')](function(_0x4d4b25){logger['error'](_0x6ee8('0x2b'),_0x5dfa2e,_0x4d4b25);_0x50de28(_0x4d4b25);});});}function respondWithStatusCode(_0x147c1a,_0x17308a){_0x17308a=_0x17308a||0xcc;return function(_0xc4c202){if(_0xc4c202){return _0x147c1a[_0x6ee8('0x2f')](_0x17308a);}return _0x147c1a['status'](_0x17308a)['end']();};}function respondWithResult(_0x2ab84b,_0x238335){_0x238335=_0x238335||0xc8;return function(_0x13767b){if(_0x13767b){return _0x2ab84b[_0x6ee8('0x30')](_0x238335)[_0x6ee8('0x31')](_0x13767b);}};}function respondWithFilteredResult(_0x3f4f85,_0x2c7f7b){return function(_0x5efcf3){if(_0x5efcf3){var _0x275ea4=typeof _0x2c7f7b[_0x6ee8('0x32')]==='undefined'&&typeof _0x2c7f7b['limit']===_0x6ee8('0x33');var _0x93ab0a=_0x5efcf3[_0x6ee8('0x34')];var _0x1ac576=_0x275ea4?0x0:_0x2c7f7b[_0x6ee8('0x32')];var _0x559aa6=_0x275ea4?_0x5efcf3[_0x6ee8('0x34')]:_0x2c7f7b[_0x6ee8('0x32')]+_0x2c7f7b['limit'];var _0x2b9fe8;if(_0x559aa6>=_0x93ab0a){_0x559aa6=_0x93ab0a;_0x2b9fe8=0xc8;}else{_0x2b9fe8=0xce;}_0x3f4f85[_0x6ee8('0x30')](_0x2b9fe8);return _0x3f4f85['set']('Content-Range',_0x1ac576+'-'+_0x559aa6+'/'+_0x93ab0a)[_0x6ee8('0x31')](_0x5efcf3);}return null;};}function patchUpdates(_0x5b833c){return function(_0x1a195b){try{jsonpatch[_0x6ee8('0x35')](_0x1a195b,_0x5b833c,!![]);}catch(_0x230256){return BPromise[_0x6ee8('0x36')](_0x230256);}return _0x1a195b[_0x6ee8('0x37')]();};}function saveUpdates(_0x597f1c,_0x55f659){return function(_0xfd4d60){if(_0xfd4d60){return _0xfd4d60[_0x6ee8('0x38')](_0x597f1c)[_0x6ee8('0x39')](function(_0x1570e3){return _0x1570e3;});}return null;};}function removeEntity(_0x23dbaf,_0xad6d2b){return function(_0x54a4cd){if(_0x54a4cd){return _0x54a4cd['destroy']()[_0x6ee8('0x39')](function(){var _0xc47d25=_0x54a4cd[_0x6ee8('0x3a')]({'plain':!![]});var _0x32bdd8='ChatQueues';return db[_0x6ee8('0x3b')][_0x6ee8('0x3c')]({'where':{'type':_0x32bdd8,'resourceId':_0xc47d25['id']}})['then'](function(){return _0x54a4cd;});})[_0x6ee8('0x39')](function(){_0x23dbaf[_0x6ee8('0x30')](0xcc)[_0x6ee8('0x3d')]();});}};}function handleEntityNotFound(_0xf2ca18,_0x4e7aac){return function(_0x44efd0){if(!_0x44efd0){_0xf2ca18['sendStatus'](0x194);}return _0x44efd0;};}function handleError(_0x29ca8a,_0x1dd95e){_0x1dd95e=_0x1dd95e||0x1f4;return function(_0x2038d3){logger['error'](_0x2038d3['stack']);if(_0x2038d3[_0x6ee8('0x3e')]){delete _0x2038d3[_0x6ee8('0x3e')];}_0x29ca8a[_0x6ee8('0x30')](_0x1dd95e)[_0x6ee8('0x3f')](_0x2038d3);};}exports[_0x6ee8('0x40')]=function(_0x4e3990,_0x9ab483){var _0x544e95={},_0x598d9a={},_0x2443ad={'count':0x0,'rows':[]};var _0x4cba88=_['map'](db['ChatQueue'][_0x6ee8('0x41')],function(_0x148067){return{'name':_0x148067[_0x6ee8('0x42')],'type':_0x148067[_0x6ee8('0x43')][_0x6ee8('0x44')]};});_0x598d9a[_0x6ee8('0x45')]=_['map'](_0x4cba88,_0x6ee8('0x3e'));_0x598d9a[_0x6ee8('0x46')]=_[_0x6ee8('0x47')](_0x4e3990[_0x6ee8('0x46')]);_0x598d9a[_0x6ee8('0x48')]=_[_0x6ee8('0x49')](_0x598d9a[_0x6ee8('0x45')],_0x598d9a[_0x6ee8('0x46')]);_0x544e95[_0x6ee8('0x4a')]=_['intersection'](_0x598d9a[_0x6ee8('0x45')],qs[_0x6ee8('0x4b')](_0x4e3990['query']['fields']));_0x544e95[_0x6ee8('0x4a')]=_0x544e95[_0x6ee8('0x4a')][_0x6ee8('0x4c')]?_0x544e95[_0x6ee8('0x4a')]:_0x598d9a[_0x6ee8('0x45')];if(!_0x4e3990['query'][_0x6ee8('0x4d')](_0x6ee8('0x4e'))){_0x544e95[_0x6ee8('0x4f')]=qs['limit'](_0x4e3990[_0x6ee8('0x46')][_0x6ee8('0x4f')]);_0x544e95[_0x6ee8('0x32')]=qs[_0x6ee8('0x32')](_0x4e3990[_0x6ee8('0x46')][_0x6ee8('0x32')]);}_0x544e95[_0x6ee8('0x50')]=qs[_0x6ee8('0x51')](_0x4e3990[_0x6ee8('0x46')][_0x6ee8('0x51')]);_0x544e95[_0x6ee8('0x52')]=qs[_0x6ee8('0x48')](_[_0x6ee8('0x53')](_0x4e3990[_0x6ee8('0x46')],_0x598d9a[_0x6ee8('0x48')]),_0x4cba88);if(_0x4e3990[_0x6ee8('0x46')]['filter']){_0x544e95[_0x6ee8('0x52')]=_['merge'](_0x544e95['where'],{'$or':_[_0x6ee8('0x54')](_0x4cba88,function(_0x319229){if(_0x319229['type']!==_0x6ee8('0x55')){var _0x24d9b5={};_0x24d9b5[_0x319229[_0x6ee8('0x3e')]]={'$like':'%'+_0x4e3990[_0x6ee8('0x46')][_0x6ee8('0x56')]+'%'};return _0x24d9b5;}})});}_0x544e95=_[_0x6ee8('0x57')]({},_0x544e95,_0x4e3990[_0x6ee8('0x58')]);var _0x118fff={'where':_0x544e95[_0x6ee8('0x52')]};return db[_0x6ee8('0x59')][_0x6ee8('0x34')](_0x118fff)[_0x6ee8('0x39')](function(_0x4abb3d){_0x2443ad[_0x6ee8('0x34')]=_0x4abb3d;if(_0x4e3990['query'][_0x6ee8('0x5a')]){_0x544e95[_0x6ee8('0x5b')]=[{'all':!![]}];}return db['ChatQueue'][_0x6ee8('0x5c')](_0x544e95);})[_0x6ee8('0x39')](function(_0x50d9cb){_0x2443ad[_0x6ee8('0x5d')]=_0x50d9cb;return _0x2443ad;})[_0x6ee8('0x39')](respondWithFilteredResult(_0x9ab483,_0x544e95))['catch'](handleError(_0x9ab483,null));};exports[_0x6ee8('0x5e')]=function(_0x180e08,_0x4c7d1b){var _0x2905e3={'raw':!![],'where':{'id':_0x180e08[_0x6ee8('0x5f')]['id']}},_0x114be3={};_0x114be3[_0x6ee8('0x45')]=_[_0x6ee8('0x47')](db['ChatQueue']['rawAttributes']);_0x114be3[_0x6ee8('0x46')]=_[_0x6ee8('0x47')](_0x180e08[_0x6ee8('0x46')]);_0x114be3[_0x6ee8('0x48')]=_[_0x6ee8('0x49')](_0x114be3[_0x6ee8('0x45')],_0x114be3[_0x6ee8('0x46')]);_0x2905e3[_0x6ee8('0x4a')]=_[_0x6ee8('0x49')](_0x114be3['model'],qs['fields'](_0x180e08[_0x6ee8('0x46')][_0x6ee8('0x4b')]));_0x2905e3['attributes']=_0x2905e3[_0x6ee8('0x4a')][_0x6ee8('0x4c')]?_0x2905e3['attributes']:_0x114be3[_0x6ee8('0x45')];if(_0x180e08['query']['includeAll']){_0x2905e3[_0x6ee8('0x5b')]=[{'all':!![]}];}_0x2905e3=_[_0x6ee8('0x57')]({},_0x2905e3,_0x180e08[_0x6ee8('0x58')]);return db[_0x6ee8('0x59')][_0x6ee8('0x60')](_0x2905e3)[_0x6ee8('0x39')](handleEntityNotFound(_0x4c7d1b,null))[_0x6ee8('0x39')](respondWithResult(_0x4c7d1b,null))[_0x6ee8('0x2e')](handleError(_0x4c7d1b,null));};exports['create']=function(_0x40c090,_0x126837){return db['ChatQueue']['create'](_0x40c090[_0x6ee8('0x61')],{})[_0x6ee8('0x39')](function(_0x1e4998){var _0x14b338=_0x40c090['user']['get']({'plain':!![]});if(!_0x14b338)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14b338[_0x6ee8('0x62')]===_0x6ee8('0x63')){var _0x5bc167=_0x1e4998[_0x6ee8('0x3a')]({'plain':!![]});var _0x8bfb81=_0x6ee8('0x64');return db[_0x6ee8('0x65')][_0x6ee8('0x60')]({'where':{'name':_0x8bfb81,'userProfileId':_0x14b338[_0x6ee8('0x66')]},'raw':!![]})[_0x6ee8('0x39')](function(_0x29e8bb){if(_0x29e8bb&&_0x29e8bb[_0x6ee8('0x67')]===0x0){return db[_0x6ee8('0x3b')][_0x6ee8('0x68')]({'name':_0x5bc167[_0x6ee8('0x3e')],'resourceId':_0x5bc167['id'],'type':_0x29e8bb[_0x6ee8('0x3e')],'sectionId':_0x29e8bb['id']},{})[_0x6ee8('0x39')](function(){return _0x1e4998;});}else{return _0x1e4998;}})[_0x6ee8('0x2e')](function(_0x108148){logger[_0x6ee8('0x29')](_0x6ee8('0x69'),_0x108148);throw _0x108148;});}return _0x1e4998;})[_0x6ee8('0x39')](respondWithResult(_0x126837,0xc9))[_0x6ee8('0x2e')](handleError(_0x126837,null));};exports['update']=function(_0x54c02f,_0x4dbedf){if(_0x54c02f[_0x6ee8('0x61')]['id']){delete _0x54c02f['body']['id'];}return db[_0x6ee8('0x59')][_0x6ee8('0x60')]({'where':{'id':_0x54c02f[_0x6ee8('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4dbedf,null))['then'](saveUpdates(_0x54c02f['body'],null))[_0x6ee8('0x39')](respondWithResult(_0x4dbedf,null))[_0x6ee8('0x2e')](handleError(_0x4dbedf,null));};exports[_0x6ee8('0x3c')]=function(_0x22e5db,_0x22dc50){return db['ChatQueue'][_0x6ee8('0x60')]({'where':{'id':_0x22e5db[_0x6ee8('0x5f')]['id']}})[_0x6ee8('0x39')](handleEntityNotFound(_0x22dc50,null))[_0x6ee8('0x39')](removeEntity(_0x22dc50,null))['catch'](handleError(_0x22dc50,null));};exports['describe']=function(_0x2b7caf,_0x53ce6d){return db[_0x6ee8('0x59')]['describe']()['then'](respondWithResult(_0x53ce6d,null))[_0x6ee8('0x2e')](handleError(_0x53ce6d,null));};exports[_0x6ee8('0x6a')]=function(_0x384e13,_0x2f72ab,_0x5beb81){var _0x5cfecb={'raw':!![],'where':{}},_0x2643a8={},_0x5da156;return db['ChatQueue'][_0x6ee8('0x6b')]({'where':{'id':_0x384e13[_0x6ee8('0x5f')]['id']}})[_0x6ee8('0x39')](handleEntityNotFound(_0x2f72ab,null))[_0x6ee8('0x39')](function(_0x1e3ced){if(_0x1e3ced){_0x5da156=_0x1e3ced[_0x6ee8('0x3a')]({'plain':!![]});_0x2643a8[_0x6ee8('0x45')]=_[_0x6ee8('0x47')](db[_0x6ee8('0x6c')]['rawAttributes']);_0x2643a8[_0x6ee8('0x46')]=_[_0x6ee8('0x47')](_0x384e13[_0x6ee8('0x46')]);_0x2643a8[_0x6ee8('0x48')]=_[_0x6ee8('0x49')](_0x2643a8[_0x6ee8('0x45')],_0x2643a8[_0x6ee8('0x46')]);_0x5cfecb[_0x6ee8('0x4a')]=_['intersection'](_0x2643a8[_0x6ee8('0x45')],qs['fields'](_0x384e13[_0x6ee8('0x46')][_0x6ee8('0x4b')]));_0x5cfecb[_0x6ee8('0x4a')]=_0x5cfecb[_0x6ee8('0x4a')]['length']?_0x5cfecb[_0x6ee8('0x4a')]:_0x2643a8[_0x6ee8('0x45')];if(!_0x384e13[_0x6ee8('0x46')][_0x6ee8('0x4d')](_0x6ee8('0x4e'))){_0x5cfecb[_0x6ee8('0x4f')]=qs[_0x6ee8('0x4f')](_0x384e13[_0x6ee8('0x46')]['limit']);_0x5cfecb['offset']=qs[_0x6ee8('0x32')](_0x384e13[_0x6ee8('0x46')][_0x6ee8('0x32')]);}_0x5cfecb[_0x6ee8('0x50')]=qs[_0x6ee8('0x51')](_0x384e13['query'][_0x6ee8('0x51')]);_0x5cfecb[_0x6ee8('0x52')]=qs[_0x6ee8('0x48')](_[_0x6ee8('0x53')](_0x384e13[_0x6ee8('0x46')],_0x2643a8[_0x6ee8('0x48')]));_0x5cfecb[_0x6ee8('0x52')][_0x6ee8('0x6d')]=_0x1e3ced['id'];if(_0x384e13[_0x6ee8('0x46')][_0x6ee8('0x56')]){_0x5cfecb['where']=_[_0x6ee8('0x57')](_0x5cfecb[_0x6ee8('0x52')],{'$or':_['map'](_0x5cfecb[_0x6ee8('0x4a')],function(_0x3d5e16){var _0x2fa05e={};_0x2fa05e[_0x3d5e16]={'$like':'%'+_0x384e13[_0x6ee8('0x46')][_0x6ee8('0x56')]+'%'};return _0x2fa05e;})});}_0x5cfecb=_[_0x6ee8('0x57')]({},_0x5cfecb,_0x384e13[_0x6ee8('0x58')]);return db['UserChatQueue'][_0x6ee8('0x5c')](_0x5cfecb);}})[_0x6ee8('0x39')](function(_0x14102c){if(_0x14102c){return db[_0x6ee8('0x6e')][_0x6ee8('0x6f')]({'where':{'id':_[_0x6ee8('0x54')](_0x14102c,'UserId'),'role':_0x6ee8('0x70')},'attributes':['id',_0x6ee8('0x3e'),_0x6ee8('0x71'),_0x6ee8('0x72'),'createdAt']});}})['then'](function(_0x341781){if(_0x341781){return{'count':_0x341781[_0x6ee8('0x34')],'rows':_[_0x6ee8('0x54')](_0x341781[_0x6ee8('0x5d')],function(_0x24c3f0){return{'membername':_0x24c3f0[_0x6ee8('0x3e')],'UserId':_0x24c3f0['id'],'queue_name':_0x5da156[_0x6ee8('0x3e')],'ChatQueueId':_0x5da156['id'],'interface':util['format'](_0x6ee8('0x73'),_0x6ee8('0x74'),_0x24c3f0['name']),'penalty':0x0,'paused':_0x24c3f0['chatPause'],'createdAt':_0x24c3f0[_0x6ee8('0x75')],'updatedAt':_0x24c3f0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f72ab,_0x5cfecb))[_0x6ee8('0x2e')](handleError(_0x2f72ab,null));};exports['getTeams']=function(_0x5ac9a8,_0x2f1366,_0x3e7ad3){var _0x822bb0={};var _0x2f5db8={};var _0x508982;var _0x77d07d;return db['ChatQueue'][_0x6ee8('0x6b')]({'where':{'id':_0x5ac9a8['params']['id']}})[_0x6ee8('0x39')](handleEntityNotFound(_0x2f1366,null))[_0x6ee8('0x39')](function(_0x10ce64){if(_0x10ce64){_0x508982=_0x10ce64;_0x2f5db8[_0x6ee8('0x45')]=_['keys'](db[_0x6ee8('0x76')]['rawAttributes']);_0x2f5db8[_0x6ee8('0x46')]=_['keys'](_0x5ac9a8['query']);_0x2f5db8[_0x6ee8('0x48')]=_[_0x6ee8('0x49')](_0x2f5db8['model'],_0x2f5db8[_0x6ee8('0x46')]);_0x822bb0[_0x6ee8('0x4a')]=_[_0x6ee8('0x49')](_0x2f5db8['model'],qs[_0x6ee8('0x4b')](_0x5ac9a8[_0x6ee8('0x46')][_0x6ee8('0x4b')]));_0x822bb0[_0x6ee8('0x4a')]=_0x822bb0['attributes'][_0x6ee8('0x4c')]?_0x822bb0[_0x6ee8('0x4a')]:_0x2f5db8[_0x6ee8('0x45')];_0x822bb0[_0x6ee8('0x50')]=qs[_0x6ee8('0x51')](_0x5ac9a8[_0x6ee8('0x46')]['sort']);_0x822bb0[_0x6ee8('0x52')]=qs['filters'](_[_0x6ee8('0x53')](_0x5ac9a8[_0x6ee8('0x46')],_0x2f5db8['filters']));if(_0x5ac9a8[_0x6ee8('0x46')][_0x6ee8('0x56')]){_0x822bb0[_0x6ee8('0x52')]=_[_0x6ee8('0x57')](_0x822bb0['where'],{'$or':_[_0x6ee8('0x54')](_0x822bb0[_0x6ee8('0x4a')],function(_0x505ab5){var _0x122c0f={};_0x122c0f[_0x505ab5]={'$like':'%'+_0x5ac9a8[_0x6ee8('0x46')][_0x6ee8('0x56')]+'%'};return _0x122c0f;})});}_0x822bb0=_[_0x6ee8('0x57')]({},_0x822bb0,_0x5ac9a8[_0x6ee8('0x58')]);return _0x508982[_0x6ee8('0x77')](_0x822bb0);}})[_0x6ee8('0x39')](function(_0x2818b3){if(_0x2818b3){_0x77d07d=_0x2818b3['length'];if(!_0x5ac9a8[_0x6ee8('0x46')][_0x6ee8('0x4d')](_0x6ee8('0x4e'))){_0x822bb0[_0x6ee8('0x4f')]=qs[_0x6ee8('0x4f')](_0x5ac9a8[_0x6ee8('0x46')]['limit']);_0x822bb0[_0x6ee8('0x32')]=qs[_0x6ee8('0x32')](_0x5ac9a8[_0x6ee8('0x46')][_0x6ee8('0x32')]);}return _0x508982[_0x6ee8('0x77')](_0x822bb0);}})['then'](function(_0xe6df1c){if(_0xe6df1c){return _0xe6df1c?{'count':_0x77d07d,'rows':_0xe6df1c}:null;}})['then'](respondWithResult(_0x2f1366,null))[_0x6ee8('0x2e')](handleError(_0x2f1366,null));};exports[_0x6ee8('0x78')]=function(_0x27dbf2,_0x85f1e9,_0x55c0e2){var _0x1ab444=_0x27dbf2['body'][_0x6ee8('0x79')];return db[_0x6ee8('0x76')][_0x6ee8('0x5c')]({'where':{'id':_0x1ab444},'attributes':['id'],'include':[{'model':db[_0x6ee8('0x6e')],'as':_0x6ee8('0x7a'),'attributes':['id',_0x6ee8('0x3e'),_0x6ee8('0x7b'),_0x6ee8('0x7c'),_0x6ee8('0x7d')],'raw':!![]}]})[_0x6ee8('0x39')](function(_0xf8ee6c){if(_0xf8ee6c){var _0x556f7c=_[_0x6ee8('0x7e')](_0xf8ee6c,function(_0x42dd77){var _0x56c99a=_0x42dd77['get']({'plain':!![]});return _0x56c99a['Agents'];});return db[_0x6ee8('0x59')][_0x6ee8('0x60')]({'where':{'id':_0x27dbf2['params']['id']}})['then'](function(_0x22668c){return db[_0x6ee8('0x7f')][_0x6ee8('0x80')](function(_0x4c8a0a){return _0x22668c[_0x6ee8('0x78')](_0x1ab444,{'transaction':_0x4c8a0a})['then'](function(){return BPromise['each'](_0x556f7c,function(_0x178c1d){return db[_0x6ee8('0x6c')][_0x6ee8('0x81')]({'where':{'UserId':_0x178c1d['id'],'ChatQueueId':_0x27dbf2['params']['id']},'transaction':_0x4c8a0a});});})[_0x6ee8('0x39')](function(){_0x556f7c[_0x6ee8('0x82')](function(_0x3b11e8){socket[_0x6ee8('0x83')](_0x6ee8('0x84'),{'UserId':_0x3b11e8['id'],'ChatQueueId':_0x22668c['id']});});});});});}})[_0x6ee8('0x39')](respondWithStatusCode(_0x85f1e9,null))[_0x6ee8('0x2e')](handleError(_0x85f1e9,null));};exports[_0x6ee8('0x85')]=function(_0x1f7d1e,_0x4a1aff,_0x1d3fb3){return db[_0x6ee8('0x76')][_0x6ee8('0x5c')]({'where':{'id':_0x1f7d1e[_0x6ee8('0x46')][_0x6ee8('0x79')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6ee8('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x6ee8('0x39')](handleEntityNotFound(_0x4a1aff,null))['then'](function(_0x4bc42f){var _0x2823a0=_[_0x6ee8('0x54')](_0x4bc42f,'id');var _0x4a6aa6=[];var _0x4218a1=[];var _0x5a14d9=squel['select']();_0x5a14d9[_0x6ee8('0x86')](_0x6ee8('0x87'))[_0x6ee8('0x88')]('team_has_chat_queues','tq')[_0x6ee8('0x89')](_0x6ee8('0x8a'),'ut',_0x6ee8('0x8b'))[_0x6ee8('0x52')](_0x6ee8('0x8c'),_0x1f7d1e[_0x6ee8('0x5f')]['id']);for(var _0x735e3d=0x0;_0x735e3d<_0x4bc42f[_0x6ee8('0x4c')];_0x735e3d+=0x1){let _0x3b6d98=_0x4bc42f[_0x735e3d];for(var _0x108b8e=0x0;_0x108b8e<_0x3b6d98[_0x6ee8('0x7a')][_0x6ee8('0x4c')];_0x108b8e+=0x1){let _0x15aa9e=_0x3b6d98[_0x6ee8('0x7a')][_0x108b8e];var _0x58f96c=_0x5a14d9[_0x6ee8('0x8d')]();_0x58f96c[_0x6ee8('0x52')](_0x6ee8('0x8e'),_0x15aa9e['id']);_0x4218a1[_0x6ee8('0x8f')](db[_0x6ee8('0x7f')][_0x6ee8('0x46')](_0x58f96c['toString'](),{'type':db[_0x6ee8('0x7f')][_0x6ee8('0x90')][_0x6ee8('0x91')]})[_0x6ee8('0x39')](function(_0x27b730){if(_0x27b730[_0x6ee8('0x4c')]===0x1){return _0x15aa9e['id'];}else{var _0x4744fc=_[_0x6ee8('0x92')](_[_0x6ee8('0x54')](_0x27b730,_0x6ee8('0x93')),function(_0x3cb009){return _[_0x6ee8('0x94')](_0x2823a0,_0x3cb009);});if(_0x4744fc){return _0x15aa9e['id'];}}}));}}return BPromise[_0x6ee8('0x95')](_0x4218a1)[_0x6ee8('0x39')](function(_0x23c747){_0x4a6aa6=_(_0x4a6aa6)[_0x6ee8('0x96')](_0x23c747)[_0x6ee8('0x97')]()[_0x6ee8('0x98')]();return db[_0x6ee8('0x59')][_0x6ee8('0x60')]({'where':{'id':_0x1f7d1e['params']['id']}})['then'](function(_0x1dcf39){return db['sequelize'][_0x6ee8('0x80')](function(_0x1175e6){return _0x1dcf39[_0x6ee8('0x85')](_0x1f7d1e['query']['ids'],{'transaction':_0x1175e6})[_0x6ee8('0x39')](function(){if(!_[_0x6ee8('0x99')](_0x4a6aa6)){return _0x1dcf39['removeAgents'](_0x4a6aa6,{'transaction':_0x1175e6});}})[_0x6ee8('0x39')](function(){_0x4a6aa6[_0x6ee8('0x82')](function(_0xa65384){socket[_0x6ee8('0x83')](_0x6ee8('0x9a'),{'UserId':_0xa65384,'ChatQueueId':_0x1dcf39['id']});});});});});});})[_0x6ee8('0x39')](respondWithStatusCode(_0x4a1aff,null))[_0x6ee8('0x2e')](handleError(_0x4a1aff,null));};exports['addAgents']=function(_0x1eecf9,_0x1c94f9,_0x58f21f){return db[_0x6ee8('0x59')]['find']({'where':{'id':_0x1eecf9[_0x6ee8('0x5f')]['id']}})[_0x6ee8('0x39')](handleEntityNotFound(_0x1c94f9,null))[_0x6ee8('0x39')](function(_0x30ce76){if(_0x30ce76){return _0x30ce76['addAgents'](_0x1eecf9[_0x6ee8('0x61')][_0x6ee8('0x79')],_[_0x6ee8('0x9b')](_0x1eecf9[_0x6ee8('0x61')],['ids','id'])||{})['spread'](function(_0x358020){for(var _0x31a789=0x0;_0x31a789<_0x1eecf9[_0x6ee8('0x61')][_0x6ee8('0x79')]['length'];_0x31a789+=0x1){socket[_0x6ee8('0x83')](_0x6ee8('0x84'),{'UserId':Number(_0x1eecf9['body'][_0x6ee8('0x79')][_0x31a789]),'ChatQueueId':Number(_0x1eecf9[_0x6ee8('0x5f')]['id'])});}return _0x358020;});}})['then'](respondWithResult(_0x1c94f9,null))[_0x6ee8('0x2e')](handleError(_0x1c94f9,null));};exports[_0x6ee8('0x9c')]=function(_0x58aab2,_0x84fbe2,_0x203972){return db[_0x6ee8('0x59')]['find']({'where':{'id':_0x58aab2[_0x6ee8('0x5f')]['id']}})['then'](handleEntityNotFound(_0x84fbe2,null))[_0x6ee8('0x39')](function(_0x458cbc){if(_0x458cbc){return _0x458cbc[_0x6ee8('0x9c')](_0x58aab2[_0x6ee8('0x46')][_0x6ee8('0x79')])[_0x6ee8('0x39')](function(){if(_[_0x6ee8('0x9d')](_0x58aab2[_0x6ee8('0x46')][_0x6ee8('0x79')])){for(var _0x5ad3c9=0x0;_0x5ad3c9<_0x58aab2[_0x6ee8('0x46')][_0x6ee8('0x79')][_0x6ee8('0x4c')];_0x5ad3c9+=0x1){socket[_0x6ee8('0x83')](_0x6ee8('0x9a'),{'UserId':Number(_0x58aab2[_0x6ee8('0x46')][_0x6ee8('0x79')][_0x5ad3c9]),'ChatQueueId':Number(_0x58aab2['params']['id'])});}}else{socket[_0x6ee8('0x83')](_0x6ee8('0x9a'),{'UserId':Number(_0x58aab2[_0x6ee8('0x46')][_0x6ee8('0x79')]),'ChatQueueId':Number(_0x58aab2[_0x6ee8('0x5f')]['id'])});}});}})[_0x6ee8('0x39')](respondWithStatusCode(_0x84fbe2,null))[_0x6ee8('0x2e')](handleError(_0x84fbe2,null));};exports['getAgents']=function(_0x5c4423,_0x3c2bd8,_0x572c2e){var _0x45888a={};var _0x4d0c0b={};var _0x1ab459;var _0x173bfe;return db['ChatQueue'][_0x6ee8('0x6b')]({'where':{'id':_0x5c4423[_0x6ee8('0x5f')]['id']}})[_0x6ee8('0x39')](handleEntityNotFound(_0x3c2bd8,null))[_0x6ee8('0x39')](function(_0x1302f0){if(_0x1302f0){_0x1ab459=_0x1302f0;_0x4d0c0b[_0x6ee8('0x45')]=_[_0x6ee8('0x47')](db[_0x6ee8('0x6e')][_0x6ee8('0x41')]);_0x4d0c0b[_0x6ee8('0x46')]=_[_0x6ee8('0x47')](_0x5c4423['query']);_0x4d0c0b[_0x6ee8('0x48')]=_[_0x6ee8('0x49')](_0x4d0c0b[_0x6ee8('0x45')],_0x4d0c0b['query']);_0x45888a[_0x6ee8('0x4a')]=_[_0x6ee8('0x49')](_0x4d0c0b[_0x6ee8('0x45')],qs[_0x6ee8('0x4b')](_0x5c4423['query']['fields']));_0x45888a['attributes']=_0x45888a[_0x6ee8('0x4a')][_0x6ee8('0x4c')]?_0x45888a[_0x6ee8('0x4a')]:_0x4d0c0b['model'];_0x45888a[_0x6ee8('0x50')]=qs[_0x6ee8('0x51')](_0x5c4423[_0x6ee8('0x46')]['sort']);_0x45888a[_0x6ee8('0x52')]=qs[_0x6ee8('0x48')](_['pick'](_0x5c4423[_0x6ee8('0x46')],_0x4d0c0b[_0x6ee8('0x48')]));if(_0x5c4423[_0x6ee8('0x46')][_0x6ee8('0x56')]){_0x45888a['where']=_['merge'](_0x45888a[_0x6ee8('0x52')],{'$or':_[_0x6ee8('0x54')](_0x45888a[_0x6ee8('0x4a')],function(_0x6b3c4f){var _0x45a5f1={};_0x45a5f1[_0x6b3c4f]={'$like':'%'+_0x5c4423[_0x6ee8('0x46')][_0x6ee8('0x56')]+'%'};return _0x45a5f1;})});}_0x45888a=_[_0x6ee8('0x57')]({},_0x45888a,_0x5c4423[_0x6ee8('0x58')]);return _0x1ab459[_0x6ee8('0x9e')](_0x45888a);}})[_0x6ee8('0x39')](function(_0x15e9ed){if(_0x15e9ed){_0x173bfe=_0x15e9ed['length'];if(!_0x5c4423[_0x6ee8('0x46')]['hasOwnProperty'](_0x6ee8('0x4e'))){_0x45888a[_0x6ee8('0x4f')]=qs[_0x6ee8('0x4f')](_0x5c4423[_0x6ee8('0x46')]['limit']);_0x45888a['offset']=qs[_0x6ee8('0x32')](_0x5c4423[_0x6ee8('0x46')]['offset']);}return _0x1ab459['getAgents'](_0x45888a);}})['then'](function(_0x21999f){if(_0x21999f){return _0x21999f?{'count':_0x173bfe,'rows':_0x21999f}:null;}})[_0x6ee8('0x39')](respondWithResult(_0x3c2bd8,null))[_0x6ee8('0x2e')](handleError(_0x3c2bd8,null));};
\ No newline at end of file
+var _0x45e5=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','localhost','./chatQueue.socket','client','http','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','info','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','ChatQueues','UserProfileResource','end','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','update','describe','getMembers','pick','ChatQueueId','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','nolimit','addTeams','User','Agents','online','interface','transaction','findOrCreate','forEach','emit','removeTeams','ids','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x19f896,_0x52c84d){var _0x4c4eec=function(_0x4c2a3c){while(--_0x4c2a3c){_0x19f896['push'](_0x19f896['shift']());}};_0x4c4eec(++_0x52c84d);}(_0x45e5,0x11c));var _0x545e=function(_0x1a1db9,_0x19e741){_0x1a1db9=_0x1a1db9-0x0;var _0x3d29dc=_0x45e5[_0x1a1db9];return _0x3d29dc;};'use strict';var emlformat=require(_0x545e('0x0'));var rimraf=require(_0x545e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x545e('0x2'));var rp=require(_0x545e('0x3'));var moment=require(_0x545e('0x4'));var BPromise=require(_0x545e('0x5'));var Mustache=require(_0x545e('0x6'));var util=require(_0x545e('0x7'));var path=require(_0x545e('0x8'));var sox=require(_0x545e('0x9'));var csv=require('to-csv');var ejs=require(_0x545e('0xa'));var fs=require('fs');var fs_extra=require(_0x545e('0xb'));var _=require(_0x545e('0xc'));var squel=require('squel');var crypto=require(_0x545e('0xd'));var jsforce=require(_0x545e('0xe'));var deskjs=require(_0x545e('0xf'));var toCsv=require(_0x545e('0x10'));var querystring=require(_0x545e('0x11'));var Papa=require(_0x545e('0x12'));var Redis=require('ioredis');var authService=require(_0x545e('0x13'));var qs=require(_0x545e('0x14'));var as=require(_0x545e('0x15'));var hardwareService=require(_0x545e('0x16'));var logger=require('../../config/logger')(_0x545e('0x17'));var utils=require('../../config/utils');var config=require(_0x545e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x545e('0x19')]=_['defaults'](config[_0x545e('0x19')],{'host':_0x545e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x545e('0x19')]));require(_0x545e('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x545e('0x1c')][_0x545e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1b8ec4,_0x897cca,_0x49f92d,_0x4ebcc8){return new BPromise(function(_0x343ac6,_0x26e7ef){var _0x5e296e=_0x4ebcc8||client;return _0x5e296e['request'](_0x1b8ec4,_0x49f92d)[_0x545e('0x1e')](function(_0x56a4a5){logger['info']('ChatQueue,\x20%s,\x20%s',_0x897cca,'request\x20sent');logger[_0x545e('0x1f')](_0x545e('0x20'),_0x897cca,_0x545e('0x21'),JSON[_0x545e('0x22')](_0x56a4a5));if(_0x56a4a5[_0x545e('0x23')]){if(_0x56a4a5[_0x545e('0x23')]['code']===0x1f4){logger[_0x545e('0x23')](_0x545e('0x24'),_0x897cca,_0x56a4a5[_0x545e('0x23')][_0x545e('0x25')]);return _0x26e7ef(_0x56a4a5['error'][_0x545e('0x25')]);}logger[_0x545e('0x23')]('ChatQueue,\x20%s,\x20%s',_0x897cca,_0x56a4a5[_0x545e('0x23')][_0x545e('0x25')]);return _0x343ac6(_0x56a4a5[_0x545e('0x23')][_0x545e('0x25')]);}else{logger[_0x545e('0x26')](_0x545e('0x24'),_0x897cca,_0x545e('0x21'));_0x343ac6(_0x56a4a5[_0x545e('0x27')][_0x545e('0x25')]);}})['catch'](function(_0x238b6c){logger[_0x545e('0x23')](_0x545e('0x24'),_0x897cca,_0x238b6c);_0x26e7ef(_0x238b6c);});});}function respondWithStatusCode(_0x1729f8,_0x2f9960){_0x2f9960=_0x2f9960||0xcc;return function(_0x5c4aa9){if(_0x5c4aa9){return _0x1729f8['sendStatus'](_0x2f9960);}return _0x1729f8['status'](_0x2f9960)['end']();};}function respondWithResult(_0xa09625,_0x4ee758){_0x4ee758=_0x4ee758||0xc8;return function(_0x500a44){if(_0x500a44){return _0xa09625[_0x545e('0x28')](_0x4ee758)[_0x545e('0x29')](_0x500a44);}};}function respondWithFilteredResult(_0x200930,_0xa510a1){return function(_0x4b70d9){if(_0x4b70d9){var _0x249837=typeof _0xa510a1[_0x545e('0x2a')]===_0x545e('0x2b')&&typeof _0xa510a1[_0x545e('0x2c')]==='undefined';var _0x22d329=_0x4b70d9['count'];var _0x53b7c6=_0x249837?0x0:_0xa510a1[_0x545e('0x2a')];var _0x29f6f0=_0x249837?_0x4b70d9[_0x545e('0x2d')]:_0xa510a1[_0x545e('0x2a')]+_0xa510a1[_0x545e('0x2c')];var _0x1c631b;if(_0x29f6f0>=_0x22d329){_0x29f6f0=_0x22d329;_0x1c631b=0xc8;}else{_0x1c631b=0xce;}_0x200930[_0x545e('0x28')](_0x1c631b);return _0x200930[_0x545e('0x2e')](_0x545e('0x2f'),_0x53b7c6+'-'+_0x29f6f0+'/'+_0x22d329)['json'](_0x4b70d9);}return null;};}function patchUpdates(_0x5505fe){return function(_0x3bdd9d){try{jsonpatch[_0x545e('0x30')](_0x3bdd9d,_0x5505fe,!![]);}catch(_0xc773ee){return BPromise['reject'](_0xc773ee);}return _0x3bdd9d[_0x545e('0x31')]();};}function saveUpdates(_0x46824f,_0x2ee03a){return function(_0x7d595c){if(_0x7d595c){return _0x7d595c['update'](_0x46824f)[_0x545e('0x1e')](function(_0x3c97a2){return _0x3c97a2;});}return null;};}function removeEntity(_0x2de7d8,_0x398b48){return function(_0x5e7e5d){if(_0x5e7e5d){return _0x5e7e5d[_0x545e('0x32')]()[_0x545e('0x1e')](function(){var _0x51ffcb=_0x5e7e5d['get']({'plain':!![]});var _0x43c960=_0x545e('0x33');return db[_0x545e('0x34')]['destroy']({'where':{'type':_0x43c960,'resourceId':_0x51ffcb['id']}})[_0x545e('0x1e')](function(){return _0x5e7e5d;});})[_0x545e('0x1e')](function(){_0x2de7d8[_0x545e('0x28')](0xcc)[_0x545e('0x35')]();});}};}function handleEntityNotFound(_0x277f41,_0x457cfa){return function(_0x33856c){if(!_0x33856c){_0x277f41[_0x545e('0x36')](0x194);}return _0x33856c;};}function handleError(_0x37b168,_0x430ca4){_0x430ca4=_0x430ca4||0x1f4;return function(_0x55bce4){logger[_0x545e('0x23')](_0x55bce4[_0x545e('0x37')]);if(_0x55bce4[_0x545e('0x38')]){delete _0x55bce4[_0x545e('0x38')];}_0x37b168[_0x545e('0x28')](_0x430ca4)[_0x545e('0x39')](_0x55bce4);};}exports[_0x545e('0x3a')]=function(_0x19e438,_0x54d018){var _0x2c4d2f={},_0x1734e1={},_0x509158={'count':0x0,'rows':[]};var _0x57384f=_[_0x545e('0x3b')](db[_0x545e('0x3c')][_0x545e('0x3d')],function(_0x46778b){return{'name':_0x46778b[_0x545e('0x3e')],'type':_0x46778b['type'][_0x545e('0x3f')]};});_0x1734e1[_0x545e('0x40')]=_['map'](_0x57384f,_0x545e('0x38'));_0x1734e1[_0x545e('0x41')]=_[_0x545e('0x42')](_0x19e438['query']);_0x1734e1[_0x545e('0x43')]=_[_0x545e('0x44')](_0x1734e1[_0x545e('0x40')],_0x1734e1['query']);_0x2c4d2f['attributes']=_['intersection'](_0x1734e1['model'],qs[_0x545e('0x45')](_0x19e438['query'][_0x545e('0x45')]));_0x2c4d2f['attributes']=_0x2c4d2f[_0x545e('0x46')][_0x545e('0x47')]?_0x2c4d2f['attributes']:_0x1734e1['model'];if(!_0x19e438[_0x545e('0x41')][_0x545e('0x48')]('nolimit')){_0x2c4d2f[_0x545e('0x2c')]=qs[_0x545e('0x2c')](_0x19e438[_0x545e('0x41')][_0x545e('0x2c')]);_0x2c4d2f[_0x545e('0x2a')]=qs[_0x545e('0x2a')](_0x19e438[_0x545e('0x41')][_0x545e('0x2a')]);}_0x2c4d2f[_0x545e('0x49')]=qs[_0x545e('0x4a')](_0x19e438['query']['sort']);_0x2c4d2f['where']=qs[_0x545e('0x43')](_['pick'](_0x19e438[_0x545e('0x41')],_0x1734e1[_0x545e('0x43')]),_0x57384f);if(_0x19e438['query'][_0x545e('0x4b')]){_0x2c4d2f['where']=_[_0x545e('0x4c')](_0x2c4d2f[_0x545e('0x4d')],{'$or':_[_0x545e('0x3b')](_0x57384f,function(_0x4b3c49){if(_0x4b3c49[_0x545e('0x4e')]!==_0x545e('0x4f')){var _0x341c71={};_0x341c71[_0x4b3c49[_0x545e('0x38')]]={'$like':'%'+_0x19e438[_0x545e('0x41')][_0x545e('0x4b')]+'%'};return _0x341c71;}})});}_0x2c4d2f=_[_0x545e('0x4c')]({},_0x2c4d2f,_0x19e438[_0x545e('0x50')]);var _0x202c7e={'where':_0x2c4d2f[_0x545e('0x4d')]};return db['ChatQueue'][_0x545e('0x2d')](_0x202c7e)[_0x545e('0x1e')](function(_0x34bfb5){_0x509158[_0x545e('0x2d')]=_0x34bfb5;if(_0x19e438[_0x545e('0x41')][_0x545e('0x51')]){_0x2c4d2f[_0x545e('0x52')]=[{'all':!![]}];}return db[_0x545e('0x3c')][_0x545e('0x53')](_0x2c4d2f);})['then'](function(_0x147f53){_0x509158[_0x545e('0x54')]=_0x147f53;return _0x509158;})[_0x545e('0x1e')](respondWithFilteredResult(_0x54d018,_0x2c4d2f))[_0x545e('0x55')](handleError(_0x54d018,null));};exports[_0x545e('0x56')]=function(_0x57f6ed,_0x3e4917){var _0x24e8a1={'raw':!![],'where':{'id':_0x57f6ed[_0x545e('0x57')]['id']}},_0x1108e5={};_0x1108e5['model']=_['keys'](db[_0x545e('0x3c')]['rawAttributes']);_0x1108e5['query']=_[_0x545e('0x42')](_0x57f6ed[_0x545e('0x41')]);_0x1108e5['filters']=_[_0x545e('0x44')](_0x1108e5['model'],_0x1108e5[_0x545e('0x41')]);_0x24e8a1[_0x545e('0x46')]=_['intersection'](_0x1108e5[_0x545e('0x40')],qs['fields'](_0x57f6ed[_0x545e('0x41')][_0x545e('0x45')]));_0x24e8a1[_0x545e('0x46')]=_0x24e8a1[_0x545e('0x46')][_0x545e('0x47')]?_0x24e8a1[_0x545e('0x46')]:_0x1108e5['model'];if(_0x57f6ed[_0x545e('0x41')][_0x545e('0x51')]){_0x24e8a1[_0x545e('0x52')]=[{'all':!![]}];}_0x24e8a1=_[_0x545e('0x4c')]({},_0x24e8a1,_0x57f6ed['options']);return db[_0x545e('0x3c')][_0x545e('0x58')](_0x24e8a1)[_0x545e('0x1e')](handleEntityNotFound(_0x3e4917,null))['then'](respondWithResult(_0x3e4917,null))['catch'](handleError(_0x3e4917,null));};exports[_0x545e('0x59')]=function(_0x349c81,_0x4c2b06){return db[_0x545e('0x3c')][_0x545e('0x59')](_0x349c81[_0x545e('0x5a')],{})[_0x545e('0x1e')](function(_0x38b397){var _0x25bc9a=_0x349c81[_0x545e('0x5b')]['get']({'plain':!![]});if(!_0x25bc9a)throw new Error(_0x545e('0x5c'));if(_0x25bc9a[_0x545e('0x5d')]===_0x545e('0x5b')){var _0x28eae2=_0x38b397[_0x545e('0x5e')]({'plain':!![]});var _0x28e038=_0x545e('0x33');return db['UserProfileSection'][_0x545e('0x58')]({'where':{'name':_0x28e038,'userProfileId':_0x25bc9a[_0x545e('0x5f')]},'raw':!![]})[_0x545e('0x1e')](function(_0x2af8ee){if(_0x2af8ee&&_0x2af8ee['autoAssociation']===0x0){return db[_0x545e('0x34')][_0x545e('0x59')]({'name':_0x28eae2['name'],'resourceId':_0x28eae2['id'],'type':_0x2af8ee['name'],'sectionId':_0x2af8ee['id']},{})['then'](function(){return _0x38b397;});}else{return _0x38b397;}})['catch'](function(_0x41cbda){logger[_0x545e('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41cbda);throw _0x41cbda;});}return _0x38b397;})[_0x545e('0x1e')](respondWithResult(_0x4c2b06,0xc9))[_0x545e('0x55')](handleError(_0x4c2b06,null));};exports[_0x545e('0x60')]=function(_0x417826,_0x21204a){if(_0x417826[_0x545e('0x5a')]['id']){delete _0x417826[_0x545e('0x5a')]['id'];}return db['ChatQueue'][_0x545e('0x58')]({'where':{'id':_0x417826[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0x21204a,null))['then'](saveUpdates(_0x417826[_0x545e('0x5a')],null))[_0x545e('0x1e')](respondWithResult(_0x21204a,null))['catch'](handleError(_0x21204a,null));};exports['destroy']=function(_0x4a0916,_0x12fdb3){return db[_0x545e('0x3c')][_0x545e('0x58')]({'where':{'id':_0x4a0916['params']['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0x12fdb3,null))['then'](removeEntity(_0x12fdb3,null))[_0x545e('0x55')](handleError(_0x12fdb3,null));};exports[_0x545e('0x61')]=function(_0x4afbd8,_0x55a849){return db['ChatQueue'][_0x545e('0x61')]()[_0x545e('0x1e')](respondWithResult(_0x55a849,null))[_0x545e('0x55')](handleError(_0x55a849,null));};exports[_0x545e('0x62')]=function(_0x2eec07,_0x1e5ffe,_0x9027c8){var _0x2d5272={'raw':!![],'where':{}},_0x39d359={},_0x32e293;return db[_0x545e('0x3c')]['findOne']({'where':{'id':_0x2eec07['params']['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0x1e5ffe,null))[_0x545e('0x1e')](function(_0x381a13){if(_0x381a13){_0x32e293=_0x381a13[_0x545e('0x5e')]({'plain':!![]});_0x39d359['model']=_[_0x545e('0x42')](db['UserChatQueue'][_0x545e('0x3d')]);_0x39d359[_0x545e('0x41')]=_[_0x545e('0x42')](_0x2eec07[_0x545e('0x41')]);_0x39d359[_0x545e('0x43')]=_[_0x545e('0x44')](_0x39d359['model'],_0x39d359['query']);_0x2d5272[_0x545e('0x46')]=_[_0x545e('0x44')](_0x39d359[_0x545e('0x40')],qs[_0x545e('0x45')](_0x2eec07['query'][_0x545e('0x45')]));_0x2d5272['attributes']=_0x2d5272[_0x545e('0x46')][_0x545e('0x47')]?_0x2d5272[_0x545e('0x46')]:_0x39d359[_0x545e('0x40')];if(!_0x2eec07[_0x545e('0x41')][_0x545e('0x48')]('nolimit')){_0x2d5272['limit']=qs[_0x545e('0x2c')](_0x2eec07[_0x545e('0x41')][_0x545e('0x2c')]);_0x2d5272[_0x545e('0x2a')]=qs['offset'](_0x2eec07[_0x545e('0x41')][_0x545e('0x2a')]);}_0x2d5272[_0x545e('0x49')]=qs[_0x545e('0x4a')](_0x2eec07[_0x545e('0x41')][_0x545e('0x4a')]);_0x2d5272['where']=qs[_0x545e('0x43')](_[_0x545e('0x63')](_0x2eec07[_0x545e('0x41')],_0x39d359[_0x545e('0x43')]));_0x2d5272[_0x545e('0x4d')][_0x545e('0x64')]=_0x381a13['id'];if(_0x2eec07[_0x545e('0x41')][_0x545e('0x4b')]){_0x2d5272['where']=_[_0x545e('0x4c')](_0x2d5272['where'],{'$or':_['map'](_0x2d5272[_0x545e('0x46')],function(_0xcd3600){var _0x4d0838={};_0x4d0838[_0xcd3600]={'$like':'%'+_0x2eec07[_0x545e('0x41')]['filter']+'%'};return _0x4d0838;})});}_0x2d5272=_['merge']({},_0x2d5272,_0x2eec07[_0x545e('0x50')]);return db[_0x545e('0x65')]['findAll'](_0x2d5272);}})['then'](function(_0x2e2cdd){if(_0x2e2cdd){return db['User'][_0x545e('0x66')]({'where':{'id':_['map'](_0x2e2cdd,_0x545e('0x67')),'role':_0x545e('0x68')},'attributes':['id',_0x545e('0x38'),_0x545e('0x69'),_0x545e('0x6a'),_0x545e('0x6b')]});}})[_0x545e('0x1e')](function(_0x1020f5){if(_0x1020f5){return{'count':_0x1020f5[_0x545e('0x2d')],'rows':_[_0x545e('0x3b')](_0x1020f5[_0x545e('0x54')],function(_0x2bc292){return{'membername':_0x2bc292[_0x545e('0x38')],'UserId':_0x2bc292['id'],'queue_name':_0x32e293[_0x545e('0x38')],'ChatQueueId':_0x32e293['id'],'interface':util['format'](_0x545e('0x6c'),_0x545e('0x6d'),_0x2bc292['name']),'penalty':0x0,'paused':_0x2bc292[_0x545e('0x69')],'createdAt':_0x2bc292['createdAt'],'updatedAt':_0x2bc292[_0x545e('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x545e('0x1e')](respondWithFilteredResult(_0x1e5ffe,_0x2d5272))['catch'](handleError(_0x1e5ffe,null));};exports[_0x545e('0x6e')]=function(_0x198f6d,_0xdfdf39,_0x12ff09){var _0x5a1f67={};var _0x15327b={};var _0x1f6d4a;var _0x12da30;return db['ChatQueue'][_0x545e('0x6f')]({'where':{'id':_0x198f6d[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0xdfdf39,null))[_0x545e('0x1e')](function(_0x504412){if(_0x504412){_0x1f6d4a=_0x504412;_0x15327b[_0x545e('0x40')]=_[_0x545e('0x42')](db[_0x545e('0x70')][_0x545e('0x3d')]);_0x15327b[_0x545e('0x41')]=_[_0x545e('0x42')](_0x198f6d['query']);_0x15327b[_0x545e('0x43')]=_['intersection'](_0x15327b[_0x545e('0x40')],_0x15327b['query']);_0x5a1f67[_0x545e('0x46')]=_[_0x545e('0x44')](_0x15327b[_0x545e('0x40')],qs['fields'](_0x198f6d[_0x545e('0x41')]['fields']));_0x5a1f67['attributes']=_0x5a1f67[_0x545e('0x46')][_0x545e('0x47')]?_0x5a1f67[_0x545e('0x46')]:_0x15327b[_0x545e('0x40')];_0x5a1f67[_0x545e('0x49')]=qs[_0x545e('0x4a')](_0x198f6d[_0x545e('0x41')]['sort']);_0x5a1f67[_0x545e('0x4d')]=qs['filters'](_['pick'](_0x198f6d[_0x545e('0x41')],_0x15327b[_0x545e('0x43')]));if(_0x198f6d[_0x545e('0x41')][_0x545e('0x4b')]){_0x5a1f67[_0x545e('0x4d')]=_[_0x545e('0x4c')](_0x5a1f67[_0x545e('0x4d')],{'$or':_[_0x545e('0x3b')](_0x5a1f67[_0x545e('0x46')],function(_0x218ab4){var _0x3d1c72={};_0x3d1c72[_0x218ab4]={'$like':'%'+_0x198f6d[_0x545e('0x41')][_0x545e('0x4b')]+'%'};return _0x3d1c72;})});}_0x5a1f67=_[_0x545e('0x4c')]({},_0x5a1f67,_0x198f6d[_0x545e('0x50')]);return _0x1f6d4a[_0x545e('0x6e')](_0x5a1f67);}})[_0x545e('0x1e')](function(_0x46ca03){if(_0x46ca03){_0x12da30=_0x46ca03[_0x545e('0x47')];if(!_0x198f6d[_0x545e('0x41')][_0x545e('0x48')](_0x545e('0x71'))){_0x5a1f67[_0x545e('0x2c')]=qs[_0x545e('0x2c')](_0x198f6d['query'][_0x545e('0x2c')]);_0x5a1f67['offset']=qs['offset'](_0x198f6d[_0x545e('0x41')][_0x545e('0x2a')]);}return _0x1f6d4a[_0x545e('0x6e')](_0x5a1f67);}})[_0x545e('0x1e')](function(_0x548d42){if(_0x548d42){return _0x548d42?{'count':_0x12da30,'rows':_0x548d42}:null;}})[_0x545e('0x1e')](respondWithResult(_0xdfdf39,null))[_0x545e('0x55')](handleError(_0xdfdf39,null));};exports[_0x545e('0x72')]=function(_0x4c3a3f,_0x5e1559,_0x50c174){var _0x3376cb=_0x4c3a3f['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x3376cb},'attributes':['id'],'include':[{'model':db[_0x545e('0x73')],'as':_0x545e('0x74'),'attributes':['id',_0x545e('0x38'),_0x545e('0x75'),'voicePause',_0x545e('0x76')],'raw':!![]}]})[_0x545e('0x1e')](function(_0x39d297){if(_0x39d297){var _0x2b3c48=_['flatMap'](_0x39d297,function(_0x323cfa){var _0x64c82b=_0x323cfa['get']({'plain':!![]});return _0x64c82b[_0x545e('0x74')];});return db[_0x545e('0x3c')]['find']({'where':{'id':_0x4c3a3f[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](function(_0x2b7cb7){return db['sequelize'][_0x545e('0x77')](function(_0x404e30){return _0x2b7cb7[_0x545e('0x72')](_0x3376cb,{'transaction':_0x404e30})[_0x545e('0x1e')](function(){return BPromise['each'](_0x2b3c48,function(_0x2091b5){return db[_0x545e('0x65')][_0x545e('0x78')]({'where':{'UserId':_0x2091b5['id'],'ChatQueueId':_0x4c3a3f[_0x545e('0x57')]['id']},'transaction':_0x404e30});});})['then'](function(){_0x2b3c48[_0x545e('0x79')](function(_0x12e4c0){socket[_0x545e('0x7a')]('userChatQueue:save',{'UserId':_0x12e4c0['id'],'ChatQueueId':_0x2b7cb7['id']});});});});});}})[_0x545e('0x1e')](respondWithStatusCode(_0x5e1559,null))['catch'](handleError(_0x5e1559,null));};exports[_0x545e('0x7b')]=function(_0x5e2a77,_0x615df3,_0x40a5b3){return db[_0x545e('0x70')][_0x545e('0x53')]({'where':{'id':_0x5e2a77[_0x545e('0x41')][_0x545e('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x545e('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x615df3,null))[_0x545e('0x1e')](function(_0x2aa6a1){var _0x381f18=_[_0x545e('0x3b')](_0x2aa6a1,'id');var _0x2fdc40=[];var _0x477af8=[];var _0x5c5366=squel['select']();_0x5c5366['field'](_0x545e('0x7d'))['from'](_0x545e('0x7e'),'tq')[_0x545e('0x7f')](_0x545e('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x545e('0x4d')](_0x545e('0x81'),_0x5e2a77[_0x545e('0x57')]['id']);for(var _0x1eb681=0x0;_0x1eb681<_0x2aa6a1[_0x545e('0x47')];_0x1eb681+=0x1){let _0x516f1e=_0x2aa6a1[_0x1eb681];for(var _0x1e58be=0x0;_0x1e58be<_0x516f1e['Agents']['length'];_0x1e58be+=0x1){let _0x3ab27f=_0x516f1e[_0x545e('0x74')][_0x1e58be];var _0x293581=_0x5c5366[_0x545e('0x82')]();_0x293581[_0x545e('0x4d')](_0x545e('0x83'),_0x3ab27f['id']);_0x477af8[_0x545e('0x84')](db[_0x545e('0x85')][_0x545e('0x41')](_0x293581['toString'](),{'type':db['sequelize'][_0x545e('0x86')][_0x545e('0x87')]})[_0x545e('0x1e')](function(_0x357a6a){if(_0x357a6a['length']===0x1){return _0x3ab27f['id'];}else{var _0x40b10e=_[_0x545e('0x88')](_[_0x545e('0x3b')](_0x357a6a,'TeamId'),function(_0x1bc007){return _[_0x545e('0x89')](_0x381f18,_0x1bc007);});if(_0x40b10e){return _0x3ab27f['id'];}}}));}}return BPromise['all'](_0x477af8)[_0x545e('0x1e')](function(_0x5c0d42){_0x2fdc40=_(_0x2fdc40)[_0x545e('0x8a')](_0x5c0d42)[_0x545e('0x8b')]()[_0x545e('0x8c')]();return db[_0x545e('0x3c')][_0x545e('0x58')]({'where':{'id':_0x5e2a77[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](function(_0x593ff8){return db[_0x545e('0x85')]['transaction'](function(_0x1b5e53){return _0x593ff8[_0x545e('0x7b')](_0x5e2a77[_0x545e('0x41')]['ids'],{'transaction':_0x1b5e53})[_0x545e('0x1e')](function(){if(!_[_0x545e('0x8d')](_0x2fdc40)){return _0x593ff8[_0x545e('0x8e')](_0x2fdc40,{'transaction':_0x1b5e53});}})[_0x545e('0x1e')](function(){_0x2fdc40['forEach'](function(_0x40cb06){socket[_0x545e('0x7a')](_0x545e('0x8f'),{'UserId':_0x40cb06,'ChatQueueId':_0x593ff8['id']});});});});});});})[_0x545e('0x1e')](respondWithStatusCode(_0x615df3,null))[_0x545e('0x55')](handleError(_0x615df3,null));};exports[_0x545e('0x90')]=function(_0x2f9325,_0xdfa052,_0x2de526){return db['ChatQueue']['find']({'where':{'id':_0x2f9325[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0xdfa052,null))[_0x545e('0x1e')](function(_0x1de123){if(_0x1de123){return _0x1de123['addAgents'](_0x2f9325['body']['ids'],_[_0x545e('0x91')](_0x2f9325['body'],[_0x545e('0x7c'),'id'])||{})[_0x545e('0x92')](function(_0x293c6e){for(var _0x7c8ea8=0x0;_0x7c8ea8<_0x2f9325[_0x545e('0x5a')][_0x545e('0x7c')]['length'];_0x7c8ea8+=0x1){socket[_0x545e('0x7a')](_0x545e('0x93'),{'UserId':Number(_0x2f9325[_0x545e('0x5a')]['ids'][_0x7c8ea8]),'ChatQueueId':Number(_0x2f9325[_0x545e('0x57')]['id'])});}return _0x293c6e;});}})['then'](respondWithResult(_0xdfa052,null))[_0x545e('0x55')](handleError(_0xdfa052,null));};exports['removeAgents']=function(_0x4fdb00,_0x849de1,_0x2de4c9){return db['ChatQueue'][_0x545e('0x58')]({'where':{'id':_0x4fdb00[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0x849de1,null))[_0x545e('0x1e')](function(_0x38b30f){if(_0x38b30f){return _0x38b30f[_0x545e('0x8e')](_0x4fdb00[_0x545e('0x41')][_0x545e('0x7c')])['then'](function(){if(_['isArray'](_0x4fdb00[_0x545e('0x41')][_0x545e('0x7c')])){for(var _0x1c5216=0x0;_0x1c5216<_0x4fdb00[_0x545e('0x41')]['ids'][_0x545e('0x47')];_0x1c5216+=0x1){socket[_0x545e('0x7a')](_0x545e('0x8f'),{'UserId':Number(_0x4fdb00[_0x545e('0x41')][_0x545e('0x7c')][_0x1c5216]),'ChatQueueId':Number(_0x4fdb00['params']['id'])});}}else{socket[_0x545e('0x7a')](_0x545e('0x8f'),{'UserId':Number(_0x4fdb00[_0x545e('0x41')]['ids']),'ChatQueueId':Number(_0x4fdb00[_0x545e('0x57')]['id'])});}});}})[_0x545e('0x1e')](respondWithStatusCode(_0x849de1,null))[_0x545e('0x55')](handleError(_0x849de1,null));};exports[_0x545e('0x94')]=function(_0x4726ab,_0x5187e6,_0x5ceaef){var _0x1ffff4={};var _0x3e5bcb={};var _0x16770d;var _0x8c27e4;return db[_0x545e('0x3c')]['findOne']({'where':{'id':_0x4726ab[_0x545e('0x57')]['id']}})[_0x545e('0x1e')](handleEntityNotFound(_0x5187e6,null))[_0x545e('0x1e')](function(_0x1c6e93){if(_0x1c6e93){_0x16770d=_0x1c6e93;_0x3e5bcb['model']=_[_0x545e('0x42')](db[_0x545e('0x73')][_0x545e('0x3d')]);_0x3e5bcb[_0x545e('0x41')]=_[_0x545e('0x42')](_0x4726ab['query']);_0x3e5bcb[_0x545e('0x43')]=_[_0x545e('0x44')](_0x3e5bcb[_0x545e('0x40')],_0x3e5bcb[_0x545e('0x41')]);_0x1ffff4['attributes']=_[_0x545e('0x44')](_0x3e5bcb['model'],qs[_0x545e('0x45')](_0x4726ab[_0x545e('0x41')][_0x545e('0x45')]));_0x1ffff4['attributes']=_0x1ffff4[_0x545e('0x46')][_0x545e('0x47')]?_0x1ffff4['attributes']:_0x3e5bcb[_0x545e('0x40')];_0x1ffff4[_0x545e('0x49')]=qs['sort'](_0x4726ab[_0x545e('0x41')]['sort']);_0x1ffff4['where']=qs[_0x545e('0x43')](_[_0x545e('0x63')](_0x4726ab['query'],_0x3e5bcb[_0x545e('0x43')]));if(_0x4726ab[_0x545e('0x41')]['filter']){_0x1ffff4[_0x545e('0x4d')]=_[_0x545e('0x4c')](_0x1ffff4[_0x545e('0x4d')],{'$or':_[_0x545e('0x3b')](_0x1ffff4[_0x545e('0x46')],function(_0x5db194){var _0x58cc53={};_0x58cc53[_0x5db194]={'$like':'%'+_0x4726ab[_0x545e('0x41')]['filter']+'%'};return _0x58cc53;})});}_0x1ffff4=_[_0x545e('0x4c')]({},_0x1ffff4,_0x4726ab[_0x545e('0x50')]);return _0x16770d['getAgents'](_0x1ffff4);}})[_0x545e('0x1e')](function(_0x23cd8c){if(_0x23cd8c){_0x8c27e4=_0x23cd8c[_0x545e('0x47')];if(!_0x4726ab[_0x545e('0x41')]['hasOwnProperty'](_0x545e('0x71'))){_0x1ffff4[_0x545e('0x2c')]=qs[_0x545e('0x2c')](_0x4726ab[_0x545e('0x41')][_0x545e('0x2c')]);_0x1ffff4['offset']=qs[_0x545e('0x2a')](_0x4726ab[_0x545e('0x41')][_0x545e('0x2a')]);}return _0x16770d['getAgents'](_0x1ffff4);}})[_0x545e('0x1e')](function(_0x486ca0){if(_0x486ca0){return _0x486ca0?{'count':_0x8c27e4,'rows':_0x486ca0}:null;}})['then'](respondWithResult(_0x5187e6,null))[_0x545e('0x55')](handleError(_0x5187e6,null));};
\ No newline at end of file
index 81107e8..960e503 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe642=['hasOwnProperty','exports','events','ChatQueue','update','remove'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xe642,0x17c));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2e64('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x2e64('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e64('0x2'),'afterDestroy':_0x2e64('0x3')};function emitEvent(_0x1f09a4){return function(_0x3d2a0f,_0x3ebc35,_0x47c94c){ChatQueueEvents['emit'](_0x1f09a4+':'+_0x3d2a0f['id'],_0x3d2a0f);ChatQueueEvents['emit'](_0x1f09a4,_0x3d2a0f);_0x47c94c(null);};}for(var e in events){if(events[_0x2e64('0x4')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x2e64('0x5')]=ChatQueueEvents;
\ No newline at end of file
+var _0x8776=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x8776,0x136));var _0x6877=function(_0x50caa0,_0x2431be){_0x50caa0=_0x50caa0-0x0;var _0x11b0c9=_0x8776[_0x50caa0];return _0x11b0c9;};'use strict';var EventEmitter=require(_0x6877('0x0'));var ChatQueue=require(_0x6877('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6877('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6877('0x3'),'afterDestroy':_0x6877('0x4')};function emitEvent(_0x56e779){return function(_0x1340f1,_0x1a878a,_0x51af65){ChatQueueEvents[_0x6877('0x5')](_0x56e779+':'+_0x1340f1['id'],_0x1340f1);ChatQueueEvents[_0x6877('0x5')](_0x56e779,_0x1340f1);_0x51af65(null);};}for(var e in events){if(events[_0x6877('0x6')](e)){var event=events[e];ChatQueue[_0x6877('0x7')](e,emitEvent(event));}}module[_0x6877('0x8')]=ChatQueueEvents;
\ No newline at end of file
index a58c517..f5c8ca2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d11=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3ab693,_0x302b18){var _0x11bd7c=function(_0x51a114){while(--_0x51a114){_0x3ab693['push'](_0x3ab693['shift']());}};_0x11bd7c(++_0x302b18);}(_0x7d11,0x1c2));var _0x17d1=function(_0x4fbb6e,_0x416dbc){_0x4fbb6e=_0x4fbb6e-0x0;var _0x1f55ad=_0x7d11[_0x4fbb6e];return _0x1f55ad;};'use strict';var _=require(_0x17d1('0x0'));var util=require(_0x17d1('0x1'));var logger=require(_0x17d1('0x2'))(_0x17d1('0x3'));var moment=require(_0x17d1('0x4'));var BPromise=require(_0x17d1('0x5'));var rp=require(_0x17d1('0x6'));var fs=require('fs');var path=require(_0x17d1('0x7'));var rimraf=require(_0x17d1('0x8'));var config=require(_0x17d1('0x9'));var attributes=require(_0x17d1('0xa'));module[_0x17d1('0xb')]=function(_0x4ff858,_0x3dfd2a){return _0x4ff858['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc3af=['ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define'];(function(_0x1dc4cb,_0x36ea79){var _0x53052e=function(_0x2e3d96){while(--_0x2e3d96){_0x1dc4cb['push'](_0x1dc4cb['shift']());}};_0x53052e(++_0x36ea79);}(_0xc3af,0x17b));var _0xfc3a=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0xc3af[_0x538c70];return _0x42ae01;};'use strict';var _=require('lodash');var util=require(_0xfc3a('0x0'));var logger=require(_0xfc3a('0x1'))(_0xfc3a('0x2'));var moment=require(_0xfc3a('0x3'));var BPromise=require(_0xfc3a('0x4'));var rp=require(_0xfc3a('0x5'));var fs=require('fs');var path=require(_0xfc3a('0x6'));var rimraf=require(_0xfc3a('0x7'));var config=require(_0xfc3a('0x8'));var attributes=require(_0xfc3a('0x9'));module['exports']=function(_0x2a5d49,_0xac7f1f){return _0x2a5d49[_0xfc3a('0xa')](_0xfc3a('0xb'),attributes,{'tableName':_0xfc3a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ed14b5a..b487dd2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2250=['client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ChatQueue','findAll','options','where','attributes','map','include','model','info','GetChatQueue','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x446103,_0x3b10e3){var _0x25c8cd=function(_0x39c046){while(--_0x39c046){_0x446103['push'](_0x446103['shift']());}};_0x25c8cd(++_0x3b10e3);}(_0x2250,0x178));var _0x0225=function(_0x12fde3,_0x4800c6){_0x12fde3=_0x12fde3-0x0;var _0x521038=_0x2250[_0x12fde3];return _0x521038;};'use strict';var _=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var moment=require(_0x0225('0x2'));var BPromise=require(_0x0225('0x3'));var rs=require(_0x0225('0x4'));var fs=require('fs');var Redis=require(_0x0225('0x5'));var db=require(_0x0225('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0225('0x7'))(_0x0225('0x8'));var config=require(_0x0225('0x9'));var jayson=require(_0x0225('0xa'));var client=jayson[_0x0225('0xb')][_0x0225('0xc')]({'port':0x232a});config[_0x0225('0xd')]=_[_0x0225('0xe')](config['redis'],{'host':_0x0225('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0225('0x10'))[_0x0225('0x11')](socket);function respondWithRpcPromise(_0x5ad1de,_0x27b060,_0x2cc6dd){return new BPromise(function(_0x4bcde6,_0x4428e6){return client[_0x0225('0x12')](_0x5ad1de,_0x2cc6dd)[_0x0225('0x13')](function(_0x679615){logger['info'](_0x0225('0x14'),_0x27b060,'request\x20sent');logger[_0x0225('0x15')](_0x0225('0x16'),_0x27b060,'request\x20sent',JSON[_0x0225('0x17')](_0x679615));if(_0x679615[_0x0225('0x18')]){if(_0x679615[_0x0225('0x18')][_0x0225('0x19')]===0x1f4){logger[_0x0225('0x18')](_0x0225('0x14'),_0x27b060,_0x679615[_0x0225('0x18')][_0x0225('0x1a')]);return _0x4428e6(_0x679615[_0x0225('0x18')][_0x0225('0x1a')]);}logger[_0x0225('0x18')]('ChatQueue,\x20%s,\x20%s',_0x27b060,_0x679615[_0x0225('0x18')][_0x0225('0x1a')]);return _0x4bcde6(_0x679615['error'][_0x0225('0x1a')]);}else{logger['info'](_0x0225('0x14'),_0x27b060,_0x0225('0x1b'));_0x4bcde6(_0x679615[_0x0225('0x1c')][_0x0225('0x1a')]);}})[_0x0225('0x1d')](function(_0x5ec4ac){logger[_0x0225('0x18')]('ChatQueue,\x20%s,\x20%s',_0x27b060,_0x5ec4ac);_0x4428e6(_0x5ec4ac);});});}exports['GetChatQueue']=function(_0x4bcccf){var _0x465672=this;return new Promise(function(_0x46a72c,_0x22fed3){return db[_0x0225('0x1e')][_0x0225('0x1f')]({'raw':_0x4bcccf[_0x0225('0x20')]?_0x4bcccf[_0x0225('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4bcccf[_0x0225('0x20')]?_0x4bcccf[_0x0225('0x20')][_0x0225('0x21')]||null:null,'attributes':_0x4bcccf['options']?_0x4bcccf['options'][_0x0225('0x22')]||null:null,'limit':_0x4bcccf['options']?_0x4bcccf['options']['limit']||null:null,'include':_0x4bcccf['options']?_0x4bcccf[_0x0225('0x20')]['include']?_[_0x0225('0x23')](_0x4bcccf[_0x0225('0x20')][_0x0225('0x24')],function(_0x2a4b31){return{'model':db[_0x2a4b31[_0x0225('0x25')]],'as':_0x2a4b31['as'],'attributes':_0x2a4b31[_0x0225('0x22')],'include':_0x2a4b31[_0x0225('0x24')]?_['map'](_0x2a4b31[_0x0225('0x24')],function(_0xb193c5){return{'model':db[_0xb193c5[_0x0225('0x25')]],'as':_0xb193c5['as'],'attributes':_0xb193c5[_0x0225('0x22')],'include':_0xb193c5['include']?_['map'](_0xb193c5['include'],function(_0x1c44d5){return{'model':db[_0x1c44d5['model']],'as':_0x1c44d5['as'],'attributes':_0x1c44d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x0225('0x13')](function(_0x4eb9ab){logger[_0x0225('0x26')]('GetChatQueue',_0x4bcccf);logger[_0x0225('0x15')]('GetChatQueue',_0x4bcccf,JSON[_0x0225('0x17')](_0x4eb9ab));_0x46a72c(_0x4eb9ab);})[_0x0225('0x1d')](function(_0x3b793a){logger[_0x0225('0x18')](_0x0225('0x27'),_0x3b793a['message'],_0x4bcccf);_0x22fed3(_0x465672[_0x0225('0x18')](0x1f4,_0x3b793a[_0x0225('0x1a')]));});});};exports[_0x0225('0x28')]=function(_0x45d587){var _0x4ab5a8=this;return new Promise(function(_0x36e02a,_0x241631){return db['ChatQueue'][_0x0225('0x29')]({'raw':_0x45d587[_0x0225('0x20')]?_0x45d587[_0x0225('0x20')][_0x0225('0x2a')]===undefined?!![]:![]:!![],'where':_0x45d587[_0x0225('0x20')]?_0x45d587[_0x0225('0x20')]['where']||null:null,'attributes':_0x45d587[_0x0225('0x20')]?_0x45d587['options']['attributes']||null:null,'include':_0x45d587[_0x0225('0x20')]?_0x45d587['options']['include']?_[_0x0225('0x23')](_0x45d587['options'][_0x0225('0x24')],function(_0x54dff4){return{'model':db[_0x54dff4[_0x0225('0x25')]],'as':_0x54dff4['as'],'attributes':_0x54dff4[_0x0225('0x22')],'include':_0x54dff4[_0x0225('0x24')]?_['map'](_0x54dff4[_0x0225('0x24')],function(_0x61f1fe){return{'model':db[_0x61f1fe[_0x0225('0x25')]],'as':_0x61f1fe['as'],'attributes':_0x61f1fe[_0x0225('0x22')],'include':_0x61f1fe[_0x0225('0x24')]?_[_0x0225('0x23')](_0x61f1fe[_0x0225('0x24')],function(_0x2e0bd1){return{'model':db[_0x2e0bd1['model']],'as':_0x2e0bd1['as'],'attributes':_0x2e0bd1['attributes']};}):[]};}):[]};}):[]:[]})[_0x0225('0x13')](function(_0x375958){logger[_0x0225('0x26')](_0x0225('0x28'),_0x45d587);logger[_0x0225('0x15')](_0x0225('0x28'),_0x45d587,JSON[_0x0225('0x17')](_0x375958));_0x36e02a(_0x375958);})['catch'](function(_0x44f675){logger['error'](_0x0225('0x28'),_0x44f675[_0x0225('0x1a')],_0x45d587);_0x241631(_0x4ab5a8[_0x0225('0x18')](0x1f4,_0x44f675[_0x0225('0x1a')]));});});};
\ No newline at end of file
+var _0xbbdd=['debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowChatQueue','find','where','util','bluebird','randomstring','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then'];(function(_0x370de9,_0x57af01){var _0x1a43ee=function(_0x6a9748){while(--_0x6a9748){_0x370de9['push'](_0x370de9['shift']());}};_0x1a43ee(++_0x57af01);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbbdd[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var moment=require('moment');var BPromise=require(_0xdbbd('0x1'));var rs=require(_0xdbbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbbd('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdbbd('0x4'));var client=jayson[_0xdbbd('0x5')][_0xdbbd('0x6')]({'port':0x232a});config[_0xdbbd('0x7')]=_['defaults'](config[_0xdbbd('0x7')],{'host':_0xdbbd('0x8'),'port':0x18eb});var socket=require(_0xdbbd('0x9'))(new Redis(config[_0xdbbd('0x7')]));require(_0xdbbd('0xa'))[_0xdbbd('0xb')](socket);function respondWithRpcPromise(_0xb6e63e,_0x1e451b,_0xb79629){return new BPromise(function(_0x11e656,_0x59c6af){return client[_0xdbbd('0xc')](_0xb6e63e,_0xb79629)[_0xdbbd('0xd')](function(_0x564f47){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1e451b,'request\x20sent');logger[_0xdbbd('0xe')](_0xdbbd('0xf'),_0x1e451b,_0xdbbd('0x10'),JSON[_0xdbbd('0x11')](_0x564f47));if(_0x564f47[_0xdbbd('0x12')]){if(_0x564f47[_0xdbbd('0x12')][_0xdbbd('0x13')]===0x1f4){logger['error'](_0xdbbd('0x14'),_0x1e451b,_0x564f47[_0xdbbd('0x12')]['message']);return _0x59c6af(_0x564f47[_0xdbbd('0x12')][_0xdbbd('0x15')]);}logger[_0xdbbd('0x12')](_0xdbbd('0x14'),_0x1e451b,_0x564f47['error'][_0xdbbd('0x15')]);return _0x11e656(_0x564f47[_0xdbbd('0x12')]['message']);}else{logger[_0xdbbd('0x16')](_0xdbbd('0x14'),_0x1e451b,_0xdbbd('0x10'));_0x11e656(_0x564f47[_0xdbbd('0x17')][_0xdbbd('0x15')]);}})['catch'](function(_0x5b266a){logger['error'](_0xdbbd('0x14'),_0x1e451b,_0x5b266a);_0x59c6af(_0x5b266a);});});}exports[_0xdbbd('0x18')]=function(_0x16a0d0){var _0x452b83=this;return new Promise(function(_0x10aad4,_0x5bdddc){return db[_0xdbbd('0x19')][_0xdbbd('0x1a')]({'raw':_0x16a0d0[_0xdbbd('0x1b')]?_0x16a0d0[_0xdbbd('0x1b')][_0xdbbd('0x1c')]===undefined?!![]:![]:!![],'where':_0x16a0d0[_0xdbbd('0x1b')]?_0x16a0d0['options']['where']||null:null,'attributes':_0x16a0d0[_0xdbbd('0x1b')]?_0x16a0d0['options'][_0xdbbd('0x1d')]||null:null,'limit':_0x16a0d0[_0xdbbd('0x1b')]?_0x16a0d0[_0xdbbd('0x1b')][_0xdbbd('0x1e')]||null:null,'include':_0x16a0d0['options']?_0x16a0d0[_0xdbbd('0x1b')][_0xdbbd('0x1f')]?_[_0xdbbd('0x20')](_0x16a0d0['options'][_0xdbbd('0x1f')],function(_0x74f84c){return{'model':db[_0x74f84c[_0xdbbd('0x21')]],'as':_0x74f84c['as'],'attributes':_0x74f84c[_0xdbbd('0x1d')],'include':_0x74f84c[_0xdbbd('0x1f')]?_[_0xdbbd('0x20')](_0x74f84c['include'],function(_0xeaa316){return{'model':db[_0xeaa316[_0xdbbd('0x21')]],'as':_0xeaa316['as'],'attributes':_0xeaa316[_0xdbbd('0x1d')],'include':_0xeaa316[_0xdbbd('0x1f')]?_[_0xdbbd('0x20')](_0xeaa316[_0xdbbd('0x1f')],function(_0x22d6cc){return{'model':db[_0x22d6cc['model']],'as':_0x22d6cc['as'],'attributes':_0x22d6cc[_0xdbbd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb9383c){logger['info'](_0xdbbd('0x18'),_0x16a0d0);logger[_0xdbbd('0xe')]('GetChatQueue',_0x16a0d0,JSON[_0xdbbd('0x11')](_0xb9383c));_0x10aad4(_0xb9383c);})[_0xdbbd('0x22')](function(_0x107c08){logger[_0xdbbd('0x12')](_0xdbbd('0x18'),_0x107c08[_0xdbbd('0x15')],_0x16a0d0);_0x5bdddc(_0x452b83[_0xdbbd('0x12')](0x1f4,_0x107c08[_0xdbbd('0x15')]));});});};exports[_0xdbbd('0x23')]=function(_0x22411e){var _0x4a9618=this;return new Promise(function(_0x35e87a,_0x3c5d79){return db[_0xdbbd('0x19')][_0xdbbd('0x24')]({'raw':_0x22411e[_0xdbbd('0x1b')]?_0x22411e['options'][_0xdbbd('0x1c')]===undefined?!![]:![]:!![],'where':_0x22411e[_0xdbbd('0x1b')]?_0x22411e[_0xdbbd('0x1b')][_0xdbbd('0x25')]||null:null,'attributes':_0x22411e[_0xdbbd('0x1b')]?_0x22411e['options'][_0xdbbd('0x1d')]||null:null,'include':_0x22411e[_0xdbbd('0x1b')]?_0x22411e[_0xdbbd('0x1b')][_0xdbbd('0x1f')]?_[_0xdbbd('0x20')](_0x22411e['options'][_0xdbbd('0x1f')],function(_0x5e26bc){return{'model':db[_0x5e26bc[_0xdbbd('0x21')]],'as':_0x5e26bc['as'],'attributes':_0x5e26bc[_0xdbbd('0x1d')],'include':_0x5e26bc['include']?_[_0xdbbd('0x20')](_0x5e26bc[_0xdbbd('0x1f')],function(_0xb95dd8){return{'model':db[_0xb95dd8[_0xdbbd('0x21')]],'as':_0xb95dd8['as'],'attributes':_0xb95dd8['attributes'],'include':_0xb95dd8['include']?_[_0xdbbd('0x20')](_0xb95dd8[_0xdbbd('0x1f')],function(_0x2cb1af){return{'model':db[_0x2cb1af[_0xdbbd('0x21')]],'as':_0x2cb1af['as'],'attributes':_0x2cb1af[_0xdbbd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdbbd('0xd')](function(_0x55a526){logger['info'](_0xdbbd('0x23'),_0x22411e);logger[_0xdbbd('0xe')]('ShowChatQueue',_0x22411e,JSON[_0xdbbd('0x11')](_0x55a526));_0x35e87a(_0x55a526);})[_0xdbbd('0x22')](function(_0x55b71b){logger[_0xdbbd('0x12')](_0xdbbd('0x23'),_0x55b71b[_0xdbbd('0x15')],_0x22411e);_0x3c5d79(_0x4a9618['error'](0x1f4,_0x55b71b[_0xdbbd('0x15')]));});});};
\ No newline at end of file
index 070a5f9..e826f22 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ad3=['register','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0x5ad3[_0x19a5d8];return _0x30104a;};'use strict';var ChatQueueEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){ChatQueueEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);ChatQueueEvents['on'](_0x292521,_0x3cec3e);}};
\ No newline at end of file
+var _0xb4e6=['removeListener','register','./chatQueue.events','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xb4e6[_0x1b64dd];return _0xeb464c;};'use strict';var ChatQueueEvents=require(_0x6b4e('0x0'));var events=['save',_0x6b4e('0x1'),_0x6b4e('0x2')];function createListener(_0x365912,_0x25ffcb){return function(_0x44e781){_0x25ffcb[_0x6b4e('0x3')](_0x365912,_0x44e781);};}function removeListener(_0x1929b8,_0x52313b){return function(){ChatQueueEvents[_0x6b4e('0x4')](_0x1929b8,_0x52313b);};}exports[_0x6b4e('0x5')]=function(_0x1f67a2){for(var _0x49de51=0x0,_0xd3138f=events['length'];_0x49de51<_0xd3138f;_0x49de51++){var _0x4f00be=events[_0x49de51];var _0x2311d9=createListener('chatQueue:'+_0x4f00be,_0x1f67a2);ChatQueueEvents['on'](_0x4f00be,_0x2311d9);}};
\ No newline at end of file
index 7db6151..72b77d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5dbfe2,_0x2c9d92){var _0x113288=function(_0x54be60){while(--_0x54be60){_0x5dbfe2['push'](_0x5dbfe2['shift']());}};_0x113288(++_0x2c9d92);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router;
\ No newline at end of file
+var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5835c8,_0x558720){var _0x46ab91=function(_0x9b79bc){while(--_0x9b79bc){_0x5835c8['push'](_0x5835c8['shift']());}};_0x46ab91(++_0x558720);}(_0x55ca,0x126));var _0xa55c=function(_0x160cd5,_0x19c58e){_0x160cd5=_0x160cd5-0x0;var _0x366763=_0x55ca[_0x160cd5];return _0x366763;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router;
\ No newline at end of file
index d212448..fcca0e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x642b=['STRING','DATE','sequelize','exports'];(function(_0x299596,_0x58887e){var _0x129643=function(_0x2ea838){while(--_0x2ea838){_0x299596['push'](_0x299596['shift']());}};_0x129643(++_0x58887e);}(_0x642b,0x196));var _0xb642=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x642b[_0x1928c9];return _0x51b5fb;};'use strict';var moment=require('moment');var Sequelize=require(_0xb642('0x0'));module[_0xb642('0x1')]={'uniqueid':{'type':Sequelize[_0xb642('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb642('0x2')]},'joinAt':{'type':Sequelize[_0xb642('0x3')]},'leaveAt':{'type':Sequelize[_0xb642('0x3')]},'acceptAt':{'type':Sequelize[_0xb642('0x3')]},'exitAt':{'type':Sequelize[_0xb642('0x3')]},'reason':{'type':Sequelize[_0xb642('0x2')]}};
\ No newline at end of file
+var _0x8f1e=['STRING','DATE','moment','sequelize'];(function(_0x5be89a,_0x2ffb4d){var _0x227621=function(_0x30caef){while(--_0x30caef){_0x5be89a['push'](_0x5be89a['shift']());}};_0x227621(++_0x2ffb4d);}(_0x8f1e,0xc2));var _0xe8f1=function(_0x12dfcb,_0xadf711){_0x12dfcb=_0x12dfcb-0x0;var _0x44e38d=_0x8f1e[_0x12dfcb];return _0x44e38d;};'use strict';var moment=require(_0xe8f1('0x0'));var Sequelize=require(_0xe8f1('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe8f1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe8f1('0x2')]},'joinAt':{'type':Sequelize[_0xe8f1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe8f1('0x3')]},'exitAt':{'type':Sequelize[_0xe8f1('0x3')]},'reason':{'type':Sequelize[_0xe8f1('0x2')]}};
\ No newline at end of file
index 20619af..8a4ad6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x539d=['squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0xc689c7,_0x63165a){var _0x535e43=function(_0x429c8b){while(--_0x429c8b){_0xc689c7['push'](_0xc689c7['shift']());}};_0x535e43(++_0x63165a);}(_0x539d,0x17b));var _0xd539=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x539d[_0x1a5946];return _0x25e9d5;};'use strict';var emlformat=require(_0xd539('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd539('0x1'));var jsonpatch=require(_0xd539('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd539('0x3'));var Mustache=require(_0xd539('0x4'));var util=require(_0xd539('0x5'));var path=require(_0xd539('0x6'));var sox=require(_0xd539('0x7'));var csv=require('to-csv');var ejs=require(_0xd539('0x8'));var fs=require('fs');var fs_extra=require(_0xd539('0x9'));var _=require(_0xd539('0xa'));var squel=require(_0xd539('0xb'));var crypto=require(_0xd539('0xc'));var jsforce=require(_0xd539('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd539('0xe'));var querystring=require(_0xd539('0xf'));var Papa=require(_0xd539('0x10'));var Redis=require(_0xd539('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd539('0x12'));var hardwareService=require(_0xd539('0x13'));var logger=require(_0xd539('0x14'))(_0xd539('0x15'));var utils=require(_0xd539('0x16'));var config=require(_0xd539('0x17'));var licenseUtil=require(_0xd539('0x18'));var db=require(_0xd539('0x19'))['db'];function respondWithStatusCode(_0x5209f2,_0x17cbc0){_0x17cbc0=_0x17cbc0||0xcc;return function(_0x1a4645){if(_0x1a4645){return _0x5209f2[_0xd539('0x1a')](_0x17cbc0);}return _0x5209f2[_0xd539('0x1b')](_0x17cbc0)[_0xd539('0x1c')]();};}function respondWithResult(_0xac445e,_0x54706f){_0x54706f=_0x54706f||0xc8;return function(_0x278f49){if(_0x278f49){return _0xac445e[_0xd539('0x1b')](_0x54706f)[_0xd539('0x1d')](_0x278f49);}};}function respondWithFilteredResult(_0x3f402e,_0x23bce1){return function(_0x7b2b41){if(_0x7b2b41){var _0x30aea1=typeof _0x23bce1[_0xd539('0x1e')]===_0xd539('0x1f')&&typeof _0x23bce1[_0xd539('0x20')]===_0xd539('0x1f');var _0x54d8ff=_0x7b2b41[_0xd539('0x21')];var _0x41fb1e=_0x30aea1?0x0:_0x23bce1[_0xd539('0x1e')];var _0x99327a=_0x30aea1?_0x7b2b41[_0xd539('0x21')]:_0x23bce1[_0xd539('0x1e')]+_0x23bce1[_0xd539('0x20')];var _0x1714cf;if(_0x99327a>=_0x54d8ff){_0x99327a=_0x54d8ff;_0x1714cf=0xc8;}else{_0x1714cf=0xce;}_0x3f402e['status'](_0x1714cf);return _0x3f402e['set'](_0xd539('0x22'),_0x41fb1e+'-'+_0x99327a+'/'+_0x54d8ff)[_0xd539('0x1d')](_0x7b2b41);}return null;};}function patchUpdates(_0x3edf97){return function(_0xad186e){try{jsonpatch['apply'](_0xad186e,_0x3edf97,!![]);}catch(_0x91917b){return BPromise[_0xd539('0x23')](_0x91917b);}return _0xad186e[_0xd539('0x24')]();};}function saveUpdates(_0x259dde,_0x11c993){return function(_0x13445e){if(_0x13445e){return _0x13445e[_0xd539('0x25')](_0x259dde)[_0xd539('0x26')](function(_0x349610){return _0x349610;});}return null;};}function removeEntity(_0x56c100,_0x28d376){return function(_0x57789d){if(_0x57789d){return _0x57789d[_0xd539('0x27')]()['then'](function(){_0x56c100['status'](0xcc)[_0xd539('0x1c')]();});}};}function handleEntityNotFound(_0xfd3352,_0x1280c2){return function(_0xc1789e){if(!_0xc1789e){_0xfd3352['sendStatus'](0x194);}return _0xc1789e;};}function handleError(_0x39cef1,_0x495161){_0x495161=_0x495161||0x1f4;return function(_0x1343de){logger[_0xd539('0x28')](_0x1343de[_0xd539('0x29')]);if(_0x1343de[_0xd539('0x2a')]){delete _0x1343de['name'];}_0x39cef1['status'](_0x495161)[_0xd539('0x2b')](_0x1343de);};}exports[_0xd539('0x2c')]=function(_0x4f717b,_0x54b57a){var _0x575b63={},_0xe17d1c={},_0x406710={'count':0x0,'rows':[]};var _0x66b2ab=_[_0xd539('0x2d')](db['ChatQueueReport'][_0xd539('0x2e')],function(_0x2662fe){return{'name':_0x2662fe['fieldName'],'type':_0x2662fe[_0xd539('0x2f')][_0xd539('0x30')]};});_0xe17d1c[_0xd539('0x31')]=_[_0xd539('0x2d')](_0x66b2ab,_0xd539('0x2a'));_0xe17d1c['query']=_[_0xd539('0x32')](_0x4f717b['query']);_0xe17d1c[_0xd539('0x33')]=_['intersection'](_0xe17d1c[_0xd539('0x31')],_0xe17d1c['query']);_0x575b63[_0xd539('0x34')]=_[_0xd539('0x35')](_0xe17d1c[_0xd539('0x31')],qs[_0xd539('0x36')](_0x4f717b[_0xd539('0x37')][_0xd539('0x36')]));_0x575b63[_0xd539('0x34')]=_0x575b63[_0xd539('0x34')][_0xd539('0x38')]?_0x575b63[_0xd539('0x34')]:_0xe17d1c[_0xd539('0x31')];if(!_0x4f717b['query'][_0xd539('0x39')]('nolimit')){_0x575b63[_0xd539('0x20')]=qs[_0xd539('0x20')](_0x4f717b['query'][_0xd539('0x20')]);_0x575b63[_0xd539('0x1e')]=qs['offset'](_0x4f717b['query'][_0xd539('0x1e')]);}_0x575b63[_0xd539('0x3a')]=qs[_0xd539('0x3b')](_0x4f717b[_0xd539('0x37')]['sort']);_0x575b63[_0xd539('0x3c')]=qs[_0xd539('0x33')](_[_0xd539('0x3d')](_0x4f717b[_0xd539('0x37')],_0xe17d1c['filters']),_0x66b2ab);if(_0x4f717b[_0xd539('0x37')][_0xd539('0x3e')]){_0x575b63[_0xd539('0x3c')]=_[_0xd539('0x3f')](_0x575b63[_0xd539('0x3c')],{'$or':_[_0xd539('0x2d')](_0x66b2ab,function(_0x4b5059){if(_0x4b5059['type']!==_0xd539('0x40')){var _0x46eb3f={};_0x46eb3f[_0x4b5059[_0xd539('0x2a')]]={'$like':'%'+_0x4f717b[_0xd539('0x37')]['filter']+'%'};return _0x46eb3f;}})});}_0x575b63=_[_0xd539('0x3f')]({},_0x575b63,_0x4f717b[_0xd539('0x41')]);var _0x14175f={'where':_0x575b63['where']};return db[_0xd539('0x42')]['count'](_0x14175f)[_0xd539('0x26')](function(_0x4b44cf){_0x406710[_0xd539('0x21')]=_0x4b44cf;if(_0x4f717b['query']['includeAll']){_0x575b63[_0xd539('0x43')]=[{'all':!![]}];}return db[_0xd539('0x42')][_0xd539('0x44')](_0x575b63);})[_0xd539('0x26')](function(_0x1917c4){_0x406710[_0xd539('0x45')]=_0x1917c4;return _0x406710;})['then'](respondWithFilteredResult(_0x54b57a,_0x575b63))[_0xd539('0x46')](handleError(_0x54b57a,null));};exports[_0xd539('0x47')]=function(_0x24d43,_0x5d1d2c){var _0x3e9320={'raw':!![],'where':{'id':_0x24d43['params']['id']}},_0x53ea3f={};_0x53ea3f[_0xd539('0x31')]=_[_0xd539('0x32')](db[_0xd539('0x42')][_0xd539('0x2e')]);_0x53ea3f['query']=_[_0xd539('0x32')](_0x24d43[_0xd539('0x37')]);_0x53ea3f[_0xd539('0x33')]=_[_0xd539('0x35')](_0x53ea3f['model'],_0x53ea3f[_0xd539('0x37')]);_0x3e9320[_0xd539('0x34')]=_['intersection'](_0x53ea3f[_0xd539('0x31')],qs[_0xd539('0x36')](_0x24d43[_0xd539('0x37')][_0xd539('0x36')]));_0x3e9320['attributes']=_0x3e9320[_0xd539('0x34')][_0xd539('0x38')]?_0x3e9320[_0xd539('0x34')]:_0x53ea3f[_0xd539('0x31')];if(_0x24d43[_0xd539('0x37')][_0xd539('0x48')]){_0x3e9320[_0xd539('0x43')]=[{'all':!![]}];}_0x3e9320=_[_0xd539('0x3f')]({},_0x3e9320,_0x24d43[_0xd539('0x41')]);return db[_0xd539('0x42')]['find'](_0x3e9320)[_0xd539('0x26')](handleEntityNotFound(_0x5d1d2c,null))[_0xd539('0x26')](respondWithResult(_0x5d1d2c,null))[_0xd539('0x46')](handleError(_0x5d1d2c,null));};exports[_0xd539('0x49')]=function(_0x4f72f7,_0x3c5e1a){return db[_0xd539('0x42')][_0xd539('0x49')](_0x4f72f7[_0xd539('0x4a')],{})[_0xd539('0x26')](respondWithResult(_0x3c5e1a,0xc9))[_0xd539('0x46')](handleError(_0x3c5e1a,null));};exports[_0xd539('0x25')]=function(_0x5e1051,_0x2e47ed){if(_0x5e1051[_0xd539('0x4a')]['id']){delete _0x5e1051[_0xd539('0x4a')]['id'];}return db[_0xd539('0x42')][_0xd539('0x4b')]({'where':{'id':_0x5e1051[_0xd539('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e47ed,null))[_0xd539('0x26')](saveUpdates(_0x5e1051[_0xd539('0x4a')],null))['then'](respondWithResult(_0x2e47ed,null))['catch'](handleError(_0x2e47ed,null));};exports[_0xd539('0x27')]=function(_0x735b36,_0x5caf42){return db[_0xd539('0x42')][_0xd539('0x4b')]({'where':{'id':_0x735b36[_0xd539('0x4c')]['id']}})[_0xd539('0x26')](handleEntityNotFound(_0x5caf42,null))['then'](removeEntity(_0x5caf42,null))[_0xd539('0x46')](handleError(_0x5caf42,null));};exports[_0xd539('0x4d')]=function(_0x2965df,_0x2b794c){return db['ChatQueueReport'][_0xd539('0x4d')]()[_0xd539('0x26')](respondWithResult(_0x2b794c,null))[_0xd539('0x46')](handleError(_0x2b794c,null));};
\ No newline at end of file
+var _0xe451=['count','update','then','destroy','sendStatus','error','name','send','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit'];(function(_0x34049f,_0xec089){var _0x372ce1=function(_0x2ab598){while(--_0x2ab598){_0x34049f['push'](_0x34049f['shift']());}};_0x372ce1(++_0xec089);}(_0xe451,0xec));var _0x1e45=function(_0x3a9e5d,_0x251378){_0x3a9e5d=_0x3a9e5d-0x0;var _0x35c9f0=_0xe451[_0x3a9e5d];return _0x35c9f0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e45('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e45('0x1'));var Mustache=require(_0x1e45('0x2'));var util=require(_0x1e45('0x3'));var path=require(_0x1e45('0x4'));var sox=require('sox');var csv=require(_0x1e45('0x5'));var ejs=require(_0x1e45('0x6'));var fs=require('fs');var fs_extra=require(_0x1e45('0x7'));var _=require('lodash');var squel=require(_0x1e45('0x8'));var crypto=require(_0x1e45('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e45('0x5'));var querystring=require(_0x1e45('0xa'));var Papa=require(_0x1e45('0xb'));var Redis=require('ioredis');var authService=require(_0x1e45('0xc'));var qs=require(_0x1e45('0xd'));var as=require(_0x1e45('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e45('0xf'));var utils=require(_0x1e45('0x10'));var config=require(_0x1e45('0x11'));var licenseUtil=require(_0x1e45('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cafc,_0x2ec564){_0x2ec564=_0x2ec564||0xcc;return function(_0x3d25a8){if(_0x3d25a8){return _0x16cafc['sendStatus'](_0x2ec564);}return _0x16cafc[_0x1e45('0x13')](_0x2ec564)[_0x1e45('0x14')]();};}function respondWithResult(_0x31215a,_0x21f68d){_0x21f68d=_0x21f68d||0xc8;return function(_0x5b3ee1){if(_0x5b3ee1){return _0x31215a[_0x1e45('0x13')](_0x21f68d)['json'](_0x5b3ee1);}};}function respondWithFilteredResult(_0xf66042,_0x2c7ace){return function(_0x4e1400){if(_0x4e1400){var _0xfdeae3=typeof _0x2c7ace[_0x1e45('0x15')]===_0x1e45('0x16')&&typeof _0x2c7ace[_0x1e45('0x17')]===_0x1e45('0x16');var _0x308c29=_0x4e1400[_0x1e45('0x18')];var _0x2a6f47=_0xfdeae3?0x0:_0x2c7ace[_0x1e45('0x15')];var _0x5d24a7=_0xfdeae3?_0x4e1400[_0x1e45('0x18')]:_0x2c7ace['offset']+_0x2c7ace['limit'];var _0x17c63a;if(_0x5d24a7>=_0x308c29){_0x5d24a7=_0x308c29;_0x17c63a=0xc8;}else{_0x17c63a=0xce;}_0xf66042['status'](_0x17c63a);return _0xf66042['set']('Content-Range',_0x2a6f47+'-'+_0x5d24a7+'/'+_0x308c29)['json'](_0x4e1400);}return null;};}function patchUpdates(_0x207335){return function(_0x4476eb){try{jsonpatch['apply'](_0x4476eb,_0x207335,!![]);}catch(_0xc0deec){return BPromise['reject'](_0xc0deec);}return _0x4476eb['save']();};}function saveUpdates(_0x41cfae,_0x59aaa7){return function(_0x4ffe97){if(_0x4ffe97){return _0x4ffe97[_0x1e45('0x19')](_0x41cfae)[_0x1e45('0x1a')](function(_0x4ce4c5){return _0x4ce4c5;});}return null;};}function removeEntity(_0x48209a,_0x2fb478){return function(_0x40c216){if(_0x40c216){return _0x40c216[_0x1e45('0x1b')]()[_0x1e45('0x1a')](function(){_0x48209a[_0x1e45('0x13')](0xcc)[_0x1e45('0x14')]();});}};}function handleEntityNotFound(_0x55e968,_0x3f6771){return function(_0x394f7e){if(!_0x394f7e){_0x55e968[_0x1e45('0x1c')](0x194);}return _0x394f7e;};}function handleError(_0x25b131,_0x1a8355){_0x1a8355=_0x1a8355||0x1f4;return function(_0xfd7633){logger[_0x1e45('0x1d')](_0xfd7633['stack']);if(_0xfd7633[_0x1e45('0x1e')]){delete _0xfd7633[_0x1e45('0x1e')];}_0x25b131[_0x1e45('0x13')](_0x1a8355)[_0x1e45('0x1f')](_0xfd7633);};}exports['index']=function(_0xe7cdcf,_0x34046e){var _0x3dd6c3={},_0x5229e7={},_0x3def67={'count':0x0,'rows':[]};var _0x4a04aa=_[_0x1e45('0x20')](db['ChatQueueReport']['rawAttributes'],function(_0x34d75e){return{'name':_0x34d75e[_0x1e45('0x21')],'type':_0x34d75e[_0x1e45('0x22')][_0x1e45('0x23')]};});_0x5229e7['model']=_[_0x1e45('0x20')](_0x4a04aa,'name');_0x5229e7[_0x1e45('0x24')]=_[_0x1e45('0x25')](_0xe7cdcf[_0x1e45('0x24')]);_0x5229e7['filters']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],_0x5229e7[_0x1e45('0x24')]);_0x3dd6c3['attributes']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],qs[_0x1e45('0x28')](_0xe7cdcf[_0x1e45('0x24')]['fields']));_0x3dd6c3[_0x1e45('0x29')]=_0x3dd6c3[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x3dd6c3[_0x1e45('0x29')]:_0x5229e7[_0x1e45('0x27')];if(!_0xe7cdcf['query']['hasOwnProperty']('nolimit')){_0x3dd6c3['limit']=qs[_0x1e45('0x17')](_0xe7cdcf['query'][_0x1e45('0x17')]);_0x3dd6c3[_0x1e45('0x15')]=qs['offset'](_0xe7cdcf['query'][_0x1e45('0x15')]);}_0x3dd6c3[_0x1e45('0x2b')]=qs[_0x1e45('0x2c')](_0xe7cdcf[_0x1e45('0x24')]['sort']);_0x3dd6c3[_0x1e45('0x2d')]=qs[_0x1e45('0x2e')](_[_0x1e45('0x2f')](_0xe7cdcf[_0x1e45('0x24')],_0x5229e7['filters']),_0x4a04aa);if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]){_0x3dd6c3[_0x1e45('0x2d')]=_['merge'](_0x3dd6c3['where'],{'$or':_[_0x1e45('0x20')](_0x4a04aa,function(_0x47c200){if(_0x47c200['type']!==_0x1e45('0x31')){var _0x587a0a={};_0x587a0a[_0x47c200['name']]={'$like':'%'+_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]+'%'};return _0x587a0a;}})});}_0x3dd6c3=_[_0x1e45('0x32')]({},_0x3dd6c3,_0xe7cdcf[_0x1e45('0x33')]);var _0x11a327={'where':_0x3dd6c3[_0x1e45('0x2d')]};return db[_0x1e45('0x34')][_0x1e45('0x18')](_0x11a327)[_0x1e45('0x1a')](function(_0x53713a){_0x3def67[_0x1e45('0x18')]=_0x53713a;if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x35')]){_0x3dd6c3[_0x1e45('0x36')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x1e45('0x37')](_0x3dd6c3);})[_0x1e45('0x1a')](function(_0x2984ae){_0x3def67[_0x1e45('0x38')]=_0x2984ae;return _0x3def67;})['then'](respondWithFilteredResult(_0x34046e,_0x3dd6c3))[_0x1e45('0x39')](handleError(_0x34046e,null));};exports[_0x1e45('0x3a')]=function(_0x32a42a,_0x393a50){var _0x522b40={'raw':!![],'where':{'id':_0x32a42a[_0x1e45('0x3b')]['id']}},_0x460d38={};_0x460d38[_0x1e45('0x27')]=_[_0x1e45('0x25')](db[_0x1e45('0x34')][_0x1e45('0x3c')]);_0x460d38['query']=_[_0x1e45('0x25')](_0x32a42a['query']);_0x460d38[_0x1e45('0x2e')]=_[_0x1e45('0x26')](_0x460d38[_0x1e45('0x27')],_0x460d38[_0x1e45('0x24')]);_0x522b40[_0x1e45('0x29')]=_[_0x1e45('0x26')](_0x460d38['model'],qs[_0x1e45('0x28')](_0x32a42a[_0x1e45('0x24')][_0x1e45('0x28')]));_0x522b40['attributes']=_0x522b40[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x522b40[_0x1e45('0x29')]:_0x460d38['model'];if(_0x32a42a['query']['includeAll']){_0x522b40[_0x1e45('0x36')]=[{'all':!![]}];}_0x522b40=_[_0x1e45('0x32')]({},_0x522b40,_0x32a42a[_0x1e45('0x33')]);return db[_0x1e45('0x34')]['find'](_0x522b40)[_0x1e45('0x1a')](handleEntityNotFound(_0x393a50,null))[_0x1e45('0x1a')](respondWithResult(_0x393a50,null))[_0x1e45('0x39')](handleError(_0x393a50,null));};exports[_0x1e45('0x3d')]=function(_0x3994d8,_0x53e41b){return db[_0x1e45('0x34')][_0x1e45('0x3d')](_0x3994d8[_0x1e45('0x3e')],{})[_0x1e45('0x1a')](respondWithResult(_0x53e41b,0xc9))[_0x1e45('0x39')](handleError(_0x53e41b,null));};exports['update']=function(_0x374c32,_0x14b06f){if(_0x374c32[_0x1e45('0x3e')]['id']){delete _0x374c32[_0x1e45('0x3e')]['id'];}return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x374c32['params']['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x14b06f,null))[_0x1e45('0x1a')](saveUpdates(_0x374c32['body'],null))[_0x1e45('0x1a')](respondWithResult(_0x14b06f,null))['catch'](handleError(_0x14b06f,null));};exports[_0x1e45('0x1b')]=function(_0x3e6845,_0x5bafc7){return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x3e6845[_0x1e45('0x3b')]['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x5bafc7,null))[_0x1e45('0x1a')](removeEntity(_0x5bafc7,null))[_0x1e45('0x39')](handleError(_0x5bafc7,null));};exports[_0x1e45('0x40')]=function(_0x4cdf47,_0x2f19f3){return db[_0x1e45('0x34')]['describe']()['then'](respondWithResult(_0x2f19f3,null))[_0x1e45('0x39')](handleError(_0x2f19f3,null));};
\ No newline at end of file
index b7693c5..294b32b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x51e86d,_0x184749){var _0x56e9eb=function(_0x3b53c3){while(--_0x3b53c3){_0x51e86d['push'](_0x51e86d['shift']());}};_0x56e9eb(++_0x184749);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 5af190d..8ce4c8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x52fb=['error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x249cc3,_0x824258){var _0x15a543=function(_0x536f62){while(--_0x536f62){_0x249cc3['push'](_0x249cc3['shift']());}};_0x15a543(++_0x824258);}(_0x52fb,0xa8));var _0xb52f=function(_0x2e622f,_0x229227){_0x2e622f=_0x2e622f-0x0;var _0x561288=_0x52fb[_0x2e622f];return _0x561288;};'use strict';var _=require(_0xb52f('0x0'));var util=require('util');var moment=require(_0xb52f('0x1'));var BPromise=require(_0xb52f('0x2'));var rs=require(_0xb52f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb52f('0x4'))['db'];var utils=require(_0xb52f('0x5'));var logger=require('../../config/logger')(_0xb52f('0x6'));var config=require('../../config/environment');var jayson=require(_0xb52f('0x7'));var client=jayson[_0xb52f('0x8')][_0xb52f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48779d,_0x2a6134,_0x5e657e){return new BPromise(function(_0x37a3b3,_0x3d91b8){return client[_0xb52f('0xa')](_0x48779d,_0x5e657e)[_0xb52f('0xb')](function(_0x179296){logger[_0xb52f('0xc')](_0xb52f('0xd'),_0x2a6134,'request\x20sent');logger[_0xb52f('0xe')](_0xb52f('0xf'),_0x2a6134,_0xb52f('0x10'),JSON[_0xb52f('0x11')](_0x179296));if(_0x179296[_0xb52f('0x12')]){if(_0x179296[_0xb52f('0x12')][_0xb52f('0x13')]===0x1f4){logger['error'](_0xb52f('0xd'),_0x2a6134,_0x179296['error'][_0xb52f('0x14')]);return _0x3d91b8(_0x179296[_0xb52f('0x12')][_0xb52f('0x14')]);}logger[_0xb52f('0x12')](_0xb52f('0xd'),_0x2a6134,_0x179296[_0xb52f('0x12')][_0xb52f('0x14')]);return _0x37a3b3(_0x179296[_0xb52f('0x12')]['message']);}else{logger['info'](_0xb52f('0xd'),_0x2a6134,_0xb52f('0x10'));_0x37a3b3(_0x179296['result'][_0xb52f('0x14')]);}})[_0xb52f('0x15')](function(_0x18f886){logger[_0xb52f('0x12')](_0xb52f('0xd'),_0x2a6134,_0x18f886);_0x3d91b8(_0x18f886);});});}exports[_0xb52f('0x16')]=function(_0x5b2417){var _0x157ac1=this;return new Promise(function(_0x5c9cb6,_0x3ab6f1){return db[_0xb52f('0x17')]['create'](_0x5b2417[_0xb52f('0x18')],{'raw':_0x5b2417['options']?_0x5b2417[_0xb52f('0x19')][_0xb52f('0x1a')]===undefined?!![]:![]:!![]})[_0xb52f('0xb')](function(_0x2b23c4){logger[_0xb52f('0xc')](_0xb52f('0x16'),_0x5b2417);logger[_0xb52f('0xe')](_0xb52f('0x16'),_0x5b2417,JSON['stringify'](_0x2b23c4));_0x5c9cb6(_0x2b23c4);})[_0xb52f('0x15')](function(_0x198faf){logger[_0xb52f('0x12')]('CreateChatQueueReport',_0x198faf[_0xb52f('0x14')],_0x5b2417);_0x3ab6f1(_0x157ac1[_0xb52f('0x12')](0x1f4,_0x198faf[_0xb52f('0x14')]));});});};exports[_0xb52f('0x1b')]=function(_0x36341a){var _0x788d3e=this;return new Promise(function(_0x56c318,_0x16ecfa){return db[_0xb52f('0x17')][_0xb52f('0x1c')](_0x36341a[_0xb52f('0x18')],{'raw':_0x36341a[_0xb52f('0x19')]?_0x36341a[_0xb52f('0x19')][_0xb52f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36341a[_0xb52f('0x19')]?_0x36341a['options'][_0xb52f('0x1d')]||null:null,'attributes':_0x36341a['options']?_0x36341a[_0xb52f('0x19')]['attributes']||null:null,'limit':_0x36341a[_0xb52f('0x19')]?_0x36341a[_0xb52f('0x19')][_0xb52f('0x1e')]||null:null})['then'](function(_0x3ffc97){logger['info'](_0xb52f('0x1b'),_0x36341a);logger['debug'](_0xb52f('0x1b'),_0x36341a,JSON[_0xb52f('0x11')](_0x3ffc97));_0x56c318(_0x3ffc97);})[_0xb52f('0x15')](function(_0x2aee08){logger[_0xb52f('0x12')](_0xb52f('0x1b'),_0x2aee08[_0xb52f('0x14')],_0x36341a);_0x16ecfa(_0x788d3e['error'](0x1f4,_0x2aee08['message']));});});};
\ No newline at end of file
+var _0xcb2c=['error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xcb2c,0x17a));var _0xccb2=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xcb2c[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var moment=require(_0xccb2('0x2'));var BPromise=require(_0xccb2('0x3'));var rs=require(_0xccb2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccb2('0x5'))['db'];var utils=require(_0xccb2('0x6'));var logger=require(_0xccb2('0x7'))(_0xccb2('0x8'));var config=require(_0xccb2('0x9'));var jayson=require(_0xccb2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e078d,_0x3c1e0e,_0x172ce0){return new BPromise(function(_0x71c46b,_0x1a8ee2){return client[_0xccb2('0xb')](_0x3e078d,_0x172ce0)[_0xccb2('0xc')](function(_0x29f2cb){logger[_0xccb2('0xd')](_0xccb2('0xe'),_0x3c1e0e,_0xccb2('0xf'));logger[_0xccb2('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3c1e0e,_0xccb2('0xf'),JSON[_0xccb2('0x11')](_0x29f2cb));if(_0x29f2cb[_0xccb2('0x12')]){if(_0x29f2cb[_0xccb2('0x12')][_0xccb2('0x13')]===0x1f4){logger['error'](_0xccb2('0xe'),_0x3c1e0e,_0x29f2cb[_0xccb2('0x12')]['message']);return _0x1a8ee2(_0x29f2cb[_0xccb2('0x12')][_0xccb2('0x14')]);}logger[_0xccb2('0x12')](_0xccb2('0xe'),_0x3c1e0e,_0x29f2cb[_0xccb2('0x12')][_0xccb2('0x14')]);return _0x71c46b(_0x29f2cb[_0xccb2('0x12')][_0xccb2('0x14')]);}else{logger[_0xccb2('0xd')](_0xccb2('0xe'),_0x3c1e0e,'request\x20sent');_0x71c46b(_0x29f2cb[_0xccb2('0x15')][_0xccb2('0x14')]);}})[_0xccb2('0x16')](function(_0x590757){logger[_0xccb2('0x12')](_0xccb2('0xe'),_0x3c1e0e,_0x590757);_0x1a8ee2(_0x590757);});});}exports[_0xccb2('0x17')]=function(_0x8a0290){var _0xdedb38=this;return new Promise(function(_0x179da7,_0x22491a){return db[_0xccb2('0x18')][_0xccb2('0x19')](_0x8a0290[_0xccb2('0x1a')],{'raw':_0x8a0290[_0xccb2('0x1b')]?_0x8a0290[_0xccb2('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xccb2('0xc')](function(_0x256919){logger[_0xccb2('0xd')](_0xccb2('0x17'),_0x8a0290);logger[_0xccb2('0x10')]('CreateChatQueueReport',_0x8a0290,JSON[_0xccb2('0x11')](_0x256919));_0x179da7(_0x256919);})[_0xccb2('0x16')](function(_0x41d42e){logger['error'](_0xccb2('0x17'),_0x41d42e[_0xccb2('0x14')],_0x8a0290);_0x22491a(_0xdedb38['error'](0x1f4,_0x41d42e[_0xccb2('0x14')]));});});};exports[_0xccb2('0x1c')]=function(_0x5d2e60){var _0x311c29=this;return new Promise(function(_0xfe7fed,_0x3f5db8){return db[_0xccb2('0x18')][_0xccb2('0x1d')](_0x5d2e60[_0xccb2('0x1a')],{'raw':_0x5d2e60[_0xccb2('0x1b')]?_0x5d2e60[_0xccb2('0x1b')][_0xccb2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d2e60['options']?_0x5d2e60[_0xccb2('0x1b')][_0xccb2('0x1f')]||null:null,'attributes':_0x5d2e60['options']?_0x5d2e60['options']['attributes']||null:null,'limit':_0x5d2e60[_0xccb2('0x1b')]?_0x5d2e60[_0xccb2('0x1b')][_0xccb2('0x20')]||null:null})['then'](function(_0x3c876a){logger[_0xccb2('0xd')]('UpdateChatQueueReport',_0x5d2e60);logger[_0xccb2('0x10')](_0xccb2('0x1c'),_0x5d2e60,JSON['stringify'](_0x3c876a));_0xfe7fed(_0x3c876a);})['catch'](function(_0x2ca798){logger[_0xccb2('0x12')](_0xccb2('0x1c'),_0x2ca798[_0xccb2('0x14')],_0x5d2e60);_0x3f5db8(_0x311c29['error'](0x1f4,_0x2ca798['message']));});});};
\ No newline at end of file
index e554083..65074e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf20=['/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x42defe,_0x413299){var _0x2977ca=function(_0x2ab8ed){while(--_0x2ab8ed){_0x42defe['push'](_0x42defe['shift']());}};_0x2977ca(++_0x413299);}(_0xcf20,0x111));var _0x0cf2=function(_0x5bdddf,_0x122b93){_0x5bdddf=_0x5bdddf-0x0;var _0x423d60=_0xcf20[_0x5bdddf];return _0x423d60;};'use strict';var multer=require(_0x0cf2('0x0'));var util=require(_0x0cf2('0x1'));var path=require(_0x0cf2('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cf2('0x3'));var router=express[_0x0cf2('0x4')]();var fs_extra=require(_0x0cf2('0x5'));var auth=require(_0x0cf2('0x6'));var interaction=require(_0x0cf2('0x7'));var config=require(_0x0cf2('0x8'));var controller=require(_0x0cf2('0x9'));router[_0x0cf2('0xa')]('/',auth[_0x0cf2('0xb')](),controller[_0x0cf2('0xc')]);router[_0x0cf2('0xa')](_0x0cf2('0xd'),auth[_0x0cf2('0xb')](),controller[_0x0cf2('0xe')]);router[_0x0cf2('0xa')](_0x0cf2('0xf'),auth[_0x0cf2('0xb')](),controller[_0x0cf2('0x10')]);router[_0x0cf2('0x11')]('/',auth[_0x0cf2('0xb')](),controller['create']);router[_0x0cf2('0x12')](_0x0cf2('0xf'),auth[_0x0cf2('0xb')](),controller['update']);router[_0x0cf2('0x13')](_0x0cf2('0xf'),auth[_0x0cf2('0xb')](),controller[_0x0cf2('0x14')]);module[_0x0cf2('0x15')]=router;
\ No newline at end of file
+var _0x520b=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','put','/:id','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3ba9b5,_0x5ba267){var _0x369735=function(_0x376371){while(--_0x376371){_0x3ba9b5['push'](_0x3ba9b5['shift']());}};_0x369735(++_0x5ba267);}(_0x520b,0xf6));var _0xb520=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x520b[_0x16a223];return _0x5ded66;};'use strict';var multer=require('multer');var util=require(_0xb520('0x0'));var path=require(_0xb520('0x1'));var timeout=require(_0xb520('0x2'));var express=require('express');var router=express[_0xb520('0x3')]();var fs_extra=require(_0xb520('0x4'));var auth=require(_0xb520('0x5'));var interaction=require(_0xb520('0x6'));var config=require(_0xb520('0x7'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xb520('0x8')](),controller[_0xb520('0x9')]);router[_0xb520('0xa')](_0xb520('0xb'),auth['isAuthenticated'](),controller[_0xb520('0xc')]);router[_0xb520('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb520('0xd')]);router[_0xb520('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb520('0xf')](_0xb520('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb520('0x11')](_0xb520('0x10'),auth[_0xb520('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index aa4c9ec..983d570 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x361ab2,_0xedfd90){var _0x426f2c=function(_0x9a3591){while(--_0x9a3591){_0x361ab2['push'](_0x361ab2['shift']());}};_0x426f2c(++_0xedfd90);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}};
\ No newline at end of file
+var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x58e2d2,_0x4ff59b){var _0x249768=function(_0x1c9e31){while(--_0x1c9e31){_0x58e2d2['push'](_0x58e2d2['shift']());}};_0x249768(++_0x4ff59b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}};
\ No newline at end of file
index 058ce58..86d0f6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ffd=['query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','keys','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','ChatTransferReport','type'];(function(_0x521eaf,_0x2e9fbd){var _0x42bba3=function(_0x31653c){while(--_0x31653c){_0x521eaf['push'](_0x521eaf['shift']());}};_0x42bba3(++_0x2e9fbd);}(_0x5ffd,0xf5));var _0xd5ff=function(_0x54a592,_0x466299){_0x54a592=_0x54a592-0x0;var _0x535d5e=_0x5ffd[_0x54a592];return _0x535d5e;};'use strict';var emlformat=require(_0xd5ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5ff('0x1'));var jsonpatch=require(_0xd5ff('0x2'));var rp=require(_0xd5ff('0x3'));var moment=require(_0xd5ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd5ff('0x5'));var util=require(_0xd5ff('0x6'));var path=require(_0xd5ff('0x7'));var sox=require(_0xd5ff('0x8'));var csv=require(_0xd5ff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5ff('0xa'));var _=require(_0xd5ff('0xb'));var squel=require(_0xd5ff('0xc'));var crypto=require(_0xd5ff('0xd'));var jsforce=require(_0xd5ff('0xe'));var deskjs=require(_0xd5ff('0xf'));var toCsv=require(_0xd5ff('0x9'));var querystring=require(_0xd5ff('0x10'));var Papa=require(_0xd5ff('0x11'));var Redis=require(_0xd5ff('0x12'));var authService=require(_0xd5ff('0x13'));var qs=require(_0xd5ff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5ff('0x15'))(_0xd5ff('0x16'));var utils=require(_0xd5ff('0x17'));var config=require(_0xd5ff('0x18'));var licenseUtil=require(_0xd5ff('0x19'));var db=require(_0xd5ff('0x1a'))['db'];function respondWithStatusCode(_0x7b1bd1,_0x3ee65a){_0x3ee65a=_0x3ee65a||0xcc;return function(_0x52baf7){if(_0x52baf7){return _0x7b1bd1['sendStatus'](_0x3ee65a);}return _0x7b1bd1[_0xd5ff('0x1b')](_0x3ee65a)['end']();};}function respondWithResult(_0x4faeb5,_0x2dde0b){_0x2dde0b=_0x2dde0b||0xc8;return function(_0x7b9de4){if(_0x7b9de4){return _0x4faeb5[_0xd5ff('0x1b')](_0x2dde0b)[_0xd5ff('0x1c')](_0x7b9de4);}};}function respondWithFilteredResult(_0x45895e,_0x5e8818){return function(_0xa98981){if(_0xa98981){var _0x3faaf8=typeof _0x5e8818['offset']===_0xd5ff('0x1d')&&typeof _0x5e8818[_0xd5ff('0x1e')]===_0xd5ff('0x1d');var _0x455565=_0xa98981[_0xd5ff('0x1f')];var _0x491faa=_0x3faaf8?0x0:_0x5e8818[_0xd5ff('0x20')];var _0xada9e=_0x3faaf8?_0xa98981[_0xd5ff('0x1f')]:_0x5e8818[_0xd5ff('0x20')]+_0x5e8818[_0xd5ff('0x1e')];var _0x5cbbfe;if(_0xada9e>=_0x455565){_0xada9e=_0x455565;_0x5cbbfe=0xc8;}else{_0x5cbbfe=0xce;}_0x45895e[_0xd5ff('0x1b')](_0x5cbbfe);return _0x45895e[_0xd5ff('0x21')](_0xd5ff('0x22'),_0x491faa+'-'+_0xada9e+'/'+_0x455565)[_0xd5ff('0x1c')](_0xa98981);}return null;};}function patchUpdates(_0x1f59b1){return function(_0x1a5db9){try{jsonpatch[_0xd5ff('0x23')](_0x1a5db9,_0x1f59b1,!![]);}catch(_0xada0d5){return BPromise[_0xd5ff('0x24')](_0xada0d5);}return _0x1a5db9[_0xd5ff('0x25')]();};}function saveUpdates(_0x381788,_0x47ba28){return function(_0x4cbfc8){if(_0x4cbfc8){return _0x4cbfc8[_0xd5ff('0x26')](_0x381788)['then'](function(_0x35c94a){return _0x35c94a;});}return null;};}function removeEntity(_0x2ba859,_0x39f23c){return function(_0x4a844b){if(_0x4a844b){return _0x4a844b['destroy']()[_0xd5ff('0x27')](function(){_0x2ba859[_0xd5ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ae15,_0x1b690b){return function(_0x277b43){if(!_0x277b43){_0x45ae15[_0xd5ff('0x28')](0x194);}return _0x277b43;};}function handleError(_0x1d2e3a,_0x465ab0){_0x465ab0=_0x465ab0||0x1f4;return function(_0x30d2c9){logger[_0xd5ff('0x29')](_0x30d2c9['stack']);if(_0x30d2c9[_0xd5ff('0x2a')]){delete _0x30d2c9[_0xd5ff('0x2a')];}_0x1d2e3a[_0xd5ff('0x1b')](_0x465ab0)[_0xd5ff('0x2b')](_0x30d2c9);};}exports['index']=function(_0x3467a1,_0xa6c871){var _0x4f3d55={},_0x5da383={},_0x16f3bd={'count':0x0,'rows':[]};var _0x4d334e=_[_0xd5ff('0x2c')](db[_0xd5ff('0x2d')]['rawAttributes'],function(_0x44bee7){return{'name':_0x44bee7['fieldName'],'type':_0x44bee7[_0xd5ff('0x2e')]['key']};});_0x5da383['model']=_['map'](_0x4d334e,'name');_0x5da383[_0xd5ff('0x2f')]=_['keys'](_0x3467a1[_0xd5ff('0x2f')]);_0x5da383[_0xd5ff('0x30')]=_['intersection'](_0x5da383[_0xd5ff('0x31')],_0x5da383[_0xd5ff('0x2f')]);_0x4f3d55[_0xd5ff('0x32')]=_[_0xd5ff('0x33')](_0x5da383['model'],qs[_0xd5ff('0x34')](_0x3467a1[_0xd5ff('0x2f')][_0xd5ff('0x34')]));_0x4f3d55[_0xd5ff('0x32')]=_0x4f3d55[_0xd5ff('0x32')][_0xd5ff('0x35')]?_0x4f3d55[_0xd5ff('0x32')]:_0x5da383[_0xd5ff('0x31')];if(!_0x3467a1[_0xd5ff('0x2f')][_0xd5ff('0x36')](_0xd5ff('0x37'))){_0x4f3d55['limit']=qs[_0xd5ff('0x1e')](_0x3467a1[_0xd5ff('0x2f')][_0xd5ff('0x1e')]);_0x4f3d55[_0xd5ff('0x20')]=qs[_0xd5ff('0x20')](_0x3467a1[_0xd5ff('0x2f')][_0xd5ff('0x20')]);}_0x4f3d55[_0xd5ff('0x38')]=qs[_0xd5ff('0x39')](_0x3467a1[_0xd5ff('0x2f')]['sort']);_0x4f3d55[_0xd5ff('0x3a')]=qs[_0xd5ff('0x30')](_[_0xd5ff('0x3b')](_0x3467a1['query'],_0x5da383['filters']),_0x4d334e);if(_0x3467a1[_0xd5ff('0x2f')][_0xd5ff('0x3c')]){_0x4f3d55[_0xd5ff('0x3a')]=_[_0xd5ff('0x3d')](_0x4f3d55['where'],{'$or':_[_0xd5ff('0x2c')](_0x4d334e,function(_0x2b9df6){if(_0x2b9df6[_0xd5ff('0x2e')]!=='VIRTUAL'){var _0x32edd1={};_0x32edd1[_0x2b9df6[_0xd5ff('0x2a')]]={'$like':'%'+_0x3467a1['query'][_0xd5ff('0x3c')]+'%'};return _0x32edd1;}})});}_0x4f3d55=_[_0xd5ff('0x3d')]({},_0x4f3d55,_0x3467a1[_0xd5ff('0x3e')]);var _0x2b2c0e={'where':_0x4f3d55['where']};return db['ChatTransferReport']['count'](_0x2b2c0e)['then'](function(_0x371b2f){_0x16f3bd[_0xd5ff('0x1f')]=_0x371b2f;if(_0x3467a1[_0xd5ff('0x2f')]['includeAll']){_0x4f3d55[_0xd5ff('0x3f')]=[{'all':!![]}];}return db[_0xd5ff('0x2d')][_0xd5ff('0x40')](_0x4f3d55);})['then'](function(_0x2da903){_0x16f3bd['rows']=_0x2da903;return _0x16f3bd;})[_0xd5ff('0x27')](respondWithFilteredResult(_0xa6c871,_0x4f3d55))[_0xd5ff('0x41')](handleError(_0xa6c871,null));};exports['show']=function(_0x1fa9b6,_0xcf036e){var _0x40987e={'raw':!![],'where':{'id':_0x1fa9b6['params']['id']}},_0x3e95ed={};_0x3e95ed[_0xd5ff('0x31')]=_[_0xd5ff('0x42')](db[_0xd5ff('0x2d')]['rawAttributes']);_0x3e95ed[_0xd5ff('0x2f')]=_[_0xd5ff('0x42')](_0x1fa9b6[_0xd5ff('0x2f')]);_0x3e95ed[_0xd5ff('0x30')]=_[_0xd5ff('0x33')](_0x3e95ed[_0xd5ff('0x31')],_0x3e95ed[_0xd5ff('0x2f')]);_0x40987e[_0xd5ff('0x32')]=_['intersection'](_0x3e95ed[_0xd5ff('0x31')],qs[_0xd5ff('0x34')](_0x1fa9b6['query'][_0xd5ff('0x34')]));_0x40987e[_0xd5ff('0x32')]=_0x40987e[_0xd5ff('0x32')][_0xd5ff('0x35')]?_0x40987e[_0xd5ff('0x32')]:_0x3e95ed[_0xd5ff('0x31')];if(_0x1fa9b6['query']['includeAll']){_0x40987e[_0xd5ff('0x3f')]=[{'all':!![]}];}_0x40987e=_[_0xd5ff('0x3d')]({},_0x40987e,_0x1fa9b6[_0xd5ff('0x3e')]);return db[_0xd5ff('0x2d')][_0xd5ff('0x43')](_0x40987e)[_0xd5ff('0x27')](handleEntityNotFound(_0xcf036e,null))[_0xd5ff('0x27')](respondWithResult(_0xcf036e,null))[_0xd5ff('0x41')](handleError(_0xcf036e,null));};exports['create']=function(_0x5407c4,_0x2bdbfd){return db[_0xd5ff('0x2d')][_0xd5ff('0x44')](_0x5407c4['body'],{})[_0xd5ff('0x27')](respondWithResult(_0x2bdbfd,0xc9))[_0xd5ff('0x41')](handleError(_0x2bdbfd,null));};exports[_0xd5ff('0x26')]=function(_0x36514e,_0x937992){if(_0x36514e[_0xd5ff('0x45')]['id']){delete _0x36514e[_0xd5ff('0x45')]['id'];}return db[_0xd5ff('0x2d')]['find']({'where':{'id':_0x36514e[_0xd5ff('0x46')]['id']}})[_0xd5ff('0x27')](handleEntityNotFound(_0x937992,null))['then'](saveUpdates(_0x36514e[_0xd5ff('0x45')],null))[_0xd5ff('0x27')](respondWithResult(_0x937992,null))[_0xd5ff('0x41')](handleError(_0x937992,null));};exports[_0xd5ff('0x47')]=function(_0x187249,_0x1c8181){return db['ChatTransferReport']['find']({'where':{'id':_0x187249['params']['id']}})[_0xd5ff('0x27')](handleEntityNotFound(_0x1c8181,null))[_0xd5ff('0x27')](removeEntity(_0x1c8181,null))[_0xd5ff('0x41')](handleError(_0x1c8181,null));};exports[_0xd5ff('0x48')]=function(_0x384e6b,_0x2ffb0a){return db[_0xd5ff('0x2d')][_0xd5ff('0x48')]()[_0xd5ff('0x27')](respondWithResult(_0x2ffb0a,null))[_0xd5ff('0x41')](handleError(_0x2ffb0a,null));};
\ No newline at end of file
+var _0xd99b=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ChatTransferReport','fieldName','type','key','query','filters','intersection','model','fields','attributes','order'];(function(_0x2bda4d,_0x5e6bb3){var _0x2b78f8=function(_0x1bc062){while(--_0x1bc062){_0x2bda4d['push'](_0x2bda4d['shift']());}};_0x2b78f8(++_0x5e6bb3);}(_0xd99b,0x1e7));var _0xbd99=function(_0x51c8ca,_0x427424){_0x51c8ca=_0x51c8ca-0x0;var _0x3fb56d=_0xd99b[_0x51c8ca];return _0x3fb56d;};'use strict';var emlformat=require(_0xbd99('0x0'));var rimraf=require(_0xbd99('0x1'));var zipdir=require(_0xbd99('0x2'));var jsonpatch=require(_0xbd99('0x3'));var rp=require(_0xbd99('0x4'));var moment=require('moment');var BPromise=require(_0xbd99('0x5'));var Mustache=require(_0xbd99('0x6'));var util=require(_0xbd99('0x7'));var path=require(_0xbd99('0x8'));var sox=require(_0xbd99('0x9'));var csv=require(_0xbd99('0xa'));var ejs=require(_0xbd99('0xb'));var fs=require('fs');var fs_extra=require(_0xbd99('0xc'));var _=require(_0xbd99('0xd'));var squel=require(_0xbd99('0xe'));var crypto=require(_0xbd99('0xf'));var jsforce=require(_0xbd99('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbd99('0xa'));var querystring=require(_0xbd99('0x11'));var Papa=require(_0xbd99('0x12'));var Redis=require(_0xbd99('0x13'));var authService=require(_0xbd99('0x14'));var qs=require(_0xbd99('0x15'));var as=require(_0xbd99('0x16'));var hardwareService=require(_0xbd99('0x17'));var logger=require(_0xbd99('0x18'))(_0xbd99('0x19'));var utils=require(_0xbd99('0x1a'));var config=require(_0xbd99('0x1b'));var licenseUtil=require(_0xbd99('0x1c'));var db=require(_0xbd99('0x1d'))['db'];function respondWithStatusCode(_0x1d20e3,_0xa59cc6){_0xa59cc6=_0xa59cc6||0xcc;return function(_0x3729a0){if(_0x3729a0){return _0x1d20e3[_0xbd99('0x1e')](_0xa59cc6);}return _0x1d20e3[_0xbd99('0x1f')](_0xa59cc6)[_0xbd99('0x20')]();};}function respondWithResult(_0x1654bf,_0x212d5b){_0x212d5b=_0x212d5b||0xc8;return function(_0x5278d6){if(_0x5278d6){return _0x1654bf[_0xbd99('0x1f')](_0x212d5b)['json'](_0x5278d6);}};}function respondWithFilteredResult(_0x6283f4,_0xa8b547){return function(_0xe51f66){if(_0xe51f66){var _0x1a79ba=typeof _0xa8b547['offset']==='undefined'&&typeof _0xa8b547[_0xbd99('0x21')]===_0xbd99('0x22');var _0x477ee2=_0xe51f66[_0xbd99('0x23')];var _0x551e49=_0x1a79ba?0x0:_0xa8b547['offset'];var _0x4a287b=_0x1a79ba?_0xe51f66[_0xbd99('0x23')]:_0xa8b547[_0xbd99('0x24')]+_0xa8b547[_0xbd99('0x21')];var _0x18a3d5;if(_0x4a287b>=_0x477ee2){_0x4a287b=_0x477ee2;_0x18a3d5=0xc8;}else{_0x18a3d5=0xce;}_0x6283f4[_0xbd99('0x1f')](_0x18a3d5);return _0x6283f4['set'](_0xbd99('0x25'),_0x551e49+'-'+_0x4a287b+'/'+_0x477ee2)['json'](_0xe51f66);}return null;};}function patchUpdates(_0xc8e953){return function(_0x2b1fe8){try{jsonpatch[_0xbd99('0x26')](_0x2b1fe8,_0xc8e953,!![]);}catch(_0x518916){return BPromise[_0xbd99('0x27')](_0x518916);}return _0x2b1fe8[_0xbd99('0x28')]();};}function saveUpdates(_0x221ac0,_0x2cd6e4){return function(_0xbe43df){if(_0xbe43df){return _0xbe43df[_0xbd99('0x29')](_0x221ac0)[_0xbd99('0x2a')](function(_0x3d527f){return _0x3d527f;});}return null;};}function removeEntity(_0x4c54a8,_0x3fb899){return function(_0x55a31f){if(_0x55a31f){return _0x55a31f[_0xbd99('0x2b')]()['then'](function(){_0x4c54a8[_0xbd99('0x1f')](0xcc)[_0xbd99('0x20')]();});}};}function handleEntityNotFound(_0x46cafc,_0x5140c7){return function(_0x203996){if(!_0x203996){_0x46cafc[_0xbd99('0x1e')](0x194);}return _0x203996;};}function handleError(_0x1454d0,_0x6a083c){_0x6a083c=_0x6a083c||0x1f4;return function(_0x1dc711){logger['error'](_0x1dc711[_0xbd99('0x2c')]);if(_0x1dc711['name']){delete _0x1dc711[_0xbd99('0x2d')];}_0x1454d0[_0xbd99('0x1f')](_0x6a083c)['send'](_0x1dc711);};}exports[_0xbd99('0x2e')]=function(_0x476fd8,_0x280755){var _0x211794={},_0x3fef96={},_0x43d823={'count':0x0,'rows':[]};var _0xec8ec1=_[_0xbd99('0x2f')](db[_0xbd99('0x30')]['rawAttributes'],function(_0x210b7f){return{'name':_0x210b7f[_0xbd99('0x31')],'type':_0x210b7f[_0xbd99('0x32')][_0xbd99('0x33')]};});_0x3fef96['model']=_[_0xbd99('0x2f')](_0xec8ec1,'name');_0x3fef96[_0xbd99('0x34')]=_['keys'](_0x476fd8[_0xbd99('0x34')]);_0x3fef96[_0xbd99('0x35')]=_[_0xbd99('0x36')](_0x3fef96[_0xbd99('0x37')],_0x3fef96[_0xbd99('0x34')]);_0x211794['attributes']=_[_0xbd99('0x36')](_0x3fef96[_0xbd99('0x37')],qs[_0xbd99('0x38')](_0x476fd8[_0xbd99('0x34')]['fields']));_0x211794[_0xbd99('0x39')]=_0x211794[_0xbd99('0x39')]['length']?_0x211794['attributes']:_0x3fef96[_0xbd99('0x37')];if(!_0x476fd8[_0xbd99('0x34')]['hasOwnProperty']('nolimit')){_0x211794[_0xbd99('0x21')]=qs[_0xbd99('0x21')](_0x476fd8[_0xbd99('0x34')][_0xbd99('0x21')]);_0x211794[_0xbd99('0x24')]=qs[_0xbd99('0x24')](_0x476fd8[_0xbd99('0x34')][_0xbd99('0x24')]);}_0x211794[_0xbd99('0x3a')]=qs[_0xbd99('0x3b')](_0x476fd8['query'][_0xbd99('0x3b')]);_0x211794[_0xbd99('0x3c')]=qs[_0xbd99('0x35')](_['pick'](_0x476fd8[_0xbd99('0x34')],_0x3fef96[_0xbd99('0x35')]),_0xec8ec1);if(_0x476fd8[_0xbd99('0x34')][_0xbd99('0x3d')]){_0x211794[_0xbd99('0x3c')]=_[_0xbd99('0x3e')](_0x211794[_0xbd99('0x3c')],{'$or':_[_0xbd99('0x2f')](_0xec8ec1,function(_0x957997){if(_0x957997[_0xbd99('0x32')]!==_0xbd99('0x3f')){var _0x8dc737={};_0x8dc737[_0x957997[_0xbd99('0x2d')]]={'$like':'%'+_0x476fd8[_0xbd99('0x34')]['filter']+'%'};return _0x8dc737;}})});}_0x211794=_[_0xbd99('0x3e')]({},_0x211794,_0x476fd8[_0xbd99('0x40')]);var _0x44d77b={'where':_0x211794[_0xbd99('0x3c')]};return db[_0xbd99('0x30')][_0xbd99('0x23')](_0x44d77b)[_0xbd99('0x2a')](function(_0x4b91c5){_0x43d823[_0xbd99('0x23')]=_0x4b91c5;if(_0x476fd8['query'][_0xbd99('0x41')]){_0x211794[_0xbd99('0x42')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xbd99('0x43')](_0x211794);})[_0xbd99('0x2a')](function(_0x4718ae){_0x43d823[_0xbd99('0x44')]=_0x4718ae;return _0x43d823;})[_0xbd99('0x2a')](respondWithFilteredResult(_0x280755,_0x211794))['catch'](handleError(_0x280755,null));};exports[_0xbd99('0x45')]=function(_0x4c0de2,_0x1b0c9a){var _0x46b9f8={'raw':!![],'where':{'id':_0x4c0de2[_0xbd99('0x46')]['id']}},_0x381ccb={};_0x381ccb[_0xbd99('0x37')]=_[_0xbd99('0x47')](db[_0xbd99('0x30')][_0xbd99('0x48')]);_0x381ccb['query']=_['keys'](_0x4c0de2[_0xbd99('0x34')]);_0x381ccb['filters']=_[_0xbd99('0x36')](_0x381ccb['model'],_0x381ccb[_0xbd99('0x34')]);_0x46b9f8['attributes']=_['intersection'](_0x381ccb[_0xbd99('0x37')],qs[_0xbd99('0x38')](_0x4c0de2[_0xbd99('0x34')]['fields']));_0x46b9f8['attributes']=_0x46b9f8['attributes']['length']?_0x46b9f8[_0xbd99('0x39')]:_0x381ccb['model'];if(_0x4c0de2['query'][_0xbd99('0x41')]){_0x46b9f8[_0xbd99('0x42')]=[{'all':!![]}];}_0x46b9f8=_[_0xbd99('0x3e')]({},_0x46b9f8,_0x4c0de2['options']);return db[_0xbd99('0x30')][_0xbd99('0x49')](_0x46b9f8)[_0xbd99('0x2a')](handleEntityNotFound(_0x1b0c9a,null))[_0xbd99('0x2a')](respondWithResult(_0x1b0c9a,null))[_0xbd99('0x4a')](handleError(_0x1b0c9a,null));};exports[_0xbd99('0x4b')]=function(_0x4dd461,_0x5f4c3d){return db[_0xbd99('0x30')][_0xbd99('0x4b')](_0x4dd461['body'],{})[_0xbd99('0x2a')](respondWithResult(_0x5f4c3d,0xc9))[_0xbd99('0x4a')](handleError(_0x5f4c3d,null));};exports[_0xbd99('0x29')]=function(_0x127a52,_0x385547){if(_0x127a52[_0xbd99('0x4c')]['id']){delete _0x127a52[_0xbd99('0x4c')]['id'];}return db['ChatTransferReport'][_0xbd99('0x49')]({'where':{'id':_0x127a52[_0xbd99('0x46')]['id']}})[_0xbd99('0x2a')](handleEntityNotFound(_0x385547,null))[_0xbd99('0x2a')](saveUpdates(_0x127a52[_0xbd99('0x4c')],null))['then'](respondWithResult(_0x385547,null))['catch'](handleError(_0x385547,null));};exports[_0xbd99('0x2b')]=function(_0x4f42fb,_0xf82b4){return db['ChatTransferReport'][_0xbd99('0x49')]({'where':{'id':_0x4f42fb[_0xbd99('0x46')]['id']}})[_0xbd99('0x2a')](handleEntityNotFound(_0xf82b4,null))[_0xbd99('0x2a')](removeEntity(_0xf82b4,null))[_0xbd99('0x4a')](handleError(_0xf82b4,null));};exports[_0xbd99('0x4d')]=function(_0x3c5725,_0x2de56a){return db['ChatTransferReport'][_0xbd99('0x4d')]()[_0xbd99('0x2a')](respondWithResult(_0x2de56a,null))['catch'](handleError(_0x2de56a,null));};
\ No newline at end of file
index d90eacc..da1d472 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a51=['api','moment','bluebird','rimraf','../../config/environment','exports','define','uniqueid','lodash','../../config/logger'];(function(_0x406e18,_0x4f2cd0){var _0x2330db=function(_0x155bbd){while(--_0x155bbd){_0x406e18['push'](_0x406e18['shift']());}};_0x2330db(++_0x4f2cd0);}(_0x4a51,0x184));var _0x14a5=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x4a51[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x14a5('0x0'));var util=require('util');var logger=require(_0x14a5('0x1'))(_0x14a5('0x2'));var moment=require(_0x14a5('0x3'));var BPromise=require(_0x14a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14a5('0x5'));var config=require(_0x14a5('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x14a5('0x7')]=function(_0x4554f1,_0x541e4b){return _0x4554f1[_0x14a5('0x8')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x14a5('0x9'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd51e=['exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','moment','request-promise','rimraf','../../config/environment'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xd51e,0x1bc));var _0xed51=function(_0x1e7ead,_0x7f6227){_0x1e7ead=_0x1e7ead-0x0;var _0x3912b2=_0xd51e[_0x1e7ead];return _0x3912b2;};'use strict';var _=require(_0xed51('0x0'));var util=require(_0xed51('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xed51('0x2'));var BPromise=require('bluebird');var rp=require(_0xed51('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed51('0x4'));var config=require(_0xed51('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0xed51('0x6')]=function(_0x3a7010,_0x5da8da){return _0x3a7010['define'](_0xed51('0x7'),attributes,{'tableName':_0xed51('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xed51('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
index d3aff89..1691cf2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd29a=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0xd29a,0xb2));var _0xad29=function(_0x121f4c,_0xf31fc7){_0x121f4c=_0x121f4c-0x0;var _0x15c18c=_0xd29a[_0x121f4c];return _0x15c18c;};'use strict';var _=require(_0xad29('0x0'));var util=require('util');var moment=require(_0xad29('0x1'));var BPromise=require(_0xad29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad29('0x3'));var logger=require(_0xad29('0x4'))('rpc');var config=require(_0xad29('0x5'));var jayson=require(_0xad29('0x6'));var client=jayson[_0xad29('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4af157,_0xd6f3af,_0x477eaf){return new BPromise(function(_0x56fcdc,_0x35539f){return client['request'](_0x4af157,_0x477eaf)[_0xad29('0x8')](function(_0x431d63){logger['info'](_0xad29('0x9'),_0xd6f3af,_0xad29('0xa'));logger[_0xad29('0xb')](_0xad29('0xc'),_0xd6f3af,_0xad29('0xa'),JSON['stringify'](_0x431d63));if(_0x431d63['error']){if(_0x431d63[_0xad29('0xd')]['code']===0x1f4){logger[_0xad29('0xd')](_0xad29('0x9'),_0xd6f3af,_0x431d63[_0xad29('0xd')][_0xad29('0xe')]);return _0x35539f(_0x431d63[_0xad29('0xd')][_0xad29('0xe')]);}logger['error'](_0xad29('0x9'),_0xd6f3af,_0x431d63[_0xad29('0xd')][_0xad29('0xe')]);return _0x56fcdc(_0x431d63[_0xad29('0xd')][_0xad29('0xe')]);}else{logger[_0xad29('0xf')](_0xad29('0x9'),_0xd6f3af,_0xad29('0xa'));_0x56fcdc(_0x431d63['result'][_0xad29('0xe')]);}})[_0xad29('0x10')](function(_0x4365af){logger[_0xad29('0xd')](_0xad29('0x9'),_0xd6f3af,_0x4365af);_0x35539f(_0x4365af);});});}
\ No newline at end of file
+var _0x18eb=['error','code','ChatTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x18eb,0x10f));var _0xb18e=function(_0xa8ca7,_0x456ca6){_0xa8ca7=_0xa8ca7-0x0;var _0x1b40d4=_0x18eb[_0xa8ca7];return _0x1b40d4;};'use strict';var _=require('lodash');var util=require(_0xb18e('0x0'));var moment=require(_0xb18e('0x1'));var BPromise=require(_0xb18e('0x2'));var rs=require(_0xb18e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb18e('0x4'));var logger=require(_0xb18e('0x5'))('rpc');var config=require(_0xb18e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb18e('0x7')][_0xb18e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f98f,_0x40b232,_0x1e9f07){return new BPromise(function(_0x39db30,_0x527067){return client[_0xb18e('0x9')](_0x26f98f,_0x1e9f07)[_0xb18e('0xa')](function(_0x26fe6c){logger[_0xb18e('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x40b232,_0xb18e('0xc'));logger['debug'](_0xb18e('0xd'),_0x40b232,'request\x20sent',JSON['stringify'](_0x26fe6c));if(_0x26fe6c[_0xb18e('0xe')]){if(_0x26fe6c[_0xb18e('0xe')][_0xb18e('0xf')]===0x1f4){logger[_0xb18e('0xe')](_0xb18e('0x10'),_0x40b232,_0x26fe6c[_0xb18e('0xe')][_0xb18e('0x11')]);return _0x527067(_0x26fe6c[_0xb18e('0xe')][_0xb18e('0x11')]);}logger[_0xb18e('0xe')](_0xb18e('0x10'),_0x40b232,_0x26fe6c['error'][_0xb18e('0x11')]);return _0x39db30(_0x26fe6c[_0xb18e('0xe')][_0xb18e('0x11')]);}else{logger[_0xb18e('0xb')](_0xb18e('0x10'),_0x40b232,_0xb18e('0xc'));_0x39db30(_0x26fe6c[_0xb18e('0x12')][_0xb18e('0x11')]);}})['catch'](function(_0x759683){logger[_0xb18e('0xe')](_0xb18e('0x10'),_0x40b232,_0x759683);_0x527067(_0x759683);});});}
\ No newline at end of file
index 57e19f9..bc410e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3e9=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','./chatTransferReport.controller','get','index','/describe','isAuthenticated','show','create','put','/:id'];(function(_0x428fb0,_0x36bab8){var _0x4ac37f=function(_0x5d89cb){while(--_0x5d89cb){_0x428fb0['push'](_0x428fb0['shift']());}};_0x4ac37f(++_0x36bab8);}(_0xe3e9,0x1ef));var _0x9e3e=function(_0x463192,_0x2a7738){_0x463192=_0x463192-0x0;var _0x3e6e6c=_0xe3e9[_0x463192];return _0x3e6e6c;};'use strict';var multer=require(_0x9e3e('0x0'));var util=require(_0x9e3e('0x1'));var path=require(_0x9e3e('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e3e('0x3'));var router=express[_0x9e3e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e3e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e3e('0x6'));router[_0x9e3e('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e3e('0x8')]);router[_0x9e3e('0x7')](_0x9e3e('0x9'),auth[_0x9e3e('0xa')](),controller['describe']);router[_0x9e3e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9e3e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9e3e('0xc')]);router[_0x9e3e('0xd')](_0x9e3e('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9e3e('0xe'),auth[_0x9e3e('0xa')](),controller[_0x9e3e('0xf')]);module[_0x9e3e('0x10')]=router;
\ No newline at end of file
+var _0x65bc=['/describe','describe','/:id','show','post','create','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','get'];(function(_0x2993dd,_0xd88e7d){var _0x3814b2=function(_0x5b1a41){while(--_0x5b1a41){_0x2993dd['push'](_0x2993dd['shift']());}};_0x3814b2(++_0xd88e7d);}(_0x65bc,0x1c8));var _0xc65b=function(_0x2383b3,_0xa31137){_0x2383b3=_0x2383b3-0x0;var _0xc10b13=_0x65bc[_0x2383b3];return _0xc10b13;};'use strict';var multer=require(_0xc65b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc65b('0x1'));var express=require(_0xc65b('0x2'));var router=express[_0xc65b('0x3')]();var fs_extra=require(_0xc65b('0x4'));var auth=require(_0xc65b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc65b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc65b('0x7')](_0xc65b('0x8'),auth['isAuthenticated'](),controller[_0xc65b('0x9')]);router[_0xc65b('0x7')](_0xc65b('0xa'),auth['isAuthenticated'](),controller[_0xc65b('0xb')]);router[_0xc65b('0xc')]('/',auth['isAuthenticated'](),controller[_0xc65b('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc65b('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc65b('0xf')]);module['exports']=router;
\ No newline at end of file
index bfe6af9..df61e38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e8f8b,_0x5c7b1d){_0x4e8f8b=_0x4e8f8b-0x0;var _0x7f6ee8=_0xedd9[_0x4e8f8b];return _0x7f6ee8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'name':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'unique':_0x9edd('0x3')},'description':{'type':Sequelize[_0x9edd('0x2')]},'mapKey':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x4')},'key':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9edd('0x2')]},'animation':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x9edd('0x9'),_0x9edd('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xb')},'start_chat_button':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xc')},'offline_chat_button':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xd')},'header_offline':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9edd('0x11')]},'closingQuestion':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x13')},'noteTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x14')},'closingMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x9edd('0x16'),_0x9edd('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return JSON[_0x9edd('0x18')]({'items':[{'type':_0x9edd('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x9edd('0x1a'),'required':!![]},'props':{'title':_0x9edd('0x1b'),'helpText':''}},{'type':_0x9edd('0x19'),'props':{'title':_0x9edd('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9edd('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9edd('0x1c')](_0x9edd('0x1d'))?JSON[_0x9edd('0x1e')](this[_0x9edd('0x1c')](_0x9edd('0x1d'))):{};},'set':function(_0x4d507f){return this['setDataValue'](_0x9edd('0x1d'),JSON[_0x9edd('0x18')](_0x4d507f));}},'offlineForm':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return JSON[_0x9edd('0x18')]({'items':[{'type':_0x9edd('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9edd('0x4')},'variable':null},{'type':_0x9edd('0x1f'),'config':{'placeholder':_0x9edd('0x20')},'props':{'title':'Comments','helpText':_0x9edd('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x9edd('0x1c')](_0x9edd('0x22'))?JSON[_0x9edd('0x1e')](this['getDataValue'](_0x9edd('0x22'))):{};},'set':function(_0x3fb556){return this[_0x9edd('0x23')](_0x9edd('0x22'),JSON[_0x9edd('0x18')](_0x3fb556));}},'token':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return rs[_0x9edd('0x24')]();}},'autoclose':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9edd('0x2')]},'forwardOffline':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9edd('0x2')]},'waitingTitle':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x9edd('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x29')},'skipUnmanaged':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x15')},'sendUnmanaged':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9edd('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9edd('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9edd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2b')},'messagesAlignment':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2c')},'defaultTitle':{'type':Sequelize[_0x9edd('0x2')]},'customerAvatar':{'type':Sequelize[_0x9edd('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9edd('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':_0x9edd('0x2d')},'systemAvatar':{'type':Sequelize[_0x9edd('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9edd('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':![],'comment':_0x9edd('0x2f'),'set':function(_0x48958a){if(!_0x48958a)this[_0x9edd('0x23')]('mandatoryDispositionPauseId',null);this[_0x9edd('0x23')](_0x9edd('0x30'),_0x48958a);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9edd('0x2')]},'vidaooTopic':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![],'defaultValue':_0x9edd('0x31')},'vidaooNote':{'type':Sequelize[_0x9edd('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x9edd('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9edd('0x11')]}};
\ No newline at end of file
+var _0x1339=['New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Send','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','thumb','stringify','input','text','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x592307,_0x2b8719){var _0x244eb8=function(_0x3e7c78){while(--_0x3e7c78){_0x592307['push'](_0x592307['shift']());}};_0x244eb8(++_0x2b8719);}(_0x1339,0x1ed));var _0x9133=function(_0x4c4f91,_0x429a4b){_0x4c4f91=_0x4c4f91-0x0;var _0x1616bc=_0x1339[_0x4c4f91];return _0x1616bc;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9133('0x0')]={'name':{'type':Sequelize[_0x9133('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'unique':_0x9133('0x2')},'description':{'type':Sequelize[_0x9133('0x1')]},'mapKey':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x3')},'mapKeyOffline':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x9133('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9133('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9133('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9133('0x8')](_0x9133('0x9'),_0x9133('0xa')),'defaultValue':_0x9133('0x9')},'header_online':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0xc')},'offline_chat_button':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9133('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9133('0x10')]},'closingQuestion':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x12')},'noteTitle':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x13')},'placeholderMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x9133('0x8')]('star',_0x9133('0x15')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9133('0x16')]({'items':[{'type':_0x9133('0x17'),'variable':null,'config':{'placeholder':'name','type':_0x9133('0x18'),'required':!![]},'props':{'title':_0x9133('0x19'),'helpText':''}},{'type':_0x9133('0x17'),'props':{'title':_0x9133('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9133('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x9133('0x1a'))?JSON[_0x9133('0x1b')](this[_0x9133('0x1c')](_0x9133('0x1a'))):{};},'set':function(_0x4483ef){return this[_0x9133('0x1d')](_0x9133('0x1a'),JSON[_0x9133('0x16')](_0x4483ef));}},'offlineForm':{'type':Sequelize[_0x9133('0x10')],'defaultValue':function(){return JSON[_0x9133('0x16')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x9133('0x3'),'type':_0x9133('0x3')},'variable':null},{'type':_0x9133('0x1e'),'config':{'placeholder':_0x9133('0x1f')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x9133('0x1c')](_0x9133('0x20'))?JSON[_0x9133('0x1b')](this[_0x9133('0x1c')](_0x9133('0x20'))):{};},'set':function(_0x88326c){return this['setDataValue']('offlineForm',JSON['stringify'](_0x88326c));}},'token':{'type':Sequelize[_0x9133('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9133('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9133('0x1')]},'waitingTitle':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x21')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9133('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x14')},'sendUnmanaged':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x25')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9133('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9133('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9133('0x10')],'defaultValue':function(){return _0x9133('0x26');}},'notificationSound':{'type':Sequelize[_0x9133('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9133('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x2a')},'defaultTitle':{'type':Sequelize[_0x9133('0x1')]},'customerAvatar':{'type':Sequelize[_0x9133('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9133('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9133('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9133('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9133('0x1')],'defaultValue':_0x9133('0x2b')},'systemAvatar':{'type':Sequelize[_0x9133('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9133('0x7')],'comment':_0x9133('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xafd8f9){if(!_0xafd8f9)this[_0x9133('0x1d')](_0x9133('0x2d'),null);this[_0x9133('0x1d')](_0x9133('0x2e'),_0xafd8f9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9133('0x1')]},'vidaooTopic':{'type':Sequelize[_0x9133('0x1')],'allowNull':![],'defaultValue':_0x9133('0x2f')},'vidaooNote':{'type':Sequelize[_0x9133('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x9133('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9133('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9133('0x10')]}};
\ No newline at end of file
index 936faac..ac3bc8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x73a5=['contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','autoclose','close','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','offline','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','fromString','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','getProactiveActions','License','increment','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.ejs','URL','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','referer','virtual','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','finally','getApplications','addProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','Contact','addAgents','removeAgents','emit','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','catch','status','end','json','limit','offset','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','options','includeAll','include','findAll','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','findOne','Disposition','merge','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','existsSync','join','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','ChatApplication','account','applications','list','orderBy','priority','asc','Applications','Contacts'];(function(_0x20692b,_0xb26d10){var _0x56e6df=function(_0x9a781d){while(--_0x9a781d){_0x20692b['push'](_0x20692b['shift']());}};_0x56e6df(++_0xb26d10);}(_0x73a5,0x8d));var _0x573a=function(_0x29290f,_0x146b26){_0x29290f=_0x29290f-0x0;var _0x3b4e63=_0x73a5[_0x29290f];return _0x3b4e63;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x573a('0x0'));var util=require('util');var path=require(_0x573a('0x1'));var ejs=require(_0x573a('0x2'));var fs=require('fs');var fs_extra=require(_0x573a('0x3'));var _=require(_0x573a('0x4'));var querystring=require(_0x573a('0x5'));var Redis=require('ioredis');var qs=require(_0x573a('0x6'));var logger=require(_0x573a('0x7'))(_0x573a('0x8'));var config=require(_0x573a('0x9'));var url=require(_0x573a('0xa'));var db=require('../../mysqldb')['db'];config[_0x573a('0xb')]=_[_0x573a('0xc')](config[_0x573a('0xb')],{'host':_0x573a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x573a('0xb')]));require(_0x573a('0xe'))[_0x573a('0xf')](socket);var htmlToText=require(_0x573a('0x10'));var jayson=require('jayson/promise');var client=jayson[_0x573a('0x11')][_0x573a('0x12')]({'port':0x232c});var client9002=jayson[_0x573a('0x11')][_0x573a('0x12')]({'port':0x232a});var client9003=jayson[_0x573a('0x11')][_0x573a('0x12')]({'port':0x232b});var client9001=jayson[_0x573a('0x11')][_0x573a('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x2ab812,_0x17ddf9,_0x5c4deb,_0x1502ca){return new BPromise(function(_0x3afff7,_0x44c34a){var _0x39846e=_0x1502ca||client;return _0x39846e[_0x573a('0x13')](_0x2ab812,_0x5c4deb)[_0x573a('0x14')](function(_0xf696af){logger[_0x573a('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x17ddf9,'request\x20sent');logger[_0x573a('0x16')](_0x573a('0x17'),_0x17ddf9,'request\x20sent',JSON[_0x573a('0x18')](_0xf696af));if(_0xf696af['error']){if(_0xf696af[_0x573a('0x19')][_0x573a('0x1a')]===0x1f4){logger['error'](_0x573a('0x1b'),_0x17ddf9,_0xf696af[_0x573a('0x19')][_0x573a('0x1c')]);return _0x44c34a(_0xf696af[_0x573a('0x19')][_0x573a('0x1c')]);}logger[_0x573a('0x19')](_0x573a('0x1b'),_0x17ddf9,_0xf696af[_0x573a('0x19')][_0x573a('0x1c')]);return _0x3afff7(_0xf696af[_0x573a('0x19')][_0x573a('0x1c')]);}else{logger[_0x573a('0x15')](_0x573a('0x1b'),_0x17ddf9,_0x573a('0x1d'));_0x3afff7(_0xf696af[_0x573a('0x1e')]['message']);}})[_0x573a('0x1f')](function(_0x25a026){logger[_0x573a('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x17ddf9,_0x25a026);_0x44c34a(_0x25a026);});});}function respondWithStatusCode(_0x4102db,_0x242fee){_0x242fee=_0x242fee||0xcc;return function(_0x330a5a){if(_0x330a5a){return _0x4102db['sendStatus'](_0x242fee);}return _0x4102db[_0x573a('0x20')](_0x242fee)[_0x573a('0x21')]();};}function respondWithResult(_0x1859d0,_0x1f0970){_0x1f0970=_0x1f0970||0xc8;return function(_0xbc6078){if(_0xbc6078){return _0x1859d0[_0x573a('0x20')](_0x1f0970)[_0x573a('0x22')](_0xbc6078);}};}function respondWithFilteredResult(_0x577e17,_0x18938a){return function(_0x23421d){if(_0x23421d){var _0x170da2=typeof _0x18938a['offset']==='undefined'&&typeof _0x18938a[_0x573a('0x23')]==='undefined';var _0x56d3af=_0x23421d['count'];var _0x4a53a6=_0x170da2?0x0:_0x18938a[_0x573a('0x24')];var _0x2c03d4=_0x170da2?_0x23421d[_0x573a('0x25')]:_0x18938a[_0x573a('0x24')]+_0x18938a[_0x573a('0x23')];var _0x5a725e;if(_0x2c03d4>=_0x56d3af){_0x2c03d4=_0x56d3af;_0x5a725e=0xc8;}else{_0x5a725e=0xce;}_0x577e17[_0x573a('0x20')](_0x5a725e);return _0x577e17[_0x573a('0x26')](_0x573a('0x27'),_0x4a53a6+'-'+_0x2c03d4+'/'+_0x56d3af)[_0x573a('0x22')](_0x23421d);}return null;};}function saveUpdates(_0x23e2b5){return function(_0x19a88b){if(_0x19a88b){return _0x19a88b['update'](_0x23e2b5)[_0x573a('0x14')](function(_0x4fa742){return _0x4fa742;});}return null;};}function removeEntity(_0x5d56b5){return function(_0x127207){if(_0x127207){return _0x127207[_0x573a('0x28')]()['then'](function(){var _0x3c3e0f=_0x127207[_0x573a('0x29')]({'plain':!![]});var _0x2c549b=_0x573a('0x2a');return db[_0x573a('0x2b')]['destroy']({'where':{'type':_0x2c549b,'resourceId':_0x3c3e0f['id']}})[_0x573a('0x14')](function(){return _0x127207;});})[_0x573a('0x14')](function(){_0x5d56b5['status'](0xcc)[_0x573a('0x21')]();});}};}function handleEntityNotFound(_0x3adb96){return function(_0x89c3da){if(!_0x89c3da){_0x3adb96[_0x573a('0x2c')](0x194);}return _0x89c3da;};}function handleError(_0x4478f5,_0x55723e){_0x55723e=_0x55723e||0x1f4;return function(_0x575787){logger['error'](_0x575787[_0x573a('0x2d')]);if(_0x575787['name']){delete _0x575787['name'];}_0x4478f5[_0x573a('0x20')](_0x55723e)['send'](_0x575787);};}exports[_0x573a('0x2e')]=function(_0x237032,_0x3c1cec){var _0x17968b={'include':[{'model':db[_0x573a('0x2f')],'as':_0x573a('0x30')}]},_0x4efd2e={},_0x445cc9={'count':0x0,'rows':[]};var _0x194a50=_[_0x573a('0x31')](db[_0x573a('0x32')]['rawAttributes'],function(_0x3190dc){return{'name':_0x3190dc[_0x573a('0x33')],'type':_0x3190dc[_0x573a('0x34')][_0x573a('0x35')]};});_0x4efd2e[_0x573a('0x36')]=_[_0x573a('0x31')](_0x194a50,'name');_0x4efd2e[_0x573a('0x37')]=_[_0x573a('0x38')](_0x237032[_0x573a('0x37')]);_0x4efd2e[_0x573a('0x39')]=_[_0x573a('0x3a')](_0x4efd2e[_0x573a('0x36')],_0x4efd2e[_0x573a('0x37')]);_0x17968b[_0x573a('0x3b')]=_['intersection'](_0x4efd2e[_0x573a('0x36')],qs['fields'](_0x237032['query'][_0x573a('0x3c')]));_0x17968b['attributes']=_0x17968b['attributes'][_0x573a('0x3d')]?_0x17968b['attributes']:_0x4efd2e[_0x573a('0x36')];if(!_0x237032[_0x573a('0x37')][_0x573a('0x3e')](_0x573a('0x3f'))){_0x17968b[_0x573a('0x23')]=qs[_0x573a('0x23')](_0x237032[_0x573a('0x37')]['limit']);_0x17968b[_0x573a('0x24')]=qs[_0x573a('0x24')](_0x237032['query'][_0x573a('0x24')]);}_0x17968b[_0x573a('0x40')]=qs['sort'](_0x237032['query'][_0x573a('0x41')]);_0x17968b[_0x573a('0x42')]=qs[_0x573a('0x39')](_[_0x573a('0x43')](_0x237032[_0x573a('0x37')],_0x4efd2e[_0x573a('0x39')]),_0x194a50);if(_0x237032[_0x573a('0x37')][_0x573a('0x44')]){_0x17968b[_0x573a('0x42')]=_['merge'](_0x17968b[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x194a50,function(_0x13d261){if(_0x13d261[_0x573a('0x34')]!==_0x573a('0x45')){var _0x21b49f={};_0x21b49f[_0x13d261[_0x573a('0x46')]]={'$like':'%'+_0x237032[_0x573a('0x37')][_0x573a('0x44')]+'%'};return _0x21b49f;}})});}_0x17968b=_['merge']({},_0x17968b,_0x237032[_0x573a('0x47')]);var _0x2befda={'where':_0x17968b[_0x573a('0x42')]};return db[_0x573a('0x32')][_0x573a('0x25')](_0x2befda)[_0x573a('0x14')](function(_0xb300bf){_0x445cc9[_0x573a('0x25')]=_0xb300bf;if(_0x237032[_0x573a('0x37')][_0x573a('0x48')]){_0x17968b[_0x573a('0x49')]=[{'all':!![]}];}return db[_0x573a('0x32')][_0x573a('0x4a')](_0x17968b);})[_0x573a('0x14')](function(_0x11ba25){_0x445cc9['rows']=_0x11ba25;return _0x445cc9;})[_0x573a('0x14')](respondWithFilteredResult(_0x3c1cec,_0x17968b))[_0x573a('0x1f')](handleError(_0x3c1cec,null));};exports[_0x573a('0x4b')]=function(_0x61f846,_0x3c6ca9){var _0x1df556={'raw':![],'where':{'id':_0x61f846['params']['id']},'include':[{'model':db[_0x573a('0x2f')],'as':'mandatoryDispositionPause'}]},_0x45243d={};_0x45243d[_0x573a('0x36')]=_[_0x573a('0x38')](db[_0x573a('0x32')][_0x573a('0x4c')]);_0x45243d[_0x573a('0x37')]=_['keys'](_0x61f846['query']);_0x45243d[_0x573a('0x39')]=_['intersection'](_0x45243d[_0x573a('0x36')],_0x45243d['query']);_0x1df556[_0x573a('0x3b')]=_[_0x573a('0x3a')](_0x45243d[_0x573a('0x36')],qs['fields'](_0x61f846[_0x573a('0x37')][_0x573a('0x3c')]));_0x1df556['attributes']=_0x1df556['attributes']['length']?_0x1df556[_0x573a('0x3b')]:_0x45243d['model'];if(_0x61f846[_0x573a('0x37')][_0x573a('0x48')]){_0x1df556[_0x573a('0x49')]=[{'all':!![]}];}_0x1df556=_['merge']({},_0x1df556,_0x61f846['options']);return db['ChatWebsite'][_0x573a('0x4d')](_0x1df556)['then'](handleEntityNotFound(_0x3c6ca9,null))[_0x573a('0x14')](respondWithResult(_0x3c6ca9,null))[_0x573a('0x1f')](handleError(_0x3c6ca9,null));};exports[_0x573a('0x4e')]=function(_0x2a3ff6,_0x5e11f5){return db[_0x573a('0x32')]['create'](_0x2a3ff6[_0x573a('0x4f')],{})[_0x573a('0x14')](function(_0x54e859){var _0x17defd=_0x2a3ff6[_0x573a('0x50')][_0x573a('0x29')]({'plain':!![]});if(!_0x17defd)throw new Error(_0x573a('0x51'));if(_0x17defd[_0x573a('0x52')]===_0x573a('0x50')){var _0x3266ed=_0x54e859[_0x573a('0x29')]({'plain':!![]});var _0x3368fb='ChatWebsites';return db[_0x573a('0x53')][_0x573a('0x4d')]({'where':{'name':_0x3368fb,'userProfileId':_0x17defd['userProfileId']},'raw':!![]})['then'](function(_0x34cfbe){if(_0x34cfbe&&_0x34cfbe[_0x573a('0x54')]===0x0){return db['UserProfileResource'][_0x573a('0x4e')]({'name':_0x3266ed[_0x573a('0x46')],'resourceId':_0x3266ed['id'],'type':_0x34cfbe[_0x573a('0x46')],'sectionId':_0x34cfbe['id']},{})[_0x573a('0x14')](function(){return _0x54e859;});}else{return _0x54e859;}})['catch'](function(_0x52f1d1){logger[_0x573a('0x19')](_0x573a('0x55'),_0x52f1d1);throw _0x52f1d1;});}return _0x54e859;})['then'](respondWithResult(_0x5e11f5,0xc9))[_0x573a('0x1f')](handleError(_0x5e11f5,null));};exports['update']=function(_0x375317,_0x1542d3){if(_0x375317['body']['id']){delete _0x375317[_0x573a('0x4f')]['id'];}return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x375317[_0x573a('0x56')]['id']},'include':[{'model':db[_0x573a('0x2f')],'as':'mandatoryDispositionPause'}]})[_0x573a('0x14')](handleEntityNotFound(_0x1542d3,null))[_0x573a('0x14')](saveUpdates(_0x375317[_0x573a('0x4f')],null))[_0x573a('0x14')](respondWithResult(_0x1542d3,null))[_0x573a('0x1f')](handleError(_0x1542d3,null));};exports[_0x573a('0x28')]=function(_0x350697,_0xb7df4b){return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x350697[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0xb7df4b,null))[_0x573a('0x14')](removeEntity(_0xb7df4b,null))['catch'](handleError(_0xb7df4b,null));};exports[_0x573a('0x57')]=function(_0x3a5b19,_0x4f81ae){return db[_0x573a('0x32')][_0x573a('0x57')]()[_0x573a('0x14')](respondWithResult(_0x4f81ae,null))[_0x573a('0x1f')](handleError(_0x4f81ae,null));};exports['addDisposition']=function(_0x320187,_0x42d03a){if(_0x320187[_0x573a('0x4f')]['id']){delete _0x320187['body']['id'];}return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x320187[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x42d03a,null))[_0x573a('0x14')](function(_0x19cd72){if(_0x19cd72){_0x320187[_0x573a('0x4f')][_0x573a('0x58')]=_0x19cd72['id'];return db['Disposition'][_0x573a('0x4e')](_0x320187[_0x573a('0x4f')]);}})[_0x573a('0x14')](respondWithResult(_0x42d03a,null))['catch'](handleError(_0x42d03a,null));};exports['getDispositions']=function(_0x5db23e,_0x2994db){var _0x178dd7={'raw':![],'where':{}};var _0x3f1e3f={};var _0x3a071f={'count':0x0,'rows':[]};return db[_0x573a('0x32')][_0x573a('0x59')]({'where':{'id':_0x5db23e[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x2994db,null))[_0x573a('0x14')](function(_0x35bc96){if(_0x35bc96){_0x3f1e3f[_0x573a('0x36')]=_[_0x573a('0x38')](db[_0x573a('0x5a')][_0x573a('0x4c')]);_0x3f1e3f['query']=_[_0x573a('0x38')](_0x5db23e[_0x573a('0x37')]);_0x3f1e3f[_0x573a('0x39')]=_[_0x573a('0x3a')](_0x3f1e3f[_0x573a('0x36')],_0x3f1e3f[_0x573a('0x37')]);_0x178dd7[_0x573a('0x3b')]=_[_0x573a('0x3a')](_0x3f1e3f['model'],qs[_0x573a('0x3c')](_0x5db23e[_0x573a('0x37')][_0x573a('0x3c')]));_0x178dd7['attributes']=_0x178dd7[_0x573a('0x3b')]['length']?_0x178dd7[_0x573a('0x3b')]:_0x3f1e3f['model'];if(!_0x5db23e['query'][_0x573a('0x3e')](_0x573a('0x3f'))){_0x178dd7[_0x573a('0x23')]=qs[_0x573a('0x23')](_0x5db23e[_0x573a('0x37')][_0x573a('0x23')]);_0x178dd7[_0x573a('0x24')]=qs[_0x573a('0x24')](_0x5db23e[_0x573a('0x37')]['offset']);}_0x178dd7[_0x573a('0x40')]=qs[_0x573a('0x41')](_0x5db23e[_0x573a('0x37')][_0x573a('0x41')]);_0x178dd7[_0x573a('0x42')]=qs[_0x573a('0x39')](_['pick'](_0x5db23e['query'],_0x3f1e3f[_0x573a('0x39')]));_0x178dd7['where'][_0x573a('0x58')]=_0x35bc96['id'];if(_0x5db23e['query'][_0x573a('0x44')]){_0x178dd7[_0x573a('0x42')]=_['merge'](_0x178dd7['where'],{'$or':_[_0x573a('0x31')](_0x178dd7[_0x573a('0x3b')],function(_0x2856fb){var _0x28ca27={};_0x28ca27[_0x2856fb]={'$like':'%'+_0x5db23e[_0x573a('0x37')]['filter']+'%'};return _0x28ca27;})});}_0x178dd7=_[_0x573a('0x5b')]({},_0x178dd7,_0x5db23e[_0x573a('0x47')]);return db[_0x573a('0x5a')][_0x573a('0x25')]({'where':_0x178dd7[_0x573a('0x42')]})[_0x573a('0x14')](function(_0x252626){_0x3a071f['count']=_0x252626;if(_0x5db23e[_0x573a('0x37')][_0x573a('0x48')]){_0x178dd7[_0x573a('0x49')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x178dd7);})[_0x573a('0x14')](function(_0x3b81a6){_0x3a071f[_0x573a('0x5c')]=_0x3b81a6;return _0x3a071f;});}})[_0x573a('0x14')](respondWithFilteredResult(_0x2994db,_0x178dd7))['catch'](handleError(_0x2994db,null));};exports[_0x573a('0x5d')]=function(_0x524392,_0x4068df){return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x524392[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x4068df,null))[_0x573a('0x14')](function(_0x497a6b){if(_0x497a6b){return _0x497a6b[_0x573a('0x5d')](_0x524392[_0x573a('0x37')][_0x573a('0x5e')]);}})[_0x573a('0x14')](respondWithStatusCode(_0x4068df,null))[_0x573a('0x1f')](handleError(_0x4068df,null));};exports[_0x573a('0x5f')]=function(_0x407d08,_0x14d6b8){if(_0x407d08[_0x573a('0x4f')]['id']){delete _0x407d08[_0x573a('0x4f')]['id'];}return db['ChatWebsite'][_0x573a('0x4d')]({'where':{'id':_0x407d08['params']['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x14d6b8,null))[_0x573a('0x14')](function(_0x17406c){if(_0x17406c){_0x407d08[_0x573a('0x4f')][_0x573a('0x58')]=_0x17406c['id'];return db[_0x573a('0x60')][_0x573a('0x4e')](_0x407d08['body']);}})[_0x573a('0x14')](respondWithResult(_0x14d6b8,null))[_0x573a('0x1f')](handleError(_0x14d6b8,null));};exports[_0x573a('0x61')]=function(_0x27acf4,_0x3724ed){var _0x22a0cb={'raw':![],'where':{}};var _0x5c0578={};var _0xccaabc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x573a('0x59')]({'where':{'id':_0x27acf4[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x3724ed,null))['then'](function(_0x3aa3b0){if(_0x3aa3b0){_0x5c0578['model']=_['keys'](db[_0x573a('0x60')][_0x573a('0x4c')]);_0x5c0578['query']=_[_0x573a('0x38')](_0x27acf4[_0x573a('0x37')]);_0x5c0578[_0x573a('0x39')]=_[_0x573a('0x3a')](_0x5c0578[_0x573a('0x36')],_0x5c0578[_0x573a('0x37')]);_0x22a0cb[_0x573a('0x3b')]=_[_0x573a('0x3a')](_0x5c0578[_0x573a('0x36')],qs[_0x573a('0x3c')](_0x27acf4[_0x573a('0x37')]['fields']));_0x22a0cb[_0x573a('0x3b')]=_0x22a0cb[_0x573a('0x3b')][_0x573a('0x3d')]?_0x22a0cb[_0x573a('0x3b')]:_0x5c0578[_0x573a('0x36')];if(!_0x27acf4[_0x573a('0x37')]['hasOwnProperty'](_0x573a('0x3f'))){_0x22a0cb[_0x573a('0x23')]=qs[_0x573a('0x23')](_0x27acf4[_0x573a('0x37')]['limit']);_0x22a0cb['offset']=qs[_0x573a('0x24')](_0x27acf4[_0x573a('0x37')][_0x573a('0x24')]);}_0x22a0cb[_0x573a('0x40')]=qs[_0x573a('0x41')](_0x27acf4[_0x573a('0x37')][_0x573a('0x41')]);_0x22a0cb[_0x573a('0x42')]=qs[_0x573a('0x39')](_[_0x573a('0x43')](_0x27acf4[_0x573a('0x37')],_0x5c0578['filters']));_0x22a0cb[_0x573a('0x42')]['ChatWebsiteId']=_0x3aa3b0['id'];if(_0x27acf4['query'][_0x573a('0x44')]){_0x22a0cb[_0x573a('0x42')]=_[_0x573a('0x5b')](_0x22a0cb[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x22a0cb[_0x573a('0x3b')],function(_0x5cde69){var _0x54fee4={};_0x54fee4[_0x5cde69]={'$like':'%'+_0x27acf4['query'][_0x573a('0x44')]+'%'};return _0x54fee4;})});}_0x22a0cb=_[_0x573a('0x5b')]({},_0x22a0cb,_0x27acf4[_0x573a('0x47')]);return db[_0x573a('0x60')]['count']({'where':_0x22a0cb[_0x573a('0x42')]})[_0x573a('0x14')](function(_0x2d0bb7){_0xccaabc[_0x573a('0x25')]=_0x2d0bb7;if(_0x27acf4[_0x573a('0x37')][_0x573a('0x48')]){_0x22a0cb[_0x573a('0x49')]=[{'all':!![]}];}return db[_0x573a('0x60')][_0x573a('0x4a')](_0x22a0cb);})[_0x573a('0x14')](function(_0xc0b0e0){_0xccaabc[_0x573a('0x5c')]=_0xc0b0e0;return _0xccaabc;});}})[_0x573a('0x14')](respondWithFilteredResult(_0x3724ed,_0x22a0cb))[_0x573a('0x1f')](handleError(_0x3724ed,null));};exports[_0x573a('0x62')]=function(_0x120be4,_0x18240a){return db['ChatWebsite'][_0x573a('0x4d')]({'where':{'id':_0x120be4[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x18240a,null))['then'](function(_0x17369f){if(_0x17369f){return _0x17369f['removeAnswers'](_0x120be4['query']['ids']);}})[_0x573a('0x14')](respondWithStatusCode(_0x18240a,null))[_0x573a('0x1f')](handleError(_0x18240a,null));};exports[_0x573a('0x63')]=function(_0x2d2bee,_0x1c5f59){_0x2d2bee[_0x573a('0x4f')][_0x573a('0x64')]=_0x2d2bee['file']['filename'];return db['ChatWebsite'][_0x573a('0x4d')]({'where':{'id':_0x2d2bee[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x1c5f59,null))[_0x573a('0x14')](saveUpdates(_0x2d2bee[_0x573a('0x4f')],null))['then'](respondWithResult(_0x1c5f59,null))[_0x573a('0x1f')](handleError(_0x1c5f59,null));};exports['addAvatar']=function(_0x3f31f7,_0x1b3197){_0x3f31f7[_0x573a('0x4f')]['agentAvatar']=_0x3f31f7[_0x573a('0x65')][_0x573a('0x66')];return db[_0x573a('0x32')]['find']({'where':{'id':_0x3f31f7[_0x573a('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b3197,null))[_0x573a('0x14')](saveUpdates(_0x3f31f7['body'],null))[_0x573a('0x14')](respondWithResult(_0x1b3197,null))[_0x573a('0x1f')](handleError(_0x1b3197,null));};exports[_0x573a('0x67')]=function(_0x533f12,_0x47c612){_0x533f12[_0x573a('0x4f')][_0x573a('0x68')]=_0x533f12[_0x573a('0x65')][_0x573a('0x66')];return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x533f12[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x47c612,null))['then'](saveUpdates(_0x533f12['body'],null))['then'](respondWithResult(_0x47c612,null))['catch'](handleError(_0x47c612,null));};exports[_0x573a('0x69')]=function(_0x1836e1,_0x2cade4){_0x1836e1[_0x573a('0x4f')][_0x573a('0x6a')]=_0x1836e1[_0x573a('0x65')][_0x573a('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x1836e1['params']['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x2cade4,null))[_0x573a('0x14')](saveUpdates(_0x1836e1[_0x573a('0x4f')],null))['then'](respondWithResult(_0x2cade4,null))[_0x573a('0x1f')](handleError(_0x2cade4,null));};exports[_0x573a('0x6b')]=function(_0x269b1f,_0x4370f0){var _0x2a3efc=path['join'](config[_0x573a('0x6c')],'server/files/images/logos/default_logo.svg');var _0x339599={'where':{'id':_0x269b1f[_0x573a('0x56')]['id']},'attributes':['id',_0x573a('0x64')],'raw':!![]};var _0x8c92c1=![];return require(_0x573a('0x6d'))[_0x573a('0x6e')]()[_0x573a('0x14')](function(_0xcf921e){if(_0xcf921e){_0x8c92c1=_0xcf921e[_0x573a('0x6f')];}})[_0x573a('0x14')](function(){return db[_0x573a('0x32')][_0x573a('0x4d')](_0x339599);})[_0x573a('0x14')](handleEntityNotFound(_0x4370f0,null))[_0x573a('0x14')](function(_0x5698e6){if(_0x5698e6){if(!_['isNil'](_0x5698e6[_0x573a('0x64')])){if(fs[_0x573a('0x70')](path[_0x573a('0x71')](config[_0x573a('0x6c')],'server/files/images/logos/',_0x5698e6[_0x573a('0x64')]))&&_0x8c92c1){_0x2a3efc=path[_0x573a('0x71')](config[_0x573a('0x6c')],'server/files/images/logos/',_0x5698e6[_0x573a('0x64')]);}}return _0x4370f0[_0x573a('0x72')](_0x2a3efc);}})['catch'](handleError(_0x4370f0,null));};exports[_0x573a('0x73')]=function(_0x4c9145,_0xe66b2a){var _0x56a5a6=path['join'](config[_0x573a('0x6c')],_0x573a('0x74'));var _0x304424={'where':{'id':_0x4c9145[_0x573a('0x56')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x573a('0x32')][_0x573a('0x4d')](_0x304424)['then'](handleEntityNotFound(_0xe66b2a,null))[_0x573a('0x14')](function(_0x1183e4){if(_0x1183e4){if(!_[_0x573a('0x75')](_0x1183e4[_0x573a('0x76')])){if(fs['existsSync'](path[_0x573a('0x71')](config[_0x573a('0x6c')],'server/files/images/avatars/',_0x1183e4[_0x573a('0x76')]))){_0x56a5a6=path['join'](config[_0x573a('0x6c')],'server/files/images/avatars/',_0x1183e4[_0x573a('0x76')]);}}return _0xe66b2a['download'](_0x56a5a6);}})[_0x573a('0x1f')](handleError(_0xe66b2a,null));};exports[_0x573a('0x77')]=function(_0x3024ba,_0x4af0d3){var _0x1f4f5d=path[_0x573a('0x71')](config['root'],_0x573a('0x78'));var _0x3676c1={'where':{'id':_0x3024ba[_0x573a('0x56')]['id']},'attributes':['id',_0x573a('0x68'),_0x573a('0x79')],'raw':!![]};return db['ChatWebsite'][_0x573a('0x4d')](_0x3676c1)['then'](handleEntityNotFound(_0x4af0d3,null))['then'](function(_0x4491b5){if(_0x4491b5){if(!_[_0x573a('0x75')](_0x4491b5[_0x573a('0x68')])){if(fs[_0x573a('0x70')](path[_0x573a('0x71')](config[_0x573a('0x6c')],_0x573a('0x7a'),_0x4491b5['customerAvatar']))&&_0x4491b5[_0x573a('0x79')]){_0x1f4f5d=path['join'](config[_0x573a('0x6c')],_0x573a('0x7a'),_0x4491b5[_0x573a('0x68')]);}}return _0x4af0d3[_0x573a('0x72')](_0x1f4f5d);}})['catch'](handleError(_0x4af0d3,null));};exports[_0x573a('0x7b')]=function(_0x2b9db4,_0x57edf4){var _0x5da2b5=path[_0x573a('0x71')](config[_0x573a('0x6c')],'server/files/images/avatars/system_avatar.png');var _0x2a6163={'where':{'id':_0x2b9db4[_0x573a('0x56')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x573a('0x32')][_0x573a('0x4d')](_0x2a6163)['then'](handleEntityNotFound(_0x57edf4,null))[_0x573a('0x14')](function(_0x2d2ebc){if(_0x2d2ebc){if(!_[_0x573a('0x75')](_0x2d2ebc[_0x573a('0x6a')])){if(fs['existsSync'](path[_0x573a('0x71')](config[_0x573a('0x6c')],_0x573a('0x7a'),_0x2d2ebc['systemAvatar']))){_0x5da2b5=path['join'](config[_0x573a('0x6c')],_0x573a('0x7a'),_0x2d2ebc[_0x573a('0x6a')]);}}return _0x57edf4[_0x573a('0x72')](_0x5da2b5);}})['catch'](handleError(_0x57edf4,null));};exports[_0x573a('0x7c')]=function(_0x1f0834,_0x136750){var _0x5e0d5f=require(_0x573a('0x7d'));var _0x5d09be=new _0x5e0d5f();var _0x5915ab=_0x5d09be['setUA'](_0x1f0834[_0x573a('0x7e')][_0x573a('0x7f')])[_0x573a('0x80')]();var _0x563643={'body':_0x1f0834[_0x573a('0x4f')],'channel':_0x573a('0x81')};var _0x57baea=[];var _0x14f886=[];var _0x2c726e={};var _0x415b94=![];return db[_0x573a('0x82')]['describe']()['then'](function(_0x1607d3){if(!_0x1607d3){throw new db[(_0x573a('0x83'))][(_0x573a('0x84'))](_0x573a('0x85'));}_0x57baea=_[_0x573a('0x86')](_[_0x573a('0x38')](_0x1607d3),[_0x573a('0x87'),_0x573a('0x88')]);_0x14f886=_['difference'](_[_0x573a('0x38')](_0x1607d3),[_0x573a('0x87'),'updatedAt',_0x573a('0x89'),_0x573a('0x8a')]);if(_0x1f0834[_0x573a('0x4f')]['id']){delete _0x1f0834[_0x573a('0x4f')]['id'];}if(_[_0x573a('0x75')](_0x1f0834[_0x573a('0x4f')][_0x573a('0x8b')])){throw new db[(_0x573a('0x83'))][(_0x573a('0x84'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1f0834[_0x573a('0x4f')]['body'])||_0x1f0834[_0x573a('0x4f')][_0x573a('0x4f')]===''){throw new db['Sequelize'][(_0x573a('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x573a('0x75')](_0x1f0834[_0x573a('0x4f')][_0x573a('0x8c')])){throw new db['Sequelize']['ValidationError'](_0x573a('0x8d')+_0x14f886);}if(!_[_0x573a('0x8e')](_0x14f886,_0x1f0834[_0x573a('0x4f')][_0x573a('0x8c')])){throw new db[(_0x573a('0x83'))][(_0x573a('0x84'))](_0x573a('0x8f')+_0x14f886);}_0x2c726e[_0x1f0834[_0x573a('0x4f')][_0x573a('0x8c')]]=_0x1f0834[_0x573a('0x4f')][_0x573a('0x8b')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1f0834[_0x573a('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x573a('0x90'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2c726e,'limit':0x1,'order':[[_0x573a('0x88'),_0x573a('0x91')]]}]},{'model':db[_0x573a('0x92')],'as':'Applications'}]});})[_0x573a('0x14')](handleEntityNotFound(_0x136750,null))['then'](function(_0x140c5b){if(_0x140c5b&&_0x140c5b[_0x573a('0x90')]){_0x563643[_0x573a('0x93')]=_0x140c5b;_0x563643[_0x573a('0x94')]=_0x140c5b['Applications'];_0x563643[_0x573a('0x95')]=_0x140c5b[_0x573a('0x90')];_0x563643[_0x573a('0x94')]=_[_0x573a('0x96')](_0x563643[_0x573a('0x94')],[_0x573a('0x97')],[_0x573a('0x98')]);if(_0x563643[_0x573a('0x93')][_0x573a('0x99')]){delete _0x563643[_0x573a('0x93')][_0x573a('0x99')];}if(_0x563643[_0x573a('0x93')][_0x573a('0x90')]&&_0x563643['account'][_0x573a('0x90')][_0x573a('0x9a')]['length']){return _0x563643[_0x573a('0x93')][_0x573a('0x90')]['Contacts'][0x0];}var _0x441240=_[_0x573a('0xc')](_0x1f0834[_0x573a('0x4f')],{'firstName':_0x1f0834['body'][_0x573a('0x8b')],'ListId':_0x140c5b[_0x573a('0x8a')]});_0x441240[_0x1f0834['body']['mapKey']]=_0x1f0834['body'][_0x573a('0x8b')];return db['CmContact']['create'](_0x441240,{'fields':_0x57baea,'raw':!![]});}})['then'](handleEntityNotFound(_0x136750,null))[_0x573a('0x14')](function(_0x2c17bb){_0x563643[_0x573a('0x9b')]=_0x2c17bb;var _0x751814=_0x1f0834['body']['customerIp'];if(_0x1f0834[_0x573a('0x7e')][_0x573a('0x9c')]){_0x751814=_0x1f0834[_0x573a('0x7e')][_0x573a('0x9c')];}else if(_0x1f0834[_0x573a('0x7e')][_0x573a('0x9d')]){_0x751814=_[_0x573a('0x9e')](_0x1f0834[_0x573a('0x7e')][_0x573a('0x9d')]['split'](','));}if(_0x2c17bb){var _0x226b67={'ContactId':_0x2c17bb['id'],'ChatWebsiteId':_0x1f0834[_0x573a('0x56')]['id'],'from':(_0x2c17bb[_0x573a('0x9f')]||'')+'\x20'+(_0x2c17bb[_0x573a('0xa0')]||''),'customerIp':_0x751814,'customerPort':_0x1f0834[_0x573a('0x7e')][_0x573a('0xa1')]?_0x1f0834[_0x573a('0x7e')][_0x573a('0xa1')]:null,'referer':_0x1f0834[_0x573a('0x4f')]['referer'],'browserName':_0x5915ab[_0x573a('0xa2')][_0x573a('0x46')]&&_0x5915ab['browser'][_0x573a('0xa3')]?util[_0x573a('0xa4')](_0x573a('0xa5'),_0x5915ab[_0x573a('0xa2')]['name'],_0x5915ab[_0x573a('0xa2')][_0x573a('0xa3')]):_0x573a('0xa6'),'browserVersion':_0x5915ab['browser'][_0x573a('0xa3')]||_0x573a('0xa6'),'osName':util[_0x573a('0xa4')](_0x573a('0xa5'),_0x5915ab['os'][_0x573a('0x46')],_0x5915ab['os'][_0x573a('0xa3')]),'osVersion':_0x5915ab['os'][_0x573a('0xa3')],'deviceModel':_0x5915ab[_0x573a('0xa7')][_0x573a('0x36')]&&_0x5915ab[_0x573a('0xa7')][_0x573a('0xa8')]?util[_0x573a('0xa4')]('%s\x20%s\x20%s',_0x5915ab['device']['model'],_0x5915ab[_0x573a('0xa7')][_0x573a('0xa8')],_0x5915ab[_0x573a('0xa7')][_0x573a('0x34')]):null,'deviceVendor':_0x5915ab[_0x573a('0xa7')]['vendor'],'deviceType':_0x5915ab[_0x573a('0xa7')][_0x573a('0x34')],'formData':JSON[_0x573a('0x18')](_0x1f0834[_0x573a('0x4f')])};var _0x3fa7ea={'ChatWebsiteId':_0x1f0834[_0x573a('0x56')]['id'],'closed':![]};if(_0x1f0834['body']['threadId']){_0x3fa7ea[_0x573a('0xa9')]=_0x1f0834[_0x573a('0x4f')][_0x573a('0xa9')];return db[_0x573a('0xaa')][_0x573a('0x4d')]({'where':_0x3fa7ea})[_0x573a('0x14')](function(_0xcd7ead){if(_0xcd7ead){return[_0xcd7ead,![]];}_0x226b67['threadId']=_0x1f0834[_0x573a('0x4f')][_0x573a('0xa9')];_0x226b67[_0x573a('0xab')]=_0x1f0834['body']['externalUrl'];return db[_0x573a('0xaa')][_0x573a('0x4e')](_0x226b67)['then'](function(_0x5114f6){return[_0x5114f6,!![]];});});}_0x3fa7ea[_0x573a('0xac')]=_0x2c17bb['id'];if(_0x1f0834[_0x573a('0x4f')]['interaction']&&_0x1f0834[_0x573a('0x4f')]['interaction']['id']){_0x3fa7ea['id']=_0x1f0834[_0x573a('0x4f')][_0x573a('0xad')]['id'];return db['ChatInteraction']['find']({'where':_0x3fa7ea})[_0x573a('0x14')](function(_0x32a96a){if(_0x32a96a){return[_0x32a96a,![]];}return db[_0x573a('0xaa')]['create'](_0x226b67)['then'](function(_0x321084){return[_0x321084,!![]];});});}return db['ChatInteraction'][_0x573a('0x4e')](_0x226b67)[_0x573a('0x14')](function(_0x421e4d){return[_0x421e4d,!![]];});}})[_0x573a('0xae')](function(_0x48b833,_0x4b3b72){if(_0x48b833){_0x415b94=_0x4b3b72;if(!_0x4b3b72){var _0x4b1560={'from':(_0x563643[_0x573a('0x9b')][_0x573a('0x9f')]||'')+'\x20'+(_0x563643[_0x573a('0x9b')][_0x573a('0xa0')]||'')};if(_0x1f0834['body']['threadId']&&_0x1f0834['body'][_0x573a('0xaf')]&&_0x1f0834['body'][_0x573a('0xa9')]!=_0x1f0834[_0x573a('0x4f')]['messageId']){_0x4b1560[_0x573a('0xa9')]=_0x1f0834[_0x573a('0x4f')][_0x573a('0xaf')];}return _0x48b833[_0x573a('0xb0')](_0x4b1560);}else{return _0x48b833;}}})[_0x573a('0x14')](function(_0x441a15){_0x563643[_0x573a('0xad')]=_0x441a15[_0x573a('0x29')]({'plain':!![]});_0x563643[_0x573a('0xad')][_0x573a('0xb1')]=_0x415b94;if(_0x563643[_0x573a('0xad')][_0x573a('0xb1')]){if(_0x563643[_0x573a('0x93')][_0x573a('0xb2')]){_0x563643[_0x573a('0x94')]['push']({'id':0x0,'priority':_0x563643[_0x573a('0x94')][_0x573a('0x3d')]+0x1,'app':_0x573a('0xb3'),'appdata':_0x573a('0xb4'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x573a('0x4e')]({'body':_0x1f0834['body']['body'],'ChatWebsiteId':_0x1f0834['params']['id'],'ChatInteractionId':_0x441a15['id'],'direction':'in','ContactId':_0x563643[_0x573a('0x9b')]['id'],'AttachmentId':_0x1f0834[_0x573a('0x4f')][_0x573a('0xb5')]});})['then'](function(_0x1fdc76){_0x563643[_0x573a('0x1c')]=_0x1fdc76;if(_0x563643[_0x573a('0xad')][_0x573a('0xb6')]){return db[_0x573a('0xb7')][_0x573a('0x4d')]({'attributes':['id','name'],'where':{'id':_0x563643[_0x573a('0xad')]['UserId']}})[_0x573a('0x14')](function(_0x4b5205){if(_0x4b5205){_0x563643[_0x573a('0x94')][_0x573a('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b5205['name']+','+(_0x563643[_0x573a('0x93')][_0x573a('0xb9')]||0xa),'interval':_0x573a('0xba')});_0x563643['forcedOwnership']=!![];}return respondWithRpcPromise(_0x573a('0xbb'),_0x573a('0xbc'),_0x563643);});}return respondWithRpcPromise(_0x573a('0xbb'),'startRouting',_0x563643);})['then'](function(_0x3a61a6){respondWithRpcPromise(_0x573a('0xbd'),_0x573a('0xbd'),{'event':_0x573a('0x7c'),'message':_0x3a61a6},client9002);return _0x3a61a6;})[_0x573a('0x14')](respondWithResult(_0x136750,null))[_0x573a('0x1f')](handleError(_0x136750,null));};exports[_0x573a('0xbe')]=function(_0x49ecc6,_0x36dfbf){var _0x27e6d2,_0x43bce4,_0x2987f4;var _0x1f5d29=[];var _0x6eea43={};var _0x3550e8=_0x49ecc6['files']||[];var _0x47278d=[];var _0x40f235;return db['CmContact'][_0x573a('0x57')]()[_0x573a('0x14')](function(_0x1f402c){if(!_0x1f402c){throw new db[(_0x573a('0x83'))][(_0x573a('0x84'))](_0x573a('0x85'));}_0x1f5d29=_[_0x573a('0x86')](_[_0x573a('0x38')](_0x1f402c),[_0x573a('0x87'),'updatedAt',_0x573a('0x89'),_0x573a('0x8a')]);if(_0x49ecc6[_0x573a('0x4f')]['id']){delete _0x49ecc6[_0x573a('0x4f')]['id'];}if(_[_0x573a('0x75')](_0x49ecc6[_0x573a('0x4f')][_0x573a('0x8b')])){throw _0x36dfbf[_0x573a('0x20')](0x1f4)[_0x573a('0xbf')](new db['Sequelize'][(_0x573a('0x84'))](_0x573a('0xc0')));}if(_[_0x573a('0x75')](_0x49ecc6['body'][_0x573a('0x4f')])||_0x49ecc6['body'][_0x573a('0x4f')]===''){throw _0x36dfbf['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x573a('0xc1')));}if(_[_0x573a('0x75')](_0x49ecc6['body'][_0x573a('0xc2')])){throw _0x36dfbf['status'](0x1f4)[_0x573a('0xbf')](new db[(_0x573a('0x83'))]['ValidationError'](_0x573a('0xc3')+_0x1f5d29));}if(!_[_0x573a('0x8e')](_0x1f5d29,_0x49ecc6[_0x573a('0x4f')][_0x573a('0xc2')])){throw _0x36dfbf[_0x573a('0x20')](0x1f4)['send'](new db['Sequelize'][(_0x573a('0x84'))](_0x573a('0xc4')+_0x1f5d29));}_0x6eea43[_0x49ecc6[_0x573a('0x4f')][_0x573a('0xc2')]]=_0x49ecc6[_0x573a('0x4f')][_0x573a('0x8b')];})['then'](function(){return db[_0x573a('0x32')]['find']({'where':{'id':_0x49ecc6[_0x573a('0x56')]['id']},'include':[{'model':db[_0x573a('0xc5')],'as':'List'},{'model':db['MailAccount'],'as':_0x573a('0xc6')}]});})[_0x573a('0x14')](handleEntityNotFound(_0x36dfbf,null))[_0x573a('0x14')](function(_0x1dcb95){if(_0x1dcb95&&_0x1dcb95[_0x573a('0x90')]){_0x43bce4=_0x1dcb95;var _0x442945=_[_0x573a('0xc')](_0x49ecc6[_0x573a('0x4f')],{'firstName':_0x49ecc6[_0x573a('0x4f')][_0x573a('0x8b')],'phone':_0x49ecc6[_0x573a('0x4f')]['from'],'ListId':_0x1dcb95['ListId']});_0x442945[_0x49ecc6[_0x573a('0x4f')][_0x573a('0xc2')]]=_0x49ecc6[_0x573a('0x4f')][_0x573a('0x8b')];return db[_0x573a('0x82')][_0x573a('0xc7')]({'where':_0x6eea43,'defaults':_0x442945});}})[_0x573a('0xae')](function(_0x53d8b6){if(_0x53d8b6){_0x2987f4=_0x53d8b6;var _0x314c7c=fs[_0x573a('0xc8')](path[_0x573a('0x71')](config[_0x573a('0x6c')],_0x573a('0xc9')),_0x573a('0xca'));var _0x53f99d=ejs[_0x573a('0xcb')](_0x314c7c,{'body':_['toPairs'](_0x49ecc6[_0x573a('0x4f')][_0x573a('0x4f')]),'bodyTitle':_0x43bce4['offlineMessageBody']});return db[_0x573a('0xcc')]['create']({'body':_0x53f99d,'plainBody':htmlToText[_0x573a('0xcd')](_0x53f99d),'ContactId':_0x53d8b6['id'],'ChatWebsiteId':_0x43bce4['id']});}})[_0x573a('0x14')](function(_0x423579){_0x40f235=_0x423579;if(_0x3550e8[_0x573a('0x3d')]){var _0x1985a1=_0x3550e8[_0x573a('0x31')](function(_0xf9977a){return{'name':_0xf9977a[_0x573a('0xce')],'basename':_0xf9977a[_0x573a('0x66')],'type':_0xf9977a['mimetype'],'ChatOfflineMessageId':_0x423579['id']};});_0x47278d=_0x1985a1['map'](_0x3ab5e2=>{var _0x2e804e={'filename':_0x3ab5e2['name'],'path':path[_0x573a('0x71')](config['root'],_0x573a('0xcf'),_0x573a('0xd0'),_0x573a('0xd1'),_0x573a('0xd2'),_0x3ab5e2[_0x573a('0xd3')])};return _0x2e804e;});if(!_0x43bce4[_0x573a('0xd4')]){return db[_0x573a('0xd5')][_0x573a('0xd6')](function(_0x1934ec){return db['Attachment'][_0x573a('0xd7')](_0x1985a1,{'transaction':_0x1934ec});});}}})['then'](function(){if(_0x40f235){_0x27e6d2=_0x40f235;return db[_0x573a('0xc6')][_0x573a('0x59')]({'where':{'service':!![]},'include':[{'model':db[_0x573a('0xd8')],'as':_0x573a('0xd9'),'raw':!![],'include':[{'model':db[_0x573a('0xda')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x573a('0x14')](function(_0x29a54d){if(_0x29a54d&&_0x29a54d['Smtp']&&_0x43bce4[_0x573a('0xdb')]&&_0x43bce4[_0x573a('0xdc')]){var _0x415d89=_0x29a54d[_0x573a('0xdd')]();return respondWithRpcPromise(_0x573a('0xde'),'sendMail',{'account':_0x415d89,'message':{'from':util[_0x573a('0xa4')]('\x22%s\x22\x20<%s>',_0x29a54d[_0x573a('0x46')],_0x29a54d[_0x573a('0xdf')]||_0x29a54d[_0x573a('0xd9')][_0x573a('0x50')]),'to':_0x43bce4[_0x573a('0xdc')],'subject':_0x43bce4[_0x573a('0xe0')],'html':_0x27e6d2['body'],'attachments':_0x47278d}},client9003)[_0x573a('0x14')](function(){return _0x27e6d2;})[_0x573a('0x1f')](function(_0x5e5ff7){logger['error'](_0x5e5ff7);});}})['then'](function(){if(_0x43bce4&&_0x43bce4['openNewInteraction']&&_0x43bce4[_0x573a('0xe1')]){var _0xee9513=[];if(_0x3550e8[_0x573a('0x3d')]){_0xee9513=_0x3550e8[_0x573a('0x31')](function(_0x3058f2){return{'name':_0x3058f2[_0x573a('0xce')],'basename':_0x3058f2['filename'],'type':_0x3058f2[_0x573a('0xe2')],'ChatOfflineMessageId':_0x40f235['id']};});}var _0x10462a;if(!_['isNil'](_0x43bce4[_0x573a('0xe3')])){var _0x54f93f=_[_0x573a('0x31')](_0x49ecc6['body'],function(_0x3d9585){return _0x3d9585;});var _0x3c0d25=_[_0x573a('0xe4')](_0x54f93f)[0x0];var _0x3e2120=_[_0x573a('0xe5')](_0x3c0d25,function(_0x3ee535){return _0x3ee535;});_0x10462a=_0x3e2120[0x1][_0x43bce4['subjectOffline']];}var _0x19de50={'from':_0x2987f4[_0x573a('0xdf')],'firstName':_0x2987f4[_0x573a('0x9f')],'lastName':_0x2987f4[_0x573a('0xa0')],'mapKey':_0x573a('0xdf'),'message':{'from':_0x2987f4['email'],'to':_0x43bce4[_0x573a('0xc6')][_0x573a('0xdf')],'cc':'','subject':_[_0x573a('0x75')](_0x10462a)?_0x43bce4[_0x573a('0xe0')]:_0x10462a,'messageId':'','sentAt':new Date(),'attach':_0xee9513['length'],'attachments':_0xee9513,'originChannel':'Chat','ChatWebsiteId':_0x43bce4['id'],'ChatOfflineMessageId':_0x27e6d2['id'],'originTo':_0x43bce4[_0x573a('0xc6')][_0x573a('0xdf')]},'body':_0x27e6d2[_0x573a('0x4f')]};var _0x2f4785={'account':{'id':_0x43bce4[_0x573a('0xe1')]},'body':_0x19de50,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x573a('0xe6'),_0x2f4785,client9001)['then'](function(){return _0x27e6d2;})[_0x573a('0x1f')](function(_0x83a310){logger['error'](_0x83a310);});}return;})[_0x573a('0x14')](function(){if(_0x27e6d2){return _0x27e6d2;}})[_0x573a('0x14')](respondWithResult(_0x36dfbf,null))['catch'](function(_0x8481dd){logger[_0x573a('0x19')](_0x573a('0x1f'),_0x8481dd);for(var _0x515698 of _0x3550e8){var _0x59225d=path[_0x573a('0x71')](config['root'],_0x573a('0xcf'),_0x573a('0xd0'),_0x573a('0xd1'),'offline-chat',_0x515698['filename']);fs_extra[_0x573a('0xe7')](_0x59225d)[_0x573a('0x1f')](function(_0x41d754){logger[_0x573a('0x19')](_0x573a('0xe8'),_0x59225d,_0x41d754);});}});};exports[_0x573a('0xe9')]=function(_0x133cec,_0x364316){return db[_0x573a('0xaa')][_0x573a('0x4d')]({'where':{'id':_0x133cec['params']['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x364316,null))[_0x573a('0x14')](function(_0x477b71){if(_0x477b71){return _0x477b71[_0x573a('0xe9')](_0x133cec[_0x573a('0x4f')][_0x573a('0x5e')],_[_0x573a('0xea')](_0x133cec[_0x573a('0x4f')],[_0x573a('0x5e'),'id'])||{});}})[_0x573a('0x14')](respondWithResult(_0x364316,null))[_0x573a('0x1f')](handleError(_0x364316,null));};exports[_0x573a('0xeb')]=function(_0x7c0b4e,_0x2729b6){var _0x1234d5={'raw':![],'where':{}};var _0x3306b6={};var _0x1365f4={'count':0x0,'rows':[]};return db[_0x573a('0x32')][_0x573a('0x59')]({'where':{'id':_0x7c0b4e[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x2729b6,null))[_0x573a('0x14')](function(_0xed084a){if(_0xed084a){_0x3306b6[_0x573a('0x36')]=_['keys'](db[_0x573a('0xaa')][_0x573a('0x4c')]);_0x3306b6[_0x573a('0x37')]=_[_0x573a('0x38')](_0x7c0b4e[_0x573a('0x37')]);_0x3306b6['filters']=_[_0x573a('0x3a')](_0x3306b6[_0x573a('0x36')],_0x3306b6[_0x573a('0x37')]);_0x1234d5[_0x573a('0x3b')]=_[_0x573a('0x3a')](_0x3306b6[_0x573a('0x36')],qs[_0x573a('0x3c')](_0x7c0b4e[_0x573a('0x37')][_0x573a('0x3c')]));_0x1234d5[_0x573a('0x3b')]=_0x1234d5[_0x573a('0x3b')][_0x573a('0x3d')]?_0x1234d5[_0x573a('0x3b')]:_0x3306b6[_0x573a('0x36')];if(!_0x7c0b4e[_0x573a('0x37')]['hasOwnProperty']('nolimit')){_0x1234d5[_0x573a('0x23')]=qs['limit'](_0x7c0b4e['query'][_0x573a('0x23')]);_0x1234d5['offset']=qs['offset'](_0x7c0b4e['query']['offset']);}_0x1234d5[_0x573a('0x40')]=qs[_0x573a('0x41')](_0x7c0b4e[_0x573a('0x37')]['sort']);_0x1234d5[_0x573a('0x42')]=qs[_0x573a('0x39')](_[_0x573a('0x43')](_0x7c0b4e[_0x573a('0x37')],_0x3306b6[_0x573a('0x39')]));_0x1234d5[_0x573a('0x42')]['ChatWebsiteId']=_0xed084a['id'];if(_0x7c0b4e[_0x573a('0x37')][_0x573a('0x44')]){_0x1234d5[_0x573a('0x42')]=_[_0x573a('0x5b')](_0x1234d5[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x1234d5[_0x573a('0x3b')],function(_0x5b534f){var _0x2da6f6={};_0x2da6f6[_0x5b534f]={'$like':'%'+_0x7c0b4e[_0x573a('0x37')][_0x573a('0x44')]+'%'};return _0x2da6f6;})});}_0x1234d5=_['merge']({},_0x1234d5,_0x7c0b4e[_0x573a('0x47')]);return db[_0x573a('0xaa')][_0x573a('0x25')]({'where':_0x1234d5[_0x573a('0x42')]})['then'](function(_0x310a9c){_0x1365f4['count']=_0x310a9c;if(_0x7c0b4e[_0x573a('0x37')][_0x573a('0x48')]){_0x1234d5[_0x573a('0x49')]=[{'model':db[_0x573a('0x82')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x573a('0x46'),_0x573a('0xec'),_0x573a('0xed')],'required':![]},{'model':db[_0x573a('0xee')],'as':'Tags','attributes':['id',_0x573a('0x46'),_0x573a('0xef')],'where':_0x7c0b4e[_0x573a('0x37')][_0x573a('0xf0')]?{'id':_0x7c0b4e[_0x573a('0x37')][_0x573a('0xf0')]}:undefined,'required':_0x7c0b4e[_0x573a('0x37')][_0x573a('0xf0')]?!![]:![]}];}return db[_0x573a('0xaa')][_0x573a('0x4a')](_0x1234d5);})[_0x573a('0x14')](function(_0x597137){_0x1365f4[_0x573a('0x5c')]=_0x597137;return _0x1365f4;});}})[_0x573a('0x14')](respondWithFilteredResult(_0x2729b6,_0x1234d5))[_0x573a('0x1f')](handleError(_0x2729b6,null));};function iftimePromise(_0x1a80c,_0x2d0983){return respondWithRpcPromise(_0x573a('0xf1'),_0x573a('0xf2'),{'command':_0x2d0983[_0x573a('0xf3')]?util[_0x573a('0xa4')](_0x573a('0xf4'),_0x1a80c[_0x573a('0xf5')],_0x2d0983['timezone']):util['format']('iftime\x20%s',_0x1a80c[_0x573a('0xf5')])},client9002)[_0x573a('0x14')](function(_0x452c4d){var _0x2644f6=_0x452c4d&&_0x452c4d[_0x573a('0xf6')](_0x573a('0xf7'))>=0x0?!![]:![];logger[_0x573a('0x15')](_0x573a('0xf8'),_0x2d0983['id'],_0x1a80c['id'],_0x1a80c['interval'],_0x2644f6?_0x573a('0xf9'):_0x573a('0xfa'),_0x2d0983[_0x573a('0xf3')]?_0x2d0983[_0x573a('0xf3')]:'No\x20timezone');return _0x2644f6;})[_0x573a('0x1f')](function(_0x4a3704){logger[_0x573a('0x19')](_0x573a('0xf8'),_0x2d0983['id'],_0x1a80c['id'],_0x1a80c[_0x573a('0xf5')],util[_0x573a('0xfb')](_0x4a3704,{'showHidden':![],'depth':null}),_0x2d0983[_0x573a('0xf3')]?_0x2d0983['timezone']:_0x573a('0xfc'));return![];});}exports['getSnippet']=function(_0x2f3d50,_0x732cca){var _0x139d35=0x0;var _0x52625e=0x0;var _0x775148=![];var _0x1e4aab;var _0x4db8e5;return db[_0x573a('0x32')]['find']({'where':{'id':_0x2f3d50[_0x573a('0x56')]['id']},'include':[{'model':db[_0x573a('0xfd')],'as':'Interval','include':[{'model':db[_0x573a('0xfd')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x573a('0x14')](handleEntityNotFound(_0x732cca,null))[_0x573a('0x14')](function(_0x126fcf){if(_0x126fcf){_0x1e4aab=_0x126fcf;return _0x126fcf[_0x573a('0xfe')]({'raw':!![]});}})[_0x573a('0x14')](function(_0x38dab3){if(_0x1e4aab){if(_0x38dab3){_0x4db8e5=_0x38dab3;}}return require(_0x573a('0x6d'))[_0x573a('0x6e')]();})['then'](function(_0x898616){if(_0x898616){_0x52625e=_0x898616['virtual'];_0x775148=_0x898616['custom'];}})[_0x573a('0x14')](function(){return db[_0x573a('0xaa')][_0x573a('0x25')]({'where':{'closed':![]}});})[_0x573a('0x14')](function(_0x2f2e88){_0x139d35=_0x2f2e88;if(_0x52625e&&_0x2f2e88>_0x52625e){return db[_0x573a('0xff')][_0x573a('0x59')]({'where':{'id':0x1}})[_0x573a('0x14')](function(_0x147b6a){if(_0x147b6a){_0x147b6a[_0x573a('0x100')](_0x573a('0x101'));}});}})[_0x573a('0x14')](function(){if(_0x1e4aab['Interval']&&_0x1e4aab[_0x573a('0xfd')][_0x573a('0x102')]){var _0x4f656f=[];for(var _0x5084bd=0x0;_0x5084bd<_0x1e4aab[_0x573a('0xfd')]['Intervals'][_0x573a('0x3d')];_0x5084bd++){var _0x1dbf5b=_0x1e4aab[_0x573a('0xfd')][_0x573a('0x102')][_0x5084bd][_0x573a('0x29')]({'plain':!![]});_0x4f656f[_0x573a('0x103')](iftimePromise(_0x1dbf5b,_0x1e4aab));}return BPromise[_0x573a('0x104')](_0x4f656f)[_0x573a('0x14')](function(_0x503b19){return _[_0x573a('0x105')](_0x503b19);});}else{return!![];}})[_0x573a('0x14')](function(_0x122358){var _0x3dfc1d=fs[_0x573a('0xc8')](path[_0x573a('0x71')](config['root'],_0x573a('0x106')),_0x573a('0xca'));var _0x3ae366=new url[(_0x573a('0x107'))](_0x1e4aab['address'])[_0x573a('0x108')];var _0x3a4315=_0x573a('0x109');var _0x56694e=![];var _0x3dfd19={'chatVersion':_0x3a4315,'chatWebsiteAddressOrigin':_0x3ae366,'remote':_0x1e4aab[_0x573a('0x10a')],'query':querystring['stringify'](_[_0x573a('0x5b')](_0x1e4aab[_0x573a('0x29')]({'plain':!![]}),{'customerIp':_0x2f3d50[_0x573a('0x7e')][_0x573a('0x9d')]||_0x2f3d50[_0x573a('0x7e')][_0x573a('0x10b')]||_0x2f3d50[_0x573a('0x10c')][_0x573a('0x10d')]||_0x2f3d50['ip'],'referer':_0x2f3d50['headers'][_0x573a('0x10e')],'openedInteractions':_0x139d35,'maxInteractions':_0x52625e,'virtual':_0x775148[_0x573a('0x10f')],'online':_0x122358,'custom':_0x775148}))['replace'](/'/g,'\x5c\x27')};_0x732cca['send'](ejs[_0x573a('0xcb')](Mustache[_0x573a('0xcb')](_0x3dfc1d,_0x3dfd19),{'proactiveActions':_0x4db8e5,'alignment':_0x1e4aab['alignment'],'verticalAlignment':_0x1e4aab['verticalAlignment'],'div_color':_0x1e4aab[_0x573a('0xef')],'labelText':_0x1e4aab[_0x573a('0x110')],'text_color':_0x1e4aab[_0x573a('0x111')],'text_button_color':_0x1e4aab[_0x573a('0x112')],'button_color':_0x1e4aab[_0x573a('0x113')],'background_color':_0x1e4aab['backgroundColor'],'hideWhenOffline':_0x1e4aab[_0x573a('0x114')],'intervalId':_0x1e4aab[_0x573a('0x115')],'isDevelopment':_0x56694e,'chatVersion':_0x3a4315}));})[_0x573a('0x1f')](handleError(_0x732cca,null));};exports[_0x573a('0x116')]=function(_0x53ab51,_0x3bbd1e){var _0x2c7556=_0x53ab51['params']['id'];var _0x17d9da=_0x53ab51['body'];var _0x27cae1=0xc8;var _0x4c0fc4=null;return db[_0x573a('0xd5')]['transaction']({'isolationLevel':db[_0x573a('0xd5')]['Transaction'][_0x573a('0x117')]['READ_COMMITTED']},function(_0x35e5c9){return db[_0x573a('0x32')][_0x573a('0x59')]({'where':{'id':_0x2c7556},'transaction':_0x35e5c9})[_0x573a('0x14')](function(_0xd7f873){if(_0xd7f873){return db[_0x573a('0x92')]['destroy']({'where':{'ChatWebsiteId':_0x2c7556},'transaction':_0x35e5c9})[_0x573a('0x14')](function(){var _0x294fe6=_[_0x573a('0x31')](_0x17d9da,function(_0x571825){_0x571825[_0x573a('0x58')]=_0x2c7556;return _0x571825;});return db[_0x573a('0x92')][_0x573a('0xd7')](_0x294fe6,{'transaction':_0x35e5c9});});}else{_0x27cae1=0x194;_0x4c0fc4=[];}});})[_0x573a('0x14')](function(){if(_0x27cae1!==0x194){return db[_0x573a('0x92')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2c7556},'order':'priority'})[_0x573a('0x14')](function(_0x5f3998){_0x4c0fc4=_0x5f3998;});}})['catch'](function(_0x5de823){_0x27cae1=0x1f4;logger[_0x573a('0x19')](_0x5de823[_0x573a('0x2d')]);if(_0x5de823['name']){delete _0x5de823[_0x573a('0x46')];}_0x4c0fc4=_0x5de823;})[_0x573a('0x118')](function(){if(_0x4c0fc4===null){_0x3bbd1e['sendStatus'](_0x27cae1);}else{if(_0x27cae1===0x1f4){_0x3bbd1e[_0x573a('0x20')](_0x27cae1)[_0x573a('0xbf')](_0x4c0fc4);}else{_0x3bbd1e[_0x573a('0x20')](_0x27cae1)[_0x573a('0x22')](_0x4c0fc4);}}});};exports['getApplications']=function(_0x109a1e,_0x4f5858){var _0x930ada={};var _0x4f865={};var _0x87f773;var _0x53bad2;return db['ChatWebsite'][_0x573a('0x59')]({'where':{'id':_0x109a1e[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x4f5858,null))[_0x573a('0x14')](function(_0x41d110){if(_0x41d110){_0x87f773=_0x41d110;_0x4f865[_0x573a('0x36')]=_[_0x573a('0x38')](db[_0x573a('0x92')][_0x573a('0x4c')]);_0x4f865[_0x573a('0x37')]=_[_0x573a('0x38')](_0x109a1e[_0x573a('0x37')]);_0x4f865['filters']=_[_0x573a('0x3a')](_0x4f865['model'],_0x4f865[_0x573a('0x37')]);_0x930ada[_0x573a('0x3b')]=_['intersection'](_0x4f865[_0x573a('0x36')],qs[_0x573a('0x3c')](_0x109a1e[_0x573a('0x37')][_0x573a('0x3c')]));_0x930ada[_0x573a('0x3b')]=_0x930ada[_0x573a('0x3b')]['length']?_0x930ada['attributes']:_0x4f865['model'];_0x930ada['order']=qs[_0x573a('0x41')](_0x109a1e[_0x573a('0x37')][_0x573a('0x41')]);_0x930ada[_0x573a('0x42')]=qs[_0x573a('0x39')](_['pick'](_0x109a1e[_0x573a('0x37')],_0x4f865[_0x573a('0x39')]));if(_0x109a1e['query'][_0x573a('0x44')]){_0x930ada[_0x573a('0x42')]=_[_0x573a('0x5b')](_0x930ada[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x930ada['attributes'],function(_0x14460f){var _0x3927cf={};_0x3927cf[_0x14460f]={'$like':'%'+_0x109a1e[_0x573a('0x37')][_0x573a('0x44')]+'%'};return _0x3927cf;})});}_0x930ada=_[_0x573a('0x5b')]({},_0x930ada,_0x109a1e[_0x573a('0x47')]);return _0x87f773[_0x573a('0x119')](_0x930ada);}})[_0x573a('0x14')](function(_0x2b5182){if(_0x2b5182){_0x53bad2=_0x2b5182[_0x573a('0x3d')];if(!_0x109a1e[_0x573a('0x37')][_0x573a('0x3e')]('nolimit')){_0x930ada[_0x573a('0x23')]=qs['limit'](_0x109a1e[_0x573a('0x37')][_0x573a('0x23')]);_0x930ada[_0x573a('0x24')]=qs[_0x573a('0x24')](_0x109a1e[_0x573a('0x37')][_0x573a('0x24')]);}return _0x87f773[_0x573a('0x119')](_0x930ada);}})[_0x573a('0x14')](function(_0x36487a){if(_0x36487a){return _0x36487a?{'count':_0x53bad2,'rows':_0x36487a}:null;}})[_0x573a('0x14')](respondWithResult(_0x4f5858,null))[_0x573a('0x1f')](handleError(_0x4f5858,null));};exports[_0x573a('0x11a')]=function(_0x71c3b5,_0x5858e3){return db['chatProactiveAction'][_0x573a('0x4d')]({'where':{'id':_0x71c3b5[_0x573a('0x56')]['id']}})['then'](handleEntityNotFound(_0x5858e3,null))[_0x573a('0x14')](function(_0x287a6c){if(_0x287a6c){return _0x287a6c[_0x573a('0x11a')](_0x71c3b5['body'][_0x573a('0x5e')],_[_0x573a('0xea')](_0x71c3b5[_0x573a('0x4f')],[_0x573a('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x5858e3,null))[_0x573a('0x1f')](handleError(_0x5858e3,null));};exports[_0x573a('0xfe')]=function(_0x5d2572,_0xf6aac5){var _0x5b5b57={};var _0x31a0c0={};var _0x4a54f4;var _0x2e5008;return db[_0x573a('0x32')]['findOne']({'where':{'id':_0x5d2572['params']['id']}})[_0x573a('0x14')](handleEntityNotFound(_0xf6aac5,null))[_0x573a('0x14')](function(_0x2d4339){if(_0x2d4339){_0x4a54f4=_0x2d4339;_0x31a0c0[_0x573a('0x36')]=_[_0x573a('0x38')](db['ChatProactiveAction'][_0x573a('0x4c')]);_0x31a0c0['query']=_[_0x573a('0x38')](_0x5d2572['query']);_0x31a0c0['filters']=_[_0x573a('0x3a')](_0x31a0c0[_0x573a('0x36')],_0x31a0c0[_0x573a('0x37')]);_0x5b5b57[_0x573a('0x3b')]=_[_0x573a('0x3a')](_0x31a0c0['model'],qs['fields'](_0x5d2572[_0x573a('0x37')][_0x573a('0x3c')]));_0x5b5b57['attributes']=_0x5b5b57[_0x573a('0x3b')][_0x573a('0x3d')]?_0x5b5b57[_0x573a('0x3b')]:_0x31a0c0[_0x573a('0x36')];_0x5b5b57[_0x573a('0x40')]=qs[_0x573a('0x41')](_0x5d2572[_0x573a('0x37')]['sort']);_0x5b5b57['where']=qs[_0x573a('0x39')](_['pick'](_0x5d2572[_0x573a('0x37')],_0x31a0c0[_0x573a('0x39')]));if(_0x5d2572[_0x573a('0x37')]['filter']){_0x5b5b57[_0x573a('0x42')]=_[_0x573a('0x5b')](_0x5b5b57[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x5b5b57[_0x573a('0x3b')],function(_0x3ec971){var _0x35abb7={};_0x35abb7[_0x3ec971]={'$like':'%'+_0x5d2572[_0x573a('0x37')][_0x573a('0x44')]+'%'};return _0x35abb7;})});}_0x5b5b57=_[_0x573a('0x5b')]({},_0x5b5b57,_0x5d2572[_0x573a('0x47')]);return _0x4a54f4[_0x573a('0xfe')](_0x5b5b57);}})['then'](function(_0x576201){if(_0x576201){_0x2e5008=_0x576201[_0x573a('0x3d')];if(!_0x5d2572[_0x573a('0x37')][_0x573a('0x3e')]('nolimit')){_0x5b5b57[_0x573a('0x23')]=qs['limit'](_0x5d2572['query']['limit']);_0x5b5b57[_0x573a('0x24')]=qs[_0x573a('0x24')](_0x5d2572[_0x573a('0x37')]['offset']);}return _0x4a54f4[_0x573a('0xfe')](_0x5b5b57);}})[_0x573a('0x14')](function(_0x3c0550){if(_0x3c0550){return _0x3c0550?{'count':_0x2e5008,'rows':_0x3c0550}:null;}})[_0x573a('0x14')](respondWithResult(_0xf6aac5,null))[_0x573a('0x1f')](handleError(_0xf6aac5,null));};exports[_0x573a('0x11b')]=function(_0x4f6399,_0x5d6c4b){var _0x4ae38f=_0x4f6399[_0x573a('0x37')][_0x573a('0x11c')]===_0x573a('0x11d')?_0x573a('0x11e'):_0x573a('0x11f');return db[_0x573a('0x32')][_0x573a('0x4d')]({'attributes':['id',_0x4ae38f],'where':{'id':_0x4f6399[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x5d6c4b,null))['then'](function(_0x21d691){if(_0x21d691){var _0x57529f=_0x21d691[_0x4ae38f];var _0x32c507=_0x57529f&&_0x57529f[_0x573a('0x120')]?_0x57529f['items']:[];_0x5d6c4b[_0x573a('0xbf')]({'fromKey':_[_0x573a('0x75')](_0x57529f['fromKey'])?undefined:_0x57529f[_0x573a('0x121')],'count':_0x32c507['length'],'rows':_0x32c507});}})['catch'](handleError(_0x5d6c4b,null));};exports['getOfflineMessages']=function(_0x10444a,_0x197a12){var _0x87b3f6={'raw':![],'where':{}};var _0x55116e={};var _0x37687f={'count':0x0,'rows':[]};return db[_0x573a('0x32')][_0x573a('0x59')]({'where':{'id':_0x10444a[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x197a12,null))[_0x573a('0x14')](function(_0x53f6b7){if(_0x53f6b7){_0x55116e[_0x573a('0x36')]=_[_0x573a('0x38')](db['ChatOfflineMessage']['rawAttributes']);_0x55116e['query']=_[_0x573a('0x38')](_0x10444a[_0x573a('0x37')]);_0x55116e[_0x573a('0x39')]=_['intersection'](_0x55116e[_0x573a('0x36')],_0x55116e[_0x573a('0x37')]);_0x87b3f6['attributes']=_[_0x573a('0x3a')](_0x55116e[_0x573a('0x36')],qs[_0x573a('0x3c')](_0x10444a[_0x573a('0x37')][_0x573a('0x3c')]));_0x87b3f6[_0x573a('0x3b')]=_0x87b3f6[_0x573a('0x3b')][_0x573a('0x3d')]?_0x87b3f6[_0x573a('0x3b')]:_0x55116e[_0x573a('0x36')];if(!_0x10444a['query'][_0x573a('0x3e')](_0x573a('0x3f'))){_0x87b3f6[_0x573a('0x23')]=qs[_0x573a('0x23')](_0x10444a[_0x573a('0x37')][_0x573a('0x23')]);_0x87b3f6['offset']=qs['offset'](_0x10444a[_0x573a('0x37')][_0x573a('0x24')]);}_0x87b3f6['order']=qs[_0x573a('0x41')](_0x10444a[_0x573a('0x37')]['sort']);_0x87b3f6[_0x573a('0x42')]=qs[_0x573a('0x39')](_['pick'](_0x10444a[_0x573a('0x37')],_0x55116e[_0x573a('0x39')]));_0x87b3f6['where'][_0x573a('0x58')]=_0x53f6b7['id'];if(_0x10444a[_0x573a('0x37')][_0x573a('0x44')]){_0x87b3f6[_0x573a('0x42')]=_[_0x573a('0x5b')](_0x87b3f6[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x87b3f6[_0x573a('0x3b')],function(_0x36022f){var _0x2aa85c={};_0x2aa85c[_0x36022f]={'$like':'%'+_0x10444a[_0x573a('0x37')][_0x573a('0x44')]+'%'};return _0x2aa85c;})});}_0x87b3f6=_[_0x573a('0x5b')]({},_0x87b3f6,_0x10444a['options']);return db[_0x573a('0xcc')][_0x573a('0x25')]({'where':_0x87b3f6[_0x573a('0x42')]})[_0x573a('0x14')](function(_0x4cb686){_0x37687f[_0x573a('0x25')]=_0x4cb686;if(_0x10444a[_0x573a('0x37')]['includeAll']){_0x87b3f6[_0x573a('0x49')]=[{'all':!![]}];}else{_0x87b3f6[_0x573a('0x49')]=[{'model':db[_0x573a('0x82')],'as':_0x573a('0x122'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x573a('0x4a')](_0x87b3f6);})[_0x573a('0x14')](function(_0x4c589d){_0x37687f[_0x573a('0x5c')]=_0x4c589d;return _0x37687f;});}})[_0x573a('0x14')](respondWithFilteredResult(_0x197a12,_0x87b3f6))[_0x573a('0x1f')](handleError(_0x197a12,null));};exports[_0x573a('0x123')]=function(_0x2e91f4,_0x35e259){return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x2e91f4[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x35e259,null))[_0x573a('0x14')](function(_0x385d9a){if(_0x385d9a){return _0x385d9a[_0x573a('0x123')](_0x2e91f4['body'][_0x573a('0x5e')],_[_0x573a('0xea')](_0x2e91f4[_0x573a('0x4f')],[_0x573a('0x5e'),'id'])||{})[_0x573a('0xae')](function(_0x5f1a8d){for(var _0x4b0e7d=0x0;_0x4b0e7d<_0x2e91f4[_0x573a('0x4f')]['ids'][_0x573a('0x3d')];_0x4b0e7d+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x2e91f4[_0x573a('0x4f')]['ids'][_0x4b0e7d]),'ChatWebsiteId':Number(_0x2e91f4['params']['id'])});}return _0x5f1a8d;});}})[_0x573a('0x14')](respondWithResult(_0x35e259,null))[_0x573a('0x1f')](handleError(_0x35e259,null));};exports[_0x573a('0x124')]=function(_0x3eb2ef,_0x176d5c){return db[_0x573a('0x32')][_0x573a('0x4d')]({'where':{'id':_0x3eb2ef[_0x573a('0x56')]['id']}})[_0x573a('0x14')](handleEntityNotFound(_0x176d5c,null))[_0x573a('0x14')](function(_0x1eb121){if(_0x1eb121){return _0x1eb121[_0x573a('0x124')](_0x3eb2ef[_0x573a('0x37')][_0x573a('0x5e')])[_0x573a('0x14')](function(){if(_['isArray'](_0x3eb2ef[_0x573a('0x37')][_0x573a('0x5e')])){for(var _0x5f45a6=0x0;_0x5f45a6<_0x3eb2ef[_0x573a('0x37')][_0x573a('0x5e')][_0x573a('0x3d')];_0x5f45a6+=0x1){socket[_0x573a('0x125')]('userChatWebsite:remove',{'UserId':Number(_0x3eb2ef[_0x573a('0x37')][_0x573a('0x5e')][_0x5f45a6]),'ChatWebsiteId':Number(_0x3eb2ef[_0x573a('0x56')]['id'])});}}else{socket[_0x573a('0x125')](_0x573a('0x126'),{'UserId':Number(_0x3eb2ef['query'][_0x573a('0x5e')]),'ChatWebsiteId':Number(_0x3eb2ef[_0x573a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x176d5c,null))[_0x573a('0x1f')](handleError(_0x176d5c,null));};exports[_0x573a('0x127')]=function(_0x4df7ff,_0x20bcf9){var _0x586a11={};var _0x45c991={};var _0x674a6f;var _0x4fd392;return db[_0x573a('0x32')][_0x573a('0x59')]({'where':{'id':_0x4df7ff[_0x573a('0x56')]['id']}})['then'](handleEntityNotFound(_0x20bcf9,null))[_0x573a('0x14')](function(_0x4d4bcf){if(_0x4d4bcf){_0x674a6f=_0x4d4bcf;_0x45c991[_0x573a('0x36')]=_[_0x573a('0x38')](db[_0x573a('0xb7')]['rawAttributes']);_0x45c991[_0x573a('0x37')]=_['keys'](_0x4df7ff[_0x573a('0x37')]);_0x45c991['filters']=_['intersection'](_0x45c991['model'],_0x45c991[_0x573a('0x37')]);_0x586a11[_0x573a('0x3b')]=_[_0x573a('0x3a')](_0x45c991[_0x573a('0x36')],qs[_0x573a('0x3c')](_0x4df7ff[_0x573a('0x37')][_0x573a('0x3c')]));_0x586a11[_0x573a('0x3b')]=_0x586a11[_0x573a('0x3b')]['length']?_0x586a11['attributes']:_0x45c991[_0x573a('0x36')];_0x586a11[_0x573a('0x40')]=qs[_0x573a('0x41')](_0x4df7ff['query'][_0x573a('0x41')]);_0x586a11['where']=qs[_0x573a('0x39')](_[_0x573a('0x43')](_0x4df7ff[_0x573a('0x37')],_0x45c991[_0x573a('0x39')]));if(_0x4df7ff[_0x573a('0x37')][_0x573a('0x44')]){_0x586a11['where']=_['merge'](_0x586a11[_0x573a('0x42')],{'$or':_[_0x573a('0x31')](_0x586a11[_0x573a('0x3b')],function(_0x5d0e17){var _0x4ab275={};_0x4ab275[_0x5d0e17]={'$like':'%'+_0x4df7ff['query'][_0x573a('0x44')]+'%'};return _0x4ab275;})});}_0x586a11=_[_0x573a('0x5b')]({},_0x586a11,_0x4df7ff[_0x573a('0x47')]);return _0x674a6f[_0x573a('0x127')](_0x586a11);}})[_0x573a('0x14')](function(_0x10fec6){if(_0x10fec6){_0x4fd392=_0x10fec6[_0x573a('0x3d')];if(!_0x4df7ff[_0x573a('0x37')][_0x573a('0x3e')](_0x573a('0x3f'))){_0x586a11[_0x573a('0x23')]=qs[_0x573a('0x23')](_0x4df7ff[_0x573a('0x37')]['limit']);_0x586a11[_0x573a('0x24')]=qs[_0x573a('0x24')](_0x4df7ff[_0x573a('0x37')][_0x573a('0x24')]);}return _0x674a6f[_0x573a('0x127')](_0x586a11);}})['then'](function(_0x397b0c){if(_0x397b0c){return _0x397b0c?{'count':_0x4fd392,'rows':_0x397b0c}:null;}})[_0x573a('0x14')](respondWithResult(_0x20bcf9,null))[_0x573a('0x1f')](handleError(_0x20bcf9,null));};
\ No newline at end of file
+var _0xa566=['addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','online','false','offlineForm','onlineForm','items','getOfflineMessages','Attachment','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatWebsite.socket','html-to-text','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','merge','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','server','offline-chat','openNewInteraction','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','findOne','Contact','internal','Tags','color','tag','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','getLicense','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','URL','address','3.1.0','remote','connection','virtual','replace','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor'];(function(_0x20c0ec,_0x5d2ed9){var _0x8f2063=function(_0x1cf74d){while(--_0x1cf74d){_0x20c0ec['push'](_0x20c0ec['shift']());}};_0x8f2063(++_0x5d2ed9);}(_0xa566,0x143));var _0x6a56=function(_0x220ed1,_0x2db6bc){_0x220ed1=_0x220ed1-0x0;var _0x158652=_0xa566[_0x220ed1];return _0x158652;};'use strict';var BPromise=require(_0x6a56('0x0'));var Mustache=require('mustache');var util=require(_0x6a56('0x1'));var path=require(_0x6a56('0x2'));var ejs=require(_0x6a56('0x3'));var fs=require('fs');var fs_extra=require(_0x6a56('0x4'));var _=require(_0x6a56('0x5'));var querystring=require(_0x6a56('0x6'));var Redis=require('ioredis');var qs=require(_0x6a56('0x7'));var logger=require(_0x6a56('0x8'))(_0x6a56('0x9'));var config=require(_0x6a56('0xa'));var url=require('url');var db=require(_0x6a56('0xb'))['db'];config['redis']=_['defaults'](config[_0x6a56('0xc')],{'host':_0x6a56('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a56('0xc')]));require(_0x6a56('0xe'))['register'](socket);var htmlToText=require(_0x6a56('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x6a56('0x10')][_0x6a56('0x11')]({'port':0x232c});var client9002=jayson[_0x6a56('0x10')][_0x6a56('0x11')]({'port':0x232a});var client9003=jayson[_0x6a56('0x10')]['http']({'port':0x232b});var client9001=jayson[_0x6a56('0x10')][_0x6a56('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x16c8b4,_0x379b75,_0x514945,_0x21cd4b){return new BPromise(function(_0x4b8332,_0x19a801){var _0x42f408=_0x21cd4b||client;return _0x42f408[_0x6a56('0x12')](_0x16c8b4,_0x514945)[_0x6a56('0x13')](function(_0x1ee6ea){logger['info'](_0x6a56('0x14'),_0x379b75,_0x6a56('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x379b75,_0x6a56('0x15'),JSON[_0x6a56('0x16')](_0x1ee6ea));if(_0x1ee6ea[_0x6a56('0x17')]){if(_0x1ee6ea[_0x6a56('0x17')][_0x6a56('0x18')]===0x1f4){logger['error'](_0x6a56('0x14'),_0x379b75,_0x1ee6ea['error'][_0x6a56('0x19')]);return _0x19a801(_0x1ee6ea[_0x6a56('0x17')][_0x6a56('0x19')]);}logger[_0x6a56('0x17')](_0x6a56('0x14'),_0x379b75,_0x1ee6ea[_0x6a56('0x17')][_0x6a56('0x19')]);return _0x4b8332(_0x1ee6ea[_0x6a56('0x17')][_0x6a56('0x19')]);}else{logger[_0x6a56('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x379b75,_0x6a56('0x15'));_0x4b8332(_0x1ee6ea[_0x6a56('0x1b')][_0x6a56('0x19')]);}})[_0x6a56('0x1c')](function(_0x3b2e11){logger[_0x6a56('0x17')](_0x6a56('0x14'),_0x379b75,_0x3b2e11);_0x19a801(_0x3b2e11);});});}function respondWithStatusCode(_0x5b8385,_0x49200c){_0x49200c=_0x49200c||0xcc;return function(_0x40c5df){if(_0x40c5df){return _0x5b8385[_0x6a56('0x1d')](_0x49200c);}return _0x5b8385[_0x6a56('0x1e')](_0x49200c)[_0x6a56('0x1f')]();};}function respondWithResult(_0x28da22,_0x337732){_0x337732=_0x337732||0xc8;return function(_0x50e1dc){if(_0x50e1dc){return _0x28da22['status'](_0x337732)[_0x6a56('0x20')](_0x50e1dc);}};}function respondWithFilteredResult(_0x20acaa,_0x51697a){return function(_0x10d4e5){if(_0x10d4e5){var _0x3e06e4=typeof _0x51697a['offset']==='undefined'&&typeof _0x51697a[_0x6a56('0x21')]===_0x6a56('0x22');var _0x1deb3d=_0x10d4e5['count'];var _0x569014=_0x3e06e4?0x0:_0x51697a[_0x6a56('0x23')];var _0x11cf12=_0x3e06e4?_0x10d4e5['count']:_0x51697a[_0x6a56('0x23')]+_0x51697a[_0x6a56('0x21')];var _0x4f0aa2;if(_0x11cf12>=_0x1deb3d){_0x11cf12=_0x1deb3d;_0x4f0aa2=0xc8;}else{_0x4f0aa2=0xce;}_0x20acaa[_0x6a56('0x1e')](_0x4f0aa2);return _0x20acaa[_0x6a56('0x24')](_0x6a56('0x25'),_0x569014+'-'+_0x11cf12+'/'+_0x1deb3d)[_0x6a56('0x20')](_0x10d4e5);}return null;};}function saveUpdates(_0x12c437){return function(_0x3872b2){if(_0x3872b2){return _0x3872b2[_0x6a56('0x26')](_0x12c437)[_0x6a56('0x13')](function(_0x11c391){return _0x11c391;});}return null;};}function removeEntity(_0x47f8ae){return function(_0x584ffd){if(_0x584ffd){return _0x584ffd[_0x6a56('0x27')]()[_0x6a56('0x13')](function(){var _0x43d319=_0x584ffd[_0x6a56('0x28')]({'plain':!![]});var _0x3b9690=_0x6a56('0x29');return db[_0x6a56('0x2a')]['destroy']({'where':{'type':_0x3b9690,'resourceId':_0x43d319['id']}})[_0x6a56('0x13')](function(){return _0x584ffd;});})[_0x6a56('0x13')](function(){_0x47f8ae[_0x6a56('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c47f4){return function(_0x3b7b5e){if(!_0x3b7b5e){_0x2c47f4['sendStatus'](0x194);}return _0x3b7b5e;};}function handleError(_0x360b79,_0x5030a9){_0x5030a9=_0x5030a9||0x1f4;return function(_0x2b0375){logger[_0x6a56('0x17')](_0x2b0375[_0x6a56('0x2b')]);if(_0x2b0375[_0x6a56('0x2c')]){delete _0x2b0375['name'];}_0x360b79[_0x6a56('0x1e')](_0x5030a9)[_0x6a56('0x2d')](_0x2b0375);};}exports[_0x6a56('0x2e')]=function(_0x3b4db1,_0x50524c){var _0x305991={'include':[{'model':db[_0x6a56('0x2f')],'as':_0x6a56('0x30')}]},_0x3be1af={},_0x3f882b={'count':0x0,'rows':[]};var _0xc65e6b=_[_0x6a56('0x31')](db[_0x6a56('0x32')][_0x6a56('0x33')],function(_0x244fc4){return{'name':_0x244fc4[_0x6a56('0x34')],'type':_0x244fc4[_0x6a56('0x35')][_0x6a56('0x36')]};});_0x3be1af[_0x6a56('0x37')]=_[_0x6a56('0x31')](_0xc65e6b,_0x6a56('0x2c'));_0x3be1af['query']=_[_0x6a56('0x38')](_0x3b4db1['query']);_0x3be1af[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x3be1af[_0x6a56('0x37')],_0x3be1af[_0x6a56('0x3b')]);_0x305991['attributes']=_['intersection'](_0x3be1af[_0x6a56('0x37')],qs['fields'](_0x3b4db1[_0x6a56('0x3b')][_0x6a56('0x3c')]));_0x305991['attributes']=_0x305991[_0x6a56('0x3d')]['length']?_0x305991[_0x6a56('0x3d')]:_0x3be1af[_0x6a56('0x37')];if(!_0x3b4db1[_0x6a56('0x3b')][_0x6a56('0x3e')](_0x6a56('0x3f'))){_0x305991[_0x6a56('0x21')]=qs[_0x6a56('0x21')](_0x3b4db1[_0x6a56('0x3b')][_0x6a56('0x21')]);_0x305991[_0x6a56('0x23')]=qs['offset'](_0x3b4db1['query']['offset']);}_0x305991[_0x6a56('0x40')]=qs[_0x6a56('0x41')](_0x3b4db1[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x305991['where']=qs[_0x6a56('0x39')](_[_0x6a56('0x42')](_0x3b4db1['query'],_0x3be1af['filters']),_0xc65e6b);if(_0x3b4db1['query'][_0x6a56('0x43')]){_0x305991[_0x6a56('0x44')]=_['merge'](_0x305991[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0xc65e6b,function(_0x3b0ad5){if(_0x3b0ad5[_0x6a56('0x35')]!==_0x6a56('0x45')){var _0x5c6712={};_0x5c6712[_0x3b0ad5[_0x6a56('0x2c')]]={'$like':'%'+_0x3b4db1[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x5c6712;}})});}_0x305991=_['merge']({},_0x305991,_0x3b4db1[_0x6a56('0x46')]);var _0x42f1c9={'where':_0x305991[_0x6a56('0x44')]};return db[_0x6a56('0x32')]['count'](_0x42f1c9)[_0x6a56('0x13')](function(_0x14826f){_0x3f882b[_0x6a56('0x47')]=_0x14826f;if(_0x3b4db1[_0x6a56('0x3b')][_0x6a56('0x48')]){_0x305991[_0x6a56('0x49')]=[{'all':!![]}];}return db[_0x6a56('0x32')][_0x6a56('0x4a')](_0x305991);})[_0x6a56('0x13')](function(_0x2008fe){_0x3f882b[_0x6a56('0x4b')]=_0x2008fe;return _0x3f882b;})['then'](respondWithFilteredResult(_0x50524c,_0x305991))[_0x6a56('0x1c')](handleError(_0x50524c,null));};exports[_0x6a56('0x4c')]=function(_0x173e26,_0x4f0437){var _0x3fdebd={'raw':![],'where':{'id':_0x173e26[_0x6a56('0x4d')]['id']},'include':[{'model':db[_0x6a56('0x2f')],'as':_0x6a56('0x30')}]},_0x232111={};_0x232111[_0x6a56('0x37')]=_[_0x6a56('0x38')](db[_0x6a56('0x32')]['rawAttributes']);_0x232111[_0x6a56('0x3b')]=_[_0x6a56('0x38')](_0x173e26[_0x6a56('0x3b')]);_0x232111[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x232111[_0x6a56('0x37')],_0x232111['query']);_0x3fdebd['attributes']=_['intersection'](_0x232111[_0x6a56('0x37')],qs['fields'](_0x173e26[_0x6a56('0x3b')]['fields']));_0x3fdebd[_0x6a56('0x3d')]=_0x3fdebd[_0x6a56('0x3d')][_0x6a56('0x4e')]?_0x3fdebd[_0x6a56('0x3d')]:_0x232111['model'];if(_0x173e26[_0x6a56('0x3b')][_0x6a56('0x48')]){_0x3fdebd[_0x6a56('0x49')]=[{'all':!![]}];}_0x3fdebd=_['merge']({},_0x3fdebd,_0x173e26['options']);return db[_0x6a56('0x32')][_0x6a56('0x4f')](_0x3fdebd)[_0x6a56('0x13')](handleEntityNotFound(_0x4f0437,null))[_0x6a56('0x13')](respondWithResult(_0x4f0437,null))[_0x6a56('0x1c')](handleError(_0x4f0437,null));};exports[_0x6a56('0x50')]=function(_0x2a9c8f,_0x507355){return db[_0x6a56('0x32')][_0x6a56('0x50')](_0x2a9c8f['body'],{})[_0x6a56('0x13')](function(_0x533316){var _0x2ddb72=_0x2a9c8f[_0x6a56('0x51')][_0x6a56('0x28')]({'plain':!![]});if(!_0x2ddb72)throw new Error(_0x6a56('0x52'));if(_0x2ddb72['role']===_0x6a56('0x51')){var _0x248d5f=_0x533316[_0x6a56('0x28')]({'plain':!![]});var _0x5d5985=_0x6a56('0x29');return db[_0x6a56('0x53')][_0x6a56('0x4f')]({'where':{'name':_0x5d5985,'userProfileId':_0x2ddb72[_0x6a56('0x54')]},'raw':!![]})[_0x6a56('0x13')](function(_0x2b65bc){if(_0x2b65bc&&_0x2b65bc[_0x6a56('0x55')]===0x0){return db[_0x6a56('0x2a')][_0x6a56('0x50')]({'name':_0x248d5f[_0x6a56('0x2c')],'resourceId':_0x248d5f['id'],'type':_0x2b65bc[_0x6a56('0x2c')],'sectionId':_0x2b65bc['id']},{})[_0x6a56('0x13')](function(){return _0x533316;});}else{return _0x533316;}})['catch'](function(_0x348349){logger['error'](_0x6a56('0x56'),_0x348349);throw _0x348349;});}return _0x533316;})[_0x6a56('0x13')](respondWithResult(_0x507355,0xc9))['catch'](handleError(_0x507355,null));};exports[_0x6a56('0x26')]=function(_0x566766,_0x506823){if(_0x566766['body']['id']){delete _0x566766[_0x6a56('0x57')]['id'];}return db['ChatWebsite'][_0x6a56('0x4f')]({'where':{'id':_0x566766[_0x6a56('0x4d')]['id']},'include':[{'model':db[_0x6a56('0x2f')],'as':_0x6a56('0x30')}]})['then'](handleEntityNotFound(_0x506823,null))[_0x6a56('0x13')](saveUpdates(_0x566766[_0x6a56('0x57')],null))[_0x6a56('0x13')](respondWithResult(_0x506823,null))[_0x6a56('0x1c')](handleError(_0x506823,null));};exports[_0x6a56('0x27')]=function(_0x38fd12,_0x4e33b9){return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x38fd12[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x4e33b9,null))[_0x6a56('0x13')](removeEntity(_0x4e33b9,null))[_0x6a56('0x1c')](handleError(_0x4e33b9,null));};exports[_0x6a56('0x58')]=function(_0x23b88c,_0x211904){return db[_0x6a56('0x32')][_0x6a56('0x58')]()[_0x6a56('0x13')](respondWithResult(_0x211904,null))[_0x6a56('0x1c')](handleError(_0x211904,null));};exports[_0x6a56('0x59')]=function(_0x4d5e86,_0x561426){if(_0x4d5e86[_0x6a56('0x57')]['id']){delete _0x4d5e86[_0x6a56('0x57')]['id'];}return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x4d5e86[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x561426,null))[_0x6a56('0x13')](function(_0x51c1ca){if(_0x51c1ca){_0x4d5e86[_0x6a56('0x57')][_0x6a56('0x5a')]=_0x51c1ca['id'];return db[_0x6a56('0x5b')]['create'](_0x4d5e86[_0x6a56('0x57')]);}})[_0x6a56('0x13')](respondWithResult(_0x561426,null))[_0x6a56('0x1c')](handleError(_0x561426,null));};exports[_0x6a56('0x5c')]=function(_0x1d02f5,_0x423108){var _0xb8d8cc={'raw':![],'where':{}};var _0x3e051f={};var _0x2d470d={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1d02f5[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x423108,null))[_0x6a56('0x13')](function(_0x4a47af){if(_0x4a47af){_0x3e051f[_0x6a56('0x37')]=_['keys'](db[_0x6a56('0x5b')]['rawAttributes']);_0x3e051f[_0x6a56('0x3b')]=_['keys'](_0x1d02f5[_0x6a56('0x3b')]);_0x3e051f[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x3e051f[_0x6a56('0x37')],_0x3e051f[_0x6a56('0x3b')]);_0xb8d8cc[_0x6a56('0x3d')]=_['intersection'](_0x3e051f[_0x6a56('0x37')],qs[_0x6a56('0x3c')](_0x1d02f5[_0x6a56('0x3b')]['fields']));_0xb8d8cc[_0x6a56('0x3d')]=_0xb8d8cc['attributes'][_0x6a56('0x4e')]?_0xb8d8cc[_0x6a56('0x3d')]:_0x3e051f['model'];if(!_0x1d02f5['query'][_0x6a56('0x3e')](_0x6a56('0x3f'))){_0xb8d8cc[_0x6a56('0x21')]=qs[_0x6a56('0x21')](_0x1d02f5[_0x6a56('0x3b')][_0x6a56('0x21')]);_0xb8d8cc['offset']=qs[_0x6a56('0x23')](_0x1d02f5[_0x6a56('0x3b')][_0x6a56('0x23')]);}_0xb8d8cc[_0x6a56('0x40')]=qs[_0x6a56('0x41')](_0x1d02f5[_0x6a56('0x3b')][_0x6a56('0x41')]);_0xb8d8cc[_0x6a56('0x44')]=qs[_0x6a56('0x39')](_[_0x6a56('0x42')](_0x1d02f5[_0x6a56('0x3b')],_0x3e051f[_0x6a56('0x39')]));_0xb8d8cc[_0x6a56('0x44')][_0x6a56('0x5a')]=_0x4a47af['id'];if(_0x1d02f5['query']['filter']){_0xb8d8cc[_0x6a56('0x44')]=_[_0x6a56('0x5d')](_0xb8d8cc[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0xb8d8cc[_0x6a56('0x3d')],function(_0x475c41){var _0x4d6ed9={};_0x4d6ed9[_0x475c41]={'$like':'%'+_0x1d02f5[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x4d6ed9;})});}_0xb8d8cc=_[_0x6a56('0x5d')]({},_0xb8d8cc,_0x1d02f5[_0x6a56('0x46')]);return db[_0x6a56('0x5b')][_0x6a56('0x47')]({'where':_0xb8d8cc[_0x6a56('0x44')]})[_0x6a56('0x13')](function(_0x509973){_0x2d470d['count']=_0x509973;if(_0x1d02f5['query'][_0x6a56('0x48')]){_0xb8d8cc[_0x6a56('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x6a56('0x4a')](_0xb8d8cc);})[_0x6a56('0x13')](function(_0x35a71c){_0x2d470d[_0x6a56('0x4b')]=_0x35a71c;return _0x2d470d;});}})['then'](respondWithFilteredResult(_0x423108,_0xb8d8cc))[_0x6a56('0x1c')](handleError(_0x423108,null));};exports['removeDispositions']=function(_0x2b409b,_0x507359){return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x2b409b['params']['id']}})['then'](handleEntityNotFound(_0x507359,null))[_0x6a56('0x13')](function(_0x1af720){if(_0x1af720){return _0x1af720['removeDispositions'](_0x2b409b['query'][_0x6a56('0x5e')]);}})[_0x6a56('0x13')](respondWithStatusCode(_0x507359,null))['catch'](handleError(_0x507359,null));};exports[_0x6a56('0x5f')]=function(_0x57d0f5,_0x16ebcf){if(_0x57d0f5[_0x6a56('0x57')]['id']){delete _0x57d0f5[_0x6a56('0x57')]['id'];}return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x57d0f5[_0x6a56('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16ebcf,null))[_0x6a56('0x13')](function(_0x325e8c){if(_0x325e8c){_0x57d0f5[_0x6a56('0x57')]['ChatWebsiteId']=_0x325e8c['id'];return db[_0x6a56('0x60')][_0x6a56('0x50')](_0x57d0f5[_0x6a56('0x57')]);}})[_0x6a56('0x13')](respondWithResult(_0x16ebcf,null))[_0x6a56('0x1c')](handleError(_0x16ebcf,null));};exports['getAnswers']=function(_0x14b10b,_0x17af74){var _0x51709={'raw':![],'where':{}};var _0x48e475={};var _0x51c7ab={'count':0x0,'rows':[]};return db[_0x6a56('0x32')]['findOne']({'where':{'id':_0x14b10b[_0x6a56('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17af74,null))[_0x6a56('0x13')](function(_0x46d90d){if(_0x46d90d){_0x48e475[_0x6a56('0x37')]=_[_0x6a56('0x38')](db[_0x6a56('0x60')][_0x6a56('0x33')]);_0x48e475[_0x6a56('0x3b')]=_[_0x6a56('0x38')](_0x14b10b['query']);_0x48e475[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x48e475[_0x6a56('0x37')],_0x48e475[_0x6a56('0x3b')]);_0x51709['attributes']=_[_0x6a56('0x3a')](_0x48e475[_0x6a56('0x37')],qs[_0x6a56('0x3c')](_0x14b10b[_0x6a56('0x3b')]['fields']));_0x51709[_0x6a56('0x3d')]=_0x51709[_0x6a56('0x3d')][_0x6a56('0x4e')]?_0x51709[_0x6a56('0x3d')]:_0x48e475['model'];if(!_0x14b10b['query'][_0x6a56('0x3e')](_0x6a56('0x3f'))){_0x51709[_0x6a56('0x21')]=qs[_0x6a56('0x21')](_0x14b10b[_0x6a56('0x3b')][_0x6a56('0x21')]);_0x51709[_0x6a56('0x23')]=qs[_0x6a56('0x23')](_0x14b10b[_0x6a56('0x3b')]['offset']);}_0x51709[_0x6a56('0x40')]=qs[_0x6a56('0x41')](_0x14b10b[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x51709[_0x6a56('0x44')]=qs['filters'](_[_0x6a56('0x42')](_0x14b10b[_0x6a56('0x3b')],_0x48e475['filters']));_0x51709[_0x6a56('0x44')][_0x6a56('0x5a')]=_0x46d90d['id'];if(_0x14b10b['query']['filter']){_0x51709['where']=_[_0x6a56('0x5d')](_0x51709[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0x51709[_0x6a56('0x3d')],function(_0x7fba00){var _0x38b63e={};_0x38b63e[_0x7fba00]={'$like':'%'+_0x14b10b[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x38b63e;})});}_0x51709=_[_0x6a56('0x5d')]({},_0x51709,_0x14b10b[_0x6a56('0x46')]);return db[_0x6a56('0x60')][_0x6a56('0x47')]({'where':_0x51709[_0x6a56('0x44')]})[_0x6a56('0x13')](function(_0x53c7d1){_0x51c7ab[_0x6a56('0x47')]=_0x53c7d1;if(_0x14b10b[_0x6a56('0x3b')][_0x6a56('0x48')]){_0x51709['include']=[{'all':!![]}];}return db[_0x6a56('0x60')]['findAll'](_0x51709);})[_0x6a56('0x13')](function(_0x490eac){_0x51c7ab[_0x6a56('0x4b')]=_0x490eac;return _0x51c7ab;});}})[_0x6a56('0x13')](respondWithFilteredResult(_0x17af74,_0x51709))[_0x6a56('0x1c')](handleError(_0x17af74,null));};exports['removeAnswers']=function(_0x5f0df3,_0x3f3547){return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x5f0df3[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x3f3547,null))['then'](function(_0x363d92){if(_0x363d92){return _0x363d92[_0x6a56('0x61')](_0x5f0df3[_0x6a56('0x3b')]['ids']);}})[_0x6a56('0x13')](respondWithStatusCode(_0x3f3547,null))[_0x6a56('0x1c')](handleError(_0x3f3547,null));};exports[_0x6a56('0x62')]=function(_0x1b4626,_0x49d923){_0x1b4626['body'][_0x6a56('0x63')]=_0x1b4626[_0x6a56('0x64')][_0x6a56('0x65')];return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x1b4626[_0x6a56('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49d923,null))['then'](saveUpdates(_0x1b4626[_0x6a56('0x57')],null))[_0x6a56('0x13')](respondWithResult(_0x49d923,null))[_0x6a56('0x1c')](handleError(_0x49d923,null));};exports[_0x6a56('0x66')]=function(_0x258729,_0x1a76ac){_0x258729[_0x6a56('0x57')][_0x6a56('0x67')]=_0x258729[_0x6a56('0x64')]['filename'];return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x258729[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x1a76ac,null))['then'](saveUpdates(_0x258729[_0x6a56('0x57')],null))[_0x6a56('0x13')](respondWithResult(_0x1a76ac,null))[_0x6a56('0x1c')](handleError(_0x1a76ac,null));};exports['addCustomerAvatar']=function(_0x481ad6,_0x2229ae){_0x481ad6[_0x6a56('0x57')][_0x6a56('0x68')]=_0x481ad6[_0x6a56('0x64')]['filename'];return db['ChatWebsite'][_0x6a56('0x4f')]({'where':{'id':_0x481ad6[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x2229ae,null))['then'](saveUpdates(_0x481ad6[_0x6a56('0x57')],null))['then'](respondWithResult(_0x2229ae,null))[_0x6a56('0x1c')](handleError(_0x2229ae,null));};exports[_0x6a56('0x69')]=function(_0xa456b4,_0x205d40){_0xa456b4[_0x6a56('0x57')][_0x6a56('0x6a')]=_0xa456b4[_0x6a56('0x64')]['filename'];return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0xa456b4[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x205d40,null))['then'](saveUpdates(_0xa456b4[_0x6a56('0x57')],null))['then'](respondWithResult(_0x205d40,null))[_0x6a56('0x1c')](handleError(_0x205d40,null));};exports[_0x6a56('0x6b')]=function(_0x24d5c3,_0x4d1a6e){var _0x5d275f=path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0x6e'));var _0x41e9db={'where':{'id':_0x24d5c3[_0x6a56('0x4d')]['id']},'attributes':['id',_0x6a56('0x63')],'raw':!![]};var _0x5cc5e9=![];return require(_0x6a56('0x6f'))['getLicense']()[_0x6a56('0x13')](function(_0x5129b0){if(_0x5129b0){_0x5cc5e9=_0x5129b0[_0x6a56('0x70')];}})[_0x6a56('0x13')](function(){return db[_0x6a56('0x32')]['find'](_0x41e9db);})[_0x6a56('0x13')](handleEntityNotFound(_0x4d1a6e,null))[_0x6a56('0x13')](function(_0x223e8e){if(_0x223e8e){if(!_[_0x6a56('0x71')](_0x223e8e[_0x6a56('0x63')])){if(fs['existsSync'](path['join'](config['root'],_0x6a56('0x72'),_0x223e8e[_0x6a56('0x63')]))&&_0x5cc5e9){_0x5d275f=path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0x72'),_0x223e8e['sitepic']);}}return _0x4d1a6e[_0x6a56('0x73')](_0x5d275f);}})[_0x6a56('0x1c')](handleError(_0x4d1a6e,null));};exports[_0x6a56('0x74')]=function(_0x5c08c8,_0x1f39c2){var _0x19adea=path['join'](config[_0x6a56('0x6d')],'server/files/images/avatars/default_avatar.png');var _0x6c1b8a={'where':{'id':_0x5c08c8[_0x6a56('0x4d')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x6a56('0x32')][_0x6a56('0x4f')](_0x6c1b8a)[_0x6a56('0x13')](handleEntityNotFound(_0x1f39c2,null))[_0x6a56('0x13')](function(_0x54deea){if(_0x54deea){if(!_[_0x6a56('0x71')](_0x54deea[_0x6a56('0x67')])){if(fs[_0x6a56('0x75')](path[_0x6a56('0x6c')](config['root'],_0x6a56('0x76'),_0x54deea[_0x6a56('0x67')]))){_0x19adea=path[_0x6a56('0x6c')](config['root'],_0x6a56('0x76'),_0x54deea[_0x6a56('0x67')]);}}return _0x1f39c2['download'](_0x19adea);}})[_0x6a56('0x1c')](handleError(_0x1f39c2,null));};exports[_0x6a56('0x77')]=function(_0x334a31,_0x53e5a0){var _0x1037dd=path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0x78'));var _0x1375e8={'where':{'id':_0x334a31[_0x6a56('0x4d')]['id']},'attributes':['id',_0x6a56('0x68'),_0x6a56('0x79')],'raw':!![]};return db[_0x6a56('0x32')][_0x6a56('0x4f')](_0x1375e8)['then'](handleEntityNotFound(_0x53e5a0,null))[_0x6a56('0x13')](function(_0x133747){if(_0x133747){if(!_[_0x6a56('0x71')](_0x133747['customerAvatar'])){if(fs[_0x6a56('0x75')](path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0x76'),_0x133747['customerAvatar']))&&_0x133747['showCustomerAvatar']){_0x1037dd=path[_0x6a56('0x6c')](config['root'],_0x6a56('0x76'),_0x133747[_0x6a56('0x68')]);}}return _0x53e5a0[_0x6a56('0x73')](_0x1037dd);}})['catch'](handleError(_0x53e5a0,null));};exports[_0x6a56('0x7a')]=function(_0x3ea869,_0xea0176){var _0x391d73=path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0x7b'));var _0x497133={'where':{'id':_0x3ea869[_0x6a56('0x4d')]['id']},'attributes':['id',_0x6a56('0x6a')],'raw':!![]};return db[_0x6a56('0x32')][_0x6a56('0x4f')](_0x497133)[_0x6a56('0x13')](handleEntityNotFound(_0xea0176,null))[_0x6a56('0x13')](function(_0x4a598f){if(_0x4a598f){if(!_[_0x6a56('0x71')](_0x4a598f[_0x6a56('0x6a')])){if(fs[_0x6a56('0x75')](path[_0x6a56('0x6c')](config['root'],'server/files/images/avatars/',_0x4a598f[_0x6a56('0x6a')]))){_0x391d73=path[_0x6a56('0x6c')](config['root'],'server/files/images/avatars/',_0x4a598f[_0x6a56('0x6a')]);}}return _0xea0176['download'](_0x391d73);}})[_0x6a56('0x1c')](handleError(_0xea0176,null));};exports[_0x6a56('0x7c')]=function(_0x4d45b0,_0x4c2d2a){var _0x3c66c4=require(_0x6a56('0x7d'));var _0x272b9b=new _0x3c66c4();var _0x582fb9=_0x272b9b[_0x6a56('0x7e')](_0x4d45b0[_0x6a56('0x7f')][_0x6a56('0x80')])[_0x6a56('0x81')]();var _0x2f0da5={'body':_0x4d45b0[_0x6a56('0x57')],'channel':_0x6a56('0x82')};var _0x126a07=[];var _0x1dfc71=[];var _0x177ae0={};var _0x5ce25d=![];return db[_0x6a56('0x83')][_0x6a56('0x58')]()[_0x6a56('0x13')](function(_0x48fa5d){if(!_0x48fa5d){throw new db[(_0x6a56('0x84'))]['ValidationError'](_0x6a56('0x85'));}_0x126a07=_[_0x6a56('0x86')](_['keys'](_0x48fa5d),[_0x6a56('0x87'),_0x6a56('0x88')]);_0x1dfc71=_[_0x6a56('0x86')](_['keys'](_0x48fa5d),['createdAt',_0x6a56('0x88'),'CompanyId',_0x6a56('0x89')]);if(_0x4d45b0[_0x6a56('0x57')]['id']){delete _0x4d45b0[_0x6a56('0x57')]['id'];}if(_[_0x6a56('0x71')](_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8a')])){throw new db[(_0x6a56('0x84'))][(_0x6a56('0x8b'))](_0x6a56('0x8c'));}if(_[_0x6a56('0x71')](_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x57')])||_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x57')]===''){throw new db[(_0x6a56('0x84'))][(_0x6a56('0x8b'))](_0x6a56('0x8d'));}if(_['isNil'](_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8e')])){throw new db['Sequelize'][(_0x6a56('0x8b'))](_0x6a56('0x8f')+_0x1dfc71);}if(!_[_0x6a56('0x90')](_0x1dfc71,_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8e')])){throw new db[(_0x6a56('0x84'))]['ValidationError'](_0x6a56('0x91')+_0x1dfc71);}_0x177ae0[_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8e')]]=_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8a')];})[_0x6a56('0x13')](function(){return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x4d45b0[_0x6a56('0x4d')]['id']},'include':[{'model':db[_0x6a56('0x92')],'as':_0x6a56('0x93'),'include':[{'model':db[_0x6a56('0x83')],'as':_0x6a56('0x94'),'where':_0x177ae0,'limit':0x1,'order':[[_0x6a56('0x88'),'DESC']]}]},{'model':db[_0x6a56('0x95')],'as':_0x6a56('0x96')}]});})['then'](handleEntityNotFound(_0x4c2d2a,null))[_0x6a56('0x13')](function(_0x925cd9){if(_0x925cd9&&_0x925cd9['List']){_0x2f0da5['account']=_0x925cd9;_0x2f0da5[_0x6a56('0x97')]=_0x925cd9[_0x6a56('0x96')];_0x2f0da5[_0x6a56('0x98')]=_0x925cd9[_0x6a56('0x93')];_0x2f0da5[_0x6a56('0x97')]=_[_0x6a56('0x99')](_0x2f0da5[_0x6a56('0x97')],[_0x6a56('0x9a')],[_0x6a56('0x9b')]);if(_0x2f0da5[_0x6a56('0x9c')][_0x6a56('0x96')]){delete _0x2f0da5[_0x6a56('0x9c')][_0x6a56('0x96')];}if(_0x2f0da5[_0x6a56('0x9c')][_0x6a56('0x93')]&&_0x2f0da5[_0x6a56('0x9c')]['List']['Contacts']['length']){return _0x2f0da5[_0x6a56('0x9c')][_0x6a56('0x93')][_0x6a56('0x94')][0x0];}var _0xf57998=_[_0x6a56('0x9d')](_0x4d45b0[_0x6a56('0x57')],{'firstName':_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8a')],'ListId':_0x925cd9['ListId']});_0xf57998[_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x8e')]]=_0x4d45b0['body']['from'];return db[_0x6a56('0x83')][_0x6a56('0x50')](_0xf57998,{'fields':_0x126a07,'raw':!![]});}})[_0x6a56('0x13')](handleEntityNotFound(_0x4c2d2a,null))[_0x6a56('0x13')](function(_0x58e452){_0x2f0da5[_0x6a56('0x9e')]=_0x58e452;var _0xefdf95=_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x9f')];if(_0x4d45b0[_0x6a56('0x7f')][_0x6a56('0xa0')]){_0xefdf95=_0x4d45b0[_0x6a56('0x7f')]['cf-connecting-ip'];}else if(_0x4d45b0['headers']['x-forwarded-for']){_0xefdf95=_['first'](_0x4d45b0[_0x6a56('0x7f')][_0x6a56('0xa1')]['split'](','));}if(_0x58e452){var _0x1acc94={'ContactId':_0x58e452['id'],'ChatWebsiteId':_0x4d45b0[_0x6a56('0x4d')]['id'],'from':(_0x58e452[_0x6a56('0xa2')]||'')+'\x20'+(_0x58e452[_0x6a56('0xa3')]||''),'customerIp':_0xefdf95,'customerPort':_0x4d45b0[_0x6a56('0x7f')][_0x6a56('0xa4')]?_0x4d45b0[_0x6a56('0x7f')][_0x6a56('0xa4')]:null,'referer':_0x4d45b0['body'][_0x6a56('0xa5')],'browserName':_0x582fb9['browser'][_0x6a56('0x2c')]&&_0x582fb9[_0x6a56('0xa6')][_0x6a56('0xa7')]?util[_0x6a56('0xa8')](_0x6a56('0xa9'),_0x582fb9[_0x6a56('0xa6')][_0x6a56('0x2c')],_0x582fb9[_0x6a56('0xa6')]['version']):'unknown','browserVersion':_0x582fb9[_0x6a56('0xa6')][_0x6a56('0xa7')]||_0x6a56('0xaa'),'osName':util[_0x6a56('0xa8')]('%s\x20%s',_0x582fb9['os'][_0x6a56('0x2c')],_0x582fb9['os'][_0x6a56('0xa7')]),'osVersion':_0x582fb9['os'][_0x6a56('0xa7')],'deviceModel':_0x582fb9[_0x6a56('0xab')][_0x6a56('0x37')]&&_0x582fb9[_0x6a56('0xab')]['vendor']?util['format'](_0x6a56('0xac'),_0x582fb9[_0x6a56('0xab')]['model'],_0x582fb9[_0x6a56('0xab')][_0x6a56('0xad')],_0x582fb9[_0x6a56('0xab')][_0x6a56('0x35')]):null,'deviceVendor':_0x582fb9['device'][_0x6a56('0xad')],'deviceType':_0x582fb9['device'][_0x6a56('0x35')],'formData':JSON['stringify'](_0x4d45b0['body'])};var _0x462f40={'ChatWebsiteId':_0x4d45b0[_0x6a56('0x4d')]['id'],'closed':![]};if(_0x4d45b0['body'][_0x6a56('0xae')]){_0x462f40[_0x6a56('0xae')]=_0x4d45b0[_0x6a56('0x57')]['threadId'];return db[_0x6a56('0xaf')]['find']({'where':_0x462f40})[_0x6a56('0x13')](function(_0x2698e7){if(_0x2698e7){return[_0x2698e7,![]];}_0x1acc94['threadId']=_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xae')];_0x1acc94['externalUrl']=_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xb0')];return db[_0x6a56('0xaf')][_0x6a56('0x50')](_0x1acc94)['then'](function(_0x14e0cc){return[_0x14e0cc,!![]];});});}_0x462f40[_0x6a56('0xb1')]=_0x58e452['id'];if(_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xb2')]&&_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xb2')]['id']){_0x462f40['id']=_0x4d45b0['body'][_0x6a56('0xb2')]['id'];return db['ChatInteraction'][_0x6a56('0x4f')]({'where':_0x462f40})['then'](function(_0x322578){if(_0x322578){return[_0x322578,![]];}return db[_0x6a56('0xaf')][_0x6a56('0x50')](_0x1acc94)[_0x6a56('0x13')](function(_0x1a3e0a){return[_0x1a3e0a,!![]];});});}return db[_0x6a56('0xaf')][_0x6a56('0x50')](_0x1acc94)[_0x6a56('0x13')](function(_0x44a57d){return[_0x44a57d,!![]];});}})[_0x6a56('0xb3')](function(_0x4f381b,_0x4e98fa){if(_0x4f381b){_0x5ce25d=_0x4e98fa;if(!_0x4e98fa){var _0x4826a3={'from':(_0x2f0da5[_0x6a56('0x9e')]['firstName']||'')+'\x20'+(_0x2f0da5[_0x6a56('0x9e')][_0x6a56('0xa3')]||'')};if(_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xae')]&&_0x4d45b0[_0x6a56('0x57')]['messageId']&&_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xae')]!=_0x4d45b0['body']['messageId']){_0x4826a3[_0x6a56('0xae')]=_0x4d45b0[_0x6a56('0x57')][_0x6a56('0xb4')];}return _0x4f381b['update'](_0x4826a3);}else{return _0x4f381b;}}})['then'](function(_0x5c86ea){_0x2f0da5['interaction']=_0x5c86ea['get']({'plain':!![]});_0x2f0da5[_0x6a56('0xb2')][_0x6a56('0xb5')]=_0x5ce25d;if(_0x2f0da5[_0x6a56('0xb2')][_0x6a56('0xb5')]){if(_0x2f0da5['account'][_0x6a56('0xb6')]){_0x2f0da5[_0x6a56('0x97')][_0x6a56('0xb7')]({'id':0x0,'priority':_0x2f0da5[_0x6a56('0x97')][_0x6a56('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x6a56('0xb8')][_0x6a56('0x50')]({'body':_0x4d45b0[_0x6a56('0x57')][_0x6a56('0x57')],'ChatWebsiteId':_0x4d45b0[_0x6a56('0x4d')]['id'],'ChatInteractionId':_0x5c86ea['id'],'direction':'in','ContactId':_0x2f0da5[_0x6a56('0x9e')]['id'],'AttachmentId':_0x4d45b0['body']['AttachmentId']});})['then'](function(_0x3a406b){_0x2f0da5[_0x6a56('0x19')]=_0x3a406b;if(_0x2f0da5[_0x6a56('0xb2')][_0x6a56('0xb9')]){return db[_0x6a56('0xba')][_0x6a56('0x4f')]({'attributes':['id',_0x6a56('0x2c')],'where':{'id':_0x2f0da5['interaction']['UserId']}})['then'](function(_0x2cfe4c){if(_0x2cfe4c){_0x2f0da5[_0x6a56('0x97')][_0x6a56('0xbb')]({'id':0x0,'priority':0x0,'app':_0x6a56('0xbc'),'appdata':_0x2cfe4c['name']+','+(_0x2f0da5[_0x6a56('0x9c')][_0x6a56('0xbd')]||0xa),'interval':_0x6a56('0xbe')});_0x2f0da5['forcedOwnership']=!![];}return respondWithRpcPromise(_0x6a56('0xbf'),_0x6a56('0xc0'),_0x2f0da5);});}return respondWithRpcPromise(_0x6a56('0xbf'),_0x6a56('0xc0'),_0x2f0da5);})[_0x6a56('0x13')](function(_0x2b6810){respondWithRpcPromise(_0x6a56('0xc1'),'EventManager',{'event':'notify','message':_0x2b6810},client9002);return _0x2b6810;})['then'](respondWithResult(_0x4c2d2a,null))['catch'](handleError(_0x4c2d2a,null));};exports[_0x6a56('0xc2')]=function(_0x9e96f8,_0x1b7743){var _0x4ee3e1,_0x4217ba,_0x2c3773;var _0x44670d=[];var _0x32fd7e={};var _0xce54cc=_0x9e96f8[_0x6a56('0xc3')]||[];var _0x378874=[];var _0xae9fdb;return db[_0x6a56('0x83')]['describe']()[_0x6a56('0x13')](function(_0x25af2d){if(!_0x25af2d){throw new db[(_0x6a56('0x84'))][(_0x6a56('0x8b'))]('no\x20available\x20attributes');}_0x44670d=_[_0x6a56('0x86')](_['keys'](_0x25af2d),[_0x6a56('0x87'),_0x6a56('0x88'),_0x6a56('0xc4'),_0x6a56('0x89')]);if(_0x9e96f8[_0x6a56('0x57')]['id']){delete _0x9e96f8['body']['id'];}if(_[_0x6a56('0x71')](_0x9e96f8[_0x6a56('0x57')][_0x6a56('0x8a')])){throw _0x1b7743[_0x6a56('0x1e')](0x1f4)[_0x6a56('0x2d')](new db[(_0x6a56('0x84'))][(_0x6a56('0x8b'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x9e96f8[_0x6a56('0x57')]['body'])||_0x9e96f8[_0x6a56('0x57')][_0x6a56('0x57')]===''){throw _0x1b7743['status'](0x1f4)[_0x6a56('0x2d')](new db[(_0x6a56('0x84'))]['ValidationError'](_0x6a56('0x8d')));}if(_[_0x6a56('0x71')](_0x9e96f8[_0x6a56('0x57')][_0x6a56('0xc5')])){throw _0x1b7743[_0x6a56('0x1e')](0x1f4)[_0x6a56('0x2d')](new db['Sequelize'][(_0x6a56('0x8b'))](_0x6a56('0xc6')+_0x44670d));}if(!_[_0x6a56('0x90')](_0x44670d,_0x9e96f8[_0x6a56('0x57')][_0x6a56('0xc5')])){throw _0x1b7743[_0x6a56('0x1e')](0x1f4)[_0x6a56('0x2d')](new db[(_0x6a56('0x84'))][(_0x6a56('0x8b'))](_0x6a56('0xc7')+_0x44670d));}_0x32fd7e[_0x9e96f8[_0x6a56('0x57')]['mapKeyOffline']]=_0x9e96f8[_0x6a56('0x57')][_0x6a56('0x8a')];})['then'](function(){return db['ChatWebsite'][_0x6a56('0x4f')]({'where':{'id':_0x9e96f8[_0x6a56('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0x6a56('0x93')},{'model':db[_0x6a56('0xc8')],'as':_0x6a56('0xc8')}]});})[_0x6a56('0x13')](handleEntityNotFound(_0x1b7743,null))['then'](function(_0x2135a3){if(_0x2135a3&&_0x2135a3[_0x6a56('0x93')]){_0x4217ba=_0x2135a3;var _0x19ea1a=_[_0x6a56('0x9d')](_0x9e96f8[_0x6a56('0x57')],{'firstName':_0x9e96f8[_0x6a56('0x57')][_0x6a56('0x8a')],'phone':_0x9e96f8[_0x6a56('0x57')][_0x6a56('0x8a')],'ListId':_0x2135a3[_0x6a56('0x89')]});_0x19ea1a[_0x9e96f8[_0x6a56('0x57')][_0x6a56('0xc5')]]=_0x9e96f8[_0x6a56('0x57')][_0x6a56('0x8a')];return db['CmContact'][_0x6a56('0xc9')]({'where':_0x32fd7e,'defaults':_0x19ea1a});}})[_0x6a56('0xb3')](function(_0x148733){if(_0x148733){_0x2c3773=_0x148733;var _0x15a564=fs[_0x6a56('0xca')](path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0xcb')),_0x6a56('0xcc'));var _0x2d1979=ejs[_0x6a56('0xcd')](_0x15a564,{'body':_['toPairs'](_0x9e96f8['body'][_0x6a56('0x57')]),'bodyTitle':_0x4217ba[_0x6a56('0xce')]});return db[_0x6a56('0xcf')][_0x6a56('0x50')]({'body':_0x2d1979,'plainBody':htmlToText['fromString'](_0x2d1979),'ContactId':_0x148733['id'],'ChatWebsiteId':_0x4217ba['id']});}})[_0x6a56('0x13')](function(_0x25807b){_0xae9fdb=_0x25807b;if(_0xce54cc['length']){var _0x46143e=_0xce54cc['map'](function(_0xedb1ea){return{'name':_0xedb1ea[_0x6a56('0xd0')],'basename':_0xedb1ea[_0x6a56('0x65')],'type':_0xedb1ea['mimetype'],'ChatOfflineMessageId':_0x25807b['id']};});_0x378874=_0x46143e['map'](_0x74f349=>{var _0x35d46c={'filename':_0x74f349[_0x6a56('0x2c')],'path':path[_0x6a56('0x6c')](config[_0x6a56('0x6d')],_0x6a56('0xd1'),_0x6a56('0xc3'),'attachments',_0x6a56('0xd2'),_0x74f349['basename'])};return _0x35d46c;});if(!_0x4217ba[_0x6a56('0xd3')]){return db['sequelize'][_0x6a56('0xd4')](function(_0x23a248){return db['Attachment'][_0x6a56('0xd5')](_0x46143e,{'transaction':_0x23a248});});}}})[_0x6a56('0x13')](function(){if(_0xae9fdb){_0x4ee3e1=_0xae9fdb;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x6a56('0xd6')],'as':_0x6a56('0xd7'),'raw':!![],'include':[{'model':db[_0x6a56('0xd8')],'as':_0x6a56('0xd8'),'raw':!![]}]}]});}})[_0x6a56('0x13')](function(_0x255ad7){if(_0x255ad7&&_0x255ad7[_0x6a56('0xd7')]&&_0x4217ba[_0x6a56('0xd9')]&&_0x4217ba[_0x6a56('0xda')]){var _0x251390=_0x255ad7[_0x6a56('0xdb')]();return respondWithRpcPromise(_0x6a56('0xdc'),'sendMail',{'account':_0x251390,'message':{'from':util['format'](_0x6a56('0xdd'),_0x255ad7[_0x6a56('0x2c')],_0x255ad7[_0x6a56('0xde')]||_0x255ad7['Smtp'][_0x6a56('0x51')]),'to':_0x4217ba[_0x6a56('0xda')],'subject':_0x4217ba[_0x6a56('0xdf')],'html':_0x4ee3e1[_0x6a56('0x57')],'attachments':_0x378874}},client9003)[_0x6a56('0x13')](function(){return _0x4ee3e1;})['catch'](function(_0x2b70b3){logger[_0x6a56('0x17')](_0x2b70b3);});}})['then'](function(){if(_0x4217ba&&_0x4217ba[_0x6a56('0xd3')]&&_0x4217ba[_0x6a56('0xe0')]){var _0x2e8335=[];if(_0xce54cc[_0x6a56('0x4e')]){_0x2e8335=_0xce54cc[_0x6a56('0x31')](function(_0x2db6a3){return{'name':_0x2db6a3[_0x6a56('0xd0')],'basename':_0x2db6a3[_0x6a56('0x65')],'type':_0x2db6a3[_0x6a56('0xe1')],'ChatOfflineMessageId':_0xae9fdb['id']};});}var _0x1a887f;if(!_[_0x6a56('0x71')](_0x4217ba[_0x6a56('0xe2')])){var _0x4560f4=_['map'](_0x9e96f8['body'],function(_0x37f391){return _0x37f391;});var _0x4c9ba0=_[_0x6a56('0xe3')](_0x4560f4)[0x0];var _0x46172c=_['mapValues'](_0x4c9ba0,function(_0x1a2617){return _0x1a2617;});_0x1a887f=_0x46172c[0x1][_0x4217ba[_0x6a56('0xe2')]];}var _0x3b6353={'from':_0x2c3773[_0x6a56('0xde')],'firstName':_0x2c3773[_0x6a56('0xa2')],'lastName':_0x2c3773[_0x6a56('0xa3')],'mapKey':_0x6a56('0xde'),'message':{'from':_0x2c3773[_0x6a56('0xde')],'to':_0x4217ba[_0x6a56('0xc8')][_0x6a56('0xde')],'cc':'','subject':_[_0x6a56('0x71')](_0x1a887f)?_0x4217ba['offlineMessageSubject']:_0x1a887f,'messageId':'','sentAt':new Date(),'attach':_0x2e8335[_0x6a56('0x4e')],'attachments':_0x2e8335,'originChannel':_0x6a56('0xe4'),'ChatWebsiteId':_0x4217ba['id'],'ChatOfflineMessageId':_0x4ee3e1['id'],'originTo':_0x4217ba[_0x6a56('0xc8')][_0x6a56('0xde')]},'body':_0x4ee3e1[_0x6a56('0x57')]};var _0x16ab63={'account':{'id':_0x4217ba['MailAccountId']},'body':_0x3b6353,'log':_0x6a56('0xe5')};return respondWithRpcPromise(_0x6a56('0xe5'),_0x6a56('0xe6'),_0x16ab63,client9001)[_0x6a56('0x13')](function(){return _0x4ee3e1;})[_0x6a56('0x1c')](function(_0x2db5ca){logger[_0x6a56('0x17')](_0x2db5ca);});}return;})[_0x6a56('0x13')](function(){if(_0x4ee3e1){return _0x4ee3e1;}})['then'](respondWithResult(_0x1b7743,null))[_0x6a56('0x1c')](function(_0x323c6a){logger[_0x6a56('0x17')](_0x6a56('0x1c'),_0x323c6a);for(var _0xc14ea4 of _0xce54cc){var _0x1602fc=path['join'](config[_0x6a56('0x6d')],'server',_0x6a56('0xc3'),_0x6a56('0xe7'),_0x6a56('0xd2'),_0xc14ea4['filename']);fs_extra[_0x6a56('0xe8')](_0x1602fc)[_0x6a56('0x1c')](function(_0x4c010c){logger['error'](_0x6a56('0xe9'),_0x1602fc,_0x4c010c);});}});};exports[_0x6a56('0xea')]=function(_0x26e603,_0x3c8095){return db[_0x6a56('0xaf')][_0x6a56('0x4f')]({'where':{'id':_0x26e603[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x3c8095,null))[_0x6a56('0x13')](function(_0x404764){if(_0x404764){return _0x404764[_0x6a56('0xea')](_0x26e603[_0x6a56('0x57')]['ids'],_['omit'](_0x26e603[_0x6a56('0x57')],[_0x6a56('0x5e'),'id'])||{});}})[_0x6a56('0x13')](respondWithResult(_0x3c8095,null))['catch'](handleError(_0x3c8095,null));};exports[_0x6a56('0xeb')]=function(_0x5c57fc,_0x3264ff){var _0x466e50={'raw':![],'where':{}};var _0x252876={};var _0x1d7df={'count':0x0,'rows':[]};return db[_0x6a56('0x32')][_0x6a56('0xec')]({'where':{'id':_0x5c57fc[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x3264ff,null))['then'](function(_0x29a67e){if(_0x29a67e){_0x252876[_0x6a56('0x37')]=_[_0x6a56('0x38')](db[_0x6a56('0xaf')]['rawAttributes']);_0x252876[_0x6a56('0x3b')]=_[_0x6a56('0x38')](_0x5c57fc[_0x6a56('0x3b')]);_0x252876[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x252876[_0x6a56('0x37')],_0x252876[_0x6a56('0x3b')]);_0x466e50[_0x6a56('0x3d')]=_[_0x6a56('0x3a')](_0x252876[_0x6a56('0x37')],qs[_0x6a56('0x3c')](_0x5c57fc['query'][_0x6a56('0x3c')]));_0x466e50['attributes']=_0x466e50['attributes'][_0x6a56('0x4e')]?_0x466e50['attributes']:_0x252876['model'];if(!_0x5c57fc[_0x6a56('0x3b')]['hasOwnProperty'](_0x6a56('0x3f'))){_0x466e50[_0x6a56('0x21')]=qs['limit'](_0x5c57fc[_0x6a56('0x3b')]['limit']);_0x466e50['offset']=qs[_0x6a56('0x23')](_0x5c57fc['query'][_0x6a56('0x23')]);}_0x466e50[_0x6a56('0x40')]=qs[_0x6a56('0x41')](_0x5c57fc[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x466e50[_0x6a56('0x44')]=qs[_0x6a56('0x39')](_[_0x6a56('0x42')](_0x5c57fc[_0x6a56('0x3b')],_0x252876[_0x6a56('0x39')]));_0x466e50['where'][_0x6a56('0x5a')]=_0x29a67e['id'];if(_0x5c57fc['query'][_0x6a56('0x43')]){_0x466e50['where']=_['merge'](_0x466e50[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0x466e50[_0x6a56('0x3d')],function(_0x3203a8){var _0x186c60={};_0x186c60[_0x3203a8]={'$like':'%'+_0x5c57fc[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x186c60;})});}_0x466e50=_[_0x6a56('0x5d')]({},_0x466e50,_0x5c57fc[_0x6a56('0x46')]);return db['ChatInteraction'][_0x6a56('0x47')]({'where':_0x466e50[_0x6a56('0x44')]})['then'](function(_0x3eb80a){_0x1d7df[_0x6a56('0x47')]=_0x3eb80a;if(_0x5c57fc[_0x6a56('0x3b')]['includeAll']){_0x466e50[_0x6a56('0x49')]=[{'model':db['CmContact'],'as':_0x6a56('0xed'),'required':![]},{'model':db[_0x6a56('0xba')],'as':'Owner','attributes':[_0x6a56('0x2c'),'fullname',_0x6a56('0xee')],'required':![]},{'model':db['Tag'],'as':_0x6a56('0xef'),'attributes':['id',_0x6a56('0x2c'),_0x6a56('0xf0')],'where':_0x5c57fc[_0x6a56('0x3b')]['tag']?{'id':_0x5c57fc[_0x6a56('0x3b')]['tag']}:undefined,'required':_0x5c57fc[_0x6a56('0x3b')][_0x6a56('0xf1')]?!![]:![]}];}return db[_0x6a56('0xaf')][_0x6a56('0x4a')](_0x466e50);})[_0x6a56('0x13')](function(_0x39f46a){_0x1d7df['rows']=_0x39f46a;return _0x1d7df;});}})[_0x6a56('0x13')](respondWithFilteredResult(_0x3264ff,_0x466e50))[_0x6a56('0x1c')](handleError(_0x3264ff,null));};function iftimePromise(_0x8e26e3,_0x2ad88e){return respondWithRpcPromise('Command','getSnippet',{'command':_0x2ad88e[_0x6a56('0xf2')]?util[_0x6a56('0xa8')](_0x6a56('0xf3'),_0x8e26e3['interval'],_0x2ad88e[_0x6a56('0xf2')]):util[_0x6a56('0xa8')](_0x6a56('0xf4'),_0x8e26e3[_0x6a56('0xf5')])},client9002)[_0x6a56('0x13')](function(_0x2aad27){var _0x5eb1ca=_0x2aad27&&_0x2aad27[_0x6a56('0xf6')](_0x6a56('0xf7'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2ad88e['id'],_0x8e26e3['id'],_0x8e26e3[_0x6a56('0xf5')],_0x5eb1ca?_0x6a56('0xf8'):'OFFLINE',_0x2ad88e['timezone']?_0x2ad88e['timezone']:_0x6a56('0xf9'));return _0x5eb1ca;})[_0x6a56('0x1c')](function(_0x59cd37){logger[_0x6a56('0x17')](_0x6a56('0xfa'),_0x2ad88e['id'],_0x8e26e3['id'],_0x8e26e3[_0x6a56('0xf5')],util[_0x6a56('0xfb')](_0x59cd37,{'showHidden':![],'depth':null}),_0x2ad88e[_0x6a56('0xf2')]?_0x2ad88e[_0x6a56('0xf2')]:_0x6a56('0xf9'));return![];});}exports['getSnippet']=function(_0x9950e0,_0x2c7ce7){var _0x49f512=0x0;var _0x1f6242=0x0;var _0x274f38=![];var _0x180341;var _0x5741df;return db['ChatWebsite'][_0x6a56('0x4f')]({'where':{'id':_0x9950e0[_0x6a56('0x4d')]['id']},'include':[{'model':db[_0x6a56('0xfc')],'as':_0x6a56('0xfc'),'include':[{'model':db['Interval'],'as':_0x6a56('0xfd'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2c7ce7,null))[_0x6a56('0x13')](function(_0x211f5e){if(_0x211f5e){_0x180341=_0x211f5e;return _0x211f5e[_0x6a56('0xfe')]({'raw':!![]});}})[_0x6a56('0x13')](function(_0x4b8827){if(_0x180341){if(_0x4b8827){_0x5741df=_0x4b8827;}}return require(_0x6a56('0x6f'))[_0x6a56('0xff')]();})[_0x6a56('0x13')](function(_0x2dfb9f){if(_0x2dfb9f){_0x1f6242=_0x2dfb9f['virtual'];_0x274f38=_0x2dfb9f['custom'];}})[_0x6a56('0x13')](function(){return db[_0x6a56('0xaf')][_0x6a56('0x47')]({'where':{'closed':![]}});})['then'](function(_0x4a38c2){_0x49f512=_0x4a38c2;if(_0x1f6242&&_0x4a38c2>_0x1f6242){return db[_0x6a56('0x100')]['findOne']({'where':{'id':0x1}})[_0x6a56('0x13')](function(_0x29d464){if(_0x29d464){_0x29d464[_0x6a56('0x101')](_0x6a56('0x102'));}});}})['then'](function(){if(_0x180341[_0x6a56('0xfc')]&&_0x180341[_0x6a56('0xfc')]['Intervals']){var _0x4974a9=[];for(var _0x5a3b19=0x0;_0x5a3b19<_0x180341['Interval'][_0x6a56('0xfd')]['length'];_0x5a3b19++){var _0x1e03b4=_0x180341['Interval'][_0x6a56('0xfd')][_0x5a3b19][_0x6a56('0x28')]({'plain':!![]});_0x4974a9[_0x6a56('0xb7')](iftimePromise(_0x1e03b4,_0x180341));}return BPromise[_0x6a56('0x103')](_0x4974a9)[_0x6a56('0x13')](function(_0x57070e){return _['some'](_0x57070e);});}else{return!![];}})[_0x6a56('0x13')](function(_0x1aa15e){var _0xe9e0d4=fs[_0x6a56('0xca')](path[_0x6a56('0x6c')](config['root'],_0x6a56('0x104')),_0x6a56('0xcc'));var _0x264bcf=new url[(_0x6a56('0x105'))](_0x180341[_0x6a56('0x106')])['origin'];var _0x21a414=_0x6a56('0x107');var _0x280c0c=![];var _0xf8e36={'chatVersion':_0x21a414,'chatWebsiteAddressOrigin':_0x264bcf,'remote':_0x180341[_0x6a56('0x108')],'query':querystring[_0x6a56('0x16')](_[_0x6a56('0x5d')](_0x180341[_0x6a56('0x28')]({'plain':!![]}),{'customerIp':_0x9950e0[_0x6a56('0x7f')][_0x6a56('0xa1')]||_0x9950e0[_0x6a56('0x7f')]['x-real-ip']||_0x9950e0[_0x6a56('0x109')]['remoteAddress']||_0x9950e0['ip'],'referer':_0x9950e0['headers']['referer'],'openedInteractions':_0x49f512,'maxInteractions':_0x1f6242,'virtual':_0x274f38[_0x6a56('0x10a')],'online':_0x1aa15e,'custom':_0x274f38}))[_0x6a56('0x10b')](/'/g,'\x5c\x27')};_0x2c7ce7[_0x6a56('0x2d')](ejs[_0x6a56('0xcd')](Mustache['render'](_0xe9e0d4,_0xf8e36),{'proactiveActions':_0x5741df,'alignment':_0x180341['alignment'],'verticalAlignment':_0x180341[_0x6a56('0x10c')],'div_color':_0x180341[_0x6a56('0xf0')],'labelText':_0x180341[_0x6a56('0x10d')],'text_color':_0x180341['textColor'],'text_button_color':_0x180341[_0x6a56('0x10e')],'button_color':_0x180341[_0x6a56('0x10f')],'background_color':_0x180341[_0x6a56('0x110')],'hideWhenOffline':_0x180341['hideWhenOffline'],'intervalId':_0x180341['IntervalId'],'isDevelopment':_0x280c0c,'chatVersion':_0x21a414}));})[_0x6a56('0x1c')](handleError(_0x2c7ce7,null));};exports[_0x6a56('0x111')]=function(_0x53b326,_0x529f78){var _0x550014=_0x53b326[_0x6a56('0x4d')]['id'];var _0x5462db=_0x53b326[_0x6a56('0x57')];var _0x301e75=0xc8;var _0x18d167=null;return db[_0x6a56('0x112')]['transaction']({'isolationLevel':db['sequelize'][_0x6a56('0x113')][_0x6a56('0x114')][_0x6a56('0x115')]},function(_0x56f15c){return db[_0x6a56('0x32')]['findOne']({'where':{'id':_0x550014},'transaction':_0x56f15c})[_0x6a56('0x13')](function(_0x2d0961){if(_0x2d0961){return db[_0x6a56('0x95')][_0x6a56('0x27')]({'where':{'ChatWebsiteId':_0x550014},'transaction':_0x56f15c})[_0x6a56('0x13')](function(){var _0xb3c002=_[_0x6a56('0x31')](_0x5462db,function(_0x3a3086){_0x3a3086[_0x6a56('0x5a')]=_0x550014;return _0x3a3086;});return db[_0x6a56('0x95')][_0x6a56('0xd5')](_0xb3c002,{'transaction':_0x56f15c});});}else{_0x301e75=0x194;_0x18d167=[];}});})[_0x6a56('0x13')](function(){if(_0x301e75!==0x194){return db[_0x6a56('0x95')][_0x6a56('0x116')]({'where':{'ChatWebsiteId':_0x550014},'order':_0x6a56('0x9a')})['then'](function(_0x4db410){_0x18d167=_0x4db410;});}})[_0x6a56('0x1c')](function(_0x55863a){_0x301e75=0x1f4;logger[_0x6a56('0x17')](_0x55863a[_0x6a56('0x2b')]);if(_0x55863a[_0x6a56('0x2c')]){delete _0x55863a[_0x6a56('0x2c')];}_0x18d167=_0x55863a;})[_0x6a56('0x117')](function(){if(_0x18d167===null){_0x529f78[_0x6a56('0x1d')](_0x301e75);}else{if(_0x301e75===0x1f4){_0x529f78[_0x6a56('0x1e')](_0x301e75)[_0x6a56('0x2d')](_0x18d167);}else{_0x529f78[_0x6a56('0x1e')](_0x301e75)['json'](_0x18d167);}}});};exports[_0x6a56('0x118')]=function(_0x35440a,_0xfad30d){var _0x4b4bd2={};var _0x2687ca={};var _0x2814a6;var _0x150edb;return db[_0x6a56('0x32')]['findOne']({'where':{'id':_0x35440a['params']['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0xfad30d,null))[_0x6a56('0x13')](function(_0x128597){if(_0x128597){_0x2814a6=_0x128597;_0x2687ca[_0x6a56('0x37')]=_[_0x6a56('0x38')](db[_0x6a56('0x95')][_0x6a56('0x33')]);_0x2687ca['query']=_[_0x6a56('0x38')](_0x35440a[_0x6a56('0x3b')]);_0x2687ca[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x2687ca[_0x6a56('0x37')],_0x2687ca[_0x6a56('0x3b')]);_0x4b4bd2[_0x6a56('0x3d')]=_['intersection'](_0x2687ca[_0x6a56('0x37')],qs[_0x6a56('0x3c')](_0x35440a[_0x6a56('0x3b')][_0x6a56('0x3c')]));_0x4b4bd2['attributes']=_0x4b4bd2[_0x6a56('0x3d')][_0x6a56('0x4e')]?_0x4b4bd2[_0x6a56('0x3d')]:_0x2687ca[_0x6a56('0x37')];_0x4b4bd2[_0x6a56('0x40')]=qs['sort'](_0x35440a[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x4b4bd2[_0x6a56('0x44')]=qs[_0x6a56('0x39')](_[_0x6a56('0x42')](_0x35440a[_0x6a56('0x3b')],_0x2687ca[_0x6a56('0x39')]));if(_0x35440a[_0x6a56('0x3b')][_0x6a56('0x43')]){_0x4b4bd2[_0x6a56('0x44')]=_[_0x6a56('0x5d')](_0x4b4bd2[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0x4b4bd2[_0x6a56('0x3d')],function(_0x451051){var _0x5ae772={};_0x5ae772[_0x451051]={'$like':'%'+_0x35440a[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x5ae772;})});}_0x4b4bd2=_[_0x6a56('0x5d')]({},_0x4b4bd2,_0x35440a[_0x6a56('0x46')]);return _0x2814a6[_0x6a56('0x118')](_0x4b4bd2);}})[_0x6a56('0x13')](function(_0x3ec1cb){if(_0x3ec1cb){_0x150edb=_0x3ec1cb[_0x6a56('0x4e')];if(!_0x35440a[_0x6a56('0x3b')][_0x6a56('0x3e')]('nolimit')){_0x4b4bd2['limit']=qs[_0x6a56('0x21')](_0x35440a[_0x6a56('0x3b')][_0x6a56('0x21')]);_0x4b4bd2[_0x6a56('0x23')]=qs['offset'](_0x35440a[_0x6a56('0x3b')][_0x6a56('0x23')]);}return _0x2814a6['getApplications'](_0x4b4bd2);}})['then'](function(_0x509a10){if(_0x509a10){return _0x509a10?{'count':_0x150edb,'rows':_0x509a10}:null;}})[_0x6a56('0x13')](respondWithResult(_0xfad30d,null))[_0x6a56('0x1c')](handleError(_0xfad30d,null));};exports[_0x6a56('0x119')]=function(_0x4d3a02,_0x52a34e){return db['chatProactiveAction']['find']({'where':{'id':_0x4d3a02[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x52a34e,null))[_0x6a56('0x13')](function(_0x11727c){if(_0x11727c){return _0x11727c['addProactiveActions'](_0x4d3a02[_0x6a56('0x57')][_0x6a56('0x5e')],_[_0x6a56('0x11a')](_0x4d3a02[_0x6a56('0x57')],['ids','id'])||{});}})[_0x6a56('0x13')](respondWithResult(_0x52a34e,null))['catch'](handleError(_0x52a34e,null));};exports['getProactiveActions']=function(_0x336458,_0x4bcade){var _0x4a7cc8={};var _0x56eed5={};var _0x36944e;var _0x3de7ad;return db[_0x6a56('0x32')][_0x6a56('0xec')]({'where':{'id':_0x336458[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x4bcade,null))[_0x6a56('0x13')](function(_0x3f430d){if(_0x3f430d){_0x36944e=_0x3f430d;_0x56eed5[_0x6a56('0x37')]=_['keys'](db[_0x6a56('0x11b')][_0x6a56('0x33')]);_0x56eed5[_0x6a56('0x3b')]=_['keys'](_0x336458[_0x6a56('0x3b')]);_0x56eed5['filters']=_[_0x6a56('0x3a')](_0x56eed5[_0x6a56('0x37')],_0x56eed5[_0x6a56('0x3b')]);_0x4a7cc8[_0x6a56('0x3d')]=_['intersection'](_0x56eed5[_0x6a56('0x37')],qs[_0x6a56('0x3c')](_0x336458[_0x6a56('0x3b')][_0x6a56('0x3c')]));_0x4a7cc8[_0x6a56('0x3d')]=_0x4a7cc8['attributes'][_0x6a56('0x4e')]?_0x4a7cc8['attributes']:_0x56eed5['model'];_0x4a7cc8['order']=qs['sort'](_0x336458[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x4a7cc8[_0x6a56('0x44')]=qs[_0x6a56('0x39')](_['pick'](_0x336458[_0x6a56('0x3b')],_0x56eed5[_0x6a56('0x39')]));if(_0x336458['query'][_0x6a56('0x43')]){_0x4a7cc8[_0x6a56('0x44')]=_[_0x6a56('0x5d')](_0x4a7cc8[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0x4a7cc8[_0x6a56('0x3d')],function(_0x23e793){var _0x4c0f8f={};_0x4c0f8f[_0x23e793]={'$like':'%'+_0x336458[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x4c0f8f;})});}_0x4a7cc8=_[_0x6a56('0x5d')]({},_0x4a7cc8,_0x336458['options']);return _0x36944e[_0x6a56('0xfe')](_0x4a7cc8);}})['then'](function(_0xfe647b){if(_0xfe647b){_0x3de7ad=_0xfe647b['length'];if(!_0x336458[_0x6a56('0x3b')]['hasOwnProperty'](_0x6a56('0x3f'))){_0x4a7cc8[_0x6a56('0x21')]=qs[_0x6a56('0x21')](_0x336458[_0x6a56('0x3b')][_0x6a56('0x21')]);_0x4a7cc8[_0x6a56('0x23')]=qs[_0x6a56('0x23')](_0x336458[_0x6a56('0x3b')][_0x6a56('0x23')]);}return _0x36944e['getProactiveActions'](_0x4a7cc8);}})['then'](function(_0x563f5e){if(_0x563f5e){return _0x563f5e?{'count':_0x3de7ad,'rows':_0x563f5e}:null;}})[_0x6a56('0x13')](respondWithResult(_0x4bcade,null))[_0x6a56('0x1c')](handleError(_0x4bcade,null));};exports['getFields']=function(_0x301cae,_0x10276d){var _0x9884b3=_0x301cae['query'][_0x6a56('0x11c')]===_0x6a56('0x11d')?_0x6a56('0x11e'):_0x6a56('0x11f');return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'attributes':['id',_0x9884b3],'where':{'id':_0x301cae[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x10276d,null))[_0x6a56('0x13')](function(_0x4d1d46){if(_0x4d1d46){var _0x5dcdd4=_0x4d1d46[_0x9884b3];var _0x47eb76=_0x5dcdd4&&_0x5dcdd4[_0x6a56('0x120')]?_0x5dcdd4[_0x6a56('0x120')]:[];_0x10276d[_0x6a56('0x2d')]({'fromKey':_[_0x6a56('0x71')](_0x5dcdd4['fromKey'])?undefined:_0x5dcdd4['fromKey'],'count':_0x47eb76[_0x6a56('0x4e')],'rows':_0x47eb76});}})[_0x6a56('0x1c')](handleError(_0x10276d,null));};exports[_0x6a56('0x121')]=function(_0x4a5f4b,_0x2ccc3d){var _0x39b67f={'raw':![],'where':{}};var _0x989808={};var _0x188b5b={'count':0x0,'rows':[]};return db[_0x6a56('0x32')][_0x6a56('0xec')]({'where':{'id':_0x4a5f4b[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x2ccc3d,null))['then'](function(_0x2fe957){if(_0x2fe957){_0x989808['model']=_['keys'](db[_0x6a56('0xcf')][_0x6a56('0x33')]);_0x989808[_0x6a56('0x3b')]=_[_0x6a56('0x38')](_0x4a5f4b['query']);_0x989808[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x989808[_0x6a56('0x37')],_0x989808['query']);_0x39b67f[_0x6a56('0x3d')]=_[_0x6a56('0x3a')](_0x989808['model'],qs['fields'](_0x4a5f4b['query'][_0x6a56('0x3c')]));_0x39b67f[_0x6a56('0x3d')]=_0x39b67f['attributes'][_0x6a56('0x4e')]?_0x39b67f['attributes']:_0x989808[_0x6a56('0x37')];if(!_0x4a5f4b[_0x6a56('0x3b')][_0x6a56('0x3e')](_0x6a56('0x3f'))){_0x39b67f[_0x6a56('0x21')]=qs[_0x6a56('0x21')](_0x4a5f4b['query']['limit']);_0x39b67f[_0x6a56('0x23')]=qs['offset'](_0x4a5f4b[_0x6a56('0x3b')][_0x6a56('0x23')]);}_0x39b67f[_0x6a56('0x40')]=qs['sort'](_0x4a5f4b[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x39b67f[_0x6a56('0x44')]=qs[_0x6a56('0x39')](_[_0x6a56('0x42')](_0x4a5f4b[_0x6a56('0x3b')],_0x989808[_0x6a56('0x39')]));_0x39b67f[_0x6a56('0x44')][_0x6a56('0x5a')]=_0x2fe957['id'];if(_0x4a5f4b[_0x6a56('0x3b')][_0x6a56('0x43')]){_0x39b67f[_0x6a56('0x44')]=_[_0x6a56('0x5d')](_0x39b67f[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0x39b67f['attributes'],function(_0x1b3584){var _0x1354bd={};_0x1354bd[_0x1b3584]={'$like':'%'+_0x4a5f4b[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x1354bd;})});}_0x39b67f=_[_0x6a56('0x5d')]({},_0x39b67f,_0x4a5f4b['options']);return db[_0x6a56('0xcf')][_0x6a56('0x47')]({'where':_0x39b67f[_0x6a56('0x44')]})[_0x6a56('0x13')](function(_0x3599c7){_0x188b5b[_0x6a56('0x47')]=_0x3599c7;if(_0x4a5f4b['query'][_0x6a56('0x48')]){_0x39b67f[_0x6a56('0x49')]=[{'all':!![]}];}else{_0x39b67f['include']=[{'model':db[_0x6a56('0x83')],'as':_0x6a56('0xed'),'required':![]},{'model':db[_0x6a56('0x122')],'as':_0x6a56('0x123'),'required':![]}];}return db[_0x6a56('0xcf')][_0x6a56('0x4a')](_0x39b67f);})[_0x6a56('0x13')](function(_0x53f9ec){_0x188b5b[_0x6a56('0x4b')]=_0x53f9ec;return _0x188b5b;});}})[_0x6a56('0x13')](respondWithFilteredResult(_0x2ccc3d,_0x39b67f))[_0x6a56('0x1c')](handleError(_0x2ccc3d,null));};exports[_0x6a56('0x124')]=function(_0x2c11d7,_0x402150){return db['ChatWebsite'][_0x6a56('0x4f')]({'where':{'id':_0x2c11d7['params']['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x402150,null))[_0x6a56('0x13')](function(_0x14843d){if(_0x14843d){return _0x14843d['addAgents'](_0x2c11d7[_0x6a56('0x57')][_0x6a56('0x5e')],_[_0x6a56('0x11a')](_0x2c11d7['body'],['ids','id'])||{})[_0x6a56('0xb3')](function(_0x5cd7c6){for(var _0x4fe5d3=0x0;_0x4fe5d3<_0x2c11d7[_0x6a56('0x57')][_0x6a56('0x5e')][_0x6a56('0x4e')];_0x4fe5d3+=0x1){socket[_0x6a56('0x125')]('userChatWebsite:save',{'UserId':Number(_0x2c11d7['body'][_0x6a56('0x5e')][_0x4fe5d3]),'ChatWebsiteId':Number(_0x2c11d7[_0x6a56('0x4d')]['id'])});}return _0x5cd7c6;});}})[_0x6a56('0x13')](respondWithResult(_0x402150,null))['catch'](handleError(_0x402150,null));};exports[_0x6a56('0x126')]=function(_0x3cbaa8,_0x33b87a){return db[_0x6a56('0x32')][_0x6a56('0x4f')]({'where':{'id':_0x3cbaa8[_0x6a56('0x4d')]['id']}})[_0x6a56('0x13')](handleEntityNotFound(_0x33b87a,null))[_0x6a56('0x13')](function(_0x17bbe8){if(_0x17bbe8){return _0x17bbe8['removeAgents'](_0x3cbaa8[_0x6a56('0x3b')]['ids'])['then'](function(){if(_[_0x6a56('0x127')](_0x3cbaa8[_0x6a56('0x3b')]['ids'])){for(var _0x608c69=0x0;_0x608c69<_0x3cbaa8[_0x6a56('0x3b')][_0x6a56('0x5e')][_0x6a56('0x4e')];_0x608c69+=0x1){socket[_0x6a56('0x125')](_0x6a56('0x128'),{'UserId':Number(_0x3cbaa8[_0x6a56('0x3b')][_0x6a56('0x5e')][_0x608c69]),'ChatWebsiteId':Number(_0x3cbaa8[_0x6a56('0x4d')]['id'])});}}else{socket[_0x6a56('0x125')]('userChatWebsite:remove',{'UserId':Number(_0x3cbaa8[_0x6a56('0x3b')][_0x6a56('0x5e')]),'ChatWebsiteId':Number(_0x3cbaa8['params']['id'])});}});}})[_0x6a56('0x13')](respondWithStatusCode(_0x33b87a,null))[_0x6a56('0x1c')](handleError(_0x33b87a,null));};exports['getAgents']=function(_0x54f23f,_0x457375){var _0x1804c0={};var _0x3a0bfa={};var _0x2c578d;var _0x140121;return db['ChatWebsite'][_0x6a56('0xec')]({'where':{'id':_0x54f23f[_0x6a56('0x4d')]['id']}})['then'](handleEntityNotFound(_0x457375,null))[_0x6a56('0x13')](function(_0x841871){if(_0x841871){_0x2c578d=_0x841871;_0x3a0bfa['model']=_[_0x6a56('0x38')](db[_0x6a56('0xba')]['rawAttributes']);_0x3a0bfa[_0x6a56('0x3b')]=_[_0x6a56('0x38')](_0x54f23f[_0x6a56('0x3b')]);_0x3a0bfa[_0x6a56('0x39')]=_[_0x6a56('0x3a')](_0x3a0bfa['model'],_0x3a0bfa[_0x6a56('0x3b')]);_0x1804c0['attributes']=_[_0x6a56('0x3a')](_0x3a0bfa[_0x6a56('0x37')],qs[_0x6a56('0x3c')](_0x54f23f['query'][_0x6a56('0x3c')]));_0x1804c0[_0x6a56('0x3d')]=_0x1804c0[_0x6a56('0x3d')][_0x6a56('0x4e')]?_0x1804c0[_0x6a56('0x3d')]:_0x3a0bfa['model'];_0x1804c0[_0x6a56('0x40')]=qs[_0x6a56('0x41')](_0x54f23f[_0x6a56('0x3b')][_0x6a56('0x41')]);_0x1804c0[_0x6a56('0x44')]=qs[_0x6a56('0x39')](_[_0x6a56('0x42')](_0x54f23f['query'],_0x3a0bfa[_0x6a56('0x39')]));if(_0x54f23f[_0x6a56('0x3b')]['filter']){_0x1804c0[_0x6a56('0x44')]=_[_0x6a56('0x5d')](_0x1804c0[_0x6a56('0x44')],{'$or':_[_0x6a56('0x31')](_0x1804c0[_0x6a56('0x3d')],function(_0x3b73ea){var _0x2ffa2b={};_0x2ffa2b[_0x3b73ea]={'$like':'%'+_0x54f23f[_0x6a56('0x3b')][_0x6a56('0x43')]+'%'};return _0x2ffa2b;})});}_0x1804c0=_[_0x6a56('0x5d')]({},_0x1804c0,_0x54f23f[_0x6a56('0x46')]);return _0x2c578d[_0x6a56('0x129')](_0x1804c0);}})[_0x6a56('0x13')](function(_0x121e3e){if(_0x121e3e){_0x140121=_0x121e3e['length'];if(!_0x54f23f['query'][_0x6a56('0x3e')](_0x6a56('0x3f'))){_0x1804c0[_0x6a56('0x21')]=qs[_0x6a56('0x21')](_0x54f23f[_0x6a56('0x3b')]['limit']);_0x1804c0[_0x6a56('0x23')]=qs[_0x6a56('0x23')](_0x54f23f[_0x6a56('0x3b')][_0x6a56('0x23')]);}return _0x2c578d[_0x6a56('0x129')](_0x1804c0);}})[_0x6a56('0x13')](function(_0x2dc7ec){if(_0x2dc7ec){return _0x2dc7ec?{'count':_0x140121,'rows':_0x2dc7ec}:null;}})[_0x6a56('0x13')](respondWithResult(_0x457375,null))[_0x6a56('0x1c')](handleError(_0x457375,null));};
\ No newline at end of file
index 95f61c2..ac87870 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08d9=['hasOwnProperty','exports','events','ChatWebsite','save','update','remove','emit'];(function(_0x4359bc,_0x237ad2){var _0x101f39=function(_0x37fc33){while(--_0x37fc33){_0x4359bc['push'](_0x4359bc['shift']());}};_0x101f39(++_0x237ad2);}(_0x08d9,0xc2));var _0x908d=function(_0x52e1ff,_0x22a521){_0x52e1ff=_0x52e1ff-0x0;var _0x2f4db0=_0x08d9[_0x52e1ff];return _0x2f4db0;};'use strict';var EventEmitter=require(_0x908d('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x908d('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x908d('0x2'),'afterUpdate':_0x908d('0x3'),'afterDestroy':_0x908d('0x4')};function emitEvent(_0x5228dd){return function(_0x53cef4,_0x15dfb3,_0x396097){ChatWebsiteEvents[_0x908d('0x5')](_0x5228dd+':'+_0x53cef4['id'],_0x53cef4);ChatWebsiteEvents[_0x908d('0x5')](_0x5228dd,_0x53cef4);_0x396097(null);};}for(var e in events){if(events[_0x908d('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x908d('0x7')]=ChatWebsiteEvents;
\ No newline at end of file
+var _0x769c=['events','ChatWebsite','setMaxListeners','remove','emit','exports'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x769c,0x96));var _0xc769=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x769c[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xc769('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xc769('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc769('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc769('0x3')};function emitEvent(_0x25dc31){return function(_0x21f114,_0x3409d2,_0x5aed51){ChatWebsiteEvents[_0xc769('0x4')](_0x25dc31+':'+_0x21f114['id'],_0x21f114);ChatWebsiteEvents[_0xc769('0x4')](_0x25dc31,_0x21f114);_0x5aed51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xc769('0x5')]=ChatWebsiteEvents;
\ No newline at end of file
index 47cc5a1..b477c89 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e28=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e28,0x107));var _0x80e2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0e28[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x80e2('0x0'))(_0x80e2('0x1'));var moment=require(_0x80e2('0x2'));var BPromise=require(_0x80e2('0x3'));var rp=require(_0x80e2('0x4'));var fs=require('fs');var path=require(_0x80e2('0x5'));var rimraf=require('rimraf');var config=require(_0x80e2('0x6'));var attributes=require(_0x80e2('0x7'));module[_0x80e2('0x8')]=function(_0x3e74bd,_0x120777){return _0x3e74bd[_0x80e2('0x9')]('ChatWebsite',attributes,{'tableName':_0x80e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7f20=['../../config/environment','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x7f20,0x178));var _0x07f2=function(_0x4392d2,_0x438f52){_0x4392d2=_0x4392d2-0x0;var _0xff44ba=_0x7f20[_0x4392d2];return _0xff44ba;};'use strict';var _=require(_0x07f2('0x0'));var util=require(_0x07f2('0x1'));var logger=require(_0x07f2('0x2'))(_0x07f2('0x3'));var moment=require(_0x07f2('0x4'));var BPromise=require(_0x07f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07f2('0x6'));var rimraf=require(_0x07f2('0x7'));var config=require(_0x07f2('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x5ab397,_0x1fe7ac){return _0x5ab397[_0x07f2('0x9')](_0x07f2('0xa'),attributes,{'tableName':_0x07f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index db1ccee..266f5d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xada3=['ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xada3,0x1ca));var _0x3ada=function(_0x357654,_0x3bba0a){_0x357654=_0x357654-0x0;var _0x3ce758=_0xada3[_0x357654];return _0x3ce758;};'use strict';var _=require(_0x3ada('0x0'));var util=require(_0x3ada('0x1'));var moment=require('moment');var BPromise=require(_0x3ada('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ada('0x3'));var db=require(_0x3ada('0x4'))['db'];var utils=require(_0x3ada('0x5'));var logger=require('../../config/logger')(_0x3ada('0x6'));var config=require(_0x3ada('0x7'));var jayson=require(_0x3ada('0x8'));var client=jayson[_0x3ada('0x9')]['http']({'port':0x232a});config[_0x3ada('0xa')]=_[_0x3ada('0xb')](config[_0x3ada('0xa')],{'host':_0x3ada('0xc'),'port':0x18eb});var socket=require(_0x3ada('0xd'))(new Redis(config['redis']));require(_0x3ada('0xe'))[_0x3ada('0xf')](socket);function respondWithRpcPromise(_0x1e413e,_0x440411,_0x1a4fb0){return new BPromise(function(_0x4007d4,_0x13363e){return client['request'](_0x1e413e,_0x1a4fb0)[_0x3ada('0x10')](function(_0x4f0c5f){logger[_0x3ada('0x11')](_0x3ada('0x12'),_0x440411,'request\x20sent');logger[_0x3ada('0x13')](_0x3ada('0x14'),_0x440411,_0x3ada('0x15'),JSON[_0x3ada('0x16')](_0x4f0c5f));if(_0x4f0c5f[_0x3ada('0x17')]){if(_0x4f0c5f['error'][_0x3ada('0x18')]===0x1f4){logger[_0x3ada('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x440411,_0x4f0c5f[_0x3ada('0x17')][_0x3ada('0x19')]);return _0x13363e(_0x4f0c5f[_0x3ada('0x17')][_0x3ada('0x19')]);}logger[_0x3ada('0x17')](_0x3ada('0x12'),_0x440411,_0x4f0c5f[_0x3ada('0x17')]['message']);return _0x4007d4(_0x4f0c5f['error']['message']);}else{logger[_0x3ada('0x11')](_0x3ada('0x12'),_0x440411,_0x3ada('0x15'));_0x4007d4(_0x4f0c5f[_0x3ada('0x1a')]['message']);}})[_0x3ada('0x1b')](function(_0x3f2f86){logger[_0x3ada('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x440411,_0x3f2f86);_0x13363e(_0x3f2f86);});});}
\ No newline at end of file
+var _0x5ad7=['client','http','redis','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11f15e,_0x2cc181){var _0x27dad5=function(_0x245de4){while(--_0x245de4){_0x11f15e['push'](_0x11f15e['shift']());}};_0x27dad5(++_0x2cc181);}(_0x5ad7,0xfc));var _0x75ad=function(_0xdf0915,_0xd4f76d){_0xdf0915=_0xdf0915-0x0;var _0x2f7d92=_0x5ad7[_0xdf0915];return _0x2f7d92;};'use strict';var _=require('lodash');var util=require(_0x75ad('0x0'));var moment=require(_0x75ad('0x1'));var BPromise=require(_0x75ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75ad('0x4'));var logger=require(_0x75ad('0x5'))(_0x75ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x75ad('0x7'));var client=jayson[_0x75ad('0x8')][_0x75ad('0x9')]({'port':0x232a});config[_0x75ad('0xa')]=_['defaults'](config[_0x75ad('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x75ad('0xb'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x75ad('0xc')](socket);function respondWithRpcPromise(_0x32a23a,_0x1a0d10,_0x13be17){return new BPromise(function(_0x48a4df,_0x25720b){return client[_0x75ad('0xd')](_0x32a23a,_0x13be17)[_0x75ad('0xe')](function(_0x433189){logger['info'](_0x75ad('0xf'),_0x1a0d10,'request\x20sent');logger[_0x75ad('0x10')](_0x75ad('0x11'),_0x1a0d10,_0x75ad('0x12'),JSON[_0x75ad('0x13')](_0x433189));if(_0x433189['error']){if(_0x433189[_0x75ad('0x14')][_0x75ad('0x15')]===0x1f4){logger['error'](_0x75ad('0xf'),_0x1a0d10,_0x433189[_0x75ad('0x14')][_0x75ad('0x16')]);return _0x25720b(_0x433189[_0x75ad('0x14')][_0x75ad('0x16')]);}logger[_0x75ad('0x14')](_0x75ad('0xf'),_0x1a0d10,_0x433189['error'][_0x75ad('0x16')]);return _0x48a4df(_0x433189[_0x75ad('0x14')][_0x75ad('0x16')]);}else{logger[_0x75ad('0x17')](_0x75ad('0xf'),_0x1a0d10,_0x75ad('0x12'));_0x48a4df(_0x433189[_0x75ad('0x18')]['message']);}})[_0x75ad('0x19')](function(_0x8226d5){logger[_0x75ad('0x14')](_0x75ad('0xf'),_0x1a0d10,_0x8226d5);_0x25720b(_0x8226d5);});});}
\ No newline at end of file
index 88498c7..fccd2c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5216=['save','update','emit','register','length','./chatWebsite.events'];(function(_0x3a8dc2,_0x41b945){var _0x71d73a=function(_0x31d7c2){while(--_0x31d7c2){_0x3a8dc2['push'](_0x3a8dc2['shift']());}};_0x71d73a(++_0x41b945);}(_0x5216,0xe9));var _0x6521=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5216[_0x2641f9];return _0x585741;};'use strict';var ChatWebsiteEvents=require(_0x6521('0x0'));var events=[_0x6521('0x1'),'remove',_0x6521('0x2')];function createListener(_0x37b700,_0x27782b){return function(_0xe14c5a){_0x27782b[_0x6521('0x3')](_0x37b700,_0xe14c5a);};}function removeListener(_0x4def23,_0x410c56){return function(){ChatWebsiteEvents['removeListener'](_0x4def23,_0x410c56);};}exports[_0x6521('0x4')]=function(_0x33fcb7){for(var _0x3bd251=0x0,_0x73b4e=events[_0x6521('0x5')];_0x3bd251<_0x73b4e;_0x3bd251++){var _0x10b570=events[_0x3bd251];var _0x4e50dd=createListener('chatWebsite:'+_0x10b570,_0x33fcb7);ChatWebsiteEvents['on'](_0x10b570,_0x4e50dd);}};
\ No newline at end of file
+var _0x1a75=['register','length','chatWebsite:','save','remove','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a75,0xb9));var _0x51a7=function(_0x1b5379,_0x41ce5b){_0x1b5379=_0x1b5379-0x0;var _0x77124e=_0x1a75[_0x1b5379];return _0x77124e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x51a7('0x0'),_0x51a7('0x1'),'update'];function createListener(_0x173f4e,_0x21c98a){return function(_0x2bb4e8){_0x21c98a[_0x51a7('0x2')](_0x173f4e,_0x2bb4e8);};}function removeListener(_0x2a6f68,_0x24c3a7){return function(){ChatWebsiteEvents[_0x51a7('0x3')](_0x2a6f68,_0x24c3a7);};}exports[_0x51a7('0x4')]=function(_0x1a653e){for(var _0x34a9b3=0x0,_0x27e6a3=events[_0x51a7('0x5')];_0x34a9b3<_0x27e6a3;_0x34a9b3++){var _0x20dcfb=events[_0x34a9b3];var _0x175912=createListener(_0x51a7('0x6')+_0x20dcfb,_0x1a653e);ChatWebsiteEvents['on'](_0x20dcfb,_0x175912);}};
\ No newline at end of file
index d5acf33..fef2e96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10c4=['describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','single','addLogo','server/files/images/avatars/','format','file','originalname','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','Router','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x10c4,0x151));var _0x410c=function(_0x3f599f,_0x35de4d){_0x3f599f=_0x3f599f-0x0;var _0x11ee81=_0x10c4[_0x3f599f];return _0x11ee81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x410c('0x0'));var timeout=require(_0x410c('0x1'));var express=require('express');var router=express[_0x410c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x410c('0x3'));var controller=require(_0x410c('0x4'));router[_0x410c('0x5')]('/',auth['isAuthenticated'](),controller[_0x410c('0x6')]);router[_0x410c('0x5')]('/describe',auth[_0x410c('0x7')](),controller[_0x410c('0x8')]);router['get']('/:id',auth[_0x410c('0x7')](),controller[_0x410c('0x9')]);router[_0x410c('0x5')](_0x410c('0xa'),auth[_0x410c('0x7')](),controller[_0x410c('0xb')]);router[_0x410c('0x5')](_0x410c('0xc'),auth[_0x410c('0x7')](),controller['getAnswers']);router[_0x410c('0x5')](_0x410c('0xd'),controller[_0x410c('0xe')]);router[_0x410c('0x5')](_0x410c('0xf'),controller['getAvatar']);router['get'](_0x410c('0x10'),controller[_0x410c('0x11')]);router[_0x410c('0x5')](_0x410c('0x12'),controller[_0x410c('0x13')]);router[_0x410c('0x5')](_0x410c('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x410c('0x15'),controller[_0x410c('0x16')]);router[_0x410c('0x5')](_0x410c('0x17'),auth[_0x410c('0x7')](),controller[_0x410c('0x18')]);router[_0x410c('0x5')]('/:id/proactive_actions',auth[_0x410c('0x7')](),controller[_0x410c('0x19')]);router[_0x410c('0x5')](_0x410c('0x1a'),controller[_0x410c('0x1b')]);router[_0x410c('0x5')](_0x410c('0x1c'),auth[_0x410c('0x7')](),controller[_0x410c('0x1d')]);router[_0x410c('0x5')](_0x410c('0x1e'),auth[_0x410c('0x7')](),controller[_0x410c('0x1f')]);router[_0x410c('0x20')]('/',auth[_0x410c('0x7')](),controller[_0x410c('0x21')]);router[_0x410c('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x410c('0x22')]);router[_0x410c('0x20')](_0x410c('0xc'),auth[_0x410c('0x7')](),controller[_0x410c('0x23')]);var upload=multer({'storage':multer[_0x410c('0x24')]({'destination':function(_0x41d0f3,_0xe65023,_0x36db0d){_0x36db0d(null,path[_0x410c('0x25')](config[_0x410c('0x26')],_0x410c('0x27')));},'filename':function(_0x126225,_0x7b893a,_0x4711f4){_0x4711f4(null,util['format'](_0x410c('0x28'),Date[_0x410c('0x29')](),_0x7b893a['originalname']));}})});router[_0x410c('0x20')](_0x410c('0xd'),upload[_0x410c('0x2a')]('file'),controller[_0x410c('0x2b')]);var upload=multer({'storage':multer[_0x410c('0x24')]({'destination':function(_0x1bd42e,_0x30dc59,_0x5cb5b7){_0x5cb5b7(null,path[_0x410c('0x25')](config[_0x410c('0x26')],_0x410c('0x2c')));},'filename':function(_0x4f9d60,_0x531d73,_0x4a081b){_0x4a081b(null,util[_0x410c('0x2d')]('%s-%s',Date['now'](),_0x531d73['originalname']));}})});router[_0x410c('0x20')](_0x410c('0xf'),upload['single'](_0x410c('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e244d,_0x2c3b68,_0x804df0){_0x804df0(null,path[_0x410c('0x25')](config[_0x410c('0x26')],_0x410c('0x2c')));},'filename':function(_0x3ac0f0,_0x4e32b3,_0x28e610){_0x28e610(null,util['format'](_0x410c('0x28'),Date['now'](),_0x4e32b3[_0x410c('0x2f')]));}})});router[_0x410c('0x20')](_0x410c('0x10'),upload[_0x410c('0x2a')](_0x410c('0x2e')),controller[_0x410c('0x30')]);var upload=multer({'storage':multer[_0x410c('0x24')]({'destination':function(_0x1b5de1,_0x37aae6,_0x529379){_0x529379(null,path[_0x410c('0x25')](config['root'],_0x410c('0x2c')));},'filename':function(_0x5815df,_0x1c1001,_0x383661){_0x383661(null,util[_0x410c('0x2d')](_0x410c('0x28'),Date[_0x410c('0x29')](),_0x1c1001[_0x410c('0x2f')]));}})});router[_0x410c('0x20')](_0x410c('0x12'),upload[_0x410c('0x2a')](_0x410c('0x2e')),controller[_0x410c('0x31')]);router[_0x410c('0x20')]('/:id/notify',controller[_0x410c('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x410c('0x24')]({'destination':function(_0x5c8854,_0x85f137,_0xad124d){const _0xcc5401=path[_0x410c('0x25')](config['root'],_0x410c('0x33'),_0x410c('0x34'),_0x410c('0x35'));fs_extra[_0x410c('0x36')](_0xcc5401,function(){_0xad124d(null,_0xcc5401);});},'filename':function(_0x3df899,_0x7e6e23,_0x208527){const _0x120097=_0x7e6e23[_0x410c('0x2f')][_0x410c('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2d17ae=path['extname'](_0x120097);const _0x9b3a45=Date[_0x410c('0x29')]()+'-'+_0x120097['replace'](_0x2d17ae,'')+_0x2d17ae;_0x208527(null,_0x9b3a45);}})});router[_0x410c('0x20')](_0x410c('0x38'),offlineUploadMulter[_0x410c('0x39')](),controller[_0x410c('0x3a')]);router[_0x410c('0x20')]('/:id/interactions',auth[_0x410c('0x7')](),controller['addInteraction']);router[_0x410c('0x20')](_0x410c('0x17'),auth[_0x410c('0x7')](),controller['addApplications']);router[_0x410c('0x20')](_0x410c('0x3b'),auth['isAuthenticated'](),controller[_0x410c('0x3c')]);router[_0x410c('0x20')](_0x410c('0x1e'),auth[_0x410c('0x7')](),controller[_0x410c('0x3d')]);router[_0x410c('0x3e')](_0x410c('0x3f'),auth['isAuthenticated'](),controller['update']);router[_0x410c('0x40')](_0x410c('0x3f'),auth[_0x410c('0x7')](),controller[_0x410c('0x41')]);router[_0x410c('0x40')](_0x410c('0xa'),auth[_0x410c('0x7')](),controller[_0x410c('0x42')]);router['delete'](_0x410c('0xc'),auth[_0x410c('0x7')](),controller[_0x410c('0x43')]);router['delete']('/:id/users',auth[_0x410c('0x7')](),controller[_0x410c('0x44')]);module['exports']=router;
\ No newline at end of file
+var _0xc0f0=['getSnippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getAgents','create','post','addDisposition','addAnswer','join','format','%s-%s','/:id/logo','single','addLogo','root','server/files/images/avatars/','now','originalname','file','diskStorage','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x48bfeb,_0x170426){var _0x5d085e=function(_0x24ae5b){while(--_0x24ae5b){_0x48bfeb['push'](_0x48bfeb['shift']());}};_0x5d085e(++_0x170426);}(_0xc0f0,0x18d));var _0x0c0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0f0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c0f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c0f('0x1'));var router=express[_0x0c0f('0x2')]();var fs_extra=require(_0x0c0f('0x3'));var auth=require(_0x0c0f('0x4'));var interaction=require(_0x0c0f('0x5'));var config=require('../../config/environment');var controller=require(_0x0c0f('0x6'));router[_0x0c0f('0x7')]('/',auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x9')]);router[_0x0c0f('0x7')](_0x0c0f('0xa'),auth['isAuthenticated'](),controller[_0x0c0f('0xb')]);router[_0x0c0f('0x7')](_0x0c0f('0xc'),auth[_0x0c0f('0x8')](),controller['show']);router[_0x0c0f('0x7')](_0x0c0f('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x0c0f('0xe'),auth['isAuthenticated'](),controller[_0x0c0f('0xf')]);router[_0x0c0f('0x7')]('/:id/logo',controller[_0x0c0f('0x10')]);router[_0x0c0f('0x7')](_0x0c0f('0x11'),controller['getAvatar']);router[_0x0c0f('0x7')]('/:id/customer_avatar',controller[_0x0c0f('0x12')]);router[_0x0c0f('0x7')](_0x0c0f('0x13'),controller['getSystemAvatar']);router[_0x0c0f('0x7')](_0x0c0f('0x14'),auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x15')]);router['get'](_0x0c0f('0x16'),controller[_0x0c0f('0x17')]);router[_0x0c0f('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0c0f('0x18')]);router['get'](_0x0c0f('0x19'),auth[_0x0c0f('0x8')](),controller['getProactiveActions']);router[_0x0c0f('0x7')](_0x0c0f('0x1a'),controller[_0x0c0f('0x1b')]);router['get'](_0x0c0f('0x1c'),auth[_0x0c0f('0x8')](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0c0f('0x1e')]);router[_0x0c0f('0x1f')](_0x0c0f('0xd'),auth['isAuthenticated'](),controller[_0x0c0f('0x20')]);router[_0x0c0f('0x1f')](_0x0c0f('0xe'),auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x158e26,_0x18d711,_0x57258a){_0x57258a(null,path[_0x0c0f('0x22')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2d8d58,_0x441678,_0x1934f2){_0x1934f2(null,util[_0x0c0f('0x23')](_0x0c0f('0x24'),Date['now'](),_0x441678['originalname']));}})});router[_0x0c0f('0x1f')](_0x0c0f('0x25'),upload[_0x0c0f('0x26')]('file'),controller[_0x0c0f('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3862b2,_0x531eec,_0x48f29f){_0x48f29f(null,path['join'](config[_0x0c0f('0x28')],_0x0c0f('0x29')));},'filename':function(_0x1651d5,_0x1cddad,_0x422e01){_0x422e01(null,util[_0x0c0f('0x23')](_0x0c0f('0x24'),Date[_0x0c0f('0x2a')](),_0x1cddad[_0x0c0f('0x2b')]));}})});router['post'](_0x0c0f('0x11'),upload[_0x0c0f('0x26')](_0x0c0f('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x0c0f('0x2d')]({'destination':function(_0x465527,_0x3fd710,_0x4dc041){_0x4dc041(null,path[_0x0c0f('0x22')](config['root'],_0x0c0f('0x29')));},'filename':function(_0x3101ea,_0x7e4e4b,_0x2db179){_0x2db179(null,util[_0x0c0f('0x23')](_0x0c0f('0x24'),Date[_0x0c0f('0x2a')](),_0x7e4e4b['originalname']));}})});router[_0x0c0f('0x1f')](_0x0c0f('0x2e'),upload[_0x0c0f('0x26')](_0x0c0f('0x2c')),controller[_0x0c0f('0x2f')]);var upload=multer({'storage':multer[_0x0c0f('0x2d')]({'destination':function(_0x3d4bb5,_0x4fe3ea,_0x1ef5c1){_0x1ef5c1(null,path[_0x0c0f('0x22')](config[_0x0c0f('0x28')],_0x0c0f('0x29')));},'filename':function(_0x134b30,_0x49aacf,_0xc60a20){_0xc60a20(null,util[_0x0c0f('0x23')](_0x0c0f('0x24'),Date[_0x0c0f('0x2a')](),_0x49aacf[_0x0c0f('0x2b')]));}})});router['post']('/:id/system_avatar',upload[_0x0c0f('0x26')](_0x0c0f('0x2c')),controller['addSystemAvatar']);router[_0x0c0f('0x1f')](_0x0c0f('0x30'),controller[_0x0c0f('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x0c0f('0x2d')]({'destination':function(_0x19c33b,_0x11a30b,_0x988cd5){const _0x22e1c1=path[_0x0c0f('0x22')](config[_0x0c0f('0x28')],'server/files',_0x0c0f('0x32'),_0x0c0f('0x33'));fs_extra[_0x0c0f('0x34')](_0x22e1c1,function(){_0x988cd5(null,_0x22e1c1);});},'filename':function(_0x2b5168,_0x51c4e0,_0x54d7e6){const _0x1037db=_0x51c4e0[_0x0c0f('0x2b')][_0x0c0f('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1300e7=path[_0x0c0f('0x36')](_0x1037db);const _0x11bb04=Date[_0x0c0f('0x2a')]()+'-'+_0x1037db[_0x0c0f('0x35')](_0x1300e7,'')+_0x1300e7;_0x54d7e6(null,_0x11bb04);}})});router['post'](_0x0c0f('0x37'),offlineUploadMulter[_0x0c0f('0x38')](),controller[_0x0c0f('0x39')]);router['post'](_0x0c0f('0x14'),auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x3a')]);router[_0x0c0f('0x1f')](_0x0c0f('0x3b'),auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x3c')]);router[_0x0c0f('0x1f')](_0x0c0f('0x19'),auth[_0x0c0f('0x8')](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x3d')]);router[_0x0c0f('0x3e')](_0x0c0f('0xc'),auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x3f')]);router[_0x0c0f('0x40')]('/:id',auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x41')]);router[_0x0c0f('0x40')](_0x0c0f('0xd'),auth['isAuthenticated'](),controller[_0x0c0f('0x42')]);router[_0x0c0f('0x40')](_0x0c0f('0xe'),auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x43')]);router[_0x0c0f('0x40')]('/:id/users',auth[_0x0c0f('0x8')](),controller[_0x0c0f('0x44')]);module[_0x0c0f('0x45')]=router;
\ No newline at end of file
index 57757a5..04cae1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c87=['isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','/client-logs','use'];(function(_0x4722a2,_0x4dbc04){var _0x61a7f2=function(_0x57d777){while(--_0x57d777){_0x4722a2['push'](_0x4722a2['shift']());}};_0x61a7f2(++_0x4dbc04);}(_0x4c87,0x16e));var _0x74c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4c87[_0x122ef9];return _0x42fba0;};var beaverLogger=require(_0x74c8('0x0'));var express=require(_0x74c8('0x1'));var auth=require(_0x74c8('0x2'));var config=require(_0x74c8('0x3'));var router=express[_0x74c8('0x4')]();var isProduction=config[_0x74c8('0x5')]===_0x74c8('0x6')||![];function clientSideLogs(_0x5c31ac,_0x1fda2e,_0x4dba1b){var _0x203788=_0x5c31ac[_0x74c8('0x7')][_0x74c8('0x8')](_0x74c8('0x9'));if(!_0x203788){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0x74c8('0xa'),'logger':_0x203788,'enableCors':!isProduction})(_0x5c31ac,_0x1fda2e,_0x4dba1b);}router[_0x74c8('0xb')](auth[_0x74c8('0xc')](),clientSideLogs);module[_0x74c8('0xd')]=router;
\ No newline at end of file
+var _0x238d=['express','env','production','get','Client-Side\x20logger\x20not\x20found!','use','exports','beaver-logger/server'];(function(_0x146ef3,_0x1c7bb0){var _0x5d9bae=function(_0x3b70f7){while(--_0x3b70f7){_0x146ef3['push'](_0x146ef3['shift']());}};_0x5d9bae(++_0x1c7bb0);}(_0x238d,0x97));var _0xd238=function(_0x1e3107,_0x37d1c2){_0x1e3107=_0x1e3107-0x0;var _0x58d4d4=_0x238d[_0x1e3107];return _0x58d4d4;};var beaverLogger=require(_0xd238('0x0'));var express=require(_0xd238('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xd238('0x2')]===_0xd238('0x3')||![];function clientSideLogs(_0x316fe3,_0x2332d1,_0x444d2d){var _0xbdab44=_0x316fe3['app'][_0xd238('0x4')]('client-side-logger');if(!_0xbdab44){throw new Error(_0xd238('0x5'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0xbdab44,'enableCors':!isProduction})(_0x316fe3,_0x2332d1,_0x444d2d);}router[_0xd238('0x6')](auth['isAuthenticated'](),clientSideLogs);module[_0xd238('0x7')]=router;
\ No newline at end of file
index 62c01fd..eb690fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e4a=['STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports'];(function(_0x32e7ce,_0x2a745a){var _0x5cbb80=function(_0x17b6e3){while(--_0x17b6e3){_0x32e7ce['push'](_0x32e7ce['shift']());}};_0x5cbb80(++_0x2a745a);}(_0x5e4a,0x67));var _0xa5e4=function(_0x7a97f3,_0x48b9eb){_0x7a97f3=_0x7a97f3-0x0;var _0x59ebfd=_0x5e4a[_0x7a97f3];return _0x59ebfd;};'use strict';var Sequelize=require('sequelize');module[_0xa5e4('0x0')]={'name':{'type':Sequelize[_0xa5e4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa5e4('0x2')](_0xa5e4('0x3'),_0xa5e4('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa5e4('0x2')](_0xa5e4('0x5'),_0xa5e4('0x6'))},'data1':{'type':Sequelize[_0xa5e4('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xa5e4('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xa5e4('0x1')],'comment':_0xa5e4('0x7')},'data4':{'type':Sequelize[_0xa5e4('0x1')],'comment':_0xa5e4('0x8')},'data5':{'type':Sequelize[_0xa5e4('0x9')],'comment':_0xa5e4('0xa')},'data6':{'type':Sequelize[_0xa5e4('0x9')],'comment':_0xa5e4('0xb')},'data7':{'type':Sequelize[_0xa5e4('0x9')],'comment':_0xa5e4('0xc')}};
\ No newline at end of file
+var _0xaeca=['AmazonAWS','Google','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','sequelize','exports','STRING'];(function(_0xc9fe08,_0x35ca3d){var _0x5c3adb=function(_0x46af9a){while(--_0x46af9a){_0xc9fe08['push'](_0xc9fe08['shift']());}};_0x5c3adb(++_0x35ca3d);}(_0xaeca,0x189));var _0xaaec=function(_0x3e5a76,_0x1e2316){_0x3e5a76=_0x3e5a76-0x0;var _0x2b9bc6=_0xaeca[_0x3e5a76];return _0x2b9bc6;};'use strict';var Sequelize=require(_0xaaec('0x0'));module[_0xaaec('0x1')]={'name':{'type':Sequelize[_0xaaec('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xaaec('0x3'),_0xaaec('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xaaec('0x5')]('Outlook365',_0xaaec('0x6'))},'data1':{'type':Sequelize[_0xaaec('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xaaec('0x2')],'comment':_0xaaec('0x7')},'data3':{'type':Sequelize[_0xaaec('0x2')],'comment':_0xaaec('0x8')},'data4':{'type':Sequelize[_0xaaec('0x2')],'comment':_0xaaec('0x9')},'data5':{'type':Sequelize[_0xaaec('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xaaec('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xaaec('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}};
\ No newline at end of file
index 24e3319..6a645ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1dfc=['then','error','name','send','padEnd','slice','index','CloudProvider','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','map','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0x1dfc,0xaa));var _0xc1df=function(_0x3c7988,_0x112ac3){_0x3c7988=_0x3c7988-0x0;var _0x416dda=_0x1dfc[_0x3c7988];return _0x416dda;};'use strict';var _=require(_0xc1df('0x0'));var Redis=require(_0xc1df('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xc1df('0x2'));var config=require(_0xc1df('0x3'));var logger=require(_0xc1df('0x4'))(_0xc1df('0x5'));var db=require(_0xc1df('0x6'))['db'];var oauth=require(_0xc1df('0x7'));config[_0xc1df('0x8')]=_[_0xc1df('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1df('0xa'))(new Redis(config[_0xc1df('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xf5b4d7,_0x7b6fb5){_0x7b6fb5=_0x7b6fb5||0xcc;return function(_0x2ae5e7){if(_0x2ae5e7){return _0xf5b4d7[_0xc1df('0xb')](_0x7b6fb5);}return _0xf5b4d7[_0xc1df('0xc')](_0x7b6fb5)[_0xc1df('0xd')]();};}function respondWithResult(_0x2e210a,_0xe0ff27){_0xe0ff27=_0xe0ff27||0xc8;return function(_0x30ba50){if(_0x30ba50){return _0x2e210a['status'](_0xe0ff27)[_0xc1df('0xe')](_0x30ba50);}};}function respondWithFilteredResult(_0x6e475a,_0x3bc4ed){return function(_0x13ee97){if(_0x13ee97){var _0x19b428=typeof _0x3bc4ed[_0xc1df('0xf')]==='undefined'&&typeof _0x3bc4ed[_0xc1df('0x10')]==='undefined';var _0x3692e5=_0x13ee97[_0xc1df('0x11')];var _0x1ecf1c=_0x19b428?0x0:_0x3bc4ed[_0xc1df('0xf')];var _0x5ad04d=_0x19b428?_0x13ee97['count']:_0x3bc4ed['offset']+_0x3bc4ed[_0xc1df('0x10')];var _0xaf758d;if(_0x5ad04d>=_0x3692e5){_0x5ad04d=_0x3692e5;_0xaf758d=0xc8;}else{_0xaf758d=0xce;}_0x6e475a['status'](_0xaf758d);return _0x6e475a[_0xc1df('0x12')](_0xc1df('0x13'),_0x1ecf1c+'-'+_0x5ad04d+'/'+_0x3692e5)['json'](_0x13ee97);}return null;};}function saveUpdates(_0x3ff4e0){return function(_0x2efde3){if(_0x2efde3){return _0x2efde3[_0xc1df('0x14')](_0x3ff4e0)['then'](function(_0x1e2481){return _0x1e2481;});}return null;};}function removeEntity(_0x286d41){return function(_0x108b5e){if(_0x108b5e){return _0x108b5e[_0xc1df('0x15')]()[_0xc1df('0x16')](function(){_0x286d41[_0xc1df('0xc')](0xcc)[_0xc1df('0xd')]();});}};}function handleEntityNotFound(_0x4f71b3){return function(_0x4be721){if(!_0x4be721){_0x4f71b3[_0xc1df('0xb')](0x194);}return _0x4be721;};}function handleError(_0x472df9,_0x751b27){_0x751b27=_0x751b27||0x1f4;return function(_0x2e1a8f){logger[_0xc1df('0x17')](_0x2e1a8f['stack']);if(_0x2e1a8f[_0xc1df('0x18')]){delete _0x2e1a8f[_0xc1df('0x18')];}_0x472df9['status'](_0x751b27)[_0xc1df('0x19')](_0x2e1a8f);};}function maskClientSecret(_0x30fedf){return _[_0xc1df('0x1a')](_0x30fedf[_0xc1df('0x1b')](0x0,0x3),0x14,'*');}exports[_0xc1df('0x1c')]=function(_0x289437,_0x380c40){var _0x5f2cdf={},_0x1c56bd={},_0x3535df={'count':0x0,'rows':[]};var _0x17ed0a=_['map'](db[_0xc1df('0x1d')]['rawAttributes'],function(_0x4fee0c){return{'name':_0x4fee0c[_0xc1df('0x1e')],'type':_0x4fee0c['type']['key']};});_0x1c56bd[_0xc1df('0x1f')]=_['map'](_0x17ed0a,_0xc1df('0x18'));_0x1c56bd['query']=_[_0xc1df('0x20')](_0x289437[_0xc1df('0x21')]);_0x1c56bd[_0xc1df('0x22')]=_[_0xc1df('0x23')](_0x1c56bd[_0xc1df('0x1f')],_0x1c56bd[_0xc1df('0x21')]);_0x5f2cdf[_0xc1df('0x24')]=_[_0xc1df('0x23')](_0x1c56bd[_0xc1df('0x1f')],qs[_0xc1df('0x25')](_0x289437[_0xc1df('0x21')][_0xc1df('0x25')]));_0x5f2cdf[_0xc1df('0x24')]=_0x5f2cdf[_0xc1df('0x24')][_0xc1df('0x26')]?_0x5f2cdf[_0xc1df('0x24')]:_0x1c56bd['model'];if(!_0x289437[_0xc1df('0x21')][_0xc1df('0x27')](_0xc1df('0x28'))){_0x5f2cdf[_0xc1df('0x10')]=qs[_0xc1df('0x10')](_0x289437['query']['limit']);_0x5f2cdf[_0xc1df('0xf')]=qs[_0xc1df('0xf')](_0x289437['query']['offset']);}_0x5f2cdf[_0xc1df('0x29')]=qs['sort'](_0x289437[_0xc1df('0x21')][_0xc1df('0x2a')]);_0x5f2cdf[_0xc1df('0x2b')]=qs[_0xc1df('0x22')](_[_0xc1df('0x2c')](_0x289437[_0xc1df('0x21')],_0x1c56bd[_0xc1df('0x22')]),_0x17ed0a);if(_0x289437['query']['filter']){_0x5f2cdf[_0xc1df('0x2b')]=_[_0xc1df('0x2d')](_0x5f2cdf[_0xc1df('0x2b')],{'$or':_['map'](_0x17ed0a,function(_0xdcb2c7){if(_0xdcb2c7[_0xc1df('0x2e')]!==_0xc1df('0x2f')){var _0x2040b5={};_0x2040b5[_0xdcb2c7['name']]={'$like':'%'+_0x289437[_0xc1df('0x21')][_0xc1df('0x30')]+'%'};return _0x2040b5;}})});}_0x5f2cdf=_[_0xc1df('0x2d')]({},_0x5f2cdf,_0x289437[_0xc1df('0x31')]);var _0x267434={'where':_0x5f2cdf[_0xc1df('0x2b')]};return db[_0xc1df('0x1d')][_0xc1df('0x11')](_0x267434)[_0xc1df('0x16')](function(_0x28fccc){_0x3535df[_0xc1df('0x11')]=_0x28fccc;if(_0x289437[_0xc1df('0x21')][_0xc1df('0x32')]){_0x5f2cdf[_0xc1df('0x33')]=[{'all':!![]}];}return db[_0xc1df('0x1d')][_0xc1df('0x34')](_0x5f2cdf);})['then'](function(_0x4cddb0){_0x3535df[_0xc1df('0x35')]=_[_0xc1df('0x36')](_0x4cddb0,function(_0x1f9be9){if(_0x1f9be9['service']===_0xc1df('0x37')){var _0x4474f6=encryptor[_0xc1df('0x38')](_0x1f9be9[_0xc1df('0x39')]);_0x1f9be9[_0xc1df('0x39')]=maskClientSecret(_0x4474f6);}return _0x1f9be9;});return _0x3535df;})['then'](respondWithFilteredResult(_0x380c40,_0x5f2cdf))[_0xc1df('0x3a')](handleError(_0x380c40,null));};exports[_0xc1df('0x3b')]=function(_0x28f3d6,_0x4e62e2){var _0x58143a={'raw':!![],'where':{'id':_0x28f3d6[_0xc1df('0x3c')]['id']}},_0x51c1ca={};_0x51c1ca[_0xc1df('0x1f')]=_[_0xc1df('0x20')](db[_0xc1df('0x1d')][_0xc1df('0x3d')]);_0x51c1ca[_0xc1df('0x21')]=_['keys'](_0x28f3d6[_0xc1df('0x21')]);_0x51c1ca[_0xc1df('0x22')]=_[_0xc1df('0x23')](_0x51c1ca[_0xc1df('0x1f')],_0x51c1ca[_0xc1df('0x21')]);_0x58143a[_0xc1df('0x24')]=_['intersection'](_0x51c1ca[_0xc1df('0x1f')],qs[_0xc1df('0x25')](_0x28f3d6[_0xc1df('0x21')]['fields']));_0x58143a[_0xc1df('0x24')]=_0x58143a[_0xc1df('0x24')][_0xc1df('0x26')]?_0x58143a[_0xc1df('0x24')]:_0x51c1ca[_0xc1df('0x1f')];if(_0x28f3d6[_0xc1df('0x21')]['includeAll']){_0x58143a[_0xc1df('0x33')]=[{'all':!![]}];}_0x58143a=_['merge']({},_0x58143a,_0x28f3d6[_0xc1df('0x31')]);return db[_0xc1df('0x1d')][_0xc1df('0x3e')](_0x58143a)['then'](handleEntityNotFound(_0x4e62e2,null))[_0xc1df('0x16')](function(_0x353a89){if(_0x353a89[_0xc1df('0x3f')]===_0xc1df('0x37')){var _0x26102e=encryptor[_0xc1df('0x38')](_0x353a89[_0xc1df('0x39')]);_0x353a89[_0xc1df('0x39')]=maskClientSecret(_0x26102e);}return _0x353a89;})[_0xc1df('0x16')](respondWithResult(_0x4e62e2,null))[_0xc1df('0x3a')](handleError(_0x4e62e2,null));};exports[_0xc1df('0x40')]=function(_0x2b619f,_0x5eb1df){if(!_0x2b619f[_0xc1df('0x41')][_0xc1df('0x18')])throw new Error(_0xc1df('0x42'));if(!_0x2b619f[_0xc1df('0x41')][_0xc1df('0x3f')])throw new Error(_0xc1df('0x43'));var _0x2503b2=db[_0xc1df('0x1d')]['rawAttributes'][_0xc1df('0x3f')]['values'];if(!_0x2503b2[_0xc1df('0x44')](_0x2b619f[_0xc1df('0x41')]['service']))throw new Error(_0xc1df('0x45')+_0x2503b2[_0xc1df('0x46')](',\x20'));if(_0x2b619f['body'][_0xc1df('0x3f')]===_0xc1df('0x37')&&_0x2b619f[_0xc1df('0x41')][_0xc1df('0x39')]){_0x2b619f['body']['data3']=encryptor['encryptString'](_0x2b619f[_0xc1df('0x41')][_0xc1df('0x39')]);}return db['CloudProvider'][_0xc1df('0x40')](_0x2b619f[_0xc1df('0x41')],{})[_0xc1df('0x16')](respondWithResult(_0x5eb1df,0xc9))[_0xc1df('0x3a')](handleError(_0x5eb1df,null));};exports[_0xc1df('0x14')]=function(_0x3c9158,_0x3cc334){if(_0x3c9158[_0xc1df('0x41')]['id']){delete _0x3c9158[_0xc1df('0x41')]['id'];}return db[_0xc1df('0x1d')][_0xc1df('0x3e')]({'where':{'id':_0x3c9158['params']['id']}})[_0xc1df('0x16')](handleEntityNotFound(_0x3cc334,null))[_0xc1df('0x16')](function(_0xc79a65){if(_0xc79a65['service']==='MicrosoftAzure'&&_0x3c9158['body']['data3']){_0x3c9158[_0xc1df('0x41')][_0xc1df('0x39')]=encryptor[_0xc1df('0x47')](_0x3c9158[_0xc1df('0x41')][_0xc1df('0x39')]);}return _0xc79a65;})['then'](saveUpdates(_0x3c9158['body'],null))[_0xc1df('0x16')](respondWithResult(_0x3cc334,null))[_0xc1df('0x3a')](handleError(_0x3cc334,null));};exports['destroy']=function(_0x2bad72,_0x3b9789){return db['CloudProvider'][_0xc1df('0x3e')]({'where':{'id':_0x2bad72['params']['id']}})[_0xc1df('0x16')](handleEntityNotFound(_0x3b9789,null))['then'](removeEntity(_0x3b9789,null))[_0xc1df('0x3a')](handleError(_0x3b9789,null));};exports[_0xc1df('0x48')]=function(_0xbfa9e6,_0x6dfd){return db[_0xc1df('0x1d')][_0xc1df('0x49')]({'where':{'id':_0xbfa9e6[_0xc1df('0x3c')]['id']},'raw':!![]})[_0xc1df('0x16')](function(_0x43c292){if(!_0x43c292)return _0x6dfd[_0xc1df('0xb')](0x194);return{'url':oauth[_0xc1df('0x4a')](_0x43c292,_0xbfa9e6[_0xc1df('0x4b')]['id'])};})[_0xc1df('0x16')](respondWithResult(_0x6dfd,null))['catch'](handleError(_0x6dfd,null));};exports[_0xc1df('0x4c')]=function(_0x408e9d,_0x274583){var _0x4e244c=_0x408e9d[_0xc1df('0x41')];var _0x43a4dc;var _0x35e827;if(_0x4e244c[_0xc1df('0x17')])throw _0x4e244c;redis[_0xc1df('0x4d')](_0x4e244c[_0xc1df('0x4e')])[_0xc1df('0x16')](function(_0xe0f36d){if(!_0xe0f36d)throw new Error('Invalid\x20state\x20parameter');_0x43a4dc=JSON[_0xc1df('0x4f')](_0xe0f36d);var _0x8edce7=Buffer['from'](_0x4e244c[_0xc1df('0x4e')],_0xc1df('0x50'))[_0xc1df('0x51')](_0xc1df('0x52'));_0x35e827=JSON[_0xc1df('0x4f')](_0x8edce7);if(!oauth[_0xc1df('0x53')](_0x4e244c[_0xc1df('0x54')],_0x43a4dc[_0xc1df('0x55')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x4e244c[_0xc1df('0x4e')]);return oauth[_0xc1df('0x56')](_0x4e244c[_0xc1df('0x57')],_0x43a4dc);})['then'](function(_0x461edc){_0x43a4dc[_0xc1df('0x58')]=_0x461edc['access_token'];_0x43a4dc[_0xc1df('0x59')]=_0x461edc[_0xc1df('0x5a')];return db[_0xc1df('0x1d')][_0xc1df('0x14')]({'data5':_0x43a4dc['data5'],'data6':_0x43a4dc[_0xc1df('0x59')]},{'where':{'id':_0x43a4dc['id']}});})['then'](function(){oauth[_0xc1df('0x5b')](_0x43a4dc);socket[_0xc1df('0x5c')](_0xc1df('0x5d'),{'id':_0x35e827['id']});return;})[_0xc1df('0x16')](respondWithStatusCode(_0x274583,null))[_0xc1df('0x3a')](function(_0x7957c7){if(_0x35e827){socket['emit']('microsoftAuthorization:error',{'id':_0x35e827['id']});}if(!_0x43a4dc){logger[_0xc1df('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x7957c7);return _0x274583[_0xc1df('0xc')](0x1f4)[_0xc1df('0x19')](_0x7957c7[_0xc1df('0x5e')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x43a4dc['id'],JSON[_0xc1df('0x5f')](_0x7957c7));});};
\ No newline at end of file
+var _0x6aa5=['encryptString','find','params','sendStatus','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data6','data5','microsoftAuthorization:success','emit','microsoftAuthorization:error','send','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','VIRTUAL','merge','options','CloudProvider','map','service','decryptString','data3','catch','show','includeAll','MicrosoftAzure','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join'];(function(_0x5f4886,_0x537a26){var _0x45003a=function(_0xa6022a){while(--_0xa6022a){_0x5f4886['push'](_0x5f4886['shift']());}};_0x45003a(++_0x537a26);}(_0x6aa5,0x1ca));var _0x56aa=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x6aa5[_0x13ed69];return _0x50c72e;};'use strict';var _=require('lodash');var Redis=require(_0x56aa('0x0'));var qs=require(_0x56aa('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x56aa('0x2'));var logger=require(_0x56aa('0x3'))(_0x56aa('0x4'));var db=require(_0x56aa('0x5'))['db'];var oauth=require(_0x56aa('0x6'));config[_0x56aa('0x7')]=_[_0x56aa('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56aa('0x7')]));var redis=new Redis(config[_0x56aa('0x7')]);function respondWithStatusCode(_0x182654,_0xd5a72e){_0xd5a72e=_0xd5a72e||0xcc;return function(_0x294d84){if(_0x294d84){return _0x182654['sendStatus'](_0xd5a72e);}return _0x182654[_0x56aa('0x9')](_0xd5a72e)[_0x56aa('0xa')]();};}function respondWithResult(_0x5e99ca,_0x4e9f60){_0x4e9f60=_0x4e9f60||0xc8;return function(_0x56ac5b){if(_0x56ac5b){return _0x5e99ca[_0x56aa('0x9')](_0x4e9f60)[_0x56aa('0xb')](_0x56ac5b);}};}function respondWithFilteredResult(_0x2dd9a0,_0x1cb82f){return function(_0x268d03){if(_0x268d03){var _0x1a8e8e=typeof _0x1cb82f[_0x56aa('0xc')]===_0x56aa('0xd')&&typeof _0x1cb82f['limit']===_0x56aa('0xd');var _0x156d1e=_0x268d03[_0x56aa('0xe')];var _0x4d370f=_0x1a8e8e?0x0:_0x1cb82f[_0x56aa('0xc')];var _0x24c496=_0x1a8e8e?_0x268d03[_0x56aa('0xe')]:_0x1cb82f['offset']+_0x1cb82f[_0x56aa('0xf')];var _0x413caf;if(_0x24c496>=_0x156d1e){_0x24c496=_0x156d1e;_0x413caf=0xc8;}else{_0x413caf=0xce;}_0x2dd9a0[_0x56aa('0x9')](_0x413caf);return _0x2dd9a0[_0x56aa('0x10')](_0x56aa('0x11'),_0x4d370f+'-'+_0x24c496+'/'+_0x156d1e)[_0x56aa('0xb')](_0x268d03);}return null;};}function saveUpdates(_0x55f1ec){return function(_0x2b11d8){if(_0x2b11d8){return _0x2b11d8[_0x56aa('0x12')](_0x55f1ec)[_0x56aa('0x13')](function(_0x564db1){return _0x564db1;});}return null;};}function removeEntity(_0x2796fc){return function(_0x43b1a7){if(_0x43b1a7){return _0x43b1a7[_0x56aa('0x14')]()[_0x56aa('0x13')](function(){_0x2796fc[_0x56aa('0x9')](0xcc)[_0x56aa('0xa')]();});}};}function handleEntityNotFound(_0x3a0f77){return function(_0x5154a7){if(!_0x5154a7){_0x3a0f77['sendStatus'](0x194);}return _0x5154a7;};}function handleError(_0x141c2b,_0x318d96){_0x318d96=_0x318d96||0x1f4;return function(_0x2e3f97){logger[_0x56aa('0x15')](_0x2e3f97[_0x56aa('0x16')]);if(_0x2e3f97[_0x56aa('0x17')]){delete _0x2e3f97[_0x56aa('0x17')];}_0x141c2b[_0x56aa('0x9')](_0x318d96)['send'](_0x2e3f97);};}function maskClientSecret(_0x5caf65){return _['padEnd'](_0x5caf65['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x2e0194,_0x3abc51){var _0x3c35cc={},_0x17e53a={},_0x5b96ec={'count':0x0,'rows':[]};var _0x4c5c2f=_['map'](db['CloudProvider'][_0x56aa('0x18')],function(_0x4bf647){return{'name':_0x4bf647[_0x56aa('0x19')],'type':_0x4bf647[_0x56aa('0x1a')][_0x56aa('0x1b')]};});_0x17e53a[_0x56aa('0x1c')]=_['map'](_0x4c5c2f,'name');_0x17e53a[_0x56aa('0x1d')]=_[_0x56aa('0x1e')](_0x2e0194[_0x56aa('0x1d')]);_0x17e53a[_0x56aa('0x1f')]=_[_0x56aa('0x20')](_0x17e53a[_0x56aa('0x1c')],_0x17e53a[_0x56aa('0x1d')]);_0x3c35cc['attributes']=_['intersection'](_0x17e53a[_0x56aa('0x1c')],qs[_0x56aa('0x21')](_0x2e0194['query'][_0x56aa('0x21')]));_0x3c35cc['attributes']=_0x3c35cc[_0x56aa('0x22')][_0x56aa('0x23')]?_0x3c35cc[_0x56aa('0x22')]:_0x17e53a[_0x56aa('0x1c')];if(!_0x2e0194[_0x56aa('0x1d')]['hasOwnProperty']('nolimit')){_0x3c35cc[_0x56aa('0xf')]=qs[_0x56aa('0xf')](_0x2e0194[_0x56aa('0x1d')][_0x56aa('0xf')]);_0x3c35cc[_0x56aa('0xc')]=qs[_0x56aa('0xc')](_0x2e0194['query'][_0x56aa('0xc')]);}_0x3c35cc[_0x56aa('0x24')]=qs[_0x56aa('0x25')](_0x2e0194[_0x56aa('0x1d')][_0x56aa('0x25')]);_0x3c35cc[_0x56aa('0x26')]=qs['filters'](_['pick'](_0x2e0194[_0x56aa('0x1d')],_0x17e53a['filters']),_0x4c5c2f);if(_0x2e0194['query']['filter']){_0x3c35cc['where']=_['merge'](_0x3c35cc[_0x56aa('0x26')],{'$or':_['map'](_0x4c5c2f,function(_0x152f18){if(_0x152f18['type']!==_0x56aa('0x27')){var _0x5e3688={};_0x5e3688[_0x152f18[_0x56aa('0x17')]]={'$like':'%'+_0x2e0194[_0x56aa('0x1d')]['filter']+'%'};return _0x5e3688;}})});}_0x3c35cc=_[_0x56aa('0x28')]({},_0x3c35cc,_0x2e0194[_0x56aa('0x29')]);var _0x24e5ff={'where':_0x3c35cc[_0x56aa('0x26')]};return db['CloudProvider'][_0x56aa('0xe')](_0x24e5ff)[_0x56aa('0x13')](function(_0x25cc01){_0x5b96ec['count']=_0x25cc01;if(_0x2e0194[_0x56aa('0x1d')]['includeAll']){_0x3c35cc['include']=[{'all':!![]}];}return db[_0x56aa('0x2a')]['findAll'](_0x3c35cc);})[_0x56aa('0x13')](function(_0x341efc){_0x5b96ec['rows']=_[_0x56aa('0x2b')](_0x341efc,function(_0x51f019){if(_0x51f019[_0x56aa('0x2c')]==='MicrosoftAzure'){var _0x29e9dc=encryptor[_0x56aa('0x2d')](_0x51f019[_0x56aa('0x2e')]);_0x51f019[_0x56aa('0x2e')]=maskClientSecret(_0x29e9dc);}return _0x51f019;});return _0x5b96ec;})[_0x56aa('0x13')](respondWithFilteredResult(_0x3abc51,_0x3c35cc))[_0x56aa('0x2f')](handleError(_0x3abc51,null));};exports[_0x56aa('0x30')]=function(_0xf1f761,_0x1145cc){var _0x5229cd={'raw':!![],'where':{'id':_0xf1f761['params']['id']}},_0x969ac6={};_0x969ac6['model']=_[_0x56aa('0x1e')](db['CloudProvider']['rawAttributes']);_0x969ac6[_0x56aa('0x1d')]=_[_0x56aa('0x1e')](_0xf1f761[_0x56aa('0x1d')]);_0x969ac6[_0x56aa('0x1f')]=_['intersection'](_0x969ac6[_0x56aa('0x1c')],_0x969ac6[_0x56aa('0x1d')]);_0x5229cd[_0x56aa('0x22')]=_[_0x56aa('0x20')](_0x969ac6[_0x56aa('0x1c')],qs[_0x56aa('0x21')](_0xf1f761['query'][_0x56aa('0x21')]));_0x5229cd[_0x56aa('0x22')]=_0x5229cd[_0x56aa('0x22')][_0x56aa('0x23')]?_0x5229cd[_0x56aa('0x22')]:_0x969ac6[_0x56aa('0x1c')];if(_0xf1f761[_0x56aa('0x1d')][_0x56aa('0x31')]){_0x5229cd['include']=[{'all':!![]}];}_0x5229cd=_['merge']({},_0x5229cd,_0xf1f761['options']);return db[_0x56aa('0x2a')]['find'](_0x5229cd)[_0x56aa('0x13')](handleEntityNotFound(_0x1145cc,null))[_0x56aa('0x13')](function(_0xa69d4b){if(_0xa69d4b[_0x56aa('0x2c')]===_0x56aa('0x32')){var _0xf4e66=encryptor[_0x56aa('0x2d')](_0xa69d4b[_0x56aa('0x2e')]);_0xa69d4b[_0x56aa('0x2e')]=maskClientSecret(_0xf4e66);}return _0xa69d4b;})['then'](respondWithResult(_0x1145cc,null))[_0x56aa('0x2f')](handleError(_0x1145cc,null));};exports['create']=function(_0x528044,_0x5629b9){if(!_0x528044[_0x56aa('0x33')][_0x56aa('0x17')])throw new Error(_0x56aa('0x34'));if(!_0x528044[_0x56aa('0x33')]['service'])throw new Error(_0x56aa('0x35'));var _0x4fb986=db[_0x56aa('0x2a')][_0x56aa('0x18')][_0x56aa('0x2c')][_0x56aa('0x36')];if(!_0x4fb986[_0x56aa('0x37')](_0x528044[_0x56aa('0x33')][_0x56aa('0x2c')]))throw new Error(_0x56aa('0x38')+_0x4fb986[_0x56aa('0x39')](',\x20'));if(_0x528044[_0x56aa('0x33')]['service']==='MicrosoftAzure'&&_0x528044[_0x56aa('0x33')][_0x56aa('0x2e')]){_0x528044['body'][_0x56aa('0x2e')]=encryptor[_0x56aa('0x3a')](_0x528044[_0x56aa('0x33')][_0x56aa('0x2e')]);}return db['CloudProvider']['create'](_0x528044['body'],{})[_0x56aa('0x13')](respondWithResult(_0x5629b9,0xc9))[_0x56aa('0x2f')](handleError(_0x5629b9,null));};exports[_0x56aa('0x12')]=function(_0x1c3d8f,_0x29fb20){if(_0x1c3d8f[_0x56aa('0x33')]['id']){delete _0x1c3d8f[_0x56aa('0x33')]['id'];}return db[_0x56aa('0x2a')][_0x56aa('0x3b')]({'where':{'id':_0x1c3d8f[_0x56aa('0x3c')]['id']}})[_0x56aa('0x13')](handleEntityNotFound(_0x29fb20,null))[_0x56aa('0x13')](function(_0x55aed6){if(_0x55aed6[_0x56aa('0x2c')]==='MicrosoftAzure'&&_0x1c3d8f[_0x56aa('0x33')][_0x56aa('0x2e')]){_0x1c3d8f[_0x56aa('0x33')][_0x56aa('0x2e')]=encryptor[_0x56aa('0x3a')](_0x1c3d8f[_0x56aa('0x33')][_0x56aa('0x2e')]);}return _0x55aed6;})[_0x56aa('0x13')](saveUpdates(_0x1c3d8f[_0x56aa('0x33')],null))[_0x56aa('0x13')](respondWithResult(_0x29fb20,null))[_0x56aa('0x2f')](handleError(_0x29fb20,null));};exports[_0x56aa('0x14')]=function(_0x69d737,_0x142762){return db[_0x56aa('0x2a')]['find']({'where':{'id':_0x69d737[_0x56aa('0x3c')]['id']}})[_0x56aa('0x13')](handleEntityNotFound(_0x142762,null))[_0x56aa('0x13')](removeEntity(_0x142762,null))['catch'](handleError(_0x142762,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4fa1e2,_0xd9bad){return db['CloudProvider']['findOne']({'where':{'id':_0x4fa1e2[_0x56aa('0x3c')]['id']},'raw':!![]})[_0x56aa('0x13')](function(_0x33322f){if(!_0x33322f)return _0xd9bad[_0x56aa('0x3d')](0x194);return{'url':oauth[_0x56aa('0x3e')](_0x33322f,_0x4fa1e2[_0x56aa('0x3f')]['id'])};})['then'](respondWithResult(_0xd9bad,null))['catch'](handleError(_0xd9bad,null));};exports[_0x56aa('0x40')]=function(_0x396b60,_0x469784){var _0x5640a8=_0x396b60[_0x56aa('0x33')];var _0x20c04a;var _0x498763;if(_0x5640a8[_0x56aa('0x15')])throw _0x5640a8;redis[_0x56aa('0x41')](_0x5640a8[_0x56aa('0x42')])['then'](function(_0x56cf99){if(!_0x56cf99)throw new Error(_0x56aa('0x43'));_0x20c04a=JSON[_0x56aa('0x44')](_0x56cf99);var _0xf78896=Buffer[_0x56aa('0x45')](_0x5640a8[_0x56aa('0x42')],_0x56aa('0x46'))['toString'](_0x56aa('0x47'));_0x498763=JSON[_0x56aa('0x44')](_0xf78896);if(!oauth[_0x56aa('0x48')](_0x5640a8[_0x56aa('0x49')],_0x20c04a[_0x56aa('0x4a')]))throw new Error(_0x56aa('0x4b'));redis[_0x56aa('0x4c')](_0x5640a8[_0x56aa('0x42')]);return oauth[_0x56aa('0x4d')](_0x5640a8[_0x56aa('0x4e')],_0x20c04a);})[_0x56aa('0x13')](function(_0x16880d){_0x20c04a['data5']=_0x16880d['access_token'];_0x20c04a[_0x56aa('0x4f')]=_0x16880d['refresh_token'];return db[_0x56aa('0x2a')][_0x56aa('0x12')]({'data5':_0x20c04a[_0x56aa('0x50')],'data6':_0x20c04a[_0x56aa('0x4f')]},{'where':{'id':_0x20c04a['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x20c04a);socket['emit'](_0x56aa('0x51'),{'id':_0x498763['id']});return;})['then'](respondWithStatusCode(_0x469784,null))[_0x56aa('0x2f')](function(_0x28081b){if(_0x498763){socket[_0x56aa('0x52')](_0x56aa('0x53'),{'id':_0x498763['id']});}if(!_0x20c04a){logger[_0x56aa('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0x28081b);return _0x469784['status'](0x1f4)[_0x56aa('0x54')](_0x28081b['message']);}logger[_0x56aa('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x20c04a['id'],JSON[_0x56aa('0x55')](_0x28081b));});};
\ No newline at end of file
index 53c8626..30109ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x139b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util'];(function(_0x4633ee,_0xc061fe){var _0x5c5ac0=function(_0x29ef60){while(--_0x29ef60){_0x4633ee['push'](_0x4633ee['shift']());}};_0x5c5ac0(++_0xc061fe);}(_0x139b,0x1b8));var _0xb139=function(_0x117be9,_0x2fa72e){_0x117be9=_0x117be9-0x0;var _0xc43448=_0x139b[_0x117be9];return _0xc43448;};'use strict';var _=require(_0xb139('0x0'));var util=require(_0xb139('0x1'));var logger=require(_0xb139('0x2'))(_0xb139('0x3'));var moment=require(_0xb139('0x4'));var BPromise=require(_0xb139('0x5'));var rp=require(_0xb139('0x6'));var fs=require('fs');var path=require(_0xb139('0x7'));var rimraf=require('rimraf');var config=require(_0xb139('0x8'));var attributes=require(_0xb139('0x9'));module[_0xb139('0xa')]=function(_0x466c55,_0x54ba65){return _0x466c55['define'](_0xb139('0xb'),attributes,{'tableName':_0xb139('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x92f3=['CloudProvider','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x1b9573,_0x5ba074){var _0x3ed329=function(_0x1bdf3f){while(--_0x1bdf3f){_0x1b9573['push'](_0x1b9573['shift']());}};_0x3ed329(++_0x5ba074);}(_0x92f3,0x16d));var _0x392f=function(_0x59f708,_0x141192){_0x59f708=_0x59f708-0x0;var _0x1d5133=_0x92f3[_0x59f708];return _0x1d5133;};'use strict';var _=require(_0x392f('0x0'));var util=require('util');var logger=require(_0x392f('0x1'))(_0x392f('0x2'));var moment=require(_0x392f('0x3'));var BPromise=require(_0x392f('0x4'));var rp=require(_0x392f('0x5'));var fs=require('fs');var path=require(_0x392f('0x6'));var rimraf=require(_0x392f('0x7'));var config=require(_0x392f('0x8'));var attributes=require(_0x392f('0x9'));module[_0x392f('0xa')]=function(_0xa6b466,_0x2630ab){return _0xa6b466[_0x392f('0xb')](_0x392f('0xc'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5067370..b6f1c82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3765=['oauth2/','set','payload','issuer','aud','audience','nonce','isAfter','exp','resolve','then','data3','CloudProvider','findOne','decryptString','POST','replace','data5','data6','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data1','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','Outlook365','{TENANT_ID}','data2','from','stringify','base64','randomBytes','toString','hex','client_id','response_type','join','data4','response_mode','scope','login','value','oauth2Claims'];(function(_0x4f89fa,_0x39546d){var _0x338542=function(_0x4cfe9d){while(--_0x4cfe9d){_0x4f89fa['push'](_0x4f89fa['shift']());}};_0x338542(++_0x39546d);}(_0x3765,0x68));var _0x5376=function(_0x2f8428,_0x5d9cea){_0x2f8428=_0x2f8428-0x0;var _0x55aa96=_0x3765[_0x2f8428];return _0x55aa96;};'use strict';var _=require(_0x5376('0x0'));var crypto=require(_0x5376('0x1'));var jwt=require(_0x5376('0x2'));var moment=require('moment');var Redis=require(_0x5376('0x3'));var rp=require(_0x5376('0x4'));var util=require(_0x5376('0x5'));var encryptor=require(_0x5376('0x6'));var config=require('../../config/environment');var logger=require(_0x5376('0x7'))(_0x5376('0x8'));var schedule=require(_0x5376('0x9'));var db=require(_0x5376('0xa'))['db'];config[_0x5376('0xb')]=_['defaults'](config[_0x5376('0xb')],{'host':_0x5376('0xc'),'port':0x18eb});var redis=new Redis(config[_0x5376('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x5376('0xd'),'profile',_0x5376('0xe'),'offline_access',_0x5376('0xf'),'https://outlook.office.com/POP.AccessAsUser.All',_0x5376('0x10')],'Dynamics365':[_0x5376('0xd'),_0x5376('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x5376('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x5376('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xd31528){var _0x441c32=_[_0x5376('0x14')](AZURE_AUTH_SCOPES[_0xd31528[_0x5376('0x15')]]);if(_0xd31528[_0x5376('0x15')]===_0x5376('0x16'))_0x441c32[_0x5376('0x17')](_0xd31528[_0x5376('0x18')]+_0x5376('0x19'));return _0x441c32['join']('\x20');}function getAccessTokenScope(_0x1c97d7){if(_0x1c97d7['type']===_0x5376('0x1a'))return _0x5376('0xf');if(_0x1c97d7[_0x5376('0x15')]===_0x5376('0x16'))return _0x1c97d7['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x576607,_0x35e6aa){var _0x594b31=MICROSOFT_AUTH_URL['replace'](_0x5376('0x1b'),_0x576607[_0x5376('0x1c')]);var _0xf230c5=['code','id_token'];var _0x50bb7e=Buffer[_0x5376('0x1d')](JSON[_0x5376('0x1e')]({'id':_0x35e6aa}))['toString'](_0x5376('0x1f'));var _0x230d1f=crypto[_0x5376('0x20')](0x10)[_0x5376('0x21')](_0x5376('0x22'));var _0x22c3a4=getAuthorizationScopes(_0x576607);var _0x2202ad=[{'key':_0x5376('0x23'),'value':_0x576607['data1']},{'key':_0x5376('0x24'),'value':encodeURIComponent(_0xf230c5[_0x5376('0x25')]('\x20'))},{'key':'redirect_uri','value':_0x576607[_0x5376('0x26')]},{'key':_0x5376('0x27'),'value':'form_post'},{'key':_0x5376('0x28'),'value':encodeURIComponent(_0x22c3a4)},{'key':'state','value':_0x50bb7e},{'key':'nonce','value':_0x230d1f},{'key':'prompt','value':_0x5376('0x29')}];var _0x2652fb=_0x594b31+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2202ad,function(_0x5b08e5){return _0x5b08e5['key']+'='+_0x5b08e5[_0x5376('0x2a')];})[_0x5376('0x25')]('&');_0x576607[_0x5376('0x2b')]={'issuer':_0x594b31['replace'](_0x5376('0x2c'),''),'audience':_0x576607['data1'],'state':_0x50bb7e,'nonce':_0x230d1f};redis[_0x5376('0x2d')](_0x50bb7e,JSON[_0x5376('0x1e')](_0x576607));return _0x2652fb;}function isValidIdToken(_0x17551b,_0x346f49){try{var _0xa6206b=jwt['decode'](_0x17551b,{'complete':!![]});var _0x554f8b=_0xa6206b[_0x5376('0x2e')];if(_0x554f8b['iss']!==_0x346f49[_0x5376('0x2f')])return![];if(_0x554f8b[_0x5376('0x30')]!==_0x346f49[_0x5376('0x31')])return![];if(_0x554f8b[_0x5376('0x32')]!==_0x346f49[_0x5376('0x32')])return![];if(moment()[_0x5376('0x33')](moment['unix'](_0x554f8b[_0x5376('0x34')])))return![];return!![];}catch(_0xb7396a){throw _0xb7396a;}}function refreshOauth2MicrosoftAccessToken(_0x2d53ef){return Promise[_0x5376('0x35')]()[_0x5376('0x36')](function(){if(_0x2d53ef[_0x5376('0x37')])return _0x2d53ef;return db[_0x5376('0x38')][_0x5376('0x39')]({'where':{'id':_0x2d53ef['id']},'raw':!![]});})[_0x5376('0x36')](function(_0x58b6e6){var _0x28df49={'grant_type':'refresh_token','refresh_token':_0x58b6e6['data6'],'scope':getAccessTokenScope(_0x58b6e6),'redirect_uri':_0x58b6e6[_0x5376('0x26')],'client_id':_0x58b6e6['data1'],'client_secret':encryptor[_0x5376('0x3a')](_0x58b6e6[_0x5376('0x37')])};var _0x1ac8d6={'method':_0x5376('0x3b'),'uri':MICROSOFT_AUTH_URL[_0x5376('0x3c')](_0x5376('0x1b'),_0x58b6e6['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28df49,'json':!![]};return rp(_0x1ac8d6);})[_0x5376('0x36')](function(_0xb6e2f7){_0x2d53ef[_0x5376('0x3d')]=_0xb6e2f7['access_token'];_0x2d53ef[_0x5376('0x3e')]=_0xb6e2f7['refresh_token'];return db[_0x5376('0x38')]['update']({'data5':_0x2d53ef[_0x5376('0x3d')],'data6':_0x2d53ef[_0x5376('0x3e')]},{'where':{'id':_0x2d53ef['id']}});})[_0x5376('0x36')](function(){return _0x2d53ef;})[_0x5376('0x3f')](function(_0x1f38a8){logger['error'](_0x5376('0x40'),_0x2d53ef['id'],_0x1f38a8);});}function getOauth2MicrosoftAccessToken(_0x2f843a,_0x248a47){var _0x2c0070={'grant_type':_0x5376('0x41'),'code':_0x2f843a,'scope':getAccessTokenScope(_0x248a47),'redirect_uri':_0x248a47[_0x5376('0x26')],'client_id':_0x248a47[_0x5376('0x42')],'client_secret':encryptor['decryptString'](_0x248a47[_0x5376('0x37')])};var _0x54d5c6={'method':_0x5376('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0x5376('0x1b'),_0x248a47[_0x5376('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2c0070,'json':!![]};return rp(_0x54d5c6);}function startRefreshInterval(_0xf45866){var _0x3291c2=schedule[_0x5376('0x43')];if(_0x3291c2[_0xf45866['id']])clearInterval(_0x3291c2[_0xf45866['id']]);_0x3291c2[_0xf45866['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5376('0x44')](this,{'id':_0xf45866['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3291c2;}function startAllRefreshIntervals(){return db[_0x5376('0x38')][_0x5376('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5376('0x36')](function(_0x528b8a){var _0x455c1c=_0x528b8a[_0x5376('0x14')](function(_0x255274){return refreshOauth2MicrosoftAccessToken(_0x255274)[_0x5376('0x36')](function(_0x2dbe6e){startRefreshInterval(_0x2dbe6e);});});return Promise[_0x5376('0x46')](_0x455c1c);})[_0x5376('0x3f')](function(_0xd0e589){var _0x52b8d4=_0xd0e589?util[_0x5376('0x47')](_0xd0e589,{'showHidden':![],'depth':null}):'';logger['error'](_0x5376('0x48'),_0x52b8d4);});}module[_0x5376('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
+var _0x5e2b=['email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','map','type','Dynamics365','push','join','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','randomBytes','hex','client_id','response_type','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','data1','set','decode','payload','aud','isAfter','resolve','then','data3','CloudProvider','findOne','data6','decryptString','POST','data5','access_token','refresh_token','update','catch','error','authorization_code','intervals','bind','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/logger','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile'];(function(_0xc01168,_0x305562){var _0x3015d2=function(_0x238cfd){while(--_0x238cfd){_0xc01168['push'](_0xc01168['shift']());}};_0x3015d2(++_0x305562);}(_0x5e2b,0x1bb));var _0xb5e2=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x5e2b[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xb5e2('0x0'));var crypto=require('crypto');var jwt=require(_0xb5e2('0x1'));var moment=require(_0xb5e2('0x2'));var Redis=require('ioredis');var rp=require(_0xb5e2('0x3'));var util=require(_0xb5e2('0x4'));var encryptor=require(_0xb5e2('0x5'));var config=require('../../config/environment');var logger=require(_0xb5e2('0x6'))('api');var schedule=require(_0xb5e2('0x7'));var db=require('../../mysqldb')['db'];config[_0xb5e2('0x8')]=_[_0xb5e2('0x9')](config[_0xb5e2('0x8')],{'host':_0xb5e2('0xa'),'port':0x18eb});var redis=new Redis(config[_0xb5e2('0x8')]);var MICROSOFT_AUTH_URL=_0xb5e2('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb5e2('0xc'),_0xb5e2('0xd'),_0xb5e2('0xe'),_0xb5e2('0xf'),_0xb5e2('0x10'),_0xb5e2('0x11')],'Dynamics365':[_0xb5e2('0x12'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x496105){var _0x4fa7d8=_[_0xb5e2('0x13')](AZURE_AUTH_SCOPES[_0x496105[_0xb5e2('0x14')]]);if(_0x496105[_0xb5e2('0x14')]===_0xb5e2('0x15'))_0x4fa7d8[_0xb5e2('0x16')](_0x496105['data7']+'/.default');return _0x4fa7d8[_0xb5e2('0x17')]('\x20');}function getAccessTokenScope(_0x4fb4df){if(_0x4fb4df[_0xb5e2('0x14')]==='Outlook365')return _0xb5e2('0xf');if(_0x4fb4df[_0xb5e2('0x14')]===_0xb5e2('0x15'))return _0x4fb4df[_0xb5e2('0x18')]+_0xb5e2('0x19');}function generateMicrosoftAuthorizationUrl(_0x3b7907,_0x5317dd){var _0x54772b=MICROSOFT_AUTH_URL[_0xb5e2('0x1a')](_0xb5e2('0x1b'),_0x3b7907[_0xb5e2('0x1c')]);var _0x44abf9=[_0xb5e2('0x1d'),_0xb5e2('0x1e')];var _0x500a5a=Buffer[_0xb5e2('0x1f')](JSON[_0xb5e2('0x20')]({'id':_0x5317dd}))[_0xb5e2('0x21')]('base64');var _0x527b5b=crypto[_0xb5e2('0x22')](0x10)[_0xb5e2('0x21')](_0xb5e2('0x23'));var _0x8d7939=getAuthorizationScopes(_0x3b7907);var _0x24af8f=[{'key':_0xb5e2('0x24'),'value':_0x3b7907['data1']},{'key':_0xb5e2('0x25'),'value':encodeURIComponent(_0x44abf9[_0xb5e2('0x17')]('\x20'))},{'key':'redirect_uri','value':_0x3b7907[_0xb5e2('0x26')]},{'key':_0xb5e2('0x27'),'value':_0xb5e2('0x28')},{'key':'scope','value':encodeURIComponent(_0x8d7939)},{'key':_0xb5e2('0x29'),'value':_0x500a5a},{'key':_0xb5e2('0x2a'),'value':_0x527b5b},{'key':_0xb5e2('0x2b'),'value':_0xb5e2('0x2c')}];var _0x79e6ac=_0x54772b+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb5e2('0x13')](_0x24af8f,function(_0x271b6f){return _0x271b6f[_0xb5e2('0x2d')]+'='+_0x271b6f[_0xb5e2('0x2e')];})[_0xb5e2('0x17')]('&');_0x3b7907[_0xb5e2('0x2f')]={'issuer':_0x54772b['replace'](_0xb5e2('0x30'),''),'audience':_0x3b7907[_0xb5e2('0x31')],'state':_0x500a5a,'nonce':_0x527b5b};redis[_0xb5e2('0x32')](_0x500a5a,JSON['stringify'](_0x3b7907));return _0x79e6ac;}function isValidIdToken(_0x230eb8,_0x1c9866){try{var _0x2651c4=jwt[_0xb5e2('0x33')](_0x230eb8,{'complete':!![]});var _0x293101=_0x2651c4[_0xb5e2('0x34')];if(_0x293101['iss']!==_0x1c9866['issuer'])return![];if(_0x293101[_0xb5e2('0x35')]!==_0x1c9866['audience'])return![];if(_0x293101[_0xb5e2('0x2a')]!==_0x1c9866[_0xb5e2('0x2a')])return![];if(moment()[_0xb5e2('0x36')](moment['unix'](_0x293101['exp'])))return![];return!![];}catch(_0x3a5c6d){throw _0x3a5c6d;}}function refreshOauth2MicrosoftAccessToken(_0x3cc3a8){return Promise[_0xb5e2('0x37')]()[_0xb5e2('0x38')](function(){if(_0x3cc3a8[_0xb5e2('0x39')])return _0x3cc3a8;return db[_0xb5e2('0x3a')][_0xb5e2('0x3b')]({'where':{'id':_0x3cc3a8['id']},'raw':!![]});})[_0xb5e2('0x38')](function(_0x5b41b1){var _0x47fbf5={'grant_type':'refresh_token','refresh_token':_0x5b41b1[_0xb5e2('0x3c')],'scope':getAccessTokenScope(_0x5b41b1),'redirect_uri':_0x5b41b1[_0xb5e2('0x26')],'client_id':_0x5b41b1[_0xb5e2('0x31')],'client_secret':encryptor[_0xb5e2('0x3d')](_0x5b41b1[_0xb5e2('0x39')])};var _0xc57b58={'method':_0xb5e2('0x3e'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x5b41b1[_0xb5e2('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x47fbf5,'json':!![]};return rp(_0xc57b58);})[_0xb5e2('0x38')](function(_0x2440ea){_0x3cc3a8[_0xb5e2('0x3f')]=_0x2440ea[_0xb5e2('0x40')];_0x3cc3a8[_0xb5e2('0x3c')]=_0x2440ea[_0xb5e2('0x41')];return db[_0xb5e2('0x3a')][_0xb5e2('0x42')]({'data5':_0x3cc3a8[_0xb5e2('0x3f')],'data6':_0x3cc3a8[_0xb5e2('0x3c')]},{'where':{'id':_0x3cc3a8['id']}});})[_0xb5e2('0x38')](function(){return _0x3cc3a8;})[_0xb5e2('0x43')](function(_0x36124b){logger[_0xb5e2('0x44')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x3cc3a8['id'],_0x36124b);});}function getOauth2MicrosoftAccessToken(_0x5f2cfb,_0x10e436){var _0x4c560e={'grant_type':_0xb5e2('0x45'),'code':_0x5f2cfb,'scope':getAccessTokenScope(_0x10e436),'redirect_uri':_0x10e436[_0xb5e2('0x26')],'client_id':_0x10e436['data1'],'client_secret':encryptor[_0xb5e2('0x3d')](_0x10e436[_0xb5e2('0x39')])};var _0xc9f285={'method':_0xb5e2('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xb5e2('0x1a')](_0xb5e2('0x1b'),_0x10e436[_0xb5e2('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4c560e,'json':!![]};return rp(_0xc9f285);}function startRefreshInterval(_0x286cf7){var _0x469c09=schedule[_0xb5e2('0x46')];if(_0x469c09[_0x286cf7['id']])clearInterval(_0x469c09[_0x286cf7['id']]);_0x469c09[_0x286cf7['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb5e2('0x47')](this,{'id':_0x286cf7['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb5e2('0x46')]=_0x469c09;}function startAllRefreshIntervals(){return db[_0xb5e2('0x3a')][_0xb5e2('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb5e2('0x38')](function(_0x1bbb02){var _0x26c2cf=_0x1bbb02[_0xb5e2('0x13')](function(_0x59366a){return refreshOauth2MicrosoftAccessToken(_0x59366a)['then'](function(_0x47c3a3){startRefreshInterval(_0x47c3a3);});});return Promise['all'](_0x26c2cf);})[_0xb5e2('0x43')](function(_0x28565e){var _0x1a2310=_0x28565e?util[_0xb5e2('0x49')](_0x28565e,{'showHidden':![],'depth':null}):'';logger['error'](_0xb5e2('0x4a'),_0x1a2310);});}module[_0xb5e2('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
index e3d092d..cbf29dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x404d=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x52fe17,_0x2af32a){var _0x5af586=function(_0x35721a){while(--_0x35721a){_0x52fe17['push'](_0x52fe17['shift']());}};_0x5af586(++_0x2af32a);}(_0x404d,0x1e9));var _0xd404=function(_0x18fbb8,_0x4c6ce8){_0x18fbb8=_0x18fbb8-0x0;var _0x14e1e8=_0x404d[_0x18fbb8];return _0x14e1e8;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require(_0xd404('0x2'));var BPromise=require(_0xd404('0x3'));var rs=require(_0xd404('0x4'));var fs=require('fs');var Redis=require(_0xd404('0x5'));var db=require(_0xd404('0x6'))['db'];var utils=require(_0xd404('0x7'));var logger=require(_0xd404('0x8'))('rpc');var config=require(_0xd404('0x9'));var jayson=require(_0xd404('0xa'));var client=jayson['client'][_0xd404('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7faf39,_0x5da99f,_0x5c335f){return new BPromise(function(_0x10021a,_0x3d7e8a){return client['request'](_0x7faf39,_0x5c335f)['then'](function(_0x3096f0){logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5da99f,_0xd404('0xe'),JSON[_0xd404('0xf')](_0x3096f0));if(_0x3096f0['error']){if(_0x3096f0[_0xd404('0x10')][_0xd404('0x11')]===0x1f4){logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x3d7e8a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x10021a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}else{logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));_0x10021a(_0x3096f0[_0xd404('0x13')][_0xd404('0x12')]);}})[_0xd404('0x14')](function(_0x155186){logger['error'](_0xd404('0xd'),_0x5da99f,_0x155186);_0x3d7e8a(_0x155186);});});}
\ No newline at end of file
+var _0xa413=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','info'];(function(_0x402b1f,_0x3df329){var _0x5d22f2=function(_0x5f17c3){while(--_0x5f17c3){_0x402b1f['push'](_0x402b1f['shift']());}};_0x5d22f2(++_0x3df329);}(_0xa413,0x1e5));var _0x3a41=function(_0x365e84,_0x44654b){_0x365e84=_0x365e84-0x0;var _0x3918a9=_0xa413[_0x365e84];return _0x3918a9;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f6d2,_0x407d52,_0xca7253){return new BPromise(function(_0x473cd2,_0x27c2e5){return client['request'](_0x45f6d2,_0xca7253)[_0x3a41('0xa')](function(_0x570304){logger['info']('CloudProvider,\x20%s,\x20%s',_0x407d52,_0x3a41('0xb'));logger['debug'](_0x3a41('0xc'),_0x407d52,'request\x20sent',JSON[_0x3a41('0xd')](_0x570304));if(_0x570304[_0x3a41('0xe')]){if(_0x570304['error'][_0x3a41('0xf')]===0x1f4){logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x27c2e5(_0x570304['error'][_0x3a41('0x11')]);}logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x473cd2(_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);}else{logger[_0x3a41('0x12')](_0x3a41('0x10'),_0x407d52,_0x3a41('0xb'));_0x473cd2(_0x570304[_0x3a41('0x13')]['message']);}})[_0x3a41('0x14')](function(_0x30d675){logger['error']('CloudProvider,\x20%s,\x20%s',_0x407d52,_0x30d675);_0x27c2e5(_0x30d675);});});}
\ No newline at end of file
index 0bd1bd9..4424bfb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x7a54,0x106));var _0x47a5=function(_0x5d6ec8,_0x4fbbab){_0x5d6ec8=_0x5d6ec8-0x0;var _0x1438b3=_0x7a54[_0x5d6ec8];return _0x1438b3;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router;
\ No newline at end of file
+var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x22667a,_0x5cee40){var _0x187033=function(_0x2b1dc7){while(--_0x2b1dc7){_0x22667a['push'](_0x22667a['shift']());}};_0x187033(++_0x5cee40);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router;
\ No newline at end of file
index acb5079..cb56700 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa831=['sequelize','exports','STRING','name'];(function(_0x717974,_0x24b354){var _0x4b38fa=function(_0x32f842){while(--_0x32f842){_0x717974['push'](_0x717974['shift']());}};_0x4b38fa(++_0x24b354);}(_0xa831,0xbc));var _0x1a83=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xa831[_0x2e0443];return _0x52d450;};'use strict';var Sequelize=require(_0x1a83('0x0'));module[_0x1a83('0x1')]={'name':{'type':Sequelize[_0x1a83('0x2')],'unique':_0x1a83('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1a83('0x2')]},'companyId':{'type':Sequelize[_0x1a83('0x2')]},'website':{'type':Sequelize[_0x1a83('0x2')]},'phone':{'type':Sequelize[_0x1a83('0x2')]},'fax':{'type':Sequelize[_0x1a83('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1a83('0x2')]},'email':{'type':Sequelize[_0x1a83('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1a83('0x2')]},'sStreet':{'type':Sequelize[_0x1a83('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1a83('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a83('0x2')]}};
\ No newline at end of file
+var _0xe35a=['STRING','name','sequelize','exports'];(function(_0x353371,_0x1d2cc9){var _0x4cbce5=function(_0x48100f){while(--_0x48100f){_0x353371['push'](_0x353371['shift']());}};_0x4cbce5(++_0x1d2cc9);}(_0xe35a,0x1a6));var _0xae35=function(_0x1e6e39,_0x3c98ed){_0x1e6e39=_0x1e6e39-0x0;var _0x2d9029=_0xe35a[_0x1e6e39];return _0x2d9029;};'use strict';var Sequelize=require(_0xae35('0x0'));module[_0xae35('0x1')]={'name':{'type':Sequelize[_0xae35('0x2')],'unique':_0xae35('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xae35('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xae35('0x2')]},'phone':{'type':Sequelize[_0xae35('0x2')]},'fax':{'type':Sequelize[_0xae35('0x2')]},'type':{'type':Sequelize[_0xae35('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xae35('0x2')]},'city':{'type':Sequelize[_0xae35('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xae35('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xae35('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xae35('0x2')]},'sCity':{'type':Sequelize[_0xae35('0x2')]},'sCountry':{'type':Sequelize[_0xae35('0x2')]},'description':{'type':Sequelize[_0xae35('0x2')]}};
\ No newline at end of file
index bee325c..4748037 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa9f=['count','set','Content-Range','json','reject','save','update','then','destroy','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','model','keys','query','filters','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','intersection','CmCompany','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','ids','omit','findOne','pick','map','getContacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xfa9f,0x98));var _0xffa9=function(_0x871ef5,_0x58880b){_0x871ef5=_0x871ef5-0x0;var _0x1f62ea=_0xfa9f[_0x871ef5];return _0x1f62ea;};'use strict';var emlformat=require(_0xffa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffa9('0x1'));var jsonpatch=require(_0xffa9('0x2'));var rp=require(_0xffa9('0x3'));var moment=require(_0xffa9('0x4'));var BPromise=require(_0xffa9('0x5'));var Mustache=require(_0xffa9('0x6'));var util=require('util');var path=require(_0xffa9('0x7'));var sox=require(_0xffa9('0x8'));var csv=require('to-csv');var ejs=require(_0xffa9('0x9'));var fs=require('fs');var fs_extra=require(_0xffa9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffa9('0xb'));var deskjs=require(_0xffa9('0xc'));var toCsv=require(_0xffa9('0xd'));var querystring=require(_0xffa9('0xe'));var Papa=require(_0xffa9('0xf'));var Redis=require(_0xffa9('0x10'));var authService=require(_0xffa9('0x11'));var qs=require(_0xffa9('0x12'));var as=require(_0xffa9('0x13'));var hardwareService=require(_0xffa9('0x14'));var logger=require(_0xffa9('0x15'))(_0xffa9('0x16'));var utils=require(_0xffa9('0x17'));var config=require(_0xffa9('0x18'));var licenseUtil=require(_0xffa9('0x19'));var db=require(_0xffa9('0x1a'))['db'];function respondWithStatusCode(_0x95c077,_0x49682f){_0x49682f=_0x49682f||0xcc;return function(_0x46fe36){if(_0x46fe36){return _0x95c077['sendStatus'](_0x49682f);}return _0x95c077[_0xffa9('0x1b')](_0x49682f)[_0xffa9('0x1c')]();};}function respondWithResult(_0x162ff2,_0x1d02c6){_0x1d02c6=_0x1d02c6||0xc8;return function(_0xc914ff){if(_0xc914ff){return _0x162ff2[_0xffa9('0x1b')](_0x1d02c6)['json'](_0xc914ff);}};}function respondWithFilteredResult(_0x311669,_0x35d341){return function(_0x37aa62){if(_0x37aa62){var _0x1dda88=typeof _0x35d341[_0xffa9('0x1d')]===_0xffa9('0x1e')&&typeof _0x35d341[_0xffa9('0x1f')]===_0xffa9('0x1e');var _0x483265=_0x37aa62[_0xffa9('0x20')];var _0x7d5da5=_0x1dda88?0x0:_0x35d341[_0xffa9('0x1d')];var _0x516747=_0x1dda88?_0x37aa62[_0xffa9('0x20')]:_0x35d341[_0xffa9('0x1d')]+_0x35d341[_0xffa9('0x1f')];var _0x2117d4;if(_0x516747>=_0x483265){_0x516747=_0x483265;_0x2117d4=0xc8;}else{_0x2117d4=0xce;}_0x311669[_0xffa9('0x1b')](_0x2117d4);return _0x311669[_0xffa9('0x21')](_0xffa9('0x22'),_0x7d5da5+'-'+_0x516747+'/'+_0x483265)[_0xffa9('0x23')](_0x37aa62);}return null;};}function patchUpdates(_0x3cd902){return function(_0x589b2a){try{jsonpatch['apply'](_0x589b2a,_0x3cd902,!![]);}catch(_0x3f8604){return BPromise[_0xffa9('0x24')](_0x3f8604);}return _0x589b2a[_0xffa9('0x25')]();};}function saveUpdates(_0x14e617,_0x1a2210){return function(_0x18c52a){if(_0x18c52a){return _0x18c52a[_0xffa9('0x26')](_0x14e617)[_0xffa9('0x27')](function(_0x430aa0){return _0x430aa0;});}return null;};}function removeEntity(_0x585f92,_0x420f73){return function(_0x331314){if(_0x331314){return _0x331314[_0xffa9('0x28')]()[_0xffa9('0x27')](function(){var _0x37677e=_0x331314['get']({'plain':!![]});var _0x3af9ba=_0xffa9('0x29');return db[_0xffa9('0x2a')][_0xffa9('0x28')]({'where':{'type':_0x3af9ba,'resourceId':_0x37677e['id']}})[_0xffa9('0x27')](function(){return _0x331314;});})[_0xffa9('0x27')](function(){_0x585f92['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9a53,_0x28c4da){return function(_0x3029cd){if(!_0x3029cd){_0x5e9a53[_0xffa9('0x2b')](0x194);}return _0x3029cd;};}function handleError(_0x3d5ec4,_0x25f8fa){_0x25f8fa=_0x25f8fa||0x1f4;return function(_0x3b8e36){logger[_0xffa9('0x2c')](_0x3b8e36[_0xffa9('0x2d')]);if(_0x3b8e36['name']){delete _0x3b8e36[_0xffa9('0x2e')];}_0x3d5ec4[_0xffa9('0x1b')](_0x25f8fa)[_0xffa9('0x2f')](_0x3b8e36);};}exports[_0xffa9('0x30')]=function(_0xf3d196,_0x54d354){var _0x3dfc48={},_0x250540={},_0x4d562c={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xffa9('0x27')](function(_0x1e0611){_0x250540[_0xffa9('0x31')]=_[_0xffa9('0x32')](_0x1e0611);_0x250540[_0xffa9('0x33')]=_[_0xffa9('0x32')](_0xf3d196[_0xffa9('0x33')]);_0x250540[_0xffa9('0x34')]=_['intersection'](_0x250540['model'],_0x250540[_0xffa9('0x33')]);_0x3dfc48['attributes']=_['intersection'](_0x250540[_0xffa9('0x31')],qs[_0xffa9('0x35')](_0xf3d196[_0xffa9('0x33')]['fields']));_0x3dfc48['attributes']=_0x3dfc48[_0xffa9('0x36')][_0xffa9('0x37')]?_0x3dfc48[_0xffa9('0x36')]:_0x250540[_0xffa9('0x31')];if(!_0xf3d196['query']['hasOwnProperty'](_0xffa9('0x38'))){_0x3dfc48[_0xffa9('0x1f')]=qs[_0xffa9('0x1f')](_0xf3d196[_0xffa9('0x33')]['limit']);_0x3dfc48['offset']=qs[_0xffa9('0x1d')](_0xf3d196[_0xffa9('0x33')][_0xffa9('0x1d')]);}_0x3dfc48[_0xffa9('0x39')]=qs[_0xffa9('0x3a')](_0xf3d196['query']['sort']);_0x3dfc48[_0xffa9('0x3b')]=qs['filters'](_['pick'](_0xf3d196[_0xffa9('0x33')],_0x250540[_0xffa9('0x34')]),_0x1e0611);if(_0xf3d196[_0xffa9('0x33')][_0xffa9('0x3c')]){_0x3dfc48[_0xffa9('0x3b')]=_[_0xffa9('0x3d')](_0x3dfc48[_0xffa9('0x3b')],{'$or':_['map'](_0x3dfc48[_0xffa9('0x36')],function(_0x2730d8){var _0x1ad7ee={};_0x1ad7ee[_0x2730d8]={'$like':'%'+_0xf3d196['query'][_0xffa9('0x3c')]+'%'};return _0x1ad7ee;})});}_0x3dfc48=_[_0xffa9('0x3d')]({},_0x3dfc48,_0xf3d196[_0xffa9('0x3e')]);var _0x1975cb={'where':_0x3dfc48[_0xffa9('0x3b')]};return db['CmCompany'][_0xffa9('0x20')](_0x1975cb)[_0xffa9('0x27')](function(_0x262563){_0x4d562c[_0xffa9('0x20')]=_0x262563;if(_0xf3d196[_0xffa9('0x33')][_0xffa9('0x3f')]){_0x3dfc48[_0xffa9('0x40')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x3dfc48);})[_0xffa9('0x27')](function(_0x348384){_0x4d562c[_0xffa9('0x41')]=_0x348384;return _0x4d562c;})[_0xffa9('0x27')](respondWithFilteredResult(_0x54d354,_0x3dfc48))['catch'](handleError(_0x54d354,null));})[_0xffa9('0x42')](handleError(_0x54d354,null));};exports[_0xffa9('0x43')]=function(_0x13c288,_0x12da3e){var _0x21ced9={'raw':![],'where':{'id':_0x13c288['params']['id']}},_0x41a0fb={};_0x41a0fb['model']=_[_0xffa9('0x32')](db['CmCompany'][_0xffa9('0x44')]);_0x41a0fb[_0xffa9('0x33')]=_[_0xffa9('0x32')](_0x13c288[_0xffa9('0x33')]);_0x41a0fb['filters']=_[_0xffa9('0x45')](_0x41a0fb['model'],_0x41a0fb[_0xffa9('0x33')]);_0x21ced9[_0xffa9('0x36')]=_[_0xffa9('0x45')](_0x41a0fb[_0xffa9('0x31')],qs[_0xffa9('0x35')](_0x13c288[_0xffa9('0x33')]['fields']));_0x21ced9[_0xffa9('0x36')]=_0x21ced9[_0xffa9('0x36')][_0xffa9('0x37')]?_0x21ced9[_0xffa9('0x36')]:_0x41a0fb['model'];if(_0x13c288[_0xffa9('0x33')][_0xffa9('0x3f')]){_0x21ced9[_0xffa9('0x40')]=[{'all':!![]}];}_0x21ced9=_[_0xffa9('0x3d')]({},_0x21ced9,_0x13c288[_0xffa9('0x3e')]);return db[_0xffa9('0x46')][_0xffa9('0x47')](_0x21ced9)[_0xffa9('0x27')](handleEntityNotFound(_0x12da3e,null))[_0xffa9('0x27')](respondWithResult(_0x12da3e,null))['catch'](handleError(_0x12da3e,null));};exports[_0xffa9('0x48')]=function(_0x442a56,_0x248492){return db[_0xffa9('0x46')]['create'](_0x442a56[_0xffa9('0x49')],{})['then'](function(_0x15ddf0){var _0x8ea961=_0x442a56[_0xffa9('0x4a')]['get']({'plain':!![]});if(!_0x8ea961)throw new Error(_0xffa9('0x4b'));if(_0x8ea961[_0xffa9('0x4c')]==='user'){var _0x188e37=_0x15ddf0[_0xffa9('0x4d')]({'plain':!![]});var _0x3f48b4=_0xffa9('0x29');return db[_0xffa9('0x4e')][_0xffa9('0x47')]({'where':{'name':_0x3f48b4,'userProfileId':_0x8ea961[_0xffa9('0x4f')]},'raw':!![]})[_0xffa9('0x27')](function(_0x33d072){if(_0x33d072&&_0x33d072[_0xffa9('0x50')]===0x0){return db[_0xffa9('0x2a')][_0xffa9('0x48')]({'name':_0x188e37[_0xffa9('0x2e')],'resourceId':_0x188e37['id'],'type':_0x33d072[_0xffa9('0x2e')],'sectionId':_0x33d072['id']},{})[_0xffa9('0x27')](function(){return _0x15ddf0;});}else{return _0x15ddf0;}})[_0xffa9('0x42')](function(_0x3c4b2c){logger[_0xffa9('0x2c')](_0xffa9('0x51'),_0x3c4b2c);throw _0x3c4b2c;});}return _0x15ddf0;})[_0xffa9('0x27')](respondWithResult(_0x248492,0xc9))[_0xffa9('0x42')](handleError(_0x248492,null));};exports[_0xffa9('0x26')]=function(_0x5592a0,_0x15bb66){if(_0x5592a0[_0xffa9('0x49')]['id']){delete _0x5592a0['body']['id'];}return db['CmCompany'][_0xffa9('0x47')]({'where':{'id':_0x5592a0[_0xffa9('0x52')]['id']}})['then'](handleEntityNotFound(_0x15bb66,null))[_0xffa9('0x27')](saveUpdates(_0x5592a0[_0xffa9('0x49')],null))[_0xffa9('0x27')](respondWithResult(_0x15bb66,null))[_0xffa9('0x42')](handleError(_0x15bb66,null));};exports[_0xffa9('0x28')]=function(_0x1e94ff,_0x44c7c6){return db[_0xffa9('0x46')][_0xffa9('0x47')]({'where':{'id':_0x1e94ff['params']['id']}})[_0xffa9('0x27')](handleEntityNotFound(_0x44c7c6,null))[_0xffa9('0x27')](removeEntity(_0x44c7c6,null))['catch'](handleError(_0x44c7c6,null));};exports[_0xffa9('0x53')]=function(_0x2f66a7,_0x3363b2){return db['CmCompany'][_0xffa9('0x53')]()[_0xffa9('0x27')](respondWithResult(_0x3363b2,null))['catch'](handleError(_0x3363b2,null));};exports[_0xffa9('0x54')]=function(_0x18dd67,_0x5d27fe,_0x13e466){return db[_0xffa9('0x55')][_0xffa9('0x47')]({'where':{'id':_0x18dd67[_0xffa9('0x52')]['id']}})[_0xffa9('0x27')](handleEntityNotFound(_0x5d27fe,null))['then'](function(_0x4d3234){if(_0x4d3234){return _0x4d3234[_0xffa9('0x54')](_0x18dd67[_0xffa9('0x49')][_0xffa9('0x56')],_[_0xffa9('0x57')](_0x18dd67[_0xffa9('0x49')],[_0xffa9('0x56'),'id'])||{});}})[_0xffa9('0x27')](respondWithResult(_0x5d27fe,null))[_0xffa9('0x42')](handleError(_0x5d27fe,null));};exports['getContacts']=function(_0x594ab8,_0x59fc5f,_0x53d94b){var _0x518dc0={};var _0x3b9d56={};var _0x360787;var _0x52b8b0;return db['CmCompany'][_0xffa9('0x58')]({'where':{'id':_0x594ab8[_0xffa9('0x52')]['id']}})['then'](handleEntityNotFound(_0x59fc5f,null))[_0xffa9('0x27')](function(_0xa0aaa3){if(_0xa0aaa3){_0x360787=_0xa0aaa3;_0x3b9d56[_0xffa9('0x31')]=_[_0xffa9('0x32')](db[_0xffa9('0x55')]['rawAttributes']);_0x3b9d56[_0xffa9('0x33')]=_['keys'](_0x594ab8[_0xffa9('0x33')]);_0x3b9d56[_0xffa9('0x34')]=_['intersection'](_0x3b9d56[_0xffa9('0x31')],_0x3b9d56[_0xffa9('0x33')]);_0x518dc0[_0xffa9('0x36')]=_[_0xffa9('0x45')](_0x3b9d56[_0xffa9('0x31')],qs[_0xffa9('0x35')](_0x594ab8['query'][_0xffa9('0x35')]));_0x518dc0['attributes']=_0x518dc0[_0xffa9('0x36')][_0xffa9('0x37')]?_0x518dc0[_0xffa9('0x36')]:_0x3b9d56[_0xffa9('0x31')];_0x518dc0[_0xffa9('0x39')]=qs[_0xffa9('0x3a')](_0x594ab8['query']['sort']);_0x518dc0[_0xffa9('0x3b')]=qs[_0xffa9('0x34')](_[_0xffa9('0x59')](_0x594ab8[_0xffa9('0x33')],_0x3b9d56[_0xffa9('0x34')]));if(_0x594ab8[_0xffa9('0x33')][_0xffa9('0x3c')]){_0x518dc0[_0xffa9('0x3b')]=_[_0xffa9('0x3d')](_0x518dc0['where'],{'$or':_[_0xffa9('0x5a')](_0x518dc0[_0xffa9('0x36')],function(_0x1e6dd1){var _0x302360={};_0x302360[_0x1e6dd1]={'$like':'%'+_0x594ab8[_0xffa9('0x33')][_0xffa9('0x3c')]+'%'};return _0x302360;})});}_0x518dc0=_['merge']({},_0x518dc0,_0x594ab8[_0xffa9('0x3e')]);return _0x360787['getContacts'](_0x518dc0);}})['then'](function(_0x5f0ba9){if(_0x5f0ba9){_0x52b8b0=_0x5f0ba9[_0xffa9('0x37')];if(!_0x594ab8[_0xffa9('0x33')]['hasOwnProperty']('nolimit')){_0x518dc0[_0xffa9('0x1f')]=qs[_0xffa9('0x1f')](_0x594ab8['query']['limit']);_0x518dc0['offset']=qs[_0xffa9('0x1d')](_0x594ab8[_0xffa9('0x33')]['offset']);}return _0x360787[_0xffa9('0x5b')](_0x518dc0);}})[_0xffa9('0x27')](function(_0x769e39){if(_0x769e39){return _0x769e39?{'count':_0x52b8b0,'rows':_0x769e39}:null;}})['then'](respondWithResult(_0x59fc5f,null))[_0xffa9('0x42')](handleError(_0x59fc5f,null));};
\ No newline at end of file
+var _0xec3d=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','params','rawAttributes','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','nolimit','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring'];(function(_0x152ef7,_0x221f4c){var _0x33b535=function(_0x4d9ab7){while(--_0x4d9ab7){_0x152ef7['push'](_0x152ef7['shift']());}};_0x33b535(++_0x221f4c);}(_0xec3d,0x1aa));var _0xdec3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec3d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdec3('0x0'));var jsonpatch=require(_0xdec3('0x1'));var rp=require(_0xdec3('0x2'));var moment=require(_0xdec3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdec3('0x4'));var util=require(_0xdec3('0x5'));var path=require(_0xdec3('0x6'));var sox=require('sox');var csv=require(_0xdec3('0x7'));var ejs=require(_0xdec3('0x8'));var fs=require('fs');var fs_extra=require(_0xdec3('0x9'));var _=require('lodash');var squel=require(_0xdec3('0xa'));var crypto=require(_0xdec3('0xb'));var jsforce=require(_0xdec3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdec3('0x7'));var querystring=require(_0xdec3('0xd'));var Papa=require(_0xdec3('0xe'));var Redis=require(_0xdec3('0xf'));var authService=require(_0xdec3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdec3('0x11'));var logger=require(_0xdec3('0x12'))(_0xdec3('0x13'));var utils=require(_0xdec3('0x14'));var config=require(_0xdec3('0x15'));var licenseUtil=require(_0xdec3('0x16'));var db=require(_0xdec3('0x17'))['db'];function respondWithStatusCode(_0x3629a4,_0x1b9bfc){_0x1b9bfc=_0x1b9bfc||0xcc;return function(_0x55a0db){if(_0x55a0db){return _0x3629a4[_0xdec3('0x18')](_0x1b9bfc);}return _0x3629a4[_0xdec3('0x19')](_0x1b9bfc)[_0xdec3('0x1a')]();};}function respondWithResult(_0x4d7a8e,_0x4e69fb){_0x4e69fb=_0x4e69fb||0xc8;return function(_0x5cd541){if(_0x5cd541){return _0x4d7a8e[_0xdec3('0x19')](_0x4e69fb)[_0xdec3('0x1b')](_0x5cd541);}};}function respondWithFilteredResult(_0x1172e4,_0x2bfe68){return function(_0x2ac417){if(_0x2ac417){var _0x1770f9=typeof _0x2bfe68['offset']===_0xdec3('0x1c')&&typeof _0x2bfe68['limit']===_0xdec3('0x1c');var _0x35e442=_0x2ac417[_0xdec3('0x1d')];var _0x3d7f01=_0x1770f9?0x0:_0x2bfe68[_0xdec3('0x1e')];var _0x5e9067=_0x1770f9?_0x2ac417['count']:_0x2bfe68[_0xdec3('0x1e')]+_0x2bfe68[_0xdec3('0x1f')];var _0xdfb0a4;if(_0x5e9067>=_0x35e442){_0x5e9067=_0x35e442;_0xdfb0a4=0xc8;}else{_0xdfb0a4=0xce;}_0x1172e4[_0xdec3('0x19')](_0xdfb0a4);return _0x1172e4[_0xdec3('0x20')](_0xdec3('0x21'),_0x3d7f01+'-'+_0x5e9067+'/'+_0x35e442)['json'](_0x2ac417);}return null;};}function patchUpdates(_0x49b158){return function(_0x359c43){try{jsonpatch[_0xdec3('0x22')](_0x359c43,_0x49b158,!![]);}catch(_0x3111a8){return BPromise[_0xdec3('0x23')](_0x3111a8);}return _0x359c43[_0xdec3('0x24')]();};}function saveUpdates(_0x61e319,_0x147405){return function(_0x9d40bf){if(_0x9d40bf){return _0x9d40bf[_0xdec3('0x25')](_0x61e319)[_0xdec3('0x26')](function(_0x12d602){return _0x12d602;});}return null;};}function removeEntity(_0x38ef90,_0x345a77){return function(_0x2f1c02){if(_0x2f1c02){return _0x2f1c02[_0xdec3('0x27')]()[_0xdec3('0x26')](function(){var _0x196877=_0x2f1c02['get']({'plain':!![]});var _0x24f20c=_0xdec3('0x28');return db[_0xdec3('0x29')][_0xdec3('0x27')]({'where':{'type':_0x24f20c,'resourceId':_0x196877['id']}})[_0xdec3('0x26')](function(){return _0x2f1c02;});})[_0xdec3('0x26')](function(){_0x38ef90[_0xdec3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4580b7,_0x2de0ed){return function(_0x2c97fe){if(!_0x2c97fe){_0x4580b7[_0xdec3('0x18')](0x194);}return _0x2c97fe;};}function handleError(_0xb291da,_0x8610d0){_0x8610d0=_0x8610d0||0x1f4;return function(_0xdf2908){logger[_0xdec3('0x2a')](_0xdf2908['stack']);if(_0xdf2908[_0xdec3('0x2b')]){delete _0xdf2908[_0xdec3('0x2b')];}_0xb291da[_0xdec3('0x19')](_0x8610d0)[_0xdec3('0x2c')](_0xdf2908);};}exports[_0xdec3('0x2d')]=function(_0x3c4524,_0x36afaa){var _0x18d6b4={},_0x55fa78={},_0x37d98b={'count':0x0,'rows':[]};return db[_0xdec3('0x2e')][_0xdec3('0x2f')]()[_0xdec3('0x26')](function(_0x1a597f){_0x55fa78['model']=_[_0xdec3('0x30')](_0x1a597f);_0x55fa78[_0xdec3('0x31')]=_[_0xdec3('0x30')](_0x3c4524[_0xdec3('0x31')]);_0x55fa78[_0xdec3('0x32')]=_['intersection'](_0x55fa78[_0xdec3('0x33')],_0x55fa78['query']);_0x18d6b4[_0xdec3('0x34')]=_['intersection'](_0x55fa78[_0xdec3('0x33')],qs[_0xdec3('0x35')](_0x3c4524[_0xdec3('0x31')]['fields']));_0x18d6b4[_0xdec3('0x34')]=_0x18d6b4[_0xdec3('0x34')][_0xdec3('0x36')]?_0x18d6b4[_0xdec3('0x34')]:_0x55fa78['model'];if(!_0x3c4524[_0xdec3('0x31')][_0xdec3('0x37')]('nolimit')){_0x18d6b4[_0xdec3('0x1f')]=qs[_0xdec3('0x1f')](_0x3c4524[_0xdec3('0x31')][_0xdec3('0x1f')]);_0x18d6b4[_0xdec3('0x1e')]=qs[_0xdec3('0x1e')](_0x3c4524['query']['offset']);}_0x18d6b4[_0xdec3('0x38')]=qs[_0xdec3('0x39')](_0x3c4524[_0xdec3('0x31')]['sort']);_0x18d6b4[_0xdec3('0x3a')]=qs['filters'](_[_0xdec3('0x3b')](_0x3c4524[_0xdec3('0x31')],_0x55fa78['filters']),_0x1a597f);if(_0x3c4524['query'][_0xdec3('0x3c')]){_0x18d6b4[_0xdec3('0x3a')]=_[_0xdec3('0x3d')](_0x18d6b4[_0xdec3('0x3a')],{'$or':_[_0xdec3('0x3e')](_0x18d6b4[_0xdec3('0x34')],function(_0x1bc968){var _0x4463bc={};_0x4463bc[_0x1bc968]={'$like':'%'+_0x3c4524[_0xdec3('0x31')][_0xdec3('0x3c')]+'%'};return _0x4463bc;})});}_0x18d6b4=_['merge']({},_0x18d6b4,_0x3c4524[_0xdec3('0x3f')]);var _0x2f9604={'where':_0x18d6b4['where']};return db[_0xdec3('0x2e')][_0xdec3('0x1d')](_0x2f9604)[_0xdec3('0x26')](function(_0x4def4c){_0x37d98b[_0xdec3('0x1d')]=_0x4def4c;if(_0x3c4524['query'][_0xdec3('0x40')]){_0x18d6b4[_0xdec3('0x41')]=[{'all':!![]}];}return db[_0xdec3('0x2e')]['findAll'](_0x18d6b4);})[_0xdec3('0x26')](function(_0x23ee4c){_0x37d98b[_0xdec3('0x42')]=_0x23ee4c;return _0x37d98b;})[_0xdec3('0x26')](respondWithFilteredResult(_0x36afaa,_0x18d6b4))[_0xdec3('0x43')](handleError(_0x36afaa,null));})[_0xdec3('0x43')](handleError(_0x36afaa,null));};exports['show']=function(_0xe1a4bb,_0x365c4e){var _0x539f47={'raw':![],'where':{'id':_0xe1a4bb[_0xdec3('0x44')]['id']}},_0x2fcdc1={};_0x2fcdc1['model']=_['keys'](db[_0xdec3('0x2e')][_0xdec3('0x45')]);_0x2fcdc1[_0xdec3('0x31')]=_[_0xdec3('0x30')](_0xe1a4bb[_0xdec3('0x31')]);_0x2fcdc1[_0xdec3('0x32')]=_[_0xdec3('0x46')](_0x2fcdc1[_0xdec3('0x33')],_0x2fcdc1['query']);_0x539f47[_0xdec3('0x34')]=_[_0xdec3('0x46')](_0x2fcdc1['model'],qs['fields'](_0xe1a4bb[_0xdec3('0x31')]['fields']));_0x539f47[_0xdec3('0x34')]=_0x539f47['attributes'][_0xdec3('0x36')]?_0x539f47['attributes']:_0x2fcdc1[_0xdec3('0x33')];if(_0xe1a4bb['query']['includeAll']){_0x539f47[_0xdec3('0x41')]=[{'all':!![]}];}_0x539f47=_['merge']({},_0x539f47,_0xe1a4bb[_0xdec3('0x3f')]);return db['CmCompany']['find'](_0x539f47)[_0xdec3('0x26')](handleEntityNotFound(_0x365c4e,null))[_0xdec3('0x26')](respondWithResult(_0x365c4e,null))['catch'](handleError(_0x365c4e,null));};exports[_0xdec3('0x47')]=function(_0x38e72d,_0x5b9661){return db[_0xdec3('0x2e')]['create'](_0x38e72d[_0xdec3('0x48')],{})[_0xdec3('0x26')](function(_0xfffd10){var _0x4a5dc1=_0x38e72d[_0xdec3('0x49')][_0xdec3('0x4a')]({'plain':!![]});if(!_0x4a5dc1)throw new Error(_0xdec3('0x4b'));if(_0x4a5dc1[_0xdec3('0x4c')]===_0xdec3('0x49')){var _0x22be69=_0xfffd10['get']({'plain':!![]});var _0x86418a=_0xdec3('0x28');return db[_0xdec3('0x4d')][_0xdec3('0x4e')]({'where':{'name':_0x86418a,'userProfileId':_0x4a5dc1[_0xdec3('0x4f')]},'raw':!![]})['then'](function(_0x4554fc){if(_0x4554fc&&_0x4554fc[_0xdec3('0x50')]===0x0){return db[_0xdec3('0x29')][_0xdec3('0x47')]({'name':_0x22be69[_0xdec3('0x2b')],'resourceId':_0x22be69['id'],'type':_0x4554fc[_0xdec3('0x2b')],'sectionId':_0x4554fc['id']},{})[_0xdec3('0x26')](function(){return _0xfffd10;});}else{return _0xfffd10;}})[_0xdec3('0x43')](function(_0x579b3b){logger[_0xdec3('0x2a')](_0xdec3('0x51'),_0x579b3b);throw _0x579b3b;});}return _0xfffd10;})[_0xdec3('0x26')](respondWithResult(_0x5b9661,0xc9))[_0xdec3('0x43')](handleError(_0x5b9661,null));};exports[_0xdec3('0x25')]=function(_0x3bac05,_0x1a54d6){if(_0x3bac05[_0xdec3('0x48')]['id']){delete _0x3bac05[_0xdec3('0x48')]['id'];}return db[_0xdec3('0x2e')][_0xdec3('0x4e')]({'where':{'id':_0x3bac05[_0xdec3('0x44')]['id']}})[_0xdec3('0x26')](handleEntityNotFound(_0x1a54d6,null))[_0xdec3('0x26')](saveUpdates(_0x3bac05[_0xdec3('0x48')],null))[_0xdec3('0x26')](respondWithResult(_0x1a54d6,null))[_0xdec3('0x43')](handleError(_0x1a54d6,null));};exports[_0xdec3('0x27')]=function(_0x1ef602,_0x535ca2){return db[_0xdec3('0x2e')][_0xdec3('0x4e')]({'where':{'id':_0x1ef602['params']['id']}})[_0xdec3('0x26')](handleEntityNotFound(_0x535ca2,null))[_0xdec3('0x26')](removeEntity(_0x535ca2,null))[_0xdec3('0x43')](handleError(_0x535ca2,null));};exports[_0xdec3('0x2f')]=function(_0x1419ee,_0x3875a5){return db['CmCompany'][_0xdec3('0x2f')]()['then'](respondWithResult(_0x3875a5,null))[_0xdec3('0x43')](handleError(_0x3875a5,null));};exports[_0xdec3('0x52')]=function(_0x29cedb,_0x1a5eb6,_0x2acdad){return db[_0xdec3('0x53')]['find']({'where':{'id':_0x29cedb[_0xdec3('0x44')]['id']}})[_0xdec3('0x26')](handleEntityNotFound(_0x1a5eb6,null))[_0xdec3('0x26')](function(_0x143e00){if(_0x143e00){return _0x143e00[_0xdec3('0x52')](_0x29cedb[_0xdec3('0x48')][_0xdec3('0x54')],_[_0xdec3('0x55')](_0x29cedb['body'],[_0xdec3('0x54'),'id'])||{});}})[_0xdec3('0x26')](respondWithResult(_0x1a5eb6,null))[_0xdec3('0x43')](handleError(_0x1a5eb6,null));};exports['getContacts']=function(_0x343717,_0x13d680,_0x267d96){var _0x33a04a={};var _0x4245e8={};var _0x118e96;var _0x3f51e0;return db[_0xdec3('0x2e')]['findOne']({'where':{'id':_0x343717[_0xdec3('0x44')]['id']}})[_0xdec3('0x26')](handleEntityNotFound(_0x13d680,null))[_0xdec3('0x26')](function(_0x4f2543){if(_0x4f2543){_0x118e96=_0x4f2543;_0x4245e8['model']=_[_0xdec3('0x30')](db['CmContact']['rawAttributes']);_0x4245e8['query']=_[_0xdec3('0x30')](_0x343717[_0xdec3('0x31')]);_0x4245e8[_0xdec3('0x32')]=_[_0xdec3('0x46')](_0x4245e8[_0xdec3('0x33')],_0x4245e8['query']);_0x33a04a[_0xdec3('0x34')]=_[_0xdec3('0x46')](_0x4245e8[_0xdec3('0x33')],qs['fields'](_0x343717[_0xdec3('0x31')][_0xdec3('0x35')]));_0x33a04a[_0xdec3('0x34')]=_0x33a04a[_0xdec3('0x34')][_0xdec3('0x36')]?_0x33a04a[_0xdec3('0x34')]:_0x4245e8[_0xdec3('0x33')];_0x33a04a[_0xdec3('0x38')]=qs[_0xdec3('0x39')](_0x343717[_0xdec3('0x31')][_0xdec3('0x39')]);_0x33a04a[_0xdec3('0x3a')]=qs['filters'](_[_0xdec3('0x3b')](_0x343717[_0xdec3('0x31')],_0x4245e8['filters']));if(_0x343717['query'][_0xdec3('0x3c')]){_0x33a04a[_0xdec3('0x3a')]=_['merge'](_0x33a04a[_0xdec3('0x3a')],{'$or':_[_0xdec3('0x3e')](_0x33a04a['attributes'],function(_0xf893ca){var _0x4b8364={};_0x4b8364[_0xf893ca]={'$like':'%'+_0x343717[_0xdec3('0x31')][_0xdec3('0x3c')]+'%'};return _0x4b8364;})});}_0x33a04a=_[_0xdec3('0x3d')]({},_0x33a04a,_0x343717[_0xdec3('0x3f')]);return _0x118e96[_0xdec3('0x56')](_0x33a04a);}})[_0xdec3('0x26')](function(_0x30ebc0){if(_0x30ebc0){_0x3f51e0=_0x30ebc0[_0xdec3('0x36')];if(!_0x343717[_0xdec3('0x31')][_0xdec3('0x37')](_0xdec3('0x57'))){_0x33a04a[_0xdec3('0x1f')]=qs[_0xdec3('0x1f')](_0x343717[_0xdec3('0x31')]['limit']);_0x33a04a[_0xdec3('0x1e')]=qs[_0xdec3('0x1e')](_0x343717[_0xdec3('0x31')][_0xdec3('0x1e')]);}return _0x118e96[_0xdec3('0x56')](_0x33a04a);}})[_0xdec3('0x26')](function(_0x2aaf2c){if(_0x2aaf2c){return _0x2aaf2c?{'count':_0x3f51e0,'rows':_0x2aaf2c}:null;}})['then'](respondWithResult(_0x13d680,null))[_0xdec3('0x43')](handleError(_0x13d680,null));};
\ No newline at end of file
index 000b3a6..8db265f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0654=['../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x45c137,_0x411b9a){var _0x310012=function(_0x477a41){while(--_0x477a41){_0x45c137['push'](_0x45c137['shift']());}};_0x310012(++_0x411b9a);}(_0x0654,0x73));var _0x4065=function(_0x5f3a0b,_0x37693f){_0x5f3a0b=_0x5f3a0b-0x0;var _0x4b8438=_0x0654[_0x5f3a0b];return _0x4b8438;};'use strict';var _=require(_0x4065('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4065('0x1'));var moment=require('moment');var BPromise=require(_0x4065('0x2'));var rp=require(_0x4065('0x3'));var fs=require('fs');var path=require(_0x4065('0x4'));var rimraf=require(_0x4065('0x5'));var config=require(_0x4065('0x6'));var attributes=require(_0x4065('0x7'));module[_0x4065('0x8')]=function(_0x5d67f6,_0x21e563){return _0x5d67f6[_0x4065('0x9')]('CmCompany',attributes,{'tableName':_0x4065('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x30d2=['./cmCompany.attributes','exports','define','cm_companies','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_0x30d2,0x90));var _0x230d=function(_0x17a329,_0x5d2f43){_0x17a329=_0x17a329-0x0;var _0x761387=_0x30d2[_0x17a329];return _0x761387;};'use strict';var _=require('lodash');var util=require(_0x230d('0x0'));var logger=require(_0x230d('0x1'))('api');var moment=require(_0x230d('0x2'));var BPromise=require(_0x230d('0x3'));var rp=require(_0x230d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x230d('0x5'));var attributes=require(_0x230d('0x6'));module[_0x230d('0x7')]=function(_0x59391a,_0x5039a6){return _0x59391a[_0x230d('0x8')]('CmCompany',attributes,{'tableName':_0x230d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d2091f6..ef1ef7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x086b=['error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x386c7c,_0x5bac87){var _0x2c6342=function(_0x394287){while(--_0x394287){_0x386c7c['push'](_0x386c7c['shift']());}};_0x2c6342(++_0x5bac87);}(_0x086b,0xa3));var _0xb086=function(_0x14047b,_0x4bebbd){_0x14047b=_0x14047b-0x0;var _0x6442ca=_0x086b[_0x14047b];return _0x6442ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb086('0x0'));var BPromise=require('bluebird');var rs=require(_0xb086('0x1'));var fs=require('fs');var Redis=require(_0xb086('0x2'));var db=require(_0xb086('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb086('0x4'))('rpc');var config=require(_0xb086('0x5'));var jayson=require(_0xb086('0x6'));var client=jayson['client'][_0xb086('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21142e,_0x3a605f,_0x4f083d){return new BPromise(function(_0x129cbe,_0x2164fd){return client['request'](_0x21142e,_0x4f083d)[_0xb086('0x8')](function(_0x17137b){logger[_0xb086('0x9')](_0xb086('0xa'),_0x3a605f,'request\x20sent');logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x3a605f,_0xb086('0xb'),JSON[_0xb086('0xc')](_0x17137b));if(_0x17137b[_0xb086('0xd')]){if(_0x17137b[_0xb086('0xd')]['code']===0x1f4){logger['error'](_0xb086('0xa'),_0x3a605f,_0x17137b[_0xb086('0xd')][_0xb086('0xe')]);return _0x2164fd(_0x17137b['error'][_0xb086('0xe')]);}logger[_0xb086('0xd')](_0xb086('0xa'),_0x3a605f,_0x17137b['error'][_0xb086('0xe')]);return _0x129cbe(_0x17137b[_0xb086('0xd')][_0xb086('0xe')]);}else{logger[_0xb086('0x9')]('CmCompany,\x20%s,\x20%s',_0x3a605f,'request\x20sent');_0x129cbe(_0x17137b['result'][_0xb086('0xe')]);}})[_0xb086('0xf')](function(_0x493646){logger[_0xb086('0xd')]('CmCompany,\x20%s,\x20%s',_0x3a605f,_0x493646);_0x2164fd(_0x493646);});});}
\ No newline at end of file
+var _0xe7a3=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x45d776,_0x2c5217){var _0x356cda=function(_0x11677d){while(--_0x11677d){_0x45d776['push'](_0x45d776['shift']());}};_0x356cda(++_0x2c5217);}(_0xe7a3,0xb1));var _0x3e7a=function(_0x170150,_0xeab6a6){_0x170150=_0x170150-0x0;var _0x1e62cf=_0xe7a3[_0x170150];return _0x1e62cf;};'use strict';var _=require(_0x3e7a('0x0'));var util=require(_0x3e7a('0x1'));var moment=require('moment');var BPromise=require(_0x3e7a('0x2'));var rs=require(_0x3e7a('0x3'));var fs=require('fs');var Redis=require(_0x3e7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e7a('0x5'));var logger=require(_0x3e7a('0x6'))('rpc');var config=require(_0x3e7a('0x7'));var jayson=require(_0x3e7a('0x8'));var client=jayson[_0x3e7a('0x9')][_0x3e7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230b68,_0x4a4132,_0x2b080a){return new BPromise(function(_0x512ad5,_0x25212d){return client[_0x3e7a('0xb')](_0x230b68,_0x2b080a)['then'](function(_0x407f56){logger[_0x3e7a('0xc')](_0x3e7a('0xd'),_0x4a4132,_0x3e7a('0xe'));logger['debug'](_0x3e7a('0xf'),_0x4a4132,_0x3e7a('0xe'),JSON[_0x3e7a('0x10')](_0x407f56));if(_0x407f56[_0x3e7a('0x11')]){if(_0x407f56[_0x3e7a('0x11')][_0x3e7a('0x12')]===0x1f4){logger[_0x3e7a('0x11')](_0x3e7a('0xd'),_0x4a4132,_0x407f56['error'][_0x3e7a('0x13')]);return _0x25212d(_0x407f56['error'][_0x3e7a('0x13')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4a4132,_0x407f56[_0x3e7a('0x11')][_0x3e7a('0x13')]);return _0x512ad5(_0x407f56[_0x3e7a('0x11')][_0x3e7a('0x13')]);}else{logger[_0x3e7a('0xc')](_0x3e7a('0xd'),_0x4a4132,_0x3e7a('0xe'));_0x512ad5(_0x407f56[_0x3e7a('0x14')][_0x3e7a('0x13')]);}})[_0x3e7a('0x15')](function(_0x10135d){logger['error'](_0x3e7a('0xd'),_0x4a4132,_0x10135d);_0x25212d(_0x10135d);});});}
\ No newline at end of file
index ba1ab1a..62c0c7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1989=['create','addContacts','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cmCompany.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','post'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x1989,0x149));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9198('0x0'));var timeout=require(_0x9198('0x1'));var express=require('express');var router=express[_0x9198('0x2')]();var fs_extra=require(_0x9198('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9198('0x4'));var config=require('../../config/environment');var controller=require(_0x9198('0x5'));router[_0x9198('0x6')]('/',auth['isAuthenticated'](),controller[_0x9198('0x7')]);router[_0x9198('0x6')](_0x9198('0x8'),auth['isAuthenticated'](),controller[_0x9198('0x9')]);router[_0x9198('0x6')](_0x9198('0xa'),auth[_0x9198('0xb')](),controller[_0x9198('0xc')]);router['get'](_0x9198('0xd'),auth['isAuthenticated'](),controller[_0x9198('0xe')]);router[_0x9198('0xf')]('/',auth['isAuthenticated'](),controller[_0x9198('0x10')]);router[_0x9198('0xf')](_0x9198('0xd'),auth['isAuthenticated'](),controller[_0x9198('0x11')]);router[_0x9198('0x12')](_0x9198('0xa'),auth['isAuthenticated'](),controller[_0x9198('0x13')]);router[_0x9198('0x14')]('/:id',auth[_0x9198('0xb')](),controller[_0x9198('0x15')]);module[_0x9198('0x16')]=router;
\ No newline at end of file
+var _0xf9b7=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCompany.controller','isAuthenticated','index','describe','show','get','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','destroy'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf9b7,0x91));var _0x7f9b=function(_0x4a1a67,_0x5e7df3){_0x4a1a67=_0x4a1a67-0x0;var _0x263c3d=_0xf9b7[_0x4a1a67];return _0x263c3d;};'use strict';var multer=require(_0x7f9b('0x0'));var util=require(_0x7f9b('0x1'));var path=require(_0x7f9b('0x2'));var timeout=require(_0x7f9b('0x3'));var express=require(_0x7f9b('0x4'));var router=express[_0x7f9b('0x5')]();var fs_extra=require(_0x7f9b('0x6'));var auth=require(_0x7f9b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f9b('0x8'));router['get']('/',auth[_0x7f9b('0x9')](),controller[_0x7f9b('0xa')]);router['get']('/describe',auth[_0x7f9b('0x9')](),controller[_0x7f9b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7f9b('0xc')]);router[_0x7f9b('0xd')](_0x7f9b('0xe'),auth['isAuthenticated'](),controller[_0x7f9b('0xf')]);router[_0x7f9b('0x10')]('/',auth['isAuthenticated'](),controller[_0x7f9b('0x11')]);router['post'](_0x7f9b('0xe'),auth[_0x7f9b('0x9')](),controller[_0x7f9b('0x12')]);router[_0x7f9b('0x13')](_0x7f9b('0x14'),auth['isAuthenticated'](),controller[_0x7f9b('0x15')]);router['delete'](_0x7f9b('0x14'),auth[_0x7f9b('0x9')](),controller[_0x7f9b('0x16')]);module[_0x7f9b('0x17')]=router;
\ No newline at end of file
index 6097da8..a4bf448 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x740c=['TEXT','INTEGER','UNSIGNED','DATE','NOW','sequelize','exports','STRING'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x740c,0x1bd));var _0xc740=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x740c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var Sequelize=require(_0xc740('0x0'));module[_0xc740('0x1')]={'firstName':{'type':Sequelize[_0xc740('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc740('0x2')]},'street':{'type':Sequelize[_0xc740('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc740('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xc740('0x2')]},'description':{'type':Sequelize[_0xc740('0x3')]},'phone':{'type':Sequelize[_0xc740('0x2')]},'mobile':{'type':Sequelize[_0xc740('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc740('0x2')]},'url':{'type':Sequelize[_0xc740('0x2')]},'facebook':{'type':Sequelize[_0xc740('0x2')]},'fb_data':{'type':Sequelize[_0xc740('0x2')]},'twitter':{'type':Sequelize[_0xc740('0x2')]},'skype':{'type':Sequelize[_0xc740('0x2')]},'teams':{'type':Sequelize[_0xc740('0x2')]},'viber':{'type':Sequelize[_0xc740('0x2')]},'line':{'type':Sequelize[_0xc740('0x2')]},'wechat':{'type':Sequelize[_0xc740('0x2')]},'telegram':{'type':Sequelize[_0xc740('0x2')]},'UserId':{'type':Sequelize[_0xc740('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xc740('0x2')]},'priority':{'type':Sequelize[_0xc740('0x4')](0x2)[_0xc740('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc740('0x6')],'defaultValue':Sequelize[_0xc740('0x7')]},'dialTimezone':{'type':Sequelize[_0xc740('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x120f=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x4dee14,_0x3d6aba){var _0x4daacb=function(_0x194cb3){while(--_0x194cb3){_0x4dee14['push'](_0x4dee14['shift']());}};_0x4daacb(++_0x3d6aba);}(_0x120f,0x134));var _0xf120=function(_0x1d44b1,_0x227b87){_0x1d44b1=_0x1d44b1-0x0;var _0x112cb6=_0x120f[_0x1d44b1];return _0x112cb6;};'use strict';var _=require(_0xf120('0x0'));var Sequelize=require(_0xf120('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xf120('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xf120('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf120('0x2')]},'country':{'type':Sequelize[_0xf120('0x2')]},'dateOfBirth':{'type':Sequelize[_0xf120('0x2')]},'description':{'type':Sequelize[_0xf120('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xf120('0x2')]},'fax':{'type':Sequelize[_0xf120('0x2')]},'email':{'type':Sequelize[_0xf120('0x2')]},'url':{'type':Sequelize[_0xf120('0x2')]},'facebook':{'type':Sequelize[_0xf120('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xf120('0x2')]},'skype':{'type':Sequelize[_0xf120('0x2')]},'teams':{'type':Sequelize[_0xf120('0x2')]},'viber':{'type':Sequelize[_0xf120('0x2')]},'line':{'type':Sequelize[_0xf120('0x2')]},'wechat':{'type':Sequelize[_0xf120('0x2')]},'telegram':{'type':Sequelize[_0xf120('0x2')]},'UserId':{'type':Sequelize[_0xf120('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xf120('0x2')]},'priority':{'type':Sequelize[_0xf120('0x4')](0x2)[_0xf120('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf120('0x6')],'defaultValue':Sequelize[_0xf120('0x7')]},'dialTimezone':{'type':Sequelize[_0xf120('0x2')]},'utcOffset':{'type':Sequelize[_0xf120('0x4')]}};
\ No newline at end of file
index c374a3f..56f5311 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b6<Object[_0x0a9e('0x25')](_0x140511)['length'];_0x11c3b6++){var _0x3652a7=Object[_0x0a9e('0x25')](_0x140511)[_0x11c3b6];if(!_[_0x0a9e('0x26')](_0x3652a7,_0x0a9e('0x27'))){_0x140511[_0x3652a7]['columnName']=_0x3652a7;_0x140511[_0x3652a7][_0x0a9e('0x28')]=_0x3652a7;}}return _0x140511;})[_0x0a9e('0x15')](function(_0x1843b2){var _0x824a4f={'where':Boolean(_0x5bfb33[_0x0a9e('0x1e')][_0x0a9e('0x29')])===!![]?undefined:{'$or':[{'ListId':_0x5bfb33[_0x0a9e('0x1e')]['id']},{'ListId':null}]},'raw':!![]};return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x824a4f)['then'](function(_0x426950){for(var _0x5d1e0e=0x0;_0x5d1e0e<_0x426950[_0x0a9e('0x2b')];_0x5d1e0e++){var _0x3ae878=_0x0a9e('0x27')+_0x426950[_0x5d1e0e]['id'];_0x1843b2[_0x3ae878][_0x0a9e('0x2c')]=_0x3ae878;_0x1843b2[_0x3ae878][_0x0a9e('0x28')]=_0x426950[_0x5d1e0e]['alias'];_0x1843b2[_0x3ae878][_0x0a9e('0x2d')]={'type':_0x426950[_0x5d1e0e][_0x0a9e('0x2e')],'values':_0x426950[_0x5d1e0e][_0x0a9e('0x2f')]};}Object[_0x0a9e('0x25')](_0x1843b2)[_0x0a9e('0x30')](function(_0x409319){if(!_0x1843b2[_0x409319][_0x0a9e('0x31')](_0x0a9e('0x2c'))){delete _0x1843b2[_0x409319];}});return _0x1843b2;});})['then'](respondWithResult(_0x1dc186,null))[_0x0a9e('0x20')](handleError(_0x1dc186,null));};exports['merge']=function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f;var _0x3f3d41;var _0x567193;if(_0x2cc7a0[_0x0a9e('0x32')]['id']){delete _0x2cc7a0[_0x0a9e('0x32')]['id'];}return db[_0x0a9e('0x21')][_0x0a9e('0x1d')]({'where':{'id':[_0x2cc7a0['body']['to'],_0x2cc7a0['body'][_0x0a9e('0x33')]]}})['then'](function(_0x24936a){if(_0x24936a){if(_0x24936a[_0x0a9e('0x2b')]!==0x2){return null;}_0x24936a[0x0]=_0x24936a[0x0][_0x0a9e('0x34')]({'plain':!![]});_0x24936a[0x1]=_0x24936a[0x1][_0x0a9e('0x34')]({'plain':!![]});delete _0x24936a[0x0]['id'];delete _0x24936a[0x1]['id'];return _['mergeWith'](_0x24936a[0x0],_0x24936a[0x1],function(_0x31916f,_0x3bfce8){if(Array[_0x0a9e('0x35')](_0x3bfce8)&&!_0x3bfce8['length']){return _0x31916f;}else if(!_0x3bfce8){return _0x31916f;}});}})[_0x0a9e('0x15')](handleEntityNotFound(_0x14b13f,null))[_0x0a9e('0x15')](function(_0x289467){if(_0x289467){if(_0x289467['tags']&&_['isArray'](_0x289467[_0x0a9e('0x24')])){_0x289467[_0x0a9e('0x24')]=_0x289467['tags'][_0x0a9e('0x36')]();}logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0['body']['from']);return db[_0x0a9e('0x39')][_0x0a9e('0x16')]({'where':{'ContactId':[_0x2cc7a0['body']['to'],_0x2cc7a0[_0x0a9e('0x32')][_0x0a9e('0x33')]]}})[_0x0a9e('0x15')](function(_0x5b4f5e){logger[_0x0a9e('0x37')](_0x0a9e('0x3a'),_0x5b4f5e);return db[_0x0a9e('0x3b')][_0x0a9e('0x16')]({'where':{'ContactId':[_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0[_0x0a9e('0x32')][_0x0a9e('0x33')]]}})[_0x0a9e('0x15')](function(_0x23b089){logger[_0x0a9e('0x37')](_0x0a9e('0x3c'),_0x23b089);return db[_0x0a9e('0x21')][_0x0a9e('0x3d')](_0x289467);});});}})[_0x0a9e('0x15')](function(_0x37f6cc){if(_0x37f6cc){_0x2b7e7f=_0x37f6cc;_0x3f3d41={'ContactId':_0x2b7e7f['id']};_0x567193={'where':{'ContactId':[_0x2cc7a0['body']['to'],_0x2cc7a0['body'][_0x0a9e('0x33')]]}};return db[_0x0a9e('0x3e')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x40')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x41')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x42')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x43')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x42')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x43')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x44')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x45')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x46')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x47')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x48')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x49')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4a')][_0x0a9e('0x3f')]({'CmContactId':_0x2b7e7f['id']},{'where':{'CmContactId':[_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0[_0x0a9e('0x32')][_0x0a9e('0x33')]]}});}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4b')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db['CmHopperHistory']['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4c')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4d')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4e')]['update'](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db['FaxQueueReport'][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4f')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x50')]['update'](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x51')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db['JscriptySessionReport'][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x52')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x53')]['update'](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x54')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x21')]['destroy']({'where':{'id':[_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0['body'][_0x0a9e('0x33')]]}});}})['then'](function(){if(_0x2b7e7f){return _0x2b7e7f;}})['then'](respondWithResult(_0x14b13f,null))['catch'](handleError(_0x14b13f,null));};exports[_0x0a9e('0x3d')]=function(_0x47de4c,_0x2f7092){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x232830){if(_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x24')]&&_[_0x0a9e('0x35')](_0x47de4c['body'][_0x0a9e('0x24')])){if(_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x24')][_0x0a9e('0x2b')]){_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x24')]=_0x47de4c['body'][_0x0a9e('0x24')][_0x0a9e('0x36')](';')+';';}else{_0x47de4c['body'][_0x0a9e('0x24')]=null;}}else{_0x47de4c['body'][_0x0a9e('0x24')]=null;}if(!_['isNil'](_0x47de4c['body']['dialTimezone'])){var _0x273cb5=_0x47de4c['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x273cb5]))_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x273cb5]['utcOffset'];}return db[_0x0a9e('0x21')]['create'](_0x47de4c[_0x0a9e('0x32')],{'fields':_[_0x0a9e('0x25')](_0x232830),'raw':!![]});})[_0x0a9e('0x15')](function(_0x5adf8f){if(_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x59')]){return insertAdditionalPhones(_0x5adf8f,_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x59')]);}else{return _0x5adf8f;}})['then'](respondWithResult(_0x2f7092,0xc9))[_0x0a9e('0x20')](handleError(_0x2f7092,null));};exports[_0x0a9e('0x5a')]=function(_0x54327c,_0x797b45){var _0x17e88c=0x0;var _0x88dcbf=0x0;var _0x409b29=0x0;var _0x401837=[];return db['CmContact'][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x281c7d){return BPromise['each'](_0x54327c[_0x0a9e('0x32')],function(_0x4f1e60){var _0x5211e3={'where':{'$or':[]},'defaults':_0x4f1e60,'fields':_[_0x0a9e('0x25')](_0x281c7d),'raw':!![]};if(_0x4f1e60[_0x0a9e('0x5b')]){for(var _0x9375fb=0x0;_0x9375fb<_0x4f1e60[_0x0a9e('0x5b')][_0x0a9e('0x2b')];_0x9375fb++){var _0xc8c264={};_0xc8c264[_0x4f1e60[_0x0a9e('0x5b')][_0x9375fb]]=_0x4f1e60[_0x4f1e60[_0x0a9e('0x5b')][_0x9375fb]];_0x5211e3[_0x0a9e('0x5c')][_0x0a9e('0x5d')][_0x0a9e('0x5e')](_0xc8c264);}_0x5211e3[_0x0a9e('0x5c')][_0x0a9e('0x5f')]=_0x4f1e60[_0x0a9e('0x5f')];}return db[_0x0a9e('0x21')][_0x0a9e('0x60')](_0x5211e3)[_0x0a9e('0x61')](function(_0x4257c9,_0x5150a4){if(_0x5150a4){if(_0x4f1e60[_0x0a9e('0x31')](_0x0a9e('0x59'))){_0x401837[_0x0a9e('0x5e')]({'contact':_0x4257c9,'additionalPhones':_0x4f1e60['additionalPhones']});}_0x17e88c++;}else{_0x409b29++;}})[_0x0a9e('0x20')](function(){_0x88dcbf++;});});})[_0x0a9e('0x15')](function(_0x4b341d){if(_0x4b341d){if(_0x401837[_0x0a9e('0x2b')]>0x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));};
\ No newline at end of file
+var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b6<Object[_0x0a9e('0x25')](_0x140511)['length'];_0x11c3b6++){var _0x3652a7=Object[_0x0a9e('0x25')](_0x140511)[_0x11c3b6];if(!_[_0x0a9e('0x26')](_0x3652a7,_0x0a9e('0x27'))){_0x140511[_0x3652a7]['columnName']=_0x3652a7;_0x140511[_0x3652a7][_0x0a9e('0x28')]=_0x3652a7;}}return _0x140511;})[_0x0a9e('0x15')](function(_0x1843b2){var _0x824a4f={'where':Boolean(_0x5bfb33[_0x0a9e('0x1e')][_0x0a9e('0x29')])===!![]?undefined:{'$or':[{'ListId':_0x5bfb33[_0x0a9e('0x1e')]['id']},{'ListId':null}]},'raw':!![]};return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x824a4f)['then'](function(_0x426950){for(var _0x5d1e0e=0x0;_0x5d1e0e<_0x426950[_0x0a9e('0x2b')];_0x5d1e0e++){var _0x3ae878=_0x0a9e('0x27')+_0x426950[_0x5d1e0e]['id'];_0x1843b2[_0x3ae878][_0x0a9e('0x2c')]=_0x3ae878;_0x1843b2[_0x3ae878][_0x0a9e('0x28')]=_0x426950[_0x5d1e0e]['alias'];_0x1843b2[_0x3ae878][_0x0a9e('0x2d')]={'type':_0x426950[_0x5d1e0e][_0x0a9e('0x2e')],'values':_0x426950[_0x5d1e0e][_0x0a9e('0x2f')]};}Object[_0x0a9e('0x25')](_0x1843b2)[_0x0a9e('0x30')](function(_0x409319){if(!_0x1843b2[_0x409319][_0x0a9e('0x31')](_0x0a9e('0x2c'))){delete _0x1843b2[_0x409319];}});return _0x1843b2;});})['then'](respondWithResult(_0x1dc186,null))[_0x0a9e('0x20')](handleError(_0x1dc186,null));};exports['merge']=function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f;var _0x3f3d41;var _0x567193;if(_0x2cc7a0[_0x0a9e('0x32')]['id']){delete _0x2cc7a0[_0x0a9e('0x32')]['id'];}return db[_0x0a9e('0x21')][_0x0a9e('0x1d')]({'where':{'id':[_0x2cc7a0['body']['to'],_0x2cc7a0['body'][_0x0a9e('0x33')]]}})['then'](function(_0x24936a){if(_0x24936a){if(_0x24936a[_0x0a9e('0x2b')]!==0x2){return null;}_0x24936a[0x0]=_0x24936a[0x0][_0x0a9e('0x34')]({'plain':!![]});_0x24936a[0x1]=_0x24936a[0x1][_0x0a9e('0x34')]({'plain':!![]});delete _0x24936a[0x0]['id'];delete _0x24936a[0x1]['id'];return _['mergeWith'](_0x24936a[0x0],_0x24936a[0x1],function(_0x31916f,_0x3bfce8){if(Array[_0x0a9e('0x35')](_0x3bfce8)&&!_0x3bfce8['length']){return _0x31916f;}else if(!_0x3bfce8){return _0x31916f;}});}})[_0x0a9e('0x15')](handleEntityNotFound(_0x14b13f,null))[_0x0a9e('0x15')](function(_0x289467){if(_0x289467){if(_0x289467['tags']&&_['isArray'](_0x289467[_0x0a9e('0x24')])){_0x289467[_0x0a9e('0x24')]=_0x289467['tags'][_0x0a9e('0x36')]();}logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0['body']['from']);return db[_0x0a9e('0x39')][_0x0a9e('0x16')]({'where':{'ContactId':[_0x2cc7a0['body']['to'],_0x2cc7a0[_0x0a9e('0x32')][_0x0a9e('0x33')]]}})[_0x0a9e('0x15')](function(_0x5b4f5e){logger[_0x0a9e('0x37')](_0x0a9e('0x3a'),_0x5b4f5e);return db[_0x0a9e('0x3b')][_0x0a9e('0x16')]({'where':{'ContactId':[_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0[_0x0a9e('0x32')][_0x0a9e('0x33')]]}})[_0x0a9e('0x15')](function(_0x23b089){logger[_0x0a9e('0x37')](_0x0a9e('0x3c'),_0x23b089);return db[_0x0a9e('0x21')][_0x0a9e('0x3d')](_0x289467);});});}})[_0x0a9e('0x15')](function(_0x37f6cc){if(_0x37f6cc){_0x2b7e7f=_0x37f6cc;_0x3f3d41={'ContactId':_0x2b7e7f['id']};_0x567193={'where':{'ContactId':[_0x2cc7a0['body']['to'],_0x2cc7a0['body'][_0x0a9e('0x33')]]}};return db[_0x0a9e('0x3e')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x40')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x41')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x42')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x43')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x42')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x43')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x44')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x45')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x46')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x47')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x48')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x49')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4a')][_0x0a9e('0x3f')]({'CmContactId':_0x2b7e7f['id']},{'where':{'CmContactId':[_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0[_0x0a9e('0x32')][_0x0a9e('0x33')]]}});}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4b')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db['CmHopperHistory']['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4c')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4d')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4e')]['update'](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db['FaxQueueReport'][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x4f')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x50')]['update'](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x51')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db['JscriptySessionReport'][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x52')]['update'](_0x3f3d41,_0x567193);}})[_0x0a9e('0x15')](function(){if(_0x2b7e7f){return db[_0x0a9e('0x53')]['update'](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x54')][_0x0a9e('0x3f')](_0x3f3d41,_0x567193);}})['then'](function(){if(_0x2b7e7f){return db[_0x0a9e('0x21')]['destroy']({'where':{'id':[_0x2cc7a0[_0x0a9e('0x32')]['to'],_0x2cc7a0['body'][_0x0a9e('0x33')]]}});}})['then'](function(){if(_0x2b7e7f){return _0x2b7e7f;}})['then'](respondWithResult(_0x14b13f,null))['catch'](handleError(_0x14b13f,null));};exports[_0x0a9e('0x3d')]=function(_0x47de4c,_0x2f7092){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x232830){if(_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x24')]&&_[_0x0a9e('0x35')](_0x47de4c['body'][_0x0a9e('0x24')])){if(_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x24')][_0x0a9e('0x2b')]){_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x24')]=_0x47de4c['body'][_0x0a9e('0x24')][_0x0a9e('0x36')](';')+';';}else{_0x47de4c['body'][_0x0a9e('0x24')]=null;}}else{_0x47de4c['body'][_0x0a9e('0x24')]=null;}if(!_['isNil'](_0x47de4c['body']['dialTimezone'])){var _0x273cb5=_0x47de4c['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x273cb5]))_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x273cb5]['utcOffset'];}return db[_0x0a9e('0x21')]['create'](_0x47de4c[_0x0a9e('0x32')],{'fields':_[_0x0a9e('0x25')](_0x232830),'raw':!![]});})[_0x0a9e('0x15')](function(_0x5adf8f){if(_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x59')]){return insertAdditionalPhones(_0x5adf8f,_0x47de4c[_0x0a9e('0x32')][_0x0a9e('0x59')]);}else{return _0x5adf8f;}})['then'](respondWithResult(_0x2f7092,0xc9))[_0x0a9e('0x20')](handleError(_0x2f7092,null));};exports[_0x0a9e('0x5a')]=function(_0x54327c,_0x797b45){var _0x17e88c=0x0;var _0x88dcbf=0x0;var _0x409b29=0x0;var _0x401837=[];return db['CmContact'][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x281c7d){return BPromise['each'](_0x54327c[_0x0a9e('0x32')],function(_0x4f1e60){var _0x5211e3={'where':{'$or':[]},'defaults':_0x4f1e60,'fields':_[_0x0a9e('0x25')](_0x281c7d),'raw':!![]};if(_0x4f1e60[_0x0a9e('0x5b')]){for(var _0x9375fb=0x0;_0x9375fb<_0x4f1e60[_0x0a9e('0x5b')][_0x0a9e('0x2b')];_0x9375fb++){var _0xc8c264={};_0xc8c264[_0x4f1e60[_0x0a9e('0x5b')][_0x9375fb]]=_0x4f1e60[_0x4f1e60[_0x0a9e('0x5b')][_0x9375fb]];_0x5211e3[_0x0a9e('0x5c')][_0x0a9e('0x5d')][_0x0a9e('0x5e')](_0xc8c264);}_0x5211e3[_0x0a9e('0x5c')][_0x0a9e('0x5f')]=_0x4f1e60[_0x0a9e('0x5f')];}return db[_0x0a9e('0x21')][_0x0a9e('0x60')](_0x5211e3)[_0x0a9e('0x61')](function(_0x4257c9,_0x5150a4){if(_0x5150a4){if(_0x4f1e60[_0x0a9e('0x31')](_0x0a9e('0x59'))){_0x401837[_0x0a9e('0x5e')]({'contact':_0x4257c9,'additionalPhones':_0x4f1e60['additionalPhones']});}_0x17e88c++;}else{_0x409b29++;}})[_0x0a9e('0x20')](function(){_0x88dcbf++;});});})[_0x0a9e('0x15')](function(_0x4b341d){if(_0x4b341d){if(_0x401837[_0x0a9e('0x2b')]>0x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));};
\ No newline at end of file
index fb155a4..d542d40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc104=['../../mysqldb','CmContact','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xc104,0x17b));var _0x4c10=function(_0x1adc50,_0x2ec177){_0x1adc50=_0x1adc50-0x0;var _0x2bfee4=_0xc104[_0x1adc50];return _0x2bfee4;};'use strict';var EventEmitter=require(_0x4c10('0x0'));var CmContact=require(_0x4c10('0x1'))['db'][_0x4c10('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4c10('0x3')](0x0);var events={'afterCreate':_0x4c10('0x4'),'afterUpdate':_0x4c10('0x5'),'afterDestroy':'remove'};function emitEvent(_0x11e559){return function(_0x268c1d,_0x596bd5,_0x22d6bc){CmContactEvents[_0x4c10('0x6')](_0x11e559+':'+_0x268c1d['id'],_0x268c1d);CmContactEvents[_0x4c10('0x6')](_0x11e559,_0x268c1d);_0x22d6bc(null);};}for(var e in events){if(events[_0x4c10('0x7')](e)){var event=events[e];CmContact[_0x4c10('0x8')](e,emitEvent(event));}}module[_0x4c10('0x9')]=CmContactEvents;
\ No newline at end of file
+var _0x8bcf=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x52afb2,_0x108961){var _0x28f94c=function(_0x418276){while(--_0x418276){_0x52afb2['push'](_0x52afb2['shift']());}};_0x28f94c(++_0x108961);}(_0x8bcf,0x1d2));var _0xf8bc=function(_0x22015e,_0x21efb3){_0x22015e=_0x22015e-0x0;var _0x115a2a=_0x8bcf[_0x22015e];return _0x115a2a;};'use strict';var EventEmitter=require(_0xf8bc('0x0'));var CmContact=require(_0xf8bc('0x1'))['db'][_0xf8bc('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf8bc('0x3')](0x0);var events={'afterCreate':_0xf8bc('0x4'),'afterUpdate':'update','afterDestroy':_0xf8bc('0x5')};function emitEvent(_0x17fa48){return function(_0x3b3b53,_0xa519f5,_0xacc7df){CmContactEvents[_0xf8bc('0x6')](_0x17fa48+':'+_0x3b3b53['id'],_0x3b3b53);CmContactEvents[_0xf8bc('0x6')](_0x17fa48,_0x3b3b53);_0xacc7df(null);};}for(var e in events){if(events[_0xf8bc('0x7')](e)){var event=events[e];CmContact[_0xf8bc('0x8')](e,emitEvent(event));}}module[_0xf8bc('0x9')]=CmContactEvents;
\ No newline at end of file
index e11b7d7..0262a6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x391f=['ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','fax','email','FULLTEXT','utf8mb4','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','CmList','Lists','always','outbound','BlackLists','CmHopperBlack','length','onlyIfOpen','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy'];(function(_0x258902,_0x42d749){var _0x2f0164=function(_0x143872){while(--_0x143872){_0x258902['push'](_0x258902['shift']());}};_0x2f0164(++_0x42d749);}(_0x391f,0x1c9));var _0xf391=function(_0x2d4023,_0x261a59){_0x2d4023=_0x2d4023-0x0;var _0x4f355d=_0x391f[_0x2d4023];return _0x4f355d;};'use strict';var _=require('lodash');var util=require(_0xf391('0x0'));var logger=require(_0xf391('0x1'))(_0xf391('0x2'));var moment=require(_0xf391('0x3'));var BPromise=require(_0xf391('0x4'));var rp=require(_0xf391('0x5'));var fs=require('fs');var path=require(_0xf391('0x6'));var rimraf=require(_0xf391('0x7'));var config=require(_0xf391('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xf391('0x9'));module[_0xf391('0xa')]=function(_0x53784b,_0x20048e){return _0x53784b[_0xf391('0xb')](_0xf391('0xc'),attributes,{'tableName':_0xf391('0xd'),'paranoid':!![],'indexes':[{'name':_0xf391('0xe'),'fields':[_0xf391('0xe')]},{'name':'fti_cm_contacts','fields':[_0xf391('0xf'),_0xf391('0x10'),'phone','mobile',_0xf391('0x11'),_0xf391('0x12')],'type':_0xf391('0x13')}],'timestamps':!![],'charset':_0xf391('0x14'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xa94c94,_0x44c42a,_0x31dab6){var _0x5996a6=_0x53784b[_0xf391('0x15')];var _0x2f7daa=_0xa94c94[_0xf391('0x16')]({'plain':!![]});function _0x2b3186(){return function(_0xea3606){logger[_0xf391('0x17')]('cmContact',_0xf391('0x18'),util[_0xf391('0x19')](_0xea3606,{'showHidden':![],'depth':null}));};}function _0x163ecb(_0x2ff847,_0xc9a127){var _0x2e274d=_0xc9a127[_0xf391('0x1a')]?_0xc9a127['scheduledat']:moment()[_0xf391('0x1b')](_0xf391('0x1c'));return new BPromise(function(_0x34bf13,_0xf30493){if(_['isNil'](_0xc9a127[_0xf391('0x1d')])){_0x34bf13({'ret':_0x2e274d});}else{_0x5996a6[_0xf391('0x1e')][_0xf391('0x1f')]({'where':{'id':_0x2ff847['id']}})[_0xf391('0x20')](function(_0x5ca5f1){if(!_[_0xf391('0x21')](_0x5ca5f1)){var _0xfb15f8=_0x5ca5f1[_0xf391('0x1d')];if(!_[_0xf391('0x21')](_0xfb15f8)){var _0x200dd3=shared[_0xf391('0x22')];var _0x4a09d3=_0x200dd3[_0xfb15f8];var _0x137003=_0x200dd3[_0xc9a127[_0xf391('0x1d')]];if(!_[_0xf391('0x21')](_0x4a09d3)&&!_[_0xf391('0x21')](_0x137003)){var _0x684b0c=_0x4a09d3[_0xf391('0x23')]-_0x137003['utcOffset'];_0x2e274d=_0xc9a127[_0xf391('0x1a')]?_0xc9a127[_0xf391('0x1a')]:moment();var _0x124c06=moment(_0x2e274d)[_0xf391('0x24')](_0x684b0c,_0xf391('0x25'));_0x34bf13({'ret':_0x124c06['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x34bf13({'ret':_0x2e274d});}else _0x34bf13({'ret':_0x2e274d});}else{_0x34bf13({'ret':_0x2e274d});}});}});return 0xa;}var _0x1b3bb7=function(_0x2f3ee6){return new BPromise(function(_0x57d13b,_0x3d7501){_0x163ecb(_0x2f3ee6,_0x2f7daa)[_0xf391('0x20')](function(_0x5f398d){_0x2f7daa[_0xf391('0x1a')]=_0x5f398d[_0xf391('0x26')];_0x5996a6[_0xf391('0x27')]['findOne']({'where':{'phone':_0x2f7daa['phone'],'VoiceQueueId':_0x2f3ee6['id']}})[_0xf391('0x20')](function(_0x5c8ba0){if(!_[_0xf391('0x21')](_0x5c8ba0)){throw new Error(_0xf391('0x28')+_0x2f7daa[_0xf391('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x2f3ee6['id']);}return _0x5996a6['CmHopper'][_0xf391('0x29')]({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa['ListId'],'priority':_0x2f7daa[_0xf391('0x2a')]?_0x2f7daa[_0xf391('0x2a')]:0x2,'scheduledat':_0x2f7daa[_0xf391('0x1a')]?_0x2f7daa[_0xf391('0x1a')]:moment()[_0xf391('0x1b')](_0xf391('0x1c')),'callback':_0x2f7daa[_0xf391('0x2b')]?!![]:![],'callbackuniqueid':_0x2f7daa[_0xf391('0x2b')]?_0x2f7daa[_0xf391('0x2b')]:undefined,'callbackat':_0x2f7daa[_0xf391('0x2b')]?moment()[_0xf391('0x1b')](_0xf391('0x1c')):undefined,'VoiceQueueId':_0x2f3ee6['id']});})[_0xf391('0x2c')](function(_0xdfd952){_0x3d7501(_0xdfd952);});});});};var _0x2eed1d=function(_0x3abf8b){return new BPromise(function(_0x6276dc,_0x26053){_0x163ecb(_0x3abf8b,_0x2f7daa)[_0xf391('0x20')](function(_0x524ab2){_0x2f7daa[_0xf391('0x1a')]=_0x524ab2['ret'];_0x5996a6[_0xf391('0x27')]['findOne']({'where':{'phone':_0x2f7daa[_0xf391('0xe')],'VoiceQueueId':_0x3abf8b['id']}})[_0xf391('0x20')](function(_0x20a95e){if(!_[_0xf391('0x21')](_0x20a95e)){throw new Error(_0xf391('0x28')+_0x2f7daa[_0xf391('0xe')]+_0xf391('0x2d')+_0x3abf8b['id']);}return _0x5996a6['CmHopperFinal'][_0xf391('0x1f')]({'where':{'calleridnum':_0x2f7daa['phone'],'VoiceQueueId':_0x3abf8b['id']}});})[_0xf391('0x20')](function(_0x4009a7){if(!_[_0xf391('0x21')](_0x4009a7)){throw new Error(_0xf391('0x2e')+_0x2f7daa[_0xf391('0xe')]+_0xf391('0x2f')+_0x3abf8b['id']);}return _0x5996a6[_0xf391('0x27')]['create']({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa[_0xf391('0x30')],'priority':_0x2f7daa[_0xf391('0x2a')]?_0x2f7daa[_0xf391('0x2a')]:0x2,'scheduledat':_0x2f7daa['scheduledat']?_0x2f7daa[_0xf391('0x1a')]:moment()[_0xf391('0x1b')](_0xf391('0x1c')),'callback':_0x2f7daa[_0xf391('0x2b')]?!![]:![],'callbackuniqueid':_0x2f7daa[_0xf391('0x2b')]?_0x2f7daa['callbackUniqueid']:undefined,'callbackat':_0x2f7daa[_0xf391('0x2b')]?moment()[_0xf391('0x1b')](_0xf391('0x1c')):undefined,'VoiceQueueId':_0x3abf8b['id']});})[_0xf391('0x2c')](function(_0x14d45c){_0x26053(_0x14d45c);});});});};function _0x577362(){return function(_0xff1df7){logger['error']('cmContact',_0xf391('0x18'),util[_0xf391('0x19')](_0xff1df7,{'showHidden':![],'depth':null}));};}function _0x303b1d(_0x41fd9f,_0x49c25b){var _0x4c6c42=_0x49c25b[_0xf391('0x1a')]?_0x49c25b['scheduledat']:moment()['format'](_0xf391('0x1c'));return new BPromise(function(_0x4bcbb8,_0x56dcfa){if(_[_0xf391('0x21')](_0x49c25b['dialTimezone'])){_0x4bcbb8({'ret':_0x4c6c42});}else{_0x5996a6[_0xf391('0x31')]['findOne']({'where':{'id':_0x41fd9f['id']}})[_0xf391('0x20')](function(_0x1d2e89){if(!_[_0xf391('0x21')](_0x1d2e89)){var _0x26634a=_0x1d2e89[_0xf391('0x1d')];if(!_[_0xf391('0x21')](_0x26634a)){var _0x485523=shared[_0xf391('0x22')];var _0x3b975e=_0x485523[_0x26634a];var _0x56a1fd=_0x485523[_0x49c25b[_0xf391('0x1d')]];if(!_[_0xf391('0x21')](_0x3b975e)&&!_['isNil'](_0x56a1fd)){var _0xcf918e=_0x3b975e[_0xf391('0x23')]-_0x56a1fd['utcOffset'];_0x4c6c42=_0x49c25b[_0xf391('0x1a')]?_0x49c25b['scheduledat']:moment();var _0x580ea6=moment(_0x4c6c42)['add'](_0xcf918e,_0xf391('0x25'));_0x4bcbb8({'ret':_0x580ea6[_0xf391('0x1b')](_0xf391('0x1c'))});}else _0x4bcbb8({'ret':_0x4c6c42});}else _0x4bcbb8({'ret':_0x4c6c42});}else{_0x4bcbb8({'ret':_0x4c6c42});}});}});return 0xa;}var _0x12eb6d=function(_0x7b956f){return new BPromise(function(_0x2dd351,_0x83508e){_0x303b1d(_0x7b956f,_0x2f7daa)[_0xf391('0x20')](function(_0x53955d){_0x2f7daa['scheduledat']=_0x53955d[_0xf391('0x26')];_0x5996a6['CmHopper'][_0xf391('0x1f')]({'where':{'phone':_0x2f7daa['phone'],'CampaignId':_0x7b956f['id']}})['then'](function(_0x32c505){if(!_[_0xf391('0x21')](_0x32c505)){throw new Error(_0xf391('0x28')+_0x2f7daa[_0xf391('0xe')]+_0xf391('0x32')+_0x7b956f['id']);}return _0x5996a6[_0xf391('0x27')][_0xf391('0x29')]({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa[_0xf391('0x30')],'priority':_0x2f7daa['priority']?_0x2f7daa[_0xf391('0x2a')]:0x2,'scheduledat':_0x2f7daa['scheduledat']?_0x2f7daa[_0xf391('0x1a')]:moment()[_0xf391('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2f7daa[_0xf391('0x2b')]?!![]:![],'callbackuniqueid':_0x2f7daa[_0xf391('0x2b')]?_0x2f7daa['callbackUniqueid']:undefined,'callbackat':_0x2f7daa[_0xf391('0x2b')]?moment()[_0xf391('0x1b')](_0xf391('0x1c')):undefined,'CampaignId':_0x7b956f['id']});})[_0xf391('0x2c')](function(_0x1d983c){_0x83508e(_0x1d983c);});});});};var _0x41429b=function(_0x2f1a5b){return new BPromise(function(_0x1f0ea0,_0x266e14){_0x303b1d(_0x2f1a5b,_0x2f7daa)['then'](function(_0x106126){_0x2f7daa[_0xf391('0x1a')]=_0x106126[_0xf391('0x26')];_0x5996a6[_0xf391('0x27')][_0xf391('0x1f')]({'where':{'phone':_0x2f7daa[_0xf391('0xe')],'CampaignId':_0x2f1a5b['id']}})[_0xf391('0x20')](function(_0x3bba24){if(!_[_0xf391('0x21')](_0x3bba24)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2f7daa[_0xf391('0xe')]+_0xf391('0x33')+_0x2f1a5b['id']);}return _0x5996a6[_0xf391('0x34')][_0xf391('0x1f')]({'where':{'calleridnum':_0x2f7daa[_0xf391('0xe')],'CampaignId':_0x2f1a5b['id']}});})[_0xf391('0x20')](function(_0x504366){if(!_['isNil'](_0x504366)){throw new Error(_0xf391('0x2e')+_0x2f7daa['phone']+_0xf391('0x35')+_0x2f1a5b['id']);}return _0x5996a6[_0xf391('0x27')]['create']({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa[_0xf391('0x30')],'priority':_0x2f7daa['priority']?_0x2f7daa['priority']:0x2,'scheduledat':_0x2f7daa[_0xf391('0x1a')]?_0x2f7daa['scheduledat']:moment()['format'](_0xf391('0x1c')),'callback':_0x2f7daa[_0xf391('0x2b')]?!![]:![],'callbackuniqueid':_0x2f7daa['callbackUniqueid']?_0x2f7daa[_0xf391('0x2b')]:undefined,'callbackat':_0x2f7daa[_0xf391('0x2b')]?moment()[_0xf391('0x1b')](_0xf391('0x1c')):undefined,'CampaignId':_0x2f1a5b['id']});})['catch'](function(_0x45c418){_0x266e14(_0x45c418);});});});};if(_0x2f7daa[_0xf391('0x30')]){_0x5996a6[_0xf391('0x1e')][_0xf391('0x36')]({'where':{'type':'outbound'},'attributes':['id',_0xf391('0x37'),'dialTimezone'],'include':[{'model':_0x5996a6[_0xf391('0x38')],'as':_0xf391('0x39'),'where':{'id':_0x2f7daa[_0xf391('0x30')]}}]})['then'](function(_0x5791a4){if(_0x5791a4){var _0x5853bc=[];for(var _0x4c9e22=0x0,_0x1e8ec6;_0x4c9e22<_0x5791a4['length'];_0x4c9e22+=0x1){_0x1e8ec6=_0x5791a4[_0x4c9e22][_0xf391('0x16')]({'plain':!![]});switch(_0x1e8ec6[_0xf391('0x37')]){case _0xf391('0x3a'):_0x2eed1d(_0x1e8ec6)[_0xf391('0x2c')](_0x2b3186());break;case'onlyIfOpen':_0x1b3bb7(_0x1e8ec6)[_0xf391('0x2c')](_0x2b3186());break;default:_0x303b1d(_0x1e8ec6,_0x2f7daa)[_0xf391('0x20')](function(_0x1d520a){_0x2f7daa[_0xf391('0x1a')]=_0x1d520a[_0xf391('0x26')];_0x5996a6[_0xf391('0x27')][_0xf391('0x29')]({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa['ListId'],'scheduledat':_0x2f7daa[_0xf391('0x1a')]?_0x2f7daa['scheduledat']:moment()[_0xf391('0x1b')](_0xf391('0x1c')),'priority':_0x2f7daa[_0xf391('0x2a')]?_0x2f7daa[_0xf391('0x2a')]:0x2,'callback':_0x2f7daa[_0xf391('0x2b')]?!![]:![],'callbackuniqueid':_0x2f7daa[_0xf391('0x2b')]?_0x2f7daa[_0xf391('0x2b')]:undefined,'callbackat':_0x2f7daa[_0xf391('0x2b')]?moment()[_0xf391('0x1b')](_0xf391('0x1c')):undefined,'VoiceQueueId':_0x1e8ec6['id']})['catch'](_0x2b3186());});}}}})[_0xf391('0x20')](function(){return _0x5996a6['VoiceQueue'][_0xf391('0x36')]({'where':{'type':_0xf391('0x3b')},'attributes':['id'],'include':[{'model':_0x5996a6[_0xf391('0x38')],'as':_0xf391('0x3c'),'where':{'id':_0x2f7daa['ListId']}}]})[_0xf391('0x20')](function(_0x5573bd){if(_0x5573bd){var _0x162a52=[];for(var _0xb2bcc4=0x0,_0x1b4884;_0xb2bcc4<_0x5573bd['length'];_0xb2bcc4+=0x1){_0x1b4884=_0x5573bd[_0xb2bcc4][_0xf391('0x16')]({'plain':!![]});_0x5996a6[_0xf391('0x3d')]['create']({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa[_0xf391('0x30')],'VoiceQueueId':_0x1b4884['id']})[_0xf391('0x2c')](function(_0x9713b0){logger[_0xf391('0x17')]('cmContact,\x20%s,\x20%s',_0xf391('0x18'),_0x9713b0['message']);});}}});})[_0xf391('0x20')](function(){return _0x5996a6['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0xf391('0x1d')],'include':[{'model':_0x5996a6[_0xf391('0x38')],'as':'Lists','where':{'id':_0x2f7daa['ListId']}}]})[_0xf391('0x20')](function(_0x3b5c72){if(_0x3b5c72){var _0x3da2eb=[];for(var _0x74c89e=0x0,_0x22a899;_0x74c89e<_0x3b5c72[_0xf391('0x3e')];_0x74c89e+=0x1){_0x22a899=_0x3b5c72[_0x74c89e][_0xf391('0x16')]({'plain':!![]});switch(_0x22a899[_0xf391('0x37')]){case _0xf391('0x3a'):_0x41429b(_0x22a899)['catch'](_0x577362());break;case _0xf391('0x3f'):_0x12eb6d(_0x22a899)['catch'](_0x577362());break;default:_0x5996a6[_0xf391('0x27')]['create']({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa[_0xf391('0x30')],'scheduledat':_0x2f7daa[_0xf391('0x1a')]?_0x2f7daa[_0xf391('0x1a')]:moment()[_0xf391('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2f7daa[_0xf391('0x2a')]?_0x2f7daa[_0xf391('0x2a')]:0x2,'callback':_0x2f7daa[_0xf391('0x2b')]?!![]:![],'callbackuniqueid':_0x2f7daa[_0xf391('0x2b')]?_0x2f7daa[_0xf391('0x2b')]:undefined,'callbackat':_0x2f7daa[_0xf391('0x2b')]?moment()[_0xf391('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x22a899['id']})['catch'](_0x577362());}}}});})['then'](function(){return _0x5996a6[_0xf391('0x31')]['findAll']({'attributes':['id'],'include':[{'model':_0x5996a6[_0xf391('0x38')],'as':_0xf391('0x3c'),'where':{'id':_0x2f7daa[_0xf391('0x30')]}}]})[_0xf391('0x20')](function(_0x36d89e){if(_0x36d89e){var _0x4f9cae=[];for(var _0x5b79c5=0x0,_0x287601;_0x5b79c5<_0x36d89e[_0xf391('0x3e')];_0x5b79c5+=0x1){_0x287601=_0x36d89e[_0x5b79c5][_0xf391('0x16')]({'plain':!![]});_0x5996a6['CmHopperBlack'][_0xf391('0x29')]({'phone':_0x2f7daa[_0xf391('0xe')],'ContactId':_0x2f7daa['id'],'ListId':_0x2f7daa[_0xf391('0x30')],'CampaignId':_0x287601['id']})[_0xf391('0x2c')](function(_0x3eebb9){logger['error'](_0xf391('0x40'),'afterCreate',_0x3eebb9['message']);});}}});})[_0xf391('0x20')](function(){_0x31dab6();})[_0xf391('0x2c')](function(_0x379938){logger['error'](_0xf391('0x40'),'afterCreate',_0x379938[_0xf391('0x41')]);_0x31dab6(_0x379938);});}else{_0x31dab6(new Error(_0xf391('0x42')));}},'afterDestroy':function(_0x2e9afe,_0x9d4fba,_0x1ca3b9){var _0x419473=_0x53784b[_0xf391('0x15')];var _0x3fb2be=_0x2e9afe['get']({'plain':!![]});return _0x419473[_0xf391('0x27')][_0xf391('0x36')]({'raw':!![],'where':{'ListId':_0x3fb2be[_0xf391('0x30')],'ContactId':_0x3fb2be['id']}})[_0xf391('0x20')](function(_0x475e3c){if(!_['isEmpty'](_0x475e3c)){var _0x5abea7=[];for(var _0xd56c98=0x0;_0xd56c98<_0x475e3c[_0xf391('0x3e')];_0xd56c98+=0x1){var _0x599804=_0x419473[_0xf391('0x27')][_0xf391('0x43')]({'where':{'ListId':_0x475e3c[_0xd56c98][_0xf391('0x30')],'ContactId':_0x475e3c[_0xd56c98][_0xf391('0x44')],'VoiceQueueId':_0x475e3c[_0xd56c98]['VoiceQueueId'],'CampaignId':_0x475e3c[_0xd56c98][_0xf391('0x45')]}});_0x5abea7[_0xf391('0x46')](_0x599804);}return BPromise[_0xf391('0x47')](_0x5abea7);}})['then'](function(_0x4a3265){logger[_0xf391('0x48')](_0xf391('0x49'),util[_0xf391('0x19')](_0x4a3265,{'showHidden':![],'depth':null}));_0x1ca3b9();})[_0xf391('0x2c')](function(_0x1f5f51){logger[_0xf391('0x17')](_0xf391('0x4a'),util[_0xf391('0x19')](_0x1f5f51,{'showHidden':![],'depth':null}));_0x1ca3b9(_0x1f5f51);});}}});};
\ No newline at end of file
+var _0xca35=['../../config/environment/shared','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','email','FULLTEXT','utf8mb4_unicode_ci','models','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','findAll','CmList','get','CmHopperBlack','message','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x9dfd2a,_0x506da8){var _0x5cd200=function(_0x2b1fa8){while(--_0x2b1fa8){_0x9dfd2a['push'](_0x9dfd2a['shift']());}};_0x5cd200(++_0x506da8);}(_0xca35,0x114));var _0x5ca3=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xca35[_0x575a38];return _0x5a7bdd;};'use strict';var _=require(_0x5ca3('0x0'));var util=require(_0x5ca3('0x1'));var logger=require(_0x5ca3('0x2'))(_0x5ca3('0x3'));var moment=require(_0x5ca3('0x4'));var BPromise=require(_0x5ca3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ca3('0x6'));var rimraf=require('rimraf');var config=require(_0x5ca3('0x7'));var shared=require(_0x5ca3('0x8'));var attributes=require('./cmContact.attributes');module['exports']=function(_0x232663,_0x5bed3d){return _0x232663[_0x5ca3('0x9')](_0x5ca3('0xa'),attributes,{'tableName':_0x5ca3('0xb'),'paranoid':!![],'indexes':[{'name':_0x5ca3('0xc'),'fields':[_0x5ca3('0xc')]},{'name':_0x5ca3('0xd'),'fields':['firstName',_0x5ca3('0xe'),_0x5ca3('0xc'),'mobile','fax',_0x5ca3('0xf')],'type':_0x5ca3('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x5ca3('0x11'),'hooks':{'afterCreate':function(_0x1933da,_0x75a5fa,_0x502c35){var _0x1acdc0=_0x232663[_0x5ca3('0x12')];var _0x16016a=_0x1933da['get']({'plain':!![]});function _0x19f52f(){return function(_0x3ff727){logger[_0x5ca3('0x13')](_0x5ca3('0x14'),_0x5ca3('0x15'),util[_0x5ca3('0x16')](_0x3ff727,{'showHidden':![],'depth':null}));};}function _0x463daf(_0x4f47c3,_0x32e5b4){var _0x4c03a1=_0x32e5b4['scheduledat']?_0x32e5b4[_0x5ca3('0x17')]:moment()[_0x5ca3('0x18')](_0x5ca3('0x19'));return new BPromise(function(_0x13de96,_0x2fa399){if(_[_0x5ca3('0x1a')](_0x32e5b4[_0x5ca3('0x1b')])){_0x13de96({'ret':_0x4c03a1});}else{_0x1acdc0[_0x5ca3('0x1c')][_0x5ca3('0x1d')]({'where':{'id':_0x4f47c3['id']}})['then'](function(_0x1efeca){if(!_['isNil'](_0x1efeca)){var _0x36a4ff=_0x1efeca[_0x5ca3('0x1b')];if(!_[_0x5ca3('0x1a')](_0x36a4ff)){var _0x2b9e42=shared['timezones'];var _0x3510e5=_0x2b9e42[_0x36a4ff];var _0x1269e5=_0x2b9e42[_0x32e5b4['dialTimezone']];if(!_['isNil'](_0x3510e5)&&!_[_0x5ca3('0x1a')](_0x1269e5)){var _0x725035=_0x3510e5[_0x5ca3('0x1e')]-_0x1269e5[_0x5ca3('0x1e')];_0x4c03a1=_0x32e5b4[_0x5ca3('0x17')]?_0x32e5b4[_0x5ca3('0x17')]:moment();var _0x3bf043=moment(_0x4c03a1)[_0x5ca3('0x1f')](_0x725035,_0x5ca3('0x20'));_0x13de96({'ret':_0x3bf043[_0x5ca3('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x13de96({'ret':_0x4c03a1});}else _0x13de96({'ret':_0x4c03a1});}else{_0x13de96({'ret':_0x4c03a1});}});}});return 0xa;}var _0x592b48=function(_0x12cbc0){return new BPromise(function(_0x765ade,_0x53cc5a){_0x463daf(_0x12cbc0,_0x16016a)[_0x5ca3('0x21')](function(_0x4c8760){_0x16016a[_0x5ca3('0x17')]=_0x4c8760[_0x5ca3('0x22')];_0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x1d')]({'where':{'phone':_0x16016a['phone'],'VoiceQueueId':_0x12cbc0['id']}})[_0x5ca3('0x21')](function(_0x1cddb9){if(!_['isNil'](_0x1cddb9)){throw new Error(_0x5ca3('0x24')+_0x16016a[_0x5ca3('0xc')]+_0x5ca3('0x25')+_0x12cbc0['id']);}return _0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x26')]({'phone':_0x16016a[_0x5ca3('0xc')],'ContactId':_0x16016a['id'],'ListId':_0x16016a['ListId'],'priority':_0x16016a['priority']?_0x16016a[_0x5ca3('0x27')]:0x2,'scheduledat':_0x16016a['scheduledat']?_0x16016a[_0x5ca3('0x17')]:moment()['format'](_0x5ca3('0x19')),'callback':_0x16016a[_0x5ca3('0x28')]?!![]:![],'callbackuniqueid':_0x16016a[_0x5ca3('0x28')]?_0x16016a[_0x5ca3('0x28')]:undefined,'callbackat':_0x16016a['callbackUniqueid']?moment()[_0x5ca3('0x18')](_0x5ca3('0x19')):undefined,'VoiceQueueId':_0x12cbc0['id']});})['catch'](function(_0x4d7a3f){_0x53cc5a(_0x4d7a3f);});});});};var _0x4d02df=function(_0x1e6dd3){return new BPromise(function(_0x341036,_0x1cf97f){_0x463daf(_0x1e6dd3,_0x16016a)['then'](function(_0x412cfa){_0x16016a[_0x5ca3('0x17')]=_0x412cfa[_0x5ca3('0x22')];_0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x1d')]({'where':{'phone':_0x16016a[_0x5ca3('0xc')],'VoiceQueueId':_0x1e6dd3['id']}})['then'](function(_0x2a922f){if(!_[_0x5ca3('0x1a')](_0x2a922f)){throw new Error('cmContact,\x20afterCreate\x20'+_0x16016a[_0x5ca3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1e6dd3['id']);}return _0x1acdc0[_0x5ca3('0x29')][_0x5ca3('0x1d')]({'where':{'calleridnum':_0x16016a[_0x5ca3('0xc')],'VoiceQueueId':_0x1e6dd3['id']}});})['then'](function(_0x2a3e29){if(!_[_0x5ca3('0x1a')](_0x2a3e29)){throw new Error(_0x5ca3('0x2a')+_0x16016a['phone']+_0x5ca3('0x2b')+_0x1e6dd3['id']);}return _0x1acdc0[_0x5ca3('0x23')]['create']({'phone':_0x16016a[_0x5ca3('0xc')],'ContactId':_0x16016a['id'],'ListId':_0x16016a[_0x5ca3('0x2c')],'priority':_0x16016a['priority']?_0x16016a[_0x5ca3('0x27')]:0x2,'scheduledat':_0x16016a[_0x5ca3('0x17')]?_0x16016a['scheduledat']:moment()['format'](_0x5ca3('0x19')),'callback':_0x16016a[_0x5ca3('0x28')]?!![]:![],'callbackuniqueid':_0x16016a[_0x5ca3('0x28')]?_0x16016a[_0x5ca3('0x28')]:undefined,'callbackat':_0x16016a['callbackUniqueid']?moment()['format'](_0x5ca3('0x19')):undefined,'VoiceQueueId':_0x1e6dd3['id']});})[_0x5ca3('0x2d')](function(_0x1f2573){_0x1cf97f(_0x1f2573);});});});};function _0x463a16(){return function(_0x43ff68){logger['error'](_0x5ca3('0x14'),'afterCreate',util[_0x5ca3('0x16')](_0x43ff68,{'showHidden':![],'depth':null}));};}function _0x523fcb(_0x3463d2,_0x287845){var _0x33716b=_0x287845['scheduledat']?_0x287845[_0x5ca3('0x17')]:moment()[_0x5ca3('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2558e4,_0x3e6ce8){if(_[_0x5ca3('0x1a')](_0x287845[_0x5ca3('0x1b')])){_0x2558e4({'ret':_0x33716b});}else{_0x1acdc0[_0x5ca3('0x2e')]['findOne']({'where':{'id':_0x3463d2['id']}})[_0x5ca3('0x21')](function(_0x54aeef){if(!_[_0x5ca3('0x1a')](_0x54aeef)){var _0x52c1a7=_0x54aeef[_0x5ca3('0x1b')];if(!_[_0x5ca3('0x1a')](_0x52c1a7)){var _0xabe262=shared[_0x5ca3('0x2f')];var _0x1c94c5=_0xabe262[_0x52c1a7];var _0x1d616c=_0xabe262[_0x287845[_0x5ca3('0x1b')]];if(!_[_0x5ca3('0x1a')](_0x1c94c5)&&!_[_0x5ca3('0x1a')](_0x1d616c)){var _0xe12bd9=_0x1c94c5['utcOffset']-_0x1d616c[_0x5ca3('0x1e')];_0x33716b=_0x287845[_0x5ca3('0x17')]?_0x287845[_0x5ca3('0x17')]:moment();var _0x13cb7b=moment(_0x33716b)[_0x5ca3('0x1f')](_0xe12bd9,'minutes');_0x2558e4({'ret':_0x13cb7b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2558e4({'ret':_0x33716b});}else _0x2558e4({'ret':_0x33716b});}else{_0x2558e4({'ret':_0x33716b});}});}});return 0xa;}var _0x3a3bc3=function(_0x41389c){return new BPromise(function(_0x465fde,_0x3df394){_0x523fcb(_0x41389c,_0x16016a)[_0x5ca3('0x21')](function(_0x2ee42b){_0x16016a[_0x5ca3('0x17')]=_0x2ee42b[_0x5ca3('0x22')];_0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x1d')]({'where':{'phone':_0x16016a[_0x5ca3('0xc')],'CampaignId':_0x41389c['id']}})['then'](function(_0x43feac){if(!_[_0x5ca3('0x1a')](_0x43feac)){throw new Error(_0x5ca3('0x24')+_0x16016a[_0x5ca3('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x41389c['id']);}return _0x1acdc0[_0x5ca3('0x23')]['create']({'phone':_0x16016a[_0x5ca3('0xc')],'ContactId':_0x16016a['id'],'ListId':_0x16016a[_0x5ca3('0x2c')],'priority':_0x16016a['priority']?_0x16016a[_0x5ca3('0x27')]:0x2,'scheduledat':_0x16016a[_0x5ca3('0x17')]?_0x16016a[_0x5ca3('0x17')]:moment()[_0x5ca3('0x18')](_0x5ca3('0x19')),'callback':_0x16016a[_0x5ca3('0x28')]?!![]:![],'callbackuniqueid':_0x16016a['callbackUniqueid']?_0x16016a[_0x5ca3('0x28')]:undefined,'callbackat':_0x16016a['callbackUniqueid']?moment()[_0x5ca3('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x41389c['id']});})['catch'](function(_0x525697){_0x3df394(_0x525697);});});});};var _0xb92656=function(_0x4d5abe){return new BPromise(function(_0x52e570,_0x490f16){_0x523fcb(_0x4d5abe,_0x16016a)[_0x5ca3('0x21')](function(_0x3d6e69){_0x16016a[_0x5ca3('0x17')]=_0x3d6e69[_0x5ca3('0x22')];_0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x1d')]({'where':{'phone':_0x16016a['phone'],'CampaignId':_0x4d5abe['id']}})[_0x5ca3('0x21')](function(_0x4b8c14){if(!_['isNil'](_0x4b8c14)){throw new Error('cmContact,\x20afterCreate\x20'+_0x16016a[_0x5ca3('0xc')]+_0x5ca3('0x30')+_0x4d5abe['id']);}return _0x1acdc0[_0x5ca3('0x29')][_0x5ca3('0x1d')]({'where':{'calleridnum':_0x16016a[_0x5ca3('0xc')],'CampaignId':_0x4d5abe['id']}});})['then'](function(_0x59d58b){if(!_[_0x5ca3('0x1a')](_0x59d58b)){throw new Error(_0x5ca3('0x2a')+_0x16016a[_0x5ca3('0xc')]+_0x5ca3('0x31')+_0x4d5abe['id']);}return _0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x26')]({'phone':_0x16016a[_0x5ca3('0xc')],'ContactId':_0x16016a['id'],'ListId':_0x16016a['ListId'],'priority':_0x16016a[_0x5ca3('0x27')]?_0x16016a[_0x5ca3('0x27')]:0x2,'scheduledat':_0x16016a[_0x5ca3('0x17')]?_0x16016a[_0x5ca3('0x17')]:moment()[_0x5ca3('0x18')](_0x5ca3('0x19')),'callback':_0x16016a[_0x5ca3('0x28')]?!![]:![],'callbackuniqueid':_0x16016a[_0x5ca3('0x28')]?_0x16016a[_0x5ca3('0x28')]:undefined,'callbackat':_0x16016a[_0x5ca3('0x28')]?moment()[_0x5ca3('0x18')](_0x5ca3('0x19')):undefined,'CampaignId':_0x4d5abe['id']});})['catch'](function(_0x22a6c7){_0x490f16(_0x22a6c7);});});});};if(_0x16016a['ListId']){_0x1acdc0[_0x5ca3('0x1c')]['findAll']({'where':{'type':_0x5ca3('0x32')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1acdc0['CmList'],'as':_0x5ca3('0x33'),'where':{'id':_0x16016a[_0x5ca3('0x2c')]}}]})['then'](function(_0x3f2746){if(_0x3f2746){var _0x1bc876=[];for(var _0x2f3683=0x0,_0xc4c6bc;_0x2f3683<_0x3f2746[_0x5ca3('0x34')];_0x2f3683+=0x1){_0xc4c6bc=_0x3f2746[_0x2f3683]['get']({'plain':!![]});switch(_0xc4c6bc[_0x5ca3('0x35')]){case _0x5ca3('0x36'):_0x4d02df(_0xc4c6bc)['catch'](_0x19f52f());break;case _0x5ca3('0x37'):_0x592b48(_0xc4c6bc)[_0x5ca3('0x2d')](_0x19f52f());break;default:_0x523fcb(_0xc4c6bc,_0x16016a)['then'](function(_0x364534){_0x16016a[_0x5ca3('0x17')]=_0x364534[_0x5ca3('0x22')];_0x1acdc0[_0x5ca3('0x23')][_0x5ca3('0x26')]({'phone':_0x16016a['phone'],'ContactId':_0x16016a['id'],'ListId':_0x16016a['ListId'],'scheduledat':_0x16016a[_0x5ca3('0x17')]?_0x16016a[_0x5ca3('0x17')]:moment()[_0x5ca3('0x18')](_0x5ca3('0x19')),'priority':_0x16016a['priority']?_0x16016a['priority']:0x2,'callback':_0x16016a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x16016a[_0x5ca3('0x28')]?_0x16016a[_0x5ca3('0x28')]:undefined,'callbackat':_0x16016a['callbackUniqueid']?moment()[_0x5ca3('0x18')](_0x5ca3('0x19')):undefined,'VoiceQueueId':_0xc4c6bc['id']})['catch'](_0x19f52f());});}}}})[_0x5ca3('0x21')](function(){return _0x1acdc0[_0x5ca3('0x1c')][_0x5ca3('0x38')]({'where':{'type':_0x5ca3('0x32')},'attributes':['id'],'include':[{'model':_0x1acdc0[_0x5ca3('0x39')],'as':'BlackLists','where':{'id':_0x16016a[_0x5ca3('0x2c')]}}]})[_0x5ca3('0x21')](function(_0xe0fe44){if(_0xe0fe44){var _0x368e90=[];for(var _0x370163=0x0,_0x3d4613;_0x370163<_0xe0fe44[_0x5ca3('0x34')];_0x370163+=0x1){_0x3d4613=_0xe0fe44[_0x370163][_0x5ca3('0x3a')]({'plain':!![]});_0x1acdc0[_0x5ca3('0x3b')][_0x5ca3('0x26')]({'phone':_0x16016a[_0x5ca3('0xc')],'ContactId':_0x16016a['id'],'ListId':_0x16016a[_0x5ca3('0x2c')],'VoiceQueueId':_0x3d4613['id']})[_0x5ca3('0x2d')](function(_0x5d8e33){logger['error']('cmContact,\x20%s,\x20%s',_0x5ca3('0x15'),_0x5d8e33[_0x5ca3('0x3c')]);});}}});})['then'](function(){return _0x1acdc0['Campaign'][_0x5ca3('0x38')]({'attributes':['id',_0x5ca3('0x35'),_0x5ca3('0x1b')],'include':[{'model':_0x1acdc0[_0x5ca3('0x39')],'as':'Lists','where':{'id':_0x16016a[_0x5ca3('0x2c')]}}]})[_0x5ca3('0x21')](function(_0x36b27d){if(_0x36b27d){var _0x526b4f=[];for(var _0x4a5523=0x0,_0x49cf07;_0x4a5523<_0x36b27d[_0x5ca3('0x34')];_0x4a5523+=0x1){_0x49cf07=_0x36b27d[_0x4a5523]['get']({'plain':!![]});switch(_0x49cf07[_0x5ca3('0x35')]){case _0x5ca3('0x36'):_0xb92656(_0x49cf07)[_0x5ca3('0x2d')](_0x463a16());break;case _0x5ca3('0x37'):_0x3a3bc3(_0x49cf07)[_0x5ca3('0x2d')](_0x463a16());break;default:_0x1acdc0[_0x5ca3('0x23')]['create']({'phone':_0x16016a[_0x5ca3('0xc')],'ContactId':_0x16016a['id'],'ListId':_0x16016a[_0x5ca3('0x2c')],'scheduledat':_0x16016a['scheduledat']?_0x16016a[_0x5ca3('0x17')]:moment()['format'](_0x5ca3('0x19')),'priority':_0x16016a[_0x5ca3('0x27')]?_0x16016a[_0x5ca3('0x27')]:0x2,'callback':_0x16016a[_0x5ca3('0x28')]?!![]:![],'callbackuniqueid':_0x16016a[_0x5ca3('0x28')]?_0x16016a['callbackUniqueid']:undefined,'callbackat':_0x16016a['callbackUniqueid']?moment()[_0x5ca3('0x18')](_0x5ca3('0x19')):undefined,'CampaignId':_0x49cf07['id']})[_0x5ca3('0x2d')](_0x463a16());}}}});})[_0x5ca3('0x21')](function(){return _0x1acdc0[_0x5ca3('0x2e')][_0x5ca3('0x38')]({'attributes':['id'],'include':[{'model':_0x1acdc0[_0x5ca3('0x39')],'as':'BlackLists','where':{'id':_0x16016a[_0x5ca3('0x2c')]}}]})[_0x5ca3('0x21')](function(_0x1acd17){if(_0x1acd17){var _0x5b5307=[];for(var _0x2d9f68=0x0,_0x260090;_0x2d9f68<_0x1acd17[_0x5ca3('0x34')];_0x2d9f68+=0x1){_0x260090=_0x1acd17[_0x2d9f68][_0x5ca3('0x3a')]({'plain':!![]});_0x1acdc0[_0x5ca3('0x3b')][_0x5ca3('0x26')]({'phone':_0x16016a['phone'],'ContactId':_0x16016a['id'],'ListId':_0x16016a[_0x5ca3('0x2c')],'CampaignId':_0x260090['id']})[_0x5ca3('0x2d')](function(_0x41a140){logger[_0x5ca3('0x13')]('cmContact,\x20%s,\x20%s','afterCreate',_0x41a140[_0x5ca3('0x3c')]);});}}});})[_0x5ca3('0x21')](function(){_0x502c35();})[_0x5ca3('0x2d')](function(_0x435921){logger[_0x5ca3('0x13')](_0x5ca3('0x3d'),_0x5ca3('0x15'),_0x435921['message']);_0x502c35(_0x435921);});}else{_0x502c35(new Error(_0x5ca3('0x3e')));}},'afterDestroy':function(_0x1da58f,_0x4e00ff,_0x5a004d){var _0x5e9126=_0x232663['models'];var _0x105d17=_0x1da58f['get']({'plain':!![]});return _0x5e9126[_0x5ca3('0x23')]['findAll']({'raw':!![],'where':{'ListId':_0x105d17[_0x5ca3('0x2c')],'ContactId':_0x105d17['id']}})[_0x5ca3('0x21')](function(_0x185840){if(!_[_0x5ca3('0x3f')](_0x185840)){var _0x13d7d3=[];for(var _0x11320b=0x0;_0x11320b<_0x185840[_0x5ca3('0x34')];_0x11320b+=0x1){var _0x38240d=_0x5e9126[_0x5ca3('0x23')][_0x5ca3('0x40')]({'where':{'ListId':_0x185840[_0x11320b][_0x5ca3('0x2c')],'ContactId':_0x185840[_0x11320b][_0x5ca3('0x41')],'VoiceQueueId':_0x185840[_0x11320b][_0x5ca3('0x42')],'CampaignId':_0x185840[_0x11320b][_0x5ca3('0x43')]}});_0x13d7d3[_0x5ca3('0x44')](_0x38240d);}return BPromise['all'](_0x13d7d3);}})[_0x5ca3('0x21')](function(_0x4339a6){logger[_0x5ca3('0x45')]('[CmContact][afterDestroy][Succesfull]',util[_0x5ca3('0x16')](_0x4339a6,{'showHidden':![],'depth':null}));_0x5a004d();})[_0x5ca3('0x2d')](function(_0x182507){logger[_0x5ca3('0x13')](_0x5ca3('0x46'),util[_0x5ca3('0x16')](_0x182507,{'showHidden':![],'depth':null}));_0x5a004d(_0x182507);});}}});};
\ No newline at end of file
index 97b9c3a..752a8f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0xff7097,_0x1b4adf){var _0xca73d4=function(_0x1f9847){while(--_0x1f9847){_0xff7097['push'](_0xff7097['shift']());}};_0xca73d4(++_0x1b4adf);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6<Object[_0x7995('0x32')](_0x5e67fe['body'])[_0x7995('0x26')];_0xf612e6++){var _0x235df7=Object[_0x7995('0x32')](_0x5e67fe[_0x7995('0x31')])[_0xf612e6];if(_0x235df7[_0x7995('0x33')](_0x7995('0x34'))){_0x242713=squel['update']()[_0x7995('0x35')](_0x7995('0x36'))[_0x7995('0x37')](_0x235df7,_0x5e67fe[_0x7995('0x31')][_0x235df7])[_0x7995('0x38')](_0x7995('0x39'),_0x2d4285['id'])[_0x7995('0x3a')]();break;}}if(!_0x242713)return _0x2d4285;return db[_0x7995('0x3b')][_0x7995('0x3c')](_0x242713)[_0x7995('0x12')](function(){return _0x2d4285;});})[_0x7995('0x12')](function(_0x270d52){logger[_0x7995('0x13')]('CreateCmContact',_0x5e67fe);logger['debug'](_0x7995('0x2f'),_0x5e67fe,JSON[_0x7995('0x18')](_0x270d52));_0x3e99cd(_0x270d52);})['catch'](function(_0x4b0855){logger[_0x7995('0x1a')]('CreateCmContact',_0x4b0855['message'],_0x5e67fe);_0xe328b1(_0x5d2428[_0x7995('0x1a')](0x1f4,_0x4b0855[_0x7995('0x1b')]));});});};
\ No newline at end of file
+var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x38dffd,_0x5b760e){var _0x45cf26=function(_0x58485e){while(--_0x58485e){_0x38dffd['push'](_0x38dffd['shift']());}};_0x45cf26(++_0x5b760e);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6<Object[_0x7995('0x32')](_0x5e67fe['body'])[_0x7995('0x26')];_0xf612e6++){var _0x235df7=Object[_0x7995('0x32')](_0x5e67fe[_0x7995('0x31')])[_0xf612e6];if(_0x235df7[_0x7995('0x33')](_0x7995('0x34'))){_0x242713=squel['update']()[_0x7995('0x35')](_0x7995('0x36'))[_0x7995('0x37')](_0x235df7,_0x5e67fe[_0x7995('0x31')][_0x235df7])[_0x7995('0x38')](_0x7995('0x39'),_0x2d4285['id'])[_0x7995('0x3a')]();break;}}if(!_0x242713)return _0x2d4285;return db[_0x7995('0x3b')][_0x7995('0x3c')](_0x242713)[_0x7995('0x12')](function(){return _0x2d4285;});})[_0x7995('0x12')](function(_0x270d52){logger[_0x7995('0x13')]('CreateCmContact',_0x5e67fe);logger['debug'](_0x7995('0x2f'),_0x5e67fe,JSON[_0x7995('0x18')](_0x270d52));_0x3e99cd(_0x270d52);})['catch'](function(_0x4b0855){logger[_0x7995('0x1a')]('CreateCmContact',_0x4b0855['message'],_0x5e67fe);_0xe328b1(_0x5d2428[_0x7995('0x1a')](0x1f4,_0x4b0855[_0x7995('0x1b')]));});});};
\ No newline at end of file
index 99fa9eb..a221f74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','cmContact:','./cmContact.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var CmContactEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){CmContactEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);CmContactEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','cmContact:','./cmContact.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var CmContactEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){CmContactEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);CmContactEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index c7253b5..0c6b0e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x2c9db4,_0x3bf59a){var _0x5df3f8=function(_0x1411c0){while(--_0x1411c0){_0x2c9db4['push'](_0x2c9db4['shift']());}};_0x5df3f8(++_0x3bf59a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router;
\ No newline at end of file
+var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x49bb58,_0x19a34d){var _0x3be1cc=function(_0x2d458e){while(--_0x2d458e){_0x49bb58['push'](_0x49bb58['shift']());}};_0x3be1cc(++_0x19a34d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router;
\ No newline at end of file
index 278833c..cc7d927 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7333=['sequelize','INTEGER','STRING','PHONE'];(function(_0x4a0332,_0x41eb99){var _0x1c903c=function(_0x5ac087){while(--_0x5ac087){_0x4a0332['push'](_0x4a0332['shift']());}};_0x1c903c(++_0x41eb99);}(_0x7333,0xfc));var _0x3733=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7333[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x3733('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x3733('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3733('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3733('0x2')],'defaultValue':_0x3733('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x3733('0x2')],'defaultValue':null}};
\ No newline at end of file
+var _0xd6ce=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x3c8bca,_0xcec1b8){var _0x517e5f=function(_0x5d3170){while(--_0x5d3170){_0x3c8bca['push'](_0x3c8bca['shift']());}};_0x517e5f(++_0xcec1b8);}(_0xd6ce,0x127));var _0xed6c=function(_0x3ea901,_0x4f19d0){_0x3ea901=_0x3ea901-0x0;var _0x417085=_0xd6ce[_0x3ea901];return _0x417085;};'use strict';var Sequelize=require(_0xed6c('0x0'));module[_0xed6c('0x1')]={'CmContactId':{'type':Sequelize[_0xed6c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xed6c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xed6c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xed6c('0x3')],'defaultValue':_0xed6c('0x4')},'OrderBy':{'type':Sequelize[_0xed6c('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}};
\ No newline at end of file
index ec97365..f907a15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63f2=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasItem','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','length','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x11e256,_0x377789){var _0x9f3d3a=function(_0x17097a){while(--_0x17097a){_0x11e256['push'](_0x11e256['shift']());}};_0x9f3d3a(++_0x377789);}(_0x63f2,0x151));var _0x263f=function(_0x583a6b,_0x2dd911){_0x583a6b=_0x583a6b-0x0;var _0x3485fd=_0x63f2[_0x583a6b];return _0x3485fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x263f('0x0'));var zipdir=require(_0x263f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x263f('0x2'));var BPromise=require(_0x263f('0x3'));var Mustache=require(_0x263f('0x4'));var util=require(_0x263f('0x5'));var path=require(_0x263f('0x6'));var sox=require(_0x263f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x263f('0x8'));var _=require(_0x263f('0x9'));var squel=require('squel');var crypto=require(_0x263f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x263f('0xb'));var toCsv=require(_0x263f('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x263f('0xd'));var authService=require(_0x263f('0xe'));var qs=require(_0x263f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x263f('0x10'));var logger=require(_0x263f('0x11'))(_0x263f('0x12'));var utils=require(_0x263f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x263f('0x14'));var db=require(_0x263f('0x15'))['db'];function respondWithStatusCode(_0x26e020,_0x88caa6){_0x88caa6=_0x88caa6||0xcc;return function(_0x59a27e){if(_0x59a27e){return _0x26e020[_0x263f('0x16')](_0x88caa6);}return _0x26e020['status'](_0x88caa6)[_0x263f('0x17')]();};}function respondWithResult(_0x3c8950,_0x2e1972){_0x2e1972=_0x2e1972||0xc8;return function(_0x191174){if(_0x191174){return _0x3c8950[_0x263f('0x18')](_0x2e1972)[_0x263f('0x19')](_0x191174);}};}function respondWithFilteredResult(_0x1710d1,_0x24d74d){return function(_0x3784bf){if(_0x3784bf){var _0x47d883=typeof _0x24d74d[_0x263f('0x1a')]===_0x263f('0x1b')&&typeof _0x24d74d[_0x263f('0x1c')]===_0x263f('0x1b');var _0x33b3cd=_0x3784bf[_0x263f('0x1d')];var _0x101e7d=_0x47d883?0x0:_0x24d74d[_0x263f('0x1a')];var _0x3eb58e=_0x47d883?_0x3784bf[_0x263f('0x1d')]:_0x24d74d['offset']+_0x24d74d[_0x263f('0x1c')];var _0x43a62c;if(_0x3eb58e>=_0x33b3cd){_0x3eb58e=_0x33b3cd;_0x43a62c=0xc8;}else{_0x43a62c=0xce;}_0x1710d1[_0x263f('0x18')](_0x43a62c);return _0x1710d1[_0x263f('0x1e')](_0x263f('0x1f'),_0x101e7d+'-'+_0x3eb58e+'/'+_0x33b3cd)[_0x263f('0x19')](_0x3784bf);}return null;};}function patchUpdates(_0x2bc188){return function(_0x4303f2){try{jsonpatch[_0x263f('0x20')](_0x4303f2,_0x2bc188,!![]);}catch(_0x36444f){return BPromise[_0x263f('0x21')](_0x36444f);}return _0x4303f2[_0x263f('0x22')]();};}function saveUpdates(_0x39d11f,_0x31ef6b){return function(_0x344394){if(_0x344394){return _0x344394['update'](_0x39d11f)['then'](function(_0x47cb3c){return _0x47cb3c;});}return null;};}function removeEntity(_0x4e525f,_0x296b34){return function(_0x8accee){if(_0x8accee){return _0x8accee['destroy']()[_0x263f('0x23')](function(){var _0x485d1c=_0x8accee['get']({'plain':!![]});var _0x3a3da3=_0x263f('0x24');return db[_0x263f('0x25')][_0x263f('0x26')]({'where':{'type':_0x3a3da3,'resourceId':_0x485d1c['id']}})[_0x263f('0x23')](function(){return _0x8accee;});})[_0x263f('0x23')](function(){_0x4e525f[_0x263f('0x18')](0xcc)[_0x263f('0x17')]();});}};}function handleEntityNotFound(_0xca3d01,_0x17654c){return function(_0x211e27){if(!_0x211e27){_0xca3d01['sendStatus'](0x194);}return _0x211e27;};}function handleError(_0x5857e5,_0x1500a4){_0x1500a4=_0x1500a4||0x1f4;return function(_0x209dec){logger[_0x263f('0x27')](_0x209dec[_0x263f('0x28')]);if(_0x209dec['name']){delete _0x209dec[_0x263f('0x29')];}_0x5857e5['status'](_0x1500a4)[_0x263f('0x2a')](_0x209dec);};}exports[_0x263f('0x2b')]=function(_0x747985,_0x21e1e5){var _0x235130={},_0x4bb1ff={},_0x4ea109={'count':0x0,'rows':[]};var _0x1e627b=_[_0x263f('0x2c')](db[_0x263f('0x2d')]['rawAttributes'],function(_0x38a1ff){return{'name':_0x38a1ff[_0x263f('0x2e')],'type':_0x38a1ff[_0x263f('0x2f')][_0x263f('0x30')]};});_0x4bb1ff['model']=_[_0x263f('0x2c')](_0x1e627b,_0x263f('0x29'));_0x4bb1ff['query']=_[_0x263f('0x31')](_0x747985[_0x263f('0x32')]);_0x4bb1ff[_0x263f('0x33')]=_[_0x263f('0x34')](_0x4bb1ff['model'],_0x4bb1ff[_0x263f('0x32')]);_0x235130['attributes']=_[_0x263f('0x34')](_0x4bb1ff[_0x263f('0x35')],qs[_0x263f('0x36')](_0x747985[_0x263f('0x32')][_0x263f('0x36')]));_0x235130['attributes']=_0x235130[_0x263f('0x37')]['length']?_0x235130[_0x263f('0x37')]:_0x4bb1ff[_0x263f('0x35')];if(!_0x747985[_0x263f('0x32')]['hasOwnProperty']('nolimit')){_0x235130[_0x263f('0x1c')]=qs['limit'](_0x747985[_0x263f('0x32')][_0x263f('0x1c')]);_0x235130[_0x263f('0x1a')]=qs[_0x263f('0x1a')](_0x747985[_0x263f('0x32')]['offset']);}_0x235130[_0x263f('0x38')]=qs[_0x263f('0x39')](_0x747985['query'][_0x263f('0x39')]);_0x235130[_0x263f('0x3a')]=qs[_0x263f('0x33')](_[_0x263f('0x3b')](_0x747985[_0x263f('0x32')],_0x4bb1ff[_0x263f('0x33')]),_0x1e627b);if(_0x747985[_0x263f('0x32')]['filter']){_0x235130[_0x263f('0x3a')]=_['merge'](_0x235130['where'],{'$or':_[_0x263f('0x2c')](_0x1e627b,function(_0x6e9409){if(_0x6e9409[_0x263f('0x2f')]!==_0x263f('0x3c')){var _0x3e1739={};_0x3e1739[_0x6e9409[_0x263f('0x29')]]={'$like':'%'+_0x747985['query'][_0x263f('0x3d')]+'%'};return _0x3e1739;}})});}_0x235130=_[_0x263f('0x3e')]({},_0x235130,_0x747985[_0x263f('0x3f')]);var _0x4dc0e0={'where':_0x235130['where']};return db[_0x263f('0x2d')][_0x263f('0x1d')](_0x4dc0e0)[_0x263f('0x23')](function(_0x57e3f3){_0x4ea109[_0x263f('0x1d')]=_0x57e3f3;if(_0x747985['query'][_0x263f('0x40')]){_0x235130['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x263f('0x41')](_0x235130);})[_0x263f('0x23')](function(_0x3cc72c){_0x4ea109[_0x263f('0x42')]=_0x3cc72c;return _0x4ea109;})[_0x263f('0x23')](respondWithFilteredResult(_0x21e1e5,_0x235130))['catch'](handleError(_0x21e1e5,null));};exports[_0x263f('0x43')]=function(_0x54c3d8,_0x1fe695){var _0x10d2eb={'raw':!![],'where':{'id':_0x54c3d8['params']['id']}},_0x40b776={};_0x40b776[_0x263f('0x35')]=_[_0x263f('0x31')](db[_0x263f('0x2d')][_0x263f('0x44')]);_0x40b776['query']=_[_0x263f('0x31')](_0x54c3d8['query']);_0x40b776[_0x263f('0x33')]=_[_0x263f('0x34')](_0x40b776[_0x263f('0x35')],_0x40b776['query']);_0x10d2eb['attributes']=_['intersection'](_0x40b776[_0x263f('0x35')],qs[_0x263f('0x36')](_0x54c3d8[_0x263f('0x32')][_0x263f('0x36')]));_0x10d2eb['attributes']=_0x10d2eb[_0x263f('0x37')][_0x263f('0x45')]?_0x10d2eb[_0x263f('0x37')]:_0x40b776[_0x263f('0x35')];if(_0x54c3d8['query']['includeAll']){_0x10d2eb[_0x263f('0x46')]=[{'all':!![]}];}_0x10d2eb=_['merge']({},_0x10d2eb,_0x54c3d8['options']);return db['CmContactHasItem'][_0x263f('0x47')](_0x10d2eb)[_0x263f('0x23')](handleEntityNotFound(_0x1fe695,null))[_0x263f('0x23')](respondWithResult(_0x1fe695,null))[_0x263f('0x48')](handleError(_0x1fe695,null));};exports[_0x263f('0x49')]=function(_0x126c24,_0x32c54e){return db[_0x263f('0x2d')][_0x263f('0x49')](_0x126c24[_0x263f('0x4a')],{})['then'](function(_0x2950f0){var _0x97d265=_0x126c24[_0x263f('0x4b')][_0x263f('0x4c')]({'plain':!![]});if(!_0x97d265)throw new Error(_0x263f('0x4d'));if(_0x97d265['role']==='user'){var _0x3fd65b=_0x2950f0[_0x263f('0x4c')]({'plain':!![]});var _0x50697a=_0x263f('0x24');return db[_0x263f('0x4e')]['find']({'where':{'name':_0x50697a,'userProfileId':_0x97d265[_0x263f('0x4f')]},'raw':!![]})[_0x263f('0x23')](function(_0x502b23){if(_0x502b23&&_0x502b23[_0x263f('0x50')]===0x0){return db[_0x263f('0x25')][_0x263f('0x49')]({'name':_0x3fd65b[_0x263f('0x29')],'resourceId':_0x3fd65b['id'],'type':_0x502b23[_0x263f('0x29')],'sectionId':_0x502b23['id']},{})[_0x263f('0x23')](function(){return _0x2950f0;});}else{return _0x2950f0;}})[_0x263f('0x48')](function(_0x31c71d){logger[_0x263f('0x27')](_0x263f('0x51'),_0x31c71d);throw _0x31c71d;});}return _0x2950f0;})[_0x263f('0x23')](respondWithResult(_0x32c54e,0xc9))[_0x263f('0x48')](handleError(_0x32c54e,null));};exports[_0x263f('0x52')]=function(_0x787617,_0x3a5151){if(_0x787617[_0x263f('0x4a')]['id']){delete _0x787617['body']['id'];}return db[_0x263f('0x2d')][_0x263f('0x47')]({'where':{'id':_0x787617['params']['id']}})[_0x263f('0x23')](handleEntityNotFound(_0x3a5151,null))[_0x263f('0x23')](saveUpdates(_0x787617[_0x263f('0x4a')],null))[_0x263f('0x23')](respondWithResult(_0x3a5151,null))[_0x263f('0x48')](handleError(_0x3a5151,null));};exports[_0x263f('0x26')]=function(_0x526fe5,_0x330c9a){return db[_0x263f('0x2d')]['find']({'where':{'id':_0x526fe5['params']['id']}})[_0x263f('0x23')](handleEntityNotFound(_0x330c9a,null))[_0x263f('0x23')](removeEntity(_0x330c9a,null))[_0x263f('0x48')](handleError(_0x330c9a,null));};
\ No newline at end of file
+var _0xfb91=['include','CmContactHasItem','findAll','rows','catch','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','pick','filters','filter','merge','options','includeAll'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfb91,0xf8));var _0x1fb9=function(_0x1cd4e0,_0x38e794){_0x1cd4e0=_0x1cd4e0-0x0;var _0x509b43=_0xfb91[_0x1cd4e0];return _0x509b43;};'use strict';var emlformat=require(_0x1fb9('0x0'));var rimraf=require(_0x1fb9('0x1'));var zipdir=require(_0x1fb9('0x2'));var jsonpatch=require(_0x1fb9('0x3'));var rp=require(_0x1fb9('0x4'));var moment=require(_0x1fb9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1fb9('0x6'));var util=require(_0x1fb9('0x7'));var path=require(_0x1fb9('0x8'));var sox=require(_0x1fb9('0x9'));var csv=require(_0x1fb9('0xa'));var ejs=require(_0x1fb9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fb9('0xc'));var squel=require(_0x1fb9('0xd'));var crypto=require(_0x1fb9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1fb9('0xf'));var toCsv=require(_0x1fb9('0xa'));var querystring=require('querystring');var Papa=require(_0x1fb9('0x10'));var Redis=require(_0x1fb9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1fb9('0x12'));var hardwareService=require(_0x1fb9('0x13'));var logger=require(_0x1fb9('0x14'))(_0x1fb9('0x15'));var utils=require('../../config/utils');var config=require(_0x1fb9('0x16'));var licenseUtil=require(_0x1fb9('0x17'));var db=require(_0x1fb9('0x18'))['db'];function respondWithStatusCode(_0x4d204e,_0x1da0dc){_0x1da0dc=_0x1da0dc||0xcc;return function(_0x2bb476){if(_0x2bb476){return _0x4d204e[_0x1fb9('0x19')](_0x1da0dc);}return _0x4d204e[_0x1fb9('0x1a')](_0x1da0dc)[_0x1fb9('0x1b')]();};}function respondWithResult(_0x219915,_0x456489){_0x456489=_0x456489||0xc8;return function(_0x1c0674){if(_0x1c0674){return _0x219915[_0x1fb9('0x1a')](_0x456489)['json'](_0x1c0674);}};}function respondWithFilteredResult(_0x252259,_0x37db46){return function(_0x2eb445){if(_0x2eb445){var _0x212657=typeof _0x37db46[_0x1fb9('0x1c')]===_0x1fb9('0x1d')&&typeof _0x37db46['limit']===_0x1fb9('0x1d');var _0x164da8=_0x2eb445['count'];var _0x1d4f0a=_0x212657?0x0:_0x37db46[_0x1fb9('0x1c')];var _0xc6b3ce=_0x212657?_0x2eb445[_0x1fb9('0x1e')]:_0x37db46[_0x1fb9('0x1c')]+_0x37db46[_0x1fb9('0x1f')];var _0x1fd9e6;if(_0xc6b3ce>=_0x164da8){_0xc6b3ce=_0x164da8;_0x1fd9e6=0xc8;}else{_0x1fd9e6=0xce;}_0x252259[_0x1fb9('0x1a')](_0x1fd9e6);return _0x252259['set']('Content-Range',_0x1d4f0a+'-'+_0xc6b3ce+'/'+_0x164da8)['json'](_0x2eb445);}return null;};}function patchUpdates(_0x17b50f){return function(_0x575ecc){try{jsonpatch[_0x1fb9('0x20')](_0x575ecc,_0x17b50f,!![]);}catch(_0x37d18e){return BPromise[_0x1fb9('0x21')](_0x37d18e);}return _0x575ecc[_0x1fb9('0x22')]();};}function saveUpdates(_0x127ff,_0x3cc93b){return function(_0x27d476){if(_0x27d476){return _0x27d476[_0x1fb9('0x23')](_0x127ff)[_0x1fb9('0x24')](function(_0x2c0847){return _0x2c0847;});}return null;};}function removeEntity(_0x4e9292,_0x9f6101){return function(_0x40558f){if(_0x40558f){return _0x40558f['destroy']()[_0x1fb9('0x24')](function(){var _0x30e127=_0x40558f[_0x1fb9('0x25')]({'plain':!![]});var _0x462016=_0x1fb9('0x26');return db[_0x1fb9('0x27')][_0x1fb9('0x28')]({'where':{'type':_0x462016,'resourceId':_0x30e127['id']}})[_0x1fb9('0x24')](function(){return _0x40558f;});})[_0x1fb9('0x24')](function(){_0x4e9292[_0x1fb9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4275bf,_0x442e73){return function(_0x46eafa){if(!_0x46eafa){_0x4275bf[_0x1fb9('0x19')](0x194);}return _0x46eafa;};}function handleError(_0x5e03f8,_0x1df0de){_0x1df0de=_0x1df0de||0x1f4;return function(_0x40a1a8){logger[_0x1fb9('0x29')](_0x40a1a8[_0x1fb9('0x2a')]);if(_0x40a1a8['name']){delete _0x40a1a8[_0x1fb9('0x2b')];}_0x5e03f8[_0x1fb9('0x1a')](_0x1df0de)['send'](_0x40a1a8);};}exports['index']=function(_0xd8b205,_0x21e13c){var _0x52d94c={},_0x23274b={},_0x59e2a8={'count':0x0,'rows':[]};var _0x1a6c09=_['map'](db['CmContactHasItem'][_0x1fb9('0x2c')],function(_0x3d549d){return{'name':_0x3d549d[_0x1fb9('0x2d')],'type':_0x3d549d[_0x1fb9('0x2e')]['key']};});_0x23274b['model']=_[_0x1fb9('0x2f')](_0x1a6c09,_0x1fb9('0x2b'));_0x23274b[_0x1fb9('0x30')]=_[_0x1fb9('0x31')](_0xd8b205['query']);_0x23274b['filters']=_[_0x1fb9('0x32')](_0x23274b[_0x1fb9('0x33')],_0x23274b[_0x1fb9('0x30')]);_0x52d94c[_0x1fb9('0x34')]=_[_0x1fb9('0x32')](_0x23274b[_0x1fb9('0x33')],qs[_0x1fb9('0x35')](_0xd8b205[_0x1fb9('0x30')]['fields']));_0x52d94c[_0x1fb9('0x34')]=_0x52d94c['attributes'][_0x1fb9('0x36')]?_0x52d94c['attributes']:_0x23274b['model'];if(!_0xd8b205[_0x1fb9('0x30')]['hasOwnProperty']('nolimit')){_0x52d94c[_0x1fb9('0x1f')]=qs[_0x1fb9('0x1f')](_0xd8b205['query'][_0x1fb9('0x1f')]);_0x52d94c[_0x1fb9('0x1c')]=qs[_0x1fb9('0x1c')](_0xd8b205['query']['offset']);}_0x52d94c[_0x1fb9('0x37')]=qs[_0x1fb9('0x38')](_0xd8b205[_0x1fb9('0x30')]['sort']);_0x52d94c[_0x1fb9('0x39')]=qs['filters'](_[_0x1fb9('0x3a')](_0xd8b205[_0x1fb9('0x30')],_0x23274b[_0x1fb9('0x3b')]),_0x1a6c09);if(_0xd8b205[_0x1fb9('0x30')][_0x1fb9('0x3c')]){_0x52d94c[_0x1fb9('0x39')]=_['merge'](_0x52d94c[_0x1fb9('0x39')],{'$or':_[_0x1fb9('0x2f')](_0x1a6c09,function(_0x128ae8){if(_0x128ae8[_0x1fb9('0x2e')]!=='VIRTUAL'){var _0x5acdc7={};_0x5acdc7[_0x128ae8[_0x1fb9('0x2b')]]={'$like':'%'+_0xd8b205[_0x1fb9('0x30')][_0x1fb9('0x3c')]+'%'};return _0x5acdc7;}})});}_0x52d94c=_[_0x1fb9('0x3d')]({},_0x52d94c,_0xd8b205[_0x1fb9('0x3e')]);var _0x36f70d={'where':_0x52d94c[_0x1fb9('0x39')]};return db['CmContactHasItem']['count'](_0x36f70d)[_0x1fb9('0x24')](function(_0x7b3494){_0x59e2a8['count']=_0x7b3494;if(_0xd8b205['query'][_0x1fb9('0x3f')]){_0x52d94c[_0x1fb9('0x40')]=[{'all':!![]}];}return db[_0x1fb9('0x41')][_0x1fb9('0x42')](_0x52d94c);})[_0x1fb9('0x24')](function(_0x3ab168){_0x59e2a8[_0x1fb9('0x43')]=_0x3ab168;return _0x59e2a8;})[_0x1fb9('0x24')](respondWithFilteredResult(_0x21e13c,_0x52d94c))[_0x1fb9('0x44')](handleError(_0x21e13c,null));};exports['show']=function(_0x1dbeea,_0x576202){var _0x3da94c={'raw':!![],'where':{'id':_0x1dbeea['params']['id']}},_0x360bdc={};_0x360bdc[_0x1fb9('0x33')]=_[_0x1fb9('0x31')](db[_0x1fb9('0x41')][_0x1fb9('0x2c')]);_0x360bdc[_0x1fb9('0x30')]=_['keys'](_0x1dbeea[_0x1fb9('0x30')]);_0x360bdc[_0x1fb9('0x3b')]=_[_0x1fb9('0x32')](_0x360bdc['model'],_0x360bdc[_0x1fb9('0x30')]);_0x3da94c[_0x1fb9('0x34')]=_['intersection'](_0x360bdc[_0x1fb9('0x33')],qs['fields'](_0x1dbeea[_0x1fb9('0x30')][_0x1fb9('0x35')]));_0x3da94c[_0x1fb9('0x34')]=_0x3da94c[_0x1fb9('0x34')]['length']?_0x3da94c[_0x1fb9('0x34')]:_0x360bdc[_0x1fb9('0x33')];if(_0x1dbeea[_0x1fb9('0x30')]['includeAll']){_0x3da94c[_0x1fb9('0x40')]=[{'all':!![]}];}_0x3da94c=_[_0x1fb9('0x3d')]({},_0x3da94c,_0x1dbeea[_0x1fb9('0x3e')]);return db['CmContactHasItem'][_0x1fb9('0x45')](_0x3da94c)[_0x1fb9('0x24')](handleEntityNotFound(_0x576202,null))[_0x1fb9('0x24')](respondWithResult(_0x576202,null))[_0x1fb9('0x44')](handleError(_0x576202,null));};exports['create']=function(_0x24b159,_0x255dd4){return db[_0x1fb9('0x41')]['create'](_0x24b159[_0x1fb9('0x46')],{})['then'](function(_0x436a9a){var _0x42fa85=_0x24b159[_0x1fb9('0x47')][_0x1fb9('0x25')]({'plain':!![]});if(!_0x42fa85)throw new Error(_0x1fb9('0x48'));if(_0x42fa85['role']===_0x1fb9('0x47')){var _0x273f0d=_0x436a9a[_0x1fb9('0x25')]({'plain':!![]});var _0x4e1bb7='CmContactHasItems';return db[_0x1fb9('0x49')][_0x1fb9('0x45')]({'where':{'name':_0x4e1bb7,'userProfileId':_0x42fa85['userProfileId']},'raw':!![]})['then'](function(_0x4a831e){if(_0x4a831e&&_0x4a831e[_0x1fb9('0x4a')]===0x0){return db[_0x1fb9('0x27')][_0x1fb9('0x4b')]({'name':_0x273f0d[_0x1fb9('0x2b')],'resourceId':_0x273f0d['id'],'type':_0x4a831e[_0x1fb9('0x2b')],'sectionId':_0x4a831e['id']},{})['then'](function(){return _0x436a9a;});}else{return _0x436a9a;}})[_0x1fb9('0x44')](function(_0x3c808d){logger[_0x1fb9('0x29')](_0x1fb9('0x4c'),_0x3c808d);throw _0x3c808d;});}return _0x436a9a;})[_0x1fb9('0x24')](respondWithResult(_0x255dd4,0xc9))[_0x1fb9('0x44')](handleError(_0x255dd4,null));};exports[_0x1fb9('0x23')]=function(_0x2a671c,_0x2e6ff1){if(_0x2a671c[_0x1fb9('0x46')]['id']){delete _0x2a671c['body']['id'];}return db[_0x1fb9('0x41')][_0x1fb9('0x45')]({'where':{'id':_0x2a671c[_0x1fb9('0x4d')]['id']}})[_0x1fb9('0x24')](handleEntityNotFound(_0x2e6ff1,null))[_0x1fb9('0x24')](saveUpdates(_0x2a671c[_0x1fb9('0x46')],null))[_0x1fb9('0x24')](respondWithResult(_0x2e6ff1,null))[_0x1fb9('0x44')](handleError(_0x2e6ff1,null));};exports[_0x1fb9('0x28')]=function(_0x410e83,_0x3cd67d){return db[_0x1fb9('0x41')][_0x1fb9('0x45')]({'where':{'id':_0x410e83[_0x1fb9('0x4d')]['id']}})[_0x1fb9('0x24')](handleEntityNotFound(_0x3cd67d,null))['then'](removeEntity(_0x3cd67d,null))[_0x1fb9('0x44')](handleError(_0x3cd67d,null));};
\ No newline at end of file
index 1f47e39..7a45288 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe263=['request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','util','moment'];(function(_0x39efab,_0x5f33d3){var _0x1eca5b=function(_0x25c6cf){while(--_0x25c6cf){_0x39efab['push'](_0x39efab['shift']());}};_0x1eca5b(++_0x5f33d3);}(_0xe263,0x94));var _0x3e26=function(_0x1af684,_0x84a5ef){_0x1af684=_0x1af684-0x0;var _0x40c954=_0xe263[_0x1af684];return _0x40c954;};'use strict';var _=require('lodash');var util=require(_0x3e26('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3e26('0x1'));var BPromise=require('bluebird');var rp=require(_0x3e26('0x2'));var fs=require('fs');var path=require(_0x3e26('0x3'));var rimraf=require(_0x3e26('0x4'));var config=require(_0x3e26('0x5'));var attributes=require(_0x3e26('0x6'));module[_0x3e26('0x7')]=function(_0x28fd57,_0x5880d7){return _0x28fd57[_0x3e26('0x8')]('CmContactHasItem',attributes,{'tableName':_0x3e26('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbe0c=['rimraf','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0xbe0c,0x155));var _0xcbe0=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0xbe0c[_0x43b5a7];return _0x5461fe;};'use strict';var _=require(_0xcbe0('0x0'));var util=require(_0xcbe0('0x1'));var logger=require('../../config/logger')(_0xcbe0('0x2'));var moment=require(_0xcbe0('0x3'));var BPromise=require(_0xcbe0('0x4'));var rp=require(_0xcbe0('0x5'));var fs=require('fs');var path=require(_0xcbe0('0x6'));var rimraf=require(_0xcbe0('0x7'));var config=require('../../config/environment');var attributes=require(_0xcbe0('0x8'));module[_0xcbe0('0x9')]=function(_0x38c2ed,_0x5a0eaa){return _0x38c2ed['define'](_0xcbe0('0xa'),attributes,{'tableName':_0xcbe0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 67cb12e..f080b7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ee1=['request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bcb4e,_0x453b69){var _0x881e05=function(_0x303756){while(--_0x303756){_0x2bcb4e['push'](_0x2bcb4e['shift']());}};_0x881e05(++_0x453b69);}(_0x9ee1,0x186));var _0x19ee=function(_0x3865cd,_0x19b938){_0x3865cd=_0x3865cd-0x0;var _0x219ab3=_0x9ee1[_0x3865cd];return _0x219ab3;};'use strict';var _=require(_0x19ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x19ee('0x1'));var fs=require('fs');var Redis=require(_0x19ee('0x2'));var db=require(_0x19ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x19ee('0x4'))(_0x19ee('0x5'));var config=require(_0x19ee('0x6'));var jayson=require(_0x19ee('0x7'));var client=jayson[_0x19ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5162c2,_0x1f9fa2,_0x10ad45){return new BPromise(function(_0x31ee48,_0x5c57a7){return client[_0x19ee('0x9')](_0x5162c2,_0x10ad45)[_0x19ee('0xa')](function(_0x1fe315){logger[_0x19ee('0xb')](_0x19ee('0xc'),_0x1f9fa2,_0x19ee('0xd'));logger[_0x19ee('0xe')](_0x19ee('0xf'),_0x1f9fa2,_0x19ee('0xd'),JSON[_0x19ee('0x10')](_0x1fe315));if(_0x1fe315[_0x19ee('0x11')]){if(_0x1fe315[_0x19ee('0x11')][_0x19ee('0x12')]===0x1f4){logger[_0x19ee('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x1f9fa2,_0x1fe315[_0x19ee('0x11')][_0x19ee('0x13')]);return _0x5c57a7(_0x1fe315[_0x19ee('0x11')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x1f9fa2,_0x1fe315[_0x19ee('0x11')][_0x19ee('0x13')]);return _0x31ee48(_0x1fe315[_0x19ee('0x11')]['message']);}else{logger[_0x19ee('0xb')](_0x19ee('0xc'),_0x1f9fa2,'request\x20sent');_0x31ee48(_0x1fe315[_0x19ee('0x14')]['message']);}})['catch'](function(_0x11894e){logger[_0x19ee('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x1f9fa2,_0x11894e);_0x5c57a7(_0x11894e);});});}
\ No newline at end of file
+var _0x7901=['../../config/logger','rpc','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c388d,_0x3f8896){var _0x1e2278=function(_0x29f715){while(--_0x29f715){_0x2c388d['push'](_0x2c388d['shift']());}};_0x1e2278(++_0x3f8896);}(_0x7901,0xc8));var _0x1790=function(_0x5d1d5c,_0x479079){_0x5d1d5c=_0x5d1d5c-0x0;var _0x5eae72=_0x7901[_0x5d1d5c];return _0x5eae72;};'use strict';var _=require(_0x1790('0x0'));var util=require(_0x1790('0x1'));var moment=require(_0x1790('0x2'));var BPromise=require('bluebird');var rs=require(_0x1790('0x3'));var fs=require('fs');var Redis=require(_0x1790('0x4'));var db=require(_0x1790('0x5'))['db'];var utils=require(_0x1790('0x6'));var logger=require(_0x1790('0x7'))(_0x1790('0x8'));var config=require('../../config/environment');var jayson=require(_0x1790('0x9'));var client=jayson['client'][_0x1790('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1979b4,_0x3ad5cb,_0x10189a){return new BPromise(function(_0xd07ed2,_0x256fe1){return client[_0x1790('0xb')](_0x1979b4,_0x10189a)[_0x1790('0xc')](function(_0x17c9cd){logger[_0x1790('0xd')](_0x1790('0xe'),_0x3ad5cb,_0x1790('0xf'));logger['debug'](_0x1790('0x10'),_0x3ad5cb,_0x1790('0xf'),JSON[_0x1790('0x11')](_0x17c9cd));if(_0x17c9cd[_0x1790('0x12')]){if(_0x17c9cd[_0x1790('0x12')][_0x1790('0x13')]===0x1f4){logger[_0x1790('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x3ad5cb,_0x17c9cd[_0x1790('0x12')][_0x1790('0x14')]);return _0x256fe1(_0x17c9cd[_0x1790('0x12')]['message']);}logger[_0x1790('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x3ad5cb,_0x17c9cd[_0x1790('0x12')]['message']);return _0xd07ed2(_0x17c9cd['error']['message']);}else{logger[_0x1790('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x3ad5cb,_0x1790('0xf'));_0xd07ed2(_0x17c9cd[_0x1790('0x15')][_0x1790('0x14')]);}})[_0x1790('0x16')](function(_0x47d226){logger[_0x1790('0x12')](_0x1790('0xe'),_0x3ad5cb,_0x47d226);_0x256fe1(_0x47d226);});});}
\ No newline at end of file
index 25e81e1..781d1a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2584=['Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','show','post','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x10bfd7,_0x38dd2d){var _0x4a1015=function(_0x513232){while(--_0x513232){_0x10bfd7['push'](_0x10bfd7['shift']());}};_0x4a1015(++_0x38dd2d);}(_0x2584,0x155));var _0x4258=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x2584[_0x204eb7];return _0x37e444;};'use strict';var multer=require(_0x4258('0x0'));var util=require('util');var path=require(_0x4258('0x1'));var timeout=require(_0x4258('0x2'));var express=require(_0x4258('0x3'));var router=express[_0x4258('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4258('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4258('0x6'));var controller=require(_0x4258('0x7'));router['get']('/',auth[_0x4258('0x8')](),controller['index']);router['get']('/:id',auth[_0x4258('0x8')](),controller[_0x4258('0x9')]);router[_0x4258('0xa')]('/',auth[_0x4258('0x8')](),controller['create']);router['put'](_0x4258('0xb'),auth[_0x4258('0x8')](),controller[_0x4258('0xc')]);router[_0x4258('0xd')](_0x4258('0xb'),auth[_0x4258('0x8')](),controller['destroy']);module[_0x4258('0xe')]=router;
\ No newline at end of file
+var _0x36da=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x424d84,_0x1ae7b3){var _0x470900=function(_0x5c5eb8){while(--_0x5c5eb8){_0x424d84['push'](_0x424d84['shift']());}};_0x470900(++_0x1ae7b3);}(_0x36da,0x154));var _0xa36d=function(_0x2b63c9,_0x9b77ef){_0x2b63c9=_0x2b63c9-0x0;var _0x5928c6=_0x36da[_0x2b63c9];return _0x5928c6;};'use strict';var multer=require(_0xa36d('0x0'));var util=require(_0xa36d('0x1'));var path=require(_0xa36d('0x2'));var timeout=require(_0xa36d('0x3'));var express=require(_0xa36d('0x4'));var router=express[_0xa36d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa36d('0x6'));var interaction=require(_0xa36d('0x7'));var config=require('../../config/environment');var controller=require(_0xa36d('0x8'));router[_0xa36d('0x9')]('/',auth[_0xa36d('0xa')](),controller[_0xa36d('0xb')]);router[_0xa36d('0x9')](_0xa36d('0xc'),auth[_0xa36d('0xa')](),controller['show']);router[_0xa36d('0xd')]('/',auth[_0xa36d('0xa')](),controller[_0xa36d('0xe')]);router[_0xa36d('0xf')](_0xa36d('0xc'),auth[_0xa36d('0xa')](),controller[_0xa36d('0x10')]);router[_0xa36d('0x11')](_0xa36d('0xc'),auth[_0xa36d('0xa')](),controller[_0xa36d('0x12')]);module[_0xa36d('0x13')]=router;
\ No newline at end of file
index 5358f48..6ae6262 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x73b1=['exports','VIRTUAL','getDataValue','alias','STRING','type','select','values','BOOLEAN','voice','lodash'];(function(_0x4897b0,_0x120200){var _0x171c64=function(_0x237d62){while(--_0x237d62){_0x4897b0['push'](_0x4897b0['shift']());}};_0x171c64(++_0x120200);}(_0x73b1,0x112));var _0x173b=function(_0x59d6a3,_0x2eac3c){_0x59d6a3=_0x59d6a3-0x0;var _0x50627f=_0x73b1[_0x59d6a3];return _0x50627f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x173b('0x0'));module[_0x173b('0x1')]={'name':{'type':Sequelize[_0x173b('0x2')],'get':function(_0x418aff){return this[_0x173b('0x3')](_0x173b('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x81825b){this['setDataValue']('alias',_0x81825b?_0x81825b:this[_0x173b('0x3')]('name'));}},'type':{'type':Sequelize[_0x173b('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0x173b('0x6'))===_0x173b('0x7')){return JSON['parse'](this[_0x173b('0x3')](_0x173b('0x8')));}else{return this[_0x173b('0x3')](_0x173b('0x8'));}},'set':function(_0x14c353){if(Array['isArray'](_0x14c353)){this['setDataValue'](_0x173b('0x8'),JSON['stringify'](_0x14c353));}else{this['setDataValue'](_0x173b('0x8'),_0x14c353);}}},'required':{'type':Sequelize[_0x173b('0x9')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x173b('0x9')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x173b('0xa'))}};
\ No newline at end of file
+var _0x5920=['long','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','getDataValue','alias','setDataValue','name','STRING','TEXT'];(function(_0x427db6,_0xac1f2c){var _0x3a7fea=function(_0x127234){while(--_0x127234){_0x427db6['push'](_0x427db6['shift']());}};_0x3a7fea(++_0xac1f2c);}(_0x5920,0x1e5));var _0x0592=function(_0x33cea7,_0x42af9d){_0x33cea7=_0x33cea7-0x0;var _0x2b0452=_0x5920[_0x33cea7];return _0x2b0452;};'use strict';var Sequelize=require(_0x0592('0x0'));var _=require(_0x0592('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x38a33d){return this[_0x0592('0x2')](_0x0592('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x213548){this[_0x0592('0x4')](_0x0592('0x3'),_0x213548?_0x213548:this[_0x0592('0x2')](_0x0592('0x5')));}},'type':{'type':Sequelize[_0x0592('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x0592('0x7')](_0x0592('0x8')),'get':function(){if(this[_0x0592('0x2')]('type')===_0x0592('0x9')){return JSON[_0x0592('0xa')](this['getDataValue'](_0x0592('0xb')));}else{return this[_0x0592('0x2')](_0x0592('0xb'));}},'set':function(_0x11e380){if(Array[_0x0592('0xc')](_0x11e380)){this[_0x0592('0x4')](_0x0592('0xb'),JSON[_0x0592('0xd')](_0x11e380));}else{this[_0x0592('0x4')](_0x0592('0xb'),_0x11e380);}}},'required':{'type':Sequelize[_0x0592('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0592('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0592('0xf')](_0x0592('0x10'))}};
\ No newline at end of file
index 628f980..243289f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26c1=['rows','catch','params','options','find','body','create','sequelize','transaction','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','name','query','keys','attributes','intersection','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','include','findAll'];(function(_0x574483,_0x5c618f){var _0x398515=function(_0x56ab02){while(--_0x56ab02){_0x574483['push'](_0x574483['shift']());}};_0x398515(++_0x5c618f);}(_0x26c1,0x161));var _0x126c=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x26c1[_0x11f0e3];return _0x2892e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x126c('0x0'));var zipdir=require(_0x126c('0x1'));var jsonpatch=require(_0x126c('0x2'));var rp=require(_0x126c('0x3'));var moment=require(_0x126c('0x4'));var BPromise=require(_0x126c('0x5'));var Mustache=require(_0x126c('0x6'));var util=require(_0x126c('0x7'));var path=require(_0x126c('0x8'));var sox=require(_0x126c('0x9'));var csv=require(_0x126c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x126c('0xb'));var _=require(_0x126c('0xc'));var squel=require(_0x126c('0xd'));var crypto=require(_0x126c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x126c('0xa'));var querystring=require(_0x126c('0xf'));var Papa=require(_0x126c('0x10'));var Redis=require('ioredis');var authService=require(_0x126c('0x11'));var qs=require(_0x126c('0x12'));var as=require(_0x126c('0x13'));var hardwareService=require(_0x126c('0x14'));var logger=require(_0x126c('0x15'))(_0x126c('0x16'));var utils=require(_0x126c('0x17'));var config=require(_0x126c('0x18'));var licenseUtil=require(_0x126c('0x19'));var db=require(_0x126c('0x1a'))['db'];function respondWithStatusCode(_0xd604d2,_0x48ece5){_0x48ece5=_0x48ece5||0xcc;return function(_0x353636){if(_0x353636){return _0xd604d2[_0x126c('0x1b')](_0x48ece5);}return _0xd604d2['status'](_0x48ece5)['end']();};}function respondWithResult(_0x31442f,_0x235fa8){_0x235fa8=_0x235fa8||0xc8;return function(_0x2aed80){if(_0x2aed80){return _0x31442f[_0x126c('0x1c')](_0x235fa8)[_0x126c('0x1d')](_0x2aed80);}};}function respondWithFilteredResult(_0x509c93,_0x341e7f){return function(_0x16709f){if(_0x16709f){var _0x15bb3a=typeof _0x341e7f[_0x126c('0x1e')]==='undefined'&&typeof _0x341e7f[_0x126c('0x1f')]===_0x126c('0x20');var _0x48b521=_0x16709f[_0x126c('0x21')];var _0x2fd80a=_0x15bb3a?0x0:_0x341e7f[_0x126c('0x1e')];var _0x371baf=_0x15bb3a?_0x16709f[_0x126c('0x21')]:_0x341e7f[_0x126c('0x1e')]+_0x341e7f[_0x126c('0x1f')];var _0x5bacd6;if(_0x371baf>=_0x48b521){_0x371baf=_0x48b521;_0x5bacd6=0xc8;}else{_0x5bacd6=0xce;}_0x509c93[_0x126c('0x1c')](_0x5bacd6);return _0x509c93['set'](_0x126c('0x22'),_0x2fd80a+'-'+_0x371baf+'/'+_0x48b521)[_0x126c('0x1d')](_0x16709f);}return null;};}function patchUpdates(_0x402c65){return function(_0x3631c7){try{jsonpatch['apply'](_0x3631c7,_0x402c65,!![]);}catch(_0x9330fb){return BPromise[_0x126c('0x23')](_0x9330fb);}return _0x3631c7[_0x126c('0x24')]();};}function saveUpdates(_0x1265d9,_0x40107e){return function(_0x190ed7){if(_0x190ed7){return _0x190ed7[_0x126c('0x25')](_0x1265d9)[_0x126c('0x26')](function(_0x4a89da){return _0x4a89da;});}return null;};}function removeEntity(_0x4b86a9,_0x484a3a){return function(_0x535d81){if(_0x535d81){return _0x535d81[_0x126c('0x27')]()[_0x126c('0x26')](function(){_0x4b86a9[_0x126c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507159,_0x4c19ac){return function(_0x3c31d8){if(!_0x3c31d8){_0x507159[_0x126c('0x1b')](0x194);}return _0x3c31d8;};}function handleError(_0x791aba,_0x574d86){_0x574d86=_0x574d86||0x1f4;return function(_0x48e2fa){logger[_0x126c('0x28')](_0x48e2fa[_0x126c('0x29')]);if(_0x48e2fa['name']){delete _0x48e2fa['name'];}_0x791aba[_0x126c('0x1c')](_0x574d86)[_0x126c('0x2a')](_0x48e2fa);};}exports['index']=function(_0x1b3dcb,_0x55f94f){var _0x51018={},_0x24ed45={},_0x484295={'count':0x0,'rows':[]};var _0x1428b9=_[_0x126c('0x2b')](db[_0x126c('0x2c')][_0x126c('0x2d')],function(_0x9e7e15){return{'name':_0x9e7e15[_0x126c('0x2e')],'type':_0x9e7e15[_0x126c('0x2f')][_0x126c('0x30')]};});_0x24ed45[_0x126c('0x31')]=_[_0x126c('0x32')](_[_0x126c('0x2b')](_0x1428b9,_0x126c('0x33')),[_0x126c('0x33')]);_0x24ed45[_0x126c('0x34')]=_[_0x126c('0x35')](_0x1b3dcb[_0x126c('0x34')]);_0x24ed45['filters']=_['intersection'](_0x24ed45[_0x126c('0x31')],_0x24ed45['query']);_0x51018[_0x126c('0x36')]=_[_0x126c('0x37')](_0x24ed45['model'],qs[_0x126c('0x38')](_0x1b3dcb[_0x126c('0x34')]['fields']));_0x51018[_0x126c('0x36')]=_0x51018[_0x126c('0x36')][_0x126c('0x39')]?_0x51018[_0x126c('0x36')]:_0x24ed45[_0x126c('0x31')];if(!_0x1b3dcb[_0x126c('0x34')]['hasOwnProperty'](_0x126c('0x3a'))){_0x51018[_0x126c('0x1f')]=qs['limit'](_0x1b3dcb[_0x126c('0x34')][_0x126c('0x1f')]);_0x51018[_0x126c('0x1e')]=qs[_0x126c('0x1e')](_0x1b3dcb['query'][_0x126c('0x1e')]);}_0x51018['order']=qs[_0x126c('0x3b')](_0x1b3dcb[_0x126c('0x34')][_0x126c('0x3b')]);_0x51018['where']=qs['filters'](_['pick'](_0x1b3dcb['query'],_0x24ed45[_0x126c('0x3c')]),_0x1428b9);if(_0x1b3dcb[_0x126c('0x34')][_0x126c('0x3d')]){_0x51018[_0x126c('0x3e')]=_[_0x126c('0x3f')](_0x51018[_0x126c('0x3e')],{'$or':_[_0x126c('0x2b')](_0x1428b9,function(_0x2d1db4){if(_0x2d1db4[_0x126c('0x2f')]!==_0x126c('0x40')){var _0x1045aa={};_0x1045aa[_0x2d1db4[_0x126c('0x33')]]={'$like':'%'+_0x1b3dcb['query'][_0x126c('0x3d')]+'%'};return _0x1045aa;}})});}_0x51018=_[_0x126c('0x3f')]({},_0x51018,_0x1b3dcb['options']);var _0x3ab526={'where':_0x51018['where']};return db[_0x126c('0x2c')][_0x126c('0x21')](_0x3ab526)[_0x126c('0x26')](function(_0xa5dc68){_0x484295['count']=_0xa5dc68;if(_0x1b3dcb[_0x126c('0x34')]['includeAll']){_0x51018[_0x126c('0x41')]=[{'all':!![]}];}return db[_0x126c('0x2c')][_0x126c('0x42')](_0x51018);})['then'](function(_0x1786ec){_0x484295[_0x126c('0x43')]=_0x1786ec;return _0x484295;})['then'](respondWithFilteredResult(_0x55f94f,_0x51018))[_0x126c('0x44')](handleError(_0x55f94f,null));};exports['show']=function(_0x1cc8f2,_0x567334){var _0xbbfa88={'raw':!![],'where':{'id':_0x1cc8f2[_0x126c('0x45')]['id']}},_0x2d9155={};_0x2d9155['model']=_[_0x126c('0x35')](db[_0x126c('0x2c')][_0x126c('0x2d')]);_0x2d9155[_0x126c('0x34')]=_[_0x126c('0x35')](_0x1cc8f2[_0x126c('0x34')]);_0x2d9155[_0x126c('0x3c')]=_[_0x126c('0x37')](_0x2d9155[_0x126c('0x31')],_0x2d9155[_0x126c('0x34')]);_0xbbfa88[_0x126c('0x36')]=_['intersection'](_0x2d9155[_0x126c('0x31')],qs[_0x126c('0x38')](_0x1cc8f2[_0x126c('0x34')][_0x126c('0x38')]));_0xbbfa88[_0x126c('0x36')]=_0xbbfa88[_0x126c('0x36')][_0x126c('0x39')]?_0xbbfa88[_0x126c('0x36')]:_0x2d9155[_0x126c('0x31')];if(_0x1cc8f2[_0x126c('0x34')]['includeAll']){_0xbbfa88[_0x126c('0x41')]=[{'all':!![]}];}_0xbbfa88=_[_0x126c('0x3f')]({},_0xbbfa88,_0x1cc8f2[_0x126c('0x46')]);return db[_0x126c('0x2c')][_0x126c('0x47')](_0xbbfa88)[_0x126c('0x26')](handleEntityNotFound(_0x567334,null))[_0x126c('0x26')](respondWithResult(_0x567334,null))[_0x126c('0x44')](handleError(_0x567334,null));};exports[_0x126c('0x25')]=function(_0x572c79,_0x15e2ab){if(_0x572c79[_0x126c('0x48')]['id']){delete _0x572c79[_0x126c('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x572c79[_0x126c('0x45')]['id']}})[_0x126c('0x26')](handleEntityNotFound(_0x15e2ab,null))['then'](saveUpdates(_0x572c79['body'],null))[_0x126c('0x26')](respondWithResult(_0x15e2ab,null))[_0x126c('0x44')](handleError(_0x15e2ab,null));};exports[_0x126c('0x27')]=function(_0xa0d6a9,_0x17a078){return db['CmCustomField']['find']({'where':{'id':_0xa0d6a9[_0x126c('0x45')]['id']}})[_0x126c('0x26')](handleEntityNotFound(_0x17a078,null))['then'](removeEntity(_0x17a078,null))[_0x126c('0x44')](handleError(_0x17a078,null));};exports[_0x126c('0x49')]=function(_0x8a582e,_0x2a8dc5){var _0x543923;return db[_0x126c('0x4a')][_0x126c('0x4b')](function(_0x363502){return db[_0x126c('0x2c')][_0x126c('0x49')](_0x8a582e[_0x126c('0x48')],{'transaction':_0x363502})[_0x126c('0x26')](function(_0x25e2a5){_0x543923=_0x25e2a5;var _0x4cad84={'type':db[_0x126c('0x4c')][_0x126c('0x4d')],'transaction':_0x363502};switch(_0x8a582e[_0x126c('0x48')]['type']){case'text':_0x4cad84[_0x126c('0x2f')]=db[_0x126c('0x4c')][_0x126c('0x4d')];break;case _0x126c('0x4e'):_0x4cad84[_0x126c('0x2f')]=db[_0x126c('0x4c')]['INTEGER'];break;case'switch':_0x4cad84[_0x126c('0x2f')]=db[_0x126c('0x4c')][_0x126c('0x4f')];_0x4cad84[_0x126c('0x50')]=![];break;default:}return db[_0x126c('0x4a')][_0x126c('0x51')][_0x126c('0x52')](_0x126c('0x53'),util['format']('cf_%d',_0x543923['id']),_0x4cad84);})[_0x126c('0x26')](function(){return _0x543923;});})[_0x126c('0x26')](respondWithResult(_0x2a8dc5,0xc9))[_0x126c('0x44')](handleError(_0x2a8dc5,null));};
\ No newline at end of file
+var _0x43da=['number','INTEGER','switch','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','show','params','keys','includeAll','body','find','catch','destroy','create','sequelize','transaction','Sequelize','TEXT','text'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x43da,0xb8));var _0xa43d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x43da[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xa43d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa43d('0x1'));var jsonpatch=require(_0xa43d('0x2'));var rp=require('request-promise');var moment=require(_0xa43d('0x3'));var BPromise=require(_0xa43d('0x4'));var Mustache=require(_0xa43d('0x5'));var util=require(_0xa43d('0x6'));var path=require(_0xa43d('0x7'));var sox=require(_0xa43d('0x8'));var csv=require(_0xa43d('0x9'));var ejs=require(_0xa43d('0xa'));var fs=require('fs');var fs_extra=require(_0xa43d('0xb'));var _=require(_0xa43d('0xc'));var squel=require(_0xa43d('0xd'));var crypto=require(_0xa43d('0xe'));var jsforce=require(_0xa43d('0xf'));var deskjs=require(_0xa43d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa43d('0x11'));var Papa=require('papaparse');var Redis=require(_0xa43d('0x12'));var authService=require(_0xa43d('0x13'));var qs=require(_0xa43d('0x14'));var as=require(_0xa43d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa43d('0x16'))(_0xa43d('0x17'));var utils=require(_0xa43d('0x18'));var config=require(_0xa43d('0x19'));var licenseUtil=require(_0xa43d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3900a8,_0x22e336){_0x22e336=_0x22e336||0xcc;return function(_0x1040f1){if(_0x1040f1){return _0x3900a8[_0xa43d('0x1b')](_0x22e336);}return _0x3900a8[_0xa43d('0x1c')](_0x22e336)[_0xa43d('0x1d')]();};}function respondWithResult(_0x41ac0e,_0x4037a3){_0x4037a3=_0x4037a3||0xc8;return function(_0x4b16cd){if(_0x4b16cd){return _0x41ac0e['status'](_0x4037a3)[_0xa43d('0x1e')](_0x4b16cd);}};}function respondWithFilteredResult(_0x59836a,_0x5de0af){return function(_0x4fc356){if(_0x4fc356){var _0x582364=typeof _0x5de0af[_0xa43d('0x1f')]===_0xa43d('0x20')&&typeof _0x5de0af[_0xa43d('0x21')]==='undefined';var _0x107b4b=_0x4fc356[_0xa43d('0x22')];var _0x334ac6=_0x582364?0x0:_0x5de0af[_0xa43d('0x1f')];var _0xbef79d=_0x582364?_0x4fc356[_0xa43d('0x22')]:_0x5de0af[_0xa43d('0x1f')]+_0x5de0af[_0xa43d('0x21')];var _0x2eae60;if(_0xbef79d>=_0x107b4b){_0xbef79d=_0x107b4b;_0x2eae60=0xc8;}else{_0x2eae60=0xce;}_0x59836a[_0xa43d('0x1c')](_0x2eae60);return _0x59836a['set'](_0xa43d('0x23'),_0x334ac6+'-'+_0xbef79d+'/'+_0x107b4b)[_0xa43d('0x1e')](_0x4fc356);}return null;};}function patchUpdates(_0x3c1a51){return function(_0x5aa739){try{jsonpatch['apply'](_0x5aa739,_0x3c1a51,!![]);}catch(_0x4ddced){return BPromise[_0xa43d('0x24')](_0x4ddced);}return _0x5aa739['save']();};}function saveUpdates(_0x2008cd,_0x1d1c8c){return function(_0x5c72bf){if(_0x5c72bf){return _0x5c72bf[_0xa43d('0x25')](_0x2008cd)[_0xa43d('0x26')](function(_0x453efa){return _0x453efa;});}return null;};}function removeEntity(_0x382b3c,_0xcc04a0){return function(_0x21ba90){if(_0x21ba90){return _0x21ba90['destroy']()[_0xa43d('0x26')](function(){_0x382b3c[_0xa43d('0x1c')](0xcc)[_0xa43d('0x1d')]();});}};}function handleEntityNotFound(_0x507e9e,_0x1ba546){return function(_0x51b50b){if(!_0x51b50b){_0x507e9e[_0xa43d('0x1b')](0x194);}return _0x51b50b;};}function handleError(_0x5669b3,_0x14142e){_0x14142e=_0x14142e||0x1f4;return function(_0x5b7549){logger[_0xa43d('0x27')](_0x5b7549[_0xa43d('0x28')]);if(_0x5b7549[_0xa43d('0x29')]){delete _0x5b7549[_0xa43d('0x29')];}_0x5669b3[_0xa43d('0x1c')](_0x14142e)[_0xa43d('0x2a')](_0x5b7549);};}exports[_0xa43d('0x2b')]=function(_0x2c90af,_0x96b1a7){var _0x429adb={},_0x4437e3={},_0x3138b0={'count':0x0,'rows':[]};var _0x5b300e=_[_0xa43d('0x2c')](db[_0xa43d('0x2d')][_0xa43d('0x2e')],function(_0x2ffe54){return{'name':_0x2ffe54['fieldName'],'type':_0x2ffe54['type'][_0xa43d('0x2f')]};});_0x4437e3[_0xa43d('0x30')]=_[_0xa43d('0x31')](_['map'](_0x5b300e,_0xa43d('0x29')),[_0xa43d('0x29')]);_0x4437e3['query']=_['keys'](_0x2c90af[_0xa43d('0x32')]);_0x4437e3[_0xa43d('0x33')]=_[_0xa43d('0x34')](_0x4437e3[_0xa43d('0x30')],_0x4437e3[_0xa43d('0x32')]);_0x429adb[_0xa43d('0x35')]=_[_0xa43d('0x34')](_0x4437e3[_0xa43d('0x30')],qs[_0xa43d('0x36')](_0x2c90af[_0xa43d('0x32')]['fields']));_0x429adb['attributes']=_0x429adb['attributes'][_0xa43d('0x37')]?_0x429adb[_0xa43d('0x35')]:_0x4437e3[_0xa43d('0x30')];if(!_0x2c90af[_0xa43d('0x32')][_0xa43d('0x38')]('nolimit')){_0x429adb[_0xa43d('0x21')]=qs[_0xa43d('0x21')](_0x2c90af['query'][_0xa43d('0x21')]);_0x429adb[_0xa43d('0x1f')]=qs[_0xa43d('0x1f')](_0x2c90af['query'][_0xa43d('0x1f')]);}_0x429adb[_0xa43d('0x39')]=qs[_0xa43d('0x3a')](_0x2c90af['query'][_0xa43d('0x3a')]);_0x429adb[_0xa43d('0x3b')]=qs[_0xa43d('0x33')](_['pick'](_0x2c90af[_0xa43d('0x32')],_0x4437e3['filters']),_0x5b300e);if(_0x2c90af[_0xa43d('0x32')]['filter']){_0x429adb['where']=_[_0xa43d('0x3c')](_0x429adb[_0xa43d('0x3b')],{'$or':_[_0xa43d('0x2c')](_0x5b300e,function(_0x10dca2){if(_0x10dca2[_0xa43d('0x3d')]!==_0xa43d('0x3e')){var _0x3c9fe0={};_0x3c9fe0[_0x10dca2[_0xa43d('0x29')]]={'$like':'%'+_0x2c90af[_0xa43d('0x32')][_0xa43d('0x3f')]+'%'};return _0x3c9fe0;}})});}_0x429adb=_[_0xa43d('0x3c')]({},_0x429adb,_0x2c90af[_0xa43d('0x40')]);var _0x112a2c={'where':_0x429adb['where']};return db[_0xa43d('0x2d')][_0xa43d('0x22')](_0x112a2c)[_0xa43d('0x26')](function(_0xc36694){_0x3138b0[_0xa43d('0x22')]=_0xc36694;if(_0x2c90af[_0xa43d('0x32')]['includeAll']){_0x429adb['include']=[{'all':!![]}];}return db[_0xa43d('0x2d')][_0xa43d('0x41')](_0x429adb);})[_0xa43d('0x26')](function(_0x129753){_0x3138b0['rows']=_0x129753;return _0x3138b0;})['then'](respondWithFilteredResult(_0x96b1a7,_0x429adb))['catch'](handleError(_0x96b1a7,null));};exports[_0xa43d('0x42')]=function(_0x1f3199,_0x3a3965){var _0x494366={'raw':!![],'where':{'id':_0x1f3199[_0xa43d('0x43')]['id']}},_0x3eefe2={};_0x3eefe2[_0xa43d('0x30')]=_[_0xa43d('0x44')](db[_0xa43d('0x2d')][_0xa43d('0x2e')]);_0x3eefe2['query']=_['keys'](_0x1f3199[_0xa43d('0x32')]);_0x3eefe2[_0xa43d('0x33')]=_['intersection'](_0x3eefe2['model'],_0x3eefe2['query']);_0x494366[_0xa43d('0x35')]=_[_0xa43d('0x34')](_0x3eefe2['model'],qs[_0xa43d('0x36')](_0x1f3199[_0xa43d('0x32')][_0xa43d('0x36')]));_0x494366[_0xa43d('0x35')]=_0x494366['attributes']['length']?_0x494366[_0xa43d('0x35')]:_0x3eefe2[_0xa43d('0x30')];if(_0x1f3199[_0xa43d('0x32')][_0xa43d('0x45')]){_0x494366['include']=[{'all':!![]}];}_0x494366=_[_0xa43d('0x3c')]({},_0x494366,_0x1f3199[_0xa43d('0x40')]);return db[_0xa43d('0x2d')]['find'](_0x494366)[_0xa43d('0x26')](handleEntityNotFound(_0x3a3965,null))[_0xa43d('0x26')](respondWithResult(_0x3a3965,null))['catch'](handleError(_0x3a3965,null));};exports['update']=function(_0x278659,_0x40e717){if(_0x278659[_0xa43d('0x46')]['id']){delete _0x278659[_0xa43d('0x46')]['id'];}return db['CmCustomField'][_0xa43d('0x47')]({'where':{'id':_0x278659['params']['id']}})['then'](handleEntityNotFound(_0x40e717,null))[_0xa43d('0x26')](saveUpdates(_0x278659[_0xa43d('0x46')],null))[_0xa43d('0x26')](respondWithResult(_0x40e717,null))[_0xa43d('0x48')](handleError(_0x40e717,null));};exports[_0xa43d('0x49')]=function(_0x5180cd,_0x1005bf){return db[_0xa43d('0x2d')][_0xa43d('0x47')]({'where':{'id':_0x5180cd[_0xa43d('0x43')]['id']}})[_0xa43d('0x26')](handleEntityNotFound(_0x1005bf,null))[_0xa43d('0x26')](removeEntity(_0x1005bf,null))[_0xa43d('0x48')](handleError(_0x1005bf,null));};exports[_0xa43d('0x4a')]=function(_0x1ffb48,_0x4e28b6){var _0x5046f0;return db[_0xa43d('0x4b')][_0xa43d('0x4c')](function(_0x5d8fd3){return db[_0xa43d('0x2d')][_0xa43d('0x4a')](_0x1ffb48['body'],{'transaction':_0x5d8fd3})[_0xa43d('0x26')](function(_0xa5d1d4){_0x5046f0=_0xa5d1d4;var _0x507c1c={'type':db[_0xa43d('0x4d')][_0xa43d('0x4e')],'transaction':_0x5d8fd3};switch(_0x1ffb48[_0xa43d('0x46')][_0xa43d('0x3d')]){case _0xa43d('0x4f'):_0x507c1c['type']=db[_0xa43d('0x4d')]['TEXT'];break;case _0xa43d('0x50'):_0x507c1c[_0xa43d('0x3d')]=db[_0xa43d('0x4d')][_0xa43d('0x51')];break;case _0xa43d('0x52'):_0x507c1c['type']=db[_0xa43d('0x4d')]['BOOLEAN'];_0x507c1c[_0xa43d('0x53')]=![];break;default:}return db[_0xa43d('0x4b')][_0xa43d('0x54')][_0xa43d('0x55')]('cm_contacts',util[_0xa43d('0x56')](_0xa43d('0x57'),_0x5046f0['id']),_0x507c1c);})[_0xa43d('0x26')](function(){return _0x5046f0;});})['then'](respondWithResult(_0x4e28b6,0xc9))[_0xa43d('0x48')](handleError(_0x4e28b6,null));};
\ No newline at end of file
index 76cb198..3dfd47d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1821=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','cm_custom_fields','lodash'];(function(_0x37e99c,_0x26aaa9){var _0x24699d=function(_0x51d092){while(--_0x51d092){_0x37e99c['push'](_0x37e99c['shift']());}};_0x24699d(++_0x26aaa9);}(_0x1821,0xc5));var _0x1182=function(_0x318426,_0x1283a6){_0x318426=_0x318426-0x0;var _0x5697f0=_0x1821[_0x318426];return _0x5697f0;};'use strict';var _=require(_0x1182('0x0'));var util=require(_0x1182('0x1'));var logger=require(_0x1182('0x2'))(_0x1182('0x3'));var moment=require('moment');var BPromise=require(_0x1182('0x4'));var rp=require(_0x1182('0x5'));var fs=require('fs');var path=require(_0x1182('0x6'));var rimraf=require(_0x1182('0x7'));var config=require(_0x1182('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x1182('0x9')]=function(_0x500db5,_0x2045b5){return _0x500db5['define']('CmCustomField',attributes,{'tableName':_0x1182('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x371f=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','define'];(function(_0x247ed6,_0x3a2005){var _0x2ad171=function(_0x218e04){while(--_0x218e04){_0x247ed6['push'](_0x247ed6['shift']());}};_0x2ad171(++_0x3a2005);}(_0x371f,0x13a));var _0xf371=function(_0x14d23a,_0x19f334){_0x14d23a=_0x14d23a-0x0;var _0x5afb61=_0x371f[_0x14d23a];return _0x5afb61;};'use strict';var _=require(_0xf371('0x0'));var util=require(_0xf371('0x1'));var logger=require(_0xf371('0x2'))(_0xf371('0x3'));var moment=require(_0xf371('0x4'));var BPromise=require('bluebird');var rp=require(_0xf371('0x5'));var fs=require('fs');var path=require(_0xf371('0x6'));var rimraf=require('rimraf');var config=require(_0xf371('0x7'));var attributes=require(_0xf371('0x8'));module['exports']=function(_0x2b424e,_0x2528c8){return _0x2b424e[_0xf371('0x9')](_0xf371('0xa'),attributes,{'tableName':_0xf371('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 50e869a..753a016 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd200=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0xd200,0x1b4));var _0x0d20=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xd200[_0x1eda20];return _0x31b953;};'use strict';var _=require('lodash');var util=require(_0x0d20('0x0'));var moment=require(_0x0d20('0x1'));var BPromise=require(_0x0d20('0x2'));var rs=require(_0x0d20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d20('0x4'))['db'];var utils=require(_0x0d20('0x5'));var logger=require(_0x0d20('0x6'))('rpc');var config=require(_0x0d20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d20('0x8')][_0x0d20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30b9b4,_0x473700,_0x5eb00b){return new BPromise(function(_0x47759e,_0x4d57cc){return client[_0x0d20('0xa')](_0x30b9b4,_0x5eb00b)[_0x0d20('0xb')](function(_0x4684ed){logger['info'](_0x0d20('0xc'),_0x473700,_0x0d20('0xd'));logger[_0x0d20('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x473700,_0x0d20('0xd'),JSON[_0x0d20('0xf')](_0x4684ed));if(_0x4684ed[_0x0d20('0x10')]){if(_0x4684ed[_0x0d20('0x10')][_0x0d20('0x11')]===0x1f4){logger[_0x0d20('0x10')](_0x0d20('0xc'),_0x473700,_0x4684ed[_0x0d20('0x10')]['message']);return _0x4d57cc(_0x4684ed[_0x0d20('0x10')]['message']);}logger[_0x0d20('0x10')](_0x0d20('0xc'),_0x473700,_0x4684ed[_0x0d20('0x10')][_0x0d20('0x12')]);return _0x47759e(_0x4684ed[_0x0d20('0x10')][_0x0d20('0x12')]);}else{logger[_0x0d20('0x13')](_0x0d20('0xc'),_0x473700,_0x0d20('0xd'));_0x47759e(_0x4684ed[_0x0d20('0x14')][_0x0d20('0x12')]);}})['catch'](function(_0x5199fd){logger[_0x0d20('0x10')](_0x0d20('0xc'),_0x473700,_0x5199fd);_0x4d57cc(_0x5199fd);});});}
\ No newline at end of file
+var _0xac36=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1f120c,_0x22cd8f){var _0x3f43f5=function(_0x2e6eef){while(--_0x2e6eef){_0x1f120c['push'](_0x1f120c['shift']());}};_0x3f43f5(++_0x22cd8f);}(_0xac36,0x177));var _0x6ac3=function(_0x3530b5,_0x323b72){_0x3530b5=_0x3530b5-0x0;var _0x2f63e5=_0xac36[_0x3530b5];return _0x2f63e5;};'use strict';var _=require('lodash');var util=require(_0x6ac3('0x0'));var moment=require(_0x6ac3('0x1'));var BPromise=require(_0x6ac3('0x2'));var rs=require(_0x6ac3('0x3'));var fs=require('fs');var Redis=require(_0x6ac3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ac3('0x5'))(_0x6ac3('0x6'));var config=require(_0x6ac3('0x7'));var jayson=require(_0x6ac3('0x8'));var client=jayson[_0x6ac3('0x9')][_0x6ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d922,_0x1adcd6,_0xfd4c0){return new BPromise(function(_0x4ad332,_0x1e8e84){return client['request'](_0x25d922,_0xfd4c0)[_0x6ac3('0xb')](function(_0x1c75aa){logger['info']('CmCustomField,\x20%s,\x20%s',_0x1adcd6,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1adcd6,'request\x20sent',JSON[_0x6ac3('0xc')](_0x1c75aa));if(_0x1c75aa[_0x6ac3('0xd')]){if(_0x1c75aa[_0x6ac3('0xd')][_0x6ac3('0xe')]===0x1f4){logger[_0x6ac3('0xd')](_0x6ac3('0xf'),_0x1adcd6,_0x1c75aa[_0x6ac3('0xd')][_0x6ac3('0x10')]);return _0x1e8e84(_0x1c75aa['error']['message']);}logger[_0x6ac3('0xd')](_0x6ac3('0xf'),_0x1adcd6,_0x1c75aa[_0x6ac3('0xd')][_0x6ac3('0x10')]);return _0x4ad332(_0x1c75aa[_0x6ac3('0xd')][_0x6ac3('0x10')]);}else{logger[_0x6ac3('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1adcd6,'request\x20sent');_0x4ad332(_0x1c75aa[_0x6ac3('0x12')]['message']);}})[_0x6ac3('0x13')](function(_0xf64456){logger['error']('CmCustomField,\x20%s,\x20%s',_0x1adcd6,_0xf64456);_0x1e8e84(_0xf64456);});});}
\ No newline at end of file
index db7a98f..606941e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0e7=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index'];(function(_0x5321f8,_0x19711a){var _0x153f70=function(_0x291195){while(--_0x291195){_0x5321f8['push'](_0x5321f8['shift']());}};_0x153f70(++_0x19711a);}(_0xd0e7,0x10d));var _0x7d0e=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xd0e7[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0x7d0e('0x0'));var util=require(_0x7d0e('0x1'));var path=require(_0x7d0e('0x2'));var timeout=require(_0x7d0e('0x3'));var express=require('express');var router=express[_0x7d0e('0x4')]();var fs_extra=require(_0x7d0e('0x5'));var auth=require(_0x7d0e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7d0e('0x7'));router[_0x7d0e('0x8')]('/',auth[_0x7d0e('0x9')](),controller[_0x7d0e('0xa')]);router[_0x7d0e('0x8')](_0x7d0e('0xb'),auth['isAuthenticated'](),controller[_0x7d0e('0xc')]);router[_0x7d0e('0xd')]('/',auth[_0x7d0e('0x9')](),controller[_0x7d0e('0xe')]);router[_0x7d0e('0xf')](_0x7d0e('0xb'),auth['isAuthenticated'](),controller[_0x7d0e('0x10')]);router[_0x7d0e('0x11')](_0x7d0e('0xb'),auth['isAuthenticated'](),controller[_0x7d0e('0x12')]);module[_0x7d0e('0x13')]=router;
\ No newline at end of file
+var _0xdad2=['isAuthenticated','index','show','post','create','put','/:id','update','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x79cf27,_0x2d42ab){var _0x5729a4=function(_0x83bab0){while(--_0x83bab0){_0x79cf27['push'](_0x79cf27['shift']());}};_0x5729a4(++_0x2d42ab);}(_0xdad2,0x14c));var _0x2dad=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xdad2[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require(_0x2dad('0x0'));var path=require(_0x2dad('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dad('0x2'));var router=express[_0x2dad('0x3')]();var fs_extra=require(_0x2dad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var controller=require('./cmCustomField.controller');router[_0x2dad('0x7')]('/',auth[_0x2dad('0x8')](),controller[_0x2dad('0x9')]);router[_0x2dad('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2dad('0xa')]);router[_0x2dad('0xb')]('/',auth[_0x2dad('0x8')](),controller[_0x2dad('0xc')]);router[_0x2dad('0xd')](_0x2dad('0xe'),auth['isAuthenticated'](),controller[_0x2dad('0xf')]);router['delete'](_0x2dad('0xe'),auth[_0x2dad('0x8')](),controller['destroy']);module[_0x2dad('0x10')]=router;
\ No newline at end of file
index 3c2b30c..308660b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8329=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x102bd8,_0x5d844a){var _0xfeb51=function(_0x4b29fd){while(--_0x4b29fd){_0x102bd8['push'](_0x102bd8['shift']());}};_0xfeb51(++_0x5d844a);}(_0x8329,0x1b3));var _0x9832=function(_0x127f6c,_0x3b81ec){_0x127f6c=_0x127f6c-0x0;var _0x22243a=_0x8329[_0x127f6c];return _0x22243a;};'use strict';var moment=require(_0x9832('0x0'));var Sequelize=require(_0x9832('0x1'));module[_0x9832('0x2')]={'phone':{'type':Sequelize[_0x9832('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x9832('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9832('0x5')],'defaultValue':moment()[_0x9832('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9832('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9832('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9832('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9832('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9832('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9832('0x7')],'unique':_0x9832('0x9')},'ListId':{'type':Sequelize[_0x9832('0x7')],'unique':_0x9832('0x9')},'UserId':{'type':Sequelize[_0x9832('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x9832('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x9832('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9832('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9832('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9832('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9832('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9832('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9832('0x5')],'allowNull':!![],'defaultValue':null}};
\ No newline at end of file
+var _0xe903=['INTEGER','DATE','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2c05b0,_0x4838ed){var _0x1be44d=function(_0x530e28){while(--_0x530e28){_0x2c05b0['push'](_0x2c05b0['shift']());}};_0x1be44d(++_0x4838ed);}(_0xe903,0x108));var _0x3e90=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xe903[_0xdc37a1];return _0x99b4fe;};'use strict';var moment=require(_0x3e90('0x0'));var Sequelize=require('sequelize');module[_0x3e90('0x1')]={'phone':{'type':Sequelize[_0x3e90('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x3e90('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3e90('0x4')](_0x3e90('0x5'))},'countbusyretry':{'type':Sequelize[_0x3e90('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3e90('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3e90('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3e90('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3e90('0x7')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x3e90('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3e90('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3e90('0x9')},'ListId':{'type':Sequelize[_0x3e90('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x3e90('0x6')],'unique':_0x3e90('0x9')},'CampaignId':{'type':Sequelize[_0x3e90('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x3e90('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3e90('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3e90('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x3e90('0x7')],'allowNull':!![],'defaultValue':null}};
\ No newline at end of file
index 44e09d2..774b36f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a59=['$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','model','keys','rawAttributes','find','catch','create','body','params','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','dataValues','createdAt','updatedAt','campaign','membername','UserId','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','sequelize','dialPreviewAutoRecallMe','value','direction','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','transaction','LOCK','CmList','dialActive','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','sendStatus','error','stack','name','send','map','CmHopper','fieldName','type','query','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x7a59,0x16e));var _0x97a5=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x7a59[_0xfbdff6];return _0x4cb9be;};'use strict';var moment=require(_0x97a5('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x97a5('0x1'))(_0x97a5('0x2'));var shared=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];function respondWithResult(_0x281bfd,_0x5e2db0){_0x5e2db0=_0x5e2db0||0xc8;return function(_0x3ba155){if(_0x3ba155){return _0x281bfd[_0x97a5('0x5')](_0x5e2db0)[_0x97a5('0x6')](_0x3ba155);}};}function respondWithFilteredResult(_0x48201b,_0x438520){return function(_0x52d32f){if(_0x52d32f){var _0x2663b9=typeof _0x438520[_0x97a5('0x7')]===_0x97a5('0x8')&&typeof _0x438520[_0x97a5('0x9')]===_0x97a5('0x8');var _0x5a51bc=_0x52d32f[_0x97a5('0xa')];var _0x101c3f=_0x2663b9?0x0:_0x438520[_0x97a5('0x7')];var _0x388bd7=_0x2663b9?_0x52d32f[_0x97a5('0xa')]:_0x438520['offset']+_0x438520['limit'];var _0x11d2eb;if(_0x388bd7>=_0x5a51bc){_0x388bd7=_0x5a51bc;_0x11d2eb=0xc8;}else{_0x11d2eb=0xce;}_0x48201b[_0x97a5('0x5')](_0x11d2eb);return _0x48201b[_0x97a5('0xb')]('Content-Range',_0x101c3f+'-'+_0x388bd7+'/'+_0x5a51bc)[_0x97a5('0x6')](_0x52d32f);}return null;};}function saveUpdates(_0x350720,_0x55305a){return function(_0x4f85a0){if(_0x4f85a0){return _0x4f85a0[_0x97a5('0xc')](_0x350720)[_0x97a5('0xd')](function(_0x50d291){return _0x50d291;});}return null;};}function handleEntityNotFound(_0x595437,_0x51d5e2){return function(_0x5a4471){if(!_0x5a4471){_0x595437[_0x97a5('0xe')](0x194);}return _0x5a4471;};}function handleError(_0x3dfb08,_0x3603e4){_0x3603e4=_0x3603e4||0x1f4;return function(_0x4d8ba7){logger[_0x97a5('0xf')](_0x4d8ba7[_0x97a5('0x10')]);if(_0x4d8ba7['name']){delete _0x4d8ba7[_0x97a5('0x11')];}_0x3dfb08['status'](_0x3603e4)[_0x97a5('0x12')](_0x4d8ba7);};}exports['index']=function(_0x4b7a38,_0x52ce92){var _0x32b00d={},_0x5c5740={},_0x79a5f7={'count':0x0,'rows':[]};var _0x9863ea=_[_0x97a5('0x13')](db[_0x97a5('0x14')]['rawAttributes'],function(_0x57dc28){return{'name':_0x57dc28[_0x97a5('0x15')],'type':_0x57dc28[_0x97a5('0x16')]['key']};});_0x5c5740['model']=_[_0x97a5('0x13')](_0x9863ea,_0x97a5('0x11'));_0x5c5740[_0x97a5('0x17')]=_['keys'](_0x4b7a38[_0x97a5('0x17')]);_0x5c5740[_0x97a5('0x18')]=_[_0x97a5('0x19')](_0x5c5740['model'],_0x5c5740[_0x97a5('0x17')]);_0x5c5740[_0x97a5('0x18')]=_['concat'](_0x5c5740[_0x97a5('0x18')],[_0x97a5('0x1a'),_0x97a5('0x1b'),_0x97a5('0x1c'),_0x97a5('0x1d'),_0x97a5('0x1e'),_0x97a5('0x1f'),_0x97a5('0x20'),_0x97a5('0x21'),'$not',_0x97a5('0x22'),_0x97a5('0x23'),_0x97a5('0x24'),_0x97a5('0x25'),_0x97a5('0x26'),_0x97a5('0x27'),'$iLike',_0x97a5('0x28'),_0x97a5('0x26'),'$overlap',_0x97a5('0x29'),_0x97a5('0x2a'),'$any']);_0x32b00d[_0x97a5('0x2b')]=_[_0x97a5('0x19')](_0x5c5740['model'],qs[_0x97a5('0x2c')](_0x4b7a38['query'][_0x97a5('0x2c')]));_0x32b00d[_0x97a5('0x2b')]=_0x32b00d[_0x97a5('0x2b')][_0x97a5('0x2d')]?_0x32b00d['attributes']:_0x5c5740['model'];if(!_0x4b7a38[_0x97a5('0x17')][_0x97a5('0x2e')](_0x97a5('0x2f'))){_0x32b00d['limit']=qs[_0x97a5('0x9')](_0x4b7a38[_0x97a5('0x17')]['limit']);_0x32b00d[_0x97a5('0x7')]=qs[_0x97a5('0x7')](_0x4b7a38['query'][_0x97a5('0x7')]);}_0x32b00d[_0x97a5('0x30')]=qs[_0x97a5('0x31')](_0x4b7a38['query'][_0x97a5('0x31')]);_0x32b00d[_0x97a5('0x32')]=qs[_0x97a5('0x18')](_[_0x97a5('0x33')](_0x4b7a38[_0x97a5('0x17')],_0x5c5740[_0x97a5('0x18')]),_0x9863ea);if(_0x4b7a38[_0x97a5('0x17')]['filter']){_0x32b00d[_0x97a5('0x32')]=_[_0x97a5('0x34')](_0x32b00d[_0x97a5('0x32')],{'$or':_[_0x97a5('0x13')](_0x9863ea,function(_0x369d7b){if(_0x369d7b[_0x97a5('0x16')]!==_0x97a5('0x35')){var _0x59ba99={};_0x59ba99[_0x369d7b[_0x97a5('0x11')]]={'$like':'%'+_0x4b7a38[_0x97a5('0x17')][_0x97a5('0x36')]+'%'};return _0x59ba99;}})});}_0x32b00d=_[_0x97a5('0x34')]({},_0x32b00d,_0x4b7a38[_0x97a5('0x37')]);var _0x49b19a={'where':_0x32b00d[_0x97a5('0x32')]};return db[_0x97a5('0x14')][_0x97a5('0xa')](_0x49b19a)[_0x97a5('0xd')](function(_0x2aec4e){_0x79a5f7['count']=_0x2aec4e;if(_0x4b7a38['query'][_0x97a5('0x38')]){_0x32b00d[_0x97a5('0x39')]=[{'all':!![]}];}return db[_0x97a5('0x14')][_0x97a5('0x3a')](_0x32b00d);})[_0x97a5('0xd')](function(_0x3dd209){_0x79a5f7['rows']=_0x3dd209;return _0x79a5f7;})[_0x97a5('0xd')](respondWithFilteredResult(_0x52ce92,_0x32b00d))['catch'](handleError(_0x52ce92,null));};exports[_0x97a5('0x3b')]=function(_0x1bde97,_0x30fc3b){var _0x798318={'raw':!![],'where':{'id':_0x1bde97['params']['id']}},_0x341cba={};_0x341cba[_0x97a5('0x3c')]=_[_0x97a5('0x3d')](db[_0x97a5('0x14')][_0x97a5('0x3e')]);_0x341cba[_0x97a5('0x17')]=_['keys'](_0x1bde97['query']);_0x341cba[_0x97a5('0x18')]=_[_0x97a5('0x19')](_0x341cba[_0x97a5('0x3c')],_0x341cba[_0x97a5('0x17')]);_0x798318['attributes']=_[_0x97a5('0x19')](_0x341cba['model'],qs[_0x97a5('0x2c')](_0x1bde97[_0x97a5('0x17')][_0x97a5('0x2c')]));_0x798318['attributes']=_0x798318[_0x97a5('0x2b')][_0x97a5('0x2d')]?_0x798318['attributes']:_0x341cba[_0x97a5('0x3c')];if(_0x1bde97[_0x97a5('0x17')][_0x97a5('0x38')]){_0x798318[_0x97a5('0x39')]=[{'all':!![]}];}_0x798318=_[_0x97a5('0x34')]({},_0x798318,_0x1bde97[_0x97a5('0x37')]);return db[_0x97a5('0x14')][_0x97a5('0x3f')](_0x798318)[_0x97a5('0xd')](handleEntityNotFound(_0x30fc3b,null))[_0x97a5('0xd')](respondWithResult(_0x30fc3b,null))[_0x97a5('0x40')](handleError(_0x30fc3b,null));};exports[_0x97a5('0x41')]=function(_0x5d54cc,_0x5c73f){return db[_0x97a5('0x14')][_0x97a5('0x41')](_0x5d54cc['body'],{})[_0x97a5('0xd')](respondWithResult(_0x5c73f,0xc9))[_0x97a5('0x40')](handleError(_0x5c73f,null));};exports[_0x97a5('0xc')]=function(_0x218f2b,_0x4b816){if(_0x218f2b['body']['id']){delete _0x218f2b[_0x97a5('0x42')]['id'];}return db[_0x97a5('0x14')][_0x97a5('0x3f')]({'where':{'id':_0x218f2b[_0x97a5('0x43')]['id']}})[_0x97a5('0xd')](handleEntityNotFound(_0x4b816,null))['then'](saveUpdates(_0x218f2b[_0x97a5('0x42')],null))['then'](respondWithResult(_0x4b816,null))[_0x97a5('0x40')](handleError(_0x4b816,null));};exports[_0x97a5('0x44')]=function(_0x330f6a,_0x4b3c38){return db[_0x97a5('0x14')][_0x97a5('0x44')]()[_0x97a5('0xd')](respondWithResult(_0x4b3c38,null))[_0x97a5('0x40')](handleError(_0x4b3c38,null));};exports[_0x97a5('0x45')]=function(_0x42ced6,_0x49b215){var _0x318469;var _0x7edab1=_0x42ced6[_0x97a5('0x43')]['id'];return db[_0x97a5('0x14')]['find']({'where':{'id':_0x42ced6[_0x97a5('0x43')]['id']}})[_0x97a5('0xd')](handleEntityNotFound(_0x49b215,null))['then'](function(_0x257a5d){if(_0x257a5d){return _0x257a5d[_0x97a5('0x45')]()[_0x97a5('0xd')](function(_0x56890f){return _0x56890f;});}})[_0x97a5('0xd')](function(_0x34d934){_0x318469=_0x34d934;if(_0x34d934){if(_0x34d934['VoiceQueueId']||_0x34d934[_0x97a5('0x46')]){return db[_0x34d934[_0x97a5('0x47')]?_0x97a5('0x48'):'Campaign'][_0x97a5('0x3f')]({'where':{'id':_0x34d934[_0x97a5('0x47')]?_0x34d934[_0x97a5('0x47')]:_0x34d934['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x97a5('0xd')](function(_0x7c4886){var _0x3ccb26={};if(_0x7c4886){_[_0x97a5('0x34')](_0x3ccb26,_['omit'](_0x318469[_0x97a5('0x49')],[_0x97a5('0x4a'),_0x97a5('0x4b'),'id']));_0x3ccb26['state']=0x15;_0x3ccb26['statedesc']='deleted';_0x3ccb26[_0x97a5('0x4c')]=_0x7c4886[_0x97a5('0x11')];_0x3ccb26[_0x97a5('0x4d')]=_0x42ced6['user'][_0x97a5('0x11')];_0x3ccb26[_0x97a5('0x4e')]=_0x42ced6[_0x97a5('0x4f')]['id'];_0x3ccb26[_0x97a5('0x50')]=!![];_0x3ccb26[_0x97a5('0x51')]=moment()[_0x97a5('0x52')](_0x97a5('0x53'));_0x3ccb26['calleridnum']=_0x318469[_0x97a5('0x54')];_0x3ccb26['campaigntype']=_0x318469[_0x97a5('0x47')]?'queue':'ivr';return db[_0x97a5('0x55')][_0x97a5('0x3f')]({'where':{'id':_0x3ccb26['ContactId']},'attributes':[_0x97a5('0x56'),_0x97a5('0x57')]})['then'](function(_0x116ded){if(!_['isNil'](_0x49b215)&&!_[_0x97a5('0x58')](_0x116ded['firstName'])){_0x3ccb26[_0x97a5('0x59')]=_0x116ded['firstName'];if(!_[_0x97a5('0x58')](_0x116ded[_0x97a5('0x57')])){_0x3ccb26['calleridname']+='\x20'+_0x116ded[_0x97a5('0x57')];}}})['finally'](function(){return db[_0x97a5('0x5a')]['create'](_0x3ccb26);});}})['then'](function(_0x537e29){return db[_0x97a5('0x5b')][_0x97a5('0x45')]({'where':{'CmHopperId':_0x7edab1}});})[_0x97a5('0xd')](function(){return _0x49b215[_0x97a5('0x5')](0xcc)[_0x97a5('0x5c')]();})[_0x97a5('0x40')](handleError(_0x49b215,null));};exports[_0x97a5('0x5d')]=function(_0xbfde6,_0x522e6f){var _0x5bec31=[];return db['CmContact'][_0x97a5('0x44')]()['then'](function(_0x5ba758){_0x5bec31=_[_0x97a5('0x3d')](_0x5ba758);return _0xbfde6[_0x97a5('0x4f')]['getVoiceQueues']({'where':{'type':_0x97a5('0x5e'),'dialActive':!![],'dialMethod':_0x97a5('0x5f')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x97a5('0xd')](function(_0x2b7156){if(_0x2b7156&&_0x2b7156[_0x97a5('0x2d')]){return db[_0x97a5('0x60')]['transaction'](function(_0x30d166){var _0x270991={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x97a5('0x52')](_0x97a5('0x53'))},'VoiceQueueId':{'$in':_[_0x97a5('0x13')](_0x2b7156,'id')},'$or':[{'UserId':null},{'UserId':_0xbfde6['user']['id']}]};var _0x4914ca={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2b7156)[_0x97a5('0x36')]([_0x97a5('0x61'),0x0])['map']('id')[_0x97a5('0x62')]()},'$or':[{'UserId':null},{'UserId':_0xbfde6[_0x97a5('0x4f')]['id']}]};var _0x31460b={'$or':[_0x270991,_0x4914ca]};var _0x3ba5db=[];if(_0xbfde6['body'][_0x97a5('0x63')]&&_0xbfde6['body']['direction']==='prev'){if(!_['isEmpty'](_0xbfde6[_0x97a5('0x42')][_0x97a5('0x64')])){_0x31460b['id']={'$in':_0xbfde6[_0x97a5('0x42')][_0x97a5('0x64')]};}_0x3ba5db=[[_0x97a5('0x65'),_0x97a5('0x66')],[_0x97a5('0x67'),_0x2b7156[0x0][_0x97a5('0x68')]==='ASC'?_0x97a5('0x69'):_0x97a5('0x66')],db['sequelize'][_0x97a5('0x6a')](_0x97a5('0x6b')),['id','DESC']];}else{if(!_[_0x97a5('0x6c')](_0xbfde6[_0x97a5('0x42')]['hopperIds'])){_0x31460b['id']={'$notIn':_0xbfde6[_0x97a5('0x42')][_0x97a5('0x64')]};}_0x3ba5db=[['priority','DESC'],[_0x97a5('0x67'),_0x2b7156[0x0]['dialOrderByScheduledAt']],db[_0x97a5('0x60')]['literal'](_0x97a5('0x6d')),['id',_0x97a5('0x66')]];}return db[_0x97a5('0x14')][_0x97a5('0x6e')]({'attributes':['id',_0x97a5('0x6f'),_0x97a5('0x54'),_0x97a5('0x70')],'where':_0x31460b,'order':_0x3ba5db,'transaction':_0x30d166,'lock':_0x30d166['LOCK'][_0x97a5('0x71')],'include':[{'model':db[_0x97a5('0x55')],'as':_0x97a5('0x72'),'attributes':_0x5bec31,'include':[{'model':db[_0x97a5('0x73')],'as':_0x97a5('0x74'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x97a5('0x75'),'attributes':['id',_0x97a5('0x11')]},{'model':db['VoiceQueue'],'as':_0x97a5('0x76'),'attributes':['id',_0x97a5('0x11'),'dialActive']}]})[_0x97a5('0xd')](function(_0x5df8b3){if(_0x5df8b3){return _0x5df8b3[_0x97a5('0xc')]({'UserId':_0xbfde6[_0x97a5('0x4f')]['id']},{'transaction':_0x30d166});}});});}})[_0x97a5('0xd')](handleEntityNotFound(_0x522e6f,null))[_0x97a5('0xd')](respondWithResult(_0x522e6f,null))[_0x97a5('0x40')](handleError(_0x522e6f,null));};exports['getPreviewRecall']=function(_0x2df3f0,_0x552e76,_0x3abe99){var _0x4f30fb=[];var _0x140320=_0x2df3f0[_0x97a5('0x43')]['id'];var _0x50979b=_0x2df3f0[_0x97a5('0x4f')]['id'];return db[_0x97a5('0x55')][_0x97a5('0x44')]()['then'](function(_0x274d85){_0x4f30fb=_[_0x97a5('0x3d')](_0x274d85);return db[_0x97a5('0x60')][_0x97a5('0x77')](function(_0x1981b9){const _0x360df4={'id':_0x140320};return db[_0x97a5('0x14')][_0x97a5('0x6e')]({'attributes':['id',_0x97a5('0x6f'),_0x97a5('0x70')],'where':_0x360df4,'transaction':_0x1981b9,'lock':_0x1981b9[_0x97a5('0x78')][_0x97a5('0x71')],'include':[{'model':db['CmContact'],'as':_0x97a5('0x72'),'attributes':_0x4f30fb,'include':[{'model':db[_0x97a5('0x73')],'as':_0x97a5('0x74'),'attributes':['id','name']}]},{'model':db[_0x97a5('0x79')],'as':'List','attributes':['id',_0x97a5('0x11')]},{'model':db[_0x97a5('0x48')],'as':_0x97a5('0x76'),'attributes':['id',_0x97a5('0x11'),_0x97a5('0x7a')]}]})['then'](function(_0x16eb72){if(_0x16eb72){return _0x16eb72[_0x97a5('0xc')]({'UserId':_0x50979b},{'transaction':_0x1981b9});}});});})[_0x97a5('0xd')](handleEntityNotFound(_0x552e76,null))[_0x97a5('0xd')](respondWithResult(_0x552e76,null))['catch'](handleError(_0x552e76,null));};exports['getOpenContacts']=function(_0x4fb59c,_0x14bab0){return _0x4fb59c[_0x97a5('0x4f')][_0x97a5('0x7b')]({'where':{'type':_0x97a5('0x5e'),'dialActive':!![],'dialMethod':_0x97a5('0x5f')},'attributes':['id'],'raw':!![]})[_0x97a5('0xd')](function(_0x277b35){if(_0x277b35&&_0x277b35[_0x97a5('0x2d')]){return db[_0x97a5('0x14')][_0x97a5('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x97a5('0x52')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x97a5('0x13')](_0x277b35,'id')},'$or':[{'UserId':null},{'UserId':_0x4fb59c[_0x97a5('0x4f')]['id']}]}});}return 0x0;})[_0x97a5('0xd')](function(_0x1995a7){if(!_['isNil'](_0x1995a7)&&_[_0x97a5('0x7c')](_0x1995a7)){return _0x14bab0[_0x97a5('0x5')](0xc8)['json']({'contacts':_0x1995a7});}else{logger[_0x97a5('0xf')](_0x97a5('0x7d'),_0x97a5('0x7e'),0x194,_0x97a5('0x7f'));_0x14bab0[_0x97a5('0xe')](0x194);}})[_0x97a5('0x40')](handleError(_0x14bab0,null));};exports[_0x97a5('0x80')]=function(_0x484282,_0x2c8fee){var _0x568396=shared[_0x97a5('0x81')];var _0x5a0b6d=[];_[_0x97a5('0x13')](_0x568396,function(_0xe46572){_0x5a0b6d[_0x97a5('0x82')]({'id':_0xe46572[_0x97a5('0x11')],'name':_0xe46572[_0x97a5('0x11')],'utcOffset':_0xe46572[_0x97a5('0x83')]});});return _0x2c8fee['status'](0xc8)['json']({'tz':_0x5a0b6d});};exports[_0x97a5('0x84')]=function(_0x59facf,_0x4eacff){var _0x162d93=shared[_0x97a5('0x81')];var _0x377257={};if(!_[_0x97a5('0x58')](_0x162d93[_0x59facf[_0x97a5('0x42')]['id']]))_0x377257=_0x162d93[_0x59facf[_0x97a5('0x42')]['id']];return _0x4eacff['status'](0xc8)[_0x97a5('0x6')](_0x377257);};
\ No newline at end of file
+var _0x84e7=['literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','update','getPreviewRecall','recallme','LOCK','Contact','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','getTimezone','lodash','../../components/parsers/qs','api','../../config/environment','status','json','offset','undefined','count','limit','set','Content-Range','then','sendStatus','error','stack','send','index','map','CmHopper','rawAttributes','fieldName','type','query','keys','intersection','model','filters','$or','$gt','$lt','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','rows','show','includeAll','find','catch','create','body','params','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','name','omit','dataValues','createdAt','updatedAt','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialPreviewAutoRecallMe','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','DESC'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x84e7,0x122));var _0x784e=function(_0x17b078,_0x1bc6a5){_0x17b078=_0x17b078-0x0;var _0x39f3ce=_0x84e7[_0x17b078];return _0x39f3ce;};'use strict';var moment=require('moment');var _=require(_0x784e('0x0'));var qs=require(_0x784e('0x1'));var logger=require('../../config/logger')(_0x784e('0x2'));var shared=require(_0x784e('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x45e3ad,_0x14cee2){_0x14cee2=_0x14cee2||0xc8;return function(_0x205619){if(_0x205619){return _0x45e3ad[_0x784e('0x4')](_0x14cee2)[_0x784e('0x5')](_0x205619);}};}function respondWithFilteredResult(_0x133296,_0x48ed22){return function(_0x3cbdd1){if(_0x3cbdd1){var _0x5d5595=typeof _0x48ed22[_0x784e('0x6')]===_0x784e('0x7')&&typeof _0x48ed22['limit']===_0x784e('0x7');var _0x46fda9=_0x3cbdd1[_0x784e('0x8')];var _0x3ddd55=_0x5d5595?0x0:_0x48ed22['offset'];var _0x4ae056=_0x5d5595?_0x3cbdd1[_0x784e('0x8')]:_0x48ed22[_0x784e('0x6')]+_0x48ed22[_0x784e('0x9')];var _0x2fd1b5;if(_0x4ae056>=_0x46fda9){_0x4ae056=_0x46fda9;_0x2fd1b5=0xc8;}else{_0x2fd1b5=0xce;}_0x133296['status'](_0x2fd1b5);return _0x133296[_0x784e('0xa')](_0x784e('0xb'),_0x3ddd55+'-'+_0x4ae056+'/'+_0x46fda9)[_0x784e('0x5')](_0x3cbdd1);}return null;};}function saveUpdates(_0x2c7227,_0x40e0d1){return function(_0x208d24){if(_0x208d24){return _0x208d24['update'](_0x2c7227)[_0x784e('0xc')](function(_0x5177e4){return _0x5177e4;});}return null;};}function handleEntityNotFound(_0x172697,_0x1f6ede){return function(_0x41f993){if(!_0x41f993){_0x172697[_0x784e('0xd')](0x194);}return _0x41f993;};}function handleError(_0x31a8cc,_0x46bd33){_0x46bd33=_0x46bd33||0x1f4;return function(_0x947397){logger[_0x784e('0xe')](_0x947397[_0x784e('0xf')]);if(_0x947397['name']){delete _0x947397['name'];}_0x31a8cc[_0x784e('0x4')](_0x46bd33)[_0x784e('0x10')](_0x947397);};}exports[_0x784e('0x11')]=function(_0x25281f,_0x3ac83){var _0x19072b={},_0x1dc568={},_0x504ebf={'count':0x0,'rows':[]};var _0x2524d0=_[_0x784e('0x12')](db[_0x784e('0x13')][_0x784e('0x14')],function(_0x440cd6){return{'name':_0x440cd6[_0x784e('0x15')],'type':_0x440cd6[_0x784e('0x16')]['key']};});_0x1dc568['model']=_[_0x784e('0x12')](_0x2524d0,'name');_0x1dc568[_0x784e('0x17')]=_[_0x784e('0x18')](_0x25281f['query']);_0x1dc568['filters']=_[_0x784e('0x19')](_0x1dc568[_0x784e('0x1a')],_0x1dc568[_0x784e('0x17')]);_0x1dc568[_0x784e('0x1b')]=_['concat'](_0x1dc568['filters'],['$and',_0x784e('0x1c'),_0x784e('0x1d'),'$gte',_0x784e('0x1e'),'$lte',_0x784e('0x1f'),'$eq',_0x784e('0x20'),_0x784e('0x21'),_0x784e('0x22'),_0x784e('0x23'),'$notIn',_0x784e('0x24'),_0x784e('0x25'),_0x784e('0x26'),_0x784e('0x27'),'$like',_0x784e('0x28'),_0x784e('0x29'),'$contained','$any']);_0x19072b[_0x784e('0x2a')]=_[_0x784e('0x19')](_0x1dc568[_0x784e('0x1a')],qs[_0x784e('0x2b')](_0x25281f[_0x784e('0x17')][_0x784e('0x2b')]));_0x19072b[_0x784e('0x2a')]=_0x19072b[_0x784e('0x2a')][_0x784e('0x2c')]?_0x19072b[_0x784e('0x2a')]:_0x1dc568[_0x784e('0x1a')];if(!_0x25281f[_0x784e('0x17')][_0x784e('0x2d')](_0x784e('0x2e'))){_0x19072b[_0x784e('0x9')]=qs['limit'](_0x25281f[_0x784e('0x17')]['limit']);_0x19072b[_0x784e('0x6')]=qs[_0x784e('0x6')](_0x25281f[_0x784e('0x17')]['offset']);}_0x19072b[_0x784e('0x2f')]=qs['sort'](_0x25281f[_0x784e('0x17')][_0x784e('0x30')]);_0x19072b['where']=qs[_0x784e('0x1b')](_[_0x784e('0x31')](_0x25281f['query'],_0x1dc568['filters']),_0x2524d0);if(_0x25281f[_0x784e('0x17')][_0x784e('0x32')]){_0x19072b[_0x784e('0x33')]=_[_0x784e('0x34')](_0x19072b[_0x784e('0x33')],{'$or':_['map'](_0x2524d0,function(_0x23f42d){if(_0x23f42d[_0x784e('0x16')]!=='VIRTUAL'){var _0x3c95da={};_0x3c95da[_0x23f42d['name']]={'$like':'%'+_0x25281f['query']['filter']+'%'};return _0x3c95da;}})});}_0x19072b=_[_0x784e('0x34')]({},_0x19072b,_0x25281f[_0x784e('0x35')]);var _0x5aa239={'where':_0x19072b[_0x784e('0x33')]};return db[_0x784e('0x13')][_0x784e('0x8')](_0x5aa239)[_0x784e('0xc')](function(_0x1351ef){_0x504ebf[_0x784e('0x8')]=_0x1351ef;if(_0x25281f['query']['includeAll']){_0x19072b[_0x784e('0x36')]=[{'all':!![]}];}return db[_0x784e('0x13')]['findAll'](_0x19072b);})['then'](function(_0x48afec){_0x504ebf[_0x784e('0x37')]=_0x48afec;return _0x504ebf;})[_0x784e('0xc')](respondWithFilteredResult(_0x3ac83,_0x19072b))['catch'](handleError(_0x3ac83,null));};exports[_0x784e('0x38')]=function(_0x2b8dbc,_0x35f85c){var _0x49e82a={'raw':!![],'where':{'id':_0x2b8dbc['params']['id']}},_0x2be8da={};_0x2be8da[_0x784e('0x1a')]=_['keys'](db[_0x784e('0x13')][_0x784e('0x14')]);_0x2be8da['query']=_['keys'](_0x2b8dbc[_0x784e('0x17')]);_0x2be8da[_0x784e('0x1b')]=_[_0x784e('0x19')](_0x2be8da['model'],_0x2be8da[_0x784e('0x17')]);_0x49e82a[_0x784e('0x2a')]=_[_0x784e('0x19')](_0x2be8da[_0x784e('0x1a')],qs['fields'](_0x2b8dbc[_0x784e('0x17')][_0x784e('0x2b')]));_0x49e82a['attributes']=_0x49e82a['attributes'][_0x784e('0x2c')]?_0x49e82a[_0x784e('0x2a')]:_0x2be8da[_0x784e('0x1a')];if(_0x2b8dbc[_0x784e('0x17')][_0x784e('0x39')]){_0x49e82a['include']=[{'all':!![]}];}_0x49e82a=_['merge']({},_0x49e82a,_0x2b8dbc['options']);return db[_0x784e('0x13')][_0x784e('0x3a')](_0x49e82a)[_0x784e('0xc')](handleEntityNotFound(_0x35f85c,null))[_0x784e('0xc')](respondWithResult(_0x35f85c,null))[_0x784e('0x3b')](handleError(_0x35f85c,null));};exports['create']=function(_0x50fbae,_0x507e5a){return db[_0x784e('0x13')][_0x784e('0x3c')](_0x50fbae['body'],{})[_0x784e('0xc')](respondWithResult(_0x507e5a,0xc9))[_0x784e('0x3b')](handleError(_0x507e5a,null));};exports['update']=function(_0x174aee,_0x329925){if(_0x174aee[_0x784e('0x3d')]['id']){delete _0x174aee[_0x784e('0x3d')]['id'];}return db[_0x784e('0x13')][_0x784e('0x3a')]({'where':{'id':_0x174aee[_0x784e('0x3e')]['id']}})[_0x784e('0xc')](handleEntityNotFound(_0x329925,null))['then'](saveUpdates(_0x174aee[_0x784e('0x3d')],null))[_0x784e('0xc')](respondWithResult(_0x329925,null))['catch'](handleError(_0x329925,null));};exports[_0x784e('0x3f')]=function(_0x473e63,_0x3bfafc){return db[_0x784e('0x13')][_0x784e('0x3f')]()[_0x784e('0xc')](respondWithResult(_0x3bfafc,null))[_0x784e('0x3b')](handleError(_0x3bfafc,null));};exports[_0x784e('0x40')]=function(_0x52438e,_0x1aded3){var _0x5a2696;var _0x1b9579=_0x52438e[_0x784e('0x3e')]['id'];return db['CmHopper']['find']({'where':{'id':_0x52438e[_0x784e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1aded3,null))[_0x784e('0xc')](function(_0x52f7a6){if(_0x52f7a6){return _0x52f7a6[_0x784e('0x40')]()[_0x784e('0xc')](function(_0x45d046){return _0x45d046;});}})[_0x784e('0xc')](function(_0x553e79){_0x5a2696=_0x553e79;if(_0x553e79){if(_0x553e79['VoiceQueueId']||_0x553e79[_0x784e('0x41')]){return db[_0x553e79[_0x784e('0x42')]?_0x784e('0x43'):_0x784e('0x44')][_0x784e('0x3a')]({'where':{'id':_0x553e79['VoiceQueueId']?_0x553e79['VoiceQueueId']:_0x553e79[_0x784e('0x41')]},'attributes':['id',_0x784e('0x45')],'raw':!![]});}}})['then'](function(_0x43f4f9){var _0x2a9456={};if(_0x43f4f9){_['merge'](_0x2a9456,_[_0x784e('0x46')](_0x5a2696[_0x784e('0x47')],[_0x784e('0x48'),_0x784e('0x49'),'id']));_0x2a9456['state']=0x15;_0x2a9456['statedesc']=_0x784e('0x4a');_0x2a9456['campaign']=_0x43f4f9['name'];_0x2a9456[_0x784e('0x4b')]=_0x52438e[_0x784e('0x4c')][_0x784e('0x45')];_0x2a9456[_0x784e('0x4d')]=_0x52438e[_0x784e('0x4c')]['id'];_0x2a9456[_0x784e('0x4a')]=!![];_0x2a9456[_0x784e('0x4e')]=moment()['format'](_0x784e('0x4f'));_0x2a9456[_0x784e('0x50')]=_0x5a2696['phone'];_0x2a9456['campaigntype']=_0x5a2696['VoiceQueueId']?_0x784e('0x51'):_0x784e('0x52');return db[_0x784e('0x53')][_0x784e('0x3a')]({'where':{'id':_0x2a9456[_0x784e('0x54')]},'attributes':['firstName',_0x784e('0x55')]})[_0x784e('0xc')](function(_0x13a1bf){if(!_[_0x784e('0x56')](_0x1aded3)&&!_['isNil'](_0x13a1bf[_0x784e('0x57')])){_0x2a9456['calleridname']=_0x13a1bf[_0x784e('0x57')];if(!_[_0x784e('0x56')](_0x13a1bf[_0x784e('0x55')])){_0x2a9456[_0x784e('0x58')]+='\x20'+_0x13a1bf[_0x784e('0x55')];}}})[_0x784e('0x59')](function(){return db['CmHopperFinal'][_0x784e('0x3c')](_0x2a9456);});}})['then'](function(_0x420f13){return db[_0x784e('0x5a')][_0x784e('0x40')]({'where':{'CmHopperId':_0x1b9579}});})[_0x784e('0xc')](function(){return _0x1aded3[_0x784e('0x4')](0xcc)[_0x784e('0x5b')]();})[_0x784e('0x3b')](handleError(_0x1aded3,null));};exports[_0x784e('0x5c')]=function(_0x40375d,_0xb848ea){var _0x38813b=[];return db[_0x784e('0x53')][_0x784e('0x3f')]()[_0x784e('0xc')](function(_0x314c9a){_0x38813b=_[_0x784e('0x18')](_0x314c9a);return _0x40375d[_0x784e('0x4c')][_0x784e('0x5d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x784e('0x5e')},'attributes':['id','dialOrderByScheduledAt',_0x784e('0x5f')],'raw':!![]});})['then'](function(_0x3236e8){if(_0x3236e8&&_0x3236e8[_0x784e('0x2c')]){return db[_0x784e('0x60')][_0x784e('0x61')](function(_0x68a021){var _0x4eb6f3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x784e('0x62')](_0x784e('0x4f'))},'VoiceQueueId':{'$in':_[_0x784e('0x12')](_0x3236e8,'id')},'$or':[{'UserId':null},{'UserId':_0x40375d['user']['id']}]};var _0x4c034d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3236e8)[_0x784e('0x32')]([_0x784e('0x5f'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x40375d['user']['id']}]};var _0x21f26e={'$or':[_0x4eb6f3,_0x4c034d]};var _0x36ae65=[];if(_0x40375d[_0x784e('0x3d')][_0x784e('0x63')]&&_0x40375d[_0x784e('0x3d')]['direction']===_0x784e('0x64')){if(!_[_0x784e('0x65')](_0x40375d[_0x784e('0x3d')][_0x784e('0x66')])){_0x21f26e['id']={'$in':_0x40375d[_0x784e('0x3d')][_0x784e('0x66')]};}_0x36ae65=[[_0x784e('0x67'),_0x784e('0x68')],['scheduledAt',_0x3236e8[0x0]['dialOrderByScheduledAt']===_0x784e('0x68')?_0x784e('0x69'):'ASC'],db[_0x784e('0x60')][_0x784e('0x6a')](_0x784e('0x6b')),['id',_0x784e('0x69')]];}else{if(!_['isEmpty'](_0x40375d[_0x784e('0x3d')][_0x784e('0x66')])){_0x21f26e['id']={'$notIn':_0x40375d[_0x784e('0x3d')][_0x784e('0x66')]};}_0x36ae65=[['priority','DESC'],['scheduledAt',_0x3236e8[0x0][_0x784e('0x6c')]],db['sequelize']['literal'](_0x784e('0x6d')),['id','ASC']];}return db['CmHopper'][_0x784e('0x6e')]({'attributes':['id',_0x784e('0x6f'),'phone','recallme'],'where':_0x21f26e,'order':_0x36ae65,'transaction':_0x68a021,'lock':_0x68a021['LOCK'][_0x784e('0x70')],'include':[{'model':db[_0x784e('0x53')],'as':'Contact','attributes':_0x38813b,'include':[{'model':db[_0x784e('0x71')],'as':_0x784e('0x72'),'attributes':['id',_0x784e('0x45')]}]},{'model':db[_0x784e('0x73')],'as':_0x784e('0x74'),'attributes':['id','name']},{'model':db[_0x784e('0x43')],'as':_0x784e('0x75'),'attributes':['id','name',_0x784e('0x76')]}]})[_0x784e('0xc')](function(_0x3af80d){if(_0x3af80d){return _0x3af80d[_0x784e('0x77')]({'UserId':_0x40375d['user']['id']},{'transaction':_0x68a021});}});});}})[_0x784e('0xc')](handleEntityNotFound(_0xb848ea,null))['then'](respondWithResult(_0xb848ea,null))[_0x784e('0x3b')](handleError(_0xb848ea,null));};exports[_0x784e('0x78')]=function(_0x3811f7,_0x57caf6,_0x3328d7){var _0x3f09cd=[];var _0x1f7907=_0x3811f7['params']['id'];var _0x3abaa2=_0x3811f7[_0x784e('0x4c')]['id'];return db[_0x784e('0x53')][_0x784e('0x3f')]()[_0x784e('0xc')](function(_0x570cc2){_0x3f09cd=_[_0x784e('0x18')](_0x570cc2);return db[_0x784e('0x60')]['transaction'](function(_0x4a2c67){const _0x3882c4={'id':_0x1f7907};return db[_0x784e('0x13')][_0x784e('0x6e')]({'attributes':['id','scheduledat',_0x784e('0x79')],'where':_0x3882c4,'transaction':_0x4a2c67,'lock':_0x4a2c67[_0x784e('0x7a')][_0x784e('0x70')],'include':[{'model':db[_0x784e('0x53')],'as':_0x784e('0x7b'),'attributes':_0x3f09cd,'include':[{'model':db[_0x784e('0x71')],'as':_0x784e('0x72'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x784e('0x74'),'attributes':['id','name']},{'model':db[_0x784e('0x43')],'as':_0x784e('0x75'),'attributes':['id',_0x784e('0x45'),'dialActive']}]})[_0x784e('0xc')](function(_0x3cb59b){if(_0x3cb59b){return _0x3cb59b[_0x784e('0x77')]({'UserId':_0x3abaa2},{'transaction':_0x4a2c67});}});});})[_0x784e('0xc')](handleEntityNotFound(_0x57caf6,null))[_0x784e('0xc')](respondWithResult(_0x57caf6,null))[_0x784e('0x3b')](handleError(_0x57caf6,null));};exports[_0x784e('0x7c')]=function(_0x13f03a,_0x464aeb){return _0x13f03a[_0x784e('0x4c')][_0x784e('0x5d')]({'where':{'type':_0x784e('0x7d'),'dialActive':!![],'dialMethod':_0x784e('0x5e')},'attributes':['id'],'raw':!![]})[_0x784e('0xc')](function(_0x127ad7){if(_0x127ad7&&_0x127ad7[_0x784e('0x2c')]){return db[_0x784e('0x13')][_0x784e('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x784e('0x62')](_0x784e('0x4f'))},'VoiceQueueId':{'$in':_[_0x784e('0x12')](_0x127ad7,'id')},'$or':[{'UserId':null},{'UserId':_0x13f03a['user']['id']}]}});}return 0x0;})[_0x784e('0xc')](function(_0x9f09e7){if(!_[_0x784e('0x56')](_0x9f09e7)&&_[_0x784e('0x7e')](_0x9f09e7)){return _0x464aeb[_0x784e('0x4')](0xc8)[_0x784e('0x5')]({'contacts':_0x9f09e7});}else{logger['error'](_0x784e('0x7f'),'getOpenContacts',0x194,_0x784e('0x80'));_0x464aeb['sendStatus'](0x194);}})['catch'](handleError(_0x464aeb,null));};exports['getTimezones']=function(_0x37cc24,_0x610060){var _0x21fb2c=shared[_0x784e('0x81')];var _0x11c957=[];_[_0x784e('0x12')](_0x21fb2c,function(_0x5ed28c){_0x11c957[_0x784e('0x82')]({'id':_0x5ed28c[_0x784e('0x45')],'name':_0x5ed28c[_0x784e('0x45')],'utcOffset':_0x5ed28c['utcOffset']});});return _0x610060[_0x784e('0x4')](0xc8)[_0x784e('0x5')]({'tz':_0x11c957});};exports[_0x784e('0x83')]=function(_0x1f9151,_0x13764d){var _0x275b00=shared[_0x784e('0x81')];var _0x4f77ef={};if(!_['isNil'](_0x275b00[_0x1f9151[_0x784e('0x3d')]['id']]))_0x4f77ef=_0x275b00[_0x1f9151[_0x784e('0x3d')]['id']];return _0x13764d[_0x784e('0x4')](0xc8)[_0x784e('0x5')](_0x4f77ef);};
\ No newline at end of file
index 00d8b97..d64eb5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda19=['define','CmHopper','cm_hopper','scheduledat','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xda19,0xd5));var _0x9da1=function(_0x5715ef,_0x55bcf7){_0x5715ef=_0x5715ef-0x0;var _0x49e2d8=_0xda19[_0x5715ef];return _0x49e2d8;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0x9da1('0xc'),'fields':['priority']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a54=['bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','priority','lodash','util','../../config/logger','moment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7a54,0x106));var _0x47a5=function(_0x4e9250,_0xa79758){_0x4e9250=_0x4e9250-0x0;var _0x304819=_0x7a54[_0x4e9250];return _0x304819;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x47a5('0xc')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0x47a5('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 1dea8a3..2c1c02b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x37f5=['error','CreateCmHopper','create','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','transaction','order','LOCK','UPDATE','Contact','keys','User','name','voicePause','length','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','sequelize','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','describe','GetContactByPhone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','moment','bluebird','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','ShowCmHopper','find'];(function(_0x28cc49,_0x92d793){var _0x51bf1b=function(_0xa983c9){while(--_0xa983c9){_0x28cc49['push'](_0x28cc49['shift']());}};_0x51bf1b(++_0x92d793);}(_0x37f5,0xd0));var _0x537f=function(_0x22585b,_0x3cd9d8){_0x22585b=_0x22585b-0x0;var _0x1d6c18=_0x37f5[_0x22585b];return _0x1d6c18;};'use strict';var _=require(_0x537f('0x0'));var util=require('util');var moment=require(_0x537f('0x1'));var BPromise=require(_0x537f('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x537f('0x3'));exports[_0x537f('0x4')]=function(_0x43de1f){var _0x291b06=this;return new Promise(function(_0x3743e4,_0x10869f){return db[_0x537f('0x5')][_0x537f('0x6')]({'raw':_0x43de1f[_0x537f('0x7')]?_0x43de1f[_0x537f('0x7')][_0x537f('0x8')]===undefined?!![]:![]:!![],'where':_0x43de1f[_0x537f('0x7')]?_0x43de1f[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':_0x43de1f['options']?_0x43de1f[_0x537f('0x7')][_0x537f('0xa')]||null:null,'limit':_0x43de1f[_0x537f('0x7')]?_0x43de1f[_0x537f('0x7')][_0x537f('0xb')]||null:null,'include':_0x43de1f[_0x537f('0x7')]?_0x43de1f[_0x537f('0x7')][_0x537f('0xc')]?_[_0x537f('0xd')](_0x43de1f[_0x537f('0x7')][_0x537f('0xc')],function(_0x27e3f8){return{'model':db[_0x27e3f8['model']],'as':_0x27e3f8['as'],'attributes':_0x27e3f8[_0x537f('0xa')],'include':_0x27e3f8[_0x537f('0xc')]?_['map'](_0x27e3f8[_0x537f('0xc')],function(_0x24493d){return{'model':db[_0x24493d[_0x537f('0xe')]],'as':_0x24493d['as'],'attributes':_0x24493d[_0x537f('0xa')],'include':_0x24493d[_0x537f('0xc')]?_[_0x537f('0xd')](_0x24493d[_0x537f('0xc')],function(_0x50ca09){return{'model':db[_0x50ca09[_0x537f('0xe')]],'as':_0x50ca09['as'],'attributes':_0x50ca09[_0x537f('0xa')]};}):[]};}):[]};}):[]:[]})[_0x537f('0xf')](function(_0x3ec8db){logger[_0x537f('0x10')](_0x537f('0x4'),_0x43de1f);logger[_0x537f('0x11')](_0x537f('0x4'),_0x43de1f,JSON[_0x537f('0x12')](_0x3ec8db));_0x3743e4(_0x3ec8db);})[_0x537f('0x13')](function(_0x35ee3a){logger['error']('GetCmHopper',_0x35ee3a[_0x537f('0x14')],_0x43de1f);_0x10869f(_0x291b06['error'](0x1f4,_0x35ee3a[_0x537f('0x14')]));});});};exports[_0x537f('0x15')]=function(_0x270937){var _0x293074=this;return new Promise(function(_0x1afcb0,_0x597fbb){return db[_0x537f('0x5')][_0x537f('0x16')]({'raw':_0x270937[_0x537f('0x7')]?_0x270937[_0x537f('0x7')][_0x537f('0x8')]===undefined?!![]:![]:!![],'where':_0x270937[_0x537f('0x7')]?_0x270937[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':_0x270937[_0x537f('0x7')]?_0x270937['options'][_0x537f('0xa')]||null:null,'include':_0x270937[_0x537f('0x7')]?_0x270937[_0x537f('0x7')][_0x537f('0xc')]?_[_0x537f('0xd')](_0x270937['options'][_0x537f('0xc')],function(_0x261b2f){return{'model':db[_0x261b2f[_0x537f('0xe')]],'as':_0x261b2f['as'],'attributes':_0x261b2f[_0x537f('0xa')],'include':_0x261b2f['include']?_[_0x537f('0xd')](_0x261b2f['include'],function(_0x7496a8){return{'model':db[_0x7496a8[_0x537f('0xe')]],'as':_0x7496a8['as'],'attributes':_0x7496a8[_0x537f('0xa')],'include':_0x7496a8[_0x537f('0xc')]?_[_0x537f('0xd')](_0x7496a8[_0x537f('0xc')],function(_0x5a09b5){return{'model':db[_0x5a09b5[_0x537f('0xe')]],'as':_0x5a09b5['as'],'attributes':_0x5a09b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f42bd){logger[_0x537f('0x10')](_0x537f('0x15'),_0x270937);logger[_0x537f('0x11')](_0x537f('0x15'),_0x270937,JSON[_0x537f('0x12')](_0x4f42bd));_0x1afcb0(_0x4f42bd);})[_0x537f('0x13')](function(_0x4ad9ac){logger['error'](_0x537f('0x15'),_0x4ad9ac[_0x537f('0x14')],_0x270937);_0x597fbb(_0x293074[_0x537f('0x17')](0x1f4,_0x4ad9ac[_0x537f('0x14')]));});});};exports[_0x537f('0x18')]=function(_0x243234){var _0x11a409=this;return new Promise(function(_0x42d88a,_0x1a4099){return db[_0x537f('0x5')][_0x537f('0x19')](_0x243234[_0x537f('0x1a')],{'raw':_0x243234[_0x537f('0x7')]?_0x243234[_0x537f('0x7')][_0x537f('0x8')]===undefined?!![]:![]:!![]})[_0x537f('0xf')](function(_0x3c71c0){logger[_0x537f('0x10')](_0x537f('0x18'),_0x243234);logger[_0x537f('0x11')](_0x537f('0x18'),_0x243234,JSON[_0x537f('0x12')](_0x3c71c0));_0x42d88a(_0x3c71c0);})['catch'](function(_0x48e7a3){logger[_0x537f('0x17')](_0x537f('0x18'),_0x48e7a3['message'],_0x243234);_0x1a4099(_0x11a409[_0x537f('0x17')](0x1f4,_0x48e7a3['message']));});});};exports['UpdateCmHopper']=function(_0x253db5){var _0x21a4dd=this;return new Promise(function(_0x43fc14,_0x7b0b70){return db[_0x537f('0x5')]['update'](_0x253db5['body'],{'raw':_0x253db5[_0x537f('0x7')]?_0x253db5['options'][_0x537f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253db5[_0x537f('0x7')]?_0x253db5[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':_0x253db5[_0x537f('0x7')]?_0x253db5[_0x537f('0x7')]['attributes']||null:null,'limit':_0x253db5[_0x537f('0x7')]?_0x253db5[_0x537f('0x7')][_0x537f('0xb')]||null:null})['then'](function(_0x32651f){logger['info']('UpdateCmHopper',_0x253db5);logger[_0x537f('0x10')](_0x537f('0x1b'),JSON[_0x537f('0x12')](_0x253db5[_0x537f('0x7')]['where']),_0x253db5['body']['active']);logger[_0x537f('0x11')](_0x537f('0x1c'),_0x253db5,JSON[_0x537f('0x12')](_0x32651f));_0x43fc14(_0x32651f);})[_0x537f('0x13')](function(_0x28413c){logger[_0x537f('0x17')](_0x537f('0x1c'),_0x28413c[_0x537f('0x14')],_0x253db5);_0x7b0b70(_0x21a4dd[_0x537f('0x17')](0x1f4,_0x28413c['message']));});});};exports['DestroyCmHopper']=function(_0x298530){var _0x1d0eb7=this;return new Promise(function(_0x50c07b,_0x1746d8){return db[_0x537f('0x5')][_0x537f('0x1d')]({'where':_0x298530['options']?_0x298530[_0x537f('0x7')][_0x537f('0x9')]||null:null})['then'](function(_0x30ee51){logger['info'](_0x537f('0x1e'),_0x298530);logger[_0x537f('0x11')](_0x537f('0x1e'),_0x298530,JSON['stringify'](_0x30ee51));_0x50c07b(_0x30ee51);})[_0x537f('0x13')](function(_0x198364){logger['error'](_0x537f('0x1e'),_0x198364['message'],_0x298530);_0x1746d8(_0x1d0eb7[_0x537f('0x17')](0x1f4,_0x198364[_0x537f('0x14')]));});});};exports[_0x537f('0x1f')]=function(_0x216269){var _0x4e6aaa=this;return new Promise(function(_0x2ef1fe,_0x491687){return db[_0x537f('0x20')]['describe']()[_0x537f('0xf')](function(_0x1de226){return db['sequelize'][_0x537f('0x21')](function(_0x211c1b){return db[_0x537f('0x5')][_0x537f('0x6')]({'where':_0x216269[_0x537f('0x7')]?_0x216269[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':_0x216269['options']?_0x216269[_0x537f('0x7')][_0x537f('0xa')]||null:null,'limit':_0x216269[_0x537f('0x7')]?_0x216269[_0x537f('0x7')][_0x537f('0xb')]||null:null,'order':_0x216269[_0x537f('0x7')]?_0x216269[_0x537f('0x7')][_0x537f('0x22')]||null:null,'transaction':_0x211c1b,'lock':_0x211c1b[_0x537f('0x23')][_0x537f('0x24')],'include':[{'model':db[_0x537f('0x20')],'as':_0x537f('0x25'),'attributes':_[_0x537f('0x26')](_0x1de226)},{'model':db[_0x537f('0x27')],'as':'Agent','attributes':['id',_0x537f('0x28'),_0x537f('0x29')]}]})['then'](function(_0x2e96a4){var _0x38e852=[];var _0x47c296=[];for(var _0x1e5bd8=0x0;_0x1e5bd8<_0x2e96a4[_0x537f('0x2a')];_0x1e5bd8+=0x1){var _0x13dbd5=_0x2e96a4[_0x1e5bd8]['UserId'];if(_0x13dbd5===null){_0x38e852[_0x537f('0x2b')](_0x2e96a4[_0x1e5bd8][_0x537f('0x2c')](_0x216269['body'],{'transaction':_0x211c1b}));}else if(!_0x47c296[_0x537f('0x2d')](_0x13dbd5)){_0x47c296['push'](_0x13dbd5);_0x38e852['push'](_0x2e96a4[_0x1e5bd8][_0x537f('0x2c')](_0x216269[_0x537f('0x1a')],{'transaction':_0x211c1b}));}}return BPromise[_0x537f('0x2e')](_0x38e852);});})['then'](function(_0x5354fd){logger[_0x537f('0x10')](_0x537f('0x1f'),_0x216269);if(_0x5354fd[_0x537f('0x2a')]>0x0){logger[_0x537f('0x10')](_0x537f('0x2f'),_0x5354fd[0x0][_0x537f('0x30')]['id'],_0x5354fd[0x0][_0x537f('0x30')][_0x537f('0x31')],_0x5354fd[0x0][_0x537f('0x30')][_0x537f('0x32')]);}logger[_0x537f('0x11')](_0x537f('0x1f'),_0x216269,JSON[_0x537f('0x12')](_0x5354fd));_0x2ef1fe(_0x5354fd);})[_0x537f('0x13')](function(_0x14d387){logger[_0x537f('0x17')](_0x537f('0x1f'),_0x14d387[_0x537f('0x14')],_0x216269);_0x491687(_0x4e6aaa[_0x537f('0x17')](0x1f4,_0x14d387['message']));});});});};exports[_0x537f('0x33')]=function(_0x214cc3){var _0x485164=this;return new Promise(function(_0xcfe4bd,_0x50f93c){return db['sequelize']['transaction'](function(_0x322854){return db['CmHopperFinal'][_0x537f('0x19')](_0x214cc3[_0x537f('0x1a')],{'raw':_0x214cc3[_0x537f('0x7')]?_0x214cc3[_0x537f('0x7')][_0x537f('0x8')]===undefined?!![]:![]:!![],'transaction':_0x322854})[_0x537f('0xf')](function(){logger[_0x537f('0x10')](_0x537f('0x34'),JSON[_0x537f('0x12')](_0x214cc3[_0x537f('0x7')][_0x537f('0x9')]),_0x214cc3['options'][_0x537f('0x9')][_0x537f('0x32')]);return db['CmHopper']['destroy']({'where':_0x214cc3[_0x537f('0x7')]?_0x214cc3[_0x537f('0x7')][_0x537f('0x9')]||null:null,'transaction':_0x322854});});})[_0x537f('0xf')](function(_0x1dc4c3){logger[_0x537f('0x10')](_0x537f('0x33'),_0x214cc3);logger['debug'](_0x537f('0x33'),_0x214cc3,JSON[_0x537f('0x12')](_0x1dc4c3));_0xcfe4bd(_0x1dc4c3);})[_0x537f('0x13')](function(_0x57e63a){logger[_0x537f('0x17')](_0x537f('0x33'),_0x57e63a[_0x537f('0x14')],_0x214cc3);_0x50f93c(_0x485164['error'](0x1f4,_0x57e63a[_0x537f('0x14')]));});});};exports['CountReScheduled']=function(_0x407ac3){var _0x564c08=this;return new Promise(function(_0x486f6e,_0x43ea3d){return db[_0x537f('0x5')][_0x537f('0x6')]({'raw':_0x407ac3[_0x537f('0x7')]?_0x407ac3[_0x537f('0x7')][_0x537f('0x8')]===undefined?!![]:![]:!![],'where':_0x407ac3[_0x537f('0x7')]?_0x407ac3[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':[[db[_0x537f('0x35')]['fn']('COUNT',db[_0x537f('0x35')]['fn']('IF',db[_0x537f('0x35')]['literal'](_0x537f('0x36')+util[_0x537f('0x37')](_0x537f('0x38'),moment()[_0x537f('0x37')](_0x537f('0x39')))+'\x20,\x201,\x20null'))),_0x537f('0x3a')]]})[_0x537f('0xf')](function(_0x535973){logger[_0x537f('0x10')](_0x537f('0x3b'),_0x407ac3);logger['debug'](_0x537f('0x3b'),_0x407ac3,JSON['stringify'](_0x535973));_0x486f6e(_0x535973);})[_0x537f('0x13')](function(_0x45da2b){logger[_0x537f('0x17')](_0x537f('0x3b'),_0x45da2b[_0x537f('0x14')],_0x407ac3);_0x43ea3d(_0x564c08['error'](0x1f4,_0x45da2b['message']));});});};exports[_0x537f('0x3c')]=function(_0x368447){var _0x34dfdf=this;return new Promise(function(_0x4cf345,_0x2b0c5f){return db[_0x537f('0x20')]['describe']()['then'](function(){return db[_0x537f('0x35')][_0x537f('0x21')](function(_0x25f9bc){return db[_0x537f('0x5')][_0x537f('0x6')]({'where':_0x368447['options']?_0x368447[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':_0x368447['options']?_0x368447[_0x537f('0x7')][_0x537f('0xa')]||null:null,'limit':0x1,'order':_0x368447[_0x537f('0x7')]?_0x368447[_0x537f('0x7')][_0x537f('0x22')]||null:null,'group':db['CmHopper'][_0x537f('0x3d')],'transaction':_0x25f9bc,'lock':_0x25f9bc['LOCK'][_0x537f('0x24')],'include':_0x368447[_0x537f('0x7')]?_0x368447['options'][_0x537f('0xc')]?_[_0x537f('0xd')](_0x368447[_0x537f('0x7')][_0x537f('0xc')],function(_0x338a04){return{'model':db[_0x338a04['model']],'as':_0x338a04['as'],'attributes':_0x338a04[_0x537f('0xa')],'include':_0x338a04[_0x537f('0xc')]?_['map'](_0x338a04[_0x537f('0xc')],function(_0x4c4e26){return{'model':db[_0x4c4e26[_0x537f('0xe')]],'as':_0x4c4e26['as'],'attributes':_0x4c4e26[_0x537f('0xa')],'include':_0x4c4e26[_0x537f('0xc')]?_[_0x537f('0xd')](_0x4c4e26[_0x537f('0xc')],function(_0x3feac9){return{'model':db[_0x3feac9[_0x537f('0xe')]],'as':_0x3feac9['as'],'attributes':_0x3feac9[_0x537f('0xa')]};}):[]};}):[]};}):[]:[]})[_0x537f('0xf')](function(_0x1607d2){var _0x1eb5ba=[];for(var _0x1fdf11=0x0;_0x1fdf11<_0x1607d2['length'];_0x1fdf11+=0x1){_0x1eb5ba[_0x537f('0x2b')](_0x1607d2[_0x1fdf11][_0x537f('0x2c')](_0x368447[_0x537f('0x1a')],{'transaction':_0x25f9bc}));}return BPromise['all'](_0x1eb5ba);});})['then'](function(_0x496af0){logger[_0x537f('0x10')](_0x537f('0x3c'),_0x368447);logger['debug'](_0x537f('0x3c'),_0x368447,JSON[_0x537f('0x12')](_0x496af0));_0x4cf345(_0x496af0);})[_0x537f('0x13')](function(_0x434531){logger[_0x537f('0x17')]('GetContactRecallMe',_0x434531[_0x537f('0x14')],_0x368447);_0x2b0c5f(_0x34dfdf[_0x537f('0x17')](0x1f4,_0x434531[_0x537f('0x14')]));});});});};exports[_0x537f('0x3e')]=function(_0x11aa68){var _0x287d9e=this;return new Promise(function(_0x448d5e,_0x3fa89d){db['CmContact'][_0x537f('0x3f')]()[_0x537f('0xf')](function(_0x2aca28){return db[_0x537f('0x5')][_0x537f('0x6')]({'raw':_0x11aa68[_0x537f('0x7')]?_0x11aa68[_0x537f('0x7')][_0x537f('0x8')]===undefined?!![]:![]:!![],'where':_0x11aa68[_0x537f('0x7')]?_0x11aa68[_0x537f('0x7')][_0x537f('0x9')]||null:null,'attributes':_0x11aa68['options']?_0x11aa68[_0x537f('0x7')]['attributes']||null:null,'limit':_0x11aa68[_0x537f('0x7')]?_0x11aa68['options'][_0x537f('0xb')]||null:null,'include':_0x11aa68['options']?_0x11aa68[_0x537f('0x7')][_0x537f('0xc')]?_[_0x537f('0xd')](_0x11aa68[_0x537f('0x7')][_0x537f('0xc')],function(_0x21422c){return{'model':db[_0x21422c[_0x537f('0xe')]],'as':_0x21422c['as'],'attributes':_0x21422c['as']===_0x537f('0x25')?_[_0x537f('0x26')](_0x2aca28):_0x21422c[_0x537f('0xa')],'include':_0x21422c['include']?_[_0x537f('0xd')](_0x21422c[_0x537f('0xc')],function(_0x58552c){return{'model':db[_0x58552c['model']],'as':_0x58552c['as'],'attributes':_0x58552c[_0x537f('0xa')],'include':_0x58552c[_0x537f('0xc')]?_[_0x537f('0xd')](_0x58552c[_0x537f('0xc')],function(_0x46e986){return{'model':db[_0x46e986['model']],'as':_0x46e986['as'],'attributes':_0x46e986[_0x537f('0xa')]};}):[]};}):[]};}):[]:[]})[_0x537f('0xf')](function(_0x5d3ec6){logger['info'](_0x537f('0x4'),_0x11aa68);logger['debug'](_0x537f('0x4'),_0x11aa68,JSON[_0x537f('0x12')](_0x5d3ec6));_0x448d5e(_0x5d3ec6);})[_0x537f('0x13')](function(_0x6d88d3){logger[_0x537f('0x17')]('GetCmHopper',_0x6d88d3[_0x537f('0x14')],_0x11aa68);_0x3fa89d(_0x287d9e[_0x537f('0x17')](0x1f4,_0x6d88d3[_0x537f('0x14')]));});});});};exports[_0x537f('0x40')]=function(_0x1e11a1){var _0x577a10=this;return new Promise(function(_0x2f7c69,_0x4faa93){return db[_0x537f('0x20')]['findOne']({'raw':!![],'where':{'phone':_0x1e11a1[_0x537f('0x7')][_0x537f('0x9')]['phone']},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x537f('0xf')](function(_0x40eb5e){logger[_0x537f('0x10')]('getContactByPhone',_0x1e11a1);logger['debug'](_0x537f('0x41'),_0x1e11a1,JSON[_0x537f('0x12')](_0x40eb5e));_0x2f7c69(_0x40eb5e);})[_0x537f('0x13')](function(_0x5c4a2c){logger[_0x537f('0x17')](_0x537f('0x41'),_0x5c4a2c[_0x537f('0x14')],_0x1e11a1);_0x4faa93(_0x577a10[_0x537f('0x17')](0x1f4,_0x5c4a2c[_0x537f('0x14')]));});});};exports[_0x537f('0x42')]=function(_0xbee511){var _0x4e42dd=this;return new Promise(function(_0x429e48,_0x4d940d){return db[_0x537f('0x35')]['transaction'](function(_0x4be39f){var _0x221991=_0xbee511['options']&&_0xbee511[_0x537f('0x7')]['where']?_0xbee511[_0x537f('0x7')][_0x537f('0x9')]:{};return db['CmHopper']['update'](_0xbee511[_0x537f('0x1a')],{'where':_0x221991,'transaction':_0x4be39f})[_0x537f('0xf')](function(_0x50ed0b){logger['info'](_0x537f('0x42'),_0xbee511);logger[_0x537f('0x11')](_0x537f('0x42'),_0xbee511,JSON['stringify'](_0x50ed0b));_0x429e48(_0x50ed0b);})[_0x537f('0x13')](function(_0x25349f){logger['error'](_0x537f('0x42'),_0x25349f[_0x537f('0x14')],_0xbee511);_0x4d940d(_0x4e42dd[_0x537f('0x17')](0x1f4,_0x25349f[_0x537f('0x14')]));});});});};exports[_0x537f('0x43')]=function(_0x15c41e){var _0x354f89=this;var _0x36444e=_0x15c41e['body'][_0x537f('0x9')][_0x537f('0x44')];var _0x13a9c1=_0x15c41e[_0x537f('0x1a')][_0x537f('0x9')][_0x537f('0x45')];var _0x3ee1b8=_0x15c41e[_0x537f('0x1a')][_0x537f('0x9')][_0x537f('0x46')];return new Promise(function(_0x67f6a8,_0x17898d){return db[_0x537f('0x5')][_0x537f('0x6')]({'where':{'voiceQueueId':{'$in':_0x36444e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x537f('0x47')](_0x537f('0x48')+_0x13a9c1+_0x537f('0x49')),'$gt':db[_0x537f('0x35')][_0x537f('0x47')](_0x537f('0x4a'))}},'UserId':{'$in':_0x3ee1b8}},'include':[{'model':db[_0x537f('0x20')],'as':_0x537f('0x25')},{'model':db[_0x537f('0x27')],'as':'Agent','attributes':['id',_0x537f('0x28'),_0x537f('0x29')]},{'model':db[_0x537f('0x4b')],'as':_0x537f('0x4c')}]})[_0x537f('0xf')](function(_0x49de6a){if(_0x49de6a[_0x537f('0x2a')]>0x0){return db['sequelize'][_0x537f('0x21')](function(_0x2d47b0){return db[_0x537f('0x5')][_0x537f('0x2c')]({'recallmeNotifiedDate':db[_0x537f('0x35')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0x537f('0xd')](_0x49de6a,'id')}},'transaction':_0x2d47b0})[_0x537f('0xf')](function(){_0x67f6a8(_0x49de6a);})[_0x537f('0x13')](function(_0x5c64b2){logger[_0x537f('0x17')](_0x537f('0x43'),_0x5c64b2[_0x537f('0x14')],_0x15c41e);_0x17898d(_0x354f89[_0x537f('0x17')](0x1f4,_0x5c64b2['message']));});})[_0x537f('0x13')](function(_0x3351ad){logger[_0x537f('0x17')](_0x537f('0x43'),_0x3351ad[_0x537f('0x14')],_0x15c41e);_0x17898d(_0x354f89[_0x537f('0x17')](0x1f4,_0x3351ad[_0x537f('0x14')]));});}else{_0x67f6a8(_0x49de6a);}});});};
\ No newline at end of file
+var _0xa6a4=['voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','util','moment','bluebird','../../mysqldb','../../config/logger','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','info','GetCmHopper','stringify','catch','error','message','find','then','debug','ShowCmHopper','CreateCmHopper','create','body','active','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','LOCK','UPDATE','CmContact','keys','Agent','name','voicePause','length','UserId','push','update','dataValues','MoveContactManagedDialer','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x495468,_0x77c7ae){var _0x53ecc6=function(_0x15ae58){while(--_0x15ae58){_0x495468['push'](_0x495468['shift']());}};_0x53ecc6(++_0x77c7ae);}(_0xa6a4,0x9e));var _0x4a6a=function(_0x24a782,_0x51eaf3){_0x24a782=_0x24a782-0x0;var _0x109a20=_0xa6a4[_0x24a782];return _0x109a20;};'use strict';var _=require('lodash');var util=require(_0x4a6a('0x0'));var moment=require(_0x4a6a('0x1'));var BPromise=require(_0x4a6a('0x2'));var db=require(_0x4a6a('0x3'))['db'];var logger=require(_0x4a6a('0x4'))('rpc');exports['GetCmHopper']=function(_0x33c708){var _0x364ba3=this;return new Promise(function(_0x147977,_0x4e1bed){return db[_0x4a6a('0x5')][_0x4a6a('0x6')]({'raw':_0x33c708[_0x4a6a('0x7')]?_0x33c708[_0x4a6a('0x7')][_0x4a6a('0x8')]===undefined?!![]:![]:!![],'where':_0x33c708[_0x4a6a('0x7')]?_0x33c708[_0x4a6a('0x7')][_0x4a6a('0x9')]||null:null,'attributes':_0x33c708[_0x4a6a('0x7')]?_0x33c708[_0x4a6a('0x7')][_0x4a6a('0xa')]||null:null,'limit':_0x33c708[_0x4a6a('0x7')]?_0x33c708[_0x4a6a('0x7')][_0x4a6a('0xb')]||null:null,'include':_0x33c708[_0x4a6a('0x7')]?_0x33c708[_0x4a6a('0x7')][_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0x33c708[_0x4a6a('0x7')][_0x4a6a('0xc')],function(_0xcddb3e){return{'model':db[_0xcddb3e[_0x4a6a('0xe')]],'as':_0xcddb3e['as'],'attributes':_0xcddb3e[_0x4a6a('0xa')],'include':_0xcddb3e[_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0xcddb3e[_0x4a6a('0xc')],function(_0x52cbd0){return{'model':db[_0x52cbd0[_0x4a6a('0xe')]],'as':_0x52cbd0['as'],'attributes':_0x52cbd0['attributes'],'include':_0x52cbd0[_0x4a6a('0xc')]?_['map'](_0x52cbd0[_0x4a6a('0xc')],function(_0x101cad){return{'model':db[_0x101cad[_0x4a6a('0xe')]],'as':_0x101cad['as'],'attributes':_0x101cad[_0x4a6a('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10d768){logger[_0x4a6a('0xf')](_0x4a6a('0x10'),_0x33c708);logger['debug'](_0x4a6a('0x10'),_0x33c708,JSON[_0x4a6a('0x11')](_0x10d768));_0x147977(_0x10d768);})[_0x4a6a('0x12')](function(_0x24b729){logger[_0x4a6a('0x13')](_0x4a6a('0x10'),_0x24b729[_0x4a6a('0x14')],_0x33c708);_0x4e1bed(_0x364ba3[_0x4a6a('0x13')](0x1f4,_0x24b729[_0x4a6a('0x14')]));});});};exports['ShowCmHopper']=function(_0xe1c1fb){var _0x2ab05c=this;return new Promise(function(_0x1fafe1,_0x7d1d0b){return db[_0x4a6a('0x5')][_0x4a6a('0x15')]({'raw':_0xe1c1fb['options']?_0xe1c1fb[_0x4a6a('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0xe1c1fb['options']?_0xe1c1fb[_0x4a6a('0x7')][_0x4a6a('0x9')]||null:null,'attributes':_0xe1c1fb['options']?_0xe1c1fb[_0x4a6a('0x7')][_0x4a6a('0xa')]||null:null,'include':_0xe1c1fb[_0x4a6a('0x7')]?_0xe1c1fb[_0x4a6a('0x7')][_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0xe1c1fb[_0x4a6a('0x7')][_0x4a6a('0xc')],function(_0x1dce27){return{'model':db[_0x1dce27[_0x4a6a('0xe')]],'as':_0x1dce27['as'],'attributes':_0x1dce27[_0x4a6a('0xa')],'include':_0x1dce27['include']?_[_0x4a6a('0xd')](_0x1dce27['include'],function(_0x33a570){return{'model':db[_0x33a570[_0x4a6a('0xe')]],'as':_0x33a570['as'],'attributes':_0x33a570['attributes'],'include':_0x33a570[_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0x33a570['include'],function(_0x2f46af){return{'model':db[_0x2f46af['model']],'as':_0x2f46af['as'],'attributes':_0x2f46af[_0x4a6a('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4a6a('0x16')](function(_0x34ecf9){logger['info']('ShowCmHopper',_0xe1c1fb);logger[_0x4a6a('0x17')](_0x4a6a('0x18'),_0xe1c1fb,JSON[_0x4a6a('0x11')](_0x34ecf9));_0x1fafe1(_0x34ecf9);})[_0x4a6a('0x12')](function(_0x39f46e){logger['error'](_0x4a6a('0x18'),_0x39f46e['message'],_0xe1c1fb);_0x7d1d0b(_0x2ab05c['error'](0x1f4,_0x39f46e[_0x4a6a('0x14')]));});});};exports[_0x4a6a('0x19')]=function(_0x2c1646){var _0x44a628=this;return new Promise(function(_0x2a9ebe,_0x4eea87){return db[_0x4a6a('0x5')][_0x4a6a('0x1a')](_0x2c1646[_0x4a6a('0x1b')],{'raw':_0x2c1646['options']?_0x2c1646[_0x4a6a('0x7')][_0x4a6a('0x8')]===undefined?!![]:![]:!![]})[_0x4a6a('0x16')](function(_0x1eb9ad){logger['info'](_0x4a6a('0x19'),_0x2c1646);logger[_0x4a6a('0x17')](_0x4a6a('0x19'),_0x2c1646,JSON[_0x4a6a('0x11')](_0x1eb9ad));_0x2a9ebe(_0x1eb9ad);})[_0x4a6a('0x12')](function(_0x5d2fbc){logger[_0x4a6a('0x13')](_0x4a6a('0x19'),_0x5d2fbc[_0x4a6a('0x14')],_0x2c1646);_0x4eea87(_0x44a628[_0x4a6a('0x13')](0x1f4,_0x5d2fbc[_0x4a6a('0x14')]));});});};exports['UpdateCmHopper']=function(_0x5d0b3e){var _0x2c3fff=this;return new Promise(function(_0x49fe53,_0x3fb856){return db['CmHopper']['update'](_0x5d0b3e[_0x4a6a('0x1b')],{'raw':_0x5d0b3e['options']?_0x5d0b3e[_0x4a6a('0x7')][_0x4a6a('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0b3e[_0x4a6a('0x7')]?_0x5d0b3e[_0x4a6a('0x7')][_0x4a6a('0x9')]||null:null,'attributes':_0x5d0b3e[_0x4a6a('0x7')]?_0x5d0b3e[_0x4a6a('0x7')]['attributes']||null:null,'limit':_0x5d0b3e['options']?_0x5d0b3e[_0x4a6a('0x7')][_0x4a6a('0xb')]||null:null})['then'](function(_0x2f6207){logger[_0x4a6a('0xf')]('UpdateCmHopper',_0x5d0b3e);logger[_0x4a6a('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5d0b3e[_0x4a6a('0x7')][_0x4a6a('0x9')]),_0x5d0b3e[_0x4a6a('0x1b')][_0x4a6a('0x1c')]);logger['debug'](_0x4a6a('0x1d'),_0x5d0b3e,JSON[_0x4a6a('0x11')](_0x2f6207));_0x49fe53(_0x2f6207);})[_0x4a6a('0x12')](function(_0x54bcc0){logger[_0x4a6a('0x13')](_0x4a6a('0x1d'),_0x54bcc0[_0x4a6a('0x14')],_0x5d0b3e);_0x3fb856(_0x2c3fff[_0x4a6a('0x13')](0x1f4,_0x54bcc0[_0x4a6a('0x14')]));});});};exports[_0x4a6a('0x1e')]=function(_0x1310b3){var _0x487b8d=this;return new Promise(function(_0x3a3551,_0x43dd78){return db['CmHopper'][_0x4a6a('0x1f')]({'where':_0x1310b3['options']?_0x1310b3[_0x4a6a('0x7')][_0x4a6a('0x9')]||null:null})['then'](function(_0x192319){logger[_0x4a6a('0xf')](_0x4a6a('0x1e'),_0x1310b3);logger['debug']('DestroyCmHopper',_0x1310b3,JSON[_0x4a6a('0x11')](_0x192319));_0x3a3551(_0x192319);})[_0x4a6a('0x12')](function(_0x260bb2){logger[_0x4a6a('0x13')](_0x4a6a('0x1e'),_0x260bb2[_0x4a6a('0x14')],_0x1310b3);_0x43dd78(_0x487b8d[_0x4a6a('0x13')](0x1f4,_0x260bb2[_0x4a6a('0x14')]));});});};exports[_0x4a6a('0x20')]=function(_0x5b388d){var _0x5a3c94=this;return new Promise(function(_0x3a797e,_0x5321ac){return db['CmContact'][_0x4a6a('0x21')]()[_0x4a6a('0x16')](function(_0x270770){return db['sequelize'][_0x4a6a('0x22')](function(_0x3d93f8){return db[_0x4a6a('0x5')][_0x4a6a('0x6')]({'where':_0x5b388d[_0x4a6a('0x7')]?_0x5b388d['options']['where']||null:null,'attributes':_0x5b388d[_0x4a6a('0x7')]?_0x5b388d[_0x4a6a('0x7')][_0x4a6a('0xa')]||null:null,'limit':_0x5b388d[_0x4a6a('0x7')]?_0x5b388d[_0x4a6a('0x7')]['limit']||null:null,'order':_0x5b388d[_0x4a6a('0x7')]?_0x5b388d[_0x4a6a('0x7')][_0x4a6a('0x23')]||null:null,'transaction':_0x3d93f8,'lock':_0x3d93f8[_0x4a6a('0x24')][_0x4a6a('0x25')],'include':[{'model':db[_0x4a6a('0x26')],'as':'Contact','attributes':_[_0x4a6a('0x27')](_0x270770)},{'model':db['User'],'as':_0x4a6a('0x28'),'attributes':['id',_0x4a6a('0x29'),_0x4a6a('0x2a')]}]})[_0x4a6a('0x16')](function(_0x11cbf9){var _0x44025d=[];var _0x1faccd=[];for(var _0x1cbcd8=0x0;_0x1cbcd8<_0x11cbf9[_0x4a6a('0x2b')];_0x1cbcd8+=0x1){var _0x163fdc=_0x11cbf9[_0x1cbcd8][_0x4a6a('0x2c')];if(_0x163fdc===null){_0x44025d['push'](_0x11cbf9[_0x1cbcd8]['update'](_0x5b388d[_0x4a6a('0x1b')],{'transaction':_0x3d93f8}));}else if(!_0x1faccd['includes'](_0x163fdc)){_0x1faccd[_0x4a6a('0x2d')](_0x163fdc);_0x44025d[_0x4a6a('0x2d')](_0x11cbf9[_0x1cbcd8][_0x4a6a('0x2e')](_0x5b388d[_0x4a6a('0x1b')],{'transaction':_0x3d93f8}));}}return BPromise['all'](_0x44025d);});})[_0x4a6a('0x16')](function(_0x22c2e9){logger[_0x4a6a('0xf')](_0x4a6a('0x20'),_0x5b388d);if(_0x22c2e9[_0x4a6a('0x2b')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x22c2e9[0x0][_0x4a6a('0x2f')]['id'],_0x22c2e9[0x0][_0x4a6a('0x2f')]['ContactId'],_0x22c2e9[0x0][_0x4a6a('0x2f')]['active']);}logger[_0x4a6a('0x17')](_0x4a6a('0x20'),_0x5b388d,JSON[_0x4a6a('0x11')](_0x22c2e9));_0x3a797e(_0x22c2e9);})[_0x4a6a('0x12')](function(_0x505afe){logger['error'](_0x4a6a('0x20'),_0x505afe[_0x4a6a('0x14')],_0x5b388d);_0x5321ac(_0x5a3c94['error'](0x1f4,_0x505afe['message']));});});});};exports[_0x4a6a('0x30')]=function(_0x387a3d){var _0x1cd06a=this;return new Promise(function(_0x49b0e1,_0x2f22df){return db[_0x4a6a('0x31')]['transaction'](function(_0x1f0a48){return db['CmHopperFinal'][_0x4a6a('0x1a')](_0x387a3d['body'],{'raw':_0x387a3d[_0x4a6a('0x7')]?_0x387a3d[_0x4a6a('0x7')][_0x4a6a('0x8')]===undefined?!![]:![]:!![],'transaction':_0x1f0a48})['then'](function(){logger['info'](_0x4a6a('0x32'),JSON[_0x4a6a('0x11')](_0x387a3d[_0x4a6a('0x7')][_0x4a6a('0x9')]),_0x387a3d['options'][_0x4a6a('0x9')][_0x4a6a('0x1c')]);return db[_0x4a6a('0x5')][_0x4a6a('0x1f')]({'where':_0x387a3d[_0x4a6a('0x7')]?_0x387a3d[_0x4a6a('0x7')][_0x4a6a('0x9')]||null:null,'transaction':_0x1f0a48});});})[_0x4a6a('0x16')](function(_0x3d5b5b){logger[_0x4a6a('0xf')](_0x4a6a('0x30'),_0x387a3d);logger[_0x4a6a('0x17')](_0x4a6a('0x30'),_0x387a3d,JSON[_0x4a6a('0x11')](_0x3d5b5b));_0x49b0e1(_0x3d5b5b);})[_0x4a6a('0x12')](function(_0x3cfb3c){logger[_0x4a6a('0x13')](_0x4a6a('0x30'),_0x3cfb3c[_0x4a6a('0x14')],_0x387a3d);_0x2f22df(_0x1cd06a[_0x4a6a('0x13')](0x1f4,_0x3cfb3c[_0x4a6a('0x14')]));});});};exports['CountReScheduled']=function(_0x4d2e7a){var _0x3eed3c=this;return new Promise(function(_0x4cb6e5,_0x6764cb){return db[_0x4a6a('0x5')][_0x4a6a('0x6')]({'raw':_0x4d2e7a[_0x4a6a('0x7')]?_0x4d2e7a[_0x4a6a('0x7')][_0x4a6a('0x8')]===undefined?!![]:![]:!![],'where':_0x4d2e7a['options']?_0x4d2e7a[_0x4a6a('0x7')][_0x4a6a('0x9')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4a6a('0x33'),db[_0x4a6a('0x31')]['fn']('IF',db[_0x4a6a('0x31')][_0x4a6a('0x34')](_0x4a6a('0x35')+util['format'](_0x4a6a('0x36'),moment()[_0x4a6a('0x37')](_0x4a6a('0x38')))+'\x20,\x201,\x20null'))),_0x4a6a('0x39')]]})[_0x4a6a('0x16')](function(_0x293bda){logger[_0x4a6a('0xf')](_0x4a6a('0x3a'),_0x4d2e7a);logger[_0x4a6a('0x17')](_0x4a6a('0x3a'),_0x4d2e7a,JSON['stringify'](_0x293bda));_0x4cb6e5(_0x293bda);})[_0x4a6a('0x12')](function(_0x44b529){logger[_0x4a6a('0x13')](_0x4a6a('0x3a'),_0x44b529[_0x4a6a('0x14')],_0x4d2e7a);_0x6764cb(_0x3eed3c['error'](0x1f4,_0x44b529['message']));});});};exports[_0x4a6a('0x3b')]=function(_0x1a8f7a){var _0x4c9edb=this;return new Promise(function(_0x334d6d,_0xcba449){return db[_0x4a6a('0x26')][_0x4a6a('0x21')]()[_0x4a6a('0x16')](function(){return db[_0x4a6a('0x31')][_0x4a6a('0x22')](function(_0x5e5bd6){return db[_0x4a6a('0x5')]['findAll']({'where':_0x1a8f7a[_0x4a6a('0x7')]?_0x1a8f7a['options'][_0x4a6a('0x9')]||null:null,'attributes':_0x1a8f7a[_0x4a6a('0x7')]?_0x1a8f7a[_0x4a6a('0x7')][_0x4a6a('0xa')]||null:null,'limit':0x1,'order':_0x1a8f7a[_0x4a6a('0x7')]?_0x1a8f7a['options'][_0x4a6a('0x23')]||null:null,'group':db['CmHopper'][_0x4a6a('0x2c')],'transaction':_0x5e5bd6,'lock':_0x5e5bd6['LOCK']['UPDATE'],'include':_0x1a8f7a[_0x4a6a('0x7')]?_0x1a8f7a[_0x4a6a('0x7')][_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0x1a8f7a[_0x4a6a('0x7')][_0x4a6a('0xc')],function(_0x361abb){return{'model':db[_0x361abb['model']],'as':_0x361abb['as'],'attributes':_0x361abb[_0x4a6a('0xa')],'include':_0x361abb[_0x4a6a('0xc')]?_['map'](_0x361abb[_0x4a6a('0xc')],function(_0x375489){return{'model':db[_0x375489['model']],'as':_0x375489['as'],'attributes':_0x375489[_0x4a6a('0xa')],'include':_0x375489[_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0x375489[_0x4a6a('0xc')],function(_0x2da126){return{'model':db[_0x2da126['model']],'as':_0x2da126['as'],'attributes':_0x2da126[_0x4a6a('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4a6a('0x16')](function(_0x1174a0){var _0x44c061=[];for(var _0x4d5b12=0x0;_0x4d5b12<_0x1174a0[_0x4a6a('0x2b')];_0x4d5b12+=0x1){_0x44c061[_0x4a6a('0x2d')](_0x1174a0[_0x4d5b12]['update'](_0x1a8f7a['body'],{'transaction':_0x5e5bd6}));}return BPromise['all'](_0x44c061);});})[_0x4a6a('0x16')](function(_0x3b443a){logger['info']('GetContactRecallMe',_0x1a8f7a);logger[_0x4a6a('0x17')](_0x4a6a('0x3b'),_0x1a8f7a,JSON['stringify'](_0x3b443a));_0x334d6d(_0x3b443a);})[_0x4a6a('0x12')](function(_0x42880c){logger[_0x4a6a('0x13')]('GetContactRecallMe',_0x42880c['message'],_0x1a8f7a);_0xcba449(_0x4c9edb[_0x4a6a('0x13')](0x1f4,_0x42880c[_0x4a6a('0x14')]));});});});};exports[_0x4a6a('0x3c')]=function(_0x415895){var _0x27faf9=this;return new Promise(function(_0x1b45e4,_0x179199){db[_0x4a6a('0x26')][_0x4a6a('0x21')]()['then'](function(_0x30a918){return db[_0x4a6a('0x5')][_0x4a6a('0x6')]({'raw':_0x415895['options']?_0x415895[_0x4a6a('0x7')][_0x4a6a('0x8')]===undefined?!![]:![]:!![],'where':_0x415895[_0x4a6a('0x7')]?_0x415895['options']['where']||null:null,'attributes':_0x415895['options']?_0x415895['options'][_0x4a6a('0xa')]||null:null,'limit':_0x415895['options']?_0x415895['options'][_0x4a6a('0xb')]||null:null,'include':_0x415895[_0x4a6a('0x7')]?_0x415895['options']['include']?_[_0x4a6a('0xd')](_0x415895['options'][_0x4a6a('0xc')],function(_0x591a9e){return{'model':db[_0x591a9e[_0x4a6a('0xe')]],'as':_0x591a9e['as'],'attributes':_0x591a9e['as']===_0x4a6a('0x3d')?_[_0x4a6a('0x27')](_0x30a918):_0x591a9e[_0x4a6a('0xa')],'include':_0x591a9e['include']?_[_0x4a6a('0xd')](_0x591a9e['include'],function(_0x5b80c2){return{'model':db[_0x5b80c2[_0x4a6a('0xe')]],'as':_0x5b80c2['as'],'attributes':_0x5b80c2[_0x4a6a('0xa')],'include':_0x5b80c2[_0x4a6a('0xc')]?_[_0x4a6a('0xd')](_0x5b80c2[_0x4a6a('0xc')],function(_0x49a72d){return{'model':db[_0x49a72d[_0x4a6a('0xe')]],'as':_0x49a72d['as'],'attributes':_0x49a72d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a6a('0x16')](function(_0x41d359){logger['info'](_0x4a6a('0x10'),_0x415895);logger[_0x4a6a('0x17')](_0x4a6a('0x10'),_0x415895,JSON[_0x4a6a('0x11')](_0x41d359));_0x1b45e4(_0x41d359);})[_0x4a6a('0x12')](function(_0x1c1569){logger[_0x4a6a('0x13')]('GetCmHopper',_0x1c1569[_0x4a6a('0x14')],_0x415895);_0x179199(_0x27faf9[_0x4a6a('0x13')](0x1f4,_0x1c1569[_0x4a6a('0x14')]));});});});};exports[_0x4a6a('0x3e')]=function(_0x100147){var _0x3f26d6=this;return new Promise(function(_0x1d8872,_0x555b1f){return db[_0x4a6a('0x26')][_0x4a6a('0x3f')]({'raw':!![],'where':{'phone':_0x100147[_0x4a6a('0x7')]['where'][_0x4a6a('0x40')]},'attributes':['id',_0x4a6a('0x41')],'order':[['id',_0x4a6a('0x42')]]})['then'](function(_0x4a7ee4){logger[_0x4a6a('0xf')](_0x4a6a('0x43'),_0x100147);logger[_0x4a6a('0x17')](_0x4a6a('0x43'),_0x100147,JSON[_0x4a6a('0x11')](_0x4a7ee4));_0x1d8872(_0x4a7ee4);})[_0x4a6a('0x12')](function(_0x374e68){logger[_0x4a6a('0x13')]('getContactByPhone',_0x374e68[_0x4a6a('0x14')],_0x100147);_0x555b1f(_0x3f26d6[_0x4a6a('0x13')](0x1f4,_0x374e68['message']));});});};exports[_0x4a6a('0x44')]=function(_0x2a5870){var _0x200645=this;return new Promise(function(_0x12037c,_0x164c2b){return db[_0x4a6a('0x31')]['transaction'](function(_0x5e88f6){var _0x393aec=_0x2a5870[_0x4a6a('0x7')]&&_0x2a5870[_0x4a6a('0x7')]['where']?_0x2a5870[_0x4a6a('0x7')][_0x4a6a('0x9')]:{};return db[_0x4a6a('0x5')]['update'](_0x2a5870['body'],{'where':_0x393aec,'transaction':_0x5e88f6})['then'](function(_0x2548a5){logger[_0x4a6a('0xf')]('ResetActiveCalls',_0x2a5870);logger['debug'](_0x4a6a('0x44'),_0x2a5870,JSON[_0x4a6a('0x11')](_0x2548a5));_0x12037c(_0x2548a5);})[_0x4a6a('0x12')](function(_0x5996c3){logger['error'](_0x4a6a('0x44'),_0x5996c3[_0x4a6a('0x14')],_0x2a5870);_0x164c2b(_0x200645[_0x4a6a('0x13')](0x1f4,_0x5996c3[_0x4a6a('0x14')]));});});});};exports[_0x4a6a('0x45')]=function(_0x500a6f){var _0x506fd5=this;var _0x3cffa3=_0x500a6f[_0x4a6a('0x1b')]['where'][_0x4a6a('0x46')];var _0x146e82=_0x500a6f[_0x4a6a('0x1b')][_0x4a6a('0x9')][_0x4a6a('0x47')];var _0x3b3c8f=_0x500a6f['body'][_0x4a6a('0x9')][_0x4a6a('0x48')];return new Promise(function(_0xf6e69f,_0x4011f2){return db[_0x4a6a('0x5')][_0x4a6a('0x6')]({'where':{'voiceQueueId':{'$in':_0x3cffa3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4a6a('0x31')]['literal'](_0x4a6a('0x49')+_0x146e82+_0x4a6a('0x4a')),'$gt':db['sequelize'][_0x4a6a('0x34')]('NOW()')}},'UserId':{'$in':_0x3b3c8f}},'include':[{'model':db[_0x4a6a('0x26')],'as':_0x4a6a('0x3d')},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x4a6a('0x2a')]},{'model':db['CmList'],'as':'List'}]})[_0x4a6a('0x16')](function(_0x100453){if(_0x100453[_0x4a6a('0x2b')]>0x0){return db[_0x4a6a('0x31')][_0x4a6a('0x22')](function(_0x21dada){return db[_0x4a6a('0x5')][_0x4a6a('0x2e')]({'recallmeNotifiedDate':db['sequelize'][_0x4a6a('0x34')](_0x4a6a('0x4b'))},{'where':{'id':{'$in':_[_0x4a6a('0xd')](_0x100453,'id')}},'transaction':_0x21dada})[_0x4a6a('0x16')](function(){_0xf6e69f(_0x100453);})[_0x4a6a('0x12')](function(_0xb87681){logger[_0x4a6a('0x13')]('CmHopperHandlePreviewRecallNotifications',_0xb87681['message'],_0x500a6f);_0x4011f2(_0x506fd5['error'](0x1f4,_0xb87681[_0x4a6a('0x14')]));});})['catch'](function(_0x485be6){logger['error'](_0x4a6a('0x45'),_0x485be6[_0x4a6a('0x14')],_0x500a6f);_0x4011f2(_0x506fd5[_0x4a6a('0x13')](0x1f4,_0x485be6[_0x4a6a('0x14')]));});}else{_0xf6e69f(_0x100453);}});});};
\ No newline at end of file
index 5890f96..3881cc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa28d=['isAuthenticated','index','get','/describe','describe','getOpenContacts','/timezones','show','/:id/previewrecall','getPreviewRecall','post','create','/timezone','put','delete','/:id','destroy','exports','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xa28d,0xa5));var _0xda28=function(_0x5d3125,_0xbdb58f){_0x5d3125=_0x5d3125-0x0;var _0x5647ca=_0xa28d[_0x5d3125];return _0x5647ca;};'use strict';var express=require('express');var router=express[_0xda28('0x0')]();var auth=require(_0xda28('0x1'));var controller=require(_0xda28('0x2'));router['get']('/',auth[_0xda28('0x3')](),controller[_0xda28('0x4')]);router[_0xda28('0x5')](_0xda28('0x6'),auth[_0xda28('0x3')](),controller[_0xda28('0x7')]);router[_0xda28('0x5')]('/opencontacts',auth[_0xda28('0x3')](),controller[_0xda28('0x8')]);router['get'](_0xda28('0x9'),auth['isAuthenticated'](),controller['getTimezones']);router[_0xda28('0x5')]('/:id',auth[_0xda28('0x3')](),controller[_0xda28('0xa')]);router[_0xda28('0x5')](_0xda28('0xb'),auth['isAuthenticated'](),controller[_0xda28('0xc')]);router[_0xda28('0xd')]('/',auth[_0xda28('0x3')](),controller[_0xda28('0xe')]);router[_0xda28('0xd')]('/preview',auth[_0xda28('0x3')](),controller['getPreview']);router['post'](_0xda28('0xf'),auth[_0xda28('0x3')](),controller['getTimezone']);router[_0xda28('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xda28('0x11')](_0xda28('0x12'),auth[_0xda28('0x3')](),controller[_0xda28('0x13')]);module[_0xda28('0x14')]=router;
\ No newline at end of file
+var _0xe1b9=['getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/timezone','getTimezone','put','delete','destroy','exports','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1b9,0x147));var _0x9e1b=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe1b9[_0x2235bf];return _0x4c3a64;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x9e1b('0x0'));var controller=require(_0x9e1b('0x1'));router['get']('/',auth[_0x9e1b('0x2')](),controller[_0x9e1b('0x3')]);router[_0x9e1b('0x4')](_0x9e1b('0x5'),auth['isAuthenticated'](),controller[_0x9e1b('0x6')]);router[_0x9e1b('0x4')](_0x9e1b('0x7'),auth[_0x9e1b('0x2')](),controller[_0x9e1b('0x8')]);router['get']('/timezones',auth[_0x9e1b('0x2')](),controller[_0x9e1b('0x9')]);router[_0x9e1b('0x4')](_0x9e1b('0xa'),auth[_0x9e1b('0x2')](),controller[_0x9e1b('0xb')]);router[_0x9e1b('0x4')](_0x9e1b('0xc'),auth[_0x9e1b('0x2')](),controller[_0x9e1b('0xd')]);router[_0x9e1b('0xe')]('/',auth[_0x9e1b('0x2')](),controller['create']);router[_0x9e1b('0xe')]('/preview',auth[_0x9e1b('0x2')](),controller['getPreview']);router[_0x9e1b('0xe')](_0x9e1b('0xf'),auth[_0x9e1b('0x2')](),controller[_0x9e1b('0x10')]);router[_0x9e1b('0x11')](_0x9e1b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9e1b('0x12')](_0x9e1b('0xa'),auth[_0x9e1b('0x2')](),controller[_0x9e1b('0x13')]);module[_0x9e1b('0x14')]=router;
\ No newline at end of file
index a39db26..5bf935c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ca8=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4ca8,0x17e));var _0x84ca=function(_0x1fa31b,_0x429701){_0x1fa31b=_0x1fa31b-0x0;var _0x1dab57=_0x4ca8[_0x1fa31b];return _0x1dab57;};'use strict';var moment=require(_0x84ca('0x0'));var Sequelize=require(_0x84ca('0x1'));module[_0x84ca('0x2')]={'CmHopperId':{'type':Sequelize[_0x84ca('0x3')]},'phone':{'type':Sequelize[_0x84ca('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x84ca('0x5')],'defaultValue':moment()[_0x84ca('0x6')](_0x84ca('0x7'))},'countbusyretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x84ca('0x3')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x8879=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','INTEGER','DATE','format'];(function(_0x4793bd,_0x1b16ab){var _0x441c5b=function(_0x574b7a){while(--_0x574b7a){_0x4793bd['push'](_0x4793bd['shift']());}};_0x441c5b(++_0x1b16ab);}(_0x8879,0x7f));var _0x9887=function(_0x2da148,_0x450594){_0x2da148=_0x2da148-0x0;var _0x2bfd9c=_0x8879[_0x2da148];return _0x2bfd9c;};'use strict';var moment=require('moment');var Sequelize=require(_0x9887('0x0'));module[_0x9887('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x9887('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9887('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9887('0x4')],'defaultValue':moment()[_0x9887('0x5')](_0x9887('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9887('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9887('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9887('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9887('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9887('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index acf9363..66070c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1797=['path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','CmHopperAdditionalPhone','findAll','rows','catch','show','rawAttributes','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','util'];(function(_0x179de0,_0x4f407c){var _0x5e50dd=function(_0x29ba77){while(--_0x29ba77){_0x179de0['push'](_0x179de0['shift']());}};_0x5e50dd(++_0x4f407c);}(_0x1797,0xf1));var _0x7179=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1797[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7179('0x0'));var zipdir=require(_0x7179('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7179('0x2'));var moment=require(_0x7179('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7179('0x4'));var path=require(_0x7179('0x5'));var sox=require('sox');var csv=require(_0x7179('0x6'));var ejs=require(_0x7179('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7179('0x8'));var crypto=require(_0x7179('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7179('0xa'));var toCsv=require(_0x7179('0x6'));var querystring=require(_0x7179('0xb'));var Papa=require('papaparse');var Redis=require(_0x7179('0xc'));var authService=require(_0x7179('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7179('0xe'));var hardwareService=require(_0x7179('0xf'));var logger=require(_0x7179('0x10'))(_0x7179('0x11'));var utils=require(_0x7179('0x12'));var config=require(_0x7179('0x13'));var licenseUtil=require(_0x7179('0x14'));var db=require(_0x7179('0x15'))['db'];function respondWithStatusCode(_0x4db25b,_0x5133d2){_0x5133d2=_0x5133d2||0xcc;return function(_0x4f53b0){if(_0x4f53b0){return _0x4db25b[_0x7179('0x16')](_0x5133d2);}return _0x4db25b[_0x7179('0x17')](_0x5133d2)[_0x7179('0x18')]();};}function respondWithResult(_0x363215,_0x26ff19){_0x26ff19=_0x26ff19||0xc8;return function(_0x5ab18a){if(_0x5ab18a){return _0x363215['status'](_0x26ff19)[_0x7179('0x19')](_0x5ab18a);}};}function respondWithFilteredResult(_0x4870ca,_0x52e96e){return function(_0xb70396){if(_0xb70396){var _0xf70e21=typeof _0x52e96e[_0x7179('0x1a')]==='undefined'&&typeof _0x52e96e[_0x7179('0x1b')]===_0x7179('0x1c');var _0x22e794=_0xb70396[_0x7179('0x1d')];var _0x5f4d73=_0xf70e21?0x0:_0x52e96e[_0x7179('0x1a')];var _0x2f77c3=_0xf70e21?_0xb70396['count']:_0x52e96e[_0x7179('0x1a')]+_0x52e96e[_0x7179('0x1b')];var _0x3fedd7;if(_0x2f77c3>=_0x22e794){_0x2f77c3=_0x22e794;_0x3fedd7=0xc8;}else{_0x3fedd7=0xce;}_0x4870ca[_0x7179('0x17')](_0x3fedd7);return _0x4870ca[_0x7179('0x1e')](_0x7179('0x1f'),_0x5f4d73+'-'+_0x2f77c3+'/'+_0x22e794)[_0x7179('0x19')](_0xb70396);}return null;};}function patchUpdates(_0x503720){return function(_0x29cfe7){try{jsonpatch[_0x7179('0x20')](_0x29cfe7,_0x503720,!![]);}catch(_0x44a88e){return BPromise[_0x7179('0x21')](_0x44a88e);}return _0x29cfe7['save']();};}function saveUpdates(_0x18ce11,_0x3fb74e){return function(_0x5bddc5){if(_0x5bddc5){return _0x5bddc5['update'](_0x18ce11)[_0x7179('0x22')](function(_0x5b91b8){return _0x5b91b8;});}return null;};}function removeEntity(_0x5e44fa,_0x10d633){return function(_0x337c86){if(_0x337c86){return _0x337c86[_0x7179('0x23')]()[_0x7179('0x22')](function(){var _0x22f0be=_0x337c86[_0x7179('0x24')]({'plain':!![]});var _0x5f5a0b=_0x7179('0x25');return db[_0x7179('0x26')]['destroy']({'where':{'type':_0x5f5a0b,'resourceId':_0x22f0be['id']}})[_0x7179('0x22')](function(){return _0x337c86;});})[_0x7179('0x22')](function(){_0x5e44fa[_0x7179('0x17')](0xcc)[_0x7179('0x18')]();});}};}function handleEntityNotFound(_0x36bc0b,_0x41b6be){return function(_0x13e4f3){if(!_0x13e4f3){_0x36bc0b[_0x7179('0x16')](0x194);}return _0x13e4f3;};}function handleError(_0x33dad1,_0x5381de){_0x5381de=_0x5381de||0x1f4;return function(_0x29a55a){logger[_0x7179('0x27')](_0x29a55a[_0x7179('0x28')]);if(_0x29a55a[_0x7179('0x29')]){delete _0x29a55a[_0x7179('0x29')];}_0x33dad1['status'](_0x5381de)['send'](_0x29a55a);};}exports[_0x7179('0x2a')]=function(_0x21dc17,_0x4d4044){var _0x1f9b68={},_0x56ce1a={},_0x46fdb9={'count':0x0,'rows':[]};var _0x27c618=_['map'](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x3ee539){return{'name':_0x3ee539[_0x7179('0x2b')],'type':_0x3ee539[_0x7179('0x2c')][_0x7179('0x2d')]};});_0x56ce1a[_0x7179('0x2e')]=_[_0x7179('0x2f')](_0x27c618,_0x7179('0x29'));_0x56ce1a[_0x7179('0x30')]=_[_0x7179('0x31')](_0x21dc17[_0x7179('0x30')]);_0x56ce1a[_0x7179('0x32')]=_[_0x7179('0x33')](_0x56ce1a[_0x7179('0x2e')],_0x56ce1a['query']);_0x1f9b68['attributes']=_['intersection'](_0x56ce1a['model'],qs['fields'](_0x21dc17['query'][_0x7179('0x34')]));_0x1f9b68[_0x7179('0x35')]=_0x1f9b68['attributes'][_0x7179('0x36')]?_0x1f9b68[_0x7179('0x35')]:_0x56ce1a[_0x7179('0x2e')];if(!_0x21dc17[_0x7179('0x30')][_0x7179('0x37')](_0x7179('0x38'))){_0x1f9b68[_0x7179('0x1b')]=qs['limit'](_0x21dc17[_0x7179('0x30')][_0x7179('0x1b')]);_0x1f9b68[_0x7179('0x1a')]=qs[_0x7179('0x1a')](_0x21dc17['query']['offset']);}_0x1f9b68[_0x7179('0x39')]=qs[_0x7179('0x3a')](_0x21dc17[_0x7179('0x30')]['sort']);_0x1f9b68[_0x7179('0x3b')]=qs[_0x7179('0x32')](_[_0x7179('0x3c')](_0x21dc17['query'],_0x56ce1a[_0x7179('0x32')]),_0x27c618);if(_0x21dc17[_0x7179('0x30')][_0x7179('0x3d')]){_0x1f9b68[_0x7179('0x3b')]=_['merge'](_0x1f9b68['where'],{'$or':_[_0x7179('0x2f')](_0x27c618,function(_0x57b7d4){if(_0x57b7d4[_0x7179('0x2c')]!==_0x7179('0x3e')){var _0x3d4b7e={};_0x3d4b7e[_0x57b7d4[_0x7179('0x29')]]={'$like':'%'+_0x21dc17[_0x7179('0x30')][_0x7179('0x3d')]+'%'};return _0x3d4b7e;}})});}_0x1f9b68=_[_0x7179('0x3f')]({},_0x1f9b68,_0x21dc17[_0x7179('0x40')]);var _0x8de95={'where':_0x1f9b68[_0x7179('0x3b')]};return db['CmHopperAdditionalPhone'][_0x7179('0x1d')](_0x8de95)[_0x7179('0x22')](function(_0x46459f){_0x46fdb9['count']=_0x46459f;if(_0x21dc17['query'][_0x7179('0x41')]){_0x1f9b68[_0x7179('0x42')]=[{'all':!![]}];}return db[_0x7179('0x43')][_0x7179('0x44')](_0x1f9b68);})[_0x7179('0x22')](function(_0x350cc0){_0x46fdb9[_0x7179('0x45')]=_0x350cc0;return _0x46fdb9;})[_0x7179('0x22')](respondWithFilteredResult(_0x4d4044,_0x1f9b68))[_0x7179('0x46')](handleError(_0x4d4044,null));};exports[_0x7179('0x47')]=function(_0x220e21,_0xf2d130){var _0x5eacb4={'raw':!![],'where':{'id':_0x220e21['params']['id']}},_0x453f52={};_0x453f52['model']=_['keys'](db['CmHopperAdditionalPhone'][_0x7179('0x48')]);_0x453f52[_0x7179('0x30')]=_[_0x7179('0x31')](_0x220e21[_0x7179('0x30')]);_0x453f52[_0x7179('0x32')]=_[_0x7179('0x33')](_0x453f52[_0x7179('0x2e')],_0x453f52['query']);_0x5eacb4[_0x7179('0x35')]=_['intersection'](_0x453f52['model'],qs[_0x7179('0x34')](_0x220e21[_0x7179('0x30')][_0x7179('0x34')]));_0x5eacb4[_0x7179('0x35')]=_0x5eacb4[_0x7179('0x35')]['length']?_0x5eacb4[_0x7179('0x35')]:_0x453f52['model'];if(_0x220e21[_0x7179('0x30')]['includeAll']){_0x5eacb4[_0x7179('0x42')]=[{'all':!![]}];}_0x5eacb4=_[_0x7179('0x3f')]({},_0x5eacb4,_0x220e21[_0x7179('0x40')]);return db[_0x7179('0x43')][_0x7179('0x49')](_0x5eacb4)[_0x7179('0x22')](handleEntityNotFound(_0xf2d130,null))[_0x7179('0x22')](respondWithResult(_0xf2d130,null))[_0x7179('0x46')](handleError(_0xf2d130,null));};exports['create']=function(_0x37872a,_0x26ac03){return db[_0x7179('0x43')][_0x7179('0x4a')](_0x37872a[_0x7179('0x4b')],{})[_0x7179('0x22')](function(_0x2efaef){var _0x20e736=_0x37872a[_0x7179('0x4c')][_0x7179('0x24')]({'plain':!![]});if(!_0x20e736)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e736[_0x7179('0x4d')]===_0x7179('0x4c')){var _0x15d59b=_0x2efaef[_0x7179('0x24')]({'plain':!![]});var _0x1044b4='CmHopperAdditionalPhones';return db['UserProfileSection'][_0x7179('0x49')]({'where':{'name':_0x1044b4,'userProfileId':_0x20e736[_0x7179('0x4e')]},'raw':!![]})[_0x7179('0x22')](function(_0x109c08){if(_0x109c08&&_0x109c08[_0x7179('0x4f')]===0x0){return db[_0x7179('0x26')][_0x7179('0x4a')]({'name':_0x15d59b[_0x7179('0x29')],'resourceId':_0x15d59b['id'],'type':_0x109c08[_0x7179('0x29')],'sectionId':_0x109c08['id']},{})[_0x7179('0x22')](function(){return _0x2efaef;});}else{return _0x2efaef;}})[_0x7179('0x46')](function(_0x22a494){logger[_0x7179('0x27')](_0x7179('0x50'),_0x22a494);throw _0x22a494;});}return _0x2efaef;})[_0x7179('0x22')](respondWithResult(_0x26ac03,0xc9))[_0x7179('0x46')](handleError(_0x26ac03,null));};exports[_0x7179('0x51')]=function(_0xcbfbbe,_0x376485){if(_0xcbfbbe[_0x7179('0x4b')]['id']){delete _0xcbfbbe['body']['id'];}return db[_0x7179('0x43')][_0x7179('0x49')]({'where':{'id':_0xcbfbbe['params']['id']}})[_0x7179('0x22')](handleEntityNotFound(_0x376485,null))['then'](saveUpdates(_0xcbfbbe[_0x7179('0x4b')],null))[_0x7179('0x22')](respondWithResult(_0x376485,null))['catch'](handleError(_0x376485,null));};exports['destroy']=function(_0x5671d1,_0x3b987d){return db[_0x7179('0x43')][_0x7179('0x49')]({'where':{'id':_0x5671d1['params']['id']}})[_0x7179('0x22')](handleEntityNotFound(_0x3b987d,null))[_0x7179('0x22')](removeEntity(_0x3b987d,null))['catch'](handleError(_0x3b987d,null));};
\ No newline at end of file
+var _0x4f61=['rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','rows','catch','show','params','include','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','send','index','CmHopperAdditionalPhone'];(function(_0x3d46cb,_0xb6b796){var _0xe0795f=function(_0x318db6){while(--_0x318db6){_0x3d46cb['push'](_0x3d46cb['shift']());}};_0xe0795f(++_0xb6b796);}(_0x4f61,0xd7));var _0x14f6=function(_0x5400ed,_0x4bfd4a){_0x5400ed=_0x5400ed-0x0;var _0x72a0d1=_0x4f61[_0x5400ed];return _0x72a0d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14f6('0x0'));var zipdir=require(_0x14f6('0x1'));var jsonpatch=require(_0x14f6('0x2'));var rp=require(_0x14f6('0x3'));var moment=require(_0x14f6('0x4'));var BPromise=require(_0x14f6('0x5'));var Mustache=require(_0x14f6('0x6'));var util=require(_0x14f6('0x7'));var path=require('path');var sox=require(_0x14f6('0x8'));var csv=require(_0x14f6('0x9'));var ejs=require(_0x14f6('0xa'));var fs=require('fs');var fs_extra=require(_0x14f6('0xb'));var _=require(_0x14f6('0xc'));var squel=require(_0x14f6('0xd'));var crypto=require('crypto');var jsforce=require(_0x14f6('0xe'));var deskjs=require(_0x14f6('0xf'));var toCsv=require(_0x14f6('0x9'));var querystring=require(_0x14f6('0x10'));var Papa=require(_0x14f6('0x11'));var Redis=require(_0x14f6('0x12'));var authService=require(_0x14f6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14f6('0x14'));var logger=require(_0x14f6('0x15'))(_0x14f6('0x16'));var utils=require(_0x14f6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x14f6('0x18'));var db=require(_0x14f6('0x19'))['db'];function respondWithStatusCode(_0x576ee4,_0x59fd02){_0x59fd02=_0x59fd02||0xcc;return function(_0x5cd731){if(_0x5cd731){return _0x576ee4[_0x14f6('0x1a')](_0x59fd02);}return _0x576ee4[_0x14f6('0x1b')](_0x59fd02)[_0x14f6('0x1c')]();};}function respondWithResult(_0x18c151,_0x319761){_0x319761=_0x319761||0xc8;return function(_0x1dbebf){if(_0x1dbebf){return _0x18c151['status'](_0x319761)[_0x14f6('0x1d')](_0x1dbebf);}};}function respondWithFilteredResult(_0x403a40,_0x58538c){return function(_0xd82a03){if(_0xd82a03){var _0x413201=typeof _0x58538c[_0x14f6('0x1e')]===_0x14f6('0x1f')&&typeof _0x58538c[_0x14f6('0x20')]==='undefined';var _0xe5d497=_0xd82a03[_0x14f6('0x21')];var _0x1b6997=_0x413201?0x0:_0x58538c[_0x14f6('0x1e')];var _0x579138=_0x413201?_0xd82a03[_0x14f6('0x21')]:_0x58538c[_0x14f6('0x1e')]+_0x58538c[_0x14f6('0x20')];var _0x12e60e;if(_0x579138>=_0xe5d497){_0x579138=_0xe5d497;_0x12e60e=0xc8;}else{_0x12e60e=0xce;}_0x403a40[_0x14f6('0x1b')](_0x12e60e);return _0x403a40[_0x14f6('0x22')](_0x14f6('0x23'),_0x1b6997+'-'+_0x579138+'/'+_0xe5d497)[_0x14f6('0x1d')](_0xd82a03);}return null;};}function patchUpdates(_0x34253d){return function(_0x24984c){try{jsonpatch[_0x14f6('0x24')](_0x24984c,_0x34253d,!![]);}catch(_0x3b9429){return BPromise[_0x14f6('0x25')](_0x3b9429);}return _0x24984c[_0x14f6('0x26')]();};}function saveUpdates(_0x10c16a,_0x44b727){return function(_0x2859da){if(_0x2859da){return _0x2859da['update'](_0x10c16a)[_0x14f6('0x27')](function(_0x2918a4){return _0x2918a4;});}return null;};}function removeEntity(_0x9e5487,_0x4b9b0e){return function(_0x4b65e8){if(_0x4b65e8){return _0x4b65e8[_0x14f6('0x28')]()[_0x14f6('0x27')](function(){var _0x53669c=_0x4b65e8[_0x14f6('0x29')]({'plain':!![]});var _0x2ddf0b=_0x14f6('0x2a');return db['UserProfileResource'][_0x14f6('0x28')]({'where':{'type':_0x2ddf0b,'resourceId':_0x53669c['id']}})[_0x14f6('0x27')](function(){return _0x4b65e8;});})[_0x14f6('0x27')](function(){_0x9e5487[_0x14f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47438b,_0x4d8242){return function(_0x141d81){if(!_0x141d81){_0x47438b[_0x14f6('0x1a')](0x194);}return _0x141d81;};}function handleError(_0x4f1ce6,_0x574678){_0x574678=_0x574678||0x1f4;return function(_0x316e91){logger[_0x14f6('0x2b')](_0x316e91[_0x14f6('0x2c')]);if(_0x316e91[_0x14f6('0x2d')]){delete _0x316e91[_0x14f6('0x2d')];}_0x4f1ce6['status'](_0x574678)[_0x14f6('0x2e')](_0x316e91);};}exports[_0x14f6('0x2f')]=function(_0xad6d16,_0x5d12d9){var _0x492671={},_0x10d0f4={},_0x10f2f6={'count':0x0,'rows':[]};var _0xab5fe8=_['map'](db[_0x14f6('0x30')][_0x14f6('0x31')],function(_0x31733d){return{'name':_0x31733d[_0x14f6('0x32')],'type':_0x31733d[_0x14f6('0x33')]['key']};});_0x10d0f4[_0x14f6('0x34')]=_[_0x14f6('0x35')](_0xab5fe8,_0x14f6('0x2d'));_0x10d0f4[_0x14f6('0x36')]=_[_0x14f6('0x37')](_0xad6d16['query']);_0x10d0f4[_0x14f6('0x38')]=_['intersection'](_0x10d0f4[_0x14f6('0x34')],_0x10d0f4[_0x14f6('0x36')]);_0x492671[_0x14f6('0x39')]=_[_0x14f6('0x3a')](_0x10d0f4[_0x14f6('0x34')],qs['fields'](_0xad6d16[_0x14f6('0x36')][_0x14f6('0x3b')]));_0x492671['attributes']=_0x492671[_0x14f6('0x39')][_0x14f6('0x3c')]?_0x492671[_0x14f6('0x39')]:_0x10d0f4[_0x14f6('0x34')];if(!_0xad6d16[_0x14f6('0x36')][_0x14f6('0x3d')](_0x14f6('0x3e'))){_0x492671[_0x14f6('0x20')]=qs['limit'](_0xad6d16[_0x14f6('0x36')]['limit']);_0x492671[_0x14f6('0x1e')]=qs['offset'](_0xad6d16[_0x14f6('0x36')]['offset']);}_0x492671[_0x14f6('0x3f')]=qs[_0x14f6('0x40')](_0xad6d16['query']['sort']);_0x492671[_0x14f6('0x41')]=qs[_0x14f6('0x38')](_[_0x14f6('0x42')](_0xad6d16[_0x14f6('0x36')],_0x10d0f4[_0x14f6('0x38')]),_0xab5fe8);if(_0xad6d16[_0x14f6('0x36')]['filter']){_0x492671['where']=_['merge'](_0x492671[_0x14f6('0x41')],{'$or':_[_0x14f6('0x35')](_0xab5fe8,function(_0x54e4f7){if(_0x54e4f7[_0x14f6('0x33')]!==_0x14f6('0x43')){var _0xd5a833={};_0xd5a833[_0x54e4f7[_0x14f6('0x2d')]]={'$like':'%'+_0xad6d16['query']['filter']+'%'};return _0xd5a833;}})});}_0x492671=_['merge']({},_0x492671,_0xad6d16[_0x14f6('0x44')]);var _0x229968={'where':_0x492671[_0x14f6('0x41')]};return db[_0x14f6('0x30')]['count'](_0x229968)[_0x14f6('0x27')](function(_0x42ade3){_0x10f2f6[_0x14f6('0x21')]=_0x42ade3;if(_0xad6d16[_0x14f6('0x36')][_0x14f6('0x45')]){_0x492671['include']=[{'all':!![]}];}return db[_0x14f6('0x30')]['findAll'](_0x492671);})[_0x14f6('0x27')](function(_0x5e21ae){_0x10f2f6[_0x14f6('0x46')]=_0x5e21ae;return _0x10f2f6;})['then'](respondWithFilteredResult(_0x5d12d9,_0x492671))[_0x14f6('0x47')](handleError(_0x5d12d9,null));};exports[_0x14f6('0x48')]=function(_0x59eb67,_0x5043f6){var _0x3a3f88={'raw':!![],'where':{'id':_0x59eb67[_0x14f6('0x49')]['id']}},_0x1fa257={};_0x1fa257['model']=_[_0x14f6('0x37')](db['CmHopperAdditionalPhone'][_0x14f6('0x31')]);_0x1fa257[_0x14f6('0x36')]=_[_0x14f6('0x37')](_0x59eb67[_0x14f6('0x36')]);_0x1fa257[_0x14f6('0x38')]=_[_0x14f6('0x3a')](_0x1fa257['model'],_0x1fa257[_0x14f6('0x36')]);_0x3a3f88[_0x14f6('0x39')]=_[_0x14f6('0x3a')](_0x1fa257[_0x14f6('0x34')],qs[_0x14f6('0x3b')](_0x59eb67[_0x14f6('0x36')]['fields']));_0x3a3f88[_0x14f6('0x39')]=_0x3a3f88['attributes'][_0x14f6('0x3c')]?_0x3a3f88[_0x14f6('0x39')]:_0x1fa257[_0x14f6('0x34')];if(_0x59eb67[_0x14f6('0x36')]['includeAll']){_0x3a3f88[_0x14f6('0x4a')]=[{'all':!![]}];}_0x3a3f88=_[_0x14f6('0x4b')]({},_0x3a3f88,_0x59eb67[_0x14f6('0x44')]);return db[_0x14f6('0x30')][_0x14f6('0x4c')](_0x3a3f88)[_0x14f6('0x27')](handleEntityNotFound(_0x5043f6,null))[_0x14f6('0x27')](respondWithResult(_0x5043f6,null))['catch'](handleError(_0x5043f6,null));};exports[_0x14f6('0x4d')]=function(_0x15c5e0,_0x36d774){return db[_0x14f6('0x30')]['create'](_0x15c5e0['body'],{})[_0x14f6('0x27')](function(_0xb724c0){var _0x3fc634=_0x15c5e0[_0x14f6('0x4e')][_0x14f6('0x29')]({'plain':!![]});if(!_0x3fc634)throw new Error(_0x14f6('0x4f'));if(_0x3fc634[_0x14f6('0x50')]===_0x14f6('0x4e')){var _0x214d79=_0xb724c0[_0x14f6('0x29')]({'plain':!![]});var _0x2606a8='CmHopperAdditionalPhones';return db[_0x14f6('0x51')][_0x14f6('0x4c')]({'where':{'name':_0x2606a8,'userProfileId':_0x3fc634[_0x14f6('0x52')]},'raw':!![]})[_0x14f6('0x27')](function(_0x306d9d){if(_0x306d9d&&_0x306d9d[_0x14f6('0x53')]===0x0){return db[_0x14f6('0x54')][_0x14f6('0x4d')]({'name':_0x214d79['name'],'resourceId':_0x214d79['id'],'type':_0x306d9d[_0x14f6('0x2d')],'sectionId':_0x306d9d['id']},{})['then'](function(){return _0xb724c0;});}else{return _0xb724c0;}})['catch'](function(_0x513d9e){logger[_0x14f6('0x2b')](_0x14f6('0x55'),_0x513d9e);throw _0x513d9e;});}return _0xb724c0;})[_0x14f6('0x27')](respondWithResult(_0x36d774,0xc9))[_0x14f6('0x47')](handleError(_0x36d774,null));};exports[_0x14f6('0x56')]=function(_0x139316,_0x3fbeb3){if(_0x139316[_0x14f6('0x57')]['id']){delete _0x139316['body']['id'];}return db[_0x14f6('0x30')][_0x14f6('0x4c')]({'where':{'id':_0x139316[_0x14f6('0x49')]['id']}})[_0x14f6('0x27')](handleEntityNotFound(_0x3fbeb3,null))[_0x14f6('0x27')](saveUpdates(_0x139316[_0x14f6('0x57')],null))[_0x14f6('0x27')](respondWithResult(_0x3fbeb3,null))[_0x14f6('0x47')](handleError(_0x3fbeb3,null));};exports[_0x14f6('0x28')]=function(_0xc8db54,_0x4ccee1){return db['CmHopperAdditionalPhone'][_0x14f6('0x4c')]({'where':{'id':_0xc8db54[_0x14f6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ccee1,null))['then'](removeEntity(_0x4ccee1,null))[_0x14f6('0x47')](handleError(_0x4ccee1,null));};
\ No newline at end of file
index 547fc78..4e8a1b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac5d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','lodash'];(function(_0x6db6f3,_0x18ddca){var _0x249b98=function(_0x6cbdd4){while(--_0x6cbdd4){_0x6db6f3['push'](_0x6db6f3['shift']());}};_0x249b98(++_0x18ddca);}(_0xac5d,0x83));var _0xdac5=function(_0xc72a72,_0xfaaf35){_0xc72a72=_0xc72a72-0x0;var _0x20f9a9=_0xac5d[_0xc72a72];return _0x20f9a9;};'use strict';var _=require(_0xdac5('0x0'));var util=require(_0xdac5('0x1'));var logger=require(_0xdac5('0x2'))(_0xdac5('0x3'));var moment=require(_0xdac5('0x4'));var BPromise=require(_0xdac5('0x5'));var rp=require(_0xdac5('0x6'));var fs=require('fs');var path=require(_0xdac5('0x7'));var rimraf=require(_0xdac5('0x8'));var config=require(_0xdac5('0x9'));var attributes=require(_0xdac5('0xa'));module[_0xdac5('0xb')]=function(_0x6f1235,_0x386d4f){return _0x6f1235['define']('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6d58=['rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x38c20b,_0x2b832b){var _0x3f37b5=function(_0x53e78c){while(--_0x53e78c){_0x38c20b['push'](_0x38c20b['shift']());}};_0x3f37b5(++_0x2b832b);}(_0x6d58,0x165));var _0x86d5=function(_0x327f83,_0x32f2a5){_0x327f83=_0x327f83-0x0;var _0x42647e=_0x6d58[_0x327f83];return _0x42647e;};'use strict';var _=require(_0x86d5('0x0'));var util=require(_0x86d5('0x1'));var logger=require('../../config/logger')(_0x86d5('0x2'));var moment=require(_0x86d5('0x3'));var BPromise=require(_0x86d5('0x4'));var rp=require(_0x86d5('0x5'));var fs=require('fs');var path=require(_0x86d5('0x6'));var rimraf=require(_0x86d5('0x7'));var config=require(_0x86d5('0x8'));var attributes=require(_0x86d5('0x9'));module[_0x86d5('0xa')]=function(_0x3a4ff4,_0x1ae315){return _0x3a4ff4[_0x86d5('0xb')](_0x86d5('0xc'),attributes,{'tableName':_0x86d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6245384..a35de3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2902=['field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countcongestionretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','minutes','add','createdAt','phone','countdropretry','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters'];(function(_0x403435,_0x582bcc){var _0x544a5d=function(_0x12c1d4){while(--_0x12c1d4){_0x403435['push'](_0x403435['shift']());}};_0x544a5d(++_0x582bcc);}(_0x2902,0x77));var _0x2290=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x2902[_0x411e71];return _0x226ae3;};'use strict';var _=require(_0x2290('0x0'));var util=require(_0x2290('0x1'));var moment=require(_0x2290('0x2'));var BPromise=require(_0x2290('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2290('0x4'));var db=require(_0x2290('0x5'))['db'];var utils=require(_0x2290('0x6'));var logger=require('../../config/logger')(_0x2290('0x7'));var config=require(_0x2290('0x8'));var jayson=require(_0x2290('0x9'));var client=jayson['client'][_0x2290('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15813e,_0x485c31,_0x544c4b){return new BPromise(function(_0x1e7953,_0x3edbfb){return client[_0x2290('0xb')](_0x15813e,_0x544c4b)['then'](function(_0x150a8c){logger['info'](_0x2290('0xc'),_0x485c31,_0x2290('0xd'));logger[_0x2290('0xe')](_0x2290('0xf'),_0x485c31,'request\x20sent',JSON[_0x2290('0x10')](_0x150a8c));if(_0x150a8c[_0x2290('0x11')]){if(_0x150a8c[_0x2290('0x11')][_0x2290('0x12')]===0x1f4){logger[_0x2290('0x11')](_0x2290('0xc'),_0x485c31,_0x150a8c[_0x2290('0x11')][_0x2290('0x13')]);return _0x3edbfb(_0x150a8c['error'][_0x2290('0x13')]);}logger['error'](_0x2290('0xc'),_0x485c31,_0x150a8c[_0x2290('0x11')][_0x2290('0x13')]);return _0x1e7953(_0x150a8c[_0x2290('0x11')]['message']);}else{logger['info'](_0x2290('0xc'),_0x485c31,_0x2290('0xd'));_0x1e7953(_0x150a8c[_0x2290('0x14')][_0x2290('0x13')]);}})[_0x2290('0x15')](function(_0x1c74aa){logger[_0x2290('0x11')](_0x2290('0xc'),_0x485c31,_0x1c74aa);_0x3edbfb(_0x1c74aa);});});}exports[_0x2290('0x16')]=function(_0x5c46fd){var _0xdcee7b=this;return new Promise(function(_0x3c277c,_0x1729c1){return db[_0x2290('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x5c46fd[_0x2290('0x18')][_0x2290('0x19')],'ListId':_0x5c46fd[_0x2290('0x18')][_0x2290('0x1a')],'VoiceQueueId':_0x5c46fd[_0x2290('0x18')][_0x2290('0x1b')]===undefined?null:_0x5c46fd[_0x2290('0x18')][_0x2290('0x1b')],'CampaignId':_0x5c46fd[_0x2290('0x18')][_0x2290('0x1c')]===undefined?null:_0x5c46fd['body'][_0x2290('0x1c')]}})[_0x2290('0x1d')](function(_0x4182dc){if(_0x4182dc!=null){return db[_0x2290('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4182dc['id'],'OrderBy':{'$gt':_0x4182dc[_0x2290('0x1f')]}},'order':[[_0x2290('0x1f'),_0x2290('0x20')]]})[_0x2290('0x1d')](function(_0x5530a9){var _0xa12a13=0x0;if(_0x5530a9){if(_0x5530a9[_0x2290('0x21')]+_0x5530a9['countcongestionretry']+_0x5530a9[_0x2290('0x22')]+_0x5530a9[_0x2290('0x23')]+_0x5530a9['countdropretry']+_0x5530a9[_0x2290('0x24')]+_0x5530a9[_0x2290('0x25')]+_0x5530a9[_0x2290('0x26')]<_0x5c46fd[_0x2290('0x27')][_0x2290('0x28')])_0xa12a13=0x1;_0x3c277c({'additional':_0xa12a13});}else{return db[_0x2290('0x1e')][_0x2290('0x29')]({'raw':!![],'where':{'CmHopperId':_0x4182dc['id']},'order':[[_0x2290('0x1f'),_0x2290('0x20')]]})[_0x2290('0x1d')](function(_0x508e7f){var _0x26c712=0x0;if(_0x508e7f){if(_0x508e7f[_0x2290('0x21')]+_0x508e7f[_0x2290('0x2a')]+_0x508e7f[_0x2290('0x22')]+_0x508e7f['countnosuchnumberretry']+_0x508e7f['countdropretry']+_0x508e7f[_0x2290('0x24')]+_0x508e7f[_0x2290('0x25')]+_0x508e7f[_0x2290('0x26')]<_0x5c46fd[_0x2290('0x27')]['dialGlobalMaxRetry'])_0x26c712=0x1;_0x3c277c({'additional':_0x26c712});}else{_0x3c277c({'additional':0x0});}})[_0x2290('0x15')](function(_0x18436c){logger['error'](_0x2290('0x16'),_0x18436c[_0x2290('0x13')]);_0x1729c1(_0xdcee7b[_0x2290('0x11')](0x1f4,_0x18436c[_0x2290('0x13')]));});}})['catch'](function(_0x308e5a){logger[_0x2290('0x11')](_0x2290('0x16'),_0x308e5a[_0x2290('0x13')]);_0x1729c1(_0xdcee7b['error'](0x1f4,_0x308e5a['message']));});}else _0x3c277c({'additional':0x0});});});};exports[_0x2290('0x2b')]=function(_0x3d2c8a){var _0x5086f7=this;return new Promise(function(_0x1acfe0,_0x44bf84){return db[_0x2290('0x17')][_0x2290('0x29')]({'raw':!![],'where':{'ContactId':_0x3d2c8a[_0x2290('0x18')][_0x2290('0x19')],'ListId':_0x3d2c8a['body'][_0x2290('0x1a')],'VoiceQueueId':_0x3d2c8a[_0x2290('0x18')][_0x2290('0x1b')]===undefined?null:_0x3d2c8a[_0x2290('0x18')]['VoiceQueueId'],'CampaignId':_0x3d2c8a[_0x2290('0x18')][_0x2290('0x1c')]===undefined?null:_0x3d2c8a[_0x2290('0x18')]['CampaignId']}})['then'](function(_0x50ce99){if(_0x50ce99!=null){return db[_0x2290('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x50ce99['id'],'OrderBy':{'$gte':_0x50ce99[_0x2290('0x1f')]}},'order':[[_0x2290('0x1f'),_0x2290('0x20')]]})[_0x2290('0x1d')](function(_0x40e4cb){if(_0x40e4cb)return activateAdditionalPhone(_0x50ce99,_0x3d2c8a[_0x2290('0x18')],_0x40e4cb,_0x3d2c8a[_0x2290('0x2c')],_0x3d2c8a[_0x2290('0x2d')])[_0x2290('0x1d')](function(_0x570c86){_0x1acfe0(_0x570c86);});else{return db[_0x2290('0x1e')][_0x2290('0x29')]({'raw':!![],'where':{'CmHopperId':_0x50ce99['id']},'order':[[_0x2290('0x1f'),_0x2290('0x20')]]})[_0x2290('0x1d')](function(_0x559a66){if(_0x559a66)return activateAdditionalPhone(_0x50ce99,_0x3d2c8a[_0x2290('0x18')],_0x559a66,_0x3d2c8a[_0x2290('0x2c')],_0x3d2c8a[_0x2290('0x2d')])[_0x2290('0x1d')](function(_0x202906){_0x1acfe0(_0x202906);});else{_0x1acfe0({'id':_0x50ce99['id'],'phone':''});}})[_0x2290('0x15')](function(_0x590fe8){logger[_0x2290('0x11')](_0x2290('0x16'),_0x590fe8[_0x2290('0x13')]);_0x44bf84(_0x5086f7['error'](0x1f4,_0x590fe8[_0x2290('0x13')]));});}})['catch'](function(_0x32f221){logger[_0x2290('0x11')]('VerifyAdditionalPhones',_0x32f221[_0x2290('0x13')]);_0x44bf84(_0x5086f7[_0x2290('0x11')](0x1f4,_0x32f221[_0x2290('0x13')]));});}else _0x1acfe0(0x1);});});};function activateAdditionalPhone(_0x3a1b8e,_0x35b151,_0x1e23d1,_0x49bde9,_0x1d794e){return new Promise(function(_0x4681b0,_0x4ff109){var _0x1db8a1;if(_[_0x2290('0x2e')](_0x1e23d1[_0x2290('0x2f')])){_0x1e23d1[_0x2290('0x2f')]=moment();}if(moment()>moment(_0x1e23d1[_0x2290('0x2f')])){_0x1db8a1=moment()['add'](_0x1d794e||0x3,_0x2290('0x30'));}else{if(_0x1e23d1[_0x2290('0x1f')]==0x0){_0x1db8a1=moment(_0x1e23d1['scheduledat']);}else{_0x1db8a1=moment()['add'](_0x1d794e||0x3,_0x2290('0x30'));}}if(_[_0x2290('0x2e')](_0x1db8a1)){_0x1db8a1=moment()[_0x2290('0x31')](_0x1d794e||0x3,_0x2290('0x30'));}var _0x3e1efc={'phone':_0x3a1b8e['phone'],'active':0x0,'OrderBy':_['isNil'](_0x3a1b8e[_0x2290('0x1f')])?0x0:_0x3a1b8e['OrderBy'],'scheduledat':moment()[_0x2290('0x31')](_0x49bde9||0x1,'minutes'),'countbusyretry':_0x35b151[_0x2290('0x21')],'countcongestionretry':_0x35b151['countcongestionretry'],'countnoanswerretry':_0x35b151[_0x2290('0x22')],'countnosuchnumberretry':_0x35b151[_0x2290('0x23')],'countdropretry':_0x35b151['countdropretry'],'countabandonedretry':_0x35b151[_0x2290('0x24')],'countmachineretry':_0x35b151[_0x2290('0x25')],'countagentrejectretry':_0x35b151[_0x2290('0x26')],'createdAt':_0x35b151[_0x2290('0x32')],'updatedAt':_0x35b151['updatedAt']};var _0x1aa69f={'CmHopperId':_0x3a1b8e['id'],'phone':_0x1e23d1[_0x2290('0x33')],'active':0x0,'OrderBy':_[_0x2290('0x2e')](_0x1e23d1[_0x2290('0x1f')])?0x0:_0x1e23d1[_0x2290('0x1f')],'scheduledat':_0x1db8a1,'countbusyretry':_0x1e23d1['countbusyretry'],'countcongestionretry':_0x1e23d1['countcongestionretry'],'countnoanswerretry':_0x1e23d1[_0x2290('0x22')],'countnosuchnumberretry':_0x1e23d1['countnosuchnumberretry'],'countdropretry':_0x1e23d1[_0x2290('0x34')],'countabandonedretry':_0x1e23d1[_0x2290('0x24')],'countmachineretry':_0x1e23d1[_0x2290('0x25')],'countagentrejectretry':_0x1e23d1[_0x2290('0x26')],'createdAt':_0x1e23d1[_0x2290('0x32')],'updatedAt':_0x1e23d1['updatedAt']};return db[_0x2290('0x35')][_0x2290('0x36')](function(_0x21ade0){return db['CmHopperAdditionalPhone'][_0x2290('0x37')](_0x3e1efc,{'where':{'id':_0x1e23d1['id']}},{'transaction':_0x21ade0})['then'](function(){return db['CmHopper'][_0x2290('0x37')](_0x1aa69f,{'where':{'id':_0x3a1b8e['id']}},{'transaction':_0x21ade0});});})['then'](function(_0x18baf1){_0x4681b0({'id':_0x3a1b8e['id'],'phone':_0x1e23d1[_0x2290('0x33')]});})[_0x2290('0x15')](function(_0x127883){logger['error'](_0x2290('0x38'),_0x127883[_0x2290('0x13')]);_0x4ff109({'error':_0x127883[_0x2290('0x13')]});});});}exports[_0x2290('0x39')]=function(_0x2da79d){var _0x5659e5=this;return new Promise(function(_0x142bb6,_0x556625){return db[_0x2290('0x17')]['update'](_0x2da79d[_0x2290('0x18')][_0x2290('0x3a')],{'where':{'id':_0x2da79d[_0x2290('0x18')]['id']}})[_0x2290('0x1d')](function(_0x2b1619){_0x142bb6(_0x2b1619);})['catch'](function(_0x1859d3){logger[_0x2290('0x11')](_0x2290('0x39'),_0x1859d3['message']);_0x556625(_0x5659e5['error'](0x1f4,_0x1859d3[_0x2290('0x13')]));});});};
\ No newline at end of file
+var _0xad26=['scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','sequelize','transaction','activateAdditionalPhone','IncrementPreviewCounters','update','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','countnoanswerretry','dialGlobalMaxRetry','SwapAdditionalPhones','waitTime','duration','isNil'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xad26,0x1b1));var _0x6ad2=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xad26[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x6ad2('0x0'));var util=require(_0x6ad2('0x1'));var moment=require(_0x6ad2('0x2'));var BPromise=require(_0x6ad2('0x3'));var rs=require(_0x6ad2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ad2('0x5'))['db'];var utils=require(_0x6ad2('0x6'));var logger=require(_0x6ad2('0x7'))(_0x6ad2('0x8'));var config=require('../../config/environment');var jayson=require(_0x6ad2('0x9'));var client=jayson[_0x6ad2('0xa')][_0x6ad2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d9b17,_0xd47d4b,_0x26f002){return new BPromise(function(_0x43cab5,_0x36e3b2){return client[_0x6ad2('0xc')](_0x1d9b17,_0x26f002)['then'](function(_0x3c6335){logger['info'](_0x6ad2('0xd'),_0xd47d4b,'request\x20sent');logger[_0x6ad2('0xe')](_0x6ad2('0xf'),_0xd47d4b,_0x6ad2('0x10'),JSON['stringify'](_0x3c6335));if(_0x3c6335[_0x6ad2('0x11')]){if(_0x3c6335[_0x6ad2('0x11')][_0x6ad2('0x12')]===0x1f4){logger[_0x6ad2('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xd47d4b,_0x3c6335[_0x6ad2('0x11')][_0x6ad2('0x13')]);return _0x36e3b2(_0x3c6335[_0x6ad2('0x11')]['message']);}logger[_0x6ad2('0x11')](_0x6ad2('0xd'),_0xd47d4b,_0x3c6335[_0x6ad2('0x11')][_0x6ad2('0x13')]);return _0x43cab5(_0x3c6335[_0x6ad2('0x11')]['message']);}else{logger['info'](_0x6ad2('0xd'),_0xd47d4b,_0x6ad2('0x10'));_0x43cab5(_0x3c6335[_0x6ad2('0x14')][_0x6ad2('0x13')]);}})[_0x6ad2('0x15')](function(_0x5fe5f1){logger[_0x6ad2('0x11')](_0x6ad2('0xd'),_0xd47d4b,_0x5fe5f1);_0x36e3b2(_0x5fe5f1);});});}exports[_0x6ad2('0x16')]=function(_0x4e60a6){var _0x111ccc=this;return new Promise(function(_0xf2a799,_0x175394){return db[_0x6ad2('0x17')][_0x6ad2('0x18')]({'raw':!![],'where':{'ContactId':_0x4e60a6['body'][_0x6ad2('0x19')],'ListId':_0x4e60a6['body'][_0x6ad2('0x1a')],'VoiceQueueId':_0x4e60a6[_0x6ad2('0x1b')][_0x6ad2('0x1c')]===undefined?null:_0x4e60a6[_0x6ad2('0x1b')][_0x6ad2('0x1c')],'CampaignId':_0x4e60a6[_0x6ad2('0x1b')][_0x6ad2('0x1d')]===undefined?null:_0x4e60a6['body'][_0x6ad2('0x1d')]}})[_0x6ad2('0x1e')](function(_0x3f2b78){if(_0x3f2b78!=null){return db[_0x6ad2('0x1f')][_0x6ad2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3f2b78['id'],'OrderBy':{'$gt':_0x3f2b78['OrderBy']}},'order':[[_0x6ad2('0x20'),_0x6ad2('0x21')]]})[_0x6ad2('0x1e')](function(_0x899d75){var _0x24782c=0x0;if(_0x899d75){if(_0x899d75[_0x6ad2('0x22')]+_0x899d75[_0x6ad2('0x23')]+_0x899d75['countnoanswerretry']+_0x899d75[_0x6ad2('0x24')]+_0x899d75[_0x6ad2('0x25')]+_0x899d75[_0x6ad2('0x26')]+_0x899d75['countmachineretry']+_0x899d75[_0x6ad2('0x27')]<_0x4e60a6[_0x6ad2('0x28')]['dialGlobalMaxRetry'])_0x24782c=0x1;_0xf2a799({'additional':_0x24782c});}else{return db[_0x6ad2('0x1f')][_0x6ad2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3f2b78['id']},'order':[['OrderBy',_0x6ad2('0x21')]]})[_0x6ad2('0x1e')](function(_0x2749c){var _0x44ff61=0x0;if(_0x2749c){if(_0x2749c[_0x6ad2('0x22')]+_0x2749c['countcongestionretry']+_0x2749c[_0x6ad2('0x29')]+_0x2749c['countnosuchnumberretry']+_0x2749c['countdropretry']+_0x2749c[_0x6ad2('0x26')]+_0x2749c['countmachineretry']+_0x2749c[_0x6ad2('0x27')]<_0x4e60a6['entity'][_0x6ad2('0x2a')])_0x44ff61=0x1;_0xf2a799({'additional':_0x44ff61});}else{_0xf2a799({'additional':0x0});}})[_0x6ad2('0x15')](function(_0x32a220){logger[_0x6ad2('0x11')](_0x6ad2('0x16'),_0x32a220[_0x6ad2('0x13')]);_0x175394(_0x111ccc[_0x6ad2('0x11')](0x1f4,_0x32a220[_0x6ad2('0x13')]));});}})[_0x6ad2('0x15')](function(_0x117fe6){logger['error'](_0x6ad2('0x16'),_0x117fe6[_0x6ad2('0x13')]);_0x175394(_0x111ccc['error'](0x1f4,_0x117fe6[_0x6ad2('0x13')]));});}else _0xf2a799({'additional':0x0});});});};exports[_0x6ad2('0x2b')]=function(_0x454ccb){var _0x23a7ee=this;return new Promise(function(_0x2444ea,_0x5bb9ad){return db['CmHopper'][_0x6ad2('0x18')]({'raw':!![],'where':{'ContactId':_0x454ccb[_0x6ad2('0x1b')]['ContactId'],'ListId':_0x454ccb[_0x6ad2('0x1b')][_0x6ad2('0x1a')],'VoiceQueueId':_0x454ccb[_0x6ad2('0x1b')][_0x6ad2('0x1c')]===undefined?null:_0x454ccb['body'][_0x6ad2('0x1c')],'CampaignId':_0x454ccb['body'][_0x6ad2('0x1d')]===undefined?null:_0x454ccb[_0x6ad2('0x1b')][_0x6ad2('0x1d')]}})[_0x6ad2('0x1e')](function(_0x59cf4f){if(_0x59cf4f!=null){return db['CmHopperAdditionalPhone'][_0x6ad2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x59cf4f['id'],'OrderBy':{'$gte':_0x59cf4f[_0x6ad2('0x20')]}},'order':[['OrderBy',_0x6ad2('0x21')]]})[_0x6ad2('0x1e')](function(_0x3cec3b){if(_0x3cec3b)return activateAdditionalPhone(_0x59cf4f,_0x454ccb[_0x6ad2('0x1b')],_0x3cec3b,_0x454ccb['duration'],_0x454ccb[_0x6ad2('0x2c')])[_0x6ad2('0x1e')](function(_0x392c20){_0x2444ea(_0x392c20);});else{return db['CmHopperAdditionalPhone'][_0x6ad2('0x18')]({'raw':!![],'where':{'CmHopperId':_0x59cf4f['id']},'order':[['OrderBy',_0x6ad2('0x21')]]})[_0x6ad2('0x1e')](function(_0x5b887b){if(_0x5b887b)return activateAdditionalPhone(_0x59cf4f,_0x454ccb[_0x6ad2('0x1b')],_0x5b887b,_0x454ccb[_0x6ad2('0x2d')],_0x454ccb[_0x6ad2('0x2c')])[_0x6ad2('0x1e')](function(_0x17c4c3){_0x2444ea(_0x17c4c3);});else{_0x2444ea({'id':_0x59cf4f['id'],'phone':''});}})[_0x6ad2('0x15')](function(_0x296014){logger[_0x6ad2('0x11')](_0x6ad2('0x16'),_0x296014['message']);_0x5bb9ad(_0x23a7ee[_0x6ad2('0x11')](0x1f4,_0x296014[_0x6ad2('0x13')]));});}})[_0x6ad2('0x15')](function(_0x48a60a){logger['error'](_0x6ad2('0x16'),_0x48a60a[_0x6ad2('0x13')]);_0x5bb9ad(_0x23a7ee[_0x6ad2('0x11')](0x1f4,_0x48a60a[_0x6ad2('0x13')]));});}else _0x2444ea(0x1);});});};function activateAdditionalPhone(_0xe9f023,_0x86c5f9,_0x3c11ef,_0x2b1542,_0x74a047){return new Promise(function(_0x3b2c9a,_0xa1e9a7){var _0xb7dbe9;if(_[_0x6ad2('0x2e')](_0x3c11ef[_0x6ad2('0x2f')])){_0x3c11ef[_0x6ad2('0x2f')]=moment();}if(moment()>moment(_0x3c11ef['scheduledat'])){_0xb7dbe9=moment()[_0x6ad2('0x30')](_0x74a047||0x3,_0x6ad2('0x31'));}else{if(_0x3c11ef[_0x6ad2('0x20')]==0x0){_0xb7dbe9=moment(_0x3c11ef[_0x6ad2('0x2f')]);}else{_0xb7dbe9=moment()['add'](_0x74a047||0x3,_0x6ad2('0x31'));}}if(_['isNil'](_0xb7dbe9)){_0xb7dbe9=moment()[_0x6ad2('0x30')](_0x74a047||0x3,_0x6ad2('0x31'));}var _0x126856={'phone':_0xe9f023[_0x6ad2('0x32')],'active':0x0,'OrderBy':_[_0x6ad2('0x2e')](_0xe9f023[_0x6ad2('0x20')])?0x0:_0xe9f023['OrderBy'],'scheduledat':moment()[_0x6ad2('0x30')](_0x2b1542||0x1,_0x6ad2('0x31')),'countbusyretry':_0x86c5f9[_0x6ad2('0x22')],'countcongestionretry':_0x86c5f9['countcongestionretry'],'countnoanswerretry':_0x86c5f9[_0x6ad2('0x29')],'countnosuchnumberretry':_0x86c5f9['countnosuchnumberretry'],'countdropretry':_0x86c5f9[_0x6ad2('0x25')],'countabandonedretry':_0x86c5f9[_0x6ad2('0x26')],'countmachineretry':_0x86c5f9[_0x6ad2('0x33')],'countagentrejectretry':_0x86c5f9['countagentrejectretry'],'createdAt':_0x86c5f9[_0x6ad2('0x34')],'updatedAt':_0x86c5f9[_0x6ad2('0x35')]};var _0x21ba4b={'CmHopperId':_0xe9f023['id'],'phone':_0x3c11ef['phone'],'active':0x0,'OrderBy':_[_0x6ad2('0x2e')](_0x3c11ef[_0x6ad2('0x20')])?0x0:_0x3c11ef['OrderBy'],'scheduledat':_0xb7dbe9,'countbusyretry':_0x3c11ef['countbusyretry'],'countcongestionretry':_0x3c11ef[_0x6ad2('0x23')],'countnoanswerretry':_0x3c11ef[_0x6ad2('0x29')],'countnosuchnumberretry':_0x3c11ef['countnosuchnumberretry'],'countdropretry':_0x3c11ef['countdropretry'],'countabandonedretry':_0x3c11ef[_0x6ad2('0x26')],'countmachineretry':_0x3c11ef['countmachineretry'],'countagentrejectretry':_0x3c11ef[_0x6ad2('0x27')],'createdAt':_0x3c11ef['createdAt'],'updatedAt':_0x3c11ef[_0x6ad2('0x35')]};return db[_0x6ad2('0x36')][_0x6ad2('0x37')](function(_0x5d0148){return db[_0x6ad2('0x1f')]['update'](_0x126856,{'where':{'id':_0x3c11ef['id']}},{'transaction':_0x5d0148})[_0x6ad2('0x1e')](function(){return db[_0x6ad2('0x17')]['update'](_0x21ba4b,{'where':{'id':_0xe9f023['id']}},{'transaction':_0x5d0148});});})[_0x6ad2('0x1e')](function(_0x52c2cd){_0x3b2c9a({'id':_0xe9f023['id'],'phone':_0x3c11ef[_0x6ad2('0x32')]});})[_0x6ad2('0x15')](function(_0x5e76f1){logger[_0x6ad2('0x11')](_0x6ad2('0x38'),_0x5e76f1[_0x6ad2('0x13')]);_0xa1e9a7({'error':_0x5e76f1[_0x6ad2('0x13')]});});});}exports[_0x6ad2('0x39')]=function(_0x3813aa){var _0x265b0b=this;return new Promise(function(_0x6ba2a6,_0x260142){return db[_0x6ad2('0x17')][_0x6ad2('0x3a')](_0x3813aa[_0x6ad2('0x1b')][_0x6ad2('0x3b')],{'where':{'id':_0x3813aa['body']['id']}})[_0x6ad2('0x1e')](function(_0xbda5dd){_0x6ba2a6(_0xbda5dd);})[_0x6ad2('0x15')](function(_0x4b4b3c){logger[_0x6ad2('0x11')](_0x6ad2('0x39'),_0x4b4b3c[_0x6ad2('0x13')]);_0x260142(_0x265b0b['error'](0x1f4,_0x4b4b3c[_0x6ad2('0x13')]));});});};
\ No newline at end of file
index 24697fb..574218c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x657e=['isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x657e,0x1c2));var _0xe657=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x657e[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xe657('0x0'));var util=require(_0xe657('0x1'));var path=require(_0xe657('0x2'));var timeout=require(_0xe657('0x3'));var express=require('express');var router=express[_0xe657('0x4')]();var fs_extra=require(_0xe657('0x5'));var auth=require(_0xe657('0x6'));var interaction=require(_0xe657('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xe657('0x8')]('/',auth[_0xe657('0x9')](),controller['index']);router[_0xe657('0x8')](_0xe657('0xa'),auth[_0xe657('0x9')](),controller['show']);router[_0xe657('0xb')]('/',auth[_0xe657('0x9')](),controller[_0xe657('0xc')]);router[_0xe657('0xd')](_0xe657('0xa'),auth[_0xe657('0x9')](),controller['update']);router[_0xe657('0xe')](_0xe657('0xa'),auth['isAuthenticated'](),controller[_0xe657('0xf')]);module[_0xe657('0x10')]=router;
\ No newline at end of file
+var _0xf536=['isAuthenticated','show','post','create','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id'];(function(_0x27af08,_0x192c31){var _0x49eb8e=function(_0x249b6b){while(--_0x249b6b){_0x27af08['push'](_0x27af08['shift']());}};_0x49eb8e(++_0x192c31);}(_0xf536,0x106));var _0x6f53=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0xf536[_0x186222];return _0x226a38;};'use strict';var multer=require('multer');var util=require(_0x6f53('0x0'));var path=require('path');var timeout=require(_0x6f53('0x1'));var express=require('express');var router=express[_0x6f53('0x2')]();var fs_extra=require(_0x6f53('0x3'));var auth=require(_0x6f53('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f53('0x5'));var controller=require(_0x6f53('0x6'));router[_0x6f53('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f53('0x8')]);router['get'](_0x6f53('0x9'),auth[_0x6f53('0xa')](),controller[_0x6f53('0xb')]);router[_0x6f53('0xc')]('/',auth[_0x6f53('0xa')](),controller[_0x6f53('0xd')]);router['put']('/:id',auth[_0x6f53('0xa')](),controller[_0x6f53('0xe')]);router[_0x6f53('0xf')](_0x6f53('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f53('0x10')]=router;
\ No newline at end of file
index 3a1c259..4c7bb46 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c45=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x29d362,_0x2dc453){var _0x2cd13c=function(_0x28593c){while(--_0x28593c){_0x29d362['push'](_0x29d362['shift']());}};_0x2cd13c(++_0x2dc453);}(_0x8c45,0xda));var _0x58c4=function(_0x48f182,_0x32b4ba){_0x48f182=_0x48f182-0x0;var _0x3b807e=_0x8c45[_0x48f182];return _0x3b807e;};'use strict';var moment=require(_0x58c4('0x0'));var Sequelize=require(_0x58c4('0x1'));module[_0x58c4('0x2')]={'phone':{'type':Sequelize[_0x58c4('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x58c4('0x4')],'unique':_0x58c4('0x5')},'ListId':{'type':Sequelize[_0x58c4('0x4')],'unique':_0x58c4('0x5')},'VoiceQueueId':{'type':Sequelize[_0x58c4('0x4')],'unique':_0x58c4('0x5')}};
\ No newline at end of file
+var _0x23f4=['INTEGER','contactListQueue','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23f4,0x1ee));var _0x423f=function(_0x2963a4,_0x4e4ac9){_0x2963a4=_0x2963a4-0x0;var _0x1322e6=_0x23f4[_0x2963a4];return _0x1322e6;};'use strict';var moment=require('moment');var Sequelize=require(_0x423f('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x423f('0x1')],'unique':_0x423f('0x2')},'ListId':{'type':Sequelize[_0x423f('0x1')],'unique':_0x423f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x423f('0x1')],'unique':_0x423f('0x2')}};
\ No newline at end of file
index 1dd5a96..4ef6848 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x48a5=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','save','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','length','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5255ba,_0x11a686){var _0x37f650=function(_0x3d5c53){while(--_0x3d5c53){_0x5255ba['push'](_0x5255ba['shift']());}};_0x37f650(++_0x11a686);}(_0x48a5,0xcb));var _0x548a=function(_0x24ba23,_0x29cb95){_0x24ba23=_0x24ba23-0x0;var _0x23fcb8=_0x48a5[_0x24ba23];return _0x23fcb8;};'use strict';var emlformat=require(_0x548a('0x0'));var rimraf=require(_0x548a('0x1'));var zipdir=require(_0x548a('0x2'));var jsonpatch=require(_0x548a('0x3'));var rp=require(_0x548a('0x4'));var moment=require(_0x548a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x548a('0x6'));var path=require(_0x548a('0x7'));var sox=require(_0x548a('0x8'));var csv=require('to-csv');var ejs=require(_0x548a('0x9'));var fs=require('fs');var fs_extra=require(_0x548a('0xa'));var _=require(_0x548a('0xb'));var squel=require(_0x548a('0xc'));var crypto=require(_0x548a('0xd'));var jsforce=require(_0x548a('0xe'));var deskjs=require(_0x548a('0xf'));var toCsv=require(_0x548a('0x10'));var querystring=require(_0x548a('0x11'));var Papa=require(_0x548a('0x12'));var Redis=require(_0x548a('0x13'));var authService=require(_0x548a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x548a('0x15'));var hardwareService=require(_0x548a('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x548a('0x17'));var licenseUtil=require(_0x548a('0x18'));var db=require(_0x548a('0x19'))['db'];function respondWithStatusCode(_0x53afe8,_0x1df885){_0x1df885=_0x1df885||0xcc;return function(_0x1a4e2d){if(_0x1a4e2d){return _0x53afe8['sendStatus'](_0x1df885);}return _0x53afe8[_0x548a('0x1a')](_0x1df885)[_0x548a('0x1b')]();};}function respondWithResult(_0x2f881f,_0xc9dda4){_0xc9dda4=_0xc9dda4||0xc8;return function(_0x3be8cb){if(_0x3be8cb){return _0x2f881f[_0x548a('0x1a')](_0xc9dda4)[_0x548a('0x1c')](_0x3be8cb);}};}function respondWithFilteredResult(_0x84c53e,_0x3e6ee9){return function(_0x502bfe){if(_0x502bfe){var _0xd2da34=typeof _0x3e6ee9['offset']==='undefined'&&typeof _0x3e6ee9[_0x548a('0x1d')]==='undefined';var _0x400907=_0x502bfe['count'];var _0x315bde=_0xd2da34?0x0:_0x3e6ee9['offset'];var _0x2df2b6=_0xd2da34?_0x502bfe[_0x548a('0x1e')]:_0x3e6ee9[_0x548a('0x1f')]+_0x3e6ee9[_0x548a('0x1d')];var _0x57bf71;if(_0x2df2b6>=_0x400907){_0x2df2b6=_0x400907;_0x57bf71=0xc8;}else{_0x57bf71=0xce;}_0x84c53e[_0x548a('0x1a')](_0x57bf71);return _0x84c53e[_0x548a('0x20')](_0x548a('0x21'),_0x315bde+'-'+_0x2df2b6+'/'+_0x400907)['json'](_0x502bfe);}return null;};}function patchUpdates(_0x577359){return function(_0x27ca07){try{jsonpatch['apply'](_0x27ca07,_0x577359,!![]);}catch(_0x35dfd5){return BPromise['reject'](_0x35dfd5);}return _0x27ca07[_0x548a('0x22')]();};}function saveUpdates(_0x5ab4a8,_0x95273b){return function(_0x31ba96){if(_0x31ba96){return _0x31ba96['update'](_0x5ab4a8)[_0x548a('0x23')](function(_0x5093a1){return _0x5093a1;});}return null;};}function removeEntity(_0x4061e7,_0x258a75){return function(_0x3fe1f1){if(_0x3fe1f1){return _0x3fe1f1['destroy']()[_0x548a('0x23')](function(){_0x4061e7[_0x548a('0x1a')](0xcc)[_0x548a('0x1b')]();});}};}function handleEntityNotFound(_0x4c38eb,_0x4de9fc){return function(_0x240390){if(!_0x240390){_0x4c38eb['sendStatus'](0x194);}return _0x240390;};}function handleError(_0x39a2a8,_0x5b8796){_0x5b8796=_0x5b8796||0x1f4;return function(_0x450ce3){logger[_0x548a('0x24')](_0x450ce3[_0x548a('0x25')]);if(_0x450ce3[_0x548a('0x26')]){delete _0x450ce3[_0x548a('0x26')];}_0x39a2a8[_0x548a('0x1a')](_0x5b8796)[_0x548a('0x27')](_0x450ce3);};}exports[_0x548a('0x28')]=function(_0x2834d1,_0xefe850){var _0x333fef={},_0x523dd2={},_0x5e1ee8={'count':0x0,'rows':[]};var _0x4b0fe5=_[_0x548a('0x29')](db[_0x548a('0x2a')][_0x548a('0x2b')],function(_0xdb8cb3){return{'name':_0xdb8cb3[_0x548a('0x2c')],'type':_0xdb8cb3[_0x548a('0x2d')][_0x548a('0x2e')]};});_0x523dd2[_0x548a('0x2f')]=_[_0x548a('0x29')](_0x4b0fe5,_0x548a('0x26'));_0x523dd2[_0x548a('0x30')]=_[_0x548a('0x31')](_0x2834d1[_0x548a('0x30')]);_0x523dd2[_0x548a('0x32')]=_['intersection'](_0x523dd2['model'],_0x523dd2[_0x548a('0x30')]);_0x333fef[_0x548a('0x33')]=_['intersection'](_0x523dd2[_0x548a('0x2f')],qs[_0x548a('0x34')](_0x2834d1[_0x548a('0x30')]['fields']));_0x333fef[_0x548a('0x33')]=_0x333fef[_0x548a('0x33')]['length']?_0x333fef[_0x548a('0x33')]:_0x523dd2['model'];if(!_0x2834d1[_0x548a('0x30')][_0x548a('0x35')](_0x548a('0x36'))){_0x333fef['limit']=qs[_0x548a('0x1d')](_0x2834d1[_0x548a('0x30')]['limit']);_0x333fef['offset']=qs['offset'](_0x2834d1[_0x548a('0x30')][_0x548a('0x1f')]);}_0x333fef[_0x548a('0x37')]=qs[_0x548a('0x38')](_0x2834d1[_0x548a('0x30')][_0x548a('0x38')]);_0x333fef[_0x548a('0x39')]=qs[_0x548a('0x32')](_['pick'](_0x2834d1[_0x548a('0x30')],_0x523dd2[_0x548a('0x32')]),_0x4b0fe5);if(_0x2834d1[_0x548a('0x30')][_0x548a('0x3a')]){_0x333fef[_0x548a('0x39')]=_[_0x548a('0x3b')](_0x333fef[_0x548a('0x39')],{'$or':_[_0x548a('0x29')](_0x4b0fe5,function(_0x127453){if(_0x127453['type']!==_0x548a('0x3c')){var _0x321bb1={};_0x321bb1[_0x127453[_0x548a('0x26')]]={'$like':'%'+_0x2834d1['query'][_0x548a('0x3a')]+'%'};return _0x321bb1;}})});}_0x333fef=_[_0x548a('0x3b')]({},_0x333fef,_0x2834d1[_0x548a('0x3d')]);var _0x42fda5={'where':_0x333fef[_0x548a('0x39')]};return db['CmHopperBlack'][_0x548a('0x1e')](_0x42fda5)[_0x548a('0x23')](function(_0xd2e98f){_0x5e1ee8['count']=_0xd2e98f;if(_0x2834d1[_0x548a('0x30')][_0x548a('0x3e')]){_0x333fef[_0x548a('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x333fef);})[_0x548a('0x23')](function(_0x29a046){_0x5e1ee8[_0x548a('0x40')]=_0x29a046;return _0x5e1ee8;})[_0x548a('0x23')](respondWithFilteredResult(_0xefe850,_0x333fef))[_0x548a('0x41')](handleError(_0xefe850,null));};exports['show']=function(_0x5c29e9,_0x1c6404){var _0x38c243={'raw':!![],'where':{'id':_0x5c29e9[_0x548a('0x42')]['id']}},_0x58b260={};_0x58b260['model']=_[_0x548a('0x31')](db[_0x548a('0x2a')][_0x548a('0x2b')]);_0x58b260['query']=_[_0x548a('0x31')](_0x5c29e9['query']);_0x58b260[_0x548a('0x32')]=_[_0x548a('0x43')](_0x58b260[_0x548a('0x2f')],_0x58b260[_0x548a('0x30')]);_0x38c243[_0x548a('0x33')]=_[_0x548a('0x43')](_0x58b260[_0x548a('0x2f')],qs['fields'](_0x5c29e9[_0x548a('0x30')][_0x548a('0x34')]));_0x38c243['attributes']=_0x38c243[_0x548a('0x33')][_0x548a('0x44')]?_0x38c243[_0x548a('0x33')]:_0x58b260[_0x548a('0x2f')];if(_0x5c29e9['query']['includeAll']){_0x38c243['include']=[{'all':!![]}];}_0x38c243=_[_0x548a('0x3b')]({},_0x38c243,_0x5c29e9[_0x548a('0x3d')]);return db[_0x548a('0x2a')]['find'](_0x38c243)[_0x548a('0x23')](handleEntityNotFound(_0x1c6404,null))[_0x548a('0x23')](respondWithResult(_0x1c6404,null))[_0x548a('0x41')](handleError(_0x1c6404,null));};exports['update']=function(_0x179aa2,_0x39baf){if(_0x179aa2[_0x548a('0x45')]['id']){delete _0x179aa2[_0x548a('0x45')]['id'];}return db[_0x548a('0x2a')][_0x548a('0x46')]({'where':{'id':_0x179aa2[_0x548a('0x42')]['id']}})[_0x548a('0x23')](handleEntityNotFound(_0x39baf,null))[_0x548a('0x23')](saveUpdates(_0x179aa2[_0x548a('0x45')],null))[_0x548a('0x23')](respondWithResult(_0x39baf,null))[_0x548a('0x41')](handleError(_0x39baf,null));};exports[_0x548a('0x47')]=function(_0x435e53,_0x5572b3){return db[_0x548a('0x2a')]['find']({'where':{'id':_0x435e53[_0x548a('0x42')]['id']}})[_0x548a('0x23')](handleEntityNotFound(_0x5572b3,null))[_0x548a('0x23')](removeEntity(_0x5572b3,null))[_0x548a('0x41')](handleError(_0x5572b3,null));};exports[_0x548a('0x48')]=function(_0x333115,_0x5862a6){return db[_0x548a('0x2a')][_0x548a('0x48')]()[_0x548a('0x23')](respondWithResult(_0x5862a6,null))['catch'](handleError(_0x5862a6,null));};
\ No newline at end of file
+var _0x7791=['name','send','index','map','CmHopperBlack','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack'];(function(_0x238988,_0x55a3bc){var _0x4705e1=function(_0x50db4a){while(--_0x50db4a){_0x238988['push'](_0x238988['shift']());}};_0x4705e1(++_0x55a3bc);}(_0x7791,0xbb));var _0x1779=function(_0x3bc304,_0x1dd725){_0x3bc304=_0x3bc304-0x0;var _0x29124e=_0x7791[_0x3bc304];return _0x29124e;};'use strict';var emlformat=require(_0x1779('0x0'));var rimraf=require(_0x1779('0x1'));var zipdir=require(_0x1779('0x2'));var jsonpatch=require(_0x1779('0x3'));var rp=require('request-promise');var moment=require(_0x1779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1779('0x5'));var util=require('util');var path=require(_0x1779('0x6'));var sox=require(_0x1779('0x7'));var csv=require(_0x1779('0x8'));var ejs=require(_0x1779('0x9'));var fs=require('fs');var fs_extra=require(_0x1779('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1779('0xb'));var jsforce=require(_0x1779('0xc'));var deskjs=require(_0x1779('0xd'));var toCsv=require(_0x1779('0x8'));var querystring=require(_0x1779('0xe'));var Papa=require(_0x1779('0xf'));var Redis=require(_0x1779('0x10'));var authService=require(_0x1779('0x11'));var qs=require(_0x1779('0x12'));var as=require(_0x1779('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1779('0x14'))('api');var utils=require(_0x1779('0x15'));var config=require(_0x1779('0x16'));var licenseUtil=require(_0x1779('0x17'));var db=require(_0x1779('0x18'))['db'];function respondWithStatusCode(_0x313d72,_0xde5444){_0xde5444=_0xde5444||0xcc;return function(_0x3aa9e8){if(_0x3aa9e8){return _0x313d72[_0x1779('0x19')](_0xde5444);}return _0x313d72[_0x1779('0x1a')](_0xde5444)[_0x1779('0x1b')]();};}function respondWithResult(_0x510ed0,_0x4f282a){_0x4f282a=_0x4f282a||0xc8;return function(_0x2aef1d){if(_0x2aef1d){return _0x510ed0[_0x1779('0x1a')](_0x4f282a)[_0x1779('0x1c')](_0x2aef1d);}};}function respondWithFilteredResult(_0x49a4c6,_0x3da016){return function(_0x96e1ac){if(_0x96e1ac){var _0x39489f=typeof _0x3da016[_0x1779('0x1d')]===_0x1779('0x1e')&&typeof _0x3da016[_0x1779('0x1f')]===_0x1779('0x1e');var _0x56b8c5=_0x96e1ac[_0x1779('0x20')];var _0x353f92=_0x39489f?0x0:_0x3da016[_0x1779('0x1d')];var _0x3dca4c=_0x39489f?_0x96e1ac[_0x1779('0x20')]:_0x3da016[_0x1779('0x1d')]+_0x3da016[_0x1779('0x1f')];var _0x22cfd4;if(_0x3dca4c>=_0x56b8c5){_0x3dca4c=_0x56b8c5;_0x22cfd4=0xc8;}else{_0x22cfd4=0xce;}_0x49a4c6[_0x1779('0x1a')](_0x22cfd4);return _0x49a4c6[_0x1779('0x21')](_0x1779('0x22'),_0x353f92+'-'+_0x3dca4c+'/'+_0x56b8c5)['json'](_0x96e1ac);}return null;};}function patchUpdates(_0x406f1c){return function(_0x3736ce){try{jsonpatch[_0x1779('0x23')](_0x3736ce,_0x406f1c,!![]);}catch(_0x2ce3cf){return BPromise['reject'](_0x2ce3cf);}return _0x3736ce[_0x1779('0x24')]();};}function saveUpdates(_0x2842bf,_0x1a790b){return function(_0x5d95c6){if(_0x5d95c6){return _0x5d95c6['update'](_0x2842bf)[_0x1779('0x25')](function(_0xbb0078){return _0xbb0078;});}return null;};}function removeEntity(_0x46c877,_0x1b18cc){return function(_0x31344e){if(_0x31344e){return _0x31344e[_0x1779('0x26')]()['then'](function(){_0x46c877[_0x1779('0x1a')](0xcc)[_0x1779('0x1b')]();});}};}function handleEntityNotFound(_0x3f6a06,_0x4ee789){return function(_0xb0540e){if(!_0xb0540e){_0x3f6a06[_0x1779('0x19')](0x194);}return _0xb0540e;};}function handleError(_0x312505,_0xd66c3a){_0xd66c3a=_0xd66c3a||0x1f4;return function(_0x2d818b){logger[_0x1779('0x27')](_0x2d818b[_0x1779('0x28')]);if(_0x2d818b[_0x1779('0x29')]){delete _0x2d818b[_0x1779('0x29')];}_0x312505['status'](_0xd66c3a)[_0x1779('0x2a')](_0x2d818b);};}exports[_0x1779('0x2b')]=function(_0x5f281c,_0x391f63){var _0x3c39a1={},_0x1e9494={},_0x2df763={'count':0x0,'rows':[]};var _0x1248c1=_[_0x1779('0x2c')](db[_0x1779('0x2d')]['rawAttributes'],function(_0x9a302d){return{'name':_0x9a302d[_0x1779('0x2e')],'type':_0x9a302d[_0x1779('0x2f')][_0x1779('0x30')]};});_0x1e9494[_0x1779('0x31')]=_['map'](_0x1248c1,'name');_0x1e9494['query']=_[_0x1779('0x32')](_0x5f281c[_0x1779('0x33')]);_0x1e9494[_0x1779('0x34')]=_[_0x1779('0x35')](_0x1e9494[_0x1779('0x31')],_0x1e9494[_0x1779('0x33')]);_0x3c39a1[_0x1779('0x36')]=_['intersection'](_0x1e9494[_0x1779('0x31')],qs[_0x1779('0x37')](_0x5f281c[_0x1779('0x33')]['fields']));_0x3c39a1['attributes']=_0x3c39a1['attributes']['length']?_0x3c39a1[_0x1779('0x36')]:_0x1e9494['model'];if(!_0x5f281c[_0x1779('0x33')]['hasOwnProperty'](_0x1779('0x38'))){_0x3c39a1[_0x1779('0x1f')]=qs[_0x1779('0x1f')](_0x5f281c[_0x1779('0x33')]['limit']);_0x3c39a1[_0x1779('0x1d')]=qs[_0x1779('0x1d')](_0x5f281c[_0x1779('0x33')][_0x1779('0x1d')]);}_0x3c39a1['order']=qs['sort'](_0x5f281c[_0x1779('0x33')]['sort']);_0x3c39a1['where']=qs[_0x1779('0x34')](_[_0x1779('0x39')](_0x5f281c['query'],_0x1e9494[_0x1779('0x34')]),_0x1248c1);if(_0x5f281c[_0x1779('0x33')][_0x1779('0x3a')]){_0x3c39a1[_0x1779('0x3b')]=_['merge'](_0x3c39a1[_0x1779('0x3b')],{'$or':_[_0x1779('0x2c')](_0x1248c1,function(_0x1bbc8d){if(_0x1bbc8d[_0x1779('0x2f')]!==_0x1779('0x3c')){var _0x2f7e6b={};_0x2f7e6b[_0x1bbc8d[_0x1779('0x29')]]={'$like':'%'+_0x5f281c['query'][_0x1779('0x3a')]+'%'};return _0x2f7e6b;}})});}_0x3c39a1=_[_0x1779('0x3d')]({},_0x3c39a1,_0x5f281c['options']);var _0x43b8bd={'where':_0x3c39a1[_0x1779('0x3b')]};return db[_0x1779('0x2d')][_0x1779('0x20')](_0x43b8bd)[_0x1779('0x25')](function(_0x210661){_0x2df763['count']=_0x210661;if(_0x5f281c[_0x1779('0x33')]['includeAll']){_0x3c39a1[_0x1779('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1779('0x3f')](_0x3c39a1);})[_0x1779('0x25')](function(_0x9159d9){_0x2df763[_0x1779('0x40')]=_0x9159d9;return _0x2df763;})[_0x1779('0x25')](respondWithFilteredResult(_0x391f63,_0x3c39a1))[_0x1779('0x41')](handleError(_0x391f63,null));};exports[_0x1779('0x42')]=function(_0x3944ec,_0x24519f){var _0x317871={'raw':!![],'where':{'id':_0x3944ec[_0x1779('0x43')]['id']}},_0x4e03de={};_0x4e03de[_0x1779('0x31')]=_[_0x1779('0x32')](db[_0x1779('0x2d')][_0x1779('0x44')]);_0x4e03de[_0x1779('0x33')]=_['keys'](_0x3944ec[_0x1779('0x33')]);_0x4e03de[_0x1779('0x34')]=_[_0x1779('0x35')](_0x4e03de[_0x1779('0x31')],_0x4e03de[_0x1779('0x33')]);_0x317871[_0x1779('0x36')]=_[_0x1779('0x35')](_0x4e03de['model'],qs['fields'](_0x3944ec[_0x1779('0x33')]['fields']));_0x317871['attributes']=_0x317871[_0x1779('0x36')][_0x1779('0x45')]?_0x317871[_0x1779('0x36')]:_0x4e03de[_0x1779('0x31')];if(_0x3944ec[_0x1779('0x33')][_0x1779('0x46')]){_0x317871[_0x1779('0x3e')]=[{'all':!![]}];}_0x317871=_[_0x1779('0x3d')]({},_0x317871,_0x3944ec[_0x1779('0x47')]);return db[_0x1779('0x2d')][_0x1779('0x48')](_0x317871)[_0x1779('0x25')](handleEntityNotFound(_0x24519f,null))['then'](respondWithResult(_0x24519f,null))[_0x1779('0x41')](handleError(_0x24519f,null));};exports[_0x1779('0x49')]=function(_0x3c0862,_0x372706){if(_0x3c0862['body']['id']){delete _0x3c0862['body']['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x3c0862[_0x1779('0x43')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x372706,null))['then'](saveUpdates(_0x3c0862[_0x1779('0x4a')],null))['then'](respondWithResult(_0x372706,null))[_0x1779('0x41')](handleError(_0x372706,null));};exports[_0x1779('0x26')]=function(_0x267744,_0x3642f5){return db[_0x1779('0x2d')][_0x1779('0x48')]({'where':{'id':_0x267744['params']['id']}})['then'](handleEntityNotFound(_0x3642f5,null))[_0x1779('0x25')](removeEntity(_0x3642f5,null))[_0x1779('0x41')](handleError(_0x3642f5,null));};exports[_0x1779('0x4b')]=function(_0x14deb1,_0x405cc6){return db[_0x1779('0x2d')][_0x1779('0x4b')]()[_0x1779('0x25')](respondWithResult(_0x405cc6,null))['catch'](handleError(_0x405cc6,null));};
\ No newline at end of file
index d29080c..b972d45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e61=['path','../../config/environment','exports','define','CmHopperBlack','../../config/logger','api','moment','request-promise'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0x5e61,0x1d9));var _0x15e6=function(_0x52efc7,_0x5ae099){_0x52efc7=_0x52efc7-0x0;var _0x23c956=_0x5e61[_0x52efc7];return _0x23c956;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x15e6('0x0'))(_0x15e6('0x1'));var moment=require(_0x15e6('0x2'));var BPromise=require('bluebird');var rp=require(_0x15e6('0x3'));var fs=require('fs');var path=require(_0x15e6('0x4'));var rimraf=require('rimraf');var config=require(_0x15e6('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x15e6('0x6')]=function(_0x497fbc,_0x3d23cd){return _0x497fbc[_0x15e6('0x7')](_0x15e6('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf01c=['api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','lodash','util','../../config/logger'];(function(_0x5a39c3,_0x7fa035){var _0x366141=function(_0x8e64fd){while(--_0x8e64fd){_0x5a39c3['push'](_0x5a39c3['shift']());}};_0x366141(++_0x7fa035);}(_0xf01c,0x189));var _0xcf01=function(_0x21a127,_0x834064){_0x21a127=_0x21a127-0x0;var _0xf511b4=_0xf01c[_0x21a127];return _0xf511b4;};'use strict';var _=require(_0xcf01('0x0'));var util=require(_0xcf01('0x1'));var logger=require(_0xcf01('0x2'))(_0xcf01('0x3'));var moment=require(_0xcf01('0x4'));var BPromise=require(_0xcf01('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf01('0x6'));var rimraf=require(_0xcf01('0x7'));var config=require(_0xcf01('0x8'));var attributes=require(_0xcf01('0x9'));module['exports']=function(_0x52eddd,_0x47bec7){return _0x52eddd[_0xcf01('0xa')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c0c4570..8043d46 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a88=['options','raw','attributes','limit','include','map','model','update','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','CmHopperBlack','findAll'];(function(_0xc2fa88,_0x44149f){var _0x16df5f=function(_0x8c5e26){while(--_0x8c5e26){_0xc2fa88['push'](_0xc2fa88['shift']());}};_0x16df5f(++_0x44149f);}(_0x8a88,0xeb));var _0x88a8=function(_0x40e60f,_0x5365e1){_0x40e60f=_0x40e60f-0x0;var _0x35511f=_0x8a88[_0x40e60f];return _0x35511f;};'use strict';var _=require(_0x88a8('0x0'));var util=require(_0x88a8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x88a8('0x2'));var fs=require('fs');var Redis=require(_0x88a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x88a8('0x4'));var logger=require(_0x88a8('0x5'))('rpc');var config=require(_0x88a8('0x6'));var jayson=require(_0x88a8('0x7'));var client=jayson[_0x88a8('0x8')][_0x88a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43447b,_0x4ae02e,_0x305b38){return new BPromise(function(_0x787b1a,_0x57c5f1){return client[_0x88a8('0xa')](_0x43447b,_0x305b38)[_0x88a8('0xb')](function(_0x54b5df){logger[_0x88a8('0xc')](_0x88a8('0xd'),_0x4ae02e,'request\x20sent');logger[_0x88a8('0xe')](_0x88a8('0xf'),_0x4ae02e,_0x88a8('0x10'),JSON[_0x88a8('0x11')](_0x54b5df));if(_0x54b5df['error']){if(_0x54b5df['error'][_0x88a8('0x12')]===0x1f4){logger['error'](_0x88a8('0xd'),_0x4ae02e,_0x54b5df[_0x88a8('0x13')][_0x88a8('0x14')]);return _0x57c5f1(_0x54b5df[_0x88a8('0x13')][_0x88a8('0x14')]);}logger[_0x88a8('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x4ae02e,_0x54b5df[_0x88a8('0x13')][_0x88a8('0x14')]);return _0x787b1a(_0x54b5df[_0x88a8('0x13')][_0x88a8('0x14')]);}else{logger[_0x88a8('0xc')](_0x88a8('0xd'),_0x4ae02e,_0x88a8('0x10'));_0x787b1a(_0x54b5df['result']['message']);}})[_0x88a8('0x15')](function(_0x4f3b4b){logger[_0x88a8('0x13')](_0x88a8('0xd'),_0x4ae02e,_0x4f3b4b);_0x57c5f1(_0x4f3b4b);});});}exports['GetCmHopperBlack']=function(_0x220abd){var _0x52efa7=this;return new Promise(function(_0x3a3efa,_0x1f9770){return db[_0x88a8('0x16')][_0x88a8('0x17')]({'raw':_0x220abd[_0x88a8('0x18')]?_0x220abd[_0x88a8('0x18')][_0x88a8('0x19')]===undefined?!![]:![]:!![],'where':_0x220abd[_0x88a8('0x18')]?_0x220abd[_0x88a8('0x18')]['where']||null:null,'attributes':_0x220abd['options']?_0x220abd[_0x88a8('0x18')][_0x88a8('0x1a')]||null:null,'limit':_0x220abd[_0x88a8('0x18')]?_0x220abd[_0x88a8('0x18')][_0x88a8('0x1b')]||null:null,'include':_0x220abd[_0x88a8('0x18')]?_0x220abd['options'][_0x88a8('0x1c')]?_[_0x88a8('0x1d')](_0x220abd['options'][_0x88a8('0x1c')],function(_0xf9ece1){return{'model':db[_0xf9ece1[_0x88a8('0x1e')]],'as':_0xf9ece1['as'],'attributes':_0xf9ece1[_0x88a8('0x1a')],'include':_0xf9ece1[_0x88a8('0x1c')]?_[_0x88a8('0x1d')](_0xf9ece1['include'],function(_0x95150b){return{'model':db[_0x95150b[_0x88a8('0x1e')]],'as':_0x95150b['as'],'attributes':_0x95150b['attributes'],'include':_0x95150b[_0x88a8('0x1c')]?_['map'](_0x95150b['include'],function(_0x59f450){return{'model':db[_0x59f450[_0x88a8('0x1e')]],'as':_0x59f450['as'],'attributes':_0x59f450['attributes']};}):[]};}):[]};}):[]:[]})[_0x88a8('0xb')](function(_0x465920){logger[_0x88a8('0xc')]('GetCmHopperBlack',_0x220abd);logger['debug']('GetCmHopperBlack',_0x220abd,JSON[_0x88a8('0x11')](_0x465920));_0x3a3efa(_0x465920);})[_0x88a8('0x15')](function(_0x1e9cf7){logger[_0x88a8('0x13')]('GetCmHopperBlack',_0x1e9cf7['message'],_0x220abd);_0x1f9770(_0x52efa7['error'](0x1f4,_0x1e9cf7[_0x88a8('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x4f0779){var _0x2d87f2=this;return new Promise(function(_0x3a9f62,_0x5224fd){return db['CmHopperBlack'][_0x88a8('0x1f')](_0x4f0779[_0x88a8('0x20')],{'raw':_0x4f0779[_0x88a8('0x18')]?_0x4f0779[_0x88a8('0x18')][_0x88a8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0779[_0x88a8('0x18')]?_0x4f0779['options'][_0x88a8('0x21')]||null:null,'attributes':_0x4f0779[_0x88a8('0x18')]?_0x4f0779[_0x88a8('0x18')][_0x88a8('0x1a')]||null:null,'limit':_0x4f0779[_0x88a8('0x18')]?_0x4f0779[_0x88a8('0x18')][_0x88a8('0x1b')]||null:null})['then'](function(_0x55c3d5){logger[_0x88a8('0xc')](_0x88a8('0x22'),_0x4f0779);logger[_0x88a8('0xe')](_0x88a8('0x22'),_0x4f0779,JSON[_0x88a8('0x11')](_0x55c3d5));_0x3a9f62(_0x55c3d5);})[_0x88a8('0x15')](function(_0x57670f){logger[_0x88a8('0x13')](_0x88a8('0x22'),_0x57670f[_0x88a8('0x14')],_0x4f0779);_0x5224fd(_0x2d87f2['error'](0x1f4,_0x57670f[_0x88a8('0x14')]));});});};exports[_0x88a8('0x23')]=function(_0x4b74bb){var _0x42f6c6=this;return new Promise(function(_0x5d7702,_0x1aa7e1){return db[_0x88a8('0x16')][_0x88a8('0x24')]({'where':_0x4b74bb[_0x88a8('0x18')]?_0x4b74bb[_0x88a8('0x18')]['where']||null:null})[_0x88a8('0xb')](function(_0x157374){logger[_0x88a8('0xc')](_0x88a8('0x23'),_0x4b74bb);logger[_0x88a8('0xe')](_0x88a8('0x23'),_0x4b74bb,JSON[_0x88a8('0x11')](_0x157374));_0x5d7702(_0x157374);})['catch'](function(_0x2bc78a){logger[_0x88a8('0x13')](_0x88a8('0x23'),_0x2bc78a[_0x88a8('0x14')],_0x4b74bb);_0x1aa7e1(_0x42f6c6[_0x88a8('0x13')](0x1f4,_0x2bc78a['message']));});});};
\ No newline at end of file
+var _0x8824=['message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','include','map','model','then','stringify','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','error','code','CmHopperBlack,\x20%s,\x20%s'];(function(_0x4d209b,_0x1a05e8){var _0xc5e693=function(_0x109c6e){while(--_0x109c6e){_0x4d209b['push'](_0x4d209b['shift']());}};_0xc5e693(++_0x1a05e8);}(_0x8824,0x1cb));var _0x4882=function(_0x4cf861,_0x247626){_0x4cf861=_0x4cf861-0x0;var _0x3ced9e=_0x8824[_0x4cf861];return _0x3ced9e;};'use strict';var _=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var moment=require(_0x4882('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4882('0x3'));var db=require(_0x4882('0x4'))['db'];var utils=require(_0x4882('0x5'));var logger=require(_0x4882('0x6'))(_0x4882('0x7'));var config=require(_0x4882('0x8'));var jayson=require(_0x4882('0x9'));var client=jayson[_0x4882('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1304bd,_0x49e609,_0x532408){return new BPromise(function(_0x4d73ac,_0x40e478){return client['request'](_0x1304bd,_0x532408)['then'](function(_0x1502f0){logger[_0x4882('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x49e609,_0x4882('0xc'));logger[_0x4882('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x49e609,'request\x20sent',JSON['stringify'](_0x1502f0));if(_0x1502f0[_0x4882('0xe')]){if(_0x1502f0[_0x4882('0xe')][_0x4882('0xf')]===0x1f4){logger[_0x4882('0xe')](_0x4882('0x10'),_0x49e609,_0x1502f0[_0x4882('0xe')]['message']);return _0x40e478(_0x1502f0['error'][_0x4882('0x11')]);}logger[_0x4882('0xe')](_0x4882('0x10'),_0x49e609,_0x1502f0[_0x4882('0xe')][_0x4882('0x11')]);return _0x4d73ac(_0x1502f0['error'][_0x4882('0x11')]);}else{logger[_0x4882('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x49e609,_0x4882('0xc'));_0x4d73ac(_0x1502f0[_0x4882('0x12')][_0x4882('0x11')]);}})[_0x4882('0x13')](function(_0x797a29){logger[_0x4882('0xe')](_0x4882('0x10'),_0x49e609,_0x797a29);_0x40e478(_0x797a29);});});}exports[_0x4882('0x14')]=function(_0x598dd3){var _0x5cee95=this;return new Promise(function(_0x2186d9,_0x4480f8){return db[_0x4882('0x15')]['findAll']({'raw':_0x598dd3[_0x4882('0x16')]?_0x598dd3[_0x4882('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x598dd3['options']?_0x598dd3[_0x4882('0x16')][_0x4882('0x17')]||null:null,'attributes':_0x598dd3[_0x4882('0x16')]?_0x598dd3[_0x4882('0x16')][_0x4882('0x18')]||null:null,'limit':_0x598dd3['options']?_0x598dd3['options']['limit']||null:null,'include':_0x598dd3['options']?_0x598dd3[_0x4882('0x16')][_0x4882('0x19')]?_['map'](_0x598dd3['options'][_0x4882('0x19')],function(_0x48b9e4){return{'model':db[_0x48b9e4['model']],'as':_0x48b9e4['as'],'attributes':_0x48b9e4[_0x4882('0x18')],'include':_0x48b9e4['include']?_[_0x4882('0x1a')](_0x48b9e4['include'],function(_0x22ac0a){return{'model':db[_0x22ac0a[_0x4882('0x1b')]],'as':_0x22ac0a['as'],'attributes':_0x22ac0a[_0x4882('0x18')],'include':_0x22ac0a['include']?_['map'](_0x22ac0a[_0x4882('0x19')],function(_0x34af4b){return{'model':db[_0x34af4b[_0x4882('0x1b')]],'as':_0x34af4b['as'],'attributes':_0x34af4b[_0x4882('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4882('0x1c')](function(_0xb795c8){logger['info']('GetCmHopperBlack',_0x598dd3);logger[_0x4882('0xd')](_0x4882('0x14'),_0x598dd3,JSON[_0x4882('0x1d')](_0xb795c8));_0x2186d9(_0xb795c8);})[_0x4882('0x13')](function(_0x4ec60e){logger[_0x4882('0xe')](_0x4882('0x14'),_0x4ec60e['message'],_0x598dd3);_0x4480f8(_0x5cee95[_0x4882('0xe')](0x1f4,_0x4ec60e[_0x4882('0x11')]));});});};exports[_0x4882('0x1e')]=function(_0xf5cae3){var _0x5d7f84=this;return new Promise(function(_0x5953fc,_0x21dc64){return db['CmHopperBlack'][_0x4882('0x1f')](_0xf5cae3['body'],{'raw':_0xf5cae3[_0x4882('0x16')]?_0xf5cae3[_0x4882('0x16')][_0x4882('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5cae3[_0x4882('0x16')]?_0xf5cae3[_0x4882('0x16')][_0x4882('0x17')]||null:null,'attributes':_0xf5cae3[_0x4882('0x16')]?_0xf5cae3['options'][_0x4882('0x18')]||null:null,'limit':_0xf5cae3['options']?_0xf5cae3['options']['limit']||null:null})[_0x4882('0x1c')](function(_0x4a1638){logger[_0x4882('0xb')]('UpdateCmHopperBlack',_0xf5cae3);logger[_0x4882('0xd')](_0x4882('0x1e'),_0xf5cae3,JSON[_0x4882('0x1d')](_0x4a1638));_0x5953fc(_0x4a1638);})[_0x4882('0x13')](function(_0x3b7b33){logger[_0x4882('0xe')](_0x4882('0x1e'),_0x3b7b33['message'],_0xf5cae3);_0x21dc64(_0x5d7f84[_0x4882('0xe')](0x1f4,_0x3b7b33[_0x4882('0x11')]));});});};exports[_0x4882('0x21')]=function(_0x2bcff2){var _0x11de83=this;return new Promise(function(_0x591400,_0x343cc7){return db[_0x4882('0x15')]['destroy']({'where':_0x2bcff2['options']?_0x2bcff2['options'][_0x4882('0x17')]||null:null})[_0x4882('0x1c')](function(_0x42c8f1){logger['info'](_0x4882('0x21'),_0x2bcff2);logger['debug'](_0x4882('0x21'),_0x2bcff2,JSON[_0x4882('0x1d')](_0x42c8f1));_0x591400(_0x42c8f1);})['catch'](function(_0x2a7056){logger[_0x4882('0xe')]('DestroyCmHopperBlack',_0x2a7056[_0x4882('0x11')],_0x2bcff2);_0x343cc7(_0x11de83['error'](0x1f4,_0x2a7056[_0x4882('0x11')]));});});};
\ No newline at end of file
index cd58847..8404491 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','put','/:id','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x326f,0xd1));var _0xf326=function(_0xc9ecb6,_0xf19494){_0xc9ecb6=_0xc9ecb6-0x0;var _0x204c52=_0x326f[_0xc9ecb6];return _0x204c52;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')](_0xf326('0xf'),auth[_0xf326('0xa')](),controller[_0xf326('0x10')]);router['delete'](_0xf326('0xf'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0x2eb2=['/describe','describe','/:id','show','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1c6d60,_0x169674){var _0x3f5d8c=function(_0x2ec592){while(--_0x2ec592){_0x1c6d60['push'](_0x1c6d60['shift']());}};_0x3f5d8c(++_0x169674);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x2eb2[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x7')](_0x22eb('0xc'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')]('/:id',auth[_0x22eb('0x8')](),controller['update']);router['delete'](_0x22eb('0xc'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);module[_0x22eb('0x10')]=router;
\ No newline at end of file
index 9bbcc76..aaeae7c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e8c=['INTEGER','DATE','STRING','endtime','diff','seconds','BOOLEAN','moment','exports'];(function(_0x45911d,_0x25b782){var _0x387de2=function(_0x148819){while(--_0x148819){_0x45911d['push'](_0x45911d['shift']());}};_0x387de2(++_0x25b782);}(_0x5e8c,0xfa));var _0xc5e8=function(_0x1ab155,_0x3b918e){_0x1ab155=_0x1ab155-0x0;var _0x350ef9=_0x5e8c[_0x1ab155];return _0x350ef9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc5e8('0x0'));module[_0xc5e8('0x1')]={'state':{'type':Sequelize[_0xc5e8('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc5e8('0x3')]},'countbusyretry':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc5e8('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xc5e8('0x4')]},'originatecalleridname':{'type':Sequelize[_0xc5e8('0x4')]},'calleridnum':{'type':Sequelize[_0xc5e8('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc5e8('0x3')]},'responsetime':{'type':Sequelize[_0xc5e8('0x3')]},'answertime':{'type':Sequelize[_0xc5e8('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc5e8('0x3')]},'ringtime':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc5e8('0x4')]},'campaign':{'type':Sequelize[_0xc5e8('0x4')]},'campaigntype':{'type':Sequelize[_0xc5e8('0x4')]},'membername':{'type':Sequelize[_0xc5e8('0x4')]},'reason':{'type':Sequelize[_0xc5e8('0x4')]},'disposition':{'type':Sequelize[_0xc5e8('0x4')]},'secondDisposition':{'type':Sequelize[_0xc5e8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc5e8('0x4')]},'dispositionat':{'type':Sequelize[_0xc5e8('0x3')],'set':function(_0x51c882){var _0x51054c=this['getDataValue'](_0xc5e8('0x5'));if(_0x51054c&&_0x51c882){this['setDataValue']('followuptime',moment(_0x51c882)[_0xc5e8('0x6')](moment(_0x51054c),_0xc5e8('0x7')));}}},'amd':{'type':Sequelize[_0xc5e8('0x8')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc5e8('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc5e8('0x3')]},'callback':{'type':Sequelize[_0xc5e8('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc5e8('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc5e8('0x3')]},'deleted':{'type':Sequelize[_0xc5e8('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc5e8('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc5e8('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x987c=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x987c,0x74));var _0xc987=function(_0x5f5346,_0x250efe){_0x5f5346=_0x5f5346-0x0;var _0x16def9=_0x987c[_0x5f5346];return _0x16def9;};'use strict';var Sequelize=require(_0xc987('0x0'));var moment=require(_0xc987('0x1'));module[_0xc987('0x2')]={'state':{'type':Sequelize[_0xc987('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xc987('0x4')]},'scheduledat':{'type':Sequelize[_0xc987('0x5')]},'countbusyretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xc987('0x4')]},'calleridnum':{'type':Sequelize[_0xc987('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc987('0x5')]},'answertime':{'type':Sequelize[_0xc987('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc987('0x5')]},'ringtime':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xc987('0x4')]},'campaigntype':{'type':Sequelize[_0xc987('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xc987('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc987('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc987('0x4')]},'dispositionat':{'type':Sequelize[_0xc987('0x5')],'set':function(_0x10582e){var _0x82dd57=this[_0xc987('0x6')](_0xc987('0x7'));if(_0x82dd57&&_0x10582e){this[_0xc987('0x8')](_0xc987('0x9'),moment(_0x10582e)['diff'](moment(_0x82dd57),_0xc987('0xa')));}}},'amd':{'type':Sequelize[_0xc987('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc987('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc987('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc987('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc987('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc987('0x5')]},'deleted':{'type':Sequelize[_0xc987('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc987('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc987('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc987('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index 9b00e5d..09b0029 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x58389d,_0x3137df){var _0x2be20a=function(_0x2b6f46){while(--_0x2b6f46){_0x58389d['push'](_0x58389d['shift']());}};_0x2be20a(++_0x3137df);}(_0x5d58,0x187));var _0x85d5=function(_0x10e69e,_0x615ec9){_0x10e69e=_0x10e69e-0x0;var _0x3a6754=_0x5d58[_0x10e69e];return _0x3a6754;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));};
\ No newline at end of file
+var _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x187d,0x93));var _0xd187=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x187d[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));};
\ No newline at end of file
index 9accc98..95494e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b40=['util','../../config/logger','api','moment','request-promise','path','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x1b40,0x1ed));var _0x01b4=function(_0x18032f,_0x4f4e45){_0x18032f=_0x18032f-0x0;var _0xb0b2b8=_0x1b40[_0x18032f];return _0xb0b2b8;};'use strict';var _=require(_0x01b4('0x0'));var util=require(_0x01b4('0x1'));var logger=require(_0x01b4('0x2'))(_0x01b4('0x3'));var moment=require(_0x01b4('0x4'));var BPromise=require('bluebird');var rp=require(_0x01b4('0x5'));var fs=require('fs');var path=require(_0x01b4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x01b4('0x7'));module['exports']=function(_0xd37052,_0x250ca6){return _0xd37052[_0x01b4('0x8')](_0x01b4('0x9'),attributes,{'tableName':_0x01b4('0xa'),'paranoid':![],'indexes':[{'name':_0x01b4('0xb'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0x01b4('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa03b=['../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x2fd4a7,_0x4aec26){var _0x20ca65=function(_0x2dce3b){while(--_0x2dce3b){_0x2fd4a7['push'](_0x2fd4a7['shift']());}};_0x20ca65(++_0x4aec26);}(_0xa03b,0xb4));var _0xba03=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0xa03b[_0x1e4f2f];return _0xccea89;};'use strict';var _=require(_0xba03('0x0'));var util=require(_0xba03('0x1'));var logger=require(_0xba03('0x2'))(_0xba03('0x3'));var moment=require(_0xba03('0x4'));var BPromise=require(_0xba03('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba03('0x6'));var rimraf=require('rimraf');var config=require(_0xba03('0x7'));var attributes=require(_0xba03('0x8'));module['exports']=function(_0x84c73,_0xfcfdac){return _0x84c73['define'](_0xba03('0x9'),attributes,{'tableName':_0xba03('0xa'),'paranoid':![],'indexes':[{'name':_0xba03('0xb'),'fields':[_0xba03('0xb')]},{'name':'uniqueid','fields':[_0xba03('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 247176d..093ea5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x110ddb,_0xcb03e9){var _0x170861=function(_0x2f6327){while(--_0x2f6327){_0x110ddb['push'](_0x110ddb['shift']());}};_0x170861(++_0xcb03e9);}(_0x7a54,0x106));var _0x47a5=function(_0x387785,_0x4e5b73){_0x387785=_0x387785-0x0;var _0xace407=_0x7a54[_0x387785];return _0xace407;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};
\ No newline at end of file
+var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x235949,_0x1ea646){var _0xf4d440=function(_0x180c7b){while(--_0x180c7b){_0x235949['push'](_0x235949['shift']());}};_0xf4d440(++_0x1ea646);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a9b3f,_0x158971){_0x4a9b3f=_0x4a9b3f-0x0;var _0x48b4f0=_0xb10b[_0x4a9b3f];return _0x48b4f0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});};
\ No newline at end of file
index 698d8eb..ad049a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7bd5=['path','Router','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','util'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x7bd5,0x72));var _0x57bd=function(_0x7014dc,_0x53d244){_0x7014dc=_0x7014dc-0x0;var _0x42d253=_0x7bd5[_0x7014dc];return _0x42d253;};'use strict';var multer=require('multer');var util=require(_0x57bd('0x0'));var path=require(_0x57bd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x57bd('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57bd('0x3'));var controller=require(_0x57bd('0x4'));router[_0x57bd('0x5')]('/',auth[_0x57bd('0x6')](),controller[_0x57bd('0x7')]);router[_0x57bd('0x5')](_0x57bd('0x8'),auth[_0x57bd('0x6')](),controller['describe']);router[_0x57bd('0x5')](_0x57bd('0x9'),auth[_0x57bd('0x6')](),controller[_0x57bd('0xa')]);router[_0x57bd('0x5')](_0x57bd('0xb'),auth[_0x57bd('0x6')](),controller[_0x57bd('0xc')]);router[_0x57bd('0x5')](_0x57bd('0xd'),auth[_0x57bd('0x6')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x57bd('0xe')](_0x57bd('0xf'),auth['isAuthenticated'](),controller[_0x57bd('0x10')]);router[_0x57bd('0xe')](_0x57bd('0x11'),auth[_0x57bd('0x6')](),controller[_0x57bd('0x12')]);router[_0x57bd('0xe')]('/checkContactHopper',auth[_0x57bd('0x6')](),controller[_0x57bd('0x13')]);router[_0x57bd('0x14')](_0x57bd('0x9'),auth[_0x57bd('0x6')](),controller[_0x57bd('0x15')]);module[_0x57bd('0x16')]=router;
\ No newline at end of file
+var _0x3ef7=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x73ef('0x0'));var util=require('util');var path=require(_0x73ef('0x1'));var timeout=require(_0x73ef('0x2'));var express=require(_0x73ef('0x3'));var router=express[_0x73ef('0x4')]();var fs_extra=require(_0x73ef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73ef('0x6'));var config=require(_0x73ef('0x7'));var controller=require(_0x73ef('0x8'));router[_0x73ef('0x9')]('/',auth['isAuthenticated'](),controller[_0x73ef('0xa')]);router[_0x73ef('0x9')](_0x73ef('0xb'),auth[_0x73ef('0xc')](),controller[_0x73ef('0xd')]);router['get'](_0x73ef('0xe'),auth[_0x73ef('0xc')](),controller['show']);router[_0x73ef('0x9')](_0x73ef('0xf'),auth[_0x73ef('0xc')](),controller[_0x73ef('0x10')]);router[_0x73ef('0x9')]('/campaign/countAttributes/:id',auth[_0x73ef('0xc')](),controller[_0x73ef('0x11')]);router[_0x73ef('0x12')](_0x73ef('0x13'),auth[_0x73ef('0xc')](),controller[_0x73ef('0x14')]);router[_0x73ef('0x12')](_0x73ef('0x15'),auth[_0x73ef('0xc')](),controller[_0x73ef('0x16')]);router[_0x73ef('0x12')](_0x73ef('0x17'),auth[_0x73ef('0xc')](),controller['checkContactHopper']);router[_0x73ef('0x18')]('/:id',auth[_0x73ef('0xc')](),controller[_0x73ef('0x19')]);module[_0x73ef('0x1a')]=router;
\ No newline at end of file
index ba58cfe..398ffa9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5921=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x241fe1,_0x1a041f){var _0x4b3a3d=function(_0x1698be){while(--_0x1698be){_0x241fe1['push'](_0x241fe1['shift']());}};_0x4b3a3d(++_0x1a041f);}(_0x5921,0x16e));var _0x1592=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x5921[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x1592('0x0'));module[_0x1592('0x1')]={'state':{'type':Sequelize[_0x1592('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1592('0x3')]},'countbusyretry':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1592('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x1592('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1592('0x4')]},'calleridname':{'type':Sequelize[_0x1592('0x4')]},'starttime':{'type':Sequelize[_0x1592('0x3')]},'responsetime':{'type':Sequelize[_0x1592('0x3')]},'answertime':{'type':Sequelize[_0x1592('0x3')]},'droptime':{'type':Sequelize[_0x1592('0x3')]},'endtime':{'type':Sequelize[_0x1592('0x3')]},'ringtime':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1592('0x4')]},'campaign':{'type':Sequelize[_0x1592('0x4')]},'campaigntype':{'type':Sequelize[_0x1592('0x4')]},'membername':{'type':Sequelize[_0x1592('0x4')]},'reason':{'type':Sequelize[_0x1592('0x4')]},'amd':{'type':Sequelize[_0x1592('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1592('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1592('0x3')]},'recallme':{'type':Sequelize[_0x1592('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1592('0x3')]},'edited':{'type':Sequelize[_0x1592('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1592('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1592('0x4')]}};
\ No newline at end of file
+var _0x7622=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x3068c8,_0x1f5504){var _0x40c6e4=function(_0x4e1f11){while(--_0x4e1f11){_0x3068c8['push'](_0x3068c8['shift']());}};_0x40c6e4(++_0x1f5504);}(_0x7622,0xba));var _0x2762=function(_0x291d80,_0x574ab4){_0x291d80=_0x291d80-0x0;var _0x35e2c6=_0x7622[_0x291d80];return _0x35e2c6;};'use strict';var Sequelize=require(_0x2762('0x0'));module['exports']={'state':{'type':Sequelize[_0x2762('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2762('0x2')]},'countbusyretry':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2762('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2762('0x3')]},'calleridname':{'type':Sequelize[_0x2762('0x3')]},'starttime':{'type':Sequelize[_0x2762('0x2')]},'responsetime':{'type':Sequelize[_0x2762('0x2')]},'answertime':{'type':Sequelize[_0x2762('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2762('0x2')]},'ringtime':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2762('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x2762('0x3')]},'membername':{'type':Sequelize[_0x2762('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x2762('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2762('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2762('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2762('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2762('0x2')]},'recallme':{'type':Sequelize[_0x2762('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2762('0x2')]},'edited':{'type':Sequelize[_0x2762('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2762('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2762('0x3')]}};
\ No newline at end of file
index 413c27a..eb14727 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4262=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4262,0x138));var _0x2426=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4262[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x2426('0x0'));var rimraf=require(_0x2426('0x1'));var zipdir=require(_0x2426('0x2'));var jsonpatch=require(_0x2426('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2426('0x4'));var Mustache=require('mustache');var util=require(_0x2426('0x5'));var path=require('path');var sox=require(_0x2426('0x6'));var csv=require('to-csv');var ejs=require(_0x2426('0x7'));var fs=require('fs');var fs_extra=require(_0x2426('0x8'));var _=require(_0x2426('0x9'));var squel=require(_0x2426('0xa'));var crypto=require(_0x2426('0xb'));var jsforce=require(_0x2426('0xc'));var deskjs=require(_0x2426('0xd'));var toCsv=require(_0x2426('0xe'));var querystring=require(_0x2426('0xf'));var Papa=require('papaparse');var Redis=require(_0x2426('0x10'));var authService=require(_0x2426('0x11'));var qs=require(_0x2426('0x12'));var as=require(_0x2426('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2426('0x14'))(_0x2426('0x15'));var utils=require('../../config/utils');var config=require(_0x2426('0x16'));var licenseUtil=require(_0x2426('0x17'));var db=require(_0x2426('0x18'))['db'];function respondWithStatusCode(_0x309a5d,_0x1c551f){_0x1c551f=_0x1c551f||0xcc;return function(_0x38f1c9){if(_0x38f1c9){return _0x309a5d[_0x2426('0x19')](_0x1c551f);}return _0x309a5d[_0x2426('0x1a')](_0x1c551f)['end']();};}function respondWithResult(_0x203ef1,_0x484cf2){_0x484cf2=_0x484cf2||0xc8;return function(_0x2311b5){if(_0x2311b5){return _0x203ef1[_0x2426('0x1a')](_0x484cf2)[_0x2426('0x1b')](_0x2311b5);}};}function respondWithFilteredResult(_0x4628df,_0x6a2c30){return function(_0x5d5bb7){if(_0x5d5bb7){var _0x5264e3=typeof _0x6a2c30['offset']===_0x2426('0x1c')&&typeof _0x6a2c30['limit']===_0x2426('0x1c');var _0x3aa0e5=_0x5d5bb7[_0x2426('0x1d')];var _0x5617e6=_0x5264e3?0x0:_0x6a2c30[_0x2426('0x1e')];var _0x40a47b=_0x5264e3?_0x5d5bb7[_0x2426('0x1d')]:_0x6a2c30[_0x2426('0x1e')]+_0x6a2c30[_0x2426('0x1f')];var _0x4aecb7;if(_0x40a47b>=_0x3aa0e5){_0x40a47b=_0x3aa0e5;_0x4aecb7=0xc8;}else{_0x4aecb7=0xce;}_0x4628df[_0x2426('0x1a')](_0x4aecb7);return _0x4628df[_0x2426('0x20')](_0x2426('0x21'),_0x5617e6+'-'+_0x40a47b+'/'+_0x3aa0e5)[_0x2426('0x1b')](_0x5d5bb7);}return null;};}function patchUpdates(_0x40ee81){return function(_0x4b402c){try{jsonpatch[_0x2426('0x22')](_0x4b402c,_0x40ee81,!![]);}catch(_0x5257a7){return BPromise[_0x2426('0x23')](_0x5257a7);}return _0x4b402c[_0x2426('0x24')]();};}function saveUpdates(_0x2b4c13,_0x301786){return function(_0x1deabb){if(_0x1deabb){return _0x1deabb[_0x2426('0x25')](_0x2b4c13)[_0x2426('0x26')](function(_0x352807){return _0x352807;});}return null;};}function removeEntity(_0x58b81d,_0x2df007){return function(_0x57b952){if(_0x57b952){return _0x57b952[_0x2426('0x27')]()['then'](function(){_0x58b81d['status'](0xcc)[_0x2426('0x28')]();});}};}function handleEntityNotFound(_0x395378,_0x217f8b){return function(_0x3fc5c6){if(!_0x3fc5c6){_0x395378[_0x2426('0x19')](0x194);}return _0x3fc5c6;};}function handleError(_0x32c477,_0x1ff9e6){_0x1ff9e6=_0x1ff9e6||0x1f4;return function(_0x22f4be){logger[_0x2426('0x29')](_0x22f4be[_0x2426('0x2a')]);if(_0x22f4be[_0x2426('0x2b')]){delete _0x22f4be['name'];}_0x32c477[_0x2426('0x1a')](_0x1ff9e6)[_0x2426('0x2c')](_0x22f4be);};}exports[_0x2426('0x2d')]=function(_0x6388d4,_0x1ec182){var _0x518d50={},_0x539b97={},_0x138893={'count':0x0,'rows':[]};var _0x7c56ef=_[_0x2426('0x2e')](db[_0x2426('0x2f')][_0x2426('0x30')],function(_0x454b7f){return{'name':_0x454b7f[_0x2426('0x31')],'type':_0x454b7f[_0x2426('0x32')][_0x2426('0x33')]};});_0x539b97['model']=_['map'](_0x7c56ef,_0x2426('0x2b'));_0x539b97[_0x2426('0x34')]=_[_0x2426('0x35')](_0x6388d4['query']);_0x539b97[_0x2426('0x36')]=_[_0x2426('0x37')](_0x539b97[_0x2426('0x38')],_0x539b97[_0x2426('0x34')]);_0x518d50['attributes']=_[_0x2426('0x37')](_0x539b97[_0x2426('0x38')],qs[_0x2426('0x39')](_0x6388d4[_0x2426('0x34')][_0x2426('0x39')]));_0x518d50[_0x2426('0x3a')]=_0x518d50[_0x2426('0x3a')][_0x2426('0x3b')]?_0x518d50['attributes']:_0x539b97[_0x2426('0x38')];if(!_0x6388d4[_0x2426('0x34')][_0x2426('0x3c')]('nolimit')){_0x518d50['limit']=qs[_0x2426('0x1f')](_0x6388d4[_0x2426('0x34')][_0x2426('0x1f')]);_0x518d50[_0x2426('0x1e')]=qs['offset'](_0x6388d4[_0x2426('0x34')][_0x2426('0x1e')]);}_0x518d50[_0x2426('0x3d')]=qs[_0x2426('0x3e')](_0x6388d4[_0x2426('0x34')]['sort']);_0x518d50[_0x2426('0x3f')]=qs[_0x2426('0x36')](_[_0x2426('0x40')](_0x6388d4[_0x2426('0x34')],_0x539b97[_0x2426('0x36')]),_0x7c56ef);if(_0x6388d4[_0x2426('0x34')][_0x2426('0x41')]){_0x518d50['where']=_[_0x2426('0x42')](_0x518d50['where'],{'$or':_['map'](_0x7c56ef,function(_0x180f73){if(_0x180f73[_0x2426('0x32')]!==_0x2426('0x43')){var _0x3ef70c={};_0x3ef70c[_0x180f73[_0x2426('0x2b')]]={'$like':'%'+_0x6388d4[_0x2426('0x34')][_0x2426('0x41')]+'%'};return _0x3ef70c;}})});}_0x518d50=_[_0x2426('0x42')]({},_0x518d50,_0x6388d4['options']);var _0x31a7af={'where':_0x518d50[_0x2426('0x3f')]};return db['CmHopperHistory'][_0x2426('0x1d')](_0x31a7af)[_0x2426('0x26')](function(_0x33c8bc){_0x138893[_0x2426('0x1d')]=_0x33c8bc;if(_0x6388d4[_0x2426('0x34')][_0x2426('0x44')]){_0x518d50['include']=[{'all':!![]}];}return db[_0x2426('0x2f')][_0x2426('0x45')](_0x518d50);})[_0x2426('0x26')](function(_0x4e84e3){_0x138893['rows']=_0x4e84e3;return _0x138893;})[_0x2426('0x26')](respondWithFilteredResult(_0x1ec182,_0x518d50))[_0x2426('0x46')](handleError(_0x1ec182,null));};exports[_0x2426('0x47')]=function(_0x1b7769,_0x4a7a38){var _0x43e840={'raw':!![],'where':{'id':_0x1b7769[_0x2426('0x48')]['id']}},_0xc87cad={};_0xc87cad['model']=_[_0x2426('0x35')](db[_0x2426('0x2f')]['rawAttributes']);_0xc87cad[_0x2426('0x34')]=_['keys'](_0x1b7769[_0x2426('0x34')]);_0xc87cad[_0x2426('0x36')]=_['intersection'](_0xc87cad[_0x2426('0x38')],_0xc87cad['query']);_0x43e840['attributes']=_[_0x2426('0x37')](_0xc87cad[_0x2426('0x38')],qs[_0x2426('0x39')](_0x1b7769[_0x2426('0x34')][_0x2426('0x39')]));_0x43e840[_0x2426('0x3a')]=_0x43e840['attributes']['length']?_0x43e840[_0x2426('0x3a')]:_0xc87cad[_0x2426('0x38')];if(_0x1b7769[_0x2426('0x34')][_0x2426('0x44')]){_0x43e840[_0x2426('0x49')]=[{'all':!![]}];}_0x43e840=_[_0x2426('0x42')]({},_0x43e840,_0x1b7769[_0x2426('0x4a')]);return db[_0x2426('0x2f')][_0x2426('0x4b')](_0x43e840)[_0x2426('0x26')](handleEntityNotFound(_0x4a7a38,null))[_0x2426('0x26')](respondWithResult(_0x4a7a38,null))[_0x2426('0x46')](handleError(_0x4a7a38,null));};exports['create']=function(_0x3ae80f,_0x4683ea){return db['CmHopperHistory'][_0x2426('0x4c')](_0x3ae80f[_0x2426('0x4d')],{})[_0x2426('0x26')](respondWithResult(_0x4683ea,0xc9))['catch'](handleError(_0x4683ea,null));};exports[_0x2426('0x4e')]=function(_0x4e415d,_0x290ea4){return db['CmHopperHistory'][_0x2426('0x4e')]()[_0x2426('0x26')](respondWithResult(_0x290ea4,null))[_0x2426('0x46')](handleError(_0x290ea4,null));};exports[_0x2426('0x25')]=function(_0x451577,_0x2a59ec){if(_0x451577[_0x2426('0x4d')]['uniqueid']){delete _0x451577[_0x2426('0x4d')][_0x2426('0x4f')];}return db[_0x2426('0x2f')][_0x2426('0x4b')]({'where':{'uniqueid':_0x451577[_0x2426('0x48')]['id']}})[_0x2426('0x26')](handleEntityNotFound(_0x2a59ec,null))['then'](saveUpdates(_0x451577[_0x2426('0x4d')],null))[_0x2426('0x26')](respondWithResult(_0x2a59ec,null))[_0x2426('0x46')](handleError(_0x2a59ec,null));};
\ No newline at end of file
+var _0x74b4=['update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','includeAll','rows','catch','params','keys','include','options','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x350396,_0x391ad2){var _0xf306b1=function(_0x3f2d38){while(--_0x3f2d38){_0x350396['push'](_0x350396['shift']());}};_0xf306b1(++_0x391ad2);}(_0x74b4,0x1b1));var _0x474b=function(_0x5ba506,_0x316c7a){_0x5ba506=_0x5ba506-0x0;var _0x820408=_0x74b4[_0x5ba506];return _0x820408;};'use strict';var emlformat=require(_0x474b('0x0'));var rimraf=require(_0x474b('0x1'));var zipdir=require(_0x474b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x474b('0x3'));var moment=require(_0x474b('0x4'));var BPromise=require(_0x474b('0x5'));var Mustache=require('mustache');var util=require(_0x474b('0x6'));var path=require(_0x474b('0x7'));var sox=require(_0x474b('0x8'));var csv=require('to-csv');var ejs=require(_0x474b('0x9'));var fs=require('fs');var fs_extra=require(_0x474b('0xa'));var _=require(_0x474b('0xb'));var squel=require(_0x474b('0xc'));var crypto=require(_0x474b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x474b('0xe'));var toCsv=require(_0x474b('0xf'));var querystring=require(_0x474b('0x10'));var Papa=require(_0x474b('0x11'));var Redis=require(_0x474b('0x12'));var authService=require(_0x474b('0x13'));var qs=require(_0x474b('0x14'));var as=require(_0x474b('0x15'));var hardwareService=require(_0x474b('0x16'));var logger=require('../../config/logger')(_0x474b('0x17'));var utils=require(_0x474b('0x18'));var config=require(_0x474b('0x19'));var licenseUtil=require(_0x474b('0x1a'));var db=require(_0x474b('0x1b'))['db'];function respondWithStatusCode(_0x14a90d,_0x3b1b83){_0x3b1b83=_0x3b1b83||0xcc;return function(_0x73f579){if(_0x73f579){return _0x14a90d[_0x474b('0x1c')](_0x3b1b83);}return _0x14a90d[_0x474b('0x1d')](_0x3b1b83)[_0x474b('0x1e')]();};}function respondWithResult(_0x32ac30,_0x2a0167){_0x2a0167=_0x2a0167||0xc8;return function(_0x24b1ab){if(_0x24b1ab){return _0x32ac30[_0x474b('0x1d')](_0x2a0167)[_0x474b('0x1f')](_0x24b1ab);}};}function respondWithFilteredResult(_0x2bbe9a,_0x593367){return function(_0x106acf){if(_0x106acf){var _0x56fb82=typeof _0x593367[_0x474b('0x20')]===_0x474b('0x21')&&typeof _0x593367['limit']===_0x474b('0x21');var _0x53f4a7=_0x106acf[_0x474b('0x22')];var _0x521bf6=_0x56fb82?0x0:_0x593367[_0x474b('0x20')];var _0x5c6222=_0x56fb82?_0x106acf[_0x474b('0x22')]:_0x593367[_0x474b('0x20')]+_0x593367[_0x474b('0x23')];var _0x4df539;if(_0x5c6222>=_0x53f4a7){_0x5c6222=_0x53f4a7;_0x4df539=0xc8;}else{_0x4df539=0xce;}_0x2bbe9a[_0x474b('0x1d')](_0x4df539);return _0x2bbe9a[_0x474b('0x24')](_0x474b('0x25'),_0x521bf6+'-'+_0x5c6222+'/'+_0x53f4a7)['json'](_0x106acf);}return null;};}function patchUpdates(_0x5a128a){return function(_0x5de11b){try{jsonpatch[_0x474b('0x26')](_0x5de11b,_0x5a128a,!![]);}catch(_0xdf95b){return BPromise[_0x474b('0x27')](_0xdf95b);}return _0x5de11b[_0x474b('0x28')]();};}function saveUpdates(_0x454c9f,_0xae3cf5){return function(_0x240edd){if(_0x240edd){return _0x240edd[_0x474b('0x29')](_0x454c9f)[_0x474b('0x2a')](function(_0x55e7f6){return _0x55e7f6;});}return null;};}function removeEntity(_0x4f8455,_0xfb351b){return function(_0x2f49dd){if(_0x2f49dd){return _0x2f49dd[_0x474b('0x2b')]()[_0x474b('0x2a')](function(){_0x4f8455['status'](0xcc)[_0x474b('0x1e')]();});}};}function handleEntityNotFound(_0x86b511,_0x257e3c){return function(_0xaebade){if(!_0xaebade){_0x86b511[_0x474b('0x1c')](0x194);}return _0xaebade;};}function handleError(_0x5744dd,_0x4558cc){_0x4558cc=_0x4558cc||0x1f4;return function(_0x317364){logger[_0x474b('0x2c')](_0x317364[_0x474b('0x2d')]);if(_0x317364[_0x474b('0x2e')]){delete _0x317364[_0x474b('0x2e')];}_0x5744dd[_0x474b('0x1d')](_0x4558cc)[_0x474b('0x2f')](_0x317364);};}exports['index']=function(_0x4a2963,_0x26ff67){var _0x4a00aa={},_0x5a0af9={},_0x1fc182={'count':0x0,'rows':[]};var _0x3636e2=_[_0x474b('0x30')](db[_0x474b('0x31')][_0x474b('0x32')],function(_0x4a5a9b){return{'name':_0x4a5a9b[_0x474b('0x33')],'type':_0x4a5a9b['type'][_0x474b('0x34')]};});_0x5a0af9[_0x474b('0x35')]=_['map'](_0x3636e2,_0x474b('0x2e'));_0x5a0af9['query']=_['keys'](_0x4a2963['query']);_0x5a0af9[_0x474b('0x36')]=_[_0x474b('0x37')](_0x5a0af9[_0x474b('0x35')],_0x5a0af9[_0x474b('0x38')]);_0x4a00aa[_0x474b('0x39')]=_[_0x474b('0x37')](_0x5a0af9['model'],qs['fields'](_0x4a2963[_0x474b('0x38')][_0x474b('0x3a')]));_0x4a00aa[_0x474b('0x39')]=_0x4a00aa['attributes'][_0x474b('0x3b')]?_0x4a00aa[_0x474b('0x39')]:_0x5a0af9[_0x474b('0x35')];if(!_0x4a2963['query'][_0x474b('0x3c')]('nolimit')){_0x4a00aa[_0x474b('0x23')]=qs[_0x474b('0x23')](_0x4a2963[_0x474b('0x38')][_0x474b('0x23')]);_0x4a00aa[_0x474b('0x20')]=qs[_0x474b('0x20')](_0x4a2963['query']['offset']);}_0x4a00aa[_0x474b('0x3d')]=qs[_0x474b('0x3e')](_0x4a2963[_0x474b('0x38')]['sort']);_0x4a00aa['where']=qs[_0x474b('0x36')](_[_0x474b('0x3f')](_0x4a2963[_0x474b('0x38')],_0x5a0af9[_0x474b('0x36')]),_0x3636e2);if(_0x4a2963[_0x474b('0x38')][_0x474b('0x40')]){_0x4a00aa[_0x474b('0x41')]=_['merge'](_0x4a00aa[_0x474b('0x41')],{'$or':_[_0x474b('0x30')](_0x3636e2,function(_0x5c446f){if(_0x5c446f[_0x474b('0x42')]!==_0x474b('0x43')){var _0x5bfa08={};_0x5bfa08[_0x5c446f[_0x474b('0x2e')]]={'$like':'%'+_0x4a2963[_0x474b('0x38')][_0x474b('0x40')]+'%'};return _0x5bfa08;}})});}_0x4a00aa=_['merge']({},_0x4a00aa,_0x4a2963['options']);var _0x2eb154={'where':_0x4a00aa[_0x474b('0x41')]};return db[_0x474b('0x31')][_0x474b('0x22')](_0x2eb154)[_0x474b('0x2a')](function(_0x2b0b9b){_0x1fc182[_0x474b('0x22')]=_0x2b0b9b;if(_0x4a2963[_0x474b('0x38')][_0x474b('0x44')]){_0x4a00aa['include']=[{'all':!![]}];}return db[_0x474b('0x31')]['findAll'](_0x4a00aa);})[_0x474b('0x2a')](function(_0x12fdf0){_0x1fc182[_0x474b('0x45')]=_0x12fdf0;return _0x1fc182;})['then'](respondWithFilteredResult(_0x26ff67,_0x4a00aa))[_0x474b('0x46')](handleError(_0x26ff67,null));};exports['show']=function(_0x33b33b,_0x57323e){var _0x1dd33f={'raw':!![],'where':{'id':_0x33b33b[_0x474b('0x47')]['id']}},_0xc4e7a9={};_0xc4e7a9['model']=_[_0x474b('0x48')](db[_0x474b('0x31')][_0x474b('0x32')]);_0xc4e7a9[_0x474b('0x38')]=_[_0x474b('0x48')](_0x33b33b[_0x474b('0x38')]);_0xc4e7a9['filters']=_['intersection'](_0xc4e7a9[_0x474b('0x35')],_0xc4e7a9['query']);_0x1dd33f[_0x474b('0x39')]=_['intersection'](_0xc4e7a9[_0x474b('0x35')],qs[_0x474b('0x3a')](_0x33b33b[_0x474b('0x38')]['fields']));_0x1dd33f[_0x474b('0x39')]=_0x1dd33f['attributes'][_0x474b('0x3b')]?_0x1dd33f['attributes']:_0xc4e7a9[_0x474b('0x35')];if(_0x33b33b['query']['includeAll']){_0x1dd33f[_0x474b('0x49')]=[{'all':!![]}];}_0x1dd33f=_['merge']({},_0x1dd33f,_0x33b33b[_0x474b('0x4a')]);return db[_0x474b('0x31')]['find'](_0x1dd33f)['then'](handleEntityNotFound(_0x57323e,null))[_0x474b('0x2a')](respondWithResult(_0x57323e,null))[_0x474b('0x46')](handleError(_0x57323e,null));};exports[_0x474b('0x4b')]=function(_0x533ba3,_0x13cad8){return db[_0x474b('0x31')]['create'](_0x533ba3[_0x474b('0x4c')],{})[_0x474b('0x2a')](respondWithResult(_0x13cad8,0xc9))[_0x474b('0x46')](handleError(_0x13cad8,null));};exports[_0x474b('0x4d')]=function(_0x20d3a6,_0x500368){return db['CmHopperHistory']['describe']()[_0x474b('0x2a')](respondWithResult(_0x500368,null))[_0x474b('0x46')](handleError(_0x500368,null));};exports[_0x474b('0x29')]=function(_0x3013a0,_0x7b967e){if(_0x3013a0[_0x474b('0x4c')][_0x474b('0x4e')]){delete _0x3013a0[_0x474b('0x4c')][_0x474b('0x4e')];}return db[_0x474b('0x31')]['find']({'where':{'uniqueid':_0x3013a0[_0x474b('0x47')]['id']}})[_0x474b('0x2a')](handleEntityNotFound(_0x7b967e,null))[_0x474b('0x2a')](saveUpdates(_0x3013a0[_0x474b('0x4c')],null))[_0x474b('0x2a')](respondWithResult(_0x7b967e,null))[_0x474b('0x46')](handleError(_0x7b967e,null));};
\ No newline at end of file
index 22924c0..1e3d149 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0424=['define','CmHopperHistory','cm_hopper_history','uniqueid','../../config/logger','api','moment','bluebird','path','./cmHopperHistory.attributes','exports'];(function(_0x2bb612,_0xaedf28){var _0x4ef64c=function(_0x45bcff){while(--_0x45bcff){_0x2bb612['push'](_0x2bb612['shift']());}};_0x4ef64c(++_0xaedf28);}(_0x0424,0x159));var _0x4042=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x0424[_0x44b7d6];return _0x5346f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x4042('0xa'),'fields':[_0x4042('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x57ef=['path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9af573,_0x373b81){var _0x4276e5=function(_0x124797){while(--_0x124797){_0x9af573['push'](_0x9af573['shift']());}};_0x4276e5(++_0x373b81);}(_0x57ef,0xdb));var _0xf57e=function(_0x2435df,_0x461a0f){_0x2435df=_0x2435df-0x0;var _0x37eaee=_0x57ef[_0x2435df];return _0x37eaee;};'use strict';var _=require('lodash');var util=require(_0xf57e('0x0'));var logger=require(_0xf57e('0x1'))(_0xf57e('0x2'));var moment=require(_0xf57e('0x3'));var BPromise=require(_0xf57e('0x4'));var rp=require(_0xf57e('0x5'));var fs=require('fs');var path=require(_0xf57e('0x6'));var rimraf=require('rimraf');var config=require(_0xf57e('0x7'));var attributes=require(_0xf57e('0x8'));module[_0xf57e('0x9')]=function(_0xf9d112,_0x31d997){return _0xf9d112[_0xf57e('0xa')](_0xf57e('0xb'),attributes,{'tableName':_0xf57e('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xf57e('0xd')]},{'name':_0xf57e('0xe'),'fields':[_0xf57e('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index 34d964b..31f2f41 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x418f=['outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','stringify','findAll','raw','where','COUNT','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null'];(function(_0x38d6a3,_0x43990e){var _0x48237d=function(_0x21a5b7){while(--_0x21a5b7){_0x38d6a3['push'](_0x38d6a3['shift']());}};_0x48237d(++_0x43990e);}(_0x418f,0xdf));var _0xf418=function(_0x2d2a9b,_0x5870ff){_0x2d2a9b=_0x2d2a9b-0x0;var _0x3d2d49=_0x418f[_0x2d2a9b];return _0x3d2d49;};'use strict';var _=require(_0xf418('0x0'));var util=require(_0xf418('0x1'));var moment=require(_0xf418('0x2'));var BPromise=require(_0xf418('0x3'));var rs=require(_0xf418('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf418('0x5'))['db'];var utils=require(_0xf418('0x6'));var logger=require(_0xf418('0x7'))(_0xf418('0x8'));var config=require('../../config/environment');var jayson=require(_0xf418('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x599239,_0x504f3f,_0x17ca7c){return new BPromise(function(_0x402b3f,_0x31c594){return client[_0xf418('0xa')](_0x599239,_0x17ca7c)[_0xf418('0xb')](function(_0x523254){logger[_0xf418('0xc')](_0xf418('0xd'),_0x504f3f,_0xf418('0xe'));logger[_0xf418('0xf')](_0xf418('0x10'),_0x504f3f,_0xf418('0xe'),JSON['stringify'](_0x523254));if(_0x523254[_0xf418('0x11')]){if(_0x523254[_0xf418('0x11')]['code']===0x1f4){logger[_0xf418('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x504f3f,_0x523254[_0xf418('0x11')]['message']);return _0x31c594(_0x523254['error'][_0xf418('0x12')]);}logger[_0xf418('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x504f3f,_0x523254[_0xf418('0x11')][_0xf418('0x12')]);return _0x402b3f(_0x523254[_0xf418('0x11')][_0xf418('0x12')]);}else{logger[_0xf418('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x504f3f,_0xf418('0xe'));_0x402b3f(_0x523254[_0xf418('0x13')]['message']);}})[_0xf418('0x14')](function(_0x1d50f3){logger[_0xf418('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x504f3f,_0x1d50f3);_0x31c594(_0x1d50f3);});});}exports[_0xf418('0x15')]=function(_0x257abe){var _0x2fc993=this;return new Promise(function(_0x3a63e4,_0xecf533){return db[_0xf418('0x16')][_0xf418('0x17')](_0x257abe['body'],{'raw':_0x257abe[_0xf418('0x18')]?_0x257abe[_0xf418('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf418('0xb')](function(_0xb7c2ee){logger[_0xf418('0xc')](_0xf418('0x15'),_0x257abe);logger['debug']('CreateCmHopperHistory',_0x257abe,JSON[_0xf418('0x19')](_0xb7c2ee));_0x3a63e4(_0xb7c2ee);})['catch'](function(_0x450993){logger[_0xf418('0x11')]('CreateCmHopperHistory',_0x450993[_0xf418('0x12')],_0x257abe);_0xecf533(_0x2fc993[_0xf418('0x11')](0x1f4,_0x450993['message']));});});};exports['AvgHandleTime']=function(_0x318347){var _0x434a95=this;return new Promise(function(_0x37053c,_0x2dbcae){return db['CmHopperHistory'][_0xf418('0x1a')]({'raw':_0x318347[_0xf418('0x18')]?_0x318347['options'][_0xf418('0x1b')]===undefined?!![]:![]:!![],'where':_0x318347[_0xf418('0x18')]?_0x318347['options'][_0xf418('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf418('0x1d'),db['sequelize']['col']('id')),_0xf418('0x1e')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x21')))),_0xf418('0x22')],[db['sequelize']['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0xf418('0x23')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xf418('0x20')](_0xf418('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xf418('0x25'),db[_0xf418('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xf418('0x26')))),_0xf418('0x27')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x25'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x28')))),_0xf418('0x29')]]})[_0xf418('0xb')](function(_0x25e6d9){logger['info']('AvgHandleTime',_0x318347);logger[_0xf418('0xf')](_0xf418('0x2a'),_0x318347,JSON[_0xf418('0x19')](_0x25e6d9));_0x37053c(_0x25e6d9);})[_0xf418('0x14')](function(_0x196ed0){logger[_0xf418('0x11')](_0xf418('0x2a'),_0x196ed0['message'],_0x318347);_0x2dbcae(_0x434a95[_0xf418('0x11')](0x1f4,_0x196ed0[_0xf418('0x12')]));});});};exports[_0xf418('0x2b')]=function(_0x21f6bf){var _0x28edf2=this;return new Promise(function(_0x2ae7e5,_0x4bb120){return db['CmHopperHistory']['findAll']({'raw':_0x21f6bf[_0xf418('0x18')]?_0x21f6bf[_0xf418('0x18')][_0xf418('0x1b')]===undefined?!![]:![]:!![],'where':_0x21f6bf[_0xf418('0x18')]?_0x21f6bf[_0xf418('0x18')][_0xf418('0x1c')]||null:null,'attributes':[[_0xf418('0x2c'),'name'],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x2d')))),_0xf418('0x2e')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x21')))),_0xf418('0x2f')],[db[_0xf418('0x1f')]['fn']('COUNT',db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x30')))),_0xf418('0x31')],[db[_0xf418('0x1f')]['fn']('COUNT',db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')]['literal'](_0xf418('0x32')))),_0xf418('0x33')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x34')))),_0xf418('0x35')],[db['sequelize']['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf418('0x36')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0xf418('0x37')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')]['literal'](_0xf418('0x38')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')]['literal'](_0xf418('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')]['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x3a')))),_0xf418('0x3b')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')]['literal'](_0xf418('0x3c')))),_0xf418('0x3d')],[db['sequelize']['fn'](_0xf418('0x1d'),db['sequelize']['fn']('IF',db[_0xf418('0x1f')][_0xf418('0x20')](_0xf418('0x3e')))),'outboundReCallsDay']],'group':[_0xf418('0x2c')]})[_0xf418('0xb')](function(_0x4087c5){logger[_0xf418('0xc')](_0xf418('0x2b'),_0x21f6bf);logger[_0xf418('0xf')](_0xf418('0x2b'),_0x21f6bf,JSON[_0xf418('0x19')](_0x4087c5));_0x2ae7e5(_0x4087c5);})[_0xf418('0x14')](function(_0x10c540){logger[_0xf418('0x11')](_0xf418('0x2b'),_0x10c540[_0xf418('0x12')],_0x21f6bf);_0x4bb120(_0x28edf2[_0xf418('0x11')](0x1f4,_0x10c540[_0xf418('0x12')]));});});};exports[_0xf418('0x3f')]=function(_0xc7e64e){var _0x2ee4b3=this;return new Promise(function(_0x129074,_0x583505){return db[_0xf418('0x16')]['findAll']({'raw':_0xc7e64e[_0xf418('0x18')]?_0xc7e64e[_0xf418('0x18')][_0xf418('0x1b')]===undefined?!![]:![]:!![],'where':_0xc7e64e[_0xf418('0x18')]?_0xc7e64e[_0xf418('0x18')][_0xf418('0x1c')]||null:null,'attributes':[['campaign',_0xf418('0x40')],[db[_0xf418('0x1f')]['fn'](_0xf418('0x1d'),db[_0xf418('0x1f')][_0xf418('0x41')]('id')),_0xf418('0x42')],[db[_0xf418('0x1f')]['fn']('COUNT',db[_0xf418('0x1f')]['fn']('IF',db['sequelize'][_0xf418('0x20')](_0xf418('0x21')))),_0xf418('0x43')]],'group':[_0xf418('0x2c')]})[_0xf418('0xb')](function(_0x34857e){logger[_0xf418('0xc')]('GetCampaignHopperHistory',_0xc7e64e);logger['debug'](_0xf418('0x3f'),_0xc7e64e,JSON[_0xf418('0x19')](_0x34857e));_0x129074(_0x34857e);})[_0xf418('0x14')](function(_0x308836){logger['error'](_0xf418('0x3f'),_0x308836[_0xf418('0x12')],_0xc7e64e);_0x583505(_0x2ee4b3['error'](0x1f4,_0x308836[_0xf418('0x12')]));});});};
\ No newline at end of file
+var _0x867f=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','CreateCmHopperHistory','stringify','CmHopperHistory','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x49ec16,_0x5130aa){var _0x19dd9=function(_0x1b50b6){while(--_0x1b50b6){_0x49ec16['push'](_0x49ec16['shift']());}};_0x19dd9(++_0x5130aa);}(_0x867f,0xe6));var _0xf867=function(_0x4f3e33,_0x5704a8){_0x4f3e33=_0x4f3e33-0x0;var _0x1a070c=_0x867f[_0x4f3e33];return _0x1a070c;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var moment=require(_0xf867('0x2'));var BPromise=require(_0xf867('0x3'));var rs=require(_0xf867('0x4'));var fs=require('fs');var Redis=require(_0xf867('0x5'));var db=require(_0xf867('0x6'))['db'];var utils=require(_0xf867('0x7'));var logger=require(_0xf867('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf867('0x9'));var client=jayson[_0xf867('0xa')][_0xf867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2841d1,_0x3fe5d1,_0x5c35f9){return new BPromise(function(_0x583f87,_0x26cfba){return client['request'](_0x2841d1,_0x5c35f9)[_0xf867('0xc')](function(_0x2b1c12){logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));logger[_0xf867('0x10')](_0xf867('0x11'),_0x3fe5d1,_0xf867('0xf'),JSON['stringify'](_0x2b1c12));if(_0x2b1c12[_0xf867('0x12')]){if(_0x2b1c12['error']['code']===0x1f4){logger[_0xf867('0x12')](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12[_0xf867('0x12')]['message']);return _0x26cfba(_0x2b1c12['error'][_0xf867('0x13')]);}logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12['error']['message']);return _0x583f87(_0x2b1c12[_0xf867('0x12')][_0xf867('0x13')]);}else{logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));_0x583f87(_0x2b1c12[_0xf867('0x14')][_0xf867('0x13')]);}})[_0xf867('0x15')](function(_0x33c10b){logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x33c10b);_0x26cfba(_0x33c10b);});});}exports['CreateCmHopperHistory']=function(_0x39f9e8){var _0x47dfa7=this;return new Promise(function(_0x51bdb3,_0x1a5592){return db['CmHopperHistory']['create'](_0x39f9e8[_0xf867('0x16')],{'raw':_0x39f9e8[_0xf867('0x17')]?_0x39f9e8['options']['raw']===undefined?!![]:![]:!![]})[_0xf867('0xc')](function(_0x23e7dd){logger[_0xf867('0xd')](_0xf867('0x18'),_0x39f9e8);logger[_0xf867('0x10')](_0xf867('0x18'),_0x39f9e8,JSON[_0xf867('0x19')](_0x23e7dd));_0x51bdb3(_0x23e7dd);})[_0xf867('0x15')](function(_0x586a25){logger['error'](_0xf867('0x18'),_0x586a25['message'],_0x39f9e8);_0x1a5592(_0x47dfa7[_0xf867('0x12')](0x1f4,_0x586a25[_0xf867('0x13')]));});});};exports['AvgHandleTime']=function(_0x419b6f){var _0x169f15=this;return new Promise(function(_0x53dc5a,_0x231076){return db[_0xf867('0x1a')][_0xf867('0x1b')]({'raw':_0x419b6f[_0xf867('0x17')]?_0x419b6f[_0xf867('0x17')][_0xf867('0x1c')]===undefined?!![]:![]:!![],'where':_0x419b6f[_0xf867('0x17')]?_0x419b6f[_0xf867('0x17')][_0xf867('0x1d')]||null:null,'attributes':[[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')][_0xf867('0x20')]('id')),_0xf867('0x21')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db['sequelize']['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x23')))),_0xf867('0x24')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db['sequelize'][_0xf867('0x22')](_0xf867('0x25')))),_0xf867('0x26')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0xf867('0x27')],[db['sequelize']['fn'](_0xf867('0x28'),db['sequelize']['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0xf867('0x1e')]['fn'](_0xf867('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0xf867('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xf867('0x2a')]]})[_0xf867('0xc')](function(_0x419de3){logger[_0xf867('0xd')]('AvgHandleTime',_0x419b6f);logger['debug'](_0xf867('0x2b'),_0x419b6f,JSON[_0xf867('0x19')](_0x419de3));_0x53dc5a(_0x419de3);})[_0xf867('0x15')](function(_0x50fb7d){logger[_0xf867('0x12')](_0xf867('0x2b'),_0x50fb7d['message'],_0x419b6f);_0x231076(_0x169f15[_0xf867('0x12')](0x1f4,_0x50fb7d['message']));});});};exports[_0xf867('0x2c')]=function(_0x2c7aa4){var _0x326abf=this;return new Promise(function(_0x4c47ad,_0x17e99a){return db['CmHopperHistory'][_0xf867('0x1b')]({'raw':_0x2c7aa4[_0xf867('0x17')]?_0x2c7aa4[_0xf867('0x17')][_0xf867('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c7aa4[_0xf867('0x17')]?_0x2c7aa4[_0xf867('0x17')][_0xf867('0x1d')]||null:null,'attributes':[[_0xf867('0x2d'),'name'],[db['sequelize']['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x2e')))),_0xf867('0x2f')],[db[_0xf867('0x1e')]['fn']('COUNT',db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x30')))),_0xf867('0x31')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')]['literal'](_0xf867('0x23')))),'outboundAnswerCallsDay'],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db['sequelize'][_0xf867('0x22')](_0xf867('0x32')))),_0xf867('0x33')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db['sequelize'][_0xf867('0x22')](_0xf867('0x34')))),_0xf867('0x35')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db['sequelize']['fn']('IF',db[_0xf867('0x1e')]['literal'](_0xf867('0x36')))),_0xf867('0x37')],[db['sequelize']['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x38')))),_0xf867('0x39')],[db['sequelize']['fn'](_0xf867('0x1f'),db['sequelize']['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x3a')))),_0xf867('0x3b')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xf867('0x3c')))),_0xf867('0x3d')],[db[_0xf867('0x1e')]['fn']('COUNT',db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0xf867('0x3e')],[db['sequelize']['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')](_0xf867('0x3f')))),_0xf867('0x40')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xf867('0x22')](_0xf867('0x41')))),_0xf867('0x42')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')]['literal'](_0xf867('0x43')))),_0xf867('0x40')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db['sequelize']['fn']('IF',db[_0xf867('0x1e')][_0xf867('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})[_0xf867('0xc')](function(_0x347273){logger['info'](_0xf867('0x2c'),_0x2c7aa4);logger[_0xf867('0x10')]('GetVoiceQueueHopperHistory',_0x2c7aa4,JSON[_0xf867('0x19')](_0x347273));_0x4c47ad(_0x347273);})[_0xf867('0x15')](function(_0x59d460){logger[_0xf867('0x12')](_0xf867('0x2c'),_0x59d460[_0xf867('0x13')],_0x2c7aa4);_0x17e99a(_0x326abf[_0xf867('0x12')](0x1f4,_0x59d460[_0xf867('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x4c1180){var _0x2dfea0=this;return new Promise(function(_0x319779,_0x29ac26){return db[_0xf867('0x1a')][_0xf867('0x1b')]({'raw':_0x4c1180[_0xf867('0x17')]?_0x4c1180['options'][_0xf867('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c1180[_0xf867('0x17')]?_0x4c1180[_0xf867('0x17')][_0xf867('0x1d')]||null:null,'attributes':[[_0xf867('0x2d'),_0xf867('0x44')],[db[_0xf867('0x1e')]['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')][_0xf867('0x20')]('id')),_0xf867('0x45')],[db['sequelize']['fn'](_0xf867('0x1f'),db[_0xf867('0x1e')]['fn']('IF',db[_0xf867('0x1e')]['literal'](_0xf867('0x23')))),_0xf867('0x46')]],'group':[_0xf867('0x2d')]})[_0xf867('0xc')](function(_0x550622){logger['info'](_0xf867('0x47'),_0x4c1180);logger[_0xf867('0x10')](_0xf867('0x47'),_0x4c1180,JSON[_0xf867('0x19')](_0x550622));_0x319779(_0x550622);})['catch'](function(_0x2d9794){logger['error'](_0xf867('0x47'),_0x2d9794[_0xf867('0x13')],_0x4c1180);_0x29ac26(_0x2dfea0[_0xf867('0x12')](0x1f4,_0x2d9794['message']));});});};
\ No newline at end of file
index 9519153..624d76e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca79=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xca79,0x1b8));var _0x9ca7=function(_0x31d5b8,_0x55846c){_0x31d5b8=_0x31d5b8-0x0;var _0x30a1b7=_0xca79[_0x31d5b8];return _0x30a1b7;};'use strict';var multer=require(_0x9ca7('0x0'));var util=require(_0x9ca7('0x1'));var path=require(_0x9ca7('0x2'));var timeout=require(_0x9ca7('0x3'));var express=require(_0x9ca7('0x4'));var router=express[_0x9ca7('0x5')]();var fs_extra=require(_0x9ca7('0x6'));var auth=require(_0x9ca7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9ca7('0x8'));var controller=require(_0x9ca7('0x9'));router['get']('/',auth[_0x9ca7('0xa')](),controller[_0x9ca7('0xb')]);router[_0x9ca7('0xc')](_0x9ca7('0xd'),auth[_0x9ca7('0xa')](),controller[_0x9ca7('0xe')]);router[_0x9ca7('0xc')](_0x9ca7('0xf'),auth['isAuthenticated'](),controller[_0x9ca7('0x10')]);router[_0x9ca7('0x11')]('/',auth['isAuthenticated'](),controller[_0x9ca7('0x12')]);router[_0x9ca7('0x13')]('/:id',auth[_0x9ca7('0xa')](),controller[_0x9ca7('0x14')]);module[_0x9ca7('0x15')]=router;
\ No newline at end of file
+var _0x3b64=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/:id','post','create','put','exports','multer'];(function(_0x2f625f,_0x5367bd){var _0x533355=function(_0x58d280){while(--_0x58d280){_0x2f625f['push'](_0x2f625f['shift']());}};_0x533355(++_0x5367bd);}(_0x3b64,0x167));var _0x43b6=function(_0x11510a,_0x1223a1){_0x11510a=_0x11510a-0x0;var _0x4fff18=_0x3b64[_0x11510a];return _0x4fff18;};'use strict';var multer=require(_0x43b6('0x0'));var util=require(_0x43b6('0x1'));var path=require(_0x43b6('0x2'));var timeout=require(_0x43b6('0x3'));var express=require(_0x43b6('0x4'));var router=express[_0x43b6('0x5')]();var fs_extra=require(_0x43b6('0x6'));var auth=require(_0x43b6('0x7'));var interaction=require(_0x43b6('0x8'));var config=require(_0x43b6('0x9'));var controller=require(_0x43b6('0xa'));router[_0x43b6('0xb')]('/',auth[_0x43b6('0xc')](),controller['index']);router[_0x43b6('0xb')]('/describe',auth[_0x43b6('0xc')](),controller['describe']);router[_0x43b6('0xb')](_0x43b6('0xd'),auth[_0x43b6('0xc')](),controller['show']);router[_0x43b6('0xe')]('/',auth[_0x43b6('0xc')](),controller[_0x43b6('0xf')]);router[_0x43b6('0x10')](_0x43b6('0xd'),auth[_0x43b6('0xc')](),controller['update']);module[_0x43b6('0x11')]=router;
\ No newline at end of file
index f4c7188..c1b9e10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d55=['sequelize','exports','STRING','name'];(function(_0x5b387b,_0x2350ad){var _0x6908b9=function(_0x1b688f){while(--_0x1b688f){_0x5b387b['push'](_0x5b387b['shift']());}};_0x6908b9(++_0x2350ad);}(_0x7d55,0x1bc));var _0x57d5=function(_0xb10d46,_0x272d64){_0xb10d46=_0xb10d46-0x0;var _0x56eea2=_0x7d55[_0xb10d46];return _0x56eea2;};'use strict';var Sequelize=require(_0x57d5('0x0'));module[_0x57d5('0x1')]={'name':{'type':Sequelize[_0x57d5('0x2')],'unique':_0x57d5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x5eb8=['STRING','exports'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x455eed,_0x822290){_0x455eed=_0x455eed-0x0;var _0x31cb46=_0x5eb8[_0x455eed];return _0x31cb46;};'use strict';var Sequelize=require('sequelize');module[_0x85eb('0x0')]={'name':{'type':Sequelize[_0x85eb('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x85eb('0x1')]}};
\ No newline at end of file
index 5d96d7a..979724e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce65=['sequelize','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','Lists','error','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','getDispositions','Disposition','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','now','writeFileSync','format','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','findOne','addCustomFields','TEXT','Sequelize','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','nolimit','info'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xce65,0xa8));var _0x5ce6=function(_0x2a5d4d,_0x4489da){_0x2a5d4d=_0x2a5d4d-0x0;var _0x3e1687=_0xce65[_0x2a5d4d];return _0x3e1687;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ce6('0x0'));var zipdir=require(_0x5ce6('0x1'));var jsonpatch=require(_0x5ce6('0x2'));var rp=require(_0x5ce6('0x3'));var moment=require(_0x5ce6('0x4'));var BPromise=require(_0x5ce6('0x5'));var Mustache=require(_0x5ce6('0x6'));var util=require(_0x5ce6('0x7'));var path=require(_0x5ce6('0x8'));var sox=require('sox');var csv=require(_0x5ce6('0x9'));var ejs=require(_0x5ce6('0xa'));var fs=require('fs');var fs_extra=require(_0x5ce6('0xb'));var _=require(_0x5ce6('0xc'));var squel=require(_0x5ce6('0xd'));var crypto=require(_0x5ce6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5ce6('0xf'));var toCsv=require(_0x5ce6('0x9'));var querystring=require(_0x5ce6('0x10'));var Papa=require(_0x5ce6('0x11'));var Redis=require(_0x5ce6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5ce6('0x13'));var as=require(_0x5ce6('0x14'));var hardwareService=require(_0x5ce6('0x15'));var logger=require(_0x5ce6('0x16'))(_0x5ce6('0x17'));var utils=require(_0x5ce6('0x18'));var config=require(_0x5ce6('0x19'));var licenseUtil=require(_0x5ce6('0x1a'));var db=require(_0x5ce6('0x1b'))['db'];var csv_results;config['redis']=_[_0x5ce6('0x1c')](config[_0x5ce6('0x1d')],{'host':_0x5ce6('0x1e'),'port':0x18eb});var socket=require(_0x5ce6('0x1f'))(new Redis(config['redis']));require(_0x5ce6('0x20'))[_0x5ce6('0x21')](socket);function respondWithStatusCode(_0x1f2043,_0x2a9be5){_0x2a9be5=_0x2a9be5||0xcc;return function(_0xf1f58d){if(_0xf1f58d){return _0x1f2043[_0x5ce6('0x22')](_0x2a9be5);}return _0x1f2043[_0x5ce6('0x23')](_0x2a9be5)[_0x5ce6('0x24')]();};}function respondWithResult(_0x1b93cd,_0x3bf14c){_0x3bf14c=_0x3bf14c||0xc8;return function(_0x353fc1){if(_0x353fc1){return _0x1b93cd['status'](_0x3bf14c)[_0x5ce6('0x25')](_0x353fc1);}};}function respondWithFilteredResult(_0x4e12aa,_0x582afa){return function(_0x2f03d3){if(_0x2f03d3){var _0xad842e=typeof _0x582afa[_0x5ce6('0x26')]===_0x5ce6('0x27')&&typeof _0x582afa['limit']===_0x5ce6('0x27');var _0xae403d=_0x2f03d3[_0x5ce6('0x28')];var _0x1ca363=_0xad842e?0x0:_0x582afa[_0x5ce6('0x26')];var _0x1c4d5b=_0xad842e?_0x2f03d3['count']:_0x582afa[_0x5ce6('0x26')]+_0x582afa[_0x5ce6('0x29')];var _0x3516bd;if(_0x1c4d5b>=_0xae403d){_0x1c4d5b=_0xae403d;_0x3516bd=0xc8;}else{_0x3516bd=0xce;}_0x4e12aa[_0x5ce6('0x23')](_0x3516bd);return _0x4e12aa['set'](_0x5ce6('0x2a'),_0x1ca363+'-'+_0x1c4d5b+'/'+_0xae403d)[_0x5ce6('0x25')](_0x2f03d3);}return null;};}function patchUpdates(_0x5d6854){return function(_0x3819fc){try{jsonpatch[_0x5ce6('0x2b')](_0x3819fc,_0x5d6854,!![]);}catch(_0x1b4417){return BPromise['reject'](_0x1b4417);}return _0x3819fc[_0x5ce6('0x2c')]();};}function saveUpdates(_0x521ced,_0x283fbe){return function(_0x291095){if(_0x291095){return _0x291095[_0x5ce6('0x2d')](_0x521ced)[_0x5ce6('0x2e')](function(_0x3a1ac8){return _0x3a1ac8;});}return null;};}function removeEntity(_0x5bdd6f,_0x10b953){return function(_0x11e346){if(_0x11e346){return _0x11e346[_0x5ce6('0x2f')]()[_0x5ce6('0x2e')](function(){var _0xb8bc2c=_0x11e346[_0x5ce6('0x30')]({'plain':!![]});var _0x3ed08f=_0x5ce6('0x31');return db['UserProfileResource'][_0x5ce6('0x2f')]({'where':{'type':_0x3ed08f,'resourceId':_0xb8bc2c['id']}})[_0x5ce6('0x2e')](function(){return _0x11e346;});})[_0x5ce6('0x2e')](function(){_0x5bdd6f[_0x5ce6('0x23')](0xcc)[_0x5ce6('0x24')]();});}};}function handleEntityNotFound(_0x4d2e21,_0x40d7ef){return function(_0x13d11a){if(!_0x13d11a){_0x4d2e21[_0x5ce6('0x22')](0x194);}return _0x13d11a;};}function handleError(_0x2ac8d9,_0x19728c){_0x19728c=_0x19728c||0x1f4;return function(_0x130e37){logger[_0x5ce6('0x32')](_0x130e37['stack']);if(_0x130e37['name']){delete _0x130e37[_0x5ce6('0x33')];}_0x2ac8d9[_0x5ce6('0x23')](_0x19728c)[_0x5ce6('0x34')](_0x130e37);};}exports[_0x5ce6('0x35')]=function(_0x1e0a7f,_0x47d8f7){var _0x1494d3={},_0x76fd48={},_0xef343f={'count':0x0,'rows':[]};var _0x5b88b5=_[_0x5ce6('0x36')](db[_0x5ce6('0x37')][_0x5ce6('0x38')],function(_0x55c8fb){return{'name':_0x55c8fb[_0x5ce6('0x39')],'type':_0x55c8fb[_0x5ce6('0x3a')]['key']};});_0x76fd48[_0x5ce6('0x3b')]=_['map'](_0x5b88b5,_0x5ce6('0x33'));_0x76fd48[_0x5ce6('0x3c')]=_['keys'](_0x1e0a7f['query']);_0x76fd48[_0x5ce6('0x3d')]=_['intersection'](_0x76fd48['model'],_0x76fd48[_0x5ce6('0x3c')]);_0x1494d3[_0x5ce6('0x3e')]=_[_0x5ce6('0x3f')](_0x76fd48[_0x5ce6('0x3b')],qs[_0x5ce6('0x40')](_0x1e0a7f[_0x5ce6('0x3c')][_0x5ce6('0x40')]));_0x1494d3[_0x5ce6('0x3e')]=_0x1494d3[_0x5ce6('0x3e')][_0x5ce6('0x41')]?_0x1494d3[_0x5ce6('0x3e')]:_0x76fd48['model'];if(!_0x1e0a7f[_0x5ce6('0x3c')][_0x5ce6('0x42')]('nolimit')){_0x1494d3['limit']=qs[_0x5ce6('0x29')](_0x1e0a7f[_0x5ce6('0x3c')][_0x5ce6('0x29')]);_0x1494d3[_0x5ce6('0x26')]=qs[_0x5ce6('0x26')](_0x1e0a7f['query'][_0x5ce6('0x26')]);}_0x1494d3['order']=qs[_0x5ce6('0x43')](_0x1e0a7f['query'][_0x5ce6('0x43')]);_0x1494d3[_0x5ce6('0x44')]=qs[_0x5ce6('0x3d')](_[_0x5ce6('0x45')](_0x1e0a7f['query'],_0x76fd48['filters']),_0x5b88b5);if(_0x1e0a7f[_0x5ce6('0x3c')][_0x5ce6('0x46')]){_0x1494d3[_0x5ce6('0x44')]=_[_0x5ce6('0x47')](_0x1494d3[_0x5ce6('0x44')],{'$or':_[_0x5ce6('0x36')](_0x5b88b5,function(_0x521b68){if(_0x521b68[_0x5ce6('0x3a')]!==_0x5ce6('0x48')){var _0xd10038={};_0xd10038[_0x521b68[_0x5ce6('0x33')]]={'$like':'%'+_0x1e0a7f['query'][_0x5ce6('0x46')]+'%'};return _0xd10038;}})});}_0x1494d3=_[_0x5ce6('0x47')]({},_0x1494d3,_0x1e0a7f[_0x5ce6('0x49')]);var _0x4bcfa6={'where':_0x1494d3[_0x5ce6('0x44')]};return db[_0x5ce6('0x37')][_0x5ce6('0x28')](_0x4bcfa6)[_0x5ce6('0x2e')](function(_0x26837d){_0xef343f[_0x5ce6('0x28')]=_0x26837d;if(_0x1e0a7f[_0x5ce6('0x3c')]['includeAll']){_0x1494d3[_0x5ce6('0x4a')]=[{'all':!![]}];}return db[_0x5ce6('0x37')][_0x5ce6('0x4b')](_0x1494d3);})[_0x5ce6('0x2e')](function(_0x4784e1){_0xef343f[_0x5ce6('0x4c')]=_0x4784e1;return _0xef343f;})['then'](respondWithFilteredResult(_0x47d8f7,_0x1494d3))[_0x5ce6('0x4d')](handleError(_0x47d8f7,null));};exports['show']=function(_0x434fdf,_0x263bb4){var _0x2fab64={'raw':![],'where':{'id':_0x434fdf[_0x5ce6('0x4e')]['id']}},_0x299b4a={};_0x299b4a[_0x5ce6('0x3b')]=_[_0x5ce6('0x4f')](db[_0x5ce6('0x37')][_0x5ce6('0x38')]);_0x299b4a[_0x5ce6('0x3c')]=_[_0x5ce6('0x4f')](_0x434fdf[_0x5ce6('0x3c')]);_0x299b4a['filters']=_[_0x5ce6('0x3f')](_0x299b4a['model'],_0x299b4a[_0x5ce6('0x3c')]);_0x2fab64[_0x5ce6('0x3e')]=_[_0x5ce6('0x3f')](_0x299b4a[_0x5ce6('0x3b')],qs[_0x5ce6('0x40')](_0x434fdf[_0x5ce6('0x3c')][_0x5ce6('0x40')]));_0x2fab64[_0x5ce6('0x3e')]=_0x2fab64[_0x5ce6('0x3e')]['length']?_0x2fab64[_0x5ce6('0x3e')]:_0x299b4a[_0x5ce6('0x3b')];if(_0x434fdf[_0x5ce6('0x3c')][_0x5ce6('0x50')]){_0x2fab64['include']=[{'all':!![]}];}_0x2fab64=_[_0x5ce6('0x47')]({},_0x2fab64,_0x434fdf[_0x5ce6('0x49')]);return db[_0x5ce6('0x37')][_0x5ce6('0x51')](_0x2fab64)[_0x5ce6('0x2e')](handleEntityNotFound(_0x263bb4,null))[_0x5ce6('0x2e')](respondWithResult(_0x263bb4,null))[_0x5ce6('0x4d')](handleError(_0x263bb4,null));};exports['create']=function(_0x13b552,_0x212519){return db[_0x5ce6('0x37')][_0x5ce6('0x52')](_0x13b552['body'],{})[_0x5ce6('0x2e')](function(_0x8d3a1f){var _0x3e8cc7=_0x13b552[_0x5ce6('0x53')]['get']({'plain':!![]});if(!_0x3e8cc7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8cc7['role']===_0x5ce6('0x53')){var _0x2753ab=_0x8d3a1f[_0x5ce6('0x30')]({'plain':!![]});var _0x3570b5='Lists';return db[_0x5ce6('0x54')][_0x5ce6('0x51')]({'where':{'name':_0x3570b5,'userProfileId':_0x3e8cc7['userProfileId']},'raw':!![]})[_0x5ce6('0x2e')](function(_0x4e5fe4){if(_0x4e5fe4&&_0x4e5fe4[_0x5ce6('0x55')]===0x0){return db['UserProfileResource'][_0x5ce6('0x52')]({'name':_0x2753ab[_0x5ce6('0x33')],'resourceId':_0x2753ab['id'],'type':_0x4e5fe4[_0x5ce6('0x33')],'sectionId':_0x4e5fe4['id']},{})['then'](function(){return _0x8d3a1f;});}else{return _0x8d3a1f;}})[_0x5ce6('0x4d')](function(_0x32aaa0){logger['error'](_0x5ce6('0x56'),_0x32aaa0);throw _0x32aaa0;});}return _0x8d3a1f;})[_0x5ce6('0x2e')](respondWithResult(_0x212519,0xc9))[_0x5ce6('0x4d')](handleError(_0x212519,null));};exports[_0x5ce6('0x2d')]=function(_0x91eaee,_0x3ef31e){if(_0x91eaee['body']['id']){delete _0x91eaee[_0x5ce6('0x57')]['id'];}return db[_0x5ce6('0x37')][_0x5ce6('0x51')]({'where':{'id':_0x91eaee[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x3ef31e,null))[_0x5ce6('0x2e')](saveUpdates(_0x91eaee['body'],null))['then'](respondWithResult(_0x3ef31e,null))[_0x5ce6('0x4d')](handleError(_0x3ef31e,null));};exports[_0x5ce6('0x2f')]=function(_0x5815f6,_0x19e063){return db['CmList']['find']({'where':{'id':_0x5815f6[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x19e063,null))[_0x5ce6('0x2e')](removeEntity(_0x19e063,null))[_0x5ce6('0x4d')](handleError(_0x19e063,null));};exports[_0x5ce6('0x58')]=function(_0x2dbae3,_0x53d223){return db[_0x5ce6('0x37')][_0x5ce6('0x58')]()[_0x5ce6('0x2e')](respondWithResult(_0x53d223,null))[_0x5ce6('0x4d')](handleError(_0x53d223,null));};exports[_0x5ce6('0x59')]=function(_0x14fe52,_0x3e3557,_0x2f979e){if(_0x14fe52[_0x5ce6('0x57')]['id']){delete _0x14fe52[_0x5ce6('0x57')]['id'];}return db[_0x5ce6('0x37')][_0x5ce6('0x51')]({'where':{'id':_0x14fe52[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x3e3557,null))[_0x5ce6('0x2e')](function(_0x421130){if(_0x421130){_0x14fe52[_0x5ce6('0x57')][_0x5ce6('0x5a')]=_0x421130['id'];return db['Disposition']['create'](_0x14fe52['body']);}})[_0x5ce6('0x2e')](respondWithResult(_0x3e3557,null))[_0x5ce6('0x4d')](handleError(_0x3e3557,null));};exports[_0x5ce6('0x5b')]=function(_0x3e7cf1,_0x1f950b,_0x34c948){var _0x30f9d5={'raw':![],'where':{}};var _0x3f6a04={};var _0x50eafb={'count':0x0,'rows':[]};return db[_0x5ce6('0x37')]['findOne']({'where':{'id':_0x3e7cf1['params']['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x1f950b,null))[_0x5ce6('0x2e')](function(_0x41c2d5){if(_0x41c2d5){_0x3f6a04[_0x5ce6('0x3b')]=_[_0x5ce6('0x4f')](db[_0x5ce6('0x5c')]['rawAttributes']);_0x3f6a04[_0x5ce6('0x3c')]=_[_0x5ce6('0x4f')](_0x3e7cf1[_0x5ce6('0x3c')]);_0x3f6a04[_0x5ce6('0x3d')]=_[_0x5ce6('0x3f')](_0x3f6a04[_0x5ce6('0x3b')],_0x3f6a04['query']);_0x30f9d5[_0x5ce6('0x3e')]=_[_0x5ce6('0x3f')](_0x3f6a04['model'],qs['fields'](_0x3e7cf1[_0x5ce6('0x3c')]['fields']));_0x30f9d5[_0x5ce6('0x3e')]=_0x30f9d5['attributes'][_0x5ce6('0x41')]?_0x30f9d5[_0x5ce6('0x3e')]:_0x3f6a04[_0x5ce6('0x3b')];if(!_0x3e7cf1[_0x5ce6('0x3c')][_0x5ce6('0x42')]('nolimit')){_0x30f9d5[_0x5ce6('0x29')]=qs['limit'](_0x3e7cf1[_0x5ce6('0x3c')][_0x5ce6('0x29')]);_0x30f9d5[_0x5ce6('0x26')]=qs[_0x5ce6('0x26')](_0x3e7cf1[_0x5ce6('0x3c')][_0x5ce6('0x26')]);}_0x30f9d5[_0x5ce6('0x5d')]=qs[_0x5ce6('0x43')](_0x3e7cf1['query'][_0x5ce6('0x43')]);_0x30f9d5[_0x5ce6('0x44')]=qs['filters'](_[_0x5ce6('0x45')](_0x3e7cf1['query'],_0x3f6a04[_0x5ce6('0x3d')]));_0x30f9d5[_0x5ce6('0x44')][_0x5ce6('0x5a')]=_0x41c2d5['id'];if(_0x3e7cf1['query'][_0x5ce6('0x46')]){_0x30f9d5['where']=_[_0x5ce6('0x47')](_0x30f9d5[_0x5ce6('0x44')],{'$or':_[_0x5ce6('0x36')](_0x30f9d5['attributes'],function(_0x43e51){var _0x18a18b={};_0x18a18b[_0x43e51]={'$like':'%'+_0x3e7cf1[_0x5ce6('0x3c')]['filter']+'%'};return _0x18a18b;})});}_0x30f9d5=_[_0x5ce6('0x47')]({},_0x30f9d5,_0x3e7cf1[_0x5ce6('0x49')]);return db[_0x5ce6('0x5c')][_0x5ce6('0x28')]({'where':_0x30f9d5['where']})[_0x5ce6('0x2e')](function(_0x59ec13){_0x50eafb[_0x5ce6('0x28')]=_0x59ec13;if(_0x3e7cf1[_0x5ce6('0x3c')][_0x5ce6('0x50')]){_0x30f9d5[_0x5ce6('0x4a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x30f9d5);})['then'](function(_0x4a3305){_0x50eafb[_0x5ce6('0x4c')]=_0x4a3305;return _0x50eafb;});}})['then'](respondWithFilteredResult(_0x1f950b,_0x30f9d5))['catch'](handleError(_0x1f950b,null));};exports[_0x5ce6('0x5e')]=function(_0xc8098b,_0x12556f,_0x11ae7b){return db['CmList'][_0x5ce6('0x51')]({'where':{'id':_0xc8098b[_0x5ce6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x12556f,null))[_0x5ce6('0x2e')](function(_0x5f1d7a){if(_0x5f1d7a){return _0x5f1d7a['removeDispositions'](_0xc8098b[_0x5ce6('0x3c')][_0x5ce6('0x5f')]);}})[_0x5ce6('0x2e')](respondWithStatusCode(_0x12556f,null))[_0x5ce6('0x4d')](handleError(_0x12556f,null));};exports[_0x5ce6('0x60')]=function(_0x481afa,_0x293385,_0x3113f7){return db['CmList']['find']({'where':{'id':_0x481afa[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x293385,null))[_0x5ce6('0x2e')](function(_0x1dd47d){if(_0x1dd47d){var _0x369dda=[];var _0x177c9d={'success':[],'errors':[]};return db[_0x5ce6('0x61')][_0x5ce6('0x58')]()['then'](function(_0x31e23a){if(_0x481afa[_0x5ce6('0x57')][_0x5ce6('0x62')]&&_['isArray'](_0x481afa[_0x5ce6('0x57')]['tags'])){if(_0x481afa[_0x5ce6('0x57')]['tags']['length']){_0x481afa['body'][_0x5ce6('0x62')]=_0x481afa[_0x5ce6('0x57')][_0x5ce6('0x62')]['join'](';')+';';}else{_0x481afa[_0x5ce6('0x57')][_0x5ce6('0x62')]=null;}}else{_0x481afa[_0x5ce6('0x57')][_0x5ce6('0x62')]=null;}if(_0x481afa[_0x5ce6('0x57')]&&_[_0x5ce6('0x63')](_0x481afa[_0x5ce6('0x57')])){for(var _0x238f5e=0x0;_0x238f5e<_0x481afa[_0x5ce6('0x57')][_0x5ce6('0x41')];_0x238f5e+=0x1){_0x481afa['body'][_0x238f5e][_0x5ce6('0x5a')]=_0x481afa['params']['id'];_0x369dda[_0x5ce6('0x64')](_0x481afa[_0x5ce6('0x57')][_0x238f5e]);}return BPromise[_0x5ce6('0x65')](_0x369dda,function(_0xabac00){return db[_0x5ce6('0x61')][_0x5ce6('0x52')](_['omit'](_0xabac00,['ids','id'])||{},{'fields':_[_0x5ce6('0x4f')](_0x31e23a),'raw':!![]})[_0x5ce6('0x2e')](function(_0x7df11a){_0x177c9d['success'][_0x5ce6('0x64')](_0x7df11a[_0x5ce6('0x66')]);})['catch'](function(_0x3ef025){_0x177c9d[_0x5ce6('0x67')][_0x5ce6('0x64')]({'data':_0xabac00,'error':_0x3ef025[_0x5ce6('0x68')]});});})[_0x5ce6('0x2e')](function(_0x6dafaa){return _0x177c9d;})[_0x5ce6('0x4d')](function(_0x29a6ce){return _0x29a6ce;});}else{_0x293385['status'](0x190)[_0x5ce6('0x25')]({'message':_0x5ce6('0x69')});}});}})['then'](respondWithResult(_0x293385,null))[_0x5ce6('0x4d')](handleError(_0x293385,null));};exports['getContacts']=function(_0x25b90d,_0x128476,_0x49f42e){var _0x39d770;return db[_0x5ce6('0x37')][_0x5ce6('0x51')]({'where':{'id':_0x25b90d[_0x5ce6('0x4e')]['id']},'include':[{'model':db[_0x5ce6('0x6a')],'as':_0x5ce6('0x6b')}]})[_0x5ce6('0x2e')](handleEntityNotFound(_0x128476,null))[_0x5ce6('0x2e')](function(_0x5c9ac9){if(_0x5c9ac9){_0x39d770=_0x5c9ac9;return db[_0x5ce6('0x61')][_0x5ce6('0x38')];}})['then'](function(_0x52949b){if(_0x52949b){var _0x17ed09={};var _0x5d1ff1={};_0x5d1ff1[_0x5ce6('0x3b')]=_[_0x5ce6('0x6c')](_[_0x5ce6('0x4f')](_0x52949b),_['map'](_0x39d770[_0x5ce6('0x6b')],function(_0x547e4a){return util['format'](_0x5ce6('0x6d'),_0x547e4a['id']);}));_0x5d1ff1[_0x5ce6('0x3c')]=_[_0x5ce6('0x4f')](_0x25b90d[_0x5ce6('0x3c')]);_0x5d1ff1[_0x5ce6('0x3d')]=_[_0x5ce6('0x3f')](_0x5d1ff1[_0x5ce6('0x3b')],_0x5d1ff1[_0x5ce6('0x3c')]);_0x17ed09[_0x5ce6('0x3e')]=_[_0x5ce6('0x3f')](_0x5d1ff1[_0x5ce6('0x3b')],qs[_0x5ce6('0x40')](_0x25b90d[_0x5ce6('0x3c')]['fields']));_0x17ed09['attributes']=_0x17ed09['attributes']['length']?_0x17ed09[_0x5ce6('0x3e')]:_0x5d1ff1[_0x5ce6('0x3b')];if(!_0x25b90d[_0x5ce6('0x3c')]['hasOwnProperty']('nolimit')){_0x17ed09[_0x5ce6('0x29')]=qs[_0x5ce6('0x29')](_0x25b90d[_0x5ce6('0x3c')]['limit']);_0x17ed09[_0x5ce6('0x26')]=qs[_0x5ce6('0x26')](_0x25b90d[_0x5ce6('0x3c')][_0x5ce6('0x26')]);}_0x17ed09['order']=qs[_0x5ce6('0x43')](_0x25b90d[_0x5ce6('0x3c')]['sort']);_0x17ed09[_0x5ce6('0x44')]=qs[_0x5ce6('0x3d')](_[_0x5ce6('0x45')](_0x25b90d['query'],_0x5d1ff1[_0x5ce6('0x3d')]));_0x17ed09[_0x5ce6('0x6e')]=!![];if(_0x25b90d[_0x5ce6('0x3c')][_0x5ce6('0x46')]){_0x17ed09['where']=_[_0x5ce6('0x47')](_0x17ed09[_0x5ce6('0x44')],{'$or':_[_0x5ce6('0x36')](_0x17ed09['attributes'],function(_0xea637a){var _0x5dc351={};_0x5dc351[_0xea637a]={'$like':'%'+_0x25b90d[_0x5ce6('0x3c')][_0x5ce6('0x46')]+'%'};return _0x5dc351;})});}_0x17ed09=_[_0x5ce6('0x47')]({},_0x17ed09,_0x25b90d[_0x5ce6('0x49')]);return _0x39d770[_0x5ce6('0x6f')](_0x17ed09);}})[_0x5ce6('0x2e')](respondWithResult(_0x128476,null))[_0x5ce6('0x4d')](handleError(_0x128476,null));};exports[_0x5ce6('0x70')]=function(_0x2ba23a,_0x15042b,_0x4d6987){var _0x1b975f;var _0x1a6cbe;var _0x567a7a;var _0x5b5d22=_0x2ba23a[_0x5ce6('0x4e')]['id'];csv_results=[];return db[_0x5ce6('0x71')][_0x5ce6('0x4b')]({'attributes':['id','name'],'raw':!![],'order':[_0x5ce6('0x72')]})[_0x5ce6('0x2e')](function(_0x222b10){_0x1b975f=_0x222b10;var _0x11a6c3=_[_0x5ce6('0x4f')](db[_0x5ce6('0x61')][_0x5ce6('0x38')]);return db[_0x5ce6('0x6a')][_0x5ce6('0x4b')]({'raw':!![],'attributes':['id',_0x5ce6('0x73')]})[_0x5ce6('0x2e')](function(_0x43779c){_0x1a6cbe=_0x43779c;var _0x27121d=squel['select']()['fields'](_0x11a6c3)['from']('cm_contacts','c')[_0x5ce6('0x44')](_0x5ce6('0x74'),_0x5b5d22)['where'](_0x5ce6('0x75'))[_0x5ce6('0x76')]();for(var _0x185f48=0x0;_0x185f48<_0x1a6cbe['length'];_0x185f48++){_0x27121d[_0x5ce6('0x77')](_0x5ce6('0x78')+_0x1a6cbe[_0x185f48]['id'],_0x5ce6('0x79')+_0x1a6cbe[_0x185f48][_0x5ce6('0x73')]);}for(var _0x185f48=0x0;_0x185f48<_0x1b975f[_0x5ce6('0x41')];_0x185f48++){_0x27121d[_0x5ce6('0x77')](squel[_0x5ce6('0x7a')]()['field'](_0x5ce6('0x7b'))[_0x5ce6('0x7c')]('cm_contact_has_items')[_0x5ce6('0x44')](_0x5ce6('0x7d'),_0x1b975f[_0x185f48]['id'])['where'](_0x5ce6('0x7e')),_0x5ce6('0x7f')+_0x1b975f[_0x185f48][_0x5ce6('0x33')]);_0x27121d[_0x5ce6('0x77')](squel['select']()[_0x5ce6('0x77')](_0x5ce6('0x80'))[_0x5ce6('0x7c')](_0x5ce6('0x81'))['where'](_0x5ce6('0x7d'),_0x1b975f[_0x185f48]['id'])[_0x5ce6('0x44')](_0x5ce6('0x7e')),_0x5ce6('0x82')+_0x1b975f[_0x185f48][_0x5ce6('0x33')]);}var _0x59ad50=[];_0x59ad50['push'](_0x27121d[_0x5ce6('0x83')]());BPromise[_0x5ce6('0x65')](_0x59ad50,handleQuery)[_0x5ce6('0x2e')](function(_0x320c92){handleQuery(_0x27121d['toString']());var _0x51a591=csv_results[0x0];if(!_['isEmpty'](_0x51a591)){var _0x3bd686=toCsv(_0x51a591);var _0x340830=Date[_0x5ce6('0x84')]();fs[_0x5ce6('0x85')](util[_0x5ce6('0x86')]('/tmp/list_%d_%s.csv',_0x5b5d22,_0x340830),_0x3bd686);_0x15042b[_0x5ce6('0x87')]('Content-disposition',_0x5ce6('0x88')+util[_0x5ce6('0x86')](_0x5ce6('0x89'),_0x5b5d22,_0x340830));_0x15042b[_0x5ce6('0x87')](_0x5ce6('0x8a'),_0x5ce6('0x8b'));return _0x15042b['download'](util['format'](_0x5ce6('0x8c'),_0x5b5d22,_0x340830));}else{return _0x15042b[_0x5ce6('0x22')](0xcc);}});});});};exports[_0x5ce6('0x8d')]=function(_0x2a345b,_0x5d5ee9,_0x550ada){var _0x4415c3;delete _0x2a345b[_0x5ce6('0x57')]['id'];return db['CmList'][_0x5ce6('0x8e')]({'where':{'id':_0x2a345b[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x5d5ee9,null))[_0x5ce6('0x2e')](function(_0x2e6312){if(_0x2e6312){return db['sequelize']['transaction'](function(_0x19c537){return db[_0x5ce6('0x6a')][_0x5ce6('0x52')](_0x2a345b['body'],{'transaction':_0x19c537})[_0x5ce6('0x2e')](function(_0x4c005d){_0x4415c3=_0x4c005d;return _0x2e6312[_0x5ce6('0x8f')](_0x4c005d,{'transaction':_0x19c537});})[_0x5ce6('0x2e')](function(){var _0x29e764={'type':db['Sequelize'][_0x5ce6('0x90')],'transaction':_0x19c537};switch(_0x2a345b[_0x5ce6('0x57')][_0x5ce6('0x3a')]){case'text':_0x29e764['type']=db[_0x5ce6('0x91')]['TEXT'];break;case _0x5ce6('0x92'):_0x29e764[_0x5ce6('0x3a')]=db[_0x5ce6('0x91')][_0x5ce6('0x93')];break;case'switch':_0x29e764[_0x5ce6('0x3a')]=db[_0x5ce6('0x91')]['BOOLEAN'];_0x29e764[_0x5ce6('0x94')]=![];break;default:}return db['sequelize'][_0x5ce6('0x95')][_0x5ce6('0x96')](_0x5ce6('0x97'),util['format'](_0x5ce6('0x98'),_0x4415c3['id']),_0x29e764);})['then'](function(){return _0x4415c3;});});}})['then'](respondWithResult(_0x5d5ee9,null))['catch'](handleError(_0x5d5ee9,null));};exports[_0x5ce6('0x99')]=function(_0x5a8fdd,_0x489712,_0x280931){var _0x2a446e={};var _0x31a35d={};var _0x57ef05;var _0x20132a;return db[_0x5ce6('0x37')][_0x5ce6('0x8e')]({'where':{'id':_0x5a8fdd[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x489712,null))[_0x5ce6('0x2e')](function(_0x387140){if(_0x387140){_0x57ef05=_0x387140;_0x31a35d['model']=_[_0x5ce6('0x4f')](db[_0x5ce6('0x6a')]['rawAttributes']);_0x31a35d[_0x5ce6('0x3c')]=_[_0x5ce6('0x4f')](_0x5a8fdd[_0x5ce6('0x3c')]);_0x31a35d[_0x5ce6('0x3d')]=_['intersection'](_0x31a35d[_0x5ce6('0x3b')],_0x31a35d['query']);_0x2a446e[_0x5ce6('0x3e')]=_[_0x5ce6('0x3f')](_0x31a35d[_0x5ce6('0x3b')],qs[_0x5ce6('0x40')](_0x5a8fdd[_0x5ce6('0x3c')][_0x5ce6('0x40')]));_0x2a446e[_0x5ce6('0x3e')]=_0x2a446e['attributes'][_0x5ce6('0x41')]?_0x2a446e[_0x5ce6('0x3e')]:_0x31a35d[_0x5ce6('0x3b')];_0x2a446e[_0x5ce6('0x5d')]=qs[_0x5ce6('0x43')](_0x5a8fdd[_0x5ce6('0x3c')][_0x5ce6('0x43')]);_0x2a446e['where']=qs[_0x5ce6('0x3d')](_[_0x5ce6('0x45')](_0x5a8fdd['query'],_0x31a35d[_0x5ce6('0x3d')]));_0x2a446e['where']=_[_0x5ce6('0x47')](_0x2a446e['where'],{'$or':[{'ListId':_0x387140['id']},{'ListId':null}]});if(_0x5a8fdd['query']['filter']){_0x2a446e[_0x5ce6('0x44')]=_[_0x5ce6('0x47')](_0x2a446e[_0x5ce6('0x44')],{'$or':_[_0x5ce6('0x36')](_0x2a446e[_0x5ce6('0x3e')],function(_0x13b8c3){var _0x127114={};_0x127114[_0x13b8c3]={'$like':'%'+_0x5a8fdd['query'][_0x5ce6('0x46')]+'%'};return _0x127114;})});}_0x2a446e=_[_0x5ce6('0x47')]({},_0x2a446e,_0x5a8fdd[_0x5ce6('0x49')]);return db[_0x5ce6('0x6a')]['findAndCountAll'](_0x2a446e);}})[_0x5ce6('0x2e')](respondWithResult(_0x489712,null))[_0x5ce6('0x4d')](handleError(_0x489712,null));};exports[_0x5ce6('0x9a')]=function(_0x417ad1,_0x8fae22){return db[_0x5ce6('0x6a')][_0x5ce6('0x9b')]({'where':{'ListId':null}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x8fae22,null))['then'](function(_0xc257f0){return _0xc257f0;})[_0x5ce6('0x2e')](respondWithResult(_0x8fae22,null))[_0x5ce6('0x4d')](handleError(_0x8fae22,null));};exports[_0x5ce6('0x9c')]=function(_0x27083b,_0x4f3da0,_0xef484d){return db[_0x5ce6('0x37')]['find']({'where':{'id':_0x27083b[_0x5ce6('0x4e')]['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x4f3da0,null))[_0x5ce6('0x2e')](function(_0x3aeb34){if(_0x3aeb34){return _0x3aeb34[_0x5ce6('0x9c')](_0x27083b['body']['ids'],_['omit'](_0x27083b[_0x5ce6('0x57')],[_0x5ce6('0x5f'),'id'])||{})[_0x5ce6('0x9d')](function(_0x12dd66){for(var _0x189152=0x0;_0x189152<_0x27083b[_0x5ce6('0x57')][_0x5ce6('0x5f')][_0x5ce6('0x41')];_0x189152+=0x1){socket[_0x5ce6('0x9e')](_0x5ce6('0x9f'),{'UserId':Number(_0x27083b[_0x5ce6('0x57')]['ids'][_0x189152]),'CmListId':Number(_0x27083b['params']['id'])});}return _0x12dd66;});}})['then'](respondWithResult(_0x4f3da0,null))[_0x5ce6('0x4d')](handleError(_0x4f3da0,null));};exports[_0x5ce6('0xa0')]=function(_0x120011,_0x185e25,_0x437703){return db[_0x5ce6('0x37')]['find']({'where':{'id':_0x120011['params']['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x185e25,null))['then'](function(_0x2b6274){if(_0x2b6274){return _0x2b6274[_0x5ce6('0xa0')](_0x120011[_0x5ce6('0x3c')]['ids'])[_0x5ce6('0x2e')](function(){if(_[_0x5ce6('0x63')](_0x120011['query'][_0x5ce6('0x5f')])){for(var _0x26110a=0x0;_0x26110a<_0x120011[_0x5ce6('0x3c')][_0x5ce6('0x5f')][_0x5ce6('0x41')];_0x26110a+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x120011['query'][_0x5ce6('0x5f')][_0x26110a]),'CmListId':Number(_0x120011[_0x5ce6('0x4e')]['id'])});}}else{socket[_0x5ce6('0x9e')](_0x5ce6('0xa1'),{'UserId':Number(_0x120011[_0x5ce6('0x3c')][_0x5ce6('0x5f')]),'CmListId':Number(_0x120011[_0x5ce6('0x4e')]['id'])});}});}})[_0x5ce6('0x2e')](respondWithStatusCode(_0x185e25,null))[_0x5ce6('0x4d')](handleError(_0x185e25,null));};exports[_0x5ce6('0xa2')]=function(_0x239fd2,_0x558612,_0x10ab52){var _0x16a64d={};var _0x4fd314={};var _0x2617b3;var _0x377d80;return db[_0x5ce6('0x37')][_0x5ce6('0x8e')]({'where':{'id':_0x239fd2['params']['id']}})[_0x5ce6('0x2e')](handleEntityNotFound(_0x558612,null))[_0x5ce6('0x2e')](function(_0x31eefb){if(_0x31eefb){_0x2617b3=_0x31eefb;_0x4fd314[_0x5ce6('0x3b')]=_[_0x5ce6('0x4f')](db[_0x5ce6('0xa3')]['rawAttributes']);_0x4fd314[_0x5ce6('0x3c')]=_[_0x5ce6('0x4f')](_0x239fd2[_0x5ce6('0x3c')]);_0x4fd314[_0x5ce6('0x3d')]=_['intersection'](_0x4fd314['model'],_0x4fd314[_0x5ce6('0x3c')]);_0x16a64d['attributes']=_[_0x5ce6('0x3f')](_0x4fd314[_0x5ce6('0x3b')],qs['fields'](_0x239fd2[_0x5ce6('0x3c')][_0x5ce6('0x40')]));_0x16a64d[_0x5ce6('0x3e')]=_0x16a64d['attributes'][_0x5ce6('0x41')]?_0x16a64d[_0x5ce6('0x3e')]:_0x4fd314[_0x5ce6('0x3b')];_0x16a64d[_0x5ce6('0x5d')]=qs[_0x5ce6('0x43')](_0x239fd2[_0x5ce6('0x3c')]['sort']);_0x16a64d['where']=qs[_0x5ce6('0x3d')](_[_0x5ce6('0x45')](_0x239fd2['query'],_0x4fd314['filters']));if(_0x239fd2[_0x5ce6('0x3c')][_0x5ce6('0x46')]){_0x16a64d[_0x5ce6('0x44')]=_['merge'](_0x16a64d['where'],{'$or':_['map'](_0x16a64d[_0x5ce6('0x3e')],function(_0x3e9c18){var _0x3203a9={};_0x3203a9[_0x3e9c18]={'$like':'%'+_0x239fd2[_0x5ce6('0x3c')]['filter']+'%'};return _0x3203a9;})});}_0x16a64d=_[_0x5ce6('0x47')]({},_0x16a64d,_0x239fd2['options']);return _0x2617b3[_0x5ce6('0xa2')](_0x16a64d);}})[_0x5ce6('0x2e')](function(_0x1c856d){if(_0x1c856d){_0x377d80=_0x1c856d[_0x5ce6('0x41')];if(!_0x239fd2[_0x5ce6('0x3c')]['hasOwnProperty'](_0x5ce6('0xa4'))){_0x16a64d[_0x5ce6('0x29')]=qs[_0x5ce6('0x29')](_0x239fd2[_0x5ce6('0x3c')][_0x5ce6('0x29')]);_0x16a64d[_0x5ce6('0x26')]=qs[_0x5ce6('0x26')](_0x239fd2['query'][_0x5ce6('0x26')]);}return _0x2617b3['getAgents'](_0x16a64d);}})[_0x5ce6('0x2e')](function(_0x409771){if(_0x409771){return _0x409771?{'count':_0x377d80,'rows':_0x409771}:null;}})[_0x5ce6('0x2e')](respondWithResult(_0x558612,null))[_0x5ce6('0x4d')](handleError(_0x558612,null));};function handleQuery(_0x142983){logger[_0x5ce6('0xa5')](_0x142983);return db[_0x5ce6('0xa6')][_0x5ce6('0x3c')](_0x142983)['spread'](function(_0xb1e07b){csv_results['push'](_0xb1e07b);})[_0x5ce6('0x4d')](function(_0x443fe7){logger['error'](_0x443fe7[_0x5ce6('0x68')]);});}
\ No newline at end of file
+var _0xf5bf=['toString','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','text','TEXT','number','BOOLEAN','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','info','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','findOne','nolimit','removeDispositions','addContacts','CmContact','tags','isArray','push','each','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','cf_%d','raw','getContacts','ContactItemType','alias','cm_contacts','c.ListId\x20=\x20?','distinct','c.cf_','customField_','field','select','item','cm_contact_has_items','CmContactId\x20=\x20c.id','description','description_additionalPhone_'];(function(_0x5280c0,_0x51a074){var _0x2935b6=function(_0x30914e){while(--_0x30914e){_0x5280c0['push'](_0x5280c0['shift']());}};_0x2935b6(++_0x51a074);}(_0xf5bf,0x16a));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xff5b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff5b('0x1'));var rp=require(_0xff5b('0x2'));var moment=require('moment');var BPromise=require(_0xff5b('0x3'));var Mustache=require(_0xff5b('0x4'));var util=require(_0xff5b('0x5'));var path=require('path');var sox=require(_0xff5b('0x6'));var csv=require('to-csv');var ejs=require(_0xff5b('0x7'));var fs=require('fs');var fs_extra=require(_0xff5b('0x8'));var _=require(_0xff5b('0x9'));var squel=require(_0xff5b('0xa'));var crypto=require(_0xff5b('0xb'));var jsforce=require(_0xff5b('0xc'));var deskjs=require(_0xff5b('0xd'));var toCsv=require(_0xff5b('0xe'));var querystring=require(_0xff5b('0xf'));var Papa=require(_0xff5b('0x10'));var Redis=require('ioredis');var authService=require(_0xff5b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff5b('0x12'));var hardwareService=require(_0xff5b('0x13'));var logger=require(_0xff5b('0x14'))(_0xff5b('0x15'));var utils=require(_0xff5b('0x16'));var config=require(_0xff5b('0x17'));var licenseUtil=require(_0xff5b('0x18'));var db=require(_0xff5b('0x19'))['db'];var csv_results;config[_0xff5b('0x1a')]=_[_0xff5b('0x1b')](config[_0xff5b('0x1a')],{'host':_0xff5b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff5b('0x1a')]));require(_0xff5b('0x1d'))['register'](socket);function respondWithStatusCode(_0x3ce394,_0x137d3a){_0x137d3a=_0x137d3a||0xcc;return function(_0x486c15){if(_0x486c15){return _0x3ce394[_0xff5b('0x1e')](_0x137d3a);}return _0x3ce394[_0xff5b('0x1f')](_0x137d3a)[_0xff5b('0x20')]();};}function respondWithResult(_0x47cd84,_0x20bf14){_0x20bf14=_0x20bf14||0xc8;return function(_0x7aa7dc){if(_0x7aa7dc){return _0x47cd84[_0xff5b('0x1f')](_0x20bf14)[_0xff5b('0x21')](_0x7aa7dc);}};}function respondWithFilteredResult(_0x3a9017,_0x36b8fb){return function(_0x2188cd){if(_0x2188cd){var _0x25a76e=typeof _0x36b8fb['offset']===_0xff5b('0x22')&&typeof _0x36b8fb[_0xff5b('0x23')]===_0xff5b('0x22');var _0x4186e8=_0x2188cd[_0xff5b('0x24')];var _0x4703d0=_0x25a76e?0x0:_0x36b8fb['offset'];var _0x58697e=_0x25a76e?_0x2188cd[_0xff5b('0x24')]:_0x36b8fb['offset']+_0x36b8fb['limit'];var _0x243736;if(_0x58697e>=_0x4186e8){_0x58697e=_0x4186e8;_0x243736=0xc8;}else{_0x243736=0xce;}_0x3a9017[_0xff5b('0x1f')](_0x243736);return _0x3a9017[_0xff5b('0x25')](_0xff5b('0x26'),_0x4703d0+'-'+_0x58697e+'/'+_0x4186e8)['json'](_0x2188cd);}return null;};}function patchUpdates(_0x497fb4){return function(_0x15dd68){try{jsonpatch[_0xff5b('0x27')](_0x15dd68,_0x497fb4,!![]);}catch(_0x154cfc){return BPromise[_0xff5b('0x28')](_0x154cfc);}return _0x15dd68[_0xff5b('0x29')]();};}function saveUpdates(_0x47eef0,_0x5191a2){return function(_0x247df1){if(_0x247df1){return _0x247df1[_0xff5b('0x2a')](_0x47eef0)[_0xff5b('0x2b')](function(_0x1bb65a){return _0x1bb65a;});}return null;};}function removeEntity(_0x488bd9,_0x78752){return function(_0x4580a4){if(_0x4580a4){return _0x4580a4[_0xff5b('0x2c')]()[_0xff5b('0x2b')](function(){var _0x4866ab=_0x4580a4[_0xff5b('0x2d')]({'plain':!![]});var _0x282d0e=_0xff5b('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x282d0e,'resourceId':_0x4866ab['id']}})['then'](function(){return _0x4580a4;});})[_0xff5b('0x2b')](function(){_0x488bd9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3690,_0x429e6b){return function(_0x27a565){if(!_0x27a565){_0x1d3690[_0xff5b('0x1e')](0x194);}return _0x27a565;};}function handleError(_0x39e94f,_0x19b716){_0x19b716=_0x19b716||0x1f4;return function(_0x5373fc){logger['error'](_0x5373fc[_0xff5b('0x2f')]);if(_0x5373fc['name']){delete _0x5373fc[_0xff5b('0x30')];}_0x39e94f[_0xff5b('0x1f')](_0x19b716)[_0xff5b('0x31')](_0x5373fc);};}exports[_0xff5b('0x32')]=function(_0x2d4bc5,_0x462fda){var _0x37ac19={},_0x314be8={},_0x371551={'count':0x0,'rows':[]};var _0x15e1b4=_[_0xff5b('0x33')](db[_0xff5b('0x34')][_0xff5b('0x35')],function(_0x2ef1c6){return{'name':_0x2ef1c6[_0xff5b('0x36')],'type':_0x2ef1c6[_0xff5b('0x37')]['key']};});_0x314be8[_0xff5b('0x38')]=_[_0xff5b('0x33')](_0x15e1b4,'name');_0x314be8[_0xff5b('0x39')]=_['keys'](_0x2d4bc5['query']);_0x314be8[_0xff5b('0x3a')]=_[_0xff5b('0x3b')](_0x314be8[_0xff5b('0x38')],_0x314be8[_0xff5b('0x39')]);_0x37ac19[_0xff5b('0x3c')]=_[_0xff5b('0x3b')](_0x314be8['model'],qs[_0xff5b('0x3d')](_0x2d4bc5[_0xff5b('0x39')][_0xff5b('0x3d')]));_0x37ac19[_0xff5b('0x3c')]=_0x37ac19[_0xff5b('0x3c')]['length']?_0x37ac19[_0xff5b('0x3c')]:_0x314be8[_0xff5b('0x38')];if(!_0x2d4bc5['query'][_0xff5b('0x3e')]('nolimit')){_0x37ac19[_0xff5b('0x23')]=qs[_0xff5b('0x23')](_0x2d4bc5['query'][_0xff5b('0x23')]);_0x37ac19['offset']=qs[_0xff5b('0x3f')](_0x2d4bc5['query']['offset']);}_0x37ac19[_0xff5b('0x40')]=qs[_0xff5b('0x41')](_0x2d4bc5[_0xff5b('0x39')][_0xff5b('0x41')]);_0x37ac19[_0xff5b('0x42')]=qs[_0xff5b('0x3a')](_[_0xff5b('0x43')](_0x2d4bc5[_0xff5b('0x39')],_0x314be8['filters']),_0x15e1b4);if(_0x2d4bc5[_0xff5b('0x39')][_0xff5b('0x44')]){_0x37ac19[_0xff5b('0x42')]=_[_0xff5b('0x45')](_0x37ac19[_0xff5b('0x42')],{'$or':_[_0xff5b('0x33')](_0x15e1b4,function(_0x5711aa){if(_0x5711aa[_0xff5b('0x37')]!==_0xff5b('0x46')){var _0x5e2eda={};_0x5e2eda[_0x5711aa['name']]={'$like':'%'+_0x2d4bc5[_0xff5b('0x39')][_0xff5b('0x44')]+'%'};return _0x5e2eda;}})});}_0x37ac19=_['merge']({},_0x37ac19,_0x2d4bc5[_0xff5b('0x47')]);var _0x97ea77={'where':_0x37ac19['where']};return db['CmList'][_0xff5b('0x24')](_0x97ea77)['then'](function(_0x5714aa){_0x371551[_0xff5b('0x24')]=_0x5714aa;if(_0x2d4bc5[_0xff5b('0x39')][_0xff5b('0x48')]){_0x37ac19[_0xff5b('0x49')]=[{'all':!![]}];}return db['CmList'][_0xff5b('0x4a')](_0x37ac19);})[_0xff5b('0x2b')](function(_0x23926e){_0x371551[_0xff5b('0x4b')]=_0x23926e;return _0x371551;})[_0xff5b('0x2b')](respondWithFilteredResult(_0x462fda,_0x37ac19))[_0xff5b('0x4c')](handleError(_0x462fda,null));};exports[_0xff5b('0x4d')]=function(_0x54ce3e,_0x48b485){var _0x7029c6={'raw':![],'where':{'id':_0x54ce3e[_0xff5b('0x4e')]['id']}},_0x42d13d={};_0x42d13d['model']=_[_0xff5b('0x4f')](db['CmList'][_0xff5b('0x35')]);_0x42d13d[_0xff5b('0x39')]=_[_0xff5b('0x4f')](_0x54ce3e[_0xff5b('0x39')]);_0x42d13d[_0xff5b('0x3a')]=_['intersection'](_0x42d13d[_0xff5b('0x38')],_0x42d13d[_0xff5b('0x39')]);_0x7029c6[_0xff5b('0x3c')]=_[_0xff5b('0x3b')](_0x42d13d[_0xff5b('0x38')],qs['fields'](_0x54ce3e[_0xff5b('0x39')][_0xff5b('0x3d')]));_0x7029c6[_0xff5b('0x3c')]=_0x7029c6['attributes'][_0xff5b('0x50')]?_0x7029c6[_0xff5b('0x3c')]:_0x42d13d[_0xff5b('0x38')];if(_0x54ce3e[_0xff5b('0x39')]['includeAll']){_0x7029c6[_0xff5b('0x49')]=[{'all':!![]}];}_0x7029c6=_[_0xff5b('0x45')]({},_0x7029c6,_0x54ce3e[_0xff5b('0x47')]);return db[_0xff5b('0x34')][_0xff5b('0x51')](_0x7029c6)[_0xff5b('0x2b')](handleEntityNotFound(_0x48b485,null))[_0xff5b('0x2b')](respondWithResult(_0x48b485,null))[_0xff5b('0x4c')](handleError(_0x48b485,null));};exports['create']=function(_0x4abf67,_0x2b40a2){return db[_0xff5b('0x34')][_0xff5b('0x52')](_0x4abf67[_0xff5b('0x53')],{})[_0xff5b('0x2b')](function(_0x387e32){var _0x211d47=_0x4abf67['user'][_0xff5b('0x2d')]({'plain':!![]});if(!_0x211d47)throw new Error(_0xff5b('0x54'));if(_0x211d47[_0xff5b('0x55')]==='user'){var _0xcd0db8=_0x387e32[_0xff5b('0x2d')]({'plain':!![]});var _0xdc8a72='Lists';return db[_0xff5b('0x56')][_0xff5b('0x51')]({'where':{'name':_0xdc8a72,'userProfileId':_0x211d47[_0xff5b('0x57')]},'raw':!![]})[_0xff5b('0x2b')](function(_0x343048){if(_0x343048&&_0x343048[_0xff5b('0x58')]===0x0){return db[_0xff5b('0x59')][_0xff5b('0x52')]({'name':_0xcd0db8['name'],'resourceId':_0xcd0db8['id'],'type':_0x343048[_0xff5b('0x30')],'sectionId':_0x343048['id']},{})[_0xff5b('0x2b')](function(){return _0x387e32;});}else{return _0x387e32;}})[_0xff5b('0x4c')](function(_0x4bf856){logger[_0xff5b('0x5a')](_0xff5b('0x5b'),_0x4bf856);throw _0x4bf856;});}return _0x387e32;})[_0xff5b('0x2b')](respondWithResult(_0x2b40a2,0xc9))[_0xff5b('0x4c')](handleError(_0x2b40a2,null));};exports['update']=function(_0x4a01a2,_0x3cc5f8){if(_0x4a01a2[_0xff5b('0x53')]['id']){delete _0x4a01a2[_0xff5b('0x53')]['id'];}return db['CmList']['find']({'where':{'id':_0x4a01a2['params']['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x3cc5f8,null))['then'](saveUpdates(_0x4a01a2[_0xff5b('0x53')],null))[_0xff5b('0x2b')](respondWithResult(_0x3cc5f8,null))[_0xff5b('0x4c')](handleError(_0x3cc5f8,null));};exports[_0xff5b('0x2c')]=function(_0x4870cb,_0x4433d5){return db['CmList'][_0xff5b('0x51')]({'where':{'id':_0x4870cb[_0xff5b('0x4e')]['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x4433d5,null))[_0xff5b('0x2b')](removeEntity(_0x4433d5,null))[_0xff5b('0x4c')](handleError(_0x4433d5,null));};exports['describe']=function(_0x40d396,_0x56c68a){return db[_0xff5b('0x34')]['describe']()['then'](respondWithResult(_0x56c68a,null))[_0xff5b('0x4c')](handleError(_0x56c68a,null));};exports[_0xff5b('0x5c')]=function(_0x1cd9fb,_0x23b001,_0x48dbb6){if(_0x1cd9fb['body']['id']){delete _0x1cd9fb[_0xff5b('0x53')]['id'];}return db['CmList'][_0xff5b('0x51')]({'where':{'id':_0x1cd9fb['params']['id']}})['then'](handleEntityNotFound(_0x23b001,null))['then'](function(_0x1689e9){if(_0x1689e9){_0x1cd9fb['body'][_0xff5b('0x5d')]=_0x1689e9['id'];return db[_0xff5b('0x5e')][_0xff5b('0x52')](_0x1cd9fb[_0xff5b('0x53')]);}})['then'](respondWithResult(_0x23b001,null))['catch'](handleError(_0x23b001,null));};exports['getDispositions']=function(_0x1fe0c1,_0x898e37,_0x2cf59e){var _0x759fc6={'raw':![],'where':{}};var _0x33d1cc={};var _0xd42304={'count':0x0,'rows':[]};return db[_0xff5b('0x34')][_0xff5b('0x5f')]({'where':{'id':_0x1fe0c1[_0xff5b('0x4e')]['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x898e37,null))['then'](function(_0x56bb81){if(_0x56bb81){_0x33d1cc[_0xff5b('0x38')]=_['keys'](db[_0xff5b('0x5e')][_0xff5b('0x35')]);_0x33d1cc[_0xff5b('0x39')]=_[_0xff5b('0x4f')](_0x1fe0c1['query']);_0x33d1cc[_0xff5b('0x3a')]=_[_0xff5b('0x3b')](_0x33d1cc[_0xff5b('0x38')],_0x33d1cc[_0xff5b('0x39')]);_0x759fc6[_0xff5b('0x3c')]=_[_0xff5b('0x3b')](_0x33d1cc['model'],qs[_0xff5b('0x3d')](_0x1fe0c1[_0xff5b('0x39')]['fields']));_0x759fc6[_0xff5b('0x3c')]=_0x759fc6[_0xff5b('0x3c')][_0xff5b('0x50')]?_0x759fc6[_0xff5b('0x3c')]:_0x33d1cc[_0xff5b('0x38')];if(!_0x1fe0c1[_0xff5b('0x39')][_0xff5b('0x3e')](_0xff5b('0x60'))){_0x759fc6[_0xff5b('0x23')]=qs[_0xff5b('0x23')](_0x1fe0c1[_0xff5b('0x39')]['limit']);_0x759fc6[_0xff5b('0x3f')]=qs[_0xff5b('0x3f')](_0x1fe0c1[_0xff5b('0x39')][_0xff5b('0x3f')]);}_0x759fc6[_0xff5b('0x40')]=qs[_0xff5b('0x41')](_0x1fe0c1['query'][_0xff5b('0x41')]);_0x759fc6[_0xff5b('0x42')]=qs[_0xff5b('0x3a')](_[_0xff5b('0x43')](_0x1fe0c1[_0xff5b('0x39')],_0x33d1cc['filters']));_0x759fc6[_0xff5b('0x42')][_0xff5b('0x5d')]=_0x56bb81['id'];if(_0x1fe0c1[_0xff5b('0x39')][_0xff5b('0x44')]){_0x759fc6[_0xff5b('0x42')]=_[_0xff5b('0x45')](_0x759fc6[_0xff5b('0x42')],{'$or':_[_0xff5b('0x33')](_0x759fc6[_0xff5b('0x3c')],function(_0x58ba33){var _0x18a761={};_0x18a761[_0x58ba33]={'$like':'%'+_0x1fe0c1['query']['filter']+'%'};return _0x18a761;})});}_0x759fc6=_[_0xff5b('0x45')]({},_0x759fc6,_0x1fe0c1[_0xff5b('0x47')]);return db[_0xff5b('0x5e')][_0xff5b('0x24')]({'where':_0x759fc6[_0xff5b('0x42')]})['then'](function(_0x559faf){_0xd42304[_0xff5b('0x24')]=_0x559faf;if(_0x1fe0c1[_0xff5b('0x39')][_0xff5b('0x48')]){_0x759fc6[_0xff5b('0x49')]=[{'all':!![]}];}return db[_0xff5b('0x5e')]['findAll'](_0x759fc6);})[_0xff5b('0x2b')](function(_0xf8896d){_0xd42304[_0xff5b('0x4b')]=_0xf8896d;return _0xd42304;});}})[_0xff5b('0x2b')](respondWithFilteredResult(_0x898e37,_0x759fc6))['catch'](handleError(_0x898e37,null));};exports[_0xff5b('0x61')]=function(_0x300916,_0x165006,_0x1963b8){return db[_0xff5b('0x34')]['find']({'where':{'id':_0x300916['params']['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x165006,null))[_0xff5b('0x2b')](function(_0x197f99){if(_0x197f99){return _0x197f99['removeDispositions'](_0x300916[_0xff5b('0x39')]['ids']);}})[_0xff5b('0x2b')](respondWithStatusCode(_0x165006,null))[_0xff5b('0x4c')](handleError(_0x165006,null));};exports[_0xff5b('0x62')]=function(_0x5a617b,_0x21a792,_0x27f58f){return db[_0xff5b('0x34')][_0xff5b('0x51')]({'where':{'id':_0x5a617b['params']['id']}})['then'](handleEntityNotFound(_0x21a792,null))['then'](function(_0x4d3b7e){if(_0x4d3b7e){var _0x1feb74=[];var _0x134efa={'success':[],'errors':[]};return db[_0xff5b('0x63')]['describe']()[_0xff5b('0x2b')](function(_0x4b4ecf){if(_0x5a617b[_0xff5b('0x53')][_0xff5b('0x64')]&&_[_0xff5b('0x65')](_0x5a617b[_0xff5b('0x53')]['tags'])){if(_0x5a617b[_0xff5b('0x53')]['tags'][_0xff5b('0x50')]){_0x5a617b['body']['tags']=_0x5a617b[_0xff5b('0x53')][_0xff5b('0x64')]['join'](';')+';';}else{_0x5a617b[_0xff5b('0x53')][_0xff5b('0x64')]=null;}}else{_0x5a617b[_0xff5b('0x53')][_0xff5b('0x64')]=null;}if(_0x5a617b[_0xff5b('0x53')]&&_[_0xff5b('0x65')](_0x5a617b['body'])){for(var _0x165d73=0x0;_0x165d73<_0x5a617b[_0xff5b('0x53')]['length'];_0x165d73+=0x1){_0x5a617b[_0xff5b('0x53')][_0x165d73][_0xff5b('0x5d')]=_0x5a617b[_0xff5b('0x4e')]['id'];_0x1feb74[_0xff5b('0x66')](_0x5a617b[_0xff5b('0x53')][_0x165d73]);}return BPromise[_0xff5b('0x67')](_0x1feb74,function(_0x16e7d0){return db['CmContact'][_0xff5b('0x52')](_['omit'](_0x16e7d0,[_0xff5b('0x68'),'id'])||{},{'fields':_['keys'](_0x4b4ecf),'raw':!![]})['then'](function(_0x43b3a4){_0x134efa[_0xff5b('0x69')][_0xff5b('0x66')](_0x43b3a4[_0xff5b('0x6a')]);})[_0xff5b('0x4c')](function(_0x94cc5c){_0x134efa[_0xff5b('0x6b')][_0xff5b('0x66')]({'data':_0x16e7d0,'error':_0x94cc5c[_0xff5b('0x6c')]});});})['then'](function(_0x20ea36){return _0x134efa;})['catch'](function(_0x149dd1){return _0x149dd1;});}else{_0x21a792[_0xff5b('0x1f')](0x190)[_0xff5b('0x21')]({'message':_0xff5b('0x6d')});}});}})[_0xff5b('0x2b')](respondWithResult(_0x21a792,null))['catch'](handleError(_0x21a792,null));};exports['getContacts']=function(_0x17b0a8,_0x4a8e62,_0x22caa1){var _0x472bc6;return db[_0xff5b('0x34')][_0xff5b('0x51')]({'where':{'id':_0x17b0a8[_0xff5b('0x4e')]['id']},'include':[{'model':db[_0xff5b('0x6e')],'as':_0xff5b('0x6f')}]})[_0xff5b('0x2b')](handleEntityNotFound(_0x4a8e62,null))[_0xff5b('0x2b')](function(_0x10c4cc){if(_0x10c4cc){_0x472bc6=_0x10c4cc;return db[_0xff5b('0x63')][_0xff5b('0x35')];}})['then'](function(_0x2221f9){if(_0x2221f9){var _0x40c7a5={};var _0x35bf22={};_0x35bf22[_0xff5b('0x38')]=_['concat'](_[_0xff5b('0x4f')](_0x2221f9),_['map'](_0x472bc6[_0xff5b('0x6f')],function(_0x2c6750){return util[_0xff5b('0x70')](_0xff5b('0x71'),_0x2c6750['id']);}));_0x35bf22[_0xff5b('0x39')]=_['keys'](_0x17b0a8['query']);_0x35bf22[_0xff5b('0x3a')]=_[_0xff5b('0x3b')](_0x35bf22['model'],_0x35bf22['query']);_0x40c7a5[_0xff5b('0x3c')]=_[_0xff5b('0x3b')](_0x35bf22[_0xff5b('0x38')],qs['fields'](_0x17b0a8[_0xff5b('0x39')][_0xff5b('0x3d')]));_0x40c7a5[_0xff5b('0x3c')]=_0x40c7a5[_0xff5b('0x3c')][_0xff5b('0x50')]?_0x40c7a5[_0xff5b('0x3c')]:_0x35bf22[_0xff5b('0x38')];if(!_0x17b0a8['query'][_0xff5b('0x3e')](_0xff5b('0x60'))){_0x40c7a5['limit']=qs['limit'](_0x17b0a8['query']['limit']);_0x40c7a5['offset']=qs[_0xff5b('0x3f')](_0x17b0a8[_0xff5b('0x39')][_0xff5b('0x3f')]);}_0x40c7a5[_0xff5b('0x40')]=qs[_0xff5b('0x41')](_0x17b0a8['query'][_0xff5b('0x41')]);_0x40c7a5['where']=qs[_0xff5b('0x3a')](_[_0xff5b('0x43')](_0x17b0a8[_0xff5b('0x39')],_0x35bf22['filters']));_0x40c7a5[_0xff5b('0x72')]=!![];if(_0x17b0a8[_0xff5b('0x39')]['filter']){_0x40c7a5[_0xff5b('0x42')]=_[_0xff5b('0x45')](_0x40c7a5[_0xff5b('0x42')],{'$or':_[_0xff5b('0x33')](_0x40c7a5[_0xff5b('0x3c')],function(_0x46858b){var _0x1bce0f={};_0x1bce0f[_0x46858b]={'$like':'%'+_0x17b0a8[_0xff5b('0x39')][_0xff5b('0x44')]+'%'};return _0x1bce0f;})});}_0x40c7a5=_[_0xff5b('0x45')]({},_0x40c7a5,_0x17b0a8[_0xff5b('0x47')]);return _0x472bc6[_0xff5b('0x73')](_0x40c7a5);}})[_0xff5b('0x2b')](respondWithResult(_0x4a8e62,null))[_0xff5b('0x4c')](handleError(_0x4a8e62,null));};exports['getContactsCsv']=function(_0x138ddd,_0x1c986e,_0x193f8e){var _0xf828e2;var _0x2380c7;var _0x29f323;var _0x53a28c=_0x138ddd[_0xff5b('0x4e')]['id'];csv_results=[];return db[_0xff5b('0x74')][_0xff5b('0x4a')]({'attributes':['id',_0xff5b('0x30')],'raw':!![],'order':['OrderBy']})['then'](function(_0x23063f){_0xf828e2=_0x23063f;var _0x2c7308=_[_0xff5b('0x4f')](db['CmContact'][_0xff5b('0x35')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0xff5b('0x75')]})[_0xff5b('0x2b')](function(_0x3527bc){_0x2380c7=_0x3527bc;var _0x43dc0f=squel['select']()[_0xff5b('0x3d')](_0x2c7308)['from'](_0xff5b('0x76'),'c')[_0xff5b('0x42')](_0xff5b('0x77'),_0x53a28c)[_0xff5b('0x42')]('c.deletedAt\x20is\x20null')[_0xff5b('0x78')]();for(var _0x400974=0x0;_0x400974<_0x2380c7[_0xff5b('0x50')];_0x400974++){_0x43dc0f['field'](_0xff5b('0x79')+_0x2380c7[_0x400974]['id'],_0xff5b('0x7a')+_0x2380c7[_0x400974][_0xff5b('0x75')]);}for(var _0x400974=0x0;_0x400974<_0xf828e2[_0xff5b('0x50')];_0x400974++){_0x43dc0f[_0xff5b('0x7b')](squel[_0xff5b('0x7c')]()[_0xff5b('0x7b')](_0xff5b('0x7d'))['from'](_0xff5b('0x7e'))[_0xff5b('0x42')]('ItemTypeId\x20=\x20?',_0xf828e2[_0x400974]['id'])['where'](_0xff5b('0x7f')),'additionalPhone_'+_0xf828e2[_0x400974][_0xff5b('0x30')]);_0x43dc0f[_0xff5b('0x7b')](squel[_0xff5b('0x7c')]()[_0xff5b('0x7b')](_0xff5b('0x80'))['from'](_0xff5b('0x7e'))[_0xff5b('0x42')]('ItemTypeId\x20=\x20?',_0xf828e2[_0x400974]['id'])['where'](_0xff5b('0x7f')),_0xff5b('0x81')+_0xf828e2[_0x400974][_0xff5b('0x30')]);}var _0x359f7d=[];_0x359f7d[_0xff5b('0x66')](_0x43dc0f[_0xff5b('0x82')]());BPromise[_0xff5b('0x67')](_0x359f7d,handleQuery)[_0xff5b('0x2b')](function(_0x501de1){handleQuery(_0x43dc0f[_0xff5b('0x82')]());var _0x1cce5e=csv_results[0x0];if(!_[_0xff5b('0x83')](_0x1cce5e)){var _0x3aeb4e=toCsv(_0x1cce5e);var _0x4cac8b=Date[_0xff5b('0x84')]();fs['writeFileSync'](util[_0xff5b('0x70')]('/tmp/list_%d_%s.csv',_0x53a28c,_0x4cac8b),_0x3aeb4e);_0x1c986e[_0xff5b('0x85')](_0xff5b('0x86'),_0xff5b('0x87')+util[_0xff5b('0x70')](_0xff5b('0x88'),_0x53a28c,_0x4cac8b));_0x1c986e[_0xff5b('0x85')](_0xff5b('0x89'),_0xff5b('0x8a'));return _0x1c986e[_0xff5b('0x8b')](util['format'](_0xff5b('0x8c'),_0x53a28c,_0x4cac8b));}else{return _0x1c986e[_0xff5b('0x1e')](0xcc);}});});});};exports[_0xff5b('0x8d')]=function(_0x352982,_0x34520b,_0x5adeb2){var _0x164c5e;delete _0x352982[_0xff5b('0x53')]['id'];return db['CmList'][_0xff5b('0x5f')]({'where':{'id':_0x352982[_0xff5b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34520b,null))[_0xff5b('0x2b')](function(_0x119c52){if(_0x119c52){return db[_0xff5b('0x8e')][_0xff5b('0x8f')](function(_0x460318){return db[_0xff5b('0x6e')]['create'](_0x352982[_0xff5b('0x53')],{'transaction':_0x460318})[_0xff5b('0x2b')](function(_0x11dece){_0x164c5e=_0x11dece;return _0x119c52['addCustomFields'](_0x11dece,{'transaction':_0x460318});})[_0xff5b('0x2b')](function(){var _0x3ee710={'type':db[_0xff5b('0x90')]['TEXT'],'transaction':_0x460318};switch(_0x352982[_0xff5b('0x53')][_0xff5b('0x37')]){case _0xff5b('0x91'):_0x3ee710[_0xff5b('0x37')]=db[_0xff5b('0x90')][_0xff5b('0x92')];break;case _0xff5b('0x93'):_0x3ee710[_0xff5b('0x37')]=db[_0xff5b('0x90')]['INTEGER'];break;case'switch':_0x3ee710['type']=db['Sequelize'][_0xff5b('0x94')];_0x3ee710['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0xff5b('0x95')](_0xff5b('0x76'),util[_0xff5b('0x70')](_0xff5b('0x96'),_0x164c5e['id']),_0x3ee710);})[_0xff5b('0x2b')](function(){return _0x164c5e;});});}})[_0xff5b('0x2b')](respondWithResult(_0x34520b,null))[_0xff5b('0x4c')](handleError(_0x34520b,null));};exports[_0xff5b('0x97')]=function(_0x1c51aa,_0x2468e3,_0x32c959){var _0x255648={};var _0x4594d3={};var _0x43ed88;var _0x2166c1;return db['CmList'][_0xff5b('0x5f')]({'where':{'id':_0x1c51aa['params']['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x2468e3,null))[_0xff5b('0x2b')](function(_0x5ea3d4){if(_0x5ea3d4){_0x43ed88=_0x5ea3d4;_0x4594d3[_0xff5b('0x38')]=_[_0xff5b('0x4f')](db[_0xff5b('0x6e')][_0xff5b('0x35')]);_0x4594d3[_0xff5b('0x39')]=_[_0xff5b('0x4f')](_0x1c51aa[_0xff5b('0x39')]);_0x4594d3[_0xff5b('0x3a')]=_[_0xff5b('0x3b')](_0x4594d3['model'],_0x4594d3['query']);_0x255648['attributes']=_[_0xff5b('0x3b')](_0x4594d3[_0xff5b('0x38')],qs[_0xff5b('0x3d')](_0x1c51aa[_0xff5b('0x39')][_0xff5b('0x3d')]));_0x255648[_0xff5b('0x3c')]=_0x255648[_0xff5b('0x3c')][_0xff5b('0x50')]?_0x255648['attributes']:_0x4594d3[_0xff5b('0x38')];_0x255648[_0xff5b('0x40')]=qs['sort'](_0x1c51aa['query'][_0xff5b('0x41')]);_0x255648[_0xff5b('0x42')]=qs['filters'](_['pick'](_0x1c51aa[_0xff5b('0x39')],_0x4594d3[_0xff5b('0x3a')]));_0x255648[_0xff5b('0x42')]=_[_0xff5b('0x45')](_0x255648[_0xff5b('0x42')],{'$or':[{'ListId':_0x5ea3d4['id']},{'ListId':null}]});if(_0x1c51aa[_0xff5b('0x39')]['filter']){_0x255648['where']=_['merge'](_0x255648['where'],{'$or':_[_0xff5b('0x33')](_0x255648['attributes'],function(_0x3f8d5a){var _0xd62e9a={};_0xd62e9a[_0x3f8d5a]={'$like':'%'+_0x1c51aa['query'][_0xff5b('0x44')]+'%'};return _0xd62e9a;})});}_0x255648=_['merge']({},_0x255648,_0x1c51aa[_0xff5b('0x47')]);return db[_0xff5b('0x6e')]['findAndCountAll'](_0x255648);}})[_0xff5b('0x2b')](respondWithResult(_0x2468e3,null))[_0xff5b('0x4c')](handleError(_0x2468e3,null));};exports[_0xff5b('0x98')]=function(_0x55ba9e,_0x3e6c87){return db[_0xff5b('0x6e')][_0xff5b('0x99')]({'where':{'ListId':null}})[_0xff5b('0x2b')](handleEntityNotFound(_0x3e6c87,null))[_0xff5b('0x2b')](function(_0x3c79c6){return _0x3c79c6;})[_0xff5b('0x2b')](respondWithResult(_0x3e6c87,null))['catch'](handleError(_0x3e6c87,null));};exports[_0xff5b('0x9a')]=function(_0x4deca2,_0x4b1d9b,_0x4d8dd8){return db[_0xff5b('0x34')][_0xff5b('0x51')]({'where':{'id':_0x4deca2[_0xff5b('0x4e')]['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x4b1d9b,null))[_0xff5b('0x2b')](function(_0x3e0b29){if(_0x3e0b29){return _0x3e0b29[_0xff5b('0x9a')](_0x4deca2[_0xff5b('0x53')]['ids'],_[_0xff5b('0x9b')](_0x4deca2['body'],[_0xff5b('0x68'),'id'])||{})[_0xff5b('0x9c')](function(_0x1490c4){for(var _0x4e7cbe=0x0;_0x4e7cbe<_0x4deca2[_0xff5b('0x53')][_0xff5b('0x68')][_0xff5b('0x50')];_0x4e7cbe+=0x1){socket['emit'](_0xff5b('0x9d'),{'UserId':Number(_0x4deca2[_0xff5b('0x53')][_0xff5b('0x68')][_0x4e7cbe]),'CmListId':Number(_0x4deca2[_0xff5b('0x4e')]['id'])});}return _0x1490c4;});}})[_0xff5b('0x2b')](respondWithResult(_0x4b1d9b,null))[_0xff5b('0x4c')](handleError(_0x4b1d9b,null));};exports[_0xff5b('0x9e')]=function(_0x216df3,_0x220bfa,_0xedb4ca){return db[_0xff5b('0x34')]['find']({'where':{'id':_0x216df3[_0xff5b('0x4e')]['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x220bfa,null))['then'](function(_0x4db7b2){if(_0x4db7b2){return _0x4db7b2['removeAgents'](_0x216df3[_0xff5b('0x39')]['ids'])[_0xff5b('0x2b')](function(){if(_['isArray'](_0x216df3[_0xff5b('0x39')]['ids'])){for(var _0x3e7df6=0x0;_0x3e7df6<_0x216df3[_0xff5b('0x39')][_0xff5b('0x68')][_0xff5b('0x50')];_0x3e7df6+=0x1){socket[_0xff5b('0x9f')](_0xff5b('0xa0'),{'UserId':Number(_0x216df3[_0xff5b('0x39')]['ids'][_0x3e7df6]),'CmListId':Number(_0x216df3['params']['id'])});}}else{socket['emit'](_0xff5b('0xa0'),{'UserId':Number(_0x216df3[_0xff5b('0x39')][_0xff5b('0x68')]),'CmListId':Number(_0x216df3[_0xff5b('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x220bfa,null))[_0xff5b('0x4c')](handleError(_0x220bfa,null));};exports['getAgents']=function(_0x269093,_0x51915e,_0x1fd75e){var _0x37aade={};var _0x330ffc={};var _0xbd5efd;var _0x2b05f4;return db[_0xff5b('0x34')][_0xff5b('0x5f')]({'where':{'id':_0x269093[_0xff5b('0x4e')]['id']}})[_0xff5b('0x2b')](handleEntityNotFound(_0x51915e,null))[_0xff5b('0x2b')](function(_0x2c4e95){if(_0x2c4e95){_0xbd5efd=_0x2c4e95;_0x330ffc[_0xff5b('0x38')]=_['keys'](db[_0xff5b('0xa1')]['rawAttributes']);_0x330ffc[_0xff5b('0x39')]=_[_0xff5b('0x4f')](_0x269093[_0xff5b('0x39')]);_0x330ffc[_0xff5b('0x3a')]=_[_0xff5b('0x3b')](_0x330ffc['model'],_0x330ffc[_0xff5b('0x39')]);_0x37aade[_0xff5b('0x3c')]=_['intersection'](_0x330ffc['model'],qs['fields'](_0x269093[_0xff5b('0x39')][_0xff5b('0x3d')]));_0x37aade[_0xff5b('0x3c')]=_0x37aade['attributes'][_0xff5b('0x50')]?_0x37aade[_0xff5b('0x3c')]:_0x330ffc[_0xff5b('0x38')];_0x37aade['order']=qs[_0xff5b('0x41')](_0x269093[_0xff5b('0x39')][_0xff5b('0x41')]);_0x37aade[_0xff5b('0x42')]=qs[_0xff5b('0x3a')](_['pick'](_0x269093[_0xff5b('0x39')],_0x330ffc['filters']));if(_0x269093['query'][_0xff5b('0x44')]){_0x37aade['where']=_[_0xff5b('0x45')](_0x37aade[_0xff5b('0x42')],{'$or':_[_0xff5b('0x33')](_0x37aade[_0xff5b('0x3c')],function(_0x4664d3){var _0x2d9d75={};_0x2d9d75[_0x4664d3]={'$like':'%'+_0x269093['query'][_0xff5b('0x44')]+'%'};return _0x2d9d75;})});}_0x37aade=_[_0xff5b('0x45')]({},_0x37aade,_0x269093[_0xff5b('0x47')]);return _0xbd5efd['getAgents'](_0x37aade);}})[_0xff5b('0x2b')](function(_0x1fa8ee){if(_0x1fa8ee){_0x2b05f4=_0x1fa8ee['length'];if(!_0x269093['query'][_0xff5b('0x3e')](_0xff5b('0x60'))){_0x37aade[_0xff5b('0x23')]=qs['limit'](_0x269093[_0xff5b('0x39')]['limit']);_0x37aade['offset']=qs[_0xff5b('0x3f')](_0x269093[_0xff5b('0x39')][_0xff5b('0x3f')]);}return _0xbd5efd[_0xff5b('0xa2')](_0x37aade);}})[_0xff5b('0x2b')](function(_0x27d708){if(_0x27d708){return _0x27d708?{'count':_0x2b05f4,'rows':_0x27d708}:null;}})[_0xff5b('0x2b')](respondWithResult(_0x51915e,null))[_0xff5b('0x4c')](handleError(_0x51915e,null));};function handleQuery(_0x3b876c){logger[_0xff5b('0xa3')](_0x3b876c);return db['sequelize']['query'](_0x3b876c)[_0xff5b('0x9c')](function(_0x1524c6){csv_results['push'](_0x1524c6);})[_0xff5b('0x4c')](function(_0xbc1ba3){logger[_0xff5b('0x5a')](_0xbc1ba3[_0xff5b('0x6c')]);});}
\ No newline at end of file
index 5589fea..d69cf80 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x157d67,_0xe5c888){_0x157d67=_0x157d67-0x0;var _0x156176=_0x326f[_0x157d67];return _0x156176;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents;
\ No newline at end of file
+var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1e1ad9,_0x379e60){var _0x24a3ba=function(_0x17c87a){while(--_0x17c87a){_0x1e1ad9['push'](_0x1e1ad9['shift']());}};_0x24a3ba(++_0x379e60);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents;
\ No newline at end of file
index 4cfb6f7..aa25923 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x10682f,_0x56a846){var _0x3fa3b0=function(_0x1104cb){while(--_0x1104cb){_0x10682f['push'](_0x10682f['shift']());}};_0x3fa3b0(++_0x56a846);}(_0x5ff3,0x17d));var _0x35ff=function(_0x52f1df,_0x141e78){_0x52f1df=_0x52f1df-0x0;var _0x29bd13=_0x5ff3[_0x52f1df];return _0x29bd13;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x30e8ac,_0x7f65a9){var _0x5a057c=function(_0x87369f){while(--_0x87369f){_0x30e8ac['push'](_0x30e8ac['shift']());}};_0x5a057c(++_0x7f65a9);}(_0x2dae,0xc3));var _0xe2da=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x2dae[_0x3e0763];return _0x351ca2;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ce9058b..ec7f373 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1d10=['moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x1f20bc,_0x539966){var _0x2849ab=function(_0x4f7e0a){while(--_0x4f7e0a){_0x1f20bc['push'](_0x1f20bc['shift']());}};_0x2849ab(++_0x539966);}(_0x1d10,0x196));var _0x01d1=function(_0x4ad997,_0x195752){_0x4ad997=_0x4ad997-0x0;var _0x3372ca=_0x1d10[_0x4ad997];return _0x3372ca;};'use strict';var _=require(_0x01d1('0x0'));var util=require(_0x01d1('0x1'));var moment=require(_0x01d1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01d1('0x3'));var db=require(_0x01d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01d1('0x5'))(_0x01d1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01d1('0x7')][_0x01d1('0x8')]({'port':0x232a});config[_0x01d1('0x9')]=_[_0x01d1('0xa')](config['redis'],{'host':_0x01d1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x01d1('0xc')](socket);function respondWithRpcPromise(_0x1cefc9,_0x4b875a,_0x546fd4){return new BPromise(function(_0x50cf43,_0x56a611){return client[_0x01d1('0xd')](_0x1cefc9,_0x546fd4)[_0x01d1('0xe')](function(_0x5ffd26){logger[_0x01d1('0xf')]('CmList,\x20%s,\x20%s',_0x4b875a,_0x01d1('0x10'));logger[_0x01d1('0x11')](_0x01d1('0x12'),_0x4b875a,_0x01d1('0x10'),JSON[_0x01d1('0x13')](_0x5ffd26));if(_0x5ffd26[_0x01d1('0x14')]){if(_0x5ffd26[_0x01d1('0x14')]['code']===0x1f4){logger[_0x01d1('0x14')](_0x01d1('0x15'),_0x4b875a,_0x5ffd26['error'][_0x01d1('0x16')]);return _0x56a611(_0x5ffd26[_0x01d1('0x14')][_0x01d1('0x16')]);}logger['error'](_0x01d1('0x15'),_0x4b875a,_0x5ffd26[_0x01d1('0x14')][_0x01d1('0x16')]);return _0x50cf43(_0x5ffd26['error'][_0x01d1('0x16')]);}else{logger[_0x01d1('0xf')](_0x01d1('0x15'),_0x4b875a,_0x01d1('0x10'));_0x50cf43(_0x5ffd26['result'][_0x01d1('0x16')]);}})[_0x01d1('0x17')](function(_0x21142c){logger[_0x01d1('0x14')]('CmList,\x20%s,\x20%s',_0x4b875a,_0x21142c);_0x56a611(_0x21142c);});});}
\ No newline at end of file
+var _0xdafd=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x102a81,_0x1865d3){var _0x5bb8fa=function(_0x4f9cb0){while(--_0x4f9cb0){_0x102a81['push'](_0x102a81['shift']());}};_0x5bb8fa(++_0x1865d3);}(_0xdafd,0x1b3));var _0xddaf=function(_0x7a0cb8,_0xfdb29e){_0x7a0cb8=_0x7a0cb8-0x0;var _0x4dd048=_0xdafd[_0x7a0cb8];return _0x4dd048;};'use strict';var _=require(_0xddaf('0x0'));var util=require('util');var moment=require(_0xddaf('0x1'));var BPromise=require(_0xddaf('0x2'));var rs=require(_0xddaf('0x3'));var fs=require('fs');var Redis=require(_0xddaf('0x4'));var db=require(_0xddaf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xddaf('0x6'));var config=require(_0xddaf('0x7'));var jayson=require(_0xddaf('0x8'));var client=jayson['client'][_0xddaf('0x9')]({'port':0x232a});config[_0xddaf('0xa')]=_[_0xddaf('0xb')](config[_0xddaf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xddaf('0xc'))(new Redis(config[_0xddaf('0xa')]));require(_0xddaf('0xd'))[_0xddaf('0xe')](socket);function respondWithRpcPromise(_0xc97fc8,_0x46d451,_0x5f1474){return new BPromise(function(_0x5ce47b,_0x1fd745){return client[_0xddaf('0xf')](_0xc97fc8,_0x5f1474)[_0xddaf('0x10')](function(_0xe37dcb){logger['info'](_0xddaf('0x11'),_0x46d451,_0xddaf('0x12'));logger[_0xddaf('0x13')](_0xddaf('0x14'),_0x46d451,'request\x20sent',JSON[_0xddaf('0x15')](_0xe37dcb));if(_0xe37dcb[_0xddaf('0x16')]){if(_0xe37dcb[_0xddaf('0x16')][_0xddaf('0x17')]===0x1f4){logger['error'](_0xddaf('0x11'),_0x46d451,_0xe37dcb['error'][_0xddaf('0x18')]);return _0x1fd745(_0xe37dcb['error']['message']);}logger[_0xddaf('0x16')](_0xddaf('0x11'),_0x46d451,_0xe37dcb[_0xddaf('0x16')][_0xddaf('0x18')]);return _0x5ce47b(_0xe37dcb[_0xddaf('0x16')][_0xddaf('0x18')]);}else{logger['info'](_0xddaf('0x11'),_0x46d451,_0xddaf('0x12'));_0x5ce47b(_0xe37dcb[_0xddaf('0x19')][_0xddaf('0x18')]);}})[_0xddaf('0x1a')](function(_0x4b2c2d){logger['error'](_0xddaf('0x11'),_0x46d451,_0x4b2c2d);_0x1fd745(_0x4b2c2d);});});}
\ No newline at end of file
index 325f64e..835c6ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb815=['emit','register','length','cmList:','./cmList.events','save'];(function(_0x326b91,_0x4b11e9){var _0x525073=function(_0x152d85){while(--_0x152d85){_0x326b91['push'](_0x326b91['shift']());}};_0x525073(++_0x4b11e9);}(_0xb815,0x160));var _0x5b81=function(_0x4f3e52,_0x3325b5){_0x4f3e52=_0x4f3e52-0x0;var _0x3c0716=_0xb815[_0x4f3e52];return _0x3c0716;};'use strict';var CmListEvents=require(_0x5b81('0x0'));var events=[_0x5b81('0x1'),'remove','update'];function createListener(_0x2ec5d4,_0x5ae6ff){return function(_0x3cab0b){_0x5ae6ff[_0x5b81('0x2')](_0x2ec5d4,_0x3cab0b);};}function removeListener(_0x24aaec,_0x114114){return function(){CmListEvents['removeListener'](_0x24aaec,_0x114114);};}exports[_0x5b81('0x3')]=function(_0x971823){for(var _0xfb1bec=0x0,_0x340970=events[_0x5b81('0x4')];_0xfb1bec<_0x340970;_0xfb1bec++){var _0x682c3e=events[_0xfb1bec];var _0x13b3a2=createListener(_0x5b81('0x5')+_0x682c3e,_0x971823);CmListEvents['on'](_0x682c3e,_0x13b3a2);}};
\ No newline at end of file
+var _0x831d=['removeListener','register','length','cmList:','./cmList.events','save','update','emit'];(function(_0x596dbf,_0x5a2e3d){var _0x222953=function(_0x4dd8e1){while(--_0x4dd8e1){_0x596dbf['push'](_0x596dbf['shift']());}};_0x222953(++_0x5a2e3d);}(_0x831d,0x19c));var _0xd831=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x831d[_0x445101];return _0x3c3d04;};'use strict';var CmListEvents=require(_0xd831('0x0'));var events=[_0xd831('0x1'),'remove',_0xd831('0x2')];function createListener(_0x54b28e,_0x3080de){return function(_0x5e3531){_0x3080de[_0xd831('0x3')](_0x54b28e,_0x5e3531);};}function removeListener(_0x3c2944,_0x2301c3){return function(){CmListEvents[_0xd831('0x4')](_0x3c2944,_0x2301c3);};}exports[_0xd831('0x5')]=function(_0x1ba52d){for(var _0x30741e=0x0,_0x1ee494=events[_0xd831('0x6')];_0x30741e<_0x1ee494;_0x30741e++){var _0x40467=events[_0x30741e];var _0x173d6e=createListener(_0xd831('0x7')+_0x40467,_0x1ba52d);CmListEvents['on'](_0x40467,_0x173d6e);}};
\ No newline at end of file
index ed5bf86..b55890a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda5d=['removeDispositions','removeAgents','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','getGlobalCustomFields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','destroy','delete'];(function(_0x5d672b,_0x28f0e4){var _0x3268fc=function(_0x47aa90){while(--_0x47aa90){_0x5d672b['push'](_0x5d672b['shift']());}};_0x3268fc(++_0x28f0e4);}(_0xda5d,0xc8));var _0xdda5=function(_0x50a7f7,_0x7c611){_0x50a7f7=_0x50a7f7-0x0;var _0x192449=_0xda5d[_0x50a7f7];return _0x192449;};'use strict';var multer=require('multer');var util=require(_0xdda5('0x0'));var path=require(_0xdda5('0x1'));var timeout=require(_0xdda5('0x2'));var express=require(_0xdda5('0x3'));var router=express['Router']();var fs_extra=require(_0xdda5('0x4'));var auth=require(_0xdda5('0x5'));var interaction=require(_0xdda5('0x6'));var config=require('../../config/environment');var controller=require(_0xdda5('0x7'));router[_0xdda5('0x8')]('/',auth[_0xdda5('0x9')](),controller[_0xdda5('0xa')]);router['get'](_0xdda5('0xb'),auth[_0xdda5('0x9')](),controller[_0xdda5('0xc')]);router['get']('/global_fields',auth[_0xdda5('0x9')](),controller[_0xdda5('0xd')]);router['get'](_0xdda5('0xe'),auth[_0xdda5('0x9')](),controller[_0xdda5('0xf')]);router[_0xdda5('0x8')]('/:id/dispositions',auth[_0xdda5('0x9')](),controller['getDispositions']);router[_0xdda5('0x8')](_0xdda5('0x10'),auth[_0xdda5('0x9')](),controller[_0xdda5('0x11')]);router[_0xdda5('0x8')](_0xdda5('0x12'),auth[_0xdda5('0x9')](),controller[_0xdda5('0x13')]);router[_0xdda5('0x8')](_0xdda5('0x14'),auth[_0xdda5('0x9')](),controller[_0xdda5('0x15')]);router[_0xdda5('0x8')](_0xdda5('0x16'),auth[_0xdda5('0x9')](),controller['getAgents']);router[_0xdda5('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdda5('0x17')](_0xdda5('0x18'),auth['isAuthenticated'](),controller[_0xdda5('0x19')]);router['post'](_0xdda5('0x10'),auth[_0xdda5('0x9')](),controller[_0xdda5('0x1a')]);router['post'](_0xdda5('0x14'),auth['isAuthenticated'](),controller[_0xdda5('0x1b')]);router[_0xdda5('0x17')]('/:id/users',auth[_0xdda5('0x9')](),controller[_0xdda5('0x1c')]);router['put']('/:id',auth[_0xdda5('0x9')](),controller['update']);router['delete']('/:id',auth[_0xdda5('0x9')](),controller[_0xdda5('0x1d')]);router[_0xdda5('0x1e')](_0xdda5('0x18'),auth[_0xdda5('0x9')](),controller[_0xdda5('0x1f')]);router['delete'](_0xdda5('0x16'),auth['isAuthenticated'](),controller[_0xdda5('0x20')]);module['exports']=router;
\ No newline at end of file
+var _0x2227=['/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','/describe','describe','get','getGlobalCustomFields'];(function(_0x51e4bd,_0x31c995){var _0x3c5c7e=function(_0x50cdf3){while(--_0x50cdf3){_0x51e4bd['push'](_0x51e4bd['shift']());}};_0x3c5c7e(++_0x31c995);}(_0x2227,0x147));var _0x7222=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x2227[_0x258fb0];return _0x4d1afe;};'use strict';var multer=require(_0x7222('0x0'));var util=require(_0x7222('0x1'));var path=require(_0x7222('0x2'));var timeout=require('connect-timeout');var express=require(_0x7222('0x3'));var router=express[_0x7222('0x4')]();var fs_extra=require(_0x7222('0x5'));var auth=require(_0x7222('0x6'));var interaction=require(_0x7222('0x7'));var config=require(_0x7222('0x8'));var controller=require(_0x7222('0x9'));router['get']('/',auth[_0x7222('0xa')](),controller['index']);router['get'](_0x7222('0xb'),auth[_0x7222('0xa')](),controller[_0x7222('0xc')]);router[_0x7222('0xd')]('/global_fields',auth[_0x7222('0xa')](),controller[_0x7222('0xe')]);router[_0x7222('0xd')](_0x7222('0xf'),auth[_0x7222('0xa')](),controller[_0x7222('0x10')]);router[_0x7222('0xd')](_0x7222('0x11'),auth[_0x7222('0xa')](),controller[_0x7222('0x12')]);router[_0x7222('0xd')]('/:id/contacts',auth[_0x7222('0xa')](),controller[_0x7222('0x13')]);router[_0x7222('0xd')](_0x7222('0x14'),auth[_0x7222('0xa')](),controller[_0x7222('0x15')]);router['get'](_0x7222('0x16'),auth['isAuthenticated'](),controller[_0x7222('0x17')]);router[_0x7222('0xd')](_0x7222('0x18'),auth[_0x7222('0xa')](),controller[_0x7222('0x19')]);router[_0x7222('0x1a')]('/',auth[_0x7222('0xa')](),controller[_0x7222('0x1b')]);router[_0x7222('0x1a')](_0x7222('0x11'),auth[_0x7222('0xa')](),controller[_0x7222('0x1c')]);router[_0x7222('0x1a')]('/:id/contacts',auth[_0x7222('0xa')](),controller[_0x7222('0x1d')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0x7222('0x1a')](_0x7222('0x18'),auth['isAuthenticated'](),controller[_0x7222('0x1e')]);router[_0x7222('0x1f')](_0x7222('0xf'),auth[_0x7222('0xa')](),controller[_0x7222('0x20')]);router[_0x7222('0x21')](_0x7222('0xf'),auth[_0x7222('0xa')](),controller[_0x7222('0x22')]);router[_0x7222('0x21')](_0x7222('0x11'),auth[_0x7222('0xa')](),controller[_0x7222('0x23')]);router[_0x7222('0x21')](_0x7222('0x18'),auth[_0x7222('0xa')](),controller[_0x7222('0x24')]);module[_0x7222('0x25')]=router;
\ No newline at end of file
index 7ee738d..12643fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc44d=['STRING','sequelize','VIRTUAL','field'];(function(_0xf50032,_0x397169){var _0x2a83d9=function(_0x336e86){while(--_0x336e86){_0xf50032['push'](_0xf50032['shift']());}};_0x2a83d9(++_0x397169);}(_0xc44d,0x18d));var _0xdc44=function(_0x1a321b,_0x1b2ce9){_0x1a321b=_0x1a321b-0x0;var _0x22fa1a=_0xc44d[_0x1a321b];return _0x22fa1a;};'use strict';var Sequelize=require(_0xdc44('0x0'));module['exports']={'name':{'type':Sequelize[_0xdc44('0x1')],'get':function(_0x27bbd3){return this['getDataValue'](_0xdc44('0x2'));}},'field':{'type':Sequelize[_0xdc44('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xdc44('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xdc44('0x3')],'allowNull':![]}};
\ No newline at end of file
+var _0x1a1e=['getDataValue','STRING','sequelize','exports'];(function(_0x111be7,_0x45b6cb){var _0x5c4c5e=function(_0x352dc4){while(--_0x352dc4){_0x111be7['push'](_0x111be7['shift']());}};_0x5c4c5e(++_0x45b6cb);}(_0x1a1e,0x106));var _0xe1a1=function(_0xa04daf,_0x25e602){_0xa04daf=_0xa04daf-0x0;var _0x3f7fa6=_0x1a1e[_0xa04daf];return _0x3f7fa6;};'use strict';var Sequelize=require(_0xe1a1('0x0'));module[_0xe1a1('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4885e0){return this[_0xe1a1('0x2')]('field');}},'field':{'type':Sequelize[_0xe1a1('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xe1a1('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xe1a1('0x3')],'allowNull':![]}};
\ No newline at end of file
index 1f9ce39..830a386 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x161e89,_0x387d33){var _0x3d6a0e=function(_0x385ad0){while(--_0x385ad0){_0x161e89['push'](_0x161e89['shift']());}};_0x3d6a0e(++_0x387d33);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));};
\ No newline at end of file
+var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x37d550,_0x2ea910){var _0x401427=function(_0x25a48c){while(--_0x25a48c){_0x37d550['push'](_0x37d550['shift']());}};_0x401427(++_0x2ea910);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));};
\ No newline at end of file
index 2e93eb9..f888aab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9919=['rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','api','moment','bluebird','request-promise','path'];(function(_0x249c0c,_0x22dcc4){var _0x5da81d=function(_0x247e86){while(--_0x247e86){_0x249c0c['push'](_0x249c0c['shift']());}};_0x5da81d(++_0x22dcc4);}(_0x9919,0x66));var _0x9991=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0x9919[_0x3d34f0];return _0x135ecd;};'use strict';var _=require(_0x9991('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9991('0x1'));var moment=require(_0x9991('0x2'));var BPromise=require(_0x9991('0x3'));var rp=require(_0x9991('0x4'));var fs=require('fs');var path=require(_0x9991('0x5'));var rimraf=require(_0x9991('0x6'));var config=require(_0x9991('0x7'));var attributes=require(_0x9991('0x8'));module[_0x9991('0x9')]=function(_0x339b85,_0x20cfcd){return _0x339b85['define'](_0x9991('0xa'),attributes,{'tableName':_0x9991('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc879=['path','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1e1d32,_0x13c313){var _0x1b0bd8=function(_0x3d8f7e){while(--_0x3d8f7e){_0x1e1d32['push'](_0x1e1d32['shift']());}};_0x1b0bd8(++_0x13c313);}(_0xc879,0x165));var _0x9c87=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xc879[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x9c87('0x0'));var util=require(_0x9c87('0x1'));var logger=require(_0x9c87('0x2'))(_0x9c87('0x3'));var moment=require('moment');var BPromise=require(_0x9c87('0x4'));var rp=require(_0x9c87('0x5'));var fs=require('fs');var path=require(_0x9c87('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c87('0x7'));module[_0x9c87('0x8')]=function(_0x23e604,_0x4919d7){return _0x23e604[_0x9c87('0x9')]('Condition',attributes,{'tableName':_0x9c87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 70bcc85..e729da0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c45=['then','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x7c45,0x1be));var _0x57c4=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x7c45[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require(_0x57c4('0x0'));var moment=require(_0x57c4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57c4('0x2'));var db=require(_0x57c4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x57c4('0x4'))(_0x57c4('0x5'));var config=require('../../config/environment');var jayson=require(_0x57c4('0x6'));var client=jayson[_0x57c4('0x7')][_0x57c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb9f01a,_0x511f63,_0x35a4e9){return new BPromise(function(_0x4abeae,_0x4d3205){return client[_0x57c4('0x9')](_0xb9f01a,_0x35a4e9)[_0x57c4('0xa')](function(_0x85b521){logger['info'](_0x57c4('0xb'),_0x511f63,'request\x20sent');logger['debug'](_0x57c4('0xc'),_0x511f63,'request\x20sent',JSON['stringify'](_0x85b521));if(_0x85b521[_0x57c4('0xd')]){if(_0x85b521[_0x57c4('0xd')]['code']===0x1f4){logger[_0x57c4('0xd')](_0x57c4('0xb'),_0x511f63,_0x85b521[_0x57c4('0xd')][_0x57c4('0xe')]);return _0x4d3205(_0x85b521[_0x57c4('0xd')][_0x57c4('0xe')]);}logger[_0x57c4('0xd')]('Condition,\x20%s,\x20%s',_0x511f63,_0x85b521[_0x57c4('0xd')][_0x57c4('0xe')]);return _0x4abeae(_0x85b521['error'][_0x57c4('0xe')]);}else{logger[_0x57c4('0xf')](_0x57c4('0xb'),_0x511f63,_0x57c4('0x10'));_0x4abeae(_0x85b521[_0x57c4('0x11')][_0x57c4('0xe')]);}})[_0x57c4('0x12')](function(_0x5df54f){logger[_0x57c4('0xd')]('Condition,\x20%s,\x20%s',_0x511f63,_0x5df54f);_0x4d3205(_0x5df54f);});});}
\ No newline at end of file
+var _0x9265=['../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x398592,_0x1eb56c){var _0x3caaf2=function(_0x5023ed){while(--_0x5023ed){_0x398592['push'](_0x398592['shift']());}};_0x3caaf2(++_0x1eb56c);}(_0x9265,0x13b));var _0x5926=function(_0x56985b,_0x678773){_0x56985b=_0x56985b-0x0;var _0x1748c4=_0x9265[_0x56985b];return _0x1748c4;};'use strict';var _=require(_0x5926('0x0'));var util=require(_0x5926('0x1'));var moment=require(_0x5926('0x2'));var BPromise=require(_0x5926('0x3'));var rs=require(_0x5926('0x4'));var fs=require('fs');var Redis=require(_0x5926('0x5'));var db=require(_0x5926('0x6'))['db'];var utils=require(_0x5926('0x7'));var logger=require(_0x5926('0x8'))(_0x5926('0x9'));var config=require(_0x5926('0xa'));var jayson=require(_0x5926('0xb'));var client=jayson[_0x5926('0xc')][_0x5926('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4a985f,_0x1937fa,_0x2419a3){return new BPromise(function(_0xc8975b,_0x1255e2){return client['request'](_0x4a985f,_0x2419a3)[_0x5926('0xe')](function(_0x22336d){logger[_0x5926('0xf')](_0x5926('0x10'),_0x1937fa,_0x5926('0x11'));logger[_0x5926('0x12')](_0x5926('0x13'),_0x1937fa,_0x5926('0x11'),JSON[_0x5926('0x14')](_0x22336d));if(_0x22336d[_0x5926('0x15')]){if(_0x22336d['error']['code']===0x1f4){logger[_0x5926('0x15')]('Condition,\x20%s,\x20%s',_0x1937fa,_0x22336d[_0x5926('0x15')][_0x5926('0x16')]);return _0x1255e2(_0x22336d[_0x5926('0x15')][_0x5926('0x16')]);}logger[_0x5926('0x15')](_0x5926('0x10'),_0x1937fa,_0x22336d[_0x5926('0x15')][_0x5926('0x16')]);return _0xc8975b(_0x22336d['error']['message']);}else{logger['info'](_0x5926('0x10'),_0x1937fa,'request\x20sent');_0xc8975b(_0x22336d[_0x5926('0x17')]['message']);}})[_0x5926('0x18')](function(_0x1d272d){logger['error'](_0x5926('0x10'),_0x1937fa,_0x1d272d);_0x1255e2(_0x1d272d);});});}
\ No newline at end of file
index 10b3569..43a41fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa585=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','path','express'];(function(_0x4c3fc8,_0x42d92e){var _0x5596f6=function(_0x5047f8){while(--_0x5047f8){_0x4c3fc8['push'](_0x4c3fc8['shift']());}};_0x5596f6(++_0x42d92e);}(_0xa585,0x1cc));var _0x5a58=function(_0x16eb6d,_0x5625cf){_0x16eb6d=_0x16eb6d-0x0;var _0x50614c=_0xa585[_0x16eb6d];return _0x50614c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5a58('0x0'));var timeout=require('connect-timeout');var express=require(_0x5a58('0x1'));var router=express[_0x5a58('0x2')]();var fs_extra=require(_0x5a58('0x3'));var auth=require(_0x5a58('0x4'));var interaction=require(_0x5a58('0x5'));var config=require(_0x5a58('0x6'));var controller=require(_0x5a58('0x7'));router[_0x5a58('0x8')](_0x5a58('0x9'),auth[_0x5a58('0xa')](),controller[_0x5a58('0xb')]);router[_0x5a58('0xc')]('/:id',auth[_0x5a58('0xa')](),controller[_0x5a58('0xd')]);module['exports']=router;
\ No newline at end of file
+var _0xbd9c=['Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','util','express'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xbd9c,0xf5));var _0xcbd9=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0xbd9c[_0x5f08a6];return _0x5d0641;};'use strict';var multer=require('multer');var util=require(_0xcbd9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd9('0x1'));var router=express[_0xcbd9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcbd9('0x3'));var interaction=require(_0xcbd9('0x4'));var config=require('../../config/environment');var controller=require(_0xcbd9('0x5'));router[_0xcbd9('0x6')](_0xcbd9('0x7'),auth[_0xcbd9('0x8')](),controller[_0xcbd9('0x9')]);router[_0xcbd9('0xa')](_0xcbd9('0x7'),auth[_0xcbd9('0x8')](),controller[_0xcbd9('0xb')]);module[_0xcbd9('0xc')]=router;
\ No newline at end of file
index 8a77e42..95494e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc74b=['sequelize','STRING','name','INTEGER'];(function(_0x150a8b,_0x8f4e20){var _0x4879c0=function(_0x1b1e3d){while(--_0x1b1e3d){_0x150a8b['push'](_0x150a8b['shift']());}};_0x4879c0(++_0x8f4e20);}(_0xc74b,0x88));var _0xbc74=function(_0x18bca9,_0x3034e1){_0x18bca9=_0x18bca9-0x0;var _0x3bb1b0=_0xc74b[_0x18bca9];return _0x3bb1b0;};'use strict';var Sequelize=require(_0xbc74('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc74('0x1')],'allowNull':![],'unique':_0xbc74('0x2')},'OrderBy':{'type':Sequelize[_0xbc74('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbc74('0x1')],'allowNull':!![]}};
\ No newline at end of file
+var _0x8b60=['STRING','name','INTEGER','sequelize','exports'];(function(_0x177735,_0x409055){var _0x1e6aff=function(_0x402138){while(--_0x402138){_0x177735['push'](_0x177735['shift']());}};_0x1e6aff(++_0x409055);}(_0x8b60,0x1d4));var _0x08b6=function(_0x508168,_0x40f494){_0x508168=_0x508168-0x0;var _0xfaac9a=_0x8b60[_0x508168];return _0xfaac9a;};'use strict';var Sequelize=require(_0x08b6('0x0'));module[_0x08b6('0x1')]={'name':{'type':Sequelize[_0x08b6('0x2')],'allowNull':![],'unique':_0x08b6('0x3')},'OrderBy':{'type':Sequelize[_0x08b6('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x08b6('0x2')],'allowNull':!![]}};
\ No newline at end of file
index 5be5a9c..e4fc035 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63a5=['end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x63a5,0x18e));var _0x563a=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x63a5[_0x11ce46];return _0x368a1e;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['ContactItemType'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](db[_0x563a('0x54')][_0x563a('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x22cc91[_0x563a('0x47')]['id']}}))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));};
\ No newline at end of file
+var _0x0abf=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','ContactItemType','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','destroy','CmContactHasItem','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x2cb718,_0x547aa2){var _0x3c7d8d=function(_0x25b329){while(--_0x25b329){_0x2cb718['push'](_0x2cb718['shift']());}};_0x3c7d8d(++_0x547aa2);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){var _0x4eee21=_0x43119f[_0xf0ab('0x26')]({'plain':!![]});var _0x4f0caf=_0xf0ab('0x27');return db[_0xf0ab('0x28')]['destroy']({'where':{'type':_0x4f0caf,'resourceId':_0x4eee21['id']}})[_0xf0ab('0x25')](function(){return _0x43119f;});})[_0xf0ab('0x25')](function(){_0x36ad01[_0xf0ab('0x18')](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x7d4ff9,_0x502921){return function(_0x2d0da7){if(!_0x2d0da7){_0x7d4ff9['sendStatus'](0x194);}return _0x2d0da7;};}function handleError(_0x55d799,_0x1dcd2e){_0x1dcd2e=_0x1dcd2e||0x1f4;return function(_0x4306c6){logger[_0xf0ab('0x29')](_0x4306c6[_0xf0ab('0x2a')]);if(_0x4306c6[_0xf0ab('0x2b')]){delete _0x4306c6[_0xf0ab('0x2b')];}_0x55d799[_0xf0ab('0x18')](_0x1dcd2e)[_0xf0ab('0x2c')](_0x4306c6);};}exports[_0xf0ab('0x2d')]=function(_0x2f0fcd,_0x21e8ac){var _0x199753={},_0x58cbe1={},_0x1e1ffb={'count':0x0,'rows':[]};var _0x35973a=_['map'](db['ContactItemType'][_0xf0ab('0x2e')],function(_0x1dc84e){return{'name':_0x1dc84e[_0xf0ab('0x2f')],'type':_0x1dc84e['type']['key']};});_0x58cbe1[_0xf0ab('0x30')]=_['map'](_0x35973a,_0xf0ab('0x2b'));_0x58cbe1['query']=_[_0xf0ab('0x31')](_0x2f0fcd[_0xf0ab('0x32')]);_0x58cbe1['filters']=_['intersection'](_0x58cbe1[_0xf0ab('0x30')],_0x58cbe1[_0xf0ab('0x32')]);_0x199753[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x58cbe1[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x199753[_0xf0ab('0x33')]=_0x199753[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x199753[_0xf0ab('0x33')]:_0x58cbe1[_0xf0ab('0x30')];if(!_0x2f0fcd[_0xf0ab('0x32')]['hasOwnProperty'](_0xf0ab('0x37'))){_0x199753[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x2f0fcd['query'][_0xf0ab('0x1d')]);_0x199753[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x2f0fcd['query'][_0xf0ab('0x1b')]);}_0x199753['order']=qs[_0xf0ab('0x38')](_0x2f0fcd['query'][_0xf0ab('0x38')]);_0x199753[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x2f0fcd[_0xf0ab('0x32')],_0x58cbe1[_0xf0ab('0x3a')]),_0x35973a);if(_0x2f0fcd['query'][_0xf0ab('0x3c')]){_0x199753[_0xf0ab('0x39')]=_['merge'](_0x199753[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x35973a,function(_0x1d4eec){if(_0x1d4eec[_0xf0ab('0x3e')]!==_0xf0ab('0x3f')){var _0x11e3b7={};_0x11e3b7[_0x1d4eec[_0xf0ab('0x2b')]]={'$like':'%'+_0x2f0fcd['query'][_0xf0ab('0x3c')]+'%'};return _0x11e3b7;}})});}_0x199753=_[_0xf0ab('0x40')]({},_0x199753,_0x2f0fcd[_0xf0ab('0x41')]);var _0x4bd6d1={'where':_0x199753[_0xf0ab('0x39')]};return db[_0xf0ab('0x42')][_0xf0ab('0x1e')](_0x4bd6d1)[_0xf0ab('0x25')](function(_0x2b7ed5){_0x1e1ffb['count']=_0x2b7ed5;if(_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x43')]){_0x199753[_0xf0ab('0x44')]=[{'all':!![]}];}return db[_0xf0ab('0x42')][_0xf0ab('0x45')](_0x199753);})[_0xf0ab('0x25')](function(_0x45849c){_0x1e1ffb[_0xf0ab('0x46')]=_0x45849c;return _0x1e1ffb;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x21e8ac,_0x199753))[_0xf0ab('0x47')](handleError(_0x21e8ac,null));};exports[_0xf0ab('0x48')]=function(_0x32ec93,_0x22a265){var _0x5e6b6b={'raw':!![],'where':{'id':_0x32ec93[_0xf0ab('0x49')]['id']}},_0x4c4ab9={};_0x4c4ab9['model']=_[_0xf0ab('0x31')](db[_0xf0ab('0x42')]['rawAttributes']);_0x4c4ab9[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x32ec93['query']);_0x4c4ab9[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],_0x4c4ab9[_0xf0ab('0x32')]);_0x5e6b6b[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x32ec93[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x5e6b6b[_0xf0ab('0x33')]=_0x5e6b6b[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x5e6b6b[_0xf0ab('0x33')]:_0x4c4ab9['model'];if(_0x32ec93['query'][_0xf0ab('0x43')]){_0x5e6b6b['include']=[{'all':!![]}];}_0x5e6b6b=_['merge']({},_0x5e6b6b,_0x32ec93['options']);return db[_0xf0ab('0x42')][_0xf0ab('0x4a')](_0x5e6b6b)[_0xf0ab('0x25')](handleEntityNotFound(_0x22a265,null))[_0xf0ab('0x25')](respondWithResult(_0x22a265,null))[_0xf0ab('0x47')](handleError(_0x22a265,null));};exports[_0xf0ab('0x4b')]=function(_0x472c1b,_0x1a0f21){return db[_0xf0ab('0x42')][_0xf0ab('0x4b')](_0x472c1b[_0xf0ab('0x4c')],{})[_0xf0ab('0x25')](function(_0x4e6c9b){var _0x393c9a=_0x472c1b[_0xf0ab('0x4d')][_0xf0ab('0x26')]({'plain':!![]});if(!_0x393c9a)throw new Error(_0xf0ab('0x4e'));if(_0x393c9a[_0xf0ab('0x4f')]===_0xf0ab('0x4d')){var _0x430921=_0x4e6c9b[_0xf0ab('0x26')]({'plain':!![]});var _0x47f564='ContactItemTypes';return db['UserProfileSection'][_0xf0ab('0x4a')]({'where':{'name':_0x47f564,'userProfileId':_0x393c9a[_0xf0ab('0x50')]},'raw':!![]})['then'](function(_0xa1a416){if(_0xa1a416&&_0xa1a416[_0xf0ab('0x51')]===0x0){return db['UserProfileResource'][_0xf0ab('0x4b')]({'name':_0x430921[_0xf0ab('0x2b')],'resourceId':_0x430921['id'],'type':_0xa1a416[_0xf0ab('0x2b')],'sectionId':_0xa1a416['id']},{})[_0xf0ab('0x25')](function(){return _0x4e6c9b;});}else{return _0x4e6c9b;}})[_0xf0ab('0x47')](function(_0x33112b){logger[_0xf0ab('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33112b);throw _0x33112b;});}return _0x4e6c9b;})[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,0xc9))['catch'](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x24')]=function(_0x4c9d2b,_0x1a402b){if(_0x4c9d2b['body']['id']){delete _0x4c9d2b['body']['id'];}return db[_0xf0ab('0x42')]['find']({'where':{'id':_0x4c9d2b[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a402b,null))[_0xf0ab('0x25')](saveUpdates(_0x4c9d2b['body'],null))[_0xf0ab('0x25')](respondWithResult(_0x1a402b,null))[_0xf0ab('0x47')](handleError(_0x1a402b,null));};exports[_0xf0ab('0x52')]=function(_0x57f9dd,_0x47f270){return db['ContactItemType'][_0xf0ab('0x4a')]({'where':{'id':_0x57f9dd[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x47f270,null))['then'](db[_0xf0ab('0x53')][_0xf0ab('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x57f9dd[_0xf0ab('0x49')]['id']}}))[_0xf0ab('0x25')](removeEntity(_0x47f270,null))[_0xf0ab('0x47')](handleError(_0x47f270,null));};
\ No newline at end of file
index 1f387e8..6e2fa01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf42d=['api','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','../../config/logger'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xf42d,0x8c));var _0xdf42=function(_0x5a95db,_0x501b0e){_0x5a95db=_0x5a95db-0x0;var _0x25efdd=_0xf42d[_0x5a95db];return _0x25efdd;};'use strict';var _=require(_0xdf42('0x0'));var util=require(_0xdf42('0x1'));var logger=require(_0xdf42('0x2'))(_0xdf42('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdf42('0x4'));var fs=require('fs');var path=require(_0xdf42('0x5'));var rimraf=require(_0xdf42('0x6'));var config=require('../../config/environment');var attributes=require(_0xdf42('0x7'));module[_0xdf42('0x8')]=function(_0x3f4a6a,_0x2fcf94){return _0x3f4a6a[_0xdf42('0x9')](_0xdf42('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4d16=['path','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xbda95a,_0x57b159){var _0x4ec880=function(_0x489dd0){while(--_0x489dd0){_0xbda95a['push'](_0xbda95a['shift']());}};_0x4ec880(++_0x57b159);}(_0x4d16,0xb6));var _0x64d1=function(_0x31f0ac,_0x20f326){_0x31f0ac=_0x31f0ac-0x0;var _0x22168f=_0x4d16[_0x31f0ac];return _0x22168f;};'use strict';var _=require(_0x64d1('0x0'));var util=require('util');var logger=require(_0x64d1('0x1'))(_0x64d1('0x2'));var moment=require('moment');var BPromise=require(_0x64d1('0x3'));var rp=require(_0x64d1('0x4'));var fs=require('fs');var path=require(_0x64d1('0x5'));var rimraf=require('rimraf');var config=require(_0x64d1('0x6'));var attributes=require(_0x64d1('0x7'));module[_0x64d1('0x8')]=function(_0x471535,_0x49c168){return _0x471535[_0x64d1('0x9')]('ContactItemType',attributes,{'tableName':_0x64d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 165e632..c79ed6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b67=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ContactItemType,\x20%s,\x20%s','result'];(function(_0x5c83dc,_0x2be76e){var _0x28cdb0=function(_0x1642e1){while(--_0x1642e1){_0x5c83dc['push'](_0x5c83dc['shift']());}};_0x28cdb0(++_0x2be76e);}(_0x6b67,0x118));var _0x76b6=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x6b67[_0x83af7f];return _0x32d85c;};'use strict';var _=require(_0x76b6('0x0'));var util=require(_0x76b6('0x1'));var moment=require(_0x76b6('0x2'));var BPromise=require('bluebird');var rs=require(_0x76b6('0x3'));var fs=require('fs');var Redis=require(_0x76b6('0x4'));var db=require(_0x76b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76b6('0x6'))('rpc');var config=require(_0x76b6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbebe8,_0x1c50db,_0x37f54b){return new BPromise(function(_0x1172ad,_0x33ab0d){return client[_0x76b6('0x8')](_0xbebe8,_0x37f54b)[_0x76b6('0x9')](function(_0x55e4fb){logger[_0x76b6('0xa')]('ContactItemType,\x20%s,\x20%s',_0x1c50db,_0x76b6('0xb'));logger[_0x76b6('0xc')](_0x76b6('0xd'),_0x1c50db,_0x76b6('0xb'),JSON[_0x76b6('0xe')](_0x55e4fb));if(_0x55e4fb[_0x76b6('0xf')]){if(_0x55e4fb[_0x76b6('0xf')][_0x76b6('0x10')]===0x1f4){logger[_0x76b6('0xf')]('ContactItemType,\x20%s,\x20%s',_0x1c50db,_0x55e4fb['error'][_0x76b6('0x11')]);return _0x33ab0d(_0x55e4fb[_0x76b6('0xf')]['message']);}logger[_0x76b6('0xf')](_0x76b6('0x12'),_0x1c50db,_0x55e4fb[_0x76b6('0xf')][_0x76b6('0x11')]);return _0x1172ad(_0x55e4fb[_0x76b6('0xf')][_0x76b6('0x11')]);}else{logger['info'](_0x76b6('0x12'),_0x1c50db,_0x76b6('0xb'));_0x1172ad(_0x55e4fb[_0x76b6('0x13')]['message']);}})['catch'](function(_0x227221){logger[_0x76b6('0xf')](_0x76b6('0x12'),_0x1c50db,_0x227221);_0x33ab0d(_0x227221);});});}
\ No newline at end of file
+var _0x4ec2=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x4ec2,0x196));var _0x24ec=function(_0x563f59,_0x2135bd){_0x563f59=_0x563f59-0x0;var _0x3ab255=_0x4ec2[_0x563f59];return _0x3ab255;};'use strict';var _=require('lodash');var util=require(_0x24ec('0x0'));var moment=require(_0x24ec('0x1'));var BPromise=require(_0x24ec('0x2'));var rs=require(_0x24ec('0x3'));var fs=require('fs');var Redis=require(_0x24ec('0x4'));var db=require(_0x24ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x24ec('0x6'))(_0x24ec('0x7'));var config=require(_0x24ec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x24ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c45f1,_0x4473ed,_0x431919){return new BPromise(function(_0x4a74a1,_0xd0cc35){return client[_0x24ec('0xa')](_0x3c45f1,_0x431919)[_0x24ec('0xb')](function(_0x4fbf49){logger['info']('ContactItemType,\x20%s,\x20%s',_0x4473ed,'request\x20sent');logger[_0x24ec('0xc')](_0x24ec('0xd'),_0x4473ed,_0x24ec('0xe'),JSON[_0x24ec('0xf')](_0x4fbf49));if(_0x4fbf49[_0x24ec('0x10')]){if(_0x4fbf49[_0x24ec('0x10')][_0x24ec('0x11')]===0x1f4){logger[_0x24ec('0x10')](_0x24ec('0x12'),_0x4473ed,_0x4fbf49[_0x24ec('0x10')][_0x24ec('0x13')]);return _0xd0cc35(_0x4fbf49[_0x24ec('0x10')][_0x24ec('0x13')]);}logger[_0x24ec('0x10')](_0x24ec('0x12'),_0x4473ed,_0x4fbf49['error'][_0x24ec('0x13')]);return _0x4a74a1(_0x4fbf49[_0x24ec('0x10')][_0x24ec('0x13')]);}else{logger[_0x24ec('0x14')]('ContactItemType,\x20%s,\x20%s',_0x4473ed,_0x24ec('0xe'));_0x4a74a1(_0x4fbf49[_0x24ec('0x15')][_0x24ec('0x13')]);}})['catch'](function(_0xeccaa5){logger[_0x24ec('0x10')](_0x24ec('0x12'),_0x4473ed,_0xeccaa5);_0xd0cc35(_0xeccaa5);});});}
\ No newline at end of file
index 30292d9..af67e27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f93=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','show','post','put','update','delete','/:id','destroy','exports','connect-timeout','express','Router'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0x7f93,0x153));var _0x37f9=function(_0x421d76,_0xdf1f19){_0x421d76=_0x421d76-0x0;var _0x27b01a=_0x7f93[_0x421d76];return _0x27b01a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x37f9('0x0'));var express=require(_0x37f9('0x1'));var router=express[_0x37f9('0x2')]();var fs_extra=require(_0x37f9('0x3'));var auth=require(_0x37f9('0x4'));var interaction=require(_0x37f9('0x5'));var config=require(_0x37f9('0x6'));var controller=require(_0x37f9('0x7'));router['get']('/',auth[_0x37f9('0x8')](),controller[_0x37f9('0x9')]);router[_0x37f9('0xa')]('/:id',auth[_0x37f9('0x8')](),controller[_0x37f9('0xb')]);router[_0x37f9('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x37f9('0xd')]('/:id',auth[_0x37f9('0x8')](),controller[_0x37f9('0xe')]);router[_0x37f9('0xf')](_0x37f9('0x10'),auth['isAuthenticated'](),controller[_0x37f9('0x11')]);module[_0x37f9('0x12')]=router;
\ No newline at end of file
+var _0x503c=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x37c464,_0x335a10){var _0xc1c63b=function(_0x40816f){while(--_0x40816f){_0x37c464['push'](_0x37c464['shift']());}};_0xc1c63b(++_0x335a10);}(_0x503c,0x146));var _0xc503=function(_0x3c6166,_0x51a9fe){_0x3c6166=_0x3c6166-0x0;var _0x215b27=_0x503c[_0x3c6166];return _0x215b27;};'use strict';var multer=require('multer');var util=require(_0xc503('0x0'));var path=require('path');var timeout=require(_0xc503('0x1'));var express=require(_0xc503('0x2'));var router=express[_0xc503('0x3')]();var fs_extra=require(_0xc503('0x4'));var auth=require(_0xc503('0x5'));var interaction=require(_0xc503('0x6'));var config=require(_0xc503('0x7'));var controller=require('./contactItemType.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc503('0x8')]);router['get'](_0xc503('0x9'),auth[_0xc503('0xa')](),controller[_0xc503('0xb')]);router[_0xc503('0xc')]('/',auth[_0xc503('0xa')](),controller[_0xc503('0xd')]);router[_0xc503('0xe')](_0xc503('0x9'),auth[_0xc503('0xa')](),controller['update']);router[_0xc503('0xf')]('/:id',auth[_0xc503('0xa')](),controller[_0xc503('0x10')]);module[_0xc503('0x11')]=router;
\ No newline at end of file
index f1dae97..486ac22 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['name','sequelize','STRING'];(function(_0x181b98,_0x1ad65e){var _0x1969a3=function(_0x486a12){while(--_0x486a12){_0x181b98['push'](_0x181b98['shift']());}};_0x1969a3(++_0x1ad65e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2558ee,_0x2a2574){_0x2558ee=_0x2558ee-0x0;var _0x431306=_0xb10b[_0x2558ee];return _0x431306;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}};
\ No newline at end of file
+var _0x2032=['name','exports','STRING'];(function(_0x421c06,_0x3a6275){var _0x5098ea=function(_0x1e7ac5){while(--_0x1e7ac5){_0x421c06['push'](_0x421c06['shift']());}};_0x5098ea(++_0x3a6275);}(_0x2032,0xd9));var _0x2203=function(_0x1ce46f,_0x187eb3){_0x1ce46f=_0x1ce46f-0x0;var _0x57c1eb=_0x2032[_0x1ce46f];return _0x57c1eb;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index a32d672..adb4c26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa3c9=['attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','get','CustomDashboards','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','merge','where','VIRTUAL','filter','findAll','rows','show','params','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','autoAssociation','update','iframe','attrUrl'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa3c9,0x1b8));var _0x9a3c=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xa3c9[_0x46f1a6];return _0x38429a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a3c('0x0'));var zipdir=require(_0x9a3c('0x1'));var jsonpatch=require(_0x9a3c('0x2'));var rp=require(_0x9a3c('0x3'));var moment=require(_0x9a3c('0x4'));var BPromise=require(_0x9a3c('0x5'));var Mustache=require(_0x9a3c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a3c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a3c('0x8'));var _=require(_0x9a3c('0x9'));var squel=require(_0x9a3c('0xa'));var crypto=require(_0x9a3c('0xb'));var jsforce=require(_0x9a3c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a3c('0xd'));var Papa=require(_0x9a3c('0xe'));var Redis=require('ioredis');var authService=require(_0x9a3c('0xf'));var qs=require(_0x9a3c('0x10'));var as=require(_0x9a3c('0x11'));var hardwareService=require(_0x9a3c('0x12'));var logger=require(_0x9a3c('0x13'))(_0x9a3c('0x14'));var utils=require('../../config/utils');var config=require(_0x9a3c('0x15'));var licenseUtil=require(_0x9a3c('0x16'));var db=require(_0x9a3c('0x17'))['db'];config[_0x9a3c('0x18')]=_[_0x9a3c('0x19')](config[_0x9a3c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a3c('0x1a'))(new Redis(config[_0x9a3c('0x18')]));require(_0x9a3c('0x1b'))[_0x9a3c('0x1c')](socket);function respondWithStatusCode(_0x2de8d4,_0x271677){_0x271677=_0x271677||0xcc;return function(_0x4f4753){if(_0x4f4753){return _0x2de8d4['sendStatus'](_0x271677);}return _0x2de8d4[_0x9a3c('0x1d')](_0x271677)[_0x9a3c('0x1e')]();};}function respondWithResult(_0x167650,_0x30033f){_0x30033f=_0x30033f||0xc8;return function(_0x1195b4){if(_0x1195b4){return _0x167650[_0x9a3c('0x1d')](_0x30033f)[_0x9a3c('0x1f')](_0x1195b4);}};}function respondWithFilteredResult(_0x228bb1,_0x5950af){return function(_0x271964){if(_0x271964){var _0x565aaa=typeof _0x5950af[_0x9a3c('0x20')]===_0x9a3c('0x21')&&typeof _0x5950af['limit']===_0x9a3c('0x21');var _0x512e67=_0x271964[_0x9a3c('0x22')];var _0x5a4a09=_0x565aaa?0x0:_0x5950af[_0x9a3c('0x20')];var _0x1d5698=_0x565aaa?_0x271964[_0x9a3c('0x22')]:_0x5950af[_0x9a3c('0x20')]+_0x5950af['limit'];var _0x23ebd4;if(_0x1d5698>=_0x512e67){_0x1d5698=_0x512e67;_0x23ebd4=0xc8;}else{_0x23ebd4=0xce;}_0x228bb1[_0x9a3c('0x1d')](_0x23ebd4);return _0x228bb1[_0x9a3c('0x23')](_0x9a3c('0x24'),_0x5a4a09+'-'+_0x1d5698+'/'+_0x512e67)[_0x9a3c('0x1f')](_0x271964);}return null;};}function patchUpdates(_0x25413f){return function(_0xdf96dd){try{jsonpatch['apply'](_0xdf96dd,_0x25413f,!![]);}catch(_0xc30240){return BPromise[_0x9a3c('0x25')](_0xc30240);}return _0xdf96dd[_0x9a3c('0x26')]();};}function saveUpdates(_0x5e0447,_0x9c49b6){return function(_0x559753){if(_0x559753){return _0x559753['update'](_0x5e0447)[_0x9a3c('0x27')](function(_0x51dbc2){return _0x51dbc2;});}return null;};}function removeEntity(_0x46eb06,_0x355420){return function(_0x4e59f0){if(_0x4e59f0){return _0x4e59f0[_0x9a3c('0x28')]()['then'](function(){var _0x57cf52=_0x4e59f0[_0x9a3c('0x29')]({'plain':!![]});var _0x2aca05=_0x9a3c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2aca05,'resourceId':_0x57cf52['id']}})['then'](function(){return _0x4e59f0;});})[_0x9a3c('0x27')](function(){_0x46eb06['status'](0xcc)[_0x9a3c('0x1e')]();});}};}function handleEntityNotFound(_0x276dad,_0x189e9c){return function(_0xa95ff1){if(!_0xa95ff1){_0x276dad['sendStatus'](0x194);}return _0xa95ff1;};}function handleError(_0x36e9d7,_0x2720cf){_0x2720cf=_0x2720cf||0x1f4;return function(_0x13f4ea){logger['error'](_0x13f4ea[_0x9a3c('0x2b')]);if(_0x13f4ea[_0x9a3c('0x2c')]){delete _0x13f4ea[_0x9a3c('0x2c')];}_0x36e9d7[_0x9a3c('0x1d')](_0x2720cf)[_0x9a3c('0x2d')](_0x13f4ea);};}exports[_0x9a3c('0x2e')]=function(_0x2b7c01,_0x1722c2){var _0x59e17d={},_0x1ed06d={},_0x49ab6c={'count':0x0,'rows':[]};var _0x50203e=_['map'](db[_0x9a3c('0x2f')][_0x9a3c('0x30')],function(_0x19e556){return{'name':_0x19e556[_0x9a3c('0x31')],'type':_0x19e556[_0x9a3c('0x32')][_0x9a3c('0x33')]};});_0x1ed06d[_0x9a3c('0x34')]=_['map'](_0x50203e,_0x9a3c('0x2c'));_0x1ed06d[_0x9a3c('0x35')]=_[_0x9a3c('0x36')](_0x2b7c01['query']);_0x1ed06d[_0x9a3c('0x37')]=_['intersection'](_0x1ed06d[_0x9a3c('0x34')],_0x1ed06d[_0x9a3c('0x35')]);_0x59e17d['attributes']=_[_0x9a3c('0x38')](_0x1ed06d[_0x9a3c('0x34')],qs['fields'](_0x2b7c01[_0x9a3c('0x35')][_0x9a3c('0x39')]));_0x59e17d[_0x9a3c('0x3a')]=_0x59e17d[_0x9a3c('0x3a')][_0x9a3c('0x3b')]?_0x59e17d[_0x9a3c('0x3a')]:_0x1ed06d[_0x9a3c('0x34')];if(!_0x2b7c01[_0x9a3c('0x35')]['hasOwnProperty'](_0x9a3c('0x3c'))){_0x59e17d[_0x9a3c('0x3d')]=qs['limit'](_0x2b7c01[_0x9a3c('0x35')][_0x9a3c('0x3d')]);_0x59e17d[_0x9a3c('0x20')]=qs[_0x9a3c('0x20')](_0x2b7c01[_0x9a3c('0x35')][_0x9a3c('0x20')]);}_0x59e17d[_0x9a3c('0x3e')]=qs[_0x9a3c('0x3f')](_0x2b7c01[_0x9a3c('0x35')][_0x9a3c('0x3f')]);_0x59e17d['where']=qs[_0x9a3c('0x37')](_[_0x9a3c('0x40')](_0x2b7c01[_0x9a3c('0x35')],_0x1ed06d[_0x9a3c('0x37')]),_0x50203e);if(_0x2b7c01[_0x9a3c('0x35')]['filter']){_0x59e17d['where']=_[_0x9a3c('0x41')](_0x59e17d[_0x9a3c('0x42')],{'$or':_['map'](_0x50203e,function(_0x328634){if(_0x328634[_0x9a3c('0x32')]!==_0x9a3c('0x43')){var _0x12a55f={};_0x12a55f[_0x328634[_0x9a3c('0x2c')]]={'$like':'%'+_0x2b7c01[_0x9a3c('0x35')][_0x9a3c('0x44')]+'%'};return _0x12a55f;}})});}_0x59e17d=_[_0x9a3c('0x41')]({},_0x59e17d,_0x2b7c01['options']);var _0x57f38e={'where':_0x59e17d[_0x9a3c('0x42')]};return db[_0x9a3c('0x2f')][_0x9a3c('0x22')](_0x57f38e)[_0x9a3c('0x27')](function(_0x2dbcf0){_0x49ab6c['count']=_0x2dbcf0;if(_0x2b7c01[_0x9a3c('0x35')]['includeAll']){_0x59e17d['include']=[{'all':!![]}];}return db[_0x9a3c('0x2f')][_0x9a3c('0x45')](_0x59e17d);})['then'](function(_0x4d0f6c){_0x49ab6c[_0x9a3c('0x46')]=_0x4d0f6c;return _0x49ab6c;})[_0x9a3c('0x27')](respondWithFilteredResult(_0x1722c2,_0x59e17d))['catch'](handleError(_0x1722c2,null));};exports[_0x9a3c('0x47')]=function(_0x3aad3a,_0x42d54a){var _0x25a8c5={'raw':![],'where':{'id':_0x3aad3a[_0x9a3c('0x48')]['id']}},_0x20c78a={};_0x20c78a['model']=_[_0x9a3c('0x36')](db[_0x9a3c('0x2f')][_0x9a3c('0x30')]);_0x20c78a[_0x9a3c('0x35')]=_[_0x9a3c('0x36')](_0x3aad3a[_0x9a3c('0x35')]);_0x20c78a['filters']=_['intersection'](_0x20c78a['model'],_0x20c78a['query']);_0x25a8c5['attributes']=_[_0x9a3c('0x38')](_0x20c78a[_0x9a3c('0x34')],qs['fields'](_0x3aad3a[_0x9a3c('0x35')][_0x9a3c('0x39')]));_0x25a8c5[_0x9a3c('0x3a')]=_0x25a8c5['attributes'][_0x9a3c('0x3b')]?_0x25a8c5[_0x9a3c('0x3a')]:_0x20c78a[_0x9a3c('0x34')];if(_0x3aad3a['query'][_0x9a3c('0x49')]){_0x25a8c5[_0x9a3c('0x4a')]=[{'all':!![]}];}_0x25a8c5=_['merge']({},_0x25a8c5,_0x3aad3a[_0x9a3c('0x4b')]);return db['Dashboard'][_0x9a3c('0x4c')](_0x25a8c5)['then'](handleEntityNotFound(_0x42d54a,null))['then'](respondWithResult(_0x42d54a,null))['catch'](handleError(_0x42d54a,null));};exports[_0x9a3c('0x4d')]=function(_0x214a7e,_0x275669){return db[_0x9a3c('0x2f')][_0x9a3c('0x4d')](_0x214a7e['body'],{})[_0x9a3c('0x27')](function(_0x46f51b){var _0x5289bc=_0x214a7e[_0x9a3c('0x4e')]['get']({'plain':!![]});if(!_0x5289bc)throw new Error(_0x9a3c('0x4f'));if(_0x5289bc[_0x9a3c('0x50')]===_0x9a3c('0x4e')){var _0x4b3492=_0x46f51b[_0x9a3c('0x29')]({'plain':!![]});var _0x43eef0=_0x9a3c('0x2a');return db[_0x9a3c('0x51')][_0x9a3c('0x4c')]({'where':{'name':_0x43eef0,'userProfileId':_0x5289bc[_0x9a3c('0x52')]},'raw':!![]})[_0x9a3c('0x27')](function(_0x174cd1){if(_0x174cd1&&_0x174cd1['autoAssociation']===0x0){return db[_0x9a3c('0x53')][_0x9a3c('0x4d')]({'name':_0x4b3492[_0x9a3c('0x2c')],'resourceId':_0x4b3492['id'],'type':_0x174cd1[_0x9a3c('0x2c')],'sectionId':_0x174cd1['id']},{})['then'](function(){return _0x46f51b;});}else{return _0x46f51b;}})[_0x9a3c('0x54')](function(_0x54fb38){logger[_0x9a3c('0x55')](_0x9a3c('0x56'),_0x54fb38);throw _0x54fb38;});}return _0x46f51b;})[_0x9a3c('0x27')](respondWithResult(_0x275669,0xc9))[_0x9a3c('0x54')](handleError(_0x275669,null));};exports[_0x9a3c('0x57')]=function(_0x3dd2ec,_0x28ce3a){var _0x35a7ec={'where':{'id':_0x3dd2ec[_0x9a3c('0x48')]['id']}},_0x553d36={};_0x553d36['model']=_[_0x9a3c('0x36')](db['Dashboard'][_0x9a3c('0x30')]);_0x35a7ec[_0x9a3c('0x3a')]=_[_0x9a3c('0x38')](_0x553d36[_0x9a3c('0x34')],qs[_0x9a3c('0x39')](_0x3dd2ec[_0x9a3c('0x35')][_0x9a3c('0x39')]));_0x35a7ec[_0x9a3c('0x3a')]=_0x35a7ec['attributes'][_0x9a3c('0x3b')]?_0x35a7ec[_0x9a3c('0x3a')]:_0x553d36['model'];if(_0x3dd2ec[_0x9a3c('0x35')][_0x9a3c('0x49')]){_0x35a7ec[_0x9a3c('0x4a')]=[{'all':!![]}];}_0x35a7ec=_[_0x9a3c('0x41')]({},_0x35a7ec,_0x3dd2ec[_0x9a3c('0x4b')]);return db[_0x9a3c('0x2f')]['find'](_0x35a7ec)[_0x9a3c('0x27')](handleEntityNotFound(_0x28ce3a,null))['then'](function(_0x8bfe30){if(_0x8bfe30){var _0x34a68b=_0x8bfe30['get']({'plain':!![]});_0x34a68b=qs[_0x9a3c('0x58')](_0x34a68b,['id',_0x9a3c('0x59'),'updatedAt']);_0x3dd2ec[_0x9a3c('0x5a')]=_['omit'](_0x3dd2ec[_0x9a3c('0x5a')],['id',_0x9a3c('0x59'),_0x9a3c('0x5b')]);return db[_0x9a3c('0x2f')][_0x9a3c('0x4d')](_[_0x9a3c('0x41')](_0x34a68b,_0x3dd2ec['body']),{'include':_0x3dd2ec[_0x9a3c('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x9a3c('0x27')](function(_0x39723f){var _0x59ca13=_0x3dd2ec[_0x9a3c('0x4e')]['get']({'plain':!![]});if(!_0x59ca13)throw new Error(_0x9a3c('0x4f'));if(_0x59ca13[_0x9a3c('0x50')]===_0x9a3c('0x4e')){var _0x1f64d1=_0x39723f[_0x9a3c('0x29')]({'plain':!![]});var _0x34aa01=_0x9a3c('0x2a');return db[_0x9a3c('0x51')][_0x9a3c('0x4c')]({'where':{'name':_0x34aa01,'userProfileId':_0x59ca13[_0x9a3c('0x52')]},'raw':!![]})['then'](function(_0x161b11){if(_0x161b11&&_0x161b11[_0x9a3c('0x5c')]===0x0){return db[_0x9a3c('0x53')]['create']({'name':_0x1f64d1[_0x9a3c('0x2c')],'resourceId':_0x1f64d1['id'],'type':_0x161b11[_0x9a3c('0x2c')],'sectionId':_0x161b11['id']},{})[_0x9a3c('0x27')](function(){return _0x39723f;});}else{return _0x39723f;}})[_0x9a3c('0x54')](function(_0x3cec05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cec05);throw _0x3cec05;});}return _0x39723f;});}})['then'](respondWithResult(_0x28ce3a,0xc9))[_0x9a3c('0x54')](handleError(_0x28ce3a,null));};exports[_0x9a3c('0x5d')]=function(_0x420b3e,_0x390cea){if(_0x420b3e[_0x9a3c('0x5a')]['id']){delete _0x420b3e[_0x9a3c('0x5a')]['id'];}return db[_0x9a3c('0x2f')]['find']({'where':{'id':_0x420b3e[_0x9a3c('0x48')]['id']}})[_0x9a3c('0x27')](handleEntityNotFound(_0x390cea,null))[_0x9a3c('0x27')](saveUpdates(_0x420b3e[_0x9a3c('0x5a')],null))[_0x9a3c('0x27')](respondWithResult(_0x390cea,null))['catch'](handleError(_0x390cea,null));};exports[_0x9a3c('0x28')]=function(_0x5b870c,_0x4c2dfc){return db['Dashboard'][_0x9a3c('0x4c')]({'where':{'id':_0x5b870c[_0x9a3c('0x48')]['id']}})[_0x9a3c('0x27')](handleEntityNotFound(_0x4c2dfc,null))[_0x9a3c('0x27')](removeEntity(_0x4c2dfc,null))['catch'](handleError(_0x4c2dfc,null));};function widgetAttributes(_0xeef8f){try{switch(_0xeef8f['type']){case _0x9a3c('0x5e'):return[{'name':_0x9a3c('0x5f'),'value':_0xeef8f[_0x9a3c('0x5f')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0]['value']:undefined)||_0x9a3c('0x61')}];case _0x9a3c('0x62'):return[{'name':'attrPath','value':_0xeef8f[_0x9a3c('0x63')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0][_0x9a3c('0x64')]:undefined)||''}];case _0x9a3c('0x65'):return[{'name':'attrHourFormat','value':_0xeef8f[_0x9a3c('0x66')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0][_0x9a3c('0x64')]:undefined)||_0x9a3c('0x67')},{'name':_0x9a3c('0x68'),'value':_0xeef8f[_0x9a3c('0x68')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x1]?_0xeef8f['attrs'][0x1][_0x9a3c('0x64')]:undefined)||_0x9a3c('0x69')},{'name':_0x9a3c('0x6a'),'value':_0xeef8f[_0x9a3c('0x6a')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x2]?_0xeef8f[_0x9a3c('0x60')][0x2][_0x9a3c('0x64')]:undefined)||0xc}];case'counter':return[{'name':_0x9a3c('0x6b'),'value':_0xeef8f[_0x9a3c('0x6b')]||(_0xeef8f['attrs']&&_0xeef8f[_0x9a3c('0x60')][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0][_0x9a3c('0x64')]:undefined)||_0x9a3c('0x6c')},{'name':_0x9a3c('0x6d'),'value':_0xeef8f[_0x9a3c('0x6d')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x1]?_0xeef8f[_0x9a3c('0x60')][0x1]['value']:undefined)||[]},{'name':_0x9a3c('0x6a'),'value':_0xeef8f[_0x9a3c('0x6a')]||(_0xeef8f['attrs']&&_0xeef8f['attrs'][0x2]?_0xeef8f[_0x9a3c('0x60')][0x2][_0x9a3c('0x64')]:undefined)||0x14},{'name':_0x9a3c('0x6e'),'value':_0xeef8f['attrChannel']||(_0xeef8f['attrs']&&_0xeef8f[_0x9a3c('0x60')][0x3]?_0xeef8f['attrs'][0x3][_0x9a3c('0x64')]:undefined)||_0x9a3c('0x6f')},{'name':_0x9a3c('0x70'),'value':_0xeef8f[_0x9a3c('0x70')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x4]?_0xeef8f[_0x9a3c('0x60')][0x4][_0x9a3c('0x64')]:undefined)||''},{'name':_0x9a3c('0x71'),'value':_0xeef8f[_0x9a3c('0x71')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x5]?_0xeef8f['attrs'][0x5][_0x9a3c('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xeef8f['attrSmsAccounts']||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x6]?_0xeef8f[_0x9a3c('0x60')][0x6][_0x9a3c('0x64')]:undefined)||''},{'name':_0x9a3c('0x72'),'value':_0xeef8f[_0x9a3c('0x72')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x7]?_0xeef8f[_0x9a3c('0x60')][0x7][_0x9a3c('0x64')]:undefined)||''},{'name':_0x9a3c('0x73'),'value':_0xeef8f[_0x9a3c('0x73')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x8]?_0xeef8f[_0x9a3c('0x60')][0x8][_0x9a3c('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0xeef8f[_0x9a3c('0x74')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f['attrs'][0x9]?_0xeef8f[_0x9a3c('0x60')][0x9][_0x9a3c('0x64')]:undefined)||''}];case _0x9a3c('0x75'):case _0x9a3c('0x76'):return[{'name':_0x9a3c('0x77'),'value':_0xeef8f[_0x9a3c('0x77')]||(_0xeef8f['attrs']&&_0xeef8f[_0x9a3c('0x60')][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0][_0x9a3c('0x64')]:undefined)||_0x9a3c('0x6c')},{'name':'attrSerie2','value':_0xeef8f['attrSerie2']||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f['attrs'][0x1]?_0xeef8f[_0x9a3c('0x60')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0xeef8f[_0x9a3c('0x78')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x2]?_0xeef8f['attrs'][0x2][_0x9a3c('0x64')]:undefined)||null},{'name':_0x9a3c('0x6d'),'value':_0xeef8f['attrVoiceQueues']||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x3]?_0xeef8f['attrs'][0x3][_0x9a3c('0x64')]:undefined)||[]},{'name':_0x9a3c('0x6e'),'value':_0xeef8f['attrChannel']||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x4]?_0xeef8f[_0x9a3c('0x60')][0x4][_0x9a3c('0x64')]:undefined)||_0x9a3c('0x6f')},{'name':_0x9a3c('0x70'),'value':_0xeef8f[_0x9a3c('0x70')]||(_0xeef8f['attrs']&&_0xeef8f['attrs'][0x5]?_0xeef8f[_0x9a3c('0x60')][0x5][_0x9a3c('0x64')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xeef8f[_0x9a3c('0x71')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x6]?_0xeef8f['attrs'][0x6][_0x9a3c('0x64')]:undefined)||''},{'name':_0x9a3c('0x79'),'value':_0xeef8f[_0x9a3c('0x79')]||(_0xeef8f['attrs']&&_0xeef8f['attrs'][0x7]?_0xeef8f[_0x9a3c('0x60')][0x7][_0x9a3c('0x64')]:undefined)||''},{'name':_0x9a3c('0x72'),'value':_0xeef8f['attrOpenchannelAccounts']||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x8]?_0xeef8f[_0x9a3c('0x60')][0x8][_0x9a3c('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xeef8f[_0x9a3c('0x73')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f['attrs'][0x9]?_0xeef8f[_0x9a3c('0x60')][0x9][_0x9a3c('0x64')]:undefined)||''},{'name':_0x9a3c('0x74'),'value':_0xeef8f[_0x9a3c('0x74')]||(_0xeef8f['attrs']&&_0xeef8f['attrs'][0xa]?_0xeef8f[_0x9a3c('0x60')][0xa]['value']:undefined)||''}];case _0x9a3c('0x7a'):return[{'name':_0x9a3c('0x7b'),'type':_0xeef8f[_0x9a3c('0x7c')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f['attrs'][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0][_0x9a3c('0x32')]:undefined)||null,'value':_0xeef8f[_0x9a3c('0x7b')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x0]?_0xeef8f[_0x9a3c('0x60')][0x0][_0x9a3c('0x64')]:undefined)||null},{'name':_0x9a3c('0x7d'),'value':_0xeef8f[_0x9a3c('0x7d')]||(_0xeef8f[_0x9a3c('0x60')]&&_0xeef8f[_0x9a3c('0x60')][0x1]?_0xeef8f[_0x9a3c('0x60')][0x1][_0x9a3c('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x1be9a4){logger['error'](_0x9a3c('0x7e'),JSON[_0x9a3c('0x7f')](_0x1be9a4));return[];}}exports[_0x9a3c('0x80')]=function(_0x451091,_0x482cb0,_0x1ed966){if(_0x451091[_0x9a3c('0x5a')]['id']){delete _0x451091[_0x9a3c('0x5a')]['id'];}return db[_0x9a3c('0x2f')][_0x9a3c('0x4c')]({'where':{'id':_0x451091[_0x9a3c('0x48')]['id']}})[_0x9a3c('0x27')](handleEntityNotFound(_0x482cb0,null))[_0x9a3c('0x27')](function(_0x5a62f4){if(_0x5a62f4){_0x451091[_0x9a3c('0x5a')][_0x9a3c('0x81')]=_0x5a62f4['id'];_0x451091[_0x9a3c('0x5a')][_0x9a3c('0x60')]=widgetAttributes(_0x451091['body']);return db[_0x9a3c('0x82')][_0x9a3c('0x4d')](_0x451091[_0x9a3c('0x5a')]);}})['then'](respondWithResult(_0x482cb0,null))[_0x9a3c('0x54')](handleError(_0x482cb0,null));};exports[_0x9a3c('0x83')]=function(_0x40fa87,_0x184339,_0x6d09bb){var _0x2dab5f={};var _0x4bbe7f={};var _0x4e32b8;var _0x54c48c;return db[_0x9a3c('0x2f')][_0x9a3c('0x84')]({'where':{'id':_0x40fa87[_0x9a3c('0x48')]['id']}})[_0x9a3c('0x27')](handleEntityNotFound(_0x184339,null))[_0x9a3c('0x27')](function(_0x2a0b92){if(_0x2a0b92){_0x4e32b8=_0x2a0b92;_0x4bbe7f[_0x9a3c('0x34')]=_[_0x9a3c('0x36')](db[_0x9a3c('0x82')][_0x9a3c('0x30')]);_0x4bbe7f[_0x9a3c('0x35')]=_[_0x9a3c('0x36')](_0x40fa87[_0x9a3c('0x35')]);_0x4bbe7f[_0x9a3c('0x37')]=_[_0x9a3c('0x38')](_0x4bbe7f[_0x9a3c('0x34')],_0x4bbe7f[_0x9a3c('0x35')]);_0x2dab5f[_0x9a3c('0x3a')]=_[_0x9a3c('0x38')](_0x4bbe7f[_0x9a3c('0x34')],qs[_0x9a3c('0x39')](_0x40fa87[_0x9a3c('0x35')][_0x9a3c('0x39')]));_0x2dab5f[_0x9a3c('0x3a')]=_0x2dab5f[_0x9a3c('0x3a')][_0x9a3c('0x3b')]?_0x2dab5f['attributes']:_0x4bbe7f['model'];_0x2dab5f[_0x9a3c('0x3e')]=qs[_0x9a3c('0x3f')](_0x40fa87[_0x9a3c('0x35')][_0x9a3c('0x3f')]);_0x2dab5f[_0x9a3c('0x42')]=qs[_0x9a3c('0x37')](_[_0x9a3c('0x40')](_0x40fa87['query'],_0x4bbe7f[_0x9a3c('0x37')]));if(_0x40fa87[_0x9a3c('0x35')]['filter']){_0x2dab5f[_0x9a3c('0x42')]=_['merge'](_0x2dab5f[_0x9a3c('0x42')],{'$or':_['map'](_0x2dab5f[_0x9a3c('0x3a')],function(_0x321c2b){var _0x1af297={};_0x1af297[_0x321c2b]={'$like':'%'+_0x40fa87['query'][_0x9a3c('0x44')]+'%'};return _0x1af297;})});}_0x2dab5f=_[_0x9a3c('0x41')]({},_0x2dab5f,_0x40fa87['options']);return _0x4e32b8[_0x9a3c('0x83')](_0x2dab5f);}})['then'](function(_0x2fa199){if(_0x2fa199){_0x54c48c=_0x2fa199['length'];if(!_0x40fa87[_0x9a3c('0x35')][_0x9a3c('0x85')](_0x9a3c('0x3c'))){_0x2dab5f[_0x9a3c('0x3d')]=qs[_0x9a3c('0x3d')](_0x40fa87[_0x9a3c('0x35')][_0x9a3c('0x3d')]);_0x2dab5f[_0x9a3c('0x20')]=qs[_0x9a3c('0x20')](_0x40fa87[_0x9a3c('0x35')][_0x9a3c('0x20')]);}return _0x4e32b8[_0x9a3c('0x83')](_0x2dab5f);}})['then'](function(_0x256670){if(_0x256670){return _0x256670?{'count':_0x54c48c,'rows':_0x256670}:null;}})[_0x9a3c('0x27')](respondWithResult(_0x184339,null))['catch'](handleError(_0x184339,null));};
\ No newline at end of file
+var _0x7713=['set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','clone','params','createdAt','updatedAt','body','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x28fde4,_0x4fbc40){var _0xdc3f1b=function(_0x58f4be){while(--_0x58f4be){_0x28fde4['push'](_0x28fde4['shift']());}};_0xdc3f1b(++_0x4fbc40);}(_0x7713,0x157));var _0x3771=function(_0x1107d8,_0x114c00){_0x1107d8=_0x1107d8-0x0;var _0x38984b=_0x7713[_0x1107d8];return _0x38984b;};'use strict';var emlformat=require(_0x3771('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3771('0x1'));var rp=require(_0x3771('0x2'));var moment=require(_0x3771('0x3'));var BPromise=require(_0x3771('0x4'));var Mustache=require(_0x3771('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3771('0x6'));var csv=require(_0x3771('0x7'));var ejs=require(_0x3771('0x8'));var fs=require('fs');var fs_extra=require(_0x3771('0x9'));var _=require(_0x3771('0xa'));var squel=require(_0x3771('0xb'));var crypto=require('crypto');var jsforce=require(_0x3771('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3771('0xd'));var Papa=require(_0x3771('0xe'));var Redis=require('ioredis');var authService=require(_0x3771('0xf'));var qs=require(_0x3771('0x10'));var as=require(_0x3771('0x11'));var hardwareService=require(_0x3771('0x12'));var logger=require('../../config/logger')(_0x3771('0x13'));var utils=require('../../config/utils');var config=require(_0x3771('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3771('0x15'))['db'];config[_0x3771('0x16')]=_[_0x3771('0x17')](config['redis'],{'host':_0x3771('0x18'),'port':0x18eb});var socket=require(_0x3771('0x19'))(new Redis(config[_0x3771('0x16')]));require('./dashboard.socket')[_0x3771('0x1a')](socket);function respondWithStatusCode(_0x2c6bd3,_0x551058){_0x551058=_0x551058||0xcc;return function(_0x114ac2){if(_0x114ac2){return _0x2c6bd3[_0x3771('0x1b')](_0x551058);}return _0x2c6bd3[_0x3771('0x1c')](_0x551058)[_0x3771('0x1d')]();};}function respondWithResult(_0x449feb,_0x19b8f1){_0x19b8f1=_0x19b8f1||0xc8;return function(_0x3e6333){if(_0x3e6333){return _0x449feb[_0x3771('0x1c')](_0x19b8f1)[_0x3771('0x1e')](_0x3e6333);}};}function respondWithFilteredResult(_0x197b9b,_0x18cebc){return function(_0x4986cc){if(_0x4986cc){var _0x3c7688=typeof _0x18cebc[_0x3771('0x1f')]==='undefined'&&typeof _0x18cebc[_0x3771('0x20')]===_0x3771('0x21');var _0x2c4297=_0x4986cc['count'];var _0x3556d5=_0x3c7688?0x0:_0x18cebc['offset'];var _0x3d6dbb=_0x3c7688?_0x4986cc[_0x3771('0x22')]:_0x18cebc[_0x3771('0x1f')]+_0x18cebc[_0x3771('0x20')];var _0x37f7c1;if(_0x3d6dbb>=_0x2c4297){_0x3d6dbb=_0x2c4297;_0x37f7c1=0xc8;}else{_0x37f7c1=0xce;}_0x197b9b[_0x3771('0x1c')](_0x37f7c1);return _0x197b9b[_0x3771('0x23')](_0x3771('0x24'),_0x3556d5+'-'+_0x3d6dbb+'/'+_0x2c4297)[_0x3771('0x1e')](_0x4986cc);}return null;};}function patchUpdates(_0x1fdd92){return function(_0x57ad21){try{jsonpatch[_0x3771('0x25')](_0x57ad21,_0x1fdd92,!![]);}catch(_0x31b220){return BPromise['reject'](_0x31b220);}return _0x57ad21[_0x3771('0x26')]();};}function saveUpdates(_0x433eff,_0x8e62de){return function(_0x6a0605){if(_0x6a0605){return _0x6a0605[_0x3771('0x27')](_0x433eff)[_0x3771('0x28')](function(_0x90a419){return _0x90a419;});}return null;};}function removeEntity(_0x41a50f,_0x26d64f){return function(_0x2b8823){if(_0x2b8823){return _0x2b8823[_0x3771('0x29')]()[_0x3771('0x28')](function(){var _0x3c04a9=_0x2b8823[_0x3771('0x2a')]({'plain':!![]});var _0x1bae79=_0x3771('0x2b');return db[_0x3771('0x2c')][_0x3771('0x29')]({'where':{'type':_0x1bae79,'resourceId':_0x3c04a9['id']}})['then'](function(){return _0x2b8823;});})[_0x3771('0x28')](function(){_0x41a50f['status'](0xcc)[_0x3771('0x1d')]();});}};}function handleEntityNotFound(_0x320330,_0x5813bd){return function(_0x52761e){if(!_0x52761e){_0x320330[_0x3771('0x1b')](0x194);}return _0x52761e;};}function handleError(_0x4077c1,_0x1b36b8){_0x1b36b8=_0x1b36b8||0x1f4;return function(_0x5bfee6){logger[_0x3771('0x2d')](_0x5bfee6[_0x3771('0x2e')]);if(_0x5bfee6['name']){delete _0x5bfee6[_0x3771('0x2f')];}_0x4077c1[_0x3771('0x1c')](_0x1b36b8)[_0x3771('0x30')](_0x5bfee6);};}exports[_0x3771('0x31')]=function(_0x11e399,_0x42b534){var _0x518ed={},_0xc01d3c={},_0x4a80e4={'count':0x0,'rows':[]};var _0x42ec8b=_['map'](db[_0x3771('0x32')][_0x3771('0x33')],function(_0x3bb7e3){return{'name':_0x3bb7e3['fieldName'],'type':_0x3bb7e3['type'][_0x3771('0x34')]};});_0xc01d3c[_0x3771('0x35')]=_[_0x3771('0x36')](_0x42ec8b,_0x3771('0x2f'));_0xc01d3c['query']=_[_0x3771('0x37')](_0x11e399[_0x3771('0x38')]);_0xc01d3c[_0x3771('0x39')]=_[_0x3771('0x3a')](_0xc01d3c[_0x3771('0x35')],_0xc01d3c[_0x3771('0x38')]);_0x518ed[_0x3771('0x3b')]=_[_0x3771('0x3a')](_0xc01d3c[_0x3771('0x35')],qs['fields'](_0x11e399[_0x3771('0x38')][_0x3771('0x3c')]));_0x518ed['attributes']=_0x518ed[_0x3771('0x3b')][_0x3771('0x3d')]?_0x518ed[_0x3771('0x3b')]:_0xc01d3c[_0x3771('0x35')];if(!_0x11e399[_0x3771('0x38')][_0x3771('0x3e')](_0x3771('0x3f'))){_0x518ed[_0x3771('0x20')]=qs['limit'](_0x11e399[_0x3771('0x38')][_0x3771('0x20')]);_0x518ed[_0x3771('0x1f')]=qs[_0x3771('0x1f')](_0x11e399['query']['offset']);}_0x518ed[_0x3771('0x40')]=qs[_0x3771('0x41')](_0x11e399[_0x3771('0x38')][_0x3771('0x41')]);_0x518ed[_0x3771('0x42')]=qs['filters'](_[_0x3771('0x43')](_0x11e399[_0x3771('0x38')],_0xc01d3c['filters']),_0x42ec8b);if(_0x11e399[_0x3771('0x38')][_0x3771('0x44')]){_0x518ed[_0x3771('0x42')]=_[_0x3771('0x45')](_0x518ed[_0x3771('0x42')],{'$or':_[_0x3771('0x36')](_0x42ec8b,function(_0x48ba73){if(_0x48ba73[_0x3771('0x46')]!==_0x3771('0x47')){var _0x16ed9d={};_0x16ed9d[_0x48ba73['name']]={'$like':'%'+_0x11e399[_0x3771('0x38')][_0x3771('0x44')]+'%'};return _0x16ed9d;}})});}_0x518ed=_[_0x3771('0x45')]({},_0x518ed,_0x11e399['options']);var _0x74be6f={'where':_0x518ed['where']};return db[_0x3771('0x32')][_0x3771('0x22')](_0x74be6f)[_0x3771('0x28')](function(_0x3589f1){_0x4a80e4[_0x3771('0x22')]=_0x3589f1;if(_0x11e399['query'][_0x3771('0x48')]){_0x518ed[_0x3771('0x49')]=[{'all':!![]}];}return db[_0x3771('0x32')][_0x3771('0x4a')](_0x518ed);})[_0x3771('0x28')](function(_0x1456a6){_0x4a80e4['rows']=_0x1456a6;return _0x4a80e4;})[_0x3771('0x28')](respondWithFilteredResult(_0x42b534,_0x518ed))[_0x3771('0x4b')](handleError(_0x42b534,null));};exports['show']=function(_0x24c35f,_0x16b966){var _0x13b4dc={'raw':![],'where':{'id':_0x24c35f['params']['id']}},_0x19e58e={};_0x19e58e['model']=_[_0x3771('0x37')](db[_0x3771('0x32')][_0x3771('0x33')]);_0x19e58e[_0x3771('0x38')]=_[_0x3771('0x37')](_0x24c35f[_0x3771('0x38')]);_0x19e58e[_0x3771('0x39')]=_[_0x3771('0x3a')](_0x19e58e[_0x3771('0x35')],_0x19e58e[_0x3771('0x38')]);_0x13b4dc[_0x3771('0x3b')]=_['intersection'](_0x19e58e[_0x3771('0x35')],qs[_0x3771('0x3c')](_0x24c35f[_0x3771('0x38')][_0x3771('0x3c')]));_0x13b4dc[_0x3771('0x3b')]=_0x13b4dc[_0x3771('0x3b')]['length']?_0x13b4dc[_0x3771('0x3b')]:_0x19e58e[_0x3771('0x35')];if(_0x24c35f[_0x3771('0x38')][_0x3771('0x48')]){_0x13b4dc['include']=[{'all':!![]}];}_0x13b4dc=_[_0x3771('0x45')]({},_0x13b4dc,_0x24c35f[_0x3771('0x4c')]);return db[_0x3771('0x32')]['find'](_0x13b4dc)['then'](handleEntityNotFound(_0x16b966,null))[_0x3771('0x28')](respondWithResult(_0x16b966,null))[_0x3771('0x4b')](handleError(_0x16b966,null));};exports[_0x3771('0x4d')]=function(_0x3ba5be,_0x186698){return db[_0x3771('0x32')][_0x3771('0x4d')](_0x3ba5be['body'],{})['then'](function(_0xb6219a){var _0x207532=_0x3ba5be[_0x3771('0x4e')]['get']({'plain':!![]});if(!_0x207532)throw new Error(_0x3771('0x4f'));if(_0x207532[_0x3771('0x50')]===_0x3771('0x4e')){var _0x4f71ac=_0xb6219a[_0x3771('0x2a')]({'plain':!![]});var _0x29a44c=_0x3771('0x2b');return db[_0x3771('0x51')][_0x3771('0x52')]({'where':{'name':_0x29a44c,'userProfileId':_0x207532[_0x3771('0x53')]},'raw':!![]})[_0x3771('0x28')](function(_0x26fe6c){if(_0x26fe6c&&_0x26fe6c['autoAssociation']===0x0){return db[_0x3771('0x2c')][_0x3771('0x4d')]({'name':_0x4f71ac[_0x3771('0x2f')],'resourceId':_0x4f71ac['id'],'type':_0x26fe6c[_0x3771('0x2f')],'sectionId':_0x26fe6c['id']},{})[_0x3771('0x28')](function(){return _0xb6219a;});}else{return _0xb6219a;}})[_0x3771('0x4b')](function(_0x120274){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x120274);throw _0x120274;});}return _0xb6219a;})[_0x3771('0x28')](respondWithResult(_0x186698,0xc9))[_0x3771('0x4b')](handleError(_0x186698,null));};exports[_0x3771('0x54')]=function(_0x2d251f,_0x3ae944){var _0x5a954a={'where':{'id':_0x2d251f[_0x3771('0x55')]['id']}},_0x460486={};_0x460486[_0x3771('0x35')]=_[_0x3771('0x37')](db[_0x3771('0x32')][_0x3771('0x33')]);_0x5a954a[_0x3771('0x3b')]=_[_0x3771('0x3a')](_0x460486[_0x3771('0x35')],qs['fields'](_0x2d251f['query'][_0x3771('0x3c')]));_0x5a954a['attributes']=_0x5a954a[_0x3771('0x3b')][_0x3771('0x3d')]?_0x5a954a[_0x3771('0x3b')]:_0x460486[_0x3771('0x35')];if(_0x2d251f[_0x3771('0x38')][_0x3771('0x48')]){_0x5a954a['include']=[{'all':!![]}];}_0x5a954a=_[_0x3771('0x45')]({},_0x5a954a,_0x2d251f[_0x3771('0x4c')]);return db[_0x3771('0x32')][_0x3771('0x52')](_0x5a954a)[_0x3771('0x28')](handleEntityNotFound(_0x3ae944,null))[_0x3771('0x28')](function(_0x336a8b){if(_0x336a8b){var _0xfa79a=_0x336a8b[_0x3771('0x2a')]({'plain':!![]});_0xfa79a=qs['omit'](_0xfa79a,['id',_0x3771('0x56'),_0x3771('0x57')]);_0x2d251f[_0x3771('0x58')]=_['omit'](_0x2d251f[_0x3771('0x58')],['id','createdAt',_0x3771('0x57')]);return db[_0x3771('0x32')][_0x3771('0x4d')](_[_0x3771('0x45')](_0xfa79a,_0x2d251f[_0x3771('0x58')]),{'include':_0x2d251f[_0x3771('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x3771('0x28')](function(_0x41f17b){var _0x3135=_0x2d251f[_0x3771('0x4e')][_0x3771('0x2a')]({'plain':!![]});if(!_0x3135)throw new Error(_0x3771('0x4f'));if(_0x3135['role']===_0x3771('0x4e')){var _0x4f7030=_0x41f17b[_0x3771('0x2a')]({'plain':!![]});var _0xc2a2b2=_0x3771('0x2b');return db[_0x3771('0x51')]['find']({'where':{'name':_0xc2a2b2,'userProfileId':_0x3135['userProfileId']},'raw':!![]})['then'](function(_0x2c1f61){if(_0x2c1f61&&_0x2c1f61[_0x3771('0x59')]===0x0){return db[_0x3771('0x2c')][_0x3771('0x4d')]({'name':_0x4f7030['name'],'resourceId':_0x4f7030['id'],'type':_0x2c1f61['name'],'sectionId':_0x2c1f61['id']},{})['then'](function(){return _0x41f17b;});}else{return _0x41f17b;}})[_0x3771('0x4b')](function(_0x41c943){logger[_0x3771('0x2d')](_0x3771('0x5a'),_0x41c943);throw _0x41c943;});}return _0x41f17b;});}})['then'](respondWithResult(_0x3ae944,0xc9))[_0x3771('0x4b')](handleError(_0x3ae944,null));};exports[_0x3771('0x27')]=function(_0x100507,_0x2cddf8){if(_0x100507[_0x3771('0x58')]['id']){delete _0x100507[_0x3771('0x58')]['id'];}return db[_0x3771('0x32')]['find']({'where':{'id':_0x100507[_0x3771('0x55')]['id']}})[_0x3771('0x28')](handleEntityNotFound(_0x2cddf8,null))[_0x3771('0x28')](saveUpdates(_0x100507['body'],null))[_0x3771('0x28')](respondWithResult(_0x2cddf8,null))[_0x3771('0x4b')](handleError(_0x2cddf8,null));};exports[_0x3771('0x29')]=function(_0x335435,_0x276300){return db['Dashboard']['find']({'where':{'id':_0x335435[_0x3771('0x55')]['id']}})['then'](handleEntityNotFound(_0x276300,null))[_0x3771('0x28')](removeEntity(_0x276300,null))[_0x3771('0x4b')](handleError(_0x276300,null));};function widgetAttributes(_0x838fc2){try{switch(_0x838fc2[_0x3771('0x46')]){case'iframe':return[{'name':_0x3771('0x5b'),'value':_0x838fc2['attrUrl']||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x0]?_0x838fc2[_0x3771('0x5c')][0x0][_0x3771('0x5d')]:undefined)||_0x3771('0x5e')}];case _0x3771('0x5f'):return[{'name':_0x3771('0x60'),'value':_0x838fc2[_0x3771('0x60')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x0]?_0x838fc2[_0x3771('0x5c')][0x0][_0x3771('0x5d')]:undefined)||''}];case _0x3771('0x61'):return[{'name':_0x3771('0x62'),'value':_0x838fc2[_0x3771('0x62')]||(_0x838fc2['attrs']&&_0x838fc2[_0x3771('0x5c')][0x0]?_0x838fc2[_0x3771('0x5c')][0x0][_0x3771('0x5d')]:undefined)||_0x3771('0x63')},{'name':_0x3771('0x64'),'value':_0x838fc2[_0x3771('0x64')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x1]?_0x838fc2[_0x3771('0x5c')][0x1][_0x3771('0x5d')]:undefined)||'0.00'},{'name':_0x3771('0x65'),'value':_0x838fc2[_0x3771('0x65')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x2]?_0x838fc2['attrs'][0x2]['value']:undefined)||0xc}];case _0x3771('0x66'):return[{'name':_0x3771('0x67'),'value':_0x838fc2[_0x3771('0x67')]||(_0x838fc2['attrs']&&_0x838fc2[_0x3771('0x5c')][0x0]?_0x838fc2[_0x3771('0x5c')][0x0][_0x3771('0x5d')]:undefined)||_0x3771('0x68')},{'name':_0x3771('0x69'),'value':_0x838fc2[_0x3771('0x69')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x1]?_0x838fc2[_0x3771('0x5c')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x838fc2[_0x3771('0x65')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x2]?_0x838fc2[_0x3771('0x5c')][0x2][_0x3771('0x5d')]:undefined)||0x14},{'name':_0x3771('0x6a'),'value':_0x838fc2[_0x3771('0x6a')]||(_0x838fc2['attrs']&&_0x838fc2['attrs'][0x3]?_0x838fc2[_0x3771('0x5c')][0x3][_0x3771('0x5d')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x838fc2[_0x3771('0x6b')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2['attrs'][0x4]?_0x838fc2[_0x3771('0x5c')][0x4]['value']:undefined)||''},{'name':_0x3771('0x6c'),'value':_0x838fc2[_0x3771('0x6c')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x5]?_0x838fc2[_0x3771('0x5c')][0x5]['value']:undefined)||''},{'name':_0x3771('0x6d'),'value':_0x838fc2['attrSmsAccounts']||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x6]?_0x838fc2['attrs'][0x6][_0x3771('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x838fc2[_0x3771('0x6e')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x7]?_0x838fc2[_0x3771('0x5c')][0x7][_0x3771('0x5d')]:undefined)||''},{'name':_0x3771('0x6f'),'value':_0x838fc2[_0x3771('0x6f')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x8]?_0x838fc2[_0x3771('0x5c')][0x8][_0x3771('0x5d')]:undefined)||''},{'name':_0x3771('0x70'),'value':_0x838fc2[_0x3771('0x70')]||(_0x838fc2['attrs']&&_0x838fc2[_0x3771('0x5c')][0x9]?_0x838fc2[_0x3771('0x5c')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x3771('0x71'),'value':_0x838fc2[_0x3771('0x71')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x0]?_0x838fc2[_0x3771('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0x3771('0x72'),'value':_0x838fc2['attrSerie2']||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2['attrs'][0x1]?_0x838fc2[_0x3771('0x5c')][0x1][_0x3771('0x5d')]:undefined)||null},{'name':_0x3771('0x73'),'value':_0x838fc2[_0x3771('0x73')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x2]?_0x838fc2[_0x3771('0x5c')][0x2][_0x3771('0x5d')]:undefined)||null},{'name':_0x3771('0x69'),'value':_0x838fc2[_0x3771('0x69')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x3]?_0x838fc2[_0x3771('0x5c')][0x3][_0x3771('0x5d')]:undefined)||[]},{'name':_0x3771('0x6a'),'value':_0x838fc2[_0x3771('0x6a')]||(_0x838fc2['attrs']&&_0x838fc2['attrs'][0x4]?_0x838fc2[_0x3771('0x5c')][0x4]['value']:undefined)||'voice'},{'name':_0x3771('0x6b'),'value':_0x838fc2['attrEmailAccounts']||(_0x838fc2['attrs']&&_0x838fc2[_0x3771('0x5c')][0x5]?_0x838fc2[_0x3771('0x5c')][0x5][_0x3771('0x5d')]:undefined)||''},{'name':_0x3771('0x6c'),'value':_0x838fc2[_0x3771('0x6c')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2['attrs'][0x6]?_0x838fc2[_0x3771('0x5c')][0x6][_0x3771('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x838fc2[_0x3771('0x6d')]||(_0x838fc2['attrs']&&_0x838fc2['attrs'][0x7]?_0x838fc2[_0x3771('0x5c')][0x7]['value']:undefined)||''},{'name':_0x3771('0x6e'),'value':_0x838fc2[_0x3771('0x6e')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x8]?_0x838fc2['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x838fc2[_0x3771('0x6f')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x9]?_0x838fc2[_0x3771('0x5c')][0x9][_0x3771('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x838fc2['attrChatWebsites']||(_0x838fc2['attrs']&&_0x838fc2['attrs'][0xa]?_0x838fc2[_0x3771('0x5c')][0xa]['value']:undefined)||''}];case _0x3771('0x74'):return[{'name':_0x3771('0x75'),'type':_0x838fc2[_0x3771('0x76')]||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x0]?_0x838fc2[_0x3771('0x5c')][0x0][_0x3771('0x46')]:undefined)||null,'value':_0x838fc2['attrReport']||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2['attrs'][0x0]?_0x838fc2[_0x3771('0x5c')][0x0]['value']:undefined)||null},{'name':_0x3771('0x77'),'value':_0x838fc2['attrRefresh']||(_0x838fc2[_0x3771('0x5c')]&&_0x838fc2[_0x3771('0x5c')][0x1]?_0x838fc2[_0x3771('0x5c')][0x1][_0x3771('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x1fd4eb){logger['error'](_0x3771('0x78'),JSON[_0x3771('0x79')](_0x1fd4eb));return[];}}exports[_0x3771('0x7a')]=function(_0x2b12e8,_0x2a9f9b,_0x4faed9){if(_0x2b12e8[_0x3771('0x58')]['id']){delete _0x2b12e8[_0x3771('0x58')]['id'];}return db['Dashboard'][_0x3771('0x52')]({'where':{'id':_0x2b12e8['params']['id']}})[_0x3771('0x28')](handleEntityNotFound(_0x2a9f9b,null))[_0x3771('0x28')](function(_0xc515fb){if(_0xc515fb){_0x2b12e8['body']['DashboardId']=_0xc515fb['id'];_0x2b12e8[_0x3771('0x58')]['attrs']=widgetAttributes(_0x2b12e8[_0x3771('0x58')]);return db[_0x3771('0x7b')][_0x3771('0x4d')](_0x2b12e8['body']);}})[_0x3771('0x28')](respondWithResult(_0x2a9f9b,null))[_0x3771('0x4b')](handleError(_0x2a9f9b,null));};exports[_0x3771('0x7c')]=function(_0x1735a2,_0x4d63f2,_0x492bd0){var _0x2d5280={};var _0x1c7b6d={};var _0x9ed6fe;var _0x2f1d50;return db[_0x3771('0x32')][_0x3771('0x7d')]({'where':{'id':_0x1735a2[_0x3771('0x55')]['id']}})[_0x3771('0x28')](handleEntityNotFound(_0x4d63f2,null))[_0x3771('0x28')](function(_0x484358){if(_0x484358){_0x9ed6fe=_0x484358;_0x1c7b6d[_0x3771('0x35')]=_[_0x3771('0x37')](db[_0x3771('0x7b')][_0x3771('0x33')]);_0x1c7b6d['query']=_[_0x3771('0x37')](_0x1735a2[_0x3771('0x38')]);_0x1c7b6d[_0x3771('0x39')]=_[_0x3771('0x3a')](_0x1c7b6d['model'],_0x1c7b6d['query']);_0x2d5280[_0x3771('0x3b')]=_['intersection'](_0x1c7b6d[_0x3771('0x35')],qs['fields'](_0x1735a2[_0x3771('0x38')][_0x3771('0x3c')]));_0x2d5280[_0x3771('0x3b')]=_0x2d5280[_0x3771('0x3b')][_0x3771('0x3d')]?_0x2d5280[_0x3771('0x3b')]:_0x1c7b6d[_0x3771('0x35')];_0x2d5280[_0x3771('0x40')]=qs[_0x3771('0x41')](_0x1735a2['query'][_0x3771('0x41')]);_0x2d5280[_0x3771('0x42')]=qs[_0x3771('0x39')](_[_0x3771('0x43')](_0x1735a2[_0x3771('0x38')],_0x1c7b6d[_0x3771('0x39')]));if(_0x1735a2[_0x3771('0x38')]['filter']){_0x2d5280[_0x3771('0x42')]=_['merge'](_0x2d5280['where'],{'$or':_[_0x3771('0x36')](_0x2d5280[_0x3771('0x3b')],function(_0x1d863c){var _0x4a7f4d={};_0x4a7f4d[_0x1d863c]={'$like':'%'+_0x1735a2[_0x3771('0x38')]['filter']+'%'};return _0x4a7f4d;})});}_0x2d5280=_[_0x3771('0x45')]({},_0x2d5280,_0x1735a2[_0x3771('0x4c')]);return _0x9ed6fe[_0x3771('0x7c')](_0x2d5280);}})[_0x3771('0x28')](function(_0x5f1b8b){if(_0x5f1b8b){_0x2f1d50=_0x5f1b8b['length'];if(!_0x1735a2[_0x3771('0x38')]['hasOwnProperty'](_0x3771('0x3f'))){_0x2d5280[_0x3771('0x20')]=qs[_0x3771('0x20')](_0x1735a2[_0x3771('0x38')][_0x3771('0x20')]);_0x2d5280[_0x3771('0x1f')]=qs[_0x3771('0x1f')](_0x1735a2[_0x3771('0x38')]['offset']);}return _0x9ed6fe[_0x3771('0x7c')](_0x2d5280);}})['then'](function(_0x245103){if(_0x245103){return _0x245103?{'count':_0x2f1d50,'rows':_0x245103}:null;}})['then'](respondWithResult(_0x4d63f2,null))['catch'](handleError(_0x4d63f2,null));};
\ No newline at end of file
index 611f626..75be628 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf403=['hasOwnProperty','hook','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x2589ea,_0x17b1e3){var _0x3e8498=function(_0x34e3da){while(--_0x34e3da){_0x2589ea['push'](_0x2589ea['shift']());}};_0x3e8498(++_0x17b1e3);}(_0xf403,0x158));var _0x3f40=function(_0x256cea,_0x327540){_0x256cea=_0x256cea-0x0;var _0x427f2a=_0xf403[_0x256cea];return _0x427f2a;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x3f40('0x0'))['db'][_0x3f40('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3f40('0x2')](0x0);var events={'afterCreate':_0x3f40('0x3'),'afterUpdate':_0x3f40('0x4'),'afterDestroy':_0x3f40('0x5')};function emitEvent(_0x384b8c){return function(_0x5f1f55,_0x2e74c9,_0x695004){DashboardEvents[_0x3f40('0x6')](_0x384b8c+':'+_0x5f1f55['id'],_0x5f1f55);DashboardEvents['emit'](_0x384b8c,_0x5f1f55);_0x695004(null);};}for(var e in events){if(events[_0x3f40('0x7')](e)){var event=events[e];Dashboard[_0x3f40('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents;
\ No newline at end of file
+var _0x9341=['events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x310b7e,_0x35c330){var _0xa252d2=function(_0x424ccd){while(--_0x424ccd){_0x310b7e['push'](_0x310b7e['shift']());}};_0xa252d2(++_0x35c330);}(_0x9341,0xc8));var _0x1934=function(_0x352270,_0x41e3ad){_0x352270=_0x352270-0x0;var _0x3caffb=_0x9341[_0x352270];return _0x3caffb;};'use strict';var EventEmitter=require(_0x1934('0x0'));var Dashboard=require(_0x1934('0x1'))['db'][_0x1934('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1934('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1934('0x4'),'afterDestroy':_0x1934('0x5')};function emitEvent(_0x5d3645){return function(_0x3bd63b,_0x2963f9,_0x51c4f5){DashboardEvents['emit'](_0x5d3645+':'+_0x3bd63b['id'],_0x3bd63b);DashboardEvents[_0x1934('0x6')](_0x5d3645,_0x3bd63b);_0x51c4f5(null);};}for(var e in events){if(events[_0x1934('0x7')](e)){var event=events[e];Dashboard[_0x1934('0x8')](e,emitEvent(event));}}module[_0x1934('0x9')]=DashboardEvents;
\ No newline at end of file
index 8a04497..1a200e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2408=['request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','api','moment'];(function(_0xec42c4,_0x2ce9a2){var _0x1ac6dc=function(_0x27e572){while(--_0x27e572){_0xec42c4['push'](_0xec42c4['shift']());}};_0x1ac6dc(++_0x2ce9a2);}(_0x2408,0x172));var _0x8240=function(_0x5cf12b,_0x1c6c3f){_0x5cf12b=_0x5cf12b-0x0;var _0x2f864a=_0x2408[_0x5cf12b];return _0x2f864a;};'use strict';var _=require(_0x8240('0x0'));var util=require(_0x8240('0x1'));var logger=require('../../config/logger')(_0x8240('0x2'));var moment=require(_0x8240('0x3'));var BPromise=require('bluebird');var rp=require(_0x8240('0x4'));var fs=require('fs');var path=require(_0x8240('0x5'));var rimraf=require('rimraf');var config=require(_0x8240('0x6'));var attributes=require(_0x8240('0x7'));module[_0x8240('0x8')]=function(_0x436913,_0x5803c0){return _0x436913[_0x8240('0x9')](_0x8240('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2737=['dashboards','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','Dashboard'];(function(_0x470e1d,_0x5f36ef){var _0x195fee=function(_0x115bf2){while(--_0x115bf2){_0x470e1d['push'](_0x470e1d['shift']());}};_0x195fee(++_0x5f36ef);}(_0x2737,0xa1));var _0x7273=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2737[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7273('0x0'))(_0x7273('0x1'));var moment=require(_0x7273('0x2'));var BPromise=require(_0x7273('0x3'));var rp=require(_0x7273('0x4'));var fs=require('fs');var path=require(_0x7273('0x5'));var rimraf=require(_0x7273('0x6'));var config=require(_0x7273('0x7'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x67a41c,_0x3a58ce){return _0x67a41c['define'](_0x7273('0x8'),attributes,{'tableName':_0x7273('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 16c7c30..0a79f03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x774c=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboard.socket','register','request','then'];(function(_0x336df4,_0x52c1dc){var _0x580d8c=function(_0x2febf1){while(--_0x2febf1){_0x336df4['push'](_0x336df4['shift']());}};_0x580d8c(++_0x52c1dc);}(_0x774c,0x11d));var _0xc774=function(_0x13a14d,_0x1e10d2){_0x13a14d=_0x13a14d-0x0;var _0x4772c6=_0x774c[_0x13a14d];return _0x4772c6;};'use strict';var _=require('lodash');var util=require(_0xc774('0x0'));var moment=require(_0xc774('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc774('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xc774('0x3'))('rpc');var config=require(_0xc774('0x4'));var jayson=require(_0xc774('0x5'));var client=jayson[_0xc774('0x6')][_0xc774('0x7')]({'port':0x232a});config['redis']=_[_0xc774('0x8')](config[_0xc774('0x9')],{'host':_0xc774('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc774('0x9')]));require(_0xc774('0xb'))[_0xc774('0xc')](socket);function respondWithRpcPromise(_0x1b5865,_0x4b068e,_0x547e03){return new BPromise(function(_0x38bfaf,_0x71cbc9){return client[_0xc774('0xd')](_0x1b5865,_0x547e03)[_0xc774('0xe')](function(_0x29290c){logger[_0xc774('0xf')](_0xc774('0x10'),_0x4b068e,_0xc774('0x11'));logger[_0xc774('0x12')](_0xc774('0x13'),_0x4b068e,'request\x20sent',JSON[_0xc774('0x14')](_0x29290c));if(_0x29290c['error']){if(_0x29290c['error'][_0xc774('0x15')]===0x1f4){logger[_0xc774('0x16')](_0xc774('0x10'),_0x4b068e,_0x29290c[_0xc774('0x16')]['message']);return _0x71cbc9(_0x29290c[_0xc774('0x16')][_0xc774('0x17')]);}logger['error'](_0xc774('0x10'),_0x4b068e,_0x29290c[_0xc774('0x16')][_0xc774('0x17')]);return _0x38bfaf(_0x29290c[_0xc774('0x16')][_0xc774('0x17')]);}else{logger[_0xc774('0xf')](_0xc774('0x10'),_0x4b068e,_0xc774('0x11'));_0x38bfaf(_0x29290c[_0xc774('0x18')]['message']);}})['catch'](function(_0x196407){logger[_0xc774('0x16')]('Dashboard,\x20%s,\x20%s',_0x4b068e,_0x196407);_0x71cbc9(_0x196407);});});}
\ No newline at end of file
+var _0xdc28=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xdc28,0x99));var _0x8dc2=function(_0xc31be8,_0x3425f0){_0xc31be8=_0xc31be8-0x0;var _0x52f117=_0xdc28[_0xc31be8];return _0x52f117;};'use strict';var _=require(_0x8dc2('0x0'));var util=require(_0x8dc2('0x1'));var moment=require(_0x8dc2('0x2'));var BPromise=require(_0x8dc2('0x3'));var rs=require(_0x8dc2('0x4'));var fs=require('fs');var Redis=require(_0x8dc2('0x5'));var db=require(_0x8dc2('0x6'))['db'];var utils=require(_0x8dc2('0x7'));var logger=require(_0x8dc2('0x8'))('rpc');var config=require(_0x8dc2('0x9'));var jayson=require(_0x8dc2('0xa'));var client=jayson[_0x8dc2('0xb')]['http']({'port':0x232a});config[_0x8dc2('0xc')]=_[_0x8dc2('0xd')](config[_0x8dc2('0xc')],{'host':_0x8dc2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dc2('0xc')]));require(_0x8dc2('0xf'))['register'](socket);function respondWithRpcPromise(_0x43817c,_0x44a398,_0x203628){return new BPromise(function(_0x311b84,_0xaee69e){return client[_0x8dc2('0x10')](_0x43817c,_0x203628)['then'](function(_0x3d1be6){logger[_0x8dc2('0x11')](_0x8dc2('0x12'),_0x44a398,_0x8dc2('0x13'));logger['debug'](_0x8dc2('0x14'),_0x44a398,'request\x20sent',JSON[_0x8dc2('0x15')](_0x3d1be6));if(_0x3d1be6['error']){if(_0x3d1be6['error']['code']===0x1f4){logger[_0x8dc2('0x16')]('Dashboard,\x20%s,\x20%s',_0x44a398,_0x3d1be6['error'][_0x8dc2('0x17')]);return _0xaee69e(_0x3d1be6['error'][_0x8dc2('0x17')]);}logger['error'](_0x8dc2('0x12'),_0x44a398,_0x3d1be6['error'][_0x8dc2('0x17')]);return _0x311b84(_0x3d1be6[_0x8dc2('0x16')]['message']);}else{logger[_0x8dc2('0x11')](_0x8dc2('0x12'),_0x44a398,'request\x20sent');_0x311b84(_0x3d1be6['result'][_0x8dc2('0x17')]);}})[_0x8dc2('0x18')](function(_0x40ae91){logger[_0x8dc2('0x16')](_0x8dc2('0x12'),_0x44a398,_0x40ae91);_0xaee69e(_0x40ae91);});});}
\ No newline at end of file
index f8260b7..da4de25 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x75cc=['dashboard:','./dashboard.events','remove','update','emit','length'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x75cc,0x7f));var _0xc75c=function(_0x7b1208,_0x3e8278){_0x7b1208=_0x7b1208-0x0;var _0x30f76f=_0x75cc[_0x7b1208];return _0x30f76f;};'use strict';var DashboardEvents=require(_0xc75c('0x0'));var events=['save',_0xc75c('0x1'),_0xc75c('0x2')];function createListener(_0x344dc2,_0x11ee32){return function(_0x24346a){_0x11ee32[_0xc75c('0x3')](_0x344dc2,_0x24346a);};}function removeListener(_0x215cad,_0x55a86f){return function(){DashboardEvents['removeListener'](_0x215cad,_0x55a86f);};}exports['register']=function(_0xe2efc4){for(var _0x1dc305=0x0,_0x3a8f3b=events[_0xc75c('0x4')];_0x1dc305<_0x3a8f3b;_0x1dc305++){var _0x5f14b3=events[_0x1dc305];var _0x458811=createListener(_0xc75c('0x5')+_0x5f14b3,_0xe2efc4);DashboardEvents['on'](_0x5f14b3,_0x458811);}};
\ No newline at end of file
+var _0x26e8=['update','emit','removeListener','register','dashboard:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26e8,0x179));var _0x826e=function(_0x427b08,_0x44470d){_0x427b08=_0x427b08-0x0;var _0x4a8274=_0x26e8[_0x427b08];return _0x4a8274;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x826e('0x0'),'remove',_0x826e('0x1')];function createListener(_0x187515,_0x4daf40){return function(_0x477fbc){_0x4daf40[_0x826e('0x2')](_0x187515,_0x477fbc);};}function removeListener(_0xd839b2,_0x396384){return function(){DashboardEvents[_0x826e('0x3')](_0xd839b2,_0x396384);};}exports[_0x826e('0x4')]=function(_0x3ce6b2){for(var _0x41a960=0x0,_0x2c72f9=events['length'];_0x41a960<_0x2c72f9;_0x41a960++){var _0x1e89fc=events[_0x41a960];var _0x87df86=createListener(_0x826e('0x5')+_0x1e89fc,_0x3ce6b2);DashboardEvents['on'](_0x1e89fc,_0x87df86);}};
\ No newline at end of file
index 7ebe4ac..09a9c89 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02c7=['show','get','getItems','post','create','/:id/clone','clone','/:id/items','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id'];(function(_0x210e50,_0x5b02cf){var _0x17ae67=function(_0x57b078){while(--_0x57b078){_0x210e50['push'](_0x210e50['shift']());}};_0x17ae67(++_0x5b02cf);}(_0x02c7,0x18d));var _0x702c=function(_0x1a322f,_0x54d072){_0x1a322f=_0x1a322f-0x0;var _0x4fe52c=_0x02c7[_0x1a322f];return _0x4fe52c;};'use strict';var multer=require(_0x702c('0x0'));var util=require(_0x702c('0x1'));var path=require(_0x702c('0x2'));var timeout=require(_0x702c('0x3'));var express=require(_0x702c('0x4'));var router=express[_0x702c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x702c('0x6'));var interaction=require(_0x702c('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x702c('0x8')](),controller[_0x702c('0x9')]);router['get'](_0x702c('0xa'),auth[_0x702c('0x8')](),controller[_0x702c('0xb')]);router[_0x702c('0xc')]('/:id/items',auth['isAuthenticated'](),controller[_0x702c('0xd')]);router[_0x702c('0xe')]('/',auth[_0x702c('0x8')](),controller[_0x702c('0xf')]);router[_0x702c('0xe')](_0x702c('0x10'),auth[_0x702c('0x8')](),controller[_0x702c('0x11')]);router['post'](_0x702c('0x12'),auth[_0x702c('0x8')](),controller['addItem']);router[_0x702c('0x13')](_0x702c('0xa'),auth['isAuthenticated'](),controller[_0x702c('0x14')]);router[_0x702c('0x15')](_0x702c('0xa'),auth[_0x702c('0x8')](),controller[_0x702c('0x16')]);module[_0x702c('0x17')]=router;
\ No newline at end of file
+var _0xed93=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util'];(function(_0x8aedd5,_0x4ba6db){var _0x37f96a=function(_0x521373){while(--_0x521373){_0x8aedd5['push'](_0x8aedd5['shift']());}};_0x37f96a(++_0x4ba6db);}(_0xed93,0x1d9));var _0x3ed9=function(_0x4f6cd3,_0x27bdd2){_0x4f6cd3=_0x4f6cd3-0x0;var _0x10a327=_0xed93[_0x4f6cd3];return _0x10a327;};'use strict';var multer=require(_0x3ed9('0x0'));var util=require(_0x3ed9('0x1'));var path=require('path');var timeout=require(_0x3ed9('0x2'));var express=require(_0x3ed9('0x3'));var router=express[_0x3ed9('0x4')]();var fs_extra=require(_0x3ed9('0x5'));var auth=require(_0x3ed9('0x6'));var interaction=require(_0x3ed9('0x7'));var config=require(_0x3ed9('0x8'));var controller=require(_0x3ed9('0x9'));router[_0x3ed9('0xa')]('/',auth[_0x3ed9('0xb')](),controller[_0x3ed9('0xc')]);router[_0x3ed9('0xa')](_0x3ed9('0xd'),auth[_0x3ed9('0xb')](),controller[_0x3ed9('0xe')]);router[_0x3ed9('0xa')](_0x3ed9('0xf'),auth[_0x3ed9('0xb')](),controller[_0x3ed9('0x10')]);router[_0x3ed9('0x11')]('/',auth[_0x3ed9('0xb')](),controller[_0x3ed9('0x12')]);router[_0x3ed9('0x11')](_0x3ed9('0x13'),auth[_0x3ed9('0xb')](),controller[_0x3ed9('0x14')]);router[_0x3ed9('0x11')](_0x3ed9('0xf'),auth[_0x3ed9('0xb')](),controller['addItem']);router[_0x3ed9('0x15')](_0x3ed9('0xd'),auth[_0x3ed9('0xb')](),controller['update']);router[_0x3ed9('0x16')](_0x3ed9('0xd'),auth[_0x3ed9('0xb')](),controller[_0x3ed9('0x17')]);module[_0x3ed9('0x18')]=router;
\ No newline at end of file
index 9c3e4ba..dcdd942 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd117=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd117,0x182));var _0x7d11=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0xd117[_0xe89d97];return _0x1b6e5d;};'use strict';var Sequelize=require(_0x7d11('0x0'));var squel=require(_0x7d11('0x1'));var _=require(_0x7d11('0x2'));module[_0x7d11('0x3')]={'title':{'type':Sequelize[_0x7d11('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x7d11('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7d11('0x5')](_0x7d11('0x6')),'get':function(){try{return JSON[_0x7d11('0x7')](this[_0x7d11('0x8')](_0x7d11('0x9')));}catch(_0x2689c6){return[];}},'set':function(_0x27d7e8){try{this[_0x7d11('0xa')](_0x7d11('0x9'),JSON[_0x7d11('0xb')](_0x27d7e8));}catch(_0x47b5e6){this[_0x7d11('0xa')](_0x7d11('0x9'),JSON[_0x7d11('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7d11('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7d11('0xc')]},'col':{'type':Sequelize[_0x7d11('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7d11('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7d11('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}};
\ No newline at end of file
+var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0xfcf0,0x138));var _0x0fcf=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0xfcf0[_0xc5a279];return _0xc755d3;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'defaultValue':0xc}};
\ No newline at end of file
index b1bf863..58d8e94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe978=['attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','include','merge','options','find','catch','params','type','iframe','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts'];(function(_0x32b404,_0x2478fd){var _0x5f2e1d=function(_0x4787b0){while(--_0x4787b0){_0x32b404['push'](_0x32b404['shift']());}};_0x5f2e1d(++_0x2478fd);}(_0xe978,0x70));var _0x8e97=function(_0x4c4d52,_0xba8cfb){_0x4c4d52=_0x4c4d52-0x0;var _0x1a75c0=_0xe978[_0x4c4d52];return _0x1a75c0;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e97('0x3'));var BPromise=require(_0x8e97('0x4'));var Mustache=require(_0x8e97('0x5'));var util=require(_0x8e97('0x6'));var path=require(_0x8e97('0x7'));var sox=require('sox');var csv=require(_0x8e97('0x8'));var ejs=require(_0x8e97('0x9'));var fs=require('fs');var fs_extra=require(_0x8e97('0xa'));var _=require(_0x8e97('0xb'));var squel=require(_0x8e97('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e97('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e97('0x8'));var querystring=require(_0x8e97('0xe'));var Papa=require(_0x8e97('0xf'));var Redis=require('ioredis');var authService=require(_0x8e97('0x10'));var qs=require(_0x8e97('0x11'));var as=require(_0x8e97('0x12'));var hardwareService=require(_0x8e97('0x13'));var logger=require(_0x8e97('0x14'))(_0x8e97('0x15'));var utils=require(_0x8e97('0x16'));var config=require(_0x8e97('0x17'));var licenseUtil=require(_0x8e97('0x18'));var db=require(_0x8e97('0x19'))['db'];config[_0x8e97('0x1a')]=_['defaults'](config[_0x8e97('0x1a')],{'host':_0x8e97('0x1b'),'port':0x18eb});var socket=require(_0x8e97('0x1c'))(new Redis(config[_0x8e97('0x1a')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x583c0a,_0x516c91){_0x516c91=_0x516c91||0xcc;return function(_0x5d78c5){if(_0x5d78c5){return _0x583c0a['sendStatus'](_0x516c91);}return _0x583c0a[_0x8e97('0x1d')](_0x516c91)['end']();};}function respondWithResult(_0x33b6b3,_0x3bb176){_0x3bb176=_0x3bb176||0xc8;return function(_0x4943c1){if(_0x4943c1){return _0x33b6b3['status'](_0x3bb176)[_0x8e97('0x1e')](_0x4943c1);}};}function respondWithFilteredResult(_0x3f3738,_0xb779ed){return function(_0x2f475c){if(_0x2f475c){var _0x2155ab=typeof _0xb779ed[_0x8e97('0x1f')]===_0x8e97('0x20')&&typeof _0xb779ed[_0x8e97('0x21')]===_0x8e97('0x20');var _0x596d71=_0x2f475c[_0x8e97('0x22')];var _0x442f99=_0x2155ab?0x0:_0xb779ed[_0x8e97('0x1f')];var _0x19f487=_0x2155ab?_0x2f475c[_0x8e97('0x22')]:_0xb779ed[_0x8e97('0x1f')]+_0xb779ed[_0x8e97('0x21')];var _0x5a5c99;if(_0x19f487>=_0x596d71){_0x19f487=_0x596d71;_0x5a5c99=0xc8;}else{_0x5a5c99=0xce;}_0x3f3738[_0x8e97('0x1d')](_0x5a5c99);return _0x3f3738[_0x8e97('0x23')](_0x8e97('0x24'),_0x442f99+'-'+_0x19f487+'/'+_0x596d71)[_0x8e97('0x1e')](_0x2f475c);}return null;};}function patchUpdates(_0x387748){return function(_0x1763e7){try{jsonpatch[_0x8e97('0x25')](_0x1763e7,_0x387748,!![]);}catch(_0x18fcdb){return BPromise[_0x8e97('0x26')](_0x18fcdb);}return _0x1763e7[_0x8e97('0x27')]();};}function saveUpdates(_0x517c1e,_0x5d5a94){return function(_0x4b08ed){if(_0x4b08ed){return _0x4b08ed[_0x8e97('0x28')](_0x517c1e)[_0x8e97('0x29')](function(_0x2be986){return _0x2be986;});}return null;};}function removeEntity(_0xcee009,_0x1bae19){return function(_0x10f327){if(_0x10f327){return _0x10f327[_0x8e97('0x2a')]()[_0x8e97('0x29')](function(){_0xcee009['status'](0xcc)[_0x8e97('0x2b')]();});}};}function handleEntityNotFound(_0x2a5f18,_0x33e801){return function(_0x5bb338){if(!_0x5bb338){_0x2a5f18[_0x8e97('0x2c')](0x194);}return _0x5bb338;};}function handleError(_0x4ef232,_0x7f0baf){_0x7f0baf=_0x7f0baf||0x1f4;return function(_0x7f3ea1){logger[_0x8e97('0x2d')](_0x7f3ea1[_0x8e97('0x2e')]);if(_0x7f3ea1[_0x8e97('0x2f')]){delete _0x7f3ea1[_0x8e97('0x2f')];}_0x4ef232[_0x8e97('0x1d')](_0x7f0baf)['send'](_0x7f3ea1);};}exports['show']=function(_0x1271c1,_0x364296){var _0x19d800={'raw':![],'where':{'id':_0x1271c1['params']['id']}},_0x3f24d0={};_0x3f24d0[_0x8e97('0x30')]=_[_0x8e97('0x31')](db[_0x8e97('0x32')][_0x8e97('0x33')]);_0x3f24d0[_0x8e97('0x34')]=_['keys'](_0x1271c1[_0x8e97('0x34')]);_0x3f24d0[_0x8e97('0x35')]=_[_0x8e97('0x36')](_0x3f24d0[_0x8e97('0x30')],_0x3f24d0[_0x8e97('0x34')]);_0x19d800['attributes']=_[_0x8e97('0x36')](_0x3f24d0['model'],qs[_0x8e97('0x37')](_0x1271c1[_0x8e97('0x34')][_0x8e97('0x37')]));_0x19d800[_0x8e97('0x38')]=_0x19d800[_0x8e97('0x38')]['length']?_0x19d800[_0x8e97('0x38')]:_0x3f24d0[_0x8e97('0x30')];if(_0x1271c1['query']['includeAll']){_0x19d800[_0x8e97('0x39')]=[{'all':!![]}];}_0x19d800=_[_0x8e97('0x3a')]({},_0x19d800,_0x1271c1[_0x8e97('0x3b')]);return db['DashboardItem'][_0x8e97('0x3c')](_0x19d800)[_0x8e97('0x29')](handleEntityNotFound(_0x364296,null))[_0x8e97('0x29')](respondWithResult(_0x364296,null))[_0x8e97('0x3d')](handleError(_0x364296,null));};exports[_0x8e97('0x2a')]=function(_0x535fde,_0x197b29){return db['DashboardItem'][_0x8e97('0x3c')]({'where':{'id':_0x535fde[_0x8e97('0x3e')]['id']}})[_0x8e97('0x29')](handleEntityNotFound(_0x197b29,null))['then'](removeEntity(_0x197b29,null))['catch'](handleError(_0x197b29,null));};function widgetAttributes(_0x3b8fae){try{switch(_0x3b8fae[_0x8e97('0x3f')]){case _0x8e97('0x40'):return[{'name':'attrUrl','value':_0x3b8fae['attrUrl']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0]['value']:undefined)||'https://'}];case _0x8e97('0x42'):return[{'name':'attrPath','value':_0x3b8fae[_0x8e97('0x43')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||''}];case _0x8e97('0x45'):return[{'name':_0x8e97('0x46'),'value':_0x3b8fae['attrHourFormat']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||_0x8e97('0x47')},{'name':_0x8e97('0x48'),'value':_0x3b8fae[_0x8e97('0x48')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x1]?_0x3b8fae[_0x8e97('0x41')][0x1][_0x8e97('0x44')]:undefined)||_0x8e97('0x49')},{'name':'attrFontSize','value':_0x3b8fae[_0x8e97('0x4a')]||(_0x3b8fae['attrs']&&_0x3b8fae[_0x8e97('0x41')][0x2]?_0x3b8fae[_0x8e97('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x8e97('0x4b'),'value':_0x3b8fae[_0x8e97('0x4b')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||_0x8e97('0x4c')},{'name':'attrVoiceQueues','value':_0x3b8fae[_0x8e97('0x4d')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x1]?_0x3b8fae[_0x8e97('0x41')][0x1][_0x8e97('0x44')]:undefined)||[]},{'name':_0x8e97('0x4a'),'value':_0x3b8fae['attrFontSize']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x2]?_0x3b8fae[_0x8e97('0x41')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x3b8fae[_0x8e97('0x4e')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x3]?_0x3b8fae[_0x8e97('0x41')][0x3][_0x8e97('0x44')]:undefined)||_0x8e97('0x4f')},{'name':'attrEmailAccounts','value':_0x3b8fae[_0x8e97('0x50')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x4]?_0x3b8fae[_0x8e97('0x41')][0x4]['value']:undefined)||''},{'name':_0x8e97('0x51'),'value':_0x3b8fae['attrFaxAccounts']||(_0x3b8fae['attrs']&&_0x3b8fae[_0x8e97('0x41')][0x5]?_0x3b8fae[_0x8e97('0x41')][0x5][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x52'),'value':_0x3b8fae[_0x8e97('0x52')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x6]?_0x3b8fae[_0x8e97('0x41')][0x6][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x53'),'value':_0x3b8fae[_0x8e97('0x53')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x7]?_0x3b8fae['attrs'][0x7][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x54'),'value':_0x3b8fae['attrWhatsappAccounts']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x8]?_0x3b8fae[_0x8e97('0x41')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3b8fae[_0x8e97('0x55')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x9]?_0x3b8fae[_0x8e97('0x41')][0x9][_0x8e97('0x44')]:undefined)||''}];case _0x8e97('0x56'):case _0x8e97('0x57'):return[{'name':_0x8e97('0x58'),'value':_0x3b8fae[_0x8e97('0x58')]||(_0x3b8fae['attrs']&&_0x3b8fae['attrs'][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x44')]:undefined)||_0x8e97('0x4c')},{'name':_0x8e97('0x59'),'value':_0x3b8fae['attrSerie2']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x1]?_0x3b8fae['attrs'][0x1][_0x8e97('0x44')]:undefined)||null},{'name':_0x8e97('0x5a'),'value':_0x3b8fae[_0x8e97('0x5a')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x2]?_0x3b8fae[_0x8e97('0x41')][0x2]['value']:undefined)||null},{'name':_0x8e97('0x4d'),'value':_0x3b8fae[_0x8e97('0x4d')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x3]?_0x3b8fae[_0x8e97('0x41')][0x3]['value']:undefined)||[]},{'name':_0x8e97('0x4e'),'value':_0x3b8fae['attrChannel']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x4]?_0x3b8fae['attrs'][0x4][_0x8e97('0x44')]:undefined)||_0x8e97('0x4f')},{'name':_0x8e97('0x50'),'value':_0x3b8fae[_0x8e97('0x50')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x5]?_0x3b8fae[_0x8e97('0x41')][0x5][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x51'),'value':_0x3b8fae['attrFaxAccounts']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x6]?_0x3b8fae[_0x8e97('0x41')][0x6][_0x8e97('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3b8fae[_0x8e97('0x52')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x7]?_0x3b8fae[_0x8e97('0x41')][0x7][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x53'),'value':_0x3b8fae[_0x8e97('0x53')]||(_0x3b8fae['attrs']&&_0x3b8fae['attrs'][0x8]?_0x3b8fae['attrs'][0x8][_0x8e97('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3b8fae['attrWhatsappAccounts']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x9]?_0x3b8fae[_0x8e97('0x41')][0x9][_0x8e97('0x44')]:undefined)||''},{'name':_0x8e97('0x55'),'value':_0x3b8fae['attrChatWebsites']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0xa]?_0x3b8fae[_0x8e97('0x41')][0xa][_0x8e97('0x44')]:undefined)||''}];case _0x8e97('0x5b'):return[{'name':_0x8e97('0x5c'),'type':_0x3b8fae['reportType']||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0][_0x8e97('0x3f')]:undefined)||null,'value':_0x3b8fae[_0x8e97('0x5c')]||(_0x3b8fae['attrs']&&_0x3b8fae[_0x8e97('0x41')][0x0]?_0x3b8fae[_0x8e97('0x41')][0x0]['value']:undefined)||null},{'name':_0x8e97('0x5d'),'value':_0x3b8fae[_0x8e97('0x5d')]||(_0x3b8fae[_0x8e97('0x41')]&&_0x3b8fae['attrs'][0x1]?_0x3b8fae['attrs'][0x1][_0x8e97('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x5ec6d5){logger[_0x8e97('0x2d')](_0x8e97('0x5e'),JSON['stringify'](_0x5ec6d5));return[];}}exports[_0x8e97('0x5f')]=function(_0x36eaa6,_0x32a851){if(_0x36eaa6[_0x8e97('0x60')]){_0x36eaa6[_0x8e97('0x60')][_0x8e97('0x41')]=widgetAttributes(_0x36eaa6[_0x8e97('0x60')]);}return db[_0x8e97('0x32')][_0x8e97('0x5f')](_0x36eaa6[_0x8e97('0x60')],{})[_0x8e97('0x29')](respondWithResult(_0x32a851,0xc9))[_0x8e97('0x3d')](handleError(_0x32a851,null));};exports[_0x8e97('0x28')]=function(_0x181e0f,_0x4f5dce){if(_0x181e0f[_0x8e97('0x60')]['id']){delete _0x181e0f[_0x8e97('0x60')]['id'];}_0x181e0f['body'][_0x8e97('0x41')]=widgetAttributes(_0x181e0f['body']);return db[_0x8e97('0x32')]['find']({'where':{'id':_0x181e0f[_0x8e97('0x3e')]['id']}})[_0x8e97('0x29')](handleEntityNotFound(_0x4f5dce,null))['then'](saveUpdates(_0x181e0f[_0x8e97('0x60')],null))['then'](respondWithResult(_0x4f5dce,null))[_0x8e97('0x3d')](handleError(_0x4f5dce,null));};
\ No newline at end of file
+var _0x2428=['attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','find','catch','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues'];(function(_0x79c9b5,_0x59b3ae){var _0x5c2d2d=function(_0x1addae){while(--_0x1addae){_0x79c9b5['push'](_0x79c9b5['shift']());}};_0x5c2d2d(++_0x59b3ae);}(_0x2428,0xd3));var _0x8242=function(_0x142cce,_0x38cf81){_0x142cce=_0x142cce-0x0;var _0x1d5013=_0x2428[_0x142cce];return _0x1d5013;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8242('0x0'));var zipdir=require(_0x8242('0x1'));var jsonpatch=require(_0x8242('0x2'));var rp=require(_0x8242('0x3'));var moment=require(_0x8242('0x4'));var BPromise=require(_0x8242('0x5'));var Mustache=require(_0x8242('0x6'));var util=require(_0x8242('0x7'));var path=require(_0x8242('0x8'));var sox=require(_0x8242('0x9'));var csv=require(_0x8242('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8242('0xb'));var _=require(_0x8242('0xc'));var squel=require(_0x8242('0xd'));var crypto=require(_0x8242('0xe'));var jsforce=require(_0x8242('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8242('0xa'));var querystring=require(_0x8242('0x10'));var Papa=require(_0x8242('0x11'));var Redis=require(_0x8242('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8242('0x13'));var as=require(_0x8242('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8242('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8242('0x16')]=_[_0x8242('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8242('0x18'))(new Redis(config[_0x8242('0x16')]));require('./dashboardItem.socket')[_0x8242('0x19')](socket);function respondWithStatusCode(_0x5d649c,_0x4086e5){_0x4086e5=_0x4086e5||0xcc;return function(_0x34dfe3){if(_0x34dfe3){return _0x5d649c[_0x8242('0x1a')](_0x4086e5);}return _0x5d649c[_0x8242('0x1b')](_0x4086e5)[_0x8242('0x1c')]();};}function respondWithResult(_0x15f60c,_0x2a7a8d){_0x2a7a8d=_0x2a7a8d||0xc8;return function(_0x53ac08){if(_0x53ac08){return _0x15f60c['status'](_0x2a7a8d)[_0x8242('0x1d')](_0x53ac08);}};}function respondWithFilteredResult(_0x45a325,_0x3e373e){return function(_0xad2711){if(_0xad2711){var _0x12b745=typeof _0x3e373e[_0x8242('0x1e')]===_0x8242('0x1f')&&typeof _0x3e373e[_0x8242('0x20')]==='undefined';var _0x1aa763=_0xad2711[_0x8242('0x21')];var _0x206916=_0x12b745?0x0:_0x3e373e[_0x8242('0x1e')];var _0x3cc7f4=_0x12b745?_0xad2711['count']:_0x3e373e[_0x8242('0x1e')]+_0x3e373e['limit'];var _0x22746e;if(_0x3cc7f4>=_0x1aa763){_0x3cc7f4=_0x1aa763;_0x22746e=0xc8;}else{_0x22746e=0xce;}_0x45a325[_0x8242('0x1b')](_0x22746e);return _0x45a325['set']('Content-Range',_0x206916+'-'+_0x3cc7f4+'/'+_0x1aa763)[_0x8242('0x1d')](_0xad2711);}return null;};}function patchUpdates(_0x737a81){return function(_0x3336e8){try{jsonpatch[_0x8242('0x22')](_0x3336e8,_0x737a81,!![]);}catch(_0x477191){return BPromise[_0x8242('0x23')](_0x477191);}return _0x3336e8[_0x8242('0x24')]();};}function saveUpdates(_0x5b5811,_0x5ddf2a){return function(_0x4d6ab5){if(_0x4d6ab5){return _0x4d6ab5[_0x8242('0x25')](_0x5b5811)[_0x8242('0x26')](function(_0x4e3caa){return _0x4e3caa;});}return null;};}function removeEntity(_0x4c964a,_0x42e6f5){return function(_0x3e75fd){if(_0x3e75fd){return _0x3e75fd['destroy']()[_0x8242('0x26')](function(){_0x4c964a['status'](0xcc)[_0x8242('0x1c')]();});}};}function handleEntityNotFound(_0x4ab16e,_0x2a8504){return function(_0x20f2b7){if(!_0x20f2b7){_0x4ab16e['sendStatus'](0x194);}return _0x20f2b7;};}function handleError(_0x135a00,_0x1a41b1){_0x1a41b1=_0x1a41b1||0x1f4;return function(_0x77a048){logger[_0x8242('0x27')](_0x77a048[_0x8242('0x28')]);if(_0x77a048[_0x8242('0x29')]){delete _0x77a048[_0x8242('0x29')];}_0x135a00[_0x8242('0x1b')](_0x1a41b1)[_0x8242('0x2a')](_0x77a048);};}exports[_0x8242('0x2b')]=function(_0x3ea5fb,_0x27bedc){var _0x44f2ca={'raw':![],'where':{'id':_0x3ea5fb[_0x8242('0x2c')]['id']}},_0x163b1e={};_0x163b1e[_0x8242('0x2d')]=_[_0x8242('0x2e')](db[_0x8242('0x2f')][_0x8242('0x30')]);_0x163b1e[_0x8242('0x31')]=_[_0x8242('0x2e')](_0x3ea5fb[_0x8242('0x31')]);_0x163b1e[_0x8242('0x32')]=_['intersection'](_0x163b1e[_0x8242('0x2d')],_0x163b1e[_0x8242('0x31')]);_0x44f2ca[_0x8242('0x33')]=_[_0x8242('0x34')](_0x163b1e[_0x8242('0x2d')],qs[_0x8242('0x35')](_0x3ea5fb[_0x8242('0x31')]['fields']));_0x44f2ca['attributes']=_0x44f2ca[_0x8242('0x33')]['length']?_0x44f2ca[_0x8242('0x33')]:_0x163b1e['model'];if(_0x3ea5fb[_0x8242('0x31')][_0x8242('0x36')]){_0x44f2ca[_0x8242('0x37')]=[{'all':!![]}];}_0x44f2ca=_[_0x8242('0x38')]({},_0x44f2ca,_0x3ea5fb[_0x8242('0x39')]);return db[_0x8242('0x2f')][_0x8242('0x3a')](_0x44f2ca)['then'](handleEntityNotFound(_0x27bedc,null))['then'](respondWithResult(_0x27bedc,null))[_0x8242('0x3b')](handleError(_0x27bedc,null));};exports[_0x8242('0x3c')]=function(_0x226846,_0x59c54){return db['DashboardItem'][_0x8242('0x3a')]({'where':{'id':_0x226846['params']['id']}})[_0x8242('0x26')](handleEntityNotFound(_0x59c54,null))[_0x8242('0x26')](removeEntity(_0x59c54,null))[_0x8242('0x3b')](handleError(_0x59c54,null));};function widgetAttributes(_0x5a8a75){try{switch(_0x5a8a75['type']){case _0x8242('0x3d'):return[{'name':_0x8242('0x3e'),'value':_0x5a8a75['attrUrl']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75['attrs'][0x0]?_0x5a8a75['attrs'][0x0][_0x8242('0x40')]:undefined)||'https://'}];case _0x8242('0x41'):return[{'name':_0x8242('0x42'),'value':_0x5a8a75[_0x8242('0x42')]||(_0x5a8a75['attrs']&&_0x5a8a75[_0x8242('0x3f')][0x0]?_0x5a8a75[_0x8242('0x3f')][0x0][_0x8242('0x40')]:undefined)||''}];case _0x8242('0x43'):return[{'name':_0x8242('0x44'),'value':_0x5a8a75[_0x8242('0x44')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x0]?_0x5a8a75['attrs'][0x0][_0x8242('0x40')]:undefined)||_0x8242('0x45')},{'name':'attrTimezone','value':_0x5a8a75[_0x8242('0x46')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x1]?_0x5a8a75[_0x8242('0x3f')][0x1][_0x8242('0x40')]:undefined)||_0x8242('0x47')},{'name':'attrFontSize','value':_0x5a8a75[_0x8242('0x48')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x2]?_0x5a8a75[_0x8242('0x3f')][0x2]['value']:undefined)||0xc}];case _0x8242('0x49'):return[{'name':_0x8242('0x4a'),'value':_0x5a8a75[_0x8242('0x4a')]||(_0x5a8a75['attrs']&&_0x5a8a75[_0x8242('0x3f')][0x0]?_0x5a8a75[_0x8242('0x3f')][0x0][_0x8242('0x40')]:undefined)||_0x8242('0x4b')},{'name':'attrVoiceQueues','value':_0x5a8a75[_0x8242('0x4c')]||(_0x5a8a75['attrs']&&_0x5a8a75[_0x8242('0x3f')][0x1]?_0x5a8a75[_0x8242('0x3f')][0x1][_0x8242('0x40')]:undefined)||[]},{'name':_0x8242('0x48'),'value':_0x5a8a75[_0x8242('0x48')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x2]?_0x5a8a75['attrs'][0x2][_0x8242('0x40')]:undefined)||0x14},{'name':_0x8242('0x4d'),'value':_0x5a8a75['attrChannel']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x3]?_0x5a8a75[_0x8242('0x3f')][0x3][_0x8242('0x40')]:undefined)||_0x8242('0x4e')},{'name':_0x8242('0x4f'),'value':_0x5a8a75[_0x8242('0x4f')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x4]?_0x5a8a75[_0x8242('0x3f')][0x4][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x50'),'value':_0x5a8a75[_0x8242('0x50')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x5]?_0x5a8a75[_0x8242('0x3f')][0x5][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x51'),'value':_0x5a8a75['attrSmsAccounts']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x6]?_0x5a8a75[_0x8242('0x3f')][0x6][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x52'),'value':_0x5a8a75['attrOpenchannelAccounts']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x7]?_0x5a8a75[_0x8242('0x3f')][0x7][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x53'),'value':_0x5a8a75['attrWhatsappAccounts']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x8]?_0x5a8a75[_0x8242('0x3f')][0x8][_0x8242('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5a8a75[_0x8242('0x54')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75['attrs'][0x9]?_0x5a8a75[_0x8242('0x3f')][0x9][_0x8242('0x40')]:undefined)||''}];case _0x8242('0x55'):case _0x8242('0x56'):return[{'name':_0x8242('0x57'),'value':_0x5a8a75['attrSerie1']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75['attrs'][0x0]?_0x5a8a75[_0x8242('0x3f')][0x0][_0x8242('0x40')]:undefined)||_0x8242('0x4b')},{'name':_0x8242('0x58'),'value':_0x5a8a75[_0x8242('0x58')]||(_0x5a8a75['attrs']&&_0x5a8a75['attrs'][0x1]?_0x5a8a75[_0x8242('0x3f')][0x1][_0x8242('0x40')]:undefined)||null},{'name':_0x8242('0x59'),'value':_0x5a8a75[_0x8242('0x59')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75['attrs'][0x2]?_0x5a8a75['attrs'][0x2][_0x8242('0x40')]:undefined)||null},{'name':_0x8242('0x4c'),'value':_0x5a8a75[_0x8242('0x4c')]||(_0x5a8a75['attrs']&&_0x5a8a75[_0x8242('0x3f')][0x3]?_0x5a8a75[_0x8242('0x3f')][0x3]['value']:undefined)||[]},{'name':_0x8242('0x4d'),'value':_0x5a8a75[_0x8242('0x4d')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x4]?_0x5a8a75[_0x8242('0x3f')][0x4]['value']:undefined)||_0x8242('0x4e')},{'name':'attrEmailAccounts','value':_0x5a8a75[_0x8242('0x4f')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x5]?_0x5a8a75[_0x8242('0x3f')][0x5][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x50'),'value':_0x5a8a75[_0x8242('0x50')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x6]?_0x5a8a75[_0x8242('0x3f')][0x6][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x51'),'value':_0x5a8a75[_0x8242('0x51')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x7]?_0x5a8a75[_0x8242('0x3f')][0x7]['value']:undefined)||''},{'name':_0x8242('0x52'),'value':_0x5a8a75[_0x8242('0x52')]||(_0x5a8a75['attrs']&&_0x5a8a75[_0x8242('0x3f')][0x8]?_0x5a8a75['attrs'][0x8]['value']:undefined)||''},{'name':_0x8242('0x53'),'value':_0x5a8a75[_0x8242('0x53')]||(_0x5a8a75['attrs']&&_0x5a8a75[_0x8242('0x3f')][0x9]?_0x5a8a75[_0x8242('0x3f')][0x9][_0x8242('0x40')]:undefined)||''},{'name':_0x8242('0x54'),'value':_0x5a8a75[_0x8242('0x54')]||(_0x5a8a75['attrs']&&_0x5a8a75['attrs'][0xa]?_0x5a8a75[_0x8242('0x3f')][0xa][_0x8242('0x40')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x5a8a75['reportType']||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x0]?_0x5a8a75['attrs'][0x0]['type']:undefined)||null,'value':_0x5a8a75[_0x8242('0x5a')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x0]?_0x5a8a75[_0x8242('0x3f')][0x0][_0x8242('0x40')]:undefined)||null},{'name':_0x8242('0x5b'),'value':_0x5a8a75[_0x8242('0x5b')]||(_0x5a8a75[_0x8242('0x3f')]&&_0x5a8a75[_0x8242('0x3f')][0x1]?_0x5a8a75['attrs'][0x1][_0x8242('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x1962c3){logger[_0x8242('0x27')](_0x8242('0x5c'),JSON[_0x8242('0x5d')](_0x1962c3));return[];}}exports[_0x8242('0x5e')]=function(_0x14d01c,_0x1f1f0d){if(_0x14d01c['body']){_0x14d01c[_0x8242('0x5f')][_0x8242('0x3f')]=widgetAttributes(_0x14d01c[_0x8242('0x5f')]);}return db['DashboardItem'][_0x8242('0x5e')](_0x14d01c[_0x8242('0x5f')],{})[_0x8242('0x26')](respondWithResult(_0x1f1f0d,0xc9))[_0x8242('0x3b')](handleError(_0x1f1f0d,null));};exports[_0x8242('0x25')]=function(_0x464669,_0xd6ad){if(_0x464669[_0x8242('0x5f')]['id']){delete _0x464669[_0x8242('0x5f')]['id'];}_0x464669[_0x8242('0x5f')][_0x8242('0x3f')]=widgetAttributes(_0x464669[_0x8242('0x5f')]);return db[_0x8242('0x2f')][_0x8242('0x3a')]({'where':{'id':_0x464669[_0x8242('0x2c')]['id']}})[_0x8242('0x26')](handleEntityNotFound(_0xd6ad,null))['then'](saveUpdates(_0x464669['body'],null))[_0x8242('0x26')](respondWithResult(_0xd6ad,null))[_0x8242('0x3b')](handleError(_0xd6ad,null));};
\ No newline at end of file
index a075cf9..768589e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf76=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit','hook','exports'];(function(_0x7725ea,_0x2c0c4a){var _0x3f05fb=function(_0x2e1f36){while(--_0x2e1f36){_0x7725ea['push'](_0x7725ea['shift']());}};_0x3f05fb(++_0x2c0c4a);}(_0xdf76,0x1c2));var _0x6df7=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0xdf76[_0x460fd7];return _0x44d1c2;};'use strict';var EventEmitter=require(_0x6df7('0x0'));var DashboardItem=require(_0x6df7('0x1'))['db'][_0x6df7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6df7('0x3')](0x0);var events={'afterCreate':_0x6df7('0x4'),'afterUpdate':_0x6df7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a56e3){return function(_0x6f8419,_0x189291,_0x47ded0){DashboardItemEvents[_0x6df7('0x6')](_0x1a56e3+':'+_0x6f8419['id'],_0x6f8419);DashboardItemEvents[_0x6df7('0x6')](_0x1a56e3,_0x6f8419);_0x47ded0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x6df7('0x7')](e,emitEvent(event));}}module[_0x6df7('0x8')]=DashboardItemEvents;
\ No newline at end of file
+var _0x5613=['update','remove','hook','events','setMaxListeners','save'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5613,0x177));var _0x3561=function(_0x13c0ab,_0x39f268){_0x13c0ab=_0x13c0ab-0x0;var _0x2f7fb8=_0x5613[_0x13c0ab];return _0x2f7fb8;};'use strict';var EventEmitter=require(_0x3561('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3561('0x1')](0x0);var events={'afterCreate':_0x3561('0x2'),'afterUpdate':_0x3561('0x3'),'afterDestroy':_0x3561('0x4')};function emitEvent(_0xbb7f3d){return function(_0x37d7b5,_0x58e557,_0x1109a0){DashboardItemEvents['emit'](_0xbb7f3d+':'+_0x37d7b5['id'],_0x37d7b5);DashboardItemEvents['emit'](_0xbb7f3d,_0x37d7b5);_0x1109a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x3561('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents;
\ No newline at end of file
index 4478351..9b19d87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd20e=['api','bluebird','request-promise','rimraf','../../config/environment','exports','DashboardItem','lodash','util','../../config/logger'];(function(_0x217e48,_0x2e4ae2){var _0x47f9c4=function(_0x4dc60c){while(--_0x4dc60c){_0x217e48['push'](_0x217e48['shift']());}};_0x47f9c4(++_0x2e4ae2);}(_0xd20e,0xbb));var _0xed20=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd20e[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var logger=require(_0xed20('0x2'))(_0xed20('0x3'));var moment=require('moment');var BPromise=require(_0xed20('0x4'));var rp=require(_0xed20('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed20('0x6'));var config=require(_0xed20('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xed20('0x8')]=function(_0x1eda4e,_0x408ac3){return _0x1eda4e['define'](_0xed20('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd331=['request-promise','path','rimraf','../../config/environment','exports','DashboardItem','dashboard_items','lodash','api','moment'];(function(_0x5bf467,_0x17192e){var _0x5a62ae=function(_0x20c3aa){while(--_0x20c3aa){_0x5bf467['push'](_0x5bf467['shift']());}};_0x5a62ae(++_0x17192e);}(_0xd331,0xed));var _0x1d33=function(_0x3263d4,_0x2a93af){_0x3263d4=_0x3263d4-0x0;var _0x26e080=_0xd331[_0x3263d4];return _0x26e080;};'use strict';var _=require(_0x1d33('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1d33('0x1'));var moment=require(_0x1d33('0x2'));var BPromise=require('bluebird');var rp=require(_0x1d33('0x3'));var fs=require('fs');var path=require(_0x1d33('0x4'));var rimraf=require(_0x1d33('0x5'));var config=require(_0x1d33('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x1d33('0x7')]=function(_0x24c32b,_0x4cf782){return _0x24c32b['define'](_0x1d33('0x8'),attributes,{'tableName':_0x1d33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index abd0c4b..cb629ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51d4=['DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0x260082,_0xe76e2f){var _0x5d24ae=function(_0x1d548d){while(--_0x1d548d){_0x260082['push'](_0x260082['shift']());}};_0x5d24ae(++_0xe76e2f);}(_0x51d4,0x1ae));var _0x451d=function(_0x2e56fc,_0xcd8e83){_0x2e56fc=_0x2e56fc-0x0;var _0x1720f4=_0x51d4[_0x2e56fc];return _0x1720f4;};'use strict';var _=require(_0x451d('0x0'));var util=require(_0x451d('0x1'));var moment=require('moment');var BPromise=require(_0x451d('0x2'));var rs=require(_0x451d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x451d('0x4'))['db'];var utils=require(_0x451d('0x5'));var logger=require(_0x451d('0x6'))(_0x451d('0x7'));var config=require(_0x451d('0x8'));var jayson=require(_0x451d('0x9'));var client=jayson[_0x451d('0xa')][_0x451d('0xb')]({'port':0x232a});config[_0x451d('0xc')]=_[_0x451d('0xd')](config['redis'],{'host':_0x451d('0xe'),'port':0x18eb});var socket=require(_0x451d('0xf'))(new Redis(config[_0x451d('0xc')]));require(_0x451d('0x10'))[_0x451d('0x11')](socket);function respondWithRpcPromise(_0x300ced,_0x16a9de,_0x43f2ec){return new BPromise(function(_0x2eb65f,_0x38bae3){return client[_0x451d('0x12')](_0x300ced,_0x43f2ec)[_0x451d('0x13')](function(_0x3e603e){logger['info'](_0x451d('0x14'),_0x16a9de,_0x451d('0x15'));logger[_0x451d('0x16')](_0x451d('0x17'),_0x16a9de,_0x451d('0x15'),JSON[_0x451d('0x18')](_0x3e603e));if(_0x3e603e['error']){if(_0x3e603e['error'][_0x451d('0x19')]===0x1f4){logger[_0x451d('0x1a')](_0x451d('0x14'),_0x16a9de,_0x3e603e[_0x451d('0x1a')][_0x451d('0x1b')]);return _0x38bae3(_0x3e603e[_0x451d('0x1a')]['message']);}logger[_0x451d('0x1a')](_0x451d('0x14'),_0x16a9de,_0x3e603e[_0x451d('0x1a')][_0x451d('0x1b')]);return _0x2eb65f(_0x3e603e[_0x451d('0x1a')][_0x451d('0x1b')]);}else{logger[_0x451d('0x1c')](_0x451d('0x14'),_0x16a9de,_0x451d('0x15'));_0x2eb65f(_0x3e603e[_0x451d('0x1d')][_0x451d('0x1b')]);}})['catch'](function(_0x5c3f61){logger[_0x451d('0x1a')](_0x451d('0x14'),_0x16a9de,_0x5c3f61);_0x38bae3(_0x5c3f61);});});}
\ No newline at end of file
+var _0x01b0=['DashboardItem,\x20%s,\x20%s','message','info','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./dashboardItem.socket','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0x01b0,0xca));var _0x001b=function(_0x37f40e,_0x5c5a1d){_0x37f40e=_0x37f40e-0x0;var _0x1bab3f=_0x01b0[_0x37f40e];return _0x1bab3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x001b('0x0'));var fs=require('fs');var Redis=require(_0x001b('0x1'));var db=require(_0x001b('0x2'))['db'];var utils=require(_0x001b('0x3'));var logger=require('../../config/logger')(_0x001b('0x4'));var config=require(_0x001b('0x5'));var jayson=require(_0x001b('0x6'));var client=jayson[_0x001b('0x7')][_0x001b('0x8')]({'port':0x232a});config[_0x001b('0x9')]=_['defaults'](config[_0x001b('0x9')],{'host':_0x001b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x001b('0xb'))['register'](socket);function respondWithRpcPromise(_0x3c6aeb,_0x3cc634,_0x3e26e8){return new BPromise(function(_0xed3a94,_0x4b1612){return client['request'](_0x3c6aeb,_0x3e26e8)['then'](function(_0x4bc095){logger['info']('DashboardItem,\x20%s,\x20%s',_0x3cc634,_0x001b('0xc'));logger[_0x001b('0xd')](_0x001b('0xe'),_0x3cc634,'request\x20sent',JSON[_0x001b('0xf')](_0x4bc095));if(_0x4bc095[_0x001b('0x10')]){if(_0x4bc095[_0x001b('0x10')][_0x001b('0x11')]===0x1f4){logger[_0x001b('0x10')](_0x001b('0x12'),_0x3cc634,_0x4bc095[_0x001b('0x10')][_0x001b('0x13')]);return _0x4b1612(_0x4bc095[_0x001b('0x10')]['message']);}logger[_0x001b('0x10')](_0x001b('0x12'),_0x3cc634,_0x4bc095[_0x001b('0x10')]['message']);return _0xed3a94(_0x4bc095[_0x001b('0x10')][_0x001b('0x13')]);}else{logger[_0x001b('0x14')](_0x001b('0x12'),_0x3cc634,_0x001b('0xc'));_0xed3a94(_0x4bc095['result'][_0x001b('0x13')]);}})[_0x001b('0x15')](function(_0x43253d){logger[_0x001b('0x10')](_0x001b('0x12'),_0x3cc634,_0x43253d);_0x4b1612(_0x43253d);});});}
\ No newline at end of file
index 3e3f54d..57f606a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4521=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4521,0xd2));var _0x1452=function(_0xbb874,_0x2b7f90){_0xbb874=_0xbb874-0x0;var _0x13a525=_0x4521[_0xbb874];return _0x13a525;};'use strict';var DashboardItemEvents=require(_0x1452('0x0'));var events=['save',_0x1452('0x1'),_0x1452('0x2')];function createListener(_0x1d43a1,_0x4c328e){return function(_0x1d2aa5){_0x4c328e[_0x1452('0x3')](_0x1d43a1,_0x1d2aa5);};}function removeListener(_0x2301a0,_0xf0942b){return function(){DashboardItemEvents[_0x1452('0x4')](_0x2301a0,_0xf0942b);};}exports[_0x1452('0x5')]=function(_0x584955){for(var _0x362547=0x0,_0x265c34=events[_0x1452('0x6')];_0x362547<_0x265c34;_0x362547++){var _0x1b0e74=events[_0x362547];var _0x74eb99=createListener(_0x1452('0x7')+_0x1b0e74,_0x584955);DashboardItemEvents['on'](_0x1b0e74,_0x74eb99);}};
\ No newline at end of file
+var _0x3c28=['removeListener','register','length','dashboardItem:','save','remove','update'];(function(_0x1ca2ff,_0x141cd6){var _0x16b496=function(_0x57dcde){while(--_0x57dcde){_0x1ca2ff['push'](_0x1ca2ff['shift']());}};_0x16b496(++_0x141cd6);}(_0x3c28,0x169));var _0x83c2=function(_0x1d3696,_0x525d46){_0x1d3696=_0x1d3696-0x0;var _0x5ba65c=_0x3c28[_0x1d3696];return _0x5ba65c;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x83c2('0x0'),_0x83c2('0x1'),_0x83c2('0x2')];function createListener(_0x507f66,_0x4b3570){return function(_0x11608a){_0x4b3570['emit'](_0x507f66,_0x11608a);};}function removeListener(_0x4ebbdc,_0x2b4a5b){return function(){DashboardItemEvents[_0x83c2('0x3')](_0x4ebbdc,_0x2b4a5b);};}exports[_0x83c2('0x4')]=function(_0x3608f4){for(var _0x160b74=0x0,_0x56415c=events[_0x83c2('0x5')];_0x160b74<_0x56415c;_0x160b74++){var _0x3e8257=events[_0x160b74];var _0xfc5f69=createListener(_0x83c2('0x6')+_0x3e8257,_0x3608f4);DashboardItemEvents['on'](_0x3e8257,_0xfc5f69);}};
\ No newline at end of file
index f3ce492..a5dff3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e44=['Router','../../components/auth/service','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','util','path','express'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x4e44,0x1cd));var _0x44e4=function(_0x51d188,_0x937fba){_0x51d188=_0x51d188-0x0;var _0x27289b=_0x4e44[_0x51d188];return _0x27289b;};'use strict';var multer=require(_0x44e4('0x0'));var util=require(_0x44e4('0x1'));var path=require(_0x44e4('0x2'));var timeout=require('connect-timeout');var express=require(_0x44e4('0x3'));var router=express[_0x44e4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x44e4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x44e4('0x6')](_0x44e4('0x7'),auth['isAuthenticated'](),controller[_0x44e4('0x8')]);router[_0x44e4('0x9')]('/',auth[_0x44e4('0xa')](),controller[_0x44e4('0xb')]);router['put'](_0x44e4('0x7'),auth[_0x44e4('0xa')](),controller[_0x44e4('0xc')]);router[_0x44e4('0xd')](_0x44e4('0x7'),auth[_0x44e4('0xa')](),controller[_0x44e4('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0x1874=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','post','isAuthenticated','delete','util','path','connect-timeout','express','Router'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1874,0x1e5));var _0x4187=function(_0x4acebb,_0x356726){_0x4acebb=_0x4acebb-0x0;var _0x21b211=_0x1874[_0x4acebb];return _0x21b211;};'use strict';var multer=require('multer');var util=require(_0x4187('0x0'));var path=require(_0x4187('0x1'));var timeout=require(_0x4187('0x2'));var express=require(_0x4187('0x3'));var router=express[_0x4187('0x4')]();var fs_extra=require(_0x4187('0x5'));var auth=require(_0x4187('0x6'));var interaction=require(_0x4187('0x7'));var config=require(_0x4187('0x8'));var controller=require(_0x4187('0x9'));router['get'](_0x4187('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4187('0xb')]('/',auth[_0x4187('0xc')](),controller['create']);router['put'](_0x4187('0xa'),auth[_0x4187('0xc')](),controller['update']);router[_0x4187('0xd')](_0x4187('0xa'),auth[_0x4187('0xc')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 3ff2637..a2375be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc547=['STRING','sequelize','ENUM','first','second','third'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xc547,0xaf));var _0x7c54=function(_0x4d6400,_0x40ef47){_0x4d6400=_0x4d6400-0x0;var _0x5d89a4=_0xc547[_0x4d6400];return _0x5d89a4;};'use strict';var Sequelize=require(_0x7c54('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x7c54('0x1')](_0x7c54('0x2'),_0x7c54('0x3'),_0x7c54('0x4')),'allowNull':![],'defaultValue':_0x7c54('0x2')},'description':{'type':Sequelize[_0x7c54('0x5')]}};
\ No newline at end of file
+var _0x0744=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x40f2b0,_0x10bf06){var _0x15ee7e=function(_0x4827d5){while(--_0x4827d5){_0x40f2b0['push'](_0x40f2b0['shift']());}};_0x15ee7e(++_0x10bf06);}(_0x0744,0xe2));var _0x4074=function(_0x15f6f7,_0x305040){_0x15f6f7=_0x15f6f7-0x0;var _0x37c435=_0x0744[_0x15f6f7];return _0x37c435;};'use strict';var Sequelize=require(_0x4074('0x0'));module[_0x4074('0x1')]={'name':{'type':Sequelize[_0x4074('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x4074('0x3')](_0x4074('0x4'),_0x4074('0x5'),_0x4074('0x6')),'allowNull':![],'defaultValue':_0x4074('0x4')},'description':{'type':Sequelize[_0x4074('0x2')]}};
\ No newline at end of file
index 6f7ae4b..a970769 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6f0=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','destroy','then','get','Dispositions','end','error','name','index','map','Disposition','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes'];(function(_0x251762,_0xba82a5){var _0x54dd64=function(_0x2a8f72){while(--_0x2a8f72){_0x251762['push'](_0x251762['shift']());}};_0x54dd64(++_0xba82a5);}(_0xf6f0,0x157));var _0x0f6f=function(_0x2d0fff,_0x128adc){_0x2d0fff=_0x2d0fff-0x0;var _0x40c5b1=_0xf6f0[_0x2d0fff];return _0x40c5b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f6f('0x0'));var rp=require(_0x0f6f('0x1'));var moment=require(_0x0f6f('0x2'));var BPromise=require(_0x0f6f('0x3'));var Mustache=require(_0x0f6f('0x4'));var util=require(_0x0f6f('0x5'));var path=require(_0x0f6f('0x6'));var sox=require(_0x0f6f('0x7'));var csv=require(_0x0f6f('0x8'));var ejs=require(_0x0f6f('0x9'));var fs=require('fs');var fs_extra=require(_0x0f6f('0xa'));var _=require(_0x0f6f('0xb'));var squel=require(_0x0f6f('0xc'));var crypto=require(_0x0f6f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f6f('0xe'));var toCsv=require(_0x0f6f('0x8'));var querystring=require(_0x0f6f('0xf'));var Papa=require(_0x0f6f('0x10'));var Redis=require(_0x0f6f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0f6f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f6f('0x13'));var logger=require('../../config/logger')(_0x0f6f('0x14'));var utils=require(_0x0f6f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0f6f('0x16'));var db=require(_0x0f6f('0x17'))['db'];function respondWithStatusCode(_0x26d8b3,_0x5e1c60){_0x5e1c60=_0x5e1c60||0xcc;return function(_0x36f908){if(_0x36f908){return _0x26d8b3[_0x0f6f('0x18')](_0x5e1c60);}return _0x26d8b3[_0x0f6f('0x19')](_0x5e1c60)['end']();};}function respondWithResult(_0x3e8595,_0x1ce704){_0x1ce704=_0x1ce704||0xc8;return function(_0x3a5cfd){if(_0x3a5cfd){return _0x3e8595[_0x0f6f('0x19')](_0x1ce704)[_0x0f6f('0x1a')](_0x3a5cfd);}};}function respondWithFilteredResult(_0x462073,_0x323756){return function(_0x19ef40){if(_0x19ef40){var _0x519512=typeof _0x323756[_0x0f6f('0x1b')]===_0x0f6f('0x1c')&&typeof _0x323756[_0x0f6f('0x1d')]===_0x0f6f('0x1c');var _0x4ab23f=_0x19ef40[_0x0f6f('0x1e')];var _0x156a5e=_0x519512?0x0:_0x323756[_0x0f6f('0x1b')];var _0x22adcc=_0x519512?_0x19ef40[_0x0f6f('0x1e')]:_0x323756['offset']+_0x323756['limit'];var _0x1b0422;if(_0x22adcc>=_0x4ab23f){_0x22adcc=_0x4ab23f;_0x1b0422=0xc8;}else{_0x1b0422=0xce;}_0x462073[_0x0f6f('0x19')](_0x1b0422);return _0x462073['set'](_0x0f6f('0x1f'),_0x156a5e+'-'+_0x22adcc+'/'+_0x4ab23f)[_0x0f6f('0x1a')](_0x19ef40);}return null;};}function patchUpdates(_0x4c801b){return function(_0x476a1d){try{jsonpatch[_0x0f6f('0x20')](_0x476a1d,_0x4c801b,!![]);}catch(_0x5bf46a){return BPromise['reject'](_0x5bf46a);}return _0x476a1d['save']();};}function saveUpdates(_0x4679a8,_0x304707){return function(_0x55a42d){if(_0x55a42d){return _0x55a42d['update'](_0x4679a8)['then'](function(_0x1bc684){return _0x1bc684;});}return null;};}function removeEntity(_0x1aeafd,_0x499e6f){return function(_0x1fd47b){if(_0x1fd47b){return _0x1fd47b[_0x0f6f('0x21')]()[_0x0f6f('0x22')](function(){var _0x2d39b6=_0x1fd47b[_0x0f6f('0x23')]({'plain':!![]});var _0x5b118a=_0x0f6f('0x24');return db['UserProfileResource'][_0x0f6f('0x21')]({'where':{'type':_0x5b118a,'resourceId':_0x2d39b6['id']}})[_0x0f6f('0x22')](function(){return _0x1fd47b;});})[_0x0f6f('0x22')](function(){_0x1aeafd[_0x0f6f('0x19')](0xcc)[_0x0f6f('0x25')]();});}};}function handleEntityNotFound(_0x291609,_0x14700e){return function(_0x431d05){if(!_0x431d05){_0x291609['sendStatus'](0x194);}return _0x431d05;};}function handleError(_0x3e6618,_0x2e7b28){_0x2e7b28=_0x2e7b28||0x1f4;return function(_0x21c262){logger[_0x0f6f('0x26')](_0x21c262['stack']);if(_0x21c262[_0x0f6f('0x27')]){delete _0x21c262[_0x0f6f('0x27')];}_0x3e6618[_0x0f6f('0x19')](_0x2e7b28)['send'](_0x21c262);};}exports[_0x0f6f('0x28')]=function(_0x47c684,_0x325312){var _0x4d43ed={},_0x12feec={},_0x11b9bc={'count':0x0,'rows':[]};var _0x293397=_[_0x0f6f('0x29')](db[_0x0f6f('0x2a')][_0x0f6f('0x2b')],function(_0x24bc52){return{'name':_0x24bc52[_0x0f6f('0x2c')],'type':_0x24bc52[_0x0f6f('0x2d')]['key']};});_0x12feec['model']=_[_0x0f6f('0x29')](_0x293397,'name');_0x12feec['query']=_[_0x0f6f('0x2e')](_0x47c684[_0x0f6f('0x2f')]);_0x12feec[_0x0f6f('0x30')]=_[_0x0f6f('0x31')](_0x12feec[_0x0f6f('0x32')],_0x12feec['query']);_0x4d43ed[_0x0f6f('0x33')]=_[_0x0f6f('0x31')](_0x12feec[_0x0f6f('0x32')],qs['fields'](_0x47c684[_0x0f6f('0x2f')]['fields']));_0x4d43ed[_0x0f6f('0x33')]=_0x4d43ed[_0x0f6f('0x33')][_0x0f6f('0x34')]?_0x4d43ed['attributes']:_0x12feec[_0x0f6f('0x32')];if(!_0x47c684[_0x0f6f('0x2f')][_0x0f6f('0x35')](_0x0f6f('0x36'))){_0x4d43ed['limit']=qs[_0x0f6f('0x1d')](_0x47c684[_0x0f6f('0x2f')]['limit']);_0x4d43ed['offset']=qs[_0x0f6f('0x1b')](_0x47c684[_0x0f6f('0x2f')][_0x0f6f('0x1b')]);}_0x4d43ed[_0x0f6f('0x37')]=qs[_0x0f6f('0x38')](_0x47c684[_0x0f6f('0x2f')][_0x0f6f('0x38')]);_0x4d43ed[_0x0f6f('0x39')]=qs[_0x0f6f('0x30')](_[_0x0f6f('0x3a')](_0x47c684[_0x0f6f('0x2f')],_0x12feec['filters']),_0x293397);if(_0x47c684[_0x0f6f('0x2f')][_0x0f6f('0x3b')]){_0x4d43ed['where']=_[_0x0f6f('0x3c')](_0x4d43ed[_0x0f6f('0x39')],{'$or':_[_0x0f6f('0x29')](_0x293397,function(_0x5628c8){if(_0x5628c8[_0x0f6f('0x2d')]!==_0x0f6f('0x3d')){var _0x212499={};_0x212499[_0x5628c8[_0x0f6f('0x27')]]={'$like':'%'+_0x47c684[_0x0f6f('0x2f')][_0x0f6f('0x3b')]+'%'};return _0x212499;}})});}_0x4d43ed=_[_0x0f6f('0x3c')]({},_0x4d43ed,_0x47c684[_0x0f6f('0x3e')]);var _0x107d2d={'where':_0x4d43ed[_0x0f6f('0x39')]};return db[_0x0f6f('0x2a')][_0x0f6f('0x1e')](_0x107d2d)[_0x0f6f('0x22')](function(_0x36af26){_0x11b9bc[_0x0f6f('0x1e')]=_0x36af26;if(_0x47c684[_0x0f6f('0x2f')][_0x0f6f('0x3f')]){_0x4d43ed[_0x0f6f('0x40')]=[{'all':!![]}];}return db[_0x0f6f('0x2a')]['findAll'](_0x4d43ed);})[_0x0f6f('0x22')](function(_0x4e6728){_0x11b9bc[_0x0f6f('0x41')]=_0x4e6728;return _0x11b9bc;})['then'](respondWithFilteredResult(_0x325312,_0x4d43ed))[_0x0f6f('0x42')](handleError(_0x325312,null));};exports[_0x0f6f('0x43')]=function(_0x5e26ce,_0x5b9ca0){var _0x11bb8f={'raw':!![],'where':{'id':_0x5e26ce[_0x0f6f('0x44')]['id']}},_0x3e70c8={};_0x3e70c8[_0x0f6f('0x32')]=_[_0x0f6f('0x2e')](db[_0x0f6f('0x2a')]['rawAttributes']);_0x3e70c8[_0x0f6f('0x2f')]=_[_0x0f6f('0x2e')](_0x5e26ce['query']);_0x3e70c8[_0x0f6f('0x30')]=_['intersection'](_0x3e70c8[_0x0f6f('0x32')],_0x3e70c8[_0x0f6f('0x2f')]);_0x11bb8f[_0x0f6f('0x33')]=_['intersection'](_0x3e70c8['model'],qs[_0x0f6f('0x45')](_0x5e26ce[_0x0f6f('0x2f')]['fields']));_0x11bb8f[_0x0f6f('0x33')]=_0x11bb8f[_0x0f6f('0x33')][_0x0f6f('0x34')]?_0x11bb8f[_0x0f6f('0x33')]:_0x3e70c8[_0x0f6f('0x32')];if(_0x5e26ce[_0x0f6f('0x2f')][_0x0f6f('0x3f')]){_0x11bb8f[_0x0f6f('0x40')]=[{'all':!![]}];}_0x11bb8f=_[_0x0f6f('0x3c')]({},_0x11bb8f,_0x5e26ce[_0x0f6f('0x3e')]);return db[_0x0f6f('0x2a')]['find'](_0x11bb8f)[_0x0f6f('0x22')](handleEntityNotFound(_0x5b9ca0,null))['then'](respondWithResult(_0x5b9ca0,null))[_0x0f6f('0x42')](handleError(_0x5b9ca0,null));};exports[_0x0f6f('0x46')]=function(_0x48a95f,_0xad5b45){return db[_0x0f6f('0x2a')][_0x0f6f('0x46')](_0x48a95f[_0x0f6f('0x47')],{})[_0x0f6f('0x22')](function(_0x8df099){var _0xc0dfde=_0x48a95f[_0x0f6f('0x48')][_0x0f6f('0x23')]({'plain':!![]});if(!_0xc0dfde)throw new Error(_0x0f6f('0x49'));if(_0xc0dfde['role']==='user'){var _0x5159ca=_0x8df099[_0x0f6f('0x23')]({'plain':!![]});var _0x51ccf4=_0x0f6f('0x24');return db['UserProfileSection'][_0x0f6f('0x4a')]({'where':{'name':_0x51ccf4,'userProfileId':_0xc0dfde[_0x0f6f('0x4b')]},'raw':!![]})['then'](function(_0x7fe4a9){if(_0x7fe4a9&&_0x7fe4a9['autoAssociation']===0x0){return db[_0x0f6f('0x4c')][_0x0f6f('0x46')]({'name':_0x5159ca['name'],'resourceId':_0x5159ca['id'],'type':_0x7fe4a9[_0x0f6f('0x27')],'sectionId':_0x7fe4a9['id']},{})[_0x0f6f('0x22')](function(){return _0x8df099;});}else{return _0x8df099;}})[_0x0f6f('0x42')](function(_0xce2407){logger[_0x0f6f('0x26')](_0x0f6f('0x4d'),_0xce2407);throw _0xce2407;});}return _0x8df099;})[_0x0f6f('0x22')](respondWithResult(_0xad5b45,0xc9))[_0x0f6f('0x42')](handleError(_0xad5b45,null));};exports[_0x0f6f('0x4e')]=function(_0x5ab028,_0x139404){if(_0x5ab028['body']['id']){delete _0x5ab028['body']['id'];}return db['Disposition'][_0x0f6f('0x4a')]({'where':{'id':_0x5ab028['params']['id']}})[_0x0f6f('0x22')](handleEntityNotFound(_0x139404,null))[_0x0f6f('0x22')](saveUpdates(_0x5ab028[_0x0f6f('0x47')],null))[_0x0f6f('0x22')](respondWithResult(_0x139404,null))[_0x0f6f('0x42')](handleError(_0x139404,null));};exports[_0x0f6f('0x21')]=function(_0x2b22ee,_0x10d24e){return db['Disposition'][_0x0f6f('0x4a')]({'where':{'id':_0x2b22ee[_0x0f6f('0x44')]['id']}})[_0x0f6f('0x22')](handleEntityNotFound(_0x10d24e,null))[_0x0f6f('0x22')](removeEntity(_0x10d24e,null))[_0x0f6f('0x42')](handleError(_0x10d24e,null));};
\ No newline at end of file
+var _0x9655=['send','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','include','findAll','catch','show','params','length','merge','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name'];(function(_0x552e0c,_0x18b5b3){var _0x50a946=function(_0x1c09c6){while(--_0x1c09c6){_0x552e0c['push'](_0x552e0c['shift']());}};_0x50a946(++_0x18b5b3);}(_0x9655,0x160));var _0x5965=function(_0x32825e,_0x434d56){_0x32825e=_0x32825e-0x0;var _0x18f77a=_0x9655[_0x32825e];return _0x18f77a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5965('0x0'));var zipdir=require(_0x5965('0x1'));var jsonpatch=require(_0x5965('0x2'));var rp=require(_0x5965('0x3'));var moment=require(_0x5965('0x4'));var BPromise=require(_0x5965('0x5'));var Mustache=require('mustache');var util=require(_0x5965('0x6'));var path=require(_0x5965('0x7'));var sox=require('sox');var csv=require(_0x5965('0x8'));var ejs=require(_0x5965('0x9'));var fs=require('fs');var fs_extra=require(_0x5965('0xa'));var _=require(_0x5965('0xb'));var squel=require('squel');var crypto=require(_0x5965('0xc'));var jsforce=require(_0x5965('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5965('0x8'));var querystring=require(_0x5965('0xe'));var Papa=require(_0x5965('0xf'));var Redis=require(_0x5965('0x10'));var authService=require(_0x5965('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5965('0x12'));var hardwareService=require(_0x5965('0x13'));var logger=require('../../config/logger')(_0x5965('0x14'));var utils=require(_0x5965('0x15'));var config=require(_0x5965('0x16'));var licenseUtil=require(_0x5965('0x17'));var db=require(_0x5965('0x18'))['db'];function respondWithStatusCode(_0x334286,_0x233dbc){_0x233dbc=_0x233dbc||0xcc;return function(_0xc9a1d2){if(_0xc9a1d2){return _0x334286[_0x5965('0x19')](_0x233dbc);}return _0x334286[_0x5965('0x1a')](_0x233dbc)['end']();};}function respondWithResult(_0x54d5c8,_0x5f94e6){_0x5f94e6=_0x5f94e6||0xc8;return function(_0x372f73){if(_0x372f73){return _0x54d5c8[_0x5965('0x1a')](_0x5f94e6)[_0x5965('0x1b')](_0x372f73);}};}function respondWithFilteredResult(_0xba6bb7,_0x1959c5){return function(_0x2d6b6c){if(_0x2d6b6c){var _0x204644=typeof _0x1959c5[_0x5965('0x1c')]===_0x5965('0x1d')&&typeof _0x1959c5[_0x5965('0x1e')]===_0x5965('0x1d');var _0x43dd1f=_0x2d6b6c['count'];var _0x4c046a=_0x204644?0x0:_0x1959c5[_0x5965('0x1c')];var _0x3fa749=_0x204644?_0x2d6b6c[_0x5965('0x1f')]:_0x1959c5[_0x5965('0x1c')]+_0x1959c5['limit'];var _0x473378;if(_0x3fa749>=_0x43dd1f){_0x3fa749=_0x43dd1f;_0x473378=0xc8;}else{_0x473378=0xce;}_0xba6bb7[_0x5965('0x1a')](_0x473378);return _0xba6bb7[_0x5965('0x20')]('Content-Range',_0x4c046a+'-'+_0x3fa749+'/'+_0x43dd1f)['json'](_0x2d6b6c);}return null;};}function patchUpdates(_0x23baf8){return function(_0x470211){try{jsonpatch['apply'](_0x470211,_0x23baf8,!![]);}catch(_0x242a71){return BPromise['reject'](_0x242a71);}return _0x470211[_0x5965('0x21')]();};}function saveUpdates(_0x25f0e1,_0x37652c){return function(_0x2d3608){if(_0x2d3608){return _0x2d3608['update'](_0x25f0e1)[_0x5965('0x22')](function(_0x45bce0){return _0x45bce0;});}return null;};}function removeEntity(_0x59523b,_0x3547fa){return function(_0x13269f){if(_0x13269f){return _0x13269f[_0x5965('0x23')]()[_0x5965('0x22')](function(){var _0x30b597=_0x13269f[_0x5965('0x24')]({'plain':!![]});var _0x1e3d9a=_0x5965('0x25');return db[_0x5965('0x26')]['destroy']({'where':{'type':_0x1e3d9a,'resourceId':_0x30b597['id']}})[_0x5965('0x22')](function(){return _0x13269f;});})[_0x5965('0x22')](function(){_0x59523b[_0x5965('0x1a')](0xcc)[_0x5965('0x27')]();});}};}function handleEntityNotFound(_0x2d1778,_0x4d6f0a){return function(_0x44898a){if(!_0x44898a){_0x2d1778[_0x5965('0x19')](0x194);}return _0x44898a;};}function handleError(_0x54beae,_0x9b50a){_0x9b50a=_0x9b50a||0x1f4;return function(_0x12ab37){logger[_0x5965('0x28')](_0x12ab37[_0x5965('0x29')]);if(_0x12ab37[_0x5965('0x2a')]){delete _0x12ab37[_0x5965('0x2a')];}_0x54beae['status'](_0x9b50a)[_0x5965('0x2b')](_0x12ab37);};}exports['index']=function(_0x5bea7f,_0x56f84a){var _0x3b5e38={},_0x370bdf={},_0x290bbd={'count':0x0,'rows':[]};var _0x306e12=_[_0x5965('0x2c')](db[_0x5965('0x2d')][_0x5965('0x2e')],function(_0x498c99){return{'name':_0x498c99[_0x5965('0x2f')],'type':_0x498c99[_0x5965('0x30')][_0x5965('0x31')]};});_0x370bdf[_0x5965('0x32')]=_['map'](_0x306e12,'name');_0x370bdf[_0x5965('0x33')]=_['keys'](_0x5bea7f[_0x5965('0x33')]);_0x370bdf[_0x5965('0x34')]=_[_0x5965('0x35')](_0x370bdf['model'],_0x370bdf['query']);_0x3b5e38[_0x5965('0x36')]=_[_0x5965('0x35')](_0x370bdf['model'],qs['fields'](_0x5bea7f[_0x5965('0x33')][_0x5965('0x37')]));_0x3b5e38['attributes']=_0x3b5e38['attributes']['length']?_0x3b5e38['attributes']:_0x370bdf[_0x5965('0x32')];if(!_0x5bea7f['query'][_0x5965('0x38')](_0x5965('0x39'))){_0x3b5e38[_0x5965('0x1e')]=qs['limit'](_0x5bea7f['query']['limit']);_0x3b5e38[_0x5965('0x1c')]=qs[_0x5965('0x1c')](_0x5bea7f[_0x5965('0x33')]['offset']);}_0x3b5e38['order']=qs[_0x5965('0x3a')](_0x5bea7f[_0x5965('0x33')][_0x5965('0x3a')]);_0x3b5e38[_0x5965('0x3b')]=qs['filters'](_['pick'](_0x5bea7f[_0x5965('0x33')],_0x370bdf[_0x5965('0x34')]),_0x306e12);if(_0x5bea7f[_0x5965('0x33')][_0x5965('0x3c')]){_0x3b5e38[_0x5965('0x3b')]=_['merge'](_0x3b5e38[_0x5965('0x3b')],{'$or':_[_0x5965('0x2c')](_0x306e12,function(_0x11a87b){if(_0x11a87b[_0x5965('0x30')]!=='VIRTUAL'){var _0x10a796={};_0x10a796[_0x11a87b[_0x5965('0x2a')]]={'$like':'%'+_0x5bea7f[_0x5965('0x33')]['filter']+'%'};return _0x10a796;}})});}_0x3b5e38=_['merge']({},_0x3b5e38,_0x5bea7f[_0x5965('0x3d')]);var _0x3c25b8={'where':_0x3b5e38[_0x5965('0x3b')]};return db[_0x5965('0x2d')][_0x5965('0x1f')](_0x3c25b8)[_0x5965('0x22')](function(_0x26bd9d){_0x290bbd[_0x5965('0x1f')]=_0x26bd9d;if(_0x5bea7f['query'][_0x5965('0x3e')]){_0x3b5e38[_0x5965('0x3f')]=[{'all':!![]}];}return db[_0x5965('0x2d')][_0x5965('0x40')](_0x3b5e38);})[_0x5965('0x22')](function(_0x1215d0){_0x290bbd['rows']=_0x1215d0;return _0x290bbd;})['then'](respondWithFilteredResult(_0x56f84a,_0x3b5e38))[_0x5965('0x41')](handleError(_0x56f84a,null));};exports[_0x5965('0x42')]=function(_0x5c39f9,_0x48afe2){var _0xa3d518={'raw':!![],'where':{'id':_0x5c39f9[_0x5965('0x43')]['id']}},_0xf2992f={};_0xf2992f[_0x5965('0x32')]=_['keys'](db[_0x5965('0x2d')][_0x5965('0x2e')]);_0xf2992f[_0x5965('0x33')]=_['keys'](_0x5c39f9[_0x5965('0x33')]);_0xf2992f[_0x5965('0x34')]=_[_0x5965('0x35')](_0xf2992f['model'],_0xf2992f[_0x5965('0x33')]);_0xa3d518[_0x5965('0x36')]=_[_0x5965('0x35')](_0xf2992f[_0x5965('0x32')],qs[_0x5965('0x37')](_0x5c39f9[_0x5965('0x33')]['fields']));_0xa3d518[_0x5965('0x36')]=_0xa3d518[_0x5965('0x36')][_0x5965('0x44')]?_0xa3d518[_0x5965('0x36')]:_0xf2992f[_0x5965('0x32')];if(_0x5c39f9[_0x5965('0x33')]['includeAll']){_0xa3d518[_0x5965('0x3f')]=[{'all':!![]}];}_0xa3d518=_[_0x5965('0x45')]({},_0xa3d518,_0x5c39f9[_0x5965('0x3d')]);return db[_0x5965('0x2d')]['find'](_0xa3d518)[_0x5965('0x22')](handleEntityNotFound(_0x48afe2,null))[_0x5965('0x22')](respondWithResult(_0x48afe2,null))['catch'](handleError(_0x48afe2,null));};exports[_0x5965('0x46')]=function(_0x19bcc2,_0x3c0303){return db[_0x5965('0x2d')][_0x5965('0x46')](_0x19bcc2['body'],{})[_0x5965('0x22')](function(_0x584841){var _0x4cb2ba=_0x19bcc2['user'][_0x5965('0x24')]({'plain':!![]});if(!_0x4cb2ba)throw new Error(_0x5965('0x47'));if(_0x4cb2ba['role']==='user'){var _0x26f630=_0x584841['get']({'plain':!![]});var _0x5e4233='Dispositions';return db[_0x5965('0x48')][_0x5965('0x49')]({'where':{'name':_0x5e4233,'userProfileId':_0x4cb2ba[_0x5965('0x4a')]},'raw':!![]})[_0x5965('0x22')](function(_0x30b071){if(_0x30b071&&_0x30b071[_0x5965('0x4b')]===0x0){return db[_0x5965('0x26')][_0x5965('0x46')]({'name':_0x26f630[_0x5965('0x2a')],'resourceId':_0x26f630['id'],'type':_0x30b071[_0x5965('0x2a')],'sectionId':_0x30b071['id']},{})[_0x5965('0x22')](function(){return _0x584841;});}else{return _0x584841;}})['catch'](function(_0x3936aa){logger[_0x5965('0x28')](_0x5965('0x4c'),_0x3936aa);throw _0x3936aa;});}return _0x584841;})[_0x5965('0x22')](respondWithResult(_0x3c0303,0xc9))[_0x5965('0x41')](handleError(_0x3c0303,null));};exports[_0x5965('0x4d')]=function(_0xfaf2e6,_0x4dd1f4){if(_0xfaf2e6['body']['id']){delete _0xfaf2e6[_0x5965('0x4e')]['id'];}return db[_0x5965('0x2d')][_0x5965('0x49')]({'where':{'id':_0xfaf2e6[_0x5965('0x43')]['id']}})[_0x5965('0x22')](handleEntityNotFound(_0x4dd1f4,null))[_0x5965('0x22')](saveUpdates(_0xfaf2e6['body'],null))[_0x5965('0x22')](respondWithResult(_0x4dd1f4,null))[_0x5965('0x41')](handleError(_0x4dd1f4,null));};exports[_0x5965('0x23')]=function(_0x7eaea0,_0x4555d2){return db[_0x5965('0x2d')][_0x5965('0x49')]({'where':{'id':_0x7eaea0[_0x5965('0x43')]['id']}})['then'](handleEntityNotFound(_0x4555d2,null))[_0x5965('0x22')](removeEntity(_0x4555d2,null))[_0x5965('0x41')](handleError(_0x4555d2,null));};
\ No newline at end of file
index 9d1fff8..4512f8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef43=['api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x32055a,_0x3456ec){var _0x469c56=function(_0x4c09a6){while(--_0x4c09a6){_0x32055a['push'](_0x32055a['shift']());}};_0x469c56(++_0x3456ec);}(_0xef43,0x1bf));var _0x3ef4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xef43[_0x432682];return _0x463d05;};'use strict';var _=require(_0x3ef4('0x0'));var util=require(_0x3ef4('0x1'));var logger=require(_0x3ef4('0x2'))(_0x3ef4('0x3'));var moment=require('moment');var BPromise=require(_0x3ef4('0x4'));var rp=require(_0x3ef4('0x5'));var fs=require('fs');var path=require(_0x3ef4('0x6'));var rimraf=require(_0x3ef4('0x7'));var config=require(_0x3ef4('0x8'));var attributes=require(_0x3ef4('0x9'));module['exports']=function(_0x123c10,_0x4ca7e1){return _0x123c10[_0x3ef4('0xa')](_0x3ef4('0xb'),attributes,{'tableName':_0x3ef4('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3ef4('0xd'),'fields':[_0x3ef4('0xe'),_0x3ef4('0xf')]},{'unique':!![],'name':_0x3ef4('0x10'),'fields':[_0x3ef4('0xe'),_0x3ef4('0x11')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0x3ef4('0x12'),'fields':['name',_0x3ef4('0x13')]},{'unique':!![],'name':_0x3ef4('0x14'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x3ef4('0x15'),'fields':['name',_0x3ef4('0x16')]},{'unique':!![],'name':_0x3ef4('0x17'),'fields':['name',_0x3ef4('0x18')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x86a0=['ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x86a0,0x91));var _0x086a=function(_0x197d78,_0x1bd130){_0x197d78=_0x197d78-0x0;var _0x5808c1=_0x86a0[_0x197d78];return _0x5808c1;};'use strict';var _=require('lodash');var util=require(_0x086a('0x0'));var logger=require(_0x086a('0x1'))(_0x086a('0x2'));var moment=require('moment');var BPromise=require(_0x086a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x086a('0x4'));var rimraf=require(_0x086a('0x5'));var config=require(_0x086a('0x6'));var attributes=require(_0x086a('0x7'));module[_0x086a('0x8')]=function(_0x583da8,_0x40b689){return _0x583da8[_0x086a('0x9')](_0x086a('0xa'),attributes,{'tableName':_0x086a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x086a('0xc'),'fields':['name',_0x086a('0xd')]},{'unique':!![],'name':_0x086a('0xe'),'fields':[_0x086a('0xf'),_0x086a('0x10')]},{'unique':!![],'name':'name_mail','fields':['name',_0x086a('0x11')]},{'unique':!![],'name':_0x086a('0x12'),'fields':[_0x086a('0xf'),'SmsAccountId']},{'unique':!![],'name':_0x086a('0x13'),'fields':[_0x086a('0xf'),_0x086a('0x14')]},{'unique':!![],'name':'name_openchannel','fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x086a('0x15'),'fields':[_0x086a('0xf'),_0x086a('0x16')]}],'timestamps':!![]});};
\ No newline at end of file
index dfe2a4d..eb6801b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ed6a6,_0x31132b){var _0x21e07d=function(_0x589dc6){while(--_0x589dc6){_0x1ed6a6['push'](_0x1ed6a6['shift']());}};_0x21e07d(++_0x31132b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4189bf,_0x1b9a27){var _0x3da2c5=function(_0x35670b){while(--_0x35670b){_0x4189bf['push'](_0x4189bf['shift']());}};_0x3da2c5(++_0x1b9a27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index 73c2b68..aab0aea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe9d7=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','update','exports','multer','util','Router','fs-extra'];(function(_0x127761,_0x1be7d9){var _0x56b863=function(_0x244698){while(--_0x244698){_0x127761['push'](_0x127761['shift']());}};_0x56b863(++_0x1be7d9);}(_0xe9d7,0x14c));var _0x7e9d=function(_0x36f82a,_0x4ec395){_0x36f82a=_0x36f82a-0x0;var _0x495067=_0xe9d7[_0x36f82a];return _0x495067;};'use strict';var multer=require(_0x7e9d('0x0'));var util=require(_0x7e9d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e9d('0x2')]();var fs_extra=require(_0x7e9d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7e9d('0x4'));var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth[_0x7e9d('0x5')](),controller[_0x7e9d('0x6')]);router[_0x7e9d('0x7')](_0x7e9d('0x8'),auth[_0x7e9d('0x5')](),controller[_0x7e9d('0x9')]);router[_0x7e9d('0xa')]('/',auth[_0x7e9d('0x5')](),controller[_0x7e9d('0xb')]);router['put'](_0x7e9d('0x8'),auth[_0x7e9d('0x5')](),controller[_0x7e9d('0xc')]);router['delete'](_0x7e9d('0x8'),auth[_0x7e9d('0x5')](),controller['destroy']);module[_0x7e9d('0xd')]=router;
\ No newline at end of file
+var _0x5625=['get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./disposition.controller'];(function(_0x3de840,_0x25db42){var _0x99b05e=function(_0x4dcc81){while(--_0x4dcc81){_0x3de840['push'](_0x3de840['shift']());}};_0x99b05e(++_0x25db42);}(_0x5625,0x110));var _0x5562=function(_0x3a7e58,_0x5ad8de){_0x3a7e58=_0x3a7e58-0x0;var _0x42f274=_0x5625[_0x3a7e58];return _0x42f274;};'use strict';var multer=require(_0x5562('0x0'));var util=require(_0x5562('0x1'));var path=require('path');var timeout=require(_0x5562('0x2'));var express=require(_0x5562('0x3'));var router=express[_0x5562('0x4')]();var fs_extra=require(_0x5562('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5562('0x6'));var controller=require(_0x5562('0x7'));router[_0x5562('0x8')]('/',auth['isAuthenticated'](),controller[_0x5562('0x9')]);router[_0x5562('0x8')](_0x5562('0xa'),auth['isAuthenticated'](),controller[_0x5562('0xb')]);router[_0x5562('0xc')]('/',auth[_0x5562('0xd')](),controller[_0x5562('0xe')]);router[_0x5562('0xf')](_0x5562('0xa'),auth[_0x5562('0xd')](),controller[_0x5562('0x10')]);router[_0x5562('0x11')]('/:id',auth[_0x5562('0xd')](),controller[_0x5562('0x12')]);module[_0x5562('0x13')]=router;
\ No newline at end of file
index fe9c777..427fe99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bcd=['9600','12000','14400','INTEGER','SIP','KHOMP','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','4800','7200'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0x4bcd,0x187));var _0xd4bc=function(_0x1af98a,_0x1b684f){_0x1af98a=_0x1af98a-0x0;var _0x12028b=_0x4bcd[_0x1af98a];return _0x12028b;};'use strict';var Sequelize=require(_0xd4bc('0x0'));module[_0xd4bc('0x1')]={'name':{'type':Sequelize[_0xd4bc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd4bc('0x2')]},'ecm':{'type':Sequelize[_0xd4bc('0x3')](_0xd4bc('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd4bc('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xd4bc('0x2')],'unique':_0xd4bc('0x5')},'minrate':{'type':Sequelize[_0xd4bc('0x3')]('2400',_0xd4bc('0x6'),_0xd4bc('0x7'),_0xd4bc('0x8'),_0xd4bc('0x9'),_0xd4bc('0xa')),'defaultValue':_0xd4bc('0x6')},'maxrate':{'type':Sequelize[_0xd4bc('0x3')]('2400',_0xd4bc('0x6'),_0xd4bc('0x7'),_0xd4bc('0x8'),_0xd4bc('0x9'),_0xd4bc('0xa')),'defaultValue':_0xd4bc('0xa')},'modem':{'type':Sequelize[_0xd4bc('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xd4bc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd4bc('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd4bc('0x3')](_0xd4bc('0xc'),'IAX','DADHI',_0xd4bc('0xd')),'defaultValue':_0xd4bc('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd4bc('0xe')],'defaultValue':function(){return _0xd4bc('0xf');}},'notificationSound':{'type':Sequelize[_0xd4bc('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd4bc('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd4bc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd4bc('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd4bc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd4bc('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd4bc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd4bc('0x11'),'set':function(_0x44cfa9){if(!_0x44cfa9)this[_0xd4bc('0x12')](_0xd4bc('0x13'),null);this[_0xd4bc('0x12')](_0xd4bc('0x14'),_0x44cfa9);}}};
\ No newline at end of file
+var _0x080a=['2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400'];(function(_0x372a3d,_0x332395){var _0x3549a8=function(_0x5062b2){while(--_0x5062b2){_0x372a3d['push'](_0x372a3d['shift']());}};_0x3549a8(++_0x332395);}(_0x080a,0x146));var _0xa080=function(_0x2908d4,_0x1246f0){_0x2908d4=_0x2908d4-0x0;var _0x2e8b94=_0x080a[_0x2908d4];return _0x2e8b94;};'use strict';var Sequelize=require(_0xa080('0x0'));module[_0xa080('0x1')]={'name':{'type':Sequelize[_0xa080('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa080('0x2')]},'ecm':{'type':Sequelize[_0xa080('0x3')](_0xa080('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa080('0x2')],'defaultValue':_0xa080('0x5')},'localstationid':{'type':Sequelize[_0xa080('0x2')],'unique':_0xa080('0x6')},'minrate':{'type':Sequelize[_0xa080('0x3')]('2400',_0xa080('0x7'),_0xa080('0x8'),_0xa080('0x9'),_0xa080('0xa'),_0xa080('0xb')),'defaultValue':_0xa080('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xa080('0xc'),'4800',_0xa080('0x8'),_0xa080('0x9'),_0xa080('0xa'),_0xa080('0xb')),'defaultValue':_0xa080('0xb')},'modem':{'type':Sequelize[_0xa080('0x2')],'defaultValue':_0xa080('0xd')},'gateway':{'type':Sequelize[_0xa080('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa080('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa080('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa080('0x3')](_0xa080('0xf'),'IAX',_0xa080('0x10'),_0xa080('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa080('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa080('0x12')],'defaultValue':function(){return _0xa080('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa080('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa080('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa080('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa080('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa080('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa080('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xa080('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xa080('0x14')],'defaultValue':![],'comment':_0xa080('0x16'),'set':function(_0x470460){if(!_0x470460)this[_0xa080('0x17')](_0xa080('0x18'),null);this[_0xa080('0x17')](_0xa080('0x19'),_0x470460);}}};
\ No newline at end of file
index d6783eb..c16e9ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x20ff=['updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','FaxAccounts','UserProfileResource','sendStatus','name','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','show','params','create','body','user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rawAttributes','findAll','removeAnswers','addInteraction','omit','FaxInteraction','Contact','User','Owner','fullname','Tag','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt'];(function(_0x413df5,_0x525343){var _0x435678=function(_0x425c85){while(--_0x425c85){_0x413df5['push'](_0x413df5['shift']());}};_0x435678(++_0x525343);}(_0x20ff,0xe9));var _0xf20f=function(_0x3b0138,_0x4b4e19){_0x3b0138=_0x3b0138-0x0;var _0x4969ed=_0x20ff[_0x3b0138];return _0x4969ed;};'use strict';var emlformat=require(_0xf20f('0x0'));var rimraf=require(_0xf20f('0x1'));var zipdir=require(_0xf20f('0x2'));var jsonpatch=require(_0xf20f('0x3'));var rp=require(_0xf20f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf20f('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf20f('0x6'));var fs=require('fs');var fs_extra=require(_0xf20f('0x7'));var _=require(_0xf20f('0x8'));var squel=require(_0xf20f('0x9'));var crypto=require(_0xf20f('0xa'));var jsforce=require(_0xf20f('0xb'));var deskjs=require(_0xf20f('0xc'));var toCsv=require(_0xf20f('0xd'));var querystring=require(_0xf20f('0xe'));var Papa=require(_0xf20f('0xf'));var Redis=require(_0xf20f('0x10'));var authService=require(_0xf20f('0x11'));var qs=require(_0xf20f('0x12'));var as=require(_0xf20f('0x13'));var hardwareService=require(_0xf20f('0x14'));var logger=require(_0xf20f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf20f('0x16'));var db=require(_0xf20f('0x17'))['db'];config[_0xf20f('0x18')]=_[_0xf20f('0x19')](config[_0xf20f('0x18')],{'host':_0xf20f('0x1a'),'port':0x18eb});var socket=require(_0xf20f('0x1b'))(new Redis(config[_0xf20f('0x18')]));require(_0xf20f('0x1c'))[_0xf20f('0x1d')](socket);var jayson=require(_0xf20f('0x1e'));var client=jayson[_0xf20f('0x1f')][_0xf20f('0x20')]({'port':0x232c});var client9002=jayson[_0xf20f('0x1f')][_0xf20f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x181711,_0x247e0b,_0x340b4f,_0x121bb1){return new BPromise(function(_0x1aed2b,_0x59623e){var _0x3cafca=_0x121bb1||client;return _0x3cafca[_0xf20f('0x21')](_0x181711,_0x340b4f)['then'](function(_0x36690a){logger[_0xf20f('0x22')](_0xf20f('0x23'),_0x247e0b,_0xf20f('0x24'));logger[_0xf20f('0x25')](_0xf20f('0x26'),_0x247e0b,_0xf20f('0x24'),JSON[_0xf20f('0x27')](_0x36690a));if(_0x36690a[_0xf20f('0x28')]){if(_0x36690a['error'][_0xf20f('0x29')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x247e0b,_0x36690a[_0xf20f('0x28')][_0xf20f('0x2a')]);return _0x59623e(_0x36690a[_0xf20f('0x28')][_0xf20f('0x2a')]);}logger[_0xf20f('0x28')](_0xf20f('0x23'),_0x247e0b,_0x36690a[_0xf20f('0x28')]['message']);return _0x1aed2b(_0x36690a['error'][_0xf20f('0x2a')]);}else{logger[_0xf20f('0x22')]('FaxAccount,\x20%s,\x20%s',_0x247e0b,_0xf20f('0x24'));_0x1aed2b(_0x36690a[_0xf20f('0x2b')][_0xf20f('0x2a')]);}})[_0xf20f('0x2c')](function(_0x3d6723){logger['error']('FaxAccount,\x20%s,\x20%s',_0x247e0b,_0x3d6723);_0x59623e(_0x3d6723);});});}function respondWithStatusCode(_0x52e7d0,_0x2200ca){_0x2200ca=_0x2200ca||0xcc;return function(_0x3cb92f){if(_0x3cb92f){return _0x52e7d0['sendStatus'](_0x2200ca);}return _0x52e7d0[_0xf20f('0x2d')](_0x2200ca)[_0xf20f('0x2e')]();};}function respondWithResult(_0x19b7a6,_0x36513b){_0x36513b=_0x36513b||0xc8;return function(_0x17f34b){if(_0x17f34b){return _0x19b7a6[_0xf20f('0x2d')](_0x36513b)[_0xf20f('0x2f')](_0x17f34b);}};}function respondWithFilteredResult(_0x368fd1,_0x20239a){return function(_0x219856){if(_0x219856){var _0x2a8ee1=typeof _0x20239a[_0xf20f('0x30')]===_0xf20f('0x31')&&typeof _0x20239a[_0xf20f('0x32')]===_0xf20f('0x31');var _0x162969=_0x219856[_0xf20f('0x33')];var _0x50f8a1=_0x2a8ee1?0x0:_0x20239a[_0xf20f('0x30')];var _0x1d1f84=_0x2a8ee1?_0x219856['count']:_0x20239a[_0xf20f('0x30')]+_0x20239a[_0xf20f('0x32')];var _0x44ce26;if(_0x1d1f84>=_0x162969){_0x1d1f84=_0x162969;_0x44ce26=0xc8;}else{_0x44ce26=0xce;}_0x368fd1[_0xf20f('0x2d')](_0x44ce26);return _0x368fd1['set'](_0xf20f('0x34'),_0x50f8a1+'-'+_0x1d1f84+'/'+_0x162969)[_0xf20f('0x2f')](_0x219856);}return null;};}function patchUpdates(_0x505c23){return function(_0x370910){try{jsonpatch[_0xf20f('0x35')](_0x370910,_0x505c23,!![]);}catch(_0x142660){return BPromise[_0xf20f('0x36')](_0x142660);}return _0x370910['save']();};}function saveUpdates(_0x1f9ce1,_0x466201){return function(_0x1c7024){if(_0x1c7024){return _0x1c7024[_0xf20f('0x37')](_0x1f9ce1)['then'](function(_0x1def6f){return _0x1def6f;});}return null;};}function removeEntity(_0x272669,_0x5bd162){return function(_0x57fd10){if(_0x57fd10){return _0x57fd10[_0xf20f('0x38')]()[_0xf20f('0x39')](function(){var _0x443781=_0x57fd10['get']({'plain':!![]});var _0xc091cc=_0xf20f('0x3a');return db[_0xf20f('0x3b')][_0xf20f('0x38')]({'where':{'type':_0xc091cc,'resourceId':_0x443781['id']}})[_0xf20f('0x39')](function(){return _0x57fd10;});})[_0xf20f('0x39')](function(){_0x272669[_0xf20f('0x2d')](0xcc)[_0xf20f('0x2e')]();});}};}function handleEntityNotFound(_0x296973,_0x3843c3){return function(_0x3aaab1){if(!_0x3aaab1){_0x296973[_0xf20f('0x3c')](0x194);}return _0x3aaab1;};}function handleError(_0x14a686,_0x1ed774){_0x1ed774=_0x1ed774||0x1f4;return function(_0x53e6eb){logger['error'](_0x53e6eb['stack']);if(_0x53e6eb[_0xf20f('0x3d')]){delete _0x53e6eb['name'];}_0x14a686[_0xf20f('0x2d')](_0x1ed774)['send'](_0x53e6eb);};}exports['index']=function(_0x3d539f,_0x584022){var _0xf49fac={'include':[{'model':db[_0xf20f('0x3e')],'as':_0xf20f('0x3f')}]},_0x2b8288={},_0x475838={'count':0x0,'rows':[]};var _0xcf2202=_[_0xf20f('0x40')](db[_0xf20f('0x41')]['rawAttributes'],function(_0x388118){return{'name':_0x388118[_0xf20f('0x42')],'type':_0x388118[_0xf20f('0x43')][_0xf20f('0x44')]};});_0x2b8288[_0xf20f('0x45')]=_[_0xf20f('0x40')](_0xcf2202,_0xf20f('0x3d'));_0x2b8288[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x3d539f[_0xf20f('0x46')]);_0x2b8288[_0xf20f('0x48')]=_[_0xf20f('0x49')](_0x2b8288[_0xf20f('0x45')],_0x2b8288['query']);_0xf49fac[_0xf20f('0x4a')]=_[_0xf20f('0x49')](_0x2b8288[_0xf20f('0x45')],qs['fields'](_0x3d539f[_0xf20f('0x46')][_0xf20f('0x4b')]));_0xf49fac[_0xf20f('0x4a')]=_0xf49fac[_0xf20f('0x4a')][_0xf20f('0x4c')]?_0xf49fac[_0xf20f('0x4a')]:_0x2b8288[_0xf20f('0x45')];if(!_0x3d539f[_0xf20f('0x46')][_0xf20f('0x4d')](_0xf20f('0x4e'))){_0xf49fac['limit']=qs[_0xf20f('0x32')](_0x3d539f[_0xf20f('0x46')]['limit']);_0xf49fac[_0xf20f('0x30')]=qs[_0xf20f('0x30')](_0x3d539f['query'][_0xf20f('0x30')]);}_0xf49fac[_0xf20f('0x4f')]=qs['sort'](_0x3d539f['query'][_0xf20f('0x50')]);_0xf49fac['where']=qs['filters'](_[_0xf20f('0x51')](_0x3d539f[_0xf20f('0x46')],_0x2b8288[_0xf20f('0x48')]),_0xcf2202);if(_0x3d539f[_0xf20f('0x46')][_0xf20f('0x52')]){_0xf49fac['where']=_[_0xf20f('0x53')](_0xf49fac[_0xf20f('0x54')],{'$or':_[_0xf20f('0x40')](_0xcf2202,function(_0x4d278d){if(_0x4d278d[_0xf20f('0x43')]!==_0xf20f('0x55')){var _0x4ab8e8={};_0x4ab8e8[_0x4d278d[_0xf20f('0x3d')]]={'$like':'%'+_0x3d539f[_0xf20f('0x46')]['filter']+'%'};return _0x4ab8e8;}})});}_0xf49fac=_[_0xf20f('0x53')]({},_0xf49fac,_0x3d539f['options']);var _0x11c8bb={'where':_0xf49fac[_0xf20f('0x54')]};return db[_0xf20f('0x41')][_0xf20f('0x33')](_0x11c8bb)[_0xf20f('0x39')](function(_0x15c112){_0x475838[_0xf20f('0x33')]=_0x15c112;if(_0x3d539f['query'][_0xf20f('0x56')]){_0xf49fac[_0xf20f('0x57')]=[{'all':!![]}];}return db[_0xf20f('0x41')]['findAll'](_0xf49fac);})['then'](function(_0x1ce301){_0x475838[_0xf20f('0x58')]=_0x1ce301;return _0x475838;})[_0xf20f('0x39')](respondWithFilteredResult(_0x584022,_0xf49fac))['catch'](handleError(_0x584022,null));};exports[_0xf20f('0x59')]=function(_0x446b57,_0x1a7870){var _0x256953={'raw':![],'where':{'id':_0x446b57[_0xf20f('0x5a')]['id']},'include':[{'model':db[_0xf20f('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3e44a9={};_0x3e44a9[_0xf20f('0x45')]=_[_0xf20f('0x47')](db[_0xf20f('0x41')]['rawAttributes']);_0x3e44a9[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x446b57['query']);_0x3e44a9[_0xf20f('0x48')]=_[_0xf20f('0x49')](_0x3e44a9['model'],_0x3e44a9[_0xf20f('0x46')]);_0x256953[_0xf20f('0x4a')]=_[_0xf20f('0x49')](_0x3e44a9[_0xf20f('0x45')],qs[_0xf20f('0x4b')](_0x446b57[_0xf20f('0x46')][_0xf20f('0x4b')]));_0x256953['attributes']=_0x256953[_0xf20f('0x4a')][_0xf20f('0x4c')]?_0x256953[_0xf20f('0x4a')]:_0x3e44a9['model'];if(_0x446b57[_0xf20f('0x46')][_0xf20f('0x56')]){_0x256953[_0xf20f('0x57')]=[{'all':!![]}];}_0x256953=_[_0xf20f('0x53')]({},_0x256953,_0x446b57['options']);return db[_0xf20f('0x41')]['find'](_0x256953)[_0xf20f('0x39')](handleEntityNotFound(_0x1a7870,null))[_0xf20f('0x39')](respondWithResult(_0x1a7870,null))[_0xf20f('0x2c')](handleError(_0x1a7870,null));};exports[_0xf20f('0x5b')]=function(_0x6e669c,_0x3995cc){return db[_0xf20f('0x41')][_0xf20f('0x5b')](_0x6e669c[_0xf20f('0x5c')],{})['then'](function(_0x5aaaac){var _0x380b24=_0x6e669c[_0xf20f('0x5d')][_0xf20f('0x5e')]({'plain':!![]});if(!_0x380b24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x380b24['role']===_0xf20f('0x5d')){var _0x240556=_0x5aaaac['get']({'plain':!![]});var _0x55a0e7=_0xf20f('0x3a');return db[_0xf20f('0x5f')][_0xf20f('0x60')]({'where':{'name':_0x55a0e7,'userProfileId':_0x380b24['userProfileId']},'raw':!![]})[_0xf20f('0x39')](function(_0x336b4b){if(_0x336b4b&&_0x336b4b[_0xf20f('0x61')]===0x0){return db[_0xf20f('0x3b')][_0xf20f('0x5b')]({'name':_0x240556[_0xf20f('0x3d')],'resourceId':_0x240556['id'],'type':_0x336b4b[_0xf20f('0x3d')],'sectionId':_0x336b4b['id']},{})['then'](function(){return _0x5aaaac;});}else{return _0x5aaaac;}})[_0xf20f('0x2c')](function(_0xd91aab){logger[_0xf20f('0x28')](_0xf20f('0x62'),_0xd91aab);throw _0xd91aab;});}return _0x5aaaac;})['then'](respondWithResult(_0x3995cc,0xc9))[_0xf20f('0x2c')](handleError(_0x3995cc,null));};exports[_0xf20f('0x37')]=function(_0x5bf672,_0x4e69f0){if(_0x5bf672[_0xf20f('0x5c')]['id']){delete _0x5bf672[_0xf20f('0x5c')]['id'];}return db[_0xf20f('0x41')][_0xf20f('0x60')]({'where':{'id':_0x5bf672['params']['id']},'include':[{'model':db[_0xf20f('0x3e')],'as':_0xf20f('0x3f')}]})[_0xf20f('0x39')](handleEntityNotFound(_0x4e69f0,null))[_0xf20f('0x39')](saveUpdates(_0x5bf672[_0xf20f('0x5c')],null))[_0xf20f('0x39')](respondWithResult(_0x4e69f0,null))[_0xf20f('0x2c')](handleError(_0x4e69f0,null));};exports['destroy']=function(_0x28fccc,_0x49d6d6){return db['FaxAccount'][_0xf20f('0x60')]({'where':{'id':_0x28fccc['params']['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x49d6d6,null))[_0xf20f('0x39')](removeEntity(_0x49d6d6,null))[_0xf20f('0x2c')](handleError(_0x49d6d6,null));};exports['describe']=function(_0x39af5a,_0xd837eb){return db[_0xf20f('0x41')][_0xf20f('0x63')]()[_0xf20f('0x39')](respondWithResult(_0xd837eb,null))['catch'](handleError(_0xd837eb,null));};exports['addDisposition']=function(_0x4a77c1,_0x38402f,_0x104b01){if(_0x4a77c1[_0xf20f('0x5c')]['id']){delete _0x4a77c1[_0xf20f('0x5c')]['id'];}return db[_0xf20f('0x41')][_0xf20f('0x60')]({'where':{'id':_0x4a77c1[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x38402f,null))[_0xf20f('0x39')](function(_0x4dc672){if(_0x4dc672){_0x4a77c1[_0xf20f('0x5c')][_0xf20f('0x64')]=_0x4dc672['id'];return db[_0xf20f('0x65')][_0xf20f('0x5b')](_0x4a77c1['body']);}})['then'](respondWithResult(_0x38402f,null))[_0xf20f('0x2c')](handleError(_0x38402f,null));};exports[_0xf20f('0x66')]=function(_0x53e7e6,_0x2e7662,_0x5a3a59){var _0x36b244={'raw':![],'where':{}};var _0x347e4f={};var _0x17536c={'count':0x0,'rows':[]};return db[_0xf20f('0x41')]['findOne']({'where':{'id':_0x53e7e6[_0xf20f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2e7662,null))[_0xf20f('0x39')](function(_0x3482c3){if(_0x3482c3){_0x347e4f[_0xf20f('0x45')]=_[_0xf20f('0x47')](db[_0xf20f('0x65')]['rawAttributes']);_0x347e4f[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x53e7e6['query']);_0x347e4f['filters']=_['intersection'](_0x347e4f[_0xf20f('0x45')],_0x347e4f[_0xf20f('0x46')]);_0x36b244[_0xf20f('0x4a')]=_[_0xf20f('0x49')](_0x347e4f['model'],qs[_0xf20f('0x4b')](_0x53e7e6['query'][_0xf20f('0x4b')]));_0x36b244[_0xf20f('0x4a')]=_0x36b244[_0xf20f('0x4a')][_0xf20f('0x4c')]?_0x36b244[_0xf20f('0x4a')]:_0x347e4f['model'];if(!_0x53e7e6[_0xf20f('0x46')][_0xf20f('0x4d')](_0xf20f('0x4e'))){_0x36b244['limit']=qs['limit'](_0x53e7e6[_0xf20f('0x46')][_0xf20f('0x32')]);_0x36b244[_0xf20f('0x30')]=qs['offset'](_0x53e7e6['query'][_0xf20f('0x30')]);}_0x36b244[_0xf20f('0x4f')]=qs[_0xf20f('0x50')](_0x53e7e6[_0xf20f('0x46')]['sort']);_0x36b244['where']=qs['filters'](_[_0xf20f('0x51')](_0x53e7e6[_0xf20f('0x46')],_0x347e4f['filters']));_0x36b244[_0xf20f('0x54')][_0xf20f('0x64')]=_0x3482c3['id'];if(_0x53e7e6[_0xf20f('0x46')][_0xf20f('0x52')]){_0x36b244[_0xf20f('0x54')]=_[_0xf20f('0x53')](_0x36b244[_0xf20f('0x54')],{'$or':_[_0xf20f('0x40')](_0x36b244[_0xf20f('0x4a')],function(_0x5a68a3){var _0x47aa87={};_0x47aa87[_0x5a68a3]={'$like':'%'+_0x53e7e6[_0xf20f('0x46')][_0xf20f('0x52')]+'%'};return _0x47aa87;})});}_0x36b244=_[_0xf20f('0x53')]({},_0x36b244,_0x53e7e6[_0xf20f('0x67')]);return db[_0xf20f('0x65')]['count']({'where':_0x36b244[_0xf20f('0x54')]})[_0xf20f('0x39')](function(_0x3ab475){_0x17536c[_0xf20f('0x33')]=_0x3ab475;if(_0x53e7e6['query'][_0xf20f('0x56')]){_0x36b244[_0xf20f('0x57')]=[{'all':!![]}];}return db[_0xf20f('0x65')]['findAll'](_0x36b244);})['then'](function(_0x6f9326){_0x17536c['rows']=_0x6f9326;return _0x17536c;});}})['then'](respondWithFilteredResult(_0x2e7662,_0x36b244))['catch'](handleError(_0x2e7662,null));};exports['removeDispositions']=function(_0x417b20,_0x26a25e,_0x18d0d3){return db[_0xf20f('0x41')][_0xf20f('0x60')]({'where':{'id':_0x417b20['params']['id']}})['then'](handleEntityNotFound(_0x26a25e,null))[_0xf20f('0x39')](function(_0x1ee0f6){if(_0x1ee0f6){return _0x1ee0f6[_0xf20f('0x68')](_0x417b20['query'][_0xf20f('0x69')]);}})[_0xf20f('0x39')](respondWithStatusCode(_0x26a25e,null))[_0xf20f('0x2c')](handleError(_0x26a25e,null));};exports[_0xf20f('0x6a')]=function(_0xe76f1f,_0x1df400,_0x14735a){if(_0xe76f1f[_0xf20f('0x5c')]['id']){delete _0xe76f1f['body']['id'];}return db[_0xf20f('0x41')][_0xf20f('0x60')]({'where':{'id':_0xe76f1f[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x1df400,null))[_0xf20f('0x39')](function(_0x158fd9){if(_0x158fd9){_0xe76f1f['body']['FaxAccountId']=_0x158fd9['id'];return db[_0xf20f('0x6b')][_0xf20f('0x5b')](_0xe76f1f[_0xf20f('0x5c')]);}})[_0xf20f('0x39')](respondWithResult(_0x1df400,null))[_0xf20f('0x2c')](handleError(_0x1df400,null));};exports[_0xf20f('0x6c')]=function(_0x117544,_0x41c872,_0x1b26b5){var _0x234e8f={'raw':![],'where':{}};var _0x2d175d={};var _0x44eade={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf20f('0x6d')]({'where':{'id':_0x117544['params']['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x41c872,null))[_0xf20f('0x39')](function(_0x2b67d6){if(_0x2b67d6){_0x2d175d[_0xf20f('0x45')]=_['keys'](db['CannedAnswer'][_0xf20f('0x6e')]);_0x2d175d[_0xf20f('0x46')]=_['keys'](_0x117544[_0xf20f('0x46')]);_0x2d175d['filters']=_['intersection'](_0x2d175d['model'],_0x2d175d[_0xf20f('0x46')]);_0x234e8f[_0xf20f('0x4a')]=_[_0xf20f('0x49')](_0x2d175d[_0xf20f('0x45')],qs[_0xf20f('0x4b')](_0x117544[_0xf20f('0x46')][_0xf20f('0x4b')]));_0x234e8f[_0xf20f('0x4a')]=_0x234e8f[_0xf20f('0x4a')]['length']?_0x234e8f[_0xf20f('0x4a')]:_0x2d175d[_0xf20f('0x45')];if(!_0x117544['query'][_0xf20f('0x4d')]('nolimit')){_0x234e8f[_0xf20f('0x32')]=qs[_0xf20f('0x32')](_0x117544[_0xf20f('0x46')]['limit']);_0x234e8f[_0xf20f('0x30')]=qs[_0xf20f('0x30')](_0x117544[_0xf20f('0x46')][_0xf20f('0x30')]);}_0x234e8f['order']=qs[_0xf20f('0x50')](_0x117544['query']['sort']);_0x234e8f[_0xf20f('0x54')]=qs['filters'](_[_0xf20f('0x51')](_0x117544[_0xf20f('0x46')],_0x2d175d[_0xf20f('0x48')]));_0x234e8f[_0xf20f('0x54')][_0xf20f('0x64')]=_0x2b67d6['id'];if(_0x117544[_0xf20f('0x46')][_0xf20f('0x52')]){_0x234e8f[_0xf20f('0x54')]=_[_0xf20f('0x53')](_0x234e8f[_0xf20f('0x54')],{'$or':_['map'](_0x234e8f[_0xf20f('0x4a')],function(_0x32ae28){var _0xf45246={};_0xf45246[_0x32ae28]={'$like':'%'+_0x117544[_0xf20f('0x46')][_0xf20f('0x52')]+'%'};return _0xf45246;})});}_0x234e8f=_[_0xf20f('0x53')]({},_0x234e8f,_0x117544[_0xf20f('0x67')]);return db[_0xf20f('0x6b')][_0xf20f('0x33')]({'where':_0x234e8f[_0xf20f('0x54')]})[_0xf20f('0x39')](function(_0x395432){_0x44eade[_0xf20f('0x33')]=_0x395432;if(_0x117544[_0xf20f('0x46')][_0xf20f('0x56')]){_0x234e8f[_0xf20f('0x57')]=[{'all':!![]}];}return db[_0xf20f('0x6b')][_0xf20f('0x6f')](_0x234e8f);})['then'](function(_0x4583ba){_0x44eade['rows']=_0x4583ba;return _0x44eade;});}})[_0xf20f('0x39')](respondWithFilteredResult(_0x41c872,_0x234e8f))[_0xf20f('0x2c')](handleError(_0x41c872,null));};exports[_0xf20f('0x70')]=function(_0x1f9ea9,_0x4c9263,_0x5ca934){return db[_0xf20f('0x41')][_0xf20f('0x60')]({'where':{'id':_0x1f9ea9[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x4c9263,null))[_0xf20f('0x39')](function(_0xdf3979){if(_0xdf3979){return _0xdf3979[_0xf20f('0x70')](_0x1f9ea9[_0xf20f('0x46')][_0xf20f('0x69')]);}})['then'](respondWithStatusCode(_0x4c9263,null))[_0xf20f('0x2c')](handleError(_0x4c9263,null));};exports['addInteraction']=function(_0x35ad59,_0x433063,_0x254f33){return db['FaxInteraction'][_0xf20f('0x60')]({'where':{'id':_0x35ad59[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x433063,null))['then'](function(_0x559568){if(_0x559568){return _0x559568[_0xf20f('0x71')](_0x35ad59[_0xf20f('0x5c')][_0xf20f('0x69')],_[_0xf20f('0x72')](_0x35ad59[_0xf20f('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0x433063,null))[_0xf20f('0x2c')](handleError(_0x433063,null));};exports['getInteractions']=function(_0x53da3c,_0x1a60a9,_0x4dde7a){var _0x2d762e={'raw':![],'where':{}};var _0x4dd873={};var _0x501c1a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x53da3c[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x1a60a9,null))[_0xf20f('0x39')](function(_0x3a76bb){if(_0x3a76bb){_0x4dd873[_0xf20f('0x45')]=_[_0xf20f('0x47')](db[_0xf20f('0x73')][_0xf20f('0x6e')]);_0x4dd873[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x53da3c[_0xf20f('0x46')]);_0x4dd873[_0xf20f('0x48')]=_[_0xf20f('0x49')](_0x4dd873[_0xf20f('0x45')],_0x4dd873['query']);_0x2d762e['attributes']=_[_0xf20f('0x49')](_0x4dd873[_0xf20f('0x45')],qs[_0xf20f('0x4b')](_0x53da3c[_0xf20f('0x46')]['fields']));_0x2d762e[_0xf20f('0x4a')]=_0x2d762e[_0xf20f('0x4a')][_0xf20f('0x4c')]?_0x2d762e['attributes']:_0x4dd873[_0xf20f('0x45')];if(!_0x53da3c['query'][_0xf20f('0x4d')](_0xf20f('0x4e'))){_0x2d762e[_0xf20f('0x32')]=qs[_0xf20f('0x32')](_0x53da3c[_0xf20f('0x46')][_0xf20f('0x32')]);_0x2d762e[_0xf20f('0x30')]=qs[_0xf20f('0x30')](_0x53da3c[_0xf20f('0x46')][_0xf20f('0x30')]);}_0x2d762e[_0xf20f('0x4f')]=qs['sort'](_0x53da3c[_0xf20f('0x46')][_0xf20f('0x50')]);_0x2d762e['where']=qs[_0xf20f('0x48')](_[_0xf20f('0x51')](_0x53da3c[_0xf20f('0x46')],_0x4dd873[_0xf20f('0x48')]));_0x2d762e['where']['FaxAccountId']=_0x3a76bb['id'];if(_0x53da3c[_0xf20f('0x46')][_0xf20f('0x52')]){_0x2d762e[_0xf20f('0x54')]=_[_0xf20f('0x53')](_0x2d762e[_0xf20f('0x54')],{'$or':_[_0xf20f('0x40')](_0x2d762e[_0xf20f('0x4a')],function(_0x269f99){var _0x647f93={};_0x647f93[_0x269f99]={'$like':'%'+_0x53da3c['query'][_0xf20f('0x52')]+'%'};return _0x647f93;})});}_0x2d762e=_[_0xf20f('0x53')]({},_0x2d762e,_0x53da3c['options']);return db[_0xf20f('0x73')][_0xf20f('0x33')]({'where':_0x2d762e['where']})[_0xf20f('0x39')](function(_0x4cf283){_0x501c1a[_0xf20f('0x33')]=_0x4cf283;if(_0x53da3c['query'][_0xf20f('0x56')]){_0x2d762e[_0xf20f('0x57')]=[{'model':db['CmContact'],'as':_0xf20f('0x74'),'required':![]},{'model':db[_0xf20f('0x75')],'as':_0xf20f('0x76'),'attributes':[_0xf20f('0x3d'),_0xf20f('0x77'),'internal'],'required':![]},{'model':db[_0xf20f('0x78')],'as':'Tags','attributes':['id',_0xf20f('0x3d'),'color'],'where':_0x53da3c['query']['tag']?{'id':_0x53da3c[_0xf20f('0x46')][_0xf20f('0x79')]}:undefined,'required':_0x53da3c['query'][_0xf20f('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0xf20f('0x6f')](_0x2d762e);})['then'](function(_0x3e4bba){_0x501c1a[_0xf20f('0x58')]=_0x3e4bba;return _0x501c1a;});}})[_0xf20f('0x39')](respondWithFilteredResult(_0x1a60a9,_0x2d762e))['catch'](handleError(_0x1a60a9,null));};exports['addApplications']=function(_0x1353a6,_0x468ca5){var _0x33421b=_0x1353a6[_0xf20f('0x5a')]['id'];var _0x514313=_0x1353a6[_0xf20f('0x5c')];var _0x58bec5=0xc8;var _0x5a92f9=null;return db[_0xf20f('0x7a')][_0xf20f('0x7b')]({'isolationLevel':db[_0xf20f('0x7a')]['Transaction'][_0xf20f('0x7c')][_0xf20f('0x7d')]},function(_0xabe776){return db[_0xf20f('0x41')]['findOne']({'where':{'id':_0x33421b},'transaction':_0xabe776})[_0xf20f('0x39')](function(_0x1fb014){if(_0x1fb014){return db['FaxApplication'][_0xf20f('0x38')]({'where':{'FaxAccountId':_0x33421b},'transaction':_0xabe776})[_0xf20f('0x39')](function(){var _0x542310=_[_0xf20f('0x40')](_0x514313,function(_0x109e63){_0x109e63[_0xf20f('0x64')]=_0x33421b;return _0x109e63;});return db[_0xf20f('0x7e')][_0xf20f('0x7f')](_0x542310,{'transaction':_0xabe776});});}else{_0x58bec5=0x194;_0x5a92f9=[];}});})[_0xf20f('0x39')](function(){if(_0x58bec5!==0x194){return db[_0xf20f('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x33421b},'order':_0xf20f('0x80')})[_0xf20f('0x39')](function(_0x30b30c){_0x5a92f9=_0x30b30c;});}})[_0xf20f('0x2c')](function(_0x59de2a){_0x58bec5=0x1f4;logger['error'](_0x59de2a[_0xf20f('0x81')]);if(_0x59de2a['name']){delete _0x59de2a[_0xf20f('0x3d')];}_0x5a92f9=_0x59de2a;})[_0xf20f('0x82')](function(){if(_0x5a92f9===null){_0x468ca5[_0xf20f('0x3c')](_0x58bec5);}else{if(_0x58bec5===0x1f4){_0x468ca5['status'](_0x58bec5)['send'](_0x5a92f9);}else{_0x468ca5[_0xf20f('0x2d')](_0x58bec5)['json'](_0x5a92f9);}}});};exports['getApplications']=function(_0x2ac588,_0xc667a5,_0x1ee7fb){var _0x402843={};var _0x32df53={};var _0x112218;var _0x57b098;return db[_0xf20f('0x41')][_0xf20f('0x6d')]({'where':{'id':_0x2ac588[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0xc667a5,null))[_0xf20f('0x39')](function(_0x2974d3){if(_0x2974d3){_0x112218=_0x2974d3;_0x32df53[_0xf20f('0x45')]=_['keys'](db[_0xf20f('0x7e')][_0xf20f('0x6e')]);_0x32df53[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x2ac588[_0xf20f('0x46')]);_0x32df53[_0xf20f('0x48')]=_[_0xf20f('0x49')](_0x32df53[_0xf20f('0x45')],_0x32df53[_0xf20f('0x46')]);_0x402843['attributes']=_[_0xf20f('0x49')](_0x32df53[_0xf20f('0x45')],qs[_0xf20f('0x4b')](_0x2ac588[_0xf20f('0x46')][_0xf20f('0x4b')]));_0x402843['attributes']=_0x402843['attributes'][_0xf20f('0x4c')]?_0x402843[_0xf20f('0x4a')]:_0x32df53['model'];_0x402843['order']=qs['sort'](_0x2ac588[_0xf20f('0x46')][_0xf20f('0x50')]);_0x402843['where']=qs[_0xf20f('0x48')](_[_0xf20f('0x51')](_0x2ac588['query'],_0x32df53[_0xf20f('0x48')]));if(_0x2ac588['query'][_0xf20f('0x52')]){_0x402843[_0xf20f('0x54')]=_['merge'](_0x402843[_0xf20f('0x54')],{'$or':_[_0xf20f('0x40')](_0x402843[_0xf20f('0x4a')],function(_0x23b722){var _0x4f5cf4={};_0x4f5cf4[_0x23b722]={'$like':'%'+_0x2ac588[_0xf20f('0x46')][_0xf20f('0x52')]+'%'};return _0x4f5cf4;})});}_0x402843=_[_0xf20f('0x53')]({},_0x402843,_0x2ac588[_0xf20f('0x67')]);return _0x112218[_0xf20f('0x83')](_0x402843);}})['then'](function(_0x4eaf50){if(_0x4eaf50){_0x57b098=_0x4eaf50[_0xf20f('0x4c')];if(!_0x2ac588[_0xf20f('0x46')]['hasOwnProperty'](_0xf20f('0x4e'))){_0x402843[_0xf20f('0x32')]=qs['limit'](_0x2ac588['query']['limit']);_0x402843[_0xf20f('0x30')]=qs[_0xf20f('0x30')](_0x2ac588[_0xf20f('0x46')]['offset']);}return _0x112218[_0xf20f('0x83')](_0x402843);}})['then'](function(_0x4ac40c){if(_0x4ac40c){return _0x4ac40c?{'count':_0x57b098,'rows':_0x4ac40c}:null;}})['then'](respondWithResult(_0xc667a5,null))[_0xf20f('0x2c')](handleError(_0xc667a5,null));};function Extension(_0x3215a2,_0xf20c07,_0x33544b,_0x76fab2){this[_0xf20f('0x84')]=_0xf20f('0x85');this[_0xf20f('0x86')]=_0x3215a2[_0xf20f('0x87')];this[_0xf20f('0x88')]=_0x76fab2;this[_0xf20f('0x43')]=_0xf20f('0x89');this[_0xf20f('0x8a')]=_0xf20f('0x8b');this['FaxAccountId']=_0x3215a2['id'];this[_0xf20f('0x80')]=_0xf20c07;this[_0xf20f('0x8c')]=_0x33544b;}function createExtensionsReciveFax(_0x1c90a3){var _0x24f77c=0x1;var _0x35e274=[];_0x35e274[_0xf20f('0x8d')](new Extension(_0x1c90a3,_0x24f77c,'',_0xf20f('0x8e')));_0x24f77c+=0x1;_0x35e274['push'](new Extension(_0x1c90a3,_0x24f77c,_0xf20f('0x8f'),_0xf20f('0x90')));_0x24f77c+=0x1;for(var _0x998253 in _0x1c90a3){if(_0x1c90a3['hasOwnProperty'](_0x998253)&&(_0x998253==='ecm'||_0x998253===_0xf20f('0x87')||_0x998253===_0xf20f('0x91')||_0x998253===_0xf20f('0x92')||_0x998253===_0xf20f('0x93')||_0x998253==='maxrate'||_0x998253==='minrate'||_0x998253===_0xf20f('0x94')||_0x998253===_0xf20f('0x95'))){_0x35e274[_0xf20f('0x8d')](new Extension(_0x1c90a3,_0x24f77c,_0xf20f('0x96')+_0x998253+')='+_0x1c90a3[_0x998253],_0xf20f('0x90')));_0x24f77c+=0x1;}}_0x35e274['push'](new Extension(_0x1c90a3,_0x24f77c,'6',_0xf20f('0x97')));_0x24f77c+=0x1;_0x35e274[_0xf20f('0x8d')](new Extension(_0x1c90a3,_0x24f77c,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0xf20f('0x98')));_0x24f77c=0x0;return _0x35e274;}exports['addAccountApplications']=function(_0x4669bc,_0x220ed8,_0x4728f6){var _0xbfd81d;return db[_0xf20f('0x7a')][_0xf20f('0x7b')](function(_0x4500d6){return db['FaxAccount'][_0xf20f('0x5b')](_0x4669bc[_0xf20f('0x5c')],{'transaction':_0x4500d6})[_0xf20f('0x39')](function(_0x21291b){_0xbfd81d=_0x21291b[_0xf20f('0x5e')]({'plain':!![]});return db[_0xf20f('0x99')][_0xf20f('0x7f')](createExtensionsReciveFax(_0xbfd81d),{'transaction':_0x4500d6});});})['then'](function(){return _0xbfd81d;})[_0xf20f('0x39')](respondWithResult(_0x220ed8,null))[_0xf20f('0x2c')](handleError(_0x220ed8,null));};exports[_0xf20f('0x9a')]=function(_0x3600ae,_0x3b3bfd,_0x264877){var _0x174e1b;return db['sequelize']['transaction'](function(_0x526166){return db['FaxAccount'][_0xf20f('0x37')](_0x3600ae[_0xf20f('0x5c')],{'where':{'id':_0x3600ae[_0xf20f('0x5c')]['id']},'transaction':_0x526166})[_0xf20f('0x39')](function(_0x25104b){return db[_0xf20f('0x99')][_0xf20f('0x38')]({'where':{'FaxAccountId':_0x3600ae['body']['id']},'transaction':_0x526166})[_0xf20f('0x39')](function(_0xcfaad4){return db[_0xf20f('0x99')][_0xf20f('0x7f')](createExtensionsReciveFax(_['omit'](_0x3600ae[_0xf20f('0x5c')],[_0xf20f('0x9b'),_0xf20f('0x44'),_0xf20f('0x9c'),_0xf20f('0x9d'),_0xf20f('0x9e'),'ListId'])),{'transaction':_0x526166});});});})['then'](function(){return db[_0xf20f('0x41')][_0xf20f('0x9f')](_0x3600ae[_0xf20f('0x5c')]['id']);})['then'](respondWithResult(_0x3b3bfd,null))[_0xf20f('0x2c')](handleError(_0x3b3bfd,null));};exports[_0xf20f('0xa0')]=function(_0x4488bc,_0x3645e7,_0x4fda06){var _0x34c555={'raw':!![],'where':{}};var _0x3874e7={};var _0xa014fc={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf20f('0x6d')]({'where':{'id':_0x4488bc[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x3645e7,null))[_0xf20f('0x39')](function(_0x2b9bd9){if(_0x2b9bd9){_0x3874e7[_0xf20f('0x45')]=_['keys'](db[_0xf20f('0xa1')]['rawAttributes']);_0x3874e7[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x4488bc[_0xf20f('0x46')]);_0x3874e7['filters']=_[_0xf20f('0x49')](_0x3874e7[_0xf20f('0x45')],_0x3874e7[_0xf20f('0x46')]);_0x34c555[_0xf20f('0x4a')]=_[_0xf20f('0x49')](_0x3874e7['model'],qs[_0xf20f('0x4b')](_0x4488bc[_0xf20f('0x46')]['fields']));_0x34c555[_0xf20f('0x4a')]=_0x34c555[_0xf20f('0x4a')][_0xf20f('0x4c')]?_0x34c555[_0xf20f('0x4a')]:_0x3874e7[_0xf20f('0x45')];if(!_0x4488bc[_0xf20f('0x46')][_0xf20f('0x4d')](_0xf20f('0x4e'))){_0x34c555[_0xf20f('0x32')]=qs[_0xf20f('0x32')](_0x4488bc['query'][_0xf20f('0x32')]);_0x34c555[_0xf20f('0x30')]=qs[_0xf20f('0x30')](_0x4488bc[_0xf20f('0x46')][_0xf20f('0x30')]);}_0x34c555[_0xf20f('0x4f')]=qs[_0xf20f('0x50')](_0x4488bc[_0xf20f('0x46')][_0xf20f('0x50')]);_0x34c555[_0xf20f('0x54')]=qs[_0xf20f('0x48')](_[_0xf20f('0x51')](_0x4488bc[_0xf20f('0x46')],_0x3874e7[_0xf20f('0x48')]));_0x34c555[_0xf20f('0x54')][_0xf20f('0x64')]=_0x2b9bd9['id'];if(_0x4488bc['query'][_0xf20f('0x52')]){_0x34c555[_0xf20f('0x54')]=_[_0xf20f('0x53')](_0x34c555['where'],{'$or':_[_0xf20f('0x40')](_0x34c555[_0xf20f('0x4a')],function(_0x569be9){var _0x4865c7={};_0x4865c7[_0x569be9]={'$like':'%'+_0x4488bc[_0xf20f('0x46')]['filter']+'%'};return _0x4865c7;})});}if(_0x4488bc['query'][_0xf20f('0xa2')]){var _0x204477=_0x4488bc[_0xf20f('0x46')][_0xf20f('0xa2')]['split'](',');var _0x36aa7e={};_0x36aa7e[_0x204477[0x0]]={'$gte':moment(_0x204477[0x1])[_0xf20f('0xa3')](_0xf20f('0xa4'))};_0x34c555[_0xf20f('0x54')]=_[_0xf20f('0x53')](_0x34c555[_0xf20f('0x54')],_0x36aa7e);}_0x34c555=_['merge']({},_0x34c555,_0x4488bc[_0xf20f('0x67')]);return db['FaxMessage'][_0xf20f('0x33')]({'where':_0x34c555[_0xf20f('0x54')]})[_0xf20f('0x39')](function(_0x54d910){_0xa014fc[_0xf20f('0x33')]=_0x54d910;if(_0x4488bc['query'][_0xf20f('0x56')]){_0x34c555[_0xf20f('0x57')]=[{'all':!![]}];}return db[_0xf20f('0xa1')]['findAll'](_0x34c555);})['then'](function(_0x4afa9f){_0xa014fc[_0xf20f('0x58')]=_0x4afa9f;return _0xa014fc;});}})[_0xf20f('0x39')](respondWithFilteredResult(_0x3645e7,_0x34c555))['catch'](handleError(_0x3645e7,null));};exports[_0xf20f('0xa5')]=function(_0x445463,_0x3ed492,_0xae5c17){var _0x5b9207,_0x28134b={},_0x2edd7f;if(_0x445463[_0xf20f('0x5c')]['to']){_0x2edd7f=_0x445463[_0xf20f('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xf20f('0x60')]({'where':{'id':_0x445463[_0xf20f('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xf20f('0xa6'),'include':[{'model':db['CmContact'],'as':_0xf20f('0xa7'),'where':{'fax':_0x2edd7f},'limit':0x1,'order':[['updatedAt',_0xf20f('0xa8')]]}]}]})[_0xf20f('0x39')](handleEntityNotFound(_0x3ed492,null))[_0xf20f('0x39')](function(_0x213a55){_0x5b9207=_0x213a55;if(_0x445463[_0xf20f('0x5c')]['attachments']&&_0x445463[_0xf20f('0x5c')][_0xf20f('0xa9')]['length']){for(var _0x53cdae=0x0;_0x53cdae<_0x445463[_0xf20f('0x5c')][_0xf20f('0xa9')][_0xf20f('0x4c')];_0x53cdae+=0x1){_0x445463['body'][_0xf20f('0xa9')][_0x53cdae]={'filename':_0x445463['body']['attachments'][_0x53cdae][_0xf20f('0x3d')],'id':_0x445463['body'][_0xf20f('0xa9')][_0x53cdae]['id'],'path':path[_0xf20f('0xaa')](config[_0xf20f('0xab')],_0xf20f('0xac'),_0x445463['body'][_0xf20f('0xa9')][_0x53cdae][_0xf20f('0xad')])};}}return respondWithRpcPromise(_0xf20f('0xae'),_0xf20f('0xae'),{'FaxAccountId':_[_0xf20f('0xaf')](_0x445463[_0xf20f('0x5a')]['id'])?undefined:_0x445463['params']['id'],'path':_[_0xf20f('0xaf')](_0x445463['body']['attachments'][0x0][_0xf20f('0xb0')])?undefined:_0x445463[_0xf20f('0x5c')][_0xf20f('0xa9')][0x0][_0xf20f('0xb0')],'fax':_[_0xf20f('0xaf')](_0x445463[_0xf20f('0x5c')]['to'][0x0])?undefined:_0x445463[_0xf20f('0x5c')]['to'][0x0]},client9002);})[_0xf20f('0x39')](function(){if(_0x5b9207){if(_[_0xf20f('0xaf')](_0x445463['body'][_0xf20f('0xb1')])){_0x445463[_0xf20f('0x5c')][_0xf20f('0xb1')]=util[_0xf20f('0xa3')](_0xf20f('0xb2'),_0x5b9207[_0xf20f('0x3d')],_0x5b9207['fax']);}if(_0x5b9207[_0xf20f('0xa6')]){if(_0x5b9207[_0xf20f('0xa6')][_0xf20f('0xa7')][_0xf20f('0x4c')]){return _0x5b9207[_0xf20f('0xa6')][_0xf20f('0xa7')][0x0];}else{return db['CmContact'][_0xf20f('0x5b')](_[_0xf20f('0x19')](_0x445463[_0xf20f('0x5c')],{'firstName':_0x445463[_0xf20f('0x5c')]['to'][0x0],'phone':_0x445463[_0xf20f('0x5c')]['to'][0x0],'fax':_0x445463[_0xf20f('0x5c')]['to'][0x0],'ListId':_0x5b9207[_0xf20f('0xb3')]}));}}else{throw new Error(_0xf20f('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x5b0cd5){if(_0x5b0cd5){return db[_0xf20f('0x73')]['find']({'where':{'ContactId':_0x5b0cd5['id'],'closed':![],'FaxAccountId':_0x5b9207['id']}})[_0xf20f('0x39')](function(_0x4a51dc){if(_0x4a51dc){return[_0x4a51dc,![]];}return db['FaxInteraction'][_0xf20f('0x5b')]({'UserId':_0x445463['user']['id'],'ContactId':_0x5b0cd5['id'],'FaxAccountId':_0x5b9207['id'],'fax':_0x445463[_0xf20f('0x5c')]['to'][0x0],'firstMsgDirection':_0xf20f('0xb5'),'Messages':[_[_0xf20f('0x53')](_0x445463[_0xf20f('0x5c')],{'read':![],'body':_0x445463[_0xf20f('0x5c')]['attachments'][0x0][_0xf20f('0xb6')],'FaxAccountId':_0x5b9207['id'],'UserId':_0x445463[_0xf20f('0x5d')]['id'],'ContactId':_0x5b0cd5['id'],'AttachmentId':_0x445463[_0xf20f('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xf20f('0xa1')],'as':_0xf20f('0xb7')}]})[_0xf20f('0x39')](function(_0x3a2bcb){return[_0x3a2bcb,!![]];});});}else{throw new Error(_0xf20f('0xb8'));}})[_0xf20f('0xb9')](function(_0x5028b5,_0x50dcce){if(_0x50dcce){return _0x5028b5;}return db[_0xf20f('0xa1')][_0xf20f('0x5b')]({'direction':_0xf20f('0xb5'),'read':![],'body':_0x445463['body']['attachments'][0x0][_0xf20f('0xb6')],'FaxAccountId':_0x5b9207['id'],'FaxInteractionId':_0x5028b5['id'],'UserId':_0x445463[_0xf20f('0x5d')]['id'],'ContactId':_0x5028b5[_0xf20f('0xba')],'AttachmentId':_0x445463[_0xf20f('0x5c')][_0xf20f('0xa9')][0x0]['id']})[_0xf20f('0x39')](function(_0x151f0c){_0x5028b5['dataValues'][_0xf20f('0xb7')]=[];_0x5028b5[_0xf20f('0xbb')][_0xf20f('0xb7')][_0xf20f('0x8d')](_0x151f0c[_0xf20f('0xbb')]);return _0x5028b5;});})[_0xf20f('0x39')](function(_0x4749df){respondWithRpcPromise(_0xf20f('0xbc'),_0xf20f('0xbc'),{'FaxAccountId':_[_0xf20f('0xaf')](_0x445463[_0xf20f('0x5a')]['id'])?undefined:_0x445463[_0xf20f('0x5a')]['id'],'path':_[_0xf20f('0xaf')](_0x445463[_0xf20f('0x5c')]['attachments'][0x0][_0xf20f('0xb0')])?undefined:_0x445463[_0xf20f('0x5c')][_0xf20f('0xa9')][0x0][_0xf20f('0xb0')],'fax':_[_0xf20f('0xaf')](_0x445463[_0xf20f('0x5c')]['to'][0x0])?undefined:_0x445463[_0xf20f('0x5c')]['to'][0x0],'AttachmentId':_0x445463[_0xf20f('0x5c')][_0xf20f('0xa9')][0x0]['id']},client9002)[_0xf20f('0x39')](function(_0x2573d){logger[_0xf20f('0x22')](_0xf20f('0xbd'),_0x2573d);})[_0xf20f('0x2c')](function(_0xe77fad){logger[_0xf20f('0x22')]('SendFaxRpc,\x20%s',_0xe77fad);});return _0x4749df;})[_0xf20f('0x39')](respondWithResult(_0x3ed492,null))[_0xf20f('0x2c')](handleError(_0x3ed492,null));};exports[_0xf20f('0xbe')]=function(_0x466551,_0x24b1e8,_0x4c6494){return db[_0xf20f('0x41')]['find']({'where':{'id':_0x466551[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x24b1e8,null))[_0xf20f('0x39')](function(_0x57a81c){if(_0x57a81c){return _0x57a81c[_0xf20f('0xbe')](_0x466551[_0xf20f('0x5c')][_0xf20f('0x69')],_[_0xf20f('0x72')](_0x466551[_0xf20f('0x5c')],[_0xf20f('0x69'),'id'])||{})['spread'](function(_0x5a9a45){for(var _0x57958b=0x0;_0x57958b<_0x466551[_0xf20f('0x5c')]['ids'][_0xf20f('0x4c')];_0x57958b+=0x1){socket[_0xf20f('0xbf')]('userFaxAccount:save',{'UserId':Number(_0x466551[_0xf20f('0x5c')][_0xf20f('0x69')][_0x57958b]),'FaxAccountId':Number(_0x466551[_0xf20f('0x5a')]['id'])});}return _0x5a9a45;});}})[_0xf20f('0x39')](respondWithResult(_0x24b1e8,null))[_0xf20f('0x2c')](handleError(_0x24b1e8,null));};exports[_0xf20f('0xc0')]=function(_0x2d37bf,_0x36b7ad,_0x376fce){return db['FaxAccount'][_0xf20f('0x60')]({'where':{'id':_0x2d37bf[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x36b7ad,null))[_0xf20f('0x39')](function(_0x49ac84){if(_0x49ac84){return _0x49ac84['removeAgents'](_0x2d37bf['query'][_0xf20f('0x69')])[_0xf20f('0x39')](function(){if(_['isArray'](_0x2d37bf[_0xf20f('0x46')]['ids'])){for(var _0x3b319a=0x0;_0x3b319a<_0x2d37bf[_0xf20f('0x46')][_0xf20f('0x69')][_0xf20f('0x4c')];_0x3b319a+=0x1){socket[_0xf20f('0xbf')](_0xf20f('0xc1'),{'UserId':Number(_0x2d37bf['query']['ids'][_0x3b319a]),'FaxAccountId':Number(_0x2d37bf['params']['id'])});}}else{socket['emit'](_0xf20f('0xc1'),{'UserId':Number(_0x2d37bf['query'][_0xf20f('0x69')]),'FaxAccountId':Number(_0x2d37bf[_0xf20f('0x5a')]['id'])});}});}})[_0xf20f('0x39')](respondWithStatusCode(_0x36b7ad,null))[_0xf20f('0x2c')](handleError(_0x36b7ad,null));};exports[_0xf20f('0xc2')]=function(_0x30ba16,_0x549aef,_0x1f7f4c){var _0x12a007={};var _0x53dd50={};var _0x4279e;var _0x193482;return db['FaxAccount'][_0xf20f('0x6d')]({'where':{'id':_0x30ba16[_0xf20f('0x5a')]['id']}})[_0xf20f('0x39')](handleEntityNotFound(_0x549aef,null))[_0xf20f('0x39')](function(_0x67b464){if(_0x67b464){_0x4279e=_0x67b464;_0x53dd50[_0xf20f('0x45')]=_['keys'](db[_0xf20f('0x75')][_0xf20f('0x6e')]);_0x53dd50[_0xf20f('0x46')]=_[_0xf20f('0x47')](_0x30ba16['query']);_0x53dd50[_0xf20f('0x48')]=_['intersection'](_0x53dd50[_0xf20f('0x45')],_0x53dd50[_0xf20f('0x46')]);_0x12a007[_0xf20f('0x4a')]=_[_0xf20f('0x49')](_0x53dd50[_0xf20f('0x45')],qs[_0xf20f('0x4b')](_0x30ba16['query'][_0xf20f('0x4b')]));_0x12a007[_0xf20f('0x4a')]=_0x12a007[_0xf20f('0x4a')][_0xf20f('0x4c')]?_0x12a007['attributes']:_0x53dd50[_0xf20f('0x45')];_0x12a007[_0xf20f('0x4f')]=qs['sort'](_0x30ba16[_0xf20f('0x46')][_0xf20f('0x50')]);_0x12a007['where']=qs[_0xf20f('0x48')](_[_0xf20f('0x51')](_0x30ba16[_0xf20f('0x46')],_0x53dd50[_0xf20f('0x48')]));if(_0x30ba16[_0xf20f('0x46')][_0xf20f('0x52')]){_0x12a007[_0xf20f('0x54')]=_['merge'](_0x12a007['where'],{'$or':_[_0xf20f('0x40')](_0x12a007[_0xf20f('0x4a')],function(_0x527d28){var _0x4c71eb={};_0x4c71eb[_0x527d28]={'$like':'%'+_0x30ba16[_0xf20f('0x46')][_0xf20f('0x52')]+'%'};return _0x4c71eb;})});}_0x12a007=_[_0xf20f('0x53')]({},_0x12a007,_0x30ba16[_0xf20f('0x67')]);return _0x4279e[_0xf20f('0xc2')](_0x12a007);}})['then'](function(_0x123959){if(_0x123959){_0x193482=_0x123959[_0xf20f('0x4c')];if(!_0x30ba16[_0xf20f('0x46')][_0xf20f('0x4d')]('nolimit')){_0x12a007[_0xf20f('0x32')]=qs[_0xf20f('0x32')](_0x30ba16[_0xf20f('0x46')][_0xf20f('0x32')]);_0x12a007['offset']=qs['offset'](_0x30ba16['query'][_0xf20f('0x30')]);}return _0x4279e['getAgents'](_0x12a007);}})[_0xf20f('0x39')](function(_0x2dfebd){if(_0x2dfebd){return _0x2dfebd?{'count':_0x193482,'rows':_0x2dfebd}:null;}})[_0xf20f('0x39')](respondWithResult(_0x549aef,null))[_0xf20f('0x2c')](handleError(_0x549aef,null));};
\ No newline at end of file
+var _0xa426=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','order','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','faxdetect','headerinfo','maxrate','minrate','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','defaults','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','update','destroy','then','get','FaxAccounts','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource'];(function(_0x69d91e,_0x12fec6){var _0x381436=function(_0x9a01a0){while(--_0x9a01a0){_0x69d91e['push'](_0x69d91e['shift']());}};_0x381436(++_0x12fec6);}(_0xa426,0x123));var _0x6a42=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa426[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x6a42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a42('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a42('0x2'));var util=require(_0x6a42('0x3'));var path=require('path');var sox=require(_0x6a42('0x4'));var csv=require(_0x6a42('0x5'));var ejs=require(_0x6a42('0x6'));var fs=require('fs');var fs_extra=require(_0x6a42('0x7'));var _=require('lodash');var squel=require(_0x6a42('0x8'));var crypto=require(_0x6a42('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a42('0xa'));var toCsv=require(_0x6a42('0x5'));var querystring=require(_0x6a42('0xb'));var Papa=require(_0x6a42('0xc'));var Redis=require(_0x6a42('0xd'));var authService=require(_0x6a42('0xe'));var qs=require(_0x6a42('0xf'));var as=require(_0x6a42('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a42('0x11'))(_0x6a42('0x12'));var utils=require(_0x6a42('0x13'));var config=require(_0x6a42('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a42('0x15'))['db'];config[_0x6a42('0x16')]=_['defaults'](config['redis'],{'host':_0x6a42('0x17'),'port':0x18eb});var socket=require(_0x6a42('0x18'))(new Redis(config[_0x6a42('0x16')]));require(_0x6a42('0x19'))['register'](socket);var jayson=require(_0x6a42('0x1a'));var client=jayson[_0x6a42('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x6a42('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2e9287,_0x38b50a,_0x416070,_0x3d1205){return new BPromise(function(_0x1a296f,_0xa1bebf){var _0x137ea5=_0x3d1205||client;return _0x137ea5[_0x6a42('0x1d')](_0x2e9287,_0x416070)['then'](function(_0x27146c){logger[_0x6a42('0x1e')](_0x6a42('0x1f'),_0x38b50a,_0x6a42('0x20'));logger[_0x6a42('0x21')](_0x6a42('0x22'),_0x38b50a,_0x6a42('0x20'),JSON['stringify'](_0x27146c));if(_0x27146c[_0x6a42('0x23')]){if(_0x27146c[_0x6a42('0x23')][_0x6a42('0x24')]===0x1f4){logger[_0x6a42('0x23')](_0x6a42('0x1f'),_0x38b50a,_0x27146c[_0x6a42('0x23')]['message']);return _0xa1bebf(_0x27146c[_0x6a42('0x23')]['message']);}logger[_0x6a42('0x23')](_0x6a42('0x1f'),_0x38b50a,_0x27146c['error'][_0x6a42('0x25')]);return _0x1a296f(_0x27146c[_0x6a42('0x23')][_0x6a42('0x25')]);}else{logger[_0x6a42('0x1e')](_0x6a42('0x1f'),_0x38b50a,'request\x20sent');_0x1a296f(_0x27146c[_0x6a42('0x26')][_0x6a42('0x25')]);}})[_0x6a42('0x27')](function(_0x1cf8a6){logger[_0x6a42('0x23')](_0x6a42('0x1f'),_0x38b50a,_0x1cf8a6);_0xa1bebf(_0x1cf8a6);});});}function respondWithStatusCode(_0xe44ff1,_0x16aa8c){_0x16aa8c=_0x16aa8c||0xcc;return function(_0x2caf9c){if(_0x2caf9c){return _0xe44ff1[_0x6a42('0x28')](_0x16aa8c);}return _0xe44ff1[_0x6a42('0x29')](_0x16aa8c)[_0x6a42('0x2a')]();};}function respondWithResult(_0x382c56,_0x53c532){_0x53c532=_0x53c532||0xc8;return function(_0x3b1ab3){if(_0x3b1ab3){return _0x382c56[_0x6a42('0x29')](_0x53c532)['json'](_0x3b1ab3);}};}function respondWithFilteredResult(_0xf6de71,_0x26ec47){return function(_0x3b4c47){if(_0x3b4c47){var _0x4b4f40=typeof _0x26ec47[_0x6a42('0x2b')]===_0x6a42('0x2c')&&typeof _0x26ec47['limit']===_0x6a42('0x2c');var _0x78372b=_0x3b4c47['count'];var _0x535391=_0x4b4f40?0x0:_0x26ec47['offset'];var _0x3950d2=_0x4b4f40?_0x3b4c47[_0x6a42('0x2d')]:_0x26ec47[_0x6a42('0x2b')]+_0x26ec47['limit'];var _0x11d16c;if(_0x3950d2>=_0x78372b){_0x3950d2=_0x78372b;_0x11d16c=0xc8;}else{_0x11d16c=0xce;}_0xf6de71[_0x6a42('0x29')](_0x11d16c);return _0xf6de71[_0x6a42('0x2e')](_0x6a42('0x2f'),_0x535391+'-'+_0x3950d2+'/'+_0x78372b)[_0x6a42('0x30')](_0x3b4c47);}return null;};}function patchUpdates(_0x37a957){return function(_0x3d7c45){try{jsonpatch[_0x6a42('0x31')](_0x3d7c45,_0x37a957,!![]);}catch(_0x326b55){return BPromise['reject'](_0x326b55);}return _0x3d7c45['save']();};}function saveUpdates(_0x2ebb53,_0x3bb8c0){return function(_0x18f1d7){if(_0x18f1d7){return _0x18f1d7[_0x6a42('0x32')](_0x2ebb53)['then'](function(_0x3dd9d5){return _0x3dd9d5;});}return null;};}function removeEntity(_0x3caa39,_0x4ee42d){return function(_0x21f542){if(_0x21f542){return _0x21f542[_0x6a42('0x33')]()[_0x6a42('0x34')](function(){var _0x2aed90=_0x21f542[_0x6a42('0x35')]({'plain':!![]});var _0x38b4bf=_0x6a42('0x36');return db['UserProfileResource'][_0x6a42('0x33')]({'where':{'type':_0x38b4bf,'resourceId':_0x2aed90['id']}})[_0x6a42('0x34')](function(){return _0x21f542;});})['then'](function(){_0x3caa39['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a929,_0x28f91b){return function(_0x2e5a0c){if(!_0x2e5a0c){_0x59a929[_0x6a42('0x28')](0x194);}return _0x2e5a0c;};}function handleError(_0xfd5fe6,_0x2e38cf){_0x2e38cf=_0x2e38cf||0x1f4;return function(_0x516d4d){logger[_0x6a42('0x23')](_0x516d4d[_0x6a42('0x37')]);if(_0x516d4d[_0x6a42('0x38')]){delete _0x516d4d[_0x6a42('0x38')];}_0xfd5fe6[_0x6a42('0x29')](_0x2e38cf)[_0x6a42('0x39')](_0x516d4d);};}exports[_0x6a42('0x3a')]=function(_0x504acd,_0xc80c89){var _0xceb80b={'include':[{'model':db['Pause'],'as':_0x6a42('0x3b')}]},_0x4645c2={},_0x228acf={'count':0x0,'rows':[]};var _0x5dd7b5=_[_0x6a42('0x3c')](db[_0x6a42('0x3d')][_0x6a42('0x3e')],function(_0x3f563c){return{'name':_0x3f563c['fieldName'],'type':_0x3f563c[_0x6a42('0x3f')][_0x6a42('0x40')]};});_0x4645c2['model']=_[_0x6a42('0x3c')](_0x5dd7b5,'name');_0x4645c2['query']=_[_0x6a42('0x41')](_0x504acd['query']);_0x4645c2[_0x6a42('0x42')]=_['intersection'](_0x4645c2[_0x6a42('0x43')],_0x4645c2[_0x6a42('0x44')]);_0xceb80b[_0x6a42('0x45')]=_[_0x6a42('0x46')](_0x4645c2[_0x6a42('0x43')],qs[_0x6a42('0x47')](_0x504acd[_0x6a42('0x44')][_0x6a42('0x47')]));_0xceb80b[_0x6a42('0x45')]=_0xceb80b['attributes'][_0x6a42('0x48')]?_0xceb80b['attributes']:_0x4645c2[_0x6a42('0x43')];if(!_0x504acd[_0x6a42('0x44')][_0x6a42('0x49')](_0x6a42('0x4a'))){_0xceb80b[_0x6a42('0x4b')]=qs['limit'](_0x504acd[_0x6a42('0x44')][_0x6a42('0x4b')]);_0xceb80b['offset']=qs[_0x6a42('0x2b')](_0x504acd[_0x6a42('0x44')][_0x6a42('0x2b')]);}_0xceb80b['order']=qs[_0x6a42('0x4c')](_0x504acd[_0x6a42('0x44')][_0x6a42('0x4c')]);_0xceb80b[_0x6a42('0x4d')]=qs[_0x6a42('0x42')](_['pick'](_0x504acd[_0x6a42('0x44')],_0x4645c2[_0x6a42('0x42')]),_0x5dd7b5);if(_0x504acd[_0x6a42('0x44')][_0x6a42('0x4e')]){_0xceb80b[_0x6a42('0x4d')]=_[_0x6a42('0x4f')](_0xceb80b[_0x6a42('0x4d')],{'$or':_[_0x6a42('0x3c')](_0x5dd7b5,function(_0x31b6c5){if(_0x31b6c5[_0x6a42('0x3f')]!==_0x6a42('0x50')){var _0x18eb77={};_0x18eb77[_0x31b6c5['name']]={'$like':'%'+_0x504acd[_0x6a42('0x44')]['filter']+'%'};return _0x18eb77;}})});}_0xceb80b=_[_0x6a42('0x4f')]({},_0xceb80b,_0x504acd[_0x6a42('0x51')]);var _0x28a779={'where':_0xceb80b['where']};return db[_0x6a42('0x3d')][_0x6a42('0x2d')](_0x28a779)[_0x6a42('0x34')](function(_0x47cd64){_0x228acf[_0x6a42('0x2d')]=_0x47cd64;if(_0x504acd[_0x6a42('0x44')][_0x6a42('0x52')]){_0xceb80b[_0x6a42('0x53')]=[{'all':!![]}];}return db[_0x6a42('0x3d')]['findAll'](_0xceb80b);})[_0x6a42('0x34')](function(_0x245f80){_0x228acf[_0x6a42('0x54')]=_0x245f80;return _0x228acf;})['then'](respondWithFilteredResult(_0xc80c89,_0xceb80b))[_0x6a42('0x27')](handleError(_0xc80c89,null));};exports[_0x6a42('0x55')]=function(_0x1798bb,_0x41d374){var _0x550d07={'raw':![],'where':{'id':_0x1798bb[_0x6a42('0x56')]['id']},'include':[{'model':db[_0x6a42('0x57')],'as':_0x6a42('0x3b')}]},_0x527ddf={};_0x527ddf[_0x6a42('0x43')]=_[_0x6a42('0x41')](db[_0x6a42('0x3d')][_0x6a42('0x3e')]);_0x527ddf['query']=_[_0x6a42('0x41')](_0x1798bb[_0x6a42('0x44')]);_0x527ddf[_0x6a42('0x42')]=_['intersection'](_0x527ddf['model'],_0x527ddf['query']);_0x550d07[_0x6a42('0x45')]=_['intersection'](_0x527ddf[_0x6a42('0x43')],qs['fields'](_0x1798bb[_0x6a42('0x44')][_0x6a42('0x47')]));_0x550d07[_0x6a42('0x45')]=_0x550d07['attributes']['length']?_0x550d07[_0x6a42('0x45')]:_0x527ddf['model'];if(_0x1798bb[_0x6a42('0x44')][_0x6a42('0x52')]){_0x550d07[_0x6a42('0x53')]=[{'all':!![]}];}_0x550d07=_[_0x6a42('0x4f')]({},_0x550d07,_0x1798bb[_0x6a42('0x51')]);return db[_0x6a42('0x3d')][_0x6a42('0x58')](_0x550d07)[_0x6a42('0x34')](handleEntityNotFound(_0x41d374,null))[_0x6a42('0x34')](respondWithResult(_0x41d374,null))['catch'](handleError(_0x41d374,null));};exports[_0x6a42('0x59')]=function(_0x4e3357,_0x3fadd5){return db[_0x6a42('0x3d')][_0x6a42('0x59')](_0x4e3357[_0x6a42('0x5a')],{})['then'](function(_0x4d7eb5){var _0x2c0f6c=_0x4e3357[_0x6a42('0x5b')][_0x6a42('0x35')]({'plain':!![]});if(!_0x2c0f6c)throw new Error(_0x6a42('0x5c'));if(_0x2c0f6c[_0x6a42('0x5d')]===_0x6a42('0x5b')){var _0xa47243=_0x4d7eb5[_0x6a42('0x35')]({'plain':!![]});var _0xaf1a77=_0x6a42('0x36');return db[_0x6a42('0x5e')]['find']({'where':{'name':_0xaf1a77,'userProfileId':_0x2c0f6c[_0x6a42('0x5f')]},'raw':!![]})[_0x6a42('0x34')](function(_0x54afc2){if(_0x54afc2&&_0x54afc2['autoAssociation']===0x0){return db[_0x6a42('0x60')][_0x6a42('0x59')]({'name':_0xa47243['name'],'resourceId':_0xa47243['id'],'type':_0x54afc2[_0x6a42('0x38')],'sectionId':_0x54afc2['id']},{})[_0x6a42('0x34')](function(){return _0x4d7eb5;});}else{return _0x4d7eb5;}})['catch'](function(_0x1bd2c8){logger[_0x6a42('0x23')](_0x6a42('0x61'),_0x1bd2c8);throw _0x1bd2c8;});}return _0x4d7eb5;})[_0x6a42('0x34')](respondWithResult(_0x3fadd5,0xc9))[_0x6a42('0x27')](handleError(_0x3fadd5,null));};exports[_0x6a42('0x32')]=function(_0x24205f,_0x2bae7d){if(_0x24205f['body']['id']){delete _0x24205f[_0x6a42('0x5a')]['id'];}return db[_0x6a42('0x3d')]['find']({'where':{'id':_0x24205f[_0x6a42('0x56')]['id']},'include':[{'model':db[_0x6a42('0x57')],'as':_0x6a42('0x3b')}]})[_0x6a42('0x34')](handleEntityNotFound(_0x2bae7d,null))[_0x6a42('0x34')](saveUpdates(_0x24205f[_0x6a42('0x5a')],null))[_0x6a42('0x34')](respondWithResult(_0x2bae7d,null))['catch'](handleError(_0x2bae7d,null));};exports[_0x6a42('0x33')]=function(_0x1d45f8,_0x361ec0){return db[_0x6a42('0x3d')][_0x6a42('0x58')]({'where':{'id':_0x1d45f8[_0x6a42('0x56')]['id']}})['then'](handleEntityNotFound(_0x361ec0,null))[_0x6a42('0x34')](removeEntity(_0x361ec0,null))[_0x6a42('0x27')](handleError(_0x361ec0,null));};exports[_0x6a42('0x62')]=function(_0x180280,_0x60d4d5){return db[_0x6a42('0x3d')][_0x6a42('0x62')]()[_0x6a42('0x34')](respondWithResult(_0x60d4d5,null))['catch'](handleError(_0x60d4d5,null));};exports[_0x6a42('0x63')]=function(_0x5d0cc2,_0x163ec3,_0x1aad31){if(_0x5d0cc2[_0x6a42('0x5a')]['id']){delete _0x5d0cc2[_0x6a42('0x5a')]['id'];}return db['FaxAccount'][_0x6a42('0x58')]({'where':{'id':_0x5d0cc2[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x163ec3,null))[_0x6a42('0x34')](function(_0x5ab71a){if(_0x5ab71a){_0x5d0cc2[_0x6a42('0x5a')][_0x6a42('0x64')]=_0x5ab71a['id'];return db[_0x6a42('0x65')][_0x6a42('0x59')](_0x5d0cc2['body']);}})['then'](respondWithResult(_0x163ec3,null))[_0x6a42('0x27')](handleError(_0x163ec3,null));};exports['getDispositions']=function(_0x22c1d0,_0x31cba3,_0x53a4c3){var _0x1b52d3={'raw':![],'where':{}};var _0x4ceb25={};var _0x44abcb={'count':0x0,'rows':[]};return db[_0x6a42('0x3d')][_0x6a42('0x66')]({'where':{'id':_0x22c1d0['params']['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x31cba3,null))[_0x6a42('0x34')](function(_0x42e08b){if(_0x42e08b){_0x4ceb25[_0x6a42('0x43')]=_[_0x6a42('0x41')](db[_0x6a42('0x65')]['rawAttributes']);_0x4ceb25[_0x6a42('0x44')]=_[_0x6a42('0x41')](_0x22c1d0[_0x6a42('0x44')]);_0x4ceb25[_0x6a42('0x42')]=_[_0x6a42('0x46')](_0x4ceb25[_0x6a42('0x43')],_0x4ceb25[_0x6a42('0x44')]);_0x1b52d3['attributes']=_[_0x6a42('0x46')](_0x4ceb25[_0x6a42('0x43')],qs[_0x6a42('0x47')](_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x47')]));_0x1b52d3[_0x6a42('0x45')]=_0x1b52d3[_0x6a42('0x45')][_0x6a42('0x48')]?_0x1b52d3[_0x6a42('0x45')]:_0x4ceb25[_0x6a42('0x43')];if(!_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x49')]('nolimit')){_0x1b52d3['limit']=qs['limit'](_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x4b')]);_0x1b52d3['offset']=qs['offset'](_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x2b')]);}_0x1b52d3[_0x6a42('0x67')]=qs['sort'](_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x4c')]);_0x1b52d3[_0x6a42('0x4d')]=qs[_0x6a42('0x42')](_[_0x6a42('0x68')](_0x22c1d0[_0x6a42('0x44')],_0x4ceb25[_0x6a42('0x42')]));_0x1b52d3['where'][_0x6a42('0x64')]=_0x42e08b['id'];if(_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x4e')]){_0x1b52d3[_0x6a42('0x4d')]=_[_0x6a42('0x4f')](_0x1b52d3['where'],{'$or':_[_0x6a42('0x3c')](_0x1b52d3[_0x6a42('0x45')],function(_0x2d607a){var _0x11b7c9={};_0x11b7c9[_0x2d607a]={'$like':'%'+_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x4e')]+'%'};return _0x11b7c9;})});}_0x1b52d3=_[_0x6a42('0x4f')]({},_0x1b52d3,_0x22c1d0[_0x6a42('0x51')]);return db[_0x6a42('0x65')][_0x6a42('0x2d')]({'where':_0x1b52d3[_0x6a42('0x4d')]})[_0x6a42('0x34')](function(_0x581ab0){_0x44abcb[_0x6a42('0x2d')]=_0x581ab0;if(_0x22c1d0[_0x6a42('0x44')][_0x6a42('0x52')]){_0x1b52d3[_0x6a42('0x53')]=[{'all':!![]}];}return db[_0x6a42('0x65')][_0x6a42('0x69')](_0x1b52d3);})[_0x6a42('0x34')](function(_0x2de132){_0x44abcb[_0x6a42('0x54')]=_0x2de132;return _0x44abcb;});}})['then'](respondWithFilteredResult(_0x31cba3,_0x1b52d3))[_0x6a42('0x27')](handleError(_0x31cba3,null));};exports[_0x6a42('0x6a')]=function(_0x55bcb4,_0x34c2ed,_0x454299){return db['FaxAccount'][_0x6a42('0x58')]({'where':{'id':_0x55bcb4['params']['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x34c2ed,null))[_0x6a42('0x34')](function(_0xe53b83){if(_0xe53b83){return _0xe53b83['removeDispositions'](_0x55bcb4['query'][_0x6a42('0x6b')]);}})[_0x6a42('0x34')](respondWithStatusCode(_0x34c2ed,null))[_0x6a42('0x27')](handleError(_0x34c2ed,null));};exports[_0x6a42('0x6c')]=function(_0x44644d,_0x1c9b4d,_0x463669){if(_0x44644d[_0x6a42('0x5a')]['id']){delete _0x44644d['body']['id'];}return db['FaxAccount'][_0x6a42('0x58')]({'where':{'id':_0x44644d[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x1c9b4d,null))[_0x6a42('0x34')](function(_0x45f7c9){if(_0x45f7c9){_0x44644d['body'][_0x6a42('0x64')]=_0x45f7c9['id'];return db[_0x6a42('0x6d')][_0x6a42('0x59')](_0x44644d[_0x6a42('0x5a')]);}})[_0x6a42('0x34')](respondWithResult(_0x1c9b4d,null))[_0x6a42('0x27')](handleError(_0x1c9b4d,null));};exports[_0x6a42('0x6e')]=function(_0x352c50,_0x55c5a4,_0x2dc955){var _0x4989f7={'raw':![],'where':{}};var _0x446ebd={};var _0x176464={'count':0x0,'rows':[]};return db[_0x6a42('0x3d')][_0x6a42('0x66')]({'where':{'id':_0x352c50[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x55c5a4,null))[_0x6a42('0x34')](function(_0x5c8752){if(_0x5c8752){_0x446ebd[_0x6a42('0x43')]=_[_0x6a42('0x41')](db['CannedAnswer'][_0x6a42('0x3e')]);_0x446ebd['query']=_[_0x6a42('0x41')](_0x352c50[_0x6a42('0x44')]);_0x446ebd[_0x6a42('0x42')]=_['intersection'](_0x446ebd[_0x6a42('0x43')],_0x446ebd[_0x6a42('0x44')]);_0x4989f7[_0x6a42('0x45')]=_['intersection'](_0x446ebd[_0x6a42('0x43')],qs[_0x6a42('0x47')](_0x352c50['query'][_0x6a42('0x47')]));_0x4989f7[_0x6a42('0x45')]=_0x4989f7[_0x6a42('0x45')]['length']?_0x4989f7[_0x6a42('0x45')]:_0x446ebd[_0x6a42('0x43')];if(!_0x352c50[_0x6a42('0x44')][_0x6a42('0x49')]('nolimit')){_0x4989f7[_0x6a42('0x4b')]=qs['limit'](_0x352c50[_0x6a42('0x44')]['limit']);_0x4989f7[_0x6a42('0x2b')]=qs['offset'](_0x352c50[_0x6a42('0x44')]['offset']);}_0x4989f7[_0x6a42('0x67')]=qs[_0x6a42('0x4c')](_0x352c50['query']['sort']);_0x4989f7[_0x6a42('0x4d')]=qs['filters'](_[_0x6a42('0x68')](_0x352c50[_0x6a42('0x44')],_0x446ebd['filters']));_0x4989f7[_0x6a42('0x4d')][_0x6a42('0x64')]=_0x5c8752['id'];if(_0x352c50[_0x6a42('0x44')][_0x6a42('0x4e')]){_0x4989f7[_0x6a42('0x4d')]=_['merge'](_0x4989f7['where'],{'$or':_[_0x6a42('0x3c')](_0x4989f7['attributes'],function(_0xe5fd3b){var _0x363b56={};_0x363b56[_0xe5fd3b]={'$like':'%'+_0x352c50[_0x6a42('0x44')]['filter']+'%'};return _0x363b56;})});}_0x4989f7=_[_0x6a42('0x4f')]({},_0x4989f7,_0x352c50['options']);return db['CannedAnswer'][_0x6a42('0x2d')]({'where':_0x4989f7[_0x6a42('0x4d')]})[_0x6a42('0x34')](function(_0x5ccff6){_0x176464[_0x6a42('0x2d')]=_0x5ccff6;if(_0x352c50['query']['includeAll']){_0x4989f7[_0x6a42('0x53')]=[{'all':!![]}];}return db[_0x6a42('0x6d')][_0x6a42('0x69')](_0x4989f7);})[_0x6a42('0x34')](function(_0x1d701a){_0x176464[_0x6a42('0x54')]=_0x1d701a;return _0x176464;});}})[_0x6a42('0x34')](respondWithFilteredResult(_0x55c5a4,_0x4989f7))[_0x6a42('0x27')](handleError(_0x55c5a4,null));};exports[_0x6a42('0x6f')]=function(_0x231e56,_0x57aee5,_0x48dde3){return db['FaxAccount']['find']({'where':{'id':_0x231e56[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x57aee5,null))[_0x6a42('0x34')](function(_0x42419d){if(_0x42419d){return _0x42419d[_0x6a42('0x6f')](_0x231e56[_0x6a42('0x44')][_0x6a42('0x6b')]);}})['then'](respondWithStatusCode(_0x57aee5,null))[_0x6a42('0x27')](handleError(_0x57aee5,null));};exports[_0x6a42('0x70')]=function(_0x290722,_0x469d68,_0x1d804b){return db[_0x6a42('0x71')][_0x6a42('0x58')]({'where':{'id':_0x290722[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x469d68,null))[_0x6a42('0x34')](function(_0xe12813){if(_0xe12813){return _0xe12813[_0x6a42('0x70')](_0x290722[_0x6a42('0x5a')][_0x6a42('0x6b')],_[_0x6a42('0x72')](_0x290722[_0x6a42('0x5a')],[_0x6a42('0x6b'),'id'])||{});}})[_0x6a42('0x34')](respondWithResult(_0x469d68,null))[_0x6a42('0x27')](handleError(_0x469d68,null));};exports[_0x6a42('0x73')]=function(_0x4ab1a5,_0x4afffc,_0x14dc57){var _0x2d7a9b={'raw':![],'where':{}};var _0x502185={};var _0x1e5233={'count':0x0,'rows':[]};return db[_0x6a42('0x3d')][_0x6a42('0x66')]({'where':{'id':_0x4ab1a5[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x4afffc,null))[_0x6a42('0x34')](function(_0x607d35){if(_0x607d35){_0x502185['model']=_[_0x6a42('0x41')](db[_0x6a42('0x71')]['rawAttributes']);_0x502185[_0x6a42('0x44')]=_[_0x6a42('0x41')](_0x4ab1a5[_0x6a42('0x44')]);_0x502185[_0x6a42('0x42')]=_[_0x6a42('0x46')](_0x502185[_0x6a42('0x43')],_0x502185[_0x6a42('0x44')]);_0x2d7a9b[_0x6a42('0x45')]=_[_0x6a42('0x46')](_0x502185[_0x6a42('0x43')],qs[_0x6a42('0x47')](_0x4ab1a5['query']['fields']));_0x2d7a9b['attributes']=_0x2d7a9b['attributes'][_0x6a42('0x48')]?_0x2d7a9b[_0x6a42('0x45')]:_0x502185[_0x6a42('0x43')];if(!_0x4ab1a5['query'][_0x6a42('0x49')]('nolimit')){_0x2d7a9b[_0x6a42('0x4b')]=qs[_0x6a42('0x4b')](_0x4ab1a5[_0x6a42('0x44')]['limit']);_0x2d7a9b[_0x6a42('0x2b')]=qs['offset'](_0x4ab1a5[_0x6a42('0x44')][_0x6a42('0x2b')]);}_0x2d7a9b[_0x6a42('0x67')]=qs[_0x6a42('0x4c')](_0x4ab1a5[_0x6a42('0x44')]['sort']);_0x2d7a9b[_0x6a42('0x4d')]=qs[_0x6a42('0x42')](_[_0x6a42('0x68')](_0x4ab1a5[_0x6a42('0x44')],_0x502185[_0x6a42('0x42')]));_0x2d7a9b['where'][_0x6a42('0x64')]=_0x607d35['id'];if(_0x4ab1a5[_0x6a42('0x44')][_0x6a42('0x4e')]){_0x2d7a9b[_0x6a42('0x4d')]=_['merge'](_0x2d7a9b[_0x6a42('0x4d')],{'$or':_['map'](_0x2d7a9b[_0x6a42('0x45')],function(_0x5b3ef3){var _0x11caf9={};_0x11caf9[_0x5b3ef3]={'$like':'%'+_0x4ab1a5[_0x6a42('0x44')][_0x6a42('0x4e')]+'%'};return _0x11caf9;})});}_0x2d7a9b=_[_0x6a42('0x4f')]({},_0x2d7a9b,_0x4ab1a5[_0x6a42('0x51')]);return db['FaxInteraction']['count']({'where':_0x2d7a9b[_0x6a42('0x4d')]})[_0x6a42('0x34')](function(_0x4a83ba){_0x1e5233['count']=_0x4a83ba;if(_0x4ab1a5[_0x6a42('0x44')][_0x6a42('0x52')]){_0x2d7a9b[_0x6a42('0x53')]=[{'model':db[_0x6a42('0x74')],'as':_0x6a42('0x75'),'required':![]},{'model':db[_0x6a42('0x76')],'as':_0x6a42('0x77'),'attributes':[_0x6a42('0x38'),'fullname',_0x6a42('0x78')],'required':![]},{'model':db[_0x6a42('0x79')],'as':_0x6a42('0x7a'),'attributes':['id',_0x6a42('0x38'),_0x6a42('0x7b')],'where':_0x4ab1a5[_0x6a42('0x44')]['tag']?{'id':_0x4ab1a5[_0x6a42('0x44')]['tag']}:undefined,'required':_0x4ab1a5['query'][_0x6a42('0x7c')]?!![]:![]}];}return db[_0x6a42('0x71')][_0x6a42('0x69')](_0x2d7a9b);})[_0x6a42('0x34')](function(_0x2bd745){_0x1e5233['rows']=_0x2bd745;return _0x1e5233;});}})['then'](respondWithFilteredResult(_0x4afffc,_0x2d7a9b))[_0x6a42('0x27')](handleError(_0x4afffc,null));};exports[_0x6a42('0x7d')]=function(_0x371717,_0x5c3615){var _0x4f6b5e=_0x371717['params']['id'];var _0x1f7396=_0x371717[_0x6a42('0x5a')];var _0x11005b=0xc8;var _0x5b9b97=null;return db[_0x6a42('0x7e')][_0x6a42('0x7f')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x289544){return db['FaxAccount']['findOne']({'where':{'id':_0x4f6b5e},'transaction':_0x289544})[_0x6a42('0x34')](function(_0xf56227){if(_0xf56227){return db[_0x6a42('0x80')][_0x6a42('0x33')]({'where':{'FaxAccountId':_0x4f6b5e},'transaction':_0x289544})['then'](function(){var _0xe0eed5=_[_0x6a42('0x3c')](_0x1f7396,function(_0x2d818b){_0x2d818b[_0x6a42('0x64')]=_0x4f6b5e;return _0x2d818b;});return db[_0x6a42('0x80')][_0x6a42('0x81')](_0xe0eed5,{'transaction':_0x289544});});}else{_0x11005b=0x194;_0x5b9b97=[];}});})[_0x6a42('0x34')](function(){if(_0x11005b!==0x194){return db['FaxApplication'][_0x6a42('0x82')]({'where':{'FaxAccountId':_0x4f6b5e},'order':_0x6a42('0x83')})[_0x6a42('0x34')](function(_0x5bd2c2){_0x5b9b97=_0x5bd2c2;});}})[_0x6a42('0x27')](function(_0x56c0f8){_0x11005b=0x1f4;logger[_0x6a42('0x23')](_0x56c0f8['stack']);if(_0x56c0f8[_0x6a42('0x38')]){delete _0x56c0f8[_0x6a42('0x38')];}_0x5b9b97=_0x56c0f8;})[_0x6a42('0x84')](function(){if(_0x5b9b97===null){_0x5c3615['sendStatus'](_0x11005b);}else{if(_0x11005b===0x1f4){_0x5c3615[_0x6a42('0x29')](_0x11005b)[_0x6a42('0x39')](_0x5b9b97);}else{_0x5c3615[_0x6a42('0x29')](_0x11005b)[_0x6a42('0x30')](_0x5b9b97);}}});};exports['getApplications']=function(_0x428042,_0x5374f1,_0x61bd4e){var _0x486466={};var _0x3d505a={};var _0x3dc3eb;var _0x53cf91;return db[_0x6a42('0x3d')][_0x6a42('0x66')]({'where':{'id':_0x428042[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x5374f1,null))[_0x6a42('0x34')](function(_0x59fae6){if(_0x59fae6){_0x3dc3eb=_0x59fae6;_0x3d505a[_0x6a42('0x43')]=_[_0x6a42('0x41')](db[_0x6a42('0x80')][_0x6a42('0x3e')]);_0x3d505a['query']=_[_0x6a42('0x41')](_0x428042[_0x6a42('0x44')]);_0x3d505a['filters']=_[_0x6a42('0x46')](_0x3d505a[_0x6a42('0x43')],_0x3d505a['query']);_0x486466[_0x6a42('0x45')]=_[_0x6a42('0x46')](_0x3d505a[_0x6a42('0x43')],qs[_0x6a42('0x47')](_0x428042[_0x6a42('0x44')][_0x6a42('0x47')]));_0x486466['attributes']=_0x486466[_0x6a42('0x45')][_0x6a42('0x48')]?_0x486466[_0x6a42('0x45')]:_0x3d505a['model'];_0x486466[_0x6a42('0x67')]=qs['sort'](_0x428042['query']['sort']);_0x486466['where']=qs[_0x6a42('0x42')](_[_0x6a42('0x68')](_0x428042[_0x6a42('0x44')],_0x3d505a[_0x6a42('0x42')]));if(_0x428042['query']['filter']){_0x486466[_0x6a42('0x4d')]=_['merge'](_0x486466[_0x6a42('0x4d')],{'$or':_['map'](_0x486466[_0x6a42('0x45')],function(_0x1192ce){var _0x56b6c3={};_0x56b6c3[_0x1192ce]={'$like':'%'+_0x428042[_0x6a42('0x44')][_0x6a42('0x4e')]+'%'};return _0x56b6c3;})});}_0x486466=_[_0x6a42('0x4f')]({},_0x486466,_0x428042[_0x6a42('0x51')]);return _0x3dc3eb[_0x6a42('0x85')](_0x486466);}})[_0x6a42('0x34')](function(_0x9def2b){if(_0x9def2b){_0x53cf91=_0x9def2b[_0x6a42('0x48')];if(!_0x428042[_0x6a42('0x44')][_0x6a42('0x49')](_0x6a42('0x4a'))){_0x486466[_0x6a42('0x4b')]=qs['limit'](_0x428042[_0x6a42('0x44')][_0x6a42('0x4b')]);_0x486466[_0x6a42('0x2b')]=qs[_0x6a42('0x2b')](_0x428042[_0x6a42('0x44')][_0x6a42('0x2b')]);}return _0x3dc3eb[_0x6a42('0x85')](_0x486466);}})['then'](function(_0x179da5){if(_0x179da5){return _0x179da5?{'count':_0x53cf91,'rows':_0x179da5}:null;}})[_0x6a42('0x34')](respondWithResult(_0x5374f1,null))['catch'](handleError(_0x5374f1,null));};function Extension(_0x4af827,_0x165edf,_0x292f7f,_0x59b16f){this[_0x6a42('0x86')]=_0x6a42('0x87');this[_0x6a42('0x88')]=_0x4af827['localstationid'];this[_0x6a42('0x89')]=_0x59b16f;this[_0x6a42('0x3f')]=_0x6a42('0x8a');this[_0x6a42('0x8b')]=_0x6a42('0x8c');this[_0x6a42('0x64')]=_0x4af827['id'];this[_0x6a42('0x83')]=_0x165edf;this['appdata']=_0x292f7f;}function createExtensionsReciveFax(_0x5d1f17){var _0x5b7f31=0x1;var _0x2ed2c4=[];_0x2ed2c4[_0x6a42('0x8d')](new Extension(_0x5d1f17,_0x5b7f31,'',_0x6a42('0x8e')));_0x5b7f31+=0x1;_0x2ed2c4[_0x6a42('0x8d')](new Extension(_0x5d1f17,_0x5b7f31,_0x6a42('0x8f'),_0x6a42('0x90')));_0x5b7f31+=0x1;for(var _0x1b3085 in _0x5d1f17){if(_0x5d1f17[_0x6a42('0x49')](_0x1b3085)&&(_0x1b3085===_0x6a42('0x91')||_0x1b3085===_0x6a42('0x92')||_0x1b3085==='gateway'||_0x1b3085===_0x6a42('0x93')||_0x1b3085===_0x6a42('0x94')||_0x1b3085===_0x6a42('0x95')||_0x1b3085===_0x6a42('0x96')||_0x1b3085==='modem'||_0x1b3085==='t38timeout')){_0x2ed2c4['push'](new Extension(_0x5d1f17,_0x5b7f31,_0x6a42('0x97')+_0x1b3085+')='+_0x5d1f17[_0x1b3085],_0x6a42('0x90')));_0x5b7f31+=0x1;}}_0x2ed2c4[_0x6a42('0x8d')](new Extension(_0x5d1f17,_0x5b7f31,'6','Wait'));_0x5b7f31+=0x1;_0x2ed2c4[_0x6a42('0x8d')](new Extension(_0x5d1f17,_0x5b7f31,_0x6a42('0x98'),_0x6a42('0x99')));_0x5b7f31=0x0;return _0x2ed2c4;}exports[_0x6a42('0x9a')]=function(_0xdb4422,_0xddebb5,_0x492d02){var _0x2420f4;return db['sequelize'][_0x6a42('0x7f')](function(_0x51c4e6){return db[_0x6a42('0x3d')][_0x6a42('0x59')](_0xdb4422['body'],{'transaction':_0x51c4e6})['then'](function(_0x1674ae){_0x2420f4=_0x1674ae[_0x6a42('0x35')]({'plain':!![]});return db[_0x6a42('0x9b')][_0x6a42('0x81')](createExtensionsReciveFax(_0x2420f4),{'transaction':_0x51c4e6});});})[_0x6a42('0x34')](function(){return _0x2420f4;})[_0x6a42('0x34')](respondWithResult(_0xddebb5,null))['catch'](handleError(_0xddebb5,null));};exports[_0x6a42('0x9c')]=function(_0x25b32a,_0x3dc4b4,_0x4e4b12){var _0x2ee1f5;return db[_0x6a42('0x7e')][_0x6a42('0x7f')](function(_0x3b8dad){return db[_0x6a42('0x3d')]['update'](_0x25b32a['body'],{'where':{'id':_0x25b32a['body']['id']},'transaction':_0x3b8dad})[_0x6a42('0x34')](function(_0x148c52){return db[_0x6a42('0x9b')][_0x6a42('0x33')]({'where':{'FaxAccountId':_0x25b32a[_0x6a42('0x5a')]['id']},'transaction':_0x3b8dad})[_0x6a42('0x34')](function(_0x4d591d){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x6a42('0x72')](_0x25b32a['body'],[_0x6a42('0x9d'),_0x6a42('0x40'),'createdAt',_0x6a42('0x9e'),_0x6a42('0x9f'),_0x6a42('0xa0')])),{'transaction':_0x3b8dad});});});})[_0x6a42('0x34')](function(){return db['FaxAccount'][_0x6a42('0xa1')](_0x25b32a['body']['id']);})[_0x6a42('0x34')](respondWithResult(_0x3dc4b4,null))[_0x6a42('0x27')](handleError(_0x3dc4b4,null));};exports['getMessages']=function(_0x20b6bc,_0x27f2a8,_0xc16bd7){var _0x10d36a={'raw':!![],'where':{}};var _0x19bb19={};var _0x31b689={'count':0x0,'rows':[]};return db[_0x6a42('0x3d')]['findOne']({'where':{'id':_0x20b6bc[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x27f2a8,null))[_0x6a42('0x34')](function(_0x472667){if(_0x472667){_0x19bb19['model']=_[_0x6a42('0x41')](db[_0x6a42('0xa2')][_0x6a42('0x3e')]);_0x19bb19[_0x6a42('0x44')]=_['keys'](_0x20b6bc[_0x6a42('0x44')]);_0x19bb19[_0x6a42('0x42')]=_[_0x6a42('0x46')](_0x19bb19[_0x6a42('0x43')],_0x19bb19[_0x6a42('0x44')]);_0x10d36a[_0x6a42('0x45')]=_['intersection'](_0x19bb19['model'],qs[_0x6a42('0x47')](_0x20b6bc[_0x6a42('0x44')][_0x6a42('0x47')]));_0x10d36a[_0x6a42('0x45')]=_0x10d36a[_0x6a42('0x45')][_0x6a42('0x48')]?_0x10d36a[_0x6a42('0x45')]:_0x19bb19[_0x6a42('0x43')];if(!_0x20b6bc[_0x6a42('0x44')][_0x6a42('0x49')](_0x6a42('0x4a'))){_0x10d36a[_0x6a42('0x4b')]=qs[_0x6a42('0x4b')](_0x20b6bc[_0x6a42('0x44')][_0x6a42('0x4b')]);_0x10d36a['offset']=qs[_0x6a42('0x2b')](_0x20b6bc[_0x6a42('0x44')][_0x6a42('0x2b')]);}_0x10d36a[_0x6a42('0x67')]=qs['sort'](_0x20b6bc['query'][_0x6a42('0x4c')]);_0x10d36a[_0x6a42('0x4d')]=qs['filters'](_['pick'](_0x20b6bc[_0x6a42('0x44')],_0x19bb19[_0x6a42('0x42')]));_0x10d36a['where'][_0x6a42('0x64')]=_0x472667['id'];if(_0x20b6bc['query'][_0x6a42('0x4e')]){_0x10d36a[_0x6a42('0x4d')]=_[_0x6a42('0x4f')](_0x10d36a['where'],{'$or':_[_0x6a42('0x3c')](_0x10d36a[_0x6a42('0x45')],function(_0x4f6164){var _0x1d2e23={};_0x1d2e23[_0x4f6164]={'$like':'%'+_0x20b6bc['query'][_0x6a42('0x4e')]+'%'};return _0x1d2e23;})});}if(_0x20b6bc['query'][_0x6a42('0xa3')]){var _0x32fb48=_0x20b6bc[_0x6a42('0x44')][_0x6a42('0xa3')]['split'](',');var _0x3e75ab={};_0x3e75ab[_0x32fb48[0x0]]={'$gte':moment(_0x32fb48[0x1])['format'](_0x6a42('0xa4'))};_0x10d36a[_0x6a42('0x4d')]=_['merge'](_0x10d36a[_0x6a42('0x4d')],_0x3e75ab);}_0x10d36a=_[_0x6a42('0x4f')]({},_0x10d36a,_0x20b6bc[_0x6a42('0x51')]);return db[_0x6a42('0xa2')]['count']({'where':_0x10d36a['where']})[_0x6a42('0x34')](function(_0x4c7f50){_0x31b689[_0x6a42('0x2d')]=_0x4c7f50;if(_0x20b6bc[_0x6a42('0x44')][_0x6a42('0x52')]){_0x10d36a[_0x6a42('0x53')]=[{'all':!![]}];}return db[_0x6a42('0xa2')][_0x6a42('0x69')](_0x10d36a);})['then'](function(_0x2c544d){_0x31b689[_0x6a42('0x54')]=_0x2c544d;return _0x31b689;});}})[_0x6a42('0x34')](respondWithFilteredResult(_0x27f2a8,_0x10d36a))[_0x6a42('0x27')](handleError(_0x27f2a8,null));};exports[_0x6a42('0x39')]=function(_0x2559d7,_0x26ee9e,_0x450a48){var _0x2b1c94,_0x29656f={},_0x2e0b22;if(_0x2559d7['body']['to']){_0x2e0b22=_0x2559d7['body']['to'][0x0];}return db[_0x6a42('0x3d')][_0x6a42('0x58')]({'where':{'id':_0x2559d7['params']['id']},'include':[{'model':db[_0x6a42('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6a42('0xa6'),'where':{'fax':_0x2e0b22},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x6a42('0x34')](handleEntityNotFound(_0x26ee9e,null))[_0x6a42('0x34')](function(_0x1df240){_0x2b1c94=_0x1df240;if(_0x2559d7['body'][_0x6a42('0xa7')]&&_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')]['length']){for(var _0x40596e=0x0;_0x40596e<_0x2559d7[_0x6a42('0x5a')]['attachments'][_0x6a42('0x48')];_0x40596e+=0x1){_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][_0x40596e]={'filename':_0x2559d7['body'][_0x6a42('0xa7')][_0x40596e]['name'],'id':_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][_0x40596e]['id'],'path':path['join'](config[_0x6a42('0xa8')],_0x6a42('0xa9'),_0x2559d7[_0x6a42('0x5a')]['attachments'][_0x40596e][_0x6a42('0xaa')])};}}return respondWithRpcPromise(_0x6a42('0xab'),_0x6a42('0xab'),{'FaxAccountId':_['isNil'](_0x2559d7[_0x6a42('0x56')]['id'])?undefined:_0x2559d7['params']['id'],'path':_[_0x6a42('0xac')](_0x2559d7['body'][_0x6a42('0xa7')][0x0]['path'])?undefined:_0x2559d7['body'][_0x6a42('0xa7')][0x0][_0x6a42('0xad')],'fax':_[_0x6a42('0xac')](_0x2559d7[_0x6a42('0x5a')]['to'][0x0])?undefined:_0x2559d7[_0x6a42('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x2b1c94){if(_['isNil'](_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xae')])){_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xae')]=util['format'](_0x6a42('0xaf'),_0x2b1c94['name'],_0x2b1c94[_0x6a42('0xb0')]);}if(_0x2b1c94[_0x6a42('0xb1')]){if(_0x2b1c94[_0x6a42('0xb1')]['Contacts'][_0x6a42('0x48')]){return _0x2b1c94['List'][_0x6a42('0xa6')][0x0];}else{return db[_0x6a42('0x74')][_0x6a42('0x59')](_[_0x6a42('0xb2')](_0x2559d7[_0x6a42('0x5a')],{'firstName':_0x2559d7['body']['to'][0x0],'phone':_0x2559d7[_0x6a42('0x5a')]['to'][0x0],'fax':_0x2559d7[_0x6a42('0x5a')]['to'][0x0],'ListId':_0x2b1c94[_0x6a42('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x6a42('0xb3'));}})[_0x6a42('0x34')](function(_0x1b6669){if(_0x1b6669){return db['FaxInteraction'][_0x6a42('0x58')]({'where':{'ContactId':_0x1b6669['id'],'closed':![],'FaxAccountId':_0x2b1c94['id']}})[_0x6a42('0x34')](function(_0x4e53cf){if(_0x4e53cf){return[_0x4e53cf,![]];}return db[_0x6a42('0x71')][_0x6a42('0x59')]({'UserId':_0x2559d7[_0x6a42('0x5b')]['id'],'ContactId':_0x1b6669['id'],'FaxAccountId':_0x2b1c94['id'],'fax':_0x2559d7[_0x6a42('0x5a')]['to'][0x0],'firstMsgDirection':_0x6a42('0xb4'),'Messages':[_[_0x6a42('0x4f')](_0x2559d7[_0x6a42('0x5a')],{'read':![],'body':_0x2559d7['body'][_0x6a42('0xa7')][0x0][_0x6a42('0xb5')],'FaxAccountId':_0x2b1c94['id'],'UserId':_0x2559d7[_0x6a42('0x5b')]['id'],'ContactId':_0x1b6669['id'],'AttachmentId':_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x6a42('0xa2')],'as':_0x6a42('0xb6')}]})['then'](function(_0x3c1ef1){return[_0x3c1ef1,!![]];});});}else{throw new Error(_0x6a42('0xb7'));}})['spread'](function(_0x2f6f8e,_0x4ada95){if(_0x4ada95){return _0x2f6f8e;}return db['FaxMessage'][_0x6a42('0x59')]({'direction':_0x6a42('0xb4'),'read':![],'body':_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][0x0][_0x6a42('0xb5')],'FaxAccountId':_0x2b1c94['id'],'FaxInteractionId':_0x2f6f8e['id'],'UserId':_0x2559d7[_0x6a42('0x5b')]['id'],'ContactId':_0x2f6f8e[_0x6a42('0xb8')],'AttachmentId':_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][0x0]['id']})[_0x6a42('0x34')](function(_0x141dbd){_0x2f6f8e[_0x6a42('0xb9')][_0x6a42('0xb6')]=[];_0x2f6f8e[_0x6a42('0xb9')][_0x6a42('0xb6')][_0x6a42('0x8d')](_0x141dbd['dataValues']);return _0x2f6f8e;});})['then'](function(_0x45ca10){respondWithRpcPromise(_0x6a42('0xba'),_0x6a42('0xba'),{'FaxAccountId':_[_0x6a42('0xac')](_0x2559d7[_0x6a42('0x56')]['id'])?undefined:_0x2559d7[_0x6a42('0x56')]['id'],'path':_[_0x6a42('0xac')](_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][0x0][_0x6a42('0xad')])?undefined:_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][0x0][_0x6a42('0xad')],'fax':_['isNil'](_0x2559d7[_0x6a42('0x5a')]['to'][0x0])?undefined:_0x2559d7[_0x6a42('0x5a')]['to'][0x0],'AttachmentId':_0x2559d7[_0x6a42('0x5a')][_0x6a42('0xa7')][0x0]['id']},client9002)[_0x6a42('0x34')](function(_0x857f9b){logger[_0x6a42('0x1e')]('SendFaxRpc,\x20%s',_0x857f9b);})[_0x6a42('0x27')](function(_0x9405d0){logger[_0x6a42('0x1e')](_0x6a42('0xbb'),_0x9405d0);});return _0x45ca10;})[_0x6a42('0x34')](respondWithResult(_0x26ee9e,null))[_0x6a42('0x27')](handleError(_0x26ee9e,null));};exports[_0x6a42('0xbc')]=function(_0x59cd73,_0x1eb03c,_0x4a7f2c){return db[_0x6a42('0x3d')][_0x6a42('0x58')]({'where':{'id':_0x59cd73['params']['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x1eb03c,null))[_0x6a42('0x34')](function(_0x21e2ac){if(_0x21e2ac){return _0x21e2ac[_0x6a42('0xbc')](_0x59cd73[_0x6a42('0x5a')]['ids'],_[_0x6a42('0x72')](_0x59cd73[_0x6a42('0x5a')],[_0x6a42('0x6b'),'id'])||{})[_0x6a42('0xbd')](function(_0x20c3d7){for(var _0x1e5b4e=0x0;_0x1e5b4e<_0x59cd73['body'][_0x6a42('0x6b')][_0x6a42('0x48')];_0x1e5b4e+=0x1){socket[_0x6a42('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x59cd73[_0x6a42('0x5a')]['ids'][_0x1e5b4e]),'FaxAccountId':Number(_0x59cd73['params']['id'])});}return _0x20c3d7;});}})[_0x6a42('0x34')](respondWithResult(_0x1eb03c,null))[_0x6a42('0x27')](handleError(_0x1eb03c,null));};exports[_0x6a42('0xbf')]=function(_0x46a9a3,_0x4dc172,_0x2989f7){return db['FaxAccount'][_0x6a42('0x58')]({'where':{'id':_0x46a9a3[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x4dc172,null))[_0x6a42('0x34')](function(_0x326b3d){if(_0x326b3d){return _0x326b3d[_0x6a42('0xbf')](_0x46a9a3['query'][_0x6a42('0x6b')])[_0x6a42('0x34')](function(){if(_['isArray'](_0x46a9a3['query'][_0x6a42('0x6b')])){for(var _0x30c292=0x0;_0x30c292<_0x46a9a3['query'][_0x6a42('0x6b')][_0x6a42('0x48')];_0x30c292+=0x1){socket[_0x6a42('0xbe')](_0x6a42('0xc0'),{'UserId':Number(_0x46a9a3['query']['ids'][_0x30c292]),'FaxAccountId':Number(_0x46a9a3[_0x6a42('0x56')]['id'])});}}else{socket[_0x6a42('0xbe')](_0x6a42('0xc0'),{'UserId':Number(_0x46a9a3[_0x6a42('0x44')][_0x6a42('0x6b')]),'FaxAccountId':Number(_0x46a9a3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4dc172,null))['catch'](handleError(_0x4dc172,null));};exports[_0x6a42('0xc1')]=function(_0x567ff5,_0x52b7aa,_0x1e1bc4){var _0x17d309={};var _0x2c5c9c={};var _0x581192;var _0x44e155;return db['FaxAccount'][_0x6a42('0x66')]({'where':{'id':_0x567ff5[_0x6a42('0x56')]['id']}})[_0x6a42('0x34')](handleEntityNotFound(_0x52b7aa,null))['then'](function(_0x54407d){if(_0x54407d){_0x581192=_0x54407d;_0x2c5c9c[_0x6a42('0x43')]=_['keys'](db['User']['rawAttributes']);_0x2c5c9c['query']=_[_0x6a42('0x41')](_0x567ff5['query']);_0x2c5c9c[_0x6a42('0x42')]=_[_0x6a42('0x46')](_0x2c5c9c[_0x6a42('0x43')],_0x2c5c9c[_0x6a42('0x44')]);_0x17d309[_0x6a42('0x45')]=_['intersection'](_0x2c5c9c[_0x6a42('0x43')],qs[_0x6a42('0x47')](_0x567ff5[_0x6a42('0x44')][_0x6a42('0x47')]));_0x17d309[_0x6a42('0x45')]=_0x17d309['attributes'][_0x6a42('0x48')]?_0x17d309['attributes']:_0x2c5c9c[_0x6a42('0x43')];_0x17d309[_0x6a42('0x67')]=qs[_0x6a42('0x4c')](_0x567ff5[_0x6a42('0x44')][_0x6a42('0x4c')]);_0x17d309[_0x6a42('0x4d')]=qs['filters'](_['pick'](_0x567ff5[_0x6a42('0x44')],_0x2c5c9c[_0x6a42('0x42')]));if(_0x567ff5['query'][_0x6a42('0x4e')]){_0x17d309[_0x6a42('0x4d')]=_[_0x6a42('0x4f')](_0x17d309[_0x6a42('0x4d')],{'$or':_[_0x6a42('0x3c')](_0x17d309[_0x6a42('0x45')],function(_0x2c379f){var _0xf5817e={};_0xf5817e[_0x2c379f]={'$like':'%'+_0x567ff5[_0x6a42('0x44')][_0x6a42('0x4e')]+'%'};return _0xf5817e;})});}_0x17d309=_['merge']({},_0x17d309,_0x567ff5[_0x6a42('0x51')]);return _0x581192[_0x6a42('0xc1')](_0x17d309);}})['then'](function(_0x5aefb8){if(_0x5aefb8){_0x44e155=_0x5aefb8['length'];if(!_0x567ff5[_0x6a42('0x44')][_0x6a42('0x49')](_0x6a42('0x4a'))){_0x17d309[_0x6a42('0x4b')]=qs[_0x6a42('0x4b')](_0x567ff5[_0x6a42('0x44')][_0x6a42('0x4b')]);_0x17d309['offset']=qs['offset'](_0x567ff5[_0x6a42('0x44')][_0x6a42('0x2b')]);}return _0x581192[_0x6a42('0xc1')](_0x17d309);}})[_0x6a42('0x34')](function(_0x40a4a7){if(_0x40a4a7){return _0x40a4a7?{'count':_0x44e155,'rows':_0x40a4a7}:null;}})[_0x6a42('0x34')](respondWithResult(_0x52b7aa,null))[_0x6a42('0x27')](handleError(_0x52b7aa,null));};
\ No newline at end of file
index a44389c..cc78636 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f81=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0xffdec4,_0x322bec){var _0x479138=function(_0x49b019){while(--_0x49b019){_0xffdec4['push'](_0xffdec4['shift']());}};_0x479138(++_0x322bec);}(_0x1f81,0xab));var _0x11f8=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x1f81[_0x3b0912];return _0xa8f339;};'use strict';var EventEmitter=require(_0x11f8('0x0'));var FaxAccount=require(_0x11f8('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x11f8('0x2')](0x0);var events={'afterCreate':_0x11f8('0x3'),'afterUpdate':'update','afterDestroy':_0x11f8('0x4')};function emitEvent(_0x2b6912){return function(_0xa169ce,_0x454d02,_0x1c6cc7){FaxAccountEvents[_0x11f8('0x5')](_0x2b6912+':'+_0xa169ce['id'],_0xa169ce);FaxAccountEvents[_0x11f8('0x5')](_0x2b6912,_0xa169ce);_0x1c6cc7(null);};}for(var e in events){if(events[_0x11f8('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x11f8('0x7')]=FaxAccountEvents;
\ No newline at end of file
+var _0x78a4=['emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x49d010,_0x4cd5ae){var _0x147755=function(_0x29ab55){while(--_0x29ab55){_0x49d010['push'](_0x49d010['shift']());}};_0x147755(++_0x4cd5ae);}(_0x78a4,0x12c));var _0x478a=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0x78a4[_0x390752];return _0x5eca55;};'use strict';var EventEmitter=require(_0x478a('0x0'));var FaxAccount=require(_0x478a('0x1'))['db'][_0x478a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x478a('0x3')](0x0);var events={'afterCreate':_0x478a('0x4'),'afterUpdate':_0x478a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5f0d01){return function(_0x5c541a,_0x3a5bb2,_0x56e017){FaxAccountEvents['emit'](_0x5f0d01+':'+_0x5c541a['id'],_0x5c541a);FaxAccountEvents[_0x478a('0x6')](_0x5f0d01,_0x5c541a);_0x56e017(null);};}for(var e in events){if(events[_0x478a('0x7')](e)){var event=events[e];FaxAccount[_0x478a('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents;
\ No newline at end of file
index afdbb28..a91df56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb60=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts'];(function(_0x25f7a4,_0xd3669b){var _0xce1383=function(_0x1182d9){while(--_0x1182d9){_0x25f7a4['push'](_0x25f7a4['shift']());}};_0xce1383(++_0xd3669b);}(_0xdb60,0x1ec));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0db6('0x0'))(_0x0db6('0x1'));var moment=require(_0x0db6('0x2'));var BPromise=require(_0x0db6('0x3'));var rp=require(_0x0db6('0x4'));var fs=require('fs');var path=require(_0x0db6('0x5'));var rimraf=require(_0x0db6('0x6'));var config=require(_0x0db6('0x7'));var attributes=require('./faxAccount.attributes');module[_0x0db6('0x8')]=function(_0x146bf7,_0x59ef92){return _0x146bf7[_0x0db6('0x9')](_0x0db6('0xa'),attributes,{'tableName':_0x0db6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5878=['fax_accounts','lodash','util','../../config/logger','api','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x40c6a7,_0x4fc99d){var _0x37f57d=function(_0x3ada7e){while(--_0x3ada7e){_0x40c6a7['push'](_0x40c6a7['shift']());}};_0x37f57d(++_0x4fc99d);}(_0x5878,0x1b9));var _0x8587=function(_0x5238b0,_0x27d80a){_0x5238b0=_0x5238b0-0x0;var _0x2202f=_0x5878[_0x5238b0];return _0x2202f;};'use strict';var _=require(_0x8587('0x0'));var util=require(_0x8587('0x1'));var logger=require(_0x8587('0x2'))(_0x8587('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8587('0x4'));var config=require(_0x8587('0x5'));var attributes=require(_0x8587('0x6'));module[_0x8587('0x7')]=function(_0x48d17,_0x29728f){return _0x48d17[_0x8587('0x8')](_0x8587('0x9'),attributes,{'tableName':_0x8587('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c7eec51..1985720 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9920=['unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxAccount','options','raw','where','map','include','model','attributes','info','GetFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','length','contact','FaxInteraction','create','Contact\x20not\x20found','autoclose','push'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9920,0x68));var _0x0992=function(_0x52469b,_0x4531d3){_0x52469b=_0x52469b-0x0;var _0x573d01=_0x9920[_0x52469b];return _0x573d01;};'use strict';var _=require(_0x0992('0x0'));var util=require('util');var moment=require(_0x0992('0x1'));var BPromise=require('bluebird');var rs=require(_0x0992('0x2'));var fs=require('fs');var Redis=require(_0x0992('0x3'));var db=require(_0x0992('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0992('0x5'))(_0x0992('0x6'));var config=require(_0x0992('0x7'));var jayson=require(_0x0992('0x8'));var client=jayson['client'][_0x0992('0x9')]({'port':0x232c});config['redis']=_[_0x0992('0xa')](config[_0x0992('0xb')],{'host':_0x0992('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0992('0xb')]));require(_0x0992('0xd'))[_0x0992('0xe')](socket);function respondWithRpcPromise(_0x427bb3,_0x3baed2,_0x26a0ea){return new BPromise(function(_0x1a0d86,_0x4e1d93){return client[_0x0992('0xf')](_0x427bb3,_0x26a0ea)[_0x0992('0x10')](function(_0x572dfb){logger['info'](_0x0992('0x11'),_0x3baed2,_0x0992('0x12'));logger[_0x0992('0x13')](_0x0992('0x14'),_0x3baed2,_0x0992('0x12'),JSON[_0x0992('0x15')](_0x572dfb));if(_0x572dfb[_0x0992('0x16')]){if(_0x572dfb[_0x0992('0x16')]['code']===0x1f4){logger['error'](_0x0992('0x11'),_0x3baed2,_0x572dfb[_0x0992('0x16')][_0x0992('0x17')]);return _0x4e1d93(_0x572dfb[_0x0992('0x16')][_0x0992('0x17')]);}logger[_0x0992('0x16')](_0x0992('0x11'),_0x3baed2,_0x572dfb[_0x0992('0x16')][_0x0992('0x17')]);return _0x1a0d86(_0x572dfb[_0x0992('0x16')][_0x0992('0x17')]);}else{logger['info'](_0x0992('0x11'),_0x3baed2,'request\x20sent');_0x1a0d86(_0x572dfb[_0x0992('0x18')][_0x0992('0x17')]);}})[_0x0992('0x19')](function(_0x26bd5f){logger[_0x0992('0x16')]('FaxAccount,\x20%s,\x20%s',_0x3baed2,_0x26bd5f);_0x4e1d93(_0x26bd5f);});});}exports['GetFaxAccount']=function(_0xe3a9c4){var _0x2a05ec=this;return new Promise(function(_0x56d176,_0x314d95){return db[_0x0992('0x1a')]['findAll']({'raw':_0xe3a9c4[_0x0992('0x1b')]?_0xe3a9c4[_0x0992('0x1b')][_0x0992('0x1c')]===undefined?!![]:![]:!![],'where':_0xe3a9c4[_0x0992('0x1b')]?_0xe3a9c4[_0x0992('0x1b')][_0x0992('0x1d')]||null:null,'attributes':_0xe3a9c4['options']?_0xe3a9c4[_0x0992('0x1b')]['attributes']||null:null,'limit':_0xe3a9c4[_0x0992('0x1b')]?_0xe3a9c4[_0x0992('0x1b')]['limit']||null:null,'include':_0xe3a9c4[_0x0992('0x1b')]?_0xe3a9c4[_0x0992('0x1b')]['include']?_[_0x0992('0x1e')](_0xe3a9c4['options'][_0x0992('0x1f')],function(_0x2f2725){return{'model':db[_0x2f2725[_0x0992('0x20')]],'as':_0x2f2725['as'],'attributes':_0x2f2725[_0x0992('0x21')],'include':_0x2f2725[_0x0992('0x1f')]?_['map'](_0x2f2725[_0x0992('0x1f')],function(_0x51ec32){return{'model':db[_0x51ec32[_0x0992('0x20')]],'as':_0x51ec32['as'],'attributes':_0x51ec32[_0x0992('0x21')],'include':_0x51ec32[_0x0992('0x1f')]?_[_0x0992('0x1e')](_0x51ec32[_0x0992('0x1f')],function(_0x994134){return{'model':db[_0x994134[_0x0992('0x20')]],'as':_0x994134['as'],'attributes':_0x994134['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x346d6d){logger[_0x0992('0x22')](_0x0992('0x23'),_0xe3a9c4);logger['debug'](_0x0992('0x23'),_0xe3a9c4,JSON[_0x0992('0x15')](_0x346d6d));_0x56d176(_0x346d6d);})[_0x0992('0x19')](function(_0x49e720){logger[_0x0992('0x16')](_0x0992('0x23'),_0x49e720[_0x0992('0x17')],_0xe3a9c4);_0x314d95(_0x2a05ec[_0x0992('0x16')](0x1f4,_0x49e720[_0x0992('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x59526f,_0x40d4a9,_0xccf5e5){var _0x3be06b=this;return new Promise(function(_0x5e5e46,_0x10b00e){var _0x3a8204={'body':_0x59526f[_0x0992('0x24')],'channel':_0x0992('0x25')};var _0x2c2d72=[];var _0x4c3f4b=[];var _0x505a7b={};return db[_0x0992('0x26')][_0x0992('0x27')]()[_0x0992('0x10')](function(_0x48032f){if(!_0x48032f){throw new db[(_0x0992('0x28'))][(_0x0992('0x29'))](_0x0992('0x2a'));}_0x2c2d72=_['difference'](_[_0x0992('0x2b')](_0x48032f),[_0x0992('0x2c'),'updatedAt']);_0x4c3f4b=_[_0x0992('0x2d')](_[_0x0992('0x2b')](_0x48032f),[_0x0992('0x2c'),_0x0992('0x2e'),_0x0992('0x2f'),_0x0992('0x30')]);if(_0x59526f[_0x0992('0x24')]['id']){delete _0x59526f[_0x0992('0x24')]['id'];}if(_[_0x0992('0x31')](_0x59526f[_0x0992('0x24')][_0x0992('0x32')])){throw new db[(_0x0992('0x28'))][(_0x0992('0x29'))](_0x0992('0x33'));}if(_['isNil'](_0x59526f[_0x0992('0x24')]['body'])||_0x59526f['body'][_0x0992('0x24')]===''){throw new db[(_0x0992('0x28'))][(_0x0992('0x29'))](_0x0992('0x34'));}if(_[_0x0992('0x31')](_0x59526f[_0x0992('0x24')][_0x0992('0x35')])){throw new db[(_0x0992('0x28'))]['ValidationError'](_0x0992('0x36')+_0x4c3f4b);}if(!_[_0x0992('0x37')](_0x4c3f4b,_0x59526f[_0x0992('0x24')][_0x0992('0x35')])){throw new db[(_0x0992('0x28'))][(_0x0992('0x29'))](_0x0992('0x38')+_0x4c3f4b);}_0x505a7b[_0x59526f[_0x0992('0x24')][_0x0992('0x35')]]=_0x59526f[_0x0992('0x24')]['from'];})[_0x0992('0x10')](function(){return db['FaxAccount'][_0x0992('0x39')]({'where':{'id':_0x59526f[_0x0992('0x3a')]['id']},'include':[{'model':db[_0x0992('0x3b')],'as':_0x0992('0x3c'),'include':[{'model':db[_0x0992('0x26')],'as':_0x0992('0x3d'),'where':_0x505a7b,'limit':0x1,'order':[[_0x0992('0x2e'),_0x0992('0x3e')]]}]},{'model':db[_0x0992('0x3f')],'as':'Applications'}]});})[_0x0992('0x10')](function(_0x1f9257){if(_0x1f9257&&_0x1f9257[_0x0992('0x3c')]){var _0x4a9e8c=_0x1f9257[_0x0992('0x40')]({'plain':!![]});_0x3a8204[_0x0992('0x3a')]=_0x4a9e8c;_0x3a8204[_0x0992('0x41')]=_0x4a9e8c[_0x0992('0x42')];_0x3a8204[_0x0992('0x43')]=_0x4a9e8c['List'];_0x3a8204[_0x0992('0x41')]=_[_0x0992('0x44')](_0x3a8204[_0x0992('0x41')],[_0x0992('0x45')],[_0x0992('0x46')]);if(_0x3a8204[_0x0992('0x3a')][_0x0992('0x42')]){delete _0x3a8204[_0x0992('0x3a')][_0x0992('0x42')];}if(_0x3a8204['account']['List']&&_0x3a8204[_0x0992('0x3a')][_0x0992('0x3c')][_0x0992('0x3d')][_0x0992('0x47')]){return _0x3a8204[_0x0992('0x3a')][_0x0992('0x3c')][_0x0992('0x3d')][0x0];}var _0x191024=_[_0x0992('0xa')](_0x59526f[_0x0992('0x24')],{'firstName':_0x59526f['body'][_0x0992('0x32')],'ListId':_0x4a9e8c[_0x0992('0x30')]});_0x191024[_0x59526f[_0x0992('0x24')][_0x0992('0x35')]]=_0x59526f[_0x0992('0x24')][_0x0992('0x32')];return db[_0x0992('0x26')]['create'](_0x191024,{'fields':_0x2c2d72,'raw':!![]});}})[_0x0992('0x10')](function(_0x23825f){_0x3a8204[_0x0992('0x48')]=_0x23825f;if(_0x23825f){var _0x414f8d={'ContactId':_0x23825f['id'],'FaxAccountId':_0x59526f[_0x0992('0x3a')]['id'],'fax':_0x23825f[_0x0992('0x25')]};return db['FaxInteraction'][_0x0992('0x39')]({'where':{'ContactId':_0x23825f['id'],'closed':![],'FaxAccountId':_0x59526f['account']['id']}})[_0x0992('0x10')](function(_0x2cbcd0){if(_0x2cbcd0){return[_0x2cbcd0,![]];}return db[_0x0992('0x49')][_0x0992('0x4a')](_0x414f8d)[_0x0992('0x10')](function(_0x4737dc){return[_0x4737dc,!![]];});});}else{throw new Error(_0x0992('0x4b'));}})['spread'](function(_0x55c9ef,_0x5250bf){var _0x493b6a=_0x55c9ef[_0x0992('0x40')]({'plain':!![]});if(_0x5250bf){if(_0x3a8204[_0x0992('0x3a')][_0x0992('0x4c')]){_0x3a8204[_0x0992('0x41')][_0x0992('0x4d')]({'id':0x0,'priority':_0x3a8204[_0x0992('0x41')][_0x0992('0x47')]+0x1,'app':'close','appdata':_0x0992('0x4e'),'interval':_0x0992('0x4f')});}_0x493b6a['created']=!![];}else{_0x493b6a['created']=![];}_0x3a8204[_0x0992('0x50')]=_0x493b6a;return db[_0x0992('0x51')][_0x0992('0x4a')]({'body':_0x59526f[_0x0992('0x24')]['body'],'FaxAccountId':_0x59526f[_0x0992('0x3a')]['id'],'FaxInteractionId':_0x55c9ef['id'],'direction':'in','ContactId':_0x55c9ef[_0x0992('0x52')],'AttachmentId':_0x59526f[_0x0992('0x24')][_0x0992('0x53')]});})[_0x0992('0x10')](function(_0x429742){_0x3a8204[_0x0992('0x17')]=_0x429742;if(_0x3a8204[_0x0992('0x50')]['UserId']){return db[_0x0992('0x54')]['find']({'attributes':['id',_0x0992('0x55')],'where':{'id':_0x3a8204[_0x0992('0x50')][_0x0992('0x56')]}})[_0x0992('0x10')](function(_0x45e9d0){if(_0x45e9d0){_0x3a8204['applications'][_0x0992('0x57')]({'id':0x0,'priority':0x0,'app':_0x0992('0x58'),'appdata':_0x45e9d0['name']+','+(_0x3a8204[_0x0992('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x0992('0x4f')});}return respondWithRpcPromise(_0x0992('0x59'),_0x0992('0x5a'),_0x3a8204);});}return respondWithRpcPromise(_0x0992('0x59'),'startRouting',_0x3a8204);})[_0x0992('0x10')](function(_0x1c63e6){_0x5e5e46(_0x1c63e6);})[_0x0992('0x19')](function(_0x790fc4){_0x10b00e(_0x3be06b[_0x0992('0x16')](0x1f4,_0x790fc4[_0x0992('0x17')]));});});};
\ No newline at end of file
+var _0x54d9=['FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','options','raw','where','attributes','limit','include','map','model','then','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','CmList','Applications','get','list','List','applications','orderBy','asc','Contacts','create','contact','FaxInteraction','find','Contact\x20not\x20found','autoclose','push','length','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x46cc9e,_0x51a09c){var _0x2afb41=function(_0x5ce282){while(--_0x5ce282){_0x46cc9e['push'](_0x46cc9e['shift']());}};_0x2afb41(++_0x51a09c);}(_0x54d9,0xf8));var _0x954d=function(_0x1c19d4,_0x146a9c){_0x1c19d4=_0x1c19d4-0x0;var _0x110ffa=_0x54d9[_0x1c19d4];return _0x110ffa;};'use strict';var _=require(_0x954d('0x0'));var util=require(_0x954d('0x1'));var moment=require(_0x954d('0x2'));var BPromise=require(_0x954d('0x3'));var rs=require(_0x954d('0x4'));var fs=require('fs');var Redis=require(_0x954d('0x5'));var db=require(_0x954d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x954d('0x7'))(_0x954d('0x8'));var config=require('../../config/environment');var jayson=require(_0x954d('0x9'));var client=jayson[_0x954d('0xa')][_0x954d('0xb')]({'port':0x232c});config['redis']=_[_0x954d('0xc')](config[_0x954d('0xd')],{'host':_0x954d('0xe'),'port':0x18eb});var socket=require(_0x954d('0xf'))(new Redis(config[_0x954d('0xd')]));require('./faxAccount.socket')[_0x954d('0x10')](socket);function respondWithRpcPromise(_0x439a4e,_0x3b5b5e,_0x30d9c9){return new BPromise(function(_0x3c6767,_0x1e1e98){return client[_0x954d('0x11')](_0x439a4e,_0x30d9c9)['then'](function(_0x15ed37){logger[_0x954d('0x12')]('FaxAccount,\x20%s,\x20%s',_0x3b5b5e,_0x954d('0x13'));logger[_0x954d('0x14')](_0x954d('0x15'),_0x3b5b5e,_0x954d('0x13'),JSON['stringify'](_0x15ed37));if(_0x15ed37['error']){if(_0x15ed37[_0x954d('0x16')][_0x954d('0x17')]===0x1f4){logger[_0x954d('0x16')]('FaxAccount,\x20%s,\x20%s',_0x3b5b5e,_0x15ed37[_0x954d('0x16')][_0x954d('0x18')]);return _0x1e1e98(_0x15ed37[_0x954d('0x16')][_0x954d('0x18')]);}logger[_0x954d('0x16')]('FaxAccount,\x20%s,\x20%s',_0x3b5b5e,_0x15ed37[_0x954d('0x16')]['message']);return _0x3c6767(_0x15ed37['error'][_0x954d('0x18')]);}else{logger[_0x954d('0x12')](_0x954d('0x19'),_0x3b5b5e,_0x954d('0x13'));_0x3c6767(_0x15ed37[_0x954d('0x1a')][_0x954d('0x18')]);}})[_0x954d('0x1b')](function(_0x129e56){logger['error'](_0x954d('0x19'),_0x3b5b5e,_0x129e56);_0x1e1e98(_0x129e56);});});}exports[_0x954d('0x1c')]=function(_0x22d263){var _0x4ea862=this;return new Promise(function(_0xf7c7bf,_0x23650f){return db['FaxAccount']['findAll']({'raw':_0x22d263[_0x954d('0x1d')]?_0x22d263[_0x954d('0x1d')][_0x954d('0x1e')]===undefined?!![]:![]:!![],'where':_0x22d263[_0x954d('0x1d')]?_0x22d263[_0x954d('0x1d')][_0x954d('0x1f')]||null:null,'attributes':_0x22d263[_0x954d('0x1d')]?_0x22d263[_0x954d('0x1d')][_0x954d('0x20')]||null:null,'limit':_0x22d263['options']?_0x22d263[_0x954d('0x1d')][_0x954d('0x21')]||null:null,'include':_0x22d263[_0x954d('0x1d')]?_0x22d263[_0x954d('0x1d')][_0x954d('0x22')]?_[_0x954d('0x23')](_0x22d263[_0x954d('0x1d')][_0x954d('0x22')],function(_0x3bf489){return{'model':db[_0x3bf489[_0x954d('0x24')]],'as':_0x3bf489['as'],'attributes':_0x3bf489[_0x954d('0x20')],'include':_0x3bf489[_0x954d('0x22')]?_[_0x954d('0x23')](_0x3bf489[_0x954d('0x22')],function(_0x4602f4){return{'model':db[_0x4602f4[_0x954d('0x24')]],'as':_0x4602f4['as'],'attributes':_0x4602f4[_0x954d('0x20')],'include':_0x4602f4['include']?_[_0x954d('0x23')](_0x4602f4[_0x954d('0x22')],function(_0x598d93){return{'model':db[_0x598d93['model']],'as':_0x598d93['as'],'attributes':_0x598d93[_0x954d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x954d('0x25')](function(_0x5be2c1){logger['info'](_0x954d('0x1c'),_0x22d263);logger[_0x954d('0x14')](_0x954d('0x1c'),_0x22d263,JSON[_0x954d('0x26')](_0x5be2c1));_0xf7c7bf(_0x5be2c1);})[_0x954d('0x1b')](function(_0x16a6ef){logger[_0x954d('0x16')](_0x954d('0x1c'),_0x16a6ef[_0x954d('0x18')],_0x22d263);_0x23650f(_0x4ea862[_0x954d('0x16')](0x1f4,_0x16a6ef['message']));});});};exports[_0x954d('0x27')]=function(_0x36e081,_0xaeec53,_0x1bb5b7){var _0x2b53bf=this;return new Promise(function(_0x1aba1f,_0x1441c6){var _0x4c8d63={'body':_0x36e081[_0x954d('0x28')],'channel':_0x954d('0x29')};var _0x2c4e3d=[];var _0x393168=[];var _0x5e658f={};return db[_0x954d('0x2a')][_0x954d('0x2b')]()['then'](function(_0x2d41a9){if(!_0x2d41a9){throw new db[(_0x954d('0x2c'))][(_0x954d('0x2d'))](_0x954d('0x2e'));}_0x2c4e3d=_[_0x954d('0x2f')](_['keys'](_0x2d41a9),['createdAt','updatedAt']);_0x393168=_[_0x954d('0x2f')](_['keys'](_0x2d41a9),[_0x954d('0x30'),_0x954d('0x31'),_0x954d('0x32'),_0x954d('0x33')]);if(_0x36e081['body']['id']){delete _0x36e081[_0x954d('0x28')]['id'];}if(_[_0x954d('0x34')](_0x36e081['body'][_0x954d('0x35')])){throw new db[(_0x954d('0x2c'))][(_0x954d('0x2d'))](_0x954d('0x36'));}if(_[_0x954d('0x34')](_0x36e081[_0x954d('0x28')][_0x954d('0x28')])||_0x36e081[_0x954d('0x28')][_0x954d('0x28')]===''){throw new db[(_0x954d('0x2c'))][(_0x954d('0x2d'))](_0x954d('0x37'));}if(_[_0x954d('0x34')](_0x36e081[_0x954d('0x28')]['mapKey'])){throw new db['Sequelize'][(_0x954d('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x393168);}if(!_[_0x954d('0x38')](_0x393168,_0x36e081[_0x954d('0x28')][_0x954d('0x39')])){throw new db[(_0x954d('0x2c'))]['ValidationError'](_0x954d('0x3a')+_0x393168);}_0x5e658f[_0x36e081['body'][_0x954d('0x39')]]=_0x36e081['body'][_0x954d('0x35')];})['then'](function(){return db[_0x954d('0x3b')]['find']({'where':{'id':_0x36e081[_0x954d('0x3c')]['id']},'include':[{'model':db[_0x954d('0x3d')],'as':'List','include':[{'model':db[_0x954d('0x2a')],'as':'Contacts','where':_0x5e658f,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['FaxApplication'],'as':_0x954d('0x3e')}]});})[_0x954d('0x25')](function(_0x3161aa){if(_0x3161aa&&_0x3161aa['List']){var _0x10328c=_0x3161aa[_0x954d('0x3f')]({'plain':!![]});_0x4c8d63[_0x954d('0x3c')]=_0x10328c;_0x4c8d63['applications']=_0x10328c['Applications'];_0x4c8d63[_0x954d('0x40')]=_0x10328c[_0x954d('0x41')];_0x4c8d63[_0x954d('0x42')]=_[_0x954d('0x43')](_0x4c8d63[_0x954d('0x42')],['priority'],[_0x954d('0x44')]);if(_0x4c8d63[_0x954d('0x3c')][_0x954d('0x3e')]){delete _0x4c8d63[_0x954d('0x3c')][_0x954d('0x3e')];}if(_0x4c8d63[_0x954d('0x3c')]['List']&&_0x4c8d63[_0x954d('0x3c')][_0x954d('0x41')]['Contacts']['length']){return _0x4c8d63[_0x954d('0x3c')][_0x954d('0x41')][_0x954d('0x45')][0x0];}var _0xfcca0b=_[_0x954d('0xc')](_0x36e081[_0x954d('0x28')],{'firstName':_0x36e081[_0x954d('0x28')][_0x954d('0x35')],'ListId':_0x10328c[_0x954d('0x33')]});_0xfcca0b[_0x36e081[_0x954d('0x28')]['mapKey']]=_0x36e081[_0x954d('0x28')][_0x954d('0x35')];return db[_0x954d('0x2a')][_0x954d('0x46')](_0xfcca0b,{'fields':_0x2c4e3d,'raw':!![]});}})[_0x954d('0x25')](function(_0x283925){_0x4c8d63[_0x954d('0x47')]=_0x283925;if(_0x283925){var _0x25ff05={'ContactId':_0x283925['id'],'FaxAccountId':_0x36e081['account']['id'],'fax':_0x283925[_0x954d('0x29')]};return db[_0x954d('0x48')][_0x954d('0x49')]({'where':{'ContactId':_0x283925['id'],'closed':![],'FaxAccountId':_0x36e081[_0x954d('0x3c')]['id']}})['then'](function(_0x3d537b){if(_0x3d537b){return[_0x3d537b,![]];}return db[_0x954d('0x48')]['create'](_0x25ff05)[_0x954d('0x25')](function(_0x3a866d){return[_0x3a866d,!![]];});});}else{throw new Error(_0x954d('0x4a'));}})['spread'](function(_0x489282,_0x31343b){var _0x47cbc4=_0x489282[_0x954d('0x3f')]({'plain':!![]});if(_0x31343b){if(_0x4c8d63[_0x954d('0x3c')][_0x954d('0x4b')]){_0x4c8d63[_0x954d('0x42')][_0x954d('0x4c')]({'id':0x0,'priority':_0x4c8d63['applications'][_0x954d('0x4d')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x954d('0x4e')});}_0x47cbc4['created']=!![];}else{_0x47cbc4['created']=![];}_0x4c8d63[_0x954d('0x4f')]=_0x47cbc4;return db[_0x954d('0x50')][_0x954d('0x46')]({'body':_0x36e081[_0x954d('0x28')][_0x954d('0x28')],'FaxAccountId':_0x36e081[_0x954d('0x3c')]['id'],'FaxInteractionId':_0x489282['id'],'direction':'in','ContactId':_0x489282[_0x954d('0x51')],'AttachmentId':_0x36e081[_0x954d('0x28')][_0x954d('0x52')]});})[_0x954d('0x25')](function(_0x4f52f6){_0x4c8d63[_0x954d('0x18')]=_0x4f52f6;if(_0x4c8d63[_0x954d('0x4f')][_0x954d('0x53')]){return db[_0x954d('0x54')]['find']({'attributes':['id',_0x954d('0x55')],'where':{'id':_0x4c8d63[_0x954d('0x4f')][_0x954d('0x53')]}})[_0x954d('0x25')](function(_0x3241a2){if(_0x3241a2){_0x4c8d63['applications'][_0x954d('0x56')]({'id':0x0,'priority':0x0,'app':_0x954d('0x57'),'appdata':_0x3241a2['name']+','+(_0x4c8d63[_0x954d('0x3c')][_0x954d('0x58')]||0xa),'interval':_0x954d('0x4e')});}return respondWithRpcPromise(_0x954d('0x59'),_0x954d('0x5a'),_0x4c8d63);});}return respondWithRpcPromise(_0x954d('0x59'),'startRouting',_0x4c8d63);})[_0x954d('0x25')](function(_0x9bc08b){_0x1aba1f(_0x9bc08b);})[_0x954d('0x1b')](function(_0x51d96e){_0x1441c6(_0x2b53bf['error'](0x1f4,_0x51d96e[_0x954d('0x18')]));});});};
\ No newline at end of file
index 59ce4fe..44cc99a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5bb4=['remove','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5bb4,0x148));var _0x45bb=function(_0x5a137a,_0x99ecb9){_0x5a137a=_0x5a137a-0x0;var _0x2f2dfd=_0x5bb4[_0x5a137a];return _0x2f2dfd;};'use strict';var FaxAccountEvents=require(_0x45bb('0x0'));var events=[_0x45bb('0x1'),_0x45bb('0x2'),'update'];function createListener(_0x3da47d,_0x1f8fd9){return function(_0x19a0bf){_0x1f8fd9['emit'](_0x3da47d,_0x19a0bf);};}function removeListener(_0x1f598c,_0x32fde1){return function(){FaxAccountEvents['removeListener'](_0x1f598c,_0x32fde1);};}exports[_0x45bb('0x3')]=function(_0x2ea7ff){for(var _0xa6e4fc=0x0,_0x486223=events[_0x45bb('0x4')];_0xa6e4fc<_0x486223;_0xa6e4fc++){var _0x418009=events[_0xa6e4fc];var _0x4d45c5=createListener(_0x45bb('0x5')+_0x418009,_0x2ea7ff);FaxAccountEvents['on'](_0x418009,_0x4d45c5);}};
\ No newline at end of file
+var _0x072a=['register','length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener'];(function(_0x2256f9,_0x324540){var _0x2bb9f3=function(_0x12a7c2){while(--_0x12a7c2){_0x2256f9['push'](_0x2256f9['shift']());}};_0x2bb9f3(++_0x324540);}(_0x072a,0x6b));var _0xa072=function(_0xd86a32,_0x4d3e6c){_0xd86a32=_0xd86a32-0x0;var _0x4b531e=_0x072a[_0xd86a32];return _0x4b531e;};'use strict';var FaxAccountEvents=require(_0xa072('0x0'));var events=[_0xa072('0x1'),_0xa072('0x2'),'update'];function createListener(_0x2f5a62,_0x1510a4){return function(_0x39b600){_0x1510a4[_0xa072('0x3')](_0x2f5a62,_0x39b600);};}function removeListener(_0x464819,_0x4ea36d){return function(){FaxAccountEvents[_0xa072('0x4')](_0x464819,_0x4ea36d);};}exports[_0xa072('0x5')]=function(_0x344dfc){for(var _0x24cfde=0x0,_0x557ff6=events[_0xa072('0x6')];_0x24cfde<_0x557ff6;_0x24cfde++){var _0x5d42af=events[_0x24cfde];var _0x308be0=createListener(_0xa072('0x7')+_0x5d42af,_0x344dfc);FaxAccountEvents['on'](_0x5d42af,_0x308be0);}};
\ No newline at end of file
index 6e1d6c2..9d59719 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x9bb6f8,_0xddf652){var _0x12d1e2=function(_0x8ed46a){while(--_0x8ed46a){_0x9bb6f8['push'](_0x9bb6f8['shift']());}};_0x12d1e2(++_0xddf652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router;
\ No newline at end of file
+var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router;
\ No newline at end of file
index a6883ac..423e6e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1419=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x3a86e9,_0x58e88e){var _0x1bf002=function(_0x371116){while(--_0x371116){_0x3a86e9['push'](_0x3a86e9['shift']());}};_0x1bf002(++_0x58e88e);}(_0x1419,0x1ed));var _0x9141=function(_0x42afd0,_0x34657a){_0x42afd0=_0x42afd0-0x0;var _0x1aa790=_0x1419[_0x42afd0];return _0x1aa790;};'use strict';var Sequelize=require(_0x9141('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9141('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9141('0x2')],'allowNull':![],'defaultValue':_0x9141('0x3')},'appdata':{'type':Sequelize[_0x9141('0x4')]()},'description':{'type':Sequelize[_0x9141('0x2')]},'interval':{'type':Sequelize[_0x9141('0x2')],'defaultValue':_0x9141('0x5')}};
\ No newline at end of file
+var _0x270d=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3c53ab,_0xa68c67){var _0x475aa6=function(_0x361569){while(--_0x361569){_0x3c53ab['push'](_0x3c53ab['shift']());}};_0x475aa6(++_0xa68c67);}(_0x270d,0x180));var _0xd270=function(_0x3b9ae1,_0x1efdf6){_0x3b9ae1=_0x3b9ae1-0x0;var _0x29367e=_0x270d[_0x3b9ae1];return _0x29367e;};'use strict';var Sequelize=require(_0xd270('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd270('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd270('0x2')],'allowNull':![],'defaultValue':_0xd270('0x3')},'appdata':{'type':Sequelize[_0xd270('0x4')]()},'description':{'type':Sequelize[_0xd270('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd270('0x5')}};
\ No newline at end of file
index f0d2a84..dd4c320 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cd8=['lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack','name','send','map','FaxApplication','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','then','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x935802,_0x35f410){var _0x1fce56=function(_0x410e73){while(--_0x410e73){_0x935802['push'](_0x935802['shift']());}};_0x1fce56(++_0x35f410);}(_0x4cd8,0x87));var _0x84cd=function(_0x3a6b78,_0x2d62be){_0x3a6b78=_0x3a6b78-0x0;var _0x4943d4=_0x4cd8[_0x3a6b78];return _0x4943d4;};'use strict';var emlformat=require(_0x84cd('0x0'));var rimraf=require(_0x84cd('0x1'));var zipdir=require(_0x84cd('0x2'));var jsonpatch=require(_0x84cd('0x3'));var rp=require(_0x84cd('0x4'));var moment=require('moment');var BPromise=require(_0x84cd('0x5'));var Mustache=require(_0x84cd('0x6'));var util=require(_0x84cd('0x7'));var path=require(_0x84cd('0x8'));var sox=require(_0x84cd('0x9'));var csv=require(_0x84cd('0xa'));var ejs=require(_0x84cd('0xb'));var fs=require('fs');var fs_extra=require(_0x84cd('0xc'));var _=require(_0x84cd('0xd'));var squel=require('squel');var crypto=require(_0x84cd('0xe'));var jsforce=require(_0x84cd('0xf'));var deskjs=require(_0x84cd('0x10'));var toCsv=require(_0x84cd('0xa'));var querystring=require('querystring');var Papa=require(_0x84cd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84cd('0x12'));var as=require(_0x84cd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cd('0x14'))(_0x84cd('0x15'));var utils=require(_0x84cd('0x16'));var config=require(_0x84cd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x84cd('0x18'))['db'];function respondWithStatusCode(_0x453f09,_0x13a2e1){_0x13a2e1=_0x13a2e1||0xcc;return function(_0x1f2270){if(_0x1f2270){return _0x453f09[_0x84cd('0x19')](_0x13a2e1);}return _0x453f09[_0x84cd('0x1a')](_0x13a2e1)[_0x84cd('0x1b')]();};}function respondWithResult(_0x3b4a1f,_0x23fc26){_0x23fc26=_0x23fc26||0xc8;return function(_0x43414f){if(_0x43414f){return _0x3b4a1f[_0x84cd('0x1a')](_0x23fc26)[_0x84cd('0x1c')](_0x43414f);}};}function respondWithFilteredResult(_0x273655,_0x34d37c){return function(_0x576eef){if(_0x576eef){var _0x968639=typeof _0x34d37c['offset']===_0x84cd('0x1d')&&typeof _0x34d37c[_0x84cd('0x1e')]===_0x84cd('0x1d');var _0xe58284=_0x576eef[_0x84cd('0x1f')];var _0x53ddff=_0x968639?0x0:_0x34d37c[_0x84cd('0x20')];var _0x2eaabd=_0x968639?_0x576eef['count']:_0x34d37c[_0x84cd('0x20')]+_0x34d37c['limit'];var _0x492490;if(_0x2eaabd>=_0xe58284){_0x2eaabd=_0xe58284;_0x492490=0xc8;}else{_0x492490=0xce;}_0x273655['status'](_0x492490);return _0x273655[_0x84cd('0x21')](_0x84cd('0x22'),_0x53ddff+'-'+_0x2eaabd+'/'+_0xe58284)['json'](_0x576eef);}return null;};}function patchUpdates(_0x4b34a9){return function(_0x3f0a92){try{jsonpatch['apply'](_0x3f0a92,_0x4b34a9,!![]);}catch(_0x47656f){return BPromise[_0x84cd('0x23')](_0x47656f);}return _0x3f0a92[_0x84cd('0x24')]();};}function saveUpdates(_0x3755ec,_0x21661d){return function(_0x5bb9d8){if(_0x5bb9d8){return _0x5bb9d8[_0x84cd('0x25')](_0x3755ec)['then'](function(_0x1fd9b7){return _0x1fd9b7;});}return null;};}function removeEntity(_0x19c663,_0x32667c){return function(_0x465599){if(_0x465599){return _0x465599[_0x84cd('0x26')]()['then'](function(){_0x19c663['status'](0xcc)[_0x84cd('0x1b')]();});}};}function handleEntityNotFound(_0x4ba112,_0x518a80){return function(_0x13bbaf){if(!_0x13bbaf){_0x4ba112[_0x84cd('0x19')](0x194);}return _0x13bbaf;};}function handleError(_0x376107,_0x2ba15b){_0x2ba15b=_0x2ba15b||0x1f4;return function(_0x427aa3){logger[_0x84cd('0x27')](_0x427aa3[_0x84cd('0x28')]);if(_0x427aa3[_0x84cd('0x29')]){delete _0x427aa3[_0x84cd('0x29')];}_0x376107[_0x84cd('0x1a')](_0x2ba15b)[_0x84cd('0x2a')](_0x427aa3);};}exports['index']=function(_0x5eee61,_0x2b775f){var _0x584e83={},_0x13b565={},_0x43f91={'count':0x0,'rows':[]};var _0x2b688c=_[_0x84cd('0x2b')](db[_0x84cd('0x2c')]['rawAttributes'],function(_0x464dcb){return{'name':_0x464dcb['fieldName'],'type':_0x464dcb[_0x84cd('0x2d')][_0x84cd('0x2e')]};});_0x13b565[_0x84cd('0x2f')]=_[_0x84cd('0x2b')](_0x2b688c,_0x84cd('0x29'));_0x13b565[_0x84cd('0x30')]=_[_0x84cd('0x31')](_0x5eee61[_0x84cd('0x30')]);_0x13b565['filters']=_[_0x84cd('0x32')](_0x13b565[_0x84cd('0x2f')],_0x13b565[_0x84cd('0x30')]);_0x584e83['attributes']=_[_0x84cd('0x32')](_0x13b565[_0x84cd('0x2f')],qs[_0x84cd('0x33')](_0x5eee61[_0x84cd('0x30')][_0x84cd('0x33')]));_0x584e83[_0x84cd('0x34')]=_0x584e83['attributes'][_0x84cd('0x35')]?_0x584e83['attributes']:_0x13b565[_0x84cd('0x2f')];if(!_0x5eee61[_0x84cd('0x30')]['hasOwnProperty'](_0x84cd('0x36'))){_0x584e83['limit']=qs[_0x84cd('0x1e')](_0x5eee61[_0x84cd('0x30')][_0x84cd('0x1e')]);_0x584e83[_0x84cd('0x20')]=qs['offset'](_0x5eee61['query'][_0x84cd('0x20')]);}_0x584e83[_0x84cd('0x37')]=qs[_0x84cd('0x38')](_0x5eee61[_0x84cd('0x30')][_0x84cd('0x38')]);_0x584e83[_0x84cd('0x39')]=qs[_0x84cd('0x3a')](_[_0x84cd('0x3b')](_0x5eee61[_0x84cd('0x30')],_0x13b565[_0x84cd('0x3a')]),_0x2b688c);if(_0x5eee61[_0x84cd('0x30')][_0x84cd('0x3c')]){_0x584e83['where']=_[_0x84cd('0x3d')](_0x584e83[_0x84cd('0x39')],{'$or':_[_0x84cd('0x2b')](_0x2b688c,function(_0x58516a){if(_0x58516a[_0x84cd('0x2d')]!=='VIRTUAL'){var _0x2912dc={};_0x2912dc[_0x58516a[_0x84cd('0x29')]]={'$like':'%'+_0x5eee61[_0x84cd('0x30')][_0x84cd('0x3c')]+'%'};return _0x2912dc;}})});}_0x584e83=_['merge']({},_0x584e83,_0x5eee61[_0x84cd('0x3e')]);var _0x271ccd={'where':_0x584e83[_0x84cd('0x39')]};return db['FaxApplication'][_0x84cd('0x1f')](_0x271ccd)[_0x84cd('0x3f')](function(_0x11397d){_0x43f91[_0x84cd('0x1f')]=_0x11397d;if(_0x5eee61[_0x84cd('0x30')][_0x84cd('0x40')]){_0x584e83[_0x84cd('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0x84cd('0x42')](_0x584e83);})[_0x84cd('0x3f')](function(_0x4f0f7d){_0x43f91['rows']=_0x4f0f7d;return _0x43f91;})[_0x84cd('0x3f')](respondWithFilteredResult(_0x2b775f,_0x584e83))['catch'](handleError(_0x2b775f,null));};exports[_0x84cd('0x43')]=function(_0xf6f39f,_0x505436){var _0x408cbb={'raw':!![],'where':{'id':_0xf6f39f[_0x84cd('0x44')]['id']}},_0x2e36bc={};_0x2e36bc[_0x84cd('0x2f')]=_['keys'](db[_0x84cd('0x2c')][_0x84cd('0x45')]);_0x2e36bc['query']=_[_0x84cd('0x31')](_0xf6f39f[_0x84cd('0x30')]);_0x2e36bc[_0x84cd('0x3a')]=_[_0x84cd('0x32')](_0x2e36bc['model'],_0x2e36bc[_0x84cd('0x30')]);_0x408cbb[_0x84cd('0x34')]=_['intersection'](_0x2e36bc[_0x84cd('0x2f')],qs[_0x84cd('0x33')](_0xf6f39f[_0x84cd('0x30')][_0x84cd('0x33')]));_0x408cbb[_0x84cd('0x34')]=_0x408cbb['attributes'][_0x84cd('0x35')]?_0x408cbb['attributes']:_0x2e36bc[_0x84cd('0x2f')];if(_0xf6f39f[_0x84cd('0x30')]['includeAll']){_0x408cbb[_0x84cd('0x41')]=[{'all':!![]}];}_0x408cbb=_['merge']({},_0x408cbb,_0xf6f39f[_0x84cd('0x3e')]);return db[_0x84cd('0x2c')][_0x84cd('0x46')](_0x408cbb)[_0x84cd('0x3f')](handleEntityNotFound(_0x505436,null))[_0x84cd('0x3f')](respondWithResult(_0x505436,null))[_0x84cd('0x47')](handleError(_0x505436,null));};exports[_0x84cd('0x48')]=function(_0x551729,_0x5c68df){return db[_0x84cd('0x2c')]['create'](_0x551729['body'],{})[_0x84cd('0x3f')](respondWithResult(_0x5c68df,0xc9))[_0x84cd('0x47')](handleError(_0x5c68df,null));};exports['update']=function(_0x30f2be,_0x465fc4){if(_0x30f2be['body']['id']){delete _0x30f2be['body']['id'];}return db[_0x84cd('0x2c')]['find']({'where':{'id':_0x30f2be['params']['id']}})[_0x84cd('0x3f')](handleEntityNotFound(_0x465fc4,null))[_0x84cd('0x3f')](saveUpdates(_0x30f2be[_0x84cd('0x49')],null))[_0x84cd('0x3f')](respondWithResult(_0x465fc4,null))['catch'](handleError(_0x465fc4,null));};exports['destroy']=function(_0x3d0797,_0x2fdbff){return db['FaxApplication']['find']({'where':{'id':_0x3d0797[_0x84cd('0x44')]['id']}})[_0x84cd('0x3f')](handleEntityNotFound(_0x2fdbff,null))[_0x84cd('0x3f')](removeEntity(_0x2fdbff,null))[_0x84cd('0x47')](handleError(_0x2fdbff,null));};
\ No newline at end of file
+var _0x2e2c=['body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','FaxApplication','then','includeAll','catch','show','params','filters','intersection','length','include','create'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x2e2c,0x1be));var _0xc2e2=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0x2e2c[_0x3f2228];return _0x285ae4;};'use strict';var emlformat=require(_0xc2e2('0x0'));var rimraf=require(_0xc2e2('0x1'));var zipdir=require(_0xc2e2('0x2'));var jsonpatch=require(_0xc2e2('0x3'));var rp=require(_0xc2e2('0x4'));var moment=require(_0xc2e2('0x5'));var BPromise=require(_0xc2e2('0x6'));var Mustache=require(_0xc2e2('0x7'));var util=require(_0xc2e2('0x8'));var path=require('path');var sox=require(_0xc2e2('0x9'));var csv=require(_0xc2e2('0xa'));var ejs=require(_0xc2e2('0xb'));var fs=require('fs');var fs_extra=require(_0xc2e2('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc2e2('0xd'));var deskjs=require(_0xc2e2('0xe'));var toCsv=require(_0xc2e2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc2e2('0xf'));var authService=require(_0xc2e2('0x10'));var qs=require(_0xc2e2('0x11'));var as=require(_0xc2e2('0x12'));var hardwareService=require(_0xc2e2('0x13'));var logger=require('../../config/logger')(_0xc2e2('0x14'));var utils=require(_0xc2e2('0x15'));var config=require(_0xc2e2('0x16'));var licenseUtil=require(_0xc2e2('0x17'));var db=require(_0xc2e2('0x18'))['db'];function respondWithStatusCode(_0x252f62,_0x45820e){_0x45820e=_0x45820e||0xcc;return function(_0x503c37){if(_0x503c37){return _0x252f62[_0xc2e2('0x19')](_0x45820e);}return _0x252f62[_0xc2e2('0x1a')](_0x45820e)[_0xc2e2('0x1b')]();};}function respondWithResult(_0x5a20e0,_0x4d352e){_0x4d352e=_0x4d352e||0xc8;return function(_0x6b0ad9){if(_0x6b0ad9){return _0x5a20e0['status'](_0x4d352e)[_0xc2e2('0x1c')](_0x6b0ad9);}};}function respondWithFilteredResult(_0x1f9c46,_0x486660){return function(_0x560481){if(_0x560481){var _0x426f04=typeof _0x486660['offset']===_0xc2e2('0x1d')&&typeof _0x486660[_0xc2e2('0x1e')]===_0xc2e2('0x1d');var _0x42212a=_0x560481[_0xc2e2('0x1f')];var _0xfea89=_0x426f04?0x0:_0x486660[_0xc2e2('0x20')];var _0xa13bb8=_0x426f04?_0x560481['count']:_0x486660[_0xc2e2('0x20')]+_0x486660[_0xc2e2('0x1e')];var _0x31a703;if(_0xa13bb8>=_0x42212a){_0xa13bb8=_0x42212a;_0x31a703=0xc8;}else{_0x31a703=0xce;}_0x1f9c46[_0xc2e2('0x1a')](_0x31a703);return _0x1f9c46[_0xc2e2('0x21')](_0xc2e2('0x22'),_0xfea89+'-'+_0xa13bb8+'/'+_0x42212a)[_0xc2e2('0x1c')](_0x560481);}return null;};}function patchUpdates(_0xc6aaf4){return function(_0x53e676){try{jsonpatch[_0xc2e2('0x23')](_0x53e676,_0xc6aaf4,!![]);}catch(_0x4e8082){return BPromise['reject'](_0x4e8082);}return _0x53e676['save']();};}function saveUpdates(_0x398b9d,_0xf05da9){return function(_0xa643b0){if(_0xa643b0){return _0xa643b0[_0xc2e2('0x24')](_0x398b9d)['then'](function(_0x3a4e81){return _0x3a4e81;});}return null;};}function removeEntity(_0x81e030,_0x317935){return function(_0x1095f3){if(_0x1095f3){return _0x1095f3['destroy']()['then'](function(){_0x81e030['status'](0xcc)[_0xc2e2('0x1b')]();});}};}function handleEntityNotFound(_0x4caf6d,_0x34bc59){return function(_0x270c5e){if(!_0x270c5e){_0x4caf6d[_0xc2e2('0x19')](0x194);}return _0x270c5e;};}function handleError(_0x5c66a4,_0x37ea4d){_0x37ea4d=_0x37ea4d||0x1f4;return function(_0x38195b){logger[_0xc2e2('0x25')](_0x38195b[_0xc2e2('0x26')]);if(_0x38195b['name']){delete _0x38195b[_0xc2e2('0x27')];}_0x5c66a4[_0xc2e2('0x1a')](_0x37ea4d)['send'](_0x38195b);};}exports[_0xc2e2('0x28')]=function(_0x32d97f,_0x48d99f){var _0x3b36f8={},_0x200e3e={},_0x13d1e9={'count':0x0,'rows':[]};var _0x593ff9=_[_0xc2e2('0x29')](db['FaxApplication'][_0xc2e2('0x2a')],function(_0x4cc53d){return{'name':_0x4cc53d[_0xc2e2('0x2b')],'type':_0x4cc53d['type'][_0xc2e2('0x2c')]};});_0x200e3e['model']=_[_0xc2e2('0x29')](_0x593ff9,_0xc2e2('0x27'));_0x200e3e[_0xc2e2('0x2d')]=_[_0xc2e2('0x2e')](_0x32d97f[_0xc2e2('0x2d')]);_0x200e3e['filters']=_['intersection'](_0x200e3e['model'],_0x200e3e[_0xc2e2('0x2d')]);_0x3b36f8[_0xc2e2('0x2f')]=_['intersection'](_0x200e3e[_0xc2e2('0x30')],qs['fields'](_0x32d97f[_0xc2e2('0x2d')][_0xc2e2('0x31')]));_0x3b36f8[_0xc2e2('0x2f')]=_0x3b36f8[_0xc2e2('0x2f')]['length']?_0x3b36f8['attributes']:_0x200e3e[_0xc2e2('0x30')];if(!_0x32d97f[_0xc2e2('0x2d')][_0xc2e2('0x32')](_0xc2e2('0x33'))){_0x3b36f8[_0xc2e2('0x1e')]=qs[_0xc2e2('0x1e')](_0x32d97f[_0xc2e2('0x2d')][_0xc2e2('0x1e')]);_0x3b36f8[_0xc2e2('0x20')]=qs[_0xc2e2('0x20')](_0x32d97f[_0xc2e2('0x2d')][_0xc2e2('0x20')]);}_0x3b36f8[_0xc2e2('0x34')]=qs['sort'](_0x32d97f[_0xc2e2('0x2d')][_0xc2e2('0x35')]);_0x3b36f8[_0xc2e2('0x36')]=qs['filters'](_[_0xc2e2('0x37')](_0x32d97f[_0xc2e2('0x2d')],_0x200e3e['filters']),_0x593ff9);if(_0x32d97f['query'][_0xc2e2('0x38')]){_0x3b36f8[_0xc2e2('0x36')]=_['merge'](_0x3b36f8['where'],{'$or':_[_0xc2e2('0x29')](_0x593ff9,function(_0x3b46f3){if(_0x3b46f3[_0xc2e2('0x39')]!==_0xc2e2('0x3a')){var _0x55da9a={};_0x55da9a[_0x3b46f3['name']]={'$like':'%'+_0x32d97f[_0xc2e2('0x2d')][_0xc2e2('0x38')]+'%'};return _0x55da9a;}})});}_0x3b36f8=_[_0xc2e2('0x3b')]({},_0x3b36f8,_0x32d97f[_0xc2e2('0x3c')]);var _0x45e834={'where':_0x3b36f8[_0xc2e2('0x36')]};return db[_0xc2e2('0x3d')][_0xc2e2('0x1f')](_0x45e834)[_0xc2e2('0x3e')](function(_0x5e9095){_0x13d1e9[_0xc2e2('0x1f')]=_0x5e9095;if(_0x32d97f['query'][_0xc2e2('0x3f')]){_0x3b36f8['include']=[{'all':!![]}];}return db[_0xc2e2('0x3d')]['findAll'](_0x3b36f8);})['then'](function(_0x694c3){_0x13d1e9['rows']=_0x694c3;return _0x13d1e9;})[_0xc2e2('0x3e')](respondWithFilteredResult(_0x48d99f,_0x3b36f8))[_0xc2e2('0x40')](handleError(_0x48d99f,null));};exports[_0xc2e2('0x41')]=function(_0x497add,_0x2ffcf0){var _0x3ada4a={'raw':!![],'where':{'id':_0x497add[_0xc2e2('0x42')]['id']}},_0x4940c1={};_0x4940c1[_0xc2e2('0x30')]=_[_0xc2e2('0x2e')](db['FaxApplication'][_0xc2e2('0x2a')]);_0x4940c1['query']=_[_0xc2e2('0x2e')](_0x497add[_0xc2e2('0x2d')]);_0x4940c1[_0xc2e2('0x43')]=_[_0xc2e2('0x44')](_0x4940c1['model'],_0x4940c1[_0xc2e2('0x2d')]);_0x3ada4a['attributes']=_[_0xc2e2('0x44')](_0x4940c1[_0xc2e2('0x30')],qs['fields'](_0x497add['query'][_0xc2e2('0x31')]));_0x3ada4a[_0xc2e2('0x2f')]=_0x3ada4a[_0xc2e2('0x2f')][_0xc2e2('0x45')]?_0x3ada4a[_0xc2e2('0x2f')]:_0x4940c1[_0xc2e2('0x30')];if(_0x497add[_0xc2e2('0x2d')][_0xc2e2('0x3f')]){_0x3ada4a[_0xc2e2('0x46')]=[{'all':!![]}];}_0x3ada4a=_[_0xc2e2('0x3b')]({},_0x3ada4a,_0x497add[_0xc2e2('0x3c')]);return db[_0xc2e2('0x3d')]['find'](_0x3ada4a)[_0xc2e2('0x3e')](handleEntityNotFound(_0x2ffcf0,null))[_0xc2e2('0x3e')](respondWithResult(_0x2ffcf0,null))[_0xc2e2('0x40')](handleError(_0x2ffcf0,null));};exports[_0xc2e2('0x47')]=function(_0x51ad77,_0x4fef6b){return db[_0xc2e2('0x3d')][_0xc2e2('0x47')](_0x51ad77['body'],{})[_0xc2e2('0x3e')](respondWithResult(_0x4fef6b,0xc9))[_0xc2e2('0x40')](handleError(_0x4fef6b,null));};exports['update']=function(_0x502e01,_0x4c94d6){if(_0x502e01[_0xc2e2('0x48')]['id']){delete _0x502e01[_0xc2e2('0x48')]['id'];}return db[_0xc2e2('0x3d')][_0xc2e2('0x49')]({'where':{'id':_0x502e01['params']['id']}})[_0xc2e2('0x3e')](handleEntityNotFound(_0x4c94d6,null))[_0xc2e2('0x3e')](saveUpdates(_0x502e01[_0xc2e2('0x48')],null))[_0xc2e2('0x3e')](respondWithResult(_0x4c94d6,null))['catch'](handleError(_0x4c94d6,null));};exports['destroy']=function(_0x569b17,_0x3c6478){return db[_0xc2e2('0x3d')][_0xc2e2('0x49')]({'where':{'id':_0x569b17[_0xc2e2('0x42')]['id']}})[_0xc2e2('0x3e')](handleEntityNotFound(_0x3c6478,null))['then'](removeEntity(_0x3c6478,null))[_0xc2e2('0x40')](handleError(_0x3c6478,null));};
\ No newline at end of file
index b8c97e0..ef60931 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8731=['moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x25c484,_0x2a95af){var _0x310e64=function(_0x109439){while(--_0x109439){_0x25c484['push'](_0x25c484['shift']());}};_0x310e64(++_0x2a95af);}(_0x8731,0x193));var _0x1873=function(_0x3c9d03,_0x377b71){_0x3c9d03=_0x3c9d03-0x0;var _0x479cf5=_0x8731[_0x3c9d03];return _0x479cf5;};'use strict';var _=require('lodash');var util=require(_0x1873('0x0'));var logger=require(_0x1873('0x1'))(_0x1873('0x2'));var moment=require(_0x1873('0x3'));var BPromise=require(_0x1873('0x4'));var rp=require(_0x1873('0x5'));var fs=require('fs');var path=require(_0x1873('0x6'));var rimraf=require('rimraf');var config=require(_0x1873('0x7'));var attributes=require(_0x1873('0x8'));module['exports']=function(_0x167c04,_0x1bf542){return _0x167c04[_0x1873('0x9')](_0x1873('0xa'),attributes,{'tableName':_0x1873('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1873('0xc'),'collate':_0x1873('0xd')});};
\ No newline at end of file
+var _0xce99=['util','../../config/logger','api','bluebird','../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x36bbf4,_0x3fd8ec){var _0x379367=function(_0x22197f){while(--_0x22197f){_0x36bbf4['push'](_0x36bbf4['shift']());}};_0x379367(++_0x3fd8ec);}(_0xce99,0x118));var _0x9ce9=function(_0x19b161,_0x875a08){_0x19b161=_0x19b161-0x0;var _0x23dbe5=_0xce99[_0x19b161];return _0x23dbe5;};'use strict';var _=require('lodash');var util=require(_0x9ce9('0x0'));var logger=require(_0x9ce9('0x1'))(_0x9ce9('0x2'));var moment=require('moment');var BPromise=require(_0x9ce9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ce9('0x4'));var attributes=require('./faxApplication.attributes');module[_0x9ce9('0x5')]=function(_0x28ec4d,_0x485203){return _0x28ec4d[_0x9ce9('0x6')]('FaxApplication',attributes,{'tableName':_0x9ce9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ce9('0x8'),'collate':_0x9ce9('0x9')});};
\ No newline at end of file
index c3e4e53..95ae58b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c00=['info','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x149105,_0x43dded){var _0x327a27=function(_0x3911b0){while(--_0x3911b0){_0x149105['push'](_0x149105['shift']());}};_0x327a27(++_0x43dded);}(_0x1c00,0x137));var _0x01c0=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x1c00[_0x174ef5];return _0x1cc379;};'use strict';var _=require('lodash');var util=require(_0x01c0('0x0'));var moment=require(_0x01c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x01c0('0x2'));var fs=require('fs');var Redis=require(_0x01c0('0x3'));var db=require(_0x01c0('0x4'))['db'];var utils=require(_0x01c0('0x5'));var logger=require(_0x01c0('0x6'))(_0x01c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x01c0('0x8'));var client=jayson['client'][_0x01c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59a0d8,_0x3f060c,_0x25984d){return new BPromise(function(_0x4515db,_0xe97c2f){return client[_0x01c0('0xa')](_0x59a0d8,_0x25984d)[_0x01c0('0xb')](function(_0x474a3e){logger['info'](_0x01c0('0xc'),_0x3f060c,_0x01c0('0xd'));logger[_0x01c0('0xe')](_0x01c0('0xf'),_0x3f060c,_0x01c0('0xd'),JSON['stringify'](_0x474a3e));if(_0x474a3e[_0x01c0('0x10')]){if(_0x474a3e[_0x01c0('0x10')][_0x01c0('0x11')]===0x1f4){logger[_0x01c0('0x10')]('FaxApplication,\x20%s,\x20%s',_0x3f060c,_0x474a3e[_0x01c0('0x10')][_0x01c0('0x12')]);return _0xe97c2f(_0x474a3e[_0x01c0('0x10')]['message']);}logger[_0x01c0('0x10')](_0x01c0('0xc'),_0x3f060c,_0x474a3e['error'][_0x01c0('0x12')]);return _0x4515db(_0x474a3e[_0x01c0('0x10')][_0x01c0('0x12')]);}else{logger[_0x01c0('0x13')]('FaxApplication,\x20%s,\x20%s',_0x3f060c,_0x01c0('0xd'));_0x4515db(_0x474a3e[_0x01c0('0x14')][_0x01c0('0x12')]);}})[_0x01c0('0x15')](function(_0x35dd2b){logger[_0x01c0('0x10')](_0x01c0('0xc'),_0x3f060c,_0x35dd2b);_0xe97c2f(_0x35dd2b);});});}exports[_0x01c0('0x16')]=function(_0x40df35){var _0x273d81=this;return new Promise(function(_0x254a55,_0x33bb88){return db[_0x01c0('0x17')]['update'](_0x40df35[_0x01c0('0x18')],{'raw':_0x40df35[_0x01c0('0x19')]?_0x40df35[_0x01c0('0x19')][_0x01c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40df35['options']?_0x40df35[_0x01c0('0x19')]['where']||null:null,'attributes':_0x40df35[_0x01c0('0x19')]?_0x40df35[_0x01c0('0x19')][_0x01c0('0x1b')]||null:null,'limit':_0x40df35[_0x01c0('0x19')]?_0x40df35[_0x01c0('0x19')][_0x01c0('0x1c')]||null:null})['then'](function(_0x2be004){logger[_0x01c0('0x13')](_0x01c0('0x16'),_0x40df35);logger[_0x01c0('0xe')](_0x01c0('0x16'),_0x40df35,JSON[_0x01c0('0x1d')](_0x2be004));_0x254a55(_0x2be004);})[_0x01c0('0x15')](function(_0x5756e3){logger[_0x01c0('0x10')]('UpdateFaxApplication',_0x5756e3[_0x01c0('0x12')],_0x40df35);_0x33bb88(_0x273d81[_0x01c0('0x10')](0x1f4,_0x5756e3['message']));});});};
\ No newline at end of file
+var _0x0f83=['request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','code','error','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0xde3c47,_0x2e3cf7){var _0x2fb6ad=function(_0xd5ee14){while(--_0xd5ee14){_0xde3c47['push'](_0xde3c47['shift']());}};_0x2fb6ad(++_0x2e3cf7);}(_0x0f83,0x66));var _0x30f8=function(_0x282d3c,_0xbf90b){_0x282d3c=_0x282d3c-0x0;var _0x50b594=_0x0f83[_0x282d3c];return _0x50b594;};'use strict';var _=require('lodash');var util=require(_0x30f8('0x0'));var moment=require(_0x30f8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30f8('0x2'));var db=require(_0x30f8('0x3'))['db'];var utils=require(_0x30f8('0x4'));var logger=require(_0x30f8('0x5'))(_0x30f8('0x6'));var config=require('../../config/environment');var jayson=require(_0x30f8('0x7'));var client=jayson[_0x30f8('0x8')][_0x30f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23836c,_0x3a6feb,_0x18627b){return new BPromise(function(_0x2572a1,_0x3047c2){return client[_0x30f8('0xa')](_0x23836c,_0x18627b)[_0x30f8('0xb')](function(_0x410480){logger[_0x30f8('0xc')](_0x30f8('0xd'),_0x3a6feb,_0x30f8('0xe'));logger['debug'](_0x30f8('0xf'),_0x3a6feb,_0x30f8('0xe'),JSON['stringify'](_0x410480));if(_0x410480['error']){if(_0x410480['error'][_0x30f8('0x10')]===0x1f4){logger['error'](_0x30f8('0xd'),_0x3a6feb,_0x410480[_0x30f8('0x11')][_0x30f8('0x12')]);return _0x3047c2(_0x410480['error'][_0x30f8('0x12')]);}logger['error'](_0x30f8('0xd'),_0x3a6feb,_0x410480[_0x30f8('0x11')][_0x30f8('0x12')]);return _0x2572a1(_0x410480['error'][_0x30f8('0x12')]);}else{logger['info'](_0x30f8('0xd'),_0x3a6feb,'request\x20sent');_0x2572a1(_0x410480['result'][_0x30f8('0x12')]);}})[_0x30f8('0x13')](function(_0x28ced5){logger['error'](_0x30f8('0xd'),_0x3a6feb,_0x28ced5);_0x3047c2(_0x28ced5);});});}exports[_0x30f8('0x14')]=function(_0x210ce3){var _0x50a7cc=this;return new Promise(function(_0x29f91e,_0x5e2e9e){return db[_0x30f8('0x15')][_0x30f8('0x16')](_0x210ce3[_0x30f8('0x17')],{'raw':_0x210ce3['options']?_0x210ce3[_0x30f8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210ce3[_0x30f8('0x18')]?_0x210ce3[_0x30f8('0x18')][_0x30f8('0x19')]||null:null,'attributes':_0x210ce3[_0x30f8('0x18')]?_0x210ce3[_0x30f8('0x18')][_0x30f8('0x1a')]||null:null,'limit':_0x210ce3['options']?_0x210ce3['options'][_0x30f8('0x1b')]||null:null})[_0x30f8('0xb')](function(_0x5cb2b2){logger['info'](_0x30f8('0x14'),_0x210ce3);logger['debug'](_0x30f8('0x14'),_0x210ce3,JSON[_0x30f8('0x1c')](_0x5cb2b2));_0x29f91e(_0x5cb2b2);})[_0x30f8('0x13')](function(_0x3378f7){logger['error'](_0x30f8('0x14'),_0x3378f7[_0x30f8('0x12')],_0x210ce3);_0x5e2e9e(_0x50a7cc['error'](0x1f4,_0x3378f7[_0x30f8('0x12')]));});});};
\ No newline at end of file
index bc3c0c8..2fc9ddd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x4f2a8d,_0x4a3491){var _0x459616=function(_0x2759d5){while(--_0x2759d5){_0x4f2a8d['push'](_0x4f2a8d['shift']());}};_0x459616(++_0x4a3491);}(_0xd4a2,0x173));var _0x2d4a=function(_0x5c0754,_0x28b3ed){_0x5c0754=_0x5c0754-0x0;var _0x49b406=_0xd4a2[_0x5c0754];return _0x49b406;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router;
\ No newline at end of file
+var _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x28a465,_0x558c2c){var _0x258386=function(_0x384486){while(--_0x384486){_0x28a465['push'](_0x28a465['shift']());}};_0x258386(++_0x558c2c);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x1eba[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router;
\ No newline at end of file
index 969dc86..dba004f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x978b=['ENUM','sequelize','DATE','STRING','out'];(function(_0x187924,_0x17e8e1){var _0x434cff=function(_0xf187eb){while(--_0xf187eb){_0x187924['push'](_0x187924['shift']());}};_0x434cff(++_0x17e8e1);}(_0x978b,0x1e6));var _0xb978=function(_0x15d69f,_0x2f39bf){_0x15d69f=_0x15d69f-0x0;var _0x2df9ff=_0x978b[_0x15d69f];return _0x2df9ff;};'use strict';var Sequelize=require(_0xb978('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb978('0x1')]},'disposition':{'type':Sequelize[_0xb978('0x2')]},'secondDisposition':{'type':Sequelize[_0xb978('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb978('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb978('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb978('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb978('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xb978('0x4')]('in',_0xb978('0x3')),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
+var _0xfece=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfece,0x102));var _0xefec=function(_0xc089c7,_0x139cea){_0xc089c7=_0xc089c7-0x0;var _0x325fb3=_0xfece[_0xc089c7];return _0x325fb3;};'use strict';var Sequelize=require(_0xefec('0x0'));module[_0xefec('0x1')]={'closed':{'type':Sequelize[_0xefec('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xefec('0x3')]},'disposition':{'type':Sequelize[_0xefec('0x4')]},'secondDisposition':{'type':Sequelize[_0xefec('0x4')]},'thirdDisposition':{'type':Sequelize[_0xefec('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xefec('0x3')]},'fax':{'type':Sequelize[_0xefec('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xefec('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xefec('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xefec('0x6')),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
index ac548f2..172e093 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2246=['sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','zip-dir','moment','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','filters','intersection','attributes','model','fields','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2246,0x15a));var _0x6224=function(_0x443111,_0x3c94ae){_0x443111=_0x443111-0x0;var _0x3056c5=_0x2246[_0x443111];return _0x3056c5;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x6224('0x0'));var moment=require(_0x6224('0x1'));var BPromise=require('bluebird');var util=require(_0x6224('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x6224('0x3'));var Redis=require(_0x6224('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x6224('0x5'));var logger=require(_0x6224('0x6'))(_0x6224('0x7'));var config=require(_0x6224('0x8'));var db=require('../../mysqldb')['db'];config[_0x6224('0x9')]=_[_0x6224('0xa')](config[_0x6224('0x9')],{'host':_0x6224('0xb'),'port':0x18eb});var socket=require(_0x6224('0xc'))(new Redis(config[_0x6224('0x9')]));require('./faxInteraction.socket')[_0x6224('0xd')](socket);function respondWithStatusCode(_0x3974cf,_0x1202fb){_0x1202fb=_0x1202fb||0xcc;return function(_0x70eb19){if(_0x70eb19){return _0x3974cf[_0x6224('0xe')](_0x1202fb);}return _0x3974cf[_0x6224('0xf')](_0x1202fb)[_0x6224('0x10')]();};}function respondWithResult(_0x135976,_0x27da76){_0x27da76=_0x27da76||0xc8;return function(_0x188eed){if(_0x188eed){return _0x135976[_0x6224('0xf')](_0x27da76)[_0x6224('0x11')](_0x188eed);}};}function respondWithFilteredResult(_0x5e49ee,_0x5a2043){return function(_0x1a622c){if(_0x1a622c){var _0x9cee90=typeof _0x5a2043[_0x6224('0x12')]===_0x6224('0x13')&&typeof _0x5a2043[_0x6224('0x14')]===_0x6224('0x13');var _0x122bb1=_0x1a622c[_0x6224('0x15')];var _0x2db82c=_0x9cee90?0x0:_0x5a2043['offset'];var _0x228b9c=_0x9cee90?_0x1a622c['count']:_0x5a2043['offset']+_0x5a2043[_0x6224('0x14')];var _0x51038d;if(_0x228b9c>=_0x122bb1){_0x228b9c=_0x122bb1;_0x51038d=0xc8;}else{_0x51038d=0xce;}_0x5e49ee[_0x6224('0xf')](_0x51038d);return _0x5e49ee['set'](_0x6224('0x16'),_0x2db82c+'-'+_0x228b9c+'/'+_0x122bb1)[_0x6224('0x11')](_0x1a622c);}return null;};}function saveUpdates(_0x1bd32a){return function(_0xf2f820){if(_0xf2f820){return _0xf2f820[_0x6224('0x17')](_0x1bd32a)[_0x6224('0x18')](function(_0x5ef4d8){return _0x5ef4d8;});}return null;};}function removeEntity(_0x558fed){return function(_0x45d7a7){if(_0x45d7a7){return _0x45d7a7[_0x6224('0x19')]()['then'](function(){_0x558fed[_0x6224('0xf')](0xcc)[_0x6224('0x10')]();});}};}function handleEntityNotFound(_0xe379dd){return function(_0x272f46){if(!_0x272f46){_0xe379dd[_0x6224('0xe')](0x194);}return _0x272f46;};}function handleError(_0x29016d,_0x51826b){_0x51826b=_0x51826b||0x1f4;return function(_0x534bbb){logger['error'](_0x534bbb[_0x6224('0x1a')]);if(_0x534bbb['name']){delete _0x534bbb[_0x6224('0x1b')];}_0x29016d[_0x6224('0xf')](_0x51826b)[_0x6224('0x1c')](_0x534bbb);};}exports[_0x6224('0x1d')]=function(_0x3f2118,_0x36090c){var _0x44da6a={};var _0x25192f=_[_0x6224('0x1e')](db[_0x6224('0x1f')][_0x6224('0x20')],function(_0x1203bd){return{'name':_0x1203bd[_0x6224('0x21')],'type':_0x1203bd[_0x6224('0x22')][_0x6224('0x23')]};});_0x44da6a=qs[_0x6224('0x24')](_0x25192f,_0x3f2118);return interaction[_0x6224('0x25')](_0x6224('0x26'),_0x3f2118[_0x6224('0x27')],_0x3f2118[_0x6224('0x28')],_0x44da6a,_0x25192f)[_0x6224('0x18')](respondWithFilteredResult(_0x36090c,_0x44da6a))[_0x6224('0x29')](handleError(_0x36090c,null));};exports[_0x6224('0x2a')]=function(_0x4d7d26,_0x5d22af){var _0x57997e={'raw':![],'where':{'id':_0x4d7d26[_0x6224('0x2b')]['id']}},_0x4b035e={};_0x4b035e['model']=_[_0x6224('0x2c')](db[_0x6224('0x1f')][_0x6224('0x20')]);_0x4b035e[_0x6224('0x27')]=_[_0x6224('0x2c')](_0x4d7d26[_0x6224('0x27')]);_0x4b035e[_0x6224('0x2d')]=_[_0x6224('0x2e')](_0x4b035e['model'],_0x4b035e[_0x6224('0x27')]);_0x57997e[_0x6224('0x2f')]=_[_0x6224('0x2e')](_0x4b035e[_0x6224('0x30')],qs[_0x6224('0x31')](_0x4d7d26[_0x6224('0x27')]['fields']));_0x57997e[_0x6224('0x2f')]=_0x57997e['attributes']['length']?_0x57997e[_0x6224('0x2f')]:_0x4b035e['model'];if(_0x4d7d26[_0x6224('0x27')]['includeAll']){_0x57997e[_0x6224('0x32')]=[{'all':!![]}];}_0x57997e=_[_0x6224('0x33')]({},_0x57997e,_0x4d7d26[_0x6224('0x34')]);return db[_0x6224('0x1f')][_0x6224('0x35')](_0x57997e)[_0x6224('0x18')](handleEntityNotFound(_0x5d22af,null))[_0x6224('0x18')](respondWithResult(_0x5d22af,null))[_0x6224('0x29')](handleError(_0x5d22af,null));};exports[_0x6224('0x36')]=function(_0x47c8af,_0x52920c){return db[_0x6224('0x1f')][_0x6224('0x36')](_0x47c8af[_0x6224('0x37')],{})[_0x6224('0x18')](respondWithResult(_0x52920c,0xc9))[_0x6224('0x29')](handleError(_0x52920c,null));};exports[_0x6224('0x17')]=function(_0xe2e8b6,_0x4d5830){if(_0xe2e8b6[_0x6224('0x37')]['id']){delete _0xe2e8b6['body']['id'];}return db[_0x6224('0x1f')][_0x6224('0x35')]({'where':{'id':_0xe2e8b6[_0x6224('0x2b')]['id']}})[_0x6224('0x18')](handleEntityNotFound(_0x4d5830,null))[_0x6224('0x18')](saveUpdates(_0xe2e8b6[_0x6224('0x37')],null))[_0x6224('0x18')](respondWithResult(_0x4d5830,null))['catch'](handleError(_0x4d5830,null));};exports[_0x6224('0x19')]=function(_0x4c617a,_0x45eba7){return db[_0x6224('0x1f')][_0x6224('0x35')]({'where':{'id':_0x4c617a['params']['id']}})[_0x6224('0x18')](handleEntityNotFound(_0x45eba7,null))[_0x6224('0x18')](removeEntity(_0x45eba7,null))[_0x6224('0x29')](handleError(_0x45eba7,null));};exports[_0x6224('0x38')]=function(_0xb16ec7,_0x3fd0e6){return db[_0x6224('0x1f')]['describe']()[_0x6224('0x18')](respondWithResult(_0x3fd0e6,null))['catch'](handleError(_0x3fd0e6,null));};exports[_0x6224('0x39')]=function(_0xd39e38,_0x2746a6){return db[_0x6224('0x3a')][_0x6224('0x35')]({'where':{'id':_0xd39e38[_0x6224('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2746a6,null))['then'](function(_0x16de22){if(_0x16de22){return _0x16de22[_0x6224('0x39')](_0xd39e38['body'][_0x6224('0x3b')],_[_0x6224('0x3c')](_0xd39e38['body'],[_0x6224('0x3b'),'id'])||{});}})[_0x6224('0x18')](respondWithResult(_0x2746a6,null))['catch'](handleError(_0x2746a6,null));};exports[_0x6224('0x3d')]=function(_0x5da8b3,_0x2883e2){var _0x4bc40c={'raw':![],'where':{}};var _0x52bbfe={};var _0x2827d0={'count':0x0,'rows':[]};return db[_0x6224('0x1f')][_0x6224('0x3e')]({'where':{'id':_0x5da8b3[_0x6224('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2883e2,null))[_0x6224('0x18')](function(_0x156b23){if(_0x156b23){_0x52bbfe[_0x6224('0x30')]=_['keys'](db[_0x6224('0x3a')][_0x6224('0x20')]);_0x52bbfe['query']=_[_0x6224('0x2c')](_0x5da8b3[_0x6224('0x27')]);_0x52bbfe[_0x6224('0x2d')]=_[_0x6224('0x2e')](_0x52bbfe[_0x6224('0x30')],_0x52bbfe['query']);_0x4bc40c['attributes']=_[_0x6224('0x2e')](_0x52bbfe[_0x6224('0x30')],qs[_0x6224('0x31')](_0x5da8b3[_0x6224('0x27')][_0x6224('0x31')]));_0x4bc40c['attributes']=_0x4bc40c[_0x6224('0x2f')][_0x6224('0x3f')]?_0x4bc40c[_0x6224('0x2f')]:_0x52bbfe[_0x6224('0x30')];if(!_0x5da8b3[_0x6224('0x27')][_0x6224('0x40')](_0x6224('0x41'))){_0x4bc40c[_0x6224('0x14')]=qs['limit'](_0x5da8b3[_0x6224('0x27')]['limit']);_0x4bc40c['offset']=qs['offset'](_0x5da8b3[_0x6224('0x27')]['offset']);}_0x4bc40c['order']=qs[_0x6224('0x42')](_0x5da8b3[_0x6224('0x27')]['sort']);_0x4bc40c[_0x6224('0x43')]=qs[_0x6224('0x2d')](_[_0x6224('0x44')](_0x5da8b3[_0x6224('0x27')],_0x52bbfe[_0x6224('0x2d')]));_0x4bc40c['where']['FaxInteractionId']=_0x156b23['id'];if(_0x5da8b3[_0x6224('0x27')]['filter']){_0x4bc40c[_0x6224('0x43')]=_[_0x6224('0x33')](_0x4bc40c[_0x6224('0x43')],{'$or':_[_0x6224('0x1e')](_0x4bc40c['attributes'],function(_0x2d7dbb){var _0x1991d4={};_0x1991d4[_0x2d7dbb]={'$like':'%'+_0x5da8b3[_0x6224('0x27')][_0x6224('0x45')]+'%'};return _0x1991d4;})});}if(_0x5da8b3[_0x6224('0x27')][_0x6224('0x46')]){var _0x23f043=_0x5da8b3['query'][_0x6224('0x46')][_0x6224('0x47')](',');var _0x4d615e={};_0x4d615e[_0x23f043[0x0]]={'$gte':moment(_0x23f043[0x1])[_0x6224('0x48')](_0x6224('0x49'))};_0x4bc40c[_0x6224('0x43')]=_[_0x6224('0x33')](_0x4bc40c['where'],_0x4d615e);}_0x4bc40c=_[_0x6224('0x33')]({},_0x4bc40c,_0x5da8b3['options']);return db[_0x6224('0x3a')][_0x6224('0x15')]({'where':_0x4bc40c[_0x6224('0x43')]})[_0x6224('0x18')](function(_0xac122a){_0x2827d0[_0x6224('0x15')]=_0xac122a;if(_0x5da8b3[_0x6224('0x27')][_0x6224('0x4a')]){_0x4bc40c['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4bc40c);})['then'](function(_0x17bc0d){_0x2827d0['rows']=_0x17bc0d;return _0x2827d0;});}})[_0x6224('0x18')](respondWithFilteredResult(_0x2883e2,_0x4bc40c))[_0x6224('0x29')](handleError(_0x2883e2,null));};exports[_0x6224('0x4b')]=function(_0x3c4ff0,_0x50e757){return db['FaxInteraction']['find']({'where':{'id':_0x3c4ff0[_0x6224('0x2b')]['id']}})[_0x6224('0x18')](handleEntityNotFound(_0x50e757,null))[_0x6224('0x18')](function(_0x199539){if(_0x199539){return _0x199539[_0x6224('0x4c')](_0x3c4ff0[_0x6224('0x37')][_0x6224('0x3b')],_[_0x6224('0x3c')](_0x3c4ff0[_0x6224('0x37')],[_0x6224('0x3b'),'id'])||{})[_0x6224('0x4d')](function(){return db[_0x6224('0x4e')][_0x6224('0x25')]({'attributes':['id',_0x6224('0x1b'),_0x6224('0x4f')],'where':{'id':_0x3c4ff0['body'][_0x6224('0x3b')]}});})[_0x6224('0x18')](function(_0x4786f4){socket[_0x6224('0x50')](_0x6224('0x51'),{'id':Number(_0x3c4ff0[_0x6224('0x2b')]['id']),'tags':_0x4786f4||[]});return{'id':Number(_0x3c4ff0[_0x6224('0x2b')]['id']),'tags':_0x4786f4||[]};});}})[_0x6224('0x18')](respondWithResult(_0x50e757,null))['catch'](handleError(_0x50e757,null));};exports['removeTags']=function(_0x3ab83e,_0x1c703a){return db['FaxInteraction']['find']({'where':{'id':_0x3ab83e[_0x6224('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1c703a,null))[_0x6224('0x18')](function(_0x420159){if(_0x420159){return _0x420159['removeTags'](_0x3ab83e[_0x6224('0x27')]['ids']);}})['then'](respondWithStatusCode(_0x1c703a,null))[_0x6224('0x29')](handleError(_0x1c703a,null));};exports[_0x6224('0x52')]=function(_0x5075e0,_0x2076bc){var _0x38540e=moment()[_0x6224('0x53')]()[_0x6224('0x54')]();var _0x106ecc=path[_0x6224('0x55')](config[_0x6224('0x56')],_0x6224('0x57'),_0x6224('0x58'),'tmp');var _0x12977e=path[_0x6224('0x55')](config[_0x6224('0x56')],_0x6224('0x57'),_0x6224('0x58'),_0x6224('0x59'));var _0x4cf2d5=path[_0x6224('0x55')](_0x106ecc,_0x38540e);var _0x25dd3f=util[_0x6224('0x48')](_0x6224('0x5a'),_0x5075e0[_0x6224('0x2b')]['id'],_0x38540e);var _0x4131dd=path[_0x6224('0x55')](_0x106ecc,_0x25dd3f);var _0x53bfda=[];_0x53bfda[_0x6224('0x5b')]({'model':db[_0x6224('0x5c')],'as':_0x6224('0x5c'),'raw':!![]});var _0x184a1d=[{'model':db[_0x6224('0x3a')],'as':_0x6224('0x5d'),'attributes':['id',_0x6224('0x37'),'createdAt'],'include':_0x53bfda}];return db[_0x6224('0x1f')][_0x6224('0x35')]({'where':{'id':_0x5075e0['params']['id']},'include':_0x184a1d})[_0x6224('0x18')](handleEntityNotFound(_0x2076bc,null))[_0x6224('0x18')](function(_0x204080){if(_0x204080&&_0x204080[_0x6224('0x5d')]){var _0x54aec4=_0x204080[_0x6224('0x5e')]({'plain':!![]});fs[_0x6224('0x5f')](_0x4cf2d5);for(var _0x5e8194=0x0;_0x5e8194<_0x54aec4['Messages'][_0x6224('0x3f')];_0x5e8194++){var _0x1f5e94=_0x54aec4['Messages'][_0x5e8194][_0x6224('0x5c')];if(_0x1f5e94){var _0x1c9957=path[_0x6224('0x55')](_0x12977e,_0x1f5e94[_0x6224('0x60')]);if(fs[_0x6224('0x61')](_0x1c9957)){fs[_0x6224('0x62')](_0x1c9957)['pipe'](fs[_0x6224('0x63')](path[_0x6224('0x55')](_0x4cf2d5,_0x1f5e94['basename'])));}}}return BPromise['resolve']()[_0x6224('0x18')](function(){return new BPromise(function(_0x47d34a,_0x2c47db){zipdir(_0x4cf2d5,{'saveTo':_0x4131dd},function(_0x3faa2f,_0x2cd50e){if(_0x3faa2f)return _0x2c47db(_0x3faa2f);return _0x47d34a(_0x2cd50e);});})[_0x6224('0x18')](function(){return new BPromise(function(_0x2880c0,_0x4af839){rimraf(_0x4cf2d5,function(_0x43270f){if(_0x43270f)_0x4af839(_0x43270f);return _0x2880c0();});});})[_0x6224('0x18')](function(){return _0x2076bc[_0x6224('0x52')](_0x4131dd,_0x25dd3f,function(_0x1e81df){if(_0x1e81df){console[_0x6224('0x64')](_0x6224('0x65'),_0x1e81df);}else{fs[_0x6224('0x66')](_0x4131dd);}});});});}else{return _0x2076bc['sendStatus'](0xc8);}})[_0x6224('0x29')](handleError(_0x2076bc,null));};
\ No newline at end of file
+var _0x6cd4=['mkdirSync','existsSync','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','stack','name','send','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','query','user','catch','params','model','keys','rawAttributes','filters','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','addMessage','FaxMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','sort','where','pick','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get'];(function(_0x3979e3,_0xb2f138){var _0x5e7c9e=function(_0x23ed7a){while(--_0x23ed7a){_0x3979e3['push'](_0x3979e3['shift']());}};_0x5e7c9e(++_0xb2f138);}(_0x6cd4,0xd0));var _0x46cd=function(_0x4e57ae,_0x18fd92){_0x4e57ae=_0x4e57ae-0x0;var _0xe22f92=_0x6cd4[_0x4e57ae];return _0xe22f92;};'use strict';var rimraf=require(_0x46cd('0x0'));var zipdir=require(_0x46cd('0x1'));var moment=require(_0x46cd('0x2'));var BPromise=require(_0x46cd('0x3'));var util=require(_0x46cd('0x4'));var path=require(_0x46cd('0x5'));var fs=require('fs');var _=require(_0x46cd('0x6'));var Redis=require(_0x46cd('0x7'));var interaction=require(_0x46cd('0x8'));var qs=require(_0x46cd('0x9'));var logger=require('../../config/logger')(_0x46cd('0xa'));var config=require(_0x46cd('0xb'));var db=require(_0x46cd('0xc'))['db'];config[_0x46cd('0xd')]=_['defaults'](config['redis'],{'host':_0x46cd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46cd('0xd')]));require(_0x46cd('0xf'))[_0x46cd('0x10')](socket);function respondWithStatusCode(_0x2f6d53,_0xa1cdb6){_0xa1cdb6=_0xa1cdb6||0xcc;return function(_0x116514){if(_0x116514){return _0x2f6d53[_0x46cd('0x11')](_0xa1cdb6);}return _0x2f6d53[_0x46cd('0x12')](_0xa1cdb6)[_0x46cd('0x13')]();};}function respondWithResult(_0x778b12,_0x25e640){_0x25e640=_0x25e640||0xc8;return function(_0x492546){if(_0x492546){return _0x778b12['status'](_0x25e640)[_0x46cd('0x14')](_0x492546);}};}function respondWithFilteredResult(_0x548fb6,_0x5cf097){return function(_0x457ad0){if(_0x457ad0){var _0x748b94=typeof _0x5cf097['offset']===_0x46cd('0x15')&&typeof _0x5cf097[_0x46cd('0x16')]==='undefined';var _0x12c144=_0x457ad0[_0x46cd('0x17')];var _0xd2ac7d=_0x748b94?0x0:_0x5cf097[_0x46cd('0x18')];var _0x37a0a7=_0x748b94?_0x457ad0[_0x46cd('0x17')]:_0x5cf097[_0x46cd('0x18')]+_0x5cf097['limit'];var _0xd5b0df;if(_0x37a0a7>=_0x12c144){_0x37a0a7=_0x12c144;_0xd5b0df=0xc8;}else{_0xd5b0df=0xce;}_0x548fb6[_0x46cd('0x12')](_0xd5b0df);return _0x548fb6[_0x46cd('0x19')](_0x46cd('0x1a'),_0xd2ac7d+'-'+_0x37a0a7+'/'+_0x12c144)[_0x46cd('0x14')](_0x457ad0);}return null;};}function saveUpdates(_0x3cf600){return function(_0x7a588b){if(_0x7a588b){return _0x7a588b['update'](_0x3cf600)[_0x46cd('0x1b')](function(_0x1ccbc4){return _0x1ccbc4;});}return null;};}function removeEntity(_0x2b8b34){return function(_0x5f411b){if(_0x5f411b){return _0x5f411b[_0x46cd('0x1c')]()['then'](function(){_0x2b8b34[_0x46cd('0x12')](0xcc)[_0x46cd('0x13')]();});}};}function handleEntityNotFound(_0x225ed4){return function(_0x45b923){if(!_0x45b923){_0x225ed4[_0x46cd('0x11')](0x194);}return _0x45b923;};}function handleError(_0x117372,_0x182907){_0x182907=_0x182907||0x1f4;return function(_0xfa5fa0){logger['error'](_0xfa5fa0[_0x46cd('0x1d')]);if(_0xfa5fa0[_0x46cd('0x1e')]){delete _0xfa5fa0[_0x46cd('0x1e')];}_0x117372[_0x46cd('0x12')](_0x182907)[_0x46cd('0x1f')](_0xfa5fa0);};}exports['index']=function(_0x5f2753,_0x6456c){var _0x4316c3={};var _0x4352d9=_[_0x46cd('0x20')](db[_0x46cd('0x21')]['rawAttributes'],function(_0x3d6e8a){return{'name':_0x3d6e8a[_0x46cd('0x22')],'type':_0x3d6e8a[_0x46cd('0x23')][_0x46cd('0x24')]};});_0x4316c3=qs[_0x46cd('0x25')](_0x4352d9,_0x5f2753);return interaction[_0x46cd('0x26')](_0x46cd('0x27'),_0x5f2753[_0x46cd('0x28')],_0x5f2753[_0x46cd('0x29')],_0x4316c3,_0x4352d9)['then'](respondWithFilteredResult(_0x6456c,_0x4316c3))[_0x46cd('0x2a')](handleError(_0x6456c,null));};exports['show']=function(_0x113e24,_0x515889){var _0x41c0e6={'raw':![],'where':{'id':_0x113e24[_0x46cd('0x2b')]['id']}},_0x4e9980={};_0x4e9980[_0x46cd('0x2c')]=_[_0x46cd('0x2d')](db[_0x46cd('0x21')][_0x46cd('0x2e')]);_0x4e9980[_0x46cd('0x28')]=_[_0x46cd('0x2d')](_0x113e24[_0x46cd('0x28')]);_0x4e9980[_0x46cd('0x2f')]=_['intersection'](_0x4e9980[_0x46cd('0x2c')],_0x4e9980[_0x46cd('0x28')]);_0x41c0e6['attributes']=_['intersection'](_0x4e9980[_0x46cd('0x2c')],qs[_0x46cd('0x30')](_0x113e24[_0x46cd('0x28')][_0x46cd('0x30')]));_0x41c0e6[_0x46cd('0x31')]=_0x41c0e6[_0x46cd('0x31')][_0x46cd('0x32')]?_0x41c0e6[_0x46cd('0x31')]:_0x4e9980[_0x46cd('0x2c')];if(_0x113e24['query'][_0x46cd('0x33')]){_0x41c0e6[_0x46cd('0x34')]=[{'all':!![]}];}_0x41c0e6=_[_0x46cd('0x35')]({},_0x41c0e6,_0x113e24[_0x46cd('0x36')]);return db[_0x46cd('0x21')][_0x46cd('0x37')](_0x41c0e6)[_0x46cd('0x1b')](handleEntityNotFound(_0x515889,null))[_0x46cd('0x1b')](respondWithResult(_0x515889,null))[_0x46cd('0x2a')](handleError(_0x515889,null));};exports[_0x46cd('0x38')]=function(_0x12f6b0,_0x5aef9e){return db[_0x46cd('0x21')][_0x46cd('0x38')](_0x12f6b0[_0x46cd('0x39')],{})[_0x46cd('0x1b')](respondWithResult(_0x5aef9e,0xc9))['catch'](handleError(_0x5aef9e,null));};exports[_0x46cd('0x3a')]=function(_0x2206c4,_0x5f2619){if(_0x2206c4['body']['id']){delete _0x2206c4[_0x46cd('0x39')]['id'];}return db[_0x46cd('0x21')][_0x46cd('0x37')]({'where':{'id':_0x2206c4[_0x46cd('0x2b')]['id']}})[_0x46cd('0x1b')](handleEntityNotFound(_0x5f2619,null))[_0x46cd('0x1b')](saveUpdates(_0x2206c4['body'],null))['then'](respondWithResult(_0x5f2619,null))[_0x46cd('0x2a')](handleError(_0x5f2619,null));};exports['destroy']=function(_0x349076,_0x3aa0a7){return db['FaxInteraction']['find']({'where':{'id':_0x349076[_0x46cd('0x2b')]['id']}})[_0x46cd('0x1b')](handleEntityNotFound(_0x3aa0a7,null))['then'](removeEntity(_0x3aa0a7,null))[_0x46cd('0x2a')](handleError(_0x3aa0a7,null));};exports['describe']=function(_0x52baf6,_0x2439ae){return db[_0x46cd('0x21')]['describe']()[_0x46cd('0x1b')](respondWithResult(_0x2439ae,null))[_0x46cd('0x2a')](handleError(_0x2439ae,null));};exports[_0x46cd('0x3b')]=function(_0x176292,_0x38e706){return db[_0x46cd('0x3c')]['find']({'where':{'id':_0x176292[_0x46cd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x38e706,null))['then'](function(_0x185503){if(_0x185503){return _0x185503[_0x46cd('0x3b')](_0x176292[_0x46cd('0x39')][_0x46cd('0x3d')],_[_0x46cd('0x3e')](_0x176292[_0x46cd('0x39')],[_0x46cd('0x3d'),'id'])||{});}})[_0x46cd('0x1b')](respondWithResult(_0x38e706,null))[_0x46cd('0x2a')](handleError(_0x38e706,null));};exports[_0x46cd('0x3f')]=function(_0x54014f,_0x2c27f9){var _0x53f2aa={'raw':![],'where':{}};var _0x3d6974={};var _0x4495e5={'count':0x0,'rows':[]};return db[_0x46cd('0x21')][_0x46cd('0x40')]({'where':{'id':_0x54014f[_0x46cd('0x2b')]['id']}})[_0x46cd('0x1b')](handleEntityNotFound(_0x2c27f9,null))['then'](function(_0x2616a8){if(_0x2616a8){_0x3d6974[_0x46cd('0x2c')]=_[_0x46cd('0x2d')](db[_0x46cd('0x3c')][_0x46cd('0x2e')]);_0x3d6974[_0x46cd('0x28')]=_[_0x46cd('0x2d')](_0x54014f[_0x46cd('0x28')]);_0x3d6974[_0x46cd('0x2f')]=_[_0x46cd('0x41')](_0x3d6974[_0x46cd('0x2c')],_0x3d6974[_0x46cd('0x28')]);_0x53f2aa['attributes']=_[_0x46cd('0x41')](_0x3d6974[_0x46cd('0x2c')],qs[_0x46cd('0x30')](_0x54014f['query']['fields']));_0x53f2aa[_0x46cd('0x31')]=_0x53f2aa['attributes'][_0x46cd('0x32')]?_0x53f2aa[_0x46cd('0x31')]:_0x3d6974[_0x46cd('0x2c')];if(!_0x54014f[_0x46cd('0x28')][_0x46cd('0x42')]('nolimit')){_0x53f2aa[_0x46cd('0x16')]=qs[_0x46cd('0x16')](_0x54014f['query'][_0x46cd('0x16')]);_0x53f2aa[_0x46cd('0x18')]=qs['offset'](_0x54014f[_0x46cd('0x28')][_0x46cd('0x18')]);}_0x53f2aa['order']=qs[_0x46cd('0x43')](_0x54014f[_0x46cd('0x28')]['sort']);_0x53f2aa[_0x46cd('0x44')]=qs[_0x46cd('0x2f')](_[_0x46cd('0x45')](_0x54014f[_0x46cd('0x28')],_0x3d6974['filters']));_0x53f2aa['where']['FaxInteractionId']=_0x2616a8['id'];if(_0x54014f[_0x46cd('0x28')][_0x46cd('0x46')]){_0x53f2aa['where']=_['merge'](_0x53f2aa[_0x46cd('0x44')],{'$or':_[_0x46cd('0x20')](_0x53f2aa[_0x46cd('0x31')],function(_0x520424){var _0x1992bf={};_0x1992bf[_0x520424]={'$like':'%'+_0x54014f[_0x46cd('0x28')][_0x46cd('0x46')]+'%'};return _0x1992bf;})});}if(_0x54014f[_0x46cd('0x28')]['$gte']){var _0x8bbcef=_0x54014f['query']['$gte'][_0x46cd('0x47')](',');var _0x15ca94={};_0x15ca94[_0x8bbcef[0x0]]={'$gte':moment(_0x8bbcef[0x1])[_0x46cd('0x48')](_0x46cd('0x49'))};_0x53f2aa[_0x46cd('0x44')]=_[_0x46cd('0x35')](_0x53f2aa['where'],_0x15ca94);}_0x53f2aa=_['merge']({},_0x53f2aa,_0x54014f['options']);return db[_0x46cd('0x3c')][_0x46cd('0x17')]({'where':_0x53f2aa['where']})['then'](function(_0x1ddd25){_0x4495e5[_0x46cd('0x17')]=_0x1ddd25;if(_0x54014f['query'][_0x46cd('0x33')]){_0x53f2aa[_0x46cd('0x34')]=[{'all':!![]}];}return db[_0x46cd('0x3c')][_0x46cd('0x26')](_0x53f2aa);})['then'](function(_0x6a821){_0x4495e5[_0x46cd('0x4a')]=_0x6a821;return _0x4495e5;});}})[_0x46cd('0x1b')](respondWithFilteredResult(_0x2c27f9,_0x53f2aa))[_0x46cd('0x2a')](handleError(_0x2c27f9,null));};exports[_0x46cd('0x4b')]=function(_0x17d9c8,_0x5d38c6){return db[_0x46cd('0x21')]['find']({'where':{'id':_0x17d9c8[_0x46cd('0x2b')]['id']}})[_0x46cd('0x1b')](handleEntityNotFound(_0x5d38c6,null))[_0x46cd('0x1b')](function(_0x4e4327){if(_0x4e4327){return _0x4e4327[_0x46cd('0x4c')](_0x17d9c8[_0x46cd('0x39')][_0x46cd('0x3d')],_[_0x46cd('0x3e')](_0x17d9c8['body'],['ids','id'])||{})['spread'](function(){return db[_0x46cd('0x4d')][_0x46cd('0x26')]({'attributes':['id','name',_0x46cd('0x4e')],'where':{'id':_0x17d9c8[_0x46cd('0x39')][_0x46cd('0x3d')]}});})[_0x46cd('0x1b')](function(_0x1f0b11){socket['emit'](_0x46cd('0x4f'),{'id':Number(_0x17d9c8['params']['id']),'tags':_0x1f0b11||[]});return{'id':Number(_0x17d9c8[_0x46cd('0x2b')]['id']),'tags':_0x1f0b11||[]};});}})[_0x46cd('0x1b')](respondWithResult(_0x5d38c6,null))[_0x46cd('0x2a')](handleError(_0x5d38c6,null));};exports[_0x46cd('0x50')]=function(_0x41db42,_0x181146){return db['FaxInteraction'][_0x46cd('0x37')]({'where':{'id':_0x41db42[_0x46cd('0x2b')]['id']}})[_0x46cd('0x1b')](handleEntityNotFound(_0x181146,null))['then'](function(_0x37fac5){if(_0x37fac5){return _0x37fac5[_0x46cd('0x50')](_0x41db42[_0x46cd('0x28')][_0x46cd('0x3d')]);}})[_0x46cd('0x1b')](respondWithStatusCode(_0x181146,null))['catch'](handleError(_0x181146,null));};exports[_0x46cd('0x51')]=function(_0x54ac6e,_0x3489b3){var _0x14777e=moment()[_0x46cd('0x52')]()[_0x46cd('0x53')]();var _0x4c765a=path['join'](config[_0x46cd('0x54')],_0x46cd('0x55'),'files',_0x46cd('0x56'));var _0x1e7aa1=path[_0x46cd('0x57')](config[_0x46cd('0x54')],_0x46cd('0x55'),_0x46cd('0x58'),_0x46cd('0x59'));var _0x52753b=path[_0x46cd('0x57')](_0x4c765a,_0x14777e);var _0x855a6=util[_0x46cd('0x48')](_0x46cd('0x5a'),_0x54ac6e[_0x46cd('0x2b')]['id'],_0x14777e);var _0xf1525c=path[_0x46cd('0x57')](_0x4c765a,_0x855a6);var _0x11cba1=[];_0x11cba1['push']({'model':db[_0x46cd('0x5b')],'as':_0x46cd('0x5b'),'raw':!![]});var _0x56efe8=[{'model':db['FaxMessage'],'as':_0x46cd('0x5c'),'attributes':['id',_0x46cd('0x39'),_0x46cd('0x5d')],'include':_0x11cba1}];return db['FaxInteraction'][_0x46cd('0x37')]({'where':{'id':_0x54ac6e[_0x46cd('0x2b')]['id']},'include':_0x56efe8})[_0x46cd('0x1b')](handleEntityNotFound(_0x3489b3,null))['then'](function(_0x5e1df7){if(_0x5e1df7&&_0x5e1df7[_0x46cd('0x5c')]){var _0x5ad14c=_0x5e1df7[_0x46cd('0x5e')]({'plain':!![]});fs[_0x46cd('0x5f')](_0x52753b);for(var _0x413af6=0x0;_0x413af6<_0x5ad14c[_0x46cd('0x5c')]['length'];_0x413af6++){var _0x4e54cf=_0x5ad14c['Messages'][_0x413af6][_0x46cd('0x5b')];if(_0x4e54cf){var _0x1a104b=path[_0x46cd('0x57')](_0x1e7aa1,_0x4e54cf['basename']);if(fs[_0x46cd('0x60')](_0x1a104b)){fs['createReadStream'](_0x1a104b)['pipe'](fs[_0x46cd('0x61')](path[_0x46cd('0x57')](_0x52753b,_0x4e54cf['basename'])));}}}return BPromise[_0x46cd('0x62')]()[_0x46cd('0x1b')](function(){return new BPromise(function(_0x425a6f,_0x14741e){zipdir(_0x52753b,{'saveTo':_0xf1525c},function(_0x499afd,_0x283117){if(_0x499afd)return _0x14741e(_0x499afd);return _0x425a6f(_0x283117);});})['then'](function(){return new BPromise(function(_0x40afa8,_0x233f75){rimraf(_0x52753b,function(_0x59b718){if(_0x59b718)_0x233f75(_0x59b718);return _0x40afa8();});});})[_0x46cd('0x1b')](function(){return _0x3489b3[_0x46cd('0x51')](_0xf1525c,_0x855a6,function(_0x18640f){if(_0x18640f){console['log'](_0x46cd('0x63'),_0x18640f);}else{fs[_0x46cd('0x64')](_0xf1525c);}});});});}else{return _0x3489b3[_0x46cd('0x11')](0xc8);}})[_0x46cd('0x2a')](handleError(_0x3489b3,null));};
\ No newline at end of file
index f9a78ed..4e44920 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbb3=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x1f0d8d,_0x434559){var _0x2083c2=function(_0x49fe1b){while(--_0x49fe1b){_0x1f0d8d['push'](_0x1f0d8d['shift']());}};_0x2083c2(++_0x434559);}(_0xbbb3,0x1b7));var _0x3bbb=function(_0x21dc0b,_0x4efdc5){_0x21dc0b=_0x21dc0b-0x0;var _0x4e4d2d=_0xbbb3[_0x21dc0b];return _0x4e4d2d;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x3bbb('0x0'))['db'][_0x3bbb('0x1')];var FaxMessage=require(_0x3bbb('0x0'))['db'][_0x3bbb('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3bbb('0x3'),'afterDestroy':_0x3bbb('0x4')};function emitEvent(_0x7b1dc2){return function(_0xd5d104,_0x11fb31,_0x5b96e3){_0xd5d104[_0x3bbb('0x5')]({'attributes':['id'],'raw':!![]})[_0x3bbb('0x6')](function(_0xc4d680){_0xd5d104[_0x3bbb('0x7')](_0x3bbb('0x8'),_0xc4d680[_0x3bbb('0x9')](function(_0x49ffca){return{'id':_0x49ffca['id']};}));return FaxMessage[_0x3bbb('0xa')]({'where':{'FaxInteractionId':_0xd5d104['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3bbb('0x6')](function(_0x2e584f){_0xd5d104[_0x3bbb('0x7')](_0x3bbb('0xb'),_0x2e584f[_0x3bbb('0xc')]);FaxInteractionEvents[_0x3bbb('0xd')](_0x7b1dc2+':'+_0xd5d104['id'],_0xd5d104);FaxInteractionEvents[_0x3bbb('0xd')](_0x7b1dc2,_0xd5d104);_0x5b96e3(null);})[_0x3bbb('0xe')](_0x5b96e3(null));};}for(var e in events){if(events[_0x3bbb('0xf')](e)){var event=events[e];FaxInteraction[_0x3bbb('0x10')](e,emitEvent(event));}}module[_0x3bbb('0x11')]=FaxInteractionEvents;
\ No newline at end of file
+var _0xb44e=['update','then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x4a4334,_0x11f528){var _0x3eaeb5=function(_0x1dfcdb){while(--_0x1dfcdb){_0x4a4334['push'](_0x4a4334['shift']());}};_0x3eaeb5(++_0x11f528);}(_0xb44e,0x9b));var _0xeb44=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xb44e[_0x8c1005];return _0x175354;};'use strict';var EventEmitter=require(_0xeb44('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xeb44('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xeb44('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xeb44('0x3')](0x0);var events={'afterCreate':_0xeb44('0x4'),'afterUpdate':_0xeb44('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21499c){return function(_0xe1dc3b,_0x402325,_0x11a9cf){_0xe1dc3b['getUsers']({'attributes':['id'],'raw':!![]})[_0xeb44('0x6')](function(_0x1741d2){_0xe1dc3b[_0xeb44('0x7')](_0xeb44('0x8'),_0x1741d2[_0xeb44('0x9')](function(_0x343b12){return{'id':_0x343b12['id']};}));return FaxMessage[_0xeb44('0xa')]({'where':{'FaxInteractionId':_0xe1dc3b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb44('0x6')](function(_0x4e5072){_0xe1dc3b[_0xeb44('0x7')]('unreadMessages',_0x4e5072[_0xeb44('0xb')]);FaxInteractionEvents[_0xeb44('0xc')](_0x21499c+':'+_0xe1dc3b['id'],_0xe1dc3b);FaxInteractionEvents['emit'](_0x21499c,_0xe1dc3b);_0x11a9cf(null);})[_0xeb44('0xd')](_0x11a9cf(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xeb44('0xe')](e,emitEvent(event));}}module[_0xeb44('0xf')]=FaxInteractionEvents;
\ No newline at end of file
index bae15b8..50c82ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x752a=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x752a,0x109));var _0xa752=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x752a[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require('lodash');var util=require(_0xa752('0x0'));var logger=require(_0xa752('0x1'))(_0xa752('0x2'));var moment=require(_0xa752('0x3'));var BPromise=require('bluebird');var rp=require(_0xa752('0x4'));var fs=require('fs');var path=require(_0xa752('0x5'));var rimraf=require(_0xa752('0x6'));var config=require(_0xa752('0x7'));var attributes=require(_0xa752('0x8'));module[_0xa752('0x9')]=function(_0x3f8802,_0x4233f8){return _0x3f8802[_0xa752('0xa')](_0xa752('0xb'),attributes,{'tableName':_0xa752('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1659a0,_0x4e7d7d,_0x46d195){if(_0x1659a0[_0xa752('0xd')]('closed')){_0x1659a0[_0xa752('0xe')]=moment()[_0xa752('0xf')](_0xa752('0x10'));}_0x46d195(null,_0x1659a0);}}});};
\ No newline at end of file
+var _0x405f=['bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x405f,0x1d8));var _0xf405=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x405f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xf405('0x0'));var logger=require(_0xf405('0x1'))(_0xf405('0x2'));var moment=require(_0xf405('0x3'));var BPromise=require(_0xf405('0x4'));var rp=require(_0xf405('0x5'));var fs=require('fs');var path=require(_0xf405('0x6'));var rimraf=require(_0xf405('0x7'));var config=require(_0xf405('0x8'));var attributes=require(_0xf405('0x9'));module[_0xf405('0xa')]=function(_0x3c9e7c,_0xcf1e3e){return _0x3c9e7c[_0xf405('0xb')](_0xf405('0xc'),attributes,{'tableName':_0xf405('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a7483,_0x218a4a,_0x175d4e){if(_0x3a7483['changed'](_0xf405('0xe'))){_0x3a7483['closedAt']=moment()[_0xf405('0xf')](_0xf405('0x10'));}_0x175d4e(null,_0x3a7483);}}});};
\ No newline at end of file
index d682b28..0c58349 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02b9=['FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x02b9,0x1e3));var _0x902b=function(_0x4a3960,_0x229ff7){_0x4a3960=_0x4a3960-0x0;var _0x48f79c=_0x02b9[_0x4a3960];return _0x48f79c;};'use strict';var _=require(_0x902b('0x0'));var util=require(_0x902b('0x1'));var moment=require(_0x902b('0x2'));var BPromise=require(_0x902b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x902b('0x4'));var db=require(_0x902b('0x5'))['db'];var utils=require(_0x902b('0x6'));var logger=require(_0x902b('0x7'))(_0x902b('0x8'));var config=require(_0x902b('0x9'));var jayson=require(_0x902b('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x902b('0xb')]=_[_0x902b('0xc')](config['redis'],{'host':_0x902b('0xd'),'port':0x18eb});var socket=require(_0x902b('0xe'))(new Redis(config[_0x902b('0xb')]));require(_0x902b('0xf'))[_0x902b('0x10')](socket);function respondWithRpcPromise(_0x3f3d32,_0x341b37,_0x18a754){return new BPromise(function(_0x24946b,_0x1b5b8b){return client[_0x902b('0x11')](_0x3f3d32,_0x18a754)[_0x902b('0x12')](function(_0x38e7cb){logger[_0x902b('0x13')](_0x902b('0x14'),_0x341b37,_0x902b('0x15'));logger[_0x902b('0x16')](_0x902b('0x17'),_0x341b37,_0x902b('0x15'),JSON[_0x902b('0x18')](_0x38e7cb));if(_0x38e7cb[_0x902b('0x19')]){if(_0x38e7cb[_0x902b('0x19')][_0x902b('0x1a')]===0x1f4){logger[_0x902b('0x19')](_0x902b('0x14'),_0x341b37,_0x38e7cb['error'][_0x902b('0x1b')]);return _0x1b5b8b(_0x38e7cb[_0x902b('0x19')]['message']);}logger[_0x902b('0x19')](_0x902b('0x14'),_0x341b37,_0x38e7cb[_0x902b('0x19')][_0x902b('0x1b')]);return _0x24946b(_0x38e7cb['error']['message']);}else{logger[_0x902b('0x13')](_0x902b('0x14'),_0x341b37,_0x902b('0x15'));_0x24946b(_0x38e7cb[_0x902b('0x1c')][_0x902b('0x1b')]);}})[_0x902b('0x1d')](function(_0x1ad88c){logger[_0x902b('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x341b37,_0x1ad88c);_0x1b5b8b(_0x1ad88c);});});}exports[_0x902b('0x1e')]=function(_0x565def){var _0x4e8ab4=this;return new Promise(function(_0x444384,_0x3ddcad){return db[_0x902b('0x1f')][_0x902b('0x20')](_0x565def[_0x902b('0x21')],{'raw':_0x565def[_0x902b('0x22')]?_0x565def[_0x902b('0x22')][_0x902b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565def[_0x902b('0x22')]?_0x565def[_0x902b('0x22')]['where']||null:null,'attributes':_0x565def[_0x902b('0x22')]?_0x565def[_0x902b('0x22')][_0x902b('0x24')]||null:null,'limit':_0x565def['options']?_0x565def['options'][_0x902b('0x25')]||null:null})[_0x902b('0x12')](function(_0x241b5f){logger[_0x902b('0x13')](_0x902b('0x1e'),_0x565def);logger[_0x902b('0x16')](_0x902b('0x1e'),_0x565def,JSON[_0x902b('0x18')](_0x241b5f));_0x444384(_0x241b5f);})[_0x902b('0x1d')](function(_0x529248){logger[_0x902b('0x19')](_0x902b('0x1e'),_0x529248[_0x902b('0x1b')],_0x565def);_0x3ddcad(_0x4e8ab4[_0x902b('0x19')](0x1f4,_0x529248[_0x902b('0x1b')]));});});};exports[_0x902b('0x26')]=function(_0x3ddec7){return new Promise(function(_0x349bac,_0x46225e){return db['FaxInteraction'][_0x902b('0x27')]({'where':_0x3ddec7['options']?_0x3ddec7[_0x902b('0x22')][_0x902b('0x28')]||null:null})[_0x902b('0x12')](function(_0x3055ed){if(_0x3055ed){return _0x3055ed[_0x902b('0x29')](_0x3ddec7[_0x902b('0x21')][_0x902b('0x2a')],_[_0x902b('0x2b')](_0x3ddec7['body'],['ids','id'])||{});}})[_0x902b('0x2c')](function(_0x22b517){logger['info'](_0x902b('0x2d'),_0x3ddec7);logger[_0x902b('0x16')](_0x902b('0x2d'),_0x3ddec7,JSON[_0x902b('0x18')](_0x22b517));_0x349bac(_0x22b517);})[_0x902b('0x1d')](function(_0x3af80b){logger[_0x902b('0x19')](_0x902b('0x2d'),_0x3af80b[_0x902b('0x1b')],_0x3ddec7);_0x46225e(_this[_0x902b('0x19')](0x1f4,_0x3af80b[_0x902b('0x1b')]));});});};
\ No newline at end of file
+var _0x124e=['where','attributes','limit','catch','find','addTags','omit','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw'];(function(_0x22f924,_0x17b3db){var _0x558899=function(_0x1c7474){while(--_0x1c7474){_0x22f924['push'](_0x22f924['shift']());}};_0x558899(++_0x17b3db);}(_0x124e,0xc7));var _0xe124=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x124e[_0x273dc5];return _0x46dae7;};'use strict';var _=require(_0xe124('0x0'));var util=require('util');var moment=require(_0xe124('0x1'));var BPromise=require(_0xe124('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe124('0x3'))['db'];var utils=require(_0xe124('0x4'));var logger=require(_0xe124('0x5'))(_0xe124('0x6'));var config=require(_0xe124('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe124('0x8')][_0xe124('0x9')]({'port':0x232a});config['redis']=_[_0xe124('0xa')](config[_0xe124('0xb')],{'host':_0xe124('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe124('0xb')]));require('./faxInteraction.socket')[_0xe124('0xd')](socket);function respondWithRpcPromise(_0xeb61f4,_0x5c84a1,_0x1ac012){return new BPromise(function(_0x4fad50,_0x3d2eea){return client['request'](_0xeb61f4,_0x1ac012)[_0xe124('0xe')](function(_0x412ae8){logger[_0xe124('0xf')](_0xe124('0x10'),_0x5c84a1,_0xe124('0x11'));logger[_0xe124('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x5c84a1,_0xe124('0x11'),JSON[_0xe124('0x13')](_0x412ae8));if(_0x412ae8[_0xe124('0x14')]){if(_0x412ae8[_0xe124('0x14')][_0xe124('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x5c84a1,_0x412ae8[_0xe124('0x14')][_0xe124('0x16')]);return _0x3d2eea(_0x412ae8[_0xe124('0x14')]['message']);}logger[_0xe124('0x14')](_0xe124('0x10'),_0x5c84a1,_0x412ae8[_0xe124('0x14')]['message']);return _0x4fad50(_0x412ae8[_0xe124('0x14')]['message']);}else{logger[_0xe124('0xf')](_0xe124('0x10'),_0x5c84a1,_0xe124('0x11'));_0x4fad50(_0x412ae8['result'][_0xe124('0x16')]);}})['catch'](function(_0x1e1780){logger[_0xe124('0x14')](_0xe124('0x10'),_0x5c84a1,_0x1e1780);_0x3d2eea(_0x1e1780);});});}exports[_0xe124('0x17')]=function(_0x46dff7){var _0x2ceb73=this;return new Promise(function(_0x230071,_0x735af2){return db[_0xe124('0x18')][_0xe124('0x19')](_0x46dff7[_0xe124('0x1a')],{'raw':_0x46dff7[_0xe124('0x1b')]?_0x46dff7['options'][_0xe124('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46dff7['options']?_0x46dff7[_0xe124('0x1b')][_0xe124('0x1d')]||null:null,'attributes':_0x46dff7[_0xe124('0x1b')]?_0x46dff7[_0xe124('0x1b')][_0xe124('0x1e')]||null:null,'limit':_0x46dff7[_0xe124('0x1b')]?_0x46dff7['options'][_0xe124('0x1f')]||null:null})['then'](function(_0x2fcaeb){logger['info'](_0xe124('0x17'),_0x46dff7);logger[_0xe124('0x12')](_0xe124('0x17'),_0x46dff7,JSON[_0xe124('0x13')](_0x2fcaeb));_0x230071(_0x2fcaeb);})[_0xe124('0x20')](function(_0x29132d){logger[_0xe124('0x14')](_0xe124('0x17'),_0x29132d[_0xe124('0x16')],_0x46dff7);_0x735af2(_0x2ceb73['error'](0x1f4,_0x29132d['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x4e9358){return new Promise(function(_0x249767,_0x347dfc){return db['FaxInteraction'][_0xe124('0x21')]({'where':_0x4e9358[_0xe124('0x1b')]?_0x4e9358[_0xe124('0x1b')][_0xe124('0x1d')]||null:null})['then'](function(_0x1ce01a){if(_0x1ce01a){return _0x1ce01a[_0xe124('0x22')](_0x4e9358[_0xe124('0x1a')]['ids'],_[_0xe124('0x23')](_0x4e9358[_0xe124('0x1a')],['ids','id'])||{});}})[_0xe124('0x24')](function(_0x4f4ede){logger[_0xe124('0xf')](_0xe124('0x25'),_0x4e9358);logger[_0xe124('0x12')]('AddTags',_0x4e9358,JSON[_0xe124('0x13')](_0x4f4ede));_0x249767(_0x4f4ede);})[_0xe124('0x20')](function(_0xb1ac71){logger[_0xe124('0x14')](_0xe124('0x25'),_0xb1ac71[_0xe124('0x16')],_0x4e9358);_0x347dfc(_this[_0xe124('0x14')](0x1f4,_0xb1ac71['message']));});});};
\ No newline at end of file
index aabfa2a..4c9a1e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc3b=['save','remove','update','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x1e4e28,_0x194366){var _0x49b11c=function(_0x5d39a1){while(--_0x5d39a1){_0x1e4e28['push'](_0x1e4e28['shift']());}};_0x49b11c(++_0x194366);}(_0xbc3b,0x179));var _0xbbc3=function(_0x373ba3,_0x265ccc){_0x373ba3=_0x373ba3-0x0;var _0x151f21=_0xbc3b[_0x373ba3];return _0x151f21;};'use strict';var FaxInteractionEvents=require(_0xbbc3('0x0'));var events=[_0xbbc3('0x1'),_0xbbc3('0x2'),_0xbbc3('0x3')];function createListener(_0x193f57,_0xfd7de5){return function(_0x1e7a93){_0xfd7de5['emit'](_0x193f57,_0x1e7a93);};}function removeListener(_0x5a4025,_0x3bcb90){return function(){FaxInteractionEvents[_0xbbc3('0x4')](_0x5a4025,_0x3bcb90);};}exports[_0xbbc3('0x5')]=function(_0x2b979a){for(var _0x51d5e9=0x0,_0x153b5c=events['length'];_0x51d5e9<_0x153b5c;_0x51d5e9++){var _0x2bd7a5=events[_0x51d5e9];var _0x39e41a=createListener(_0xbbc3('0x6')+_0x2bd7a5,_0x2b979a);FaxInteractionEvents['on'](_0x2bd7a5,_0x39e41a);}};
\ No newline at end of file
+var _0x909e=['length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x909e,0x1f2));var _0xe909=function(_0x3bfa0a,_0x1b84fb){_0x3bfa0a=_0x3bfa0a-0x0;var _0x483031=_0x909e[_0x3bfa0a];return _0x483031;};'use strict';var FaxInteractionEvents=require(_0xe909('0x0'));var events=[_0xe909('0x1'),_0xe909('0x2'),_0xe909('0x3')];function createListener(_0x1d54ab,_0x5900af){return function(_0x430c40){_0x5900af['emit'](_0x1d54ab,_0x430c40);};}function removeListener(_0x1fdb06,_0x2a35ac){return function(){FaxInteractionEvents[_0xe909('0x4')](_0x1fdb06,_0x2a35ac);};}exports[_0xe909('0x5')]=function(_0x2b549a){for(var _0x4c8fe7=0x0,_0x531419=events[_0xe909('0x6')];_0x4c8fe7<_0x531419;_0x4c8fe7++){var _0x57f0f5=events[_0x4c8fe7];var _0x961ad8=createListener(_0xe909('0x7')+_0x57f0f5,_0x2b549a);FaxInteractionEvents['on'](_0x57f0f5,_0x961ad8);}};
\ No newline at end of file
index e6fa794..8eefa53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x80b9=['./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','download','create','post','addMessage','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','faxinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x80b9,0x8e));var _0x980b=function(_0x3c8277,_0x426041){_0x3c8277=_0x3c8277-0x0;var _0x40765b=_0x80b9[_0x3c8277];return _0x40765b;};'use strict';var multer=require(_0x980b('0x0'));var util=require(_0x980b('0x1'));var path=require(_0x980b('0x2'));var timeout=require(_0x980b('0x3'));var express=require('express');var router=express[_0x980b('0x4')]();var fs_extra=require(_0x980b('0x5'));var auth=require(_0x980b('0x6'));var interaction=require(_0x980b('0x7'));var config=require('../../config/environment');var controller=require(_0x980b('0x8'));router[_0x980b('0x9')]('/',auth[_0x980b('0xa')](),controller[_0x980b('0xb')]);router['get']('/describe',auth[_0x980b('0xa')](),controller[_0x980b('0xc')]);router[_0x980b('0x9')](_0x980b('0xd'),auth[_0x980b('0xa')](),controller[_0x980b('0xe')]);router['get']('/:id/messages',auth[_0x980b('0xa')](),controller[_0x980b('0xf')]);router[_0x980b('0x9')]('/:id/download',auth[_0x980b('0xa')](),controller[_0x980b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x980b('0x11')]);router[_0x980b('0x12')]('/:id/messages',auth[_0x980b('0xa')](),controller[_0x980b('0x13')]);router[_0x980b('0x12')]('/:id/tags',auth[_0x980b('0xa')](),interaction[_0x980b('0x14')]('fax',_0x980b('0x15')),controller[_0x980b('0x16')]);router[_0x980b('0x17')]('/:id',auth[_0x980b('0xa')](),interaction['tracked'](_0x980b('0x18'),_0x980b('0x19')),controller['update']);router['delete'](_0x980b('0xd'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x980b('0x1a')),controller['destroy']);router[_0x980b('0x1b')]('/:id/tags',auth[_0x980b('0xa')](),controller[_0x980b('0x1c')]);module[_0x980b('0x1d')]=router;
\ No newline at end of file
+var _0x4bc9=['delete','faxinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','fax','tracked','update'];(function(_0xa423c5,_0x2472d3){var _0x39fffd=function(_0x4d8986){while(--_0x4d8986){_0xa423c5['push'](_0xa423c5['shift']());}};_0x39fffd(++_0x2472d3);}(_0x4bc9,0x1d4));var _0x94bc=function(_0xd6b5d6,_0x157d08){_0xd6b5d6=_0xd6b5d6-0x0;var _0x243656=_0x4bc9[_0xd6b5d6];return _0x243656;};'use strict';var multer=require(_0x94bc('0x0'));var util=require(_0x94bc('0x1'));var path=require('path');var timeout=require(_0x94bc('0x2'));var express=require(_0x94bc('0x3'));var router=express[_0x94bc('0x4')]();var fs_extra=require(_0x94bc('0x5'));var auth=require(_0x94bc('0x6'));var interaction=require(_0x94bc('0x7'));var config=require(_0x94bc('0x8'));var controller=require(_0x94bc('0x9'));router[_0x94bc('0xa')]('/',auth[_0x94bc('0xb')](),controller[_0x94bc('0xc')]);router[_0x94bc('0xa')](_0x94bc('0xd'),auth[_0x94bc('0xb')](),controller['describe']);router['get'](_0x94bc('0xe'),auth['isAuthenticated'](),controller[_0x94bc('0xf')]);router[_0x94bc('0xa')](_0x94bc('0x10'),auth[_0x94bc('0xb')](),controller['getMessages']);router[_0x94bc('0xa')](_0x94bc('0x11'),auth[_0x94bc('0xb')](),controller[_0x94bc('0x12')]);router['post']('/',auth[_0x94bc('0xb')](),controller[_0x94bc('0x13')]);router[_0x94bc('0x14')](_0x94bc('0x10'),auth[_0x94bc('0xb')](),controller['addMessage']);router[_0x94bc('0x14')](_0x94bc('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x94bc('0x16'),'faxinteraction:addtags'),controller['addTags']);router['put'](_0x94bc('0xe'),auth[_0x94bc('0xb')](),interaction[_0x94bc('0x17')](_0x94bc('0x16'),'faxinteraction:update'),controller[_0x94bc('0x18')]);router[_0x94bc('0x19')](_0x94bc('0xe'),auth[_0x94bc('0xb')](),interaction['tracked']('fax',_0x94bc('0x1a')),controller['destroy']);router[_0x94bc('0x19')](_0x94bc('0x15'),auth[_0x94bc('0xb')](),controller[_0x94bc('0x1b')]);module[_0x94bc('0x1c')]=router;
\ No newline at end of file
index 4e5d1c0..5c670b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81bd=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x81bd,0x7c));var _0xd81b=function(_0x2b43ba,_0x3510f1){_0x2b43ba=_0x2b43ba-0x0;var _0x26d41e=_0x81bd[_0x2b43ba];return _0x26d41e;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'body':{'type':Sequelize[_0xd81b('0x2')](_0xd81b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd81b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd81b('0x5')]('in',_0xd81b('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xd81b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd81b('0x7')]}};
\ No newline at end of file
+var _0x383d=['medium','BOOLEAN','out','DATE','TEXT'];(function(_0x529351,_0x3ac704){var _0x41cd56=function(_0x540861){while(--_0x540861){_0x529351['push'](_0x529351['shift']());}};_0x41cd56(++_0x3ac704);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd383('0x0')](_0xd383('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd383('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd383('0x3')),'defaultValue':_0xd383('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd383('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd383('0x4')]}};
\ No newline at end of file
index 3284cbe..8a0282b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2607=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','FaxMessage','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','destroy','describe','fax-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','motionChannel','create','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x50dd3e,_0x15f898){var _0x366108=function(_0x53e891){while(--_0x53e891){_0x50dd3e['push'](_0x50dd3e['shift']());}};_0x366108(++_0x15f898);}(_0x2607,0x7f));var _0x7260=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0x2607[_0x53f37f];return _0x2fe5f8;};'use strict';var emlformat=require(_0x7260('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7260('0x1'));var jsonpatch=require(_0x7260('0x2'));var rp=require(_0x7260('0x3'));var moment=require(_0x7260('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7260('0x5'));var util=require(_0x7260('0x6'));var path=require(_0x7260('0x7'));var sox=require(_0x7260('0x8'));var csv=require(_0x7260('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7260('0xa'));var squel=require(_0x7260('0xb'));var crypto=require(_0x7260('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7260('0x9'));var querystring=require('querystring');var Papa=require(_0x7260('0xd'));var Redis=require(_0x7260('0xe'));var authService=require(_0x7260('0xf'));var qs=require(_0x7260('0x10'));var as=require(_0x7260('0x11'));var hardwareService=require(_0x7260('0x12'));var logger=require(_0x7260('0x13'))(_0x7260('0x14'));var utils=require('../../config/utils');var config=require(_0x7260('0x15'));var licenseUtil=require(_0x7260('0x16'));var db=require(_0x7260('0x17'))['db'];config[_0x7260('0x18')]=_[_0x7260('0x19')](config[_0x7260('0x18')],{'host':_0x7260('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7260('0x18')]));require(_0x7260('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7260('0x1c')][_0x7260('0x1d')]({'port':0x232c});var client9002=jayson[_0x7260('0x1c')][_0x7260('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x31c955,_0x290d3c,_0x32a404,_0x5d43ee){return new BPromise(function(_0x4abf07,_0x2e5b15){var _0x3aa97d=_0x5d43ee||client;return _0x3aa97d[_0x7260('0x1e')](_0x31c955,_0x32a404)['then'](function(_0x5b657f){logger[_0x7260('0x1f')](_0x7260('0x20'),_0x290d3c,_0x7260('0x21'));logger['debug'](_0x7260('0x22'),_0x290d3c,_0x7260('0x21'),JSON[_0x7260('0x23')](_0x5b657f));if(_0x5b657f[_0x7260('0x24')]){if(_0x5b657f[_0x7260('0x24')][_0x7260('0x25')]===0x1f4){logger[_0x7260('0x24')]('FaxMessage,\x20%s,\x20%s',_0x290d3c,_0x5b657f['error']['message']);return _0x2e5b15(_0x5b657f['error'][_0x7260('0x26')]);}logger[_0x7260('0x24')](_0x7260('0x20'),_0x290d3c,_0x5b657f[_0x7260('0x24')][_0x7260('0x26')]);return _0x4abf07(_0x5b657f[_0x7260('0x24')][_0x7260('0x26')]);}else{logger[_0x7260('0x1f')](_0x7260('0x20'),_0x290d3c,_0x7260('0x21'));_0x4abf07(_0x5b657f[_0x7260('0x27')]['message']);}})[_0x7260('0x28')](function(_0x154079){logger[_0x7260('0x24')](_0x7260('0x20'),_0x290d3c,_0x154079);_0x2e5b15(_0x154079);});});}function respondWithStatusCode(_0x537c2b,_0x326174){_0x326174=_0x326174||0xcc;return function(_0x45940d){if(_0x45940d){return _0x537c2b['sendStatus'](_0x326174);}return _0x537c2b[_0x7260('0x29')](_0x326174)[_0x7260('0x2a')]();};}function respondWithResult(_0x31ec13,_0x1c078f){_0x1c078f=_0x1c078f||0xc8;return function(_0x5292db){if(_0x5292db){return _0x31ec13[_0x7260('0x29')](_0x1c078f)[_0x7260('0x2b')](_0x5292db);}};}function respondWithFilteredResult(_0x178dc3,_0x36d4d4){return function(_0x2cf1b1){if(_0x2cf1b1){var _0x15c12b=typeof _0x36d4d4[_0x7260('0x2c')]===_0x7260('0x2d')&&typeof _0x36d4d4['limit']===_0x7260('0x2d');var _0x3c255b=_0x2cf1b1[_0x7260('0x2e')];var _0x4d4709=_0x15c12b?0x0:_0x36d4d4[_0x7260('0x2c')];var _0x19b961=_0x15c12b?_0x2cf1b1[_0x7260('0x2e')]:_0x36d4d4[_0x7260('0x2c')]+_0x36d4d4[_0x7260('0x2f')];var _0x4456f5;if(_0x19b961>=_0x3c255b){_0x19b961=_0x3c255b;_0x4456f5=0xc8;}else{_0x4456f5=0xce;}_0x178dc3[_0x7260('0x29')](_0x4456f5);return _0x178dc3[_0x7260('0x30')](_0x7260('0x31'),_0x4d4709+'-'+_0x19b961+'/'+_0x3c255b)[_0x7260('0x2b')](_0x2cf1b1);}return null;};}function patchUpdates(_0x1906c1){return function(_0x5e1316){try{jsonpatch[_0x7260('0x32')](_0x5e1316,_0x1906c1,!![]);}catch(_0x3e7c52){return BPromise[_0x7260('0x33')](_0x3e7c52);}return _0x5e1316[_0x7260('0x34')]();};}function saveUpdates(_0x48f2f4,_0x4a9ff5){return function(_0xf6e414){if(_0xf6e414){return _0xf6e414[_0x7260('0x35')](_0x48f2f4)[_0x7260('0x36')](function(_0x4f872f){return _0x4f872f;});}return null;};}function removeEntity(_0x44af19,_0x47c5f9){return function(_0x225f45){if(_0x225f45){return _0x225f45['destroy']()[_0x7260('0x36')](function(){_0x44af19['status'](0xcc)[_0x7260('0x2a')]();});}};}function handleEntityNotFound(_0x35555c,_0x4f92a7){return function(_0x217918){if(!_0x217918){_0x35555c['sendStatus'](0x194);}return _0x217918;};}function handleError(_0x19def9,_0x453180){_0x453180=_0x453180||0x1f4;return function(_0x11b7a0){logger['error'](_0x11b7a0[_0x7260('0x37')]);if(_0x11b7a0[_0x7260('0x38')]){delete _0x11b7a0[_0x7260('0x38')];}_0x19def9['status'](_0x453180)['send'](_0x11b7a0);};}exports[_0x7260('0x39')]=function(_0x494e59,_0x169b76){var _0x46003a={},_0x45b04e={},_0x37e94a={'count':0x0,'rows':[]};var _0x4400ec=_[_0x7260('0x3a')](db[_0x7260('0x3b')][_0x7260('0x3c')],function(_0x5b290a){return{'name':_0x5b290a['fieldName'],'type':_0x5b290a['type'][_0x7260('0x3d')]};});_0x45b04e[_0x7260('0x3e')]=_[_0x7260('0x3a')](_0x4400ec,_0x7260('0x38'));_0x45b04e['query']=_[_0x7260('0x3f')](_0x494e59[_0x7260('0x40')]);_0x45b04e['filters']=_[_0x7260('0x41')](_0x45b04e[_0x7260('0x3e')],_0x45b04e[_0x7260('0x40')]);_0x46003a[_0x7260('0x42')]=_[_0x7260('0x41')](_0x45b04e[_0x7260('0x3e')],qs['fields'](_0x494e59[_0x7260('0x40')][_0x7260('0x43')]));_0x46003a[_0x7260('0x42')]=_0x46003a[_0x7260('0x42')][_0x7260('0x44')]?_0x46003a['attributes']:_0x45b04e[_0x7260('0x3e')];if(!_0x494e59[_0x7260('0x40')][_0x7260('0x45')](_0x7260('0x46'))){_0x46003a[_0x7260('0x2f')]=qs[_0x7260('0x2f')](_0x494e59[_0x7260('0x40')][_0x7260('0x2f')]);_0x46003a[_0x7260('0x2c')]=qs[_0x7260('0x2c')](_0x494e59[_0x7260('0x40')][_0x7260('0x2c')]);}_0x46003a['order']=qs['sort'](_0x494e59[_0x7260('0x40')][_0x7260('0x47')]);_0x46003a[_0x7260('0x48')]=qs[_0x7260('0x49')](_[_0x7260('0x4a')](_0x494e59[_0x7260('0x40')],_0x45b04e[_0x7260('0x49')]),_0x4400ec);if(_0x494e59[_0x7260('0x40')][_0x7260('0x4b')]){_0x46003a[_0x7260('0x48')]=_[_0x7260('0x4c')](_0x46003a[_0x7260('0x48')],{'$or':_[_0x7260('0x3a')](_0x4400ec,function(_0x1d8e47){if(_0x1d8e47['type']!==_0x7260('0x4d')){var _0x5799fc={};_0x5799fc[_0x1d8e47[_0x7260('0x38')]]={'$like':'%'+_0x494e59[_0x7260('0x40')][_0x7260('0x4b')]+'%'};return _0x5799fc;}})});}_0x46003a=_[_0x7260('0x4c')]({},_0x46003a,_0x494e59[_0x7260('0x4e')]);var _0x3c24b3={'where':_0x46003a[_0x7260('0x48')]};return db[_0x7260('0x3b')][_0x7260('0x2e')](_0x3c24b3)[_0x7260('0x36')](function(_0x1b16f2){_0x37e94a[_0x7260('0x2e')]=_0x1b16f2;if(_0x494e59['query'][_0x7260('0x4f')]){_0x46003a[_0x7260('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0x7260('0x51')](_0x46003a);})[_0x7260('0x36')](function(_0x5bc825){_0x37e94a[_0x7260('0x52')]=_0x5bc825;return _0x37e94a;})[_0x7260('0x36')](respondWithFilteredResult(_0x169b76,_0x46003a))[_0x7260('0x28')](handleError(_0x169b76,null));};exports[_0x7260('0x53')]=function(_0x19499f,_0x162fc2){var _0x129549={'raw':!![],'where':{'id':_0x19499f[_0x7260('0x54')]['id']}},_0x521045={};_0x521045[_0x7260('0x3e')]=_[_0x7260('0x3f')](db['FaxMessage'][_0x7260('0x3c')]);_0x521045[_0x7260('0x40')]=_['keys'](_0x19499f[_0x7260('0x40')]);_0x521045['filters']=_[_0x7260('0x41')](_0x521045[_0x7260('0x3e')],_0x521045[_0x7260('0x40')]);_0x129549[_0x7260('0x42')]=_[_0x7260('0x41')](_0x521045[_0x7260('0x3e')],qs[_0x7260('0x43')](_0x19499f[_0x7260('0x40')][_0x7260('0x43')]));_0x129549[_0x7260('0x42')]=_0x129549['attributes'][_0x7260('0x44')]?_0x129549[_0x7260('0x42')]:_0x521045[_0x7260('0x3e')];if(_0x19499f[_0x7260('0x40')][_0x7260('0x4f')]){_0x129549['include']=[{'all':!![]}];}_0x129549=_[_0x7260('0x4c')]({},_0x129549,_0x19499f[_0x7260('0x4e')]);return db[_0x7260('0x3b')][_0x7260('0x55')](_0x129549)[_0x7260('0x36')](handleEntityNotFound(_0x162fc2,null))['then'](respondWithResult(_0x162fc2,null))['catch'](handleError(_0x162fc2,null));};exports[_0x7260('0x35')]=function(_0x35262a,_0x476ed1){if(_0x35262a[_0x7260('0x56')]['id']){delete _0x35262a[_0x7260('0x56')]['id'];}return db[_0x7260('0x3b')][_0x7260('0x55')]({'where':{'id':_0x35262a[_0x7260('0x54')]['id']}})['then'](handleEntityNotFound(_0x476ed1,null))[_0x7260('0x36')](saveUpdates(_0x35262a[_0x7260('0x56')],null))[_0x7260('0x36')](respondWithResult(_0x476ed1,null))[_0x7260('0x28')](handleError(_0x476ed1,null));};exports[_0x7260('0x57')]=function(_0x47f266,_0x42fb37){return db['FaxMessage'][_0x7260('0x55')]({'where':{'id':_0x47f266[_0x7260('0x54')]['id']}})[_0x7260('0x36')](handleEntityNotFound(_0x42fb37,null))['then'](removeEntity(_0x42fb37,null))['catch'](handleError(_0x42fb37,null));};exports[_0x7260('0x58')]=function(_0x2744cf,_0x12e7a8){return db[_0x7260('0x3b')][_0x7260('0x58')]()[_0x7260('0x36')](respondWithResult(_0x12e7a8,null))[_0x7260('0x28')](handleError(_0x12e7a8,null));};var interaction_log=require(_0x7260('0x13'))(_0x7260('0x59'));exports[_0x7260('0x5a')]=function(_0x49feba,_0x146bf9,_0x15736d){var _0x1bf5ba={'agent':{},'channel':'fax'};if(_0x49feba[_0x7260('0x56')]['id']){delete _0x49feba[_0x7260('0x56')]['id'];}_0x49feba['body'][_0x7260('0x5b')]=!![];_0x49feba['body'][_0x7260('0x5c')]=moment()['format'](_0x7260('0x5d'));_0x49feba[_0x7260('0x56')][_0x7260('0x5e')]=_0x49feba[_0x7260('0x56')][_0x7260('0x5e')]||_0x49feba[_0x7260('0x5f')]['id'];_0x1bf5ba[_0x7260('0x60')]['id']=_0x49feba[_0x7260('0x56')][_0x7260('0x5e')];return db[_0x7260('0x3b')][_0x7260('0x55')]({'where':{'id':_0x49feba[_0x7260('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x146bf9,null))[_0x7260('0x36')](saveUpdates(_0x49feba[_0x7260('0x56')],null))[_0x7260('0x36')](function(_0x3db26c){if(_0x3db26c){_0x1bf5ba[_0x7260('0x26')]=_0x3db26c[_0x7260('0x61')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3db26c[_0x7260('0x62')]}});}return null;})[_0x7260('0x36')](handleEntityNotFound(_0x146bf9,null))[_0x7260('0x36')](function(_0x232ad5){if(_0x232ad5){return _0x232ad5[_0x7260('0x35')]({'UserId':_0x49feba['body'][_0x7260('0x5e')],'read1stAt':_[_0x7260('0x63')](_0x232ad5[_0x7260('0x64')])?moment()[_0x7260('0x65')](_0x7260('0x5d')):undefined});}return null;})[_0x7260('0x36')](function(_0x466e15){if(_0x466e15){_0x1bf5ba[_0x7260('0x66')]=_0x466e15[_0x7260('0x61')]({'plain':!![]});interaction_log[_0x7260('0x1f')](_0x7260('0x67'),_0x49feba[_0x7260('0x5f')]['id'],_0x49feba[_0x7260('0x5f')][_0x7260('0x38')],_0x49feba[_0x7260('0x5f')][_0x7260('0x68')],_0x1bf5ba[_0x7260('0x66')]['id'],_0x49feba[_0x7260('0x56')]?JSON['stringify'](_0x49feba[_0x7260('0x56')]):_0x7260('0x69'));return respondWithRpcPromise(_0x7260('0x6a'),'acceptMessage',_0x1bf5ba);}return null;})[_0x7260('0x36')](function(_0x23540e){var _0x119525=_0x7260('0x6b')+_0x23540e[_0x7260('0x26')][_0x7260('0x6c')];return db[_0x7260('0x6d')][_0x7260('0x40')](_0x119525,{'type':db[_0x7260('0x6e')][_0x7260('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x585658){return _0x585658;});})['then'](function(_0x36ba0b){if(_0x36ba0b){_0x1bf5ba[_0x7260('0x26')]['contact']=_0x36ba0b[0x0];if(!_0x49feba[_0x7260('0x56')][_0x7260('0x5e')])return;return db[_0x7260('0x70')][_0x7260('0x55')]({'where':{'id':_0x49feba[_0x7260('0x56')]['UserId'],'role':_0x7260('0x60')},'attributes':['id',_0x7260('0x38'),_0x7260('0x71'),_0x7260('0x72'),_0x7260('0x73')],'raw':!![]});}return null;})[_0x7260('0x36')](function(_0x1b5955){if(!_0x1b5955)return null;_0x1bf5ba['message']['agent']=_0x1b5955;return _0x1bf5ba;})['then'](function(_0x25e275){if(_0x25e275){if(_0x49feba[_0x7260('0x56')][_0x7260('0x74')]){_0x1bf5ba[_0x7260('0x26')][_0x7260('0x75')]=util[_0x7260('0x65')](_0x7260('0x76'),_0x49feba[_0x7260('0x5f')]['name']);_0x1bf5ba[_0x7260('0x26')]['channel']=_0x1bf5ba[_0x7260('0x77')];_0x1bf5ba[_0x7260('0x26')]['motionChannel']=_0x1bf5ba[_0x7260('0x77')];_0x1bf5ba[_0x7260('0x26')][_0x7260('0x78')]=_0x7260('0x5a');return respondWithRpcPromise('EventManager',_0x7260('0x79'),{'event':_0x7260('0x7a'),'message':_0x1bf5ba[_0x7260('0x26')]},client9002)['then'](function(){return _0x1bf5ba;});}return _0x1bf5ba;}return null;})[_0x7260('0x36')](respondWithResult(_0x146bf9,null))[_0x7260('0x28')](handleError(_0x146bf9,null));};var interaction_log=require(_0x7260('0x13'))(_0x7260('0x59'));exports[_0x7260('0x33')]=function(_0x327317,_0x2bfe6e,_0x5c2a89){var _0x9af070={'agent':{},'channel':_0x7260('0x7b')};if(_0x327317[_0x7260('0x56')]['id']){delete _0x327317[_0x7260('0x56')]['id'];}_0x327317['body'][_0x7260('0x5e')]=_0x327317[_0x7260('0x56')]['UserId']||_0x327317[_0x7260('0x5f')]['id'];_0x9af070['agent']['id']=_0x327317[_0x7260('0x56')]['UserId'];return db['FaxMessage'][_0x7260('0x55')]({'where':{'id':_0x327317[_0x7260('0x54')]['id'],'UserId':null}})[_0x7260('0x36')](handleEntityNotFound(_0x2bfe6e,null))[_0x7260('0x36')](function(_0xe6b123){if(_0xe6b123){_0x9af070['message']=_0xe6b123[_0x7260('0x61')]({'plain':!![]});return db[_0x7260('0x7c')][_0x7260('0x55')]({'where':{'id':_0xe6b123[_0x7260('0x62')]}});}return null;})[_0x7260('0x36')](handleEntityNotFound(_0x2bfe6e,null))[_0x7260('0x36')](function(_0x171862){if(_0x171862){_0x9af070[_0x7260('0x66')]=_0x171862['get']({'plain':!![]});interaction_log['info'](_0x7260('0x7d'),_0x327317[_0x7260('0x5f')]['id'],_0x327317[_0x7260('0x5f')][_0x7260('0x38')],_0x327317[_0x7260('0x5f')][_0x7260('0x68')],_0x9af070[_0x7260('0x66')]['id'],_0x327317[_0x7260('0x56')]?JSON[_0x7260('0x23')](_0x327317[_0x7260('0x56')]):'null');return respondWithRpcPromise(_0x7260('0x7e'),_0x7260('0x7f'),_0x9af070);}return null;})[_0x7260('0x36')](function(_0x168b13){var _0x414080=_0x7260('0x6b')+_0x168b13['message'][_0x7260('0x6c')];return db[_0x7260('0x6d')]['query'](_0x414080,{'type':db[_0x7260('0x6e')][_0x7260('0x6f')][_0x7260('0x80')],'raw':!![]})['then'](function(_0x361d1f){return _0x361d1f;});})[_0x7260('0x36')](function(_0x598f35){if(_0x598f35){_0x9af070[_0x7260('0x26')][_0x7260('0x81')]=_0x598f35[0x0];if(!_0x327317['body']['UserId'])return;return db['User'][_0x7260('0x55')]({'where':{'id':_0x327317[_0x7260('0x56')]['UserId'],'role':_0x7260('0x60')},'attributes':['id',_0x7260('0x38'),_0x7260('0x71'),_0x7260('0x72'),_0x7260('0x73')],'raw':!![]});}return null;})[_0x7260('0x36')](function(_0x35e283){if(!_0x35e283)return null;_0x9af070['message'][_0x7260('0x60')]=_0x35e283;return _0x9af070;})['then'](function(_0x93454b){if(_0x93454b){_0x93454b[_0x7260('0x26')][_0x7260('0x75')]=util['format']('SIP/%s',_0x327317[_0x7260('0x5f')][_0x7260('0x38')]);_0x93454b[_0x7260('0x26')][_0x7260('0x77')]=_0x9af070[_0x7260('0x77')];_0x93454b[_0x7260('0x26')][_0x7260('0x82')]=_0x9af070[_0x7260('0x77')];_0x93454b['message'][_0x7260('0x78')]='reject';respondWithRpcPromise(_0x7260('0x79'),_0x7260('0x79'),{'event':'rejectmessage','message':_0x93454b[_0x7260('0x26')]},client9002);return _0x9af070;}return null;})['then'](respondWithResult(_0x2bfe6e,null))[_0x7260('0x28')](handleError(_0x2bfe6e,null));};exports[_0x7260('0x83')]=function(_0x455291,_0x50a6f2){var _0xaaec8b;return db['FaxMessage']['create'](_0x455291['body'],{})[_0x7260('0x36')](function(_0x179ef7){_0xaaec8b=_0x179ef7;return db['CmContact'][_0x7260('0x84')]({'where':{'id':_0xaaec8b[_0x7260('0x6c')]}});})['then'](function(_0x1b18e7){if(_[_0x7260('0x63')](_0x1b18e7)){return;}else{_0xaaec8b['fax']=_0x1b18e7[_0x7260('0x7b')];return db[_0x7260('0x85')][_0x7260('0x84')]({'where':{'id':_0xaaec8b['AttachmentId']}});}})[_0x7260('0x36')](function(_0x2037c9){return respondWithRpcPromise(_0x7260('0x86'),_0x7260('0x86'),{'FaxAccountId':_[_0x7260('0x63')](_0x455291['body'])?undefined:_0x455291['body'][_0x7260('0x87')],'path':_[_0x7260('0x63')](_0x2037c9)?undefined:util['format'](_0x7260('0x88'),_0x2037c9[_0x7260('0x89')]),'fax':_[_0x7260('0x63')](_0xaaec8b[_0x7260('0x7b')])?undefined:_0xaaec8b[_0x7260('0x7b')],'AttachmentId':_0xaaec8b[_0x7260('0x8a')]},client9002);})[_0x7260('0x36')](respondWithResult(_0x50a6f2,0xc9))[_0x7260('0x28')](handleError(_0x50a6f2,null));};exports[_0x7260('0x8b')]=function(_0x477ae3,_0x146a3b){var _0x2b0cc6=path['join'](config[_0x7260('0x8c')],_0x7260('0x8d'),_0x7260('0x8e'),'attachments');return db['FaxMessage']['find']({'where':{'id':_0x477ae3['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x7260('0x36')](handleEntityNotFound(_0x146a3b,null))[_0x7260('0x36')](function(_0x1015a0){if(_0x1015a0){return _0x146a3b[_0x7260('0x8b')](path[_0x7260('0x8f')](_0x2b0cc6,_0x1015a0['Attachment'][_0x7260('0x89')]));}})[_0x7260('0x28')](handleError(_0x146a3b,null));};
\ No newline at end of file
+var _0x8083=['model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','keys','include','find','body','params','destroy','describe','fax-interactions','fax','read','readAt','format','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','interaction','info','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','reject','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','motionChannel','CmContact','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','attachments','basename','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','stack','name','send','index','FaxMessage','rawAttributes','type','key'];(function(_0x479cad,_0x4b796c){var _0x551ebb=function(_0x210815){while(--_0x210815){_0x479cad['push'](_0x479cad['shift']());}};_0x551ebb(++_0x4b796c);}(_0x8083,0x1ed));var _0x3808=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x8083[_0x13b796];return _0x54757d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3808('0x0'));var zipdir=require(_0x3808('0x1'));var jsonpatch=require(_0x3808('0x2'));var rp=require('request-promise');var moment=require(_0x3808('0x3'));var BPromise=require(_0x3808('0x4'));var Mustache=require(_0x3808('0x5'));var util=require(_0x3808('0x6'));var path=require(_0x3808('0x7'));var sox=require('sox');var csv=require(_0x3808('0x8'));var ejs=require(_0x3808('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3808('0xa'));var squel=require('squel');var crypto=require(_0x3808('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3808('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3808('0xd'));var Papa=require(_0x3808('0xe'));var Redis=require(_0x3808('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3808('0x10'));var logger=require(_0x3808('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3808('0x12'));var db=require(_0x3808('0x13'))['db'];config[_0x3808('0x14')]=_[_0x3808('0x15')](config['redis'],{'host':_0x3808('0x16'),'port':0x18eb});var socket=require(_0x3808('0x17'))(new Redis(config['redis']));require(_0x3808('0x18'))[_0x3808('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3808('0x1a')][_0x3808('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa28896,_0x4a6c19,_0x50428a,_0x2e82d2){return new BPromise(function(_0x4556b0,_0x356c6e){var _0x3c2a66=_0x2e82d2||client;return _0x3c2a66[_0x3808('0x1c')](_0xa28896,_0x50428a)[_0x3808('0x1d')](function(_0x5da8cb){logger['info'](_0x3808('0x1e'),_0x4a6c19,'request\x20sent');logger[_0x3808('0x1f')](_0x3808('0x20'),_0x4a6c19,_0x3808('0x21'),JSON[_0x3808('0x22')](_0x5da8cb));if(_0x5da8cb[_0x3808('0x23')]){if(_0x5da8cb[_0x3808('0x23')][_0x3808('0x24')]===0x1f4){logger[_0x3808('0x23')](_0x3808('0x1e'),_0x4a6c19,_0x5da8cb[_0x3808('0x23')][_0x3808('0x25')]);return _0x356c6e(_0x5da8cb[_0x3808('0x23')][_0x3808('0x25')]);}logger[_0x3808('0x23')](_0x3808('0x1e'),_0x4a6c19,_0x5da8cb[_0x3808('0x23')][_0x3808('0x25')]);return _0x4556b0(_0x5da8cb[_0x3808('0x23')][_0x3808('0x25')]);}else{logger['info'](_0x3808('0x1e'),_0x4a6c19,_0x3808('0x21'));_0x4556b0(_0x5da8cb[_0x3808('0x26')][_0x3808('0x25')]);}})[_0x3808('0x27')](function(_0x4872e5){logger[_0x3808('0x23')](_0x3808('0x1e'),_0x4a6c19,_0x4872e5);_0x356c6e(_0x4872e5);});});}function respondWithStatusCode(_0x53b5e7,_0x5868af){_0x5868af=_0x5868af||0xcc;return function(_0x552cb8){if(_0x552cb8){return _0x53b5e7[_0x3808('0x28')](_0x5868af);}return _0x53b5e7[_0x3808('0x29')](_0x5868af)[_0x3808('0x2a')]();};}function respondWithResult(_0x4c578e,_0x3a8fd1){_0x3a8fd1=_0x3a8fd1||0xc8;return function(_0x1d4abb){if(_0x1d4abb){return _0x4c578e[_0x3808('0x29')](_0x3a8fd1)[_0x3808('0x2b')](_0x1d4abb);}};}function respondWithFilteredResult(_0x22a93d,_0x5c0982){return function(_0xe4260b){if(_0xe4260b){var _0x12e7bc=typeof _0x5c0982['offset']===_0x3808('0x2c')&&typeof _0x5c0982['limit']===_0x3808('0x2c');var _0x654d81=_0xe4260b[_0x3808('0x2d')];var _0x59d524=_0x12e7bc?0x0:_0x5c0982[_0x3808('0x2e')];var _0x21ce90=_0x12e7bc?_0xe4260b[_0x3808('0x2d')]:_0x5c0982[_0x3808('0x2e')]+_0x5c0982[_0x3808('0x2f')];var _0x25b5b7;if(_0x21ce90>=_0x654d81){_0x21ce90=_0x654d81;_0x25b5b7=0xc8;}else{_0x25b5b7=0xce;}_0x22a93d[_0x3808('0x29')](_0x25b5b7);return _0x22a93d[_0x3808('0x30')](_0x3808('0x31'),_0x59d524+'-'+_0x21ce90+'/'+_0x654d81)['json'](_0xe4260b);}return null;};}function patchUpdates(_0x159ab7){return function(_0x26c8ec){try{jsonpatch['apply'](_0x26c8ec,_0x159ab7,!![]);}catch(_0x7a724b){return BPromise['reject'](_0x7a724b);}return _0x26c8ec['save']();};}function saveUpdates(_0xbab505,_0x12f81a){return function(_0x39383d){if(_0x39383d){return _0x39383d[_0x3808('0x32')](_0xbab505)[_0x3808('0x1d')](function(_0x4c0c65){return _0x4c0c65;});}return null;};}function removeEntity(_0x44fa4f,_0x2aa717){return function(_0x26077b){if(_0x26077b){return _0x26077b['destroy']()[_0x3808('0x1d')](function(){_0x44fa4f['status'](0xcc)[_0x3808('0x2a')]();});}};}function handleEntityNotFound(_0x4eb80d,_0x2e77f1){return function(_0xc4d51b){if(!_0xc4d51b){_0x4eb80d[_0x3808('0x28')](0x194);}return _0xc4d51b;};}function handleError(_0x3bd52d,_0x48628c){_0x48628c=_0x48628c||0x1f4;return function(_0x1ca3eb){logger[_0x3808('0x23')](_0x1ca3eb[_0x3808('0x33')]);if(_0x1ca3eb[_0x3808('0x34')]){delete _0x1ca3eb[_0x3808('0x34')];}_0x3bd52d[_0x3808('0x29')](_0x48628c)[_0x3808('0x35')](_0x1ca3eb);};}exports[_0x3808('0x36')]=function(_0x4e6cc9,_0x27ce48){var _0x264366={},_0x7c3b0e={},_0x456501={'count':0x0,'rows':[]};var _0x33a67e=_['map'](db[_0x3808('0x37')][_0x3808('0x38')],function(_0x3deb3e){return{'name':_0x3deb3e['fieldName'],'type':_0x3deb3e[_0x3808('0x39')][_0x3808('0x3a')]};});_0x7c3b0e[_0x3808('0x3b')]=_[_0x3808('0x3c')](_0x33a67e,_0x3808('0x34'));_0x7c3b0e[_0x3808('0x3d')]=_['keys'](_0x4e6cc9['query']);_0x7c3b0e[_0x3808('0x3e')]=_[_0x3808('0x3f')](_0x7c3b0e[_0x3808('0x3b')],_0x7c3b0e[_0x3808('0x3d')]);_0x264366[_0x3808('0x40')]=_[_0x3808('0x3f')](_0x7c3b0e['model'],qs[_0x3808('0x41')](_0x4e6cc9[_0x3808('0x3d')][_0x3808('0x41')]));_0x264366['attributes']=_0x264366[_0x3808('0x40')][_0x3808('0x42')]?_0x264366['attributes']:_0x7c3b0e[_0x3808('0x3b')];if(!_0x4e6cc9[_0x3808('0x3d')][_0x3808('0x43')](_0x3808('0x44'))){_0x264366[_0x3808('0x2f')]=qs[_0x3808('0x2f')](_0x4e6cc9[_0x3808('0x3d')]['limit']);_0x264366['offset']=qs[_0x3808('0x2e')](_0x4e6cc9[_0x3808('0x3d')][_0x3808('0x2e')]);}_0x264366[_0x3808('0x45')]=qs[_0x3808('0x46')](_0x4e6cc9['query']['sort']);_0x264366[_0x3808('0x47')]=qs[_0x3808('0x3e')](_['pick'](_0x4e6cc9[_0x3808('0x3d')],_0x7c3b0e[_0x3808('0x3e')]),_0x33a67e);if(_0x4e6cc9[_0x3808('0x3d')][_0x3808('0x48')]){_0x264366[_0x3808('0x47')]=_[_0x3808('0x49')](_0x264366[_0x3808('0x47')],{'$or':_[_0x3808('0x3c')](_0x33a67e,function(_0x54c8ac){if(_0x54c8ac[_0x3808('0x39')]!==_0x3808('0x4a')){var _0x270ada={};_0x270ada[_0x54c8ac[_0x3808('0x34')]]={'$like':'%'+_0x4e6cc9['query']['filter']+'%'};return _0x270ada;}})});}_0x264366=_['merge']({},_0x264366,_0x4e6cc9[_0x3808('0x4b')]);var _0xd18225={'where':_0x264366[_0x3808('0x47')]};return db[_0x3808('0x37')][_0x3808('0x2d')](_0xd18225)[_0x3808('0x1d')](function(_0x2a83e1){_0x456501[_0x3808('0x2d')]=_0x2a83e1;if(_0x4e6cc9['query'][_0x3808('0x4c')]){_0x264366['include']=[{'all':!![]}];}return db[_0x3808('0x37')][_0x3808('0x4d')](_0x264366);})[_0x3808('0x1d')](function(_0x129223){_0x456501['rows']=_0x129223;return _0x456501;})['then'](respondWithFilteredResult(_0x27ce48,_0x264366))[_0x3808('0x27')](handleError(_0x27ce48,null));};exports[_0x3808('0x4e')]=function(_0x58a4cc,_0x4dc814){var _0x137224={'raw':!![],'where':{'id':_0x58a4cc['params']['id']}},_0x5ee074={};_0x5ee074[_0x3808('0x3b')]=_[_0x3808('0x4f')](db[_0x3808('0x37')][_0x3808('0x38')]);_0x5ee074[_0x3808('0x3d')]=_[_0x3808('0x4f')](_0x58a4cc[_0x3808('0x3d')]);_0x5ee074[_0x3808('0x3e')]=_[_0x3808('0x3f')](_0x5ee074[_0x3808('0x3b')],_0x5ee074[_0x3808('0x3d')]);_0x137224[_0x3808('0x40')]=_[_0x3808('0x3f')](_0x5ee074[_0x3808('0x3b')],qs[_0x3808('0x41')](_0x58a4cc[_0x3808('0x3d')][_0x3808('0x41')]));_0x137224[_0x3808('0x40')]=_0x137224[_0x3808('0x40')][_0x3808('0x42')]?_0x137224[_0x3808('0x40')]:_0x5ee074[_0x3808('0x3b')];if(_0x58a4cc[_0x3808('0x3d')][_0x3808('0x4c')]){_0x137224[_0x3808('0x50')]=[{'all':!![]}];}_0x137224=_[_0x3808('0x49')]({},_0x137224,_0x58a4cc[_0x3808('0x4b')]);return db['FaxMessage'][_0x3808('0x51')](_0x137224)[_0x3808('0x1d')](handleEntityNotFound(_0x4dc814,null))['then'](respondWithResult(_0x4dc814,null))[_0x3808('0x27')](handleError(_0x4dc814,null));};exports[_0x3808('0x32')]=function(_0x3eaca2,_0x13dcb3){if(_0x3eaca2[_0x3808('0x52')]['id']){delete _0x3eaca2['body']['id'];}return db[_0x3808('0x37')][_0x3808('0x51')]({'where':{'id':_0x3eaca2[_0x3808('0x53')]['id']}})[_0x3808('0x1d')](handleEntityNotFound(_0x13dcb3,null))[_0x3808('0x1d')](saveUpdates(_0x3eaca2['body'],null))[_0x3808('0x1d')](respondWithResult(_0x13dcb3,null))['catch'](handleError(_0x13dcb3,null));};exports[_0x3808('0x54')]=function(_0x3cd936,_0x27cd35){return db['FaxMessage'][_0x3808('0x51')]({'where':{'id':_0x3cd936[_0x3808('0x53')]['id']}})[_0x3808('0x1d')](handleEntityNotFound(_0x27cd35,null))[_0x3808('0x1d')](removeEntity(_0x27cd35,null))[_0x3808('0x27')](handleError(_0x27cd35,null));};exports[_0x3808('0x55')]=function(_0x508135,_0x42d29c){return db[_0x3808('0x37')]['describe']()[_0x3808('0x1d')](respondWithResult(_0x42d29c,null))[_0x3808('0x27')](handleError(_0x42d29c,null));};var interaction_log=require(_0x3808('0x11'))(_0x3808('0x56'));exports['accept']=function(_0x13a69c,_0x1d7df8,_0x4b82c8){var _0x66d4ea={'agent':{},'channel':_0x3808('0x57')};if(_0x13a69c[_0x3808('0x52')]['id']){delete _0x13a69c[_0x3808('0x52')]['id'];}_0x13a69c[_0x3808('0x52')][_0x3808('0x58')]=!![];_0x13a69c[_0x3808('0x52')][_0x3808('0x59')]=moment()[_0x3808('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x13a69c[_0x3808('0x52')]['UserId']=_0x13a69c['body'][_0x3808('0x5b')]||_0x13a69c[_0x3808('0x5c')]['id'];_0x66d4ea[_0x3808('0x5d')]['id']=_0x13a69c[_0x3808('0x52')][_0x3808('0x5b')];return db[_0x3808('0x37')][_0x3808('0x51')]({'where':{'id':_0x13a69c[_0x3808('0x53')]['id'],'UserId':null}})[_0x3808('0x1d')](handleEntityNotFound(_0x1d7df8,null))['then'](saveUpdates(_0x13a69c['body'],null))[_0x3808('0x1d')](function(_0x8fae7d){if(_0x8fae7d){_0x66d4ea[_0x3808('0x25')]=_0x8fae7d['get']({'plain':!![]});return db[_0x3808('0x5e')][_0x3808('0x51')]({'where':{'id':_0x8fae7d[_0x3808('0x5f')]}});}return null;})[_0x3808('0x1d')](handleEntityNotFound(_0x1d7df8,null))[_0x3808('0x1d')](function(_0x2e6375){if(_0x2e6375){return _0x2e6375[_0x3808('0x32')]({'UserId':_0x13a69c['body'][_0x3808('0x5b')],'read1stAt':_['isNil'](_0x2e6375[_0x3808('0x60')])?moment()[_0x3808('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3808('0x1d')](function(_0x5a765d){if(_0x5a765d){_0x66d4ea[_0x3808('0x61')]=_0x5a765d['get']({'plain':!![]});interaction_log[_0x3808('0x62')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13a69c[_0x3808('0x5c')]['id'],_0x13a69c['user'][_0x3808('0x34')],_0x13a69c[_0x3808('0x5c')][_0x3808('0x63')],_0x66d4ea['interaction']['id'],_0x13a69c[_0x3808('0x52')]?JSON[_0x3808('0x22')](_0x13a69c[_0x3808('0x52')]):_0x3808('0x64'));return respondWithRpcPromise(_0x3808('0x65'),_0x3808('0x66'),_0x66d4ea);}return null;})[_0x3808('0x1d')](function(_0x1a54d4){var _0x516e93='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1a54d4['message']['ContactId'];return db[_0x3808('0x67')][_0x3808('0x3d')](_0x516e93,{'type':db[_0x3808('0x68')][_0x3808('0x69')]['SELECT'],'raw':!![]})['then'](function(_0x4d4369){return _0x4d4369;});})[_0x3808('0x1d')](function(_0x470c0f){if(_0x470c0f){_0x66d4ea[_0x3808('0x25')][_0x3808('0x6a')]=_0x470c0f[0x0];if(!_0x13a69c[_0x3808('0x52')][_0x3808('0x5b')])return;return db[_0x3808('0x6b')][_0x3808('0x51')]({'where':{'id':_0x13a69c[_0x3808('0x52')]['UserId'],'role':_0x3808('0x5d')},'attributes':['id','name',_0x3808('0x6c'),_0x3808('0x6d'),_0x3808('0x6e')],'raw':!![]});}return null;})[_0x3808('0x1d')](function(_0x1ec881){if(!_0x1ec881)return null;_0x66d4ea[_0x3808('0x25')]['agent']=_0x1ec881;return _0x66d4ea;})['then'](function(_0x4958d3){if(_0x4958d3){if(_0x13a69c[_0x3808('0x52')][_0x3808('0x6f')]){_0x66d4ea[_0x3808('0x25')][_0x3808('0x70')]=util['format'](_0x3808('0x71'),_0x13a69c[_0x3808('0x5c')][_0x3808('0x34')]);_0x66d4ea[_0x3808('0x25')][_0x3808('0x72')]=_0x66d4ea[_0x3808('0x72')];_0x66d4ea[_0x3808('0x25')]['motionChannel']=_0x66d4ea[_0x3808('0x72')];_0x66d4ea[_0x3808('0x25')][_0x3808('0x73')]=_0x3808('0x74');return respondWithRpcPromise(_0x3808('0x75'),_0x3808('0x75'),{'event':'acceptmessage','message':_0x66d4ea['message']},client9002)[_0x3808('0x1d')](function(){return _0x66d4ea;});}return _0x66d4ea;}return null;})[_0x3808('0x1d')](respondWithResult(_0x1d7df8,null))[_0x3808('0x27')](handleError(_0x1d7df8,null));};var interaction_log=require(_0x3808('0x11'))(_0x3808('0x56'));exports[_0x3808('0x76')]=function(_0x278433,_0x2986af,_0x2c9fd8){var _0x408593={'agent':{},'channel':_0x3808('0x57')};if(_0x278433[_0x3808('0x52')]['id']){delete _0x278433[_0x3808('0x52')]['id'];}_0x278433['body'][_0x3808('0x5b')]=_0x278433[_0x3808('0x52')]['UserId']||_0x278433['user']['id'];_0x408593[_0x3808('0x5d')]['id']=_0x278433[_0x3808('0x52')][_0x3808('0x5b')];return db[_0x3808('0x37')][_0x3808('0x51')]({'where':{'id':_0x278433[_0x3808('0x53')]['id'],'UserId':null}})[_0x3808('0x1d')](handleEntityNotFound(_0x2986af,null))[_0x3808('0x1d')](function(_0x8ceb02){if(_0x8ceb02){_0x408593[_0x3808('0x25')]=_0x8ceb02['get']({'plain':!![]});return db[_0x3808('0x5e')][_0x3808('0x51')]({'where':{'id':_0x8ceb02[_0x3808('0x5f')]}});}return null;})[_0x3808('0x1d')](handleEntityNotFound(_0x2986af,null))[_0x3808('0x1d')](function(_0x4e0dca){if(_0x4e0dca){_0x408593['interaction']=_0x4e0dca[_0x3808('0x77')]({'plain':!![]});interaction_log[_0x3808('0x62')](_0x3808('0x78'),_0x278433['user']['id'],_0x278433['user'][_0x3808('0x34')],_0x278433[_0x3808('0x5c')][_0x3808('0x63')],_0x408593['interaction']['id'],_0x278433['body']?JSON[_0x3808('0x22')](_0x278433[_0x3808('0x52')]):_0x3808('0x64'));return respondWithRpcPromise('RejectMessage',_0x3808('0x79'),_0x408593);}return null;})[_0x3808('0x1d')](function(_0x153a13){var _0x570d3a=_0x3808('0x7a')+_0x153a13['message'][_0x3808('0x7b')];return db['sequelize'][_0x3808('0x3d')](_0x570d3a,{'type':db[_0x3808('0x68')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3808('0x1d')](function(_0x311f57){return _0x311f57;});})[_0x3808('0x1d')](function(_0x39ad58){if(_0x39ad58){_0x408593[_0x3808('0x25')][_0x3808('0x6a')]=_0x39ad58[0x0];if(!_0x278433[_0x3808('0x52')][_0x3808('0x5b')])return;return db[_0x3808('0x6b')][_0x3808('0x51')]({'where':{'id':_0x278433[_0x3808('0x52')][_0x3808('0x5b')],'role':_0x3808('0x5d')},'attributes':['id',_0x3808('0x34'),_0x3808('0x6c'),_0x3808('0x6d'),_0x3808('0x6e')],'raw':!![]});}return null;})['then'](function(_0x53739b){if(!_0x53739b)return null;_0x408593[_0x3808('0x25')][_0x3808('0x5d')]=_0x53739b;return _0x408593;})[_0x3808('0x1d')](function(_0x1ce94a){if(_0x1ce94a){_0x1ce94a['message'][_0x3808('0x70')]=util[_0x3808('0x5a')](_0x3808('0x71'),_0x278433['user'][_0x3808('0x34')]);_0x1ce94a['message']['channel']=_0x408593[_0x3808('0x72')];_0x1ce94a[_0x3808('0x25')][_0x3808('0x7c')]=_0x408593[_0x3808('0x72')];_0x1ce94a['message']['event']=_0x3808('0x76');respondWithRpcPromise('EventManager',_0x3808('0x75'),{'event':'rejectmessage','message':_0x1ce94a[_0x3808('0x25')]},client9002);return _0x408593;}return null;})[_0x3808('0x1d')](respondWithResult(_0x2986af,null))[_0x3808('0x27')](handleError(_0x2986af,null));};exports['create']=function(_0x27b948,_0x25df9c){var _0x13ff07;return db[_0x3808('0x37')]['create'](_0x27b948[_0x3808('0x52')],{})[_0x3808('0x1d')](function(_0x1cc43d){_0x13ff07=_0x1cc43d;return db[_0x3808('0x7d')]['findOne']({'where':{'id':_0x13ff07[_0x3808('0x7b')]}});})[_0x3808('0x1d')](function(_0x1930c3){if(_[_0x3808('0x7e')](_0x1930c3)){return;}else{_0x13ff07[_0x3808('0x57')]=_0x1930c3[_0x3808('0x57')];return db[_0x3808('0x7f')]['findOne']({'where':{'id':_0x13ff07[_0x3808('0x80')]}});}})[_0x3808('0x1d')](function(_0x20cc5d){return respondWithRpcPromise(_0x3808('0x81'),_0x3808('0x81'),{'FaxAccountId':_[_0x3808('0x7e')](_0x27b948[_0x3808('0x52')])?undefined:_0x27b948[_0x3808('0x52')][_0x3808('0x82')],'path':_['isNil'](_0x20cc5d)?undefined:util['format'](_0x3808('0x83'),_0x20cc5d['basename']),'fax':_['isNil'](_0x13ff07['fax'])?undefined:_0x13ff07[_0x3808('0x57')],'AttachmentId':_0x13ff07[_0x3808('0x80')]},client9002);})[_0x3808('0x1d')](respondWithResult(_0x25df9c,0xc9))[_0x3808('0x27')](handleError(_0x25df9c,null));};exports[_0x3808('0x84')]=function(_0x3eb6fb,_0xfb2f63){var _0x5ccaaf=path[_0x3808('0x85')](config[_0x3808('0x86')],_0x3808('0x87'),'files',_0x3808('0x88'));return db['FaxMessage'][_0x3808('0x51')]({'where':{'id':_0x3eb6fb[_0x3808('0x53')]['id']},'include':[{'model':db[_0x3808('0x7f')],'as':_0x3808('0x7f')}]})[_0x3808('0x1d')](handleEntityNotFound(_0xfb2f63,null))[_0x3808('0x1d')](function(_0x3bab31){if(_0x3bab31){return _0xfb2f63[_0x3808('0x84')](path[_0x3808('0x85')](_0x5ccaaf,_0x3bab31[_0x3808('0x7f')][_0x3808('0x89')]));}})['catch'](handleError(_0xfb2f63,null));};
\ No newline at end of file
index 59b8cc6..bda5a67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55c1=['hasOwnProperty','exports','events','../../mysqldb','update','remove','emit'];(function(_0x50cbb4,_0x196b3b){var _0x246938=function(_0xc2ce17){while(--_0xc2ce17){_0x50cbb4['push'](_0x50cbb4['shift']());}};_0x246938(++_0x196b3b);}(_0x55c1,0x1e5));var _0x155c=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x55c1[_0x3ed054];return _0x16dd95;};'use strict';var EventEmitter=require(_0x155c('0x0'));var FaxMessage=require(_0x155c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x155c('0x2'),'afterDestroy':_0x155c('0x3')};function emitEvent(_0x30444a){return function(_0x64c8aa,_0xb127e8,_0x5305d5){FaxMessageEvents[_0x155c('0x4')](_0x30444a+':'+_0x64c8aa['id'],_0x64c8aa);FaxMessageEvents[_0x155c('0x4')](_0x30444a,_0x64c8aa);_0x5305d5(null);};}for(var e in events){if(events[_0x155c('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x155c('0x6')]=FaxMessageEvents;
\ No newline at end of file
+var _0x3f8a=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x125d11,_0xd33527){var _0xd77ef2=function(_0x238141){while(--_0x238141){_0x125d11['push'](_0x125d11['shift']());}};_0xd77ef2(++_0xd33527);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2c60de,_0x565bf9){_0x2c60de=_0x2c60de-0x0;var _0x277399=_0x3f8a[_0x2c60de];return _0x277399;};'use strict';var EventEmitter=require(_0xa3f8('0x0'));var FaxMessage=require(_0xa3f8('0x1'))['db'][_0xa3f8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa3f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3f8('0x4'),'afterDestroy':_0xa3f8('0x5')};function emitEvent(_0x928738){return function(_0x15b6aa,_0x2553fd,_0x2847b4){FaxMessageEvents[_0xa3f8('0x6')](_0x928738+':'+_0x15b6aa['id'],_0x15b6aa);FaxMessageEvents[_0xa3f8('0x6')](_0x928738,_0x15b6aa);_0x2847b4(null);};}for(var e in events){if(events[_0xa3f8('0x7')](e)){var event=events[e];FaxMessage[_0xa3f8('0x8')](e,emitEvent(event));}}module[_0xa3f8('0x9')]=FaxMessageEvents;
\ No newline at end of file
index 17d957c..375b698 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7e3=['FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','catch','util','api','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define'];(function(_0x490dca,_0x49324a){var _0x2212a6=function(_0x1eddd4){while(--_0x1eddd4){_0x490dca['push'](_0x490dca['shift']());}};_0x2212a6(++_0x49324a);}(_0xd7e3,0x142));var _0x3d7e=function(_0x59b86c,_0x244d0d){_0x59b86c=_0x59b86c-0x0;var _0x4936fc=_0xd7e3[_0x59b86c];return _0x4936fc;};'use strict';var _=require('lodash');var util=require(_0x3d7e('0x0'));var logger=require('../../config/logger')(_0x3d7e('0x1'));var moment=require(_0x3d7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x3d7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d7e('0x4'));var config=require(_0x3d7e('0x5'));var attributes=require(_0x3d7e('0x6'));module['exports']=function(_0x5a1894,_0x310e1b){return _0x5a1894[_0x3d7e('0x7')](_0x3d7e('0x8'),attributes,{'tableName':_0x3d7e('0x9'),'paranoid':![],'indexes':[{'name':_0x3d7e('0xa'),'fields':['body'],'type':_0x3d7e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3af511,_0x576428,_0x31eb3c){var _0x2e66f2=_0x5a1894[_0x3d7e('0xc')];var _0x37a207=_0x3af511[_0x3d7e('0xd')]({'plain':!![]});if(_0x37a207[_0x3d7e('0xe')][_0x3d7e('0xf')]()==='in'||_0x37a207[_0x3d7e('0xe')]['toLowerCase']()==='out'&&!_0x37a207[_0x3d7e('0x10')]&&!_[_0x3d7e('0x11')](_0x37a207[_0x3d7e('0x12')])){_0x2e66f2[_0x3d7e('0x13')][_0x3d7e('0x14')]({'where':{'id':_0x37a207['FaxInteractionId']}})['then'](function(_0x4e3fdc){if(_0x4e3fdc){_0x4e3fdc['update']({'lastMsgAt':_0x37a207['createdAt'],'lastMsgDirection':_0x37a207['direction'][_0x3d7e('0xf')]()});}})[_0x3d7e('0x15')](function(_0x41122b){console['error'](_0x41122b);});}_0x31eb3c();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x970e=['request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x317bfa,_0x183068){var _0x3ce05d=function(_0x27db0e){while(--_0x27db0e){_0x317bfa['push'](_0x317bfa['shift']());}};_0x3ce05d(++_0x183068);}(_0x970e,0x1f2));var _0xe970=function(_0x2178c3,_0x454b36){_0x2178c3=_0x2178c3-0x0;var _0x41416c=_0x970e[_0x2178c3];return _0x41416c;};'use strict';var _=require(_0xe970('0x0'));var util=require(_0xe970('0x1'));var logger=require(_0xe970('0x2'))(_0xe970('0x3'));var moment=require(_0xe970('0x4'));var BPromise=require(_0xe970('0x5'));var rp=require(_0xe970('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe970('0x7'));var config=require(_0xe970('0x8'));var attributes=require(_0xe970('0x9'));module[_0xe970('0xa')]=function(_0x21f195,_0x26d746){return _0x21f195['define'](_0xe970('0xb'),attributes,{'tableName':_0xe970('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xe970('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5df09d,_0x88659b,_0x241484){var _0x3cd97d=_0x21f195['models'];var _0x58045c=_0x5df09d[_0xe970('0xe')]({'plain':!![]});if(_0x58045c[_0xe970('0xf')][_0xe970('0x10')]()==='in'||_0x58045c[_0xe970('0xf')][_0xe970('0x10')]()===_0xe970('0x11')&&!_0x58045c[_0xe970('0x12')]&&!_[_0xe970('0x13')](_0x58045c[_0xe970('0x14')])){_0x3cd97d[_0xe970('0x15')][_0xe970('0x16')]({'where':{'id':_0x58045c['FaxInteractionId']}})['then'](function(_0x1b4e3e){if(_0x1b4e3e){_0x1b4e3e[_0xe970('0x17')]({'lastMsgAt':_0x58045c[_0xe970('0x18')],'lastMsgDirection':_0x58045c['direction'][_0xe970('0x10')]()});}})[_0xe970('0x19')](function(_0xe35290){console[_0xe970('0x1a')](_0xe35290);});}_0x241484();}},'charset':'utf8mb4','collate':_0xe970('0x1b')});};
\ No newline at end of file
index 6bd36e8..dce84d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4862bb,_0x752b16){var _0x2653c6=function(_0x121a3d){while(--_0x121a3d){_0x4862bb['push'](_0x4862bb['shift']());}};_0x2653c6(++_0x752b16);}(_0x84ab,0x12f));var _0xb84a=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x84ab[_0xcd0918];return _0x250704;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});};
\ No newline at end of file
+var _0x9c44=['code','message','info','catch','FaxMessage','create','body','options','CreateFaxMessage','stringify','UpdateFaxMessage','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});config[_0x49c4('0x9')]=_[_0x49c4('0xa')](config[_0x49c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0xb'))(new Redis(config[_0x49c4('0x9')]));require(_0x49c4('0xc'))[_0x49c4('0xd')](socket);function respondWithRpcPromise(_0x4c7d3a,_0x5ab4a3,_0x451ea6){return new BPromise(function(_0x313e73,_0x58cad7){return client[_0x49c4('0xe')](_0x4c7d3a,_0x451ea6)[_0x49c4('0xf')](function(_0x4adb3c){logger['info'](_0x49c4('0x10'),_0x5ab4a3,_0x49c4('0x11'));logger['debug'](_0x49c4('0x12'),_0x5ab4a3,_0x49c4('0x11'),JSON['stringify'](_0x4adb3c));if(_0x4adb3c[_0x49c4('0x13')]){if(_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x14')]===0x1f4){logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x58cad7(_0x4adb3c[_0x49c4('0x13')]['message']);}logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x313e73(_0x4adb3c[_0x49c4('0x13')]['message']);}else{logger[_0x49c4('0x16')](_0x49c4('0x10'),_0x5ab4a3,'request\x20sent');_0x313e73(_0x4adb3c['result'][_0x49c4('0x15')]);}})[_0x49c4('0x17')](function(_0x3addb2){logger['error'](_0x49c4('0x10'),_0x5ab4a3,_0x3addb2);_0x58cad7(_0x3addb2);});});}exports['CreateFaxMessage']=function(_0x2cbd50){var _0x1806c2=this;return new Promise(function(_0xe31fcc,_0x291526){return db[_0x49c4('0x18')][_0x49c4('0x19')](_0x2cbd50[_0x49c4('0x1a')],{'raw':_0x2cbd50[_0x49c4('0x1b')]?_0x2cbd50[_0x49c4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57f502){logger[_0x49c4('0x16')]('CreateFaxMessage',_0x2cbd50);logger['debug'](_0x49c4('0x1c'),_0x2cbd50,JSON[_0x49c4('0x1d')](_0x57f502));_0xe31fcc(_0x57f502);})[_0x49c4('0x17')](function(_0xd335e4){logger['error']('CreateFaxMessage',_0xd335e4[_0x49c4('0x15')],_0x2cbd50);_0x291526(_0x1806c2[_0x49c4('0x13')](0x1f4,_0xd335e4['message']));});});};exports[_0x49c4('0x1e')]=function(_0x43e014){var _0x210159=this;return new Promise(function(_0xa7a826,_0x531d92){return db['FaxMessage'][_0x49c4('0x1f')](_0x43e014['body'],{'raw':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e014[_0x49c4('0x1b')]?_0x43e014['options'][_0x49c4('0x21')]||null:null,'attributes':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x22')]||null:null,'limit':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x23')]||null:null})[_0x49c4('0xf')](function(_0x17b50f){logger[_0x49c4('0x16')](_0x49c4('0x1e'),_0x43e014);logger['debug']('UpdateFaxMessage',_0x43e014,JSON['stringify'](_0x17b50f));_0xa7a826(_0x17b50f);})[_0x49c4('0x17')](function(_0x7ee704){logger[_0x49c4('0x13')](_0x49c4('0x1e'),_0x7ee704[_0x49c4('0x15')],_0x43e014);_0x531d92(_0x210159['error'](0x1f4,_0x7ee704[_0x49c4('0x15')]));});});};
\ No newline at end of file
index 7e27e8b..a9b12a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1088=['removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1088,0xac));var _0x8108=function(_0x3d1644,_0x5e9460){_0x3d1644=_0x3d1644-0x0;var _0x5a3c39=_0x1088[_0x3d1644];return _0x5a3c39;};'use strict';var FaxMessageEvents=require(_0x8108('0x0'));var events=[_0x8108('0x1'),_0x8108('0x2'),_0x8108('0x3')];function createListener(_0x297ec5,_0x5047a6){return function(_0x30e2c2){_0x5047a6['emit'](_0x297ec5,_0x30e2c2);};}function removeListener(_0x2c56ba,_0x180d26){return function(){FaxMessageEvents[_0x8108('0x4')](_0x2c56ba,_0x180d26);};}exports[_0x8108('0x5')]=function(_0x1c508b){for(var _0x2b9438=0x0,_0x2449cb=events[_0x8108('0x6')];_0x2b9438<_0x2449cb;_0x2b9438++){var _0x553faf=events[_0x2b9438];var _0x98f360=createListener(_0x8108('0x7')+_0x553faf,_0x1c508b);FaxMessageEvents['on'](_0x553faf,_0x98f360);}};
\ No newline at end of file
+var _0x18bd=['removeListener','length','faxMessage:','./faxMessage.events','save','remove','emit'];(function(_0x52b52b,_0x3cf1d1){var _0x4c5141=function(_0x3f2f12){while(--_0x3f2f12){_0x52b52b['push'](_0x52b52b['shift']());}};_0x4c5141(++_0x3cf1d1);}(_0x18bd,0xce));var _0xd18b=function(_0xffa255,_0x363b68){_0xffa255=_0xffa255-0x0;var _0x4536ae=_0x18bd[_0xffa255];return _0x4536ae;};'use strict';var FaxMessageEvents=require(_0xd18b('0x0'));var events=[_0xd18b('0x1'),_0xd18b('0x2'),'update'];function createListener(_0x39766b,_0x3abf7c){return function(_0xf00f42){_0x3abf7c[_0xd18b('0x3')](_0x39766b,_0xf00f42);};}function removeListener(_0x2081ef,_0x100130){return function(){FaxMessageEvents[_0xd18b('0x4')](_0x2081ef,_0x100130);};}exports['register']=function(_0x598250){for(var _0x2268e2=0x0,_0x1de1c5=events[_0xd18b('0x5')];_0x2268e2<_0x1de1c5;_0x2268e2++){var _0x2d3de5=events[_0x2268e2];var _0x437f29=createListener(_0xd18b('0x6')+_0x2d3de5,_0x598250);FaxMessageEvents['on'](_0x2d3de5,_0x437f29);}};
\ No newline at end of file
index 0c1634b..e3e7590 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb688=['accept','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb688,0xcf));var _0x8b68=function(_0x51cdca,_0x1cd055){_0x51cdca=_0x51cdca-0x0;var _0x58b208=_0xb688[_0x51cdca];return _0x58b208;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')]('/',auth[_0x8b68('0xc')](),interaction['tracked'](_0x8b68('0x13'),_0x8b68('0x14')),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')](_0x8b68('0x18'),auth['isAuthenticated'](),controller[_0x8b68('0x19')]);router['put']('/:id/reject',auth[_0x8b68('0xc')](),controller[_0x8b68('0x1a')]);router[_0x8b68('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x8b68('0x1c')]);module['exports']=router;
\ No newline at end of file
+var _0x5b02=['put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','show','download','post','tracked','fax','faxmessage:create','create'];(function(_0x26e3e2,_0x1e5dd7){var _0x502226=function(_0x4e0044){while(--_0x4e0044){_0x26e3e2['push'](_0x26e3e2['shift']());}};_0x502226(++_0x1e5dd7);}(_0x5b02,0xe9));var _0x25b0=function(_0x5c9ac9,_0x50cd17){_0x5c9ac9=_0x5c9ac9-0x0;var _0x2770b4=_0x5b02[_0x5c9ac9];return _0x2770b4;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x8')]('/:id/download',auth[_0x25b0('0x9')](),controller[_0x25b0('0xd')]);router[_0x25b0('0xe')]('/',auth[_0x25b0('0x9')](),interaction[_0x25b0('0xf')](_0x25b0('0x10'),_0x25b0('0x11')),controller[_0x25b0('0x12')]);router[_0x25b0('0x13')](_0x25b0('0x14'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x15')]);router[_0x25b0('0x13')](_0x25b0('0x16'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x17')]);router[_0x25b0('0x13')](_0x25b0('0x18'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x19')]);router[_0x25b0('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x25b0('0x1b')]);module['exports']=router;
\ No newline at end of file
index a5a093f..7c10ed3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30e9=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30e9,0x121));var _0x930e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x30e9[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x930e('0x0'));module[_0x930e('0x1')]={'name':{'type':Sequelize[_0x930e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x930e('0x2')]},'timeout':{'type':Sequelize[_0x930e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x930e('0x4')](_0x930e('0x5'),_0x930e('0x6'),_0x930e('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x930e('0x3')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x85e6=['STRING','ENUM','rrmemory','beepall','INTEGER','sequelize','exports','name'];(function(_0x20e8ee,_0x596118){var _0x2243d8=function(_0x20428d){while(--_0x20428d){_0x20e8ee['push'](_0x20e8ee['shift']());}};_0x2243d8(++_0x596118);}(_0x85e6,0x1a5));var _0x685e=function(_0x458d2d,_0x435f78){_0x458d2d=_0x458d2d-0x0;var _0x56b4fe=_0x85e6[_0x458d2d];return _0x56b4fe;};'use strict';var Sequelize=require(_0x685e('0x0'));module[_0x685e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x685e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x685e('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x685e('0x4')](_0x685e('0x5'),_0x685e('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x685e('0x7')],'defaultValue':0x0}};
\ No newline at end of file
index c684e09..56fcc53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25c8=['name','send','map','FaxQueue','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','FaxQueueId','UserId','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','User','field','tq.TeamId','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack'];(function(_0x4f8ac0,_0x5f2776){var _0x2b6329=function(_0x3d2c73){while(--_0x3d2c73){_0x4f8ac0['push'](_0x4f8ac0['shift']());}};_0x2b6329(++_0x5f2776);}(_0x25c8,0x16e));var _0x825c=function(_0x2899e3,_0x5b05a7){_0x2899e3=_0x2899e3-0x0;var _0x24fcbd=_0x25c8[_0x2899e3];return _0x24fcbd;};'use strict';var emlformat=require(_0x825c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x825c('0x1'));var jsonpatch=require(_0x825c('0x2'));var rp=require(_0x825c('0x3'));var moment=require(_0x825c('0x4'));var BPromise=require(_0x825c('0x5'));var Mustache=require(_0x825c('0x6'));var util=require(_0x825c('0x7'));var path=require(_0x825c('0x8'));var sox=require(_0x825c('0x9'));var csv=require(_0x825c('0xa'));var ejs=require(_0x825c('0xb'));var fs=require('fs');var fs_extra=require(_0x825c('0xc'));var _=require('lodash');var squel=require(_0x825c('0xd'));var crypto=require(_0x825c('0xe'));var jsforce=require(_0x825c('0xf'));var deskjs=require(_0x825c('0x10'));var toCsv=require(_0x825c('0xa'));var querystring=require(_0x825c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x825c('0x12'));var qs=require(_0x825c('0x13'));var as=require(_0x825c('0x14'));var hardwareService=require(_0x825c('0x15'));var logger=require(_0x825c('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x825c('0x17'));var db=require('../../mysqldb')['db'];config[_0x825c('0x18')]=_['defaults'](config['redis'],{'host':_0x825c('0x19'),'port':0x18eb});var socket=require(_0x825c('0x1a'))(new Redis(config['redis']));require(_0x825c('0x1b'))[_0x825c('0x1c')](socket);function respondWithStatusCode(_0xb742bf,_0x3b7241){_0x3b7241=_0x3b7241||0xcc;return function(_0x177248){if(_0x177248){return _0xb742bf[_0x825c('0x1d')](_0x3b7241);}return _0xb742bf['status'](_0x3b7241)['end']();};}function respondWithResult(_0x3eb965,_0x6b4102){_0x6b4102=_0x6b4102||0xc8;return function(_0x364da6){if(_0x364da6){return _0x3eb965[_0x825c('0x1e')](_0x6b4102)['json'](_0x364da6);}};}function respondWithFilteredResult(_0x371ca5,_0x462037){return function(_0x297ff6){if(_0x297ff6){var _0xd12a36=typeof _0x462037['offset']===_0x825c('0x1f')&&typeof _0x462037[_0x825c('0x20')]==='undefined';var _0x51b7b1=_0x297ff6[_0x825c('0x21')];var _0x18cf37=_0xd12a36?0x0:_0x462037[_0x825c('0x22')];var _0x216812=_0xd12a36?_0x297ff6[_0x825c('0x21')]:_0x462037[_0x825c('0x22')]+_0x462037[_0x825c('0x20')];var _0x5afc60;if(_0x216812>=_0x51b7b1){_0x216812=_0x51b7b1;_0x5afc60=0xc8;}else{_0x5afc60=0xce;}_0x371ca5['status'](_0x5afc60);return _0x371ca5['set'](_0x825c('0x23'),_0x18cf37+'-'+_0x216812+'/'+_0x51b7b1)[_0x825c('0x24')](_0x297ff6);}return null;};}function patchUpdates(_0x597ec1){return function(_0x44cf7e){try{jsonpatch['apply'](_0x44cf7e,_0x597ec1,!![]);}catch(_0x521c01){return BPromise[_0x825c('0x25')](_0x521c01);}return _0x44cf7e[_0x825c('0x26')]();};}function saveUpdates(_0x44050d,_0x50daab){return function(_0xef8ec9){if(_0xef8ec9){return _0xef8ec9[_0x825c('0x27')](_0x44050d)[_0x825c('0x28')](function(_0x12e570){return _0x12e570;});}return null;};}function removeEntity(_0xa5373e,_0x3a8c52){return function(_0x4473c5){if(_0x4473c5){return _0x4473c5[_0x825c('0x29')]()[_0x825c('0x28')](function(){var _0x4ea6e2=_0x4473c5[_0x825c('0x2a')]({'plain':!![]});var _0x270daa=_0x825c('0x2b');return db[_0x825c('0x2c')]['destroy']({'where':{'type':_0x270daa,'resourceId':_0x4ea6e2['id']}})[_0x825c('0x28')](function(){return _0x4473c5;});})[_0x825c('0x28')](function(){_0xa5373e['status'](0xcc)[_0x825c('0x2d')]();});}};}function handleEntityNotFound(_0x239e49,_0x373602){return function(_0xa9393e){if(!_0xa9393e){_0x239e49[_0x825c('0x1d')](0x194);}return _0xa9393e;};}function handleError(_0x5c7b5a,_0x46145f){_0x46145f=_0x46145f||0x1f4;return function(_0x3926a5){logger[_0x825c('0x2e')](_0x3926a5[_0x825c('0x2f')]);if(_0x3926a5[_0x825c('0x30')]){delete _0x3926a5[_0x825c('0x30')];}_0x5c7b5a[_0x825c('0x1e')](_0x46145f)[_0x825c('0x31')](_0x3926a5);};}exports['index']=function(_0x240b00,_0x3e1f9b){var _0x5594cc={},_0x5c7877={},_0x421d1b={'count':0x0,'rows':[]};var _0x5f0d52=_[_0x825c('0x32')](db[_0x825c('0x33')][_0x825c('0x34')],function(_0x2653ec){return{'name':_0x2653ec[_0x825c('0x35')],'type':_0x2653ec[_0x825c('0x36')][_0x825c('0x37')]};});_0x5c7877['model']=_[_0x825c('0x32')](_0x5f0d52,_0x825c('0x30'));_0x5c7877['query']=_[_0x825c('0x38')](_0x240b00[_0x825c('0x39')]);_0x5c7877[_0x825c('0x3a')]=_['intersection'](_0x5c7877[_0x825c('0x3b')],_0x5c7877[_0x825c('0x39')]);_0x5594cc[_0x825c('0x3c')]=_[_0x825c('0x3d')](_0x5c7877[_0x825c('0x3b')],qs[_0x825c('0x3e')](_0x240b00[_0x825c('0x39')][_0x825c('0x3e')]));_0x5594cc['attributes']=_0x5594cc[_0x825c('0x3c')][_0x825c('0x3f')]?_0x5594cc['attributes']:_0x5c7877['model'];if(!_0x240b00['query'][_0x825c('0x40')](_0x825c('0x41'))){_0x5594cc[_0x825c('0x20')]=qs[_0x825c('0x20')](_0x240b00['query'][_0x825c('0x20')]);_0x5594cc[_0x825c('0x22')]=qs[_0x825c('0x22')](_0x240b00[_0x825c('0x39')][_0x825c('0x22')]);}_0x5594cc[_0x825c('0x42')]=qs[_0x825c('0x43')](_0x240b00[_0x825c('0x39')][_0x825c('0x43')]);_0x5594cc[_0x825c('0x44')]=qs[_0x825c('0x3a')](_[_0x825c('0x45')](_0x240b00[_0x825c('0x39')],_0x5c7877[_0x825c('0x3a')]),_0x5f0d52);if(_0x240b00[_0x825c('0x39')][_0x825c('0x46')]){_0x5594cc[_0x825c('0x44')]=_[_0x825c('0x47')](_0x5594cc[_0x825c('0x44')],{'$or':_[_0x825c('0x32')](_0x5f0d52,function(_0x3ede74){if(_0x3ede74[_0x825c('0x36')]!=='VIRTUAL'){var _0x5bc043={};_0x5bc043[_0x3ede74[_0x825c('0x30')]]={'$like':'%'+_0x240b00[_0x825c('0x39')][_0x825c('0x46')]+'%'};return _0x5bc043;}})});}_0x5594cc=_['merge']({},_0x5594cc,_0x240b00[_0x825c('0x48')]);var _0x8a1dc9={'where':_0x5594cc[_0x825c('0x44')]};return db[_0x825c('0x33')][_0x825c('0x21')](_0x8a1dc9)['then'](function(_0x43ec52){_0x421d1b[_0x825c('0x21')]=_0x43ec52;if(_0x240b00[_0x825c('0x39')]['includeAll']){_0x5594cc[_0x825c('0x49')]=[{'all':!![]}];}return db[_0x825c('0x33')][_0x825c('0x4a')](_0x5594cc);})['then'](function(_0x2b90b6){_0x421d1b[_0x825c('0x4b')]=_0x2b90b6;return _0x421d1b;})[_0x825c('0x28')](respondWithFilteredResult(_0x3e1f9b,_0x5594cc))[_0x825c('0x4c')](handleError(_0x3e1f9b,null));};exports[_0x825c('0x4d')]=function(_0x574e21,_0xa27806){var _0x23c072={'raw':!![],'where':{'id':_0x574e21[_0x825c('0x4e')]['id']}},_0x2eb152={};_0x2eb152[_0x825c('0x3b')]=_['keys'](db[_0x825c('0x33')]['rawAttributes']);_0x2eb152[_0x825c('0x39')]=_['keys'](_0x574e21[_0x825c('0x39')]);_0x2eb152[_0x825c('0x3a')]=_['intersection'](_0x2eb152[_0x825c('0x3b')],_0x2eb152[_0x825c('0x39')]);_0x23c072[_0x825c('0x3c')]=_[_0x825c('0x3d')](_0x2eb152[_0x825c('0x3b')],qs[_0x825c('0x3e')](_0x574e21['query'][_0x825c('0x3e')]));_0x23c072[_0x825c('0x3c')]=_0x23c072['attributes'][_0x825c('0x3f')]?_0x23c072[_0x825c('0x3c')]:_0x2eb152[_0x825c('0x3b')];if(_0x574e21[_0x825c('0x39')][_0x825c('0x4f')]){_0x23c072[_0x825c('0x49')]=[{'all':!![]}];}_0x23c072=_[_0x825c('0x47')]({},_0x23c072,_0x574e21['options']);return db[_0x825c('0x33')][_0x825c('0x50')](_0x23c072)[_0x825c('0x28')](handleEntityNotFound(_0xa27806,null))[_0x825c('0x28')](respondWithResult(_0xa27806,null))[_0x825c('0x4c')](handleError(_0xa27806,null));};exports[_0x825c('0x51')]=function(_0x11d610,_0x3baa3b){return db[_0x825c('0x33')]['create'](_0x11d610[_0x825c('0x52')],{})['then'](function(_0x3c7c99){var _0x499520=_0x11d610['user']['get']({'plain':!![]});if(!_0x499520)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x499520[_0x825c('0x53')]===_0x825c('0x54')){var _0x50ef1d=_0x3c7c99[_0x825c('0x2a')]({'plain':!![]});var _0x3eba72=_0x825c('0x2b');return db[_0x825c('0x55')][_0x825c('0x50')]({'where':{'name':_0x3eba72,'userProfileId':_0x499520[_0x825c('0x56')]},'raw':!![]})[_0x825c('0x28')](function(_0x1ffd76){if(_0x1ffd76&&_0x1ffd76[_0x825c('0x57')]===0x0){return db[_0x825c('0x2c')]['create']({'name':_0x50ef1d[_0x825c('0x30')],'resourceId':_0x50ef1d['id'],'type':_0x1ffd76[_0x825c('0x30')],'sectionId':_0x1ffd76['id']},{})[_0x825c('0x28')](function(){return _0x3c7c99;});}else{return _0x3c7c99;}})[_0x825c('0x4c')](function(_0x21cfa4){logger[_0x825c('0x2e')](_0x825c('0x58'),_0x21cfa4);throw _0x21cfa4;});}return _0x3c7c99;})[_0x825c('0x28')](respondWithResult(_0x3baa3b,0xc9))[_0x825c('0x4c')](handleError(_0x3baa3b,null));};exports[_0x825c('0x27')]=function(_0x3f1679,_0x4b6ebf){if(_0x3f1679[_0x825c('0x52')]['id']){delete _0x3f1679['body']['id'];}return db[_0x825c('0x33')][_0x825c('0x50')]({'where':{'id':_0x3f1679[_0x825c('0x4e')]['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x4b6ebf,null))[_0x825c('0x28')](saveUpdates(_0x3f1679['body'],null))[_0x825c('0x28')](respondWithResult(_0x4b6ebf,null))[_0x825c('0x4c')](handleError(_0x4b6ebf,null));};exports[_0x825c('0x29')]=function(_0x571939,_0x537319){return db[_0x825c('0x33')][_0x825c('0x50')]({'where':{'id':_0x571939[_0x825c('0x4e')]['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x537319,null))[_0x825c('0x28')](removeEntity(_0x537319,null))[_0x825c('0x4c')](handleError(_0x537319,null));};exports['describe']=function(_0x175e1c,_0xb23cda){return db[_0x825c('0x33')][_0x825c('0x59')]()[_0x825c('0x28')](respondWithResult(_0xb23cda,null))[_0x825c('0x4c')](handleError(_0xb23cda,null));};exports[_0x825c('0x5a')]=function(_0x5429ee,_0x48b1fe,_0xf245e8){var _0x1fc411={'raw':!![],'where':{}},_0x2a5c17={},_0x49f7f2;return db[_0x825c('0x33')]['findOne']({'where':{'id':_0x5429ee['params']['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x48b1fe,null))[_0x825c('0x28')](function(_0x1dff81){if(_0x1dff81){_0x49f7f2=_0x1dff81[_0x825c('0x2a')]({'plain':!![]});_0x2a5c17[_0x825c('0x3b')]=_[_0x825c('0x38')](db[_0x825c('0x5b')][_0x825c('0x34')]);_0x2a5c17[_0x825c('0x39')]=_[_0x825c('0x38')](_0x5429ee[_0x825c('0x39')]);_0x2a5c17['filters']=_['intersection'](_0x2a5c17[_0x825c('0x3b')],_0x2a5c17['query']);_0x1fc411['attributes']=_[_0x825c('0x3d')](_0x2a5c17['model'],qs[_0x825c('0x3e')](_0x5429ee[_0x825c('0x39')][_0x825c('0x3e')]));_0x1fc411[_0x825c('0x3c')]=_0x1fc411[_0x825c('0x3c')][_0x825c('0x3f')]?_0x1fc411[_0x825c('0x3c')]:_0x2a5c17[_0x825c('0x3b')];if(!_0x5429ee[_0x825c('0x39')][_0x825c('0x40')]('nolimit')){_0x1fc411[_0x825c('0x20')]=qs[_0x825c('0x20')](_0x5429ee[_0x825c('0x39')][_0x825c('0x20')]);_0x1fc411['offset']=qs['offset'](_0x5429ee[_0x825c('0x39')][_0x825c('0x22')]);}_0x1fc411[_0x825c('0x42')]=qs[_0x825c('0x43')](_0x5429ee['query']['sort']);_0x1fc411[_0x825c('0x44')]=qs[_0x825c('0x3a')](_[_0x825c('0x45')](_0x5429ee[_0x825c('0x39')],_0x2a5c17[_0x825c('0x3a')]));_0x1fc411[_0x825c('0x44')][_0x825c('0x5c')]=_0x1dff81['id'];if(_0x5429ee[_0x825c('0x39')][_0x825c('0x46')]){_0x1fc411['where']=_['merge'](_0x1fc411[_0x825c('0x44')],{'$or':_['map'](_0x1fc411[_0x825c('0x3c')],function(_0x575076){var _0x1a7764={};_0x1a7764[_0x575076]={'$like':'%'+_0x5429ee[_0x825c('0x39')][_0x825c('0x46')]+'%'};return _0x1a7764;})});}_0x1fc411=_[_0x825c('0x47')]({},_0x1fc411,_0x5429ee[_0x825c('0x48')]);return db[_0x825c('0x5b')][_0x825c('0x4a')](_0x1fc411);}})[_0x825c('0x28')](function(_0x589331){if(_0x589331){return db['User']['findAndCountAll']({'where':{'id':_[_0x825c('0x32')](_0x589331,_0x825c('0x5d')),'role':'agent'},'attributes':['id','name',_0x825c('0x5e'),'updatedAt',_0x825c('0x5f')]});}})[_0x825c('0x28')](function(_0xb5e838){if(_0xb5e838){return{'count':_0xb5e838[_0x825c('0x21')],'rows':_[_0x825c('0x32')](_0xb5e838['rows'],function(_0x4045ac){return{'membername':_0x4045ac[_0x825c('0x30')],'UserId':_0x4045ac['id'],'queue_name':_0x49f7f2[_0x825c('0x30')],'FaxQueueId':_0x49f7f2['id'],'interface':util[_0x825c('0x60')](_0x825c('0x61'),_0x825c('0x62'),_0x4045ac[_0x825c('0x30')]),'penalty':0x0,'paused':_0x4045ac[_0x825c('0x5e')],'createdAt':_0x4045ac[_0x825c('0x5f')],'updatedAt':_0x4045ac[_0x825c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48b1fe,_0x1fc411))['catch'](handleError(_0x48b1fe,null));};exports[_0x825c('0x64')]=function(_0x26a49a,_0x2c6626,_0x45b6ee){var _0x498526={};var _0x1ca7e6={};var _0x24427f;var _0x29e2d0;return db[_0x825c('0x33')]['findOne']({'where':{'id':_0x26a49a['params']['id']}})['then'](handleEntityNotFound(_0x2c6626,null))['then'](function(_0x33dbb5){if(_0x33dbb5){_0x24427f=_0x33dbb5;_0x1ca7e6[_0x825c('0x3b')]=_[_0x825c('0x38')](db[_0x825c('0x65')][_0x825c('0x34')]);_0x1ca7e6[_0x825c('0x39')]=_[_0x825c('0x38')](_0x26a49a[_0x825c('0x39')]);_0x1ca7e6[_0x825c('0x3a')]=_['intersection'](_0x1ca7e6[_0x825c('0x3b')],_0x1ca7e6[_0x825c('0x39')]);_0x498526[_0x825c('0x3c')]=_[_0x825c('0x3d')](_0x1ca7e6['model'],qs['fields'](_0x26a49a['query'][_0x825c('0x3e')]));_0x498526[_0x825c('0x3c')]=_0x498526[_0x825c('0x3c')][_0x825c('0x3f')]?_0x498526['attributes']:_0x1ca7e6[_0x825c('0x3b')];_0x498526[_0x825c('0x42')]=qs[_0x825c('0x43')](_0x26a49a[_0x825c('0x39')][_0x825c('0x43')]);_0x498526[_0x825c('0x44')]=qs[_0x825c('0x3a')](_[_0x825c('0x45')](_0x26a49a[_0x825c('0x39')],_0x1ca7e6[_0x825c('0x3a')]));if(_0x26a49a[_0x825c('0x39')]['filter']){_0x498526[_0x825c('0x44')]=_[_0x825c('0x47')](_0x498526[_0x825c('0x44')],{'$or':_[_0x825c('0x32')](_0x498526[_0x825c('0x3c')],function(_0x2cf8b5){var _0x34fbc8={};_0x34fbc8[_0x2cf8b5]={'$like':'%'+_0x26a49a['query'][_0x825c('0x46')]+'%'};return _0x34fbc8;})});}_0x498526=_['merge']({},_0x498526,_0x26a49a[_0x825c('0x48')]);return _0x24427f[_0x825c('0x64')](_0x498526);}})[_0x825c('0x28')](function(_0x15a0af){if(_0x15a0af){_0x29e2d0=_0x15a0af[_0x825c('0x3f')];if(!_0x26a49a[_0x825c('0x39')][_0x825c('0x40')](_0x825c('0x41'))){_0x498526[_0x825c('0x20')]=qs['limit'](_0x26a49a[_0x825c('0x39')][_0x825c('0x20')]);_0x498526[_0x825c('0x22')]=qs[_0x825c('0x22')](_0x26a49a[_0x825c('0x39')][_0x825c('0x22')]);}return _0x24427f[_0x825c('0x64')](_0x498526);}})['then'](function(_0x166671){if(_0x166671){return _0x166671?{'count':_0x29e2d0,'rows':_0x166671}:null;}})[_0x825c('0x28')](respondWithResult(_0x2c6626,null))[_0x825c('0x4c')](handleError(_0x2c6626,null));};exports[_0x825c('0x66')]=function(_0x29d9ec,_0x4a0975,_0xaa0591){var _0x35b415=_0x29d9ec[_0x825c('0x52')][_0x825c('0x67')];return db['Team']['findAll']({'where':{'id':_0x35b415},'attributes':['id'],'include':[{'model':db['User'],'as':_0x825c('0x68'),'attributes':['id',_0x825c('0x30'),_0x825c('0x69'),_0x825c('0x6a'),_0x825c('0x6b')],'raw':!![]}]})['then'](function(_0x3e64af){if(_0x3e64af){var _0x19df37=_[_0x825c('0x6c')](_0x3e64af,function(_0x27df42){var _0x342b09=_0x27df42[_0x825c('0x2a')]({'plain':!![]});return _0x342b09[_0x825c('0x68')];});return db[_0x825c('0x33')][_0x825c('0x50')]({'where':{'id':_0x29d9ec['params']['id']}})['then'](function(_0x7c8222){return db[_0x825c('0x6d')][_0x825c('0x6e')](function(_0x2ddc1e){return _0x7c8222[_0x825c('0x66')](_0x35b415,{'transaction':_0x2ddc1e})[_0x825c('0x28')](function(){return BPromise['each'](_0x19df37,function(_0x4e8d67){return db[_0x825c('0x5b')][_0x825c('0x6f')]({'where':{'UserId':_0x4e8d67['id'],'FaxQueueId':_0x29d9ec[_0x825c('0x4e')]['id']},'transaction':_0x2ddc1e});});})[_0x825c('0x28')](function(){_0x19df37[_0x825c('0x70')](function(_0x8f7d8){socket[_0x825c('0x71')](_0x825c('0x72'),{'UserId':_0x8f7d8['id'],'FaxQueueId':_0x7c8222['id']});});});});});}})[_0x825c('0x28')](respondWithStatusCode(_0x4a0975,null))[_0x825c('0x4c')](handleError(_0x4a0975,null));};exports[_0x825c('0x73')]=function(_0x2b1e50,_0x119d81,_0x4a398e){return db[_0x825c('0x65')]['findAll']({'where':{'id':_0x2b1e50[_0x825c('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x825c('0x74')],'as':_0x825c('0x68'),'attributes':['id'],'raw':!![]}]})[_0x825c('0x28')](handleEntityNotFound(_0x119d81,null))[_0x825c('0x28')](function(_0x6119ab){var _0x27c537=_[_0x825c('0x32')](_0x6119ab,'id');var _0x40e5c4=[];var _0x3d19b0=[];var _0x391b6f=squel['select']();_0x391b6f[_0x825c('0x75')](_0x825c('0x76'))['from']('team_has_fax_queues','tq')[_0x825c('0x77')](_0x825c('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x825c('0x79'),_0x2b1e50[_0x825c('0x4e')]['id']);for(var _0x364790=0x0;_0x364790<_0x6119ab[_0x825c('0x3f')];_0x364790+=0x1){let _0x4d9c3c=_0x6119ab[_0x364790];for(var _0x4421c7=0x0;_0x4421c7<_0x4d9c3c['Agents'][_0x825c('0x3f')];_0x4421c7+=0x1){let _0x1e7392=_0x4d9c3c[_0x825c('0x68')][_0x4421c7];var _0x1cf09b=_0x391b6f[_0x825c('0x7a')]();_0x1cf09b['where'](_0x825c('0x7b'),_0x1e7392['id']);_0x3d19b0[_0x825c('0x7c')](db[_0x825c('0x6d')][_0x825c('0x39')](_0x1cf09b[_0x825c('0x7d')](),{'type':db['sequelize'][_0x825c('0x7e')]['SELECT']})[_0x825c('0x28')](function(_0x58df03){if(_0x58df03[_0x825c('0x3f')]===0x1){return _0x1e7392['id'];}else{var _0x12d5e6=_[_0x825c('0x7f')](_['map'](_0x58df03,_0x825c('0x80')),function(_0x4c63f1){return _[_0x825c('0x81')](_0x27c537,_0x4c63f1);});if(_0x12d5e6){return _0x1e7392['id'];}}}));}}return BPromise['all'](_0x3d19b0)[_0x825c('0x28')](function(_0x1516ec){_0x40e5c4=_(_0x40e5c4)[_0x825c('0x82')](_0x1516ec)['compact']()['value']();return db[_0x825c('0x33')][_0x825c('0x50')]({'where':{'id':_0x2b1e50['params']['id']}})['then'](function(_0x522dd7){return db[_0x825c('0x6d')][_0x825c('0x6e')](function(_0x3447bd){return _0x522dd7[_0x825c('0x73')](_0x2b1e50[_0x825c('0x39')]['ids'],{'transaction':_0x3447bd})[_0x825c('0x28')](function(){if(!_['isEmpty'](_0x40e5c4)){return _0x522dd7[_0x825c('0x83')](_0x40e5c4,{'transaction':_0x3447bd});}})[_0x825c('0x28')](function(){_0x40e5c4[_0x825c('0x70')](function(_0x51962b){socket[_0x825c('0x71')](_0x825c('0x84'),{'UserId':_0x51962b,'FaxQueueId':_0x522dd7['id']});});});});});});})[_0x825c('0x28')](respondWithStatusCode(_0x119d81,null))[_0x825c('0x4c')](handleError(_0x119d81,null));};exports['addAgents']=function(_0x4aa05e,_0x5b3c1f,_0x5a7052){return db[_0x825c('0x33')][_0x825c('0x50')]({'where':{'id':_0x4aa05e['params']['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x5b3c1f,null))['then'](function(_0x1590dc){if(_0x1590dc){return _0x1590dc[_0x825c('0x85')](_0x4aa05e[_0x825c('0x52')]['ids'],_[_0x825c('0x86')](_0x4aa05e[_0x825c('0x52')],[_0x825c('0x67'),'id'])||{})[_0x825c('0x87')](function(_0x2fd268){for(var _0x5d962a=0x0;_0x5d962a<_0x4aa05e[_0x825c('0x52')][_0x825c('0x67')][_0x825c('0x3f')];_0x5d962a+=0x1){socket[_0x825c('0x71')](_0x825c('0x72'),{'UserId':Number(_0x4aa05e['body'][_0x825c('0x67')][_0x5d962a]),'FaxQueueId':Number(_0x4aa05e[_0x825c('0x4e')]['id'])});}return _0x2fd268;});}})[_0x825c('0x28')](respondWithResult(_0x5b3c1f,null))[_0x825c('0x4c')](handleError(_0x5b3c1f,null));};exports['removeAgents']=function(_0x5f3409,_0x3e0330,_0x14ee44){return db[_0x825c('0x33')][_0x825c('0x50')]({'where':{'id':_0x5f3409[_0x825c('0x4e')]['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x3e0330,null))[_0x825c('0x28')](function(_0x1f64c2){if(_0x1f64c2){return _0x1f64c2[_0x825c('0x83')](_0x5f3409[_0x825c('0x39')][_0x825c('0x67')])[_0x825c('0x28')](function(){if(_['isArray'](_0x5f3409[_0x825c('0x39')][_0x825c('0x67')])){for(var _0x441ffe=0x0;_0x441ffe<_0x5f3409[_0x825c('0x39')]['ids'][_0x825c('0x3f')];_0x441ffe+=0x1){socket[_0x825c('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x5f3409['query'][_0x825c('0x67')][_0x441ffe]),'FaxQueueId':Number(_0x5f3409[_0x825c('0x4e')]['id'])});}}else{socket[_0x825c('0x71')](_0x825c('0x84'),{'UserId':Number(_0x5f3409[_0x825c('0x39')][_0x825c('0x67')]),'FaxQueueId':Number(_0x5f3409[_0x825c('0x4e')]['id'])});}});}})[_0x825c('0x28')](respondWithStatusCode(_0x3e0330,null))[_0x825c('0x4c')](handleError(_0x3e0330,null));};exports[_0x825c('0x88')]=function(_0x5215f3,_0x5556dd,_0x393af4){var _0x122a0a={};var _0x1d390b={};var _0x582be3;var _0x24c967;return db[_0x825c('0x33')][_0x825c('0x89')]({'where':{'id':_0x5215f3[_0x825c('0x4e')]['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x5556dd,null))[_0x825c('0x28')](function(_0x96d03){if(_0x96d03){_0x582be3=_0x96d03;_0x1d390b['model']=_[_0x825c('0x38')](db[_0x825c('0x74')][_0x825c('0x34')]);_0x1d390b['query']=_['keys'](_0x5215f3[_0x825c('0x39')]);_0x1d390b[_0x825c('0x3a')]=_['intersection'](_0x1d390b['model'],_0x1d390b[_0x825c('0x39')]);_0x122a0a[_0x825c('0x3c')]=_['intersection'](_0x1d390b[_0x825c('0x3b')],qs[_0x825c('0x3e')](_0x5215f3[_0x825c('0x39')]['fields']));_0x122a0a['attributes']=_0x122a0a[_0x825c('0x3c')][_0x825c('0x3f')]?_0x122a0a[_0x825c('0x3c')]:_0x1d390b[_0x825c('0x3b')];_0x122a0a[_0x825c('0x42')]=qs['sort'](_0x5215f3[_0x825c('0x39')][_0x825c('0x43')]);_0x122a0a[_0x825c('0x44')]=qs[_0x825c('0x3a')](_[_0x825c('0x45')](_0x5215f3[_0x825c('0x39')],_0x1d390b[_0x825c('0x3a')]));if(_0x5215f3['query'][_0x825c('0x46')]){_0x122a0a[_0x825c('0x44')]=_[_0x825c('0x47')](_0x122a0a[_0x825c('0x44')],{'$or':_[_0x825c('0x32')](_0x122a0a['attributes'],function(_0x23be7b){var _0x3bc3c0={};_0x3bc3c0[_0x23be7b]={'$like':'%'+_0x5215f3[_0x825c('0x39')][_0x825c('0x46')]+'%'};return _0x3bc3c0;})});}_0x122a0a=_[_0x825c('0x47')]({},_0x122a0a,_0x5215f3[_0x825c('0x48')]);return _0x582be3['getAgents'](_0x122a0a);}})['then'](function(_0x3a60ee){if(_0x3a60ee){_0x24c967=_0x3a60ee[_0x825c('0x3f')];if(!_0x5215f3['query'][_0x825c('0x40')](_0x825c('0x41'))){_0x122a0a[_0x825c('0x20')]=qs[_0x825c('0x20')](_0x5215f3[_0x825c('0x39')][_0x825c('0x20')]);_0x122a0a[_0x825c('0x22')]=qs[_0x825c('0x22')](_0x5215f3['query'][_0x825c('0x22')]);}return _0x582be3[_0x825c('0x88')](_0x122a0a);}})[_0x825c('0x28')](function(_0x3c4852){if(_0x3c4852){return _0x3c4852?{'count':_0x24c967,'rows':_0x3c4852}:null;}})[_0x825c('0x28')](respondWithResult(_0x5556dd,null))[_0x825c('0x4c')](handleError(_0x5556dd,null));};
\ No newline at end of file
+var _0xbf85=['get','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','every','compact','value','removeTeams','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','send','index','map','FaxQueue','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body'];(function(_0x54b01a,_0x4fab10){var _0x62e975=function(_0x4f9b1a){while(--_0x4f9b1a){_0x54b01a['push'](_0x54b01a['shift']());}};_0x62e975(++_0x4fab10);}(_0xbf85,0x14f));var _0x5bf8=function(_0x1d209c,_0x633e4a){_0x1d209c=_0x1d209c-0x0;var _0x33c332=_0xbf85[_0x1d209c];return _0x33c332;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bf8('0x0'));var zipdir=require(_0x5bf8('0x1'));var jsonpatch=require(_0x5bf8('0x2'));var rp=require('request-promise');var moment=require(_0x5bf8('0x3'));var BPromise=require(_0x5bf8('0x4'));var Mustache=require(_0x5bf8('0x5'));var util=require(_0x5bf8('0x6'));var path=require(_0x5bf8('0x7'));var sox=require('sox');var csv=require(_0x5bf8('0x8'));var ejs=require(_0x5bf8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5bf8('0xa'));var crypto=require(_0x5bf8('0xb'));var jsforce=require(_0x5bf8('0xc'));var deskjs=require(_0x5bf8('0xd'));var toCsv=require(_0x5bf8('0x8'));var querystring=require('querystring');var Papa=require(_0x5bf8('0xe'));var Redis=require(_0x5bf8('0xf'));var authService=require(_0x5bf8('0x10'));var qs=require(_0x5bf8('0x11'));var as=require(_0x5bf8('0x12'));var hardwareService=require(_0x5bf8('0x13'));var logger=require(_0x5bf8('0x14'))(_0x5bf8('0x15'));var utils=require(_0x5bf8('0x16'));var config=require(_0x5bf8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bf8('0x18'))['db'];config[_0x5bf8('0x19')]=_[_0x5bf8('0x1a')](config['redis'],{'host':_0x5bf8('0x1b'),'port':0x18eb});var socket=require(_0x5bf8('0x1c'))(new Redis(config[_0x5bf8('0x19')]));require('./faxQueue.socket')[_0x5bf8('0x1d')](socket);function respondWithStatusCode(_0x5e5408,_0x3c9daa){_0x3c9daa=_0x3c9daa||0xcc;return function(_0x2a7d61){if(_0x2a7d61){return _0x5e5408[_0x5bf8('0x1e')](_0x3c9daa);}return _0x5e5408['status'](_0x3c9daa)[_0x5bf8('0x1f')]();};}function respondWithResult(_0x17fab5,_0x5c37aa){_0x5c37aa=_0x5c37aa||0xc8;return function(_0x8c4543){if(_0x8c4543){return _0x17fab5[_0x5bf8('0x20')](_0x5c37aa)['json'](_0x8c4543);}};}function respondWithFilteredResult(_0x17749c,_0x1dae1e){return function(_0x32ab3c){if(_0x32ab3c){var _0x22e206=typeof _0x1dae1e['offset']===_0x5bf8('0x21')&&typeof _0x1dae1e[_0x5bf8('0x22')]==='undefined';var _0x24fd83=_0x32ab3c['count'];var _0x1bcfe4=_0x22e206?0x0:_0x1dae1e[_0x5bf8('0x23')];var _0x7efd4f=_0x22e206?_0x32ab3c[_0x5bf8('0x24')]:_0x1dae1e[_0x5bf8('0x23')]+_0x1dae1e[_0x5bf8('0x22')];var _0x29db84;if(_0x7efd4f>=_0x24fd83){_0x7efd4f=_0x24fd83;_0x29db84=0xc8;}else{_0x29db84=0xce;}_0x17749c[_0x5bf8('0x20')](_0x29db84);return _0x17749c['set'](_0x5bf8('0x25'),_0x1bcfe4+'-'+_0x7efd4f+'/'+_0x24fd83)['json'](_0x32ab3c);}return null;};}function patchUpdates(_0x4cb0b7){return function(_0x2f1cbf){try{jsonpatch[_0x5bf8('0x26')](_0x2f1cbf,_0x4cb0b7,!![]);}catch(_0x56026a){return BPromise[_0x5bf8('0x27')](_0x56026a);}return _0x2f1cbf[_0x5bf8('0x28')]();};}function saveUpdates(_0x583284,_0x1b7207){return function(_0x23511d){if(_0x23511d){return _0x23511d[_0x5bf8('0x29')](_0x583284)[_0x5bf8('0x2a')](function(_0x1a2311){return _0x1a2311;});}return null;};}function removeEntity(_0x3f4809,_0x1a3a58){return function(_0x3d2eed){if(_0x3d2eed){return _0x3d2eed[_0x5bf8('0x2b')]()[_0x5bf8('0x2a')](function(){var _0x3c60f6=_0x3d2eed['get']({'plain':!![]});var _0x313901=_0x5bf8('0x2c');return db[_0x5bf8('0x2d')][_0x5bf8('0x2b')]({'where':{'type':_0x313901,'resourceId':_0x3c60f6['id']}})[_0x5bf8('0x2a')](function(){return _0x3d2eed;});})[_0x5bf8('0x2a')](function(){_0x3f4809[_0x5bf8('0x20')](0xcc)[_0x5bf8('0x1f')]();});}};}function handleEntityNotFound(_0x2aba55,_0x113ca4){return function(_0x16f687){if(!_0x16f687){_0x2aba55[_0x5bf8('0x1e')](0x194);}return _0x16f687;};}function handleError(_0x52eff7,_0x2e754f){_0x2e754f=_0x2e754f||0x1f4;return function(_0x266880){logger['error'](_0x266880['stack']);if(_0x266880['name']){delete _0x266880['name'];}_0x52eff7['status'](_0x2e754f)[_0x5bf8('0x2e')](_0x266880);};}exports[_0x5bf8('0x2f')]=function(_0x29a780,_0x568eba){var _0x559747={},_0x12da05={},_0x1f6344={'count':0x0,'rows':[]};var _0xb47515=_[_0x5bf8('0x30')](db[_0x5bf8('0x31')]['rawAttributes'],function(_0xce3698){return{'name':_0xce3698[_0x5bf8('0x32')],'type':_0xce3698[_0x5bf8('0x33')][_0x5bf8('0x34')]};});_0x12da05[_0x5bf8('0x35')]=_[_0x5bf8('0x30')](_0xb47515,_0x5bf8('0x36'));_0x12da05[_0x5bf8('0x37')]=_[_0x5bf8('0x38')](_0x29a780[_0x5bf8('0x37')]);_0x12da05[_0x5bf8('0x39')]=_['intersection'](_0x12da05[_0x5bf8('0x35')],_0x12da05['query']);_0x559747[_0x5bf8('0x3a')]=_[_0x5bf8('0x3b')](_0x12da05['model'],qs[_0x5bf8('0x3c')](_0x29a780['query'][_0x5bf8('0x3c')]));_0x559747[_0x5bf8('0x3a')]=_0x559747[_0x5bf8('0x3a')][_0x5bf8('0x3d')]?_0x559747['attributes']:_0x12da05[_0x5bf8('0x35')];if(!_0x29a780[_0x5bf8('0x37')][_0x5bf8('0x3e')](_0x5bf8('0x3f'))){_0x559747[_0x5bf8('0x22')]=qs['limit'](_0x29a780[_0x5bf8('0x37')]['limit']);_0x559747['offset']=qs[_0x5bf8('0x23')](_0x29a780[_0x5bf8('0x37')][_0x5bf8('0x23')]);}_0x559747[_0x5bf8('0x40')]=qs[_0x5bf8('0x41')](_0x29a780[_0x5bf8('0x37')][_0x5bf8('0x41')]);_0x559747[_0x5bf8('0x42')]=qs[_0x5bf8('0x39')](_[_0x5bf8('0x43')](_0x29a780[_0x5bf8('0x37')],_0x12da05[_0x5bf8('0x39')]),_0xb47515);if(_0x29a780[_0x5bf8('0x37')][_0x5bf8('0x44')]){_0x559747[_0x5bf8('0x42')]=_['merge'](_0x559747['where'],{'$or':_[_0x5bf8('0x30')](_0xb47515,function(_0x40c12a){if(_0x40c12a['type']!==_0x5bf8('0x45')){var _0x4bab56={};_0x4bab56[_0x40c12a['name']]={'$like':'%'+_0x29a780[_0x5bf8('0x37')][_0x5bf8('0x44')]+'%'};return _0x4bab56;}})});}_0x559747=_[_0x5bf8('0x46')]({},_0x559747,_0x29a780['options']);var _0x4d6974={'where':_0x559747[_0x5bf8('0x42')]};return db[_0x5bf8('0x31')][_0x5bf8('0x24')](_0x4d6974)[_0x5bf8('0x2a')](function(_0x58d512){_0x1f6344[_0x5bf8('0x24')]=_0x58d512;if(_0x29a780['query'][_0x5bf8('0x47')]){_0x559747[_0x5bf8('0x48')]=[{'all':!![]}];}return db[_0x5bf8('0x31')][_0x5bf8('0x49')](_0x559747);})[_0x5bf8('0x2a')](function(_0x136bb7){_0x1f6344[_0x5bf8('0x4a')]=_0x136bb7;return _0x1f6344;})['then'](respondWithFilteredResult(_0x568eba,_0x559747))[_0x5bf8('0x4b')](handleError(_0x568eba,null));};exports[_0x5bf8('0x4c')]=function(_0xdea450,_0x567ef1){var _0x44111b={'raw':!![],'where':{'id':_0xdea450[_0x5bf8('0x4d')]['id']}},_0x12fbd3={};_0x12fbd3[_0x5bf8('0x35')]=_[_0x5bf8('0x38')](db[_0x5bf8('0x31')][_0x5bf8('0x4e')]);_0x12fbd3[_0x5bf8('0x37')]=_[_0x5bf8('0x38')](_0xdea450[_0x5bf8('0x37')]);_0x12fbd3[_0x5bf8('0x39')]=_[_0x5bf8('0x3b')](_0x12fbd3[_0x5bf8('0x35')],_0x12fbd3['query']);_0x44111b[_0x5bf8('0x3a')]=_[_0x5bf8('0x3b')](_0x12fbd3[_0x5bf8('0x35')],qs['fields'](_0xdea450['query'][_0x5bf8('0x3c')]));_0x44111b[_0x5bf8('0x3a')]=_0x44111b[_0x5bf8('0x3a')]['length']?_0x44111b['attributes']:_0x12fbd3[_0x5bf8('0x35')];if(_0xdea450[_0x5bf8('0x37')][_0x5bf8('0x47')]){_0x44111b[_0x5bf8('0x48')]=[{'all':!![]}];}_0x44111b=_['merge']({},_0x44111b,_0xdea450[_0x5bf8('0x4f')]);return db['FaxQueue'][_0x5bf8('0x50')](_0x44111b)[_0x5bf8('0x2a')](handleEntityNotFound(_0x567ef1,null))[_0x5bf8('0x2a')](respondWithResult(_0x567ef1,null))[_0x5bf8('0x4b')](handleError(_0x567ef1,null));};exports['create']=function(_0x5782fc,_0x55af5b){return db['FaxQueue']['create'](_0x5782fc[_0x5bf8('0x51')],{})[_0x5bf8('0x2a')](function(_0x1f0126){var _0x54cb20=_0x5782fc['user'][_0x5bf8('0x52')]({'plain':!![]});if(!_0x54cb20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54cb20[_0x5bf8('0x53')]===_0x5bf8('0x54')){var _0x51266c=_0x1f0126['get']({'plain':!![]});var _0x435cf5=_0x5bf8('0x2c');return db[_0x5bf8('0x55')][_0x5bf8('0x50')]({'where':{'name':_0x435cf5,'userProfileId':_0x54cb20[_0x5bf8('0x56')]},'raw':!![]})['then'](function(_0x1f4a29){if(_0x1f4a29&&_0x1f4a29['autoAssociation']===0x0){return db['UserProfileResource'][_0x5bf8('0x57')]({'name':_0x51266c[_0x5bf8('0x36')],'resourceId':_0x51266c['id'],'type':_0x1f4a29[_0x5bf8('0x36')],'sectionId':_0x1f4a29['id']},{})[_0x5bf8('0x2a')](function(){return _0x1f0126;});}else{return _0x1f0126;}})[_0x5bf8('0x4b')](function(_0x47d418){logger['error'](_0x5bf8('0x58'),_0x47d418);throw _0x47d418;});}return _0x1f0126;})['then'](respondWithResult(_0x55af5b,0xc9))[_0x5bf8('0x4b')](handleError(_0x55af5b,null));};exports['update']=function(_0xc71d84,_0x520048){if(_0xc71d84[_0x5bf8('0x51')]['id']){delete _0xc71d84[_0x5bf8('0x51')]['id'];}return db[_0x5bf8('0x31')][_0x5bf8('0x50')]({'where':{'id':_0xc71d84[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x520048,null))[_0x5bf8('0x2a')](saveUpdates(_0xc71d84['body'],null))[_0x5bf8('0x2a')](respondWithResult(_0x520048,null))[_0x5bf8('0x4b')](handleError(_0x520048,null));};exports[_0x5bf8('0x2b')]=function(_0x25d38f,_0x4f8116){return db['FaxQueue'][_0x5bf8('0x50')]({'where':{'id':_0x25d38f[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x4f8116,null))['then'](removeEntity(_0x4f8116,null))['catch'](handleError(_0x4f8116,null));};exports[_0x5bf8('0x59')]=function(_0x2438c9,_0x119f41){return db[_0x5bf8('0x31')][_0x5bf8('0x59')]()[_0x5bf8('0x2a')](respondWithResult(_0x119f41,null))[_0x5bf8('0x4b')](handleError(_0x119f41,null));};exports['getMembers']=function(_0x52f197,_0x250727,_0x220ba7){var _0x44f0ee={'raw':!![],'where':{}},_0x3b0b00={},_0x58fdad;return db['FaxQueue'][_0x5bf8('0x5a')]({'where':{'id':_0x52f197[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x250727,null))['then'](function(_0x8c631a){if(_0x8c631a){_0x58fdad=_0x8c631a[_0x5bf8('0x52')]({'plain':!![]});_0x3b0b00[_0x5bf8('0x35')]=_[_0x5bf8('0x38')](db[_0x5bf8('0x5b')][_0x5bf8('0x4e')]);_0x3b0b00[_0x5bf8('0x37')]=_['keys'](_0x52f197[_0x5bf8('0x37')]);_0x3b0b00[_0x5bf8('0x39')]=_[_0x5bf8('0x3b')](_0x3b0b00['model'],_0x3b0b00[_0x5bf8('0x37')]);_0x44f0ee[_0x5bf8('0x3a')]=_['intersection'](_0x3b0b00['model'],qs['fields'](_0x52f197[_0x5bf8('0x37')][_0x5bf8('0x3c')]));_0x44f0ee[_0x5bf8('0x3a')]=_0x44f0ee[_0x5bf8('0x3a')][_0x5bf8('0x3d')]?_0x44f0ee[_0x5bf8('0x3a')]:_0x3b0b00[_0x5bf8('0x35')];if(!_0x52f197[_0x5bf8('0x37')][_0x5bf8('0x3e')](_0x5bf8('0x3f'))){_0x44f0ee[_0x5bf8('0x22')]=qs[_0x5bf8('0x22')](_0x52f197[_0x5bf8('0x37')][_0x5bf8('0x22')]);_0x44f0ee[_0x5bf8('0x23')]=qs['offset'](_0x52f197['query'][_0x5bf8('0x23')]);}_0x44f0ee[_0x5bf8('0x40')]=qs['sort'](_0x52f197['query'][_0x5bf8('0x41')]);_0x44f0ee[_0x5bf8('0x42')]=qs[_0x5bf8('0x39')](_['pick'](_0x52f197['query'],_0x3b0b00['filters']));_0x44f0ee['where'][_0x5bf8('0x5c')]=_0x8c631a['id'];if(_0x52f197[_0x5bf8('0x37')][_0x5bf8('0x44')]){_0x44f0ee[_0x5bf8('0x42')]=_['merge'](_0x44f0ee['where'],{'$or':_['map'](_0x44f0ee[_0x5bf8('0x3a')],function(_0xccc03d){var _0xfc9f45={};_0xfc9f45[_0xccc03d]={'$like':'%'+_0x52f197[_0x5bf8('0x37')][_0x5bf8('0x44')]+'%'};return _0xfc9f45;})});}_0x44f0ee=_['merge']({},_0x44f0ee,_0x52f197[_0x5bf8('0x4f')]);return db['UserFaxQueue'][_0x5bf8('0x49')](_0x44f0ee);}})[_0x5bf8('0x2a')](function(_0x5cc381){if(_0x5cc381){return db['User'][_0x5bf8('0x5d')]({'where':{'id':_[_0x5bf8('0x30')](_0x5cc381,'UserId'),'role':_0x5bf8('0x5e')},'attributes':['id','name','faxPause',_0x5bf8('0x5f'),_0x5bf8('0x60')]});}})['then'](function(_0x1d2b48){if(_0x1d2b48){return{'count':_0x1d2b48['count'],'rows':_['map'](_0x1d2b48['rows'],function(_0x37f0a6){return{'membername':_0x37f0a6['name'],'UserId':_0x37f0a6['id'],'queue_name':_0x58fdad['name'],'FaxQueueId':_0x58fdad['id'],'interface':util[_0x5bf8('0x61')](_0x5bf8('0x62'),_0x5bf8('0x63'),_0x37f0a6[_0x5bf8('0x36')]),'penalty':0x0,'paused':_0x37f0a6[_0x5bf8('0x64')],'createdAt':_0x37f0a6[_0x5bf8('0x60')],'updatedAt':_0x37f0a6[_0x5bf8('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5bf8('0x2a')](respondWithFilteredResult(_0x250727,_0x44f0ee))[_0x5bf8('0x4b')](handleError(_0x250727,null));};exports[_0x5bf8('0x65')]=function(_0xd45ad5,_0x40ff59,_0x1cdd15){var _0x58ec15={};var _0x474edf={};var _0x2b6ba6;var _0x418512;return db[_0x5bf8('0x31')][_0x5bf8('0x5a')]({'where':{'id':_0xd45ad5[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x40ff59,null))[_0x5bf8('0x2a')](function(_0x3c0b77){if(_0x3c0b77){_0x2b6ba6=_0x3c0b77;_0x474edf['model']=_['keys'](db[_0x5bf8('0x66')][_0x5bf8('0x4e')]);_0x474edf['query']=_['keys'](_0xd45ad5[_0x5bf8('0x37')]);_0x474edf[_0x5bf8('0x39')]=_['intersection'](_0x474edf[_0x5bf8('0x35')],_0x474edf[_0x5bf8('0x37')]);_0x58ec15[_0x5bf8('0x3a')]=_[_0x5bf8('0x3b')](_0x474edf['model'],qs[_0x5bf8('0x3c')](_0xd45ad5[_0x5bf8('0x37')]['fields']));_0x58ec15[_0x5bf8('0x3a')]=_0x58ec15[_0x5bf8('0x3a')][_0x5bf8('0x3d')]?_0x58ec15[_0x5bf8('0x3a')]:_0x474edf[_0x5bf8('0x35')];_0x58ec15['order']=qs[_0x5bf8('0x41')](_0xd45ad5[_0x5bf8('0x37')][_0x5bf8('0x41')]);_0x58ec15[_0x5bf8('0x42')]=qs['filters'](_[_0x5bf8('0x43')](_0xd45ad5['query'],_0x474edf[_0x5bf8('0x39')]));if(_0xd45ad5[_0x5bf8('0x37')]['filter']){_0x58ec15['where']=_[_0x5bf8('0x46')](_0x58ec15[_0x5bf8('0x42')],{'$or':_[_0x5bf8('0x30')](_0x58ec15[_0x5bf8('0x3a')],function(_0x3b6f2b){var _0x57996d={};_0x57996d[_0x3b6f2b]={'$like':'%'+_0xd45ad5[_0x5bf8('0x37')][_0x5bf8('0x44')]+'%'};return _0x57996d;})});}_0x58ec15=_[_0x5bf8('0x46')]({},_0x58ec15,_0xd45ad5[_0x5bf8('0x4f')]);return _0x2b6ba6[_0x5bf8('0x65')](_0x58ec15);}})[_0x5bf8('0x2a')](function(_0x434f4c){if(_0x434f4c){_0x418512=_0x434f4c[_0x5bf8('0x3d')];if(!_0xd45ad5[_0x5bf8('0x37')][_0x5bf8('0x3e')](_0x5bf8('0x3f'))){_0x58ec15[_0x5bf8('0x22')]=qs[_0x5bf8('0x22')](_0xd45ad5['query'][_0x5bf8('0x22')]);_0x58ec15[_0x5bf8('0x23')]=qs[_0x5bf8('0x23')](_0xd45ad5[_0x5bf8('0x37')][_0x5bf8('0x23')]);}return _0x2b6ba6['getTeams'](_0x58ec15);}})[_0x5bf8('0x2a')](function(_0x5f3875){if(_0x5f3875){return _0x5f3875?{'count':_0x418512,'rows':_0x5f3875}:null;}})['then'](respondWithResult(_0x40ff59,null))[_0x5bf8('0x4b')](handleError(_0x40ff59,null));};exports['addTeams']=function(_0x5d37c5,_0x104300,_0x3db671){var _0x182716=_0x5d37c5[_0x5bf8('0x51')][_0x5bf8('0x67')];return db[_0x5bf8('0x66')]['findAll']({'where':{'id':_0x182716},'attributes':['id'],'include':[{'model':db[_0x5bf8('0x68')],'as':_0x5bf8('0x69'),'attributes':['id',_0x5bf8('0x36'),_0x5bf8('0x6a'),_0x5bf8('0x6b'),'interface'],'raw':!![]}]})[_0x5bf8('0x2a')](function(_0x20046c){if(_0x20046c){var _0x1d1168=_[_0x5bf8('0x6c')](_0x20046c,function(_0x3df11c){var _0x28e3de=_0x3df11c[_0x5bf8('0x52')]({'plain':!![]});return _0x28e3de['Agents'];});return db[_0x5bf8('0x31')]['find']({'where':{'id':_0x5d37c5[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](function(_0x2a0389){return db[_0x5bf8('0x6d')][_0x5bf8('0x6e')](function(_0x3d46a9){return _0x2a0389[_0x5bf8('0x6f')](_0x182716,{'transaction':_0x3d46a9})['then'](function(){return BPromise[_0x5bf8('0x70')](_0x1d1168,function(_0x2119dd){return db[_0x5bf8('0x5b')][_0x5bf8('0x71')]({'where':{'UserId':_0x2119dd['id'],'FaxQueueId':_0x5d37c5['params']['id']},'transaction':_0x3d46a9});});})[_0x5bf8('0x2a')](function(){_0x1d1168[_0x5bf8('0x72')](function(_0x2ff1a7){socket['emit']('userFaxQueue:save',{'UserId':_0x2ff1a7['id'],'FaxQueueId':_0x2a0389['id']});});});});});}})[_0x5bf8('0x2a')](respondWithStatusCode(_0x104300,null))[_0x5bf8('0x4b')](handleError(_0x104300,null));};exports['removeTeams']=function(_0x21b41e,_0x4fb424,_0x36b993){return db['Team'][_0x5bf8('0x49')]({'where':{'id':_0x21b41e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5bf8('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5bf8('0x2a')](handleEntityNotFound(_0x4fb424,null))[_0x5bf8('0x2a')](function(_0x166a22){var _0x3d4579=_[_0x5bf8('0x30')](_0x166a22,'id');var _0x47ee76=[];var _0x444635=[];var _0x26be7a=squel[_0x5bf8('0x73')]();_0x26be7a[_0x5bf8('0x74')](_0x5bf8('0x75'))['from'](_0x5bf8('0x76'),'tq')[_0x5bf8('0x77')](_0x5bf8('0x78'),'ut',_0x5bf8('0x79'))[_0x5bf8('0x42')](_0x5bf8('0x7a'),_0x21b41e[_0x5bf8('0x4d')]['id']);for(var _0x4e1953=0x0;_0x4e1953<_0x166a22['length'];_0x4e1953+=0x1){let _0x342ff9=_0x166a22[_0x4e1953];for(var _0x106087=0x0;_0x106087<_0x342ff9['Agents'][_0x5bf8('0x3d')];_0x106087+=0x1){let _0x1a7f87=_0x342ff9['Agents'][_0x106087];var _0x1e7c4b=_0x26be7a[_0x5bf8('0x7b')]();_0x1e7c4b[_0x5bf8('0x42')]('ut.UserId\x20=\x20?',_0x1a7f87['id']);_0x444635[_0x5bf8('0x7c')](db[_0x5bf8('0x6d')][_0x5bf8('0x37')](_0x1e7c4b[_0x5bf8('0x7d')](),{'type':db[_0x5bf8('0x6d')]['QueryTypes']['SELECT']})[_0x5bf8('0x2a')](function(_0x4cc681){if(_0x4cc681['length']===0x1){return _0x1a7f87['id'];}else{var _0x34ff00=_[_0x5bf8('0x7e')](_[_0x5bf8('0x30')](_0x4cc681,'TeamId'),function(_0x8a6baa){return _['includes'](_0x3d4579,_0x8a6baa);});if(_0x34ff00){return _0x1a7f87['id'];}}}));}}return BPromise['all'](_0x444635)['then'](function(_0x44aaec){_0x47ee76=_(_0x47ee76)['union'](_0x44aaec)[_0x5bf8('0x7f')]()[_0x5bf8('0x80')]();return db['FaxQueue'][_0x5bf8('0x50')]({'where':{'id':_0x21b41e['params']['id']}})[_0x5bf8('0x2a')](function(_0x2b4f58){return db[_0x5bf8('0x6d')]['transaction'](function(_0x3d5b44){return _0x2b4f58[_0x5bf8('0x81')](_0x21b41e['query']['ids'],{'transaction':_0x3d5b44})[_0x5bf8('0x2a')](function(){if(!_[_0x5bf8('0x82')](_0x47ee76)){return _0x2b4f58[_0x5bf8('0x83')](_0x47ee76,{'transaction':_0x3d5b44});}})[_0x5bf8('0x2a')](function(){_0x47ee76[_0x5bf8('0x72')](function(_0x51f6fc){socket[_0x5bf8('0x84')](_0x5bf8('0x85'),{'UserId':_0x51f6fc,'FaxQueueId':_0x2b4f58['id']});});});});});});})[_0x5bf8('0x2a')](respondWithStatusCode(_0x4fb424,null))[_0x5bf8('0x4b')](handleError(_0x4fb424,null));};exports[_0x5bf8('0x86')]=function(_0x5442aa,_0x1236d7,_0x5a8910){return db[_0x5bf8('0x31')][_0x5bf8('0x50')]({'where':{'id':_0x5442aa['params']['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x1236d7,null))['then'](function(_0x306c64){if(_0x306c64){return _0x306c64[_0x5bf8('0x86')](_0x5442aa[_0x5bf8('0x51')]['ids'],_[_0x5bf8('0x87')](_0x5442aa[_0x5bf8('0x51')],['ids','id'])||{})[_0x5bf8('0x88')](function(_0x31cd73){for(var _0x4a48f5=0x0;_0x4a48f5<_0x5442aa[_0x5bf8('0x51')][_0x5bf8('0x67')][_0x5bf8('0x3d')];_0x4a48f5+=0x1){socket[_0x5bf8('0x84')](_0x5bf8('0x89'),{'UserId':Number(_0x5442aa['body'][_0x5bf8('0x67')][_0x4a48f5]),'FaxQueueId':Number(_0x5442aa[_0x5bf8('0x4d')]['id'])});}return _0x31cd73;});}})[_0x5bf8('0x2a')](respondWithResult(_0x1236d7,null))[_0x5bf8('0x4b')](handleError(_0x1236d7,null));};exports[_0x5bf8('0x83')]=function(_0x101656,_0x1c2002,_0xc9258b){return db['FaxQueue'][_0x5bf8('0x50')]({'where':{'id':_0x101656[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x1c2002,null))[_0x5bf8('0x2a')](function(_0x59b573){if(_0x59b573){return _0x59b573['removeAgents'](_0x101656[_0x5bf8('0x37')][_0x5bf8('0x67')])[_0x5bf8('0x2a')](function(){if(_['isArray'](_0x101656[_0x5bf8('0x37')][_0x5bf8('0x67')])){for(var _0x511e74=0x0;_0x511e74<_0x101656[_0x5bf8('0x37')]['ids'][_0x5bf8('0x3d')];_0x511e74+=0x1){socket[_0x5bf8('0x84')](_0x5bf8('0x85'),{'UserId':Number(_0x101656['query']['ids'][_0x511e74]),'FaxQueueId':Number(_0x101656[_0x5bf8('0x4d')]['id'])});}}else{socket['emit'](_0x5bf8('0x85'),{'UserId':Number(_0x101656[_0x5bf8('0x37')][_0x5bf8('0x67')]),'FaxQueueId':Number(_0x101656[_0x5bf8('0x4d')]['id'])});}});}})[_0x5bf8('0x2a')](respondWithStatusCode(_0x1c2002,null))['catch'](handleError(_0x1c2002,null));};exports[_0x5bf8('0x8a')]=function(_0x58f5e8,_0x15bb7a,_0x602895){var _0x54a933={};var _0x4fee0d={};var _0x31aba8;var _0x175f29;return db[_0x5bf8('0x31')][_0x5bf8('0x5a')]({'where':{'id':_0x58f5e8[_0x5bf8('0x4d')]['id']}})[_0x5bf8('0x2a')](handleEntityNotFound(_0x15bb7a,null))[_0x5bf8('0x2a')](function(_0x4e02bc){if(_0x4e02bc){_0x31aba8=_0x4e02bc;_0x4fee0d['model']=_[_0x5bf8('0x38')](db[_0x5bf8('0x68')]['rawAttributes']);_0x4fee0d[_0x5bf8('0x37')]=_[_0x5bf8('0x38')](_0x58f5e8['query']);_0x4fee0d['filters']=_[_0x5bf8('0x3b')](_0x4fee0d['model'],_0x4fee0d[_0x5bf8('0x37')]);_0x54a933[_0x5bf8('0x3a')]=_[_0x5bf8('0x3b')](_0x4fee0d[_0x5bf8('0x35')],qs[_0x5bf8('0x3c')](_0x58f5e8['query']['fields']));_0x54a933[_0x5bf8('0x3a')]=_0x54a933['attributes']['length']?_0x54a933[_0x5bf8('0x3a')]:_0x4fee0d['model'];_0x54a933[_0x5bf8('0x40')]=qs[_0x5bf8('0x41')](_0x58f5e8[_0x5bf8('0x37')][_0x5bf8('0x41')]);_0x54a933[_0x5bf8('0x42')]=qs['filters'](_[_0x5bf8('0x43')](_0x58f5e8['query'],_0x4fee0d['filters']));if(_0x58f5e8[_0x5bf8('0x37')][_0x5bf8('0x44')]){_0x54a933[_0x5bf8('0x42')]=_['merge'](_0x54a933[_0x5bf8('0x42')],{'$or':_[_0x5bf8('0x30')](_0x54a933[_0x5bf8('0x3a')],function(_0x287f06){var _0x109c0d={};_0x109c0d[_0x287f06]={'$like':'%'+_0x58f5e8[_0x5bf8('0x37')][_0x5bf8('0x44')]+'%'};return _0x109c0d;})});}_0x54a933=_[_0x5bf8('0x46')]({},_0x54a933,_0x58f5e8['options']);return _0x31aba8[_0x5bf8('0x8a')](_0x54a933);}})[_0x5bf8('0x2a')](function(_0x515d6f){if(_0x515d6f){_0x175f29=_0x515d6f[_0x5bf8('0x3d')];if(!_0x58f5e8['query'][_0x5bf8('0x3e')](_0x5bf8('0x3f'))){_0x54a933['limit']=qs[_0x5bf8('0x22')](_0x58f5e8[_0x5bf8('0x37')][_0x5bf8('0x22')]);_0x54a933[_0x5bf8('0x23')]=qs['offset'](_0x58f5e8[_0x5bf8('0x37')][_0x5bf8('0x23')]);}return _0x31aba8[_0x5bf8('0x8a')](_0x54a933);}})[_0x5bf8('0x2a')](function(_0x55dff5){if(_0x55dff5){return _0x55dff5?{'count':_0x175f29,'rows':_0x55dff5}:null;}})[_0x5bf8('0x2a')](respondWithResult(_0x15bb7a,null))['catch'](handleError(_0x15bb7a,null));};
\ No newline at end of file
index ac56297..ddf010b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x411c=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x476b5b,_0x6172f8){var _0x24a924=function(_0x258664){while(--_0x258664){_0x476b5b['push'](_0x476b5b['shift']());}};_0x24a924(++_0x6172f8);}(_0x411c,0xc8));var _0xc411=function(_0x4689d9,_0x3162d9){_0x4689d9=_0x4689d9-0x0;var _0x5174d1=_0x411c[_0x4689d9];return _0x5174d1;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xc411('0x0'))['db'][_0xc411('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc411('0x2')](0x0);var events={'afterCreate':_0xc411('0x3'),'afterUpdate':_0xc411('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5834f8){return function(_0x23b8a9,_0x1c1136,_0xc27655){FaxQueueEvents['emit'](_0x5834f8+':'+_0x23b8a9['id'],_0x23b8a9);FaxQueueEvents[_0xc411('0x5')](_0x5834f8,_0x23b8a9);_0xc27655(null);};}for(var e in events){if(events[_0xc411('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xc411('0x7')]=FaxQueueEvents;
\ No newline at end of file
+var _0xd282=['update','remove','emit','hook','exports','../../mysqldb','FaxQueue','save'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xd282,0xfd));var _0x2d28=function(_0x34d8f7,_0x2abf6b){_0x34d8f7=_0x34d8f7-0x0;var _0x201f01=_0xd282[_0x34d8f7];return _0x201f01;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x2d28('0x0'))['db'][_0x2d28('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d28('0x2'),'afterUpdate':_0x2d28('0x3'),'afterDestroy':_0x2d28('0x4')};function emitEvent(_0x1f8182){return function(_0x3259b1,_0x395eb6,_0x501f4c){FaxQueueEvents[_0x2d28('0x5')](_0x1f8182+':'+_0x3259b1['id'],_0x3259b1);FaxQueueEvents[_0x2d28('0x5')](_0x1f8182,_0x3259b1);_0x501f4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2d28('0x6')](e,emitEvent(event));}}module[_0x2d28('0x7')]=FaxQueueEvents;
\ No newline at end of file
index 2b813a6..0a938dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd635=['../../config/logger','api','moment','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xd635,0x1e6));var _0x5d63=function(_0x1a84fc,_0x32fb6f){_0x1a84fc=_0x1a84fc-0x0;var _0x178d3a=_0xd635[_0x1a84fc];return _0x178d3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d63('0x0'))(_0x5d63('0x1'));var moment=require(_0x5d63('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d63('0x3'));var rimraf=require(_0x5d63('0x4'));var config=require(_0x5d63('0x5'));var attributes=require(_0x5d63('0x6'));module['exports']=function(_0x2f048c,_0xabd984){return _0x2f048c[_0x5d63('0x7')](_0x5d63('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8954=['rimraf','../../config/environment','exports','define','fax_queues','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x42650c,_0xc05ba5){var _0x3ba3dc=function(_0xba2022){while(--_0xba2022){_0x42650c['push'](_0x42650c['shift']());}};_0x3ba3dc(++_0xc05ba5);}(_0x8954,0x94));var _0x4895=function(_0xdde7a1,_0x442663){_0xdde7a1=_0xdde7a1-0x0;var _0x238939=_0x8954[_0xdde7a1];return _0x238939;};'use strict';var _=require(_0x4895('0x0'));var util=require('util');var logger=require(_0x4895('0x1'))(_0x4895('0x2'));var moment=require(_0x4895('0x3'));var BPromise=require(_0x4895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4895('0x5'));var rimraf=require(_0x4895('0x6'));var config=require(_0x4895('0x7'));var attributes=require('./faxQueue.attributes');module[_0x4895('0x8')]=function(_0xe4299e,_0x3d0235){return _0xe4299e[_0x4895('0x9')]('FaxQueue',attributes,{'tableName':_0x4895('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5386642..9de1e2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4085=['defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http','redis'];(function(_0x1fad89,_0x3fa02b){var _0x46e69c=function(_0x316e32){while(--_0x316e32){_0x1fad89['push'](_0x1fad89['shift']());}};_0x46e69c(++_0x3fa02b);}(_0x4085,0x100));var _0x5408=function(_0x243aa4,_0x4136bf){_0x243aa4=_0x243aa4-0x0;var _0x5b9261=_0x4085[_0x243aa4];return _0x5b9261;};'use strict';var _=require(_0x5408('0x0'));var util=require(_0x5408('0x1'));var moment=require(_0x5408('0x2'));var BPromise=require(_0x5408('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5408('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5408('0x5'));var logger=require('../../config/logger')(_0x5408('0x6'));var config=require(_0x5408('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5408('0x8')]({'port':0x232a});config[_0x5408('0x9')]=_[_0x5408('0xa')](config[_0x5408('0x9')],{'host':_0x5408('0xb'),'port':0x18eb});var socket=require(_0x5408('0xc'))(new Redis(config['redis']));require(_0x5408('0xd'))[_0x5408('0xe')](socket);function respondWithRpcPromise(_0x4ae9b2,_0x17dd7b,_0x570919){return new BPromise(function(_0x2c6984,_0x285fc6){return client[_0x5408('0xf')](_0x4ae9b2,_0x570919)['then'](function(_0x465ad1){logger[_0x5408('0x10')](_0x5408('0x11'),_0x17dd7b,'request\x20sent');logger[_0x5408('0x12')](_0x5408('0x13'),_0x17dd7b,_0x5408('0x14'),JSON[_0x5408('0x15')](_0x465ad1));if(_0x465ad1[_0x5408('0x16')]){if(_0x465ad1[_0x5408('0x16')]['code']===0x1f4){logger[_0x5408('0x16')]('FaxQueue,\x20%s,\x20%s',_0x17dd7b,_0x465ad1[_0x5408('0x16')][_0x5408('0x17')]);return _0x285fc6(_0x465ad1[_0x5408('0x16')][_0x5408('0x17')]);}logger[_0x5408('0x16')](_0x5408('0x11'),_0x17dd7b,_0x465ad1['error']['message']);return _0x2c6984(_0x465ad1[_0x5408('0x16')][_0x5408('0x17')]);}else{logger[_0x5408('0x10')](_0x5408('0x11'),_0x17dd7b,_0x5408('0x14'));_0x2c6984(_0x465ad1['result'][_0x5408('0x17')]);}})[_0x5408('0x18')](function(_0x51bda8){logger[_0x5408('0x16')]('FaxQueue,\x20%s,\x20%s',_0x17dd7b,_0x51bda8);_0x285fc6(_0x51bda8);});});}exports[_0x5408('0x19')]=function(_0x3afc67){var _0x6de97b=this;return new Promise(function(_0x423562,_0x2768e3){return db[_0x5408('0x1a')][_0x5408('0x1b')]({'raw':_0x3afc67['options']?_0x3afc67[_0x5408('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3afc67[_0x5408('0x1c')]?_0x3afc67[_0x5408('0x1c')][_0x5408('0x1d')]||null:null,'attributes':_0x3afc67[_0x5408('0x1c')]?_0x3afc67[_0x5408('0x1c')][_0x5408('0x1e')]||null:null,'limit':_0x3afc67['options']?_0x3afc67[_0x5408('0x1c')][_0x5408('0x1f')]||null:null,'include':_0x3afc67['options']?_0x3afc67[_0x5408('0x1c')][_0x5408('0x20')]?_[_0x5408('0x21')](_0x3afc67['options'][_0x5408('0x20')],function(_0x1d026c){return{'model':db[_0x1d026c[_0x5408('0x22')]],'as':_0x1d026c['as'],'attributes':_0x1d026c[_0x5408('0x1e')],'include':_0x1d026c[_0x5408('0x20')]?_[_0x5408('0x21')](_0x1d026c['include'],function(_0x460763){return{'model':db[_0x460763['model']],'as':_0x460763['as'],'attributes':_0x460763['attributes'],'include':_0x460763[_0x5408('0x20')]?_[_0x5408('0x21')](_0x460763[_0x5408('0x20')],function(_0x340338){return{'model':db[_0x340338[_0x5408('0x22')]],'as':_0x340338['as'],'attributes':_0x340338[_0x5408('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5408('0x23')](function(_0x4f942a){logger[_0x5408('0x10')](_0x5408('0x19'),_0x3afc67);logger[_0x5408('0x12')]('GetFaxQueue',_0x3afc67,JSON[_0x5408('0x15')](_0x4f942a));_0x423562(_0x4f942a);})[_0x5408('0x18')](function(_0x542951){logger['error'](_0x5408('0x19'),_0x542951[_0x5408('0x17')],_0x3afc67);_0x2768e3(_0x6de97b[_0x5408('0x16')](0x1f4,_0x542951[_0x5408('0x17')]));});});};exports[_0x5408('0x24')]=function(_0x10a6de){var _0x56222a=this;return new Promise(function(_0x4a3aad,_0x5e1176){return db[_0x5408('0x1a')][_0x5408('0x25')]({'raw':_0x10a6de[_0x5408('0x1c')]?_0x10a6de[_0x5408('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x10a6de[_0x5408('0x1c')]?_0x10a6de['options']['where']||null:null,'attributes':_0x10a6de[_0x5408('0x1c')]?_0x10a6de[_0x5408('0x1c')][_0x5408('0x1e')]||null:null,'include':_0x10a6de[_0x5408('0x1c')]?_0x10a6de[_0x5408('0x1c')][_0x5408('0x20')]?_[_0x5408('0x21')](_0x10a6de[_0x5408('0x1c')][_0x5408('0x20')],function(_0x4da793){return{'model':db[_0x4da793[_0x5408('0x22')]],'as':_0x4da793['as'],'attributes':_0x4da793['attributes'],'include':_0x4da793['include']?_[_0x5408('0x21')](_0x4da793['include'],function(_0x2d48af){return{'model':db[_0x2d48af['model']],'as':_0x2d48af['as'],'attributes':_0x2d48af[_0x5408('0x1e')],'include':_0x2d48af[_0x5408('0x20')]?_['map'](_0x2d48af['include'],function(_0x402480){return{'model':db[_0x402480[_0x5408('0x22')]],'as':_0x402480['as'],'attributes':_0x402480[_0x5408('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5408('0x23')](function(_0x3c0515){logger[_0x5408('0x10')](_0x5408('0x24'),_0x10a6de);logger['debug'](_0x5408('0x24'),_0x10a6de,JSON['stringify'](_0x3c0515));_0x4a3aad(_0x3c0515);})[_0x5408('0x18')](function(_0x1032f5){logger[_0x5408('0x16')](_0x5408('0x24'),_0x1032f5['message'],_0x10a6de);_0x5e1176(_0x56222a[_0x5408('0x16')](0x1f4,_0x1032f5[_0x5408('0x17')]));});});};
\ No newline at end of file
+var _0x1d47=['client','http','defaults','localhost','redis','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','info','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc2ba3d,_0x41d05a){var _0x4960b7=function(_0x295b8b){while(--_0x295b8b){_0xc2ba3d['push'](_0xc2ba3d['shift']());}};_0x4960b7(++_0x41d05a);}(_0x1d47,0x99));var _0x71d4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x1d47[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x71d4('0x0'));var util=require('util');var moment=require(_0x71d4('0x1'));var BPromise=require(_0x71d4('0x2'));var rs=require(_0x71d4('0x3'));var fs=require('fs');var Redis=require(_0x71d4('0x4'));var db=require(_0x71d4('0x5'))['db'];var utils=require(_0x71d4('0x6'));var logger=require(_0x71d4('0x7'))(_0x71d4('0x8'));var config=require(_0x71d4('0x9'));var jayson=require(_0x71d4('0xa'));var client=jayson[_0x71d4('0xb')][_0x71d4('0xc')]({'port':0x232a});config['redis']=_[_0x71d4('0xd')](config['redis'],{'host':_0x71d4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71d4('0xf')]));require('./faxQueue.socket')[_0x71d4('0x10')](socket);function respondWithRpcPromise(_0x558e17,_0x10fc8a,_0x570308){return new BPromise(function(_0x49f284,_0x1156fc){return client[_0x71d4('0x11')](_0x558e17,_0x570308)['then'](function(_0x42336f){logger['info'](_0x71d4('0x12'),_0x10fc8a,_0x71d4('0x13'));logger[_0x71d4('0x14')](_0x71d4('0x15'),_0x10fc8a,'request\x20sent',JSON[_0x71d4('0x16')](_0x42336f));if(_0x42336f['error']){if(_0x42336f['error'][_0x71d4('0x17')]===0x1f4){logger[_0x71d4('0x18')](_0x71d4('0x12'),_0x10fc8a,_0x42336f[_0x71d4('0x18')]['message']);return _0x1156fc(_0x42336f['error']['message']);}logger[_0x71d4('0x18')]('FaxQueue,\x20%s,\x20%s',_0x10fc8a,_0x42336f[_0x71d4('0x18')][_0x71d4('0x19')]);return _0x49f284(_0x42336f[_0x71d4('0x18')][_0x71d4('0x19')]);}else{logger['info'](_0x71d4('0x12'),_0x10fc8a,_0x71d4('0x13'));_0x49f284(_0x42336f['result'][_0x71d4('0x19')]);}})[_0x71d4('0x1a')](function(_0x5439ae){logger[_0x71d4('0x18')](_0x71d4('0x12'),_0x10fc8a,_0x5439ae);_0x1156fc(_0x5439ae);});});}exports[_0x71d4('0x1b')]=function(_0x45fb2a){var _0x20a48d=this;return new Promise(function(_0x4c9ac0,_0x23e9ee){return db['FaxQueue'][_0x71d4('0x1c')]({'raw':_0x45fb2a[_0x71d4('0x1d')]?_0x45fb2a[_0x71d4('0x1d')][_0x71d4('0x1e')]===undefined?!![]:![]:!![],'where':_0x45fb2a[_0x71d4('0x1d')]?_0x45fb2a[_0x71d4('0x1d')][_0x71d4('0x1f')]||null:null,'attributes':_0x45fb2a['options']?_0x45fb2a[_0x71d4('0x1d')][_0x71d4('0x20')]||null:null,'limit':_0x45fb2a[_0x71d4('0x1d')]?_0x45fb2a[_0x71d4('0x1d')][_0x71d4('0x21')]||null:null,'include':_0x45fb2a['options']?_0x45fb2a[_0x71d4('0x1d')][_0x71d4('0x22')]?_[_0x71d4('0x23')](_0x45fb2a[_0x71d4('0x1d')][_0x71d4('0x22')],function(_0x5988a8){return{'model':db[_0x5988a8[_0x71d4('0x24')]],'as':_0x5988a8['as'],'attributes':_0x5988a8[_0x71d4('0x20')],'include':_0x5988a8['include']?_['map'](_0x5988a8['include'],function(_0x8d0f24){return{'model':db[_0x8d0f24[_0x71d4('0x24')]],'as':_0x8d0f24['as'],'attributes':_0x8d0f24[_0x71d4('0x20')],'include':_0x8d0f24[_0x71d4('0x22')]?_[_0x71d4('0x23')](_0x8d0f24['include'],function(_0x3e068e){return{'model':db[_0x3e068e['model']],'as':_0x3e068e['as'],'attributes':_0x3e068e[_0x71d4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x71d4('0x25')](function(_0xb40c51){logger[_0x71d4('0x26')](_0x71d4('0x1b'),_0x45fb2a);logger[_0x71d4('0x14')](_0x71d4('0x1b'),_0x45fb2a,JSON[_0x71d4('0x16')](_0xb40c51));_0x4c9ac0(_0xb40c51);})[_0x71d4('0x1a')](function(_0x1bc20e){logger[_0x71d4('0x18')](_0x71d4('0x1b'),_0x1bc20e['message'],_0x45fb2a);_0x23e9ee(_0x20a48d['error'](0x1f4,_0x1bc20e[_0x71d4('0x19')]));});});};exports[_0x71d4('0x27')]=function(_0x538baa){var _0x3c8d46=this;return new Promise(function(_0x3cfed4,_0x1c1a71){return db['FaxQueue'][_0x71d4('0x28')]({'raw':_0x538baa[_0x71d4('0x1d')]?_0x538baa[_0x71d4('0x1d')][_0x71d4('0x1e')]===undefined?!![]:![]:!![],'where':_0x538baa[_0x71d4('0x1d')]?_0x538baa[_0x71d4('0x1d')]['where']||null:null,'attributes':_0x538baa[_0x71d4('0x1d')]?_0x538baa[_0x71d4('0x1d')][_0x71d4('0x20')]||null:null,'include':_0x538baa[_0x71d4('0x1d')]?_0x538baa['options'][_0x71d4('0x22')]?_[_0x71d4('0x23')](_0x538baa['options'][_0x71d4('0x22')],function(_0x4f4ba9){return{'model':db[_0x4f4ba9[_0x71d4('0x24')]],'as':_0x4f4ba9['as'],'attributes':_0x4f4ba9[_0x71d4('0x20')],'include':_0x4f4ba9[_0x71d4('0x22')]?_['map'](_0x4f4ba9[_0x71d4('0x22')],function(_0x587f21){return{'model':db[_0x587f21[_0x71d4('0x24')]],'as':_0x587f21['as'],'attributes':_0x587f21[_0x71d4('0x20')],'include':_0x587f21[_0x71d4('0x22')]?_[_0x71d4('0x23')](_0x587f21[_0x71d4('0x22')],function(_0x3dace2){return{'model':db[_0x3dace2[_0x71d4('0x24')]],'as':_0x3dace2['as'],'attributes':_0x3dace2[_0x71d4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x71d4('0x25')](function(_0x418c90){logger['info']('ShowFaxQueue',_0x538baa);logger[_0x71d4('0x14')](_0x71d4('0x27'),_0x538baa,JSON[_0x71d4('0x16')](_0x418c90));_0x3cfed4(_0x418c90);})[_0x71d4('0x1a')](function(_0x373b66){logger[_0x71d4('0x18')](_0x71d4('0x27'),_0x373b66[_0x71d4('0x19')],_0x538baa);_0x1c1a71(_0x3c8d46[_0x71d4('0x18')](0x1f4,_0x373b66[_0x71d4('0x19')]));});});};
\ No newline at end of file
index 2fdcda9..621f99a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2984=['remove','update','removeListener','register','length','faxQueue:','save'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x2984,0xae));var _0x4298=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x2984[_0x134c2e];return _0x2825db;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4298('0x0'),_0x4298('0x1'),_0x4298('0x2')];function createListener(_0x492cd0,_0x2b0ab3){return function(_0x22ee0a){_0x2b0ab3['emit'](_0x492cd0,_0x22ee0a);};}function removeListener(_0xaccb26,_0xe8665){return function(){FaxQueueEvents[_0x4298('0x3')](_0xaccb26,_0xe8665);};}exports[_0x4298('0x4')]=function(_0x1cd1d8){for(var _0x527eb7=0x0,_0x16972c=events[_0x4298('0x5')];_0x527eb7<_0x16972c;_0x527eb7++){var _0x3ed0cd=events[_0x527eb7];var _0x27cd31=createListener(_0x4298('0x6')+_0x3ed0cd,_0x1cd1d8);FaxQueueEvents['on'](_0x3ed0cd,_0x27cd31);}};
\ No newline at end of file
+var _0x6fd5=['./faxQueue.events','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x157363,_0x43e87b){var _0x25dd68=function(_0xfc7f6c){while(--_0xfc7f6c){_0x157363['push'](_0x157363['shift']());}};_0x25dd68(++_0x43e87b);}(_0x6fd5,0xf0));var _0x56fd=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6fd5[_0x4243a3];return _0x1b2a33;};'use strict';var FaxQueueEvents=require(_0x56fd('0x0'));var events=['save',_0x56fd('0x1'),_0x56fd('0x2')];function createListener(_0x2626a2,_0x2d9a4e){return function(_0xf5b2de){_0x2d9a4e[_0x56fd('0x3')](_0x2626a2,_0xf5b2de);};}function removeListener(_0x3aecd4,_0x5a397a){return function(){FaxQueueEvents[_0x56fd('0x4')](_0x3aecd4,_0x5a397a);};}exports[_0x56fd('0x5')]=function(_0x1ae776){for(var _0x649fcd=0x0,_0x29d85b=events[_0x56fd('0x6')];_0x649fcd<_0x29d85b;_0x649fcd++){var _0x26e641=events[_0x649fcd];var _0x48ede7=createListener(_0x56fd('0x7')+_0x26e641,_0x1ae776);FaxQueueEvents['on'](_0x26e641,_0x48ede7);}};
\ No newline at end of file
index 675fb0e..d326456 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd10=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','update','destroy','delete','removeTeams','multer','util'];(function(_0x1f4095,_0xba697b){var _0x16ab98=function(_0x24b757){while(--_0x24b757){_0x1f4095['push'](_0x1f4095['shift']());}};_0x16ab98(++_0xba697b);}(_0xbd10,0x85));var _0x0bd1=function(_0x263e02,_0x1256b6){_0x263e02=_0x263e02-0x0;var _0x27d5b6=_0xbd10[_0x263e02];return _0x27d5b6;};'use strict';var multer=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var path=require(_0x0bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd1('0x3'));var router=express[_0x0bd1('0x4')]();var fs_extra=require(_0x0bd1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var controller=require(_0x0bd1('0x8'));router[_0x0bd1('0x9')]('/',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0xb')]);router['get'](_0x0bd1('0xc'),auth['isAuthenticated'](),controller[_0x0bd1('0xd')]);router[_0x0bd1('0x9')](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller['show']);router[_0x0bd1('0x9')](_0x0bd1('0xf'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x10')]);router[_0x0bd1('0x9')](_0x0bd1('0x11'),auth['isAuthenticated'](),controller[_0x0bd1('0x12')]);router[_0x0bd1('0x9')](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x14')]);router[_0x0bd1('0x15')]('/',auth['isAuthenticated'](),controller[_0x0bd1('0x16')]);router[_0x0bd1('0x15')](_0x0bd1('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x0bd1('0x15')](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller['addAgents']);router['put'](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x17')]);router['delete'](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x18')]);router[_0x0bd1('0x19')]('/:id/teams',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x1a')]);router['delete'](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0xef17=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','describe','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','/:id/users','put','update','destroy'];(function(_0xa08526,_0xd2a376){var _0x2684eb=function(_0x2bfe3a){while(--_0x2bfe3a){_0xa08526['push'](_0xa08526['shift']());}};_0x2684eb(++_0xd2a376);}(_0xef17,0x136));var _0x7ef1=function(_0x5b9f02,_0x32d165){_0x5b9f02=_0x5b9f02-0x0;var _0xce60b9=_0xef17[_0x5b9f02];return _0xce60b9;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xb')](_0x7ef1('0xe'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xf')]);router[_0x7ef1('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7ef1('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7ef1('0x11')]);router['post']('/',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x12')]);router[_0x7ef1('0x13')](_0x7ef1('0x14'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x15')]);router[_0x7ef1('0x13')](_0x7ef1('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7ef1('0x17')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x19')]);router['delete'](_0x7ef1('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x7ef1('0x16'),auth['isAuthenticated'](),controller[_0x7ef1('0x1a')]);module[_0x7ef1('0x1b')]=router;
\ No newline at end of file
index 4680634..eb5ff32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf067=['moment','sequelize','STRING','DATE'];(function(_0x5cd003,_0x175cba){var _0x3c6930=function(_0x3de2b0){while(--_0x3de2b0){_0x5cd003['push'](_0x5cd003['shift']());}};_0x3c6930(++_0x175cba);}(_0xf067,0x124));var _0x7f06=function(_0x2c9315,_0x356307){_0x2c9315=_0x2c9315-0x0;var _0x4a4fec=_0xf067[_0x2c9315];return _0x4a4fec;};'use strict';var moment=require(_0x7f06('0x0'));var Sequelize=require(_0x7f06('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7f06('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7f06('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7f06('0x3')]},'reason':{'type':Sequelize[_0x7f06('0x2')]}};
\ No newline at end of file
+var _0x4bcf=['STRING','DATE','moment','sequelize'];(function(_0x1934fc,_0x437669){var _0x4c2de0=function(_0x89358c){while(--_0x89358c){_0x1934fc['push'](_0x1934fc['shift']());}};_0x4c2de0(++_0x437669);}(_0x4bcf,0x116));var _0xf4bc=function(_0xc9b9f3,_0x4b96c4){_0xc9b9f3=_0xc9b9f3-0x0;var _0x2e4a9a=_0x4bcf[_0xc9b9f3];return _0x2e4a9a;};'use strict';var moment=require(_0xf4bc('0x0'));var Sequelize=require(_0xf4bc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf4bc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf4bc('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf4bc('0x3')]},'exitAt':{'type':Sequelize[_0xf4bc('0x3')]},'reason':{'type':Sequelize[_0xf4bc('0x2')]}};
\ No newline at end of file
index 665bf34..33b3815 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8482=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','options','findAll','rows','show','length','includeAll','include','find','create','body','catch','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x1a7abc,_0x58311c){var _0x135e97=function(_0x4d7f74){while(--_0x4d7f74){_0x1a7abc['push'](_0x1a7abc['shift']());}};_0x135e97(++_0x58311c);}(_0x8482,0x14e));var _0x2848=function(_0x2f84fb,_0x2c7f84){_0x2f84fb=_0x2f84fb-0x0;var _0x593d98=_0x8482[_0x2f84fb];return _0x593d98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2848('0x0'));var zipdir=require(_0x2848('0x1'));var jsonpatch=require(_0x2848('0x2'));var rp=require(_0x2848('0x3'));var moment=require(_0x2848('0x4'));var BPromise=require(_0x2848('0x5'));var Mustache=require(_0x2848('0x6'));var util=require(_0x2848('0x7'));var path=require(_0x2848('0x8'));var sox=require(_0x2848('0x9'));var csv=require('to-csv');var ejs=require(_0x2848('0xa'));var fs=require('fs');var fs_extra=require(_0x2848('0xb'));var _=require('lodash');var squel=require(_0x2848('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2848('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2848('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2848('0xf'));var as=require(_0x2848('0x10'));var hardwareService=require(_0x2848('0x11'));var logger=require(_0x2848('0x12'))(_0x2848('0x13'));var utils=require(_0x2848('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2848('0x15'))['db'];function respondWithStatusCode(_0x465380,_0xf0658d){_0xf0658d=_0xf0658d||0xcc;return function(_0x566a0b){if(_0x566a0b){return _0x465380[_0x2848('0x16')](_0xf0658d);}return _0x465380[_0x2848('0x17')](_0xf0658d)[_0x2848('0x18')]();};}function respondWithResult(_0x5e64c7,_0xbddd26){_0xbddd26=_0xbddd26||0xc8;return function(_0x501a0e){if(_0x501a0e){return _0x5e64c7[_0x2848('0x17')](_0xbddd26)['json'](_0x501a0e);}};}function respondWithFilteredResult(_0x1002d2,_0xeba65b){return function(_0x6600c5){if(_0x6600c5){var _0x59f39a=typeof _0xeba65b['offset']==='undefined'&&typeof _0xeba65b['limit']===_0x2848('0x19');var _0x1acd41=_0x6600c5[_0x2848('0x1a')];var _0x46755c=_0x59f39a?0x0:_0xeba65b[_0x2848('0x1b')];var _0x3b4eeb=_0x59f39a?_0x6600c5[_0x2848('0x1a')]:_0xeba65b[_0x2848('0x1b')]+_0xeba65b[_0x2848('0x1c')];var _0x193ffa;if(_0x3b4eeb>=_0x1acd41){_0x3b4eeb=_0x1acd41;_0x193ffa=0xc8;}else{_0x193ffa=0xce;}_0x1002d2[_0x2848('0x17')](_0x193ffa);return _0x1002d2['set'](_0x2848('0x1d'),_0x46755c+'-'+_0x3b4eeb+'/'+_0x1acd41)[_0x2848('0x1e')](_0x6600c5);}return null;};}function patchUpdates(_0x1a1f79){return function(_0x5748ae){try{jsonpatch[_0x2848('0x1f')](_0x5748ae,_0x1a1f79,!![]);}catch(_0x1f67a7){return BPromise[_0x2848('0x20')](_0x1f67a7);}return _0x5748ae[_0x2848('0x21')]();};}function saveUpdates(_0x3b99a2,_0x555279){return function(_0x3dd7db){if(_0x3dd7db){return _0x3dd7db[_0x2848('0x22')](_0x3b99a2)[_0x2848('0x23')](function(_0x436709){return _0x436709;});}return null;};}function removeEntity(_0xea4128,_0x40f510){return function(_0x5f38e2){if(_0x5f38e2){return _0x5f38e2[_0x2848('0x24')]()['then'](function(){_0xea4128[_0x2848('0x17')](0xcc)[_0x2848('0x18')]();});}};}function handleEntityNotFound(_0x2d936a,_0x4517d3){return function(_0x51c924){if(!_0x51c924){_0x2d936a[_0x2848('0x16')](0x194);}return _0x51c924;};}function handleError(_0xecd4f4,_0xdba069){_0xdba069=_0xdba069||0x1f4;return function(_0x2dc32e){logger[_0x2848('0x25')](_0x2dc32e[_0x2848('0x26')]);if(_0x2dc32e[_0x2848('0x27')]){delete _0x2dc32e['name'];}_0xecd4f4['status'](_0xdba069)['send'](_0x2dc32e);};}exports[_0x2848('0x28')]=function(_0x18df37,_0x3b9c0d){var _0x3f915b={},_0x189701={},_0x528825={'count':0x0,'rows':[]};var _0x4c9685=_['map'](db[_0x2848('0x29')][_0x2848('0x2a')],function(_0x1ff601){return{'name':_0x1ff601[_0x2848('0x2b')],'type':_0x1ff601[_0x2848('0x2c')][_0x2848('0x2d')]};});_0x189701[_0x2848('0x2e')]=_[_0x2848('0x2f')](_0x4c9685,_0x2848('0x27'));_0x189701[_0x2848('0x30')]=_[_0x2848('0x31')](_0x18df37['query']);_0x189701[_0x2848('0x32')]=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],_0x189701[_0x2848('0x30')]);_0x3f915b['attributes']=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x18df37[_0x2848('0x30')]['fields']));_0x3f915b['attributes']=_0x3f915b['attributes']['length']?_0x3f915b[_0x2848('0x35')]:_0x189701[_0x2848('0x2e')];if(!_0x18df37['query']['hasOwnProperty'](_0x2848('0x36'))){_0x3f915b[_0x2848('0x1c')]=qs[_0x2848('0x1c')](_0x18df37[_0x2848('0x30')][_0x2848('0x1c')]);_0x3f915b['offset']=qs[_0x2848('0x1b')](_0x18df37[_0x2848('0x30')][_0x2848('0x1b')]);}_0x3f915b['order']=qs[_0x2848('0x37')](_0x18df37[_0x2848('0x30')][_0x2848('0x37')]);_0x3f915b[_0x2848('0x38')]=qs[_0x2848('0x32')](_['pick'](_0x18df37['query'],_0x189701[_0x2848('0x32')]),_0x4c9685);if(_0x18df37[_0x2848('0x30')][_0x2848('0x39')]){_0x3f915b[_0x2848('0x38')]=_[_0x2848('0x3a')](_0x3f915b[_0x2848('0x38')],{'$or':_['map'](_0x4c9685,function(_0x489ed8){if(_0x489ed8['type']!=='VIRTUAL'){var _0x5c3d4e={};_0x5c3d4e[_0x489ed8[_0x2848('0x27')]]={'$like':'%'+_0x18df37['query'][_0x2848('0x39')]+'%'};return _0x5c3d4e;}})});}_0x3f915b=_['merge']({},_0x3f915b,_0x18df37[_0x2848('0x3b')]);var _0x24af01={'where':_0x3f915b[_0x2848('0x38')]};return db['FaxQueueReport'][_0x2848('0x1a')](_0x24af01)[_0x2848('0x23')](function(_0x368ef1){_0x528825[_0x2848('0x1a')]=_0x368ef1;if(_0x18df37[_0x2848('0x30')]['includeAll']){_0x3f915b['include']=[{'all':!![]}];}return db[_0x2848('0x29')][_0x2848('0x3c')](_0x3f915b);})[_0x2848('0x23')](function(_0xfe7e37){_0x528825[_0x2848('0x3d')]=_0xfe7e37;return _0x528825;})[_0x2848('0x23')](respondWithFilteredResult(_0x3b9c0d,_0x3f915b))['catch'](handleError(_0x3b9c0d,null));};exports[_0x2848('0x3e')]=function(_0x5ef41f,_0x3208f2){var _0x56d0fa={'raw':!![],'where':{'id':_0x5ef41f['params']['id']}},_0x32f51a={};_0x32f51a['model']=_['keys'](db['FaxQueueReport'][_0x2848('0x2a')]);_0x32f51a[_0x2848('0x30')]=_[_0x2848('0x31')](_0x5ef41f[_0x2848('0x30')]);_0x32f51a[_0x2848('0x32')]=_[_0x2848('0x33')](_0x32f51a[_0x2848('0x2e')],_0x32f51a[_0x2848('0x30')]);_0x56d0fa[_0x2848('0x35')]=_['intersection'](_0x32f51a[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x5ef41f[_0x2848('0x30')]['fields']));_0x56d0fa[_0x2848('0x35')]=_0x56d0fa[_0x2848('0x35')][_0x2848('0x3f')]?_0x56d0fa[_0x2848('0x35')]:_0x32f51a[_0x2848('0x2e')];if(_0x5ef41f['query'][_0x2848('0x40')]){_0x56d0fa[_0x2848('0x41')]=[{'all':!![]}];}_0x56d0fa=_[_0x2848('0x3a')]({},_0x56d0fa,_0x5ef41f[_0x2848('0x3b')]);return db['FaxQueueReport'][_0x2848('0x42')](_0x56d0fa)[_0x2848('0x23')](handleEntityNotFound(_0x3208f2,null))[_0x2848('0x23')](respondWithResult(_0x3208f2,null))['catch'](handleError(_0x3208f2,null));};exports[_0x2848('0x43')]=function(_0xf6c69,_0x53420b){return db['FaxQueueReport'][_0x2848('0x43')](_0xf6c69[_0x2848('0x44')],{})[_0x2848('0x23')](respondWithResult(_0x53420b,0xc9))[_0x2848('0x45')](handleError(_0x53420b,null));};exports[_0x2848('0x22')]=function(_0x4e4b1e,_0x35ed61){if(_0x4e4b1e[_0x2848('0x44')]['id']){delete _0x4e4b1e[_0x2848('0x44')]['id'];}return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0x4e4b1e[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x35ed61,null))[_0x2848('0x23')](saveUpdates(_0x4e4b1e[_0x2848('0x44')],null))[_0x2848('0x23')](respondWithResult(_0x35ed61,null))[_0x2848('0x45')](handleError(_0x35ed61,null));};exports[_0x2848('0x24')]=function(_0xe8e50,_0x1a8946){return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0xe8e50[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x1a8946,null))[_0x2848('0x23')](removeEntity(_0x1a8946,null))[_0x2848('0x45')](handleError(_0x1a8946,null));};exports['describe']=function(_0x2814a2,_0x3b996e){return db['FaxQueueReport'][_0x2848('0x47')]()[_0x2848('0x23')](respondWithResult(_0x3b996e,null))['catch'](handleError(_0x3b996e,null));};
\ No newline at end of file
+var _0x0962=['type','VIRTUAL','options','includeAll','include','findAll','catch','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x5b94cd,_0x819fb7){var _0x540115=function(_0x604dd){while(--_0x604dd){_0x5b94cd['push'](_0x5b94cd['shift']());}};_0x540115(++_0x819fb7);}(_0x0962,0x198));var _0x2096=function(_0x6e337f,_0x1dd036){_0x6e337f=_0x6e337f-0x0;var _0x3345c0=_0x0962[_0x6e337f];return _0x3345c0;};'use strict';var emlformat=require(_0x2096('0x0'));var rimraf=require(_0x2096('0x1'));var zipdir=require(_0x2096('0x2'));var jsonpatch=require(_0x2096('0x3'));var rp=require('request-promise');var moment=require(_0x2096('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2096('0x5'));var path=require(_0x2096('0x6'));var sox=require(_0x2096('0x7'));var csv=require(_0x2096('0x8'));var ejs=require(_0x2096('0x9'));var fs=require('fs');var fs_extra=require(_0x2096('0xa'));var _=require(_0x2096('0xb'));var squel=require(_0x2096('0xc'));var crypto=require('crypto');var jsforce=require(_0x2096('0xd'));var deskjs=require(_0x2096('0xe'));var toCsv=require(_0x2096('0x8'));var querystring=require(_0x2096('0xf'));var Papa=require(_0x2096('0x10'));var Redis=require(_0x2096('0x11'));var authService=require(_0x2096('0x12'));var qs=require(_0x2096('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2096('0x14'));var logger=require(_0x2096('0x15'))('api');var utils=require(_0x2096('0x16'));var config=require(_0x2096('0x17'));var licenseUtil=require(_0x2096('0x18'));var db=require(_0x2096('0x19'))['db'];function respondWithStatusCode(_0x5d351e,_0x541213){_0x541213=_0x541213||0xcc;return function(_0x404e2b){if(_0x404e2b){return _0x5d351e[_0x2096('0x1a')](_0x541213);}return _0x5d351e[_0x2096('0x1b')](_0x541213)['end']();};}function respondWithResult(_0x14bf54,_0x45b7ec){_0x45b7ec=_0x45b7ec||0xc8;return function(_0x420c57){if(_0x420c57){return _0x14bf54['status'](_0x45b7ec)[_0x2096('0x1c')](_0x420c57);}};}function respondWithFilteredResult(_0x37dcd0,_0x2c6e88){return function(_0x305ada){if(_0x305ada){var _0x5b151a=typeof _0x2c6e88[_0x2096('0x1d')]===_0x2096('0x1e')&&typeof _0x2c6e88[_0x2096('0x1f')]==='undefined';var _0x479ba2=_0x305ada[_0x2096('0x20')];var _0x22c478=_0x5b151a?0x0:_0x2c6e88['offset'];var _0xd7e9e0=_0x5b151a?_0x305ada[_0x2096('0x20')]:_0x2c6e88[_0x2096('0x1d')]+_0x2c6e88['limit'];var _0x2a9f62;if(_0xd7e9e0>=_0x479ba2){_0xd7e9e0=_0x479ba2;_0x2a9f62=0xc8;}else{_0x2a9f62=0xce;}_0x37dcd0['status'](_0x2a9f62);return _0x37dcd0[_0x2096('0x21')](_0x2096('0x22'),_0x22c478+'-'+_0xd7e9e0+'/'+_0x479ba2)[_0x2096('0x1c')](_0x305ada);}return null;};}function patchUpdates(_0x12fe63){return function(_0x3f4d7d){try{jsonpatch[_0x2096('0x23')](_0x3f4d7d,_0x12fe63,!![]);}catch(_0x2125ad){return BPromise[_0x2096('0x24')](_0x2125ad);}return _0x3f4d7d[_0x2096('0x25')]();};}function saveUpdates(_0x58c61c,_0x40f28c){return function(_0x4b74e2){if(_0x4b74e2){return _0x4b74e2[_0x2096('0x26')](_0x58c61c)['then'](function(_0x5dfdd5){return _0x5dfdd5;});}return null;};}function removeEntity(_0x362414,_0x686f15){return function(_0x3c3d9c){if(_0x3c3d9c){return _0x3c3d9c[_0x2096('0x27')]()[_0x2096('0x28')](function(){_0x362414[_0x2096('0x1b')](0xcc)[_0x2096('0x29')]();});}};}function handleEntityNotFound(_0xe72b8a,_0x285ff1){return function(_0x2e2c03){if(!_0x2e2c03){_0xe72b8a[_0x2096('0x1a')](0x194);}return _0x2e2c03;};}function handleError(_0xd70ed4,_0x587afa){_0x587afa=_0x587afa||0x1f4;return function(_0x4a78e7){logger[_0x2096('0x2a')](_0x4a78e7[_0x2096('0x2b')]);if(_0x4a78e7[_0x2096('0x2c')]){delete _0x4a78e7[_0x2096('0x2c')];}_0xd70ed4[_0x2096('0x1b')](_0x587afa)[_0x2096('0x2d')](_0x4a78e7);};}exports[_0x2096('0x2e')]=function(_0x1e980c,_0x73b7b4){var _0x56e019={},_0x1524de={},_0x393ef1={'count':0x0,'rows':[]};var _0x77692b=_[_0x2096('0x2f')](db[_0x2096('0x30')][_0x2096('0x31')],function(_0x1a0ace){return{'name':_0x1a0ace[_0x2096('0x32')],'type':_0x1a0ace['type'][_0x2096('0x33')]};});_0x1524de[_0x2096('0x34')]=_['map'](_0x77692b,_0x2096('0x2c'));_0x1524de[_0x2096('0x35')]=_[_0x2096('0x36')](_0x1e980c[_0x2096('0x35')]);_0x1524de[_0x2096('0x37')]=_[_0x2096('0x38')](_0x1524de[_0x2096('0x34')],_0x1524de[_0x2096('0x35')]);_0x56e019['attributes']=_[_0x2096('0x38')](_0x1524de[_0x2096('0x34')],qs['fields'](_0x1e980c[_0x2096('0x35')]['fields']));_0x56e019['attributes']=_0x56e019[_0x2096('0x39')][_0x2096('0x3a')]?_0x56e019[_0x2096('0x39')]:_0x1524de[_0x2096('0x34')];if(!_0x1e980c['query']['hasOwnProperty'](_0x2096('0x3b'))){_0x56e019[_0x2096('0x1f')]=qs[_0x2096('0x1f')](_0x1e980c[_0x2096('0x35')]['limit']);_0x56e019['offset']=qs[_0x2096('0x1d')](_0x1e980c[_0x2096('0x35')]['offset']);}_0x56e019[_0x2096('0x3c')]=qs[_0x2096('0x3d')](_0x1e980c['query'][_0x2096('0x3d')]);_0x56e019['where']=qs['filters'](_[_0x2096('0x3e')](_0x1e980c['query'],_0x1524de[_0x2096('0x37')]),_0x77692b);if(_0x1e980c['query'][_0x2096('0x3f')]){_0x56e019[_0x2096('0x40')]=_[_0x2096('0x41')](_0x56e019[_0x2096('0x40')],{'$or':_[_0x2096('0x2f')](_0x77692b,function(_0x2f226a){if(_0x2f226a[_0x2096('0x42')]!==_0x2096('0x43')){var _0x1072af={};_0x1072af[_0x2f226a[_0x2096('0x2c')]]={'$like':'%'+_0x1e980c[_0x2096('0x35')][_0x2096('0x3f')]+'%'};return _0x1072af;}})});}_0x56e019=_['merge']({},_0x56e019,_0x1e980c[_0x2096('0x44')]);var _0x4d7ec5={'where':_0x56e019[_0x2096('0x40')]};return db[_0x2096('0x30')][_0x2096('0x20')](_0x4d7ec5)[_0x2096('0x28')](function(_0x3ebe73){_0x393ef1[_0x2096('0x20')]=_0x3ebe73;if(_0x1e980c[_0x2096('0x35')][_0x2096('0x45')]){_0x56e019[_0x2096('0x46')]=[{'all':!![]}];}return db[_0x2096('0x30')][_0x2096('0x47')](_0x56e019);})['then'](function(_0x38efd0){_0x393ef1['rows']=_0x38efd0;return _0x393ef1;})[_0x2096('0x28')](respondWithFilteredResult(_0x73b7b4,_0x56e019))[_0x2096('0x48')](handleError(_0x73b7b4,null));};exports['show']=function(_0x492116,_0x3bd152){var _0x167b97={'raw':!![],'where':{'id':_0x492116[_0x2096('0x49')]['id']}},_0x52b4dc={};_0x52b4dc[_0x2096('0x34')]=_[_0x2096('0x36')](db[_0x2096('0x30')][_0x2096('0x31')]);_0x52b4dc[_0x2096('0x35')]=_['keys'](_0x492116[_0x2096('0x35')]);_0x52b4dc[_0x2096('0x37')]=_[_0x2096('0x38')](_0x52b4dc['model'],_0x52b4dc[_0x2096('0x35')]);_0x167b97[_0x2096('0x39')]=_[_0x2096('0x38')](_0x52b4dc['model'],qs[_0x2096('0x4a')](_0x492116[_0x2096('0x35')]['fields']));_0x167b97[_0x2096('0x39')]=_0x167b97[_0x2096('0x39')][_0x2096('0x3a')]?_0x167b97[_0x2096('0x39')]:_0x52b4dc['model'];if(_0x492116['query'][_0x2096('0x45')]){_0x167b97['include']=[{'all':!![]}];}_0x167b97=_['merge']({},_0x167b97,_0x492116['options']);return db[_0x2096('0x30')][_0x2096('0x4b')](_0x167b97)[_0x2096('0x28')](handleEntityNotFound(_0x3bd152,null))[_0x2096('0x28')](respondWithResult(_0x3bd152,null))['catch'](handleError(_0x3bd152,null));};exports['create']=function(_0x18b972,_0x300e02){return db[_0x2096('0x30')][_0x2096('0x4c')](_0x18b972[_0x2096('0x4d')],{})[_0x2096('0x28')](respondWithResult(_0x300e02,0xc9))['catch'](handleError(_0x300e02,null));};exports['update']=function(_0x1e7dea,_0x2ed29c){if(_0x1e7dea[_0x2096('0x4d')]['id']){delete _0x1e7dea[_0x2096('0x4d')]['id'];}return db[_0x2096('0x30')]['find']({'where':{'id':_0x1e7dea['params']['id']}})[_0x2096('0x28')](handleEntityNotFound(_0x2ed29c,null))[_0x2096('0x28')](saveUpdates(_0x1e7dea['body'],null))[_0x2096('0x28')](respondWithResult(_0x2ed29c,null))[_0x2096('0x48')](handleError(_0x2ed29c,null));};exports[_0x2096('0x27')]=function(_0x58a25d,_0x5e0c64){return db['FaxQueueReport'][_0x2096('0x4b')]({'where':{'id':_0x58a25d[_0x2096('0x49')]['id']}})[_0x2096('0x28')](handleEntityNotFound(_0x5e0c64,null))[_0x2096('0x28')](removeEntity(_0x5e0c64,null))[_0x2096('0x48')](handleError(_0x5e0c64,null));};exports[_0x2096('0x4e')]=function(_0x542915,_0x2aff64){return db[_0x2096('0x30')]['describe']()['then'](respondWithResult(_0x2aff64,null))[_0x2096('0x48')](handleError(_0x2aff64,null));};
\ No newline at end of file
index 723ad86..d849318 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x4a439c,_0x1a04a5){var _0x5aa32b=function(_0x387aa8){while(--_0x387aa8){_0x4a439c['push'](_0x4a439c['shift']());}};_0x5aa32b(++_0x1a04a5);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7fbe[_0x2576d7];return _0x16a08c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x2a1044,_0x145063){var _0x14b7c6=function(_0x3dbbb){while(--_0x3dbbb){_0x2a1044['push'](_0x2a1044['shift']());}};_0x14b7c6(++_0x145063);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x7fbe[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 6292768..f0d4d69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd97=['http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x294c52,_0x447c50){var _0x31eb24=function(_0x124d40){while(--_0x124d40){_0x294c52['push'](_0x294c52['shift']());}};_0x31eb24(++_0x447c50);}(_0xbd97,0x11c));var _0x7bd9=function(_0xe3e430,_0x594a7c){_0xe3e430=_0xe3e430-0x0;var _0x4c67ee=_0xbd97[_0xe3e430];return _0x4c67ee;};'use strict';var _=require(_0x7bd9('0x0'));var util=require(_0x7bd9('0x1'));var moment=require(_0x7bd9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7bd9('0x3'));var fs=require('fs');var Redis=require(_0x7bd9('0x4'));var db=require(_0x7bd9('0x5'))['db'];var utils=require(_0x7bd9('0x6'));var logger=require(_0x7bd9('0x7'))(_0x7bd9('0x8'));var config=require(_0x7bd9('0x9'));var jayson=require(_0x7bd9('0xa'));var client=jayson[_0x7bd9('0xb')][_0x7bd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f4dc3,_0x576268,_0x33db3c){return new BPromise(function(_0x229b4a,_0x2ae8d1){return client[_0x7bd9('0xd')](_0x1f4dc3,_0x33db3c)['then'](function(_0xee60b4){logger[_0x7bd9('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x576268,_0x7bd9('0xf'));logger[_0x7bd9('0x10')](_0x7bd9('0x11'),_0x576268,_0x7bd9('0xf'),JSON[_0x7bd9('0x12')](_0xee60b4));if(_0xee60b4[_0x7bd9('0x13')]){if(_0xee60b4[_0x7bd9('0x13')][_0x7bd9('0x14')]===0x1f4){logger[_0x7bd9('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x576268,_0xee60b4['error'][_0x7bd9('0x15')]);return _0x2ae8d1(_0xee60b4['error'][_0x7bd9('0x15')]);}logger[_0x7bd9('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x576268,_0xee60b4[_0x7bd9('0x13')][_0x7bd9('0x15')]);return _0x229b4a(_0xee60b4[_0x7bd9('0x13')]['message']);}else{logger[_0x7bd9('0xe')](_0x7bd9('0x16'),_0x576268,'request\x20sent');_0x229b4a(_0xee60b4[_0x7bd9('0x17')][_0x7bd9('0x15')]);}})[_0x7bd9('0x18')](function(_0x3666ae){logger[_0x7bd9('0x13')](_0x7bd9('0x16'),_0x576268,_0x3666ae);_0x2ae8d1(_0x3666ae);});});}exports[_0x7bd9('0x19')]=function(_0xa65d9d){var _0x3da38f=this;return new Promise(function(_0x590dee,_0x59a0d8){return db[_0x7bd9('0x1a')][_0x7bd9('0x1b')](_0xa65d9d[_0x7bd9('0x1c')],{'raw':_0xa65d9d['options']?_0xa65d9d[_0x7bd9('0x1d')][_0x7bd9('0x1e')]===undefined?!![]:![]:!![]})[_0x7bd9('0x1f')](function(_0x5968e0){logger['info'](_0x7bd9('0x19'),_0xa65d9d);logger[_0x7bd9('0x10')]('CreateFaxQueueReport',_0xa65d9d,JSON[_0x7bd9('0x12')](_0x5968e0));_0x590dee(_0x5968e0);})[_0x7bd9('0x18')](function(_0x2c5599){logger['error'](_0x7bd9('0x19'),_0x2c5599[_0x7bd9('0x15')],_0xa65d9d);_0x59a0d8(_0x3da38f[_0x7bd9('0x13')](0x1f4,_0x2c5599[_0x7bd9('0x15')]));});});};exports[_0x7bd9('0x20')]=function(_0x186516){var _0x315790=this;return new Promise(function(_0x4b8c23,_0x571924){return db[_0x7bd9('0x1a')][_0x7bd9('0x21')](_0x186516[_0x7bd9('0x1c')],{'raw':_0x186516['options']?_0x186516[_0x7bd9('0x1d')][_0x7bd9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x186516[_0x7bd9('0x1d')]?_0x186516['options'][_0x7bd9('0x22')]||null:null,'attributes':_0x186516[_0x7bd9('0x1d')]?_0x186516[_0x7bd9('0x1d')][_0x7bd9('0x23')]||null:null,'limit':_0x186516[_0x7bd9('0x1d')]?_0x186516[_0x7bd9('0x1d')][_0x7bd9('0x24')]||null:null})['then'](function(_0x22863a){logger[_0x7bd9('0xe')](_0x7bd9('0x20'),_0x186516);logger[_0x7bd9('0x10')](_0x7bd9('0x20'),_0x186516,JSON[_0x7bd9('0x12')](_0x22863a));_0x4b8c23(_0x22863a);})['catch'](function(_0x1e5d0c){logger[_0x7bd9('0x13')](_0x7bd9('0x20'),_0x1e5d0c['message'],_0x186516);_0x571924(_0x315790['error'](0x1f4,_0x1e5d0c['message']));});});};
\ No newline at end of file
+var _0xb320=['FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xb320,0xa9));var _0x0b32=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xb320[_0x22bdd3];return _0x44d9d9;};'use strict';var _=require('lodash');var util=require(_0x0b32('0x0'));var moment=require('moment');var BPromise=require(_0x0b32('0x1'));var rs=require(_0x0b32('0x2'));var fs=require('fs');var Redis=require(_0x0b32('0x3'));var db=require(_0x0b32('0x4'))['db'];var utils=require(_0x0b32('0x5'));var logger=require(_0x0b32('0x6'))(_0x0b32('0x7'));var config=require(_0x0b32('0x8'));var jayson=require(_0x0b32('0x9'));var client=jayson[_0x0b32('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x561033,_0x5176db,_0x141586){return new BPromise(function(_0xb339e3,_0x5d91c8){return client['request'](_0x561033,_0x141586)[_0x0b32('0xb')](function(_0x1c0682){logger[_0x0b32('0xc')](_0x0b32('0xd'),_0x5176db,'request\x20sent');logger[_0x0b32('0xe')](_0x0b32('0xf'),_0x5176db,_0x0b32('0x10'),JSON[_0x0b32('0x11')](_0x1c0682));if(_0x1c0682[_0x0b32('0x12')]){if(_0x1c0682['error'][_0x0b32('0x13')]===0x1f4){logger[_0x0b32('0x12')](_0x0b32('0xd'),_0x5176db,_0x1c0682[_0x0b32('0x12')][_0x0b32('0x14')]);return _0x5d91c8(_0x1c0682[_0x0b32('0x12')]['message']);}logger[_0x0b32('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5176db,_0x1c0682['error'][_0x0b32('0x14')]);return _0xb339e3(_0x1c0682[_0x0b32('0x12')]['message']);}else{logger[_0x0b32('0xc')](_0x0b32('0xd'),_0x5176db,_0x0b32('0x10'));_0xb339e3(_0x1c0682[_0x0b32('0x15')][_0x0b32('0x14')]);}})[_0x0b32('0x16')](function(_0xddfc7){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5176db,_0xddfc7);_0x5d91c8(_0xddfc7);});});}exports['CreateFaxQueueReport']=function(_0x1d005e){var _0x546a3e=this;return new Promise(function(_0x5d8252,_0x70ab9f){return db[_0x0b32('0x17')][_0x0b32('0x18')](_0x1d005e[_0x0b32('0x19')],{'raw':_0x1d005e[_0x0b32('0x1a')]?_0x1d005e['options'][_0x0b32('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x47a368){logger[_0x0b32('0xc')](_0x0b32('0x1c'),_0x1d005e);logger['debug'](_0x0b32('0x1c'),_0x1d005e,JSON[_0x0b32('0x11')](_0x47a368));_0x5d8252(_0x47a368);})[_0x0b32('0x16')](function(_0xbfd31b){logger[_0x0b32('0x12')](_0x0b32('0x1c'),_0xbfd31b[_0x0b32('0x14')],_0x1d005e);_0x70ab9f(_0x546a3e[_0x0b32('0x12')](0x1f4,_0xbfd31b[_0x0b32('0x14')]));});});};exports[_0x0b32('0x1d')]=function(_0x1c24e8){var _0xd6e04a=this;return new Promise(function(_0xa0edc,_0x2afaa3){return db['FaxQueueReport'][_0x0b32('0x1e')](_0x1c24e8[_0x0b32('0x19')],{'raw':_0x1c24e8['options']?_0x1c24e8[_0x0b32('0x1a')][_0x0b32('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c24e8[_0x0b32('0x1a')]?_0x1c24e8[_0x0b32('0x1a')][_0x0b32('0x1f')]||null:null,'attributes':_0x1c24e8[_0x0b32('0x1a')]?_0x1c24e8[_0x0b32('0x1a')]['attributes']||null:null,'limit':_0x1c24e8[_0x0b32('0x1a')]?_0x1c24e8['options']['limit']||null:null})[_0x0b32('0xb')](function(_0x72a823){logger['info']('UpdateFaxQueueReport',_0x1c24e8);logger['debug'](_0x0b32('0x1d'),_0x1c24e8,JSON['stringify'](_0x72a823));_0xa0edc(_0x72a823);})[_0x0b32('0x16')](function(_0x4545f3){logger[_0x0b32('0x12')](_0x0b32('0x1d'),_0x4545f3['message'],_0x1c24e8);_0x2afaa3(_0xd6e04a[_0x0b32('0x12')](0x1f4,_0x4545f3['message']));});});};
\ No newline at end of file
index 90ccdbb..5fe5262 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xecbe=['post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x37abb8,_0x5179a0){var _0x7babf1=function(_0x412f89){while(--_0x412f89){_0x37abb8['push'](_0x37abb8['shift']());}};_0x7babf1(++_0x5179a0);}(_0xecbe,0x101));var _0xeecb=function(_0x37d36f,_0x736947){_0x37d36f=_0x37d36f-0x0;var _0x285016=_0xecbe[_0x37d36f];return _0x285016;};'use strict';var multer=require(_0xeecb('0x0'));var util=require(_0xeecb('0x1'));var path=require(_0xeecb('0x2'));var timeout=require(_0xeecb('0x3'));var express=require(_0xeecb('0x4'));var router=express[_0xeecb('0x5')]();var fs_extra=require(_0xeecb('0x6'));var auth=require(_0xeecb('0x7'));var interaction=require(_0xeecb('0x8'));var config=require('../../config/environment');var controller=require(_0xeecb('0x9'));router['get']('/',auth[_0xeecb('0xa')](),controller['index']);router[_0xeecb('0xb')](_0xeecb('0xc'),auth[_0xeecb('0xa')](),controller[_0xeecb('0xd')]);router[_0xeecb('0xb')](_0xeecb('0xe'),auth[_0xeecb('0xa')](),controller[_0xeecb('0xf')]);router[_0xeecb('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xeecb('0x11')](_0xeecb('0xe'),auth[_0xeecb('0xa')](),controller['update']);router[_0xeecb('0x12')](_0xeecb('0xe'),auth[_0xeecb('0xa')](),controller[_0xeecb('0x13')]);module[_0xeecb('0x14')]=router;
\ No newline at end of file
+var _0xfbe0=['create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x5079cb,_0x3f6150){var _0x301659=function(_0x4c499c){while(--_0x4c499c){_0x5079cb['push'](_0x5079cb['shift']());}};_0x301659(++_0x3f6150);}(_0xfbe0,0xee));var _0x0fbe=function(_0x4538aa,_0x2e7a4a){_0x4538aa=_0x4538aa-0x0;var _0xd85bfb=_0xfbe0[_0x4538aa];return _0xd85bfb;};'use strict';var multer=require(_0x0fbe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0fbe('0x1'));var express=require(_0x0fbe('0x2'));var router=express['Router']();var fs_extra=require(_0x0fbe('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0fbe('0x4'));var config=require(_0x0fbe('0x5'));var controller=require(_0x0fbe('0x6'));router[_0x0fbe('0x7')]('/',auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x9')]);router[_0x0fbe('0x7')]('/describe',auth[_0x0fbe('0x8')](),controller[_0x0fbe('0xa')]);router['get'](_0x0fbe('0xb'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0xc')]);router[_0x0fbe('0xd')]('/',auth[_0x0fbe('0x8')](),controller[_0x0fbe('0xe')]);router[_0x0fbe('0xf')](_0x0fbe('0xb'),auth[_0x0fbe('0x8')](),controller[_0x0fbe('0x10')]);router[_0x0fbe('0x11')](_0x0fbe('0xb'),auth[_0x0fbe('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 1541038..59fbeb1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x561248,_0x360e7c){var _0x58e857=function(_0x1ff481){while(--_0x1ff481){_0x561248['push'](_0x561248['shift']());}};_0x58e857(++_0x360e7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}};
\ No newline at end of file
+var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x52ac48,_0x146d20){var _0x17b0f6=function(_0xfd2b28){while(--_0xfd2b28){_0x52ac48['push'](_0x52ac48['shift']());}};_0x17b0f6(++_0x146d20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}};
\ No newline at end of file
index 9af4345..d5d00d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7777=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','reject','save','then','destroy','stack','name','index','map','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','where','pick','merge','type','FaxTransferReport','includeAll','include','findAll','rows','keys','options','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs'];(function(_0x36592d,_0x486b5f){var _0x1ba6e5=function(_0xbec377){while(--_0xbec377){_0x36592d['push'](_0x36592d['shift']());}};_0x1ba6e5(++_0x486b5f);}(_0x7777,0x1c2));var _0x7777=function(_0x4559d6,_0x21ff92){_0x4559d6=_0x4559d6-0x0;var _0x3b77ae=_0x7777[_0x4559d6];return _0x3b77ae;};'use strict';var emlformat=require(_0x7777('0x0'));var rimraf=require(_0x7777('0x1'));var zipdir=require(_0x7777('0x2'));var jsonpatch=require(_0x7777('0x3'));var rp=require(_0x7777('0x4'));var moment=require(_0x7777('0x5'));var BPromise=require(_0x7777('0x6'));var Mustache=require(_0x7777('0x7'));var util=require(_0x7777('0x8'));var path=require(_0x7777('0x9'));var sox=require(_0x7777('0xa'));var csv=require('to-csv');var ejs=require(_0x7777('0xb'));var fs=require('fs');var fs_extra=require(_0x7777('0xc'));var _=require(_0x7777('0xd'));var squel=require('squel');var crypto=require(_0x7777('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7777('0xf'));var toCsv=require(_0x7777('0x10'));var querystring=require('querystring');var Papa=require(_0x7777('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7777('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7777('0x13'));var utils=require(_0x7777('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7777('0x15'));var db=require(_0x7777('0x16'))['db'];function respondWithStatusCode(_0x234ebb,_0x3f8e59){_0x3f8e59=_0x3f8e59||0xcc;return function(_0x3044dc){if(_0x3044dc){return _0x234ebb[_0x7777('0x17')](_0x3f8e59);}return _0x234ebb[_0x7777('0x18')](_0x3f8e59)[_0x7777('0x19')]();};}function respondWithResult(_0x311ee7,_0x2b0d1c){_0x2b0d1c=_0x2b0d1c||0xc8;return function(_0x15b3af){if(_0x15b3af){return _0x311ee7['status'](_0x2b0d1c)['json'](_0x15b3af);}};}function respondWithFilteredResult(_0x3c9b43,_0x2cb7ae){return function(_0x4d9611){if(_0x4d9611){var _0x2210be=typeof _0x2cb7ae[_0x7777('0x1a')]==='undefined'&&typeof _0x2cb7ae['limit']==='undefined';var _0x28111a=_0x4d9611[_0x7777('0x1b')];var _0x818f32=_0x2210be?0x0:_0x2cb7ae[_0x7777('0x1a')];var _0x1228bc=_0x2210be?_0x4d9611['count']:_0x2cb7ae[_0x7777('0x1a')]+_0x2cb7ae[_0x7777('0x1c')];var _0x276d45;if(_0x1228bc>=_0x28111a){_0x1228bc=_0x28111a;_0x276d45=0xc8;}else{_0x276d45=0xce;}_0x3c9b43[_0x7777('0x18')](_0x276d45);return _0x3c9b43[_0x7777('0x1d')](_0x7777('0x1e'),_0x818f32+'-'+_0x1228bc+'/'+_0x28111a)[_0x7777('0x1f')](_0x4d9611);}return null;};}function patchUpdates(_0x250ea7){return function(_0x70a41c){try{jsonpatch['apply'](_0x70a41c,_0x250ea7,!![]);}catch(_0x550a79){return BPromise[_0x7777('0x20')](_0x550a79);}return _0x70a41c[_0x7777('0x21')]();};}function saveUpdates(_0x41e2d2,_0x20d189){return function(_0x481321){if(_0x481321){return _0x481321['update'](_0x41e2d2)[_0x7777('0x22')](function(_0x210e55){return _0x210e55;});}return null;};}function removeEntity(_0x35b5e1,_0x4c4e57){return function(_0x131a6e){if(_0x131a6e){return _0x131a6e[_0x7777('0x23')]()[_0x7777('0x22')](function(){_0x35b5e1[_0x7777('0x18')](0xcc)[_0x7777('0x19')]();});}};}function handleEntityNotFound(_0x5444dd,_0x3c0a35){return function(_0x286645){if(!_0x286645){_0x5444dd[_0x7777('0x17')](0x194);}return _0x286645;};}function handleError(_0x529844,_0x3a465b){_0x3a465b=_0x3a465b||0x1f4;return function(_0x2ae2c3){logger['error'](_0x2ae2c3[_0x7777('0x24')]);if(_0x2ae2c3[_0x7777('0x25')]){delete _0x2ae2c3['name'];}_0x529844[_0x7777('0x18')](_0x3a465b)['send'](_0x2ae2c3);};}exports[_0x7777('0x26')]=function(_0x11f528,_0x178cd4){var _0x378987={},_0x35da22={},_0x1e574d={'count':0x0,'rows':[]};var _0x571b3d=_[_0x7777('0x27')](db['FaxTransferReport'][_0x7777('0x28')],function(_0x31f372){return{'name':_0x31f372['fieldName'],'type':_0x31f372['type']['key']};});_0x35da22[_0x7777('0x29')]=_[_0x7777('0x27')](_0x571b3d,_0x7777('0x25'));_0x35da22[_0x7777('0x2a')]=_['keys'](_0x11f528[_0x7777('0x2a')]);_0x35da22[_0x7777('0x2b')]=_[_0x7777('0x2c')](_0x35da22[_0x7777('0x29')],_0x35da22[_0x7777('0x2a')]);_0x378987[_0x7777('0x2d')]=_[_0x7777('0x2c')](_0x35da22[_0x7777('0x29')],qs[_0x7777('0x2e')](_0x11f528[_0x7777('0x2a')][_0x7777('0x2e')]));_0x378987['attributes']=_0x378987[_0x7777('0x2d')][_0x7777('0x2f')]?_0x378987[_0x7777('0x2d')]:_0x35da22['model'];if(!_0x11f528['query']['hasOwnProperty'](_0x7777('0x30'))){_0x378987['limit']=qs[_0x7777('0x1c')](_0x11f528['query'][_0x7777('0x1c')]);_0x378987['offset']=qs[_0x7777('0x1a')](_0x11f528[_0x7777('0x2a')][_0x7777('0x1a')]);}_0x378987['order']=qs['sort'](_0x11f528[_0x7777('0x2a')]['sort']);_0x378987[_0x7777('0x31')]=qs[_0x7777('0x2b')](_[_0x7777('0x32')](_0x11f528[_0x7777('0x2a')],_0x35da22[_0x7777('0x2b')]),_0x571b3d);if(_0x11f528[_0x7777('0x2a')]['filter']){_0x378987[_0x7777('0x31')]=_[_0x7777('0x33')](_0x378987[_0x7777('0x31')],{'$or':_[_0x7777('0x27')](_0x571b3d,function(_0x4081ea){if(_0x4081ea[_0x7777('0x34')]!=='VIRTUAL'){var _0x43a48={};_0x43a48[_0x4081ea['name']]={'$like':'%'+_0x11f528[_0x7777('0x2a')]['filter']+'%'};return _0x43a48;}})});}_0x378987=_['merge']({},_0x378987,_0x11f528['options']);var _0x52f320={'where':_0x378987['where']};return db[_0x7777('0x35')]['count'](_0x52f320)['then'](function(_0x33c02d){_0x1e574d[_0x7777('0x1b')]=_0x33c02d;if(_0x11f528[_0x7777('0x2a')][_0x7777('0x36')]){_0x378987[_0x7777('0x37')]=[{'all':!![]}];}return db[_0x7777('0x35')][_0x7777('0x38')](_0x378987);})['then'](function(_0x581a91){_0x1e574d[_0x7777('0x39')]=_0x581a91;return _0x1e574d;})[_0x7777('0x22')](respondWithFilteredResult(_0x178cd4,_0x378987))['catch'](handleError(_0x178cd4,null));};exports['show']=function(_0x5232c1,_0x4613f1){var _0x3d1151={'raw':!![],'where':{'id':_0x5232c1['params']['id']}},_0x23f8b2={};_0x23f8b2['model']=_[_0x7777('0x3a')](db[_0x7777('0x35')][_0x7777('0x28')]);_0x23f8b2[_0x7777('0x2a')]=_['keys'](_0x5232c1[_0x7777('0x2a')]);_0x23f8b2[_0x7777('0x2b')]=_[_0x7777('0x2c')](_0x23f8b2[_0x7777('0x29')],_0x23f8b2[_0x7777('0x2a')]);_0x3d1151[_0x7777('0x2d')]=_[_0x7777('0x2c')](_0x23f8b2['model'],qs[_0x7777('0x2e')](_0x5232c1[_0x7777('0x2a')][_0x7777('0x2e')]));_0x3d1151[_0x7777('0x2d')]=_0x3d1151[_0x7777('0x2d')]['length']?_0x3d1151[_0x7777('0x2d')]:_0x23f8b2['model'];if(_0x5232c1[_0x7777('0x2a')][_0x7777('0x36')]){_0x3d1151[_0x7777('0x37')]=[{'all':!![]}];}_0x3d1151=_[_0x7777('0x33')]({},_0x3d1151,_0x5232c1[_0x7777('0x3b')]);return db[_0x7777('0x35')][_0x7777('0x3c')](_0x3d1151)['then'](handleEntityNotFound(_0x4613f1,null))[_0x7777('0x22')](respondWithResult(_0x4613f1,null))[_0x7777('0x3d')](handleError(_0x4613f1,null));};exports[_0x7777('0x3e')]=function(_0x510576,_0x5e5d36){return db[_0x7777('0x35')][_0x7777('0x3e')](_0x510576[_0x7777('0x3f')],{})[_0x7777('0x22')](respondWithResult(_0x5e5d36,0xc9))[_0x7777('0x3d')](handleError(_0x5e5d36,null));};exports[_0x7777('0x40')]=function(_0x2f194d,_0x52f34d){if(_0x2f194d[_0x7777('0x3f')]['id']){delete _0x2f194d['body']['id'];}return db['FaxTransferReport'][_0x7777('0x3c')]({'where':{'id':_0x2f194d[_0x7777('0x41')]['id']}})[_0x7777('0x22')](handleEntityNotFound(_0x52f34d,null))[_0x7777('0x22')](saveUpdates(_0x2f194d[_0x7777('0x3f')],null))[_0x7777('0x22')](respondWithResult(_0x52f34d,null))['catch'](handleError(_0x52f34d,null));};exports[_0x7777('0x23')]=function(_0xd89128,_0x3f9c9e){return db[_0x7777('0x35')][_0x7777('0x3c')]({'where':{'id':_0xd89128[_0x7777('0x41')]['id']}})[_0x7777('0x22')](handleEntityNotFound(_0x3f9c9e,null))[_0x7777('0x22')](removeEntity(_0x3f9c9e,null))[_0x7777('0x3d')](handleError(_0x3f9c9e,null));};exports[_0x7777('0x42')]=function(_0x48c019,_0xb4a839){return db[_0x7777('0x35')][_0x7777('0x42')]()[_0x7777('0x22')](respondWithResult(_0xb4a839,null))['catch'](handleError(_0xb4a839,null));};
\ No newline at end of file
+var _0x19f6=['fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','FaxTransferReport','includeAll','include','findAll','catch','find','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x19f6,0xcf));var _0x619f=function(_0x5bef0a,_0x1fb747){_0x5bef0a=_0x5bef0a-0x0;var _0x1a02ea=_0x19f6[_0x5bef0a];return _0x1a02ea;};'use strict';var emlformat=require(_0x619f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x619f('0x1'));var jsonpatch=require(_0x619f('0x2'));var rp=require(_0x619f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x619f('0x4'));var path=require(_0x619f('0x5'));var sox=require(_0x619f('0x6'));var csv=require(_0x619f('0x7'));var ejs=require(_0x619f('0x8'));var fs=require('fs');var fs_extra=require(_0x619f('0x9'));var _=require(_0x619f('0xa'));var squel=require(_0x619f('0xb'));var crypto=require('crypto');var jsforce=require(_0x619f('0xc'));var deskjs=require(_0x619f('0xd'));var toCsv=require(_0x619f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x619f('0xe'));var authService=require(_0x619f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x619f('0x10'))(_0x619f('0x11'));var utils=require(_0x619f('0x12'));var config=require(_0x619f('0x13'));var licenseUtil=require(_0x619f('0x14'));var db=require(_0x619f('0x15'))['db'];function respondWithStatusCode(_0x1f0268,_0x318327){_0x318327=_0x318327||0xcc;return function(_0x1fd6c8){if(_0x1fd6c8){return _0x1f0268[_0x619f('0x16')](_0x318327);}return _0x1f0268[_0x619f('0x17')](_0x318327)[_0x619f('0x18')]();};}function respondWithResult(_0x464f39,_0x3fb0cc){_0x3fb0cc=_0x3fb0cc||0xc8;return function(_0x5f0287){if(_0x5f0287){return _0x464f39['status'](_0x3fb0cc)[_0x619f('0x19')](_0x5f0287);}};}function respondWithFilteredResult(_0x203362,_0x52cfa8){return function(_0x4c8882){if(_0x4c8882){var _0x1ed859=typeof _0x52cfa8['offset']==='undefined'&&typeof _0x52cfa8[_0x619f('0x1a')]===_0x619f('0x1b');var _0x2ea8eb=_0x4c8882[_0x619f('0x1c')];var _0x14409f=_0x1ed859?0x0:_0x52cfa8[_0x619f('0x1d')];var _0x4ae1c4=_0x1ed859?_0x4c8882[_0x619f('0x1c')]:_0x52cfa8[_0x619f('0x1d')]+_0x52cfa8[_0x619f('0x1a')];var _0x17352b;if(_0x4ae1c4>=_0x2ea8eb){_0x4ae1c4=_0x2ea8eb;_0x17352b=0xc8;}else{_0x17352b=0xce;}_0x203362['status'](_0x17352b);return _0x203362[_0x619f('0x1e')](_0x619f('0x1f'),_0x14409f+'-'+_0x4ae1c4+'/'+_0x2ea8eb)['json'](_0x4c8882);}return null;};}function patchUpdates(_0x5a5c6b){return function(_0x4c878d){try{jsonpatch[_0x619f('0x20')](_0x4c878d,_0x5a5c6b,!![]);}catch(_0x444634){return BPromise[_0x619f('0x21')](_0x444634);}return _0x4c878d[_0x619f('0x22')]();};}function saveUpdates(_0x6c2a7b,_0x5994a7){return function(_0x167164){if(_0x167164){return _0x167164[_0x619f('0x23')](_0x6c2a7b)['then'](function(_0x46e705){return _0x46e705;});}return null;};}function removeEntity(_0x37d8e6,_0xeefed2){return function(_0x52a261){if(_0x52a261){return _0x52a261['destroy']()[_0x619f('0x24')](function(){_0x37d8e6[_0x619f('0x17')](0xcc)[_0x619f('0x18')]();});}};}function handleEntityNotFound(_0x16b4ab,_0x32e8b6){return function(_0x201289){if(!_0x201289){_0x16b4ab['sendStatus'](0x194);}return _0x201289;};}function handleError(_0x10459e,_0x31b362){_0x31b362=_0x31b362||0x1f4;return function(_0x10f16f){logger[_0x619f('0x25')](_0x10f16f[_0x619f('0x26')]);if(_0x10f16f[_0x619f('0x27')]){delete _0x10f16f[_0x619f('0x27')];}_0x10459e[_0x619f('0x17')](_0x31b362)[_0x619f('0x28')](_0x10f16f);};}exports['index']=function(_0x545097,_0x5d2522){var _0x18ed4f={},_0x4d1414={},_0x24b440={'count':0x0,'rows':[]};var _0x389e26=_[_0x619f('0x29')](db['FaxTransferReport'][_0x619f('0x2a')],function(_0x9d3098){return{'name':_0x9d3098[_0x619f('0x2b')],'type':_0x9d3098[_0x619f('0x2c')]['key']};});_0x4d1414[_0x619f('0x2d')]=_['map'](_0x389e26,_0x619f('0x27'));_0x4d1414[_0x619f('0x2e')]=_[_0x619f('0x2f')](_0x545097[_0x619f('0x2e')]);_0x4d1414[_0x619f('0x30')]=_[_0x619f('0x31')](_0x4d1414['model'],_0x4d1414[_0x619f('0x2e')]);_0x18ed4f[_0x619f('0x32')]=_[_0x619f('0x31')](_0x4d1414[_0x619f('0x2d')],qs[_0x619f('0x33')](_0x545097[_0x619f('0x2e')][_0x619f('0x33')]));_0x18ed4f['attributes']=_0x18ed4f[_0x619f('0x32')]['length']?_0x18ed4f[_0x619f('0x32')]:_0x4d1414[_0x619f('0x2d')];if(!_0x545097[_0x619f('0x2e')][_0x619f('0x34')](_0x619f('0x35'))){_0x18ed4f['limit']=qs[_0x619f('0x1a')](_0x545097[_0x619f('0x2e')][_0x619f('0x1a')]);_0x18ed4f[_0x619f('0x1d')]=qs[_0x619f('0x1d')](_0x545097['query'][_0x619f('0x1d')]);}_0x18ed4f[_0x619f('0x36')]=qs[_0x619f('0x37')](_0x545097[_0x619f('0x2e')][_0x619f('0x37')]);_0x18ed4f[_0x619f('0x38')]=qs[_0x619f('0x30')](_['pick'](_0x545097[_0x619f('0x2e')],_0x4d1414[_0x619f('0x30')]),_0x389e26);if(_0x545097[_0x619f('0x2e')]['filter']){_0x18ed4f[_0x619f('0x38')]=_['merge'](_0x18ed4f[_0x619f('0x38')],{'$or':_[_0x619f('0x29')](_0x389e26,function(_0x5df1ba){if(_0x5df1ba[_0x619f('0x2c')]!==_0x619f('0x39')){var _0xb6b8cd={};_0xb6b8cd[_0x5df1ba[_0x619f('0x27')]]={'$like':'%'+_0x545097[_0x619f('0x2e')][_0x619f('0x3a')]+'%'};return _0xb6b8cd;}})});}_0x18ed4f=_[_0x619f('0x3b')]({},_0x18ed4f,_0x545097[_0x619f('0x3c')]);var _0x5437ba={'where':_0x18ed4f[_0x619f('0x38')]};return db[_0x619f('0x3d')][_0x619f('0x1c')](_0x5437ba)[_0x619f('0x24')](function(_0x459ae2){_0x24b440[_0x619f('0x1c')]=_0x459ae2;if(_0x545097['query'][_0x619f('0x3e')]){_0x18ed4f[_0x619f('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x619f('0x40')](_0x18ed4f);})[_0x619f('0x24')](function(_0x2a65e5){_0x24b440['rows']=_0x2a65e5;return _0x24b440;})[_0x619f('0x24')](respondWithFilteredResult(_0x5d2522,_0x18ed4f))[_0x619f('0x41')](handleError(_0x5d2522,null));};exports['show']=function(_0x349ede,_0x43bb42){var _0x2b1c56={'raw':!![],'where':{'id':_0x349ede['params']['id']}},_0x447f11={};_0x447f11[_0x619f('0x2d')]=_[_0x619f('0x2f')](db[_0x619f('0x3d')][_0x619f('0x2a')]);_0x447f11[_0x619f('0x2e')]=_[_0x619f('0x2f')](_0x349ede[_0x619f('0x2e')]);_0x447f11['filters']=_[_0x619f('0x31')](_0x447f11[_0x619f('0x2d')],_0x447f11[_0x619f('0x2e')]);_0x2b1c56[_0x619f('0x32')]=_[_0x619f('0x31')](_0x447f11[_0x619f('0x2d')],qs[_0x619f('0x33')](_0x349ede['query'][_0x619f('0x33')]));_0x2b1c56[_0x619f('0x32')]=_0x2b1c56[_0x619f('0x32')]['length']?_0x2b1c56[_0x619f('0x32')]:_0x447f11['model'];if(_0x349ede[_0x619f('0x2e')][_0x619f('0x3e')]){_0x2b1c56[_0x619f('0x3f')]=[{'all':!![]}];}_0x2b1c56=_['merge']({},_0x2b1c56,_0x349ede[_0x619f('0x3c')]);return db[_0x619f('0x3d')][_0x619f('0x42')](_0x2b1c56)[_0x619f('0x24')](handleEntityNotFound(_0x43bb42,null))[_0x619f('0x24')](respondWithResult(_0x43bb42,null))['catch'](handleError(_0x43bb42,null));};exports[_0x619f('0x43')]=function(_0x14c413,_0x504c99){return db[_0x619f('0x3d')][_0x619f('0x43')](_0x14c413[_0x619f('0x44')],{})[_0x619f('0x24')](respondWithResult(_0x504c99,0xc9))['catch'](handleError(_0x504c99,null));};exports[_0x619f('0x23')]=function(_0x30343a,_0xf93839){if(_0x30343a[_0x619f('0x44')]['id']){delete _0x30343a[_0x619f('0x44')]['id'];}return db[_0x619f('0x3d')][_0x619f('0x42')]({'where':{'id':_0x30343a['params']['id']}})[_0x619f('0x24')](handleEntityNotFound(_0xf93839,null))[_0x619f('0x24')](saveUpdates(_0x30343a['body'],null))['then'](respondWithResult(_0xf93839,null))[_0x619f('0x41')](handleError(_0xf93839,null));};exports[_0x619f('0x45')]=function(_0x2d32f1,_0x465de2){return db['FaxTransferReport'][_0x619f('0x42')]({'where':{'id':_0x2d32f1[_0x619f('0x46')]['id']}})[_0x619f('0x24')](handleEntityNotFound(_0x465de2,null))[_0x619f('0x24')](removeEntity(_0x465de2,null))[_0x619f('0x41')](handleError(_0x465de2,null));};exports[_0x619f('0x47')]=function(_0x5bc028,_0x484706){return db[_0x619f('0x3d')][_0x619f('0x47')]()['then'](respondWithResult(_0x484706,null))[_0x619f('0x41')](handleError(_0x484706,null));};
\ No newline at end of file
index bd6be19..d7186f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1403=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x186872,_0x50a406){var _0x2f440d=function(_0x41691d){while(--_0x41691d){_0x186872['push'](_0x186872['shift']());}};_0x2f440d(++_0x50a406);}(_0x1403,0xcb));var _0x3140=function(_0x51d93b,_0x1c0c07){_0x51d93b=_0x51d93b-0x0;var _0x23bc18=_0x1403[_0x51d93b];return _0x23bc18;};'use strict';var _=require(_0x3140('0x0'));var util=require('util');var logger=require(_0x3140('0x1'))(_0x3140('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3140('0x3'));var fs=require('fs');var path=require(_0x3140('0x4'));var rimraf=require(_0x3140('0x5'));var config=require(_0x3140('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x3140('0x7')]=function(_0xff922b,_0x373a2b){return _0xff922b[_0x3140('0x8')](_0x3140('0x9'),attributes,{'tableName':_0x3140('0xa'),'paranoid':![],'indexes':[{'name':_0x3140('0xb'),'fields':[_0x3140('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x84f2=['FaxTransferReport','uniqueid','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x84f2,0x1ee));var _0x284f=function(_0x575228,_0x3f9bc1){_0x575228=_0x575228-0x0;var _0x4cb11e=_0x84f2[_0x575228];return _0x4cb11e;};'use strict';var _=require(_0x284f('0x0'));var util=require(_0x284f('0x1'));var logger=require(_0x284f('0x2'))('api');var moment=require(_0x284f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x284f('0x4'));var rimraf=require(_0x284f('0x5'));var config=require(_0x284f('0x6'));var attributes=require(_0x284f('0x7'));module[_0x284f('0x8')]=function(_0x21c6dd,_0x3bfd43){return _0x21c6dd[_0x284f('0x9')](_0x284f('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x284f('0xb'),'fields':[_0x284f('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index dff73a7..4d7e3c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa2ab=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x4bb28b,_0x296703){var _0x2b7452=function(_0x433b4f){while(--_0x433b4f){_0x4bb28b['push'](_0x4bb28b['shift']());}};_0x2b7452(++_0x296703);}(_0xa2ab,0x65));var _0xba2a=function(_0x149380,_0x162914){_0x149380=_0x149380-0x0;var _0x46cad=_0xa2ab[_0x149380];return _0x46cad;};'use strict';var _=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var moment=require(_0xba2a('0x2'));var BPromise=require(_0xba2a('0x3'));var rs=require(_0xba2a('0x4'));var fs=require('fs');var Redis=require(_0xba2a('0x5'));var db=require(_0xba2a('0x6'))['db'];var utils=require(_0xba2a('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xba2a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9f3f99,_0x575162,_0x13f7ff){return new BPromise(function(_0x35828d,_0x22625a){return client[_0xba2a('0x9')](_0x9f3f99,_0x13f7ff)[_0xba2a('0xa')](function(_0x499cd3){logger[_0xba2a('0xb')](_0xba2a('0xc'),_0x575162,_0xba2a('0xd'));logger[_0xba2a('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x575162,_0xba2a('0xd'),JSON[_0xba2a('0xf')](_0x499cd3));if(_0x499cd3[_0xba2a('0x10')]){if(_0x499cd3[_0xba2a('0x10')]['code']===0x1f4){logger[_0xba2a('0x10')](_0xba2a('0xc'),_0x575162,_0x499cd3[_0xba2a('0x10')]['message']);return _0x22625a(_0x499cd3[_0xba2a('0x10')]['message']);}logger['error'](_0xba2a('0xc'),_0x575162,_0x499cd3[_0xba2a('0x10')]['message']);return _0x35828d(_0x499cd3[_0xba2a('0x10')][_0xba2a('0x11')]);}else{logger[_0xba2a('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x575162,_0xba2a('0xd'));_0x35828d(_0x499cd3[_0xba2a('0x12')][_0xba2a('0x11')]);}})[_0xba2a('0x13')](function(_0x1f27e9){logger[_0xba2a('0x10')](_0xba2a('0xc'),_0x575162,_0x1f27e9);_0x22625a(_0x1f27e9);});});}
\ No newline at end of file
+var _0xb951=['client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x24657f,_0x1620ed){var _0x389972=function(_0x1eca77){while(--_0x1eca77){_0x24657f['push'](_0x24657f['shift']());}};_0x389972(++_0x1620ed);}(_0xb951,0x142));var _0x1b95=function(_0x29ce74,_0x4c6b8c){_0x29ce74=_0x29ce74-0x0;var _0x44bf9c=_0xb951[_0x29ce74];return _0x44bf9c;};'use strict';var _=require(_0x1b95('0x0'));var util=require(_0x1b95('0x1'));var moment=require(_0x1b95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b95('0x3'))['db'];var utils=require(_0x1b95('0x4'));var logger=require(_0x1b95('0x5'))(_0x1b95('0x6'));var config=require(_0x1b95('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1b95('0x8')][_0x1b95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24e4e7,_0x42ef42,_0x176747){return new BPromise(function(_0x33416a,_0x532cdf){return client[_0x1b95('0xa')](_0x24e4e7,_0x176747)[_0x1b95('0xb')](function(_0x4b4585){logger[_0x1b95('0xc')](_0x1b95('0xd'),_0x42ef42,_0x1b95('0xe'));logger[_0x1b95('0xf')](_0x1b95('0x10'),_0x42ef42,'request\x20sent',JSON[_0x1b95('0x11')](_0x4b4585));if(_0x4b4585[_0x1b95('0x12')]){if(_0x4b4585[_0x1b95('0x12')][_0x1b95('0x13')]===0x1f4){logger['error'](_0x1b95('0xd'),_0x42ef42,_0x4b4585[_0x1b95('0x12')][_0x1b95('0x14')]);return _0x532cdf(_0x4b4585['error'][_0x1b95('0x14')]);}logger[_0x1b95('0x12')](_0x1b95('0xd'),_0x42ef42,_0x4b4585[_0x1b95('0x12')][_0x1b95('0x14')]);return _0x33416a(_0x4b4585[_0x1b95('0x12')][_0x1b95('0x14')]);}else{logger[_0x1b95('0xc')](_0x1b95('0xd'),_0x42ef42,_0x1b95('0xe'));_0x33416a(_0x4b4585['result']['message']);}})[_0x1b95('0x15')](function(_0x50ac52){logger[_0x1b95('0x12')](_0x1b95('0xd'),_0x42ef42,_0x50ac52);_0x532cdf(_0x50ac52);});});}
\ No newline at end of file
index 7dcec06..36c3207 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb761=['multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','/:id','destroy','exports'];(function(_0x2a0f1a,_0x4e7206){var _0x2721bc=function(_0x42d2b8){while(--_0x42d2b8){_0x2a0f1a['push'](_0x2a0f1a['shift']());}};_0x2721bc(++_0x4e7206);}(_0xb761,0x1a0));var _0x1b76=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xb761[_0x257495];return _0x3849aa;};'use strict';var multer=require(_0x1b76('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b76('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x1b76('0x2'));var interaction=require(_0x1b76('0x3'));var config=require(_0x1b76('0x4'));var controller=require('./faxTransferReport.controller');router[_0x1b76('0x5')]('/',auth['isAuthenticated'](),controller[_0x1b76('0x6')]);router[_0x1b76('0x5')](_0x1b76('0x7'),auth[_0x1b76('0x8')](),controller[_0x1b76('0x9')]);router[_0x1b76('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x1b76('0xa')]);router[_0x1b76('0xb')]('/',auth[_0x1b76('0x8')](),controller[_0x1b76('0xc')]);router['put'](_0x1b76('0xd'),auth[_0x1b76('0x8')](),controller['update']);router['delete'](_0x1b76('0xd'),auth[_0x1b76('0x8')](),controller[_0x1b76('0xe')]);module[_0x1b76('0xf')]=router;
\ No newline at end of file
+var _0x40ee=['/:id','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x4d4aec,_0x19e701){var _0x235d7e=function(_0x100ff6){while(--_0x100ff6){_0x4d4aec['push'](_0x4d4aec['shift']());}};_0x235d7e(++_0x19e701);}(_0x40ee,0xaf));var _0xe40e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x40ee[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xe40e('0x0'));var util=require(_0xe40e('0x1'));var path=require(_0xe40e('0x2'));var timeout=require(_0xe40e('0x3'));var express=require(_0xe40e('0x4'));var router=express[_0xe40e('0x5')]();var fs_extra=require(_0xe40e('0x6'));var auth=require(_0xe40e('0x7'));var interaction=require(_0xe40e('0x8'));var config=require(_0xe40e('0x9'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xe40e('0xa')](),controller[_0xe40e('0xb')]);router[_0xe40e('0xc')](_0xe40e('0xd'),auth[_0xe40e('0xa')](),controller[_0xe40e('0xe')]);router['get'](_0xe40e('0xf'),auth[_0xe40e('0xa')](),controller['show']);router['post']('/',auth[_0xe40e('0xa')](),controller[_0xe40e('0x10')]);router['put'](_0xe40e('0xf'),auth[_0xe40e('0xa')](),controller[_0xe40e('0x11')]);router['delete']('/:id',auth[_0xe40e('0xa')](),controller[_0xe40e('0x12')]);module['exports']=router;
\ No newline at end of file
index 425af9f..4ee0078 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef5a=['../../components/interaction/service','./intDeskAccount.controller','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19e9c8,_0x4474ed){var _0xc0152f=function(_0x3cabda){while(--_0x3cabda){_0x19e9c8['push'](_0x19e9c8['shift']());}};_0xc0152f(++_0x4474ed);}(_0xef5a,0x150));var _0xaef5=function(_0x376b0d,_0x52755d){_0x376b0d=_0x376b0d-0x0;var _0x123313=_0xef5a[_0x376b0d];return _0x123313;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xaef5('0x0'));var express=require(_0xaef5('0x1'));var router=express[_0xaef5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xaef5('0x3'));var interaction=require(_0xaef5('0x4'));var config=require('../../config/environment');var controller=require(_0xaef5('0x5'));router[_0xaef5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaef5('0x6')](_0xaef5('0x7'),auth['isAuthenticated'](),controller[_0xaef5('0x8')]);router[_0xaef5('0x6')](_0xaef5('0x9'),auth[_0xaef5('0xa')](),controller[_0xaef5('0xb')]);router[_0xaef5('0x6')](_0xaef5('0xc'),auth[_0xaef5('0xa')](),controller[_0xaef5('0xd')]);router[_0xaef5('0xe')]('/',auth[_0xaef5('0xa')](),controller['create']);router[_0xaef5('0xe')](_0xaef5('0x9'),auth['isAuthenticated'](),controller[_0xaef5('0xf')]);router[_0xaef5('0x10')](_0xaef5('0x7'),auth[_0xaef5('0xa')](),controller['update']);router[_0xaef5('0x11')](_0xaef5('0x7'),auth[_0xaef5('0xa')](),controller[_0xaef5('0x12')]);module[_0xaef5('0x13')]=router;
\ No newline at end of file
+var _0x0004=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','path'];(function(_0x1b9ab2,_0x1b8913){var _0x5bb038=function(_0x422845){while(--_0x422845){_0x1b9ab2['push'](_0x1b9ab2['shift']());}};_0x5bb038(++_0x1b8913);}(_0x0004,0x19e));var _0x4000=function(_0x4f232d,_0x50c2fd){_0x4f232d=_0x4f232d-0x0;var _0x494086=_0x0004[_0x4f232d];return _0x494086;};'use strict';var multer=require(_0x4000('0x0'));var util=require('util');var path=require(_0x4000('0x1'));var timeout=require(_0x4000('0x2'));var express=require(_0x4000('0x3'));var router=express[_0x4000('0x4')]();var fs_extra=require(_0x4000('0x5'));var auth=require(_0x4000('0x6'));var interaction=require(_0x4000('0x7'));var config=require(_0x4000('0x8'));var controller=require(_0x4000('0x9'));router['get']('/',auth[_0x4000('0xa')](),controller[_0x4000('0xb')]);router[_0x4000('0xc')]('/:id',auth[_0x4000('0xa')](),controller[_0x4000('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x4000('0xe')]);router['get'](_0x4000('0xf'),auth[_0x4000('0xa')](),controller[_0x4000('0x10')]);router[_0x4000('0x11')]('/',auth[_0x4000('0xa')](),controller[_0x4000('0x12')]);router[_0x4000('0x11')](_0x4000('0x13'),auth[_0x4000('0xa')](),controller[_0x4000('0x14')]);router[_0x4000('0x15')](_0x4000('0x16'),auth[_0x4000('0xa')](),controller[_0x4000('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4000('0x18')]);module[_0x4000('0x19')]=router;
\ No newline at end of file
index 77961b8..caf06d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb39b=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x470f34,_0x2d29da){var _0x2ce792=function(_0x166b86){while(--_0x166b86){_0x470f34['push'](_0x470f34['shift']());}};_0x2ce792(++_0x2d29da);}(_0xb39b,0xa6));var _0xbb39=function(_0x59d983,_0x4e150b){_0x59d983=_0x59d983-0x0;var _0x5e1e97=_0xb39b[_0x59d983];return _0x5e1e97;};'use strict';var Sequelize=require(_0xbb39('0x0'));module[_0xbb39('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbb39('0x2')]},'remoteUri':{'type':Sequelize[_0xbb39('0x2')]},'authType':{'type':Sequelize[_0xbb39('0x3')]('basic'),'defaultValue':_0xbb39('0x4')},'password':{'type':Sequelize[_0xbb39('0x2')]},'consumerKey':{'type':Sequelize[_0xbb39('0x2')]},'consumerSecret':{'type':Sequelize[_0xbb39('0x2')]},'token':{'type':Sequelize[_0xbb39('0x2')]},'tokenSecret':{'type':Sequelize[_0xbb39('0x2')]},'serverUrl':{'type':Sequelize[_0xbb39('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbb39('0x5'),_0xbb39('0x6')),'defaultValue':_0xbb39('0x5')}};
\ No newline at end of file
+var _0xa585=['newTab','integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0xd6601b,_0x19ca00){var _0x496db2=function(_0x4fff85){while(--_0x4fff85){_0xd6601b['push'](_0xd6601b['shift']());}};_0x496db2(++_0x19ca00);}(_0xa585,0xf7));var _0x5a58=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xa585[_0x4695ba];return _0x524b7d;};'use strict';var Sequelize=require(_0x5a58('0x0'));module[_0x5a58('0x1')]={'name':{'type':Sequelize[_0x5a58('0x2')]},'description':{'type':Sequelize[_0x5a58('0x2')]},'username':{'type':Sequelize[_0x5a58('0x2')]},'remoteUri':{'type':Sequelize[_0x5a58('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x5a58('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x5a58('0x2')]},'consumerKey':{'type':Sequelize[_0x5a58('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x5a58('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5a58('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5a58('0x4')]('integrationTab',_0x5a58('0x5')),'defaultValue':_0x5a58('0x6')}};
\ No newline at end of file
index 4c7503b..43533d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a8a=['merge','filter','options','rows','catch','show','params','rawAttributes','keys','length','includeAll','include','find','create','body','getConfigurations','DeskConfiguration','pick','findOne','Subjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','DeskAccount','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x347999,_0x315e31){var _0x48aec3=function(_0x55b84a){while(--_0x55b84a){_0x347999['push'](_0x347999['shift']());}};_0x48aec3(++_0x315e31);}(_0x9a8a,0xab));var _0xa9a8=function(_0x4e8189,_0x3f507c){_0x4e8189=_0x4e8189-0x0;var _0x2a91bf=_0x9a8a[_0x4e8189];return _0x2a91bf;};'use strict';var emlformat=require(_0xa9a8('0x0'));var rimraf=require(_0xa9a8('0x1'));var zipdir=require(_0xa9a8('0x2'));var jsonpatch=require(_0xa9a8('0x3'));var rp=require(_0xa9a8('0x4'));var moment=require(_0xa9a8('0x5'));var BPromise=require(_0xa9a8('0x6'));var Mustache=require(_0xa9a8('0x7'));var util=require(_0xa9a8('0x8'));var path=require(_0xa9a8('0x9'));var sox=require(_0xa9a8('0xa'));var csv=require('to-csv');var ejs=require(_0xa9a8('0xb'));var fs=require('fs');var fs_extra=require(_0xa9a8('0xc'));var _=require('lodash');var squel=require(_0xa9a8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa9a8('0xe'));var toCsv=require(_0xa9a8('0xf'));var querystring=require('querystring');var Papa=require(_0xa9a8('0x10'));var Redis=require(_0xa9a8('0x11'));var authService=require(_0xa9a8('0x12'));var qs=require(_0xa9a8('0x13'));var as=require(_0xa9a8('0x14'));var hardwareService=require(_0xa9a8('0x15'));var logger=require(_0xa9a8('0x16'))(_0xa9a8('0x17'));var utils=require(_0xa9a8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa9a8('0x19'));var db=require(_0xa9a8('0x1a'))['db'];var integrations=require(_0xa9a8('0x1b'));function respondWithStatusCode(_0xd5b67f,_0x17429d){_0x17429d=_0x17429d||0xcc;return function(_0x52804f){if(_0x52804f){return _0xd5b67f[_0xa9a8('0x1c')](_0x17429d);}return _0xd5b67f[_0xa9a8('0x1d')](_0x17429d)['end']();};}function respondWithResult(_0x200ffd,_0x56e03c){_0x56e03c=_0x56e03c||0xc8;return function(_0x281430){if(_0x281430){return _0x200ffd[_0xa9a8('0x1d')](_0x56e03c)[_0xa9a8('0x1e')](_0x281430);}};}function respondWithFilteredResult(_0x68b47e,_0x5c9787){return function(_0x57e49a){if(_0x57e49a){var _0x564892=typeof _0x5c9787[_0xa9a8('0x1f')]==='undefined'&&typeof _0x5c9787[_0xa9a8('0x20')]===_0xa9a8('0x21');var _0x1a4d45=_0x57e49a['count'];var _0x407639=_0x564892?0x0:_0x5c9787[_0xa9a8('0x1f')];var _0x5ace41=_0x564892?_0x57e49a[_0xa9a8('0x22')]:_0x5c9787['offset']+_0x5c9787['limit'];var _0x178e6e;if(_0x5ace41>=_0x1a4d45){_0x5ace41=_0x1a4d45;_0x178e6e=0xc8;}else{_0x178e6e=0xce;}_0x68b47e[_0xa9a8('0x1d')](_0x178e6e);return _0x68b47e[_0xa9a8('0x23')](_0xa9a8('0x24'),_0x407639+'-'+_0x5ace41+'/'+_0x1a4d45)['json'](_0x57e49a);}return null;};}function patchUpdates(_0x463335){return function(_0x143ba9){try{jsonpatch[_0xa9a8('0x25')](_0x143ba9,_0x463335,!![]);}catch(_0xb56f0f){return BPromise[_0xa9a8('0x26')](_0xb56f0f);}return _0x143ba9[_0xa9a8('0x27')]();};}function saveUpdates(_0x7a2569,_0x5c6aeb){return function(_0x11c01b){if(_0x11c01b){return _0x11c01b[_0xa9a8('0x28')](_0x7a2569)[_0xa9a8('0x29')](function(_0x2770f6){return _0x2770f6;});}return null;};}function removeEntity(_0x3a06dc,_0x23f2d9){return function(_0x133ad8){if(_0x133ad8){return _0x133ad8[_0xa9a8('0x2a')]()['then'](function(){_0x3a06dc[_0xa9a8('0x1d')](0xcc)[_0xa9a8('0x2b')]();});}};}function handleEntityNotFound(_0x360194,_0x5cb798){return function(_0x5c6449){if(!_0x5c6449){_0x360194[_0xa9a8('0x1c')](0x194);}return _0x5c6449;};}function handleError(_0x35b0dd,_0x630fe2){_0x630fe2=_0x630fe2||0x1f4;return function(_0x41f134){logger[_0xa9a8('0x2c')](_0x41f134[_0xa9a8('0x2d')]);if(_0x41f134[_0xa9a8('0x2e')]){delete _0x41f134['name'];}_0x35b0dd[_0xa9a8('0x1d')](_0x630fe2)[_0xa9a8('0x2f')](_0x41f134);};}exports[_0xa9a8('0x30')]=function(_0xcad8d0,_0x560bed){var _0x1dcd07={},_0x4359b2={},_0x3e83f3={'count':0x0,'rows':[]};var _0x421857=_[_0xa9a8('0x31')](db[_0xa9a8('0x32')]['rawAttributes'],function(_0x351fca){return{'name':_0x351fca['fieldName'],'type':_0x351fca[_0xa9a8('0x33')][_0xa9a8('0x34')]};});_0x4359b2[_0xa9a8('0x35')]=_[_0xa9a8('0x31')](_0x421857,_0xa9a8('0x2e'));_0x4359b2[_0xa9a8('0x36')]=_['keys'](_0xcad8d0['query']);_0x4359b2['filters']=_[_0xa9a8('0x37')](_0x4359b2[_0xa9a8('0x35')],_0x4359b2[_0xa9a8('0x36')]);_0x1dcd07[_0xa9a8('0x38')]=_[_0xa9a8('0x37')](_0x4359b2[_0xa9a8('0x35')],qs[_0xa9a8('0x39')](_0xcad8d0['query'][_0xa9a8('0x39')]));_0x1dcd07[_0xa9a8('0x38')]=_0x1dcd07['attributes']['length']?_0x1dcd07[_0xa9a8('0x38')]:_0x4359b2[_0xa9a8('0x35')];if(!_0xcad8d0[_0xa9a8('0x36')][_0xa9a8('0x3a')](_0xa9a8('0x3b'))){_0x1dcd07['limit']=qs[_0xa9a8('0x20')](_0xcad8d0[_0xa9a8('0x36')][_0xa9a8('0x20')]);_0x1dcd07[_0xa9a8('0x1f')]=qs['offset'](_0xcad8d0[_0xa9a8('0x36')][_0xa9a8('0x1f')]);}_0x1dcd07['order']=qs[_0xa9a8('0x3c')](_0xcad8d0[_0xa9a8('0x36')][_0xa9a8('0x3c')]);_0x1dcd07[_0xa9a8('0x3d')]=qs[_0xa9a8('0x3e')](_['pick'](_0xcad8d0['query'],_0x4359b2['filters']),_0x421857);if(_0xcad8d0[_0xa9a8('0x36')]['filter']){_0x1dcd07[_0xa9a8('0x3d')]=_[_0xa9a8('0x3f')](_0x1dcd07[_0xa9a8('0x3d')],{'$or':_[_0xa9a8('0x31')](_0x421857,function(_0x1101ed){if(_0x1101ed[_0xa9a8('0x33')]!=='VIRTUAL'){var _0x4b1dc9={};_0x4b1dc9[_0x1101ed[_0xa9a8('0x2e')]]={'$like':'%'+_0xcad8d0[_0xa9a8('0x36')][_0xa9a8('0x40')]+'%'};return _0x4b1dc9;}})});}_0x1dcd07=_['merge']({},_0x1dcd07,_0xcad8d0[_0xa9a8('0x41')]);var _0x228b34={'where':_0x1dcd07[_0xa9a8('0x3d')]};return db[_0xa9a8('0x32')][_0xa9a8('0x22')](_0x228b34)[_0xa9a8('0x29')](function(_0x47da58){_0x3e83f3[_0xa9a8('0x22')]=_0x47da58;if(_0xcad8d0[_0xa9a8('0x36')]['includeAll']){_0x1dcd07['include']=[{'all':!![]}];}return db[_0xa9a8('0x32')]['findAll'](_0x1dcd07);})[_0xa9a8('0x29')](function(_0x246c95){_0x3e83f3[_0xa9a8('0x42')]=_0x246c95;return _0x3e83f3;})['then'](respondWithFilteredResult(_0x560bed,_0x1dcd07))[_0xa9a8('0x43')](handleError(_0x560bed,null));};exports[_0xa9a8('0x44')]=function(_0x5e12b4,_0x4a25f7){var _0x2bb9bd={'raw':![],'where':{'id':_0x5e12b4[_0xa9a8('0x45')]['id']}},_0x380d79={};_0x380d79['model']=_['keys'](db[_0xa9a8('0x32')][_0xa9a8('0x46')]);_0x380d79[_0xa9a8('0x36')]=_[_0xa9a8('0x47')](_0x5e12b4['query']);_0x380d79[_0xa9a8('0x3e')]=_[_0xa9a8('0x37')](_0x380d79[_0xa9a8('0x35')],_0x380d79[_0xa9a8('0x36')]);_0x2bb9bd['attributes']=_[_0xa9a8('0x37')](_0x380d79[_0xa9a8('0x35')],qs[_0xa9a8('0x39')](_0x5e12b4['query'][_0xa9a8('0x39')]));_0x2bb9bd[_0xa9a8('0x38')]=_0x2bb9bd[_0xa9a8('0x38')][_0xa9a8('0x48')]?_0x2bb9bd[_0xa9a8('0x38')]:_0x380d79[_0xa9a8('0x35')];if(_0x5e12b4[_0xa9a8('0x36')][_0xa9a8('0x49')]){_0x2bb9bd[_0xa9a8('0x4a')]=[{'all':!![]}];}_0x2bb9bd=_[_0xa9a8('0x3f')]({},_0x2bb9bd,_0x5e12b4[_0xa9a8('0x41')]);return db[_0xa9a8('0x32')][_0xa9a8('0x4b')](_0x2bb9bd)['then'](handleEntityNotFound(_0x4a25f7,null))[_0xa9a8('0x29')](respondWithResult(_0x4a25f7,null))[_0xa9a8('0x43')](handleError(_0x4a25f7,null));};exports[_0xa9a8('0x4c')]=function(_0x4bea30,_0x473c8b){return db[_0xa9a8('0x32')]['create'](_0x4bea30[_0xa9a8('0x4d')],{})[_0xa9a8('0x29')](respondWithResult(_0x473c8b,0xc9))[_0xa9a8('0x43')](handleError(_0x473c8b,null));};exports[_0xa9a8('0x28')]=function(_0xa5cd13,_0x3f6d5b){if(_0xa5cd13[_0xa9a8('0x4d')]['id']){delete _0xa5cd13[_0xa9a8('0x4d')]['id'];}return db[_0xa9a8('0x32')]['find']({'where':{'id':_0xa5cd13[_0xa9a8('0x45')]['id']}})[_0xa9a8('0x29')](handleEntityNotFound(_0x3f6d5b,null))[_0xa9a8('0x29')](saveUpdates(_0xa5cd13[_0xa9a8('0x4d')],null))[_0xa9a8('0x29')](respondWithResult(_0x3f6d5b,null))[_0xa9a8('0x43')](handleError(_0x3f6d5b,null));};exports[_0xa9a8('0x2a')]=function(_0x5d2ccb,_0x35e94c){return db['DeskAccount'][_0xa9a8('0x4b')]({'where':{'id':_0x5d2ccb[_0xa9a8('0x45')]['id']}})[_0xa9a8('0x29')](handleEntityNotFound(_0x35e94c,null))[_0xa9a8('0x29')](removeEntity(_0x35e94c,null))['catch'](handleError(_0x35e94c,null));};exports[_0xa9a8('0x4e')]=function(_0x32b147,_0x1e4d2e,_0x2574c1){var _0x3fdf02={};var _0x40759b={};var _0x458199;var _0x40becb;return db[_0xa9a8('0x32')]['findOne']({'where':{'id':_0x32b147['params']['id']}})['then'](handleEntityNotFound(_0x1e4d2e,null))['then'](function(_0x199acf){if(_0x199acf){_0x458199=_0x199acf;_0x40759b[_0xa9a8('0x35')]=_['keys'](db[_0xa9a8('0x4f')][_0xa9a8('0x46')]);_0x40759b[_0xa9a8('0x36')]=_[_0xa9a8('0x47')](_0x32b147[_0xa9a8('0x36')]);_0x40759b[_0xa9a8('0x3e')]=_[_0xa9a8('0x37')](_0x40759b[_0xa9a8('0x35')],_0x40759b['query']);_0x3fdf02[_0xa9a8('0x38')]=_[_0xa9a8('0x37')](_0x40759b['model'],qs[_0xa9a8('0x39')](_0x32b147[_0xa9a8('0x36')][_0xa9a8('0x39')]));_0x3fdf02[_0xa9a8('0x38')]=_0x3fdf02[_0xa9a8('0x38')][_0xa9a8('0x48')]?_0x3fdf02['attributes']:_0x40759b[_0xa9a8('0x35')];_0x3fdf02['order']=qs['sort'](_0x32b147[_0xa9a8('0x36')][_0xa9a8('0x3c')]);_0x3fdf02['where']=qs['filters'](_[_0xa9a8('0x50')](_0x32b147['query'],_0x40759b[_0xa9a8('0x3e')]));if(_0x32b147['query'][_0xa9a8('0x40')]){_0x3fdf02[_0xa9a8('0x3d')]=_['merge'](_0x3fdf02[_0xa9a8('0x3d')],{'$or':_[_0xa9a8('0x31')](_0x3fdf02['attributes'],function(_0x1629b2){var _0x3fa84d={};_0x3fa84d[_0x1629b2]={'$like':'%'+_0x32b147[_0xa9a8('0x36')][_0xa9a8('0x40')]+'%'};return _0x3fa84d;})});}_0x3fdf02=_[_0xa9a8('0x3f')]({},_0x3fdf02,_0x32b147['options']);return _0x458199[_0xa9a8('0x4e')](_0x3fdf02);}})[_0xa9a8('0x29')](function(_0x1fe928){if(_0x1fe928){_0x40becb=_0x1fe928[_0xa9a8('0x48')];if(!_0x32b147['query'][_0xa9a8('0x3a')](_0xa9a8('0x3b'))){_0x3fdf02[_0xa9a8('0x20')]=qs['limit'](_0x32b147[_0xa9a8('0x36')][_0xa9a8('0x20')]);_0x3fdf02[_0xa9a8('0x1f')]=qs[_0xa9a8('0x1f')](_0x32b147[_0xa9a8('0x36')][_0xa9a8('0x1f')]);}return _0x458199[_0xa9a8('0x4e')](_0x3fdf02);}})[_0xa9a8('0x29')](function(_0x27af38){if(_0x27af38){return _0x27af38?{'count':_0x40becb,'rows':_0x27af38}:null;}})['then'](respondWithResult(_0x1e4d2e,null))[_0xa9a8('0x43')](handleError(_0x1e4d2e,null));};exports['addConfiguration']=function(_0x1b9e2f,_0xc3b9fb,_0x34d340){if(_0x1b9e2f[_0xa9a8('0x4d')]['id']){delete _0x1b9e2f[_0xa9a8('0x4d')]['id'];}return db[_0xa9a8('0x32')][_0xa9a8('0x51')]({'where':{'id':_0x1b9e2f['params']['id']}})[_0xa9a8('0x29')](handleEntityNotFound(_0xc3b9fb,null))['then'](function(_0x47de03){if(_0x47de03){_0x1b9e2f[_0xa9a8('0x4d')]['AccountId']=_0x47de03['id'];_0x1b9e2f[_0xa9a8('0x4d')][_0xa9a8('0x52')]=integrations['getSubjects'](_0x1b9e2f[_0xa9a8('0x4d')][_0xa9a8('0x53')],_0x1b9e2f['body'][_0xa9a8('0x33')]);_0x1b9e2f['body'][_0xa9a8('0x54')]=integrations[_0xa9a8('0x55')](_0x1b9e2f[_0xa9a8('0x4d')]['channel'],_0x1b9e2f['body']['type']);return db['DeskConfiguration'][_0xa9a8('0x4c')](_0x1b9e2f['body'],{'include':[{'model':db['DeskField'],'as':_0xa9a8('0x52')},{'model':db[_0xa9a8('0x56')],'as':_0xa9a8('0x54')}]});}return null;})['then'](respondWithResult(_0xc3b9fb,null))['catch'](handleError(_0xc3b9fb,null));};exports['getFields']=function(_0x30dc23,_0x5f51ca,_0xc29ffb){var _0x344d62=[{'name':_0xa9a8('0x57'),'label':_0xa9a8('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2cbae5='';return db[_0xa9a8('0x32')][_0xa9a8('0x51')]({'where':{'id':_0x30dc23[_0xa9a8('0x45')]['id']},'attributes':['id',_0xa9a8('0x58'),_0xa9a8('0x59'),_0xa9a8('0x5a'),_0xa9a8('0x5b'),_0xa9a8('0x5c'),_0xa9a8('0x5d'),_0xa9a8('0x5e'),_0xa9a8('0x5f')]})[_0xa9a8('0x29')](handleEntityNotFound(_0x5f51ca,null))[_0xa9a8('0x29')](function(_0x301fc2){if(_0x301fc2){_0x2cbae5=_0x301fc2['remoteUri'];var _0x36d901=_0x2cbae5[_0xa9a8('0x60')](-0x1);if(_0x36d901==='/'){_0x2cbae5=_0x2cbae5[_0xa9a8('0x61')](0x0,_0x2cbae5[_0xa9a8('0x62')](_0x36d901));}var _0x27e282={'method':_0xa9a8('0x63'),'uri':util[_0xa9a8('0x64')](_0xa9a8('0x65'),_0x2cbae5),'headers':{'Content-Type':'application/json','Accept':_0xa9a8('0x66')},'json':!![]};if(_0x301fc2[_0xa9a8('0x59')]==='basic'){_0x27e282[_0xa9a8('0x67')][_0xa9a8('0x68')]=util['format'](_0xa9a8('0x69'),new Buffer(util[_0xa9a8('0x64')](_0xa9a8('0x6a'),_0x301fc2[_0xa9a8('0x5a')],_0x301fc2[_0xa9a8('0x5b')]))[_0xa9a8('0x6b')]('base64'));}return rp(_0x27e282)[_0xa9a8('0x29')](function(_0x3d9583){return _0x344d62[_0xa9a8('0x6c')](_[_0xa9a8('0x31')](_0x3d9583[_0xa9a8('0x6d')][_0xa9a8('0x6e')],function(_0x1b4c8c){return{'id':_0x1b4c8c['name'],'name':_0x1b4c8c[_0xa9a8('0x2e')],'type':_0x1b4c8c['type'],'active':_0x1b4c8c['active'],'label':_0x1b4c8c['label'],'custom':!![]};}));});}})[_0xa9a8('0x29')](function(_0x21db72){return{'count':_0x21db72[_0xa9a8('0x48')],'rows':_0x21db72};})['then'](respondWithResult(_0x5f51ca,null))['catch'](function(_0x448cfc){var _0x2378fe=_0x30dc23[_0xa9a8('0x36')][_0xa9a8('0x6f')]?0x1f4:_0x448cfc[_0xa9a8('0x70')]||0x1f4;logger[_0xa9a8('0x2c')](_0xa9a8('0x71'),_0xa9a8('0x72'),_0x2378fe,JSON[_0xa9a8('0x73')](_0x448cfc));delete _0x448cfc[_0xa9a8('0x2e')];if(_0x2378fe===0x191){_0x2378fe=0x190;}_0x5f51ca[_0xa9a8('0x1d')](_0x2378fe)['send'](_0x30dc23[_0xa9a8('0x36')][_0xa9a8('0x6f')]?{'message':_0xa9a8('0x74'),'statusCode':_0x448cfc['statusCode']}:_0x448cfc);});};
\ No newline at end of file
+var _0xd054=['Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','show','create','body','find','params','DeskConfiguration','sort','getConfigurations','nolimit','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','remoteUri','substring','lastIndexOf','format','%s/custom_fields','application/json','basic'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd054,0x168));var _0x4d05=function(_0x58f045,_0x217e8f){_0x58f045=_0x58f045-0x0;var _0x2eff3b=_0xd054[_0x58f045];return _0x2eff3b;};'use strict';var emlformat=require(_0x4d05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d05('0x1'));var jsonpatch=require(_0x4d05('0x2'));var rp=require(_0x4d05('0x3'));var moment=require(_0x4d05('0x4'));var BPromise=require(_0x4d05('0x5'));var Mustache=require(_0x4d05('0x6'));var util=require('util');var path=require(_0x4d05('0x7'));var sox=require(_0x4d05('0x8'));var csv=require(_0x4d05('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d05('0xa'));var squel=require(_0x4d05('0xb'));var crypto=require('crypto');var jsforce=require(_0x4d05('0xc'));var deskjs=require(_0x4d05('0xd'));var toCsv=require(_0x4d05('0x9'));var querystring=require(_0x4d05('0xe'));var Papa=require(_0x4d05('0xf'));var Redis=require(_0x4d05('0x10'));var authService=require(_0x4d05('0x11'));var qs=require(_0x4d05('0x12'));var as=require(_0x4d05('0x13'));var hardwareService=require(_0x4d05('0x14'));var logger=require(_0x4d05('0x15'))(_0x4d05('0x16'));var utils=require(_0x4d05('0x17'));var config=require(_0x4d05('0x18'));var licenseUtil=require(_0x4d05('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d7e63,_0x1b2cf9){_0x1b2cf9=_0x1b2cf9||0xcc;return function(_0x4612a5){if(_0x4612a5){return _0x2d7e63[_0x4d05('0x1a')](_0x1b2cf9);}return _0x2d7e63[_0x4d05('0x1b')](_0x1b2cf9)[_0x4d05('0x1c')]();};}function respondWithResult(_0x131851,_0x1a97d8){_0x1a97d8=_0x1a97d8||0xc8;return function(_0x38fa12){if(_0x38fa12){return _0x131851[_0x4d05('0x1b')](_0x1a97d8)[_0x4d05('0x1d')](_0x38fa12);}};}function respondWithFilteredResult(_0x3a3b17,_0x1ce0f9){return function(_0x56a167){if(_0x56a167){var _0x4c35a3=typeof _0x1ce0f9[_0x4d05('0x1e')]===_0x4d05('0x1f')&&typeof _0x1ce0f9[_0x4d05('0x20')]===_0x4d05('0x1f');var _0x5c8346=_0x56a167[_0x4d05('0x21')];var _0x9a6751=_0x4c35a3?0x0:_0x1ce0f9[_0x4d05('0x1e')];var _0x227cc4=_0x4c35a3?_0x56a167[_0x4d05('0x21')]:_0x1ce0f9[_0x4d05('0x1e')]+_0x1ce0f9[_0x4d05('0x20')];var _0xa05b61;if(_0x227cc4>=_0x5c8346){_0x227cc4=_0x5c8346;_0xa05b61=0xc8;}else{_0xa05b61=0xce;}_0x3a3b17[_0x4d05('0x1b')](_0xa05b61);return _0x3a3b17[_0x4d05('0x22')](_0x4d05('0x23'),_0x9a6751+'-'+_0x227cc4+'/'+_0x5c8346)[_0x4d05('0x1d')](_0x56a167);}return null;};}function patchUpdates(_0x22cb02){return function(_0x35e272){try{jsonpatch[_0x4d05('0x24')](_0x35e272,_0x22cb02,!![]);}catch(_0x58f0ed){return BPromise[_0x4d05('0x25')](_0x58f0ed);}return _0x35e272['save']();};}function saveUpdates(_0x5c8a77,_0x545e2e){return function(_0xae13c3){if(_0xae13c3){return _0xae13c3[_0x4d05('0x26')](_0x5c8a77)[_0x4d05('0x27')](function(_0x2a766d){return _0x2a766d;});}return null;};}function removeEntity(_0x39154e,_0x237e64){return function(_0xdf4ea){if(_0xdf4ea){return _0xdf4ea[_0x4d05('0x28')]()[_0x4d05('0x27')](function(){_0x39154e[_0x4d05('0x1b')](0xcc)[_0x4d05('0x1c')]();});}};}function handleEntityNotFound(_0x180330,_0x38f3f8){return function(_0x1244d1){if(!_0x1244d1){_0x180330[_0x4d05('0x1a')](0x194);}return _0x1244d1;};}function handleError(_0x318af5,_0x396d1d){_0x396d1d=_0x396d1d||0x1f4;return function(_0x384fc9){logger['error'](_0x384fc9[_0x4d05('0x29')]);if(_0x384fc9[_0x4d05('0x2a')]){delete _0x384fc9[_0x4d05('0x2a')];}_0x318af5[_0x4d05('0x1b')](_0x396d1d)[_0x4d05('0x2b')](_0x384fc9);};}exports[_0x4d05('0x2c')]=function(_0x5bbb5f,_0xaa2227){var _0x3c7792={},_0x3a0c1a={},_0x339f9d={'count':0x0,'rows':[]};var _0x3c0bb5=_[_0x4d05('0x2d')](db[_0x4d05('0x2e')][_0x4d05('0x2f')],function(_0x5b7769){return{'name':_0x5b7769[_0x4d05('0x30')],'type':_0x5b7769[_0x4d05('0x31')]['key']};});_0x3a0c1a[_0x4d05('0x32')]=_[_0x4d05('0x2d')](_0x3c0bb5,_0x4d05('0x2a'));_0x3a0c1a[_0x4d05('0x33')]=_[_0x4d05('0x34')](_0x5bbb5f[_0x4d05('0x33')]);_0x3a0c1a[_0x4d05('0x35')]=_[_0x4d05('0x36')](_0x3a0c1a[_0x4d05('0x32')],_0x3a0c1a[_0x4d05('0x33')]);_0x3c7792[_0x4d05('0x37')]=_[_0x4d05('0x36')](_0x3a0c1a[_0x4d05('0x32')],qs['fields'](_0x5bbb5f[_0x4d05('0x33')][_0x4d05('0x38')]));_0x3c7792[_0x4d05('0x37')]=_0x3c7792[_0x4d05('0x37')][_0x4d05('0x39')]?_0x3c7792[_0x4d05('0x37')]:_0x3a0c1a[_0x4d05('0x32')];if(!_0x5bbb5f[_0x4d05('0x33')][_0x4d05('0x3a')]('nolimit')){_0x3c7792[_0x4d05('0x20')]=qs['limit'](_0x5bbb5f[_0x4d05('0x33')][_0x4d05('0x20')]);_0x3c7792[_0x4d05('0x1e')]=qs[_0x4d05('0x1e')](_0x5bbb5f['query'][_0x4d05('0x1e')]);}_0x3c7792[_0x4d05('0x3b')]=qs['sort'](_0x5bbb5f['query']['sort']);_0x3c7792['where']=qs[_0x4d05('0x35')](_[_0x4d05('0x3c')](_0x5bbb5f[_0x4d05('0x33')],_0x3a0c1a['filters']),_0x3c0bb5);if(_0x5bbb5f[_0x4d05('0x33')][_0x4d05('0x3d')]){_0x3c7792[_0x4d05('0x3e')]=_['merge'](_0x3c7792[_0x4d05('0x3e')],{'$or':_['map'](_0x3c0bb5,function(_0x42dccc){if(_0x42dccc[_0x4d05('0x31')]!==_0x4d05('0x3f')){var _0x4330ac={};_0x4330ac[_0x42dccc['name']]={'$like':'%'+_0x5bbb5f['query'][_0x4d05('0x3d')]+'%'};return _0x4330ac;}})});}_0x3c7792=_[_0x4d05('0x40')]({},_0x3c7792,_0x5bbb5f[_0x4d05('0x41')]);var _0x39ad1b={'where':_0x3c7792[_0x4d05('0x3e')]};return db[_0x4d05('0x2e')][_0x4d05('0x21')](_0x39ad1b)[_0x4d05('0x27')](function(_0x288e81){_0x339f9d[_0x4d05('0x21')]=_0x288e81;if(_0x5bbb5f[_0x4d05('0x33')]['includeAll']){_0x3c7792[_0x4d05('0x42')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3c7792);})['then'](function(_0x3ae1d4){_0x339f9d[_0x4d05('0x43')]=_0x3ae1d4;return _0x339f9d;})[_0x4d05('0x27')](respondWithFilteredResult(_0xaa2227,_0x3c7792))[_0x4d05('0x44')](handleError(_0xaa2227,null));};exports[_0x4d05('0x45')]=function(_0x49f2d6,_0x6d22d){var _0x526ad2={'raw':![],'where':{'id':_0x49f2d6['params']['id']}},_0x3e5919={};_0x3e5919[_0x4d05('0x32')]=_[_0x4d05('0x34')](db[_0x4d05('0x2e')][_0x4d05('0x2f')]);_0x3e5919[_0x4d05('0x33')]=_['keys'](_0x49f2d6[_0x4d05('0x33')]);_0x3e5919[_0x4d05('0x35')]=_[_0x4d05('0x36')](_0x3e5919['model'],_0x3e5919[_0x4d05('0x33')]);_0x526ad2[_0x4d05('0x37')]=_['intersection'](_0x3e5919[_0x4d05('0x32')],qs[_0x4d05('0x38')](_0x49f2d6[_0x4d05('0x33')][_0x4d05('0x38')]));_0x526ad2[_0x4d05('0x37')]=_0x526ad2['attributes']['length']?_0x526ad2['attributes']:_0x3e5919[_0x4d05('0x32')];if(_0x49f2d6[_0x4d05('0x33')]['includeAll']){_0x526ad2[_0x4d05('0x42')]=[{'all':!![]}];}_0x526ad2=_[_0x4d05('0x40')]({},_0x526ad2,_0x49f2d6['options']);return db[_0x4d05('0x2e')]['find'](_0x526ad2)[_0x4d05('0x27')](handleEntityNotFound(_0x6d22d,null))[_0x4d05('0x27')](respondWithResult(_0x6d22d,null))['catch'](handleError(_0x6d22d,null));};exports[_0x4d05('0x46')]=function(_0x560acf,_0x2417c6){return db[_0x4d05('0x2e')][_0x4d05('0x46')](_0x560acf[_0x4d05('0x47')],{})['then'](respondWithResult(_0x2417c6,0xc9))[_0x4d05('0x44')](handleError(_0x2417c6,null));};exports[_0x4d05('0x26')]=function(_0x3900b8,_0x2e882f){if(_0x3900b8[_0x4d05('0x47')]['id']){delete _0x3900b8['body']['id'];}return db[_0x4d05('0x2e')][_0x4d05('0x48')]({'where':{'id':_0x3900b8[_0x4d05('0x49')]['id']}})[_0x4d05('0x27')](handleEntityNotFound(_0x2e882f,null))[_0x4d05('0x27')](saveUpdates(_0x3900b8[_0x4d05('0x47')],null))[_0x4d05('0x27')](respondWithResult(_0x2e882f,null))[_0x4d05('0x44')](handleError(_0x2e882f,null));};exports[_0x4d05('0x28')]=function(_0x7c84ce,_0x254ced){return db['DeskAccount'][_0x4d05('0x48')]({'where':{'id':_0x7c84ce['params']['id']}})['then'](handleEntityNotFound(_0x254ced,null))['then'](removeEntity(_0x254ced,null))['catch'](handleError(_0x254ced,null));};exports['getConfigurations']=function(_0x1c14af,_0x4c9256,_0x1546eb){var _0x4e7be2={};var _0x5401bc={};var _0x40991c;var _0x214f53;return db[_0x4d05('0x2e')]['findOne']({'where':{'id':_0x1c14af[_0x4d05('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c9256,null))[_0x4d05('0x27')](function(_0x3a99d4){if(_0x3a99d4){_0x40991c=_0x3a99d4;_0x5401bc[_0x4d05('0x32')]=_['keys'](db[_0x4d05('0x4a')][_0x4d05('0x2f')]);_0x5401bc[_0x4d05('0x33')]=_[_0x4d05('0x34')](_0x1c14af['query']);_0x5401bc[_0x4d05('0x35')]=_[_0x4d05('0x36')](_0x5401bc['model'],_0x5401bc[_0x4d05('0x33')]);_0x4e7be2['attributes']=_['intersection'](_0x5401bc[_0x4d05('0x32')],qs[_0x4d05('0x38')](_0x1c14af['query'][_0x4d05('0x38')]));_0x4e7be2['attributes']=_0x4e7be2[_0x4d05('0x37')][_0x4d05('0x39')]?_0x4e7be2['attributes']:_0x5401bc['model'];_0x4e7be2['order']=qs[_0x4d05('0x4b')](_0x1c14af[_0x4d05('0x33')]['sort']);_0x4e7be2[_0x4d05('0x3e')]=qs[_0x4d05('0x35')](_[_0x4d05('0x3c')](_0x1c14af['query'],_0x5401bc['filters']));if(_0x1c14af['query'][_0x4d05('0x3d')]){_0x4e7be2['where']=_[_0x4d05('0x40')](_0x4e7be2['where'],{'$or':_[_0x4d05('0x2d')](_0x4e7be2[_0x4d05('0x37')],function(_0x2a53d5){var _0x49ee51={};_0x49ee51[_0x2a53d5]={'$like':'%'+_0x1c14af[_0x4d05('0x33')][_0x4d05('0x3d')]+'%'};return _0x49ee51;})});}_0x4e7be2=_[_0x4d05('0x40')]({},_0x4e7be2,_0x1c14af[_0x4d05('0x41')]);return _0x40991c[_0x4d05('0x4c')](_0x4e7be2);}})[_0x4d05('0x27')](function(_0x10a3ae){if(_0x10a3ae){_0x214f53=_0x10a3ae[_0x4d05('0x39')];if(!_0x1c14af[_0x4d05('0x33')]['hasOwnProperty'](_0x4d05('0x4d'))){_0x4e7be2[_0x4d05('0x20')]=qs['limit'](_0x1c14af[_0x4d05('0x33')][_0x4d05('0x20')]);_0x4e7be2[_0x4d05('0x1e')]=qs[_0x4d05('0x1e')](_0x1c14af[_0x4d05('0x33')][_0x4d05('0x1e')]);}return _0x40991c['getConfigurations'](_0x4e7be2);}})['then'](function(_0x48f4b0){if(_0x48f4b0){return _0x48f4b0?{'count':_0x214f53,'rows':_0x48f4b0}:null;}})[_0x4d05('0x27')](respondWithResult(_0x4c9256,null))[_0x4d05('0x44')](handleError(_0x4c9256,null));};exports['addConfiguration']=function(_0x4d8f09,_0x5051f3,_0x14ffe6){if(_0x4d8f09[_0x4d05('0x47')]['id']){delete _0x4d8f09['body']['id'];}return db[_0x4d05('0x2e')][_0x4d05('0x4e')]({'where':{'id':_0x4d8f09[_0x4d05('0x49')]['id']}})[_0x4d05('0x27')](handleEntityNotFound(_0x5051f3,null))[_0x4d05('0x27')](function(_0x271a6b){if(_0x271a6b){_0x4d8f09[_0x4d05('0x47')][_0x4d05('0x4f')]=_0x271a6b['id'];_0x4d8f09[_0x4d05('0x47')]['Subjects']=integrations[_0x4d05('0x50')](_0x4d8f09['body'][_0x4d05('0x51')],_0x4d8f09['body']['type']);_0x4d8f09[_0x4d05('0x47')][_0x4d05('0x52')]=integrations[_0x4d05('0x53')](_0x4d8f09[_0x4d05('0x47')][_0x4d05('0x51')],_0x4d8f09[_0x4d05('0x47')]['type']);return db[_0x4d05('0x4a')][_0x4d05('0x46')](_0x4d8f09[_0x4d05('0x47')],{'include':[{'model':db[_0x4d05('0x54')],'as':'Subjects'},{'model':db[_0x4d05('0x54')],'as':'Descriptions'}]});}return null;})[_0x4d05('0x27')](respondWithResult(_0x5051f3,null))[_0x4d05('0x44')](handleError(_0x5051f3,null));};exports[_0x4d05('0x55')]=function(_0x27caf3,_0x35fa52,_0x5695ff){var _0x3f6dd6=[{'name':_0x4d05('0x56'),'label':_0x4d05('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3ecd44='';return db[_0x4d05('0x2e')]['findOne']({'where':{'id':_0x27caf3['params']['id']},'attributes':['id','remoteUri',_0x4d05('0x57'),_0x4d05('0x58'),_0x4d05('0x59'),'consumerKey',_0x4d05('0x5a'),_0x4d05('0x5b'),_0x4d05('0x5c')]})[_0x4d05('0x27')](handleEntityNotFound(_0x35fa52,null))[_0x4d05('0x27')](function(_0x5287e2){if(_0x5287e2){_0x3ecd44=_0x5287e2[_0x4d05('0x5d')];var _0x208886=_0x3ecd44['slice'](-0x1);if(_0x208886==='/'){_0x3ecd44=_0x3ecd44[_0x4d05('0x5e')](0x0,_0x3ecd44[_0x4d05('0x5f')](_0x208886));}var _0x3a73b6={'method':'GET','uri':util[_0x4d05('0x60')](_0x4d05('0x61'),_0x3ecd44),'headers':{'Content-Type':_0x4d05('0x62'),'Accept':'application/json'},'json':!![]};if(_0x5287e2[_0x4d05('0x57')]===_0x4d05('0x63')){_0x3a73b6['headers'][_0x4d05('0x64')]=util[_0x4d05('0x60')](_0x4d05('0x65'),new Buffer(util['format'](_0x4d05('0x66'),_0x5287e2[_0x4d05('0x58')],_0x5287e2[_0x4d05('0x59')]))[_0x4d05('0x67')](_0x4d05('0x68')));}return rp(_0x3a73b6)[_0x4d05('0x27')](function(_0x1932db){return _0x3f6dd6[_0x4d05('0x69')](_[_0x4d05('0x2d')](_0x1932db[_0x4d05('0x6a')][_0x4d05('0x6b')],function(_0x23ce3a){return{'id':_0x23ce3a[_0x4d05('0x2a')],'name':_0x23ce3a[_0x4d05('0x2a')],'type':_0x23ce3a['type'],'active':_0x23ce3a[_0x4d05('0x6c')],'label':_0x23ce3a[_0x4d05('0x6d')],'custom':!![]};}));});}})[_0x4d05('0x27')](function(_0x32f454){return{'count':_0x32f454['length'],'rows':_0x32f454};})[_0x4d05('0x27')](respondWithResult(_0x35fa52,null))['catch'](function(_0x3611a7){var _0x381b1d=_0x27caf3['query'][_0x4d05('0x6e')]?0x1f4:_0x3611a7['statusCode']||0x1f4;logger[_0x4d05('0x6f')](_0x4d05('0x70'),_0x4d05('0x55'),_0x381b1d,JSON[_0x4d05('0x71')](_0x3611a7));delete _0x3611a7[_0x4d05('0x2a')];if(_0x381b1d===0x191){_0x381b1d=0x190;}_0x35fa52['status'](_0x381b1d)[_0x4d05('0x2b')](_0x27caf3[_0x4d05('0x33')][_0x4d05('0x6e')]?{'message':_0x4d05('0x72'),'statusCode':_0x3611a7['statusCode']}:_0x3611a7);});};
\ No newline at end of file
index 306164b..caec31c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab5f=['./intDeskAccount.attributes','define','DeskAccount','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe9fca1,_0x5ba251){var _0x55ae32=function(_0x553090){while(--_0x553090){_0xe9fca1['push'](_0xe9fca1['shift']());}};_0x55ae32(++_0x5ba251);}(_0xab5f,0x1d1));var _0xfab5=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xab5f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xfab5('0x0'));var util=require(_0xfab5('0x1'));var logger=require('../../config/logger')(_0xfab5('0x2'));var moment=require(_0xfab5('0x3'));var BPromise=require('bluebird');var rp=require(_0xfab5('0x4'));var fs=require('fs');var path=require(_0xfab5('0x5'));var rimraf=require(_0xfab5('0x6'));var config=require(_0xfab5('0x7'));var attributes=require(_0xfab5('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40b4c4,_0xe90b6){return _0x40b4c4[_0xfab5('0x9')](_0xfab5('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x527c=['exports','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x25a92f,_0x352bf0){var _0x1e43fe=function(_0x467615){while(--_0x467615){_0x25a92f['push'](_0x25a92f['shift']());}};_0x1e43fe(++_0x352bf0);}(_0x527c,0xf2));var _0xc527=function(_0x1e9d6a,_0x3e5cab){_0x1e9d6a=_0x1e9d6a-0x0;var _0x222bd1=_0x527c[_0x1e9d6a];return _0x222bd1;};'use strict';var _=require(_0xc527('0x0'));var util=require(_0xc527('0x1'));var logger=require('../../config/logger')(_0xc527('0x2'));var moment=require(_0xc527('0x3'));var BPromise=require(_0xc527('0x4'));var rp=require(_0xc527('0x5'));var fs=require('fs');var path=require(_0xc527('0x6'));var rimraf=require(_0xc527('0x7'));var config=require(_0xc527('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xc527('0x9'));module[_0xc527('0xa')]=function(_0x5aa791,_0x23d48b){return _0x5aa791[_0xc527('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a433176..80dca4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24ab=['where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','map','model','debug','ShowDeskAccount','find','raw'];(function(_0xf7c72a,_0x4bb071){var _0x483324=function(_0x36b75e){while(--_0x36b75e){_0xf7c72a['push'](_0xf7c72a['shift']());}};_0x483324(++_0x4bb071);}(_0x24ab,0x155));var _0xb24a=function(_0x32ed89,_0x11d953){_0x32ed89=_0x32ed89-0x0;var _0x262961=_0x24ab[_0x32ed89];return _0x262961;};'use strict';var _=require(_0xb24a('0x0'));var util=require(_0xb24a('0x1'));var moment=require(_0xb24a('0x2'));var BPromise=require('bluebird');var rs=require(_0xb24a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb24a('0x4'))['db'];var utils=require(_0xb24a('0x5'));var logger=require(_0xb24a('0x6'))('rpc');var config=require(_0xb24a('0x7'));var jayson=require(_0xb24a('0x8'));var client=jayson[_0xb24a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e661e,_0x59c94c,_0x40f555){return new BPromise(function(_0x8877e8,_0x7f476b){return client['request'](_0x5e661e,_0x40f555)[_0xb24a('0xa')](function(_0x41e512){logger['info'](_0xb24a('0xb'),_0x59c94c,_0xb24a('0xc'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x59c94c,_0xb24a('0xc'),JSON[_0xb24a('0xd')](_0x41e512));if(_0x41e512[_0xb24a('0xe')]){if(_0x41e512[_0xb24a('0xe')][_0xb24a('0xf')]===0x1f4){logger[_0xb24a('0xe')]('DeskAccount,\x20%s,\x20%s',_0x59c94c,_0x41e512[_0xb24a('0xe')][_0xb24a('0x10')]);return _0x7f476b(_0x41e512['error']['message']);}logger['error'](_0xb24a('0xb'),_0x59c94c,_0x41e512[_0xb24a('0xe')]['message']);return _0x8877e8(_0x41e512['error'][_0xb24a('0x10')]);}else{logger[_0xb24a('0x11')](_0xb24a('0xb'),_0x59c94c,_0xb24a('0xc'));_0x8877e8(_0x41e512[_0xb24a('0x12')][_0xb24a('0x10')]);}})[_0xb24a('0x13')](function(_0x75d092){logger[_0xb24a('0xe')](_0xb24a('0xb'),_0x59c94c,_0x75d092);_0x7f476b(_0x75d092);});});}exports[_0xb24a('0x14')]=function(_0x2925f1){var _0x5ce514=this;return new Promise(function(_0x314139,_0x24071d){return db[_0xb24a('0x15')][_0xb24a('0x16')]({'raw':_0x2925f1[_0xb24a('0x17')]?_0x2925f1[_0xb24a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2925f1[_0xb24a('0x17')]?_0x2925f1['options']['where']||null:null,'attributes':_0x2925f1[_0xb24a('0x17')]?_0x2925f1[_0xb24a('0x17')][_0xb24a('0x18')]||null:null,'limit':_0x2925f1['options']?_0x2925f1[_0xb24a('0x17')][_0xb24a('0x19')]||null:null,'include':_0x2925f1[_0xb24a('0x17')]?_0x2925f1[_0xb24a('0x17')][_0xb24a('0x1a')]?_['map'](_0x2925f1[_0xb24a('0x17')][_0xb24a('0x1a')],function(_0xa7cdd3){return{'model':db[_0xa7cdd3['model']],'as':_0xa7cdd3['as'],'attributes':_0xa7cdd3[_0xb24a('0x18')],'include':_0xa7cdd3[_0xb24a('0x1a')]?_[_0xb24a('0x1b')](_0xa7cdd3['include'],function(_0xe4e5f3){return{'model':db[_0xe4e5f3['model']],'as':_0xe4e5f3['as'],'attributes':_0xe4e5f3[_0xb24a('0x18')],'include':_0xe4e5f3['include']?_[_0xb24a('0x1b')](_0xe4e5f3[_0xb24a('0x1a')],function(_0xad7224){return{'model':db[_0xad7224[_0xb24a('0x1c')]],'as':_0xad7224['as'],'attributes':_0xad7224[_0xb24a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb24a('0xa')](function(_0x1ffd77){logger[_0xb24a('0x11')](_0xb24a('0x14'),_0x2925f1);logger[_0xb24a('0x1d')]('GetDeskAccount',_0x2925f1,JSON[_0xb24a('0xd')](_0x1ffd77));_0x314139(_0x1ffd77);})[_0xb24a('0x13')](function(_0x3cf925){logger['error'](_0xb24a('0x14'),_0x3cf925['message'],_0x2925f1);_0x24071d(_0x5ce514[_0xb24a('0xe')](0x1f4,_0x3cf925[_0xb24a('0x10')]));});});};exports[_0xb24a('0x1e')]=function(_0x1c9448){var _0x53b19f=this;return new Promise(function(_0x1c35ba,_0x3fbe04){return db[_0xb24a('0x15')][_0xb24a('0x1f')]({'raw':_0x1c9448[_0xb24a('0x17')]?_0x1c9448[_0xb24a('0x17')][_0xb24a('0x20')]===undefined?!![]:![]:!![],'where':_0x1c9448[_0xb24a('0x17')]?_0x1c9448[_0xb24a('0x17')][_0xb24a('0x21')]||null:null,'attributes':_0x1c9448[_0xb24a('0x17')]?_0x1c9448[_0xb24a('0x17')][_0xb24a('0x18')]||null:null,'include':_0x1c9448[_0xb24a('0x17')]?_0x1c9448[_0xb24a('0x17')]['include']?_[_0xb24a('0x1b')](_0x1c9448['options'][_0xb24a('0x1a')],function(_0x103039){return{'model':db[_0x103039[_0xb24a('0x1c')]],'as':_0x103039['as'],'attributes':_0x103039[_0xb24a('0x18')],'include':_0x103039['include']?_['map'](_0x103039[_0xb24a('0x1a')],function(_0x2fb9b3){return{'model':db[_0x2fb9b3['model']],'as':_0x2fb9b3['as'],'attributes':_0x2fb9b3[_0xb24a('0x18')],'include':_0x2fb9b3[_0xb24a('0x1a')]?_[_0xb24a('0x1b')](_0x2fb9b3['include'],function(_0x47097d){return{'model':db[_0x47097d[_0xb24a('0x1c')]],'as':_0x47097d['as'],'attributes':_0x47097d['attributes']};}):[]};}):[]};}):[]:[]})[_0xb24a('0xa')](function(_0x4f1854){logger['info'](_0xb24a('0x1e'),_0x1c9448);logger[_0xb24a('0x1d')](_0xb24a('0x1e'),_0x1c9448,JSON['stringify'](_0x4f1854));_0x1c35ba(_0x4f1854);})[_0xb24a('0x13')](function(_0xd7eba2){logger[_0xb24a('0xe')]('ShowDeskAccount',_0xd7eba2[_0xb24a('0x10')],_0x1c9448);_0x3fbe04(_0x53b19f[_0xb24a('0xe')](0x1f4,_0xd7eba2['message']));});});};
\ No newline at end of file
+var _0x6c11=['http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','model','map','ShowDeskAccount','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5e5c35,_0xdab7e3){var _0x53ff31=function(_0x9a89d0){while(--_0x9a89d0){_0x5e5c35['push'](_0x5e5c35['shift']());}};_0x53ff31(++_0xdab7e3);}(_0x6c11,0xff));var _0x16c1=function(_0x2e9b83,_0x238187){_0x2e9b83=_0x2e9b83-0x0;var _0x569ce3=_0x6c11[_0x2e9b83];return _0x569ce3;};'use strict';var _=require(_0x16c1('0x0'));var util=require('util');var moment=require(_0x16c1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16c1('0x2'));var db=require(_0x16c1('0x3'))['db'];var utils=require(_0x16c1('0x4'));var logger=require(_0x16c1('0x5'))(_0x16c1('0x6'));var config=require('../../config/environment');var jayson=require(_0x16c1('0x7'));var client=jayson[_0x16c1('0x8')][_0x16c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4440,_0x3a700e,_0x1a785d){return new BPromise(function(_0x1669ef,_0x3e5034){return client['request'](_0x5d4440,_0x1a785d)[_0x16c1('0xa')](function(_0x42fcbf){logger[_0x16c1('0xb')]('DeskAccount,\x20%s,\x20%s',_0x3a700e,_0x16c1('0xc'));logger[_0x16c1('0xd')](_0x16c1('0xe'),_0x3a700e,_0x16c1('0xc'),JSON[_0x16c1('0xf')](_0x42fcbf));if(_0x42fcbf[_0x16c1('0x10')]){if(_0x42fcbf[_0x16c1('0x10')][_0x16c1('0x11')]===0x1f4){logger['error'](_0x16c1('0x12'),_0x3a700e,_0x42fcbf[_0x16c1('0x10')][_0x16c1('0x13')]);return _0x3e5034(_0x42fcbf['error'][_0x16c1('0x13')]);}logger[_0x16c1('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3a700e,_0x42fcbf[_0x16c1('0x10')][_0x16c1('0x13')]);return _0x1669ef(_0x42fcbf[_0x16c1('0x10')][_0x16c1('0x13')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3a700e,'request\x20sent');_0x1669ef(_0x42fcbf['result'][_0x16c1('0x13')]);}})[_0x16c1('0x14')](function(_0x26b892){logger[_0x16c1('0x10')](_0x16c1('0x12'),_0x3a700e,_0x26b892);_0x3e5034(_0x26b892);});});}exports[_0x16c1('0x15')]=function(_0x360c2e){var _0x3704b2=this;return new Promise(function(_0x185188,_0x5786a5){return db[_0x16c1('0x16')][_0x16c1('0x17')]({'raw':_0x360c2e[_0x16c1('0x18')]?_0x360c2e['options'][_0x16c1('0x19')]===undefined?!![]:![]:!![],'where':_0x360c2e[_0x16c1('0x18')]?_0x360c2e[_0x16c1('0x18')][_0x16c1('0x1a')]||null:null,'attributes':_0x360c2e[_0x16c1('0x18')]?_0x360c2e[_0x16c1('0x18')][_0x16c1('0x1b')]||null:null,'limit':_0x360c2e['options']?_0x360c2e[_0x16c1('0x18')]['limit']||null:null,'include':_0x360c2e[_0x16c1('0x18')]?_0x360c2e['options'][_0x16c1('0x1c')]?_['map'](_0x360c2e[_0x16c1('0x18')][_0x16c1('0x1c')],function(_0x163148){return{'model':db[_0x163148[_0x16c1('0x1d')]],'as':_0x163148['as'],'attributes':_0x163148[_0x16c1('0x1b')],'include':_0x163148[_0x16c1('0x1c')]?_[_0x16c1('0x1e')](_0x163148['include'],function(_0x3b146a){return{'model':db[_0x3b146a['model']],'as':_0x3b146a['as'],'attributes':_0x3b146a[_0x16c1('0x1b')],'include':_0x3b146a['include']?_[_0x16c1('0x1e')](_0x3b146a['include'],function(_0xe1ce02){return{'model':db[_0xe1ce02[_0x16c1('0x1d')]],'as':_0xe1ce02['as'],'attributes':_0xe1ce02[_0x16c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x16c1('0xa')](function(_0x10cfdd){logger[_0x16c1('0xb')](_0x16c1('0x15'),_0x360c2e);logger['debug'](_0x16c1('0x15'),_0x360c2e,JSON[_0x16c1('0xf')](_0x10cfdd));_0x185188(_0x10cfdd);})[_0x16c1('0x14')](function(_0x2c2541){logger[_0x16c1('0x10')]('GetDeskAccount',_0x2c2541[_0x16c1('0x13')],_0x360c2e);_0x5786a5(_0x3704b2[_0x16c1('0x10')](0x1f4,_0x2c2541['message']));});});};exports[_0x16c1('0x1f')]=function(_0x4c2928){var _0x312925=this;return new Promise(function(_0x2d533b,_0x1e7b01){return db[_0x16c1('0x16')][_0x16c1('0x20')]({'raw':_0x4c2928[_0x16c1('0x18')]?_0x4c2928[_0x16c1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c2928[_0x16c1('0x18')]?_0x4c2928['options']['where']||null:null,'attributes':_0x4c2928['options']?_0x4c2928['options'][_0x16c1('0x1b')]||null:null,'include':_0x4c2928[_0x16c1('0x18')]?_0x4c2928['options'][_0x16c1('0x1c')]?_[_0x16c1('0x1e')](_0x4c2928[_0x16c1('0x18')]['include'],function(_0x48c4bc){return{'model':db[_0x48c4bc['model']],'as':_0x48c4bc['as'],'attributes':_0x48c4bc['attributes'],'include':_0x48c4bc[_0x16c1('0x1c')]?_[_0x16c1('0x1e')](_0x48c4bc[_0x16c1('0x1c')],function(_0x498966){return{'model':db[_0x498966[_0x16c1('0x1d')]],'as':_0x498966['as'],'attributes':_0x498966[_0x16c1('0x1b')],'include':_0x498966[_0x16c1('0x1c')]?_[_0x16c1('0x1e')](_0x498966[_0x16c1('0x1c')],function(_0x5d1aaa){return{'model':db[_0x5d1aaa[_0x16c1('0x1d')]],'as':_0x5d1aaa['as'],'attributes':_0x5d1aaa[_0x16c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x16c1('0xa')](function(_0xbdf97d){logger['info'](_0x16c1('0x1f'),_0x4c2928);logger[_0x16c1('0xd')](_0x16c1('0x1f'),_0x4c2928,JSON[_0x16c1('0xf')](_0xbdf97d));_0x2d533b(_0xbdf97d);})['catch'](function(_0x45a758){logger[_0x16c1('0x10')](_0x16c1('0x1f'),_0x45a758['message'],_0x4c2928);_0x1e7b01(_0x312925['error'](0x1f4,_0x45a758[_0x16c1('0x13')]));});});};
\ No newline at end of file
index 1444722..a352a75 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x324c67,_0x55ad24){var _0x53a261=function(_0x1f3e3a){while(--_0x1f3e3a){_0x324c67['push'](_0x324c67['shift']());}};_0x53a261(++_0x55ad24);}(_0x7217,0x19e));var _0x7721=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7217[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router;
\ No newline at end of file
+var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x59cb2a,_0x579e33){var _0x1ed1a8=function(_0x26c716){while(--_0x26c716){_0x59cb2a['push'](_0x59cb2a['shift']());}};_0x1ed1a8(++_0x579e33);}(_0x008c,0x188));var _0xc008=function(_0x2287df,_0x5a4a24){_0x2287df=_0x2287df-0x0;var _0x2afbc1=_0x008c[_0x2287df];return _0x2afbc1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router;
\ No newline at end of file
index 0a4b74f..beee4d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6e3=['exports','STRING','sequelize'];(function(_0x33113f,_0x54bcb0){var _0x323c90=function(_0x5a28e7){while(--_0x5a28e7){_0x33113f['push'](_0x33113f['shift']());}};_0x323c90(++_0x54bcb0);}(_0xd6e3,0x92));var _0x3d6e=function(_0x40d66a,_0x32110f){_0x40d66a=_0x40d66a-0x0;var _0x818344=_0xd6e3[_0x40d66a];return _0x818344;};'use strict';var Sequelize=require(_0x3d6e('0x0'));module[_0x3d6e('0x1')]={'name':{'type':Sequelize[_0x3d6e('0x2')]},'description':{'type':Sequelize[_0x3d6e('0x2')]}};
\ No newline at end of file
+var _0xd43b=['STRING','sequelize','exports'];(function(_0x494e72,_0x5f1178){var _0x2d3947=function(_0x165f2b){while(--_0x165f2b){_0x494e72['push'](_0x494e72['shift']());}};_0x2d3947(++_0x5f1178);}(_0xd43b,0xaf));var _0xbd43=function(_0x43a48f,_0x6797c6){_0x43a48f=_0x43a48f-0x0;var _0x1bde3c=_0xd43b[_0x43a48f];return _0x1bde3c;};'use strict';var Sequelize=require(_0xbd43('0x0'));module[_0xbd43('0x1')]={'name':{'type':Sequelize[_0xbd43('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 4d94a92..7c0d72f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcc86=['moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','update','end','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','create','body','find','destroy','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','request-promise'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0xcc86,0x1e9));var _0x6cc8=function(_0x79d123,_0x134a34){_0x79d123=_0x79d123-0x0;var _0x12be25=_0xcc86[_0x79d123];return _0x12be25;};'use strict';var emlformat=require(_0x6cc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cc8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cc8('0x2'));var moment=require(_0x6cc8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6cc8('0x4'));var util=require(_0x6cc8('0x5'));var path=require('path');var sox=require(_0x6cc8('0x6'));var csv=require(_0x6cc8('0x7'));var ejs=require(_0x6cc8('0x8'));var fs=require('fs');var fs_extra=require(_0x6cc8('0x9'));var _=require(_0x6cc8('0xa'));var squel=require(_0x6cc8('0xb'));var crypto=require(_0x6cc8('0xc'));var jsforce=require(_0x6cc8('0xd'));var deskjs=require(_0x6cc8('0xe'));var toCsv=require(_0x6cc8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cc8('0xf'));var authService=require(_0x6cc8('0x10'));var qs=require(_0x6cc8('0x11'));var as=require(_0x6cc8('0x12'));var hardwareService=require(_0x6cc8('0x13'));var logger=require(_0x6cc8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6cc8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cc8('0x16'))['db'];function respondWithStatusCode(_0x1b4d08,_0x3c3331){_0x3c3331=_0x3c3331||0xcc;return function(_0x12a5b9){if(_0x12a5b9){return _0x1b4d08[_0x6cc8('0x17')](_0x3c3331);}return _0x1b4d08[_0x6cc8('0x18')](_0x3c3331)['end']();};}function respondWithResult(_0x13abc5,_0x3f56f2){_0x3f56f2=_0x3f56f2||0xc8;return function(_0x26f6e6){if(_0x26f6e6){return _0x13abc5[_0x6cc8('0x18')](_0x3f56f2)[_0x6cc8('0x19')](_0x26f6e6);}};}function respondWithFilteredResult(_0xe1133d,_0x2c09a2){return function(_0x41181a){if(_0x41181a){var _0x254358=typeof _0x2c09a2[_0x6cc8('0x1a')]==='undefined'&&typeof _0x2c09a2['limit']==='undefined';var _0x409abb=_0x41181a[_0x6cc8('0x1b')];var _0x2f30fb=_0x254358?0x0:_0x2c09a2[_0x6cc8('0x1a')];var _0x4d91c7=_0x254358?_0x41181a[_0x6cc8('0x1b')]:_0x2c09a2['offset']+_0x2c09a2[_0x6cc8('0x1c')];var _0x3407ba;if(_0x4d91c7>=_0x409abb){_0x4d91c7=_0x409abb;_0x3407ba=0xc8;}else{_0x3407ba=0xce;}_0xe1133d['status'](_0x3407ba);return _0xe1133d[_0x6cc8('0x1d')](_0x6cc8('0x1e'),_0x2f30fb+'-'+_0x4d91c7+'/'+_0x409abb)[_0x6cc8('0x19')](_0x41181a);}return null;};}function patchUpdates(_0x2a1295){return function(_0xd6683){try{jsonpatch[_0x6cc8('0x1f')](_0xd6683,_0x2a1295,!![]);}catch(_0x188da0){return BPromise[_0x6cc8('0x20')](_0x188da0);}return _0xd6683['save']();};}function saveUpdates(_0x4c4ac8,_0x316666){return function(_0x40042c){if(_0x40042c){return _0x40042c[_0x6cc8('0x21')](_0x4c4ac8)['then'](function(_0x8667bc){return _0x8667bc;});}return null;};}function removeEntity(_0x4500bc,_0x3627c0){return function(_0x1f2f4e){if(_0x1f2f4e){return _0x1f2f4e['destroy']()['then'](function(){_0x4500bc[_0x6cc8('0x18')](0xcc)[_0x6cc8('0x22')]();});}};}function handleEntityNotFound(_0x60c149,_0x4ee319){return function(_0x4c0a2e){if(!_0x4c0a2e){_0x60c149[_0x6cc8('0x17')](0x194);}return _0x4c0a2e;};}function handleError(_0x2ce829,_0x465e4b){_0x465e4b=_0x465e4b||0x1f4;return function(_0xcab10c){logger[_0x6cc8('0x23')](_0xcab10c[_0x6cc8('0x24')]);if(_0xcab10c[_0x6cc8('0x25')]){delete _0xcab10c['name'];}_0x2ce829[_0x6cc8('0x18')](_0x465e4b)[_0x6cc8('0x26')](_0xcab10c);};}exports[_0x6cc8('0x27')]=function(_0x544c1f,_0x3e341e){var _0x3ab45a={},_0x3d6cae={},_0x39f581={'count':0x0,'rows':[]};var _0x51cb15=_[_0x6cc8('0x28')](db[_0x6cc8('0x29')][_0x6cc8('0x2a')],function(_0x321894){return{'name':_0x321894['fieldName'],'type':_0x321894['type'][_0x6cc8('0x2b')]};});_0x3d6cae[_0x6cc8('0x2c')]=_[_0x6cc8('0x28')](_0x51cb15,'name');_0x3d6cae[_0x6cc8('0x2d')]=_[_0x6cc8('0x2e')](_0x544c1f[_0x6cc8('0x2d')]);_0x3d6cae[_0x6cc8('0x2f')]=_[_0x6cc8('0x30')](_0x3d6cae[_0x6cc8('0x2c')],_0x3d6cae[_0x6cc8('0x2d')]);_0x3ab45a['attributes']=_[_0x6cc8('0x30')](_0x3d6cae[_0x6cc8('0x2c')],qs[_0x6cc8('0x31')](_0x544c1f[_0x6cc8('0x2d')][_0x6cc8('0x31')]));_0x3ab45a['attributes']=_0x3ab45a[_0x6cc8('0x32')][_0x6cc8('0x33')]?_0x3ab45a[_0x6cc8('0x32')]:_0x3d6cae[_0x6cc8('0x2c')];if(!_0x544c1f[_0x6cc8('0x2d')][_0x6cc8('0x34')](_0x6cc8('0x35'))){_0x3ab45a[_0x6cc8('0x1c')]=qs[_0x6cc8('0x1c')](_0x544c1f[_0x6cc8('0x2d')]['limit']);_0x3ab45a[_0x6cc8('0x1a')]=qs['offset'](_0x544c1f['query']['offset']);}_0x3ab45a[_0x6cc8('0x36')]=qs['sort'](_0x544c1f[_0x6cc8('0x2d')][_0x6cc8('0x37')]);_0x3ab45a[_0x6cc8('0x38')]=qs['filters'](_[_0x6cc8('0x39')](_0x544c1f[_0x6cc8('0x2d')],_0x3d6cae[_0x6cc8('0x2f')]),_0x51cb15);if(_0x544c1f[_0x6cc8('0x2d')]['filter']){_0x3ab45a[_0x6cc8('0x38')]=_['merge'](_0x3ab45a['where'],{'$or':_[_0x6cc8('0x28')](_0x51cb15,function(_0x35216f){if(_0x35216f[_0x6cc8('0x3a')]!=='VIRTUAL'){var _0x1fb113={};_0x1fb113[_0x35216f[_0x6cc8('0x25')]]={'$like':'%'+_0x544c1f[_0x6cc8('0x2d')][_0x6cc8('0x3b')]+'%'};return _0x1fb113;}})});}_0x3ab45a=_[_0x6cc8('0x3c')]({},_0x3ab45a,_0x544c1f[_0x6cc8('0x3d')]);var _0x54085a={'where':_0x3ab45a[_0x6cc8('0x38')]};return db['DeskConfiguration'][_0x6cc8('0x1b')](_0x54085a)['then'](function(_0x203043){_0x39f581[_0x6cc8('0x1b')]=_0x203043;if(_0x544c1f['query'][_0x6cc8('0x3e')]){_0x3ab45a[_0x6cc8('0x3f')]=[{'all':!![]}];}return db[_0x6cc8('0x29')][_0x6cc8('0x40')](_0x3ab45a);})[_0x6cc8('0x41')](function(_0x319c0e){_0x39f581[_0x6cc8('0x42')]=_0x319c0e;return _0x39f581;})[_0x6cc8('0x41')](respondWithFilteredResult(_0x3e341e,_0x3ab45a))[_0x6cc8('0x43')](handleError(_0x3e341e,null));};exports[_0x6cc8('0x44')]=function(_0x5ab545,_0x5b8082){var _0x121f9e={'raw':![],'where':{'id':_0x5ab545[_0x6cc8('0x45')]['id']}},_0x20c10c={};_0x20c10c[_0x6cc8('0x2c')]=_['keys'](db[_0x6cc8('0x29')][_0x6cc8('0x2a')]);_0x20c10c[_0x6cc8('0x2d')]=_[_0x6cc8('0x2e')](_0x5ab545[_0x6cc8('0x2d')]);_0x20c10c[_0x6cc8('0x2f')]=_['intersection'](_0x20c10c['model'],_0x20c10c[_0x6cc8('0x2d')]);_0x121f9e[_0x6cc8('0x32')]=_['intersection'](_0x20c10c['model'],qs['fields'](_0x5ab545['query'][_0x6cc8('0x31')]));_0x121f9e['attributes']=_0x121f9e[_0x6cc8('0x32')][_0x6cc8('0x33')]?_0x121f9e[_0x6cc8('0x32')]:_0x20c10c['model'];if(_0x5ab545['query'][_0x6cc8('0x3e')]){_0x121f9e['include']=[{'all':!![]}];}_0x121f9e=_[_0x6cc8('0x3c')]({},_0x121f9e,_0x5ab545[_0x6cc8('0x3d')]);return db['DeskConfiguration']['find'](_0x121f9e)[_0x6cc8('0x41')](handleEntityNotFound(_0x5b8082,null))['then'](respondWithResult(_0x5b8082,null))[_0x6cc8('0x43')](handleError(_0x5b8082,null));};exports[_0x6cc8('0x46')]=function(_0x5abbcc,_0xcebab){return db[_0x6cc8('0x29')][_0x6cc8('0x46')](_0x5abbcc[_0x6cc8('0x47')],{})[_0x6cc8('0x41')](respondWithResult(_0xcebab,0xc9))[_0x6cc8('0x43')](handleError(_0xcebab,null));};exports['update']=function(_0x455d06,_0x2c9e84){if(_0x455d06[_0x6cc8('0x47')]['id']){delete _0x455d06[_0x6cc8('0x47')]['id'];}return db[_0x6cc8('0x29')][_0x6cc8('0x48')]({'where':{'id':_0x455d06['params']['id']}})[_0x6cc8('0x41')](handleEntityNotFound(_0x2c9e84,null))[_0x6cc8('0x41')](saveUpdates(_0x455d06[_0x6cc8('0x47')],null))['then'](respondWithResult(_0x2c9e84,null))[_0x6cc8('0x43')](handleError(_0x2c9e84,null));};exports[_0x6cc8('0x49')]=function(_0x3e2c25,_0x1896e3){return db[_0x6cc8('0x29')]['find']({'where':{'id':_0x3e2c25[_0x6cc8('0x45')]['id']}})[_0x6cc8('0x41')](handleEntityNotFound(_0x1896e3,null))['then'](removeEntity(_0x1896e3,null))[_0x6cc8('0x43')](handleError(_0x1896e3,null));};exports[_0x6cc8('0x4a')]=function(_0x323cf3,_0x198109,_0x16e7b1){var _0xbd88c={};var _0x1191ad={};var _0x3f84ea;var _0x2adf21;return db[_0x6cc8('0x29')]['findOne']({'where':{'id':_0x323cf3[_0x6cc8('0x45')]['id']}})['then'](handleEntityNotFound(_0x198109,null))[_0x6cc8('0x41')](function(_0x21174d){if(_0x21174d){_0x3f84ea=_0x21174d;_0x1191ad[_0x6cc8('0x2c')]=_[_0x6cc8('0x2e')](db[_0x6cc8('0x4b')][_0x6cc8('0x2a')]);_0x1191ad[_0x6cc8('0x2d')]=_[_0x6cc8('0x2e')](_0x323cf3['query']);_0x1191ad[_0x6cc8('0x2f')]=_[_0x6cc8('0x30')](_0x1191ad[_0x6cc8('0x2c')],_0x1191ad['query']);_0xbd88c[_0x6cc8('0x32')]=_[_0x6cc8('0x30')](_0x1191ad[_0x6cc8('0x2c')],qs[_0x6cc8('0x31')](_0x323cf3['query'][_0x6cc8('0x31')]));_0xbd88c[_0x6cc8('0x32')]=_0xbd88c['attributes']['length']?_0xbd88c[_0x6cc8('0x32')]:_0x1191ad[_0x6cc8('0x2c')];_0xbd88c['order']=qs[_0x6cc8('0x37')](_0x323cf3[_0x6cc8('0x2d')][_0x6cc8('0x37')]);_0xbd88c[_0x6cc8('0x38')]=qs[_0x6cc8('0x2f')](_['pick'](_0x323cf3[_0x6cc8('0x2d')],_0x1191ad[_0x6cc8('0x2f')]));if(_0x323cf3[_0x6cc8('0x2d')]['filter']){_0xbd88c[_0x6cc8('0x38')]=_['merge'](_0xbd88c[_0x6cc8('0x38')],{'$or':_[_0x6cc8('0x28')](_0xbd88c['attributes'],function(_0x175cc6){var _0x4ee16a={};_0x4ee16a[_0x175cc6]={'$like':'%'+_0x323cf3['query'][_0x6cc8('0x3b')]+'%'};return _0x4ee16a;})});}_0xbd88c=_[_0x6cc8('0x3c')]({},_0xbd88c,_0x323cf3['options']);return _0x3f84ea['getFields'](_0xbd88c);}})['then'](function(_0x3a36af){if(_0x3a36af){_0x2adf21=_0x3a36af[_0x6cc8('0x33')];if(!_0x323cf3[_0x6cc8('0x2d')][_0x6cc8('0x34')](_0x6cc8('0x35'))){_0xbd88c['limit']=qs[_0x6cc8('0x1c')](_0x323cf3[_0x6cc8('0x2d')]['limit']);_0xbd88c[_0x6cc8('0x1a')]=qs[_0x6cc8('0x1a')](_0x323cf3['query'][_0x6cc8('0x1a')]);}return _0x3f84ea[_0x6cc8('0x4a')](_0xbd88c);}})['then'](function(_0x525e52){if(_0x525e52){return _0x525e52?{'count':_0x2adf21,'rows':_0x525e52}:null;}})['then'](respondWithResult(_0x198109,null))[_0x6cc8('0x43')](handleError(_0x198109,null));};exports[_0x6cc8('0x4c')]=function(_0x501a8a,_0x57a0be,_0x1ecf4b){var _0x308c06={};var _0x5871d9={};var _0x53d6d7;var _0x2a53e9;return db[_0x6cc8('0x29')][_0x6cc8('0x4d')]({'where':{'id':_0x501a8a[_0x6cc8('0x45')]['id']}})[_0x6cc8('0x41')](handleEntityNotFound(_0x57a0be,null))[_0x6cc8('0x41')](function(_0x5ea121){if(_0x5ea121){_0x53d6d7=_0x5ea121;_0x5871d9[_0x6cc8('0x2c')]=_[_0x6cc8('0x2e')](db['DeskField'][_0x6cc8('0x2a')]);_0x5871d9[_0x6cc8('0x2d')]=_[_0x6cc8('0x2e')](_0x501a8a[_0x6cc8('0x2d')]);_0x5871d9[_0x6cc8('0x2f')]=_['intersection'](_0x5871d9['model'],_0x5871d9[_0x6cc8('0x2d')]);_0x308c06[_0x6cc8('0x32')]=_[_0x6cc8('0x30')](_0x5871d9['model'],qs[_0x6cc8('0x31')](_0x501a8a[_0x6cc8('0x2d')][_0x6cc8('0x31')]));_0x308c06[_0x6cc8('0x32')]=_0x308c06[_0x6cc8('0x32')][_0x6cc8('0x33')]?_0x308c06[_0x6cc8('0x32')]:_0x5871d9['model'];_0x308c06[_0x6cc8('0x36')]=qs[_0x6cc8('0x37')](_0x501a8a['query'][_0x6cc8('0x37')]);_0x308c06[_0x6cc8('0x38')]=qs['filters'](_[_0x6cc8('0x39')](_0x501a8a['query'],_0x5871d9[_0x6cc8('0x2f')]));if(_0x501a8a[_0x6cc8('0x2d')][_0x6cc8('0x3b')]){_0x308c06[_0x6cc8('0x38')]=_['merge'](_0x308c06['where'],{'$or':_['map'](_0x308c06[_0x6cc8('0x32')],function(_0x238581){var _0x34a6e3={};_0x34a6e3[_0x238581]={'$like':'%'+_0x501a8a[_0x6cc8('0x2d')][_0x6cc8('0x3b')]+'%'};return _0x34a6e3;})});}_0x308c06=_[_0x6cc8('0x3c')]({},_0x308c06,_0x501a8a['options']);return _0x53d6d7[_0x6cc8('0x4c')](_0x308c06);}})[_0x6cc8('0x41')](function(_0x242f79){if(_0x242f79){_0x2a53e9=_0x242f79[_0x6cc8('0x33')];if(!_0x501a8a['query'][_0x6cc8('0x34')]('nolimit')){_0x308c06['limit']=qs[_0x6cc8('0x1c')](_0x501a8a[_0x6cc8('0x2d')][_0x6cc8('0x1c')]);_0x308c06[_0x6cc8('0x1a')]=qs[_0x6cc8('0x1a')](_0x501a8a[_0x6cc8('0x2d')][_0x6cc8('0x1a')]);}return _0x53d6d7[_0x6cc8('0x4c')](_0x308c06);}})[_0x6cc8('0x41')](function(_0x3ca669){if(_0x3ca669){return _0x3ca669?{'count':_0x2a53e9,'rows':_0x3ca669}:null;}})[_0x6cc8('0x41')](respondWithResult(_0x57a0be,null))[_0x6cc8('0x43')](handleError(_0x57a0be,null));};exports[_0x6cc8('0x4e')]=function(_0x1bc979,_0x271651,_0x4b7bff){var _0x5e1d8a={};var _0x2d6acd={};var _0x3603cd;var _0x4b8204;return db[_0x6cc8('0x29')][_0x6cc8('0x4d')]({'where':{'id':_0x1bc979[_0x6cc8('0x45')]['id']}})[_0x6cc8('0x41')](handleEntityNotFound(_0x271651,null))[_0x6cc8('0x41')](function(_0x2b28b5){if(_0x2b28b5){_0x3603cd=_0x2b28b5;_0x2d6acd[_0x6cc8('0x2c')]=_[_0x6cc8('0x2e')](db[_0x6cc8('0x4b')]['rawAttributes']);_0x2d6acd['query']=_[_0x6cc8('0x2e')](_0x1bc979[_0x6cc8('0x2d')]);_0x2d6acd[_0x6cc8('0x2f')]=_[_0x6cc8('0x30')](_0x2d6acd[_0x6cc8('0x2c')],_0x2d6acd[_0x6cc8('0x2d')]);_0x5e1d8a[_0x6cc8('0x32')]=_[_0x6cc8('0x30')](_0x2d6acd['model'],qs[_0x6cc8('0x31')](_0x1bc979['query'][_0x6cc8('0x31')]));_0x5e1d8a[_0x6cc8('0x32')]=_0x5e1d8a[_0x6cc8('0x32')][_0x6cc8('0x33')]?_0x5e1d8a[_0x6cc8('0x32')]:_0x2d6acd[_0x6cc8('0x2c')];_0x5e1d8a[_0x6cc8('0x36')]=qs['sort'](_0x1bc979['query']['sort']);_0x5e1d8a['where']=qs[_0x6cc8('0x2f')](_['pick'](_0x1bc979[_0x6cc8('0x2d')],_0x2d6acd[_0x6cc8('0x2f')]));if(_0x1bc979['query'][_0x6cc8('0x3b')]){_0x5e1d8a[_0x6cc8('0x38')]=_['merge'](_0x5e1d8a[_0x6cc8('0x38')],{'$or':_[_0x6cc8('0x28')](_0x5e1d8a[_0x6cc8('0x32')],function(_0xc959f9){var _0x471ec1={};_0x471ec1[_0xc959f9]={'$like':'%'+_0x1bc979[_0x6cc8('0x2d')]['filter']+'%'};return _0x471ec1;})});}_0x5e1d8a=_[_0x6cc8('0x3c')]({},_0x5e1d8a,_0x1bc979['options']);return _0x3603cd[_0x6cc8('0x4e')](_0x5e1d8a);}})['then'](function(_0x568bdb){if(_0x568bdb){_0x4b8204=_0x568bdb[_0x6cc8('0x33')];if(!_0x1bc979['query'][_0x6cc8('0x34')](_0x6cc8('0x35'))){_0x5e1d8a[_0x6cc8('0x1c')]=qs[_0x6cc8('0x1c')](_0x1bc979[_0x6cc8('0x2d')][_0x6cc8('0x1c')]);_0x5e1d8a['offset']=qs['offset'](_0x1bc979[_0x6cc8('0x2d')][_0x6cc8('0x1a')]);}return _0x3603cd[_0x6cc8('0x4e')](_0x5e1d8a);}})['then'](function(_0x426a6e){if(_0x426a6e){return _0x426a6e?{'count':_0x4b8204,'rows':_0x426a6e}:null;}})[_0x6cc8('0x41')](respondWithResult(_0x271651,null))[_0x6cc8('0x43')](handleError(_0x271651,null));};exports[_0x6cc8('0x4f')]=function(_0x3586c8,_0x518489,_0x3c0eee){var _0x4511d2={};var _0x28ccc3={};var _0x480a23;var _0x349e78;return db[_0x6cc8('0x29')][_0x6cc8('0x4d')]({'where':{'id':_0x3586c8[_0x6cc8('0x45')]['id']}})[_0x6cc8('0x41')](handleEntityNotFound(_0x518489,null))[_0x6cc8('0x41')](function(_0x1fd826){if(_0x1fd826){_0x480a23=_0x1fd826;_0x28ccc3['model']=_[_0x6cc8('0x2e')](db['Tag'][_0x6cc8('0x2a')]);_0x28ccc3[_0x6cc8('0x2d')]=_['keys'](_0x3586c8['query']);_0x28ccc3[_0x6cc8('0x2f')]=_['intersection'](_0x28ccc3[_0x6cc8('0x2c')],_0x28ccc3['query']);_0x4511d2['attributes']=_[_0x6cc8('0x30')](_0x28ccc3[_0x6cc8('0x2c')],qs[_0x6cc8('0x31')](_0x3586c8[_0x6cc8('0x2d')][_0x6cc8('0x31')]));_0x4511d2[_0x6cc8('0x32')]=_0x4511d2['attributes'][_0x6cc8('0x33')]?_0x4511d2[_0x6cc8('0x32')]:_0x28ccc3[_0x6cc8('0x2c')];_0x4511d2[_0x6cc8('0x36')]=qs[_0x6cc8('0x37')](_0x3586c8[_0x6cc8('0x2d')][_0x6cc8('0x37')]);_0x4511d2['where']=qs[_0x6cc8('0x2f')](_[_0x6cc8('0x39')](_0x3586c8[_0x6cc8('0x2d')],_0x28ccc3[_0x6cc8('0x2f')]));if(_0x3586c8['query']['filter']){_0x4511d2[_0x6cc8('0x38')]=_[_0x6cc8('0x3c')](_0x4511d2['where'],{'$or':_[_0x6cc8('0x28')](_0x4511d2[_0x6cc8('0x32')],function(_0x1d134a){var _0x32f4d7={};_0x32f4d7[_0x1d134a]={'$like':'%'+_0x3586c8[_0x6cc8('0x2d')]['filter']+'%'};return _0x32f4d7;})});}_0x4511d2=_[_0x6cc8('0x3c')]({},_0x4511d2,_0x3586c8[_0x6cc8('0x3d')]);return _0x480a23[_0x6cc8('0x4f')](_0x4511d2);}})[_0x6cc8('0x41')](function(_0x2b5988){if(_0x2b5988){_0x349e78=_0x2b5988['length'];if(!_0x3586c8[_0x6cc8('0x2d')][_0x6cc8('0x34')](_0x6cc8('0x35'))){_0x4511d2[_0x6cc8('0x1c')]=qs['limit'](_0x3586c8['query']['limit']);_0x4511d2[_0x6cc8('0x1a')]=qs['offset'](_0x3586c8['query']['offset']);}return _0x480a23['getTags'](_0x4511d2);}})[_0x6cc8('0x41')](function(_0x3e540a){if(_0x3e540a){return _0x3e540a?{'count':_0x349e78,'rows':_0x3e540a}:null;}})[_0x6cc8('0x41')](respondWithResult(_0x518489,null))[_0x6cc8('0x43')](handleError(_0x518489,null));};exports[_0x6cc8('0x50')]=function(_0x505083,_0x306061,_0x33c15b){if(_0x505083[_0x6cc8('0x47')]['id']){delete _0x505083[_0x6cc8('0x47')]['id'];}return db['DeskConfiguration'][_0x6cc8('0x4d')]({'where':{'id':_0x505083[_0x6cc8('0x45')]['id']}})[_0x6cc8('0x41')](handleEntityNotFound(_0x306061,null))[_0x6cc8('0x41')](function(_0x15659c){if(_0x15659c){return _0x15659c[_0x6cc8('0x50')](_0x505083[_0x6cc8('0x47')][_0x6cc8('0x51')]||[]);}return null;})['then'](respondWithResult(_0x306061,null))[_0x6cc8('0x43')](handleError(_0x306061,null));};
\ No newline at end of file
+var _0x0402=['apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','model','query','keys','filters','attributes','intersection','length','limit','order','sort','pick','filter','where','merge','VIRTUAL','DeskConfiguration','includeAll','include','catch','show','fields','options','find','create','body','getFields','findOne','params','DeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0402,0x179));var _0x2040=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x0402[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2040('0x0'));var zipdir=require(_0x2040('0x1'));var jsonpatch=require(_0x2040('0x2'));var rp=require(_0x2040('0x3'));var moment=require('moment');var BPromise=require(_0x2040('0x4'));var Mustache=require(_0x2040('0x5'));var util=require(_0x2040('0x6'));var path=require('path');var sox=require(_0x2040('0x7'));var csv=require(_0x2040('0x8'));var ejs=require(_0x2040('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2040('0xa'));var squel=require(_0x2040('0xb'));var crypto=require(_0x2040('0xc'));var jsforce=require(_0x2040('0xd'));var deskjs=require(_0x2040('0xe'));var toCsv=require(_0x2040('0x8'));var querystring=require('querystring');var Papa=require(_0x2040('0xf'));var Redis=require('ioredis');var authService=require(_0x2040('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2040('0x11'));var hardwareService=require(_0x2040('0x12'));var logger=require(_0x2040('0x13'))(_0x2040('0x14'));var utils=require('../../config/utils');var config=require(_0x2040('0x15'));var licenseUtil=require(_0x2040('0x16'));var db=require(_0x2040('0x17'))['db'];function respondWithStatusCode(_0x3c6beb,_0x552c3e){_0x552c3e=_0x552c3e||0xcc;return function(_0x5c7d4e){if(_0x5c7d4e){return _0x3c6beb[_0x2040('0x18')](_0x552c3e);}return _0x3c6beb['status'](_0x552c3e)[_0x2040('0x19')]();};}function respondWithResult(_0x4ed46f,_0xd9d225){_0xd9d225=_0xd9d225||0xc8;return function(_0x112f1b){if(_0x112f1b){return _0x4ed46f[_0x2040('0x1a')](_0xd9d225)[_0x2040('0x1b')](_0x112f1b);}};}function respondWithFilteredResult(_0x49b904,_0x19a1d2){return function(_0xabfaec){if(_0xabfaec){var _0x4781b4=typeof _0x19a1d2[_0x2040('0x1c')]===_0x2040('0x1d')&&typeof _0x19a1d2['limit']==='undefined';var _0x1df885=_0xabfaec[_0x2040('0x1e')];var _0x1e2068=_0x4781b4?0x0:_0x19a1d2[_0x2040('0x1c')];var _0x40d8ea=_0x4781b4?_0xabfaec['count']:_0x19a1d2[_0x2040('0x1c')]+_0x19a1d2['limit'];var _0x2ec595;if(_0x40d8ea>=_0x1df885){_0x40d8ea=_0x1df885;_0x2ec595=0xc8;}else{_0x2ec595=0xce;}_0x49b904[_0x2040('0x1a')](_0x2ec595);return _0x49b904[_0x2040('0x1f')](_0x2040('0x20'),_0x1e2068+'-'+_0x40d8ea+'/'+_0x1df885)[_0x2040('0x1b')](_0xabfaec);}return null;};}function patchUpdates(_0x72b36d){return function(_0x4854d1){try{jsonpatch[_0x2040('0x21')](_0x4854d1,_0x72b36d,!![]);}catch(_0x2bb40e){return BPromise[_0x2040('0x22')](_0x2bb40e);}return _0x4854d1[_0x2040('0x23')]();};}function saveUpdates(_0x3607ac,_0x8189e3){return function(_0x5de057){if(_0x5de057){return _0x5de057[_0x2040('0x24')](_0x3607ac)[_0x2040('0x25')](function(_0x20114c){return _0x20114c;});}return null;};}function removeEntity(_0x1f5532,_0x4e9ab4){return function(_0x1dcdb3){if(_0x1dcdb3){return _0x1dcdb3[_0x2040('0x26')]()[_0x2040('0x25')](function(){_0x1f5532[_0x2040('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338c36,_0x49b7e4){return function(_0x29ed68){if(!_0x29ed68){_0x338c36['sendStatus'](0x194);}return _0x29ed68;};}function handleError(_0x4b20d3,_0x2bd0c9){_0x2bd0c9=_0x2bd0c9||0x1f4;return function(_0x3d5857){logger[_0x2040('0x27')](_0x3d5857['stack']);if(_0x3d5857[_0x2040('0x28')]){delete _0x3d5857[_0x2040('0x28')];}_0x4b20d3[_0x2040('0x1a')](_0x2bd0c9)[_0x2040('0x29')](_0x3d5857);};}exports[_0x2040('0x2a')]=function(_0x513385,_0x7e9b3b){var _0x3bf5db={},_0x38872e={},_0x221997={'count':0x0,'rows':[]};var _0x3486a3=_[_0x2040('0x2b')](db['DeskConfiguration'][_0x2040('0x2c')],function(_0x717d04){return{'name':_0x717d04['fieldName'],'type':_0x717d04['type']['key']};});_0x38872e[_0x2040('0x2d')]=_[_0x2040('0x2b')](_0x3486a3,'name');_0x38872e[_0x2040('0x2e')]=_[_0x2040('0x2f')](_0x513385[_0x2040('0x2e')]);_0x38872e[_0x2040('0x30')]=_['intersection'](_0x38872e[_0x2040('0x2d')],_0x38872e['query']);_0x3bf5db[_0x2040('0x31')]=_[_0x2040('0x32')](_0x38872e['model'],qs['fields'](_0x513385[_0x2040('0x2e')]['fields']));_0x3bf5db[_0x2040('0x31')]=_0x3bf5db[_0x2040('0x31')][_0x2040('0x33')]?_0x3bf5db[_0x2040('0x31')]:_0x38872e[_0x2040('0x2d')];if(!_0x513385[_0x2040('0x2e')]['hasOwnProperty']('nolimit')){_0x3bf5db[_0x2040('0x34')]=qs[_0x2040('0x34')](_0x513385[_0x2040('0x2e')][_0x2040('0x34')]);_0x3bf5db[_0x2040('0x1c')]=qs[_0x2040('0x1c')](_0x513385[_0x2040('0x2e')][_0x2040('0x1c')]);}_0x3bf5db[_0x2040('0x35')]=qs[_0x2040('0x36')](_0x513385[_0x2040('0x2e')][_0x2040('0x36')]);_0x3bf5db['where']=qs[_0x2040('0x30')](_[_0x2040('0x37')](_0x513385['query'],_0x38872e['filters']),_0x3486a3);if(_0x513385[_0x2040('0x2e')][_0x2040('0x38')]){_0x3bf5db[_0x2040('0x39')]=_[_0x2040('0x3a')](_0x3bf5db[_0x2040('0x39')],{'$or':_[_0x2040('0x2b')](_0x3486a3,function(_0x10221b){if(_0x10221b['type']!==_0x2040('0x3b')){var _0x515490={};_0x515490[_0x10221b['name']]={'$like':'%'+_0x513385['query'][_0x2040('0x38')]+'%'};return _0x515490;}})});}_0x3bf5db=_[_0x2040('0x3a')]({},_0x3bf5db,_0x513385['options']);var _0x3fa292={'where':_0x3bf5db[_0x2040('0x39')]};return db[_0x2040('0x3c')][_0x2040('0x1e')](_0x3fa292)['then'](function(_0x2ce6c9){_0x221997[_0x2040('0x1e')]=_0x2ce6c9;if(_0x513385[_0x2040('0x2e')][_0x2040('0x3d')]){_0x3bf5db[_0x2040('0x3e')]=[{'all':!![]}];}return db[_0x2040('0x3c')]['findAll'](_0x3bf5db);})[_0x2040('0x25')](function(_0x589418){_0x221997['rows']=_0x589418;return _0x221997;})[_0x2040('0x25')](respondWithFilteredResult(_0x7e9b3b,_0x3bf5db))[_0x2040('0x3f')](handleError(_0x7e9b3b,null));};exports[_0x2040('0x40')]=function(_0x4b97c3,_0x4cf008){var _0x42abff={'raw':![],'where':{'id':_0x4b97c3['params']['id']}},_0x579c47={};_0x579c47['model']=_[_0x2040('0x2f')](db[_0x2040('0x3c')]['rawAttributes']);_0x579c47[_0x2040('0x2e')]=_[_0x2040('0x2f')](_0x4b97c3['query']);_0x579c47[_0x2040('0x30')]=_[_0x2040('0x32')](_0x579c47[_0x2040('0x2d')],_0x579c47[_0x2040('0x2e')]);_0x42abff[_0x2040('0x31')]=_['intersection'](_0x579c47[_0x2040('0x2d')],qs[_0x2040('0x41')](_0x4b97c3[_0x2040('0x2e')]['fields']));_0x42abff[_0x2040('0x31')]=_0x42abff[_0x2040('0x31')][_0x2040('0x33')]?_0x42abff[_0x2040('0x31')]:_0x579c47[_0x2040('0x2d')];if(_0x4b97c3[_0x2040('0x2e')][_0x2040('0x3d')]){_0x42abff[_0x2040('0x3e')]=[{'all':!![]}];}_0x42abff=_['merge']({},_0x42abff,_0x4b97c3[_0x2040('0x42')]);return db[_0x2040('0x3c')][_0x2040('0x43')](_0x42abff)[_0x2040('0x25')](handleEntityNotFound(_0x4cf008,null))[_0x2040('0x25')](respondWithResult(_0x4cf008,null))[_0x2040('0x3f')](handleError(_0x4cf008,null));};exports[_0x2040('0x44')]=function(_0x2d4018,_0x51dead){return db[_0x2040('0x3c')]['create'](_0x2d4018[_0x2040('0x45')],{})[_0x2040('0x25')](respondWithResult(_0x51dead,0xc9))[_0x2040('0x3f')](handleError(_0x51dead,null));};exports[_0x2040('0x24')]=function(_0x1368d0,_0x163023){if(_0x1368d0[_0x2040('0x45')]['id']){delete _0x1368d0[_0x2040('0x45')]['id'];}return db[_0x2040('0x3c')]['find']({'where':{'id':_0x1368d0['params']['id']}})['then'](handleEntityNotFound(_0x163023,null))[_0x2040('0x25')](saveUpdates(_0x1368d0[_0x2040('0x45')],null))[_0x2040('0x25')](respondWithResult(_0x163023,null))[_0x2040('0x3f')](handleError(_0x163023,null));};exports['destroy']=function(_0xb2f184,_0x451169){return db[_0x2040('0x3c')][_0x2040('0x43')]({'where':{'id':_0xb2f184['params']['id']}})['then'](handleEntityNotFound(_0x451169,null))[_0x2040('0x25')](removeEntity(_0x451169,null))['catch'](handleError(_0x451169,null));};exports[_0x2040('0x46')]=function(_0x305a62,_0x4aef7a,_0x36dfa0){var _0x1cf7ec={};var _0x5386d7={};var _0x181fce;var _0x2b6a3f;return db['DeskConfiguration'][_0x2040('0x47')]({'where':{'id':_0x305a62[_0x2040('0x48')]['id']}})[_0x2040('0x25')](handleEntityNotFound(_0x4aef7a,null))[_0x2040('0x25')](function(_0x21dc84){if(_0x21dc84){_0x181fce=_0x21dc84;_0x5386d7[_0x2040('0x2d')]=_[_0x2040('0x2f')](db[_0x2040('0x49')]['rawAttributes']);_0x5386d7[_0x2040('0x2e')]=_[_0x2040('0x2f')](_0x305a62[_0x2040('0x2e')]);_0x5386d7['filters']=_['intersection'](_0x5386d7[_0x2040('0x2d')],_0x5386d7[_0x2040('0x2e')]);_0x1cf7ec[_0x2040('0x31')]=_['intersection'](_0x5386d7[_0x2040('0x2d')],qs[_0x2040('0x41')](_0x305a62[_0x2040('0x2e')][_0x2040('0x41')]));_0x1cf7ec[_0x2040('0x31')]=_0x1cf7ec['attributes'][_0x2040('0x33')]?_0x1cf7ec['attributes']:_0x5386d7[_0x2040('0x2d')];_0x1cf7ec[_0x2040('0x35')]=qs[_0x2040('0x36')](_0x305a62['query'][_0x2040('0x36')]);_0x1cf7ec[_0x2040('0x39')]=qs[_0x2040('0x30')](_['pick'](_0x305a62[_0x2040('0x2e')],_0x5386d7['filters']));if(_0x305a62[_0x2040('0x2e')][_0x2040('0x38')]){_0x1cf7ec[_0x2040('0x39')]=_[_0x2040('0x3a')](_0x1cf7ec[_0x2040('0x39')],{'$or':_[_0x2040('0x2b')](_0x1cf7ec['attributes'],function(_0x5724ff){var _0x1ce105={};_0x1ce105[_0x5724ff]={'$like':'%'+_0x305a62[_0x2040('0x2e')]['filter']+'%'};return _0x1ce105;})});}_0x1cf7ec=_[_0x2040('0x3a')]({},_0x1cf7ec,_0x305a62['options']);return _0x181fce['getFields'](_0x1cf7ec);}})[_0x2040('0x25')](function(_0x199c8e){if(_0x199c8e){_0x2b6a3f=_0x199c8e[_0x2040('0x33')];if(!_0x305a62[_0x2040('0x2e')][_0x2040('0x4a')](_0x2040('0x4b'))){_0x1cf7ec[_0x2040('0x34')]=qs[_0x2040('0x34')](_0x305a62[_0x2040('0x2e')][_0x2040('0x34')]);_0x1cf7ec[_0x2040('0x1c')]=qs[_0x2040('0x1c')](_0x305a62[_0x2040('0x2e')]['offset']);}return _0x181fce[_0x2040('0x46')](_0x1cf7ec);}})[_0x2040('0x25')](function(_0x48394d){if(_0x48394d){return _0x48394d?{'count':_0x2b6a3f,'rows':_0x48394d}:null;}})[_0x2040('0x25')](respondWithResult(_0x4aef7a,null))[_0x2040('0x3f')](handleError(_0x4aef7a,null));};exports[_0x2040('0x4c')]=function(_0x511fa4,_0x45abed,_0x2af3da){var _0x263a6f={};var _0x93245d={};var _0x4e9c09;var _0x10f4db;return db[_0x2040('0x3c')][_0x2040('0x47')]({'where':{'id':_0x511fa4['params']['id']}})[_0x2040('0x25')](handleEntityNotFound(_0x45abed,null))[_0x2040('0x25')](function(_0x16290f){if(_0x16290f){_0x4e9c09=_0x16290f;_0x93245d['model']=_[_0x2040('0x2f')](db[_0x2040('0x49')][_0x2040('0x2c')]);_0x93245d[_0x2040('0x2e')]=_['keys'](_0x511fa4[_0x2040('0x2e')]);_0x93245d[_0x2040('0x30')]=_[_0x2040('0x32')](_0x93245d[_0x2040('0x2d')],_0x93245d[_0x2040('0x2e')]);_0x263a6f[_0x2040('0x31')]=_[_0x2040('0x32')](_0x93245d[_0x2040('0x2d')],qs[_0x2040('0x41')](_0x511fa4[_0x2040('0x2e')][_0x2040('0x41')]));_0x263a6f[_0x2040('0x31')]=_0x263a6f[_0x2040('0x31')][_0x2040('0x33')]?_0x263a6f[_0x2040('0x31')]:_0x93245d[_0x2040('0x2d')];_0x263a6f[_0x2040('0x35')]=qs[_0x2040('0x36')](_0x511fa4[_0x2040('0x2e')][_0x2040('0x36')]);_0x263a6f[_0x2040('0x39')]=qs[_0x2040('0x30')](_[_0x2040('0x37')](_0x511fa4[_0x2040('0x2e')],_0x93245d[_0x2040('0x30')]));if(_0x511fa4['query'][_0x2040('0x38')]){_0x263a6f[_0x2040('0x39')]=_[_0x2040('0x3a')](_0x263a6f[_0x2040('0x39')],{'$or':_[_0x2040('0x2b')](_0x263a6f[_0x2040('0x31')],function(_0x12140c){var _0x369206={};_0x369206[_0x12140c]={'$like':'%'+_0x511fa4[_0x2040('0x2e')][_0x2040('0x38')]+'%'};return _0x369206;})});}_0x263a6f=_[_0x2040('0x3a')]({},_0x263a6f,_0x511fa4[_0x2040('0x42')]);return _0x4e9c09[_0x2040('0x4c')](_0x263a6f);}})[_0x2040('0x25')](function(_0x242902){if(_0x242902){_0x10f4db=_0x242902[_0x2040('0x33')];if(!_0x511fa4[_0x2040('0x2e')][_0x2040('0x4a')](_0x2040('0x4b'))){_0x263a6f[_0x2040('0x34')]=qs['limit'](_0x511fa4[_0x2040('0x2e')][_0x2040('0x34')]);_0x263a6f[_0x2040('0x1c')]=qs[_0x2040('0x1c')](_0x511fa4[_0x2040('0x2e')][_0x2040('0x1c')]);}return _0x4e9c09[_0x2040('0x4c')](_0x263a6f);}})[_0x2040('0x25')](function(_0x5738fc){if(_0x5738fc){return _0x5738fc?{'count':_0x10f4db,'rows':_0x5738fc}:null;}})[_0x2040('0x25')](respondWithResult(_0x45abed,null))['catch'](handleError(_0x45abed,null));};exports[_0x2040('0x4d')]=function(_0x482971,_0x138cc4,_0x17b35b){var _0x33732a={};var _0x3eceab={};var _0x1d8d5b;var _0x4511a7;return db[_0x2040('0x3c')][_0x2040('0x47')]({'where':{'id':_0x482971[_0x2040('0x48')]['id']}})[_0x2040('0x25')](handleEntityNotFound(_0x138cc4,null))[_0x2040('0x25')](function(_0xc23e98){if(_0xc23e98){_0x1d8d5b=_0xc23e98;_0x3eceab[_0x2040('0x2d')]=_['keys'](db['DeskField'][_0x2040('0x2c')]);_0x3eceab[_0x2040('0x2e')]=_['keys'](_0x482971[_0x2040('0x2e')]);_0x3eceab[_0x2040('0x30')]=_[_0x2040('0x32')](_0x3eceab[_0x2040('0x2d')],_0x3eceab[_0x2040('0x2e')]);_0x33732a['attributes']=_[_0x2040('0x32')](_0x3eceab['model'],qs[_0x2040('0x41')](_0x482971['query'][_0x2040('0x41')]));_0x33732a['attributes']=_0x33732a[_0x2040('0x31')][_0x2040('0x33')]?_0x33732a[_0x2040('0x31')]:_0x3eceab[_0x2040('0x2d')];_0x33732a[_0x2040('0x35')]=qs[_0x2040('0x36')](_0x482971['query']['sort']);_0x33732a[_0x2040('0x39')]=qs['filters'](_[_0x2040('0x37')](_0x482971[_0x2040('0x2e')],_0x3eceab[_0x2040('0x30')]));if(_0x482971[_0x2040('0x2e')][_0x2040('0x38')]){_0x33732a[_0x2040('0x39')]=_['merge'](_0x33732a['where'],{'$or':_[_0x2040('0x2b')](_0x33732a[_0x2040('0x31')],function(_0x466bf8){var _0x2c2c6f={};_0x2c2c6f[_0x466bf8]={'$like':'%'+_0x482971[_0x2040('0x2e')]['filter']+'%'};return _0x2c2c6f;})});}_0x33732a=_['merge']({},_0x33732a,_0x482971[_0x2040('0x42')]);return _0x1d8d5b[_0x2040('0x4d')](_0x33732a);}})['then'](function(_0x171666){if(_0x171666){_0x4511a7=_0x171666[_0x2040('0x33')];if(!_0x482971[_0x2040('0x2e')][_0x2040('0x4a')](_0x2040('0x4b'))){_0x33732a[_0x2040('0x34')]=qs[_0x2040('0x34')](_0x482971[_0x2040('0x2e')]['limit']);_0x33732a[_0x2040('0x1c')]=qs['offset'](_0x482971[_0x2040('0x2e')]['offset']);}return _0x1d8d5b[_0x2040('0x4d')](_0x33732a);}})[_0x2040('0x25')](function(_0x390eb1){if(_0x390eb1){return _0x390eb1?{'count':_0x4511a7,'rows':_0x390eb1}:null;}})['then'](respondWithResult(_0x138cc4,null))[_0x2040('0x3f')](handleError(_0x138cc4,null));};exports['getTags']=function(_0x23475a,_0x22868b,_0x55ec8f){var _0x2ebcd3={};var _0x5939dd={};var _0x1cf946;var _0x36e3f5;return db[_0x2040('0x3c')][_0x2040('0x47')]({'where':{'id':_0x23475a[_0x2040('0x48')]['id']}})[_0x2040('0x25')](handleEntityNotFound(_0x22868b,null))['then'](function(_0x52b330){if(_0x52b330){_0x1cf946=_0x52b330;_0x5939dd['model']=_[_0x2040('0x2f')](db[_0x2040('0x4e')][_0x2040('0x2c')]);_0x5939dd[_0x2040('0x2e')]=_['keys'](_0x23475a[_0x2040('0x2e')]);_0x5939dd[_0x2040('0x30')]=_[_0x2040('0x32')](_0x5939dd[_0x2040('0x2d')],_0x5939dd[_0x2040('0x2e')]);_0x2ebcd3[_0x2040('0x31')]=_['intersection'](_0x5939dd[_0x2040('0x2d')],qs['fields'](_0x23475a['query'][_0x2040('0x41')]));_0x2ebcd3['attributes']=_0x2ebcd3[_0x2040('0x31')][_0x2040('0x33')]?_0x2ebcd3[_0x2040('0x31')]:_0x5939dd[_0x2040('0x2d')];_0x2ebcd3['order']=qs[_0x2040('0x36')](_0x23475a[_0x2040('0x2e')]['sort']);_0x2ebcd3[_0x2040('0x39')]=qs[_0x2040('0x30')](_[_0x2040('0x37')](_0x23475a[_0x2040('0x2e')],_0x5939dd['filters']));if(_0x23475a[_0x2040('0x2e')][_0x2040('0x38')]){_0x2ebcd3[_0x2040('0x39')]=_[_0x2040('0x3a')](_0x2ebcd3['where'],{'$or':_[_0x2040('0x2b')](_0x2ebcd3[_0x2040('0x31')],function(_0x47a1fd){var _0xe8d7de={};_0xe8d7de[_0x47a1fd]={'$like':'%'+_0x23475a[_0x2040('0x2e')]['filter']+'%'};return _0xe8d7de;})});}_0x2ebcd3=_['merge']({},_0x2ebcd3,_0x23475a['options']);return _0x1cf946[_0x2040('0x4f')](_0x2ebcd3);}})[_0x2040('0x25')](function(_0x4ac4c2){if(_0x4ac4c2){_0x36e3f5=_0x4ac4c2[_0x2040('0x33')];if(!_0x23475a[_0x2040('0x2e')][_0x2040('0x4a')]('nolimit')){_0x2ebcd3['limit']=qs[_0x2040('0x34')](_0x23475a[_0x2040('0x2e')][_0x2040('0x34')]);_0x2ebcd3['offset']=qs['offset'](_0x23475a['query'][_0x2040('0x1c')]);}return _0x1cf946[_0x2040('0x4f')](_0x2ebcd3);}})['then'](function(_0xc29370){if(_0xc29370){return _0xc29370?{'count':_0x36e3f5,'rows':_0xc29370}:null;}})[_0x2040('0x25')](respondWithResult(_0x22868b,null))[_0x2040('0x3f')](handleError(_0x22868b,null));};exports['setTags']=function(_0x496886,_0x325afc,_0xf33c0e){if(_0x496886[_0x2040('0x45')]['id']){delete _0x496886['body']['id'];}return db['DeskConfiguration'][_0x2040('0x47')]({'where':{'id':_0x496886[_0x2040('0x48')]['id']}})['then'](handleEntityNotFound(_0x325afc,null))['then'](function(_0x5e796e){if(_0x5e796e){return _0x5e796e[_0x2040('0x50')](_0x496886[_0x2040('0x45')][_0x2040('0x51')]||[]);}return null;})[_0x2040('0x25')](respondWithResult(_0x325afc,null))['catch'](handleError(_0x325afc,null));};
\ No newline at end of file
index 18e4b1c..22021f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08e0=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x4869e0,_0x1ea74d){var _0x528be3=function(_0x4ee4c6){while(--_0x4ee4c6){_0x4869e0['push'](_0x4869e0['shift']());}};_0x528be3(++_0x1ea74d);}(_0x08e0,0x16a));var _0x008e=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x08e0[_0x2a0738];return _0x159679;};'use strict';var _=require(_0x008e('0x0'));var util=require(_0x008e('0x1'));var logger=require(_0x008e('0x2'))(_0x008e('0x3'));var moment=require(_0x008e('0x4'));var BPromise=require(_0x008e('0x5'));var rp=require(_0x008e('0x6'));var fs=require('fs');var path=require(_0x008e('0x7'));var rimraf=require(_0x008e('0x8'));var config=require('../../config/environment');var attributes=require(_0x008e('0x9'));module['exports']=function(_0x38e6c6,_0x3e6de6){return _0x38e6c6['define'](_0x008e('0xa'),attributes,{'tableName':_0x008e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2c3f=['exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x3badd8,_0x14b5e8){var _0x26c7d9=function(_0x17d5ae){while(--_0x17d5ae){_0x3badd8['push'](_0x3badd8['shift']());}};_0x26c7d9(++_0x14b5e8);}(_0x2c3f,0xc3));var _0xf2c3=function(_0x119746,_0x5affb6){_0x119746=_0x119746-0x0;var _0x4c4c68=_0x2c3f[_0x119746];return _0x4c4c68;};'use strict';var _=require(_0xf2c3('0x0'));var util=require(_0xf2c3('0x1'));var logger=require(_0xf2c3('0x2'))(_0xf2c3('0x3'));var moment=require('moment');var BPromise=require(_0xf2c3('0x4'));var rp=require(_0xf2c3('0x5'));var fs=require('fs');var path=require(_0xf2c3('0x6'));var rimraf=require(_0xf2c3('0x7'));var config=require('../../config/environment');var attributes=require(_0xf2c3('0x8'));module[_0xf2c3('0x9')]=function(_0x1fd140,_0x5c8dc6){return _0x1fd140['define'](_0xf2c3('0xa'),attributes,{'tableName':_0xf2c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 364ef18..313a3e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d62=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x5b2000,_0x226add){var _0x3b5a28=function(_0x4b12cb){while(--_0x4b12cb){_0x5b2000['push'](_0x5b2000['shift']());}};_0x3b5a28(++_0x226add);}(_0x8d62,0xf8));var _0x28d6=function(_0x6f1258,_0x2e311a){_0x6f1258=_0x6f1258-0x0;var _0x40020d=_0x8d62[_0x6f1258];return _0x40020d;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var moment=require(_0x28d6('0x1'));var BPromise=require(_0x28d6('0x2'));var rs=require(_0x28d6('0x3'));var fs=require('fs');var Redis=require(_0x28d6('0x4'));var db=require(_0x28d6('0x5'))['db'];var utils=require(_0x28d6('0x6'));var logger=require(_0x28d6('0x7'))(_0x28d6('0x8'));var config=require(_0x28d6('0x9'));var jayson=require(_0x28d6('0xa'));var client=jayson[_0x28d6('0xb')][_0x28d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe8aa7b,_0x5c8a27,_0x1d5399){return new BPromise(function(_0xb9dccb,_0x3f3235){return client['request'](_0xe8aa7b,_0x1d5399)[_0x28d6('0xd')](function(_0x4b564f){logger[_0x28d6('0xe')](_0x28d6('0xf'),_0x5c8a27,_0x28d6('0x10'));logger[_0x28d6('0x11')](_0x28d6('0x12'),_0x5c8a27,'request\x20sent',JSON[_0x28d6('0x13')](_0x4b564f));if(_0x4b564f[_0x28d6('0x14')]){if(_0x4b564f[_0x28d6('0x14')][_0x28d6('0x15')]===0x1f4){logger[_0x28d6('0x14')](_0x28d6('0xf'),_0x5c8a27,_0x4b564f[_0x28d6('0x14')][_0x28d6('0x16')]);return _0x3f3235(_0x4b564f['error'][_0x28d6('0x16')]);}logger[_0x28d6('0x14')](_0x28d6('0xf'),_0x5c8a27,_0x4b564f['error'][_0x28d6('0x16')]);return _0xb9dccb(_0x4b564f['error'][_0x28d6('0x16')]);}else{logger[_0x28d6('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x5c8a27,_0x28d6('0x10'));_0xb9dccb(_0x4b564f[_0x28d6('0x17')][_0x28d6('0x16')]);}})[_0x28d6('0x18')](function(_0x154c4d){logger['error'](_0x28d6('0xf'),_0x5c8a27,_0x154c4d);_0x3f3235(_0x154c4d);});});}
\ No newline at end of file
+var _0xb7de=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2c3453,_0x5ea996){var _0x182b70=function(_0x5be8f1){while(--_0x5be8f1){_0x2c3453['push'](_0x2c3453['shift']());}};_0x182b70(++_0x5ea996);}(_0xb7de,0xc7));var _0xeb7d=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xb7de[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var moment=require(_0xeb7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb7d('0x3'));var fs=require('fs');var Redis=require(_0xeb7d('0x4'));var db=require(_0xeb7d('0x5'))['db'];var utils=require(_0xeb7d('0x6'));var logger=require(_0xeb7d('0x7'))('rpc');var config=require(_0xeb7d('0x8'));var jayson=require(_0xeb7d('0x9'));var client=jayson[_0xeb7d('0xa')][_0xeb7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc8bd99,_0x593170,_0x5e7556){return new BPromise(function(_0xb802e1,_0x13d376){return client[_0xeb7d('0xc')](_0xc8bd99,_0x5e7556)[_0xeb7d('0xd')](function(_0x4a880a){logger[_0xeb7d('0xe')](_0xeb7d('0xf'),_0x593170,_0xeb7d('0x10'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x593170,_0xeb7d('0x10'),JSON['stringify'](_0x4a880a));if(_0x4a880a[_0xeb7d('0x11')]){if(_0x4a880a[_0xeb7d('0x11')][_0xeb7d('0x12')]===0x1f4){logger[_0xeb7d('0x11')](_0xeb7d('0xf'),_0x593170,_0x4a880a[_0xeb7d('0x11')]['message']);return _0x13d376(_0x4a880a[_0xeb7d('0x11')][_0xeb7d('0x13')]);}logger[_0xeb7d('0x11')](_0xeb7d('0xf'),_0x593170,_0x4a880a[_0xeb7d('0x11')]['message']);return _0xb802e1(_0x4a880a[_0xeb7d('0x11')]['message']);}else{logger[_0xeb7d('0xe')](_0xeb7d('0xf'),_0x593170,_0xeb7d('0x10'));_0xb802e1(_0x4a880a['result']['message']);}})[_0xeb7d('0x14')](function(_0xfcbbce){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x593170,_0xfcbbce);_0x13d376(_0xfcbbce);});});}
\ No newline at end of file
index 3fff79e..6b61ee8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x640e=['util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x1d1276,_0x4b2aad){var _0x504510=function(_0x222282){while(--_0x222282){_0x1d1276['push'](_0x1d1276['shift']());}};_0x504510(++_0x4b2aad);}(_0x640e,0x65));var _0xe640=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x640e[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0xe640('0x0'));var util=require(_0xe640('0x1'));var path=require('path');var timeout=require(_0xe640('0x2'));var express=require(_0xe640('0x3'));var router=express[_0xe640('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe640('0x5'));var controller=require('./intDeskField.controller');router[_0xe640('0x6')]('/',auth[_0xe640('0x7')](),controller[_0xe640('0x8')]);router[_0xe640('0x6')](_0xe640('0x9'),auth[_0xe640('0x7')](),controller[_0xe640('0xa')]);router[_0xe640('0xb')]('/',auth[_0xe640('0x7')](),controller['create']);router[_0xe640('0xc')](_0xe640('0x9'),auth[_0xe640('0x7')](),controller[_0xe640('0xd')]);router[_0xe640('0xe')](_0xe640('0x9'),auth['isAuthenticated'](),controller[_0xe640('0xf')]);module[_0xe640('0x10')]=router;
\ No newline at end of file
+var _0x065d=['/:id','show','post','create','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x065d,0x6f));var _0xd065=function(_0x323960,_0x558215){_0x323960=_0x323960-0x0;var _0x50cf80=_0x065d[_0x323960];return _0x50cf80;};'use strict';var multer=require(_0xd065('0x0'));var util=require('util');var path=require(_0xd065('0x1'));var timeout=require(_0xd065('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd065('0x3'));var interaction=require(_0xd065('0x4'));var config=require(_0xd065('0x5'));var controller=require(_0xd065('0x6'));router['get']('/',auth[_0xd065('0x7')](),controller['index']);router[_0xd065('0x8')](_0xd065('0x9'),auth[_0xd065('0x7')](),controller[_0xd065('0xa')]);router[_0xd065('0xb')]('/',auth[_0xd065('0x7')](),controller[_0xd065('0xc')]);router['put'](_0xd065('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xd065('0xd')]('/:id',auth[_0xd065('0x7')](),controller[_0xd065('0xe')]);module['exports']=router;
\ No newline at end of file
index 2e32a04..2b8f59d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6834=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x5c3997,_0x58cba5){var _0x285f55=function(_0x39a327){while(--_0x39a327){_0x5c3997['push'](_0x5c3997['shift']());}};_0x285f55(++_0x58cba5);}(_0x6834,0x197));var _0x4683=function(_0x598bf9,_0x105c1f){_0x598bf9=_0x598bf9-0x0;var _0x44fb05=_0x6834[_0x598bf9];return _0x44fb05;};'use strict';var Sequelize=require(_0x4683('0x0'));module['exports']={'type':{'type':Sequelize[_0x4683('0x1')](_0x4683('0x2'),_0x4683('0x3'),_0x4683('0x4'),_0x4683('0x5'),_0x4683('0x6')),'defaultValue':_0x4683('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4683('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4683('0x2'),_0x4683('0x3'),_0x4683('0x4'))},'keyContent':{'type':Sequelize[_0x4683('0x7')]},'idField':{'type':Sequelize[_0x4683('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4683('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4683('0x7')]}};
\ No newline at end of file
+var _0x527b=['STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','picklist'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x527b,0x100));var _0xb527=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x527b[_0x3358ba];return _0x296e73;};'use strict';var Sequelize=require(_0xb527('0x0'));module[_0xb527('0x1')]={'type':{'type':Sequelize[_0xb527('0x2')](_0xb527('0x3'),'variable','customVariable','keyValue',_0xb527('0x4')),'defaultValue':_0xb527('0x3')},'content':{'type':Sequelize[_0xb527('0x5')]},'key':{'type':Sequelize[_0xb527('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xb527('0x3'),_0xb527('0x6'),_0xb527('0x7'))},'keyContent':{'type':Sequelize[_0xb527('0x5')]},'idField':{'type':Sequelize[_0xb527('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb527('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb527('0x5')]}};
\ No newline at end of file
index c01bfd2..eb914b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a8e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskField','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a8e,0x132));var _0xe2a8=function(_0x3b15a1,_0x3c2f2a){_0x3b15a1=_0x3b15a1-0x0;var _0x4c4839=_0x2a8e[_0x3b15a1];return _0x4c4839;};'use strict';var emlformat=require(_0xe2a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe2a8('0x1'));var jsonpatch=require(_0xe2a8('0x2'));var rp=require(_0xe2a8('0x3'));var moment=require(_0xe2a8('0x4'));var BPromise=require(_0xe2a8('0x5'));var Mustache=require(_0xe2a8('0x6'));var util=require(_0xe2a8('0x7'));var path=require(_0xe2a8('0x8'));var sox=require(_0xe2a8('0x9'));var csv=require('to-csv');var ejs=require(_0xe2a8('0xa'));var fs=require('fs');var fs_extra=require(_0xe2a8('0xb'));var _=require(_0xe2a8('0xc'));var squel=require(_0xe2a8('0xd'));var crypto=require(_0xe2a8('0xe'));var jsforce=require(_0xe2a8('0xf'));var deskjs=require(_0xe2a8('0x10'));var toCsv=require(_0xe2a8('0x11'));var querystring=require('querystring');var Papa=require(_0xe2a8('0x12'));var Redis=require(_0xe2a8('0x13'));var authService=require(_0xe2a8('0x14'));var qs=require(_0xe2a8('0x15'));var as=require(_0xe2a8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2a8('0x17'))(_0xe2a8('0x18'));var utils=require(_0xe2a8('0x19'));var config=require(_0xe2a8('0x1a'));var licenseUtil=require(_0xe2a8('0x1b'));var db=require(_0xe2a8('0x1c'))['db'];function respondWithStatusCode(_0x1721b8,_0x5691de){_0x5691de=_0x5691de||0xcc;return function(_0x3f727e){if(_0x3f727e){return _0x1721b8[_0xe2a8('0x1d')](_0x5691de);}return _0x1721b8[_0xe2a8('0x1e')](_0x5691de)[_0xe2a8('0x1f')]();};}function respondWithResult(_0x50b59c,_0x44c829){_0x44c829=_0x44c829||0xc8;return function(_0x5bea82){if(_0x5bea82){return _0x50b59c[_0xe2a8('0x1e')](_0x44c829)[_0xe2a8('0x20')](_0x5bea82);}};}function respondWithFilteredResult(_0xd035a0,_0xea9d76){return function(_0x20f230){if(_0x20f230){var _0x29cfde=typeof _0xea9d76['offset']===_0xe2a8('0x21')&&typeof _0xea9d76[_0xe2a8('0x22')]==='undefined';var _0x285a79=_0x20f230[_0xe2a8('0x23')];var _0x19dd17=_0x29cfde?0x0:_0xea9d76['offset'];var _0x1117d7=_0x29cfde?_0x20f230[_0xe2a8('0x23')]:_0xea9d76['offset']+_0xea9d76[_0xe2a8('0x22')];var _0x1ec914;if(_0x1117d7>=_0x285a79){_0x1117d7=_0x285a79;_0x1ec914=0xc8;}else{_0x1ec914=0xce;}_0xd035a0[_0xe2a8('0x1e')](_0x1ec914);return _0xd035a0['set'](_0xe2a8('0x24'),_0x19dd17+'-'+_0x1117d7+'/'+_0x285a79)['json'](_0x20f230);}return null;};}function patchUpdates(_0x26efcc){return function(_0x441d46){try{jsonpatch[_0xe2a8('0x25')](_0x441d46,_0x26efcc,!![]);}catch(_0x25d2be){return BPromise[_0xe2a8('0x26')](_0x25d2be);}return _0x441d46[_0xe2a8('0x27')]();};}function saveUpdates(_0x329bbf,_0x429a65){return function(_0x41f105){if(_0x41f105){return _0x41f105[_0xe2a8('0x28')](_0x329bbf)['then'](function(_0x22312e){return _0x22312e;});}return null;};}function removeEntity(_0x44c9b8,_0x261267){return function(_0x34426f){if(_0x34426f){return _0x34426f[_0xe2a8('0x29')]()[_0xe2a8('0x2a')](function(){_0x44c9b8[_0xe2a8('0x1e')](0xcc)[_0xe2a8('0x1f')]();});}};}function handleEntityNotFound(_0x42b5bf,_0x1fff37){return function(_0x545e05){if(!_0x545e05){_0x42b5bf[_0xe2a8('0x1d')](0x194);}return _0x545e05;};}function handleError(_0x29dd7e,_0xc5afd6){_0xc5afd6=_0xc5afd6||0x1f4;return function(_0x2c4f37){logger[_0xe2a8('0x2b')](_0x2c4f37[_0xe2a8('0x2c')]);if(_0x2c4f37[_0xe2a8('0x2d')]){delete _0x2c4f37[_0xe2a8('0x2d')];}_0x29dd7e[_0xe2a8('0x1e')](_0xc5afd6)[_0xe2a8('0x2e')](_0x2c4f37);};}exports[_0xe2a8('0x2f')]=function(_0x5216e8,_0x321969){var _0x8fda3f={},_0x30b2df={},_0x3abc96={'count':0x0,'rows':[]};var _0x3dd968=_[_0xe2a8('0x30')](db[_0xe2a8('0x31')]['rawAttributes'],function(_0x2a3e18){return{'name':_0x2a3e18[_0xe2a8('0x32')],'type':_0x2a3e18['type'][_0xe2a8('0x33')]};});_0x30b2df[_0xe2a8('0x34')]=_[_0xe2a8('0x30')](_0x3dd968,'name');_0x30b2df[_0xe2a8('0x35')]=_[_0xe2a8('0x36')](_0x5216e8[_0xe2a8('0x35')]);_0x30b2df['filters']=_[_0xe2a8('0x37')](_0x30b2df['model'],_0x30b2df[_0xe2a8('0x35')]);_0x8fda3f['attributes']=_[_0xe2a8('0x37')](_0x30b2df[_0xe2a8('0x34')],qs[_0xe2a8('0x38')](_0x5216e8[_0xe2a8('0x35')][_0xe2a8('0x38')]));_0x8fda3f[_0xe2a8('0x39')]=_0x8fda3f[_0xe2a8('0x39')][_0xe2a8('0x3a')]?_0x8fda3f[_0xe2a8('0x39')]:_0x30b2df[_0xe2a8('0x34')];if(!_0x5216e8['query'][_0xe2a8('0x3b')]('nolimit')){_0x8fda3f[_0xe2a8('0x22')]=qs[_0xe2a8('0x22')](_0x5216e8['query'][_0xe2a8('0x22')]);_0x8fda3f[_0xe2a8('0x3c')]=qs['offset'](_0x5216e8[_0xe2a8('0x35')][_0xe2a8('0x3c')]);}_0x8fda3f[_0xe2a8('0x3d')]=qs[_0xe2a8('0x3e')](_0x5216e8[_0xe2a8('0x35')][_0xe2a8('0x3e')]);_0x8fda3f[_0xe2a8('0x3f')]=qs[_0xe2a8('0x40')](_[_0xe2a8('0x41')](_0x5216e8[_0xe2a8('0x35')],_0x30b2df[_0xe2a8('0x40')]),_0x3dd968);if(_0x5216e8[_0xe2a8('0x35')][_0xe2a8('0x42')]){_0x8fda3f[_0xe2a8('0x3f')]=_['merge'](_0x8fda3f['where'],{'$or':_[_0xe2a8('0x30')](_0x3dd968,function(_0x5bbb48){if(_0x5bbb48[_0xe2a8('0x43')]!=='VIRTUAL'){var _0x21f439={};_0x21f439[_0x5bbb48['name']]={'$like':'%'+_0x5216e8[_0xe2a8('0x35')][_0xe2a8('0x42')]+'%'};return _0x21f439;}})});}_0x8fda3f=_[_0xe2a8('0x44')]({},_0x8fda3f,_0x5216e8[_0xe2a8('0x45')]);var _0x464e69={'where':_0x8fda3f[_0xe2a8('0x3f')]};return db[_0xe2a8('0x31')][_0xe2a8('0x23')](_0x464e69)['then'](function(_0x4368bd){_0x3abc96[_0xe2a8('0x23')]=_0x4368bd;if(_0x5216e8[_0xe2a8('0x35')][_0xe2a8('0x46')]){_0x8fda3f[_0xe2a8('0x47')]=[{'all':!![]}];}return db[_0xe2a8('0x31')][_0xe2a8('0x48')](_0x8fda3f);})[_0xe2a8('0x2a')](function(_0x59f0cb){_0x3abc96[_0xe2a8('0x49')]=_0x59f0cb;return _0x3abc96;})[_0xe2a8('0x2a')](respondWithFilteredResult(_0x321969,_0x8fda3f))[_0xe2a8('0x4a')](handleError(_0x321969,null));};exports[_0xe2a8('0x4b')]=function(_0x38c8b0,_0x3f716d){var _0x523d0a={'raw':!![],'where':{'id':_0x38c8b0['params']['id']}},_0x516890={};_0x516890[_0xe2a8('0x34')]=_[_0xe2a8('0x36')](db[_0xe2a8('0x31')][_0xe2a8('0x4c')]);_0x516890[_0xe2a8('0x35')]=_[_0xe2a8('0x36')](_0x38c8b0[_0xe2a8('0x35')]);_0x516890[_0xe2a8('0x40')]=_['intersection'](_0x516890[_0xe2a8('0x34')],_0x516890[_0xe2a8('0x35')]);_0x523d0a['attributes']=_['intersection'](_0x516890[_0xe2a8('0x34')],qs[_0xe2a8('0x38')](_0x38c8b0['query'][_0xe2a8('0x38')]));_0x523d0a[_0xe2a8('0x39')]=_0x523d0a[_0xe2a8('0x39')][_0xe2a8('0x3a')]?_0x523d0a[_0xe2a8('0x39')]:_0x516890['model'];if(_0x38c8b0[_0xe2a8('0x35')][_0xe2a8('0x46')]){_0x523d0a[_0xe2a8('0x47')]=[{'all':!![]}];}_0x523d0a=_[_0xe2a8('0x44')]({},_0x523d0a,_0x38c8b0['options']);return db[_0xe2a8('0x31')][_0xe2a8('0x4d')](_0x523d0a)[_0xe2a8('0x2a')](handleEntityNotFound(_0x3f716d,null))['then'](respondWithResult(_0x3f716d,null))[_0xe2a8('0x4a')](handleError(_0x3f716d,null));};exports['create']=function(_0x5b6098,_0x2ac4a8){return db['DeskField'][_0xe2a8('0x4e')](_0x5b6098[_0xe2a8('0x4f')],{})[_0xe2a8('0x2a')](respondWithResult(_0x2ac4a8,0xc9))[_0xe2a8('0x4a')](handleError(_0x2ac4a8,null));};exports[_0xe2a8('0x28')]=function(_0x2b2814,_0x5a3590){if(_0x2b2814[_0xe2a8('0x4f')]['id']){delete _0x2b2814['body']['id'];}return db[_0xe2a8('0x31')][_0xe2a8('0x4d')]({'where':{'id':_0x2b2814[_0xe2a8('0x50')]['id']}})[_0xe2a8('0x2a')](handleEntityNotFound(_0x5a3590,null))[_0xe2a8('0x2a')](saveUpdates(_0x2b2814['body'],null))[_0xe2a8('0x2a')](respondWithResult(_0x5a3590,null))[_0xe2a8('0x4a')](handleError(_0x5a3590,null));};exports[_0xe2a8('0x29')]=function(_0x5e0bd1,_0x2d75fe){return db[_0xe2a8('0x31')][_0xe2a8('0x4d')]({'where':{'id':_0x5e0bd1[_0xe2a8('0x50')]['id']}})[_0xe2a8('0x2a')](handleEntityNotFound(_0x2d75fe,null))[_0xe2a8('0x2a')](removeEntity(_0x2d75fe,null))['catch'](handleError(_0x2d75fe,null));};
\ No newline at end of file
+var _0x8a8b=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key'];(function(_0x1a070b,_0x46d2c8){var _0x20b48d=function(_0x4e8510){while(--_0x4e8510){_0x1a070b['push'](_0x1a070b['shift']());}};_0x20b48d(++_0x46d2c8);}(_0x8a8b,0xae));var _0xb8a8=function(_0x4ae23e,_0x5f59a0){_0x4ae23e=_0x4ae23e-0x0;var _0x3268c6=_0x8a8b[_0x4ae23e];return _0x3268c6;};'use strict';var emlformat=require(_0xb8a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8a8('0x1'));var rp=require(_0xb8a8('0x2'));var moment=require('moment');var BPromise=require(_0xb8a8('0x3'));var Mustache=require('mustache');var util=require(_0xb8a8('0x4'));var path=require('path');var sox=require(_0xb8a8('0x5'));var csv=require(_0xb8a8('0x6'));var ejs=require(_0xb8a8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8a8('0x8'));var squel=require('squel');var crypto=require(_0xb8a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb8a8('0xa'));var toCsv=require(_0xb8a8('0x6'));var querystring=require(_0xb8a8('0xb'));var Papa=require('papaparse');var Redis=require(_0xb8a8('0xc'));var authService=require(_0xb8a8('0xd'));var qs=require(_0xb8a8('0xe'));var as=require(_0xb8a8('0xf'));var hardwareService=require(_0xb8a8('0x10'));var logger=require(_0xb8a8('0x11'))(_0xb8a8('0x12'));var utils=require(_0xb8a8('0x13'));var config=require(_0xb8a8('0x14'));var licenseUtil=require(_0xb8a8('0x15'));var db=require(_0xb8a8('0x16'))['db'];function respondWithStatusCode(_0x3ba314,_0x6e85aa){_0x6e85aa=_0x6e85aa||0xcc;return function(_0x5278f8){if(_0x5278f8){return _0x3ba314[_0xb8a8('0x17')](_0x6e85aa);}return _0x3ba314[_0xb8a8('0x18')](_0x6e85aa)[_0xb8a8('0x19')]();};}function respondWithResult(_0xad6499,_0x42fb99){_0x42fb99=_0x42fb99||0xc8;return function(_0xf3750e){if(_0xf3750e){return _0xad6499[_0xb8a8('0x18')](_0x42fb99)[_0xb8a8('0x1a')](_0xf3750e);}};}function respondWithFilteredResult(_0x22e0ac,_0x3d96dc){return function(_0x3ca02e){if(_0x3ca02e){var _0x4f6cd0=typeof _0x3d96dc[_0xb8a8('0x1b')]==='undefined'&&typeof _0x3d96dc[_0xb8a8('0x1c')]===_0xb8a8('0x1d');var _0x412041=_0x3ca02e[_0xb8a8('0x1e')];var _0x121be4=_0x4f6cd0?0x0:_0x3d96dc[_0xb8a8('0x1b')];var _0x1d0898=_0x4f6cd0?_0x3ca02e[_0xb8a8('0x1e')]:_0x3d96dc['offset']+_0x3d96dc['limit'];var _0x306c20;if(_0x1d0898>=_0x412041){_0x1d0898=_0x412041;_0x306c20=0xc8;}else{_0x306c20=0xce;}_0x22e0ac['status'](_0x306c20);return _0x22e0ac['set']('Content-Range',_0x121be4+'-'+_0x1d0898+'/'+_0x412041)[_0xb8a8('0x1a')](_0x3ca02e);}return null;};}function patchUpdates(_0x44cdee){return function(_0x421b58){try{jsonpatch[_0xb8a8('0x1f')](_0x421b58,_0x44cdee,!![]);}catch(_0x380fcb){return BPromise[_0xb8a8('0x20')](_0x380fcb);}return _0x421b58['save']();};}function saveUpdates(_0x17c2b8,_0x9ca4b){return function(_0x1a3ff2){if(_0x1a3ff2){return _0x1a3ff2[_0xb8a8('0x21')](_0x17c2b8)['then'](function(_0x404ca5){return _0x404ca5;});}return null;};}function removeEntity(_0x55c6aa,_0x32aba6){return function(_0x4bc82a){if(_0x4bc82a){return _0x4bc82a[_0xb8a8('0x22')]()['then'](function(){_0x55c6aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dadd6,_0x2dfad6){return function(_0xd25b42){if(!_0xd25b42){_0x5dadd6[_0xb8a8('0x17')](0x194);}return _0xd25b42;};}function handleError(_0x1672ba,_0x41b86d){_0x41b86d=_0x41b86d||0x1f4;return function(_0x4b6c93){logger[_0xb8a8('0x23')](_0x4b6c93[_0xb8a8('0x24')]);if(_0x4b6c93[_0xb8a8('0x25')]){delete _0x4b6c93[_0xb8a8('0x25')];}_0x1672ba[_0xb8a8('0x18')](_0x41b86d)['send'](_0x4b6c93);};}exports[_0xb8a8('0x26')]=function(_0x118f2d,_0xe1772e){var _0x1e7403={},_0x47464e={},_0x543e81={'count':0x0,'rows':[]};var _0x4aec01=_[_0xb8a8('0x27')](db[_0xb8a8('0x28')][_0xb8a8('0x29')],function(_0x3c2bea){return{'name':_0x3c2bea[_0xb8a8('0x2a')],'type':_0x3c2bea[_0xb8a8('0x2b')][_0xb8a8('0x2c')]};});_0x47464e[_0xb8a8('0x2d')]=_[_0xb8a8('0x27')](_0x4aec01,_0xb8a8('0x25'));_0x47464e['query']=_['keys'](_0x118f2d[_0xb8a8('0x2e')]);_0x47464e[_0xb8a8('0x2f')]=_[_0xb8a8('0x30')](_0x47464e['model'],_0x47464e['query']);_0x1e7403['attributes']=_['intersection'](_0x47464e['model'],qs[_0xb8a8('0x31')](_0x118f2d[_0xb8a8('0x2e')][_0xb8a8('0x31')]));_0x1e7403['attributes']=_0x1e7403[_0xb8a8('0x32')][_0xb8a8('0x33')]?_0x1e7403[_0xb8a8('0x32')]:_0x47464e[_0xb8a8('0x2d')];if(!_0x118f2d[_0xb8a8('0x2e')][_0xb8a8('0x34')]('nolimit')){_0x1e7403[_0xb8a8('0x1c')]=qs[_0xb8a8('0x1c')](_0x118f2d[_0xb8a8('0x2e')][_0xb8a8('0x1c')]);_0x1e7403[_0xb8a8('0x1b')]=qs[_0xb8a8('0x1b')](_0x118f2d['query']['offset']);}_0x1e7403[_0xb8a8('0x35')]=qs[_0xb8a8('0x36')](_0x118f2d[_0xb8a8('0x2e')][_0xb8a8('0x36')]);_0x1e7403[_0xb8a8('0x37')]=qs[_0xb8a8('0x2f')](_[_0xb8a8('0x38')](_0x118f2d['query'],_0x47464e[_0xb8a8('0x2f')]),_0x4aec01);if(_0x118f2d[_0xb8a8('0x2e')][_0xb8a8('0x39')]){_0x1e7403[_0xb8a8('0x37')]=_[_0xb8a8('0x3a')](_0x1e7403[_0xb8a8('0x37')],{'$or':_[_0xb8a8('0x27')](_0x4aec01,function(_0x3901c8){if(_0x3901c8[_0xb8a8('0x2b')]!==_0xb8a8('0x3b')){var _0x27b287={};_0x27b287[_0x3901c8[_0xb8a8('0x25')]]={'$like':'%'+_0x118f2d[_0xb8a8('0x2e')][_0xb8a8('0x39')]+'%'};return _0x27b287;}})});}_0x1e7403=_['merge']({},_0x1e7403,_0x118f2d[_0xb8a8('0x3c')]);var _0x605e15={'where':_0x1e7403[_0xb8a8('0x37')]};return db[_0xb8a8('0x28')][_0xb8a8('0x1e')](_0x605e15)[_0xb8a8('0x3d')](function(_0x3d011f){_0x543e81[_0xb8a8('0x1e')]=_0x3d011f;if(_0x118f2d['query'][_0xb8a8('0x3e')]){_0x1e7403[_0xb8a8('0x3f')]=[{'all':!![]}];}return db[_0xb8a8('0x28')][_0xb8a8('0x40')](_0x1e7403);})[_0xb8a8('0x3d')](function(_0x4eec73){_0x543e81[_0xb8a8('0x41')]=_0x4eec73;return _0x543e81;})[_0xb8a8('0x3d')](respondWithFilteredResult(_0xe1772e,_0x1e7403))['catch'](handleError(_0xe1772e,null));};exports[_0xb8a8('0x42')]=function(_0x2bfc77,_0x36c8e4){var _0x4d0f99={'raw':!![],'where':{'id':_0x2bfc77[_0xb8a8('0x43')]['id']}},_0x3590ac={};_0x3590ac[_0xb8a8('0x2d')]=_[_0xb8a8('0x44')](db['DeskField'][_0xb8a8('0x29')]);_0x3590ac['query']=_[_0xb8a8('0x44')](_0x2bfc77['query']);_0x3590ac[_0xb8a8('0x2f')]=_[_0xb8a8('0x30')](_0x3590ac[_0xb8a8('0x2d')],_0x3590ac[_0xb8a8('0x2e')]);_0x4d0f99[_0xb8a8('0x32')]=_[_0xb8a8('0x30')](_0x3590ac[_0xb8a8('0x2d')],qs[_0xb8a8('0x31')](_0x2bfc77[_0xb8a8('0x2e')][_0xb8a8('0x31')]));_0x4d0f99[_0xb8a8('0x32')]=_0x4d0f99[_0xb8a8('0x32')][_0xb8a8('0x33')]?_0x4d0f99[_0xb8a8('0x32')]:_0x3590ac['model'];if(_0x2bfc77[_0xb8a8('0x2e')]['includeAll']){_0x4d0f99[_0xb8a8('0x3f')]=[{'all':!![]}];}_0x4d0f99=_[_0xb8a8('0x3a')]({},_0x4d0f99,_0x2bfc77[_0xb8a8('0x3c')]);return db[_0xb8a8('0x28')][_0xb8a8('0x45')](_0x4d0f99)[_0xb8a8('0x3d')](handleEntityNotFound(_0x36c8e4,null))[_0xb8a8('0x3d')](respondWithResult(_0x36c8e4,null))['catch'](handleError(_0x36c8e4,null));};exports[_0xb8a8('0x46')]=function(_0x4175e1,_0x3ca626){return db['DeskField'][_0xb8a8('0x46')](_0x4175e1[_0xb8a8('0x47')],{})['then'](respondWithResult(_0x3ca626,0xc9))['catch'](handleError(_0x3ca626,null));};exports[_0xb8a8('0x21')]=function(_0x45e3d3,_0x2b6464){if(_0x45e3d3['body']['id']){delete _0x45e3d3[_0xb8a8('0x47')]['id'];}return db[_0xb8a8('0x28')][_0xb8a8('0x45')]({'where':{'id':_0x45e3d3[_0xb8a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b6464,null))[_0xb8a8('0x3d')](saveUpdates(_0x45e3d3[_0xb8a8('0x47')],null))[_0xb8a8('0x3d')](respondWithResult(_0x2b6464,null))[_0xb8a8('0x48')](handleError(_0x2b6464,null));};exports['destroy']=function(_0xa46a18,_0x32f688){return db[_0xb8a8('0x28')][_0xb8a8('0x45')]({'where':{'id':_0xa46a18[_0xb8a8('0x43')]['id']}})[_0xb8a8('0x3d')](handleEntityNotFound(_0x32f688,null))[_0xb8a8('0x3d')](removeEntity(_0x32f688,null))['catch'](handleError(_0x32f688,null));};
\ No newline at end of file
index f5d845f..1926dfc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9df2=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields','idField','lodash'];(function(_0x5d2473,_0x36d636){var _0x4f042d=function(_0x150fe8){while(--_0x150fe8){_0x5d2473['push'](_0x5d2473['shift']());}};_0x4f042d(++_0x36d636);}(_0x9df2,0xcf));var _0x29df=function(_0x14a227,_0x59a0d3){_0x14a227=_0x14a227-0x0;var _0x109b7f=_0x9df2[_0x14a227];return _0x109b7f;};'use strict';var _=require(_0x29df('0x0'));var util=require(_0x29df('0x1'));var logger=require(_0x29df('0x2'))(_0x29df('0x3'));var moment=require('moment');var BPromise=require(_0x29df('0x4'));var rp=require(_0x29df('0x5'));var fs=require('fs');var path=require(_0x29df('0x6'));var rimraf=require(_0x29df('0x7'));var config=require('../../config/environment');var attributes=require(_0x29df('0x8'));module['exports']=function(_0x49ed16,_0xa14483){return _0x49ed16[_0x29df('0x9')](_0x29df('0xa'),attributes,{'tableName':_0x29df('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x29df('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x4bec=['desk_unique_index','idField','util','api','moment','request-promise','rimraf','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4bec,0x12b));var _0xc4be=function(_0x4719bb,_0x457328){_0x4719bb=_0x4719bb-0x0;var _0x4bdb66=_0x4bec[_0x4719bb];return _0x4bdb66;};'use strict';var _=require('lodash');var util=require(_0xc4be('0x0'));var logger=require('../../config/logger')(_0xc4be('0x1'));var moment=require(_0xc4be('0x2'));var BPromise=require('bluebird');var rp=require(_0xc4be('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4be('0x4'));var config=require(_0xc4be('0x5'));var attributes=require(_0xc4be('0x6'));module['exports']=function(_0x117be9,_0x554b7e){return _0x117be9['define'](_0xc4be('0x7'),attributes,{'tableName':_0xc4be('0x8'),'paranoid':![],'indexes':[{'name':_0xc4be('0x9'),'fields':[_0xc4be('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index fdbd429..0501d01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfbd1=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x4daf0d,_0x3aa28a){var _0x176df0=function(_0x26f65e){while(--_0x26f65e){_0x4daf0d['push'](_0x4daf0d['shift']());}};_0x176df0(++_0x3aa28a);}(_0xfbd1,0x1b5));var _0x1fbd=function(_0x5a25f6,_0x3db5cb){_0x5a25f6=_0x5a25f6-0x0;var _0x5a524d=_0xfbd1[_0x5a25f6];return _0x5a524d;};'use strict';var _=require(_0x1fbd('0x0'));var util=require(_0x1fbd('0x1'));var moment=require(_0x1fbd('0x2'));var BPromise=require('bluebird');var rs=require(_0x1fbd('0x3'));var fs=require('fs');var Redis=require(_0x1fbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fbd('0x5'));var logger=require(_0x1fbd('0x6'))('rpc');var config=require(_0x1fbd('0x7'));var jayson=require(_0x1fbd('0x8'));var client=jayson['client'][_0x1fbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a1f1,_0x1b8029,_0x486c3c){return new BPromise(function(_0x21c366,_0x5bac0f){return client[_0x1fbd('0xa')](_0x35a1f1,_0x486c3c)[_0x1fbd('0xb')](function(_0x4ec602){logger[_0x1fbd('0xc')](_0x1fbd('0xd'),_0x1b8029,_0x1fbd('0xe'));logger[_0x1fbd('0xf')](_0x1fbd('0x10'),_0x1b8029,_0x1fbd('0xe'),JSON[_0x1fbd('0x11')](_0x4ec602));if(_0x4ec602[_0x1fbd('0x12')]){if(_0x4ec602[_0x1fbd('0x12')]['code']===0x1f4){logger['error'](_0x1fbd('0xd'),_0x1b8029,_0x4ec602['error'][_0x1fbd('0x13')]);return _0x5bac0f(_0x4ec602[_0x1fbd('0x12')]['message']);}logger[_0x1fbd('0x12')]('DeskField,\x20%s,\x20%s',_0x1b8029,_0x4ec602[_0x1fbd('0x12')][_0x1fbd('0x13')]);return _0x21c366(_0x4ec602[_0x1fbd('0x12')][_0x1fbd('0x13')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x1b8029,_0x1fbd('0xe'));_0x21c366(_0x4ec602[_0x1fbd('0x14')][_0x1fbd('0x13')]);}})[_0x1fbd('0x15')](function(_0x5a6916){logger[_0x1fbd('0x12')](_0x1fbd('0xd'),_0x1b8029,_0x5a6916);_0x5bac0f(_0x5a6916);});});}
\ No newline at end of file
+var _0x845c=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x3f09d4,_0x202d30){var _0x1c17ac=function(_0x2e37fd){while(--_0x2e37fd){_0x3f09d4['push'](_0x3f09d4['shift']());}};_0x1c17ac(++_0x202d30);}(_0x845c,0x64));var _0xc845=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x845c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc845('0x0'));var util=require(_0xc845('0x1'));var moment=require(_0xc845('0x2'));var BPromise=require(_0xc845('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc845('0x4'));var db=require(_0xc845('0x5'))['db'];var utils=require(_0xc845('0x6'));var logger=require('../../config/logger')(_0xc845('0x7'));var config=require('../../config/environment');var jayson=require(_0xc845('0x8'));var client=jayson[_0xc845('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b480,_0x10379d,_0x19f159){return new BPromise(function(_0x5582d5,_0x13d075){return client[_0xc845('0xa')](_0x51b480,_0x19f159)[_0xc845('0xb')](function(_0x40c3db){logger[_0xc845('0xc')](_0xc845('0xd'),_0x10379d,_0xc845('0xe'));logger[_0xc845('0xf')](_0xc845('0x10'),_0x10379d,_0xc845('0xe'),JSON[_0xc845('0x11')](_0x40c3db));if(_0x40c3db[_0xc845('0x12')]){if(_0x40c3db[_0xc845('0x12')]['code']===0x1f4){logger[_0xc845('0x12')]('DeskField,\x20%s,\x20%s',_0x10379d,_0x40c3db['error'][_0xc845('0x13')]);return _0x13d075(_0x40c3db[_0xc845('0x12')][_0xc845('0x13')]);}logger['error'](_0xc845('0xd'),_0x10379d,_0x40c3db[_0xc845('0x12')][_0xc845('0x13')]);return _0x5582d5(_0x40c3db[_0xc845('0x12')][_0xc845('0x13')]);}else{logger[_0xc845('0xc')](_0xc845('0xd'),_0x10379d,'request\x20sent');_0x5582d5(_0x40c3db[_0xc845('0x14')]['message']);}})['catch'](function(_0x4796af){logger[_0xc845('0x12')](_0xc845('0xd'),_0x10379d,_0x4796af);_0x13d075(_0x4796af);});});}
\ No newline at end of file
index 2ba154c..bf8e548 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b22=['get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x30f619,_0x4e3e72){var _0x310ec8=function(_0x3b0d1c){while(--_0x3b0d1c){_0x30f619['push'](_0x30f619['shift']());}};_0x310ec8(++_0x4e3e72);}(_0x5b22,0x1d1));var _0x25b2=function(_0x5d6109,_0x54a2c7){_0x5d6109=_0x5d6109-0x0;var _0x5299f3=_0x5b22[_0x5d6109];return _0x5299f3;};'use strict';var multer=require(_0x25b2('0x0'));var util=require(_0x25b2('0x1'));var path=require(_0x25b2('0x2'));var timeout=require(_0x25b2('0x3'));var express=require(_0x25b2('0x4'));var router=express[_0x25b2('0x5')]();var fs_extra=require(_0x25b2('0x6'));var auth=require(_0x25b2('0x7'));var interaction=require(_0x25b2('0x8'));var config=require(_0x25b2('0x9'));var controller=require('./intDynamics365Account.controller');router[_0x25b2('0xa')]('/',auth[_0x25b2('0xb')](),controller[_0x25b2('0xc')]);router[_0x25b2('0xa')](_0x25b2('0xd'),auth[_0x25b2('0xb')](),controller['show']);router['get'](_0x25b2('0xe'),auth[_0x25b2('0xb')](),controller['getConfigurations']);router[_0x25b2('0xa')](_0x25b2('0xf'),auth[_0x25b2('0xb')](),controller[_0x25b2('0x10')]);router[_0x25b2('0x11')]('/',auth[_0x25b2('0xb')](),controller[_0x25b2('0x12')]);router[_0x25b2('0x11')](_0x25b2('0xe'),auth[_0x25b2('0xb')](),controller[_0x25b2('0x13')]);router[_0x25b2('0x14')](_0x25b2('0xd'),auth[_0x25b2('0xb')](),controller[_0x25b2('0x15')]);router[_0x25b2('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x25b2('0x17')]);module[_0x25b2('0x18')]=router;
\ No newline at end of file
+var _0x2c67=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','addConfiguration'];(function(_0x235be9,_0x4ca361){var _0x1fc038=function(_0x453883){while(--_0x453883){_0x235be9['push'](_0x235be9['shift']());}};_0x1fc038(++_0x4ca361);}(_0x2c67,0x164));var _0x72c6=function(_0x381e98,_0x250c6e){_0x381e98=_0x381e98-0x0;var _0x5aa0c2=_0x2c67[_0x381e98];return _0x5aa0c2;};'use strict';var multer=require(_0x72c6('0x0'));var util=require(_0x72c6('0x1'));var path=require('path');var timeout=require(_0x72c6('0x2'));var express=require(_0x72c6('0x3'));var router=express[_0x72c6('0x4')]();var fs_extra=require(_0x72c6('0x5'));var auth=require(_0x72c6('0x6'));var interaction=require(_0x72c6('0x7'));var config=require(_0x72c6('0x8'));var controller=require(_0x72c6('0x9'));router[_0x72c6('0xa')]('/',auth['isAuthenticated'](),controller[_0x72c6('0xb')]);router['get'](_0x72c6('0xc'),auth['isAuthenticated'](),controller[_0x72c6('0xd')]);router[_0x72c6('0xa')](_0x72c6('0xe'),auth['isAuthenticated'](),controller[_0x72c6('0xf')]);router[_0x72c6('0xa')](_0x72c6('0x10'),auth[_0x72c6('0x11')](),controller[_0x72c6('0x12')]);router[_0x72c6('0x13')]('/',auth[_0x72c6('0x11')](),controller[_0x72c6('0x14')]);router[_0x72c6('0x13')](_0x72c6('0xe'),auth[_0x72c6('0x11')](),controller[_0x72c6('0x15')]);router[_0x72c6('0x16')](_0x72c6('0xc'),auth[_0x72c6('0x11')](),controller[_0x72c6('0x17')]);router[_0x72c6('0x18')](_0x72c6('0xc'),auth[_0x72c6('0x11')](),controller[_0x72c6('0x19')]);module[_0x72c6('0x1a')]=router;
\ No newline at end of file
index 445f664..053ebeb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e8d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x35fb0b,_0x22b8df){var _0x7d4c6a=function(_0x1d0497){while(--_0x1d0497){_0x35fb0b['push'](_0x35fb0b['shift']());}};_0x7d4c6a(++_0x22b8df);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x469f08,_0x178ecb){_0x469f08=_0x469f08-0x0;var _0xf1c7b6=_0x5e8d[_0x469f08];return _0xf1c7b6;};'use strict';var Sequelize=require(_0xd5e8('0x0'));module[_0xd5e8('0x1')]={'name':{'type':Sequelize[_0xd5e8('0x2')]},'username':{'type':Sequelize[_0xd5e8('0x2')]},'password':{'type':Sequelize[_0xd5e8('0x2')]},'remoteUri':{'type':Sequelize[_0xd5e8('0x2')]},'tenantId':{'type':Sequelize[_0xd5e8('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xd5e8('0x2')]},'serverUrl':{'type':Sequelize[_0xd5e8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xd5e8('0x3')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x965d=['exports','STRING','sequelize'];(function(_0x4dc939,_0x4ae210){var _0x1c70bc=function(_0x31602d){while(--_0x31602d){_0x4dc939['push'](_0x4dc939['shift']());}};_0x1c70bc(++_0x4ae210);}(_0x965d,0x1be));var _0xd965=function(_0x303675,_0xf33824){_0x303675=_0x303675-0x0;var _0x39f6cf=_0x965d[_0x303675];return _0x39f6cf;};'use strict';var Sequelize=require(_0xd965('0x0'));module[_0xd965('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd965('0x2')]},'password':{'type':Sequelize[_0xd965('0x2')]},'remoteUri':{'type':Sequelize[_0xd965('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd965('0x2')]},'clientSecret':{'type':Sequelize[_0xd965('0x2')]},'serverUrl':{'type':Sequelize[_0xd965('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
index 2aa6318..f5f418f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f5a=['$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../config/logger','status','json','offset','undefined','limit','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','count','includeAll','findAll','rows','catch','params','options','create','body','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Dynamics365Field','Subjects','slice','substring','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','https://login.microsoftonline.com/','tenantId','username','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x3f5a,0x17c));var _0xa3f5=function(_0x245ff8,_0x2e81f8){_0x245ff8=_0x245ff8-0x0;var _0x5a4faa=_0x3f5a[_0x245ff8];return _0x5a4faa;};'use strict';var rp=require(_0xa3f5('0x0'));var util=require(_0xa3f5('0x1'));var _=require(_0xa3f5('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xa3f5('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x182032,_0x4aa87d){_0x4aa87d=_0x4aa87d||0xc8;return function(_0x4a5fa6){if(_0x4a5fa6){return _0x182032[_0xa3f5('0x4')](_0x4aa87d)[_0xa3f5('0x5')](_0x4a5fa6);}};}function respondWithFilteredResult(_0x1d0353,_0x30a42d){return function(_0x579aab){if(_0x579aab){var _0x351124=typeof _0x30a42d[_0xa3f5('0x6')]===_0xa3f5('0x7')&&typeof _0x30a42d[_0xa3f5('0x8')]===_0xa3f5('0x7');var _0x49f8a4=_0x579aab['count'];var _0x328ce7=_0x351124?0x0:_0x30a42d[_0xa3f5('0x6')];var _0x476420=_0x351124?_0x579aab['count']:_0x30a42d[_0xa3f5('0x6')]+_0x30a42d['limit'];var _0x4d5386;if(_0x476420>=_0x49f8a4){_0x476420=_0x49f8a4;_0x4d5386=0xc8;}else{_0x4d5386=0xce;}_0x1d0353[_0xa3f5('0x4')](_0x4d5386);return _0x1d0353['set']('Content-Range',_0x328ce7+'-'+_0x476420+'/'+_0x49f8a4)[_0xa3f5('0x5')](_0x579aab);}return null;};}function saveUpdates(_0x4efa0f){return function(_0x3e445c){if(_0x3e445c){return _0x3e445c[_0xa3f5('0x9')](_0x4efa0f)[_0xa3f5('0xa')](function(_0x22759f){return _0x22759f;});}return null;};}function removeEntity(_0x538a3e){return function(_0x23de5a){if(_0x23de5a){return _0x23de5a['destroy']()[_0xa3f5('0xa')](function(){_0x538a3e['status'](0xcc)[_0xa3f5('0xb')]();});}};}function handleEntityNotFound(_0x36d4a5){return function(_0x345f60){if(!_0x345f60){_0x36d4a5[_0xa3f5('0xc')](0x194);}return _0x345f60;};}function handleError(_0x1db2ad,_0x41ab2f){_0x41ab2f=_0x41ab2f||0x1f4;return function(_0xcf2a5c){logger[_0xa3f5('0xd')](_0xcf2a5c[_0xa3f5('0xe')]);if(_0xcf2a5c['name']){delete _0xcf2a5c[_0xa3f5('0xf')];}_0x1db2ad[_0xa3f5('0x4')](_0x41ab2f)[_0xa3f5('0x10')](_0xcf2a5c);};}exports[_0xa3f5('0x11')]=function(_0x19ea59,_0x5c0884){var _0x46a9c7={},_0x5acde5={},_0x557752={'count':0x0,'rows':[]};var _0x5789c6=_[_0xa3f5('0x12')](db[_0xa3f5('0x13')][_0xa3f5('0x14')],function(_0x2f139c){return{'name':_0x2f139c[_0xa3f5('0x15')],'type':_0x2f139c[_0xa3f5('0x16')][_0xa3f5('0x17')]};});_0x5acde5[_0xa3f5('0x18')]=_[_0xa3f5('0x12')](_0x5789c6,'name');_0x5acde5[_0xa3f5('0x19')]=_[_0xa3f5('0x1a')](_0x19ea59[_0xa3f5('0x19')]);_0x5acde5[_0xa3f5('0x1b')]=_[_0xa3f5('0x1c')](_0x5acde5[_0xa3f5('0x18')],_0x5acde5['query']);_0x46a9c7[_0xa3f5('0x1d')]=_[_0xa3f5('0x1c')](_0x5acde5[_0xa3f5('0x18')],qs['fields'](_0x19ea59[_0xa3f5('0x19')][_0xa3f5('0x1e')]));_0x46a9c7[_0xa3f5('0x1d')]=_0x46a9c7[_0xa3f5('0x1d')][_0xa3f5('0x1f')]?_0x46a9c7['attributes']:_0x5acde5[_0xa3f5('0x18')];if(!_0x19ea59[_0xa3f5('0x19')][_0xa3f5('0x20')]('nolimit')){_0x46a9c7[_0xa3f5('0x8')]=qs[_0xa3f5('0x8')](_0x19ea59['query']['limit']);_0x46a9c7[_0xa3f5('0x6')]=qs[_0xa3f5('0x6')](_0x19ea59[_0xa3f5('0x19')]['offset']);}_0x46a9c7['order']=qs[_0xa3f5('0x21')](_0x19ea59['query'][_0xa3f5('0x21')]);_0x46a9c7[_0xa3f5('0x22')]=qs[_0xa3f5('0x1b')](_[_0xa3f5('0x23')](_0x19ea59[_0xa3f5('0x19')],_0x5acde5[_0xa3f5('0x1b')]),_0x5789c6);if(_0x19ea59[_0xa3f5('0x19')][_0xa3f5('0x24')]){_0x46a9c7[_0xa3f5('0x22')]=_[_0xa3f5('0x25')](_0x46a9c7[_0xa3f5('0x22')],{'$or':_['map'](_0x5789c6,function(_0xdff861){if(_0xdff861[_0xa3f5('0x16')]!=='VIRTUAL'){var _0x161e62={};_0x161e62[_0xdff861[_0xa3f5('0xf')]]={'$like':'%'+_0x19ea59['query'][_0xa3f5('0x24')]+'%'};return _0x161e62;}})});}_0x46a9c7=_[_0xa3f5('0x25')]({},_0x46a9c7,_0x19ea59['options']);var _0x5c2492={'where':_0x46a9c7['where']};return db[_0xa3f5('0x13')]['count'](_0x5c2492)[_0xa3f5('0xa')](function(_0x1c6e67){_0x557752[_0xa3f5('0x26')]=_0x1c6e67;if(_0x19ea59[_0xa3f5('0x19')][_0xa3f5('0x27')]){_0x46a9c7['include']=[{'all':!![]}];}return db[_0xa3f5('0x13')][_0xa3f5('0x28')](_0x46a9c7);})[_0xa3f5('0xa')](function(_0x2fbc21){_0x557752[_0xa3f5('0x29')]=_0x2fbc21;return _0x557752;})[_0xa3f5('0xa')](respondWithFilteredResult(_0x5c0884,_0x46a9c7))[_0xa3f5('0x2a')](handleError(_0x5c0884,null));};exports['show']=function(_0x441d3d,_0x50a5a2){var _0x5c6a97={'raw':![],'where':{'id':_0x441d3d[_0xa3f5('0x2b')]['id']}},_0x5d121c={};_0x5d121c[_0xa3f5('0x18')]=_[_0xa3f5('0x1a')](db[_0xa3f5('0x13')][_0xa3f5('0x14')]);_0x5d121c[_0xa3f5('0x19')]=_[_0xa3f5('0x1a')](_0x441d3d[_0xa3f5('0x19')]);_0x5d121c['filters']=_[_0xa3f5('0x1c')](_0x5d121c[_0xa3f5('0x18')],_0x5d121c[_0xa3f5('0x19')]);_0x5c6a97[_0xa3f5('0x1d')]=_[_0xa3f5('0x1c')](_0x5d121c[_0xa3f5('0x18')],qs[_0xa3f5('0x1e')](_0x441d3d[_0xa3f5('0x19')][_0xa3f5('0x1e')]));_0x5c6a97[_0xa3f5('0x1d')]=_0x5c6a97[_0xa3f5('0x1d')][_0xa3f5('0x1f')]?_0x5c6a97['attributes']:_0x5d121c[_0xa3f5('0x18')];if(_0x441d3d[_0xa3f5('0x19')]['includeAll']){_0x5c6a97['include']=[{'all':!![]}];}_0x5c6a97=_[_0xa3f5('0x25')]({},_0x5c6a97,_0x441d3d[_0xa3f5('0x2c')]);return db[_0xa3f5('0x13')]['find'](_0x5c6a97)[_0xa3f5('0xa')](handleEntityNotFound(_0x50a5a2,null))[_0xa3f5('0xa')](respondWithResult(_0x50a5a2,null))[_0xa3f5('0x2a')](handleError(_0x50a5a2,null));};exports[_0xa3f5('0x2d')]=function(_0x2242e6,_0x29e354){return db['Dynamics365Account'][_0xa3f5('0x2d')](_0x2242e6[_0xa3f5('0x2e')],{})['then'](respondWithResult(_0x29e354,0xc9))[_0xa3f5('0x2a')](handleError(_0x29e354,null));};exports['update']=function(_0x5f32d5,_0x408e39){if(_0x5f32d5[_0xa3f5('0x2e')]['id']){delete _0x5f32d5[_0xa3f5('0x2e')]['id'];}return db['Dynamics365Account'][_0xa3f5('0x2f')]({'where':{'id':_0x5f32d5[_0xa3f5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x408e39,null))[_0xa3f5('0xa')](saveUpdates(_0x5f32d5[_0xa3f5('0x2e')],null))['then'](respondWithResult(_0x408e39,null))[_0xa3f5('0x2a')](handleError(_0x408e39,null));};exports['destroy']=function(_0x316dab,_0x39f014){return db[_0xa3f5('0x13')][_0xa3f5('0x2f')]({'where':{'id':_0x316dab[_0xa3f5('0x2b')]['id']}})[_0xa3f5('0xa')](handleEntityNotFound(_0x39f014,null))['then'](removeEntity(_0x39f014,null))[_0xa3f5('0x2a')](handleError(_0x39f014,null));};exports[_0xa3f5('0x30')]=function(_0x192d5f,_0x2475aa){var _0x179c85={};var _0xed2f1d={};var _0x24b0ef;var _0x1d73c9;return db['Dynamics365Account'][_0xa3f5('0x31')]({'where':{'id':_0x192d5f[_0xa3f5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2475aa,null))[_0xa3f5('0xa')](function(_0x527ea3){if(_0x527ea3){_0x24b0ef=_0x527ea3;_0xed2f1d['model']=_[_0xa3f5('0x1a')](db[_0xa3f5('0x32')][_0xa3f5('0x14')]);_0xed2f1d[_0xa3f5('0x19')]=_[_0xa3f5('0x1a')](_0x192d5f[_0xa3f5('0x19')]);_0xed2f1d[_0xa3f5('0x1b')]=_[_0xa3f5('0x1c')](_0xed2f1d[_0xa3f5('0x18')],_0xed2f1d[_0xa3f5('0x19')]);_0x179c85[_0xa3f5('0x1d')]=_[_0xa3f5('0x1c')](_0xed2f1d[_0xa3f5('0x18')],qs[_0xa3f5('0x1e')](_0x192d5f[_0xa3f5('0x19')][_0xa3f5('0x1e')]));_0x179c85[_0xa3f5('0x1d')]=_0x179c85[_0xa3f5('0x1d')][_0xa3f5('0x1f')]?_0x179c85[_0xa3f5('0x1d')]:_0xed2f1d[_0xa3f5('0x18')];_0x179c85['order']=qs[_0xa3f5('0x21')](_0x192d5f[_0xa3f5('0x19')][_0xa3f5('0x21')]);_0x179c85['where']=qs['filters'](_[_0xa3f5('0x23')](_0x192d5f[_0xa3f5('0x19')],_0xed2f1d[_0xa3f5('0x1b')]));if(_0x192d5f[_0xa3f5('0x19')][_0xa3f5('0x24')]){_0x179c85[_0xa3f5('0x22')]=_[_0xa3f5('0x25')](_0x179c85[_0xa3f5('0x22')],{'$or':_[_0xa3f5('0x12')](_0x179c85[_0xa3f5('0x1d')],function(_0x20ad21){var _0x34823c={};_0x34823c[_0x20ad21]={'$like':'%'+_0x192d5f['query'][_0xa3f5('0x24')]+'%'};return _0x34823c;})});}_0x179c85=_['merge']({},_0x179c85,_0x192d5f[_0xa3f5('0x2c')]);return _0x24b0ef[_0xa3f5('0x30')](_0x179c85);}})[_0xa3f5('0xa')](function(_0x29c690){if(_0x29c690){_0x1d73c9=_0x29c690[_0xa3f5('0x1f')];if(!_0x192d5f[_0xa3f5('0x19')][_0xa3f5('0x20')](_0xa3f5('0x33'))){_0x179c85[_0xa3f5('0x8')]=qs[_0xa3f5('0x8')](_0x192d5f['query'][_0xa3f5('0x8')]);_0x179c85[_0xa3f5('0x6')]=qs[_0xa3f5('0x6')](_0x192d5f[_0xa3f5('0x19')][_0xa3f5('0x6')]);}return _0x24b0ef['getConfigurations'](_0x179c85);}})['then'](function(_0xddff73){if(_0xddff73){return _0xddff73?{'count':_0x1d73c9,'rows':_0xddff73}:null;}})[_0xa3f5('0xa')](respondWithResult(_0x2475aa,null))[_0xa3f5('0x2a')](handleError(_0x2475aa,null));};exports[_0xa3f5('0x34')]=function(_0x14f62d,_0x161928){if(_0x14f62d[_0xa3f5('0x2e')]['id']){delete _0x14f62d[_0xa3f5('0x2e')]['id'];}return db[_0xa3f5('0x13')][_0xa3f5('0x31')]({'where':{'id':_0x14f62d[_0xa3f5('0x2b')]['id']}})[_0xa3f5('0xa')](handleEntityNotFound(_0x161928,null))[_0xa3f5('0xa')](function(_0x36541d){if(_0x36541d){_0x14f62d[_0xa3f5('0x2e')][_0xa3f5('0x35')]=_0x36541d['id'];_0x14f62d['body']['Subjects']=integrations[_0xa3f5('0x36')](_0x14f62d[_0xa3f5('0x2e')][_0xa3f5('0x37')],_0x14f62d[_0xa3f5('0x2e')][_0xa3f5('0x16')]);_0x14f62d[_0xa3f5('0x2e')][_0xa3f5('0x38')]=integrations['getDescriptions'](_0x14f62d[_0xa3f5('0x2e')]['channel'],_0x14f62d['body'][_0xa3f5('0x16')]);return db[_0xa3f5('0x32')]['create'](_0x14f62d[_0xa3f5('0x2e')],{'include':[{'model':db[_0xa3f5('0x39')],'as':_0xa3f5('0x3a')},{'model':db[_0xa3f5('0x39')],'as':_0xa3f5('0x38')}]});}return null;})[_0xa3f5('0xa')](respondWithResult(_0x161928,null))[_0xa3f5('0x2a')](handleError(_0x161928,null));};function sanitizeRemoteUri(_0x51105d){var _0x2a98c7=_0x51105d[_0xa3f5('0x3b')](-0x1);if(_0x2a98c7==='/')return _0x51105d[_0xa3f5('0x3c')](0x0,_0x51105d['lastIndexOf'](_0x2a98c7));return _0x51105d;}function getWebApiUrl(_0xbd6a67){return util[_0xa3f5('0x3d')]('%s/api/data/v9.0/',_0xbd6a67);}exports[_0xa3f5('0x3e')]=function(_0x14579e,_0x33907f){var _0x21ae5a=_0x14579e[_0xa3f5('0x19')][_0xa3f5('0x3f')];var _0x42c88f=_0x21ae5a===_0xa3f5('0x40')?_0xa3f5('0x41'):_0xa3f5('0x42');var _0x4a7234='';var _0x5059c9='';var _0x5c0d26='';var _0x372ae1='';var _0x151248='';var _0x1c309f='';var _0x18a0a7='';var _0x52a2b6='';var _0x49a2ae=[_0xa3f5('0x43'),_0xa3f5('0x44'),_0xa3f5('0x45'),_0xa3f5('0x46'),'caseorigincode',_0xa3f5('0x47'),_0xa3f5('0x48'),'regardingobjectid',_0xa3f5('0x49'),'phonecall_activity_parties'];var _0x5bbc8e=[_0xa3f5('0x4a'),_0xa3f5('0x4b'),'actualserviceunits',_0xa3f5('0x4c'),_0xa3f5('0x4d'),_0xa3f5('0x4e'),_0xa3f5('0x4f'),_0xa3f5('0x50'),_0xa3f5('0x51'),_0xa3f5('0x52'),_0xa3f5('0x53'),_0xa3f5('0x54'),'createdon',_0xa3f5('0x55'),_0xa3f5('0x56'),_0xa3f5('0x57'),_0xa3f5('0x58'),'customeridyominame',_0xa3f5('0x59'),_0xa3f5('0x5a'),_0xa3f5('0x5b'),_0xa3f5('0x5c'),_0xa3f5('0x5d'),'exchangerate',_0xa3f5('0x5e'),_0xa3f5('0x5f'),'importsequencenumber',_0xa3f5('0x60'),_0xa3f5('0x61'),_0xa3f5('0x62'),_0xa3f5('0x63'),'modifiedbyexternalpartyname',_0xa3f5('0x64'),_0xa3f5('0x65'),_0xa3f5('0x66'),'modifiedon',_0xa3f5('0x67'),_0xa3f5('0x68'),_0xa3f5('0x69'),_0xa3f5('0x6a'),_0xa3f5('0x6b'),_0xa3f5('0x6c'),_0xa3f5('0x6d'),_0xa3f5('0x6e'),_0xa3f5('0x6f'),_0xa3f5('0x70'),_0xa3f5('0x71'),_0xa3f5('0x72'),'primarycontactidyominame',_0xa3f5('0x73'),_0xa3f5('0x74'),'productserialnumber',_0xa3f5('0x75'),'resolvebykpiidname',_0xa3f5('0x76'),'responsiblecontactidname',_0xa3f5('0x77'),_0xa3f5('0x78'),_0xa3f5('0x79'),_0xa3f5('0x7a'),_0xa3f5('0x7b'),'statecode',_0xa3f5('0x7c'),'subjectidname',_0xa3f5('0x7d'),'timezoneruleversionnumber',_0xa3f5('0x7e'),_0xa3f5('0x7f'),_0xa3f5('0x80'),_0xa3f5('0x81')];var _0x1939c8=_0x49a2ae[_0xa3f5('0x82')](_0x5bbc8e);return db[_0xa3f5('0x13')][_0xa3f5('0x31')]({'where':{'id':_0x14579e[_0xa3f5('0x2b')]['id']},'attributes':['id','username',_0xa3f5('0x83'),_0xa3f5('0x84'),'tenantId',_0xa3f5('0x85'),_0xa3f5('0x86'),_0xa3f5('0x87')],'include':[{'model':db[_0xa3f5('0x88')],'as':_0xa3f5('0x88'),'attributes':['id',_0xa3f5('0x89'),'data7']}]})['then'](handleEntityNotFound(_0x33907f,null))[_0xa3f5('0xa')](function(_0x91ad38){if(_0x91ad38){if(_0x91ad38['modernAuthentication']){_0x91ad38[_0xa3f5('0x8a')]=_0x91ad38[_0xa3f5('0x88')][_0xa3f5('0x89')];_0x52a2b6=sanitizeRemoteUri(_0x91ad38[_0xa3f5('0x88')]['data7']);_0x18a0a7=getWebApiUrl(_0x52a2b6);return _0x91ad38;}_0x52a2b6=sanitizeRemoteUri(_0x91ad38['remoteUri']);_0x18a0a7=getWebApiUrl(_0x52a2b6);var _0x157f54={'method':'POST','uri':_0xa3f5('0x8b')+_0x91ad38[_0xa3f5('0x8c')]+'/oauth2/token','form':{'client_id':_0x91ad38[_0xa3f5('0x85')],'resource':_0x52a2b6,'username':_0x91ad38[_0xa3f5('0x8d')],'password':_0x91ad38[_0xa3f5('0x83')],'grant_type':_0xa3f5('0x83'),'client_secret':_0x91ad38[_0xa3f5('0x86')]},'json':!![]};return rp(_0x157f54);}})[_0xa3f5('0xa')](function(_0x1584c3){_0x1c309f=_0x1584c3[_0xa3f5('0x8a')];var _0x23e462={'method':'GET','uri':encodeURI(_0x18a0a7+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x42c88f+'\x27'),'headers':{'Authorization':_0xa3f5('0x8e')+_0x1c309f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23e462);})[_0xa3f5('0xa')](function(_0x379be5){var _0x82992=_0x379be5[_0xa3f5('0x8f')][0x0];var _0x5b7694=_0x82992[_0xa3f5('0x90')];var _0x8d3869={'method':_0xa3f5('0x91'),'uri':_0x18a0a7+_0xa3f5('0x92')+_0x5b7694+_0xa3f5('0x93'),'headers':{'Authorization':_0xa3f5('0x8e')+_0x1c309f,'If-None-Match':null,'OData-Version':_0xa3f5('0x94')},'json':!![]};return rp(_0x8d3869);})['then'](function(_0x976cdc){_0x4a7234=_0x976cdc;_0x5059c9=_0x4a7234[_0xa3f5('0x95')];_0x5059c9=_['remove'](_0x5059c9,function(_0x7ea84e){return!_0x1939c8[_0xa3f5('0x96')](_0x7ea84e[_0xa3f5('0x97')]);});var _0x2b9043=[];var _0x2ee366=[];_0x5059c9[_0xa3f5('0x98')](function(_0x55d971){if(_0x55d971[_0xa3f5('0x99')]){var _0x2bcb9b=_0x55d971[_0xa3f5('0x99')][_0xa3f5('0x3c')](_0x55d971[_0xa3f5('0x99')][_0xa3f5('0x9a')]('.')+0x1);if(_0x2bcb9b===_0xa3f5('0x9b')){_0x2b9043[_0xa3f5('0x9c')](getSelectList(_0x18a0a7,_0x21ae5a,_0x2ee366,_0x4a7234[_0xa3f5('0x90')],_0x55d971[_0xa3f5('0x90')],_0x1c309f));}}});return Promise[_0xa3f5('0x9d')](_0x2b9043);})[_0xa3f5('0xa')](function(_0x57ad85){_0x5c0d26=_0x57ad85[0x0];var _0x51dad9=[];var _0x5ef7a4=[];_0x5059c9[_0xa3f5('0x98')](function(_0x454cfa){if(!_['isNil'](_0x454cfa[_0xa3f5('0x99')])){var _0xa66d63=_0x454cfa[_0xa3f5('0x99')]['substring'](_0x454cfa['@odata.type'][_0xa3f5('0x9a')]('.')+0x1);if(_0xa66d63===_0xa3f5('0x9e')){_0x51dad9[_0xa3f5('0x9c')](getBooleanList(_0x18a0a7,_0x21ae5a,_0x5ef7a4,_0x4a7234[_0xa3f5('0x90')],_0x454cfa[_0xa3f5('0x90')],_0x1c309f));}}});return Promise[_0xa3f5('0x9d')](_0x51dad9);})[_0xa3f5('0xa')](function(_0x1db462){_0x372ae1=_0x1db462[0x0];var _0x5554a1=[];var _0x4f7ec9=[];_0x5059c9['forEach'](function(_0x26d67f){if(_0x26d67f[_0xa3f5('0x99')]){var _0x3b4bab=_0x26d67f['@odata.type']['substring'](_0x26d67f[_0xa3f5('0x99')][_0xa3f5('0x9a')]('.')+0x1);if(_0x3b4bab===_0xa3f5('0x9f')||_0x3b4bab===_0xa3f5('0xa0')||_0x3b4bab===_0xa3f5('0xa1')||_0x3b4bab===_0xa3f5('0xa2')||_0x3b4bab==='MemoAttributeMetadata'||_0x3b4bab===_0xa3f5('0xa3')||_0x3b4bab===_0xa3f5('0xa4')||_0x3b4bab===_0xa3f5('0xa5')||_0x3b4bab==='StateAttributeMetadata'||_0x3b4bab===_0xa3f5('0xa6')){_0x5554a1['push'](getInputList(_0x18a0a7,_0x21ae5a,_0x3b4bab,_0x4f7ec9,_0x4a7234[_0xa3f5('0x90')],_0x26d67f['MetadataId'],_0x1c309f));}}});return Promise['all'](_0x5554a1);})[_0xa3f5('0xa')](function(_0x5bcd79){_0x151248=_0x5bcd79[0x0];var _0x2ac50b=_0x5c0d26[_0xa3f5('0x82')](_0x372ae1)[_0xa3f5('0x82')](_0x151248);var _0x4c84f9={'count':_0x2ac50b[_0xa3f5('0x1f')],'rows':_0x2ac50b};return _0x4c84f9;})[_0xa3f5('0xa')](respondWithResult(_0x33907f,null))['catch'](function(_0x66c790){var _0x34a55d=_0x14579e['query'][_0xa3f5('0xa7')]?0x1f4:_0x66c790[_0xa3f5('0xa8')]||0x1f4;logger[_0xa3f5('0xd')](_0x66c790[_0xa3f5('0xe')]);delete _0x66c790[_0xa3f5('0xf')];if(_0x34a55d===0x191){_0x34a55d=0x190;}_0x33907f[_0xa3f5('0x4')](_0x34a55d)[_0xa3f5('0x10')](_0x14579e[_0xa3f5('0x19')][_0xa3f5('0xa7')]?{'message':_0xa3f5('0xa9'),'statusCode':_0x66c790[_0xa3f5('0xa8')]}:_0x66c790);});};function getSelectList(_0x27b0b8,_0x439595,_0x251951,_0x348187,_0x957b3b,_0x80e17d){var _0x19f180={'method':_0xa3f5('0x91'),'uri':_0x27b0b8+_0xa3f5('0x92')+_0x348187+_0xa3f5('0xaa')+_0x957b3b+_0xa3f5('0xab')+_0xa3f5('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x80e17d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x19f180)['then'](function(_0x3211ea){var _0x5f44c3=[];var _0x2dccc7=_0x3211ea['OptionSet'][_0xa3f5('0xad')];_0x2dccc7[_0xa3f5('0x98')](function(_0xe34589){_0x5f44c3[_0xa3f5('0x9c')]({'name':_0xe34589[_0xa3f5('0xae')][_0xa3f5('0xaf')]['Label'],'value':String(_0xe34589[_0xa3f5('0xb0')])});});var _0x52b0ea={'id':_0x439595+'_'+_0x3211ea[_0xa3f5('0x97')],'name':_0x3211ea[_0xa3f5('0xb1')][_0xa3f5('0xaf')][_0xa3f5('0xae')],'custom':![],'options':_0x5f44c3};_0x251951[_0xa3f5('0x9c')](_0x52b0ea);return _0x251951;});}function getBooleanList(_0x183840,_0x3302a0,_0x32f75f,_0x1235c5,_0x8cd660,_0x191247){var _0x464761={'method':'GET','uri':_0x183840+_0xa3f5('0x92')+_0x1235c5+_0xa3f5('0xaa')+_0x8cd660+_0xa3f5('0xb2'),'headers':{'Authorization':_0xa3f5('0x8e')+_0x191247,'If-None-Match':null,'OData-Version':_0xa3f5('0x94')},'json':!![]};return rp(_0x464761)[_0xa3f5('0xa')](function(_0x237a2b){var _0x47f89a=[];_0x47f89a[_0xa3f5('0x9c')]({'name':_0x237a2b['OptionSet'][_0xa3f5('0xb3')][_0xa3f5('0xae')][_0xa3f5('0xaf')][_0xa3f5('0xae')],'value':_0xa3f5('0xb4')},{'name':_0x237a2b[_0xa3f5('0xb5')][_0xa3f5('0xb6')][_0xa3f5('0xae')]['UserLocalizedLabel'][_0xa3f5('0xae')],'value':'false'});var _0x122ec5={'id':_0x3302a0+'_'+_0x237a2b[_0xa3f5('0x97')],'name':_0x237a2b[_0xa3f5('0xb1')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x47f89a};_0x32f75f['push'](_0x122ec5);return _0x32f75f;});}function getInputList(_0x59ebb0,_0x279622,_0x1a7d70,_0x4d59e2,_0x452fda,_0x276b0a,_0x3aed98){var _0x18baca={'method':_0xa3f5('0x91'),'uri':_0x59ebb0+'EntityDefinitions('+_0x452fda+_0xa3f5('0xaa')+_0x276b0a+_0xa3f5('0xb7')+_0x1a7d70+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xa3f5('0x8e')+_0x3aed98,'If-None-Match':null,'OData-Version':_0xa3f5('0x94')},'json':!![]};return rp(_0x18baca)[_0xa3f5('0xa')](function(_0x520b62){var _0xf87ee5={'id':_0x279622+'_'+_0x520b62[_0xa3f5('0x97')],'name':_0x520b62[_0xa3f5('0xb1')][_0xa3f5('0xaf')]?_0x520b62[_0xa3f5('0xb1')][_0xa3f5('0xaf')][_0xa3f5('0xae')]:_0x520b62[_0xa3f5('0x97')],'custom':![],'options':[]};_0x4d59e2[_0xa3f5('0x9c')](_0xf87ee5);return _0x4d59e2;});}
\ No newline at end of file
+var _0x105f=['description','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','https://login.microsoftonline.com/','/oauth2/token','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','error','send','test','Wrong\x20credentials','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','DisplayName','OptionSet','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','api','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','end','sendStatus','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','Dynamics365Account','rows','show','params','keys','rawAttributes','fields','include','catch','create','body','find','getConfigurations','Dynamics365Configuration','pick','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title'];(function(_0x3b0c5d,_0x160f65){var _0x26a2c4=function(_0x511936){while(--_0x511936){_0x3b0c5d['push'](_0x3b0c5d['shift']());}};_0x26a2c4(++_0x160f65);}(_0x105f,0x71));var _0xf105=function(_0x442056,_0x7e77e4){_0x442056=_0x442056-0x0;var _0x568188=_0x105f[_0x442056];return _0x568188;};'use strict';var rp=require('request-promise');var util=require(_0xf105('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf105('0x1'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf105('0x2'));function respondWithResult(_0x34d5e7,_0x7bfadd){_0x7bfadd=_0x7bfadd||0xc8;return function(_0x368830){if(_0x368830){return _0x34d5e7['status'](_0x7bfadd)[_0xf105('0x3')](_0x368830);}};}function respondWithFilteredResult(_0x100675,_0x5f4946){return function(_0x12509d){if(_0x12509d){var _0x57abaa=typeof _0x5f4946[_0xf105('0x4')]===_0xf105('0x5')&&typeof _0x5f4946[_0xf105('0x6')]===_0xf105('0x5');var _0x4e6abd=_0x12509d['count'];var _0x50596d=_0x57abaa?0x0:_0x5f4946['offset'];var _0x17ebdd=_0x57abaa?_0x12509d[_0xf105('0x7')]:_0x5f4946['offset']+_0x5f4946[_0xf105('0x6')];var _0x27abb2;if(_0x17ebdd>=_0x4e6abd){_0x17ebdd=_0x4e6abd;_0x27abb2=0xc8;}else{_0x27abb2=0xce;}_0x100675[_0xf105('0x8')](_0x27abb2);return _0x100675[_0xf105('0x9')](_0xf105('0xa'),_0x50596d+'-'+_0x17ebdd+'/'+_0x4e6abd)[_0xf105('0x3')](_0x12509d);}return null;};}function saveUpdates(_0x48c08e){return function(_0x2f2dd5){if(_0x2f2dd5){return _0x2f2dd5['update'](_0x48c08e)[_0xf105('0xb')](function(_0xb8cdd0){return _0xb8cdd0;});}return null;};}function removeEntity(_0x36e59e){return function(_0x57e98d){if(_0x57e98d){return _0x57e98d[_0xf105('0xc')]()['then'](function(){_0x36e59e['status'](0xcc)[_0xf105('0xd')]();});}};}function handleEntityNotFound(_0x443095){return function(_0x24dd40){if(!_0x24dd40){_0x443095[_0xf105('0xe')](0x194);}return _0x24dd40;};}function handleError(_0x468643,_0x5036e0){_0x5036e0=_0x5036e0||0x1f4;return function(_0x50ae81){logger['error'](_0x50ae81['stack']);if(_0x50ae81[_0xf105('0xf')]){delete _0x50ae81['name'];}_0x468643[_0xf105('0x8')](_0x5036e0)['send'](_0x50ae81);};}exports[_0xf105('0x10')]=function(_0x3e1c5f,_0x2188e9){var _0xe07a35={},_0x369b60={},_0x3d704a={'count':0x0,'rows':[]};var _0x2a673b=_[_0xf105('0x11')](db['Dynamics365Account']['rawAttributes'],function(_0x2aa2e2){return{'name':_0x2aa2e2[_0xf105('0x12')],'type':_0x2aa2e2[_0xf105('0x13')][_0xf105('0x14')]};});_0x369b60[_0xf105('0x15')]=_[_0xf105('0x11')](_0x2a673b,_0xf105('0xf'));_0x369b60[_0xf105('0x16')]=_['keys'](_0x3e1c5f[_0xf105('0x16')]);_0x369b60[_0xf105('0x17')]=_[_0xf105('0x18')](_0x369b60[_0xf105('0x15')],_0x369b60[_0xf105('0x16')]);_0xe07a35[_0xf105('0x19')]=_[_0xf105('0x18')](_0x369b60[_0xf105('0x15')],qs['fields'](_0x3e1c5f[_0xf105('0x16')]['fields']));_0xe07a35[_0xf105('0x19')]=_0xe07a35['attributes'][_0xf105('0x1a')]?_0xe07a35[_0xf105('0x19')]:_0x369b60[_0xf105('0x15')];if(!_0x3e1c5f[_0xf105('0x16')][_0xf105('0x1b')](_0xf105('0x1c'))){_0xe07a35['limit']=qs[_0xf105('0x6')](_0x3e1c5f['query'][_0xf105('0x6')]);_0xe07a35[_0xf105('0x4')]=qs[_0xf105('0x4')](_0x3e1c5f[_0xf105('0x16')][_0xf105('0x4')]);}_0xe07a35[_0xf105('0x1d')]=qs[_0xf105('0x1e')](_0x3e1c5f[_0xf105('0x16')][_0xf105('0x1e')]);_0xe07a35[_0xf105('0x1f')]=qs['filters'](_['pick'](_0x3e1c5f[_0xf105('0x16')],_0x369b60[_0xf105('0x17')]),_0x2a673b);if(_0x3e1c5f['query']['filter']){_0xe07a35[_0xf105('0x1f')]=_[_0xf105('0x20')](_0xe07a35[_0xf105('0x1f')],{'$or':_['map'](_0x2a673b,function(_0x2245cf){if(_0x2245cf[_0xf105('0x13')]!==_0xf105('0x21')){var _0xd48fbb={};_0xd48fbb[_0x2245cf[_0xf105('0xf')]]={'$like':'%'+_0x3e1c5f[_0xf105('0x16')][_0xf105('0x22')]+'%'};return _0xd48fbb;}})});}_0xe07a35=_['merge']({},_0xe07a35,_0x3e1c5f[_0xf105('0x23')]);var _0x487466={'where':_0xe07a35[_0xf105('0x1f')]};return db['Dynamics365Account'][_0xf105('0x7')](_0x487466)['then'](function(_0x3240df){_0x3d704a[_0xf105('0x7')]=_0x3240df;if(_0x3e1c5f[_0xf105('0x16')][_0xf105('0x24')]){_0xe07a35['include']=[{'all':!![]}];}return db[_0xf105('0x25')]['findAll'](_0xe07a35);})[_0xf105('0xb')](function(_0x478acc){_0x3d704a[_0xf105('0x26')]=_0x478acc;return _0x3d704a;})[_0xf105('0xb')](respondWithFilteredResult(_0x2188e9,_0xe07a35))['catch'](handleError(_0x2188e9,null));};exports[_0xf105('0x27')]=function(_0x405417,_0x2279f3){var _0x328bd0={'raw':![],'where':{'id':_0x405417[_0xf105('0x28')]['id']}},_0x17b61c={};_0x17b61c[_0xf105('0x15')]=_[_0xf105('0x29')](db[_0xf105('0x25')][_0xf105('0x2a')]);_0x17b61c[_0xf105('0x16')]=_[_0xf105('0x29')](_0x405417[_0xf105('0x16')]);_0x17b61c[_0xf105('0x17')]=_[_0xf105('0x18')](_0x17b61c[_0xf105('0x15')],_0x17b61c['query']);_0x328bd0[_0xf105('0x19')]=_['intersection'](_0x17b61c[_0xf105('0x15')],qs[_0xf105('0x2b')](_0x405417['query'][_0xf105('0x2b')]));_0x328bd0[_0xf105('0x19')]=_0x328bd0[_0xf105('0x19')][_0xf105('0x1a')]?_0x328bd0[_0xf105('0x19')]:_0x17b61c[_0xf105('0x15')];if(_0x405417['query'][_0xf105('0x24')]){_0x328bd0[_0xf105('0x2c')]=[{'all':!![]}];}_0x328bd0=_[_0xf105('0x20')]({},_0x328bd0,_0x405417[_0xf105('0x23')]);return db['Dynamics365Account']['find'](_0x328bd0)[_0xf105('0xb')](handleEntityNotFound(_0x2279f3,null))[_0xf105('0xb')](respondWithResult(_0x2279f3,null))[_0xf105('0x2d')](handleError(_0x2279f3,null));};exports[_0xf105('0x2e')]=function(_0x25e090,_0x13ad8d){return db['Dynamics365Account'][_0xf105('0x2e')](_0x25e090[_0xf105('0x2f')],{})[_0xf105('0xb')](respondWithResult(_0x13ad8d,0xc9))[_0xf105('0x2d')](handleError(_0x13ad8d,null));};exports['update']=function(_0x5a8234,_0x7be3bc){if(_0x5a8234[_0xf105('0x2f')]['id']){delete _0x5a8234[_0xf105('0x2f')]['id'];}return db[_0xf105('0x25')][_0xf105('0x30')]({'where':{'id':_0x5a8234[_0xf105('0x28')]['id']}})['then'](handleEntityNotFound(_0x7be3bc,null))['then'](saveUpdates(_0x5a8234['body'],null))[_0xf105('0xb')](respondWithResult(_0x7be3bc,null))[_0xf105('0x2d')](handleError(_0x7be3bc,null));};exports[_0xf105('0xc')]=function(_0x3fae65,_0x5625c8){return db[_0xf105('0x25')][_0xf105('0x30')]({'where':{'id':_0x3fae65[_0xf105('0x28')]['id']}})[_0xf105('0xb')](handleEntityNotFound(_0x5625c8,null))['then'](removeEntity(_0x5625c8,null))[_0xf105('0x2d')](handleError(_0x5625c8,null));};exports[_0xf105('0x31')]=function(_0x400103,_0x59b75f){var _0x33624f={};var _0x1beeab={};var _0x1f2509;var _0x5d65e9;return db[_0xf105('0x25')]['findOne']({'where':{'id':_0x400103['params']['id']}})[_0xf105('0xb')](handleEntityNotFound(_0x59b75f,null))[_0xf105('0xb')](function(_0x173b10){if(_0x173b10){_0x1f2509=_0x173b10;_0x1beeab['model']=_[_0xf105('0x29')](db[_0xf105('0x32')][_0xf105('0x2a')]);_0x1beeab['query']=_['keys'](_0x400103['query']);_0x1beeab[_0xf105('0x17')]=_[_0xf105('0x18')](_0x1beeab[_0xf105('0x15')],_0x1beeab[_0xf105('0x16')]);_0x33624f[_0xf105('0x19')]=_[_0xf105('0x18')](_0x1beeab[_0xf105('0x15')],qs['fields'](_0x400103['query'][_0xf105('0x2b')]));_0x33624f['attributes']=_0x33624f[_0xf105('0x19')][_0xf105('0x1a')]?_0x33624f[_0xf105('0x19')]:_0x1beeab['model'];_0x33624f[_0xf105('0x1d')]=qs[_0xf105('0x1e')](_0x400103[_0xf105('0x16')][_0xf105('0x1e')]);_0x33624f[_0xf105('0x1f')]=qs[_0xf105('0x17')](_[_0xf105('0x33')](_0x400103[_0xf105('0x16')],_0x1beeab[_0xf105('0x17')]));if(_0x400103[_0xf105('0x16')][_0xf105('0x22')]){_0x33624f[_0xf105('0x1f')]=_[_0xf105('0x20')](_0x33624f[_0xf105('0x1f')],{'$or':_[_0xf105('0x11')](_0x33624f['attributes'],function(_0x1ee4b0){var _0x3736f9={};_0x3736f9[_0x1ee4b0]={'$like':'%'+_0x400103[_0xf105('0x16')][_0xf105('0x22')]+'%'};return _0x3736f9;})});}_0x33624f=_[_0xf105('0x20')]({},_0x33624f,_0x400103[_0xf105('0x23')]);return _0x1f2509[_0xf105('0x31')](_0x33624f);}})['then'](function(_0x2ecff5){if(_0x2ecff5){_0x5d65e9=_0x2ecff5[_0xf105('0x1a')];if(!_0x400103['query'][_0xf105('0x1b')](_0xf105('0x1c'))){_0x33624f[_0xf105('0x6')]=qs[_0xf105('0x6')](_0x400103['query'][_0xf105('0x6')]);_0x33624f[_0xf105('0x4')]=qs[_0xf105('0x4')](_0x400103[_0xf105('0x16')]['offset']);}return _0x1f2509['getConfigurations'](_0x33624f);}})[_0xf105('0xb')](function(_0x10dbd7){if(_0x10dbd7){return _0x10dbd7?{'count':_0x5d65e9,'rows':_0x10dbd7}:null;}})['then'](respondWithResult(_0x59b75f,null))['catch'](handleError(_0x59b75f,null));};exports['addConfiguration']=function(_0x6977a1,_0x112b46){if(_0x6977a1[_0xf105('0x2f')]['id']){delete _0x6977a1[_0xf105('0x2f')]['id'];}return db[_0xf105('0x25')][_0xf105('0x34')]({'where':{'id':_0x6977a1[_0xf105('0x28')]['id']}})['then'](handleEntityNotFound(_0x112b46,null))[_0xf105('0xb')](function(_0x5d82d2){if(_0x5d82d2){_0x6977a1[_0xf105('0x2f')]['AccountId']=_0x5d82d2['id'];_0x6977a1[_0xf105('0x2f')][_0xf105('0x35')]=integrations[_0xf105('0x36')](_0x6977a1[_0xf105('0x2f')]['channel'],_0x6977a1[_0xf105('0x2f')][_0xf105('0x13')]);_0x6977a1[_0xf105('0x2f')][_0xf105('0x37')]=integrations[_0xf105('0x38')](_0x6977a1[_0xf105('0x2f')][_0xf105('0x39')],_0x6977a1[_0xf105('0x2f')][_0xf105('0x13')]);return db[_0xf105('0x32')][_0xf105('0x2e')](_0x6977a1[_0xf105('0x2f')],{'include':[{'model':db[_0xf105('0x3a')],'as':_0xf105('0x35')},{'model':db[_0xf105('0x3a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x112b46,null))[_0xf105('0x2d')](handleError(_0x112b46,null));};function sanitizeRemoteUri(_0x322082){var _0x32bd5d=_0x322082[_0xf105('0x3b')](-0x1);if(_0x32bd5d==='/')return _0x322082[_0xf105('0x3c')](0x0,_0x322082[_0xf105('0x3d')](_0x32bd5d));return _0x322082;}function getWebApiUrl(_0x158eeb){return util['format'](_0xf105('0x3e'),_0x158eeb);}exports[_0xf105('0x3f')]=function(_0x2d8b1b,_0xf1fab6){var _0x521662=_0x2d8b1b[_0xf105('0x16')]['ticketType'];var _0x109e6a=_0x521662===_0xf105('0x40')?_0xf105('0x41'):_0xf105('0x42');var _0xd5ec2f='';var _0x4fbe8b='';var _0x160703='';var _0x58152b='';var _0x24207c='';var _0x4bf374='';var _0x4b7423='';var _0x3b7920='';var _0x380fba=[_0xf105('0x43'),_0xf105('0x44'),'customerid',_0xf105('0x45'),_0xf105('0x46'),_0xf105('0x47'),'phonenumber','regardingobjectid',_0xf105('0x48'),_0xf105('0x49')];var _0x15f9c7=[_0xf105('0x4a'),_0xf105('0x4b'),'actualserviceunits','billedserviceunits',_0xf105('0x4c'),_0xf105('0x4d'),_0xf105('0x4e'),_0xf105('0x4f'),_0xf105('0x50'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0xf105('0x51'),_0xf105('0x52'),_0xf105('0x53'),_0xf105('0x54'),_0xf105('0x55'),_0xf105('0x56'),_0xf105('0x57'),_0xf105('0x58'),_0xf105('0x59'),_0xf105('0x5a'),_0xf105('0x5b'),'exchangerate',_0xf105('0x5c'),_0xf105('0x5d'),_0xf105('0x5e'),_0xf105('0x5f'),_0xf105('0x60'),'lastonholdtime',_0xf105('0x61'),_0xf105('0x62'),_0xf105('0x63'),_0xf105('0x64'),_0xf105('0x65'),_0xf105('0x66'),_0xf105('0x67'),_0xf105('0x68'),_0xf105('0x69'),'msdyn_iotalertname',_0xf105('0x6a'),_0xf105('0x6b'),'overriddencreatedon','owneridname',_0xf105('0x6c'),_0xf105('0x6d'),'parentcaseidname',_0xf105('0x6e'),'primarycontactidyominame',_0xf105('0x6f'),_0xf105('0x70'),_0xf105('0x71'),'resolveby',_0xf105('0x72'),_0xf105('0x73'),'responsiblecontactidname','responsiblecontactidyominame',_0xf105('0x74'),'slainvokedidname',_0xf105('0x75'),'socialprofileidname',_0xf105('0x76'),_0xf105('0x77'),_0xf105('0x78'),_0xf105('0x79'),_0xf105('0x7a'),'transactioncurrencyidname','traversedpath',_0xf105('0x7b'),_0xf105('0x7c')];var _0x346030=_0x380fba[_0xf105('0x7d')](_0x15f9c7);return db[_0xf105('0x25')][_0xf105('0x34')]({'where':{'id':_0x2d8b1b['params']['id']},'attributes':['id',_0xf105('0x7e'),'password','remoteUri',_0xf105('0x7f'),_0xf105('0x80'),_0xf105('0x81'),_0xf105('0x82')],'include':[{'model':db['CloudProvider'],'as':_0xf105('0x83'),'attributes':['id',_0xf105('0x84'),_0xf105('0x85')]}]})[_0xf105('0xb')](handleEntityNotFound(_0xf1fab6,null))['then'](function(_0x2f60f7){if(_0x2f60f7){if(_0x2f60f7[_0xf105('0x82')]){_0x2f60f7[_0xf105('0x86')]=_0x2f60f7['CloudProvider']['data5'];_0x3b7920=sanitizeRemoteUri(_0x2f60f7[_0xf105('0x83')][_0xf105('0x85')]);_0x4b7423=getWebApiUrl(_0x3b7920);return _0x2f60f7;}_0x3b7920=sanitizeRemoteUri(_0x2f60f7[_0xf105('0x87')]);_0x4b7423=getWebApiUrl(_0x3b7920);var _0x3de2fb={'method':'POST','uri':_0xf105('0x88')+_0x2f60f7['tenantId']+_0xf105('0x89'),'form':{'client_id':_0x2f60f7['clientId'],'resource':_0x3b7920,'username':_0x2f60f7['username'],'password':_0x2f60f7[_0xf105('0x8a')],'grant_type':_0xf105('0x8a'),'client_secret':_0x2f60f7['clientSecret']},'json':!![]};return rp(_0x3de2fb);}})[_0xf105('0xb')](function(_0x52ecc7){_0x4bf374=_0x52ecc7['access_token'];var _0x470bdc={'method':'GET','uri':encodeURI(_0x4b7423+_0xf105('0x8b')+_0x109e6a+'\x27'),'headers':{'Authorization':_0xf105('0x8c')+_0x4bf374,'If-None-Match':null,'OData-Version':_0xf105('0x8d')},'json':!![]};return rp(_0x470bdc);})[_0xf105('0xb')](function(_0x5ee864){var _0x1440fd=_0x5ee864[_0xf105('0x8e')][0x0];var _0x34b35c=_0x1440fd[_0xf105('0x8f')];var _0xac21={'method':_0xf105('0x90'),'uri':_0x4b7423+_0xf105('0x91')+_0x34b35c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf105('0x8c')+_0x4bf374,'If-None-Match':null,'OData-Version':_0xf105('0x8d')},'json':!![]};return rp(_0xac21);})[_0xf105('0xb')](function(_0x39703a){_0xd5ec2f=_0x39703a;_0x4fbe8b=_0xd5ec2f[_0xf105('0x92')];_0x4fbe8b=_['remove'](_0x4fbe8b,function(_0x3bd40b){return!_0x346030[_0xf105('0x93')](_0x3bd40b[_0xf105('0x94')]);});var _0x3b392e=[];var _0x225d38=[];_0x4fbe8b[_0xf105('0x95')](function(_0x32d188){if(_0x32d188[_0xf105('0x96')]){var _0x729aa2=_0x32d188[_0xf105('0x96')][_0xf105('0x3c')](_0x32d188[_0xf105('0x96')]['lastIndexOf']('.')+0x1);if(_0x729aa2===_0xf105('0x97')){_0x3b392e[_0xf105('0x98')](getSelectList(_0x4b7423,_0x521662,_0x225d38,_0xd5ec2f[_0xf105('0x8f')],_0x32d188[_0xf105('0x8f')],_0x4bf374));}}});return Promise[_0xf105('0x99')](_0x3b392e);})[_0xf105('0xb')](function(_0xc1cf3a){_0x160703=_0xc1cf3a[0x0];var _0x25e8c8=[];var _0x519f20=[];_0x4fbe8b[_0xf105('0x95')](function(_0x1b3117){if(!_[_0xf105('0x9a')](_0x1b3117['@odata.type'])){var _0x441d08=_0x1b3117[_0xf105('0x96')]['substring'](_0x1b3117[_0xf105('0x96')][_0xf105('0x3d')]('.')+0x1);if(_0x441d08==='BooleanAttributeMetadata'){_0x25e8c8[_0xf105('0x98')](getBooleanList(_0x4b7423,_0x521662,_0x519f20,_0xd5ec2f['MetadataId'],_0x1b3117['MetadataId'],_0x4bf374));}}});return Promise[_0xf105('0x99')](_0x25e8c8);})[_0xf105('0xb')](function(_0x53f45c){_0x58152b=_0x53f45c[0x0];var _0x28c27b=[];var _0x5ae7ba=[];_0x4fbe8b[_0xf105('0x95')](function(_0x58ec27){if(_0x58ec27[_0xf105('0x96')]){var _0x493998=_0x58ec27[_0xf105('0x96')][_0xf105('0x3c')](_0x58ec27['@odata.type'][_0xf105('0x3d')]('.')+0x1);if(_0x493998===_0xf105('0x9b')||_0x493998===_0xf105('0x9c')||_0x493998===_0xf105('0x9d')||_0x493998===_0xf105('0x9e')||_0x493998===_0xf105('0x9f')||_0x493998===_0xf105('0xa0')||_0x493998===_0xf105('0xa1')||_0x493998===_0xf105('0xa2')||_0x493998===_0xf105('0xa3')||_0x493998===_0xf105('0xa4')){_0x28c27b[_0xf105('0x98')](getInputList(_0x4b7423,_0x521662,_0x493998,_0x5ae7ba,_0xd5ec2f[_0xf105('0x8f')],_0x58ec27[_0xf105('0x8f')],_0x4bf374));}}});return Promise['all'](_0x28c27b);})['then'](function(_0x349ded){_0x24207c=_0x349ded[0x0];var _0x3b7ee1=_0x160703[_0xf105('0x7d')](_0x58152b)[_0xf105('0x7d')](_0x24207c);var _0x4bde98={'count':_0x3b7ee1['length'],'rows':_0x3b7ee1};return _0x4bde98;})[_0xf105('0xb')](respondWithResult(_0xf1fab6,null))[_0xf105('0x2d')](function(_0x57c253){var _0x25db3a=_0x2d8b1b[_0xf105('0x16')]['test']?0x1f4:_0x57c253['statusCode']||0x1f4;logger[_0xf105('0xa5')](_0x57c253['stack']);delete _0x57c253[_0xf105('0xf')];if(_0x25db3a===0x191){_0x25db3a=0x190;}_0xf1fab6[_0xf105('0x8')](_0x25db3a)[_0xf105('0xa6')](_0x2d8b1b[_0xf105('0x16')][_0xf105('0xa7')]?{'message':_0xf105('0xa8'),'statusCode':_0x57c253[_0xf105('0xa9')]}:_0x57c253);});};function getSelectList(_0x53690e,_0x59a9b1,_0x26fe5d,_0xd20ada,_0x6fc0e0,_0x224368){var _0x3d2e83={'method':_0xf105('0x90'),'uri':_0x53690e+_0xf105('0x91')+_0xd20ada+_0xf105('0xaa')+_0x6fc0e0+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xf105('0xab'),'headers':{'Authorization':_0xf105('0x8c')+_0x224368,'If-None-Match':null,'OData-Version':_0xf105('0x8d')},'json':!![]};return rp(_0x3d2e83)[_0xf105('0xb')](function(_0x57a112){var _0x22e10b=[];var _0x19989d=_0x57a112['OptionSet'][_0xf105('0xac')];_0x19989d['forEach'](function(_0x5097d7){_0x22e10b[_0xf105('0x98')]({'name':_0x5097d7[_0xf105('0xad')][_0xf105('0xae')][_0xf105('0xad')],'value':String(_0x5097d7['Value'])});});var _0x29f175={'id':_0x59a9b1+'_'+_0x57a112[_0xf105('0x94')],'name':_0x57a112[_0xf105('0xaf')][_0xf105('0xae')]['Label'],'custom':![],'options':_0x22e10b};_0x26fe5d[_0xf105('0x98')](_0x29f175);return _0x26fe5d;});}function getBooleanList(_0x513590,_0x52f844,_0x52a61f,_0x356961,_0xe78d75,_0x1a7978){var _0x47494b={'method':'GET','uri':_0x513590+_0xf105('0x91')+_0x356961+_0xf105('0xaa')+_0xe78d75+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xf105('0x8c')+_0x1a7978,'If-None-Match':null,'OData-Version':_0xf105('0x8d')},'json':!![]};return rp(_0x47494b)[_0xf105('0xb')](function(_0x29d0e6){var _0x944ed5=[];_0x944ed5['push']({'name':_0x29d0e6[_0xf105('0xb0')]['TrueOption'][_0xf105('0xad')][_0xf105('0xae')]['Label'],'value':_0xf105('0xb1')},{'name':_0x29d0e6[_0xf105('0xb0')]['FalseOption']['Label'][_0xf105('0xae')][_0xf105('0xad')],'value':_0xf105('0xb2')});var _0x52ce29={'id':_0x52f844+'_'+_0x29d0e6[_0xf105('0x94')],'name':_0x29d0e6[_0xf105('0xaf')]['UserLocalizedLabel'][_0xf105('0xad')],'custom':![],'options':_0x944ed5};_0x52a61f['push'](_0x52ce29);return _0x52a61f;});}function getInputList(_0x2b3fc4,_0x17b49a,_0x34131a,_0x28bf6f,_0x14fd0a,_0x5cd09d,_0x528f80){var _0x1418cd={'method':_0xf105('0x90'),'uri':_0x2b3fc4+_0xf105('0x91')+_0x14fd0a+_0xf105('0xaa')+_0x5cd09d+_0xf105('0xb3')+_0x34131a+_0xf105('0xb4'),'headers':{'Authorization':_0xf105('0x8c')+_0x528f80,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1418cd)[_0xf105('0xb')](function(_0x1e6fa9){var _0x415528={'id':_0x17b49a+'_'+_0x1e6fa9[_0xf105('0x94')],'name':_0x1e6fa9[_0xf105('0xaf')][_0xf105('0xae')]?_0x1e6fa9['DisplayName'][_0xf105('0xae')][_0xf105('0xad')]:_0x1e6fa9[_0xf105('0x94')],'custom':![],'options':[]};_0x28bf6f[_0xf105('0x98')](_0x415528);return _0x28bf6f;});}
\ No newline at end of file
index 1984120..e2ef978 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x2a4aa9,_0x3d4201){var _0x12be74=function(_0x5accc5){while(--_0x5accc5){_0x2a4aa9['push'](_0x2a4aa9['shift']());}};_0x12be74(++_0x3d4201);}(_0x757a,0xde));var _0xa757=function(_0x2f4599,_0x2bea36){_0x2f4599=_0x2f4599-0x0;var _0x33e51f=_0x757a[_0x2f4599];return _0x33e51f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x232792,_0x45150a){var _0x5a1a4f=function(_0x43a4d0){while(--_0x43a4d0){_0x232792['push'](_0x232792['shift']());}};_0x5a1a4f(++_0x45150a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0xcb91[_0xd578cb];return _0x775533;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1161f29..0a79c17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54c7=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','where','attributes','limit','include','map','model','debug','ShowDynamics365Account','find','lodash','moment','bluebird'];(function(_0x3c2701,_0x119d6e){var _0x570f77=function(_0x522811){while(--_0x522811){_0x3c2701['push'](_0x3c2701['shift']());}};_0x570f77(++_0x119d6e);}(_0x54c7,0x138));var _0x754c=function(_0x17d451,_0x447b31){_0x17d451=_0x17d451-0x0;var _0x3cb4bc=_0x54c7[_0x17d451];return _0x3cb4bc;};'use strict';var _=require(_0x754c('0x0'));var util=require('util');var moment=require(_0x754c('0x1'));var BPromise=require(_0x754c('0x2'));var rs=require(_0x754c('0x3'));var fs=require('fs');var Redis=require(_0x754c('0x4'));var db=require(_0x754c('0x5'))['db'];var utils=require(_0x754c('0x6'));var logger=require('../../config/logger')(_0x754c('0x7'));var config=require('../../config/environment');var jayson=require(_0x754c('0x8'));var client=jayson[_0x754c('0x9')][_0x754c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213f8c,_0x2d7830,_0x28b6fb){return new BPromise(function(_0x126831,_0x11009b){return client[_0x754c('0xb')](_0x213f8c,_0x28b6fb)[_0x754c('0xc')](function(_0x1df897){logger[_0x754c('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2d7830,_0x754c('0xe'));logger['debug'](_0x754c('0xf'),_0x2d7830,_0x754c('0xe'),JSON[_0x754c('0x10')](_0x1df897));if(_0x1df897[_0x754c('0x11')]){if(_0x1df897[_0x754c('0x11')][_0x754c('0x12')]===0x1f4){logger['error'](_0x754c('0x13'),_0x2d7830,_0x1df897[_0x754c('0x11')]['message']);return _0x11009b(_0x1df897[_0x754c('0x11')][_0x754c('0x14')]);}logger['error'](_0x754c('0x13'),_0x2d7830,_0x1df897[_0x754c('0x11')][_0x754c('0x14')]);return _0x126831(_0x1df897[_0x754c('0x11')][_0x754c('0x14')]);}else{logger[_0x754c('0xd')](_0x754c('0x13'),_0x2d7830,_0x754c('0xe'));_0x126831(_0x1df897[_0x754c('0x15')][_0x754c('0x14')]);}})[_0x754c('0x16')](function(_0x1e25ab){logger[_0x754c('0x11')](_0x754c('0x13'),_0x2d7830,_0x1e25ab);_0x11009b(_0x1e25ab);});});}exports[_0x754c('0x17')]=function(_0x20fe2c){var _0xd01ab6=this;return new Promise(function(_0x57a031,_0x575133){return db['Dynamics365Account'][_0x754c('0x18')]({'raw':_0x20fe2c['options']?_0x20fe2c[_0x754c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x20fe2c['options']?_0x20fe2c['options'][_0x754c('0x1a')]||null:null,'attributes':_0x20fe2c[_0x754c('0x19')]?_0x20fe2c[_0x754c('0x19')][_0x754c('0x1b')]||null:null,'limit':_0x20fe2c['options']?_0x20fe2c[_0x754c('0x19')][_0x754c('0x1c')]||null:null,'include':_0x20fe2c['options']?_0x20fe2c[_0x754c('0x19')][_0x754c('0x1d')]?_[_0x754c('0x1e')](_0x20fe2c[_0x754c('0x19')][_0x754c('0x1d')],function(_0x2fea5c){return{'model':db[_0x2fea5c['model']],'as':_0x2fea5c['as'],'attributes':_0x2fea5c[_0x754c('0x1b')],'include':_0x2fea5c[_0x754c('0x1d')]?_['map'](_0x2fea5c['include'],function(_0x3a0b82){return{'model':db[_0x3a0b82[_0x754c('0x1f')]],'as':_0x3a0b82['as'],'attributes':_0x3a0b82[_0x754c('0x1b')],'include':_0x3a0b82[_0x754c('0x1d')]?_[_0x754c('0x1e')](_0x3a0b82[_0x754c('0x1d')],function(_0x1f3098){return{'model':db[_0x1f3098[_0x754c('0x1f')]],'as':_0x1f3098['as'],'attributes':_0x1f3098[_0x754c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x754c('0xc')](function(_0x5d2155){logger[_0x754c('0xd')](_0x754c('0x17'),_0x20fe2c);logger[_0x754c('0x20')](_0x754c('0x17'),_0x20fe2c,JSON['stringify'](_0x5d2155));_0x57a031(_0x5d2155);})[_0x754c('0x16')](function(_0x37648e){logger[_0x754c('0x11')]('GetDynamics365Account',_0x37648e[_0x754c('0x14')],_0x20fe2c);_0x575133(_0xd01ab6[_0x754c('0x11')](0x1f4,_0x37648e['message']));});});};exports[_0x754c('0x21')]=function(_0x380e67){var _0x361081=this;return new Promise(function(_0x3c713b,_0x18b780){return db['Dynamics365Account'][_0x754c('0x22')]({'raw':_0x380e67[_0x754c('0x19')]?_0x380e67['options']['raw']===undefined?!![]:![]:!![],'where':_0x380e67[_0x754c('0x19')]?_0x380e67[_0x754c('0x19')][_0x754c('0x1a')]||null:null,'attributes':_0x380e67[_0x754c('0x19')]?_0x380e67[_0x754c('0x19')]['attributes']||null:null,'include':_0x380e67[_0x754c('0x19')]?_0x380e67[_0x754c('0x19')][_0x754c('0x1d')]?_['map'](_0x380e67[_0x754c('0x19')][_0x754c('0x1d')],function(_0x2dc8e1){return{'model':db[_0x2dc8e1[_0x754c('0x1f')]],'as':_0x2dc8e1['as'],'attributes':_0x2dc8e1[_0x754c('0x1b')],'include':_0x2dc8e1[_0x754c('0x1d')]?_[_0x754c('0x1e')](_0x2dc8e1[_0x754c('0x1d')],function(_0x58ec68){return{'model':db[_0x58ec68[_0x754c('0x1f')]],'as':_0x58ec68['as'],'attributes':_0x58ec68[_0x754c('0x1b')],'include':_0x58ec68[_0x754c('0x1d')]?_[_0x754c('0x1e')](_0x58ec68[_0x754c('0x1d')],function(_0x29ee4c){return{'model':db[_0x29ee4c['model']],'as':_0x29ee4c['as'],'attributes':_0x29ee4c[_0x754c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1944a2){logger[_0x754c('0xd')]('ShowDynamics365Account',_0x380e67);logger[_0x754c('0x20')](_0x754c('0x21'),_0x380e67,JSON[_0x754c('0x10')](_0x1944a2));_0x3c713b(_0x1944a2);})[_0x754c('0x16')](function(_0x1d0525){logger['error'](_0x754c('0x21'),_0x1d0525['message'],_0x380e67);_0x18b780(_0x361081[_0x754c('0x11')](0x1f4,_0x1d0525['message']));});});};
\ No newline at end of file
+var _0x6b6a=['code','message','catch','Dynamics365Account','findAll','options','where','attributes','include','map','model','then','GetDynamics365Account','ShowDynamics365Account','find','lodash','randomstring','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xce0583,_0x30efb4){var _0x57a041=function(_0x34ef7e){while(--_0x34ef7e){_0xce0583['push'](_0xce0583['shift']());}};_0x57a041(++_0x30efb4);}(_0x6b6a,0x1c2));var _0xa6b6=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x6b6a[_0x15b192];return _0x396e73;};'use strict';var _=require(_0xa6b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa6b6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6b6('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa6b6('0x3'));var client=jayson[_0xa6b6('0x4')][_0xa6b6('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x9e2bab,_0x2512dc,_0x235b11){return new BPromise(function(_0xa07f7c,_0x5215a3){return client[_0xa6b6('0x6')](_0x9e2bab,_0x235b11)['then'](function(_0x24dc02){logger[_0xa6b6('0x7')](_0xa6b6('0x8'),_0x2512dc,_0xa6b6('0x9'));logger[_0xa6b6('0xa')](_0xa6b6('0xb'),_0x2512dc,_0xa6b6('0x9'),JSON[_0xa6b6('0xc')](_0x24dc02));if(_0x24dc02[_0xa6b6('0xd')]){if(_0x24dc02[_0xa6b6('0xd')][_0xa6b6('0xe')]===0x1f4){logger[_0xa6b6('0xd')](_0xa6b6('0x8'),_0x2512dc,_0x24dc02[_0xa6b6('0xd')][_0xa6b6('0xf')]);return _0x5215a3(_0x24dc02[_0xa6b6('0xd')][_0xa6b6('0xf')]);}logger[_0xa6b6('0xd')](_0xa6b6('0x8'),_0x2512dc,_0x24dc02[_0xa6b6('0xd')][_0xa6b6('0xf')]);return _0xa07f7c(_0x24dc02[_0xa6b6('0xd')][_0xa6b6('0xf')]);}else{logger['info'](_0xa6b6('0x8'),_0x2512dc,_0xa6b6('0x9'));_0xa07f7c(_0x24dc02['result'][_0xa6b6('0xf')]);}})[_0xa6b6('0x10')](function(_0x49a9a8){logger[_0xa6b6('0xd')](_0xa6b6('0x8'),_0x2512dc,_0x49a9a8);_0x5215a3(_0x49a9a8);});});}exports['GetDynamics365Account']=function(_0x48de39){var _0x4ef18b=this;return new Promise(function(_0x3dc748,_0x6396b7){return db[_0xa6b6('0x11')][_0xa6b6('0x12')]({'raw':_0x48de39[_0xa6b6('0x13')]?_0x48de39[_0xa6b6('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x48de39['options']?_0x48de39['options'][_0xa6b6('0x14')]||null:null,'attributes':_0x48de39[_0xa6b6('0x13')]?_0x48de39['options'][_0xa6b6('0x15')]||null:null,'limit':_0x48de39[_0xa6b6('0x13')]?_0x48de39[_0xa6b6('0x13')]['limit']||null:null,'include':_0x48de39[_0xa6b6('0x13')]?_0x48de39[_0xa6b6('0x13')][_0xa6b6('0x16')]?_[_0xa6b6('0x17')](_0x48de39['options'][_0xa6b6('0x16')],function(_0x18e873){return{'model':db[_0x18e873[_0xa6b6('0x18')]],'as':_0x18e873['as'],'attributes':_0x18e873['attributes'],'include':_0x18e873[_0xa6b6('0x16')]?_[_0xa6b6('0x17')](_0x18e873[_0xa6b6('0x16')],function(_0x24ba32){return{'model':db[_0x24ba32[_0xa6b6('0x18')]],'as':_0x24ba32['as'],'attributes':_0x24ba32['attributes'],'include':_0x24ba32[_0xa6b6('0x16')]?_[_0xa6b6('0x17')](_0x24ba32['include'],function(_0x87aaa3){return{'model':db[_0x87aaa3[_0xa6b6('0x18')]],'as':_0x87aaa3['as'],'attributes':_0x87aaa3[_0xa6b6('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa6b6('0x19')](function(_0x22077a){logger[_0xa6b6('0x7')](_0xa6b6('0x1a'),_0x48de39);logger[_0xa6b6('0xa')]('GetDynamics365Account',_0x48de39,JSON[_0xa6b6('0xc')](_0x22077a));_0x3dc748(_0x22077a);})['catch'](function(_0x2cf9d7){logger['error'](_0xa6b6('0x1a'),_0x2cf9d7['message'],_0x48de39);_0x6396b7(_0x4ef18b[_0xa6b6('0xd')](0x1f4,_0x2cf9d7[_0xa6b6('0xf')]));});});};exports[_0xa6b6('0x1b')]=function(_0x28f13a){var _0x2ae1f3=this;return new Promise(function(_0x4a9274,_0x58dc22){return db[_0xa6b6('0x11')][_0xa6b6('0x1c')]({'raw':_0x28f13a[_0xa6b6('0x13')]?_0x28f13a['options']['raw']===undefined?!![]:![]:!![],'where':_0x28f13a[_0xa6b6('0x13')]?_0x28f13a[_0xa6b6('0x13')]['where']||null:null,'attributes':_0x28f13a[_0xa6b6('0x13')]?_0x28f13a[_0xa6b6('0x13')]['attributes']||null:null,'include':_0x28f13a[_0xa6b6('0x13')]?_0x28f13a[_0xa6b6('0x13')]['include']?_[_0xa6b6('0x17')](_0x28f13a[_0xa6b6('0x13')][_0xa6b6('0x16')],function(_0x1bed17){return{'model':db[_0x1bed17[_0xa6b6('0x18')]],'as':_0x1bed17['as'],'attributes':_0x1bed17['attributes'],'include':_0x1bed17['include']?_[_0xa6b6('0x17')](_0x1bed17['include'],function(_0xe621e4){return{'model':db[_0xe621e4[_0xa6b6('0x18')]],'as':_0xe621e4['as'],'attributes':_0xe621e4[_0xa6b6('0x15')],'include':_0xe621e4[_0xa6b6('0x16')]?_[_0xa6b6('0x17')](_0xe621e4[_0xa6b6('0x16')],function(_0x7f6766){return{'model':db[_0x7f6766[_0xa6b6('0x18')]],'as':_0x7f6766['as'],'attributes':_0x7f6766[_0xa6b6('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa6b6('0x19')](function(_0x207faa){logger['info'](_0xa6b6('0x1b'),_0x28f13a);logger[_0xa6b6('0xa')](_0xa6b6('0x1b'),_0x28f13a,JSON['stringify'](_0x207faa));_0x4a9274(_0x207faa);})[_0xa6b6('0x10')](function(_0x24ec56){logger[_0xa6b6('0xd')](_0xa6b6('0x1b'),_0x24ec56[_0xa6b6('0xf')],_0x28f13a);_0x58dc22(_0x2ae1f3[_0xa6b6('0xd')](0x1f4,_0x24ec56[_0xa6b6('0xf')]));});});};
\ No newline at end of file
index 456b6b8..ed7f083 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9296=['getFields','get','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x56d110,_0x1d6665){var _0x209daf=function(_0xda50b){while(--_0xda50b){_0x56d110['push'](_0x56d110['shift']());}};_0x209daf(++_0x1d6665);}(_0x9296,0x10d));var _0x6929=function(_0x4d4db3,_0x779102){_0x4d4db3=_0x4d4db3-0x0;var _0x3989f9=_0x9296[_0x4d4db3];return _0x3989f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6929('0x0'));var timeout=require('connect-timeout');var express=require(_0x6929('0x1'));var router=express[_0x6929('0x2')]();var fs_extra=require(_0x6929('0x3'));var auth=require(_0x6929('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6929('0x5'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x6929('0x6')](),controller[_0x6929('0x7')]);router['get'](_0x6929('0x8'),auth[_0x6929('0x6')](),controller[_0x6929('0x9')]);router['get'](_0x6929('0xa'),auth[_0x6929('0x6')](),controller[_0x6929('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x6929('0xc')](_0x6929('0xd'),auth['isAuthenticated'](),controller[_0x6929('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6929('0xf')]);router['put'](_0x6929('0x8'),auth['isAuthenticated'](),controller[_0x6929('0x10')]);router[_0x6929('0x11')](_0x6929('0x8'),auth[_0x6929('0x6')](),controller[_0x6929('0x12')]);module[_0x6929('0x13')]=router;
\ No newline at end of file
+var _0xf4a0=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xf4a0,0x1f2));var _0x0f4a=function(_0x5accf1,_0x521711){_0x5accf1=_0x5accf1-0x0;var _0x2304ab=_0xf4a0[_0x5accf1];return _0x2304ab;};'use strict';var multer=require(_0x0f4a('0x0'));var util=require(_0x0f4a('0x1'));var path=require(_0x0f4a('0x2'));var timeout=require(_0x0f4a('0x3'));var express=require(_0x0f4a('0x4'));var router=express[_0x0f4a('0x5')]();var fs_extra=require(_0x0f4a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0f4a('0x7'));var config=require(_0x0f4a('0x8'));var controller=require(_0x0f4a('0x9'));router['get']('/',auth[_0x0f4a('0xa')](),controller[_0x0f4a('0xb')]);router['get'](_0x0f4a('0xc'),auth[_0x0f4a('0xa')](),controller[_0x0f4a('0xd')]);router[_0x0f4a('0xe')]('/:id/fields',auth[_0x0f4a('0xa')](),controller[_0x0f4a('0xf')]);router['get'](_0x0f4a('0x10'),auth[_0x0f4a('0xa')](),controller['getSubjects']);router[_0x0f4a('0xe')](_0x0f4a('0x11'),auth[_0x0f4a('0xa')](),controller[_0x0f4a('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0f4a('0x13')]);router[_0x0f4a('0x14')](_0x0f4a('0xc'),auth['isAuthenticated'](),controller[_0x0f4a('0x15')]);router[_0x0f4a('0x16')](_0x0f4a('0xc'),auth[_0x0f4a('0xa')](),controller['destroy']);module[_0x0f4a('0x17')]=router;
\ No newline at end of file
index ab0a376..94659ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x782e=['exports','STRING','ENUM','phonecall','incident','contact','nothing','BOOLEAN','sequelize'];(function(_0x201cd0,_0x50f50b){var _0x1e44cb=function(_0x216aa7){while(--_0x216aa7){_0x201cd0['push'](_0x201cd0['shift']());}};_0x1e44cb(++_0x50f50b);}(_0x782e,0x1ee));var _0xe782=function(_0x49218c,_0x264921){_0x49218c=_0x49218c-0x0;var _0x5b955e=_0x782e[_0x49218c];return _0x5b955e;};'use strict';var Sequelize=require(_0xe782('0x0'));module[_0xe782('0x1')]={'name':{'type':Sequelize[_0xe782('0x2')]},'description':{'type':Sequelize[_0xe782('0x2')]},'ticketType':{'type':Sequelize[_0xe782('0x3')]('incident',_0xe782('0x4')),'defaultValue':_0xe782('0x5')},'moduleCreate':{'type':Sequelize[_0xe782('0x3')](_0xe782('0x6'),_0xe782('0x7')),'defaultValue':_0xe782('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xe782('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xe782('0x8')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x9977=['ENUM','incident','phonecall','contact','nothing','exports','STRING'];(function(_0x340075,_0x36bde0){var _0x4c36fa=function(_0x2733b4){while(--_0x2733b4){_0x340075['push'](_0x340075['shift']());}};_0x4c36fa(++_0x36bde0);}(_0x9977,0x1ef));var _0x7997=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0x9977[_0x4ebdf4];return _0x18d1c1;};'use strict';var Sequelize=require('sequelize');module[_0x7997('0x0')]={'name':{'type':Sequelize[_0x7997('0x1')]},'description':{'type':Sequelize[_0x7997('0x1')]},'ticketType':{'type':Sequelize[_0x7997('0x2')](_0x7997('0x3'),_0x7997('0x4')),'defaultValue':_0x7997('0x3')},'moduleCreate':{'type':Sequelize[_0x7997('0x2')](_0x7997('0x5'),_0x7997('0x6')),'defaultValue':_0x7997('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7997('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
index f0cb55c..a8ba9be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88c5=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','nolimit','sort','where','filters','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','catch','show','params','fields','options','find','create','body','getFields','Dynamics365Field','order','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch'];(function(_0x380fa9,_0x5123eb){var _0x4f2532=function(_0x4bde43){while(--_0x4bde43){_0x380fa9['push'](_0x380fa9['shift']());}};_0x4f2532(++_0x5123eb);}(_0x88c5,0x183));var _0x588c=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0x88c5[_0x1fc1f9];return _0x4987ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x588c('0x0'));var zipdir=require(_0x588c('0x1'));var jsonpatch=require(_0x588c('0x2'));var rp=require(_0x588c('0x3'));var moment=require(_0x588c('0x4'));var BPromise=require(_0x588c('0x5'));var Mustache=require('mustache');var util=require(_0x588c('0x6'));var path=require(_0x588c('0x7'));var sox=require(_0x588c('0x8'));var csv=require(_0x588c('0x9'));var ejs=require(_0x588c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x588c('0xb'));var squel=require(_0x588c('0xc'));var crypto=require(_0x588c('0xd'));var jsforce=require(_0x588c('0xe'));var deskjs=require(_0x588c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x588c('0x10'));var Papa=require(_0x588c('0x11'));var Redis=require(_0x588c('0x12'));var authService=require(_0x588c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x588c('0x14'));var logger=require(_0x588c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x588c('0x16'));var licenseUtil=require(_0x588c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5090dc,_0x1229f8){_0x1229f8=_0x1229f8||0xcc;return function(_0x96b424){if(_0x96b424){return _0x5090dc[_0x588c('0x18')](_0x1229f8);}return _0x5090dc[_0x588c('0x19')](_0x1229f8)[_0x588c('0x1a')]();};}function respondWithResult(_0x5a6d17,_0x15f567){_0x15f567=_0x15f567||0xc8;return function(_0x15e10d){if(_0x15e10d){return _0x5a6d17[_0x588c('0x19')](_0x15f567)['json'](_0x15e10d);}};}function respondWithFilteredResult(_0x47214f,_0x892dda){return function(_0x2b1b78){if(_0x2b1b78){var _0x1e4da5=typeof _0x892dda[_0x588c('0x1b')]===_0x588c('0x1c')&&typeof _0x892dda[_0x588c('0x1d')]==='undefined';var _0x2ee78a=_0x2b1b78[_0x588c('0x1e')];var _0x5532eb=_0x1e4da5?0x0:_0x892dda[_0x588c('0x1b')];var _0x1d7129=_0x1e4da5?_0x2b1b78[_0x588c('0x1e')]:_0x892dda[_0x588c('0x1b')]+_0x892dda['limit'];var _0x553fa9;if(_0x1d7129>=_0x2ee78a){_0x1d7129=_0x2ee78a;_0x553fa9=0xc8;}else{_0x553fa9=0xce;}_0x47214f['status'](_0x553fa9);return _0x47214f['set'](_0x588c('0x1f'),_0x5532eb+'-'+_0x1d7129+'/'+_0x2ee78a)['json'](_0x2b1b78);}return null;};}function patchUpdates(_0xd01480){return function(_0x310c8f){try{jsonpatch[_0x588c('0x20')](_0x310c8f,_0xd01480,!![]);}catch(_0x1573e9){return BPromise[_0x588c('0x21')](_0x1573e9);}return _0x310c8f['save']();};}function saveUpdates(_0x3eac78,_0x35bb5f){return function(_0xe74ef5){if(_0xe74ef5){return _0xe74ef5[_0x588c('0x22')](_0x3eac78)[_0x588c('0x23')](function(_0x548c6f){return _0x548c6f;});}return null;};}function removeEntity(_0x47effa,_0x252814){return function(_0x3182e9){if(_0x3182e9){return _0x3182e9[_0x588c('0x24')]()['then'](function(){_0x47effa[_0x588c('0x19')](0xcc)[_0x588c('0x1a')]();});}};}function handleEntityNotFound(_0x12604b,_0x3eaa88){return function(_0x121767){if(!_0x121767){_0x12604b[_0x588c('0x18')](0x194);}return _0x121767;};}function handleError(_0x494af4,_0x2bf734){_0x2bf734=_0x2bf734||0x1f4;return function(_0x338306){logger[_0x588c('0x25')](_0x338306['stack']);if(_0x338306['name']){delete _0x338306[_0x588c('0x26')];}_0x494af4[_0x588c('0x19')](_0x2bf734)['send'](_0x338306);};}exports[_0x588c('0x27')]=function(_0x325e7c,_0x207607){var _0x496ee4={},_0x5954d3={},_0x1ceb2f={'count':0x0,'rows':[]};var _0x23f959=_['map'](db[_0x588c('0x28')][_0x588c('0x29')],function(_0xb68516){return{'name':_0xb68516[_0x588c('0x2a')],'type':_0xb68516['type'][_0x588c('0x2b')]};});_0x5954d3[_0x588c('0x2c')]=_['map'](_0x23f959,_0x588c('0x26'));_0x5954d3[_0x588c('0x2d')]=_[_0x588c('0x2e')](_0x325e7c[_0x588c('0x2d')]);_0x5954d3['filters']=_[_0x588c('0x2f')](_0x5954d3[_0x588c('0x2c')],_0x5954d3['query']);_0x496ee4[_0x588c('0x30')]=_[_0x588c('0x2f')](_0x5954d3[_0x588c('0x2c')],qs['fields'](_0x325e7c[_0x588c('0x2d')]['fields']));_0x496ee4[_0x588c('0x30')]=_0x496ee4[_0x588c('0x30')][_0x588c('0x31')]?_0x496ee4[_0x588c('0x30')]:_0x5954d3['model'];if(!_0x325e7c[_0x588c('0x2d')]['hasOwnProperty'](_0x588c('0x32'))){_0x496ee4[_0x588c('0x1d')]=qs[_0x588c('0x1d')](_0x325e7c[_0x588c('0x2d')]['limit']);_0x496ee4[_0x588c('0x1b')]=qs[_0x588c('0x1b')](_0x325e7c['query'][_0x588c('0x1b')]);}_0x496ee4['order']=qs['sort'](_0x325e7c[_0x588c('0x2d')][_0x588c('0x33')]);_0x496ee4[_0x588c('0x34')]=qs[_0x588c('0x35')](_['pick'](_0x325e7c[_0x588c('0x2d')],_0x5954d3[_0x588c('0x35')]),_0x23f959);if(_0x325e7c[_0x588c('0x2d')][_0x588c('0x36')]){_0x496ee4['where']=_[_0x588c('0x37')](_0x496ee4['where'],{'$or':_[_0x588c('0x38')](_0x23f959,function(_0x3df5f9){if(_0x3df5f9[_0x588c('0x39')]!==_0x588c('0x3a')){var _0x1b6011={};_0x1b6011[_0x3df5f9[_0x588c('0x26')]]={'$like':'%'+_0x325e7c[_0x588c('0x2d')]['filter']+'%'};return _0x1b6011;}})});}_0x496ee4=_[_0x588c('0x37')]({},_0x496ee4,_0x325e7c['options']);var _0x3a2d28={'where':_0x496ee4[_0x588c('0x34')]};return db[_0x588c('0x28')][_0x588c('0x1e')](_0x3a2d28)[_0x588c('0x23')](function(_0x2eacab){_0x1ceb2f[_0x588c('0x1e')]=_0x2eacab;if(_0x325e7c[_0x588c('0x2d')][_0x588c('0x3b')]){_0x496ee4[_0x588c('0x3c')]=[{'all':!![]}];}return db[_0x588c('0x28')][_0x588c('0x3d')](_0x496ee4);})['then'](function(_0x398b8d){_0x1ceb2f['rows']=_0x398b8d;return _0x1ceb2f;})['then'](respondWithFilteredResult(_0x207607,_0x496ee4))[_0x588c('0x3e')](handleError(_0x207607,null));};exports[_0x588c('0x3f')]=function(_0x3a8d6a,_0x3a4bfe){var _0x594efe={'raw':![],'where':{'id':_0x3a8d6a[_0x588c('0x40')]['id']}},_0x466442={};_0x466442[_0x588c('0x2c')]=_[_0x588c('0x2e')](db[_0x588c('0x28')][_0x588c('0x29')]);_0x466442[_0x588c('0x2d')]=_[_0x588c('0x2e')](_0x3a8d6a[_0x588c('0x2d')]);_0x466442['filters']=_['intersection'](_0x466442['model'],_0x466442[_0x588c('0x2d')]);_0x594efe[_0x588c('0x30')]=_[_0x588c('0x2f')](_0x466442['model'],qs[_0x588c('0x41')](_0x3a8d6a[_0x588c('0x2d')][_0x588c('0x41')]));_0x594efe[_0x588c('0x30')]=_0x594efe[_0x588c('0x30')]['length']?_0x594efe['attributes']:_0x466442[_0x588c('0x2c')];if(_0x3a8d6a[_0x588c('0x2d')][_0x588c('0x3b')]){_0x594efe[_0x588c('0x3c')]=[{'all':!![]}];}_0x594efe=_['merge']({},_0x594efe,_0x3a8d6a[_0x588c('0x42')]);return db['Dynamics365Configuration'][_0x588c('0x43')](_0x594efe)[_0x588c('0x23')](handleEntityNotFound(_0x3a4bfe,null))[_0x588c('0x23')](respondWithResult(_0x3a4bfe,null))[_0x588c('0x3e')](handleError(_0x3a4bfe,null));};exports['create']=function(_0x480874,_0x601f31){return db[_0x588c('0x28')][_0x588c('0x44')](_0x480874[_0x588c('0x45')],{})[_0x588c('0x23')](respondWithResult(_0x601f31,0xc9))['catch'](handleError(_0x601f31,null));};exports['update']=function(_0x512869,_0x439de1){if(_0x512869['body']['id']){delete _0x512869['body']['id'];}return db[_0x588c('0x28')][_0x588c('0x43')]({'where':{'id':_0x512869[_0x588c('0x40')]['id']}})[_0x588c('0x23')](handleEntityNotFound(_0x439de1,null))['then'](saveUpdates(_0x512869[_0x588c('0x45')],null))[_0x588c('0x23')](respondWithResult(_0x439de1,null))[_0x588c('0x3e')](handleError(_0x439de1,null));};exports[_0x588c('0x24')]=function(_0x380562,_0x3b0b07){return db[_0x588c('0x28')][_0x588c('0x43')]({'where':{'id':_0x380562[_0x588c('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b0b07,null))[_0x588c('0x23')](removeEntity(_0x3b0b07,null))[_0x588c('0x3e')](handleError(_0x3b0b07,null));};exports[_0x588c('0x46')]=function(_0x49c32c,_0x51f9d3,_0x3125bd){var _0x378086={};var _0x100810={};var _0x5a32b6;var _0x581c02;return db[_0x588c('0x28')]['findOne']({'where':{'id':_0x49c32c[_0x588c('0x40')]['id']}})[_0x588c('0x23')](handleEntityNotFound(_0x51f9d3,null))[_0x588c('0x23')](function(_0x57cf14){if(_0x57cf14){_0x5a32b6=_0x57cf14;_0x100810['model']=_[_0x588c('0x2e')](db[_0x588c('0x47')][_0x588c('0x29')]);_0x100810[_0x588c('0x2d')]=_['keys'](_0x49c32c['query']);_0x100810[_0x588c('0x35')]=_[_0x588c('0x2f')](_0x100810['model'],_0x100810['query']);_0x378086[_0x588c('0x30')]=_[_0x588c('0x2f')](_0x100810[_0x588c('0x2c')],qs['fields'](_0x49c32c['query']['fields']));_0x378086[_0x588c('0x30')]=_0x378086[_0x588c('0x30')][_0x588c('0x31')]?_0x378086[_0x588c('0x30')]:_0x100810['model'];_0x378086[_0x588c('0x48')]=qs[_0x588c('0x33')](_0x49c32c['query']['sort']);_0x378086[_0x588c('0x34')]=qs[_0x588c('0x35')](_[_0x588c('0x49')](_0x49c32c['query'],_0x100810[_0x588c('0x35')]));if(_0x49c32c[_0x588c('0x2d')][_0x588c('0x36')]){_0x378086['where']=_[_0x588c('0x37')](_0x378086['where'],{'$or':_[_0x588c('0x38')](_0x378086[_0x588c('0x30')],function(_0x4b411f){var _0x30d835={};_0x30d835[_0x4b411f]={'$like':'%'+_0x49c32c[_0x588c('0x2d')][_0x588c('0x36')]+'%'};return _0x30d835;})});}_0x378086=_[_0x588c('0x37')]({},_0x378086,_0x49c32c[_0x588c('0x42')]);return _0x5a32b6[_0x588c('0x46')](_0x378086);}})[_0x588c('0x23')](function(_0x4f191d){if(_0x4f191d){_0x581c02=_0x4f191d[_0x588c('0x31')];if(!_0x49c32c['query'][_0x588c('0x4a')](_0x588c('0x32'))){_0x378086[_0x588c('0x1d')]=qs[_0x588c('0x1d')](_0x49c32c['query'][_0x588c('0x1d')]);_0x378086['offset']=qs[_0x588c('0x1b')](_0x49c32c['query'][_0x588c('0x1b')]);}return _0x5a32b6[_0x588c('0x46')](_0x378086);}})[_0x588c('0x23')](function(_0x4a588a){if(_0x4a588a){return _0x4a588a?{'count':_0x581c02,'rows':_0x4a588a}:null;}})[_0x588c('0x23')](respondWithResult(_0x51f9d3,null))[_0x588c('0x3e')](handleError(_0x51f9d3,null));};exports[_0x588c('0x4b')]=function(_0x2f1b8c,_0x26f6c3,_0x4cb267){var _0x138136={};var _0x5a820a={};var _0x5b920e;var _0x55e897;return db[_0x588c('0x28')][_0x588c('0x4c')]({'where':{'id':_0x2f1b8c[_0x588c('0x40')]['id']}})[_0x588c('0x23')](handleEntityNotFound(_0x26f6c3,null))[_0x588c('0x23')](function(_0x2c4ee7){if(_0x2c4ee7){_0x5b920e=_0x2c4ee7;_0x5a820a[_0x588c('0x2c')]=_[_0x588c('0x2e')](db[_0x588c('0x47')][_0x588c('0x29')]);_0x5a820a['query']=_['keys'](_0x2f1b8c[_0x588c('0x2d')]);_0x5a820a[_0x588c('0x35')]=_[_0x588c('0x2f')](_0x5a820a[_0x588c('0x2c')],_0x5a820a['query']);_0x138136[_0x588c('0x30')]=_[_0x588c('0x2f')](_0x5a820a[_0x588c('0x2c')],qs[_0x588c('0x41')](_0x2f1b8c[_0x588c('0x2d')]['fields']));_0x138136['attributes']=_0x138136[_0x588c('0x30')]['length']?_0x138136[_0x588c('0x30')]:_0x5a820a[_0x588c('0x2c')];_0x138136[_0x588c('0x48')]=qs[_0x588c('0x33')](_0x2f1b8c['query'][_0x588c('0x33')]);_0x138136[_0x588c('0x34')]=qs[_0x588c('0x35')](_['pick'](_0x2f1b8c[_0x588c('0x2d')],_0x5a820a[_0x588c('0x35')]));if(_0x2f1b8c[_0x588c('0x2d')][_0x588c('0x36')]){_0x138136[_0x588c('0x34')]=_['merge'](_0x138136[_0x588c('0x34')],{'$or':_['map'](_0x138136[_0x588c('0x30')],function(_0xc64831){var _0x48da8b={};_0x48da8b[_0xc64831]={'$like':'%'+_0x2f1b8c['query'][_0x588c('0x36')]+'%'};return _0x48da8b;})});}_0x138136=_[_0x588c('0x37')]({},_0x138136,_0x2f1b8c['options']);return _0x5b920e[_0x588c('0x4b')](_0x138136);}})[_0x588c('0x23')](function(_0x16a302){if(_0x16a302){_0x55e897=_0x16a302[_0x588c('0x31')];if(!_0x2f1b8c[_0x588c('0x2d')]['hasOwnProperty'](_0x588c('0x32'))){_0x138136[_0x588c('0x1d')]=qs['limit'](_0x2f1b8c['query']['limit']);_0x138136['offset']=qs[_0x588c('0x1b')](_0x2f1b8c[_0x588c('0x2d')][_0x588c('0x1b')]);}return _0x5b920e[_0x588c('0x4b')](_0x138136);}})[_0x588c('0x23')](function(_0x547f07){if(_0x547f07){return _0x547f07?{'count':_0x55e897,'rows':_0x547f07}:null;}})[_0x588c('0x23')](respondWithResult(_0x26f6c3,null))['catch'](handleError(_0x26f6c3,null));};exports[_0x588c('0x4d')]=function(_0x23c7c0,_0x540a09,_0x4f7d7c){var _0x14cb83={};var _0x4f68a8={};var _0xe96866;var _0x76e0cc;return db[_0x588c('0x28')]['findOne']({'where':{'id':_0x23c7c0[_0x588c('0x40')]['id']}})[_0x588c('0x23')](handleEntityNotFound(_0x540a09,null))[_0x588c('0x23')](function(_0x26f8e2){if(_0x26f8e2){_0xe96866=_0x26f8e2;_0x4f68a8['model']=_[_0x588c('0x2e')](db[_0x588c('0x47')][_0x588c('0x29')]);_0x4f68a8[_0x588c('0x2d')]=_['keys'](_0x23c7c0['query']);_0x4f68a8[_0x588c('0x35')]=_['intersection'](_0x4f68a8[_0x588c('0x2c')],_0x4f68a8[_0x588c('0x2d')]);_0x14cb83[_0x588c('0x30')]=_[_0x588c('0x2f')](_0x4f68a8[_0x588c('0x2c')],qs[_0x588c('0x41')](_0x23c7c0[_0x588c('0x2d')][_0x588c('0x41')]));_0x14cb83[_0x588c('0x30')]=_0x14cb83[_0x588c('0x30')]['length']?_0x14cb83[_0x588c('0x30')]:_0x4f68a8['model'];_0x14cb83[_0x588c('0x48')]=qs['sort'](_0x23c7c0[_0x588c('0x2d')][_0x588c('0x33')]);_0x14cb83['where']=qs[_0x588c('0x35')](_[_0x588c('0x49')](_0x23c7c0[_0x588c('0x2d')],_0x4f68a8[_0x588c('0x35')]));if(_0x23c7c0['query'][_0x588c('0x36')]){_0x14cb83['where']=_['merge'](_0x14cb83[_0x588c('0x34')],{'$or':_['map'](_0x14cb83[_0x588c('0x30')],function(_0x3aebbe){var _0x47a663={};_0x47a663[_0x3aebbe]={'$like':'%'+_0x23c7c0[_0x588c('0x2d')][_0x588c('0x36')]+'%'};return _0x47a663;})});}_0x14cb83=_[_0x588c('0x37')]({},_0x14cb83,_0x23c7c0[_0x588c('0x42')]);return _0xe96866[_0x588c('0x4d')](_0x14cb83);}})[_0x588c('0x23')](function(_0x52c25f){if(_0x52c25f){_0x76e0cc=_0x52c25f[_0x588c('0x31')];if(!_0x23c7c0[_0x588c('0x2d')][_0x588c('0x4a')](_0x588c('0x32'))){_0x14cb83[_0x588c('0x1d')]=qs[_0x588c('0x1d')](_0x23c7c0['query'][_0x588c('0x1d')]);_0x14cb83[_0x588c('0x1b')]=qs[_0x588c('0x1b')](_0x23c7c0[_0x588c('0x2d')][_0x588c('0x1b')]);}return _0xe96866['getDescriptions'](_0x14cb83);}})[_0x588c('0x23')](function(_0x5a906b){if(_0x5a906b){return _0x5a906b?{'count':_0x76e0cc,'rows':_0x5a906b}:null;}})[_0x588c('0x23')](respondWithResult(_0x540a09,null))[_0x588c('0x3e')](handleError(_0x540a09,null));};
\ No newline at end of file
+var _0xb639=['options','rows','catch','show','params','fields','includeAll','include','create','body','destroy','find','getFields','findOne','Dynamics365Field','length','sort','pick','hasOwnProperty','getSubjects','nolimit','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','order','filter','merge','where','VIRTUAL'];(function(_0x24293,_0x334bfb){var _0xf337e=function(_0x2885be){while(--_0x2885be){_0x24293['push'](_0x24293['shift']());}};_0xf337e(++_0x334bfb);}(_0xb639,0x1ea));var _0x9b63=function(_0x5f0b01,_0x38c683){_0x5f0b01=_0x5f0b01-0x0;var _0x1f62a9=_0xb639[_0x5f0b01];return _0x1f62a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b63('0x0'));var zipdir=require(_0x9b63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9b63('0x2'));var BPromise=require(_0x9b63('0x3'));var Mustache=require(_0x9b63('0x4'));var util=require(_0x9b63('0x5'));var path=require(_0x9b63('0x6'));var sox=require(_0x9b63('0x7'));var csv=require('to-csv');var ejs=require(_0x9b63('0x8'));var fs=require('fs');var fs_extra=require(_0x9b63('0x9'));var _=require(_0x9b63('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b63('0xb'));var deskjs=require(_0x9b63('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9b63('0xd'));var authService=require(_0x9b63('0xe'));var qs=require(_0x9b63('0xf'));var as=require(_0x9b63('0x10'));var hardwareService=require(_0x9b63('0x11'));var logger=require(_0x9b63('0x12'))(_0x9b63('0x13'));var utils=require(_0x9b63('0x14'));var config=require(_0x9b63('0x15'));var licenseUtil=require(_0x9b63('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dfbf2,_0x995eb3){_0x995eb3=_0x995eb3||0xcc;return function(_0x4b61bd){if(_0x4b61bd){return _0x3dfbf2['sendStatus'](_0x995eb3);}return _0x3dfbf2[_0x9b63('0x17')](_0x995eb3)[_0x9b63('0x18')]();};}function respondWithResult(_0x8dc86a,_0x2d05a3){_0x2d05a3=_0x2d05a3||0xc8;return function(_0x24133b){if(_0x24133b){return _0x8dc86a[_0x9b63('0x17')](_0x2d05a3)[_0x9b63('0x19')](_0x24133b);}};}function respondWithFilteredResult(_0x9e1caf,_0x4edae7){return function(_0x76956d){if(_0x76956d){var _0x2bb40e=typeof _0x4edae7[_0x9b63('0x1a')]==='undefined'&&typeof _0x4edae7[_0x9b63('0x1b')]===_0x9b63('0x1c');var _0x5cfc6b=_0x76956d[_0x9b63('0x1d')];var _0xdadff1=_0x2bb40e?0x0:_0x4edae7[_0x9b63('0x1a')];var _0x4b16cd=_0x2bb40e?_0x76956d['count']:_0x4edae7[_0x9b63('0x1a')]+_0x4edae7['limit'];var _0x20b070;if(_0x4b16cd>=_0x5cfc6b){_0x4b16cd=_0x5cfc6b;_0x20b070=0xc8;}else{_0x20b070=0xce;}_0x9e1caf['status'](_0x20b070);return _0x9e1caf[_0x9b63('0x1e')](_0x9b63('0x1f'),_0xdadff1+'-'+_0x4b16cd+'/'+_0x5cfc6b)[_0x9b63('0x19')](_0x76956d);}return null;};}function patchUpdates(_0x1c4d51){return function(_0x2b64f5){try{jsonpatch['apply'](_0x2b64f5,_0x1c4d51,!![]);}catch(_0x14f833){return BPromise['reject'](_0x14f833);}return _0x2b64f5[_0x9b63('0x20')]();};}function saveUpdates(_0x1dff55,_0x5854ca){return function(_0x1c739d){if(_0x1c739d){return _0x1c739d[_0x9b63('0x21')](_0x1dff55)[_0x9b63('0x22')](function(_0x35b78d){return _0x35b78d;});}return null;};}function removeEntity(_0x38752e,_0xf77dd9){return function(_0x4cf50c){if(_0x4cf50c){return _0x4cf50c['destroy']()[_0x9b63('0x22')](function(){_0x38752e[_0x9b63('0x17')](0xcc)[_0x9b63('0x18')]();});}};}function handleEntityNotFound(_0x48c46a,_0x2557c5){return function(_0x386815){if(!_0x386815){_0x48c46a[_0x9b63('0x23')](0x194);}return _0x386815;};}function handleError(_0x56627c,_0x74ee30){_0x74ee30=_0x74ee30||0x1f4;return function(_0x3facd2){logger['error'](_0x3facd2[_0x9b63('0x24')]);if(_0x3facd2[_0x9b63('0x25')]){delete _0x3facd2[_0x9b63('0x25')];}_0x56627c['status'](_0x74ee30)[_0x9b63('0x26')](_0x3facd2);};}exports[_0x9b63('0x27')]=function(_0x4f2451,_0x4cdff5){var _0x8ecc25={},_0x20f51d={},_0x16cb7c={'count':0x0,'rows':[]};var _0x5b63b1=_[_0x9b63('0x28')](db[_0x9b63('0x29')][_0x9b63('0x2a')],function(_0x472d18){return{'name':_0x472d18[_0x9b63('0x2b')],'type':_0x472d18[_0x9b63('0x2c')]['key']};});_0x20f51d[_0x9b63('0x2d')]=_[_0x9b63('0x28')](_0x5b63b1,_0x9b63('0x25'));_0x20f51d['query']=_[_0x9b63('0x2e')](_0x4f2451[_0x9b63('0x2f')]);_0x20f51d[_0x9b63('0x30')]=_[_0x9b63('0x31')](_0x20f51d['model'],_0x20f51d[_0x9b63('0x2f')]);_0x8ecc25[_0x9b63('0x32')]=_[_0x9b63('0x31')](_0x20f51d[_0x9b63('0x2d')],qs['fields'](_0x4f2451['query']['fields']));_0x8ecc25[_0x9b63('0x32')]=_0x8ecc25[_0x9b63('0x32')]['length']?_0x8ecc25[_0x9b63('0x32')]:_0x20f51d[_0x9b63('0x2d')];if(!_0x4f2451[_0x9b63('0x2f')]['hasOwnProperty']('nolimit')){_0x8ecc25[_0x9b63('0x1b')]=qs[_0x9b63('0x1b')](_0x4f2451[_0x9b63('0x2f')][_0x9b63('0x1b')]);_0x8ecc25[_0x9b63('0x1a')]=qs['offset'](_0x4f2451['query'][_0x9b63('0x1a')]);}_0x8ecc25[_0x9b63('0x33')]=qs['sort'](_0x4f2451['query']['sort']);_0x8ecc25['where']=qs[_0x9b63('0x30')](_['pick'](_0x4f2451[_0x9b63('0x2f')],_0x20f51d[_0x9b63('0x30')]),_0x5b63b1);if(_0x4f2451[_0x9b63('0x2f')][_0x9b63('0x34')]){_0x8ecc25['where']=_[_0x9b63('0x35')](_0x8ecc25[_0x9b63('0x36')],{'$or':_[_0x9b63('0x28')](_0x5b63b1,function(_0x29349d){if(_0x29349d[_0x9b63('0x2c')]!==_0x9b63('0x37')){var _0x5f325a={};_0x5f325a[_0x29349d[_0x9b63('0x25')]]={'$like':'%'+_0x4f2451['query'][_0x9b63('0x34')]+'%'};return _0x5f325a;}})});}_0x8ecc25=_[_0x9b63('0x35')]({},_0x8ecc25,_0x4f2451[_0x9b63('0x38')]);var _0x24cc22={'where':_0x8ecc25[_0x9b63('0x36')]};return db[_0x9b63('0x29')]['count'](_0x24cc22)[_0x9b63('0x22')](function(_0x2f45c7){_0x16cb7c[_0x9b63('0x1d')]=_0x2f45c7;if(_0x4f2451[_0x9b63('0x2f')]['includeAll']){_0x8ecc25['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x8ecc25);})['then'](function(_0x15b16a){_0x16cb7c[_0x9b63('0x39')]=_0x15b16a;return _0x16cb7c;})['then'](respondWithFilteredResult(_0x4cdff5,_0x8ecc25))[_0x9b63('0x3a')](handleError(_0x4cdff5,null));};exports[_0x9b63('0x3b')]=function(_0x27b336,_0x571ef0){var _0x54d528={'raw':![],'where':{'id':_0x27b336[_0x9b63('0x3c')]['id']}},_0x2dff99={};_0x2dff99['model']=_[_0x9b63('0x2e')](db['Dynamics365Configuration'][_0x9b63('0x2a')]);_0x2dff99[_0x9b63('0x2f')]=_[_0x9b63('0x2e')](_0x27b336[_0x9b63('0x2f')]);_0x2dff99[_0x9b63('0x30')]=_['intersection'](_0x2dff99[_0x9b63('0x2d')],_0x2dff99[_0x9b63('0x2f')]);_0x54d528[_0x9b63('0x32')]=_['intersection'](_0x2dff99[_0x9b63('0x2d')],qs[_0x9b63('0x3d')](_0x27b336['query'][_0x9b63('0x3d')]));_0x54d528['attributes']=_0x54d528['attributes']['length']?_0x54d528[_0x9b63('0x32')]:_0x2dff99[_0x9b63('0x2d')];if(_0x27b336[_0x9b63('0x2f')][_0x9b63('0x3e')]){_0x54d528[_0x9b63('0x3f')]=[{'all':!![]}];}_0x54d528=_[_0x9b63('0x35')]({},_0x54d528,_0x27b336[_0x9b63('0x38')]);return db[_0x9b63('0x29')]['find'](_0x54d528)[_0x9b63('0x22')](handleEntityNotFound(_0x571ef0,null))[_0x9b63('0x22')](respondWithResult(_0x571ef0,null))[_0x9b63('0x3a')](handleError(_0x571ef0,null));};exports[_0x9b63('0x40')]=function(_0x508bf4,_0x5d285e){return db['Dynamics365Configuration']['create'](_0x508bf4[_0x9b63('0x41')],{})[_0x9b63('0x22')](respondWithResult(_0x5d285e,0xc9))[_0x9b63('0x3a')](handleError(_0x5d285e,null));};exports[_0x9b63('0x21')]=function(_0x5619f4,_0x29acff){if(_0x5619f4[_0x9b63('0x41')]['id']){delete _0x5619f4[_0x9b63('0x41')]['id'];}return db[_0x9b63('0x29')]['find']({'where':{'id':_0x5619f4[_0x9b63('0x3c')]['id']}})['then'](handleEntityNotFound(_0x29acff,null))['then'](saveUpdates(_0x5619f4[_0x9b63('0x41')],null))[_0x9b63('0x22')](respondWithResult(_0x29acff,null))[_0x9b63('0x3a')](handleError(_0x29acff,null));};exports[_0x9b63('0x42')]=function(_0x54057d,_0x203007){return db[_0x9b63('0x29')][_0x9b63('0x43')]({'where':{'id':_0x54057d[_0x9b63('0x3c')]['id']}})['then'](handleEntityNotFound(_0x203007,null))[_0x9b63('0x22')](removeEntity(_0x203007,null))['catch'](handleError(_0x203007,null));};exports[_0x9b63('0x44')]=function(_0x41fa69,_0x413720,_0x321b83){var _0x3034ce={};var _0x1e5f27={};var _0x44bc41;var _0x1693c5;return db['Dynamics365Configuration'][_0x9b63('0x45')]({'where':{'id':_0x41fa69[_0x9b63('0x3c')]['id']}})[_0x9b63('0x22')](handleEntityNotFound(_0x413720,null))['then'](function(_0x3816be){if(_0x3816be){_0x44bc41=_0x3816be;_0x1e5f27[_0x9b63('0x2d')]=_[_0x9b63('0x2e')](db[_0x9b63('0x46')]['rawAttributes']);_0x1e5f27['query']=_[_0x9b63('0x2e')](_0x41fa69['query']);_0x1e5f27[_0x9b63('0x30')]=_[_0x9b63('0x31')](_0x1e5f27['model'],_0x1e5f27[_0x9b63('0x2f')]);_0x3034ce[_0x9b63('0x32')]=_[_0x9b63('0x31')](_0x1e5f27[_0x9b63('0x2d')],qs['fields'](_0x41fa69['query'][_0x9b63('0x3d')]));_0x3034ce[_0x9b63('0x32')]=_0x3034ce[_0x9b63('0x32')][_0x9b63('0x47')]?_0x3034ce[_0x9b63('0x32')]:_0x1e5f27[_0x9b63('0x2d')];_0x3034ce[_0x9b63('0x33')]=qs[_0x9b63('0x48')](_0x41fa69[_0x9b63('0x2f')][_0x9b63('0x48')]);_0x3034ce[_0x9b63('0x36')]=qs['filters'](_[_0x9b63('0x49')](_0x41fa69['query'],_0x1e5f27[_0x9b63('0x30')]));if(_0x41fa69['query'][_0x9b63('0x34')]){_0x3034ce[_0x9b63('0x36')]=_[_0x9b63('0x35')](_0x3034ce[_0x9b63('0x36')],{'$or':_[_0x9b63('0x28')](_0x3034ce[_0x9b63('0x32')],function(_0x7034f){var _0x3e6f7d={};_0x3e6f7d[_0x7034f]={'$like':'%'+_0x41fa69[_0x9b63('0x2f')][_0x9b63('0x34')]+'%'};return _0x3e6f7d;})});}_0x3034ce=_[_0x9b63('0x35')]({},_0x3034ce,_0x41fa69[_0x9b63('0x38')]);return _0x44bc41[_0x9b63('0x44')](_0x3034ce);}})[_0x9b63('0x22')](function(_0x31badd){if(_0x31badd){_0x1693c5=_0x31badd[_0x9b63('0x47')];if(!_0x41fa69[_0x9b63('0x2f')][_0x9b63('0x4a')]('nolimit')){_0x3034ce[_0x9b63('0x1b')]=qs[_0x9b63('0x1b')](_0x41fa69['query'][_0x9b63('0x1b')]);_0x3034ce[_0x9b63('0x1a')]=qs['offset'](_0x41fa69['query'][_0x9b63('0x1a')]);}return _0x44bc41[_0x9b63('0x44')](_0x3034ce);}})[_0x9b63('0x22')](function(_0x23db58){if(_0x23db58){return _0x23db58?{'count':_0x1693c5,'rows':_0x23db58}:null;}})[_0x9b63('0x22')](respondWithResult(_0x413720,null))[_0x9b63('0x3a')](handleError(_0x413720,null));};exports[_0x9b63('0x4b')]=function(_0x1dfc8f,_0x4b278f,_0x2fadf8){var _0x2eda79={};var _0x139d1a={};var _0x5816e3;var _0x314c70;return db[_0x9b63('0x29')]['findOne']({'where':{'id':_0x1dfc8f['params']['id']}})[_0x9b63('0x22')](handleEntityNotFound(_0x4b278f,null))['then'](function(_0x27a554){if(_0x27a554){_0x5816e3=_0x27a554;_0x139d1a[_0x9b63('0x2d')]=_[_0x9b63('0x2e')](db[_0x9b63('0x46')][_0x9b63('0x2a')]);_0x139d1a[_0x9b63('0x2f')]=_[_0x9b63('0x2e')](_0x1dfc8f[_0x9b63('0x2f')]);_0x139d1a['filters']=_[_0x9b63('0x31')](_0x139d1a[_0x9b63('0x2d')],_0x139d1a[_0x9b63('0x2f')]);_0x2eda79[_0x9b63('0x32')]=_[_0x9b63('0x31')](_0x139d1a[_0x9b63('0x2d')],qs[_0x9b63('0x3d')](_0x1dfc8f[_0x9b63('0x2f')][_0x9b63('0x3d')]));_0x2eda79[_0x9b63('0x32')]=_0x2eda79['attributes'][_0x9b63('0x47')]?_0x2eda79[_0x9b63('0x32')]:_0x139d1a[_0x9b63('0x2d')];_0x2eda79['order']=qs[_0x9b63('0x48')](_0x1dfc8f[_0x9b63('0x2f')]['sort']);_0x2eda79['where']=qs['filters'](_[_0x9b63('0x49')](_0x1dfc8f[_0x9b63('0x2f')],_0x139d1a[_0x9b63('0x30')]));if(_0x1dfc8f[_0x9b63('0x2f')][_0x9b63('0x34')]){_0x2eda79[_0x9b63('0x36')]=_[_0x9b63('0x35')](_0x2eda79[_0x9b63('0x36')],{'$or':_[_0x9b63('0x28')](_0x2eda79[_0x9b63('0x32')],function(_0x39296e){var _0x1de86a={};_0x1de86a[_0x39296e]={'$like':'%'+_0x1dfc8f[_0x9b63('0x2f')][_0x9b63('0x34')]+'%'};return _0x1de86a;})});}_0x2eda79=_[_0x9b63('0x35')]({},_0x2eda79,_0x1dfc8f[_0x9b63('0x38')]);return _0x5816e3['getSubjects'](_0x2eda79);}})['then'](function(_0x115938){if(_0x115938){_0x314c70=_0x115938[_0x9b63('0x47')];if(!_0x1dfc8f['query'][_0x9b63('0x4a')](_0x9b63('0x4c'))){_0x2eda79[_0x9b63('0x1b')]=qs[_0x9b63('0x1b')](_0x1dfc8f[_0x9b63('0x2f')][_0x9b63('0x1b')]);_0x2eda79[_0x9b63('0x1a')]=qs[_0x9b63('0x1a')](_0x1dfc8f[_0x9b63('0x2f')][_0x9b63('0x1a')]);}return _0x5816e3[_0x9b63('0x4b')](_0x2eda79);}})['then'](function(_0x264bc1){if(_0x264bc1){return _0x264bc1?{'count':_0x314c70,'rows':_0x264bc1}:null;}})[_0x9b63('0x22')](respondWithResult(_0x4b278f,null))[_0x9b63('0x3a')](handleError(_0x4b278f,null));};exports['getDescriptions']=function(_0xb9d918,_0x4be5d0,_0x4bf7c4){var _0x36a0f3={};var _0x1c0cb6={};var _0x4d83c3;var _0xef392d;return db[_0x9b63('0x29')]['findOne']({'where':{'id':_0xb9d918[_0x9b63('0x3c')]['id']}})[_0x9b63('0x22')](handleEntityNotFound(_0x4be5d0,null))[_0x9b63('0x22')](function(_0x2d1955){if(_0x2d1955){_0x4d83c3=_0x2d1955;_0x1c0cb6[_0x9b63('0x2d')]=_[_0x9b63('0x2e')](db[_0x9b63('0x46')]['rawAttributes']);_0x1c0cb6['query']=_[_0x9b63('0x2e')](_0xb9d918['query']);_0x1c0cb6[_0x9b63('0x30')]=_[_0x9b63('0x31')](_0x1c0cb6[_0x9b63('0x2d')],_0x1c0cb6[_0x9b63('0x2f')]);_0x36a0f3[_0x9b63('0x32')]=_[_0x9b63('0x31')](_0x1c0cb6[_0x9b63('0x2d')],qs[_0x9b63('0x3d')](_0xb9d918[_0x9b63('0x2f')][_0x9b63('0x3d')]));_0x36a0f3[_0x9b63('0x32')]=_0x36a0f3['attributes'][_0x9b63('0x47')]?_0x36a0f3['attributes']:_0x1c0cb6[_0x9b63('0x2d')];_0x36a0f3['order']=qs[_0x9b63('0x48')](_0xb9d918[_0x9b63('0x2f')][_0x9b63('0x48')]);_0x36a0f3['where']=qs[_0x9b63('0x30')](_[_0x9b63('0x49')](_0xb9d918[_0x9b63('0x2f')],_0x1c0cb6[_0x9b63('0x30')]));if(_0xb9d918[_0x9b63('0x2f')][_0x9b63('0x34')]){_0x36a0f3['where']=_['merge'](_0x36a0f3['where'],{'$or':_[_0x9b63('0x28')](_0x36a0f3[_0x9b63('0x32')],function(_0x4f5689){var _0x9772bc={};_0x9772bc[_0x4f5689]={'$like':'%'+_0xb9d918[_0x9b63('0x2f')][_0x9b63('0x34')]+'%'};return _0x9772bc;})});}_0x36a0f3=_['merge']({},_0x36a0f3,_0xb9d918[_0x9b63('0x38')]);return _0x4d83c3[_0x9b63('0x4d')](_0x36a0f3);}})['then'](function(_0x49a645){if(_0x49a645){_0xef392d=_0x49a645[_0x9b63('0x47')];if(!_0xb9d918['query'][_0x9b63('0x4a')](_0x9b63('0x4c'))){_0x36a0f3[_0x9b63('0x1b')]=qs[_0x9b63('0x1b')](_0xb9d918[_0x9b63('0x2f')][_0x9b63('0x1b')]);_0x36a0f3[_0x9b63('0x1a')]=qs[_0x9b63('0x1a')](_0xb9d918[_0x9b63('0x2f')][_0x9b63('0x1a')]);}return _0x4d83c3[_0x9b63('0x4d')](_0x36a0f3);}})['then'](function(_0x19ddd4){if(_0x19ddd4){return _0x19ddd4?{'count':_0xef392d,'rows':_0x19ddd4}:null;}})['then'](respondWithResult(_0x4be5d0,null))[_0x9b63('0x3a')](handleError(_0x4be5d0,null));};
\ No newline at end of file
index 1a68183..aa4ef6b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x493a97,_0x50a93e){var _0x51f171=function(_0x26a0bb){while(--_0x26a0bb){_0x493a97['push'](_0x493a97['shift']());}};_0x51f171(++_0x50a93e);}(_0x3e74,0x175));var _0x43e7=function(_0x5a00d2,_0x2715a7){_0x5a00d2=_0x5a00d2-0x0;var _0x2f144f=_0x3e74[_0x5a00d2];return _0x2f144f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x37b112,_0x3548bb){_0x37b112=_0x37b112-0x0;var _0x59f332=_0x6f0d[_0x37b112];return _0x59f332;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2c5bac7..0735df9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62ab=['code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0x514359,_0xb51f1b){var _0x31198c=function(_0x1065e3){while(--_0x1065e3){_0x514359['push'](_0x514359['shift']());}};_0x31198c(++_0xb51f1b);}(_0x62ab,0xbf));var _0xb62a=function(_0x501f89,_0x4d7d73){_0x501f89=_0x501f89-0x0;var _0x599131=_0x62ab[_0x501f89];return _0x599131;};'use strict';var _=require(_0xb62a('0x0'));var util=require(_0xb62a('0x1'));var moment=require(_0xb62a('0x2'));var BPromise=require(_0xb62a('0x3'));var rs=require(_0xb62a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb62a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb62a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x500f2b,_0x31319c,_0x25f7fb){return new BPromise(function(_0x1251b7,_0x4f9ab4){return client['request'](_0x500f2b,_0x25f7fb)[_0xb62a('0x7')](function(_0x1aef96){logger['info'](_0xb62a('0x8'),_0x31319c,_0xb62a('0x9'));logger[_0xb62a('0xa')](_0xb62a('0xb'),_0x31319c,_0xb62a('0x9'),JSON['stringify'](_0x1aef96));if(_0x1aef96[_0xb62a('0xc')]){if(_0x1aef96[_0xb62a('0xc')][_0xb62a('0xd')]===0x1f4){logger['error'](_0xb62a('0x8'),_0x31319c,_0x1aef96[_0xb62a('0xc')][_0xb62a('0xe')]);return _0x4f9ab4(_0x1aef96[_0xb62a('0xc')][_0xb62a('0xe')]);}logger[_0xb62a('0xc')](_0xb62a('0x8'),_0x31319c,_0x1aef96[_0xb62a('0xc')][_0xb62a('0xe')]);return _0x1251b7(_0x1aef96[_0xb62a('0xc')][_0xb62a('0xe')]);}else{logger[_0xb62a('0xf')](_0xb62a('0x8'),_0x31319c,_0xb62a('0x9'));_0x1251b7(_0x1aef96[_0xb62a('0x10')][_0xb62a('0xe')]);}})['catch'](function(_0x4aecf8){logger['error'](_0xb62a('0x8'),_0x31319c,_0x4aecf8);_0x4f9ab4(_0x4aecf8);});});}
\ No newline at end of file
+var _0x38c4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x119d0f,_0xd33b7b){var _0x5f9b8f=function(_0x12ed96){while(--_0x12ed96){_0x119d0f['push'](_0x119d0f['shift']());}};_0x5f9b8f(++_0xd33b7b);}(_0x38c4,0x199));var _0x438c=function(_0x51586a,_0x181782){_0x51586a=_0x51586a-0x0;var _0x50f172=_0x38c4[_0x51586a];return _0x50f172;};'use strict';var _=require(_0x438c('0x0'));var util=require(_0x438c('0x1'));var moment=require(_0x438c('0x2'));var BPromise=require('bluebird');var rs=require(_0x438c('0x3'));var fs=require('fs');var Redis=require(_0x438c('0x4'));var db=require(_0x438c('0x5'))['db'];var utils=require(_0x438c('0x6'));var logger=require(_0x438c('0x7'))(_0x438c('0x8'));var config=require(_0x438c('0x9'));var jayson=require(_0x438c('0xa'));var client=jayson[_0x438c('0xb')][_0x438c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x523622,_0x19a461,_0x54ddab){return new BPromise(function(_0x4e7aeb,_0x5d3c1e){return client[_0x438c('0xd')](_0x523622,_0x54ddab)[_0x438c('0xe')](function(_0x30ac6e){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x19a461,_0x438c('0xf'));logger[_0x438c('0x10')](_0x438c('0x11'),_0x19a461,_0x438c('0xf'),JSON[_0x438c('0x12')](_0x30ac6e));if(_0x30ac6e[_0x438c('0x13')]){if(_0x30ac6e['error'][_0x438c('0x14')]===0x1f4){logger['error'](_0x438c('0x15'),_0x19a461,_0x30ac6e[_0x438c('0x13')][_0x438c('0x16')]);return _0x5d3c1e(_0x30ac6e['error'][_0x438c('0x16')]);}logger[_0x438c('0x13')](_0x438c('0x15'),_0x19a461,_0x30ac6e[_0x438c('0x13')][_0x438c('0x16')]);return _0x4e7aeb(_0x30ac6e[_0x438c('0x13')][_0x438c('0x16')]);}else{logger[_0x438c('0x17')](_0x438c('0x15'),_0x19a461,_0x438c('0xf'));_0x4e7aeb(_0x30ac6e[_0x438c('0x18')][_0x438c('0x16')]);}})[_0x438c('0x19')](function(_0x310781){logger[_0x438c('0x13')](_0x438c('0x15'),_0x19a461,_0x310781);_0x5d3c1e(_0x310781);});});}
\ No newline at end of file
index 23d10bb..8403ced 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x89ab=['update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x2a4455,_0x37cbdb){var _0x4ad259=function(_0x38f00d){while(--_0x38f00d){_0x2a4455['push'](_0x2a4455['shift']());}};_0x4ad259(++_0x37cbdb);}(_0x89ab,0x159));var _0xb89a=function(_0x11c8a9,_0x542283){_0x11c8a9=_0x11c8a9-0x0;var _0x344766=_0x89ab[_0x11c8a9];return _0x344766;};'use strict';var multer=require('multer');var util=require(_0xb89a('0x0'));var path=require(_0xb89a('0x1'));var timeout=require(_0xb89a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb89a('0x3'));var auth=require(_0xb89a('0x4'));var interaction=require(_0xb89a('0x5'));var config=require(_0xb89a('0x6'));var controller=require(_0xb89a('0x7'));router[_0xb89a('0x8')]('/',auth[_0xb89a('0x9')](),controller[_0xb89a('0xa')]);router[_0xb89a('0x8')](_0xb89a('0xb'),auth[_0xb89a('0x9')](),controller['show']);router[_0xb89a('0xc')]('/',auth['isAuthenticated'](),controller[_0xb89a('0xd')]);router[_0xb89a('0xe')]('/:id',auth[_0xb89a('0x9')](),controller[_0xb89a('0xf')]);router[_0xb89a('0x10')](_0xb89a('0xb'),auth[_0xb89a('0x9')](),controller[_0xb89a('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0x5c95=['index','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x547976,_0x3e5459){var _0x54cf9e=function(_0x1aedd3){while(--_0x1aedd3){_0x547976['push'](_0x547976['shift']());}};_0x54cf9e(++_0x3e5459);}(_0x5c95,0x187));var _0x55c9=function(_0x318606,_0x26823b){_0x318606=_0x318606-0x0;var _0x5f47fd=_0x5c95[_0x318606];return _0x5f47fd;};'use strict';var multer=require(_0x55c9('0x0'));var util=require(_0x55c9('0x1'));var path=require(_0x55c9('0x2'));var timeout=require(_0x55c9('0x3'));var express=require('express');var router=express[_0x55c9('0x4')]();var fs_extra=require(_0x55c9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x55c9('0x6'));var config=require(_0x55c9('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x55c9('0x8')](),controller[_0x55c9('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x55c9('0xa')]('/',auth[_0x55c9('0x8')](),controller['create']);router[_0x55c9('0xb')](_0x55c9('0xc'),auth[_0x55c9('0x8')](),controller[_0x55c9('0xd')]);router['delete']('/:id',auth[_0x55c9('0x8')](),controller[_0x55c9('0xe')]);module[_0x55c9('0xf')]=router;
\ No newline at end of file
index 2a915f6..c4763cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf39=['STRING','BOOLEAN','ENUM','string','customVariable','keyValue'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcf39,0x170));var _0x9cf3=function(_0x13fcaf,_0x416c69){_0x13fcaf=_0x13fcaf-0x0;var _0x4fa631=_0xcf39[_0x13fcaf];return _0x4fa631;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9cf3('0x0')](_0x9cf3('0x1'),'variable',_0x9cf3('0x2'),_0x9cf3('0x3'),'picklist'),'defaultValue':_0x9cf3('0x1')},'content':{'type':Sequelize[_0x9cf3('0x4')]},'key':{'type':Sequelize[_0x9cf3('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x9cf3('0x1'),'variable',_0x9cf3('0x2'))},'keyContent':{'type':Sequelize[_0x9cf3('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9cf3('0x4')]},'customField':{'type':Sequelize[_0x9cf3('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9cf3('0x4')]}};
\ No newline at end of file
+var _0xead2=['string','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2c0efb,_0x5dd1d7){var _0x3c93b9=function(_0x41d023){while(--_0x41d023){_0x2c0efb['push'](_0x2c0efb['shift']());}};_0x3c93b9(++_0x5dd1d7);}(_0xead2,0xc7));var _0x2ead=function(_0x3fd41,_0x2bffd1){_0x3fd41=_0x3fd41-0x0;var _0x1d27b0=_0xead2[_0x3fd41];return _0x1d27b0;};'use strict';var Sequelize=require(_0x2ead('0x0'));module[_0x2ead('0x1')]={'type':{'type':Sequelize[_0x2ead('0x2')]('string',_0x2ead('0x3'),_0x2ead('0x4'),_0x2ead('0x5'),_0x2ead('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2ead('0x7')]},'key':{'type':Sequelize[_0x2ead('0x7')]},'keyType':{'type':Sequelize[_0x2ead('0x2')](_0x2ead('0x8'),_0x2ead('0x3'),_0x2ead('0x4'))},'keyContent':{'type':Sequelize[_0x2ead('0x7')]},'idField':{'type':Sequelize[_0x2ead('0x7')]},'nameField':{'type':Sequelize[_0x2ead('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index d3ffcde..7f47fdc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf95e=['name','send','index','map','Dynamics365Field','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then'];(function(_0x311c69,_0x2557df){var _0x302d4d=function(_0x26e149){while(--_0x26e149){_0x311c69['push'](_0x311c69['shift']());}};_0x302d4d(++_0x2557df);}(_0xf95e,0x6a));var _0xef95=function(_0x167f9e,_0x208fe4){_0x167f9e=_0x167f9e-0x0;var _0x51d75e=_0xf95e[_0x167f9e];return _0x51d75e;};'use strict';var emlformat=require(_0xef95('0x0'));var rimraf=require(_0xef95('0x1'));var zipdir=require(_0xef95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef95('0x3'));var moment=require(_0xef95('0x4'));var BPromise=require(_0xef95('0x5'));var Mustache=require(_0xef95('0x6'));var util=require(_0xef95('0x7'));var path=require(_0xef95('0x8'));var sox=require(_0xef95('0x9'));var csv=require(_0xef95('0xa'));var ejs=require(_0xef95('0xb'));var fs=require('fs');var fs_extra=require(_0xef95('0xc'));var _=require(_0xef95('0xd'));var squel=require(_0xef95('0xe'));var crypto=require('crypto');var jsforce=require(_0xef95('0xf'));var deskjs=require(_0xef95('0x10'));var toCsv=require(_0xef95('0xa'));var querystring=require('querystring');var Papa=require(_0xef95('0x11'));var Redis=require('ioredis');var authService=require(_0xef95('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xef95('0x13'));var hardwareService=require(_0xef95('0x14'));var logger=require('../../config/logger')(_0xef95('0x15'));var utils=require(_0xef95('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xef95('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf844b6,_0x216e67){_0x216e67=_0x216e67||0xcc;return function(_0x4bc0b0){if(_0x4bc0b0){return _0xf844b6[_0xef95('0x18')](_0x216e67);}return _0xf844b6[_0xef95('0x19')](_0x216e67)[_0xef95('0x1a')]();};}function respondWithResult(_0x8a1539,_0x95d09b){_0x95d09b=_0x95d09b||0xc8;return function(_0x5e57ab){if(_0x5e57ab){return _0x8a1539['status'](_0x95d09b)['json'](_0x5e57ab);}};}function respondWithFilteredResult(_0x3f91ab,_0x30bd9a){return function(_0x6f025f){if(_0x6f025f){var _0x1468c2=typeof _0x30bd9a[_0xef95('0x1b')]===_0xef95('0x1c')&&typeof _0x30bd9a[_0xef95('0x1d')]==='undefined';var _0x5dee73=_0x6f025f[_0xef95('0x1e')];var _0x1d5c09=_0x1468c2?0x0:_0x30bd9a['offset'];var _0x10c10b=_0x1468c2?_0x6f025f[_0xef95('0x1e')]:_0x30bd9a[_0xef95('0x1b')]+_0x30bd9a[_0xef95('0x1d')];var _0xfec56c;if(_0x10c10b>=_0x5dee73){_0x10c10b=_0x5dee73;_0xfec56c=0xc8;}else{_0xfec56c=0xce;}_0x3f91ab[_0xef95('0x19')](_0xfec56c);return _0x3f91ab[_0xef95('0x1f')](_0xef95('0x20'),_0x1d5c09+'-'+_0x10c10b+'/'+_0x5dee73)[_0xef95('0x21')](_0x6f025f);}return null;};}function patchUpdates(_0x561236){return function(_0x3e7942){try{jsonpatch[_0xef95('0x22')](_0x3e7942,_0x561236,!![]);}catch(_0x5fecd2){return BPromise['reject'](_0x5fecd2);}return _0x3e7942[_0xef95('0x23')]();};}function saveUpdates(_0x55bb4d,_0x35d12c){return function(_0x446a29){if(_0x446a29){return _0x446a29[_0xef95('0x24')](_0x55bb4d)[_0xef95('0x25')](function(_0x10f0de){return _0x10f0de;});}return null;};}function removeEntity(_0x17abda,_0x525406){return function(_0x2f217c){if(_0x2f217c){return _0x2f217c['destroy']()['then'](function(){_0x17abda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c05c9,_0xbebd87){return function(_0x36ef5b){if(!_0x36ef5b){_0x3c05c9[_0xef95('0x18')](0x194);}return _0x36ef5b;};}function handleError(_0x26d2a6,_0x8db209){_0x8db209=_0x8db209||0x1f4;return function(_0x11aaa4){logger['error'](_0x11aaa4['stack']);if(_0x11aaa4[_0xef95('0x26')]){delete _0x11aaa4[_0xef95('0x26')];}_0x26d2a6[_0xef95('0x19')](_0x8db209)[_0xef95('0x27')](_0x11aaa4);};}exports[_0xef95('0x28')]=function(_0x4d6492,_0x1f0656){var _0x24c4ce={},_0x3900b6={},_0x265f4b={'count':0x0,'rows':[]};var _0xb933ba=_[_0xef95('0x29')](db[_0xef95('0x2a')][_0xef95('0x2b')],function(_0x268dde){return{'name':_0x268dde[_0xef95('0x2c')],'type':_0x268dde['type']['key']};});_0x3900b6[_0xef95('0x2d')]=_['map'](_0xb933ba,_0xef95('0x26'));_0x3900b6[_0xef95('0x2e')]=_[_0xef95('0x2f')](_0x4d6492[_0xef95('0x2e')]);_0x3900b6[_0xef95('0x30')]=_[_0xef95('0x31')](_0x3900b6['model'],_0x3900b6[_0xef95('0x2e')]);_0x24c4ce[_0xef95('0x32')]=_[_0xef95('0x31')](_0x3900b6[_0xef95('0x2d')],qs[_0xef95('0x33')](_0x4d6492[_0xef95('0x2e')]['fields']));_0x24c4ce[_0xef95('0x32')]=_0x24c4ce[_0xef95('0x32')][_0xef95('0x34')]?_0x24c4ce['attributes']:_0x3900b6[_0xef95('0x2d')];if(!_0x4d6492['query'][_0xef95('0x35')](_0xef95('0x36'))){_0x24c4ce['limit']=qs['limit'](_0x4d6492[_0xef95('0x2e')]['limit']);_0x24c4ce[_0xef95('0x1b')]=qs[_0xef95('0x1b')](_0x4d6492[_0xef95('0x2e')][_0xef95('0x1b')]);}_0x24c4ce[_0xef95('0x37')]=qs[_0xef95('0x38')](_0x4d6492['query'][_0xef95('0x38')]);_0x24c4ce[_0xef95('0x39')]=qs['filters'](_['pick'](_0x4d6492[_0xef95('0x2e')],_0x3900b6['filters']),_0xb933ba);if(_0x4d6492[_0xef95('0x2e')]['filter']){_0x24c4ce['where']=_[_0xef95('0x3a')](_0x24c4ce[_0xef95('0x39')],{'$or':_[_0xef95('0x29')](_0xb933ba,function(_0x1b427f){if(_0x1b427f[_0xef95('0x3b')]!=='VIRTUAL'){var _0x279bf0={};_0x279bf0[_0x1b427f[_0xef95('0x26')]]={'$like':'%'+_0x4d6492[_0xef95('0x2e')][_0xef95('0x3c')]+'%'};return _0x279bf0;}})});}_0x24c4ce=_['merge']({},_0x24c4ce,_0x4d6492[_0xef95('0x3d')]);var _0x59488b={'where':_0x24c4ce[_0xef95('0x39')]};return db[_0xef95('0x2a')][_0xef95('0x1e')](_0x59488b)[_0xef95('0x25')](function(_0x5e866c){_0x265f4b[_0xef95('0x1e')]=_0x5e866c;if(_0x4d6492[_0xef95('0x2e')][_0xef95('0x3e')]){_0x24c4ce[_0xef95('0x3f')]=[{'all':!![]}];}return db[_0xef95('0x2a')]['findAll'](_0x24c4ce);})[_0xef95('0x25')](function(_0x23f18a){_0x265f4b[_0xef95('0x40')]=_0x23f18a;return _0x265f4b;})['then'](respondWithFilteredResult(_0x1f0656,_0x24c4ce))[_0xef95('0x41')](handleError(_0x1f0656,null));};exports[_0xef95('0x42')]=function(_0x39504a,_0x4319f1){var _0x5363c9={'raw':!![],'where':{'id':_0x39504a[_0xef95('0x43')]['id']}},_0x5bb7c1={};_0x5bb7c1['model']=_['keys'](db[_0xef95('0x2a')][_0xef95('0x2b')]);_0x5bb7c1[_0xef95('0x2e')]=_['keys'](_0x39504a[_0xef95('0x2e')]);_0x5bb7c1[_0xef95('0x30')]=_[_0xef95('0x31')](_0x5bb7c1[_0xef95('0x2d')],_0x5bb7c1[_0xef95('0x2e')]);_0x5363c9[_0xef95('0x32')]=_[_0xef95('0x31')](_0x5bb7c1[_0xef95('0x2d')],qs[_0xef95('0x33')](_0x39504a[_0xef95('0x2e')][_0xef95('0x33')]));_0x5363c9['attributes']=_0x5363c9['attributes'][_0xef95('0x34')]?_0x5363c9[_0xef95('0x32')]:_0x5bb7c1['model'];if(_0x39504a[_0xef95('0x2e')]['includeAll']){_0x5363c9[_0xef95('0x3f')]=[{'all':!![]}];}_0x5363c9=_[_0xef95('0x3a')]({},_0x5363c9,_0x39504a[_0xef95('0x3d')]);return db[_0xef95('0x2a')][_0xef95('0x44')](_0x5363c9)[_0xef95('0x25')](handleEntityNotFound(_0x4319f1,null))[_0xef95('0x25')](respondWithResult(_0x4319f1,null))[_0xef95('0x41')](handleError(_0x4319f1,null));};exports[_0xef95('0x45')]=function(_0x133458,_0x1956af){return db['Dynamics365Field'][_0xef95('0x45')](_0x133458['body'],{})[_0xef95('0x25')](respondWithResult(_0x1956af,0xc9))[_0xef95('0x41')](handleError(_0x1956af,null));};exports[_0xef95('0x24')]=function(_0x2b6020,_0x1ae114){if(_0x2b6020[_0xef95('0x46')]['id']){delete _0x2b6020[_0xef95('0x46')]['id'];}return db['Dynamics365Field'][_0xef95('0x44')]({'where':{'id':_0x2b6020[_0xef95('0x43')]['id']}})[_0xef95('0x25')](handleEntityNotFound(_0x1ae114,null))[_0xef95('0x25')](saveUpdates(_0x2b6020[_0xef95('0x46')],null))['then'](respondWithResult(_0x1ae114,null))[_0xef95('0x41')](handleError(_0x1ae114,null));};exports[_0xef95('0x47')]=function(_0x90e597,_0x540a67){return db['Dynamics365Field'][_0xef95('0x44')]({'where':{'id':_0x90e597['params']['id']}})['then'](handleEntityNotFound(_0x540a67,null))['then'](removeEntity(_0x540a67,null))['catch'](handleError(_0x540a67,null));};
\ No newline at end of file
+var _0xc9fa=['sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','limit','undefined','count','offset','save','update','destroy','then','sendStatus','error','stack','name','index','Dynamics365Field','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','map','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x11d073,_0x1a6d85){var _0x1ef950=function(_0x3ef798){while(--_0x3ef798){_0x11d073['push'](_0x11d073['shift']());}};_0x1ef950(++_0x1a6d85);}(_0xc9fa,0x84));var _0xac9f=function(_0xdbccf0,_0x3dba4d){_0xdbccf0=_0xdbccf0-0x0;var _0x162a01=_0xc9fa[_0xdbccf0];return _0x162a01;};'use strict';var emlformat=require(_0xac9f('0x0'));var rimraf=require(_0xac9f('0x1'));var zipdir=require(_0xac9f('0x2'));var jsonpatch=require(_0xac9f('0x3'));var rp=require('request-promise');var moment=require(_0xac9f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac9f('0x5'));var util=require(_0xac9f('0x6'));var path=require(_0xac9f('0x7'));var sox=require(_0xac9f('0x8'));var csv=require(_0xac9f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac9f('0xa'));var _=require(_0xac9f('0xb'));var squel=require(_0xac9f('0xc'));var crypto=require('crypto');var jsforce=require(_0xac9f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac9f('0xe'));var Papa=require('papaparse');var Redis=require(_0xac9f('0xf'));var authService=require(_0xac9f('0x10'));var qs=require(_0xac9f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac9f('0x12'));var logger=require(_0xac9f('0x13'))(_0xac9f('0x14'));var utils=require(_0xac9f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac9f('0x16'))['db'];function respondWithStatusCode(_0x16ca8e,_0x588b6f){_0x588b6f=_0x588b6f||0xcc;return function(_0x4522a4){if(_0x4522a4){return _0x16ca8e['sendStatus'](_0x588b6f);}return _0x16ca8e['status'](_0x588b6f)[_0xac9f('0x17')]();};}function respondWithResult(_0x1e8347,_0x5d8657){_0x5d8657=_0x5d8657||0xc8;return function(_0x370a34){if(_0x370a34){return _0x1e8347[_0xac9f('0x18')](_0x5d8657)[_0xac9f('0x19')](_0x370a34);}};}function respondWithFilteredResult(_0x1bf23d,_0x274ef1){return function(_0xd7a462){if(_0xd7a462){var _0x181832=typeof _0x274ef1['offset']==='undefined'&&typeof _0x274ef1[_0xac9f('0x1a')]===_0xac9f('0x1b');var _0x504818=_0xd7a462[_0xac9f('0x1c')];var _0x7d35a0=_0x181832?0x0:_0x274ef1[_0xac9f('0x1d')];var _0x37d7d0=_0x181832?_0xd7a462[_0xac9f('0x1c')]:_0x274ef1[_0xac9f('0x1d')]+_0x274ef1[_0xac9f('0x1a')];var _0x325fba;if(_0x37d7d0>=_0x504818){_0x37d7d0=_0x504818;_0x325fba=0xc8;}else{_0x325fba=0xce;}_0x1bf23d[_0xac9f('0x18')](_0x325fba);return _0x1bf23d['set']('Content-Range',_0x7d35a0+'-'+_0x37d7d0+'/'+_0x504818)[_0xac9f('0x19')](_0xd7a462);}return null;};}function patchUpdates(_0x3af8f0){return function(_0x4d6a32){try{jsonpatch['apply'](_0x4d6a32,_0x3af8f0,!![]);}catch(_0x2e3963){return BPromise['reject'](_0x2e3963);}return _0x4d6a32[_0xac9f('0x1e')]();};}function saveUpdates(_0x837cac,_0x10b73e){return function(_0xff1597){if(_0xff1597){return _0xff1597[_0xac9f('0x1f')](_0x837cac)['then'](function(_0x5d0da6){return _0x5d0da6;});}return null;};}function removeEntity(_0x235ac6,_0x19abd2){return function(_0x5126f7){if(_0x5126f7){return _0x5126f7[_0xac9f('0x20')]()[_0xac9f('0x21')](function(){_0x235ac6[_0xac9f('0x18')](0xcc)[_0xac9f('0x17')]();});}};}function handleEntityNotFound(_0x5ae0fb,_0x318392){return function(_0x2abb30){if(!_0x2abb30){_0x5ae0fb[_0xac9f('0x22')](0x194);}return _0x2abb30;};}function handleError(_0xf21309,_0x472d51){_0x472d51=_0x472d51||0x1f4;return function(_0x22340f){logger[_0xac9f('0x23')](_0x22340f[_0xac9f('0x24')]);if(_0x22340f[_0xac9f('0x25')]){delete _0x22340f[_0xac9f('0x25')];}_0xf21309[_0xac9f('0x18')](_0x472d51)['send'](_0x22340f);};}exports[_0xac9f('0x26')]=function(_0x13419f,_0x178288){var _0x7f7803={},_0x407699={},_0x1f652d={'count':0x0,'rows':[]};var _0x438e51=_['map'](db[_0xac9f('0x27')][_0xac9f('0x28')],function(_0x7d6043){return{'name':_0x7d6043[_0xac9f('0x29')],'type':_0x7d6043[_0xac9f('0x2a')]['key']};});_0x407699[_0xac9f('0x2b')]=_['map'](_0x438e51,_0xac9f('0x25'));_0x407699[_0xac9f('0x2c')]=_['keys'](_0x13419f[_0xac9f('0x2c')]);_0x407699[_0xac9f('0x2d')]=_[_0xac9f('0x2e')](_0x407699[_0xac9f('0x2b')],_0x407699['query']);_0x7f7803[_0xac9f('0x2f')]=_[_0xac9f('0x2e')](_0x407699[_0xac9f('0x2b')],qs[_0xac9f('0x30')](_0x13419f['query'][_0xac9f('0x30')]));_0x7f7803[_0xac9f('0x2f')]=_0x7f7803[_0xac9f('0x2f')][_0xac9f('0x31')]?_0x7f7803[_0xac9f('0x2f')]:_0x407699[_0xac9f('0x2b')];if(!_0x13419f[_0xac9f('0x2c')][_0xac9f('0x32')](_0xac9f('0x33'))){_0x7f7803[_0xac9f('0x1a')]=qs[_0xac9f('0x1a')](_0x13419f[_0xac9f('0x2c')][_0xac9f('0x1a')]);_0x7f7803[_0xac9f('0x1d')]=qs['offset'](_0x13419f[_0xac9f('0x2c')][_0xac9f('0x1d')]);}_0x7f7803[_0xac9f('0x34')]=qs['sort'](_0x13419f['query']['sort']);_0x7f7803[_0xac9f('0x35')]=qs[_0xac9f('0x2d')](_[_0xac9f('0x36')](_0x13419f[_0xac9f('0x2c')],_0x407699[_0xac9f('0x2d')]),_0x438e51);if(_0x13419f[_0xac9f('0x2c')][_0xac9f('0x37')]){_0x7f7803[_0xac9f('0x35')]=_['merge'](_0x7f7803[_0xac9f('0x35')],{'$or':_[_0xac9f('0x38')](_0x438e51,function(_0x5877f3){if(_0x5877f3[_0xac9f('0x2a')]!==_0xac9f('0x39')){var _0x29c2be={};_0x29c2be[_0x5877f3[_0xac9f('0x25')]]={'$like':'%'+_0x13419f[_0xac9f('0x2c')]['filter']+'%'};return _0x29c2be;}})});}_0x7f7803=_[_0xac9f('0x3a')]({},_0x7f7803,_0x13419f[_0xac9f('0x3b')]);var _0x40de25={'where':_0x7f7803['where']};return db['Dynamics365Field']['count'](_0x40de25)[_0xac9f('0x21')](function(_0x10c1ad){_0x1f652d[_0xac9f('0x1c')]=_0x10c1ad;if(_0x13419f[_0xac9f('0x2c')]['includeAll']){_0x7f7803['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xac9f('0x3c')](_0x7f7803);})[_0xac9f('0x21')](function(_0xef0bd5){_0x1f652d[_0xac9f('0x3d')]=_0xef0bd5;return _0x1f652d;})[_0xac9f('0x21')](respondWithFilteredResult(_0x178288,_0x7f7803))[_0xac9f('0x3e')](handleError(_0x178288,null));};exports[_0xac9f('0x3f')]=function(_0x1c1fb5,_0x356258){var _0x5dbb98={'raw':!![],'where':{'id':_0x1c1fb5[_0xac9f('0x40')]['id']}},_0xdb065d={};_0xdb065d['model']=_[_0xac9f('0x41')](db['Dynamics365Field'][_0xac9f('0x28')]);_0xdb065d[_0xac9f('0x2c')]=_['keys'](_0x1c1fb5[_0xac9f('0x2c')]);_0xdb065d[_0xac9f('0x2d')]=_[_0xac9f('0x2e')](_0xdb065d['model'],_0xdb065d['query']);_0x5dbb98[_0xac9f('0x2f')]=_[_0xac9f('0x2e')](_0xdb065d[_0xac9f('0x2b')],qs[_0xac9f('0x30')](_0x1c1fb5[_0xac9f('0x2c')][_0xac9f('0x30')]));_0x5dbb98['attributes']=_0x5dbb98[_0xac9f('0x2f')][_0xac9f('0x31')]?_0x5dbb98['attributes']:_0xdb065d[_0xac9f('0x2b')];if(_0x1c1fb5[_0xac9f('0x2c')][_0xac9f('0x42')]){_0x5dbb98['include']=[{'all':!![]}];}_0x5dbb98=_['merge']({},_0x5dbb98,_0x1c1fb5['options']);return db[_0xac9f('0x27')][_0xac9f('0x43')](_0x5dbb98)[_0xac9f('0x21')](handleEntityNotFound(_0x356258,null))['then'](respondWithResult(_0x356258,null))[_0xac9f('0x3e')](handleError(_0x356258,null));};exports['create']=function(_0x312e40,_0x287fa0){return db[_0xac9f('0x27')][_0xac9f('0x44')](_0x312e40['body'],{})[_0xac9f('0x21')](respondWithResult(_0x287fa0,0xc9))[_0xac9f('0x3e')](handleError(_0x287fa0,null));};exports[_0xac9f('0x1f')]=function(_0x26f5f8,_0x1a0d81){if(_0x26f5f8[_0xac9f('0x45')]['id']){delete _0x26f5f8[_0xac9f('0x45')]['id'];}return db['Dynamics365Field'][_0xac9f('0x43')]({'where':{'id':_0x26f5f8[_0xac9f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a0d81,null))[_0xac9f('0x21')](saveUpdates(_0x26f5f8[_0xac9f('0x45')],null))['then'](respondWithResult(_0x1a0d81,null))['catch'](handleError(_0x1a0d81,null));};exports['destroy']=function(_0x5a5c36,_0x3c718f){return db[_0xac9f('0x27')]['find']({'where':{'id':_0x5a5c36[_0xac9f('0x40')]['id']}})[_0xac9f('0x21')](handleEntityNotFound(_0x3c718f,null))[_0xac9f('0x21')](removeEntity(_0x3c718f,null))['catch'](handleError(_0x3c718f,null));};
\ No newline at end of file
index eb56a3c..1155fa1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f5c=['int_dynamics365_fields','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field'];(function(_0x436137,_0x1ae35d){var _0xeddc14=function(_0x4bc8ad){while(--_0x4bc8ad){_0x436137['push'](_0x436137['shift']());}};_0xeddc14(++_0x1ae35d);}(_0x3f5c,0x113));var _0xc3f5=function(_0x55cc7e,_0x3475be){_0x55cc7e=_0x55cc7e-0x0;var _0x884a75=_0x3f5c[_0x55cc7e];return _0x884a75;};'use strict';var _=require(_0xc3f5('0x0'));var util=require(_0xc3f5('0x1'));var logger=require(_0xc3f5('0x2'))(_0xc3f5('0x3'));var moment=require('moment');var BPromise=require(_0xc3f5('0x4'));var rp=require(_0xc3f5('0x5'));var fs=require('fs');var path=require(_0xc3f5('0x6'));var rimraf=require(_0xc3f5('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3f5('0x8'));module[_0xc3f5('0x9')]=function(_0x37daa5,_0x51a86b){return _0x37daa5['define'](_0xc3f5('0xa'),attributes,{'tableName':_0xc3f5('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xc3f5('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x619e=['idField','lodash','util','../../config/logger','moment','path','rimraf','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x585ba8,_0x4400b0){var _0x5c5f8f=function(_0x37247e){while(--_0x37247e){_0x585ba8['push'](_0x585ba8['shift']());}};_0x5c5f8f(++_0x4400b0);}(_0x619e,0x18d));var _0xe619=function(_0x2c976f,_0x4bd2c4){_0x2c976f=_0x2c976f-0x0;var _0x1a1227=_0x619e[_0x2c976f];return _0x1a1227;};'use strict';var _=require(_0xe619('0x0'));var util=require(_0xe619('0x1'));var logger=require(_0xe619('0x2'))('api');var moment=require(_0xe619('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe619('0x4'));var rimraf=require(_0xe619('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xe619('0x6')]=function(_0x3a3a6d,_0x4f78a5){return _0x3a3a6d[_0xe619('0x7')](_0xe619('0x8'),attributes,{'tableName':_0xe619('0x9'),'paranoid':![],'indexes':[{'name':_0xe619('0xa'),'fields':[_0xe619('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index d93ae67..020cac7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x045f=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x045f,0x1b7));var _0xf045=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0x045f[_0x5b445b];return _0x1a40fe;};'use strict';var _=require('lodash');var util=require(_0xf045('0x0'));var moment=require(_0xf045('0x1'));var BPromise=require(_0xf045('0x2'));var rs=require(_0xf045('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf045('0x4'))['db'];var utils=require(_0xf045('0x5'));var logger=require('../../config/logger')(_0xf045('0x6'));var config=require(_0xf045('0x7'));var jayson=require(_0xf045('0x8'));var client=jayson['client'][_0xf045('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b7bbf,_0x195b6e,_0xbc9bdb){return new BPromise(function(_0x49a4ae,_0x1e6cec){return client[_0xf045('0xa')](_0x2b7bbf,_0xbc9bdb)[_0xf045('0xb')](function(_0x568d90){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x195b6e,'request\x20sent');logger[_0xf045('0xc')](_0xf045('0xd'),_0x195b6e,_0xf045('0xe'),JSON[_0xf045('0xf')](_0x568d90));if(_0x568d90[_0xf045('0x10')]){if(_0x568d90[_0xf045('0x10')][_0xf045('0x11')]===0x1f4){logger[_0xf045('0x10')](_0xf045('0x12'),_0x195b6e,_0x568d90[_0xf045('0x10')]['message']);return _0x1e6cec(_0x568d90[_0xf045('0x10')][_0xf045('0x13')]);}logger[_0xf045('0x10')](_0xf045('0x12'),_0x195b6e,_0x568d90[_0xf045('0x10')][_0xf045('0x13')]);return _0x49a4ae(_0x568d90[_0xf045('0x10')][_0xf045('0x13')]);}else{logger[_0xf045('0x14')](_0xf045('0x12'),_0x195b6e,'request\x20sent');_0x49a4ae(_0x568d90[_0xf045('0x15')][_0xf045('0x13')]);}})[_0xf045('0x16')](function(_0x19990f){logger[_0xf045('0x10')](_0xf045('0x12'),_0x195b6e,_0x19990f);_0x1e6cec(_0x19990f);});});}
\ No newline at end of file
+var _0xe3e8=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xe3e8,0xb9));var _0x8e3e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xe3e8[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x8e3e('0x0'));var util=require('util');var moment=require(_0x8e3e('0x1'));var BPromise=require(_0x8e3e('0x2'));var rs=require(_0x8e3e('0x3'));var fs=require('fs');var Redis=require(_0x8e3e('0x4'));var db=require(_0x8e3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e3e('0x6'));var config=require(_0x8e3e('0x7'));var jayson=require(_0x8e3e('0x8'));var client=jayson[_0x8e3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1382f5,_0x58b2be,_0x19e328){return new BPromise(function(_0x68927b,_0x341534){return client[_0x8e3e('0xa')](_0x1382f5,_0x19e328)[_0x8e3e('0xb')](function(_0x32be61){logger['info'](_0x8e3e('0xc'),_0x58b2be,_0x8e3e('0xd'));logger['debug'](_0x8e3e('0xe'),_0x58b2be,'request\x20sent',JSON[_0x8e3e('0xf')](_0x32be61));if(_0x32be61['error']){if(_0x32be61[_0x8e3e('0x10')][_0x8e3e('0x11')]===0x1f4){logger[_0x8e3e('0x10')](_0x8e3e('0xc'),_0x58b2be,_0x32be61[_0x8e3e('0x10')][_0x8e3e('0x12')]);return _0x341534(_0x32be61['error'][_0x8e3e('0x12')]);}logger['error'](_0x8e3e('0xc'),_0x58b2be,_0x32be61[_0x8e3e('0x10')][_0x8e3e('0x12')]);return _0x68927b(_0x32be61['error'][_0x8e3e('0x12')]);}else{logger['info'](_0x8e3e('0xc'),_0x58b2be,'request\x20sent');_0x68927b(_0x32be61[_0x8e3e('0x13')][_0x8e3e('0x12')]);}})[_0x8e3e('0x14')](function(_0x536125){logger[_0x8e3e('0x10')](_0x8e3e('0xc'),_0x58b2be,_0x536125);_0x341534(_0x536125);});});}
\ No newline at end of file
index e0bb854..8df7866 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa050=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','multer'];(function(_0x2c50ed,_0x563374){var _0x50d07d=function(_0x5477de){while(--_0x5477de){_0x2c50ed['push'](_0x2c50ed['shift']());}};_0x50d07d(++_0x563374);}(_0xa050,0x133));var _0x0a05=function(_0x46c51b,_0x300ce7){_0x46c51b=_0x46c51b-0x0;var _0x21c550=_0xa050[_0x46c51b];return _0x21c550;};'use strict';var multer=require(_0x0a05('0x0'));var util=require(_0x0a05('0x1'));var path=require(_0x0a05('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a05('0x3'));var router=express[_0x0a05('0x4')]();var fs_extra=require(_0x0a05('0x5'));var auth=require(_0x0a05('0x6'));var interaction=require(_0x0a05('0x7'));var config=require(_0x0a05('0x8'));var controller=require(_0x0a05('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0a05('0xa')](_0x0a05('0xb'),auth[_0x0a05('0xc')](),controller['show']);router['get'](_0x0a05('0xd'),auth[_0x0a05('0xc')](),controller[_0x0a05('0xe')]);router[_0x0a05('0xa')](_0x0a05('0xf'),auth[_0x0a05('0xc')](),controller[_0x0a05('0x10')]);router[_0x0a05('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a05('0x11')](_0x0a05('0xd'),auth[_0x0a05('0xc')](),controller['addConfiguration']);router[_0x0a05('0x12')]('/:id',auth[_0x0a05('0xc')](),controller[_0x0a05('0x13')]);router[_0x0a05('0x14')](_0x0a05('0xb'),auth[_0x0a05('0xc')](),controller[_0x0a05('0x15')]);module['exports']=router;
\ No newline at end of file
+var _0x4b2a=['fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','get','isAuthenticated','getConfigurations','/:id/fields','post','create','/:id/configurations','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4b2a,0x1de));var _0xa4b2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4b2a[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xa4b2('0x0'));var util=require(_0xa4b2('0x1'));var path=require(_0xa4b2('0x2'));var timeout=require(_0xa4b2('0x3'));var express=require(_0xa4b2('0x4'));var router=express['Router']();var fs_extra=require(_0xa4b2('0x5'));var auth=require(_0xa4b2('0x6'));var interaction=require(_0xa4b2('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa4b2('0x8')]);router['get'](_0xa4b2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa4b2('0xa')]('/:id/configurations',auth[_0xa4b2('0xb')](),controller[_0xa4b2('0xc')]);router[_0xa4b2('0xa')](_0xa4b2('0xd'),auth[_0xa4b2('0xb')](),controller['getFields']);router[_0xa4b2('0xe')]('/',auth[_0xa4b2('0xb')](),controller[_0xa4b2('0xf')]);router[_0xa4b2('0xe')](_0xa4b2('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xa4b2('0x9'),auth[_0xa4b2('0xb')](),controller[_0xa4b2('0x11')]);router[_0xa4b2('0x12')]('/:id',auth[_0xa4b2('0xb')](),controller[_0xa4b2('0x13')]);module[_0xa4b2('0x14')]=router;
\ No newline at end of file
index e58a7ad..9b34aaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5464=['remoteUri','sequelize','exports','STRING'];(function(_0x1f0cd3,_0x1604e9){var _0x5c9f9a=function(_0x2f02b6){while(--_0x2f02b6){_0x1f0cd3['push'](_0x1f0cd3['shift']());}};_0x5c9f9a(++_0x1604e9);}(_0x5464,0x15d));var _0x4546=function(_0x556b58,_0x44ed1e){_0x556b58=_0x556b58-0x0;var _0x30d758=_0x5464[_0x556b58];return _0x30d758;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x4546('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4546('0x3')},'serverUrl':{'type':Sequelize[_0x4546('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x205bc3,_0x18a9c5){var _0x2963e9=function(_0x2aacf){while(--_0x2aacf){_0x205bc3['push'](_0x205bc3['shift']());}};_0x2963e9(++_0x18a9c5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x0b0e[_0x404eed];return _0xd45887;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}};
\ No newline at end of file
index 0ddcf5b..f9a8495 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f8c=['FreshdeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','Basic\x20%s','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','default','custom_text','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1fd3f8,_0x4cdfe3){_0x1fd3f8=_0x1fd3f8-0x0;var _0x49aba9=_0x3f8c[_0x1fd3f8];return _0x49aba9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];var integrations=require(_0xc3f8('0x16'));function respondWithStatusCode(_0x155c80,_0x511763){_0x511763=_0x511763||0xcc;return function(_0x84f489){if(_0x84f489){return _0x155c80[_0xc3f8('0x17')](_0x511763);}return _0x155c80[_0xc3f8('0x18')](_0x511763)[_0xc3f8('0x19')]();};}function respondWithResult(_0x6155e9,_0x47754c){_0x47754c=_0x47754c||0xc8;return function(_0x29e2b6){if(_0x29e2b6){return _0x6155e9[_0xc3f8('0x18')](_0x47754c)[_0xc3f8('0x1a')](_0x29e2b6);}};}function respondWithFilteredResult(_0x2fd8e8,_0x3cb28a){return function(_0x2a9f64){if(_0x2a9f64){var _0x29d031=typeof _0x3cb28a['offset']===_0xc3f8('0x1b')&&typeof _0x3cb28a['limit']==='undefined';var _0x3df137=_0x2a9f64[_0xc3f8('0x1c')];var _0x35500f=_0x29d031?0x0:_0x3cb28a[_0xc3f8('0x1d')];var _0x47a185=_0x29d031?_0x2a9f64[_0xc3f8('0x1c')]:_0x3cb28a[_0xc3f8('0x1d')]+_0x3cb28a['limit'];var _0xe14074;if(_0x47a185>=_0x3df137){_0x47a185=_0x3df137;_0xe14074=0xc8;}else{_0xe14074=0xce;}_0x2fd8e8['status'](_0xe14074);return _0x2fd8e8[_0xc3f8('0x1e')](_0xc3f8('0x1f'),_0x35500f+'-'+_0x47a185+'/'+_0x3df137)[_0xc3f8('0x1a')](_0x2a9f64);}return null;};}function patchUpdates(_0x53ada5){return function(_0x543dca){try{jsonpatch[_0xc3f8('0x20')](_0x543dca,_0x53ada5,!![]);}catch(_0x2a7096){return BPromise[_0xc3f8('0x21')](_0x2a7096);}return _0x543dca[_0xc3f8('0x22')]();};}function saveUpdates(_0x6522e9,_0x251bf7){return function(_0x43b2b4){if(_0x43b2b4){return _0x43b2b4[_0xc3f8('0x23')](_0x6522e9)['then'](function(_0x571f92){return _0x571f92;});}return null;};}function removeEntity(_0x4b83f0,_0x2559a4){return function(_0x5e1d14){if(_0x5e1d14){return _0x5e1d14[_0xc3f8('0x24')]()[_0xc3f8('0x25')](function(){_0x4b83f0['status'](0xcc)[_0xc3f8('0x19')]();});}};}function handleEntityNotFound(_0x327b2d,_0x2d237e){return function(_0xb883b5){if(!_0xb883b5){_0x327b2d[_0xc3f8('0x17')](0x194);}return _0xb883b5;};}function handleError(_0x9d43b4,_0xf1d460){_0xf1d460=_0xf1d460||0x1f4;return function(_0x7f14ad){logger[_0xc3f8('0x26')](_0x7f14ad[_0xc3f8('0x27')]);if(_0x7f14ad[_0xc3f8('0x28')]){delete _0x7f14ad[_0xc3f8('0x28')];}_0x9d43b4[_0xc3f8('0x18')](_0xf1d460)[_0xc3f8('0x29')](_0x7f14ad);};}exports['index']=function(_0x58b303,_0x2909f8){var _0x218029={},_0x5bf6e2={},_0x151bba={'count':0x0,'rows':[]};var _0x4d39a0=_[_0xc3f8('0x2a')](db[_0xc3f8('0x2b')]['rawAttributes'],function(_0x48b32e){return{'name':_0x48b32e[_0xc3f8('0x2c')],'type':_0x48b32e[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x5bf6e2[_0xc3f8('0x2f')]=_[_0xc3f8('0x2a')](_0x4d39a0,_0xc3f8('0x28'));_0x5bf6e2[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x58b303[_0xc3f8('0x30')]);_0x5bf6e2[_0xc3f8('0x32')]=_['intersection'](_0x5bf6e2[_0xc3f8('0x2f')],_0x5bf6e2[_0xc3f8('0x30')]);_0x218029[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x5bf6e2[_0xc3f8('0x2f')],qs['fields'](_0x58b303['query'][_0xc3f8('0x35')]));_0x218029[_0xc3f8('0x33')]=_0x218029[_0xc3f8('0x33')][_0xc3f8('0x36')]?_0x218029[_0xc3f8('0x33')]:_0x5bf6e2['model'];if(!_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x218029['limit']=qs[_0xc3f8('0x39')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x218029['offset']=qs[_0xc3f8('0x1d')](_0x58b303[_0xc3f8('0x30')]['offset']);}_0x218029[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3b')]);_0x218029[_0xc3f8('0x3c')]=qs[_0xc3f8('0x32')](_['pick'](_0x58b303[_0xc3f8('0x30')],_0x5bf6e2[_0xc3f8('0x32')]),_0x4d39a0);if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3d')]){_0x218029[_0xc3f8('0x3c')]=_['merge'](_0x218029[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2a')](_0x4d39a0,function(_0xaa4c98){if(_0xaa4c98['type']!==_0xc3f8('0x3e')){var _0x83b7ab={};_0x83b7ab[_0xaa4c98[_0xc3f8('0x28')]]={'$like':'%'+_0x58b303[_0xc3f8('0x30')]['filter']+'%'};return _0x83b7ab;}})});}_0x218029=_[_0xc3f8('0x3f')]({},_0x218029,_0x58b303[_0xc3f8('0x40')]);var _0x2df096={'where':_0x218029[_0xc3f8('0x3c')]};return db['FreshdeskAccount'][_0xc3f8('0x1c')](_0x2df096)['then'](function(_0x5d144b){_0x151bba[_0xc3f8('0x1c')]=_0x5d144b;if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x218029[_0xc3f8('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x218029);})[_0xc3f8('0x25')](function(_0x16805c){_0x151bba[_0xc3f8('0x43')]=_0x16805c;return _0x151bba;})[_0xc3f8('0x25')](respondWithFilteredResult(_0x2909f8,_0x218029))[_0xc3f8('0x44')](handleError(_0x2909f8,null));};exports[_0xc3f8('0x45')]=function(_0x3113b4,_0x45e6ea){var _0x13d8dc={'raw':![],'where':{'id':_0x3113b4[_0xc3f8('0x46')]['id']}},_0x34bccd={};_0x34bccd['model']=_[_0xc3f8('0x31')](db[_0xc3f8('0x2b')]['rawAttributes']);_0x34bccd[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x3113b4['query']);_0x34bccd[_0xc3f8('0x32')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],_0x34bccd[_0xc3f8('0x30')]);_0x13d8dc[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x13d8dc[_0xc3f8('0x33')]=_0x13d8dc['attributes'][_0xc3f8('0x36')]?_0x13d8dc[_0xc3f8('0x33')]:_0x34bccd['model'];if(_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x13d8dc[_0xc3f8('0x42')]=[{'all':!![]}];}_0x13d8dc=_[_0xc3f8('0x3f')]({},_0x13d8dc,_0x3113b4['options']);return db['FreshdeskAccount'][_0xc3f8('0x47')](_0x13d8dc)[_0xc3f8('0x25')](handleEntityNotFound(_0x45e6ea,null))[_0xc3f8('0x25')](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));};exports[_0xc3f8('0x48')]=function(_0x3a665e,_0x418961){return db[_0xc3f8('0x2b')][_0xc3f8('0x48')](_0x3a665e['body'],{})[_0xc3f8('0x25')](respondWithResult(_0x418961,0xc9))[_0xc3f8('0x44')](handleError(_0x418961,null));};exports['update']=function(_0x1becae,_0x3fcb6a){if(_0x1becae[_0xc3f8('0x49')]['id']){delete _0x1becae[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x1becae[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcb6a,null))[_0xc3f8('0x25')](saveUpdates(_0x1becae[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x3fcb6a,null))[_0xc3f8('0x44')](handleError(_0x3fcb6a,null));};exports[_0xc3f8('0x24')]=function(_0x2448bf,_0x33e5c5){return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x2448bf[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x33e5c5,null))[_0xc3f8('0x25')](removeEntity(_0x33e5c5,null))[_0xc3f8('0x44')](handleError(_0x33e5c5,null));};exports[_0xc3f8('0x4a')]=function(_0x267c95,_0x3e6c1d,_0x3d752a){var _0x97a88e={};var _0x920f4b={};var _0x4fc02c;var _0x51249a;return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x267c95['params']['id']}})['then'](handleEntityNotFound(_0x3e6c1d,null))[_0xc3f8('0x25')](function(_0x4b4adb){if(_0x4b4adb){_0x4fc02c=_0x4b4adb;_0x920f4b[_0xc3f8('0x2f')]=_[_0xc3f8('0x31')](db[_0xc3f8('0x4c')]['rawAttributes']);_0x920f4b[_0xc3f8('0x30')]=_['keys'](_0x267c95['query']);_0x920f4b[_0xc3f8('0x32')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],_0x920f4b[_0xc3f8('0x30')]);_0x97a88e[_0xc3f8('0x33')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x97a88e[_0xc3f8('0x33')]=_0x97a88e['attributes']['length']?_0x97a88e[_0xc3f8('0x33')]:_0x920f4b[_0xc3f8('0x2f')];_0x97a88e[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x267c95[_0xc3f8('0x30')]['sort']);_0x97a88e[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x4d')](_0x267c95[_0xc3f8('0x30')],_0x920f4b[_0xc3f8('0x32')]));if(_0x267c95[_0xc3f8('0x30')]['filter']){_0x97a88e[_0xc3f8('0x3c')]=_['merge'](_0x97a88e['where'],{'$or':_['map'](_0x97a88e['attributes'],function(_0x12df02){var _0x143d50={};_0x143d50[_0x12df02]={'$like':'%'+_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x3d')]+'%'};return _0x143d50;})});}_0x97a88e=_[_0xc3f8('0x3f')]({},_0x97a88e,_0x267c95[_0xc3f8('0x40')]);return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x5250df){if(_0x5250df){_0x51249a=_0x5250df[_0xc3f8('0x36')];if(!_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x97a88e[_0xc3f8('0x39')]=qs['limit'](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x97a88e[_0xc3f8('0x1d')]=qs[_0xc3f8('0x1d')](_0x267c95[_0xc3f8('0x30')]['offset']);}return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x42b255){if(_0x42b255){return _0x42b255?{'count':_0x51249a,'rows':_0x42b255}:null;}})[_0xc3f8('0x25')](respondWithResult(_0x3e6c1d,null))[_0xc3f8('0x44')](handleError(_0x3e6c1d,null));};exports[_0xc3f8('0x4e')]=function(_0x56fd61,_0x2f199d,_0x4ca426){if(_0x56fd61[_0xc3f8('0x49')]['id']){delete _0x56fd61['body']['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x56fd61['params']['id']}})['then'](handleEntityNotFound(_0x2f199d,null))[_0xc3f8('0x25')](function(_0x2c7ab9){if(_0x2c7ab9){_0x56fd61['body'][_0xc3f8('0x4f')]=_0x2c7ab9['id'];_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x50')]=integrations[_0xc3f8('0x51')](_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x52')],_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x2d')]);_0x56fd61['body']['Descriptions']=integrations[_0xc3f8('0x53')](_0x56fd61['body']['channel'],_0x56fd61['body']['type']);return db['FreshdeskConfiguration'][_0xc3f8('0x48')](_0x56fd61[_0xc3f8('0x49')],{'include':[{'model':db[_0xc3f8('0x54')],'as':_0xc3f8('0x50')},{'model':db['FreshdeskField'],'as':_0xc3f8('0x55')}]});}return null;})[_0xc3f8('0x25')](respondWithResult(_0x2f199d,null))['catch'](handleError(_0x2f199d,null));};exports[_0xc3f8('0x56')]=function(_0x273faf,_0x104eec,_0x531de8){var _0xaedf89='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x273faf['params']['id']},'attributes':['id',_0xc3f8('0x57'),_0xc3f8('0x58')]})['then'](handleEntityNotFound(_0x104eec,null))[_0xc3f8('0x25')](function(_0x3fb47f){if(_0x3fb47f){_0xaedf89=_0x3fb47f['remoteUri'];var _0x265418=_0xaedf89[_0xc3f8('0x59')](-0x1);if(_0x265418==='/'){_0xaedf89=_0xaedf89['substring'](0x0,_0xaedf89[_0xc3f8('0x5a')](_0x265418));}return rp({'method':'GET','uri':util[_0xc3f8('0x5b')](_0xc3f8('0x5c'),_0xaedf89,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xc3f8('0x5d'),new Buffer(util[_0xc3f8('0x5b')]('%s:X',_0x3fb47f[_0xc3f8('0x58')]))['toString'](_0xc3f8('0x5e')))},'json':!![]});}})['then'](function(_0x280e74){if(_0x280e74){var _0x19adb5=[_0xc3f8('0x5f'),_0xc3f8('0x60'),_0xc3f8('0x61'),_0xc3f8('0x62'),_0xc3f8('0x18'),_0xc3f8('0x63'),_0xc3f8('0x64'),'source',_0xc3f8('0x65'),_0xc3f8('0x64'),_0xc3f8('0x66')];_[_0xc3f8('0x67')](_0x280e74,function(_0x3c321d){return _0x19adb5['includes'](_0x3c321d[_0xc3f8('0x28')])||!_0x3c321d[_0xc3f8('0x68')]&&_0x3c321d[_0xc3f8('0x2d')]!==_0xc3f8('0x69')&&_0x3c321d[_0xc3f8('0x2d')]!=='custom_dropdown';});return{'count':_0x280e74[_0xc3f8('0x36')],'rows':_[_0xc3f8('0x2a')](_0x280e74,function(_0x1001a1){return{'id':_0x1001a1['name'],'name':_0x1001a1['label'],'custom':!_0x1001a1[_0xc3f8('0x68')],'options':_0x1001a1[_0xc3f8('0x6a')]?_[_0xc3f8('0x2a')](_0x1001a1[_0xc3f8('0x6a')],function(_0x4b9b3b){return{'name':_[_0xc3f8('0x6b')](_0x4b9b3b),'value':_0x4b9b3b};}):[]};})};}})[_0xc3f8('0x25')](respondWithResult(_0x104eec,null))[_0xc3f8('0x44')](function(_0x5f1fbb){var _0x2a29fa=_0x273faf[_0xc3f8('0x30')]['test']?0x1f4:_0x5f1fbb['statusCode']||0x1f4;logger[_0xc3f8('0x26')](_0xc3f8('0x6c'),'getFields',_0x2a29fa,JSON[_0xc3f8('0x6d')](_0x5f1fbb));delete _0x5f1fbb[_0xc3f8('0x28')];if(_0x2a29fa===0x191){_0x2a29fa=0x190;}_0x104eec['status'](_0x2a29fa)[_0xc3f8('0x29')](_0x273faf['query'][_0xc3f8('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x5f1fbb[_0xc3f8('0x6f')]}:_0x5f1fbb);});};
\ No newline at end of file
+var _0x24e9=['format','Basic\x20%s','base64','subject','agent','description','group','source','ticket_type','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','save','then','destroy','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','update','params','FreshdeskConfiguration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','findOne','apiKey','remoteUri','lastIndexOf','GET','%s/%s','api/v2/ticket_fields'];(function(_0x16c33e,_0x5b919c){var _0x18e058=function(_0x575009){while(--_0x575009){_0x16c33e['push'](_0x16c33e['shift']());}};_0x18e058(++_0x5b919c);}(_0x24e9,0x85));var _0x924e=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x24e9[_0x25701b];return _0x3a8a2c;};'use strict';var emlformat=require(_0x924e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x924e('0x1'));var jsonpatch=require(_0x924e('0x2'));var rp=require(_0x924e('0x3'));var moment=require(_0x924e('0x4'));var BPromise=require(_0x924e('0x5'));var Mustache=require(_0x924e('0x6'));var util=require(_0x924e('0x7'));var path=require(_0x924e('0x8'));var sox=require('sox');var csv=require(_0x924e('0x9'));var ejs=require(_0x924e('0xa'));var fs=require('fs');var fs_extra=require(_0x924e('0xb'));var _=require(_0x924e('0xc'));var squel=require(_0x924e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x924e('0xe'));var toCsv=require(_0x924e('0x9'));var querystring=require(_0x924e('0xf'));var Papa=require(_0x924e('0x10'));var Redis=require('ioredis');var authService=require(_0x924e('0x11'));var qs=require(_0x924e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x924e('0x13'));var logger=require('../../config/logger')(_0x924e('0x14'));var utils=require(_0x924e('0x15'));var config=require(_0x924e('0x16'));var licenseUtil=require(_0x924e('0x17'));var db=require(_0x924e('0x18'))['db'];var integrations=require(_0x924e('0x19'));function respondWithStatusCode(_0x2096d0,_0x380bb5){_0x380bb5=_0x380bb5||0xcc;return function(_0x570bb8){if(_0x570bb8){return _0x2096d0[_0x924e('0x1a')](_0x380bb5);}return _0x2096d0['status'](_0x380bb5)[_0x924e('0x1b')]();};}function respondWithResult(_0x3ac60a,_0x12dcec){_0x12dcec=_0x12dcec||0xc8;return function(_0x3d7eac){if(_0x3d7eac){return _0x3ac60a[_0x924e('0x1c')](_0x12dcec)[_0x924e('0x1d')](_0x3d7eac);}};}function respondWithFilteredResult(_0x4dff17,_0x4df52c){return function(_0x8328a5){if(_0x8328a5){var _0x463d18=typeof _0x4df52c['offset']===_0x924e('0x1e')&&typeof _0x4df52c['limit']==='undefined';var _0x1a04d7=_0x8328a5['count'];var _0x50272c=_0x463d18?0x0:_0x4df52c[_0x924e('0x1f')];var _0x4715f8=_0x463d18?_0x8328a5[_0x924e('0x20')]:_0x4df52c[_0x924e('0x1f')]+_0x4df52c[_0x924e('0x21')];var _0x51fb8c;if(_0x4715f8>=_0x1a04d7){_0x4715f8=_0x1a04d7;_0x51fb8c=0xc8;}else{_0x51fb8c=0xce;}_0x4dff17[_0x924e('0x1c')](_0x51fb8c);return _0x4dff17[_0x924e('0x22')]('Content-Range',_0x50272c+'-'+_0x4715f8+'/'+_0x1a04d7)[_0x924e('0x1d')](_0x8328a5);}return null;};}function patchUpdates(_0x136d02){return function(_0x2070f5){try{jsonpatch[_0x924e('0x23')](_0x2070f5,_0x136d02,!![]);}catch(_0x59b352){return BPromise[_0x924e('0x24')](_0x59b352);}return _0x2070f5[_0x924e('0x25')]();};}function saveUpdates(_0x524524,_0x460295){return function(_0x4297b4){if(_0x4297b4){return _0x4297b4['update'](_0x524524)[_0x924e('0x26')](function(_0x1b26f9){return _0x1b26f9;});}return null;};}function removeEntity(_0x1a4106,_0x3315f6){return function(_0x33bc7c){if(_0x33bc7c){return _0x33bc7c[_0x924e('0x27')]()[_0x924e('0x26')](function(){_0x1a4106[_0x924e('0x1c')](0xcc)[_0x924e('0x1b')]();});}};}function handleEntityNotFound(_0x4662c4,_0x4fb285){return function(_0x497daa){if(!_0x497daa){_0x4662c4[_0x924e('0x1a')](0x194);}return _0x497daa;};}function handleError(_0x5e4fd8,_0x51a30f){_0x51a30f=_0x51a30f||0x1f4;return function(_0x1ea892){logger[_0x924e('0x28')](_0x1ea892[_0x924e('0x29')]);if(_0x1ea892[_0x924e('0x2a')]){delete _0x1ea892['name'];}_0x5e4fd8['status'](_0x51a30f)[_0x924e('0x2b')](_0x1ea892);};}exports['index']=function(_0x42d472,_0x4258e7){var _0x1dc3fd={},_0x352d42={},_0x5825f2={'count':0x0,'rows':[]};var _0x22992d=_[_0x924e('0x2c')](db[_0x924e('0x2d')][_0x924e('0x2e')],function(_0xb88fb5){return{'name':_0xb88fb5[_0x924e('0x2f')],'type':_0xb88fb5[_0x924e('0x30')][_0x924e('0x31')]};});_0x352d42[_0x924e('0x32')]=_[_0x924e('0x2c')](_0x22992d,_0x924e('0x2a'));_0x352d42[_0x924e('0x33')]=_[_0x924e('0x34')](_0x42d472[_0x924e('0x33')]);_0x352d42[_0x924e('0x35')]=_[_0x924e('0x36')](_0x352d42[_0x924e('0x32')],_0x352d42['query']);_0x1dc3fd[_0x924e('0x37')]=_[_0x924e('0x36')](_0x352d42['model'],qs[_0x924e('0x38')](_0x42d472['query'][_0x924e('0x38')]));_0x1dc3fd[_0x924e('0x37')]=_0x1dc3fd[_0x924e('0x37')][_0x924e('0x39')]?_0x1dc3fd[_0x924e('0x37')]:_0x352d42['model'];if(!_0x42d472[_0x924e('0x33')][_0x924e('0x3a')](_0x924e('0x3b'))){_0x1dc3fd[_0x924e('0x21')]=qs[_0x924e('0x21')](_0x42d472[_0x924e('0x33')][_0x924e('0x21')]);_0x1dc3fd[_0x924e('0x1f')]=qs[_0x924e('0x1f')](_0x42d472[_0x924e('0x33')][_0x924e('0x1f')]);}_0x1dc3fd[_0x924e('0x3c')]=qs[_0x924e('0x3d')](_0x42d472['query'][_0x924e('0x3d')]);_0x1dc3fd['where']=qs[_0x924e('0x35')](_[_0x924e('0x3e')](_0x42d472[_0x924e('0x33')],_0x352d42[_0x924e('0x35')]),_0x22992d);if(_0x42d472[_0x924e('0x33')][_0x924e('0x3f')]){_0x1dc3fd[_0x924e('0x40')]=_[_0x924e('0x41')](_0x1dc3fd[_0x924e('0x40')],{'$or':_[_0x924e('0x2c')](_0x22992d,function(_0x281fc6){if(_0x281fc6[_0x924e('0x30')]!==_0x924e('0x42')){var _0x6d050c={};_0x6d050c[_0x281fc6['name']]={'$like':'%'+_0x42d472[_0x924e('0x33')][_0x924e('0x3f')]+'%'};return _0x6d050c;}})});}_0x1dc3fd=_['merge']({},_0x1dc3fd,_0x42d472[_0x924e('0x43')]);var _0x591145={'where':_0x1dc3fd[_0x924e('0x40')]};return db[_0x924e('0x2d')][_0x924e('0x20')](_0x591145)[_0x924e('0x26')](function(_0xd2fa2a){_0x5825f2[_0x924e('0x20')]=_0xd2fa2a;if(_0x42d472[_0x924e('0x33')][_0x924e('0x44')]){_0x1dc3fd[_0x924e('0x45')]=[{'all':!![]}];}return db[_0x924e('0x2d')][_0x924e('0x46')](_0x1dc3fd);})[_0x924e('0x26')](function(_0x3e45af){_0x5825f2[_0x924e('0x47')]=_0x3e45af;return _0x5825f2;})[_0x924e('0x26')](respondWithFilteredResult(_0x4258e7,_0x1dc3fd))['catch'](handleError(_0x4258e7,null));};exports[_0x924e('0x48')]=function(_0x2e1fc1,_0x3ded39){var _0x649759={'raw':![],'where':{'id':_0x2e1fc1['params']['id']}},_0x24b8b0={};_0x24b8b0[_0x924e('0x32')]=_[_0x924e('0x34')](db[_0x924e('0x2d')]['rawAttributes']);_0x24b8b0[_0x924e('0x33')]=_[_0x924e('0x34')](_0x2e1fc1['query']);_0x24b8b0['filters']=_['intersection'](_0x24b8b0[_0x924e('0x32')],_0x24b8b0[_0x924e('0x33')]);_0x649759[_0x924e('0x37')]=_[_0x924e('0x36')](_0x24b8b0[_0x924e('0x32')],qs[_0x924e('0x38')](_0x2e1fc1[_0x924e('0x33')][_0x924e('0x38')]));_0x649759['attributes']=_0x649759[_0x924e('0x37')][_0x924e('0x39')]?_0x649759['attributes']:_0x24b8b0[_0x924e('0x32')];if(_0x2e1fc1[_0x924e('0x33')][_0x924e('0x44')]){_0x649759[_0x924e('0x45')]=[{'all':!![]}];}_0x649759=_['merge']({},_0x649759,_0x2e1fc1[_0x924e('0x43')]);return db[_0x924e('0x2d')][_0x924e('0x49')](_0x649759)[_0x924e('0x26')](handleEntityNotFound(_0x3ded39,null))['then'](respondWithResult(_0x3ded39,null))['catch'](handleError(_0x3ded39,null));};exports[_0x924e('0x4a')]=function(_0x32db84,_0x233d82){return db[_0x924e('0x2d')][_0x924e('0x4a')](_0x32db84[_0x924e('0x4b')],{})[_0x924e('0x26')](respondWithResult(_0x233d82,0xc9))[_0x924e('0x4c')](handleError(_0x233d82,null));};exports[_0x924e('0x4d')]=function(_0x353a48,_0x76c64e){if(_0x353a48[_0x924e('0x4b')]['id']){delete _0x353a48[_0x924e('0x4b')]['id'];}return db['FreshdeskAccount'][_0x924e('0x49')]({'where':{'id':_0x353a48[_0x924e('0x4e')]['id']}})[_0x924e('0x26')](handleEntityNotFound(_0x76c64e,null))[_0x924e('0x26')](saveUpdates(_0x353a48[_0x924e('0x4b')],null))[_0x924e('0x26')](respondWithResult(_0x76c64e,null))[_0x924e('0x4c')](handleError(_0x76c64e,null));};exports[_0x924e('0x27')]=function(_0x53f43b,_0xc8fab){return db[_0x924e('0x2d')][_0x924e('0x49')]({'where':{'id':_0x53f43b[_0x924e('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc8fab,null))['then'](removeEntity(_0xc8fab,null))[_0x924e('0x4c')](handleError(_0xc8fab,null));};exports['getConfigurations']=function(_0xbe505e,_0x3bd2b0,_0x569a82){var _0x18a72c={};var _0x48dbc4={};var _0x46ade8;var _0x312667;return db[_0x924e('0x2d')]['findOne']({'where':{'id':_0xbe505e['params']['id']}})[_0x924e('0x26')](handleEntityNotFound(_0x3bd2b0,null))[_0x924e('0x26')](function(_0x7c3fe9){if(_0x7c3fe9){_0x46ade8=_0x7c3fe9;_0x48dbc4['model']=_[_0x924e('0x34')](db[_0x924e('0x4f')][_0x924e('0x2e')]);_0x48dbc4[_0x924e('0x33')]=_[_0x924e('0x34')](_0xbe505e[_0x924e('0x33')]);_0x48dbc4['filters']=_[_0x924e('0x36')](_0x48dbc4['model'],_0x48dbc4[_0x924e('0x33')]);_0x18a72c[_0x924e('0x37')]=_[_0x924e('0x36')](_0x48dbc4[_0x924e('0x32')],qs[_0x924e('0x38')](_0xbe505e[_0x924e('0x33')][_0x924e('0x38')]));_0x18a72c['attributes']=_0x18a72c[_0x924e('0x37')]['length']?_0x18a72c[_0x924e('0x37')]:_0x48dbc4[_0x924e('0x32')];_0x18a72c['order']=qs['sort'](_0xbe505e['query'][_0x924e('0x3d')]);_0x18a72c[_0x924e('0x40')]=qs[_0x924e('0x35')](_[_0x924e('0x3e')](_0xbe505e[_0x924e('0x33')],_0x48dbc4['filters']));if(_0xbe505e[_0x924e('0x33')][_0x924e('0x3f')]){_0x18a72c[_0x924e('0x40')]=_['merge'](_0x18a72c[_0x924e('0x40')],{'$or':_['map'](_0x18a72c[_0x924e('0x37')],function(_0x17dcc5){var _0x34c788={};_0x34c788[_0x17dcc5]={'$like':'%'+_0xbe505e[_0x924e('0x33')]['filter']+'%'};return _0x34c788;})});}_0x18a72c=_[_0x924e('0x41')]({},_0x18a72c,_0xbe505e[_0x924e('0x43')]);return _0x46ade8[_0x924e('0x50')](_0x18a72c);}})[_0x924e('0x26')](function(_0x4cdffa){if(_0x4cdffa){_0x312667=_0x4cdffa[_0x924e('0x39')];if(!_0xbe505e[_0x924e('0x33')][_0x924e('0x3a')](_0x924e('0x3b'))){_0x18a72c['limit']=qs[_0x924e('0x21')](_0xbe505e[_0x924e('0x33')][_0x924e('0x21')]);_0x18a72c[_0x924e('0x1f')]=qs[_0x924e('0x1f')](_0xbe505e['query']['offset']);}return _0x46ade8[_0x924e('0x50')](_0x18a72c);}})[_0x924e('0x26')](function(_0x207ec6){if(_0x207ec6){return _0x207ec6?{'count':_0x312667,'rows':_0x207ec6}:null;}})[_0x924e('0x26')](respondWithResult(_0x3bd2b0,null))[_0x924e('0x4c')](handleError(_0x3bd2b0,null));};exports['addConfiguration']=function(_0x311ad1,_0x299ba4,_0x59e155){if(_0x311ad1['body']['id']){delete _0x311ad1[_0x924e('0x4b')]['id'];}return db[_0x924e('0x2d')]['findOne']({'where':{'id':_0x311ad1[_0x924e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x299ba4,null))[_0x924e('0x26')](function(_0x31db6d){if(_0x31db6d){_0x311ad1[_0x924e('0x4b')][_0x924e('0x51')]=_0x31db6d['id'];_0x311ad1[_0x924e('0x4b')][_0x924e('0x52')]=integrations['getSubjects'](_0x311ad1[_0x924e('0x4b')][_0x924e('0x53')],_0x311ad1[_0x924e('0x4b')]['type']);_0x311ad1[_0x924e('0x4b')][_0x924e('0x54')]=integrations[_0x924e('0x55')](_0x311ad1[_0x924e('0x4b')][_0x924e('0x53')],_0x311ad1[_0x924e('0x4b')]['type']);return db['FreshdeskConfiguration']['create'](_0x311ad1[_0x924e('0x4b')],{'include':[{'model':db[_0x924e('0x56')],'as':_0x924e('0x52')},{'model':db['FreshdeskField'],'as':_0x924e('0x54')}]});}return null;})[_0x924e('0x26')](respondWithResult(_0x299ba4,null))[_0x924e('0x4c')](handleError(_0x299ba4,null));};exports[_0x924e('0x57')]=function(_0x50fe75,_0x1c42c9,_0x24adba){var _0x11ce7e='';return db[_0x924e('0x2d')][_0x924e('0x58')]({'where':{'id':_0x50fe75[_0x924e('0x4e')]['id']},'attributes':['id','remoteUri',_0x924e('0x59')]})[_0x924e('0x26')](handleEntityNotFound(_0x1c42c9,null))['then'](function(_0x154549){if(_0x154549){_0x11ce7e=_0x154549[_0x924e('0x5a')];var _0x39ec55=_0x11ce7e['slice'](-0x1);if(_0x39ec55==='/'){_0x11ce7e=_0x11ce7e['substring'](0x0,_0x11ce7e[_0x924e('0x5b')](_0x39ec55));}return rp({'method':_0x924e('0x5c'),'uri':util['format'](_0x924e('0x5d'),_0x11ce7e,_0x924e('0x5e')),'headers':{'Authorization':util[_0x924e('0x5f')](_0x924e('0x60'),new Buffer(util[_0x924e('0x5f')]('%s:X',_0x154549[_0x924e('0x59')]))['toString'](_0x924e('0x61')))},'json':!![]});}})['then'](function(_0x522328){if(_0x522328){var _0x382b6d=['requester',_0x924e('0x62'),_0x924e('0x63'),_0x924e('0x64'),_0x924e('0x1c'),'priority',_0x924e('0x65'),_0x924e('0x66'),_0x924e('0x67'),_0x924e('0x65'),'company'];_['remove'](_0x522328,function(_0x2afda7){return _0x382b6d[_0x924e('0x68')](_0x2afda7[_0x924e('0x2a')])||!_0x2afda7['default']&&_0x2afda7[_0x924e('0x30')]!==_0x924e('0x69')&&_0x2afda7[_0x924e('0x30')]!==_0x924e('0x6a');});return{'count':_0x522328[_0x924e('0x39')],'rows':_[_0x924e('0x2c')](_0x522328,function(_0x23b619){return{'id':_0x23b619['name'],'name':_0x23b619[_0x924e('0x6b')],'custom':!_0x23b619[_0x924e('0x6c')],'options':_0x23b619['choices']?_['map'](_0x23b619[_0x924e('0x6d')],function(_0x1661e8){return{'name':_[_0x924e('0x6e')](_0x1661e8),'value':_0x1661e8};}):[]};})};}})[_0x924e('0x26')](respondWithResult(_0x1c42c9,null))[_0x924e('0x4c')](function(_0x1ae328){var _0x46e2ae=_0x50fe75['query'][_0x924e('0x6f')]?0x1f4:_0x1ae328[_0x924e('0x70')]||0x1f4;logger[_0x924e('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x46e2ae,JSON['stringify'](_0x1ae328));delete _0x1ae328['name'];if(_0x46e2ae===0x191){_0x46e2ae=0x190;}_0x1c42c9[_0x924e('0x1c')](_0x46e2ae)[_0x924e('0x2b')](_0x50fe75[_0x924e('0x33')][_0x924e('0x6f')]?{'message':_0x924e('0x71'),'statusCode':_0x1ae328[_0x924e('0x70')]}:_0x1ae328);});};
\ No newline at end of file
index 25e5299..4201c21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ca0=['bluebird','../../config/environment','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x357aa6,_0x908a2f){var _0x4b29f5=function(_0x52ed53){while(--_0x52ed53){_0x357aa6['push'](_0x357aa6['shift']());}};_0x4b29f5(++_0x908a2f);}(_0x5ca0,0x177));var _0x05ca=function(_0x1ff072,_0x3e75c2){_0x1ff072=_0x1ff072-0x0;var _0x540550=_0x5ca0[_0x1ff072];return _0x540550;};'use strict';var _=require(_0x05ca('0x0'));var util=require(_0x05ca('0x1'));var logger=require(_0x05ca('0x2'))(_0x05ca('0x3'));var moment=require(_0x05ca('0x4'));var BPromise=require(_0x05ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x05ca('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x05ca('0x7')]=function(_0x1c9370,_0x175228){return _0x1c9370[_0x05ca('0x8')]('FreshdeskAccount',attributes,{'tableName':_0x05ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2744=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','lodash','../../config/logger'];(function(_0x1f15bb,_0x4663fb){var _0x3a49ef=function(_0x5aa13c){while(--_0x5aa13c){_0x1f15bb['push'](_0x1f15bb['shift']());}};_0x3a49ef(++_0x4663fb);}(_0x2744,0x77));var _0x4274=function(_0x1703cf,_0x21fed1){_0x1703cf=_0x1703cf-0x0;var _0x4304eb=_0x2744[_0x1703cf];return _0x4304eb;};'use strict';var _=require(_0x4274('0x0'));var util=require('util');var logger=require(_0x4274('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4274('0x2'));var rp=require(_0x4274('0x3'));var fs=require('fs');var path=require(_0x4274('0x4'));var rimraf=require(_0x4274('0x5'));var config=require(_0x4274('0x6'));var attributes=require(_0x4274('0x7'));var integrations=require(_0x4274('0x8'));module['exports']=function(_0x42e38e,_0x6b1b5){return _0x42e38e[_0x4274('0x9')](_0x4274('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0528dff..7b8a4c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabfc=['attributes','include','map','model','then','debug','ShowFreshdeskAccount','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xabfc,0x194));var _0xcabf=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xabfc[_0x328534];return _0x2796c0;};'use strict';var _=require(_0xcabf('0x0'));var util=require(_0xcabf('0x1'));var moment=require(_0xcabf('0x2'));var BPromise=require(_0xcabf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcabf('0x4'));var logger=require('../../config/logger')(_0xcabf('0x5'));var config=require(_0xcabf('0x6'));var jayson=require(_0xcabf('0x7'));var client=jayson[_0xcabf('0x8')][_0xcabf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa50cf2,_0x1e07de,_0x3c8b61){return new BPromise(function(_0x2fcca9,_0x4b39d9){return client[_0xcabf('0xa')](_0xa50cf2,_0x3c8b61)['then'](function(_0x3551d4){logger[_0xcabf('0xb')](_0xcabf('0xc'),_0x1e07de,_0xcabf('0xd'));logger['debug'](_0xcabf('0xe'),_0x1e07de,'request\x20sent',JSON[_0xcabf('0xf')](_0x3551d4));if(_0x3551d4['error']){if(_0x3551d4[_0xcabf('0x10')]['code']===0x1f4){logger[_0xcabf('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x1e07de,_0x3551d4[_0xcabf('0x10')][_0xcabf('0x11')]);return _0x4b39d9(_0x3551d4[_0xcabf('0x10')][_0xcabf('0x11')]);}logger[_0xcabf('0x10')](_0xcabf('0xc'),_0x1e07de,_0x3551d4[_0xcabf('0x10')]['message']);return _0x2fcca9(_0x3551d4[_0xcabf('0x10')]['message']);}else{logger['info'](_0xcabf('0xc'),_0x1e07de,_0xcabf('0xd'));_0x2fcca9(_0x3551d4[_0xcabf('0x12')][_0xcabf('0x11')]);}})['catch'](function(_0x3d0dc9){logger[_0xcabf('0x10')](_0xcabf('0xc'),_0x1e07de,_0x3d0dc9);_0x4b39d9(_0x3d0dc9);});});}exports[_0xcabf('0x13')]=function(_0x52b50d){var _0x4b4b36=this;return new Promise(function(_0x21934a,_0x1f2b61){return db[_0xcabf('0x14')][_0xcabf('0x15')]({'raw':_0x52b50d[_0xcabf('0x16')]?_0x52b50d[_0xcabf('0x16')][_0xcabf('0x17')]===undefined?!![]:![]:!![],'where':_0x52b50d['options']?_0x52b50d[_0xcabf('0x16')][_0xcabf('0x18')]||null:null,'attributes':_0x52b50d['options']?_0x52b50d[_0xcabf('0x16')][_0xcabf('0x19')]||null:null,'limit':_0x52b50d[_0xcabf('0x16')]?_0x52b50d[_0xcabf('0x16')]['limit']||null:null,'include':_0x52b50d[_0xcabf('0x16')]?_0x52b50d[_0xcabf('0x16')][_0xcabf('0x1a')]?_[_0xcabf('0x1b')](_0x52b50d[_0xcabf('0x16')]['include'],function(_0x54c92b){return{'model':db[_0x54c92b['model']],'as':_0x54c92b['as'],'attributes':_0x54c92b[_0xcabf('0x19')],'include':_0x54c92b['include']?_[_0xcabf('0x1b')](_0x54c92b['include'],function(_0xbdc636){return{'model':db[_0xbdc636['model']],'as':_0xbdc636['as'],'attributes':_0xbdc636[_0xcabf('0x19')],'include':_0xbdc636[_0xcabf('0x1a')]?_[_0xcabf('0x1b')](_0xbdc636[_0xcabf('0x1a')],function(_0x52236f){return{'model':db[_0x52236f[_0xcabf('0x1c')]],'as':_0x52236f['as'],'attributes':_0x52236f[_0xcabf('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcabf('0x1d')](function(_0x5d7f9f){logger[_0xcabf('0xb')](_0xcabf('0x13'),_0x52b50d);logger['debug']('GetFreshdeskAccount',_0x52b50d,JSON[_0xcabf('0xf')](_0x5d7f9f));_0x21934a(_0x5d7f9f);})['catch'](function(_0x38529c){logger['error'](_0xcabf('0x13'),_0x38529c[_0xcabf('0x11')],_0x52b50d);_0x1f2b61(_0x4b4b36[_0xcabf('0x10')](0x1f4,_0x38529c[_0xcabf('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x99576c){var _0x2a3c2d=this;return new Promise(function(_0x16ccb2,_0x3191b0){return db[_0xcabf('0x14')]['find']({'raw':_0x99576c[_0xcabf('0x16')]?_0x99576c['options'][_0xcabf('0x17')]===undefined?!![]:![]:!![],'where':_0x99576c[_0xcabf('0x16')]?_0x99576c['options'][_0xcabf('0x18')]||null:null,'attributes':_0x99576c[_0xcabf('0x16')]?_0x99576c[_0xcabf('0x16')][_0xcabf('0x19')]||null:null,'include':_0x99576c[_0xcabf('0x16')]?_0x99576c[_0xcabf('0x16')][_0xcabf('0x1a')]?_['map'](_0x99576c[_0xcabf('0x16')][_0xcabf('0x1a')],function(_0x4c7190){return{'model':db[_0x4c7190[_0xcabf('0x1c')]],'as':_0x4c7190['as'],'attributes':_0x4c7190[_0xcabf('0x19')],'include':_0x4c7190[_0xcabf('0x1a')]?_['map'](_0x4c7190[_0xcabf('0x1a')],function(_0x539840){return{'model':db[_0x539840[_0xcabf('0x1c')]],'as':_0x539840['as'],'attributes':_0x539840[_0xcabf('0x19')],'include':_0x539840[_0xcabf('0x1a')]?_[_0xcabf('0x1b')](_0x539840[_0xcabf('0x1a')],function(_0x2c803f){return{'model':db[_0x2c803f[_0xcabf('0x1c')]],'as':_0x2c803f['as'],'attributes':_0x2c803f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f23fe){logger[_0xcabf('0xb')]('ShowFreshdeskAccount',_0x99576c);logger[_0xcabf('0x1e')](_0xcabf('0x1f'),_0x99576c,JSON[_0xcabf('0xf')](_0x3f23fe));_0x16ccb2(_0x3f23fe);})[_0xcabf('0x20')](function(_0x407412){logger[_0xcabf('0x10')]('ShowFreshdeskAccount',_0x407412['message'],_0x99576c);_0x3191b0(_0x2a3c2d[_0xcabf('0x10')](0x1f4,_0x407412[_0xcabf('0x11')]));});});};
\ No newline at end of file
+var _0x537a=['info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','map','include','model','ShowFreshdeskAccount','find','then','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','debug','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x537a,0xf7));var _0xa537=function(_0x2b332c,_0x4f557f){_0x2b332c=_0x2b332c-0x0;var _0x4423e6=_0x537a[_0x2b332c];return _0x4423e6;};'use strict';var _=require('lodash');var util=require(_0xa537('0x0'));var moment=require('moment');var BPromise=require(_0xa537('0x1'));var rs=require(_0xa537('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa537('0x3'));var logger=require(_0xa537('0x4'))(_0xa537('0x5'));var config=require(_0xa537('0x6'));var jayson=require(_0xa537('0x7'));var client=jayson[_0xa537('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3407,_0xebdbb3,_0xfa73aa){return new BPromise(function(_0xdd920b,_0x25e0b1){return client[_0xa537('0x9')](_0x2a3407,_0xfa73aa)['then'](function(_0x80663d){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xebdbb3,'request\x20sent');logger[_0xa537('0xa')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xebdbb3,_0xa537('0xb'),JSON[_0xa537('0xc')](_0x80663d));if(_0x80663d['error']){if(_0x80663d[_0xa537('0xd')][_0xa537('0xe')]===0x1f4){logger[_0xa537('0xd')](_0xa537('0xf'),_0xebdbb3,_0x80663d['error'][_0xa537('0x10')]);return _0x25e0b1(_0x80663d['error'][_0xa537('0x10')]);}logger[_0xa537('0xd')](_0xa537('0xf'),_0xebdbb3,_0x80663d[_0xa537('0xd')][_0xa537('0x10')]);return _0xdd920b(_0x80663d['error'][_0xa537('0x10')]);}else{logger[_0xa537('0x11')](_0xa537('0xf'),_0xebdbb3,_0xa537('0xb'));_0xdd920b(_0x80663d[_0xa537('0x12')][_0xa537('0x10')]);}})[_0xa537('0x13')](function(_0x2d4a21){logger[_0xa537('0xd')](_0xa537('0xf'),_0xebdbb3,_0x2d4a21);_0x25e0b1(_0x2d4a21);});});}exports[_0xa537('0x14')]=function(_0x2061c3){var _0xcc08ad=this;return new Promise(function(_0x2c0a6e,_0x51e608){return db[_0xa537('0x15')]['findAll']({'raw':_0x2061c3[_0xa537('0x16')]?_0x2061c3['options'][_0xa537('0x17')]===undefined?!![]:![]:!![],'where':_0x2061c3[_0xa537('0x16')]?_0x2061c3[_0xa537('0x16')][_0xa537('0x18')]||null:null,'attributes':_0x2061c3['options']?_0x2061c3['options'][_0xa537('0x19')]||null:null,'limit':_0x2061c3['options']?_0x2061c3[_0xa537('0x16')][_0xa537('0x1a')]||null:null,'include':_0x2061c3[_0xa537('0x16')]?_0x2061c3[_0xa537('0x16')]['include']?_[_0xa537('0x1b')](_0x2061c3[_0xa537('0x16')][_0xa537('0x1c')],function(_0x341549){return{'model':db[_0x341549[_0xa537('0x1d')]],'as':_0x341549['as'],'attributes':_0x341549[_0xa537('0x19')],'include':_0x341549['include']?_[_0xa537('0x1b')](_0x341549[_0xa537('0x1c')],function(_0x2bf608){return{'model':db[_0x2bf608[_0xa537('0x1d')]],'as':_0x2bf608['as'],'attributes':_0x2bf608['attributes'],'include':_0x2bf608['include']?_['map'](_0x2bf608[_0xa537('0x1c')],function(_0xfd1f49){return{'model':db[_0xfd1f49[_0xa537('0x1d')]],'as':_0xfd1f49['as'],'attributes':_0xfd1f49[_0xa537('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3692c7){logger[_0xa537('0x11')]('GetFreshdeskAccount',_0x2061c3);logger[_0xa537('0xa')](_0xa537('0x14'),_0x2061c3,JSON['stringify'](_0x3692c7));_0x2c0a6e(_0x3692c7);})[_0xa537('0x13')](function(_0x515ab7){logger['error'](_0xa537('0x14'),_0x515ab7[_0xa537('0x10')],_0x2061c3);_0x51e608(_0xcc08ad['error'](0x1f4,_0x515ab7[_0xa537('0x10')]));});});};exports[_0xa537('0x1e')]=function(_0x5129ef){var _0x4a1d24=this;return new Promise(function(_0x1c8c6c,_0x153ed4){return db[_0xa537('0x15')][_0xa537('0x1f')]({'raw':_0x5129ef[_0xa537('0x16')]?_0x5129ef[_0xa537('0x16')][_0xa537('0x17')]===undefined?!![]:![]:!![],'where':_0x5129ef['options']?_0x5129ef[_0xa537('0x16')][_0xa537('0x18')]||null:null,'attributes':_0x5129ef['options']?_0x5129ef['options']['attributes']||null:null,'include':_0x5129ef[_0xa537('0x16')]?_0x5129ef[_0xa537('0x16')][_0xa537('0x1c')]?_[_0xa537('0x1b')](_0x5129ef['options']['include'],function(_0x4db686){return{'model':db[_0x4db686[_0xa537('0x1d')]],'as':_0x4db686['as'],'attributes':_0x4db686[_0xa537('0x19')],'include':_0x4db686[_0xa537('0x1c')]?_[_0xa537('0x1b')](_0x4db686['include'],function(_0x7bcbc1){return{'model':db[_0x7bcbc1[_0xa537('0x1d')]],'as':_0x7bcbc1['as'],'attributes':_0x7bcbc1[_0xa537('0x19')],'include':_0x7bcbc1[_0xa537('0x1c')]?_[_0xa537('0x1b')](_0x7bcbc1[_0xa537('0x1c')],function(_0x10721d){return{'model':db[_0x10721d[_0xa537('0x1d')]],'as':_0x10721d['as'],'attributes':_0x10721d[_0xa537('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa537('0x20')](function(_0x23bd77){logger[_0xa537('0x11')](_0xa537('0x1e'),_0x5129ef);logger[_0xa537('0xa')](_0xa537('0x1e'),_0x5129ef,JSON['stringify'](_0x23bd77));_0x1c8c6c(_0x23bd77);})['catch'](function(_0x2aa5ba){logger[_0xa537('0xd')](_0xa537('0x1e'),_0x2aa5ba[_0xa537('0x10')],_0x5129ef);_0x153ed4(_0x4a1d24[_0xa537('0xd')](0x1f4,_0x2aa5ba['message']));});});};
\ No newline at end of file
index 576f94f..3d46514 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadfa=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x271474,_0x248441){var _0x72f117=function(_0x4ad1b9){while(--_0x4ad1b9){_0x271474['push'](_0x271474['shift']());}};_0x72f117(++_0x248441);}(_0xadfa,0x9b));var _0xaadf=function(_0x30ed85,_0x285b6b){_0x30ed85=_0x30ed85-0x0;var _0x286e8d=_0xadfa[_0x30ed85];return _0x286e8d;};'use strict';var multer=require(_0xaadf('0x0'));var util=require(_0xaadf('0x1'));var path=require(_0xaadf('0x2'));var timeout=require(_0xaadf('0x3'));var express=require(_0xaadf('0x4'));var router=express[_0xaadf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaadf('0x6'));var interaction=require(_0xaadf('0x7'));var config=require(_0xaadf('0x8'));var controller=require(_0xaadf('0x9'));router[_0xaadf('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaadf('0xa')](_0xaadf('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xaadf('0xc'),auth[_0xaadf('0xd')](),controller[_0xaadf('0xe')]);router[_0xaadf('0xa')]('/:id/subjects',auth[_0xaadf('0xd')](),controller['getSubjects']);router[_0xaadf('0xa')](_0xaadf('0xf'),auth['isAuthenticated'](),controller[_0xaadf('0x10')]);router['get'](_0xaadf('0x11'),auth[_0xaadf('0xd')](),controller[_0xaadf('0x12')]);router[_0xaadf('0x13')]('/',auth[_0xaadf('0xd')](),controller[_0xaadf('0x14')]);router[_0xaadf('0x13')]('/:id/tags',auth['isAuthenticated'](),controller[_0xaadf('0x15')]);router[_0xaadf('0x16')]('/:id',auth[_0xaadf('0xd')](),controller[_0xaadf('0x17')]);router[_0xaadf('0x18')](_0xaadf('0xb'),auth['isAuthenticated'](),controller[_0xaadf('0x19')]);module[_0xaadf('0x1a')]=router;
\ No newline at end of file
+var _0xb206=['/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','show','get','/:id/fields','getFields'];(function(_0x11b40d,_0x3a55eb){var _0x1c73ce=function(_0x5105ff){while(--_0x5105ff){_0x11b40d['push'](_0x11b40d['shift']());}};_0x1c73ce(++_0x3a55eb);}(_0xb206,0xbb));var _0x6b20=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xb206[_0x5e6cb8];return _0x3faeb3;};'use strict';var multer=require(_0x6b20('0x0'));var util=require(_0x6b20('0x1'));var path=require('path');var timeout=require(_0x6b20('0x2'));var express=require(_0x6b20('0x3'));var router=express[_0x6b20('0x4')]();var fs_extra=require(_0x6b20('0x5'));var auth=require(_0x6b20('0x6'));var interaction=require(_0x6b20('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x6b20('0x8')](),controller['index']);router['get']('/:id',auth[_0x6b20('0x8')](),controller[_0x6b20('0x9')]);router[_0x6b20('0xa')](_0x6b20('0xb'),auth[_0x6b20('0x8')](),controller[_0x6b20('0xc')]);router[_0x6b20('0xa')](_0x6b20('0xd'),auth[_0x6b20('0x8')](),controller['getSubjects']);router[_0x6b20('0xa')](_0x6b20('0xe'),auth[_0x6b20('0x8')](),controller['getDescriptions']);router[_0x6b20('0xa')](_0x6b20('0xf'),auth[_0x6b20('0x8')](),controller[_0x6b20('0x10')]);router[_0x6b20('0x11')]('/',auth[_0x6b20('0x8')](),controller[_0x6b20('0x12')]);router['post'](_0x6b20('0xf'),auth['isAuthenticated'](),controller['setTags']);router[_0x6b20('0x13')]('/:id',auth[_0x6b20('0x8')](),controller[_0x6b20('0x14')]);router[_0x6b20('0x15')](_0x6b20('0x16'),auth[_0x6b20('0x8')](),controller[_0x6b20('0x17')]);module[_0x6b20('0x18')]=router;
\ No newline at end of file
index 15f3b8e..8fa3461 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa237=['STRING','sequelize','exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa237,0xdc));var _0x7a23=function(_0x3775ac,_0x43b235){_0x3775ac=_0x3775ac-0x0;var _0x3f8f5=_0xa237[_0x3775ac];return _0x3f8f5;};'use strict';var Sequelize=require(_0x7a23('0x0'));module[_0x7a23('0x1')]={'name':{'type':Sequelize[_0x7a23('0x2')]},'description':{'type':Sequelize[_0x7a23('0x2')]}};
\ No newline at end of file
+var _0xd5e9=['STRING','sequelize','exports'];(function(_0x2d55b6,_0x1e9fc8){var _0x5517db=function(_0x54e691){while(--_0x54e691){_0x2d55b6['push'](_0x2d55b6['shift']());}};_0x5517db(++_0x1e9fc8);}(_0xd5e9,0x1ae));var _0x9d5e=function(_0x2903ec,_0x4adec2){_0x2903ec=_0x2903ec-0x0;var _0x50251f=_0xd5e9[_0x2903ec];return _0x50251f;};'use strict';var Sequelize=require(_0x9d5e('0x0'));module[_0x9d5e('0x1')]={'name':{'type':Sequelize[_0x9d5e('0x2')]},'description':{'type':Sequelize[_0x9d5e('0x2')]}};
\ No newline at end of file
index d09261b..56fe18e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ffa=['body','update','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','pick','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','end','error','stack','name','send','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0x4ffa,0x108));var _0xa4ff=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4ffa[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xa4ff('0x0'));var rimraf=require(_0xa4ff('0x1'));var zipdir=require(_0xa4ff('0x2'));var jsonpatch=require(_0xa4ff('0x3'));var rp=require(_0xa4ff('0x4'));var moment=require(_0xa4ff('0x5'));var BPromise=require(_0xa4ff('0x6'));var Mustache=require(_0xa4ff('0x7'));var util=require(_0xa4ff('0x8'));var path=require(_0xa4ff('0x9'));var sox=require(_0xa4ff('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4ff('0xb'));var _=require(_0xa4ff('0xc'));var squel=require('squel');var crypto=require(_0xa4ff('0xd'));var jsforce=require(_0xa4ff('0xe'));var deskjs=require(_0xa4ff('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa4ff('0x10'));var Papa=require(_0xa4ff('0x11'));var Redis=require(_0xa4ff('0x12'));var authService=require(_0xa4ff('0x13'));var qs=require(_0xa4ff('0x14'));var as=require(_0xa4ff('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4ff('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa4ff('0x17'));var licenseUtil=require(_0xa4ff('0x18'));var db=require(_0xa4ff('0x19'))['db'];function respondWithStatusCode(_0x2fd317,_0x1ee1aa){_0x1ee1aa=_0x1ee1aa||0xcc;return function(_0x23a2bb){if(_0x23a2bb){return _0x2fd317[_0xa4ff('0x1a')](_0x1ee1aa);}return _0x2fd317[_0xa4ff('0x1b')](_0x1ee1aa)['end']();};}function respondWithResult(_0x2f0ef4,_0x350e8f){_0x350e8f=_0x350e8f||0xc8;return function(_0x40ea47){if(_0x40ea47){return _0x2f0ef4[_0xa4ff('0x1b')](_0x350e8f)[_0xa4ff('0x1c')](_0x40ea47);}};}function respondWithFilteredResult(_0x5e9533,_0x468bb6){return function(_0xdb7f48){if(_0xdb7f48){var _0x486b00=typeof _0x468bb6['offset']===_0xa4ff('0x1d')&&typeof _0x468bb6[_0xa4ff('0x1e')]===_0xa4ff('0x1d');var _0x57f859=_0xdb7f48[_0xa4ff('0x1f')];var _0x5be67d=_0x486b00?0x0:_0x468bb6[_0xa4ff('0x20')];var _0x48c1cc=_0x486b00?_0xdb7f48[_0xa4ff('0x1f')]:_0x468bb6[_0xa4ff('0x20')]+_0x468bb6['limit'];var _0x538cb0;if(_0x48c1cc>=_0x57f859){_0x48c1cc=_0x57f859;_0x538cb0=0xc8;}else{_0x538cb0=0xce;}_0x5e9533['status'](_0x538cb0);return _0x5e9533['set'](_0xa4ff('0x21'),_0x5be67d+'-'+_0x48c1cc+'/'+_0x57f859)[_0xa4ff('0x1c')](_0xdb7f48);}return null;};}function patchUpdates(_0x4dd5af){return function(_0x1dee95){try{jsonpatch[_0xa4ff('0x22')](_0x1dee95,_0x4dd5af,!![]);}catch(_0x1e3332){return BPromise[_0xa4ff('0x23')](_0x1e3332);}return _0x1dee95[_0xa4ff('0x24')]();};}function saveUpdates(_0x220240,_0x3ea013){return function(_0x552f48){if(_0x552f48){return _0x552f48['update'](_0x220240)[_0xa4ff('0x25')](function(_0x237593){return _0x237593;});}return null;};}function removeEntity(_0x5c7118,_0x5346c5){return function(_0x21d191){if(_0x21d191){return _0x21d191['destroy']()[_0xa4ff('0x25')](function(){_0x5c7118[_0xa4ff('0x1b')](0xcc)[_0xa4ff('0x26')]();});}};}function handleEntityNotFound(_0x57a1c6,_0x533361){return function(_0x55f09c){if(!_0x55f09c){_0x57a1c6[_0xa4ff('0x1a')](0x194);}return _0x55f09c;};}function handleError(_0x1d6ce3,_0x1a8160){_0x1a8160=_0x1a8160||0x1f4;return function(_0x99598c){logger[_0xa4ff('0x27')](_0x99598c[_0xa4ff('0x28')]);if(_0x99598c[_0xa4ff('0x29')]){delete _0x99598c[_0xa4ff('0x29')];}_0x1d6ce3[_0xa4ff('0x1b')](_0x1a8160)[_0xa4ff('0x2a')](_0x99598c);};}exports['index']=function(_0x2f07e5,_0x208730){var _0x4770d7={},_0x18eefd={},_0x176466={'count':0x0,'rows':[]};var _0x107a7b=_['map'](db[_0xa4ff('0x2b')][_0xa4ff('0x2c')],function(_0x90ccea){return{'name':_0x90ccea['fieldName'],'type':_0x90ccea[_0xa4ff('0x2d')][_0xa4ff('0x2e')]};});_0x18eefd[_0xa4ff('0x2f')]=_[_0xa4ff('0x30')](_0x107a7b,_0xa4ff('0x29'));_0x18eefd[_0xa4ff('0x31')]=_[_0xa4ff('0x32')](_0x2f07e5[_0xa4ff('0x31')]);_0x18eefd[_0xa4ff('0x33')]=_[_0xa4ff('0x34')](_0x18eefd['model'],_0x18eefd['query']);_0x4770d7[_0xa4ff('0x35')]=_[_0xa4ff('0x34')](_0x18eefd[_0xa4ff('0x2f')],qs[_0xa4ff('0x36')](_0x2f07e5['query'][_0xa4ff('0x36')]));_0x4770d7[_0xa4ff('0x35')]=_0x4770d7['attributes'][_0xa4ff('0x37')]?_0x4770d7[_0xa4ff('0x35')]:_0x18eefd['model'];if(!_0x2f07e5[_0xa4ff('0x31')][_0xa4ff('0x38')](_0xa4ff('0x39'))){_0x4770d7[_0xa4ff('0x1e')]=qs['limit'](_0x2f07e5[_0xa4ff('0x31')]['limit']);_0x4770d7[_0xa4ff('0x20')]=qs[_0xa4ff('0x20')](_0x2f07e5[_0xa4ff('0x31')][_0xa4ff('0x20')]);}_0x4770d7[_0xa4ff('0x3a')]=qs['sort'](_0x2f07e5[_0xa4ff('0x31')][_0xa4ff('0x3b')]);_0x4770d7['where']=qs[_0xa4ff('0x33')](_['pick'](_0x2f07e5[_0xa4ff('0x31')],_0x18eefd[_0xa4ff('0x33')]),_0x107a7b);if(_0x2f07e5[_0xa4ff('0x31')][_0xa4ff('0x3c')]){_0x4770d7['where']=_['merge'](_0x4770d7[_0xa4ff('0x3d')],{'$or':_[_0xa4ff('0x30')](_0x107a7b,function(_0x4699bf){if(_0x4699bf[_0xa4ff('0x2d')]!==_0xa4ff('0x3e')){var _0x426bfa={};_0x426bfa[_0x4699bf['name']]={'$like':'%'+_0x2f07e5[_0xa4ff('0x31')][_0xa4ff('0x3c')]+'%'};return _0x426bfa;}})});}_0x4770d7=_[_0xa4ff('0x3f')]({},_0x4770d7,_0x2f07e5[_0xa4ff('0x40')]);var _0x5e9e3e={'where':_0x4770d7[_0xa4ff('0x3d')]};return db[_0xa4ff('0x2b')][_0xa4ff('0x1f')](_0x5e9e3e)[_0xa4ff('0x25')](function(_0x10a03c){_0x176466[_0xa4ff('0x1f')]=_0x10a03c;if(_0x2f07e5[_0xa4ff('0x31')][_0xa4ff('0x41')]){_0x4770d7[_0xa4ff('0x42')]=[{'all':!![]}];}return db[_0xa4ff('0x2b')][_0xa4ff('0x43')](_0x4770d7);})['then'](function(_0x4a8ff6){_0x176466['rows']=_0x4a8ff6;return _0x176466;})['then'](respondWithFilteredResult(_0x208730,_0x4770d7))[_0xa4ff('0x44')](handleError(_0x208730,null));};exports[_0xa4ff('0x45')]=function(_0x1b7ab8,_0x3e76f0){var _0x382909={'raw':![],'where':{'id':_0x1b7ab8[_0xa4ff('0x46')]['id']}},_0x199c74={};_0x199c74[_0xa4ff('0x2f')]=_['keys'](db[_0xa4ff('0x2b')][_0xa4ff('0x2c')]);_0x199c74[_0xa4ff('0x31')]=_[_0xa4ff('0x32')](_0x1b7ab8['query']);_0x199c74[_0xa4ff('0x33')]=_[_0xa4ff('0x34')](_0x199c74[_0xa4ff('0x2f')],_0x199c74[_0xa4ff('0x31')]);_0x382909[_0xa4ff('0x35')]=_[_0xa4ff('0x34')](_0x199c74[_0xa4ff('0x2f')],qs['fields'](_0x1b7ab8['query'][_0xa4ff('0x36')]));_0x382909[_0xa4ff('0x35')]=_0x382909[_0xa4ff('0x35')]['length']?_0x382909[_0xa4ff('0x35')]:_0x199c74[_0xa4ff('0x2f')];if(_0x1b7ab8['query']['includeAll']){_0x382909[_0xa4ff('0x42')]=[{'all':!![]}];}_0x382909=_[_0xa4ff('0x3f')]({},_0x382909,_0x1b7ab8[_0xa4ff('0x40')]);return db[_0xa4ff('0x2b')][_0xa4ff('0x47')](_0x382909)[_0xa4ff('0x25')](handleEntityNotFound(_0x3e76f0,null))['then'](respondWithResult(_0x3e76f0,null))[_0xa4ff('0x44')](handleError(_0x3e76f0,null));};exports['create']=function(_0x2ade8c,_0x345c7f){return db['FreshdeskConfiguration']['create'](_0x2ade8c[_0xa4ff('0x48')],{})[_0xa4ff('0x25')](respondWithResult(_0x345c7f,0xc9))[_0xa4ff('0x44')](handleError(_0x345c7f,null));};exports[_0xa4ff('0x49')]=function(_0xf724d7,_0xf671b8){if(_0xf724d7[_0xa4ff('0x48')]['id']){delete _0xf724d7[_0xa4ff('0x48')]['id'];}return db[_0xa4ff('0x2b')][_0xa4ff('0x47')]({'where':{'id':_0xf724d7[_0xa4ff('0x46')]['id']}})[_0xa4ff('0x25')](handleEntityNotFound(_0xf671b8,null))[_0xa4ff('0x25')](saveUpdates(_0xf724d7[_0xa4ff('0x48')],null))[_0xa4ff('0x25')](respondWithResult(_0xf671b8,null))[_0xa4ff('0x44')](handleError(_0xf671b8,null));};exports[_0xa4ff('0x4a')]=function(_0x5732c1,_0x435cc7){return db['FreshdeskConfiguration'][_0xa4ff('0x47')]({'where':{'id':_0x5732c1['params']['id']}})[_0xa4ff('0x25')](handleEntityNotFound(_0x435cc7,null))[_0xa4ff('0x25')](removeEntity(_0x435cc7,null))[_0xa4ff('0x44')](handleError(_0x435cc7,null));};exports[_0xa4ff('0x4b')]=function(_0x1dd009,_0x3e7308,_0x4f847e){var _0x13e897={};var _0x89537c={};var _0x100a05;var _0x27e7d9;return db['FreshdeskConfiguration'][_0xa4ff('0x4c')]({'where':{'id':_0x1dd009[_0xa4ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e7308,null))[_0xa4ff('0x25')](function(_0x1ae0dc){if(_0x1ae0dc){_0x100a05=_0x1ae0dc;_0x89537c[_0xa4ff('0x2f')]=_[_0xa4ff('0x32')](db[_0xa4ff('0x4d')][_0xa4ff('0x2c')]);_0x89537c[_0xa4ff('0x31')]=_[_0xa4ff('0x32')](_0x1dd009['query']);_0x89537c[_0xa4ff('0x33')]=_[_0xa4ff('0x34')](_0x89537c['model'],_0x89537c['query']);_0x13e897[_0xa4ff('0x35')]=_['intersection'](_0x89537c[_0xa4ff('0x2f')],qs[_0xa4ff('0x36')](_0x1dd009['query'][_0xa4ff('0x36')]));_0x13e897[_0xa4ff('0x35')]=_0x13e897[_0xa4ff('0x35')][_0xa4ff('0x37')]?_0x13e897[_0xa4ff('0x35')]:_0x89537c[_0xa4ff('0x2f')];_0x13e897[_0xa4ff('0x3a')]=qs[_0xa4ff('0x3b')](_0x1dd009['query'][_0xa4ff('0x3b')]);_0x13e897[_0xa4ff('0x3d')]=qs[_0xa4ff('0x33')](_['pick'](_0x1dd009['query'],_0x89537c[_0xa4ff('0x33')]));if(_0x1dd009[_0xa4ff('0x31')]['filter']){_0x13e897[_0xa4ff('0x3d')]=_[_0xa4ff('0x3f')](_0x13e897[_0xa4ff('0x3d')],{'$or':_[_0xa4ff('0x30')](_0x13e897[_0xa4ff('0x35')],function(_0x583022){var _0x3a3e24={};_0x3a3e24[_0x583022]={'$like':'%'+_0x1dd009[_0xa4ff('0x31')][_0xa4ff('0x3c')]+'%'};return _0x3a3e24;})});}_0x13e897=_[_0xa4ff('0x3f')]({},_0x13e897,_0x1dd009[_0xa4ff('0x40')]);return _0x100a05[_0xa4ff('0x4b')](_0x13e897);}})[_0xa4ff('0x25')](function(_0x320dc8){if(_0x320dc8){_0x27e7d9=_0x320dc8[_0xa4ff('0x37')];if(!_0x1dd009['query'][_0xa4ff('0x38')](_0xa4ff('0x39'))){_0x13e897[_0xa4ff('0x1e')]=qs[_0xa4ff('0x1e')](_0x1dd009['query'][_0xa4ff('0x1e')]);_0x13e897[_0xa4ff('0x20')]=qs[_0xa4ff('0x20')](_0x1dd009[_0xa4ff('0x31')][_0xa4ff('0x20')]);}return _0x100a05[_0xa4ff('0x4b')](_0x13e897);}})[_0xa4ff('0x25')](function(_0x3930d0){if(_0x3930d0){return _0x3930d0?{'count':_0x27e7d9,'rows':_0x3930d0}:null;}})[_0xa4ff('0x25')](respondWithResult(_0x3e7308,null))[_0xa4ff('0x44')](handleError(_0x3e7308,null));};exports[_0xa4ff('0x4e')]=function(_0x46c9d3,_0x5d22b9,_0x15f671){var _0x129957={};var _0x38635f={};var _0x284d31;var _0x2135c4;return db['FreshdeskConfiguration'][_0xa4ff('0x4c')]({'where':{'id':_0x46c9d3['params']['id']}})[_0xa4ff('0x25')](handleEntityNotFound(_0x5d22b9,null))['then'](function(_0x3b82c8){if(_0x3b82c8){_0x284d31=_0x3b82c8;_0x38635f[_0xa4ff('0x2f')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x38635f[_0xa4ff('0x31')]=_[_0xa4ff('0x32')](_0x46c9d3['query']);_0x38635f['filters']=_[_0xa4ff('0x34')](_0x38635f['model'],_0x38635f['query']);_0x129957[_0xa4ff('0x35')]=_[_0xa4ff('0x34')](_0x38635f[_0xa4ff('0x2f')],qs['fields'](_0x46c9d3[_0xa4ff('0x31')]['fields']));_0x129957[_0xa4ff('0x35')]=_0x129957[_0xa4ff('0x35')][_0xa4ff('0x37')]?_0x129957[_0xa4ff('0x35')]:_0x38635f['model'];_0x129957['order']=qs[_0xa4ff('0x3b')](_0x46c9d3[_0xa4ff('0x31')][_0xa4ff('0x3b')]);_0x129957[_0xa4ff('0x3d')]=qs[_0xa4ff('0x33')](_['pick'](_0x46c9d3['query'],_0x38635f[_0xa4ff('0x33')]));if(_0x46c9d3[_0xa4ff('0x31')][_0xa4ff('0x3c')]){_0x129957[_0xa4ff('0x3d')]=_[_0xa4ff('0x3f')](_0x129957['where'],{'$or':_['map'](_0x129957[_0xa4ff('0x35')],function(_0x5e3ed2){var _0x1c679b={};_0x1c679b[_0x5e3ed2]={'$like':'%'+_0x46c9d3['query'][_0xa4ff('0x3c')]+'%'};return _0x1c679b;})});}_0x129957=_[_0xa4ff('0x3f')]({},_0x129957,_0x46c9d3[_0xa4ff('0x40')]);return _0x284d31['getSubjects'](_0x129957);}})[_0xa4ff('0x25')](function(_0xf472eb){if(_0xf472eb){_0x2135c4=_0xf472eb[_0xa4ff('0x37')];if(!_0x46c9d3[_0xa4ff('0x31')]['hasOwnProperty'](_0xa4ff('0x39'))){_0x129957[_0xa4ff('0x1e')]=qs['limit'](_0x46c9d3[_0xa4ff('0x31')][_0xa4ff('0x1e')]);_0x129957[_0xa4ff('0x20')]=qs[_0xa4ff('0x20')](_0x46c9d3[_0xa4ff('0x31')][_0xa4ff('0x20')]);}return _0x284d31['getSubjects'](_0x129957);}})[_0xa4ff('0x25')](function(_0x1302b8){if(_0x1302b8){return _0x1302b8?{'count':_0x2135c4,'rows':_0x1302b8}:null;}})['then'](respondWithResult(_0x5d22b9,null))[_0xa4ff('0x44')](handleError(_0x5d22b9,null));};exports[_0xa4ff('0x4f')]=function(_0x2e643b,_0x2ab682,_0x28271a){var _0x3e888f={};var _0x3d0a5a={};var _0x681d4a;var _0x4a0ef3;return db[_0xa4ff('0x2b')][_0xa4ff('0x4c')]({'where':{'id':_0x2e643b['params']['id']}})['then'](handleEntityNotFound(_0x2ab682,null))[_0xa4ff('0x25')](function(_0x2f0e14){if(_0x2f0e14){_0x681d4a=_0x2f0e14;_0x3d0a5a[_0xa4ff('0x2f')]=_[_0xa4ff('0x32')](db[_0xa4ff('0x4d')][_0xa4ff('0x2c')]);_0x3d0a5a[_0xa4ff('0x31')]=_['keys'](_0x2e643b[_0xa4ff('0x31')]);_0x3d0a5a['filters']=_[_0xa4ff('0x34')](_0x3d0a5a[_0xa4ff('0x2f')],_0x3d0a5a[_0xa4ff('0x31')]);_0x3e888f['attributes']=_[_0xa4ff('0x34')](_0x3d0a5a[_0xa4ff('0x2f')],qs[_0xa4ff('0x36')](_0x2e643b[_0xa4ff('0x31')][_0xa4ff('0x36')]));_0x3e888f[_0xa4ff('0x35')]=_0x3e888f['attributes'][_0xa4ff('0x37')]?_0x3e888f[_0xa4ff('0x35')]:_0x3d0a5a[_0xa4ff('0x2f')];_0x3e888f[_0xa4ff('0x3a')]=qs['sort'](_0x2e643b[_0xa4ff('0x31')][_0xa4ff('0x3b')]);_0x3e888f[_0xa4ff('0x3d')]=qs[_0xa4ff('0x33')](_['pick'](_0x2e643b[_0xa4ff('0x31')],_0x3d0a5a[_0xa4ff('0x33')]));if(_0x2e643b[_0xa4ff('0x31')][_0xa4ff('0x3c')]){_0x3e888f['where']=_[_0xa4ff('0x3f')](_0x3e888f[_0xa4ff('0x3d')],{'$or':_[_0xa4ff('0x30')](_0x3e888f[_0xa4ff('0x35')],function(_0x356cf7){var _0x1fa73c={};_0x1fa73c[_0x356cf7]={'$like':'%'+_0x2e643b[_0xa4ff('0x31')][_0xa4ff('0x3c')]+'%'};return _0x1fa73c;})});}_0x3e888f=_[_0xa4ff('0x3f')]({},_0x3e888f,_0x2e643b['options']);return _0x681d4a[_0xa4ff('0x4f')](_0x3e888f);}})['then'](function(_0x2e9066){if(_0x2e9066){_0x4a0ef3=_0x2e9066['length'];if(!_0x2e643b['query'][_0xa4ff('0x38')](_0xa4ff('0x39'))){_0x3e888f['limit']=qs['limit'](_0x2e643b[_0xa4ff('0x31')][_0xa4ff('0x1e')]);_0x3e888f[_0xa4ff('0x20')]=qs[_0xa4ff('0x20')](_0x2e643b[_0xa4ff('0x31')][_0xa4ff('0x20')]);}return _0x681d4a[_0xa4ff('0x4f')](_0x3e888f);}})[_0xa4ff('0x25')](function(_0x3e3bce){if(_0x3e3bce){return _0x3e3bce?{'count':_0x4a0ef3,'rows':_0x3e3bce}:null;}})[_0xa4ff('0x25')](respondWithResult(_0x2ab682,null))['catch'](handleError(_0x2ab682,null));};exports[_0xa4ff('0x50')]=function(_0x589a02,_0x4c0c24,_0x2b5090){var _0x125e71={};var _0x5c9087={};var _0x5b490a;var _0x75faa4;return db[_0xa4ff('0x2b')]['findOne']({'where':{'id':_0x589a02[_0xa4ff('0x46')]['id']}})[_0xa4ff('0x25')](handleEntityNotFound(_0x4c0c24,null))[_0xa4ff('0x25')](function(_0x1bb3e7){if(_0x1bb3e7){_0x5b490a=_0x1bb3e7;_0x5c9087[_0xa4ff('0x2f')]=_[_0xa4ff('0x32')](db[_0xa4ff('0x51')][_0xa4ff('0x2c')]);_0x5c9087[_0xa4ff('0x31')]=_[_0xa4ff('0x32')](_0x589a02[_0xa4ff('0x31')]);_0x5c9087[_0xa4ff('0x33')]=_['intersection'](_0x5c9087['model'],_0x5c9087[_0xa4ff('0x31')]);_0x125e71[_0xa4ff('0x35')]=_[_0xa4ff('0x34')](_0x5c9087[_0xa4ff('0x2f')],qs['fields'](_0x589a02[_0xa4ff('0x31')][_0xa4ff('0x36')]));_0x125e71['attributes']=_0x125e71['attributes'][_0xa4ff('0x37')]?_0x125e71['attributes']:_0x5c9087[_0xa4ff('0x2f')];_0x125e71[_0xa4ff('0x3a')]=qs[_0xa4ff('0x3b')](_0x589a02['query']['sort']);_0x125e71[_0xa4ff('0x3d')]=qs[_0xa4ff('0x33')](_[_0xa4ff('0x52')](_0x589a02[_0xa4ff('0x31')],_0x5c9087[_0xa4ff('0x33')]));if(_0x589a02[_0xa4ff('0x31')][_0xa4ff('0x3c')]){_0x125e71[_0xa4ff('0x3d')]=_[_0xa4ff('0x3f')](_0x125e71[_0xa4ff('0x3d')],{'$or':_[_0xa4ff('0x30')](_0x125e71[_0xa4ff('0x35')],function(_0x135a88){var _0x242a19={};_0x242a19[_0x135a88]={'$like':'%'+_0x589a02['query']['filter']+'%'};return _0x242a19;})});}_0x125e71=_[_0xa4ff('0x3f')]({},_0x125e71,_0x589a02[_0xa4ff('0x40')]);return _0x5b490a[_0xa4ff('0x50')](_0x125e71);}})[_0xa4ff('0x25')](function(_0x34a0f7){if(_0x34a0f7){_0x75faa4=_0x34a0f7[_0xa4ff('0x37')];if(!_0x589a02[_0xa4ff('0x31')]['hasOwnProperty'](_0xa4ff('0x39'))){_0x125e71['limit']=qs['limit'](_0x589a02[_0xa4ff('0x31')]['limit']);_0x125e71[_0xa4ff('0x20')]=qs[_0xa4ff('0x20')](_0x589a02[_0xa4ff('0x31')][_0xa4ff('0x20')]);}return _0x5b490a['getTags'](_0x125e71);}})[_0xa4ff('0x25')](function(_0x209fed){if(_0x209fed){return _0x209fed?{'count':_0x75faa4,'rows':_0x209fed}:null;}})['then'](respondWithResult(_0x4c0c24,null))['catch'](handleError(_0x4c0c24,null));};exports['setTags']=function(_0x50be69,_0x58dd8f,_0x32ab76){if(_0x50be69[_0xa4ff('0x48')]['id']){delete _0x50be69[_0xa4ff('0x48')]['id'];}return db[_0xa4ff('0x2b')][_0xa4ff('0x4c')]({'where':{'id':_0x50be69[_0xa4ff('0x46')]['id']}})[_0xa4ff('0x25')](handleEntityNotFound(_0x58dd8f,null))[_0xa4ff('0x25')](function(_0x405b71){if(_0x405b71){return _0x405b71['setTags'](_0x50be69[_0xa4ff('0x48')][_0xa4ff('0x53')]||[]);}return null;})[_0xa4ff('0x25')](respondWithResult(_0x58dd8f,null))['catch'](handleError(_0x58dd8f,null));};
\ No newline at end of file
+var _0xdbd1=['params','includeAll','find','catch','create','body','FreshdeskField','pick','nolimit','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show'];(function(_0x1f6691,_0x3a3d46){var _0xf786b6=function(_0x2afbdb){while(--_0x2afbdb){_0x1f6691['push'](_0x1f6691['shift']());}};_0xf786b6(++_0x3a3d46);}(_0xdbd1,0x151));var _0x1dbd=function(_0x3b4de2,_0x525d6b){_0x3b4de2=_0x3b4de2-0x0;var _0x530dfa=_0xdbd1[_0x3b4de2];return _0x530dfa;};'use strict';var emlformat=require(_0x1dbd('0x0'));var rimraf=require(_0x1dbd('0x1'));var zipdir=require(_0x1dbd('0x2'));var jsonpatch=require(_0x1dbd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1dbd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1dbd('0x5'));var sox=require(_0x1dbd('0x6'));var csv=require(_0x1dbd('0x7'));var ejs=require(_0x1dbd('0x8'));var fs=require('fs');var fs_extra=require(_0x1dbd('0x9'));var _=require(_0x1dbd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1dbd('0xb'));var deskjs=require(_0x1dbd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1dbd('0xd'));var Papa=require('papaparse');var Redis=require(_0x1dbd('0xe'));var authService=require(_0x1dbd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dbd('0x10'));var logger=require(_0x1dbd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x1dbd('0x12'));var licenseUtil=require(_0x1dbd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a42a7,_0x4c50ce){_0x4c50ce=_0x4c50ce||0xcc;return function(_0x13be99){if(_0x13be99){return _0x2a42a7[_0x1dbd('0x14')](_0x4c50ce);}return _0x2a42a7[_0x1dbd('0x15')](_0x4c50ce)['end']();};}function respondWithResult(_0x173941,_0x5b5cbd){_0x5b5cbd=_0x5b5cbd||0xc8;return function(_0x295473){if(_0x295473){return _0x173941[_0x1dbd('0x15')](_0x5b5cbd)[_0x1dbd('0x16')](_0x295473);}};}function respondWithFilteredResult(_0x2f1f6b,_0x39c586){return function(_0x24b0e9){if(_0x24b0e9){var _0x554657=typeof _0x39c586[_0x1dbd('0x17')]==='undefined'&&typeof _0x39c586[_0x1dbd('0x18')]===_0x1dbd('0x19');var _0x5ca4eb=_0x24b0e9['count'];var _0x182c6e=_0x554657?0x0:_0x39c586['offset'];var _0x393a20=_0x554657?_0x24b0e9[_0x1dbd('0x1a')]:_0x39c586[_0x1dbd('0x17')]+_0x39c586[_0x1dbd('0x18')];var _0x32522e;if(_0x393a20>=_0x5ca4eb){_0x393a20=_0x5ca4eb;_0x32522e=0xc8;}else{_0x32522e=0xce;}_0x2f1f6b[_0x1dbd('0x15')](_0x32522e);return _0x2f1f6b[_0x1dbd('0x1b')](_0x1dbd('0x1c'),_0x182c6e+'-'+_0x393a20+'/'+_0x5ca4eb)[_0x1dbd('0x16')](_0x24b0e9);}return null;};}function patchUpdates(_0x36ed0b){return function(_0xb6b0f){try{jsonpatch[_0x1dbd('0x1d')](_0xb6b0f,_0x36ed0b,!![]);}catch(_0x36e3fe){return BPromise[_0x1dbd('0x1e')](_0x36e3fe);}return _0xb6b0f['save']();};}function saveUpdates(_0x2cc69e,_0x2bcdef){return function(_0x13c333){if(_0x13c333){return _0x13c333[_0x1dbd('0x1f')](_0x2cc69e)[_0x1dbd('0x20')](function(_0x1a4389){return _0x1a4389;});}return null;};}function removeEntity(_0x377daa,_0x4ba718){return function(_0xa214a7){if(_0xa214a7){return _0xa214a7[_0x1dbd('0x21')]()['then'](function(){_0x377daa[_0x1dbd('0x15')](0xcc)[_0x1dbd('0x22')]();});}};}function handleEntityNotFound(_0x22b059,_0x2557dd){return function(_0x1aa128){if(!_0x1aa128){_0x22b059[_0x1dbd('0x14')](0x194);}return _0x1aa128;};}function handleError(_0xb68a16,_0x3dbe78){_0x3dbe78=_0x3dbe78||0x1f4;return function(_0x7be125){logger[_0x1dbd('0x23')](_0x7be125['stack']);if(_0x7be125[_0x1dbd('0x24')]){delete _0x7be125['name'];}_0xb68a16[_0x1dbd('0x15')](_0x3dbe78)['send'](_0x7be125);};}exports[_0x1dbd('0x25')]=function(_0x5148c7,_0x4f5e62){var _0x6525ca={},_0x2bbfbb={},_0x37f892={'count':0x0,'rows':[]};var _0x35ee0c=_['map'](db[_0x1dbd('0x26')][_0x1dbd('0x27')],function(_0x3b0312){return{'name':_0x3b0312[_0x1dbd('0x28')],'type':_0x3b0312[_0x1dbd('0x29')]['key']};});_0x2bbfbb[_0x1dbd('0x2a')]=_[_0x1dbd('0x2b')](_0x35ee0c,_0x1dbd('0x24'));_0x2bbfbb['query']=_[_0x1dbd('0x2c')](_0x5148c7[_0x1dbd('0x2d')]);_0x2bbfbb['filters']=_['intersection'](_0x2bbfbb[_0x1dbd('0x2a')],_0x2bbfbb[_0x1dbd('0x2d')]);_0x6525ca[_0x1dbd('0x2e')]=_[_0x1dbd('0x2f')](_0x2bbfbb[_0x1dbd('0x2a')],qs['fields'](_0x5148c7[_0x1dbd('0x2d')][_0x1dbd('0x30')]));_0x6525ca[_0x1dbd('0x2e')]=_0x6525ca[_0x1dbd('0x2e')][_0x1dbd('0x31')]?_0x6525ca[_0x1dbd('0x2e')]:_0x2bbfbb[_0x1dbd('0x2a')];if(!_0x5148c7[_0x1dbd('0x2d')][_0x1dbd('0x32')]('nolimit')){_0x6525ca['limit']=qs[_0x1dbd('0x18')](_0x5148c7['query'][_0x1dbd('0x18')]);_0x6525ca['offset']=qs[_0x1dbd('0x17')](_0x5148c7['query'][_0x1dbd('0x17')]);}_0x6525ca[_0x1dbd('0x33')]=qs[_0x1dbd('0x34')](_0x5148c7[_0x1dbd('0x2d')]['sort']);_0x6525ca[_0x1dbd('0x35')]=qs[_0x1dbd('0x36')](_['pick'](_0x5148c7[_0x1dbd('0x2d')],_0x2bbfbb['filters']),_0x35ee0c);if(_0x5148c7[_0x1dbd('0x2d')][_0x1dbd('0x37')]){_0x6525ca[_0x1dbd('0x35')]=_[_0x1dbd('0x38')](_0x6525ca['where'],{'$or':_[_0x1dbd('0x2b')](_0x35ee0c,function(_0x45789b){if(_0x45789b[_0x1dbd('0x29')]!==_0x1dbd('0x39')){var _0x2e9349={};_0x2e9349[_0x45789b[_0x1dbd('0x24')]]={'$like':'%'+_0x5148c7['query'][_0x1dbd('0x37')]+'%'};return _0x2e9349;}})});}_0x6525ca=_[_0x1dbd('0x38')]({},_0x6525ca,_0x5148c7[_0x1dbd('0x3a')]);var _0x41fb0c={'where':_0x6525ca[_0x1dbd('0x35')]};return db['FreshdeskConfiguration']['count'](_0x41fb0c)[_0x1dbd('0x20')](function(_0x28f05d){_0x37f892[_0x1dbd('0x1a')]=_0x28f05d;if(_0x5148c7[_0x1dbd('0x2d')]['includeAll']){_0x6525ca[_0x1dbd('0x3b')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x1dbd('0x3c')](_0x6525ca);})['then'](function(_0x28f247){_0x37f892[_0x1dbd('0x3d')]=_0x28f247;return _0x37f892;})[_0x1dbd('0x20')](respondWithFilteredResult(_0x4f5e62,_0x6525ca))['catch'](handleError(_0x4f5e62,null));};exports[_0x1dbd('0x3e')]=function(_0x51e493,_0x584d1c){var _0xdb14c={'raw':![],'where':{'id':_0x51e493[_0x1dbd('0x3f')]['id']}},_0x2e8642={};_0x2e8642['model']=_[_0x1dbd('0x2c')](db[_0x1dbd('0x26')][_0x1dbd('0x27')]);_0x2e8642[_0x1dbd('0x2d')]=_[_0x1dbd('0x2c')](_0x51e493[_0x1dbd('0x2d')]);_0x2e8642[_0x1dbd('0x36')]=_[_0x1dbd('0x2f')](_0x2e8642[_0x1dbd('0x2a')],_0x2e8642[_0x1dbd('0x2d')]);_0xdb14c[_0x1dbd('0x2e')]=_['intersection'](_0x2e8642['model'],qs[_0x1dbd('0x30')](_0x51e493[_0x1dbd('0x2d')]['fields']));_0xdb14c['attributes']=_0xdb14c[_0x1dbd('0x2e')][_0x1dbd('0x31')]?_0xdb14c['attributes']:_0x2e8642['model'];if(_0x51e493[_0x1dbd('0x2d')][_0x1dbd('0x40')]){_0xdb14c[_0x1dbd('0x3b')]=[{'all':!![]}];}_0xdb14c=_[_0x1dbd('0x38')]({},_0xdb14c,_0x51e493[_0x1dbd('0x3a')]);return db['FreshdeskConfiguration'][_0x1dbd('0x41')](_0xdb14c)[_0x1dbd('0x20')](handleEntityNotFound(_0x584d1c,null))[_0x1dbd('0x20')](respondWithResult(_0x584d1c,null))[_0x1dbd('0x42')](handleError(_0x584d1c,null));};exports[_0x1dbd('0x43')]=function(_0xce1eff,_0x2fac4d){return db[_0x1dbd('0x26')][_0x1dbd('0x43')](_0xce1eff[_0x1dbd('0x44')],{})['then'](respondWithResult(_0x2fac4d,0xc9))['catch'](handleError(_0x2fac4d,null));};exports['update']=function(_0x55561e,_0x3c60b4){if(_0x55561e[_0x1dbd('0x44')]['id']){delete _0x55561e[_0x1dbd('0x44')]['id'];}return db[_0x1dbd('0x26')][_0x1dbd('0x41')]({'where':{'id':_0x55561e[_0x1dbd('0x3f')]['id']}})[_0x1dbd('0x20')](handleEntityNotFound(_0x3c60b4,null))['then'](saveUpdates(_0x55561e[_0x1dbd('0x44')],null))[_0x1dbd('0x20')](respondWithResult(_0x3c60b4,null))[_0x1dbd('0x42')](handleError(_0x3c60b4,null));};exports['destroy']=function(_0x310283,_0x138d92){return db['FreshdeskConfiguration'][_0x1dbd('0x41')]({'where':{'id':_0x310283[_0x1dbd('0x3f')]['id']}})[_0x1dbd('0x20')](handleEntityNotFound(_0x138d92,null))[_0x1dbd('0x20')](removeEntity(_0x138d92,null))['catch'](handleError(_0x138d92,null));};exports['getFields']=function(_0x2e128f,_0x2b503f,_0x5c4f8f){var _0x21d29f={};var _0x4603df={};var _0x59fd3a;var _0x1989f9;return db[_0x1dbd('0x26')]['findOne']({'where':{'id':_0x2e128f['params']['id']}})['then'](handleEntityNotFound(_0x2b503f,null))[_0x1dbd('0x20')](function(_0x474826){if(_0x474826){_0x59fd3a=_0x474826;_0x4603df[_0x1dbd('0x2a')]=_[_0x1dbd('0x2c')](db[_0x1dbd('0x45')]['rawAttributes']);_0x4603df[_0x1dbd('0x2d')]=_[_0x1dbd('0x2c')](_0x2e128f[_0x1dbd('0x2d')]);_0x4603df[_0x1dbd('0x36')]=_[_0x1dbd('0x2f')](_0x4603df[_0x1dbd('0x2a')],_0x4603df[_0x1dbd('0x2d')]);_0x21d29f['attributes']=_['intersection'](_0x4603df[_0x1dbd('0x2a')],qs[_0x1dbd('0x30')](_0x2e128f[_0x1dbd('0x2d')][_0x1dbd('0x30')]));_0x21d29f[_0x1dbd('0x2e')]=_0x21d29f[_0x1dbd('0x2e')][_0x1dbd('0x31')]?_0x21d29f[_0x1dbd('0x2e')]:_0x4603df[_0x1dbd('0x2a')];_0x21d29f[_0x1dbd('0x33')]=qs[_0x1dbd('0x34')](_0x2e128f[_0x1dbd('0x2d')][_0x1dbd('0x34')]);_0x21d29f[_0x1dbd('0x35')]=qs[_0x1dbd('0x36')](_[_0x1dbd('0x46')](_0x2e128f[_0x1dbd('0x2d')],_0x4603df[_0x1dbd('0x36')]));if(_0x2e128f[_0x1dbd('0x2d')]['filter']){_0x21d29f[_0x1dbd('0x35')]=_[_0x1dbd('0x38')](_0x21d29f['where'],{'$or':_['map'](_0x21d29f[_0x1dbd('0x2e')],function(_0xcec08e){var _0x185cc9={};_0x185cc9[_0xcec08e]={'$like':'%'+_0x2e128f[_0x1dbd('0x2d')][_0x1dbd('0x37')]+'%'};return _0x185cc9;})});}_0x21d29f=_[_0x1dbd('0x38')]({},_0x21d29f,_0x2e128f[_0x1dbd('0x3a')]);return _0x59fd3a['getFields'](_0x21d29f);}})['then'](function(_0x377d89){if(_0x377d89){_0x1989f9=_0x377d89['length'];if(!_0x2e128f[_0x1dbd('0x2d')][_0x1dbd('0x32')](_0x1dbd('0x47'))){_0x21d29f[_0x1dbd('0x18')]=qs[_0x1dbd('0x18')](_0x2e128f[_0x1dbd('0x2d')]['limit']);_0x21d29f['offset']=qs['offset'](_0x2e128f[_0x1dbd('0x2d')][_0x1dbd('0x17')]);}return _0x59fd3a[_0x1dbd('0x48')](_0x21d29f);}})['then'](function(_0x265245){if(_0x265245){return _0x265245?{'count':_0x1989f9,'rows':_0x265245}:null;}})[_0x1dbd('0x20')](respondWithResult(_0x2b503f,null))[_0x1dbd('0x42')](handleError(_0x2b503f,null));};exports[_0x1dbd('0x49')]=function(_0x1e1f34,_0xc2ffff,_0x16e486){var _0x333d58={};var _0x3a9d92={};var _0x2e4a18;var _0x499345;return db['FreshdeskConfiguration'][_0x1dbd('0x4a')]({'where':{'id':_0x1e1f34[_0x1dbd('0x3f')]['id']}})[_0x1dbd('0x20')](handleEntityNotFound(_0xc2ffff,null))[_0x1dbd('0x20')](function(_0x39ba5d){if(_0x39ba5d){_0x2e4a18=_0x39ba5d;_0x3a9d92[_0x1dbd('0x2a')]=_[_0x1dbd('0x2c')](db[_0x1dbd('0x45')]['rawAttributes']);_0x3a9d92[_0x1dbd('0x2d')]=_[_0x1dbd('0x2c')](_0x1e1f34[_0x1dbd('0x2d')]);_0x3a9d92[_0x1dbd('0x36')]=_['intersection'](_0x3a9d92[_0x1dbd('0x2a')],_0x3a9d92['query']);_0x333d58['attributes']=_['intersection'](_0x3a9d92[_0x1dbd('0x2a')],qs[_0x1dbd('0x30')](_0x1e1f34['query'][_0x1dbd('0x30')]));_0x333d58[_0x1dbd('0x2e')]=_0x333d58[_0x1dbd('0x2e')]['length']?_0x333d58['attributes']:_0x3a9d92[_0x1dbd('0x2a')];_0x333d58[_0x1dbd('0x33')]=qs['sort'](_0x1e1f34[_0x1dbd('0x2d')][_0x1dbd('0x34')]);_0x333d58[_0x1dbd('0x35')]=qs[_0x1dbd('0x36')](_[_0x1dbd('0x46')](_0x1e1f34[_0x1dbd('0x2d')],_0x3a9d92[_0x1dbd('0x36')]));if(_0x1e1f34[_0x1dbd('0x2d')][_0x1dbd('0x37')]){_0x333d58['where']=_[_0x1dbd('0x38')](_0x333d58['where'],{'$or':_[_0x1dbd('0x2b')](_0x333d58['attributes'],function(_0x4473bb){var _0x2f7365={};_0x2f7365[_0x4473bb]={'$like':'%'+_0x1e1f34['query'][_0x1dbd('0x37')]+'%'};return _0x2f7365;})});}_0x333d58=_[_0x1dbd('0x38')]({},_0x333d58,_0x1e1f34[_0x1dbd('0x3a')]);return _0x2e4a18['getSubjects'](_0x333d58);}})[_0x1dbd('0x20')](function(_0x412253){if(_0x412253){_0x499345=_0x412253[_0x1dbd('0x31')];if(!_0x1e1f34[_0x1dbd('0x2d')][_0x1dbd('0x32')]('nolimit')){_0x333d58[_0x1dbd('0x18')]=qs[_0x1dbd('0x18')](_0x1e1f34[_0x1dbd('0x2d')][_0x1dbd('0x18')]);_0x333d58[_0x1dbd('0x17')]=qs[_0x1dbd('0x17')](_0x1e1f34[_0x1dbd('0x2d')][_0x1dbd('0x17')]);}return _0x2e4a18[_0x1dbd('0x49')](_0x333d58);}})[_0x1dbd('0x20')](function(_0xec7727){if(_0xec7727){return _0xec7727?{'count':_0x499345,'rows':_0xec7727}:null;}})[_0x1dbd('0x20')](respondWithResult(_0xc2ffff,null))[_0x1dbd('0x42')](handleError(_0xc2ffff,null));};exports[_0x1dbd('0x4b')]=function(_0x2934e7,_0x2a5712,_0x4ee156){var _0x8a4c56={};var _0x5c6246={};var _0x2646c1;var _0x2a7baf;return db[_0x1dbd('0x26')][_0x1dbd('0x4a')]({'where':{'id':_0x2934e7['params']['id']}})[_0x1dbd('0x20')](handleEntityNotFound(_0x2a5712,null))['then'](function(_0x4a1bd7){if(_0x4a1bd7){_0x2646c1=_0x4a1bd7;_0x5c6246[_0x1dbd('0x2a')]=_[_0x1dbd('0x2c')](db[_0x1dbd('0x45')][_0x1dbd('0x27')]);_0x5c6246['query']=_[_0x1dbd('0x2c')](_0x2934e7['query']);_0x5c6246['filters']=_[_0x1dbd('0x2f')](_0x5c6246[_0x1dbd('0x2a')],_0x5c6246[_0x1dbd('0x2d')]);_0x8a4c56[_0x1dbd('0x2e')]=_[_0x1dbd('0x2f')](_0x5c6246[_0x1dbd('0x2a')],qs['fields'](_0x2934e7[_0x1dbd('0x2d')][_0x1dbd('0x30')]));_0x8a4c56['attributes']=_0x8a4c56[_0x1dbd('0x2e')]['length']?_0x8a4c56[_0x1dbd('0x2e')]:_0x5c6246[_0x1dbd('0x2a')];_0x8a4c56[_0x1dbd('0x33')]=qs[_0x1dbd('0x34')](_0x2934e7['query'][_0x1dbd('0x34')]);_0x8a4c56['where']=qs['filters'](_[_0x1dbd('0x46')](_0x2934e7['query'],_0x5c6246[_0x1dbd('0x36')]));if(_0x2934e7[_0x1dbd('0x2d')][_0x1dbd('0x37')]){_0x8a4c56[_0x1dbd('0x35')]=_[_0x1dbd('0x38')](_0x8a4c56[_0x1dbd('0x35')],{'$or':_[_0x1dbd('0x2b')](_0x8a4c56[_0x1dbd('0x2e')],function(_0x31bef9){var _0x1cd9c3={};_0x1cd9c3[_0x31bef9]={'$like':'%'+_0x2934e7[_0x1dbd('0x2d')][_0x1dbd('0x37')]+'%'};return _0x1cd9c3;})});}_0x8a4c56=_[_0x1dbd('0x38')]({},_0x8a4c56,_0x2934e7[_0x1dbd('0x3a')]);return _0x2646c1[_0x1dbd('0x4b')](_0x8a4c56);}})[_0x1dbd('0x20')](function(_0x1bef3e){if(_0x1bef3e){_0x2a7baf=_0x1bef3e[_0x1dbd('0x31')];if(!_0x2934e7[_0x1dbd('0x2d')][_0x1dbd('0x32')](_0x1dbd('0x47'))){_0x8a4c56['limit']=qs[_0x1dbd('0x18')](_0x2934e7[_0x1dbd('0x2d')][_0x1dbd('0x18')]);_0x8a4c56[_0x1dbd('0x17')]=qs[_0x1dbd('0x17')](_0x2934e7[_0x1dbd('0x2d')][_0x1dbd('0x17')]);}return _0x2646c1[_0x1dbd('0x4b')](_0x8a4c56);}})[_0x1dbd('0x20')](function(_0x3b8bd2){if(_0x3b8bd2){return _0x3b8bd2?{'count':_0x2a7baf,'rows':_0x3b8bd2}:null;}})[_0x1dbd('0x20')](respondWithResult(_0x2a5712,null))[_0x1dbd('0x42')](handleError(_0x2a5712,null));};exports[_0x1dbd('0x4c')]=function(_0x9c3199,_0x3a5dc1,_0x124923){var _0x249a6d={};var _0x1b0a5a={};var _0x2bdebb;var _0x4e0fee;return db[_0x1dbd('0x26')][_0x1dbd('0x4a')]({'where':{'id':_0x9c3199[_0x1dbd('0x3f')]['id']}})[_0x1dbd('0x20')](handleEntityNotFound(_0x3a5dc1,null))[_0x1dbd('0x20')](function(_0x36065f){if(_0x36065f){_0x2bdebb=_0x36065f;_0x1b0a5a[_0x1dbd('0x2a')]=_[_0x1dbd('0x2c')](db[_0x1dbd('0x4d')][_0x1dbd('0x27')]);_0x1b0a5a[_0x1dbd('0x2d')]=_[_0x1dbd('0x2c')](_0x9c3199[_0x1dbd('0x2d')]);_0x1b0a5a['filters']=_[_0x1dbd('0x2f')](_0x1b0a5a['model'],_0x1b0a5a[_0x1dbd('0x2d')]);_0x249a6d['attributes']=_['intersection'](_0x1b0a5a[_0x1dbd('0x2a')],qs[_0x1dbd('0x30')](_0x9c3199[_0x1dbd('0x2d')][_0x1dbd('0x30')]));_0x249a6d[_0x1dbd('0x2e')]=_0x249a6d[_0x1dbd('0x2e')][_0x1dbd('0x31')]?_0x249a6d[_0x1dbd('0x2e')]:_0x1b0a5a[_0x1dbd('0x2a')];_0x249a6d[_0x1dbd('0x33')]=qs[_0x1dbd('0x34')](_0x9c3199[_0x1dbd('0x2d')][_0x1dbd('0x34')]);_0x249a6d[_0x1dbd('0x35')]=qs[_0x1dbd('0x36')](_[_0x1dbd('0x46')](_0x9c3199[_0x1dbd('0x2d')],_0x1b0a5a[_0x1dbd('0x36')]));if(_0x9c3199[_0x1dbd('0x2d')][_0x1dbd('0x37')]){_0x249a6d[_0x1dbd('0x35')]=_[_0x1dbd('0x38')](_0x249a6d[_0x1dbd('0x35')],{'$or':_[_0x1dbd('0x2b')](_0x249a6d['attributes'],function(_0x3047a0){var _0x180fcf={};_0x180fcf[_0x3047a0]={'$like':'%'+_0x9c3199[_0x1dbd('0x2d')][_0x1dbd('0x37')]+'%'};return _0x180fcf;})});}_0x249a6d=_[_0x1dbd('0x38')]({},_0x249a6d,_0x9c3199[_0x1dbd('0x3a')]);return _0x2bdebb[_0x1dbd('0x4c')](_0x249a6d);}})[_0x1dbd('0x20')](function(_0x1e1cde){if(_0x1e1cde){_0x4e0fee=_0x1e1cde[_0x1dbd('0x31')];if(!_0x9c3199['query'][_0x1dbd('0x32')](_0x1dbd('0x47'))){_0x249a6d[_0x1dbd('0x18')]=qs[_0x1dbd('0x18')](_0x9c3199[_0x1dbd('0x2d')][_0x1dbd('0x18')]);_0x249a6d[_0x1dbd('0x17')]=qs[_0x1dbd('0x17')](_0x9c3199[_0x1dbd('0x2d')][_0x1dbd('0x17')]);}return _0x2bdebb[_0x1dbd('0x4c')](_0x249a6d);}})['then'](function(_0x9ca86b){if(_0x9ca86b){return _0x9ca86b?{'count':_0x4e0fee,'rows':_0x9ca86b}:null;}})['then'](respondWithResult(_0x3a5dc1,null))[_0x1dbd('0x42')](handleError(_0x3a5dc1,null));};exports['setTags']=function(_0xcc7553,_0x4c9d1e,_0x60457){if(_0xcc7553[_0x1dbd('0x44')]['id']){delete _0xcc7553[_0x1dbd('0x44')]['id'];}return db[_0x1dbd('0x26')][_0x1dbd('0x4a')]({'where':{'id':_0xcc7553['params']['id']}})[_0x1dbd('0x20')](handleEntityNotFound(_0x4c9d1e,null))[_0x1dbd('0x20')](function(_0x9ce560){if(_0x9ce560){return _0x9ce560[_0x1dbd('0x4e')](_0xcc7553[_0x1dbd('0x44')][_0x1dbd('0x4f')]||[]);}return null;})[_0x1dbd('0x20')](respondWithResult(_0x4c9d1e,null))[_0x1dbd('0x42')](handleError(_0x4c9d1e,null));};
\ No newline at end of file
index 5520a19..a535a6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe355=['exports','define','FreshdeskConfiguration','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe355,0x137));var _0x5e35=function(_0x34968e,_0xbcd5a4){_0x34968e=_0x34968e-0x0;var _0x109081=_0xe355[_0x34968e];return _0x109081;};'use strict';var _=require(_0x5e35('0x0'));var util=require(_0x5e35('0x1'));var logger=require('../../config/logger')(_0x5e35('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e35('0x3'));var fs=require('fs');var path=require(_0x5e35('0x4'));var rimraf=require(_0x5e35('0x5'));var config=require(_0x5e35('0x6'));var attributes=require(_0x5e35('0x7'));module[_0x5e35('0x8')]=function(_0x41ec22,_0x5f03ba){return _0x41ec22[_0x5e35('0x9')](_0x5e35('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf75e=['bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf75e,0x168));var _0xef75=function(_0x133715,_0x1f7fe7){_0x133715=_0x133715-0x0;var _0x13c50a=_0xf75e[_0x133715];return _0x13c50a;};'use strict';var _=require(_0xef75('0x0'));var util=require('util');var logger=require(_0xef75('0x1'))(_0xef75('0x2'));var moment=require(_0xef75('0x3'));var BPromise=require(_0xef75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef75('0x5'));var rimraf=require(_0xef75('0x6'));var config=require(_0xef75('0x7'));var attributes=require(_0xef75('0x8'));module[_0xef75('0x9')]=function(_0x49b731,_0x140156){return _0x49b731[_0xef75('0xa')](_0xef75('0xb'),attributes,{'tableName':_0xef75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f8a6c98..0787e74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7bc=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4be6f4,_0x385b23){var _0x3e9098=function(_0x17ff9a){while(--_0x17ff9a){_0x4be6f4['push'](_0x4be6f4['shift']());}};_0x3e9098(++_0x385b23);}(_0xc7bc,0x13c));var _0xcc7b=function(_0x533b40,_0x204696){_0x533b40=_0x533b40-0x0;var _0x2b0292=_0xc7bc[_0x533b40];return _0x2b0292;};'use strict';var _=require(_0xcc7b('0x0'));var util=require('util');var moment=require(_0xcc7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc7b('0x2'));var fs=require('fs');var Redis=require(_0xcc7b('0x3'));var db=require(_0xcc7b('0x4'))['db'];var utils=require(_0xcc7b('0x5'));var logger=require(_0xcc7b('0x6'))(_0xcc7b('0x7'));var config=require(_0xcc7b('0x8'));var jayson=require(_0xcc7b('0x9'));var client=jayson['client'][_0xcc7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a9b39,_0xd9fbd6,_0x35df32){return new BPromise(function(_0x300a49,_0x22c1e4){return client[_0xcc7b('0xb')](_0x1a9b39,_0x35df32)['then'](function(_0xad4159){logger[_0xcc7b('0xc')](_0xcc7b('0xd'),_0xd9fbd6,_0xcc7b('0xe'));logger[_0xcc7b('0xf')](_0xcc7b('0x10'),_0xd9fbd6,_0xcc7b('0xe'),JSON[_0xcc7b('0x11')](_0xad4159));if(_0xad4159['error']){if(_0xad4159[_0xcc7b('0x12')][_0xcc7b('0x13')]===0x1f4){logger[_0xcc7b('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd9fbd6,_0xad4159[_0xcc7b('0x12')]['message']);return _0x22c1e4(_0xad4159[_0xcc7b('0x12')][_0xcc7b('0x14')]);}logger[_0xcc7b('0x12')](_0xcc7b('0xd'),_0xd9fbd6,_0xad4159['error'][_0xcc7b('0x14')]);return _0x300a49(_0xad4159[_0xcc7b('0x12')][_0xcc7b('0x14')]);}else{logger['info'](_0xcc7b('0xd'),_0xd9fbd6,'request\x20sent');_0x300a49(_0xad4159[_0xcc7b('0x15')][_0xcc7b('0x14')]);}})[_0xcc7b('0x16')](function(_0x419e39){logger['error'](_0xcc7b('0xd'),_0xd9fbd6,_0x419e39);_0x22c1e4(_0x419e39);});});}
\ No newline at end of file
+var _0x761c=['../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x245132,_0x4d1437){var _0x28abad=function(_0x1b66d4){while(--_0x1b66d4){_0x245132['push'](_0x245132['shift']());}};_0x28abad(++_0x4d1437);}(_0x761c,0x1b3));var _0xc761=function(_0x37c20e,_0x372c2d){_0x37c20e=_0x37c20e-0x0;var _0x28c89f=_0x761c[_0x37c20e];return _0x28c89f;};'use strict';var _=require('lodash');var util=require(_0xc761('0x0'));var moment=require(_0xc761('0x1'));var BPromise=require(_0xc761('0x2'));var rs=require(_0xc761('0x3'));var fs=require('fs');var Redis=require(_0xc761('0x4'));var db=require(_0xc761('0x5'))['db'];var utils=require(_0xc761('0x6'));var logger=require('../../config/logger')(_0xc761('0x7'));var config=require(_0xc761('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc761('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33de79,_0x30f08f,_0x52ffda){return new BPromise(function(_0x37c228,_0x522ba6){return client[_0xc761('0xa')](_0x33de79,_0x52ffda)[_0xc761('0xb')](function(_0x5d417b){logger[_0xc761('0xc')](_0xc761('0xd'),_0x30f08f,_0xc761('0xe'));logger[_0xc761('0xf')](_0xc761('0x10'),_0x30f08f,_0xc761('0xe'),JSON['stringify'](_0x5d417b));if(_0x5d417b[_0xc761('0x11')]){if(_0x5d417b[_0xc761('0x11')]['code']===0x1f4){logger['error'](_0xc761('0xd'),_0x30f08f,_0x5d417b[_0xc761('0x11')][_0xc761('0x12')]);return _0x522ba6(_0x5d417b['error'][_0xc761('0x12')]);}logger[_0xc761('0x11')](_0xc761('0xd'),_0x30f08f,_0x5d417b['error']['message']);return _0x37c228(_0x5d417b[_0xc761('0x11')][_0xc761('0x12')]);}else{logger[_0xc761('0xc')](_0xc761('0xd'),_0x30f08f,'request\x20sent');_0x37c228(_0x5d417b[_0xc761('0x13')][_0xc761('0x12')]);}})['catch'](function(_0x19e790){logger[_0xc761('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30f08f,_0x19e790);_0x522ba6(_0x19e790);});});}
\ No newline at end of file
index b729448..b661691 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6157=['delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','isAuthenticated','/:id','show','post','put'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6157,0x179));var _0x7615=function(_0x5aa1a2,_0x466532){_0x5aa1a2=_0x5aa1a2-0x0;var _0xc5f363=_0x6157[_0x5aa1a2];return _0xc5f363;};'use strict';var multer=require(_0x7615('0x0'));var util=require(_0x7615('0x1'));var path=require(_0x7615('0x2'));var timeout=require('connect-timeout');var express=require(_0x7615('0x3'));var router=express[_0x7615('0x4')]();var fs_extra=require(_0x7615('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7615('0x6'));var controller=require(_0x7615('0x7'));router['get']('/',auth[_0x7615('0x8')](),controller['index']);router['get'](_0x7615('0x9'),auth['isAuthenticated'](),controller[_0x7615('0xa')]);router[_0x7615('0xb')]('/',auth[_0x7615('0x8')](),controller['create']);router[_0x7615('0xc')](_0x7615('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7615('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7615('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0x6022=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','util','path','connect-timeout'];(function(_0x8389d7,_0x56499f){var _0x156ade=function(_0x3cb16e){while(--_0x3cb16e){_0x8389d7['push'](_0x8389d7['shift']());}};_0x156ade(++_0x56499f);}(_0x6022,0x10b));var _0x2602=function(_0x192ce9,_0x339ef2){_0x192ce9=_0x192ce9-0x0;var _0x2432b5=_0x6022[_0x192ce9];return _0x2432b5;};'use strict';var multer=require('multer');var util=require(_0x2602('0x0'));var path=require(_0x2602('0x1'));var timeout=require(_0x2602('0x2'));var express=require(_0x2602('0x3'));var router=express[_0x2602('0x4')]();var fs_extra=require(_0x2602('0x5'));var auth=require(_0x2602('0x6'));var interaction=require(_0x2602('0x7'));var config=require('../../config/environment');var controller=require(_0x2602('0x8'));router[_0x2602('0x9')]('/',auth[_0x2602('0xa')](),controller[_0x2602('0xb')]);router[_0x2602('0x9')](_0x2602('0xc'),auth[_0x2602('0xa')](),controller['show']);router[_0x2602('0xd')]('/',auth[_0x2602('0xa')](),controller[_0x2602('0xe')]);router['put'](_0x2602('0xc'),auth[_0x2602('0xa')](),controller[_0x2602('0xf')]);router['delete'](_0x2602('0xc'),auth['isAuthenticated'](),controller[_0x2602('0x10')]);module[_0x2602('0x11')]=router;
\ No newline at end of file
index 4ffa3b7..33f9c70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9288=['STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist'];(function(_0x4d6c98,_0x246c39){var _0x3da6e2=function(_0x4fa04e){while(--_0x4fa04e){_0x4d6c98['push'](_0x4d6c98['shift']());}};_0x3da6e2(++_0x246c39);}(_0x9288,0x13a));var _0x8928=function(_0x58ccfe,_0x4d0c41){_0x58ccfe=_0x58ccfe-0x0;var _0x4e8273=_0x9288[_0x58ccfe];return _0x4e8273;};'use strict';var Sequelize=require(_0x8928('0x0'));module[_0x8928('0x1')]={'type':{'type':Sequelize[_0x8928('0x2')](_0x8928('0x3'),'variable','customVariable',_0x8928('0x4'),_0x8928('0x5')),'defaultValue':_0x8928('0x3')},'content':{'type':Sequelize[_0x8928('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8928('0x2')](_0x8928('0x3'),_0x8928('0x7'),_0x8928('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8928('0x6')]},'nameField':{'type':Sequelize[_0x8928('0x6')]},'customField':{'type':Sequelize[_0x8928('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8928('0x6')]}};
\ No newline at end of file
+var _0x9300=['string','variable','customVariable','picklist','STRING','exports','ENUM'];(function(_0x26ef30,_0x42b817){var _0x445d62=function(_0x23fd28){while(--_0x23fd28){_0x26ef30['push'](_0x26ef30['shift']());}};_0x445d62(++_0x42b817);}(_0x9300,0x132));var _0x0930=function(_0x1425e8,_0x2c195b){_0x1425e8=_0x1425e8-0x0;var _0x1cd239=_0x9300[_0x1425e8];return _0x1cd239;};'use strict';var Sequelize=require('sequelize');module[_0x0930('0x0')]={'type':{'type':Sequelize[_0x0930('0x1')](_0x0930('0x2'),_0x0930('0x3'),_0x0930('0x4'),'keyValue',_0x0930('0x5')),'defaultValue':_0x0930('0x2')},'content':{'type':Sequelize[_0x0930('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0930('0x1')](_0x0930('0x2'),_0x0930('0x3'),_0x0930('0x4'))},'keyContent':{'type':Sequelize[_0x0930('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0930('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0930('0x6')]}};
\ No newline at end of file
index 25e89a8..4a531e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b73=['include','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll'];(function(_0x546ab6,_0x357f23){var _0x3952ca=function(_0x29dcfa){while(--_0x29dcfa){_0x546ab6['push'](_0x546ab6['shift']());}};_0x3952ca(++_0x357f23);}(_0x1b73,0x1d5));var _0x31b7=function(_0x2d41dd,_0x4884ac){_0x2d41dd=_0x2d41dd-0x0;var _0x1d2ffa=_0x1b73[_0x2d41dd];return _0x1d2ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0x2c993b,_0x4e5673){return function(_0xb8a998){if(!_0xb8a998){_0x2c993b['sendStatus'](0x194);}return _0xb8a998;};}function handleError(_0x3dd60d,_0x2da751){_0x2da751=_0x2da751||0x1f4;return function(_0x14b63f){logger[_0x31b7('0x28')](_0x14b63f[_0x31b7('0x29')]);if(_0x14b63f[_0x31b7('0x2a')]){delete _0x14b63f[_0x31b7('0x2a')];}_0x3dd60d[_0x31b7('0x1b')](_0x2da751)['send'](_0x14b63f);};}exports['index']=function(_0x503549,_0x46508a){var _0x39521d={},_0x2a7c54={},_0x4f5e1d={'count':0x0,'rows':[]};var _0x169238=_[_0x31b7('0x2b')](db[_0x31b7('0x2c')][_0x31b7('0x2d')],function(_0x58a87e){return{'name':_0x58a87e[_0x31b7('0x2e')],'type':_0x58a87e[_0x31b7('0x2f')]['key']};});_0x2a7c54['model']=_[_0x31b7('0x2b')](_0x169238,_0x31b7('0x2a'));_0x2a7c54[_0x31b7('0x30')]=_[_0x31b7('0x31')](_0x503549['query']);_0x2a7c54['filters']=_[_0x31b7('0x32')](_0x2a7c54[_0x31b7('0x33')],_0x2a7c54[_0x31b7('0x30')]);_0x39521d[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x2a7c54['model'],qs['fields'](_0x503549[_0x31b7('0x30')][_0x31b7('0x35')]));_0x39521d['attributes']=_0x39521d[_0x31b7('0x34')][_0x31b7('0x36')]?_0x39521d['attributes']:_0x2a7c54[_0x31b7('0x33')];if(!_0x503549[_0x31b7('0x30')][_0x31b7('0x37')](_0x31b7('0x38'))){_0x39521d[_0x31b7('0x1e')]=qs[_0x31b7('0x1e')](_0x503549[_0x31b7('0x30')][_0x31b7('0x1e')]);_0x39521d[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x503549[_0x31b7('0x30')][_0x31b7('0x20')]);}_0x39521d[_0x31b7('0x39')]=qs['sort'](_0x503549['query'][_0x31b7('0x3a')]);_0x39521d[_0x31b7('0x3b')]=qs[_0x31b7('0x3c')](_[_0x31b7('0x3d')](_0x503549[_0x31b7('0x30')],_0x2a7c54[_0x31b7('0x3c')]),_0x169238);if(_0x503549[_0x31b7('0x30')][_0x31b7('0x3e')]){_0x39521d[_0x31b7('0x3b')]=_[_0x31b7('0x3f')](_0x39521d['where'],{'$or':_[_0x31b7('0x2b')](_0x169238,function(_0xfd4863){if(_0xfd4863[_0x31b7('0x2f')]!==_0x31b7('0x40')){var _0x5c9cec={};_0x5c9cec[_0xfd4863[_0x31b7('0x2a')]]={'$like':'%'+_0x503549[_0x31b7('0x30')]['filter']+'%'};return _0x5c9cec;}})});}_0x39521d=_[_0x31b7('0x3f')]({},_0x39521d,_0x503549['options']);var _0x587506={'where':_0x39521d[_0x31b7('0x3b')]};return db[_0x31b7('0x2c')][_0x31b7('0x1f')](_0x587506)[_0x31b7('0x27')](function(_0x3d0413){_0x4f5e1d['count']=_0x3d0413;if(_0x503549[_0x31b7('0x30')]['includeAll']){_0x39521d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x31b7('0x41')](_0x39521d);})[_0x31b7('0x27')](function(_0x1527b3){_0x4f5e1d[_0x31b7('0x42')]=_0x1527b3;return _0x4f5e1d;})[_0x31b7('0x27')](respondWithFilteredResult(_0x46508a,_0x39521d))['catch'](handleError(_0x46508a,null));};exports[_0x31b7('0x43')]=function(_0x5d1f25,_0xef2b18){var _0x3caab0={'raw':!![],'where':{'id':_0x5d1f25[_0x31b7('0x44')]['id']}},_0x41c92e={};_0x41c92e['model']=_[_0x31b7('0x31')](db[_0x31b7('0x2c')][_0x31b7('0x2d')]);_0x41c92e['query']=_[_0x31b7('0x31')](_0x5d1f25['query']);_0x41c92e[_0x31b7('0x3c')]=_[_0x31b7('0x32')](_0x41c92e['model'],_0x41c92e[_0x31b7('0x30')]);_0x3caab0[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x41c92e[_0x31b7('0x33')],qs['fields'](_0x5d1f25[_0x31b7('0x30')]['fields']));_0x3caab0['attributes']=_0x3caab0[_0x31b7('0x34')][_0x31b7('0x36')]?_0x3caab0[_0x31b7('0x34')]:_0x41c92e[_0x31b7('0x33')];if(_0x5d1f25['query'][_0x31b7('0x45')]){_0x3caab0[_0x31b7('0x46')]=[{'all':!![]}];}_0x3caab0=_['merge']({},_0x3caab0,_0x5d1f25[_0x31b7('0x47')]);return db[_0x31b7('0x2c')][_0x31b7('0x48')](_0x3caab0)['then'](handleEntityNotFound(_0xef2b18,null))[_0x31b7('0x27')](respondWithResult(_0xef2b18,null))[_0x31b7('0x49')](handleError(_0xef2b18,null));};exports[_0x31b7('0x4a')]=function(_0x164115,_0x345059){return db[_0x31b7('0x2c')][_0x31b7('0x4a')](_0x164115[_0x31b7('0x4b')],{})['then'](respondWithResult(_0x345059,0xc9))[_0x31b7('0x49')](handleError(_0x345059,null));};exports['update']=function(_0x5a72ee,_0x22cc77){if(_0x5a72ee[_0x31b7('0x4b')]['id']){delete _0x5a72ee[_0x31b7('0x4b')]['id'];}return db[_0x31b7('0x2c')]['find']({'where':{'id':_0x5a72ee[_0x31b7('0x44')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x22cc77,null))[_0x31b7('0x27')](saveUpdates(_0x5a72ee['body'],null))[_0x31b7('0x27')](respondWithResult(_0x22cc77,null))[_0x31b7('0x49')](handleError(_0x22cc77,null));};exports[_0x31b7('0x4c')]=function(_0x3b5868,_0x2bf59c){return db[_0x31b7('0x2c')][_0x31b7('0x48')]({'where':{'id':_0x3b5868[_0x31b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bf59c,null))['then'](removeEntity(_0x2bf59c,null))[_0x31b7('0x49')](handleError(_0x2bf59c,null));};
\ No newline at end of file
+var _0x41bb=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','FreshdeskField','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x295aa4,_0x58dcf0){var _0x17ea2f=function(_0x40caaf){while(--_0x40caaf){_0x295aa4['push'](_0x295aa4['shift']());}};_0x17ea2f(++_0x58dcf0);}(_0x41bb,0xc5));var _0xb41b=function(_0x19fcac,_0x58503c){_0x19fcac=_0x19fcac-0x0;var _0x547290=_0x41bb[_0x19fcac];return _0x547290;};'use strict';var emlformat=require(_0xb41b('0x0'));var rimraf=require(_0xb41b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb41b('0x2'));var rp=require('request-promise');var moment=require(_0xb41b('0x3'));var BPromise=require(_0xb41b('0x4'));var Mustache=require(_0xb41b('0x5'));var util=require(_0xb41b('0x6'));var path=require('path');var sox=require(_0xb41b('0x7'));var csv=require(_0xb41b('0x8'));var ejs=require(_0xb41b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x8'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var licenseUtil=require(_0xb41b('0x15'));var db=require(_0xb41b('0x16'))['db'];function respondWithStatusCode(_0x2066d5,_0x5f1ea4){_0x5f1ea4=_0x5f1ea4||0xcc;return function(_0x353ba3){if(_0x353ba3){return _0x2066d5[_0xb41b('0x17')](_0x5f1ea4);}return _0x2066d5[_0xb41b('0x18')](_0x5f1ea4)[_0xb41b('0x19')]();};}function respondWithResult(_0x3be1ec,_0x4e8603){_0x4e8603=_0x4e8603||0xc8;return function(_0x4e7f11){if(_0x4e7f11){return _0x3be1ec['status'](_0x4e8603)[_0xb41b('0x1a')](_0x4e7f11);}};}function respondWithFilteredResult(_0xdc5fb0,_0x143a81){return function(_0x338920){if(_0x338920){var _0x29ea51=typeof _0x143a81['offset']===_0xb41b('0x1b')&&typeof _0x143a81[_0xb41b('0x1c')]===_0xb41b('0x1b');var _0xcf0728=_0x338920[_0xb41b('0x1d')];var _0x47154d=_0x29ea51?0x0:_0x143a81[_0xb41b('0x1e')];var _0x5df8c2=_0x29ea51?_0x338920['count']:_0x143a81['offset']+_0x143a81[_0xb41b('0x1c')];var _0x503e86;if(_0x5df8c2>=_0xcf0728){_0x5df8c2=_0xcf0728;_0x503e86=0xc8;}else{_0x503e86=0xce;}_0xdc5fb0[_0xb41b('0x18')](_0x503e86);return _0xdc5fb0[_0xb41b('0x1f')](_0xb41b('0x20'),_0x47154d+'-'+_0x5df8c2+'/'+_0xcf0728)['json'](_0x338920);}return null;};}function patchUpdates(_0x53bc44){return function(_0x1a1386){try{jsonpatch[_0xb41b('0x21')](_0x1a1386,_0x53bc44,!![]);}catch(_0xd1bc61){return BPromise[_0xb41b('0x22')](_0xd1bc61);}return _0x1a1386[_0xb41b('0x23')]();};}function saveUpdates(_0x42dccb,_0x4c73da){return function(_0x58f149){if(_0x58f149){return _0x58f149[_0xb41b('0x24')](_0x42dccb)[_0xb41b('0x25')](function(_0x871b35){return _0x871b35;});}return null;};}function removeEntity(_0x583741,_0x14e9c8){return function(_0x2441d6){if(_0x2441d6){return _0x2441d6['destroy']()[_0xb41b('0x25')](function(){_0x583741[_0xb41b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed3c7e,_0x4a7992){return function(_0x2d0f27){if(!_0x2d0f27){_0xed3c7e[_0xb41b('0x17')](0x194);}return _0x2d0f27;};}function handleError(_0x53e3a2,_0x3af2c){_0x3af2c=_0x3af2c||0x1f4;return function(_0x4265b8){logger['error'](_0x4265b8['stack']);if(_0x4265b8[_0xb41b('0x26')]){delete _0x4265b8[_0xb41b('0x26')];}_0x53e3a2[_0xb41b('0x18')](_0x3af2c)[_0xb41b('0x27')](_0x4265b8);};}exports[_0xb41b('0x28')]=function(_0x181cbd,_0x253efb){var _0x545395={},_0x26ef96={},_0xb68029={'count':0x0,'rows':[]};var _0x5069aa=_[_0xb41b('0x29')](db['FreshdeskField'][_0xb41b('0x2a')],function(_0x31d4cd){return{'name':_0x31d4cd['fieldName'],'type':_0x31d4cd[_0xb41b('0x2b')]['key']};});_0x26ef96[_0xb41b('0x2c')]=_[_0xb41b('0x29')](_0x5069aa,'name');_0x26ef96[_0xb41b('0x2d')]=_[_0xb41b('0x2e')](_0x181cbd[_0xb41b('0x2d')]);_0x26ef96[_0xb41b('0x2f')]=_[_0xb41b('0x30')](_0x26ef96[_0xb41b('0x2c')],_0x26ef96[_0xb41b('0x2d')]);_0x545395[_0xb41b('0x31')]=_[_0xb41b('0x30')](_0x26ef96[_0xb41b('0x2c')],qs['fields'](_0x181cbd[_0xb41b('0x2d')]['fields']));_0x545395['attributes']=_0x545395[_0xb41b('0x31')][_0xb41b('0x32')]?_0x545395[_0xb41b('0x31')]:_0x26ef96[_0xb41b('0x2c')];if(!_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x33')](_0xb41b('0x34'))){_0x545395[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x1c')]);_0x545395['offset']=qs[_0xb41b('0x1e')](_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x1e')]);}_0x545395[_0xb41b('0x35')]=qs[_0xb41b('0x36')](_0x181cbd[_0xb41b('0x2d')]['sort']);_0x545395['where']=qs[_0xb41b('0x2f')](_[_0xb41b('0x37')](_0x181cbd['query'],_0x26ef96[_0xb41b('0x2f')]),_0x5069aa);if(_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x38')]){_0x545395[_0xb41b('0x39')]=_[_0xb41b('0x3a')](_0x545395['where'],{'$or':_[_0xb41b('0x29')](_0x5069aa,function(_0x5775d3){if(_0x5775d3[_0xb41b('0x2b')]!==_0xb41b('0x3b')){var _0x799d6={};_0x799d6[_0x5775d3[_0xb41b('0x26')]]={'$like':'%'+_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x38')]+'%'};return _0x799d6;}})});}_0x545395=_[_0xb41b('0x3a')]({},_0x545395,_0x181cbd[_0xb41b('0x3c')]);var _0x2b0721={'where':_0x545395['where']};return db['FreshdeskField']['count'](_0x2b0721)[_0xb41b('0x25')](function(_0x5147ce){_0xb68029['count']=_0x5147ce;if(_0x181cbd[_0xb41b('0x2d')]['includeAll']){_0x545395[_0xb41b('0x3d')]=[{'all':!![]}];}return db[_0xb41b('0x3e')][_0xb41b('0x3f')](_0x545395);})[_0xb41b('0x25')](function(_0x4fa390){_0xb68029[_0xb41b('0x40')]=_0x4fa390;return _0xb68029;})[_0xb41b('0x25')](respondWithFilteredResult(_0x253efb,_0x545395))['catch'](handleError(_0x253efb,null));};exports[_0xb41b('0x41')]=function(_0xa70324,_0x3f181c){var _0x174d6c={'raw':!![],'where':{'id':_0xa70324[_0xb41b('0x42')]['id']}},_0x47bab5={};_0x47bab5['model']=_[_0xb41b('0x2e')](db[_0xb41b('0x3e')][_0xb41b('0x2a')]);_0x47bab5['query']=_['keys'](_0xa70324[_0xb41b('0x2d')]);_0x47bab5[_0xb41b('0x2f')]=_[_0xb41b('0x30')](_0x47bab5[_0xb41b('0x2c')],_0x47bab5[_0xb41b('0x2d')]);_0x174d6c[_0xb41b('0x31')]=_[_0xb41b('0x30')](_0x47bab5['model'],qs['fields'](_0xa70324[_0xb41b('0x2d')]['fields']));_0x174d6c[_0xb41b('0x31')]=_0x174d6c['attributes'][_0xb41b('0x32')]?_0x174d6c['attributes']:_0x47bab5[_0xb41b('0x2c')];if(_0xa70324['query'][_0xb41b('0x43')]){_0x174d6c[_0xb41b('0x3d')]=[{'all':!![]}];}_0x174d6c=_[_0xb41b('0x3a')]({},_0x174d6c,_0xa70324[_0xb41b('0x3c')]);return db['FreshdeskField'][_0xb41b('0x44')](_0x174d6c)[_0xb41b('0x25')](handleEntityNotFound(_0x3f181c,null))['then'](respondWithResult(_0x3f181c,null))[_0xb41b('0x45')](handleError(_0x3f181c,null));};exports['create']=function(_0x5cc658,_0x5733d0){return db['FreshdeskField'][_0xb41b('0x46')](_0x5cc658[_0xb41b('0x47')],{})[_0xb41b('0x25')](respondWithResult(_0x5733d0,0xc9))[_0xb41b('0x45')](handleError(_0x5733d0,null));};exports[_0xb41b('0x24')]=function(_0x349a6c,_0x34d076){if(_0x349a6c[_0xb41b('0x47')]['id']){delete _0x349a6c[_0xb41b('0x47')]['id'];}return db[_0xb41b('0x3e')][_0xb41b('0x44')]({'where':{'id':_0x349a6c[_0xb41b('0x42')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x34d076,null))[_0xb41b('0x25')](saveUpdates(_0x349a6c[_0xb41b('0x47')],null))[_0xb41b('0x25')](respondWithResult(_0x34d076,null))['catch'](handleError(_0x34d076,null));};exports[_0xb41b('0x48')]=function(_0x5e041d,_0x4a7aa3){return db[_0xb41b('0x3e')][_0xb41b('0x44')]({'where':{'id':_0x5e041d[_0xb41b('0x42')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x4a7aa3,null))[_0xb41b('0x25')](removeEntity(_0x4a7aa3,null))[_0xb41b('0x45')](handleError(_0x4a7aa3,null));};
\ No newline at end of file
index bf000e7..5ad5751 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21ca=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x225ffb,_0x3a7232){var _0x34089e=function(_0x5e46c9){while(--_0x5e46c9){_0x225ffb['push'](_0x225ffb['shift']());}};_0x34089e(++_0x3a7232);}(_0x21ca,0x14e));var _0xa21c=function(_0xc9873a,_0x5efdcb){_0xc9873a=_0xc9873a-0x0;var _0x2f7d84=_0x21ca[_0xc9873a];return _0x2f7d84;};'use strict';var _=require('lodash');var util=require(_0xa21c('0x0'));var logger=require(_0xa21c('0x1'))('api');var moment=require(_0xa21c('0x2'));var BPromise=require(_0xa21c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa21c('0x4'));var rimraf=require(_0xa21c('0x5'));var config=require(_0xa21c('0x6'));var attributes=require(_0xa21c('0x7'));module['exports']=function(_0x29c9f5,_0x24efd2){return _0x29c9f5['define'](_0xa21c('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xa21c('0x9'),'fields':[_0xa21c('0xa'),_0xa21c('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x2743=['rimraf','./intFreshdeskField.attributes','define','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','request-promise'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0x2743,0x176));var _0x3274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2743[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3274('0x0'));var util=require(_0x3274('0x1'));var logger=require(_0x3274('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3274('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3274('0x4'));var config=require('../../config/environment');var attributes=require(_0x3274('0x5'));module['exports']=function(_0x24f64a,_0x9f782){return _0x24f64a[_0x3274('0x6')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x3274('0x7'),'fields':['idField',_0x3274('0x8')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index f62b091..21fa2b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3d8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4729ae,_0x35a7c4){var _0x464880=function(_0x2e6d08){while(--_0x2e6d08){_0x4729ae['push'](_0x4729ae['shift']());}};_0x464880(++_0x35a7c4);}(_0xb3d8,0x191));var _0x8b3d=function(_0x2a5444,_0x49a726){_0x2a5444=_0x2a5444-0x0;var _0x1a057d=_0xb3d8[_0x2a5444];return _0x1a057d;};'use strict';var _=require(_0x8b3d('0x0'));var util=require(_0x8b3d('0x1'));var moment=require(_0x8b3d('0x2'));var BPromise=require(_0x8b3d('0x3'));var rs=require(_0x8b3d('0x4'));var fs=require('fs');var Redis=require(_0x8b3d('0x5'));var db=require(_0x8b3d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b3d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b3d('0x8'));var client=jayson[_0x8b3d('0x9')][_0x8b3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d31d9,_0x5881a0,_0x4bfe3c){return new BPromise(function(_0x9c5462,_0x20c0e4){return client['request'](_0x3d31d9,_0x4bfe3c)['then'](function(_0x5d05db){logger[_0x8b3d('0xb')](_0x8b3d('0xc'),_0x5881a0,_0x8b3d('0xd'));logger['debug'](_0x8b3d('0xe'),_0x5881a0,_0x8b3d('0xd'),JSON[_0x8b3d('0xf')](_0x5d05db));if(_0x5d05db[_0x8b3d('0x10')]){if(_0x5d05db[_0x8b3d('0x10')][_0x8b3d('0x11')]===0x1f4){logger['error'](_0x8b3d('0xc'),_0x5881a0,_0x5d05db[_0x8b3d('0x10')][_0x8b3d('0x12')]);return _0x20c0e4(_0x5d05db[_0x8b3d('0x10')][_0x8b3d('0x12')]);}logger[_0x8b3d('0x10')](_0x8b3d('0xc'),_0x5881a0,_0x5d05db[_0x8b3d('0x10')]['message']);return _0x9c5462(_0x5d05db[_0x8b3d('0x10')][_0x8b3d('0x12')]);}else{logger['info'](_0x8b3d('0xc'),_0x5881a0,_0x8b3d('0xd'));_0x9c5462(_0x5d05db['result'][_0x8b3d('0x12')]);}})[_0x8b3d('0x13')](function(_0x4425ea){logger['error'](_0x8b3d('0xc'),_0x5881a0,_0x4425ea);_0x20c0e4(_0x4425ea);});});}
\ No newline at end of file
+var _0x3ea4=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','request\x20sent','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s'];(function(_0x12b4af,_0x3f83e5){var _0x3f6da4=function(_0x1e94fd){while(--_0x1e94fd){_0x12b4af['push'](_0x12b4af['shift']());}};_0x3f6da4(++_0x3f83e5);}(_0x3ea4,0x190));var _0x43ea=function(_0x256b67,_0x14e47b){_0x256b67=_0x256b67-0x0;var _0x3e2d99=_0x3ea4[_0x256b67];return _0x3e2d99;};'use strict';var _=require(_0x43ea('0x0'));var util=require(_0x43ea('0x1'));var moment=require(_0x43ea('0x2'));var BPromise=require(_0x43ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ea('0x4'));var db=require(_0x43ea('0x5'))['db'];var utils=require(_0x43ea('0x6'));var logger=require('../../config/logger')(_0x43ea('0x7'));var config=require(_0x43ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x43ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77b688,_0x22c573,_0x4a5e6f){return new BPromise(function(_0x2b62a8,_0x57e38c){return client[_0x43ea('0xa')](_0x77b688,_0x4a5e6f)['then'](function(_0x14934c){logger[_0x43ea('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x22c573,_0x43ea('0xc'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x22c573,_0x43ea('0xc'),JSON[_0x43ea('0xd')](_0x14934c));if(_0x14934c[_0x43ea('0xe')]){if(_0x14934c['error'][_0x43ea('0xf')]===0x1f4){logger[_0x43ea('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x22c573,_0x14934c[_0x43ea('0xe')]['message']);return _0x57e38c(_0x14934c[_0x43ea('0xe')][_0x43ea('0x10')]);}logger['error'](_0x43ea('0x11'),_0x22c573,_0x14934c[_0x43ea('0xe')]['message']);return _0x2b62a8(_0x14934c[_0x43ea('0xe')][_0x43ea('0x10')]);}else{logger[_0x43ea('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x22c573,_0x43ea('0xc'));_0x2b62a8(_0x14934c['result']['message']);}})[_0x43ea('0x12')](function(_0x5d4a88){logger[_0x43ea('0xe')](_0x43ea('0x11'),_0x22c573,_0x5d4a88);_0x57e38c(_0x5d4a88);});});}
\ No newline at end of file
index 0735832..fb3201e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x44a3=['getFields','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x2acc06,_0x3f9dcf){var _0x18ad24=function(_0x440536){while(--_0x440536){_0x2acc06['push'](_0x2acc06['shift']());}};_0x18ad24(++_0x3f9dcf);}(_0x44a3,0x1a9));var _0x344a=function(_0x51666b,_0x48e537){_0x51666b=_0x51666b-0x0;var _0x1858fa=_0x44a3[_0x51666b];return _0x1858fa;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/fields',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),controller['create']);router[_0x344a('0x10')]('/:id/configurations',auth[_0x344a('0xb')](),controller[_0x344a('0x11')]);router['put']('/:id',auth[_0x344a('0xb')](),controller[_0x344a('0x12')]);router[_0x344a('0x13')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);module['exports']=router;
\ No newline at end of file
+var _0x593e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0x593e,0xcb));var _0xe593=function(_0xd6b186,_0x11f279){_0xd6b186=_0xd6b186-0x0;var _0x504439=_0x593e[_0xd6b186];return _0x504439;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id/configurations',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),controller['create']);router[_0xe593('0x11')](_0xe593('0x12'),auth[_0xe593('0xb')](),controller[_0xe593('0x13')]);router[_0xe593('0x14')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0x15')]);router[_0xe593('0x16')](_0xe593('0xd'),auth['isAuthenticated'](),controller[_0xe593('0x17')]);module[_0xe593('0x18')]=router;
\ No newline at end of file
index c3348c1..bbe48b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7096=['exports','STRING','username','remoteUri'];(function(_0x2225ff,_0x404f26){var _0x11dc70=function(_0x5c761a){while(--_0x5c761a){_0x2225ff['push'](_0x2225ff['shift']());}};_0x11dc70(++_0x404f26);}(_0x7096,0x10c));var _0x6709=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7096[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}};
\ No newline at end of file
+var _0x1eba=['exports','STRING','remoteUri','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0x1eba[_0x53d172];return _0x1bd0a2;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')]},'description':{'type':Sequelize[_0xa1eb('0x2')]},'username':{'type':Sequelize[_0xa1eb('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1eb('0x2')],'unique':_0xa1eb('0x3')},'serverUrl':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]}};
\ No newline at end of file
index 32969de..9e387ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d20=['users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','params','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','order','sort','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token='];(function(_0x2666de,_0x41ce04){var _0x55704f=function(_0x14c0d9){while(--_0x14c0d9){_0x2666de['push'](_0x2666de['shift']());}};_0x55704f(++_0x41ce04);}(_0x4d20,0x12e));var _0x04d2=function(_0x5b173f,_0x3c71f9){_0x5b173f=_0x5b173f-0x0;var _0x1f22e6=_0x4d20[_0x5b173f];return _0x1f22e6;};'use strict';var emlformat=require(_0x04d2('0x0'));var rimraf=require(_0x04d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04d2('0x2'));var rp=require(_0x04d2('0x3'));var moment=require(_0x04d2('0x4'));var BPromise=require(_0x04d2('0x5'));var Mustache=require(_0x04d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x04d2('0x7'));var ejs=require(_0x04d2('0x8'));var fs=require('fs');var fs_extra=require(_0x04d2('0x9'));var _=require(_0x04d2('0xa'));var squel=require(_0x04d2('0xb'));var crypto=require('crypto');var jsforce=require(_0x04d2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x04d2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x04d2('0xd'));var qs=require(_0x04d2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04d2('0xf'));var logger=require(_0x04d2('0x10'))(_0x04d2('0x11'));var utils=require(_0x04d2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x04d2('0x13'));var db=require(_0x04d2('0x14'))['db'];var integrations=require(_0x04d2('0x15'));function respondWithStatusCode(_0x2d2de1,_0x478488){_0x478488=_0x478488||0xcc;return function(_0xb719da){if(_0xb719da){return _0x2d2de1[_0x04d2('0x16')](_0x478488);}return _0x2d2de1['status'](_0x478488)[_0x04d2('0x17')]();};}function respondWithResult(_0xdedb54,_0x517016){_0x517016=_0x517016||0xc8;return function(_0x5051fa){if(_0x5051fa){return _0xdedb54[_0x04d2('0x18')](_0x517016)[_0x04d2('0x19')](_0x5051fa);}};}function respondWithFilteredResult(_0x62b8d4,_0x5de499){return function(_0x380a51){if(_0x380a51){var _0x34bce7=typeof _0x5de499[_0x04d2('0x1a')]===_0x04d2('0x1b')&&typeof _0x5de499[_0x04d2('0x1c')]==='undefined';var _0x39162e=_0x380a51[_0x04d2('0x1d')];var _0x5b09f6=_0x34bce7?0x0:_0x5de499[_0x04d2('0x1a')];var _0x74f2f0=_0x34bce7?_0x380a51[_0x04d2('0x1d')]:_0x5de499['offset']+_0x5de499[_0x04d2('0x1c')];var _0x170368;if(_0x74f2f0>=_0x39162e){_0x74f2f0=_0x39162e;_0x170368=0xc8;}else{_0x170368=0xce;}_0x62b8d4['status'](_0x170368);return _0x62b8d4[_0x04d2('0x1e')](_0x04d2('0x1f'),_0x5b09f6+'-'+_0x74f2f0+'/'+_0x39162e)[_0x04d2('0x19')](_0x380a51);}return null;};}function patchUpdates(_0x2117ca){return function(_0x1598b0){try{jsonpatch[_0x04d2('0x20')](_0x1598b0,_0x2117ca,!![]);}catch(_0x1ef542){return BPromise['reject'](_0x1ef542);}return _0x1598b0[_0x04d2('0x21')]();};}function saveUpdates(_0x36f0cb,_0x3623d0){return function(_0x5f1f27){if(_0x5f1f27){return _0x5f1f27[_0x04d2('0x22')](_0x36f0cb)[_0x04d2('0x23')](function(_0x4607ef){return _0x4607ef;});}return null;};}function removeEntity(_0x5ea5d6,_0x3538b9){return function(_0x1cadb2){if(_0x1cadb2){return _0x1cadb2['destroy']()[_0x04d2('0x23')](function(){_0x5ea5d6['status'](0xcc)[_0x04d2('0x17')]();});}};}function handleEntityNotFound(_0x57a224,_0x4952f3){return function(_0x5dc710){if(!_0x5dc710){_0x57a224[_0x04d2('0x16')](0x194);}return _0x5dc710;};}function handleError(_0xbede1b,_0x15b998){_0x15b998=_0x15b998||0x1f4;return function(_0x27f52d){logger['error'](_0x27f52d[_0x04d2('0x24')]);if(_0x27f52d[_0x04d2('0x25')]){delete _0x27f52d[_0x04d2('0x25')];}_0xbede1b[_0x04d2('0x18')](_0x15b998)[_0x04d2('0x26')](_0x27f52d);};}exports[_0x04d2('0x27')]=function(_0x5383f4,_0x13f0c6){var _0x50e6be={},_0x3a4a19={},_0x3a86d6={'count':0x0,'rows':[]};var _0x2df408=_['map'](db[_0x04d2('0x28')][_0x04d2('0x29')],function(_0x1446e5){return{'name':_0x1446e5[_0x04d2('0x2a')],'type':_0x1446e5[_0x04d2('0x2b')][_0x04d2('0x2c')]};});_0x3a4a19[_0x04d2('0x2d')]=_[_0x04d2('0x2e')](_0x2df408,_0x04d2('0x25'));_0x3a4a19[_0x04d2('0x2f')]=_[_0x04d2('0x30')](_0x5383f4[_0x04d2('0x2f')]);_0x3a4a19[_0x04d2('0x31')]=_[_0x04d2('0x32')](_0x3a4a19[_0x04d2('0x2d')],_0x3a4a19[_0x04d2('0x2f')]);_0x50e6be[_0x04d2('0x33')]=_[_0x04d2('0x32')](_0x3a4a19[_0x04d2('0x2d')],qs['fields'](_0x5383f4[_0x04d2('0x2f')][_0x04d2('0x34')]));_0x50e6be[_0x04d2('0x33')]=_0x50e6be[_0x04d2('0x33')]['length']?_0x50e6be[_0x04d2('0x33')]:_0x3a4a19[_0x04d2('0x2d')];if(!_0x5383f4[_0x04d2('0x2f')][_0x04d2('0x35')]('nolimit')){_0x50e6be[_0x04d2('0x1c')]=qs[_0x04d2('0x1c')](_0x5383f4['query'][_0x04d2('0x1c')]);_0x50e6be[_0x04d2('0x1a')]=qs[_0x04d2('0x1a')](_0x5383f4['query']['offset']);}_0x50e6be['order']=qs['sort'](_0x5383f4[_0x04d2('0x2f')]['sort']);_0x50e6be[_0x04d2('0x36')]=qs[_0x04d2('0x31')](_[_0x04d2('0x37')](_0x5383f4[_0x04d2('0x2f')],_0x3a4a19['filters']),_0x2df408);if(_0x5383f4['query']['filter']){_0x50e6be[_0x04d2('0x36')]=_[_0x04d2('0x38')](_0x50e6be[_0x04d2('0x36')],{'$or':_[_0x04d2('0x2e')](_0x2df408,function(_0x64134f){if(_0x64134f[_0x04d2('0x2b')]!==_0x04d2('0x39')){var _0x19a33e={};_0x19a33e[_0x64134f[_0x04d2('0x25')]]={'$like':'%'+_0x5383f4[_0x04d2('0x2f')][_0x04d2('0x3a')]+'%'};return _0x19a33e;}})});}_0x50e6be=_[_0x04d2('0x38')]({},_0x50e6be,_0x5383f4['options']);var _0xd2ec93={'where':_0x50e6be[_0x04d2('0x36')]};return db[_0x04d2('0x28')][_0x04d2('0x1d')](_0xd2ec93)[_0x04d2('0x23')](function(_0x5006d3){_0x3a86d6['count']=_0x5006d3;if(_0x5383f4[_0x04d2('0x2f')][_0x04d2('0x3b')]){_0x50e6be['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x04d2('0x3c')](_0x50e6be);})[_0x04d2('0x23')](function(_0xf8cd55){_0x3a86d6['rows']=_0xf8cd55;return _0x3a86d6;})[_0x04d2('0x23')](respondWithFilteredResult(_0x13f0c6,_0x50e6be))[_0x04d2('0x3d')](handleError(_0x13f0c6,null));};exports['show']=function(_0x165a4f,_0x5e9146){var _0x42dc87={'raw':![],'where':{'id':_0x165a4f[_0x04d2('0x3e')]['id']}},_0xd7b3ef={};_0xd7b3ef[_0x04d2('0x2d')]=_[_0x04d2('0x30')](db['FreshsalesAccount'][_0x04d2('0x29')]);_0xd7b3ef['query']=_['keys'](_0x165a4f[_0x04d2('0x2f')]);_0xd7b3ef['filters']=_['intersection'](_0xd7b3ef[_0x04d2('0x2d')],_0xd7b3ef[_0x04d2('0x2f')]);_0x42dc87['attributes']=_[_0x04d2('0x32')](_0xd7b3ef['model'],qs[_0x04d2('0x34')](_0x165a4f['query']['fields']));_0x42dc87['attributes']=_0x42dc87[_0x04d2('0x33')][_0x04d2('0x3f')]?_0x42dc87[_0x04d2('0x33')]:_0xd7b3ef[_0x04d2('0x2d')];if(_0x165a4f[_0x04d2('0x2f')][_0x04d2('0x3b')]){_0x42dc87['include']=[{'all':!![]}];}_0x42dc87=_[_0x04d2('0x38')]({},_0x42dc87,_0x165a4f['options']);return db[_0x04d2('0x28')]['find'](_0x42dc87)['then'](handleEntityNotFound(_0x5e9146,null))[_0x04d2('0x23')](respondWithResult(_0x5e9146,null))[_0x04d2('0x3d')](handleError(_0x5e9146,null));};exports[_0x04d2('0x40')]=function(_0x501aaf,_0x672f5a){return db[_0x04d2('0x28')][_0x04d2('0x40')](_0x501aaf[_0x04d2('0x41')],{})[_0x04d2('0x23')](respondWithResult(_0x672f5a,0xc9))[_0x04d2('0x3d')](handleError(_0x672f5a,null));};exports['update']=function(_0x4db9b3,_0x4f57e7){if(_0x4db9b3['body']['id']){delete _0x4db9b3[_0x04d2('0x41')]['id'];}return db['FreshsalesAccount'][_0x04d2('0x42')]({'where':{'id':_0x4db9b3[_0x04d2('0x3e')]['id']}})[_0x04d2('0x23')](handleEntityNotFound(_0x4f57e7,null))[_0x04d2('0x23')](saveUpdates(_0x4db9b3[_0x04d2('0x41')],null))[_0x04d2('0x23')](respondWithResult(_0x4f57e7,null))[_0x04d2('0x3d')](handleError(_0x4f57e7,null));};exports['destroy']=function(_0x4a305d,_0x46943e){return db[_0x04d2('0x28')][_0x04d2('0x42')]({'where':{'id':_0x4a305d[_0x04d2('0x3e')]['id']}})[_0x04d2('0x23')](handleEntityNotFound(_0x46943e,null))['then'](removeEntity(_0x46943e,null))[_0x04d2('0x3d')](handleError(_0x46943e,null));};exports[_0x04d2('0x43')]=function(_0x9f8b30,_0x1c5e08,_0x19ff19){var _0x435533={};var _0x79e6f8={};var _0x6105bd;var _0x2ad329;return db['FreshsalesAccount'][_0x04d2('0x44')]({'where':{'id':_0x9f8b30[_0x04d2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1c5e08,null))[_0x04d2('0x23')](function(_0x471299){if(_0x471299){_0x6105bd=_0x471299;_0x79e6f8[_0x04d2('0x2d')]=_['keys'](db[_0x04d2('0x45')][_0x04d2('0x29')]);_0x79e6f8[_0x04d2('0x2f')]=_[_0x04d2('0x30')](_0x9f8b30['query']);_0x79e6f8['filters']=_[_0x04d2('0x32')](_0x79e6f8[_0x04d2('0x2d')],_0x79e6f8[_0x04d2('0x2f')]);_0x435533[_0x04d2('0x33')]=_[_0x04d2('0x32')](_0x79e6f8['model'],qs['fields'](_0x9f8b30[_0x04d2('0x2f')][_0x04d2('0x34')]));_0x435533[_0x04d2('0x33')]=_0x435533[_0x04d2('0x33')]['length']?_0x435533['attributes']:_0x79e6f8[_0x04d2('0x2d')];_0x435533[_0x04d2('0x46')]=qs[_0x04d2('0x47')](_0x9f8b30[_0x04d2('0x2f')][_0x04d2('0x47')]);_0x435533['where']=qs[_0x04d2('0x31')](_[_0x04d2('0x37')](_0x9f8b30[_0x04d2('0x2f')],_0x79e6f8['filters']));if(_0x9f8b30[_0x04d2('0x2f')][_0x04d2('0x3a')]){_0x435533[_0x04d2('0x36')]=_[_0x04d2('0x38')](_0x435533[_0x04d2('0x36')],{'$or':_[_0x04d2('0x2e')](_0x435533[_0x04d2('0x33')],function(_0x47ca91){var _0x610eca={};_0x610eca[_0x47ca91]={'$like':'%'+_0x9f8b30[_0x04d2('0x2f')]['filter']+'%'};return _0x610eca;})});}_0x435533=_[_0x04d2('0x38')]({},_0x435533,_0x9f8b30[_0x04d2('0x48')]);return _0x6105bd[_0x04d2('0x43')](_0x435533);}})[_0x04d2('0x23')](function(_0x13a010){if(_0x13a010){_0x2ad329=_0x13a010[_0x04d2('0x3f')];if(!_0x9f8b30['query']['hasOwnProperty']('nolimit')){_0x435533[_0x04d2('0x1c')]=qs['limit'](_0x9f8b30[_0x04d2('0x2f')][_0x04d2('0x1c')]);_0x435533[_0x04d2('0x1a')]=qs['offset'](_0x9f8b30[_0x04d2('0x2f')][_0x04d2('0x1a')]);}return _0x6105bd[_0x04d2('0x43')](_0x435533);}})[_0x04d2('0x23')](function(_0x312aef){if(_0x312aef){return _0x312aef?{'count':_0x2ad329,'rows':_0x312aef}:null;}})[_0x04d2('0x23')](respondWithResult(_0x1c5e08,null))['catch'](handleError(_0x1c5e08,null));};exports[_0x04d2('0x49')]=function(_0x238424,_0x1560c4,_0x36ac0d){if(_0x238424[_0x04d2('0x41')]['id']){delete _0x238424[_0x04d2('0x41')]['id'];}return db[_0x04d2('0x28')][_0x04d2('0x44')]({'where':{'id':_0x238424['params']['id']}})[_0x04d2('0x23')](handleEntityNotFound(_0x1560c4,null))['then'](function(_0x1e3a4a){if(_0x1e3a4a){_0x238424[_0x04d2('0x41')][_0x04d2('0x4a')]=_0x1e3a4a['id'];_0x238424[_0x04d2('0x41')][_0x04d2('0x4b')]=integrations[_0x04d2('0x4c')](_0x238424[_0x04d2('0x41')][_0x04d2('0x4d')],_0x238424['body'][_0x04d2('0x2b')]);_0x238424['body'][_0x04d2('0x4e')]=integrations[_0x04d2('0x4f')](_0x238424[_0x04d2('0x41')][_0x04d2('0x4d')],_0x238424[_0x04d2('0x41')][_0x04d2('0x2b')]);return db[_0x04d2('0x45')]['create'](_0x238424[_0x04d2('0x41')],{'include':[{'model':db['FreshsalesField'],'as':_0x04d2('0x4b')},{'model':db[_0x04d2('0x50')],'as':_0x04d2('0x4e')}]});}return null;})[_0x04d2('0x23')](respondWithResult(_0x1560c4,null))[_0x04d2('0x3d')](handleError(_0x1560c4,null));};exports[_0x04d2('0x51')]=function(_0x4925ad,_0x3f4f3c,_0x1542a1){var _0x311756='';var _0x35e344='';return db[_0x04d2('0x28')][_0x04d2('0x44')]({'where':{'id':_0x4925ad['params']['id']},'attributes':['id',_0x04d2('0x52'),'remoteUri','apiKey']})[_0x04d2('0x23')](handleEntityNotFound(_0x3f4f3c,null))[_0x04d2('0x23')](function(_0x3262ee){if(_0x3262ee){_0x35e344=_0x3262ee[_0x04d2('0x52')];_0x311756=_0x3262ee[_0x04d2('0x53')];var _0xdf5816=_0x3262ee[_0x04d2('0x53')]['slice'](-0x1);if(_0xdf5816==='/'){_0x311756=_0x311756['substring'](0x0,_0x311756[_0x04d2('0x54')](_0xdf5816));}return rp({'method':_0x04d2('0x55'),'uri':util[_0x04d2('0x56')](_0x04d2('0x57'),_0x311756,_0x04d2('0x58')),'headers':{'Authorization':_0x04d2('0x59')+_0x3262ee['apiKey']},'json':!![]});}})[_0x04d2('0x23')](function(_0x5e6bd0){if(_0x5e6bd0){var _0x1a090d=_0x5e6bd0[_0x04d2('0x5a')];var _0x3a7b15=![];var _0x2eafac=null;for(_0x2eafac=0x0;_0x2eafac<_0x1a090d[_0x04d2('0x3f')];_0x2eafac++){if(_0x1a090d[_0x2eafac][_0x04d2('0x5b')]===_0x35e344){_0x3a7b15=!![];}}if(_0x3a7b15){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x04d2('0x5c')});}}})[_0x04d2('0x23')](respondWithResult(_0x3f4f3c,null))[_0x04d2('0x3d')](function(_0x18c24e){var _0x549b6f=_0x4925ad['query'][_0x04d2('0x5d')]?0x1f4:_0x18c24e[_0x04d2('0x5e')]||0x1f4;logger[_0x04d2('0x5f')](_0x04d2('0x60'),_0x04d2('0x51'),_0x549b6f,JSON[_0x04d2('0x61')](_0x18c24e));delete _0x18c24e[_0x04d2('0x25')];if(_0x549b6f===0x191){_0x549b6f=0x190;}_0x3f4f3c[_0x04d2('0x18')](_0x549b6f)[_0x04d2('0x26')](_0x4925ad[_0x04d2('0x2f')][_0x04d2('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x18c24e['statusCode']}:_0x18c24e);});};
\ No newline at end of file
+var _0x83c2=['merge','filter','options','FreshsalesAccount','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','getConfigurations','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0x463d73,_0x471f3d){var _0x2a2f1b=function(_0x403539){while(--_0x403539){_0x463d73['push'](_0x463d73['shift']());}};_0x2a2f1b(++_0x471f3d);}(_0x83c2,0x96));var _0x283c=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x83c2[_0x334fea];return _0x3c5829;};'use strict';var emlformat=require(_0x283c('0x0'));var rimraf=require(_0x283c('0x1'));var zipdir=require(_0x283c('0x2'));var jsonpatch=require(_0x283c('0x3'));var rp=require('request-promise');var moment=require(_0x283c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x283c('0x5'));var path=require(_0x283c('0x6'));var sox=require('sox');var csv=require(_0x283c('0x7'));var ejs=require(_0x283c('0x8'));var fs=require('fs');var fs_extra=require(_0x283c('0x9'));var _=require(_0x283c('0xa'));var squel=require(_0x283c('0xb'));var crypto=require(_0x283c('0xc'));var jsforce=require(_0x283c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x283c('0xe'));var Papa=require(_0x283c('0xf'));var Redis=require('ioredis');var authService=require(_0x283c('0x10'));var qs=require(_0x283c('0x11'));var as=require(_0x283c('0x12'));var hardwareService=require(_0x283c('0x13'));var logger=require(_0x283c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x283c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x283c('0x16'));function respondWithStatusCode(_0x4d34d9,_0x41dd2f){_0x41dd2f=_0x41dd2f||0xcc;return function(_0x2c632a){if(_0x2c632a){return _0x4d34d9['sendStatus'](_0x41dd2f);}return _0x4d34d9[_0x283c('0x17')](_0x41dd2f)['end']();};}function respondWithResult(_0x1e06ee,_0x1e5b4d){_0x1e5b4d=_0x1e5b4d||0xc8;return function(_0x49622e){if(_0x49622e){return _0x1e06ee['status'](_0x1e5b4d)[_0x283c('0x18')](_0x49622e);}};}function respondWithFilteredResult(_0x586c6b,_0x5e45a6){return function(_0x1b2459){if(_0x1b2459){var _0x512972=typeof _0x5e45a6[_0x283c('0x19')]===_0x283c('0x1a')&&typeof _0x5e45a6[_0x283c('0x1b')]===_0x283c('0x1a');var _0x172b67=_0x1b2459['count'];var _0x3e8311=_0x512972?0x0:_0x5e45a6[_0x283c('0x19')];var _0xe0bf17=_0x512972?_0x1b2459['count']:_0x5e45a6[_0x283c('0x19')]+_0x5e45a6[_0x283c('0x1b')];var _0x51c2e1;if(_0xe0bf17>=_0x172b67){_0xe0bf17=_0x172b67;_0x51c2e1=0xc8;}else{_0x51c2e1=0xce;}_0x586c6b[_0x283c('0x17')](_0x51c2e1);return _0x586c6b['set']('Content-Range',_0x3e8311+'-'+_0xe0bf17+'/'+_0x172b67)[_0x283c('0x18')](_0x1b2459);}return null;};}function patchUpdates(_0x447310){return function(_0x114af2){try{jsonpatch[_0x283c('0x1c')](_0x114af2,_0x447310,!![]);}catch(_0x30b14c){return BPromise[_0x283c('0x1d')](_0x30b14c);}return _0x114af2[_0x283c('0x1e')]();};}function saveUpdates(_0x4d4739,_0x2ddd63){return function(_0x49563a){if(_0x49563a){return _0x49563a[_0x283c('0x1f')](_0x4d4739)[_0x283c('0x20')](function(_0x4d33b7){return _0x4d33b7;});}return null;};}function removeEntity(_0x208730,_0x1109d7){return function(_0x20fcf8){if(_0x20fcf8){return _0x20fcf8[_0x283c('0x21')]()['then'](function(){_0x208730['status'](0xcc)[_0x283c('0x22')]();});}};}function handleEntityNotFound(_0x4fa53f,_0x40c379){return function(_0x45ce36){if(!_0x45ce36){_0x4fa53f[_0x283c('0x23')](0x194);}return _0x45ce36;};}function handleError(_0x381d62,_0x4db2d9){_0x4db2d9=_0x4db2d9||0x1f4;return function(_0x41052c){logger['error'](_0x41052c[_0x283c('0x24')]);if(_0x41052c[_0x283c('0x25')]){delete _0x41052c[_0x283c('0x25')];}_0x381d62[_0x283c('0x17')](_0x4db2d9)[_0x283c('0x26')](_0x41052c);};}exports[_0x283c('0x27')]=function(_0x346a2a,_0x16a0fd){var _0x3897f3={},_0x2d15c1={},_0x40c65c={'count':0x0,'rows':[]};var _0x2cacc8=_['map'](db['FreshsalesAccount'][_0x283c('0x28')],function(_0x364226){return{'name':_0x364226[_0x283c('0x29')],'type':_0x364226[_0x283c('0x2a')][_0x283c('0x2b')]};});_0x2d15c1[_0x283c('0x2c')]=_[_0x283c('0x2d')](_0x2cacc8,_0x283c('0x25'));_0x2d15c1[_0x283c('0x2e')]=_[_0x283c('0x2f')](_0x346a2a[_0x283c('0x2e')]);_0x2d15c1[_0x283c('0x30')]=_[_0x283c('0x31')](_0x2d15c1[_0x283c('0x2c')],_0x2d15c1['query']);_0x3897f3['attributes']=_[_0x283c('0x31')](_0x2d15c1['model'],qs[_0x283c('0x32')](_0x346a2a[_0x283c('0x2e')][_0x283c('0x32')]));_0x3897f3['attributes']=_0x3897f3[_0x283c('0x33')][_0x283c('0x34')]?_0x3897f3[_0x283c('0x33')]:_0x2d15c1['model'];if(!_0x346a2a[_0x283c('0x2e')][_0x283c('0x35')]('nolimit')){_0x3897f3[_0x283c('0x1b')]=qs[_0x283c('0x1b')](_0x346a2a[_0x283c('0x2e')][_0x283c('0x1b')]);_0x3897f3[_0x283c('0x19')]=qs[_0x283c('0x19')](_0x346a2a[_0x283c('0x2e')]['offset']);}_0x3897f3[_0x283c('0x36')]=qs[_0x283c('0x37')](_0x346a2a[_0x283c('0x2e')][_0x283c('0x37')]);_0x3897f3[_0x283c('0x38')]=qs[_0x283c('0x30')](_[_0x283c('0x39')](_0x346a2a[_0x283c('0x2e')],_0x2d15c1[_0x283c('0x30')]),_0x2cacc8);if(_0x346a2a[_0x283c('0x2e')]['filter']){_0x3897f3[_0x283c('0x38')]=_[_0x283c('0x3a')](_0x3897f3['where'],{'$or':_['map'](_0x2cacc8,function(_0x578bf7){if(_0x578bf7[_0x283c('0x2a')]!=='VIRTUAL'){var _0x5a36a8={};_0x5a36a8[_0x578bf7[_0x283c('0x25')]]={'$like':'%'+_0x346a2a[_0x283c('0x2e')][_0x283c('0x3b')]+'%'};return _0x5a36a8;}})});}_0x3897f3=_['merge']({},_0x3897f3,_0x346a2a[_0x283c('0x3c')]);var _0x48a88b={'where':_0x3897f3[_0x283c('0x38')]};return db[_0x283c('0x3d')][_0x283c('0x3e')](_0x48a88b)[_0x283c('0x20')](function(_0x50cf39){_0x40c65c[_0x283c('0x3e')]=_0x50cf39;if(_0x346a2a['query'][_0x283c('0x3f')]){_0x3897f3[_0x283c('0x40')]=[{'all':!![]}];}return db[_0x283c('0x3d')][_0x283c('0x41')](_0x3897f3);})[_0x283c('0x20')](function(_0x18e0d0){_0x40c65c[_0x283c('0x42')]=_0x18e0d0;return _0x40c65c;})[_0x283c('0x20')](respondWithFilteredResult(_0x16a0fd,_0x3897f3))[_0x283c('0x43')](handleError(_0x16a0fd,null));};exports[_0x283c('0x44')]=function(_0x2a18a1,_0x1140a3){var _0x236799={'raw':![],'where':{'id':_0x2a18a1[_0x283c('0x45')]['id']}},_0x548753={};_0x548753[_0x283c('0x2c')]=_['keys'](db[_0x283c('0x3d')]['rawAttributes']);_0x548753[_0x283c('0x2e')]=_[_0x283c('0x2f')](_0x2a18a1[_0x283c('0x2e')]);_0x548753[_0x283c('0x30')]=_['intersection'](_0x548753[_0x283c('0x2c')],_0x548753[_0x283c('0x2e')]);_0x236799[_0x283c('0x33')]=_[_0x283c('0x31')](_0x548753[_0x283c('0x2c')],qs[_0x283c('0x32')](_0x2a18a1['query'][_0x283c('0x32')]));_0x236799[_0x283c('0x33')]=_0x236799[_0x283c('0x33')]['length']?_0x236799[_0x283c('0x33')]:_0x548753[_0x283c('0x2c')];if(_0x2a18a1['query'][_0x283c('0x3f')]){_0x236799[_0x283c('0x40')]=[{'all':!![]}];}_0x236799=_[_0x283c('0x3a')]({},_0x236799,_0x2a18a1['options']);return db[_0x283c('0x3d')]['find'](_0x236799)[_0x283c('0x20')](handleEntityNotFound(_0x1140a3,null))['then'](respondWithResult(_0x1140a3,null))[_0x283c('0x43')](handleError(_0x1140a3,null));};exports['create']=function(_0x1b7b00,_0x100e4e){return db[_0x283c('0x3d')][_0x283c('0x46')](_0x1b7b00[_0x283c('0x47')],{})['then'](respondWithResult(_0x100e4e,0xc9))[_0x283c('0x43')](handleError(_0x100e4e,null));};exports[_0x283c('0x1f')]=function(_0x4cfdef,_0x4d4278){if(_0x4cfdef['body']['id']){delete _0x4cfdef['body']['id'];}return db[_0x283c('0x3d')][_0x283c('0x48')]({'where':{'id':_0x4cfdef['params']['id']}})['then'](handleEntityNotFound(_0x4d4278,null))[_0x283c('0x20')](saveUpdates(_0x4cfdef['body'],null))['then'](respondWithResult(_0x4d4278,null))['catch'](handleError(_0x4d4278,null));};exports[_0x283c('0x21')]=function(_0x58941e,_0x2622cd){return db[_0x283c('0x3d')][_0x283c('0x48')]({'where':{'id':_0x58941e['params']['id']}})[_0x283c('0x20')](handleEntityNotFound(_0x2622cd,null))[_0x283c('0x20')](removeEntity(_0x2622cd,null))[_0x283c('0x43')](handleError(_0x2622cd,null));};exports['getConfigurations']=function(_0x25c09b,_0x540aaa,_0xef5611){var _0xd5b24f={};var _0x922924={};var _0x3a716d;var _0x1db87c;return db[_0x283c('0x3d')][_0x283c('0x49')]({'where':{'id':_0x25c09b[_0x283c('0x45')]['id']}})[_0x283c('0x20')](handleEntityNotFound(_0x540aaa,null))[_0x283c('0x20')](function(_0x595554){if(_0x595554){_0x3a716d=_0x595554;_0x922924[_0x283c('0x2c')]=_['keys'](db['FreshsalesConfiguration'][_0x283c('0x28')]);_0x922924[_0x283c('0x2e')]=_[_0x283c('0x2f')](_0x25c09b[_0x283c('0x2e')]);_0x922924[_0x283c('0x30')]=_[_0x283c('0x31')](_0x922924[_0x283c('0x2c')],_0x922924['query']);_0xd5b24f[_0x283c('0x33')]=_['intersection'](_0x922924[_0x283c('0x2c')],qs[_0x283c('0x32')](_0x25c09b[_0x283c('0x2e')][_0x283c('0x32')]));_0xd5b24f[_0x283c('0x33')]=_0xd5b24f[_0x283c('0x33')][_0x283c('0x34')]?_0xd5b24f[_0x283c('0x33')]:_0x922924[_0x283c('0x2c')];_0xd5b24f[_0x283c('0x36')]=qs['sort'](_0x25c09b[_0x283c('0x2e')][_0x283c('0x37')]);_0xd5b24f['where']=qs[_0x283c('0x30')](_[_0x283c('0x39')](_0x25c09b[_0x283c('0x2e')],_0x922924[_0x283c('0x30')]));if(_0x25c09b[_0x283c('0x2e')][_0x283c('0x3b')]){_0xd5b24f['where']=_[_0x283c('0x3a')](_0xd5b24f['where'],{'$or':_[_0x283c('0x2d')](_0xd5b24f[_0x283c('0x33')],function(_0x3be728){var _0x29e1bb={};_0x29e1bb[_0x3be728]={'$like':'%'+_0x25c09b[_0x283c('0x2e')][_0x283c('0x3b')]+'%'};return _0x29e1bb;})});}_0xd5b24f=_[_0x283c('0x3a')]({},_0xd5b24f,_0x25c09b[_0x283c('0x3c')]);return _0x3a716d[_0x283c('0x4a')](_0xd5b24f);}})[_0x283c('0x20')](function(_0x15e494){if(_0x15e494){_0x1db87c=_0x15e494['length'];if(!_0x25c09b[_0x283c('0x2e')][_0x283c('0x35')](_0x283c('0x4b'))){_0xd5b24f[_0x283c('0x1b')]=qs['limit'](_0x25c09b[_0x283c('0x2e')][_0x283c('0x1b')]);_0xd5b24f['offset']=qs[_0x283c('0x19')](_0x25c09b[_0x283c('0x2e')][_0x283c('0x19')]);}return _0x3a716d[_0x283c('0x4a')](_0xd5b24f);}})['then'](function(_0x55fdf5){if(_0x55fdf5){return _0x55fdf5?{'count':_0x1db87c,'rows':_0x55fdf5}:null;}})[_0x283c('0x20')](respondWithResult(_0x540aaa,null))[_0x283c('0x43')](handleError(_0x540aaa,null));};exports['addConfiguration']=function(_0x3ba3ce,_0x18e8fd,_0x488d28){if(_0x3ba3ce[_0x283c('0x47')]['id']){delete _0x3ba3ce['body']['id'];}return db['FreshsalesAccount'][_0x283c('0x49')]({'where':{'id':_0x3ba3ce[_0x283c('0x45')]['id']}})[_0x283c('0x20')](handleEntityNotFound(_0x18e8fd,null))[_0x283c('0x20')](function(_0x1cce70){if(_0x1cce70){_0x3ba3ce[_0x283c('0x47')][_0x283c('0x4c')]=_0x1cce70['id'];_0x3ba3ce[_0x283c('0x47')][_0x283c('0x4d')]=integrations[_0x283c('0x4e')](_0x3ba3ce[_0x283c('0x47')][_0x283c('0x4f')],_0x3ba3ce['body']['type']);_0x3ba3ce[_0x283c('0x47')][_0x283c('0x50')]=integrations[_0x283c('0x51')](_0x3ba3ce[_0x283c('0x47')][_0x283c('0x4f')],_0x3ba3ce[_0x283c('0x47')][_0x283c('0x2a')]);return db[_0x283c('0x52')][_0x283c('0x46')](_0x3ba3ce[_0x283c('0x47')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x283c('0x53')],'as':_0x283c('0x50')}]});}return null;})[_0x283c('0x20')](respondWithResult(_0x18e8fd,null))[_0x283c('0x43')](handleError(_0x18e8fd,null));};exports['getFields']=function(_0x35f863,_0xef9710,_0x3ae148){var _0x138136='';var _0x1eaf88='';return db[_0x283c('0x3d')]['findOne']({'where':{'id':_0x35f863[_0x283c('0x45')]['id']},'attributes':['id',_0x283c('0x54'),_0x283c('0x55'),_0x283c('0x56')]})[_0x283c('0x20')](handleEntityNotFound(_0xef9710,null))[_0x283c('0x20')](function(_0x4d37bf){if(_0x4d37bf){_0x1eaf88=_0x4d37bf[_0x283c('0x54')];_0x138136=_0x4d37bf[_0x283c('0x55')];var _0x250ac3=_0x4d37bf[_0x283c('0x55')][_0x283c('0x57')](-0x1);if(_0x250ac3==='/'){_0x138136=_0x138136[_0x283c('0x58')](0x0,_0x138136[_0x283c('0x59')](_0x250ac3));}return rp({'method':_0x283c('0x5a'),'uri':util[_0x283c('0x5b')](_0x283c('0x5c'),_0x138136,_0x283c('0x5d')),'headers':{'Authorization':'Token\x20token='+_0x4d37bf[_0x283c('0x56')]},'json':!![]});}})[_0x283c('0x20')](function(_0x595aa2){if(_0x595aa2){var _0x1f005f=_0x595aa2[_0x283c('0x5e')];var _0x389a63=![];var _0x14c225=null;for(_0x14c225=0x0;_0x14c225<_0x1f005f[_0x283c('0x34')];_0x14c225++){if(_0x1f005f[_0x14c225][_0x283c('0x5f')]===_0x1eaf88){_0x389a63=!![];}}if(_0x389a63){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x283c('0x60')});}}})['then'](respondWithResult(_0xef9710,null))['catch'](function(_0x4b91f1){var _0x152893=_0x35f863['query'][_0x283c('0x61')]?0x1f4:_0x4b91f1[_0x283c('0x62')]||0x1f4;logger[_0x283c('0x63')](_0x283c('0x64'),_0x283c('0x65'),_0x152893,JSON[_0x283c('0x66')](_0x4b91f1));delete _0x4b91f1[_0x283c('0x25')];if(_0x152893===0x191){_0x152893=0x190;}_0xef9710['status'](_0x152893)[_0x283c('0x26')](_0x35f863[_0x283c('0x2e')][_0x283c('0x61')]?{'message':_0x283c('0x67'),'statusCode':_0x4b91f1[_0x283c('0x62')]}:_0x4b91f1);});};
\ No newline at end of file
index ab90d61..01e9871 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfcf0,0x138));var _0x0fcf=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xfcf0[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x0fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7a54,0x106));var _0x47a5=function(_0x28ee7a,_0x59637e){_0x28ee7a=_0x28ee7a-0x0;var _0x2c3634=_0x7a54[_0x28ee7a];return _0x2c3634;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));var integrations=require(_0x47a5('0x9'));module['exports']=function(_0x3d5629,_0x59199c){return _0x3d5629[_0x47a5('0xa')](_0x47a5('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9f4feaf..2ddbdb1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d11=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FreshsalesAccount','findAll','options','attributes','limit','map','include','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0xe36749,_0x2a45c8){var _0x5d86b7=function(_0x1219e5){while(--_0x1219e5){_0xe36749['push'](_0xe36749['shift']());}};_0x5d86b7(++_0x2a45c8);}(_0x6d11,0xbf));var _0x16d1=function(_0x4a882e,_0xcfdddc){_0x4a882e=_0x4a882e-0x0;var _0x33828e=_0x6d11[_0x4a882e];return _0x33828e;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});}exports['GetFreshsalesAccount']=function(_0x46a25e){var _0x4aeff0=this;return new Promise(function(_0x1da1b8,_0x4fe22d){return db[_0x16d1('0x15')][_0x16d1('0x16')]({'raw':_0x46a25e['options']?_0x46a25e['options']['raw']===undefined?!![]:![]:!![],'where':_0x46a25e['options']?_0x46a25e[_0x16d1('0x17')]['where']||null:null,'attributes':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x18')]||null:null,'limit':_0x46a25e[_0x16d1('0x17')]?_0x46a25e['options'][_0x16d1('0x19')]||null:null,'include':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')]['include']?_[_0x16d1('0x1a')](_0x46a25e[_0x16d1('0x17')][_0x16d1('0x1b')],function(_0x47cad4){return{'model':db[_0x47cad4[_0x16d1('0x1c')]],'as':_0x47cad4['as'],'attributes':_0x47cad4[_0x16d1('0x18')],'include':_0x47cad4[_0x16d1('0x1b')]?_[_0x16d1('0x1a')](_0x47cad4[_0x16d1('0x1b')],function(_0x335c24){return{'model':db[_0x335c24[_0x16d1('0x1c')]],'as':_0x335c24['as'],'attributes':_0x335c24[_0x16d1('0x18')],'include':_0x335c24[_0x16d1('0x1b')]?_[_0x16d1('0x1a')](_0x335c24[_0x16d1('0x1b')],function(_0x2b8403){return{'model':db[_0x2b8403['model']],'as':_0x2b8403['as'],'attributes':_0x2b8403[_0x16d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x16d1('0xa')](function(_0x4257f1){logger['info'](_0x16d1('0x1d'),_0x46a25e);logger[_0x16d1('0xd')](_0x16d1('0x1d'),_0x46a25e,JSON[_0x16d1('0x10')](_0x4257f1));_0x1da1b8(_0x4257f1);})[_0x16d1('0x14')](function(_0x462e5b){logger[_0x16d1('0x11')]('GetFreshsalesAccount',_0x462e5b[_0x16d1('0x13')],_0x46a25e);_0x4fe22d(_0x4aeff0[_0x16d1('0x11')](0x1f4,_0x462e5b[_0x16d1('0x13')]));});});};exports[_0x16d1('0x1e')]=function(_0x55c021){var _0x4b27f6=this;return new Promise(function(_0x2f16ee,_0x4ab3d4){return db[_0x16d1('0x15')][_0x16d1('0x1f')]({'raw':_0x55c021[_0x16d1('0x17')]?_0x55c021[_0x16d1('0x17')][_0x16d1('0x20')]===undefined?!![]:![]:!![],'where':_0x55c021[_0x16d1('0x17')]?_0x55c021[_0x16d1('0x17')][_0x16d1('0x21')]||null:null,'attributes':_0x55c021[_0x16d1('0x17')]?_0x55c021[_0x16d1('0x17')][_0x16d1('0x18')]||null:null,'include':_0x55c021[_0x16d1('0x17')]?_0x55c021['options'][_0x16d1('0x1b')]?_['map'](_0x55c021[_0x16d1('0x17')][_0x16d1('0x1b')],function(_0x2b9126){return{'model':db[_0x2b9126[_0x16d1('0x1c')]],'as':_0x2b9126['as'],'attributes':_0x2b9126[_0x16d1('0x18')],'include':_0x2b9126[_0x16d1('0x1b')]?_['map'](_0x2b9126['include'],function(_0x58d72d){return{'model':db[_0x58d72d[_0x16d1('0x1c')]],'as':_0x58d72d['as'],'attributes':_0x58d72d[_0x16d1('0x18')],'include':_0x58d72d[_0x16d1('0x1b')]?_[_0x16d1('0x1a')](_0x58d72d['include'],function(_0x885454){return{'model':db[_0x885454[_0x16d1('0x1c')]],'as':_0x885454['as'],'attributes':_0x885454['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x508ed7){logger[_0x16d1('0xb')](_0x16d1('0x1e'),_0x55c021);logger[_0x16d1('0xd')]('ShowFreshsalesAccount',_0x55c021,JSON[_0x16d1('0x10')](_0x508ed7));_0x2f16ee(_0x508ed7);})[_0x16d1('0x14')](function(_0x2928ad){logger[_0x16d1('0x11')](_0x16d1('0x1e'),_0x2928ad[_0x16d1('0x13')],_0x55c021);_0x4ab3d4(_0x4b27f6[_0x16d1('0x11')](0x1f4,_0x2928ad['message']));});});};
\ No newline at end of file
+var _0xffd6=['options','raw','limit','include','model','attributes','ShowFreshsalesAccount','FreshsalesAccount','find','where','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','findAll'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xffd6,0x97));var _0x6ffd=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xffd6[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['FreshsalesAccount'][_0x6ffd('0x17')]({'raw':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b['options'][_0x6ffd('0x19')]===undefined?!![]:![]:!![],'where':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b['options']['where']||null:null,'attributes':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b[_0x6ffd('0x18')]['attributes']||null:null,'limit':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1a')]||null:null,'include':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1b')]?_['map'](_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1b')],function(_0x50c19a){return{'model':db[_0x50c19a[_0x6ffd('0x1c')]],'as':_0x50c19a['as'],'attributes':_0x50c19a[_0x6ffd('0x1d')],'include':_0x50c19a[_0x6ffd('0x1b')]?_['map'](_0x50c19a[_0x6ffd('0x1b')],function(_0x3e5726){return{'model':db[_0x3e5726[_0x6ffd('0x1c')]],'as':_0x3e5726['as'],'attributes':_0x3e5726['attributes'],'include':_0x3e5726[_0x6ffd('0x1b')]?_['map'](_0x3e5726[_0x6ffd('0x1b')],function(_0x43269c){return{'model':db[_0x43269c['model']],'as':_0x43269c['as'],'attributes':_0x43269c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ffd('0xa')](function(_0x2a0391){logger[_0x6ffd('0x13')]('GetFreshsalesAccount',_0x889a4b);logger['debug'](_0x6ffd('0x16'),_0x889a4b,JSON['stringify'](_0x2a0391));_0x11a609(_0x2a0391);})[_0x6ffd('0x15')](function(_0x20c007){logger['error'](_0x6ffd('0x16'),_0x20c007[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0x20c007[_0x6ffd('0x12')]));});});};exports[_0x6ffd('0x1e')]=function(_0x31c609){var _0x225c66=this;return new Promise(function(_0xccb8c,_0x17f627){return db[_0x6ffd('0x1f')][_0x6ffd('0x20')]({'raw':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x31c609['options']?_0x31c609['options'][_0x6ffd('0x21')]||null:null,'attributes':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1d')]||null:null,'include':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1b')]?_[_0x6ffd('0x22')](_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1b')],function(_0x26394c){return{'model':db[_0x26394c[_0x6ffd('0x1c')]],'as':_0x26394c['as'],'attributes':_0x26394c[_0x6ffd('0x1d')],'include':_0x26394c['include']?_[_0x6ffd('0x22')](_0x26394c[_0x6ffd('0x1b')],function(_0x2efc20){return{'model':db[_0x2efc20[_0x6ffd('0x1c')]],'as':_0x2efc20['as'],'attributes':_0x2efc20['attributes'],'include':_0x2efc20[_0x6ffd('0x1b')]?_['map'](_0x2efc20['include'],function(_0x617d52){return{'model':db[_0x617d52[_0x6ffd('0x1c')]],'as':_0x617d52['as'],'attributes':_0x617d52[_0x6ffd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6ffd('0xa')](function(_0x55e9b4){logger[_0x6ffd('0x13')]('ShowFreshsalesAccount',_0x31c609);logger[_0x6ffd('0xd')](_0x6ffd('0x1e'),_0x31c609,JSON[_0x6ffd('0xf')](_0x55e9b4));_0xccb8c(_0x55e9b4);})[_0x6ffd('0x15')](function(_0x23fae4){logger['error']('ShowFreshsalesAccount',_0x23fae4[_0x6ffd('0x12')],_0x31c609);_0x17f627(_0x225c66['error'](0x1f4,_0x23fae4[_0x6ffd('0x12')]));});});};
\ No newline at end of file
index 5c9735d..ed13df7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32c6=['/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32c6,0x14c));var _0x632c=function(_0x421c96,_0x324a2b){_0x421c96=_0x421c96-0x0;var _0xbf32d6=_0x32c6[_0x421c96];return _0xbf32d6;};'use strict';var multer=require('multer');var util=require(_0x632c('0x0'));var path=require('path');var timeout=require(_0x632c('0x1'));var express=require('express');var router=express[_0x632c('0x2')]();var fs_extra=require(_0x632c('0x3'));var auth=require(_0x632c('0x4'));var interaction=require(_0x632c('0x5'));var config=require(_0x632c('0x6'));var controller=require(_0x632c('0x7'));router[_0x632c('0x8')]('/',auth[_0x632c('0x9')](),controller['index']);router[_0x632c('0x8')](_0x632c('0xa'),auth[_0x632c('0x9')](),controller[_0x632c('0xb')]);router[_0x632c('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x632c('0xc')]);router[_0x632c('0x8')](_0x632c('0xd'),auth[_0x632c('0x9')](),controller[_0x632c('0xe')]);router[_0x632c('0x8')](_0x632c('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x632c('0x10')]('/',auth['isAuthenticated'](),controller[_0x632c('0x11')]);router[_0x632c('0x12')]('/:id',auth[_0x632c('0x9')](),controller[_0x632c('0x13')]);router[_0x632c('0x14')](_0x632c('0xa'),auth[_0x632c('0x9')](),controller[_0x632c('0x15')]);module[_0x632c('0x16')]=router;
\ No newline at end of file
+var _0xfee3=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfee3,0xa3));var _0x3fee=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xfee3[_0x2d994d];return _0xd54be4;};'use strict';var multer=require('multer');var util=require(_0x3fee('0x0'));var path=require('path');var timeout=require(_0x3fee('0x1'));var express=require(_0x3fee('0x2'));var router=express['Router']();var fs_extra=require(_0x3fee('0x3'));var auth=require(_0x3fee('0x4'));var interaction=require(_0x3fee('0x5'));var config=require(_0x3fee('0x6'));var controller=require(_0x3fee('0x7'));router[_0x3fee('0x8')]('/',auth[_0x3fee('0x9')](),controller[_0x3fee('0xa')]);router['get'](_0x3fee('0xb'),auth[_0x3fee('0x9')](),controller[_0x3fee('0xc')]);router[_0x3fee('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x3fee('0x8')](_0x3fee('0xd'),auth['isAuthenticated'](),controller[_0x3fee('0xe')]);router[_0x3fee('0x8')](_0x3fee('0xf'),auth[_0x3fee('0x9')](),controller[_0x3fee('0x10')]);router[_0x3fee('0x11')]('/',auth[_0x3fee('0x9')](),controller[_0x3fee('0x12')]);router[_0x3fee('0x13')](_0x3fee('0xb'),auth[_0x3fee('0x9')](),controller[_0x3fee('0x14')]);router['delete'](_0x3fee('0xb'),auth[_0x3fee('0x9')](),controller['destroy']);module[_0x3fee('0x15')]=router;
\ No newline at end of file
index 9d484f6..4865025 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a75=['exports','STRING','sequelize'];(function(_0x19ba62,_0x499de0){var _0x54fc2a=function(_0x26f084){while(--_0x26f084){_0x19ba62['push'](_0x19ba62['shift']());}};_0x54fc2a(++_0x499de0);}(_0x5a75,0xf8));var _0x55a7=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x5a75[_0x43c8b8];return _0x413be3;};'use strict';var Sequelize=require(_0x55a7('0x0'));module[_0x55a7('0x1')]={'name':{'type':Sequelize[_0x55a7('0x2')]},'description':{'type':Sequelize[_0x55a7('0x2')]}};
\ No newline at end of file
+var _0x5b87=['STRING'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x5b87,0x1b1));var _0x75b8=function(_0x38e0a,_0x5b3a8c){_0x38e0a=_0x38e0a-0x0;var _0x427352=_0x5b87[_0x38e0a];return _0x427352;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x75b8('0x0')]},'description':{'type':Sequelize[_0x75b8('0x0')]}};
\ No newline at end of file
index 0bdf2d2..32031fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8aaa=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','destroy','getSubjects','findOne','FreshsalesField','pick','getDescriptions','nolimit','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','error','stack','name','map','FreshsalesConfiguration','type','key','keys','query','filters'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x8aaa,0x10c));var _0xa8aa=function(_0x3c5ad6,_0x47b7bf){_0x3c5ad6=_0x3c5ad6-0x0;var _0x3154f2=_0x8aaa[_0x3c5ad6];return _0x3154f2;};'use strict';var emlformat=require(_0xa8aa('0x0'));var rimraf=require(_0xa8aa('0x1'));var zipdir=require(_0xa8aa('0x2'));var jsonpatch=require(_0xa8aa('0x3'));var rp=require(_0xa8aa('0x4'));var moment=require(_0xa8aa('0x5'));var BPromise=require(_0xa8aa('0x6'));var Mustache=require('mustache');var util=require(_0xa8aa('0x7'));var path=require(_0xa8aa('0x8'));var sox=require(_0xa8aa('0x9'));var csv=require(_0xa8aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa8aa('0xb'));var squel=require(_0xa8aa('0xc'));var crypto=require(_0xa8aa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa8aa('0xe'));var Papa=require('papaparse');var Redis=require(_0xa8aa('0xf'));var authService=require(_0xa8aa('0x10'));var qs=require(_0xa8aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8aa('0x12'));var logger=require(_0xa8aa('0x13'))(_0xa8aa('0x14'));var utils=require(_0xa8aa('0x15'));var config=require(_0xa8aa('0x16'));var licenseUtil=require(_0xa8aa('0x17'));var db=require(_0xa8aa('0x18'))['db'];function respondWithStatusCode(_0x4b7833,_0xac928d){_0xac928d=_0xac928d||0xcc;return function(_0x1c26c8){if(_0x1c26c8){return _0x4b7833[_0xa8aa('0x19')](_0xac928d);}return _0x4b7833[_0xa8aa('0x1a')](_0xac928d)[_0xa8aa('0x1b')]();};}function respondWithResult(_0x10fdb4,_0x940f36){_0x940f36=_0x940f36||0xc8;return function(_0x5d8e77){if(_0x5d8e77){return _0x10fdb4[_0xa8aa('0x1a')](_0x940f36)['json'](_0x5d8e77);}};}function respondWithFilteredResult(_0x405c6d,_0x501537){return function(_0x30c448){if(_0x30c448){var _0x10b6d8=typeof _0x501537[_0xa8aa('0x1c')]===_0xa8aa('0x1d')&&typeof _0x501537[_0xa8aa('0x1e')]===_0xa8aa('0x1d');var _0x39f24a=_0x30c448[_0xa8aa('0x1f')];var _0x48bc4b=_0x10b6d8?0x0:_0x501537[_0xa8aa('0x1c')];var _0x5dab72=_0x10b6d8?_0x30c448[_0xa8aa('0x1f')]:_0x501537['offset']+_0x501537[_0xa8aa('0x1e')];var _0xa999be;if(_0x5dab72>=_0x39f24a){_0x5dab72=_0x39f24a;_0xa999be=0xc8;}else{_0xa999be=0xce;}_0x405c6d[_0xa8aa('0x1a')](_0xa999be);return _0x405c6d[_0xa8aa('0x20')](_0xa8aa('0x21'),_0x48bc4b+'-'+_0x5dab72+'/'+_0x39f24a)[_0xa8aa('0x22')](_0x30c448);}return null;};}function patchUpdates(_0x59dfa8){return function(_0x1d4353){try{jsonpatch['apply'](_0x1d4353,_0x59dfa8,!![]);}catch(_0x221bb4){return BPromise[_0xa8aa('0x23')](_0x221bb4);}return _0x1d4353['save']();};}function saveUpdates(_0x1d9a2a,_0x2c59cb){return function(_0x430866){if(_0x430866){return _0x430866[_0xa8aa('0x24')](_0x1d9a2a)[_0xa8aa('0x25')](function(_0x1812e2){return _0x1812e2;});}return null;};}function removeEntity(_0x2dc351,_0x36c913){return function(_0xa880f7){if(_0xa880f7){return _0xa880f7['destroy']()[_0xa8aa('0x25')](function(){_0x2dc351[_0xa8aa('0x1a')](0xcc)[_0xa8aa('0x1b')]();});}};}function handleEntityNotFound(_0x30eef2,_0x31a190){return function(_0x820e4){if(!_0x820e4){_0x30eef2[_0xa8aa('0x19')](0x194);}return _0x820e4;};}function handleError(_0x43f8bb,_0x23651d){_0x23651d=_0x23651d||0x1f4;return function(_0x4b7394){logger[_0xa8aa('0x26')](_0x4b7394[_0xa8aa('0x27')]);if(_0x4b7394[_0xa8aa('0x28')]){delete _0x4b7394['name'];}_0x43f8bb['status'](_0x23651d)['send'](_0x4b7394);};}exports['index']=function(_0x221196,_0x1b970f){var _0x35f0f4={},_0x3072fe={},_0x545c56={'count':0x0,'rows':[]};var _0x232913=_[_0xa8aa('0x29')](db[_0xa8aa('0x2a')]['rawAttributes'],function(_0x25a9f8){return{'name':_0x25a9f8['fieldName'],'type':_0x25a9f8[_0xa8aa('0x2b')][_0xa8aa('0x2c')]};});_0x3072fe['model']=_[_0xa8aa('0x29')](_0x232913,_0xa8aa('0x28'));_0x3072fe['query']=_[_0xa8aa('0x2d')](_0x221196[_0xa8aa('0x2e')]);_0x3072fe[_0xa8aa('0x2f')]=_[_0xa8aa('0x30')](_0x3072fe[_0xa8aa('0x31')],_0x3072fe[_0xa8aa('0x2e')]);_0x35f0f4[_0xa8aa('0x32')]=_['intersection'](_0x3072fe[_0xa8aa('0x31')],qs[_0xa8aa('0x33')](_0x221196[_0xa8aa('0x2e')][_0xa8aa('0x33')]));_0x35f0f4[_0xa8aa('0x32')]=_0x35f0f4[_0xa8aa('0x32')][_0xa8aa('0x34')]?_0x35f0f4[_0xa8aa('0x32')]:_0x3072fe[_0xa8aa('0x31')];if(!_0x221196[_0xa8aa('0x2e')][_0xa8aa('0x35')]('nolimit')){_0x35f0f4[_0xa8aa('0x1e')]=qs[_0xa8aa('0x1e')](_0x221196[_0xa8aa('0x2e')][_0xa8aa('0x1e')]);_0x35f0f4[_0xa8aa('0x1c')]=qs[_0xa8aa('0x1c')](_0x221196['query']['offset']);}_0x35f0f4[_0xa8aa('0x36')]=qs[_0xa8aa('0x37')](_0x221196[_0xa8aa('0x2e')][_0xa8aa('0x37')]);_0x35f0f4[_0xa8aa('0x38')]=qs[_0xa8aa('0x2f')](_['pick'](_0x221196['query'],_0x3072fe[_0xa8aa('0x2f')]),_0x232913);if(_0x221196['query'][_0xa8aa('0x39')]){_0x35f0f4['where']=_[_0xa8aa('0x3a')](_0x35f0f4[_0xa8aa('0x38')],{'$or':_[_0xa8aa('0x29')](_0x232913,function(_0x345cb2){if(_0x345cb2[_0xa8aa('0x2b')]!==_0xa8aa('0x3b')){var _0x105756={};_0x105756[_0x345cb2['name']]={'$like':'%'+_0x221196[_0xa8aa('0x2e')][_0xa8aa('0x39')]+'%'};return _0x105756;}})});}_0x35f0f4=_[_0xa8aa('0x3a')]({},_0x35f0f4,_0x221196[_0xa8aa('0x3c')]);var _0x5c9da3={'where':_0x35f0f4[_0xa8aa('0x38')]};return db['FreshsalesConfiguration'][_0xa8aa('0x1f')](_0x5c9da3)[_0xa8aa('0x25')](function(_0x39b6b4){_0x545c56[_0xa8aa('0x1f')]=_0x39b6b4;if(_0x221196[_0xa8aa('0x2e')][_0xa8aa('0x3d')]){_0x35f0f4[_0xa8aa('0x3e')]=[{'all':!![]}];}return db[_0xa8aa('0x2a')][_0xa8aa('0x3f')](_0x35f0f4);})[_0xa8aa('0x25')](function(_0xb679c5){_0x545c56[_0xa8aa('0x40')]=_0xb679c5;return _0x545c56;})[_0xa8aa('0x25')](respondWithFilteredResult(_0x1b970f,_0x35f0f4))['catch'](handleError(_0x1b970f,null));};exports[_0xa8aa('0x41')]=function(_0x496803,_0x173f6f){var _0x30a1b9={'raw':![],'where':{'id':_0x496803[_0xa8aa('0x42')]['id']}},_0x501082={};_0x501082[_0xa8aa('0x31')]=_[_0xa8aa('0x2d')](db[_0xa8aa('0x2a')][_0xa8aa('0x43')]);_0x501082[_0xa8aa('0x2e')]=_[_0xa8aa('0x2d')](_0x496803['query']);_0x501082[_0xa8aa('0x2f')]=_[_0xa8aa('0x30')](_0x501082[_0xa8aa('0x31')],_0x501082['query']);_0x30a1b9[_0xa8aa('0x32')]=_[_0xa8aa('0x30')](_0x501082[_0xa8aa('0x31')],qs[_0xa8aa('0x33')](_0x496803['query'][_0xa8aa('0x33')]));_0x30a1b9['attributes']=_0x30a1b9[_0xa8aa('0x32')][_0xa8aa('0x34')]?_0x30a1b9[_0xa8aa('0x32')]:_0x501082[_0xa8aa('0x31')];if(_0x496803['query']['includeAll']){_0x30a1b9['include']=[{'all':!![]}];}_0x30a1b9=_[_0xa8aa('0x3a')]({},_0x30a1b9,_0x496803[_0xa8aa('0x3c')]);return db[_0xa8aa('0x2a')][_0xa8aa('0x44')](_0x30a1b9)[_0xa8aa('0x25')](handleEntityNotFound(_0x173f6f,null))['then'](respondWithResult(_0x173f6f,null))[_0xa8aa('0x45')](handleError(_0x173f6f,null));};exports['create']=function(_0x433e04,_0x64b2c4){return db[_0xa8aa('0x2a')]['create'](_0x433e04[_0xa8aa('0x46')],{})[_0xa8aa('0x25')](respondWithResult(_0x64b2c4,0xc9))[_0xa8aa('0x45')](handleError(_0x64b2c4,null));};exports[_0xa8aa('0x24')]=function(_0x193508,_0x33a2b9){if(_0x193508[_0xa8aa('0x46')]['id']){delete _0x193508['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x193508['params']['id']}})[_0xa8aa('0x25')](handleEntityNotFound(_0x33a2b9,null))[_0xa8aa('0x25')](saveUpdates(_0x193508['body'],null))[_0xa8aa('0x25')](respondWithResult(_0x33a2b9,null))[_0xa8aa('0x45')](handleError(_0x33a2b9,null));};exports[_0xa8aa('0x47')]=function(_0x1afe6d,_0x295357){return db[_0xa8aa('0x2a')][_0xa8aa('0x44')]({'where':{'id':_0x1afe6d[_0xa8aa('0x42')]['id']}})[_0xa8aa('0x25')](handleEntityNotFound(_0x295357,null))[_0xa8aa('0x25')](removeEntity(_0x295357,null))[_0xa8aa('0x45')](handleError(_0x295357,null));};exports[_0xa8aa('0x48')]=function(_0x3d8fd8,_0x23ab31,_0x1e43d6){var _0x494e19={};var _0x4e6c91={};var _0x14cd7f;var _0x4a7111;return db[_0xa8aa('0x2a')][_0xa8aa('0x49')]({'where':{'id':_0x3d8fd8['params']['id']}})[_0xa8aa('0x25')](handleEntityNotFound(_0x23ab31,null))[_0xa8aa('0x25')](function(_0x59496d){if(_0x59496d){_0x14cd7f=_0x59496d;_0x4e6c91[_0xa8aa('0x31')]=_[_0xa8aa('0x2d')](db[_0xa8aa('0x4a')]['rawAttributes']);_0x4e6c91[_0xa8aa('0x2e')]=_[_0xa8aa('0x2d')](_0x3d8fd8['query']);_0x4e6c91[_0xa8aa('0x2f')]=_[_0xa8aa('0x30')](_0x4e6c91['model'],_0x4e6c91[_0xa8aa('0x2e')]);_0x494e19[_0xa8aa('0x32')]=_[_0xa8aa('0x30')](_0x4e6c91[_0xa8aa('0x31')],qs[_0xa8aa('0x33')](_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x33')]));_0x494e19[_0xa8aa('0x32')]=_0x494e19['attributes'][_0xa8aa('0x34')]?_0x494e19[_0xa8aa('0x32')]:_0x4e6c91[_0xa8aa('0x31')];_0x494e19[_0xa8aa('0x36')]=qs['sort'](_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x37')]);_0x494e19[_0xa8aa('0x38')]=qs['filters'](_[_0xa8aa('0x4b')](_0x3d8fd8[_0xa8aa('0x2e')],_0x4e6c91[_0xa8aa('0x2f')]));if(_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x39')]){_0x494e19['where']=_[_0xa8aa('0x3a')](_0x494e19[_0xa8aa('0x38')],{'$or':_[_0xa8aa('0x29')](_0x494e19[_0xa8aa('0x32')],function(_0x4a3ac6){var _0x142474={};_0x142474[_0x4a3ac6]={'$like':'%'+_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x39')]+'%'};return _0x142474;})});}_0x494e19=_[_0xa8aa('0x3a')]({},_0x494e19,_0x3d8fd8[_0xa8aa('0x3c')]);return _0x14cd7f[_0xa8aa('0x48')](_0x494e19);}})[_0xa8aa('0x25')](function(_0x437a9d){if(_0x437a9d){_0x4a7111=_0x437a9d['length'];if(!_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x35')]('nolimit')){_0x494e19[_0xa8aa('0x1e')]=qs[_0xa8aa('0x1e')](_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x1e')]);_0x494e19[_0xa8aa('0x1c')]=qs['offset'](_0x3d8fd8[_0xa8aa('0x2e')][_0xa8aa('0x1c')]);}return _0x14cd7f[_0xa8aa('0x48')](_0x494e19);}})[_0xa8aa('0x25')](function(_0x136845){if(_0x136845){return _0x136845?{'count':_0x4a7111,'rows':_0x136845}:null;}})['then'](respondWithResult(_0x23ab31,null))['catch'](handleError(_0x23ab31,null));};exports[_0xa8aa('0x4c')]=function(_0xfa002e,_0x125bd9,_0x9eb1a8){var _0x1147dd={};var _0x51e517={};var _0x13c9b4;var _0x87d9e4;return db[_0xa8aa('0x2a')][_0xa8aa('0x49')]({'where':{'id':_0xfa002e[_0xa8aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x125bd9,null))['then'](function(_0x30490c){if(_0x30490c){_0x13c9b4=_0x30490c;_0x51e517[_0xa8aa('0x31')]=_['keys'](db[_0xa8aa('0x4a')][_0xa8aa('0x43')]);_0x51e517[_0xa8aa('0x2e')]=_[_0xa8aa('0x2d')](_0xfa002e[_0xa8aa('0x2e')]);_0x51e517[_0xa8aa('0x2f')]=_[_0xa8aa('0x30')](_0x51e517[_0xa8aa('0x31')],_0x51e517[_0xa8aa('0x2e')]);_0x1147dd['attributes']=_[_0xa8aa('0x30')](_0x51e517[_0xa8aa('0x31')],qs['fields'](_0xfa002e['query'][_0xa8aa('0x33')]));_0x1147dd[_0xa8aa('0x32')]=_0x1147dd['attributes'][_0xa8aa('0x34')]?_0x1147dd['attributes']:_0x51e517['model'];_0x1147dd['order']=qs[_0xa8aa('0x37')](_0xfa002e[_0xa8aa('0x2e')]['sort']);_0x1147dd[_0xa8aa('0x38')]=qs[_0xa8aa('0x2f')](_[_0xa8aa('0x4b')](_0xfa002e['query'],_0x51e517[_0xa8aa('0x2f')]));if(_0xfa002e[_0xa8aa('0x2e')][_0xa8aa('0x39')]){_0x1147dd['where']=_[_0xa8aa('0x3a')](_0x1147dd['where'],{'$or':_[_0xa8aa('0x29')](_0x1147dd[_0xa8aa('0x32')],function(_0x4b57d6){var _0x22f61d={};_0x22f61d[_0x4b57d6]={'$like':'%'+_0xfa002e[_0xa8aa('0x2e')][_0xa8aa('0x39')]+'%'};return _0x22f61d;})});}_0x1147dd=_['merge']({},_0x1147dd,_0xfa002e['options']);return _0x13c9b4[_0xa8aa('0x4c')](_0x1147dd);}})[_0xa8aa('0x25')](function(_0x6b85bb){if(_0x6b85bb){_0x87d9e4=_0x6b85bb[_0xa8aa('0x34')];if(!_0xfa002e[_0xa8aa('0x2e')][_0xa8aa('0x35')](_0xa8aa('0x4d'))){_0x1147dd[_0xa8aa('0x1e')]=qs['limit'](_0xfa002e[_0xa8aa('0x2e')][_0xa8aa('0x1e')]);_0x1147dd[_0xa8aa('0x1c')]=qs['offset'](_0xfa002e[_0xa8aa('0x2e')][_0xa8aa('0x1c')]);}return _0x13c9b4['getDescriptions'](_0x1147dd);}})[_0xa8aa('0x25')](function(_0x3d9c8b){if(_0x3d9c8b){return _0x3d9c8b?{'count':_0x87d9e4,'rows':_0x3d9c8b}:null;}})[_0xa8aa('0x25')](respondWithResult(_0x125bd9,null))['catch'](handleError(_0x125bd9,null));};exports[_0xa8aa('0x4e')]=function(_0x580391,_0x5187f1,_0x2e7887){var _0x195d73={};var _0x28c1d2={};var _0x64cf65;var _0x324b3e;return db['FreshsalesConfiguration'][_0xa8aa('0x49')]({'where':{'id':_0x580391['params']['id']}})[_0xa8aa('0x25')](handleEntityNotFound(_0x5187f1,null))[_0xa8aa('0x25')](function(_0x47f7d9){if(_0x47f7d9){_0x64cf65=_0x47f7d9;_0x28c1d2[_0xa8aa('0x31')]=_[_0xa8aa('0x2d')](db[_0xa8aa('0x4a')]['rawAttributes']);_0x28c1d2['query']=_[_0xa8aa('0x2d')](_0x580391[_0xa8aa('0x2e')]);_0x28c1d2['filters']=_['intersection'](_0x28c1d2[_0xa8aa('0x31')],_0x28c1d2[_0xa8aa('0x2e')]);_0x195d73['attributes']=_[_0xa8aa('0x30')](_0x28c1d2[_0xa8aa('0x31')],qs[_0xa8aa('0x33')](_0x580391[_0xa8aa('0x2e')][_0xa8aa('0x33')]));_0x195d73[_0xa8aa('0x32')]=_0x195d73[_0xa8aa('0x32')][_0xa8aa('0x34')]?_0x195d73[_0xa8aa('0x32')]:_0x28c1d2[_0xa8aa('0x31')];_0x195d73[_0xa8aa('0x36')]=qs[_0xa8aa('0x37')](_0x580391[_0xa8aa('0x2e')][_0xa8aa('0x37')]);_0x195d73['where']=qs['filters'](_['pick'](_0x580391[_0xa8aa('0x2e')],_0x28c1d2[_0xa8aa('0x2f')]));if(_0x580391[_0xa8aa('0x2e')][_0xa8aa('0x39')]){_0x195d73[_0xa8aa('0x38')]=_[_0xa8aa('0x3a')](_0x195d73[_0xa8aa('0x38')],{'$or':_['map'](_0x195d73[_0xa8aa('0x32')],function(_0x4af9fd){var _0x220801={};_0x220801[_0x4af9fd]={'$like':'%'+_0x580391['query']['filter']+'%'};return _0x220801;})});}_0x195d73=_[_0xa8aa('0x3a')]({},_0x195d73,_0x580391[_0xa8aa('0x3c')]);return _0x64cf65[_0xa8aa('0x4e')](_0x195d73);}})[_0xa8aa('0x25')](function(_0x39c7b9){if(_0x39c7b9){_0x324b3e=_0x39c7b9[_0xa8aa('0x34')];if(!_0x580391[_0xa8aa('0x2e')]['hasOwnProperty'](_0xa8aa('0x4d'))){_0x195d73[_0xa8aa('0x1e')]=qs['limit'](_0x580391['query'][_0xa8aa('0x1e')]);_0x195d73[_0xa8aa('0x1c')]=qs[_0xa8aa('0x1c')](_0x580391[_0xa8aa('0x2e')][_0xa8aa('0x1c')]);}return _0x64cf65[_0xa8aa('0x4e')](_0x195d73);}})['then'](function(_0x408ec2){if(_0x408ec2){return _0x408ec2?{'count':_0x324b3e,'rows':_0x408ec2}:null;}})['then'](respondWithResult(_0x5187f1,null))[_0xa8aa('0x45')](handleError(_0x5187f1,null));};
\ No newline at end of file
+var _0x1320=['hasOwnProperty','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','pick'];(function(_0x43621c,_0x26aa2a){var _0x4e19db=function(_0x59ae3b){while(--_0x59ae3b){_0x43621c['push'](_0x43621c['shift']());}};_0x4e19db(++_0x26aa2a);}(_0x1320,0x197));var _0x0132=function(_0x310c0a,_0x4ec103){_0x310c0a=_0x310c0a-0x0;var _0x599109=_0x1320[_0x310c0a];return _0x599109;};'use strict';var emlformat=require(_0x0132('0x0'));var rimraf=require(_0x0132('0x1'));var zipdir=require(_0x0132('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0132('0x3'));var moment=require(_0x0132('0x4'));var BPromise=require(_0x0132('0x5'));var Mustache=require(_0x0132('0x6'));var util=require('util');var path=require(_0x0132('0x7'));var sox=require(_0x0132('0x8'));var csv=require('to-csv');var ejs=require(_0x0132('0x9'));var fs=require('fs');var fs_extra=require(_0x0132('0xa'));var _=require(_0x0132('0xb'));var squel=require('squel');var crypto=require(_0x0132('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0132('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0132('0xe'));var Redis=require(_0x0132('0xf'));var authService=require(_0x0132('0x10'));var qs=require(_0x0132('0x11'));var as=require(_0x0132('0x12'));var hardwareService=require(_0x0132('0x13'));var logger=require(_0x0132('0x14'))(_0x0132('0x15'));var utils=require(_0x0132('0x16'));var config=require(_0x0132('0x17'));var licenseUtil=require(_0x0132('0x18'));var db=require(_0x0132('0x19'))['db'];function respondWithStatusCode(_0x4086fb,_0x3a5882){_0x3a5882=_0x3a5882||0xcc;return function(_0x1ebebf){if(_0x1ebebf){return _0x4086fb[_0x0132('0x1a')](_0x3a5882);}return _0x4086fb['status'](_0x3a5882)[_0x0132('0x1b')]();};}function respondWithResult(_0xd24d86,_0x4cd09f){_0x4cd09f=_0x4cd09f||0xc8;return function(_0x4deeaf){if(_0x4deeaf){return _0xd24d86[_0x0132('0x1c')](_0x4cd09f)[_0x0132('0x1d')](_0x4deeaf);}};}function respondWithFilteredResult(_0xeedec,_0x43bd12){return function(_0x16b29e){if(_0x16b29e){var _0x38129b=typeof _0x43bd12[_0x0132('0x1e')]===_0x0132('0x1f')&&typeof _0x43bd12[_0x0132('0x20')]===_0x0132('0x1f');var _0x5d5a52=_0x16b29e[_0x0132('0x21')];var _0x5a947f=_0x38129b?0x0:_0x43bd12['offset'];var _0x451174=_0x38129b?_0x16b29e[_0x0132('0x21')]:_0x43bd12['offset']+_0x43bd12['limit'];var _0x25a7a5;if(_0x451174>=_0x5d5a52){_0x451174=_0x5d5a52;_0x25a7a5=0xc8;}else{_0x25a7a5=0xce;}_0xeedec[_0x0132('0x1c')](_0x25a7a5);return _0xeedec[_0x0132('0x22')](_0x0132('0x23'),_0x5a947f+'-'+_0x451174+'/'+_0x5d5a52)[_0x0132('0x1d')](_0x16b29e);}return null;};}function patchUpdates(_0x5a88ad){return function(_0x1e48e1){try{jsonpatch[_0x0132('0x24')](_0x1e48e1,_0x5a88ad,!![]);}catch(_0x1e84d9){return BPromise['reject'](_0x1e84d9);}return _0x1e48e1[_0x0132('0x25')]();};}function saveUpdates(_0x2cb2d7,_0xaef5b4){return function(_0x4afa97){if(_0x4afa97){return _0x4afa97['update'](_0x2cb2d7)[_0x0132('0x26')](function(_0x1d2ba8){return _0x1d2ba8;});}return null;};}function removeEntity(_0x2924c5,_0x3f50dc){return function(_0x3443e7){if(_0x3443e7){return _0x3443e7[_0x0132('0x27')]()[_0x0132('0x26')](function(){_0x2924c5['status'](0xcc)[_0x0132('0x1b')]();});}};}function handleEntityNotFound(_0x38f29e,_0x508c72){return function(_0x290fa5){if(!_0x290fa5){_0x38f29e[_0x0132('0x1a')](0x194);}return _0x290fa5;};}function handleError(_0x5f346c,_0x8028b6){_0x8028b6=_0x8028b6||0x1f4;return function(_0x215abb){logger[_0x0132('0x28')](_0x215abb[_0x0132('0x29')]);if(_0x215abb[_0x0132('0x2a')]){delete _0x215abb['name'];}_0x5f346c[_0x0132('0x1c')](_0x8028b6)['send'](_0x215abb);};}exports['index']=function(_0x293fd3,_0x2111b8){var _0x1abfe7={},_0x1e6039={},_0x5a4259={'count':0x0,'rows':[]};var _0x4febc6=_[_0x0132('0x2b')](db[_0x0132('0x2c')][_0x0132('0x2d')],function(_0x53bec8){return{'name':_0x53bec8[_0x0132('0x2e')],'type':_0x53bec8[_0x0132('0x2f')][_0x0132('0x30')]};});_0x1e6039[_0x0132('0x31')]=_[_0x0132('0x2b')](_0x4febc6,_0x0132('0x2a'));_0x1e6039[_0x0132('0x32')]=_[_0x0132('0x33')](_0x293fd3[_0x0132('0x32')]);_0x1e6039['filters']=_[_0x0132('0x34')](_0x1e6039[_0x0132('0x31')],_0x1e6039['query']);_0x1abfe7[_0x0132('0x35')]=_[_0x0132('0x34')](_0x1e6039[_0x0132('0x31')],qs[_0x0132('0x36')](_0x293fd3[_0x0132('0x32')]['fields']));_0x1abfe7[_0x0132('0x35')]=_0x1abfe7[_0x0132('0x35')][_0x0132('0x37')]?_0x1abfe7[_0x0132('0x35')]:_0x1e6039[_0x0132('0x31')];if(!_0x293fd3['query']['hasOwnProperty'](_0x0132('0x38'))){_0x1abfe7[_0x0132('0x20')]=qs[_0x0132('0x20')](_0x293fd3[_0x0132('0x32')]['limit']);_0x1abfe7[_0x0132('0x1e')]=qs[_0x0132('0x1e')](_0x293fd3[_0x0132('0x32')][_0x0132('0x1e')]);}_0x1abfe7[_0x0132('0x39')]=qs[_0x0132('0x3a')](_0x293fd3[_0x0132('0x32')][_0x0132('0x3a')]);_0x1abfe7[_0x0132('0x3b')]=qs[_0x0132('0x3c')](_['pick'](_0x293fd3[_0x0132('0x32')],_0x1e6039[_0x0132('0x3c')]),_0x4febc6);if(_0x293fd3[_0x0132('0x32')]['filter']){_0x1abfe7[_0x0132('0x3b')]=_[_0x0132('0x3d')](_0x1abfe7[_0x0132('0x3b')],{'$or':_['map'](_0x4febc6,function(_0x579aab){if(_0x579aab[_0x0132('0x2f')]!==_0x0132('0x3e')){var _0x357cb0={};_0x357cb0[_0x579aab[_0x0132('0x2a')]]={'$like':'%'+_0x293fd3[_0x0132('0x32')][_0x0132('0x3f')]+'%'};return _0x357cb0;}})});}_0x1abfe7=_[_0x0132('0x3d')]({},_0x1abfe7,_0x293fd3[_0x0132('0x40')]);var _0x157de7={'where':_0x1abfe7['where']};return db[_0x0132('0x2c')][_0x0132('0x21')](_0x157de7)[_0x0132('0x26')](function(_0x409df6){_0x5a4259['count']=_0x409df6;if(_0x293fd3[_0x0132('0x32')][_0x0132('0x41')]){_0x1abfe7[_0x0132('0x42')]=[{'all':!![]}];}return db[_0x0132('0x2c')]['findAll'](_0x1abfe7);})[_0x0132('0x26')](function(_0x528c19){_0x5a4259[_0x0132('0x43')]=_0x528c19;return _0x5a4259;})['then'](respondWithFilteredResult(_0x2111b8,_0x1abfe7))[_0x0132('0x44')](handleError(_0x2111b8,null));};exports[_0x0132('0x45')]=function(_0x133948,_0x13286c){var _0x85f8a4={'raw':![],'where':{'id':_0x133948[_0x0132('0x46')]['id']}},_0xece5e9={};_0xece5e9[_0x0132('0x31')]=_['keys'](db[_0x0132('0x2c')][_0x0132('0x2d')]);_0xece5e9[_0x0132('0x32')]=_[_0x0132('0x33')](_0x133948['query']);_0xece5e9[_0x0132('0x3c')]=_[_0x0132('0x34')](_0xece5e9[_0x0132('0x31')],_0xece5e9[_0x0132('0x32')]);_0x85f8a4['attributes']=_[_0x0132('0x34')](_0xece5e9['model'],qs['fields'](_0x133948[_0x0132('0x32')]['fields']));_0x85f8a4[_0x0132('0x35')]=_0x85f8a4[_0x0132('0x35')]['length']?_0x85f8a4[_0x0132('0x35')]:_0xece5e9[_0x0132('0x31')];if(_0x133948[_0x0132('0x32')][_0x0132('0x41')]){_0x85f8a4[_0x0132('0x42')]=[{'all':!![]}];}_0x85f8a4=_['merge']({},_0x85f8a4,_0x133948[_0x0132('0x40')]);return db[_0x0132('0x2c')]['find'](_0x85f8a4)[_0x0132('0x26')](handleEntityNotFound(_0x13286c,null))['then'](respondWithResult(_0x13286c,null))[_0x0132('0x44')](handleError(_0x13286c,null));};exports[_0x0132('0x47')]=function(_0x248d76,_0x310a82){return db[_0x0132('0x2c')][_0x0132('0x47')](_0x248d76[_0x0132('0x48')],{})[_0x0132('0x26')](respondWithResult(_0x310a82,0xc9))[_0x0132('0x44')](handleError(_0x310a82,null));};exports['update']=function(_0x1dcf44,_0x97607e){if(_0x1dcf44[_0x0132('0x48')]['id']){delete _0x1dcf44[_0x0132('0x48')]['id'];}return db[_0x0132('0x2c')][_0x0132('0x49')]({'where':{'id':_0x1dcf44[_0x0132('0x46')]['id']}})['then'](handleEntityNotFound(_0x97607e,null))[_0x0132('0x26')](saveUpdates(_0x1dcf44['body'],null))[_0x0132('0x26')](respondWithResult(_0x97607e,null))[_0x0132('0x44')](handleError(_0x97607e,null));};exports['destroy']=function(_0x4dfa3d,_0x13a28a){return db[_0x0132('0x2c')][_0x0132('0x49')]({'where':{'id':_0x4dfa3d['params']['id']}})[_0x0132('0x26')](handleEntityNotFound(_0x13a28a,null))[_0x0132('0x26')](removeEntity(_0x13a28a,null))[_0x0132('0x44')](handleError(_0x13a28a,null));};exports[_0x0132('0x4a')]=function(_0x192f6e,_0x4c2eb7,_0x2ef7bf){var _0x673ee8={};var _0x1f72f1={};var _0x56e512;var _0x345817;return db[_0x0132('0x2c')][_0x0132('0x4b')]({'where':{'id':_0x192f6e[_0x0132('0x46')]['id']}})[_0x0132('0x26')](handleEntityNotFound(_0x4c2eb7,null))['then'](function(_0x1da293){if(_0x1da293){_0x56e512=_0x1da293;_0x1f72f1[_0x0132('0x31')]=_['keys'](db[_0x0132('0x4c')]['rawAttributes']);_0x1f72f1[_0x0132('0x32')]=_[_0x0132('0x33')](_0x192f6e[_0x0132('0x32')]);_0x1f72f1[_0x0132('0x3c')]=_[_0x0132('0x34')](_0x1f72f1['model'],_0x1f72f1[_0x0132('0x32')]);_0x673ee8[_0x0132('0x35')]=_[_0x0132('0x34')](_0x1f72f1['model'],qs[_0x0132('0x36')](_0x192f6e[_0x0132('0x32')][_0x0132('0x36')]));_0x673ee8[_0x0132('0x35')]=_0x673ee8[_0x0132('0x35')][_0x0132('0x37')]?_0x673ee8[_0x0132('0x35')]:_0x1f72f1['model'];_0x673ee8[_0x0132('0x39')]=qs['sort'](_0x192f6e['query'][_0x0132('0x3a')]);_0x673ee8[_0x0132('0x3b')]=qs[_0x0132('0x3c')](_['pick'](_0x192f6e['query'],_0x1f72f1['filters']));if(_0x192f6e[_0x0132('0x32')][_0x0132('0x3f')]){_0x673ee8[_0x0132('0x3b')]=_['merge'](_0x673ee8[_0x0132('0x3b')],{'$or':_['map'](_0x673ee8[_0x0132('0x35')],function(_0x1e0759){var _0x10febb={};_0x10febb[_0x1e0759]={'$like':'%'+_0x192f6e[_0x0132('0x32')][_0x0132('0x3f')]+'%'};return _0x10febb;})});}_0x673ee8=_[_0x0132('0x3d')]({},_0x673ee8,_0x192f6e['options']);return _0x56e512['getSubjects'](_0x673ee8);}})[_0x0132('0x26')](function(_0x5ed1a9){if(_0x5ed1a9){_0x345817=_0x5ed1a9[_0x0132('0x37')];if(!_0x192f6e[_0x0132('0x32')]['hasOwnProperty'](_0x0132('0x38'))){_0x673ee8[_0x0132('0x20')]=qs['limit'](_0x192f6e[_0x0132('0x32')][_0x0132('0x20')]);_0x673ee8[_0x0132('0x1e')]=qs[_0x0132('0x1e')](_0x192f6e[_0x0132('0x32')][_0x0132('0x1e')]);}return _0x56e512[_0x0132('0x4a')](_0x673ee8);}})[_0x0132('0x26')](function(_0x560f49){if(_0x560f49){return _0x560f49?{'count':_0x345817,'rows':_0x560f49}:null;}})['then'](respondWithResult(_0x4c2eb7,null))[_0x0132('0x44')](handleError(_0x4c2eb7,null));};exports[_0x0132('0x4d')]=function(_0x41ef11,_0x120e13,_0x42dfe0){var _0x74d7d6={};var _0x49781f={};var _0x2c1684;var _0x269928;return db[_0x0132('0x2c')][_0x0132('0x4b')]({'where':{'id':_0x41ef11[_0x0132('0x46')]['id']}})[_0x0132('0x26')](handleEntityNotFound(_0x120e13,null))['then'](function(_0x35b5d2){if(_0x35b5d2){_0x2c1684=_0x35b5d2;_0x49781f[_0x0132('0x31')]=_[_0x0132('0x33')](db[_0x0132('0x4c')][_0x0132('0x2d')]);_0x49781f[_0x0132('0x32')]=_[_0x0132('0x33')](_0x41ef11[_0x0132('0x32')]);_0x49781f[_0x0132('0x3c')]=_['intersection'](_0x49781f[_0x0132('0x31')],_0x49781f[_0x0132('0x32')]);_0x74d7d6[_0x0132('0x35')]=_['intersection'](_0x49781f[_0x0132('0x31')],qs['fields'](_0x41ef11[_0x0132('0x32')][_0x0132('0x36')]));_0x74d7d6[_0x0132('0x35')]=_0x74d7d6[_0x0132('0x35')]['length']?_0x74d7d6[_0x0132('0x35')]:_0x49781f[_0x0132('0x31')];_0x74d7d6[_0x0132('0x39')]=qs['sort'](_0x41ef11[_0x0132('0x32')][_0x0132('0x3a')]);_0x74d7d6[_0x0132('0x3b')]=qs['filters'](_[_0x0132('0x4e')](_0x41ef11[_0x0132('0x32')],_0x49781f[_0x0132('0x3c')]));if(_0x41ef11[_0x0132('0x32')]['filter']){_0x74d7d6['where']=_[_0x0132('0x3d')](_0x74d7d6[_0x0132('0x3b')],{'$or':_['map'](_0x74d7d6[_0x0132('0x35')],function(_0x3e4deb){var _0x4ebbda={};_0x4ebbda[_0x3e4deb]={'$like':'%'+_0x41ef11[_0x0132('0x32')][_0x0132('0x3f')]+'%'};return _0x4ebbda;})});}_0x74d7d6=_[_0x0132('0x3d')]({},_0x74d7d6,_0x41ef11[_0x0132('0x40')]);return _0x2c1684[_0x0132('0x4d')](_0x74d7d6);}})[_0x0132('0x26')](function(_0x4d3af5){if(_0x4d3af5){_0x269928=_0x4d3af5[_0x0132('0x37')];if(!_0x41ef11[_0x0132('0x32')][_0x0132('0x4f')]('nolimit')){_0x74d7d6[_0x0132('0x20')]=qs[_0x0132('0x20')](_0x41ef11['query']['limit']);_0x74d7d6[_0x0132('0x1e')]=qs[_0x0132('0x1e')](_0x41ef11['query'][_0x0132('0x1e')]);}return _0x2c1684[_0x0132('0x4d')](_0x74d7d6);}})[_0x0132('0x26')](function(_0x4896fd){if(_0x4896fd){return _0x4896fd?{'count':_0x269928,'rows':_0x4896fd}:null;}})['then'](respondWithResult(_0x120e13,null))['catch'](handleError(_0x120e13,null));};exports[_0x0132('0x50')]=function(_0x4c0129,_0x309998,_0x4e8723){var _0x196828={};var _0x5a8777={};var _0x525ad2;var _0x2b22ea;return db[_0x0132('0x2c')][_0x0132('0x4b')]({'where':{'id':_0x4c0129[_0x0132('0x46')]['id']}})[_0x0132('0x26')](handleEntityNotFound(_0x309998,null))['then'](function(_0x52cdfb){if(_0x52cdfb){_0x525ad2=_0x52cdfb;_0x5a8777['model']=_[_0x0132('0x33')](db[_0x0132('0x4c')]['rawAttributes']);_0x5a8777['query']=_[_0x0132('0x33')](_0x4c0129[_0x0132('0x32')]);_0x5a8777[_0x0132('0x3c')]=_[_0x0132('0x34')](_0x5a8777[_0x0132('0x31')],_0x5a8777[_0x0132('0x32')]);_0x196828[_0x0132('0x35')]=_[_0x0132('0x34')](_0x5a8777[_0x0132('0x31')],qs['fields'](_0x4c0129[_0x0132('0x32')]['fields']));_0x196828[_0x0132('0x35')]=_0x196828['attributes']['length']?_0x196828[_0x0132('0x35')]:_0x5a8777[_0x0132('0x31')];_0x196828[_0x0132('0x39')]=qs[_0x0132('0x3a')](_0x4c0129['query'][_0x0132('0x3a')]);_0x196828['where']=qs['filters'](_[_0x0132('0x4e')](_0x4c0129['query'],_0x5a8777[_0x0132('0x3c')]));if(_0x4c0129['query'][_0x0132('0x3f')]){_0x196828[_0x0132('0x3b')]=_[_0x0132('0x3d')](_0x196828[_0x0132('0x3b')],{'$or':_['map'](_0x196828[_0x0132('0x35')],function(_0x433abd){var _0x29fc63={};_0x29fc63[_0x433abd]={'$like':'%'+_0x4c0129['query'][_0x0132('0x3f')]+'%'};return _0x29fc63;})});}_0x196828=_['merge']({},_0x196828,_0x4c0129[_0x0132('0x40')]);return _0x525ad2['getFields'](_0x196828);}})[_0x0132('0x26')](function(_0x2ae1b1){if(_0x2ae1b1){_0x2b22ea=_0x2ae1b1[_0x0132('0x37')];if(!_0x4c0129[_0x0132('0x32')][_0x0132('0x4f')](_0x0132('0x38'))){_0x196828['limit']=qs['limit'](_0x4c0129[_0x0132('0x32')][_0x0132('0x20')]);_0x196828[_0x0132('0x1e')]=qs['offset'](_0x4c0129[_0x0132('0x32')][_0x0132('0x1e')]);}return _0x525ad2[_0x0132('0x50')](_0x196828);}})['then'](function(_0x49fd1b){if(_0x49fd1b){return _0x49fd1b?{'count':_0x2b22ea,'rows':_0x49fd1b}:null;}})[_0x0132('0x26')](respondWithResult(_0x309998,null))[_0x0132('0x44')](handleError(_0x309998,null));};
\ No newline at end of file
index 3b8a7e7..feac87b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4193=['util','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x10cf5d,_0x396a02){var _0x5b9d4b=function(_0x5dd2e2){while(--_0x5dd2e2){_0x10cf5d['push'](_0x10cf5d['shift']());}};_0x5b9d4b(++_0x396a02);}(_0x4193,0x1eb));var _0x3419=function(_0x29a9b9,_0x56c047){_0x29a9b9=_0x29a9b9-0x0;var _0x3c9a52=_0x4193[_0x29a9b9];return _0x3c9a52;};'use strict';var _=require(_0x3419('0x0'));var util=require(_0x3419('0x1'));var logger=require('../../config/logger')(_0x3419('0x2'));var moment=require('moment');var BPromise=require(_0x3419('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3419('0x4'));var rimraf=require(_0x3419('0x5'));var config=require(_0x3419('0x6'));var attributes=require(_0x3419('0x7'));module[_0x3419('0x8')]=function(_0x171224,_0x3989ef){return _0x171224[_0x3419('0x9')](_0x3419('0xa'),attributes,{'tableName':_0x3419('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe85a=['bluebird','request-promise','path','rimraf','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x5803d6,_0x5e61a8){var _0x78d51e=function(_0x4cfa02){while(--_0x4cfa02){_0x5803d6['push'](_0x5803d6['shift']());}};_0x78d51e(++_0x5e61a8);}(_0xe85a,0xcc));var _0xae85=function(_0x56798b,_0x425822){_0x56798b=_0x56798b-0x0;var _0x2d218b=_0xe85a[_0x56798b];return _0x2d218b;};'use strict';var _=require(_0xae85('0x0'));var util=require(_0xae85('0x1'));var logger=require(_0xae85('0x2'))(_0xae85('0x3'));var moment=require(_0xae85('0x4'));var BPromise=require(_0xae85('0x5'));var rp=require(_0xae85('0x6'));var fs=require('fs');var path=require(_0xae85('0x7'));var rimraf=require(_0xae85('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0xf64140,_0x437269){return _0xf64140[_0xae85('0x9')](_0xae85('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ce9a0ea..be30972 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe31=['../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x218633,_0x14cb74){var _0x3ab068=function(_0x5fc544){while(--_0x5fc544){_0x218633['push'](_0x218633['shift']());}};_0x3ab068(++_0x14cb74);}(_0xbe31,0x120));var _0x1be3=function(_0x2e9df5,_0x435984){_0x2e9df5=_0x2e9df5-0x0;var _0x224611=_0xbe31[_0x2e9df5];return _0x224611;};'use strict';var _=require('lodash');var util=require(_0x1be3('0x0'));var moment=require('moment');var BPromise=require(_0x1be3('0x1'));var rs=require(_0x1be3('0x2'));var fs=require('fs');var Redis=require(_0x1be3('0x3'));var db=require(_0x1be3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1be3('0x5'));var config=require(_0x1be3('0x6'));var jayson=require(_0x1be3('0x7'));var client=jayson[_0x1be3('0x8')][_0x1be3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eef18,_0x13c808,_0x5d4626){return new BPromise(function(_0x54add3,_0x11c197){return client['request'](_0x3eef18,_0x5d4626)[_0x1be3('0xa')](function(_0x328e5e){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x13c808,_0x1be3('0xb'));logger[_0x1be3('0xc')](_0x1be3('0xd'),_0x13c808,_0x1be3('0xb'),JSON[_0x1be3('0xe')](_0x328e5e));if(_0x328e5e[_0x1be3('0xf')]){if(_0x328e5e[_0x1be3('0xf')][_0x1be3('0x10')]===0x1f4){logger[_0x1be3('0xf')](_0x1be3('0x11'),_0x13c808,_0x328e5e[_0x1be3('0xf')]['message']);return _0x11c197(_0x328e5e[_0x1be3('0xf')][_0x1be3('0x12')]);}logger[_0x1be3('0xf')](_0x1be3('0x11'),_0x13c808,_0x328e5e[_0x1be3('0xf')][_0x1be3('0x12')]);return _0x54add3(_0x328e5e['error'][_0x1be3('0x12')]);}else{logger[_0x1be3('0x13')](_0x1be3('0x11'),_0x13c808,_0x1be3('0xb'));_0x54add3(_0x328e5e[_0x1be3('0x14')]['message']);}})['catch'](function(_0x554fe9){logger[_0x1be3('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x13c808,_0x554fe9);_0x11c197(_0x554fe9);});});}
\ No newline at end of file
+var _0x8cd8=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x8cd8,0x1de));var _0x88cd=function(_0x52a235,_0x313190){_0x52a235=_0x52a235-0x0;var _0x339e12=_0x8cd8[_0x52a235];return _0x339e12;};'use strict';var _=require(_0x88cd('0x0'));var util=require(_0x88cd('0x1'));var moment=require(_0x88cd('0x2'));var BPromise=require(_0x88cd('0x3'));var rs=require(_0x88cd('0x4'));var fs=require('fs');var Redis=require(_0x88cd('0x5'));var db=require(_0x88cd('0x6'))['db'];var utils=require(_0x88cd('0x7'));var logger=require(_0x88cd('0x8'))(_0x88cd('0x9'));var config=require('../../config/environment');var jayson=require(_0x88cd('0xa'));var client=jayson[_0x88cd('0xb')][_0x88cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44ac92,_0x192719,_0x3ec799){return new BPromise(function(_0x13c484,_0x4a5da2){return client[_0x88cd('0xd')](_0x44ac92,_0x3ec799)[_0x88cd('0xe')](function(_0x372066){logger[_0x88cd('0xf')](_0x88cd('0x10'),_0x192719,_0x88cd('0x11'));logger[_0x88cd('0x12')](_0x88cd('0x13'),_0x192719,_0x88cd('0x11'),JSON[_0x88cd('0x14')](_0x372066));if(_0x372066[_0x88cd('0x15')]){if(_0x372066[_0x88cd('0x15')][_0x88cd('0x16')]===0x1f4){logger[_0x88cd('0x15')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x192719,_0x372066[_0x88cd('0x15')]['message']);return _0x4a5da2(_0x372066[_0x88cd('0x15')]['message']);}logger[_0x88cd('0x15')](_0x88cd('0x10'),_0x192719,_0x372066['error'][_0x88cd('0x17')]);return _0x13c484(_0x372066['error']['message']);}else{logger['info'](_0x88cd('0x10'),_0x192719,_0x88cd('0x11'));_0x13c484(_0x372066['result']['message']);}})[_0x88cd('0x18')](function(_0x2dcb78){logger['error'](_0x88cd('0x10'),_0x192719,_0x2dcb78);_0x4a5da2(_0x2dcb78);});});}
\ No newline at end of file
index 3af90c5..29945aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x44d4=['exports','multer','express','Router','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x44d4,0x161));var _0x444d=function(_0x296174,_0x3e82a1){_0x296174=_0x296174-0x0;var _0x16ae68=_0x44d4[_0x296174];return _0x16ae68;};'use strict';var multer=require(_0x444d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x444d('0x1'));var router=express[_0x444d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x444d('0x3'));var controller=require(_0x444d('0x4'));router[_0x444d('0x5')]('/',auth[_0x444d('0x6')](),controller[_0x444d('0x7')]);router[_0x444d('0x5')](_0x444d('0x8'),auth['isAuthenticated'](),controller[_0x444d('0x9')]);router['post']('/',auth[_0x444d('0x6')](),controller[_0x444d('0xa')]);router[_0x444d('0xb')](_0x444d('0x8'),auth[_0x444d('0x6')](),controller[_0x444d('0xc')]);router[_0x444d('0xd')](_0x444d('0x8'),auth[_0x444d('0x6')](),controller[_0x444d('0xe')]);module[_0x444d('0xf')]=router;
\ No newline at end of file
+var _0x4b8a=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x30d2af,_0x378716){var _0x2d1c42=function(_0x90e629){while(--_0x90e629){_0x30d2af['push'](_0x30d2af['shift']());}};_0x2d1c42(++_0x378716);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4b8a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xa4b8('0x0'));var path=require('path');var timeout=require(_0xa4b8('0x1'));var express=require(_0xa4b8('0x2'));var router=express[_0xa4b8('0x3')]();var fs_extra=require(_0xa4b8('0x4'));var auth=require(_0xa4b8('0x5'));var interaction=require(_0xa4b8('0x6'));var config=require(_0xa4b8('0x7'));var controller=require(_0xa4b8('0x8'));router[_0xa4b8('0x9')]('/',auth[_0xa4b8('0xa')](),controller[_0xa4b8('0xb')]);router[_0xa4b8('0x9')](_0xa4b8('0xc'),auth[_0xa4b8('0xa')](),controller['show']);router[_0xa4b8('0xd')]('/',auth[_0xa4b8('0xa')](),controller[_0xa4b8('0xe')]);router[_0xa4b8('0xf')](_0xa4b8('0xc'),auth[_0xa4b8('0xa')](),controller[_0xa4b8('0x10')]);router[_0xa4b8('0x11')](_0xa4b8('0xc'),auth[_0xa4b8('0xa')](),controller[_0xa4b8('0x12')]);module[_0xa4b8('0x13')]=router;
\ No newline at end of file
index 49ba827..c204020 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c34=['picklist','STRING','ENUM','string','BOOLEAN','sequelize','exports','customVariable','keyValue'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1c34,0x1c7));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x41c3('0x0'));module[_0x41c3('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x41c3('0x2'),_0x41c3('0x3'),_0x41c3('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x41c3('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x41c3('0x6')](_0x41c3('0x7'),'variable',_0x41c3('0x2'))},'keyContent':{'type':Sequelize[_0x41c3('0x5')]},'idField':{'type':Sequelize[_0x41c3('0x5')]},'nameField':{'type':Sequelize[_0x41c3('0x5')]},'customField':{'type':Sequelize[_0x41c3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41c3('0x5')]}};
\ No newline at end of file
+var _0xbe96=['ENUM','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5e03f6,_0x41ad00){var _0x2ae1c5=function(_0x592244){while(--_0x592244){_0x5e03f6['push'](_0x5e03f6['shift']());}};_0x2ae1c5(++_0x41ad00);}(_0xbe96,0x129));var _0x6be9=function(_0x33331f,_0x4f7736){_0x33331f=_0x33331f-0x0;var _0x372927=_0xbe96[_0x33331f];return _0x372927;};'use strict';var Sequelize=require(_0x6be9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6be9('0x1'),_0x6be9('0x2'),_0x6be9('0x3'),_0x6be9('0x4'),_0x6be9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6be9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6be9('0x7')](_0x6be9('0x1'),_0x6be9('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x6be9('0x6')]},'idField':{'type':Sequelize[_0x6be9('0x6')]},'nameField':{'type':Sequelize[_0x6be9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6be9('0x6')]}};
\ No newline at end of file
index 7f3869a..4302491 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45c8=['catch','show','params','options','find','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','FreshsalesField','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','rows'];(function(_0x2ee5f6,_0x3fb1ad){var _0x35c100=function(_0x2f2f12){while(--_0x2f2f12){_0x2ee5f6['push'](_0x2ee5f6['shift']());}};_0x35c100(++_0x3fb1ad);}(_0x45c8,0x179));var _0x845c=function(_0x365b23,_0x5c59b0){_0x365b23=_0x365b23-0x0;var _0x9b4dc2=_0x45c8[_0x365b23];return _0x9b4dc2;};'use strict';var emlformat=require(_0x845c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x845c('0x1'));var moment=require(_0x845c('0x2'));var BPromise=require(_0x845c('0x3'));var Mustache=require(_0x845c('0x4'));var util=require(_0x845c('0x5'));var path=require(_0x845c('0x6'));var sox=require(_0x845c('0x7'));var csv=require(_0x845c('0x8'));var ejs=require(_0x845c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x845c('0xa'));var squel=require('squel');var crypto=require(_0x845c('0xb'));var jsforce=require(_0x845c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x845c('0x8'));var querystring=require(_0x845c('0xd'));var Papa=require(_0x845c('0xe'));var Redis=require('ioredis');var authService=require(_0x845c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x845c('0x10'));var hardwareService=require(_0x845c('0x11'));var logger=require(_0x845c('0x12'))(_0x845c('0x13'));var utils=require(_0x845c('0x14'));var config=require(_0x845c('0x15'));var licenseUtil=require(_0x845c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bc6c9,_0x52c86c){_0x52c86c=_0x52c86c||0xcc;return function(_0x3e6106){if(_0x3e6106){return _0x3bc6c9[_0x845c('0x17')](_0x52c86c);}return _0x3bc6c9[_0x845c('0x18')](_0x52c86c)[_0x845c('0x19')]();};}function respondWithResult(_0x210cd5,_0x13506a){_0x13506a=_0x13506a||0xc8;return function(_0x1d8ce0){if(_0x1d8ce0){return _0x210cd5[_0x845c('0x18')](_0x13506a)[_0x845c('0x1a')](_0x1d8ce0);}};}function respondWithFilteredResult(_0xeb82d3,_0x533917){return function(_0x1ba0c4){if(_0x1ba0c4){var _0x2ca518=typeof _0x533917[_0x845c('0x1b')]===_0x845c('0x1c')&&typeof _0x533917[_0x845c('0x1d')]==='undefined';var _0x4b7d04=_0x1ba0c4[_0x845c('0x1e')];var _0x4388cc=_0x2ca518?0x0:_0x533917[_0x845c('0x1b')];var _0x1bcbab=_0x2ca518?_0x1ba0c4[_0x845c('0x1e')]:_0x533917[_0x845c('0x1b')]+_0x533917[_0x845c('0x1d')];var _0x283e24;if(_0x1bcbab>=_0x4b7d04){_0x1bcbab=_0x4b7d04;_0x283e24=0xc8;}else{_0x283e24=0xce;}_0xeb82d3[_0x845c('0x18')](_0x283e24);return _0xeb82d3[_0x845c('0x1f')](_0x845c('0x20'),_0x4388cc+'-'+_0x1bcbab+'/'+_0x4b7d04)[_0x845c('0x1a')](_0x1ba0c4);}return null;};}function patchUpdates(_0x5358e2){return function(_0x1cbb31){try{jsonpatch[_0x845c('0x21')](_0x1cbb31,_0x5358e2,!![]);}catch(_0x59e93d){return BPromise[_0x845c('0x22')](_0x59e93d);}return _0x1cbb31['save']();};}function saveUpdates(_0x3b4793,_0x27fb6d){return function(_0xc62c6a){if(_0xc62c6a){return _0xc62c6a['update'](_0x3b4793)['then'](function(_0x39845f){return _0x39845f;});}return null;};}function removeEntity(_0x5a835b,_0x2ea697){return function(_0x45f523){if(_0x45f523){return _0x45f523[_0x845c('0x23')]()['then'](function(){_0x5a835b['status'](0xcc)[_0x845c('0x19')]();});}};}function handleEntityNotFound(_0x43c9dd,_0x1197c2){return function(_0x1aa4cd){if(!_0x1aa4cd){_0x43c9dd[_0x845c('0x17')](0x194);}return _0x1aa4cd;};}function handleError(_0x287a04,_0xc2a7d){_0xc2a7d=_0xc2a7d||0x1f4;return function(_0x1bed58){logger[_0x845c('0x24')](_0x1bed58[_0x845c('0x25')]);if(_0x1bed58[_0x845c('0x26')]){delete _0x1bed58[_0x845c('0x26')];}_0x287a04[_0x845c('0x18')](_0xc2a7d)[_0x845c('0x27')](_0x1bed58);};}exports[_0x845c('0x28')]=function(_0x399ee9,_0x19e1f4){var _0x5af9a6={},_0x493813={},_0x388e70={'count':0x0,'rows':[]};var _0x845438=_['map'](db[_0x845c('0x29')][_0x845c('0x2a')],function(_0x3db476){return{'name':_0x3db476['fieldName'],'type':_0x3db476[_0x845c('0x2b')][_0x845c('0x2c')]};});_0x493813[_0x845c('0x2d')]=_[_0x845c('0x2e')](_0x845438,'name');_0x493813[_0x845c('0x2f')]=_[_0x845c('0x30')](_0x399ee9[_0x845c('0x2f')]);_0x493813[_0x845c('0x31')]=_['intersection'](_0x493813[_0x845c('0x2d')],_0x493813[_0x845c('0x2f')]);_0x5af9a6[_0x845c('0x32')]=_[_0x845c('0x33')](_0x493813[_0x845c('0x2d')],qs[_0x845c('0x34')](_0x399ee9['query']['fields']));_0x5af9a6[_0x845c('0x32')]=_0x5af9a6['attributes'][_0x845c('0x35')]?_0x5af9a6[_0x845c('0x32')]:_0x493813[_0x845c('0x2d')];if(!_0x399ee9['query'][_0x845c('0x36')](_0x845c('0x37'))){_0x5af9a6[_0x845c('0x1d')]=qs[_0x845c('0x1d')](_0x399ee9[_0x845c('0x2f')][_0x845c('0x1d')]);_0x5af9a6['offset']=qs[_0x845c('0x1b')](_0x399ee9[_0x845c('0x2f')]['offset']);}_0x5af9a6[_0x845c('0x38')]=qs[_0x845c('0x39')](_0x399ee9[_0x845c('0x2f')]['sort']);_0x5af9a6[_0x845c('0x3a')]=qs[_0x845c('0x31')](_[_0x845c('0x3b')](_0x399ee9['query'],_0x493813[_0x845c('0x31')]),_0x845438);if(_0x399ee9[_0x845c('0x2f')][_0x845c('0x3c')]){_0x5af9a6[_0x845c('0x3a')]=_[_0x845c('0x3d')](_0x5af9a6[_0x845c('0x3a')],{'$or':_['map'](_0x845438,function(_0x428e60){if(_0x428e60['type']!==_0x845c('0x3e')){var _0x1caf41={};_0x1caf41[_0x428e60[_0x845c('0x26')]]={'$like':'%'+_0x399ee9[_0x845c('0x2f')][_0x845c('0x3c')]+'%'};return _0x1caf41;}})});}_0x5af9a6=_[_0x845c('0x3d')]({},_0x5af9a6,_0x399ee9['options']);var _0x31cc77={'where':_0x5af9a6[_0x845c('0x3a')]};return db[_0x845c('0x29')][_0x845c('0x1e')](_0x31cc77)[_0x845c('0x3f')](function(_0xca0b3c){_0x388e70[_0x845c('0x1e')]=_0xca0b3c;if(_0x399ee9[_0x845c('0x2f')][_0x845c('0x40')]){_0x5af9a6[_0x845c('0x41')]=[{'all':!![]}];}return db[_0x845c('0x29')]['findAll'](_0x5af9a6);})[_0x845c('0x3f')](function(_0x1a00e5){_0x388e70[_0x845c('0x42')]=_0x1a00e5;return _0x388e70;})['then'](respondWithFilteredResult(_0x19e1f4,_0x5af9a6))[_0x845c('0x43')](handleError(_0x19e1f4,null));};exports[_0x845c('0x44')]=function(_0xf9b8c8,_0x4623f5){var _0x4606e8={'raw':!![],'where':{'id':_0xf9b8c8[_0x845c('0x45')]['id']}},_0x24bed4={};_0x24bed4['model']=_[_0x845c('0x30')](db[_0x845c('0x29')][_0x845c('0x2a')]);_0x24bed4[_0x845c('0x2f')]=_['keys'](_0xf9b8c8[_0x845c('0x2f')]);_0x24bed4[_0x845c('0x31')]=_[_0x845c('0x33')](_0x24bed4['model'],_0x24bed4['query']);_0x4606e8[_0x845c('0x32')]=_['intersection'](_0x24bed4['model'],qs[_0x845c('0x34')](_0xf9b8c8[_0x845c('0x2f')][_0x845c('0x34')]));_0x4606e8[_0x845c('0x32')]=_0x4606e8['attributes'][_0x845c('0x35')]?_0x4606e8[_0x845c('0x32')]:_0x24bed4[_0x845c('0x2d')];if(_0xf9b8c8['query'][_0x845c('0x40')]){_0x4606e8[_0x845c('0x41')]=[{'all':!![]}];}_0x4606e8=_[_0x845c('0x3d')]({},_0x4606e8,_0xf9b8c8[_0x845c('0x46')]);return db[_0x845c('0x29')][_0x845c('0x47')](_0x4606e8)[_0x845c('0x3f')](handleEntityNotFound(_0x4623f5,null))[_0x845c('0x3f')](respondWithResult(_0x4623f5,null))[_0x845c('0x43')](handleError(_0x4623f5,null));};exports[_0x845c('0x48')]=function(_0x274ed8,_0x3bdc25){return db[_0x845c('0x29')][_0x845c('0x48')](_0x274ed8[_0x845c('0x49')],{})[_0x845c('0x3f')](respondWithResult(_0x3bdc25,0xc9))[_0x845c('0x43')](handleError(_0x3bdc25,null));};exports['update']=function(_0x52a5f4,_0x37dbc8){if(_0x52a5f4[_0x845c('0x49')]['id']){delete _0x52a5f4[_0x845c('0x49')]['id'];}return db['FreshsalesField'][_0x845c('0x47')]({'where':{'id':_0x52a5f4[_0x845c('0x45')]['id']}})['then'](handleEntityNotFound(_0x37dbc8,null))[_0x845c('0x3f')](saveUpdates(_0x52a5f4[_0x845c('0x49')],null))[_0x845c('0x3f')](respondWithResult(_0x37dbc8,null))[_0x845c('0x43')](handleError(_0x37dbc8,null));};exports[_0x845c('0x23')]=function(_0x3cbaaf,_0x47d57e){return db[_0x845c('0x29')]['find']({'where':{'id':_0x3cbaaf[_0x845c('0x45')]['id']}})[_0x845c('0x3f')](handleEntityNotFound(_0x47d57e,null))[_0x845c('0x3f')](removeEntity(_0x47d57e,null))['catch'](handleError(_0x47d57e,null));};
\ No newline at end of file
+var _0xfa93=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','catch','show','includeAll','options','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x5ade1d,_0x5a6f9e){var _0x52d1e7=function(_0x3af973){while(--_0x3af973){_0x5ade1d['push'](_0x5ade1d['shift']());}};_0x52d1e7(++_0x5a6f9e);}(_0xfa93,0xd4));var _0x3fa9=function(_0xe42a96,_0x610517){_0xe42a96=_0xe42a96-0x0;var _0x1e3e54=_0xfa93[_0xe42a96];return _0x1e3e54;};'use strict';var emlformat=require(_0x3fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fa9('0x1'));var jsonpatch=require(_0x3fa9('0x2'));var rp=require(_0x3fa9('0x3'));var moment=require(_0x3fa9('0x4'));var BPromise=require(_0x3fa9('0x5'));var Mustache=require(_0x3fa9('0x6'));var util=require(_0x3fa9('0x7'));var path=require(_0x3fa9('0x8'));var sox=require(_0x3fa9('0x9'));var csv=require(_0x3fa9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fa9('0xb'));var squel=require(_0x3fa9('0xc'));var crypto=require(_0x3fa9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3fa9('0xe'));var toCsv=require(_0x3fa9('0xa'));var querystring=require(_0x3fa9('0xf'));var Papa=require(_0x3fa9('0x10'));var Redis=require('ioredis');var authService=require(_0x3fa9('0x11'));var qs=require(_0x3fa9('0x12'));var as=require(_0x3fa9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fa9('0x14'))('api');var utils=require(_0x3fa9('0x15'));var config=require(_0x3fa9('0x16'));var licenseUtil=require(_0x3fa9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499ab9,_0x1a028e){_0x1a028e=_0x1a028e||0xcc;return function(_0x211283){if(_0x211283){return _0x499ab9[_0x3fa9('0x18')](_0x1a028e);}return _0x499ab9[_0x3fa9('0x19')](_0x1a028e)['end']();};}function respondWithResult(_0x2a8f61,_0x8ced29){_0x8ced29=_0x8ced29||0xc8;return function(_0x297a56){if(_0x297a56){return _0x2a8f61[_0x3fa9('0x19')](_0x8ced29)[_0x3fa9('0x1a')](_0x297a56);}};}function respondWithFilteredResult(_0x56e897,_0x2e47ee){return function(_0x3efdeb){if(_0x3efdeb){var _0x4e78a6=typeof _0x2e47ee[_0x3fa9('0x1b')]===_0x3fa9('0x1c')&&typeof _0x2e47ee['limit']===_0x3fa9('0x1c');var _0x1b3f72=_0x3efdeb['count'];var _0x3a393c=_0x4e78a6?0x0:_0x2e47ee['offset'];var _0x53b92c=_0x4e78a6?_0x3efdeb['count']:_0x2e47ee[_0x3fa9('0x1b')]+_0x2e47ee[_0x3fa9('0x1d')];var _0x16afb0;if(_0x53b92c>=_0x1b3f72){_0x53b92c=_0x1b3f72;_0x16afb0=0xc8;}else{_0x16afb0=0xce;}_0x56e897[_0x3fa9('0x19')](_0x16afb0);return _0x56e897[_0x3fa9('0x1e')](_0x3fa9('0x1f'),_0x3a393c+'-'+_0x53b92c+'/'+_0x1b3f72)[_0x3fa9('0x1a')](_0x3efdeb);}return null;};}function patchUpdates(_0x259226){return function(_0x3e92b2){try{jsonpatch['apply'](_0x3e92b2,_0x259226,!![]);}catch(_0x36a58b){return BPromise[_0x3fa9('0x20')](_0x36a58b);}return _0x3e92b2['save']();};}function saveUpdates(_0xa71876,_0x2ac558){return function(_0x683ad1){if(_0x683ad1){return _0x683ad1['update'](_0xa71876)[_0x3fa9('0x21')](function(_0x2c5156){return _0x2c5156;});}return null;};}function removeEntity(_0x11f414,_0x43593f){return function(_0x549d3d){if(_0x549d3d){return _0x549d3d[_0x3fa9('0x22')]()[_0x3fa9('0x21')](function(){_0x11f414[_0x3fa9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27cdf8,_0x53ed20){return function(_0xa93082){if(!_0xa93082){_0x27cdf8[_0x3fa9('0x18')](0x194);}return _0xa93082;};}function handleError(_0x1aaab9,_0x44cb4c){_0x44cb4c=_0x44cb4c||0x1f4;return function(_0x4758b4){logger[_0x3fa9('0x23')](_0x4758b4[_0x3fa9('0x24')]);if(_0x4758b4['name']){delete _0x4758b4[_0x3fa9('0x25')];}_0x1aaab9['status'](_0x44cb4c)[_0x3fa9('0x26')](_0x4758b4);};}exports[_0x3fa9('0x27')]=function(_0x1cfb72,_0x167d9c){var _0xea06b3={},_0x3baa36={},_0x473763={'count':0x0,'rows':[]};var _0x47f7a2=_[_0x3fa9('0x28')](db[_0x3fa9('0x29')][_0x3fa9('0x2a')],function(_0x10abe4){return{'name':_0x10abe4[_0x3fa9('0x2b')],'type':_0x10abe4[_0x3fa9('0x2c')][_0x3fa9('0x2d')]};});_0x3baa36['model']=_[_0x3fa9('0x28')](_0x47f7a2,_0x3fa9('0x25'));_0x3baa36[_0x3fa9('0x2e')]=_[_0x3fa9('0x2f')](_0x1cfb72['query']);_0x3baa36[_0x3fa9('0x30')]=_[_0x3fa9('0x31')](_0x3baa36[_0x3fa9('0x32')],_0x3baa36[_0x3fa9('0x2e')]);_0xea06b3[_0x3fa9('0x33')]=_[_0x3fa9('0x31')](_0x3baa36[_0x3fa9('0x32')],qs[_0x3fa9('0x34')](_0x1cfb72[_0x3fa9('0x2e')][_0x3fa9('0x34')]));_0xea06b3[_0x3fa9('0x33')]=_0xea06b3[_0x3fa9('0x33')]['length']?_0xea06b3[_0x3fa9('0x33')]:_0x3baa36[_0x3fa9('0x32')];if(!_0x1cfb72[_0x3fa9('0x2e')]['hasOwnProperty']('nolimit')){_0xea06b3['limit']=qs[_0x3fa9('0x1d')](_0x1cfb72[_0x3fa9('0x2e')][_0x3fa9('0x1d')]);_0xea06b3[_0x3fa9('0x1b')]=qs[_0x3fa9('0x1b')](_0x1cfb72[_0x3fa9('0x2e')][_0x3fa9('0x1b')]);}_0xea06b3[_0x3fa9('0x35')]=qs[_0x3fa9('0x36')](_0x1cfb72[_0x3fa9('0x2e')][_0x3fa9('0x36')]);_0xea06b3[_0x3fa9('0x37')]=qs[_0x3fa9('0x30')](_[_0x3fa9('0x38')](_0x1cfb72[_0x3fa9('0x2e')],_0x3baa36[_0x3fa9('0x30')]),_0x47f7a2);if(_0x1cfb72[_0x3fa9('0x2e')][_0x3fa9('0x39')]){_0xea06b3[_0x3fa9('0x37')]=_[_0x3fa9('0x3a')](_0xea06b3[_0x3fa9('0x37')],{'$or':_[_0x3fa9('0x28')](_0x47f7a2,function(_0x6b01b0){if(_0x6b01b0[_0x3fa9('0x2c')]!==_0x3fa9('0x3b')){var _0x4a9d6b={};_0x4a9d6b[_0x6b01b0[_0x3fa9('0x25')]]={'$like':'%'+_0x1cfb72[_0x3fa9('0x2e')][_0x3fa9('0x39')]+'%'};return _0x4a9d6b;}})});}_0xea06b3=_['merge']({},_0xea06b3,_0x1cfb72['options']);var _0x501b0d={'where':_0xea06b3['where']};return db[_0x3fa9('0x29')][_0x3fa9('0x3c')](_0x501b0d)[_0x3fa9('0x21')](function(_0x4c139a){_0x473763[_0x3fa9('0x3c')]=_0x4c139a;if(_0x1cfb72[_0x3fa9('0x2e')]['includeAll']){_0xea06b3[_0x3fa9('0x3d')]=[{'all':!![]}];}return db[_0x3fa9('0x29')][_0x3fa9('0x3e')](_0xea06b3);})[_0x3fa9('0x21')](function(_0xf9be23){_0x473763['rows']=_0xf9be23;return _0x473763;})[_0x3fa9('0x21')](respondWithFilteredResult(_0x167d9c,_0xea06b3))[_0x3fa9('0x3f')](handleError(_0x167d9c,null));};exports[_0x3fa9('0x40')]=function(_0x29ec3f,_0x163b3f){var _0x247fca={'raw':!![],'where':{'id':_0x29ec3f['params']['id']}},_0x27b98b={};_0x27b98b[_0x3fa9('0x32')]=_[_0x3fa9('0x2f')](db[_0x3fa9('0x29')][_0x3fa9('0x2a')]);_0x27b98b[_0x3fa9('0x2e')]=_[_0x3fa9('0x2f')](_0x29ec3f[_0x3fa9('0x2e')]);_0x27b98b['filters']=_[_0x3fa9('0x31')](_0x27b98b[_0x3fa9('0x32')],_0x27b98b[_0x3fa9('0x2e')]);_0x247fca[_0x3fa9('0x33')]=_[_0x3fa9('0x31')](_0x27b98b['model'],qs[_0x3fa9('0x34')](_0x29ec3f[_0x3fa9('0x2e')][_0x3fa9('0x34')]));_0x247fca[_0x3fa9('0x33')]=_0x247fca[_0x3fa9('0x33')]['length']?_0x247fca['attributes']:_0x27b98b['model'];if(_0x29ec3f['query'][_0x3fa9('0x41')]){_0x247fca[_0x3fa9('0x3d')]=[{'all':!![]}];}_0x247fca=_[_0x3fa9('0x3a')]({},_0x247fca,_0x29ec3f[_0x3fa9('0x42')]);return db[_0x3fa9('0x29')][_0x3fa9('0x43')](_0x247fca)[_0x3fa9('0x21')](handleEntityNotFound(_0x163b3f,null))[_0x3fa9('0x21')](respondWithResult(_0x163b3f,null))[_0x3fa9('0x3f')](handleError(_0x163b3f,null));};exports[_0x3fa9('0x44')]=function(_0x3b7ddf,_0x593858){return db[_0x3fa9('0x29')][_0x3fa9('0x44')](_0x3b7ddf[_0x3fa9('0x45')],{})['then'](respondWithResult(_0x593858,0xc9))[_0x3fa9('0x3f')](handleError(_0x593858,null));};exports[_0x3fa9('0x46')]=function(_0xf2c22b,_0x3cccf4){if(_0xf2c22b[_0x3fa9('0x45')]['id']){delete _0xf2c22b['body']['id'];}return db[_0x3fa9('0x29')][_0x3fa9('0x43')]({'where':{'id':_0xf2c22b[_0x3fa9('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cccf4,null))[_0x3fa9('0x21')](saveUpdates(_0xf2c22b['body'],null))[_0x3fa9('0x21')](respondWithResult(_0x3cccf4,null))[_0x3fa9('0x3f')](handleError(_0x3cccf4,null));};exports[_0x3fa9('0x22')]=function(_0x166497,_0x34c849){return db[_0x3fa9('0x29')][_0x3fa9('0x43')]({'where':{'id':_0x166497[_0x3fa9('0x47')]['id']}})['then'](handleEntityNotFound(_0x34c849,null))[_0x3fa9('0x21')](removeEntity(_0x34c849,null))['catch'](handleError(_0x34c849,null));};
\ No newline at end of file
index fdac3bc..6590deb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdc2=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intFreshsalesField.attributes'];(function(_0x461ab0,_0x4e88ce){var _0x23227a=function(_0x2d31b8){while(--_0x2d31b8){_0x461ab0['push'](_0x461ab0['shift']());}};_0x23227a(++_0x4e88ce);}(_0xbdc2,0x148));var _0x2bdc=function(_0x584e52,_0x5443dc){_0x584e52=_0x584e52-0x0;var _0x5cf710=_0xbdc2[_0x584e52];return _0x5cf710;};'use strict';var _=require(_0x2bdc('0x0'));var util=require(_0x2bdc('0x1'));var logger=require(_0x2bdc('0x2'))(_0x2bdc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2bdc('0x4'));var fs=require('fs');var path=require(_0x2bdc('0x5'));var rimraf=require('rimraf');var config=require(_0x2bdc('0x6'));var attributes=require(_0x2bdc('0x7'));module['exports']=function(_0x1a4381,_0x4bf5cd){return _0x1a4381[_0x2bdc('0x8')](_0x2bdc('0x9'),attributes,{'tableName':_0x2bdc('0xa'),'paranoid':![],'indexes':[{'name':_0x2bdc('0xb'),'fields':[_0x2bdc('0xc'),_0x2bdc('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xbf13=['../../config/logger','api','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util'];(function(_0x9564af,_0x577e06){var _0x15dfad=function(_0x2413a8){while(--_0x2413a8){_0x9564af['push'](_0x9564af['shift']());}};_0x15dfad(++_0x577e06);}(_0xbf13,0xe2));var _0x3bf1=function(_0x22500e,_0x550954){_0x22500e=_0x22500e-0x0;var _0x3452e3=_0xbf13[_0x22500e];return _0x3452e3;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var logger=require(_0x3bf1('0x2'))(_0x3bf1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3bf1('0x4'));var fs=require('fs');var path=require(_0x3bf1('0x5'));var rimraf=require('rimraf');var config=require(_0x3bf1('0x6'));var attributes=require(_0x3bf1('0x7'));module[_0x3bf1('0x8')]=function(_0x227e3a,_0x172690){return _0x227e3a['define']('FreshsalesField',attributes,{'tableName':_0x3bf1('0x9'),'paranoid':![],'indexes':[{'name':_0x3bf1('0xa'),'fields':['idField',_0x3bf1('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 17abb7f..5749af9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x52bc4f,_0xfa72dc){var _0x53e887=function(_0x220e4e){while(--_0x220e4e){_0x52bc4f['push'](_0x52bc4f['shift']());}};_0x53e887(++_0xfa72dc);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}
\ No newline at end of file
+var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x30f3b7,_0x224df1){var _0x249068=function(_0x54609e){while(--_0x54609e){_0x30f3b7['push'](_0x30f3b7['shift']());}};_0x249068(++_0x224df1);}(_0x2a07,0x74));var _0x72a0=function(_0x3ffd40,_0x4c65b8){_0x3ffd40=_0x3ffd40-0x0;var _0x14309d=_0x2a07[_0x3ffd40];return _0x14309d;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});}
\ No newline at end of file
index ce0fd80..ce36a0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x342d35,_0x14e940){var _0x31f19e=function(_0x4c6b04){while(--_0x4c6b04){_0x342d35['push'](_0x342d35['shift']());}};_0x31f19e(++_0x14e940);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router;
\ No newline at end of file
+var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2e3671,_0x27065d){var _0x4f9c39=function(_0x10ae6d){while(--_0x10ae6d){_0x2e3671['push'](_0x2e3671['shift']());}};_0x4f9c39(++_0x27065d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router;
\ No newline at end of file
index ef7e5df..0b42852 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81cb=['sequelize','exports','STRING','newTab','integrationTab'];(function(_0x4ff38c,_0x26601d){var _0x4c6edb=function(_0x16ec39){while(--_0x16ec39){_0x4ff38c['push'](_0x4ff38c['shift']());}};_0x4c6edb(++_0x26601d);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb81c('0x0'));module[_0xb81c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb81c('0x2')]},'username':{'type':Sequelize[_0xb81c('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xb81c('0x2')]},'password':{'type':Sequelize[_0xb81c('0x2')]},'clientId':{'type':Sequelize[_0xb81c('0x2')]},'clientSecret':{'type':Sequelize[_0xb81c('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb81c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xb81c('0x3')),'defaultValue':_0xb81c('0x4')}};
\ No newline at end of file
+var _0x3c6a=['STRING','username','integrationTab','newTab','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x3c6a[_0x26fc81];return _0x9feece;};'use strict';var Sequelize=require('sequelize');module[_0xa3c6('0x0')]={'name':{'type':Sequelize[_0xa3c6('0x1')]},'description':{'type':Sequelize[_0xa3c6('0x1')]},'username':{'type':Sequelize[_0xa3c6('0x1')],'unique':_0xa3c6('0x2')},'remoteUri':{'type':Sequelize[_0xa3c6('0x1')]},'password':{'type':Sequelize[_0xa3c6('0x1')]},'clientId':{'type':Sequelize[_0xa3c6('0x1')]},'clientSecret':{'type':Sequelize[_0xa3c6('0x1')]},'securityToken':{'type':Sequelize[_0xa3c6('0x1')]},'serverUrl':{'type':Sequelize[_0xa3c6('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa3c6('0x3'),_0xa3c6('0x4')),'defaultValue':_0xa3c6('0x3')}};
\ No newline at end of file
index 7c91692..5d5eb68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b1f=['login','username','password','concat','ticketType','sobject','describe','OwnerId','Subject','Description','int','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','False','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','model','keys','find','create','body','findOne','SalesforceConfiguration','getConfigurations','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientSecret','securityToken','slice','substring','lastIndexOf','Connection','clientId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7b1f,0x94));var _0xf7b1=function(_0x2c7854,_0x4b665d){_0x2c7854=_0x2c7854-0x0;var _0x538345=_0x7b1f[_0x2c7854];return _0x538345;};'use strict';var emlformat=require(_0xf7b1('0x0'));var rimraf=require(_0xf7b1('0x1'));var zipdir=require(_0xf7b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7b1('0x3'));var moment=require(_0xf7b1('0x4'));var BPromise=require(_0xf7b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf7b1('0x6'));var sox=require(_0xf7b1('0x7'));var csv=require('to-csv');var ejs=require(_0xf7b1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7b1('0x9'));var squel=require(_0xf7b1('0xa'));var crypto=require('crypto');var jsforce=require(_0xf7b1('0xb'));var deskjs=require(_0xf7b1('0xc'));var toCsv=require(_0xf7b1('0xd'));var querystring=require(_0xf7b1('0xe'));var Papa=require(_0xf7b1('0xf'));var Redis=require('ioredis');var authService=require(_0xf7b1('0x10'));var qs=require(_0xf7b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7b1('0x12'));var logger=require(_0xf7b1('0x13'))(_0xf7b1('0x14'));var utils=require(_0xf7b1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf7b1('0x16'));function respondWithStatusCode(_0x2644ce,_0x558927){_0x558927=_0x558927||0xcc;return function(_0x362b11){if(_0x362b11){return _0x2644ce[_0xf7b1('0x17')](_0x558927);}return _0x2644ce['status'](_0x558927)[_0xf7b1('0x18')]();};}function respondWithResult(_0xe6cc35,_0x5183cf){_0x5183cf=_0x5183cf||0xc8;return function(_0x27c714){if(_0x27c714){return _0xe6cc35[_0xf7b1('0x19')](_0x5183cf)[_0xf7b1('0x1a')](_0x27c714);}};}function respondWithFilteredResult(_0x1f1bc5,_0x51fbd3){return function(_0x1ad781){if(_0x1ad781){var _0x426a53=typeof _0x51fbd3['offset']==='undefined'&&typeof _0x51fbd3[_0xf7b1('0x1b')]==='undefined';var _0x192671=_0x1ad781[_0xf7b1('0x1c')];var _0x2cdfb5=_0x426a53?0x0:_0x51fbd3['offset'];var _0x5a3db4=_0x426a53?_0x1ad781[_0xf7b1('0x1c')]:_0x51fbd3[_0xf7b1('0x1d')]+_0x51fbd3['limit'];var _0x390208;if(_0x5a3db4>=_0x192671){_0x5a3db4=_0x192671;_0x390208=0xc8;}else{_0x390208=0xce;}_0x1f1bc5[_0xf7b1('0x19')](_0x390208);return _0x1f1bc5[_0xf7b1('0x1e')](_0xf7b1('0x1f'),_0x2cdfb5+'-'+_0x5a3db4+'/'+_0x192671)[_0xf7b1('0x1a')](_0x1ad781);}return null;};}function patchUpdates(_0x49ea39){return function(_0x208a53){try{jsonpatch[_0xf7b1('0x20')](_0x208a53,_0x49ea39,!![]);}catch(_0x1c78a9){return BPromise['reject'](_0x1c78a9);}return _0x208a53['save']();};}function saveUpdates(_0x151686,_0x3b1090){return function(_0x2dffc3){if(_0x2dffc3){return _0x2dffc3[_0xf7b1('0x21')](_0x151686)['then'](function(_0x48256d){return _0x48256d;});}return null;};}function removeEntity(_0x8f3d3,_0x5a1361){return function(_0x5a4e85){if(_0x5a4e85){return _0x5a4e85[_0xf7b1('0x22')]()['then'](function(){_0x8f3d3['status'](0xcc)[_0xf7b1('0x18')]();});}};}function handleEntityNotFound(_0x242c06,_0x3a922f){return function(_0x542573){if(!_0x542573){_0x242c06[_0xf7b1('0x17')](0x194);}return _0x542573;};}function handleError(_0x196f38,_0x164ff7){_0x164ff7=_0x164ff7||0x1f4;return function(_0x33bee6){logger[_0xf7b1('0x23')](_0x33bee6[_0xf7b1('0x24')]);if(_0x33bee6[_0xf7b1('0x25')]){delete _0x33bee6[_0xf7b1('0x25')];}_0x196f38[_0xf7b1('0x19')](_0x164ff7)[_0xf7b1('0x26')](_0x33bee6);};}exports[_0xf7b1('0x27')]=function(_0x5c4dd4,_0x486e18){var _0x3ad925={},_0x422aa7={},_0x403926={'count':0x0,'rows':[]};var _0x42afc6=_[_0xf7b1('0x28')](db[_0xf7b1('0x29')][_0xf7b1('0x2a')],function(_0x11d7d3){return{'name':_0x11d7d3[_0xf7b1('0x2b')],'type':_0x11d7d3[_0xf7b1('0x2c')]['key']};});_0x422aa7['model']=_[_0xf7b1('0x28')](_0x42afc6,_0xf7b1('0x25'));_0x422aa7[_0xf7b1('0x2d')]=_['keys'](_0x5c4dd4[_0xf7b1('0x2d')]);_0x422aa7[_0xf7b1('0x2e')]=_[_0xf7b1('0x2f')](_0x422aa7['model'],_0x422aa7[_0xf7b1('0x2d')]);_0x3ad925[_0xf7b1('0x30')]=_[_0xf7b1('0x2f')](_0x422aa7['model'],qs[_0xf7b1('0x31')](_0x5c4dd4[_0xf7b1('0x2d')][_0xf7b1('0x31')]));_0x3ad925['attributes']=_0x3ad925[_0xf7b1('0x30')][_0xf7b1('0x32')]?_0x3ad925[_0xf7b1('0x30')]:_0x422aa7['model'];if(!_0x5c4dd4[_0xf7b1('0x2d')][_0xf7b1('0x33')]('nolimit')){_0x3ad925[_0xf7b1('0x1b')]=qs[_0xf7b1('0x1b')](_0x5c4dd4[_0xf7b1('0x2d')]['limit']);_0x3ad925[_0xf7b1('0x1d')]=qs[_0xf7b1('0x1d')](_0x5c4dd4[_0xf7b1('0x2d')][_0xf7b1('0x1d')]);}_0x3ad925['order']=qs['sort'](_0x5c4dd4[_0xf7b1('0x2d')][_0xf7b1('0x34')]);_0x3ad925[_0xf7b1('0x35')]=qs[_0xf7b1('0x2e')](_[_0xf7b1('0x36')](_0x5c4dd4[_0xf7b1('0x2d')],_0x422aa7[_0xf7b1('0x2e')]),_0x42afc6);if(_0x5c4dd4[_0xf7b1('0x2d')]['filter']){_0x3ad925[_0xf7b1('0x35')]=_[_0xf7b1('0x37')](_0x3ad925['where'],{'$or':_[_0xf7b1('0x28')](_0x42afc6,function(_0x257a99){if(_0x257a99[_0xf7b1('0x2c')]!==_0xf7b1('0x38')){var _0x698131={};_0x698131[_0x257a99['name']]={'$like':'%'+_0x5c4dd4[_0xf7b1('0x2d')][_0xf7b1('0x39')]+'%'};return _0x698131;}})});}_0x3ad925=_['merge']({},_0x3ad925,_0x5c4dd4[_0xf7b1('0x3a')]);var _0xb9702e={'where':_0x3ad925[_0xf7b1('0x35')]};return db[_0xf7b1('0x29')]['count'](_0xb9702e)[_0xf7b1('0x3b')](function(_0x5cb2f0){_0x403926[_0xf7b1('0x1c')]=_0x5cb2f0;if(_0x5c4dd4['query'][_0xf7b1('0x3c')]){_0x3ad925[_0xf7b1('0x3d')]=[{'all':!![]}];}return db[_0xf7b1('0x29')][_0xf7b1('0x3e')](_0x3ad925);})[_0xf7b1('0x3b')](function(_0x2c281d){_0x403926[_0xf7b1('0x3f')]=_0x2c281d;return _0x403926;})['then'](respondWithFilteredResult(_0x486e18,_0x3ad925))[_0xf7b1('0x40')](handleError(_0x486e18,null));};exports[_0xf7b1('0x41')]=function(_0x4a4763,_0x55fd07){var _0x38f162={'raw':![],'where':{'id':_0x4a4763[_0xf7b1('0x42')]['id']}},_0x457505={};_0x457505[_0xf7b1('0x43')]=_[_0xf7b1('0x44')](db[_0xf7b1('0x29')][_0xf7b1('0x2a')]);_0x457505['query']=_['keys'](_0x4a4763['query']);_0x457505['filters']=_[_0xf7b1('0x2f')](_0x457505[_0xf7b1('0x43')],_0x457505[_0xf7b1('0x2d')]);_0x38f162[_0xf7b1('0x30')]=_[_0xf7b1('0x2f')](_0x457505[_0xf7b1('0x43')],qs[_0xf7b1('0x31')](_0x4a4763[_0xf7b1('0x2d')][_0xf7b1('0x31')]));_0x38f162['attributes']=_0x38f162[_0xf7b1('0x30')]['length']?_0x38f162[_0xf7b1('0x30')]:_0x457505[_0xf7b1('0x43')];if(_0x4a4763[_0xf7b1('0x2d')][_0xf7b1('0x3c')]){_0x38f162[_0xf7b1('0x3d')]=[{'all':!![]}];}_0x38f162=_['merge']({},_0x38f162,_0x4a4763[_0xf7b1('0x3a')]);return db['SalesforceAccount'][_0xf7b1('0x45')](_0x38f162)[_0xf7b1('0x3b')](handleEntityNotFound(_0x55fd07,null))['then'](respondWithResult(_0x55fd07,null))[_0xf7b1('0x40')](handleError(_0x55fd07,null));};exports['create']=function(_0x5c2ddb,_0x1f7c1d){return db[_0xf7b1('0x29')][_0xf7b1('0x46')](_0x5c2ddb[_0xf7b1('0x47')],{})[_0xf7b1('0x3b')](respondWithResult(_0x1f7c1d,0xc9))[_0xf7b1('0x40')](handleError(_0x1f7c1d,null));};exports[_0xf7b1('0x21')]=function(_0x194d19,_0x5d804c){if(_0x194d19[_0xf7b1('0x47')]['id']){delete _0x194d19[_0xf7b1('0x47')]['id'];}return db[_0xf7b1('0x29')][_0xf7b1('0x45')]({'where':{'id':_0x194d19[_0xf7b1('0x42')]['id']}})[_0xf7b1('0x3b')](handleEntityNotFound(_0x5d804c,null))[_0xf7b1('0x3b')](saveUpdates(_0x194d19[_0xf7b1('0x47')],null))[_0xf7b1('0x3b')](respondWithResult(_0x5d804c,null))[_0xf7b1('0x40')](handleError(_0x5d804c,null));};exports[_0xf7b1('0x22')]=function(_0x4ad53f,_0x1715b9){return db[_0xf7b1('0x29')][_0xf7b1('0x45')]({'where':{'id':_0x4ad53f[_0xf7b1('0x42')]['id']}})[_0xf7b1('0x3b')](handleEntityNotFound(_0x1715b9,null))['then'](removeEntity(_0x1715b9,null))[_0xf7b1('0x40')](handleError(_0x1715b9,null));};exports['getConfigurations']=function(_0xb49bb0,_0x3c21c8,_0x1fae5d){var _0x53f341={};var _0x237077={};var _0x534310;var _0x2a2452;return db[_0xf7b1('0x29')][_0xf7b1('0x48')]({'where':{'id':_0xb49bb0[_0xf7b1('0x42')]['id']}})[_0xf7b1('0x3b')](handleEntityNotFound(_0x3c21c8,null))[_0xf7b1('0x3b')](function(_0x33cc7c){if(_0x33cc7c){_0x534310=_0x33cc7c;_0x237077[_0xf7b1('0x43')]=_[_0xf7b1('0x44')](db[_0xf7b1('0x49')][_0xf7b1('0x2a')]);_0x237077[_0xf7b1('0x2d')]=_[_0xf7b1('0x44')](_0xb49bb0[_0xf7b1('0x2d')]);_0x237077[_0xf7b1('0x2e')]=_['intersection'](_0x237077[_0xf7b1('0x43')],_0x237077[_0xf7b1('0x2d')]);_0x53f341['attributes']=_[_0xf7b1('0x2f')](_0x237077[_0xf7b1('0x43')],qs['fields'](_0xb49bb0[_0xf7b1('0x2d')][_0xf7b1('0x31')]));_0x53f341[_0xf7b1('0x30')]=_0x53f341[_0xf7b1('0x30')]['length']?_0x53f341['attributes']:_0x237077[_0xf7b1('0x43')];_0x53f341['order']=qs[_0xf7b1('0x34')](_0xb49bb0['query'][_0xf7b1('0x34')]);_0x53f341[_0xf7b1('0x35')]=qs[_0xf7b1('0x2e')](_[_0xf7b1('0x36')](_0xb49bb0[_0xf7b1('0x2d')],_0x237077[_0xf7b1('0x2e')]));if(_0xb49bb0[_0xf7b1('0x2d')]['filter']){_0x53f341['where']=_['merge'](_0x53f341[_0xf7b1('0x35')],{'$or':_[_0xf7b1('0x28')](_0x53f341[_0xf7b1('0x30')],function(_0x44c7d8){var _0x374c66={};_0x374c66[_0x44c7d8]={'$like':'%'+_0xb49bb0[_0xf7b1('0x2d')]['filter']+'%'};return _0x374c66;})});}_0x53f341=_[_0xf7b1('0x37')]({},_0x53f341,_0xb49bb0[_0xf7b1('0x3a')]);return _0x534310[_0xf7b1('0x4a')](_0x53f341);}})[_0xf7b1('0x3b')](function(_0x3bfad0){if(_0x3bfad0){_0x2a2452=_0x3bfad0[_0xf7b1('0x32')];if(!_0xb49bb0['query'][_0xf7b1('0x33')](_0xf7b1('0x4b'))){_0x53f341[_0xf7b1('0x1b')]=qs[_0xf7b1('0x1b')](_0xb49bb0[_0xf7b1('0x2d')][_0xf7b1('0x1b')]);_0x53f341[_0xf7b1('0x1d')]=qs['offset'](_0xb49bb0[_0xf7b1('0x2d')][_0xf7b1('0x1d')]);}return _0x534310[_0xf7b1('0x4a')](_0x53f341);}})[_0xf7b1('0x3b')](function(_0x411d9a){if(_0x411d9a){return _0x411d9a?{'count':_0x2a2452,'rows':_0x411d9a}:null;}})['then'](respondWithResult(_0x3c21c8,null))[_0xf7b1('0x40')](handleError(_0x3c21c8,null));};exports['addConfiguration']=function(_0x20f4ba,_0x4fc3ae,_0x2425e4){if(_0x20f4ba['body']['id']){delete _0x20f4ba[_0xf7b1('0x47')]['id'];}return db[_0xf7b1('0x29')][_0xf7b1('0x48')]({'where':{'id':_0x20f4ba[_0xf7b1('0x42')]['id']}})[_0xf7b1('0x3b')](handleEntityNotFound(_0x4fc3ae,null))[_0xf7b1('0x3b')](function(_0x4b63ee){if(_0x4b63ee){_0x20f4ba[_0xf7b1('0x47')][_0xf7b1('0x4c')]=_0x4b63ee['id'];_0x20f4ba[_0xf7b1('0x47')][_0xf7b1('0x4d')]=integrations[_0xf7b1('0x4e')](_0x20f4ba['body'][_0xf7b1('0x4f')],_0x20f4ba[_0xf7b1('0x47')][_0xf7b1('0x2c')]);_0x20f4ba[_0xf7b1('0x47')][_0xf7b1('0x50')]=integrations[_0xf7b1('0x51')](_0x20f4ba[_0xf7b1('0x47')][_0xf7b1('0x4f')],_0x20f4ba[_0xf7b1('0x47')][_0xf7b1('0x2c')]);return db[_0xf7b1('0x49')][_0xf7b1('0x46')](_0x20f4ba[_0xf7b1('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0xf7b1('0x4d')},{'model':db[_0xf7b1('0x52')],'as':_0xf7b1('0x50')}]});}return null;})[_0xf7b1('0x3b')](respondWithResult(_0x4fc3ae,null))['catch'](handleError(_0x4fc3ae,null));};exports[_0xf7b1('0x53')]=function(_0x5dd810,_0x2302eb,_0x70f49b){var _0x39a31b;var _0x5966a0='';var _0x59f03e='Task';return db[_0xf7b1('0x29')][_0xf7b1('0x48')]({'where':{'id':_0x5dd810[_0xf7b1('0x42')]['id']},'attributes':['id',_0xf7b1('0x54'),'clientId',_0xf7b1('0x55'),'username','password',_0xf7b1('0x56')]})['then'](handleEntityNotFound(_0x2302eb,null))[_0xf7b1('0x3b')](function(_0x2a43ff){if(_0x2a43ff){_0x5966a0=_0x2a43ff[_0xf7b1('0x54')];var _0x2ecb97=_0x5966a0[_0xf7b1('0x57')](-0x1);if(_0x2ecb97==='/'){_0x5966a0=_0x5966a0[_0xf7b1('0x58')](0x0,_0x5966a0[_0xf7b1('0x59')](_0x2ecb97));}_0x39a31b=new jsforce[(_0xf7b1('0x5a'))]({'oauth2':{'loginUrl':_0x5966a0,'clientId':_0x2a43ff[_0xf7b1('0x5b')],'clientSecret':_0x2a43ff[_0xf7b1('0x55')]}});return _0x39a31b[_0xf7b1('0x5c')](_0x2a43ff[_0xf7b1('0x5d')],_0x2a43ff[_0xf7b1('0x5e')][_0xf7b1('0x5f')](_0x2a43ff[_0xf7b1('0x56')]));}})[_0xf7b1('0x3b')](function(_0x1d90d6){if(_0x1d90d6){if(!_['isNil'](_0x5dd810[_0xf7b1('0x2d')][_0xf7b1('0x60')])){_0x59f03e=_0x5dd810[_0xf7b1('0x2d')][_0xf7b1('0x60')];}return _0x39a31b[_0xf7b1('0x61')](_0x59f03e)[_0xf7b1('0x62')]();}})[_0xf7b1('0x3b')](function(_0x2fb963){var _0x37aa36=[_0xf7b1('0x63'),'ActivityDate','IsReminderSet','IsRecurrence',_0xf7b1('0x64'),_0xf7b1('0x65')];var _0xb7501=['string',_0xf7b1('0x66'),'picklist','boolean',_0xf7b1('0x67'),_0xf7b1('0x68'),_0xf7b1('0x69')];if(_0x2fb963){_[_0xf7b1('0x6a')](_0x2fb963['fields'],function(_0x2d2ea5){return _0x37aa36[_0xf7b1('0x6b')](_0x2d2ea5['name'])||!_0xb7501[_0xf7b1('0x6b')](_0x2d2ea5['type']);});return{'count':_0x2fb963['fields'][_0xf7b1('0x32')],'rows':_[_0xf7b1('0x28')](_0x2fb963['fields'],function(_0x20b927){return{'id':_0x20b927[_0xf7b1('0x25')],'name':_0x20b927[_0xf7b1('0x6c')],'custom':_0x20b927[_0xf7b1('0x6d')],'options':_0x20b927[_0xf7b1('0x6e')][_0xf7b1('0x32')]>0x0?_[_0xf7b1('0x28')](_0x20b927[_0xf7b1('0x6e')],function(_0x430c89){return{'name':_0x430c89[_0xf7b1('0x6c')],'value':_0x430c89[_0xf7b1('0x6f')]};}):_0x20b927[_0xf7b1('0x2c')]==_0xf7b1('0x70')?[{'name':_0xf7b1('0x71'),'value':'true'},{'name':_0xf7b1('0x72'),'value':_0xf7b1('0x73')}]:[]};})};}})[_0xf7b1('0x3b')](respondWithResult(_0x2302eb,null))[_0xf7b1('0x40')](function(_0x1f106a){var _0x1db963=_0x5dd810[_0xf7b1('0x2d')][_0xf7b1('0x74')]?0x1f4:_0x1f106a[_0xf7b1('0x75')]||0x1f4;logger[_0xf7b1('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xf7b1('0x53'),_0x1db963,JSON[_0xf7b1('0x76')](_0x1f106a));delete _0x1f106a[_0xf7b1('0x25')];if(_0x1db963===0x191){_0x1db963=0x190;}_0x2302eb['status'](_0x1db963)[_0xf7b1('0x26')](_0x5dd810[_0xf7b1('0x2d')][_0xf7b1('0x74')]?{'message':_0xf7b1('0x77'),'statusCode':_0x1f106a['statusCode']}:_0x1f106a);});};
\ No newline at end of file
+var _0x4cad=['fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','SalesforceAccount','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getConfigurations','findOne','length','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','includes','label','custom','picklistValues','value','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','type','key','map','intersection','model','query'];(function(_0x55e565,_0x371bf7){var _0x21b288=function(_0x3fabcf){while(--_0x3fabcf){_0x55e565['push'](_0x55e565['shift']());}};_0x21b288(++_0x371bf7);}(_0x4cad,0x1b9));var _0xd4ca=function(_0xc2e65d,_0x37b1b4){_0xc2e65d=_0xc2e65d-0x0;var _0x5b8c86=_0x4cad[_0xc2e65d];return _0x5b8c86;};'use strict';var emlformat=require(_0xd4ca('0x0'));var rimraf=require(_0xd4ca('0x1'));var zipdir=require(_0xd4ca('0x2'));var jsonpatch=require(_0xd4ca('0x3'));var rp=require('request-promise');var moment=require(_0xd4ca('0x4'));var BPromise=require(_0xd4ca('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd4ca('0x6'));var sox=require(_0xd4ca('0x7'));var csv=require(_0xd4ca('0x8'));var ejs=require(_0xd4ca('0x9'));var fs=require('fs');var fs_extra=require(_0xd4ca('0xa'));var _=require(_0xd4ca('0xb'));var squel=require(_0xd4ca('0xc'));var crypto=require(_0xd4ca('0xd'));var jsforce=require(_0xd4ca('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4ca('0xf'));var Papa=require('papaparse');var Redis=require(_0xd4ca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd4ca('0x11'));var as=require(_0xd4ca('0x12'));var hardwareService=require(_0xd4ca('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd4ca('0x14'));var config=require(_0xd4ca('0x15'));var licenseUtil=require(_0xd4ca('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd4ca('0x17'));function respondWithStatusCode(_0x2e6fd9,_0x20f5e3){_0x20f5e3=_0x20f5e3||0xcc;return function(_0xb8cb04){if(_0xb8cb04){return _0x2e6fd9[_0xd4ca('0x18')](_0x20f5e3);}return _0x2e6fd9[_0xd4ca('0x19')](_0x20f5e3)['end']();};}function respondWithResult(_0x5b64e1,_0x271e7d){_0x271e7d=_0x271e7d||0xc8;return function(_0x4f5f6c){if(_0x4f5f6c){return _0x5b64e1['status'](_0x271e7d)['json'](_0x4f5f6c);}};}function respondWithFilteredResult(_0x367822,_0x59bbd6){return function(_0x29d85c){if(_0x29d85c){var _0x52d788=typeof _0x59bbd6['offset']===_0xd4ca('0x1a')&&typeof _0x59bbd6[_0xd4ca('0x1b')]===_0xd4ca('0x1a');var _0x22b5c9=_0x29d85c[_0xd4ca('0x1c')];var _0x13b21a=_0x52d788?0x0:_0x59bbd6['offset'];var _0x125776=_0x52d788?_0x29d85c[_0xd4ca('0x1c')]:_0x59bbd6[_0xd4ca('0x1d')]+_0x59bbd6['limit'];var _0x34f5cf;if(_0x125776>=_0x22b5c9){_0x125776=_0x22b5c9;_0x34f5cf=0xc8;}else{_0x34f5cf=0xce;}_0x367822['status'](_0x34f5cf);return _0x367822[_0xd4ca('0x1e')](_0xd4ca('0x1f'),_0x13b21a+'-'+_0x125776+'/'+_0x22b5c9)[_0xd4ca('0x20')](_0x29d85c);}return null;};}function patchUpdates(_0x31d0ce){return function(_0x535cde){try{jsonpatch[_0xd4ca('0x21')](_0x535cde,_0x31d0ce,!![]);}catch(_0x5653f5){return BPromise[_0xd4ca('0x22')](_0x5653f5);}return _0x535cde[_0xd4ca('0x23')]();};}function saveUpdates(_0x29589d,_0x958dc1){return function(_0x43a47c){if(_0x43a47c){return _0x43a47c[_0xd4ca('0x24')](_0x29589d)[_0xd4ca('0x25')](function(_0x209026){return _0x209026;});}return null;};}function removeEntity(_0x4bad7d,_0x59bb6b){return function(_0xb28225){if(_0xb28225){return _0xb28225[_0xd4ca('0x26')]()['then'](function(){_0x4bad7d[_0xd4ca('0x19')](0xcc)[_0xd4ca('0x27')]();});}};}function handleEntityNotFound(_0x4035e0,_0x471081){return function(_0x1ce357){if(!_0x1ce357){_0x4035e0[_0xd4ca('0x18')](0x194);}return _0x1ce357;};}function handleError(_0xc00818,_0x24614c){_0x24614c=_0x24614c||0x1f4;return function(_0x1fb0b8){logger[_0xd4ca('0x28')](_0x1fb0b8[_0xd4ca('0x29')]);if(_0x1fb0b8[_0xd4ca('0x2a')]){delete _0x1fb0b8[_0xd4ca('0x2a')];}_0xc00818['status'](_0x24614c)[_0xd4ca('0x2b')](_0x1fb0b8);};}exports['index']=function(_0x526f39,_0x1bb4bf){var _0x5203df={},_0x1fa926={},_0x348d70={'count':0x0,'rows':[]};var _0x262934=_['map'](db['SalesforceAccount'][_0xd4ca('0x2c')],function(_0x5286c5){return{'name':_0x5286c5['fieldName'],'type':_0x5286c5[_0xd4ca('0x2d')][_0xd4ca('0x2e')]};});_0x1fa926['model']=_[_0xd4ca('0x2f')](_0x262934,_0xd4ca('0x2a'));_0x1fa926['query']=_['keys'](_0x526f39['query']);_0x1fa926['filters']=_[_0xd4ca('0x30')](_0x1fa926[_0xd4ca('0x31')],_0x1fa926[_0xd4ca('0x32')]);_0x5203df['attributes']=_[_0xd4ca('0x30')](_0x1fa926[_0xd4ca('0x31')],qs['fields'](_0x526f39['query'][_0xd4ca('0x33')]));_0x5203df[_0xd4ca('0x34')]=_0x5203df[_0xd4ca('0x34')]['length']?_0x5203df['attributes']:_0x1fa926['model'];if(!_0x526f39[_0xd4ca('0x32')][_0xd4ca('0x35')]('nolimit')){_0x5203df['limit']=qs[_0xd4ca('0x1b')](_0x526f39[_0xd4ca('0x32')][_0xd4ca('0x1b')]);_0x5203df[_0xd4ca('0x1d')]=qs[_0xd4ca('0x1d')](_0x526f39[_0xd4ca('0x32')][_0xd4ca('0x1d')]);}_0x5203df[_0xd4ca('0x36')]=qs[_0xd4ca('0x37')](_0x526f39[_0xd4ca('0x32')][_0xd4ca('0x37')]);_0x5203df[_0xd4ca('0x38')]=qs[_0xd4ca('0x39')](_[_0xd4ca('0x3a')](_0x526f39[_0xd4ca('0x32')],_0x1fa926[_0xd4ca('0x39')]),_0x262934);if(_0x526f39[_0xd4ca('0x32')]['filter']){_0x5203df[_0xd4ca('0x38')]=_[_0xd4ca('0x3b')](_0x5203df[_0xd4ca('0x38')],{'$or':_[_0xd4ca('0x2f')](_0x262934,function(_0x237313){if(_0x237313[_0xd4ca('0x2d')]!=='VIRTUAL'){var _0x9b5bbe={};_0x9b5bbe[_0x237313[_0xd4ca('0x2a')]]={'$like':'%'+_0x526f39['query'][_0xd4ca('0x3c')]+'%'};return _0x9b5bbe;}})});}_0x5203df=_[_0xd4ca('0x3b')]({},_0x5203df,_0x526f39[_0xd4ca('0x3d')]);var _0x58ec4a={'where':_0x5203df[_0xd4ca('0x38')]};return db[_0xd4ca('0x3e')][_0xd4ca('0x1c')](_0x58ec4a)[_0xd4ca('0x25')](function(_0xbda2e1){_0x348d70['count']=_0xbda2e1;if(_0x526f39['query'][_0xd4ca('0x3f')]){_0x5203df['include']=[{'all':!![]}];}return db[_0xd4ca('0x3e')][_0xd4ca('0x40')](_0x5203df);})[_0xd4ca('0x25')](function(_0x44c6df){_0x348d70[_0xd4ca('0x41')]=_0x44c6df;return _0x348d70;})[_0xd4ca('0x25')](respondWithFilteredResult(_0x1bb4bf,_0x5203df))[_0xd4ca('0x42')](handleError(_0x1bb4bf,null));};exports['show']=function(_0x50662a,_0x154de7){var _0x3132ee={'raw':![],'where':{'id':_0x50662a[_0xd4ca('0x43')]['id']}},_0x59fd64={};_0x59fd64[_0xd4ca('0x31')]=_[_0xd4ca('0x44')](db['SalesforceAccount']['rawAttributes']);_0x59fd64[_0xd4ca('0x32')]=_['keys'](_0x50662a[_0xd4ca('0x32')]);_0x59fd64[_0xd4ca('0x39')]=_[_0xd4ca('0x30')](_0x59fd64[_0xd4ca('0x31')],_0x59fd64[_0xd4ca('0x32')]);_0x3132ee['attributes']=_[_0xd4ca('0x30')](_0x59fd64[_0xd4ca('0x31')],qs[_0xd4ca('0x33')](_0x50662a[_0xd4ca('0x32')][_0xd4ca('0x33')]));_0x3132ee[_0xd4ca('0x34')]=_0x3132ee[_0xd4ca('0x34')]['length']?_0x3132ee[_0xd4ca('0x34')]:_0x59fd64[_0xd4ca('0x31')];if(_0x50662a[_0xd4ca('0x32')][_0xd4ca('0x3f')]){_0x3132ee[_0xd4ca('0x45')]=[{'all':!![]}];}_0x3132ee=_[_0xd4ca('0x3b')]({},_0x3132ee,_0x50662a[_0xd4ca('0x3d')]);return db[_0xd4ca('0x3e')][_0xd4ca('0x46')](_0x3132ee)[_0xd4ca('0x25')](handleEntityNotFound(_0x154de7,null))['then'](respondWithResult(_0x154de7,null))[_0xd4ca('0x42')](handleError(_0x154de7,null));};exports[_0xd4ca('0x47')]=function(_0x155819,_0x1cf019){return db[_0xd4ca('0x3e')]['create'](_0x155819['body'],{})[_0xd4ca('0x25')](respondWithResult(_0x1cf019,0xc9))[_0xd4ca('0x42')](handleError(_0x1cf019,null));};exports[_0xd4ca('0x24')]=function(_0x4ca4f6,_0x253898){if(_0x4ca4f6[_0xd4ca('0x48')]['id']){delete _0x4ca4f6['body']['id'];}return db[_0xd4ca('0x3e')]['find']({'where':{'id':_0x4ca4f6[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x25')](handleEntityNotFound(_0x253898,null))['then'](saveUpdates(_0x4ca4f6[_0xd4ca('0x48')],null))[_0xd4ca('0x25')](respondWithResult(_0x253898,null))[_0xd4ca('0x42')](handleError(_0x253898,null));};exports['destroy']=function(_0x3a235a,_0x48fb6a){return db['SalesforceAccount'][_0xd4ca('0x46')]({'where':{'id':_0x3a235a[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x25')](handleEntityNotFound(_0x48fb6a,null))[_0xd4ca('0x25')](removeEntity(_0x48fb6a,null))[_0xd4ca('0x42')](handleError(_0x48fb6a,null));};exports[_0xd4ca('0x49')]=function(_0x304a46,_0x55c3a4,_0x1fef0a){var _0x4c9591={};var _0x500b8b={};var _0x129122;var _0x53f1f1;return db[_0xd4ca('0x3e')][_0xd4ca('0x4a')]({'where':{'id':_0x304a46['params']['id']}})[_0xd4ca('0x25')](handleEntityNotFound(_0x55c3a4,null))[_0xd4ca('0x25')](function(_0x37361e){if(_0x37361e){_0x129122=_0x37361e;_0x500b8b[_0xd4ca('0x31')]=_[_0xd4ca('0x44')](db['SalesforceConfiguration']['rawAttributes']);_0x500b8b[_0xd4ca('0x32')]=_['keys'](_0x304a46['query']);_0x500b8b[_0xd4ca('0x39')]=_[_0xd4ca('0x30')](_0x500b8b['model'],_0x500b8b[_0xd4ca('0x32')]);_0x4c9591['attributes']=_['intersection'](_0x500b8b[_0xd4ca('0x31')],qs[_0xd4ca('0x33')](_0x304a46[_0xd4ca('0x32')][_0xd4ca('0x33')]));_0x4c9591[_0xd4ca('0x34')]=_0x4c9591[_0xd4ca('0x34')]['length']?_0x4c9591[_0xd4ca('0x34')]:_0x500b8b[_0xd4ca('0x31')];_0x4c9591[_0xd4ca('0x36')]=qs['sort'](_0x304a46[_0xd4ca('0x32')]['sort']);_0x4c9591[_0xd4ca('0x38')]=qs['filters'](_[_0xd4ca('0x3a')](_0x304a46['query'],_0x500b8b['filters']));if(_0x304a46[_0xd4ca('0x32')]['filter']){_0x4c9591[_0xd4ca('0x38')]=_[_0xd4ca('0x3b')](_0x4c9591[_0xd4ca('0x38')],{'$or':_[_0xd4ca('0x2f')](_0x4c9591[_0xd4ca('0x34')],function(_0x53bd54){var _0x5553e4={};_0x5553e4[_0x53bd54]={'$like':'%'+_0x304a46[_0xd4ca('0x32')][_0xd4ca('0x3c')]+'%'};return _0x5553e4;})});}_0x4c9591=_[_0xd4ca('0x3b')]({},_0x4c9591,_0x304a46[_0xd4ca('0x3d')]);return _0x129122[_0xd4ca('0x49')](_0x4c9591);}})['then'](function(_0x5ecc6a){if(_0x5ecc6a){_0x53f1f1=_0x5ecc6a[_0xd4ca('0x4b')];if(!_0x304a46[_0xd4ca('0x32')]['hasOwnProperty'](_0xd4ca('0x4c'))){_0x4c9591[_0xd4ca('0x1b')]=qs[_0xd4ca('0x1b')](_0x304a46[_0xd4ca('0x32')]['limit']);_0x4c9591[_0xd4ca('0x1d')]=qs[_0xd4ca('0x1d')](_0x304a46[_0xd4ca('0x32')][_0xd4ca('0x1d')]);}return _0x129122['getConfigurations'](_0x4c9591);}})[_0xd4ca('0x25')](function(_0x233614){if(_0x233614){return _0x233614?{'count':_0x53f1f1,'rows':_0x233614}:null;}})[_0xd4ca('0x25')](respondWithResult(_0x55c3a4,null))[_0xd4ca('0x42')](handleError(_0x55c3a4,null));};exports[_0xd4ca('0x4d')]=function(_0x58fb35,_0x223c14,_0x10cc5e){if(_0x58fb35[_0xd4ca('0x48')]['id']){delete _0x58fb35[_0xd4ca('0x48')]['id'];}return db[_0xd4ca('0x3e')][_0xd4ca('0x4a')]({'where':{'id':_0x58fb35[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x25')](handleEntityNotFound(_0x223c14,null))[_0xd4ca('0x25')](function(_0x372ee0){if(_0x372ee0){_0x58fb35['body']['AccountId']=_0x372ee0['id'];_0x58fb35['body'][_0xd4ca('0x4e')]=integrations['getSubjects'](_0x58fb35[_0xd4ca('0x48')][_0xd4ca('0x4f')],_0x58fb35[_0xd4ca('0x48')][_0xd4ca('0x2d')]);_0x58fb35[_0xd4ca('0x48')][_0xd4ca('0x50')]=integrations[_0xd4ca('0x51')](_0x58fb35[_0xd4ca('0x48')][_0xd4ca('0x4f')],_0x58fb35[_0xd4ca('0x48')]['type']);return db[_0xd4ca('0x52')][_0xd4ca('0x47')](_0x58fb35[_0xd4ca('0x48')],{'include':[{'model':db[_0xd4ca('0x53')],'as':_0xd4ca('0x4e')},{'model':db[_0xd4ca('0x53')],'as':_0xd4ca('0x50')}]});}return null;})[_0xd4ca('0x25')](respondWithResult(_0x223c14,null))['catch'](handleError(_0x223c14,null));};exports[_0xd4ca('0x54')]=function(_0x33054e,_0x1c5764,_0xb7916e){var _0x5e0fd2;var _0x44e855='';var _0x42b473=_0xd4ca('0x55');return db[_0xd4ca('0x3e')][_0xd4ca('0x4a')]({'where':{'id':_0x33054e[_0xd4ca('0x43')]['id']},'attributes':['id',_0xd4ca('0x56'),'clientId',_0xd4ca('0x57'),'username',_0xd4ca('0x58'),_0xd4ca('0x59')]})[_0xd4ca('0x25')](handleEntityNotFound(_0x1c5764,null))[_0xd4ca('0x25')](function(_0xc2b425){if(_0xc2b425){_0x44e855=_0xc2b425[_0xd4ca('0x56')];var _0x1eee30=_0x44e855[_0xd4ca('0x5a')](-0x1);if(_0x1eee30==='/'){_0x44e855=_0x44e855[_0xd4ca('0x5b')](0x0,_0x44e855[_0xd4ca('0x5c')](_0x1eee30));}_0x5e0fd2=new jsforce[(_0xd4ca('0x5d'))]({'oauth2':{'loginUrl':_0x44e855,'clientId':_0xc2b425['clientId'],'clientSecret':_0xc2b425[_0xd4ca('0x57')]}});return _0x5e0fd2[_0xd4ca('0x5e')](_0xc2b425['username'],_0xc2b425[_0xd4ca('0x58')][_0xd4ca('0x5f')](_0xc2b425[_0xd4ca('0x59')]));}})[_0xd4ca('0x25')](function(_0x10c6d4){if(_0x10c6d4){if(!_[_0xd4ca('0x60')](_0x33054e[_0xd4ca('0x32')][_0xd4ca('0x61')])){_0x42b473=_0x33054e[_0xd4ca('0x32')]['ticketType'];}return _0x5e0fd2[_0xd4ca('0x62')](_0x42b473)['describe']();}})[_0xd4ca('0x25')](function(_0x1116f6){var _0x4d4174=[_0xd4ca('0x63'),_0xd4ca('0x64'),_0xd4ca('0x65'),_0xd4ca('0x66'),_0xd4ca('0x67'),_0xd4ca('0x68')];var _0x1d3963=[_0xd4ca('0x69'),_0xd4ca('0x6a'),_0xd4ca('0x6b'),_0xd4ca('0x6c'),_0xd4ca('0x6d'),_0xd4ca('0x6e'),'phone'];if(_0x1116f6){_['remove'](_0x1116f6[_0xd4ca('0x33')],function(_0x16384){return _0x4d4174[_0xd4ca('0x6f')](_0x16384['name'])||!_0x1d3963[_0xd4ca('0x6f')](_0x16384[_0xd4ca('0x2d')]);});return{'count':_0x1116f6[_0xd4ca('0x33')][_0xd4ca('0x4b')],'rows':_[_0xd4ca('0x2f')](_0x1116f6[_0xd4ca('0x33')],function(_0x1cb886){return{'id':_0x1cb886[_0xd4ca('0x2a')],'name':_0x1cb886[_0xd4ca('0x70')],'custom':_0x1cb886[_0xd4ca('0x71')],'options':_0x1cb886[_0xd4ca('0x72')][_0xd4ca('0x4b')]>0x0?_[_0xd4ca('0x2f')](_0x1cb886[_0xd4ca('0x72')],function(_0x4549a1){return{'name':_0x4549a1[_0xd4ca('0x70')],'value':_0x4549a1[_0xd4ca('0x73')]};}):_0x1cb886[_0xd4ca('0x2d')]==_0xd4ca('0x6c')?[{'name':'True','value':_0xd4ca('0x74')},{'name':_0xd4ca('0x75'),'value':'false'}]:[]};})};}})[_0xd4ca('0x25')](respondWithResult(_0x1c5764,null))[_0xd4ca('0x42')](function(_0x304560){var _0x189c3f=_0x33054e[_0xd4ca('0x32')][_0xd4ca('0x76')]?0x1f4:_0x304560[_0xd4ca('0x77')]||0x1f4;logger[_0xd4ca('0x28')](_0xd4ca('0x78'),_0xd4ca('0x54'),_0x189c3f,JSON[_0xd4ca('0x79')](_0x304560));delete _0x304560['name'];if(_0x189c3f===0x191){_0x189c3f=0x190;}_0x1c5764[_0xd4ca('0x19')](_0x189c3f)[_0xd4ca('0x2b')](_0x33054e[_0xd4ca('0x32')][_0xd4ca('0x76')]?{'message':_0xd4ca('0x7a'),'statusCode':_0x304560[_0xd4ca('0x77')]}:_0x304560);});};
\ No newline at end of file
index 26cc4b3..1cb55b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc882=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api','moment'];(function(_0x2b992d,_0x4436f5){var _0x3a30c1=function(_0x33d9be){while(--_0x33d9be){_0x2b992d['push'](_0x2b992d['shift']());}};_0x3a30c1(++_0x4436f5);}(_0xc882,0xff));var _0x2c88=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc882[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var logger=require(_0x2c88('0x2'))(_0x2c88('0x3'));var moment=require(_0x2c88('0x4'));var BPromise=require(_0x2c88('0x5'));var rp=require(_0x2c88('0x6'));var fs=require('fs');var path=require(_0x2c88('0x7'));var rimraf=require(_0x2c88('0x8'));var config=require(_0x2c88('0x9'));var attributes=require(_0x2c88('0xa'));var integrations=require(_0x2c88('0xb'));module[_0x2c88('0xc')]=function(_0x15eadc,_0x26bfea){return _0x15eadc['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3931=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42f0d1,_0x45fe4a){var _0x43f981=function(_0x5882e8){while(--_0x5882e8){_0x42f0d1['push'](_0x42f0d1['shift']());}};_0x43f981(++_0x45fe4a);}(_0x3931,0x14c));var _0x1393=function(_0x543fe4,_0x445071){_0x543fe4=_0x543fe4-0x0;var _0x5783dd=_0x3931[_0x543fe4];return _0x5783dd;};'use strict';var _=require('lodash');var util=require(_0x1393('0x0'));var logger=require(_0x1393('0x1'))(_0x1393('0x2'));var moment=require(_0x1393('0x3'));var BPromise=require(_0x1393('0x4'));var rp=require(_0x1393('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1393('0x6'));var config=require(_0x1393('0x7'));var attributes=require(_0x1393('0x8'));var integrations=require(_0x1393('0x9'));module['exports']=function(_0x52c156,_0x2cfe88){return _0x52c156[_0x1393('0xa')](_0x1393('0xb'),attributes,{'tableName':_0x1393('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 61af4f1..13c8dcb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0191=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','include','model','attributes','map','ShowSalesforceAccount','find','raw','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x387625,_0x2a41d8){var _0x2abf75=function(_0x4dbbea){while(--_0x4dbbea){_0x387625['push'](_0x387625['shift']());}};_0x2abf75(++_0x2a41d8);}(_0x0191,0x13f));var _0x1019=function(_0x2e1d3d,_0x719bf0){_0x2e1d3d=_0x2e1d3d-0x0;var _0x3d81df=_0x0191[_0x2e1d3d];return _0x3d81df;};'use strict';var _=require(_0x1019('0x0'));var util=require(_0x1019('0x1'));var moment=require('moment');var BPromise=require(_0x1019('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1019('0x3'));var db=require(_0x1019('0x4'))['db'];var utils=require(_0x1019('0x5'));var logger=require(_0x1019('0x6'))('rpc');var config=require(_0x1019('0x7'));var jayson=require(_0x1019('0x8'));var client=jayson[_0x1019('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c630a,_0x3b734a,_0x3bf2a3){return new BPromise(function(_0x28c561,_0x46cae4){return client[_0x1019('0xa')](_0x2c630a,_0x3bf2a3)[_0x1019('0xb')](function(_0x34592c){logger[_0x1019('0xc')](_0x1019('0xd'),_0x3b734a,_0x1019('0xe'));logger[_0x1019('0xf')](_0x1019('0x10'),_0x3b734a,_0x1019('0xe'),JSON[_0x1019('0x11')](_0x34592c));if(_0x34592c[_0x1019('0x12')]){if(_0x34592c['error'][_0x1019('0x13')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3b734a,_0x34592c[_0x1019('0x12')][_0x1019('0x14')]);return _0x46cae4(_0x34592c[_0x1019('0x12')][_0x1019('0x14')]);}logger[_0x1019('0x12')](_0x1019('0xd'),_0x3b734a,_0x34592c[_0x1019('0x12')]['message']);return _0x28c561(_0x34592c[_0x1019('0x12')][_0x1019('0x14')]);}else{logger[_0x1019('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x3b734a,_0x1019('0xe'));_0x28c561(_0x34592c[_0x1019('0x15')][_0x1019('0x14')]);}})[_0x1019('0x16')](function(_0x348568){logger['error'](_0x1019('0xd'),_0x3b734a,_0x348568);_0x46cae4(_0x348568);});});}exports[_0x1019('0x17')]=function(_0x761746){var _0x3335f8=this;return new Promise(function(_0x508fed,_0xad4e3e){return db[_0x1019('0x18')][_0x1019('0x19')]({'raw':_0x761746[_0x1019('0x1a')]?_0x761746[_0x1019('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x761746[_0x1019('0x1a')]?_0x761746[_0x1019('0x1a')][_0x1019('0x1b')]||null:null,'attributes':_0x761746[_0x1019('0x1a')]?_0x761746['options']['attributes']||null:null,'limit':_0x761746['options']?_0x761746[_0x1019('0x1a')][_0x1019('0x1c')]||null:null,'include':_0x761746['options']?_0x761746[_0x1019('0x1a')][_0x1019('0x1d')]?_['map'](_0x761746[_0x1019('0x1a')][_0x1019('0x1d')],function(_0x57d9fe){return{'model':db[_0x57d9fe[_0x1019('0x1e')]],'as':_0x57d9fe['as'],'attributes':_0x57d9fe[_0x1019('0x1f')],'include':_0x57d9fe['include']?_['map'](_0x57d9fe[_0x1019('0x1d')],function(_0x1b9202){return{'model':db[_0x1b9202[_0x1019('0x1e')]],'as':_0x1b9202['as'],'attributes':_0x1b9202[_0x1019('0x1f')],'include':_0x1b9202['include']?_[_0x1019('0x20')](_0x1b9202[_0x1019('0x1d')],function(_0x59b783){return{'model':db[_0x59b783[_0x1019('0x1e')]],'as':_0x59b783['as'],'attributes':_0x59b783[_0x1019('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1019('0xb')](function(_0x4f3ff1){logger[_0x1019('0xc')]('GetSalesforceAccount',_0x761746);logger[_0x1019('0xf')](_0x1019('0x17'),_0x761746,JSON[_0x1019('0x11')](_0x4f3ff1));_0x508fed(_0x4f3ff1);})[_0x1019('0x16')](function(_0x29772e){logger[_0x1019('0x12')](_0x1019('0x17'),_0x29772e[_0x1019('0x14')],_0x761746);_0xad4e3e(_0x3335f8['error'](0x1f4,_0x29772e[_0x1019('0x14')]));});});};exports[_0x1019('0x21')]=function(_0x3d3d46){var _0x36f219=this;return new Promise(function(_0x3fd2eb,_0x4f1450){return db[_0x1019('0x18')][_0x1019('0x22')]({'raw':_0x3d3d46[_0x1019('0x1a')]?_0x3d3d46['options'][_0x1019('0x23')]===undefined?!![]:![]:!![],'where':_0x3d3d46[_0x1019('0x1a')]?_0x3d3d46[_0x1019('0x1a')][_0x1019('0x1b')]||null:null,'attributes':_0x3d3d46[_0x1019('0x1a')]?_0x3d3d46[_0x1019('0x1a')][_0x1019('0x1f')]||null:null,'include':_0x3d3d46['options']?_0x3d3d46['options'][_0x1019('0x1d')]?_[_0x1019('0x20')](_0x3d3d46[_0x1019('0x1a')]['include'],function(_0x357cc3){return{'model':db[_0x357cc3[_0x1019('0x1e')]],'as':_0x357cc3['as'],'attributes':_0x357cc3['attributes'],'include':_0x357cc3[_0x1019('0x1d')]?_[_0x1019('0x20')](_0x357cc3[_0x1019('0x1d')],function(_0xfd56e0){return{'model':db[_0xfd56e0[_0x1019('0x1e')]],'as':_0xfd56e0['as'],'attributes':_0xfd56e0['attributes'],'include':_0xfd56e0[_0x1019('0x1d')]?_[_0x1019('0x20')](_0xfd56e0['include'],function(_0x3c7893){return{'model':db[_0x3c7893[_0x1019('0x1e')]],'as':_0x3c7893['as'],'attributes':_0x3c7893[_0x1019('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1019('0xb')](function(_0x4a4c83){logger[_0x1019('0xc')]('ShowSalesforceAccount',_0x3d3d46);logger['debug'](_0x1019('0x21'),_0x3d3d46,JSON['stringify'](_0x4a4c83));_0x3fd2eb(_0x4a4c83);})[_0x1019('0x16')](function(_0xaed5d5){logger[_0x1019('0x12')]('ShowSalesforceAccount',_0xaed5d5['message'],_0x3d3d46);_0x4f1450(_0x36f219['error'](0x1f4,_0xaed5d5[_0x1019('0x14')]));});});};
\ No newline at end of file
+var _0x67d1=['SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug'];(function(_0x58f924,_0x2c014c){var _0x168ba6=function(_0x24a9cc){while(--_0x24a9cc){_0x58f924['push'](_0x58f924['shift']());}};_0x168ba6(++_0x2c014c);}(_0x67d1,0xf1));var _0x167d=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x67d1[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x167d('0x0'));var moment=require(_0x167d('0x1'));var BPromise=require('bluebird');var rs=require(_0x167d('0x2'));var fs=require('fs');var Redis=require(_0x167d('0x3'));var db=require(_0x167d('0x4'))['db'];var utils=require(_0x167d('0x5'));var logger=require('../../config/logger')(_0x167d('0x6'));var config=require(_0x167d('0x7'));var jayson=require(_0x167d('0x8'));var client=jayson[_0x167d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x737b3f,_0x546152,_0x56a2b6){return new BPromise(function(_0x1445bd,_0x1053ef){return client[_0x167d('0xa')](_0x737b3f,_0x56a2b6)[_0x167d('0xb')](function(_0x4747df){logger[_0x167d('0xc')](_0x167d('0xd'),_0x546152,'request\x20sent');logger[_0x167d('0xe')](_0x167d('0xf'),_0x546152,_0x167d('0x10'),JSON[_0x167d('0x11')](_0x4747df));if(_0x4747df[_0x167d('0x12')]){if(_0x4747df[_0x167d('0x12')]['code']===0x1f4){logger[_0x167d('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x546152,_0x4747df[_0x167d('0x12')][_0x167d('0x13')]);return _0x1053ef(_0x4747df['error'][_0x167d('0x13')]);}logger[_0x167d('0x12')](_0x167d('0xd'),_0x546152,_0x4747df[_0x167d('0x12')][_0x167d('0x13')]);return _0x1445bd(_0x4747df['error']['message']);}else{logger[_0x167d('0xc')](_0x167d('0xd'),_0x546152,_0x167d('0x10'));_0x1445bd(_0x4747df['result'][_0x167d('0x13')]);}})['catch'](function(_0x43fd94){logger['error'](_0x167d('0xd'),_0x546152,_0x43fd94);_0x1053ef(_0x43fd94);});});}exports[_0x167d('0x14')]=function(_0x1e1611){var _0x49e343=this;return new Promise(function(_0x6db64f,_0xdf1845){return db[_0x167d('0x15')]['findAll']({'raw':_0x1e1611[_0x167d('0x16')]?_0x1e1611[_0x167d('0x16')][_0x167d('0x17')]===undefined?!![]:![]:!![],'where':_0x1e1611[_0x167d('0x16')]?_0x1e1611[_0x167d('0x16')][_0x167d('0x18')]||null:null,'attributes':_0x1e1611['options']?_0x1e1611['options'][_0x167d('0x19')]||null:null,'limit':_0x1e1611['options']?_0x1e1611[_0x167d('0x16')][_0x167d('0x1a')]||null:null,'include':_0x1e1611['options']?_0x1e1611['options'][_0x167d('0x1b')]?_[_0x167d('0x1c')](_0x1e1611[_0x167d('0x16')][_0x167d('0x1b')],function(_0x53a29f){return{'model':db[_0x53a29f[_0x167d('0x1d')]],'as':_0x53a29f['as'],'attributes':_0x53a29f[_0x167d('0x19')],'include':_0x53a29f[_0x167d('0x1b')]?_[_0x167d('0x1c')](_0x53a29f['include'],function(_0x36fda8){return{'model':db[_0x36fda8[_0x167d('0x1d')]],'as':_0x36fda8['as'],'attributes':_0x36fda8[_0x167d('0x19')],'include':_0x36fda8[_0x167d('0x1b')]?_[_0x167d('0x1c')](_0x36fda8['include'],function(_0xbc5f2b){return{'model':db[_0xbc5f2b['model']],'as':_0xbc5f2b['as'],'attributes':_0xbc5f2b[_0x167d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x167d('0xb')](function(_0x3d5b1c){logger[_0x167d('0xc')](_0x167d('0x14'),_0x1e1611);logger[_0x167d('0xe')]('GetSalesforceAccount',_0x1e1611,JSON[_0x167d('0x11')](_0x3d5b1c));_0x6db64f(_0x3d5b1c);})['catch'](function(_0x382851){logger[_0x167d('0x12')]('GetSalesforceAccount',_0x382851[_0x167d('0x13')],_0x1e1611);_0xdf1845(_0x49e343[_0x167d('0x12')](0x1f4,_0x382851['message']));});});};exports[_0x167d('0x1e')]=function(_0x5dafc5){var _0x4c0956=this;return new Promise(function(_0x1ab301,_0x3cfb1d){return db[_0x167d('0x15')]['find']({'raw':_0x5dafc5['options']?_0x5dafc5[_0x167d('0x16')][_0x167d('0x17')]===undefined?!![]:![]:!![],'where':_0x5dafc5[_0x167d('0x16')]?_0x5dafc5[_0x167d('0x16')]['where']||null:null,'attributes':_0x5dafc5['options']?_0x5dafc5['options'][_0x167d('0x19')]||null:null,'include':_0x5dafc5[_0x167d('0x16')]?_0x5dafc5['options'][_0x167d('0x1b')]?_['map'](_0x5dafc5[_0x167d('0x16')][_0x167d('0x1b')],function(_0x43192f){return{'model':db[_0x43192f['model']],'as':_0x43192f['as'],'attributes':_0x43192f[_0x167d('0x19')],'include':_0x43192f[_0x167d('0x1b')]?_[_0x167d('0x1c')](_0x43192f[_0x167d('0x1b')],function(_0x47d982){return{'model':db[_0x47d982[_0x167d('0x1d')]],'as':_0x47d982['as'],'attributes':_0x47d982['attributes'],'include':_0x47d982[_0x167d('0x1b')]?_[_0x167d('0x1c')](_0x47d982[_0x167d('0x1b')],function(_0x10df94){return{'model':db[_0x10df94[_0x167d('0x1d')]],'as':_0x10df94['as'],'attributes':_0x10df94['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59c39c){logger[_0x167d('0xc')](_0x167d('0x1e'),_0x5dafc5);logger[_0x167d('0xe')](_0x167d('0x1e'),_0x5dafc5,JSON[_0x167d('0x11')](_0x59c39c));_0x1ab301(_0x59c39c);})[_0x167d('0x1f')](function(_0x16fac2){logger[_0x167d('0x12')](_0x167d('0x1e'),_0x16fac2[_0x167d('0x13')],_0x5dafc5);_0x3cfb1d(_0x4c0956['error'](0x1f4,_0x16fac2[_0x167d('0x13')]));});});};
\ No newline at end of file
index 8b0824e..797163a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2f4a84,_0x58b3d5){var _0x58afba=function(_0x1d0b19){while(--_0x1d0b19){_0x2f4a84['push'](_0x2f4a84['shift']());}};_0x58afba(++_0x58b3d5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12babe,_0x13dff6){_0x12babe=_0x12babe-0x0;var _0x23e896=_0x5f2f[_0x12babe];return _0x23e896;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router;
\ No newline at end of file
+var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x3226d9,_0x3c84fa){var _0x400576=function(_0x53b226){while(--_0x53b226){_0x3226d9['push'](_0x3226d9['shift']());}};_0x400576(++_0x3c84fa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router;
\ No newline at end of file
index 3b8eed3..ab50cd2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x694d=['contact','sequelize','exports','STRING','Task','Case','contact_lead','lead','account_contact_lead','account','ENUM'];(function(_0x549fb4,_0x57140c){var _0xc64c37=function(_0x40e702){while(--_0x40e702){_0x549fb4['push'](_0x549fb4['shift']());}};_0xc64c37(++_0x57140c);}(_0x694d,0x16c));var _0xd694=function(_0xc8e740,_0x399ac4){_0xc8e740=_0xc8e740-0x0;var _0x430229=_0x694d[_0xc8e740];return _0x430229;};'use strict';var Sequelize=require(_0xd694('0x0'));module[_0xd694('0x1')]={'name':{'type':Sequelize[_0xd694('0x2')]},'description':{'type':Sequelize[_0xd694('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xd694('0x3'),_0xd694('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xd694('0x5'),'contact',_0xd694('0x6'),_0xd694('0x7'),_0xd694('0x8')),'defaultValue':_0xd694('0x5')},'moduleCreate':{'type':Sequelize[_0xd694('0x9')]('nothing',_0xd694('0xa'),_0xd694('0x6'),_0xd694('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xd694('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd694('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xbf4a=['Case','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports','STRING','Task'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0xbf4a,0x146));var _0xabf4=function(_0x1167c0,_0x35949a){_0x1167c0=_0x1167c0-0x0;var _0x20219d=_0xbf4a[_0x1167c0];return _0x20219d;};'use strict';var Sequelize=require(_0xabf4('0x0'));module[_0xabf4('0x1')]={'name':{'type':Sequelize[_0xabf4('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xabf4('0x3'),_0xabf4('0x4')),'defaultValue':_0xabf4('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xabf4('0x5'),_0xabf4('0x6'),_0xabf4('0x7'),_0xabf4('0x8'),_0xabf4('0x9')),'defaultValue':_0xabf4('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xabf4('0x6'),_0xabf4('0x7'),_0xabf4('0x9')),'defaultValue':_0xabf4('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xabf4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xabf4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xabf4('0x2')]}};
\ No newline at end of file
index cb866c0..dfc7ff7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85f1=['fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','SalesforceConfiguration','include','catch','create','body','find','getFields','SalesforceField','order','map','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x164055,_0x4f701b){var _0x45d955=function(_0x583306){while(--_0x583306){_0x164055['push'](_0x164055['shift']());}};_0x45d955(++_0x4f701b);}(_0x85f1,0xc4));var _0x185f=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x85f1[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x185f('0x0'));var rimraf=require(_0x185f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x185f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x185f('0x3'));var Mustache=require(_0x185f('0x4'));var util=require('util');var path=require(_0x185f('0x5'));var sox=require('sox');var csv=require(_0x185f('0x6'));var ejs=require(_0x185f('0x7'));var fs=require('fs');var fs_extra=require(_0x185f('0x8'));var _=require(_0x185f('0x9'));var squel=require(_0x185f('0xa'));var crypto=require('crypto');var jsforce=require(_0x185f('0xb'));var deskjs=require(_0x185f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x185f('0xd'));var Papa=require(_0x185f('0xe'));var Redis=require(_0x185f('0xf'));var authService=require(_0x185f('0x10'));var qs=require(_0x185f('0x11'));var as=require(_0x185f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x185f('0x13'))(_0x185f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x185f('0x15'));var db=require(_0x185f('0x16'))['db'];function respondWithStatusCode(_0x4f163e,_0x4778c9){_0x4778c9=_0x4778c9||0xcc;return function(_0x22116f){if(_0x22116f){return _0x4f163e[_0x185f('0x17')](_0x4778c9);}return _0x4f163e[_0x185f('0x18')](_0x4778c9)[_0x185f('0x19')]();};}function respondWithResult(_0x412498,_0x11d014){_0x11d014=_0x11d014||0xc8;return function(_0x1b86bb){if(_0x1b86bb){return _0x412498[_0x185f('0x18')](_0x11d014)[_0x185f('0x1a')](_0x1b86bb);}};}function respondWithFilteredResult(_0x56eeec,_0x19ec56){return function(_0x3a3471){if(_0x3a3471){var _0x56d8e4=typeof _0x19ec56[_0x185f('0x1b')]===_0x185f('0x1c')&&typeof _0x19ec56[_0x185f('0x1d')]===_0x185f('0x1c');var _0x5e97b5=_0x3a3471[_0x185f('0x1e')];var _0x400c84=_0x56d8e4?0x0:_0x19ec56['offset'];var _0x1b6d63=_0x56d8e4?_0x3a3471['count']:_0x19ec56[_0x185f('0x1b')]+_0x19ec56[_0x185f('0x1d')];var _0x15d2b2;if(_0x1b6d63>=_0x5e97b5){_0x1b6d63=_0x5e97b5;_0x15d2b2=0xc8;}else{_0x15d2b2=0xce;}_0x56eeec[_0x185f('0x18')](_0x15d2b2);return _0x56eeec[_0x185f('0x1f')](_0x185f('0x20'),_0x400c84+'-'+_0x1b6d63+'/'+_0x5e97b5)[_0x185f('0x1a')](_0x3a3471);}return null;};}function patchUpdates(_0x5a0baf){return function(_0x4dfded){try{jsonpatch[_0x185f('0x21')](_0x4dfded,_0x5a0baf,!![]);}catch(_0x89896f){return BPromise[_0x185f('0x22')](_0x89896f);}return _0x4dfded[_0x185f('0x23')]();};}function saveUpdates(_0x5d3f59,_0x36ce13){return function(_0x4e3beb){if(_0x4e3beb){return _0x4e3beb[_0x185f('0x24')](_0x5d3f59)[_0x185f('0x25')](function(_0x242ef6){return _0x242ef6;});}return null;};}function removeEntity(_0x29818e,_0x13e66f){return function(_0x41b1a7){if(_0x41b1a7){return _0x41b1a7[_0x185f('0x26')]()[_0x185f('0x25')](function(){_0x29818e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a52b8,_0x453f7f){return function(_0x4c1c0d){if(!_0x4c1c0d){_0x3a52b8[_0x185f('0x17')](0x194);}return _0x4c1c0d;};}function handleError(_0x59aae1,_0x3b3d77){_0x3b3d77=_0x3b3d77||0x1f4;return function(_0x294ad3){logger[_0x185f('0x27')](_0x294ad3[_0x185f('0x28')]);if(_0x294ad3[_0x185f('0x29')]){delete _0x294ad3[_0x185f('0x29')];}_0x59aae1[_0x185f('0x18')](_0x3b3d77)[_0x185f('0x2a')](_0x294ad3);};}exports[_0x185f('0x2b')]=function(_0x1d6ed8,_0x154c8f){var _0x414f30={},_0x4bfeb4={},_0x49b86c={'count':0x0,'rows':[]};var _0x57d98d=_['map'](db['SalesforceConfiguration'][_0x185f('0x2c')],function(_0x2bd10b){return{'name':_0x2bd10b[_0x185f('0x2d')],'type':_0x2bd10b['type'][_0x185f('0x2e')]};});_0x4bfeb4[_0x185f('0x2f')]=_['map'](_0x57d98d,_0x185f('0x29'));_0x4bfeb4[_0x185f('0x30')]=_[_0x185f('0x31')](_0x1d6ed8[_0x185f('0x30')]);_0x4bfeb4[_0x185f('0x32')]=_[_0x185f('0x33')](_0x4bfeb4['model'],_0x4bfeb4['query']);_0x414f30[_0x185f('0x34')]=_[_0x185f('0x33')](_0x4bfeb4[_0x185f('0x2f')],qs[_0x185f('0x35')](_0x1d6ed8[_0x185f('0x30')][_0x185f('0x35')]));_0x414f30['attributes']=_0x414f30[_0x185f('0x34')][_0x185f('0x36')]?_0x414f30[_0x185f('0x34')]:_0x4bfeb4['model'];if(!_0x1d6ed8['query'][_0x185f('0x37')](_0x185f('0x38'))){_0x414f30[_0x185f('0x1d')]=qs[_0x185f('0x1d')](_0x1d6ed8[_0x185f('0x30')][_0x185f('0x1d')]);_0x414f30[_0x185f('0x1b')]=qs[_0x185f('0x1b')](_0x1d6ed8[_0x185f('0x30')][_0x185f('0x1b')]);}_0x414f30['order']=qs['sort'](_0x1d6ed8[_0x185f('0x30')][_0x185f('0x39')]);_0x414f30['where']=qs[_0x185f('0x32')](_[_0x185f('0x3a')](_0x1d6ed8[_0x185f('0x30')],_0x4bfeb4[_0x185f('0x32')]),_0x57d98d);if(_0x1d6ed8['query'][_0x185f('0x3b')]){_0x414f30[_0x185f('0x3c')]=_[_0x185f('0x3d')](_0x414f30[_0x185f('0x3c')],{'$or':_['map'](_0x57d98d,function(_0x2cc15a){if(_0x2cc15a[_0x185f('0x3e')]!==_0x185f('0x3f')){var _0x47c2d3={};_0x47c2d3[_0x2cc15a[_0x185f('0x29')]]={'$like':'%'+_0x1d6ed8[_0x185f('0x30')]['filter']+'%'};return _0x47c2d3;}})});}_0x414f30=_['merge']({},_0x414f30,_0x1d6ed8[_0x185f('0x40')]);var _0x3e8b51={'where':_0x414f30[_0x185f('0x3c')]};return db['SalesforceConfiguration'][_0x185f('0x1e')](_0x3e8b51)['then'](function(_0x4d29fa){_0x49b86c['count']=_0x4d29fa;if(_0x1d6ed8[_0x185f('0x30')][_0x185f('0x41')]){_0x414f30['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x185f('0x42')](_0x414f30);})[_0x185f('0x25')](function(_0xc44343){_0x49b86c[_0x185f('0x43')]=_0xc44343;return _0x49b86c;})[_0x185f('0x25')](respondWithFilteredResult(_0x154c8f,_0x414f30))['catch'](handleError(_0x154c8f,null));};exports[_0x185f('0x44')]=function(_0x26d775,_0x7b10f1){var _0x23f85c={'raw':![],'where':{'id':_0x26d775[_0x185f('0x45')]['id']}},_0x446593={};_0x446593[_0x185f('0x2f')]=_[_0x185f('0x31')](db[_0x185f('0x46')][_0x185f('0x2c')]);_0x446593['query']=_['keys'](_0x26d775[_0x185f('0x30')]);_0x446593[_0x185f('0x32')]=_[_0x185f('0x33')](_0x446593[_0x185f('0x2f')],_0x446593[_0x185f('0x30')]);_0x23f85c[_0x185f('0x34')]=_[_0x185f('0x33')](_0x446593[_0x185f('0x2f')],qs[_0x185f('0x35')](_0x26d775['query'][_0x185f('0x35')]));_0x23f85c[_0x185f('0x34')]=_0x23f85c['attributes']['length']?_0x23f85c[_0x185f('0x34')]:_0x446593[_0x185f('0x2f')];if(_0x26d775[_0x185f('0x30')][_0x185f('0x41')]){_0x23f85c[_0x185f('0x47')]=[{'all':!![]}];}_0x23f85c=_[_0x185f('0x3d')]({},_0x23f85c,_0x26d775['options']);return db['SalesforceConfiguration']['find'](_0x23f85c)['then'](handleEntityNotFound(_0x7b10f1,null))[_0x185f('0x25')](respondWithResult(_0x7b10f1,null))[_0x185f('0x48')](handleError(_0x7b10f1,null));};exports[_0x185f('0x49')]=function(_0x500309,_0x2f451c){return db[_0x185f('0x46')][_0x185f('0x49')](_0x500309[_0x185f('0x4a')],{})[_0x185f('0x25')](respondWithResult(_0x2f451c,0xc9))['catch'](handleError(_0x2f451c,null));};exports['update']=function(_0x372b49,_0x4886ef){if(_0x372b49['body']['id']){delete _0x372b49['body']['id'];}return db['SalesforceConfiguration'][_0x185f('0x4b')]({'where':{'id':_0x372b49['params']['id']}})[_0x185f('0x25')](handleEntityNotFound(_0x4886ef,null))[_0x185f('0x25')](saveUpdates(_0x372b49['body'],null))['then'](respondWithResult(_0x4886ef,null))[_0x185f('0x48')](handleError(_0x4886ef,null));};exports[_0x185f('0x26')]=function(_0x3607ed,_0x2dcb00){return db['SalesforceConfiguration'][_0x185f('0x4b')]({'where':{'id':_0x3607ed[_0x185f('0x45')]['id']}})[_0x185f('0x25')](handleEntityNotFound(_0x2dcb00,null))[_0x185f('0x25')](removeEntity(_0x2dcb00,null))['catch'](handleError(_0x2dcb00,null));};exports[_0x185f('0x4c')]=function(_0x31b3c8,_0x2b90d9,_0x311ec3){var _0x2d2e8b={};var _0xdfe5b0={};var _0x54b988;var _0x492bc6;return db[_0x185f('0x46')]['findOne']({'where':{'id':_0x31b3c8['params']['id']}})[_0x185f('0x25')](handleEntityNotFound(_0x2b90d9,null))['then'](function(_0x421270){if(_0x421270){_0x54b988=_0x421270;_0xdfe5b0[_0x185f('0x2f')]=_[_0x185f('0x31')](db[_0x185f('0x4d')][_0x185f('0x2c')]);_0xdfe5b0[_0x185f('0x30')]=_[_0x185f('0x31')](_0x31b3c8[_0x185f('0x30')]);_0xdfe5b0[_0x185f('0x32')]=_['intersection'](_0xdfe5b0[_0x185f('0x2f')],_0xdfe5b0[_0x185f('0x30')]);_0x2d2e8b[_0x185f('0x34')]=_[_0x185f('0x33')](_0xdfe5b0[_0x185f('0x2f')],qs['fields'](_0x31b3c8[_0x185f('0x30')][_0x185f('0x35')]));_0x2d2e8b[_0x185f('0x34')]=_0x2d2e8b[_0x185f('0x34')][_0x185f('0x36')]?_0x2d2e8b[_0x185f('0x34')]:_0xdfe5b0[_0x185f('0x2f')];_0x2d2e8b[_0x185f('0x4e')]=qs['sort'](_0x31b3c8['query'][_0x185f('0x39')]);_0x2d2e8b[_0x185f('0x3c')]=qs[_0x185f('0x32')](_[_0x185f('0x3a')](_0x31b3c8['query'],_0xdfe5b0[_0x185f('0x32')]));if(_0x31b3c8[_0x185f('0x30')][_0x185f('0x3b')]){_0x2d2e8b[_0x185f('0x3c')]=_[_0x185f('0x3d')](_0x2d2e8b[_0x185f('0x3c')],{'$or':_[_0x185f('0x4f')](_0x2d2e8b[_0x185f('0x34')],function(_0x105603){var _0x10aea1={};_0x10aea1[_0x105603]={'$like':'%'+_0x31b3c8[_0x185f('0x30')][_0x185f('0x3b')]+'%'};return _0x10aea1;})});}_0x2d2e8b=_['merge']({},_0x2d2e8b,_0x31b3c8[_0x185f('0x40')]);return _0x54b988['getFields'](_0x2d2e8b);}})['then'](function(_0x393309){if(_0x393309){_0x492bc6=_0x393309[_0x185f('0x36')];if(!_0x31b3c8[_0x185f('0x30')][_0x185f('0x37')]('nolimit')){_0x2d2e8b['limit']=qs[_0x185f('0x1d')](_0x31b3c8[_0x185f('0x30')]['limit']);_0x2d2e8b[_0x185f('0x1b')]=qs[_0x185f('0x1b')](_0x31b3c8[_0x185f('0x30')][_0x185f('0x1b')]);}return _0x54b988[_0x185f('0x4c')](_0x2d2e8b);}})[_0x185f('0x25')](function(_0xb9e6dd){if(_0xb9e6dd){return _0xb9e6dd?{'count':_0x492bc6,'rows':_0xb9e6dd}:null;}})[_0x185f('0x25')](respondWithResult(_0x2b90d9,null))[_0x185f('0x48')](handleError(_0x2b90d9,null));};exports[_0x185f('0x50')]=function(_0x255ff0,_0x42182c,_0x7c4333){var _0x1e9cb1={};var _0x3d9c97={};var _0x423223;var _0x500f93;return db[_0x185f('0x46')][_0x185f('0x51')]({'where':{'id':_0x255ff0[_0x185f('0x45')]['id']}})[_0x185f('0x25')](handleEntityNotFound(_0x42182c,null))[_0x185f('0x25')](function(_0x2fdd97){if(_0x2fdd97){_0x423223=_0x2fdd97;_0x3d9c97[_0x185f('0x2f')]=_['keys'](db[_0x185f('0x4d')][_0x185f('0x2c')]);_0x3d9c97[_0x185f('0x30')]=_[_0x185f('0x31')](_0x255ff0['query']);_0x3d9c97[_0x185f('0x32')]=_[_0x185f('0x33')](_0x3d9c97['model'],_0x3d9c97[_0x185f('0x30')]);_0x1e9cb1['attributes']=_['intersection'](_0x3d9c97[_0x185f('0x2f')],qs[_0x185f('0x35')](_0x255ff0[_0x185f('0x30')][_0x185f('0x35')]));_0x1e9cb1[_0x185f('0x34')]=_0x1e9cb1[_0x185f('0x34')][_0x185f('0x36')]?_0x1e9cb1[_0x185f('0x34')]:_0x3d9c97[_0x185f('0x2f')];_0x1e9cb1[_0x185f('0x4e')]=qs[_0x185f('0x39')](_0x255ff0[_0x185f('0x30')][_0x185f('0x39')]);_0x1e9cb1['where']=qs[_0x185f('0x32')](_[_0x185f('0x3a')](_0x255ff0[_0x185f('0x30')],_0x3d9c97[_0x185f('0x32')]));if(_0x255ff0['query'][_0x185f('0x3b')]){_0x1e9cb1[_0x185f('0x3c')]=_[_0x185f('0x3d')](_0x1e9cb1['where'],{'$or':_[_0x185f('0x4f')](_0x1e9cb1[_0x185f('0x34')],function(_0x16f66d){var _0x1cc129={};_0x1cc129[_0x16f66d]={'$like':'%'+_0x255ff0[_0x185f('0x30')][_0x185f('0x3b')]+'%'};return _0x1cc129;})});}_0x1e9cb1=_[_0x185f('0x3d')]({},_0x1e9cb1,_0x255ff0['options']);return _0x423223[_0x185f('0x50')](_0x1e9cb1);}})[_0x185f('0x25')](function(_0x528df7){if(_0x528df7){_0x500f93=_0x528df7['length'];if(!_0x255ff0[_0x185f('0x30')]['hasOwnProperty'](_0x185f('0x38'))){_0x1e9cb1[_0x185f('0x1d')]=qs['limit'](_0x255ff0[_0x185f('0x30')]['limit']);_0x1e9cb1[_0x185f('0x1b')]=qs['offset'](_0x255ff0['query'][_0x185f('0x1b')]);}return _0x423223[_0x185f('0x50')](_0x1e9cb1);}})[_0x185f('0x25')](function(_0x17b8e3){if(_0x17b8e3){return _0x17b8e3?{'count':_0x500f93,'rows':_0x17b8e3}:null;}})[_0x185f('0x25')](respondWithResult(_0x42182c,null))[_0x185f('0x48')](handleError(_0x42182c,null));};exports[_0x185f('0x52')]=function(_0x5b8cd6,_0xab39f1,_0x43ffca){var _0x41b528={};var _0x3b6307={};var _0x597f42;var _0x34b7cb;return db[_0x185f('0x46')][_0x185f('0x51')]({'where':{'id':_0x5b8cd6['params']['id']}})[_0x185f('0x25')](handleEntityNotFound(_0xab39f1,null))[_0x185f('0x25')](function(_0x22eee4){if(_0x22eee4){_0x597f42=_0x22eee4;_0x3b6307[_0x185f('0x2f')]=_['keys'](db[_0x185f('0x4d')][_0x185f('0x2c')]);_0x3b6307[_0x185f('0x30')]=_[_0x185f('0x31')](_0x5b8cd6[_0x185f('0x30')]);_0x3b6307['filters']=_[_0x185f('0x33')](_0x3b6307[_0x185f('0x2f')],_0x3b6307[_0x185f('0x30')]);_0x41b528[_0x185f('0x34')]=_['intersection'](_0x3b6307['model'],qs['fields'](_0x5b8cd6['query']['fields']));_0x41b528[_0x185f('0x34')]=_0x41b528['attributes'][_0x185f('0x36')]?_0x41b528['attributes']:_0x3b6307[_0x185f('0x2f')];_0x41b528[_0x185f('0x4e')]=qs[_0x185f('0x39')](_0x5b8cd6[_0x185f('0x30')][_0x185f('0x39')]);_0x41b528['where']=qs[_0x185f('0x32')](_['pick'](_0x5b8cd6[_0x185f('0x30')],_0x3b6307[_0x185f('0x32')]));if(_0x5b8cd6[_0x185f('0x30')][_0x185f('0x3b')]){_0x41b528[_0x185f('0x3c')]=_[_0x185f('0x3d')](_0x41b528[_0x185f('0x3c')],{'$or':_[_0x185f('0x4f')](_0x41b528[_0x185f('0x34')],function(_0x23c006){var _0x1dd44c={};_0x1dd44c[_0x23c006]={'$like':'%'+_0x5b8cd6[_0x185f('0x30')][_0x185f('0x3b')]+'%'};return _0x1dd44c;})});}_0x41b528=_['merge']({},_0x41b528,_0x5b8cd6['options']);return _0x597f42[_0x185f('0x52')](_0x41b528);}})[_0x185f('0x25')](function(_0x4cbae8){if(_0x4cbae8){_0x34b7cb=_0x4cbae8[_0x185f('0x36')];if(!_0x5b8cd6['query'][_0x185f('0x37')]('nolimit')){_0x41b528[_0x185f('0x1d')]=qs[_0x185f('0x1d')](_0x5b8cd6[_0x185f('0x30')][_0x185f('0x1d')]);_0x41b528[_0x185f('0x1b')]=qs['offset'](_0x5b8cd6[_0x185f('0x30')][_0x185f('0x1b')]);}return _0x597f42[_0x185f('0x52')](_0x41b528);}})['then'](function(_0x99f232){if(_0x99f232){return _0x99f232?{'count':_0x34b7cb,'rows':_0x99f232}:null;}})[_0x185f('0x25')](respondWithResult(_0xab39f1,null))[_0x185f('0x48')](handleError(_0xab39f1,null));};
\ No newline at end of file
+var _0x4832=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','getFields','findOne','SalesforceField','length','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x21af22,_0x3b5456){var _0x4f3f34=function(_0x399432){while(--_0x399432){_0x21af22['push'](_0x21af22['shift']());}};_0x4f3f34(++_0x3b5456);}(_0x4832,0x183));var _0x2483=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x4832[_0x254b22];return _0x1279db;};'use strict';var emlformat=require(_0x2483('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2483('0x1'));var jsonpatch=require(_0x2483('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2483('0x3'));var Mustache=require(_0x2483('0x4'));var util=require(_0x2483('0x5'));var path=require(_0x2483('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2483('0x7'));var fs=require('fs');var fs_extra=require(_0x2483('0x8'));var _=require(_0x2483('0x9'));var squel=require('squel');var crypto=require(_0x2483('0xa'));var jsforce=require(_0x2483('0xb'));var deskjs=require(_0x2483('0xc'));var toCsv=require(_0x2483('0xd'));var querystring=require(_0x2483('0xe'));var Papa=require('papaparse');var Redis=require(_0x2483('0xf'));var authService=require(_0x2483('0x10'));var qs=require(_0x2483('0x11'));var as=require(_0x2483('0x12'));var hardwareService=require(_0x2483('0x13'));var logger=require('../../config/logger')(_0x2483('0x14'));var utils=require(_0x2483('0x15'));var config=require(_0x2483('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2483('0x17'))['db'];function respondWithStatusCode(_0x2e7eac,_0x15df8e){_0x15df8e=_0x15df8e||0xcc;return function(_0x3a136c){if(_0x3a136c){return _0x2e7eac[_0x2483('0x18')](_0x15df8e);}return _0x2e7eac[_0x2483('0x19')](_0x15df8e)['end']();};}function respondWithResult(_0x20c40d,_0x49b16f){_0x49b16f=_0x49b16f||0xc8;return function(_0x2a66a5){if(_0x2a66a5){return _0x20c40d[_0x2483('0x19')](_0x49b16f)[_0x2483('0x1a')](_0x2a66a5);}};}function respondWithFilteredResult(_0x371145,_0x6a6aeb){return function(_0x115227){if(_0x115227){var _0x31ad09=typeof _0x6a6aeb[_0x2483('0x1b')]===_0x2483('0x1c')&&typeof _0x6a6aeb[_0x2483('0x1d')]===_0x2483('0x1c');var _0x374245=_0x115227[_0x2483('0x1e')];var _0x1f9892=_0x31ad09?0x0:_0x6a6aeb[_0x2483('0x1b')];var _0xad1bd3=_0x31ad09?_0x115227['count']:_0x6a6aeb[_0x2483('0x1b')]+_0x6a6aeb[_0x2483('0x1d')];var _0x35f07f;if(_0xad1bd3>=_0x374245){_0xad1bd3=_0x374245;_0x35f07f=0xc8;}else{_0x35f07f=0xce;}_0x371145['status'](_0x35f07f);return _0x371145[_0x2483('0x1f')](_0x2483('0x20'),_0x1f9892+'-'+_0xad1bd3+'/'+_0x374245)[_0x2483('0x1a')](_0x115227);}return null;};}function patchUpdates(_0x2f91c3){return function(_0x3f5c28){try{jsonpatch[_0x2483('0x21')](_0x3f5c28,_0x2f91c3,!![]);}catch(_0x412783){return BPromise[_0x2483('0x22')](_0x412783);}return _0x3f5c28[_0x2483('0x23')]();};}function saveUpdates(_0x363540,_0x2ba5e0){return function(_0x10d422){if(_0x10d422){return _0x10d422['update'](_0x363540)['then'](function(_0x3ac3ca){return _0x3ac3ca;});}return null;};}function removeEntity(_0x39584d,_0x3f8ae8){return function(_0x3d31ad){if(_0x3d31ad){return _0x3d31ad[_0x2483('0x24')]()[_0x2483('0x25')](function(){_0x39584d['status'](0xcc)[_0x2483('0x26')]();});}};}function handleEntityNotFound(_0x1762e1,_0x27cb0a){return function(_0x14b8fc){if(!_0x14b8fc){_0x1762e1[_0x2483('0x18')](0x194);}return _0x14b8fc;};}function handleError(_0x596f5d,_0x3e3e5b){_0x3e3e5b=_0x3e3e5b||0x1f4;return function(_0x5ebe34){logger[_0x2483('0x27')](_0x5ebe34[_0x2483('0x28')]);if(_0x5ebe34[_0x2483('0x29')]){delete _0x5ebe34[_0x2483('0x29')];}_0x596f5d[_0x2483('0x19')](_0x3e3e5b)[_0x2483('0x2a')](_0x5ebe34);};}exports['index']=function(_0x2f0622,_0x3b2977){var _0x336f9d={},_0x3191da={},_0x955f69={'count':0x0,'rows':[]};var _0x5034c8=_[_0x2483('0x2b')](db[_0x2483('0x2c')][_0x2483('0x2d')],function(_0x71469f){return{'name':_0x71469f['fieldName'],'type':_0x71469f[_0x2483('0x2e')][_0x2483('0x2f')]};});_0x3191da[_0x2483('0x30')]=_[_0x2483('0x2b')](_0x5034c8,_0x2483('0x29'));_0x3191da[_0x2483('0x31')]=_[_0x2483('0x32')](_0x2f0622[_0x2483('0x31')]);_0x3191da[_0x2483('0x33')]=_['intersection'](_0x3191da[_0x2483('0x30')],_0x3191da[_0x2483('0x31')]);_0x336f9d['attributes']=_[_0x2483('0x34')](_0x3191da[_0x2483('0x30')],qs[_0x2483('0x35')](_0x2f0622[_0x2483('0x31')][_0x2483('0x35')]));_0x336f9d['attributes']=_0x336f9d[_0x2483('0x36')]['length']?_0x336f9d[_0x2483('0x36')]:_0x3191da[_0x2483('0x30')];if(!_0x2f0622['query'][_0x2483('0x37')](_0x2483('0x38'))){_0x336f9d[_0x2483('0x1d')]=qs[_0x2483('0x1d')](_0x2f0622[_0x2483('0x31')][_0x2483('0x1d')]);_0x336f9d['offset']=qs[_0x2483('0x1b')](_0x2f0622[_0x2483('0x31')][_0x2483('0x1b')]);}_0x336f9d[_0x2483('0x39')]=qs[_0x2483('0x3a')](_0x2f0622['query'][_0x2483('0x3a')]);_0x336f9d[_0x2483('0x3b')]=qs[_0x2483('0x33')](_[_0x2483('0x3c')](_0x2f0622[_0x2483('0x31')],_0x3191da[_0x2483('0x33')]),_0x5034c8);if(_0x2f0622[_0x2483('0x31')][_0x2483('0x3d')]){_0x336f9d['where']=_['merge'](_0x336f9d['where'],{'$or':_[_0x2483('0x2b')](_0x5034c8,function(_0x3d1256){if(_0x3d1256[_0x2483('0x2e')]!==_0x2483('0x3e')){var _0x1c90cd={};_0x1c90cd[_0x3d1256[_0x2483('0x29')]]={'$like':'%'+_0x2f0622[_0x2483('0x31')][_0x2483('0x3d')]+'%'};return _0x1c90cd;}})});}_0x336f9d=_[_0x2483('0x3f')]({},_0x336f9d,_0x2f0622[_0x2483('0x40')]);var _0x5c0cac={'where':_0x336f9d['where']};return db[_0x2483('0x2c')][_0x2483('0x1e')](_0x5c0cac)[_0x2483('0x25')](function(_0x3e18ec){_0x955f69['count']=_0x3e18ec;if(_0x2f0622[_0x2483('0x31')][_0x2483('0x41')]){_0x336f9d[_0x2483('0x42')]=[{'all':!![]}];}return db[_0x2483('0x2c')][_0x2483('0x43')](_0x336f9d);})[_0x2483('0x25')](function(_0x4e5d76){_0x955f69[_0x2483('0x44')]=_0x4e5d76;return _0x955f69;})[_0x2483('0x25')](respondWithFilteredResult(_0x3b2977,_0x336f9d))[_0x2483('0x45')](handleError(_0x3b2977,null));};exports['show']=function(_0xcd0a9c,_0x296812){var _0x1253be={'raw':![],'where':{'id':_0xcd0a9c['params']['id']}},_0x23c736={};_0x23c736[_0x2483('0x30')]=_[_0x2483('0x32')](db[_0x2483('0x2c')][_0x2483('0x2d')]);_0x23c736['query']=_['keys'](_0xcd0a9c[_0x2483('0x31')]);_0x23c736[_0x2483('0x33')]=_['intersection'](_0x23c736['model'],_0x23c736[_0x2483('0x31')]);_0x1253be['attributes']=_[_0x2483('0x34')](_0x23c736[_0x2483('0x30')],qs[_0x2483('0x35')](_0xcd0a9c[_0x2483('0x31')][_0x2483('0x35')]));_0x1253be[_0x2483('0x36')]=_0x1253be['attributes']['length']?_0x1253be[_0x2483('0x36')]:_0x23c736[_0x2483('0x30')];if(_0xcd0a9c[_0x2483('0x31')][_0x2483('0x41')]){_0x1253be[_0x2483('0x42')]=[{'all':!![]}];}_0x1253be=_[_0x2483('0x3f')]({},_0x1253be,_0xcd0a9c[_0x2483('0x40')]);return db[_0x2483('0x2c')][_0x2483('0x46')](_0x1253be)['then'](handleEntityNotFound(_0x296812,null))[_0x2483('0x25')](respondWithResult(_0x296812,null))[_0x2483('0x45')](handleError(_0x296812,null));};exports[_0x2483('0x47')]=function(_0x1c92db,_0x2e0969){return db['SalesforceConfiguration'][_0x2483('0x47')](_0x1c92db[_0x2483('0x48')],{})[_0x2483('0x25')](respondWithResult(_0x2e0969,0xc9))['catch'](handleError(_0x2e0969,null));};exports[_0x2483('0x49')]=function(_0x56bb66,_0x52e2ce){if(_0x56bb66[_0x2483('0x48')]['id']){delete _0x56bb66[_0x2483('0x48')]['id'];}return db[_0x2483('0x2c')][_0x2483('0x46')]({'where':{'id':_0x56bb66[_0x2483('0x4a')]['id']}})[_0x2483('0x25')](handleEntityNotFound(_0x52e2ce,null))[_0x2483('0x25')](saveUpdates(_0x56bb66[_0x2483('0x48')],null))[_0x2483('0x25')](respondWithResult(_0x52e2ce,null))['catch'](handleError(_0x52e2ce,null));};exports['destroy']=function(_0x731047,_0x38c684){return db['SalesforceConfiguration']['find']({'where':{'id':_0x731047['params']['id']}})[_0x2483('0x25')](handleEntityNotFound(_0x38c684,null))[_0x2483('0x25')](removeEntity(_0x38c684,null))[_0x2483('0x45')](handleError(_0x38c684,null));};exports[_0x2483('0x4b')]=function(_0x21ed47,_0x528f7a,_0x201ffb){var _0x49a785={};var _0xe43678={};var _0x5b5dda;var _0x429971;return db[_0x2483('0x2c')][_0x2483('0x4c')]({'where':{'id':_0x21ed47[_0x2483('0x4a')]['id']}})[_0x2483('0x25')](handleEntityNotFound(_0x528f7a,null))[_0x2483('0x25')](function(_0x37587){if(_0x37587){_0x5b5dda=_0x37587;_0xe43678['model']=_[_0x2483('0x32')](db[_0x2483('0x4d')][_0x2483('0x2d')]);_0xe43678[_0x2483('0x31')]=_[_0x2483('0x32')](_0x21ed47[_0x2483('0x31')]);_0xe43678[_0x2483('0x33')]=_[_0x2483('0x34')](_0xe43678[_0x2483('0x30')],_0xe43678['query']);_0x49a785[_0x2483('0x36')]=_[_0x2483('0x34')](_0xe43678['model'],qs[_0x2483('0x35')](_0x21ed47[_0x2483('0x31')][_0x2483('0x35')]));_0x49a785[_0x2483('0x36')]=_0x49a785[_0x2483('0x36')][_0x2483('0x4e')]?_0x49a785[_0x2483('0x36')]:_0xe43678['model'];_0x49a785[_0x2483('0x39')]=qs[_0x2483('0x3a')](_0x21ed47[_0x2483('0x31')][_0x2483('0x3a')]);_0x49a785[_0x2483('0x3b')]=qs[_0x2483('0x33')](_[_0x2483('0x3c')](_0x21ed47[_0x2483('0x31')],_0xe43678[_0x2483('0x33')]));if(_0x21ed47['query']['filter']){_0x49a785[_0x2483('0x3b')]=_[_0x2483('0x3f')](_0x49a785[_0x2483('0x3b')],{'$or':_[_0x2483('0x2b')](_0x49a785[_0x2483('0x36')],function(_0x5db251){var _0xadd368={};_0xadd368[_0x5db251]={'$like':'%'+_0x21ed47['query'][_0x2483('0x3d')]+'%'};return _0xadd368;})});}_0x49a785=_[_0x2483('0x3f')]({},_0x49a785,_0x21ed47[_0x2483('0x40')]);return _0x5b5dda[_0x2483('0x4b')](_0x49a785);}})[_0x2483('0x25')](function(_0x5a718b){if(_0x5a718b){_0x429971=_0x5a718b[_0x2483('0x4e')];if(!_0x21ed47[_0x2483('0x31')][_0x2483('0x37')](_0x2483('0x38'))){_0x49a785[_0x2483('0x1d')]=qs[_0x2483('0x1d')](_0x21ed47[_0x2483('0x31')][_0x2483('0x1d')]);_0x49a785[_0x2483('0x1b')]=qs[_0x2483('0x1b')](_0x21ed47[_0x2483('0x31')][_0x2483('0x1b')]);}return _0x5b5dda[_0x2483('0x4b')](_0x49a785);}})[_0x2483('0x25')](function(_0x3f6998){if(_0x3f6998){return _0x3f6998?{'count':_0x429971,'rows':_0x3f6998}:null;}})[_0x2483('0x25')](respondWithResult(_0x528f7a,null))[_0x2483('0x45')](handleError(_0x528f7a,null));};exports[_0x2483('0x4f')]=function(_0x8aaf2d,_0x5da98c,_0x226af8){var _0x788a96={};var _0x37d0b={};var _0x283e8c;var _0x242bdc;return db[_0x2483('0x2c')]['findOne']({'where':{'id':_0x8aaf2d[_0x2483('0x4a')]['id']}})[_0x2483('0x25')](handleEntityNotFound(_0x5da98c,null))[_0x2483('0x25')](function(_0x4532ab){if(_0x4532ab){_0x283e8c=_0x4532ab;_0x37d0b[_0x2483('0x30')]=_[_0x2483('0x32')](db[_0x2483('0x4d')]['rawAttributes']);_0x37d0b['query']=_[_0x2483('0x32')](_0x8aaf2d['query']);_0x37d0b[_0x2483('0x33')]=_['intersection'](_0x37d0b[_0x2483('0x30')],_0x37d0b['query']);_0x788a96[_0x2483('0x36')]=_[_0x2483('0x34')](_0x37d0b[_0x2483('0x30')],qs[_0x2483('0x35')](_0x8aaf2d['query'][_0x2483('0x35')]));_0x788a96[_0x2483('0x36')]=_0x788a96[_0x2483('0x36')][_0x2483('0x4e')]?_0x788a96[_0x2483('0x36')]:_0x37d0b['model'];_0x788a96['order']=qs[_0x2483('0x3a')](_0x8aaf2d[_0x2483('0x31')][_0x2483('0x3a')]);_0x788a96['where']=qs[_0x2483('0x33')](_[_0x2483('0x3c')](_0x8aaf2d[_0x2483('0x31')],_0x37d0b[_0x2483('0x33')]));if(_0x8aaf2d[_0x2483('0x31')][_0x2483('0x3d')]){_0x788a96[_0x2483('0x3b')]=_[_0x2483('0x3f')](_0x788a96[_0x2483('0x3b')],{'$or':_[_0x2483('0x2b')](_0x788a96[_0x2483('0x36')],function(_0x3f2a26){var _0x35df1d={};_0x35df1d[_0x3f2a26]={'$like':'%'+_0x8aaf2d[_0x2483('0x31')][_0x2483('0x3d')]+'%'};return _0x35df1d;})});}_0x788a96=_[_0x2483('0x3f')]({},_0x788a96,_0x8aaf2d[_0x2483('0x40')]);return _0x283e8c[_0x2483('0x4f')](_0x788a96);}})['then'](function(_0x3a1fd4){if(_0x3a1fd4){_0x242bdc=_0x3a1fd4[_0x2483('0x4e')];if(!_0x8aaf2d[_0x2483('0x31')][_0x2483('0x37')](_0x2483('0x38'))){_0x788a96[_0x2483('0x1d')]=qs[_0x2483('0x1d')](_0x8aaf2d['query'][_0x2483('0x1d')]);_0x788a96[_0x2483('0x1b')]=qs[_0x2483('0x1b')](_0x8aaf2d[_0x2483('0x31')][_0x2483('0x1b')]);}return _0x283e8c[_0x2483('0x4f')](_0x788a96);}})[_0x2483('0x25')](function(_0xa97161){if(_0xa97161){return _0xa97161?{'count':_0x242bdc,'rows':_0xa97161}:null;}})['then'](respondWithResult(_0x5da98c,null))[_0x2483('0x45')](handleError(_0x5da98c,null));};exports['getDescriptions']=function(_0x3d0bb8,_0x5d87b0,_0x2307a2){var _0x2f6a29={};var _0x3f6631={};var _0x11f348;var _0x150803;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3d0bb8[_0x2483('0x4a')]['id']}})[_0x2483('0x25')](handleEntityNotFound(_0x5d87b0,null))[_0x2483('0x25')](function(_0x342eca){if(_0x342eca){_0x11f348=_0x342eca;_0x3f6631[_0x2483('0x30')]=_[_0x2483('0x32')](db[_0x2483('0x4d')][_0x2483('0x2d')]);_0x3f6631[_0x2483('0x31')]=_['keys'](_0x3d0bb8[_0x2483('0x31')]);_0x3f6631['filters']=_['intersection'](_0x3f6631[_0x2483('0x30')],_0x3f6631[_0x2483('0x31')]);_0x2f6a29[_0x2483('0x36')]=_[_0x2483('0x34')](_0x3f6631['model'],qs[_0x2483('0x35')](_0x3d0bb8[_0x2483('0x31')]['fields']));_0x2f6a29[_0x2483('0x36')]=_0x2f6a29[_0x2483('0x36')][_0x2483('0x4e')]?_0x2f6a29['attributes']:_0x3f6631['model'];_0x2f6a29[_0x2483('0x39')]=qs['sort'](_0x3d0bb8[_0x2483('0x31')]['sort']);_0x2f6a29[_0x2483('0x3b')]=qs['filters'](_[_0x2483('0x3c')](_0x3d0bb8[_0x2483('0x31')],_0x3f6631[_0x2483('0x33')]));if(_0x3d0bb8[_0x2483('0x31')][_0x2483('0x3d')]){_0x2f6a29[_0x2483('0x3b')]=_[_0x2483('0x3f')](_0x2f6a29[_0x2483('0x3b')],{'$or':_['map'](_0x2f6a29[_0x2483('0x36')],function(_0x1b2201){var _0x5b6ac8={};_0x5b6ac8[_0x1b2201]={'$like':'%'+_0x3d0bb8[_0x2483('0x31')][_0x2483('0x3d')]+'%'};return _0x5b6ac8;})});}_0x2f6a29=_['merge']({},_0x2f6a29,_0x3d0bb8[_0x2483('0x40')]);return _0x11f348['getDescriptions'](_0x2f6a29);}})['then'](function(_0x312439){if(_0x312439){_0x150803=_0x312439[_0x2483('0x4e')];if(!_0x3d0bb8[_0x2483('0x31')][_0x2483('0x37')](_0x2483('0x38'))){_0x2f6a29['limit']=qs[_0x2483('0x1d')](_0x3d0bb8[_0x2483('0x31')]['limit']);_0x2f6a29[_0x2483('0x1b')]=qs[_0x2483('0x1b')](_0x3d0bb8[_0x2483('0x31')][_0x2483('0x1b')]);}return _0x11f348[_0x2483('0x50')](_0x2f6a29);}})[_0x2483('0x25')](function(_0x785bfc){if(_0x785bfc){return _0x785bfc?{'count':_0x150803,'rows':_0x785bfc}:null;}})[_0x2483('0x25')](respondWithResult(_0x5d87b0,null))['catch'](handleError(_0x5d87b0,null));};
\ No newline at end of file
index aa4e267..9288c2a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa25b=['bluebird','request-promise','rimraf','../../config/environment','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api'];(function(_0x4edc38,_0x26867e){var _0x182c61=function(_0x39c3ed){while(--_0x39c3ed){_0x4edc38['push'](_0x4edc38['shift']());}};_0x182c61(++_0x26867e);}(_0xa25b,0x1ee));var _0xba25=function(_0x2f72a5,_0x123095){_0x2f72a5=_0x2f72a5-0x0;var _0x4a5a20=_0xa25b[_0x2f72a5];return _0x4a5a20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xba25('0x0'))(_0xba25('0x1'));var moment=require('moment');var BPromise=require(_0xba25('0x2'));var rp=require(_0xba25('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba25('0x4'));var config=require(_0xba25('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x296b73,_0x433659){return _0x296b73['define'](_0xba25('0x6'),attributes,{'tableName':_0xba25('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x62ba=['path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','moment','request-promise'];(function(_0x5f124a,_0x34e5d2){var _0x3717c1=function(_0x16e713){while(--_0x16e713){_0x5f124a['push'](_0x5f124a['shift']());}};_0x3717c1(++_0x34e5d2);}(_0x62ba,0x19e));var _0xa62b=function(_0x59d46d,_0x400167){_0x59d46d=_0x59d46d-0x0;var _0x294f37=_0x62ba[_0x59d46d];return _0x294f37;};'use strict';var _=require(_0xa62b('0x0'));var util=require('util');var logger=require(_0xa62b('0x1'))('api');var moment=require(_0xa62b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa62b('0x3'));var fs=require('fs');var path=require(_0xa62b('0x4'));var rimraf=require(_0xa62b('0x5'));var config=require(_0xa62b('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xa62b('0x7')]=function(_0x56fe72,_0x33efd6){return _0x56fe72[_0xa62b('0x8')](_0xa62b('0x9'),attributes,{'tableName':_0xa62b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ce3e73b..548291c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8bb8=['ioredis','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x57522d,_0x457052){var _0x5b51b5=function(_0x59e0b6){while(--_0x59e0b6){_0x57522d['push'](_0x57522d['shift']());}};_0x5b51b5(++_0x457052);}(_0x8bb8,0x1bf));var _0x88bb=function(_0x85f720,_0x813776){_0x85f720=_0x85f720-0x0;var _0x5cba2c=_0x8bb8[_0x85f720];return _0x5cba2c;};'use strict';var _=require(_0x88bb('0x0'));var util=require('util');var moment=require(_0x88bb('0x1'));var BPromise=require(_0x88bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x88bb('0x4'));var jayson=require(_0x88bb('0x5'));var client=jayson[_0x88bb('0x6')][_0x88bb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3db596,_0x18be65,_0x2785bc){return new BPromise(function(_0x55f3a5,_0x39fd64){return client[_0x88bb('0x8')](_0x3db596,_0x2785bc)[_0x88bb('0x9')](function(_0x106336){logger['info'](_0x88bb('0xa'),_0x18be65,'request\x20sent');logger['debug'](_0x88bb('0xb'),_0x18be65,_0x88bb('0xc'),JSON[_0x88bb('0xd')](_0x106336));if(_0x106336[_0x88bb('0xe')]){if(_0x106336['error']['code']===0x1f4){logger[_0x88bb('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18be65,_0x106336['error']['message']);return _0x39fd64(_0x106336[_0x88bb('0xe')][_0x88bb('0xf')]);}logger[_0x88bb('0xe')](_0x88bb('0xa'),_0x18be65,_0x106336[_0x88bb('0xe')][_0x88bb('0xf')]);return _0x55f3a5(_0x106336['error'][_0x88bb('0xf')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x18be65,_0x88bb('0xc'));_0x55f3a5(_0x106336[_0x88bb('0x10')][_0x88bb('0xf')]);}})[_0x88bb('0x11')](function(_0xd45176){logger[_0x88bb('0xe')](_0x88bb('0xa'),_0x18be65,_0xd45176);_0x39fd64(_0xd45176);});});}
\ No newline at end of file
+var _0x3c00=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ab3d3,_0x2514df){var _0x49b7f6=function(_0x2265e0){while(--_0x2265e0){_0x4ab3d3['push'](_0x4ab3d3['shift']());}};_0x49b7f6(++_0x2514df);}(_0x3c00,0xcc));var _0x03c0=function(_0x573dc9,_0x9b60a7){_0x573dc9=_0x573dc9-0x0;var _0x287ece=_0x3c00[_0x573dc9];return _0x287ece;};'use strict';var _=require(_0x03c0('0x0'));var util=require(_0x03c0('0x1'));var moment=require('moment');var BPromise=require(_0x03c0('0x2'));var rs=require(_0x03c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03c0('0x4'))['db'];var utils=require(_0x03c0('0x5'));var logger=require('../../config/logger')(_0x03c0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x03c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8815a7,_0x48fdf7,_0x53af0c){return new BPromise(function(_0x21fd75,_0x1a0e53){return client[_0x03c0('0x8')](_0x8815a7,_0x53af0c)['then'](function(_0x3deb2f){logger['info'](_0x03c0('0x9'),_0x48fdf7,_0x03c0('0xa'));logger[_0x03c0('0xb')](_0x03c0('0xc'),_0x48fdf7,_0x03c0('0xa'),JSON[_0x03c0('0xd')](_0x3deb2f));if(_0x3deb2f[_0x03c0('0xe')]){if(_0x3deb2f[_0x03c0('0xe')][_0x03c0('0xf')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x48fdf7,_0x3deb2f[_0x03c0('0xe')][_0x03c0('0x10')]);return _0x1a0e53(_0x3deb2f[_0x03c0('0xe')][_0x03c0('0x10')]);}logger[_0x03c0('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48fdf7,_0x3deb2f[_0x03c0('0xe')][_0x03c0('0x10')]);return _0x21fd75(_0x3deb2f[_0x03c0('0xe')][_0x03c0('0x10')]);}else{logger[_0x03c0('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48fdf7,_0x03c0('0xa'));_0x21fd75(_0x3deb2f[_0x03c0('0x12')][_0x03c0('0x10')]);}})[_0x03c0('0x13')](function(_0x52cb0f){logger[_0x03c0('0xe')](_0x03c0('0x9'),_0x48fdf7,_0x52cb0f);_0x1a0e53(_0x52cb0f);});});}
\ No newline at end of file
index 42cd60a..1109385 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe94c=['index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xe94c,0x75));var _0xce94=function(_0x57340d,_0x441afb){_0x57340d=_0x57340d-0x0;var _0x2f9677=_0xe94c[_0x57340d];return _0x2f9677;};'use strict';var multer=require(_0xce94('0x0'));var util=require('util');var path=require(_0xce94('0x1'));var timeout=require('connect-timeout');var express=require(_0xce94('0x2'));var router=express[_0xce94('0x3')]();var fs_extra=require(_0xce94('0x4'));var auth=require(_0xce94('0x5'));var interaction=require(_0xce94('0x6'));var config=require(_0xce94('0x7'));var controller=require('./intSalesforceField.controller');router[_0xce94('0x8')]('/',auth['isAuthenticated'](),controller[_0xce94('0x9')]);router[_0xce94('0x8')](_0xce94('0xa'),auth[_0xce94('0xb')](),controller['show']);router[_0xce94('0xc')]('/',auth[_0xce94('0xb')](),controller[_0xce94('0xd')]);router[_0xce94('0xe')](_0xce94('0xa'),auth['isAuthenticated'](),controller[_0xce94('0xf')]);router['delete'](_0xce94('0xa'),auth[_0xce94('0xb')](),controller[_0xce94('0x10')]);module[_0xce94('0x11')]=router;
\ No newline at end of file
+var _0xc1a5=['create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x14ee8e,_0x1d7547){var _0x1d2f47=function(_0x41be29){while(--_0x41be29){_0x14ee8e['push'](_0x14ee8e['shift']());}};_0x1d2f47(++_0x1d7547);}(_0xc1a5,0x1cc));var _0x5c1a=function(_0x439abd,_0x2d3355){_0x439abd=_0x439abd-0x0;var _0xa1effc=_0xc1a5[_0x439abd];return _0xa1effc;};'use strict';var multer=require(_0x5c1a('0x0'));var util=require(_0x5c1a('0x1'));var path=require(_0x5c1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c1a('0x3'));var router=express[_0x5c1a('0x4')]();var fs_extra=require(_0x5c1a('0x5'));var auth=require(_0x5c1a('0x6'));var interaction=require(_0x5c1a('0x7'));var config=require('../../config/environment');var controller=require(_0x5c1a('0x8'));router[_0x5c1a('0x9')]('/',auth['isAuthenticated'](),controller[_0x5c1a('0xa')]);router[_0x5c1a('0x9')](_0x5c1a('0xb'),auth[_0x5c1a('0xc')](),controller[_0x5c1a('0xd')]);router[_0x5c1a('0xe')]('/',auth[_0x5c1a('0xc')](),controller[_0x5c1a('0xf')]);router[_0x5c1a('0x10')](_0x5c1a('0xb'),auth[_0x5c1a('0xc')](),controller[_0x5c1a('0x11')]);router[_0x5c1a('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index d2ae2da..fb58ec0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc03e=['variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xc03e,0x14a));var _0xec03=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xc03e[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xec03('0x0'));module[_0xec03('0x1')]={'type':{'type':Sequelize[_0xec03('0x2')]('string',_0xec03('0x3'),_0xec03('0x4'),_0xec03('0x5'),_0xec03('0x6')),'defaultValue':_0xec03('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec03('0x8')]},'keyType':{'type':Sequelize[_0xec03('0x2')](_0xec03('0x7'),'variable',_0xec03('0x4'))},'keyContent':{'type':Sequelize[_0xec03('0x8')]},'idField':{'type':Sequelize[_0xec03('0x8')]},'variableName':{'type':Sequelize[_0xec03('0x8')]}};
\ No newline at end of file
+var _0x9a9e=['customVariable','sequelize','ENUM','variable','keyValue','picklist','string','STRING'];(function(_0x141c8b,_0x40a89d){var _0xa7d317=function(_0x1380e3){while(--_0x1380e3){_0x141c8b['push'](_0x141c8b['shift']());}};_0xa7d317(++_0x40a89d);}(_0x9a9e,0x91));var _0xe9a9=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x9a9e[_0x480bc8];return _0x28c245;};'use strict';var Sequelize=require(_0xe9a9('0x0'));module['exports']={'type':{'type':Sequelize[_0xe9a9('0x1')]('string',_0xe9a9('0x2'),'customVariable',_0xe9a9('0x3'),_0xe9a9('0x4')),'defaultValue':_0xe9a9('0x5')},'content':{'type':Sequelize[_0xe9a9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe9a9('0x1')](_0xe9a9('0x5'),_0xe9a9('0x2'),_0xe9a9('0x7'))},'keyContent':{'type':Sequelize[_0xe9a9('0x6')]},'idField':{'type':Sequelize[_0xe9a9('0x6')]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 8c7f662..9518a1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3833=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','save','update','then','destroy','error','stack','send','index','map','SalesforceField','rawAttributes','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3835ac,_0x3f5229){var _0x2e53d4=function(_0x2ef71f){while(--_0x2ef71f){_0x3835ac['push'](_0x3835ac['shift']());}};_0x2e53d4(++_0x3f5229);}(_0x3833,0x1b6));var _0x3383=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x3833[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x3383('0x0'));var rimraf=require(_0x3383('0x1'));var zipdir=require(_0x3383('0x2'));var jsonpatch=require(_0x3383('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3383('0x4'));var Mustache=require('mustache');var util=require(_0x3383('0x5'));var path=require(_0x3383('0x6'));var sox=require(_0x3383('0x7'));var csv=require(_0x3383('0x8'));var ejs=require(_0x3383('0x9'));var fs=require('fs');var fs_extra=require(_0x3383('0xa'));var _=require('lodash');var squel=require(_0x3383('0xb'));var crypto=require(_0x3383('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3383('0x8'));var querystring=require(_0x3383('0xd'));var Papa=require(_0x3383('0xe'));var Redis=require('ioredis');var authService=require(_0x3383('0xf'));var qs=require(_0x3383('0x10'));var as=require(_0x3383('0x11'));var hardwareService=require(_0x3383('0x12'));var logger=require(_0x3383('0x13'))('api');var utils=require(_0x3383('0x14'));var config=require(_0x3383('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3383('0x16'))['db'];function respondWithStatusCode(_0x1399e4,_0x406545){_0x406545=_0x406545||0xcc;return function(_0x24363d){if(_0x24363d){return _0x1399e4[_0x3383('0x17')](_0x406545);}return _0x1399e4[_0x3383('0x18')](_0x406545)[_0x3383('0x19')]();};}function respondWithResult(_0x3b3f4d,_0x38e4e6){_0x38e4e6=_0x38e4e6||0xc8;return function(_0x2db8b8){if(_0x2db8b8){return _0x3b3f4d[_0x3383('0x18')](_0x38e4e6)['json'](_0x2db8b8);}};}function respondWithFilteredResult(_0x5fb9ca,_0x9b673b){return function(_0x38dac9){if(_0x38dac9){var _0x119cc6=typeof _0x9b673b[_0x3383('0x1a')]===_0x3383('0x1b')&&typeof _0x9b673b[_0x3383('0x1c')]==='undefined';var _0x18665c=_0x38dac9['count'];var _0xae5bbc=_0x119cc6?0x0:_0x9b673b[_0x3383('0x1a')];var _0x4bb81c=_0x119cc6?_0x38dac9['count']:_0x9b673b[_0x3383('0x1a')]+_0x9b673b['limit'];var _0x22ea6f;if(_0x4bb81c>=_0x18665c){_0x4bb81c=_0x18665c;_0x22ea6f=0xc8;}else{_0x22ea6f=0xce;}_0x5fb9ca[_0x3383('0x18')](_0x22ea6f);return _0x5fb9ca['set'](_0x3383('0x1d'),_0xae5bbc+'-'+_0x4bb81c+'/'+_0x18665c)[_0x3383('0x1e')](_0x38dac9);}return null;};}function patchUpdates(_0x35a347){return function(_0x285218){try{jsonpatch['apply'](_0x285218,_0x35a347,!![]);}catch(_0x1bb7cc){return BPromise['reject'](_0x1bb7cc);}return _0x285218[_0x3383('0x1f')]();};}function saveUpdates(_0x4c2698,_0x3f8178){return function(_0x5cabb0){if(_0x5cabb0){return _0x5cabb0[_0x3383('0x20')](_0x4c2698)[_0x3383('0x21')](function(_0x2ddf55){return _0x2ddf55;});}return null;};}function removeEntity(_0x29343c,_0x20ac88){return function(_0x3652ed){if(_0x3652ed){return _0x3652ed[_0x3383('0x22')]()[_0x3383('0x21')](function(){_0x29343c[_0x3383('0x18')](0xcc)[_0x3383('0x19')]();});}};}function handleEntityNotFound(_0x437571,_0x469465){return function(_0x46dbdc){if(!_0x46dbdc){_0x437571[_0x3383('0x17')](0x194);}return _0x46dbdc;};}function handleError(_0x4c4435,_0x432ad5){_0x432ad5=_0x432ad5||0x1f4;return function(_0x58bdac){logger[_0x3383('0x23')](_0x58bdac[_0x3383('0x24')]);if(_0x58bdac['name']){delete _0x58bdac['name'];}_0x4c4435[_0x3383('0x18')](_0x432ad5)[_0x3383('0x25')](_0x58bdac);};}exports[_0x3383('0x26')]=function(_0xd5ce9d,_0x6c28bd){var _0x102c3c={},_0x29facd={},_0x1237e2={'count':0x0,'rows':[]};var _0x267d24=_[_0x3383('0x27')](db[_0x3383('0x28')][_0x3383('0x29')],function(_0x2133cc){return{'name':_0x2133cc['fieldName'],'type':_0x2133cc['type']['key']};});_0x29facd[_0x3383('0x2a')]=_['map'](_0x267d24,_0x3383('0x2b'));_0x29facd[_0x3383('0x2c')]=_[_0x3383('0x2d')](_0xd5ce9d['query']);_0x29facd[_0x3383('0x2e')]=_[_0x3383('0x2f')](_0x29facd[_0x3383('0x2a')],_0x29facd[_0x3383('0x2c')]);_0x102c3c[_0x3383('0x30')]=_[_0x3383('0x2f')](_0x29facd[_0x3383('0x2a')],qs[_0x3383('0x31')](_0xd5ce9d['query'][_0x3383('0x31')]));_0x102c3c[_0x3383('0x30')]=_0x102c3c[_0x3383('0x30')]['length']?_0x102c3c[_0x3383('0x30')]:_0x29facd[_0x3383('0x2a')];if(!_0xd5ce9d[_0x3383('0x2c')][_0x3383('0x32')](_0x3383('0x33'))){_0x102c3c[_0x3383('0x1c')]=qs['limit'](_0xd5ce9d[_0x3383('0x2c')][_0x3383('0x1c')]);_0x102c3c['offset']=qs[_0x3383('0x1a')](_0xd5ce9d['query'][_0x3383('0x1a')]);}_0x102c3c[_0x3383('0x34')]=qs['sort'](_0xd5ce9d[_0x3383('0x2c')][_0x3383('0x35')]);_0x102c3c[_0x3383('0x36')]=qs[_0x3383('0x2e')](_[_0x3383('0x37')](_0xd5ce9d[_0x3383('0x2c')],_0x29facd[_0x3383('0x2e')]),_0x267d24);if(_0xd5ce9d['query'][_0x3383('0x38')]){_0x102c3c['where']=_[_0x3383('0x39')](_0x102c3c[_0x3383('0x36')],{'$or':_[_0x3383('0x27')](_0x267d24,function(_0x2a3fa6){if(_0x2a3fa6[_0x3383('0x3a')]!==_0x3383('0x3b')){var _0x347dfb={};_0x347dfb[_0x2a3fa6[_0x3383('0x2b')]]={'$like':'%'+_0xd5ce9d[_0x3383('0x2c')][_0x3383('0x38')]+'%'};return _0x347dfb;}})});}_0x102c3c=_[_0x3383('0x39')]({},_0x102c3c,_0xd5ce9d[_0x3383('0x3c')]);var _0x4e7fc9={'where':_0x102c3c[_0x3383('0x36')]};return db[_0x3383('0x28')]['count'](_0x4e7fc9)['then'](function(_0x398672){_0x1237e2[_0x3383('0x3d')]=_0x398672;if(_0xd5ce9d[_0x3383('0x2c')][_0x3383('0x3e')]){_0x102c3c[_0x3383('0x3f')]=[{'all':!![]}];}return db[_0x3383('0x28')]['findAll'](_0x102c3c);})[_0x3383('0x21')](function(_0x3900f9){_0x1237e2['rows']=_0x3900f9;return _0x1237e2;})[_0x3383('0x21')](respondWithFilteredResult(_0x6c28bd,_0x102c3c))[_0x3383('0x40')](handleError(_0x6c28bd,null));};exports[_0x3383('0x41')]=function(_0x2e73f7,_0x4d19a1){var _0x2059ba={'raw':!![],'where':{'id':_0x2e73f7['params']['id']}},_0x5fae15={};_0x5fae15[_0x3383('0x2a')]=_[_0x3383('0x2d')](db[_0x3383('0x28')]['rawAttributes']);_0x5fae15['query']=_[_0x3383('0x2d')](_0x2e73f7[_0x3383('0x2c')]);_0x5fae15[_0x3383('0x2e')]=_[_0x3383('0x2f')](_0x5fae15['model'],_0x5fae15['query']);_0x2059ba['attributes']=_[_0x3383('0x2f')](_0x5fae15[_0x3383('0x2a')],qs[_0x3383('0x31')](_0x2e73f7[_0x3383('0x2c')][_0x3383('0x31')]));_0x2059ba['attributes']=_0x2059ba['attributes']['length']?_0x2059ba[_0x3383('0x30')]:_0x5fae15[_0x3383('0x2a')];if(_0x2e73f7[_0x3383('0x2c')]['includeAll']){_0x2059ba[_0x3383('0x3f')]=[{'all':!![]}];}_0x2059ba=_[_0x3383('0x39')]({},_0x2059ba,_0x2e73f7[_0x3383('0x3c')]);return db[_0x3383('0x28')][_0x3383('0x42')](_0x2059ba)[_0x3383('0x21')](handleEntityNotFound(_0x4d19a1,null))[_0x3383('0x21')](respondWithResult(_0x4d19a1,null))[_0x3383('0x40')](handleError(_0x4d19a1,null));};exports['create']=function(_0x3135d5,_0x53beef){return db[_0x3383('0x28')][_0x3383('0x43')](_0x3135d5['body'],{})[_0x3383('0x21')](respondWithResult(_0x53beef,0xc9))[_0x3383('0x40')](handleError(_0x53beef,null));};exports[_0x3383('0x20')]=function(_0x6c0c01,_0x1e379b){if(_0x6c0c01[_0x3383('0x44')]['id']){delete _0x6c0c01['body']['id'];}return db[_0x3383('0x28')]['find']({'where':{'id':_0x6c0c01[_0x3383('0x45')]['id']}})[_0x3383('0x21')](handleEntityNotFound(_0x1e379b,null))[_0x3383('0x21')](saveUpdates(_0x6c0c01[_0x3383('0x44')],null))[_0x3383('0x21')](respondWithResult(_0x1e379b,null))['catch'](handleError(_0x1e379b,null));};exports[_0x3383('0x22')]=function(_0x2baf39,_0x50c150){return db[_0x3383('0x28')][_0x3383('0x42')]({'where':{'id':_0x2baf39['params']['id']}})[_0x3383('0x21')](handleEntityNotFound(_0x50c150,null))[_0x3383('0x21')](removeEntity(_0x50c150,null))[_0x3383('0x40')](handleError(_0x50c150,null));};
\ No newline at end of file
+var _0xb4a4=['fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceField','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0xd01545,_0x1331b6){var _0x1b479a=function(_0x1bea4e){while(--_0x1bea4e){_0xd01545['push'](_0xd01545['shift']());}};_0x1b479a(++_0x1331b6);}(_0xb4a4,0x1ac));var _0x4b4a=function(_0x3ad8b6,_0x2f8939){_0x3ad8b6=_0x3ad8b6-0x0;var _0x40b1d4=_0xb4a4[_0x3ad8b6];return _0x40b1d4;};'use strict';var emlformat=require(_0x4b4a('0x0'));var rimraf=require(_0x4b4a('0x1'));var zipdir=require(_0x4b4a('0x2'));var jsonpatch=require(_0x4b4a('0x3'));var rp=require(_0x4b4a('0x4'));var moment=require(_0x4b4a('0x5'));var BPromise=require(_0x4b4a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4b4a('0x7'));var sox=require(_0x4b4a('0x8'));var csv=require(_0x4b4a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b4a('0xa'));var _=require(_0x4b4a('0xb'));var squel=require(_0x4b4a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b4a('0xd'));var Papa=require(_0x4b4a('0xe'));var Redis=require(_0x4b4a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4b4a('0x10'));var as=require(_0x4b4a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b4a('0x12'))(_0x4b4a('0x13'));var utils=require('../../config/utils');var config=require(_0x4b4a('0x14'));var licenseUtil=require(_0x4b4a('0x15'));var db=require(_0x4b4a('0x16'))['db'];function respondWithStatusCode(_0x337067,_0x2eafb7){_0x2eafb7=_0x2eafb7||0xcc;return function(_0x53ea1e){if(_0x53ea1e){return _0x337067[_0x4b4a('0x17')](_0x2eafb7);}return _0x337067['status'](_0x2eafb7)[_0x4b4a('0x18')]();};}function respondWithResult(_0xeeedd4,_0x399558){_0x399558=_0x399558||0xc8;return function(_0x24acdc){if(_0x24acdc){return _0xeeedd4[_0x4b4a('0x19')](_0x399558)[_0x4b4a('0x1a')](_0x24acdc);}};}function respondWithFilteredResult(_0x49f792,_0x28dc88){return function(_0x2e9b1a){if(_0x2e9b1a){var _0x36db11=typeof _0x28dc88[_0x4b4a('0x1b')]===_0x4b4a('0x1c')&&typeof _0x28dc88['limit']===_0x4b4a('0x1c');var _0x1236ed=_0x2e9b1a[_0x4b4a('0x1d')];var _0x305ab1=_0x36db11?0x0:_0x28dc88['offset'];var _0x8987d4=_0x36db11?_0x2e9b1a[_0x4b4a('0x1d')]:_0x28dc88['offset']+_0x28dc88['limit'];var _0x27a0e9;if(_0x8987d4>=_0x1236ed){_0x8987d4=_0x1236ed;_0x27a0e9=0xc8;}else{_0x27a0e9=0xce;}_0x49f792[_0x4b4a('0x19')](_0x27a0e9);return _0x49f792[_0x4b4a('0x1e')](_0x4b4a('0x1f'),_0x305ab1+'-'+_0x8987d4+'/'+_0x1236ed)[_0x4b4a('0x1a')](_0x2e9b1a);}return null;};}function patchUpdates(_0x4bd6ce){return function(_0x63f3c0){try{jsonpatch[_0x4b4a('0x20')](_0x63f3c0,_0x4bd6ce,!![]);}catch(_0x356965){return BPromise[_0x4b4a('0x21')](_0x356965);}return _0x63f3c0[_0x4b4a('0x22')]();};}function saveUpdates(_0x37f5c0,_0x397dc0){return function(_0x5ade81){if(_0x5ade81){return _0x5ade81[_0x4b4a('0x23')](_0x37f5c0)[_0x4b4a('0x24')](function(_0x2233f7){return _0x2233f7;});}return null;};}function removeEntity(_0x36674c,_0x2cda62){return function(_0x285ccd){if(_0x285ccd){return _0x285ccd[_0x4b4a('0x25')]()[_0x4b4a('0x24')](function(){_0x36674c[_0x4b4a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b3a1,_0x11b886){return function(_0x5187bc){if(!_0x5187bc){_0x57b3a1[_0x4b4a('0x17')](0x194);}return _0x5187bc;};}function handleError(_0x281156,_0x438d1c){_0x438d1c=_0x438d1c||0x1f4;return function(_0x4df4dc){logger[_0x4b4a('0x26')](_0x4df4dc[_0x4b4a('0x27')]);if(_0x4df4dc[_0x4b4a('0x28')]){delete _0x4df4dc[_0x4b4a('0x28')];}_0x281156[_0x4b4a('0x19')](_0x438d1c)['send'](_0x4df4dc);};}exports[_0x4b4a('0x29')]=function(_0x448310,_0x12605a){var _0x2d945c={},_0x33dfff={},_0x37cdcc={'count':0x0,'rows':[]};var _0x1a88f1=_[_0x4b4a('0x2a')](db[_0x4b4a('0x2b')]['rawAttributes'],function(_0x4dda2a){return{'name':_0x4dda2a[_0x4b4a('0x2c')],'type':_0x4dda2a[_0x4b4a('0x2d')][_0x4b4a('0x2e')]};});_0x33dfff[_0x4b4a('0x2f')]=_[_0x4b4a('0x2a')](_0x1a88f1,_0x4b4a('0x28'));_0x33dfff['query']=_[_0x4b4a('0x30')](_0x448310[_0x4b4a('0x31')]);_0x33dfff[_0x4b4a('0x32')]=_['intersection'](_0x33dfff['model'],_0x33dfff['query']);_0x2d945c[_0x4b4a('0x33')]=_[_0x4b4a('0x34')](_0x33dfff[_0x4b4a('0x2f')],qs[_0x4b4a('0x35')](_0x448310[_0x4b4a('0x31')][_0x4b4a('0x35')]));_0x2d945c[_0x4b4a('0x33')]=_0x2d945c[_0x4b4a('0x33')]['length']?_0x2d945c['attributes']:_0x33dfff[_0x4b4a('0x2f')];if(!_0x448310[_0x4b4a('0x31')]['hasOwnProperty'](_0x4b4a('0x36'))){_0x2d945c['limit']=qs[_0x4b4a('0x37')](_0x448310['query'][_0x4b4a('0x37')]);_0x2d945c[_0x4b4a('0x1b')]=qs[_0x4b4a('0x1b')](_0x448310['query'][_0x4b4a('0x1b')]);}_0x2d945c[_0x4b4a('0x38')]=qs[_0x4b4a('0x39')](_0x448310[_0x4b4a('0x31')][_0x4b4a('0x39')]);_0x2d945c[_0x4b4a('0x3a')]=qs['filters'](_[_0x4b4a('0x3b')](_0x448310[_0x4b4a('0x31')],_0x33dfff[_0x4b4a('0x32')]),_0x1a88f1);if(_0x448310[_0x4b4a('0x31')]['filter']){_0x2d945c[_0x4b4a('0x3a')]=_[_0x4b4a('0x3c')](_0x2d945c[_0x4b4a('0x3a')],{'$or':_['map'](_0x1a88f1,function(_0x7d68aa){if(_0x7d68aa[_0x4b4a('0x2d')]!==_0x4b4a('0x3d')){var _0x2b3639={};_0x2b3639[_0x7d68aa[_0x4b4a('0x28')]]={'$like':'%'+_0x448310['query'][_0x4b4a('0x3e')]+'%'};return _0x2b3639;}})});}_0x2d945c=_[_0x4b4a('0x3c')]({},_0x2d945c,_0x448310['options']);var _0x11d5b4={'where':_0x2d945c[_0x4b4a('0x3a')]};return db['SalesforceField'][_0x4b4a('0x1d')](_0x11d5b4)[_0x4b4a('0x24')](function(_0x39663e){_0x37cdcc[_0x4b4a('0x1d')]=_0x39663e;if(_0x448310[_0x4b4a('0x31')][_0x4b4a('0x3f')]){_0x2d945c[_0x4b4a('0x40')]=[{'all':!![]}];}return db[_0x4b4a('0x2b')][_0x4b4a('0x41')](_0x2d945c);})[_0x4b4a('0x24')](function(_0x23128b){_0x37cdcc[_0x4b4a('0x42')]=_0x23128b;return _0x37cdcc;})['then'](respondWithFilteredResult(_0x12605a,_0x2d945c))[_0x4b4a('0x43')](handleError(_0x12605a,null));};exports['show']=function(_0x440703,_0x213e07){var _0x44016b={'raw':!![],'where':{'id':_0x440703[_0x4b4a('0x44')]['id']}},_0x712bf1={};_0x712bf1[_0x4b4a('0x2f')]=_[_0x4b4a('0x30')](db[_0x4b4a('0x2b')]['rawAttributes']);_0x712bf1[_0x4b4a('0x31')]=_[_0x4b4a('0x30')](_0x440703[_0x4b4a('0x31')]);_0x712bf1['filters']=_[_0x4b4a('0x34')](_0x712bf1[_0x4b4a('0x2f')],_0x712bf1[_0x4b4a('0x31')]);_0x44016b[_0x4b4a('0x33')]=_['intersection'](_0x712bf1[_0x4b4a('0x2f')],qs['fields'](_0x440703[_0x4b4a('0x31')][_0x4b4a('0x35')]));_0x44016b['attributes']=_0x44016b[_0x4b4a('0x33')][_0x4b4a('0x45')]?_0x44016b[_0x4b4a('0x33')]:_0x712bf1[_0x4b4a('0x2f')];if(_0x440703[_0x4b4a('0x31')][_0x4b4a('0x3f')]){_0x44016b[_0x4b4a('0x40')]=[{'all':!![]}];}_0x44016b=_[_0x4b4a('0x3c')]({},_0x44016b,_0x440703['options']);return db['SalesforceField'][_0x4b4a('0x46')](_0x44016b)[_0x4b4a('0x24')](handleEntityNotFound(_0x213e07,null))[_0x4b4a('0x24')](respondWithResult(_0x213e07,null))[_0x4b4a('0x43')](handleError(_0x213e07,null));};exports[_0x4b4a('0x47')]=function(_0x196c8f,_0x25f637){return db[_0x4b4a('0x2b')][_0x4b4a('0x47')](_0x196c8f[_0x4b4a('0x48')],{})[_0x4b4a('0x24')](respondWithResult(_0x25f637,0xc9))['catch'](handleError(_0x25f637,null));};exports[_0x4b4a('0x23')]=function(_0x5ac7e1,_0x44e5c0){if(_0x5ac7e1[_0x4b4a('0x48')]['id']){delete _0x5ac7e1[_0x4b4a('0x48')]['id'];}return db[_0x4b4a('0x2b')]['find']({'where':{'id':_0x5ac7e1[_0x4b4a('0x44')]['id']}})[_0x4b4a('0x24')](handleEntityNotFound(_0x44e5c0,null))[_0x4b4a('0x24')](saveUpdates(_0x5ac7e1['body'],null))[_0x4b4a('0x24')](respondWithResult(_0x44e5c0,null))[_0x4b4a('0x43')](handleError(_0x44e5c0,null));};exports[_0x4b4a('0x25')]=function(_0x39e559,_0x18548d){return db[_0x4b4a('0x2b')][_0x4b4a('0x46')]({'where':{'id':_0x39e559[_0x4b4a('0x44')]['id']}})[_0x4b4a('0x24')](handleEntityNotFound(_0x18548d,null))['then'](removeEntity(_0x18548d,null))[_0x4b4a('0x43')](handleError(_0x18548d,null));};
\ No newline at end of file
index 811c023..6861d43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x991f=['request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger'];(function(_0x54cfb3,_0x37303e){var _0x434eab=function(_0x202cb5){while(--_0x202cb5){_0x54cfb3['push'](_0x54cfb3['shift']());}};_0x434eab(++_0x37303e);}(_0x991f,0x171));var _0xf991=function(_0x2eb402,_0x70adf0){_0x2eb402=_0x2eb402-0x0;var _0x5d1793=_0x991f[_0x2eb402];return _0x5d1793;};'use strict';var _=require(_0xf991('0x0'));var util=require(_0xf991('0x1'));var logger=require(_0xf991('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf991('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf991('0x4'));var config=require(_0xf991('0x5'));var attributes=require(_0xf991('0x6'));module[_0xf991('0x7')]=function(_0x20e481,_0x361754){return _0x20e481[_0xf991('0x8')](_0xf991('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xf991('0xa'),'fields':[_0xf991('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0b89=['util','../../config/logger','moment','bluebird','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','lodash'];(function(_0x398f4e,_0x1081b2){var _0x5dbcba=function(_0x6f2cca){while(--_0x6f2cca){_0x398f4e['push'](_0x398f4e['shift']());}};_0x5dbcba(++_0x1081b2);}(_0x0b89,0x1cb));var _0x90b8=function(_0x3d17d8,_0x1fa1a7){_0x3d17d8=_0x3d17d8-0x0;var _0x3ca057=_0x0b89[_0x3d17d8];return _0x3ca057;};'use strict';var _=require(_0x90b8('0x0'));var util=require(_0x90b8('0x1'));var logger=require(_0x90b8('0x2'))('api');var moment=require(_0x90b8('0x3'));var BPromise=require(_0x90b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90b8('0x5'));module[_0x90b8('0x6')]=function(_0x365ee8,_0x3d5b03){return _0x365ee8[_0x90b8('0x7')]('SalesforceField',attributes,{'tableName':_0x90b8('0x8'),'paranoid':![],'indexes':[{'name':_0x90b8('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index b7538b4..72aaf9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2967=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xeee344,_0x291948){var _0x2ad583=function(_0x42713e){while(--_0x42713e){_0xeee344['push'](_0xeee344['shift']());}};_0x2ad583(++_0x291948);}(_0x2967,0xf2));var _0x7296=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x2967[_0x4e90e3];return _0x295e5b;};'use strict';var _=require(_0x7296('0x0'));var util=require(_0x7296('0x1'));var moment=require(_0x7296('0x2'));var BPromise=require(_0x7296('0x3'));var rs=require(_0x7296('0x4'));var fs=require('fs');var Redis=require(_0x7296('0x5'));var db=require(_0x7296('0x6'))['db'];var utils=require(_0x7296('0x7'));var logger=require(_0x7296('0x8'))('rpc');var config=require(_0x7296('0x9'));var jayson=require(_0x7296('0xa'));var client=jayson['client'][_0x7296('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11308e,_0x22727e,_0x1a4507){return new BPromise(function(_0x12d12a,_0x2853a9){return client[_0x7296('0xc')](_0x11308e,_0x1a4507)[_0x7296('0xd')](function(_0x5e5077){logger[_0x7296('0xe')](_0x7296('0xf'),_0x22727e,_0x7296('0x10'));logger['debug'](_0x7296('0x11'),_0x22727e,_0x7296('0x10'),JSON[_0x7296('0x12')](_0x5e5077));if(_0x5e5077[_0x7296('0x13')]){if(_0x5e5077['error']['code']===0x1f4){logger[_0x7296('0x13')]('SalesforceField,\x20%s,\x20%s',_0x22727e,_0x5e5077[_0x7296('0x13')]['message']);return _0x2853a9(_0x5e5077[_0x7296('0x13')]['message']);}logger[_0x7296('0x13')]('SalesforceField,\x20%s,\x20%s',_0x22727e,_0x5e5077['error'][_0x7296('0x14')]);return _0x12d12a(_0x5e5077[_0x7296('0x13')][_0x7296('0x14')]);}else{logger[_0x7296('0xe')](_0x7296('0xf'),_0x22727e,_0x7296('0x10'));_0x12d12a(_0x5e5077[_0x7296('0x15')][_0x7296('0x14')]);}})[_0x7296('0x16')](function(_0x27c69d){logger[_0x7296('0x13')](_0x7296('0xf'),_0x22727e,_0x27c69d);_0x2853a9(_0x27c69d);});});}
\ No newline at end of file
+var _0x48a3=['error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x547515,_0x41c2c4){var _0x2fdecf=function(_0x55f20e){while(--_0x55f20e){_0x547515['push'](_0x547515['shift']());}};_0x2fdecf(++_0x41c2c4);}(_0x48a3,0xcc));var _0x348a=function(_0x34b071,_0x415c5b){_0x34b071=_0x34b071-0x0;var _0x1b391d=_0x48a3[_0x34b071];return _0x1b391d;};'use strict';var _=require(_0x348a('0x0'));var util=require(_0x348a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x348a('0x2'));var fs=require('fs');var Redis=require(_0x348a('0x3'));var db=require(_0x348a('0x4'))['db'];var utils=require(_0x348a('0x5'));var logger=require('../../config/logger')(_0x348a('0x6'));var config=require(_0x348a('0x7'));var jayson=require(_0x348a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4451fd,_0x428ba8,_0xbb26a7){return new BPromise(function(_0x121253,_0x4da856){return client[_0x348a('0x9')](_0x4451fd,_0xbb26a7)[_0x348a('0xa')](function(_0x5039ed){logger[_0x348a('0xb')](_0x348a('0xc'),_0x428ba8,_0x348a('0xd'));logger[_0x348a('0xe')](_0x348a('0xf'),_0x428ba8,_0x348a('0xd'),JSON['stringify'](_0x5039ed));if(_0x5039ed['error']){if(_0x5039ed[_0x348a('0x10')][_0x348a('0x11')]===0x1f4){logger[_0x348a('0x10')](_0x348a('0xc'),_0x428ba8,_0x5039ed[_0x348a('0x10')][_0x348a('0x12')]);return _0x4da856(_0x5039ed[_0x348a('0x10')][_0x348a('0x12')]);}logger[_0x348a('0x10')](_0x348a('0xc'),_0x428ba8,_0x5039ed[_0x348a('0x10')][_0x348a('0x12')]);return _0x121253(_0x5039ed[_0x348a('0x10')][_0x348a('0x12')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x428ba8,_0x348a('0xd'));_0x121253(_0x5039ed[_0x348a('0x13')][_0x348a('0x12')]);}})['catch'](function(_0x2b39c4){logger[_0x348a('0x10')]('SalesforceField,\x20%s,\x20%s',_0x428ba8,_0x2b39c4);_0x4da856(_0x2b39c4);});});}
\ No newline at end of file
index 3ae21a4..0a96f50 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x78d8=['/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0x78d8,0x15c));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x878d('0x0'));var path=require(_0x878d('0x1'));var timeout=require(_0x878d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x878d('0x3'));var config=require(_0x878d('0x4'));var controller=require(_0x878d('0x5'));router[_0x878d('0x6')]('/',auth[_0x878d('0x7')](),controller[_0x878d('0x8')]);router[_0x878d('0x6')](_0x878d('0x9'),auth[_0x878d('0x7')](),controller[_0x878d('0xa')]);router['get']('/:id/configurations',auth[_0x878d('0x7')](),controller[_0x878d('0xb')]);router[_0x878d('0x6')](_0x878d('0xc'),auth[_0x878d('0x7')](),controller[_0x878d('0xd')]);router[_0x878d('0xe')]('/',auth['isAuthenticated'](),controller[_0x878d('0xf')]);router[_0x878d('0xe')]('/:id/configurations',auth[_0x878d('0x7')](),controller[_0x878d('0x10')]);router[_0x878d('0x11')]('/:id',auth[_0x878d('0x7')](),controller['update']);router[_0x878d('0x12')](_0x878d('0x9'),auth[_0x878d('0x7')](),controller['destroy']);module[_0x878d('0x13')]=router;
\ No newline at end of file
+var _0x4711=['./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5eac33,_0x126183){var _0x5a5f17=function(_0x292781){while(--_0x292781){_0x5eac33['push'](_0x5eac33['shift']());}};_0x5a5f17(++_0x126183);}(_0x4711,0x10c));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1471('0x0'));var util=require(_0x1471('0x1'));var path=require(_0x1471('0x2'));var timeout=require(_0x1471('0x3'));var express=require(_0x1471('0x4'));var router=express[_0x1471('0x5')]();var fs_extra=require(_0x1471('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1471('0x7'));var config=require('../../config/environment');var controller=require(_0x1471('0x8'));router[_0x1471('0x9')]('/',auth[_0x1471('0xa')](),controller[_0x1471('0xb')]);router[_0x1471('0x9')]('/:id',auth[_0x1471('0xa')](),controller[_0x1471('0xc')]);router[_0x1471('0x9')](_0x1471('0xd'),auth[_0x1471('0xa')](),controller['getConfigurations']);router['get'](_0x1471('0xe'),auth[_0x1471('0xa')](),controller[_0x1471('0xf')]);router[_0x1471('0x10')]('/',auth[_0x1471('0xa')](),controller[_0x1471('0x11')]);router[_0x1471('0x10')](_0x1471('0xd'),auth['isAuthenticated'](),controller[_0x1471('0x12')]);router[_0x1471('0x13')](_0x1471('0x14'),auth[_0x1471('0xa')](),controller[_0x1471('0x15')]);router['delete'](_0x1471('0x14'),auth[_0x1471('0xa')](),controller[_0x1471('0x16')]);module['exports']=router;
\ No newline at end of file
index 8253175..04cbaa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0911=['remoteUri','sequelize','exports','STRING','username'];(function(_0x185a0d,_0x37d2cf){var _0x57df19=function(_0x5ee8f4){while(--_0x5ee8f4){_0x185a0d['push'](_0x185a0d['shift']());}};_0x57df19(++_0x37d2cf);}(_0x0911,0x150));var _0x1091=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x0911[_0x421cf8];return _0x145c48;};'use strict';var Sequelize=require(_0x1091('0x0'));module[_0x1091('0x1')]={'name':{'type':Sequelize[_0x1091('0x2')]},'description':{'type':Sequelize[_0x1091('0x2')]},'username':{'type':Sequelize[_0x1091('0x2')],'unique':_0x1091('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1091('0x2')]},'remoteUri':{'type':Sequelize[_0x1091('0x2')],'unique':_0x1091('0x4')},'serverUrl':{'type':Sequelize[_0x1091('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x6078=['username','remoteUri','sequelize','exports','STRING'];(function(_0x59de8a,_0xbf84e){var _0x337bc4=function(_0x5b0c05){while(--_0x5b0c05){_0x59de8a['push'](_0x59de8a['shift']());}};_0x337bc4(++_0xbf84e);}(_0x6078,0x1ec));var _0x8607=function(_0x168e04,_0x2d0c3a){_0x168e04=_0x168e04-0x0;var _0x551d64=_0x6078[_0x168e04];return _0x551d64;};'use strict';var Sequelize=require(_0x8607('0x0'));module[_0x8607('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8607('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8607('0x3')},'password':{'type':Sequelize[_0x8607('0x2')]},'email':{'type':Sequelize[_0x8607('0x2')]},'remoteUri':{'type':Sequelize[_0x8607('0x2')],'unique':_0x8607('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
index 928811b..1c2412f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3b5=['key','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','due_date','reopen_count','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','inactive','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','type'];(function(_0x3bf96b,_0x241008){var _0x431ced=function(_0x2fa96e){while(--_0x2fa96e){_0x3bf96b['push'](_0x3bf96b['shift']());}};_0x431ced(++_0x241008);}(_0xc3b5,0x14b));var _0x5c3b=function(_0x4bb2c8,_0x7af606){_0x4bb2c8=_0x4bb2c8-0x0;var _0x5dcb85=_0xc3b5[_0x4bb2c8];return _0x5dcb85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c3b('0x0'));var zipdir=require(_0x5c3b('0x1'));var jsonpatch=require(_0x5c3b('0x2'));var rp=require(_0x5c3b('0x3'));var moment=require('moment');var BPromise=require(_0x5c3b('0x4'));var Mustache=require(_0x5c3b('0x5'));var util=require(_0x5c3b('0x6'));var path=require(_0x5c3b('0x7'));var sox=require(_0x5c3b('0x8'));var csv=require(_0x5c3b('0x9'));var ejs=require(_0x5c3b('0xa'));var fs=require('fs');var fs_extra=require(_0x5c3b('0xb'));var _=require('lodash');var squel=require(_0x5c3b('0xc'));var crypto=require('crypto');var jsforce=require(_0x5c3b('0xd'));var deskjs=require(_0x5c3b('0xe'));var toCsv=require(_0x5c3b('0x9'));var querystring=require(_0x5c3b('0xf'));var Papa=require(_0x5c3b('0x10'));var Redis=require(_0x5c3b('0x11'));var authService=require(_0x5c3b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c3b('0x13'));var logger=require('../../config/logger')(_0x5c3b('0x14'));var utils=require(_0x5c3b('0x15'));var config=require(_0x5c3b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c3b('0x17'))['db'];var integrations=require(_0x5c3b('0x18'));function respondWithStatusCode(_0x4648bc,_0x31bf6c){_0x31bf6c=_0x31bf6c||0xcc;return function(_0xcc096b){if(_0xcc096b){return _0x4648bc[_0x5c3b('0x19')](_0x31bf6c);}return _0x4648bc[_0x5c3b('0x1a')](_0x31bf6c)[_0x5c3b('0x1b')]();};}function respondWithResult(_0x599ab6,_0x190438){_0x190438=_0x190438||0xc8;return function(_0x2e14b5){if(_0x2e14b5){return _0x599ab6[_0x5c3b('0x1a')](_0x190438)['json'](_0x2e14b5);}};}function respondWithFilteredResult(_0x184109,_0x16a385){return function(_0x2d2adb){if(_0x2d2adb){var _0x12a4f2=typeof _0x16a385[_0x5c3b('0x1c')]===_0x5c3b('0x1d')&&typeof _0x16a385[_0x5c3b('0x1e')]===_0x5c3b('0x1d');var _0x2a8fa9=_0x2d2adb[_0x5c3b('0x1f')];var _0x1f4807=_0x12a4f2?0x0:_0x16a385[_0x5c3b('0x1c')];var _0x447ffc=_0x12a4f2?_0x2d2adb[_0x5c3b('0x1f')]:_0x16a385[_0x5c3b('0x1c')]+_0x16a385[_0x5c3b('0x1e')];var _0xfe7c1b;if(_0x447ffc>=_0x2a8fa9){_0x447ffc=_0x2a8fa9;_0xfe7c1b=0xc8;}else{_0xfe7c1b=0xce;}_0x184109['status'](_0xfe7c1b);return _0x184109[_0x5c3b('0x20')](_0x5c3b('0x21'),_0x1f4807+'-'+_0x447ffc+'/'+_0x2a8fa9)[_0x5c3b('0x22')](_0x2d2adb);}return null;};}function patchUpdates(_0x389255){return function(_0x1551a1){try{jsonpatch[_0x5c3b('0x23')](_0x1551a1,_0x389255,!![]);}catch(_0x29a8a8){return BPromise[_0x5c3b('0x24')](_0x29a8a8);}return _0x1551a1[_0x5c3b('0x25')]();};}function saveUpdates(_0x99b49a,_0x3614db){return function(_0x2f0893){if(_0x2f0893){return _0x2f0893[_0x5c3b('0x26')](_0x99b49a)[_0x5c3b('0x27')](function(_0x9b1464){return _0x9b1464;});}return null;};}function removeEntity(_0xded399,_0x331ff6){return function(_0x1e046c){if(_0x1e046c){return _0x1e046c['destroy']()['then'](function(){_0xded399[_0x5c3b('0x1a')](0xcc)[_0x5c3b('0x1b')]();});}};}function handleEntityNotFound(_0x111381,_0x4611dc){return function(_0x4fa7fb){if(!_0x4fa7fb){_0x111381[_0x5c3b('0x19')](0x194);}return _0x4fa7fb;};}function handleError(_0x20131a,_0x5819ea){_0x5819ea=_0x5819ea||0x1f4;return function(_0x21b129){logger[_0x5c3b('0x28')](_0x21b129[_0x5c3b('0x29')]);if(_0x21b129['name']){delete _0x21b129[_0x5c3b('0x2a')];}_0x20131a[_0x5c3b('0x1a')](_0x5819ea)[_0x5c3b('0x2b')](_0x21b129);};}exports[_0x5c3b('0x2c')]=function(_0x1a3021,_0xbf7bcb){var _0x3091df={},_0x5def73={},_0xff1e4f={'count':0x0,'rows':[]};var _0x4f6259=_[_0x5c3b('0x2d')](db[_0x5c3b('0x2e')][_0x5c3b('0x2f')],function(_0x3bcc49){return{'name':_0x3bcc49['fieldName'],'type':_0x3bcc49[_0x5c3b('0x30')][_0x5c3b('0x31')]};});_0x5def73['model']=_[_0x5c3b('0x2d')](_0x4f6259,'name');_0x5def73[_0x5c3b('0x32')]=_[_0x5c3b('0x33')](_0x1a3021['query']);_0x5def73['filters']=_['intersection'](_0x5def73[_0x5c3b('0x34')],_0x5def73[_0x5c3b('0x32')]);_0x3091df['attributes']=_[_0x5c3b('0x35')](_0x5def73[_0x5c3b('0x34')],qs[_0x5c3b('0x36')](_0x1a3021['query'][_0x5c3b('0x36')]));_0x3091df[_0x5c3b('0x37')]=_0x3091df['attributes']['length']?_0x3091df[_0x5c3b('0x37')]:_0x5def73[_0x5c3b('0x34')];if(!_0x1a3021[_0x5c3b('0x32')][_0x5c3b('0x38')](_0x5c3b('0x39'))){_0x3091df[_0x5c3b('0x1e')]=qs[_0x5c3b('0x1e')](_0x1a3021[_0x5c3b('0x32')][_0x5c3b('0x1e')]);_0x3091df['offset']=qs[_0x5c3b('0x1c')](_0x1a3021[_0x5c3b('0x32')]['offset']);}_0x3091df[_0x5c3b('0x3a')]=qs['sort'](_0x1a3021[_0x5c3b('0x32')][_0x5c3b('0x3b')]);_0x3091df[_0x5c3b('0x3c')]=qs[_0x5c3b('0x3d')](_[_0x5c3b('0x3e')](_0x1a3021['query'],_0x5def73[_0x5c3b('0x3d')]),_0x4f6259);if(_0x1a3021['query']['filter']){_0x3091df[_0x5c3b('0x3c')]=_['merge'](_0x3091df[_0x5c3b('0x3c')],{'$or':_[_0x5c3b('0x2d')](_0x4f6259,function(_0x45b4bd){if(_0x45b4bd[_0x5c3b('0x30')]!==_0x5c3b('0x3f')){var _0x26c962={};_0x26c962[_0x45b4bd['name']]={'$like':'%'+_0x1a3021[_0x5c3b('0x32')][_0x5c3b('0x40')]+'%'};return _0x26c962;}})});}_0x3091df=_[_0x5c3b('0x41')]({},_0x3091df,_0x1a3021[_0x5c3b('0x42')]);var _0x36c186={'where':_0x3091df[_0x5c3b('0x3c')]};return db[_0x5c3b('0x2e')]['count'](_0x36c186)[_0x5c3b('0x27')](function(_0x4956ad){_0xff1e4f['count']=_0x4956ad;if(_0x1a3021[_0x5c3b('0x32')][_0x5c3b('0x43')]){_0x3091df[_0x5c3b('0x44')]=[{'all':!![]}];}return db[_0x5c3b('0x2e')]['findAll'](_0x3091df);})[_0x5c3b('0x27')](function(_0x5ac671){_0xff1e4f[_0x5c3b('0x45')]=_0x5ac671;return _0xff1e4f;})['then'](respondWithFilteredResult(_0xbf7bcb,_0x3091df))[_0x5c3b('0x46')](handleError(_0xbf7bcb,null));};exports[_0x5c3b('0x47')]=function(_0x22f29b,_0x1cc0b1){var _0x5a24fc={'raw':![],'where':{'id':_0x22f29b[_0x5c3b('0x48')]['id']}},_0x490cee={};_0x490cee[_0x5c3b('0x34')]=_[_0x5c3b('0x33')](db['ServicenowAccount'][_0x5c3b('0x2f')]);_0x490cee[_0x5c3b('0x32')]=_[_0x5c3b('0x33')](_0x22f29b[_0x5c3b('0x32')]);_0x490cee['filters']=_['intersection'](_0x490cee[_0x5c3b('0x34')],_0x490cee[_0x5c3b('0x32')]);_0x5a24fc[_0x5c3b('0x37')]=_['intersection'](_0x490cee[_0x5c3b('0x34')],qs[_0x5c3b('0x36')](_0x22f29b[_0x5c3b('0x32')][_0x5c3b('0x36')]));_0x5a24fc[_0x5c3b('0x37')]=_0x5a24fc['attributes'][_0x5c3b('0x49')]?_0x5a24fc['attributes']:_0x490cee['model'];if(_0x22f29b[_0x5c3b('0x32')][_0x5c3b('0x43')]){_0x5a24fc['include']=[{'all':!![]}];}_0x5a24fc=_[_0x5c3b('0x41')]({},_0x5a24fc,_0x22f29b[_0x5c3b('0x42')]);return db[_0x5c3b('0x2e')][_0x5c3b('0x4a')](_0x5a24fc)[_0x5c3b('0x27')](handleEntityNotFound(_0x1cc0b1,null))[_0x5c3b('0x27')](respondWithResult(_0x1cc0b1,null))[_0x5c3b('0x46')](handleError(_0x1cc0b1,null));};exports[_0x5c3b('0x4b')]=function(_0x444adb,_0x90d077){return db[_0x5c3b('0x2e')][_0x5c3b('0x4b')](_0x444adb['body'],{})['then'](respondWithResult(_0x90d077,0xc9))[_0x5c3b('0x46')](handleError(_0x90d077,null));};exports[_0x5c3b('0x26')]=function(_0x27721a,_0x371f43){if(_0x27721a[_0x5c3b('0x4c')]['id']){delete _0x27721a[_0x5c3b('0x4c')]['id'];}return db[_0x5c3b('0x2e')]['find']({'where':{'id':_0x27721a[_0x5c3b('0x48')]['id']}})[_0x5c3b('0x27')](handleEntityNotFound(_0x371f43,null))[_0x5c3b('0x27')](saveUpdates(_0x27721a[_0x5c3b('0x4c')],null))[_0x5c3b('0x27')](respondWithResult(_0x371f43,null))[_0x5c3b('0x46')](handleError(_0x371f43,null));};exports[_0x5c3b('0x4d')]=function(_0x539035,_0x3932a7){return db[_0x5c3b('0x2e')][_0x5c3b('0x4a')]({'where':{'id':_0x539035['params']['id']}})[_0x5c3b('0x27')](handleEntityNotFound(_0x3932a7,null))['then'](removeEntity(_0x3932a7,null))[_0x5c3b('0x46')](handleError(_0x3932a7,null));};exports[_0x5c3b('0x4e')]=function(_0x49fd07,_0x16a5bd,_0x593daa){var _0x18b6ed={};var _0x428da2={};var _0x51e112;var _0x25f3a7;return db[_0x5c3b('0x2e')][_0x5c3b('0x4f')]({'where':{'id':_0x49fd07[_0x5c3b('0x48')]['id']}})[_0x5c3b('0x27')](handleEntityNotFound(_0x16a5bd,null))[_0x5c3b('0x27')](function(_0x37c9e0){if(_0x37c9e0){_0x51e112=_0x37c9e0;_0x428da2[_0x5c3b('0x34')]=_[_0x5c3b('0x33')](db[_0x5c3b('0x50')][_0x5c3b('0x2f')]);_0x428da2['query']=_[_0x5c3b('0x33')](_0x49fd07[_0x5c3b('0x32')]);_0x428da2['filters']=_[_0x5c3b('0x35')](_0x428da2[_0x5c3b('0x34')],_0x428da2[_0x5c3b('0x32')]);_0x18b6ed['attributes']=_[_0x5c3b('0x35')](_0x428da2[_0x5c3b('0x34')],qs['fields'](_0x49fd07[_0x5c3b('0x32')]['fields']));_0x18b6ed[_0x5c3b('0x37')]=_0x18b6ed['attributes'][_0x5c3b('0x49')]?_0x18b6ed[_0x5c3b('0x37')]:_0x428da2[_0x5c3b('0x34')];_0x18b6ed[_0x5c3b('0x3a')]=qs['sort'](_0x49fd07[_0x5c3b('0x32')][_0x5c3b('0x3b')]);_0x18b6ed[_0x5c3b('0x3c')]=qs[_0x5c3b('0x3d')](_[_0x5c3b('0x3e')](_0x49fd07[_0x5c3b('0x32')],_0x428da2['filters']));if(_0x49fd07[_0x5c3b('0x32')]['filter']){_0x18b6ed['where']=_['merge'](_0x18b6ed['where'],{'$or':_[_0x5c3b('0x2d')](_0x18b6ed[_0x5c3b('0x37')],function(_0x3730c4){var _0xfdb54b={};_0xfdb54b[_0x3730c4]={'$like':'%'+_0x49fd07['query'][_0x5c3b('0x40')]+'%'};return _0xfdb54b;})});}_0x18b6ed=_[_0x5c3b('0x41')]({},_0x18b6ed,_0x49fd07[_0x5c3b('0x42')]);return _0x51e112['getConfigurations'](_0x18b6ed);}})[_0x5c3b('0x27')](function(_0x36e27e){if(_0x36e27e){_0x25f3a7=_0x36e27e['length'];if(!_0x49fd07[_0x5c3b('0x32')]['hasOwnProperty'](_0x5c3b('0x39'))){_0x18b6ed[_0x5c3b('0x1e')]=qs['limit'](_0x49fd07[_0x5c3b('0x32')][_0x5c3b('0x1e')]);_0x18b6ed[_0x5c3b('0x1c')]=qs[_0x5c3b('0x1c')](_0x49fd07[_0x5c3b('0x32')][_0x5c3b('0x1c')]);}return _0x51e112['getConfigurations'](_0x18b6ed);}})[_0x5c3b('0x27')](function(_0x3ac7d3){if(_0x3ac7d3){return _0x3ac7d3?{'count':_0x25f3a7,'rows':_0x3ac7d3}:null;}})[_0x5c3b('0x27')](respondWithResult(_0x16a5bd,null))['catch'](handleError(_0x16a5bd,null));};exports['addConfiguration']=function(_0x5a303e,_0x11afa8,_0x1d4723){if(_0x5a303e[_0x5c3b('0x4c')]['id']){delete _0x5a303e[_0x5c3b('0x4c')]['id'];}return db[_0x5c3b('0x2e')][_0x5c3b('0x4f')]({'where':{'id':_0x5a303e['params']['id']}})[_0x5c3b('0x27')](handleEntityNotFound(_0x11afa8,null))[_0x5c3b('0x27')](function(_0x502f2b){if(_0x502f2b){_0x5a303e[_0x5c3b('0x4c')][_0x5c3b('0x51')]=_0x502f2b['id'];_0x5a303e[_0x5c3b('0x4c')][_0x5c3b('0x52')]=integrations['getSubjects'](_0x5a303e[_0x5c3b('0x4c')][_0x5c3b('0x53')],_0x5a303e[_0x5c3b('0x4c')][_0x5c3b('0x30')]);_0x5a303e[_0x5c3b('0x4c')][_0x5c3b('0x54')]=integrations[_0x5c3b('0x55')](_0x5a303e[_0x5c3b('0x4c')]['channel'],_0x5a303e['body'][_0x5c3b('0x30')]);return db[_0x5c3b('0x50')]['create'](_0x5a303e[_0x5c3b('0x4c')],{'include':[{'model':db[_0x5c3b('0x56')],'as':_0x5c3b('0x52')},{'model':db[_0x5c3b('0x56')],'as':_0x5c3b('0x54')}]});}return null;})['then'](respondWithResult(_0x11afa8,null))[_0x5c3b('0x46')](handleError(_0x11afa8,null));};exports[_0x5c3b('0x57')]=function(_0xfcb1a8,_0xb113a1,_0x11cdfa){var _0x2955b5=[_0x5c3b('0x58'),_0x5c3b('0x59'),'knowledge',_0x5c3b('0x5a'),_0x5c3b('0x5b'),_0x5c3b('0x5c'),_0x5c3b('0x5d'),_0x5c3b('0x5e'),_0x5c3b('0x5f')];var _0x13fd9d=[_0x5c3b('0x60'),_0x5c3b('0x58'),_0x5c3b('0x61'),_0x5c3b('0x62'),_0x5c3b('0x63'),_0x5c3b('0x64'),_0x5c3b('0x65'),_0x5c3b('0x59'),_0x5c3b('0x66'),_0x5c3b('0x67'),_0x5c3b('0x68'),_0x5c3b('0x69'),_0x5c3b('0x6a'),'user_input',_0x5c3b('0x6b'),'sys_domain',_0x5c3b('0x6c'),_0x5c3b('0x6d'),_0x5c3b('0x6e'),_0x5c3b('0x3a'),_0x5c3b('0x6f'),_0x5c3b('0x70'),_0x5c3b('0x71'),'delivery_plan','impact',_0x5c3b('0x72'),_0x5c3b('0x73'),'business_service',_0x5c3b('0x74'),_0x5c3b('0x75'),_0x5c3b('0x76'),'time_worked',_0x5c3b('0x77'),_0x5c3b('0x78'),_0x5c3b('0x79'),_0x5c3b('0x7a'),_0x5c3b('0x7b'),'reopened_time',_0x5c3b('0x7c'),_0x5c3b('0x7d'),_0x5c3b('0x7e'),_0x5c3b('0x5a'),_0x5c3b('0x7f'),'short_description',_0x5c3b('0x5b'),_0x5c3b('0x80'),'delivery_task',_0x5c3b('0x81'),_0x5c3b('0x82'),_0x5c3b('0x83'),_0x5c3b('0x84'),'description',_0x5c3b('0x85'),'notify',_0x5c3b('0x86'),_0x5c3b('0x87'),_0x5c3b('0x88'),_0x5c3b('0x89'),_0x5c3b('0x8a'),_0x5c3b('0x8b'),'contact_type',_0x5c3b('0x8c'),_0x5c3b('0x5d'),_0x5c3b('0x8d'),_0x5c3b('0x8e'),_0x5c3b('0x8f'),_0x5c3b('0x90'),_0x5c3b('0x91'),_0x5c3b('0x92'),_0x5c3b('0x5e'),_0x5c3b('0x93'),_0x5c3b('0x94'),_0x5c3b('0x95'),'comments_and_work_notes',_0x5c3b('0x96'),'sys_mod_count',_0x5c3b('0x97'),'sys_tags',_0x5c3b('0x98'),'upon_approval',_0x5c3b('0x99'),_0x5c3b('0x9a'),_0x5c3b('0x5f')];var _0x3d16e8='';var _0x39bb3e='';var _0x3a0725=[];var _0x548add='';var _0x48d8dc='';var _0xbaa1ad=[];var _0x20c9b4='';var _0xcce8f5='';var _0x1165d5={};var _0x49514b='';return db[_0x5c3b('0x2e')][_0x5c3b('0x4f')]({'where':{'id':_0xfcb1a8[_0x5c3b('0x48')]['id']},'attributes':['id',_0x5c3b('0x9b'),_0x5c3b('0x9c'),_0x5c3b('0x9d'),_0x5c3b('0x9e'),_0x5c3b('0x9f')]})[_0x5c3b('0x27')](handleEntityNotFound(_0xb113a1,null))['then'](function(_0x447930){if(_0x447930){_0x49514b=_0x447930['remoteUri'];var _0x3ca8a7=_0x49514b['slice'](-0x1);if(_0x3ca8a7==='/'){_0x49514b=_0x49514b[_0x5c3b('0xa0')](0x0,_0x49514b[_0x5c3b('0xa1')](_0x3ca8a7));}_0xcce8f5=util[_0x5c3b('0xa2')](_0x5c3b('0xa3'),_0x49514b);_0x20c9b4=util[_0x5c3b('0xa2')](_0x5c3b('0xa4'),_0x49514b);_0x1165d5={'user':_0x447930['username'],'pass':_0x447930[_0x5c3b('0x9c')]};var _0x5583a5={'method':_0x5c3b('0xa5'),'uri':_0xcce8f5+_0x5c3b('0xa6'),'auth':_0x1165d5,'json':!![]};return rp(_0x5583a5);}})['then'](function(_0x2bfadb){if(_0x2bfadb[_0x5c3b('0xa7')]['length']>0x0){_0x3d16e8=_0x2bfadb[_0x5c3b('0xa7')];}console[_0x5c3b('0xa8')](_0x5c3b('0xa9'),_0x3d16e8);_0xbaa1ad=[];_0x39bb3e=Object[_0x5c3b('0xaa')]([],_0x3d16e8);_['remove'](_0x39bb3e,function(_0x15530c){return!_0x2955b5[_0x5c3b('0xab')](_0x15530c['name']);});_0x39bb3e[_0x5c3b('0xac')](function(_0x1800d2){var _0xd46d61=createFieldObject(_0x20c9b4,_0x1165d5,_0x1800d2[_0x5c3b('0xad')],_0x1800d2[_0x5c3b('0x2a')],_0x1800d2[_0x5c3b('0xae')],![]);_0xbaa1ad[_0x5c3b('0xaf')](_0xd46d61);});return Promise[_0x5c3b('0xb0')](_0xbaa1ad);})[_0x5c3b('0x27')](function(_0x3bfe0d){_0x3a0725=_0x3bfe0d;_0x548add=Object[_0x5c3b('0xaa')]([],_0x3d16e8);console['log'](_0x5c3b('0xb1'),_0x3d16e8);_[_0x5c3b('0xb2')](_0x548add,function(_0x34a64a){return _0x13fd9d['includes'](_0x34a64a[_0x5c3b('0x2a')]);});console[_0x5c3b('0xa8')](_0x5c3b('0xb3'),_0x548add);_0xbaa1ad=[];_0x548add[_0x5c3b('0xac')](function(_0x620c9d){var _0x2b4ea3=createFieldObject(_0x20c9b4,_0x1165d5,_0x620c9d[_0x5c3b('0xad')],_0x620c9d[_0x5c3b('0x2a')],_0x620c9d[_0x5c3b('0xae')],!![]);_0xbaa1ad['push'](_0x2b4ea3);});return Promise[_0x5c3b('0xb0')](_0xbaa1ad);})[_0x5c3b('0x27')](function(_0x12b587){_0x48d8dc=_0x12b587;var _0x3c3ba5=_0x3a0725['concat'](_0x48d8dc);return{'count':_0x3c3ba5[_0x5c3b('0x49')],'rows':_0x3c3ba5};})[_0x5c3b('0x27')](respondWithResult(_0xb113a1,null))['catch'](function(_0x4ac0d0){console[_0x5c3b('0xa8')](_0x5c3b('0xb4')+_0x4ac0d0);var _0x14b322=_0xfcb1a8['query'][_0x5c3b('0xb5')]?0x1f4:_0x4ac0d0[_0x5c3b('0xb6')]||0x1f4;logger['error'](_0x4ac0d0[_0x5c3b('0x29')]);delete _0x4ac0d0[_0x5c3b('0x2a')];if(_0x14b322===0x191){_0x14b322=0x190;}_0xb113a1[_0x5c3b('0x1a')](_0x14b322)[_0x5c3b('0x2b')](_0xfcb1a8[_0x5c3b('0x32')][_0x5c3b('0xb5')]?{'message':_0x5c3b('0xb7'),'statusCode':_0x4ac0d0['statusCode']}:_0x4ac0d0);});};function createFieldObject(_0x23e14e,_0x41b759,_0x1b9915,_0x15d0c2,_0x502f3e,_0x654037){return new Promise(function(_0x5733ef,_0x3d551f){var _0x3a54e3={'id':_0x15d0c2,'name':_0x502f3e,'custom':_0x654037};if(_0x1b9915===_0x5c3b('0xb8')){_0x3a54e3[_0x5c3b('0x42')]=[{'name':_0x5c3b('0xb9'),'value':_0x5c3b('0xba')},{'name':_0x5c3b('0xbb'),'value':_0x5c3b('0xbc')}];_0x5733ef(_0x3a54e3);}else{var _0x50f860={'method':_0x5c3b('0xa5'),'uri':_0x23e14e+'sys_choice?sysparm_query=name=incident^element='+_0x15d0c2,'auth':_0x41b759,'json':!![]};return rp(_0x50f860)[_0x5c3b('0x27')](function(_0xa1d3dc){var _0x301533=[];if(_0xa1d3dc[_0x5c3b('0xa7')][_0x5c3b('0x49')]>0x0){_0xa1d3dc[_0x5c3b('0xa7')][_0x5c3b('0xac')](function(_0x5197bf){if(_0x5197bf[_0x5c3b('0xbd')]===_0x5c3b('0xbc')){var _0x50e800={'name':_0x5197bf[_0x5c3b('0xae')],'value':_0x5197bf['value']};_0x301533['push'](_0x50e800);}});}_0x3a54e3[_0x5c3b('0x42')]=_0x301533;if(_0x3a54e3[_0x5c3b('0x42')]['length']>0x0){_0x5733ef(_0x3a54e3);}else{if(_0x654037==![]){_0x5733ef();}else{_0x5733ef(_0x3a54e3);}}});}});}
\ No newline at end of file
+var _0x4264=['sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','set','Content-Range','reject','then','destroy','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','update','find','findOne','ServicenowConfiguration','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','knowledge','subcategory','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','close_code','delivery_task','work_start','business_stc','additional_assignee_list','description','notify','sys_class_name','closed_by','parent_incident','sys_id','contact_type','urgency','problem_id','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','error','send','Wrong\x20credentials','statusCode','boolean','True','true','False','false'];(function(_0x56e86a,_0x514475){var _0x49a80a=function(_0x997829){while(--_0x997829){_0x56e86a['push'](_0x56e86a['shift']());}};_0x49a80a(++_0x514475);}(_0x4264,0xbe));var _0x4426=function(_0x2869f5,_0x30fb8d){_0x2869f5=_0x2869f5-0x0;var _0x2ec4da=_0x4264[_0x2869f5];return _0x2ec4da;};'use strict';var emlformat=require(_0x4426('0x0'));var rimraf=require(_0x4426('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4426('0x2'));var rp=require(_0x4426('0x3'));var moment=require(_0x4426('0x4'));var BPromise=require(_0x4426('0x5'));var Mustache=require(_0x4426('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4426('0x7'));var csv=require(_0x4426('0x8'));var ejs=require(_0x4426('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4426('0xa'));var squel=require(_0x4426('0xb'));var crypto=require(_0x4426('0xc'));var jsforce=require(_0x4426('0xd'));var deskjs=require(_0x4426('0xe'));var toCsv=require(_0x4426('0x8'));var querystring=require(_0x4426('0xf'));var Papa=require(_0x4426('0x10'));var Redis=require('ioredis');var authService=require(_0x4426('0x11'));var qs=require(_0x4426('0x12'));var as=require(_0x4426('0x13'));var hardwareService=require(_0x4426('0x14'));var logger=require(_0x4426('0x15'))(_0x4426('0x16'));var utils=require(_0x4426('0x17'));var config=require(_0x4426('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4426('0x19'))['db'];var integrations=require(_0x4426('0x1a'));function respondWithStatusCode(_0x574ada,_0x2b4bb8){_0x2b4bb8=_0x2b4bb8||0xcc;return function(_0x5b2fef){if(_0x5b2fef){return _0x574ada['sendStatus'](_0x2b4bb8);}return _0x574ada['status'](_0x2b4bb8)['end']();};}function respondWithResult(_0x1df9c1,_0x1ce44f){_0x1ce44f=_0x1ce44f||0xc8;return function(_0x2ae62f){if(_0x2ae62f){return _0x1df9c1[_0x4426('0x1b')](_0x1ce44f)[_0x4426('0x1c')](_0x2ae62f);}};}function respondWithFilteredResult(_0x5d0b14,_0x14de48){return function(_0x3b7394){if(_0x3b7394){var _0x2a841b=typeof _0x14de48['offset']===_0x4426('0x1d')&&typeof _0x14de48[_0x4426('0x1e')]===_0x4426('0x1d');var _0x30d90a=_0x3b7394['count'];var _0x2a2bad=_0x2a841b?0x0:_0x14de48[_0x4426('0x1f')];var _0x3258cc=_0x2a841b?_0x3b7394['count']:_0x14de48[_0x4426('0x1f')]+_0x14de48[_0x4426('0x1e')];var _0x15841d;if(_0x3258cc>=_0x30d90a){_0x3258cc=_0x30d90a;_0x15841d=0xc8;}else{_0x15841d=0xce;}_0x5d0b14[_0x4426('0x1b')](_0x15841d);return _0x5d0b14[_0x4426('0x20')](_0x4426('0x21'),_0x2a2bad+'-'+_0x3258cc+'/'+_0x30d90a)['json'](_0x3b7394);}return null;};}function patchUpdates(_0x5fed41){return function(_0x2c44b2){try{jsonpatch['apply'](_0x2c44b2,_0x5fed41,!![]);}catch(_0x3fc5c6){return BPromise[_0x4426('0x22')](_0x3fc5c6);}return _0x2c44b2['save']();};}function saveUpdates(_0x4c4adf,_0x3957a9){return function(_0x255760){if(_0x255760){return _0x255760['update'](_0x4c4adf)[_0x4426('0x23')](function(_0x50ed48){return _0x50ed48;});}return null;};}function removeEntity(_0x337c78,_0x4ecc03){return function(_0x3e2e29){if(_0x3e2e29){return _0x3e2e29[_0x4426('0x24')]()['then'](function(){_0x337c78[_0x4426('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530d2f,_0x3c8774){return function(_0xd674c2){if(!_0xd674c2){_0x530d2f['sendStatus'](0x194);}return _0xd674c2;};}function handleError(_0xe6b920,_0x347015){_0x347015=_0x347015||0x1f4;return function(_0x491f0a){logger['error'](_0x491f0a[_0x4426('0x25')]);if(_0x491f0a[_0x4426('0x26')]){delete _0x491f0a[_0x4426('0x26')];}_0xe6b920[_0x4426('0x1b')](_0x347015)['send'](_0x491f0a);};}exports[_0x4426('0x27')]=function(_0x1821cb,_0x4fe377){var _0x29cbdf={},_0x579bfc={},_0x1cfeae={'count':0x0,'rows':[]};var _0x3c5a39=_[_0x4426('0x28')](db[_0x4426('0x29')][_0x4426('0x2a')],function(_0xe49e2){return{'name':_0xe49e2[_0x4426('0x2b')],'type':_0xe49e2[_0x4426('0x2c')][_0x4426('0x2d')]};});_0x579bfc[_0x4426('0x2e')]=_[_0x4426('0x28')](_0x3c5a39,_0x4426('0x26'));_0x579bfc[_0x4426('0x2f')]=_[_0x4426('0x30')](_0x1821cb['query']);_0x579bfc[_0x4426('0x31')]=_[_0x4426('0x32')](_0x579bfc[_0x4426('0x2e')],_0x579bfc['query']);_0x29cbdf[_0x4426('0x33')]=_[_0x4426('0x32')](_0x579bfc[_0x4426('0x2e')],qs[_0x4426('0x34')](_0x1821cb['query']['fields']));_0x29cbdf[_0x4426('0x33')]=_0x29cbdf['attributes']['length']?_0x29cbdf['attributes']:_0x579bfc[_0x4426('0x2e')];if(!_0x1821cb[_0x4426('0x2f')][_0x4426('0x35')]('nolimit')){_0x29cbdf[_0x4426('0x1e')]=qs[_0x4426('0x1e')](_0x1821cb[_0x4426('0x2f')][_0x4426('0x1e')]);_0x29cbdf[_0x4426('0x1f')]=qs[_0x4426('0x1f')](_0x1821cb[_0x4426('0x2f')][_0x4426('0x1f')]);}_0x29cbdf[_0x4426('0x36')]=qs['sort'](_0x1821cb[_0x4426('0x2f')][_0x4426('0x37')]);_0x29cbdf[_0x4426('0x38')]=qs[_0x4426('0x31')](_[_0x4426('0x39')](_0x1821cb[_0x4426('0x2f')],_0x579bfc[_0x4426('0x31')]),_0x3c5a39);if(_0x1821cb['query']['filter']){_0x29cbdf[_0x4426('0x38')]=_[_0x4426('0x3a')](_0x29cbdf[_0x4426('0x38')],{'$or':_[_0x4426('0x28')](_0x3c5a39,function(_0x278ff6){if(_0x278ff6[_0x4426('0x2c')]!==_0x4426('0x3b')){var _0x311a5f={};_0x311a5f[_0x278ff6[_0x4426('0x26')]]={'$like':'%'+_0x1821cb['query'][_0x4426('0x3c')]+'%'};return _0x311a5f;}})});}_0x29cbdf=_['merge']({},_0x29cbdf,_0x1821cb['options']);var _0x509651={'where':_0x29cbdf[_0x4426('0x38')]};return db[_0x4426('0x29')]['count'](_0x509651)[_0x4426('0x23')](function(_0x4f2c95){_0x1cfeae['count']=_0x4f2c95;if(_0x1821cb[_0x4426('0x2f')][_0x4426('0x3d')]){_0x29cbdf[_0x4426('0x3e')]=[{'all':!![]}];}return db[_0x4426('0x29')][_0x4426('0x3f')](_0x29cbdf);})['then'](function(_0x203f9c){_0x1cfeae[_0x4426('0x40')]=_0x203f9c;return _0x1cfeae;})[_0x4426('0x23')](respondWithFilteredResult(_0x4fe377,_0x29cbdf))[_0x4426('0x41')](handleError(_0x4fe377,null));};exports[_0x4426('0x42')]=function(_0x29086a,_0x2789b7){var _0x595fd4={'raw':![],'where':{'id':_0x29086a[_0x4426('0x43')]['id']}},_0x597257={};_0x597257[_0x4426('0x2e')]=_['keys'](db[_0x4426('0x29')][_0x4426('0x2a')]);_0x597257[_0x4426('0x2f')]=_[_0x4426('0x30')](_0x29086a[_0x4426('0x2f')]);_0x597257[_0x4426('0x31')]=_['intersection'](_0x597257[_0x4426('0x2e')],_0x597257['query']);_0x595fd4['attributes']=_[_0x4426('0x32')](_0x597257[_0x4426('0x2e')],qs[_0x4426('0x34')](_0x29086a[_0x4426('0x2f')][_0x4426('0x34')]));_0x595fd4[_0x4426('0x33')]=_0x595fd4[_0x4426('0x33')][_0x4426('0x44')]?_0x595fd4[_0x4426('0x33')]:_0x597257[_0x4426('0x2e')];if(_0x29086a[_0x4426('0x2f')][_0x4426('0x3d')]){_0x595fd4['include']=[{'all':!![]}];}_0x595fd4=_[_0x4426('0x3a')]({},_0x595fd4,_0x29086a[_0x4426('0x45')]);return db['ServicenowAccount']['find'](_0x595fd4)[_0x4426('0x23')](handleEntityNotFound(_0x2789b7,null))[_0x4426('0x23')](respondWithResult(_0x2789b7,null))[_0x4426('0x41')](handleError(_0x2789b7,null));};exports[_0x4426('0x46')]=function(_0x5eab19,_0x2cc3f8){return db[_0x4426('0x29')][_0x4426('0x46')](_0x5eab19[_0x4426('0x47')],{})['then'](respondWithResult(_0x2cc3f8,0xc9))[_0x4426('0x41')](handleError(_0x2cc3f8,null));};exports[_0x4426('0x48')]=function(_0x37df74,_0x103995){if(_0x37df74[_0x4426('0x47')]['id']){delete _0x37df74[_0x4426('0x47')]['id'];}return db['ServicenowAccount'][_0x4426('0x49')]({'where':{'id':_0x37df74[_0x4426('0x43')]['id']}})[_0x4426('0x23')](handleEntityNotFound(_0x103995,null))[_0x4426('0x23')](saveUpdates(_0x37df74[_0x4426('0x47')],null))[_0x4426('0x23')](respondWithResult(_0x103995,null))['catch'](handleError(_0x103995,null));};exports['destroy']=function(_0x5cdba4,_0x1f6ded){return db[_0x4426('0x29')][_0x4426('0x49')]({'where':{'id':_0x5cdba4['params']['id']}})[_0x4426('0x23')](handleEntityNotFound(_0x1f6ded,null))[_0x4426('0x23')](removeEntity(_0x1f6ded,null))[_0x4426('0x41')](handleError(_0x1f6ded,null));};exports['getConfigurations']=function(_0xa0a68d,_0x16b11e,_0x1c0c5a){var _0x856120={};var _0x42f4b4={};var _0x199332;var _0x1436c8;return db[_0x4426('0x29')][_0x4426('0x4a')]({'where':{'id':_0xa0a68d[_0x4426('0x43')]['id']}})[_0x4426('0x23')](handleEntityNotFound(_0x16b11e,null))[_0x4426('0x23')](function(_0x35aa17){if(_0x35aa17){_0x199332=_0x35aa17;_0x42f4b4[_0x4426('0x2e')]=_[_0x4426('0x30')](db[_0x4426('0x4b')][_0x4426('0x2a')]);_0x42f4b4['query']=_[_0x4426('0x30')](_0xa0a68d[_0x4426('0x2f')]);_0x42f4b4[_0x4426('0x31')]=_[_0x4426('0x32')](_0x42f4b4[_0x4426('0x2e')],_0x42f4b4[_0x4426('0x2f')]);_0x856120[_0x4426('0x33')]=_[_0x4426('0x32')](_0x42f4b4[_0x4426('0x2e')],qs[_0x4426('0x34')](_0xa0a68d[_0x4426('0x2f')][_0x4426('0x34')]));_0x856120[_0x4426('0x33')]=_0x856120[_0x4426('0x33')][_0x4426('0x44')]?_0x856120[_0x4426('0x33')]:_0x42f4b4[_0x4426('0x2e')];_0x856120['order']=qs['sort'](_0xa0a68d[_0x4426('0x2f')][_0x4426('0x37')]);_0x856120[_0x4426('0x38')]=qs['filters'](_[_0x4426('0x39')](_0xa0a68d[_0x4426('0x2f')],_0x42f4b4[_0x4426('0x31')]));if(_0xa0a68d['query']['filter']){_0x856120[_0x4426('0x38')]=_[_0x4426('0x3a')](_0x856120['where'],{'$or':_['map'](_0x856120[_0x4426('0x33')],function(_0x1058e8){var _0x426b14={};_0x426b14[_0x1058e8]={'$like':'%'+_0xa0a68d[_0x4426('0x2f')][_0x4426('0x3c')]+'%'};return _0x426b14;})});}_0x856120=_['merge']({},_0x856120,_0xa0a68d[_0x4426('0x45')]);return _0x199332[_0x4426('0x4c')](_0x856120);}})[_0x4426('0x23')](function(_0x19b9e5){if(_0x19b9e5){_0x1436c8=_0x19b9e5['length'];if(!_0xa0a68d['query'][_0x4426('0x35')](_0x4426('0x4d'))){_0x856120[_0x4426('0x1e')]=qs[_0x4426('0x1e')](_0xa0a68d[_0x4426('0x2f')]['limit']);_0x856120[_0x4426('0x1f')]=qs['offset'](_0xa0a68d[_0x4426('0x2f')][_0x4426('0x1f')]);}return _0x199332['getConfigurations'](_0x856120);}})[_0x4426('0x23')](function(_0x5cfe38){if(_0x5cfe38){return _0x5cfe38?{'count':_0x1436c8,'rows':_0x5cfe38}:null;}})[_0x4426('0x23')](respondWithResult(_0x16b11e,null))[_0x4426('0x41')](handleError(_0x16b11e,null));};exports[_0x4426('0x4e')]=function(_0x5b6e3f,_0x1882d1,_0xde213f){if(_0x5b6e3f[_0x4426('0x47')]['id']){delete _0x5b6e3f[_0x4426('0x47')]['id'];}return db['ServicenowAccount'][_0x4426('0x4a')]({'where':{'id':_0x5b6e3f[_0x4426('0x43')]['id']}})[_0x4426('0x23')](handleEntityNotFound(_0x1882d1,null))[_0x4426('0x23')](function(_0x3ce498){if(_0x3ce498){_0x5b6e3f['body']['AccountId']=_0x3ce498['id'];_0x5b6e3f[_0x4426('0x47')][_0x4426('0x4f')]=integrations[_0x4426('0x50')](_0x5b6e3f[_0x4426('0x47')]['channel'],_0x5b6e3f[_0x4426('0x47')][_0x4426('0x2c')]);_0x5b6e3f[_0x4426('0x47')][_0x4426('0x51')]=integrations[_0x4426('0x52')](_0x5b6e3f[_0x4426('0x47')][_0x4426('0x53')],_0x5b6e3f[_0x4426('0x47')][_0x4426('0x2c')]);return db[_0x4426('0x4b')][_0x4426('0x46')](_0x5b6e3f[_0x4426('0x47')],{'include':[{'model':db['ServicenowField'],'as':_0x4426('0x4f')},{'model':db[_0x4426('0x54')],'as':'Descriptions'}]});}return null;})[_0x4426('0x23')](respondWithResult(_0x1882d1,null))[_0x4426('0x41')](handleError(_0x1882d1,null));};exports[_0x4426('0x55')]=function(_0x272ed8,_0x501fd2,_0x2f6fe3){var _0x3d19c6=[_0x4426('0x56'),'hold_reason',_0x4426('0x57'),_0x4426('0x58'),'close_code','notify',_0x4426('0x59'),_0x4426('0x5a'),_0x4426('0x5b')];var _0x239972=[_0x4426('0x5c'),'made_sla',_0x4426('0x5d'),_0x4426('0x5e'),_0x4426('0x5f'),_0x4426('0x60'),'child_incidents',_0x4426('0x61'),_0x4426('0x62'),_0x4426('0x63'),_0x4426('0x64'),_0x4426('0x65'),'opened_by','user_input',_0x4426('0x66'),_0x4426('0x67'),_0x4426('0x68'),_0x4426('0x69'),'knowledge',_0x4426('0x36'),_0x4426('0x6a'),_0x4426('0x6b'),'cmdb_ci',_0x4426('0x6c'),_0x4426('0x6d'),_0x4426('0x6e'),_0x4426('0x6f'),_0x4426('0x70'),_0x4426('0x71'),'sys_domain_path','rfc',_0x4426('0x72'),_0x4426('0x73'),_0x4426('0x74'),_0x4426('0x75'),'group_list',_0x4426('0x76'),_0x4426('0x77'),_0x4426('0x78'),'caller_id',_0x4426('0x79'),'subcategory',_0x4426('0x7a'),_0x4426('0x7b'),_0x4426('0x7c'),'correlation_display',_0x4426('0x7d'),_0x4426('0x7e'),'assignment_group',_0x4426('0x7f'),_0x4426('0x80'),_0x4426('0x81'),'calendar_duration',_0x4426('0x82'),_0x4426('0x83'),'close_notes',_0x4426('0x84'),'follow_up',_0x4426('0x85'),_0x4426('0x86'),_0x4426('0x87'),'reopened_by',_0x4426('0x59'),_0x4426('0x88'),_0x4426('0x89'),_0x4426('0x8a'),'reassignment_count',_0x4426('0x8b'),_0x4426('0x8c'),'severity','comments',_0x4426('0x8d'),_0x4426('0x8e'),_0x4426('0x8f'),_0x4426('0x90'),_0x4426('0x91'),_0x4426('0x92'),_0x4426('0x93'),_0x4426('0x94'),_0x4426('0x95'),'correlation_id',_0x4426('0x96'),_0x4426('0x5b')];var _0x52c56b='';var _0x28ff13='';var _0x291a1a=[];var _0x11aef5='';var _0x1df173='';var _0x1fcd17=[];var _0x33ee1d='';var _0x1b8a94='';var _0x37d067={};var _0x1541e9='';return db[_0x4426('0x29')][_0x4426('0x4a')]({'where':{'id':_0x272ed8['params']['id']},'attributes':['id',_0x4426('0x97'),_0x4426('0x98'),_0x4426('0x99'),_0x4426('0x9a'),'serverUrl']})['then'](handleEntityNotFound(_0x501fd2,null))[_0x4426('0x23')](function(_0x436a24){if(_0x436a24){_0x1541e9=_0x436a24[_0x4426('0x9a')];var _0x3b40a0=_0x1541e9['slice'](-0x1);if(_0x3b40a0==='/'){_0x1541e9=_0x1541e9[_0x4426('0x9b')](0x0,_0x1541e9[_0x4426('0x9c')](_0x3b40a0));}_0x1b8a94=util[_0x4426('0x9d')](_0x4426('0x9e'),_0x1541e9);_0x33ee1d=util[_0x4426('0x9d')](_0x4426('0x9f'),_0x1541e9);_0x37d067={'user':_0x436a24[_0x4426('0x97')],'pass':_0x436a24[_0x4426('0x98')]};var _0x403f2f={'method':_0x4426('0xa0'),'uri':_0x1b8a94+_0x4426('0xa1'),'auth':_0x37d067,'json':!![]};return rp(_0x403f2f);}})[_0x4426('0x23')](function(_0xe334d4){if(_0xe334d4['result'][_0x4426('0x44')]>0x0){_0x52c56b=_0xe334d4[_0x4426('0xa2')];}console[_0x4426('0xa3')]('incident\x20table\x20objects',_0x52c56b);_0x1fcd17=[];_0x28ff13=Object[_0x4426('0xa4')]([],_0x52c56b);_[_0x4426('0xa5')](_0x28ff13,function(_0x5cd44c){return!_0x3d19c6[_0x4426('0xa6')](_0x5cd44c[_0x4426('0x26')]);});_0x28ff13[_0x4426('0xa7')](function(_0x1572d6){var _0x2f5a98=createFieldObject(_0x33ee1d,_0x37d067,_0x1572d6[_0x4426('0xa8')],_0x1572d6[_0x4426('0x26')],_0x1572d6[_0x4426('0xa9')],![]);_0x1fcd17['push'](_0x2f5a98);});return Promise[_0x4426('0xaa')](_0x1fcd17);})['then'](function(_0x3cfeb0){_0x291a1a=_0x3cfeb0;_0x11aef5=Object[_0x4426('0xa4')]([],_0x52c56b);console['log'](_0x4426('0xab'),_0x52c56b);_[_0x4426('0xa5')](_0x11aef5,function(_0x1f2f4b){return _0x239972[_0x4426('0xa6')](_0x1f2f4b['name']);});console[_0x4426('0xa3')](_0x4426('0xac'),_0x11aef5);_0x1fcd17=[];_0x11aef5['forEach'](function(_0x3c68f6){var _0x30c1e4=createFieldObject(_0x33ee1d,_0x37d067,_0x3c68f6[_0x4426('0xa8')],_0x3c68f6[_0x4426('0x26')],_0x3c68f6[_0x4426('0xa9')],!![]);_0x1fcd17[_0x4426('0xad')](_0x30c1e4);});return Promise[_0x4426('0xaa')](_0x1fcd17);})[_0x4426('0x23')](function(_0x1ae14a){_0x1df173=_0x1ae14a;var _0x329515=_0x291a1a[_0x4426('0xae')](_0x1df173);return{'count':_0x329515[_0x4426('0x44')],'rows':_0x329515};})[_0x4426('0x23')](respondWithResult(_0x501fd2,null))['catch'](function(_0xec9f6){console[_0x4426('0xa3')](_0x4426('0xaf')+_0xec9f6);var _0x37cb19=_0x272ed8['query'][_0x4426('0xb0')]?0x1f4:_0xec9f6['statusCode']||0x1f4;logger[_0x4426('0xb1')](_0xec9f6['stack']);delete _0xec9f6[_0x4426('0x26')];if(_0x37cb19===0x191){_0x37cb19=0x190;}_0x501fd2[_0x4426('0x1b')](_0x37cb19)[_0x4426('0xb2')](_0x272ed8[_0x4426('0x2f')]['test']?{'message':_0x4426('0xb3'),'statusCode':_0xec9f6[_0x4426('0xb4')]}:_0xec9f6);});};function createFieldObject(_0x5d68b7,_0x19222c,_0x3a1369,_0x4bfceb,_0x563707,_0x28b2c6){return new Promise(function(_0x548e8e,_0xe8013a){var _0x213852={'id':_0x4bfceb,'name':_0x563707,'custom':_0x28b2c6};if(_0x3a1369===_0x4426('0xb5')){_0x213852[_0x4426('0x45')]=[{'name':_0x4426('0xb6'),'value':_0x4426('0xb7')},{'name':_0x4426('0xb8'),'value':_0x4426('0xb9')}];_0x548e8e(_0x213852);}else{var _0x2a4808={'method':_0x4426('0xa0'),'uri':_0x5d68b7+_0x4426('0xba')+_0x4bfceb,'auth':_0x19222c,'json':!![]};return rp(_0x2a4808)[_0x4426('0x23')](function(_0xd6f69){var _0x33d754=[];if(_0xd6f69[_0x4426('0xa2')][_0x4426('0x44')]>0x0){_0xd6f69['result'][_0x4426('0xa7')](function(_0x12b494){if(_0x12b494['inactive']===_0x4426('0xb9')){var _0x2901b6={'name':_0x12b494[_0x4426('0xa9')],'value':_0x12b494[_0x4426('0xbb')]};_0x33d754['push'](_0x2901b6);}});}_0x213852[_0x4426('0x45')]=_0x33d754;if(_0x213852[_0x4426('0x45')][_0x4426('0x44')]>0x0){_0x548e8e(_0x213852);}else{if(_0x28b2c6==![]){_0x548e8e();}else{_0x548e8e(_0x213852);}}});}});}
\ No newline at end of file
index 5cd8fbf..e993a85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x4e6ae7,_0x56aa97){var _0x7aac8e=function(_0x3c826d){while(--_0x3c826d){_0x4e6ae7['push'](_0x4e6ae7['shift']());}};_0x7aac8e(++_0x56aa97);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x2eb2[_0x3a6efd];return _0x487b9a;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x47f07d,_0x195757){var _0x3fbb32=function(_0xcc9fb8){while(--_0xcc9fb8){_0x47f07d['push'](_0x47f07d['shift']());}};_0x3fbb32(++_0x195757);}(_0x5fab,0x177));var _0xb5fa=function(_0x5a056e,_0x382a98){_0x5a056e=_0x5a056e-0x0;var _0x5e1dab=_0x5fab[_0x5a056e];return _0x5e1dab;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 373e712..b194a94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f1a=['jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3f1a,0x145));var _0xa3f1=function(_0x745766,_0x1a9f45){_0x745766=_0x745766-0x0;var _0xc461ad=_0x3f1a[_0x745766];return _0xc461ad;};'use strict';var _=require('lodash');var util=require(_0xa3f1('0x0'));var moment=require('moment');var BPromise=require(_0xa3f1('0x1'));var rs=require(_0xa3f1('0x2'));var fs=require('fs');var Redis=require(_0xa3f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3f1('0x4'));var logger=require(_0xa3f1('0x5'))(_0xa3f1('0x6'));var config=require(_0xa3f1('0x7'));var jayson=require(_0xa3f1('0x8'));var client=jayson[_0xa3f1('0x9')][_0xa3f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x400912,_0x39260b,_0x4e197a){return new BPromise(function(_0x39ce04,_0x482881){return client[_0xa3f1('0xb')](_0x400912,_0x4e197a)[_0xa3f1('0xc')](function(_0x531eae){logger[_0xa3f1('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x39260b,'request\x20sent');logger[_0xa3f1('0xe')](_0xa3f1('0xf'),_0x39260b,_0xa3f1('0x10'),JSON[_0xa3f1('0x11')](_0x531eae));if(_0x531eae['error']){if(_0x531eae['error'][_0xa3f1('0x12')]===0x1f4){logger[_0xa3f1('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x39260b,_0x531eae[_0xa3f1('0x13')][_0xa3f1('0x14')]);return _0x482881(_0x531eae[_0xa3f1('0x13')]['message']);}logger[_0xa3f1('0x13')](_0xa3f1('0x15'),_0x39260b,_0x531eae['error']['message']);return _0x39ce04(_0x531eae[_0xa3f1('0x13')][_0xa3f1('0x14')]);}else{logger[_0xa3f1('0xd')](_0xa3f1('0x15'),_0x39260b,_0xa3f1('0x10'));_0x39ce04(_0x531eae[_0xa3f1('0x16')]['message']);}})[_0xa3f1('0x17')](function(_0x112cff){logger['error'](_0xa3f1('0x15'),_0x39260b,_0x112cff);_0x482881(_0x112cff);});});}exports[_0xa3f1('0x18')]=function(_0x38fe75){var _0x7046c3=this;return new Promise(function(_0x4a7569,_0x50f670){return db['ServicenowAccount'][_0xa3f1('0x19')]({'raw':_0x38fe75[_0xa3f1('0x1a')]?_0x38fe75[_0xa3f1('0x1a')][_0xa3f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x38fe75[_0xa3f1('0x1a')]?_0x38fe75[_0xa3f1('0x1a')][_0xa3f1('0x1c')]||null:null,'attributes':_0x38fe75['options']?_0x38fe75[_0xa3f1('0x1a')][_0xa3f1('0x1d')]||null:null,'limit':_0x38fe75[_0xa3f1('0x1a')]?_0x38fe75[_0xa3f1('0x1a')][_0xa3f1('0x1e')]||null:null,'include':_0x38fe75['options']?_0x38fe75[_0xa3f1('0x1a')][_0xa3f1('0x1f')]?_[_0xa3f1('0x20')](_0x38fe75[_0xa3f1('0x1a')][_0xa3f1('0x1f')],function(_0x3bacef){return{'model':db[_0x3bacef[_0xa3f1('0x21')]],'as':_0x3bacef['as'],'attributes':_0x3bacef[_0xa3f1('0x1d')],'include':_0x3bacef['include']?_[_0xa3f1('0x20')](_0x3bacef[_0xa3f1('0x1f')],function(_0x4e433f){return{'model':db[_0x4e433f[_0xa3f1('0x21')]],'as':_0x4e433f['as'],'attributes':_0x4e433f[_0xa3f1('0x1d')],'include':_0x4e433f[_0xa3f1('0x1f')]?_['map'](_0x4e433f[_0xa3f1('0x1f')],function(_0x182e57){return{'model':db[_0x182e57[_0xa3f1('0x21')]],'as':_0x182e57['as'],'attributes':_0x182e57[_0xa3f1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x531526){logger[_0xa3f1('0xd')](_0xa3f1('0x18'),_0x38fe75);logger[_0xa3f1('0xe')]('GetServicenowAccount',_0x38fe75,JSON[_0xa3f1('0x11')](_0x531526));_0x4a7569(_0x531526);})[_0xa3f1('0x17')](function(_0x20a44a){logger[_0xa3f1('0x13')](_0xa3f1('0x18'),_0x20a44a[_0xa3f1('0x14')],_0x38fe75);_0x50f670(_0x7046c3[_0xa3f1('0x13')](0x1f4,_0x20a44a[_0xa3f1('0x14')]));});});};exports[_0xa3f1('0x22')]=function(_0x444c6b){var _0x4cf5a1=this;return new Promise(function(_0xc65a12,_0xde2394){return db[_0xa3f1('0x23')][_0xa3f1('0x24')]({'raw':_0x444c6b[_0xa3f1('0x1a')]?_0x444c6b['options'][_0xa3f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x444c6b[_0xa3f1('0x1a')]?_0x444c6b[_0xa3f1('0x1a')][_0xa3f1('0x1c')]||null:null,'attributes':_0x444c6b['options']?_0x444c6b[_0xa3f1('0x1a')][_0xa3f1('0x1d')]||null:null,'include':_0x444c6b[_0xa3f1('0x1a')]?_0x444c6b[_0xa3f1('0x1a')][_0xa3f1('0x1f')]?_[_0xa3f1('0x20')](_0x444c6b['options'][_0xa3f1('0x1f')],function(_0x2de9e0){return{'model':db[_0x2de9e0[_0xa3f1('0x21')]],'as':_0x2de9e0['as'],'attributes':_0x2de9e0[_0xa3f1('0x1d')],'include':_0x2de9e0['include']?_[_0xa3f1('0x20')](_0x2de9e0['include'],function(_0x1998ca){return{'model':db[_0x1998ca[_0xa3f1('0x21')]],'as':_0x1998ca['as'],'attributes':_0x1998ca[_0xa3f1('0x1d')],'include':_0x1998ca[_0xa3f1('0x1f')]?_[_0xa3f1('0x20')](_0x1998ca[_0xa3f1('0x1f')],function(_0x38c91f){return{'model':db[_0x38c91f[_0xa3f1('0x21')]],'as':_0x38c91f['as'],'attributes':_0x38c91f[_0xa3f1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a5b38){logger[_0xa3f1('0xd')]('ShowServicenowAccount',_0x444c6b);logger[_0xa3f1('0xe')](_0xa3f1('0x22'),_0x444c6b,JSON[_0xa3f1('0x11')](_0x2a5b38));_0xc65a12(_0x2a5b38);})[_0xa3f1('0x17')](function(_0x2fc81e){logger['error'](_0xa3f1('0x22'),_0x2fc81e['message'],_0x444c6b);_0xde2394(_0x4cf5a1[_0xa3f1('0x13')](0x1f4,_0x2fc81e[_0xa3f1('0x14')]));});});};
\ No newline at end of file
+var _0x6d1e=['options','raw','attributes','include','map','debug','ShowServicenowAccount','find','where','model','lodash','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x5746bf,_0x2e9ff8){var _0x3856e6=function(_0xb14007){while(--_0xb14007){_0x5746bf['push'](_0x5746bf['shift']());}};_0x3856e6(++_0x2e9ff8);}(_0x6d1e,0xf2));var _0xe6d1=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x6d1e[_0x18afca];return _0x11603f;};'use strict';var _=require(_0xe6d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6d1('0x1'));var logger=require(_0xe6d1('0x2'))(_0xe6d1('0x3'));var config=require(_0xe6d1('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xe6d1('0x5')][_0xe6d1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5e34ec,_0x5bb69d,_0x3057eb){return new BPromise(function(_0x56826a,_0x40f193){return client[_0xe6d1('0x7')](_0x5e34ec,_0x3057eb)['then'](function(_0x551237){logger[_0xe6d1('0x8')](_0xe6d1('0x9'),_0x5bb69d,'request\x20sent');logger['debug'](_0xe6d1('0xa'),_0x5bb69d,_0xe6d1('0xb'),JSON['stringify'](_0x551237));if(_0x551237[_0xe6d1('0xc')]){if(_0x551237[_0xe6d1('0xc')][_0xe6d1('0xd')]===0x1f4){logger[_0xe6d1('0xc')](_0xe6d1('0x9'),_0x5bb69d,_0x551237[_0xe6d1('0xc')][_0xe6d1('0xe')]);return _0x40f193(_0x551237['error'][_0xe6d1('0xe')]);}logger['error'](_0xe6d1('0x9'),_0x5bb69d,_0x551237['error']['message']);return _0x56826a(_0x551237[_0xe6d1('0xc')]['message']);}else{logger['info'](_0xe6d1('0x9'),_0x5bb69d,_0xe6d1('0xb'));_0x56826a(_0x551237['result']['message']);}})[_0xe6d1('0xf')](function(_0x559643){logger[_0xe6d1('0xc')](_0xe6d1('0x9'),_0x5bb69d,_0x559643);_0x40f193(_0x559643);});});}exports[_0xe6d1('0x10')]=function(_0x1a20a3){var _0x21c148=this;return new Promise(function(_0x5544df,_0x23c8d4){return db[_0xe6d1('0x11')][_0xe6d1('0x12')]({'raw':_0x1a20a3[_0xe6d1('0x13')]?_0x1a20a3[_0xe6d1('0x13')][_0xe6d1('0x14')]===undefined?!![]:![]:!![],'where':_0x1a20a3[_0xe6d1('0x13')]?_0x1a20a3['options']['where']||null:null,'attributes':_0x1a20a3[_0xe6d1('0x13')]?_0x1a20a3[_0xe6d1('0x13')][_0xe6d1('0x15')]||null:null,'limit':_0x1a20a3['options']?_0x1a20a3['options']['limit']||null:null,'include':_0x1a20a3[_0xe6d1('0x13')]?_0x1a20a3[_0xe6d1('0x13')]['include']?_['map'](_0x1a20a3['options'][_0xe6d1('0x16')],function(_0x43518c){return{'model':db[_0x43518c['model']],'as':_0x43518c['as'],'attributes':_0x43518c[_0xe6d1('0x15')],'include':_0x43518c[_0xe6d1('0x16')]?_[_0xe6d1('0x17')](_0x43518c['include'],function(_0x2871f8){return{'model':db[_0x2871f8['model']],'as':_0x2871f8['as'],'attributes':_0x2871f8['attributes'],'include':_0x2871f8['include']?_[_0xe6d1('0x17')](_0x2871f8[_0xe6d1('0x16')],function(_0x1fdf7c){return{'model':db[_0x1fdf7c['model']],'as':_0x1fdf7c['as'],'attributes':_0x1fdf7c[_0xe6d1('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x294132){logger[_0xe6d1('0x8')](_0xe6d1('0x10'),_0x1a20a3);logger[_0xe6d1('0x18')]('GetServicenowAccount',_0x1a20a3,JSON['stringify'](_0x294132));_0x5544df(_0x294132);})[_0xe6d1('0xf')](function(_0x6833ee){logger[_0xe6d1('0xc')](_0xe6d1('0x10'),_0x6833ee[_0xe6d1('0xe')],_0x1a20a3);_0x23c8d4(_0x21c148['error'](0x1f4,_0x6833ee[_0xe6d1('0xe')]));});});};exports[_0xe6d1('0x19')]=function(_0x576b6c){var _0x4d4c65=this;return new Promise(function(_0x3a895e,_0x3b3efc){return db[_0xe6d1('0x11')][_0xe6d1('0x1a')]({'raw':_0x576b6c['options']?_0x576b6c[_0xe6d1('0x13')][_0xe6d1('0x14')]===undefined?!![]:![]:!![],'where':_0x576b6c[_0xe6d1('0x13')]?_0x576b6c[_0xe6d1('0x13')][_0xe6d1('0x1b')]||null:null,'attributes':_0x576b6c[_0xe6d1('0x13')]?_0x576b6c[_0xe6d1('0x13')]['attributes']||null:null,'include':_0x576b6c[_0xe6d1('0x13')]?_0x576b6c[_0xe6d1('0x13')][_0xe6d1('0x16')]?_['map'](_0x576b6c[_0xe6d1('0x13')]['include'],function(_0x3b761d){return{'model':db[_0x3b761d[_0xe6d1('0x1c')]],'as':_0x3b761d['as'],'attributes':_0x3b761d[_0xe6d1('0x15')],'include':_0x3b761d['include']?_['map'](_0x3b761d[_0xe6d1('0x16')],function(_0x2fd367){return{'model':db[_0x2fd367[_0xe6d1('0x1c')]],'as':_0x2fd367['as'],'attributes':_0x2fd367['attributes'],'include':_0x2fd367[_0xe6d1('0x16')]?_[_0xe6d1('0x17')](_0x2fd367[_0xe6d1('0x16')],function(_0x2d17d5){return{'model':db[_0x2d17d5[_0xe6d1('0x1c')]],'as':_0x2d17d5['as'],'attributes':_0x2d17d5[_0xe6d1('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a536d){logger[_0xe6d1('0x8')]('ShowServicenowAccount',_0x576b6c);logger[_0xe6d1('0x18')](_0xe6d1('0x19'),_0x576b6c,JSON['stringify'](_0x1a536d));_0x3a895e(_0x1a536d);})[_0xe6d1('0xf')](function(_0x5cc685){logger['error']('ShowServicenowAccount',_0x5cc685[_0xe6d1('0xe')],_0x576b6c);_0x3b3efc(_0x4d4c65[_0xe6d1('0xc')](0x1f4,_0x5cc685[_0xe6d1('0xe')]));});});};
\ No newline at end of file
index d5c80e8..76d0efb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc204=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xc204,0x1de));var _0x4c20=function(_0x311c51,_0x3f7c83){_0x311c51=_0x311c51-0x0;var _0x385c87=_0xc204[_0x311c51];return _0x385c87;};'use strict';var multer=require(_0x4c20('0x0'));var util=require(_0x4c20('0x1'));var path=require(_0x4c20('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c20('0x3'));var router=express[_0x4c20('0x4')]();var fs_extra=require(_0x4c20('0x5'));var auth=require(_0x4c20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c20('0x7'));var controller=require(_0x4c20('0x8'));router[_0x4c20('0x9')]('/',auth[_0x4c20('0xa')](),controller[_0x4c20('0xb')]);router[_0x4c20('0x9')](_0x4c20('0xc'),auth['isAuthenticated'](),controller[_0x4c20('0xd')]);router['get'](_0x4c20('0xe'),auth['isAuthenticated'](),controller[_0x4c20('0xf')]);router[_0x4c20('0x9')](_0x4c20('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x4c20('0x9')](_0x4c20('0x11'),auth[_0x4c20('0xa')](),controller[_0x4c20('0x12')]);router[_0x4c20('0x13')]('/',auth[_0x4c20('0xa')](),controller[_0x4c20('0x14')]);router[_0x4c20('0x15')](_0x4c20('0xc'),auth['isAuthenticated'](),controller[_0x4c20('0x16')]);router['delete'](_0x4c20('0xc'),auth[_0x4c20('0xa')](),controller[_0x4c20('0x17')]);module['exports']=router;
\ No newline at end of file
+var _0xe793=['get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x1513b0,_0xefaa9c){var _0x14a988=function(_0x4bf0aa){while(--_0x4bf0aa){_0x1513b0['push'](_0x1513b0['shift']());}};_0x14a988(++_0xefaa9c);}(_0xe793,0x7e));var _0x3e79=function(_0x1a873a,_0x55f113){_0x1a873a=_0x1a873a-0x0;var _0x16fba2=_0xe793[_0x1a873a];return _0x16fba2;};'use strict';var multer=require(_0x3e79('0x0'));var util=require(_0x3e79('0x1'));var path=require('path');var timeout=require(_0x3e79('0x2'));var express=require(_0x3e79('0x3'));var router=express['Router']();var fs_extra=require(_0x3e79('0x4'));var auth=require(_0x3e79('0x5'));var interaction=require(_0x3e79('0x6'));var config=require(_0x3e79('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x3e79('0x8')](),controller[_0x3e79('0x9')]);router['get'](_0x3e79('0xa'),auth['isAuthenticated'](),controller[_0x3e79('0xb')]);router[_0x3e79('0xc')](_0x3e79('0xd'),auth[_0x3e79('0x8')](),controller[_0x3e79('0xe')]);router['get'](_0x3e79('0xf'),auth[_0x3e79('0x8')](),controller[_0x3e79('0x10')]);router[_0x3e79('0xc')]('/:id/descriptions',auth[_0x3e79('0x8')](),controller[_0x3e79('0x11')]);router['post']('/',auth[_0x3e79('0x8')](),controller[_0x3e79('0x12')]);router[_0x3e79('0x13')](_0x3e79('0xa'),auth[_0x3e79('0x8')](),controller[_0x3e79('0x14')]);router['delete']('/:id',auth[_0x3e79('0x8')](),controller[_0x3e79('0x15')]);module[_0x3e79('0x16')]=router;
\ No newline at end of file
index 882bca3..457df37 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8cad=['exports','STRING'];(function(_0x5812c3,_0x56da39){var _0x3219da=function(_0x55bc02){while(--_0x55bc02){_0x5812c3['push'](_0x5812c3['shift']());}};_0x3219da(++_0x56da39);}(_0x8cad,0x172));var _0xd8ca=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x8cad[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require('sequelize');module[_0xd8ca('0x0')]={'name':{'type':Sequelize[_0xd8ca('0x1')]},'description':{'type':Sequelize[_0xd8ca('0x1')]}};
\ No newline at end of file
+var _0xec93=['exports','STRING'];(function(_0x2b9f08,_0x32f052){var _0x375c87=function(_0x3b8b81){while(--_0x3b8b81){_0x2b9f08['push'](_0x2b9f08['shift']());}};_0x375c87(++_0x32f052);}(_0xec93,0x90));var _0x3ec9=function(_0xf1a3c1,_0x526dbc){_0xf1a3c1=_0xf1a3c1-0x0;var _0x4e0b60=_0xec93[_0xf1a3c1];return _0x4e0b60;};'use strict';var Sequelize=require('sequelize');module[_0x3ec9('0x0')]={'name':{'type':Sequelize[_0x3ec9('0x1')]},'description':{'type':Sequelize[_0x3ec9('0x1')]}};
\ No newline at end of file
index c2de860..e229f7c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb788=['findOne','ServicenowField','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','options','where','includeAll','findAll','rows','show','params','include','find','catch','create','body','destroy','getFields'];(function(_0x4c6fe9,_0x545ab3){var _0x4046b7=function(_0x5561a5){while(--_0x5561a5){_0x4c6fe9['push'](_0x4c6fe9['shift']());}};_0x4046b7(++_0x545ab3);}(_0xb788,0x1d9));var _0x8b78=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0xb788[_0x467e9e];return _0x10376a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b78('0x1'));var rp=require(_0x8b78('0x2'));var moment=require(_0x8b78('0x3'));var BPromise=require(_0x8b78('0x4'));var Mustache=require('mustache');var util=require(_0x8b78('0x5'));var path=require(_0x8b78('0x6'));var sox=require(_0x8b78('0x7'));var csv=require(_0x8b78('0x8'));var ejs=require(_0x8b78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8b78('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b78('0xb'));var toCsv=require(_0x8b78('0x8'));var querystring=require(_0x8b78('0xc'));var Papa=require(_0x8b78('0xd'));var Redis=require('ioredis');var authService=require(_0x8b78('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8b78('0xf'));var hardwareService=require(_0x8b78('0x10'));var logger=require(_0x8b78('0x11'))(_0x8b78('0x12'));var utils=require('../../config/utils');var config=require(_0x8b78('0x13'));var licenseUtil=require(_0x8b78('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1566,_0x3cbb34){_0x3cbb34=_0x3cbb34||0xcc;return function(_0xfc68c){if(_0xfc68c){return _0x1b1566[_0x8b78('0x15')](_0x3cbb34);}return _0x1b1566[_0x8b78('0x16')](_0x3cbb34)[_0x8b78('0x17')]();};}function respondWithResult(_0x5a0269,_0x24f1a8){_0x24f1a8=_0x24f1a8||0xc8;return function(_0x8427c){if(_0x8427c){return _0x5a0269[_0x8b78('0x16')](_0x24f1a8)[_0x8b78('0x18')](_0x8427c);}};}function respondWithFilteredResult(_0x506d15,_0xd7d662){return function(_0x570a6b){if(_0x570a6b){var _0x5e8593=typeof _0xd7d662[_0x8b78('0x19')]===_0x8b78('0x1a')&&typeof _0xd7d662[_0x8b78('0x1b')]===_0x8b78('0x1a');var _0x51e20c=_0x570a6b[_0x8b78('0x1c')];var _0x47dc9c=_0x5e8593?0x0:_0xd7d662[_0x8b78('0x19')];var _0x12f9c9=_0x5e8593?_0x570a6b[_0x8b78('0x1c')]:_0xd7d662['offset']+_0xd7d662[_0x8b78('0x1b')];var _0x5e48bc;if(_0x12f9c9>=_0x51e20c){_0x12f9c9=_0x51e20c;_0x5e48bc=0xc8;}else{_0x5e48bc=0xce;}_0x506d15[_0x8b78('0x16')](_0x5e48bc);return _0x506d15['set'](_0x8b78('0x1d'),_0x47dc9c+'-'+_0x12f9c9+'/'+_0x51e20c)['json'](_0x570a6b);}return null;};}function patchUpdates(_0x15567a){return function(_0x110ed7){try{jsonpatch[_0x8b78('0x1e')](_0x110ed7,_0x15567a,!![]);}catch(_0xc3d9a1){return BPromise[_0x8b78('0x1f')](_0xc3d9a1);}return _0x110ed7['save']();};}function saveUpdates(_0x524f22,_0x42773b){return function(_0x237328){if(_0x237328){return _0x237328[_0x8b78('0x20')](_0x524f22)[_0x8b78('0x21')](function(_0x42274f){return _0x42274f;});}return null;};}function removeEntity(_0x4a68f0,_0x3c3803){return function(_0x4cd851){if(_0x4cd851){return _0x4cd851['destroy']()['then'](function(){_0x4a68f0[_0x8b78('0x16')](0xcc)[_0x8b78('0x17')]();});}};}function handleEntityNotFound(_0x331f60,_0x346a19){return function(_0x45d9e0){if(!_0x45d9e0){_0x331f60[_0x8b78('0x15')](0x194);}return _0x45d9e0;};}function handleError(_0x23afcd,_0x16b23b){_0x16b23b=_0x16b23b||0x1f4;return function(_0x2681f1){logger[_0x8b78('0x22')](_0x2681f1[_0x8b78('0x23')]);if(_0x2681f1['name']){delete _0x2681f1[_0x8b78('0x24')];}_0x23afcd[_0x8b78('0x16')](_0x16b23b)[_0x8b78('0x25')](_0x2681f1);};}exports[_0x8b78('0x26')]=function(_0x1518dd,_0x2972b5){var _0x18a621={},_0x45fa0b={},_0x4e452d={'count':0x0,'rows':[]};var _0x3e7438=_['map'](db[_0x8b78('0x27')][_0x8b78('0x28')],function(_0x45967f){return{'name':_0x45967f[_0x8b78('0x29')],'type':_0x45967f[_0x8b78('0x2a')][_0x8b78('0x2b')]};});_0x45fa0b[_0x8b78('0x2c')]=_[_0x8b78('0x2d')](_0x3e7438,_0x8b78('0x24'));_0x45fa0b[_0x8b78('0x2e')]=_[_0x8b78('0x2f')](_0x1518dd[_0x8b78('0x2e')]);_0x45fa0b[_0x8b78('0x30')]=_[_0x8b78('0x31')](_0x45fa0b[_0x8b78('0x2c')],_0x45fa0b[_0x8b78('0x2e')]);_0x18a621['attributes']=_[_0x8b78('0x31')](_0x45fa0b['model'],qs[_0x8b78('0x32')](_0x1518dd['query']['fields']));_0x18a621[_0x8b78('0x33')]=_0x18a621[_0x8b78('0x33')][_0x8b78('0x34')]?_0x18a621[_0x8b78('0x33')]:_0x45fa0b[_0x8b78('0x2c')];if(!_0x1518dd[_0x8b78('0x2e')][_0x8b78('0x35')]('nolimit')){_0x18a621[_0x8b78('0x1b')]=qs[_0x8b78('0x1b')](_0x1518dd[_0x8b78('0x2e')][_0x8b78('0x1b')]);_0x18a621[_0x8b78('0x19')]=qs['offset'](_0x1518dd['query'][_0x8b78('0x19')]);}_0x18a621[_0x8b78('0x36')]=qs[_0x8b78('0x37')](_0x1518dd[_0x8b78('0x2e')]['sort']);_0x18a621['where']=qs[_0x8b78('0x30')](_[_0x8b78('0x38')](_0x1518dd[_0x8b78('0x2e')],_0x45fa0b[_0x8b78('0x30')]),_0x3e7438);if(_0x1518dd[_0x8b78('0x2e')][_0x8b78('0x39')]){_0x18a621['where']=_[_0x8b78('0x3a')](_0x18a621['where'],{'$or':_[_0x8b78('0x2d')](_0x3e7438,function(_0x22d351){if(_0x22d351[_0x8b78('0x2a')]!=='VIRTUAL'){var _0x1d33b9={};_0x1d33b9[_0x22d351[_0x8b78('0x24')]]={'$like':'%'+_0x1518dd[_0x8b78('0x2e')][_0x8b78('0x39')]+'%'};return _0x1d33b9;}})});}_0x18a621=_['merge']({},_0x18a621,_0x1518dd[_0x8b78('0x3b')]);var _0x1b7f08={'where':_0x18a621[_0x8b78('0x3c')]};return db[_0x8b78('0x27')][_0x8b78('0x1c')](_0x1b7f08)[_0x8b78('0x21')](function(_0x294725){_0x4e452d[_0x8b78('0x1c')]=_0x294725;if(_0x1518dd[_0x8b78('0x2e')][_0x8b78('0x3d')]){_0x18a621['include']=[{'all':!![]}];}return db[_0x8b78('0x27')][_0x8b78('0x3e')](_0x18a621);})[_0x8b78('0x21')](function(_0x81b833){_0x4e452d[_0x8b78('0x3f')]=_0x81b833;return _0x4e452d;})[_0x8b78('0x21')](respondWithFilteredResult(_0x2972b5,_0x18a621))['catch'](handleError(_0x2972b5,null));};exports[_0x8b78('0x40')]=function(_0x10d2ca,_0x521417){var _0x401698={'raw':![],'where':{'id':_0x10d2ca[_0x8b78('0x41')]['id']}},_0x4422d7={};_0x4422d7[_0x8b78('0x2c')]=_[_0x8b78('0x2f')](db[_0x8b78('0x27')][_0x8b78('0x28')]);_0x4422d7['query']=_[_0x8b78('0x2f')](_0x10d2ca[_0x8b78('0x2e')]);_0x4422d7[_0x8b78('0x30')]=_['intersection'](_0x4422d7[_0x8b78('0x2c')],_0x4422d7[_0x8b78('0x2e')]);_0x401698['attributes']=_[_0x8b78('0x31')](_0x4422d7[_0x8b78('0x2c')],qs[_0x8b78('0x32')](_0x10d2ca[_0x8b78('0x2e')]['fields']));_0x401698[_0x8b78('0x33')]=_0x401698[_0x8b78('0x33')][_0x8b78('0x34')]?_0x401698[_0x8b78('0x33')]:_0x4422d7['model'];if(_0x10d2ca[_0x8b78('0x2e')]['includeAll']){_0x401698[_0x8b78('0x42')]=[{'all':!![]}];}_0x401698=_[_0x8b78('0x3a')]({},_0x401698,_0x10d2ca[_0x8b78('0x3b')]);return db[_0x8b78('0x27')][_0x8b78('0x43')](_0x401698)[_0x8b78('0x21')](handleEntityNotFound(_0x521417,null))[_0x8b78('0x21')](respondWithResult(_0x521417,null))[_0x8b78('0x44')](handleError(_0x521417,null));};exports['create']=function(_0x4d6e08,_0xb85e8){return db[_0x8b78('0x27')][_0x8b78('0x45')](_0x4d6e08[_0x8b78('0x46')],{})['then'](respondWithResult(_0xb85e8,0xc9))[_0x8b78('0x44')](handleError(_0xb85e8,null));};exports[_0x8b78('0x20')]=function(_0x16a64f,_0x5f0f01){if(_0x16a64f[_0x8b78('0x46')]['id']){delete _0x16a64f[_0x8b78('0x46')]['id'];}return db[_0x8b78('0x27')][_0x8b78('0x43')]({'where':{'id':_0x16a64f[_0x8b78('0x41')]['id']}})[_0x8b78('0x21')](handleEntityNotFound(_0x5f0f01,null))[_0x8b78('0x21')](saveUpdates(_0x16a64f['body'],null))[_0x8b78('0x21')](respondWithResult(_0x5f0f01,null))[_0x8b78('0x44')](handleError(_0x5f0f01,null));};exports[_0x8b78('0x47')]=function(_0x496929,_0x266ffd){return db[_0x8b78('0x27')][_0x8b78('0x43')]({'where':{'id':_0x496929[_0x8b78('0x41')]['id']}})[_0x8b78('0x21')](handleEntityNotFound(_0x266ffd,null))[_0x8b78('0x21')](removeEntity(_0x266ffd,null))['catch'](handleError(_0x266ffd,null));};exports[_0x8b78('0x48')]=function(_0x3a4a2b,_0x438dbc,_0xfde2fc){var _0x31ee2e={};var _0x5b1e95={};var _0xac92d9;var _0x4b8959;return db[_0x8b78('0x27')][_0x8b78('0x49')]({'where':{'id':_0x3a4a2b['params']['id']}})[_0x8b78('0x21')](handleEntityNotFound(_0x438dbc,null))[_0x8b78('0x21')](function(_0x573f5e){if(_0x573f5e){_0xac92d9=_0x573f5e;_0x5b1e95['model']=_['keys'](db[_0x8b78('0x4a')][_0x8b78('0x28')]);_0x5b1e95[_0x8b78('0x2e')]=_[_0x8b78('0x2f')](_0x3a4a2b[_0x8b78('0x2e')]);_0x5b1e95['filters']=_[_0x8b78('0x31')](_0x5b1e95[_0x8b78('0x2c')],_0x5b1e95[_0x8b78('0x2e')]);_0x31ee2e[_0x8b78('0x33')]=_['intersection'](_0x5b1e95[_0x8b78('0x2c')],qs[_0x8b78('0x32')](_0x3a4a2b[_0x8b78('0x2e')][_0x8b78('0x32')]));_0x31ee2e['attributes']=_0x31ee2e['attributes'][_0x8b78('0x34')]?_0x31ee2e[_0x8b78('0x33')]:_0x5b1e95['model'];_0x31ee2e[_0x8b78('0x36')]=qs[_0x8b78('0x37')](_0x3a4a2b[_0x8b78('0x2e')][_0x8b78('0x37')]);_0x31ee2e[_0x8b78('0x3c')]=qs['filters'](_[_0x8b78('0x38')](_0x3a4a2b[_0x8b78('0x2e')],_0x5b1e95[_0x8b78('0x30')]));if(_0x3a4a2b[_0x8b78('0x2e')][_0x8b78('0x39')]){_0x31ee2e[_0x8b78('0x3c')]=_[_0x8b78('0x3a')](_0x31ee2e[_0x8b78('0x3c')],{'$or':_[_0x8b78('0x2d')](_0x31ee2e[_0x8b78('0x33')],function(_0x4d10cd){var _0x287f11={};_0x287f11[_0x4d10cd]={'$like':'%'+_0x3a4a2b[_0x8b78('0x2e')]['filter']+'%'};return _0x287f11;})});}_0x31ee2e=_[_0x8b78('0x3a')]({},_0x31ee2e,_0x3a4a2b['options']);return _0xac92d9[_0x8b78('0x48')](_0x31ee2e);}})[_0x8b78('0x21')](function(_0x32fe45){if(_0x32fe45){_0x4b8959=_0x32fe45[_0x8b78('0x34')];if(!_0x3a4a2b[_0x8b78('0x2e')][_0x8b78('0x35')](_0x8b78('0x4b'))){_0x31ee2e[_0x8b78('0x1b')]=qs[_0x8b78('0x1b')](_0x3a4a2b['query'][_0x8b78('0x1b')]);_0x31ee2e[_0x8b78('0x19')]=qs[_0x8b78('0x19')](_0x3a4a2b[_0x8b78('0x2e')]['offset']);}return _0xac92d9[_0x8b78('0x48')](_0x31ee2e);}})[_0x8b78('0x21')](function(_0x556285){if(_0x556285){return _0x556285?{'count':_0x4b8959,'rows':_0x556285}:null;}})['then'](respondWithResult(_0x438dbc,null))[_0x8b78('0x44')](handleError(_0x438dbc,null));};exports['getSubjects']=function(_0x3c33be,_0x556ce3,_0x191b62){var _0x3a9bf4={};var _0x1cea33={};var _0x1a1d43;var _0x279228;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3c33be[_0x8b78('0x41')]['id']}})['then'](handleEntityNotFound(_0x556ce3,null))[_0x8b78('0x21')](function(_0xd2712e){if(_0xd2712e){_0x1a1d43=_0xd2712e;_0x1cea33[_0x8b78('0x2c')]=_['keys'](db[_0x8b78('0x4a')]['rawAttributes']);_0x1cea33['query']=_['keys'](_0x3c33be[_0x8b78('0x2e')]);_0x1cea33['filters']=_[_0x8b78('0x31')](_0x1cea33[_0x8b78('0x2c')],_0x1cea33[_0x8b78('0x2e')]);_0x3a9bf4[_0x8b78('0x33')]=_[_0x8b78('0x31')](_0x1cea33['model'],qs['fields'](_0x3c33be[_0x8b78('0x2e')][_0x8b78('0x32')]));_0x3a9bf4[_0x8b78('0x33')]=_0x3a9bf4[_0x8b78('0x33')][_0x8b78('0x34')]?_0x3a9bf4['attributes']:_0x1cea33[_0x8b78('0x2c')];_0x3a9bf4[_0x8b78('0x36')]=qs[_0x8b78('0x37')](_0x3c33be['query'][_0x8b78('0x37')]);_0x3a9bf4[_0x8b78('0x3c')]=qs[_0x8b78('0x30')](_[_0x8b78('0x38')](_0x3c33be[_0x8b78('0x2e')],_0x1cea33[_0x8b78('0x30')]));if(_0x3c33be[_0x8b78('0x2e')][_0x8b78('0x39')]){_0x3a9bf4[_0x8b78('0x3c')]=_[_0x8b78('0x3a')](_0x3a9bf4[_0x8b78('0x3c')],{'$or':_[_0x8b78('0x2d')](_0x3a9bf4[_0x8b78('0x33')],function(_0xb6a539){var _0x340147={};_0x340147[_0xb6a539]={'$like':'%'+_0x3c33be[_0x8b78('0x2e')][_0x8b78('0x39')]+'%'};return _0x340147;})});}_0x3a9bf4=_['merge']({},_0x3a9bf4,_0x3c33be[_0x8b78('0x3b')]);return _0x1a1d43[_0x8b78('0x4c')](_0x3a9bf4);}})['then'](function(_0x4b43b7){if(_0x4b43b7){_0x279228=_0x4b43b7['length'];if(!_0x3c33be[_0x8b78('0x2e')]['hasOwnProperty'](_0x8b78('0x4b'))){_0x3a9bf4['limit']=qs[_0x8b78('0x1b')](_0x3c33be[_0x8b78('0x2e')][_0x8b78('0x1b')]);_0x3a9bf4['offset']=qs[_0x8b78('0x19')](_0x3c33be[_0x8b78('0x2e')]['offset']);}return _0x1a1d43['getSubjects'](_0x3a9bf4);}})[_0x8b78('0x21')](function(_0x3e1dce){if(_0x3e1dce){return _0x3e1dce?{'count':_0x279228,'rows':_0x3e1dce}:null;}})['then'](respondWithResult(_0x556ce3,null))[_0x8b78('0x44')](handleError(_0x556ce3,null));};exports[_0x8b78('0x4d')]=function(_0x542374,_0x421e25,_0x2064fd){var _0xf7b954={};var _0x2c0702={};var _0x95ced7;var _0x32d16d;return db[_0x8b78('0x27')]['findOne']({'where':{'id':_0x542374[_0x8b78('0x41')]['id']}})[_0x8b78('0x21')](handleEntityNotFound(_0x421e25,null))['then'](function(_0x29de36){if(_0x29de36){_0x95ced7=_0x29de36;_0x2c0702[_0x8b78('0x2c')]=_[_0x8b78('0x2f')](db[_0x8b78('0x4a')]['rawAttributes']);_0x2c0702[_0x8b78('0x2e')]=_[_0x8b78('0x2f')](_0x542374['query']);_0x2c0702[_0x8b78('0x30')]=_[_0x8b78('0x31')](_0x2c0702[_0x8b78('0x2c')],_0x2c0702[_0x8b78('0x2e')]);_0xf7b954[_0x8b78('0x33')]=_[_0x8b78('0x31')](_0x2c0702[_0x8b78('0x2c')],qs[_0x8b78('0x32')](_0x542374[_0x8b78('0x2e')]['fields']));_0xf7b954[_0x8b78('0x33')]=_0xf7b954[_0x8b78('0x33')][_0x8b78('0x34')]?_0xf7b954['attributes']:_0x2c0702[_0x8b78('0x2c')];_0xf7b954[_0x8b78('0x36')]=qs[_0x8b78('0x37')](_0x542374[_0x8b78('0x2e')]['sort']);_0xf7b954['where']=qs[_0x8b78('0x30')](_['pick'](_0x542374[_0x8b78('0x2e')],_0x2c0702[_0x8b78('0x30')]));if(_0x542374['query'][_0x8b78('0x39')]){_0xf7b954[_0x8b78('0x3c')]=_['merge'](_0xf7b954['where'],{'$or':_[_0x8b78('0x2d')](_0xf7b954[_0x8b78('0x33')],function(_0x514549){var _0x45fa57={};_0x45fa57[_0x514549]={'$like':'%'+_0x542374[_0x8b78('0x2e')][_0x8b78('0x39')]+'%'};return _0x45fa57;})});}_0xf7b954=_['merge']({},_0xf7b954,_0x542374[_0x8b78('0x3b')]);return _0x95ced7[_0x8b78('0x4d')](_0xf7b954);}})[_0x8b78('0x21')](function(_0xbc23b8){if(_0xbc23b8){_0x32d16d=_0xbc23b8[_0x8b78('0x34')];if(!_0x542374[_0x8b78('0x2e')][_0x8b78('0x35')](_0x8b78('0x4b'))){_0xf7b954['limit']=qs['limit'](_0x542374[_0x8b78('0x2e')]['limit']);_0xf7b954[_0x8b78('0x19')]=qs['offset'](_0x542374[_0x8b78('0x2e')]['offset']);}return _0x95ced7[_0x8b78('0x4d')](_0xf7b954);}})[_0x8b78('0x21')](function(_0x2b0006){if(_0x2b0006){return _0x2b0006?{'count':_0x32d16d,'rows':_0x2b0006}:null;}})[_0x8b78('0x21')](respondWithResult(_0x421e25,null))[_0x8b78('0x44')](handleError(_0x421e25,null));};
\ No newline at end of file
+var _0xf501=['params','length','find','create','body','findOne','ServicenowField','getFields','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','ServicenowConfiguration','findAll','rows','catch','show'];(function(_0x2ecd3c,_0x2c55e3){var _0x5ae37e=function(_0x3dc090){while(--_0x3dc090){_0x2ecd3c['push'](_0x2ecd3c['shift']());}};_0x5ae37e(++_0x2c55e3);}(_0xf501,0xad));var _0x1f50=function(_0x4fde0d,_0x157f1f){_0x4fde0d=_0x4fde0d-0x0;var _0x494d52=_0xf501[_0x4fde0d];return _0x494d52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f50('0x0'));var zipdir=require(_0x1f50('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f50('0x2'));var moment=require(_0x1f50('0x3'));var BPromise=require(_0x1f50('0x4'));var Mustache=require(_0x1f50('0x5'));var util=require(_0x1f50('0x6'));var path=require('path');var sox=require(_0x1f50('0x7'));var csv=require(_0x1f50('0x8'));var ejs=require(_0x1f50('0x9'));var fs=require('fs');var fs_extra=require(_0x1f50('0xa'));var _=require('lodash');var squel=require(_0x1f50('0xb'));var crypto=require(_0x1f50('0xc'));var jsforce=require(_0x1f50('0xd'));var deskjs=require(_0x1f50('0xe'));var toCsv=require(_0x1f50('0x8'));var querystring=require('querystring');var Papa=require(_0x1f50('0xf'));var Redis=require(_0x1f50('0x10'));var authService=require(_0x1f50('0x11'));var qs=require(_0x1f50('0x12'));var as=require(_0x1f50('0x13'));var hardwareService=require(_0x1f50('0x14'));var logger=require(_0x1f50('0x15'))('api');var utils=require(_0x1f50('0x16'));var config=require(_0x1f50('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f50('0x18'))['db'];function respondWithStatusCode(_0x38826b,_0x3436d9){_0x3436d9=_0x3436d9||0xcc;return function(_0x4373f9){if(_0x4373f9){return _0x38826b[_0x1f50('0x19')](_0x3436d9);}return _0x38826b['status'](_0x3436d9)[_0x1f50('0x1a')]();};}function respondWithResult(_0x382c15,_0x53ae3d){_0x53ae3d=_0x53ae3d||0xc8;return function(_0x1ec0a0){if(_0x1ec0a0){return _0x382c15['status'](_0x53ae3d)[_0x1f50('0x1b')](_0x1ec0a0);}};}function respondWithFilteredResult(_0x3d6eff,_0x21ea76){return function(_0xf8b770){if(_0xf8b770){var _0x400c24=typeof _0x21ea76[_0x1f50('0x1c')]==='undefined'&&typeof _0x21ea76[_0x1f50('0x1d')]==='undefined';var _0x5761c5=_0xf8b770['count'];var _0x4d9dd8=_0x400c24?0x0:_0x21ea76[_0x1f50('0x1c')];var _0x40ded8=_0x400c24?_0xf8b770[_0x1f50('0x1e')]:_0x21ea76['offset']+_0x21ea76['limit'];var _0x13266f;if(_0x40ded8>=_0x5761c5){_0x40ded8=_0x5761c5;_0x13266f=0xc8;}else{_0x13266f=0xce;}_0x3d6eff[_0x1f50('0x1f')](_0x13266f);return _0x3d6eff[_0x1f50('0x20')]('Content-Range',_0x4d9dd8+'-'+_0x40ded8+'/'+_0x5761c5)['json'](_0xf8b770);}return null;};}function patchUpdates(_0x377b58){return function(_0x1d1de2){try{jsonpatch[_0x1f50('0x21')](_0x1d1de2,_0x377b58,!![]);}catch(_0x47c255){return BPromise[_0x1f50('0x22')](_0x47c255);}return _0x1d1de2[_0x1f50('0x23')]();};}function saveUpdates(_0x36d45f,_0x3133fa){return function(_0x8fea83){if(_0x8fea83){return _0x8fea83[_0x1f50('0x24')](_0x36d45f)[_0x1f50('0x25')](function(_0x2f4a15){return _0x2f4a15;});}return null;};}function removeEntity(_0x31c730,_0x253ff1){return function(_0x1d5ebb){if(_0x1d5ebb){return _0x1d5ebb[_0x1f50('0x26')]()[_0x1f50('0x25')](function(){_0x31c730[_0x1f50('0x1f')](0xcc)[_0x1f50('0x1a')]();});}};}function handleEntityNotFound(_0x2c2bff,_0x263938){return function(_0x5dd129){if(!_0x5dd129){_0x2c2bff[_0x1f50('0x19')](0x194);}return _0x5dd129;};}function handleError(_0x5dd96d,_0x4ee102){_0x4ee102=_0x4ee102||0x1f4;return function(_0x5039c7){logger[_0x1f50('0x27')](_0x5039c7['stack']);if(_0x5039c7[_0x1f50('0x28')]){delete _0x5039c7[_0x1f50('0x28')];}_0x5dd96d[_0x1f50('0x1f')](_0x4ee102)[_0x1f50('0x29')](_0x5039c7);};}exports[_0x1f50('0x2a')]=function(_0x3e9135,_0x14fbd4){var _0x5503cf={},_0x460dbe={},_0x429bd0={'count':0x0,'rows':[]};var _0x14e69c=_['map'](db['ServicenowConfiguration'][_0x1f50('0x2b')],function(_0x2e4c43){return{'name':_0x2e4c43['fieldName'],'type':_0x2e4c43[_0x1f50('0x2c')][_0x1f50('0x2d')]};});_0x460dbe[_0x1f50('0x2e')]=_[_0x1f50('0x2f')](_0x14e69c,'name');_0x460dbe['query']=_[_0x1f50('0x30')](_0x3e9135[_0x1f50('0x31')]);_0x460dbe[_0x1f50('0x32')]=_[_0x1f50('0x33')](_0x460dbe['model'],_0x460dbe[_0x1f50('0x31')]);_0x5503cf['attributes']=_[_0x1f50('0x33')](_0x460dbe[_0x1f50('0x2e')],qs[_0x1f50('0x34')](_0x3e9135[_0x1f50('0x31')][_0x1f50('0x34')]));_0x5503cf[_0x1f50('0x35')]=_0x5503cf[_0x1f50('0x35')]['length']?_0x5503cf[_0x1f50('0x35')]:_0x460dbe[_0x1f50('0x2e')];if(!_0x3e9135['query']['hasOwnProperty'](_0x1f50('0x36'))){_0x5503cf[_0x1f50('0x1d')]=qs['limit'](_0x3e9135[_0x1f50('0x31')]['limit']);_0x5503cf[_0x1f50('0x1c')]=qs[_0x1f50('0x1c')](_0x3e9135[_0x1f50('0x31')][_0x1f50('0x1c')]);}_0x5503cf[_0x1f50('0x37')]=qs[_0x1f50('0x38')](_0x3e9135[_0x1f50('0x31')][_0x1f50('0x38')]);_0x5503cf[_0x1f50('0x39')]=qs['filters'](_[_0x1f50('0x3a')](_0x3e9135['query'],_0x460dbe[_0x1f50('0x32')]),_0x14e69c);if(_0x3e9135[_0x1f50('0x31')]['filter']){_0x5503cf[_0x1f50('0x39')]=_[_0x1f50('0x3b')](_0x5503cf[_0x1f50('0x39')],{'$or':_[_0x1f50('0x2f')](_0x14e69c,function(_0x1d5b65){if(_0x1d5b65[_0x1f50('0x2c')]!==_0x1f50('0x3c')){var _0x4c86aa={};_0x4c86aa[_0x1d5b65['name']]={'$like':'%'+_0x3e9135[_0x1f50('0x31')][_0x1f50('0x3d')]+'%'};return _0x4c86aa;}})});}_0x5503cf=_[_0x1f50('0x3b')]({},_0x5503cf,_0x3e9135[_0x1f50('0x3e')]);var _0x34f935={'where':_0x5503cf['where']};return db['ServicenowConfiguration'][_0x1f50('0x1e')](_0x34f935)[_0x1f50('0x25')](function(_0xec2c5c){_0x429bd0['count']=_0xec2c5c;if(_0x3e9135['query'][_0x1f50('0x3f')]){_0x5503cf[_0x1f50('0x40')]=[{'all':!![]}];}return db[_0x1f50('0x41')][_0x1f50('0x42')](_0x5503cf);})[_0x1f50('0x25')](function(_0x422890){_0x429bd0[_0x1f50('0x43')]=_0x422890;return _0x429bd0;})[_0x1f50('0x25')](respondWithFilteredResult(_0x14fbd4,_0x5503cf))[_0x1f50('0x44')](handleError(_0x14fbd4,null));};exports[_0x1f50('0x45')]=function(_0xe45814,_0x11994e){var _0x751a4e={'raw':![],'where':{'id':_0xe45814[_0x1f50('0x46')]['id']}},_0xa8bf97={};_0xa8bf97['model']=_['keys'](db[_0x1f50('0x41')][_0x1f50('0x2b')]);_0xa8bf97[_0x1f50('0x31')]=_[_0x1f50('0x30')](_0xe45814[_0x1f50('0x31')]);_0xa8bf97[_0x1f50('0x32')]=_['intersection'](_0xa8bf97['model'],_0xa8bf97[_0x1f50('0x31')]);_0x751a4e[_0x1f50('0x35')]=_['intersection'](_0xa8bf97['model'],qs[_0x1f50('0x34')](_0xe45814[_0x1f50('0x31')][_0x1f50('0x34')]));_0x751a4e[_0x1f50('0x35')]=_0x751a4e[_0x1f50('0x35')][_0x1f50('0x47')]?_0x751a4e[_0x1f50('0x35')]:_0xa8bf97[_0x1f50('0x2e')];if(_0xe45814[_0x1f50('0x31')]['includeAll']){_0x751a4e['include']=[{'all':!![]}];}_0x751a4e=_[_0x1f50('0x3b')]({},_0x751a4e,_0xe45814[_0x1f50('0x3e')]);return db[_0x1f50('0x41')][_0x1f50('0x48')](_0x751a4e)[_0x1f50('0x25')](handleEntityNotFound(_0x11994e,null))[_0x1f50('0x25')](respondWithResult(_0x11994e,null))['catch'](handleError(_0x11994e,null));};exports['create']=function(_0x131bd6,_0x3d22b8){return db[_0x1f50('0x41')][_0x1f50('0x49')](_0x131bd6[_0x1f50('0x4a')],{})[_0x1f50('0x25')](respondWithResult(_0x3d22b8,0xc9))[_0x1f50('0x44')](handleError(_0x3d22b8,null));};exports[_0x1f50('0x24')]=function(_0x4e2ab9,_0x2040cb){if(_0x4e2ab9[_0x1f50('0x4a')]['id']){delete _0x4e2ab9[_0x1f50('0x4a')]['id'];}return db[_0x1f50('0x41')][_0x1f50('0x48')]({'where':{'id':_0x4e2ab9['params']['id']}})[_0x1f50('0x25')](handleEntityNotFound(_0x2040cb,null))['then'](saveUpdates(_0x4e2ab9['body'],null))[_0x1f50('0x25')](respondWithResult(_0x2040cb,null))['catch'](handleError(_0x2040cb,null));};exports[_0x1f50('0x26')]=function(_0x252586,_0x308d22){return db[_0x1f50('0x41')]['find']({'where':{'id':_0x252586['params']['id']}})[_0x1f50('0x25')](handleEntityNotFound(_0x308d22,null))[_0x1f50('0x25')](removeEntity(_0x308d22,null))[_0x1f50('0x44')](handleError(_0x308d22,null));};exports['getFields']=function(_0x2b4e16,_0x365024,_0x349766){var _0x5d42cc={};var _0x25ca91={};var _0x1e8766;var _0x105775;return db[_0x1f50('0x41')][_0x1f50('0x4b')]({'where':{'id':_0x2b4e16['params']['id']}})[_0x1f50('0x25')](handleEntityNotFound(_0x365024,null))[_0x1f50('0x25')](function(_0x501a0f){if(_0x501a0f){_0x1e8766=_0x501a0f;_0x25ca91[_0x1f50('0x2e')]=_[_0x1f50('0x30')](db[_0x1f50('0x4c')][_0x1f50('0x2b')]);_0x25ca91[_0x1f50('0x31')]=_[_0x1f50('0x30')](_0x2b4e16[_0x1f50('0x31')]);_0x25ca91[_0x1f50('0x32')]=_['intersection'](_0x25ca91['model'],_0x25ca91['query']);_0x5d42cc[_0x1f50('0x35')]=_[_0x1f50('0x33')](_0x25ca91[_0x1f50('0x2e')],qs['fields'](_0x2b4e16[_0x1f50('0x31')]['fields']));_0x5d42cc['attributes']=_0x5d42cc['attributes'][_0x1f50('0x47')]?_0x5d42cc[_0x1f50('0x35')]:_0x25ca91['model'];_0x5d42cc[_0x1f50('0x37')]=qs[_0x1f50('0x38')](_0x2b4e16[_0x1f50('0x31')]['sort']);_0x5d42cc[_0x1f50('0x39')]=qs[_0x1f50('0x32')](_[_0x1f50('0x3a')](_0x2b4e16[_0x1f50('0x31')],_0x25ca91[_0x1f50('0x32')]));if(_0x2b4e16['query'][_0x1f50('0x3d')]){_0x5d42cc[_0x1f50('0x39')]=_['merge'](_0x5d42cc[_0x1f50('0x39')],{'$or':_['map'](_0x5d42cc[_0x1f50('0x35')],function(_0x5cee48){var _0x571d23={};_0x571d23[_0x5cee48]={'$like':'%'+_0x2b4e16[_0x1f50('0x31')][_0x1f50('0x3d')]+'%'};return _0x571d23;})});}_0x5d42cc=_[_0x1f50('0x3b')]({},_0x5d42cc,_0x2b4e16[_0x1f50('0x3e')]);return _0x1e8766[_0x1f50('0x4d')](_0x5d42cc);}})['then'](function(_0x1aa310){if(_0x1aa310){_0x105775=_0x1aa310['length'];if(!_0x2b4e16['query'][_0x1f50('0x4e')](_0x1f50('0x36'))){_0x5d42cc[_0x1f50('0x1d')]=qs[_0x1f50('0x1d')](_0x2b4e16[_0x1f50('0x31')][_0x1f50('0x1d')]);_0x5d42cc[_0x1f50('0x1c')]=qs['offset'](_0x2b4e16[_0x1f50('0x31')]['offset']);}return _0x1e8766[_0x1f50('0x4d')](_0x5d42cc);}})[_0x1f50('0x25')](function(_0x2f7da8){if(_0x2f7da8){return _0x2f7da8?{'count':_0x105775,'rows':_0x2f7da8}:null;}})[_0x1f50('0x25')](respondWithResult(_0x365024,null))[_0x1f50('0x44')](handleError(_0x365024,null));};exports[_0x1f50('0x4f')]=function(_0x6d407e,_0x271d6e,_0xb37934){var _0x3b2bae={};var _0x20236b={};var _0x5107d0;var _0x139259;return db[_0x1f50('0x41')][_0x1f50('0x4b')]({'where':{'id':_0x6d407e[_0x1f50('0x46')]['id']}})[_0x1f50('0x25')](handleEntityNotFound(_0x271d6e,null))[_0x1f50('0x25')](function(_0x25dc5c){if(_0x25dc5c){_0x5107d0=_0x25dc5c;_0x20236b[_0x1f50('0x2e')]=_[_0x1f50('0x30')](db[_0x1f50('0x4c')][_0x1f50('0x2b')]);_0x20236b[_0x1f50('0x31')]=_[_0x1f50('0x30')](_0x6d407e[_0x1f50('0x31')]);_0x20236b[_0x1f50('0x32')]=_[_0x1f50('0x33')](_0x20236b[_0x1f50('0x2e')],_0x20236b['query']);_0x3b2bae[_0x1f50('0x35')]=_[_0x1f50('0x33')](_0x20236b['model'],qs[_0x1f50('0x34')](_0x6d407e[_0x1f50('0x31')][_0x1f50('0x34')]));_0x3b2bae[_0x1f50('0x35')]=_0x3b2bae[_0x1f50('0x35')][_0x1f50('0x47')]?_0x3b2bae[_0x1f50('0x35')]:_0x20236b[_0x1f50('0x2e')];_0x3b2bae[_0x1f50('0x37')]=qs[_0x1f50('0x38')](_0x6d407e[_0x1f50('0x31')][_0x1f50('0x38')]);_0x3b2bae[_0x1f50('0x39')]=qs[_0x1f50('0x32')](_[_0x1f50('0x3a')](_0x6d407e['query'],_0x20236b[_0x1f50('0x32')]));if(_0x6d407e[_0x1f50('0x31')][_0x1f50('0x3d')]){_0x3b2bae[_0x1f50('0x39')]=_[_0x1f50('0x3b')](_0x3b2bae[_0x1f50('0x39')],{'$or':_[_0x1f50('0x2f')](_0x3b2bae['attributes'],function(_0x5bcd46){var _0xa24db3={};_0xa24db3[_0x5bcd46]={'$like':'%'+_0x6d407e[_0x1f50('0x31')][_0x1f50('0x3d')]+'%'};return _0xa24db3;})});}_0x3b2bae=_[_0x1f50('0x3b')]({},_0x3b2bae,_0x6d407e['options']);return _0x5107d0[_0x1f50('0x4f')](_0x3b2bae);}})['then'](function(_0x325bee){if(_0x325bee){_0x139259=_0x325bee[_0x1f50('0x47')];if(!_0x6d407e['query'][_0x1f50('0x4e')](_0x1f50('0x36'))){_0x3b2bae[_0x1f50('0x1d')]=qs['limit'](_0x6d407e[_0x1f50('0x31')][_0x1f50('0x1d')]);_0x3b2bae['offset']=qs[_0x1f50('0x1c')](_0x6d407e[_0x1f50('0x31')][_0x1f50('0x1c')]);}return _0x5107d0['getSubjects'](_0x3b2bae);}})[_0x1f50('0x25')](function(_0x39264b){if(_0x39264b){return _0x39264b?{'count':_0x139259,'rows':_0x39264b}:null;}})[_0x1f50('0x25')](respondWithResult(_0x271d6e,null))[_0x1f50('0x44')](handleError(_0x271d6e,null));};exports[_0x1f50('0x50')]=function(_0xcf0cb0,_0x52f4be,_0x8cc3e0){var _0x186424={};var _0x1996ed={};var _0x4654fd;var _0x33bbcd;return db[_0x1f50('0x41')][_0x1f50('0x4b')]({'where':{'id':_0xcf0cb0['params']['id']}})[_0x1f50('0x25')](handleEntityNotFound(_0x52f4be,null))['then'](function(_0x517b6b){if(_0x517b6b){_0x4654fd=_0x517b6b;_0x1996ed['model']=_[_0x1f50('0x30')](db[_0x1f50('0x4c')][_0x1f50('0x2b')]);_0x1996ed[_0x1f50('0x31')]=_[_0x1f50('0x30')](_0xcf0cb0[_0x1f50('0x31')]);_0x1996ed[_0x1f50('0x32')]=_[_0x1f50('0x33')](_0x1996ed[_0x1f50('0x2e')],_0x1996ed[_0x1f50('0x31')]);_0x186424[_0x1f50('0x35')]=_[_0x1f50('0x33')](_0x1996ed[_0x1f50('0x2e')],qs[_0x1f50('0x34')](_0xcf0cb0[_0x1f50('0x31')][_0x1f50('0x34')]));_0x186424[_0x1f50('0x35')]=_0x186424[_0x1f50('0x35')][_0x1f50('0x47')]?_0x186424['attributes']:_0x1996ed[_0x1f50('0x2e')];_0x186424[_0x1f50('0x37')]=qs[_0x1f50('0x38')](_0xcf0cb0[_0x1f50('0x31')][_0x1f50('0x38')]);_0x186424[_0x1f50('0x39')]=qs[_0x1f50('0x32')](_[_0x1f50('0x3a')](_0xcf0cb0[_0x1f50('0x31')],_0x1996ed['filters']));if(_0xcf0cb0['query']['filter']){_0x186424[_0x1f50('0x39')]=_[_0x1f50('0x3b')](_0x186424['where'],{'$or':_[_0x1f50('0x2f')](_0x186424['attributes'],function(_0x5c72ff){var _0x444269={};_0x444269[_0x5c72ff]={'$like':'%'+_0xcf0cb0['query'][_0x1f50('0x3d')]+'%'};return _0x444269;})});}_0x186424=_[_0x1f50('0x3b')]({},_0x186424,_0xcf0cb0[_0x1f50('0x3e')]);return _0x4654fd[_0x1f50('0x50')](_0x186424);}})[_0x1f50('0x25')](function(_0x3c5529){if(_0x3c5529){_0x33bbcd=_0x3c5529[_0x1f50('0x47')];if(!_0xcf0cb0[_0x1f50('0x31')][_0x1f50('0x4e')]('nolimit')){_0x186424[_0x1f50('0x1d')]=qs['limit'](_0xcf0cb0[_0x1f50('0x31')]['limit']);_0x186424[_0x1f50('0x1c')]=qs[_0x1f50('0x1c')](_0xcf0cb0[_0x1f50('0x31')]['offset']);}return _0x4654fd['getDescriptions'](_0x186424);}})['then'](function(_0x5e736b){if(_0x5e736b){return _0x5e736b?{'count':_0x33bbcd,'rows':_0x5e736b}:null;}})[_0x1f50('0x25')](respondWithResult(_0x52f4be,null))[_0x1f50('0x44')](handleError(_0x52f4be,null));};
\ No newline at end of file
index 08c3a3b..6d75c39 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc901=['ServicenowConfiguration','int_servicenow_configurations','lodash','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x327b6b,_0x5c61e3){var _0x41616b=function(_0x3cfd00){while(--_0x3cfd00){_0x327b6b['push'](_0x327b6b['shift']());}};_0x41616b(++_0x5c61e3);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c90('0x1'));var rp=require(_0x1c90('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c90('0x3'));var config=require(_0x1c90('0x4'));var attributes=require(_0x1c90('0x5'));module[_0x1c90('0x6')]=function(_0x1c9021,_0x14eb4f){return _0x1c9021[_0x1c90('0x7')](_0x1c90('0x8'),attributes,{'tableName':_0x1c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xda2d=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x30e641,_0x390ad9){var _0x13b6ae=function(_0x5c9b43){while(--_0x5c9b43){_0x30e641['push'](_0x30e641['shift']());}};_0x13b6ae(++_0x390ad9);}(_0xda2d,0x102));var _0xdda2=function(_0x2c535b,_0xaa9ff8){_0x2c535b=_0x2c535b-0x0;var _0x516ee4=_0xda2d[_0x2c535b];return _0x516ee4;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3b85563..149c8df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf715=['jayson/promise','client','http','request','info','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x336e61,_0xc7ccf0){var _0x32c815=function(_0x544cef){while(--_0x544cef){_0x336e61['push'](_0x336e61['shift']());}};_0x32c815(++_0xc7ccf0);}(_0xf715,0x90));var _0x5f71=function(_0x53e1fb,_0x17d039){_0x53e1fb=_0x53e1fb-0x0;var _0x70ced9=_0xf715[_0x53e1fb];return _0x70ced9;};'use strict';var _=require('lodash');var util=require(_0x5f71('0x0'));var moment=require('moment');var BPromise=require(_0x5f71('0x1'));var rs=require(_0x5f71('0x2'));var fs=require('fs');var Redis=require(_0x5f71('0x3'));var db=require(_0x5f71('0x4'))['db'];var utils=require(_0x5f71('0x5'));var logger=require(_0x5f71('0x6'))('rpc');var config=require(_0x5f71('0x7'));var jayson=require(_0x5f71('0x8'));var client=jayson[_0x5f71('0x9')][_0x5f71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4210a7,_0x5e34c0,_0x52cab5){return new BPromise(function(_0x7eec34,_0x2d0515){return client[_0x5f71('0xb')](_0x4210a7,_0x52cab5)['then'](function(_0x5d8110){logger[_0x5f71('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e34c0,_0x5f71('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5e34c0,'request\x20sent',JSON[_0x5f71('0xe')](_0x5d8110));if(_0x5d8110['error']){if(_0x5d8110['error']['code']===0x1f4){logger[_0x5f71('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e34c0,_0x5d8110[_0x5f71('0xf')][_0x5f71('0x10')]);return _0x2d0515(_0x5d8110['error'][_0x5f71('0x10')]);}logger[_0x5f71('0xf')](_0x5f71('0x11'),_0x5e34c0,_0x5d8110[_0x5f71('0xf')][_0x5f71('0x10')]);return _0x7eec34(_0x5d8110['error'][_0x5f71('0x10')]);}else{logger[_0x5f71('0xc')](_0x5f71('0x11'),_0x5e34c0,'request\x20sent');_0x7eec34(_0x5d8110[_0x5f71('0x12')][_0x5f71('0x10')]);}})['catch'](function(_0x532036){logger[_0x5f71('0xf')](_0x5f71('0x11'),_0x5e34c0,_0x532036);_0x2d0515(_0x532036);});});}
\ No newline at end of file
+var _0x0348=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x543e72,_0x4caa75){var _0x35aa66=function(_0x40b6a2){while(--_0x40b6a2){_0x543e72['push'](_0x543e72['shift']());}};_0x35aa66(++_0x4caa75);}(_0x0348,0x1e9));var _0x8034=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0x0348[_0x38ff1e];return _0x3755d4;};'use strict';var _=require('lodash');var util=require(_0x8034('0x0'));var moment=require('moment');var BPromise=require(_0x8034('0x1'));var rs=require(_0x8034('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8034('0x3'))['db'];var utils=require(_0x8034('0x4'));var logger=require(_0x8034('0x5'))(_0x8034('0x6'));var config=require(_0x8034('0x7'));var jayson=require(_0x8034('0x8'));var client=jayson[_0x8034('0x9')][_0x8034('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dfb10,_0x317fac,_0x1b9897){return new BPromise(function(_0x308814,_0x3ffa94){return client[_0x8034('0xb')](_0x5dfb10,_0x1b9897)[_0x8034('0xc')](function(_0x1ed3a9){logger[_0x8034('0xd')](_0x8034('0xe'),_0x317fac,_0x8034('0xf'));logger[_0x8034('0x10')](_0x8034('0x11'),_0x317fac,'request\x20sent',JSON[_0x8034('0x12')](_0x1ed3a9));if(_0x1ed3a9['error']){if(_0x1ed3a9[_0x8034('0x13')]['code']===0x1f4){logger[_0x8034('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x317fac,_0x1ed3a9['error'][_0x8034('0x14')]);return _0x3ffa94(_0x1ed3a9[_0x8034('0x13')][_0x8034('0x14')]);}logger['error'](_0x8034('0xe'),_0x317fac,_0x1ed3a9['error'][_0x8034('0x14')]);return _0x308814(_0x1ed3a9['error'][_0x8034('0x14')]);}else{logger[_0x8034('0xd')](_0x8034('0xe'),_0x317fac,_0x8034('0xf'));_0x308814(_0x1ed3a9['result']['message']);}})[_0x8034('0x15')](function(_0x40f002){logger[_0x8034('0x13')](_0x8034('0xe'),_0x317fac,_0x40f002);_0x3ffa94(_0x40f002);});});}
\ No newline at end of file
index bfc2569..0628b30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3274=['fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','multer','util','express'];(function(_0xc8a598,_0x8ffd7c){var _0x2a6225=function(_0x5f2d46){while(--_0x5f2d46){_0xc8a598['push'](_0xc8a598['shift']());}};_0x2a6225(++_0x8ffd7c);}(_0x3274,0x8d));var _0x4327=function(_0x26dd99,_0x5d9029){_0x26dd99=_0x26dd99-0x0;var _0x1f7ae2=_0x3274[_0x26dd99];return _0x1f7ae2;};'use strict';var multer=require(_0x4327('0x0'));var util=require(_0x4327('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4327('0x2'));var router=express['Router']();var fs_extra=require(_0x4327('0x3'));var auth=require(_0x4327('0x4'));var interaction=require(_0x4327('0x5'));var config=require('../../config/environment');var controller=require(_0x4327('0x6'));router[_0x4327('0x7')]('/',auth[_0x4327('0x8')](),controller[_0x4327('0x9')]);router[_0x4327('0x7')](_0x4327('0xa'),auth[_0x4327('0x8')](),controller[_0x4327('0xb')]);router['post']('/',auth[_0x4327('0x8')](),controller['create']);router[_0x4327('0xc')](_0x4327('0xa'),auth['isAuthenticated'](),controller[_0x4327('0xd')]);router[_0x4327('0xe')](_0x4327('0xa'),auth[_0x4327('0x8')](),controller['destroy']);module[_0x4327('0xf')]=router;
\ No newline at end of file
+var _0x1de6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','delete','exports','multer','path','connect-timeout','express'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x1de6,0x140));var _0x61de=function(_0x280c4b,_0xfe785d){_0x280c4b=_0x280c4b-0x0;var _0x2a5e90=_0x1de6[_0x280c4b];return _0x2a5e90;};'use strict';var multer=require(_0x61de('0x0'));var util=require('util');var path=require(_0x61de('0x1'));var timeout=require(_0x61de('0x2'));var express=require(_0x61de('0x3'));var router=express[_0x61de('0x4')]();var fs_extra=require(_0x61de('0x5'));var auth=require(_0x61de('0x6'));var interaction=require(_0x61de('0x7'));var config=require(_0x61de('0x8'));var controller=require(_0x61de('0x9'));router[_0x61de('0xa')]('/',auth[_0x61de('0xb')](),controller[_0x61de('0xc')]);router[_0x61de('0xa')](_0x61de('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x61de('0xe')]('/',auth[_0x61de('0xb')](),controller[_0x61de('0xf')]);router['put'](_0x61de('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x61de('0x10')](_0x61de('0xd'),auth[_0x61de('0xb')](),controller['destroy']);module[_0x61de('0x11')]=router;
\ No newline at end of file
index 5072c19..02306cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a22=['exports','ENUM','string','picklist','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x31eb10,_0x5ac7a4){var _0x153ba8=function(_0x45f3c5){while(--_0x45f3c5){_0x31eb10['push'](_0x31eb10['shift']());}};_0x153ba8(++_0x5ac7a4);}(_0x8a22,0xa1));var _0x28a2=function(_0x2f1a6a,_0x3b004f){_0x2f1a6a=_0x2f1a6a-0x0;var _0x1d3d0e=_0x8a22[_0x2f1a6a];return _0x1d3d0e;};'use strict';var Sequelize=require(_0x28a2('0x0'));module[_0x28a2('0x1')]={'type':{'type':Sequelize[_0x28a2('0x2')](_0x28a2('0x3'),'variable','customVariable','keyValue',_0x28a2('0x4')),'defaultValue':_0x28a2('0x3')},'content':{'type':Sequelize[_0x28a2('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x28a2('0x2')]('string',_0x28a2('0x6'),_0x28a2('0x7'))},'keyContent':{'type':Sequelize[_0x28a2('0x5')]},'idField':{'type':Sequelize[_0x28a2('0x5')]},'nameField':{'type':Sequelize[_0x28a2('0x5')]},'customField':{'type':Sequelize[_0x28a2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xd254=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x11b3f4,_0x371c17){var _0x47af1d=function(_0x11d38d){while(--_0x11d38d){_0x11b3f4['push'](_0x11b3f4['shift']());}};_0x47af1d(++_0x371c17);}(_0xd254,0x1e1));var _0x4d25=function(_0x247fbd,_0x319e79){_0x247fbd=_0x247fbd-0x0;var _0x452044=_0xd254[_0x247fbd];return _0x452044;};'use strict';var Sequelize=require(_0x4d25('0x0'));module[_0x4d25('0x1')]={'type':{'type':Sequelize[_0x4d25('0x2')](_0x4d25('0x3'),'variable',_0x4d25('0x4'),_0x4d25('0x5'),_0x4d25('0x6')),'defaultValue':_0x4d25('0x3')},'content':{'type':Sequelize[_0x4d25('0x7')]},'key':{'type':Sequelize[_0x4d25('0x7')]},'keyType':{'type':Sequelize[_0x4d25('0x2')](_0x4d25('0x3'),_0x4d25('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x4d25('0x7')]},'idField':{'type':Sequelize[_0x4d25('0x7')]},'nameField':{'type':Sequelize[_0x4d25('0x7')]},'customField':{'type':Sequelize[_0x4d25('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4d25('0x7')]}};
\ No newline at end of file
index a08372f..7f97730 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7ad=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','rows','catch','length','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','model','query','keys'];(function(_0x28411a,_0x529996){var _0x206ae6=function(_0x65a488){while(--_0x65a488){_0x28411a['push'](_0x28411a['shift']());}};_0x206ae6(++_0x529996);}(_0xd7ad,0xec));var _0xdd7a=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xd7ad[_0x1147ab];return _0x55cb5a;};'use strict';var emlformat=require(_0xdd7a('0x0'));var rimraf=require(_0xdd7a('0x1'));var zipdir=require(_0xdd7a('0x2'));var jsonpatch=require(_0xdd7a('0x3'));var rp=require('request-promise');var moment=require(_0xdd7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd7a('0x5'));var util=require(_0xdd7a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xdd7a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd7a('0x8'));var _=require(_0xdd7a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdd7a('0xa'));var deskjs=require(_0xdd7a('0xb'));var toCsv=require(_0xdd7a('0x7'));var querystring=require(_0xdd7a('0xc'));var Papa=require('papaparse');var Redis=require(_0xdd7a('0xd'));var authService=require(_0xdd7a('0xe'));var qs=require(_0xdd7a('0xf'));var as=require(_0xdd7a('0x10'));var hardwareService=require(_0xdd7a('0x11'));var logger=require(_0xdd7a('0x12'))(_0xdd7a('0x13'));var utils=require(_0xdd7a('0x14'));var config=require(_0xdd7a('0x15'));var licenseUtil=require(_0xdd7a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ada87,_0x2179a1){_0x2179a1=_0x2179a1||0xcc;return function(_0x270aeb){if(_0x270aeb){return _0x4ada87[_0xdd7a('0x17')](_0x2179a1);}return _0x4ada87['status'](_0x2179a1)['end']();};}function respondWithResult(_0x44062d,_0x1d62f1){_0x1d62f1=_0x1d62f1||0xc8;return function(_0x3263fb){if(_0x3263fb){return _0x44062d[_0xdd7a('0x18')](_0x1d62f1)[_0xdd7a('0x19')](_0x3263fb);}};}function respondWithFilteredResult(_0x478651,_0x2b9c46){return function(_0x2d6ed6){if(_0x2d6ed6){var _0x5028a0=typeof _0x2b9c46[_0xdd7a('0x1a')]==='undefined'&&typeof _0x2b9c46[_0xdd7a('0x1b')]===_0xdd7a('0x1c');var _0x56726f=_0x2d6ed6[_0xdd7a('0x1d')];var _0x2e8a66=_0x5028a0?0x0:_0x2b9c46['offset'];var _0x16691e=_0x5028a0?_0x2d6ed6[_0xdd7a('0x1d')]:_0x2b9c46[_0xdd7a('0x1a')]+_0x2b9c46[_0xdd7a('0x1b')];var _0x42eb1f;if(_0x16691e>=_0x56726f){_0x16691e=_0x56726f;_0x42eb1f=0xc8;}else{_0x42eb1f=0xce;}_0x478651[_0xdd7a('0x18')](_0x42eb1f);return _0x478651[_0xdd7a('0x1e')](_0xdd7a('0x1f'),_0x2e8a66+'-'+_0x16691e+'/'+_0x56726f)[_0xdd7a('0x19')](_0x2d6ed6);}return null;};}function patchUpdates(_0x35f5da){return function(_0x3e1081){try{jsonpatch['apply'](_0x3e1081,_0x35f5da,!![]);}catch(_0x288cac){return BPromise[_0xdd7a('0x20')](_0x288cac);}return _0x3e1081['save']();};}function saveUpdates(_0x4bb743,_0x13af8d){return function(_0x55c407){if(_0x55c407){return _0x55c407[_0xdd7a('0x21')](_0x4bb743)[_0xdd7a('0x22')](function(_0x17bb92){return _0x17bb92;});}return null;};}function removeEntity(_0x185f51,_0x2a5f7d){return function(_0xae98af){if(_0xae98af){return _0xae98af[_0xdd7a('0x23')]()['then'](function(){_0x185f51['status'](0xcc)[_0xdd7a('0x24')]();});}};}function handleEntityNotFound(_0x4d6eac,_0x3546f0){return function(_0x4bbae4){if(!_0x4bbae4){_0x4d6eac['sendStatus'](0x194);}return _0x4bbae4;};}function handleError(_0x58ef7d,_0x5d04c6){_0x5d04c6=_0x5d04c6||0x1f4;return function(_0x4adcd4){logger[_0xdd7a('0x25')](_0x4adcd4['stack']);if(_0x4adcd4[_0xdd7a('0x26')]){delete _0x4adcd4['name'];}_0x58ef7d['status'](_0x5d04c6)[_0xdd7a('0x27')](_0x4adcd4);};}exports[_0xdd7a('0x28')]=function(_0x495d72,_0x1c7e47){var _0x56d7ee={},_0x28b134={},_0x49bb56={'count':0x0,'rows':[]};var _0x2452fa=_[_0xdd7a('0x29')](db[_0xdd7a('0x2a')][_0xdd7a('0x2b')],function(_0x2d17ce){return{'name':_0x2d17ce[_0xdd7a('0x2c')],'type':_0x2d17ce['type']['key']};});_0x28b134[_0xdd7a('0x2d')]=_[_0xdd7a('0x29')](_0x2452fa,_0xdd7a('0x26'));_0x28b134[_0xdd7a('0x2e')]=_[_0xdd7a('0x2f')](_0x495d72[_0xdd7a('0x2e')]);_0x28b134[_0xdd7a('0x30')]=_[_0xdd7a('0x31')](_0x28b134['model'],_0x28b134[_0xdd7a('0x2e')]);_0x56d7ee[_0xdd7a('0x32')]=_[_0xdd7a('0x31')](_0x28b134[_0xdd7a('0x2d')],qs[_0xdd7a('0x33')](_0x495d72[_0xdd7a('0x2e')][_0xdd7a('0x33')]));_0x56d7ee['attributes']=_0x56d7ee['attributes']['length']?_0x56d7ee[_0xdd7a('0x32')]:_0x28b134[_0xdd7a('0x2d')];if(!_0x495d72[_0xdd7a('0x2e')][_0xdd7a('0x34')](_0xdd7a('0x35'))){_0x56d7ee[_0xdd7a('0x1b')]=qs[_0xdd7a('0x1b')](_0x495d72['query'][_0xdd7a('0x1b')]);_0x56d7ee[_0xdd7a('0x1a')]=qs[_0xdd7a('0x1a')](_0x495d72[_0xdd7a('0x2e')]['offset']);}_0x56d7ee[_0xdd7a('0x36')]=qs[_0xdd7a('0x37')](_0x495d72[_0xdd7a('0x2e')][_0xdd7a('0x37')]);_0x56d7ee['where']=qs['filters'](_[_0xdd7a('0x38')](_0x495d72[_0xdd7a('0x2e')],_0x28b134['filters']),_0x2452fa);if(_0x495d72['query'][_0xdd7a('0x39')]){_0x56d7ee[_0xdd7a('0x3a')]=_[_0xdd7a('0x3b')](_0x56d7ee[_0xdd7a('0x3a')],{'$or':_[_0xdd7a('0x29')](_0x2452fa,function(_0x1ecc0f){if(_0x1ecc0f[_0xdd7a('0x3c')]!==_0xdd7a('0x3d')){var _0xe25abf={};_0xe25abf[_0x1ecc0f[_0xdd7a('0x26')]]={'$like':'%'+_0x495d72[_0xdd7a('0x2e')][_0xdd7a('0x39')]+'%'};return _0xe25abf;}})});}_0x56d7ee=_['merge']({},_0x56d7ee,_0x495d72[_0xdd7a('0x3e')]);var _0xa77da6={'where':_0x56d7ee[_0xdd7a('0x3a')]};return db[_0xdd7a('0x2a')][_0xdd7a('0x1d')](_0xa77da6)[_0xdd7a('0x22')](function(_0x247aba){_0x49bb56[_0xdd7a('0x1d')]=_0x247aba;if(_0x495d72[_0xdd7a('0x2e')]['includeAll']){_0x56d7ee['include']=[{'all':!![]}];}return db[_0xdd7a('0x2a')]['findAll'](_0x56d7ee);})['then'](function(_0x40e429){_0x49bb56[_0xdd7a('0x3f')]=_0x40e429;return _0x49bb56;})[_0xdd7a('0x22')](respondWithFilteredResult(_0x1c7e47,_0x56d7ee))[_0xdd7a('0x40')](handleError(_0x1c7e47,null));};exports['show']=function(_0x5aab78,_0x3785ce){var _0x509ff5={'raw':!![],'where':{'id':_0x5aab78['params']['id']}},_0x39b574={};_0x39b574[_0xdd7a('0x2d')]=_[_0xdd7a('0x2f')](db[_0xdd7a('0x2a')][_0xdd7a('0x2b')]);_0x39b574['query']=_[_0xdd7a('0x2f')](_0x5aab78[_0xdd7a('0x2e')]);_0x39b574[_0xdd7a('0x30')]=_['intersection'](_0x39b574[_0xdd7a('0x2d')],_0x39b574['query']);_0x509ff5['attributes']=_[_0xdd7a('0x31')](_0x39b574[_0xdd7a('0x2d')],qs[_0xdd7a('0x33')](_0x5aab78[_0xdd7a('0x2e')][_0xdd7a('0x33')]));_0x509ff5[_0xdd7a('0x32')]=_0x509ff5['attributes'][_0xdd7a('0x41')]?_0x509ff5[_0xdd7a('0x32')]:_0x39b574['model'];if(_0x5aab78[_0xdd7a('0x2e')]['includeAll']){_0x509ff5[_0xdd7a('0x42')]=[{'all':!![]}];}_0x509ff5=_[_0xdd7a('0x3b')]({},_0x509ff5,_0x5aab78['options']);return db[_0xdd7a('0x2a')][_0xdd7a('0x43')](_0x509ff5)[_0xdd7a('0x22')](handleEntityNotFound(_0x3785ce,null))[_0xdd7a('0x22')](respondWithResult(_0x3785ce,null))[_0xdd7a('0x40')](handleError(_0x3785ce,null));};exports[_0xdd7a('0x44')]=function(_0x2ae96c,_0x542d68){return db['ServicenowField'][_0xdd7a('0x44')](_0x2ae96c[_0xdd7a('0x45')],{})['then'](respondWithResult(_0x542d68,0xc9))[_0xdd7a('0x40')](handleError(_0x542d68,null));};exports[_0xdd7a('0x21')]=function(_0x3b7353,_0x1c6d76){if(_0x3b7353['body']['id']){delete _0x3b7353[_0xdd7a('0x45')]['id'];}return db[_0xdd7a('0x2a')][_0xdd7a('0x43')]({'where':{'id':_0x3b7353[_0xdd7a('0x46')]['id']}})[_0xdd7a('0x22')](handleEntityNotFound(_0x1c6d76,null))['then'](saveUpdates(_0x3b7353[_0xdd7a('0x45')],null))[_0xdd7a('0x22')](respondWithResult(_0x1c6d76,null))['catch'](handleError(_0x1c6d76,null));};exports['destroy']=function(_0x3e79d4,_0x3892e8){return db[_0xdd7a('0x2a')][_0xdd7a('0x43')]({'where':{'id':_0x3e79d4[_0xdd7a('0x46')]['id']}})[_0xdd7a('0x22')](handleEntityNotFound(_0x3892e8,null))[_0xdd7a('0x22')](removeEntity(_0x3892e8,null))['catch'](handleError(_0x3892e8,null));};
\ No newline at end of file
+var _0xdbbe=['filter','merge','type','VIRTUAL','ServicenowField','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xdbbe,0x1de));var _0xedbb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdbbe[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xedbb('0x0'));var rimraf=require(_0xedbb('0x1'));var zipdir=require(_0xedbb('0x2'));var jsonpatch=require(_0xedbb('0x3'));var rp=require(_0xedbb('0x4'));var moment=require(_0xedbb('0x5'));var BPromise=require(_0xedbb('0x6'));var Mustache=require(_0xedbb('0x7'));var util=require('util');var path=require(_0xedbb('0x8'));var sox=require(_0xedbb('0x9'));var csv=require(_0xedbb('0xa'));var ejs=require(_0xedbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedbb('0xc'));var squel=require(_0xedbb('0xd'));var crypto=require(_0xedbb('0xe'));var jsforce=require(_0xedbb('0xf'));var deskjs=require(_0xedbb('0x10'));var toCsv=require(_0xedbb('0xa'));var querystring=require(_0xedbb('0x11'));var Papa=require(_0xedbb('0x12'));var Redis=require(_0xedbb('0x13'));var authService=require(_0xedbb('0x14'));var qs=require(_0xedbb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedbb('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xedbb('0x17'));var config=require(_0xedbb('0x18'));var licenseUtil=require(_0xedbb('0x19'));var db=require(_0xedbb('0x1a'))['db'];function respondWithStatusCode(_0x4732e7,_0x4468e8){_0x4468e8=_0x4468e8||0xcc;return function(_0x4f434b){if(_0x4f434b){return _0x4732e7[_0xedbb('0x1b')](_0x4468e8);}return _0x4732e7[_0xedbb('0x1c')](_0x4468e8)[_0xedbb('0x1d')]();};}function respondWithResult(_0x3e681b,_0x41336a){_0x41336a=_0x41336a||0xc8;return function(_0x2be697){if(_0x2be697){return _0x3e681b['status'](_0x41336a)[_0xedbb('0x1e')](_0x2be697);}};}function respondWithFilteredResult(_0x1f1414,_0x37574e){return function(_0x20bb40){if(_0x20bb40){var _0x3be71e=typeof _0x37574e[_0xedbb('0x1f')]===_0xedbb('0x20')&&typeof _0x37574e[_0xedbb('0x21')]===_0xedbb('0x20');var _0x26a293=_0x20bb40['count'];var _0x3007aa=_0x3be71e?0x0:_0x37574e[_0xedbb('0x1f')];var _0x396f38=_0x3be71e?_0x20bb40[_0xedbb('0x22')]:_0x37574e[_0xedbb('0x1f')]+_0x37574e[_0xedbb('0x21')];var _0x57daca;if(_0x396f38>=_0x26a293){_0x396f38=_0x26a293;_0x57daca=0xc8;}else{_0x57daca=0xce;}_0x1f1414[_0xedbb('0x1c')](_0x57daca);return _0x1f1414[_0xedbb('0x23')](_0xedbb('0x24'),_0x3007aa+'-'+_0x396f38+'/'+_0x26a293)[_0xedbb('0x1e')](_0x20bb40);}return null;};}function patchUpdates(_0x30de46){return function(_0x1d851d){try{jsonpatch['apply'](_0x1d851d,_0x30de46,!![]);}catch(_0x4f0698){return BPromise['reject'](_0x4f0698);}return _0x1d851d[_0xedbb('0x25')]();};}function saveUpdates(_0x4a91d0,_0x1eb3c3){return function(_0x2975fc){if(_0x2975fc){return _0x2975fc[_0xedbb('0x26')](_0x4a91d0)[_0xedbb('0x27')](function(_0x151201){return _0x151201;});}return null;};}function removeEntity(_0x49bc5a,_0x38ddf5){return function(_0x1f54fc){if(_0x1f54fc){return _0x1f54fc['destroy']()[_0xedbb('0x27')](function(){_0x49bc5a['status'](0xcc)[_0xedbb('0x1d')]();});}};}function handleEntityNotFound(_0x237d37,_0x4afb18){return function(_0x532518){if(!_0x532518){_0x237d37['sendStatus'](0x194);}return _0x532518;};}function handleError(_0x3e9b1a,_0xd92e7f){_0xd92e7f=_0xd92e7f||0x1f4;return function(_0x5eb589){logger[_0xedbb('0x28')](_0x5eb589[_0xedbb('0x29')]);if(_0x5eb589[_0xedbb('0x2a')]){delete _0x5eb589[_0xedbb('0x2a')];}_0x3e9b1a[_0xedbb('0x1c')](_0xd92e7f)['send'](_0x5eb589);};}exports[_0xedbb('0x2b')]=function(_0x16854b,_0x12b35d){var _0x4840ef={},_0x5c31c6={},_0x568133={'count':0x0,'rows':[]};var _0x3065ad=_['map'](db['ServicenowField'][_0xedbb('0x2c')],function(_0x44501e){return{'name':_0x44501e[_0xedbb('0x2d')],'type':_0x44501e['type'][_0xedbb('0x2e')]};});_0x5c31c6['model']=_[_0xedbb('0x2f')](_0x3065ad,_0xedbb('0x2a'));_0x5c31c6[_0xedbb('0x30')]=_[_0xedbb('0x31')](_0x16854b[_0xedbb('0x30')]);_0x5c31c6[_0xedbb('0x32')]=_[_0xedbb('0x33')](_0x5c31c6[_0xedbb('0x34')],_0x5c31c6['query']);_0x4840ef['attributes']=_[_0xedbb('0x33')](_0x5c31c6['model'],qs[_0xedbb('0x35')](_0x16854b[_0xedbb('0x30')]['fields']));_0x4840ef[_0xedbb('0x36')]=_0x4840ef['attributes']['length']?_0x4840ef[_0xedbb('0x36')]:_0x5c31c6[_0xedbb('0x34')];if(!_0x16854b['query'][_0xedbb('0x37')](_0xedbb('0x38'))){_0x4840ef[_0xedbb('0x21')]=qs[_0xedbb('0x21')](_0x16854b[_0xedbb('0x30')][_0xedbb('0x21')]);_0x4840ef[_0xedbb('0x1f')]=qs[_0xedbb('0x1f')](_0x16854b[_0xedbb('0x30')][_0xedbb('0x1f')]);}_0x4840ef[_0xedbb('0x39')]=qs[_0xedbb('0x3a')](_0x16854b[_0xedbb('0x30')][_0xedbb('0x3a')]);_0x4840ef[_0xedbb('0x3b')]=qs[_0xedbb('0x32')](_[_0xedbb('0x3c')](_0x16854b[_0xedbb('0x30')],_0x5c31c6['filters']),_0x3065ad);if(_0x16854b[_0xedbb('0x30')][_0xedbb('0x3d')]){_0x4840ef['where']=_[_0xedbb('0x3e')](_0x4840ef[_0xedbb('0x3b')],{'$or':_[_0xedbb('0x2f')](_0x3065ad,function(_0x1cf742){if(_0x1cf742[_0xedbb('0x3f')]!==_0xedbb('0x40')){var _0xbee48f={};_0xbee48f[_0x1cf742[_0xedbb('0x2a')]]={'$like':'%'+_0x16854b['query']['filter']+'%'};return _0xbee48f;}})});}_0x4840ef=_[_0xedbb('0x3e')]({},_0x4840ef,_0x16854b['options']);var _0xb17ae4={'where':_0x4840ef[_0xedbb('0x3b')]};return db[_0xedbb('0x41')][_0xedbb('0x22')](_0xb17ae4)['then'](function(_0x468181){_0x568133[_0xedbb('0x22')]=_0x468181;if(_0x16854b['query']['includeAll']){_0x4840ef[_0xedbb('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0xedbb('0x43')](_0x4840ef);})[_0xedbb('0x27')](function(_0x3d6681){_0x568133[_0xedbb('0x44')]=_0x3d6681;return _0x568133;})['then'](respondWithFilteredResult(_0x12b35d,_0x4840ef))[_0xedbb('0x45')](handleError(_0x12b35d,null));};exports[_0xedbb('0x46')]=function(_0x344401,_0x4f7c8f){var _0x42a1d3={'raw':!![],'where':{'id':_0x344401[_0xedbb('0x47')]['id']}},_0x513563={};_0x513563[_0xedbb('0x34')]=_[_0xedbb('0x31')](db['ServicenowField']['rawAttributes']);_0x513563[_0xedbb('0x30')]=_['keys'](_0x344401[_0xedbb('0x30')]);_0x513563[_0xedbb('0x32')]=_[_0xedbb('0x33')](_0x513563['model'],_0x513563[_0xedbb('0x30')]);_0x42a1d3[_0xedbb('0x36')]=_[_0xedbb('0x33')](_0x513563[_0xedbb('0x34')],qs[_0xedbb('0x35')](_0x344401[_0xedbb('0x30')][_0xedbb('0x35')]));_0x42a1d3[_0xedbb('0x36')]=_0x42a1d3['attributes'][_0xedbb('0x48')]?_0x42a1d3[_0xedbb('0x36')]:_0x513563[_0xedbb('0x34')];if(_0x344401['query']['includeAll']){_0x42a1d3[_0xedbb('0x42')]=[{'all':!![]}];}_0x42a1d3=_[_0xedbb('0x3e')]({},_0x42a1d3,_0x344401[_0xedbb('0x49')]);return db[_0xedbb('0x41')][_0xedbb('0x4a')](_0x42a1d3)[_0xedbb('0x27')](handleEntityNotFound(_0x4f7c8f,null))[_0xedbb('0x27')](respondWithResult(_0x4f7c8f,null))['catch'](handleError(_0x4f7c8f,null));};exports[_0xedbb('0x4b')]=function(_0x26e2c9,_0x42520b){return db[_0xedbb('0x41')][_0xedbb('0x4b')](_0x26e2c9['body'],{})['then'](respondWithResult(_0x42520b,0xc9))['catch'](handleError(_0x42520b,null));};exports[_0xedbb('0x26')]=function(_0x3d69cd,_0x3b54b6){if(_0x3d69cd[_0xedbb('0x4c')]['id']){delete _0x3d69cd[_0xedbb('0x4c')]['id'];}return db[_0xedbb('0x41')][_0xedbb('0x4a')]({'where':{'id':_0x3d69cd[_0xedbb('0x47')]['id']}})[_0xedbb('0x27')](handleEntityNotFound(_0x3b54b6,null))[_0xedbb('0x27')](saveUpdates(_0x3d69cd[_0xedbb('0x4c')],null))[_0xedbb('0x27')](respondWithResult(_0x3b54b6,null))[_0xedbb('0x45')](handleError(_0x3b54b6,null));};exports['destroy']=function(_0x300c5d,_0x37628b){return db[_0xedbb('0x41')]['find']({'where':{'id':_0x300c5d['params']['id']}})['then'](handleEntityNotFound(_0x37628b,null))[_0xedbb('0x27')](removeEntity(_0x37628b,null))[_0xedbb('0x45')](handleError(_0x37628b,null));};
\ No newline at end of file
index a2af622..6f6996b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7530=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0xe2a1aa,_0x525d7b){var _0x5a8362=function(_0x39aece){while(--_0x39aece){_0xe2a1aa['push'](_0xe2a1aa['shift']());}};_0x5a8362(++_0x525d7b);}(_0x7530,0x11a));var _0x0753=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x7530[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x0753('0x0'));var util=require('util');var logger=require(_0x0753('0x1'))(_0x0753('0x2'));var moment=require(_0x0753('0x3'));var BPromise=require('bluebird');var rp=require(_0x0753('0x4'));var fs=require('fs');var path=require(_0x0753('0x5'));var rimraf=require(_0x0753('0x6'));var config=require(_0x0753('0x7'));var attributes=require(_0x0753('0x8'));module[_0x0753('0x9')]=function(_0x4f7473,_0x54f895){return _0x4f7473[_0x0753('0xa')](_0x0753('0xb'),attributes,{'tableName':_0x0753('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0753('0xd'),_0x0753('0xe')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x8a97=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x8a97,0x15c));var _0x78a9=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8a97[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x78a9('0x0'));var util=require(_0x78a9('0x1'));var logger=require(_0x78a9('0x2'))(_0x78a9('0x3'));var moment=require(_0x78a9('0x4'));var BPromise=require(_0x78a9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78a9('0x6'));var rimraf=require(_0x78a9('0x7'));var config=require(_0x78a9('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x78a9('0x9')]=function(_0x4cd92b,_0x1e196d){return _0x4cd92b['define']('ServicenowField',attributes,{'tableName':_0x78a9('0xa'),'paranoid':![],'indexes':[{'name':_0x78a9('0xb'),'fields':[_0x78a9('0xc'),_0x78a9('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index e473e3f..851beee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x33af63,_0x261c83){var _0x32bb59=function(_0x422ba4){while(--_0x422ba4){_0x33af63['push'](_0x33af63['shift']());}};_0x32bb59(++_0x261c83);}(_0xe706,0xa3));var _0x6e70=function(_0x56d591,_0x3191a3){_0x56d591=_0x56d591-0x0;var _0x4bf0ff=_0xe706[_0x56d591];return _0x4bf0ff;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}
\ No newline at end of file
+var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0xbdb7[_0x401d67];return _0x25076b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}
\ No newline at end of file
index 70670e3..28dd69d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3b9e90,_0x5f017f){var _0x93cf2b=function(_0x1b45e9){while(--_0x1b45e9){_0x3b9e90['push'](_0x3b9e90['shift']());}};_0x93cf2b(++_0x5f017f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router;
\ No newline at end of file
+var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xdbfee7,_0x483f80){var _0x57a714=function(_0x3b0e80){while(--_0x3b0e80){_0xdbfee7['push'](_0xdbfee7['shift']());}};_0x57a714(++_0x483f80);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
index d848e8a..071ebf6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x204bf3,_0x74c9f2){var _0x4fa38d=function(_0x5f0334){while(--_0x5f0334){_0x204bf3['push'](_0x204bf3['shift']());}};_0x4fa38d(++_0x74c9f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3b001e,_0x2cab62){var _0x320d75=function(_0x563d4c){while(--_0x563d4c){_0x3b001e['push'](_0x3b001e['shift']());}};_0x320d75(++_0x2cab62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}};
\ No newline at end of file
index 2d62555..08aad3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ec1=['test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','error','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','VIRTUAL','includeAll','catch','show','options','find','create','body','update','params','findOne','length','sort','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','channel','SugarcrmConfiguration','SugarcrmField','Subjects','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0x6ec1,0x1ea));var _0x16ec=function(_0x1bc40c,_0x58bcb7){_0x1bc40c=_0x1bc40c-0x0;var _0x27a451=_0x6ec1[_0x1bc40c];return _0x27a451;};'use strict';var emlformat=require(_0x16ec('0x0'));var rimraf=require(_0x16ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16ec('0x2'));var rp=require(_0x16ec('0x3'));var moment=require(_0x16ec('0x4'));var BPromise=require(_0x16ec('0x5'));var Mustache=require(_0x16ec('0x6'));var util=require(_0x16ec('0x7'));var path=require(_0x16ec('0x8'));var sox=require(_0x16ec('0x9'));var csv=require('to-csv');var ejs=require(_0x16ec('0xa'));var fs=require('fs');var fs_extra=require(_0x16ec('0xb'));var _=require(_0x16ec('0xc'));var squel=require(_0x16ec('0xd'));var crypto=require(_0x16ec('0xe'));var jsforce=require(_0x16ec('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x16ec('0x10'));var querystring=require(_0x16ec('0x11'));var Papa=require(_0x16ec('0x12'));var Redis=require(_0x16ec('0x13'));var authService=require(_0x16ec('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x16ec('0x15'));var hardwareService=require(_0x16ec('0x16'));var logger=require(_0x16ec('0x17'))(_0x16ec('0x18'));var utils=require(_0x16ec('0x19'));var config=require(_0x16ec('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x16ec('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x38b892,_0x2cc712){_0x2cc712=_0x2cc712||0xcc;return function(_0x4cef1c){if(_0x4cef1c){return _0x38b892[_0x16ec('0x1c')](_0x2cc712);}return _0x38b892['status'](_0x2cc712)[_0x16ec('0x1d')]();};}function respondWithResult(_0x5e669c,_0x331e3d){_0x331e3d=_0x331e3d||0xc8;return function(_0x3b9c0b){if(_0x3b9c0b){return _0x5e669c[_0x16ec('0x1e')](_0x331e3d)[_0x16ec('0x1f')](_0x3b9c0b);}};}function respondWithFilteredResult(_0x5ecc85,_0x12a75d){return function(_0x1e7a3d){if(_0x1e7a3d){var _0x2c831f=typeof _0x12a75d['offset']===_0x16ec('0x20')&&typeof _0x12a75d[_0x16ec('0x21')]==='undefined';var _0x240f15=_0x1e7a3d[_0x16ec('0x22')];var _0x2fcc93=_0x2c831f?0x0:_0x12a75d['offset'];var _0x149dfe=_0x2c831f?_0x1e7a3d[_0x16ec('0x22')]:_0x12a75d[_0x16ec('0x23')]+_0x12a75d[_0x16ec('0x21')];var _0x116392;if(_0x149dfe>=_0x240f15){_0x149dfe=_0x240f15;_0x116392=0xc8;}else{_0x116392=0xce;}_0x5ecc85['status'](_0x116392);return _0x5ecc85['set'](_0x16ec('0x24'),_0x2fcc93+'-'+_0x149dfe+'/'+_0x240f15)[_0x16ec('0x1f')](_0x1e7a3d);}return null;};}function patchUpdates(_0x43b245){return function(_0x435b3e){try{jsonpatch[_0x16ec('0x25')](_0x435b3e,_0x43b245,!![]);}catch(_0x6b8e2){return BPromise['reject'](_0x6b8e2);}return _0x435b3e[_0x16ec('0x26')]();};}function saveUpdates(_0x27e373,_0x1781b2){return function(_0x35b85f){if(_0x35b85f){return _0x35b85f['update'](_0x27e373)[_0x16ec('0x27')](function(_0x3c9241){return _0x3c9241;});}return null;};}function removeEntity(_0x4dd289,_0x16706b){return function(_0x61eec5){if(_0x61eec5){return _0x61eec5[_0x16ec('0x28')]()['then'](function(){_0x4dd289[_0x16ec('0x1e')](0xcc)[_0x16ec('0x1d')]();});}};}function handleEntityNotFound(_0x53f121,_0x5d9c56){return function(_0x2251b1){if(!_0x2251b1){_0x53f121['sendStatus'](0x194);}return _0x2251b1;};}function handleError(_0x124083,_0x498d27){_0x498d27=_0x498d27||0x1f4;return function(_0x1f9506){logger[_0x16ec('0x29')](_0x1f9506['stack']);if(_0x1f9506[_0x16ec('0x2a')]){delete _0x1f9506[_0x16ec('0x2a')];}_0x124083[_0x16ec('0x1e')](_0x498d27)['send'](_0x1f9506);};}exports[_0x16ec('0x2b')]=function(_0x3bc036,_0x63d4cb){var _0x3dce37={},_0x1003d7={},_0x4254ef={'count':0x0,'rows':[]};var _0x2f627f=_[_0x16ec('0x2c')](db[_0x16ec('0x2d')][_0x16ec('0x2e')],function(_0x31b285){return{'name':_0x31b285[_0x16ec('0x2f')],'type':_0x31b285['type'][_0x16ec('0x30')]};});_0x1003d7[_0x16ec('0x31')]=_[_0x16ec('0x2c')](_0x2f627f,_0x16ec('0x2a'));_0x1003d7[_0x16ec('0x32')]=_[_0x16ec('0x33')](_0x3bc036[_0x16ec('0x32')]);_0x1003d7[_0x16ec('0x34')]=_[_0x16ec('0x35')](_0x1003d7[_0x16ec('0x31')],_0x1003d7['query']);_0x3dce37[_0x16ec('0x36')]=_[_0x16ec('0x35')](_0x1003d7['model'],qs[_0x16ec('0x37')](_0x3bc036[_0x16ec('0x32')]['fields']));_0x3dce37[_0x16ec('0x36')]=_0x3dce37[_0x16ec('0x36')]['length']?_0x3dce37[_0x16ec('0x36')]:_0x1003d7[_0x16ec('0x31')];if(!_0x3bc036['query'][_0x16ec('0x38')](_0x16ec('0x39'))){_0x3dce37[_0x16ec('0x21')]=qs[_0x16ec('0x21')](_0x3bc036['query'][_0x16ec('0x21')]);_0x3dce37['offset']=qs[_0x16ec('0x23')](_0x3bc036['query'][_0x16ec('0x23')]);}_0x3dce37[_0x16ec('0x3a')]=qs['sort'](_0x3bc036[_0x16ec('0x32')]['sort']);_0x3dce37['where']=qs['filters'](_[_0x16ec('0x3b')](_0x3bc036[_0x16ec('0x32')],_0x1003d7['filters']),_0x2f627f);if(_0x3bc036[_0x16ec('0x32')][_0x16ec('0x3c')]){_0x3dce37[_0x16ec('0x3d')]=_[_0x16ec('0x3e')](_0x3dce37[_0x16ec('0x3d')],{'$or':_['map'](_0x2f627f,function(_0x247aee){if(_0x247aee[_0x16ec('0x3f')]!==_0x16ec('0x40')){var _0x44d1b7={};_0x44d1b7[_0x247aee[_0x16ec('0x2a')]]={'$like':'%'+_0x3bc036[_0x16ec('0x32')][_0x16ec('0x3c')]+'%'};return _0x44d1b7;}})});}_0x3dce37=_[_0x16ec('0x3e')]({},_0x3dce37,_0x3bc036['options']);var _0x304e87={'where':_0x3dce37[_0x16ec('0x3d')]};return db['SugarcrmAccount'][_0x16ec('0x22')](_0x304e87)[_0x16ec('0x27')](function(_0x940e5c){_0x4254ef[_0x16ec('0x22')]=_0x940e5c;if(_0x3bc036[_0x16ec('0x32')][_0x16ec('0x41')]){_0x3dce37['include']=[{'all':!![]}];}return db[_0x16ec('0x2d')]['findAll'](_0x3dce37);})[_0x16ec('0x27')](function(_0xa86e75){_0x4254ef['rows']=_0xa86e75;return _0x4254ef;})['then'](respondWithFilteredResult(_0x63d4cb,_0x3dce37))[_0x16ec('0x42')](handleError(_0x63d4cb,null));};exports[_0x16ec('0x43')]=function(_0x2cd96b,_0x5424df){var _0x23a52b={'raw':![],'where':{'id':_0x2cd96b['params']['id']}},_0xbeb3a2={};_0xbeb3a2[_0x16ec('0x31')]=_['keys'](db[_0x16ec('0x2d')][_0x16ec('0x2e')]);_0xbeb3a2[_0x16ec('0x32')]=_[_0x16ec('0x33')](_0x2cd96b['query']);_0xbeb3a2[_0x16ec('0x34')]=_[_0x16ec('0x35')](_0xbeb3a2[_0x16ec('0x31')],_0xbeb3a2[_0x16ec('0x32')]);_0x23a52b[_0x16ec('0x36')]=_[_0x16ec('0x35')](_0xbeb3a2[_0x16ec('0x31')],qs[_0x16ec('0x37')](_0x2cd96b['query']['fields']));_0x23a52b[_0x16ec('0x36')]=_0x23a52b[_0x16ec('0x36')]['length']?_0x23a52b[_0x16ec('0x36')]:_0xbeb3a2['model'];if(_0x2cd96b[_0x16ec('0x32')]['includeAll']){_0x23a52b['include']=[{'all':!![]}];}_0x23a52b=_[_0x16ec('0x3e')]({},_0x23a52b,_0x2cd96b[_0x16ec('0x44')]);return db['SugarcrmAccount'][_0x16ec('0x45')](_0x23a52b)[_0x16ec('0x27')](handleEntityNotFound(_0x5424df,null))[_0x16ec('0x27')](respondWithResult(_0x5424df,null))[_0x16ec('0x42')](handleError(_0x5424df,null));};exports[_0x16ec('0x46')]=function(_0x30ded9,_0x5e4f07){return db[_0x16ec('0x2d')][_0x16ec('0x46')](_0x30ded9[_0x16ec('0x47')],{})['then'](respondWithResult(_0x5e4f07,0xc9))[_0x16ec('0x42')](handleError(_0x5e4f07,null));};exports[_0x16ec('0x48')]=function(_0x5e8d74,_0xce9afc){if(_0x5e8d74[_0x16ec('0x47')]['id']){delete _0x5e8d74[_0x16ec('0x47')]['id'];}return db[_0x16ec('0x2d')][_0x16ec('0x45')]({'where':{'id':_0x5e8d74[_0x16ec('0x49')]['id']}})[_0x16ec('0x27')](handleEntityNotFound(_0xce9afc,null))[_0x16ec('0x27')](saveUpdates(_0x5e8d74[_0x16ec('0x47')],null))[_0x16ec('0x27')](respondWithResult(_0xce9afc,null))[_0x16ec('0x42')](handleError(_0xce9afc,null));};exports['destroy']=function(_0x16850d,_0x576fc2){return db[_0x16ec('0x2d')][_0x16ec('0x45')]({'where':{'id':_0x16850d[_0x16ec('0x49')]['id']}})[_0x16ec('0x27')](handleEntityNotFound(_0x576fc2,null))[_0x16ec('0x27')](removeEntity(_0x576fc2,null))['catch'](handleError(_0x576fc2,null));};exports['getConfigurations']=function(_0x35ca56,_0xedb37,_0x372d6e){var _0x1fb70a={};var _0x2f2446={};var _0x19cb9f;var _0x3d1e6f;return db[_0x16ec('0x2d')][_0x16ec('0x4a')]({'where':{'id':_0x35ca56[_0x16ec('0x49')]['id']}})['then'](handleEntityNotFound(_0xedb37,null))['then'](function(_0x2e8ec5){if(_0x2e8ec5){_0x19cb9f=_0x2e8ec5;_0x2f2446[_0x16ec('0x31')]=_[_0x16ec('0x33')](db['SugarcrmConfiguration'][_0x16ec('0x2e')]);_0x2f2446[_0x16ec('0x32')]=_[_0x16ec('0x33')](_0x35ca56[_0x16ec('0x32')]);_0x2f2446[_0x16ec('0x34')]=_[_0x16ec('0x35')](_0x2f2446[_0x16ec('0x31')],_0x2f2446['query']);_0x1fb70a['attributes']=_['intersection'](_0x2f2446['model'],qs[_0x16ec('0x37')](_0x35ca56[_0x16ec('0x32')][_0x16ec('0x37')]));_0x1fb70a[_0x16ec('0x36')]=_0x1fb70a[_0x16ec('0x36')][_0x16ec('0x4b')]?_0x1fb70a[_0x16ec('0x36')]:_0x2f2446[_0x16ec('0x31')];_0x1fb70a[_0x16ec('0x3a')]=qs[_0x16ec('0x4c')](_0x35ca56[_0x16ec('0x32')][_0x16ec('0x4c')]);_0x1fb70a[_0x16ec('0x3d')]=qs[_0x16ec('0x34')](_[_0x16ec('0x3b')](_0x35ca56[_0x16ec('0x32')],_0x2f2446['filters']));if(_0x35ca56[_0x16ec('0x32')][_0x16ec('0x3c')]){_0x1fb70a[_0x16ec('0x3d')]=_['merge'](_0x1fb70a[_0x16ec('0x3d')],{'$or':_[_0x16ec('0x2c')](_0x1fb70a[_0x16ec('0x36')],function(_0x85b3c1){var _0x984e9b={};_0x984e9b[_0x85b3c1]={'$like':'%'+_0x35ca56['query'][_0x16ec('0x3c')]+'%'};return _0x984e9b;})});}_0x1fb70a=_['merge']({},_0x1fb70a,_0x35ca56[_0x16ec('0x44')]);return _0x19cb9f[_0x16ec('0x4d')](_0x1fb70a);}})[_0x16ec('0x27')](function(_0x47e36c){if(_0x47e36c){_0x3d1e6f=_0x47e36c[_0x16ec('0x4b')];if(!_0x35ca56[_0x16ec('0x32')][_0x16ec('0x38')]('nolimit')){_0x1fb70a[_0x16ec('0x21')]=qs[_0x16ec('0x21')](_0x35ca56[_0x16ec('0x32')][_0x16ec('0x21')]);_0x1fb70a[_0x16ec('0x23')]=qs['offset'](_0x35ca56['query'][_0x16ec('0x23')]);}return _0x19cb9f[_0x16ec('0x4d')](_0x1fb70a);}})[_0x16ec('0x27')](function(_0x47b459){if(_0x47b459){return _0x47b459?{'count':_0x3d1e6f,'rows':_0x47b459}:null;}})[_0x16ec('0x27')](respondWithResult(_0xedb37,null))[_0x16ec('0x42')](handleError(_0xedb37,null));};exports[_0x16ec('0x4e')]=function(_0x37a89d,_0x242fae,_0x3d654e){if(_0x37a89d[_0x16ec('0x47')]['id']){delete _0x37a89d[_0x16ec('0x47')]['id'];}return db[_0x16ec('0x2d')][_0x16ec('0x4a')]({'where':{'id':_0x37a89d[_0x16ec('0x49')]['id']}})[_0x16ec('0x27')](handleEntityNotFound(_0x242fae,null))[_0x16ec('0x27')](function(_0x5df72a){if(_0x5df72a){_0x37a89d[_0x16ec('0x47')][_0x16ec('0x4f')]=_0x5df72a['id'];_0x37a89d[_0x16ec('0x47')]['Subjects']=integrations[_0x16ec('0x50')](_0x37a89d[_0x16ec('0x47')]['channel'],_0x37a89d[_0x16ec('0x47')][_0x16ec('0x3f')]);_0x37a89d[_0x16ec('0x47')][_0x16ec('0x51')]=integrations['getDescriptions'](_0x37a89d[_0x16ec('0x47')][_0x16ec('0x52')],_0x37a89d['body']['type']);return db[_0x16ec('0x53')][_0x16ec('0x46')](_0x37a89d['body'],{'include':[{'model':db[_0x16ec('0x54')],'as':_0x16ec('0x55')},{'model':db[_0x16ec('0x54')],'as':_0x16ec('0x51')}]});}return null;})[_0x16ec('0x27')](respondWithResult(_0x242fae,null))[_0x16ec('0x42')](handleError(_0x242fae,null));};exports['getFields']=function(_0x1bce81,_0x1aa157,_0x2251fc){var _0x5f3ce9='';var _0x43255a=['id','name','assigned_user_id',_0x16ec('0x56'),_0x16ec('0x57'),_0x16ec('0x58'),_0x16ec('0x59'),_0x16ec('0x5a'),_0x16ec('0x5b'),_0x16ec('0x5c'),_0x16ec('0x5d'),_0x16ec('0x5e')];return db['SugarcrmAccount'][_0x16ec('0x4a')]({'where':{'id':_0x1bce81['params']['id']},'attributes':['id',_0x16ec('0x5f'),_0x16ec('0x60'),_0x16ec('0x61')]})[_0x16ec('0x27')](handleEntityNotFound(_0x1aa157,null))['then'](function(_0x1d5299){if(_0x1d5299){_0x5f3ce9=_0x1d5299[_0x16ec('0x61')];var _0xe4a943=_0x5f3ce9[_0x16ec('0x62')](-0x1);if(_0xe4a943==='/'){_0x5f3ce9=_0x5f3ce9[_0x16ec('0x63')](0x0,_0x5f3ce9[_0x16ec('0x64')](_0xe4a943));}return rp({'method':_0x16ec('0x65'),'uri':util['format'](_0x16ec('0x66'),_0x5f3ce9,_0x16ec('0x67')),'json':!![],'form':{'method':'login','input_type':_0x16ec('0x68'),'response_type':_0x16ec('0x68'),'rest_data':JSON[_0x16ec('0x69')]({'user_auth':{'user_name':_0x1d5299[_0x16ec('0x5f')],'password':_0x1d5299['password'],'encryption':_0x16ec('0x6a')},'application':_0x16ec('0x6b')})}});}})['then'](function(_0x3d18fc){if(_0x3d18fc&&_0x3d18fc[_0x16ec('0x2a')]!=='Invalid\x20Login'&&_0x3d18fc[_0x16ec('0x2a')]!==_0x16ec('0x6c')){return rp({'method':_0x16ec('0x65'),'uri':util[_0x16ec('0x6d')](_0x16ec('0x66'),_0x5f3ce9,_0x16ec('0x67')),'json':!![],'form':{'method':_0x16ec('0x6e'),'input_type':_0x16ec('0x68'),'response_type':_0x16ec('0x68'),'rest_data':JSON[_0x16ec('0x69')]({'session':_0x3d18fc['id'],'module_name':_0x16ec('0x6f')})}})[_0x16ec('0x27')](function(_0x14a241){if(_0x14a241){var _0xe7ab4=_[_0x16ec('0x70')](_0x14a241[_0x16ec('0x71')]);_[_0x16ec('0x72')](_0xe7ab4,function(_0x50fc9f){return _0x43255a['includes'](_0x50fc9f[_0x16ec('0x2a')]);});return{'count':_0xe7ab4['length'],'rows':_['map'](_0xe7ab4,function(_0x303cc0){return{'id':_0x303cc0['name'],'name':_0x303cc0[_0x16ec('0x73')],'custom':_['endsWith'](_0x303cc0[_0x16ec('0x2a')],'_c')?!![]:![],'options':_0x303cc0[_0x16ec('0x44')]?_[_0x16ec('0x2c')](_[_0x16ec('0x70')](_0x303cc0[_0x16ec('0x44')]),function(_0x4ad4b0){return{'name':_0x4ad4b0[_0x16ec('0x74')],'value':_0x4ad4b0[_0x16ec('0x2a')]};}):[]};})};}})[_0x16ec('0x27')](respondWithResult(_0x1aa157,null))[_0x16ec('0x42')](function(_0x12901a){var _0x432619=_0x1bce81[_0x16ec('0x32')]['test']?0x1f4:_0x12901a[_0x16ec('0x75')]||0x1f4;logger[_0x16ec('0x29')](_0x16ec('0x76'),_0x16ec('0x77'),_0x432619,JSON['stringify'](_0x12901a));delete _0x12901a[_0x16ec('0x2a')];if(_0x432619===0x191){_0x432619=0x190;}_0x1aa157[_0x16ec('0x1e')](_0x432619)['send'](_0x1bce81[_0x16ec('0x32')][_0x16ec('0x78')]?{'message':_0x16ec('0x79'),'statusCode':_0x12901a[_0x16ec('0x75')]}:_0x12901a);});}else{var _0x49ff6f=0x1f4;_0x1aa157['status'](_0x49ff6f)['send']({'message':_0x16ec('0x79'),'statusCode':0x190});}});};
\ No newline at end of file
+var _0x695b=['ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','findOne','keys','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x417538,_0x5a1ad6){var _0x3b15b1=function(_0x46e2dd){while(--_0x46e2dd){_0x417538['push'](_0x417538['shift']());}};_0x3b15b1(++_0x5a1ad6);}(_0x695b,0x74));var _0xb695=function(_0x471ac1,_0x2d40ce){_0x471ac1=_0x471ac1-0x0;var _0x4b5fd0=_0x695b[_0x471ac1];return _0x4b5fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb695('0x0'));var zipdir=require(_0xb695('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb695('0x2'));var moment=require(_0xb695('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb695('0x4'));var util=require(_0xb695('0x5'));var path=require(_0xb695('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb695('0x7'));var fs=require('fs');var fs_extra=require(_0xb695('0x8'));var _=require(_0xb695('0x9'));var squel=require(_0xb695('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb695('0xb'));var toCsv=require(_0xb695('0xc'));var querystring=require('querystring');var Papa=require(_0xb695('0xd'));var Redis=require(_0xb695('0xe'));var authService=require(_0xb695('0xf'));var qs=require(_0xb695('0x10'));var as=require(_0xb695('0x11'));var hardwareService=require(_0xb695('0x12'));var logger=require(_0xb695('0x13'))(_0xb695('0x14'));var utils=require(_0xb695('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb695('0x16'));var db=require(_0xb695('0x17'))['db'];var integrations=require(_0xb695('0x18'));function respondWithStatusCode(_0x4e3e29,_0x33fcf2){_0x33fcf2=_0x33fcf2||0xcc;return function(_0x481b65){if(_0x481b65){return _0x4e3e29[_0xb695('0x19')](_0x33fcf2);}return _0x4e3e29['status'](_0x33fcf2)[_0xb695('0x1a')]();};}function respondWithResult(_0x1044bd,_0x13f57e){_0x13f57e=_0x13f57e||0xc8;return function(_0x2bcbd0){if(_0x2bcbd0){return _0x1044bd[_0xb695('0x1b')](_0x13f57e)[_0xb695('0x1c')](_0x2bcbd0);}};}function respondWithFilteredResult(_0x3e72dc,_0x4ad9a0){return function(_0x277fce){if(_0x277fce){var _0x4a4101=typeof _0x4ad9a0[_0xb695('0x1d')]===_0xb695('0x1e')&&typeof _0x4ad9a0[_0xb695('0x1f')]===_0xb695('0x1e');var _0x3ce455=_0x277fce[_0xb695('0x20')];var _0x3dbbb5=_0x4a4101?0x0:_0x4ad9a0['offset'];var _0x1cb581=_0x4a4101?_0x277fce[_0xb695('0x20')]:_0x4ad9a0[_0xb695('0x1d')]+_0x4ad9a0[_0xb695('0x1f')];var _0x411952;if(_0x1cb581>=_0x3ce455){_0x1cb581=_0x3ce455;_0x411952=0xc8;}else{_0x411952=0xce;}_0x3e72dc[_0xb695('0x1b')](_0x411952);return _0x3e72dc[_0xb695('0x21')]('Content-Range',_0x3dbbb5+'-'+_0x1cb581+'/'+_0x3ce455)['json'](_0x277fce);}return null;};}function patchUpdates(_0x28b4e0){return function(_0x1c76e9){try{jsonpatch['apply'](_0x1c76e9,_0x28b4e0,!![]);}catch(_0x62bbfc){return BPromise[_0xb695('0x22')](_0x62bbfc);}return _0x1c76e9[_0xb695('0x23')]();};}function saveUpdates(_0x504fc3,_0x1edabf){return function(_0x173ea4){if(_0x173ea4){return _0x173ea4[_0xb695('0x24')](_0x504fc3)[_0xb695('0x25')](function(_0x47a05a){return _0x47a05a;});}return null;};}function removeEntity(_0x27ff98,_0x6024f7){return function(_0x2df222){if(_0x2df222){return _0x2df222[_0xb695('0x26')]()['then'](function(){_0x27ff98[_0xb695('0x1b')](0xcc)[_0xb695('0x1a')]();});}};}function handleEntityNotFound(_0x55ef3b,_0x54d07){return function(_0x202bc1){if(!_0x202bc1){_0x55ef3b['sendStatus'](0x194);}return _0x202bc1;};}function handleError(_0x51f606,_0x343be2){_0x343be2=_0x343be2||0x1f4;return function(_0x3e6b33){logger[_0xb695('0x27')](_0x3e6b33['stack']);if(_0x3e6b33[_0xb695('0x28')]){delete _0x3e6b33[_0xb695('0x28')];}_0x51f606[_0xb695('0x1b')](_0x343be2)[_0xb695('0x29')](_0x3e6b33);};}exports['index']=function(_0x279025,_0x5b3842){var _0x11337a={},_0x9010ab={},_0x2c4217={'count':0x0,'rows':[]};var _0x3f151c=_[_0xb695('0x2a')](db[_0xb695('0x2b')][_0xb695('0x2c')],function(_0x3c916e){return{'name':_0x3c916e[_0xb695('0x2d')],'type':_0x3c916e[_0xb695('0x2e')]['key']};});_0x9010ab[_0xb695('0x2f')]=_['map'](_0x3f151c,_0xb695('0x28'));_0x9010ab[_0xb695('0x30')]=_['keys'](_0x279025[_0xb695('0x30')]);_0x9010ab['filters']=_[_0xb695('0x31')](_0x9010ab[_0xb695('0x2f')],_0x9010ab[_0xb695('0x30')]);_0x11337a[_0xb695('0x32')]=_[_0xb695('0x31')](_0x9010ab['model'],qs[_0xb695('0x33')](_0x279025['query']['fields']));_0x11337a[_0xb695('0x32')]=_0x11337a[_0xb695('0x32')][_0xb695('0x34')]?_0x11337a[_0xb695('0x32')]:_0x9010ab[_0xb695('0x2f')];if(!_0x279025['query'][_0xb695('0x35')](_0xb695('0x36'))){_0x11337a[_0xb695('0x1f')]=qs[_0xb695('0x1f')](_0x279025[_0xb695('0x30')][_0xb695('0x1f')]);_0x11337a[_0xb695('0x1d')]=qs[_0xb695('0x1d')](_0x279025[_0xb695('0x30')][_0xb695('0x1d')]);}_0x11337a['order']=qs[_0xb695('0x37')](_0x279025['query'][_0xb695('0x37')]);_0x11337a[_0xb695('0x38')]=qs[_0xb695('0x39')](_[_0xb695('0x3a')](_0x279025[_0xb695('0x30')],_0x9010ab['filters']),_0x3f151c);if(_0x279025['query'][_0xb695('0x3b')]){_0x11337a[_0xb695('0x38')]=_[_0xb695('0x3c')](_0x11337a['where'],{'$or':_[_0xb695('0x2a')](_0x3f151c,function(_0x228ba4){if(_0x228ba4[_0xb695('0x2e')]!=='VIRTUAL'){var _0x1409ab={};_0x1409ab[_0x228ba4['name']]={'$like':'%'+_0x279025[_0xb695('0x30')][_0xb695('0x3b')]+'%'};return _0x1409ab;}})});}_0x11337a=_['merge']({},_0x11337a,_0x279025['options']);var _0x362c89={'where':_0x11337a['where']};return db[_0xb695('0x2b')][_0xb695('0x20')](_0x362c89)['then'](function(_0x5167fd){_0x2c4217[_0xb695('0x20')]=_0x5167fd;if(_0x279025['query'][_0xb695('0x3d')]){_0x11337a[_0xb695('0x3e')]=[{'all':!![]}];}return db[_0xb695('0x2b')][_0xb695('0x3f')](_0x11337a);})['then'](function(_0x40fdd7){_0x2c4217[_0xb695('0x40')]=_0x40fdd7;return _0x2c4217;})['then'](respondWithFilteredResult(_0x5b3842,_0x11337a))['catch'](handleError(_0x5b3842,null));};exports[_0xb695('0x41')]=function(_0x56c3c4,_0x43ac1a){var _0x536fb4={'raw':![],'where':{'id':_0x56c3c4[_0xb695('0x42')]['id']}},_0x1bfea7={};_0x1bfea7['model']=_['keys'](db[_0xb695('0x2b')]['rawAttributes']);_0x1bfea7[_0xb695('0x30')]=_['keys'](_0x56c3c4[_0xb695('0x30')]);_0x1bfea7[_0xb695('0x39')]=_[_0xb695('0x31')](_0x1bfea7[_0xb695('0x2f')],_0x1bfea7[_0xb695('0x30')]);_0x536fb4[_0xb695('0x32')]=_[_0xb695('0x31')](_0x1bfea7['model'],qs[_0xb695('0x33')](_0x56c3c4[_0xb695('0x30')]['fields']));_0x536fb4['attributes']=_0x536fb4[_0xb695('0x32')][_0xb695('0x34')]?_0x536fb4[_0xb695('0x32')]:_0x1bfea7[_0xb695('0x2f')];if(_0x56c3c4['query'][_0xb695('0x3d')]){_0x536fb4[_0xb695('0x3e')]=[{'all':!![]}];}_0x536fb4=_[_0xb695('0x3c')]({},_0x536fb4,_0x56c3c4[_0xb695('0x43')]);return db[_0xb695('0x2b')][_0xb695('0x44')](_0x536fb4)[_0xb695('0x25')](handleEntityNotFound(_0x43ac1a,null))['then'](respondWithResult(_0x43ac1a,null))[_0xb695('0x45')](handleError(_0x43ac1a,null));};exports[_0xb695('0x46')]=function(_0x3a254b,_0x11a12b){return db[_0xb695('0x2b')][_0xb695('0x46')](_0x3a254b[_0xb695('0x47')],{})[_0xb695('0x25')](respondWithResult(_0x11a12b,0xc9))[_0xb695('0x45')](handleError(_0x11a12b,null));};exports[_0xb695('0x24')]=function(_0x4e4764,_0x5800c9){if(_0x4e4764[_0xb695('0x47')]['id']){delete _0x4e4764[_0xb695('0x47')]['id'];}return db[_0xb695('0x2b')]['find']({'where':{'id':_0x4e4764[_0xb695('0x42')]['id']}})[_0xb695('0x25')](handleEntityNotFound(_0x5800c9,null))['then'](saveUpdates(_0x4e4764['body'],null))['then'](respondWithResult(_0x5800c9,null))[_0xb695('0x45')](handleError(_0x5800c9,null));};exports[_0xb695('0x26')]=function(_0x110201,_0x3c3c05){return db[_0xb695('0x2b')][_0xb695('0x44')]({'where':{'id':_0x110201[_0xb695('0x42')]['id']}})[_0xb695('0x25')](handleEntityNotFound(_0x3c3c05,null))[_0xb695('0x25')](removeEntity(_0x3c3c05,null))[_0xb695('0x45')](handleError(_0x3c3c05,null));};exports['getConfigurations']=function(_0x15ce6c,_0x4d61a2,_0x51d64a){var _0x338902={};var _0x21f3e0={};var _0x4b938d;var _0x114c4a;return db['SugarcrmAccount'][_0xb695('0x48')]({'where':{'id':_0x15ce6c[_0xb695('0x42')]['id']}})[_0xb695('0x25')](handleEntityNotFound(_0x4d61a2,null))[_0xb695('0x25')](function(_0x26e828){if(_0x26e828){_0x4b938d=_0x26e828;_0x21f3e0[_0xb695('0x2f')]=_[_0xb695('0x49')](db['SugarcrmConfiguration'][_0xb695('0x2c')]);_0x21f3e0['query']=_[_0xb695('0x49')](_0x15ce6c['query']);_0x21f3e0[_0xb695('0x39')]=_[_0xb695('0x31')](_0x21f3e0[_0xb695('0x2f')],_0x21f3e0[_0xb695('0x30')]);_0x338902[_0xb695('0x32')]=_['intersection'](_0x21f3e0['model'],qs[_0xb695('0x33')](_0x15ce6c[_0xb695('0x30')][_0xb695('0x33')]));_0x338902[_0xb695('0x32')]=_0x338902[_0xb695('0x32')][_0xb695('0x34')]?_0x338902['attributes']:_0x21f3e0[_0xb695('0x2f')];_0x338902[_0xb695('0x4a')]=qs[_0xb695('0x37')](_0x15ce6c[_0xb695('0x30')][_0xb695('0x37')]);_0x338902['where']=qs[_0xb695('0x39')](_[_0xb695('0x3a')](_0x15ce6c[_0xb695('0x30')],_0x21f3e0['filters']));if(_0x15ce6c[_0xb695('0x30')][_0xb695('0x3b')]){_0x338902[_0xb695('0x38')]=_[_0xb695('0x3c')](_0x338902[_0xb695('0x38')],{'$or':_[_0xb695('0x2a')](_0x338902['attributes'],function(_0x34141d){var _0x4ad6a0={};_0x4ad6a0[_0x34141d]={'$like':'%'+_0x15ce6c[_0xb695('0x30')][_0xb695('0x3b')]+'%'};return _0x4ad6a0;})});}_0x338902=_[_0xb695('0x3c')]({},_0x338902,_0x15ce6c[_0xb695('0x43')]);return _0x4b938d[_0xb695('0x4b')](_0x338902);}})[_0xb695('0x25')](function(_0x155363){if(_0x155363){_0x114c4a=_0x155363[_0xb695('0x34')];if(!_0x15ce6c[_0xb695('0x30')]['hasOwnProperty'](_0xb695('0x36'))){_0x338902[_0xb695('0x1f')]=qs[_0xb695('0x1f')](_0x15ce6c[_0xb695('0x30')][_0xb695('0x1f')]);_0x338902[_0xb695('0x1d')]=qs[_0xb695('0x1d')](_0x15ce6c[_0xb695('0x30')][_0xb695('0x1d')]);}return _0x4b938d[_0xb695('0x4b')](_0x338902);}})[_0xb695('0x25')](function(_0x214d21){if(_0x214d21){return _0x214d21?{'count':_0x114c4a,'rows':_0x214d21}:null;}})['then'](respondWithResult(_0x4d61a2,null))[_0xb695('0x45')](handleError(_0x4d61a2,null));};exports[_0xb695('0x4c')]=function(_0xd3595d,_0x2d094e,_0x377314){if(_0xd3595d[_0xb695('0x47')]['id']){delete _0xd3595d[_0xb695('0x47')]['id'];}return db[_0xb695('0x2b')][_0xb695('0x48')]({'where':{'id':_0xd3595d['params']['id']}})[_0xb695('0x25')](handleEntityNotFound(_0x2d094e,null))[_0xb695('0x25')](function(_0x5728f1){if(_0x5728f1){_0xd3595d[_0xb695('0x47')][_0xb695('0x4d')]=_0x5728f1['id'];_0xd3595d[_0xb695('0x47')][_0xb695('0x4e')]=integrations[_0xb695('0x4f')](_0xd3595d[_0xb695('0x47')]['channel'],_0xd3595d[_0xb695('0x47')][_0xb695('0x2e')]);_0xd3595d[_0xb695('0x47')][_0xb695('0x50')]=integrations[_0xb695('0x51')](_0xd3595d['body'][_0xb695('0x52')],_0xd3595d[_0xb695('0x47')][_0xb695('0x2e')]);return db[_0xb695('0x53')][_0xb695('0x46')](_0xd3595d['body'],{'include':[{'model':db[_0xb695('0x54')],'as':_0xb695('0x4e')},{'model':db['SugarcrmField'],'as':_0xb695('0x50')}]});}return null;})[_0xb695('0x25')](respondWithResult(_0x2d094e,null))[_0xb695('0x45')](handleError(_0x2d094e,null));};exports['getFields']=function(_0xdff9fe,_0x674d61,_0x21b34c){var _0x500a45='';var _0xe07655=['id',_0xb695('0x28'),_0xb695('0x55'),_0xb695('0x56'),_0xb695('0x57'),_0xb695('0x58'),'duration_hours',_0xb695('0x59'),_0xb695('0x5a'),_0xb695('0x5b'),_0xb695('0x5c'),_0xb695('0x5d')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0xdff9fe[_0xb695('0x42')]['id']},'attributes':['id',_0xb695('0x5e'),_0xb695('0x5f'),_0xb695('0x60')]})[_0xb695('0x25')](handleEntityNotFound(_0x674d61,null))[_0xb695('0x25')](function(_0x47e1fb){if(_0x47e1fb){_0x500a45=_0x47e1fb[_0xb695('0x60')];var _0x1d8ece=_0x500a45[_0xb695('0x61')](-0x1);if(_0x1d8ece==='/'){_0x500a45=_0x500a45['substring'](0x0,_0x500a45[_0xb695('0x62')](_0x1d8ece));}return rp({'method':_0xb695('0x63'),'uri':util[_0xb695('0x64')](_0xb695('0x65'),_0x500a45,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb695('0x66'),'input_type':_0xb695('0x67'),'response_type':_0xb695('0x67'),'rest_data':JSON[_0xb695('0x68')]({'user_auth':{'user_name':_0x47e1fb[_0xb695('0x5e')],'password':_0x47e1fb['password'],'encryption':_0xb695('0x69')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xb695('0x25')](function(_0x237c5e){if(_0x237c5e&&_0x237c5e[_0xb695('0x28')]!==_0xb695('0x6a')&&_0x237c5e[_0xb695('0x28')]!==_0xb695('0x6b')){return rp({'method':'POST','uri':util[_0xb695('0x64')](_0xb695('0x65'),_0x500a45,_0xb695('0x6c')),'json':!![],'form':{'method':_0xb695('0x6d'),'input_type':_0xb695('0x67'),'response_type':_0xb695('0x67'),'rest_data':JSON[_0xb695('0x68')]({'session':_0x237c5e['id'],'module_name':_0xb695('0x6e')})}})['then'](function(_0x1d87fe){if(_0x1d87fe){var _0x49fcee=_['values'](_0x1d87fe[_0xb695('0x6f')]);_[_0xb695('0x70')](_0x49fcee,function(_0x294d1c){return _0xe07655[_0xb695('0x71')](_0x294d1c[_0xb695('0x28')]);});return{'count':_0x49fcee[_0xb695('0x34')],'rows':_[_0xb695('0x2a')](_0x49fcee,function(_0x4bfe61){return{'id':_0x4bfe61[_0xb695('0x28')],'name':_0x4bfe61[_0xb695('0x72')],'custom':_[_0xb695('0x73')](_0x4bfe61[_0xb695('0x28')],'_c')?!![]:![],'options':_0x4bfe61[_0xb695('0x43')]?_[_0xb695('0x2a')](_[_0xb695('0x74')](_0x4bfe61[_0xb695('0x43')]),function(_0x2493ae){return{'name':_0x2493ae[_0xb695('0x75')],'value':_0x2493ae[_0xb695('0x28')]};}):[]};})};}})[_0xb695('0x25')](respondWithResult(_0x674d61,null))[_0xb695('0x45')](function(_0x58a671){var _0x251e54=_0xdff9fe[_0xb695('0x30')][_0xb695('0x76')]?0x1f4:_0x58a671[_0xb695('0x77')]||0x1f4;logger[_0xb695('0x27')](_0xb695('0x78'),_0xb695('0x79'),_0x251e54,JSON[_0xb695('0x68')](_0x58a671));delete _0x58a671[_0xb695('0x28')];if(_0x251e54===0x191){_0x251e54=0x190;}_0x674d61[_0xb695('0x1b')](_0x251e54)[_0xb695('0x29')](_0xdff9fe[_0xb695('0x30')][_0xb695('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x58a671['statusCode']}:_0x58a671);});}else{var _0x497c80=0x1f4;_0x674d61['status'](_0x497c80)['send']({'message':_0xb695('0x7a'),'statusCode':0x190});}});};
\ No newline at end of file
index 93e0522..afd4624 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x207a=['util','api','moment','request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash'];(function(_0x3cfe01,_0xfe69e6){var _0x5b6853=function(_0x278419){while(--_0x278419){_0x3cfe01['push'](_0x3cfe01['shift']());}};_0x5b6853(++_0xfe69e6);}(_0x207a,0x83));var _0xa207=function(_0xc3299b,_0x174ae2){_0xc3299b=_0xc3299b-0x0;var _0x2bb127=_0x207a[_0xc3299b];return _0x2bb127;};'use strict';var _=require(_0xa207('0x0'));var util=require(_0xa207('0x1'));var logger=require('../../config/logger')(_0xa207('0x2'));var moment=require(_0xa207('0x3'));var BPromise=require('bluebird');var rp=require(_0xa207('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa207('0x5'));var config=require('../../config/environment');var attributes=require(_0xa207('0x6'));var integrations=require(_0xa207('0x7'));module[_0xa207('0x8')]=function(_0x59173e,_0x4c933a){return _0x59173e[_0xa207('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xa207('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x53a6=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x529dea,_0x3cb8ab){var _0x2116a7=function(_0x4a841e){while(--_0x4a841e){_0x529dea['push'](_0x529dea['shift']());}};_0x2116a7(++_0x3cb8ab);}(_0x53a6,0x193));var _0x653a=function(_0x1a4612,_0x427b89){_0x1a4612=_0x1a4612-0x0;var _0xab8caf=_0x53a6[_0x1a4612];return _0xab8caf;};'use strict';var _=require(_0x653a('0x0'));var util=require(_0x653a('0x1'));var logger=require(_0x653a('0x2'))(_0x653a('0x3'));var moment=require(_0x653a('0x4'));var BPromise=require('bluebird');var rp=require(_0x653a('0x5'));var fs=require('fs');var path=require(_0x653a('0x6'));var rimraf=require(_0x653a('0x7'));var config=require(_0x653a('0x8'));var attributes=require(_0x653a('0x9'));var integrations=require(_0x653a('0xa'));module[_0x653a('0xb')]=function(_0x2f7796,_0x36b81f){return _0x2f7796['define'](_0x653a('0xc'),attributes,{'tableName':_0x653a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 53d9f5d..08c6867 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa953=['http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa953,0x153));var _0x3a95=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xa953[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x3a95('0x0'));var util=require(_0x3a95('0x1'));var moment=require(_0x3a95('0x2'));var BPromise=require(_0x3a95('0x3'));var rs=require(_0x3a95('0x4'));var fs=require('fs');var Redis=require(_0x3a95('0x5'));var db=require(_0x3a95('0x6'))['db'];var utils=require(_0x3a95('0x7'));var logger=require(_0x3a95('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a95('0x9'));var client=jayson[_0x3a95('0xa')][_0x3a95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54788b,_0x5b219f,_0x4b1111){return new BPromise(function(_0x202f57,_0x5c5025){return client[_0x3a95('0xc')](_0x54788b,_0x4b1111)[_0x3a95('0xd')](function(_0x59c73e){logger[_0x3a95('0xe')](_0x3a95('0xf'),_0x5b219f,_0x3a95('0x10'));logger[_0x3a95('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5b219f,_0x3a95('0x10'),JSON['stringify'](_0x59c73e));if(_0x59c73e['error']){if(_0x59c73e[_0x3a95('0x12')][_0x3a95('0x13')]===0x1f4){logger[_0x3a95('0x12')](_0x3a95('0xf'),_0x5b219f,_0x59c73e['error'][_0x3a95('0x14')]);return _0x5c5025(_0x59c73e['error'][_0x3a95('0x14')]);}logger['error'](_0x3a95('0xf'),_0x5b219f,_0x59c73e['error'][_0x3a95('0x14')]);return _0x202f57(_0x59c73e[_0x3a95('0x12')][_0x3a95('0x14')]);}else{logger[_0x3a95('0xe')](_0x3a95('0xf'),_0x5b219f,_0x3a95('0x10'));_0x202f57(_0x59c73e['result']['message']);}})[_0x3a95('0x15')](function(_0x42bb6f){logger['error'](_0x3a95('0xf'),_0x5b219f,_0x42bb6f);_0x5c5025(_0x42bb6f);});});}exports[_0x3a95('0x16')]=function(_0x2ba6eb){var _0x4b6a2f=this;return new Promise(function(_0x538453,_0x232d2f){return db[_0x3a95('0x17')][_0x3a95('0x18')]({'raw':_0x2ba6eb[_0x3a95('0x19')]?_0x2ba6eb[_0x3a95('0x19')][_0x3a95('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ba6eb[_0x3a95('0x19')]?_0x2ba6eb[_0x3a95('0x19')][_0x3a95('0x1b')]||null:null,'attributes':_0x2ba6eb[_0x3a95('0x19')]?_0x2ba6eb[_0x3a95('0x19')][_0x3a95('0x1c')]||null:null,'limit':_0x2ba6eb[_0x3a95('0x19')]?_0x2ba6eb['options']['limit']||null:null,'include':_0x2ba6eb[_0x3a95('0x19')]?_0x2ba6eb[_0x3a95('0x19')][_0x3a95('0x1d')]?_[_0x3a95('0x1e')](_0x2ba6eb[_0x3a95('0x19')][_0x3a95('0x1d')],function(_0x1bb250){return{'model':db[_0x1bb250[_0x3a95('0x1f')]],'as':_0x1bb250['as'],'attributes':_0x1bb250[_0x3a95('0x1c')],'include':_0x1bb250[_0x3a95('0x1d')]?_[_0x3a95('0x1e')](_0x1bb250[_0x3a95('0x1d')],function(_0x3aa991){return{'model':db[_0x3aa991['model']],'as':_0x3aa991['as'],'attributes':_0x3aa991[_0x3a95('0x1c')],'include':_0x3aa991['include']?_[_0x3a95('0x1e')](_0x3aa991['include'],function(_0x3c6bcd){return{'model':db[_0x3c6bcd[_0x3a95('0x1f')]],'as':_0x3c6bcd['as'],'attributes':_0x3c6bcd[_0x3a95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a95('0xd')](function(_0x37cb7a){logger[_0x3a95('0xe')]('GetSugarcrmAccount',_0x2ba6eb);logger['debug'](_0x3a95('0x16'),_0x2ba6eb,JSON['stringify'](_0x37cb7a));_0x538453(_0x37cb7a);})[_0x3a95('0x15')](function(_0x16b31d){logger[_0x3a95('0x12')](_0x3a95('0x16'),_0x16b31d[_0x3a95('0x14')],_0x2ba6eb);_0x232d2f(_0x4b6a2f[_0x3a95('0x12')](0x1f4,_0x16b31d[_0x3a95('0x14')]));});});};exports[_0x3a95('0x20')]=function(_0x23cb22){var _0x2947ff=this;return new Promise(function(_0x553719,_0x4e2571){return db[_0x3a95('0x17')][_0x3a95('0x21')]({'raw':_0x23cb22[_0x3a95('0x19')]?_0x23cb22[_0x3a95('0x19')][_0x3a95('0x1a')]===undefined?!![]:![]:!![],'where':_0x23cb22[_0x3a95('0x19')]?_0x23cb22[_0x3a95('0x19')][_0x3a95('0x1b')]||null:null,'attributes':_0x23cb22[_0x3a95('0x19')]?_0x23cb22[_0x3a95('0x19')][_0x3a95('0x1c')]||null:null,'include':_0x23cb22['options']?_0x23cb22[_0x3a95('0x19')][_0x3a95('0x1d')]?_['map'](_0x23cb22[_0x3a95('0x19')][_0x3a95('0x1d')],function(_0x1e336f){return{'model':db[_0x1e336f[_0x3a95('0x1f')]],'as':_0x1e336f['as'],'attributes':_0x1e336f['attributes'],'include':_0x1e336f[_0x3a95('0x1d')]?_[_0x3a95('0x1e')](_0x1e336f[_0x3a95('0x1d')],function(_0x3bfef1){return{'model':db[_0x3bfef1[_0x3a95('0x1f')]],'as':_0x3bfef1['as'],'attributes':_0x3bfef1[_0x3a95('0x1c')],'include':_0x3bfef1[_0x3a95('0x1d')]?_[_0x3a95('0x1e')](_0x3bfef1[_0x3a95('0x1d')],function(_0x4496ed){return{'model':db[_0x4496ed[_0x3a95('0x1f')]],'as':_0x4496ed['as'],'attributes':_0x4496ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x281b2a){logger['info']('ShowSugarcrmAccount',_0x23cb22);logger[_0x3a95('0x11')](_0x3a95('0x20'),_0x23cb22,JSON[_0x3a95('0x22')](_0x281b2a));_0x553719(_0x281b2a);})[_0x3a95('0x15')](function(_0x3a0b5e){logger[_0x3a95('0x12')](_0x3a95('0x20'),_0x3a0b5e[_0x3a95('0x14')],_0x23cb22);_0x4e2571(_0x2947ff[_0x3a95('0x12')](0x1f4,_0x3a0b5e['message']));});});};
\ No newline at end of file
+var _0xa90f=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x53ab55,_0x492f31){var _0x37776f=function(_0x4cb98c){while(--_0x4cb98c){_0x53ab55['push'](_0x53ab55['shift']());}};_0x37776f(++_0x492f31);}(_0xa90f,0x1b5));var _0xfa90=function(_0x5fc42c,_0x42ff9a){_0x5fc42c=_0x5fc42c-0x0;var _0x3b791a=_0xa90f[_0x5fc42c];return _0x3b791a;};'use strict';var _=require(_0xfa90('0x0'));var util=require('util');var moment=require(_0xfa90('0x1'));var BPromise=require(_0xfa90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa90('0x3'))['db'];var utils=require(_0xfa90('0x4'));var logger=require(_0xfa90('0x5'))('rpc');var config=require(_0xfa90('0x6'));var jayson=require(_0xfa90('0x7'));var client=jayson[_0xfa90('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb486f2,_0x316fd2,_0x273d50){return new BPromise(function(_0x568941,_0x43b897){return client[_0xfa90('0x9')](_0xb486f2,_0x273d50)[_0xfa90('0xa')](function(_0x4f59c0){logger[_0xfa90('0xb')](_0xfa90('0xc'),_0x316fd2,_0xfa90('0xd'));logger[_0xfa90('0xe')](_0xfa90('0xf'),_0x316fd2,_0xfa90('0xd'),JSON['stringify'](_0x4f59c0));if(_0x4f59c0['error']){if(_0x4f59c0[_0xfa90('0x10')]['code']===0x1f4){logger[_0xfa90('0x10')](_0xfa90('0xc'),_0x316fd2,_0x4f59c0[_0xfa90('0x10')][_0xfa90('0x11')]);return _0x43b897(_0x4f59c0['error'][_0xfa90('0x11')]);}logger[_0xfa90('0x10')](_0xfa90('0xc'),_0x316fd2,_0x4f59c0[_0xfa90('0x10')][_0xfa90('0x11')]);return _0x568941(_0x4f59c0[_0xfa90('0x10')][_0xfa90('0x11')]);}else{logger[_0xfa90('0xb')](_0xfa90('0xc'),_0x316fd2,_0xfa90('0xd'));_0x568941(_0x4f59c0[_0xfa90('0x12')][_0xfa90('0x11')]);}})[_0xfa90('0x13')](function(_0x458d7c){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x316fd2,_0x458d7c);_0x43b897(_0x458d7c);});});}exports[_0xfa90('0x14')]=function(_0x1b4186){var _0x4dfd50=this;return new Promise(function(_0x1fd45b,_0x183a06){return db[_0xfa90('0x15')][_0xfa90('0x16')]({'raw':_0x1b4186[_0xfa90('0x17')]?_0x1b4186['options'][_0xfa90('0x18')]===undefined?!![]:![]:!![],'where':_0x1b4186[_0xfa90('0x17')]?_0x1b4186[_0xfa90('0x17')][_0xfa90('0x19')]||null:null,'attributes':_0x1b4186[_0xfa90('0x17')]?_0x1b4186[_0xfa90('0x17')][_0xfa90('0x1a')]||null:null,'limit':_0x1b4186[_0xfa90('0x17')]?_0x1b4186[_0xfa90('0x17')][_0xfa90('0x1b')]||null:null,'include':_0x1b4186['options']?_0x1b4186[_0xfa90('0x17')][_0xfa90('0x1c')]?_['map'](_0x1b4186[_0xfa90('0x17')][_0xfa90('0x1c')],function(_0x187719){return{'model':db[_0x187719['model']],'as':_0x187719['as'],'attributes':_0x187719[_0xfa90('0x1a')],'include':_0x187719[_0xfa90('0x1c')]?_[_0xfa90('0x1d')](_0x187719['include'],function(_0x5cb5b6){return{'model':db[_0x5cb5b6[_0xfa90('0x1e')]],'as':_0x5cb5b6['as'],'attributes':_0x5cb5b6['attributes'],'include':_0x5cb5b6[_0xfa90('0x1c')]?_['map'](_0x5cb5b6[_0xfa90('0x1c')],function(_0x1cff93){return{'model':db[_0x1cff93[_0xfa90('0x1e')]],'as':_0x1cff93['as'],'attributes':_0x1cff93['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa90('0xa')](function(_0x15c3f9){logger[_0xfa90('0xb')](_0xfa90('0x14'),_0x1b4186);logger['debug']('GetSugarcrmAccount',_0x1b4186,JSON[_0xfa90('0x1f')](_0x15c3f9));_0x1fd45b(_0x15c3f9);})[_0xfa90('0x13')](function(_0x3a445d){logger[_0xfa90('0x10')](_0xfa90('0x14'),_0x3a445d[_0xfa90('0x11')],_0x1b4186);_0x183a06(_0x4dfd50[_0xfa90('0x10')](0x1f4,_0x3a445d[_0xfa90('0x11')]));});});};exports[_0xfa90('0x20')]=function(_0x29395c){var _0x14c26e=this;return new Promise(function(_0x13cc64,_0xd61fb3){return db[_0xfa90('0x15')][_0xfa90('0x21')]({'raw':_0x29395c[_0xfa90('0x17')]?_0x29395c['options'][_0xfa90('0x18')]===undefined?!![]:![]:!![],'where':_0x29395c[_0xfa90('0x17')]?_0x29395c['options'][_0xfa90('0x19')]||null:null,'attributes':_0x29395c['options']?_0x29395c[_0xfa90('0x17')]['attributes']||null:null,'include':_0x29395c['options']?_0x29395c[_0xfa90('0x17')]['include']?_[_0xfa90('0x1d')](_0x29395c[_0xfa90('0x17')][_0xfa90('0x1c')],function(_0x536f78){return{'model':db[_0x536f78[_0xfa90('0x1e')]],'as':_0x536f78['as'],'attributes':_0x536f78[_0xfa90('0x1a')],'include':_0x536f78[_0xfa90('0x1c')]?_[_0xfa90('0x1d')](_0x536f78[_0xfa90('0x1c')],function(_0x43d63e){return{'model':db[_0x43d63e[_0xfa90('0x1e')]],'as':_0x43d63e['as'],'attributes':_0x43d63e['attributes'],'include':_0x43d63e[_0xfa90('0x1c')]?_['map'](_0x43d63e[_0xfa90('0x1c')],function(_0x5864b5){return{'model':db[_0x5864b5['model']],'as':_0x5864b5['as'],'attributes':_0x5864b5[_0xfa90('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfa90('0xa')](function(_0x126b3b){logger['info'](_0xfa90('0x20'),_0x29395c);logger[_0xfa90('0xe')](_0xfa90('0x20'),_0x29395c,JSON[_0xfa90('0x1f')](_0x126b3b));_0x13cc64(_0x126b3b);})['catch'](function(_0x4742a9){logger[_0xfa90('0x10')](_0xfa90('0x20'),_0x4742a9[_0xfa90('0x11')],_0x29395c);_0xd61fb3(_0x14c26e[_0xfa90('0x10')](0x1f4,_0x4742a9[_0xfa90('0x11')]));});});};
\ No newline at end of file
index b13d609..ce837f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a34=['getSubjects','/:id/descriptions','getDescriptions','post','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x232f3a,_0xcf2cd4){var _0x209889=function(_0x57318d){while(--_0x57318d){_0x232f3a['push'](_0x232f3a['shift']());}};_0x209889(++_0xcf2cd4);}(_0x9a34,0x1c6));var _0x49a3=function(_0x4bb77a,_0x310641){_0x4bb77a=_0x4bb77a-0x0;var _0x55e53e=_0x9a34[_0x4bb77a];return _0x55e53e;};'use strict';var multer=require('multer');var util=require(_0x49a3('0x0'));var path=require(_0x49a3('0x1'));var timeout=require('connect-timeout');var express=require(_0x49a3('0x2'));var router=express[_0x49a3('0x3')]();var fs_extra=require(_0x49a3('0x4'));var auth=require(_0x49a3('0x5'));var interaction=require(_0x49a3('0x6'));var config=require('../../config/environment');var controller=require(_0x49a3('0x7'));router['get']('/',auth[_0x49a3('0x8')](),controller['index']);router[_0x49a3('0x9')](_0x49a3('0xa'),auth[_0x49a3('0x8')](),controller['show']);router[_0x49a3('0x9')](_0x49a3('0xb'),auth[_0x49a3('0x8')](),controller[_0x49a3('0xc')]);router[_0x49a3('0x9')](_0x49a3('0xd'),auth['isAuthenticated'](),controller[_0x49a3('0xe')]);router[_0x49a3('0x9')](_0x49a3('0xf'),auth[_0x49a3('0x8')](),controller[_0x49a3('0x10')]);router[_0x49a3('0x11')]('/',auth[_0x49a3('0x8')](),controller['create']);router['put'](_0x49a3('0xa'),auth[_0x49a3('0x8')](),controller['update']);router['delete'](_0x49a3('0xa'),auth[_0x49a3('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x7fab=['/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x7fab,0x1dd));var _0xb7fa=function(_0x1c0f8d,_0x1adacb){_0x1c0f8d=_0x1c0f8d-0x0;var _0x108dd2=_0x7fab[_0x1c0f8d];return _0x108dd2;};'use strict';var multer=require(_0xb7fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb7fa('0x1'));var express=require(_0xb7fa('0x2'));var router=express['Router']();var fs_extra=require(_0xb7fa('0x3'));var auth=require(_0xb7fa('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xb7fa('0x5')](),controller[_0xb7fa('0x6')]);router[_0xb7fa('0x7')](_0xb7fa('0x8'),auth[_0xb7fa('0x5')](),controller['show']);router[_0xb7fa('0x7')](_0xb7fa('0x9'),auth['isAuthenticated'](),controller[_0xb7fa('0xa')]);router[_0xb7fa('0x7')](_0xb7fa('0xb'),auth[_0xb7fa('0x5')](),controller['getSubjects']);router[_0xb7fa('0x7')]('/:id/descriptions',auth[_0xb7fa('0x5')](),controller[_0xb7fa('0xc')]);router['post']('/',auth[_0xb7fa('0x5')](),controller[_0xb7fa('0xd')]);router[_0xb7fa('0xe')](_0xb7fa('0x8'),auth[_0xb7fa('0x5')](),controller[_0xb7fa('0xf')]);router[_0xb7fa('0x10')](_0xb7fa('0x8'),auth['isAuthenticated'](),controller[_0xb7fa('0x11')]);module['exports']=router;
\ No newline at end of file
index 6581ca6..e105442 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf35d=['exports','STRING','sequelize'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xf35d,0x6b));var _0xdf35=function(_0x469da2,_0x418219){_0x469da2=_0x469da2-0x0;var _0x14ca72=_0xf35d[_0x469da2];return _0x14ca72;};'use strict';var Sequelize=require(_0xdf35('0x0'));module[_0xdf35('0x1')]={'name':{'type':Sequelize[_0xdf35('0x2')]},'description':{'type':Sequelize[_0xdf35('0x2')]}};
\ No newline at end of file
+var _0x796b=['exports','STRING','sequelize'];(function(_0x3567c2,_0x1ed368){var _0x594a04=function(_0x1439bb){while(--_0x1439bb){_0x3567c2['push'](_0x3567c2['shift']());}};_0x594a04(++_0x1ed368);}(_0x796b,0xbc));var _0xb796=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x796b[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require(_0xb796('0x0'));module[_0xb796('0x1')]={'name':{'type':Sequelize[_0xb796('0x2')]},'description':{'type':Sequelize[_0xb796('0x2')]}};
\ No newline at end of file
index 0f245f4..973c857 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x197a=['sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','name','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1f8ac1,_0xed3823){var _0xed6927=function(_0x5990fb){while(--_0x5990fb){_0x1f8ac1['push'](_0x1f8ac1['shift']());}};_0xed6927(++_0xed3823);}(_0x197a,0x85));var _0xa197=function(_0x2340e2,_0x1627f9){_0x2340e2=_0x2340e2-0x0;var _0x5ced10=_0x197a[_0x2340e2];return _0x5ced10;};'use strict';var emlformat=require(_0xa197('0x0'));var rimraf=require(_0xa197('0x1'));var zipdir=require(_0xa197('0x2'));var jsonpatch=require(_0xa197('0x3'));var rp=require(_0xa197('0x4'));var moment=require(_0xa197('0x5'));var BPromise=require(_0xa197('0x6'));var Mustache=require(_0xa197('0x7'));var util=require('util');var path=require(_0xa197('0x8'));var sox=require(_0xa197('0x9'));var csv=require(_0xa197('0xa'));var ejs=require(_0xa197('0xb'));var fs=require('fs');var fs_extra=require(_0xa197('0xc'));var _=require(_0xa197('0xd'));var squel=require('squel');var crypto=require(_0xa197('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa197('0xa'));var querystring=require(_0xa197('0xf'));var Papa=require(_0xa197('0x10'));var Redis=require(_0xa197('0x11'));var authService=require(_0xa197('0x12'));var qs=require(_0xa197('0x13'));var as=require(_0xa197('0x14'));var hardwareService=require(_0xa197('0x15'));var logger=require(_0xa197('0x16'))(_0xa197('0x17'));var utils=require(_0xa197('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa197('0x19'));var db=require(_0xa197('0x1a'))['db'];function respondWithStatusCode(_0x41c20d,_0x12a4a8){_0x12a4a8=_0x12a4a8||0xcc;return function(_0x40b4b5){if(_0x40b4b5){return _0x41c20d[_0xa197('0x1b')](_0x12a4a8);}return _0x41c20d[_0xa197('0x1c')](_0x12a4a8)['end']();};}function respondWithResult(_0x451907,_0xe30b54){_0xe30b54=_0xe30b54||0xc8;return function(_0x277d53){if(_0x277d53){return _0x451907[_0xa197('0x1c')](_0xe30b54)['json'](_0x277d53);}};}function respondWithFilteredResult(_0x1915c5,_0xbd37d6){return function(_0x2f7d3e){if(_0x2f7d3e){var _0xfffdd8=typeof _0xbd37d6[_0xa197('0x1d')]===_0xa197('0x1e')&&typeof _0xbd37d6[_0xa197('0x1f')]===_0xa197('0x1e');var _0x3d4966=_0x2f7d3e[_0xa197('0x20')];var _0xbbe5bf=_0xfffdd8?0x0:_0xbd37d6['offset'];var _0x30ec5e=_0xfffdd8?_0x2f7d3e[_0xa197('0x20')]:_0xbd37d6['offset']+_0xbd37d6[_0xa197('0x1f')];var _0xa9bd40;if(_0x30ec5e>=_0x3d4966){_0x30ec5e=_0x3d4966;_0xa9bd40=0xc8;}else{_0xa9bd40=0xce;}_0x1915c5['status'](_0xa9bd40);return _0x1915c5[_0xa197('0x21')](_0xa197('0x22'),_0xbbe5bf+'-'+_0x30ec5e+'/'+_0x3d4966)[_0xa197('0x23')](_0x2f7d3e);}return null;};}function patchUpdates(_0x39f6d6){return function(_0x22bc89){try{jsonpatch['apply'](_0x22bc89,_0x39f6d6,!![]);}catch(_0xf06f98){return BPromise[_0xa197('0x24')](_0xf06f98);}return _0x22bc89[_0xa197('0x25')]();};}function saveUpdates(_0x3445e8,_0x4ba19d){return function(_0xb59cf3){if(_0xb59cf3){return _0xb59cf3[_0xa197('0x26')](_0x3445e8)[_0xa197('0x27')](function(_0x452984){return _0x452984;});}return null;};}function removeEntity(_0x2cb1a4,_0x1c68ee){return function(_0x26f6a4){if(_0x26f6a4){return _0x26f6a4['destroy']()['then'](function(){_0x2cb1a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2030b7,_0x463ea1){return function(_0x7d8459){if(!_0x7d8459){_0x2030b7[_0xa197('0x1b')](0x194);}return _0x7d8459;};}function handleError(_0x4fad70,_0x3bea3e){_0x3bea3e=_0x3bea3e||0x1f4;return function(_0xa99d51){logger[_0xa197('0x28')](_0xa99d51['stack']);if(_0xa99d51[_0xa197('0x29')]){delete _0xa99d51[_0xa197('0x29')];}_0x4fad70['status'](_0x3bea3e)['send'](_0xa99d51);};}exports['index']=function(_0x1005a0,_0x42a109){var _0x4c7ba1={},_0x1e3099={},_0x261e10={'count':0x0,'rows':[]};var _0x3a48a2=_[_0xa197('0x2a')](db['SugarcrmConfiguration'][_0xa197('0x2b')],function(_0x5aae39){return{'name':_0x5aae39[_0xa197('0x2c')],'type':_0x5aae39[_0xa197('0x2d')][_0xa197('0x2e')]};});_0x1e3099['model']=_['map'](_0x3a48a2,_0xa197('0x29'));_0x1e3099['query']=_[_0xa197('0x2f')](_0x1005a0['query']);_0x1e3099[_0xa197('0x30')]=_[_0xa197('0x31')](_0x1e3099[_0xa197('0x32')],_0x1e3099[_0xa197('0x33')]);_0x4c7ba1[_0xa197('0x34')]=_[_0xa197('0x31')](_0x1e3099[_0xa197('0x32')],qs['fields'](_0x1005a0[_0xa197('0x33')][_0xa197('0x35')]));_0x4c7ba1[_0xa197('0x34')]=_0x4c7ba1['attributes'][_0xa197('0x36')]?_0x4c7ba1['attributes']:_0x1e3099[_0xa197('0x32')];if(!_0x1005a0['query']['hasOwnProperty'](_0xa197('0x37'))){_0x4c7ba1[_0xa197('0x1f')]=qs['limit'](_0x1005a0[_0xa197('0x33')][_0xa197('0x1f')]);_0x4c7ba1[_0xa197('0x1d')]=qs[_0xa197('0x1d')](_0x1005a0['query']['offset']);}_0x4c7ba1[_0xa197('0x38')]=qs[_0xa197('0x39')](_0x1005a0[_0xa197('0x33')][_0xa197('0x39')]);_0x4c7ba1['where']=qs[_0xa197('0x30')](_[_0xa197('0x3a')](_0x1005a0[_0xa197('0x33')],_0x1e3099[_0xa197('0x30')]),_0x3a48a2);if(_0x1005a0['query'][_0xa197('0x3b')]){_0x4c7ba1[_0xa197('0x3c')]=_[_0xa197('0x3d')](_0x4c7ba1[_0xa197('0x3c')],{'$or':_[_0xa197('0x2a')](_0x3a48a2,function(_0x38460a){if(_0x38460a['type']!==_0xa197('0x3e')){var _0x230e9f={};_0x230e9f[_0x38460a[_0xa197('0x29')]]={'$like':'%'+_0x1005a0[_0xa197('0x33')][_0xa197('0x3b')]+'%'};return _0x230e9f;}})});}_0x4c7ba1=_['merge']({},_0x4c7ba1,_0x1005a0[_0xa197('0x3f')]);var _0x5ae663={'where':_0x4c7ba1['where']};return db['SugarcrmConfiguration'][_0xa197('0x20')](_0x5ae663)[_0xa197('0x27')](function(_0x39facb){_0x261e10[_0xa197('0x20')]=_0x39facb;if(_0x1005a0['query']['includeAll']){_0x4c7ba1['include']=[{'all':!![]}];}return db[_0xa197('0x40')]['findAll'](_0x4c7ba1);})[_0xa197('0x27')](function(_0x339e60){_0x261e10[_0xa197('0x41')]=_0x339e60;return _0x261e10;})[_0xa197('0x27')](respondWithFilteredResult(_0x42a109,_0x4c7ba1))[_0xa197('0x42')](handleError(_0x42a109,null));};exports[_0xa197('0x43')]=function(_0xfbef49,_0x4cf8f1){var _0x10251d={'raw':![],'where':{'id':_0xfbef49[_0xa197('0x44')]['id']}},_0x18061f={};_0x18061f[_0xa197('0x32')]=_['keys'](db['SugarcrmConfiguration'][_0xa197('0x2b')]);_0x18061f[_0xa197('0x33')]=_[_0xa197('0x2f')](_0xfbef49['query']);_0x18061f[_0xa197('0x30')]=_['intersection'](_0x18061f['model'],_0x18061f[_0xa197('0x33')]);_0x10251d[_0xa197('0x34')]=_[_0xa197('0x31')](_0x18061f['model'],qs['fields'](_0xfbef49['query'][_0xa197('0x35')]));_0x10251d[_0xa197('0x34')]=_0x10251d[_0xa197('0x34')][_0xa197('0x36')]?_0x10251d['attributes']:_0x18061f[_0xa197('0x32')];if(_0xfbef49[_0xa197('0x33')][_0xa197('0x45')]){_0x10251d[_0xa197('0x46')]=[{'all':!![]}];}_0x10251d=_['merge']({},_0x10251d,_0xfbef49[_0xa197('0x3f')]);return db['SugarcrmConfiguration'][_0xa197('0x47')](_0x10251d)[_0xa197('0x27')](handleEntityNotFound(_0x4cf8f1,null))[_0xa197('0x27')](respondWithResult(_0x4cf8f1,null))[_0xa197('0x42')](handleError(_0x4cf8f1,null));};exports[_0xa197('0x48')]=function(_0xef7b9a,_0x3426c0){return db[_0xa197('0x40')]['create'](_0xef7b9a['body'],{})['then'](respondWithResult(_0x3426c0,0xc9))[_0xa197('0x42')](handleError(_0x3426c0,null));};exports[_0xa197('0x26')]=function(_0x125109,_0x16a583){if(_0x125109[_0xa197('0x49')]['id']){delete _0x125109[_0xa197('0x49')]['id'];}return db[_0xa197('0x40')][_0xa197('0x47')]({'where':{'id':_0x125109['params']['id']}})[_0xa197('0x27')](handleEntityNotFound(_0x16a583,null))[_0xa197('0x27')](saveUpdates(_0x125109[_0xa197('0x49')],null))[_0xa197('0x27')](respondWithResult(_0x16a583,null))[_0xa197('0x42')](handleError(_0x16a583,null));};exports['destroy']=function(_0x222a44,_0x4e603b){return db[_0xa197('0x40')][_0xa197('0x47')]({'where':{'id':_0x222a44[_0xa197('0x44')]['id']}})[_0xa197('0x27')](handleEntityNotFound(_0x4e603b,null))['then'](removeEntity(_0x4e603b,null))['catch'](handleError(_0x4e603b,null));};exports[_0xa197('0x4a')]=function(_0x3814d2,_0x4ef616,_0x2285ba){var _0x188110={};var _0x233e24={};var _0x48527f;var _0x41a20b;return db[_0xa197('0x40')][_0xa197('0x4b')]({'where':{'id':_0x3814d2[_0xa197('0x44')]['id']}})[_0xa197('0x27')](handleEntityNotFound(_0x4ef616,null))['then'](function(_0x2c8f6c){if(_0x2c8f6c){_0x48527f=_0x2c8f6c;_0x233e24[_0xa197('0x32')]=_[_0xa197('0x2f')](db[_0xa197('0x4c')]['rawAttributes']);_0x233e24['query']=_[_0xa197('0x2f')](_0x3814d2[_0xa197('0x33')]);_0x233e24[_0xa197('0x30')]=_[_0xa197('0x31')](_0x233e24[_0xa197('0x32')],_0x233e24[_0xa197('0x33')]);_0x188110[_0xa197('0x34')]=_[_0xa197('0x31')](_0x233e24['model'],qs['fields'](_0x3814d2[_0xa197('0x33')][_0xa197('0x35')]));_0x188110[_0xa197('0x34')]=_0x188110[_0xa197('0x34')]['length']?_0x188110['attributes']:_0x233e24['model'];_0x188110[_0xa197('0x38')]=qs[_0xa197('0x39')](_0x3814d2['query'][_0xa197('0x39')]);_0x188110[_0xa197('0x3c')]=qs[_0xa197('0x30')](_[_0xa197('0x3a')](_0x3814d2[_0xa197('0x33')],_0x233e24[_0xa197('0x30')]));if(_0x3814d2[_0xa197('0x33')]['filter']){_0x188110['where']=_['merge'](_0x188110[_0xa197('0x3c')],{'$or':_[_0xa197('0x2a')](_0x188110[_0xa197('0x34')],function(_0x117641){var _0x37f72c={};_0x37f72c[_0x117641]={'$like':'%'+_0x3814d2[_0xa197('0x33')]['filter']+'%'};return _0x37f72c;})});}_0x188110=_['merge']({},_0x188110,_0x3814d2['options']);return _0x48527f[_0xa197('0x4a')](_0x188110);}})[_0xa197('0x27')](function(_0x39a00a){if(_0x39a00a){_0x41a20b=_0x39a00a[_0xa197('0x36')];if(!_0x3814d2['query'][_0xa197('0x4d')]('nolimit')){_0x188110['limit']=qs[_0xa197('0x1f')](_0x3814d2[_0xa197('0x33')][_0xa197('0x1f')]);_0x188110['offset']=qs[_0xa197('0x1d')](_0x3814d2[_0xa197('0x33')]['offset']);}return _0x48527f[_0xa197('0x4a')](_0x188110);}})[_0xa197('0x27')](function(_0x2fe6e3){if(_0x2fe6e3){return _0x2fe6e3?{'count':_0x41a20b,'rows':_0x2fe6e3}:null;}})[_0xa197('0x27')](respondWithResult(_0x4ef616,null))[_0xa197('0x42')](handleError(_0x4ef616,null));};exports[_0xa197('0x4e')]=function(_0x23a160,_0x229471,_0x2f07d3){var _0x70e98c={};var _0x2998e2={};var _0x46c883;var _0x43c350;return db[_0xa197('0x40')][_0xa197('0x4b')]({'where':{'id':_0x23a160['params']['id']}})[_0xa197('0x27')](handleEntityNotFound(_0x229471,null))['then'](function(_0x3e0cb1){if(_0x3e0cb1){_0x46c883=_0x3e0cb1;_0x2998e2[_0xa197('0x32')]=_[_0xa197('0x2f')](db['SugarcrmField']['rawAttributes']);_0x2998e2[_0xa197('0x33')]=_['keys'](_0x23a160[_0xa197('0x33')]);_0x2998e2[_0xa197('0x30')]=_[_0xa197('0x31')](_0x2998e2['model'],_0x2998e2[_0xa197('0x33')]);_0x70e98c['attributes']=_['intersection'](_0x2998e2[_0xa197('0x32')],qs[_0xa197('0x35')](_0x23a160[_0xa197('0x33')][_0xa197('0x35')]));_0x70e98c[_0xa197('0x34')]=_0x70e98c['attributes'][_0xa197('0x36')]?_0x70e98c[_0xa197('0x34')]:_0x2998e2[_0xa197('0x32')];_0x70e98c[_0xa197('0x38')]=qs[_0xa197('0x39')](_0x23a160['query'][_0xa197('0x39')]);_0x70e98c[_0xa197('0x3c')]=qs[_0xa197('0x30')](_[_0xa197('0x3a')](_0x23a160['query'],_0x2998e2[_0xa197('0x30')]));if(_0x23a160[_0xa197('0x33')][_0xa197('0x3b')]){_0x70e98c[_0xa197('0x3c')]=_[_0xa197('0x3d')](_0x70e98c[_0xa197('0x3c')],{'$or':_[_0xa197('0x2a')](_0x70e98c['attributes'],function(_0x3c32ed){var _0x28fd45={};_0x28fd45[_0x3c32ed]={'$like':'%'+_0x23a160[_0xa197('0x33')][_0xa197('0x3b')]+'%'};return _0x28fd45;})});}_0x70e98c=_['merge']({},_0x70e98c,_0x23a160[_0xa197('0x3f')]);return _0x46c883['getSubjects'](_0x70e98c);}})[_0xa197('0x27')](function(_0x54d939){if(_0x54d939){_0x43c350=_0x54d939[_0xa197('0x36')];if(!_0x23a160['query'][_0xa197('0x4d')](_0xa197('0x37'))){_0x70e98c[_0xa197('0x1f')]=qs['limit'](_0x23a160[_0xa197('0x33')][_0xa197('0x1f')]);_0x70e98c['offset']=qs[_0xa197('0x1d')](_0x23a160[_0xa197('0x33')][_0xa197('0x1d')]);}return _0x46c883['getSubjects'](_0x70e98c);}})[_0xa197('0x27')](function(_0x467231){if(_0x467231){return _0x467231?{'count':_0x43c350,'rows':_0x467231}:null;}})[_0xa197('0x27')](respondWithResult(_0x229471,null))['catch'](handleError(_0x229471,null));};exports[_0xa197('0x4f')]=function(_0x296fe0,_0x53cfbd,_0xcc484c){var _0x19f84d={};var _0x20c847={};var _0x425081;var _0x229d1a;return db[_0xa197('0x40')]['findOne']({'where':{'id':_0x296fe0[_0xa197('0x44')]['id']}})[_0xa197('0x27')](handleEntityNotFound(_0x53cfbd,null))[_0xa197('0x27')](function(_0x4e2c96){if(_0x4e2c96){_0x425081=_0x4e2c96;_0x20c847[_0xa197('0x32')]=_[_0xa197('0x2f')](db[_0xa197('0x4c')][_0xa197('0x2b')]);_0x20c847[_0xa197('0x33')]=_['keys'](_0x296fe0[_0xa197('0x33')]);_0x20c847[_0xa197('0x30')]=_[_0xa197('0x31')](_0x20c847[_0xa197('0x32')],_0x20c847[_0xa197('0x33')]);_0x19f84d[_0xa197('0x34')]=_['intersection'](_0x20c847[_0xa197('0x32')],qs[_0xa197('0x35')](_0x296fe0['query'][_0xa197('0x35')]));_0x19f84d[_0xa197('0x34')]=_0x19f84d['attributes']['length']?_0x19f84d['attributes']:_0x20c847[_0xa197('0x32')];_0x19f84d[_0xa197('0x38')]=qs[_0xa197('0x39')](_0x296fe0[_0xa197('0x33')][_0xa197('0x39')]);_0x19f84d[_0xa197('0x3c')]=qs['filters'](_[_0xa197('0x3a')](_0x296fe0[_0xa197('0x33')],_0x20c847[_0xa197('0x30')]));if(_0x296fe0[_0xa197('0x33')][_0xa197('0x3b')]){_0x19f84d[_0xa197('0x3c')]=_['merge'](_0x19f84d[_0xa197('0x3c')],{'$or':_[_0xa197('0x2a')](_0x19f84d[_0xa197('0x34')],function(_0xbd6694){var _0x5c216d={};_0x5c216d[_0xbd6694]={'$like':'%'+_0x296fe0[_0xa197('0x33')][_0xa197('0x3b')]+'%'};return _0x5c216d;})});}_0x19f84d=_[_0xa197('0x3d')]({},_0x19f84d,_0x296fe0[_0xa197('0x3f')]);return _0x425081[_0xa197('0x4f')](_0x19f84d);}})[_0xa197('0x27')](function(_0x40db4e){if(_0x40db4e){_0x229d1a=_0x40db4e[_0xa197('0x36')];if(!_0x296fe0[_0xa197('0x33')][_0xa197('0x4d')](_0xa197('0x37'))){_0x19f84d['limit']=qs[_0xa197('0x1f')](_0x296fe0[_0xa197('0x33')][_0xa197('0x1f')]);_0x19f84d[_0xa197('0x1d')]=qs[_0xa197('0x1d')](_0x296fe0[_0xa197('0x33')][_0xa197('0x1d')]);}return _0x425081[_0xa197('0x4f')](_0x19f84d);}})[_0xa197('0x27')](function(_0x48586a){if(_0x48586a){return _0x48586a?{'count':_0x229d1a,'rows':_0x48586a}:null;}})[_0xa197('0x27')](respondWithResult(_0x53cfbd,null))['catch'](handleError(_0x53cfbd,null));};
\ No newline at end of file
+var _0xa4e3=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','set','json','save','update','then','destroy','stack','name','send','index','SugarcrmConfiguration','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','catch','create','body','find','findOne','SugarcrmField','hasOwnProperty','nolimit','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0xdf3655,_0x3df389){var _0x5099be=function(_0x57d162){while(--_0x57d162){_0xdf3655['push'](_0xdf3655['shift']());}};_0x5099be(++_0x3df389);}(_0xa4e3,0x9d));var _0x3a4e=function(_0x5b4c2e,_0x5dba78){_0x5b4c2e=_0x5b4c2e-0x0;var _0x3a00c7=_0xa4e3[_0x5b4c2e];return _0x3a00c7;};'use strict';var emlformat=require(_0x3a4e('0x0'));var rimraf=require(_0x3a4e('0x1'));var zipdir=require(_0x3a4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a4e('0x3'));var moment=require(_0x3a4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3a4e('0x5'));var util=require(_0x3a4e('0x6'));var path=require(_0x3a4e('0x7'));var sox=require('sox');var csv=require(_0x3a4e('0x8'));var ejs=require(_0x3a4e('0x9'));var fs=require('fs');var fs_extra=require(_0x3a4e('0xa'));var _=require(_0x3a4e('0xb'));var squel=require(_0x3a4e('0xc'));var crypto=require(_0x3a4e('0xd'));var jsforce=require(_0x3a4e('0xe'));var deskjs=require(_0x3a4e('0xf'));var toCsv=require(_0x3a4e('0x8'));var querystring=require(_0x3a4e('0x10'));var Papa=require(_0x3a4e('0x11'));var Redis=require(_0x3a4e('0x12'));var authService=require(_0x3a4e('0x13'));var qs=require(_0x3a4e('0x14'));var as=require(_0x3a4e('0x15'));var hardwareService=require(_0x3a4e('0x16'));var logger=require(_0x3a4e('0x17'))('api');var utils=require(_0x3a4e('0x18'));var config=require(_0x3a4e('0x19'));var licenseUtil=require(_0x3a4e('0x1a'));var db=require(_0x3a4e('0x1b'))['db'];function respondWithStatusCode(_0x1810ec,_0x55bd36){_0x55bd36=_0x55bd36||0xcc;return function(_0x394ff3){if(_0x394ff3){return _0x1810ec['sendStatus'](_0x55bd36);}return _0x1810ec[_0x3a4e('0x1c')](_0x55bd36)[_0x3a4e('0x1d')]();};}function respondWithResult(_0x48c9e6,_0x592db1){_0x592db1=_0x592db1||0xc8;return function(_0x3d92e3){if(_0x3d92e3){return _0x48c9e6[_0x3a4e('0x1c')](_0x592db1)['json'](_0x3d92e3);}};}function respondWithFilteredResult(_0x283cca,_0x2d3fb5){return function(_0x2a7b80){if(_0x2a7b80){var _0x651d2e=typeof _0x2d3fb5['offset']==='undefined'&&typeof _0x2d3fb5['limit']===_0x3a4e('0x1e');var _0x22ead9=_0x2a7b80[_0x3a4e('0x1f')];var _0xdbb267=_0x651d2e?0x0:_0x2d3fb5[_0x3a4e('0x20')];var _0x1aaa3e=_0x651d2e?_0x2a7b80['count']:_0x2d3fb5[_0x3a4e('0x20')]+_0x2d3fb5['limit'];var _0x2c1d01;if(_0x1aaa3e>=_0x22ead9){_0x1aaa3e=_0x22ead9;_0x2c1d01=0xc8;}else{_0x2c1d01=0xce;}_0x283cca[_0x3a4e('0x1c')](_0x2c1d01);return _0x283cca[_0x3a4e('0x21')]('Content-Range',_0xdbb267+'-'+_0x1aaa3e+'/'+_0x22ead9)[_0x3a4e('0x22')](_0x2a7b80);}return null;};}function patchUpdates(_0xb6aea2){return function(_0x45587e){try{jsonpatch['apply'](_0x45587e,_0xb6aea2,!![]);}catch(_0x2d7e62){return BPromise['reject'](_0x2d7e62);}return _0x45587e[_0x3a4e('0x23')]();};}function saveUpdates(_0x2f9f10,_0x57ee18){return function(_0x163297){if(_0x163297){return _0x163297[_0x3a4e('0x24')](_0x2f9f10)[_0x3a4e('0x25')](function(_0x120aa){return _0x120aa;});}return null;};}function removeEntity(_0x2a0e75,_0x3696e9){return function(_0x57b33f){if(_0x57b33f){return _0x57b33f[_0x3a4e('0x26')]()[_0x3a4e('0x25')](function(){_0x2a0e75[_0x3a4e('0x1c')](0xcc)[_0x3a4e('0x1d')]();});}};}function handleEntityNotFound(_0x16d3d1,_0x1c83c5){return function(_0x56488c){if(!_0x56488c){_0x16d3d1['sendStatus'](0x194);}return _0x56488c;};}function handleError(_0x2f2e4a,_0x2be4bd){_0x2be4bd=_0x2be4bd||0x1f4;return function(_0x1b7310){logger['error'](_0x1b7310[_0x3a4e('0x27')]);if(_0x1b7310[_0x3a4e('0x28')]){delete _0x1b7310[_0x3a4e('0x28')];}_0x2f2e4a[_0x3a4e('0x1c')](_0x2be4bd)[_0x3a4e('0x29')](_0x1b7310);};}exports[_0x3a4e('0x2a')]=function(_0x245c10,_0x1ce1e3){var _0x19077d={},_0x1ecf22={},_0x34b6ce={'count':0x0,'rows':[]};var _0x2c5ad8=_['map'](db[_0x3a4e('0x2b')]['rawAttributes'],function(_0x572492){return{'name':_0x572492[_0x3a4e('0x2c')],'type':_0x572492[_0x3a4e('0x2d')][_0x3a4e('0x2e')]};});_0x1ecf22[_0x3a4e('0x2f')]=_['map'](_0x2c5ad8,_0x3a4e('0x28'));_0x1ecf22['query']=_[_0x3a4e('0x30')](_0x245c10['query']);_0x1ecf22[_0x3a4e('0x31')]=_[_0x3a4e('0x32')](_0x1ecf22['model'],_0x1ecf22[_0x3a4e('0x33')]);_0x19077d[_0x3a4e('0x34')]=_[_0x3a4e('0x32')](_0x1ecf22['model'],qs[_0x3a4e('0x35')](_0x245c10[_0x3a4e('0x33')]['fields']));_0x19077d[_0x3a4e('0x34')]=_0x19077d[_0x3a4e('0x34')][_0x3a4e('0x36')]?_0x19077d[_0x3a4e('0x34')]:_0x1ecf22[_0x3a4e('0x2f')];if(!_0x245c10[_0x3a4e('0x33')]['hasOwnProperty']('nolimit')){_0x19077d[_0x3a4e('0x37')]=qs[_0x3a4e('0x37')](_0x245c10[_0x3a4e('0x33')][_0x3a4e('0x37')]);_0x19077d[_0x3a4e('0x20')]=qs[_0x3a4e('0x20')](_0x245c10[_0x3a4e('0x33')][_0x3a4e('0x20')]);}_0x19077d[_0x3a4e('0x38')]=qs['sort'](_0x245c10[_0x3a4e('0x33')][_0x3a4e('0x39')]);_0x19077d[_0x3a4e('0x3a')]=qs[_0x3a4e('0x31')](_[_0x3a4e('0x3b')](_0x245c10[_0x3a4e('0x33')],_0x1ecf22[_0x3a4e('0x31')]),_0x2c5ad8);if(_0x245c10['query'][_0x3a4e('0x3c')]){_0x19077d[_0x3a4e('0x3a')]=_[_0x3a4e('0x3d')](_0x19077d[_0x3a4e('0x3a')],{'$or':_[_0x3a4e('0x3e')](_0x2c5ad8,function(_0x379457){if(_0x379457[_0x3a4e('0x2d')]!==_0x3a4e('0x3f')){var _0x32c2fe={};_0x32c2fe[_0x379457[_0x3a4e('0x28')]]={'$like':'%'+_0x245c10['query']['filter']+'%'};return _0x32c2fe;}})});}_0x19077d=_['merge']({},_0x19077d,_0x245c10[_0x3a4e('0x40')]);var _0x2faf46={'where':_0x19077d['where']};return db[_0x3a4e('0x2b')][_0x3a4e('0x1f')](_0x2faf46)['then'](function(_0x19b6d8){_0x34b6ce['count']=_0x19b6d8;if(_0x245c10[_0x3a4e('0x33')][_0x3a4e('0x41')]){_0x19077d[_0x3a4e('0x42')]=[{'all':!![]}];}return db[_0x3a4e('0x2b')][_0x3a4e('0x43')](_0x19077d);})[_0x3a4e('0x25')](function(_0x577dac){_0x34b6ce['rows']=_0x577dac;return _0x34b6ce;})[_0x3a4e('0x25')](respondWithFilteredResult(_0x1ce1e3,_0x19077d))['catch'](handleError(_0x1ce1e3,null));};exports['show']=function(_0x4286f2,_0x153572){var _0xd8ad81={'raw':![],'where':{'id':_0x4286f2[_0x3a4e('0x44')]['id']}},_0x35cda1={};_0x35cda1[_0x3a4e('0x2f')]=_['keys'](db['SugarcrmConfiguration'][_0x3a4e('0x45')]);_0x35cda1[_0x3a4e('0x33')]=_['keys'](_0x4286f2['query']);_0x35cda1[_0x3a4e('0x31')]=_[_0x3a4e('0x32')](_0x35cda1[_0x3a4e('0x2f')],_0x35cda1['query']);_0xd8ad81[_0x3a4e('0x34')]=_[_0x3a4e('0x32')](_0x35cda1[_0x3a4e('0x2f')],qs[_0x3a4e('0x35')](_0x4286f2[_0x3a4e('0x33')][_0x3a4e('0x35')]));_0xd8ad81[_0x3a4e('0x34')]=_0xd8ad81[_0x3a4e('0x34')][_0x3a4e('0x36')]?_0xd8ad81[_0x3a4e('0x34')]:_0x35cda1[_0x3a4e('0x2f')];if(_0x4286f2[_0x3a4e('0x33')][_0x3a4e('0x41')]){_0xd8ad81[_0x3a4e('0x42')]=[{'all':!![]}];}_0xd8ad81=_['merge']({},_0xd8ad81,_0x4286f2[_0x3a4e('0x40')]);return db['SugarcrmConfiguration']['find'](_0xd8ad81)['then'](handleEntityNotFound(_0x153572,null))['then'](respondWithResult(_0x153572,null))[_0x3a4e('0x46')](handleError(_0x153572,null));};exports[_0x3a4e('0x47')]=function(_0x3fdc88,_0x4eafdf){return db[_0x3a4e('0x2b')]['create'](_0x3fdc88[_0x3a4e('0x48')],{})[_0x3a4e('0x25')](respondWithResult(_0x4eafdf,0xc9))[_0x3a4e('0x46')](handleError(_0x4eafdf,null));};exports[_0x3a4e('0x24')]=function(_0x1085b6,_0x3eb52e){if(_0x1085b6['body']['id']){delete _0x1085b6[_0x3a4e('0x48')]['id'];}return db[_0x3a4e('0x2b')][_0x3a4e('0x49')]({'where':{'id':_0x1085b6[_0x3a4e('0x44')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x3eb52e,null))['then'](saveUpdates(_0x1085b6['body'],null))[_0x3a4e('0x25')](respondWithResult(_0x3eb52e,null))[_0x3a4e('0x46')](handleError(_0x3eb52e,null));};exports[_0x3a4e('0x26')]=function(_0x1e6b40,_0x323142){return db[_0x3a4e('0x2b')][_0x3a4e('0x49')]({'where':{'id':_0x1e6b40[_0x3a4e('0x44')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x323142,null))[_0x3a4e('0x25')](removeEntity(_0x323142,null))['catch'](handleError(_0x323142,null));};exports['getFields']=function(_0x2d073c,_0x1a2d11,_0x1eb0b4){var _0x334bcf={};var _0x49041c={};var _0x1d6bc9;var _0xf2a937;return db[_0x3a4e('0x2b')][_0x3a4e('0x4a')]({'where':{'id':_0x2d073c['params']['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x1a2d11,null))['then'](function(_0x22836e){if(_0x22836e){_0x1d6bc9=_0x22836e;_0x49041c['model']=_[_0x3a4e('0x30')](db[_0x3a4e('0x4b')][_0x3a4e('0x45')]);_0x49041c['query']=_['keys'](_0x2d073c['query']);_0x49041c['filters']=_[_0x3a4e('0x32')](_0x49041c[_0x3a4e('0x2f')],_0x49041c[_0x3a4e('0x33')]);_0x334bcf['attributes']=_[_0x3a4e('0x32')](_0x49041c['model'],qs['fields'](_0x2d073c[_0x3a4e('0x33')][_0x3a4e('0x35')]));_0x334bcf[_0x3a4e('0x34')]=_0x334bcf[_0x3a4e('0x34')][_0x3a4e('0x36')]?_0x334bcf['attributes']:_0x49041c[_0x3a4e('0x2f')];_0x334bcf['order']=qs['sort'](_0x2d073c[_0x3a4e('0x33')][_0x3a4e('0x39')]);_0x334bcf[_0x3a4e('0x3a')]=qs['filters'](_[_0x3a4e('0x3b')](_0x2d073c[_0x3a4e('0x33')],_0x49041c[_0x3a4e('0x31')]));if(_0x2d073c['query'][_0x3a4e('0x3c')]){_0x334bcf[_0x3a4e('0x3a')]=_[_0x3a4e('0x3d')](_0x334bcf['where'],{'$or':_[_0x3a4e('0x3e')](_0x334bcf[_0x3a4e('0x34')],function(_0x245d1a){var _0x569834={};_0x569834[_0x245d1a]={'$like':'%'+_0x2d073c[_0x3a4e('0x33')][_0x3a4e('0x3c')]+'%'};return _0x569834;})});}_0x334bcf=_['merge']({},_0x334bcf,_0x2d073c[_0x3a4e('0x40')]);return _0x1d6bc9['getFields'](_0x334bcf);}})[_0x3a4e('0x25')](function(_0x2ea641){if(_0x2ea641){_0xf2a937=_0x2ea641[_0x3a4e('0x36')];if(!_0x2d073c[_0x3a4e('0x33')][_0x3a4e('0x4c')](_0x3a4e('0x4d'))){_0x334bcf['limit']=qs['limit'](_0x2d073c[_0x3a4e('0x33')][_0x3a4e('0x37')]);_0x334bcf[_0x3a4e('0x20')]=qs[_0x3a4e('0x20')](_0x2d073c[_0x3a4e('0x33')][_0x3a4e('0x20')]);}return _0x1d6bc9[_0x3a4e('0x4e')](_0x334bcf);}})[_0x3a4e('0x25')](function(_0x3e633d){if(_0x3e633d){return _0x3e633d?{'count':_0xf2a937,'rows':_0x3e633d}:null;}})['then'](respondWithResult(_0x1a2d11,null))[_0x3a4e('0x46')](handleError(_0x1a2d11,null));};exports[_0x3a4e('0x4f')]=function(_0x417add,_0x555ecb,_0x1d7e37){var _0x1ee995={};var _0x55c61f={};var _0x26adab;var _0x56fe07;return db[_0x3a4e('0x2b')][_0x3a4e('0x4a')]({'where':{'id':_0x417add[_0x3a4e('0x44')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x555ecb,null))[_0x3a4e('0x25')](function(_0x3811cc){if(_0x3811cc){_0x26adab=_0x3811cc;_0x55c61f[_0x3a4e('0x2f')]=_[_0x3a4e('0x30')](db['SugarcrmField'][_0x3a4e('0x45')]);_0x55c61f[_0x3a4e('0x33')]=_['keys'](_0x417add[_0x3a4e('0x33')]);_0x55c61f[_0x3a4e('0x31')]=_['intersection'](_0x55c61f['model'],_0x55c61f[_0x3a4e('0x33')]);_0x1ee995[_0x3a4e('0x34')]=_[_0x3a4e('0x32')](_0x55c61f[_0x3a4e('0x2f')],qs['fields'](_0x417add[_0x3a4e('0x33')][_0x3a4e('0x35')]));_0x1ee995[_0x3a4e('0x34')]=_0x1ee995[_0x3a4e('0x34')][_0x3a4e('0x36')]?_0x1ee995[_0x3a4e('0x34')]:_0x55c61f['model'];_0x1ee995[_0x3a4e('0x38')]=qs[_0x3a4e('0x39')](_0x417add[_0x3a4e('0x33')][_0x3a4e('0x39')]);_0x1ee995[_0x3a4e('0x3a')]=qs['filters'](_[_0x3a4e('0x3b')](_0x417add['query'],_0x55c61f['filters']));if(_0x417add['query'][_0x3a4e('0x3c')]){_0x1ee995[_0x3a4e('0x3a')]=_[_0x3a4e('0x3d')](_0x1ee995['where'],{'$or':_[_0x3a4e('0x3e')](_0x1ee995[_0x3a4e('0x34')],function(_0x25adf2){var _0x3648a1={};_0x3648a1[_0x25adf2]={'$like':'%'+_0x417add[_0x3a4e('0x33')]['filter']+'%'};return _0x3648a1;})});}_0x1ee995=_[_0x3a4e('0x3d')]({},_0x1ee995,_0x417add[_0x3a4e('0x40')]);return _0x26adab[_0x3a4e('0x4f')](_0x1ee995);}})[_0x3a4e('0x25')](function(_0x126264){if(_0x126264){_0x56fe07=_0x126264[_0x3a4e('0x36')];if(!_0x417add[_0x3a4e('0x33')]['hasOwnProperty'](_0x3a4e('0x4d'))){_0x1ee995[_0x3a4e('0x37')]=qs['limit'](_0x417add[_0x3a4e('0x33')][_0x3a4e('0x37')]);_0x1ee995['offset']=qs[_0x3a4e('0x20')](_0x417add[_0x3a4e('0x33')][_0x3a4e('0x20')]);}return _0x26adab[_0x3a4e('0x4f')](_0x1ee995);}})[_0x3a4e('0x25')](function(_0x1a1b3d){if(_0x1a1b3d){return _0x1a1b3d?{'count':_0x56fe07,'rows':_0x1a1b3d}:null;}})[_0x3a4e('0x25')](respondWithResult(_0x555ecb,null))[_0x3a4e('0x46')](handleError(_0x555ecb,null));};exports[_0x3a4e('0x50')]=function(_0x5a663c,_0x38d53e,_0x2700ff){var _0xe009ae={};var _0x43c39f={};var _0x1f559b;var _0x218f56;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5a663c[_0x3a4e('0x44')]['id']}})[_0x3a4e('0x25')](handleEntityNotFound(_0x38d53e,null))[_0x3a4e('0x25')](function(_0x1ea6e4){if(_0x1ea6e4){_0x1f559b=_0x1ea6e4;_0x43c39f[_0x3a4e('0x2f')]=_[_0x3a4e('0x30')](db[_0x3a4e('0x4b')][_0x3a4e('0x45')]);_0x43c39f[_0x3a4e('0x33')]=_[_0x3a4e('0x30')](_0x5a663c[_0x3a4e('0x33')]);_0x43c39f[_0x3a4e('0x31')]=_[_0x3a4e('0x32')](_0x43c39f[_0x3a4e('0x2f')],_0x43c39f[_0x3a4e('0x33')]);_0xe009ae['attributes']=_['intersection'](_0x43c39f['model'],qs[_0x3a4e('0x35')](_0x5a663c[_0x3a4e('0x33')]['fields']));_0xe009ae[_0x3a4e('0x34')]=_0xe009ae[_0x3a4e('0x34')][_0x3a4e('0x36')]?_0xe009ae[_0x3a4e('0x34')]:_0x43c39f[_0x3a4e('0x2f')];_0xe009ae[_0x3a4e('0x38')]=qs[_0x3a4e('0x39')](_0x5a663c['query'][_0x3a4e('0x39')]);_0xe009ae['where']=qs['filters'](_[_0x3a4e('0x3b')](_0x5a663c[_0x3a4e('0x33')],_0x43c39f[_0x3a4e('0x31')]));if(_0x5a663c[_0x3a4e('0x33')][_0x3a4e('0x3c')]){_0xe009ae[_0x3a4e('0x3a')]=_[_0x3a4e('0x3d')](_0xe009ae[_0x3a4e('0x3a')],{'$or':_[_0x3a4e('0x3e')](_0xe009ae[_0x3a4e('0x34')],function(_0xd34cd4){var _0x5cb0f0={};_0x5cb0f0[_0xd34cd4]={'$like':'%'+_0x5a663c[_0x3a4e('0x33')]['filter']+'%'};return _0x5cb0f0;})});}_0xe009ae=_['merge']({},_0xe009ae,_0x5a663c[_0x3a4e('0x40')]);return _0x1f559b[_0x3a4e('0x50')](_0xe009ae);}})[_0x3a4e('0x25')](function(_0x2db944){if(_0x2db944){_0x218f56=_0x2db944[_0x3a4e('0x36')];if(!_0x5a663c[_0x3a4e('0x33')][_0x3a4e('0x4c')](_0x3a4e('0x4d'))){_0xe009ae['limit']=qs[_0x3a4e('0x37')](_0x5a663c[_0x3a4e('0x33')][_0x3a4e('0x37')]);_0xe009ae[_0x3a4e('0x20')]=qs[_0x3a4e('0x20')](_0x5a663c[_0x3a4e('0x33')][_0x3a4e('0x20')]);}return _0x1f559b['getDescriptions'](_0xe009ae);}})[_0x3a4e('0x25')](function(_0x1ca753){if(_0x1ca753){return _0x1ca753?{'count':_0x218f56,'rows':_0x1ca753}:null;}})[_0x3a4e('0x25')](respondWithResult(_0x38d53e,null))[_0x3a4e('0x46')](handleError(_0x38d53e,null));};
\ No newline at end of file
index e97f97a..49e6785 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39d7=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x39d7,0x106));var _0x739d=function(_0x280c89,_0x110c4b){_0x280c89=_0x280c89-0x0;var _0x15229d=_0x39d7[_0x280c89];return _0x15229d;};'use strict';var _=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var logger=require(_0x739d('0x2'))(_0x739d('0x3'));var moment=require(_0x739d('0x4'));var BPromise=require('bluebird');var rp=require(_0x739d('0x5'));var fs=require('fs');var path=require(_0x739d('0x6'));var rimraf=require(_0x739d('0x7'));var config=require(_0x739d('0x8'));var attributes=require(_0x739d('0x9'));module[_0x739d('0xa')]=function(_0x1e9259,_0x2190d5){return _0x1e9259['define'](_0x739d('0xb'),attributes,{'tableName':_0x739d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd8a5=['bluebird','request-promise','path','rimraf','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment'];(function(_0x2ccab9,_0x42969d){var _0x20e296=function(_0x58ef89){while(--_0x58ef89){_0x2ccab9['push'](_0x2ccab9['shift']());}};_0x20e296(++_0x42969d);}(_0xd8a5,0x134));var _0x5d8a=function(_0x290e6b,_0x363257){_0x290e6b=_0x290e6b-0x0;var _0x377506=_0xd8a5[_0x290e6b];return _0x377506;};'use strict';var _=require(_0x5d8a('0x0'));var util=require(_0x5d8a('0x1'));var logger=require(_0x5d8a('0x2'))('api');var moment=require(_0x5d8a('0x3'));var BPromise=require(_0x5d8a('0x4'));var rp=require(_0x5d8a('0x5'));var fs=require('fs');var path=require(_0x5d8a('0x6'));var rimraf=require(_0x5d8a('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x5d8a('0x8')]=function(_0x484a3c,_0x42cc88){return _0x484a3c[_0x5d8a('0x9')](_0x5d8a('0xa'),attributes,{'tableName':_0x5d8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b1e2b68..09ccbd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf879=['error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1ce10f,_0x40cd62){var _0x321c67=function(_0x3e2b1c){while(--_0x3e2b1c){_0x1ce10f['push'](_0x1ce10f['shift']());}};_0x321c67(++_0x40cd62);}(_0xf879,0x144));var _0x9f87=function(_0x413bcb,_0x1f0c5d){_0x413bcb=_0x413bcb-0x0;var _0x2b6048=_0xf879[_0x413bcb];return _0x2b6048;};'use strict';var _=require(_0x9f87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9f87('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f87('0x2'));var db=require(_0x9f87('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f87('0x4'))(_0x9f87('0x5'));var config=require(_0x9f87('0x6'));var jayson=require(_0x9f87('0x7'));var client=jayson[_0x9f87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ca69,_0x42167c,_0x384422){return new BPromise(function(_0x4af083,_0x802eac){return client[_0x9f87('0x9')](_0x20ca69,_0x384422)[_0x9f87('0xa')](function(_0x3e69ab){logger[_0x9f87('0xb')](_0x9f87('0xc'),_0x42167c,_0x9f87('0xd'));logger[_0x9f87('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x42167c,_0x9f87('0xd'),JSON[_0x9f87('0xf')](_0x3e69ab));if(_0x3e69ab[_0x9f87('0x10')]){if(_0x3e69ab[_0x9f87('0x10')][_0x9f87('0x11')]===0x1f4){logger[_0x9f87('0x10')](_0x9f87('0xc'),_0x42167c,_0x3e69ab['error'][_0x9f87('0x12')]);return _0x802eac(_0x3e69ab['error'][_0x9f87('0x12')]);}logger[_0x9f87('0x10')](_0x9f87('0xc'),_0x42167c,_0x3e69ab['error']['message']);return _0x4af083(_0x3e69ab[_0x9f87('0x10')][_0x9f87('0x12')]);}else{logger[_0x9f87('0xb')](_0x9f87('0xc'),_0x42167c,_0x9f87('0xd'));_0x4af083(_0x3e69ab[_0x9f87('0x13')]['message']);}})['catch'](function(_0x388417){logger[_0x9f87('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x42167c,_0x388417);_0x802eac(_0x388417);});});}
\ No newline at end of file
+var _0xf27d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0xf27d,0xa2));var _0xdf27=function(_0x11618a,_0x3308e3){_0x11618a=_0x11618a-0x0;var _0xb81fa9=_0xf27d[_0x11618a];return _0xb81fa9;};'use strict';var _=require(_0xdf27('0x0'));var util=require(_0xdf27('0x1'));var moment=require(_0xdf27('0x2'));var BPromise=require(_0xdf27('0x3'));var rs=require(_0xdf27('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf27('0x5'))['db'];var utils=require(_0xdf27('0x6'));var logger=require('../../config/logger')(_0xdf27('0x7'));var config=require(_0xdf27('0x8'));var jayson=require(_0xdf27('0x9'));var client=jayson[_0xdf27('0xa')][_0xdf27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x371b9e,_0xa21ff3,_0x55f955){return new BPromise(function(_0x3ae68f,_0x55d9b4){return client[_0xdf27('0xc')](_0x371b9e,_0x55f955)[_0xdf27('0xd')](function(_0x5d01b8){logger[_0xdf27('0xe')](_0xdf27('0xf'),_0xa21ff3,_0xdf27('0x10'));logger[_0xdf27('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xa21ff3,'request\x20sent',JSON[_0xdf27('0x12')](_0x5d01b8));if(_0x5d01b8[_0xdf27('0x13')]){if(_0x5d01b8[_0xdf27('0x13')][_0xdf27('0x14')]===0x1f4){logger[_0xdf27('0x13')](_0xdf27('0xf'),_0xa21ff3,_0x5d01b8[_0xdf27('0x13')][_0xdf27('0x15')]);return _0x55d9b4(_0x5d01b8[_0xdf27('0x13')]['message']);}logger[_0xdf27('0x13')](_0xdf27('0xf'),_0xa21ff3,_0x5d01b8[_0xdf27('0x13')][_0xdf27('0x15')]);return _0x3ae68f(_0x5d01b8[_0xdf27('0x13')][_0xdf27('0x15')]);}else{logger['info'](_0xdf27('0xf'),_0xa21ff3,'request\x20sent');_0x3ae68f(_0x5d01b8[_0xdf27('0x16')]['message']);}})[_0xdf27('0x17')](function(_0x4bd77d){logger[_0xdf27('0x13')](_0xdf27('0xf'),_0xa21ff3,_0x4bd77d);_0x55d9b4(_0x4bd77d);});});}
\ No newline at end of file
index 1e96485..e28105c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6068=['update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1ad46c,_0x50dd2c){var _0x38c8b3=function(_0x519d0f){while(--_0x519d0f){_0x1ad46c['push'](_0x1ad46c['shift']());}};_0x38c8b3(++_0x50dd2c);}(_0x6068,0xec));var _0x8606=function(_0x460bc6,_0x1aa092){_0x460bc6=_0x460bc6-0x0;var _0x120b0b=_0x6068[_0x460bc6];return _0x120b0b;};'use strict';var multer=require(_0x8606('0x0'));var util=require(_0x8606('0x1'));var path=require('path');var timeout=require(_0x8606('0x2'));var express=require(_0x8606('0x3'));var router=express[_0x8606('0x4')]();var fs_extra=require(_0x8606('0x5'));var auth=require(_0x8606('0x6'));var interaction=require(_0x8606('0x7'));var config=require(_0x8606('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x8606('0x9')]('/',auth[_0x8606('0xa')](),controller[_0x8606('0xb')]);router[_0x8606('0x9')](_0x8606('0xc'),auth[_0x8606('0xa')](),controller[_0x8606('0xd')]);router[_0x8606('0xe')]('/',auth[_0x8606('0xa')](),controller[_0x8606('0xf')]);router['put'](_0x8606('0xc'),auth[_0x8606('0xa')](),controller[_0x8606('0x10')]);router['delete'](_0x8606('0xc'),auth[_0x8606('0xa')](),controller['destroy']);module[_0x8606('0x11')]=router;
\ No newline at end of file
+var _0x0ccf=['put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x0ccf,0xe1));var _0xf0cc=function(_0x3abdf1,_0xbf6648){_0x3abdf1=_0x3abdf1-0x0;var _0x160b12=_0x0ccf[_0x3abdf1];return _0x160b12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf0cc('0x0'));var timeout=require(_0xf0cc('0x1'));var express=require(_0xf0cc('0x2'));var router=express[_0xf0cc('0x3')]();var fs_extra=require(_0xf0cc('0x4'));var auth=require(_0xf0cc('0x5'));var interaction=require(_0xf0cc('0x6'));var config=require(_0xf0cc('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf0cc('0x8')]('/',auth['isAuthenticated'](),controller[_0xf0cc('0x9')]);router[_0xf0cc('0x8')](_0xf0cc('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf0cc('0xb')](),controller[_0xf0cc('0xc')]);router[_0xf0cc('0xd')](_0xf0cc('0xa'),auth[_0xf0cc('0xb')](),controller[_0xf0cc('0xe')]);router['delete'](_0xf0cc('0xa'),auth['isAuthenticated'](),controller[_0xf0cc('0xf')]);module[_0xf0cc('0x10')]=router;
\ No newline at end of file
index 7db754f..e518992 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb60=['sequelize','exports','ENUM','variable','customVariable','string','STRING','BOOLEAN'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0xbb60,0x188));var _0x0bb6=function(_0x2261fd,_0x43b60b){_0x2261fd=_0x2261fd-0x0;var _0xcff064=_0xbb60[_0x2261fd];return _0xcff064;};'use strict';var Sequelize=require(_0x0bb6('0x0'));module[_0x0bb6('0x1')]={'type':{'type':Sequelize[_0x0bb6('0x2')]('string',_0x0bb6('0x3'),_0x0bb6('0x4'),'keyValue','picklist'),'defaultValue':_0x0bb6('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0bb6('0x6')]},'keyType':{'type':Sequelize[_0x0bb6('0x2')](_0x0bb6('0x5'),_0x0bb6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0bb6('0x6')]},'idField':{'type':Sequelize[_0x0bb6('0x6')]},'nameField':{'type':Sequelize[_0x0bb6('0x6')]},'customField':{'type':Sequelize[_0x0bb6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0bb6('0x6')]}};
\ No newline at end of file
+var _0x408e=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x38963f,_0x3c6b68){var _0x294a20=function(_0xdfc75){while(--_0xdfc75){_0x38963f['push'](_0x38963f['shift']());}};_0x294a20(++_0x3c6b68);}(_0x408e,0x18d));var _0xe408=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x408e[_0x311aad];return _0x1779bd;};'use strict';var Sequelize=require(_0xe408('0x0'));module['exports']={'type':{'type':Sequelize[_0xe408('0x1')](_0xe408('0x2'),_0xe408('0x3'),'customVariable',_0xe408('0x4'),_0xe408('0x5')),'defaultValue':_0xe408('0x2')},'content':{'type':Sequelize[_0xe408('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe408('0x3'),_0xe408('0x7'))},'keyContent':{'type':Sequelize[_0xe408('0x6')]},'idField':{'type':Sequelize[_0xe408('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe408('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe408('0x6')]}};
\ No newline at end of file
index 9d8cd75..ab49324 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa875=['find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','include','params','keys','includeAll'];(function(_0x532cbd,_0x381fda){var _0x298f6a=function(_0x398325){while(--_0x398325){_0x532cbd['push'](_0x532cbd['shift']());}};_0x298f6a(++_0x381fda);}(_0xa875,0xe5));var _0x5a87=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0xa875[_0x3b3210];return _0x5b5484;};'use strict';var emlformat=require(_0x5a87('0x0'));var rimraf=require(_0x5a87('0x1'));var zipdir=require(_0x5a87('0x2'));var jsonpatch=require(_0x5a87('0x3'));var rp=require(_0x5a87('0x4'));var moment=require(_0x5a87('0x5'));var BPromise=require(_0x5a87('0x6'));var Mustache=require(_0x5a87('0x7'));var util=require(_0x5a87('0x8'));var path=require(_0x5a87('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a87('0xa'));var _=require(_0x5a87('0xb'));var squel=require(_0x5a87('0xc'));var crypto=require(_0x5a87('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5a87('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5a87('0xf'));var Papa=require(_0x5a87('0x10'));var Redis=require(_0x5a87('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5a87('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a87('0x13'))(_0x5a87('0x14'));var utils=require(_0x5a87('0x15'));var config=require(_0x5a87('0x16'));var licenseUtil=require(_0x5a87('0x17'));var db=require(_0x5a87('0x18'))['db'];function respondWithStatusCode(_0x184024,_0x25897c){_0x25897c=_0x25897c||0xcc;return function(_0x5a0fa6){if(_0x5a0fa6){return _0x184024[_0x5a87('0x19')](_0x25897c);}return _0x184024[_0x5a87('0x1a')](_0x25897c)[_0x5a87('0x1b')]();};}function respondWithResult(_0x45d23b,_0x43693a){_0x43693a=_0x43693a||0xc8;return function(_0x4de2fc){if(_0x4de2fc){return _0x45d23b[_0x5a87('0x1a')](_0x43693a)[_0x5a87('0x1c')](_0x4de2fc);}};}function respondWithFilteredResult(_0xe9ed9f,_0xa37c6e){return function(_0xd299){if(_0xd299){var _0x3348a9=typeof _0xa37c6e[_0x5a87('0x1d')]===_0x5a87('0x1e')&&typeof _0xa37c6e['limit']===_0x5a87('0x1e');var _0x24ecf2=_0xd299[_0x5a87('0x1f')];var _0x41f755=_0x3348a9?0x0:_0xa37c6e[_0x5a87('0x1d')];var _0x362ff7=_0x3348a9?_0xd299['count']:_0xa37c6e[_0x5a87('0x1d')]+_0xa37c6e[_0x5a87('0x20')];var _0x3795e0;if(_0x362ff7>=_0x24ecf2){_0x362ff7=_0x24ecf2;_0x3795e0=0xc8;}else{_0x3795e0=0xce;}_0xe9ed9f[_0x5a87('0x1a')](_0x3795e0);return _0xe9ed9f[_0x5a87('0x21')]('Content-Range',_0x41f755+'-'+_0x362ff7+'/'+_0x24ecf2)[_0x5a87('0x1c')](_0xd299);}return null;};}function patchUpdates(_0x1d8b42){return function(_0x7e4d24){try{jsonpatch[_0x5a87('0x22')](_0x7e4d24,_0x1d8b42,!![]);}catch(_0x22354b){return BPromise[_0x5a87('0x23')](_0x22354b);}return _0x7e4d24[_0x5a87('0x24')]();};}function saveUpdates(_0x5db35d,_0x407e0a){return function(_0x1e2b5a){if(_0x1e2b5a){return _0x1e2b5a[_0x5a87('0x25')](_0x5db35d)[_0x5a87('0x26')](function(_0x36c65f){return _0x36c65f;});}return null;};}function removeEntity(_0x3de978,_0x2e4031){return function(_0x31571c){if(_0x31571c){return _0x31571c[_0x5a87('0x27')]()[_0x5a87('0x26')](function(){_0x3de978[_0x5a87('0x1a')](0xcc)[_0x5a87('0x1b')]();});}};}function handleEntityNotFound(_0xa44537,_0x5d6af1){return function(_0x1d98b5){if(!_0x1d98b5){_0xa44537[_0x5a87('0x19')](0x194);}return _0x1d98b5;};}function handleError(_0x1bd842,_0x2dafe3){_0x2dafe3=_0x2dafe3||0x1f4;return function(_0x32b982){logger[_0x5a87('0x28')](_0x32b982[_0x5a87('0x29')]);if(_0x32b982[_0x5a87('0x2a')]){delete _0x32b982[_0x5a87('0x2a')];}_0x1bd842[_0x5a87('0x1a')](_0x2dafe3)[_0x5a87('0x2b')](_0x32b982);};}exports[_0x5a87('0x2c')]=function(_0x5cddda,_0x2f619d){var _0x2caba0={},_0x2d2e62={},_0x5943c2={'count':0x0,'rows':[]};var _0x23237c=_['map'](db[_0x5a87('0x2d')]['rawAttributes'],function(_0x41746e){return{'name':_0x41746e[_0x5a87('0x2e')],'type':_0x41746e[_0x5a87('0x2f')][_0x5a87('0x30')]};});_0x2d2e62[_0x5a87('0x31')]=_['map'](_0x23237c,_0x5a87('0x2a'));_0x2d2e62['query']=_['keys'](_0x5cddda[_0x5a87('0x32')]);_0x2d2e62[_0x5a87('0x33')]=_[_0x5a87('0x34')](_0x2d2e62[_0x5a87('0x31')],_0x2d2e62[_0x5a87('0x32')]);_0x2caba0[_0x5a87('0x35')]=_['intersection'](_0x2d2e62['model'],qs['fields'](_0x5cddda[_0x5a87('0x32')][_0x5a87('0x36')]));_0x2caba0[_0x5a87('0x35')]=_0x2caba0[_0x5a87('0x35')][_0x5a87('0x37')]?_0x2caba0[_0x5a87('0x35')]:_0x2d2e62[_0x5a87('0x31')];if(!_0x5cddda['query'][_0x5a87('0x38')](_0x5a87('0x39'))){_0x2caba0['limit']=qs['limit'](_0x5cddda[_0x5a87('0x32')][_0x5a87('0x20')]);_0x2caba0[_0x5a87('0x1d')]=qs[_0x5a87('0x1d')](_0x5cddda['query']['offset']);}_0x2caba0[_0x5a87('0x3a')]=qs[_0x5a87('0x3b')](_0x5cddda[_0x5a87('0x32')]['sort']);_0x2caba0[_0x5a87('0x3c')]=qs[_0x5a87('0x33')](_[_0x5a87('0x3d')](_0x5cddda['query'],_0x2d2e62[_0x5a87('0x33')]),_0x23237c);if(_0x5cddda['query'][_0x5a87('0x3e')]){_0x2caba0['where']=_['merge'](_0x2caba0['where'],{'$or':_[_0x5a87('0x3f')](_0x23237c,function(_0x32ea9d){if(_0x32ea9d[_0x5a87('0x2f')]!==_0x5a87('0x40')){var _0x5dcb5f={};_0x5dcb5f[_0x32ea9d[_0x5a87('0x2a')]]={'$like':'%'+_0x5cddda[_0x5a87('0x32')][_0x5a87('0x3e')]+'%'};return _0x5dcb5f;}})});}_0x2caba0=_[_0x5a87('0x41')]({},_0x2caba0,_0x5cddda[_0x5a87('0x42')]);var _0x9a889={'where':_0x2caba0[_0x5a87('0x3c')]};return db[_0x5a87('0x2d')][_0x5a87('0x1f')](_0x9a889)[_0x5a87('0x26')](function(_0x4eb4b5){_0x5943c2[_0x5a87('0x1f')]=_0x4eb4b5;if(_0x5cddda[_0x5a87('0x32')]['includeAll']){_0x2caba0[_0x5a87('0x43')]=[{'all':!![]}];}return db[_0x5a87('0x2d')]['findAll'](_0x2caba0);})[_0x5a87('0x26')](function(_0x3d5634){_0x5943c2['rows']=_0x3d5634;return _0x5943c2;})[_0x5a87('0x26')](respondWithFilteredResult(_0x2f619d,_0x2caba0))['catch'](handleError(_0x2f619d,null));};exports['show']=function(_0x1d08f8,_0x354f8b){var _0x3d119b={'raw':!![],'where':{'id':_0x1d08f8[_0x5a87('0x44')]['id']}},_0x4fd580={};_0x4fd580['model']=_[_0x5a87('0x45')](db['SugarcrmField']['rawAttributes']);_0x4fd580[_0x5a87('0x32')]=_[_0x5a87('0x45')](_0x1d08f8[_0x5a87('0x32')]);_0x4fd580[_0x5a87('0x33')]=_['intersection'](_0x4fd580['model'],_0x4fd580[_0x5a87('0x32')]);_0x3d119b[_0x5a87('0x35')]=_[_0x5a87('0x34')](_0x4fd580[_0x5a87('0x31')],qs['fields'](_0x1d08f8[_0x5a87('0x32')][_0x5a87('0x36')]));_0x3d119b[_0x5a87('0x35')]=_0x3d119b[_0x5a87('0x35')][_0x5a87('0x37')]?_0x3d119b[_0x5a87('0x35')]:_0x4fd580[_0x5a87('0x31')];if(_0x1d08f8[_0x5a87('0x32')][_0x5a87('0x46')]){_0x3d119b['include']=[{'all':!![]}];}_0x3d119b=_['merge']({},_0x3d119b,_0x1d08f8[_0x5a87('0x42')]);return db['SugarcrmField'][_0x5a87('0x47')](_0x3d119b)[_0x5a87('0x26')](handleEntityNotFound(_0x354f8b,null))[_0x5a87('0x26')](respondWithResult(_0x354f8b,null))['catch'](handleError(_0x354f8b,null));};exports[_0x5a87('0x48')]=function(_0x4d2792,_0x38b791){return db['SugarcrmField'][_0x5a87('0x48')](_0x4d2792['body'],{})['then'](respondWithResult(_0x38b791,0xc9))['catch'](handleError(_0x38b791,null));};exports[_0x5a87('0x25')]=function(_0x12456d,_0x3d00e0){if(_0x12456d[_0x5a87('0x49')]['id']){delete _0x12456d['body']['id'];}return db['SugarcrmField'][_0x5a87('0x47')]({'where':{'id':_0x12456d[_0x5a87('0x44')]['id']}})[_0x5a87('0x26')](handleEntityNotFound(_0x3d00e0,null))[_0x5a87('0x26')](saveUpdates(_0x12456d[_0x5a87('0x49')],null))[_0x5a87('0x26')](respondWithResult(_0x3d00e0,null))['catch'](handleError(_0x3d00e0,null));};exports[_0x5a87('0x27')]=function(_0x21f2a6,_0x2d7354){return db[_0x5a87('0x2d')]['find']({'where':{'id':_0x21f2a6['params']['id']}})[_0x5a87('0x26')](handleEntityNotFound(_0x2d7354,null))[_0x5a87('0x26')](removeEntity(_0x2d7354,null))[_0x5a87('0x4a')](handleError(_0x2d7354,null));};
\ No newline at end of file
+var _0xdc9e=['rawAttributes','fieldName','type','key','model','map','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','index','SugarcrmField'];(function(_0x3b5170,_0x1bc38c){var _0x3afd14=function(_0x15af13){while(--_0x15af13){_0x3b5170['push'](_0x3b5170['shift']());}};_0x3afd14(++_0x1bc38c);}(_0xdc9e,0xc0));var _0xedc9=function(_0xcfa2e0,_0x40dd3d){_0xcfa2e0=_0xcfa2e0-0x0;var _0x1dc2b1=_0xdc9e[_0xcfa2e0];return _0x1dc2b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xedc9('0x0'));var jsonpatch=require(_0xedc9('0x1'));var rp=require(_0xedc9('0x2'));var moment=require(_0xedc9('0x3'));var BPromise=require(_0xedc9('0x4'));var Mustache=require(_0xedc9('0x5'));var util=require(_0xedc9('0x6'));var path=require(_0xedc9('0x7'));var sox=require(_0xedc9('0x8'));var csv=require(_0xedc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedc9('0xa'));var _=require(_0xedc9('0xb'));var squel=require(_0xedc9('0xc'));var crypto=require(_0xedc9('0xd'));var jsforce=require(_0xedc9('0xe'));var deskjs=require(_0xedc9('0xf'));var toCsv=require(_0xedc9('0x9'));var querystring=require(_0xedc9('0x10'));var Papa=require(_0xedc9('0x11'));var Redis=require(_0xedc9('0x12'));var authService=require(_0xedc9('0x13'));var qs=require(_0xedc9('0x14'));var as=require(_0xedc9('0x15'));var hardwareService=require(_0xedc9('0x16'));var logger=require(_0xedc9('0x17'))(_0xedc9('0x18'));var utils=require(_0xedc9('0x19'));var config=require(_0xedc9('0x1a'));var licenseUtil=require(_0xedc9('0x1b'));var db=require(_0xedc9('0x1c'))['db'];function respondWithStatusCode(_0x375c8c,_0x4d1dbf){_0x4d1dbf=_0x4d1dbf||0xcc;return function(_0x3cd214){if(_0x3cd214){return _0x375c8c[_0xedc9('0x1d')](_0x4d1dbf);}return _0x375c8c['status'](_0x4d1dbf)[_0xedc9('0x1e')]();};}function respondWithResult(_0x36f4be,_0x1b1997){_0x1b1997=_0x1b1997||0xc8;return function(_0xf3bd79){if(_0xf3bd79){return _0x36f4be[_0xedc9('0x1f')](_0x1b1997)[_0xedc9('0x20')](_0xf3bd79);}};}function respondWithFilteredResult(_0x13b8ad,_0x33df29){return function(_0x501207){if(_0x501207){var _0x40b799=typeof _0x33df29['offset']==='undefined'&&typeof _0x33df29[_0xedc9('0x21')]===_0xedc9('0x22');var _0x288328=_0x501207[_0xedc9('0x23')];var _0x4aa88a=_0x40b799?0x0:_0x33df29[_0xedc9('0x24')];var _0x52f789=_0x40b799?_0x501207[_0xedc9('0x23')]:_0x33df29[_0xedc9('0x24')]+_0x33df29[_0xedc9('0x21')];var _0x355abf;if(_0x52f789>=_0x288328){_0x52f789=_0x288328;_0x355abf=0xc8;}else{_0x355abf=0xce;}_0x13b8ad[_0xedc9('0x1f')](_0x355abf);return _0x13b8ad['set'](_0xedc9('0x25'),_0x4aa88a+'-'+_0x52f789+'/'+_0x288328)[_0xedc9('0x20')](_0x501207);}return null;};}function patchUpdates(_0x59f3e5){return function(_0x34dea0){try{jsonpatch['apply'](_0x34dea0,_0x59f3e5,!![]);}catch(_0x4abe56){return BPromise[_0xedc9('0x26')](_0x4abe56);}return _0x34dea0[_0xedc9('0x27')]();};}function saveUpdates(_0x2a9681,_0x9a0fa2){return function(_0x28c46a){if(_0x28c46a){return _0x28c46a['update'](_0x2a9681)[_0xedc9('0x28')](function(_0x41c05f){return _0x41c05f;});}return null;};}function removeEntity(_0x40b5f1,_0x4bca19){return function(_0x1dd257){if(_0x1dd257){return _0x1dd257[_0xedc9('0x29')]()['then'](function(){_0x40b5f1[_0xedc9('0x1f')](0xcc)[_0xedc9('0x1e')]();});}};}function handleEntityNotFound(_0x26e26c,_0x25fa06){return function(_0x2b960d){if(!_0x2b960d){_0x26e26c[_0xedc9('0x1d')](0x194);}return _0x2b960d;};}function handleError(_0x2f323d,_0x1fee15){_0x1fee15=_0x1fee15||0x1f4;return function(_0x1156ea){logger[_0xedc9('0x2a')](_0x1156ea[_0xedc9('0x2b')]);if(_0x1156ea[_0xedc9('0x2c')]){delete _0x1156ea[_0xedc9('0x2c')];}_0x2f323d[_0xedc9('0x1f')](_0x1fee15)[_0xedc9('0x2d')](_0x1156ea);};}exports[_0xedc9('0x2e')]=function(_0x3ac256,_0x438cb2){var _0x2e7baf={},_0x20af03={},_0x5f47ad={'count':0x0,'rows':[]};var _0x169b0b=_['map'](db[_0xedc9('0x2f')][_0xedc9('0x30')],function(_0x37be0b){return{'name':_0x37be0b[_0xedc9('0x31')],'type':_0x37be0b[_0xedc9('0x32')][_0xedc9('0x33')]};});_0x20af03[_0xedc9('0x34')]=_[_0xedc9('0x35')](_0x169b0b,_0xedc9('0x2c'));_0x20af03['query']=_['keys'](_0x3ac256['query']);_0x20af03[_0xedc9('0x36')]=_['intersection'](_0x20af03['model'],_0x20af03[_0xedc9('0x37')]);_0x2e7baf['attributes']=_[_0xedc9('0x38')](_0x20af03['model'],qs[_0xedc9('0x39')](_0x3ac256[_0xedc9('0x37')]['fields']));_0x2e7baf[_0xedc9('0x3a')]=_0x2e7baf[_0xedc9('0x3a')][_0xedc9('0x3b')]?_0x2e7baf['attributes']:_0x20af03[_0xedc9('0x34')];if(!_0x3ac256[_0xedc9('0x37')][_0xedc9('0x3c')](_0xedc9('0x3d'))){_0x2e7baf[_0xedc9('0x21')]=qs[_0xedc9('0x21')](_0x3ac256[_0xedc9('0x37')][_0xedc9('0x21')]);_0x2e7baf['offset']=qs[_0xedc9('0x24')](_0x3ac256[_0xedc9('0x37')]['offset']);}_0x2e7baf[_0xedc9('0x3e')]=qs['sort'](_0x3ac256['query'][_0xedc9('0x3f')]);_0x2e7baf[_0xedc9('0x40')]=qs[_0xedc9('0x36')](_['pick'](_0x3ac256['query'],_0x20af03[_0xedc9('0x36')]),_0x169b0b);if(_0x3ac256[_0xedc9('0x37')][_0xedc9('0x41')]){_0x2e7baf['where']=_[_0xedc9('0x42')](_0x2e7baf[_0xedc9('0x40')],{'$or':_[_0xedc9('0x35')](_0x169b0b,function(_0x5e5e5c){if(_0x5e5e5c[_0xedc9('0x32')]!==_0xedc9('0x43')){var _0x128075={};_0x128075[_0x5e5e5c[_0xedc9('0x2c')]]={'$like':'%'+_0x3ac256[_0xedc9('0x37')][_0xedc9('0x41')]+'%'};return _0x128075;}})});}_0x2e7baf=_[_0xedc9('0x42')]({},_0x2e7baf,_0x3ac256[_0xedc9('0x44')]);var _0x485320={'where':_0x2e7baf['where']};return db[_0xedc9('0x2f')][_0xedc9('0x23')](_0x485320)['then'](function(_0x359c26){_0x5f47ad[_0xedc9('0x23')]=_0x359c26;if(_0x3ac256[_0xedc9('0x37')][_0xedc9('0x45')]){_0x2e7baf[_0xedc9('0x46')]=[{'all':!![]}];}return db[_0xedc9('0x2f')][_0xedc9('0x47')](_0x2e7baf);})[_0xedc9('0x28')](function(_0x17ba6c){_0x5f47ad[_0xedc9('0x48')]=_0x17ba6c;return _0x5f47ad;})[_0xedc9('0x28')](respondWithFilteredResult(_0x438cb2,_0x2e7baf))[_0xedc9('0x49')](handleError(_0x438cb2,null));};exports[_0xedc9('0x4a')]=function(_0x362bed,_0x454baf){var _0x4afbfc={'raw':!![],'where':{'id':_0x362bed[_0xedc9('0x4b')]['id']}},_0x2df14a={};_0x2df14a['model']=_[_0xedc9('0x4c')](db[_0xedc9('0x2f')][_0xedc9('0x30')]);_0x2df14a['query']=_['keys'](_0x362bed[_0xedc9('0x37')]);_0x2df14a['filters']=_[_0xedc9('0x38')](_0x2df14a['model'],_0x2df14a[_0xedc9('0x37')]);_0x4afbfc['attributes']=_['intersection'](_0x2df14a[_0xedc9('0x34')],qs[_0xedc9('0x39')](_0x362bed['query'][_0xedc9('0x39')]));_0x4afbfc[_0xedc9('0x3a')]=_0x4afbfc['attributes'][_0xedc9('0x3b')]?_0x4afbfc[_0xedc9('0x3a')]:_0x2df14a[_0xedc9('0x34')];if(_0x362bed[_0xedc9('0x37')]['includeAll']){_0x4afbfc[_0xedc9('0x46')]=[{'all':!![]}];}_0x4afbfc=_[_0xedc9('0x42')]({},_0x4afbfc,_0x362bed[_0xedc9('0x44')]);return db['SugarcrmField'][_0xedc9('0x4d')](_0x4afbfc)[_0xedc9('0x28')](handleEntityNotFound(_0x454baf,null))[_0xedc9('0x28')](respondWithResult(_0x454baf,null))[_0xedc9('0x49')](handleError(_0x454baf,null));};exports[_0xedc9('0x4e')]=function(_0x498e73,_0x124536){return db[_0xedc9('0x2f')][_0xedc9('0x4e')](_0x498e73[_0xedc9('0x4f')],{})['then'](respondWithResult(_0x124536,0xc9))['catch'](handleError(_0x124536,null));};exports['update']=function(_0x3e7c35,_0x53a0b3){if(_0x3e7c35['body']['id']){delete _0x3e7c35[_0xedc9('0x4f')]['id'];}return db[_0xedc9('0x2f')][_0xedc9('0x4d')]({'where':{'id':_0x3e7c35[_0xedc9('0x4b')]['id']}})[_0xedc9('0x28')](handleEntityNotFound(_0x53a0b3,null))[_0xedc9('0x28')](saveUpdates(_0x3e7c35['body'],null))[_0xedc9('0x28')](respondWithResult(_0x53a0b3,null))[_0xedc9('0x49')](handleError(_0x53a0b3,null));};exports[_0xedc9('0x29')]=function(_0x6bcc60,_0x1adfb3){return db[_0xedc9('0x2f')][_0xedc9('0x4d')]({'where':{'id':_0x6bcc60['params']['id']}})[_0xedc9('0x28')](handleEntityNotFound(_0x1adfb3,null))['then'](removeEntity(_0x1adfb3,null))[_0xedc9('0x49')](handleError(_0x1adfb3,null));};
\ No newline at end of file
index eb670e7..5feb34f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72c1=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','int_sugarcrm_fields','idField','FieldId','lodash','util'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x72c1,0x98));var _0x172c=function(_0x32948f,_0x563d32){_0x32948f=_0x32948f-0x0;var _0x1b3376=_0x72c1[_0x32948f];return _0x1b3376;};'use strict';var _=require(_0x172c('0x0'));var util=require(_0x172c('0x1'));var logger=require(_0x172c('0x2'))(_0x172c('0x3'));var moment=require(_0x172c('0x4'));var BPromise=require('bluebird');var rp=require(_0x172c('0x5'));var fs=require('fs');var path=require(_0x172c('0x6'));var rimraf=require(_0x172c('0x7'));var config=require(_0x172c('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x172c('0x9')]=function(_0x3c8f2b,_0x12cbd8){return _0x3c8f2b[_0x172c('0xa')]('SugarcrmField',attributes,{'tableName':_0x172c('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x172c('0xc'),_0x172c('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x201a=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','path','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x45de25,_0x1fa0a2){var _0x783497=function(_0x3b6858){while(--_0x3b6858){_0x45de25['push'](_0x45de25['shift']());}};_0x783497(++_0x1fa0a2);}(_0x201a,0x102));var _0xa201=function(_0x557d47,_0x34c5a2){_0x557d47=_0x557d47-0x0;var _0x342b74=_0x201a[_0x557d47];return _0x342b74;};'use strict';var _=require(_0xa201('0x0'));var util=require(_0xa201('0x1'));var logger=require('../../config/logger')(_0xa201('0x2'));var moment=require(_0xa201('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa201('0x4'));var rimraf=require('rimraf');var config=require(_0xa201('0x5'));var attributes=require(_0xa201('0x6'));module[_0xa201('0x7')]=function(_0x1744d7,_0x16ee6e){return _0x1744d7[_0xa201('0x8')](_0xa201('0x9'),attributes,{'tableName':_0xa201('0xa'),'paranoid':![],'indexes':[{'name':_0xa201('0xb'),'fields':[_0xa201('0xc'),_0xa201('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index b3add36..3e5ee58 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b04=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug'];(function(_0x48aeef,_0x298484){var _0x3c70d1=function(_0x2d4083){while(--_0x2d4083){_0x48aeef['push'](_0x48aeef['shift']());}};_0x3c70d1(++_0x298484);}(_0x6b04,0x1ec));var _0x46b0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6b04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x46b0('0x0'));var util=require(_0x46b0('0x1'));var moment=require('moment');var BPromise=require(_0x46b0('0x2'));var rs=require(_0x46b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x46b0('0x5'))(_0x46b0('0x6'));var config=require(_0x46b0('0x7'));var jayson=require(_0x46b0('0x8'));var client=jayson[_0x46b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26da2c,_0x2771a1,_0x1b0a43){return new BPromise(function(_0x37f195,_0x38586a){return client[_0x46b0('0xa')](_0x26da2c,_0x1b0a43)[_0x46b0('0xb')](function(_0x45724c){logger[_0x46b0('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x2771a1,'request\x20sent');logger[_0x46b0('0xd')](_0x46b0('0xe'),_0x2771a1,_0x46b0('0xf'),JSON[_0x46b0('0x10')](_0x45724c));if(_0x45724c[_0x46b0('0x11')]){if(_0x45724c[_0x46b0('0x11')][_0x46b0('0x12')]===0x1f4){logger[_0x46b0('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x2771a1,_0x45724c['error']['message']);return _0x38586a(_0x45724c[_0x46b0('0x11')][_0x46b0('0x13')]);}logger[_0x46b0('0x11')](_0x46b0('0x14'),_0x2771a1,_0x45724c['error'][_0x46b0('0x13')]);return _0x37f195(_0x45724c[_0x46b0('0x11')]['message']);}else{logger[_0x46b0('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x2771a1,_0x46b0('0xf'));_0x37f195(_0x45724c[_0x46b0('0x15')][_0x46b0('0x13')]);}})[_0x46b0('0x16')](function(_0x3c2245){logger[_0x46b0('0x11')](_0x46b0('0x14'),_0x2771a1,_0x3c2245);_0x38586a(_0x3c2245);});});}
\ No newline at end of file
+var _0x1cab=['util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d9f7f,_0x3e4f01){var _0x47de15=function(_0x22c42e){while(--_0x22c42e){_0x2d9f7f['push'](_0x2d9f7f['shift']());}};_0x47de15(++_0x3e4f01);}(_0x1cab,0x1b5));var _0xb1ca=function(_0x4c2649,_0xdbe427){_0x4c2649=_0x4c2649-0x0;var _0x2b3041=_0x1cab[_0x4c2649];return _0x2b3041;};'use strict';var _=require('lodash');var util=require(_0xb1ca('0x0'));var moment=require(_0xb1ca('0x1'));var BPromise=require(_0xb1ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb1ca('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb1ca('0x5'));var client=jayson[_0xb1ca('0x6')][_0xb1ca('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xfb7a81,_0x562df9,_0x170173){return new BPromise(function(_0x4328b1,_0x2a8a91){return client[_0xb1ca('0x8')](_0xfb7a81,_0x170173)[_0xb1ca('0x9')](function(_0x414f59){logger['info'](_0xb1ca('0xa'),_0x562df9,_0xb1ca('0xb'));logger[_0xb1ca('0xc')](_0xb1ca('0xd'),_0x562df9,_0xb1ca('0xb'),JSON[_0xb1ca('0xe')](_0x414f59));if(_0x414f59[_0xb1ca('0xf')]){if(_0x414f59[_0xb1ca('0xf')][_0xb1ca('0x10')]===0x1f4){logger[_0xb1ca('0xf')](_0xb1ca('0xa'),_0x562df9,_0x414f59[_0xb1ca('0xf')][_0xb1ca('0x11')]);return _0x2a8a91(_0x414f59[_0xb1ca('0xf')][_0xb1ca('0x11')]);}logger[_0xb1ca('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x562df9,_0x414f59['error'][_0xb1ca('0x11')]);return _0x4328b1(_0x414f59[_0xb1ca('0xf')][_0xb1ca('0x11')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x562df9,_0xb1ca('0xb'));_0x4328b1(_0x414f59[_0xb1ca('0x12')][_0xb1ca('0x11')]);}})['catch'](function(_0x8c6f86){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x562df9,_0x8c6f86);_0x2a8a91(_0x8c6f86);});});}
\ No newline at end of file
index 826fb6a..3946ad3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x984b=['/:id/configurations','put','update','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x984b,0xee));var _0xb984=function(_0x3323d2,_0x11f7da){_0x3323d2=_0x3323d2-0x0;var _0x557de0=_0x984b[_0x3323d2];return _0x557de0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb984('0x0'));var express=require(_0xb984('0x1'));var router=express[_0xb984('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb984('0x3'));var config=require(_0xb984('0x4'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xb984('0x5')](),controller[_0xb984('0x6')]);router['get'](_0xb984('0x7'),auth[_0xb984('0x5')](),controller['show']);router[_0xb984('0x8')]('/:id/configurations',auth[_0xb984('0x5')](),controller[_0xb984('0x9')]);router[_0xb984('0x8')](_0xb984('0xa'),auth[_0xb984('0x5')](),controller[_0xb984('0xb')]);router[_0xb984('0xc')]('/',auth[_0xb984('0x5')](),controller[_0xb984('0xd')]);router[_0xb984('0xc')](_0xb984('0xe'),auth[_0xb984('0x5')](),controller['addConfiguration']);router[_0xb984('0xf')]('/:id',auth[_0xb984('0x5')](),controller[_0xb984('0x10')]);router['delete'](_0xb984('0x7'),auth[_0xb984('0x5')](),controller['destroy']);module[_0xb984('0x11')]=router;
\ No newline at end of file
+var _0x865d=['../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x41f5a6,_0xb35c51){var _0x241efd=function(_0x2cfaa5){while(--_0x2cfaa5){_0x41f5a6['push'](_0x41f5a6['shift']());}};_0x241efd(++_0xb35c51);}(_0x865d,0x1d9));var _0xd865=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x865d[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xd865('0x0'));var util=require(_0xd865('0x1'));var path=require(_0xd865('0x2'));var timeout=require(_0xd865('0x3'));var express=require(_0xd865('0x4'));var router=express[_0xd865('0x5')]();var fs_extra=require(_0xd865('0x6'));var auth=require(_0xd865('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd865('0x8'));var controller=require(_0xd865('0x9'));router[_0xd865('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd865('0xb'),auth[_0xd865('0xc')](),controller[_0xd865('0xd')]);router[_0xd865('0xa')](_0xd865('0xe'),auth['isAuthenticated'](),controller[_0xd865('0xf')]);router[_0xd865('0xa')](_0xd865('0x10'),auth['isAuthenticated'](),controller[_0xd865('0x11')]);router[_0xd865('0x12')]('/',auth[_0xd865('0xc')](),controller[_0xd865('0x13')]);router[_0xd865('0x12')]('/:id/configurations',auth[_0xd865('0xc')](),controller['addConfiguration']);router[_0xd865('0x14')]('/:id',auth[_0xd865('0xc')](),controller[_0xd865('0x15')]);router['delete'](_0xd865('0xb'),auth[_0xd865('0xc')](),controller[_0xd865('0x16')]);module[_0xd865('0x17')]=router;
\ No newline at end of file
index 3ecffc5..57d6b9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16bb=['STRING','HelpDesk','sequelize'];(function(_0x459cce,_0x4753dc){var _0x2d4906=function(_0x179b7c){while(--_0x179b7c){_0x459cce['push'](_0x459cce['shift']());}};_0x2d4906(++_0x4753dc);}(_0x16bb,0x12b));var _0xb16b=function(_0x148271,_0x1ba6b0){_0x148271=_0x148271-0x0;var _0x1b4dbf=_0x16bb[_0x148271];return _0x1b4dbf;};'use strict';var Sequelize=require(_0xb16b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb16b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb16b('0x1')]},'username':{'type':Sequelize[_0xb16b('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb16b('0x1')],'allowNull':![],'defaultValue':_0xb16b('0x2')},'remoteUri':{'type':Sequelize[_0xb16b('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb16b('0x1')],'allowNull':![]}};
\ No newline at end of file
+var _0x8014=['sequelize','exports','STRING'];(function(_0x154bc7,_0x4ab188){var _0x38d238=function(_0x201285){while(--_0x201285){_0x154bc7['push'](_0x154bc7['shift']());}};_0x38d238(++_0x4ab188);}(_0x8014,0x192));var _0x4801=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x8014[_0x120123];return _0x3bec4c;};'use strict';var Sequelize=require(_0x4801('0x0'));module[_0x4801('0x1')]={'name':{'type':Sequelize[_0x4801('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4801('0x2')]},'username':{'type':Sequelize[_0x4801('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4801('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x4801('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4801('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4801('0x2')],'allowNull':![]}};
\ No newline at end of file
index 2ee0080..b2e99c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a69=['Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VtigerAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','includes','remove','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8a69,0x7d));var _0x98a6=function(_0x35e93f,_0x36f082){_0x35e93f=_0x35e93f-0x0;var _0x1113fc=_0x8a69[_0x35e93f];return _0x1113fc;};'use strict';var emlformat=require(_0x98a6('0x0'));var rimraf=require(_0x98a6('0x1'));var zipdir=require(_0x98a6('0x2'));var jsonpatch=require(_0x98a6('0x3'));var rp=require(_0x98a6('0x4'));var moment=require(_0x98a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98a6('0x6'));var util=require(_0x98a6('0x7'));var path=require(_0x98a6('0x8'));var sox=require(_0x98a6('0x9'));var csv=require(_0x98a6('0xa'));var ejs=require(_0x98a6('0xb'));var fs=require('fs');var fs_extra=require(_0x98a6('0xc'));var _=require(_0x98a6('0xd'));var squel=require(_0x98a6('0xe'));var crypto=require(_0x98a6('0xf'));var jsforce=require(_0x98a6('0x10'));var deskjs=require(_0x98a6('0x11'));var toCsv=require(_0x98a6('0xa'));var querystring=require(_0x98a6('0x12'));var Papa=require(_0x98a6('0x13'));var Redis=require('ioredis');var authService=require(_0x98a6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x98a6('0x15'));var hardwareService=require(_0x98a6('0x16'));var logger=require(_0x98a6('0x17'))(_0x98a6('0x18'));var utils=require(_0x98a6('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x98a6('0x1a'));var db=require(_0x98a6('0x1b'))['db'];var integrations=require(_0x98a6('0x1c'));function respondWithStatusCode(_0x2d2cad,_0x4f7eeb){_0x4f7eeb=_0x4f7eeb||0xcc;return function(_0x4b9dbb){if(_0x4b9dbb){return _0x2d2cad[_0x98a6('0x1d')](_0x4f7eeb);}return _0x2d2cad[_0x98a6('0x1e')](_0x4f7eeb)['end']();};}function respondWithResult(_0x1f2ff3,_0x4982d4){_0x4982d4=_0x4982d4||0xc8;return function(_0x5a438a){if(_0x5a438a){return _0x1f2ff3[_0x98a6('0x1e')](_0x4982d4)[_0x98a6('0x1f')](_0x5a438a);}};}function respondWithFilteredResult(_0x7c6710,_0x3d2e6b){return function(_0x170e2b){if(_0x170e2b){var _0x50955e=typeof _0x3d2e6b['offset']===_0x98a6('0x20')&&typeof _0x3d2e6b[_0x98a6('0x21')]===_0x98a6('0x20');var _0x32df8c=_0x170e2b[_0x98a6('0x22')];var _0x1e7067=_0x50955e?0x0:_0x3d2e6b[_0x98a6('0x23')];var _0x284ba8=_0x50955e?_0x170e2b[_0x98a6('0x22')]:_0x3d2e6b[_0x98a6('0x23')]+_0x3d2e6b[_0x98a6('0x21')];var _0x16106c;if(_0x284ba8>=_0x32df8c){_0x284ba8=_0x32df8c;_0x16106c=0xc8;}else{_0x16106c=0xce;}_0x7c6710['status'](_0x16106c);return _0x7c6710[_0x98a6('0x24')](_0x98a6('0x25'),_0x1e7067+'-'+_0x284ba8+'/'+_0x32df8c)[_0x98a6('0x1f')](_0x170e2b);}return null;};}function patchUpdates(_0x2f6247){return function(_0x41a07d){try{jsonpatch[_0x98a6('0x26')](_0x41a07d,_0x2f6247,!![]);}catch(_0xe3723b){return BPromise['reject'](_0xe3723b);}return _0x41a07d['save']();};}function saveUpdates(_0x5ef71c,_0x3c0288){return function(_0x1bbe24){if(_0x1bbe24){return _0x1bbe24[_0x98a6('0x27')](_0x5ef71c)[_0x98a6('0x28')](function(_0x11a3d6){return _0x11a3d6;});}return null;};}function removeEntity(_0x30d758,_0x74bc30){return function(_0x406744){if(_0x406744){return _0x406744['destroy']()[_0x98a6('0x28')](function(){_0x30d758[_0x98a6('0x1e')](0xcc)[_0x98a6('0x29')]();});}};}function handleEntityNotFound(_0x270029,_0x424482){return function(_0x5d7157){if(!_0x5d7157){_0x270029['sendStatus'](0x194);}return _0x5d7157;};}function handleError(_0x1a076d,_0x17bfe0){_0x17bfe0=_0x17bfe0||0x1f4;return function(_0x4d38d1){logger[_0x98a6('0x2a')](_0x4d38d1[_0x98a6('0x2b')]);if(_0x4d38d1[_0x98a6('0x2c')]){delete _0x4d38d1[_0x98a6('0x2c')];}_0x1a076d[_0x98a6('0x1e')](_0x17bfe0)['send'](_0x4d38d1);};}exports[_0x98a6('0x2d')]=function(_0x4de039,_0x382fa1){var _0x3aadfb={},_0x5deec8={},_0x320c3b={'count':0x0,'rows':[]};var _0x49b2e1=_[_0x98a6('0x2e')](db['VtigerAccount'][_0x98a6('0x2f')],function(_0x2d36cc){return{'name':_0x2d36cc[_0x98a6('0x30')],'type':_0x2d36cc[_0x98a6('0x31')][_0x98a6('0x32')]};});_0x5deec8[_0x98a6('0x33')]=_['map'](_0x49b2e1,'name');_0x5deec8[_0x98a6('0x34')]=_[_0x98a6('0x35')](_0x4de039[_0x98a6('0x34')]);_0x5deec8[_0x98a6('0x36')]=_[_0x98a6('0x37')](_0x5deec8[_0x98a6('0x33')],_0x5deec8[_0x98a6('0x34')]);_0x3aadfb[_0x98a6('0x38')]=_[_0x98a6('0x37')](_0x5deec8[_0x98a6('0x33')],qs['fields'](_0x4de039[_0x98a6('0x34')][_0x98a6('0x39')]));_0x3aadfb['attributes']=_0x3aadfb['attributes'][_0x98a6('0x3a')]?_0x3aadfb[_0x98a6('0x38')]:_0x5deec8[_0x98a6('0x33')];if(!_0x4de039[_0x98a6('0x34')]['hasOwnProperty'](_0x98a6('0x3b'))){_0x3aadfb[_0x98a6('0x21')]=qs[_0x98a6('0x21')](_0x4de039[_0x98a6('0x34')][_0x98a6('0x21')]);_0x3aadfb[_0x98a6('0x23')]=qs[_0x98a6('0x23')](_0x4de039[_0x98a6('0x34')][_0x98a6('0x23')]);}_0x3aadfb[_0x98a6('0x3c')]=qs[_0x98a6('0x3d')](_0x4de039['query'][_0x98a6('0x3d')]);_0x3aadfb[_0x98a6('0x3e')]=qs[_0x98a6('0x36')](_[_0x98a6('0x3f')](_0x4de039[_0x98a6('0x34')],_0x5deec8['filters']),_0x49b2e1);if(_0x4de039['query'][_0x98a6('0x40')]){_0x3aadfb['where']=_[_0x98a6('0x41')](_0x3aadfb['where'],{'$or':_[_0x98a6('0x2e')](_0x49b2e1,function(_0x340461){if(_0x340461[_0x98a6('0x31')]!==_0x98a6('0x42')){var _0x4c2041={};_0x4c2041[_0x340461[_0x98a6('0x2c')]]={'$like':'%'+_0x4de039[_0x98a6('0x34')][_0x98a6('0x40')]+'%'};return _0x4c2041;}})});}_0x3aadfb=_[_0x98a6('0x41')]({},_0x3aadfb,_0x4de039['options']);var _0x30aa78={'where':_0x3aadfb[_0x98a6('0x3e')]};return db[_0x98a6('0x43')][_0x98a6('0x22')](_0x30aa78)['then'](function(_0x56d5a4){_0x320c3b[_0x98a6('0x22')]=_0x56d5a4;if(_0x4de039[_0x98a6('0x34')][_0x98a6('0x44')]){_0x3aadfb[_0x98a6('0x45')]=[{'all':!![]}];}return db[_0x98a6('0x43')][_0x98a6('0x46')](_0x3aadfb);})[_0x98a6('0x28')](function(_0x15bcb9){_0x320c3b[_0x98a6('0x47')]=_0x15bcb9;return _0x320c3b;})['then'](respondWithFilteredResult(_0x382fa1,_0x3aadfb))[_0x98a6('0x48')](handleError(_0x382fa1,null));};exports[_0x98a6('0x49')]=function(_0x14eea2,_0x145742){var _0x2672f4={'raw':![],'where':{'id':_0x14eea2[_0x98a6('0x4a')]['id']}},_0x261202={};_0x261202[_0x98a6('0x33')]=_[_0x98a6('0x35')](db[_0x98a6('0x43')][_0x98a6('0x2f')]);_0x261202['query']=_[_0x98a6('0x35')](_0x14eea2[_0x98a6('0x34')]);_0x261202['filters']=_[_0x98a6('0x37')](_0x261202['model'],_0x261202[_0x98a6('0x34')]);_0x2672f4[_0x98a6('0x38')]=_['intersection'](_0x261202['model'],qs[_0x98a6('0x39')](_0x14eea2[_0x98a6('0x34')]['fields']));_0x2672f4[_0x98a6('0x38')]=_0x2672f4[_0x98a6('0x38')][_0x98a6('0x3a')]?_0x2672f4[_0x98a6('0x38')]:_0x261202[_0x98a6('0x33')];if(_0x14eea2[_0x98a6('0x34')][_0x98a6('0x44')]){_0x2672f4[_0x98a6('0x45')]=[{'all':!![]}];}_0x2672f4=_[_0x98a6('0x41')]({},_0x2672f4,_0x14eea2[_0x98a6('0x4b')]);return db[_0x98a6('0x43')][_0x98a6('0x4c')](_0x2672f4)[_0x98a6('0x28')](handleEntityNotFound(_0x145742,null))['then'](respondWithResult(_0x145742,null))[_0x98a6('0x48')](handleError(_0x145742,null));};exports[_0x98a6('0x4d')]=function(_0x18c62b,_0x377e83){return db[_0x98a6('0x43')][_0x98a6('0x4d')](_0x18c62b[_0x98a6('0x4e')],{})[_0x98a6('0x28')](respondWithResult(_0x377e83,0xc9))[_0x98a6('0x48')](handleError(_0x377e83,null));};exports[_0x98a6('0x27')]=function(_0x4a052c,_0x69af33){if(_0x4a052c[_0x98a6('0x4e')]['id']){delete _0x4a052c[_0x98a6('0x4e')]['id'];}return db['VtigerAccount'][_0x98a6('0x4c')]({'where':{'id':_0x4a052c[_0x98a6('0x4a')]['id']}})[_0x98a6('0x28')](handleEntityNotFound(_0x69af33,null))[_0x98a6('0x28')](saveUpdates(_0x4a052c[_0x98a6('0x4e')],null))[_0x98a6('0x28')](respondWithResult(_0x69af33,null))['catch'](handleError(_0x69af33,null));};exports[_0x98a6('0x4f')]=function(_0xd032fa,_0x2aa9b7){return db['VtigerAccount'][_0x98a6('0x4c')]({'where':{'id':_0xd032fa['params']['id']}})[_0x98a6('0x28')](handleEntityNotFound(_0x2aa9b7,null))[_0x98a6('0x28')](removeEntity(_0x2aa9b7,null))[_0x98a6('0x48')](handleError(_0x2aa9b7,null));};exports[_0x98a6('0x50')]=function(_0x1bca66,_0xe1599b,_0x99a550){var _0xcba56f={};var _0x6a1632={};var _0x3f09f7;var _0x151fef;return db[_0x98a6('0x43')][_0x98a6('0x51')]({'where':{'id':_0x1bca66[_0x98a6('0x4a')]['id']}})[_0x98a6('0x28')](handleEntityNotFound(_0xe1599b,null))[_0x98a6('0x28')](function(_0x3158ad){if(_0x3158ad){_0x3f09f7=_0x3158ad;_0x6a1632[_0x98a6('0x33')]=_[_0x98a6('0x35')](db['VtigerConfiguration'][_0x98a6('0x2f')]);_0x6a1632[_0x98a6('0x34')]=_[_0x98a6('0x35')](_0x1bca66['query']);_0x6a1632['filters']=_['intersection'](_0x6a1632[_0x98a6('0x33')],_0x6a1632[_0x98a6('0x34')]);_0xcba56f[_0x98a6('0x38')]=_[_0x98a6('0x37')](_0x6a1632[_0x98a6('0x33')],qs[_0x98a6('0x39')](_0x1bca66[_0x98a6('0x34')]['fields']));_0xcba56f[_0x98a6('0x38')]=_0xcba56f['attributes'][_0x98a6('0x3a')]?_0xcba56f[_0x98a6('0x38')]:_0x6a1632[_0x98a6('0x33')];_0xcba56f[_0x98a6('0x3c')]=qs[_0x98a6('0x3d')](_0x1bca66['query'][_0x98a6('0x3d')]);_0xcba56f[_0x98a6('0x3e')]=qs[_0x98a6('0x36')](_[_0x98a6('0x3f')](_0x1bca66['query'],_0x6a1632[_0x98a6('0x36')]));if(_0x1bca66[_0x98a6('0x34')][_0x98a6('0x40')]){_0xcba56f[_0x98a6('0x3e')]=_[_0x98a6('0x41')](_0xcba56f['where'],{'$or':_['map'](_0xcba56f[_0x98a6('0x38')],function(_0x2a6776){var _0x54ddf2={};_0x54ddf2[_0x2a6776]={'$like':'%'+_0x1bca66[_0x98a6('0x34')]['filter']+'%'};return _0x54ddf2;})});}_0xcba56f=_['merge']({},_0xcba56f,_0x1bca66[_0x98a6('0x4b')]);return _0x3f09f7['getConfigurations'](_0xcba56f);}})[_0x98a6('0x28')](function(_0x4aa9ca){if(_0x4aa9ca){_0x151fef=_0x4aa9ca[_0x98a6('0x3a')];if(!_0x1bca66[_0x98a6('0x34')][_0x98a6('0x52')](_0x98a6('0x3b'))){_0xcba56f['limit']=qs['limit'](_0x1bca66[_0x98a6('0x34')][_0x98a6('0x21')]);_0xcba56f['offset']=qs[_0x98a6('0x23')](_0x1bca66[_0x98a6('0x34')][_0x98a6('0x23')]);}return _0x3f09f7[_0x98a6('0x50')](_0xcba56f);}})['then'](function(_0x2cfb08){if(_0x2cfb08){return _0x2cfb08?{'count':_0x151fef,'rows':_0x2cfb08}:null;}})[_0x98a6('0x28')](respondWithResult(_0xe1599b,null))[_0x98a6('0x48')](handleError(_0xe1599b,null));};exports[_0x98a6('0x53')]=function(_0x555fd0,_0x232d06,_0x569c1d){if(_0x555fd0[_0x98a6('0x4e')]['id']){delete _0x555fd0[_0x98a6('0x4e')]['id'];}return db[_0x98a6('0x43')][_0x98a6('0x51')]({'where':{'id':_0x555fd0['params']['id']}})[_0x98a6('0x28')](handleEntityNotFound(_0x232d06,null))[_0x98a6('0x28')](function(_0x32cc5b){if(_0x32cc5b){_0x555fd0[_0x98a6('0x4e')][_0x98a6('0x54')]=_0x32cc5b['id'];_0x555fd0['body'][_0x98a6('0x55')]=integrations[_0x98a6('0x56')](_0x555fd0[_0x98a6('0x4e')][_0x98a6('0x57')],_0x555fd0[_0x98a6('0x4e')][_0x98a6('0x31')]);_0x555fd0[_0x98a6('0x4e')][_0x98a6('0x58')]=integrations['getDescriptions'](_0x555fd0['body'][_0x98a6('0x57')],_0x555fd0[_0x98a6('0x4e')]['type']);return db['VtigerConfiguration'][_0x98a6('0x4d')](_0x555fd0[_0x98a6('0x4e')],{'include':[{'model':db[_0x98a6('0x59')],'as':'Subjects'},{'model':db[_0x98a6('0x59')],'as':_0x98a6('0x58')}]});}return null;})[_0x98a6('0x28')](respondWithResult(_0x232d06,null))[_0x98a6('0x48')](handleError(_0x232d06,null));};var md5=require('md5');exports[_0x98a6('0x5a')]=function(_0x1e195a,_0x5e5e05,_0x26193b){var _0x3dfeb5=null;var _0x315771=null;var _0x3e91cf=null;var _0x4922bf=null;var _0x11f47c='';return db[_0x98a6('0x43')][_0x98a6('0x51')]({'where':{'id':_0x1e195a['params']['id']},'attributes':['id',_0x98a6('0x2c'),_0x98a6('0x5b'),_0x98a6('0x5c'),_0x98a6('0x5d'),_0x98a6('0x5e'),_0x98a6('0x5f'),_0x98a6('0x60')]})['then'](handleEntityNotFound(_0x5e5e05,null))[_0x98a6('0x28')](function(_0x4f9611){if(_0x4f9611){_0x3dfeb5=_0x4f9611[_0x98a6('0x5b')];_0x315771=_0x4f9611['accessKey'];_0x3e91cf=_0x4f9611[_0x98a6('0x5d')];_0x11f47c=_0x4f9611[_0x98a6('0x5e')];var _0x5c6931=_0x11f47c[_0x98a6('0x61')](-0x1);if(_0x5c6931==='/'){_0x11f47c=_0x11f47c['substring'](0x0,_0x11f47c['lastIndexOf'](_0x5c6931));}_0x4922bf=util['format'](_0x98a6('0x62'),_0x11f47c);var _0xf74529={'method':'GET','uri':_0x4922bf,'qs':{'operation':_0x98a6('0x63'),'username':_0x4f9611[_0x98a6('0x5b')]},'json':!![]};return rp(_0xf74529);}})[_0x98a6('0x28')](function(_0x3669ba){if(_0x3669ba[_0x98a6('0x64')]){var _0x19b612={'method':_0x98a6('0x65'),'uri':_0x4922bf,'form':{'operation':_0x98a6('0x66'),'username':_0x3dfeb5,'accessKey':md5(_0x3669ba[_0x98a6('0x67')][_0x98a6('0x68')]+_0x315771)},'json':!![]};return rp(_0x19b612);}})[_0x98a6('0x28')](function(_0x3f04e3){if(_0x3f04e3[_0x98a6('0x64')]){var _0x5bad1b={'method':_0x98a6('0x69'),'uri':_0x4922bf,'qs':{'operation':_0x98a6('0x6a'),'username':_0x3dfeb5,'sessionName':_0x3f04e3[_0x98a6('0x67')][_0x98a6('0x6b')],'elementType':_0x3e91cf},'json':!![]};return rp(_0x5bad1b);}})[_0x98a6('0x28')](function(_0x4de192){if(_0x4de192[_0x98a6('0x64')]){var _0x54850=[_0x98a6('0x6c'),'reference','owner'];_['remove'](_0x4de192['result']['fields'],function(_0x2df394){return _0x54850[_0x98a6('0x6d')](_0x2df394[_0x98a6('0x31')]['name']);});_[_0x98a6('0x6e')](_0x4de192[_0x98a6('0x67')][_0x98a6('0x39')],function(_0x29f9be){return _0x29f9be['editable']===_0x98a6('0x6f');});return{'count':_0x4de192['result'][_0x98a6('0x39')][_0x98a6('0x3a')],'rows':_[_0x98a6('0x2e')](_0x4de192['result'][_0x98a6('0x39')],function(_0x3d1a77){return{'id':_0x3d1a77['name'],'name':_0x3d1a77[_0x98a6('0x70')],'custom':_[_0x98a6('0x71')](_0x3d1a77['name'],'cf_')?!![]:![],'options':_0x3d1a77[_0x98a6('0x31')][_0x98a6('0x2c')]===_0x98a6('0x72')&&_0x3d1a77[_0x98a6('0x31')][_0x98a6('0x73')]['length']>0x0?_[_0x98a6('0x2e')](_0x3d1a77[_0x98a6('0x31')][_0x98a6('0x73')],function(_0x21c0ba){return{'name':_0x21c0ba[_0x98a6('0x70')],'value':_0x21c0ba[_0x98a6('0x74')]};}):[]};})};}})[_0x98a6('0x28')](respondWithResult(_0x5e5e05,null))[_0x98a6('0x48')](function(_0xe2ac3e){console[_0x98a6('0x75')](_0x98a6('0x76')+_0xe2ac3e);var _0x5c7665=_0x1e195a[_0x98a6('0x34')][_0x98a6('0x77')]?0x1f4:_0xe2ac3e[_0x98a6('0x78')]||0x1f4;logger[_0x98a6('0x2a')](_0x98a6('0x79'),_0x98a6('0x5a'),_0x5c7665,JSON[_0x98a6('0x7a')](_0xe2ac3e));delete _0xe2ac3e['name'];if(_0x5c7665===0x191){_0x5c7665=0x190;}_0x5e5e05[_0x98a6('0x1e')](_0x5c7665)['send'](_0x1e195a[_0x98a6('0x34')][_0x98a6('0x77')]?{'message':_0x98a6('0x7b'),'statusCode':_0xe2ac3e[_0x98a6('0x78')]}:_0xe2ac3e);});};
\ No newline at end of file
+var _0xc015=['describe','reference','includes','remove','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','format','%s/webservice.php','GET','getchallenge','success','POST','result','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc015,0x182));var _0x5c01=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xc015[_0x212bf5];return _0xfcad21;};'use strict';var emlformat=require(_0x5c01('0x0'));var rimraf=require(_0x5c01('0x1'));var zipdir=require(_0x5c01('0x2'));var jsonpatch=require(_0x5c01('0x3'));var rp=require(_0x5c01('0x4'));var moment=require(_0x5c01('0x5'));var BPromise=require(_0x5c01('0x6'));var Mustache=require(_0x5c01('0x7'));var util=require('util');var path=require(_0x5c01('0x8'));var sox=require(_0x5c01('0x9'));var csv=require('to-csv');var ejs=require(_0x5c01('0xa'));var fs=require('fs');var fs_extra=require(_0x5c01('0xb'));var _=require(_0x5c01('0xc'));var squel=require('squel');var crypto=require(_0x5c01('0xd'));var jsforce=require(_0x5c01('0xe'));var deskjs=require(_0x5c01('0xf'));var toCsv=require(_0x5c01('0x10'));var querystring=require(_0x5c01('0x11'));var Papa=require(_0x5c01('0x12'));var Redis=require(_0x5c01('0x13'));var authService=require(_0x5c01('0x14'));var qs=require(_0x5c01('0x15'));var as=require(_0x5c01('0x16'));var hardwareService=require(_0x5c01('0x17'));var logger=require(_0x5c01('0x18'))(_0x5c01('0x19'));var utils=require(_0x5c01('0x1a'));var config=require(_0x5c01('0x1b'));var licenseUtil=require(_0x5c01('0x1c'));var db=require(_0x5c01('0x1d'))['db'];var integrations=require(_0x5c01('0x1e'));function respondWithStatusCode(_0x4b0c6d,_0x16a3b3){_0x16a3b3=_0x16a3b3||0xcc;return function(_0x22df48){if(_0x22df48){return _0x4b0c6d['sendStatus'](_0x16a3b3);}return _0x4b0c6d[_0x5c01('0x1f')](_0x16a3b3)[_0x5c01('0x20')]();};}function respondWithResult(_0xf3a1b0,_0x18bd02){_0x18bd02=_0x18bd02||0xc8;return function(_0x16c67f){if(_0x16c67f){return _0xf3a1b0[_0x5c01('0x1f')](_0x18bd02)['json'](_0x16c67f);}};}function respondWithFilteredResult(_0x3a3739,_0x3c66ca){return function(_0x6515c7){if(_0x6515c7){var _0x44d0b5=typeof _0x3c66ca[_0x5c01('0x21')]===_0x5c01('0x22')&&typeof _0x3c66ca[_0x5c01('0x23')]===_0x5c01('0x22');var _0x302c12=_0x6515c7[_0x5c01('0x24')];var _0x21fe7e=_0x44d0b5?0x0:_0x3c66ca[_0x5c01('0x21')];var _0x38f0fa=_0x44d0b5?_0x6515c7[_0x5c01('0x24')]:_0x3c66ca[_0x5c01('0x21')]+_0x3c66ca['limit'];var _0x5cb2df;if(_0x38f0fa>=_0x302c12){_0x38f0fa=_0x302c12;_0x5cb2df=0xc8;}else{_0x5cb2df=0xce;}_0x3a3739[_0x5c01('0x1f')](_0x5cb2df);return _0x3a3739['set']('Content-Range',_0x21fe7e+'-'+_0x38f0fa+'/'+_0x302c12)[_0x5c01('0x25')](_0x6515c7);}return null;};}function patchUpdates(_0x1be3bf){return function(_0x3637b1){try{jsonpatch[_0x5c01('0x26')](_0x3637b1,_0x1be3bf,!![]);}catch(_0x2ea4e2){return BPromise[_0x5c01('0x27')](_0x2ea4e2);}return _0x3637b1[_0x5c01('0x28')]();};}function saveUpdates(_0x21d1c0,_0x2bd6c3){return function(_0x552ff5){if(_0x552ff5){return _0x552ff5[_0x5c01('0x29')](_0x21d1c0)[_0x5c01('0x2a')](function(_0x16d3be){return _0x16d3be;});}return null;};}function removeEntity(_0x111a8f,_0x2cc05e){return function(_0x156413){if(_0x156413){return _0x156413[_0x5c01('0x2b')]()['then'](function(){_0x111a8f[_0x5c01('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f91e0,_0x1a7c02){return function(_0x351238){if(!_0x351238){_0x3f91e0[_0x5c01('0x2c')](0x194);}return _0x351238;};}function handleError(_0x5e1db3,_0x1533dc){_0x1533dc=_0x1533dc||0x1f4;return function(_0x306b67){logger[_0x5c01('0x2d')](_0x306b67[_0x5c01('0x2e')]);if(_0x306b67[_0x5c01('0x2f')]){delete _0x306b67[_0x5c01('0x2f')];}_0x5e1db3[_0x5c01('0x1f')](_0x1533dc)[_0x5c01('0x30')](_0x306b67);};}exports[_0x5c01('0x31')]=function(_0x2f6e90,_0x2c91ad){var _0x2f989a={},_0x30b5ac={},_0xde587={'count':0x0,'rows':[]};var _0x2df597=_[_0x5c01('0x32')](db[_0x5c01('0x33')][_0x5c01('0x34')],function(_0x4447d3){return{'name':_0x4447d3[_0x5c01('0x35')],'type':_0x4447d3[_0x5c01('0x36')][_0x5c01('0x37')]};});_0x30b5ac[_0x5c01('0x38')]=_[_0x5c01('0x32')](_0x2df597,_0x5c01('0x2f'));_0x30b5ac[_0x5c01('0x39')]=_[_0x5c01('0x3a')](_0x2f6e90[_0x5c01('0x39')]);_0x30b5ac[_0x5c01('0x3b')]=_['intersection'](_0x30b5ac[_0x5c01('0x38')],_0x30b5ac['query']);_0x2f989a[_0x5c01('0x3c')]=_[_0x5c01('0x3d')](_0x30b5ac['model'],qs[_0x5c01('0x3e')](_0x2f6e90[_0x5c01('0x39')][_0x5c01('0x3e')]));_0x2f989a[_0x5c01('0x3c')]=_0x2f989a[_0x5c01('0x3c')][_0x5c01('0x3f')]?_0x2f989a['attributes']:_0x30b5ac[_0x5c01('0x38')];if(!_0x2f6e90['query']['hasOwnProperty']('nolimit')){_0x2f989a[_0x5c01('0x23')]=qs['limit'](_0x2f6e90[_0x5c01('0x39')]['limit']);_0x2f989a[_0x5c01('0x21')]=qs[_0x5c01('0x21')](_0x2f6e90[_0x5c01('0x39')]['offset']);}_0x2f989a[_0x5c01('0x40')]=qs[_0x5c01('0x41')](_0x2f6e90['query'][_0x5c01('0x41')]);_0x2f989a[_0x5c01('0x42')]=qs['filters'](_[_0x5c01('0x43')](_0x2f6e90[_0x5c01('0x39')],_0x30b5ac[_0x5c01('0x3b')]),_0x2df597);if(_0x2f6e90[_0x5c01('0x39')][_0x5c01('0x44')]){_0x2f989a[_0x5c01('0x42')]=_[_0x5c01('0x45')](_0x2f989a[_0x5c01('0x42')],{'$or':_[_0x5c01('0x32')](_0x2df597,function(_0x3e68ce){if(_0x3e68ce[_0x5c01('0x36')]!==_0x5c01('0x46')){var _0x2f3d0e={};_0x2f3d0e[_0x3e68ce['name']]={'$like':'%'+_0x2f6e90[_0x5c01('0x39')]['filter']+'%'};return _0x2f3d0e;}})});}_0x2f989a=_['merge']({},_0x2f989a,_0x2f6e90[_0x5c01('0x47')]);var _0x54020e={'where':_0x2f989a[_0x5c01('0x42')]};return db['VtigerAccount'][_0x5c01('0x24')](_0x54020e)[_0x5c01('0x2a')](function(_0x420946){_0xde587[_0x5c01('0x24')]=_0x420946;if(_0x2f6e90[_0x5c01('0x39')][_0x5c01('0x48')]){_0x2f989a[_0x5c01('0x49')]=[{'all':!![]}];}return db[_0x5c01('0x33')]['findAll'](_0x2f989a);})[_0x5c01('0x2a')](function(_0x53454b){_0xde587[_0x5c01('0x4a')]=_0x53454b;return _0xde587;})[_0x5c01('0x2a')](respondWithFilteredResult(_0x2c91ad,_0x2f989a))[_0x5c01('0x4b')](handleError(_0x2c91ad,null));};exports[_0x5c01('0x4c')]=function(_0x3333d8,_0x132a11){var _0x323904={'raw':![],'where':{'id':_0x3333d8[_0x5c01('0x4d')]['id']}},_0x1ef151={};_0x1ef151[_0x5c01('0x38')]=_[_0x5c01('0x3a')](db[_0x5c01('0x33')]['rawAttributes']);_0x1ef151[_0x5c01('0x39')]=_[_0x5c01('0x3a')](_0x3333d8[_0x5c01('0x39')]);_0x1ef151[_0x5c01('0x3b')]=_[_0x5c01('0x3d')](_0x1ef151['model'],_0x1ef151['query']);_0x323904[_0x5c01('0x3c')]=_[_0x5c01('0x3d')](_0x1ef151[_0x5c01('0x38')],qs[_0x5c01('0x3e')](_0x3333d8['query'][_0x5c01('0x3e')]));_0x323904[_0x5c01('0x3c')]=_0x323904[_0x5c01('0x3c')][_0x5c01('0x3f')]?_0x323904[_0x5c01('0x3c')]:_0x1ef151[_0x5c01('0x38')];if(_0x3333d8['query'][_0x5c01('0x48')]){_0x323904['include']=[{'all':!![]}];}_0x323904=_[_0x5c01('0x45')]({},_0x323904,_0x3333d8[_0x5c01('0x47')]);return db[_0x5c01('0x33')][_0x5c01('0x4e')](_0x323904)[_0x5c01('0x2a')](handleEntityNotFound(_0x132a11,null))['then'](respondWithResult(_0x132a11,null))[_0x5c01('0x4b')](handleError(_0x132a11,null));};exports[_0x5c01('0x4f')]=function(_0x447cfc,_0x253661){return db[_0x5c01('0x33')][_0x5c01('0x4f')](_0x447cfc['body'],{})[_0x5c01('0x2a')](respondWithResult(_0x253661,0xc9))[_0x5c01('0x4b')](handleError(_0x253661,null));};exports[_0x5c01('0x29')]=function(_0x3f64fe,_0x508d1){if(_0x3f64fe['body']['id']){delete _0x3f64fe[_0x5c01('0x50')]['id'];}return db[_0x5c01('0x33')][_0x5c01('0x4e')]({'where':{'id':_0x3f64fe[_0x5c01('0x4d')]['id']}})[_0x5c01('0x2a')](handleEntityNotFound(_0x508d1,null))[_0x5c01('0x2a')](saveUpdates(_0x3f64fe[_0x5c01('0x50')],null))['then'](respondWithResult(_0x508d1,null))[_0x5c01('0x4b')](handleError(_0x508d1,null));};exports[_0x5c01('0x2b')]=function(_0x26efec,_0x4cf801){return db[_0x5c01('0x33')][_0x5c01('0x4e')]({'where':{'id':_0x26efec[_0x5c01('0x4d')]['id']}})[_0x5c01('0x2a')](handleEntityNotFound(_0x4cf801,null))[_0x5c01('0x2a')](removeEntity(_0x4cf801,null))[_0x5c01('0x4b')](handleError(_0x4cf801,null));};exports[_0x5c01('0x51')]=function(_0x5022d2,_0x45df27,_0x4648e0){var _0x28bfc5={};var _0x107e5b={};var _0x3514a0;var _0x912102;return db[_0x5c01('0x33')][_0x5c01('0x52')]({'where':{'id':_0x5022d2[_0x5c01('0x4d')]['id']}})[_0x5c01('0x2a')](handleEntityNotFound(_0x45df27,null))[_0x5c01('0x2a')](function(_0x12ca0b){if(_0x12ca0b){_0x3514a0=_0x12ca0b;_0x107e5b['model']=_[_0x5c01('0x3a')](db[_0x5c01('0x53')][_0x5c01('0x34')]);_0x107e5b[_0x5c01('0x39')]=_[_0x5c01('0x3a')](_0x5022d2['query']);_0x107e5b[_0x5c01('0x3b')]=_[_0x5c01('0x3d')](_0x107e5b[_0x5c01('0x38')],_0x107e5b[_0x5c01('0x39')]);_0x28bfc5[_0x5c01('0x3c')]=_['intersection'](_0x107e5b[_0x5c01('0x38')],qs['fields'](_0x5022d2[_0x5c01('0x39')][_0x5c01('0x3e')]));_0x28bfc5[_0x5c01('0x3c')]=_0x28bfc5[_0x5c01('0x3c')][_0x5c01('0x3f')]?_0x28bfc5[_0x5c01('0x3c')]:_0x107e5b[_0x5c01('0x38')];_0x28bfc5['order']=qs[_0x5c01('0x41')](_0x5022d2['query'][_0x5c01('0x41')]);_0x28bfc5['where']=qs[_0x5c01('0x3b')](_['pick'](_0x5022d2[_0x5c01('0x39')],_0x107e5b[_0x5c01('0x3b')]));if(_0x5022d2[_0x5c01('0x39')][_0x5c01('0x44')]){_0x28bfc5[_0x5c01('0x42')]=_['merge'](_0x28bfc5[_0x5c01('0x42')],{'$or':_['map'](_0x28bfc5[_0x5c01('0x3c')],function(_0x3cb3e2){var _0x5d36f9={};_0x5d36f9[_0x3cb3e2]={'$like':'%'+_0x5022d2[_0x5c01('0x39')][_0x5c01('0x44')]+'%'};return _0x5d36f9;})});}_0x28bfc5=_[_0x5c01('0x45')]({},_0x28bfc5,_0x5022d2[_0x5c01('0x47')]);return _0x3514a0[_0x5c01('0x51')](_0x28bfc5);}})[_0x5c01('0x2a')](function(_0x3cdce5){if(_0x3cdce5){_0x912102=_0x3cdce5[_0x5c01('0x3f')];if(!_0x5022d2[_0x5c01('0x39')][_0x5c01('0x54')](_0x5c01('0x55'))){_0x28bfc5[_0x5c01('0x23')]=qs['limit'](_0x5022d2[_0x5c01('0x39')][_0x5c01('0x23')]);_0x28bfc5[_0x5c01('0x21')]=qs[_0x5c01('0x21')](_0x5022d2[_0x5c01('0x39')]['offset']);}return _0x3514a0['getConfigurations'](_0x28bfc5);}})[_0x5c01('0x2a')](function(_0x5a44f1){if(_0x5a44f1){return _0x5a44f1?{'count':_0x912102,'rows':_0x5a44f1}:null;}})[_0x5c01('0x2a')](respondWithResult(_0x45df27,null))[_0x5c01('0x4b')](handleError(_0x45df27,null));};exports[_0x5c01('0x56')]=function(_0x4253f0,_0x542725,_0x5a458c){if(_0x4253f0['body']['id']){delete _0x4253f0[_0x5c01('0x50')]['id'];}return db[_0x5c01('0x33')][_0x5c01('0x52')]({'where':{'id':_0x4253f0[_0x5c01('0x4d')]['id']}})[_0x5c01('0x2a')](handleEntityNotFound(_0x542725,null))[_0x5c01('0x2a')](function(_0xdab43a){if(_0xdab43a){_0x4253f0[_0x5c01('0x50')][_0x5c01('0x57')]=_0xdab43a['id'];_0x4253f0[_0x5c01('0x50')][_0x5c01('0x58')]=integrations[_0x5c01('0x59')](_0x4253f0[_0x5c01('0x50')][_0x5c01('0x5a')],_0x4253f0[_0x5c01('0x50')][_0x5c01('0x36')]);_0x4253f0[_0x5c01('0x50')][_0x5c01('0x5b')]=integrations[_0x5c01('0x5c')](_0x4253f0[_0x5c01('0x50')][_0x5c01('0x5a')],_0x4253f0[_0x5c01('0x50')]['type']);return db[_0x5c01('0x53')]['create'](_0x4253f0[_0x5c01('0x50')],{'include':[{'model':db[_0x5c01('0x5d')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x5c01('0x5b')}]});}return null;})[_0x5c01('0x2a')](respondWithResult(_0x542725,null))[_0x5c01('0x4b')](handleError(_0x542725,null));};var md5=require(_0x5c01('0x5e'));exports[_0x5c01('0x5f')]=function(_0x2766c0,_0x30eeb3,_0x438f07){var _0x3ef689=null;var _0x5068fd=null;var _0x449c8c=null;var _0x1b2184=null;var _0xe163c3='';return db[_0x5c01('0x33')]['findOne']({'where':{'id':_0x2766c0['params']['id']},'attributes':['id',_0x5c01('0x2f'),_0x5c01('0x60'),_0x5c01('0x61'),_0x5c01('0x62'),_0x5c01('0x63'),_0x5c01('0x64'),_0x5c01('0x65')]})[_0x5c01('0x2a')](handleEntityNotFound(_0x30eeb3,null))['then'](function(_0xaa3625){if(_0xaa3625){_0x3ef689=_0xaa3625[_0x5c01('0x60')];_0x5068fd=_0xaa3625[_0x5c01('0x65')];_0x449c8c=_0xaa3625['moduleName'];_0xe163c3=_0xaa3625[_0x5c01('0x63')];var _0x3fc311=_0xe163c3['slice'](-0x1);if(_0x3fc311==='/'){_0xe163c3=_0xe163c3['substring'](0x0,_0xe163c3['lastIndexOf'](_0x3fc311));}_0x1b2184=util[_0x5c01('0x66')](_0x5c01('0x67'),_0xe163c3);var _0x4a4ddc={'method':_0x5c01('0x68'),'uri':_0x1b2184,'qs':{'operation':_0x5c01('0x69'),'username':_0xaa3625[_0x5c01('0x60')]},'json':!![]};return rp(_0x4a4ddc);}})['then'](function(_0x4aee6a){if(_0x4aee6a[_0x5c01('0x6a')]){var _0x1794d9={'method':_0x5c01('0x6b'),'uri':_0x1b2184,'form':{'operation':'login','username':_0x3ef689,'accessKey':md5(_0x4aee6a[_0x5c01('0x6c')][_0x5c01('0x6d')]+_0x5068fd)},'json':!![]};return rp(_0x1794d9);}})[_0x5c01('0x2a')](function(_0x2c05d6){if(_0x2c05d6[_0x5c01('0x6a')]){var _0x39dff6={'method':'GET','uri':_0x1b2184,'qs':{'operation':_0x5c01('0x6e'),'username':_0x3ef689,'sessionName':_0x2c05d6['result']['sessionName'],'elementType':_0x449c8c},'json':!![]};return rp(_0x39dff6);}})[_0x5c01('0x2a')](function(_0x33972f){if(_0x33972f[_0x5c01('0x6a')]){var _0x15b2b5=['autogenerated',_0x5c01('0x6f'),'owner'];_['remove'](_0x33972f['result'][_0x5c01('0x3e')],function(_0x3c3aba){return _0x15b2b5[_0x5c01('0x70')](_0x3c3aba[_0x5c01('0x36')][_0x5c01('0x2f')]);});_[_0x5c01('0x71')](_0x33972f[_0x5c01('0x6c')][_0x5c01('0x3e')],function(_0x3ae7cf){return _0x3ae7cf['editable']==='false';});return{'count':_0x33972f['result'][_0x5c01('0x3e')][_0x5c01('0x3f')],'rows':_[_0x5c01('0x32')](_0x33972f[_0x5c01('0x6c')][_0x5c01('0x3e')],function(_0x5bf199){return{'id':_0x5bf199['name'],'name':_0x5bf199[_0x5c01('0x72')],'custom':_[_0x5c01('0x73')](_0x5bf199[_0x5c01('0x2f')],_0x5c01('0x74'))?!![]:![],'options':_0x5bf199[_0x5c01('0x36')]['name']===_0x5c01('0x75')&&_0x5bf199[_0x5c01('0x36')][_0x5c01('0x76')]['length']>0x0?_[_0x5c01('0x32')](_0x5bf199[_0x5c01('0x36')]['picklistValues'],function(_0x176cff){return{'name':_0x176cff[_0x5c01('0x72')],'value':_0x176cff['value']};}):[]};})};}})[_0x5c01('0x2a')](respondWithResult(_0x30eeb3,null))[_0x5c01('0x4b')](function(_0x590139){console[_0x5c01('0x77')](_0x5c01('0x78')+_0x590139);var _0x38aadf=_0x2766c0[_0x5c01('0x39')]['test']?0x1f4:_0x590139[_0x5c01('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x5c01('0x5f'),_0x38aadf,JSON[_0x5c01('0x7a')](_0x590139));delete _0x590139['name'];if(_0x38aadf===0x191){_0x38aadf=0x190;}_0x30eeb3[_0x5c01('0x1f')](_0x38aadf)[_0x5c01('0x30')](_0x2766c0['query'][_0x5c01('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x590139[_0x5c01('0x79')]}:_0x590139);});};
\ No newline at end of file
index 2e91693..f75bad1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd807=['path','rimraf','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x10d24b,_0x2b0995){var _0x3e4669=function(_0x37144f){while(--_0x37144f){_0x10d24b['push'](_0x10d24b['shift']());}};_0x3e4669(++_0x2b0995);}(_0xd807,0x96));var _0x7d80=function(_0xc893e2,_0x1e5774){_0xc893e2=_0xc893e2-0x0;var _0x55da13=_0xd807[_0xc893e2];return _0x55da13;};'use strict';var _=require(_0x7d80('0x0'));var util=require(_0x7d80('0x1'));var logger=require(_0x7d80('0x2'))('api');var moment=require(_0x7d80('0x3'));var BPromise=require(_0x7d80('0x4'));var rp=require(_0x7d80('0x5'));var fs=require('fs');var path=require(_0x7d80('0x6'));var rimraf=require(_0x7d80('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x7d80('0x8'));module[_0x7d80('0x9')]=function(_0x4f60ba,_0xdf0ad8){return _0x4f60ba[_0x7d80('0xa')](_0x7d80('0xb'),attributes,{'tableName':_0x7d80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x19df=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1be763,_0x568b31){var _0x300410=function(_0x5a8d8a){while(--_0x5a8d8a){_0x1be763['push'](_0x1be763['shift']());}};_0x300410(++_0x568b31);}(_0x19df,0x1eb));var _0xf19d=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x19df[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0xf19d('0x0'));var util=require(_0xf19d('0x1'));var logger=require(_0xf19d('0x2'))(_0xf19d('0x3'));var moment=require(_0xf19d('0x4'));var BPromise=require(_0xf19d('0x5'));var rp=require(_0xf19d('0x6'));var fs=require('fs');var path=require(_0xf19d('0x7'));var rimraf=require(_0xf19d('0x8'));var config=require(_0xf19d('0x9'));var attributes=require(_0xf19d('0xa'));var integrations=require(_0xf19d('0xb'));module[_0xf19d('0xc')]=function(_0x423ff3,_0x335cb1){return _0x423ff3[_0xf19d('0xd')](_0xf19d('0xe'),attributes,{'tableName':_0xf19d('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 81f2dde..261b25c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xe205,0xa7));var _0x5e20=function(_0x5f438b,_0xf50a97){_0x5f438b=_0x5f438b-0x0;var _0x2fb15a=_0xe205[_0x5f438b];return _0x2fb15a;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});};
\ No newline at end of file
+var _0xeb74=['attributes','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map'];(function(_0x303fed,_0x5eecd3){var _0x1d9585=function(_0x5ab3b5){while(--_0x5ab3b5){_0x303fed['push'](_0x303fed['shift']());}};_0x1d9585(++_0x5eecd3);}(_0xeb74,0xe3));var _0x4eb7=function(_0x5b97ee,_0x2ef7b9){_0x5b97ee=_0x5b97ee-0x0;var _0xcfd22=_0xeb74[_0x5b97ee];return _0xcfd22;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});}exports[_0x4eb7('0x17')]=function(_0x3b6d41){var _0xf14478=this;return new Promise(function(_0x302e16,_0x44f1b9){return db[_0x4eb7('0x18')][_0x4eb7('0x19')]({'raw':_0x3b6d41['options']?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1c')]||null:null,'attributes':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')]['attributes']||null:null,'limit':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1d')]||null:null,'include':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1e')],function(_0x13e871){return{'model':db[_0x13e871['model']],'as':_0x13e871['as'],'attributes':_0x13e871[_0x4eb7('0x20')],'include':_0x13e871[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x13e871[_0x4eb7('0x1e')],function(_0x3e0da2){return{'model':db[_0x3e0da2[_0x4eb7('0x21')]],'as':_0x3e0da2['as'],'attributes':_0x3e0da2[_0x4eb7('0x20')],'include':_0x3e0da2[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x3e0da2[_0x4eb7('0x1e')],function(_0xf83c11){return{'model':db[_0xf83c11[_0x4eb7('0x21')]],'as':_0xf83c11['as'],'attributes':_0xf83c11[_0x4eb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4eb7('0xc')](function(_0x433794){logger[_0x4eb7('0x14')](_0x4eb7('0x17'),_0x3b6d41);logger[_0x4eb7('0xe')](_0x4eb7('0x17'),_0x3b6d41,JSON[_0x4eb7('0x22')](_0x433794));_0x302e16(_0x433794);})[_0x4eb7('0x16')](function(_0x17030a){logger[_0x4eb7('0x11')]('GetVtigerAccount',_0x17030a[_0x4eb7('0x13')],_0x3b6d41);_0x44f1b9(_0xf14478['error'](0x1f4,_0x17030a[_0x4eb7('0x13')]));});});};exports[_0x4eb7('0x23')]=function(_0xc5aa21){var _0x1fe298=this;return new Promise(function(_0x468195,_0x1cec8e){return db[_0x4eb7('0x18')][_0x4eb7('0x24')]({'raw':_0xc5aa21[_0x4eb7('0x1a')]?_0xc5aa21['options'][_0x4eb7('0x1b')]===undefined?!![]:![]:!![],'where':_0xc5aa21['options']?_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1c')]||null:null,'attributes':_0xc5aa21['options']?_0xc5aa21['options'][_0x4eb7('0x20')]||null:null,'include':_0xc5aa21[_0x4eb7('0x1a')]?_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1e')]?_['map'](_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1e')],function(_0xcc9bb4){return{'model':db[_0xcc9bb4[_0x4eb7('0x21')]],'as':_0xcc9bb4['as'],'attributes':_0xcc9bb4[_0x4eb7('0x20')],'include':_0xcc9bb4['include']?_[_0x4eb7('0x1f')](_0xcc9bb4[_0x4eb7('0x1e')],function(_0x31cc6d){return{'model':db[_0x31cc6d['model']],'as':_0x31cc6d['as'],'attributes':_0x31cc6d[_0x4eb7('0x20')],'include':_0x31cc6d[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x31cc6d['include'],function(_0x70f2b2){return{'model':db[_0x70f2b2['model']],'as':_0x70f2b2['as'],'attributes':_0x70f2b2[_0x4eb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4eb7('0xc')](function(_0x392fa3){logger[_0x4eb7('0x14')]('ShowVtigerAccount',_0xc5aa21);logger[_0x4eb7('0xe')](_0x4eb7('0x23'),_0xc5aa21,JSON[_0x4eb7('0x22')](_0x392fa3));_0x468195(_0x392fa3);})[_0x4eb7('0x16')](function(_0x4f0cce){logger['error']('ShowVtigerAccount',_0x4f0cce[_0x4eb7('0x13')],_0xc5aa21);_0x1cec8e(_0x1fe298[_0x4eb7('0x11')](0x1f4,_0x4f0cce[_0x4eb7('0x13')]));});});};
\ No newline at end of file
index 56ae0c6..c4f591a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f3e=['put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x8f3e,0xca));var _0xe8f3=function(_0x1b3b2e,_0x3501b4){_0x1b3b2e=_0x1b3b2e-0x0;var _0x10b6dd=_0x8f3e[_0x1b3b2e];return _0x10b6dd;};'use strict';var multer=require(_0xe8f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe8f3('0x1'));var express=require(_0xe8f3('0x2'));var router=express[_0xe8f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe8f3('0x4'));var interaction=require(_0xe8f3('0x5'));var config=require(_0xe8f3('0x6'));var controller=require(_0xe8f3('0x7'));router[_0xe8f3('0x8')]('/',auth[_0xe8f3('0x9')](),controller[_0xe8f3('0xa')]);router['get'](_0xe8f3('0xb'),auth[_0xe8f3('0x9')](),controller[_0xe8f3('0xc')]);router['get']('/:id/fields',auth[_0xe8f3('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xe8f3('0x9')](),controller[_0xe8f3('0xd')]);router[_0xe8f3('0x8')](_0xe8f3('0xe'),auth[_0xe8f3('0x9')](),controller[_0xe8f3('0xf')]);router[_0xe8f3('0x10')]('/',auth[_0xe8f3('0x9')](),controller[_0xe8f3('0x11')]);router[_0xe8f3('0x12')]('/:id',auth[_0xe8f3('0x9')](),controller[_0xe8f3('0x13')]);router['delete'](_0xe8f3('0xb'),auth[_0xe8f3('0x9')](),controller[_0xe8f3('0x14')]);module[_0xe8f3('0x15')]=router;
\ No newline at end of file
+var _0xd343=['post','create','put','update','exports','util','path','connect-timeout','express','../../components/auth/service','./intVtigerConfiguration.controller','isAuthenticated','/:id','show','get','getFields','/:id/descriptions','getDescriptions'];(function(_0x5a7db4,_0x1a512b){var _0x3c18f1=function(_0x4d3faf){while(--_0x4d3faf){_0x5a7db4['push'](_0x5a7db4['shift']());}};_0x3c18f1(++_0x1a512b);}(_0xd343,0x1d9));var _0x3d34=function(_0x273efe,_0x1af253){_0x273efe=_0x273efe-0x0;var _0x163b9e=_0xd343[_0x273efe];return _0x163b9e;};'use strict';var multer=require('multer');var util=require(_0x3d34('0x0'));var path=require(_0x3d34('0x1'));var timeout=require(_0x3d34('0x2'));var express=require(_0x3d34('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d34('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d34('0x5'));router['get']('/',auth[_0x3d34('0x6')](),controller['index']);router['get'](_0x3d34('0x7'),auth[_0x3d34('0x6')](),controller[_0x3d34('0x8')]);router[_0x3d34('0x9')]('/:id/fields',auth[_0x3d34('0x6')](),controller[_0x3d34('0xa')]);router[_0x3d34('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x3d34('0x9')](_0x3d34('0xb'),auth['isAuthenticated'](),controller[_0x3d34('0xc')]);router[_0x3d34('0xd')]('/',auth[_0x3d34('0x6')](),controller[_0x3d34('0xe')]);router[_0x3d34('0xf')]('/:id',auth[_0x3d34('0x6')](),controller[_0x3d34('0x10')]);router['delete']('/:id',auth[_0x3d34('0x6')](),controller['destroy']);module[_0x3d34('0x11')]=router;
\ No newline at end of file
index 91ef0bb..8c3fe2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd096=['STRING','sequelize','exports'];(function(_0xd16df9,_0x18db96){var _0x141b04=function(_0x5f44ad){while(--_0x5f44ad){_0xd16df9['push'](_0xd16df9['shift']());}};_0x141b04(++_0x18db96);}(_0xd096,0x166));var _0x6d09=function(_0x44b3fb,_0x51b59c){_0x44b3fb=_0x44b3fb-0x0;var _0x2fd070=_0xd096[_0x44b3fb];return _0x2fd070;};'use strict';var Sequelize=require(_0x6d09('0x0'));module[_0x6d09('0x1')]={'name':{'type':Sequelize[_0x6d09('0x2')]},'description':{'type':Sequelize[_0x6d09('0x2')]}};
\ No newline at end of file
+var _0xcfa2=['STRING','sequelize'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xcfa2,0xdd));var _0x2cfa=function(_0x2c1a0d,_0x367236){_0x2c1a0d=_0x2c1a0d-0x0;var _0x187a70=_0xcfa2[_0x2c1a0d];return _0x187a70;};'use strict';var Sequelize=require(_0x2cfa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2cfa('0x1')]}};
\ No newline at end of file
index ad8907b..6d8eced 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x588f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','nolimit','getDescriptions','VtigerField','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x588f,0x194));var _0xf588=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x588f[_0xf26d40];return _0x50b68c;};'use strict';var emlformat=require(_0xf588('0x0'));var rimraf=require(_0xf588('0x1'));var zipdir=require(_0xf588('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf588('0x3'));var moment=require('moment');var BPromise=require(_0xf588('0x4'));var Mustache=require(_0xf588('0x5'));var util=require(_0xf588('0x6'));var path=require(_0xf588('0x7'));var sox=require(_0xf588('0x8'));var csv=require(_0xf588('0x9'));var ejs=require(_0xf588('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf588('0xb'));var squel=require(_0xf588('0xc'));var crypto=require(_0xf588('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf588('0x9'));var querystring=require(_0xf588('0xe'));var Papa=require('papaparse');var Redis=require(_0xf588('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf588('0x10'));var as=require(_0xf588('0x11'));var hardwareService=require(_0xf588('0x12'));var logger=require(_0xf588('0x13'))(_0xf588('0x14'));var utils=require(_0xf588('0x15'));var config=require(_0xf588('0x16'));var licenseUtil=require(_0xf588('0x17'));var db=require(_0xf588('0x18'))['db'];function respondWithStatusCode(_0x490786,_0x3fecd9){_0x3fecd9=_0x3fecd9||0xcc;return function(_0x60dfa0){if(_0x60dfa0){return _0x490786['sendStatus'](_0x3fecd9);}return _0x490786[_0xf588('0x19')](_0x3fecd9)[_0xf588('0x1a')]();};}function respondWithResult(_0x40bc93,_0x5a20b){_0x5a20b=_0x5a20b||0xc8;return function(_0x37eed7){if(_0x37eed7){return _0x40bc93[_0xf588('0x19')](_0x5a20b)[_0xf588('0x1b')](_0x37eed7);}};}function respondWithFilteredResult(_0x47f959,_0x4ec945){return function(_0x16dea0){if(_0x16dea0){var _0x4f7d57=typeof _0x4ec945['offset']===_0xf588('0x1c')&&typeof _0x4ec945['limit']==='undefined';var _0x3fa21f=_0x16dea0['count'];var _0x5eda34=_0x4f7d57?0x0:_0x4ec945[_0xf588('0x1d')];var _0x2f4697=_0x4f7d57?_0x16dea0[_0xf588('0x1e')]:_0x4ec945[_0xf588('0x1d')]+_0x4ec945[_0xf588('0x1f')];var _0x1144cd;if(_0x2f4697>=_0x3fa21f){_0x2f4697=_0x3fa21f;_0x1144cd=0xc8;}else{_0x1144cd=0xce;}_0x47f959[_0xf588('0x19')](_0x1144cd);return _0x47f959[_0xf588('0x20')](_0xf588('0x21'),_0x5eda34+'-'+_0x2f4697+'/'+_0x3fa21f)[_0xf588('0x1b')](_0x16dea0);}return null;};}function patchUpdates(_0x57431d){return function(_0x5619bf){try{jsonpatch[_0xf588('0x22')](_0x5619bf,_0x57431d,!![]);}catch(_0x4e27b5){return BPromise[_0xf588('0x23')](_0x4e27b5);}return _0x5619bf[_0xf588('0x24')]();};}function saveUpdates(_0xcc230c,_0x4efb55){return function(_0x3ea065){if(_0x3ea065){return _0x3ea065[_0xf588('0x25')](_0xcc230c)[_0xf588('0x26')](function(_0x3a5a7d){return _0x3a5a7d;});}return null;};}function removeEntity(_0x28ac2a,_0x1fcd7f){return function(_0x27c6fc){if(_0x27c6fc){return _0x27c6fc[_0xf588('0x27')]()[_0xf588('0x26')](function(){_0x28ac2a[_0xf588('0x19')](0xcc)[_0xf588('0x1a')]();});}};}function handleEntityNotFound(_0x48579b,_0xc77b4c){return function(_0x41eac5){if(!_0x41eac5){_0x48579b[_0xf588('0x28')](0x194);}return _0x41eac5;};}function handleError(_0x32e9be,_0x59117f){_0x59117f=_0x59117f||0x1f4;return function(_0x5d222d){logger[_0xf588('0x29')](_0x5d222d[_0xf588('0x2a')]);if(_0x5d222d[_0xf588('0x2b')]){delete _0x5d222d[_0xf588('0x2b')];}_0x32e9be['status'](_0x59117f)[_0xf588('0x2c')](_0x5d222d);};}exports[_0xf588('0x2d')]=function(_0x23c2fb,_0x2d2a55){var _0x6e5b4={},_0x17cece={},_0x2dfb10={'count':0x0,'rows':[]};var _0x181bc2=_[_0xf588('0x2e')](db[_0xf588('0x2f')][_0xf588('0x30')],function(_0x5adc34){return{'name':_0x5adc34[_0xf588('0x31')],'type':_0x5adc34[_0xf588('0x32')][_0xf588('0x33')]};});_0x17cece[_0xf588('0x34')]=_[_0xf588('0x2e')](_0x181bc2,'name');_0x17cece['query']=_[_0xf588('0x35')](_0x23c2fb['query']);_0x17cece[_0xf588('0x36')]=_[_0xf588('0x37')](_0x17cece[_0xf588('0x34')],_0x17cece[_0xf588('0x38')]);_0x6e5b4[_0xf588('0x39')]=_[_0xf588('0x37')](_0x17cece[_0xf588('0x34')],qs[_0xf588('0x3a')](_0x23c2fb[_0xf588('0x38')][_0xf588('0x3a')]));_0x6e5b4[_0xf588('0x39')]=_0x6e5b4[_0xf588('0x39')][_0xf588('0x3b')]?_0x6e5b4[_0xf588('0x39')]:_0x17cece['model'];if(!_0x23c2fb[_0xf588('0x38')]['hasOwnProperty']('nolimit')){_0x6e5b4['limit']=qs['limit'](_0x23c2fb[_0xf588('0x38')][_0xf588('0x1f')]);_0x6e5b4[_0xf588('0x1d')]=qs[_0xf588('0x1d')](_0x23c2fb[_0xf588('0x38')][_0xf588('0x1d')]);}_0x6e5b4[_0xf588('0x3c')]=qs[_0xf588('0x3d')](_0x23c2fb[_0xf588('0x38')][_0xf588('0x3d')]);_0x6e5b4['where']=qs[_0xf588('0x36')](_[_0xf588('0x3e')](_0x23c2fb[_0xf588('0x38')],_0x17cece[_0xf588('0x36')]),_0x181bc2);if(_0x23c2fb[_0xf588('0x38')][_0xf588('0x3f')]){_0x6e5b4[_0xf588('0x40')]=_[_0xf588('0x41')](_0x6e5b4[_0xf588('0x40')],{'$or':_[_0xf588('0x2e')](_0x181bc2,function(_0x1ba73a){if(_0x1ba73a['type']!==_0xf588('0x42')){var _0x2e32d6={};_0x2e32d6[_0x1ba73a[_0xf588('0x2b')]]={'$like':'%'+_0x23c2fb['query'][_0xf588('0x3f')]+'%'};return _0x2e32d6;}})});}_0x6e5b4=_['merge']({},_0x6e5b4,_0x23c2fb['options']);var _0x2a9aac={'where':_0x6e5b4['where']};return db[_0xf588('0x2f')][_0xf588('0x1e')](_0x2a9aac)[_0xf588('0x26')](function(_0x311f8a){_0x2dfb10[_0xf588('0x1e')]=_0x311f8a;if(_0x23c2fb['query']['includeAll']){_0x6e5b4[_0xf588('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xf588('0x44')](_0x6e5b4);})['then'](function(_0x443474){_0x2dfb10[_0xf588('0x45')]=_0x443474;return _0x2dfb10;})['then'](respondWithFilteredResult(_0x2d2a55,_0x6e5b4))[_0xf588('0x46')](handleError(_0x2d2a55,null));};exports['show']=function(_0x5aa3ad,_0x233a81){var _0x5ea801={'raw':![],'where':{'id':_0x5aa3ad[_0xf588('0x47')]['id']}},_0x4615c7={};_0x4615c7['model']=_['keys'](db['VtigerConfiguration'][_0xf588('0x30')]);_0x4615c7[_0xf588('0x38')]=_['keys'](_0x5aa3ad[_0xf588('0x38')]);_0x4615c7[_0xf588('0x36')]=_['intersection'](_0x4615c7[_0xf588('0x34')],_0x4615c7[_0xf588('0x38')]);_0x5ea801[_0xf588('0x39')]=_['intersection'](_0x4615c7[_0xf588('0x34')],qs['fields'](_0x5aa3ad[_0xf588('0x38')][_0xf588('0x3a')]));_0x5ea801[_0xf588('0x39')]=_0x5ea801[_0xf588('0x39')][_0xf588('0x3b')]?_0x5ea801['attributes']:_0x4615c7[_0xf588('0x34')];if(_0x5aa3ad['query'][_0xf588('0x48')]){_0x5ea801['include']=[{'all':!![]}];}_0x5ea801=_[_0xf588('0x41')]({},_0x5ea801,_0x5aa3ad[_0xf588('0x49')]);return db[_0xf588('0x2f')][_0xf588('0x4a')](_0x5ea801)[_0xf588('0x26')](handleEntityNotFound(_0x233a81,null))[_0xf588('0x26')](respondWithResult(_0x233a81,null))[_0xf588('0x46')](handleError(_0x233a81,null));};exports[_0xf588('0x4b')]=function(_0x2fc543,_0x210fb6){return db[_0xf588('0x2f')][_0xf588('0x4b')](_0x2fc543[_0xf588('0x4c')],{})[_0xf588('0x26')](respondWithResult(_0x210fb6,0xc9))[_0xf588('0x46')](handleError(_0x210fb6,null));};exports[_0xf588('0x25')]=function(_0x2ada7b,_0x3e6c38){if(_0x2ada7b[_0xf588('0x4c')]['id']){delete _0x2ada7b['body']['id'];}return db[_0xf588('0x2f')][_0xf588('0x4a')]({'where':{'id':_0x2ada7b[_0xf588('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e6c38,null))[_0xf588('0x26')](saveUpdates(_0x2ada7b['body'],null))['then'](respondWithResult(_0x3e6c38,null))[_0xf588('0x46')](handleError(_0x3e6c38,null));};exports[_0xf588('0x27')]=function(_0x3a2b34,_0x218987){return db['VtigerConfiguration'][_0xf588('0x4a')]({'where':{'id':_0x3a2b34[_0xf588('0x47')]['id']}})['then'](handleEntityNotFound(_0x218987,null))['then'](removeEntity(_0x218987,null))[_0xf588('0x46')](handleError(_0x218987,null));};exports[_0xf588('0x4d')]=function(_0x144923,_0x7da08a,_0x300156){var _0x2065a8={};var _0x3bfb7d={};var _0xca8eb9;var _0x1bd111;return db[_0xf588('0x2f')][_0xf588('0x4e')]({'where':{'id':_0x144923[_0xf588('0x47')]['id']}})['then'](handleEntityNotFound(_0x7da08a,null))['then'](function(_0x35fe50){if(_0x35fe50){_0xca8eb9=_0x35fe50;_0x3bfb7d[_0xf588('0x34')]=_['keys'](db['VtigerField'][_0xf588('0x30')]);_0x3bfb7d[_0xf588('0x38')]=_[_0xf588('0x35')](_0x144923['query']);_0x3bfb7d[_0xf588('0x36')]=_[_0xf588('0x37')](_0x3bfb7d[_0xf588('0x34')],_0x3bfb7d['query']);_0x2065a8[_0xf588('0x39')]=_[_0xf588('0x37')](_0x3bfb7d[_0xf588('0x34')],qs[_0xf588('0x3a')](_0x144923['query'][_0xf588('0x3a')]));_0x2065a8[_0xf588('0x39')]=_0x2065a8[_0xf588('0x39')]['length']?_0x2065a8[_0xf588('0x39')]:_0x3bfb7d[_0xf588('0x34')];_0x2065a8[_0xf588('0x3c')]=qs[_0xf588('0x3d')](_0x144923[_0xf588('0x38')]['sort']);_0x2065a8[_0xf588('0x40')]=qs['filters'](_[_0xf588('0x3e')](_0x144923[_0xf588('0x38')],_0x3bfb7d[_0xf588('0x36')]));if(_0x144923[_0xf588('0x38')]['filter']){_0x2065a8['where']=_['merge'](_0x2065a8[_0xf588('0x40')],{'$or':_[_0xf588('0x2e')](_0x2065a8[_0xf588('0x39')],function(_0x4bfd80){var _0x2dbce8={};_0x2dbce8[_0x4bfd80]={'$like':'%'+_0x144923[_0xf588('0x38')]['filter']+'%'};return _0x2dbce8;})});}_0x2065a8=_[_0xf588('0x41')]({},_0x2065a8,_0x144923[_0xf588('0x49')]);return _0xca8eb9[_0xf588('0x4d')](_0x2065a8);}})['then'](function(_0x18b20f){if(_0x18b20f){_0x1bd111=_0x18b20f[_0xf588('0x3b')];if(!_0x144923[_0xf588('0x38')][_0xf588('0x4f')]('nolimit')){_0x2065a8[_0xf588('0x1f')]=qs[_0xf588('0x1f')](_0x144923['query'][_0xf588('0x1f')]);_0x2065a8[_0xf588('0x1d')]=qs['offset'](_0x144923['query'][_0xf588('0x1d')]);}return _0xca8eb9[_0xf588('0x4d')](_0x2065a8);}})[_0xf588('0x26')](function(_0x202a43){if(_0x202a43){return _0x202a43?{'count':_0x1bd111,'rows':_0x202a43}:null;}})[_0xf588('0x26')](respondWithResult(_0x7da08a,null))[_0xf588('0x46')](handleError(_0x7da08a,null));};exports[_0xf588('0x50')]=function(_0x3e664a,_0x279b51,_0x7aaabc){var _0x52a463={};var _0xfdae7={};var _0x46e3d4;var _0x53462e;return db[_0xf588('0x2f')][_0xf588('0x4e')]({'where':{'id':_0x3e664a[_0xf588('0x47')]['id']}})[_0xf588('0x26')](handleEntityNotFound(_0x279b51,null))[_0xf588('0x26')](function(_0x2a48a8){if(_0x2a48a8){_0x46e3d4=_0x2a48a8;_0xfdae7[_0xf588('0x34')]=_[_0xf588('0x35')](db['VtigerField'][_0xf588('0x30')]);_0xfdae7['query']=_[_0xf588('0x35')](_0x3e664a[_0xf588('0x38')]);_0xfdae7[_0xf588('0x36')]=_['intersection'](_0xfdae7[_0xf588('0x34')],_0xfdae7['query']);_0x52a463[_0xf588('0x39')]=_[_0xf588('0x37')](_0xfdae7['model'],qs[_0xf588('0x3a')](_0x3e664a[_0xf588('0x38')][_0xf588('0x3a')]));_0x52a463[_0xf588('0x39')]=_0x52a463['attributes'][_0xf588('0x3b')]?_0x52a463[_0xf588('0x39')]:_0xfdae7[_0xf588('0x34')];_0x52a463[_0xf588('0x3c')]=qs[_0xf588('0x3d')](_0x3e664a['query']['sort']);_0x52a463['where']=qs[_0xf588('0x36')](_[_0xf588('0x3e')](_0x3e664a['query'],_0xfdae7[_0xf588('0x36')]));if(_0x3e664a[_0xf588('0x38')][_0xf588('0x3f')]){_0x52a463[_0xf588('0x40')]=_[_0xf588('0x41')](_0x52a463[_0xf588('0x40')],{'$or':_['map'](_0x52a463[_0xf588('0x39')],function(_0xe1f580){var _0x41237c={};_0x41237c[_0xe1f580]={'$like':'%'+_0x3e664a[_0xf588('0x38')][_0xf588('0x3f')]+'%'};return _0x41237c;})});}_0x52a463=_[_0xf588('0x41')]({},_0x52a463,_0x3e664a['options']);return _0x46e3d4['getSubjects'](_0x52a463);}})[_0xf588('0x26')](function(_0x420e77){if(_0x420e77){_0x53462e=_0x420e77[_0xf588('0x3b')];if(!_0x3e664a['query'][_0xf588('0x4f')](_0xf588('0x51'))){_0x52a463['limit']=qs[_0xf588('0x1f')](_0x3e664a[_0xf588('0x38')][_0xf588('0x1f')]);_0x52a463[_0xf588('0x1d')]=qs['offset'](_0x3e664a[_0xf588('0x38')][_0xf588('0x1d')]);}return _0x46e3d4[_0xf588('0x50')](_0x52a463);}})[_0xf588('0x26')](function(_0x225675){if(_0x225675){return _0x225675?{'count':_0x53462e,'rows':_0x225675}:null;}})[_0xf588('0x26')](respondWithResult(_0x279b51,null))[_0xf588('0x46')](handleError(_0x279b51,null));};exports[_0xf588('0x52')]=function(_0x36a6df,_0x29f15c,_0x16a2dc){var _0x4276b2={};var _0x37e364={};var _0xee7257;var _0x1c31df;return db[_0xf588('0x2f')]['findOne']({'where':{'id':_0x36a6df[_0xf588('0x47')]['id']}})[_0xf588('0x26')](handleEntityNotFound(_0x29f15c,null))['then'](function(_0x58a170){if(_0x58a170){_0xee7257=_0x58a170;_0x37e364['model']=_[_0xf588('0x35')](db[_0xf588('0x53')][_0xf588('0x30')]);_0x37e364['query']=_[_0xf588('0x35')](_0x36a6df[_0xf588('0x38')]);_0x37e364['filters']=_[_0xf588('0x37')](_0x37e364[_0xf588('0x34')],_0x37e364['query']);_0x4276b2['attributes']=_['intersection'](_0x37e364[_0xf588('0x34')],qs['fields'](_0x36a6df[_0xf588('0x38')][_0xf588('0x3a')]));_0x4276b2[_0xf588('0x39')]=_0x4276b2[_0xf588('0x39')]['length']?_0x4276b2[_0xf588('0x39')]:_0x37e364['model'];_0x4276b2[_0xf588('0x3c')]=qs[_0xf588('0x3d')](_0x36a6df[_0xf588('0x38')]['sort']);_0x4276b2['where']=qs[_0xf588('0x36')](_[_0xf588('0x3e')](_0x36a6df[_0xf588('0x38')],_0x37e364[_0xf588('0x36')]));if(_0x36a6df[_0xf588('0x38')][_0xf588('0x3f')]){_0x4276b2[_0xf588('0x40')]=_[_0xf588('0x41')](_0x4276b2[_0xf588('0x40')],{'$or':_[_0xf588('0x2e')](_0x4276b2['attributes'],function(_0x457185){var _0x17531d={};_0x17531d[_0x457185]={'$like':'%'+_0x36a6df[_0xf588('0x38')][_0xf588('0x3f')]+'%'};return _0x17531d;})});}_0x4276b2=_[_0xf588('0x41')]({},_0x4276b2,_0x36a6df[_0xf588('0x49')]);return _0xee7257['getDescriptions'](_0x4276b2);}})[_0xf588('0x26')](function(_0x21493a){if(_0x21493a){_0x1c31df=_0x21493a[_0xf588('0x3b')];if(!_0x36a6df[_0xf588('0x38')]['hasOwnProperty']('nolimit')){_0x4276b2[_0xf588('0x1f')]=qs['limit'](_0x36a6df[_0xf588('0x38')]['limit']);_0x4276b2[_0xf588('0x1d')]=qs[_0xf588('0x1d')](_0x36a6df[_0xf588('0x38')]['offset']);}return _0xee7257[_0xf588('0x52')](_0x4276b2);}})[_0xf588('0x26')](function(_0x465f12){if(_0x465f12){return _0x465f12?{'count':_0x1c31df,'rows':_0x465f12}:null;}})[_0xf588('0x26')](respondWithResult(_0x29f15c,null))[_0xf588('0x46')](handleError(_0x29f15c,null));};
\ No newline at end of file
+var _0x89b5=['update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','save'];(function(_0x5eb9c1,_0x477c4b){var _0x371df6=function(_0x360e73){while(--_0x360e73){_0x5eb9c1['push'](_0x5eb9c1['shift']());}};_0x371df6(++_0x477c4b);}(_0x89b5,0x16d));var _0x589b=function(_0x193661,_0x35603a){_0x193661=_0x193661-0x0;var _0x5913e7=_0x89b5[_0x193661];return _0x5913e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x589b('0x0'));var zipdir=require(_0x589b('0x1'));var jsonpatch=require(_0x589b('0x2'));var rp=require(_0x589b('0x3'));var moment=require('moment');var BPromise=require(_0x589b('0x4'));var Mustache=require(_0x589b('0x5'));var util=require(_0x589b('0x6'));var path=require(_0x589b('0x7'));var sox=require(_0x589b('0x8'));var csv=require(_0x589b('0x9'));var ejs=require(_0x589b('0xa'));var fs=require('fs');var fs_extra=require(_0x589b('0xb'));var _=require(_0x589b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x589b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x589b('0x9'));var querystring=require(_0x589b('0xe'));var Papa=require(_0x589b('0xf'));var Redis=require('ioredis');var authService=require(_0x589b('0x10'));var qs=require(_0x589b('0x11'));var as=require(_0x589b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x589b('0x13'))('api');var utils=require(_0x589b('0x14'));var config=require(_0x589b('0x15'));var licenseUtil=require(_0x589b('0x16'));var db=require(_0x589b('0x17'))['db'];function respondWithStatusCode(_0x299757,_0x1a4384){_0x1a4384=_0x1a4384||0xcc;return function(_0x5c26d3){if(_0x5c26d3){return _0x299757[_0x589b('0x18')](_0x1a4384);}return _0x299757['status'](_0x1a4384)[_0x589b('0x19')]();};}function respondWithResult(_0x2fb807,_0x570a73){_0x570a73=_0x570a73||0xc8;return function(_0x2eaa6c){if(_0x2eaa6c){return _0x2fb807[_0x589b('0x1a')](_0x570a73)[_0x589b('0x1b')](_0x2eaa6c);}};}function respondWithFilteredResult(_0x21bb30,_0x2288a5){return function(_0x32529b){if(_0x32529b){var _0x381179=typeof _0x2288a5['offset']===_0x589b('0x1c')&&typeof _0x2288a5['limit']===_0x589b('0x1c');var _0x4739c9=_0x32529b[_0x589b('0x1d')];var _0x37c74b=_0x381179?0x0:_0x2288a5[_0x589b('0x1e')];var _0x4b7cde=_0x381179?_0x32529b[_0x589b('0x1d')]:_0x2288a5['offset']+_0x2288a5[_0x589b('0x1f')];var _0x578a8d;if(_0x4b7cde>=_0x4739c9){_0x4b7cde=_0x4739c9;_0x578a8d=0xc8;}else{_0x578a8d=0xce;}_0x21bb30[_0x589b('0x1a')](_0x578a8d);return _0x21bb30[_0x589b('0x20')]('Content-Range',_0x37c74b+'-'+_0x4b7cde+'/'+_0x4739c9)[_0x589b('0x1b')](_0x32529b);}return null;};}function patchUpdates(_0x535099){return function(_0x5d580c){try{jsonpatch[_0x589b('0x21')](_0x5d580c,_0x535099,!![]);}catch(_0x44ed3a){return BPromise['reject'](_0x44ed3a);}return _0x5d580c[_0x589b('0x22')]();};}function saveUpdates(_0x231e75,_0x46e182){return function(_0xe9d43c){if(_0xe9d43c){return _0xe9d43c[_0x589b('0x23')](_0x231e75)['then'](function(_0x40c953){return _0x40c953;});}return null;};}function removeEntity(_0x2cba4f,_0x397030){return function(_0x4ca37b){if(_0x4ca37b){return _0x4ca37b['destroy']()[_0x589b('0x24')](function(){_0x2cba4f[_0x589b('0x1a')](0xcc)[_0x589b('0x19')]();});}};}function handleEntityNotFound(_0x389fd2,_0x15f11e){return function(_0x324e90){if(!_0x324e90){_0x389fd2[_0x589b('0x18')](0x194);}return _0x324e90;};}function handleError(_0x576ab1,_0x270777){_0x270777=_0x270777||0x1f4;return function(_0x483c47){logger[_0x589b('0x25')](_0x483c47[_0x589b('0x26')]);if(_0x483c47[_0x589b('0x27')]){delete _0x483c47['name'];}_0x576ab1['status'](_0x270777)[_0x589b('0x28')](_0x483c47);};}exports[_0x589b('0x29')]=function(_0x3aee92,_0x564ff1){var _0x2e76cf={},_0x462553={},_0x2b8bce={'count':0x0,'rows':[]};var _0xa1d1bf=_[_0x589b('0x2a')](db[_0x589b('0x2b')][_0x589b('0x2c')],function(_0x469efe){return{'name':_0x469efe['fieldName'],'type':_0x469efe[_0x589b('0x2d')]['key']};});_0x462553['model']=_[_0x589b('0x2a')](_0xa1d1bf,_0x589b('0x27'));_0x462553[_0x589b('0x2e')]=_['keys'](_0x3aee92[_0x589b('0x2e')]);_0x462553[_0x589b('0x2f')]=_[_0x589b('0x30')](_0x462553[_0x589b('0x31')],_0x462553[_0x589b('0x2e')]);_0x2e76cf[_0x589b('0x32')]=_['intersection'](_0x462553[_0x589b('0x31')],qs[_0x589b('0x33')](_0x3aee92[_0x589b('0x2e')][_0x589b('0x33')]));_0x2e76cf[_0x589b('0x32')]=_0x2e76cf[_0x589b('0x32')][_0x589b('0x34')]?_0x2e76cf['attributes']:_0x462553[_0x589b('0x31')];if(!_0x3aee92[_0x589b('0x2e')][_0x589b('0x35')](_0x589b('0x36'))){_0x2e76cf[_0x589b('0x1f')]=qs[_0x589b('0x1f')](_0x3aee92[_0x589b('0x2e')][_0x589b('0x1f')]);_0x2e76cf[_0x589b('0x1e')]=qs[_0x589b('0x1e')](_0x3aee92[_0x589b('0x2e')][_0x589b('0x1e')]);}_0x2e76cf[_0x589b('0x37')]=qs[_0x589b('0x38')](_0x3aee92[_0x589b('0x2e')][_0x589b('0x38')]);_0x2e76cf[_0x589b('0x39')]=qs[_0x589b('0x2f')](_[_0x589b('0x3a')](_0x3aee92[_0x589b('0x2e')],_0x462553[_0x589b('0x2f')]),_0xa1d1bf);if(_0x3aee92['query'][_0x589b('0x3b')]){_0x2e76cf['where']=_[_0x589b('0x3c')](_0x2e76cf[_0x589b('0x39')],{'$or':_[_0x589b('0x2a')](_0xa1d1bf,function(_0x1e3de6){if(_0x1e3de6[_0x589b('0x2d')]!==_0x589b('0x3d')){var _0x3c48f9={};_0x3c48f9[_0x1e3de6['name']]={'$like':'%'+_0x3aee92['query'][_0x589b('0x3b')]+'%'};return _0x3c48f9;}})});}_0x2e76cf=_[_0x589b('0x3c')]({},_0x2e76cf,_0x3aee92[_0x589b('0x3e')]);var _0xa71b09={'where':_0x2e76cf[_0x589b('0x39')]};return db['VtigerConfiguration']['count'](_0xa71b09)[_0x589b('0x24')](function(_0xda3e97){_0x2b8bce[_0x589b('0x1d')]=_0xda3e97;if(_0x3aee92[_0x589b('0x2e')][_0x589b('0x3f')]){_0x2e76cf['include']=[{'all':!![]}];}return db[_0x589b('0x2b')][_0x589b('0x40')](_0x2e76cf);})[_0x589b('0x24')](function(_0x49730e){_0x2b8bce[_0x589b('0x41')]=_0x49730e;return _0x2b8bce;})[_0x589b('0x24')](respondWithFilteredResult(_0x564ff1,_0x2e76cf))[_0x589b('0x42')](handleError(_0x564ff1,null));};exports[_0x589b('0x43')]=function(_0x17f947,_0x255aa8){var _0x1d9c42={'raw':![],'where':{'id':_0x17f947['params']['id']}},_0x423147={};_0x423147[_0x589b('0x31')]=_['keys'](db[_0x589b('0x2b')][_0x589b('0x2c')]);_0x423147[_0x589b('0x2e')]=_[_0x589b('0x44')](_0x17f947['query']);_0x423147[_0x589b('0x2f')]=_[_0x589b('0x30')](_0x423147['model'],_0x423147[_0x589b('0x2e')]);_0x1d9c42[_0x589b('0x32')]=_['intersection'](_0x423147['model'],qs['fields'](_0x17f947[_0x589b('0x2e')][_0x589b('0x33')]));_0x1d9c42[_0x589b('0x32')]=_0x1d9c42[_0x589b('0x32')][_0x589b('0x34')]?_0x1d9c42[_0x589b('0x32')]:_0x423147[_0x589b('0x31')];if(_0x17f947[_0x589b('0x2e')]['includeAll']){_0x1d9c42[_0x589b('0x45')]=[{'all':!![]}];}_0x1d9c42=_[_0x589b('0x3c')]({},_0x1d9c42,_0x17f947[_0x589b('0x3e')]);return db[_0x589b('0x2b')][_0x589b('0x46')](_0x1d9c42)[_0x589b('0x24')](handleEntityNotFound(_0x255aa8,null))[_0x589b('0x24')](respondWithResult(_0x255aa8,null))['catch'](handleError(_0x255aa8,null));};exports[_0x589b('0x47')]=function(_0x183a0f,_0x3f2dd){return db[_0x589b('0x2b')][_0x589b('0x47')](_0x183a0f[_0x589b('0x48')],{})[_0x589b('0x24')](respondWithResult(_0x3f2dd,0xc9))[_0x589b('0x42')](handleError(_0x3f2dd,null));};exports[_0x589b('0x23')]=function(_0x173bce,_0x242c6c){if(_0x173bce[_0x589b('0x48')]['id']){delete _0x173bce[_0x589b('0x48')]['id'];}return db[_0x589b('0x2b')][_0x589b('0x46')]({'where':{'id':_0x173bce[_0x589b('0x49')]['id']}})[_0x589b('0x24')](handleEntityNotFound(_0x242c6c,null))[_0x589b('0x24')](saveUpdates(_0x173bce[_0x589b('0x48')],null))[_0x589b('0x24')](respondWithResult(_0x242c6c,null))[_0x589b('0x42')](handleError(_0x242c6c,null));};exports[_0x589b('0x4a')]=function(_0x2cbb70,_0xc38867){return db[_0x589b('0x2b')][_0x589b('0x46')]({'where':{'id':_0x2cbb70[_0x589b('0x49')]['id']}})[_0x589b('0x24')](handleEntityNotFound(_0xc38867,null))['then'](removeEntity(_0xc38867,null))[_0x589b('0x42')](handleError(_0xc38867,null));};exports[_0x589b('0x4b')]=function(_0x2fd4f4,_0x334ad8,_0x2f5d6e){var _0xf8d708={};var _0x437e1a={};var _0x482827;var _0x51b360;return db[_0x589b('0x2b')][_0x589b('0x4c')]({'where':{'id':_0x2fd4f4[_0x589b('0x49')]['id']}})[_0x589b('0x24')](handleEntityNotFound(_0x334ad8,null))[_0x589b('0x24')](function(_0x223914){if(_0x223914){_0x482827=_0x223914;_0x437e1a[_0x589b('0x31')]=_['keys'](db[_0x589b('0x4d')]['rawAttributes']);_0x437e1a[_0x589b('0x2e')]=_[_0x589b('0x44')](_0x2fd4f4[_0x589b('0x2e')]);_0x437e1a[_0x589b('0x2f')]=_[_0x589b('0x30')](_0x437e1a[_0x589b('0x31')],_0x437e1a['query']);_0xf8d708[_0x589b('0x32')]=_['intersection'](_0x437e1a['model'],qs[_0x589b('0x33')](_0x2fd4f4[_0x589b('0x2e')][_0x589b('0x33')]));_0xf8d708[_0x589b('0x32')]=_0xf8d708[_0x589b('0x32')][_0x589b('0x34')]?_0xf8d708[_0x589b('0x32')]:_0x437e1a[_0x589b('0x31')];_0xf8d708[_0x589b('0x37')]=qs[_0x589b('0x38')](_0x2fd4f4['query'][_0x589b('0x38')]);_0xf8d708[_0x589b('0x39')]=qs[_0x589b('0x2f')](_[_0x589b('0x3a')](_0x2fd4f4[_0x589b('0x2e')],_0x437e1a[_0x589b('0x2f')]));if(_0x2fd4f4[_0x589b('0x2e')][_0x589b('0x3b')]){_0xf8d708[_0x589b('0x39')]=_[_0x589b('0x3c')](_0xf8d708[_0x589b('0x39')],{'$or':_[_0x589b('0x2a')](_0xf8d708['attributes'],function(_0x1e44c9){var _0x19713d={};_0x19713d[_0x1e44c9]={'$like':'%'+_0x2fd4f4['query'][_0x589b('0x3b')]+'%'};return _0x19713d;})});}_0xf8d708=_[_0x589b('0x3c')]({},_0xf8d708,_0x2fd4f4[_0x589b('0x3e')]);return _0x482827[_0x589b('0x4b')](_0xf8d708);}})[_0x589b('0x24')](function(_0xb75b98){if(_0xb75b98){_0x51b360=_0xb75b98['length'];if(!_0x2fd4f4[_0x589b('0x2e')][_0x589b('0x35')]('nolimit')){_0xf8d708[_0x589b('0x1f')]=qs[_0x589b('0x1f')](_0x2fd4f4[_0x589b('0x2e')]['limit']);_0xf8d708[_0x589b('0x1e')]=qs[_0x589b('0x1e')](_0x2fd4f4[_0x589b('0x2e')][_0x589b('0x1e')]);}return _0x482827['getFields'](_0xf8d708);}})['then'](function(_0x1b9bb4){if(_0x1b9bb4){return _0x1b9bb4?{'count':_0x51b360,'rows':_0x1b9bb4}:null;}})[_0x589b('0x24')](respondWithResult(_0x334ad8,null))[_0x589b('0x42')](handleError(_0x334ad8,null));};exports[_0x589b('0x4e')]=function(_0x315ca3,_0x111701,_0x33cab7){var _0x2d5326={};var _0x1529a2={};var _0x456d2b;var _0x3ab179;return db[_0x589b('0x2b')][_0x589b('0x4c')]({'where':{'id':_0x315ca3[_0x589b('0x49')]['id']}})[_0x589b('0x24')](handleEntityNotFound(_0x111701,null))[_0x589b('0x24')](function(_0x241c12){if(_0x241c12){_0x456d2b=_0x241c12;_0x1529a2[_0x589b('0x31')]=_['keys'](db[_0x589b('0x4d')][_0x589b('0x2c')]);_0x1529a2[_0x589b('0x2e')]=_[_0x589b('0x44')](_0x315ca3[_0x589b('0x2e')]);_0x1529a2['filters']=_[_0x589b('0x30')](_0x1529a2[_0x589b('0x31')],_0x1529a2[_0x589b('0x2e')]);_0x2d5326[_0x589b('0x32')]=_[_0x589b('0x30')](_0x1529a2[_0x589b('0x31')],qs[_0x589b('0x33')](_0x315ca3[_0x589b('0x2e')]['fields']));_0x2d5326[_0x589b('0x32')]=_0x2d5326[_0x589b('0x32')][_0x589b('0x34')]?_0x2d5326[_0x589b('0x32')]:_0x1529a2[_0x589b('0x31')];_0x2d5326[_0x589b('0x37')]=qs['sort'](_0x315ca3['query']['sort']);_0x2d5326[_0x589b('0x39')]=qs[_0x589b('0x2f')](_['pick'](_0x315ca3[_0x589b('0x2e')],_0x1529a2[_0x589b('0x2f')]));if(_0x315ca3[_0x589b('0x2e')][_0x589b('0x3b')]){_0x2d5326[_0x589b('0x39')]=_[_0x589b('0x3c')](_0x2d5326[_0x589b('0x39')],{'$or':_[_0x589b('0x2a')](_0x2d5326[_0x589b('0x32')],function(_0x290b13){var _0x3f1c6e={};_0x3f1c6e[_0x290b13]={'$like':'%'+_0x315ca3[_0x589b('0x2e')][_0x589b('0x3b')]+'%'};return _0x3f1c6e;})});}_0x2d5326=_[_0x589b('0x3c')]({},_0x2d5326,_0x315ca3['options']);return _0x456d2b[_0x589b('0x4e')](_0x2d5326);}})['then'](function(_0x560d58){if(_0x560d58){_0x3ab179=_0x560d58[_0x589b('0x34')];if(!_0x315ca3[_0x589b('0x2e')][_0x589b('0x35')](_0x589b('0x36'))){_0x2d5326[_0x589b('0x1f')]=qs[_0x589b('0x1f')](_0x315ca3[_0x589b('0x2e')][_0x589b('0x1f')]);_0x2d5326[_0x589b('0x1e')]=qs[_0x589b('0x1e')](_0x315ca3[_0x589b('0x2e')][_0x589b('0x1e')]);}return _0x456d2b['getSubjects'](_0x2d5326);}})[_0x589b('0x24')](function(_0x37a09c){if(_0x37a09c){return _0x37a09c?{'count':_0x3ab179,'rows':_0x37a09c}:null;}})[_0x589b('0x24')](respondWithResult(_0x111701,null))['catch'](handleError(_0x111701,null));};exports['getDescriptions']=function(_0x39081b,_0xfdaeb9,_0x1e1e29){var _0x2759c8={};var _0x52612b={};var _0x3ed163;var _0x308777;return db['VtigerConfiguration'][_0x589b('0x4c')]({'where':{'id':_0x39081b[_0x589b('0x49')]['id']}})[_0x589b('0x24')](handleEntityNotFound(_0xfdaeb9,null))[_0x589b('0x24')](function(_0x54a77b){if(_0x54a77b){_0x3ed163=_0x54a77b;_0x52612b[_0x589b('0x31')]=_[_0x589b('0x44')](db['VtigerField'][_0x589b('0x2c')]);_0x52612b['query']=_['keys'](_0x39081b['query']);_0x52612b[_0x589b('0x2f')]=_['intersection'](_0x52612b['model'],_0x52612b['query']);_0x2759c8[_0x589b('0x32')]=_[_0x589b('0x30')](_0x52612b[_0x589b('0x31')],qs[_0x589b('0x33')](_0x39081b[_0x589b('0x2e')][_0x589b('0x33')]));_0x2759c8[_0x589b('0x32')]=_0x2759c8[_0x589b('0x32')][_0x589b('0x34')]?_0x2759c8['attributes']:_0x52612b[_0x589b('0x31')];_0x2759c8[_0x589b('0x37')]=qs[_0x589b('0x38')](_0x39081b[_0x589b('0x2e')][_0x589b('0x38')]);_0x2759c8[_0x589b('0x39')]=qs[_0x589b('0x2f')](_[_0x589b('0x3a')](_0x39081b[_0x589b('0x2e')],_0x52612b[_0x589b('0x2f')]));if(_0x39081b[_0x589b('0x2e')][_0x589b('0x3b')]){_0x2759c8[_0x589b('0x39')]=_[_0x589b('0x3c')](_0x2759c8[_0x589b('0x39')],{'$or':_[_0x589b('0x2a')](_0x2759c8[_0x589b('0x32')],function(_0x2d749d){var _0x57c4ad={};_0x57c4ad[_0x2d749d]={'$like':'%'+_0x39081b['query'][_0x589b('0x3b')]+'%'};return _0x57c4ad;})});}_0x2759c8=_['merge']({},_0x2759c8,_0x39081b['options']);return _0x3ed163[_0x589b('0x4f')](_0x2759c8);}})[_0x589b('0x24')](function(_0x416572){if(_0x416572){_0x308777=_0x416572[_0x589b('0x34')];if(!_0x39081b[_0x589b('0x2e')][_0x589b('0x35')]('nolimit')){_0x2759c8[_0x589b('0x1f')]=qs['limit'](_0x39081b[_0x589b('0x2e')]['limit']);_0x2759c8[_0x589b('0x1e')]=qs['offset'](_0x39081b[_0x589b('0x2e')]['offset']);}return _0x3ed163[_0x589b('0x4f')](_0x2759c8);}})[_0x589b('0x24')](function(_0x12cb7f){if(_0x12cb7f){return _0x12cb7f?{'count':_0x308777,'rows':_0x12cb7f}:null;}})[_0x589b('0x24')](respondWithResult(_0xfdaeb9,null))['catch'](handleError(_0xfdaeb9,null));};
\ No newline at end of file
index 7f0a0e9..bdee770 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23ff=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util','../../config/logger'];(function(_0xaa7af2,_0x289bf0){var _0xbf48e3=function(_0x477729){while(--_0x477729){_0xaa7af2['push'](_0xaa7af2['shift']());}};_0xbf48e3(++_0x289bf0);}(_0x23ff,0x1b7));var _0xf23f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf23f('0x0'));var util=require(_0xf23f('0x1'));var logger=require(_0xf23f('0x2'))(_0xf23f('0x3'));var moment=require(_0xf23f('0x4'));var BPromise=require(_0xf23f('0x5'));var rp=require(_0xf23f('0x6'));var fs=require('fs');var path=require(_0xf23f('0x7'));var rimraf=require(_0xf23f('0x8'));var config=require(_0xf23f('0x9'));var attributes=require(_0xf23f('0xa'));module['exports']=function(_0x38865b,_0x3b5aa8){return _0x38865b[_0xf23f('0xb')](_0xf23f('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4c64=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment','bluebird'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x4c64,0x15c));var _0x44c6=function(_0x4ba6cf,_0x4da8ca){_0x4ba6cf=_0x4ba6cf-0x0;var _0x40bc2b=_0x4c64[_0x4ba6cf];return _0x40bc2b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44c6('0x0'))(_0x44c6('0x1'));var moment=require(_0x44c6('0x2'));var BPromise=require(_0x44c6('0x3'));var rp=require(_0x44c6('0x4'));var fs=require('fs');var path=require(_0x44c6('0x5'));var rimraf=require(_0x44c6('0x6'));var config=require('../../config/environment');var attributes=require(_0x44c6('0x7'));module['exports']=function(_0x4d45a3,_0x21d408){return _0x4d45a3[_0x44c6('0x8')](_0x44c6('0x9'),attributes,{'tableName':_0x44c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9eba32d..3219c76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b96=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x2bcbde,_0x1af371){var _0x365223=function(_0x353d91){while(--_0x353d91){_0x2bcbde['push'](_0x2bcbde['shift']());}};_0x365223(++_0x1af371);}(_0x8b96,0xfb));var _0x68b9=function(_0x1decf6,_0x304b7d){_0x1decf6=_0x1decf6-0x0;var _0x438f7d=_0x8b96[_0x1decf6];return _0x438f7d;};'use strict';var _=require('lodash');var util=require(_0x68b9('0x0'));var moment=require('moment');var BPromise=require(_0x68b9('0x1'));var rs=require(_0x68b9('0x2'));var fs=require('fs');var Redis=require(_0x68b9('0x3'));var db=require(_0x68b9('0x4'))['db'];var utils=require(_0x68b9('0x5'));var logger=require(_0x68b9('0x6'))(_0x68b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x68b9('0x8'));var client=jayson['client'][_0x68b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x282f27,_0x119e03,_0x34cd51){return new BPromise(function(_0x4a37c7,_0x36b177){return client[_0x68b9('0xa')](_0x282f27,_0x34cd51)[_0x68b9('0xb')](function(_0x40c5c7){logger[_0x68b9('0xc')](_0x68b9('0xd'),_0x119e03,_0x68b9('0xe'));logger[_0x68b9('0xf')](_0x68b9('0x10'),_0x119e03,_0x68b9('0xe'),JSON[_0x68b9('0x11')](_0x40c5c7));if(_0x40c5c7['error']){if(_0x40c5c7[_0x68b9('0x12')][_0x68b9('0x13')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x119e03,_0x40c5c7['error'][_0x68b9('0x14')]);return _0x36b177(_0x40c5c7[_0x68b9('0x12')][_0x68b9('0x14')]);}logger[_0x68b9('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x119e03,_0x40c5c7['error'][_0x68b9('0x14')]);return _0x4a37c7(_0x40c5c7['error'][_0x68b9('0x14')]);}else{logger[_0x68b9('0xc')](_0x68b9('0xd'),_0x119e03,_0x68b9('0xe'));_0x4a37c7(_0x40c5c7[_0x68b9('0x15')][_0x68b9('0x14')]);}})[_0x68b9('0x16')](function(_0x16356d){logger[_0x68b9('0x12')](_0x68b9('0xd'),_0x119e03,_0x16356d);_0x36b177(_0x16356d);});});}
\ No newline at end of file
+var _0xe604=['../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xe604,0x171));var _0x4e60=function(_0x435520,_0x3a280a){_0x435520=_0x435520-0x0;var _0x18d93d=_0xe604[_0x435520];return _0x18d93d;};'use strict';var _=require(_0x4e60('0x0'));var util=require(_0x4e60('0x1'));var moment=require(_0x4e60('0x2'));var BPromise=require(_0x4e60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e60('0x4'));var db=require(_0x4e60('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e60('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e60('0x7'));var client=jayson[_0x4e60('0x8')][_0x4e60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5601e3,_0x2fe925,_0x4d1ac3){return new BPromise(function(_0x45c9d2,_0x6b1b12){return client[_0x4e60('0xa')](_0x5601e3,_0x4d1ac3)[_0x4e60('0xb')](function(_0x33ba60){logger[_0x4e60('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2fe925,_0x4e60('0xd'));logger[_0x4e60('0xe')](_0x4e60('0xf'),_0x2fe925,_0x4e60('0xd'),JSON[_0x4e60('0x10')](_0x33ba60));if(_0x33ba60[_0x4e60('0x11')]){if(_0x33ba60[_0x4e60('0x11')]['code']===0x1f4){logger[_0x4e60('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x2fe925,_0x33ba60[_0x4e60('0x11')][_0x4e60('0x12')]);return _0x6b1b12(_0x33ba60[_0x4e60('0x11')][_0x4e60('0x12')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2fe925,_0x33ba60[_0x4e60('0x11')][_0x4e60('0x12')]);return _0x45c9d2(_0x33ba60[_0x4e60('0x11')][_0x4e60('0x12')]);}else{logger[_0x4e60('0xc')](_0x4e60('0x13'),_0x2fe925,_0x4e60('0xd'));_0x45c9d2(_0x33ba60[_0x4e60('0x14')]['message']);}})[_0x4e60('0x15')](function(_0x492d9a){logger[_0x4e60('0x11')](_0x4e60('0x13'),_0x2fe925,_0x492d9a);_0x6b1b12(_0x492d9a);});});}
\ No newline at end of file
index 4e5ffae..f2cb8c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f93=['Router','fs-extra','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2aaddd,_0x551fcd){var _0x13a70c=function(_0x2e089d){while(--_0x2e089d){_0x2aaddd['push'](_0x2aaddd['shift']());}};_0x13a70c(++_0x551fcd);}(_0x6f93,0xb7));var _0x36f9=function(_0x39c832,_0x157280){_0x39c832=_0x39c832-0x0;var _0x259e23=_0x6f93[_0x39c832];return _0x259e23;};'use strict';var multer=require('multer');var util=require(_0x36f9('0x0'));var path=require(_0x36f9('0x1'));var timeout=require(_0x36f9('0x2'));var express=require(_0x36f9('0x3'));var router=express[_0x36f9('0x4')]();var fs_extra=require(_0x36f9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x36f9('0x6'));var controller=require(_0x36f9('0x7'));router[_0x36f9('0x8')]('/',auth[_0x36f9('0x9')](),controller[_0x36f9('0xa')]);router['get'](_0x36f9('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x36f9('0x9')](),controller[_0x36f9('0xc')]);router['put'](_0x36f9('0xb'),auth[_0x36f9('0x9')](),controller[_0x36f9('0xd')]);router[_0x36f9('0xe')](_0x36f9('0xb'),auth['isAuthenticated'](),controller[_0x36f9('0xf')]);module[_0x36f9('0x10')]=router;
\ No newline at end of file
+var _0x52cb=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x52cb,0x140));var _0xb52c=function(_0x20c7b6,_0x458b6a){_0x20c7b6=_0x20c7b6-0x0;var _0x243741=_0x52cb[_0x20c7b6];return _0x243741;};'use strict';var multer=require(_0xb52c('0x0'));var util=require(_0xb52c('0x1'));var path=require(_0xb52c('0x2'));var timeout=require(_0xb52c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb52c('0x4'));var auth=require(_0xb52c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb52c('0x6'));var controller=require(_0xb52c('0x7'));router[_0xb52c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb52c('0x9')]);router['get'](_0xb52c('0xa'),auth[_0xb52c('0xb')](),controller[_0xb52c('0xc')]);router['post']('/',auth[_0xb52c('0xb')](),controller[_0xb52c('0xd')]);router[_0xb52c('0xe')](_0xb52c('0xa'),auth[_0xb52c('0xb')](),controller[_0xb52c('0xf')]);router[_0xb52c('0x10')]('/:id',auth[_0xb52c('0xb')](),controller[_0xb52c('0x11')]);module['exports']=router;
\ No newline at end of file
index 8795a0e..e525035 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d66=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1870e3,_0x196c6c){var _0x2f8d11=function(_0x45832f){while(--_0x45832f){_0x1870e3['push'](_0x1870e3['shift']());}};_0x2f8d11(++_0x196c6c);}(_0x3d66,0xf4));var _0x63d6=function(_0xc96212,_0x2a2935){_0xc96212=_0xc96212-0x0;var _0x4b2679=_0x3d66[_0xc96212];return _0x4b2679;};'use strict';var Sequelize=require('sequelize');module[_0x63d6('0x0')]={'type':{'type':Sequelize[_0x63d6('0x1')](_0x63d6('0x2'),_0x63d6('0x3'),_0x63d6('0x4'),_0x63d6('0x5'),_0x63d6('0x6')),'defaultValue':_0x63d6('0x2')},'content':{'type':Sequelize[_0x63d6('0x7')]},'key':{'type':Sequelize[_0x63d6('0x7')]},'keyType':{'type':Sequelize[_0x63d6('0x1')](_0x63d6('0x2'),_0x63d6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x63d6('0x7')]},'idField':{'type':Sequelize[_0x63d6('0x7')]},'nameField':{'type':Sequelize[_0x63d6('0x7')]},'customField':{'type':Sequelize[_0x63d6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xcea3=['STRING','exports','string','variable','customVariable','keyValue','picklist'];(function(_0xce1e7e,_0x573352){var _0x375c35=function(_0x1c1598){while(--_0x1c1598){_0xce1e7e['push'](_0xce1e7e['shift']());}};_0x375c35(++_0x573352);}(_0xcea3,0x1cf));var _0x3cea=function(_0x2ee4ae,_0xcc134a){_0x2ee4ae=_0x2ee4ae-0x0;var _0x1de567=_0xcea3[_0x2ee4ae];return _0x1de567;};'use strict';var Sequelize=require('sequelize');module[_0x3cea('0x0')]={'type':{'type':Sequelize['ENUM'](_0x3cea('0x1'),_0x3cea('0x2'),_0x3cea('0x3'),_0x3cea('0x4'),_0x3cea('0x5')),'defaultValue':_0x3cea('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3cea('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x3cea('0x1'),'variable',_0x3cea('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3cea('0x6')]},'nameField':{'type':Sequelize[_0x3cea('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3cea('0x6')]}};
\ No newline at end of file
index 8c53094..17e2f45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30fa=['pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','VtigerField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2b94f1,_0x2e2fcd){var _0x5ccf5c=function(_0x51f303){while(--_0x51f303){_0x2b94f1['push'](_0x2b94f1['shift']());}};_0x5ccf5c(++_0x2e2fcd);}(_0x30fa,0x139));var _0xa30f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x30fa[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xa30f('0x0'));var rimraf=require(_0xa30f('0x1'));var zipdir=require(_0xa30f('0x2'));var jsonpatch=require(_0xa30f('0x3'));var rp=require(_0xa30f('0x4'));var moment=require('moment');var BPromise=require(_0xa30f('0x5'));var Mustache=require(_0xa30f('0x6'));var util=require(_0xa30f('0x7'));var path=require(_0xa30f('0x8'));var sox=require(_0xa30f('0x9'));var csv=require(_0xa30f('0xa'));var ejs=require(_0xa30f('0xb'));var fs=require('fs');var fs_extra=require(_0xa30f('0xc'));var _=require(_0xa30f('0xd'));var squel=require(_0xa30f('0xe'));var crypto=require(_0xa30f('0xf'));var jsforce=require(_0xa30f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa30f('0xa'));var querystring=require(_0xa30f('0x11'));var Papa=require('papaparse');var Redis=require(_0xa30f('0x12'));var authService=require(_0xa30f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa30f('0x14'));var logger=require(_0xa30f('0x15'))(_0xa30f('0x16'));var utils=require('../../config/utils');var config=require(_0xa30f('0x17'));var licenseUtil=require(_0xa30f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220a01,_0x2170cd){_0x2170cd=_0x2170cd||0xcc;return function(_0x4f51c6){if(_0x4f51c6){return _0x220a01[_0xa30f('0x19')](_0x2170cd);}return _0x220a01[_0xa30f('0x1a')](_0x2170cd)[_0xa30f('0x1b')]();};}function respondWithResult(_0x4b870c,_0x12ab07){_0x12ab07=_0x12ab07||0xc8;return function(_0x3b2fd9){if(_0x3b2fd9){return _0x4b870c['status'](_0x12ab07)[_0xa30f('0x1c')](_0x3b2fd9);}};}function respondWithFilteredResult(_0x30462c,_0xdd42a4){return function(_0x5089a5){if(_0x5089a5){var _0xf68f65=typeof _0xdd42a4[_0xa30f('0x1d')]===_0xa30f('0x1e')&&typeof _0xdd42a4[_0xa30f('0x1f')]===_0xa30f('0x1e');var _0x5f2cc5=_0x5089a5[_0xa30f('0x20')];var _0x57da7e=_0xf68f65?0x0:_0xdd42a4[_0xa30f('0x1d')];var _0x19c975=_0xf68f65?_0x5089a5[_0xa30f('0x20')]:_0xdd42a4[_0xa30f('0x1d')]+_0xdd42a4[_0xa30f('0x1f')];var _0x65a32e;if(_0x19c975>=_0x5f2cc5){_0x19c975=_0x5f2cc5;_0x65a32e=0xc8;}else{_0x65a32e=0xce;}_0x30462c[_0xa30f('0x1a')](_0x65a32e);return _0x30462c[_0xa30f('0x21')]('Content-Range',_0x57da7e+'-'+_0x19c975+'/'+_0x5f2cc5)['json'](_0x5089a5);}return null;};}function patchUpdates(_0x5bb2c7){return function(_0x6fcefe){try{jsonpatch[_0xa30f('0x22')](_0x6fcefe,_0x5bb2c7,!![]);}catch(_0x4711ea){return BPromise[_0xa30f('0x23')](_0x4711ea);}return _0x6fcefe[_0xa30f('0x24')]();};}function saveUpdates(_0x2b616d,_0x587992){return function(_0x2e8fc0){if(_0x2e8fc0){return _0x2e8fc0['update'](_0x2b616d)['then'](function(_0x3468f8){return _0x3468f8;});}return null;};}function removeEntity(_0x11bd4e,_0x2e2848){return function(_0x3823fb){if(_0x3823fb){return _0x3823fb['destroy']()[_0xa30f('0x25')](function(){_0x11bd4e[_0xa30f('0x1a')](0xcc)[_0xa30f('0x1b')]();});}};}function handleEntityNotFound(_0x423e45,_0x154c29){return function(_0x47707c){if(!_0x47707c){_0x423e45[_0xa30f('0x19')](0x194);}return _0x47707c;};}function handleError(_0x344e3f,_0xd4a1da){_0xd4a1da=_0xd4a1da||0x1f4;return function(_0xf89093){logger[_0xa30f('0x26')](_0xf89093['stack']);if(_0xf89093[_0xa30f('0x27')]){delete _0xf89093[_0xa30f('0x27')];}_0x344e3f[_0xa30f('0x1a')](_0xd4a1da)[_0xa30f('0x28')](_0xf89093);};}exports['index']=function(_0x24fbf0,_0x39fcab){var _0x2e3146={},_0x404068={},_0x1c2a09={'count':0x0,'rows':[]};var _0x21b6e1=_['map'](db[_0xa30f('0x29')]['rawAttributes'],function(_0x7c3a4){return{'name':_0x7c3a4[_0xa30f('0x2a')],'type':_0x7c3a4[_0xa30f('0x2b')]['key']};});_0x404068[_0xa30f('0x2c')]=_['map'](_0x21b6e1,'name');_0x404068[_0xa30f('0x2d')]=_[_0xa30f('0x2e')](_0x24fbf0[_0xa30f('0x2d')]);_0x404068[_0xa30f('0x2f')]=_['intersection'](_0x404068[_0xa30f('0x2c')],_0x404068[_0xa30f('0x2d')]);_0x2e3146[_0xa30f('0x30')]=_[_0xa30f('0x31')](_0x404068[_0xa30f('0x2c')],qs[_0xa30f('0x32')](_0x24fbf0[_0xa30f('0x2d')][_0xa30f('0x32')]));_0x2e3146['attributes']=_0x2e3146[_0xa30f('0x30')][_0xa30f('0x33')]?_0x2e3146[_0xa30f('0x30')]:_0x404068[_0xa30f('0x2c')];if(!_0x24fbf0[_0xa30f('0x2d')][_0xa30f('0x34')](_0xa30f('0x35'))){_0x2e3146[_0xa30f('0x1f')]=qs[_0xa30f('0x1f')](_0x24fbf0['query']['limit']);_0x2e3146[_0xa30f('0x1d')]=qs[_0xa30f('0x1d')](_0x24fbf0[_0xa30f('0x2d')][_0xa30f('0x1d')]);}_0x2e3146[_0xa30f('0x36')]=qs[_0xa30f('0x37')](_0x24fbf0[_0xa30f('0x2d')][_0xa30f('0x37')]);_0x2e3146[_0xa30f('0x38')]=qs[_0xa30f('0x2f')](_[_0xa30f('0x39')](_0x24fbf0[_0xa30f('0x2d')],_0x404068[_0xa30f('0x2f')]),_0x21b6e1);if(_0x24fbf0[_0xa30f('0x2d')][_0xa30f('0x3a')]){_0x2e3146[_0xa30f('0x38')]=_[_0xa30f('0x3b')](_0x2e3146[_0xa30f('0x38')],{'$or':_['map'](_0x21b6e1,function(_0x222347){if(_0x222347[_0xa30f('0x2b')]!==_0xa30f('0x3c')){var _0x5c9d2d={};_0x5c9d2d[_0x222347[_0xa30f('0x27')]]={'$like':'%'+_0x24fbf0[_0xa30f('0x2d')]['filter']+'%'};return _0x5c9d2d;}})});}_0x2e3146=_[_0xa30f('0x3b')]({},_0x2e3146,_0x24fbf0[_0xa30f('0x3d')]);var _0x1dcaec={'where':_0x2e3146[_0xa30f('0x38')]};return db['VtigerField']['count'](_0x1dcaec)[_0xa30f('0x25')](function(_0x45fea1){_0x1c2a09['count']=_0x45fea1;if(_0x24fbf0[_0xa30f('0x2d')][_0xa30f('0x3e')]){_0x2e3146[_0xa30f('0x3f')]=[{'all':!![]}];}return db[_0xa30f('0x29')]['findAll'](_0x2e3146);})[_0xa30f('0x25')](function(_0x3963a0){_0x1c2a09[_0xa30f('0x40')]=_0x3963a0;return _0x1c2a09;})[_0xa30f('0x25')](respondWithFilteredResult(_0x39fcab,_0x2e3146))[_0xa30f('0x41')](handleError(_0x39fcab,null));};exports[_0xa30f('0x42')]=function(_0x411402,_0x24ab83){var _0x105c00={'raw':!![],'where':{'id':_0x411402[_0xa30f('0x43')]['id']}},_0x3ab623={};_0x3ab623[_0xa30f('0x2c')]=_[_0xa30f('0x2e')](db[_0xa30f('0x29')][_0xa30f('0x44')]);_0x3ab623[_0xa30f('0x2d')]=_[_0xa30f('0x2e')](_0x411402[_0xa30f('0x2d')]);_0x3ab623[_0xa30f('0x2f')]=_[_0xa30f('0x31')](_0x3ab623[_0xa30f('0x2c')],_0x3ab623[_0xa30f('0x2d')]);_0x105c00['attributes']=_[_0xa30f('0x31')](_0x3ab623[_0xa30f('0x2c')],qs['fields'](_0x411402[_0xa30f('0x2d')]['fields']));_0x105c00['attributes']=_0x105c00[_0xa30f('0x30')][_0xa30f('0x33')]?_0x105c00[_0xa30f('0x30')]:_0x3ab623[_0xa30f('0x2c')];if(_0x411402[_0xa30f('0x2d')]['includeAll']){_0x105c00[_0xa30f('0x3f')]=[{'all':!![]}];}_0x105c00=_[_0xa30f('0x3b')]({},_0x105c00,_0x411402[_0xa30f('0x3d')]);return db[_0xa30f('0x29')][_0xa30f('0x45')](_0x105c00)[_0xa30f('0x25')](handleEntityNotFound(_0x24ab83,null))[_0xa30f('0x25')](respondWithResult(_0x24ab83,null))[_0xa30f('0x41')](handleError(_0x24ab83,null));};exports['create']=function(_0x227878,_0x18a5e5){return db['VtigerField'][_0xa30f('0x46')](_0x227878[_0xa30f('0x47')],{})[_0xa30f('0x25')](respondWithResult(_0x18a5e5,0xc9))[_0xa30f('0x41')](handleError(_0x18a5e5,null));};exports[_0xa30f('0x48')]=function(_0x5e9d6f,_0x339934){if(_0x5e9d6f[_0xa30f('0x47')]['id']){delete _0x5e9d6f[_0xa30f('0x47')]['id'];}return db[_0xa30f('0x29')][_0xa30f('0x45')]({'where':{'id':_0x5e9d6f[_0xa30f('0x43')]['id']}})[_0xa30f('0x25')](handleEntityNotFound(_0x339934,null))[_0xa30f('0x25')](saveUpdates(_0x5e9d6f[_0xa30f('0x47')],null))[_0xa30f('0x25')](respondWithResult(_0x339934,null))[_0xa30f('0x41')](handleError(_0x339934,null));};exports[_0xa30f('0x49')]=function(_0xb5d6fe,_0x3cf0c1){return db['VtigerField'][_0xa30f('0x45')]({'where':{'id':_0xb5d6fe['params']['id']}})[_0xa30f('0x25')](handleEntityNotFound(_0x3cf0c1,null))[_0xa30f('0x25')](removeEntity(_0x3cf0c1,null))['catch'](handleError(_0x3cf0c1,null));};
\ No newline at end of file
+var _0x6dff=['fieldName','type','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','reject','save','update','then','destroy','stack','name','index','VtigerField'];(function(_0xb4e052,_0x1d3cb6){var _0x5197e7=function(_0x9bc429){while(--_0x9bc429){_0xb4e052['push'](_0xb4e052['shift']());}};_0x5197e7(++_0x1d3cb6);}(_0x6dff,0xab));var _0xf6df=function(_0x15c6e5,_0x16f5b5){_0x15c6e5=_0x15c6e5-0x0;var _0x3245ee=_0x6dff[_0x15c6e5];return _0x3245ee;};'use strict';var emlformat=require(_0xf6df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6df('0x1'));var jsonpatch=require(_0xf6df('0x2'));var rp=require(_0xf6df('0x3'));var moment=require(_0xf6df('0x4'));var BPromise=require(_0xf6df('0x5'));var Mustache=require(_0xf6df('0x6'));var util=require(_0xf6df('0x7'));var path=require(_0xf6df('0x8'));var sox=require('sox');var csv=require(_0xf6df('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6df('0xa'));var _=require(_0xf6df('0xb'));var squel=require('squel');var crypto=require(_0xf6df('0xc'));var jsforce=require(_0xf6df('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf6df('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf6df('0xe'));var authService=require(_0xf6df('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf6df('0x10'));var hardwareService=require(_0xf6df('0x11'));var logger=require(_0xf6df('0x12'))(_0xf6df('0x13'));var utils=require(_0xf6df('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf6df('0x15'));var db=require(_0xf6df('0x16'))['db'];function respondWithStatusCode(_0x31c8e3,_0x91e45f){_0x91e45f=_0x91e45f||0xcc;return function(_0x1b4ab2){if(_0x1b4ab2){return _0x31c8e3[_0xf6df('0x17')](_0x91e45f);}return _0x31c8e3['status'](_0x91e45f)[_0xf6df('0x18')]();};}function respondWithResult(_0x54597a,_0x256bcc){_0x256bcc=_0x256bcc||0xc8;return function(_0x52a91d){if(_0x52a91d){return _0x54597a[_0xf6df('0x19')](_0x256bcc)[_0xf6df('0x1a')](_0x52a91d);}};}function respondWithFilteredResult(_0x13a401,_0x452c87){return function(_0x133388){if(_0x133388){var _0x48701f=typeof _0x452c87[_0xf6df('0x1b')]===_0xf6df('0x1c')&&typeof _0x452c87[_0xf6df('0x1d')]===_0xf6df('0x1c');var _0x45945b=_0x133388['count'];var _0x375cd5=_0x48701f?0x0:_0x452c87[_0xf6df('0x1b')];var _0x20e387=_0x48701f?_0x133388['count']:_0x452c87[_0xf6df('0x1b')]+_0x452c87[_0xf6df('0x1d')];var _0x287904;if(_0x20e387>=_0x45945b){_0x20e387=_0x45945b;_0x287904=0xc8;}else{_0x287904=0xce;}_0x13a401[_0xf6df('0x19')](_0x287904);return _0x13a401['set']('Content-Range',_0x375cd5+'-'+_0x20e387+'/'+_0x45945b)[_0xf6df('0x1a')](_0x133388);}return null;};}function patchUpdates(_0x178e7d){return function(_0x485bfb){try{jsonpatch['apply'](_0x485bfb,_0x178e7d,!![]);}catch(_0x3e8b27){return BPromise[_0xf6df('0x1e')](_0x3e8b27);}return _0x485bfb[_0xf6df('0x1f')]();};}function saveUpdates(_0x47507b,_0x2c6364){return function(_0x42bde8){if(_0x42bde8){return _0x42bde8[_0xf6df('0x20')](_0x47507b)[_0xf6df('0x21')](function(_0x24aaea){return _0x24aaea;});}return null;};}function removeEntity(_0x40896e,_0x552772){return function(_0x532e85){if(_0x532e85){return _0x532e85[_0xf6df('0x22')]()[_0xf6df('0x21')](function(){_0x40896e[_0xf6df('0x19')](0xcc)[_0xf6df('0x18')]();});}};}function handleEntityNotFound(_0x399189,_0x288186){return function(_0x1167a3){if(!_0x1167a3){_0x399189[_0xf6df('0x17')](0x194);}return _0x1167a3;};}function handleError(_0x1d80df,_0xc0cd3d){_0xc0cd3d=_0xc0cd3d||0x1f4;return function(_0x4574ea){logger['error'](_0x4574ea[_0xf6df('0x23')]);if(_0x4574ea[_0xf6df('0x24')]){delete _0x4574ea[_0xf6df('0x24')];}_0x1d80df[_0xf6df('0x19')](_0xc0cd3d)['send'](_0x4574ea);};}exports[_0xf6df('0x25')]=function(_0x594772,_0x434dba){var _0x4237fa={},_0x3211f2={},_0x3d2aae={'count':0x0,'rows':[]};var _0x53cfd6=_['map'](db[_0xf6df('0x26')]['rawAttributes'],function(_0x3e62b9){return{'name':_0x3e62b9[_0xf6df('0x27')],'type':_0x3e62b9[_0xf6df('0x28')]['key']};});_0x3211f2['model']=_[_0xf6df('0x29')](_0x53cfd6,'name');_0x3211f2[_0xf6df('0x2a')]=_[_0xf6df('0x2b')](_0x594772[_0xf6df('0x2a')]);_0x3211f2[_0xf6df('0x2c')]=_['intersection'](_0x3211f2['model'],_0x3211f2['query']);_0x4237fa[_0xf6df('0x2d')]=_[_0xf6df('0x2e')](_0x3211f2[_0xf6df('0x2f')],qs['fields'](_0x594772[_0xf6df('0x2a')][_0xf6df('0x30')]));_0x4237fa[_0xf6df('0x2d')]=_0x4237fa[_0xf6df('0x2d')][_0xf6df('0x31')]?_0x4237fa[_0xf6df('0x2d')]:_0x3211f2[_0xf6df('0x2f')];if(!_0x594772['query'][_0xf6df('0x32')](_0xf6df('0x33'))){_0x4237fa['limit']=qs[_0xf6df('0x1d')](_0x594772[_0xf6df('0x2a')]['limit']);_0x4237fa['offset']=qs[_0xf6df('0x1b')](_0x594772[_0xf6df('0x2a')][_0xf6df('0x1b')]);}_0x4237fa[_0xf6df('0x34')]=qs[_0xf6df('0x35')](_0x594772[_0xf6df('0x2a')][_0xf6df('0x35')]);_0x4237fa[_0xf6df('0x36')]=qs[_0xf6df('0x2c')](_[_0xf6df('0x37')](_0x594772[_0xf6df('0x2a')],_0x3211f2['filters']),_0x53cfd6);if(_0x594772['query'][_0xf6df('0x38')]){_0x4237fa[_0xf6df('0x36')]=_[_0xf6df('0x39')](_0x4237fa['where'],{'$or':_[_0xf6df('0x29')](_0x53cfd6,function(_0x4c5779){if(_0x4c5779[_0xf6df('0x28')]!==_0xf6df('0x3a')){var _0x568fd1={};_0x568fd1[_0x4c5779[_0xf6df('0x24')]]={'$like':'%'+_0x594772['query'][_0xf6df('0x38')]+'%'};return _0x568fd1;}})});}_0x4237fa=_['merge']({},_0x4237fa,_0x594772['options']);var _0x5b5265={'where':_0x4237fa[_0xf6df('0x36')]};return db[_0xf6df('0x26')][_0xf6df('0x3b')](_0x5b5265)['then'](function(_0x36a40e){_0x3d2aae[_0xf6df('0x3b')]=_0x36a40e;if(_0x594772[_0xf6df('0x2a')]['includeAll']){_0x4237fa[_0xf6df('0x3c')]=[{'all':!![]}];}return db[_0xf6df('0x26')][_0xf6df('0x3d')](_0x4237fa);})[_0xf6df('0x21')](function(_0x527466){_0x3d2aae[_0xf6df('0x3e')]=_0x527466;return _0x3d2aae;})['then'](respondWithFilteredResult(_0x434dba,_0x4237fa))[_0xf6df('0x3f')](handleError(_0x434dba,null));};exports[_0xf6df('0x40')]=function(_0x1fd74b,_0x3e364d){var _0x37977e={'raw':!![],'where':{'id':_0x1fd74b[_0xf6df('0x41')]['id']}},_0x39a733={};_0x39a733[_0xf6df('0x2f')]=_['keys'](db[_0xf6df('0x26')][_0xf6df('0x42')]);_0x39a733['query']=_[_0xf6df('0x2b')](_0x1fd74b[_0xf6df('0x2a')]);_0x39a733[_0xf6df('0x2c')]=_[_0xf6df('0x2e')](_0x39a733['model'],_0x39a733[_0xf6df('0x2a')]);_0x37977e['attributes']=_[_0xf6df('0x2e')](_0x39a733['model'],qs[_0xf6df('0x30')](_0x1fd74b[_0xf6df('0x2a')][_0xf6df('0x30')]));_0x37977e['attributes']=_0x37977e[_0xf6df('0x2d')]['length']?_0x37977e[_0xf6df('0x2d')]:_0x39a733[_0xf6df('0x2f')];if(_0x1fd74b[_0xf6df('0x2a')]['includeAll']){_0x37977e[_0xf6df('0x3c')]=[{'all':!![]}];}_0x37977e=_[_0xf6df('0x39')]({},_0x37977e,_0x1fd74b['options']);return db[_0xf6df('0x26')]['find'](_0x37977e)[_0xf6df('0x21')](handleEntityNotFound(_0x3e364d,null))['then'](respondWithResult(_0x3e364d,null))[_0xf6df('0x3f')](handleError(_0x3e364d,null));};exports[_0xf6df('0x43')]=function(_0x11bba1,_0x128fe0){return db['VtigerField'][_0xf6df('0x43')](_0x11bba1[_0xf6df('0x44')],{})[_0xf6df('0x21')](respondWithResult(_0x128fe0,0xc9))[_0xf6df('0x3f')](handleError(_0x128fe0,null));};exports[_0xf6df('0x20')]=function(_0x5c5fd9,_0x5079c1){if(_0x5c5fd9[_0xf6df('0x44')]['id']){delete _0x5c5fd9['body']['id'];}return db['VtigerField'][_0xf6df('0x45')]({'where':{'id':_0x5c5fd9[_0xf6df('0x41')]['id']}})['then'](handleEntityNotFound(_0x5079c1,null))[_0xf6df('0x21')](saveUpdates(_0x5c5fd9[_0xf6df('0x44')],null))[_0xf6df('0x21')](respondWithResult(_0x5079c1,null))[_0xf6df('0x3f')](handleError(_0x5079c1,null));};exports['destroy']=function(_0x131860,_0x1c44a5){return db[_0xf6df('0x26')][_0xf6df('0x45')]({'where':{'id':_0x131860[_0xf6df('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c44a5,null))[_0xf6df('0x21')](removeEntity(_0x1c44a5,null))['catch'](handleError(_0x1c44a5,null));};
\ No newline at end of file
index bf29a77..6acb54b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a03=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intVtigerField.attributes','VtigerField','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x17d4a3,_0x412974){var _0x29a932=function(_0x1b157e){while(--_0x1b157e){_0x17d4a3['push'](_0x17d4a3['shift']());}};_0x29a932(++_0x412974);}(_0x6a03,0xa8));var _0x36a0=function(_0x21618,_0x5f5d19){_0x21618=_0x21618-0x0;var _0x290d51=_0x6a03[_0x21618];return _0x290d51;};'use strict';var _=require(_0x36a0('0x0'));var util=require(_0x36a0('0x1'));var logger=require(_0x36a0('0x2'))(_0x36a0('0x3'));var moment=require(_0x36a0('0x4'));var BPromise=require(_0x36a0('0x5'));var rp=require(_0x36a0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36a0('0x7'));var attributes=require(_0x36a0('0x8'));module['exports']=function(_0x3909ac,_0x56794f){return _0x3909ac['define'](_0x36a0('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x36a0('0xa'),'fields':[_0x36a0('0xb'),_0x36a0('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xdbf3=['exports','VtigerField','idField','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerField.attributes'];(function(_0x409da1,_0x16cc4a){var _0x330c56=function(_0xe66049){while(--_0xe66049){_0x409da1['push'](_0x409da1['shift']());}};_0x330c56(++_0x16cc4a);}(_0xdbf3,0x18f));var _0x3dbf=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xdbf3[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x3dbf('0x0'));var util=require(_0x3dbf('0x1'));var logger=require(_0x3dbf('0x2'))(_0x3dbf('0x3'));var moment=require(_0x3dbf('0x4'));var BPromise=require(_0x3dbf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dbf('0x6'));var rimraf=require('rimraf');var config=require(_0x3dbf('0x7'));var attributes=require(_0x3dbf('0x8'));module[_0x3dbf('0x9')]=function(_0x1cfe23,_0x1c3fbf){return _0x1cfe23['define'](_0x3dbf('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x3dbf('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index ec599d7..54c8641 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x82b0=['rpc','../../config/environment','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x482e6f,_0x1e73a9){var _0x205d86=function(_0x43306e){while(--_0x43306e){_0x482e6f['push'](_0x482e6f['shift']());}};_0x205d86(++_0x1e73a9);}(_0x82b0,0x1f2));var _0x082b=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x82b0[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var moment=require(_0x082b('0x2'));var BPromise=require(_0x082b('0x3'));var rs=require(_0x082b('0x4'));var fs=require('fs');var Redis=require(_0x082b('0x5'));var db=require(_0x082b('0x6'))['db'];var utils=require(_0x082b('0x7'));var logger=require('../../config/logger')(_0x082b('0x8'));var config=require(_0x082b('0x9'));var jayson=require(_0x082b('0xa'));var client=jayson['client'][_0x082b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47e1b3,_0x33c506,_0x2936a1){return new BPromise(function(_0x5f1f81,_0x4652f3){return client['request'](_0x47e1b3,_0x2936a1)[_0x082b('0xc')](function(_0x1c04a8){logger[_0x082b('0xd')](_0x082b('0xe'),_0x33c506,_0x082b('0xf'));logger[_0x082b('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x33c506,_0x082b('0xf'),JSON['stringify'](_0x1c04a8));if(_0x1c04a8[_0x082b('0x11')]){if(_0x1c04a8[_0x082b('0x11')][_0x082b('0x12')]===0x1f4){logger[_0x082b('0x11')](_0x082b('0xe'),_0x33c506,_0x1c04a8[_0x082b('0x11')]['message']);return _0x4652f3(_0x1c04a8[_0x082b('0x11')][_0x082b('0x13')]);}logger['error'](_0x082b('0xe'),_0x33c506,_0x1c04a8[_0x082b('0x11')]['message']);return _0x5f1f81(_0x1c04a8[_0x082b('0x11')][_0x082b('0x13')]);}else{logger[_0x082b('0xd')](_0x082b('0xe'),_0x33c506,_0x082b('0xf'));_0x5f1f81(_0x1c04a8[_0x082b('0x14')][_0x082b('0x13')]);}})[_0x082b('0x15')](function(_0x5ca0db){logger[_0x082b('0x11')](_0x082b('0xe'),_0x33c506,_0x5ca0db);_0x4652f3(_0x5ca0db);});});}
\ No newline at end of file
+var _0xf6bc=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c0b22,_0x56d46a){var _0x16a8a6=function(_0x268ef6){while(--_0x268ef6){_0x5c0b22['push'](_0x5c0b22['shift']());}};_0x16a8a6(++_0x56d46a);}(_0xf6bc,0x68));var _0xcf6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf6b('0x0'));var util=require(_0xcf6b('0x1'));var moment=require(_0xcf6b('0x2'));var BPromise=require(_0xcf6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf6b('0x4'));var db=require(_0xcf6b('0x5'))['db'];var utils=require(_0xcf6b('0x6'));var logger=require(_0xcf6b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf6b('0x8'));var client=jayson[_0xcf6b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383a5e,_0x252e50,_0x5735b8){return new BPromise(function(_0x36502d,_0x4f3762){return client['request'](_0x383a5e,_0x5735b8)['then'](function(_0xf6a11d){logger[_0xcf6b('0xa')](_0xcf6b('0xb'),_0x252e50,_0xcf6b('0xc'));logger[_0xcf6b('0xd')](_0xcf6b('0xe'),_0x252e50,_0xcf6b('0xc'),JSON[_0xcf6b('0xf')](_0xf6a11d));if(_0xf6a11d[_0xcf6b('0x10')]){if(_0xf6a11d[_0xcf6b('0x10')]['code']===0x1f4){logger[_0xcf6b('0x10')](_0xcf6b('0xb'),_0x252e50,_0xf6a11d['error'][_0xcf6b('0x11')]);return _0x4f3762(_0xf6a11d[_0xcf6b('0x10')][_0xcf6b('0x11')]);}logger[_0xcf6b('0x10')](_0xcf6b('0xb'),_0x252e50,_0xf6a11d[_0xcf6b('0x10')][_0xcf6b('0x11')]);return _0x36502d(_0xf6a11d['error'][_0xcf6b('0x11')]);}else{logger[_0xcf6b('0xa')]('VtigerField,\x20%s,\x20%s',_0x252e50,'request\x20sent');_0x36502d(_0xf6a11d[_0xcf6b('0x12')][_0xcf6b('0x11')]);}})[_0xcf6b('0x13')](function(_0x623b71){logger[_0xcf6b('0x10')](_0xcf6b('0xb'),_0x252e50,_0x623b71);_0x4f3762(_0x623b71);});});}
\ No newline at end of file
index 73317e1..9f79f27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e71=['getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5c3cfd,_0x491545){var _0x3488f1=function(_0x3a3784){while(--_0x3a3784){_0x5c3cfd['push'](_0x5c3cfd['shift']());}};_0x3488f1(++_0x491545);}(_0x6e71,0xc2));var _0x16e7=function(_0x3a711b,_0x2c03b4){_0x3a711b=_0x3a711b-0x0;var _0x194f2a=_0x6e71[_0x3a711b];return _0x194f2a;};'use strict';var multer=require(_0x16e7('0x0'));var util=require(_0x16e7('0x1'));var path=require('path');var timeout=require(_0x16e7('0x2'));var express=require(_0x16e7('0x3'));var router=express[_0x16e7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x16e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x16e7('0x6'));var controller=require(_0x16e7('0x7'));router[_0x16e7('0x8')]('/',auth[_0x16e7('0x9')](),controller[_0x16e7('0xa')]);router[_0x16e7('0x8')](_0x16e7('0xb'),auth[_0x16e7('0x9')](),controller[_0x16e7('0xc')]);router[_0x16e7('0x8')]('/:id/configurations',auth[_0x16e7('0x9')](),controller[_0x16e7('0xd')]);router[_0x16e7('0x8')](_0x16e7('0xe'),auth['isAuthenticated'](),controller[_0x16e7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16e7('0x10')]);router[_0x16e7('0x11')](_0x16e7('0x12'),auth[_0x16e7('0x9')](),controller[_0x16e7('0x13')]);router['put']('/:id',auth[_0x16e7('0x9')](),controller[_0x16e7('0x14')]);router[_0x16e7('0x15')](_0x16e7('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x16e7('0x16')]=router;
\ No newline at end of file
+var _0xe9e9=['put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x3ab04c,_0x3e990c){var _0x3582df=function(_0x129e37){while(--_0x129e37){_0x3ab04c['push'](_0x3ab04c['shift']());}};_0x3582df(++_0x3e990c);}(_0xe9e9,0x7b));var _0x9e9e=function(_0x1a68df,_0x5b5910){_0x1a68df=_0x1a68df-0x0;var _0x11af5b=_0xe9e9[_0x1a68df];return _0x11af5b;};'use strict';var multer=require(_0x9e9e('0x0'));var util=require(_0x9e9e('0x1'));var path=require(_0x9e9e('0x2'));var timeout=require(_0x9e9e('0x3'));var express=require(_0x9e9e('0x4'));var router=express['Router']();var fs_extra=require(_0x9e9e('0x5'));var auth=require(_0x9e9e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e9e('0x7'));var controller=require(_0x9e9e('0x8'));router[_0x9e9e('0x9')]('/',auth[_0x9e9e('0xa')](),controller[_0x9e9e('0xb')]);router[_0x9e9e('0x9')](_0x9e9e('0xc'),auth[_0x9e9e('0xa')](),controller[_0x9e9e('0xd')]);router['get']('/:id/configurations',auth[_0x9e9e('0xa')](),controller[_0x9e9e('0xe')]);router[_0x9e9e('0x9')](_0x9e9e('0xf'),auth[_0x9e9e('0xa')](),controller[_0x9e9e('0x10')]);router[_0x9e9e('0x11')]('/',auth[_0x9e9e('0xa')](),controller[_0x9e9e('0x12')]);router['post'](_0x9e9e('0x13'),auth['isAuthenticated'](),controller[_0x9e9e('0x14')]);router[_0x9e9e('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9e9e('0x16')]);router['delete'](_0x9e9e('0xc'),auth[_0x9e9e('0xa')](),controller[_0x9e9e('0x17')]);module['exports']=router;
\ No newline at end of file
index 502f9ec..bd3a371 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d0a=['password','token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d0a,0x175));var _0xa5d0=function(_0x4fd465,_0x515456){_0x4fd465=_0x4fd465-0x0;var _0x43cbe7=_0x5d0a[_0x4fd465];return _0x43cbe7;};'use strict';var Sequelize=require(_0xa5d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa5d0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa5d0('0x1')],'unique':_0xa5d0('0x2')},'password':{'type':Sequelize[_0xa5d0('0x1')]},'token':{'type':Sequelize[_0xa5d0('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa5d0('0x3')},'authType':{'type':Sequelize[_0xa5d0('0x4')](_0xa5d0('0x5'),_0xa5d0('0x6')),'defaultValue':_0xa5d0('0x5')},'serverUrl':{'type':Sequelize[_0xa5d0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa5d0('0x4')](_0xa5d0('0x7'),_0xa5d0('0x8')),'defaultValue':_0xa5d0('0x7')}};
\ No newline at end of file
+var _0x4888=['password','token','exports','STRING','username','remoteUri','ENUM'];(function(_0x723830,_0x221944){var _0x915161=function(_0x16e125){while(--_0x16e125){_0x723830['push'](_0x723830['shift']());}};_0x915161(++_0x221944);}(_0x4888,0x198));var _0x8488=function(_0x327040,_0x6f7206){_0x327040=_0x327040-0x0;var _0x201070=_0x4888[_0x327040];return _0x201070;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'password':{'type':Sequelize[_0x8488('0x1')]},'token':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8488('0x3')},'authType':{'type':Sequelize[_0x8488('0x4')](_0x8488('0x5'),_0x8488('0x6')),'defaultValue':_0x8488('0x5')},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':'integrationTab'}};
\ No newline at end of file
index 5565128..d543321 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdb7=['rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','ZendeskAccount','include','findAll','rows','intersection','length','includeAll','options','catch','create','body','update','find','params','destroy','getConfigurations','hasOwnProperty','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','authType','remoteUri','substring','GET','format','headers','%s:%s','username','toString','base64','Basic\x20%s','%s/token:%s','token','Unknown\x20authentication\x20type','subject','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map'];(function(_0x6cd464,_0x2378ad){var _0x40ab30=function(_0x5da98b){while(--_0x5da98b){_0x6cd464['push'](_0x6cd464['shift']());}};_0x40ab30(++_0x2378ad);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x321327,_0x4965b){_0x321327=_0x321327-0x0;var _0x33be38=_0xbdb7[_0x321327];return _0x33be38;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];var integrations=require(_0x7bdb('0x17'));function respondWithStatusCode(_0x496613,_0x8d74ff){_0x8d74ff=_0x8d74ff||0xcc;return function(_0x53021d){if(_0x53021d){return _0x496613['sendStatus'](_0x8d74ff);}return _0x496613[_0x7bdb('0x18')](_0x8d74ff)[_0x7bdb('0x19')]();};}function respondWithResult(_0x4fd91a,_0x50eeca){_0x50eeca=_0x50eeca||0xc8;return function(_0x4e98f7){if(_0x4e98f7){return _0x4fd91a[_0x7bdb('0x18')](_0x50eeca)[_0x7bdb('0x1a')](_0x4e98f7);}};}function respondWithFilteredResult(_0xe9919f,_0x25d417){return function(_0x31c909){if(_0x31c909){var _0xbde12a=typeof _0x25d417[_0x7bdb('0x1b')]===_0x7bdb('0x1c')&&typeof _0x25d417['limit']===_0x7bdb('0x1c');var _0x43f352=_0x31c909[_0x7bdb('0x1d')];var _0x2aff6a=_0xbde12a?0x0:_0x25d417['offset'];var _0x41f540=_0xbde12a?_0x31c909[_0x7bdb('0x1d')]:_0x25d417['offset']+_0x25d417[_0x7bdb('0x1e')];var _0x31f78e;if(_0x41f540>=_0x43f352){_0x41f540=_0x43f352;_0x31f78e=0xc8;}else{_0x31f78e=0xce;}_0xe9919f[_0x7bdb('0x18')](_0x31f78e);return _0xe9919f[_0x7bdb('0x1f')](_0x7bdb('0x20'),_0x2aff6a+'-'+_0x41f540+'/'+_0x43f352)['json'](_0x31c909);}return null;};}function patchUpdates(_0x49f353){return function(_0x677825){try{jsonpatch[_0x7bdb('0x21')](_0x677825,_0x49f353,!![]);}catch(_0x5daea4){return BPromise[_0x7bdb('0x22')](_0x5daea4);}return _0x677825[_0x7bdb('0x23')]();};}function saveUpdates(_0x346c72,_0x3f53e7){return function(_0x3a1d0f){if(_0x3a1d0f){return _0x3a1d0f['update'](_0x346c72)[_0x7bdb('0x24')](function(_0xdad53d){return _0xdad53d;});}return null;};}function removeEntity(_0x40c447,_0x3a456f){return function(_0x481f4b){if(_0x481f4b){return _0x481f4b['destroy']()[_0x7bdb('0x24')](function(){_0x40c447['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9e02,_0x2abef6){return function(_0x51ab04){if(!_0x51ab04){_0x4a9e02[_0x7bdb('0x25')](0x194);}return _0x51ab04;};}function handleError(_0x72ba69,_0x3ec129){_0x3ec129=_0x3ec129||0x1f4;return function(_0x7c09cf){logger[_0x7bdb('0x26')](_0x7c09cf['stack']);if(_0x7c09cf[_0x7bdb('0x27')]){delete _0x7c09cf[_0x7bdb('0x27')];}_0x72ba69[_0x7bdb('0x18')](_0x3ec129)[_0x7bdb('0x28')](_0x7c09cf);};}exports[_0x7bdb('0x29')]=function(_0x2e8e65,_0x1e9996){var _0xd2d7be={},_0x25a1fe={},_0x365c02={'count':0x0,'rows':[]};var _0x9ec48d=_[_0x7bdb('0x2a')](db['ZendeskAccount'][_0x7bdb('0x2b')],function(_0x23fc3a){return{'name':_0x23fc3a[_0x7bdb('0x2c')],'type':_0x23fc3a[_0x7bdb('0x2d')][_0x7bdb('0x2e')]};});_0x25a1fe['model']=_[_0x7bdb('0x2a')](_0x9ec48d,_0x7bdb('0x27'));_0x25a1fe[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x2e8e65['query']);_0x25a1fe['filters']=_['intersection'](_0x25a1fe[_0x7bdb('0x31')],_0x25a1fe['query']);_0xd2d7be[_0x7bdb('0x32')]=_['intersection'](_0x25a1fe[_0x7bdb('0x31')],qs[_0x7bdb('0x33')](_0x2e8e65[_0x7bdb('0x2f')]['fields']));_0xd2d7be[_0x7bdb('0x32')]=_0xd2d7be['attributes']['length']?_0xd2d7be[_0x7bdb('0x32')]:_0x25a1fe['model'];if(!_0x2e8e65[_0x7bdb('0x2f')]['hasOwnProperty']('nolimit')){_0xd2d7be[_0x7bdb('0x1e')]=qs[_0x7bdb('0x1e')](_0x2e8e65[_0x7bdb('0x2f')][_0x7bdb('0x1e')]);_0xd2d7be[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x2e8e65['query'][_0x7bdb('0x1b')]);}_0xd2d7be[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x2e8e65[_0x7bdb('0x2f')][_0x7bdb('0x35')]);_0xd2d7be[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x2e8e65[_0x7bdb('0x2f')],_0x25a1fe['filters']),_0x9ec48d);if(_0x2e8e65['query'][_0x7bdb('0x39')]){_0xd2d7be[_0x7bdb('0x36')]=_[_0x7bdb('0x3a')](_0xd2d7be[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x2a')](_0x9ec48d,function(_0x509e90){if(_0x509e90['type']!==_0x7bdb('0x3b')){var _0x5d7c1f={};_0x5d7c1f[_0x509e90[_0x7bdb('0x27')]]={'$like':'%'+_0x2e8e65['query'][_0x7bdb('0x39')]+'%'};return _0x5d7c1f;}})});}_0xd2d7be=_['merge']({},_0xd2d7be,_0x2e8e65['options']);var _0x21dae7={'where':_0xd2d7be[_0x7bdb('0x36')]};return db[_0x7bdb('0x3c')][_0x7bdb('0x1d')](_0x21dae7)[_0x7bdb('0x24')](function(_0x2b4829){_0x365c02[_0x7bdb('0x1d')]=_0x2b4829;if(_0x2e8e65['query']['includeAll']){_0xd2d7be[_0x7bdb('0x3d')]=[{'all':!![]}];}return db[_0x7bdb('0x3c')][_0x7bdb('0x3e')](_0xd2d7be);})[_0x7bdb('0x24')](function(_0x39fbca){_0x365c02[_0x7bdb('0x3f')]=_0x39fbca;return _0x365c02;})[_0x7bdb('0x24')](respondWithFilteredResult(_0x1e9996,_0xd2d7be))['catch'](handleError(_0x1e9996,null));};exports['show']=function(_0x1bcbcd,_0x8e893e){var _0x4636f8={'raw':![],'where':{'id':_0x1bcbcd['params']['id']}},_0x72a81c={};_0x72a81c[_0x7bdb('0x31')]=_['keys'](db[_0x7bdb('0x3c')][_0x7bdb('0x2b')]);_0x72a81c[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x1bcbcd[_0x7bdb('0x2f')]);_0x72a81c[_0x7bdb('0x37')]=_[_0x7bdb('0x40')](_0x72a81c[_0x7bdb('0x31')],_0x72a81c[_0x7bdb('0x2f')]);_0x4636f8['attributes']=_[_0x7bdb('0x40')](_0x72a81c[_0x7bdb('0x31')],qs['fields'](_0x1bcbcd[_0x7bdb('0x2f')]['fields']));_0x4636f8[_0x7bdb('0x32')]=_0x4636f8[_0x7bdb('0x32')][_0x7bdb('0x41')]?_0x4636f8[_0x7bdb('0x32')]:_0x72a81c[_0x7bdb('0x31')];if(_0x1bcbcd['query'][_0x7bdb('0x42')]){_0x4636f8[_0x7bdb('0x3d')]=[{'all':!![]}];}_0x4636f8=_[_0x7bdb('0x3a')]({},_0x4636f8,_0x1bcbcd[_0x7bdb('0x43')]);return db[_0x7bdb('0x3c')]['find'](_0x4636f8)[_0x7bdb('0x24')](handleEntityNotFound(_0x8e893e,null))[_0x7bdb('0x24')](respondWithResult(_0x8e893e,null))[_0x7bdb('0x44')](handleError(_0x8e893e,null));};exports[_0x7bdb('0x45')]=function(_0x259007,_0x25c534){return db[_0x7bdb('0x3c')][_0x7bdb('0x45')](_0x259007[_0x7bdb('0x46')],{})[_0x7bdb('0x24')](respondWithResult(_0x25c534,0xc9))['catch'](handleError(_0x25c534,null));};exports[_0x7bdb('0x47')]=function(_0x58c4bc,_0x47cccd){if(_0x58c4bc[_0x7bdb('0x46')]['id']){delete _0x58c4bc[_0x7bdb('0x46')]['id'];}return db['ZendeskAccount'][_0x7bdb('0x48')]({'where':{'id':_0x58c4bc[_0x7bdb('0x49')]['id']}})['then'](handleEntityNotFound(_0x47cccd,null))['then'](saveUpdates(_0x58c4bc['body'],null))[_0x7bdb('0x24')](respondWithResult(_0x47cccd,null))[_0x7bdb('0x44')](handleError(_0x47cccd,null));};exports[_0x7bdb('0x4a')]=function(_0x46410c,_0x33687b){return db[_0x7bdb('0x3c')][_0x7bdb('0x48')]({'where':{'id':_0x46410c[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x33687b,null))[_0x7bdb('0x24')](removeEntity(_0x33687b,null))['catch'](handleError(_0x33687b,null));};exports[_0x7bdb('0x4b')]=function(_0x4806e0,_0x240425,_0x27358d){var _0x5d564d={};var _0x457886={};var _0x493d23;var _0x258f29;return db['ZendeskAccount']['findOne']({'where':{'id':_0x4806e0[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x240425,null))['then'](function(_0x4e17f3){if(_0x4e17f3){_0x493d23=_0x4e17f3;_0x457886['model']=_[_0x7bdb('0x30')](db['ZendeskConfiguration']['rawAttributes']);_0x457886[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x4806e0[_0x7bdb('0x2f')]);_0x457886[_0x7bdb('0x37')]=_['intersection'](_0x457886[_0x7bdb('0x31')],_0x457886['query']);_0x5d564d[_0x7bdb('0x32')]=_[_0x7bdb('0x40')](_0x457886[_0x7bdb('0x31')],qs[_0x7bdb('0x33')](_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x33')]));_0x5d564d['attributes']=_0x5d564d[_0x7bdb('0x32')][_0x7bdb('0x41')]?_0x5d564d[_0x7bdb('0x32')]:_0x457886['model'];_0x5d564d[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x4806e0['query'][_0x7bdb('0x35')]);_0x5d564d['where']=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x4806e0['query'],_0x457886['filters']));if(_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x39')]){_0x5d564d['where']=_[_0x7bdb('0x3a')](_0x5d564d['where'],{'$or':_[_0x7bdb('0x2a')](_0x5d564d['attributes'],function(_0x496cc3){var _0x22ef9c={};_0x22ef9c[_0x496cc3]={'$like':'%'+_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x39')]+'%'};return _0x22ef9c;})});}_0x5d564d=_[_0x7bdb('0x3a')]({},_0x5d564d,_0x4806e0[_0x7bdb('0x43')]);return _0x493d23[_0x7bdb('0x4b')](_0x5d564d);}})[_0x7bdb('0x24')](function(_0x8cf13a){if(_0x8cf13a){_0x258f29=_0x8cf13a[_0x7bdb('0x41')];if(!_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x4c')](_0x7bdb('0x4d'))){_0x5d564d['limit']=qs[_0x7bdb('0x1e')](_0x4806e0[_0x7bdb('0x2f')]['limit']);_0x5d564d[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x1b')]);}return _0x493d23[_0x7bdb('0x4b')](_0x5d564d);}})['then'](function(_0xa5624f){if(_0xa5624f){return _0xa5624f?{'count':_0x258f29,'rows':_0xa5624f}:null;}})[_0x7bdb('0x24')](respondWithResult(_0x240425,null))[_0x7bdb('0x44')](handleError(_0x240425,null));};exports['addConfiguration']=function(_0x3dbcf,_0x2c2fb7,_0x33b93a){if(_0x3dbcf[_0x7bdb('0x46')]['id']){delete _0x3dbcf[_0x7bdb('0x46')]['id'];}return db[_0x7bdb('0x3c')][_0x7bdb('0x4e')]({'where':{'id':_0x3dbcf[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x2c2fb7,null))['then'](function(_0x7a7c4a){if(_0x7a7c4a){_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x4f')]=_0x7a7c4a['id'];_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x50')]=integrations[_0x7bdb('0x51')](_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x52')],_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x2d')]);_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x53')]=integrations[_0x7bdb('0x54')](_0x3dbcf['body'][_0x7bdb('0x52')],_0x3dbcf['body'][_0x7bdb('0x2d')]);return db[_0x7bdb('0x55')][_0x7bdb('0x45')](_0x3dbcf['body'],{'include':[{'model':db[_0x7bdb('0x56')],'as':_0x7bdb('0x50')},{'model':db['ZendeskField'],'as':_0x7bdb('0x53')}]});}return null;})[_0x7bdb('0x24')](respondWithResult(_0x2c2fb7,null))['catch'](handleError(_0x2c2fb7,null));};exports[_0x7bdb('0x57')]=function(_0x1a706b,_0x579caa,_0x291fd3){var _0x237688='';return db['ZendeskAccount'][_0x7bdb('0x4e')]({'where':{'id':_0x1a706b[_0x7bdb('0x49')]['id']},'attributes':['id','username',_0x7bdb('0x58'),'token',_0x7bdb('0x59'),_0x7bdb('0x5a')]})[_0x7bdb('0x24')](handleEntityNotFound(_0x579caa,null))[_0x7bdb('0x24')](function(_0x1e5063){if(_0x1e5063){_0x237688=_0x1e5063['remoteUri'];var _0x590818=_0x237688['slice'](-0x1);if(_0x590818==='/'){_0x237688=_0x237688[_0x7bdb('0x5b')](0x0,_0x237688['lastIndexOf'](_0x590818));}var _0x242a35={'method':_0x7bdb('0x5c'),'uri':util[_0x7bdb('0x5d')]('%s/%s',_0x237688,'ticket_fields'),'json':!![]};switch(_0x1e5063[_0x7bdb('0x59')]){case _0x7bdb('0x58'):_0x242a35[_0x7bdb('0x5e')]={'Authorization':util[_0x7bdb('0x5d')]('Basic\x20%s',new Buffer(util[_0x7bdb('0x5d')](_0x7bdb('0x5f'),_0x1e5063[_0x7bdb('0x60')],_0x1e5063[_0x7bdb('0x58')]))[_0x7bdb('0x61')](_0x7bdb('0x62')))};break;case'token':_0x242a35[_0x7bdb('0x5e')]={'Authorization':util['format'](_0x7bdb('0x63'),new Buffer(util['format'](_0x7bdb('0x64'),_0x1e5063[_0x7bdb('0x60')],_0x1e5063[_0x7bdb('0x65')]))[_0x7bdb('0x61')](_0x7bdb('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0x7bdb('0x66'));}return rp(_0x242a35);}})[_0x7bdb('0x24')](function(_0x51fec5){if(_0x51fec5){var _0x415ec5=[_0x7bdb('0x67'),'description',_0x7bdb('0x68'),_0x7bdb('0x69')];_['remove'](_0x51fec5[_0x7bdb('0x6a')],function(_0x493c69){return _0x415ec5['includes'](_0x493c69[_0x7bdb('0x2d')]);});return{'count':_0x51fec5[_0x7bdb('0x6a')]['length'],'rows':_['map'](_0x51fec5[_0x7bdb('0x6a')],function(_0x566a9e){return{'id':_0x566a9e['id'],'name':_0x566a9e[_0x7bdb('0x6b')]>0x7?_0x566a9e['title']:_0x566a9e[_0x7bdb('0x2d')],'custom':_0x566a9e[_0x7bdb('0x6b')]>0x7?!![]:![],'options':_0x566a9e[_0x7bdb('0x6c')]?_0x566a9e[_0x7bdb('0x6c')]:_0x566a9e['custom_field_options']?_0x566a9e[_0x7bdb('0x6d')]:[]};})};}})[_0x7bdb('0x24')](respondWithResult(_0x579caa,null))['catch'](function(_0x2be441){var _0x3096e0=_0x1a706b['query'][_0x7bdb('0x6e')]?0x1f4:_0x2be441[_0x7bdb('0x6f')]||0x1f4;logger[_0x7bdb('0x26')](_0x7bdb('0x70'),'getFields',_0x3096e0,JSON[_0x7bdb('0x71')](_0x2be441));delete _0x2be441['name'];if(_0x3096e0===0x191){_0x3096e0=0x190;}_0x579caa[_0x7bdb('0x18')](_0x3096e0)[_0x7bdb('0x28')](_0x1a706b[_0x7bdb('0x2f')]['test']?{'message':_0x7bdb('0x72'),'statusCode':_0x2be441[_0x7bdb('0x6f')]}:_0x2be441);});};
\ No newline at end of file
+var _0x4e81=['limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','options','where','includeAll','include','findAll','show','params','find','catch','create','body','findOne','ZendeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','password','headers','Basic\x20%s','toString','base64','format','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined'];(function(_0x1f5673,_0x5ba351){var _0x490762=function(_0x52d3e3){while(--_0x52d3e3){_0x1f5673['push'](_0x1f5673['shift']());}};_0x490762(++_0x5ba351);}(_0x4e81,0x1bc));var _0x14e8=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x4e81[_0x5f25b3];return _0x4ab9bf;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x14e8('0x19'));function respondWithStatusCode(_0x59c6c9,_0x2607ef){_0x2607ef=_0x2607ef||0xcc;return function(_0x341d40){if(_0x341d40){return _0x59c6c9[_0x14e8('0x1a')](_0x2607ef);}return _0x59c6c9['status'](_0x2607ef)[_0x14e8('0x1b')]();};}function respondWithResult(_0x4e1064,_0x458e4a){_0x458e4a=_0x458e4a||0xc8;return function(_0x58d26e){if(_0x58d26e){return _0x4e1064[_0x14e8('0x1c')](_0x458e4a)[_0x14e8('0x1d')](_0x58d26e);}};}function respondWithFilteredResult(_0xc6101f,_0x135996){return function(_0x52e64f){if(_0x52e64f){var _0x10c4a9=typeof _0x135996[_0x14e8('0x1e')]===_0x14e8('0x1f')&&typeof _0x135996[_0x14e8('0x20')]===_0x14e8('0x1f');var _0x1f1a0d=_0x52e64f[_0x14e8('0x21')];var _0x462259=_0x10c4a9?0x0:_0x135996['offset'];var _0x328c5a=_0x10c4a9?_0x52e64f[_0x14e8('0x21')]:_0x135996[_0x14e8('0x1e')]+_0x135996[_0x14e8('0x20')];var _0x246c5d;if(_0x328c5a>=_0x1f1a0d){_0x328c5a=_0x1f1a0d;_0x246c5d=0xc8;}else{_0x246c5d=0xce;}_0xc6101f['status'](_0x246c5d);return _0xc6101f[_0x14e8('0x22')](_0x14e8('0x23'),_0x462259+'-'+_0x328c5a+'/'+_0x1f1a0d)[_0x14e8('0x1d')](_0x52e64f);}return null;};}function patchUpdates(_0x48e30a){return function(_0x2c3f45){try{jsonpatch['apply'](_0x2c3f45,_0x48e30a,!![]);}catch(_0x4cca43){return BPromise[_0x14e8('0x24')](_0x4cca43);}return _0x2c3f45[_0x14e8('0x25')]();};}function saveUpdates(_0x117b00,_0xcf673){return function(_0x4ad25d){if(_0x4ad25d){return _0x4ad25d[_0x14e8('0x26')](_0x117b00)['then'](function(_0x31bdd3){return _0x31bdd3;});}return null;};}function removeEntity(_0x185a0e,_0x4ffc8b){return function(_0x58a3a1){if(_0x58a3a1){return _0x58a3a1['destroy']()[_0x14e8('0x27')](function(){_0x185a0e[_0x14e8('0x1c')](0xcc)[_0x14e8('0x1b')]();});}};}function handleEntityNotFound(_0x20bfe8,_0x333d44){return function(_0x57eb46){if(!_0x57eb46){_0x20bfe8[_0x14e8('0x1a')](0x194);}return _0x57eb46;};}function handleError(_0x3fd96d,_0x3c09cb){_0x3c09cb=_0x3c09cb||0x1f4;return function(_0x2f5818){logger[_0x14e8('0x28')](_0x2f5818[_0x14e8('0x29')]);if(_0x2f5818[_0x14e8('0x2a')]){delete _0x2f5818['name'];}_0x3fd96d[_0x14e8('0x1c')](_0x3c09cb)[_0x14e8('0x2b')](_0x2f5818);};}exports[_0x14e8('0x2c')]=function(_0x5f5abb,_0x48eed0){var _0x5cacd7={},_0x8fe0e2={},_0x2a408d={'count':0x0,'rows':[]};var _0x567385=_[_0x14e8('0x2d')](db[_0x14e8('0x2e')][_0x14e8('0x2f')],function(_0xa83433){return{'name':_0xa83433['fieldName'],'type':_0xa83433[_0x14e8('0x30')][_0x14e8('0x31')]};});_0x8fe0e2[_0x14e8('0x32')]=_[_0x14e8('0x2d')](_0x567385,_0x14e8('0x2a'));_0x8fe0e2['query']=_[_0x14e8('0x33')](_0x5f5abb[_0x14e8('0x34')]);_0x8fe0e2[_0x14e8('0x35')]=_[_0x14e8('0x36')](_0x8fe0e2['model'],_0x8fe0e2[_0x14e8('0x34')]);_0x5cacd7['attributes']=_[_0x14e8('0x36')](_0x8fe0e2[_0x14e8('0x32')],qs[_0x14e8('0x37')](_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x37')]));_0x5cacd7[_0x14e8('0x38')]=_0x5cacd7[_0x14e8('0x38')][_0x14e8('0x39')]?_0x5cacd7[_0x14e8('0x38')]:_0x8fe0e2[_0x14e8('0x32')];if(!_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x3a')]('nolimit')){_0x5cacd7['limit']=qs['limit'](_0x5f5abb[_0x14e8('0x34')]['limit']);_0x5cacd7[_0x14e8('0x1e')]=qs['offset'](_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x1e')]);}_0x5cacd7[_0x14e8('0x3b')]=qs[_0x14e8('0x3c')](_0x5f5abb['query'][_0x14e8('0x3c')]);_0x5cacd7['where']=qs[_0x14e8('0x35')](_[_0x14e8('0x3d')](_0x5f5abb[_0x14e8('0x34')],_0x8fe0e2[_0x14e8('0x35')]),_0x567385);if(_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x3e')]){_0x5cacd7['where']=_[_0x14e8('0x3f')](_0x5cacd7['where'],{'$or':_[_0x14e8('0x2d')](_0x567385,function(_0x20f69d){if(_0x20f69d[_0x14e8('0x30')]!=='VIRTUAL'){var _0x27d51b={};_0x27d51b[_0x20f69d[_0x14e8('0x2a')]]={'$like':'%'+_0x5f5abb['query'][_0x14e8('0x3e')]+'%'};return _0x27d51b;}})});}_0x5cacd7=_[_0x14e8('0x3f')]({},_0x5cacd7,_0x5f5abb[_0x14e8('0x40')]);var _0x3a7aa7={'where':_0x5cacd7[_0x14e8('0x41')]};return db[_0x14e8('0x2e')][_0x14e8('0x21')](_0x3a7aa7)[_0x14e8('0x27')](function(_0x33743a){_0x2a408d[_0x14e8('0x21')]=_0x33743a;if(_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x42')]){_0x5cacd7[_0x14e8('0x43')]=[{'all':!![]}];}return db[_0x14e8('0x2e')][_0x14e8('0x44')](_0x5cacd7);})['then'](function(_0x24c9e6){_0x2a408d['rows']=_0x24c9e6;return _0x2a408d;})['then'](respondWithFilteredResult(_0x48eed0,_0x5cacd7))['catch'](handleError(_0x48eed0,null));};exports[_0x14e8('0x45')]=function(_0x5ed821,_0x46a3c4){var _0x45bff0={'raw':![],'where':{'id':_0x5ed821[_0x14e8('0x46')]['id']}},_0x7907e8={};_0x7907e8[_0x14e8('0x32')]=_[_0x14e8('0x33')](db[_0x14e8('0x2e')][_0x14e8('0x2f')]);_0x7907e8[_0x14e8('0x34')]=_[_0x14e8('0x33')](_0x5ed821[_0x14e8('0x34')]);_0x7907e8['filters']=_[_0x14e8('0x36')](_0x7907e8[_0x14e8('0x32')],_0x7907e8[_0x14e8('0x34')]);_0x45bff0[_0x14e8('0x38')]=_['intersection'](_0x7907e8[_0x14e8('0x32')],qs[_0x14e8('0x37')](_0x5ed821['query']['fields']));_0x45bff0[_0x14e8('0x38')]=_0x45bff0['attributes']['length']?_0x45bff0[_0x14e8('0x38')]:_0x7907e8[_0x14e8('0x32')];if(_0x5ed821['query'][_0x14e8('0x42')]){_0x45bff0[_0x14e8('0x43')]=[{'all':!![]}];}_0x45bff0=_['merge']({},_0x45bff0,_0x5ed821[_0x14e8('0x40')]);return db[_0x14e8('0x2e')][_0x14e8('0x47')](_0x45bff0)[_0x14e8('0x27')](handleEntityNotFound(_0x46a3c4,null))[_0x14e8('0x27')](respondWithResult(_0x46a3c4,null))[_0x14e8('0x48')](handleError(_0x46a3c4,null));};exports[_0x14e8('0x49')]=function(_0x2541ad,_0x146e2c){return db[_0x14e8('0x2e')][_0x14e8('0x49')](_0x2541ad[_0x14e8('0x4a')],{})[_0x14e8('0x27')](respondWithResult(_0x146e2c,0xc9))[_0x14e8('0x48')](handleError(_0x146e2c,null));};exports[_0x14e8('0x26')]=function(_0x1f50bc,_0x59820f){if(_0x1f50bc[_0x14e8('0x4a')]['id']){delete _0x1f50bc['body']['id'];}return db[_0x14e8('0x2e')][_0x14e8('0x47')]({'where':{'id':_0x1f50bc[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x59820f,null))['then'](saveUpdates(_0x1f50bc['body'],null))['then'](respondWithResult(_0x59820f,null))[_0x14e8('0x48')](handleError(_0x59820f,null));};exports['destroy']=function(_0x55f9b0,_0xd2b281){return db[_0x14e8('0x2e')]['find']({'where':{'id':_0x55f9b0[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0xd2b281,null))[_0x14e8('0x27')](removeEntity(_0xd2b281,null))[_0x14e8('0x48')](handleError(_0xd2b281,null));};exports['getConfigurations']=function(_0x519c9c,_0x1cdcca,_0xc602b1){var _0x15464a={};var _0x3a09b7={};var _0x41b5ab;var _0x2fbac7;return db['ZendeskAccount'][_0x14e8('0x4b')]({'where':{'id':_0x519c9c[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x1cdcca,null))[_0x14e8('0x27')](function(_0x5e6083){if(_0x5e6083){_0x41b5ab=_0x5e6083;_0x3a09b7[_0x14e8('0x32')]=_[_0x14e8('0x33')](db[_0x14e8('0x4c')][_0x14e8('0x2f')]);_0x3a09b7['query']=_[_0x14e8('0x33')](_0x519c9c[_0x14e8('0x34')]);_0x3a09b7[_0x14e8('0x35')]=_[_0x14e8('0x36')](_0x3a09b7[_0x14e8('0x32')],_0x3a09b7[_0x14e8('0x34')]);_0x15464a[_0x14e8('0x38')]=_[_0x14e8('0x36')](_0x3a09b7['model'],qs['fields'](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x37')]));_0x15464a[_0x14e8('0x38')]=_0x15464a[_0x14e8('0x38')][_0x14e8('0x39')]?_0x15464a['attributes']:_0x3a09b7['model'];_0x15464a['order']=qs[_0x14e8('0x3c')](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3c')]);_0x15464a['where']=qs[_0x14e8('0x35')](_[_0x14e8('0x3d')](_0x519c9c[_0x14e8('0x34')],_0x3a09b7['filters']));if(_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3e')]){_0x15464a[_0x14e8('0x41')]=_[_0x14e8('0x3f')](_0x15464a[_0x14e8('0x41')],{'$or':_[_0x14e8('0x2d')](_0x15464a[_0x14e8('0x38')],function(_0x12a2b3){var _0x2da07b={};_0x2da07b[_0x12a2b3]={'$like':'%'+_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3e')]+'%'};return _0x2da07b;})});}_0x15464a=_['merge']({},_0x15464a,_0x519c9c[_0x14e8('0x40')]);return _0x41b5ab[_0x14e8('0x4d')](_0x15464a);}})[_0x14e8('0x27')](function(_0x38e79a){if(_0x38e79a){_0x2fbac7=_0x38e79a[_0x14e8('0x39')];if(!_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3a')](_0x14e8('0x4e'))){_0x15464a[_0x14e8('0x20')]=qs[_0x14e8('0x20')](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x20')]);_0x15464a['offset']=qs[_0x14e8('0x1e')](_0x519c9c[_0x14e8('0x34')]['offset']);}return _0x41b5ab[_0x14e8('0x4d')](_0x15464a);}})[_0x14e8('0x27')](function(_0x31e785){if(_0x31e785){return _0x31e785?{'count':_0x2fbac7,'rows':_0x31e785}:null;}})[_0x14e8('0x27')](respondWithResult(_0x1cdcca,null))[_0x14e8('0x48')](handleError(_0x1cdcca,null));};exports[_0x14e8('0x4f')]=function(_0x139405,_0x5b6e28,_0x4c30dd){if(_0x139405['body']['id']){delete _0x139405[_0x14e8('0x4a')]['id'];}return db[_0x14e8('0x2e')][_0x14e8('0x4b')]({'where':{'id':_0x139405[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x5b6e28,null))[_0x14e8('0x27')](function(_0x402956){if(_0x402956){_0x139405['body'][_0x14e8('0x50')]=_0x402956['id'];_0x139405[_0x14e8('0x4a')]['Subjects']=integrations[_0x14e8('0x51')](_0x139405[_0x14e8('0x4a')]['channel'],_0x139405['body']['type']);_0x139405[_0x14e8('0x4a')][_0x14e8('0x52')]=integrations[_0x14e8('0x53')](_0x139405[_0x14e8('0x4a')]['channel'],_0x139405[_0x14e8('0x4a')][_0x14e8('0x30')]);return db[_0x14e8('0x4c')][_0x14e8('0x49')](_0x139405[_0x14e8('0x4a')],{'include':[{'model':db[_0x14e8('0x54')],'as':'Subjects'},{'model':db[_0x14e8('0x54')],'as':_0x14e8('0x52')}]});}return null;})[_0x14e8('0x27')](respondWithResult(_0x5b6e28,null))['catch'](handleError(_0x5b6e28,null));};exports['getFields']=function(_0x20a598,_0x53d0c8,_0x25f63c){var _0x5cbce8='';return db[_0x14e8('0x2e')]['findOne']({'where':{'id':_0x20a598[_0x14e8('0x46')]['id']},'attributes':['id',_0x14e8('0x55'),'password',_0x14e8('0x56'),_0x14e8('0x57'),_0x14e8('0x58')]})[_0x14e8('0x27')](handleEntityNotFound(_0x53d0c8,null))[_0x14e8('0x27')](function(_0x6dee32){if(_0x6dee32){_0x5cbce8=_0x6dee32[_0x14e8('0x58')];var _0x2ba695=_0x5cbce8[_0x14e8('0x59')](-0x1);if(_0x2ba695==='/'){_0x5cbce8=_0x5cbce8[_0x14e8('0x5a')](0x0,_0x5cbce8[_0x14e8('0x5b')](_0x2ba695));}var _0x2e0e7d={'method':_0x14e8('0x5c'),'uri':util['format']('%s/%s',_0x5cbce8,'ticket_fields'),'json':!![]};switch(_0x6dee32[_0x14e8('0x57')]){case _0x14e8('0x5d'):_0x2e0e7d[_0x14e8('0x5e')]={'Authorization':util['format'](_0x14e8('0x5f'),new Buffer(util['format']('%s:%s',_0x6dee32['username'],_0x6dee32[_0x14e8('0x5d')]))[_0x14e8('0x60')](_0x14e8('0x61')))};break;case'token':_0x2e0e7d[_0x14e8('0x5e')]={'Authorization':util['format'](_0x14e8('0x5f'),new Buffer(util[_0x14e8('0x62')](_0x14e8('0x63'),_0x6dee32[_0x14e8('0x55')],_0x6dee32[_0x14e8('0x56')]))[_0x14e8('0x60')](_0x14e8('0x61')))};break;default:throw new db[(_0x14e8('0x64'))][(_0x14e8('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x2e0e7d);}})[_0x14e8('0x27')](function(_0x4eb2ef){if(_0x4eb2ef){var _0x355395=[_0x14e8('0x66'),_0x14e8('0x67'),_0x14e8('0x68'),_0x14e8('0x69')];_[_0x14e8('0x6a')](_0x4eb2ef[_0x14e8('0x6b')],function(_0x308617){return _0x355395[_0x14e8('0x6c')](_0x308617['type']);});return{'count':_0x4eb2ef[_0x14e8('0x6b')][_0x14e8('0x39')],'rows':_[_0x14e8('0x2d')](_0x4eb2ef[_0x14e8('0x6b')],function(_0x492757){return{'id':_0x492757['id'],'name':_0x492757[_0x14e8('0x6d')]>0x7?_0x492757[_0x14e8('0x6e')]:_0x492757[_0x14e8('0x30')],'custom':_0x492757[_0x14e8('0x6d')]>0x7?!![]:![],'options':_0x492757['system_field_options']?_0x492757[_0x14e8('0x6f')]:_0x492757['custom_field_options']?_0x492757[_0x14e8('0x70')]:[]};})};}})['then'](respondWithResult(_0x53d0c8,null))['catch'](function(_0x3e820f){var _0xb68079=_0x20a598[_0x14e8('0x34')][_0x14e8('0x71')]?0x1f4:_0x3e820f[_0x14e8('0x72')]||0x1f4;logger[_0x14e8('0x28')](_0x14e8('0x73'),_0x14e8('0x74'),_0xb68079,JSON[_0x14e8('0x75')](_0x3e820f));delete _0x3e820f[_0x14e8('0x2a')];if(_0xb68079===0x191){_0xb68079=0x190;}_0x53d0c8[_0x14e8('0x1c')](_0xb68079)['send'](_0x20a598[_0x14e8('0x34')][_0x14e8('0x71')]?{'message':_0x14e8('0x76'),'statusCode':_0x3e820f['statusCode']}:_0x3e820f);});};
\ No newline at end of file
index 32e36e8..3a34aea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d24=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x5e370e,_0x2b2f55){var _0x4cbf6b=function(_0x4d1f0c){while(--_0x4d1f0c){_0x5e370e['push'](_0x5e370e['shift']());}};_0x4cbf6b(++_0x2b2f55);}(_0x6d24,0x166));var _0x46d2=function(_0x442b6b,_0x2856a2){_0x442b6b=_0x442b6b-0x0;var _0x7cfac0=_0x6d24[_0x442b6b];return _0x7cfac0;};'use strict';var _=require(_0x46d2('0x0'));var util=require(_0x46d2('0x1'));var logger=require(_0x46d2('0x2'))(_0x46d2('0x3'));var moment=require(_0x46d2('0x4'));var BPromise=require(_0x46d2('0x5'));var rp=require(_0x46d2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46d2('0x7'));var config=require(_0x46d2('0x8'));var attributes=require(_0x46d2('0x9'));var integrations=require(_0x46d2('0xa'));module[_0x46d2('0xb')]=function(_0x2c8084,_0x1d647d){return _0x2c8084[_0x46d2('0xc')](_0x46d2('0xd'),attributes,{'tableName':_0x46d2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc6fd=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xc6fd,0x11d));var _0xdc6f=function(_0x22e4db,_0x3df78b){_0x22e4db=_0x22e4db-0x0;var _0x542583=_0xc6fd[_0x22e4db];return _0x542583;};'use strict';var _=require(_0xdc6f('0x0'));var util=require(_0xdc6f('0x1'));var logger=require('../../config/logger')(_0xdc6f('0x2'));var moment=require(_0xdc6f('0x3'));var BPromise=require(_0xdc6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc6f('0x5'));var rimraf=require(_0xdc6f('0x6'));var config=require(_0xdc6f('0x7'));var attributes=require(_0xdc6f('0x8'));var integrations=require(_0xdc6f('0x9'));module[_0xdc6f('0xa')]=function(_0x502ce8,_0x2bc134){return _0x502ce8[_0xdc6f('0xb')](_0xdc6f('0xc'),attributes,{'tableName':_0xdc6f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bd46f4e..5571160 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5057=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowZendeskAccount','debug','lodash','util','moment'];(function(_0x4fbfb1,_0x4f8fc4){var _0x4f6cf4=function(_0x1a9797){while(--_0x1a9797){_0x4fbfb1['push'](_0x4fbfb1['shift']());}};_0x4f6cf4(++_0x4f8fc4);}(_0x5057,0x151));var _0x7505=function(_0x8c26f5,_0x5bd361){_0x8c26f5=_0x8c26f5-0x0;var _0x1efcab=_0x5057[_0x8c26f5];return _0x1efcab;};'use strict';var _=require(_0x7505('0x0'));var util=require(_0x7505('0x1'));var moment=require(_0x7505('0x2'));var BPromise=require('bluebird');var rs=require(_0x7505('0x3'));var fs=require('fs');var Redis=require(_0x7505('0x4'));var db=require(_0x7505('0x5'))['db'];var utils=require(_0x7505('0x6'));var logger=require('../../config/logger')(_0x7505('0x7'));var config=require(_0x7505('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7505('0x9')][_0x7505('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288914,_0x273f93,_0x254212){return new BPromise(function(_0x2f2772,_0x4e3c23){return client[_0x7505('0xb')](_0x288914,_0x254212)['then'](function(_0x350215){logger[_0x7505('0xc')](_0x7505('0xd'),_0x273f93,'request\x20sent');logger['debug'](_0x7505('0xe'),_0x273f93,_0x7505('0xf'),JSON[_0x7505('0x10')](_0x350215));if(_0x350215[_0x7505('0x11')]){if(_0x350215[_0x7505('0x11')]['code']===0x1f4){logger[_0x7505('0x11')](_0x7505('0xd'),_0x273f93,_0x350215['error'][_0x7505('0x12')]);return _0x4e3c23(_0x350215['error'][_0x7505('0x12')]);}logger[_0x7505('0x11')](_0x7505('0xd'),_0x273f93,_0x350215['error'][_0x7505('0x12')]);return _0x2f2772(_0x350215['error'][_0x7505('0x12')]);}else{logger['info'](_0x7505('0xd'),_0x273f93,'request\x20sent');_0x2f2772(_0x350215[_0x7505('0x13')]['message']);}})[_0x7505('0x14')](function(_0x1fd50a){logger[_0x7505('0x11')](_0x7505('0xd'),_0x273f93,_0x1fd50a);_0x4e3c23(_0x1fd50a);});});}exports[_0x7505('0x15')]=function(_0x4bb793){var _0x188515=this;return new Promise(function(_0x1d59d8,_0x450868){return db[_0x7505('0x16')][_0x7505('0x17')]({'raw':_0x4bb793[_0x7505('0x18')]?_0x4bb793[_0x7505('0x18')][_0x7505('0x19')]===undefined?!![]:![]:!![],'where':_0x4bb793[_0x7505('0x18')]?_0x4bb793[_0x7505('0x18')][_0x7505('0x1a')]||null:null,'attributes':_0x4bb793['options']?_0x4bb793['options'][_0x7505('0x1b')]||null:null,'limit':_0x4bb793[_0x7505('0x18')]?_0x4bb793[_0x7505('0x18')]['limit']||null:null,'include':_0x4bb793[_0x7505('0x18')]?_0x4bb793[_0x7505('0x18')][_0x7505('0x1c')]?_[_0x7505('0x1d')](_0x4bb793['options']['include'],function(_0x16fbbc){return{'model':db[_0x16fbbc[_0x7505('0x1e')]],'as':_0x16fbbc['as'],'attributes':_0x16fbbc[_0x7505('0x1b')],'include':_0x16fbbc[_0x7505('0x1c')]?_['map'](_0x16fbbc[_0x7505('0x1c')],function(_0x14fce6){return{'model':db[_0x14fce6[_0x7505('0x1e')]],'as':_0x14fce6['as'],'attributes':_0x14fce6[_0x7505('0x1b')],'include':_0x14fce6[_0x7505('0x1c')]?_['map'](_0x14fce6[_0x7505('0x1c')],function(_0x3044bb){return{'model':db[_0x3044bb['model']],'as':_0x3044bb['as'],'attributes':_0x3044bb[_0x7505('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7505('0x1f')](function(_0x5cc785){logger[_0x7505('0xc')](_0x7505('0x15'),_0x4bb793);logger['debug'](_0x7505('0x15'),_0x4bb793,JSON['stringify'](_0x5cc785));_0x1d59d8(_0x5cc785);})['catch'](function(_0x5b7f09){logger[_0x7505('0x11')]('GetZendeskAccount',_0x5b7f09[_0x7505('0x12')],_0x4bb793);_0x450868(_0x188515[_0x7505('0x11')](0x1f4,_0x5b7f09[_0x7505('0x12')]));});});};exports[_0x7505('0x20')]=function(_0x3d4dc6){var _0x27da53=this;return new Promise(function(_0x34e931,_0x44eb42){return db[_0x7505('0x16')]['find']({'raw':_0x3d4dc6['options']?_0x3d4dc6[_0x7505('0x18')][_0x7505('0x19')]===undefined?!![]:![]:!![],'where':_0x3d4dc6[_0x7505('0x18')]?_0x3d4dc6[_0x7505('0x18')][_0x7505('0x1a')]||null:null,'attributes':_0x3d4dc6['options']?_0x3d4dc6[_0x7505('0x18')][_0x7505('0x1b')]||null:null,'include':_0x3d4dc6[_0x7505('0x18')]?_0x3d4dc6['options'][_0x7505('0x1c')]?_['map'](_0x3d4dc6[_0x7505('0x18')][_0x7505('0x1c')],function(_0x13221d){return{'model':db[_0x13221d[_0x7505('0x1e')]],'as':_0x13221d['as'],'attributes':_0x13221d['attributes'],'include':_0x13221d[_0x7505('0x1c')]?_['map'](_0x13221d[_0x7505('0x1c')],function(_0x1d0c75){return{'model':db[_0x1d0c75['model']],'as':_0x1d0c75['as'],'attributes':_0x1d0c75[_0x7505('0x1b')],'include':_0x1d0c75['include']?_[_0x7505('0x1d')](_0x1d0c75[_0x7505('0x1c')],function(_0x308767){return{'model':db[_0x308767[_0x7505('0x1e')]],'as':_0x308767['as'],'attributes':_0x308767['attributes']};}):[]};}):[]};}):[]:[]})[_0x7505('0x1f')](function(_0x42df7f){logger['info'](_0x7505('0x20'),_0x3d4dc6);logger[_0x7505('0x21')]('ShowZendeskAccount',_0x3d4dc6,JSON[_0x7505('0x10')](_0x42df7f));_0x34e931(_0x42df7f);})[_0x7505('0x14')](function(_0x474435){logger[_0x7505('0x11')](_0x7505('0x20'),_0x474435['message'],_0x3d4dc6);_0x44eb42(_0x27da53[_0x7505('0x11')](0x1f4,_0x474435[_0x7505('0x12')]));});});};
\ No newline at end of file
+var _0xe585=['where','attributes','limit','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ZendeskAccount','options','raw'];(function(_0x42120b,_0x37c565){var _0x5cef94=function(_0x241e81){while(--_0x241e81){_0x42120b['push'](_0x42120b['shift']());}};_0x5cef94(++_0x37c565);}(_0xe585,0x9a));var _0x5e58=function(_0x427975,_0x2b2956){_0x427975=_0x427975-0x0;var _0x227be5=_0xe585[_0x427975];return _0x227be5;};'use strict';var _=require(_0x5e58('0x0'));var util=require('util');var moment=require(_0x5e58('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e58('0x2'));var fs=require('fs');var Redis=require(_0x5e58('0x3'));var db=require(_0x5e58('0x4'))['db'];var utils=require(_0x5e58('0x5'));var logger=require(_0x5e58('0x6'))(_0x5e58('0x7'));var config=require(_0x5e58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5e58('0x9')][_0x5e58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x351ad4,_0x30f05b,_0x3e8b0f){return new BPromise(function(_0x587424,_0x244ee5){return client[_0x5e58('0xb')](_0x351ad4,_0x3e8b0f)[_0x5e58('0xc')](function(_0x57cf49){logger['info'](_0x5e58('0xd'),_0x30f05b,_0x5e58('0xe'));logger[_0x5e58('0xf')](_0x5e58('0x10'),_0x30f05b,'request\x20sent',JSON['stringify'](_0x57cf49));if(_0x57cf49[_0x5e58('0x11')]){if(_0x57cf49['error'][_0x5e58('0x12')]===0x1f4){logger[_0x5e58('0x11')](_0x5e58('0xd'),_0x30f05b,_0x57cf49[_0x5e58('0x11')][_0x5e58('0x13')]);return _0x244ee5(_0x57cf49[_0x5e58('0x11')][_0x5e58('0x13')]);}logger['error'](_0x5e58('0xd'),_0x30f05b,_0x57cf49[_0x5e58('0x11')][_0x5e58('0x13')]);return _0x587424(_0x57cf49[_0x5e58('0x11')]['message']);}else{logger[_0x5e58('0x14')](_0x5e58('0xd'),_0x30f05b,'request\x20sent');_0x587424(_0x57cf49[_0x5e58('0x15')]['message']);}})[_0x5e58('0x16')](function(_0xdade30){logger['error'](_0x5e58('0xd'),_0x30f05b,_0xdade30);_0x244ee5(_0xdade30);});});}exports['GetZendeskAccount']=function(_0x3ecfb8){var _0x4f67c6=this;return new Promise(function(_0x1b2c82,_0x4edbc0){return db[_0x5e58('0x17')]['findAll']({'raw':_0x3ecfb8[_0x5e58('0x18')]?_0x3ecfb8['options'][_0x5e58('0x19')]===undefined?!![]:![]:!![],'where':_0x3ecfb8[_0x5e58('0x18')]?_0x3ecfb8[_0x5e58('0x18')][_0x5e58('0x1a')]||null:null,'attributes':_0x3ecfb8['options']?_0x3ecfb8[_0x5e58('0x18')][_0x5e58('0x1b')]||null:null,'limit':_0x3ecfb8['options']?_0x3ecfb8[_0x5e58('0x18')][_0x5e58('0x1c')]||null:null,'include':_0x3ecfb8[_0x5e58('0x18')]?_0x3ecfb8['options'][_0x5e58('0x1d')]?_[_0x5e58('0x1e')](_0x3ecfb8['options'][_0x5e58('0x1d')],function(_0x378e8d){return{'model':db[_0x378e8d['model']],'as':_0x378e8d['as'],'attributes':_0x378e8d[_0x5e58('0x1b')],'include':_0x378e8d['include']?_[_0x5e58('0x1e')](_0x378e8d[_0x5e58('0x1d')],function(_0x3856ad){return{'model':db[_0x3856ad[_0x5e58('0x1f')]],'as':_0x3856ad['as'],'attributes':_0x3856ad['attributes'],'include':_0x3856ad[_0x5e58('0x1d')]?_[_0x5e58('0x1e')](_0x3856ad['include'],function(_0x4313ac){return{'model':db[_0x4313ac[_0x5e58('0x1f')]],'as':_0x4313ac['as'],'attributes':_0x4313ac[_0x5e58('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5e58('0xc')](function(_0x2401b8){logger[_0x5e58('0x14')](_0x5e58('0x20'),_0x3ecfb8);logger[_0x5e58('0xf')](_0x5e58('0x20'),_0x3ecfb8,JSON[_0x5e58('0x21')](_0x2401b8));_0x1b2c82(_0x2401b8);})[_0x5e58('0x16')](function(_0x133e58){logger[_0x5e58('0x11')]('GetZendeskAccount',_0x133e58[_0x5e58('0x13')],_0x3ecfb8);_0x4edbc0(_0x4f67c6[_0x5e58('0x11')](0x1f4,_0x133e58[_0x5e58('0x13')]));});});};exports[_0x5e58('0x22')]=function(_0x216594){var _0x2052c8=this;return new Promise(function(_0x21dd2a,_0x5ade0d){return db['ZendeskAccount'][_0x5e58('0x23')]({'raw':_0x216594[_0x5e58('0x18')]?_0x216594[_0x5e58('0x18')][_0x5e58('0x19')]===undefined?!![]:![]:!![],'where':_0x216594['options']?_0x216594[_0x5e58('0x18')][_0x5e58('0x1a')]||null:null,'attributes':_0x216594[_0x5e58('0x18')]?_0x216594[_0x5e58('0x18')][_0x5e58('0x1b')]||null:null,'include':_0x216594['options']?_0x216594[_0x5e58('0x18')][_0x5e58('0x1d')]?_['map'](_0x216594[_0x5e58('0x18')][_0x5e58('0x1d')],function(_0x5a1aeb){return{'model':db[_0x5a1aeb[_0x5e58('0x1f')]],'as':_0x5a1aeb['as'],'attributes':_0x5a1aeb['attributes'],'include':_0x5a1aeb['include']?_['map'](_0x5a1aeb[_0x5e58('0x1d')],function(_0x2ee3ea){return{'model':db[_0x2ee3ea['model']],'as':_0x2ee3ea['as'],'attributes':_0x2ee3ea['attributes'],'include':_0x2ee3ea['include']?_[_0x5e58('0x1e')](_0x2ee3ea[_0x5e58('0x1d')],function(_0x2292bd){return{'model':db[_0x2292bd['model']],'as':_0x2292bd['as'],'attributes':_0x2292bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e58('0xc')](function(_0x44c7a0){logger['info']('ShowZendeskAccount',_0x216594);logger[_0x5e58('0xf')](_0x5e58('0x22'),_0x216594,JSON[_0x5e58('0x21')](_0x44c7a0));_0x21dd2a(_0x44c7a0);})[_0x5e58('0x16')](function(_0x1bad03){logger[_0x5e58('0x11')](_0x5e58('0x22'),_0x1bad03['message'],_0x216594);_0x5ade0d(_0x2052c8['error'](0x1f4,_0x1bad03[_0x5e58('0x13')]));});});};
\ No newline at end of file
index 3341fd6..460ad7c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x81ab8b,_0x5677be){var _0x377eba=function(_0x4eb469){while(--_0x4eb469){_0x81ab8b['push'](_0x81ab8b['shift']());}};_0x377eba(++_0x5677be);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router;
\ No newline at end of file
+var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x2f9b8d,_0x2335f3){var _0x4367e0=function(_0x361993){while(--_0x361993){_0x2f9b8d['push'](_0x2f9b8d['shift']());}};_0x4367e0(++_0x2335f3);}(_0xa571,0x107));var _0x1a57=function(_0x14f55c,_0x2adaaf){_0x14f55c=_0x14f55c-0x0;var _0x513e7a=_0xa571[_0x14f55c];return _0x513e7a;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router;
\ No newline at end of file
index a19067d..b3ef0ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09f0=['STRING'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x09f0,0xdc));var _0x009f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x09f0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x009f('0x0')]},'description':{'type':Sequelize[_0x009f('0x0')]}};
\ No newline at end of file
+var _0xfea0=['exports','STRING'];(function(_0x4a3e52,_0x279057){var _0x5e10d0=function(_0x46b05d){while(--_0x46b05d){_0x4a3e52['push'](_0x4a3e52['shift']());}};_0x5e10d0(++_0x279057);}(_0xfea0,0x132));var _0x0fea=function(_0x23b44b,_0x55c618){_0x23b44b=_0x23b44b-0x0;var _0x37d039=_0xfea0[_0x23b44b];return _0x37d039;};'use strict';var Sequelize=require('sequelize');module[_0x0fea('0x0')]={'name':{'type':Sequelize[_0x0fea('0x1')]},'description':{'type':Sequelize[_0x0fea('0x1')]}};
\ No newline at end of file
index a01f5b5..5ded6a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac55=['ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','then','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getFields','findOne'];(function(_0x4eac00,_0x78486e){var _0x3ddfc5=function(_0x2352fd){while(--_0x2352fd){_0x4eac00['push'](_0x4eac00['shift']());}};_0x3ddfc5(++_0x78486e);}(_0xac55,0x1b1));var _0x5ac5=function(_0x35ddf6,_0x382ce8){_0x35ddf6=_0x35ddf6-0x0;var _0x4d5930=_0xac55[_0x35ddf6];return _0x4d5930;};'use strict';var emlformat=require(_0x5ac5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ac5('0x1'));var jsonpatch=require(_0x5ac5('0x2'));var rp=require('request-promise');var moment=require(_0x5ac5('0x3'));var BPromise=require(_0x5ac5('0x4'));var Mustache=require(_0x5ac5('0x5'));var util=require(_0x5ac5('0x6'));var path=require('path');var sox=require(_0x5ac5('0x7'));var csv=require(_0x5ac5('0x8'));var ejs=require(_0x5ac5('0x9'));var fs=require('fs');var fs_extra=require(_0x5ac5('0xa'));var _=require(_0x5ac5('0xb'));var squel=require(_0x5ac5('0xc'));var crypto=require(_0x5ac5('0xd'));var jsforce=require(_0x5ac5('0xe'));var deskjs=require(_0x5ac5('0xf'));var toCsv=require(_0x5ac5('0x8'));var querystring=require('querystring');var Papa=require(_0x5ac5('0x10'));var Redis=require(_0x5ac5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5ac5('0x12'));var as=require(_0x5ac5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac5('0x14'))(_0x5ac5('0x15'));var utils=require('../../config/utils');var config=require(_0x5ac5('0x16'));var licenseUtil=require(_0x5ac5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x928b55,_0x5638a8){_0x5638a8=_0x5638a8||0xcc;return function(_0x5510e5){if(_0x5510e5){return _0x928b55[_0x5ac5('0x18')](_0x5638a8);}return _0x928b55[_0x5ac5('0x19')](_0x5638a8)[_0x5ac5('0x1a')]();};}function respondWithResult(_0x1e5ae1,_0x1965df){_0x1965df=_0x1965df||0xc8;return function(_0x550eb7){if(_0x550eb7){return _0x1e5ae1[_0x5ac5('0x19')](_0x1965df)[_0x5ac5('0x1b')](_0x550eb7);}};}function respondWithFilteredResult(_0x22b21a,_0x5cc0b0){return function(_0x883a6a){if(_0x883a6a){var _0x4a2e04=typeof _0x5cc0b0[_0x5ac5('0x1c')]==='undefined'&&typeof _0x5cc0b0[_0x5ac5('0x1d')]===_0x5ac5('0x1e');var _0x5e5971=_0x883a6a[_0x5ac5('0x1f')];var _0x5f1be3=_0x4a2e04?0x0:_0x5cc0b0[_0x5ac5('0x1c')];var _0x1fa457=_0x4a2e04?_0x883a6a[_0x5ac5('0x1f')]:_0x5cc0b0['offset']+_0x5cc0b0[_0x5ac5('0x1d')];var _0x335388;if(_0x1fa457>=_0x5e5971){_0x1fa457=_0x5e5971;_0x335388=0xc8;}else{_0x335388=0xce;}_0x22b21a[_0x5ac5('0x19')](_0x335388);return _0x22b21a[_0x5ac5('0x20')](_0x5ac5('0x21'),_0x5f1be3+'-'+_0x1fa457+'/'+_0x5e5971)[_0x5ac5('0x1b')](_0x883a6a);}return null;};}function patchUpdates(_0x522170){return function(_0xd1243e){try{jsonpatch[_0x5ac5('0x22')](_0xd1243e,_0x522170,!![]);}catch(_0x4f22e9){return BPromise[_0x5ac5('0x23')](_0x4f22e9);}return _0xd1243e['save']();};}function saveUpdates(_0x12314a,_0x289d54){return function(_0x47ae1a){if(_0x47ae1a){return _0x47ae1a[_0x5ac5('0x24')](_0x12314a)['then'](function(_0x72f038){return _0x72f038;});}return null;};}function removeEntity(_0x85d5ac,_0x3a41a3){return function(_0x3c0c7f){if(_0x3c0c7f){return _0x3c0c7f[_0x5ac5('0x25')]()['then'](function(){_0x85d5ac['status'](0xcc)[_0x5ac5('0x1a')]();});}};}function handleEntityNotFound(_0x76e858,_0x3cc90f){return function(_0x39efc8){if(!_0x39efc8){_0x76e858[_0x5ac5('0x18')](0x194);}return _0x39efc8;};}function handleError(_0x33aa58,_0x2ebb11){_0x2ebb11=_0x2ebb11||0x1f4;return function(_0x411c8a){logger[_0x5ac5('0x26')](_0x411c8a[_0x5ac5('0x27')]);if(_0x411c8a[_0x5ac5('0x28')]){delete _0x411c8a[_0x5ac5('0x28')];}_0x33aa58[_0x5ac5('0x19')](_0x2ebb11)[_0x5ac5('0x29')](_0x411c8a);};}exports[_0x5ac5('0x2a')]=function(_0x4e7f63,_0x1e591d){var _0x2c01e1={},_0x2de4f5={},_0x5c0740={'count':0x0,'rows':[]};var _0x4762b7=_[_0x5ac5('0x2b')](db[_0x5ac5('0x2c')]['rawAttributes'],function(_0x1771cb){return{'name':_0x1771cb[_0x5ac5('0x2d')],'type':_0x1771cb['type'][_0x5ac5('0x2e')]};});_0x2de4f5[_0x5ac5('0x2f')]=_[_0x5ac5('0x2b')](_0x4762b7,'name');_0x2de4f5[_0x5ac5('0x30')]=_[_0x5ac5('0x31')](_0x4e7f63[_0x5ac5('0x30')]);_0x2de4f5[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x2de4f5['model'],_0x2de4f5[_0x5ac5('0x30')]);_0x2c01e1[_0x5ac5('0x34')]=_[_0x5ac5('0x33')](_0x2de4f5[_0x5ac5('0x2f')],qs[_0x5ac5('0x35')](_0x4e7f63['query'][_0x5ac5('0x35')]));_0x2c01e1[_0x5ac5('0x34')]=_0x2c01e1[_0x5ac5('0x34')][_0x5ac5('0x36')]?_0x2c01e1['attributes']:_0x2de4f5['model'];if(!_0x4e7f63[_0x5ac5('0x30')][_0x5ac5('0x37')]('nolimit')){_0x2c01e1[_0x5ac5('0x1d')]=qs['limit'](_0x4e7f63['query'][_0x5ac5('0x1d')]);_0x2c01e1['offset']=qs[_0x5ac5('0x1c')](_0x4e7f63[_0x5ac5('0x30')][_0x5ac5('0x1c')]);}_0x2c01e1[_0x5ac5('0x38')]=qs[_0x5ac5('0x39')](_0x4e7f63['query'][_0x5ac5('0x39')]);_0x2c01e1[_0x5ac5('0x3a')]=qs[_0x5ac5('0x32')](_[_0x5ac5('0x3b')](_0x4e7f63[_0x5ac5('0x30')],_0x2de4f5[_0x5ac5('0x32')]),_0x4762b7);if(_0x4e7f63['query'][_0x5ac5('0x3c')]){_0x2c01e1[_0x5ac5('0x3a')]=_[_0x5ac5('0x3d')](_0x2c01e1[_0x5ac5('0x3a')],{'$or':_[_0x5ac5('0x2b')](_0x4762b7,function(_0x272179){if(_0x272179[_0x5ac5('0x3e')]!=='VIRTUAL'){var _0xc1046={};_0xc1046[_0x272179[_0x5ac5('0x28')]]={'$like':'%'+_0x4e7f63[_0x5ac5('0x30')]['filter']+'%'};return _0xc1046;}})});}_0x2c01e1=_[_0x5ac5('0x3d')]({},_0x2c01e1,_0x4e7f63['options']);var _0x2b748e={'where':_0x2c01e1[_0x5ac5('0x3a')]};return db[_0x5ac5('0x2c')][_0x5ac5('0x1f')](_0x2b748e)[_0x5ac5('0x3f')](function(_0x214390){_0x5c0740[_0x5ac5('0x1f')]=_0x214390;if(_0x4e7f63['query'][_0x5ac5('0x40')]){_0x2c01e1[_0x5ac5('0x41')]=[{'all':!![]}];}return db[_0x5ac5('0x2c')][_0x5ac5('0x42')](_0x2c01e1);})[_0x5ac5('0x3f')](function(_0x3e4ebc){_0x5c0740['rows']=_0x3e4ebc;return _0x5c0740;})['then'](respondWithFilteredResult(_0x1e591d,_0x2c01e1))[_0x5ac5('0x43')](handleError(_0x1e591d,null));};exports[_0x5ac5('0x44')]=function(_0x368605,_0x580e3b){var _0x8b5652={'raw':![],'where':{'id':_0x368605[_0x5ac5('0x45')]['id']}},_0x2e9f37={};_0x2e9f37[_0x5ac5('0x2f')]=_[_0x5ac5('0x31')](db[_0x5ac5('0x2c')][_0x5ac5('0x46')]);_0x2e9f37[_0x5ac5('0x30')]=_[_0x5ac5('0x31')](_0x368605['query']);_0x2e9f37[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x2e9f37[_0x5ac5('0x2f')],_0x2e9f37[_0x5ac5('0x30')]);_0x8b5652[_0x5ac5('0x34')]=_[_0x5ac5('0x33')](_0x2e9f37['model'],qs[_0x5ac5('0x35')](_0x368605[_0x5ac5('0x30')]['fields']));_0x8b5652[_0x5ac5('0x34')]=_0x8b5652[_0x5ac5('0x34')][_0x5ac5('0x36')]?_0x8b5652[_0x5ac5('0x34')]:_0x2e9f37[_0x5ac5('0x2f')];if(_0x368605[_0x5ac5('0x30')][_0x5ac5('0x40')]){_0x8b5652['include']=[{'all':!![]}];}_0x8b5652=_[_0x5ac5('0x3d')]({},_0x8b5652,_0x368605[_0x5ac5('0x47')]);return db[_0x5ac5('0x2c')][_0x5ac5('0x48')](_0x8b5652)['then'](handleEntityNotFound(_0x580e3b,null))[_0x5ac5('0x3f')](respondWithResult(_0x580e3b,null))[_0x5ac5('0x43')](handleError(_0x580e3b,null));};exports[_0x5ac5('0x49')]=function(_0x5bb28b,_0x252154){return db['ZendeskConfiguration'][_0x5ac5('0x49')](_0x5bb28b['body'],{})['then'](respondWithResult(_0x252154,0xc9))[_0x5ac5('0x43')](handleError(_0x252154,null));};exports[_0x5ac5('0x24')]=function(_0x23d093,_0x40fdee){if(_0x23d093['body']['id']){delete _0x23d093['body']['id'];}return db[_0x5ac5('0x2c')][_0x5ac5('0x48')]({'where':{'id':_0x23d093[_0x5ac5('0x45')]['id']}})[_0x5ac5('0x3f')](handleEntityNotFound(_0x40fdee,null))[_0x5ac5('0x3f')](saveUpdates(_0x23d093[_0x5ac5('0x4a')],null))['then'](respondWithResult(_0x40fdee,null))[_0x5ac5('0x43')](handleError(_0x40fdee,null));};exports[_0x5ac5('0x25')]=function(_0xfaec7b,_0x5c65f3){return db[_0x5ac5('0x2c')][_0x5ac5('0x48')]({'where':{'id':_0xfaec7b[_0x5ac5('0x45')]['id']}})[_0x5ac5('0x3f')](handleEntityNotFound(_0x5c65f3,null))[_0x5ac5('0x3f')](removeEntity(_0x5c65f3,null))[_0x5ac5('0x43')](handleError(_0x5c65f3,null));};exports[_0x5ac5('0x4b')]=function(_0x1ef20a,_0x4e0f84,_0x1c0073){var _0x5d7f4e={};var _0x2f39ee={};var _0x3798d3;var _0x7e4c93;return db[_0x5ac5('0x2c')][_0x5ac5('0x4c')]({'where':{'id':_0x1ef20a[_0x5ac5('0x45')]['id']}})[_0x5ac5('0x3f')](handleEntityNotFound(_0x4e0f84,null))['then'](function(_0x55b28a){if(_0x55b28a){_0x3798d3=_0x55b28a;_0x2f39ee['model']=_[_0x5ac5('0x31')](db[_0x5ac5('0x4d')]['rawAttributes']);_0x2f39ee[_0x5ac5('0x30')]=_[_0x5ac5('0x31')](_0x1ef20a[_0x5ac5('0x30')]);_0x2f39ee['filters']=_[_0x5ac5('0x33')](_0x2f39ee[_0x5ac5('0x2f')],_0x2f39ee[_0x5ac5('0x30')]);_0x5d7f4e[_0x5ac5('0x34')]=_[_0x5ac5('0x33')](_0x2f39ee[_0x5ac5('0x2f')],qs[_0x5ac5('0x35')](_0x1ef20a['query']['fields']));_0x5d7f4e[_0x5ac5('0x34')]=_0x5d7f4e[_0x5ac5('0x34')][_0x5ac5('0x36')]?_0x5d7f4e['attributes']:_0x2f39ee['model'];_0x5d7f4e['order']=qs[_0x5ac5('0x39')](_0x1ef20a[_0x5ac5('0x30')]['sort']);_0x5d7f4e[_0x5ac5('0x3a')]=qs[_0x5ac5('0x32')](_['pick'](_0x1ef20a['query'],_0x2f39ee['filters']));if(_0x1ef20a[_0x5ac5('0x30')][_0x5ac5('0x3c')]){_0x5d7f4e[_0x5ac5('0x3a')]=_[_0x5ac5('0x3d')](_0x5d7f4e[_0x5ac5('0x3a')],{'$or':_['map'](_0x5d7f4e['attributes'],function(_0x22595b){var _0x5e67fa={};_0x5e67fa[_0x22595b]={'$like':'%'+_0x1ef20a[_0x5ac5('0x30')][_0x5ac5('0x3c')]+'%'};return _0x5e67fa;})});}_0x5d7f4e=_[_0x5ac5('0x3d')]({},_0x5d7f4e,_0x1ef20a['options']);return _0x3798d3['getFields'](_0x5d7f4e);}})[_0x5ac5('0x3f')](function(_0x5c709d){if(_0x5c709d){_0x7e4c93=_0x5c709d[_0x5ac5('0x36')];if(!_0x1ef20a['query']['hasOwnProperty'](_0x5ac5('0x4e'))){_0x5d7f4e[_0x5ac5('0x1d')]=qs[_0x5ac5('0x1d')](_0x1ef20a[_0x5ac5('0x30')][_0x5ac5('0x1d')]);_0x5d7f4e[_0x5ac5('0x1c')]=qs['offset'](_0x1ef20a[_0x5ac5('0x30')][_0x5ac5('0x1c')]);}return _0x3798d3[_0x5ac5('0x4b')](_0x5d7f4e);}})[_0x5ac5('0x3f')](function(_0x6a64b4){if(_0x6a64b4){return _0x6a64b4?{'count':_0x7e4c93,'rows':_0x6a64b4}:null;}})['then'](respondWithResult(_0x4e0f84,null))['catch'](handleError(_0x4e0f84,null));};exports[_0x5ac5('0x4f')]=function(_0x2f90d5,_0x22c3b6,_0xc438b3){var _0x5bfe83={};var _0x2a11bd={};var _0x5d9935;var _0x1395cb;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2f90d5['params']['id']}})['then'](handleEntityNotFound(_0x22c3b6,null))[_0x5ac5('0x3f')](function(_0x49f67f){if(_0x49f67f){_0x5d9935=_0x49f67f;_0x2a11bd[_0x5ac5('0x2f')]=_[_0x5ac5('0x31')](db[_0x5ac5('0x4d')][_0x5ac5('0x46')]);_0x2a11bd[_0x5ac5('0x30')]=_[_0x5ac5('0x31')](_0x2f90d5[_0x5ac5('0x30')]);_0x2a11bd[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x2a11bd['model'],_0x2a11bd[_0x5ac5('0x30')]);_0x5bfe83[_0x5ac5('0x34')]=_['intersection'](_0x2a11bd[_0x5ac5('0x2f')],qs[_0x5ac5('0x35')](_0x2f90d5[_0x5ac5('0x30')][_0x5ac5('0x35')]));_0x5bfe83[_0x5ac5('0x34')]=_0x5bfe83[_0x5ac5('0x34')]['length']?_0x5bfe83[_0x5ac5('0x34')]:_0x2a11bd['model'];_0x5bfe83[_0x5ac5('0x38')]=qs['sort'](_0x2f90d5[_0x5ac5('0x30')][_0x5ac5('0x39')]);_0x5bfe83[_0x5ac5('0x3a')]=qs['filters'](_[_0x5ac5('0x3b')](_0x2f90d5[_0x5ac5('0x30')],_0x2a11bd['filters']));if(_0x2f90d5[_0x5ac5('0x30')]['filter']){_0x5bfe83[_0x5ac5('0x3a')]=_[_0x5ac5('0x3d')](_0x5bfe83[_0x5ac5('0x3a')],{'$or':_[_0x5ac5('0x2b')](_0x5bfe83['attributes'],function(_0x10d158){var _0x36df8e={};_0x36df8e[_0x10d158]={'$like':'%'+_0x2f90d5[_0x5ac5('0x30')][_0x5ac5('0x3c')]+'%'};return _0x36df8e;})});}_0x5bfe83=_[_0x5ac5('0x3d')]({},_0x5bfe83,_0x2f90d5[_0x5ac5('0x47')]);return _0x5d9935[_0x5ac5('0x4f')](_0x5bfe83);}})['then'](function(_0x6083ec){if(_0x6083ec){_0x1395cb=_0x6083ec[_0x5ac5('0x36')];if(!_0x2f90d5[_0x5ac5('0x30')]['hasOwnProperty']('nolimit')){_0x5bfe83[_0x5ac5('0x1d')]=qs[_0x5ac5('0x1d')](_0x2f90d5[_0x5ac5('0x30')][_0x5ac5('0x1d')]);_0x5bfe83['offset']=qs[_0x5ac5('0x1c')](_0x2f90d5['query']['offset']);}return _0x5d9935[_0x5ac5('0x4f')](_0x5bfe83);}})['then'](function(_0x2adbc5){if(_0x2adbc5){return _0x2adbc5?{'count':_0x1395cb,'rows':_0x2adbc5}:null;}})[_0x5ac5('0x3f')](respondWithResult(_0x22c3b6,null))[_0x5ac5('0x43')](handleError(_0x22c3b6,null));};exports[_0x5ac5('0x50')]=function(_0x5aee82,_0x17c809,_0xf01910){var _0x352291={};var _0x3f3152={};var _0x49a405;var _0x580c42;return db['ZendeskConfiguration'][_0x5ac5('0x4c')]({'where':{'id':_0x5aee82[_0x5ac5('0x45')]['id']}})[_0x5ac5('0x3f')](handleEntityNotFound(_0x17c809,null))['then'](function(_0x11ddcf){if(_0x11ddcf){_0x49a405=_0x11ddcf;_0x3f3152[_0x5ac5('0x2f')]=_[_0x5ac5('0x31')](db[_0x5ac5('0x4d')][_0x5ac5('0x46')]);_0x3f3152[_0x5ac5('0x30')]=_[_0x5ac5('0x31')](_0x5aee82[_0x5ac5('0x30')]);_0x3f3152[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x3f3152[_0x5ac5('0x2f')],_0x3f3152[_0x5ac5('0x30')]);_0x352291[_0x5ac5('0x34')]=_[_0x5ac5('0x33')](_0x3f3152[_0x5ac5('0x2f')],qs[_0x5ac5('0x35')](_0x5aee82['query'][_0x5ac5('0x35')]));_0x352291[_0x5ac5('0x34')]=_0x352291[_0x5ac5('0x34')][_0x5ac5('0x36')]?_0x352291[_0x5ac5('0x34')]:_0x3f3152[_0x5ac5('0x2f')];_0x352291[_0x5ac5('0x38')]=qs[_0x5ac5('0x39')](_0x5aee82[_0x5ac5('0x30')][_0x5ac5('0x39')]);_0x352291[_0x5ac5('0x3a')]=qs[_0x5ac5('0x32')](_[_0x5ac5('0x3b')](_0x5aee82[_0x5ac5('0x30')],_0x3f3152[_0x5ac5('0x32')]));if(_0x5aee82['query']['filter']){_0x352291['where']=_['merge'](_0x352291[_0x5ac5('0x3a')],{'$or':_[_0x5ac5('0x2b')](_0x352291[_0x5ac5('0x34')],function(_0x4fd607){var _0x4d4e06={};_0x4d4e06[_0x4fd607]={'$like':'%'+_0x5aee82[_0x5ac5('0x30')][_0x5ac5('0x3c')]+'%'};return _0x4d4e06;})});}_0x352291=_['merge']({},_0x352291,_0x5aee82[_0x5ac5('0x47')]);return _0x49a405['getDescriptions'](_0x352291);}})['then'](function(_0x24d668){if(_0x24d668){_0x580c42=_0x24d668[_0x5ac5('0x36')];if(!_0x5aee82[_0x5ac5('0x30')][_0x5ac5('0x37')](_0x5ac5('0x4e'))){_0x352291['limit']=qs[_0x5ac5('0x1d')](_0x5aee82[_0x5ac5('0x30')][_0x5ac5('0x1d')]);_0x352291[_0x5ac5('0x1c')]=qs[_0x5ac5('0x1c')](_0x5aee82['query'][_0x5ac5('0x1c')]);}return _0x49a405[_0x5ac5('0x50')](_0x352291);}})[_0x5ac5('0x3f')](function(_0x170b80){if(_0x170b80){return _0x170b80?{'count':_0x580c42,'rows':_0x170b80}:null;}})['then'](respondWithResult(_0x17c809,null))['catch'](handleError(_0x17c809,null));};exports[_0x5ac5('0x51')]=function(_0xc5d18,_0x1febac,_0x4057f3){var _0x106d0f={};var _0x1383a9={};var _0x3a8f0e;var _0x10805e;return db[_0x5ac5('0x2c')]['findOne']({'where':{'id':_0xc5d18['params']['id']}})[_0x5ac5('0x3f')](handleEntityNotFound(_0x1febac,null))[_0x5ac5('0x3f')](function(_0x1cef3b){if(_0x1cef3b){_0x3a8f0e=_0x1cef3b;_0x1383a9[_0x5ac5('0x2f')]=_[_0x5ac5('0x31')](db[_0x5ac5('0x52')][_0x5ac5('0x46')]);_0x1383a9['query']=_[_0x5ac5('0x31')](_0xc5d18['query']);_0x1383a9[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x1383a9[_0x5ac5('0x2f')],_0x1383a9[_0x5ac5('0x30')]);_0x106d0f[_0x5ac5('0x34')]=_[_0x5ac5('0x33')](_0x1383a9[_0x5ac5('0x2f')],qs[_0x5ac5('0x35')](_0xc5d18[_0x5ac5('0x30')][_0x5ac5('0x35')]));_0x106d0f['attributes']=_0x106d0f[_0x5ac5('0x34')][_0x5ac5('0x36')]?_0x106d0f[_0x5ac5('0x34')]:_0x1383a9['model'];_0x106d0f[_0x5ac5('0x38')]=qs[_0x5ac5('0x39')](_0xc5d18['query'][_0x5ac5('0x39')]);_0x106d0f[_0x5ac5('0x3a')]=qs[_0x5ac5('0x32')](_['pick'](_0xc5d18[_0x5ac5('0x30')],_0x1383a9['filters']));if(_0xc5d18[_0x5ac5('0x30')][_0x5ac5('0x3c')]){_0x106d0f[_0x5ac5('0x3a')]=_[_0x5ac5('0x3d')](_0x106d0f[_0x5ac5('0x3a')],{'$or':_[_0x5ac5('0x2b')](_0x106d0f[_0x5ac5('0x34')],function(_0x3b8509){var _0x15af9e={};_0x15af9e[_0x3b8509]={'$like':'%'+_0xc5d18[_0x5ac5('0x30')][_0x5ac5('0x3c')]+'%'};return _0x15af9e;})});}_0x106d0f=_[_0x5ac5('0x3d')]({},_0x106d0f,_0xc5d18[_0x5ac5('0x47')]);return _0x3a8f0e['getTags'](_0x106d0f);}})[_0x5ac5('0x3f')](function(_0xed4f02){if(_0xed4f02){_0x10805e=_0xed4f02[_0x5ac5('0x36')];if(!_0xc5d18[_0x5ac5('0x30')][_0x5ac5('0x37')]('nolimit')){_0x106d0f[_0x5ac5('0x1d')]=qs[_0x5ac5('0x1d')](_0xc5d18['query'][_0x5ac5('0x1d')]);_0x106d0f[_0x5ac5('0x1c')]=qs[_0x5ac5('0x1c')](_0xc5d18[_0x5ac5('0x30')][_0x5ac5('0x1c')]);}return _0x3a8f0e[_0x5ac5('0x51')](_0x106d0f);}})[_0x5ac5('0x3f')](function(_0x39bbbd){if(_0x39bbbd){return _0x39bbbd?{'count':_0x10805e,'rows':_0x39bbbd}:null;}})['then'](respondWithResult(_0x1febac,null))[_0x5ac5('0x43')](handleError(_0x1febac,null));};exports['setTags']=function(_0x11c659,_0x3d6cc3,_0x3b2f91){if(_0x11c659['body']['id']){delete _0x11c659[_0x5ac5('0x4a')]['id'];}return db[_0x5ac5('0x2c')][_0x5ac5('0x4c')]({'where':{'id':_0x11c659['params']['id']}})[_0x5ac5('0x3f')](handleEntityNotFound(_0x3d6cc3,null))[_0x5ac5('0x3f')](function(_0x3839e6){if(_0x3839e6){return _0x3839e6[_0x5ac5('0x53')](_0x11c659[_0x5ac5('0x4a')][_0x5ac5('0x54')]||[]);}return null;})[_0x5ac5('0x3f')](respondWithResult(_0x3d6cc3,null))['catch'](handleError(_0x3d6cc3,null));};
\ No newline at end of file
+var _0x6d42=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','find','create','body','update','params','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x6d42,0x137));var _0x26d4=function(_0x55ed46,_0x1277ed){_0x55ed46=_0x55ed46-0x0;var _0x2465f4=_0x6d42[_0x55ed46];return _0x2465f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26d4('0x0'));var zipdir=require(_0x26d4('0x1'));var jsonpatch=require(_0x26d4('0x2'));var rp=require(_0x26d4('0x3'));var moment=require(_0x26d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x26d4('0x5'));var path=require(_0x26d4('0x6'));var sox=require(_0x26d4('0x7'));var csv=require(_0x26d4('0x8'));var ejs=require(_0x26d4('0x9'));var fs=require('fs');var fs_extra=require(_0x26d4('0xa'));var _=require(_0x26d4('0xb'));var squel=require(_0x26d4('0xc'));var crypto=require('crypto');var jsforce=require(_0x26d4('0xd'));var deskjs=require(_0x26d4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26d4('0xf'));var Papa=require(_0x26d4('0x10'));var Redis=require(_0x26d4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26d4('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26d4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x26d4('0x14'))['db'];function respondWithStatusCode(_0x2fd1ef,_0x28a1fa){_0x28a1fa=_0x28a1fa||0xcc;return function(_0x46cafe){if(_0x46cafe){return _0x2fd1ef[_0x26d4('0x15')](_0x28a1fa);}return _0x2fd1ef[_0x26d4('0x16')](_0x28a1fa)[_0x26d4('0x17')]();};}function respondWithResult(_0x34aedf,_0x37b8c0){_0x37b8c0=_0x37b8c0||0xc8;return function(_0x8f11e4){if(_0x8f11e4){return _0x34aedf[_0x26d4('0x16')](_0x37b8c0)[_0x26d4('0x18')](_0x8f11e4);}};}function respondWithFilteredResult(_0x147354,_0x15db98){return function(_0x42c26f){if(_0x42c26f){var _0x347039=typeof _0x15db98[_0x26d4('0x19')]===_0x26d4('0x1a')&&typeof _0x15db98[_0x26d4('0x1b')]===_0x26d4('0x1a');var _0x5be322=_0x42c26f[_0x26d4('0x1c')];var _0x137f3b=_0x347039?0x0:_0x15db98[_0x26d4('0x19')];var _0x562b0d=_0x347039?_0x42c26f['count']:_0x15db98[_0x26d4('0x19')]+_0x15db98[_0x26d4('0x1b')];var _0x46235d;if(_0x562b0d>=_0x5be322){_0x562b0d=_0x5be322;_0x46235d=0xc8;}else{_0x46235d=0xce;}_0x147354[_0x26d4('0x16')](_0x46235d);return _0x147354[_0x26d4('0x1d')](_0x26d4('0x1e'),_0x137f3b+'-'+_0x562b0d+'/'+_0x5be322)[_0x26d4('0x18')](_0x42c26f);}return null;};}function patchUpdates(_0x6e2364){return function(_0x27e1cc){try{jsonpatch[_0x26d4('0x1f')](_0x27e1cc,_0x6e2364,!![]);}catch(_0x2085b0){return BPromise['reject'](_0x2085b0);}return _0x27e1cc['save']();};}function saveUpdates(_0x9c19d0,_0x30896e){return function(_0x41193f){if(_0x41193f){return _0x41193f['update'](_0x9c19d0)[_0x26d4('0x20')](function(_0x3e0673){return _0x3e0673;});}return null;};}function removeEntity(_0x452d1d,_0xf47df6){return function(_0x334ce9){if(_0x334ce9){return _0x334ce9['destroy']()[_0x26d4('0x20')](function(){_0x452d1d[_0x26d4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d51b,_0x4f8609){return function(_0x1757ef){if(!_0x1757ef){_0x42d51b['sendStatus'](0x194);}return _0x1757ef;};}function handleError(_0x3a2fb6,_0x3734c0){_0x3734c0=_0x3734c0||0x1f4;return function(_0x5a4d6f){logger[_0x26d4('0x21')](_0x5a4d6f[_0x26d4('0x22')]);if(_0x5a4d6f[_0x26d4('0x23')]){delete _0x5a4d6f[_0x26d4('0x23')];}_0x3a2fb6[_0x26d4('0x16')](_0x3734c0)['send'](_0x5a4d6f);};}exports[_0x26d4('0x24')]=function(_0x5360ab,_0x263908){var _0x3b5117={},_0x217531={},_0x4f4ac3={'count':0x0,'rows':[]};var _0x287323=_[_0x26d4('0x25')](db[_0x26d4('0x26')][_0x26d4('0x27')],function(_0x2b5b1b){return{'name':_0x2b5b1b[_0x26d4('0x28')],'type':_0x2b5b1b['type'][_0x26d4('0x29')]};});_0x217531['model']=_['map'](_0x287323,_0x26d4('0x23'));_0x217531[_0x26d4('0x2a')]=_['keys'](_0x5360ab[_0x26d4('0x2a')]);_0x217531[_0x26d4('0x2b')]=_['intersection'](_0x217531['model'],_0x217531['query']);_0x3b5117[_0x26d4('0x2c')]=_[_0x26d4('0x2d')](_0x217531[_0x26d4('0x2e')],qs[_0x26d4('0x2f')](_0x5360ab[_0x26d4('0x2a')][_0x26d4('0x2f')]));_0x3b5117[_0x26d4('0x2c')]=_0x3b5117['attributes'][_0x26d4('0x30')]?_0x3b5117[_0x26d4('0x2c')]:_0x217531[_0x26d4('0x2e')];if(!_0x5360ab[_0x26d4('0x2a')][_0x26d4('0x31')](_0x26d4('0x32'))){_0x3b5117[_0x26d4('0x1b')]=qs[_0x26d4('0x1b')](_0x5360ab[_0x26d4('0x2a')][_0x26d4('0x1b')]);_0x3b5117['offset']=qs[_0x26d4('0x19')](_0x5360ab[_0x26d4('0x2a')]['offset']);}_0x3b5117[_0x26d4('0x33')]=qs[_0x26d4('0x34')](_0x5360ab['query'][_0x26d4('0x34')]);_0x3b5117['where']=qs[_0x26d4('0x2b')](_[_0x26d4('0x35')](_0x5360ab[_0x26d4('0x2a')],_0x217531[_0x26d4('0x2b')]),_0x287323);if(_0x5360ab[_0x26d4('0x2a')][_0x26d4('0x36')]){_0x3b5117['where']=_['merge'](_0x3b5117[_0x26d4('0x37')],{'$or':_[_0x26d4('0x25')](_0x287323,function(_0xca0873){if(_0xca0873['type']!==_0x26d4('0x38')){var _0x5a9bda={};_0x5a9bda[_0xca0873[_0x26d4('0x23')]]={'$like':'%'+_0x5360ab[_0x26d4('0x2a')][_0x26d4('0x36')]+'%'};return _0x5a9bda;}})});}_0x3b5117=_[_0x26d4('0x39')]({},_0x3b5117,_0x5360ab[_0x26d4('0x3a')]);var _0x5c0faf={'where':_0x3b5117[_0x26d4('0x37')]};return db[_0x26d4('0x26')][_0x26d4('0x1c')](_0x5c0faf)[_0x26d4('0x20')](function(_0x4a218c){_0x4f4ac3[_0x26d4('0x1c')]=_0x4a218c;if(_0x5360ab[_0x26d4('0x2a')][_0x26d4('0x3b')]){_0x3b5117[_0x26d4('0x3c')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x3b5117);})[_0x26d4('0x20')](function(_0x33f899){_0x4f4ac3[_0x26d4('0x3d')]=_0x33f899;return _0x4f4ac3;})[_0x26d4('0x20')](respondWithFilteredResult(_0x263908,_0x3b5117))[_0x26d4('0x3e')](handleError(_0x263908,null));};exports[_0x26d4('0x3f')]=function(_0x261e93,_0x487147){var _0x571f75={'raw':![],'where':{'id':_0x261e93['params']['id']}},_0x4b8122={};_0x4b8122['model']=_[_0x26d4('0x40')](db[_0x26d4('0x26')][_0x26d4('0x27')]);_0x4b8122['query']=_['keys'](_0x261e93[_0x26d4('0x2a')]);_0x4b8122[_0x26d4('0x2b')]=_[_0x26d4('0x2d')](_0x4b8122[_0x26d4('0x2e')],_0x4b8122[_0x26d4('0x2a')]);_0x571f75[_0x26d4('0x2c')]=_[_0x26d4('0x2d')](_0x4b8122['model'],qs[_0x26d4('0x2f')](_0x261e93[_0x26d4('0x2a')][_0x26d4('0x2f')]));_0x571f75[_0x26d4('0x2c')]=_0x571f75[_0x26d4('0x2c')][_0x26d4('0x30')]?_0x571f75[_0x26d4('0x2c')]:_0x4b8122[_0x26d4('0x2e')];if(_0x261e93[_0x26d4('0x2a')][_0x26d4('0x3b')]){_0x571f75[_0x26d4('0x3c')]=[{'all':!![]}];}_0x571f75=_[_0x26d4('0x39')]({},_0x571f75,_0x261e93[_0x26d4('0x3a')]);return db[_0x26d4('0x26')][_0x26d4('0x41')](_0x571f75)[_0x26d4('0x20')](handleEntityNotFound(_0x487147,null))[_0x26d4('0x20')](respondWithResult(_0x487147,null))[_0x26d4('0x3e')](handleError(_0x487147,null));};exports[_0x26d4('0x42')]=function(_0x4b7fed,_0x4223b3){return db['ZendeskConfiguration'][_0x26d4('0x42')](_0x4b7fed[_0x26d4('0x43')],{})[_0x26d4('0x20')](respondWithResult(_0x4223b3,0xc9))[_0x26d4('0x3e')](handleError(_0x4223b3,null));};exports[_0x26d4('0x44')]=function(_0x1e9d64,_0x81b332){if(_0x1e9d64[_0x26d4('0x43')]['id']){delete _0x1e9d64[_0x26d4('0x43')]['id'];}return db['ZendeskConfiguration'][_0x26d4('0x41')]({'where':{'id':_0x1e9d64[_0x26d4('0x45')]['id']}})[_0x26d4('0x20')](handleEntityNotFound(_0x81b332,null))[_0x26d4('0x20')](saveUpdates(_0x1e9d64['body'],null))[_0x26d4('0x20')](respondWithResult(_0x81b332,null))[_0x26d4('0x3e')](handleError(_0x81b332,null));};exports['destroy']=function(_0x367fd1,_0x14b611){return db[_0x26d4('0x26')]['find']({'where':{'id':_0x367fd1[_0x26d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x14b611,null))[_0x26d4('0x20')](removeEntity(_0x14b611,null))[_0x26d4('0x3e')](handleError(_0x14b611,null));};exports['getFields']=function(_0x228f08,_0xa9b143,_0x33ad19){var _0x4e2d99={};var _0x4d69f4={};var _0x40ced1;var _0x2de588;return db[_0x26d4('0x26')][_0x26d4('0x46')]({'where':{'id':_0x228f08[_0x26d4('0x45')]['id']}})[_0x26d4('0x20')](handleEntityNotFound(_0xa9b143,null))[_0x26d4('0x20')](function(_0x8d59a6){if(_0x8d59a6){_0x40ced1=_0x8d59a6;_0x4d69f4['model']=_[_0x26d4('0x40')](db[_0x26d4('0x47')][_0x26d4('0x27')]);_0x4d69f4[_0x26d4('0x2a')]=_[_0x26d4('0x40')](_0x228f08[_0x26d4('0x2a')]);_0x4d69f4['filters']=_['intersection'](_0x4d69f4['model'],_0x4d69f4[_0x26d4('0x2a')]);_0x4e2d99[_0x26d4('0x2c')]=_[_0x26d4('0x2d')](_0x4d69f4[_0x26d4('0x2e')],qs[_0x26d4('0x2f')](_0x228f08['query'][_0x26d4('0x2f')]));_0x4e2d99[_0x26d4('0x2c')]=_0x4e2d99[_0x26d4('0x2c')]['length']?_0x4e2d99[_0x26d4('0x2c')]:_0x4d69f4['model'];_0x4e2d99[_0x26d4('0x33')]=qs[_0x26d4('0x34')](_0x228f08[_0x26d4('0x2a')][_0x26d4('0x34')]);_0x4e2d99['where']=qs[_0x26d4('0x2b')](_[_0x26d4('0x35')](_0x228f08[_0x26d4('0x2a')],_0x4d69f4[_0x26d4('0x2b')]));if(_0x228f08['query'][_0x26d4('0x36')]){_0x4e2d99[_0x26d4('0x37')]=_['merge'](_0x4e2d99[_0x26d4('0x37')],{'$or':_[_0x26d4('0x25')](_0x4e2d99[_0x26d4('0x2c')],function(_0x55e2b4){var _0x4eedc5={};_0x4eedc5[_0x55e2b4]={'$like':'%'+_0x228f08[_0x26d4('0x2a')][_0x26d4('0x36')]+'%'};return _0x4eedc5;})});}_0x4e2d99=_[_0x26d4('0x39')]({},_0x4e2d99,_0x228f08[_0x26d4('0x3a')]);return _0x40ced1[_0x26d4('0x48')](_0x4e2d99);}})[_0x26d4('0x20')](function(_0x380c53){if(_0x380c53){_0x2de588=_0x380c53[_0x26d4('0x30')];if(!_0x228f08[_0x26d4('0x2a')][_0x26d4('0x31')](_0x26d4('0x32'))){_0x4e2d99[_0x26d4('0x1b')]=qs[_0x26d4('0x1b')](_0x228f08['query'][_0x26d4('0x1b')]);_0x4e2d99['offset']=qs[_0x26d4('0x19')](_0x228f08['query'][_0x26d4('0x19')]);}return _0x40ced1[_0x26d4('0x48')](_0x4e2d99);}})['then'](function(_0x2dc70e){if(_0x2dc70e){return _0x2dc70e?{'count':_0x2de588,'rows':_0x2dc70e}:null;}})[_0x26d4('0x20')](respondWithResult(_0xa9b143,null))[_0x26d4('0x3e')](handleError(_0xa9b143,null));};exports[_0x26d4('0x49')]=function(_0x13a84a,_0xced7f6,_0x5dd4aa){var _0x16fce8={};var _0x291fee={};var _0x4df6d1;var _0x470f8c;return db[_0x26d4('0x26')]['findOne']({'where':{'id':_0x13a84a[_0x26d4('0x45')]['id']}})[_0x26d4('0x20')](handleEntityNotFound(_0xced7f6,null))[_0x26d4('0x20')](function(_0x29f706){if(_0x29f706){_0x4df6d1=_0x29f706;_0x291fee['model']=_[_0x26d4('0x40')](db['ZendeskField'][_0x26d4('0x27')]);_0x291fee[_0x26d4('0x2a')]=_[_0x26d4('0x40')](_0x13a84a[_0x26d4('0x2a')]);_0x291fee[_0x26d4('0x2b')]=_[_0x26d4('0x2d')](_0x291fee['model'],_0x291fee[_0x26d4('0x2a')]);_0x16fce8[_0x26d4('0x2c')]=_[_0x26d4('0x2d')](_0x291fee['model'],qs[_0x26d4('0x2f')](_0x13a84a[_0x26d4('0x2a')][_0x26d4('0x2f')]));_0x16fce8[_0x26d4('0x2c')]=_0x16fce8[_0x26d4('0x2c')][_0x26d4('0x30')]?_0x16fce8[_0x26d4('0x2c')]:_0x291fee['model'];_0x16fce8[_0x26d4('0x33')]=qs[_0x26d4('0x34')](_0x13a84a[_0x26d4('0x2a')][_0x26d4('0x34')]);_0x16fce8[_0x26d4('0x37')]=qs[_0x26d4('0x2b')](_['pick'](_0x13a84a['query'],_0x291fee[_0x26d4('0x2b')]));if(_0x13a84a[_0x26d4('0x2a')][_0x26d4('0x36')]){_0x16fce8[_0x26d4('0x37')]=_[_0x26d4('0x39')](_0x16fce8[_0x26d4('0x37')],{'$or':_[_0x26d4('0x25')](_0x16fce8[_0x26d4('0x2c')],function(_0x450c0d){var _0x2ff078={};_0x2ff078[_0x450c0d]={'$like':'%'+_0x13a84a[_0x26d4('0x2a')][_0x26d4('0x36')]+'%'};return _0x2ff078;})});}_0x16fce8=_[_0x26d4('0x39')]({},_0x16fce8,_0x13a84a[_0x26d4('0x3a')]);return _0x4df6d1[_0x26d4('0x49')](_0x16fce8);}})[_0x26d4('0x20')](function(_0x42e06c){if(_0x42e06c){_0x470f8c=_0x42e06c[_0x26d4('0x30')];if(!_0x13a84a[_0x26d4('0x2a')][_0x26d4('0x31')](_0x26d4('0x32'))){_0x16fce8[_0x26d4('0x1b')]=qs[_0x26d4('0x1b')](_0x13a84a['query'][_0x26d4('0x1b')]);_0x16fce8['offset']=qs[_0x26d4('0x19')](_0x13a84a[_0x26d4('0x2a')][_0x26d4('0x19')]);}return _0x4df6d1[_0x26d4('0x49')](_0x16fce8);}})[_0x26d4('0x20')](function(_0x12a597){if(_0x12a597){return _0x12a597?{'count':_0x470f8c,'rows':_0x12a597}:null;}})[_0x26d4('0x20')](respondWithResult(_0xced7f6,null))[_0x26d4('0x3e')](handleError(_0xced7f6,null));};exports['getDescriptions']=function(_0x6ff44e,_0x5a7c63,_0x19e544){var _0x1ad0ba={};var _0xe061fd={};var _0x3669ec;var _0x30dd8b;return db[_0x26d4('0x26')][_0x26d4('0x46')]({'where':{'id':_0x6ff44e[_0x26d4('0x45')]['id']}})[_0x26d4('0x20')](handleEntityNotFound(_0x5a7c63,null))[_0x26d4('0x20')](function(_0x15552b){if(_0x15552b){_0x3669ec=_0x15552b;_0xe061fd[_0x26d4('0x2e')]=_[_0x26d4('0x40')](db['ZendeskField'][_0x26d4('0x27')]);_0xe061fd[_0x26d4('0x2a')]=_['keys'](_0x6ff44e[_0x26d4('0x2a')]);_0xe061fd[_0x26d4('0x2b')]=_[_0x26d4('0x2d')](_0xe061fd[_0x26d4('0x2e')],_0xe061fd[_0x26d4('0x2a')]);_0x1ad0ba[_0x26d4('0x2c')]=_[_0x26d4('0x2d')](_0xe061fd[_0x26d4('0x2e')],qs['fields'](_0x6ff44e[_0x26d4('0x2a')]['fields']));_0x1ad0ba[_0x26d4('0x2c')]=_0x1ad0ba[_0x26d4('0x2c')]['length']?_0x1ad0ba[_0x26d4('0x2c')]:_0xe061fd['model'];_0x1ad0ba[_0x26d4('0x33')]=qs[_0x26d4('0x34')](_0x6ff44e[_0x26d4('0x2a')][_0x26d4('0x34')]);_0x1ad0ba[_0x26d4('0x37')]=qs[_0x26d4('0x2b')](_[_0x26d4('0x35')](_0x6ff44e[_0x26d4('0x2a')],_0xe061fd[_0x26d4('0x2b')]));if(_0x6ff44e[_0x26d4('0x2a')]['filter']){_0x1ad0ba[_0x26d4('0x37')]=_[_0x26d4('0x39')](_0x1ad0ba['where'],{'$or':_[_0x26d4('0x25')](_0x1ad0ba[_0x26d4('0x2c')],function(_0x12456e){var _0x785bc9={};_0x785bc9[_0x12456e]={'$like':'%'+_0x6ff44e[_0x26d4('0x2a')][_0x26d4('0x36')]+'%'};return _0x785bc9;})});}_0x1ad0ba=_[_0x26d4('0x39')]({},_0x1ad0ba,_0x6ff44e[_0x26d4('0x3a')]);return _0x3669ec[_0x26d4('0x4a')](_0x1ad0ba);}})[_0x26d4('0x20')](function(_0x3cf3e8){if(_0x3cf3e8){_0x30dd8b=_0x3cf3e8['length'];if(!_0x6ff44e[_0x26d4('0x2a')][_0x26d4('0x31')](_0x26d4('0x32'))){_0x1ad0ba[_0x26d4('0x1b')]=qs[_0x26d4('0x1b')](_0x6ff44e[_0x26d4('0x2a')]['limit']);_0x1ad0ba[_0x26d4('0x19')]=qs[_0x26d4('0x19')](_0x6ff44e['query']['offset']);}return _0x3669ec[_0x26d4('0x4a')](_0x1ad0ba);}})[_0x26d4('0x20')](function(_0x37d6d9){if(_0x37d6d9){return _0x37d6d9?{'count':_0x30dd8b,'rows':_0x37d6d9}:null;}})[_0x26d4('0x20')](respondWithResult(_0x5a7c63,null))[_0x26d4('0x3e')](handleError(_0x5a7c63,null));};exports[_0x26d4('0x4b')]=function(_0x321aa,_0x5370aa,_0x3060d4){var _0x4189e7={};var _0x1f17e9={};var _0x5b908d;var _0x351700;return db[_0x26d4('0x26')][_0x26d4('0x46')]({'where':{'id':_0x321aa['params']['id']}})[_0x26d4('0x20')](handleEntityNotFound(_0x5370aa,null))['then'](function(_0x4be935){if(_0x4be935){_0x5b908d=_0x4be935;_0x1f17e9[_0x26d4('0x2e')]=_[_0x26d4('0x40')](db[_0x26d4('0x4c')][_0x26d4('0x27')]);_0x1f17e9['query']=_['keys'](_0x321aa[_0x26d4('0x2a')]);_0x1f17e9[_0x26d4('0x2b')]=_[_0x26d4('0x2d')](_0x1f17e9[_0x26d4('0x2e')],_0x1f17e9['query']);_0x4189e7[_0x26d4('0x2c')]=_['intersection'](_0x1f17e9['model'],qs[_0x26d4('0x2f')](_0x321aa[_0x26d4('0x2a')][_0x26d4('0x2f')]));_0x4189e7[_0x26d4('0x2c')]=_0x4189e7[_0x26d4('0x2c')][_0x26d4('0x30')]?_0x4189e7[_0x26d4('0x2c')]:_0x1f17e9[_0x26d4('0x2e')];_0x4189e7[_0x26d4('0x33')]=qs[_0x26d4('0x34')](_0x321aa['query']['sort']);_0x4189e7['where']=qs[_0x26d4('0x2b')](_['pick'](_0x321aa[_0x26d4('0x2a')],_0x1f17e9[_0x26d4('0x2b')]));if(_0x321aa[_0x26d4('0x2a')][_0x26d4('0x36')]){_0x4189e7[_0x26d4('0x37')]=_[_0x26d4('0x39')](_0x4189e7[_0x26d4('0x37')],{'$or':_[_0x26d4('0x25')](_0x4189e7[_0x26d4('0x2c')],function(_0x309412){var _0x44c84d={};_0x44c84d[_0x309412]={'$like':'%'+_0x321aa[_0x26d4('0x2a')][_0x26d4('0x36')]+'%'};return _0x44c84d;})});}_0x4189e7=_[_0x26d4('0x39')]({},_0x4189e7,_0x321aa[_0x26d4('0x3a')]);return _0x5b908d[_0x26d4('0x4b')](_0x4189e7);}})[_0x26d4('0x20')](function(_0x1ad302){if(_0x1ad302){_0x351700=_0x1ad302['length'];if(!_0x321aa['query']['hasOwnProperty'](_0x26d4('0x32'))){_0x4189e7[_0x26d4('0x1b')]=qs[_0x26d4('0x1b')](_0x321aa['query'][_0x26d4('0x1b')]);_0x4189e7[_0x26d4('0x19')]=qs[_0x26d4('0x19')](_0x321aa[_0x26d4('0x2a')][_0x26d4('0x19')]);}return _0x5b908d[_0x26d4('0x4b')](_0x4189e7);}})[_0x26d4('0x20')](function(_0x3c8ff5){if(_0x3c8ff5){return _0x3c8ff5?{'count':_0x351700,'rows':_0x3c8ff5}:null;}})[_0x26d4('0x20')](respondWithResult(_0x5370aa,null))[_0x26d4('0x3e')](handleError(_0x5370aa,null));};exports[_0x26d4('0x4d')]=function(_0x47e311,_0xce266b,_0x188bd6){if(_0x47e311[_0x26d4('0x43')]['id']){delete _0x47e311[_0x26d4('0x43')]['id'];}return db[_0x26d4('0x26')][_0x26d4('0x46')]({'where':{'id':_0x47e311[_0x26d4('0x45')]['id']}})['then'](handleEntityNotFound(_0xce266b,null))[_0x26d4('0x20')](function(_0x2fb268){if(_0x2fb268){return _0x2fb268['setTags'](_0x47e311[_0x26d4('0x43')][_0x26d4('0x4e')]||[]);}return null;})[_0x26d4('0x20')](respondWithResult(_0xce266b,null))[_0x26d4('0x3e')](handleError(_0xce266b,null));};
\ No newline at end of file
index 7db170d..dee2ab2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0xb855be,_0x2eecb7){_0xb855be=_0xb855be-0x0;var _0x308420=_0xf4f4[_0xb855be];return _0x308420;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7916=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','ZendeskConfiguration','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7916,0x128));var _0x6791=function(_0x52e978,_0x49de10){_0x52e978=_0x52e978-0x0;var _0x4f6afc=_0x7916[_0x52e978];return _0x4f6afc;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8166ede..bd2b9eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53e2=['message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x53e2,0xd5));var _0x253e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x53e2[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x253e('0x0'));var BPromise=require(_0x253e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x253e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x253e('0x3'));var logger=require(_0x253e('0x4'))('rpc');var config=require(_0x253e('0x5'));var jayson=require(_0x253e('0x6'));var client=jayson['client'][_0x253e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fb6c4,_0x4cd95a,_0x4ba9a2){return new BPromise(function(_0x34fce7,_0x3d8fc8){return client[_0x253e('0x8')](_0x2fb6c4,_0x4ba9a2)[_0x253e('0x9')](function(_0x128fe2){logger[_0x253e('0xa')](_0x253e('0xb'),_0x4cd95a,_0x253e('0xc'));logger[_0x253e('0xd')](_0x253e('0xe'),_0x4cd95a,_0x253e('0xc'),JSON[_0x253e('0xf')](_0x128fe2));if(_0x128fe2[_0x253e('0x10')]){if(_0x128fe2[_0x253e('0x10')][_0x253e('0x11')]===0x1f4){logger['error'](_0x253e('0xb'),_0x4cd95a,_0x128fe2[_0x253e('0x10')]['message']);return _0x3d8fc8(_0x128fe2[_0x253e('0x10')][_0x253e('0x12')]);}logger[_0x253e('0x10')](_0x253e('0xb'),_0x4cd95a,_0x128fe2['error']['message']);return _0x34fce7(_0x128fe2['error'][_0x253e('0x12')]);}else{logger[_0x253e('0xa')](_0x253e('0xb'),_0x4cd95a,_0x253e('0xc'));_0x34fce7(_0x128fe2[_0x253e('0x13')]['message']);}})[_0x253e('0x14')](function(_0x49f761){logger[_0x253e('0x10')](_0x253e('0xb'),_0x4cd95a,_0x49f761);_0x3d8fc8(_0x49f761);});});}
\ No newline at end of file
+var _0xfead=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1a7090,_0x113b24){var _0x644b94=function(_0x1c4f75){while(--_0x1c4f75){_0x1a7090['push'](_0x1a7090['shift']());}};_0x644b94(++_0x113b24);}(_0xfead,0x159));var _0xdfea=function(_0x411e50,_0x4db852){_0x411e50=_0x411e50-0x0;var _0x2c9ec1=_0xfead[_0x411e50];return _0x2c9ec1;};'use strict';var _=require(_0xdfea('0x0'));var util=require('util');var moment=require(_0xdfea('0x1'));var BPromise=require(_0xdfea('0x2'));var rs=require(_0xdfea('0x3'));var fs=require('fs');var Redis=require(_0xdfea('0x4'));var db=require(_0xdfea('0x5'))['db'];var utils=require(_0xdfea('0x6'));var logger=require(_0xdfea('0x7'))(_0xdfea('0x8'));var config=require(_0xdfea('0x9'));var jayson=require(_0xdfea('0xa'));var client=jayson[_0xdfea('0xb')][_0xdfea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3e48c,_0x4215b9,_0x394e3d){return new BPromise(function(_0x3c74c2,_0x57b4d7){return client[_0xdfea('0xd')](_0xb3e48c,_0x394e3d)[_0xdfea('0xe')](function(_0x15a22e){logger[_0xdfea('0xf')](_0xdfea('0x10'),_0x4215b9,_0xdfea('0x11'));logger[_0xdfea('0x12')](_0xdfea('0x13'),_0x4215b9,_0xdfea('0x11'),JSON[_0xdfea('0x14')](_0x15a22e));if(_0x15a22e[_0xdfea('0x15')]){if(_0x15a22e['error']['code']===0x1f4){logger['error'](_0xdfea('0x10'),_0x4215b9,_0x15a22e[_0xdfea('0x15')]['message']);return _0x57b4d7(_0x15a22e[_0xdfea('0x15')]['message']);}logger[_0xdfea('0x15')](_0xdfea('0x10'),_0x4215b9,_0x15a22e[_0xdfea('0x15')]['message']);return _0x3c74c2(_0x15a22e[_0xdfea('0x15')][_0xdfea('0x16')]);}else{logger[_0xdfea('0xf')](_0xdfea('0x10'),_0x4215b9,_0xdfea('0x11'));_0x3c74c2(_0x15a22e['result'][_0xdfea('0x16')]);}})[_0xdfea('0x17')](function(_0x44f84d){logger[_0xdfea('0x15')](_0xdfea('0x10'),_0x4215b9,_0x44f84d);_0x57b4d7(_0x44f84d);});});}
\ No newline at end of file
index c71483d..ef5ff73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x452c=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','show','post','put'];(function(_0x314c4b,_0x377f22){var _0x3f6f4b=function(_0x3d74e2){while(--_0x3d74e2){_0x314c4b['push'](_0x314c4b['shift']());}};_0x3f6f4b(++_0x377f22);}(_0x452c,0x1f2));var _0xc452=function(_0x20cdf0,_0x5ebdd6){_0x20cdf0=_0x20cdf0-0x0;var _0x3385b6=_0x452c[_0x20cdf0];return _0x3385b6;};'use strict';var multer=require(_0xc452('0x0'));var util=require(_0xc452('0x1'));var path=require(_0xc452('0x2'));var timeout=require(_0xc452('0x3'));var express=require(_0xc452('0x4'));var router=express[_0xc452('0x5')]();var fs_extra=require(_0xc452('0x6'));var auth=require(_0xc452('0x7'));var interaction=require(_0xc452('0x8'));var config=require('../../config/environment');var controller=require(_0xc452('0x9'));router[_0xc452('0xa')]('/',auth[_0xc452('0xb')](),controller['index']);router[_0xc452('0xa')]('/:id',auth[_0xc452('0xb')](),controller[_0xc452('0xc')]);router[_0xc452('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc452('0xe')](_0xc452('0xf'),auth[_0xc452('0xb')](),controller[_0xc452('0x10')]);router['delete'](_0xc452('0xf'),auth[_0xc452('0xb')](),controller[_0xc452('0x11')]);module[_0xc452('0x12')]=router;
\ No newline at end of file
+var _0x94ee=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','/:id','show','create','put','delete'];(function(_0x189e47,_0x4fa398){var _0x5c375b=function(_0x349e8c){while(--_0x349e8c){_0x189e47['push'](_0x189e47['shift']());}};_0x5c375b(++_0x4fa398);}(_0x94ee,0x1bb));var _0xe94e=function(_0x399b11,_0x33f5f5){_0x399b11=_0x399b11-0x0;var _0x1fc9a0=_0x94ee[_0x399b11];return _0x1fc9a0;};'use strict';var multer=require(_0xe94e('0x0'));var util=require(_0xe94e('0x1'));var path=require(_0xe94e('0x2'));var timeout=require(_0xe94e('0x3'));var express=require(_0xe94e('0x4'));var router=express[_0xe94e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe94e('0x6'));var interaction=require(_0xe94e('0x7'));var config=require('../../config/environment');var controller=require(_0xe94e('0x8'));router['get']('/',auth[_0xe94e('0x9')](),controller[_0xe94e('0xa')]);router['get'](_0xe94e('0xb'),auth[_0xe94e('0x9')](),controller[_0xe94e('0xc')]);router['post']('/',auth[_0xe94e('0x9')](),controller[_0xe94e('0xd')]);router[_0xe94e('0xe')](_0xe94e('0xb'),auth[_0xe94e('0x9')](),controller['update']);router[_0xe94e('0xf')](_0xe94e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe94e('0x10')]=router;
\ No newline at end of file
index 6d38e00..cd2e456 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ad7=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9ad7,0xdb));var _0x79ad=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x9ad7[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x79ad('0x0'));module[_0x79ad('0x1')]={'type':{'type':Sequelize[_0x79ad('0x2')](_0x79ad('0x3'),_0x79ad('0x4'),_0x79ad('0x5'),'keyValue',_0x79ad('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x79ad('0x7')]},'key':{'type':Sequelize[_0x79ad('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x79ad('0x3'),_0x79ad('0x4'),_0x79ad('0x5'))},'keyContent':{'type':Sequelize[_0x79ad('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x79ad('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79ad('0x7')]}};
\ No newline at end of file
+var _0x4a3f=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x4aa168,_0x184fce){var _0x5ca074=function(_0x139178){while(--_0x139178){_0x4aa168['push'](_0x4aa168['shift']());}};_0x5ca074(++_0x184fce);}(_0x4a3f,0x177));var _0xf4a3=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x4a3f[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xf4a3('0x0'));module[_0xf4a3('0x1')]={'type':{'type':Sequelize[_0xf4a3('0x2')](_0xf4a3('0x3'),_0xf4a3('0x4'),_0xf4a3('0x5'),_0xf4a3('0x6'),_0xf4a3('0x7')),'defaultValue':_0xf4a3('0x3')},'content':{'type':Sequelize[_0xf4a3('0x8')]},'key':{'type':Sequelize[_0xf4a3('0x8')]},'keyType':{'type':Sequelize[_0xf4a3('0x2')]('string',_0xf4a3('0x4'),_0xf4a3('0x5'))},'keyContent':{'type':Sequelize[_0xf4a3('0x8')]},'idField':{'type':Sequelize[_0xf4a3('0x8')]},'nameField':{'type':Sequelize[_0xf4a3('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf4a3('0x8')]}};
\ No newline at end of file
index 4d604b0..a504e8c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c4b=['include','findAll','catch','intersection','length','options','create','body','params','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','ZendeskField','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','includeAll'];(function(_0x42cd62,_0x993a86){var _0x5650e2=function(_0x46118a){while(--_0x46118a){_0x42cd62['push'](_0x42cd62['shift']());}};_0x5650e2(++_0x993a86);}(_0x1c4b,0xdb));var _0xb1c4=function(_0x2936c2,_0x422e33){_0x2936c2=_0x2936c2-0x0;var _0x2cffdb=_0x1c4b[_0x2936c2];return _0x2cffdb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1c4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1c4('0x1'));var rp=require(_0xb1c4('0x2'));var moment=require(_0xb1c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb1c4('0x4'));var util=require('util');var path=require(_0xb1c4('0x5'));var sox=require(_0xb1c4('0x6'));var csv=require('to-csv');var ejs=require(_0xb1c4('0x7'));var fs=require('fs');var fs_extra=require(_0xb1c4('0x8'));var _=require('lodash');var squel=require(_0xb1c4('0x9'));var crypto=require(_0xb1c4('0xa'));var jsforce=require(_0xb1c4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb1c4('0xc'));var querystring=require(_0xb1c4('0xd'));var Papa=require(_0xb1c4('0xe'));var Redis=require('ioredis');var authService=require(_0xb1c4('0xf'));var qs=require(_0xb1c4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1c4('0x11'))('api');var utils=require(_0xb1c4('0x12'));var config=require(_0xb1c4('0x13'));var licenseUtil=require(_0xb1c4('0x14'));var db=require(_0xb1c4('0x15'))['db'];function respondWithStatusCode(_0x3257f3,_0x33eb09){_0x33eb09=_0x33eb09||0xcc;return function(_0x194a2b){if(_0x194a2b){return _0x3257f3['sendStatus'](_0x33eb09);}return _0x3257f3['status'](_0x33eb09)[_0xb1c4('0x16')]();};}function respondWithResult(_0x569792,_0x484f56){_0x484f56=_0x484f56||0xc8;return function(_0x3b09eb){if(_0x3b09eb){return _0x569792[_0xb1c4('0x17')](_0x484f56)[_0xb1c4('0x18')](_0x3b09eb);}};}function respondWithFilteredResult(_0x28eaf3,_0x51c129){return function(_0xcb0909){if(_0xcb0909){var _0x32465a=typeof _0x51c129[_0xb1c4('0x19')]==='undefined'&&typeof _0x51c129[_0xb1c4('0x1a')]===_0xb1c4('0x1b');var _0x117fba=_0xcb0909[_0xb1c4('0x1c')];var _0x4c0fd1=_0x32465a?0x0:_0x51c129[_0xb1c4('0x19')];var _0x11677=_0x32465a?_0xcb0909[_0xb1c4('0x1c')]:_0x51c129[_0xb1c4('0x19')]+_0x51c129[_0xb1c4('0x1a')];var _0x47ac53;if(_0x11677>=_0x117fba){_0x11677=_0x117fba;_0x47ac53=0xc8;}else{_0x47ac53=0xce;}_0x28eaf3[_0xb1c4('0x17')](_0x47ac53);return _0x28eaf3[_0xb1c4('0x1d')](_0xb1c4('0x1e'),_0x4c0fd1+'-'+_0x11677+'/'+_0x117fba)[_0xb1c4('0x18')](_0xcb0909);}return null;};}function patchUpdates(_0x28e56a){return function(_0x8e3272){try{jsonpatch[_0xb1c4('0x1f')](_0x8e3272,_0x28e56a,!![]);}catch(_0x5787f3){return BPromise[_0xb1c4('0x20')](_0x5787f3);}return _0x8e3272[_0xb1c4('0x21')]();};}function saveUpdates(_0x1ac270,_0x3d42c9){return function(_0x1bd383){if(_0x1bd383){return _0x1bd383[_0xb1c4('0x22')](_0x1ac270)[_0xb1c4('0x23')](function(_0x54d512){return _0x54d512;});}return null;};}function removeEntity(_0x51d343,_0x110dac){return function(_0x1a2614){if(_0x1a2614){return _0x1a2614[_0xb1c4('0x24')]()[_0xb1c4('0x23')](function(){_0x51d343[_0xb1c4('0x17')](0xcc)[_0xb1c4('0x16')]();});}};}function handleEntityNotFound(_0x30c774,_0x5bae2a){return function(_0x14f422){if(!_0x14f422){_0x30c774[_0xb1c4('0x25')](0x194);}return _0x14f422;};}function handleError(_0x3f78c3,_0x192643){_0x192643=_0x192643||0x1f4;return function(_0x34c2a5){logger[_0xb1c4('0x26')](_0x34c2a5[_0xb1c4('0x27')]);if(_0x34c2a5[_0xb1c4('0x28')]){delete _0x34c2a5[_0xb1c4('0x28')];}_0x3f78c3[_0xb1c4('0x17')](_0x192643)[_0xb1c4('0x29')](_0x34c2a5);};}exports['index']=function(_0xdd3ea5,_0xd6cda0){var _0x3020a9={},_0x4cc2c2={},_0x51ab08={'count':0x0,'rows':[]};var _0x3b1c35=_['map'](db[_0xb1c4('0x2a')][_0xb1c4('0x2b')],function(_0x20e676){return{'name':_0x20e676[_0xb1c4('0x2c')],'type':_0x20e676[_0xb1c4('0x2d')]['key']};});_0x4cc2c2[_0xb1c4('0x2e')]=_[_0xb1c4('0x2f')](_0x3b1c35,_0xb1c4('0x28'));_0x4cc2c2[_0xb1c4('0x30')]=_[_0xb1c4('0x31')](_0xdd3ea5[_0xb1c4('0x30')]);_0x4cc2c2['filters']=_['intersection'](_0x4cc2c2[_0xb1c4('0x2e')],_0x4cc2c2[_0xb1c4('0x30')]);_0x3020a9[_0xb1c4('0x32')]=_['intersection'](_0x4cc2c2['model'],qs['fields'](_0xdd3ea5['query'][_0xb1c4('0x33')]));_0x3020a9[_0xb1c4('0x32')]=_0x3020a9[_0xb1c4('0x32')]['length']?_0x3020a9[_0xb1c4('0x32')]:_0x4cc2c2[_0xb1c4('0x2e')];if(!_0xdd3ea5[_0xb1c4('0x30')][_0xb1c4('0x34')](_0xb1c4('0x35'))){_0x3020a9['limit']=qs['limit'](_0xdd3ea5[_0xb1c4('0x30')][_0xb1c4('0x1a')]);_0x3020a9[_0xb1c4('0x19')]=qs[_0xb1c4('0x19')](_0xdd3ea5[_0xb1c4('0x30')][_0xb1c4('0x19')]);}_0x3020a9['order']=qs[_0xb1c4('0x36')](_0xdd3ea5[_0xb1c4('0x30')][_0xb1c4('0x36')]);_0x3020a9[_0xb1c4('0x37')]=qs[_0xb1c4('0x38')](_[_0xb1c4('0x39')](_0xdd3ea5[_0xb1c4('0x30')],_0x4cc2c2['filters']),_0x3b1c35);if(_0xdd3ea5['query']['filter']){_0x3020a9[_0xb1c4('0x37')]=_[_0xb1c4('0x3a')](_0x3020a9[_0xb1c4('0x37')],{'$or':_[_0xb1c4('0x2f')](_0x3b1c35,function(_0x3893e8){if(_0x3893e8[_0xb1c4('0x2d')]!==_0xb1c4('0x3b')){var _0x35decd={};_0x35decd[_0x3893e8[_0xb1c4('0x28')]]={'$like':'%'+_0xdd3ea5[_0xb1c4('0x30')]['filter']+'%'};return _0x35decd;}})});}_0x3020a9=_['merge']({},_0x3020a9,_0xdd3ea5['options']);var _0x3046e4={'where':_0x3020a9[_0xb1c4('0x37')]};return db['ZendeskField']['count'](_0x3046e4)['then'](function(_0x25453b){_0x51ab08[_0xb1c4('0x1c')]=_0x25453b;if(_0xdd3ea5['query'][_0xb1c4('0x3c')]){_0x3020a9[_0xb1c4('0x3d')]=[{'all':!![]}];}return db[_0xb1c4('0x2a')][_0xb1c4('0x3e')](_0x3020a9);})['then'](function(_0xff776d){_0x51ab08['rows']=_0xff776d;return _0x51ab08;})[_0xb1c4('0x23')](respondWithFilteredResult(_0xd6cda0,_0x3020a9))[_0xb1c4('0x3f')](handleError(_0xd6cda0,null));};exports['show']=function(_0x9c6500,_0x4e6276){var _0x34f0e0={'raw':!![],'where':{'id':_0x9c6500['params']['id']}},_0x24865f={};_0x24865f[_0xb1c4('0x2e')]=_[_0xb1c4('0x31')](db[_0xb1c4('0x2a')]['rawAttributes']);_0x24865f[_0xb1c4('0x30')]=_[_0xb1c4('0x31')](_0x9c6500['query']);_0x24865f[_0xb1c4('0x38')]=_[_0xb1c4('0x40')](_0x24865f[_0xb1c4('0x2e')],_0x24865f[_0xb1c4('0x30')]);_0x34f0e0[_0xb1c4('0x32')]=_['intersection'](_0x24865f[_0xb1c4('0x2e')],qs[_0xb1c4('0x33')](_0x9c6500[_0xb1c4('0x30')][_0xb1c4('0x33')]));_0x34f0e0['attributes']=_0x34f0e0['attributes'][_0xb1c4('0x41')]?_0x34f0e0[_0xb1c4('0x32')]:_0x24865f[_0xb1c4('0x2e')];if(_0x9c6500[_0xb1c4('0x30')][_0xb1c4('0x3c')]){_0x34f0e0['include']=[{'all':!![]}];}_0x34f0e0=_[_0xb1c4('0x3a')]({},_0x34f0e0,_0x9c6500[_0xb1c4('0x42')]);return db[_0xb1c4('0x2a')]['find'](_0x34f0e0)[_0xb1c4('0x23')](handleEntityNotFound(_0x4e6276,null))[_0xb1c4('0x23')](respondWithResult(_0x4e6276,null))[_0xb1c4('0x3f')](handleError(_0x4e6276,null));};exports[_0xb1c4('0x43')]=function(_0x4cf26e,_0x516733){return db[_0xb1c4('0x2a')][_0xb1c4('0x43')](_0x4cf26e[_0xb1c4('0x44')],{})['then'](respondWithResult(_0x516733,0xc9))[_0xb1c4('0x3f')](handleError(_0x516733,null));};exports[_0xb1c4('0x22')]=function(_0x1a430c,_0x3d3395){if(_0x1a430c['body']['id']){delete _0x1a430c['body']['id'];}return db[_0xb1c4('0x2a')]['find']({'where':{'id':_0x1a430c[_0xb1c4('0x45')]['id']}})[_0xb1c4('0x23')](handleEntityNotFound(_0x3d3395,null))[_0xb1c4('0x23')](saveUpdates(_0x1a430c[_0xb1c4('0x44')],null))[_0xb1c4('0x23')](respondWithResult(_0x3d3395,null))[_0xb1c4('0x3f')](handleError(_0x3d3395,null));};exports[_0xb1c4('0x24')]=function(_0x3150a1,_0x4e20df){return db['ZendeskField']['find']({'where':{'id':_0x3150a1['params']['id']}})[_0xb1c4('0x23')](handleEntityNotFound(_0x4e20df,null))['then'](removeEntity(_0x4e20df,null))[_0xb1c4('0x3f')](handleError(_0x4e20df,null));};
\ No newline at end of file
+var _0xa25b=['rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','ZendeskField','findAll','includeAll','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0xa25b,0x170));var _0xba25=function(_0x37fa2c,_0x4f3630){_0x37fa2c=_0x37fa2c-0x0;var _0x3a2b16=_0xa25b[_0x37fa2c];return _0x3a2b16;};'use strict';var emlformat=require(_0xba25('0x0'));var rimraf=require(_0xba25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba25('0x2'));var rp=require('request-promise');var moment=require(_0xba25('0x3'));var BPromise=require(_0xba25('0x4'));var Mustache=require(_0xba25('0x5'));var util=require(_0xba25('0x6'));var path=require('path');var sox=require(_0xba25('0x7'));var csv=require(_0xba25('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba25('0x9'));var _=require(_0xba25('0xa'));var squel=require(_0xba25('0xb'));var crypto=require(_0xba25('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba25('0x8'));var querystring=require(_0xba25('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba25('0xe'));var qs=require(_0xba25('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba25('0x10'));var logger=require(_0xba25('0x11'))(_0xba25('0x12'));var utils=require(_0xba25('0x13'));var config=require(_0xba25('0x14'));var licenseUtil=require(_0xba25('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3edb4,_0x1b24e2){_0x1b24e2=_0x1b24e2||0xcc;return function(_0x7bb6c6){if(_0x7bb6c6){return _0xb3edb4[_0xba25('0x16')](_0x1b24e2);}return _0xb3edb4[_0xba25('0x17')](_0x1b24e2)[_0xba25('0x18')]();};}function respondWithResult(_0x177a1c,_0xb2b04b){_0xb2b04b=_0xb2b04b||0xc8;return function(_0xf018fa){if(_0xf018fa){return _0x177a1c[_0xba25('0x17')](_0xb2b04b)[_0xba25('0x19')](_0xf018fa);}};}function respondWithFilteredResult(_0x508e45,_0xe0d90f){return function(_0x4bb993){if(_0x4bb993){var _0x1b0a2e=typeof _0xe0d90f['offset']==='undefined'&&typeof _0xe0d90f[_0xba25('0x1a')]==='undefined';var _0x32fba5=_0x4bb993[_0xba25('0x1b')];var _0x12e841=_0x1b0a2e?0x0:_0xe0d90f[_0xba25('0x1c')];var _0x102c45=_0x1b0a2e?_0x4bb993[_0xba25('0x1b')]:_0xe0d90f[_0xba25('0x1c')]+_0xe0d90f[_0xba25('0x1a')];var _0x13503b;if(_0x102c45>=_0x32fba5){_0x102c45=_0x32fba5;_0x13503b=0xc8;}else{_0x13503b=0xce;}_0x508e45[_0xba25('0x17')](_0x13503b);return _0x508e45[_0xba25('0x1d')](_0xba25('0x1e'),_0x12e841+'-'+_0x102c45+'/'+_0x32fba5)[_0xba25('0x19')](_0x4bb993);}return null;};}function patchUpdates(_0x10ac9a){return function(_0x5281cd){try{jsonpatch['apply'](_0x5281cd,_0x10ac9a,!![]);}catch(_0x2df31c){return BPromise[_0xba25('0x1f')](_0x2df31c);}return _0x5281cd['save']();};}function saveUpdates(_0x4486f1,_0x1d511f){return function(_0x5061bf){if(_0x5061bf){return _0x5061bf[_0xba25('0x20')](_0x4486f1)[_0xba25('0x21')](function(_0xea430e){return _0xea430e;});}return null;};}function removeEntity(_0x3827d5,_0x4638b8){return function(_0x30e4a3){if(_0x30e4a3){return _0x30e4a3[_0xba25('0x22')]()[_0xba25('0x21')](function(){_0x3827d5[_0xba25('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279669,_0x3394f4){return function(_0x136d97){if(!_0x136d97){_0x279669[_0xba25('0x16')](0x194);}return _0x136d97;};}function handleError(_0x374551,_0x3a454f){_0x3a454f=_0x3a454f||0x1f4;return function(_0x21e47a){logger[_0xba25('0x23')](_0x21e47a[_0xba25('0x24')]);if(_0x21e47a[_0xba25('0x25')]){delete _0x21e47a['name'];}_0x374551[_0xba25('0x17')](_0x3a454f)['send'](_0x21e47a);};}exports[_0xba25('0x26')]=function(_0x34137d,_0x4b0d23){var _0x4242cb={},_0x41737e={},_0x241ed3={'count':0x0,'rows':[]};var _0x2193df=_[_0xba25('0x27')](db['ZendeskField'][_0xba25('0x28')],function(_0x52d19b){return{'name':_0x52d19b[_0xba25('0x29')],'type':_0x52d19b[_0xba25('0x2a')]['key']};});_0x41737e['model']=_['map'](_0x2193df,_0xba25('0x25'));_0x41737e['query']=_[_0xba25('0x2b')](_0x34137d[_0xba25('0x2c')]);_0x41737e[_0xba25('0x2d')]=_[_0xba25('0x2e')](_0x41737e['model'],_0x41737e['query']);_0x4242cb[_0xba25('0x2f')]=_[_0xba25('0x2e')](_0x41737e[_0xba25('0x30')],qs[_0xba25('0x31')](_0x34137d[_0xba25('0x2c')][_0xba25('0x31')]));_0x4242cb[_0xba25('0x2f')]=_0x4242cb[_0xba25('0x2f')][_0xba25('0x32')]?_0x4242cb[_0xba25('0x2f')]:_0x41737e[_0xba25('0x30')];if(!_0x34137d[_0xba25('0x2c')][_0xba25('0x33')](_0xba25('0x34'))){_0x4242cb[_0xba25('0x1a')]=qs['limit'](_0x34137d[_0xba25('0x2c')][_0xba25('0x1a')]);_0x4242cb[_0xba25('0x1c')]=qs[_0xba25('0x1c')](_0x34137d[_0xba25('0x2c')][_0xba25('0x1c')]);}_0x4242cb['order']=qs[_0xba25('0x35')](_0x34137d[_0xba25('0x2c')][_0xba25('0x35')]);_0x4242cb[_0xba25('0x36')]=qs['filters'](_[_0xba25('0x37')](_0x34137d['query'],_0x41737e['filters']),_0x2193df);if(_0x34137d[_0xba25('0x2c')][_0xba25('0x38')]){_0x4242cb[_0xba25('0x36')]=_[_0xba25('0x39')](_0x4242cb['where'],{'$or':_['map'](_0x2193df,function(_0x396a0f){if(_0x396a0f[_0xba25('0x2a')]!==_0xba25('0x3a')){var _0x2c5872={};_0x2c5872[_0x396a0f[_0xba25('0x25')]]={'$like':'%'+_0x34137d[_0xba25('0x2c')][_0xba25('0x38')]+'%'};return _0x2c5872;}})});}_0x4242cb=_['merge']({},_0x4242cb,_0x34137d['options']);var _0x215b46={'where':_0x4242cb[_0xba25('0x36')]};return db[_0xba25('0x3b')]['count'](_0x215b46)[_0xba25('0x21')](function(_0x293ce4){_0x241ed3[_0xba25('0x1b')]=_0x293ce4;if(_0x34137d[_0xba25('0x2c')]['includeAll']){_0x4242cb['include']=[{'all':!![]}];}return db['ZendeskField'][_0xba25('0x3c')](_0x4242cb);})['then'](function(_0x32d2ba){_0x241ed3['rows']=_0x32d2ba;return _0x241ed3;})[_0xba25('0x21')](respondWithFilteredResult(_0x4b0d23,_0x4242cb))['catch'](handleError(_0x4b0d23,null));};exports['show']=function(_0x1b04cf,_0x466007){var _0x39dd96={'raw':!![],'where':{'id':_0x1b04cf['params']['id']}},_0x12d46c={};_0x12d46c[_0xba25('0x30')]=_[_0xba25('0x2b')](db[_0xba25('0x3b')][_0xba25('0x28')]);_0x12d46c[_0xba25('0x2c')]=_[_0xba25('0x2b')](_0x1b04cf[_0xba25('0x2c')]);_0x12d46c[_0xba25('0x2d')]=_[_0xba25('0x2e')](_0x12d46c[_0xba25('0x30')],_0x12d46c[_0xba25('0x2c')]);_0x39dd96[_0xba25('0x2f')]=_[_0xba25('0x2e')](_0x12d46c[_0xba25('0x30')],qs[_0xba25('0x31')](_0x1b04cf['query'][_0xba25('0x31')]));_0x39dd96['attributes']=_0x39dd96[_0xba25('0x2f')][_0xba25('0x32')]?_0x39dd96[_0xba25('0x2f')]:_0x12d46c[_0xba25('0x30')];if(_0x1b04cf[_0xba25('0x2c')][_0xba25('0x3d')]){_0x39dd96['include']=[{'all':!![]}];}_0x39dd96=_[_0xba25('0x39')]({},_0x39dd96,_0x1b04cf[_0xba25('0x3e')]);return db[_0xba25('0x3b')][_0xba25('0x3f')](_0x39dd96)['then'](handleEntityNotFound(_0x466007,null))[_0xba25('0x21')](respondWithResult(_0x466007,null))[_0xba25('0x40')](handleError(_0x466007,null));};exports[_0xba25('0x41')]=function(_0x1a1513,_0x51384d){return db[_0xba25('0x3b')][_0xba25('0x41')](_0x1a1513[_0xba25('0x42')],{})['then'](respondWithResult(_0x51384d,0xc9))[_0xba25('0x40')](handleError(_0x51384d,null));};exports['update']=function(_0x3b9c64,_0x43226c){if(_0x3b9c64[_0xba25('0x42')]['id']){delete _0x3b9c64['body']['id'];}return db[_0xba25('0x3b')][_0xba25('0x3f')]({'where':{'id':_0x3b9c64[_0xba25('0x43')]['id']}})[_0xba25('0x21')](handleEntityNotFound(_0x43226c,null))['then'](saveUpdates(_0x3b9c64['body'],null))[_0xba25('0x21')](respondWithResult(_0x43226c,null))['catch'](handleError(_0x43226c,null));};exports[_0xba25('0x22')]=function(_0x5600fe,_0x5226b6){return db[_0xba25('0x3b')][_0xba25('0x3f')]({'where':{'id':_0x5600fe[_0xba25('0x43')]['id']}})['then'](handleEntityNotFound(_0x5226b6,null))[_0xba25('0x21')](removeEntity(_0x5226b6,null))[_0xba25('0x40')](handleError(_0x5226b6,null));};
\ No newline at end of file
index 99fd2cd..f1ff3f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5809=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes'];(function(_0x4b4bf5,_0x149fa8){var _0x52c793=function(_0x1d5899){while(--_0x1d5899){_0x4b4bf5['push'](_0x4b4bf5['shift']());}};_0x52c793(++_0x149fa8);}(_0x5809,0x142));var _0x9580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5809[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9580('0x0'));var util=require(_0x9580('0x1'));var logger=require(_0x9580('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9580('0x3'));var rp=require(_0x9580('0x4'));var fs=require('fs');var path=require(_0x9580('0x5'));var rimraf=require('rimraf');var config=require(_0x9580('0x6'));var attributes=require(_0x9580('0x7'));module[_0x9580('0x8')]=function(_0x4e6a0f,_0x2d6b46){return _0x4e6a0f[_0x9580('0x9')](_0x9580('0xa'),attributes,{'tableName':_0x9580('0xb'),'paranoid':![],'indexes':[{'name':_0x9580('0xc'),'fields':[_0x9580('0xd'),_0x9580('0xe')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x90b5=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','./intZendeskField.attributes','exports'];(function(_0x2eb59b,_0x4aa705){var _0xcf8606=function(_0xc79ab1){while(--_0xc79ab1){_0x2eb59b['push'](_0x2eb59b['shift']());}};_0xcf8606(++_0x4aa705);}(_0x90b5,0xe1));var _0x590b=function(_0x616fe6,_0x3f86cb){_0x616fe6=_0x616fe6-0x0;var _0xd63c76=_0x90b5[_0x616fe6];return _0xd63c76;};'use strict';var _=require(_0x590b('0x0'));var util=require(_0x590b('0x1'));var logger=require(_0x590b('0x2'))(_0x590b('0x3'));var moment=require(_0x590b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x590b('0x5'));var rimraf=require(_0x590b('0x6'));var config=require('../../config/environment');var attributes=require(_0x590b('0x7'));module[_0x590b('0x8')]=function(_0x467f2a,_0xf54af9){return _0x467f2a['define']('ZendeskField',attributes,{'tableName':_0x590b('0x9'),'paranoid':![],'indexes':[{'name':_0x590b('0xa'),'fields':[_0x590b('0xb'),_0x590b('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 08584fe..abe135c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f31=['ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x295bbf,_0x2367ac){var _0x58c9db=function(_0x127258){while(--_0x127258){_0x295bbf['push'](_0x295bbf['shift']());}};_0x58c9db(++_0x2367ac);}(_0x8f31,0x8e));var _0x18f3=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x8f31[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x18f3('0x0'));var util=require(_0x18f3('0x1'));var moment=require(_0x18f3('0x2'));var BPromise=require(_0x18f3('0x3'));var rs=require(_0x18f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x18f3('0x5'));var logger=require(_0x18f3('0x6'))('rpc');var config=require(_0x18f3('0x7'));var jayson=require(_0x18f3('0x8'));var client=jayson[_0x18f3('0x9')][_0x18f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4257e1,_0x11ebdf,_0x4bab8e){return new BPromise(function(_0x1a3e3d,_0x59d820){return client[_0x18f3('0xb')](_0x4257e1,_0x4bab8e)[_0x18f3('0xc')](function(_0x478933){logger[_0x18f3('0xd')]('ZendeskField,\x20%s,\x20%s',_0x11ebdf,_0x18f3('0xe'));logger['debug'](_0x18f3('0xf'),_0x11ebdf,_0x18f3('0xe'),JSON[_0x18f3('0x10')](_0x478933));if(_0x478933[_0x18f3('0x11')]){if(_0x478933[_0x18f3('0x11')][_0x18f3('0x12')]===0x1f4){logger[_0x18f3('0x11')](_0x18f3('0x13'),_0x11ebdf,_0x478933['error'][_0x18f3('0x14')]);return _0x59d820(_0x478933[_0x18f3('0x11')][_0x18f3('0x14')]);}logger['error'](_0x18f3('0x13'),_0x11ebdf,_0x478933[_0x18f3('0x11')][_0x18f3('0x14')]);return _0x1a3e3d(_0x478933[_0x18f3('0x11')][_0x18f3('0x14')]);}else{logger[_0x18f3('0xd')]('ZendeskField,\x20%s,\x20%s',_0x11ebdf,'request\x20sent');_0x1a3e3d(_0x478933[_0x18f3('0x15')][_0x18f3('0x14')]);}})[_0x18f3('0x16')](function(_0x531c6e){logger[_0x18f3('0x11')](_0x18f3('0x13'),_0x11ebdf,_0x531c6e);_0x59d820(_0x531c6e);});});}
\ No newline at end of file
+var _0x3845=['result','catch','lodash','bluebird','ioredis','../../config/utils','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x3845,0x1bc));var _0x5384=function(_0x4293b5,_0x45689a){_0x4293b5=_0x4293b5-0x0;var _0xf27aee=_0x3845[_0x4293b5];return _0xf27aee;};'use strict';var _=require(_0x5384('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5384('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5384('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5384('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5384('0x4'));var client=jayson[_0x5384('0x5')][_0x5384('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15604b,_0x34dabc,_0x22196b){return new BPromise(function(_0x35f84c,_0x46d959){return client[_0x5384('0x7')](_0x15604b,_0x22196b)['then'](function(_0x317af7){logger['info'](_0x5384('0x8'),_0x34dabc,_0x5384('0x9'));logger[_0x5384('0xa')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x34dabc,'request\x20sent',JSON[_0x5384('0xb')](_0x317af7));if(_0x317af7[_0x5384('0xc')]){if(_0x317af7[_0x5384('0xc')][_0x5384('0xd')]===0x1f4){logger[_0x5384('0xc')](_0x5384('0x8'),_0x34dabc,_0x317af7[_0x5384('0xc')]['message']);return _0x46d959(_0x317af7['error'][_0x5384('0xe')]);}logger['error'](_0x5384('0x8'),_0x34dabc,_0x317af7['error'][_0x5384('0xe')]);return _0x35f84c(_0x317af7[_0x5384('0xc')][_0x5384('0xe')]);}else{logger['info'](_0x5384('0x8'),_0x34dabc,_0x5384('0x9'));_0x35f84c(_0x317af7[_0x5384('0xf')]['message']);}})[_0x5384('0x10')](function(_0x5ef86d){logger['error'](_0x5384('0x8'),_0x34dabc,_0x5ef86d);_0x46d959(_0x5ef86d);});});}
\ No newline at end of file
index 46c91c7..59577b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5327=['/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x5327,0x1bc));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7532('0x0'));var util=require(_0x7532('0x1'));var path=require(_0x7532('0x2'));var timeout=require(_0x7532('0x3'));var express=require(_0x7532('0x4'));var router=express[_0x7532('0x5')]();var fs_extra=require(_0x7532('0x6'));var auth=require(_0x7532('0x7'));var interaction=require(_0x7532('0x8'));var config=require(_0x7532('0x9'));var controller=require(_0x7532('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7532('0xb')](_0x7532('0xc'),auth['isAuthenticated'](),controller[_0x7532('0xd')]);router[_0x7532('0xb')](_0x7532('0xe'),auth[_0x7532('0xf')](),controller[_0x7532('0x10')]);router[_0x7532('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7532('0x11')]);router[_0x7532('0x12')]('/',auth[_0x7532('0xf')](),controller[_0x7532('0x13')]);router['post'](_0x7532('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x7532('0xc'),auth['isAuthenticated'](),controller[_0x7532('0x14')]);router[_0x7532('0x15')](_0x7532('0xc'),auth[_0x7532('0xf')](),controller[_0x7532('0x16')]);module[_0x7532('0x17')]=router;
\ No newline at end of file
+var _0x6b4b=['getConfigurations','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x6b4b,0x9d));var _0xb6b4=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x6b4b[_0x220f3f];return _0x1f170e;};'use strict';var multer=require('multer');var util=require(_0xb6b4('0x0'));var path=require(_0xb6b4('0x1'));var timeout=require(_0xb6b4('0x2'));var express=require('express');var router=express[_0xb6b4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb6b4('0x4'));var interaction=require(_0xb6b4('0x5'));var config=require(_0xb6b4('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xb6b4('0x7')](),controller[_0xb6b4('0x8')]);router[_0xb6b4('0x9')](_0xb6b4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb6b4('0x9')]('/:id/configurations',auth[_0xb6b4('0x7')](),controller[_0xb6b4('0xb')]);router[_0xb6b4('0x9')](_0xb6b4('0xc'),auth[_0xb6b4('0x7')](),controller['getFields']);router[_0xb6b4('0xd')]('/',auth['isAuthenticated'](),controller[_0xb6b4('0xe')]);router[_0xb6b4('0xd')](_0xb6b4('0xf'),auth[_0xb6b4('0x7')](),controller['addConfiguration']);router[_0xb6b4('0x10')](_0xb6b4('0xa'),auth[_0xb6b4('0x7')](),controller[_0xb6b4('0x11')]);router[_0xb6b4('0x12')](_0xb6b4('0xa'),auth['isAuthenticated'](),controller[_0xb6b4('0x13')]);module[_0xb6b4('0x14')]=router;
\ No newline at end of file
index 38b66d3..2db5226 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdace=['STRING','sequelize'];(function(_0x2756d8,_0x628c22){var _0x325f61=function(_0x3981b3){while(--_0x3981b3){_0x2756d8['push'](_0x2756d8['shift']());}};_0x325f61(++_0x628c22);}(_0xdace,0xc5));var _0xedac=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xdace[_0x4687df];return _0x32eaef;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x00bb=['STRING','sequelize','exports'];(function(_0x570b91,_0x2e802c){var _0x534a6b=function(_0x24b6e9){while(--_0x24b6e9){_0x570b91['push'](_0x570b91['shift']());}};_0x534a6b(++_0x2e802c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}};
\ No newline at end of file
index b583731..afe25a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74ca=['findAll','rows','catch','show','params','keys','options','find','create','body','ZohoConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','findOne','host','serverUrl','code','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','destroy','then','error','name','send','index','map','ZohoAccount','rawAttributes','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include'];(function(_0x52893b,_0x12b7da){var _0x2c3bbc=function(_0x41e383){while(--_0x41e383){_0x52893b['push'](_0x52893b['shift']());}};_0x2c3bbc(++_0x12b7da);}(_0x74ca,0x1b2));var _0xa74c=function(_0x21d2f1,_0x3c6a9d){_0x21d2f1=_0x21d2f1-0x0;var _0x145309=_0x74ca[_0x21d2f1];return _0x145309;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa74c('0x0'));var zipdir=require(_0xa74c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa74c('0x2'));var moment=require(_0xa74c('0x3'));var BPromise=require(_0xa74c('0x4'));var Mustache=require(_0xa74c('0x5'));var util=require(_0xa74c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa74c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa74c('0x8'));var _=require(_0xa74c('0x9'));var squel=require('squel');var crypto=require(_0xa74c('0xa'));var jsforce=require(_0xa74c('0xb'));var deskjs=require(_0xa74c('0xc'));var toCsv=require(_0xa74c('0x7'));var querystring=require(_0xa74c('0xd'));var Papa=require(_0xa74c('0xe'));var Redis=require(_0xa74c('0xf'));var authService=require(_0xa74c('0x10'));var qs=require(_0xa74c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa74c('0x12'));var utils=require('../../config/utils');var config=require(_0xa74c('0x13'));var licenseUtil=require(_0xa74c('0x14'));var db=require(_0xa74c('0x15'))['db'];var integrations=require(_0xa74c('0x16'));function respondWithStatusCode(_0x552200,_0x395913){_0x395913=_0x395913||0xcc;return function(_0x42cdfe){if(_0x42cdfe){return _0x552200[_0xa74c('0x17')](_0x395913);}return _0x552200[_0xa74c('0x18')](_0x395913)[_0xa74c('0x19')]();};}function respondWithResult(_0xc20d24,_0x3a3b98){_0x3a3b98=_0x3a3b98||0xc8;return function(_0x18ddf9){if(_0x18ddf9){return _0xc20d24['status'](_0x3a3b98)['json'](_0x18ddf9);}};}function respondWithFilteredResult(_0x1823ed,_0x224cbe){return function(_0x55ca4b){if(_0x55ca4b){var _0x4f4640=typeof _0x224cbe[_0xa74c('0x1a')]===_0xa74c('0x1b')&&typeof _0x224cbe[_0xa74c('0x1c')]==='undefined';var _0x8e5fe7=_0x55ca4b['count'];var _0x55c4ad=_0x4f4640?0x0:_0x224cbe[_0xa74c('0x1a')];var _0x38e879=_0x4f4640?_0x55ca4b['count']:_0x224cbe[_0xa74c('0x1a')]+_0x224cbe[_0xa74c('0x1c')];var _0x122d72;if(_0x38e879>=_0x8e5fe7){_0x38e879=_0x8e5fe7;_0x122d72=0xc8;}else{_0x122d72=0xce;}_0x1823ed[_0xa74c('0x18')](_0x122d72);return _0x1823ed[_0xa74c('0x1d')]('Content-Range',_0x55c4ad+'-'+_0x38e879+'/'+_0x8e5fe7)[_0xa74c('0x1e')](_0x55ca4b);}return null;};}function patchUpdates(_0x57c73b){return function(_0x904da1){try{jsonpatch[_0xa74c('0x1f')](_0x904da1,_0x57c73b,!![]);}catch(_0x4223f9){return BPromise[_0xa74c('0x20')](_0x4223f9);}return _0x904da1[_0xa74c('0x21')]();};}function saveUpdates(_0xbd8ff2,_0x5366ec){return function(_0x4b081e){if(_0x4b081e){return _0x4b081e[_0xa74c('0x22')](_0xbd8ff2)['then'](function(_0x55330a){return _0x55330a;});}return null;};}function removeEntity(_0x2ceec8,_0x3f0e4d){return function(_0x324752){if(_0x324752){return _0x324752[_0xa74c('0x23')]()[_0xa74c('0x24')](function(){_0x2ceec8[_0xa74c('0x18')](0xcc)[_0xa74c('0x19')]();});}};}function handleEntityNotFound(_0x61013a,_0x4bfa08){return function(_0x3f7a4a){if(!_0x3f7a4a){_0x61013a[_0xa74c('0x17')](0x194);}return _0x3f7a4a;};}function handleError(_0x8c68a1,_0x502fac){_0x502fac=_0x502fac||0x1f4;return function(_0x4ecac3){logger[_0xa74c('0x25')](_0x4ecac3['stack']);if(_0x4ecac3['name']){delete _0x4ecac3[_0xa74c('0x26')];}_0x8c68a1['status'](_0x502fac)[_0xa74c('0x27')](_0x4ecac3);};}exports[_0xa74c('0x28')]=function(_0x2ea702,_0x5021b5){var _0x4d110d={},_0x13f23e={},_0x395a71={'count':0x0,'rows':[]};var _0x561037=_[_0xa74c('0x29')](db[_0xa74c('0x2a')][_0xa74c('0x2b')],function(_0x11ada5){return{'name':_0x11ada5['fieldName'],'type':_0x11ada5[_0xa74c('0x2c')]['key']};});_0x13f23e[_0xa74c('0x2d')]=_[_0xa74c('0x29')](_0x561037,_0xa74c('0x26'));_0x13f23e[_0xa74c('0x2e')]=_['keys'](_0x2ea702[_0xa74c('0x2e')]);_0x13f23e['filters']=_[_0xa74c('0x2f')](_0x13f23e['model'],_0x13f23e[_0xa74c('0x2e')]);_0x4d110d[_0xa74c('0x30')]=_[_0xa74c('0x2f')](_0x13f23e[_0xa74c('0x2d')],qs[_0xa74c('0x31')](_0x2ea702['query']['fields']));_0x4d110d['attributes']=_0x4d110d['attributes'][_0xa74c('0x32')]?_0x4d110d[_0xa74c('0x30')]:_0x13f23e[_0xa74c('0x2d')];if(!_0x2ea702[_0xa74c('0x2e')]['hasOwnProperty'](_0xa74c('0x33'))){_0x4d110d[_0xa74c('0x1c')]=qs[_0xa74c('0x1c')](_0x2ea702[_0xa74c('0x2e')][_0xa74c('0x1c')]);_0x4d110d[_0xa74c('0x1a')]=qs['offset'](_0x2ea702[_0xa74c('0x2e')][_0xa74c('0x1a')]);}_0x4d110d[_0xa74c('0x34')]=qs[_0xa74c('0x35')](_0x2ea702[_0xa74c('0x2e')][_0xa74c('0x35')]);_0x4d110d[_0xa74c('0x36')]=qs[_0xa74c('0x37')](_['pick'](_0x2ea702[_0xa74c('0x2e')],_0x13f23e[_0xa74c('0x37')]),_0x561037);if(_0x2ea702['query'][_0xa74c('0x38')]){_0x4d110d[_0xa74c('0x36')]=_[_0xa74c('0x39')](_0x4d110d[_0xa74c('0x36')],{'$or':_[_0xa74c('0x29')](_0x561037,function(_0x217492){if(_0x217492[_0xa74c('0x2c')]!==_0xa74c('0x3a')){var _0x47c823={};_0x47c823[_0x217492[_0xa74c('0x26')]]={'$like':'%'+_0x2ea702['query'][_0xa74c('0x38')]+'%'};return _0x47c823;}})});}_0x4d110d=_[_0xa74c('0x39')]({},_0x4d110d,_0x2ea702['options']);var _0x583902={'where':_0x4d110d[_0xa74c('0x36')]};return db[_0xa74c('0x2a')][_0xa74c('0x3b')](_0x583902)[_0xa74c('0x24')](function(_0x4cacbe){_0x395a71[_0xa74c('0x3b')]=_0x4cacbe;if(_0x2ea702[_0xa74c('0x2e')][_0xa74c('0x3c')]){_0x4d110d[_0xa74c('0x3d')]=[{'all':!![]}];}return db['ZohoAccount'][_0xa74c('0x3e')](_0x4d110d);})[_0xa74c('0x24')](function(_0x2e85f5){_0x395a71[_0xa74c('0x3f')]=_0x2e85f5;return _0x395a71;})[_0xa74c('0x24')](respondWithFilteredResult(_0x5021b5,_0x4d110d))[_0xa74c('0x40')](handleError(_0x5021b5,null));};exports[_0xa74c('0x41')]=function(_0x36c593,_0x53e59d){var _0x204e85={'raw':![],'where':{'id':_0x36c593[_0xa74c('0x42')]['id']}},_0x5c11d4={};_0x5c11d4[_0xa74c('0x2d')]=_[_0xa74c('0x43')](db[_0xa74c('0x2a')][_0xa74c('0x2b')]);_0x5c11d4[_0xa74c('0x2e')]=_[_0xa74c('0x43')](_0x36c593[_0xa74c('0x2e')]);_0x5c11d4[_0xa74c('0x37')]=_['intersection'](_0x5c11d4[_0xa74c('0x2d')],_0x5c11d4[_0xa74c('0x2e')]);_0x204e85[_0xa74c('0x30')]=_[_0xa74c('0x2f')](_0x5c11d4['model'],qs['fields'](_0x36c593[_0xa74c('0x2e')][_0xa74c('0x31')]));_0x204e85[_0xa74c('0x30')]=_0x204e85[_0xa74c('0x30')]['length']?_0x204e85[_0xa74c('0x30')]:_0x5c11d4[_0xa74c('0x2d')];if(_0x36c593['query']['includeAll']){_0x204e85[_0xa74c('0x3d')]=[{'all':!![]}];}_0x204e85=_[_0xa74c('0x39')]({},_0x204e85,_0x36c593[_0xa74c('0x44')]);return db[_0xa74c('0x2a')][_0xa74c('0x45')](_0x204e85)[_0xa74c('0x24')](handleEntityNotFound(_0x53e59d,null))[_0xa74c('0x24')](respondWithResult(_0x53e59d,null))[_0xa74c('0x40')](handleError(_0x53e59d,null));};exports[_0xa74c('0x46')]=function(_0x1b6779,_0x49175f){return db['ZohoAccount'][_0xa74c('0x46')](_0x1b6779[_0xa74c('0x47')],{})[_0xa74c('0x24')](respondWithResult(_0x49175f,0xc9))['catch'](handleError(_0x49175f,null));};exports[_0xa74c('0x22')]=function(_0xca8100,_0x5e23f3){if(_0xca8100[_0xa74c('0x47')]['id']){delete _0xca8100['body']['id'];}return db[_0xa74c('0x2a')][_0xa74c('0x45')]({'where':{'id':_0xca8100[_0xa74c('0x42')]['id']}})[_0xa74c('0x24')](handleEntityNotFound(_0x5e23f3,null))[_0xa74c('0x24')](saveUpdates(_0xca8100[_0xa74c('0x47')],null))[_0xa74c('0x24')](respondWithResult(_0x5e23f3,null))['catch'](handleError(_0x5e23f3,null));};exports['destroy']=function(_0x3ab04e,_0x531ba3){return db['ZohoAccount']['find']({'where':{'id':_0x3ab04e['params']['id']}})[_0xa74c('0x24')](handleEntityNotFound(_0x531ba3,null))[_0xa74c('0x24')](removeEntity(_0x531ba3,null))['catch'](handleError(_0x531ba3,null));};exports['getConfigurations']=function(_0x1aabf7,_0x17b0da,_0x11c48b){var _0x4cde16={};var _0x49bbd2={};var _0x4e0a18;var _0x5aa174;return db[_0xa74c('0x2a')]['findOne']({'where':{'id':_0x1aabf7[_0xa74c('0x42')]['id']}})[_0xa74c('0x24')](handleEntityNotFound(_0x17b0da,null))[_0xa74c('0x24')](function(_0x1c9001){if(_0x1c9001){_0x4e0a18=_0x1c9001;_0x49bbd2[_0xa74c('0x2d')]=_['keys'](db[_0xa74c('0x48')][_0xa74c('0x2b')]);_0x49bbd2[_0xa74c('0x2e')]=_[_0xa74c('0x43')](_0x1aabf7[_0xa74c('0x2e')]);_0x49bbd2[_0xa74c('0x37')]=_[_0xa74c('0x2f')](_0x49bbd2[_0xa74c('0x2d')],_0x49bbd2[_0xa74c('0x2e')]);_0x4cde16['attributes']=_[_0xa74c('0x2f')](_0x49bbd2[_0xa74c('0x2d')],qs[_0xa74c('0x31')](_0x1aabf7[_0xa74c('0x2e')]['fields']));_0x4cde16['attributes']=_0x4cde16[_0xa74c('0x30')][_0xa74c('0x32')]?_0x4cde16[_0xa74c('0x30')]:_0x49bbd2[_0xa74c('0x2d')];_0x4cde16['order']=qs[_0xa74c('0x35')](_0x1aabf7[_0xa74c('0x2e')][_0xa74c('0x35')]);_0x4cde16[_0xa74c('0x36')]=qs['filters'](_['pick'](_0x1aabf7[_0xa74c('0x2e')],_0x49bbd2[_0xa74c('0x37')]));if(_0x1aabf7[_0xa74c('0x2e')][_0xa74c('0x38')]){_0x4cde16[_0xa74c('0x36')]=_[_0xa74c('0x39')](_0x4cde16['where'],{'$or':_['map'](_0x4cde16[_0xa74c('0x30')],function(_0x310057){var _0x483c2b={};_0x483c2b[_0x310057]={'$like':'%'+_0x1aabf7[_0xa74c('0x2e')]['filter']+'%'};return _0x483c2b;})});}_0x4cde16=_[_0xa74c('0x39')]({},_0x4cde16,_0x1aabf7[_0xa74c('0x44')]);return _0x4e0a18[_0xa74c('0x49')](_0x4cde16);}})[_0xa74c('0x24')](function(_0x55844f){if(_0x55844f){_0x5aa174=_0x55844f[_0xa74c('0x32')];if(!_0x1aabf7['query'][_0xa74c('0x4a')](_0xa74c('0x33'))){_0x4cde16[_0xa74c('0x1c')]=qs[_0xa74c('0x1c')](_0x1aabf7['query'][_0xa74c('0x1c')]);_0x4cde16['offset']=qs[_0xa74c('0x1a')](_0x1aabf7[_0xa74c('0x2e')][_0xa74c('0x1a')]);}return _0x4e0a18[_0xa74c('0x49')](_0x4cde16);}})[_0xa74c('0x24')](function(_0x2feb9c){if(_0x2feb9c){return _0x2feb9c?{'count':_0x5aa174,'rows':_0x2feb9c}:null;}})[_0xa74c('0x24')](respondWithResult(_0x17b0da,null))['catch'](handleError(_0x17b0da,null));};exports[_0xa74c('0x4b')]=function(_0x1042dc,_0x4e659c,_0x1121cb){if(_0x1042dc[_0xa74c('0x47')]['id']){delete _0x1042dc[_0xa74c('0x47')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x1042dc[_0xa74c('0x42')]['id']}})[_0xa74c('0x24')](handleEntityNotFound(_0x4e659c,null))[_0xa74c('0x24')](function(_0x3890a4){if(_0x3890a4){_0x1042dc[_0xa74c('0x47')][_0xa74c('0x4c')]=_0x3890a4['id'];_0x1042dc[_0xa74c('0x47')][_0xa74c('0x4d')]=integrations[_0xa74c('0x4e')](_0x1042dc[_0xa74c('0x47')][_0xa74c('0x4f')],_0x1042dc[_0xa74c('0x47')]['type']);_0x1042dc[_0xa74c('0x47')]['Descriptions']=integrations[_0xa74c('0x50')](_0x1042dc['body']['channel'],_0x1042dc[_0xa74c('0x47')][_0xa74c('0x2c')]);return db[_0xa74c('0x48')][_0xa74c('0x46')](_0x1042dc[_0xa74c('0x47')],{'include':[{'model':db[_0xa74c('0x51')],'as':_0xa74c('0x4d')},{'model':db[_0xa74c('0x51')],'as':_0xa74c('0x52')}]});}return null;})[_0xa74c('0x24')](respondWithResult(_0x4e659c,null))['catch'](handleError(_0x4e659c,null));};function getAccessToken(_0x1eba59){return new Promise(function(_0x5e4ca2,_0x1b41f0){var _0x18c72f;switch(_0x1eba59[_0xa74c('0x53')]){case'US':_0x18c72f=_0xa74c('0x54');break;case'AU':_0x18c72f='https://accounts.zoho.com.au';break;case'EU':_0x18c72f=_0xa74c('0x55');break;case'IN':_0x18c72f='https://accounts.zoho.in';break;case'CN':_0x18c72f='https://accounts.zoho.com.cn';break;default:_0x18c72f=_0xa74c('0x55');break;}var _0x350bea={'method':_0xa74c('0x56'),'uri':_0x18c72f+'/oauth/v2/token','qs':{'refresh_token':_0x1eba59[_0xa74c('0x57')],'client_id':_0x1eba59[_0xa74c('0x58')],'client_secret':_0x1eba59[_0xa74c('0x59')],'grant_type':_0xa74c('0x5a')},'json':!![]};return rp(_0x350bea)[_0xa74c('0x24')](function(_0x37fcb3){if(_0x37fcb3[_0xa74c('0x5b')]){_0x5e4ca2(_0x37fcb3[_0xa74c('0x5b')]);}else{_0x1b41f0('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa74c('0x40')](function(_0x48833a){_0x1b41f0(_0x48833a);});});}exports['getFields']=function(_0x31af23,_0x505fca,_0x4134e1){var _0x4ce6f5,_0x15a344,_0x4a4e61,_0x2dc98c,_0x11b036;return db[_0xa74c('0x2a')][_0xa74c('0x5c')]({'where':{'id':_0x31af23['params']['id']},'attributes':['id',_0xa74c('0x5d'),_0xa74c('0x53'),_0xa74c('0x58'),_0xa74c('0x59'),_0xa74c('0x5e'),_0xa74c('0x5f'),_0xa74c('0x57')]})[_0xa74c('0x24')](handleEntityNotFound(_0x505fca,null))[_0xa74c('0x24')](function(_0x559104){_0x11b036=_0x559104;_0x4ce6f5=_0x11b036[_0xa74c('0x5d')];_0x15a344=_0x4ce6f5===_0xa74c('0x60')?'eu':_0xa74c('0x61');_0x4a4e61=_0x11b036['serverUrl'];var _0x3dd341=_0x4a4e61[_0xa74c('0x62')](-0x1);if(_0x3dd341==='/'||_0x3dd341==='\x5c'||_0x3dd341===':'){_0x4a4e61=_0x4a4e61['substring'](0x0,_0x4a4e61['lastIndexOf'](_0x3dd341));}if(!_0x11b036[_0xa74c('0x57')]){throw new Error(_0xa74c('0x63'));}return getAccessToken(_0x11b036);})[_0xa74c('0x24')](function(_0x3c9fb2){if(_0x3c9fb2){return rp({'method':'GET','uri':util[_0xa74c('0x64')](_0xa74c('0x65'),_0x15a344),'qs':{'module':_0xa74c('0x66')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3c9fb2},'json':!![]});}})['then'](function(_0x188313){if(_0x188313){if(_0x188313[_0xa74c('0x67')]&&_0x188313[_0xa74c('0x67')][_0xa74c('0x25')]){throw new Error(_0x188313['response'][_0xa74c('0x25')][_0xa74c('0x68')]);}var _0x550ce3=[];var _0x2db3c1=[];var _0x163902=[_0xa74c('0x69'),_0xa74c('0x6a'),_0xa74c('0x6b'),_0xa74c('0x6c'),_0xa74c('0x6d'),_0xa74c('0x6e'),_0xa74c('0x6f'),_0xa74c('0x70')];_0x2db3c1=_[_0xa74c('0x71')](_0x188313['fields'],function(_0x6f5d17){return _0x163902[_0xa74c('0x72')](_0x6f5d17[_0xa74c('0x73')]);});for(var _0x200337=0x0;_0x200337<_0x2db3c1['length'];_0x200337++){if(_0x2db3c1[_0x200337][_0xa74c('0x74')]===![]){_0x550ce3[_0xa74c('0x75')]({'id':_0x2db3c1[_0x200337]['id'],'name':_0x2db3c1[_0x200337][_0xa74c('0x76')],'custom':_0x2db3c1[_0x200337]['custom_field'],'options':_0x2db3c1[_0x200337][_0xa74c('0x77')]==='picklist'&&_0x2db3c1[_0x200337][_0xa74c('0x78')][_0xa74c('0x32')]>-0x1?_[_0xa74c('0x29')](_0x2db3c1[_0x200337]['pick_list_values'],function(_0x27505f){return{'name':_0x27505f,'value':_0x27505f};}):[]});}}return{'count':_0x550ce3['length'],'rows':_0x550ce3};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x505fca,null))[_0xa74c('0x40')](function(_0x427d4a){var _0x21cff4=_0x31af23[_0xa74c('0x2e')]['test']?0x1f4:_0x427d4a[_0xa74c('0x79')]||0x1f4;logger['error'](_0xa74c('0x7a'),'getFields',_0x21cff4,JSON[_0xa74c('0x7b')](_0x427d4a));delete _0x427d4a['name'];if(_0x21cff4===0x191){_0x21cff4=0x190;}_0x505fca[_0xa74c('0x18')](_0x21cff4)[_0xa74c('0x27')](_0x31af23[_0xa74c('0x2e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x427d4a[_0xa74c('0x79')]}:_0x427d4a);});};
\ No newline at end of file
+var _0x1dce=['https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','create','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x39def5,_0x277d82){var _0xfa0567=function(_0x515754){while(--_0x515754){_0x39def5['push'](_0x39def5['shift']());}};_0xfa0567(++_0x277d82);}(_0x1dce,0x1a9));var _0xe1dc=function(_0x3f7855,_0x535342){_0x3f7855=_0x3f7855-0x0;var _0x301fb7=_0x1dce[_0x3f7855];return _0x301fb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe1dc('0x0'));var jsonpatch=require(_0xe1dc('0x1'));var rp=require(_0xe1dc('0x2'));var moment=require(_0xe1dc('0x3'));var BPromise=require(_0xe1dc('0x4'));var Mustache=require(_0xe1dc('0x5'));var util=require('util');var path=require(_0xe1dc('0x6'));var sox=require(_0xe1dc('0x7'));var csv=require('to-csv');var ejs=require(_0xe1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xe1dc('0x9'));var _=require(_0xe1dc('0xa'));var squel=require(_0xe1dc('0xb'));var crypto=require(_0xe1dc('0xc'));var jsforce=require(_0xe1dc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe1dc('0xe'));var Redis=require(_0xe1dc('0xf'));var authService=require(_0xe1dc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1dc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe1dc('0x12'));var licenseUtil=require(_0xe1dc('0x13'));var db=require(_0xe1dc('0x14'))['db'];var integrations=require(_0xe1dc('0x15'));function respondWithStatusCode(_0x319ee1,_0x5c1a3b){_0x5c1a3b=_0x5c1a3b||0xcc;return function(_0x48797d){if(_0x48797d){return _0x319ee1[_0xe1dc('0x16')](_0x5c1a3b);}return _0x319ee1[_0xe1dc('0x17')](_0x5c1a3b)[_0xe1dc('0x18')]();};}function respondWithResult(_0x1e39dd,_0x1ae552){_0x1ae552=_0x1ae552||0xc8;return function(_0x45edfc){if(_0x45edfc){return _0x1e39dd['status'](_0x1ae552)[_0xe1dc('0x19')](_0x45edfc);}};}function respondWithFilteredResult(_0x342bcc,_0xa7ea85){return function(_0xd9a239){if(_0xd9a239){var _0x653e6d=typeof _0xa7ea85['offset']===_0xe1dc('0x1a')&&typeof _0xa7ea85['limit']===_0xe1dc('0x1a');var _0x4390a6=_0xd9a239[_0xe1dc('0x1b')];var _0x31ff2c=_0x653e6d?0x0:_0xa7ea85[_0xe1dc('0x1c')];var _0x5d6946=_0x653e6d?_0xd9a239['count']:_0xa7ea85['offset']+_0xa7ea85[_0xe1dc('0x1d')];var _0x2fce0c;if(_0x5d6946>=_0x4390a6){_0x5d6946=_0x4390a6;_0x2fce0c=0xc8;}else{_0x2fce0c=0xce;}_0x342bcc[_0xe1dc('0x17')](_0x2fce0c);return _0x342bcc[_0xe1dc('0x1e')](_0xe1dc('0x1f'),_0x31ff2c+'-'+_0x5d6946+'/'+_0x4390a6)['json'](_0xd9a239);}return null;};}function patchUpdates(_0x1491af){return function(_0x280c8b){try{jsonpatch[_0xe1dc('0x20')](_0x280c8b,_0x1491af,!![]);}catch(_0xd14894){return BPromise[_0xe1dc('0x21')](_0xd14894);}return _0x280c8b['save']();};}function saveUpdates(_0x5bf4f0,_0x5da487){return function(_0x2fc325){if(_0x2fc325){return _0x2fc325[_0xe1dc('0x22')](_0x5bf4f0)[_0xe1dc('0x23')](function(_0x477ac1){return _0x477ac1;});}return null;};}function removeEntity(_0x161586,_0x5a6cb0){return function(_0x1652ce){if(_0x1652ce){return _0x1652ce[_0xe1dc('0x24')]()['then'](function(){_0x161586['status'](0xcc)[_0xe1dc('0x18')]();});}};}function handleEntityNotFound(_0x4c111a,_0x15a845){return function(_0x3684d8){if(!_0x3684d8){_0x4c111a[_0xe1dc('0x16')](0x194);}return _0x3684d8;};}function handleError(_0x2cbd2a,_0x204dcc){_0x204dcc=_0x204dcc||0x1f4;return function(_0x15e2d9){logger[_0xe1dc('0x25')](_0x15e2d9[_0xe1dc('0x26')]);if(_0x15e2d9[_0xe1dc('0x27')]){delete _0x15e2d9[_0xe1dc('0x27')];}_0x2cbd2a[_0xe1dc('0x17')](_0x204dcc)[_0xe1dc('0x28')](_0x15e2d9);};}exports[_0xe1dc('0x29')]=function(_0x369159,_0x5f37e3){var _0x45ce96={},_0x2c6a5e={},_0x209117={'count':0x0,'rows':[]};var _0x635e39=_[_0xe1dc('0x2a')](db[_0xe1dc('0x2b')][_0xe1dc('0x2c')],function(_0x2a162d){return{'name':_0x2a162d[_0xe1dc('0x2d')],'type':_0x2a162d[_0xe1dc('0x2e')][_0xe1dc('0x2f')]};});_0x2c6a5e['model']=_['map'](_0x635e39,'name');_0x2c6a5e[_0xe1dc('0x30')]=_[_0xe1dc('0x31')](_0x369159[_0xe1dc('0x30')]);_0x2c6a5e['filters']=_['intersection'](_0x2c6a5e[_0xe1dc('0x32')],_0x2c6a5e['query']);_0x45ce96[_0xe1dc('0x33')]=_['intersection'](_0x2c6a5e['model'],qs['fields'](_0x369159['query'][_0xe1dc('0x34')]));_0x45ce96['attributes']=_0x45ce96[_0xe1dc('0x33')][_0xe1dc('0x35')]?_0x45ce96[_0xe1dc('0x33')]:_0x2c6a5e['model'];if(!_0x369159[_0xe1dc('0x30')][_0xe1dc('0x36')](_0xe1dc('0x37'))){_0x45ce96['limit']=qs[_0xe1dc('0x1d')](_0x369159[_0xe1dc('0x30')][_0xe1dc('0x1d')]);_0x45ce96[_0xe1dc('0x1c')]=qs['offset'](_0x369159[_0xe1dc('0x30')][_0xe1dc('0x1c')]);}_0x45ce96[_0xe1dc('0x38')]=qs['sort'](_0x369159['query'][_0xe1dc('0x39')]);_0x45ce96['where']=qs['filters'](_['pick'](_0x369159['query'],_0x2c6a5e[_0xe1dc('0x3a')]),_0x635e39);if(_0x369159[_0xe1dc('0x30')][_0xe1dc('0x3b')]){_0x45ce96[_0xe1dc('0x3c')]=_[_0xe1dc('0x3d')](_0x45ce96[_0xe1dc('0x3c')],{'$or':_[_0xe1dc('0x2a')](_0x635e39,function(_0x301494){if(_0x301494[_0xe1dc('0x2e')]!==_0xe1dc('0x3e')){var _0x50c2cd={};_0x50c2cd[_0x301494['name']]={'$like':'%'+_0x369159[_0xe1dc('0x30')]['filter']+'%'};return _0x50c2cd;}})});}_0x45ce96=_[_0xe1dc('0x3d')]({},_0x45ce96,_0x369159[_0xe1dc('0x3f')]);var _0x26def5={'where':_0x45ce96[_0xe1dc('0x3c')]};return db['ZohoAccount'][_0xe1dc('0x1b')](_0x26def5)[_0xe1dc('0x23')](function(_0x593574){_0x209117[_0xe1dc('0x1b')]=_0x593574;if(_0x369159[_0xe1dc('0x30')][_0xe1dc('0x40')]){_0x45ce96[_0xe1dc('0x41')]=[{'all':!![]}];}return db[_0xe1dc('0x2b')][_0xe1dc('0x42')](_0x45ce96);})['then'](function(_0x1c8036){_0x209117['rows']=_0x1c8036;return _0x209117;})[_0xe1dc('0x23')](respondWithFilteredResult(_0x5f37e3,_0x45ce96))[_0xe1dc('0x43')](handleError(_0x5f37e3,null));};exports[_0xe1dc('0x44')]=function(_0x1c0342,_0x567f69){var _0x4bb87c={'raw':![],'where':{'id':_0x1c0342[_0xe1dc('0x45')]['id']}},_0x3b9310={};_0x3b9310[_0xe1dc('0x32')]=_['keys'](db[_0xe1dc('0x2b')][_0xe1dc('0x2c')]);_0x3b9310[_0xe1dc('0x30')]=_[_0xe1dc('0x31')](_0x1c0342[_0xe1dc('0x30')]);_0x3b9310['filters']=_['intersection'](_0x3b9310[_0xe1dc('0x32')],_0x3b9310[_0xe1dc('0x30')]);_0x4bb87c[_0xe1dc('0x33')]=_[_0xe1dc('0x46')](_0x3b9310[_0xe1dc('0x32')],qs[_0xe1dc('0x34')](_0x1c0342[_0xe1dc('0x30')][_0xe1dc('0x34')]));_0x4bb87c['attributes']=_0x4bb87c['attributes'][_0xe1dc('0x35')]?_0x4bb87c['attributes']:_0x3b9310[_0xe1dc('0x32')];if(_0x1c0342[_0xe1dc('0x30')][_0xe1dc('0x40')]){_0x4bb87c[_0xe1dc('0x41')]=[{'all':!![]}];}_0x4bb87c=_['merge']({},_0x4bb87c,_0x1c0342[_0xe1dc('0x3f')]);return db[_0xe1dc('0x2b')]['find'](_0x4bb87c)['then'](handleEntityNotFound(_0x567f69,null))[_0xe1dc('0x23')](respondWithResult(_0x567f69,null))['catch'](handleError(_0x567f69,null));};exports[_0xe1dc('0x47')]=function(_0x4869d7,_0x965a3c){return db['ZohoAccount'][_0xe1dc('0x47')](_0x4869d7[_0xe1dc('0x48')],{})['then'](respondWithResult(_0x965a3c,0xc9))['catch'](handleError(_0x965a3c,null));};exports['update']=function(_0x42042f,_0x138a44){if(_0x42042f['body']['id']){delete _0x42042f[_0xe1dc('0x48')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x42042f[_0xe1dc('0x45')]['id']}})[_0xe1dc('0x23')](handleEntityNotFound(_0x138a44,null))['then'](saveUpdates(_0x42042f['body'],null))[_0xe1dc('0x23')](respondWithResult(_0x138a44,null))[_0xe1dc('0x43')](handleError(_0x138a44,null));};exports['destroy']=function(_0x32fa8e,_0x7d1292){return db[_0xe1dc('0x2b')]['find']({'where':{'id':_0x32fa8e['params']['id']}})[_0xe1dc('0x23')](handleEntityNotFound(_0x7d1292,null))[_0xe1dc('0x23')](removeEntity(_0x7d1292,null))['catch'](handleError(_0x7d1292,null));};exports[_0xe1dc('0x49')]=function(_0x419a7f,_0x2b2e41,_0x22722b){var _0x29d4d2={};var _0x45709c={};var _0x1c09b3;var _0x440133;return db['ZohoAccount']['findOne']({'where':{'id':_0x419a7f[_0xe1dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b2e41,null))[_0xe1dc('0x23')](function(_0x1555e5){if(_0x1555e5){_0x1c09b3=_0x1555e5;_0x45709c[_0xe1dc('0x32')]=_[_0xe1dc('0x31')](db[_0xe1dc('0x4a')][_0xe1dc('0x2c')]);_0x45709c['query']=_[_0xe1dc('0x31')](_0x419a7f[_0xe1dc('0x30')]);_0x45709c[_0xe1dc('0x3a')]=_['intersection'](_0x45709c[_0xe1dc('0x32')],_0x45709c['query']);_0x29d4d2[_0xe1dc('0x33')]=_[_0xe1dc('0x46')](_0x45709c[_0xe1dc('0x32')],qs['fields'](_0x419a7f[_0xe1dc('0x30')][_0xe1dc('0x34')]));_0x29d4d2[_0xe1dc('0x33')]=_0x29d4d2['attributes'][_0xe1dc('0x35')]?_0x29d4d2[_0xe1dc('0x33')]:_0x45709c['model'];_0x29d4d2['order']=qs[_0xe1dc('0x39')](_0x419a7f[_0xe1dc('0x30')][_0xe1dc('0x39')]);_0x29d4d2[_0xe1dc('0x3c')]=qs[_0xe1dc('0x3a')](_['pick'](_0x419a7f[_0xe1dc('0x30')],_0x45709c[_0xe1dc('0x3a')]));if(_0x419a7f[_0xe1dc('0x30')]['filter']){_0x29d4d2[_0xe1dc('0x3c')]=_[_0xe1dc('0x3d')](_0x29d4d2['where'],{'$or':_[_0xe1dc('0x2a')](_0x29d4d2[_0xe1dc('0x33')],function(_0x592b93){var _0x1d77ef={};_0x1d77ef[_0x592b93]={'$like':'%'+_0x419a7f[_0xe1dc('0x30')][_0xe1dc('0x3b')]+'%'};return _0x1d77ef;})});}_0x29d4d2=_['merge']({},_0x29d4d2,_0x419a7f['options']);return _0x1c09b3[_0xe1dc('0x49')](_0x29d4d2);}})[_0xe1dc('0x23')](function(_0x1eb287){if(_0x1eb287){_0x440133=_0x1eb287[_0xe1dc('0x35')];if(!_0x419a7f[_0xe1dc('0x30')][_0xe1dc('0x36')](_0xe1dc('0x37'))){_0x29d4d2[_0xe1dc('0x1d')]=qs['limit'](_0x419a7f['query'][_0xe1dc('0x1d')]);_0x29d4d2['offset']=qs[_0xe1dc('0x1c')](_0x419a7f[_0xe1dc('0x30')][_0xe1dc('0x1c')]);}return _0x1c09b3[_0xe1dc('0x49')](_0x29d4d2);}})[_0xe1dc('0x23')](function(_0x47ec2e){if(_0x47ec2e){return _0x47ec2e?{'count':_0x440133,'rows':_0x47ec2e}:null;}})[_0xe1dc('0x23')](respondWithResult(_0x2b2e41,null))[_0xe1dc('0x43')](handleError(_0x2b2e41,null));};exports[_0xe1dc('0x4b')]=function(_0x47c483,_0x2fddd8,_0x1ee0e0){if(_0x47c483[_0xe1dc('0x48')]['id']){delete _0x47c483[_0xe1dc('0x48')]['id'];}return db[_0xe1dc('0x2b')][_0xe1dc('0x4c')]({'where':{'id':_0x47c483[_0xe1dc('0x45')]['id']}})[_0xe1dc('0x23')](handleEntityNotFound(_0x2fddd8,null))['then'](function(_0x42a373){if(_0x42a373){_0x47c483[_0xe1dc('0x48')][_0xe1dc('0x4d')]=_0x42a373['id'];_0x47c483[_0xe1dc('0x48')][_0xe1dc('0x4e')]=integrations[_0xe1dc('0x4f')](_0x47c483['body']['channel'],_0x47c483[_0xe1dc('0x48')][_0xe1dc('0x2e')]);_0x47c483[_0xe1dc('0x48')][_0xe1dc('0x50')]=integrations[_0xe1dc('0x51')](_0x47c483[_0xe1dc('0x48')][_0xe1dc('0x52')],_0x47c483[_0xe1dc('0x48')][_0xe1dc('0x2e')]);return db[_0xe1dc('0x4a')][_0xe1dc('0x47')](_0x47c483[_0xe1dc('0x48')],{'include':[{'model':db[_0xe1dc('0x53')],'as':_0xe1dc('0x4e')},{'model':db[_0xe1dc('0x53')],'as':'Descriptions'}]});}return null;})[_0xe1dc('0x23')](respondWithResult(_0x2fddd8,null))['catch'](handleError(_0x2fddd8,null));};function getAccessToken(_0x3d2eec){return new Promise(function(_0x503d7b,_0x5a7d59){var _0x1a7270;switch(_0x3d2eec[_0xe1dc('0x54')]){case'US':_0x1a7270=_0xe1dc('0x55');break;case'AU':_0x1a7270=_0xe1dc('0x56');break;case'EU':_0x1a7270=_0xe1dc('0x57');break;case'IN':_0x1a7270=_0xe1dc('0x58');break;case'CN':_0x1a7270=_0xe1dc('0x59');break;default:_0x1a7270=_0xe1dc('0x57');break;}var _0x1d544f={'method':_0xe1dc('0x5a'),'uri':_0x1a7270+_0xe1dc('0x5b'),'qs':{'refresh_token':_0x3d2eec[_0xe1dc('0x5c')],'client_id':_0x3d2eec[_0xe1dc('0x5d')],'client_secret':_0x3d2eec[_0xe1dc('0x5e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1d544f)['then'](function(_0x42e331){if(_0x42e331[_0xe1dc('0x5f')]){_0x503d7b(_0x42e331['access_token']);}else{_0x5a7d59(_0xe1dc('0x60'));}})[_0xe1dc('0x43')](function(_0xa7fff1){_0x5a7d59(_0xa7fff1);});});}exports[_0xe1dc('0x61')]=function(_0x56f55c,_0xd04957,_0x22e7e5){var _0x238ca4,_0x2433bb,_0x4d6975,_0x322e1b,_0x9e2f5e;return db[_0xe1dc('0x2b')][_0xe1dc('0x4c')]({'where':{'id':_0x56f55c[_0xe1dc('0x45')]['id']},'attributes':['id',_0xe1dc('0x62'),_0xe1dc('0x54'),_0xe1dc('0x5d'),'clientSecret','serverUrl',_0xe1dc('0x63'),_0xe1dc('0x5c')]})['then'](handleEntityNotFound(_0xd04957,null))['then'](function(_0x207123){_0x9e2f5e=_0x207123;_0x238ca4=_0x9e2f5e[_0xe1dc('0x62')];_0x2433bb=_0x238ca4==='zoho.eu'?'eu':_0xe1dc('0x64');_0x4d6975=_0x9e2f5e['serverUrl'];var _0x24e6b2=_0x4d6975[_0xe1dc('0x65')](-0x1);if(_0x24e6b2==='/'||_0x24e6b2==='\x5c'||_0x24e6b2===':'){_0x4d6975=_0x4d6975[_0xe1dc('0x66')](0x0,_0x4d6975['lastIndexOf'](_0x24e6b2));}if(!_0x9e2f5e[_0xe1dc('0x5c')]){throw new Error(_0xe1dc('0x67'));}return getAccessToken(_0x9e2f5e);})['then'](function(_0x1ac983){if(_0x1ac983){return rp({'method':_0xe1dc('0x68'),'uri':util[_0xe1dc('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2433bb),'qs':{'module':_0xe1dc('0x6a')},'headers':{'Authorization':_0xe1dc('0x6b')+_0x1ac983},'json':!![]});}})[_0xe1dc('0x23')](function(_0x5acb73){if(_0x5acb73){if(_0x5acb73[_0xe1dc('0x6c')]&&_0x5acb73['response']['error']){throw new Error(_0x5acb73[_0xe1dc('0x6c')][_0xe1dc('0x25')][_0xe1dc('0x6d')]);}var _0x1cdc03=[];var _0x4a6dda=[];var _0x148796=[_0xe1dc('0x6e'),_0xe1dc('0x6f'),'Description','WhoId',_0xe1dc('0x70'),_0xe1dc('0x71'),_0xe1dc('0x72'),_0xe1dc('0x73')];_0x4a6dda=_['remove'](_0x5acb73['fields'],function(_0x263a3b){return _0x148796[_0xe1dc('0x74')](_0x263a3b[_0xe1dc('0x75')]);});for(var _0x8d3ba8=0x0;_0x8d3ba8<_0x4a6dda[_0xe1dc('0x35')];_0x8d3ba8++){if(_0x4a6dda[_0x8d3ba8]['system_mandatory']===![]){_0x1cdc03[_0xe1dc('0x76')]({'id':_0x4a6dda[_0x8d3ba8]['id'],'name':_0x4a6dda[_0x8d3ba8][_0xe1dc('0x77')],'custom':_0x4a6dda[_0x8d3ba8][_0xe1dc('0x78')],'options':_0x4a6dda[_0x8d3ba8][_0xe1dc('0x79')]===_0xe1dc('0x7a')&&_0x4a6dda[_0x8d3ba8][_0xe1dc('0x7b')]['length']>-0x1?_[_0xe1dc('0x2a')](_0x4a6dda[_0x8d3ba8]['pick_list_values'],function(_0x53f371){return{'name':_0x53f371,'value':_0x53f371};}):[]});}}return{'count':_0x1cdc03[_0xe1dc('0x35')],'rows':_0x1cdc03};}else{return{'count':0x0,'rows':[]};}})[_0xe1dc('0x23')](respondWithResult(_0xd04957,null))['catch'](function(_0x24c385){var _0x1e9200=_0x56f55c['query'][_0xe1dc('0x7c')]?0x1f4:_0x24c385[_0xe1dc('0x7d')]||0x1f4;logger[_0xe1dc('0x25')](_0xe1dc('0x7e'),_0xe1dc('0x61'),_0x1e9200,JSON['stringify'](_0x24c385));delete _0x24c385['name'];if(_0x1e9200===0x191){_0x1e9200=0x190;}_0xd04957[_0xe1dc('0x17')](_0x1e9200)[_0xe1dc('0x28')](_0x56f55c[_0xe1dc('0x30')]['test']?{'message':_0xe1dc('0x7f'),'statusCode':_0x24c385[_0xe1dc('0x7d')]}:_0x24c385);});};
\ No newline at end of file
index 5869ea7..1a00f21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe83=['path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','slice','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','inspect','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1d8e84,_0x3ad5f2){var _0x4feb4e=function(_0x2b3993){while(--_0x2b3993){_0x1d8e84['push'](_0x1d8e84['shift']());}};_0x4feb4e(++_0x3ad5f2);}(_0xbe83,0x12e));var _0x3be8=function(_0x5b681e,_0x238f13){_0x5b681e=_0x5b681e-0x0;var _0x39d539=_0xbe83[_0x5b681e];return _0x39d539;};'use strict';var _=require(_0x3be8('0x0'));var util=require(_0x3be8('0x1'));var logger=require(_0x3be8('0x2'))(_0x3be8('0x3'));var moment=require(_0x3be8('0x4'));var BPromise=require(_0x3be8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3be8('0x6'));var rimraf=require('rimraf');var config=require(_0x3be8('0x7'));var attributes=require(_0x3be8('0x8'));var integrations=require(_0x3be8('0x9'));module[_0x3be8('0xa')]=function(_0xec0495,_0x1c5c3a){return _0xec0495[_0x3be8('0xb')](_0x3be8('0xc'),attributes,{'tableName':_0x3be8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a97a4,_0x37410d,_0x2ae50d){if(_0x1a97a4['changed']('zone')||_0x1a97a4[_0x3be8('0xe')](_0x3be8('0xf'))||_0x1a97a4[_0x3be8('0xe')]('clientId')||_0x1a97a4[_0x3be8('0xe')](_0x3be8('0x10'))||_0x1a97a4['changed'](_0x3be8('0x11'))||_0x1a97a4['changed'](_0x3be8('0x12'))){var _0x51c18c,_0x4c3fd6;_0x51c18c=_0x1a97a4[_0x3be8('0xf')];var _0x29afc7=_0x51c18c[_0x3be8('0x13')](-0x1);if(_0x29afc7==='/'||_0x29afc7==='\x5c'||_0x29afc7===':'){_0x51c18c=_0x51c18c['substring'](0x0,_0x51c18c['lastIndexOf'](_0x29afc7));}switch(_0x1a97a4[_0x3be8('0x14')]){case'US':_0x4c3fd6=_0x3be8('0x15');break;case'AU':_0x4c3fd6='https://accounts.zoho.com.au';break;case'IN':_0x4c3fd6='https://accounts.zoho.in';break;case'CN':_0x4c3fd6=_0x3be8('0x16');break;default:_0x4c3fd6=_0x3be8('0x17');break;}var _0x3d409e={'method':_0x3be8('0x18'),'uri':_0x4c3fd6+_0x3be8('0x19'),'form':{'grant_type':_0x3be8('0x1a'),'client_id':_0x1a97a4['clientId'],'client_secret':_0x1a97a4['clientSecret'],'redirect_uri':_0x1a97a4[_0x3be8('0xf')],'code':_0x1a97a4[_0x3be8('0x11')]},'headers':{'Content-Type':_0x3be8('0x1b')}};return rp(_0x3d409e)[_0x3be8('0x1c')](function(_0x436918){var _0x9cbd55=JSON[_0x3be8('0x1d')](_0x436918);if(_0x9cbd55[_0x3be8('0x1e')]){_0x1a97a4[_0x3be8('0x1f')]=_0x9cbd55[_0x3be8('0x1e')];logger[_0x3be8('0x20')](util[_0x3be8('0x21')](_0x3be8('0x22'),_0x1a97a4[_0x3be8('0x23')],_0x1a97a4['id']));}else{logger['error'](util[_0x3be8('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1a97a4[_0x3be8('0x23')],_0x1a97a4['id']),util['inspect'](_0x9cbd55,{'showHidden':![],'depth':null}));}return _0x2ae50d(null,_0x37410d);})[_0x3be8('0x24')](function(_0x222b2f){logger[_0x3be8('0x25')](util[_0x3be8('0x21')](_0x3be8('0x26'),_0x1a97a4[_0x3be8('0x23')],_0x1a97a4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2ae50d(_0x222b2f);});}else{return _0x2ae50d(null,_0x37410d);}},'beforeUpdate':function(_0x38596e,_0x10a816,_0x759a78){if(_0x38596e[_0x3be8('0xe')](_0x3be8('0x14'))||_0x38596e[_0x3be8('0xe')](_0x3be8('0xf'))||_0x38596e[_0x3be8('0xe')]('clientId')||_0x38596e[_0x3be8('0xe')]('clientSecret')||_0x38596e[_0x3be8('0xe')](_0x3be8('0x11'))||_0x38596e[_0x3be8('0xe')]('host')){var _0x47b689,_0x5b20b3;_0x47b689=_0x38596e[_0x3be8('0xf')];var _0x167aa8=_0x47b689[_0x3be8('0x13')](-0x1);if(_0x167aa8==='/'||_0x167aa8==='\x5c'||_0x167aa8===':'){_0x47b689=_0x47b689[_0x3be8('0x27')](0x0,_0x47b689[_0x3be8('0x28')](_0x167aa8));}switch(_0x38596e[_0x3be8('0x14')]){case'US':_0x5b20b3=_0x3be8('0x15');break;case'AU':_0x5b20b3=_0x3be8('0x29');break;case'IN':_0x5b20b3=_0x3be8('0x2a');break;case'CN':_0x5b20b3='https://accounts.zoho.com.cn';break;default:_0x5b20b3='https://accounts.zoho.eu';break;}var _0x2f18ae={'method':_0x3be8('0x18'),'uri':_0x5b20b3+_0x3be8('0x19'),'form':{'grant_type':_0x3be8('0x1a'),'client_id':_0x38596e['clientId'],'client_secret':_0x38596e['clientSecret'],'redirect_uri':_0x38596e[_0x3be8('0xf')],'code':_0x38596e[_0x3be8('0x11')]},'headers':{'Content-Type':_0x3be8('0x1b')}};return rp(_0x2f18ae)['then'](function(_0x26cef8){var _0x5c9ea2=JSON[_0x3be8('0x1d')](_0x26cef8);if(_0x5c9ea2[_0x3be8('0x1e')]){_0x38596e['refreshToken']=_0x5c9ea2[_0x3be8('0x1e')];logger['info'](util[_0x3be8('0x21')](_0x3be8('0x22'),_0x38596e['name'],_0x38596e['id']));}else{logger['error'](util[_0x3be8('0x21')](_0x3be8('0x26'),_0x38596e[_0x3be8('0x23')],_0x38596e['id']),util[_0x3be8('0x2b')](_0x5c9ea2,{'showHidden':![],'depth':null}));}return _0x759a78(null,_0x10a816);})[_0x3be8('0x24')](function(_0x115dd3){logger[_0x3be8('0x25')](util[_0x3be8('0x21')](_0x3be8('0x26'),_0x38596e[_0x3be8('0x23')],_0x38596e['id']),util[_0x3be8('0x2b')](parsedResult,{'showHidden':![],'depth':null}));return _0x759a78(_0x115dd3);});}else{return _0x759a78(null,_0x10a816);}}}});};
\ No newline at end of file
+var _0x48cb=['inspect','catch','name','https://accounts.zoho.com','POST','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x36a479,_0x30abcb){var _0xe08592=function(_0x16a301){while(--_0x16a301){_0x36a479['push'](_0x36a479['shift']());}};_0xe08592(++_0x30abcb);}(_0x48cb,0x14d));var _0xb48c=function(_0xe4f1c0,_0x17dae3){_0xe4f1c0=_0xe4f1c0-0x0;var _0x16e788=_0x48cb[_0xe4f1c0];return _0x16e788;};'use strict';var _=require(_0xb48c('0x0'));var util=require('util');var logger=require(_0xb48c('0x1'))('api');var moment=require(_0xb48c('0x2'));var BPromise=require(_0xb48c('0x3'));var rp=require(_0xb48c('0x4'));var fs=require('fs');var path=require(_0xb48c('0x5'));var rimraf=require(_0xb48c('0x6'));var config=require(_0xb48c('0x7'));var attributes=require(_0xb48c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xb48c('0x9')]=function(_0x57939f,_0xb4d5b2){return _0x57939f[_0xb48c('0xa')]('ZohoAccount',attributes,{'tableName':_0xb48c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27ecff,_0x49c57f,_0x5dfcae){if(_0x27ecff[_0xb48c('0xc')](_0xb48c('0xd'))||_0x27ecff['changed'](_0xb48c('0xe'))||_0x27ecff[_0xb48c('0xc')](_0xb48c('0xf'))||_0x27ecff[_0xb48c('0xc')](_0xb48c('0x10'))||_0x27ecff[_0xb48c('0xc')](_0xb48c('0x11'))||_0x27ecff[_0xb48c('0xc')](_0xb48c('0x12'))){var _0x2240a3,_0x286d97;_0x2240a3=_0x27ecff['serverUrl'];var _0xbceb89=_0x2240a3['slice'](-0x1);if(_0xbceb89==='/'||_0xbceb89==='\x5c'||_0xbceb89===':'){_0x2240a3=_0x2240a3[_0xb48c('0x13')](0x0,_0x2240a3[_0xb48c('0x14')](_0xbceb89));}switch(_0x27ecff[_0xb48c('0xd')]){case'US':_0x286d97='https://accounts.zoho.com';break;case'AU':_0x286d97=_0xb48c('0x15');break;case'IN':_0x286d97=_0xb48c('0x16');break;case'CN':_0x286d97=_0xb48c('0x17');break;default:_0x286d97='https://accounts.zoho.eu';break;}var _0x56c87f={'method':'POST','uri':_0x286d97+_0xb48c('0x18'),'form':{'grant_type':_0xb48c('0x19'),'client_id':_0x27ecff['clientId'],'client_secret':_0x27ecff[_0xb48c('0x10')],'redirect_uri':_0x27ecff[_0xb48c('0xe')],'code':_0x27ecff[_0xb48c('0x11')]},'headers':{'Content-Type':_0xb48c('0x1a')}};return rp(_0x56c87f)[_0xb48c('0x1b')](function(_0x774dbc){var _0x48e7b2=JSON[_0xb48c('0x1c')](_0x774dbc);if(_0x48e7b2[_0xb48c('0x1d')]){_0x27ecff[_0xb48c('0x1e')]=_0x48e7b2[_0xb48c('0x1d')];logger[_0xb48c('0x1f')](util[_0xb48c('0x20')](_0xb48c('0x21'),_0x27ecff['name'],_0x27ecff['id']));}else{logger[_0xb48c('0x22')](util[_0xb48c('0x20')](_0xb48c('0x23'),_0x27ecff['name'],_0x27ecff['id']),util[_0xb48c('0x24')](_0x48e7b2,{'showHidden':![],'depth':null}));}return _0x5dfcae(null,_0x49c57f);})[_0xb48c('0x25')](function(_0x334ebd){logger[_0xb48c('0x22')](util[_0xb48c('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x27ecff[_0xb48c('0x26')],_0x27ecff['id']),util[_0xb48c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5dfcae(_0x334ebd);});}else{return _0x5dfcae(null,_0x49c57f);}},'beforeUpdate':function(_0x6550d5,_0x3a46f8,_0x161326){if(_0x6550d5[_0xb48c('0xc')](_0xb48c('0xd'))||_0x6550d5[_0xb48c('0xc')]('serverUrl')||_0x6550d5[_0xb48c('0xc')]('clientId')||_0x6550d5['changed']('clientSecret')||_0x6550d5[_0xb48c('0xc')](_0xb48c('0x11'))||_0x6550d5['changed'](_0xb48c('0x12'))){var _0x3bfcf5,_0x3bcb52;_0x3bfcf5=_0x6550d5['serverUrl'];var _0x506a94=_0x3bfcf5['slice'](-0x1);if(_0x506a94==='/'||_0x506a94==='\x5c'||_0x506a94===':'){_0x3bfcf5=_0x3bfcf5[_0xb48c('0x13')](0x0,_0x3bfcf5[_0xb48c('0x14')](_0x506a94));}switch(_0x6550d5[_0xb48c('0xd')]){case'US':_0x3bcb52=_0xb48c('0x27');break;case'AU':_0x3bcb52='https://accounts.zoho.com.au';break;case'IN':_0x3bcb52=_0xb48c('0x16');break;case'CN':_0x3bcb52=_0xb48c('0x17');break;default:_0x3bcb52='https://accounts.zoho.eu';break;}var _0x296db6={'method':_0xb48c('0x28'),'uri':_0x3bcb52+_0xb48c('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x6550d5[_0xb48c('0xf')],'client_secret':_0x6550d5['clientSecret'],'redirect_uri':_0x6550d5[_0xb48c('0xe')],'code':_0x6550d5['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x296db6)[_0xb48c('0x1b')](function(_0x3d4782){var _0x387ccd=JSON[_0xb48c('0x1c')](_0x3d4782);if(_0x387ccd[_0xb48c('0x1d')]){_0x6550d5[_0xb48c('0x1e')]=_0x387ccd[_0xb48c('0x1d')];logger[_0xb48c('0x1f')](util[_0xb48c('0x20')](_0xb48c('0x21'),_0x6550d5[_0xb48c('0x26')],_0x6550d5['id']));}else{logger[_0xb48c('0x22')](util['format'](_0xb48c('0x23'),_0x6550d5[_0xb48c('0x26')],_0x6550d5['id']),util[_0xb48c('0x24')](_0x387ccd,{'showHidden':![],'depth':null}));}return _0x161326(null,_0x3a46f8);})[_0xb48c('0x25')](function(_0x53b5f4){logger['error'](util[_0xb48c('0x20')](_0xb48c('0x23'),_0x6550d5[_0xb48c('0x26')],_0x6550d5['id']),util[_0xb48c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x161326(_0x53b5f4);});}else{return _0x161326(null,_0x3a46f8);}}}});};
\ No newline at end of file
index feef4e1..4cdf3cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4d9=['result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowZohoAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2aef9c,_0x2f664c){var _0x172800=function(_0x36c81d){while(--_0x36c81d){_0x2aef9c['push'](_0x2aef9c['shift']());}};_0x172800(++_0x2f664c);}(_0xb4d9,0xce));var _0x9b4d=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xb4d9[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var moment=require('moment');var BPromise=require(_0x9b4d('0x2'));var rs=require(_0x9b4d('0x3'));var fs=require('fs');var Redis=require(_0x9b4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b4d('0x5'));var logger=require(_0x9b4d('0x6'))(_0x9b4d('0x7'));var config=require(_0x9b4d('0x8'));var jayson=require(_0x9b4d('0x9'));var client=jayson[_0x9b4d('0xa')][_0x9b4d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x429cc5,_0x461cb1,_0x14cb0b){return new BPromise(function(_0x156c68,_0x48832a){return client[_0x9b4d('0xc')](_0x429cc5,_0x14cb0b)['then'](function(_0x340b21){logger['info'](_0x9b4d('0xd'),_0x461cb1,_0x9b4d('0xe'));logger[_0x9b4d('0xf')](_0x9b4d('0x10'),_0x461cb1,_0x9b4d('0xe'),JSON[_0x9b4d('0x11')](_0x340b21));if(_0x340b21[_0x9b4d('0x12')]){if(_0x340b21[_0x9b4d('0x12')][_0x9b4d('0x13')]===0x1f4){logger[_0x9b4d('0x12')](_0x9b4d('0xd'),_0x461cb1,_0x340b21[_0x9b4d('0x12')]['message']);return _0x48832a(_0x340b21[_0x9b4d('0x12')][_0x9b4d('0x14')]);}logger[_0x9b4d('0x12')](_0x9b4d('0xd'),_0x461cb1,_0x340b21['error'][_0x9b4d('0x14')]);return _0x156c68(_0x340b21['error']['message']);}else{logger[_0x9b4d('0x15')](_0x9b4d('0xd'),_0x461cb1,_0x9b4d('0xe'));_0x156c68(_0x340b21[_0x9b4d('0x16')][_0x9b4d('0x14')]);}})[_0x9b4d('0x17')](function(_0x5d23f3){logger['error'](_0x9b4d('0xd'),_0x461cb1,_0x5d23f3);_0x48832a(_0x5d23f3);});});}exports[_0x9b4d('0x18')]=function(_0x15e808){var _0x25c32d=this;return new Promise(function(_0x1c52eb,_0x20e223){return db[_0x9b4d('0x19')][_0x9b4d('0x1a')]({'raw':_0x15e808[_0x9b4d('0x1b')]?_0x15e808[_0x9b4d('0x1b')][_0x9b4d('0x1c')]===undefined?!![]:![]:!![],'where':_0x15e808[_0x9b4d('0x1b')]?_0x15e808[_0x9b4d('0x1b')][_0x9b4d('0x1d')]||null:null,'attributes':_0x15e808[_0x9b4d('0x1b')]?_0x15e808[_0x9b4d('0x1b')][_0x9b4d('0x1e')]||null:null,'limit':_0x15e808[_0x9b4d('0x1b')]?_0x15e808[_0x9b4d('0x1b')][_0x9b4d('0x1f')]||null:null,'include':_0x15e808['options']?_0x15e808[_0x9b4d('0x1b')][_0x9b4d('0x20')]?_[_0x9b4d('0x21')](_0x15e808['options'][_0x9b4d('0x20')],function(_0x5daeda){return{'model':db[_0x5daeda['model']],'as':_0x5daeda['as'],'attributes':_0x5daeda[_0x9b4d('0x1e')],'include':_0x5daeda['include']?_[_0x9b4d('0x21')](_0x5daeda[_0x9b4d('0x20')],function(_0x5607b7){return{'model':db[_0x5607b7[_0x9b4d('0x22')]],'as':_0x5607b7['as'],'attributes':_0x5607b7[_0x9b4d('0x1e')],'include':_0x5607b7[_0x9b4d('0x20')]?_['map'](_0x5607b7['include'],function(_0x465013){return{'model':db[_0x465013[_0x9b4d('0x22')]],'as':_0x465013['as'],'attributes':_0x465013['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b4d('0x23')](function(_0x5d639b){logger[_0x9b4d('0x15')]('GetZohoAccount',_0x15e808);logger[_0x9b4d('0xf')]('GetZohoAccount',_0x15e808,JSON[_0x9b4d('0x11')](_0x5d639b));_0x1c52eb(_0x5d639b);})[_0x9b4d('0x17')](function(_0x5e9d1b){logger[_0x9b4d('0x12')]('GetZohoAccount',_0x5e9d1b['message'],_0x15e808);_0x20e223(_0x25c32d[_0x9b4d('0x12')](0x1f4,_0x5e9d1b[_0x9b4d('0x14')]));});});};exports['ShowZohoAccount']=function(_0x51459b){var _0xe5980d=this;return new Promise(function(_0x3b1954,_0x1da4ab){return db[_0x9b4d('0x19')][_0x9b4d('0x24')]({'raw':_0x51459b[_0x9b4d('0x1b')]?_0x51459b[_0x9b4d('0x1b')][_0x9b4d('0x1c')]===undefined?!![]:![]:!![],'where':_0x51459b[_0x9b4d('0x1b')]?_0x51459b[_0x9b4d('0x1b')][_0x9b4d('0x1d')]||null:null,'attributes':_0x51459b[_0x9b4d('0x1b')]?_0x51459b[_0x9b4d('0x1b')][_0x9b4d('0x1e')]||null:null,'include':_0x51459b[_0x9b4d('0x1b')]?_0x51459b['options'][_0x9b4d('0x20')]?_['map'](_0x51459b[_0x9b4d('0x1b')][_0x9b4d('0x20')],function(_0x141989){return{'model':db[_0x141989[_0x9b4d('0x22')]],'as':_0x141989['as'],'attributes':_0x141989[_0x9b4d('0x1e')],'include':_0x141989[_0x9b4d('0x20')]?_[_0x9b4d('0x21')](_0x141989['include'],function(_0x1b99b7){return{'model':db[_0x1b99b7[_0x9b4d('0x22')]],'as':_0x1b99b7['as'],'attributes':_0x1b99b7[_0x9b4d('0x1e')],'include':_0x1b99b7['include']?_['map'](_0x1b99b7[_0x9b4d('0x20')],function(_0x47bff3){return{'model':db[_0x47bff3['model']],'as':_0x47bff3['as'],'attributes':_0x47bff3[_0x9b4d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9b4d('0x23')](function(_0xb588fe){logger[_0x9b4d('0x15')](_0x9b4d('0x25'),_0x51459b);logger['debug'](_0x9b4d('0x25'),_0x51459b,JSON[_0x9b4d('0x11')](_0xb588fe));_0x3b1954(_0xb588fe);})['catch'](function(_0xf5842){logger[_0x9b4d('0x12')](_0x9b4d('0x25'),_0xf5842[_0x9b4d('0x14')],_0x51459b);_0x1da4ab(_0xe5980d[_0x9b4d('0x12')](0x1f4,_0xf5842['message']));});});};
\ No newline at end of file
+var _0x3445=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','map','include','model','ShowZohoAccount','find','lodash','util','moment'];(function(_0x54891f,_0x52d9b0){var _0x59c5f0=function(_0x4a165c){while(--_0x4a165c){_0x54891f['push'](_0x54891f['shift']());}};_0x59c5f0(++_0x52d9b0);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require(_0x5344('0x2'));var BPromise=require(_0x5344('0x3'));var rs=require(_0x5344('0x4'));var fs=require('fs');var Redis=require(_0x5344('0x5'));var db=require(_0x5344('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5344('0x7'));var config=require(_0x5344('0x8'));var jayson=require(_0x5344('0x9'));var client=jayson[_0x5344('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ffe5f,_0x5642cb,_0x5a4f52){return new BPromise(function(_0x3f638c,_0x4adb8a){return client['request'](_0x4ffe5f,_0x5a4f52)[_0x5344('0xb')](function(_0xbc5346){logger[_0x5344('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x5642cb,_0x5344('0xd'));logger[_0x5344('0xe')](_0x5344('0xf'),_0x5642cb,_0x5344('0xd'),JSON[_0x5344('0x10')](_0xbc5346));if(_0xbc5346[_0x5344('0x11')]){if(_0xbc5346['error'][_0x5344('0x12')]===0x1f4){logger[_0x5344('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x5642cb,_0xbc5346[_0x5344('0x11')]['message']);return _0x4adb8a(_0xbc5346[_0x5344('0x11')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5642cb,_0xbc5346[_0x5344('0x11')][_0x5344('0x13')]);return _0x3f638c(_0xbc5346[_0x5344('0x11')][_0x5344('0x13')]);}else{logger[_0x5344('0xc')](_0x5344('0x14'),_0x5642cb,_0x5344('0xd'));_0x3f638c(_0xbc5346[_0x5344('0x15')][_0x5344('0x13')]);}})[_0x5344('0x16')](function(_0x4ae241){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5642cb,_0x4ae241);_0x4adb8a(_0x4ae241);});});}exports[_0x5344('0x17')]=function(_0x215fbd){var _0x517b16=this;return new Promise(function(_0x4fb036,_0x508e34){return db[_0x5344('0x18')]['findAll']({'raw':_0x215fbd['options']?_0x215fbd['options']['raw']===undefined?!![]:![]:!![],'where':_0x215fbd[_0x5344('0x19')]?_0x215fbd[_0x5344('0x19')][_0x5344('0x1a')]||null:null,'attributes':_0x215fbd[_0x5344('0x19')]?_0x215fbd[_0x5344('0x19')][_0x5344('0x1b')]||null:null,'limit':_0x215fbd[_0x5344('0x19')]?_0x215fbd[_0x5344('0x19')][_0x5344('0x1c')]||null:null,'include':_0x215fbd[_0x5344('0x19')]?_0x215fbd['options']['include']?_[_0x5344('0x1d')](_0x215fbd[_0x5344('0x19')][_0x5344('0x1e')],function(_0x434e0d){return{'model':db[_0x434e0d[_0x5344('0x1f')]],'as':_0x434e0d['as'],'attributes':_0x434e0d['attributes'],'include':_0x434e0d[_0x5344('0x1e')]?_[_0x5344('0x1d')](_0x434e0d[_0x5344('0x1e')],function(_0x477c0a){return{'model':db[_0x477c0a['model']],'as':_0x477c0a['as'],'attributes':_0x477c0a[_0x5344('0x1b')],'include':_0x477c0a[_0x5344('0x1e')]?_[_0x5344('0x1d')](_0x477c0a[_0x5344('0x1e')],function(_0x4c120c){return{'model':db[_0x4c120c['model']],'as':_0x4c120c['as'],'attributes':_0x4c120c[_0x5344('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5344('0xb')](function(_0x3471a9){logger[_0x5344('0xc')]('GetZohoAccount',_0x215fbd);logger[_0x5344('0xe')](_0x5344('0x17'),_0x215fbd,JSON[_0x5344('0x10')](_0x3471a9));_0x4fb036(_0x3471a9);})[_0x5344('0x16')](function(_0x1867d6){logger[_0x5344('0x11')](_0x5344('0x17'),_0x1867d6['message'],_0x215fbd);_0x508e34(_0x517b16[_0x5344('0x11')](0x1f4,_0x1867d6['message']));});});};exports[_0x5344('0x20')]=function(_0x2ad28e){var _0x3dbb4e=this;return new Promise(function(_0xdaa060,_0x43a1e2){return db[_0x5344('0x18')][_0x5344('0x21')]({'raw':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e[_0x5344('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e[_0x5344('0x19')][_0x5344('0x1a')]||null:null,'attributes':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e['options'][_0x5344('0x1b')]||null:null,'include':_0x2ad28e[_0x5344('0x19')]?_0x2ad28e['options'][_0x5344('0x1e')]?_[_0x5344('0x1d')](_0x2ad28e['options'][_0x5344('0x1e')],function(_0x3c0988){return{'model':db[_0x3c0988['model']],'as':_0x3c0988['as'],'attributes':_0x3c0988[_0x5344('0x1b')],'include':_0x3c0988[_0x5344('0x1e')]?_['map'](_0x3c0988[_0x5344('0x1e')],function(_0x332a1d){return{'model':db[_0x332a1d[_0x5344('0x1f')]],'as':_0x332a1d['as'],'attributes':_0x332a1d[_0x5344('0x1b')],'include':_0x332a1d[_0x5344('0x1e')]?_['map'](_0x332a1d['include'],function(_0x3fafb1){return{'model':db[_0x3fafb1['model']],'as':_0x3fafb1['as'],'attributes':_0x3fafb1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a430){logger[_0x5344('0xc')](_0x5344('0x20'),_0x2ad28e);logger['debug'](_0x5344('0x20'),_0x2ad28e,JSON['stringify'](_0x45a430));_0xdaa060(_0x45a430);})['catch'](function(_0x5e812f){logger[_0x5344('0x11')](_0x5344('0x20'),_0x5e812f[_0x5344('0x13')],_0x2ad28e);_0x43a1e2(_0x3dbb4e[_0x5344('0x11')](0x1f4,_0x5e812f[_0x5344('0x13')]));});});};
\ No newline at end of file
index 8f540ec..1ff83f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46a0=['../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','getDescriptions','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2b43b1,_0x9fd762){var _0x3b480d=function(_0x5929a3){while(--_0x5929a3){_0x2b43b1['push'](_0x2b43b1['shift']());}};_0x3b480d(++_0x9fd762);}(_0x46a0,0x10b));var _0x046a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46a0[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x046a('0x0'));var path=require(_0x046a('0x1'));var timeout=require(_0x046a('0x2'));var express=require(_0x046a('0x3'));var router=express[_0x046a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x046a('0x5'));var interaction=require(_0x046a('0x6'));var config=require('../../config/environment');var controller=require(_0x046a('0x7'));router[_0x046a('0x8')]('/',auth['isAuthenticated'](),controller[_0x046a('0x9')]);router[_0x046a('0x8')](_0x046a('0xa'),auth[_0x046a('0xb')](),controller[_0x046a('0xc')]);router[_0x046a('0x8')](_0x046a('0xd'),auth[_0x046a('0xb')](),controller['getFields']);router[_0x046a('0x8')]('/:id/subjects',auth[_0x046a('0xb')](),controller[_0x046a('0xe')]);router[_0x046a('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x046a('0xf')]);router[_0x046a('0x10')]('/',auth['isAuthenticated'](),controller[_0x046a('0x11')]);router[_0x046a('0x12')](_0x046a('0xa'),auth[_0x046a('0xb')](),controller[_0x046a('0x13')]);router['delete']('/:id',auth[_0x046a('0xb')](),controller['destroy']);module[_0x046a('0x14')]=router;
\ No newline at end of file
+var _0x4f89=['getDescriptions','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x415062,_0x1ee7e8){var _0x33b9e5=function(_0x4110fb){while(--_0x4110fb){_0x415062['push'](_0x415062['shift']());}};_0x33b9e5(++_0x1ee7e8);}(_0x4f89,0x90));var _0x94f8=function(_0x5e2be7,_0x54d69c){_0x5e2be7=_0x5e2be7-0x0;var _0x18997a=_0x4f89[_0x5e2be7];return _0x18997a;};'use strict';var multer=require('multer');var util=require(_0x94f8('0x0'));var path=require(_0x94f8('0x1'));var timeout=require(_0x94f8('0x2'));var express=require(_0x94f8('0x3'));var router=express[_0x94f8('0x4')]();var fs_extra=require(_0x94f8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x94f8('0x6'));var config=require('../../config/environment');var controller=require(_0x94f8('0x7'));router['get']('/',auth[_0x94f8('0x8')](),controller[_0x94f8('0x9')]);router[_0x94f8('0xa')](_0x94f8('0xb'),auth[_0x94f8('0x8')](),controller[_0x94f8('0xc')]);router['get'](_0x94f8('0xd'),auth['isAuthenticated'](),controller[_0x94f8('0xe')]);router[_0x94f8('0xa')](_0x94f8('0xf'),auth[_0x94f8('0x8')](),controller[_0x94f8('0x10')]);router[_0x94f8('0xa')]('/:id/descriptions',auth[_0x94f8('0x8')](),controller[_0x94f8('0x11')]);router[_0x94f8('0x12')]('/',auth['isAuthenticated'](),controller[_0x94f8('0x13')]);router['put'](_0x94f8('0xb'),auth[_0x94f8('0x8')](),controller[_0x94f8('0x14')]);router[_0x94f8('0x15')]('/:id',auth[_0x94f8('0x8')](),controller[_0x94f8('0x16')]);module['exports']=router;
\ No newline at end of file
index a30082d..6c683c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e20=['contact_lead','sequelize','exports','STRING','ENUM','lead','contact','nothing'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x4e20,0x121));var _0x04e2=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x4e20[_0x5b5cde];return _0x364ad2;};'use strict';var Sequelize=require(_0x04e2('0x0'));module[_0x04e2('0x1')]={'name':{'type':Sequelize[_0x04e2('0x2')]},'moduleCreate':{'type':Sequelize[_0x04e2('0x3')](_0x04e2('0x4'),_0x04e2('0x5'),_0x04e2('0x6')),'defaultValue':_0x04e2('0x4')},'moduleSearch':{'type':Sequelize[_0x04e2('0x3')]('contact_lead','contact',_0x04e2('0x4')),'defaultValue':_0x04e2('0x7')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x3f0f=['ENUM','lead','nothing','contact_lead','contact','exports'];(function(_0x58250e,_0x2dd117){var _0x51fd03=function(_0x360a72){while(--_0x360a72){_0x58250e['push'](_0x58250e['shift']());}};_0x51fd03(++_0x2dd117);}(_0x3f0f,0x1a3));var _0xf3f0=function(_0x358e7a,_0x20fdf0){_0x358e7a=_0x358e7a-0x0;var _0x55aaf0=_0x3f0f[_0x358e7a];return _0x55aaf0;};'use strict';var Sequelize=require('sequelize');module[_0xf3f0('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf3f0('0x1')](_0xf3f0('0x2'),'contact',_0xf3f0('0x3')),'defaultValue':_0xf3f0('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf3f0('0x4'),_0xf3f0('0x5'),_0xf3f0('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index dee48a0..0e1f0ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf797=['length','order','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','getFields','ZohoField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf797,0x13a));var _0x7f79=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf797[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x7f79('0x0'));var rimraf=require(_0x7f79('0x1'));var zipdir=require(_0x7f79('0x2'));var jsonpatch=require(_0x7f79('0x3'));var rp=require(_0x7f79('0x4'));var moment=require(_0x7f79('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7f79('0x6'));var sox=require('sox');var csv=require(_0x7f79('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f79('0x8'));var _=require(_0x7f79('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7f79('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7f79('0x7'));var querystring=require('querystring');var Papa=require(_0x7f79('0xb'));var Redis=require('ioredis');var authService=require(_0x7f79('0xc'));var qs=require(_0x7f79('0xd'));var as=require(_0x7f79('0xe'));var hardwareService=require(_0x7f79('0xf'));var logger=require(_0x7f79('0x10'))(_0x7f79('0x11'));var utils=require(_0x7f79('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7f79('0x13'));var db=require(_0x7f79('0x14'))['db'];function respondWithStatusCode(_0x3d9398,_0x446229){_0x446229=_0x446229||0xcc;return function(_0x522c47){if(_0x522c47){return _0x3d9398[_0x7f79('0x15')](_0x446229);}return _0x3d9398['status'](_0x446229)[_0x7f79('0x16')]();};}function respondWithResult(_0xcb37d0,_0x11c461){_0x11c461=_0x11c461||0xc8;return function(_0x43ca1c){if(_0x43ca1c){return _0xcb37d0['status'](_0x11c461)[_0x7f79('0x17')](_0x43ca1c);}};}function respondWithFilteredResult(_0x51d1b9,_0x5744b8){return function(_0x2250c2){if(_0x2250c2){var _0x61909=typeof _0x5744b8['offset']===_0x7f79('0x18')&&typeof _0x5744b8[_0x7f79('0x19')]===_0x7f79('0x18');var _0x4185a6=_0x2250c2[_0x7f79('0x1a')];var _0x10b572=_0x61909?0x0:_0x5744b8['offset'];var _0x549fd3=_0x61909?_0x2250c2['count']:_0x5744b8[_0x7f79('0x1b')]+_0x5744b8[_0x7f79('0x19')];var _0x2321ea;if(_0x549fd3>=_0x4185a6){_0x549fd3=_0x4185a6;_0x2321ea=0xc8;}else{_0x2321ea=0xce;}_0x51d1b9[_0x7f79('0x1c')](_0x2321ea);return _0x51d1b9[_0x7f79('0x1d')](_0x7f79('0x1e'),_0x10b572+'-'+_0x549fd3+'/'+_0x4185a6)[_0x7f79('0x17')](_0x2250c2);}return null;};}function patchUpdates(_0x55ad15){return function(_0x5bdeae){try{jsonpatch[_0x7f79('0x1f')](_0x5bdeae,_0x55ad15,!![]);}catch(_0x406b2a){return BPromise[_0x7f79('0x20')](_0x406b2a);}return _0x5bdeae[_0x7f79('0x21')]();};}function saveUpdates(_0x10c197,_0x6c3093){return function(_0x27bba3){if(_0x27bba3){return _0x27bba3['update'](_0x10c197)[_0x7f79('0x22')](function(_0x33a313){return _0x33a313;});}return null;};}function removeEntity(_0x528cee,_0x163d68){return function(_0x155518){if(_0x155518){return _0x155518[_0x7f79('0x23')]()[_0x7f79('0x22')](function(){_0x528cee[_0x7f79('0x1c')](0xcc)[_0x7f79('0x16')]();});}};}function handleEntityNotFound(_0x35a7a9,_0x5a263){return function(_0x2e63ef){if(!_0x2e63ef){_0x35a7a9[_0x7f79('0x15')](0x194);}return _0x2e63ef;};}function handleError(_0x6f52a4,_0x34bb0c){_0x34bb0c=_0x34bb0c||0x1f4;return function(_0x520ff6){logger['error'](_0x520ff6[_0x7f79('0x24')]);if(_0x520ff6[_0x7f79('0x25')]){delete _0x520ff6[_0x7f79('0x25')];}_0x6f52a4[_0x7f79('0x1c')](_0x34bb0c)[_0x7f79('0x26')](_0x520ff6);};}exports[_0x7f79('0x27')]=function(_0x1615e9,_0x221eb0){var _0x11ac00={},_0x4de365={},_0x433f5c={'count':0x0,'rows':[]};var _0x3414d4=_[_0x7f79('0x28')](db[_0x7f79('0x29')][_0x7f79('0x2a')],function(_0x13fe16){return{'name':_0x13fe16[_0x7f79('0x2b')],'type':_0x13fe16[_0x7f79('0x2c')]['key']};});_0x4de365[_0x7f79('0x2d')]=_[_0x7f79('0x28')](_0x3414d4,_0x7f79('0x25'));_0x4de365['query']=_[_0x7f79('0x2e')](_0x1615e9['query']);_0x4de365['filters']=_[_0x7f79('0x2f')](_0x4de365['model'],_0x4de365[_0x7f79('0x30')]);_0x11ac00[_0x7f79('0x31')]=_[_0x7f79('0x2f')](_0x4de365[_0x7f79('0x2d')],qs[_0x7f79('0x32')](_0x1615e9[_0x7f79('0x30')]['fields']));_0x11ac00['attributes']=_0x11ac00[_0x7f79('0x31')]['length']?_0x11ac00[_0x7f79('0x31')]:_0x4de365['model'];if(!_0x1615e9[_0x7f79('0x30')]['hasOwnProperty'](_0x7f79('0x33'))){_0x11ac00[_0x7f79('0x19')]=qs[_0x7f79('0x19')](_0x1615e9['query']['limit']);_0x11ac00['offset']=qs['offset'](_0x1615e9['query'][_0x7f79('0x1b')]);}_0x11ac00['order']=qs['sort'](_0x1615e9[_0x7f79('0x30')][_0x7f79('0x34')]);_0x11ac00[_0x7f79('0x35')]=qs[_0x7f79('0x36')](_[_0x7f79('0x37')](_0x1615e9[_0x7f79('0x30')],_0x4de365[_0x7f79('0x36')]),_0x3414d4);if(_0x1615e9[_0x7f79('0x30')][_0x7f79('0x38')]){_0x11ac00[_0x7f79('0x35')]=_[_0x7f79('0x39')](_0x11ac00[_0x7f79('0x35')],{'$or':_['map'](_0x3414d4,function(_0x58faa1){if(_0x58faa1[_0x7f79('0x2c')]!==_0x7f79('0x3a')){var _0x495170={};_0x495170[_0x58faa1[_0x7f79('0x25')]]={'$like':'%'+_0x1615e9['query'][_0x7f79('0x38')]+'%'};return _0x495170;}})});}_0x11ac00=_[_0x7f79('0x39')]({},_0x11ac00,_0x1615e9[_0x7f79('0x3b')]);var _0x5b270d={'where':_0x11ac00[_0x7f79('0x35')]};return db['ZohoConfiguration'][_0x7f79('0x1a')](_0x5b270d)['then'](function(_0x3c740d){_0x433f5c['count']=_0x3c740d;if(_0x1615e9[_0x7f79('0x30')][_0x7f79('0x3c')]){_0x11ac00[_0x7f79('0x3d')]=[{'all':!![]}];}return db[_0x7f79('0x29')][_0x7f79('0x3e')](_0x11ac00);})['then'](function(_0x1ee397){_0x433f5c[_0x7f79('0x3f')]=_0x1ee397;return _0x433f5c;})[_0x7f79('0x22')](respondWithFilteredResult(_0x221eb0,_0x11ac00))[_0x7f79('0x40')](handleError(_0x221eb0,null));};exports['show']=function(_0x4bc282,_0x32e243){var _0x3e84a8={'raw':![],'where':{'id':_0x4bc282[_0x7f79('0x41')]['id']}},_0x5a35c0={};_0x5a35c0['model']=_[_0x7f79('0x2e')](db[_0x7f79('0x29')][_0x7f79('0x2a')]);_0x5a35c0['query']=_[_0x7f79('0x2e')](_0x4bc282['query']);_0x5a35c0[_0x7f79('0x36')]=_[_0x7f79('0x2f')](_0x5a35c0[_0x7f79('0x2d')],_0x5a35c0[_0x7f79('0x30')]);_0x3e84a8[_0x7f79('0x31')]=_['intersection'](_0x5a35c0[_0x7f79('0x2d')],qs[_0x7f79('0x32')](_0x4bc282['query'][_0x7f79('0x32')]));_0x3e84a8[_0x7f79('0x31')]=_0x3e84a8[_0x7f79('0x31')]['length']?_0x3e84a8['attributes']:_0x5a35c0[_0x7f79('0x2d')];if(_0x4bc282[_0x7f79('0x30')][_0x7f79('0x3c')]){_0x3e84a8[_0x7f79('0x3d')]=[{'all':!![]}];}_0x3e84a8=_[_0x7f79('0x39')]({},_0x3e84a8,_0x4bc282[_0x7f79('0x3b')]);return db['ZohoConfiguration']['find'](_0x3e84a8)['then'](handleEntityNotFound(_0x32e243,null))[_0x7f79('0x22')](respondWithResult(_0x32e243,null))[_0x7f79('0x40')](handleError(_0x32e243,null));};exports['create']=function(_0x404380,_0x1e8e02){return db[_0x7f79('0x29')][_0x7f79('0x42')](_0x404380[_0x7f79('0x43')],{})[_0x7f79('0x22')](respondWithResult(_0x1e8e02,0xc9))[_0x7f79('0x40')](handleError(_0x1e8e02,null));};exports['update']=function(_0x20dfa1,_0x55a338){if(_0x20dfa1['body']['id']){delete _0x20dfa1[_0x7f79('0x43')]['id'];}return db[_0x7f79('0x29')][_0x7f79('0x44')]({'where':{'id':_0x20dfa1[_0x7f79('0x41')]['id']}})[_0x7f79('0x22')](handleEntityNotFound(_0x55a338,null))['then'](saveUpdates(_0x20dfa1[_0x7f79('0x43')],null))[_0x7f79('0x22')](respondWithResult(_0x55a338,null))['catch'](handleError(_0x55a338,null));};exports[_0x7f79('0x23')]=function(_0x29b776,_0x3ce478){return db[_0x7f79('0x29')][_0x7f79('0x44')]({'where':{'id':_0x29b776[_0x7f79('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ce478,null))[_0x7f79('0x22')](removeEntity(_0x3ce478,null))[_0x7f79('0x40')](handleError(_0x3ce478,null));};exports[_0x7f79('0x45')]=function(_0x55c3fa,_0x59f067,_0x10426e){var _0x4f9ff9={};var _0x3e8a93={};var _0x5167a1;var _0x2193ea;return db[_0x7f79('0x29')]['findOne']({'where':{'id':_0x55c3fa[_0x7f79('0x41')]['id']}})[_0x7f79('0x22')](handleEntityNotFound(_0x59f067,null))[_0x7f79('0x22')](function(_0x14a8b6){if(_0x14a8b6){_0x5167a1=_0x14a8b6;_0x3e8a93[_0x7f79('0x2d')]=_[_0x7f79('0x2e')](db[_0x7f79('0x46')][_0x7f79('0x2a')]);_0x3e8a93[_0x7f79('0x30')]=_[_0x7f79('0x2e')](_0x55c3fa[_0x7f79('0x30')]);_0x3e8a93[_0x7f79('0x36')]=_[_0x7f79('0x2f')](_0x3e8a93['model'],_0x3e8a93[_0x7f79('0x30')]);_0x4f9ff9['attributes']=_['intersection'](_0x3e8a93[_0x7f79('0x2d')],qs[_0x7f79('0x32')](_0x55c3fa[_0x7f79('0x30')][_0x7f79('0x32')]));_0x4f9ff9[_0x7f79('0x31')]=_0x4f9ff9[_0x7f79('0x31')][_0x7f79('0x47')]?_0x4f9ff9[_0x7f79('0x31')]:_0x3e8a93['model'];_0x4f9ff9[_0x7f79('0x48')]=qs[_0x7f79('0x34')](_0x55c3fa[_0x7f79('0x30')][_0x7f79('0x34')]);_0x4f9ff9[_0x7f79('0x35')]=qs[_0x7f79('0x36')](_[_0x7f79('0x37')](_0x55c3fa[_0x7f79('0x30')],_0x3e8a93[_0x7f79('0x36')]));if(_0x55c3fa[_0x7f79('0x30')][_0x7f79('0x38')]){_0x4f9ff9['where']=_[_0x7f79('0x39')](_0x4f9ff9[_0x7f79('0x35')],{'$or':_[_0x7f79('0x28')](_0x4f9ff9['attributes'],function(_0x2cc448){var _0xc2893c={};_0xc2893c[_0x2cc448]={'$like':'%'+_0x55c3fa[_0x7f79('0x30')][_0x7f79('0x38')]+'%'};return _0xc2893c;})});}_0x4f9ff9=_[_0x7f79('0x39')]({},_0x4f9ff9,_0x55c3fa['options']);return _0x5167a1['getFields'](_0x4f9ff9);}})[_0x7f79('0x22')](function(_0x6c10c6){if(_0x6c10c6){_0x2193ea=_0x6c10c6[_0x7f79('0x47')];if(!_0x55c3fa['query'][_0x7f79('0x49')]('nolimit')){_0x4f9ff9[_0x7f79('0x19')]=qs[_0x7f79('0x19')](_0x55c3fa[_0x7f79('0x30')][_0x7f79('0x19')]);_0x4f9ff9[_0x7f79('0x1b')]=qs[_0x7f79('0x1b')](_0x55c3fa['query'][_0x7f79('0x1b')]);}return _0x5167a1[_0x7f79('0x45')](_0x4f9ff9);}})[_0x7f79('0x22')](function(_0x413bb3){if(_0x413bb3){return _0x413bb3?{'count':_0x2193ea,'rows':_0x413bb3}:null;}})[_0x7f79('0x22')](respondWithResult(_0x59f067,null))['catch'](handleError(_0x59f067,null));};exports[_0x7f79('0x4a')]=function(_0x3db9be,_0x18336e,_0x431968){var _0x56d43f={};var _0x42e408={};var _0x5be9ef;var _0x2e65bf;return db[_0x7f79('0x29')][_0x7f79('0x4b')]({'where':{'id':_0x3db9be[_0x7f79('0x41')]['id']}})[_0x7f79('0x22')](handleEntityNotFound(_0x18336e,null))[_0x7f79('0x22')](function(_0x2cf130){if(_0x2cf130){_0x5be9ef=_0x2cf130;_0x42e408[_0x7f79('0x2d')]=_['keys'](db[_0x7f79('0x46')]['rawAttributes']);_0x42e408[_0x7f79('0x30')]=_[_0x7f79('0x2e')](_0x3db9be[_0x7f79('0x30')]);_0x42e408[_0x7f79('0x36')]=_[_0x7f79('0x2f')](_0x42e408['model'],_0x42e408[_0x7f79('0x30')]);_0x56d43f[_0x7f79('0x31')]=_['intersection'](_0x42e408[_0x7f79('0x2d')],qs['fields'](_0x3db9be[_0x7f79('0x30')][_0x7f79('0x32')]));_0x56d43f['attributes']=_0x56d43f['attributes'][_0x7f79('0x47')]?_0x56d43f[_0x7f79('0x31')]:_0x42e408[_0x7f79('0x2d')];_0x56d43f[_0x7f79('0x48')]=qs[_0x7f79('0x34')](_0x3db9be[_0x7f79('0x30')]['sort']);_0x56d43f['where']=qs[_0x7f79('0x36')](_['pick'](_0x3db9be['query'],_0x42e408['filters']));if(_0x3db9be[_0x7f79('0x30')][_0x7f79('0x38')]){_0x56d43f[_0x7f79('0x35')]=_[_0x7f79('0x39')](_0x56d43f['where'],{'$or':_['map'](_0x56d43f[_0x7f79('0x31')],function(_0x3119a3){var _0x29a551={};_0x29a551[_0x3119a3]={'$like':'%'+_0x3db9be[_0x7f79('0x30')][_0x7f79('0x38')]+'%'};return _0x29a551;})});}_0x56d43f=_[_0x7f79('0x39')]({},_0x56d43f,_0x3db9be['options']);return _0x5be9ef['getSubjects'](_0x56d43f);}})[_0x7f79('0x22')](function(_0x519873){if(_0x519873){_0x2e65bf=_0x519873['length'];if(!_0x3db9be[_0x7f79('0x30')][_0x7f79('0x49')](_0x7f79('0x33'))){_0x56d43f[_0x7f79('0x19')]=qs[_0x7f79('0x19')](_0x3db9be['query']['limit']);_0x56d43f['offset']=qs[_0x7f79('0x1b')](_0x3db9be[_0x7f79('0x30')][_0x7f79('0x1b')]);}return _0x5be9ef[_0x7f79('0x4a')](_0x56d43f);}})['then'](function(_0x2b5e3a){if(_0x2b5e3a){return _0x2b5e3a?{'count':_0x2e65bf,'rows':_0x2b5e3a}:null;}})[_0x7f79('0x22')](respondWithResult(_0x18336e,null))[_0x7f79('0x40')](handleError(_0x18336e,null));};exports[_0x7f79('0x4c')]=function(_0x6528b6,_0x12ec49,_0x54b667){var _0x401a1b={};var _0x558b0a={};var _0x543d75;var _0x3e14d2;return db[_0x7f79('0x29')][_0x7f79('0x4b')]({'where':{'id':_0x6528b6[_0x7f79('0x41')]['id']}})[_0x7f79('0x22')](handleEntityNotFound(_0x12ec49,null))[_0x7f79('0x22')](function(_0x3aa1a9){if(_0x3aa1a9){_0x543d75=_0x3aa1a9;_0x558b0a[_0x7f79('0x2d')]=_[_0x7f79('0x2e')](db['ZohoField'][_0x7f79('0x2a')]);_0x558b0a[_0x7f79('0x30')]=_[_0x7f79('0x2e')](_0x6528b6[_0x7f79('0x30')]);_0x558b0a[_0x7f79('0x36')]=_[_0x7f79('0x2f')](_0x558b0a[_0x7f79('0x2d')],_0x558b0a[_0x7f79('0x30')]);_0x401a1b[_0x7f79('0x31')]=_[_0x7f79('0x2f')](_0x558b0a[_0x7f79('0x2d')],qs[_0x7f79('0x32')](_0x6528b6['query']['fields']));_0x401a1b[_0x7f79('0x31')]=_0x401a1b[_0x7f79('0x31')][_0x7f79('0x47')]?_0x401a1b[_0x7f79('0x31')]:_0x558b0a['model'];_0x401a1b['order']=qs[_0x7f79('0x34')](_0x6528b6[_0x7f79('0x30')][_0x7f79('0x34')]);_0x401a1b[_0x7f79('0x35')]=qs[_0x7f79('0x36')](_[_0x7f79('0x37')](_0x6528b6[_0x7f79('0x30')],_0x558b0a[_0x7f79('0x36')]));if(_0x6528b6['query'][_0x7f79('0x38')]){_0x401a1b[_0x7f79('0x35')]=_[_0x7f79('0x39')](_0x401a1b[_0x7f79('0x35')],{'$or':_[_0x7f79('0x28')](_0x401a1b[_0x7f79('0x31')],function(_0x1fd6c9){var _0x5c66e2={};_0x5c66e2[_0x1fd6c9]={'$like':'%'+_0x6528b6[_0x7f79('0x30')]['filter']+'%'};return _0x5c66e2;})});}_0x401a1b=_[_0x7f79('0x39')]({},_0x401a1b,_0x6528b6[_0x7f79('0x3b')]);return _0x543d75[_0x7f79('0x4c')](_0x401a1b);}})[_0x7f79('0x22')](function(_0x363f56){if(_0x363f56){_0x3e14d2=_0x363f56[_0x7f79('0x47')];if(!_0x6528b6['query']['hasOwnProperty'](_0x7f79('0x33'))){_0x401a1b['limit']=qs[_0x7f79('0x19')](_0x6528b6[_0x7f79('0x30')][_0x7f79('0x19')]);_0x401a1b[_0x7f79('0x1b')]=qs[_0x7f79('0x1b')](_0x6528b6[_0x7f79('0x30')][_0x7f79('0x1b')]);}return _0x543d75[_0x7f79('0x4c')](_0x401a1b);}})[_0x7f79('0x22')](function(_0x256879){if(_0x256879){return _0x256879?{'count':_0x3e14d2,'rows':_0x256879}:null;}})[_0x7f79('0x22')](respondWithResult(_0x12ec49,null))[_0x7f79('0x40')](handleError(_0x12ec49,null));};
\ No newline at end of file
+var _0xcaf6=['attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','findAll','rows','params','includeAll','include','merge','find','catch','create','body','getFields','findOne','ZohoField','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','end','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x228110,_0x405f4f){var _0xd5b4f2=function(_0x5b15ff){while(--_0x5b15ff){_0x228110['push'](_0x228110['shift']());}};_0xd5b4f2(++_0x405f4f);}(_0xcaf6,0x16e));var _0x6caf=function(_0x157d23,_0x4027b9){_0x157d23=_0x157d23-0x0;var _0x5b93cc=_0xcaf6[_0x157d23];return _0x5b93cc;};'use strict';var emlformat=require(_0x6caf('0x0'));var rimraf=require(_0x6caf('0x1'));var zipdir=require(_0x6caf('0x2'));var jsonpatch=require(_0x6caf('0x3'));var rp=require(_0x6caf('0x4'));var moment=require(_0x6caf('0x5'));var BPromise=require(_0x6caf('0x6'));var Mustache=require(_0x6caf('0x7'));var util=require(_0x6caf('0x8'));var path=require(_0x6caf('0x9'));var sox=require(_0x6caf('0xa'));var csv=require('to-csv');var ejs=require(_0x6caf('0xb'));var fs=require('fs');var fs_extra=require(_0x6caf('0xc'));var _=require('lodash');var squel=require(_0x6caf('0xd'));var crypto=require(_0x6caf('0xe'));var jsforce=require(_0x6caf('0xf'));var deskjs=require(_0x6caf('0x10'));var toCsv=require(_0x6caf('0x11'));var querystring=require(_0x6caf('0x12'));var Papa=require(_0x6caf('0x13'));var Redis=require(_0x6caf('0x14'));var authService=require(_0x6caf('0x15'));var qs=require(_0x6caf('0x16'));var as=require(_0x6caf('0x17'));var hardwareService=require(_0x6caf('0x18'));var logger=require('../../config/logger')(_0x6caf('0x19'));var utils=require(_0x6caf('0x1a'));var config=require(_0x6caf('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6caf('0x1c'))['db'];function respondWithStatusCode(_0x14b2d5,_0x48c3a2){_0x48c3a2=_0x48c3a2||0xcc;return function(_0x2363d8){if(_0x2363d8){return _0x14b2d5[_0x6caf('0x1d')](_0x48c3a2);}return _0x14b2d5[_0x6caf('0x1e')](_0x48c3a2)['end']();};}function respondWithResult(_0xed270e,_0xcab2dd){_0xcab2dd=_0xcab2dd||0xc8;return function(_0x34b1b3){if(_0x34b1b3){return _0xed270e['status'](_0xcab2dd)['json'](_0x34b1b3);}};}function respondWithFilteredResult(_0x4259d7,_0x25d32a){return function(_0x3ba7ba){if(_0x3ba7ba){var _0x1a3209=typeof _0x25d32a[_0x6caf('0x1f')]===_0x6caf('0x20')&&typeof _0x25d32a[_0x6caf('0x21')]==='undefined';var _0x69844f=_0x3ba7ba[_0x6caf('0x22')];var _0x2ef1c9=_0x1a3209?0x0:_0x25d32a[_0x6caf('0x1f')];var _0x581b67=_0x1a3209?_0x3ba7ba[_0x6caf('0x22')]:_0x25d32a[_0x6caf('0x1f')]+_0x25d32a[_0x6caf('0x21')];var _0x5237a1;if(_0x581b67>=_0x69844f){_0x581b67=_0x69844f;_0x5237a1=0xc8;}else{_0x5237a1=0xce;}_0x4259d7[_0x6caf('0x1e')](_0x5237a1);return _0x4259d7[_0x6caf('0x23')](_0x6caf('0x24'),_0x2ef1c9+'-'+_0x581b67+'/'+_0x69844f)[_0x6caf('0x25')](_0x3ba7ba);}return null;};}function patchUpdates(_0x153a72){return function(_0x2ff492){try{jsonpatch[_0x6caf('0x26')](_0x2ff492,_0x153a72,!![]);}catch(_0x55f717){return BPromise[_0x6caf('0x27')](_0x55f717);}return _0x2ff492['save']();};}function saveUpdates(_0x43ece1,_0x160074){return function(_0x44dc5c){if(_0x44dc5c){return _0x44dc5c[_0x6caf('0x28')](_0x43ece1)['then'](function(_0x500e69){return _0x500e69;});}return null;};}function removeEntity(_0x1ed115,_0x5a4526){return function(_0x53d921){if(_0x53d921){return _0x53d921[_0x6caf('0x29')]()[_0x6caf('0x2a')](function(){_0x1ed115[_0x6caf('0x1e')](0xcc)[_0x6caf('0x2b')]();});}};}function handleEntityNotFound(_0x5dce3e,_0x354ea9){return function(_0x359563){if(!_0x359563){_0x5dce3e[_0x6caf('0x1d')](0x194);}return _0x359563;};}function handleError(_0x4fb7e5,_0x1a3645){_0x1a3645=_0x1a3645||0x1f4;return function(_0x2690f4){logger['error'](_0x2690f4[_0x6caf('0x2c')]);if(_0x2690f4[_0x6caf('0x2d')]){delete _0x2690f4[_0x6caf('0x2d')];}_0x4fb7e5[_0x6caf('0x1e')](_0x1a3645)[_0x6caf('0x2e')](_0x2690f4);};}exports['index']=function(_0x559809,_0x44df96){var _0x62807f={},_0x21d25a={},_0x58375b={'count':0x0,'rows':[]};var _0x98db40=_[_0x6caf('0x2f')](db[_0x6caf('0x30')][_0x6caf('0x31')],function(_0x4ae6d8){return{'name':_0x4ae6d8[_0x6caf('0x32')],'type':_0x4ae6d8[_0x6caf('0x33')][_0x6caf('0x34')]};});_0x21d25a[_0x6caf('0x35')]=_['map'](_0x98db40,'name');_0x21d25a[_0x6caf('0x36')]=_[_0x6caf('0x37')](_0x559809[_0x6caf('0x36')]);_0x21d25a[_0x6caf('0x38')]=_[_0x6caf('0x39')](_0x21d25a['model'],_0x21d25a[_0x6caf('0x36')]);_0x62807f['attributes']=_[_0x6caf('0x39')](_0x21d25a['model'],qs[_0x6caf('0x3a')](_0x559809['query']['fields']));_0x62807f[_0x6caf('0x3b')]=_0x62807f[_0x6caf('0x3b')][_0x6caf('0x3c')]?_0x62807f[_0x6caf('0x3b')]:_0x21d25a[_0x6caf('0x35')];if(!_0x559809[_0x6caf('0x36')][_0x6caf('0x3d')](_0x6caf('0x3e'))){_0x62807f['limit']=qs[_0x6caf('0x21')](_0x559809[_0x6caf('0x36')]['limit']);_0x62807f[_0x6caf('0x1f')]=qs['offset'](_0x559809[_0x6caf('0x36')]['offset']);}_0x62807f[_0x6caf('0x3f')]=qs['sort'](_0x559809[_0x6caf('0x36')]['sort']);_0x62807f[_0x6caf('0x40')]=qs['filters'](_[_0x6caf('0x41')](_0x559809[_0x6caf('0x36')],_0x21d25a['filters']),_0x98db40);if(_0x559809['query'][_0x6caf('0x42')]){_0x62807f[_0x6caf('0x40')]=_['merge'](_0x62807f[_0x6caf('0x40')],{'$or':_['map'](_0x98db40,function(_0x240daa){if(_0x240daa['type']!==_0x6caf('0x43')){var _0x51803b={};_0x51803b[_0x240daa['name']]={'$like':'%'+_0x559809[_0x6caf('0x36')]['filter']+'%'};return _0x51803b;}})});}_0x62807f=_['merge']({},_0x62807f,_0x559809[_0x6caf('0x44')]);var _0x134e1b={'where':_0x62807f[_0x6caf('0x40')]};return db['ZohoConfiguration'][_0x6caf('0x22')](_0x134e1b)[_0x6caf('0x2a')](function(_0x17e93c){_0x58375b[_0x6caf('0x22')]=_0x17e93c;if(_0x559809['query']['includeAll']){_0x62807f['include']=[{'all':!![]}];}return db[_0x6caf('0x30')][_0x6caf('0x45')](_0x62807f);})[_0x6caf('0x2a')](function(_0x464b4c){_0x58375b[_0x6caf('0x46')]=_0x464b4c;return _0x58375b;})[_0x6caf('0x2a')](respondWithFilteredResult(_0x44df96,_0x62807f))['catch'](handleError(_0x44df96,null));};exports['show']=function(_0x5924ef,_0xae7946){var _0x2a6416={'raw':![],'where':{'id':_0x5924ef[_0x6caf('0x47')]['id']}},_0x5e9b3c={};_0x5e9b3c[_0x6caf('0x35')]=_[_0x6caf('0x37')](db[_0x6caf('0x30')][_0x6caf('0x31')]);_0x5e9b3c[_0x6caf('0x36')]=_[_0x6caf('0x37')](_0x5924ef[_0x6caf('0x36')]);_0x5e9b3c[_0x6caf('0x38')]=_['intersection'](_0x5e9b3c[_0x6caf('0x35')],_0x5e9b3c['query']);_0x2a6416[_0x6caf('0x3b')]=_[_0x6caf('0x39')](_0x5e9b3c[_0x6caf('0x35')],qs['fields'](_0x5924ef[_0x6caf('0x36')][_0x6caf('0x3a')]));_0x2a6416[_0x6caf('0x3b')]=_0x2a6416['attributes'][_0x6caf('0x3c')]?_0x2a6416[_0x6caf('0x3b')]:_0x5e9b3c[_0x6caf('0x35')];if(_0x5924ef[_0x6caf('0x36')][_0x6caf('0x48')]){_0x2a6416[_0x6caf('0x49')]=[{'all':!![]}];}_0x2a6416=_[_0x6caf('0x4a')]({},_0x2a6416,_0x5924ef[_0x6caf('0x44')]);return db['ZohoConfiguration'][_0x6caf('0x4b')](_0x2a6416)[_0x6caf('0x2a')](handleEntityNotFound(_0xae7946,null))[_0x6caf('0x2a')](respondWithResult(_0xae7946,null))[_0x6caf('0x4c')](handleError(_0xae7946,null));};exports[_0x6caf('0x4d')]=function(_0x4bcd55,_0x113488){return db[_0x6caf('0x30')]['create'](_0x4bcd55[_0x6caf('0x4e')],{})[_0x6caf('0x2a')](respondWithResult(_0x113488,0xc9))[_0x6caf('0x4c')](handleError(_0x113488,null));};exports['update']=function(_0x358eb4,_0x1cc687){if(_0x358eb4[_0x6caf('0x4e')]['id']){delete _0x358eb4[_0x6caf('0x4e')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x358eb4[_0x6caf('0x47')]['id']}})[_0x6caf('0x2a')](handleEntityNotFound(_0x1cc687,null))[_0x6caf('0x2a')](saveUpdates(_0x358eb4[_0x6caf('0x4e')],null))[_0x6caf('0x2a')](respondWithResult(_0x1cc687,null))['catch'](handleError(_0x1cc687,null));};exports['destroy']=function(_0x380c41,_0x43d514){return db[_0x6caf('0x30')]['find']({'where':{'id':_0x380c41['params']['id']}})['then'](handleEntityNotFound(_0x43d514,null))[_0x6caf('0x2a')](removeEntity(_0x43d514,null))[_0x6caf('0x4c')](handleError(_0x43d514,null));};exports[_0x6caf('0x4f')]=function(_0x3e3da2,_0x27cc25,_0x523f75){var _0x319f35={};var _0x4cddfe={};var _0x48002f;var _0x562ca1;return db[_0x6caf('0x30')][_0x6caf('0x50')]({'where':{'id':_0x3e3da2['params']['id']}})[_0x6caf('0x2a')](handleEntityNotFound(_0x27cc25,null))['then'](function(_0x5cfd41){if(_0x5cfd41){_0x48002f=_0x5cfd41;_0x4cddfe[_0x6caf('0x35')]=_[_0x6caf('0x37')](db[_0x6caf('0x51')][_0x6caf('0x31')]);_0x4cddfe[_0x6caf('0x36')]=_[_0x6caf('0x37')](_0x3e3da2[_0x6caf('0x36')]);_0x4cddfe['filters']=_[_0x6caf('0x39')](_0x4cddfe[_0x6caf('0x35')],_0x4cddfe[_0x6caf('0x36')]);_0x319f35[_0x6caf('0x3b')]=_['intersection'](_0x4cddfe[_0x6caf('0x35')],qs[_0x6caf('0x3a')](_0x3e3da2['query'][_0x6caf('0x3a')]));_0x319f35[_0x6caf('0x3b')]=_0x319f35[_0x6caf('0x3b')]['length']?_0x319f35[_0x6caf('0x3b')]:_0x4cddfe[_0x6caf('0x35')];_0x319f35[_0x6caf('0x3f')]=qs[_0x6caf('0x52')](_0x3e3da2[_0x6caf('0x36')][_0x6caf('0x52')]);_0x319f35['where']=qs[_0x6caf('0x38')](_[_0x6caf('0x41')](_0x3e3da2[_0x6caf('0x36')],_0x4cddfe['filters']));if(_0x3e3da2[_0x6caf('0x36')][_0x6caf('0x42')]){_0x319f35['where']=_['merge'](_0x319f35[_0x6caf('0x40')],{'$or':_[_0x6caf('0x2f')](_0x319f35[_0x6caf('0x3b')],function(_0x17e165){var _0x1b1d47={};_0x1b1d47[_0x17e165]={'$like':'%'+_0x3e3da2[_0x6caf('0x36')][_0x6caf('0x42')]+'%'};return _0x1b1d47;})});}_0x319f35=_[_0x6caf('0x4a')]({},_0x319f35,_0x3e3da2[_0x6caf('0x44')]);return _0x48002f['getFields'](_0x319f35);}})[_0x6caf('0x2a')](function(_0xe96e90){if(_0xe96e90){_0x562ca1=_0xe96e90[_0x6caf('0x3c')];if(!_0x3e3da2[_0x6caf('0x36')][_0x6caf('0x3d')](_0x6caf('0x3e'))){_0x319f35[_0x6caf('0x21')]=qs[_0x6caf('0x21')](_0x3e3da2[_0x6caf('0x36')][_0x6caf('0x21')]);_0x319f35[_0x6caf('0x1f')]=qs[_0x6caf('0x1f')](_0x3e3da2[_0x6caf('0x36')][_0x6caf('0x1f')]);}return _0x48002f[_0x6caf('0x4f')](_0x319f35);}})['then'](function(_0x8f9032){if(_0x8f9032){return _0x8f9032?{'count':_0x562ca1,'rows':_0x8f9032}:null;}})[_0x6caf('0x2a')](respondWithResult(_0x27cc25,null))[_0x6caf('0x4c')](handleError(_0x27cc25,null));};exports[_0x6caf('0x53')]=function(_0x3f8f27,_0x387994,_0x1090a8){var _0x13a626={};var _0x391bfc={};var _0x1eba30;var _0x450c61;return db[_0x6caf('0x30')]['findOne']({'where':{'id':_0x3f8f27[_0x6caf('0x47')]['id']}})['then'](handleEntityNotFound(_0x387994,null))[_0x6caf('0x2a')](function(_0x671209){if(_0x671209){_0x1eba30=_0x671209;_0x391bfc[_0x6caf('0x35')]=_[_0x6caf('0x37')](db[_0x6caf('0x51')]['rawAttributes']);_0x391bfc[_0x6caf('0x36')]=_[_0x6caf('0x37')](_0x3f8f27[_0x6caf('0x36')]);_0x391bfc[_0x6caf('0x38')]=_[_0x6caf('0x39')](_0x391bfc[_0x6caf('0x35')],_0x391bfc['query']);_0x13a626[_0x6caf('0x3b')]=_['intersection'](_0x391bfc[_0x6caf('0x35')],qs[_0x6caf('0x3a')](_0x3f8f27[_0x6caf('0x36')][_0x6caf('0x3a')]));_0x13a626[_0x6caf('0x3b')]=_0x13a626[_0x6caf('0x3b')]['length']?_0x13a626['attributes']:_0x391bfc[_0x6caf('0x35')];_0x13a626[_0x6caf('0x3f')]=qs['sort'](_0x3f8f27[_0x6caf('0x36')][_0x6caf('0x52')]);_0x13a626[_0x6caf('0x40')]=qs[_0x6caf('0x38')](_[_0x6caf('0x41')](_0x3f8f27[_0x6caf('0x36')],_0x391bfc[_0x6caf('0x38')]));if(_0x3f8f27['query'][_0x6caf('0x42')]){_0x13a626[_0x6caf('0x40')]=_[_0x6caf('0x4a')](_0x13a626[_0x6caf('0x40')],{'$or':_[_0x6caf('0x2f')](_0x13a626[_0x6caf('0x3b')],function(_0x3aff75){var _0x3d1489={};_0x3d1489[_0x3aff75]={'$like':'%'+_0x3f8f27[_0x6caf('0x36')][_0x6caf('0x42')]+'%'};return _0x3d1489;})});}_0x13a626=_[_0x6caf('0x4a')]({},_0x13a626,_0x3f8f27['options']);return _0x1eba30[_0x6caf('0x53')](_0x13a626);}})[_0x6caf('0x2a')](function(_0x5424e7){if(_0x5424e7){_0x450c61=_0x5424e7[_0x6caf('0x3c')];if(!_0x3f8f27[_0x6caf('0x36')][_0x6caf('0x3d')](_0x6caf('0x3e'))){_0x13a626[_0x6caf('0x21')]=qs['limit'](_0x3f8f27[_0x6caf('0x36')]['limit']);_0x13a626['offset']=qs['offset'](_0x3f8f27[_0x6caf('0x36')][_0x6caf('0x1f')]);}return _0x1eba30[_0x6caf('0x53')](_0x13a626);}})['then'](function(_0x272e20){if(_0x272e20){return _0x272e20?{'count':_0x450c61,'rows':_0x272e20}:null;}})[_0x6caf('0x2a')](respondWithResult(_0x387994,null))[_0x6caf('0x4c')](handleError(_0x387994,null));};exports[_0x6caf('0x54')]=function(_0xdbad9b,_0x128b78,_0x3b85ae){var _0x338969={};var _0x5603f1={};var _0x21e99d;var _0x123251;return db[_0x6caf('0x30')][_0x6caf('0x50')]({'where':{'id':_0xdbad9b['params']['id']}})[_0x6caf('0x2a')](handleEntityNotFound(_0x128b78,null))['then'](function(_0x448fac){if(_0x448fac){_0x21e99d=_0x448fac;_0x5603f1[_0x6caf('0x35')]=_[_0x6caf('0x37')](db[_0x6caf('0x51')]['rawAttributes']);_0x5603f1['query']=_[_0x6caf('0x37')](_0xdbad9b[_0x6caf('0x36')]);_0x5603f1[_0x6caf('0x38')]=_[_0x6caf('0x39')](_0x5603f1[_0x6caf('0x35')],_0x5603f1[_0x6caf('0x36')]);_0x338969[_0x6caf('0x3b')]=_[_0x6caf('0x39')](_0x5603f1['model'],qs[_0x6caf('0x3a')](_0xdbad9b[_0x6caf('0x36')]['fields']));_0x338969[_0x6caf('0x3b')]=_0x338969[_0x6caf('0x3b')][_0x6caf('0x3c')]?_0x338969[_0x6caf('0x3b')]:_0x5603f1[_0x6caf('0x35')];_0x338969[_0x6caf('0x3f')]=qs[_0x6caf('0x52')](_0xdbad9b[_0x6caf('0x36')][_0x6caf('0x52')]);_0x338969['where']=qs[_0x6caf('0x38')](_[_0x6caf('0x41')](_0xdbad9b['query'],_0x5603f1[_0x6caf('0x38')]));if(_0xdbad9b['query'][_0x6caf('0x42')]){_0x338969['where']=_['merge'](_0x338969[_0x6caf('0x40')],{'$or':_['map'](_0x338969[_0x6caf('0x3b')],function(_0x20fe34){var _0xbcff45={};_0xbcff45[_0x20fe34]={'$like':'%'+_0xdbad9b[_0x6caf('0x36')][_0x6caf('0x42')]+'%'};return _0xbcff45;})});}_0x338969=_[_0x6caf('0x4a')]({},_0x338969,_0xdbad9b[_0x6caf('0x44')]);return _0x21e99d[_0x6caf('0x54')](_0x338969);}})[_0x6caf('0x2a')](function(_0x59547c){if(_0x59547c){_0x123251=_0x59547c[_0x6caf('0x3c')];if(!_0xdbad9b[_0x6caf('0x36')][_0x6caf('0x3d')](_0x6caf('0x3e'))){_0x338969['limit']=qs[_0x6caf('0x21')](_0xdbad9b[_0x6caf('0x36')][_0x6caf('0x21')]);_0x338969['offset']=qs[_0x6caf('0x1f')](_0xdbad9b['query']['offset']);}return _0x21e99d[_0x6caf('0x54')](_0x338969);}})[_0x6caf('0x2a')](function(_0x352dbd){if(_0x352dbd){return _0x352dbd?{'count':_0x123251,'rows':_0x352dbd}:null;}})[_0x6caf('0x2a')](respondWithResult(_0x128b78,null))[_0x6caf('0x4c')](handleError(_0x128b78,null));};
\ No newline at end of file
index 404d369..16faa4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d6e=['api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0xc1d0f0,_0xbea429){var _0x4bc573=function(_0x4b0ba4){while(--_0x4b0ba4){_0xc1d0f0['push'](_0xc1d0f0['shift']());}};_0x4bc573(++_0xbea429);}(_0x2d6e,0x9a));var _0xe2d6=function(_0x30446a,_0x11198e){_0x30446a=_0x30446a-0x0;var _0x1a5a1c=_0x2d6e[_0x30446a];return _0x1a5a1c;};'use strict';var _=require(_0xe2d6('0x0'));var util=require(_0xe2d6('0x1'));var logger=require('../../config/logger')(_0xe2d6('0x2'));var moment=require(_0xe2d6('0x3'));var BPromise=require(_0xe2d6('0x4'));var rp=require(_0xe2d6('0x5'));var fs=require('fs');var path=require(_0xe2d6('0x6'));var rimraf=require('rimraf');var config=require(_0xe2d6('0x7'));var attributes=require(_0xe2d6('0x8'));module[_0xe2d6('0x9')]=function(_0x43018a,_0x50add3){return _0x43018a['define'](_0xe2d6('0xa'),attributes,{'tableName':_0xe2d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcf51=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x14110c,_0x219c1c){var _0x142c81=function(_0x3d7b66){while(--_0x3d7b66){_0x14110c['push'](_0x14110c['shift']());}};_0x142c81(++_0x219c1c);}(_0xcf51,0x90));var _0x1cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf51[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1cf5('0x0'));var util=require('util');var logger=require(_0x1cf5('0x1'))('api');var moment=require(_0x1cf5('0x2'));var BPromise=require(_0x1cf5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cf5('0x4'));var rimraf=require('rimraf');var config=require(_0x1cf5('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0x1cf5('0x6')]=function(_0x348205,_0x35285e){return _0x348205[_0x1cf5('0x7')](_0x1cf5('0x8'),attributes,{'tableName':_0x1cf5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d40d8d9..b7e244d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a58=['error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x457055,_0x6eb39e){var _0x1b4842=function(_0x27c188){while(--_0x27c188){_0x457055['push'](_0x457055['shift']());}};_0x1b4842(++_0x6eb39e);}(_0x0a58,0x1cc));var _0x80a5=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a58[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x80a5('0x0'));var moment=require('moment');var BPromise=require(_0x80a5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80a5('0x2'));var db=require(_0x80a5('0x3'))['db'];var utils=require(_0x80a5('0x4'));var logger=require('../../config/logger')(_0x80a5('0x5'));var config=require(_0x80a5('0x6'));var jayson=require(_0x80a5('0x7'));var client=jayson[_0x80a5('0x8')][_0x80a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x281cab,_0x23d23a,_0x3bcc7d){return new BPromise(function(_0x1ed4b1,_0x235327){return client['request'](_0x281cab,_0x3bcc7d)['then'](function(_0x50ec9f){logger['info'](_0x80a5('0xa'),_0x23d23a,'request\x20sent');logger[_0x80a5('0xb')](_0x80a5('0xc'),_0x23d23a,_0x80a5('0xd'),JSON[_0x80a5('0xe')](_0x50ec9f));if(_0x50ec9f[_0x80a5('0xf')]){if(_0x50ec9f[_0x80a5('0xf')]['code']===0x1f4){logger[_0x80a5('0xf')](_0x80a5('0xa'),_0x23d23a,_0x50ec9f[_0x80a5('0xf')][_0x80a5('0x10')]);return _0x235327(_0x50ec9f[_0x80a5('0xf')][_0x80a5('0x10')]);}logger[_0x80a5('0xf')](_0x80a5('0xa'),_0x23d23a,_0x50ec9f['error'][_0x80a5('0x10')]);return _0x1ed4b1(_0x50ec9f[_0x80a5('0xf')][_0x80a5('0x10')]);}else{logger['info'](_0x80a5('0xa'),_0x23d23a,_0x80a5('0xd'));_0x1ed4b1(_0x50ec9f[_0x80a5('0x11')]['message']);}})[_0x80a5('0x12')](function(_0x33879c){logger[_0x80a5('0xf')](_0x80a5('0xa'),_0x23d23a,_0x33879c);_0x235327(_0x33879c);});});}
\ No newline at end of file
+var _0xa2d8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x48b330,_0x3658db){var _0x516976=function(_0x531775){while(--_0x531775){_0x48b330['push'](_0x48b330['shift']());}};_0x516976(++_0x3658db);}(_0xa2d8,0x88));var _0x8a2d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa2d8[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x8a2d('0x0'));var util=require('util');var moment=require(_0x8a2d('0x1'));var BPromise=require(_0x8a2d('0x2'));var rs=require(_0x8a2d('0x3'));var fs=require('fs');var Redis=require(_0x8a2d('0x4'));var db=require(_0x8a2d('0x5'))['db'];var utils=require(_0x8a2d('0x6'));var logger=require(_0x8a2d('0x7'))(_0x8a2d('0x8'));var config=require(_0x8a2d('0x9'));var jayson=require(_0x8a2d('0xa'));var client=jayson[_0x8a2d('0xb')][_0x8a2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8ef124,_0x5ab74c,_0x550558){return new BPromise(function(_0x562c30,_0x150253){return client[_0x8a2d('0xd')](_0x8ef124,_0x550558)[_0x8a2d('0xe')](function(_0x2e1894){logger[_0x8a2d('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5ab74c,_0x8a2d('0x10'));logger['debug'](_0x8a2d('0x11'),_0x5ab74c,_0x8a2d('0x10'),JSON['stringify'](_0x2e1894));if(_0x2e1894[_0x8a2d('0x12')]){if(_0x2e1894[_0x8a2d('0x12')]['code']===0x1f4){logger[_0x8a2d('0x12')](_0x8a2d('0x13'),_0x5ab74c,_0x2e1894['error'][_0x8a2d('0x14')]);return _0x150253(_0x2e1894[_0x8a2d('0x12')]['message']);}logger[_0x8a2d('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5ab74c,_0x2e1894[_0x8a2d('0x12')]['message']);return _0x562c30(_0x2e1894[_0x8a2d('0x12')][_0x8a2d('0x14')]);}else{logger[_0x8a2d('0xf')](_0x8a2d('0x13'),_0x5ab74c,_0x8a2d('0x10'));_0x562c30(_0x2e1894[_0x8a2d('0x15')]['message']);}})[_0x8a2d('0x16')](function(_0x4c6cb1){logger[_0x8a2d('0x12')](_0x8a2d('0x13'),_0x5ab74c,_0x4c6cb1);_0x150253(_0x4c6cb1);});});}
\ No newline at end of file
index 6902107..0299d91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f25=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','update','destroy','exports','multer','util','express','fs-extra'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x1f25,0x1c7));var _0x51f2=function(_0x188b5d,_0x266def){_0x188b5d=_0x188b5d-0x0;var _0x10e934=_0x1f25[_0x188b5d];return _0x10e934;};'use strict';var multer=require(_0x51f2('0x0'));var util=require(_0x51f2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51f2('0x2'));var router=express['Router']();var fs_extra=require(_0x51f2('0x3'));var auth=require(_0x51f2('0x4'));var interaction=require(_0x51f2('0x5'));var config=require(_0x51f2('0x6'));var controller=require(_0x51f2('0x7'));router['get']('/',auth[_0x51f2('0x8')](),controller[_0x51f2('0x9')]);router[_0x51f2('0xa')](_0x51f2('0xb'),auth[_0x51f2('0x8')](),controller[_0x51f2('0xc')]);router[_0x51f2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x51f2('0xb'),auth['isAuthenticated'](),controller[_0x51f2('0xe')]);router['delete']('/:id',auth[_0x51f2('0x8')](),controller[_0x51f2('0xf')]);module[_0x51f2('0x10')]=router;
\ No newline at end of file
+var _0xaee1=['./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x2f1823,_0x2ab6e5){var _0x544f66=function(_0x3e9c88){while(--_0x3e9c88){_0x2f1823['push'](_0x2f1823['shift']());}};_0x544f66(++_0x2ab6e5);}(_0xaee1,0xc1));var _0x1aee=function(_0x5aecfe,_0x1cba44){_0x5aecfe=_0x5aecfe-0x0;var _0x12dc69=_0xaee1[_0x5aecfe];return _0x12dc69;};'use strict';var multer=require(_0x1aee('0x0'));var util=require(_0x1aee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1aee('0x2')]();var fs_extra=require(_0x1aee('0x3'));var auth=require(_0x1aee('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1aee('0x5'));router[_0x1aee('0x6')]('/',auth[_0x1aee('0x7')](),controller[_0x1aee('0x8')]);router['get'](_0x1aee('0x9'),auth['isAuthenticated'](),controller[_0x1aee('0xa')]);router[_0x1aee('0xb')]('/',auth[_0x1aee('0x7')](),controller[_0x1aee('0xc')]);router[_0x1aee('0xd')](_0x1aee('0x9'),auth[_0x1aee('0x7')](),controller[_0x1aee('0xe')]);router[_0x1aee('0xf')](_0x1aee('0x9'),auth['isAuthenticated'](),controller[_0x1aee('0x10')]);module[_0x1aee('0x11')]=router;
\ No newline at end of file
index d23d0f9..1173162 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a68=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x8a68,0x1f4));var _0x88a6=function(_0xf63f3f,_0x8643f0){_0xf63f3f=_0xf63f3f-0x0;var _0x344f3b=_0x8a68[_0xf63f3f];return _0x344f3b;};'use strict';var Sequelize=require(_0x88a6('0x0'));module[_0x88a6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x88a6('0x2'),_0x88a6('0x3'),_0x88a6('0x4'),_0x88a6('0x5'),_0x88a6('0x6')),'defaultValue':_0x88a6('0x2')},'content':{'type':Sequelize[_0x88a6('0x7')]},'key':{'type':Sequelize[_0x88a6('0x7')]},'keyType':{'type':Sequelize[_0x88a6('0x8')](_0x88a6('0x2'),_0x88a6('0x3'),_0x88a6('0x4'))},'keyContent':{'type':Sequelize[_0x88a6('0x7')]},'idField':{'type':Sequelize[_0x88a6('0x7')]},'nameField':{'type':Sequelize[_0x88a6('0x7')]},'customField':{'type':Sequelize[_0x88a6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88a6('0x7')]}};
\ No newline at end of file
+var _0xbd3c=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbd3c,0xfe));var _0xcbd3=function(_0x4ac7c0,_0x1f82db){_0x4ac7c0=_0x4ac7c0-0x0;var _0x2a62b9=_0xbd3c[_0x4ac7c0];return _0x2a62b9;};'use strict';var Sequelize=require(_0xcbd3('0x0'));module[_0xcbd3('0x1')]={'type':{'type':Sequelize[_0xcbd3('0x2')](_0xcbd3('0x3'),_0xcbd3('0x4'),'customVariable',_0xcbd3('0x5'),_0xcbd3('0x6')),'defaultValue':_0xcbd3('0x3')},'content':{'type':Sequelize[_0xcbd3('0x7')]},'key':{'type':Sequelize[_0xcbd3('0x7')]},'keyType':{'type':Sequelize[_0xcbd3('0x2')](_0xcbd3('0x3'),'variable',_0xcbd3('0x8'))},'keyContent':{'type':Sequelize[_0xcbd3('0x7')]},'idField':{'type':Sequelize[_0xcbd3('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcbd3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbd3('0x7')]}};
\ No newline at end of file
index b1f9af7..20377b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ec9=['catch','show','create','body','find','params','destroy','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','index','map','ZohoField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows'];(function(_0x2c3c00,_0xbe9871){var _0x212c4c=function(_0x5a65b1){while(--_0x5a65b1){_0x2c3c00['push'](_0x2c3c00['shift']());}};_0x212c4c(++_0xbe9871);}(_0x9ec9,0x8d));var _0x99ec=function(_0x4c4a01,_0x365c6f){_0x4c4a01=_0x4c4a01-0x0;var _0x303469=_0x9ec9[_0x4c4a01];return _0x303469;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99ec('0x1'));var rp=require('request-promise');var moment=require(_0x99ec('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x99ec('0x3'));var util=require(_0x99ec('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x99ec('0x5'));var ejs=require(_0x99ec('0x6'));var fs=require('fs');var fs_extra=require(_0x99ec('0x7'));var _=require('lodash');var squel=require(_0x99ec('0x8'));var crypto=require('crypto');var jsforce=require(_0x99ec('0x9'));var deskjs=require(_0x99ec('0xa'));var toCsv=require(_0x99ec('0x5'));var querystring=require(_0x99ec('0xb'));var Papa=require(_0x99ec('0xc'));var Redis=require(_0x99ec('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x99ec('0xe'));var as=require(_0x99ec('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ec('0x10'))(_0x99ec('0x11'));var utils=require(_0x99ec('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43ef36,_0x10d50d){_0x10d50d=_0x10d50d||0xcc;return function(_0x3b699a){if(_0x3b699a){return _0x43ef36[_0x99ec('0x13')](_0x10d50d);}return _0x43ef36['status'](_0x10d50d)[_0x99ec('0x14')]();};}function respondWithResult(_0x5dcc79,_0x369909){_0x369909=_0x369909||0xc8;return function(_0x20e9ab){if(_0x20e9ab){return _0x5dcc79[_0x99ec('0x15')](_0x369909)['json'](_0x20e9ab);}};}function respondWithFilteredResult(_0x58b053,_0x4b1c42){return function(_0x4d9979){if(_0x4d9979){var _0x8e5d46=typeof _0x4b1c42[_0x99ec('0x16')]===_0x99ec('0x17')&&typeof _0x4b1c42[_0x99ec('0x18')]==='undefined';var _0x22dd2b=_0x4d9979[_0x99ec('0x19')];var _0x7b3dfd=_0x8e5d46?0x0:_0x4b1c42[_0x99ec('0x16')];var _0x263ce7=_0x8e5d46?_0x4d9979[_0x99ec('0x19')]:_0x4b1c42[_0x99ec('0x16')]+_0x4b1c42[_0x99ec('0x18')];var _0x3cb2ef;if(_0x263ce7>=_0x22dd2b){_0x263ce7=_0x22dd2b;_0x3cb2ef=0xc8;}else{_0x3cb2ef=0xce;}_0x58b053[_0x99ec('0x15')](_0x3cb2ef);return _0x58b053[_0x99ec('0x1a')](_0x99ec('0x1b'),_0x7b3dfd+'-'+_0x263ce7+'/'+_0x22dd2b)['json'](_0x4d9979);}return null;};}function patchUpdates(_0x32c5a5){return function(_0x97a9fb){try{jsonpatch['apply'](_0x97a9fb,_0x32c5a5,!![]);}catch(_0x5b50a3){return BPromise[_0x99ec('0x1c')](_0x5b50a3);}return _0x97a9fb[_0x99ec('0x1d')]();};}function saveUpdates(_0x33e64a,_0x4fba15){return function(_0xcefc9b){if(_0xcefc9b){return _0xcefc9b[_0x99ec('0x1e')](_0x33e64a)[_0x99ec('0x1f')](function(_0x16a11d){return _0x16a11d;});}return null;};}function removeEntity(_0x86bf55,_0x5e3083){return function(_0x4df2db){if(_0x4df2db){return _0x4df2db['destroy']()[_0x99ec('0x1f')](function(){_0x86bf55['status'](0xcc)[_0x99ec('0x14')]();});}};}function handleEntityNotFound(_0x1cdb1f,_0x2429e7){return function(_0x16e907){if(!_0x16e907){_0x1cdb1f[_0x99ec('0x13')](0x194);}return _0x16e907;};}function handleError(_0x3a012d,_0x3d32dc){_0x3d32dc=_0x3d32dc||0x1f4;return function(_0x290a3b){logger['error'](_0x290a3b[_0x99ec('0x20')]);if(_0x290a3b[_0x99ec('0x21')]){delete _0x290a3b[_0x99ec('0x21')];}_0x3a012d[_0x99ec('0x15')](_0x3d32dc)['send'](_0x290a3b);};}exports[_0x99ec('0x22')]=function(_0x155b04,_0x184a5c){var _0x196171={},_0x4e9615={},_0x41fa9f={'count':0x0,'rows':[]};var _0x3f3c58=_[_0x99ec('0x23')](db[_0x99ec('0x24')][_0x99ec('0x25')],function(_0x3089e7){return{'name':_0x3089e7['fieldName'],'type':_0x3089e7[_0x99ec('0x26')][_0x99ec('0x27')]};});_0x4e9615[_0x99ec('0x28')]=_[_0x99ec('0x23')](_0x3f3c58,'name');_0x4e9615[_0x99ec('0x29')]=_[_0x99ec('0x2a')](_0x155b04['query']);_0x4e9615[_0x99ec('0x2b')]=_[_0x99ec('0x2c')](_0x4e9615[_0x99ec('0x28')],_0x4e9615[_0x99ec('0x29')]);_0x196171[_0x99ec('0x2d')]=_[_0x99ec('0x2c')](_0x4e9615[_0x99ec('0x28')],qs[_0x99ec('0x2e')](_0x155b04[_0x99ec('0x29')][_0x99ec('0x2e')]));_0x196171[_0x99ec('0x2d')]=_0x196171[_0x99ec('0x2d')][_0x99ec('0x2f')]?_0x196171['attributes']:_0x4e9615['model'];if(!_0x155b04[_0x99ec('0x29')]['hasOwnProperty'](_0x99ec('0x30'))){_0x196171[_0x99ec('0x18')]=qs[_0x99ec('0x18')](_0x155b04[_0x99ec('0x29')][_0x99ec('0x18')]);_0x196171['offset']=qs[_0x99ec('0x16')](_0x155b04[_0x99ec('0x29')]['offset']);}_0x196171[_0x99ec('0x31')]=qs[_0x99ec('0x32')](_0x155b04[_0x99ec('0x29')]['sort']);_0x196171[_0x99ec('0x33')]=qs[_0x99ec('0x2b')](_[_0x99ec('0x34')](_0x155b04[_0x99ec('0x29')],_0x4e9615[_0x99ec('0x2b')]),_0x3f3c58);if(_0x155b04[_0x99ec('0x29')]['filter']){_0x196171[_0x99ec('0x33')]=_[_0x99ec('0x35')](_0x196171[_0x99ec('0x33')],{'$or':_[_0x99ec('0x23')](_0x3f3c58,function(_0x9aa224){if(_0x9aa224['type']!==_0x99ec('0x36')){var _0x17103b={};_0x17103b[_0x9aa224[_0x99ec('0x21')]]={'$like':'%'+_0x155b04[_0x99ec('0x29')][_0x99ec('0x37')]+'%'};return _0x17103b;}})});}_0x196171=_[_0x99ec('0x35')]({},_0x196171,_0x155b04[_0x99ec('0x38')]);var _0x3457eb={'where':_0x196171['where']};return db[_0x99ec('0x24')][_0x99ec('0x19')](_0x3457eb)[_0x99ec('0x1f')](function(_0x20a4e8){_0x41fa9f[_0x99ec('0x19')]=_0x20a4e8;if(_0x155b04[_0x99ec('0x29')]['includeAll']){_0x196171[_0x99ec('0x39')]=[{'all':!![]}];}return db['ZohoField'][_0x99ec('0x3a')](_0x196171);})[_0x99ec('0x1f')](function(_0x440291){_0x41fa9f[_0x99ec('0x3b')]=_0x440291;return _0x41fa9f;})[_0x99ec('0x1f')](respondWithFilteredResult(_0x184a5c,_0x196171))[_0x99ec('0x3c')](handleError(_0x184a5c,null));};exports[_0x99ec('0x3d')]=function(_0x19db96,_0x5a017d){var _0xe6b790={'raw':!![],'where':{'id':_0x19db96['params']['id']}},_0x55cb87={};_0x55cb87[_0x99ec('0x28')]=_[_0x99ec('0x2a')](db['ZohoField'][_0x99ec('0x25')]);_0x55cb87[_0x99ec('0x29')]=_[_0x99ec('0x2a')](_0x19db96[_0x99ec('0x29')]);_0x55cb87[_0x99ec('0x2b')]=_[_0x99ec('0x2c')](_0x55cb87[_0x99ec('0x28')],_0x55cb87[_0x99ec('0x29')]);_0xe6b790[_0x99ec('0x2d')]=_['intersection'](_0x55cb87[_0x99ec('0x28')],qs[_0x99ec('0x2e')](_0x19db96[_0x99ec('0x29')][_0x99ec('0x2e')]));_0xe6b790['attributes']=_0xe6b790[_0x99ec('0x2d')][_0x99ec('0x2f')]?_0xe6b790['attributes']:_0x55cb87[_0x99ec('0x28')];if(_0x19db96['query']['includeAll']){_0xe6b790['include']=[{'all':!![]}];}_0xe6b790=_[_0x99ec('0x35')]({},_0xe6b790,_0x19db96[_0x99ec('0x38')]);return db[_0x99ec('0x24')]['find'](_0xe6b790)['then'](handleEntityNotFound(_0x5a017d,null))[_0x99ec('0x1f')](respondWithResult(_0x5a017d,null))[_0x99ec('0x3c')](handleError(_0x5a017d,null));};exports[_0x99ec('0x3e')]=function(_0x5f5720,_0xd8213){return db[_0x99ec('0x24')][_0x99ec('0x3e')](_0x5f5720[_0x99ec('0x3f')],{})[_0x99ec('0x1f')](respondWithResult(_0xd8213,0xc9))[_0x99ec('0x3c')](handleError(_0xd8213,null));};exports['update']=function(_0x11f44b,_0x78ea2f){if(_0x11f44b[_0x99ec('0x3f')]['id']){delete _0x11f44b[_0x99ec('0x3f')]['id'];}return db[_0x99ec('0x24')][_0x99ec('0x40')]({'where':{'id':_0x11f44b[_0x99ec('0x41')]['id']}})['then'](handleEntityNotFound(_0x78ea2f,null))[_0x99ec('0x1f')](saveUpdates(_0x11f44b['body'],null))[_0x99ec('0x1f')](respondWithResult(_0x78ea2f,null))[_0x99ec('0x3c')](handleError(_0x78ea2f,null));};exports[_0x99ec('0x42')]=function(_0x58b555,_0x2e4f18){return db[_0x99ec('0x24')]['find']({'where':{'id':_0x58b555[_0x99ec('0x41')]['id']}})[_0x99ec('0x1f')](handleEntityNotFound(_0x2e4f18,null))['then'](removeEntity(_0x2e4f18,null))['catch'](handleError(_0x2e4f18,null));};
\ No newline at end of file
+var _0xdc9b=['then','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','update','destroy'];(function(_0x11865a,_0x279597){var _0x2aa36c=function(_0x32f9b4){while(--_0x32f9b4){_0x11865a['push'](_0x11865a['shift']());}};_0x2aa36c(++_0x279597);}(_0xdc9b,0x70));var _0xbdc9=function(_0x46a134,_0x2e3f67){_0x46a134=_0x46a134-0x0;var _0x3c4677=_0xdc9b[_0x46a134];return _0x3c4677;};'use strict';var emlformat=require(_0xbdc9('0x0'));var rimraf=require(_0xbdc9('0x1'));var zipdir=require(_0xbdc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdc9('0x3'));var moment=require(_0xbdc9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbdc9('0x5'));var path=require(_0xbdc9('0x6'));var sox=require('sox');var csv=require(_0xbdc9('0x7'));var ejs=require(_0xbdc9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbdc9('0x9'));var squel=require('squel');var crypto=require(_0xbdc9('0xa'));var jsforce=require(_0xbdc9('0xb'));var deskjs=require(_0xbdc9('0xc'));var toCsv=require(_0xbdc9('0x7'));var querystring=require(_0xbdc9('0xd'));var Papa=require(_0xbdc9('0xe'));var Redis=require(_0xbdc9('0xf'));var authService=require(_0xbdc9('0x10'));var qs=require(_0xbdc9('0x11'));var as=require(_0xbdc9('0x12'));var hardwareService=require(_0xbdc9('0x13'));var logger=require(_0xbdc9('0x14'))(_0xbdc9('0x15'));var utils=require(_0xbdc9('0x16'));var config=require(_0xbdc9('0x17'));var licenseUtil=require(_0xbdc9('0x18'));var db=require(_0xbdc9('0x19'))['db'];function respondWithStatusCode(_0x465acf,_0x12a807){_0x12a807=_0x12a807||0xcc;return function(_0x2784c1){if(_0x2784c1){return _0x465acf[_0xbdc9('0x1a')](_0x12a807);}return _0x465acf['status'](_0x12a807)[_0xbdc9('0x1b')]();};}function respondWithResult(_0x505617,_0x4b220e){_0x4b220e=_0x4b220e||0xc8;return function(_0x180f38){if(_0x180f38){return _0x505617[_0xbdc9('0x1c')](_0x4b220e)['json'](_0x180f38);}};}function respondWithFilteredResult(_0x2ace40,_0x386607){return function(_0x37e210){if(_0x37e210){var _0x18bd36=typeof _0x386607[_0xbdc9('0x1d')]===_0xbdc9('0x1e')&&typeof _0x386607['limit']==='undefined';var _0x1756e6=_0x37e210[_0xbdc9('0x1f')];var _0x32b094=_0x18bd36?0x0:_0x386607['offset'];var _0x4f60f4=_0x18bd36?_0x37e210[_0xbdc9('0x1f')]:_0x386607[_0xbdc9('0x1d')]+_0x386607['limit'];var _0x7d3d9f;if(_0x4f60f4>=_0x1756e6){_0x4f60f4=_0x1756e6;_0x7d3d9f=0xc8;}else{_0x7d3d9f=0xce;}_0x2ace40[_0xbdc9('0x1c')](_0x7d3d9f);return _0x2ace40[_0xbdc9('0x20')]('Content-Range',_0x32b094+'-'+_0x4f60f4+'/'+_0x1756e6)[_0xbdc9('0x21')](_0x37e210);}return null;};}function patchUpdates(_0x37e81f){return function(_0x2d4b57){try{jsonpatch[_0xbdc9('0x22')](_0x2d4b57,_0x37e81f,!![]);}catch(_0x35671a){return BPromise[_0xbdc9('0x23')](_0x35671a);}return _0x2d4b57['save']();};}function saveUpdates(_0x48f5a7,_0x2d9831){return function(_0x26f72){if(_0x26f72){return _0x26f72[_0xbdc9('0x24')](_0x48f5a7)['then'](function(_0x2604fb){return _0x2604fb;});}return null;};}function removeEntity(_0x1b24a7,_0x586c1d){return function(_0x715fa1){if(_0x715fa1){return _0x715fa1[_0xbdc9('0x25')]()[_0xbdc9('0x26')](function(){_0x1b24a7[_0xbdc9('0x1c')](0xcc)[_0xbdc9('0x1b')]();});}};}function handleEntityNotFound(_0x27c6c7,_0xdaffa9){return function(_0x41f103){if(!_0x41f103){_0x27c6c7[_0xbdc9('0x1a')](0x194);}return _0x41f103;};}function handleError(_0x58d243,_0x406014){_0x406014=_0x406014||0x1f4;return function(_0x1a1324){logger['error'](_0x1a1324[_0xbdc9('0x27')]);if(_0x1a1324[_0xbdc9('0x28')]){delete _0x1a1324[_0xbdc9('0x28')];}_0x58d243[_0xbdc9('0x1c')](_0x406014)[_0xbdc9('0x29')](_0x1a1324);};}exports[_0xbdc9('0x2a')]=function(_0x4b42ff,_0x1e1397){var _0x36b0dd={},_0x1cb43b={},_0x5338ea={'count':0x0,'rows':[]};var _0x5ba682=_['map'](db[_0xbdc9('0x2b')][_0xbdc9('0x2c')],function(_0x121629){return{'name':_0x121629[_0xbdc9('0x2d')],'type':_0x121629[_0xbdc9('0x2e')][_0xbdc9('0x2f')]};});_0x1cb43b['model']=_[_0xbdc9('0x30')](_0x5ba682,_0xbdc9('0x28'));_0x1cb43b[_0xbdc9('0x31')]=_[_0xbdc9('0x32')](_0x4b42ff['query']);_0x1cb43b[_0xbdc9('0x33')]=_[_0xbdc9('0x34')](_0x1cb43b[_0xbdc9('0x35')],_0x1cb43b[_0xbdc9('0x31')]);_0x36b0dd[_0xbdc9('0x36')]=_['intersection'](_0x1cb43b[_0xbdc9('0x35')],qs['fields'](_0x4b42ff[_0xbdc9('0x31')][_0xbdc9('0x37')]));_0x36b0dd[_0xbdc9('0x36')]=_0x36b0dd[_0xbdc9('0x36')][_0xbdc9('0x38')]?_0x36b0dd[_0xbdc9('0x36')]:_0x1cb43b[_0xbdc9('0x35')];if(!_0x4b42ff[_0xbdc9('0x31')][_0xbdc9('0x39')]('nolimit')){_0x36b0dd[_0xbdc9('0x3a')]=qs[_0xbdc9('0x3a')](_0x4b42ff['query'][_0xbdc9('0x3a')]);_0x36b0dd['offset']=qs['offset'](_0x4b42ff['query'][_0xbdc9('0x1d')]);}_0x36b0dd['order']=qs[_0xbdc9('0x3b')](_0x4b42ff['query'][_0xbdc9('0x3b')]);_0x36b0dd[_0xbdc9('0x3c')]=qs[_0xbdc9('0x33')](_[_0xbdc9('0x3d')](_0x4b42ff['query'],_0x1cb43b[_0xbdc9('0x33')]),_0x5ba682);if(_0x4b42ff['query'][_0xbdc9('0x3e')]){_0x36b0dd[_0xbdc9('0x3c')]=_['merge'](_0x36b0dd[_0xbdc9('0x3c')],{'$or':_['map'](_0x5ba682,function(_0x24927e){if(_0x24927e[_0xbdc9('0x2e')]!==_0xbdc9('0x3f')){var _0x35815f={};_0x35815f[_0x24927e[_0xbdc9('0x28')]]={'$like':'%'+_0x4b42ff[_0xbdc9('0x31')]['filter']+'%'};return _0x35815f;}})});}_0x36b0dd=_['merge']({},_0x36b0dd,_0x4b42ff[_0xbdc9('0x40')]);var _0x589698={'where':_0x36b0dd['where']};return db[_0xbdc9('0x2b')][_0xbdc9('0x1f')](_0x589698)[_0xbdc9('0x26')](function(_0x2211b7){_0x5338ea[_0xbdc9('0x1f')]=_0x2211b7;if(_0x4b42ff[_0xbdc9('0x31')]['includeAll']){_0x36b0dd[_0xbdc9('0x41')]=[{'all':!![]}];}return db[_0xbdc9('0x2b')][_0xbdc9('0x42')](_0x36b0dd);})[_0xbdc9('0x26')](function(_0x2b5a59){_0x5338ea[_0xbdc9('0x43')]=_0x2b5a59;return _0x5338ea;})[_0xbdc9('0x26')](respondWithFilteredResult(_0x1e1397,_0x36b0dd))['catch'](handleError(_0x1e1397,null));};exports[_0xbdc9('0x44')]=function(_0x1b7921,_0x53074d){var _0x4847b1={'raw':!![],'where':{'id':_0x1b7921[_0xbdc9('0x45')]['id']}},_0x537138={};_0x537138[_0xbdc9('0x35')]=_[_0xbdc9('0x32')](db['ZohoField'][_0xbdc9('0x2c')]);_0x537138[_0xbdc9('0x31')]=_[_0xbdc9('0x32')](_0x1b7921['query']);_0x537138[_0xbdc9('0x33')]=_[_0xbdc9('0x34')](_0x537138[_0xbdc9('0x35')],_0x537138[_0xbdc9('0x31')]);_0x4847b1[_0xbdc9('0x36')]=_['intersection'](_0x537138[_0xbdc9('0x35')],qs[_0xbdc9('0x37')](_0x1b7921[_0xbdc9('0x31')][_0xbdc9('0x37')]));_0x4847b1[_0xbdc9('0x36')]=_0x4847b1[_0xbdc9('0x36')][_0xbdc9('0x38')]?_0x4847b1['attributes']:_0x537138[_0xbdc9('0x35')];if(_0x1b7921[_0xbdc9('0x31')]['includeAll']){_0x4847b1[_0xbdc9('0x41')]=[{'all':!![]}];}_0x4847b1=_[_0xbdc9('0x46')]({},_0x4847b1,_0x1b7921[_0xbdc9('0x40')]);return db[_0xbdc9('0x2b')][_0xbdc9('0x47')](_0x4847b1)[_0xbdc9('0x26')](handleEntityNotFound(_0x53074d,null))[_0xbdc9('0x26')](respondWithResult(_0x53074d,null))[_0xbdc9('0x48')](handleError(_0x53074d,null));};exports[_0xbdc9('0x49')]=function(_0x2679a4,_0x4eceed){return db[_0xbdc9('0x2b')][_0xbdc9('0x49')](_0x2679a4[_0xbdc9('0x4a')],{})['then'](respondWithResult(_0x4eceed,0xc9))[_0xbdc9('0x48')](handleError(_0x4eceed,null));};exports['update']=function(_0x5793c0,_0x21ba50){if(_0x5793c0[_0xbdc9('0x4a')]['id']){delete _0x5793c0[_0xbdc9('0x4a')]['id'];}return db[_0xbdc9('0x2b')]['find']({'where':{'id':_0x5793c0[_0xbdc9('0x45')]['id']}})[_0xbdc9('0x26')](handleEntityNotFound(_0x21ba50,null))[_0xbdc9('0x26')](saveUpdates(_0x5793c0['body'],null))['then'](respondWithResult(_0x21ba50,null))[_0xbdc9('0x48')](handleError(_0x21ba50,null));};exports[_0xbdc9('0x25')]=function(_0x430ed2,_0x5e1621){return db[_0xbdc9('0x2b')][_0xbdc9('0x47')]({'where':{'id':_0x430ed2[_0xbdc9('0x45')]['id']}})[_0xbdc9('0x26')](handleEntityNotFound(_0x5e1621,null))[_0xbdc9('0x26')](removeEntity(_0x5e1621,null))[_0xbdc9('0x48')](handleError(_0x5e1621,null));};
\ No newline at end of file
index 7d3a902..a817e42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5464=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0x42dafe,_0x4cfe95){var _0x1f6512=function(_0x14b53d){while(--_0x14b53d){_0x42dafe['push'](_0x42dafe['shift']());}};_0x1f6512(++_0x4cfe95);}(_0x5464,0x15d));var _0x4546=function(_0x127f0f,_0x330652){_0x127f0f=_0x127f0f-0x0;var _0x37804e=_0x5464[_0x127f0f];return _0x37804e;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xc'),_0x4546('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x5204=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x5204,0xdf));var _0x4520=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x5204[_0x216d45];return _0xbaac0b;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[{'name':_0x4520('0xc'),'fields':['idField',_0x4520('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 49a8444..e9be7ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4468=['then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x4468,0xf1));var _0x8446=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x4468[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x8446('0x0'));var util=require('util');var moment=require(_0x8446('0x1'));var BPromise=require(_0x8446('0x2'));var rs=require(_0x8446('0x3'));var fs=require('fs');var Redis=require(_0x8446('0x4'));var db=require(_0x8446('0x5'))['db'];var utils=require(_0x8446('0x6'));var logger=require('../../config/logger')(_0x8446('0x7'));var config=require(_0x8446('0x8'));var jayson=require(_0x8446('0x9'));var client=jayson[_0x8446('0xa')][_0x8446('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e444b,_0x29cf9c,_0xfd6ef1){return new BPromise(function(_0x1e50e5,_0xa8f463){return client['request'](_0x2e444b,_0xfd6ef1)[_0x8446('0xc')](function(_0x1cdcab){logger['info'](_0x8446('0xd'),_0x29cf9c,_0x8446('0xe'));logger[_0x8446('0xf')](_0x8446('0x10'),_0x29cf9c,_0x8446('0xe'),JSON[_0x8446('0x11')](_0x1cdcab));if(_0x1cdcab['error']){if(_0x1cdcab[_0x8446('0x12')][_0x8446('0x13')]===0x1f4){logger[_0x8446('0x12')](_0x8446('0xd'),_0x29cf9c,_0x1cdcab['error']['message']);return _0xa8f463(_0x1cdcab['error'][_0x8446('0x14')]);}logger[_0x8446('0x12')](_0x8446('0xd'),_0x29cf9c,_0x1cdcab[_0x8446('0x12')][_0x8446('0x14')]);return _0x1e50e5(_0x1cdcab[_0x8446('0x12')]['message']);}else{logger['info'](_0x8446('0xd'),_0x29cf9c,_0x8446('0xe'));_0x1e50e5(_0x1cdcab[_0x8446('0x15')]['message']);}})[_0x8446('0x16')](function(_0x53cd85){logger['error'](_0x8446('0xd'),_0x29cf9c,_0x53cd85);_0xa8f463(_0x53cd85);});});}
\ No newline at end of file
+var _0x5675=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x5675,0x97));var _0x5567=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x5675[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var moment=require(_0x5567('0x2'));var BPromise=require(_0x5567('0x3'));var rs=require(_0x5567('0x4'));var fs=require('fs');var Redis=require(_0x5567('0x5'));var db=require(_0x5567('0x6'))['db'];var utils=require(_0x5567('0x7'));var logger=require(_0x5567('0x8'))(_0x5567('0x9'));var config=require(_0x5567('0xa'));var jayson=require(_0x5567('0xb'));var client=jayson['client'][_0x5567('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21b00f,_0x51843f,_0x63c720){return new BPromise(function(_0x2412cd,_0x19e193){return client[_0x5567('0xd')](_0x21b00f,_0x63c720)[_0x5567('0xe')](function(_0x93ddf3){logger[_0x5567('0xf')](_0x5567('0x10'),_0x51843f,_0x5567('0x11'));logger[_0x5567('0x12')](_0x5567('0x13'),_0x51843f,_0x5567('0x11'),JSON['stringify'](_0x93ddf3));if(_0x93ddf3[_0x5567('0x14')]){if(_0x93ddf3[_0x5567('0x14')][_0x5567('0x15')]===0x1f4){logger[_0x5567('0x14')]('ZohoField,\x20%s,\x20%s',_0x51843f,_0x93ddf3[_0x5567('0x14')][_0x5567('0x16')]);return _0x19e193(_0x93ddf3[_0x5567('0x14')][_0x5567('0x16')]);}logger[_0x5567('0x14')](_0x5567('0x10'),_0x51843f,_0x93ddf3[_0x5567('0x14')][_0x5567('0x16')]);return _0x2412cd(_0x93ddf3[_0x5567('0x14')][_0x5567('0x16')]);}else{logger[_0x5567('0xf')](_0x5567('0x10'),_0x51843f,_0x5567('0x11'));_0x2412cd(_0x93ddf3['result'][_0x5567('0x16')]);}})[_0x5567('0x17')](function(_0xa3f5b){logger[_0x5567('0x14')](_0x5567('0x10'),_0x51843f,_0xa3f5b);_0x19e193(_0xa3f5b);});});}
\ No newline at end of file
index 1e31e3b..7c10ca1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x414166,_0x5e87f3){var _0x373505=function(_0x1cd5b1){while(--_0x1cd5b1){_0x414166['push'](_0x414166['shift']());}};_0x373505(++_0x5e87f3);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index dd0481d..1f0689c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68fa=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x357398,_0x5727f9){var _0x561d9a=function(_0x5176c5){while(--_0x5176c5){_0x357398['push'](_0x357398['shift']());}};_0x561d9a(++_0x5727f9);}(_0x68fa,0x135));var _0xa68f=function(_0x466161,_0x29cc00){_0x466161=_0x466161-0x0;var _0x2f9c1d=_0x68fa[_0x466161];return _0x2f9c1d;};'use strict';var Sequelize=require(_0xa68f('0x0'));module[_0xa68f('0x1')]={'name':{'type':Sequelize[_0xa68f('0x2')],'allowNull':![],'unique':_0xa68f('0x3')},'version':{'type':Sequelize[_0xa68f('0x2')],'allowNull':![],'unique':_0xa68f('0x3')},'main':{'type':Sequelize[_0xa68f('0x2')],'defaultValue':_0xa68f('0x4')},'filename':{'type':Sequelize[_0xa68f('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa68f('0x2')]},'size':{'type':Sequelize[_0xa68f('0x5')]},'active':{'type':Sequelize[_0xa68f('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xa68f('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xa68f('0x7')},'description':{'type':Sequelize[_0xa68f('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa68f('0x2')]},'link':{'type':Sequelize[_0xa68f('0x2')],'defaultValue':'#'}};
\ No newline at end of file
+var _0x91d1=['unique_name_and_version','INTEGER','BOOLEAN','exports','STRING'];(function(_0x185e34,_0x1d8732){var _0x2e8d2b=function(_0x45bd65){while(--_0x45bd65){_0x185e34['push'](_0x185e34['shift']());}};_0x2e8d2b(++_0x1d8732);}(_0x91d1,0x17a));var _0x191d=function(_0x3905b1,_0x2bddb9){_0x3905b1=_0x3905b1-0x0;var _0xd4525f=_0x91d1[_0x3905b1];return _0xd4525f;};'use strict';var Sequelize=require('sequelize');module[_0x191d('0x0')]={'name':{'type':Sequelize[_0x191d('0x1')],'allowNull':![],'unique':_0x191d('0x2')},'version':{'type':Sequelize[_0x191d('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x191d('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x191d('0x1')]},'path':{'type':Sequelize[_0x191d('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x191d('0x3')]},'active':{'type':Sequelize[_0x191d('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x191d('0x1')]},'state':{'type':Sequelize[_0x191d('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}};
\ No newline at end of file
index 619605f..9e59379 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x1967,0x173));var _0x7196=function(_0x4d0129,_0x375103){_0x4d0129=_0x4d0129-0x0;var _0x36c191=_0x1967[_0x4d0129];return _0x36c191;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));};
\ No newline at end of file
+var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x92cb12,_0x275b21){var _0x15eae8=function(_0x417536){while(--_0x417536){_0x92cb12['push'](_0x92cb12['shift']());}};_0x15eae8(++_0x275b21);}(_0xacf4,0xe7));var _0x4acf=function(_0x506739,_0x30fb31){_0x506739=_0x506739-0x0;var _0x58e6fa=_0xacf4[_0x506739];return _0x58e6fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['Integration'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};
\ No newline at end of file
index f67838c..82519ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8303=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','integrations','lodash','util','../../config/logger'];(function(_0xe34491,_0x325ded){var _0x51d3d1=function(_0x6961bd){while(--_0x6961bd){_0xe34491['push'](_0xe34491['shift']());}};_0x51d3d1(++_0x325ded);}(_0x8303,0x11b));var _0x3830=function(_0x10d0bb,_0x270533){_0x10d0bb=_0x10d0bb-0x0;var _0x272841=_0x8303[_0x10d0bb];return _0x272841;};'use strict';var _=require(_0x3830('0x0'));var util=require(_0x3830('0x1'));var logger=require(_0x3830('0x2'))(_0x3830('0x3'));var moment=require(_0x3830('0x4'));var BPromise=require(_0x3830('0x5'));var rp=require(_0x3830('0x6'));var fs=require('fs');var path=require(_0x3830('0x7'));var rimraf=require(_0x3830('0x8'));var config=require(_0x3830('0x9'));var attributes=require(_0x3830('0xa'));module[_0x3830('0xb')]=function(_0x4982de,_0x55e934){return _0x4982de['define']('Integration',attributes,{'tableName':_0x3830('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfeda=['bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util'];(function(_0x4d504e,_0x265d27){var _0x3737bb=function(_0x2a22f9){while(--_0x2a22f9){_0x4d504e['push'](_0x4d504e['shift']());}};_0x3737bb(++_0x265d27);}(_0xfeda,0x6c));var _0xafed=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xfeda[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xafed('0x0'));var util=require(_0xafed('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xafed('0x2'));var rp=require(_0xafed('0x3'));var fs=require('fs');var path=require(_0xafed('0x4'));var rimraf=require(_0xafed('0x5'));var config=require('../../config/environment');var attributes=require(_0xafed('0x6'));module[_0xafed('0x7')]=function(_0x2f207c,_0x4d7552){return _0x2f207c[_0xafed('0x8')](_0xafed('0x9'),attributes,{'tableName':_0xafed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 234764b..5f19caf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x4b2c91,_0x146e75){var _0x39dea8=function(_0x48c6d0){while(--_0x48c6d0){_0x4b2c91['push'](_0x4b2c91['shift']());}};_0x39dea8(++_0x146e75);}(_0x1a85,0x178));var _0x51a8=function(_0x5674fc,_0x2b623b){_0x5674fc=_0x5674fc-0x0;var _0x2444a5=_0x1a85[_0x5674fc];return _0x2444a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}
\ No newline at end of file
+var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4fcce9,_0x34391a){var _0x1d5a34=function(_0x566046){while(--_0x566046){_0x4fcce9['push'](_0x4fcce9['shift']());}};_0x1d5a34(++_0x34391a);}(_0x2ef3,0xba));var _0x32ef=function(_0x13c98e,_0x849b39){_0x13c98e=_0x13c98e-0x0;var _0x545230=_0x2ef3[_0x13c98e];return _0x545230;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}
\ No newline at end of file
index d5c827e..97bd8aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x310b5c,_0x1db201){var _0x396e7e=function(_0x309033){while(--_0x309033){_0x310b5c['push'](_0x310b5c['shift']());}};_0x396e7e(++_0x1db201);}(_0x4975,0x86));var _0x5497=function(_0x39536e,_0x103efc){_0x39536e=_0x39536e-0x0;var _0x3debd1=_0x4975[_0x39536e];return _0x3debd1;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router;
\ No newline at end of file
+var _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x2db4c1,_0x3d87fd){var _0x3fe1c3=function(_0x85a2d2){while(--_0x85a2d2){_0x2db4c1['push'](_0x2db4c1['shift']());}};_0x3fe1c3(++_0x3d87fd);}(_0x1a85,0x178));var _0x51a8=function(_0x58b900,_0x4067f4){_0x58b900=_0x58b900-0x0;var _0x142565=_0x1a85[_0x58b900];return _0x142565;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router;
\ No newline at end of file
index bf8c534..0eb4cb1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91a9=['ENUM','SENT','SENDING','RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x91a9,0x7c));var _0x991a=function(_0x1718ea,_0x5bef73){_0x1718ea=_0x1718ea-0x0;var _0x1e9811=_0x91a9[_0x1718ea];return _0x1e9811;};'use strict';var Sequelize=require('sequelize');module[_0x991a('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x991a('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x991a('0x1')]},'integrationId':{'type':Sequelize[_0x991a('0x2')]},'contacts':{'type':Sequelize[_0x991a('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x991a('0x1')]},'calleridname':{'type':Sequelize[_0x991a('0x1')]},'queue':{'type':Sequelize[_0x991a('0x1')]},'interface':{'type':Sequelize[_0x991a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x991a('0x3')]},'holdtime':{'type':Sequelize[_0x991a('0x2')]},'agentcomplete':{'type':Sequelize[_0x991a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x991a('0x3')]},'talktime':{'type':Sequelize[_0x991a('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x991a('0x2')]},'reason':{'type':Sequelize[_0x991a('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x991a('0x3')]},'agentdump':{'type':Sequelize[_0x991a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x991a('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x991a('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x991a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x991a('0x1')]},'connectedlinename':{'type':Sequelize[_0x991a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x991a('0x1')]},'context':{'type':Sequelize[_0x991a('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x991a('0x1')]},'destchannel':{'type':Sequelize[_0x991a('0x1')]},'destchannelstate':{'type':Sequelize[_0x991a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x991a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x991a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x991a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x991a('0x1')]},'destlanguage':{'type':Sequelize[_0x991a('0x1')]},'destaccountcode':{'type':Sequelize[_0x991a('0x1')]},'destcontext':{'type':Sequelize[_0x991a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x991a('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x991a('0x1')]},'subject':{'type':Sequelize[_0x991a('0x1')]},'from':{'type':Sequelize[_0x991a('0x1')]},'to':{'type':Sequelize[_0x991a('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x991a('0x5')]},'html':{'type':Sequelize[_0x991a('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x991a('0x6')](_0x991a('0x7'),_0x991a('0x8'),_0x991a('0x9'),'FAILED')},'url':{'type':Sequelize[_0x991a('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x991a('0x1')]},'projectId':{'type':Sequelize[_0x991a('0x2')]}};
\ No newline at end of file
+var _0x37eb=['INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','exports','STRING','DATE'];(function(_0x45fca1,_0x4786c7){var _0x3e3cf1=function(_0x13be67){while(--_0x13be67){_0x45fca1['push'](_0x45fca1['shift']());}};_0x3e3cf1(++_0x4786c7);}(_0x37eb,0x7f));var _0xb37e=function(_0x2bdbcc,_0x2c698b){_0x2bdbcc=_0x2bdbcc-0x0;var _0x798c3f=_0x37eb[_0x2bdbcc];return _0x798c3f;};'use strict';var Sequelize=require('sequelize');module[_0xb37e('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xb37e('0x1')]},'exitStatus':{'type':Sequelize[_0xb37e('0x1')]},'ticketId':{'type':Sequelize[_0xb37e('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb37e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb37e('0x1')]},'interface':{'type':Sequelize[_0xb37e('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xb37e('0x2')]},'agentconnectAt':{'type':Sequelize[_0xb37e('0x2')]},'holdtime':{'type':Sequelize[_0xb37e('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xb37e('0x3')]},'agentacw':{'type':Sequelize[_0xb37e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb37e('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xb37e('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb37e('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb37e('0x1')]},'channelstate':{'type':Sequelize[_0xb37e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb37e('0x1')]},'connectedlinenum':{'type':Sequelize[_0xb37e('0x1')]},'connectedlinename':{'type':Sequelize[_0xb37e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb37e('0x1')]},'context':{'type':Sequelize[_0xb37e('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb37e('0x1')]},'destchannel':{'type':Sequelize[_0xb37e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb37e('0x1')]},'destcalleridname':{'type':Sequelize[_0xb37e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb37e('0x1')]},'destlanguage':{'type':Sequelize[_0xb37e('0x1')]},'destaccountcode':{'type':Sequelize[_0xb37e('0x1')]},'destcontext':{'type':Sequelize[_0xb37e('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb37e('0x1')]},'destuniqueid':{'type':Sequelize[_0xb37e('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb37e('0x1')]},'subject':{'type':Sequelize[_0xb37e('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb37e('0x1')]},'cc':{'type':Sequelize[_0xb37e('0x1')]},'attachment':{'type':Sequelize[_0xb37e('0x5')]},'html':{'type':Sequelize[_0xb37e('0x5')]},'text':{'type':Sequelize[_0xb37e('0x5')]},'status':{'type':Sequelize[_0xb37e('0x6')](_0xb37e('0x7'),_0xb37e('0x8'),'RECEIVED',_0xb37e('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xb37e('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xb37e('0x3')]}};
\ No newline at end of file
index 3cad844..30b773b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b9f=['Content-Range','reject','save','update','then','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x36284b,_0x2b7436){var _0x23c34a=function(_0x14f579){while(--_0x14f579){_0x36284b['push'](_0x36284b['shift']());}};_0x23c34a(++_0x2b7436);}(_0x7b9f,0x106));var _0xf7b9=function(_0x537e50,_0x1c676d){_0x537e50=_0x537e50-0x0;var _0x42f01f=_0x7b9f[_0x537e50];return _0x42f01f;};'use strict';var emlformat=require(_0xf7b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7b9('0x1'));var jsonpatch=require(_0xf7b9('0x2'));var rp=require(_0xf7b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf7b9('0x4'));var util=require(_0xf7b9('0x5'));var path=require(_0xf7b9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7b9('0x7'));var fs=require('fs');var fs_extra=require(_0xf7b9('0x8'));var _=require(_0xf7b9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf7b9('0xa'));var deskjs=require(_0xf7b9('0xb'));var toCsv=require(_0xf7b9('0xc'));var querystring=require(_0xf7b9('0xd'));var Papa=require(_0xf7b9('0xe'));var Redis=require(_0xf7b9('0xf'));var authService=require(_0xf7b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf7b9('0x11'));var hardwareService=require(_0xf7b9('0x12'));var logger=require(_0xf7b9('0x13'))(_0xf7b9('0x14'));var utils=require(_0xf7b9('0x15'));var config=require(_0xf7b9('0x16'));var licenseUtil=require(_0xf7b9('0x17'));var db=require(_0xf7b9('0x18'))['db'];function respondWithStatusCode(_0x53ef71,_0x7809ad){_0x7809ad=_0x7809ad||0xcc;return function(_0x30d323){if(_0x30d323){return _0x53ef71[_0xf7b9('0x19')](_0x7809ad);}return _0x53ef71[_0xf7b9('0x1a')](_0x7809ad)[_0xf7b9('0x1b')]();};}function respondWithResult(_0x290f67,_0x16f3b3){_0x16f3b3=_0x16f3b3||0xc8;return function(_0x5dec8a){if(_0x5dec8a){return _0x290f67[_0xf7b9('0x1a')](_0x16f3b3)[_0xf7b9('0x1c')](_0x5dec8a);}};}function respondWithFilteredResult(_0x92f483,_0x4ac940){return function(_0x21f8c5){if(_0x21f8c5){var _0x3e610e=typeof _0x4ac940[_0xf7b9('0x1d')]===_0xf7b9('0x1e')&&typeof _0x4ac940[_0xf7b9('0x1f')]===_0xf7b9('0x1e');var _0x2c7bfe=_0x21f8c5[_0xf7b9('0x20')];var _0x2c1978=_0x3e610e?0x0:_0x4ac940['offset'];var _0x2f2106=_0x3e610e?_0x21f8c5[_0xf7b9('0x20')]:_0x4ac940['offset']+_0x4ac940[_0xf7b9('0x1f')];var _0x518df4;if(_0x2f2106>=_0x2c7bfe){_0x2f2106=_0x2c7bfe;_0x518df4=0xc8;}else{_0x518df4=0xce;}_0x92f483[_0xf7b9('0x1a')](_0x518df4);return _0x92f483[_0xf7b9('0x21')](_0xf7b9('0x22'),_0x2c1978+'-'+_0x2f2106+'/'+_0x2c7bfe)[_0xf7b9('0x1c')](_0x21f8c5);}return null;};}function patchUpdates(_0x189f64){return function(_0x5380b3){try{jsonpatch['apply'](_0x5380b3,_0x189f64,!![]);}catch(_0x12dd14){return BPromise[_0xf7b9('0x23')](_0x12dd14);}return _0x5380b3[_0xf7b9('0x24')]();};}function saveUpdates(_0x53a8b8,_0x23feab){return function(_0x700445){if(_0x700445){return _0x700445[_0xf7b9('0x25')](_0x53a8b8)[_0xf7b9('0x26')](function(_0x2bc557){return _0x2bc557;});}return null;};}function removeEntity(_0xc367e0,_0x4b423e){return function(_0x31e421){if(_0x31e421){return _0x31e421['destroy']()[_0xf7b9('0x26')](function(){_0xc367e0[_0xf7b9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0faf,_0x2f3d80){return function(_0x18ff8d){if(!_0x18ff8d){_0x3d0faf[_0xf7b9('0x19')](0x194);}return _0x18ff8d;};}function handleError(_0x58f174,_0x527132){_0x527132=_0x527132||0x1f4;return function(_0x2c3ff0){logger[_0xf7b9('0x27')](_0x2c3ff0[_0xf7b9('0x28')]);if(_0x2c3ff0['name']){delete _0x2c3ff0[_0xf7b9('0x29')];}_0x58f174[_0xf7b9('0x1a')](_0x527132)['send'](_0x2c3ff0);};}exports[_0xf7b9('0x2a')]=function(_0x5c69bc,_0xec3b46){var _0x1db135={},_0x1e7691={},_0x4ab849={'count':0x0,'rows':[]};var _0x4df3b5=_[_0xf7b9('0x2b')](db[_0xf7b9('0x2c')][_0xf7b9('0x2d')],function(_0x5700c2){return{'name':_0x5700c2[_0xf7b9('0x2e')],'type':_0x5700c2['type'][_0xf7b9('0x2f')]};});_0x1e7691[_0xf7b9('0x30')]=_[_0xf7b9('0x2b')](_0x4df3b5,'name');_0x1e7691[_0xf7b9('0x31')]=_[_0xf7b9('0x32')](_0x5c69bc['query']);_0x1e7691[_0xf7b9('0x33')]=_[_0xf7b9('0x34')](_0x1e7691[_0xf7b9('0x30')],_0x1e7691[_0xf7b9('0x31')]);_0x1db135[_0xf7b9('0x35')]=_['intersection'](_0x1e7691[_0xf7b9('0x30')],qs[_0xf7b9('0x36')](_0x5c69bc['query'][_0xf7b9('0x36')]));_0x1db135[_0xf7b9('0x35')]=_0x1db135['attributes'][_0xf7b9('0x37')]?_0x1db135[_0xf7b9('0x35')]:_0x1e7691[_0xf7b9('0x30')];if(!_0x5c69bc[_0xf7b9('0x31')][_0xf7b9('0x38')](_0xf7b9('0x39'))){_0x1db135[_0xf7b9('0x1f')]=qs[_0xf7b9('0x1f')](_0x5c69bc[_0xf7b9('0x31')][_0xf7b9('0x1f')]);_0x1db135[_0xf7b9('0x1d')]=qs[_0xf7b9('0x1d')](_0x5c69bc[_0xf7b9('0x31')]['offset']);}_0x1db135['order']=qs['sort'](_0x5c69bc['query']['sort']);_0x1db135[_0xf7b9('0x3a')]=qs['filters'](_[_0xf7b9('0x3b')](_0x5c69bc[_0xf7b9('0x31')],_0x1e7691[_0xf7b9('0x33')]),_0x4df3b5);if(_0x5c69bc[_0xf7b9('0x31')][_0xf7b9('0x3c')]){_0x1db135[_0xf7b9('0x3a')]=_['merge'](_0x1db135['where'],{'$or':_[_0xf7b9('0x2b')](_0x4df3b5,function(_0xa9d229){if(_0xa9d229['type']!==_0xf7b9('0x3d')){var _0x4a3bde={};_0x4a3bde[_0xa9d229[_0xf7b9('0x29')]]={'$like':'%'+_0x5c69bc[_0xf7b9('0x31')]['filter']+'%'};return _0x4a3bde;}})});}_0x1db135=_[_0xf7b9('0x3e')]({},_0x1db135,_0x5c69bc[_0xf7b9('0x3f')]);var _0xc9cda8={'where':_0x1db135[_0xf7b9('0x3a')]};return db[_0xf7b9('0x2c')][_0xf7b9('0x20')](_0xc9cda8)[_0xf7b9('0x26')](function(_0x4ed2b4){_0x4ab849['count']=_0x4ed2b4;if(_0x5c69bc[_0xf7b9('0x31')][_0xf7b9('0x40')]){_0x1db135['include']=[{'all':!![]}];}return db[_0xf7b9('0x2c')]['findAll'](_0x1db135);})[_0xf7b9('0x26')](function(_0x4f601e){_0x4ab849[_0xf7b9('0x41')]=_0x4f601e;return _0x4ab849;})['then'](respondWithFilteredResult(_0xec3b46,_0x1db135))[_0xf7b9('0x42')](handleError(_0xec3b46,null));};exports['show']=function(_0x2efd75,_0x39a87d){var _0x51b603={'raw':![],'where':{'id':_0x2efd75[_0xf7b9('0x43')]['id']}},_0x3db9f4={};_0x3db9f4[_0xf7b9('0x30')]=_['keys'](db[_0xf7b9('0x2c')][_0xf7b9('0x2d')]);_0x3db9f4[_0xf7b9('0x31')]=_['keys'](_0x2efd75[_0xf7b9('0x31')]);_0x3db9f4[_0xf7b9('0x33')]=_['intersection'](_0x3db9f4[_0xf7b9('0x30')],_0x3db9f4[_0xf7b9('0x31')]);_0x51b603[_0xf7b9('0x35')]=_[_0xf7b9('0x34')](_0x3db9f4[_0xf7b9('0x30')],qs[_0xf7b9('0x36')](_0x2efd75['query'][_0xf7b9('0x36')]));_0x51b603[_0xf7b9('0x35')]=_0x51b603[_0xf7b9('0x35')][_0xf7b9('0x37')]?_0x51b603[_0xf7b9('0x35')]:_0x3db9f4[_0xf7b9('0x30')];if(_0x2efd75[_0xf7b9('0x31')][_0xf7b9('0x40')]){_0x51b603[_0xf7b9('0x44')]=[{'all':!![]}];}_0x51b603=_[_0xf7b9('0x3e')]({},_0x51b603,_0x2efd75[_0xf7b9('0x3f')]);return db['IntegrationReport'][_0xf7b9('0x45')](_0x51b603)[_0xf7b9('0x26')](handleEntityNotFound(_0x39a87d,null))[_0xf7b9('0x26')](respondWithResult(_0x39a87d,null))[_0xf7b9('0x42')](handleError(_0x39a87d,null));};exports[_0xf7b9('0x46')]=function(_0x486759,_0x3f531a){return db['IntegrationReport'][_0xf7b9('0x46')](_0x486759[_0xf7b9('0x47')],{})[_0xf7b9('0x26')](respondWithResult(_0x3f531a,0xc9))[_0xf7b9('0x42')](handleError(_0x3f531a,null));};exports[_0xf7b9('0x25')]=function(_0x5b8506,_0x48dd1d){if(_0x5b8506[_0xf7b9('0x47')]['id']){delete _0x5b8506[_0xf7b9('0x47')]['id'];}return db['IntegrationReport'][_0xf7b9('0x45')]({'where':{'id':_0x5b8506[_0xf7b9('0x43')]['id']}})[_0xf7b9('0x26')](handleEntityNotFound(_0x48dd1d,null))['then'](saveUpdates(_0x5b8506[_0xf7b9('0x47')],null))[_0xf7b9('0x26')](respondWithResult(_0x48dd1d,null))['catch'](handleError(_0x48dd1d,null));};exports[_0xf7b9('0x48')]=function(_0x18790b,_0x1c28ea){return db[_0xf7b9('0x2c')][_0xf7b9('0x45')]({'where':{'id':_0x18790b[_0xf7b9('0x43')]['id']}})[_0xf7b9('0x26')](handleEntityNotFound(_0x1c28ea,null))[_0xf7b9('0x26')](removeEntity(_0x1c28ea,null))['catch'](handleError(_0x1c28ea,null));};exports[_0xf7b9('0x49')]=function(_0x3cfa40,_0x1ddd3e){return db['IntegrationReport'][_0xf7b9('0x49')]()[_0xf7b9('0x26')](respondWithResult(_0x1ddd3e,null))[_0xf7b9('0x42')](handleError(_0x1ddd3e,null));};
\ No newline at end of file
+var _0x9c04=['../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','params','filters','fields','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3ed2ac,_0x4b26c8){var _0x3596ff=function(_0x24cfe5){while(--_0x24cfe5){_0x3ed2ac['push'](_0x3ed2ac['shift']());}};_0x3596ff(++_0x4b26c8);}(_0x9c04,0xd4));var _0x49c0=function(_0x4ea571,_0x524bc2){_0x4ea571=_0x4ea571-0x0;var _0x122eba=_0x9c04[_0x4ea571];return _0x122eba;};'use strict';var emlformat=require(_0x49c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49c0('0x1'));var jsonpatch=require(_0x49c0('0x2'));var rp=require('request-promise');var moment=require(_0x49c0('0x3'));var BPromise=require(_0x49c0('0x4'));var Mustache=require(_0x49c0('0x5'));var util=require(_0x49c0('0x6'));var path=require('path');var sox=require(_0x49c0('0x7'));var csv=require('to-csv');var ejs=require(_0x49c0('0x8'));var fs=require('fs');var fs_extra=require(_0x49c0('0x9'));var _=require(_0x49c0('0xa'));var squel=require('squel');var crypto=require(_0x49c0('0xb'));var jsforce=require(_0x49c0('0xc'));var deskjs=require(_0x49c0('0xd'));var toCsv=require(_0x49c0('0xe'));var querystring=require(_0x49c0('0xf'));var Papa=require('papaparse');var Redis=require(_0x49c0('0x10'));var authService=require(_0x49c0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x49c0('0x12'));var hardwareService=require(_0x49c0('0x13'));var logger=require(_0x49c0('0x14'))(_0x49c0('0x15'));var utils=require(_0x49c0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x49c0('0x17'));var db=require(_0x49c0('0x18'))['db'];function respondWithStatusCode(_0xa0e35b,_0xb7e45a){_0xb7e45a=_0xb7e45a||0xcc;return function(_0x33811e){if(_0x33811e){return _0xa0e35b['sendStatus'](_0xb7e45a);}return _0xa0e35b[_0x49c0('0x19')](_0xb7e45a)[_0x49c0('0x1a')]();};}function respondWithResult(_0x261924,_0x90beea){_0x90beea=_0x90beea||0xc8;return function(_0x19bd72){if(_0x19bd72){return _0x261924[_0x49c0('0x19')](_0x90beea)[_0x49c0('0x1b')](_0x19bd72);}};}function respondWithFilteredResult(_0xd15543,_0x5373d7){return function(_0x56dd72){if(_0x56dd72){var _0x2060fc=typeof _0x5373d7['offset']==='undefined'&&typeof _0x5373d7['limit']==='undefined';var _0x5de1b9=_0x56dd72[_0x49c0('0x1c')];var _0x258d92=_0x2060fc?0x0:_0x5373d7['offset'];var _0x15d024=_0x2060fc?_0x56dd72[_0x49c0('0x1c')]:_0x5373d7[_0x49c0('0x1d')]+_0x5373d7['limit'];var _0x25b2a3;if(_0x15d024>=_0x5de1b9){_0x15d024=_0x5de1b9;_0x25b2a3=0xc8;}else{_0x25b2a3=0xce;}_0xd15543[_0x49c0('0x19')](_0x25b2a3);return _0xd15543[_0x49c0('0x1e')](_0x49c0('0x1f'),_0x258d92+'-'+_0x15d024+'/'+_0x5de1b9)[_0x49c0('0x1b')](_0x56dd72);}return null;};}function patchUpdates(_0xcbf0d9){return function(_0x5d3cc4){try{jsonpatch['apply'](_0x5d3cc4,_0xcbf0d9,!![]);}catch(_0x180ff7){return BPromise[_0x49c0('0x20')](_0x180ff7);}return _0x5d3cc4[_0x49c0('0x21')]();};}function saveUpdates(_0x3b3b99,_0x12f3c8){return function(_0x51d258){if(_0x51d258){return _0x51d258[_0x49c0('0x22')](_0x3b3b99)['then'](function(_0x3730bd){return _0x3730bd;});}return null;};}function removeEntity(_0x1c13e4,_0x4a5f45){return function(_0xbc00da){if(_0xbc00da){return _0xbc00da[_0x49c0('0x23')]()['then'](function(){_0x1c13e4['status'](0xcc)[_0x49c0('0x1a')]();});}};}function handleEntityNotFound(_0x51b979,_0x26bf7b){return function(_0x43e862){if(!_0x43e862){_0x51b979[_0x49c0('0x24')](0x194);}return _0x43e862;};}function handleError(_0x5d4583,_0x216b2f){_0x216b2f=_0x216b2f||0x1f4;return function(_0x490168){logger[_0x49c0('0x25')](_0x490168[_0x49c0('0x26')]);if(_0x490168[_0x49c0('0x27')]){delete _0x490168[_0x49c0('0x27')];}_0x5d4583[_0x49c0('0x19')](_0x216b2f)[_0x49c0('0x28')](_0x490168);};}exports[_0x49c0('0x29')]=function(_0x5019e3,_0x4d6198){var _0x12ac50={},_0x7bf1c9={},_0xb643b2={'count':0x0,'rows':[]};var _0x511ebc=_[_0x49c0('0x2a')](db[_0x49c0('0x2b')][_0x49c0('0x2c')],function(_0x3640b2){return{'name':_0x3640b2[_0x49c0('0x2d')],'type':_0x3640b2[_0x49c0('0x2e')]['key']};});_0x7bf1c9[_0x49c0('0x2f')]=_['map'](_0x511ebc,_0x49c0('0x27'));_0x7bf1c9[_0x49c0('0x30')]=_[_0x49c0('0x31')](_0x5019e3[_0x49c0('0x30')]);_0x7bf1c9['filters']=_[_0x49c0('0x32')](_0x7bf1c9[_0x49c0('0x2f')],_0x7bf1c9[_0x49c0('0x30')]);_0x12ac50[_0x49c0('0x33')]=_[_0x49c0('0x32')](_0x7bf1c9[_0x49c0('0x2f')],qs['fields'](_0x5019e3[_0x49c0('0x30')]['fields']));_0x12ac50[_0x49c0('0x33')]=_0x12ac50[_0x49c0('0x33')][_0x49c0('0x34')]?_0x12ac50[_0x49c0('0x33')]:_0x7bf1c9[_0x49c0('0x2f')];if(!_0x5019e3[_0x49c0('0x30')][_0x49c0('0x35')](_0x49c0('0x36'))){_0x12ac50[_0x49c0('0x37')]=qs[_0x49c0('0x37')](_0x5019e3[_0x49c0('0x30')][_0x49c0('0x37')]);_0x12ac50[_0x49c0('0x1d')]=qs[_0x49c0('0x1d')](_0x5019e3['query']['offset']);}_0x12ac50[_0x49c0('0x38')]=qs[_0x49c0('0x39')](_0x5019e3[_0x49c0('0x30')][_0x49c0('0x39')]);_0x12ac50[_0x49c0('0x3a')]=qs['filters'](_[_0x49c0('0x3b')](_0x5019e3[_0x49c0('0x30')],_0x7bf1c9['filters']),_0x511ebc);if(_0x5019e3[_0x49c0('0x30')][_0x49c0('0x3c')]){_0x12ac50['where']=_[_0x49c0('0x3d')](_0x12ac50[_0x49c0('0x3a')],{'$or':_['map'](_0x511ebc,function(_0x4bc6ea){if(_0x4bc6ea[_0x49c0('0x2e')]!==_0x49c0('0x3e')){var _0x1afbce={};_0x1afbce[_0x4bc6ea[_0x49c0('0x27')]]={'$like':'%'+_0x5019e3[_0x49c0('0x30')][_0x49c0('0x3c')]+'%'};return _0x1afbce;}})});}_0x12ac50=_[_0x49c0('0x3d')]({},_0x12ac50,_0x5019e3['options']);var _0x36f1c1={'where':_0x12ac50[_0x49c0('0x3a')]};return db['IntegrationReport']['count'](_0x36f1c1)[_0x49c0('0x3f')](function(_0x2d9f0a){_0xb643b2[_0x49c0('0x1c')]=_0x2d9f0a;if(_0x5019e3[_0x49c0('0x30')][_0x49c0('0x40')]){_0x12ac50[_0x49c0('0x41')]=[{'all':!![]}];}return db[_0x49c0('0x2b')][_0x49c0('0x42')](_0x12ac50);})[_0x49c0('0x3f')](function(_0xe2a46f){_0xb643b2[_0x49c0('0x43')]=_0xe2a46f;return _0xb643b2;})[_0x49c0('0x3f')](respondWithFilteredResult(_0x4d6198,_0x12ac50))[_0x49c0('0x44')](handleError(_0x4d6198,null));};exports[_0x49c0('0x45')]=function(_0x2dcf88,_0x12d901){var _0x21c83a={'raw':![],'where':{'id':_0x2dcf88[_0x49c0('0x46')]['id']}},_0x37fc30={};_0x37fc30[_0x49c0('0x2f')]=_[_0x49c0('0x31')](db[_0x49c0('0x2b')]['rawAttributes']);_0x37fc30[_0x49c0('0x30')]=_[_0x49c0('0x31')](_0x2dcf88['query']);_0x37fc30[_0x49c0('0x47')]=_[_0x49c0('0x32')](_0x37fc30['model'],_0x37fc30[_0x49c0('0x30')]);_0x21c83a[_0x49c0('0x33')]=_[_0x49c0('0x32')](_0x37fc30[_0x49c0('0x2f')],qs[_0x49c0('0x48')](_0x2dcf88[_0x49c0('0x30')][_0x49c0('0x48')]));_0x21c83a[_0x49c0('0x33')]=_0x21c83a[_0x49c0('0x33')][_0x49c0('0x34')]?_0x21c83a[_0x49c0('0x33')]:_0x37fc30[_0x49c0('0x2f')];if(_0x2dcf88[_0x49c0('0x30')][_0x49c0('0x40')]){_0x21c83a['include']=[{'all':!![]}];}_0x21c83a=_[_0x49c0('0x3d')]({},_0x21c83a,_0x2dcf88[_0x49c0('0x49')]);return db['IntegrationReport'][_0x49c0('0x4a')](_0x21c83a)[_0x49c0('0x3f')](handleEntityNotFound(_0x12d901,null))[_0x49c0('0x3f')](respondWithResult(_0x12d901,null))[_0x49c0('0x44')](handleError(_0x12d901,null));};exports[_0x49c0('0x4b')]=function(_0x15ec43,_0x3d81a8){return db[_0x49c0('0x2b')][_0x49c0('0x4b')](_0x15ec43[_0x49c0('0x4c')],{})[_0x49c0('0x3f')](respondWithResult(_0x3d81a8,0xc9))['catch'](handleError(_0x3d81a8,null));};exports[_0x49c0('0x22')]=function(_0x3c0f26,_0x2ef03d){if(_0x3c0f26[_0x49c0('0x4c')]['id']){delete _0x3c0f26[_0x49c0('0x4c')]['id'];}return db['IntegrationReport'][_0x49c0('0x4a')]({'where':{'id':_0x3c0f26[_0x49c0('0x46')]['id']}})[_0x49c0('0x3f')](handleEntityNotFound(_0x2ef03d,null))['then'](saveUpdates(_0x3c0f26['body'],null))[_0x49c0('0x3f')](respondWithResult(_0x2ef03d,null))['catch'](handleError(_0x2ef03d,null));};exports[_0x49c0('0x23')]=function(_0x427c20,_0x3b2c21){return db['IntegrationReport']['find']({'where':{'id':_0x427c20['params']['id']}})['then'](handleEntityNotFound(_0x3b2c21,null))['then'](removeEntity(_0x3b2c21,null))[_0x49c0('0x44')](handleError(_0x3b2c21,null));};exports[_0x49c0('0x4d')]=function(_0xd0ea4e,_0x1619a9){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x1619a9,null))[_0x49c0('0x44')](handleError(_0x1619a9,null));};
\ No newline at end of file
index dbab919..6d6d3ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7ea=['report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x38aa1d,_0x4faf18){var _0x2fb75d=function(_0x14ee14){while(--_0x14ee14){_0x38aa1d['push'](_0x38aa1d['shift']());}};_0x2fb75d(++_0x4faf18);}(_0xa7ea,0x7f));var _0xaa7e=function(_0x331783,_0x239a94){_0x331783=_0x331783-0x0;var _0x42b3d3=_0xa7ea[_0x331783];return _0x42b3d3;};'use strict';var _=require(_0xaa7e('0x0'));var util=require(_0xaa7e('0x1'));var logger=require(_0xaa7e('0x2'))('api');var moment=require(_0xaa7e('0x3'));var BPromise=require(_0xaa7e('0x4'));var rp=require(_0xaa7e('0x5'));var fs=require('fs');var path=require(_0xaa7e('0x6'));var rimraf=require(_0xaa7e('0x7'));var config=require(_0xaa7e('0x8'));var attributes=require(_0xaa7e('0x9'));module[_0xaa7e('0xa')]=function(_0x4b7a98,_0x5efb7a){return _0x4b7a98[_0xaa7e('0xb')](_0xaa7e('0xc'),attributes,{'tableName':_0xaa7e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6a56=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util'];(function(_0x6bada1,_0x280ed5){var _0x91fc3b=function(_0x1348b8){while(--_0x1348b8){_0x6bada1['push'](_0x6bada1['shift']());}};_0x91fc3b(++_0x280ed5);}(_0x6a56,0xec));var _0x66a5=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x6a56[_0x2718c7];return _0x59d89c;};'use strict';var _=require(_0x66a5('0x0'));var util=require(_0x66a5('0x1'));var logger=require(_0x66a5('0x2'))(_0x66a5('0x3'));var moment=require(_0x66a5('0x4'));var BPromise=require(_0x66a5('0x5'));var rp=require(_0x66a5('0x6'));var fs=require('fs');var path=require(_0x66a5('0x7'));var rimraf=require(_0x66a5('0x8'));var config=require(_0x66a5('0x9'));var attributes=require(_0x66a5('0xa'));module['exports']=function(_0x283a24,_0x104065){return _0x283a24[_0x66a5('0xb')](_0x66a5('0xc'),attributes,{'tableName':_0x66a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4df7796..5c92605 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x572438,_0x1b94fe){var _0xc6e9a7=function(_0x5b25a7){while(--_0x5b25a7){_0x572438['push'](_0x572438['shift']());}};_0xc6e9a7(++_0x1b94fe);}(_0x5fab,0x177));var _0xb5fa=function(_0x3f57db,_0x10e075){_0x3f57db=_0x3f57db-0x0;var _0x8cc430=_0x5fab[_0x3f57db];return _0x8cc430;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}
\ No newline at end of file
+var _0x6d38=['request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x250da3,_0x118122){var _0x5be8c7=function(_0x445100){while(--_0x445100){_0x250da3['push'](_0x250da3['shift']());}};_0x5be8c7(++_0x118122);}(_0x6d38,0x1ef));var _0x86d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6d38[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});}
\ No newline at end of file
index 2cac7f4..4d161be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x82f8=['get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','addInterval','post','/:id/sub_intervals/create_many','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x5afa3d,_0x54f4a3){var _0x539628=function(_0x3e5cfa){while(--_0x3e5cfa){_0x5afa3d['push'](_0x5afa3d['shift']());}};_0x539628(++_0x54f4a3);}(_0x82f8,0x157));var _0x882f=function(_0x37173e,_0x3d5a5c){_0x37173e=_0x37173e-0x0;var _0x28515f=_0x82f8[_0x37173e];return _0x28515f;};'use strict';var multer=require('multer');var util=require(_0x882f('0x0'));var path=require(_0x882f('0x1'));var timeout=require('connect-timeout');var express=require(_0x882f('0x2'));var router=express[_0x882f('0x3')]();var fs_extra=require(_0x882f('0x4'));var auth=require(_0x882f('0x5'));var interaction=require(_0x882f('0x6'));var config=require(_0x882f('0x7'));var controller=require(_0x882f('0x8'));router[_0x882f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x882f('0x9')](_0x882f('0xa'),auth[_0x882f('0xb')](),controller[_0x882f('0xc')]);router['get'](_0x882f('0xd'),auth['isAuthenticated'](),controller[_0x882f('0xe')]);router['post']('/',auth[_0x882f('0xb')](),controller['create']);router['post'](_0x882f('0xd'),auth[_0x882f('0xb')](),controller[_0x882f('0xf')]);router[_0x882f('0x10')](_0x882f('0x11'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x882f('0x12')](_0x882f('0xa'),auth[_0x882f('0xb')](),controller[_0x882f('0x13')]);router[_0x882f('0x14')](_0x882f('0xa'),auth[_0x882f('0xb')](),controller['destroy']);module[_0x882f('0x15')]=router;
\ No newline at end of file
+var _0x2899=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','getIntervals','post','isAuthenticated','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2899,0xfe));var _0x9289=function(_0x5e68db,_0x40b061){_0x5e68db=_0x5e68db-0x0;var _0x4297f4=_0x2899[_0x5e68db];return _0x4297f4;};'use strict';var multer=require(_0x9289('0x0'));var util=require(_0x9289('0x1'));var path=require(_0x9289('0x2'));var timeout=require(_0x9289('0x3'));var express=require(_0x9289('0x4'));var router=express[_0x9289('0x5')]();var fs_extra=require(_0x9289('0x6'));var auth=require(_0x9289('0x7'));var interaction=require(_0x9289('0x8'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x9289('0x9')]('/',auth['isAuthenticated'](),controller[_0x9289('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x9289('0xb')]);router[_0x9289('0xc')]('/',auth[_0x9289('0xd')](),controller[_0x9289('0xe')]);router[_0x9289('0xc')]('/:id/sub_intervals',auth[_0x9289('0xd')](),controller[_0x9289('0xf')]);router[_0x9289('0xc')](_0x9289('0x10'),auth[_0x9289('0xd')](),controller[_0x9289('0x11')]);router[_0x9289('0x12')](_0x9289('0x13'),auth[_0x9289('0xd')](),controller[_0x9289('0x14')]);router[_0x9289('0x15')]('/:id',auth[_0x9289('0xd')](),controller['destroy']);module[_0x9289('0x16')]=router;
\ No newline at end of file
index ade10ae..e4fa806 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1d59=['STRING'];(function(_0x3b7c9c,_0x3e09aa){var _0x5e397a=function(_0x41bd58){while(--_0x41bd58){_0x3b7c9c['push'](_0x3b7c9c['shift']());}};_0x5e397a(++_0x3e09aa);}(_0x1d59,0xa4));var _0x91d5=function(_0x1f68bb,_0x436ab5){_0x1f68bb=_0x1f68bb-0x0;var _0x3b3831=_0x1d59[_0x1f68bb];return _0x3b3831;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x91d5('0x0')]},'description':{'type':Sequelize[_0x91d5('0x0')]},'interval':{'type':Sequelize[_0x91d5('0x0')],'allowNull':!![]}};
\ No newline at end of file
+var _0x2611=['STRING','sequelize','exports'];(function(_0x69d91e,_0x12fec6){var _0x381436=function(_0x9a01a0){while(--_0x9a01a0){_0x69d91e['push'](_0x69d91e['shift']());}};_0x381436(++_0x12fec6);}(_0x2611,0x67));var _0x1261=function(_0x1ee1ce,_0x4c2ce2){_0x1ee1ce=_0x1ee1ce-0x0;var _0x3dcd9c=_0x2611[_0x1ee1ce];return _0x3dcd9c;};'use strict';var Sequelize=require(_0x1261('0x0'));module[_0x1261('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1261('0x2')]},'interval':{'type':Sequelize[_0x1261('0x2')],'allowNull':!![]}};
\ No newline at end of file
index c017a82..c14d894 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b88=['limit','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','Interval','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','sort','filters','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','nolimit','addIntervals','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1b88,0x1a2));var _0x81b8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x1b88[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x81b8('0x0'));var rimraf=require(_0x81b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x81b8('0x2'));var moment=require('moment');var BPromise=require(_0x81b8('0x3'));var Mustache=require('mustache');var util=require(_0x81b8('0x4'));var path=require(_0x81b8('0x5'));var sox=require(_0x81b8('0x6'));var csv=require(_0x81b8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81b8('0x8'));var _=require('lodash');var squel=require(_0x81b8('0x9'));var crypto=require(_0x81b8('0xa'));var jsforce=require(_0x81b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x81b8('0x7'));var querystring=require(_0x81b8('0xc'));var Papa=require(_0x81b8('0xd'));var Redis=require(_0x81b8('0xe'));var authService=require(_0x81b8('0xf'));var qs=require(_0x81b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81b8('0x11'));var logger=require(_0x81b8('0x12'))(_0x81b8('0x13'));var utils=require(_0x81b8('0x14'));var config=require(_0x81b8('0x15'));var licenseUtil=require(_0x81b8('0x16'));var db=require(_0x81b8('0x17'))['db'];var extensions=require(_0x81b8('0x18'));function respondWithStatusCode(_0x49b423,_0x5228ac){_0x5228ac=_0x5228ac||0xcc;return function(_0x479558){if(_0x479558){return _0x49b423[_0x81b8('0x19')](_0x5228ac);}return _0x49b423[_0x81b8('0x1a')](_0x5228ac)[_0x81b8('0x1b')]();};}function respondWithResult(_0x4e130a,_0x2e3aeb){_0x2e3aeb=_0x2e3aeb||0xc8;return function(_0x572d4a){if(_0x572d4a){return _0x4e130a[_0x81b8('0x1a')](_0x2e3aeb)[_0x81b8('0x1c')](_0x572d4a);}};}function respondWithFilteredResult(_0x2f7385,_0x32f55a){return function(_0x139b27){if(_0x139b27){var _0x554cc0=typeof _0x32f55a[_0x81b8('0x1d')]===_0x81b8('0x1e')&&typeof _0x32f55a['limit']===_0x81b8('0x1e');var _0x16ab9c=_0x139b27[_0x81b8('0x1f')];var _0x4b3e29=_0x554cc0?0x0:_0x32f55a[_0x81b8('0x1d')];var _0x428fe4=_0x554cc0?_0x139b27[_0x81b8('0x1f')]:_0x32f55a[_0x81b8('0x1d')]+_0x32f55a[_0x81b8('0x20')];var _0x38917f;if(_0x428fe4>=_0x16ab9c){_0x428fe4=_0x16ab9c;_0x38917f=0xc8;}else{_0x38917f=0xce;}_0x2f7385[_0x81b8('0x1a')](_0x38917f);return _0x2f7385[_0x81b8('0x21')]('Content-Range',_0x4b3e29+'-'+_0x428fe4+'/'+_0x16ab9c)[_0x81b8('0x1c')](_0x139b27);}return null;};}function patchUpdates(_0x2c4e4d){return function(_0x2438c6){try{jsonpatch[_0x81b8('0x22')](_0x2438c6,_0x2c4e4d,!![]);}catch(_0x102d87){return BPromise[_0x81b8('0x23')](_0x102d87);}return _0x2438c6[_0x81b8('0x24')]();};}function saveUpdates(_0x5a9aea,_0x147014){return function(_0x5bf187){if(_0x5bf187){return _0x5bf187[_0x81b8('0x25')](_0x5a9aea)['then'](function(_0x38939a){return _0x38939a;});}return null;};}function removeEntity(_0x15174b,_0xa59f59){return function(_0x114c57){if(_0x114c57){return _0x114c57[_0x81b8('0x26')]()[_0x81b8('0x27')](function(){var _0x52de24=_0x114c57[_0x81b8('0x28')]({'plain':!![]});var _0x591dc0='Intervals';return db[_0x81b8('0x29')][_0x81b8('0x26')]({'where':{'type':_0x591dc0,'resourceId':_0x52de24['id']}})[_0x81b8('0x27')](function(){return _0x114c57;});})['then'](function(){_0x15174b[_0x81b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa986b7,_0x20137b){return function(_0x768af6){if(!_0x768af6){_0xa986b7[_0x81b8('0x19')](0x194);}return _0x768af6;};}function handleError(_0x4ccf79,_0x4e76ad){_0x4e76ad=_0x4e76ad||0x1f4;return function(_0x39f9f9){logger[_0x81b8('0x2a')](_0x39f9f9[_0x81b8('0x2b')]);if(_0x39f9f9[_0x81b8('0x2c')]){delete _0x39f9f9[_0x81b8('0x2c')];}_0x4ccf79['status'](_0x4e76ad)['send'](_0x39f9f9);};}exports['index']=function(_0x4c61c7,_0x20e4b9){var _0x3d8f02={},_0x295bdb={},_0x46a90d={'count':0x0,'rows':[]};var _0xdeb10d=_['map'](db[_0x81b8('0x2d')][_0x81b8('0x2e')],function(_0x430a11){return{'name':_0x430a11['fieldName'],'type':_0x430a11[_0x81b8('0x2f')][_0x81b8('0x30')]};});_0x295bdb[_0x81b8('0x31')]=_[_0x81b8('0x32')](_0xdeb10d,'name');_0x295bdb['query']=_[_0x81b8('0x33')](_0x4c61c7[_0x81b8('0x34')]);_0x295bdb['filters']=_[_0x81b8('0x35')](_0x295bdb['model'],_0x295bdb[_0x81b8('0x34')]);_0x3d8f02[_0x81b8('0x36')]=_[_0x81b8('0x35')](_0x295bdb[_0x81b8('0x31')],qs['fields'](_0x4c61c7[_0x81b8('0x34')][_0x81b8('0x37')]));_0x3d8f02[_0x81b8('0x36')]=_0x3d8f02[_0x81b8('0x36')][_0x81b8('0x38')]?_0x3d8f02[_0x81b8('0x36')]:_0x295bdb['model'];if(!_0x4c61c7[_0x81b8('0x34')]['hasOwnProperty']('nolimit')){_0x3d8f02[_0x81b8('0x20')]=qs[_0x81b8('0x20')](_0x4c61c7[_0x81b8('0x34')][_0x81b8('0x20')]);_0x3d8f02[_0x81b8('0x1d')]=qs[_0x81b8('0x1d')](_0x4c61c7[_0x81b8('0x34')][_0x81b8('0x1d')]);}_0x3d8f02['order']=qs[_0x81b8('0x39')](_0x4c61c7[_0x81b8('0x34')][_0x81b8('0x39')]);_0x3d8f02['where']=qs[_0x81b8('0x3a')](_[_0x81b8('0x3b')](_0x4c61c7['query'],_0x295bdb[_0x81b8('0x3a')]),_0xdeb10d);if(_0x4c61c7['query'][_0x81b8('0x3c')]){_0x3d8f02['where']=_[_0x81b8('0x3d')](_0x3d8f02['where'],{'$or':_[_0x81b8('0x32')](_0xdeb10d,function(_0x4ef021){if(_0x4ef021[_0x81b8('0x2f')]!==_0x81b8('0x3e')){var _0x5a63c5={};_0x5a63c5[_0x4ef021['name']]={'$like':'%'+_0x4c61c7[_0x81b8('0x34')]['filter']+'%'};return _0x5a63c5;}})});}_0x3d8f02=_[_0x81b8('0x3d')]({},_0x3d8f02,_0x4c61c7['options']);var _0x99023a={'where':_0x3d8f02[_0x81b8('0x3f')]};return db[_0x81b8('0x2d')][_0x81b8('0x1f')](_0x99023a)[_0x81b8('0x27')](function(_0x189ccd){_0x46a90d[_0x81b8('0x1f')]=_0x189ccd;if(_0x4c61c7[_0x81b8('0x34')][_0x81b8('0x40')]){_0x3d8f02[_0x81b8('0x41')]=[{'all':!![]}];}return db[_0x81b8('0x2d')][_0x81b8('0x42')](_0x3d8f02);})[_0x81b8('0x27')](function(_0x3c5c83){_0x46a90d[_0x81b8('0x43')]=_0x3c5c83;return _0x46a90d;})[_0x81b8('0x27')](respondWithFilteredResult(_0x20e4b9,_0x3d8f02))[_0x81b8('0x44')](handleError(_0x20e4b9,null));};exports[_0x81b8('0x45')]=function(_0x7e883e,_0x26d07e){var _0x20fac8={'raw':!![],'where':{'id':_0x7e883e[_0x81b8('0x46')]['id']}},_0x13e4fb={};_0x13e4fb[_0x81b8('0x31')]=_[_0x81b8('0x33')](db[_0x81b8('0x2d')][_0x81b8('0x2e')]);_0x13e4fb[_0x81b8('0x34')]=_[_0x81b8('0x33')](_0x7e883e['query']);_0x13e4fb[_0x81b8('0x3a')]=_[_0x81b8('0x35')](_0x13e4fb['model'],_0x13e4fb['query']);_0x20fac8[_0x81b8('0x36')]=_[_0x81b8('0x35')](_0x13e4fb[_0x81b8('0x31')],qs[_0x81b8('0x37')](_0x7e883e['query'][_0x81b8('0x37')]));_0x20fac8['attributes']=_0x20fac8['attributes'][_0x81b8('0x38')]?_0x20fac8[_0x81b8('0x36')]:_0x13e4fb[_0x81b8('0x31')];if(_0x7e883e[_0x81b8('0x34')][_0x81b8('0x40')]){_0x20fac8[_0x81b8('0x41')]=[{'all':!![]}];}_0x20fac8=_[_0x81b8('0x3d')]({},_0x20fac8,_0x7e883e[_0x81b8('0x47')]);return db[_0x81b8('0x2d')][_0x81b8('0x48')](_0x20fac8)['then'](handleEntityNotFound(_0x26d07e,null))[_0x81b8('0x27')](respondWithResult(_0x26d07e,null))[_0x81b8('0x44')](handleError(_0x26d07e,null));};exports[_0x81b8('0x49')]=function(_0xc176f9,_0x882d3a){return db[_0x81b8('0x2d')][_0x81b8('0x49')](_0xc176f9[_0x81b8('0x4a')],{})[_0x81b8('0x27')](function(_0x3ccbe5){var _0x18bca7=_0xc176f9[_0x81b8('0x4b')][_0x81b8('0x28')]({'plain':!![]});if(!_0x18bca7)throw new Error(_0x81b8('0x4c'));if(_0x18bca7[_0x81b8('0x4d')]===_0x81b8('0x4b')){var _0x1d25f3=_0x3ccbe5[_0x81b8('0x28')]({'plain':!![]});var _0x58f57c=_0x81b8('0x4e');return db[_0x81b8('0x4f')][_0x81b8('0x48')]({'where':{'name':_0x58f57c,'userProfileId':_0x18bca7[_0x81b8('0x50')]},'raw':!![]})[_0x81b8('0x27')](function(_0xefdd82){if(_0xefdd82&&_0xefdd82[_0x81b8('0x51')]===0x0){return db[_0x81b8('0x29')][_0x81b8('0x49')]({'name':_0x1d25f3['name'],'resourceId':_0x1d25f3['id'],'type':_0xefdd82['name'],'sectionId':_0xefdd82['id']},{})[_0x81b8('0x27')](function(){return _0x3ccbe5;});}else{return _0x3ccbe5;}})[_0x81b8('0x44')](function(_0xdd2f79){logger[_0x81b8('0x2a')](_0x81b8('0x52'),_0xdd2f79);throw _0xdd2f79;});}return _0x3ccbe5;})[_0x81b8('0x27')](respondWithResult(_0x882d3a,0xc9))[_0x81b8('0x44')](handleError(_0x882d3a,null));};exports[_0x81b8('0x25')]=function(_0x5e2ddc,_0x264052){if(_0x5e2ddc['body']['id']){delete _0x5e2ddc[_0x81b8('0x4a')]['id'];}return db[_0x81b8('0x2d')]['find']({'where':{'id':_0x5e2ddc['params']['id']}})[_0x81b8('0x27')](handleEntityNotFound(_0x264052,null))[_0x81b8('0x27')](saveUpdates(_0x5e2ddc[_0x81b8('0x4a')],null))[_0x81b8('0x27')](respondWithResult(_0x264052,null))[_0x81b8('0x44')](handleError(_0x264052,null));};exports[_0x81b8('0x26')]=function(_0x55f1d2,_0x2f424f){return db['Interval'][_0x81b8('0x48')]({'where':{'id':_0x55f1d2[_0x81b8('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f424f,null))[_0x81b8('0x27')](removeEntity(_0x2f424f,null))['catch'](handleError(_0x2f424f,null));};exports[_0x81b8('0x53')]=function(_0x223372,_0x4a90fe,_0x5029ac){if(_0x223372['body']['id']){delete _0x223372[_0x81b8('0x4a')]['id'];}return db[_0x81b8('0x2d')][_0x81b8('0x48')]({'where':{'id':_0x223372['params']['id']}})[_0x81b8('0x27')](handleEntityNotFound(_0x4a90fe,null))[_0x81b8('0x27')](function(_0x5900c3){if(_0x5900c3){_0x223372[_0x81b8('0x4a')][_0x81b8('0x54')]=_0x5900c3['id'];return db[_0x81b8('0x2d')][_0x81b8('0x49')](_0x223372[_0x81b8('0x4a')]);}})[_0x81b8('0x27')](respondWithResult(_0x4a90fe,null))[_0x81b8('0x44')](handleError(_0x4a90fe,null));};exports[_0x81b8('0x55')]=function(_0x3ddba2,_0x457016,_0x400217){var _0x284d81={};var _0x21cb96={};var _0x5989b1;var _0x405ff4;return db['Interval'][_0x81b8('0x56')]({'where':{'id':_0x3ddba2[_0x81b8('0x46')]['id']}})[_0x81b8('0x27')](handleEntityNotFound(_0x457016,null))[_0x81b8('0x27')](function(_0x45f039){if(_0x45f039){_0x5989b1=_0x45f039;_0x21cb96[_0x81b8('0x31')]=_[_0x81b8('0x33')](db[_0x81b8('0x2d')][_0x81b8('0x2e')]);_0x21cb96[_0x81b8('0x34')]=_[_0x81b8('0x33')](_0x3ddba2[_0x81b8('0x34')]);_0x21cb96[_0x81b8('0x3a')]=_[_0x81b8('0x35')](_0x21cb96['model'],_0x21cb96[_0x81b8('0x34')]);_0x284d81[_0x81b8('0x36')]=_[_0x81b8('0x35')](_0x21cb96['model'],qs[_0x81b8('0x37')](_0x3ddba2[_0x81b8('0x34')]['fields']));_0x284d81[_0x81b8('0x36')]=_0x284d81[_0x81b8('0x36')][_0x81b8('0x38')]?_0x284d81[_0x81b8('0x36')]:_0x21cb96[_0x81b8('0x31')];_0x284d81['order']=qs[_0x81b8('0x39')](_0x3ddba2['query']['sort']);_0x284d81['where']=qs[_0x81b8('0x3a')](_[_0x81b8('0x3b')](_0x3ddba2['query'],_0x21cb96[_0x81b8('0x3a')]));if(_0x3ddba2[_0x81b8('0x34')][_0x81b8('0x3c')]){_0x284d81['where']=_[_0x81b8('0x3d')](_0x284d81['where'],{'$or':_[_0x81b8('0x32')](_0x284d81['attributes'],function(_0x2f2437){var _0x1965f7={};_0x1965f7[_0x2f2437]={'$like':'%'+_0x3ddba2[_0x81b8('0x34')]['filter']+'%'};return _0x1965f7;})});}_0x284d81=_[_0x81b8('0x3d')]({},_0x284d81,_0x3ddba2[_0x81b8('0x47')]);return _0x5989b1[_0x81b8('0x55')](_0x284d81);}})[_0x81b8('0x27')](function(_0x25c811){if(_0x25c811){_0x405ff4=_0x25c811[_0x81b8('0x38')];if(!_0x3ddba2[_0x81b8('0x34')][_0x81b8('0x57')](_0x81b8('0x58'))){_0x284d81[_0x81b8('0x20')]=qs[_0x81b8('0x20')](_0x3ddba2['query']['limit']);_0x284d81[_0x81b8('0x1d')]=qs['offset'](_0x3ddba2[_0x81b8('0x34')][_0x81b8('0x1d')]);}return _0x5989b1[_0x81b8('0x55')](_0x284d81);}})['then'](function(_0x53409e){if(_0x53409e){return _0x53409e?{'count':_0x405ff4,'rows':_0x53409e}:null;}})[_0x81b8('0x27')](respondWithResult(_0x457016,null))[_0x81b8('0x44')](handleError(_0x457016,null));};exports[_0x81b8('0x59')]=function(_0xfcb707,_0x4b45c5,_0x154cc4){return db[_0x81b8('0x2d')]['findOne']({'where':{'id':_0xfcb707[_0x81b8('0x46')]['id']}})[_0x81b8('0x27')](handleEntityNotFound(_0x4b45c5,null))[_0x81b8('0x27')](function(_0x5d0e53){if(_0x5d0e53){return db['sequelize']['transaction'](function(_0xc20f7f){return db['Interval'][_0x81b8('0x26')]({'where':{'IntervalId':_0xfcb707['params']['id']},'transaction':_0xc20f7f})[_0x81b8('0x27')](function(_0x366c07){var _0x53e3a5=_[_0x81b8('0x32')](_0xfcb707[_0x81b8('0x4a')],function(_0x20fc6a){delete _0x20fc6a['id'];_0x20fc6a[_0x81b8('0x54')]=_0xfcb707[_0x81b8('0x46')]['id'];return _0x20fc6a;});return db[_0x81b8('0x2d')]['bulkCreate'](_0x53e3a5,{'transaction':_0xc20f7f});});})['then'](function(){return db['Interval'][_0x81b8('0x42')]({'where':{'IntervalId':_0xfcb707[_0x81b8('0x46')]['id']}});});}})[_0x81b8('0x27')](respondWithResult(_0x4b45c5,null))[_0x81b8('0x44')](handleError(_0x4b45c5,null));};
\ No newline at end of file
+var _0x9117=['show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','addInterval','getIntervals','order','pick','addIntervals','findOne','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9117,0x72));var _0x7911=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x9117[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0x7911('0x0'));var rimraf=require(_0x7911('0x1'));var zipdir=require(_0x7911('0x2'));var jsonpatch=require(_0x7911('0x3'));var rp=require(_0x7911('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7911('0x5'));var util=require(_0x7911('0x6'));var path=require(_0x7911('0x7'));var sox=require(_0x7911('0x8'));var csv=require(_0x7911('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7911('0xa'));var _=require(_0x7911('0xb'));var squel=require(_0x7911('0xc'));var crypto=require(_0x7911('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7911('0x9'));var querystring=require(_0x7911('0xe'));var Papa=require(_0x7911('0xf'));var Redis=require(_0x7911('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7911('0x11'));var as=require(_0x7911('0x12'));var hardwareService=require(_0x7911('0x13'));var logger=require('../../config/logger')(_0x7911('0x14'));var utils=require('../../config/utils');var config=require(_0x7911('0x15'));var licenseUtil=require(_0x7911('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x7911('0x17'));function respondWithStatusCode(_0x9e49ec,_0x377289){_0x377289=_0x377289||0xcc;return function(_0x467454){if(_0x467454){return _0x9e49ec['sendStatus'](_0x377289);}return _0x9e49ec[_0x7911('0x18')](_0x377289)[_0x7911('0x19')]();};}function respondWithResult(_0x5d4cbb,_0x421db6){_0x421db6=_0x421db6||0xc8;return function(_0x56a5e2){if(_0x56a5e2){return _0x5d4cbb[_0x7911('0x18')](_0x421db6)[_0x7911('0x1a')](_0x56a5e2);}};}function respondWithFilteredResult(_0x80c70c,_0x5e7e20){return function(_0x4eb19f){if(_0x4eb19f){var _0xfa153d=typeof _0x5e7e20[_0x7911('0x1b')]===_0x7911('0x1c')&&typeof _0x5e7e20[_0x7911('0x1d')]===_0x7911('0x1c');var _0x1c7497=_0x4eb19f[_0x7911('0x1e')];var _0x21880a=_0xfa153d?0x0:_0x5e7e20[_0x7911('0x1b')];var _0x2a359b=_0xfa153d?_0x4eb19f['count']:_0x5e7e20[_0x7911('0x1b')]+_0x5e7e20[_0x7911('0x1d')];var _0x24ab9f;if(_0x2a359b>=_0x1c7497){_0x2a359b=_0x1c7497;_0x24ab9f=0xc8;}else{_0x24ab9f=0xce;}_0x80c70c[_0x7911('0x18')](_0x24ab9f);return _0x80c70c['set']('Content-Range',_0x21880a+'-'+_0x2a359b+'/'+_0x1c7497)[_0x7911('0x1a')](_0x4eb19f);}return null;};}function patchUpdates(_0x12d498){return function(_0x2a4c4b){try{jsonpatch[_0x7911('0x1f')](_0x2a4c4b,_0x12d498,!![]);}catch(_0x3b7e59){return BPromise[_0x7911('0x20')](_0x3b7e59);}return _0x2a4c4b[_0x7911('0x21')]();};}function saveUpdates(_0x58ab99,_0x31b1ba){return function(_0x5c1a79){if(_0x5c1a79){return _0x5c1a79['update'](_0x58ab99)['then'](function(_0x1ca4cb){return _0x1ca4cb;});}return null;};}function removeEntity(_0xfa8934,_0x14f55b){return function(_0x1b9692){if(_0x1b9692){return _0x1b9692[_0x7911('0x22')]()[_0x7911('0x23')](function(){var _0x328b3e=_0x1b9692[_0x7911('0x24')]({'plain':!![]});var _0x26ccac=_0x7911('0x25');return db[_0x7911('0x26')][_0x7911('0x22')]({'where':{'type':_0x26ccac,'resourceId':_0x328b3e['id']}})[_0x7911('0x23')](function(){return _0x1b9692;});})[_0x7911('0x23')](function(){_0xfa8934['status'](0xcc)[_0x7911('0x19')]();});}};}function handleEntityNotFound(_0x3c3f92,_0x46d865){return function(_0x5a91ba){if(!_0x5a91ba){_0x3c3f92[_0x7911('0x27')](0x194);}return _0x5a91ba;};}function handleError(_0x38b699,_0x3920e4){_0x3920e4=_0x3920e4||0x1f4;return function(_0x49ca2d){logger[_0x7911('0x28')](_0x49ca2d['stack']);if(_0x49ca2d[_0x7911('0x29')]){delete _0x49ca2d[_0x7911('0x29')];}_0x38b699[_0x7911('0x18')](_0x3920e4)[_0x7911('0x2a')](_0x49ca2d);};}exports[_0x7911('0x2b')]=function(_0x53e377,_0x174fe1){var _0xceddcb={},_0x3010e2={},_0x4f2415={'count':0x0,'rows':[]};var _0x562bc8=_[_0x7911('0x2c')](db[_0x7911('0x2d')]['rawAttributes'],function(_0x5e493a){return{'name':_0x5e493a[_0x7911('0x2e')],'type':_0x5e493a[_0x7911('0x2f')][_0x7911('0x30')]};});_0x3010e2[_0x7911('0x31')]=_[_0x7911('0x2c')](_0x562bc8,'name');_0x3010e2[_0x7911('0x32')]=_[_0x7911('0x33')](_0x53e377[_0x7911('0x32')]);_0x3010e2[_0x7911('0x34')]=_['intersection'](_0x3010e2['model'],_0x3010e2[_0x7911('0x32')]);_0xceddcb[_0x7911('0x35')]=_[_0x7911('0x36')](_0x3010e2[_0x7911('0x31')],qs[_0x7911('0x37')](_0x53e377['query'][_0x7911('0x37')]));_0xceddcb[_0x7911('0x35')]=_0xceddcb[_0x7911('0x35')][_0x7911('0x38')]?_0xceddcb[_0x7911('0x35')]:_0x3010e2[_0x7911('0x31')];if(!_0x53e377[_0x7911('0x32')][_0x7911('0x39')](_0x7911('0x3a'))){_0xceddcb[_0x7911('0x1d')]=qs[_0x7911('0x1d')](_0x53e377[_0x7911('0x32')][_0x7911('0x1d')]);_0xceddcb[_0x7911('0x1b')]=qs[_0x7911('0x1b')](_0x53e377[_0x7911('0x32')][_0x7911('0x1b')]);}_0xceddcb['order']=qs[_0x7911('0x3b')](_0x53e377['query'][_0x7911('0x3b')]);_0xceddcb[_0x7911('0x3c')]=qs[_0x7911('0x34')](_['pick'](_0x53e377[_0x7911('0x32')],_0x3010e2[_0x7911('0x34')]),_0x562bc8);if(_0x53e377[_0x7911('0x32')][_0x7911('0x3d')]){_0xceddcb[_0x7911('0x3c')]=_['merge'](_0xceddcb['where'],{'$or':_['map'](_0x562bc8,function(_0x3dce4a){if(_0x3dce4a[_0x7911('0x2f')]!==_0x7911('0x3e')){var _0x641390={};_0x641390[_0x3dce4a['name']]={'$like':'%'+_0x53e377['query']['filter']+'%'};return _0x641390;}})});}_0xceddcb=_[_0x7911('0x3f')]({},_0xceddcb,_0x53e377[_0x7911('0x40')]);var _0xbb536c={'where':_0xceddcb[_0x7911('0x3c')]};return db['Interval']['count'](_0xbb536c)[_0x7911('0x23')](function(_0x3e520b){_0x4f2415[_0x7911('0x1e')]=_0x3e520b;if(_0x53e377['query']['includeAll']){_0xceddcb['include']=[{'all':!![]}];}return db[_0x7911('0x2d')][_0x7911('0x41')](_0xceddcb);})['then'](function(_0x2b8442){_0x4f2415[_0x7911('0x42')]=_0x2b8442;return _0x4f2415;})['then'](respondWithFilteredResult(_0x174fe1,_0xceddcb))[_0x7911('0x43')](handleError(_0x174fe1,null));};exports[_0x7911('0x44')]=function(_0x4b45df,_0x31b18c){var _0x23caea={'raw':!![],'where':{'id':_0x4b45df[_0x7911('0x45')]['id']}},_0x3b2c3a={};_0x3b2c3a[_0x7911('0x31')]=_[_0x7911('0x33')](db[_0x7911('0x2d')][_0x7911('0x46')]);_0x3b2c3a[_0x7911('0x32')]=_[_0x7911('0x33')](_0x4b45df[_0x7911('0x32')]);_0x3b2c3a['filters']=_[_0x7911('0x36')](_0x3b2c3a[_0x7911('0x31')],_0x3b2c3a['query']);_0x23caea[_0x7911('0x35')]=_[_0x7911('0x36')](_0x3b2c3a['model'],qs['fields'](_0x4b45df['query'][_0x7911('0x37')]));_0x23caea[_0x7911('0x35')]=_0x23caea['attributes'][_0x7911('0x38')]?_0x23caea[_0x7911('0x35')]:_0x3b2c3a[_0x7911('0x31')];if(_0x4b45df[_0x7911('0x32')][_0x7911('0x47')]){_0x23caea[_0x7911('0x48')]=[{'all':!![]}];}_0x23caea=_[_0x7911('0x3f')]({},_0x23caea,_0x4b45df[_0x7911('0x40')]);return db[_0x7911('0x2d')][_0x7911('0x49')](_0x23caea)[_0x7911('0x23')](handleEntityNotFound(_0x31b18c,null))[_0x7911('0x23')](respondWithResult(_0x31b18c,null))[_0x7911('0x43')](handleError(_0x31b18c,null));};exports[_0x7911('0x4a')]=function(_0x418f39,_0x456f46){return db[_0x7911('0x2d')][_0x7911('0x4a')](_0x418f39[_0x7911('0x4b')],{})[_0x7911('0x23')](function(_0x23868d){var _0x4dbb7d=_0x418f39[_0x7911('0x4c')][_0x7911('0x24')]({'plain':!![]});if(!_0x4dbb7d)throw new Error(_0x7911('0x4d'));if(_0x4dbb7d[_0x7911('0x4e')]===_0x7911('0x4c')){var _0x1165b0=_0x23868d[_0x7911('0x24')]({'plain':!![]});var _0x172848=_0x7911('0x25');return db[_0x7911('0x4f')][_0x7911('0x49')]({'where':{'name':_0x172848,'userProfileId':_0x4dbb7d[_0x7911('0x50')]},'raw':!![]})[_0x7911('0x23')](function(_0x3c9e70){if(_0x3c9e70&&_0x3c9e70[_0x7911('0x51')]===0x0){return db[_0x7911('0x26')]['create']({'name':_0x1165b0[_0x7911('0x29')],'resourceId':_0x1165b0['id'],'type':_0x3c9e70[_0x7911('0x29')],'sectionId':_0x3c9e70['id']},{})[_0x7911('0x23')](function(){return _0x23868d;});}else{return _0x23868d;}})[_0x7911('0x43')](function(_0x55a904){logger[_0x7911('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55a904);throw _0x55a904;});}return _0x23868d;})[_0x7911('0x23')](respondWithResult(_0x456f46,0xc9))[_0x7911('0x43')](handleError(_0x456f46,null));};exports[_0x7911('0x52')]=function(_0x290ef9,_0x4acae1){if(_0x290ef9[_0x7911('0x4b')]['id']){delete _0x290ef9[_0x7911('0x4b')]['id'];}return db['Interval']['find']({'where':{'id':_0x290ef9[_0x7911('0x45')]['id']}})[_0x7911('0x23')](handleEntityNotFound(_0x4acae1,null))[_0x7911('0x23')](saveUpdates(_0x290ef9[_0x7911('0x4b')],null))['then'](respondWithResult(_0x4acae1,null))[_0x7911('0x43')](handleError(_0x4acae1,null));};exports[_0x7911('0x22')]=function(_0x358d97,_0x31c09f){return db[_0x7911('0x2d')]['find']({'where':{'id':_0x358d97[_0x7911('0x45')]['id']}})[_0x7911('0x23')](handleEntityNotFound(_0x31c09f,null))[_0x7911('0x23')](removeEntity(_0x31c09f,null))[_0x7911('0x43')](handleError(_0x31c09f,null));};exports[_0x7911('0x53')]=function(_0x1f3d2b,_0x5c32e6,_0x462d56){if(_0x1f3d2b[_0x7911('0x4b')]['id']){delete _0x1f3d2b[_0x7911('0x4b')]['id'];}return db[_0x7911('0x2d')][_0x7911('0x49')]({'where':{'id':_0x1f3d2b[_0x7911('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c32e6,null))[_0x7911('0x23')](function(_0x1dfb92){if(_0x1dfb92){_0x1f3d2b[_0x7911('0x4b')]['IntervalId']=_0x1dfb92['id'];return db[_0x7911('0x2d')][_0x7911('0x4a')](_0x1f3d2b[_0x7911('0x4b')]);}})[_0x7911('0x23')](respondWithResult(_0x5c32e6,null))['catch'](handleError(_0x5c32e6,null));};exports[_0x7911('0x54')]=function(_0x493f19,_0x268992,_0x18c178){var _0x4f52c9={};var _0x497ea9={};var _0x12d775;var _0x3d6407;return db[_0x7911('0x2d')]['findOne']({'where':{'id':_0x493f19['params']['id']}})[_0x7911('0x23')](handleEntityNotFound(_0x268992,null))[_0x7911('0x23')](function(_0x19b7d2){if(_0x19b7d2){_0x12d775=_0x19b7d2;_0x497ea9['model']=_['keys'](db[_0x7911('0x2d')][_0x7911('0x46')]);_0x497ea9[_0x7911('0x32')]=_['keys'](_0x493f19[_0x7911('0x32')]);_0x497ea9[_0x7911('0x34')]=_[_0x7911('0x36')](_0x497ea9[_0x7911('0x31')],_0x497ea9[_0x7911('0x32')]);_0x4f52c9[_0x7911('0x35')]=_['intersection'](_0x497ea9[_0x7911('0x31')],qs[_0x7911('0x37')](_0x493f19[_0x7911('0x32')][_0x7911('0x37')]));_0x4f52c9['attributes']=_0x4f52c9[_0x7911('0x35')][_0x7911('0x38')]?_0x4f52c9[_0x7911('0x35')]:_0x497ea9['model'];_0x4f52c9[_0x7911('0x55')]=qs[_0x7911('0x3b')](_0x493f19[_0x7911('0x32')][_0x7911('0x3b')]);_0x4f52c9[_0x7911('0x3c')]=qs[_0x7911('0x34')](_[_0x7911('0x56')](_0x493f19[_0x7911('0x32')],_0x497ea9['filters']));if(_0x493f19[_0x7911('0x32')][_0x7911('0x3d')]){_0x4f52c9['where']=_[_0x7911('0x3f')](_0x4f52c9[_0x7911('0x3c')],{'$or':_[_0x7911('0x2c')](_0x4f52c9['attributes'],function(_0x4ae7db){var _0x512fb2={};_0x512fb2[_0x4ae7db]={'$like':'%'+_0x493f19[_0x7911('0x32')]['filter']+'%'};return _0x512fb2;})});}_0x4f52c9=_['merge']({},_0x4f52c9,_0x493f19[_0x7911('0x40')]);return _0x12d775['getIntervals'](_0x4f52c9);}})[_0x7911('0x23')](function(_0x4a58b9){if(_0x4a58b9){_0x3d6407=_0x4a58b9[_0x7911('0x38')];if(!_0x493f19[_0x7911('0x32')][_0x7911('0x39')](_0x7911('0x3a'))){_0x4f52c9['limit']=qs[_0x7911('0x1d')](_0x493f19[_0x7911('0x32')][_0x7911('0x1d')]);_0x4f52c9[_0x7911('0x1b')]=qs[_0x7911('0x1b')](_0x493f19[_0x7911('0x32')]['offset']);}return _0x12d775['getIntervals'](_0x4f52c9);}})[_0x7911('0x23')](function(_0xa8373d){if(_0xa8373d){return _0xa8373d?{'count':_0x3d6407,'rows':_0xa8373d}:null;}})['then'](respondWithResult(_0x268992,null))[_0x7911('0x43')](handleError(_0x268992,null));};exports[_0x7911('0x57')]=function(_0x603857,_0x37d03a,_0xb58efd){return db['Interval'][_0x7911('0x58')]({'where':{'id':_0x603857[_0x7911('0x45')]['id']}})[_0x7911('0x23')](handleEntityNotFound(_0x37d03a,null))[_0x7911('0x23')](function(_0x51e261){if(_0x51e261){return db['sequelize']['transaction'](function(_0x2c6e66){return db[_0x7911('0x2d')][_0x7911('0x22')]({'where':{'IntervalId':_0x603857[_0x7911('0x45')]['id']},'transaction':_0x2c6e66})['then'](function(_0xa7eeed){var _0x25bffc=_[_0x7911('0x2c')](_0x603857['body'],function(_0x36933c){delete _0x36933c['id'];_0x36933c[_0x7911('0x59')]=_0x603857[_0x7911('0x45')]['id'];return _0x36933c;});return db['Interval'][_0x7911('0x5a')](_0x25bffc,{'transaction':_0x2c6e66});});})['then'](function(){return db['Interval'][_0x7911('0x41')]({'where':{'IntervalId':_0x603857[_0x7911('0x45')]['id']}});});}})[_0x7911('0x23')](respondWithResult(_0x37d03a,null))['catch'](handleError(_0x37d03a,null));};
\ No newline at end of file
index bdf96a2..c0752c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3e4=['then','all','map','ifTime','reduce','../../components/extensions/rewrite','iftime','define','tools_intervals','rewrite','string','interval'];(function(_0x2124be,_0x199834){var _0x5f3dad=function(_0x15d9e0){while(--_0x15d9e0){_0x2124be['push'](_0x2124be['shift']());}};_0x5f3dad(++_0x199834);}(_0xc3e4,0x179));var _0x4c3e=function(_0x571fba,_0x496bac){_0x571fba=_0x571fba-0x0;var _0x5b356b=_0xc3e4[_0x571fba];return _0x5b356b;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x4c3e('0x0'));var iftime=require('../../utils/iftime')[_0x4c3e('0x1')];module['exports']=function(_0x145455){return _0x145455[_0x4c3e('0x2')]('Interval',attributes,{'tableName':_0x4c3e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x87a751){extensions[_0x4c3e('0x4')](_0x145455,_0x87a751);},'afterBulkCreate':function(_0x3999a3,_0x32339d,_0x5d5c37){_0x5d5c37();extensions[_0x4c3e('0x4')](_0x145455,_0x3999a3[0x0]);},'afterUpdate':function(_0xa11ab3){extensions['rewrite'](_0x145455,_0xa11ab3);},'afterDestroy':function(_0x4c32eb){extensions[_0x4c3e('0x4')](_0x145455,_0x4c32eb);}},'instanceMethods':{'ifTime':function(_0x1a4602=undefined,_0x4f2f80=new Date()){if(typeof this['interval']===_0x4c3e('0x5')){return iftime(this[_0x4c3e('0x6')],_0x1a4602,_0x4f2f80);}else{return this['getIntervals']()[_0x4c3e('0x7')](function(_0x4ef3bd){return Promise[_0x4c3e('0x8')](_0x4ef3bd[_0x4c3e('0x9')](function(_0x5e6637){return _0x5e6637[_0x4c3e('0xa')](_0x1a4602,_0x4f2f80);}));})[_0x4c3e('0x7')](function(_0x50ec83){return _0x50ec83[_0x4c3e('0xb')](function(_0x5f2b75,_0xd37b4f){return _0x5f2b75||_0xd37b4f;},![]);});}}}});};
\ No newline at end of file
+var _0x137b=['rewrite','interval','string','then','map','ifTime','reduce','./interval.attributes','../../utils/iftime','exports','define','tools_intervals'];(function(_0x56d6f0,_0x25ded3){var _0x39fe78=function(_0x23f339){while(--_0x23f339){_0x56d6f0['push'](_0x56d6f0['shift']());}};_0x39fe78(++_0x25ded3);}(_0x137b,0x1f3));var _0xb137=function(_0x2ae5ce,_0x481760){_0x2ae5ce=_0x2ae5ce-0x0;var _0x3ccd3c=_0x137b[_0x2ae5ce];return _0x3ccd3c;};'use strict';var attributes=require(_0xb137('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xb137('0x1'))['iftime'];module[_0xb137('0x2')]=function(_0x6811ae){return _0x6811ae[_0xb137('0x3')]('Interval',attributes,{'tableName':_0xb137('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2721a0){extensions['rewrite'](_0x6811ae,_0x2721a0);},'afterBulkCreate':function(_0x278809,_0x2fb10d,_0x5d7ef9){_0x5d7ef9();extensions[_0xb137('0x5')](_0x6811ae,_0x278809[0x0]);},'afterUpdate':function(_0x39fe4a){extensions[_0xb137('0x5')](_0x6811ae,_0x39fe4a);},'afterDestroy':function(_0x2d76bf){extensions[_0xb137('0x5')](_0x6811ae,_0x2d76bf);}},'instanceMethods':{'ifTime':function(_0x23d6b2=undefined,_0x1aab71=new Date()){if(typeof this[_0xb137('0x6')]===_0xb137('0x7')){return iftime(this[_0xb137('0x6')],_0x23d6b2,_0x1aab71);}else{return this['getIntervals']()[_0xb137('0x8')](function(_0x42bc20){return Promise['all'](_0x42bc20[_0xb137('0x9')](function(_0x517a68){return _0x517a68[_0xb137('0xa')](_0x23d6b2,_0x1aab71);}));})[_0xb137('0x8')](function(_0x4d334f){return _0x4d334f[_0xb137('0xb')](function(_0x4552d6,_0x3b519c){return _0x4552d6||_0x3b519c;},![]);});}}}});};
\ No newline at end of file
index c6c8c20..86829e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e57=['../../mysqldb','../../utils/iftime','../../config/logger','rpc','Interval','findAll','options','raw','where','attributes','limit','map','include','model','then','info','GetInterval','debug','stringify','error','message','ShowInterval','find','catch','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util'];(function(_0x53c261,_0x2a3529){var _0x30a857=function(_0x1d2d00){while(--_0x1d2d00){_0x53c261['push'](_0x53c261['shift']());}};_0x30a857(++_0x2a3529);}(_0x7e57,0xb2));var _0x77e5=function(_0x3be001,_0x8b69e8){_0x3be001=_0x3be001-0x0;var _0xfc610f=_0x7e57[_0x3be001];return _0xfc610f;};'use strict';var _=require(_0x77e5('0x0'));var util=require(_0x77e5('0x1'));var db=require(_0x77e5('0x2'))['db'];var iftime=require(_0x77e5('0x3'))['iftime'];var logger=require(_0x77e5('0x4'))(_0x77e5('0x5'));exports['GetInterval']=function(_0x206603){var _0x19ca2e=this;return new Promise(function(_0x48a367,_0x33784d){return db[_0x77e5('0x6')][_0x77e5('0x7')]({'raw':_0x206603[_0x77e5('0x8')]?_0x206603['options'][_0x77e5('0x9')]===undefined?!![]:![]:!![],'where':_0x206603['options']?_0x206603[_0x77e5('0x8')][_0x77e5('0xa')]||null:null,'attributes':_0x206603[_0x77e5('0x8')]?_0x206603[_0x77e5('0x8')][_0x77e5('0xb')]||null:null,'limit':_0x206603['options']?_0x206603[_0x77e5('0x8')][_0x77e5('0xc')]||null:null,'include':_0x206603['options']?_0x206603['options']['include']?_['map'](_0x206603[_0x77e5('0x8')]['include'],function(_0x33bee7){return{'model':db[_0x33bee7['model']],'as':_0x33bee7['as'],'attributes':_0x33bee7[_0x77e5('0xb')],'include':_0x33bee7['include']?_[_0x77e5('0xd')](_0x33bee7[_0x77e5('0xe')],function(_0x5b1760){return{'model':db[_0x5b1760[_0x77e5('0xf')]],'as':_0x5b1760['as'],'attributes':_0x5b1760[_0x77e5('0xb')],'include':_0x5b1760[_0x77e5('0xe')]?_[_0x77e5('0xd')](_0x5b1760[_0x77e5('0xe')],function(_0x12ff24){return{'model':db[_0x12ff24['model']],'as':_0x12ff24['as'],'attributes':_0x12ff24[_0x77e5('0xb')]};}):[]};}):[]};}):[]:[]})[_0x77e5('0x10')](function(_0x3bb8f0){logger[_0x77e5('0x11')](_0x77e5('0x12'),_0x206603);logger[_0x77e5('0x13')](_0x77e5('0x12'),_0x206603,JSON[_0x77e5('0x14')](_0x3bb8f0));_0x48a367(_0x3bb8f0);})['catch'](function(_0x53f604){logger[_0x77e5('0x15')](_0x77e5('0x12'),_0x53f604['message'],_0x206603);_0x33784d(_0x19ca2e['error'](0x1f4,_0x53f604[_0x77e5('0x16')]));});});};exports[_0x77e5('0x17')]=function(_0x3d685b){var _0x36c270=this;return new Promise(function(_0x1283c6,_0x4fc99a){return db['Interval'][_0x77e5('0x18')]({'raw':_0x3d685b['options']?_0x3d685b[_0x77e5('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3d685b['options']?_0x3d685b[_0x77e5('0x8')]['where']||null:null,'attributes':_0x3d685b[_0x77e5('0x8')]?_0x3d685b[_0x77e5('0x8')]['attributes']||null:null,'include':_0x3d685b[_0x77e5('0x8')]?_0x3d685b[_0x77e5('0x8')]['include']?_[_0x77e5('0xd')](_0x3d685b[_0x77e5('0x8')][_0x77e5('0xe')],function(_0x546fdf){return{'model':db[_0x546fdf[_0x77e5('0xf')]],'as':_0x546fdf['as'],'attributes':_0x546fdf[_0x77e5('0xb')],'include':_0x546fdf[_0x77e5('0xe')]?_['map'](_0x546fdf[_0x77e5('0xe')],function(_0x1a834f){return{'model':db[_0x1a834f[_0x77e5('0xf')]],'as':_0x1a834f['as'],'attributes':_0x1a834f['attributes'],'include':_0x1a834f[_0x77e5('0xe')]?_[_0x77e5('0xd')](_0x1a834f[_0x77e5('0xe')],function(_0xf39912){return{'model':db[_0xf39912[_0x77e5('0xf')]],'as':_0xf39912['as'],'attributes':_0xf39912['attributes']};}):[]};}):[]};}):[]:[]})[_0x77e5('0x10')](function(_0x341b1b){logger[_0x77e5('0x11')]('ShowInterval',_0x3d685b);logger[_0x77e5('0x13')]('ShowInterval',_0x3d685b,JSON[_0x77e5('0x14')](_0x341b1b));_0x1283c6(_0x341b1b);})[_0x77e5('0x19')](function(_0x31ba9f){logger['error'](_0x77e5('0x17'),_0x31ba9f[_0x77e5('0x16')],_0x3d685b);_0x4fc99a(_0x36c270[_0x77e5('0x15')](0x1f4,_0x31ba9f[_0x77e5('0x16')]));});});};function checkArrayOfIntervals(_0x47e1d8,_0x103d16){var _0x2acfdb=[];return db[_0x77e5('0x6')]['findAll']({'where':{'id':_0x47e1d8}})[_0x77e5('0x10')](function(_0x1ae7cf){_0x2acfdb=_0x1ae7cf;return Promise['all'](_0x2acfdb[_0x77e5('0xd')](function(_0x4225de){return _0x4225de[_0x77e5('0x1a')](_0x103d16);}));})[_0x77e5('0x10')](function(_0x5738f6){var _0x194ac7=_0x5738f6[_0x77e5('0x1b')](function(_0xb9e2de,_0x5860e3){return _0xb9e2de||_0x5860e3;},![]);logger[_0x77e5('0x11')](util[_0x77e5('0x1c')](_0x77e5('0x1d'),_0x2acfdb[_0x77e5('0xd')](function(_0x25e4b3){return _0x25e4b3[_0x77e5('0x1e')];})[_0x77e5('0x1f')](',\x20'),_0x2acfdb[_0x77e5('0xd')](function(_0xe4ac39){return _0xe4ac39['id'];})[_0x77e5('0x1f')](',\x20')));return _0x194ac7;});}function checkSingleInterval(_0x5ca9f9,_0x50a28a){return db[_0x77e5('0x6')]['findById'](_0x5ca9f9)[_0x77e5('0x10')](function(_0x52427f){if(_0x52427f){logger[_0x77e5('0x11')](util[_0x77e5('0x1c')](_0x77e5('0x20'),_0x52427f[_0x77e5('0x1e')],_0x52427f['id']));return _0x52427f[_0x77e5('0x1a')](_0x50a28a);}});}exports['IntervalIftime']=function(_0x1cc1c6){var _0x1cfb31=_0x1cc1c6[_0x77e5('0x21')];var _0x48802d=Array[_0x77e5('0x22')](_0x1cc1c6[_0x77e5('0x23')])?_0x1cc1c6[_0x77e5('0x23')]:typeof _0x1cc1c6[_0x77e5('0x23')]===_0x77e5('0x24')?[_0x1cc1c6[_0x77e5('0x23')]]:[];var _0x504e32=_0x1cc1c6[_0x77e5('0x25')]||undefined;var _0x30bb24=![];if(_0x48802d[_0x77e5('0x26')]){logger[_0x77e5('0x11')](util[_0x77e5('0x1c')](_0x77e5('0x27'),_0x48802d[_0x77e5('0x1f')](';\x20')));}if(_0x504e32){logger[_0x77e5('0x11')](util[_0x77e5('0x1c')](_0x77e5('0x28'),_0x504e32));}logger['debug'](_0x77e5('0x29'),_0x30bb24);logger[_0x77e5('0x2a')](_0x77e5('0x2b'),_0x1cc1c6);return Promise[_0x77e5('0x2c')]()[_0x77e5('0x10')](function(){if(Array['isArray'](_0x1cfb31)){return checkArrayOfIntervals(_0x1cfb31,_0x504e32);}else if(_0x1cfb31){return checkSingleInterval(_0x1cfb31,_0x504e32);}})[_0x77e5('0x10')](function(_0x59911f){var _0x39955a=_0x48802d['reduce'](function(_0x61f7b7,_0x2d24df){return _0x61f7b7||iftime(_0x2d24df,_0x504e32);},![]);_0x30bb24=_0x59911f||_0x39955a;return _0x30bb24;})[_0x77e5('0x19')](function(_0x18dc70){logger['error'](_0x77e5('0x2b'),_0x1cc1c6,_0x18dc70);throw this[_0x77e5('0x15')](0x1f4,_0x18dc70['message']);});};
\ No newline at end of file
+var _0xf3d4=['rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','message','error','ShowInterval','find','info','stringify','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','IntervalIftime','resolve','catch','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0xf3d4,0x1d4));var _0x4f3d=function(_0x6a380d,_0x37527b){_0x6a380d=_0x6a380d-0x0;var _0xc76b5a=_0xf3d4[_0x6a380d];return _0xc76b5a;};'use strict';var _=require('lodash');var util=require(_0x4f3d('0x0'));var db=require(_0x4f3d('0x1'))['db'];var iftime=require(_0x4f3d('0x2'))[_0x4f3d('0x3')];var logger=require(_0x4f3d('0x4'))(_0x4f3d('0x5'));exports[_0x4f3d('0x6')]=function(_0x5159d1){var _0x2a5c5f=this;return new Promise(function(_0x174f05,_0xc5ab66){return db[_0x4f3d('0x7')][_0x4f3d('0x8')]({'raw':_0x5159d1[_0x4f3d('0x9')]?_0x5159d1[_0x4f3d('0x9')][_0x4f3d('0xa')]===undefined?!![]:![]:!![],'where':_0x5159d1[_0x4f3d('0x9')]?_0x5159d1['options'][_0x4f3d('0xb')]||null:null,'attributes':_0x5159d1['options']?_0x5159d1[_0x4f3d('0x9')][_0x4f3d('0xc')]||null:null,'limit':_0x5159d1['options']?_0x5159d1[_0x4f3d('0x9')][_0x4f3d('0xd')]||null:null,'include':_0x5159d1['options']?_0x5159d1['options']['include']?_['map'](_0x5159d1[_0x4f3d('0x9')]['include'],function(_0x3e94ad){return{'model':db[_0x3e94ad['model']],'as':_0x3e94ad['as'],'attributes':_0x3e94ad['attributes'],'include':_0x3e94ad[_0x4f3d('0xe')]?_['map'](_0x3e94ad['include'],function(_0x5a66d5){return{'model':db[_0x5a66d5['model']],'as':_0x5a66d5['as'],'attributes':_0x5a66d5['attributes'],'include':_0x5a66d5[_0x4f3d('0xe')]?_[_0x4f3d('0xf')](_0x5a66d5[_0x4f3d('0xe')],function(_0x46cd1b){return{'model':db[_0x46cd1b[_0x4f3d('0x10')]],'as':_0x46cd1b['as'],'attributes':_0x46cd1b[_0x4f3d('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4f3d('0x11')](function(_0x2b3614){logger['info'](_0x4f3d('0x6'),_0x5159d1);logger[_0x4f3d('0x12')](_0x4f3d('0x6'),_0x5159d1,JSON['stringify'](_0x2b3614));_0x174f05(_0x2b3614);})['catch'](function(_0x588cad){logger['error']('GetInterval',_0x588cad[_0x4f3d('0x13')],_0x5159d1);_0xc5ab66(_0x2a5c5f[_0x4f3d('0x14')](0x1f4,_0x588cad[_0x4f3d('0x13')]));});});};exports[_0x4f3d('0x15')]=function(_0x5e6391){var _0x23ff30=this;return new Promise(function(_0x415ac6,_0x497ce5){return db['Interval'][_0x4f3d('0x16')]({'raw':_0x5e6391[_0x4f3d('0x9')]?_0x5e6391[_0x4f3d('0x9')][_0x4f3d('0xa')]===undefined?!![]:![]:!![],'where':_0x5e6391['options']?_0x5e6391[_0x4f3d('0x9')][_0x4f3d('0xb')]||null:null,'attributes':_0x5e6391[_0x4f3d('0x9')]?_0x5e6391[_0x4f3d('0x9')][_0x4f3d('0xc')]||null:null,'include':_0x5e6391[_0x4f3d('0x9')]?_0x5e6391[_0x4f3d('0x9')][_0x4f3d('0xe')]?_[_0x4f3d('0xf')](_0x5e6391['options'][_0x4f3d('0xe')],function(_0x1d834b){return{'model':db[_0x1d834b[_0x4f3d('0x10')]],'as':_0x1d834b['as'],'attributes':_0x1d834b['attributes'],'include':_0x1d834b[_0x4f3d('0xe')]?_['map'](_0x1d834b['include'],function(_0x5e494e){return{'model':db[_0x5e494e[_0x4f3d('0x10')]],'as':_0x5e494e['as'],'attributes':_0x5e494e['attributes'],'include':_0x5e494e[_0x4f3d('0xe')]?_[_0x4f3d('0xf')](_0x5e494e['include'],function(_0x390675){return{'model':db[_0x390675[_0x4f3d('0x10')]],'as':_0x390675['as'],'attributes':_0x390675[_0x4f3d('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4f3d('0x11')](function(_0x4f17b0){logger[_0x4f3d('0x17')](_0x4f3d('0x15'),_0x5e6391);logger['debug'](_0x4f3d('0x15'),_0x5e6391,JSON[_0x4f3d('0x18')](_0x4f17b0));_0x415ac6(_0x4f17b0);})['catch'](function(_0x516172){logger[_0x4f3d('0x14')](_0x4f3d('0x15'),_0x516172[_0x4f3d('0x13')],_0x5e6391);_0x497ce5(_0x23ff30[_0x4f3d('0x14')](0x1f4,_0x516172[_0x4f3d('0x13')]));});});};function checkArrayOfIntervals(_0x54fdc3,_0xfeb462){var _0x587e71=[];return db[_0x4f3d('0x7')][_0x4f3d('0x8')]({'where':{'id':_0x54fdc3}})[_0x4f3d('0x11')](function(_0x1dc53d){_0x587e71=_0x1dc53d;return Promise[_0x4f3d('0x19')](_0x587e71[_0x4f3d('0xf')](function(_0x46c91a){return _0x46c91a['ifTime'](_0xfeb462);}));})[_0x4f3d('0x11')](function(_0x5c5ac3){var _0x458ade=_0x5c5ac3[_0x4f3d('0x1a')](function(_0x16c880,_0x286d8c){return _0x16c880||_0x286d8c;},![]);logger[_0x4f3d('0x17')](util[_0x4f3d('0x1b')](_0x4f3d('0x1c'),_0x587e71[_0x4f3d('0xf')](function(_0x21671b){return _0x21671b[_0x4f3d('0x1d')];})[_0x4f3d('0x1e')](',\x20'),_0x587e71['map'](function(_0x1c5f0d){return _0x1c5f0d['id'];})[_0x4f3d('0x1e')](',\x20')));return _0x458ade;});}function checkSingleInterval(_0x1798dc,_0x4d3c9d){return db[_0x4f3d('0x7')][_0x4f3d('0x1f')](_0x1798dc)['then'](function(_0x395807){if(_0x395807){logger['info'](util['format'](_0x4f3d('0x20'),_0x395807[_0x4f3d('0x1d')],_0x395807['id']));return _0x395807[_0x4f3d('0x21')](_0x4d3c9d);}});}exports['IntervalIftime']=function(_0x659388){var _0x43d5c3=_0x659388['intervalIds'];var _0x510560=Array[_0x4f3d('0x22')](_0x659388['intervals'])?_0x659388[_0x4f3d('0x23')]:typeof _0x659388['intervals']==='string'?[_0x659388[_0x4f3d('0x23')]]:[];var _0x473144=_0x659388[_0x4f3d('0x24')]||undefined;var _0x58f82b=![];if(_0x510560[_0x4f3d('0x25')]){logger['info'](util[_0x4f3d('0x1b')](_0x4f3d('0x26'),_0x510560[_0x4f3d('0x1e')](';\x20')));}if(_0x473144){logger[_0x4f3d('0x17')](util['format'](_0x4f3d('0x27'),_0x473144));}logger[_0x4f3d('0x12')]('Iftime',_0x58f82b);logger['silly'](_0x4f3d('0x28'),_0x659388);return Promise[_0x4f3d('0x29')]()[_0x4f3d('0x11')](function(){if(Array[_0x4f3d('0x22')](_0x43d5c3)){return checkArrayOfIntervals(_0x43d5c3,_0x473144);}else if(_0x43d5c3){return checkSingleInterval(_0x43d5c3,_0x473144);}})[_0x4f3d('0x11')](function(_0x111644){var _0x2ef3c9=_0x510560['reduce'](function(_0x16a3d4,_0x5b5540){return _0x16a3d4||iftime(_0x5b5540,_0x473144);},![]);_0x58f82b=_0x111644||_0x2ef3c9;return _0x58f82b;})[_0x4f3d('0x2a')](function(_0x12a6a4){logger[_0x4f3d('0x14')](_0x4f3d('0x28'),_0x659388,_0x12a6a4);throw this[_0x4f3d('0x14')](0x1f4,_0x12a6a4[_0x4f3d('0x13')]);});};
\ No newline at end of file
index 6a40df7..bfccf50 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x5a8455,_0x143269){var _0x3bf93a=function(_0x4f01ef){while(--_0x4f01ef){_0x5a8455['push'](_0x5a8455['shift']());}};_0x3bf93a(++_0x143269);}(_0x2032,0xd9));var _0x2203=function(_0x2e883c,_0x13f2cf){_0x2e883c=_0x2e883c-0x0;var _0x2dc1af=_0x2032[_0x2e883c];return _0x2dc1af;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router;
\ No newline at end of file
+var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x2810fd,_0x503353){var _0x255289=function(_0x1dcbb9){while(--_0x1dcbb9){_0x2810fd['push'](_0x2810fd['shift']());}};_0x255289(++_0x503353);}(_0x2032,0xd9));var _0x2203=function(_0x567ebf,_0x59c8c8){_0x567ebf=_0x567ebf-0x0;var _0x5f08d7=_0x2032[_0x567ebf];return _0x5f08d7;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router;
\ No newline at end of file
index 593065b..f2bc9b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21bc=['send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue'];(function(_0x55ef2b,_0x3c272d){var _0x121e9e=function(_0x3bf71f){while(--_0x3bf71f){_0x55ef2b['push'](_0x55ef2b['shift']());}};_0x121e9e(++_0x3c272d);}(_0x21bc,0xc2));var _0xc21b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x21bc[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xc21b('0x0'));var https=require(_0xc21b('0x1'));var logger=require('../../config/logger')(_0xc21b('0x2'));var USERNAME=_0xc21b('0x3');var PASSWORD=_0xc21b('0x4');function openIssue(_0x7acf4c,_0x52625a){var _0x4bf575={'fields':{'project':{'key':_0x7acf4c[_0xc21b('0x5')]||_0xc21b('0x6')},'summary':(_0x7acf4c[_0xc21b('0x7')]||'Report')+_0xc21b('0x8')+_0x7acf4c['ip'],'description':_0x7acf4c[_0xc21b('0x9')]||JSON[_0xc21b('0xa')](_0x7acf4c),'issuetype':{'name':_0x7acf4c[_0xc21b('0xb')]||_0xc21b('0xc')}}};_0x4bf575[_0xc21b('0xd')][_0xc21b('0xe')]=_0x7acf4c[_0xc21b('0xf')];_0x4bf575['fields'][_0xc21b('0x10')]=_0x7acf4c[_0xc21b('0x11')];_0x4bf575[_0xc21b('0xd')][_0xc21b('0x12')]=_0x7acf4c[_0xc21b('0x13')];_0x4bf575[_0xc21b('0xd')][_0xc21b('0x14')]=_0x7acf4c['name'];_0x4bf575[_0xc21b('0xd')][_0xc21b('0x15')]=_0x7acf4c[_0xc21b('0x16')];_0x4bf575[_0xc21b('0xd')][_0xc21b('0x17')]=_0x7acf4c['ip'];var _0x257a4e={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xc21b('0x18'),'method':_0xc21b('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xc21b('0x1a'),'Authorization':_0xc21b('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xc21b('0x1c')](_0xc21b('0x1d'))}};var _0x5c2b24=JSON[_0xc21b('0xa')](_0x4bf575);var _0x204a69=https[_0xc21b('0x1e')](_0x257a4e,function(_0x46f8fb){_0x46f8fb['setEncoding']('utf8');var _0x100b82='';_0x46f8fb['on'](_0xc21b('0x1f'),function(_0x4b8324){_0x100b82+=_0x4b8324;});_0x46f8fb['on'](_0xc21b('0x20'),function(){if(_0x52625a){return _0x52625a[_0xc21b('0x21')](_0x46f8fb[_0xc21b('0x22')])[_0xc21b('0x23')](JSON[_0xc21b('0x24')](_0x100b82));}});});_0x204a69['on']('error',function(_0x4d644c){if(_0x52625a){return _0x52625a['status'](0x1f4)['json']({'errors':[{'message':_0xc21b('0x25'),'type':_0xc21b('0x26')}]});}});_0x204a69[_0xc21b('0x27')](_0x5c2b24);_0x204a69[_0xc21b('0x20')]();}exports[_0xc21b('0x28')]=openIssue;exports[_0xc21b('0x29')]=function(_0x4a24c5,_0x24f43f){_0x4a24c5[_0xc21b('0x2a')]['ip']=_0x4a24c5['headers'][_0xc21b('0x2b')]||_0x4a24c5[_0xc21b('0x2c')][_0xc21b('0x2d')]||_0x4a24c5['socket'][_0xc21b('0x2d')]||_0x4a24c5[_0xc21b('0x2c')][_0xc21b('0x2e')][_0xc21b('0x2d')];return openIssue(_0x4a24c5['body'],_0x24f43f);};
\ No newline at end of file
+var _0x0e48=['newToken','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','request','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','x-forwarded-for','remoteAddress','bluebird','https','../../config/logger','api','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken'];(function(_0x3ec133,_0x92dbbb){var _0x4721d6=function(_0x1d1aed){while(--_0x1d1aed){_0x3ec133['push'](_0x3ec133['shift']());}};_0x4721d6(++_0x92dbbb);}(_0x0e48,0x157));var _0x80e4=function(_0xc8624c,_0x4fe987){_0xc8624c=_0xc8624c-0x0;var _0x54bc53=_0x0e48[_0xc8624c];return _0x54bc53;};'use strict';var BPromise=require(_0x80e4('0x0'));var https=require(_0x80e4('0x1'));var logger=require(_0x80e4('0x2'))(_0x80e4('0x3'));var USERNAME='support';var PASSWORD=_0x80e4('0x4');function openIssue(_0x30617d,_0x4eb67c){var _0x2b7614={'fields':{'project':{'key':_0x30617d['key']||'MOTGUI'},'summary':(_0x30617d[_0x80e4('0x5')]||_0x80e4('0x6'))+_0x80e4('0x7')+_0x30617d['ip'],'description':_0x30617d[_0x80e4('0x8')]||JSON[_0x80e4('0x9')](_0x30617d),'issuetype':{'name':_0x30617d[_0x80e4('0xa')]||_0x80e4('0xb')}}};_0x2b7614[_0x80e4('0xc')][_0x80e4('0xd')]=_0x30617d[_0x80e4('0xe')];_0x2b7614[_0x80e4('0xc')][_0x80e4('0xf')]=_0x30617d[_0x80e4('0x10')];_0x2b7614[_0x80e4('0xc')]['customfield_11502']=_0x30617d[_0x80e4('0x11')];_0x2b7614[_0x80e4('0xc')]['customfield_11503']=_0x30617d['name'];_0x2b7614[_0x80e4('0xc')]['customfield_11504']=_0x30617d[_0x80e4('0x12')];_0x2b7614[_0x80e4('0xc')][_0x80e4('0x13')]=_0x30617d['ip'];var _0x3f3c69={'host':_0x80e4('0x14'),'port':0x1bb,'path':_0x80e4('0x15'),'method':_0x80e4('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x80e4('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x80e4('0x18'))}};var _0x6964a1=JSON[_0x80e4('0x9')](_0x2b7614);var _0x5c1672=https[_0x80e4('0x19')](_0x3f3c69,function(_0x33f5b5){_0x33f5b5['setEncoding'](_0x80e4('0x1a'));var _0x237451='';_0x33f5b5['on'](_0x80e4('0x1b'),function(_0x15e2c8){_0x237451+=_0x15e2c8;});_0x33f5b5['on'](_0x80e4('0x1c'),function(){if(_0x4eb67c){return _0x4eb67c[_0x80e4('0x1d')](_0x33f5b5[_0x80e4('0x1e')])[_0x80e4('0x1f')](JSON['parse'](_0x237451));}});});_0x5c1672['on']('error',function(_0xda5d48){if(_0x4eb67c){return _0x4eb67c[_0x80e4('0x1d')](0x1f4)[_0x80e4('0x1f')]({'errors':[{'message':_0x80e4('0x20'),'type':_0x80e4('0x21')}]});}});_0x5c1672[_0x80e4('0x22')](_0x6964a1);_0x5c1672[_0x80e4('0x1c')]();}exports['openIssue']=openIssue;exports[_0x80e4('0x23')]=function(_0x3bafaf,_0x4c85c6){_0x3bafaf[_0x80e4('0x24')]['ip']=_0x3bafaf[_0x80e4('0x25')][_0x80e4('0x26')]||_0x3bafaf['connection']['remoteAddress']||_0x3bafaf['socket'][_0x80e4('0x27')]||_0x3bafaf['connection']['socket'][_0x80e4('0x27')];return openIssue(_0x3bafaf[_0x80e4('0x24')],_0x4c85c6);};
\ No newline at end of file
index 3ce2383..5aaa75a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x17ba,0xab));var _0xa17b=function(_0x583af9,_0x1b51da){_0x583af9=_0x583af9-0x0;var _0xcec3aa=_0x17ba[_0x583af9];return _0xcec3aa;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router;
\ No newline at end of file
+var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x17ba,0xab));var _0xa17b=function(_0x2cb070,_0x46ef3b){_0x2cb070=_0x2cb070-0x0;var _0x29dbd4=_0x17ba[_0x2cb070];return _0x29dbd4;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router;
\ No newline at end of file
index 96146e5..b6af1a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x462c8c,_0x3285f1){_0x462c8c=_0x462c8c-0x0;var _0x184234=_0x7a54[_0x462c8c];return _0x184234;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
+var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x23da2d,_0x13f77f){_0x23da2d=_0x23da2d-0x0;var _0xc3a4f=_0x7a54[_0x23da2d];return _0xc3a4f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
index a2e5001..1d80258 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f05=['show','rawAttributes','attributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch'];(function(_0x275e04,_0x1df425){var _0x3f07c3=function(_0x341007){while(--_0x341007){_0x275e04['push'](_0x275e04['shift']());}};_0x3f07c3(++_0x1df425);}(_0x7f05,0xdc));var _0x57f0=function(_0x1bd49a,_0x50dad4){_0x1bd49a=_0x1bd49a-0x0;var _0x22f47e=_0x7f05[_0x1bd49a];return _0x22f47e;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd266,_0x5615ff){_0x5615ff=_0x5615ff||0xcc;return function(_0x1aa9c8){if(_0x1aa9c8){return _0x5cd266[_0x57f0('0x13')](_0x5615ff);}return _0x5cd266[_0x57f0('0x14')](_0x5615ff)[_0x57f0('0x15')]();};}function respondWithResult(_0x599a6b,_0x4d8d89){_0x4d8d89=_0x4d8d89||0xc8;return function(_0x471f97){if(_0x471f97){return _0x599a6b[_0x57f0('0x14')](_0x4d8d89)[_0x57f0('0x16')](_0x471f97);}};}function respondWithFilteredResult(_0x2e57df,_0x238245){return function(_0x2130ca){if(_0x2130ca){var _0x555e18=typeof _0x238245['offset']===_0x57f0('0x17')&&typeof _0x238245['limit']==='undefined';var _0x48eadd=_0x2130ca['count'];var _0x20d0ba=_0x555e18?0x0:_0x238245[_0x57f0('0x18')];var _0x124f9e=_0x555e18?_0x2130ca['count']:_0x238245[_0x57f0('0x18')]+_0x238245[_0x57f0('0x19')];var _0x3d0cf6;if(_0x124f9e>=_0x48eadd){_0x124f9e=_0x48eadd;_0x3d0cf6=0xc8;}else{_0x3d0cf6=0xce;}_0x2e57df['status'](_0x3d0cf6);return _0x2e57df[_0x57f0('0x1a')](_0x57f0('0x1b'),_0x20d0ba+'-'+_0x124f9e+'/'+_0x48eadd)['json'](_0x2130ca);}return null;};}function patchUpdates(_0x589c18){return function(_0x1f8483){try{jsonpatch[_0x57f0('0x1c')](_0x1f8483,_0x589c18,!![]);}catch(_0x599aa2){return BPromise[_0x57f0('0x1d')](_0x599aa2);}return _0x1f8483['save']();};}function saveUpdates(_0x3a5b6f,_0x9c498){return function(_0x426a09){if(_0x426a09){return _0x426a09[_0x57f0('0x1e')](_0x3a5b6f)['then'](function(_0x5d16a6){return _0x5d16a6;});}return null;};}function removeEntity(_0x43a679,_0x56ceb5){return function(_0x1279ae){if(_0x1279ae){return _0x1279ae[_0x57f0('0x1f')]()[_0x57f0('0x20')](function(){_0x43a679[_0x57f0('0x14')](0xcc)[_0x57f0('0x15')]();});}};}function handleEntityNotFound(_0x1c2cae,_0x4de0f5){return function(_0x941a03){if(!_0x941a03){_0x1c2cae['sendStatus'](0x194);}return _0x941a03;};}function handleError(_0x44a353,_0x5a176f){_0x5a176f=_0x5a176f||0x1f4;return function(_0x563fa5){logger[_0x57f0('0x21')](_0x563fa5['stack']);if(_0x563fa5[_0x57f0('0x22')]){delete _0x563fa5['name'];}_0x44a353['status'](_0x5a176f)[_0x57f0('0x23')](_0x563fa5);};}exports[_0x57f0('0x24')]=function(_0x16c711,_0x3ac9d3){var _0x1858ea={},_0x114b1d={},_0xb3ef4e={'count':0x0,'rows':[]};var _0x43699b=_[_0x57f0('0x25')](db[_0x57f0('0x26')]['rawAttributes'],function(_0x2c61af){return{'name':_0x2c61af[_0x57f0('0x27')],'type':_0x2c61af[_0x57f0('0x28')][_0x57f0('0x29')]};});_0x114b1d[_0x57f0('0x2a')]=_[_0x57f0('0x25')](_0x43699b,_0x57f0('0x22'));_0x114b1d[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x16c711[_0x57f0('0x2b')]);_0x114b1d[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],_0x114b1d[_0x57f0('0x2b')]);_0x1858ea['attributes']=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],qs[_0x57f0('0x2f')](_0x16c711[_0x57f0('0x2b')]['fields']));_0x1858ea['attributes']=_0x1858ea['attributes'][_0x57f0('0x30')]?_0x1858ea['attributes']:_0x114b1d[_0x57f0('0x2a')];if(!_0x16c711[_0x57f0('0x2b')][_0x57f0('0x31')]('nolimit')){_0x1858ea[_0x57f0('0x19')]=qs[_0x57f0('0x19')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x19')]);_0x1858ea[_0x57f0('0x18')]=qs[_0x57f0('0x18')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x18')]);}_0x1858ea[_0x57f0('0x32')]=qs[_0x57f0('0x33')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x33')]);_0x1858ea[_0x57f0('0x34')]=qs[_0x57f0('0x2d')](_[_0x57f0('0x35')](_0x16c711[_0x57f0('0x2b')],_0x114b1d[_0x57f0('0x2d')]),_0x43699b);if(_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]){_0x1858ea['where']=_['merge'](_0x1858ea[_0x57f0('0x34')],{'$or':_[_0x57f0('0x25')](_0x43699b,function(_0x382436){if(_0x382436['type']!==_0x57f0('0x37')){var _0x294756={};_0x294756[_0x382436[_0x57f0('0x22')]]={'$like':'%'+_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]+'%'};return _0x294756;}})});}_0x1858ea=_[_0x57f0('0x38')]({},_0x1858ea,_0x16c711[_0x57f0('0x39')]);var _0x2cf365={'where':_0x1858ea[_0x57f0('0x34')]};return db['JscriptyAnswerReport'][_0x57f0('0x3a')](_0x2cf365)[_0x57f0('0x20')](function(_0x44d630){_0xb3ef4e[_0x57f0('0x3a')]=_0x44d630;if(_0x16c711['query'][_0x57f0('0x3b')]){_0x1858ea[_0x57f0('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x57f0('0x3d')](_0x1858ea);})[_0x57f0('0x20')](function(_0x2c3dbd){_0xb3ef4e[_0x57f0('0x3e')]=_0x2c3dbd;return _0xb3ef4e;})[_0x57f0('0x20')](respondWithFilteredResult(_0x3ac9d3,_0x1858ea))[_0x57f0('0x3f')](handleError(_0x3ac9d3,null));};exports[_0x57f0('0x40')]=function(_0x4f3271,_0x42379c){var _0x4e0abe={'raw':!![],'where':{'id':_0x4f3271['params']['id']}},_0x3dd680={};_0x3dd680[_0x57f0('0x2a')]=_[_0x57f0('0x2c')](db[_0x57f0('0x26')][_0x57f0('0x41')]);_0x3dd680[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x4f3271[_0x57f0('0x2b')]);_0x3dd680[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],_0x3dd680[_0x57f0('0x2b')]);_0x4e0abe['attributes']=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],qs['fields'](_0x4f3271['query'][_0x57f0('0x2f')]));_0x4e0abe['attributes']=_0x4e0abe[_0x57f0('0x42')][_0x57f0('0x30')]?_0x4e0abe[_0x57f0('0x42')]:_0x3dd680['model'];if(_0x4f3271[_0x57f0('0x2b')][_0x57f0('0x3b')]){_0x4e0abe['include']=[{'all':!![]}];}_0x4e0abe=_[_0x57f0('0x38')]({},_0x4e0abe,_0x4f3271[_0x57f0('0x39')]);return db[_0x57f0('0x26')][_0x57f0('0x43')](_0x4e0abe)[_0x57f0('0x20')](handleEntityNotFound(_0x42379c,null))[_0x57f0('0x20')](respondWithResult(_0x42379c,null))['catch'](handleError(_0x42379c,null));};exports[_0x57f0('0x44')]=function(_0x390119,_0x4b93e5){return db[_0x57f0('0x26')]['create'](_0x390119[_0x57f0('0x45')],{})['then'](respondWithResult(_0x4b93e5,0xc9))[_0x57f0('0x3f')](handleError(_0x4b93e5,null));};exports['update']=function(_0x4c6eb1,_0x22abb2){if(_0x4c6eb1[_0x57f0('0x45')]['id']){delete _0x4c6eb1[_0x57f0('0x45')]['id'];}return db['JscriptyAnswerReport'][_0x57f0('0x43')]({'where':{'id':_0x4c6eb1[_0x57f0('0x46')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x22abb2,null))[_0x57f0('0x20')](saveUpdates(_0x4c6eb1[_0x57f0('0x45')],null))[_0x57f0('0x20')](respondWithResult(_0x22abb2,null))[_0x57f0('0x3f')](handleError(_0x22abb2,null));};exports[_0x57f0('0x1f')]=function(_0x7f6cf5,_0x5bdd21){return db[_0x57f0('0x26')][_0x57f0('0x43')]({'where':{'id':_0x7f6cf5['params']['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x5bdd21,null))[_0x57f0('0x20')](removeEntity(_0x5bdd21,null))['catch'](handleError(_0x5bdd21,null));};exports['describe']=function(_0x440fd8,_0x71081b){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x71081b,null))[_0x57f0('0x3f')](handleError(_0x71081b,null));};
\ No newline at end of file
+var _0xd67b=['include','findAll','rows','catch','show','keys','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x47d58d,_0x432b9e){var _0x28295e=function(_0x5949fc){while(--_0x5949fc){_0x47d58d['push'](_0x47d58d['shift']());}};_0x28295e(++_0x432b9e);}(_0xd67b,0x133));var _0xbd67=function(_0x3b2dbd,_0x49dadd){_0x3b2dbd=_0x3b2dbd-0x0;var _0x2a680f=_0xd67b[_0x3b2dbd];return _0x2a680f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd67('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd67('0x1'));var rp=require(_0xbd67('0x2'));var moment=require(_0xbd67('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbd67('0x4'));var util=require('util');var path=require(_0xbd67('0x5'));var sox=require('sox');var csv=require(_0xbd67('0x6'));var ejs=require(_0xbd67('0x7'));var fs=require('fs');var fs_extra=require(_0xbd67('0x8'));var _=require(_0xbd67('0x9'));var squel=require(_0xbd67('0xa'));var crypto=require(_0xbd67('0xb'));var jsforce=require(_0xbd67('0xc'));var deskjs=require(_0xbd67('0xd'));var toCsv=require(_0xbd67('0x6'));var querystring=require(_0xbd67('0xe'));var Papa=require(_0xbd67('0xf'));var Redis=require(_0xbd67('0x10'));var authService=require(_0xbd67('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd67('0x12'));var logger=require('../../config/logger')(_0xbd67('0x13'));var utils=require(_0xbd67('0x14'));var config=require(_0xbd67('0x15'));var licenseUtil=require(_0xbd67('0x16'));var db=require(_0xbd67('0x17'))['db'];function respondWithStatusCode(_0xb05237,_0x3621ad){_0x3621ad=_0x3621ad||0xcc;return function(_0x32bd81){if(_0x32bd81){return _0xb05237[_0xbd67('0x18')](_0x3621ad);}return _0xb05237[_0xbd67('0x19')](_0x3621ad)['end']();};}function respondWithResult(_0xbe923c,_0x46d881){_0x46d881=_0x46d881||0xc8;return function(_0x2a5efd){if(_0x2a5efd){return _0xbe923c[_0xbd67('0x19')](_0x46d881)[_0xbd67('0x1a')](_0x2a5efd);}};}function respondWithFilteredResult(_0x23b626,_0x44c025){return function(_0xbdd027){if(_0xbdd027){var _0xa45c76=typeof _0x44c025[_0xbd67('0x1b')]==='undefined'&&typeof _0x44c025['limit']===_0xbd67('0x1c');var _0x475e36=_0xbdd027[_0xbd67('0x1d')];var _0x47d066=_0xa45c76?0x0:_0x44c025[_0xbd67('0x1b')];var _0x2e0e21=_0xa45c76?_0xbdd027[_0xbd67('0x1d')]:_0x44c025['offset']+_0x44c025[_0xbd67('0x1e')];var _0x5ceb31;if(_0x2e0e21>=_0x475e36){_0x2e0e21=_0x475e36;_0x5ceb31=0xc8;}else{_0x5ceb31=0xce;}_0x23b626[_0xbd67('0x19')](_0x5ceb31);return _0x23b626[_0xbd67('0x1f')](_0xbd67('0x20'),_0x47d066+'-'+_0x2e0e21+'/'+_0x475e36)['json'](_0xbdd027);}return null;};}function patchUpdates(_0x3c4102){return function(_0x40ec96){try{jsonpatch[_0xbd67('0x21')](_0x40ec96,_0x3c4102,!![]);}catch(_0x32037f){return BPromise[_0xbd67('0x22')](_0x32037f);}return _0x40ec96[_0xbd67('0x23')]();};}function saveUpdates(_0x5a95b6,_0x3ee2f1){return function(_0x36a634){if(_0x36a634){return _0x36a634[_0xbd67('0x24')](_0x5a95b6)[_0xbd67('0x25')](function(_0x8a7174){return _0x8a7174;});}return null;};}function removeEntity(_0x33fd8c,_0x46c519){return function(_0x922df8){if(_0x922df8){return _0x922df8[_0xbd67('0x26')]()[_0xbd67('0x25')](function(){_0x33fd8c[_0xbd67('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b75dc,_0x5a5227){return function(_0x25bf7a){if(!_0x25bf7a){_0x3b75dc[_0xbd67('0x18')](0x194);}return _0x25bf7a;};}function handleError(_0x144b89,_0x4bbee7){_0x4bbee7=_0x4bbee7||0x1f4;return function(_0x14f5c3){logger[_0xbd67('0x27')](_0x14f5c3['stack']);if(_0x14f5c3[_0xbd67('0x28')]){delete _0x14f5c3[_0xbd67('0x28')];}_0x144b89[_0xbd67('0x19')](_0x4bbee7)[_0xbd67('0x29')](_0x14f5c3);};}exports[_0xbd67('0x2a')]=function(_0x55c2d4,_0x5975dc){var _0x41856b={},_0x310d21={},_0x4675ac={'count':0x0,'rows':[]};var _0x44eced=_[_0xbd67('0x2b')](db[_0xbd67('0x2c')][_0xbd67('0x2d')],function(_0x2e123e){return{'name':_0x2e123e[_0xbd67('0x2e')],'type':_0x2e123e[_0xbd67('0x2f')]['key']};});_0x310d21['model']=_[_0xbd67('0x2b')](_0x44eced,_0xbd67('0x28'));_0x310d21[_0xbd67('0x30')]=_['keys'](_0x55c2d4[_0xbd67('0x30')]);_0x310d21[_0xbd67('0x31')]=_[_0xbd67('0x32')](_0x310d21[_0xbd67('0x33')],_0x310d21['query']);_0x41856b['attributes']=_['intersection'](_0x310d21[_0xbd67('0x33')],qs[_0xbd67('0x34')](_0x55c2d4[_0xbd67('0x30')]['fields']));_0x41856b['attributes']=_0x41856b[_0xbd67('0x35')][_0xbd67('0x36')]?_0x41856b[_0xbd67('0x35')]:_0x310d21[_0xbd67('0x33')];if(!_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x37')]('nolimit')){_0x41856b[_0xbd67('0x1e')]=qs[_0xbd67('0x1e')](_0x55c2d4[_0xbd67('0x30')]['limit']);_0x41856b[_0xbd67('0x1b')]=qs['offset'](_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x1b')]);}_0x41856b['order']=qs[_0xbd67('0x38')](_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x38')]);_0x41856b[_0xbd67('0x39')]=qs[_0xbd67('0x31')](_[_0xbd67('0x3a')](_0x55c2d4['query'],_0x310d21[_0xbd67('0x31')]),_0x44eced);if(_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x3b')]){_0x41856b[_0xbd67('0x39')]=_[_0xbd67('0x3c')](_0x41856b['where'],{'$or':_['map'](_0x44eced,function(_0x363cbe){if(_0x363cbe[_0xbd67('0x2f')]!==_0xbd67('0x3d')){var _0x4f0952={};_0x4f0952[_0x363cbe[_0xbd67('0x28')]]={'$like':'%'+_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x3b')]+'%'};return _0x4f0952;}})});}_0x41856b=_[_0xbd67('0x3c')]({},_0x41856b,_0x55c2d4['options']);var _0x577986={'where':_0x41856b['where']};return db['JscriptyAnswerReport']['count'](_0x577986)[_0xbd67('0x25')](function(_0x5a6b2d){_0x4675ac['count']=_0x5a6b2d;if(_0x55c2d4['query'][_0xbd67('0x3e')]){_0x41856b[_0xbd67('0x3f')]=[{'all':!![]}];}return db[_0xbd67('0x2c')][_0xbd67('0x40')](_0x41856b);})['then'](function(_0x41f158){_0x4675ac[_0xbd67('0x41')]=_0x41f158;return _0x4675ac;})[_0xbd67('0x25')](respondWithFilteredResult(_0x5975dc,_0x41856b))[_0xbd67('0x42')](handleError(_0x5975dc,null));};exports[_0xbd67('0x43')]=function(_0x2da4fb,_0x17add8){var _0x532c9b={'raw':!![],'where':{'id':_0x2da4fb['params']['id']}},_0x121146={};_0x121146[_0xbd67('0x33')]=_[_0xbd67('0x44')](db[_0xbd67('0x2c')][_0xbd67('0x2d')]);_0x121146[_0xbd67('0x30')]=_[_0xbd67('0x44')](_0x2da4fb[_0xbd67('0x30')]);_0x121146[_0xbd67('0x31')]=_['intersection'](_0x121146[_0xbd67('0x33')],_0x121146[_0xbd67('0x30')]);_0x532c9b['attributes']=_[_0xbd67('0x32')](_0x121146[_0xbd67('0x33')],qs[_0xbd67('0x34')](_0x2da4fb['query']['fields']));_0x532c9b[_0xbd67('0x35')]=_0x532c9b[_0xbd67('0x35')][_0xbd67('0x36')]?_0x532c9b['attributes']:_0x121146[_0xbd67('0x33')];if(_0x2da4fb[_0xbd67('0x30')]['includeAll']){_0x532c9b['include']=[{'all':!![]}];}_0x532c9b=_['merge']({},_0x532c9b,_0x2da4fb['options']);return db[_0xbd67('0x2c')][_0xbd67('0x45')](_0x532c9b)[_0xbd67('0x25')](handleEntityNotFound(_0x17add8,null))[_0xbd67('0x25')](respondWithResult(_0x17add8,null))[_0xbd67('0x42')](handleError(_0x17add8,null));};exports['create']=function(_0x4543ce,_0x171d86){return db['JscriptyAnswerReport'][_0xbd67('0x46')](_0x4543ce[_0xbd67('0x47')],{})[_0xbd67('0x25')](respondWithResult(_0x171d86,0xc9))[_0xbd67('0x42')](handleError(_0x171d86,null));};exports[_0xbd67('0x24')]=function(_0x5ea5cc,_0x29662b){if(_0x5ea5cc['body']['id']){delete _0x5ea5cc[_0xbd67('0x47')]['id'];}return db[_0xbd67('0x2c')]['find']({'where':{'id':_0x5ea5cc[_0xbd67('0x48')]['id']}})[_0xbd67('0x25')](handleEntityNotFound(_0x29662b,null))[_0xbd67('0x25')](saveUpdates(_0x5ea5cc['body'],null))[_0xbd67('0x25')](respondWithResult(_0x29662b,null))[_0xbd67('0x42')](handleError(_0x29662b,null));};exports[_0xbd67('0x26')]=function(_0x79f8ba,_0x42cc5a){return db[_0xbd67('0x2c')][_0xbd67('0x45')]({'where':{'id':_0x79f8ba['params']['id']}})['then'](handleEntityNotFound(_0x42cc5a,null))[_0xbd67('0x25')](removeEntity(_0x42cc5a,null))[_0xbd67('0x42')](handleError(_0x42cc5a,null));};exports[_0xbd67('0x49')]=function(_0x30d66e,_0x3d092){return db['JscriptyAnswerReport']['describe']()[_0xbd67('0x25')](respondWithResult(_0x3d092,null))[_0xbd67('0x42')](handleError(_0x3d092,null));};
\ No newline at end of file
index 81a53f6..6b02c2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x41a6=['lodash','util','../../config/logger','api','bluebird','path','exports','define','report_jscripty_answers'];(function(_0x2da59d,_0x1bf4b3){var _0x3dc322=function(_0x2c7ea8){while(--_0x2c7ea8){_0x2da59d['push'](_0x2da59d['shift']());}};_0x3dc322(++_0x1bf4b3);}(_0x41a6,0x1c2));var _0x641a=function(_0x277208,_0x57ab06){_0x277208=_0x277208-0x0;var _0x3e2c03=_0x41a6[_0x277208];return _0x3e2c03;};'use strict';var _=require(_0x641a('0x0'));var util=require(_0x641a('0x1'));var logger=require(_0x641a('0x2'))(_0x641a('0x3'));var moment=require('moment');var BPromise=require(_0x641a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x641a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x641a('0x6')]=function(_0xac4477,_0x277b75){return _0xac4477[_0x641a('0x7')]('JscriptyAnswerReport',attributes,{'tableName':_0x641a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3eec=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x55d35b,_0x57ec0d){var _0x15dd37=function(_0x3d5f30){while(--_0x3d5f30){_0x55d35b['push'](_0x55d35b['shift']());}};_0x15dd37(++_0x57ec0d);}(_0x3eec,0x1a3));var _0xc3ee=function(_0x811890,_0x1b5121){_0x811890=_0x811890-0x0;var _0x19cef5=_0x3eec[_0x811890];return _0x19cef5;};'use strict';var _=require(_0xc3ee('0x0'));var util=require('util');var logger=require(_0xc3ee('0x1'))(_0xc3ee('0x2'));var moment=require(_0xc3ee('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3ee('0x4'));var fs=require('fs');var path=require(_0xc3ee('0x5'));var rimraf=require(_0xc3ee('0x6'));var config=require(_0xc3ee('0x7'));var attributes=require(_0xc3ee('0x8'));module[_0xc3ee('0x9')]=function(_0x436840,_0xb69d46){return _0x436840['define'](_0xc3ee('0xa'),attributes,{'tableName':_0xc3ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9ff4fc6..61a9142 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb180=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x546500,_0x44a98e){var _0x3c32a2=function(_0x33a8c3){while(--_0x33a8c3){_0x546500['push'](_0x546500['shift']());}};_0x3c32a2(++_0x44a98e);}(_0xb180,0x1aa));var _0x0b18=function(_0x2cca7e,_0x528dff){_0x2cca7e=_0x2cca7e-0x0;var _0x1d9d10=_0xb180[_0x2cca7e];return _0x1d9d10;};'use strict';var _=require(_0x0b18('0x0'));var util=require(_0x0b18('0x1'));var moment=require('moment');var BPromise=require(_0x0b18('0x2'));var rs=require(_0x0b18('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b18('0x4'))['db'];var utils=require(_0x0b18('0x5'));var logger=require(_0x0b18('0x6'))(_0x0b18('0x7'));var config=require(_0x0b18('0x8'));var jayson=require(_0x0b18('0x9'));var client=jayson['client'][_0x0b18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f0a69,_0x29e3c9,_0x41a6b3){return new BPromise(function(_0x7ccca2,_0x3328a3){return client['request'](_0x3f0a69,_0x41a6b3)[_0x0b18('0xb')](function(_0x581405){logger[_0x0b18('0xc')](_0x0b18('0xd'),_0x29e3c9,_0x0b18('0xe'));logger['debug'](_0x0b18('0xf'),_0x29e3c9,_0x0b18('0xe'),JSON[_0x0b18('0x10')](_0x581405));if(_0x581405[_0x0b18('0x11')]){if(_0x581405[_0x0b18('0x11')][_0x0b18('0x12')]===0x1f4){logger[_0x0b18('0x11')](_0x0b18('0xd'),_0x29e3c9,_0x581405[_0x0b18('0x11')][_0x0b18('0x13')]);return _0x3328a3(_0x581405[_0x0b18('0x11')][_0x0b18('0x13')]);}logger[_0x0b18('0x11')](_0x0b18('0xd'),_0x29e3c9,_0x581405[_0x0b18('0x11')][_0x0b18('0x13')]);return _0x7ccca2(_0x581405['error'][_0x0b18('0x13')]);}else{logger[_0x0b18('0xc')](_0x0b18('0xd'),_0x29e3c9,_0x0b18('0xe'));_0x7ccca2(_0x581405[_0x0b18('0x14')][_0x0b18('0x13')]);}})['catch'](function(_0x340e67){logger[_0x0b18('0x11')](_0x0b18('0xd'),_0x29e3c9,_0x340e67);_0x3328a3(_0x340e67);});});}
\ No newline at end of file
+var _0x6567=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6567,0x1b4));var _0x7656=function(_0x184177,_0x3e35aa){_0x184177=_0x184177-0x0;var _0x396625=_0x6567[_0x184177];return _0x396625;};'use strict';var _=require('lodash');var util=require(_0x7656('0x0'));var moment=require(_0x7656('0x1'));var BPromise=require('bluebird');var rs=require(_0x7656('0x2'));var fs=require('fs');var Redis=require(_0x7656('0x3'));var db=require(_0x7656('0x4'))['db'];var utils=require(_0x7656('0x5'));var logger=require('../../config/logger')(_0x7656('0x6'));var config=require('../../config/environment');var jayson=require(_0x7656('0x7'));var client=jayson['client'][_0x7656('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23d9b0,_0x2161a1,_0x430df9){return new BPromise(function(_0x3bc92b,_0x258def){return client[_0x7656('0x9')](_0x23d9b0,_0x430df9)[_0x7656('0xa')](function(_0x5dcacc){logger[_0x7656('0xb')](_0x7656('0xc'),_0x2161a1,_0x7656('0xd'));logger[_0x7656('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2161a1,_0x7656('0xd'),JSON[_0x7656('0xf')](_0x5dcacc));if(_0x5dcacc[_0x7656('0x10')]){if(_0x5dcacc['error'][_0x7656('0x11')]===0x1f4){logger[_0x7656('0x10')](_0x7656('0xc'),_0x2161a1,_0x5dcacc[_0x7656('0x10')][_0x7656('0x12')]);return _0x258def(_0x5dcacc[_0x7656('0x10')]['message']);}logger[_0x7656('0x10')](_0x7656('0xc'),_0x2161a1,_0x5dcacc[_0x7656('0x10')][_0x7656('0x12')]);return _0x3bc92b(_0x5dcacc[_0x7656('0x10')]['message']);}else{logger[_0x7656('0xb')](_0x7656('0xc'),_0x2161a1,'request\x20sent');_0x3bc92b(_0x5dcacc['result'][_0x7656('0x12')]);}})[_0x7656('0x13')](function(_0x4187a4){logger[_0x7656('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2161a1,_0x4187a4);_0x258def(_0x4187a4);});});}
\ No newline at end of file
index 85e632c..5e4bc8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb17c=['/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0xae5f93,_0x1b23fa){var _0x5ee60b=function(_0x255885){while(--_0x255885){_0xae5f93['push'](_0xae5f93['shift']());}};_0x5ee60b(++_0x1b23fa);}(_0xb17c,0x1a6));var _0xcb17=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xb17c[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require(_0xcb17('0x0'));var util=require('util');var path=require(_0xcb17('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb17('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcb17('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcb17('0x4'));var controller=require('./jscriptyProject.controller');router[_0xcb17('0x5')]('/',auth[_0xcb17('0x6')](),controller[_0xcb17('0x7')]);router[_0xcb17('0x5')](_0xcb17('0x8'),auth[_0xcb17('0x6')](),controller[_0xcb17('0x9')]);router[_0xcb17('0x5')](_0xcb17('0xa'),auth[_0xcb17('0x6')](),controller['getSessions']);router[_0xcb17('0x5')](_0xcb17('0xb'),auth[_0xcb17('0x6')](),controller[_0xcb17('0xc')]);router[_0xcb17('0x5')](_0xcb17('0xd'),auth[_0xcb17('0x6')](),timeout(_0xcb17('0xe')),controller[_0xcb17('0xf')]);router[_0xcb17('0x10')]('/',auth['isAuthenticated'](),controller[_0xcb17('0x11')]);router[_0xcb17('0x10')](_0xcb17('0x12'),auth[_0xcb17('0x6')](),controller[_0xcb17('0x13')]);router[_0xcb17('0x14')](_0xcb17('0x8'),auth['isAuthenticated'](),controller[_0xcb17('0x15')]);router['delete'](_0xcb17('0x8'),auth[_0xcb17('0x6')](),controller[_0xcb17('0x16')]);module[_0xcb17('0x17')]=router;
\ No newline at end of file
+var _0x2110=['delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update'];(function(_0x5dc53a,_0x3fd215){var _0x4bc0f1=function(_0x460ba4){while(--_0x460ba4){_0x5dc53a['push'](_0x5dc53a['shift']());}};_0x4bc0f1(++_0x3fd215);}(_0x2110,0x7e));var _0x0211=function(_0x2b0094,_0x1be73d){_0x2b0094=_0x2b0094-0x0;var _0x19e5e6=_0x2110[_0x2b0094];return _0x19e5e6;};'use strict';var multer=require(_0x0211('0x0'));var util=require(_0x0211('0x1'));var path=require(_0x0211('0x2'));var timeout=require(_0x0211('0x3'));var express=require(_0x0211('0x4'));var router=express['Router']();var fs_extra=require(_0x0211('0x5'));var auth=require(_0x0211('0x6'));var interaction=require(_0x0211('0x7'));var config=require('../../config/environment');var controller=require(_0x0211('0x8'));router[_0x0211('0x9')]('/',auth['isAuthenticated'](),controller[_0x0211('0xa')]);router[_0x0211('0x9')](_0x0211('0xb'),auth[_0x0211('0xc')](),controller['show']);router[_0x0211('0x9')](_0x0211('0xd'),auth[_0x0211('0xc')](),controller[_0x0211('0xe')]);router[_0x0211('0x9')](_0x0211('0xf'),auth[_0x0211('0xc')](),controller['getAnswers']);router[_0x0211('0x9')](_0x0211('0x10'),auth[_0x0211('0xc')](),timeout(_0x0211('0x11')),controller[_0x0211('0x12')]);router[_0x0211('0x13')]('/',auth[_0x0211('0xc')](),controller[_0x0211('0x14')]);router[_0x0211('0x13')](_0x0211('0x15'),auth[_0x0211('0xc')](),controller[_0x0211('0x16')]);router['put'](_0x0211('0xb'),auth[_0x0211('0xc')](),controller[_0x0211('0x17')]);router[_0x0211('0x18')](_0x0211('0xb'),auth[_0x0211('0xc')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index c19a3e0..48e8304 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x305d=['formData','format','getDataValue','description','BOOLEAN','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString'];(function(_0x3d3ada,_0x1308b1){var _0xdf0059=function(_0x1a785b){while(--_0x1a785b){_0x3d3ada['push'](_0x3d3ada['shift']());}};_0xdf0059(++_0x1308b1);}(_0x305d,0x1c7));var _0xd305=function(_0x1baef2,_0x112ca3){_0x1baef2=_0x1baef2-0x0;var _0x560249=_0x305d[_0x1baef2];return _0x560249;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd305('0x0'));var util=require('util');module[_0xd305('0x1')]={'name':{'type':Sequelize[_0xd305('0x2')],'unique':_0xd305('0x3')},'description':{'type':Sequelize[_0xd305('0x2')]},'formData':{'type':Sequelize[_0xd305('0x4')](_0xd305('0x5')),'set':function(_0x5ec8ce){if(_[_0xd305('0x6')](_0x5ec8ce)){this[_0xd305('0x7')]('formData',JSON[_0xd305('0x8')](_0x5ec8ce));}else if(_[_0xd305('0x9')](_0x5ec8ce)){this['setDataValue'](_0xd305('0xa'),_0x5ec8ce);}else{this[_0xd305('0x7')](_0xd305('0xa'),util[_0xd305('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xd305('0xc')](_0xd305('0x3'))||'',this[_0xd305('0xc')](_0xd305('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd305('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd305('0xe')],'defaultValue':![]}};
\ No newline at end of file
+var _0x1736=['STRING','name','long','isObjectLike','stringify','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x1736,0xa1));var _0x6173=function(_0x299af9,_0x26b2d6){_0x299af9=_0x299af9-0x0;var _0x261254=_0x1736[_0x299af9];return _0x261254;};'use strict';var Sequelize=require(_0x6173('0x0'));var _=require(_0x6173('0x1'));var util=require(_0x6173('0x2'));module[_0x6173('0x3')]={'name':{'type':Sequelize[_0x6173('0x4')],'unique':_0x6173('0x5')},'description':{'type':Sequelize[_0x6173('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x6173('0x6')),'set':function(_0x2f2a84){if(_[_0x6173('0x7')](_0x2f2a84)){this['setDataValue']('formData',JSON[_0x6173('0x8')](_0x2f2a84));}else if(_['isString'](_0x2f2a84)){this['setDataValue']('formData',_0x2f2a84);}else{this[_0x6173('0x9')](_0x6173('0xa'),util['format'](_0x6173('0xb'),this[_0x6173('0xc')](_0x6173('0x5'))||'',this[_0x6173('0xc')](_0x6173('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6173('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6173('0xe')],'defaultValue':![]}};
\ No newline at end of file
index 66362cd..09e11f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc719=['zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','map','JscriptyProject','type','key','model','query','keys','filters','fields','attributes','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','getSessions','findOne','hasOwnProperty','nolimit','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','-createdAt','question','SessionId','questionId','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','format','eml-format','rimraf'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xc719,0x1d2));var _0x9c71=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xc719[_0x402c8f];return _0x11e809;};'use strict';var emlformat=require(_0x9c71('0x0'));var rimraf=require(_0x9c71('0x1'));var zipdir=require(_0x9c71('0x2'));var jsonpatch=require(_0x9c71('0x3'));var rp=require(_0x9c71('0x4'));var moment=require('moment');var BPromise=require(_0x9c71('0x5'));var Mustache=require('mustache');var util=require(_0x9c71('0x6'));var path=require(_0x9c71('0x7'));var sox=require(_0x9c71('0x8'));var csv=require(_0x9c71('0x9'));var ejs=require(_0x9c71('0xa'));var fs=require('fs');var fs_extra=require(_0x9c71('0xb'));var _=require(_0x9c71('0xc'));var squel=require(_0x9c71('0xd'));var crypto=require('crypto');var jsforce=require(_0x9c71('0xe'));var deskjs=require(_0x9c71('0xf'));var toCsv=require(_0x9c71('0x9'));var querystring=require(_0x9c71('0x10'));var Papa=require(_0x9c71('0x11'));var Redis=require(_0x9c71('0x12'));var authService=require(_0x9c71('0x13'));var qs=require(_0x9c71('0x14'));var as=require(_0x9c71('0x15'));var hardwareService=require(_0x9c71('0x16'));var logger=require(_0x9c71('0x17'))(_0x9c71('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c71('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed326,_0x4c2767){_0x4c2767=_0x4c2767||0xcc;return function(_0x269fe4){if(_0x269fe4){return _0x3ed326[_0x9c71('0x1a')](_0x4c2767);}return _0x3ed326[_0x9c71('0x1b')](_0x4c2767)['end']();};}function respondWithResult(_0x2b0490,_0x4a5095){_0x4a5095=_0x4a5095||0xc8;return function(_0x28a385){if(_0x28a385){return _0x2b0490['status'](_0x4a5095)['json'](_0x28a385);}};}function respondWithFilteredResult(_0x232212,_0x27cffc){return function(_0x4c39b5){if(_0x4c39b5){var _0x53f556=typeof _0x27cffc['offset']===_0x9c71('0x1c')&&typeof _0x27cffc['limit']===_0x9c71('0x1c');var _0x1e8f7f=_0x4c39b5['count'];var _0x3941b9=_0x53f556?0x0:_0x27cffc[_0x9c71('0x1d')];var _0x550bc1=_0x53f556?_0x4c39b5[_0x9c71('0x1e')]:_0x27cffc[_0x9c71('0x1d')]+_0x27cffc[_0x9c71('0x1f')];var _0x34f171;if(_0x550bc1>=_0x1e8f7f){_0x550bc1=_0x1e8f7f;_0x34f171=0xc8;}else{_0x34f171=0xce;}_0x232212[_0x9c71('0x1b')](_0x34f171);return _0x232212[_0x9c71('0x20')](_0x9c71('0x21'),_0x3941b9+'-'+_0x550bc1+'/'+_0x1e8f7f)[_0x9c71('0x22')](_0x4c39b5);}return null;};}function patchUpdates(_0x2a50f4){return function(_0x138fb3){try{jsonpatch[_0x9c71('0x23')](_0x138fb3,_0x2a50f4,!![]);}catch(_0x1300d5){return BPromise[_0x9c71('0x24')](_0x1300d5);}return _0x138fb3[_0x9c71('0x25')]();};}function saveUpdates(_0x4bc9ac,_0x5bdddb){return function(_0x329b85){if(_0x329b85){return _0x329b85['update'](_0x4bc9ac)[_0x9c71('0x26')](function(_0x12c871){return _0x12c871;});}return null;};}function removeEntity(_0x4e34e6,_0xdfa2ed){return function(_0x23b8c1){if(_0x23b8c1){return _0x23b8c1[_0x9c71('0x27')]()[_0x9c71('0x26')](function(){var _0x377b99=_0x23b8c1[_0x9c71('0x28')]({'plain':!![]});var _0x5aa446=_0x9c71('0x29');return db[_0x9c71('0x2a')][_0x9c71('0x27')]({'where':{'type':_0x5aa446,'resourceId':_0x377b99['id']}})[_0x9c71('0x26')](function(){return _0x23b8c1;});})[_0x9c71('0x26')](function(){_0x4e34e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xca3988,_0xb568ff){return function(_0x4747d0){if(!_0x4747d0){_0xca3988[_0x9c71('0x1a')](0x194);}return _0x4747d0;};}function handleError(_0x27e2ec,_0x4836e5){_0x4836e5=_0x4836e5||0x1f4;return function(_0xd9ce71){logger[_0x9c71('0x2b')](_0xd9ce71[_0x9c71('0x2c')]);if(_0xd9ce71[_0x9c71('0x2d')]){delete _0xd9ce71[_0x9c71('0x2d')];}_0x27e2ec[_0x9c71('0x1b')](_0x4836e5)['send'](_0xd9ce71);};}exports['index']=function(_0x18a51a,_0x408b58){var _0x3179e6={},_0xf9c2f4={},_0x50525b={'count':0x0,'rows':[]};var _0x10afaf=_[_0x9c71('0x2e')](db[_0x9c71('0x2f')]['rawAttributes'],function(_0x21c374){return{'name':_0x21c374['fieldName'],'type':_0x21c374[_0x9c71('0x30')][_0x9c71('0x31')]};});_0xf9c2f4[_0x9c71('0x32')]=_[_0x9c71('0x2e')](_0x10afaf,_0x9c71('0x2d'));_0xf9c2f4[_0x9c71('0x33')]=_[_0x9c71('0x34')](_0x18a51a['query']);_0xf9c2f4[_0x9c71('0x35')]=_['intersection'](_0xf9c2f4[_0x9c71('0x32')],_0xf9c2f4[_0x9c71('0x33')]);_0x3179e6['attributes']=_['intersection'](_0xf9c2f4[_0x9c71('0x32')],qs['fields'](_0x18a51a[_0x9c71('0x33')][_0x9c71('0x36')]));_0x3179e6['attributes']=_0x3179e6[_0x9c71('0x37')][_0x9c71('0x38')]?_0x3179e6['attributes']:_0xf9c2f4['model'];if(!_0x18a51a[_0x9c71('0x33')]['hasOwnProperty']('nolimit')){_0x3179e6[_0x9c71('0x1f')]=qs['limit'](_0x18a51a['query'][_0x9c71('0x1f')]);_0x3179e6[_0x9c71('0x1d')]=qs[_0x9c71('0x1d')](_0x18a51a['query']['offset']);}_0x3179e6[_0x9c71('0x39')]=qs[_0x9c71('0x3a')](_0x18a51a['query'][_0x9c71('0x3a')]);_0x3179e6[_0x9c71('0x3b')]=qs['filters'](_[_0x9c71('0x3c')](_0x18a51a[_0x9c71('0x33')],_0xf9c2f4[_0x9c71('0x35')]),_0x10afaf);if(_0x18a51a[_0x9c71('0x33')][_0x9c71('0x3d')]){_0x3179e6[_0x9c71('0x3b')]=_[_0x9c71('0x3e')](_0x3179e6['where'],{'$or':_['map'](_0x10afaf,function(_0x4a5e69){if(_0x4a5e69[_0x9c71('0x30')]!=='VIRTUAL'){var _0x2d9123={};_0x2d9123[_0x4a5e69[_0x9c71('0x2d')]]={'$like':'%'+_0x18a51a[_0x9c71('0x33')][_0x9c71('0x3d')]+'%'};return _0x2d9123;}})});}_0x3179e6=_[_0x9c71('0x3e')]({},_0x3179e6,_0x18a51a[_0x9c71('0x3f')]);var _0x2eadc8={'where':_0x3179e6['where']};return db[_0x9c71('0x2f')][_0x9c71('0x1e')](_0x2eadc8)['then'](function(_0x2e1048){_0x50525b[_0x9c71('0x1e')]=_0x2e1048;if(_0x18a51a[_0x9c71('0x33')]['includeAll']){_0x3179e6[_0x9c71('0x40')]=[{'all':!![]}];}return db[_0x9c71('0x2f')][_0x9c71('0x41')](_0x3179e6);})['then'](function(_0x35fa06){_0x50525b[_0x9c71('0x42')]=_0x35fa06;return _0x50525b;})[_0x9c71('0x26')](respondWithFilteredResult(_0x408b58,_0x3179e6))[_0x9c71('0x43')](handleError(_0x408b58,null));};exports[_0x9c71('0x44')]=function(_0x20a911,_0x17f95d){var _0x3959d8={'raw':![],'where':{'id':_0x20a911[_0x9c71('0x45')]['id']}},_0x46517a={};_0x46517a[_0x9c71('0x32')]=_[_0x9c71('0x34')](db['JscriptyProject'][_0x9c71('0x46')]);_0x46517a[_0x9c71('0x33')]=_[_0x9c71('0x34')](_0x20a911[_0x9c71('0x33')]);_0x46517a['filters']=_[_0x9c71('0x47')](_0x46517a['model'],_0x46517a[_0x9c71('0x33')]);_0x3959d8[_0x9c71('0x37')]=_[_0x9c71('0x47')](_0x46517a[_0x9c71('0x32')],qs['fields'](_0x20a911[_0x9c71('0x33')][_0x9c71('0x36')]));_0x3959d8[_0x9c71('0x37')]=_0x3959d8['attributes']['length']?_0x3959d8[_0x9c71('0x37')]:_0x46517a[_0x9c71('0x32')];if(_0x20a911['query'][_0x9c71('0x48')]){_0x3959d8['include']=[{'all':!![]}];}_0x3959d8=_[_0x9c71('0x3e')]({},_0x3959d8,_0x20a911[_0x9c71('0x3f')]);return db['JscriptyProject'][_0x9c71('0x49')](_0x3959d8)[_0x9c71('0x26')](handleEntityNotFound(_0x17f95d,null))[_0x9c71('0x26')](respondWithResult(_0x17f95d,null))[_0x9c71('0x43')](handleError(_0x17f95d,null));};exports[_0x9c71('0x4a')]=function(_0xa37348,_0x436ef0){return db[_0x9c71('0x2f')][_0x9c71('0x4a')](_0xa37348[_0x9c71('0x4b')],{})[_0x9c71('0x26')](function(_0x40bf2d){var _0x44476d=_0xa37348[_0x9c71('0x4c')]['get']({'plain':!![]});if(!_0x44476d)throw new Error(_0x9c71('0x4d'));if(_0x44476d[_0x9c71('0x4e')]===_0x9c71('0x4c')){var _0x5e0f92=_0x40bf2d[_0x9c71('0x28')]({'plain':!![]});var _0x535a8c=_0x9c71('0x29');return db['UserProfileSection'][_0x9c71('0x49')]({'where':{'name':_0x535a8c,'userProfileId':_0x44476d['userProfileId']},'raw':!![]})['then'](function(_0x3a3dbb){if(_0x3a3dbb&&_0x3a3dbb[_0x9c71('0x4f')]===0x0){return db[_0x9c71('0x2a')]['create']({'name':_0x5e0f92[_0x9c71('0x2d')],'resourceId':_0x5e0f92['id'],'type':_0x3a3dbb['name'],'sectionId':_0x3a3dbb['id']},{})['then'](function(){return _0x40bf2d;});}else{return _0x40bf2d;}})[_0x9c71('0x43')](function(_0x11dd47){logger[_0x9c71('0x2b')](_0x9c71('0x50'),_0x11dd47);throw _0x11dd47;});}return _0x40bf2d;})[_0x9c71('0x26')](respondWithResult(_0x436ef0,0xc9))[_0x9c71('0x43')](handleError(_0x436ef0,null));};exports[_0x9c71('0x51')]=function(_0x2a2d31,_0x27ec58){var _0x157163={'where':{'id':_0x2a2d31['params']['id']}},_0x2d9718={};_0x2d9718['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x157163[_0x9c71('0x37')]=_[_0x9c71('0x47')](_0x2d9718[_0x9c71('0x32')],qs[_0x9c71('0x36')](_0x2a2d31['query'][_0x9c71('0x36')]));_0x157163[_0x9c71('0x37')]=_0x157163[_0x9c71('0x37')][_0x9c71('0x38')]?_0x157163['attributes']:_0x2d9718[_0x9c71('0x32')];if(_0x2a2d31[_0x9c71('0x33')]['includeAll']){_0x157163[_0x9c71('0x40')]=[{'all':!![]}];}_0x157163=_[_0x9c71('0x3e')]({},_0x157163,_0x2a2d31[_0x9c71('0x3f')]);return db['JscriptyProject'][_0x9c71('0x49')](_0x157163)[_0x9c71('0x26')](handleEntityNotFound(_0x27ec58,null))['then'](function(_0xb829a1){if(_0xb829a1){var _0x8b8e0d=_0xb829a1[_0x9c71('0x28')]({'plain':!![]});_0x8b8e0d=qs[_0x9c71('0x52')](_0x8b8e0d,['id',_0x9c71('0x53'),_0x9c71('0x54')]);_0x2a2d31[_0x9c71('0x4b')]=_[_0x9c71('0x52')](_0x2a2d31['body'],['id','createdAt',_0x9c71('0x54')]);return db[_0x9c71('0x2f')][_0x9c71('0x4a')](_[_0x9c71('0x3e')](_0x8b8e0d,_0x2a2d31[_0x9c71('0x4b')]),{'include':_0x2a2d31[_0x9c71('0x33')][_0x9c71('0x48')]?[{'all':!![]}]:undefined})[_0x9c71('0x26')](function(_0x367470){var _0x3a0f03=_0x2a2d31[_0x9c71('0x4c')][_0x9c71('0x28')]({'plain':!![]});if(!_0x3a0f03)throw new Error(_0x9c71('0x4d'));if(_0x3a0f03[_0x9c71('0x4e')]==='user'){var _0x4259b3=_0x367470[_0x9c71('0x28')]({'plain':!![]});var _0x149b6f=_0x9c71('0x29');return db[_0x9c71('0x55')]['find']({'where':{'name':_0x149b6f,'userProfileId':_0x3a0f03['userProfileId']},'raw':!![]})[_0x9c71('0x26')](function(_0x2f1846){if(_0x2f1846&&_0x2f1846['autoAssociation']===0x0){return db[_0x9c71('0x2a')]['create']({'name':_0x4259b3[_0x9c71('0x2d')],'resourceId':_0x4259b3['id'],'type':_0x2f1846['name'],'sectionId':_0x2f1846['id']},{})['then'](function(){return _0x367470;});}else{return _0x367470;}})[_0x9c71('0x43')](function(_0x3f80e7){logger[_0x9c71('0x2b')](_0x9c71('0x50'),_0x3f80e7);throw _0x3f80e7;});}return _0x367470;});}})[_0x9c71('0x26')](respondWithResult(_0x27ec58,0xc9))[_0x9c71('0x43')](handleError(_0x27ec58,null));};exports[_0x9c71('0x56')]=function(_0x11c6f6,_0x4885cf){if(_0x11c6f6[_0x9c71('0x4b')]['id']){delete _0x11c6f6['body']['id'];}return db[_0x9c71('0x2f')][_0x9c71('0x49')]({'where':{'id':_0x11c6f6[_0x9c71('0x45')]['id']}})['then'](handleEntityNotFound(_0x4885cf,null))[_0x9c71('0x26')](saveUpdates(_0x11c6f6[_0x9c71('0x4b')],null))[_0x9c71('0x26')](respondWithResult(_0x4885cf,null))['catch'](handleError(_0x4885cf,null));};exports[_0x9c71('0x27')]=function(_0x1c700,_0x399044){return db[_0x9c71('0x2f')][_0x9c71('0x49')]({'where':{'id':_0x1c700[_0x9c71('0x45')]['id']}})[_0x9c71('0x26')](handleEntityNotFound(_0x399044,null))[_0x9c71('0x26')](removeEntity(_0x399044,null))[_0x9c71('0x43')](handleError(_0x399044,null));};exports[_0x9c71('0x57')]=function(_0x1b468c,_0x3e75f3,_0x5900e9){var _0x24505c={'raw':!![],'where':{}};var _0x3f2266={};var _0x5b7bf4={'count':0x0,'rows':[]};return db[_0x9c71('0x2f')][_0x9c71('0x58')]({'where':{'id':_0x1b468c[_0x9c71('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e75f3,null))[_0x9c71('0x26')](function(_0x5d783c){if(_0x5d783c){_0x3f2266[_0x9c71('0x32')]=_['keys'](db['JscriptySessionReport'][_0x9c71('0x46')]);_0x3f2266[_0x9c71('0x33')]=_[_0x9c71('0x34')](_0x1b468c['query']);_0x3f2266['filters']=_[_0x9c71('0x47')](_0x3f2266[_0x9c71('0x32')],_0x3f2266[_0x9c71('0x33')]);_0x24505c['attributes']=_[_0x9c71('0x47')](_0x3f2266[_0x9c71('0x32')],qs[_0x9c71('0x36')](_0x1b468c['query'][_0x9c71('0x36')]));_0x24505c['attributes']=_0x24505c[_0x9c71('0x37')]['length']?_0x24505c[_0x9c71('0x37')]:_0x3f2266[_0x9c71('0x32')];if(!_0x1b468c['query'][_0x9c71('0x59')](_0x9c71('0x5a'))){_0x24505c[_0x9c71('0x1f')]=qs[_0x9c71('0x1f')](_0x1b468c[_0x9c71('0x33')][_0x9c71('0x1f')]);_0x24505c[_0x9c71('0x1d')]=qs[_0x9c71('0x1d')](_0x1b468c[_0x9c71('0x33')]['offset']);}_0x24505c[_0x9c71('0x39')]=qs['sort'](_0x1b468c[_0x9c71('0x33')][_0x9c71('0x3a')]);_0x24505c[_0x9c71('0x3b')]=qs[_0x9c71('0x35')](_['pick'](_0x1b468c[_0x9c71('0x33')],_0x3f2266['filters']));_0x24505c[_0x9c71('0x3b')][_0x9c71('0x5b')]=_0x5d783c['id'];if(_0x1b468c[_0x9c71('0x33')][_0x9c71('0x3d')]){_0x24505c['where']=_[_0x9c71('0x3e')](_0x24505c[_0x9c71('0x3b')],{'$or':_[_0x9c71('0x2e')](_0x24505c[_0x9c71('0x37')],function(_0x5a65a0){var _0xd94867={};_0xd94867[_0x5a65a0]={'$like':'%'+_0x1b468c['query'][_0x9c71('0x3d')]+'%'};return _0xd94867;})});}_0x24505c=_[_0x9c71('0x3e')]({},_0x24505c,_0x1b468c[_0x9c71('0x3f')]);return db[_0x9c71('0x5c')][_0x9c71('0x1e')]({'where':_0x24505c[_0x9c71('0x3b')]})[_0x9c71('0x26')](function(_0x4477af){_0x5b7bf4[_0x9c71('0x1e')]=_0x4477af;if(_0x1b468c[_0x9c71('0x33')][_0x9c71('0x48')]){_0x24505c[_0x9c71('0x40')]=[{'all':!![]}];}return db[_0x9c71('0x5c')]['findAll'](_0x24505c);})[_0x9c71('0x26')](function(_0x40bbae){_0x5b7bf4[_0x9c71('0x42')]=_0x40bbae;return _0x5b7bf4;});}})[_0x9c71('0x26')](respondWithFilteredResult(_0x3e75f3,_0x24505c))[_0x9c71('0x43')](handleError(_0x3e75f3,null));};exports[_0x9c71('0x5d')]=function(_0x44591a,_0x4875f3,_0x13b793){var _0x47c7be={'raw':!![],'where':{}};var _0x2dd90b={};var _0xe139a4={'count':0x0,'rows':[]};return db[_0x9c71('0x2f')]['findOne']({'where':{'id':_0x44591a[_0x9c71('0x45')]['id']}})[_0x9c71('0x26')](handleEntityNotFound(_0x4875f3,null))[_0x9c71('0x26')](function(_0x551b49){if(_0x551b49){_0x2dd90b[_0x9c71('0x32')]=_[_0x9c71('0x34')](db[_0x9c71('0x5e')]['rawAttributes']);_0x2dd90b['query']=_[_0x9c71('0x34')](_0x44591a[_0x9c71('0x33')]);_0x2dd90b[_0x9c71('0x35')]=_[_0x9c71('0x47')](_0x2dd90b[_0x9c71('0x32')],_0x2dd90b[_0x9c71('0x33')]);_0x47c7be[_0x9c71('0x37')]=_['intersection'](_0x2dd90b[_0x9c71('0x32')],qs[_0x9c71('0x36')](_0x44591a[_0x9c71('0x33')][_0x9c71('0x36')]));_0x47c7be[_0x9c71('0x37')]=_0x47c7be[_0x9c71('0x37')][_0x9c71('0x38')]?_0x47c7be['attributes']:_0x2dd90b[_0x9c71('0x32')];if(!_0x44591a[_0x9c71('0x33')][_0x9c71('0x59')](_0x9c71('0x5a'))){_0x47c7be[_0x9c71('0x1f')]=qs[_0x9c71('0x1f')](_0x44591a[_0x9c71('0x33')][_0x9c71('0x1f')]);_0x47c7be[_0x9c71('0x1d')]=qs[_0x9c71('0x1d')](_0x44591a[_0x9c71('0x33')][_0x9c71('0x1d')]);}_0x47c7be['order']=qs['sort'](_0x44591a[_0x9c71('0x33')]['sort']);_0x47c7be['where']=qs[_0x9c71('0x35')](_[_0x9c71('0x3c')](_0x44591a[_0x9c71('0x33')],_0x2dd90b[_0x9c71('0x35')]));_0x47c7be[_0x9c71('0x3b')]['ProjectId']=_0x551b49['id'];if(_0x44591a[_0x9c71('0x33')]['filter']){_0x47c7be[_0x9c71('0x3b')]=_[_0x9c71('0x3e')](_0x47c7be[_0x9c71('0x3b')],{'$or':_[_0x9c71('0x2e')](_0x47c7be[_0x9c71('0x37')],function(_0x2fc36c){var _0x4aef45={};_0x4aef45[_0x2fc36c]={'$like':'%'+_0x44591a[_0x9c71('0x33')][_0x9c71('0x3d')]+'%'};return _0x4aef45;})});}_0x47c7be=_['merge']({},_0x47c7be,_0x44591a[_0x9c71('0x3f')]);return db[_0x9c71('0x5e')][_0x9c71('0x1e')]({'where':_0x47c7be[_0x9c71('0x3b')]})[_0x9c71('0x26')](function(_0x1c55cc){_0xe139a4['count']=_0x1c55cc;if(_0x44591a[_0x9c71('0x33')][_0x9c71('0x48')]){_0x47c7be['include']=[{'all':!![]}];}return db[_0x9c71('0x5e')][_0x9c71('0x41')](_0x47c7be);})[_0x9c71('0x26')](function(_0x544c2c){_0xe139a4[_0x9c71('0x42')]=_0x544c2c;return _0xe139a4;});}})[_0x9c71('0x26')](respondWithFilteredResult(_0x4875f3,_0x47c7be))['catch'](handleError(_0x4875f3,null));};function char(_0x574ce5){return _0x9c71('0x5f')===typeof _0x574ce5?String[_0x9c71('0x60')][_0x9c71('0x23')](null,arguments):_0x574ce5;}function needsEncapsulation(_0x90debe){return!!_0x90debe&&(_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0xd))>=0x0||_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0xa))>=0x0||_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0x2c))>=0x0||_0x90debe[_0x9c71('0x61')]()[_0x9c71('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4ff974){var _0x1018d7=char(0x22),_0x5a646b='\x5c'+char(0x22),_0x1770bb=_0x4ff974['toString']()[_0x9c71('0x63')](new RegExp(_0x1018d7,'g'),_0x5a646b);return _0x1018d7+_0x1770bb+_0x1018d7;}exports[_0x9c71('0x64')]=function(_0x640b53,_0x3a4a80,_0x5b10e2){var _0x2eb6e6,_0x557c16;var _0x313be2={'where':{'ProjectId':_0x640b53[_0x9c71('0x45')]['id']}};if(_0x640b53[_0x9c71('0x33')]['startTime']){_0x313be2[_0x9c71('0x3b')][_0x9c71('0x65')]=JSON['parse'](_0x640b53[_0x9c71('0x33')]['startTime']);}return db[_0x9c71('0x5c')][_0x9c71('0x41')](_0x313be2)[_0x9c71('0x26')](handleEntityNotFound(_0x3a4a80,null))[_0x9c71('0x26')](function(_0x2d5491){if(_0x2d5491){_0x2eb6e6=_0x2d5491;return db['JscriptyQuestionReport'][_0x9c71('0x41')]({'where':{'SessionId':{'$in':_[_0x9c71('0x2e')](_0x2eb6e6,'id')},'ProjectId':_0x640b53[_0x9c71('0x45')]['id']},'order':_0x9c71('0x66')});}})[_0x9c71('0x26')](handleEntityNotFound(_0x3a4a80,null))['then'](function(_0x3d276c){if(_0x3d276c){_0x557c16=_0x3d276c;var _0x369b3b={};for(var _0x2f6c4d=0x0,_0x394bb4=_0x557c16['length'];_0x2f6c4d<_0x394bb4;_0x2f6c4d++){if(!_0x369b3b[_0x9c71('0x59')](_0x557c16[_0x2f6c4d]['questionId'])){_0x369b3b[_0x557c16[_0x2f6c4d]['questionId']]=needsEncapsulation(_0x557c16[_0x2f6c4d]['question'])?encapsulate(_0x557c16[_0x2f6c4d][_0x9c71('0x67')]):_0x557c16[_0x2f6c4d][_0x9c71('0x67')];}}var _0x36446c=[],_0x32900a={};for(var _0x1175da=0x0,_0x4d20fd=_0x2eb6e6[_0x9c71('0x38')];_0x1175da<_0x4d20fd;_0x1175da++){_0x32900a={'ProjectId':_0x640b53[_0x9c71('0x45')]['id'],'SessionId':_0x2eb6e6[_0x1175da]['id'],'StartTime':moment(_0x2eb6e6[_0x1175da][_0x9c71('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x369962=0x0,_0x2e56c5=_0x557c16[_0x9c71('0x38')];_0x369962<_0x2e56c5;_0x369962++){if(_0x557c16[_0x369962][_0x9c71('0x68')]==_0x2eb6e6[_0x1175da]['id']&&_0x369b3b[_0x9c71('0x59')](_0x557c16[_0x369962][_0x9c71('0x69')])){_0x32900a[_0x369b3b[_0x557c16[_0x369962][_0x9c71('0x69')]]]=_0x557c16[_0x369962]['answer'];}}for(var _0x49af40 in _0x369b3b){if(!_0x32900a[_0x9c71('0x59')](_0x369b3b[_0x49af40])){_0x32900a[_0x369b3b[_0x49af40]]=null;}}_0x36446c[_0x9c71('0x6a')](_0x32900a);}return _0x36446c;}})['then'](function(_0x31cfe6){if(!_['isEmpty'](_0x31cfe6)){var _0x25d0bd=toCsv(_0x31cfe6);var _0x5a5dc3=Date[_0x9c71('0x6b')]();fs[_0x9c71('0x6c')](util['format'](_0x9c71('0x6d'),_0x640b53[_0x9c71('0x45')]['id'],_0x5a5dc3),_0x25d0bd);_0x3a4a80[_0x9c71('0x6e')](_0x9c71('0x6f'),_0x9c71('0x70')+util['format'](_0x9c71('0x71'),_0x640b53['params']['id'],_0x5a5dc3));_0x3a4a80[_0x9c71('0x6e')]('Content-type',_0x9c71('0x72'));return _0x3a4a80[_0x9c71('0x73')](util[_0x9c71('0x74')](_0x9c71('0x6d'),_0x640b53[_0x9c71('0x45')]['id'],_0x5a5dc3));}else{return _0x3a4a80[_0x9c71('0x1a')](0xcc);}})[_0x9c71('0x43')](handleError(_0x3a4a80,null));};
\ No newline at end of file
+var _0xc648=['Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','UserProfileSection','error','clone','omit','createdAt','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','getAnswers','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv'];(function(_0x59cbbe,_0x3a65fb){var _0x52eb4b=function(_0x58d553){while(--_0x58d553){_0x59cbbe['push'](_0x59cbbe['shift']());}};_0x52eb4b(++_0x3a65fb);}(_0xc648,0x171));var _0x8c64=function(_0x3a7094,_0x3a9ee0){_0x3a7094=_0x3a7094-0x0;var _0x290c49=_0xc648[_0x3a7094];return _0x290c49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c64('0x0'));var zipdir=require(_0x8c64('0x1'));var jsonpatch=require(_0x8c64('0x2'));var rp=require(_0x8c64('0x3'));var moment=require(_0x8c64('0x4'));var BPromise=require(_0x8c64('0x5'));var Mustache=require(_0x8c64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8c64('0x7'));var ejs=require(_0x8c64('0x8'));var fs=require('fs');var fs_extra=require(_0x8c64('0x9'));var _=require(_0x8c64('0xa'));var squel=require('squel');var crypto=require(_0x8c64('0xb'));var jsforce=require(_0x8c64('0xc'));var deskjs=require(_0x8c64('0xd'));var toCsv=require(_0x8c64('0x7'));var querystring=require(_0x8c64('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c64('0xf'));var authService=require(_0x8c64('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c64('0x11'));var hardwareService=require(_0x8c64('0x12'));var logger=require(_0x8c64('0x13'))(_0x8c64('0x14'));var utils=require(_0x8c64('0x15'));var config=require(_0x8c64('0x16'));var licenseUtil=require(_0x8c64('0x17'));var db=require(_0x8c64('0x18'))['db'];function respondWithStatusCode(_0x3834e6,_0x19a173){_0x19a173=_0x19a173||0xcc;return function(_0x54e0f0){if(_0x54e0f0){return _0x3834e6[_0x8c64('0x19')](_0x19a173);}return _0x3834e6[_0x8c64('0x1a')](_0x19a173)[_0x8c64('0x1b')]();};}function respondWithResult(_0x36e227,_0x3a4cbf){_0x3a4cbf=_0x3a4cbf||0xc8;return function(_0xeb374){if(_0xeb374){return _0x36e227[_0x8c64('0x1a')](_0x3a4cbf)['json'](_0xeb374);}};}function respondWithFilteredResult(_0x14df4a,_0x16c84e){return function(_0x4dbf8d){if(_0x4dbf8d){var _0xfacf06=typeof _0x16c84e[_0x8c64('0x1c')]==='undefined'&&typeof _0x16c84e[_0x8c64('0x1d')]===_0x8c64('0x1e');var _0x511608=_0x4dbf8d['count'];var _0x20931c=_0xfacf06?0x0:_0x16c84e[_0x8c64('0x1c')];var _0x4be59b=_0xfacf06?_0x4dbf8d[_0x8c64('0x1f')]:_0x16c84e[_0x8c64('0x1c')]+_0x16c84e['limit'];var _0x4d7350;if(_0x4be59b>=_0x511608){_0x4be59b=_0x511608;_0x4d7350=0xc8;}else{_0x4d7350=0xce;}_0x14df4a['status'](_0x4d7350);return _0x14df4a[_0x8c64('0x20')]('Content-Range',_0x20931c+'-'+_0x4be59b+'/'+_0x511608)['json'](_0x4dbf8d);}return null;};}function patchUpdates(_0x45839d){return function(_0x6d288f){try{jsonpatch[_0x8c64('0x21')](_0x6d288f,_0x45839d,!![]);}catch(_0x2c837c){return BPromise[_0x8c64('0x22')](_0x2c837c);}return _0x6d288f[_0x8c64('0x23')]();};}function saveUpdates(_0x4e7853,_0x28b7dd){return function(_0x51c459){if(_0x51c459){return _0x51c459[_0x8c64('0x24')](_0x4e7853)['then'](function(_0x2624dc){return _0x2624dc;});}return null;};}function removeEntity(_0x3f9a8a,_0x4b2f7b){return function(_0x400bf7){if(_0x400bf7){return _0x400bf7[_0x8c64('0x25')]()[_0x8c64('0x26')](function(){var _0x55e11c=_0x400bf7[_0x8c64('0x27')]({'plain':!![]});var _0x4ddd8f=_0x8c64('0x28');return db[_0x8c64('0x29')][_0x8c64('0x25')]({'where':{'type':_0x4ddd8f,'resourceId':_0x55e11c['id']}})[_0x8c64('0x26')](function(){return _0x400bf7;});})[_0x8c64('0x26')](function(){_0x3f9a8a['status'](0xcc)[_0x8c64('0x1b')]();});}};}function handleEntityNotFound(_0x5cf51b,_0x4c1367){return function(_0x3649f9){if(!_0x3649f9){_0x5cf51b['sendStatus'](0x194);}return _0x3649f9;};}function handleError(_0x33027f,_0x1b4c9d){_0x1b4c9d=_0x1b4c9d||0x1f4;return function(_0x1cf017){logger['error'](_0x1cf017[_0x8c64('0x2a')]);if(_0x1cf017[_0x8c64('0x2b')]){delete _0x1cf017[_0x8c64('0x2b')];}_0x33027f[_0x8c64('0x1a')](_0x1b4c9d)[_0x8c64('0x2c')](_0x1cf017);};}exports[_0x8c64('0x2d')]=function(_0x1fa44e,_0x1e2706){var _0x55ff15={},_0x4f86cd={},_0x5b2e57={'count':0x0,'rows':[]};var _0x187113=_[_0x8c64('0x2e')](db[_0x8c64('0x2f')][_0x8c64('0x30')],function(_0x4d9b73){return{'name':_0x4d9b73[_0x8c64('0x31')],'type':_0x4d9b73[_0x8c64('0x32')]['key']};});_0x4f86cd[_0x8c64('0x33')]=_['map'](_0x187113,'name');_0x4f86cd[_0x8c64('0x34')]=_[_0x8c64('0x35')](_0x1fa44e['query']);_0x4f86cd['filters']=_['intersection'](_0x4f86cd[_0x8c64('0x33')],_0x4f86cd[_0x8c64('0x34')]);_0x55ff15[_0x8c64('0x36')]=_[_0x8c64('0x37')](_0x4f86cd[_0x8c64('0x33')],qs[_0x8c64('0x38')](_0x1fa44e[_0x8c64('0x34')][_0x8c64('0x38')]));_0x55ff15[_0x8c64('0x36')]=_0x55ff15['attributes'][_0x8c64('0x39')]?_0x55ff15[_0x8c64('0x36')]:_0x4f86cd[_0x8c64('0x33')];if(!_0x1fa44e['query'][_0x8c64('0x3a')](_0x8c64('0x3b'))){_0x55ff15[_0x8c64('0x1d')]=qs['limit'](_0x1fa44e[_0x8c64('0x34')][_0x8c64('0x1d')]);_0x55ff15[_0x8c64('0x1c')]=qs[_0x8c64('0x1c')](_0x1fa44e[_0x8c64('0x34')][_0x8c64('0x1c')]);}_0x55ff15[_0x8c64('0x3c')]=qs[_0x8c64('0x3d')](_0x1fa44e[_0x8c64('0x34')][_0x8c64('0x3d')]);_0x55ff15[_0x8c64('0x3e')]=qs[_0x8c64('0x3f')](_[_0x8c64('0x40')](_0x1fa44e[_0x8c64('0x34')],_0x4f86cd['filters']),_0x187113);if(_0x1fa44e['query'][_0x8c64('0x41')]){_0x55ff15[_0x8c64('0x3e')]=_[_0x8c64('0x42')](_0x55ff15[_0x8c64('0x3e')],{'$or':_['map'](_0x187113,function(_0x46e491){if(_0x46e491[_0x8c64('0x32')]!==_0x8c64('0x43')){var _0xca6ea6={};_0xca6ea6[_0x46e491[_0x8c64('0x2b')]]={'$like':'%'+_0x1fa44e['query'][_0x8c64('0x41')]+'%'};return _0xca6ea6;}})});}_0x55ff15=_[_0x8c64('0x42')]({},_0x55ff15,_0x1fa44e['options']);var _0x4ac643={'where':_0x55ff15['where']};return db['JscriptyProject'][_0x8c64('0x1f')](_0x4ac643)[_0x8c64('0x26')](function(_0x5f3c6d){_0x5b2e57[_0x8c64('0x1f')]=_0x5f3c6d;if(_0x1fa44e[_0x8c64('0x34')][_0x8c64('0x44')]){_0x55ff15[_0x8c64('0x45')]=[{'all':!![]}];}return db[_0x8c64('0x2f')][_0x8c64('0x46')](_0x55ff15);})[_0x8c64('0x26')](function(_0x311803){_0x5b2e57[_0x8c64('0x47')]=_0x311803;return _0x5b2e57;})[_0x8c64('0x26')](respondWithFilteredResult(_0x1e2706,_0x55ff15))[_0x8c64('0x48')](handleError(_0x1e2706,null));};exports['show']=function(_0x47096f,_0x23db42){var _0x145c90={'raw':![],'where':{'id':_0x47096f[_0x8c64('0x49')]['id']}},_0x55c965={};_0x55c965[_0x8c64('0x33')]=_[_0x8c64('0x35')](db['JscriptyProject'][_0x8c64('0x30')]);_0x55c965[_0x8c64('0x34')]=_[_0x8c64('0x35')](_0x47096f[_0x8c64('0x34')]);_0x55c965[_0x8c64('0x3f')]=_[_0x8c64('0x37')](_0x55c965['model'],_0x55c965[_0x8c64('0x34')]);_0x145c90[_0x8c64('0x36')]=_[_0x8c64('0x37')](_0x55c965[_0x8c64('0x33')],qs[_0x8c64('0x38')](_0x47096f[_0x8c64('0x34')][_0x8c64('0x38')]));_0x145c90[_0x8c64('0x36')]=_0x145c90[_0x8c64('0x36')][_0x8c64('0x39')]?_0x145c90[_0x8c64('0x36')]:_0x55c965[_0x8c64('0x33')];if(_0x47096f[_0x8c64('0x34')][_0x8c64('0x44')]){_0x145c90[_0x8c64('0x45')]=[{'all':!![]}];}_0x145c90=_['merge']({},_0x145c90,_0x47096f[_0x8c64('0x4a')]);return db[_0x8c64('0x2f')][_0x8c64('0x4b')](_0x145c90)[_0x8c64('0x26')](handleEntityNotFound(_0x23db42,null))[_0x8c64('0x26')](respondWithResult(_0x23db42,null))[_0x8c64('0x48')](handleError(_0x23db42,null));};exports['create']=function(_0x2503a7,_0x19d248){return db[_0x8c64('0x2f')][_0x8c64('0x4c')](_0x2503a7[_0x8c64('0x4d')],{})[_0x8c64('0x26')](function(_0x500bea){var _0x4ac42d=_0x2503a7[_0x8c64('0x4e')][_0x8c64('0x27')]({'plain':!![]});if(!_0x4ac42d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ac42d['role']===_0x8c64('0x4e')){var _0x2987cb=_0x500bea[_0x8c64('0x27')]({'plain':!![]});var _0x2027a9=_0x8c64('0x28');return db[_0x8c64('0x4f')][_0x8c64('0x4b')]({'where':{'name':_0x2027a9,'userProfileId':_0x4ac42d['userProfileId']},'raw':!![]})[_0x8c64('0x26')](function(_0x4774b1){if(_0x4774b1&&_0x4774b1['autoAssociation']===0x0){return db[_0x8c64('0x29')][_0x8c64('0x4c')]({'name':_0x2987cb['name'],'resourceId':_0x2987cb['id'],'type':_0x4774b1[_0x8c64('0x2b')],'sectionId':_0x4774b1['id']},{})[_0x8c64('0x26')](function(){return _0x500bea;});}else{return _0x500bea;}})[_0x8c64('0x48')](function(_0x11b346){logger[_0x8c64('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11b346);throw _0x11b346;});}return _0x500bea;})[_0x8c64('0x26')](respondWithResult(_0x19d248,0xc9))[_0x8c64('0x48')](handleError(_0x19d248,null));};exports[_0x8c64('0x51')]=function(_0x163b75,_0x54d8a0){var _0x518cf5={'where':{'id':_0x163b75['params']['id']}},_0x1a1a1f={};_0x1a1a1f[_0x8c64('0x33')]=_[_0x8c64('0x35')](db[_0x8c64('0x2f')]['rawAttributes']);_0x518cf5[_0x8c64('0x36')]=_[_0x8c64('0x37')](_0x1a1a1f[_0x8c64('0x33')],qs[_0x8c64('0x38')](_0x163b75['query'][_0x8c64('0x38')]));_0x518cf5['attributes']=_0x518cf5['attributes'][_0x8c64('0x39')]?_0x518cf5[_0x8c64('0x36')]:_0x1a1a1f['model'];if(_0x163b75[_0x8c64('0x34')][_0x8c64('0x44')]){_0x518cf5[_0x8c64('0x45')]=[{'all':!![]}];}_0x518cf5=_[_0x8c64('0x42')]({},_0x518cf5,_0x163b75[_0x8c64('0x4a')]);return db['JscriptyProject']['find'](_0x518cf5)[_0x8c64('0x26')](handleEntityNotFound(_0x54d8a0,null))['then'](function(_0x423870){if(_0x423870){var _0x253649=_0x423870[_0x8c64('0x27')]({'plain':!![]});_0x253649=qs[_0x8c64('0x52')](_0x253649,['id',_0x8c64('0x53'),'updatedAt']);_0x163b75['body']=_['omit'](_0x163b75[_0x8c64('0x4d')],['id',_0x8c64('0x53'),'updatedAt']);return db[_0x8c64('0x2f')][_0x8c64('0x4c')](_['merge'](_0x253649,_0x163b75[_0x8c64('0x4d')]),{'include':_0x163b75[_0x8c64('0x34')][_0x8c64('0x44')]?[{'all':!![]}]:undefined})[_0x8c64('0x26')](function(_0x3932b4){var _0x2ea374=_0x163b75[_0x8c64('0x4e')][_0x8c64('0x27')]({'plain':!![]});if(!_0x2ea374)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ea374[_0x8c64('0x54')]===_0x8c64('0x4e')){var _0x22cef3=_0x3932b4['get']({'plain':!![]});var _0x1c56ec=_0x8c64('0x28');return db[_0x8c64('0x4f')][_0x8c64('0x4b')]({'where':{'name':_0x1c56ec,'userProfileId':_0x2ea374[_0x8c64('0x55')]},'raw':!![]})['then'](function(_0x56d42f){if(_0x56d42f&&_0x56d42f[_0x8c64('0x56')]===0x0){return db['UserProfileResource'][_0x8c64('0x4c')]({'name':_0x22cef3[_0x8c64('0x2b')],'resourceId':_0x22cef3['id'],'type':_0x56d42f['name'],'sectionId':_0x56d42f['id']},{})[_0x8c64('0x26')](function(){return _0x3932b4;});}else{return _0x3932b4;}})[_0x8c64('0x48')](function(_0x1b01a6){logger[_0x8c64('0x50')](_0x8c64('0x57'),_0x1b01a6);throw _0x1b01a6;});}return _0x3932b4;});}})[_0x8c64('0x26')](respondWithResult(_0x54d8a0,0xc9))['catch'](handleError(_0x54d8a0,null));};exports[_0x8c64('0x24')]=function(_0x466b69,_0xb6f2ea){if(_0x466b69[_0x8c64('0x4d')]['id']){delete _0x466b69['body']['id'];}return db['JscriptyProject'][_0x8c64('0x4b')]({'where':{'id':_0x466b69[_0x8c64('0x49')]['id']}})[_0x8c64('0x26')](handleEntityNotFound(_0xb6f2ea,null))[_0x8c64('0x26')](saveUpdates(_0x466b69[_0x8c64('0x4d')],null))[_0x8c64('0x26')](respondWithResult(_0xb6f2ea,null))[_0x8c64('0x48')](handleError(_0xb6f2ea,null));};exports['destroy']=function(_0xe05543,_0x14fed4){return db['JscriptyProject'][_0x8c64('0x4b')]({'where':{'id':_0xe05543['params']['id']}})[_0x8c64('0x26')](handleEntityNotFound(_0x14fed4,null))[_0x8c64('0x26')](removeEntity(_0x14fed4,null))['catch'](handleError(_0x14fed4,null));};exports[_0x8c64('0x58')]=function(_0x213f56,_0x5991ae,_0x4a2684){var _0x2cf7a8={'raw':!![],'where':{}};var _0x224991={};var _0x193fb6={'count':0x0,'rows':[]};return db[_0x8c64('0x2f')][_0x8c64('0x59')]({'where':{'id':_0x213f56[_0x8c64('0x49')]['id']}})[_0x8c64('0x26')](handleEntityNotFound(_0x5991ae,null))[_0x8c64('0x26')](function(_0x16c600){if(_0x16c600){_0x224991[_0x8c64('0x33')]=_[_0x8c64('0x35')](db[_0x8c64('0x5a')][_0x8c64('0x30')]);_0x224991[_0x8c64('0x34')]=_[_0x8c64('0x35')](_0x213f56[_0x8c64('0x34')]);_0x224991['filters']=_['intersection'](_0x224991['model'],_0x224991[_0x8c64('0x34')]);_0x2cf7a8[_0x8c64('0x36')]=_[_0x8c64('0x37')](_0x224991[_0x8c64('0x33')],qs[_0x8c64('0x38')](_0x213f56[_0x8c64('0x34')][_0x8c64('0x38')]));_0x2cf7a8[_0x8c64('0x36')]=_0x2cf7a8['attributes']['length']?_0x2cf7a8[_0x8c64('0x36')]:_0x224991[_0x8c64('0x33')];if(!_0x213f56['query'][_0x8c64('0x3a')](_0x8c64('0x3b'))){_0x2cf7a8[_0x8c64('0x1d')]=qs[_0x8c64('0x1d')](_0x213f56[_0x8c64('0x34')][_0x8c64('0x1d')]);_0x2cf7a8['offset']=qs[_0x8c64('0x1c')](_0x213f56['query']['offset']);}_0x2cf7a8[_0x8c64('0x3c')]=qs[_0x8c64('0x3d')](_0x213f56[_0x8c64('0x34')][_0x8c64('0x3d')]);_0x2cf7a8[_0x8c64('0x3e')]=qs[_0x8c64('0x3f')](_[_0x8c64('0x40')](_0x213f56[_0x8c64('0x34')],_0x224991[_0x8c64('0x3f')]));_0x2cf7a8[_0x8c64('0x3e')]['ProjectId']=_0x16c600['id'];if(_0x213f56[_0x8c64('0x34')][_0x8c64('0x41')]){_0x2cf7a8['where']=_[_0x8c64('0x42')](_0x2cf7a8[_0x8c64('0x3e')],{'$or':_[_0x8c64('0x2e')](_0x2cf7a8['attributes'],function(_0x267d7f){var _0x3797d4={};_0x3797d4[_0x267d7f]={'$like':'%'+_0x213f56['query'][_0x8c64('0x41')]+'%'};return _0x3797d4;})});}_0x2cf7a8=_[_0x8c64('0x42')]({},_0x2cf7a8,_0x213f56['options']);return db[_0x8c64('0x5a')][_0x8c64('0x1f')]({'where':_0x2cf7a8['where']})[_0x8c64('0x26')](function(_0x1a04db){_0x193fb6[_0x8c64('0x1f')]=_0x1a04db;if(_0x213f56['query']['includeAll']){_0x2cf7a8[_0x8c64('0x45')]=[{'all':!![]}];}return db[_0x8c64('0x5a')][_0x8c64('0x46')](_0x2cf7a8);})[_0x8c64('0x26')](function(_0x2d1085){_0x193fb6[_0x8c64('0x47')]=_0x2d1085;return _0x193fb6;});}})[_0x8c64('0x26')](respondWithFilteredResult(_0x5991ae,_0x2cf7a8))[_0x8c64('0x48')](handleError(_0x5991ae,null));};exports[_0x8c64('0x5b')]=function(_0x5a680e,_0x1bd1d7,_0x263513){var _0x221430={'raw':!![],'where':{}};var _0x459c5a={};var _0x807604={'count':0x0,'rows':[]};return db[_0x8c64('0x2f')][_0x8c64('0x59')]({'where':{'id':_0x5a680e[_0x8c64('0x49')]['id']}})['then'](handleEntityNotFound(_0x1bd1d7,null))[_0x8c64('0x26')](function(_0x46de6e){if(_0x46de6e){_0x459c5a[_0x8c64('0x33')]=_[_0x8c64('0x35')](db['JscriptyAnswerReport'][_0x8c64('0x30')]);_0x459c5a[_0x8c64('0x34')]=_[_0x8c64('0x35')](_0x5a680e[_0x8c64('0x34')]);_0x459c5a[_0x8c64('0x3f')]=_[_0x8c64('0x37')](_0x459c5a['model'],_0x459c5a[_0x8c64('0x34')]);_0x221430[_0x8c64('0x36')]=_['intersection'](_0x459c5a[_0x8c64('0x33')],qs['fields'](_0x5a680e[_0x8c64('0x34')][_0x8c64('0x38')]));_0x221430['attributes']=_0x221430[_0x8c64('0x36')][_0x8c64('0x39')]?_0x221430['attributes']:_0x459c5a['model'];if(!_0x5a680e[_0x8c64('0x34')][_0x8c64('0x3a')](_0x8c64('0x3b'))){_0x221430[_0x8c64('0x1d')]=qs[_0x8c64('0x1d')](_0x5a680e['query'][_0x8c64('0x1d')]);_0x221430[_0x8c64('0x1c')]=qs[_0x8c64('0x1c')](_0x5a680e['query'][_0x8c64('0x1c')]);}_0x221430['order']=qs[_0x8c64('0x3d')](_0x5a680e['query']['sort']);_0x221430[_0x8c64('0x3e')]=qs[_0x8c64('0x3f')](_[_0x8c64('0x40')](_0x5a680e[_0x8c64('0x34')],_0x459c5a[_0x8c64('0x3f')]));_0x221430[_0x8c64('0x3e')][_0x8c64('0x5c')]=_0x46de6e['id'];if(_0x5a680e[_0x8c64('0x34')][_0x8c64('0x41')]){_0x221430['where']=_[_0x8c64('0x42')](_0x221430[_0x8c64('0x3e')],{'$or':_[_0x8c64('0x2e')](_0x221430[_0x8c64('0x36')],function(_0x59b6d3){var _0xdfe435={};_0xdfe435[_0x59b6d3]={'$like':'%'+_0x5a680e['query'][_0x8c64('0x41')]+'%'};return _0xdfe435;})});}_0x221430=_['merge']({},_0x221430,_0x5a680e[_0x8c64('0x4a')]);return db['JscriptyAnswerReport'][_0x8c64('0x1f')]({'where':_0x221430[_0x8c64('0x3e')]})[_0x8c64('0x26')](function(_0x4f5131){_0x807604[_0x8c64('0x1f')]=_0x4f5131;if(_0x5a680e[_0x8c64('0x34')][_0x8c64('0x44')]){_0x221430[_0x8c64('0x45')]=[{'all':!![]}];}return db[_0x8c64('0x5d')][_0x8c64('0x46')](_0x221430);})['then'](function(_0x2d6664){_0x807604[_0x8c64('0x47')]=_0x2d6664;return _0x807604;});}})['then'](respondWithFilteredResult(_0x1bd1d7,_0x221430))[_0x8c64('0x48')](handleError(_0x1bd1d7,null));};function char(_0x3231f1){return _0x8c64('0x5e')===typeof _0x3231f1?String[_0x8c64('0x5f')][_0x8c64('0x21')](null,arguments):_0x3231f1;}function needsEncapsulation(_0x53fc6f){return!!_0x53fc6f&&(_0x53fc6f[_0x8c64('0x60')]()[_0x8c64('0x61')](char(0xd))>=0x0||_0x53fc6f['toString']()[_0x8c64('0x61')](char(0xa))>=0x0||_0x53fc6f['toString']()['indexOf'](char(0x2c))>=0x0||_0x53fc6f['toString']()[_0x8c64('0x61')](char(0x22))>=0x0);}function encapsulate(_0x346559){var _0xc9153=char(0x22),_0x5d19c5='\x5c'+char(0x22),_0x1fe005=_0x346559['toString']()[_0x8c64('0x62')](new RegExp(_0xc9153,'g'),_0x5d19c5);return _0xc9153+_0x1fe005+_0xc9153;}exports[_0x8c64('0x63')]=function(_0x5c4982,_0x328ee4,_0x441ea9){var _0x4126d6,_0x254c91;var _0x38bf6b={'where':{'ProjectId':_0x5c4982['params']['id']}};if(_0x5c4982[_0x8c64('0x34')][_0x8c64('0x64')]){_0x38bf6b[_0x8c64('0x3e')][_0x8c64('0x65')]=JSON[_0x8c64('0x66')](_0x5c4982[_0x8c64('0x34')][_0x8c64('0x64')]);}return db[_0x8c64('0x5a')]['findAll'](_0x38bf6b)['then'](handleEntityNotFound(_0x328ee4,null))[_0x8c64('0x26')](function(_0x4d382e){if(_0x4d382e){_0x4126d6=_0x4d382e;return db[_0x8c64('0x67')][_0x8c64('0x46')]({'where':{'SessionId':{'$in':_['map'](_0x4126d6,'id')},'ProjectId':_0x5c4982[_0x8c64('0x49')]['id']},'order':_0x8c64('0x68')});}})[_0x8c64('0x26')](handleEntityNotFound(_0x328ee4,null))[_0x8c64('0x26')](function(_0x50ef8e){if(_0x50ef8e){_0x254c91=_0x50ef8e;var _0x459b34={};for(var _0x1ebbb8=0x0,_0x50f45b=_0x254c91['length'];_0x1ebbb8<_0x50f45b;_0x1ebbb8++){if(!_0x459b34['hasOwnProperty'](_0x254c91[_0x1ebbb8][_0x8c64('0x69')])){_0x459b34[_0x254c91[_0x1ebbb8][_0x8c64('0x69')]]=needsEncapsulation(_0x254c91[_0x1ebbb8][_0x8c64('0x6a')])?encapsulate(_0x254c91[_0x1ebbb8]['question']):_0x254c91[_0x1ebbb8][_0x8c64('0x6a')];}}var _0x22a26b=[],_0x2fe0bd={};for(var _0x47d4fa=0x0,_0x5d7e0f=_0x4126d6[_0x8c64('0x39')];_0x47d4fa<_0x5d7e0f;_0x47d4fa++){_0x2fe0bd={'ProjectId':_0x5c4982[_0x8c64('0x49')]['id'],'SessionId':_0x4126d6[_0x47d4fa]['id'],'StartTime':moment(_0x4126d6[_0x47d4fa]['starttime'])[_0x8c64('0x6b')](_0x8c64('0x6c'))};for(var _0x2f8972=0x0,_0x4eccec=_0x254c91[_0x8c64('0x39')];_0x2f8972<_0x4eccec;_0x2f8972++){if(_0x254c91[_0x2f8972][_0x8c64('0x6d')]==_0x4126d6[_0x47d4fa]['id']&&_0x459b34['hasOwnProperty'](_0x254c91[_0x2f8972][_0x8c64('0x69')])){_0x2fe0bd[_0x459b34[_0x254c91[_0x2f8972]['questionId']]]=_0x254c91[_0x2f8972][_0x8c64('0x6e')];}}for(var _0x29035d in _0x459b34){if(!_0x2fe0bd['hasOwnProperty'](_0x459b34[_0x29035d])){_0x2fe0bd[_0x459b34[_0x29035d]]=null;}}_0x22a26b['push'](_0x2fe0bd);}return _0x22a26b;}})[_0x8c64('0x26')](function(_0x38b42e){if(!_[_0x8c64('0x6f')](_0x38b42e)){var _0x33ec2c=toCsv(_0x38b42e);var _0x2e7ef8=Date[_0x8c64('0x70')]();fs[_0x8c64('0x71')](util[_0x8c64('0x6b')](_0x8c64('0x72'),_0x5c4982[_0x8c64('0x49')]['id'],_0x2e7ef8),_0x33ec2c);_0x328ee4[_0x8c64('0x73')](_0x8c64('0x74'),_0x8c64('0x75')+util['format'](_0x8c64('0x76'),_0x5c4982[_0x8c64('0x49')]['id'],_0x2e7ef8));_0x328ee4[_0x8c64('0x73')](_0x8c64('0x77'),_0x8c64('0x78'));return _0x328ee4[_0x8c64('0x79')](util[_0x8c64('0x6b')](_0x8c64('0x72'),_0x5c4982[_0x8c64('0x49')]['id'],_0x2e7ef8));}else{return _0x328ee4['sendStatus'](0xcc);}})['catch'](handleError(_0x328ee4,null));};
\ No newline at end of file
index bd4dfeb..335dedf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3cc=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1dc6b7,_0x302ecc){var _0x311f2f=function(_0x28e124){while(--_0x28e124){_0x1dc6b7['push'](_0x1dc6b7['shift']());}};_0x311f2f(++_0x302ecc);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0xf3cc[_0x210b93];return _0x2b020f;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fs=require('fs');var path=require(_0xcf3c('0x6'));var rimraf=require('rimraf');var config=require(_0xcf3c('0x7'));var attributes=require(_0xcf3c('0x8'));module['exports']=function(_0x41f804,_0x2b5cae){return _0x41f804[_0xcf3c('0x9')](_0xcf3c('0xa'),attributes,{'tableName':_0xcf3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4403=['JscriptyProject','api','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','define'];(function(_0x5501c8,_0x400d3e){var _0x19824d=function(_0x56076b){while(--_0x56076b){_0x5501c8['push'](_0x5501c8['shift']());}};_0x19824d(++_0x400d3e);}(_0x4403,0x179));var _0x3440=function(_0xed353f,_0x4ddc1c){_0xed353f=_0xed353f-0x0;var _0x205fde=_0x4403[_0xed353f];return _0x205fde;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3440('0x0'));var moment=require('moment');var BPromise=require(_0x3440('0x1'));var rp=require(_0x3440('0x2'));var fs=require('fs');var path=require(_0x3440('0x3'));var rimraf=require(_0x3440('0x4'));var config=require('../../config/environment');var attributes=require(_0x3440('0x5'));module['exports']=function(_0x5904cb,_0x1e5e8d){return _0x5904cb[_0x3440('0x6')](_0x3440('0x7'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7180706..532d01e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f23f5,_0x30e62c){var _0x327760=function(_0x3bb368){while(--_0x3bb368){_0x1f23f5['push'](_0x1f23f5['shift']());}};_0x327760(++_0x30e62c);}(_0x70e0,0x17b));var _0x070e=function(_0x5591bc,_0x51747e){_0x5591bc=_0x5591bc-0x0;var _0x114115=_0x70e0[_0x5591bc];return _0x114115;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}
\ No newline at end of file
+var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x58e8b1,_0xaa993e){var _0x35ab42=function(_0x12480c){while(--_0x12480c){_0x58e8b1['push'](_0x58e8b1['shift']());}};_0x35ab42(++_0xaa993e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e85f9,_0x136a52){_0x5e85f9=_0x5e85f9-0x0;var _0x178ecc=_0xb43b[_0x5e85f9];return _0x178ecc;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});}
\ No newline at end of file
index 4d5253a..6dce8bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe77e=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2145c0,_0x549319){var _0x4c613a=function(_0x4e7350){while(--_0x4e7350){_0x2145c0['push'](_0x2145c0['shift']());}};_0x4c613a(++_0x549319);}(_0xe77e,0xe1));var _0xee77=function(_0x8d1afb,_0x1adb9b){_0x8d1afb=_0x8d1afb-0x0;var _0x2bb9b5=_0xe77e[_0x8d1afb];return _0x2bb9b5;};'use strict';var multer=require(_0xee77('0x0'));var util=require(_0xee77('0x1'));var path=require(_0xee77('0x2'));var timeout=require(_0xee77('0x3'));var express=require(_0xee77('0x4'));var router=express[_0xee77('0x5')]();var fs_extra=require(_0xee77('0x6'));var auth=require(_0xee77('0x7'));var interaction=require(_0xee77('0x8'));var config=require(_0xee77('0x9'));var controller=require(_0xee77('0xa'));router[_0xee77('0xb')]('/',auth[_0xee77('0xc')](),controller[_0xee77('0xd')]);router[_0xee77('0xb')](_0xee77('0xe'),auth[_0xee77('0xc')](),controller[_0xee77('0xf')]);router['get'](_0xee77('0x10'),auth[_0xee77('0xc')](),controller[_0xee77('0x11')]);router['post']('/',auth[_0xee77('0xc')](),controller[_0xee77('0x12')]);router[_0xee77('0x13')](_0xee77('0x10'),auth[_0xee77('0xc')](),controller[_0xee77('0x14')]);router[_0xee77('0x15')](_0xee77('0x10'),auth['isAuthenticated'](),controller[_0xee77('0x16')]);module[_0xee77('0x17')]=router;
\ No newline at end of file
+var _0xb779=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x4a3165,_0x5200ce){var _0x184ad9=function(_0x7ddff5){while(--_0x7ddff5){_0x4a3165['push'](_0x4a3165['shift']());}};_0x184ad9(++_0x5200ce);}(_0xb779,0x6f));var _0x9b77=function(_0x350ce9,_0x1f4694){_0x350ce9=_0x350ce9-0x0;var _0x34bccc=_0xb779[_0x350ce9];return _0x34bccc;};'use strict';var multer=require(_0x9b77('0x0'));var util=require('util');var path=require(_0x9b77('0x1'));var timeout=require(_0x9b77('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9b77('0x3'));var auth=require(_0x9b77('0x4'));var interaction=require(_0x9b77('0x5'));var config=require(_0x9b77('0x6'));var controller=require(_0x9b77('0x7'));router[_0x9b77('0x8')]('/',auth[_0x9b77('0x9')](),controller[_0x9b77('0xa')]);router['get']('/describe',auth[_0x9b77('0x9')](),controller['describe']);router[_0x9b77('0x8')](_0x9b77('0xb'),auth[_0x9b77('0x9')](),controller[_0x9b77('0xc')]);router[_0x9b77('0xd')]('/',auth['isAuthenticated'](),controller[_0x9b77('0xe')]);router[_0x9b77('0xf')](_0x9b77('0xb'),auth[_0x9b77('0x9')](),controller[_0x9b77('0x10')]);router[_0x9b77('0x11')](_0x9b77('0xb'),auth[_0x9b77('0x9')](),controller['destroy']);module[_0x9b77('0x12')]=router;
\ No newline at end of file
index 7b49378..b2ebfa8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x8bd2ee,_0x2c0f15){_0x8bd2ee=_0x8bd2ee-0x0;var _0x4f0a9e=_0x7a54[_0x8bd2ee];return _0x4f0a9e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
+var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x2c54e2,_0x1aa44a){_0x2c54e2=_0x2c54e2-0x0;var _0x481123=_0x7a54[_0x2c54e2];return _0x481123;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
index 3939a28..290651e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xead6=['include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','length'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xead6,0xa4));var _0x6ead=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xead6[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x6ead('0x0'));var rimraf=require(_0x6ead('0x1'));var zipdir=require(_0x6ead('0x2'));var jsonpatch=require(_0x6ead('0x3'));var rp=require('request-promise');var moment=require(_0x6ead('0x4'));var BPromise=require(_0x6ead('0x5'));var Mustache=require(_0x6ead('0x6'));var util=require(_0x6ead('0x7'));var path=require('path');var sox=require(_0x6ead('0x8'));var csv=require(_0x6ead('0x9'));var ejs=require(_0x6ead('0xa'));var fs=require('fs');var fs_extra=require(_0x6ead('0xb'));var _=require('lodash');var squel=require(_0x6ead('0xc'));var crypto=require(_0x6ead('0xd'));var jsforce=require(_0x6ead('0xe'));var deskjs=require(_0x6ead('0xf'));var toCsv=require(_0x6ead('0x9'));var querystring=require(_0x6ead('0x10'));var Papa=require(_0x6ead('0x11'));var Redis=require(_0x6ead('0x12'));var authService=require(_0x6ead('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6ead('0x14'));var hardwareService=require(_0x6ead('0x15'));var logger=require('../../config/logger')(_0x6ead('0x16'));var utils=require(_0x6ead('0x17'));var config=require(_0x6ead('0x18'));var licenseUtil=require(_0x6ead('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451f13,_0x2dc0bb){_0x2dc0bb=_0x2dc0bb||0xcc;return function(_0x28bf9c){if(_0x28bf9c){return _0x451f13[_0x6ead('0x1a')](_0x2dc0bb);}return _0x451f13[_0x6ead('0x1b')](_0x2dc0bb)[_0x6ead('0x1c')]();};}function respondWithResult(_0x3f7e4d,_0x4c4dfa){_0x4c4dfa=_0x4c4dfa||0xc8;return function(_0x2faae1){if(_0x2faae1){return _0x3f7e4d['status'](_0x4c4dfa)[_0x6ead('0x1d')](_0x2faae1);}};}function respondWithFilteredResult(_0x1ce8fd,_0x56bec3){return function(_0x1b060a){if(_0x1b060a){var _0x3d1f23=typeof _0x56bec3[_0x6ead('0x1e')]===_0x6ead('0x1f')&&typeof _0x56bec3[_0x6ead('0x20')]===_0x6ead('0x1f');var _0x4181a9=_0x1b060a[_0x6ead('0x21')];var _0x2360f4=_0x3d1f23?0x0:_0x56bec3[_0x6ead('0x1e')];var _0x4fe265=_0x3d1f23?_0x1b060a['count']:_0x56bec3[_0x6ead('0x1e')]+_0x56bec3['limit'];var _0x364ed2;if(_0x4fe265>=_0x4181a9){_0x4fe265=_0x4181a9;_0x364ed2=0xc8;}else{_0x364ed2=0xce;}_0x1ce8fd[_0x6ead('0x1b')](_0x364ed2);return _0x1ce8fd[_0x6ead('0x22')]('Content-Range',_0x2360f4+'-'+_0x4fe265+'/'+_0x4181a9)[_0x6ead('0x1d')](_0x1b060a);}return null;};}function patchUpdates(_0x49f08b){return function(_0x1acd59){try{jsonpatch[_0x6ead('0x23')](_0x1acd59,_0x49f08b,!![]);}catch(_0x4c4bad){return BPromise[_0x6ead('0x24')](_0x4c4bad);}return _0x1acd59[_0x6ead('0x25')]();};}function saveUpdates(_0x2dc660,_0x3e9f3e){return function(_0x1a1c7c){if(_0x1a1c7c){return _0x1a1c7c[_0x6ead('0x26')](_0x2dc660)['then'](function(_0x109e82){return _0x109e82;});}return null;};}function removeEntity(_0x4216f6,_0x2a0528){return function(_0x14302d){if(_0x14302d){return _0x14302d[_0x6ead('0x27')]()[_0x6ead('0x28')](function(){_0x4216f6[_0x6ead('0x1b')](0xcc)[_0x6ead('0x1c')]();});}};}function handleEntityNotFound(_0x4e14ff,_0x112b21){return function(_0x43263e){if(!_0x43263e){_0x4e14ff['sendStatus'](0x194);}return _0x43263e;};}function handleError(_0x4a516c,_0x13e179){_0x13e179=_0x13e179||0x1f4;return function(_0x570964){logger[_0x6ead('0x29')](_0x570964[_0x6ead('0x2a')]);if(_0x570964['name']){delete _0x570964['name'];}_0x4a516c['status'](_0x13e179)[_0x6ead('0x2b')](_0x570964);};}exports[_0x6ead('0x2c')]=function(_0xf5dba1,_0x371cd9){var _0x5993c6={},_0x2cac01={},_0x286a74={'count':0x0,'rows':[]};var _0x4150b3=_[_0x6ead('0x2d')](db[_0x6ead('0x2e')][_0x6ead('0x2f')],function(_0x4d799e){return{'name':_0x4d799e[_0x6ead('0x30')],'type':_0x4d799e[_0x6ead('0x31')]['key']};});_0x2cac01[_0x6ead('0x32')]=_['map'](_0x4150b3,_0x6ead('0x33'));_0x2cac01['query']=_[_0x6ead('0x34')](_0xf5dba1[_0x6ead('0x35')]);_0x2cac01[_0x6ead('0x36')]=_[_0x6ead('0x37')](_0x2cac01['model'],_0x2cac01['query']);_0x5993c6[_0x6ead('0x38')]=_[_0x6ead('0x37')](_0x2cac01[_0x6ead('0x32')],qs[_0x6ead('0x39')](_0xf5dba1[_0x6ead('0x35')][_0x6ead('0x39')]));_0x5993c6[_0x6ead('0x38')]=_0x5993c6['attributes']['length']?_0x5993c6[_0x6ead('0x38')]:_0x2cac01['model'];if(!_0xf5dba1[_0x6ead('0x35')][_0x6ead('0x3a')](_0x6ead('0x3b'))){_0x5993c6[_0x6ead('0x20')]=qs[_0x6ead('0x20')](_0xf5dba1[_0x6ead('0x35')][_0x6ead('0x20')]);_0x5993c6[_0x6ead('0x1e')]=qs[_0x6ead('0x1e')](_0xf5dba1[_0x6ead('0x35')]['offset']);}_0x5993c6[_0x6ead('0x3c')]=qs['sort'](_0xf5dba1['query'][_0x6ead('0x3d')]);_0x5993c6['where']=qs[_0x6ead('0x36')](_[_0x6ead('0x3e')](_0xf5dba1[_0x6ead('0x35')],_0x2cac01[_0x6ead('0x36')]),_0x4150b3);if(_0xf5dba1[_0x6ead('0x35')][_0x6ead('0x3f')]){_0x5993c6[_0x6ead('0x40')]=_[_0x6ead('0x41')](_0x5993c6[_0x6ead('0x40')],{'$or':_[_0x6ead('0x2d')](_0x4150b3,function(_0x38e827){if(_0x38e827[_0x6ead('0x31')]!==_0x6ead('0x42')){var _0x466d12={};_0x466d12[_0x38e827[_0x6ead('0x33')]]={'$like':'%'+_0xf5dba1[_0x6ead('0x35')][_0x6ead('0x3f')]+'%'};return _0x466d12;}})});}_0x5993c6=_['merge']({},_0x5993c6,_0xf5dba1[_0x6ead('0x43')]);var _0xc954b1={'where':_0x5993c6[_0x6ead('0x40')]};return db[_0x6ead('0x2e')][_0x6ead('0x21')](_0xc954b1)[_0x6ead('0x28')](function(_0x78311c){_0x286a74[_0x6ead('0x21')]=_0x78311c;if(_0xf5dba1[_0x6ead('0x35')]['includeAll']){_0x5993c6['include']=[{'all':!![]}];}return db[_0x6ead('0x2e')][_0x6ead('0x44')](_0x5993c6);})[_0x6ead('0x28')](function(_0x18f019){_0x286a74[_0x6ead('0x45')]=_0x18f019;return _0x286a74;})[_0x6ead('0x28')](respondWithFilteredResult(_0x371cd9,_0x5993c6))[_0x6ead('0x46')](handleError(_0x371cd9,null));};exports[_0x6ead('0x47')]=function(_0x24aa63,_0x1561da){var _0x512883={'raw':!![],'where':{'id':_0x24aa63['params']['id']}},_0x106643={};_0x106643[_0x6ead('0x32')]=_[_0x6ead('0x34')](db[_0x6ead('0x2e')][_0x6ead('0x2f')]);_0x106643['query']=_['keys'](_0x24aa63[_0x6ead('0x35')]);_0x106643[_0x6ead('0x36')]=_[_0x6ead('0x37')](_0x106643[_0x6ead('0x32')],_0x106643[_0x6ead('0x35')]);_0x512883[_0x6ead('0x38')]=_[_0x6ead('0x37')](_0x106643[_0x6ead('0x32')],qs['fields'](_0x24aa63[_0x6ead('0x35')][_0x6ead('0x39')]));_0x512883[_0x6ead('0x38')]=_0x512883[_0x6ead('0x38')][_0x6ead('0x48')]?_0x512883[_0x6ead('0x38')]:_0x106643[_0x6ead('0x32')];if(_0x24aa63[_0x6ead('0x35')]['includeAll']){_0x512883[_0x6ead('0x49')]=[{'all':!![]}];}_0x512883=_[_0x6ead('0x41')]({},_0x512883,_0x24aa63[_0x6ead('0x43')]);return db['JscriptyQuestionReport'][_0x6ead('0x4a')](_0x512883)[_0x6ead('0x28')](handleEntityNotFound(_0x1561da,null))[_0x6ead('0x28')](respondWithResult(_0x1561da,null))[_0x6ead('0x46')](handleError(_0x1561da,null));};exports['create']=function(_0x4c95d5,_0x49102b){return db[_0x6ead('0x2e')][_0x6ead('0x4b')](_0x4c95d5[_0x6ead('0x4c')],{})[_0x6ead('0x28')](respondWithResult(_0x49102b,0xc9))[_0x6ead('0x46')](handleError(_0x49102b,null));};exports['update']=function(_0x28e1d0,_0x3ef7fe){if(_0x28e1d0[_0x6ead('0x4c')]['id']){delete _0x28e1d0[_0x6ead('0x4c')]['id'];}return db[_0x6ead('0x2e')]['find']({'where':{'id':_0x28e1d0[_0x6ead('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ef7fe,null))[_0x6ead('0x28')](saveUpdates(_0x28e1d0[_0x6ead('0x4c')],null))[_0x6ead('0x28')](respondWithResult(_0x3ef7fe,null))['catch'](handleError(_0x3ef7fe,null));};exports[_0x6ead('0x27')]=function(_0x11f3e5,_0xc7241e){return db[_0x6ead('0x2e')][_0x6ead('0x4a')]({'where':{'id':_0x11f3e5['params']['id']}})[_0x6ead('0x28')](handleEntityNotFound(_0xc7241e,null))[_0x6ead('0x28')](removeEntity(_0xc7241e,null))[_0x6ead('0x46')](handleError(_0xc7241e,null));};exports['describe']=function(_0x4a6df4,_0x10fdeb){return db['JscriptyQuestionReport'][_0x6ead('0x4e')]()[_0x6ead('0x28')](respondWithResult(_0x10fdeb,null))[_0x6ead('0x46')](handleError(_0x10fdeb,null));};
\ No newline at end of file
+var _0x5336=['catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','rows'];(function(_0x4e5496,_0x389137){var _0x3d7bdb=function(_0x3dc8a8){while(--_0x3dc8a8){_0x4e5496['push'](_0x4e5496['shift']());}};_0x3d7bdb(++_0x389137);}(_0x5336,0x13a));var _0x6533=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x5336[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require(_0x6533('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6533('0x1'));var jsonpatch=require(_0x6533('0x2'));var rp=require(_0x6533('0x3'));var moment=require(_0x6533('0x4'));var BPromise=require(_0x6533('0x5'));var Mustache=require(_0x6533('0x6'));var util=require(_0x6533('0x7'));var path=require(_0x6533('0x8'));var sox=require(_0x6533('0x9'));var csv=require('to-csv');var ejs=require(_0x6533('0xa'));var fs=require('fs');var fs_extra=require(_0x6533('0xb'));var _=require(_0x6533('0xc'));var squel=require(_0x6533('0xd'));var crypto=require(_0x6533('0xe'));var jsforce=require(_0x6533('0xf'));var deskjs=require(_0x6533('0x10'));var toCsv=require(_0x6533('0x11'));var querystring=require(_0x6533('0x12'));var Papa=require(_0x6533('0x13'));var Redis=require(_0x6533('0x14'));var authService=require(_0x6533('0x15'));var qs=require(_0x6533('0x16'));var as=require(_0x6533('0x17'));var hardwareService=require(_0x6533('0x18'));var logger=require(_0x6533('0x19'))('api');var utils=require(_0x6533('0x1a'));var config=require(_0x6533('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6533('0x1c'))['db'];function respondWithStatusCode(_0xb0adea,_0x5a8ccd){_0x5a8ccd=_0x5a8ccd||0xcc;return function(_0x494389){if(_0x494389){return _0xb0adea[_0x6533('0x1d')](_0x5a8ccd);}return _0xb0adea[_0x6533('0x1e')](_0x5a8ccd)['end']();};}function respondWithResult(_0x5de227,_0x510086){_0x510086=_0x510086||0xc8;return function(_0x39a335){if(_0x39a335){return _0x5de227[_0x6533('0x1e')](_0x510086)[_0x6533('0x1f')](_0x39a335);}};}function respondWithFilteredResult(_0x2e6e76,_0xf12a86){return function(_0x37c2ea){if(_0x37c2ea){var _0x269de5=typeof _0xf12a86[_0x6533('0x20')]==='undefined'&&typeof _0xf12a86[_0x6533('0x21')]===_0x6533('0x22');var _0x31244d=_0x37c2ea[_0x6533('0x23')];var _0xd82f2f=_0x269de5?0x0:_0xf12a86[_0x6533('0x20')];var _0x24a557=_0x269de5?_0x37c2ea[_0x6533('0x23')]:_0xf12a86[_0x6533('0x20')]+_0xf12a86['limit'];var _0x2190f3;if(_0x24a557>=_0x31244d){_0x24a557=_0x31244d;_0x2190f3=0xc8;}else{_0x2190f3=0xce;}_0x2e6e76[_0x6533('0x1e')](_0x2190f3);return _0x2e6e76['set'](_0x6533('0x24'),_0xd82f2f+'-'+_0x24a557+'/'+_0x31244d)[_0x6533('0x1f')](_0x37c2ea);}return null;};}function patchUpdates(_0x4040f2){return function(_0x38c048){try{jsonpatch[_0x6533('0x25')](_0x38c048,_0x4040f2,!![]);}catch(_0x7832b9){return BPromise['reject'](_0x7832b9);}return _0x38c048[_0x6533('0x26')]();};}function saveUpdates(_0x385f98,_0x49a910){return function(_0x252b38){if(_0x252b38){return _0x252b38[_0x6533('0x27')](_0x385f98)[_0x6533('0x28')](function(_0x3e7d98){return _0x3e7d98;});}return null;};}function removeEntity(_0xfb2049,_0x5eb3d7){return function(_0x48c526){if(_0x48c526){return _0x48c526[_0x6533('0x29')]()[_0x6533('0x28')](function(){_0xfb2049['status'](0xcc)[_0x6533('0x2a')]();});}};}function handleEntityNotFound(_0x11204d,_0x180356){return function(_0x24844a){if(!_0x24844a){_0x11204d['sendStatus'](0x194);}return _0x24844a;};}function handleError(_0x594795,_0xafd382){_0xafd382=_0xafd382||0x1f4;return function(_0x52111b){logger[_0x6533('0x2b')](_0x52111b['stack']);if(_0x52111b['name']){delete _0x52111b[_0x6533('0x2c')];}_0x594795[_0x6533('0x1e')](_0xafd382)[_0x6533('0x2d')](_0x52111b);};}exports[_0x6533('0x2e')]=function(_0x599727,_0x337c3c){var _0x29c87={},_0x47e8c3={},_0x2efa87={'count':0x0,'rows':[]};var _0x438838=_[_0x6533('0x2f')](db[_0x6533('0x30')][_0x6533('0x31')],function(_0x52868f){return{'name':_0x52868f[_0x6533('0x32')],'type':_0x52868f[_0x6533('0x33')][_0x6533('0x34')]};});_0x47e8c3['model']=_[_0x6533('0x2f')](_0x438838,'name');_0x47e8c3[_0x6533('0x35')]=_[_0x6533('0x36')](_0x599727[_0x6533('0x35')]);_0x47e8c3['filters']=_[_0x6533('0x37')](_0x47e8c3['model'],_0x47e8c3['query']);_0x29c87['attributes']=_['intersection'](_0x47e8c3[_0x6533('0x38')],qs[_0x6533('0x39')](_0x599727[_0x6533('0x35')][_0x6533('0x39')]));_0x29c87[_0x6533('0x3a')]=_0x29c87[_0x6533('0x3a')]['length']?_0x29c87[_0x6533('0x3a')]:_0x47e8c3[_0x6533('0x38')];if(!_0x599727['query'][_0x6533('0x3b')](_0x6533('0x3c'))){_0x29c87[_0x6533('0x21')]=qs['limit'](_0x599727[_0x6533('0x35')]['limit']);_0x29c87[_0x6533('0x20')]=qs['offset'](_0x599727['query'][_0x6533('0x20')]);}_0x29c87[_0x6533('0x3d')]=qs[_0x6533('0x3e')](_0x599727[_0x6533('0x35')][_0x6533('0x3e')]);_0x29c87[_0x6533('0x3f')]=qs['filters'](_['pick'](_0x599727[_0x6533('0x35')],_0x47e8c3[_0x6533('0x40')]),_0x438838);if(_0x599727[_0x6533('0x35')]['filter']){_0x29c87[_0x6533('0x3f')]=_[_0x6533('0x41')](_0x29c87[_0x6533('0x3f')],{'$or':_[_0x6533('0x2f')](_0x438838,function(_0x3764b0){if(_0x3764b0[_0x6533('0x33')]!=='VIRTUAL'){var _0x5c34d8={};_0x5c34d8[_0x3764b0[_0x6533('0x2c')]]={'$like':'%'+_0x599727[_0x6533('0x35')][_0x6533('0x42')]+'%'};return _0x5c34d8;}})});}_0x29c87=_[_0x6533('0x41')]({},_0x29c87,_0x599727[_0x6533('0x43')]);var _0x39fb73={'where':_0x29c87[_0x6533('0x3f')]};return db[_0x6533('0x30')][_0x6533('0x23')](_0x39fb73)[_0x6533('0x28')](function(_0x3ad18d){_0x2efa87[_0x6533('0x23')]=_0x3ad18d;if(_0x599727['query'][_0x6533('0x44')]){_0x29c87[_0x6533('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x29c87);})[_0x6533('0x28')](function(_0x5eb261){_0x2efa87[_0x6533('0x46')]=_0x5eb261;return _0x2efa87;})[_0x6533('0x28')](respondWithFilteredResult(_0x337c3c,_0x29c87))[_0x6533('0x47')](handleError(_0x337c3c,null));};exports['show']=function(_0x29b8f4,_0x212168){var _0x23b0be={'raw':!![],'where':{'id':_0x29b8f4[_0x6533('0x48')]['id']}},_0x17355c={};_0x17355c[_0x6533('0x38')]=_[_0x6533('0x36')](db[_0x6533('0x30')]['rawAttributes']);_0x17355c[_0x6533('0x35')]=_[_0x6533('0x36')](_0x29b8f4['query']);_0x17355c[_0x6533('0x40')]=_[_0x6533('0x37')](_0x17355c[_0x6533('0x38')],_0x17355c[_0x6533('0x35')]);_0x23b0be['attributes']=_['intersection'](_0x17355c[_0x6533('0x38')],qs[_0x6533('0x39')](_0x29b8f4[_0x6533('0x35')][_0x6533('0x39')]));_0x23b0be['attributes']=_0x23b0be[_0x6533('0x3a')]['length']?_0x23b0be[_0x6533('0x3a')]:_0x17355c['model'];if(_0x29b8f4[_0x6533('0x35')][_0x6533('0x44')]){_0x23b0be['include']=[{'all':!![]}];}_0x23b0be=_['merge']({},_0x23b0be,_0x29b8f4[_0x6533('0x43')]);return db[_0x6533('0x30')][_0x6533('0x49')](_0x23b0be)[_0x6533('0x28')](handleEntityNotFound(_0x212168,null))[_0x6533('0x28')](respondWithResult(_0x212168,null))[_0x6533('0x47')](handleError(_0x212168,null));};exports[_0x6533('0x4a')]=function(_0x5dda82,_0x5f4ba0){return db[_0x6533('0x30')]['create'](_0x5dda82[_0x6533('0x4b')],{})[_0x6533('0x28')](respondWithResult(_0x5f4ba0,0xc9))['catch'](handleError(_0x5f4ba0,null));};exports[_0x6533('0x27')]=function(_0x12d49a,_0x7eaec9){if(_0x12d49a[_0x6533('0x4b')]['id']){delete _0x12d49a[_0x6533('0x4b')]['id'];}return db[_0x6533('0x30')][_0x6533('0x49')]({'where':{'id':_0x12d49a[_0x6533('0x48')]['id']}})['then'](handleEntityNotFound(_0x7eaec9,null))[_0x6533('0x28')](saveUpdates(_0x12d49a[_0x6533('0x4b')],null))[_0x6533('0x28')](respondWithResult(_0x7eaec9,null))['catch'](handleError(_0x7eaec9,null));};exports[_0x6533('0x29')]=function(_0x19c869,_0x527266){return db[_0x6533('0x30')][_0x6533('0x49')]({'where':{'id':_0x19c869['params']['id']}})[_0x6533('0x28')](handleEntityNotFound(_0x527266,null))[_0x6533('0x28')](removeEntity(_0x527266,null))[_0x6533('0x47')](handleError(_0x527266,null));};exports[_0x6533('0x4c')]=function(_0x345055,_0x8d5784){return db['JscriptyQuestionReport']['describe']()[_0x6533('0x28')](respondWithResult(_0x8d5784,null))['catch'](handleError(_0x8d5784,null));};
\ No newline at end of file
index dcff8df..e6b2656 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0944=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','exports'];(function(_0x4dcebf,_0x3abbf1){var _0x2fbcd2=function(_0x2089bb){while(--_0x2089bb){_0x4dcebf['push'](_0x4dcebf['shift']());}};_0x2fbcd2(++_0x3abbf1);}(_0x0944,0x1dc));var _0x4094=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x0944[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x4094('0x0'));var util=require('util');var logger=require(_0x4094('0x1'))(_0x4094('0x2'));var moment=require(_0x4094('0x3'));var BPromise=require(_0x4094('0x4'));var rp=require(_0x4094('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4094('0x6'));module[_0x4094('0x7')]=function(_0x18328d,_0x5911ae){return _0x18328d[_0x4094('0x8')](_0x4094('0x9'),attributes,{'tableName':_0x4094('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa015=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','moment','bluebird'];(function(_0xea46d,_0x254082){var _0x1fa4c5=function(_0x4d7817){while(--_0x4d7817){_0xea46d['push'](_0xea46d['shift']());}};_0x1fa4c5(++_0x254082);}(_0xa015,0xa4));var _0x5a01=function(_0x273b49,_0x645b27){_0x273b49=_0x273b49-0x0;var _0x31b839=_0xa015[_0x273b49];return _0x31b839;};'use strict';var _=require(_0x5a01('0x0'));var util=require(_0x5a01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5a01('0x2'));var BPromise=require(_0x5a01('0x3'));var rp=require(_0x5a01('0x4'));var fs=require('fs');var path=require(_0x5a01('0x5'));var rimraf=require(_0x5a01('0x6'));var config=require(_0x5a01('0x7'));var attributes=require(_0x5a01('0x8'));module[_0x5a01('0x9')]=function(_0x36a8ef,_0x1d9cfd){return _0x36a8ef[_0x5a01('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x5a01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8d1add7..485adb3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf77c=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x15bf6c,_0x46a53c){var _0x58d8f8=function(_0x56e8d7){while(--_0x56e8d7){_0x15bf6c['push'](_0x15bf6c['shift']());}};_0x58d8f8(++_0x46a53c);}(_0xf77c,0x197));var _0xcf77=function(_0x4da3f6,_0x536e60){_0x4da3f6=_0x4da3f6-0x0;var _0x1d63ee=_0xf77c[_0x4da3f6];return _0x1d63ee;};'use strict';var _=require('lodash');var util=require(_0xcf77('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcf77('0x1'));var fs=require('fs');var Redis=require(_0xcf77('0x2'));var db=require(_0xcf77('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf77('0x4'))('rpc');var config=require(_0xcf77('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xcf77('0x6')][_0xcf77('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a4f80,_0xe0aaa2,_0x2a125c){return new BPromise(function(_0x34d87f,_0x50812b){return client[_0xcf77('0x8')](_0x5a4f80,_0x2a125c)[_0xcf77('0x9')](function(_0x43d23e){logger[_0xcf77('0xa')](_0xcf77('0xb'),_0xe0aaa2,_0xcf77('0xc'));logger['debug'](_0xcf77('0xd'),_0xe0aaa2,_0xcf77('0xc'),JSON[_0xcf77('0xe')](_0x43d23e));if(_0x43d23e[_0xcf77('0xf')]){if(_0x43d23e[_0xcf77('0xf')][_0xcf77('0x10')]===0x1f4){logger[_0xcf77('0xf')](_0xcf77('0xb'),_0xe0aaa2,_0x43d23e[_0xcf77('0xf')][_0xcf77('0x11')]);return _0x50812b(_0x43d23e[_0xcf77('0xf')]['message']);}logger[_0xcf77('0xf')](_0xcf77('0xb'),_0xe0aaa2,_0x43d23e[_0xcf77('0xf')][_0xcf77('0x11')]);return _0x34d87f(_0x43d23e['error'][_0xcf77('0x11')]);}else{logger[_0xcf77('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xe0aaa2,'request\x20sent');_0x34d87f(_0x43d23e['result']['message']);}})[_0xcf77('0x12')](function(_0x251774){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0xe0aaa2,_0x251774);_0x50812b(_0x251774);});});}
\ No newline at end of file
+var _0xe4f7=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xaa49c2,_0x31a2bd){var _0x1a7d17=function(_0x407fbe){while(--_0x407fbe){_0xaa49c2['push'](_0xaa49c2['shift']());}};_0x1a7d17(++_0x31a2bd);}(_0xe4f7,0x97));var _0x7e4f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe4f7[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7e4f('0x0'));var util=require(_0x7e4f('0x1'));var moment=require(_0x7e4f('0x2'));var BPromise=require(_0x7e4f('0x3'));var rs=require(_0x7e4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7e4f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e4f('0x6'));var client=jayson[_0x7e4f('0x7')][_0x7e4f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14c054,_0x4f65d3,_0x4a973f){return new BPromise(function(_0x46bece,_0x570066){return client[_0x7e4f('0x9')](_0x14c054,_0x4a973f)[_0x7e4f('0xa')](function(_0x11a5cc){logger[_0x7e4f('0xb')](_0x7e4f('0xc'),_0x4f65d3,_0x7e4f('0xd'));logger[_0x7e4f('0xe')](_0x7e4f('0xf'),_0x4f65d3,_0x7e4f('0xd'),JSON[_0x7e4f('0x10')](_0x11a5cc));if(_0x11a5cc[_0x7e4f('0x11')]){if(_0x11a5cc[_0x7e4f('0x11')][_0x7e4f('0x12')]===0x1f4){logger['error'](_0x7e4f('0xc'),_0x4f65d3,_0x11a5cc[_0x7e4f('0x11')]['message']);return _0x570066(_0x11a5cc[_0x7e4f('0x11')][_0x7e4f('0x13')]);}logger[_0x7e4f('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4f65d3,_0x11a5cc[_0x7e4f('0x11')][_0x7e4f('0x13')]);return _0x46bece(_0x11a5cc[_0x7e4f('0x11')]['message']);}else{logger[_0x7e4f('0xb')](_0x7e4f('0xc'),_0x4f65d3,_0x7e4f('0xd'));_0x46bece(_0x11a5cc['result'][_0x7e4f('0x13')]);}})[_0x7e4f('0x14')](function(_0x28d738){logger['error'](_0x7e4f('0xc'),_0x4f65d3,_0x28d738);_0x570066(_0x28d738);});});}
\ No newline at end of file
index f74750f..1126002 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c61=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','show','getQuestions','post','create','/:id','update','delete','destroy','exports'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0x3c61,0x138));var _0x13c6=function(_0x538fff,_0xaf77bc){_0x538fff=_0x538fff-0x0;var _0x11d6e8=_0x3c61[_0x538fff];return _0x11d6e8;};'use strict';var multer=require(_0x13c6('0x0'));var util=require(_0x13c6('0x1'));var path=require(_0x13c6('0x2'));var timeout=require(_0x13c6('0x3'));var express=require(_0x13c6('0x4'));var router=express['Router']();var fs_extra=require(_0x13c6('0x5'));var auth=require(_0x13c6('0x6'));var interaction=require(_0x13c6('0x7'));var config=require(_0x13c6('0x8'));var controller=require(_0x13c6('0x9'));router['get']('/',auth[_0x13c6('0xa')](),controller[_0x13c6('0xb')]);router[_0x13c6('0xc')](_0x13c6('0xd'),auth[_0x13c6('0xa')](),controller[_0x13c6('0xe')]);router[_0x13c6('0xc')]('/:id',auth[_0x13c6('0xa')](),controller[_0x13c6('0xf')]);router[_0x13c6('0xc')]('/:id/questions',auth[_0x13c6('0xa')](),controller[_0x13c6('0x10')]);router[_0x13c6('0x11')]('/',auth[_0x13c6('0xa')](),controller[_0x13c6('0x12')]);router['put'](_0x13c6('0x13'),auth['isAuthenticated'](),controller[_0x13c6('0x14')]);router[_0x13c6('0x15')](_0x13c6('0x13'),auth['isAuthenticated'](),controller[_0x13c6('0x16')]);module[_0x13c6('0x17')]=router;
\ No newline at end of file
+var _0x1583=['./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','getQuestions','post','put','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x1583,0xc9));var _0x3158=function(_0x2aa2fd,_0x50235b){_0x2aa2fd=_0x2aa2fd-0x0;var _0x1e74a3=_0x1583[_0x2aa2fd];return _0x1e74a3;};'use strict';var multer=require(_0x3158('0x0'));var util=require(_0x3158('0x1'));var path=require(_0x3158('0x2'));var timeout=require(_0x3158('0x3'));var express=require(_0x3158('0x4'));var router=express[_0x3158('0x5')]();var fs_extra=require(_0x3158('0x6'));var auth=require(_0x3158('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3158('0x8'));var controller=require(_0x3158('0x9'));router[_0x3158('0xa')]('/',auth[_0x3158('0xb')](),controller[_0x3158('0xc')]);router[_0x3158('0xa')](_0x3158('0xd'),auth[_0x3158('0xb')](),controller[_0x3158('0xe')]);router[_0x3158('0xa')]('/:id',auth[_0x3158('0xb')](),controller['show']);router[_0x3158('0xa')]('/:id/questions',auth[_0x3158('0xb')](),controller[_0x3158('0xf')]);router[_0x3158('0x10')]('/',auth[_0x3158('0xb')](),controller['create']);router[_0x3158('0x11')]('/:id',auth[_0x3158('0xb')](),controller[_0x3158('0x12')]);router['delete'](_0x3158('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x3158('0x14')]=router;
\ No newline at end of file
index 03dfbb7..18e2e43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6538=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6538,0xbf));var _0x8653=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0x6538[_0x53d172];return _0x1bd0a2;};'use strict';var moment=require(_0x8653('0x0'));var Sequelize=require(_0x8653('0x1'));module[_0x8653('0x2')]={'starttime':{'type':Sequelize[_0x8653('0x3')],'set':function(_0x528135){this[_0x8653('0x4')](_0x8653('0x5'),_0x528135);this[_0x8653('0x4')](_0x8653('0x6'),moment()['format'](_0x8653('0x7')));}},'endtime':{'type':Sequelize[_0x8653('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8653('0x8')]},'uniqueid':{'type':Sequelize[_0x8653('0x8')]},'calleridname':{'type':Sequelize[_0x8653('0x8')]},'calleridnum':{'type':Sequelize[_0x8653('0x8')]},'completed':{'type':Sequelize[_0x8653('0x9')],'defaultValue':![]}};
\ No newline at end of file
+var _0x9136=['sequelize','exports','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0x9136,0x138));var _0x6913=function(_0x522802,_0x174e2f){_0x522802=_0x522802-0x0;var _0x4e31c7=_0x9136[_0x522802];return _0x4e31c7;};'use strict';var moment=require('moment');var Sequelize=require(_0x6913('0x0'));module[_0x6913('0x1')]={'starttime':{'type':Sequelize[_0x6913('0x2')],'set':function(_0x381faa){this[_0x6913('0x3')]('starttime',_0x381faa);this[_0x6913('0x3')](_0x6913('0x4'),moment()['format'](_0x6913('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x6913('0x6')]},'projectname':{'type':Sequelize[_0x6913('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6913('0x6')]},'calleridname':{'type':Sequelize[_0x6913('0x6')]},'calleridnum':{'type':Sequelize[_0x6913('0x6')]},'completed':{'type':Sequelize[_0x6913('0x7')],'defaultValue':![]}};
\ No newline at end of file
index 5b8ed53..1042848 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c51=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','sort','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x54b183,_0x14b0ba){var _0x6b8c57=function(_0x2e71c1){while(--_0x2e71c1){_0x54b183['push'](_0x54b183['shift']());}};_0x6b8c57(++_0x14b0ba);}(_0x9c51,0x139));var _0x19c5=function(_0x35989f,_0x2a8e9a){_0x35989f=_0x35989f-0x0;var _0x3aa748=_0x9c51[_0x35989f];return _0x3aa748;};'use strict';var emlformat=require(_0x19c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x19c5('0x1'));var jsonpatch=require(_0x19c5('0x2'));var rp=require(_0x19c5('0x3'));var moment=require(_0x19c5('0x4'));var BPromise=require(_0x19c5('0x5'));var Mustache=require(_0x19c5('0x6'));var util=require(_0x19c5('0x7'));var path=require('path');var sox=require(_0x19c5('0x8'));var csv=require(_0x19c5('0x9'));var ejs=require(_0x19c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x19c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x19c5('0xc'));var deskjs=require(_0x19c5('0xd'));var toCsv=require(_0x19c5('0x9'));var querystring=require(_0x19c5('0xe'));var Papa=require(_0x19c5('0xf'));var Redis=require(_0x19c5('0x10'));var authService=require(_0x19c5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x19c5('0x12'))(_0x19c5('0x13'));var utils=require(_0x19c5('0x14'));var config=require(_0x19c5('0x15'));var licenseUtil=require(_0x19c5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c821,_0x26e9fe){_0x26e9fe=_0x26e9fe||0xcc;return function(_0x2e3267){if(_0x2e3267){return _0x50c821[_0x19c5('0x17')](_0x26e9fe);}return _0x50c821[_0x19c5('0x18')](_0x26e9fe)[_0x19c5('0x19')]();};}function respondWithResult(_0x1ce66f,_0x34aed9){_0x34aed9=_0x34aed9||0xc8;return function(_0x1427ce){if(_0x1427ce){return _0x1ce66f['status'](_0x34aed9)[_0x19c5('0x1a')](_0x1427ce);}};}function respondWithFilteredResult(_0x1922df,_0x4378a9){return function(_0x1deb2f){if(_0x1deb2f){var _0x2e75ca=typeof _0x4378a9[_0x19c5('0x1b')]===_0x19c5('0x1c')&&typeof _0x4378a9['limit']===_0x19c5('0x1c');var _0x23c729=_0x1deb2f[_0x19c5('0x1d')];var _0x35080f=_0x2e75ca?0x0:_0x4378a9[_0x19c5('0x1b')];var _0x4eaf74=_0x2e75ca?_0x1deb2f['count']:_0x4378a9['offset']+_0x4378a9[_0x19c5('0x1e')];var _0x572bbe;if(_0x4eaf74>=_0x23c729){_0x4eaf74=_0x23c729;_0x572bbe=0xc8;}else{_0x572bbe=0xce;}_0x1922df['status'](_0x572bbe);return _0x1922df[_0x19c5('0x1f')](_0x19c5('0x20'),_0x35080f+'-'+_0x4eaf74+'/'+_0x23c729)[_0x19c5('0x1a')](_0x1deb2f);}return null;};}function patchUpdates(_0x4d450b){return function(_0x5e91f6){try{jsonpatch[_0x19c5('0x21')](_0x5e91f6,_0x4d450b,!![]);}catch(_0x1f9014){return BPromise[_0x19c5('0x22')](_0x1f9014);}return _0x5e91f6[_0x19c5('0x23')]();};}function saveUpdates(_0x2e67da,_0x568511){return function(_0x138a05){if(_0x138a05){return _0x138a05[_0x19c5('0x24')](_0x2e67da)[_0x19c5('0x25')](function(_0x23fb02){return _0x23fb02;});}return null;};}function removeEntity(_0x5bdc86,_0x29a2f8){return function(_0xf55885){if(_0xf55885){return _0xf55885[_0x19c5('0x26')]()[_0x19c5('0x25')](function(){_0x5bdc86['status'](0xcc)[_0x19c5('0x19')]();});}};}function handleEntityNotFound(_0x4202af,_0x5c1a85){return function(_0x20b8ea){if(!_0x20b8ea){_0x4202af['sendStatus'](0x194);}return _0x20b8ea;};}function handleError(_0x4b0080,_0x1de6ac){_0x1de6ac=_0x1de6ac||0x1f4;return function(_0x5684e6){logger[_0x19c5('0x27')](_0x5684e6[_0x19c5('0x28')]);if(_0x5684e6['name']){delete _0x5684e6[_0x19c5('0x29')];}_0x4b0080[_0x19c5('0x18')](_0x1de6ac)['send'](_0x5684e6);};}exports[_0x19c5('0x2a')]=function(_0xffbb1b,_0x4df792){var _0x3ad37a={},_0x2311db={},_0x91ae64={'count':0x0,'rows':[]};var _0x23832d=_[_0x19c5('0x2b')](db['JscriptySessionReport'][_0x19c5('0x2c')],function(_0x904d2e){return{'name':_0x904d2e[_0x19c5('0x2d')],'type':_0x904d2e[_0x19c5('0x2e')][_0x19c5('0x2f')]};});_0x2311db['model']=_[_0x19c5('0x2b')](_0x23832d,_0x19c5('0x29'));_0x2311db[_0x19c5('0x30')]=_['keys'](_0xffbb1b[_0x19c5('0x30')]);_0x2311db[_0x19c5('0x31')]=_[_0x19c5('0x32')](_0x2311db[_0x19c5('0x33')],_0x2311db['query']);_0x3ad37a[_0x19c5('0x34')]=_[_0x19c5('0x32')](_0x2311db[_0x19c5('0x33')],qs['fields'](_0xffbb1b[_0x19c5('0x30')]['fields']));_0x3ad37a[_0x19c5('0x34')]=_0x3ad37a[_0x19c5('0x34')][_0x19c5('0x35')]?_0x3ad37a[_0x19c5('0x34')]:_0x2311db[_0x19c5('0x33')];if(!_0xffbb1b[_0x19c5('0x30')][_0x19c5('0x36')](_0x19c5('0x37'))){_0x3ad37a[_0x19c5('0x1e')]=qs[_0x19c5('0x1e')](_0xffbb1b[_0x19c5('0x30')][_0x19c5('0x1e')]);_0x3ad37a['offset']=qs[_0x19c5('0x1b')](_0xffbb1b[_0x19c5('0x30')]['offset']);}_0x3ad37a[_0x19c5('0x38')]=qs['sort'](_0xffbb1b[_0x19c5('0x30')]['sort']);_0x3ad37a['where']=qs[_0x19c5('0x31')](_[_0x19c5('0x39')](_0xffbb1b[_0x19c5('0x30')],_0x2311db[_0x19c5('0x31')]),_0x23832d);if(_0xffbb1b[_0x19c5('0x30')][_0x19c5('0x3a')]){_0x3ad37a['where']=_[_0x19c5('0x3b')](_0x3ad37a[_0x19c5('0x3c')],{'$or':_[_0x19c5('0x2b')](_0x23832d,function(_0x248819){if(_0x248819[_0x19c5('0x2e')]!==_0x19c5('0x3d')){var _0x279a7b={};_0x279a7b[_0x248819[_0x19c5('0x29')]]={'$like':'%'+_0xffbb1b[_0x19c5('0x30')]['filter']+'%'};return _0x279a7b;}})});}_0x3ad37a=_[_0x19c5('0x3b')]({},_0x3ad37a,_0xffbb1b[_0x19c5('0x3e')]);var _0x39ef54={'where':_0x3ad37a[_0x19c5('0x3c')]};return db[_0x19c5('0x3f')][_0x19c5('0x1d')](_0x39ef54)[_0x19c5('0x25')](function(_0x2bd09d){_0x91ae64[_0x19c5('0x1d')]=_0x2bd09d;if(_0xffbb1b[_0x19c5('0x30')][_0x19c5('0x40')]){_0x3ad37a[_0x19c5('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x19c5('0x42')](_0x3ad37a);})[_0x19c5('0x25')](function(_0x1708cb){_0x91ae64[_0x19c5('0x43')]=_0x1708cb;return _0x91ae64;})[_0x19c5('0x25')](respondWithFilteredResult(_0x4df792,_0x3ad37a))[_0x19c5('0x44')](handleError(_0x4df792,null));};exports['show']=function(_0x59eeed,_0x223bdd){var _0x5a0774={'raw':!![],'where':{'id':_0x59eeed[_0x19c5('0x45')]['id']}},_0x3d3ab4={};_0x3d3ab4['model']=_[_0x19c5('0x46')](db[_0x19c5('0x3f')][_0x19c5('0x2c')]);_0x3d3ab4[_0x19c5('0x30')]=_[_0x19c5('0x46')](_0x59eeed[_0x19c5('0x30')]);_0x3d3ab4[_0x19c5('0x31')]=_[_0x19c5('0x32')](_0x3d3ab4[_0x19c5('0x33')],_0x3d3ab4['query']);_0x5a0774['attributes']=_[_0x19c5('0x32')](_0x3d3ab4['model'],qs[_0x19c5('0x47')](_0x59eeed[_0x19c5('0x30')]['fields']));_0x5a0774['attributes']=_0x5a0774['attributes'][_0x19c5('0x35')]?_0x5a0774['attributes']:_0x3d3ab4[_0x19c5('0x33')];if(_0x59eeed['query'][_0x19c5('0x40')]){_0x5a0774['include']=[{'all':!![]}];}_0x5a0774=_[_0x19c5('0x3b')]({},_0x5a0774,_0x59eeed[_0x19c5('0x3e')]);return db[_0x19c5('0x3f')][_0x19c5('0x48')](_0x5a0774)[_0x19c5('0x25')](handleEntityNotFound(_0x223bdd,null))['then'](respondWithResult(_0x223bdd,null))['catch'](handleError(_0x223bdd,null));};exports[_0x19c5('0x49')]=function(_0x3f672e,_0xfab30b){return db[_0x19c5('0x3f')][_0x19c5('0x49')](_0x3f672e[_0x19c5('0x4a')],{})[_0x19c5('0x25')](respondWithResult(_0xfab30b,0xc9))['catch'](handleError(_0xfab30b,null));};exports['update']=function(_0x5345ee,_0x4cb129){if(_0x5345ee[_0x19c5('0x4a')]['id']){delete _0x5345ee[_0x19c5('0x4a')]['id'];}return db[_0x19c5('0x3f')][_0x19c5('0x48')]({'where':{'id':_0x5345ee['params']['id']}})[_0x19c5('0x25')](handleEntityNotFound(_0x4cb129,null))[_0x19c5('0x25')](saveUpdates(_0x5345ee[_0x19c5('0x4a')],null))['then'](respondWithResult(_0x4cb129,null))[_0x19c5('0x44')](handleError(_0x4cb129,null));};exports['destroy']=function(_0x2c1cb4,_0x289230){return db[_0x19c5('0x3f')][_0x19c5('0x48')]({'where':{'id':_0x2c1cb4[_0x19c5('0x45')]['id']}})[_0x19c5('0x25')](handleEntityNotFound(_0x289230,null))['then'](removeEntity(_0x289230,null))['catch'](handleError(_0x289230,null));};exports[_0x19c5('0x4b')]=function(_0x2fae94,_0x4ca356){return db[_0x19c5('0x3f')][_0x19c5('0x4b')]()['then'](respondWithResult(_0x4ca356,null))[_0x19c5('0x44')](handleError(_0x4ca356,null));};exports[_0x19c5('0x4c')]=function(_0x25a840,_0x184b58,_0x305730){var _0x5cdd51={'raw':!![],'where':{}};var _0x30e4f5={};var _0x6447da={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x19c5('0x4d')]({'where':{'id':_0x25a840[_0x19c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x184b58,null))[_0x19c5('0x25')](function(_0x1d3ba0){if(_0x1d3ba0){_0x30e4f5[_0x19c5('0x33')]=_[_0x19c5('0x46')](db[_0x19c5('0x4e')][_0x19c5('0x2c')]);_0x30e4f5[_0x19c5('0x30')]=_[_0x19c5('0x46')](_0x25a840[_0x19c5('0x30')]);_0x30e4f5[_0x19c5('0x31')]=_[_0x19c5('0x32')](_0x30e4f5[_0x19c5('0x33')],_0x30e4f5[_0x19c5('0x30')]);_0x5cdd51['attributes']=_[_0x19c5('0x32')](_0x30e4f5[_0x19c5('0x33')],qs[_0x19c5('0x47')](_0x25a840[_0x19c5('0x30')]['fields']));_0x5cdd51['attributes']=_0x5cdd51[_0x19c5('0x34')][_0x19c5('0x35')]?_0x5cdd51[_0x19c5('0x34')]:_0x30e4f5[_0x19c5('0x33')];if(!_0x25a840[_0x19c5('0x30')]['hasOwnProperty']('nolimit')){_0x5cdd51['limit']=qs[_0x19c5('0x1e')](_0x25a840['query']['limit']);_0x5cdd51[_0x19c5('0x1b')]=qs[_0x19c5('0x1b')](_0x25a840[_0x19c5('0x30')][_0x19c5('0x1b')]);}_0x5cdd51['order']=qs[_0x19c5('0x4f')](_0x25a840[_0x19c5('0x30')][_0x19c5('0x4f')]);_0x5cdd51[_0x19c5('0x3c')]=qs['filters'](_[_0x19c5('0x39')](_0x25a840[_0x19c5('0x30')],_0x30e4f5['filters']));_0x5cdd51[_0x19c5('0x3c')][_0x19c5('0x50')]=_0x1d3ba0['id'];if(_0x25a840[_0x19c5('0x30')][_0x19c5('0x3a')]){_0x5cdd51[_0x19c5('0x3c')]=_[_0x19c5('0x3b')](_0x5cdd51[_0x19c5('0x3c')],{'$or':_[_0x19c5('0x2b')](_0x5cdd51[_0x19c5('0x34')],function(_0x1f8d22){var _0x1dc2c7={};_0x1dc2c7[_0x1f8d22]={'$like':'%'+_0x25a840['query'][_0x19c5('0x3a')]+'%'};return _0x1dc2c7;})});}_0x5cdd51=_[_0x19c5('0x3b')]({},_0x5cdd51,_0x25a840[_0x19c5('0x3e')]);return db[_0x19c5('0x4e')]['count']({'where':_0x5cdd51[_0x19c5('0x3c')]})['then'](function(_0x104bae){_0x6447da[_0x19c5('0x1d')]=_0x104bae;if(_0x25a840['query']['includeAll']){_0x5cdd51[_0x19c5('0x41')]=[{'all':!![]}];}return db[_0x19c5('0x4e')]['findAll'](_0x5cdd51);})[_0x19c5('0x25')](function(_0x271349){_0x6447da[_0x19c5('0x43')]=_0x271349;return _0x6447da;});}})[_0x19c5('0x25')](respondWithFilteredResult(_0x184b58,_0x5cdd51))['catch'](handleError(_0x184b58,null));};
\ No newline at end of file
+var _0x39b2=['ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','intersection','include','create','update','body','find','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','order','pick','rows','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x4c4e97,_0x594020){var _0x53f7ef=function(_0x417320){while(--_0x417320){_0x4c4e97['push'](_0x4c4e97['shift']());}};_0x53f7ef(++_0x594020);}(_0x39b2,0xe3));var _0x239b=function(_0x23c7ef,_0x5d624b){_0x23c7ef=_0x23c7ef-0x0;var _0x14d98c=_0x39b2[_0x23c7ef];return _0x14d98c;};'use strict';var emlformat=require(_0x239b('0x0'));var rimraf=require(_0x239b('0x1'));var zipdir=require(_0x239b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x239b('0x3'));var moment=require(_0x239b('0x4'));var BPromise=require(_0x239b('0x5'));var Mustache=require(_0x239b('0x6'));var util=require(_0x239b('0x7'));var path=require('path');var sox=require(_0x239b('0x8'));var csv=require(_0x239b('0x9'));var ejs=require(_0x239b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x239b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x239b('0xc'));var deskjs=require(_0x239b('0xd'));var toCsv=require(_0x239b('0x9'));var querystring=require(_0x239b('0xe'));var Papa=require(_0x239b('0xf'));var Redis=require(_0x239b('0x10'));var authService=require(_0x239b('0x11'));var qs=require(_0x239b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x239b('0x13'));var logger=require(_0x239b('0x14'))(_0x239b('0x15'));var utils=require(_0x239b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x239b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3726ee,_0x1fdccb){_0x1fdccb=_0x1fdccb||0xcc;return function(_0x54cf06){if(_0x54cf06){return _0x3726ee[_0x239b('0x18')](_0x1fdccb);}return _0x3726ee[_0x239b('0x19')](_0x1fdccb)[_0x239b('0x1a')]();};}function respondWithResult(_0x13fbf3,_0x78de50){_0x78de50=_0x78de50||0xc8;return function(_0x552f01){if(_0x552f01){return _0x13fbf3[_0x239b('0x19')](_0x78de50)['json'](_0x552f01);}};}function respondWithFilteredResult(_0xc73439,_0x3dfb7d){return function(_0x290f37){if(_0x290f37){var _0x58ab5c=typeof _0x3dfb7d[_0x239b('0x1b')]===_0x239b('0x1c')&&typeof _0x3dfb7d[_0x239b('0x1d')]===_0x239b('0x1c');var _0x31f51b=_0x290f37[_0x239b('0x1e')];var _0x10e434=_0x58ab5c?0x0:_0x3dfb7d[_0x239b('0x1b')];var _0x87b077=_0x58ab5c?_0x290f37['count']:_0x3dfb7d['offset']+_0x3dfb7d[_0x239b('0x1d')];var _0x3e1140;if(_0x87b077>=_0x31f51b){_0x87b077=_0x31f51b;_0x3e1140=0xc8;}else{_0x3e1140=0xce;}_0xc73439['status'](_0x3e1140);return _0xc73439[_0x239b('0x1f')](_0x239b('0x20'),_0x10e434+'-'+_0x87b077+'/'+_0x31f51b)[_0x239b('0x21')](_0x290f37);}return null;};}function patchUpdates(_0xd785a8){return function(_0x5ec14f){try{jsonpatch[_0x239b('0x22')](_0x5ec14f,_0xd785a8,!![]);}catch(_0x2a72ca){return BPromise['reject'](_0x2a72ca);}return _0x5ec14f['save']();};}function saveUpdates(_0x309f96,_0x284e4d){return function(_0x1ace6c){if(_0x1ace6c){return _0x1ace6c['update'](_0x309f96)[_0x239b('0x23')](function(_0x240617){return _0x240617;});}return null;};}function removeEntity(_0x354599,_0x340bdf){return function(_0x29af30){if(_0x29af30){return _0x29af30['destroy']()[_0x239b('0x23')](function(){_0x354599[_0x239b('0x19')](0xcc)[_0x239b('0x1a')]();});}};}function handleEntityNotFound(_0x3e6754,_0xfa8783){return function(_0x5c1a5d){if(!_0x5c1a5d){_0x3e6754[_0x239b('0x18')](0x194);}return _0x5c1a5d;};}function handleError(_0x282d84,_0x5b435e){_0x5b435e=_0x5b435e||0x1f4;return function(_0x15236e){logger['error'](_0x15236e[_0x239b('0x24')]);if(_0x15236e[_0x239b('0x25')]){delete _0x15236e[_0x239b('0x25')];}_0x282d84[_0x239b('0x19')](_0x5b435e)[_0x239b('0x26')](_0x15236e);};}exports[_0x239b('0x27')]=function(_0x26c2c5,_0x837f5){var _0x4c9dd9={},_0x11580e={},_0x2b3f12={'count':0x0,'rows':[]};var _0x1eb8c6=_[_0x239b('0x28')](db[_0x239b('0x29')][_0x239b('0x2a')],function(_0x3591ab){return{'name':_0x3591ab[_0x239b('0x2b')],'type':_0x3591ab[_0x239b('0x2c')][_0x239b('0x2d')]};});_0x11580e[_0x239b('0x2e')]=_[_0x239b('0x28')](_0x1eb8c6,_0x239b('0x25'));_0x11580e[_0x239b('0x2f')]=_[_0x239b('0x30')](_0x26c2c5[_0x239b('0x2f')]);_0x11580e[_0x239b('0x31')]=_['intersection'](_0x11580e[_0x239b('0x2e')],_0x11580e['query']);_0x4c9dd9[_0x239b('0x32')]=_['intersection'](_0x11580e[_0x239b('0x2e')],qs[_0x239b('0x33')](_0x26c2c5[_0x239b('0x2f')][_0x239b('0x33')]));_0x4c9dd9['attributes']=_0x4c9dd9[_0x239b('0x32')][_0x239b('0x34')]?_0x4c9dd9[_0x239b('0x32')]:_0x11580e[_0x239b('0x2e')];if(!_0x26c2c5['query']['hasOwnProperty']('nolimit')){_0x4c9dd9[_0x239b('0x1d')]=qs['limit'](_0x26c2c5[_0x239b('0x2f')]['limit']);_0x4c9dd9[_0x239b('0x1b')]=qs[_0x239b('0x1b')](_0x26c2c5[_0x239b('0x2f')][_0x239b('0x1b')]);}_0x4c9dd9['order']=qs[_0x239b('0x35')](_0x26c2c5[_0x239b('0x2f')]['sort']);_0x4c9dd9['where']=qs[_0x239b('0x31')](_['pick'](_0x26c2c5[_0x239b('0x2f')],_0x11580e[_0x239b('0x31')]),_0x1eb8c6);if(_0x26c2c5[_0x239b('0x2f')][_0x239b('0x36')]){_0x4c9dd9[_0x239b('0x37')]=_[_0x239b('0x38')](_0x4c9dd9[_0x239b('0x37')],{'$or':_[_0x239b('0x28')](_0x1eb8c6,function(_0x50f640){if(_0x50f640[_0x239b('0x2c')]!==_0x239b('0x39')){var _0x1e84d4={};_0x1e84d4[_0x50f640[_0x239b('0x25')]]={'$like':'%'+_0x26c2c5[_0x239b('0x2f')]['filter']+'%'};return _0x1e84d4;}})});}_0x4c9dd9=_[_0x239b('0x38')]({},_0x4c9dd9,_0x26c2c5[_0x239b('0x3a')]);var _0x40fe8f={'where':_0x4c9dd9['where']};return db[_0x239b('0x29')][_0x239b('0x1e')](_0x40fe8f)['then'](function(_0x4614b6){_0x2b3f12[_0x239b('0x1e')]=_0x4614b6;if(_0x26c2c5['query'][_0x239b('0x3b')]){_0x4c9dd9['include']=[{'all':!![]}];}return db[_0x239b('0x29')][_0x239b('0x3c')](_0x4c9dd9);})['then'](function(_0xbb0c5){_0x2b3f12['rows']=_0xbb0c5;return _0x2b3f12;})['then'](respondWithFilteredResult(_0x837f5,_0x4c9dd9))[_0x239b('0x3d')](handleError(_0x837f5,null));};exports[_0x239b('0x3e')]=function(_0x505045,_0x49acbe){var _0x7b0ab6={'raw':!![],'where':{'id':_0x505045[_0x239b('0x3f')]['id']}},_0x403997={};_0x403997[_0x239b('0x2e')]=_[_0x239b('0x30')](db['JscriptySessionReport']['rawAttributes']);_0x403997[_0x239b('0x2f')]=_['keys'](_0x505045[_0x239b('0x2f')]);_0x403997[_0x239b('0x31')]=_[_0x239b('0x40')](_0x403997[_0x239b('0x2e')],_0x403997[_0x239b('0x2f')]);_0x7b0ab6[_0x239b('0x32')]=_[_0x239b('0x40')](_0x403997[_0x239b('0x2e')],qs[_0x239b('0x33')](_0x505045[_0x239b('0x2f')][_0x239b('0x33')]));_0x7b0ab6[_0x239b('0x32')]=_0x7b0ab6[_0x239b('0x32')][_0x239b('0x34')]?_0x7b0ab6['attributes']:_0x403997['model'];if(_0x505045[_0x239b('0x2f')]['includeAll']){_0x7b0ab6[_0x239b('0x41')]=[{'all':!![]}];}_0x7b0ab6=_['merge']({},_0x7b0ab6,_0x505045[_0x239b('0x3a')]);return db['JscriptySessionReport']['find'](_0x7b0ab6)['then'](handleEntityNotFound(_0x49acbe,null))[_0x239b('0x23')](respondWithResult(_0x49acbe,null))['catch'](handleError(_0x49acbe,null));};exports[_0x239b('0x42')]=function(_0x489f7d,_0x1f9f7b){return db[_0x239b('0x29')][_0x239b('0x42')](_0x489f7d['body'],{})['then'](respondWithResult(_0x1f9f7b,0xc9))[_0x239b('0x3d')](handleError(_0x1f9f7b,null));};exports[_0x239b('0x43')]=function(_0x54c81c,_0x880721){if(_0x54c81c['body']['id']){delete _0x54c81c[_0x239b('0x44')]['id'];}return db[_0x239b('0x29')][_0x239b('0x45')]({'where':{'id':_0x54c81c[_0x239b('0x3f')]['id']}})[_0x239b('0x23')](handleEntityNotFound(_0x880721,null))['then'](saveUpdates(_0x54c81c['body'],null))['then'](respondWithResult(_0x880721,null))[_0x239b('0x3d')](handleError(_0x880721,null));};exports[_0x239b('0x46')]=function(_0x35a284,_0x68cac3){return db['JscriptySessionReport'][_0x239b('0x45')]({'where':{'id':_0x35a284[_0x239b('0x3f')]['id']}})[_0x239b('0x23')](handleEntityNotFound(_0x68cac3,null))[_0x239b('0x23')](removeEntity(_0x68cac3,null))[_0x239b('0x3d')](handleError(_0x68cac3,null));};exports[_0x239b('0x47')]=function(_0x35e5ac,_0x39d2ef){return db[_0x239b('0x29')][_0x239b('0x47')]()[_0x239b('0x23')](respondWithResult(_0x39d2ef,null))['catch'](handleError(_0x39d2ef,null));};exports[_0x239b('0x48')]=function(_0x1dc900,_0x370f36,_0x105b70){var _0x27148e={'raw':!![],'where':{}};var _0x510394={};var _0x40f42c={'count':0x0,'rows':[]};return db[_0x239b('0x29')][_0x239b('0x49')]({'where':{'id':_0x1dc900[_0x239b('0x3f')]['id']}})[_0x239b('0x23')](handleEntityNotFound(_0x370f36,null))[_0x239b('0x23')](function(_0x562149){if(_0x562149){_0x510394[_0x239b('0x2e')]=_[_0x239b('0x30')](db[_0x239b('0x4a')][_0x239b('0x2a')]);_0x510394[_0x239b('0x2f')]=_['keys'](_0x1dc900[_0x239b('0x2f')]);_0x510394[_0x239b('0x31')]=_[_0x239b('0x40')](_0x510394[_0x239b('0x2e')],_0x510394[_0x239b('0x2f')]);_0x27148e['attributes']=_[_0x239b('0x40')](_0x510394[_0x239b('0x2e')],qs[_0x239b('0x33')](_0x1dc900[_0x239b('0x2f')][_0x239b('0x33')]));_0x27148e[_0x239b('0x32')]=_0x27148e[_0x239b('0x32')][_0x239b('0x34')]?_0x27148e[_0x239b('0x32')]:_0x510394['model'];if(!_0x1dc900[_0x239b('0x2f')]['hasOwnProperty'](_0x239b('0x4b'))){_0x27148e[_0x239b('0x1d')]=qs[_0x239b('0x1d')](_0x1dc900[_0x239b('0x2f')][_0x239b('0x1d')]);_0x27148e['offset']=qs[_0x239b('0x1b')](_0x1dc900[_0x239b('0x2f')][_0x239b('0x1b')]);}_0x27148e[_0x239b('0x4c')]=qs[_0x239b('0x35')](_0x1dc900[_0x239b('0x2f')][_0x239b('0x35')]);_0x27148e['where']=qs[_0x239b('0x31')](_[_0x239b('0x4d')](_0x1dc900[_0x239b('0x2f')],_0x510394['filters']));_0x27148e[_0x239b('0x37')]['SessionId']=_0x562149['id'];if(_0x1dc900[_0x239b('0x2f')][_0x239b('0x36')]){_0x27148e['where']=_[_0x239b('0x38')](_0x27148e[_0x239b('0x37')],{'$or':_[_0x239b('0x28')](_0x27148e[_0x239b('0x32')],function(_0x57af49){var _0x42b4a4={};_0x42b4a4[_0x57af49]={'$like':'%'+_0x1dc900[_0x239b('0x2f')]['filter']+'%'};return _0x42b4a4;})});}_0x27148e=_[_0x239b('0x38')]({},_0x27148e,_0x1dc900[_0x239b('0x3a')]);return db[_0x239b('0x4a')][_0x239b('0x1e')]({'where':_0x27148e[_0x239b('0x37')]})[_0x239b('0x23')](function(_0x7f3561){_0x40f42c[_0x239b('0x1e')]=_0x7f3561;if(_0x1dc900[_0x239b('0x2f')][_0x239b('0x3b')]){_0x27148e[_0x239b('0x41')]=[{'all':!![]}];}return db[_0x239b('0x4a')]['findAll'](_0x27148e);})[_0x239b('0x23')](function(_0x5d34d0){_0x40f42c[_0x239b('0x4e')]=_0x5d34d0;return _0x40f42c;});}})[_0x239b('0x23')](respondWithFilteredResult(_0x370f36,_0x27148e))['catch'](handleError(_0x370f36,null));};
\ No newline at end of file
index f260e90..da82656 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x1ed0ce,_0x381bf4){var _0x3978b1=function(_0x16a1e9){while(--_0x16a1e9){_0x1ed0ce['push'](_0x1ed0ce['shift']());}};_0x3978b1(++_0x381bf4);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x35b05d,_0x5d7664){_0x35b05d=_0x35b05d-0x0;var _0x47b869=_0xc1c6[_0x35b05d];return _0x47b869;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbd51=['exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','./jscriptySessionReport.attributes'];(function(_0x2e078f,_0x22ff51){var _0x23cce3=function(_0x3ebe0f){while(--_0x3ebe0f){_0x2e078f['push'](_0x2e078f['shift']());}};_0x23cce3(++_0x22ff51);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x47aeb5,_0x1a4b86){_0x47aeb5=_0x47aeb5-0x0;var _0x46dda0=_0xbd51[_0x47aeb5];return _0x46dda0;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index efc092f..afeb4d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd117,0x182));var _0x7d11=function(_0x1ccb5d,_0x341da9){_0x1ccb5d=_0x1ccb5d-0x0;var _0x1fe071=_0xd117[_0x1ccb5d];return _0x1fe071;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}
\ No newline at end of file
+var _0x430c=['then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x430c,0x1a1));var _0xc430=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x430c[_0x541260];return _0x1dd2b5;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});}
\ No newline at end of file
index f297785..a880d73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33c6=['path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','put','/:id','isAuthenticated','update','downloadLogFile','exports','util'];(function(_0x2a5dc1,_0xc58ca4){var _0x244d63=function(_0x2836c5){while(--_0x2836c5){_0x2a5dc1['push'](_0x2a5dc1['shift']());}};_0x244d63(++_0xc58ca4);}(_0x33c6,0x15d));var _0x633c=function(_0x367a96,_0x4ab6e5){_0x367a96=_0x367a96-0x0;var _0x5ec123=_0x33c6[_0x367a96];return _0x5ec123;};'use strict';var multer=require('multer');var util=require(_0x633c('0x0'));var path=require(_0x633c('0x1'));var timeout=require(_0x633c('0x2'));var express=require(_0x633c('0x3'));var router=express['Router']();var fs_extra=require(_0x633c('0x4'));var auth=require(_0x633c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0x633c('0x6')]('/',controller[_0x633c('0x7')]);router[_0x633c('0x8')](_0x633c('0x9'),auth[_0x633c('0xa')](),controller[_0x633c('0xb')]);router[_0x633c('0x6')]('/download_log_file',auth[_0x633c('0xa')](),controller[_0x633c('0xc')]);module[_0x633c('0xd')]=router;
\ No newline at end of file
+var _0x5e63=['isAuthenticated','get','downloadLogFile','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put'];(function(_0x5bcd7d,_0x3de531){var _0x6d0a15=function(_0x48cfff){while(--_0x48cfff){_0x5bcd7d['push'](_0x5bcd7d['shift']());}};_0x6d0a15(++_0x3de531);}(_0x5e63,0x17a));var _0x35e6=function(_0x3ba336,_0x53f49f){_0x3ba336=_0x3ba336-0x0;var _0x27d765=_0x5e63[_0x3ba336];return _0x27d765;};'use strict';var multer=require(_0x35e6('0x0'));var util=require(_0x35e6('0x1'));var path=require(_0x35e6('0x2'));var timeout=require(_0x35e6('0x3'));var express=require(_0x35e6('0x4'));var router=express[_0x35e6('0x5')]();var fs_extra=require(_0x35e6('0x6'));var auth=require(_0x35e6('0x7'));var interaction=require(_0x35e6('0x8'));var config=require(_0x35e6('0x9'));var controller=require('./license.controller');router['get']('/',controller[_0x35e6('0xa')]);router[_0x35e6('0xb')]('/:id',auth[_0x35e6('0xc')](),controller['update']);router[_0x35e6('0xd')]('/download_log_file',auth[_0x35e6('0xc')](),controller[_0x35e6('0xe')]);module['exports']=router;
\ No newline at end of file
index 30d8ff3..96677cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa9f=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x51c5fc,_0x335ba0){var _0x242b3b=function(_0x41ab5d){while(--_0x41ab5d){_0x51c5fc['push'](_0x51c5fc['shift']());}};_0x242b3b(++_0x335ba0);}(_0xfa9f,0x9e));var _0xffa9=function(_0xfc7019,_0x277c9e){_0xfc7019=_0xfc7019-0x0;var _0x2af8f4=_0xfa9f[_0xfc7019];return _0x2af8f4;};'use strict';var Sequelize=require(_0xffa9('0x0'));module[_0xffa9('0x1')]={'license':{'type':Sequelize[_0xffa9('0x2')]},'data1':{'type':Sequelize[_0xffa9('0x3')]},'data2':{'type':Sequelize[_0xffa9('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xffa9('0x4')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x2700=['STRING','sequelize','exports','TEXT'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x2700,0x19d));var _0x0270=function(_0xdc94fa,_0x4ed3ad){_0xdc94fa=_0xdc94fa-0x0;var _0x129090=_0x2700[_0xdc94fa];return _0x129090;};'use strict';var Sequelize=require(_0x0270('0x0'));module[_0x0270('0x1')]={'license':{'type':Sequelize[_0x0270('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0270('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 0f4b9a4..25f3d19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x662f=['sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','model','keys','License','query','filters','intersection','attributes','fields','length','options','getLicense','update','body','find','checkLicense','key','demo','catch','license-info.log','join','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x3e58f2,_0xb41915){var _0x3a3169=function(_0x347112){while(--_0x347112){_0x3e58f2['push'](_0x3e58f2['shift']());}};_0x3a3169(++_0xb41915);}(_0x662f,0x133));var _0xf662=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x662f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf662('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf662('0x1'));var rp=require(_0xf662('0x2'));var moment=require('moment');var BPromise=require(_0xf662('0x3'));var Mustache=require(_0xf662('0x4'));var util=require('util');var path=require(_0xf662('0x5'));var sox=require(_0xf662('0x6'));var csv=require(_0xf662('0x7'));var ejs=require(_0xf662('0x8'));var fs=require('fs');var fs_extra=require(_0xf662('0x9'));var _=require('lodash');var squel=require(_0xf662('0xa'));var crypto=require(_0xf662('0xb'));var jsforce=require(_0xf662('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf662('0xd'));var Papa=require(_0xf662('0xe'));var Redis=require(_0xf662('0xf'));var authService=require(_0xf662('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf662('0x11'));var hardwareService=require(_0xf662('0x12'));var logger=require(_0xf662('0x13'))(_0xf662('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf662('0x15'));var db=require(_0xf662('0x16'))['db'];function respondWithStatusCode(_0x311dfa,_0x20cdde){_0x20cdde=_0x20cdde||0xcc;return function(_0x278293){if(_0x278293){return _0x311dfa[_0xf662('0x17')](_0x20cdde);}return _0x311dfa[_0xf662('0x18')](_0x20cdde)[_0xf662('0x19')]();};}function respondWithResult(_0x3b03ba,_0x2cf5dd){_0x2cf5dd=_0x2cf5dd||0xc8;return function(_0x360575){if(_0x360575){return _0x3b03ba['status'](_0x2cf5dd)[_0xf662('0x1a')](_0x360575);}};}function respondWithFilteredResult(_0x5f2d2c,_0x326933){return function(_0x413f61){if(_0x413f61){var _0x39d3d0=typeof _0x326933[_0xf662('0x1b')]==='undefined'&&typeof _0x326933['limit']===_0xf662('0x1c');var _0x4725f3=_0x413f61[_0xf662('0x1d')];var _0xf0bbe=_0x39d3d0?0x0:_0x326933[_0xf662('0x1b')];var _0xec9417=_0x39d3d0?_0x413f61[_0xf662('0x1d')]:_0x326933[_0xf662('0x1b')]+_0x326933['limit'];var _0x1ec2b5;if(_0xec9417>=_0x4725f3){_0xec9417=_0x4725f3;_0x1ec2b5=0xc8;}else{_0x1ec2b5=0xce;}_0x5f2d2c[_0xf662('0x18')](_0x1ec2b5);return _0x5f2d2c[_0xf662('0x1e')](_0xf662('0x1f'),_0xf0bbe+'-'+_0xec9417+'/'+_0x4725f3)['json'](_0x413f61);}return null;};}function patchUpdates(_0x27c234){return function(_0x110fb8){try{jsonpatch['apply'](_0x110fb8,_0x27c234,!![]);}catch(_0x24b816){return BPromise[_0xf662('0x20')](_0x24b816);}return _0x110fb8[_0xf662('0x21')]();};}function saveUpdates(_0x9d5c53,_0x428c58){return function(_0x102b51){if(_0x102b51){return _0x102b51['update'](_0x9d5c53)[_0xf662('0x22')](function(_0x356428){return _0x356428;});}return null;};}function removeEntity(_0x3db5cc,_0x15580b){return function(_0x255999){if(_0x255999){return _0x255999[_0xf662('0x23')]()[_0xf662('0x22')](function(){_0x3db5cc[_0xf662('0x18')](0xcc)[_0xf662('0x19')]();});}};}function handleEntityNotFound(_0x45d96a,_0x54193f){return function(_0x350529){if(!_0x350529){_0x45d96a['sendStatus'](0x194);}return _0x350529;};}function handleError(_0x14c732,_0x5e6a16){_0x5e6a16=_0x5e6a16||0x1f4;return function(_0xa36aa0){logger[_0xf662('0x24')](_0xa36aa0[_0xf662('0x25')]);if(_0xa36aa0[_0xf662('0x26')]){delete _0xa36aa0[_0xf662('0x26')];}_0x14c732[_0xf662('0x18')](_0x5e6a16)[_0xf662('0x27')](_0xa36aa0);};}var utilLicense=require(_0xf662('0x15'));exports['index']=function(_0x406fee,_0x15360e){var _0x27ff52={'raw':!![],'where':{'id':0x1}},_0x232349={};_0x232349[_0xf662('0x28')]=_[_0xf662('0x29')](db[_0xf662('0x2a')]['rawAttributes']);_0x232349[_0xf662('0x2b')]=_[_0xf662('0x29')](_0x406fee['query']);_0x232349[_0xf662('0x2c')]=_[_0xf662('0x2d')](_0x232349[_0xf662('0x28')],_0x232349[_0xf662('0x2b')]);_0x27ff52[_0xf662('0x2e')]=_[_0xf662('0x2d')](_0x232349[_0xf662('0x28')],qs[_0xf662('0x2f')](_0x406fee['query']['fields']));_0x27ff52[_0xf662('0x2e')]=_0x27ff52[_0xf662('0x2e')][_0xf662('0x30')]?_0x27ff52[_0xf662('0x2e')]:_0x232349[_0xf662('0x28')];_0x27ff52=_['merge']({},_0x27ff52,_0x406fee[_0xf662('0x31')]);return utilLicense[_0xf662('0x32')](_0x27ff52)['then'](respondWithResult(_0x15360e,null))['catch'](handleError(_0x15360e,null));};exports[_0xf662('0x33')]=function(_0x21274d,_0x40e637){if(_0x21274d[_0xf662('0x34')]['id']){delete _0x21274d[_0xf662('0x34')]['id'];}return db['License'][_0xf662('0x35')]({'where':{'id':_0x21274d['params']['id']}})[_0xf662('0x22')](handleEntityNotFound(_0x40e637,null))[_0xf662('0x22')](function(_0x416e9d){var _0x17f19e=_0x416e9d['get']({'plain':!![]});return utilLicense[_0xf662('0x36')](_0x17f19e,_0x21274d[_0xf662('0x34')][_0xf662('0x37')]);})['then'](function(_0x3f8455){if(!_0x3f8455[_0xf662('0x38')]){return saveUpdates(_0x21274d[_0xf662('0x34')],null);}return _0x3f8455;})[_0xf662('0x22')](respondWithResult(_0x40e637,null))[_0xf662('0x39')](handleError(_0x40e637,null));};exports['downloadLogFile']=function(_0xbfe05c,_0x2fa938){var _0x137575=_0xf662('0x3a');var _0x49ef46=path[_0xf662('0x3b')]('/var','log',_0xf662('0x3c'),_0x137575);_0x2fa938['setHeader'](_0xf662('0x3d'),_0xf662('0x3e')+_0x137575);_0x2fa938[_0xf662('0x1e')](_0xf662('0x3f'),_0xf662('0x40'));_0x2fa938[_0xf662('0x41')](_0x49ef46);};
\ No newline at end of file
+var _0xfc54=['params','get','checkLicense','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','zip-dir','fast-json-patch','moment','mustache','path','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','sendStatus','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','length','merge','options','getLicense','catch','body','find'];(function(_0x554ce5,_0x7e9a8a){var _0x3ec7b4=function(_0x4629e8){while(--_0x4629e8){_0x554ce5['push'](_0x554ce5['shift']());}};_0x3ec7b4(++_0x7e9a8a);}(_0xfc54,0x1a6));var _0x4fc5=function(_0x4b2ed7,_0x5b3100){_0x4b2ed7=_0x4b2ed7-0x0;var _0x55a953=_0xfc54[_0x4b2ed7];return _0x55a953;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fc5('0x0'));var jsonpatch=require(_0x4fc5('0x1'));var rp=require('request-promise');var moment=require(_0x4fc5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4fc5('0x3'));var util=require('util');var path=require(_0x4fc5('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4fc5('0x5'));var deskjs=require(_0x4fc5('0x6'));var toCsv=require(_0x4fc5('0x7'));var querystring=require(_0x4fc5('0x8'));var Papa=require(_0x4fc5('0x9'));var Redis=require(_0x4fc5('0xa'));var authService=require(_0x4fc5('0xb'));var qs=require(_0x4fc5('0xc'));var as=require(_0x4fc5('0xd'));var hardwareService=require(_0x4fc5('0xe'));var logger=require(_0x4fc5('0xf'))(_0x4fc5('0x10'));var utils=require(_0x4fc5('0x11'));var config=require(_0x4fc5('0x12'));var licenseUtil=require(_0x4fc5('0x13'));var db=require(_0x4fc5('0x14'))['db'];function respondWithStatusCode(_0xad5caa,_0x44d730){_0x44d730=_0x44d730||0xcc;return function(_0x55b61b){if(_0x55b61b){return _0xad5caa['sendStatus'](_0x44d730);}return _0xad5caa[_0x4fc5('0x15')](_0x44d730)[_0x4fc5('0x16')]();};}function respondWithResult(_0x10a7f8,_0x1ac4b7){_0x1ac4b7=_0x1ac4b7||0xc8;return function(_0x1c7311){if(_0x1c7311){return _0x10a7f8['status'](_0x1ac4b7)['json'](_0x1c7311);}};}function respondWithFilteredResult(_0x471a8d,_0x1261b5){return function(_0x545787){if(_0x545787){var _0x1698ae=typeof _0x1261b5[_0x4fc5('0x17')]===_0x4fc5('0x18')&&typeof _0x1261b5[_0x4fc5('0x19')]===_0x4fc5('0x18');var _0x5c09e9=_0x545787[_0x4fc5('0x1a')];var _0xe3b8c6=_0x1698ae?0x0:_0x1261b5['offset'];var _0x2b1ad8=_0x1698ae?_0x545787[_0x4fc5('0x1a')]:_0x1261b5[_0x4fc5('0x17')]+_0x1261b5['limit'];var _0x48013;if(_0x2b1ad8>=_0x5c09e9){_0x2b1ad8=_0x5c09e9;_0x48013=0xc8;}else{_0x48013=0xce;}_0x471a8d[_0x4fc5('0x15')](_0x48013);return _0x471a8d[_0x4fc5('0x1b')](_0x4fc5('0x1c'),_0xe3b8c6+'-'+_0x2b1ad8+'/'+_0x5c09e9)[_0x4fc5('0x1d')](_0x545787);}return null;};}function patchUpdates(_0x1a246d){return function(_0xd7dce4){try{jsonpatch['apply'](_0xd7dce4,_0x1a246d,!![]);}catch(_0x88fba2){return BPromise['reject'](_0x88fba2);}return _0xd7dce4[_0x4fc5('0x1e')]();};}function saveUpdates(_0x5dc6e2,_0x2c739e){return function(_0x2d370d){if(_0x2d370d){return _0x2d370d['update'](_0x5dc6e2)[_0x4fc5('0x1f')](function(_0x5410ad){return _0x5410ad;});}return null;};}function removeEntity(_0x5e12cb,_0x10210c){return function(_0x2d6079){if(_0x2d6079){return _0x2d6079[_0x4fc5('0x20')]()[_0x4fc5('0x1f')](function(){_0x5e12cb[_0x4fc5('0x15')](0xcc)[_0x4fc5('0x16')]();});}};}function handleEntityNotFound(_0x75eb1d,_0x2bfa9c){return function(_0x287494){if(!_0x287494){_0x75eb1d[_0x4fc5('0x21')](0x194);}return _0x287494;};}function handleError(_0x45eceb,_0x59c5a4){_0x59c5a4=_0x59c5a4||0x1f4;return function(_0x6073a4){logger[_0x4fc5('0x22')](_0x6073a4[_0x4fc5('0x23')]);if(_0x6073a4[_0x4fc5('0x24')]){delete _0x6073a4[_0x4fc5('0x24')];}_0x45eceb[_0x4fc5('0x15')](_0x59c5a4)[_0x4fc5('0x25')](_0x6073a4);};}var utilLicense=require(_0x4fc5('0x13'));exports[_0x4fc5('0x26')]=function(_0x2b39a0,_0x406329){var _0x1a6eb8={'raw':!![],'where':{'id':0x1}},_0x1512c6={};_0x1512c6[_0x4fc5('0x27')]=_[_0x4fc5('0x28')](db[_0x4fc5('0x29')][_0x4fc5('0x2a')]);_0x1512c6[_0x4fc5('0x2b')]=_[_0x4fc5('0x28')](_0x2b39a0['query']);_0x1512c6[_0x4fc5('0x2c')]=_['intersection'](_0x1512c6[_0x4fc5('0x27')],_0x1512c6[_0x4fc5('0x2b')]);_0x1a6eb8['attributes']=_[_0x4fc5('0x2d')](_0x1512c6[_0x4fc5('0x27')],qs['fields'](_0x2b39a0[_0x4fc5('0x2b')]['fields']));_0x1a6eb8[_0x4fc5('0x2e')]=_0x1a6eb8[_0x4fc5('0x2e')][_0x4fc5('0x2f')]?_0x1a6eb8[_0x4fc5('0x2e')]:_0x1512c6[_0x4fc5('0x27')];_0x1a6eb8=_[_0x4fc5('0x30')]({},_0x1a6eb8,_0x2b39a0[_0x4fc5('0x31')]);return utilLicense[_0x4fc5('0x32')](_0x1a6eb8)[_0x4fc5('0x1f')](respondWithResult(_0x406329,null))[_0x4fc5('0x33')](handleError(_0x406329,null));};exports['update']=function(_0x4fe9d9,_0x24a1fe){if(_0x4fe9d9[_0x4fc5('0x34')]['id']){delete _0x4fe9d9[_0x4fc5('0x34')]['id'];}return db[_0x4fc5('0x29')][_0x4fc5('0x35')]({'where':{'id':_0x4fe9d9[_0x4fc5('0x36')]['id']}})[_0x4fc5('0x1f')](handleEntityNotFound(_0x24a1fe,null))[_0x4fc5('0x1f')](function(_0x559551){var _0x34808b=_0x559551[_0x4fc5('0x37')]({'plain':!![]});return utilLicense[_0x4fc5('0x38')](_0x34808b,_0x4fe9d9[_0x4fc5('0x34')]['key']);})[_0x4fc5('0x1f')](function(_0x5dc1ff){if(!_0x5dc1ff['demo']){return saveUpdates(_0x4fe9d9[_0x4fc5('0x34')],null);}return _0x5dc1ff;})[_0x4fc5('0x1f')](respondWithResult(_0x24a1fe,null))[_0x4fc5('0x33')](handleError(_0x24a1fe,null));};exports['downloadLogFile']=function(_0x5a1a70,_0xbc53ce){var _0x9487bc=_0x4fc5('0x39');var _0x56783a=path[_0x4fc5('0x3a')](_0x4fc5('0x3b'),_0x4fc5('0x3c'),_0x4fc5('0x3d'),_0x9487bc);_0xbc53ce[_0x4fc5('0x3e')](_0x4fc5('0x3f'),_0x4fc5('0x40')+_0x9487bc);_0xbc53ce[_0x4fc5('0x1b')](_0x4fc5('0x41'),_0x4fc5('0x42'));_0xbc53ce[_0x4fc5('0x43')](_0x56783a);};
\ No newline at end of file
index eea0111..8e96b84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fba=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','License'];(function(_0x142038,_0x34b23b){var _0x1d3a56=function(_0x93e09e){while(--_0x93e09e){_0x142038['push'](_0x142038['shift']());}};_0x1d3a56(++_0x34b23b);}(_0x8fba,0x64));var _0xa8fb=function(_0x90d3eb,_0x1c7eaa){_0x90d3eb=_0x90d3eb-0x0;var _0x5f38d0=_0x8fba[_0x90d3eb];return _0x5f38d0;};'use strict';var _=require(_0xa8fb('0x0'));var util=require(_0xa8fb('0x1'));var logger=require(_0xa8fb('0x2'))(_0xa8fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa8fb('0x4'));var fs=require('fs');var path=require(_0xa8fb('0x5'));var rimraf=require(_0xa8fb('0x6'));var config=require(_0xa8fb('0x7'));var attributes=require('./license.attributes');module[_0xa8fb('0x8')]=function(_0x32422d,_0x123a6f){return _0x32422d['define'](_0xa8fb('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x94f1=['License','license','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define'];(function(_0x19b2a8,_0x4eea6a){var _0x482f2c=function(_0x11fd06){while(--_0x11fd06){_0x19b2a8['push'](_0x19b2a8['shift']());}};_0x482f2c(++_0x4eea6a);}(_0x94f1,0x1bc));var _0x194f=function(_0x18e411,_0xd68451){_0x18e411=_0x18e411-0x0;var _0x10e8f6=_0x94f1[_0x18e411];return _0x10e8f6;};'use strict';var _=require('lodash');var util=require(_0x194f('0x0'));var logger=require(_0x194f('0x1'))(_0x194f('0x2'));var moment=require(_0x194f('0x3'));var BPromise=require(_0x194f('0x4'));var rp=require(_0x194f('0x5'));var fs=require('fs');var path=require(_0x194f('0x6'));var rimraf=require('rimraf');var config=require(_0x194f('0x7'));var attributes=require(_0x194f('0x8'));module[_0x194f('0x9')]=function(_0x2790d5,_0x5c59ea){return _0x2790d5[_0x194f('0xa')](_0x194f('0xb'),attributes,{'tableName':_0x194f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5f88be1..a0e7217 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8199=['then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x292ec9,_0x3f304d){var _0xce9423=function(_0x3d7052){while(--_0x3d7052){_0x292ec9['push'](_0x292ec9['shift']());}};_0xce9423(++_0x3f304d);}(_0x8199,0x185));var _0x9819=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x8199[_0x509dad];return _0x21e122;};'use strict';var _=require(_0x9819('0x0'));var util=require(_0x9819('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9819('0x2'));var db=require(_0x9819('0x3'))['db'];var utils=require(_0x9819('0x4'));var logger=require(_0x9819('0x5'))('rpc');var config=require(_0x9819('0x6'));var jayson=require(_0x9819('0x7'));var client=jayson[_0x9819('0x8')][_0x9819('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c9a7b,_0x14738c,_0x6ebd89){return new BPromise(function(_0x52475c,_0x552378){return client['request'](_0x2c9a7b,_0x6ebd89)[_0x9819('0xa')](function(_0x45c9da){logger[_0x9819('0xb')](_0x9819('0xc'),_0x14738c,_0x9819('0xd'));logger[_0x9819('0xe')](_0x9819('0xf'),_0x14738c,_0x9819('0xd'),JSON[_0x9819('0x10')](_0x45c9da));if(_0x45c9da['error']){if(_0x45c9da[_0x9819('0x11')]['code']===0x1f4){logger[_0x9819('0x11')]('License,\x20%s,\x20%s',_0x14738c,_0x45c9da[_0x9819('0x11')][_0x9819('0x12')]);return _0x552378(_0x45c9da[_0x9819('0x11')]['message']);}logger['error'](_0x9819('0xc'),_0x14738c,_0x45c9da[_0x9819('0x11')][_0x9819('0x12')]);return _0x52475c(_0x45c9da[_0x9819('0x11')][_0x9819('0x12')]);}else{logger[_0x9819('0xb')]('License,\x20%s,\x20%s',_0x14738c,_0x9819('0xd'));_0x52475c(_0x45c9da[_0x9819('0x13')]['message']);}})[_0x9819('0x14')](function(_0x2b72d2){logger[_0x9819('0x11')](_0x9819('0xc'),_0x14738c,_0x2b72d2);_0x552378(_0x2b72d2);});});}
\ No newline at end of file
+var _0x937d=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x937d,0x185));var _0xd937=function(_0x481ecb,_0x49f0a3){_0x481ecb=_0x481ecb-0x0;var _0x24e4e6=_0x937d[_0x481ecb];return _0x24e4e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd937('0x0'));var BPromise=require(_0xd937('0x1'));var rs=require(_0xd937('0x2'));var fs=require('fs');var Redis=require(_0xd937('0x3'));var db=require(_0xd937('0x4'))['db'];var utils=require(_0xd937('0x5'));var logger=require(_0xd937('0x6'))('rpc');var config=require(_0xd937('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd937('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20caf3,_0x6f1511,_0x3deec9){return new BPromise(function(_0x4207d6,_0x55c5a5){return client['request'](_0x20caf3,_0x3deec9)[_0xd937('0x9')](function(_0x58c775){logger[_0xd937('0xa')](_0xd937('0xb'),_0x6f1511,_0xd937('0xc'));logger[_0xd937('0xd')](_0xd937('0xe'),_0x6f1511,_0xd937('0xc'),JSON[_0xd937('0xf')](_0x58c775));if(_0x58c775[_0xd937('0x10')]){if(_0x58c775['error'][_0xd937('0x11')]===0x1f4){logger[_0xd937('0x10')](_0xd937('0xb'),_0x6f1511,_0x58c775[_0xd937('0x10')]['message']);return _0x55c5a5(_0x58c775[_0xd937('0x10')][_0xd937('0x12')]);}logger[_0xd937('0x10')](_0xd937('0xb'),_0x6f1511,_0x58c775[_0xd937('0x10')]['message']);return _0x4207d6(_0x58c775[_0xd937('0x10')][_0xd937('0x12')]);}else{logger[_0xd937('0xa')](_0xd937('0xb'),_0x6f1511,'request\x20sent');_0x4207d6(_0x58c775['result'][_0xd937('0x12')]);}})['catch'](function(_0x584995){logger[_0xd937('0x10')](_0xd937('0xb'),_0x6f1511,_0x584995);_0x55c5a5(_0x584995);});});}
\ No newline at end of file
index 9301d79..9d4ac1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2998=['addSmtp','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addImap'];(function(_0x31bc55,_0x2735ad){var _0x50b2cf=function(_0x122982){while(--_0x122982){_0x31bc55['push'](_0x31bc55['shift']());}};_0x50b2cf(++_0x2735ad);}(_0x2998,0x1cf));var _0x8299=function(_0x5c0832,_0x1b480f){_0x5c0832=_0x5c0832-0x0;var _0x170641=_0x2998[_0x5c0832];return _0x170641;};'use strict';var multer=require(_0x8299('0x0'));var util=require(_0x8299('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8299('0x2'));var router=express[_0x8299('0x3')]();var fs_extra=require(_0x8299('0x4'));var auth=require(_0x8299('0x5'));var interaction=require(_0x8299('0x6'));var config=require(_0x8299('0x7'));var controller=require('./mailAccount.controller');router[_0x8299('0x8')]('/',auth['isAuthenticated'](),controller[_0x8299('0x9')]);router['get'](_0x8299('0xa'),auth[_0x8299('0xb')](),controller[_0x8299('0xc')]);router[_0x8299('0x8')](_0x8299('0xd'),auth[_0x8299('0xb')](),controller[_0x8299('0xe')]);router[_0x8299('0x8')](_0x8299('0xf'),auth[_0x8299('0xb')](),controller[_0x8299('0x10')]);router[_0x8299('0x8')](_0x8299('0x11'),auth['isAuthenticated'](),controller[_0x8299('0x12')]);router[_0x8299('0x8')](_0x8299('0x13'),auth[_0x8299('0xb')](),controller[_0x8299('0x14')]);router[_0x8299('0x8')](_0x8299('0x15'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x8299('0x8')]('/:id/interactions',auth[_0x8299('0xb')](),controller[_0x8299('0x16')]);router[_0x8299('0x8')](_0x8299('0x17'),auth[_0x8299('0xb')](),controller[_0x8299('0x18')]);router[_0x8299('0x8')]('/:id/messages',auth[_0x8299('0xb')](),controller[_0x8299('0x19')]);router[_0x8299('0x8')]('/:id/verify',auth[_0x8299('0xb')](),controller[_0x8299('0x1a')]);router[_0x8299('0x8')](_0x8299('0x1b'),auth[_0x8299('0xb')](),controller[_0x8299('0x1c')]);router[_0x8299('0x1d')]('/:id/dispositions',auth[_0x8299('0xb')](),controller[_0x8299('0x1e')]);router[_0x8299('0x1d')](_0x8299('0x11'),auth[_0x8299('0xb')](),controller['addAnswer']);router['post']('/',auth[_0x8299('0xb')](),controller['create']);router[_0x8299('0x1d')](_0x8299('0x13'),auth[_0x8299('0xb')](),controller[_0x8299('0x1f')]);router[_0x8299('0x1d')]('/:id/out_servers',auth[_0x8299('0xb')](),controller[_0x8299('0x20')]);router[_0x8299('0x1d')]('/:id/interactions',auth[_0x8299('0xb')](),controller['addInteraction']);router[_0x8299('0x1d')](_0x8299('0x17'),auth['isAuthenticated'](),controller[_0x8299('0x21')]);router[_0x8299('0x1d')](_0x8299('0x22'),auth[_0x8299('0xb')](),controller[_0x8299('0x23')]);router[_0x8299('0x1d')](_0x8299('0x1b'),auth[_0x8299('0xb')](),controller['addAgents']);router[_0x8299('0x24')](_0x8299('0xd'),auth[_0x8299('0xb')](),controller['update']);router[_0x8299('0x25')](_0x8299('0xf'),auth[_0x8299('0xb')](),controller[_0x8299('0x26')]);router[_0x8299('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8299('0x27')]);router[_0x8299('0x25')](_0x8299('0x13'),auth[_0x8299('0xb')](),controller[_0x8299('0x28')]);router[_0x8299('0x25')](_0x8299('0x15'),auth[_0x8299('0xb')](),controller[_0x8299('0x29')]);router['delete']('/:id',auth[_0x8299('0xb')](),controller[_0x8299('0x2a')]);router[_0x8299('0x25')](_0x8299('0x1b'),auth[_0x8299('0xb')](),controller[_0x8299('0x2b')]);module[_0x8299('0x2c')]=router;
\ No newline at end of file
+var _0x64ec=['/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','addImap','addSmtp','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp'];(function(_0x2e02de,_0x36f412){var _0xb7fe60=function(_0x2cf3a8){while(--_0x2cf3a8){_0x2e02de['push'](_0x2e02de['shift']());}};_0xb7fe60(++_0x36f412);}(_0x64ec,0x183));var _0xc64e=function(_0x1b936f,_0x377390){_0x1b936f=_0x1b936f-0x0;var _0x136be2=_0x64ec[_0x1b936f];return _0x136be2;};'use strict';var multer=require(_0xc64e('0x0'));var util=require('util');var path=require(_0xc64e('0x1'));var timeout=require('connect-timeout');var express=require(_0xc64e('0x2'));var router=express[_0xc64e('0x3')]();var fs_extra=require(_0xc64e('0x4'));var auth=require(_0xc64e('0x5'));var interaction=require(_0xc64e('0x6'));var config=require(_0xc64e('0x7'));var controller=require(_0xc64e('0x8'));router[_0xc64e('0x9')]('/',auth[_0xc64e('0xa')](),controller[_0xc64e('0xb')]);router[_0xc64e('0x9')](_0xc64e('0xc'),auth[_0xc64e('0xa')](),controller[_0xc64e('0xd')]);router['get'](_0xc64e('0xe'),auth[_0xc64e('0xa')](),controller[_0xc64e('0xf')]);router[_0xc64e('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xc64e('0x9')]('/:id/canned_answers',auth[_0xc64e('0xa')](),controller['getAnswers']);router[_0xc64e('0x9')](_0xc64e('0x10'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x11')]);router[_0xc64e('0x9')](_0xc64e('0x12'),auth['isAuthenticated'](),controller[_0xc64e('0x13')]);router[_0xc64e('0x9')](_0xc64e('0x14'),auth['isAuthenticated'](),controller[_0xc64e('0x15')]);router[_0xc64e('0x9')](_0xc64e('0x16'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x17')]);router[_0xc64e('0x9')]('/:id/messages',auth[_0xc64e('0xa')](),controller[_0xc64e('0x18')]);router[_0xc64e('0x9')](_0xc64e('0x19'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x1a')]);router[_0xc64e('0x9')](_0xc64e('0x1b'),auth['isAuthenticated'](),controller[_0xc64e('0x1c')]);router[_0xc64e('0x1d')](_0xc64e('0x1e'),auth['isAuthenticated'](),controller[_0xc64e('0x1f')]);router[_0xc64e('0x1d')](_0xc64e('0x20'),auth['isAuthenticated'](),controller[_0xc64e('0x21')]);router['post']('/',auth[_0xc64e('0xa')](),controller['create']);router[_0xc64e('0x1d')](_0xc64e('0x10'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x22')]);router[_0xc64e('0x1d')](_0xc64e('0x12'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x23')]);router[_0xc64e('0x1d')]('/:id/interactions',auth[_0xc64e('0xa')](),controller['addInteraction']);router[_0xc64e('0x1d')](_0xc64e('0x16'),auth['isAuthenticated'](),controller['addApplications']);router[_0xc64e('0x1d')](_0xc64e('0x24'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x25')]);router[_0xc64e('0x1d')](_0xc64e('0x1b'),auth['isAuthenticated'](),controller[_0xc64e('0x26')]);router['put'](_0xc64e('0xe'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x27')]);router[_0xc64e('0x28')](_0xc64e('0x1e'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x29')]);router[_0xc64e('0x28')](_0xc64e('0x20'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x2a')]);router[_0xc64e('0x28')](_0xc64e('0x10'),auth[_0xc64e('0xa')](),controller[_0xc64e('0x2b')]);router[_0xc64e('0x28')]('/:id/out_servers',auth[_0xc64e('0xa')](),controller[_0xc64e('0x2c')]);router[_0xc64e('0x28')](_0xc64e('0xe'),auth[_0xc64e('0xa')](),controller['destroy']);router[_0xc64e('0x28')]('/:id/users',auth[_0xc64e('0xa')](),controller['removeAgents']);module[_0xc64e('0x2d')]=router;
\ No newline at end of file
index 2d7af85..06b9bac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f64=['TEXT','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}<br/>Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9f64,0x13e));var _0x49f6=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x9f64[_0x172747];return _0x509692;};'use strict';var Sequelize=require(_0x49f6('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x49f6('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x49f6('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x49f6('0x2')]},'markAsUnread':{'type':Sequelize[_0x49f6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49f6('0x4')},'fontSize':{'type':Sequelize[_0x49f6('0x5')](0x2)[_0x49f6('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x49f6('0x2')],'defaultValue':function(){return _0x49f6('0x7');}},'notificationSound':{'type':Sequelize[_0x49f6('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x49f6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49f6('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49f6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49f6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49f6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49f6('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x49f6('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x49f6('0x3')],'defaultValue':![],'comment':_0x49f6('0x9'),'set':function(_0x314fd9){if(!_0x314fd9)this[_0x49f6('0xa')](_0x49f6('0xb'),null);this[_0x49f6('0xa')](_0x49f6('0xc'),_0x314fd9);}},'provider':{'type':Sequelize[_0x49f6('0xd')](_0x49f6('0xe'),_0x49f6('0xf'),_0x49f6('0x10'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x49f6('0x11')](_0x49f6('0x12')))return _0x49f6('0x13');return this['getDataValue'](_0x49f6('0x12'));},'set':function(_0x4c28fc){if(_0x4c28fc===_0x49f6('0x13'))_0x4c28fc=null;return this[_0x49f6('0xa')]('provider',_0x4c28fc);}}};
\ No newline at end of file
+var _0x486e=['custom','getDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}<br/>Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','provider'];(function(_0x50a45f,_0x428399){var _0x5279ef=function(_0x5c2bb3){while(--_0x5c2bb3){_0x50a45f['push'](_0x50a45f['shift']());}};_0x5279ef(++_0x428399);}(_0x486e,0x1d0));var _0xe486=function(_0x409ad2,_0x5129c1){_0x409ad2=_0x409ad2-0x0;var _0x595b5f=_0x486e[_0x409ad2];return _0x595b5f;};'use strict';var Sequelize=require(_0xe486('0x0'));module[_0xe486('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe486('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xe486('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe486('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe486('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xe486('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe486('0x2')],'allowNull':![],'defaultValue':_0xe486('0x5')},'fontSize':{'type':Sequelize[_0xe486('0x6')](0x2)[_0xe486('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe486('0x4')],'defaultValue':function(){return _0xe486('0x8');}},'notificationSound':{'type':Sequelize[_0xe486('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe486('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe486('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe486('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe486('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe486('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe486('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe486('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe486('0x3')],'defaultValue':![],'comment':_0xe486('0xa'),'set':function(_0x2ef8a1){if(!_0x2ef8a1)this[_0xe486('0xb')]('mandatoryDispositionPauseId',null);this[_0xe486('0xb')](_0xe486('0xc'),_0x2ef8a1);}},'provider':{'type':Sequelize[_0xe486('0xd')](_0xe486('0xe'),_0xe486('0xf'),_0xe486('0x10'),_0xe486('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xe486('0x12')))return _0xe486('0x13');return this[_0xe486('0x14')](_0xe486('0x12'));},'set':function(_0x4ca3a7){if(_0x4ca3a7===_0xe486('0x13'))_0x4ca3a7=null;return this[_0xe486('0xb')](_0xe486('0x12'),_0x4ca3a7);}}};
\ No newline at end of file
index a14ac73..37e35d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9db4=['query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','MailServerIn','mandatoryDispositionPause','intersection','find','body','custom','provider','secure','params','Mail\x20Account\x20not\x20found','describe','addDisposition','create','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','attach','out','messageId','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','offset','undefined','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','username','Imap','index','MailServerOut','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys'];(function(_0x165a80,_0x5a4b87){var _0x391342=function(_0x6f5853){while(--_0x6f5853){_0x165a80['push'](_0x165a80['shift']());}};_0x391342(++_0x5a4b87);}(_0x9db4,0x1e7));var _0x49db=function(_0x3804d3,_0x44f5ce){_0x3804d3=_0x3804d3-0x0;var _0x12cf35=_0x9db4[_0x3804d3];return _0x12cf35;};'use strict';var moment=require(_0x49db('0x0'));var BPromise=require(_0x49db('0x1'));var util=require(_0x49db('0x2'));var path=require(_0x49db('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x49db('0x4'));var qs=require(_0x49db('0x5'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x49db('0x6'))['db'];config[_0x49db('0x7')]=_[_0x49db('0x8')](config[_0x49db('0x7')],{'host':_0x49db('0x9'),'port':0x18eb});var socket=require(_0x49db('0xa'))(new Redis(config[_0x49db('0x7')]));require('./mailAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x49db('0xb')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3e047e,_0x78aa3f,_0x7dfcda,_0x2f1163){return new BPromise(function(_0x612011,_0x93d799){var _0x469ae0=_0x2f1163||client;return _0x469ae0[_0x49db('0xc')](_0x3e047e,_0x7dfcda)[_0x49db('0xd')](function(_0x4e964d){logger[_0x49db('0xe')](_0x49db('0xf'),_0x78aa3f,'request\x20sent');logger[_0x49db('0x10')](_0x49db('0x11'),_0x78aa3f,_0x49db('0x12'),JSON[_0x49db('0x13')](_0x4e964d));if(_0x4e964d['error']){if(_0x4e964d[_0x49db('0x14')][_0x49db('0x15')]===0x1f4){logger[_0x49db('0x14')](_0x49db('0xf'),_0x78aa3f,_0x4e964d[_0x49db('0x14')][_0x49db('0x16')]);return _0x93d799(_0x4e964d[_0x49db('0x14')]['message']);}logger[_0x49db('0x14')](_0x49db('0xf'),_0x78aa3f,_0x4e964d[_0x49db('0x14')]['message']);return _0x612011(_0x4e964d[_0x49db('0x14')][_0x49db('0x16')]);}else{logger['info'](_0x49db('0xf'),_0x78aa3f,_0x49db('0x12'));_0x612011(_0x4e964d['result'][_0x49db('0x16')]);}})[_0x49db('0x17')](function(_0x364ed7){logger[_0x49db('0x14')](_0x49db('0xf'),_0x78aa3f,_0x364ed7);_0x93d799(_0x364ed7);});});}function respondWithStatusCode(_0x4af553,_0x3e2a66){_0x3e2a66=_0x3e2a66||0xcc;return function(_0x290b50){if(_0x290b50){return _0x4af553['sendStatus'](_0x3e2a66);}return _0x4af553['status'](_0x3e2a66)[_0x49db('0x18')]();};}function respondWithResult(_0x2b1d43,_0x37f9ab){_0x37f9ab=_0x37f9ab||0xc8;return function(_0x4f97f0){if(_0x4f97f0){return _0x2b1d43[_0x49db('0x19')](_0x37f9ab)['json'](_0x4f97f0);}};}function respondWithFilteredResult(_0xebf746,_0x5d4362){return function(_0x403359){if(_0x403359){var _0x5ca61d=typeof _0x5d4362[_0x49db('0x1a')]===_0x49db('0x1b')&&typeof _0x5d4362['limit']===_0x49db('0x1b');var _0x5edb3b=_0x403359[_0x49db('0x1c')];var _0x29aa2b=_0x5ca61d?0x0:_0x5d4362[_0x49db('0x1a')];var _0x3ffd73=_0x5ca61d?_0x403359['count']:_0x5d4362[_0x49db('0x1a')]+_0x5d4362['limit'];var _0x3e176f;if(_0x3ffd73>=_0x5edb3b){_0x3ffd73=_0x5edb3b;_0x3e176f=0xc8;}else{_0x3e176f=0xce;}_0xebf746[_0x49db('0x19')](_0x3e176f);return _0xebf746[_0x49db('0x1d')](_0x49db('0x1e'),_0x29aa2b+'-'+_0x3ffd73+'/'+_0x5edb3b)['json'](_0x403359);}return null;};}function saveUpdates(_0x4d9c35){return function(_0x206643){if(_0x206643){return _0x206643[_0x49db('0x1f')](_0x4d9c35)['then'](function(_0x1b22f6){return _0x1b22f6;});}return null;};}function removeEntity(_0x54f658){return function(_0xe88639){if(_0xe88639){return _0xe88639[_0x49db('0x20')]()['then'](function(){var _0x231e65=_0xe88639[_0x49db('0x21')]({'plain':!![]});var _0x55c126=_0x49db('0x22');return db[_0x49db('0x23')]['destroy']({'where':{'type':_0x55c126,'resourceId':_0x231e65['id']}})[_0x49db('0xd')](function(){return _0xe88639;});})[_0x49db('0xd')](function(){_0x54f658['status'](0xcc)[_0x49db('0x18')]();});}};}function handleEntityNotFound(_0x59864c){return function(_0x15a52b){if(!_0x15a52b){_0x59864c[_0x49db('0x24')](0x194);}return _0x15a52b;};}function handleError(_0x4288a4,_0x237136){_0x237136=_0x237136||0x1f4;return function(_0x589439){logger[_0x49db('0x14')](_0x589439[_0x49db('0x25')]);if(_0x589439[_0x49db('0x26')]){delete _0x589439[_0x49db('0x26')];}_0x4288a4['status'](_0x237136)[_0x49db('0x27')](_0x589439);};}function getImapHost(_0x351b9a){switch(_0x351b9a){case _0x49db('0x28'):return _0x49db('0x29');case _0x49db('0x2a'):return _0x49db('0x2b');case _0x49db('0x2c'):return _0x49db('0x2d');case'outlook365':return _0x49db('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x351b9a);}function getSmtpHost(_0xa71da5){switch(_0xa71da5){case _0x49db('0x28'):return _0x49db('0x2f');case _0x49db('0x2a'):return _0x49db('0x30');case _0x49db('0x2c'):return'smtp-mail.outlook.com';case _0x49db('0x31'):return _0x49db('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0xa71da5);}function getAuthenticationOptions(_0x2311bb,_0xc0ee43){var _0x54947c={};var _0x3126bb={};if(_0x2311bb){_0x54947c[_0x49db('0x33')]=_0x3126bb[_0x49db('0x33')]=_0xc0ee43['username'];_0x54947c[_0x49db('0x34')]=_0x3126bb[_0x49db('0x35')]=_0xc0ee43[_0x49db('0x34')];if(_0xc0ee43[_0x49db('0x36')]){_0x54947c[_0x49db('0x36')]=_0x3126bb[_0x49db('0x36')]=!![];_0x54947c[_0x49db('0x37')]=_0x3126bb[_0x49db('0x37')]=_0xc0ee43[_0x49db('0x37')];_0x54947c['password']=_0x3126bb[_0x49db('0x35')]=null;}else{_0x54947c['CloudProviderId']=_0x3126bb[_0x49db('0x37')]=null;}_0x54947c[_0x49db('0x38')]=getImapHost(_0x2311bb);_0x54947c[_0x49db('0x39')]=0x3e1;_0x3126bb[_0x49db('0x38')]=getSmtpHost(_0x2311bb);_0x3126bb['port']=0x24b;_0x3126bb['secure']=![];_0x54947c['service']=_0x3126bb[_0x49db('0x3a')]=null;}else{if(_0xc0ee43[_0x49db('0x3b')]){_0x54947c[_0x49db('0x33')]=_0x3126bb['user']=_0xc0ee43[_0x49db('0x3c')];_0x54947c[_0x49db('0x34')]=_0x3126bb['pass']=_0xc0ee43[_0x49db('0x34')];}else{_0x54947c[_0x49db('0x3b')]=_0x3126bb[_0x49db('0x3b')]=![];_0x54947c['user']=_0x3126bb[_0x49db('0x33')]=null;_0x54947c[_0x49db('0x34')]=_0x3126bb['pass']=null;}_0x54947c[_0x49db('0x38')]=_0xc0ee43['Imap'][_0x49db('0x38')];_0x54947c['port']=_0xc0ee43[_0x49db('0x3d')][_0x49db('0x39')];_0x3126bb[_0x49db('0x38')]=_0xc0ee43['Smtp'][_0x49db('0x38')];_0x3126bb[_0x49db('0x39')]=_0xc0ee43['Smtp'][_0x49db('0x39')];}return{'Imap':_0x54947c,'Smtp':_0x3126bb};}exports[_0x49db('0x3e')]=function(_0x259e25,_0x1fa268){var _0x4ffdcd={'include':[{'model':db['MailServerIn'],'as':_0x49db('0x3d')},{'model':db[_0x49db('0x3f')],'as':_0x49db('0x40')},{'model':db[_0x49db('0x41')],'as':'mandatoryDispositionPause'}]},_0x8cb6e1={},_0x79f3df={'count':0x0,'rows':[]};var _0x23e3be=_[_0x49db('0x42')](db[_0x49db('0x43')][_0x49db('0x44')],function(_0x3801fe){return{'name':_0x3801fe[_0x49db('0x45')],'type':_0x3801fe[_0x49db('0x46')][_0x49db('0x47')]};});_0x8cb6e1[_0x49db('0x48')]=_[_0x49db('0x42')](_0x23e3be,'name');_0x8cb6e1['query']=_[_0x49db('0x49')](_0x259e25[_0x49db('0x4a')]);_0x8cb6e1['filters']=_['intersection'](_0x8cb6e1['model'],_0x8cb6e1['query']);_0x4ffdcd[_0x49db('0x4b')]=_['intersection'](_0x8cb6e1[_0x49db('0x48')],qs[_0x49db('0x4c')](_0x259e25[_0x49db('0x4a')][_0x49db('0x4c')]));_0x4ffdcd[_0x49db('0x4b')]=_0x4ffdcd[_0x49db('0x4b')][_0x49db('0x4d')]?_0x4ffdcd[_0x49db('0x4b')]:_0x8cb6e1[_0x49db('0x48')];if(!_0x259e25[_0x49db('0x4a')][_0x49db('0x4e')](_0x49db('0x4f'))){_0x4ffdcd[_0x49db('0x50')]=qs[_0x49db('0x50')](_0x259e25[_0x49db('0x4a')][_0x49db('0x50')]);_0x4ffdcd[_0x49db('0x1a')]=qs['offset'](_0x259e25[_0x49db('0x4a')][_0x49db('0x1a')]);}_0x4ffdcd[_0x49db('0x51')]=qs['sort'](_0x259e25[_0x49db('0x4a')][_0x49db('0x52')]);_0x4ffdcd[_0x49db('0x53')]=qs[_0x49db('0x54')](_[_0x49db('0x55')](_0x259e25[_0x49db('0x4a')],_0x8cb6e1['filters']),_0x23e3be);if(_0x259e25['query'][_0x49db('0x56')]){_0x4ffdcd[_0x49db('0x53')]=_[_0x49db('0x57')](_0x4ffdcd[_0x49db('0x53')],{'$or':_['map'](_0x23e3be,function(_0x2b97a0){if(_0x2b97a0['type']!==_0x49db('0x58')){var _0x236525={};_0x236525[_0x2b97a0['name']]={'$like':'%'+_0x259e25[_0x49db('0x4a')][_0x49db('0x56')]+'%'};return _0x236525;}})});}_0x4ffdcd=_[_0x49db('0x57')]({},_0x4ffdcd,_0x259e25[_0x49db('0x59')]);var _0x524f7b={'where':_0x4ffdcd[_0x49db('0x53')]};return db[_0x49db('0x43')]['count'](_0x524f7b)[_0x49db('0xd')](function(_0x677ec1){_0x79f3df['count']=_0x677ec1;if(_0x259e25['query'][_0x49db('0x5a')]){_0x4ffdcd[_0x49db('0x5b')]=[{'all':!![]}];}return db[_0x49db('0x43')][_0x49db('0x5c')](_0x4ffdcd);})['then'](function(_0x2f4a50){_0x79f3df[_0x49db('0x5d')]=_0x2f4a50;return _0x79f3df;})[_0x49db('0xd')](respondWithFilteredResult(_0x1fa268,_0x4ffdcd))['catch'](handleError(_0x1fa268,null));};exports[_0x49db('0x5e')]=function(_0x216108,_0x4cf1c9){var _0x1e2e01={'raw':![],'where':{'id':_0x216108['params']['id']},'include':[{'model':db[_0x49db('0x5f')],'as':_0x49db('0x3d')},{'model':db[_0x49db('0x3f')],'as':_0x49db('0x40')},{'model':db[_0x49db('0x41')],'as':_0x49db('0x60')}]},_0x3df2fe={};_0x3df2fe[_0x49db('0x48')]=_[_0x49db('0x49')](db[_0x49db('0x43')][_0x49db('0x44')]);_0x3df2fe[_0x49db('0x4a')]=_[_0x49db('0x49')](_0x216108[_0x49db('0x4a')]);_0x3df2fe[_0x49db('0x54')]=_['intersection'](_0x3df2fe[_0x49db('0x48')],_0x3df2fe['query']);_0x1e2e01['attributes']=_[_0x49db('0x61')](_0x3df2fe['model'],qs[_0x49db('0x4c')](_0x216108[_0x49db('0x4a')][_0x49db('0x4c')]));_0x1e2e01[_0x49db('0x4b')]=_0x1e2e01[_0x49db('0x4b')]['length']?_0x1e2e01[_0x49db('0x4b')]:_0x3df2fe[_0x49db('0x48')];if(_0x216108[_0x49db('0x4a')]['includeAll']){_0x1e2e01[_0x49db('0x5b')]=[{'all':!![]}];}_0x1e2e01=_[_0x49db('0x57')]({},_0x1e2e01,_0x216108[_0x49db('0x59')]);return db['MailAccount'][_0x49db('0x62')](_0x1e2e01)[_0x49db('0xd')](handleEntityNotFound(_0x4cf1c9,null))[_0x49db('0xd')](respondWithResult(_0x4cf1c9,null))['catch'](handleError(_0x4cf1c9,null));};exports['update']=function(_0x392568,_0x8b53aa){if(_0x392568['body']['id']){delete _0x392568[_0x49db('0x63')]['id'];}var _0x192b4e=_0x392568['body']['provider']===_0x49db('0x64')?null:_0x392568[_0x49db('0x63')][_0x49db('0x65')];var _0x49dc33=_0x392568[_0x49db('0x63')][_0x49db('0x3d')]||{};var _0x2e0981=_0x392568[_0x49db('0x63')]['Smtp']||{};if(_0x192b4e){_0x49dc33[_0x49db('0x38')]=getImapHost(_0x192b4e);_0x49dc33[_0x49db('0x39')]=0x3e1;_0x2e0981['host']=getSmtpHost(_0x192b4e);_0x2e0981[_0x49db('0x39')]=0x24b;_0x2e0981[_0x49db('0x66')]=![];}if(_0x2e0981[_0x49db('0x36')]){_0x2e0981[_0x49db('0x66')]=![];}else{_0x2e0981[_0x49db('0x37')]=null;}if(!_0x49dc33[_0x49db('0x36')])_0x49dc33[_0x49db('0x37')]=null;_0x392568['body'][_0x49db('0x3d')]=_0x49dc33;_0x392568[_0x49db('0x63')]['Smtp']=_0x2e0981;return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x392568[_0x49db('0x67')]['id']},'include':[{'model':db[_0x49db('0x5f')],'as':_0x49db('0x3d')},{'model':db[_0x49db('0x3f')],'as':'Smtp'},{'model':db['Pause'],'as':_0x49db('0x60')}]})[_0x49db('0xd')](handleEntityNotFound(_0x8b53aa,null))[_0x49db('0xd')](function(_0x30efa5){if(!_0x30efa5)throw new Error(_0x49db('0x68'));if(_0x30efa5[_0x49db('0x3a')])delete _0x392568['body'][_0x49db('0x3d')];return _0x30efa5;})[_0x49db('0xd')](saveUpdates(_0x392568['body'],null))['then'](function(_0x329ef4){if(!_0x392568[_0x49db('0x63')][_0x49db('0x3d')])return _0x329ef4;return db[_0x49db('0x5f')]['update'](_0x392568[_0x49db('0x63')][_0x49db('0x3d')],{'where':{'MailAccountId':_0x329ef4['id']}})['then'](function(){return _0x329ef4;});})[_0x49db('0xd')](function(_0xd0d634){if(!_0x392568[_0x49db('0x63')][_0x49db('0x40')])return _0xd0d634;return db[_0x49db('0x3f')][_0x49db('0x1f')](_0x392568['body'][_0x49db('0x40')],{'where':{'MailAccountId':_0xd0d634['id']}})['then'](function(){return _0xd0d634;});})[_0x49db('0xd')](respondWithResult(_0x8b53aa,null))['catch'](handleError(_0x8b53aa,null));};exports[_0x49db('0x69')]=function(_0x82d538,_0xfa1c36){return db[_0x49db('0x43')]['describe']()[_0x49db('0xd')](respondWithResult(_0xfa1c36,null))[_0x49db('0x17')](handleError(_0xfa1c36,null));};exports[_0x49db('0x6a')]=function(_0x64a211,_0xa0bfa4){if(_0x64a211[_0x49db('0x63')]['id']){delete _0x64a211[_0x49db('0x63')]['id'];}return db['MailAccount'][_0x49db('0x62')]({'where':{'id':_0x64a211[_0x49db('0x67')]['id']}})['then'](handleEntityNotFound(_0xa0bfa4,null))[_0x49db('0xd')](function(_0x10f170){if(_0x10f170){_0x64a211[_0x49db('0x63')]['MailAccountId']=_0x10f170['id'];return db['Disposition'][_0x49db('0x6b')](_0x64a211['body']);}})[_0x49db('0xd')](respondWithResult(_0xa0bfa4,null))[_0x49db('0x17')](handleError(_0xa0bfa4,null));};exports[_0x49db('0x6c')]=function(_0xccc269,_0x5c736c){var _0x5bd85f={'raw':![],'where':{}};var _0x57a7d4={};var _0xb5b59={'count':0x0,'rows':[]};return db['MailAccount'][_0x49db('0x6d')]({'where':{'id':_0xccc269[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x5c736c,null))[_0x49db('0xd')](function(_0x3131e3){if(_0x3131e3){_0x57a7d4[_0x49db('0x48')]=_[_0x49db('0x49')](db[_0x49db('0x6e')][_0x49db('0x44')]);_0x57a7d4[_0x49db('0x4a')]=_[_0x49db('0x49')](_0xccc269[_0x49db('0x4a')]);_0x57a7d4['filters']=_[_0x49db('0x61')](_0x57a7d4[_0x49db('0x48')],_0x57a7d4[_0x49db('0x4a')]);_0x5bd85f[_0x49db('0x4b')]=_[_0x49db('0x61')](_0x57a7d4[_0x49db('0x48')],qs['fields'](_0xccc269[_0x49db('0x4a')][_0x49db('0x4c')]));_0x5bd85f[_0x49db('0x4b')]=_0x5bd85f[_0x49db('0x4b')]['length']?_0x5bd85f[_0x49db('0x4b')]:_0x57a7d4['model'];if(!_0xccc269['query'][_0x49db('0x4e')](_0x49db('0x4f'))){_0x5bd85f[_0x49db('0x50')]=qs[_0x49db('0x50')](_0xccc269['query'][_0x49db('0x50')]);_0x5bd85f[_0x49db('0x1a')]=qs[_0x49db('0x1a')](_0xccc269[_0x49db('0x4a')][_0x49db('0x1a')]);}_0x5bd85f[_0x49db('0x51')]=qs['sort'](_0xccc269[_0x49db('0x4a')]['sort']);_0x5bd85f['where']=qs[_0x49db('0x54')](_[_0x49db('0x55')](_0xccc269[_0x49db('0x4a')],_0x57a7d4[_0x49db('0x54')]));_0x5bd85f[_0x49db('0x53')]['MailAccountId']=_0x3131e3['id'];if(_0xccc269[_0x49db('0x4a')][_0x49db('0x56')]){_0x5bd85f['where']=_[_0x49db('0x57')](_0x5bd85f[_0x49db('0x53')],{'$or':_[_0x49db('0x42')](_0x5bd85f[_0x49db('0x4b')],function(_0x2f05eb){var _0x30a948={};_0x30a948[_0x2f05eb]={'$like':'%'+_0xccc269[_0x49db('0x4a')][_0x49db('0x56')]+'%'};return _0x30a948;})});}_0x5bd85f=_['merge']({},_0x5bd85f,_0xccc269[_0x49db('0x59')]);return db['Disposition'][_0x49db('0x1c')]({'where':_0x5bd85f[_0x49db('0x53')]})['then'](function(_0x580e47){_0xb5b59[_0x49db('0x1c')]=_0x580e47;if(_0xccc269[_0x49db('0x4a')]['includeAll']){_0x5bd85f[_0x49db('0x5b')]=[{'all':!![]}];}return db[_0x49db('0x6e')][_0x49db('0x5c')](_0x5bd85f);})[_0x49db('0xd')](function(_0x929fc3){_0xb5b59['rows']=_0x929fc3;return _0xb5b59;});}})[_0x49db('0xd')](respondWithFilteredResult(_0x5c736c,_0x5bd85f))[_0x49db('0x17')](handleError(_0x5c736c,null));};exports[_0x49db('0x6f')]=function(_0x20e13f,_0x5a4c53){return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x20e13f[_0x49db('0x67')]['id']}})['then'](handleEntityNotFound(_0x5a4c53,null))[_0x49db('0xd')](function(_0xf1ece2){if(_0xf1ece2){return _0xf1ece2[_0x49db('0x6f')](_0x20e13f['query'][_0x49db('0x70')]);}})[_0x49db('0xd')](respondWithStatusCode(_0x5a4c53,null))[_0x49db('0x17')](handleError(_0x5a4c53,null));};exports[_0x49db('0x71')]=function(_0xc9f641,_0x756a28){if(_0xc9f641['body']['id']){delete _0xc9f641['body']['id'];}return db[_0x49db('0x43')]['find']({'where':{'id':_0xc9f641[_0x49db('0x67')]['id']}})['then'](handleEntityNotFound(_0x756a28,null))[_0x49db('0xd')](function(_0x5b3a52){if(_0x5b3a52){_0xc9f641['body'][_0x49db('0x72')]=_0x5b3a52['id'];return db[_0x49db('0x73')][_0x49db('0x6b')](_0xc9f641[_0x49db('0x63')]);}})[_0x49db('0xd')](respondWithResult(_0x756a28,null))[_0x49db('0x17')](handleError(_0x756a28,null));};exports['getAnswers']=function(_0x368bc9,_0x57b61c){var _0x192e59={'raw':![],'where':{}};var _0x43e2da={};var _0x57ac8c={'count':0x0,'rows':[]};return db[_0x49db('0x43')][_0x49db('0x6d')]({'where':{'id':_0x368bc9[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x57b61c,null))[_0x49db('0xd')](function(_0x1148cc){if(_0x1148cc){_0x43e2da[_0x49db('0x48')]=_[_0x49db('0x49')](db['CannedAnswer']['rawAttributes']);_0x43e2da['query']=_[_0x49db('0x49')](_0x368bc9['query']);_0x43e2da[_0x49db('0x54')]=_['intersection'](_0x43e2da[_0x49db('0x48')],_0x43e2da[_0x49db('0x4a')]);_0x192e59[_0x49db('0x4b')]=_['intersection'](_0x43e2da[_0x49db('0x48')],qs[_0x49db('0x4c')](_0x368bc9[_0x49db('0x4a')][_0x49db('0x4c')]));_0x192e59[_0x49db('0x4b')]=_0x192e59[_0x49db('0x4b')][_0x49db('0x4d')]?_0x192e59[_0x49db('0x4b')]:_0x43e2da[_0x49db('0x48')];if(!_0x368bc9[_0x49db('0x4a')][_0x49db('0x4e')]('nolimit')){_0x192e59[_0x49db('0x50')]=qs[_0x49db('0x50')](_0x368bc9[_0x49db('0x4a')]['limit']);_0x192e59[_0x49db('0x1a')]=qs[_0x49db('0x1a')](_0x368bc9[_0x49db('0x4a')][_0x49db('0x1a')]);}_0x192e59['order']=qs[_0x49db('0x52')](_0x368bc9[_0x49db('0x4a')][_0x49db('0x52')]);_0x192e59[_0x49db('0x53')]=qs['filters'](_[_0x49db('0x55')](_0x368bc9['query'],_0x43e2da['filters']));_0x192e59[_0x49db('0x53')][_0x49db('0x72')]=_0x1148cc['id'];if(_0x368bc9[_0x49db('0x4a')]['filter']){_0x192e59[_0x49db('0x53')]=_['merge'](_0x192e59['where'],{'$or':_[_0x49db('0x42')](_0x192e59[_0x49db('0x4b')],function(_0x413396){var _0x1f2914={};_0x1f2914[_0x413396]={'$like':'%'+_0x368bc9[_0x49db('0x4a')][_0x49db('0x56')]+'%'};return _0x1f2914;})});}_0x192e59=_['merge']({},_0x192e59,_0x368bc9[_0x49db('0x59')]);return db[_0x49db('0x73')][_0x49db('0x1c')]({'where':_0x192e59[_0x49db('0x53')]})[_0x49db('0xd')](function(_0x1555ae){_0x57ac8c[_0x49db('0x1c')]=_0x1555ae;if(_0x368bc9[_0x49db('0x4a')][_0x49db('0x5a')]){_0x192e59['include']=[{'all':!![]}];}return db[_0x49db('0x73')]['findAll'](_0x192e59);})[_0x49db('0xd')](function(_0x27161d){_0x57ac8c[_0x49db('0x5d')]=_0x27161d;return _0x57ac8c;});}})[_0x49db('0xd')](respondWithFilteredResult(_0x57b61c,_0x192e59))['catch'](handleError(_0x57b61c,null));};exports['removeAnswers']=function(_0x2ae8f7,_0x37df7d){return db[_0x49db('0x43')]['find']({'where':{'id':_0x2ae8f7[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x37df7d,null))[_0x49db('0xd')](function(_0x4e777f){if(_0x4e777f){return _0x4e777f['removeAnswers'](_0x2ae8f7['query'][_0x49db('0x70')]);}})[_0x49db('0xd')](respondWithStatusCode(_0x37df7d,null))[_0x49db('0x17')](handleError(_0x37df7d,null));};exports[_0x49db('0x6b')]=function(_0x2a3018,_0x137c02){var _0xf22d3a={'name':_0x2a3018[_0x49db('0x63')][_0x49db('0x26')],'key':_0x2a3018[_0x49db('0x63')]['key'],'provider':_0x2a3018[_0x49db('0x63')]['provider']===_0x49db('0x64')?null:_0x2a3018[_0x49db('0x63')][_0x49db('0x65')],'email':_0x2a3018[_0x49db('0x63')][_0x49db('0x74')],'ListId':_0x2a3018[_0x49db('0x63')][_0x49db('0x75')],'active':!_[_0x49db('0x76')](_0x2a3018[_0x49db('0x63')]['active'])?_0x2a3018[_0x49db('0x63')][_0x49db('0x77')]:!![],'description':_0x2a3018['body'][_0x49db('0x78')]||null};var _0x457c38=getAuthenticationOptions(_0xf22d3a[_0x49db('0x65')],_0x2a3018[_0x49db('0x63')]);_0xf22d3a[_0x49db('0x3d')]=_0x457c38[_0x49db('0x3d')];_0xf22d3a[_0x49db('0x40')]=_0x457c38['Smtp'];return db[_0x49db('0x43')][_0x49db('0x6b')](_0xf22d3a,{'include':[{'model':db[_0x49db('0x3f')],'as':_0x49db('0x40')},{'model':db[_0x49db('0x5f')],'as':_0x49db('0x3d')}]})[_0x49db('0xd')](function(_0x5b3b30){var _0xd6f751=_0x2a3018[_0x49db('0x33')][_0x49db('0x21')]({'plain':!![]});if(!_0xd6f751)throw new Error(_0x49db('0x79'));if(_0xd6f751[_0x49db('0x7a')]===_0x49db('0x33')){var _0x1bace4=_0x5b3b30[_0x49db('0x21')]({'plain':!![]});return db[_0x49db('0x7b')]['find']({'where':{'name':'MailAccounts','userProfileId':_0xd6f751['userProfileId']},'raw':!![]})[_0x49db('0xd')](function(_0x64fcc0){if(_0x64fcc0&&_0x64fcc0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1bace4[_0x49db('0x26')],'resourceId':_0x1bace4['id'],'type':_0x64fcc0[_0x49db('0x26')],'sectionId':_0x64fcc0['id']},{})['then'](function(){return _0x5b3b30;});}else{return _0x5b3b30;}})[_0x49db('0x17')](function(_0x1b8c42){logger['error'](_0x49db('0x7c'),_0x1b8c42);throw _0x1b8c42;});}return _0x5b3b30;})[_0x49db('0xd')](respondWithResult(_0x137c02,0xc9))[_0x49db('0x17')](handleError(_0x137c02,null));};exports[_0x49db('0x7d')]=function(_0x110790,_0x25f252){return db[_0x49db('0x43')][_0x49db('0x6d')]({'where':{'id':_0x110790['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x25f252,null))[_0x49db('0xd')](function(_0x2d074f){if(_0x2d074f){return _0x2d074f[_0x49db('0x7d')]();}return null;})[_0x49db('0xd')](respondWithResult(_0x25f252,null))[_0x49db('0x17')](handleError(_0x25f252,null));};exports['addImap']=function(_0x853603,_0x43da46){if(_0x853603['body']['id']){delete _0x853603['body']['id'];}return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x853603[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x43da46,null))[_0x49db('0xd')](function(_0x5d9060){if(_0x5d9060){_0x853603[_0x49db('0x63')][_0x49db('0x72')]=_0x5d9060['id'];return db['MailServerIn']['create'](_0x853603[_0x49db('0x63')]);}})['then'](respondWithResult(_0x43da46,null))['catch'](handleError(_0x43da46,null));};exports[_0x49db('0x7e')]=function(_0x1e73ed,_0x86c094){return db['MailAccount']['findOne']({'where':{'id':_0x1e73ed[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x86c094,null))[_0x49db('0xd')](function(_0x2e6265){if(_0x2e6265){return _0x2e6265['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x86c094,null))[_0x49db('0x17')](handleError(_0x86c094,null));};exports[_0x49db('0x7f')]=function(_0x4e49d4,_0x2ede87){return db[_0x49db('0x43')][_0x49db('0x6d')]({'where':{'id':_0x4e49d4['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x2ede87,null))['then'](function(_0x443e9a){if(_0x443e9a){return _0x443e9a['getSmtp']();}return null;})[_0x49db('0xd')](respondWithResult(_0x2ede87,null))[_0x49db('0x17')](handleError(_0x2ede87,null));};exports['addSmtp']=function(_0x390e51,_0x5beb69){if(_0x390e51[_0x49db('0x63')]['id']){delete _0x390e51['body']['id'];}return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x390e51['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x5beb69,null))[_0x49db('0xd')](function(_0x65674d){if(_0x65674d){_0x390e51[_0x49db('0x63')]['MailAccountId']=_0x65674d['id'];return db[_0x49db('0x3f')]['create'](_0x390e51[_0x49db('0x63')]);}})[_0x49db('0xd')](respondWithResult(_0x5beb69,null))[_0x49db('0x17')](handleError(_0x5beb69,null));};exports['removeSmtp']=function(_0x1b1cdb,_0x3a03b6){return db[_0x49db('0x43')]['findOne']({'where':{'id':_0x1b1cdb['params']['id']}})['then'](handleEntityNotFound(_0x3a03b6,null))[_0x49db('0xd')](function(_0x3c2f73){if(_0x3c2f73){return _0x3c2f73[_0x49db('0x80')](null);}return null;})[_0x49db('0xd')](respondWithStatusCode(_0x3a03b6,null))[_0x49db('0x17')](handleError(_0x3a03b6,null));};exports[_0x49db('0x81')]=function(_0x286f81,_0x324edd){return db[_0x49db('0x82')][_0x49db('0x62')]({'where':{'id':_0x286f81[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x324edd,null))['then'](function(_0x17a488){if(_0x17a488){return _0x17a488[_0x49db('0x81')](_0x286f81[_0x49db('0x63')][_0x49db('0x70')],_[_0x49db('0x83')](_0x286f81['body'],['ids','id'])||{});}})[_0x49db('0xd')](respondWithResult(_0x324edd,null))[_0x49db('0x17')](handleError(_0x324edd,null));};exports[_0x49db('0x84')]=function(_0x2b8f81,_0x2746be){var _0xee1db={'raw':![],'where':{}};var _0x1e32ca={};var _0x4cfe17={'count':0x0,'rows':[]};return db[_0x49db('0x43')]['findOne']({'where':{'id':_0x2b8f81['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x2746be,null))[_0x49db('0xd')](function(_0x508041){if(_0x508041){_0x1e32ca[_0x49db('0x48')]=_[_0x49db('0x49')](db['MailInteraction'][_0x49db('0x44')]);_0x1e32ca[_0x49db('0x4a')]=_[_0x49db('0x49')](_0x2b8f81[_0x49db('0x4a')]);_0x1e32ca[_0x49db('0x54')]=_['intersection'](_0x1e32ca['model'],_0x1e32ca[_0x49db('0x4a')]);_0xee1db[_0x49db('0x4b')]=_['intersection'](_0x1e32ca[_0x49db('0x48')],qs[_0x49db('0x4c')](_0x2b8f81['query'][_0x49db('0x4c')]));_0xee1db[_0x49db('0x4b')]=_0xee1db[_0x49db('0x4b')]['length']?_0xee1db[_0x49db('0x4b')]:_0x1e32ca[_0x49db('0x48')];if(!_0x2b8f81[_0x49db('0x4a')]['hasOwnProperty'](_0x49db('0x4f'))){_0xee1db[_0x49db('0x50')]=qs[_0x49db('0x50')](_0x2b8f81[_0x49db('0x4a')]['limit']);_0xee1db[_0x49db('0x1a')]=qs[_0x49db('0x1a')](_0x2b8f81[_0x49db('0x4a')][_0x49db('0x1a')]);}_0xee1db[_0x49db('0x51')]=qs[_0x49db('0x52')](_0x2b8f81['query'][_0x49db('0x52')]);_0xee1db[_0x49db('0x53')]=qs[_0x49db('0x54')](_[_0x49db('0x55')](_0x2b8f81[_0x49db('0x4a')],_0x1e32ca[_0x49db('0x54')]));_0xee1db[_0x49db('0x53')][_0x49db('0x72')]=_0x508041['id'];if(_0x2b8f81[_0x49db('0x4a')]['filter']){_0xee1db['where']=_[_0x49db('0x57')](_0xee1db['where'],{'$or':_['map'](_0xee1db['attributes'],function(_0x17e92f){var _0x52af56={};_0x52af56[_0x17e92f]={'$like':'%'+_0x2b8f81[_0x49db('0x4a')][_0x49db('0x56')]+'%'};return _0x52af56;})});}_0xee1db=_[_0x49db('0x57')]({},_0xee1db,_0x2b8f81[_0x49db('0x59')]);return db['MailInteraction'][_0x49db('0x1c')]({'where':_0xee1db[_0x49db('0x53')]})[_0x49db('0xd')](function(_0x5eb850){_0x4cfe17[_0x49db('0x1c')]=_0x5eb850;if(_0x2b8f81[_0x49db('0x4a')][_0x49db('0x5a')]){_0xee1db[_0x49db('0x5b')]=[{'model':db[_0x49db('0x85')],'as':_0x49db('0x86'),'required':![]},{'model':db[_0x49db('0x87')],'as':_0x49db('0x88'),'attributes':['name','fullname',_0x49db('0x89')],'required':![]},{'model':db[_0x49db('0x8a')],'as':_0x49db('0x8b'),'attributes':['id','name',_0x49db('0x8c')],'where':_0x2b8f81[_0x49db('0x4a')][_0x49db('0x8d')]?{'id':_0x2b8f81[_0x49db('0x4a')][_0x49db('0x8d')]}:undefined,'required':_0x2b8f81[_0x49db('0x4a')][_0x49db('0x8d')]?!![]:![]}];}return db[_0x49db('0x82')][_0x49db('0x5c')](_0xee1db);})[_0x49db('0xd')](function(_0x1ac138){_0x4cfe17[_0x49db('0x5d')]=_0x1ac138;return _0x4cfe17;});}})[_0x49db('0xd')](respondWithFilteredResult(_0x2746be,_0xee1db))[_0x49db('0x17')](handleError(_0x2746be,null));};exports[_0x49db('0x8e')]=function addApplications(_0x366f94,_0xf5e6ac){var _0x39174e=_0x366f94[_0x49db('0x67')]['id'];var _0x20cd93=_0x366f94[_0x49db('0x63')];var _0x18dc62=0xc8;var _0x510646=null;return db['sequelize'][_0x49db('0x8f')]({'isolationLevel':db['sequelize'][_0x49db('0x90')][_0x49db('0x91')][_0x49db('0x92')]},function(_0x4f71fb){return db[_0x49db('0x43')][_0x49db('0x6d')]({'where':{'id':_0x39174e},'transaction':_0x4f71fb})[_0x49db('0xd')](function(_0x36aeaf){if(_0x36aeaf){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x39174e},'transaction':_0x4f71fb})['then'](function(){var _0x3296c8=_[_0x49db('0x42')](_0x20cd93,function(_0x1ad7d8){_0x1ad7d8[_0x49db('0x72')]=_0x39174e;return _0x1ad7d8;});return db[_0x49db('0x93')]['bulkCreate'](_0x3296c8,{'transaction':_0x4f71fb});});}else{_0x18dc62=0x194;_0x510646=[];}});})[_0x49db('0xd')](function(){if(_0x18dc62!==0x194){return db[_0x49db('0x93')][_0x49db('0x94')]({'where':{'MailAccountId':_0x39174e},'order':_0x49db('0x95')})[_0x49db('0xd')](function(_0x11bb10){_0x510646=_0x11bb10;});}})[_0x49db('0x17')](function(_0x33a955){_0x18dc62=0x1f4;logger[_0x49db('0x14')](_0x33a955['stack']);if(_0x33a955[_0x49db('0x26')]){delete _0x33a955[_0x49db('0x26')];}_0x510646=_0x33a955;})[_0x49db('0x96')](function(){if(_0x510646===null){_0xf5e6ac[_0x49db('0x24')](_0x18dc62);}else{if(_0x18dc62===0x1f4){_0xf5e6ac[_0x49db('0x19')](_0x18dc62)[_0x49db('0x27')](_0x510646);}else{_0xf5e6ac[_0x49db('0x19')](_0x18dc62)[_0x49db('0x97')](_0x510646);}}});};exports[_0x49db('0x98')]=function(_0x4182e8,_0xf2b75d){var _0x2a6966={};var _0x4b64e3={};var _0x15c252;var _0x5beb3;return db[_0x49db('0x43')]['findOne']({'where':{'id':_0x4182e8['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0xf2b75d,null))[_0x49db('0xd')](function(_0x3ef6fa){if(_0x3ef6fa){_0x15c252=_0x3ef6fa;_0x4b64e3[_0x49db('0x48')]=_['keys'](db[_0x49db('0x93')][_0x49db('0x44')]);_0x4b64e3[_0x49db('0x4a')]=_['keys'](_0x4182e8[_0x49db('0x4a')]);_0x4b64e3[_0x49db('0x54')]=_[_0x49db('0x61')](_0x4b64e3[_0x49db('0x48')],_0x4b64e3['query']);_0x2a6966[_0x49db('0x4b')]=_[_0x49db('0x61')](_0x4b64e3['model'],qs[_0x49db('0x4c')](_0x4182e8[_0x49db('0x4a')][_0x49db('0x4c')]));_0x2a6966[_0x49db('0x4b')]=_0x2a6966['attributes'][_0x49db('0x4d')]?_0x2a6966[_0x49db('0x4b')]:_0x4b64e3['model'];_0x2a6966[_0x49db('0x51')]=qs['sort'](_0x4182e8[_0x49db('0x4a')][_0x49db('0x52')]);_0x2a6966['where']=qs[_0x49db('0x54')](_[_0x49db('0x55')](_0x4182e8[_0x49db('0x4a')],_0x4b64e3['filters']));if(_0x4182e8[_0x49db('0x4a')][_0x49db('0x56')]){_0x2a6966['where']=_['merge'](_0x2a6966[_0x49db('0x53')],{'$or':_[_0x49db('0x42')](_0x2a6966[_0x49db('0x4b')],function(_0xe35e2){var _0x5a2702={};_0x5a2702[_0xe35e2]={'$like':'%'+_0x4182e8[_0x49db('0x4a')]['filter']+'%'};return _0x5a2702;})});}_0x2a6966=_[_0x49db('0x57')]({},_0x2a6966,_0x4182e8['options']);return _0x15c252['getApplications'](_0x2a6966);}})[_0x49db('0xd')](function(_0x4555e2){if(_0x4555e2){_0x5beb3=_0x4555e2[_0x49db('0x4d')];if(!_0x4182e8[_0x49db('0x4a')]['hasOwnProperty'](_0x49db('0x4f'))){_0x2a6966['limit']=qs['limit'](_0x4182e8[_0x49db('0x4a')][_0x49db('0x50')]);_0x2a6966[_0x49db('0x1a')]=qs[_0x49db('0x1a')](_0x4182e8[_0x49db('0x4a')]['offset']);}return _0x15c252[_0x49db('0x98')](_0x2a6966);}})[_0x49db('0xd')](function(_0x4fc172){if(_0x4fc172){return _0x4fc172?{'count':_0x5beb3,'rows':_0x4fc172}:null;}})[_0x49db('0xd')](respondWithResult(_0xf2b75d,null))[_0x49db('0x17')](handleError(_0xf2b75d,null));};exports[_0x49db('0x99')]=function(_0x1d8a70,_0x369265){var _0x439cde={'raw':!![],'where':{}};var _0x2ddb3a={};var _0x304f16={'count':0x0,'rows':[]};return db['MailAccount'][_0x49db('0x6d')]({'where':{'id':_0x1d8a70['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x369265,null))[_0x49db('0xd')](function(_0x1fdd5c){if(_0x1fdd5c){_0x2ddb3a[_0x49db('0x48')]=_[_0x49db('0x49')](db[_0x49db('0x9a')][_0x49db('0x44')]);_0x2ddb3a[_0x49db('0x4a')]=_[_0x49db('0x49')](_0x1d8a70[_0x49db('0x4a')]);_0x2ddb3a[_0x49db('0x54')]=_[_0x49db('0x61')](_0x2ddb3a[_0x49db('0x48')],_0x2ddb3a[_0x49db('0x4a')]);_0x439cde[_0x49db('0x4b')]=_['intersection'](_0x2ddb3a[_0x49db('0x48')],qs[_0x49db('0x4c')](_0x1d8a70[_0x49db('0x4a')][_0x49db('0x4c')]));_0x439cde[_0x49db('0x4b')]=_0x439cde[_0x49db('0x4b')][_0x49db('0x4d')]?_0x439cde[_0x49db('0x4b')]:_0x2ddb3a['model'];if(!_0x1d8a70[_0x49db('0x4a')][_0x49db('0x4e')](_0x49db('0x4f'))){_0x439cde['limit']=qs['limit'](_0x1d8a70[_0x49db('0x4a')][_0x49db('0x50')]);_0x439cde['offset']=qs[_0x49db('0x1a')](_0x1d8a70[_0x49db('0x4a')]['offset']);}_0x439cde[_0x49db('0x51')]=qs[_0x49db('0x52')](_0x1d8a70[_0x49db('0x4a')]['sort']);_0x439cde['where']=qs[_0x49db('0x54')](_[_0x49db('0x55')](_0x1d8a70[_0x49db('0x4a')],_0x2ddb3a['filters']));_0x439cde[_0x49db('0x53')][_0x49db('0x72')]=_0x1fdd5c['id'];if(_0x1d8a70[_0x49db('0x4a')][_0x49db('0x56')]){_0x439cde[_0x49db('0x53')]=_['merge'](_0x439cde['where'],{'$or':_[_0x49db('0x42')](_0x439cde[_0x49db('0x4b')],function(_0x1299b4){var _0x20f10d={};_0x20f10d[_0x1299b4]={'$like':'%'+_0x1d8a70['query'][_0x49db('0x56')]+'%'};return _0x20f10d;})});}if(_0x1d8a70[_0x49db('0x4a')][_0x49db('0x9b')]){var _0x11a1d2=_0x1d8a70[_0x49db('0x4a')]['$gte'][_0x49db('0x9c')](',');var _0x2fb9e9={};_0x2fb9e9[_0x11a1d2[0x0]]={'$gte':moment(_0x11a1d2[0x1])[_0x49db('0x9d')](_0x49db('0x9e'))};_0x439cde[_0x49db('0x53')]=_[_0x49db('0x57')](_0x439cde['where'],_0x2fb9e9);}_0x439cde=_['merge']({},_0x439cde,_0x1d8a70[_0x49db('0x59')]);return db[_0x49db('0x9a')]['count']({'where':_0x439cde['where']})[_0x49db('0xd')](function(_0x432a1b){_0x304f16['count']=_0x432a1b;if(_0x1d8a70[_0x49db('0x4a')][_0x49db('0x5a')]){_0x439cde[_0x49db('0x5b')]=[{'all':!![]}];}return db[_0x49db('0x9a')][_0x49db('0x5c')](_0x439cde);})[_0x49db('0xd')](function(_0x27da1e){if(_0x1d8a70[_0x49db('0x4a')][_0x49db('0x9f')]===_0x49db('0xa0')){for(var _0x593fd3=0x0;_0x593fd3<_0x27da1e['length'];_0x593fd3++){_0x27da1e[_0x593fd3][_0x49db('0x63')]=juice(_0x27da1e[_0x593fd3][_0x49db('0x63')]);}}_0x304f16[_0x49db('0x5d')]=_0x27da1e;return _0x304f16;});}})[_0x49db('0xd')](respondWithFilteredResult(_0x369265,_0x439cde))['catch'](handleError(_0x369265,null));};exports[_0x49db('0x27')]=function(_0x379dae,_0x509872){var _0x493823,_0x20b690={},_0x5acbee;if(_0x379dae['body']['to']){_0x5acbee=_0x379dae[_0x49db('0x63')]['to'][_0x49db('0x9c')](',')[0x0];}return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x379dae[_0x49db('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0x49db('0xa1'),'include':[{'model':db[_0x49db('0x85')],'as':_0x49db('0xa2'),'where':{'email':_0x5acbee},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x49db('0x3f')],'as':_0x49db('0x40'),'raw':!![],'include':[{'model':db[_0x49db('0xa3')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x509872,null))[_0x49db('0xd')](function(_0x470099){if(!_0x470099)return;_0x493823=_0x470099;if(!_0x470099['Smtp'])throw new Error(_0x49db('0xa4'));if(_[_0x49db('0x76')](_0x379dae['body'][_0x49db('0xa5')])){_0x379dae[_0x49db('0x63')][_0x49db('0xa5')]=util[_0x49db('0x9d')](_0x49db('0xa6'),_0x470099[_0x49db('0x26')],_0x470099[_0x49db('0x74')]||_0x470099['Smtp'][_0x49db('0x33')]);}if(_0x379dae[_0x49db('0x63')][_0x49db('0xa7')]&&_0x379dae[_0x49db('0x63')]['attachments'][_0x49db('0x4d')]){for(var _0x9f7ca8=0x0;_0x9f7ca8<_0x379dae['body']['attachments']['length'];_0x9f7ca8+=0x1){_0x379dae[_0x49db('0x63')]['attachments'][_0x9f7ca8]={'filename':_0x379dae[_0x49db('0x63')][_0x49db('0xa7')][_0x9f7ca8]['name'],'path':path['join'](config[_0x49db('0xa8')],_0x49db('0xa9'),_0x379dae[_0x49db('0x63')][_0x49db('0xa7')][_0x9f7ca8][_0x49db('0xaa')])};}}var _0x4a8a69=_0x470099[_0x49db('0xab')]();return respondWithRpcPromise(_0x49db('0xac'),_0x49db('0xad'),{'account':_0x4a8a69,'message':_0x379dae[_0x49db('0x63')]});})['then'](function(_0x34da8c){if(!_0x34da8c)return;_0x20b690=_0x34da8c;if(!_0x493823['List'])throw new Error('List\x20not\x20found');if(_0x493823[_0x49db('0xa1')]['Contacts'][_0x49db('0x4d')])return _0x493823[_0x49db('0xa1')]['Contacts'][0x0];return db[_0x49db('0x85')][_0x49db('0x6b')](_['defaults'](_0x379dae[_0x49db('0x63')],{'firstName':_0x379dae['body']['to'],'email':_0x379dae[_0x49db('0x63')]['to'],'phone':_0x379dae[_0x49db('0x63')]['to'],'ListId':_0x493823[_0x49db('0x75')]}));})[_0x49db('0xd')](function(_0x45eb79){if(!_0x45eb79)return;var _0x581f9b={'UserId':_0x379dae[_0x49db('0x33')]['id'],'ContactId':_0x45eb79['id'],'MailAccountId':_0x493823['id'],'inReplyTo':_0x20b690['messageId'],'to':_0x379dae['body'][_0x49db('0xa5')],'cc':_0x379dae[_0x49db('0x63')]['cc'],'subject':_0x379dae[_0x49db('0x63')]['subject'],'attach':_0x379dae[_0x49db('0x63')][_0x49db('0xae')],'firstMsgDirection':_0x49db('0xaf'),'lastMsgAt':moment()[_0x49db('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x49db('0xaf'),'Messages':[_['merge'](_0x379dae[_0x49db('0x63')],{'messageId':_0x20b690[_0x49db('0xb0')],'sentAt':moment()[_0x49db('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x493823['id'],'UserId':_0x379dae[_0x49db('0x33')]['id'],'ContactId':_0x45eb79['id']})]};if(_0x379dae[_0x49db('0x63')]['Interaction']){_0x581f9b=_['merge'](_0x581f9b,_0x379dae[_0x49db('0x63')]['Interaction']);}return db['MailInteraction'][_0x49db('0x6b')](_0x581f9b,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x49db('0xd')](respondWithResult(_0x509872,null))[_0x49db('0x17')](handleError(_0x509872,null));};exports['verifySmtp']=function(_0x56e293,_0x5d258f){return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x56e293[_0x49db('0x67')]['id']},'include':[{'model':db[_0x49db('0x3f')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x49db('0xa3'),'raw':!![]}]}]})[_0x49db('0xd')](handleEntityNotFound(_0x5d258f,null))['then'](function(_0x11d5d1){if(!_0x11d5d1[_0x49db('0x40')])return;var _0x11d57d=_0x11d5d1['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x49db('0xb1'),{'account':_0x11d57d});})[_0x49db('0xd')](respondWithResult(_0x5d258f,null))[_0x49db('0x17')](handleError(_0x5d258f,null));};exports[_0x49db('0x20')]=function(_0x48fc3b,_0x5238e4){return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x48fc3b[_0x49db('0x67')]['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x5238e4,null))['then'](function(_0xa34a6d){if(_0xa34a6d&&_0xa34a6d[_0x49db('0x3a')]){throw new db[(_0x49db('0xb2'))]['ValidationError'](_0x49db('0xb3'));}return _0xa34a6d;})[_0x49db('0xd')](removeEntity(_0x5238e4,null))['catch'](handleError(_0x5238e4,null));};exports['addAgents']=function(_0x4083fe,_0x117f7e){return db[_0x49db('0x43')][_0x49db('0x62')]({'where':{'id':_0x4083fe[_0x49db('0x67')]['id']}})['then'](handleEntityNotFound(_0x117f7e,null))[_0x49db('0xd')](function(_0x3d8f0f){if(_0x3d8f0f){return _0x3d8f0f[_0x49db('0xb4')](_0x4083fe[_0x49db('0x63')][_0x49db('0x70')],_[_0x49db('0x83')](_0x4083fe[_0x49db('0x63')],[_0x49db('0x70'),'id'])||{})[_0x49db('0xb5')](function(_0x2a7faf){for(var _0x333934=0x0;_0x333934<_0x4083fe[_0x49db('0x63')]['ids'][_0x49db('0x4d')];_0x333934+=0x1){socket[_0x49db('0xb6')](_0x49db('0xb7'),{'UserId':Number(_0x4083fe[_0x49db('0x63')]['ids'][_0x333934]),'MailAccountId':Number(_0x4083fe[_0x49db('0x67')]['id'])});}return _0x2a7faf;});}})[_0x49db('0xd')](respondWithResult(_0x117f7e,null))[_0x49db('0x17')](handleError(_0x117f7e,null));};exports[_0x49db('0xb8')]=function(_0x2060f5,_0x4777b5){return db[_0x49db('0x43')]['find']({'where':{'id':_0x2060f5['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x4777b5,null))[_0x49db('0xd')](function(_0x469f9b){if(_0x469f9b){return _0x469f9b['removeAgents'](_0x2060f5[_0x49db('0x4a')][_0x49db('0x70')])[_0x49db('0xd')](function(){if(_['isArray'](_0x2060f5[_0x49db('0x4a')][_0x49db('0x70')])){for(var _0x5936c8=0x0;_0x5936c8<_0x2060f5[_0x49db('0x4a')]['ids'][_0x49db('0x4d')];_0x5936c8+=0x1){socket[_0x49db('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x2060f5[_0x49db('0x4a')]['ids'][_0x5936c8]),'MailAccountId':Number(_0x2060f5[_0x49db('0x67')]['id'])});}}else{socket[_0x49db('0xb6')](_0x49db('0xb9'),{'UserId':Number(_0x2060f5[_0x49db('0x4a')][_0x49db('0x70')]),'MailAccountId':Number(_0x2060f5[_0x49db('0x67')]['id'])});}});}})[_0x49db('0xd')](respondWithStatusCode(_0x4777b5,null))[_0x49db('0x17')](handleError(_0x4777b5,null));};exports[_0x49db('0xba')]=function(_0x17be16,_0x2cc6e1){var _0x533687={};var _0x4220f1={};var _0x2c0c58;var _0x144d37;return db[_0x49db('0x43')][_0x49db('0x6d')]({'where':{'id':_0x17be16['params']['id']}})[_0x49db('0xd')](handleEntityNotFound(_0x2cc6e1,null))[_0x49db('0xd')](function(_0x2aad82){if(_0x2aad82){_0x2c0c58=_0x2aad82;_0x4220f1[_0x49db('0x48')]=_[_0x49db('0x49')](db['User'][_0x49db('0x44')]);_0x4220f1[_0x49db('0x4a')]=_[_0x49db('0x49')](_0x17be16['query']);_0x4220f1[_0x49db('0x54')]=_[_0x49db('0x61')](_0x4220f1['model'],_0x4220f1['query']);_0x533687[_0x49db('0x4b')]=_[_0x49db('0x61')](_0x4220f1[_0x49db('0x48')],qs['fields'](_0x17be16[_0x49db('0x4a')][_0x49db('0x4c')]));_0x533687['attributes']=_0x533687[_0x49db('0x4b')][_0x49db('0x4d')]?_0x533687[_0x49db('0x4b')]:_0x4220f1[_0x49db('0x48')];_0x533687[_0x49db('0x51')]=qs['sort'](_0x17be16[_0x49db('0x4a')][_0x49db('0x52')]);_0x533687[_0x49db('0x53')]=qs['filters'](_[_0x49db('0x55')](_0x17be16[_0x49db('0x4a')],_0x4220f1[_0x49db('0x54')]));if(_0x17be16[_0x49db('0x4a')][_0x49db('0x56')]){_0x533687[_0x49db('0x53')]=_[_0x49db('0x57')](_0x533687[_0x49db('0x53')],{'$or':_[_0x49db('0x42')](_0x533687[_0x49db('0x4b')],function(_0x3d700c){var _0x45ed14={};_0x45ed14[_0x3d700c]={'$like':'%'+_0x17be16[_0x49db('0x4a')][_0x49db('0x56')]+'%'};return _0x45ed14;})});}_0x533687=_[_0x49db('0x57')]({},_0x533687,_0x17be16[_0x49db('0x59')]);return _0x2c0c58[_0x49db('0xba')](_0x533687);}})['then'](function(_0x984160){if(_0x984160){_0x144d37=_0x984160[_0x49db('0x4d')];if(!_0x17be16[_0x49db('0x4a')][_0x49db('0x4e')](_0x49db('0x4f'))){_0x533687[_0x49db('0x50')]=qs['limit'](_0x17be16[_0x49db('0x4a')][_0x49db('0x50')]);_0x533687[_0x49db('0x1a')]=qs[_0x49db('0x1a')](_0x17be16['query'][_0x49db('0x1a')]);}return _0x2c0c58[_0x49db('0xba')](_0x533687);}})['then'](function(_0x3d7c8f){if(_0x3d7c8f){return _0x3d7c8f?{'count':_0x144d37,'rows':_0x3d7c8f}:null;}})[_0x49db('0xd')](respondWithResult(_0x2cc6e1,null))[_0x49db('0x17')](handleError(_0x2cc6e1,null));};
\ No newline at end of file
+var _0xc321=['addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','subject','attach','out','format','messageId','Interaction','Messages','verifySmtp','ValidationError','addAgents','spread','removeAgents','isArray','emit','User','getAgents','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./mailAccount.socket','jayson/promise','http','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','end','status','offset','undefined','limit','count','set','json','destroy','get','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','authentication','Imap','Smtp','index','MailServerOut','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','merge','options','MailAccount','include','findAll','show','params','MailServerIn','Pause','rawAttributes','includeAll','update','body','custom','provider','find','Mail\x20Account\x20not\x20found','service','describe','addDisposition','MailAccountId','Disposition','getDispositions','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag'];(function(_0x5d9ccd,_0x38dfaa){var _0x171778=function(_0x736193){while(--_0x736193){_0x5d9ccd['push'](_0x5d9ccd['shift']());}};_0x171778(++_0x38dfaa);}(_0xc321,0x1b5));var _0x1c32=function(_0x3596b3,_0x462774){_0x3596b3=_0x3596b3-0x0;var _0x289464=_0xc321[_0x3596b3];return _0x289464;};'use strict';var moment=require(_0x1c32('0x0'));var BPromise=require(_0x1c32('0x1'));var util=require('util');var path=require('path');var _=require(_0x1c32('0x2'));var juice=require(_0x1c32('0x3'));var Redis=require(_0x1c32('0x4'));var qs=require(_0x1c32('0x5'));var logger=require(_0x1c32('0x6'))(_0x1c32('0x7'));var config=require(_0x1c32('0x8'));var db=require('../../mysqldb')['db'];config[_0x1c32('0x9')]=_['defaults'](config[_0x1c32('0x9')],{'host':_0x1c32('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c32('0x9')]));require(_0x1c32('0xb'))['register'](socket);var jayson=require(_0x1c32('0xc'));var client=jayson['client'][_0x1c32('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x5a3418,_0xf4a2aa,_0x2c376e,_0x44ef0a){return new BPromise(function(_0x3dbd18,_0x33f98f){var _0x339b34=_0x44ef0a||client;return _0x339b34[_0x1c32('0xe')](_0x5a3418,_0x2c376e)[_0x1c32('0xf')](function(_0x1291e9){logger[_0x1c32('0x10')]('MailAccount,\x20%s,\x20%s',_0xf4a2aa,_0x1c32('0x11'));logger['debug'](_0x1c32('0x12'),_0xf4a2aa,_0x1c32('0x11'),JSON[_0x1c32('0x13')](_0x1291e9));if(_0x1291e9[_0x1c32('0x14')]){if(_0x1291e9['error'][_0x1c32('0x15')]===0x1f4){logger[_0x1c32('0x14')](_0x1c32('0x16'),_0xf4a2aa,_0x1291e9[_0x1c32('0x14')][_0x1c32('0x17')]);return _0x33f98f(_0x1291e9[_0x1c32('0x14')][_0x1c32('0x17')]);}logger[_0x1c32('0x14')]('MailAccount,\x20%s,\x20%s',_0xf4a2aa,_0x1291e9[_0x1c32('0x14')][_0x1c32('0x17')]);return _0x3dbd18(_0x1291e9[_0x1c32('0x14')][_0x1c32('0x17')]);}else{logger[_0x1c32('0x10')]('MailAccount,\x20%s,\x20%s',_0xf4a2aa,_0x1c32('0x11'));_0x3dbd18(_0x1291e9[_0x1c32('0x18')]['message']);}})[_0x1c32('0x19')](function(_0x565217){logger['error']('MailAccount,\x20%s,\x20%s',_0xf4a2aa,_0x565217);_0x33f98f(_0x565217);});});}function respondWithStatusCode(_0x24cde7,_0x4ed200){_0x4ed200=_0x4ed200||0xcc;return function(_0x2552f1){if(_0x2552f1){return _0x24cde7['sendStatus'](_0x4ed200);}return _0x24cde7['status'](_0x4ed200)[_0x1c32('0x1a')]();};}function respondWithResult(_0x165323,_0x1b0743){_0x1b0743=_0x1b0743||0xc8;return function(_0x1ce317){if(_0x1ce317){return _0x165323[_0x1c32('0x1b')](_0x1b0743)['json'](_0x1ce317);}};}function respondWithFilteredResult(_0x1966db,_0x43c48f){return function(_0x813a9c){if(_0x813a9c){var _0x456e25=typeof _0x43c48f[_0x1c32('0x1c')]===_0x1c32('0x1d')&&typeof _0x43c48f[_0x1c32('0x1e')]===_0x1c32('0x1d');var _0x2f0e16=_0x813a9c[_0x1c32('0x1f')];var _0x387a18=_0x456e25?0x0:_0x43c48f['offset'];var _0x5a13fd=_0x456e25?_0x813a9c[_0x1c32('0x1f')]:_0x43c48f[_0x1c32('0x1c')]+_0x43c48f[_0x1c32('0x1e')];var _0x17f027;if(_0x5a13fd>=_0x2f0e16){_0x5a13fd=_0x2f0e16;_0x17f027=0xc8;}else{_0x17f027=0xce;}_0x1966db[_0x1c32('0x1b')](_0x17f027);return _0x1966db[_0x1c32('0x20')]('Content-Range',_0x387a18+'-'+_0x5a13fd+'/'+_0x2f0e16)[_0x1c32('0x21')](_0x813a9c);}return null;};}function saveUpdates(_0x1c9b69){return function(_0x484800){if(_0x484800){return _0x484800['update'](_0x1c9b69)['then'](function(_0x276ef9){return _0x276ef9;});}return null;};}function removeEntity(_0xb0e41){return function(_0x2db2cb){if(_0x2db2cb){return _0x2db2cb[_0x1c32('0x22')]()['then'](function(){var _0x2678f0=_0x2db2cb[_0x1c32('0x23')]({'plain':!![]});var _0xd69746='MailAccounts';return db['UserProfileResource'][_0x1c32('0x22')]({'where':{'type':_0xd69746,'resourceId':_0x2678f0['id']}})[_0x1c32('0xf')](function(){return _0x2db2cb;});})[_0x1c32('0xf')](function(){_0xb0e41[_0x1c32('0x1b')](0xcc)[_0x1c32('0x1a')]();});}};}function handleEntityNotFound(_0x494235){return function(_0x144134){if(!_0x144134){_0x494235[_0x1c32('0x24')](0x194);}return _0x144134;};}function handleError(_0x1adf64,_0x23c773){_0x23c773=_0x23c773||0x1f4;return function(_0x53e82f){logger[_0x1c32('0x14')](_0x53e82f['stack']);if(_0x53e82f['name']){delete _0x53e82f[_0x1c32('0x25')];}_0x1adf64['status'](_0x23c773)[_0x1c32('0x26')](_0x53e82f);};}function getImapHost(_0x9cfd98){switch(_0x9cfd98){case _0x1c32('0x27'):return _0x1c32('0x28');case _0x1c32('0x29'):return _0x1c32('0x2a');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x9cfd98);}function getSmtpHost(_0x52954c){switch(_0x52954c){case _0x1c32('0x27'):return'smtp.gmail.com';case _0x1c32('0x29'):return _0x1c32('0x2b');case _0x1c32('0x2c'):return _0x1c32('0x2d');case _0x1c32('0x2e'):return _0x1c32('0x2f');}throw new Error('Unknown\x20email\x20service\x20provider',_0x52954c);}function getAuthenticationOptions(_0x53c69f,_0x522382){var _0x5cc708={};var _0x4d48e8={};if(_0x53c69f){_0x5cc708[_0x1c32('0x30')]=_0x4d48e8[_0x1c32('0x30')]=_0x522382[_0x1c32('0x31')];_0x5cc708[_0x1c32('0x32')]=_0x4d48e8['pass']=_0x522382[_0x1c32('0x32')];if(_0x522382[_0x1c32('0x33')]){_0x5cc708[_0x1c32('0x33')]=_0x4d48e8[_0x1c32('0x33')]=!![];_0x5cc708[_0x1c32('0x34')]=_0x4d48e8[_0x1c32('0x34')]=_0x522382[_0x1c32('0x34')];_0x5cc708[_0x1c32('0x32')]=_0x4d48e8[_0x1c32('0x35')]=null;}else{_0x5cc708[_0x1c32('0x34')]=_0x4d48e8[_0x1c32('0x34')]=null;}_0x5cc708[_0x1c32('0x36')]=getImapHost(_0x53c69f);_0x5cc708[_0x1c32('0x37')]=0x3e1;_0x4d48e8['host']=getSmtpHost(_0x53c69f);_0x4d48e8[_0x1c32('0x37')]=0x24b;_0x4d48e8[_0x1c32('0x38')]=![];_0x5cc708['service']=_0x4d48e8['service']=null;}else{if(_0x522382[_0x1c32('0x39')]){_0x5cc708[_0x1c32('0x30')]=_0x4d48e8['user']=_0x522382[_0x1c32('0x31')];_0x5cc708['password']=_0x4d48e8[_0x1c32('0x35')]=_0x522382[_0x1c32('0x32')];}else{_0x5cc708[_0x1c32('0x39')]=_0x4d48e8[_0x1c32('0x39')]=![];_0x5cc708[_0x1c32('0x30')]=_0x4d48e8[_0x1c32('0x30')]=null;_0x5cc708['password']=_0x4d48e8['pass']=null;}_0x5cc708[_0x1c32('0x36')]=_0x522382['Imap'][_0x1c32('0x36')];_0x5cc708[_0x1c32('0x37')]=_0x522382[_0x1c32('0x3a')][_0x1c32('0x37')];_0x4d48e8[_0x1c32('0x36')]=_0x522382[_0x1c32('0x3b')][_0x1c32('0x36')];_0x4d48e8['port']=_0x522382[_0x1c32('0x3b')][_0x1c32('0x37')];}return{'Imap':_0x5cc708,'Smtp':_0x4d48e8};}exports[_0x1c32('0x3c')]=function(_0x1dd735,_0x385a3e){var _0x3d60d4={'include':[{'model':db['MailServerIn'],'as':_0x1c32('0x3a')},{'model':db[_0x1c32('0x3d')],'as':_0x1c32('0x3b')},{'model':db['Pause'],'as':_0x1c32('0x3e')}]},_0x134187={},_0x432090={'count':0x0,'rows':[]};var _0x3e184d=_[_0x1c32('0x3f')](db['MailAccount']['rawAttributes'],function(_0x5687b6){return{'name':_0x5687b6[_0x1c32('0x40')],'type':_0x5687b6[_0x1c32('0x41')][_0x1c32('0x42')]};});_0x134187[_0x1c32('0x43')]=_['map'](_0x3e184d,_0x1c32('0x25'));_0x134187[_0x1c32('0x44')]=_[_0x1c32('0x45')](_0x1dd735[_0x1c32('0x44')]);_0x134187['filters']=_[_0x1c32('0x46')](_0x134187[_0x1c32('0x43')],_0x134187[_0x1c32('0x44')]);_0x3d60d4[_0x1c32('0x47')]=_[_0x1c32('0x46')](_0x134187[_0x1c32('0x43')],qs[_0x1c32('0x48')](_0x1dd735[_0x1c32('0x44')][_0x1c32('0x48')]));_0x3d60d4[_0x1c32('0x47')]=_0x3d60d4[_0x1c32('0x47')][_0x1c32('0x49')]?_0x3d60d4[_0x1c32('0x47')]:_0x134187['model'];if(!_0x1dd735[_0x1c32('0x44')][_0x1c32('0x4a')](_0x1c32('0x4b'))){_0x3d60d4['limit']=qs[_0x1c32('0x1e')](_0x1dd735[_0x1c32('0x44')][_0x1c32('0x1e')]);_0x3d60d4[_0x1c32('0x1c')]=qs['offset'](_0x1dd735[_0x1c32('0x44')][_0x1c32('0x1c')]);}_0x3d60d4[_0x1c32('0x4c')]=qs[_0x1c32('0x4d')](_0x1dd735[_0x1c32('0x44')]['sort']);_0x3d60d4['where']=qs[_0x1c32('0x4e')](_[_0x1c32('0x4f')](_0x1dd735[_0x1c32('0x44')],_0x134187[_0x1c32('0x4e')]),_0x3e184d);if(_0x1dd735[_0x1c32('0x44')]['filter']){_0x3d60d4[_0x1c32('0x50')]=_['merge'](_0x3d60d4[_0x1c32('0x50')],{'$or':_[_0x1c32('0x3f')](_0x3e184d,function(_0x5561d4){if(_0x5561d4['type']!==_0x1c32('0x51')){var _0x184f61={};_0x184f61[_0x5561d4[_0x1c32('0x25')]]={'$like':'%'+_0x1dd735[_0x1c32('0x44')]['filter']+'%'};return _0x184f61;}})});}_0x3d60d4=_[_0x1c32('0x52')]({},_0x3d60d4,_0x1dd735[_0x1c32('0x53')]);var _0x32e956={'where':_0x3d60d4[_0x1c32('0x50')]};return db[_0x1c32('0x54')][_0x1c32('0x1f')](_0x32e956)[_0x1c32('0xf')](function(_0xf41005){_0x432090['count']=_0xf41005;if(_0x1dd735[_0x1c32('0x44')]['includeAll']){_0x3d60d4[_0x1c32('0x55')]=[{'all':!![]}];}return db[_0x1c32('0x54')][_0x1c32('0x56')](_0x3d60d4);})[_0x1c32('0xf')](function(_0x280473){_0x432090['rows']=_0x280473;return _0x432090;})[_0x1c32('0xf')](respondWithFilteredResult(_0x385a3e,_0x3d60d4))[_0x1c32('0x19')](handleError(_0x385a3e,null));};exports[_0x1c32('0x57')]=function(_0x57e828,_0x2f2629){var _0x495dc1={'raw':![],'where':{'id':_0x57e828[_0x1c32('0x58')]['id']},'include':[{'model':db[_0x1c32('0x59')],'as':_0x1c32('0x3a')},{'model':db[_0x1c32('0x3d')],'as':_0x1c32('0x3b')},{'model':db[_0x1c32('0x5a')],'as':_0x1c32('0x3e')}]},_0x3fdeea={};_0x3fdeea[_0x1c32('0x43')]=_[_0x1c32('0x45')](db['MailAccount'][_0x1c32('0x5b')]);_0x3fdeea['query']=_[_0x1c32('0x45')](_0x57e828[_0x1c32('0x44')]);_0x3fdeea[_0x1c32('0x4e')]=_[_0x1c32('0x46')](_0x3fdeea['model'],_0x3fdeea[_0x1c32('0x44')]);_0x495dc1[_0x1c32('0x47')]=_['intersection'](_0x3fdeea['model'],qs[_0x1c32('0x48')](_0x57e828[_0x1c32('0x44')]['fields']));_0x495dc1[_0x1c32('0x47')]=_0x495dc1[_0x1c32('0x47')][_0x1c32('0x49')]?_0x495dc1['attributes']:_0x3fdeea[_0x1c32('0x43')];if(_0x57e828[_0x1c32('0x44')][_0x1c32('0x5c')]){_0x495dc1[_0x1c32('0x55')]=[{'all':!![]}];}_0x495dc1=_['merge']({},_0x495dc1,_0x57e828[_0x1c32('0x53')]);return db['MailAccount']['find'](_0x495dc1)['then'](handleEntityNotFound(_0x2f2629,null))[_0x1c32('0xf')](respondWithResult(_0x2f2629,null))['catch'](handleError(_0x2f2629,null));};exports[_0x1c32('0x5d')]=function(_0x2a04eb,_0x1506a1){if(_0x2a04eb[_0x1c32('0x5e')]['id']){delete _0x2a04eb[_0x1c32('0x5e')]['id'];}var _0x263e26=_0x2a04eb[_0x1c32('0x5e')]['provider']===_0x1c32('0x5f')?null:_0x2a04eb['body'][_0x1c32('0x60')];var _0x256d32=_0x2a04eb[_0x1c32('0x5e')]['Imap']||{};var _0xc9971e=_0x2a04eb['body']['Smtp']||{};if(_0x263e26){_0x256d32[_0x1c32('0x36')]=getImapHost(_0x263e26);_0x256d32[_0x1c32('0x37')]=0x3e1;_0xc9971e['host']=getSmtpHost(_0x263e26);_0xc9971e[_0x1c32('0x37')]=0x24b;_0xc9971e[_0x1c32('0x38')]=![];}if(_0xc9971e[_0x1c32('0x33')]){_0xc9971e['secure']=![];}else{_0xc9971e[_0x1c32('0x34')]=null;}if(!_0x256d32['modernAuthentication'])_0x256d32[_0x1c32('0x34')]=null;_0x2a04eb[_0x1c32('0x5e')]['Imap']=_0x256d32;_0x2a04eb[_0x1c32('0x5e')]['Smtp']=_0xc9971e;return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0x2a04eb[_0x1c32('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x1c32('0x3b')},{'model':db['Pause'],'as':_0x1c32('0x3e')}]})[_0x1c32('0xf')](handleEntityNotFound(_0x1506a1,null))[_0x1c32('0xf')](function(_0x387f19){if(!_0x387f19)throw new Error(_0x1c32('0x62'));if(_0x387f19[_0x1c32('0x63')])delete _0x2a04eb[_0x1c32('0x5e')][_0x1c32('0x3a')];return _0x387f19;})[_0x1c32('0xf')](saveUpdates(_0x2a04eb[_0x1c32('0x5e')],null))[_0x1c32('0xf')](function(_0x5e13dd){if(!_0x2a04eb[_0x1c32('0x5e')][_0x1c32('0x3a')])return _0x5e13dd;return db[_0x1c32('0x59')][_0x1c32('0x5d')](_0x2a04eb[_0x1c32('0x5e')][_0x1c32('0x3a')],{'where':{'MailAccountId':_0x5e13dd['id']}})['then'](function(){return _0x5e13dd;});})[_0x1c32('0xf')](function(_0x4409ac){if(!_0x2a04eb[_0x1c32('0x5e')][_0x1c32('0x3b')])return _0x4409ac;return db['MailServerOut'][_0x1c32('0x5d')](_0x2a04eb[_0x1c32('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x4409ac['id']}})[_0x1c32('0xf')](function(){return _0x4409ac;});})[_0x1c32('0xf')](respondWithResult(_0x1506a1,null))['catch'](handleError(_0x1506a1,null));};exports['describe']=function(_0x1ad5d3,_0x5e4f69){return db[_0x1c32('0x54')][_0x1c32('0x64')]()[_0x1c32('0xf')](respondWithResult(_0x5e4f69,null))[_0x1c32('0x19')](handleError(_0x5e4f69,null));};exports[_0x1c32('0x65')]=function(_0x744277,_0x4cb514){if(_0x744277[_0x1c32('0x5e')]['id']){delete _0x744277[_0x1c32('0x5e')]['id'];}return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0x744277[_0x1c32('0x58')]['id']}})['then'](handleEntityNotFound(_0x4cb514,null))['then'](function(_0x4ffd2c){if(_0x4ffd2c){_0x744277[_0x1c32('0x5e')][_0x1c32('0x66')]=_0x4ffd2c['id'];return db[_0x1c32('0x67')]['create'](_0x744277[_0x1c32('0x5e')]);}})[_0x1c32('0xf')](respondWithResult(_0x4cb514,null))[_0x1c32('0x19')](handleError(_0x4cb514,null));};exports[_0x1c32('0x68')]=function(_0x405edf,_0x4a0fc2){var _0x1c5812={'raw':![],'where':{}};var _0x27b8f7={};var _0x1c18d9={'count':0x0,'rows':[]};return db[_0x1c32('0x54')]['findOne']({'where':{'id':_0x405edf[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x4a0fc2,null))[_0x1c32('0xf')](function(_0x91ab1a){if(_0x91ab1a){_0x27b8f7[_0x1c32('0x43')]=_['keys'](db[_0x1c32('0x67')][_0x1c32('0x5b')]);_0x27b8f7['query']=_[_0x1c32('0x45')](_0x405edf[_0x1c32('0x44')]);_0x27b8f7[_0x1c32('0x4e')]=_[_0x1c32('0x46')](_0x27b8f7[_0x1c32('0x43')],_0x27b8f7[_0x1c32('0x44')]);_0x1c5812[_0x1c32('0x47')]=_[_0x1c32('0x46')](_0x27b8f7['model'],qs['fields'](_0x405edf[_0x1c32('0x44')][_0x1c32('0x48')]));_0x1c5812['attributes']=_0x1c5812['attributes'][_0x1c32('0x49')]?_0x1c5812[_0x1c32('0x47')]:_0x27b8f7['model'];if(!_0x405edf['query'][_0x1c32('0x4a')](_0x1c32('0x4b'))){_0x1c5812[_0x1c32('0x1e')]=qs[_0x1c32('0x1e')](_0x405edf[_0x1c32('0x44')][_0x1c32('0x1e')]);_0x1c5812[_0x1c32('0x1c')]=qs[_0x1c32('0x1c')](_0x405edf[_0x1c32('0x44')]['offset']);}_0x1c5812[_0x1c32('0x4c')]=qs[_0x1c32('0x4d')](_0x405edf[_0x1c32('0x44')][_0x1c32('0x4d')]);_0x1c5812[_0x1c32('0x50')]=qs[_0x1c32('0x4e')](_['pick'](_0x405edf[_0x1c32('0x44')],_0x27b8f7[_0x1c32('0x4e')]));_0x1c5812[_0x1c32('0x50')][_0x1c32('0x66')]=_0x91ab1a['id'];if(_0x405edf[_0x1c32('0x44')][_0x1c32('0x69')]){_0x1c5812[_0x1c32('0x50')]=_['merge'](_0x1c5812[_0x1c32('0x50')],{'$or':_[_0x1c32('0x3f')](_0x1c5812[_0x1c32('0x47')],function(_0x183f3b){var _0x5e9a32={};_0x5e9a32[_0x183f3b]={'$like':'%'+_0x405edf[_0x1c32('0x44')][_0x1c32('0x69')]+'%'};return _0x5e9a32;})});}_0x1c5812=_[_0x1c32('0x52')]({},_0x1c5812,_0x405edf[_0x1c32('0x53')]);return db[_0x1c32('0x67')][_0x1c32('0x1f')]({'where':_0x1c5812[_0x1c32('0x50')]})['then'](function(_0x390196){_0x1c18d9[_0x1c32('0x1f')]=_0x390196;if(_0x405edf[_0x1c32('0x44')][_0x1c32('0x5c')]){_0x1c5812[_0x1c32('0x55')]=[{'all':!![]}];}return db[_0x1c32('0x67')][_0x1c32('0x56')](_0x1c5812);})['then'](function(_0x249ed6){_0x1c18d9[_0x1c32('0x6a')]=_0x249ed6;return _0x1c18d9;});}})['then'](respondWithFilteredResult(_0x4a0fc2,_0x1c5812))[_0x1c32('0x19')](handleError(_0x4a0fc2,null));};exports[_0x1c32('0x6b')]=function(_0x1a3c1f,_0x134866){return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0x1a3c1f[_0x1c32('0x58')]['id']}})['then'](handleEntityNotFound(_0x134866,null))[_0x1c32('0xf')](function(_0x3110d1){if(_0x3110d1){return _0x3110d1[_0x1c32('0x6b')](_0x1a3c1f[_0x1c32('0x44')][_0x1c32('0x6c')]);}})[_0x1c32('0xf')](respondWithStatusCode(_0x134866,null))[_0x1c32('0x19')](handleError(_0x134866,null));};exports[_0x1c32('0x6d')]=function(_0xe9dce6,_0x4bbb78){if(_0xe9dce6[_0x1c32('0x5e')]['id']){delete _0xe9dce6[_0x1c32('0x5e')]['id'];}return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0xe9dce6[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x4bbb78,null))[_0x1c32('0xf')](function(_0x6d315a){if(_0x6d315a){_0xe9dce6[_0x1c32('0x5e')][_0x1c32('0x66')]=_0x6d315a['id'];return db[_0x1c32('0x6e')][_0x1c32('0x6f')](_0xe9dce6[_0x1c32('0x5e')]);}})['then'](respondWithResult(_0x4bbb78,null))[_0x1c32('0x19')](handleError(_0x4bbb78,null));};exports['getAnswers']=function(_0x5884b0,_0x46a5dd){var _0x3d70c8={'raw':![],'where':{}};var _0x434e64={};var _0x97bde8={'count':0x0,'rows':[]};return db[_0x1c32('0x54')]['findOne']({'where':{'id':_0x5884b0[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x46a5dd,null))[_0x1c32('0xf')](function(_0x25dfb3){if(_0x25dfb3){_0x434e64[_0x1c32('0x43')]=_[_0x1c32('0x45')](db['CannedAnswer']['rawAttributes']);_0x434e64['query']=_[_0x1c32('0x45')](_0x5884b0[_0x1c32('0x44')]);_0x434e64[_0x1c32('0x4e')]=_[_0x1c32('0x46')](_0x434e64[_0x1c32('0x43')],_0x434e64[_0x1c32('0x44')]);_0x3d70c8['attributes']=_[_0x1c32('0x46')](_0x434e64[_0x1c32('0x43')],qs['fields'](_0x5884b0[_0x1c32('0x44')][_0x1c32('0x48')]));_0x3d70c8['attributes']=_0x3d70c8[_0x1c32('0x47')][_0x1c32('0x49')]?_0x3d70c8[_0x1c32('0x47')]:_0x434e64['model'];if(!_0x5884b0['query']['hasOwnProperty'](_0x1c32('0x4b'))){_0x3d70c8[_0x1c32('0x1e')]=qs['limit'](_0x5884b0[_0x1c32('0x44')]['limit']);_0x3d70c8[_0x1c32('0x1c')]=qs[_0x1c32('0x1c')](_0x5884b0[_0x1c32('0x44')][_0x1c32('0x1c')]);}_0x3d70c8[_0x1c32('0x4c')]=qs[_0x1c32('0x4d')](_0x5884b0[_0x1c32('0x44')][_0x1c32('0x4d')]);_0x3d70c8[_0x1c32('0x50')]=qs[_0x1c32('0x4e')](_[_0x1c32('0x4f')](_0x5884b0[_0x1c32('0x44')],_0x434e64[_0x1c32('0x4e')]));_0x3d70c8[_0x1c32('0x50')][_0x1c32('0x66')]=_0x25dfb3['id'];if(_0x5884b0[_0x1c32('0x44')][_0x1c32('0x69')]){_0x3d70c8[_0x1c32('0x50')]=_[_0x1c32('0x52')](_0x3d70c8[_0x1c32('0x50')],{'$or':_[_0x1c32('0x3f')](_0x3d70c8[_0x1c32('0x47')],function(_0x25ff86){var _0x1a7705={};_0x1a7705[_0x25ff86]={'$like':'%'+_0x5884b0[_0x1c32('0x44')]['filter']+'%'};return _0x1a7705;})});}_0x3d70c8=_[_0x1c32('0x52')]({},_0x3d70c8,_0x5884b0['options']);return db[_0x1c32('0x6e')][_0x1c32('0x1f')]({'where':_0x3d70c8[_0x1c32('0x50')]})[_0x1c32('0xf')](function(_0x39f312){_0x97bde8[_0x1c32('0x1f')]=_0x39f312;if(_0x5884b0[_0x1c32('0x44')][_0x1c32('0x5c')]){_0x3d70c8[_0x1c32('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1c32('0x56')](_0x3d70c8);})[_0x1c32('0xf')](function(_0xd22d5f){_0x97bde8[_0x1c32('0x6a')]=_0xd22d5f;return _0x97bde8;});}})[_0x1c32('0xf')](respondWithFilteredResult(_0x46a5dd,_0x3d70c8))[_0x1c32('0x19')](handleError(_0x46a5dd,null));};exports[_0x1c32('0x70')]=function(_0x3a6c8a,_0x4421b4){return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0x3a6c8a['params']['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x4421b4,null))[_0x1c32('0xf')](function(_0x127ae9){if(_0x127ae9){return _0x127ae9[_0x1c32('0x70')](_0x3a6c8a[_0x1c32('0x44')][_0x1c32('0x6c')]);}})[_0x1c32('0xf')](respondWithStatusCode(_0x4421b4,null))['catch'](handleError(_0x4421b4,null));};exports[_0x1c32('0x6f')]=function(_0x1618b9,_0x169324){var _0x1c9a93={'name':_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x25')],'key':_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x42')],'provider':_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x60')]===_0x1c32('0x5f')?null:_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x60')],'email':_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x71')],'ListId':_0x1618b9['body'][_0x1c32('0x72')],'active':!_[_0x1c32('0x73')](_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x74')])?_0x1618b9[_0x1c32('0x5e')][_0x1c32('0x74')]:!![],'description':_0x1618b9[_0x1c32('0x5e')]['description']||null};var _0x4886be=getAuthenticationOptions(_0x1c9a93[_0x1c32('0x60')],_0x1618b9[_0x1c32('0x5e')]);_0x1c9a93[_0x1c32('0x3a')]=_0x4886be['Imap'];_0x1c9a93[_0x1c32('0x3b')]=_0x4886be['Smtp'];return db[_0x1c32('0x54')][_0x1c32('0x6f')](_0x1c9a93,{'include':[{'model':db[_0x1c32('0x3d')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x1c32('0x3a')}]})['then'](function(_0x58156a){var _0xc81803=_0x1618b9[_0x1c32('0x30')][_0x1c32('0x23')]({'plain':!![]});if(!_0xc81803)throw new Error(_0x1c32('0x75'));if(_0xc81803[_0x1c32('0x76')]===_0x1c32('0x30')){var _0x214cc9=_0x58156a['get']({'plain':!![]});return db[_0x1c32('0x77')][_0x1c32('0x61')]({'where':{'name':_0x1c32('0x78'),'userProfileId':_0xc81803[_0x1c32('0x79')]},'raw':!![]})[_0x1c32('0xf')](function(_0x521259){if(_0x521259&&_0x521259[_0x1c32('0x7a')]===0x0){return db['UserProfileResource'][_0x1c32('0x6f')]({'name':_0x214cc9[_0x1c32('0x25')],'resourceId':_0x214cc9['id'],'type':_0x521259[_0x1c32('0x25')],'sectionId':_0x521259['id']},{})['then'](function(){return _0x58156a;});}else{return _0x58156a;}})[_0x1c32('0x19')](function(_0x226d57){logger[_0x1c32('0x14')](_0x1c32('0x7b'),_0x226d57);throw _0x226d57;});}return _0x58156a;})[_0x1c32('0xf')](respondWithResult(_0x169324,0xc9))[_0x1c32('0x19')](handleError(_0x169324,null));};exports[_0x1c32('0x7c')]=function(_0x41b5da,_0x396679){return db[_0x1c32('0x54')][_0x1c32('0x7d')]({'where':{'id':_0x41b5da['params']['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x396679,null))['then'](function(_0x449ca9){if(_0x449ca9){return _0x449ca9[_0x1c32('0x7c')]();}return null;})[_0x1c32('0xf')](respondWithResult(_0x396679,null))[_0x1c32('0x19')](handleError(_0x396679,null));};exports[_0x1c32('0x7e')]=function(_0x444075,_0x30e95f){if(_0x444075['body']['id']){delete _0x444075[_0x1c32('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x444075[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x30e95f,null))[_0x1c32('0xf')](function(_0x59f46b){if(_0x59f46b){_0x444075[_0x1c32('0x5e')][_0x1c32('0x66')]=_0x59f46b['id'];return db[_0x1c32('0x59')][_0x1c32('0x6f')](_0x444075[_0x1c32('0x5e')]);}})[_0x1c32('0xf')](respondWithResult(_0x30e95f,null))[_0x1c32('0x19')](handleError(_0x30e95f,null));};exports['removeImap']=function(_0x2fcfa6,_0x3c43fe){return db[_0x1c32('0x54')]['findOne']({'where':{'id':_0x2fcfa6[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x3c43fe,null))['then'](function(_0x6caccc){if(_0x6caccc){return _0x6caccc[_0x1c32('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x3c43fe,null))[_0x1c32('0x19')](handleError(_0x3c43fe,null));};exports[_0x1c32('0x80')]=function(_0x31abcd,_0x1c9e1b){return db[_0x1c32('0x54')]['findOne']({'where':{'id':_0x31abcd['params']['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x1c9e1b,null))[_0x1c32('0xf')](function(_0x3733fb){if(_0x3733fb){return _0x3733fb['getSmtp']();}return null;})['then'](respondWithResult(_0x1c9e1b,null))[_0x1c32('0x19')](handleError(_0x1c9e1b,null));};exports[_0x1c32('0x81')]=function(_0x3126bf,_0x5f2ba9){if(_0x3126bf[_0x1c32('0x5e')]['id']){delete _0x3126bf['body']['id'];}return db[_0x1c32('0x54')]['find']({'where':{'id':_0x3126bf['params']['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x5f2ba9,null))['then'](function(_0xefa363){if(_0xefa363){_0x3126bf[_0x1c32('0x5e')][_0x1c32('0x66')]=_0xefa363['id'];return db['MailServerOut']['create'](_0x3126bf[_0x1c32('0x5e')]);}})[_0x1c32('0xf')](respondWithResult(_0x5f2ba9,null))[_0x1c32('0x19')](handleError(_0x5f2ba9,null));};exports[_0x1c32('0x82')]=function(_0xc37dda,_0x360a87){return db['MailAccount']['findOne']({'where':{'id':_0xc37dda[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x360a87,null))['then'](function(_0x5daad4){if(_0x5daad4){return _0x5daad4[_0x1c32('0x83')](null);}return null;})[_0x1c32('0xf')](respondWithStatusCode(_0x360a87,null))[_0x1c32('0x19')](handleError(_0x360a87,null));};exports[_0x1c32('0x84')]=function(_0x2e6c4f,_0x4126b5){return db[_0x1c32('0x85')][_0x1c32('0x61')]({'where':{'id':_0x2e6c4f[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x4126b5,null))[_0x1c32('0xf')](function(_0x37a643){if(_0x37a643){return _0x37a643['addInteraction'](_0x2e6c4f[_0x1c32('0x5e')][_0x1c32('0x6c')],_[_0x1c32('0x86')](_0x2e6c4f[_0x1c32('0x5e')],['ids','id'])||{});}})[_0x1c32('0xf')](respondWithResult(_0x4126b5,null))['catch'](handleError(_0x4126b5,null));};exports[_0x1c32('0x87')]=function(_0xa8c95e,_0x4349b8){var _0x1a8048={'raw':![],'where':{}};var _0x27468c={};var _0xbf3534={'count':0x0,'rows':[]};return db[_0x1c32('0x54')][_0x1c32('0x7d')]({'where':{'id':_0xa8c95e['params']['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x4349b8,null))[_0x1c32('0xf')](function(_0xf6688e){if(_0xf6688e){_0x27468c[_0x1c32('0x43')]=_[_0x1c32('0x45')](db[_0x1c32('0x85')]['rawAttributes']);_0x27468c[_0x1c32('0x44')]=_[_0x1c32('0x45')](_0xa8c95e['query']);_0x27468c['filters']=_[_0x1c32('0x46')](_0x27468c[_0x1c32('0x43')],_0x27468c[_0x1c32('0x44')]);_0x1a8048['attributes']=_[_0x1c32('0x46')](_0x27468c['model'],qs[_0x1c32('0x48')](_0xa8c95e['query']['fields']));_0x1a8048[_0x1c32('0x47')]=_0x1a8048['attributes']['length']?_0x1a8048['attributes']:_0x27468c[_0x1c32('0x43')];if(!_0xa8c95e['query'][_0x1c32('0x4a')](_0x1c32('0x4b'))){_0x1a8048['limit']=qs[_0x1c32('0x1e')](_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x1e')]);_0x1a8048[_0x1c32('0x1c')]=qs[_0x1c32('0x1c')](_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x1c')]);}_0x1a8048['order']=qs[_0x1c32('0x4d')](_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x4d')]);_0x1a8048['where']=qs[_0x1c32('0x4e')](_['pick'](_0xa8c95e[_0x1c32('0x44')],_0x27468c[_0x1c32('0x4e')]));_0x1a8048[_0x1c32('0x50')][_0x1c32('0x66')]=_0xf6688e['id'];if(_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x69')]){_0x1a8048['where']=_['merge'](_0x1a8048['where'],{'$or':_[_0x1c32('0x3f')](_0x1a8048[_0x1c32('0x47')],function(_0x288520){var _0x449a9d={};_0x449a9d[_0x288520]={'$like':'%'+_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x69')]+'%'};return _0x449a9d;})});}_0x1a8048=_[_0x1c32('0x52')]({},_0x1a8048,_0xa8c95e[_0x1c32('0x53')]);return db[_0x1c32('0x85')][_0x1c32('0x1f')]({'where':_0x1a8048[_0x1c32('0x50')]})[_0x1c32('0xf')](function(_0x3b4ae7){_0xbf3534['count']=_0x3b4ae7;if(_0xa8c95e[_0x1c32('0x44')]['includeAll']){_0x1a8048[_0x1c32('0x55')]=[{'model':db[_0x1c32('0x88')],'as':_0x1c32('0x89'),'required':![]},{'model':db['User'],'as':_0x1c32('0x8a'),'attributes':[_0x1c32('0x25'),_0x1c32('0x8b'),_0x1c32('0x8c')],'required':![]},{'model':db[_0x1c32('0x8d')],'as':_0x1c32('0x8e'),'attributes':['id','name',_0x1c32('0x8f')],'where':_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x90')]?{'id':_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x90')]}:undefined,'required':_0xa8c95e[_0x1c32('0x44')][_0x1c32('0x90')]?!![]:![]}];}return db[_0x1c32('0x85')][_0x1c32('0x56')](_0x1a8048);})[_0x1c32('0xf')](function(_0x207d6b){_0xbf3534[_0x1c32('0x6a')]=_0x207d6b;return _0xbf3534;});}})[_0x1c32('0xf')](respondWithFilteredResult(_0x4349b8,_0x1a8048))[_0x1c32('0x19')](handleError(_0x4349b8,null));};exports[_0x1c32('0x91')]=function addApplications(_0x3b7e69,_0x427dd5){var _0x11fd95=_0x3b7e69['params']['id'];var _0x2c9194=_0x3b7e69['body'];var _0x5a8a94=0xc8;var _0x220ea0=null;return db[_0x1c32('0x92')]['transaction']({'isolationLevel':db[_0x1c32('0x92')]['Transaction'][_0x1c32('0x93')][_0x1c32('0x94')]},function(_0x25edb2){return db[_0x1c32('0x54')][_0x1c32('0x7d')]({'where':{'id':_0x11fd95},'transaction':_0x25edb2})[_0x1c32('0xf')](function(_0x4aa9c0){if(_0x4aa9c0){return db[_0x1c32('0x95')][_0x1c32('0x22')]({'where':{'MailAccountId':_0x11fd95},'transaction':_0x25edb2})[_0x1c32('0xf')](function(){var _0x33a5ab=_[_0x1c32('0x3f')](_0x2c9194,function(_0x8a62a6){_0x8a62a6['MailAccountId']=_0x11fd95;return _0x8a62a6;});return db['MailApplication'][_0x1c32('0x96')](_0x33a5ab,{'transaction':_0x25edb2});});}else{_0x5a8a94=0x194;_0x220ea0=[];}});})[_0x1c32('0xf')](function(){if(_0x5a8a94!==0x194){return db[_0x1c32('0x95')][_0x1c32('0x97')]({'where':{'MailAccountId':_0x11fd95},'order':_0x1c32('0x98')})['then'](function(_0x1c9ee6){_0x220ea0=_0x1c9ee6;});}})[_0x1c32('0x19')](function(_0x9794a7){_0x5a8a94=0x1f4;logger[_0x1c32('0x14')](_0x9794a7[_0x1c32('0x99')]);if(_0x9794a7['name']){delete _0x9794a7[_0x1c32('0x25')];}_0x220ea0=_0x9794a7;})['finally'](function(){if(_0x220ea0===null){_0x427dd5[_0x1c32('0x24')](_0x5a8a94);}else{if(_0x5a8a94===0x1f4){_0x427dd5[_0x1c32('0x1b')](_0x5a8a94)[_0x1c32('0x26')](_0x220ea0);}else{_0x427dd5[_0x1c32('0x1b')](_0x5a8a94)[_0x1c32('0x21')](_0x220ea0);}}});};exports[_0x1c32('0x9a')]=function(_0xcd9470,_0x10942b){var _0x5af372={};var _0x527eed={};var _0x244272;var _0x49c397;return db[_0x1c32('0x54')][_0x1c32('0x7d')]({'where':{'id':_0xcd9470[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x10942b,null))[_0x1c32('0xf')](function(_0x9b4214){if(_0x9b4214){_0x244272=_0x9b4214;_0x527eed[_0x1c32('0x43')]=_[_0x1c32('0x45')](db[_0x1c32('0x95')][_0x1c32('0x5b')]);_0x527eed[_0x1c32('0x44')]=_['keys'](_0xcd9470[_0x1c32('0x44')]);_0x527eed[_0x1c32('0x4e')]=_[_0x1c32('0x46')](_0x527eed['model'],_0x527eed[_0x1c32('0x44')]);_0x5af372[_0x1c32('0x47')]=_[_0x1c32('0x46')](_0x527eed[_0x1c32('0x43')],qs[_0x1c32('0x48')](_0xcd9470[_0x1c32('0x44')]['fields']));_0x5af372[_0x1c32('0x47')]=_0x5af372[_0x1c32('0x47')][_0x1c32('0x49')]?_0x5af372[_0x1c32('0x47')]:_0x527eed[_0x1c32('0x43')];_0x5af372[_0x1c32('0x4c')]=qs[_0x1c32('0x4d')](_0xcd9470[_0x1c32('0x44')][_0x1c32('0x4d')]);_0x5af372[_0x1c32('0x50')]=qs[_0x1c32('0x4e')](_[_0x1c32('0x4f')](_0xcd9470[_0x1c32('0x44')],_0x527eed[_0x1c32('0x4e')]));if(_0xcd9470[_0x1c32('0x44')][_0x1c32('0x69')]){_0x5af372[_0x1c32('0x50')]=_[_0x1c32('0x52')](_0x5af372[_0x1c32('0x50')],{'$or':_[_0x1c32('0x3f')](_0x5af372[_0x1c32('0x47')],function(_0x23ef91){var _0x3a8890={};_0x3a8890[_0x23ef91]={'$like':'%'+_0xcd9470['query'][_0x1c32('0x69')]+'%'};return _0x3a8890;})});}_0x5af372=_[_0x1c32('0x52')]({},_0x5af372,_0xcd9470[_0x1c32('0x53')]);return _0x244272[_0x1c32('0x9a')](_0x5af372);}})[_0x1c32('0xf')](function(_0x112f3b){if(_0x112f3b){_0x49c397=_0x112f3b[_0x1c32('0x49')];if(!_0xcd9470['query']['hasOwnProperty'](_0x1c32('0x4b'))){_0x5af372['limit']=qs[_0x1c32('0x1e')](_0xcd9470[_0x1c32('0x44')][_0x1c32('0x1e')]);_0x5af372[_0x1c32('0x1c')]=qs[_0x1c32('0x1c')](_0xcd9470[_0x1c32('0x44')][_0x1c32('0x1c')]);}return _0x244272[_0x1c32('0x9a')](_0x5af372);}})['then'](function(_0xda9617){if(_0xda9617){return _0xda9617?{'count':_0x49c397,'rows':_0xda9617}:null;}})['then'](respondWithResult(_0x10942b,null))[_0x1c32('0x19')](handleError(_0x10942b,null));};exports[_0x1c32('0x9b')]=function(_0x325d88,_0x5d101b){var _0x200a51={'raw':!![],'where':{}};var _0xb84f3d={};var _0xd90032={'count':0x0,'rows':[]};return db[_0x1c32('0x54')][_0x1c32('0x7d')]({'where':{'id':_0x325d88[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x5d101b,null))[_0x1c32('0xf')](function(_0x199bcc){if(_0x199bcc){_0xb84f3d['model']=_[_0x1c32('0x45')](db[_0x1c32('0x9c')][_0x1c32('0x5b')]);_0xb84f3d[_0x1c32('0x44')]=_[_0x1c32('0x45')](_0x325d88['query']);_0xb84f3d[_0x1c32('0x4e')]=_[_0x1c32('0x46')](_0xb84f3d[_0x1c32('0x43')],_0xb84f3d['query']);_0x200a51[_0x1c32('0x47')]=_[_0x1c32('0x46')](_0xb84f3d[_0x1c32('0x43')],qs[_0x1c32('0x48')](_0x325d88[_0x1c32('0x44')][_0x1c32('0x48')]));_0x200a51[_0x1c32('0x47')]=_0x200a51[_0x1c32('0x47')][_0x1c32('0x49')]?_0x200a51[_0x1c32('0x47')]:_0xb84f3d[_0x1c32('0x43')];if(!_0x325d88[_0x1c32('0x44')][_0x1c32('0x4a')]('nolimit')){_0x200a51[_0x1c32('0x1e')]=qs[_0x1c32('0x1e')](_0x325d88[_0x1c32('0x44')][_0x1c32('0x1e')]);_0x200a51[_0x1c32('0x1c')]=qs[_0x1c32('0x1c')](_0x325d88[_0x1c32('0x44')][_0x1c32('0x1c')]);}_0x200a51[_0x1c32('0x4c')]=qs[_0x1c32('0x4d')](_0x325d88[_0x1c32('0x44')][_0x1c32('0x4d')]);_0x200a51[_0x1c32('0x50')]=qs['filters'](_[_0x1c32('0x4f')](_0x325d88[_0x1c32('0x44')],_0xb84f3d[_0x1c32('0x4e')]));_0x200a51[_0x1c32('0x50')]['MailAccountId']=_0x199bcc['id'];if(_0x325d88[_0x1c32('0x44')][_0x1c32('0x69')]){_0x200a51[_0x1c32('0x50')]=_[_0x1c32('0x52')](_0x200a51[_0x1c32('0x50')],{'$or':_[_0x1c32('0x3f')](_0x200a51[_0x1c32('0x47')],function(_0x1f3d5d){var _0x189c88={};_0x189c88[_0x1f3d5d]={'$like':'%'+_0x325d88[_0x1c32('0x44')][_0x1c32('0x69')]+'%'};return _0x189c88;})});}if(_0x325d88[_0x1c32('0x44')]['$gte']){var _0x1e7776=_0x325d88[_0x1c32('0x44')][_0x1c32('0x9d')][_0x1c32('0x9e')](',');var _0x139e93={};_0x139e93[_0x1e7776[0x0]]={'$gte':moment(_0x1e7776[0x1])['format'](_0x1c32('0x9f'))};_0x200a51['where']=_['merge'](_0x200a51[_0x1c32('0x50')],_0x139e93);}_0x200a51=_[_0x1c32('0x52')]({},_0x200a51,_0x325d88[_0x1c32('0x53')]);return db[_0x1c32('0x9c')][_0x1c32('0x1f')]({'where':_0x200a51[_0x1c32('0x50')]})['then'](function(_0x2c8485){_0xd90032['count']=_0x2c8485;if(_0x325d88[_0x1c32('0x44')][_0x1c32('0x5c')]){_0x200a51['include']=[{'all':!![]}];}return db['MailMessage'][_0x1c32('0x56')](_0x200a51);})[_0x1c32('0xf')](function(_0x1d4cc6){if(_0x325d88[_0x1c32('0x44')][_0x1c32('0xa0')]==='true'){for(var _0x237375=0x0;_0x237375<_0x1d4cc6['length'];_0x237375++){_0x1d4cc6[_0x237375][_0x1c32('0x5e')]=juice(_0x1d4cc6[_0x237375][_0x1c32('0x5e')]);}}_0xd90032[_0x1c32('0x6a')]=_0x1d4cc6;return _0xd90032;});}})[_0x1c32('0xf')](respondWithFilteredResult(_0x5d101b,_0x200a51))[_0x1c32('0x19')](handleError(_0x5d101b,null));};exports[_0x1c32('0x26')]=function(_0x55dfbb,_0x4d1c72){var _0x3b2345,_0x18c075={},_0x3102c5;if(_0x55dfbb['body']['to']){_0x3102c5=_0x55dfbb[_0x1c32('0x5e')]['to'][_0x1c32('0x9e')](',')[0x0];}return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0x55dfbb[_0x1c32('0x58')]['id']},'include':[{'model':db[_0x1c32('0xa1')],'as':_0x1c32('0xa2'),'include':[{'model':db[_0x1c32('0x88')],'as':_0x1c32('0xa3'),'where':{'email':_0x3102c5},'limit':0x1,'order':[[_0x1c32('0xa4'),_0x1c32('0xa5')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1c32('0xa6')],'as':_0x1c32('0xa6'),'raw':!![]}]}]})[_0x1c32('0xf')](handleEntityNotFound(_0x4d1c72,null))['then'](function(_0x416026){if(!_0x416026)return;_0x3b2345=_0x416026;if(!_0x416026['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x1c32('0x73')](_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa7')])){_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa7')]=util['format'](_0x1c32('0xa8'),_0x416026[_0x1c32('0x25')],_0x416026['email']||_0x416026['Smtp']['user']);}if(_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa9')]&&_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa9')][_0x1c32('0x49')]){for(var _0x18eca6=0x0;_0x18eca6<_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa9')][_0x1c32('0x49')];_0x18eca6+=0x1){_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa9')][_0x18eca6]={'filename':_0x55dfbb['body'][_0x1c32('0xa9')][_0x18eca6][_0x1c32('0x25')],'path':path[_0x1c32('0xaa')](config['root'],_0x1c32('0xab'),_0x55dfbb[_0x1c32('0x5e')]['attachments'][_0x18eca6][_0x1c32('0xac')])};}}var _0x3ebaaa=_0x416026[_0x1c32('0xad')]();return respondWithRpcPromise(_0x1c32('0xae'),_0x1c32('0xaf'),{'account':_0x3ebaaa,'message':_0x55dfbb[_0x1c32('0x5e')]});})[_0x1c32('0xf')](function(_0x3b0657){if(!_0x3b0657)return;_0x18c075=_0x3b0657;if(!_0x3b2345[_0x1c32('0xa2')])throw new Error(_0x1c32('0xb0'));if(_0x3b2345[_0x1c32('0xa2')][_0x1c32('0xa3')]['length'])return _0x3b2345[_0x1c32('0xa2')]['Contacts'][0x0];return db[_0x1c32('0x88')][_0x1c32('0x6f')](_[_0x1c32('0xb1')](_0x55dfbb['body'],{'firstName':_0x55dfbb[_0x1c32('0x5e')]['to'],'email':_0x55dfbb[_0x1c32('0x5e')]['to'],'phone':_0x55dfbb[_0x1c32('0x5e')]['to'],'ListId':_0x3b2345[_0x1c32('0x72')]}));})[_0x1c32('0xf')](function(_0x4078b2){if(!_0x4078b2)return;var _0xc82a7a={'UserId':_0x55dfbb[_0x1c32('0x30')]['id'],'ContactId':_0x4078b2['id'],'MailAccountId':_0x3b2345['id'],'inReplyTo':_0x18c075['messageId'],'to':_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xa7')],'cc':_0x55dfbb['body']['cc'],'subject':_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xb2')],'attach':_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xb3')],'firstMsgDirection':_0x1c32('0xb4'),'lastMsgAt':moment()[_0x1c32('0xb5')](_0x1c32('0x9f')),'lastMsgDirection':_0x1c32('0xb4'),'Messages':[_['merge'](_0x55dfbb['body'],{'messageId':_0x18c075[_0x1c32('0xb6')],'sentAt':moment()['format'](_0x1c32('0x9f')),'read':!![],'MailAccountId':_0x3b2345['id'],'UserId':_0x55dfbb[_0x1c32('0x30')]['id'],'ContactId':_0x4078b2['id']})]};if(_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xb7')]){_0xc82a7a=_[_0x1c32('0x52')](_0xc82a7a,_0x55dfbb[_0x1c32('0x5e')][_0x1c32('0xb7')]);}return db[_0x1c32('0x85')]['create'](_0xc82a7a,{'include':[{'model':db[_0x1c32('0x9c')],'as':_0x1c32('0xb8')}]});})[_0x1c32('0xf')](respondWithResult(_0x4d1c72,null))[_0x1c32('0x19')](handleError(_0x4d1c72,null));};exports[_0x1c32('0xb9')]=function(_0x2d859c,_0x365ca4){return db[_0x1c32('0x54')][_0x1c32('0x61')]({'where':{'id':_0x2d859c[_0x1c32('0x58')]['id']},'include':[{'model':db[_0x1c32('0x3d')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1c32('0xa6')],'as':_0x1c32('0xa6'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x365ca4,null))[_0x1c32('0xf')](function(_0x31f0b0){if(!_0x31f0b0[_0x1c32('0x3b')])return;var _0x154634=_0x31f0b0[_0x1c32('0xad')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x154634});})[_0x1c32('0xf')](respondWithResult(_0x365ca4,null))[_0x1c32('0x19')](handleError(_0x365ca4,null));};exports['destroy']=function(_0x296f34,_0x11c84d){return db['MailAccount'][_0x1c32('0x61')]({'where':{'id':_0x296f34['params']['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x11c84d,null))[_0x1c32('0xf')](function(_0x126b1a){if(_0x126b1a&&_0x126b1a[_0x1c32('0x63')]){throw new db['Sequelize'][(_0x1c32('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x126b1a;})['then'](removeEntity(_0x11c84d,null))['catch'](handleError(_0x11c84d,null));};exports['addAgents']=function(_0x1ab758,_0x4c07d9){return db[_0x1c32('0x54')]['find']({'where':{'id':_0x1ab758[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0x4c07d9,null))[_0x1c32('0xf')](function(_0x320a38){if(_0x320a38){return _0x320a38[_0x1c32('0xbb')](_0x1ab758[_0x1c32('0x5e')]['ids'],_['omit'](_0x1ab758[_0x1c32('0x5e')],[_0x1c32('0x6c'),'id'])||{})[_0x1c32('0xbc')](function(_0x482f6a){for(var _0x5ab420=0x0;_0x5ab420<_0x1ab758[_0x1c32('0x5e')][_0x1c32('0x6c')][_0x1c32('0x49')];_0x5ab420+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x1ab758[_0x1c32('0x5e')][_0x1c32('0x6c')][_0x5ab420]),'MailAccountId':Number(_0x1ab758[_0x1c32('0x58')]['id'])});}return _0x482f6a;});}})[_0x1c32('0xf')](respondWithResult(_0x4c07d9,null))[_0x1c32('0x19')](handleError(_0x4c07d9,null));};exports[_0x1c32('0xbd')]=function(_0x50763e,_0x2a8d1d){return db['MailAccount']['find']({'where':{'id':_0x50763e[_0x1c32('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a8d1d,null))[_0x1c32('0xf')](function(_0x37d684){if(_0x37d684){return _0x37d684[_0x1c32('0xbd')](_0x50763e[_0x1c32('0x44')][_0x1c32('0x6c')])['then'](function(){if(_[_0x1c32('0xbe')](_0x50763e[_0x1c32('0x44')][_0x1c32('0x6c')])){for(var _0x19c510=0x0;_0x19c510<_0x50763e[_0x1c32('0x44')][_0x1c32('0x6c')][_0x1c32('0x49')];_0x19c510+=0x1){socket[_0x1c32('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x50763e[_0x1c32('0x44')]['ids'][_0x19c510]),'MailAccountId':Number(_0x50763e[_0x1c32('0x58')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x50763e['query']['ids']),'MailAccountId':Number(_0x50763e[_0x1c32('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a8d1d,null))[_0x1c32('0x19')](handleError(_0x2a8d1d,null));};exports['getAgents']=function(_0x32e397,_0xe64e6b){var _0x4618e5={};var _0x32932b={};var _0x218547;var _0xbf55f3;return db[_0x1c32('0x54')][_0x1c32('0x7d')]({'where':{'id':_0x32e397[_0x1c32('0x58')]['id']}})[_0x1c32('0xf')](handleEntityNotFound(_0xe64e6b,null))[_0x1c32('0xf')](function(_0x35ffc0){if(_0x35ffc0){_0x218547=_0x35ffc0;_0x32932b['model']=_[_0x1c32('0x45')](db[_0x1c32('0xc0')][_0x1c32('0x5b')]);_0x32932b[_0x1c32('0x44')]=_[_0x1c32('0x45')](_0x32e397[_0x1c32('0x44')]);_0x32932b[_0x1c32('0x4e')]=_[_0x1c32('0x46')](_0x32932b['model'],_0x32932b['query']);_0x4618e5['attributes']=_['intersection'](_0x32932b[_0x1c32('0x43')],qs[_0x1c32('0x48')](_0x32e397[_0x1c32('0x44')][_0x1c32('0x48')]));_0x4618e5[_0x1c32('0x47')]=_0x4618e5['attributes'][_0x1c32('0x49')]?_0x4618e5[_0x1c32('0x47')]:_0x32932b[_0x1c32('0x43')];_0x4618e5[_0x1c32('0x4c')]=qs['sort'](_0x32e397['query'][_0x1c32('0x4d')]);_0x4618e5[_0x1c32('0x50')]=qs[_0x1c32('0x4e')](_[_0x1c32('0x4f')](_0x32e397['query'],_0x32932b[_0x1c32('0x4e')]));if(_0x32e397[_0x1c32('0x44')]['filter']){_0x4618e5[_0x1c32('0x50')]=_[_0x1c32('0x52')](_0x4618e5[_0x1c32('0x50')],{'$or':_[_0x1c32('0x3f')](_0x4618e5[_0x1c32('0x47')],function(_0x3d13f3){var _0x3589df={};_0x3589df[_0x3d13f3]={'$like':'%'+_0x32e397[_0x1c32('0x44')]['filter']+'%'};return _0x3589df;})});}_0x4618e5=_[_0x1c32('0x52')]({},_0x4618e5,_0x32e397[_0x1c32('0x53')]);return _0x218547[_0x1c32('0xc1')](_0x4618e5);}})['then'](function(_0x4a7f7e){if(_0x4a7f7e){_0xbf55f3=_0x4a7f7e[_0x1c32('0x49')];if(!_0x32e397[_0x1c32('0x44')]['hasOwnProperty']('nolimit')){_0x4618e5[_0x1c32('0x1e')]=qs[_0x1c32('0x1e')](_0x32e397['query'][_0x1c32('0x1e')]);_0x4618e5[_0x1c32('0x1c')]=qs[_0x1c32('0x1c')](_0x32e397['query']['offset']);}return _0x218547[_0x1c32('0xc1')](_0x4618e5);}})[_0x1c32('0xf')](function(_0x174699){if(_0x174699){return _0x174699?{'count':_0xbf55f3,'rows':_0x174699}:null;}})[_0x1c32('0xf')](respondWithResult(_0xe64e6b,null))[_0x1c32('0x19')](handleError(_0xe64e6b,null));};
\ No newline at end of file
index 55d52ad..5b5c2e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd117=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x270774,_0x3863f2){var _0x21583c=function(_0x4ec71a){while(--_0x4ec71a){_0x270774['push'](_0x270774['shift']());}};_0x21583c(++_0x3863f2);}(_0xd117,0x182));var _0x7d11=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xd117[_0x47adb8];return _0x4689a8;};'use strict';var EventEmitter=require(_0x7d11('0x0'));var MailAccount=require(_0x7d11('0x1'))['db'][_0x7d11('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7d11('0x3')](0x0);var events={'afterCreate':_0x7d11('0x4'),'afterUpdate':_0x7d11('0x5'),'afterDestroy':_0x7d11('0x6')};function emitEvent(_0x254bb4){return function(_0x3c07be,_0x31fcb0,_0x589c51){MailAccountEvents[_0x7d11('0x7')](_0x254bb4+':'+_0x3c07be['id'],_0x3c07be);MailAccountEvents[_0x7d11('0x7')](_0x254bb4,_0x3c07be);_0x589c51(null);};}for(var e in events){if(events[_0x7d11('0x8')](e)){var event=events[e];MailAccount[_0x7d11('0x9')](e,emitEvent(event));}}module[_0x7d11('0xa')]=MailAccountEvents;
\ No newline at end of file
+var _0xe1d3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x4796eb,_0x2f8389){var _0x1fb1a4=function(_0x1c4717){while(--_0x1c4717){_0x4796eb['push'](_0x4796eb['shift']());}};_0x1fb1a4(++_0x2f8389);}(_0xe1d3,0x159));var _0x3e1d=function(_0x32b473,_0xc85e5c){_0x32b473=_0x32b473-0x0;var _0x135881=_0xe1d3[_0x32b473];return _0x135881;};'use strict';var EventEmitter=require(_0x3e1d('0x0'));var MailAccount=require(_0x3e1d('0x1'))['db'][_0x3e1d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3e1d('0x3')](0x0);var events={'afterCreate':_0x3e1d('0x4'),'afterUpdate':'update','afterDestroy':_0x3e1d('0x5')};function emitEvent(_0x4a0768){return function(_0x23f59b,_0x38df15,_0x4f6337){MailAccountEvents['emit'](_0x4a0768+':'+_0x23f59b['id'],_0x23f59b);MailAccountEvents[_0x3e1d('0x6')](_0x4a0768,_0x23f59b);_0x4f6337(null);};}for(var e in events){if(events[_0x3e1d('0x7')](e)){var event=events[e];MailAccount[_0x3e1d('0x8')](e,emitEvent(event));}}module[_0x3e1d('0x9')]=MailAccountEvents;
\ No newline at end of file
index 90db4ac..dfc252d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc825=['data5','pass','./mailAccount.attributes','exports','MailAccount','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','auth','OAuth2','user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc825,0x178));var _0x5c82=function(_0x478ecf,_0x463faf){_0x478ecf=_0x478ecf-0x0;var _0x39dfd6=_0xc825[_0x478ecf];return _0x39dfd6;};'use strict';var attributes=require(_0x5c82('0x0'));module[_0x5c82('0x1')]=function(_0x18b1bc){return _0x18b1bc['define'](_0x5c82('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x23446a=this;var _0x331181={'id':_0x23446a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x23446a[_0x5c82('0x3')]!==_0x5c82('0x4')){_0x331181[_0x5c82('0x5')]=_0x23446a[_0x5c82('0x3')];}else{_0x331181[_0x5c82('0x6')]=_0x23446a[_0x5c82('0x7')][_0x5c82('0x6')];_0x331181[_0x5c82('0x8')]=_0x23446a[_0x5c82('0x7')][_0x5c82('0x8')];_0x331181[_0x5c82('0x9')]=_0x23446a[_0x5c82('0x7')]['secure'];}if(_0x23446a[_0x5c82('0x7')]['authentication']){if(_0x23446a[_0x5c82('0x7')][_0x5c82('0xa')]){if(!_0x23446a[_0x5c82('0x7')][_0x5c82('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x331181[_0x5c82('0xc')]={'type':_0x5c82('0xd'),'user':_0x23446a[_0x5c82('0x7')][_0x5c82('0xe')],'accessToken':_0x23446a['Smtp'][_0x5c82('0xb')][_0x5c82('0xf')]};}else{_0x331181[_0x5c82('0xc')]={'user':_0x23446a[_0x5c82('0x7')][_0x5c82('0xe')],'pass':_0x23446a[_0x5c82('0x7')][_0x5c82('0x10')]};}}return _0x331181;}}});};
\ No newline at end of file
+var _0x15e5=['define','provider','custom','service','host','Smtp','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','data5','pass'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15e5,0x13b));var _0x515e=function(_0x1f781e,_0x217901){_0x1f781e=_0x1f781e-0x0;var _0x3bcd3a=_0x15e5[_0x1f781e];return _0x3bcd3a;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x51b1e2){return _0x51b1e2[_0x515e('0x0')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x581c0c=this;var _0x195bd6={'id':_0x581c0c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x581c0c[_0x515e('0x1')]!==_0x515e('0x2')){_0x195bd6[_0x515e('0x3')]=_0x581c0c['provider'];}else{_0x195bd6[_0x515e('0x4')]=_0x581c0c[_0x515e('0x5')][_0x515e('0x4')];_0x195bd6['port']=_0x581c0c['Smtp']['port'];_0x195bd6[_0x515e('0x6')]=_0x581c0c[_0x515e('0x5')]['secure'];}if(_0x581c0c[_0x515e('0x5')][_0x515e('0x7')]){if(_0x581c0c['Smtp'][_0x515e('0x8')]){if(!_0x581c0c['Smtp']['CloudProvider'])throw new Error(_0x515e('0x9'));_0x195bd6[_0x515e('0xa')]={'type':'OAuth2','user':_0x581c0c[_0x515e('0x5')][_0x515e('0xb')],'accessToken':_0x581c0c[_0x515e('0x5')][_0x515e('0xc')][_0x515e('0xd')]};}else{_0x195bd6['auth']={'user':_0x581c0c[_0x515e('0x5')][_0x515e('0xb')],'pass':_0x581c0c[_0x515e('0x5')][_0x515e('0xe')]};}}return _0x195bd6;}}});};
\ No newline at end of file
index 87874b5..bb667b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x187d=['account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','list','applications','orderBy','priority','autoclose','length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','model','map','debug','ShowMailAccount','find','where','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x12ceba,_0x59ba15){var _0x36c243=function(_0x4f44c9){while(--_0x4f44c9){_0x12ceba['push'](_0x12ceba['shift']());}};_0x36c243(++_0x59ba15);}(_0x187d,0x93));var _0xd187=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x187d[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var BPromise=require(_0xd187('0x1'));var rs=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var db=require(_0xd187('0x4'))['db'];var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var jayson=require(_0xd187('0x7'));var client=jayson[_0xd187('0x8')]['http']({'port':0x232c});config[_0xd187('0x9')]=_[_0xd187('0xa')](config[_0xd187('0x9')],{'host':_0xd187('0xb'),'port':0x18eb});var socket=require(_0xd187('0xc'))(new Redis(config[_0xd187('0x9')]));require(_0xd187('0xd'))[_0xd187('0xe')](socket);function respondWithRpcPromise(_0x5b480f,_0x342539,_0x42848b){return new BPromise(function(_0x4039f6,_0x473866){return client[_0xd187('0xf')](_0x5b480f,_0x42848b)[_0xd187('0x10')](function(_0x59c194){logger[_0xd187('0x11')](_0xd187('0x12'),_0x342539,_0xd187('0x13'));logger['debug'](_0xd187('0x14'),_0x342539,_0xd187('0x13'),JSON[_0xd187('0x15')](_0x59c194));if(_0x59c194['error']){if(_0x59c194[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x59c194['error'][_0xd187('0x18')]);return _0x473866(_0x59c194[_0xd187('0x16')][_0xd187('0x18')]);}logger[_0xd187('0x16')]('MailAccount,\x20%s,\x20%s',_0x342539,_0x59c194[_0xd187('0x16')]['message']);return _0x4039f6(_0x59c194['error'][_0xd187('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x342539,_0xd187('0x13'));_0x4039f6(_0x59c194[_0xd187('0x19')][_0xd187('0x18')]);}})[_0xd187('0x1a')](function(_0x21df74){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x21df74);_0x473866(_0x21df74);});});}exports[_0xd187('0x1b')]=function(_0x4f2f88){var _0x46fca3=this;return new Promise(function(_0x170d5c,_0x11b2a1){return db[_0xd187('0x1c')]['findAll']({'raw':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f2f88['options']?_0x4f2f88['options']['where']||null:null,'attributes':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'limit':_0x4f2f88['options']?_0x4f2f88[_0xd187('0x1d')]['limit']||null:null,'include':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88['options'][_0xd187('0x20')]?_['map'](_0x4f2f88['options'][_0xd187('0x20')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x21')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1f')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x20')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x21')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1f')],'include':_0xeff822['include']?_[_0xd187('0x22')](_0xeff822[_0xd187('0x20')],function(_0x5c8e52){return{'model':db[_0x5c8e52[_0xd187('0x21')]],'as':_0x5c8e52['as'],'attributes':_0x5c8e52[_0xd187('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x4c50a5){logger[_0xd187('0x11')]('GetMailAccount',_0x4f2f88);logger[_0xd187('0x23')](_0xd187('0x1b'),_0x4f2f88,JSON[_0xd187('0x15')](_0x4c50a5));_0x170d5c(_0x4c50a5);})[_0xd187('0x1a')](function(_0x489f2e){logger[_0xd187('0x16')](_0xd187('0x1b'),_0x489f2e['message'],_0x4f2f88);_0x11b2a1(_0x46fca3['error'](0x1f4,_0x489f2e[_0xd187('0x18')]));});});};exports[_0xd187('0x24')]=function(_0x13f285){var _0x481346=this;return new Promise(function(_0x2874b2,_0x2d8843){return db[_0xd187('0x1c')][_0xd187('0x25')]({'raw':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x13f285[_0xd187('0x1d')]?_0x13f285['options'][_0xd187('0x26')]||null:null,'attributes':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'include':_0x13f285[_0xd187('0x1d')]?_0x13f285['options']['include']?_[_0xd187('0x22')](_0x13f285[_0xd187('0x1d')]['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x21')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1f')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x20')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes'],'include':_0xf32da2['include']?_[_0xd187('0x22')](_0xf32da2['include'],function(_0x28c252){return{'model':db[_0x28c252[_0xd187('0x21')]],'as':_0x28c252['as'],'attributes':_0x28c252['attributes']};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x5674ca){if(_0x13f285[_0xd187('0x1d')][_0xd187('0x27')]===!![])_0x5674ca['setDataValue'](_0xd187('0x28'),_0x5674ca[_0xd187('0x29')]());logger['info'](_0xd187('0x24'),_0x13f285);logger['debug']('ShowMailAccount',_0x13f285,JSON[_0xd187('0x15')](_0x5674ca));_0x2874b2(_0x5674ca);})[_0xd187('0x1a')](function(_0xdecb24){logger[_0xd187('0x16')](_0xd187('0x24'),_0xdecb24['message'],_0x13f285);_0x2d8843(_0x481346[_0xd187('0x16')](0x1f4,_0xdecb24[_0xd187('0x18')]));});});};exports[_0xd187('0x2a')]=function(_0x4f3139){var _0x4b121c=this;return new Promise(function(_0x538c05,_0x595195){var _0x21bb3c={'body':_0x4f3139[_0xd187('0x2b')],'channel':_0xd187('0x2c')};var _0x367303=_[_0xd187('0x2d')](_[_0xd187('0x2e')](db[_0xd187('0x2f')][_0xd187('0x30')]),['createdAt',_0xd187('0x31'),_0xd187('0x32'),_0xd187('0x33')]);var _0x51c7fc=![];if(_0x4f3139[_0xd187('0x2b')]['id']){delete _0x4f3139['body']['id'];}if(_[_0xd187('0x34')](_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0xd187('0x36')));}if(_['isNil'](_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')])||_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')]===''){return _0x595195(_0x4b121c['error'](0x1f4,_0xd187('0x37')));}if(_[_0xd187('0x34')](_0x4f3139['body'][_0xd187('0x38')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}if(!_['includes'](_0x367303,_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')])){return _0x595195(_0x4b121c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}var _0x4f616d={};_0x4f616d[_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')];return db[_0xd187('0x1c')][_0xd187('0x25')]({'where':{'id':_0x4f3139[_0xd187('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd187('0x3a'),'include':[{'model':db[_0xd187('0x2f')],'as':_0xd187('0x3b'),'where':_0x4f616d,'limit':0x1,'order':[[_0xd187('0x31'),_0xd187('0x3c')]]}]},{'model':db[_0xd187('0x3d')],'as':_0xd187('0x3e')},{'model':db[_0xd187('0x3f')],'as':'Smtp','include':[{'model':db[_0xd187('0x40')],'as':_0xd187('0x40')}]}]})[_0xd187('0x10')](function(_0x1449d7){if(_0x1449d7&&_0x1449d7[_0xd187('0x3a')]){var _0x5ad646=_0x1449d7[_0xd187('0x41')]({'plain':!![]});_0x21bb3c[_0xd187('0x39')]=_['omit'](_0x5ad646,[_0xd187('0x3e'),_0xd187('0x3a')]);_0x21bb3c['account']['smtpOptions']=_0x1449d7['getSmtpOptions']();_0x21bb3c['applications']=_0x5ad646[_0xd187('0x3e')];_0x21bb3c[_0xd187('0x42')]=_0x5ad646[_0xd187('0x3a')];_0x21bb3c[_0xd187('0x43')]=_[_0xd187('0x44')](_0x21bb3c[_0xd187('0x43')],[_0xd187('0x45')],['asc']);if(_0x21bb3c[_0xd187('0x39')]&&_0x21bb3c[_0xd187('0x39')][_0xd187('0x46')]){_0x21bb3c[_0xd187('0x43')]['push']({'id':0x0,'priority':_0x21bb3c[_0xd187('0x43')]['length']+0x1,'app':'close','appdata':_0xd187('0x46'),'interval':'*,*,*,*'});}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')];}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')];}if(_0x5ad646[_0xd187('0x3a')]['Contacts'][_0xd187('0x47')]){return _0x5ad646[_0xd187('0x3a')]['Contacts'][0x0];}var _0x471f11=_[_0xd187('0xa')](_0x4f3139[_0xd187('0x2b')],{'firstName':_0x4f3139['body'][_0xd187('0x35')],'ListId':_0x5ad646[_0xd187('0x33')]});_0x471f11[_0x4f3139['body'][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')]['from'];return db[_0xd187('0x2f')]['create'](_0x471f11);}else{throw new Error(_0xd187('0x48'));}})[_0xd187('0x10')](function(_0x3a2a00){_0x21bb3c[_0xd187('0x49')]=_0x3a2a00;if(_0x3a2a00){if(!_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')]){_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x4a')]=rs[_0xd187('0x4b')]()+'\x20'+_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')];}var _0x945810={'ContactId':_0x3a2a00['id'],'MailAccountId':_0x4f3139[_0xd187('0x39')]['id'],'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4c')],'attach':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd187('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f3139['account']['id']},'include':[{'model':db[_0xd187('0x50')],'as':_0xd187('0x51'),'attributes':[_0xd187('0x4a')],'where':{'messageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x52')]}}]})[_0xd187('0x10')](function(_0x4f89a6){if(_0x4f89a6){return[_0x4f89a6,![]];}return db['MailInteraction'][_0xd187('0x53')](_0x945810)[_0xd187('0x10')](function(_0x2870ad){return[_0x2870ad,!![]];});});}else{throw new Error(_0xd187('0x54'));}})['spread'](function(_0x2c1df4,_0x49543f){if(_0x2c1df4){_0x51c7fc=_0x49543f;if(!_0x49543f){return _0x2c1df4[_0xd187('0x55')]({'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')]['message']['subject'],'attach':_0x2c1df4[_0xd187('0x4d')]?_0x2c1df4[_0xd187('0x4d')]:_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'substatus':null,'substatusAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'});}else{return _0x2c1df4;}}})[_0xd187('0x10')](function(_0x379e89){_0x21bb3c[_0xd187('0x56')]=_0x379e89['get']({'plain':!![]});_0x21bb3c[_0xd187('0x56')][_0xd187('0x57')]=_0x51c7fc;return db['MailMessage'][_0xd187('0x53')]({'body':_0x4f3139[_0xd187('0x2b')]['body'],'MailAccountId':_0x4f3139['account']['id'],'MailInteractionId':_0x379e89['id'],'direction':'in','ContactId':_0x21bb3c[_0xd187('0x49')]['id'],'messageId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'from':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'to':_0x4f3139['body']['message']['to'],'cc':_0x4f3139[_0xd187('0x2b')]['message']['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['subject'],'attach':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x4d')],'Attachments':_0x4f3139['body']['message']['attachments'],'originTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x58')],'originCc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x59')],'bcc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['bcc'],'ChatWebsiteId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x5a')]||null,'originChannel':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x5b')]||_0xd187('0x5c'),'ChatOfflineMessageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x5d')]||null},{'include':[{'model':db[_0xd187('0x5e')],'as':'Attachments'}]});})[_0xd187('0x10')](function(_0x3afdd9){_0x21bb3c[_0xd187('0x18')]=_0x3afdd9;if(_0x21bb3c[_0xd187('0x56')]['UserId']){return db[_0xd187('0x5f')][_0xd187('0x25')]({'attributes':['id','name'],'where':{'id':_0x21bb3c[_0xd187('0x56')]['UserId']}})['then'](function(_0x506c53){if(_0x506c53){_0x21bb3c[_0xd187('0x43')][_0xd187('0x60')]({'id':0x0,'priority':0x0,'app':_0xd187('0x61'),'appdata':_0x506c53[_0xd187('0x62')]+','+(_0x21bb3c[_0xd187('0x39')][_0xd187('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd187('0x64'),_0xd187('0x65'),_0x21bb3c);});}return respondWithRpcPromise('Start','startRouting',_0x21bb3c);})[_0xd187('0x10')](function(_0x3e1c19){_0x538c05(_0x3e1c19);})[_0xd187('0x1a')](function(_0x1f163a){_0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0x1f163a[_0xd187('0x18')]));});});};
\ No newline at end of file
+var _0x4137=['Smtp','CloudProvider','get','omit','Applications','applications','priority','asc','push','length','Contacts','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailServerOut'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7413('0x0'));var moment=require(_0x7413('0x1'));var BPromise=require(_0x7413('0x2'));var rs=require(_0x7413('0x3'));var Redis=require(_0x7413('0x4'));var db=require(_0x7413('0x5'))['db'];var logger=require(_0x7413('0x6'))(_0x7413('0x7'));var config=require(_0x7413('0x8'));var jayson=require(_0x7413('0x9'));var client=jayson[_0x7413('0xa')][_0x7413('0xb')]({'port':0x232c});config['redis']=_[_0x7413('0xc')](config[_0x7413('0xd')],{'host':_0x7413('0xe'),'port':0x18eb});var socket=require(_0x7413('0xf'))(new Redis(config['redis']));require(_0x7413('0x10'))[_0x7413('0x11')](socket);function respondWithRpcPromise(_0x4e320b,_0x422bf5,_0x2f4b54){return new BPromise(function(_0x50fde0,_0x29f124){return client[_0x7413('0x12')](_0x4e320b,_0x2f4b54)[_0x7413('0x13')](function(_0x3e026b){logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));logger[_0x7413('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'),JSON[_0x7413('0x17')](_0x3e026b));if(_0x3e026b[_0x7413('0x18')]){if(_0x3e026b['error']['code']===0x1f4){logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b[_0x7413('0x18')]['message']);return _0x29f124(_0x3e026b[_0x7413('0x18')][_0x7413('0x1a')]);}logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b['error']['message']);return _0x50fde0(_0x3e026b[_0x7413('0x18')]['message']);}else{logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));_0x50fde0(_0x3e026b[_0x7413('0x1b')][_0x7413('0x1a')]);}})[_0x7413('0x1c')](function(_0x2a3417){logger[_0x7413('0x18')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x2a3417);_0x29f124(_0x2a3417);});});}exports[_0x7413('0x1d')]=function(_0x17c062){var _0x11f8a1=this;return new Promise(function(_0xfe5b8c,_0x5bee15){return db[_0x7413('0x1e')][_0x7413('0x1f')]({'raw':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x21')]===undefined?!![]:![]:!![],'where':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x22')]||null:null,'attributes':_0x17c062['options']?_0x17c062['options'][_0x7413('0x23')]||null:null,'limit':_0x17c062['options']?_0x17c062[_0x7413('0x20')][_0x7413('0x24')]||null:null,'include':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x25')]?_[_0x7413('0x26')](_0x17c062[_0x7413('0x20')][_0x7413('0x25')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x25')]?_['map'](_0x1d455b[_0x7413('0x25')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x27')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes'],'include':_0x71cbb4[_0x7413('0x25')]?_[_0x7413('0x26')](_0x71cbb4[_0x7413('0x25')],function(_0x4843fd){return{'model':db[_0x4843fd[_0x7413('0x27')]],'as':_0x4843fd['as'],'attributes':_0x4843fd[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24dce7){logger['info'](_0x7413('0x1d'),_0x17c062);logger[_0x7413('0x16')](_0x7413('0x1d'),_0x17c062,JSON[_0x7413('0x17')](_0x24dce7));_0xfe5b8c(_0x24dce7);})[_0x7413('0x1c')](function(_0x2004ea){logger['error'](_0x7413('0x1d'),_0x2004ea[_0x7413('0x1a')],_0x17c062);_0x5bee15(_0x11f8a1[_0x7413('0x18')](0x1f4,_0x2004ea[_0x7413('0x1a')]));});});};exports[_0x7413('0x28')]=function(_0x256395){var _0x185cfe=this;return new Promise(function(_0x5b4426,_0xd763f9){return db[_0x7413('0x1e')][_0x7413('0x29')]({'raw':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x22')]||null:null,'attributes':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['attributes']||null:null,'include':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x25')]?_[_0x7413('0x26')](_0x256395['options']['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x27')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x23')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x25')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x23')],'include':_0x5a92ab['include']?_[_0x7413('0x26')](_0x5a92ab[_0x7413('0x25')],function(_0xf34b21){return{'model':db[_0xf34b21[_0x7413('0x27')]],'as':_0xf34b21['as'],'attributes':_0xf34b21[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa58bd2){if(_0x256395[_0x7413('0x20')][_0x7413('0x2a')]===!![])_0xa58bd2[_0x7413('0x2b')](_0x7413('0x2c'),_0xa58bd2[_0x7413('0x2d')]());logger[_0x7413('0x14')](_0x7413('0x28'),_0x256395);logger[_0x7413('0x16')](_0x7413('0x28'),_0x256395,JSON[_0x7413('0x17')](_0xa58bd2));_0x5b4426(_0xa58bd2);})[_0x7413('0x1c')](function(_0x5a9791){logger[_0x7413('0x18')]('ShowMailAccount',_0x5a9791['message'],_0x256395);_0xd763f9(_0x185cfe['error'](0x1f4,_0x5a9791['message']));});});};exports['NotifyMailAccount']=function(_0x44af7d){var _0x4c1770=this;return new Promise(function(_0x535e49,_0x5dc077){var _0x4d0008={'body':_0x44af7d['body'],'channel':_0x7413('0x2e')};var _0x32f1e8=_[_0x7413('0x2f')](_[_0x7413('0x30')](db[_0x7413('0x31')]['rawAttributes']),[_0x7413('0x32'),'updatedAt',_0x7413('0x33'),_0x7413('0x34')]);var _0xa063d1=![];if(_0x44af7d[_0x7413('0x35')]['id']){delete _0x44af7d[_0x7413('0x35')]['id'];}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x37')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x38')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x35')])||_0x44af7d['body'][_0x7413('0x35')]===''){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x39')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x3b')+_0x32f1e8));}if(!_[_0x7413('0x3c')](_0x32f1e8,_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770['error'](0x1f4,_0x7413('0x3d')+_0x32f1e8));}var _0x52a088={};_0x52a088[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d[_0x7413('0x35')][_0x7413('0x37')];return db[_0x7413('0x1e')][_0x7413('0x29')]({'where':{'id':_0x44af7d[_0x7413('0x3e')]['id']},'include':[{'model':db[_0x7413('0x3f')],'as':_0x7413('0x40'),'include':[{'model':db[_0x7413('0x31')],'as':'Contacts','where':_0x52a088,'limit':0x1,'order':[['updatedAt',_0x7413('0x41')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x7413('0x42')],'as':_0x7413('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7413('0x44')}]}]})['then'](function(_0x562bae){if(_0x562bae&&_0x562bae[_0x7413('0x40')]){var _0x5f263e=_0x562bae[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x3e')]=_[_0x7413('0x46')](_0x5f263e,[_0x7413('0x47'),_0x7413('0x40')]);_0x4d0008[_0x7413('0x3e')][_0x7413('0x2c')]=_0x562bae[_0x7413('0x2d')]();_0x4d0008[_0x7413('0x48')]=_0x5f263e[_0x7413('0x47')];_0x4d0008['list']=_0x5f263e[_0x7413('0x40')];_0x4d0008['applications']=_['orderBy'](_0x4d0008['applications'],[_0x7413('0x49')],[_0x7413('0x4a')]);if(_0x4d0008[_0x7413('0x3e')]&&_0x4d0008[_0x7413('0x3e')]['autoclose']){_0x4d0008['applications'][_0x7413('0x4b')]({'id':0x0,'priority':_0x4d0008['applications'][_0x7413('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x4d0008['account']['Applications']){delete _0x4d0008[_0x7413('0x3e')][_0x7413('0x47')];}if(_0x4d0008[_0x7413('0x3e')][_0x7413('0x40')]){delete _0x4d0008[_0x7413('0x3e')]['List'];}if(_0x5f263e[_0x7413('0x40')][_0x7413('0x4d')][_0x7413('0x4c')]){return _0x5f263e['List'][_0x7413('0x4d')][0x0];}var _0x5c3324=_['defaults'](_0x44af7d[_0x7413('0x35')],{'firstName':_0x44af7d[_0x7413('0x35')][_0x7413('0x37')],'ListId':_0x5f263e[_0x7413('0x34')]});_0x5c3324[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d['body'][_0x7413('0x37')];return db['CmContact'][_0x7413('0x4e')](_0x5c3324);}else{throw new Error('List\x20not\x20found');}})[_0x7413('0x13')](function(_0x4d4faa){_0x4d0008[_0x7413('0x4f')]=_0x4d4faa;if(_0x4d4faa){if(!_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x50')]){_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')]=rs['generate']()+'\x20'+_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'];}var _0x3ce34c={'ContactId':_0x4d4faa['id'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'inReplyTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x52')],'lastMsgAt':moment()[_0x7413('0x53')](_0x7413('0x54')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x44af7d['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7413('0x50')],'where':{'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['inReplyTo']}}]})[_0x7413('0x13')](function(_0xb7dd83){if(_0xb7dd83){return[_0xb7dd83,![]];}return db[_0x7413('0x55')][_0x7413('0x4e')](_0x3ce34c)[_0x7413('0x13')](function(_0x3db284){return[_0x3db284,!![]];});});}else{throw new Error(_0x7413('0x56'));}})[_0x7413('0x57')](function(_0x1ec131,_0x47512d){if(_0x1ec131){_0xa063d1=_0x47512d;if(!_0x47512d){return _0x1ec131[_0x7413('0x58')]({'inReplyTo':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['messageId'],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x1ec131[_0x7413('0x52')]?_0x1ec131['attach']:_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x7413('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7413('0x54')),'lastMsgDirection':'in'});}else{return _0x1ec131;}}})[_0x7413('0x13')](function(_0x167c6b){_0x4d0008[_0x7413('0x59')]=_0x167c6b[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x59')][_0x7413('0x5a')]=_0xa063d1;return db[_0x7413('0x5b')]['create']({'body':_0x44af7d[_0x7413('0x35')]['body'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'MailInteractionId':_0x167c6b['id'],'direction':'in','ContactId':_0x4d0008[_0x7413('0x4f')]['id'],'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x50')],'from':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'to':_0x44af7d[_0x7413('0x35')]['message']['to'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')]['attach'],'Attachments':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attachments'],'originTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x5c')],'originCc':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x5d')],'bcc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5e')],'ChatWebsiteId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5f')]||'Email','ChatOfflineMessageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x60')]||null},{'include':[{'model':db[_0x7413('0x61')],'as':_0x7413('0x62')}]});})[_0x7413('0x13')](function(_0x46e9f8){_0x4d0008[_0x7413('0x1a')]=_0x46e9f8;if(_0x4d0008[_0x7413('0x59')]['UserId']){return db[_0x7413('0x63')][_0x7413('0x29')]({'attributes':['id',_0x7413('0x64')],'where':{'id':_0x4d0008[_0x7413('0x59')][_0x7413('0x65')]}})[_0x7413('0x13')](function(_0x4c9d1b){if(_0x4c9d1b){_0x4d0008[_0x7413('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c9d1b[_0x7413('0x64')]+','+(_0x4d0008[_0x7413('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x7413('0x66')});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);})[_0x7413('0x13')](function(_0x2d361c){_0x535e49(_0x2d361c);})[_0x7413('0x1c')](function(_0x5f4765){_0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x5f4765['message']));});});};
\ No newline at end of file
index 8147228..353ffbb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x48ac=['register','mailAccount:','save','update','emit','removeListener'];(function(_0x5b018f,_0x114704){var _0x5a231b=function(_0x661551){while(--_0x661551){_0x5b018f['push'](_0x5b018f['shift']());}};_0x5a231b(++_0x114704);}(_0x48ac,0xe0));var _0xc48a=function(_0x2681ab,_0x111ea5){_0x2681ab=_0x2681ab-0x0;var _0x590175=_0x48ac[_0x2681ab];return _0x590175;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xc48a('0x0'),'remove',_0xc48a('0x1')];function createListener(_0xbfd8aa,_0x3b8221){return function(_0x585c5c){_0x3b8221[_0xc48a('0x2')](_0xbfd8aa,_0x585c5c);};}function removeListener(_0x11a4da,_0xcd83ab){return function(){MailAccountEvents[_0xc48a('0x3')](_0x11a4da,_0xcd83ab);};}exports[_0xc48a('0x4')]=function(_0x499749){for(var _0x48205f=0x0,_0x5df462=events['length'];_0x48205f<_0x5df462;_0x48205f++){var _0x1e1e1a=events[_0x48205f];var _0xf0c31b=createListener(_0xc48a('0x5')+_0x1e1e1a,_0x499749);MailAccountEvents['on'](_0x1e1e1a,_0xf0c31b);}};
\ No newline at end of file
+var _0x5bf9=['length','save','remove','update','emit','removeListener','register'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x5bf9,0xa2));var _0x95bf=function(_0x3eada3,_0x3572ed){_0x3eada3=_0x3eada3-0x0;var _0x3d6779=_0x5bf9[_0x3eada3];return _0x3d6779;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x95bf('0x0'),_0x95bf('0x1'),_0x95bf('0x2')];function createListener(_0x5a279a,_0x28b665){return function(_0x405352){_0x28b665[_0x95bf('0x3')](_0x5a279a,_0x405352);};}function removeListener(_0x4fc39e,_0x4525bc){return function(){MailAccountEvents[_0x95bf('0x4')](_0x4fc39e,_0x4525bc);};}exports[_0x95bf('0x5')]=function(_0x2cd685){for(var _0x298fc6=0x0,_0x47de40=events[_0x95bf('0x6')];_0x298fc6<_0x47de40;_0x298fc6++){var _0x487e36=events[_0x298fc6];var _0x3b3f63=createListener('mailAccount:'+_0x487e36,_0x2cd685);MailAccountEvents['on'](_0x487e36,_0x3b3f63);}};
\ No newline at end of file
index c9116ce..4b3a4d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9edc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3e7c33,_0x3bf3ef){var _0x3f2c18=function(_0x114439){while(--_0x114439){_0x3e7c33['push'](_0x3e7c33['shift']());}};_0x3f2c18(++_0x3bf3ef);}(_0x9edc,0x150));var _0xc9ed=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x9edc[_0x3b16e1];return _0x311d1b;};'use strict';var multer=require(_0xc9ed('0x0'));var util=require(_0xc9ed('0x1'));var path=require(_0xc9ed('0x2'));var timeout=require(_0xc9ed('0x3'));var express=require(_0xc9ed('0x4'));var router=express[_0xc9ed('0x5')]();var fs_extra=require(_0xc9ed('0x6'));var auth=require(_0xc9ed('0x7'));var interaction=require(_0xc9ed('0x8'));var config=require(_0xc9ed('0x9'));var controller=require('./mailApplication.controller');router[_0xc9ed('0xa')]('/:id',auth[_0xc9ed('0xb')](),controller[_0xc9ed('0xc')]);router[_0xc9ed('0xd')](_0xc9ed('0xe'),auth[_0xc9ed('0xb')](),controller[_0xc9ed('0xf')]);router[_0xc9ed('0x10')](_0xc9ed('0xe'),auth[_0xc9ed('0xb')](),controller[_0xc9ed('0x11')]);module[_0xc9ed('0x12')]=router;
\ No newline at end of file
+var _0xac80=['../../config/environment','get','/:id','isAuthenticated','update','delete','destroy','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e1f74,_0x567dc9){var _0x4fba1e=function(_0x3023bc){while(--_0x3023bc){_0x3e1f74['push'](_0x3e1f74['shift']());}};_0x4fba1e(++_0x567dc9);}(_0xac80,0x11b));var _0x0ac8=function(_0x114fec,_0x5dd74a){_0x114fec=_0x114fec-0x0;var _0x56a690=_0xac80[_0x114fec];return _0x56a690;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ac8('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ac8('0x1')]();var fs_extra=require(_0x0ac8('0x2'));var auth=require(_0x0ac8('0x3'));var interaction=require(_0x0ac8('0x4'));var config=require(_0x0ac8('0x5'));var controller=require('./mailApplication.controller');router[_0x0ac8('0x6')](_0x0ac8('0x7'),auth[_0x0ac8('0x8')](),controller['show']);router['put']('/:id',auth[_0x0ac8('0x8')](),controller[_0x0ac8('0x9')]);router[_0x0ac8('0xa')](_0x0ac8('0x7'),auth['isAuthenticated'](),controller[_0x0ac8('0xb')]);module['exports']=router;
\ No newline at end of file
index 9225c08..eacaa71 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2746=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x50b660,_0x2f5328){var _0x5118c4=function(_0x162506){while(--_0x162506){_0x50b660['push'](_0x50b660['shift']());}};_0x5118c4(++_0x2f5328);}(_0x2746,0x75));var _0x6274=function(_0x7aae4,_0x379629){_0x7aae4=_0x7aae4-0x0;var _0x1ce74e=_0x2746[_0x7aae4];return _0x1ce74e;};'use strict';var Sequelize=require(_0x6274('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6274('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6274('0x2')],'allowNull':![],'defaultValue':_0x6274('0x3')},'appdata':{'type':Sequelize[_0x6274('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6274('0x2')],'defaultValue':_0x6274('0x5')}};
\ No newline at end of file
+var _0xff24=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xff24,0x109));var _0x4ff2=function(_0x3cd74c,_0x33f558){_0x3cd74c=_0x3cd74c-0x0;var _0xa61b9f=_0xff24[_0x3cd74c];return _0xa61b9f;};'use strict';var Sequelize=require(_0x4ff2('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4ff2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4ff2('0x2')],'allowNull':![],'defaultValue':_0x4ff2('0x3')},'appdata':{'type':Sequelize[_0x4ff2('0x4')]()},'description':{'type':Sequelize[_0x4ff2('0x2')]},'interval':{'type':Sequelize[_0x4ff2('0x2')],'defaultValue':_0x4ff2('0x5')}};
\ No newline at end of file
index 833088d..9a3d613 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2dc70d,_0x26e805){_0x2dc70d=_0x2dc70d-0x0;var _0x3b9ecc=_0xbdb7[_0x2dc70d];return _0x3b9ecc;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));};
\ No newline at end of file
+var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));};
\ No newline at end of file
index 5b3f6bf..38b1ccc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8cc1=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x8cc1,0x1e6));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18cc('0x0'));var util=require(_0x18cc('0x1'));var logger=require(_0x18cc('0x2'))(_0x18cc('0x3'));var moment=require(_0x18cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x18cc('0x5'));var fs=require('fs');var path=require(_0x18cc('0x6'));var rimraf=require(_0x18cc('0x7'));var config=require(_0x18cc('0x8'));var attributes=require(_0x18cc('0x9'));module[_0x18cc('0xa')]=function(_0x2a868c,_0x1ca32d){return _0x2a868c[_0x18cc('0xb')](_0x18cc('0xc'),attributes,{'tableName':_0x18cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18cc('0xe'),'collate':_0x18cc('0xf')});};
\ No newline at end of file
+var _0x7bbf=['bluebird','path','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7bbf,0x19e));var _0xf7bb=function(_0x11689e,_0x4572b0){_0x11689e=_0x11689e-0x0;var _0x2a8c31=_0x7bbf[_0x11689e];return _0x2a8c31;};'use strict';var _=require(_0xf7bb('0x0'));var util=require(_0xf7bb('0x1'));var logger=require(_0xf7bb('0x2'))(_0xf7bb('0x3'));var moment=require('moment');var BPromise=require(_0xf7bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7bb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf7bb('0x6'));module[_0xf7bb('0x7')]=function(_0x52bf25,_0xf83043){return _0x52bf25['define'](_0xf7bb('0x8'),attributes,{'tableName':_0xf7bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf7bb('0xa')});};
\ No newline at end of file
index 9b4159d..4072eda 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xade9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3caf1e,_0x2c3aae){var _0x61cbe9=function(_0x14c997){while(--_0x14c997){_0x3caf1e['push'](_0x3caf1e['shift']());}};_0x61cbe9(++_0x2c3aae);}(_0xade9,0x1e7));var _0x9ade=function(_0x20952d,_0x4eddd5){_0x20952d=_0x20952d-0x0;var _0x3b24d5=_0xade9[_0x20952d];return _0x3b24d5;};'use strict';var _=require('lodash');var util=require(_0x9ade('0x0'));var moment=require(_0x9ade('0x1'));var BPromise=require(_0x9ade('0x2'));var rs=require(_0x9ade('0x3'));var fs=require('fs');var Redis=require(_0x9ade('0x4'));var db=require(_0x9ade('0x5'))['db'];var utils=require(_0x9ade('0x6'));var logger=require(_0x9ade('0x7'))('rpc');var config=require(_0x9ade('0x8'));var jayson=require(_0x9ade('0x9'));var client=jayson['client'][_0x9ade('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3840d,_0x48974f,_0x37f58a){return new BPromise(function(_0x38bbe5,_0x3c00ba){return client['request'](_0xc3840d,_0x37f58a)[_0x9ade('0xb')](function(_0x579ac5){logger[_0x9ade('0xc')]('MailApplication,\x20%s,\x20%s',_0x48974f,_0x9ade('0xd'));logger[_0x9ade('0xe')](_0x9ade('0xf'),_0x48974f,'request\x20sent',JSON[_0x9ade('0x10')](_0x579ac5));if(_0x579ac5[_0x9ade('0x11')]){if(_0x579ac5[_0x9ade('0x11')][_0x9ade('0x12')]===0x1f4){logger['error'](_0x9ade('0x13'),_0x48974f,_0x579ac5[_0x9ade('0x11')][_0x9ade('0x14')]);return _0x3c00ba(_0x579ac5[_0x9ade('0x11')][_0x9ade('0x14')]);}logger['error'](_0x9ade('0x13'),_0x48974f,_0x579ac5['error'][_0x9ade('0x14')]);return _0x38bbe5(_0x579ac5[_0x9ade('0x11')]['message']);}else{logger[_0x9ade('0xc')](_0x9ade('0x13'),_0x48974f,_0x9ade('0xd'));_0x38bbe5(_0x579ac5['result'][_0x9ade('0x14')]);}})[_0x9ade('0x15')](function(_0x1dd072){logger['error'](_0x9ade('0x13'),_0x48974f,_0x1dd072);_0x3c00ba(_0x1dd072);});});}exports[_0x9ade('0x16')]=function(_0x266d6f){var _0x5b29b8=this;return new Promise(function(_0x363156,_0x3b6aa6){return db[_0x9ade('0x17')][_0x9ade('0x18')](_0x266d6f[_0x9ade('0x19')],{'raw':_0x266d6f[_0x9ade('0x1a')]?_0x266d6f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x266d6f['options']?_0x266d6f[_0x9ade('0x1a')][_0x9ade('0x1b')]||null:null,'attributes':_0x266d6f[_0x9ade('0x1a')]?_0x266d6f[_0x9ade('0x1a')][_0x9ade('0x1c')]||null:null,'limit':_0x266d6f[_0x9ade('0x1a')]?_0x266d6f[_0x9ade('0x1a')]['limit']||null:null})['then'](function(_0xcb32be){logger['info'](_0x9ade('0x16'),_0x266d6f);logger[_0x9ade('0xe')](_0x9ade('0x16'),_0x266d6f,JSON['stringify'](_0xcb32be));_0x363156(_0xcb32be);})[_0x9ade('0x15')](function(_0xda4ff8){logger['error'](_0x9ade('0x16'),_0xda4ff8[_0x9ade('0x14')],_0x266d6f);_0x3b6aa6(_0x5b29b8[_0x9ade('0x11')](0x1f4,_0xda4ff8[_0x9ade('0x14')]));});});};
\ No newline at end of file
+var _0x0b6e=['client','http','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','then','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb84be7,_0x51247e){var _0x1b03e2=function(_0x40b89a){while(--_0x40b89a){_0xb84be7['push'](_0xb84be7['shift']());}};_0x1b03e2(++_0x51247e);}(_0x0b6e,0x164));var _0xe0b6=function(_0x15e782,_0x4f825d){_0x15e782=_0x15e782-0x0;var _0x2ea84b=_0x0b6e[_0x15e782];return _0x2ea84b;};'use strict';var _=require(_0xe0b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe0b6('0x1'));var rs=require(_0xe0b6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0b6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0b6('0x4'))(_0xe0b6('0x5'));var config=require(_0xe0b6('0x6'));var jayson=require(_0xe0b6('0x7'));var client=jayson[_0xe0b6('0x8')][_0xe0b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42f8e9,_0x290bf1,_0x24cec8){return new BPromise(function(_0x2e3362,_0x5c47a3){return client['request'](_0x42f8e9,_0x24cec8)['then'](function(_0x1200cb){logger[_0xe0b6('0xa')](_0xe0b6('0xb'),_0x290bf1,_0xe0b6('0xc'));logger['debug'](_0xe0b6('0xd'),_0x290bf1,_0xe0b6('0xc'),JSON[_0xe0b6('0xe')](_0x1200cb));if(_0x1200cb['error']){if(_0x1200cb[_0xe0b6('0xf')][_0xe0b6('0x10')]===0x1f4){logger[_0xe0b6('0xf')](_0xe0b6('0xb'),_0x290bf1,_0x1200cb[_0xe0b6('0xf')][_0xe0b6('0x11')]);return _0x5c47a3(_0x1200cb[_0xe0b6('0xf')][_0xe0b6('0x11')]);}logger[_0xe0b6('0xf')]('MailApplication,\x20%s,\x20%s',_0x290bf1,_0x1200cb[_0xe0b6('0xf')][_0xe0b6('0x11')]);return _0x2e3362(_0x1200cb['error'][_0xe0b6('0x11')]);}else{logger[_0xe0b6('0xa')](_0xe0b6('0xb'),_0x290bf1,'request\x20sent');_0x2e3362(_0x1200cb['result'][_0xe0b6('0x11')]);}})[_0xe0b6('0x12')](function(_0x5c2a52){logger[_0xe0b6('0xf')](_0xe0b6('0xb'),_0x290bf1,_0x5c2a52);_0x5c47a3(_0x5c2a52);});});}exports[_0xe0b6('0x13')]=function(_0x44ec42){var _0x277169=this;return new Promise(function(_0x46f782,_0x101cf5){return db[_0xe0b6('0x14')][_0xe0b6('0x15')](_0x44ec42[_0xe0b6('0x16')],{'raw':_0x44ec42[_0xe0b6('0x17')]?_0x44ec42[_0xe0b6('0x17')][_0xe0b6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ec42[_0xe0b6('0x17')]?_0x44ec42[_0xe0b6('0x17')][_0xe0b6('0x19')]||null:null,'attributes':_0x44ec42[_0xe0b6('0x17')]?_0x44ec42[_0xe0b6('0x17')][_0xe0b6('0x1a')]||null:null,'limit':_0x44ec42['options']?_0x44ec42[_0xe0b6('0x17')]['limit']||null:null})[_0xe0b6('0x1b')](function(_0x1e0f3e){logger['info'](_0xe0b6('0x13'),_0x44ec42);logger['debug'](_0xe0b6('0x13'),_0x44ec42,JSON[_0xe0b6('0xe')](_0x1e0f3e));_0x46f782(_0x1e0f3e);})[_0xe0b6('0x12')](function(_0x574583){logger['error']('UpdateMailApplication',_0x574583['message'],_0x44ec42);_0x101cf5(_0x277169[_0xe0b6('0xf')](0x1f4,_0x574583[_0xe0b6('0x11')]));});});};
\ No newline at end of file
index 5b527a4..c8ece99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c68=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','./mailInteraction.controller','isAuthenticated','index','get','describe'];(function(_0x29b5ce,_0x15d3e1){var _0x2d8cfb=function(_0x29ca38){while(--_0x29ca38){_0x29b5ce['push'](_0x29b5ce['shift']());}};_0x2d8cfb(++_0x15d3e1);}(_0x7c68,0x189));var _0x87c6=function(_0x358c14,_0x180d69){_0x358c14=_0x358c14-0x0;var _0x207415=_0x7c68[_0x358c14];return _0x207415;};'use strict';var express=require(_0x87c6('0x0'));var router=express[_0x87c6('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0x87c6('0x2'));router['get']('/',auth[_0x87c6('0x3')](),controller[_0x87c6('0x4')]);router[_0x87c6('0x5')]('/describe',auth[_0x87c6('0x3')](),controller[_0x87c6('0x6')]);router[_0x87c6('0x5')]('/:id',auth[_0x87c6('0x3')](),controller[_0x87c6('0x7')]);router[_0x87c6('0x5')](_0x87c6('0x8'),auth[_0x87c6('0x3')](),controller[_0x87c6('0x9')]);router[_0x87c6('0x5')](_0x87c6('0xa'),auth[_0x87c6('0x3')](),controller[_0x87c6('0xb')]);router[_0x87c6('0xc')]('/',auth[_0x87c6('0x3')](),controller[_0x87c6('0xd')]);router['post'](_0x87c6('0x8'),auth[_0x87c6('0x3')](),controller[_0x87c6('0xe')]);router['post'](_0x87c6('0xf'),auth[_0x87c6('0x3')](),interaction[_0x87c6('0x10')](_0x87c6('0x11'),'mailinteraction:addtags'),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x87c6('0x11'),_0x87c6('0x12')),controller[_0x87c6('0x13')]);router[_0x87c6('0x14')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x87c6('0x11'),_0x87c6('0x15')),controller[_0x87c6('0x16')]);router[_0x87c6('0x14')](_0x87c6('0xf'),auth[_0x87c6('0x3')](),controller[_0x87c6('0x17')]);module[_0x87c6('0x18')]=router;
\ No newline at end of file
+var _0x0e1f=['exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','/:id/tags','tracked','mailinteraction:addtags','put','mailinteraction:update','update','mail','mailinteraction:destroy','destroy'];(function(_0x180bd3,_0x240488){var _0x2c7250=function(_0x949746){while(--_0x949746){_0x180bd3['push'](_0x180bd3['shift']());}};_0x2c7250(++_0x240488);}(_0x0e1f,0x139));var _0xf0e1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e1f[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0xf0e1('0x0'));var router=express[_0xf0e1('0x1')]();var auth=require(_0xf0e1('0x2'));var interaction=require(_0xf0e1('0x3'));var controller=require(_0xf0e1('0x4'));router[_0xf0e1('0x5')]('/',auth[_0xf0e1('0x6')](),controller[_0xf0e1('0x7')]);router[_0xf0e1('0x5')](_0xf0e1('0x8'),auth[_0xf0e1('0x6')](),controller[_0xf0e1('0x9')]);router[_0xf0e1('0x5')](_0xf0e1('0xa'),auth['isAuthenticated'](),controller[_0xf0e1('0xb')]);router[_0xf0e1('0x5')]('/:id/messages',auth[_0xf0e1('0x6')](),controller[_0xf0e1('0xc')]);router[_0xf0e1('0x5')](_0xf0e1('0xd'),auth[_0xf0e1('0x6')](),controller['download']);router[_0xf0e1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0e1('0xe')](_0xf0e1('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0xf0e1('0xe')](_0xf0e1('0x10'),auth['isAuthenticated'](),interaction[_0xf0e1('0x11')]('mail',_0xf0e1('0x12')),controller['addTags']);router[_0xf0e1('0x13')](_0xf0e1('0xa'),auth[_0xf0e1('0x6')](),interaction[_0xf0e1('0x11')]('mail',_0xf0e1('0x14')),controller[_0xf0e1('0x15')]);router['delete'](_0xf0e1('0xa'),auth[_0xf0e1('0x6')](),interaction['tracked'](_0xf0e1('0x16'),_0xf0e1('0x17')),controller[_0xf0e1('0x18')]);router['delete'](_0xf0e1('0x10'),auth['isAuthenticated'](),controller['removeTags']);module[_0xf0e1('0x19')]=router;
\ No newline at end of file
index 65dab7c..3992fe1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x163b=['DATE','ENUM','out','BOOLEAN','sequelize','iconv','exports','STRING','TEXT'];(function(_0x2bc8b4,_0x35cc1b){var _0x24c2bb=function(_0x2bea18){while(--_0x2bea18){_0x2bc8b4['push'](_0x2bc8b4['shift']());}};_0x24c2bb(++_0x35cc1b);}(_0x163b,0x175));var _0xb163=function(_0x27835f,_0x43d12c){_0x27835f=_0x27835f-0x0;var _0x497014=_0x163b[_0x27835f];return _0x497014;};'use strict';var Sequelize=require(_0xb163('0x0'));var iconv=require(_0xb163('0x1'));module[_0xb163('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb163('0x3')]},'secondDisposition':{'type':Sequelize[_0xb163('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb163('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xb163('0x3')]},'cc':{'type':Sequelize[_0xb163('0x4')]('long')},'subject':{'type':Sequelize[_0xb163('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb163('0x5')]},'substatus':{'type':Sequelize[_0xb163('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xb163('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xb163('0x6')]('in',_0xb163('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb163('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xb163('0x6')]('in',_0xb163('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb163('0x8')],'defaultValue':![]}};
\ No newline at end of file
+var _0xb6af=['ENUM','BOOLEAN','sequelize','iconv','exports','DATE','STRING','TEXT','long','out'];(function(_0x55edf0,_0x24c842){var _0x47b114=function(_0x2cc2f4){while(--_0x2cc2f4){_0x55edf0['push'](_0x55edf0['shift']());}};_0x47b114(++_0x24c842);}(_0xb6af,0x1ce));var _0xfb6a=function(_0x55b037,_0x2d9392){_0x55b037=_0x55b037-0x0;var _0x5f1053=_0xb6af[_0x55b037];return _0x5f1053;};'use strict';var Sequelize=require(_0xfb6a('0x0'));var iconv=require(_0xfb6a('0x1'));module[_0xfb6a('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfb6a('0x3')]},'disposition':{'type':Sequelize[_0xfb6a('0x4')]},'secondDisposition':{'type':Sequelize[_0xfb6a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfb6a('0x4')]},'note':{'type':Sequelize[_0xfb6a('0x4')]},'inReplyTo':{'type':Sequelize[_0xfb6a('0x4')](0x1fe)},'to':{'type':Sequelize[_0xfb6a('0x4')]},'cc':{'type':Sequelize[_0xfb6a('0x5')](_0xfb6a('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfb6a('0x3')]},'substatus':{'type':Sequelize[_0xfb6a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xfb6a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfb6a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfb6a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfb6a('0x9')],'defaultValue':![]}};
\ No newline at end of file
index 2998b60..5a0cb7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ad7=['html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','show','params','keys','filters','intersection','model','attributes','fields','length','include','merge','options','find','catch','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','Attachments','from','bcc','subject','createdAt','get','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb'];(function(_0x5ebad3,_0x1fad92){var _0x3719e6=function(_0x398a9){while(--_0x398a9){_0x5ebad3['push'](_0x5ebad3['shift']());}};_0x3719e6(++_0x1fad92);}(_0x9ad7,0x153));var _0x79ad=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x9ad7[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0x79ad('0x0'));var rimraf=require(_0x79ad('0x1'));var zipdir=require('zip-dir');var moment=require(_0x79ad('0x2'));var BPromise=require(_0x79ad('0x3'));var util=require(_0x79ad('0x4'));var path=require(_0x79ad('0x5'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x79ad('0x6'));var interaction=require(_0x79ad('0x7'));var qs=require(_0x79ad('0x8'));var logger=require(_0x79ad('0x9'))(_0x79ad('0xa'));var config=require('../../config/environment');var db=require(_0x79ad('0xb'))['db'];var htmlEntities=require(_0x79ad('0xc'));config[_0x79ad('0xd')]=_[_0x79ad('0xe')](config['redis'],{'host':_0x79ad('0xf'),'port':0x18eb});var socket=require(_0x79ad('0x10'))(new Redis(config[_0x79ad('0xd')]));require('./mailInteraction.socket')[_0x79ad('0x11')](socket);function respondWithStatusCode(_0x5c24ec,_0x4d2090){_0x4d2090=_0x4d2090||0xcc;return function(_0x3d6d45){if(_0x3d6d45){return _0x5c24ec[_0x79ad('0x12')](_0x4d2090);}return _0x5c24ec[_0x79ad('0x13')](_0x4d2090)[_0x79ad('0x14')]();};}function respondWithResult(_0x3664b0,_0x1b8037){_0x1b8037=_0x1b8037||0xc8;return function(_0x570541){if(_0x570541){return _0x3664b0[_0x79ad('0x13')](_0x1b8037)[_0x79ad('0x15')](_0x570541);}};}function respondWithFilteredResult(_0x3e7644,_0x3cee91){return function(_0x22e734){if(_0x22e734){var _0x3b0f96=typeof _0x3cee91[_0x79ad('0x16')]===_0x79ad('0x17')&&typeof _0x3cee91[_0x79ad('0x18')]===_0x79ad('0x17');var _0xc71289=_0x22e734['count'];var _0x3b1d1d=_0x3b0f96?0x0:_0x3cee91[_0x79ad('0x16')];var _0x37be69=_0x3b0f96?_0x22e734[_0x79ad('0x19')]:_0x3cee91[_0x79ad('0x16')]+_0x3cee91[_0x79ad('0x18')];var _0x41c718;if(_0x37be69>=_0xc71289){_0x37be69=_0xc71289;_0x41c718=0xc8;}else{_0x41c718=0xce;}_0x3e7644[_0x79ad('0x13')](_0x41c718);return _0x3e7644[_0x79ad('0x1a')]('Content-Range',_0x3b1d1d+'-'+_0x37be69+'/'+_0xc71289)[_0x79ad('0x15')](_0x22e734);}return null;};}function saveUpdates(_0x35a873){return function(_0xf929b8){if(_0xf929b8){return _0xf929b8['update'](_0x35a873)[_0x79ad('0x1b')](function(_0x4a6490){return _0x4a6490;});}return null;};}function removeEntity(_0x3ac508){return function(_0x3b0a05){if(_0x3b0a05){return _0x3b0a05[_0x79ad('0x1c')]()[_0x79ad('0x1b')](function(){_0x3ac508[_0x79ad('0x13')](0xcc)[_0x79ad('0x14')]();});}};}function handleEntityNotFound(_0x3daed1){return function(_0x15f2c8){if(!_0x15f2c8){_0x3daed1[_0x79ad('0x12')](0x194);}return _0x15f2c8;};}function handleError(_0x52f55c,_0x32e746){_0x32e746=_0x32e746||0x1f4;return function(_0xf32f73){logger[_0x79ad('0x1d')](_0xf32f73[_0x79ad('0x1e')]);if(_0xf32f73[_0x79ad('0x1f')]){delete _0xf32f73[_0x79ad('0x1f')];}_0x52f55c['status'](_0x32e746)[_0x79ad('0x20')](_0xf32f73);};}exports[_0x79ad('0x21')]=function(_0x58cbf2,_0x44b60c){var _0x43d3c2={};var _0x125e8e=_[_0x79ad('0x22')](db[_0x79ad('0x23')][_0x79ad('0x24')],function(_0x47e807){return{'name':_0x47e807[_0x79ad('0x25')],'type':_0x47e807[_0x79ad('0x26')][_0x79ad('0x27')]};});_0x43d3c2=qs[_0x79ad('0x28')](_0x125e8e,_0x58cbf2);return interaction[_0x79ad('0x29')](_0x79ad('0x2a'),_0x58cbf2[_0x79ad('0x2b')],_0x58cbf2[_0x79ad('0x2c')],_0x43d3c2,_0x125e8e)[_0x79ad('0x1b')](respondWithFilteredResult(_0x44b60c,_0x43d3c2))['catch'](handleError(_0x44b60c,null));};exports[_0x79ad('0x2d')]=function(_0x4d182f,_0x28d130){var _0xdcee08={'raw':![],'where':{'id':_0x4d182f[_0x79ad('0x2e')]['id']}},_0x49e306={};_0x49e306['model']=_[_0x79ad('0x2f')](db[_0x79ad('0x23')]['rawAttributes']);_0x49e306[_0x79ad('0x2b')]=_['keys'](_0x4d182f[_0x79ad('0x2b')]);_0x49e306[_0x79ad('0x30')]=_[_0x79ad('0x31')](_0x49e306[_0x79ad('0x32')],_0x49e306['query']);_0xdcee08[_0x79ad('0x33')]=_[_0x79ad('0x31')](_0x49e306[_0x79ad('0x32')],qs[_0x79ad('0x34')](_0x4d182f[_0x79ad('0x2b')]['fields']));_0xdcee08[_0x79ad('0x33')]=_0xdcee08[_0x79ad('0x33')][_0x79ad('0x35')]?_0xdcee08[_0x79ad('0x33')]:_0x49e306['model'];if(_0x4d182f['query']['includeAll']){_0xdcee08[_0x79ad('0x36')]=[{'all':!![]}];}_0xdcee08=_[_0x79ad('0x37')]({},_0xdcee08,_0x4d182f[_0x79ad('0x38')]);return db[_0x79ad('0x23')][_0x79ad('0x39')](_0xdcee08)['then'](handleEntityNotFound(_0x28d130,null))[_0x79ad('0x1b')](respondWithResult(_0x28d130,null))[_0x79ad('0x3a')](handleError(_0x28d130,null));};exports[_0x79ad('0x3b')]=function(_0x27c631,_0x4a9ba8){return db['MailInteraction'][_0x79ad('0x3b')](_0x27c631['body'],{})['then'](respondWithResult(_0x4a9ba8,0xc9))[_0x79ad('0x3a')](handleError(_0x4a9ba8,null));};exports['update']=function(_0x2088fa,_0x20bbf9){if(_0x2088fa[_0x79ad('0x3c')]['id']){delete _0x2088fa['body']['id'];}return db[_0x79ad('0x23')][_0x79ad('0x39')]({'where':{'id':_0x2088fa[_0x79ad('0x2e')]['id']}})[_0x79ad('0x1b')](handleEntityNotFound(_0x20bbf9,null))[_0x79ad('0x1b')](saveUpdates(_0x2088fa[_0x79ad('0x3c')],null))[_0x79ad('0x1b')](respondWithResult(_0x20bbf9,null))[_0x79ad('0x3a')](handleError(_0x20bbf9,null));};exports[_0x79ad('0x1c')]=function(_0x451406,_0x36a9b5){return db[_0x79ad('0x23')][_0x79ad('0x39')]({'where':{'id':_0x451406[_0x79ad('0x2e')]['id']}})[_0x79ad('0x1b')](handleEntityNotFound(_0x36a9b5,null))[_0x79ad('0x1b')](removeEntity(_0x36a9b5,null))['catch'](handleError(_0x36a9b5,null));};exports[_0x79ad('0x3d')]=function(_0x1505be,_0x3265a0){return db[_0x79ad('0x23')][_0x79ad('0x3d')]()[_0x79ad('0x1b')](respondWithResult(_0x3265a0,null))['catch'](handleError(_0x3265a0,null));};exports[_0x79ad('0x3e')]=function(_0x43bdc0,_0x29dc39){return db[_0x79ad('0x3f')][_0x79ad('0x39')]({'where':{'id':_0x43bdc0[_0x79ad('0x2e')]['id']}})[_0x79ad('0x1b')](handleEntityNotFound(_0x29dc39,null))[_0x79ad('0x1b')](function(_0x4b859b){if(_0x4b859b){return _0x4b859b['addMessage'](_0x43bdc0[_0x79ad('0x3c')][_0x79ad('0x40')],_[_0x79ad('0x41')](_0x43bdc0[_0x79ad('0x3c')],[_0x79ad('0x40'),'id'])||{});}})['then'](respondWithResult(_0x29dc39,null))[_0x79ad('0x3a')](handleError(_0x29dc39,null));};exports[_0x79ad('0x42')]=function(_0x57f2da,_0x342877){var _0x1a8962={'raw':![],'where':{}};var _0x5ba179={};var _0x518b7a={'count':0x0,'rows':[]};return db[_0x79ad('0x23')]['findOne']({'where':{'id':_0x57f2da[_0x79ad('0x2e')]['id']}})[_0x79ad('0x1b')](handleEntityNotFound(_0x342877,null))[_0x79ad('0x1b')](function(_0x2e41b2){if(_0x2e41b2){_0x5ba179['model']=_[_0x79ad('0x2f')](db[_0x79ad('0x3f')][_0x79ad('0x24')]);_0x5ba179['query']=_[_0x79ad('0x2f')](_0x57f2da[_0x79ad('0x2b')]);_0x5ba179[_0x79ad('0x30')]=_[_0x79ad('0x31')](_0x5ba179[_0x79ad('0x32')],_0x5ba179[_0x79ad('0x2b')]);_0x1a8962[_0x79ad('0x33')]=_[_0x79ad('0x31')](_0x5ba179[_0x79ad('0x32')],qs[_0x79ad('0x34')](_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x34')]));_0x1a8962[_0x79ad('0x33')]=_0x1a8962[_0x79ad('0x33')][_0x79ad('0x35')]?_0x1a8962[_0x79ad('0x33')]:_0x5ba179['model'];if(!_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x43')](_0x79ad('0x44'))){_0x1a8962['limit']=qs[_0x79ad('0x18')](_0x57f2da[_0x79ad('0x2b')]['limit']);_0x1a8962[_0x79ad('0x16')]=qs[_0x79ad('0x16')](_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x16')]);}_0x1a8962[_0x79ad('0x45')]=qs[_0x79ad('0x46')](_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x46')]);_0x1a8962[_0x79ad('0x47')]=qs[_0x79ad('0x30')](_[_0x79ad('0x48')](_0x57f2da[_0x79ad('0x2b')],_0x5ba179['filters']));_0x1a8962['where'][_0x79ad('0x49')]=_0x2e41b2['id'];if(_0x57f2da[_0x79ad('0x2b')]['filter']){_0x1a8962['where']=_[_0x79ad('0x37')](_0x1a8962['where'],{'$or':_[_0x79ad('0x22')](_0x1a8962[_0x79ad('0x33')],function(_0x59e048){var _0x308d86={};_0x308d86[_0x59e048]={'$like':'%'+_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x4a')]+'%'};return _0x308d86;})});}if(_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x4b')]){var _0x4df99c=_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x4b')][_0x79ad('0x4c')](',');var _0x41bfdc={};_0x41bfdc[_0x4df99c[0x0]]={'$gte':moment(_0x4df99c[0x1])[_0x79ad('0x4d')](_0x79ad('0x4e'))};_0x1a8962[_0x79ad('0x47')]=_[_0x79ad('0x37')](_0x1a8962[_0x79ad('0x47')],_0x41bfdc);}_0x1a8962=_[_0x79ad('0x37')]({},_0x1a8962,_0x57f2da[_0x79ad('0x38')]);return db[_0x79ad('0x3f')][_0x79ad('0x19')]({'where':_0x1a8962[_0x79ad('0x47')]})[_0x79ad('0x1b')](function(_0x3e083a){_0x518b7a['count']=_0x3e083a;if(_0x57f2da[_0x79ad('0x2b')][_0x79ad('0x4f')]){_0x1a8962['include']=[{'all':!![]}];}return db[_0x79ad('0x3f')][_0x79ad('0x29')](_0x1a8962);})['then'](function(_0x10cbb9){if(_0x57f2da['query'][_0x79ad('0x50')]===_0x79ad('0x51')){for(var _0x2fb652=0x0;_0x2fb652<_0x10cbb9[_0x79ad('0x35')];_0x2fb652++){_0x10cbb9[_0x2fb652][_0x79ad('0x3c')]=juice(_0x10cbb9[_0x2fb652][_0x79ad('0x3c')]);}}_0x518b7a[_0x79ad('0x52')]=_0x10cbb9;return _0x518b7a;});}})[_0x79ad('0x1b')](respondWithFilteredResult(_0x342877,_0x1a8962))[_0x79ad('0x3a')](handleError(_0x342877,null));};exports[_0x79ad('0x53')]=function(_0x590366,_0x2d9f37){return db[_0x79ad('0x23')][_0x79ad('0x39')]({'where':{'id':_0x590366[_0x79ad('0x2e')]['id']}})[_0x79ad('0x1b')](handleEntityNotFound(_0x2d9f37,null))[_0x79ad('0x1b')](function(_0x50c6d3){if(_0x50c6d3){return _0x50c6d3[_0x79ad('0x54')](_0x590366['body'][_0x79ad('0x40')],_[_0x79ad('0x41')](_0x590366['body'],['ids','id'])||{})[_0x79ad('0x55')](function(){return db[_0x79ad('0x56')]['findAll']({'attributes':['id',_0x79ad('0x1f'),_0x79ad('0x57')],'where':{'id':_0x590366['body'][_0x79ad('0x40')]}});})[_0x79ad('0x1b')](function(_0x534091){socket[_0x79ad('0x58')](_0x79ad('0x59'),{'id':Number(_0x590366[_0x79ad('0x2e')]['id']),'tags':_0x534091||[]});return{'id':Number(_0x590366[_0x79ad('0x2e')]['id']),'tags':_0x534091||[]};});}})['then'](respondWithResult(_0x2d9f37,null))[_0x79ad('0x3a')](handleError(_0x2d9f37,null));};exports[_0x79ad('0x5a')]=function(_0x5e5a3e,_0x3d6896){return db['MailInteraction'][_0x79ad('0x39')]({'where':{'id':_0x5e5a3e[_0x79ad('0x2e')]['id']}})[_0x79ad('0x1b')](handleEntityNotFound(_0x3d6896,null))[_0x79ad('0x1b')](function(_0x5a98ed){if(_0x5a98ed){return _0x5a98ed[_0x79ad('0x5a')](_0x5e5a3e[_0x79ad('0x2b')][_0x79ad('0x40')]);}})[_0x79ad('0x1b')](respondWithStatusCode(_0x3d6896,null))[_0x79ad('0x3a')](handleError(_0x3d6896,null));};exports['download']=function(_0x209974,_0xf791a6){var _0x2d0607=moment()['unix']()[_0x79ad('0x5b')]();var _0x5e0820=path['join'](config[_0x79ad('0x5c')],'server',_0x79ad('0x5d'),_0x79ad('0x5e'));var _0xaecc00=path[_0x79ad('0x5f')](config['root'],_0x79ad('0x60'),_0x79ad('0x5d'),_0x79ad('0x61'));var _0x5ad0e4=path[_0x79ad('0x5f')](_0x5e0820,_0x2d0607);var _0x1424cc=util['format'](_0x79ad('0x62'),_0x209974[_0x79ad('0x2e')]['id'],_0x2d0607);var _0x1f5601=path['join'](_0x5e0820,_0x1424cc);var _0x29a928=[];if(_0x209974[_0x79ad('0x2b')][_0x79ad('0x61')]){_0x29a928[_0x79ad('0x63')]({'model':db['Attachment'],'as':_0x79ad('0x64'),'raw':!![]});}var _0x386369=[{'model':db[_0x79ad('0x3f')],'as':'Messages','attributes':['id',_0x79ad('0x3c'),_0x79ad('0x65'),'to','cc',_0x79ad('0x66'),_0x79ad('0x67'),_0x79ad('0x68')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x29a928}];return db[_0x79ad('0x23')]['find']({'where':{'id':_0x209974[_0x79ad('0x2e')]['id']},'include':_0x386369})['then'](handleEntityNotFound(_0xf791a6,null))[_0x79ad('0x1b')](function(_0x558205){if(_0x558205&&_0x558205['Messages']){var _0x2f7d97=_0x558205[_0x79ad('0x69')]({'plain':!![]});fs['mkdirSync'](_0x5ad0e4);return BPromise['each'](_0x2f7d97['Messages'],function(_0x115705,_0x4b28d0){var _0x23269f={'from':_0x115705['from'],'to':_0x115705['to']||_0x79ad('0x6a'),'subject':_0x115705['subject'],'html':htmlEntities['decode'](_0x115705['body']),'headers':{'Date':moment(_0x115705[_0x79ad('0x68')])[_0x79ad('0x4d')](_0x79ad('0x6b'))},'attachments':[]};if(_0x115705['cc']){_0x23269f[_0x79ad('0x6c')]['Cc']=_0x115705['cc'];}if(_0x115705[_0x79ad('0x66')]){_0x23269f[_0x79ad('0x6c')][_0x79ad('0x6d')]=_0x115705[_0x79ad('0x66')];}return new BPromise(function(_0x57330b,_0x18caa3){if(_0x115705['Attachments']){for(var _0x1c6455=0x0;_0x1c6455<_0x115705[_0x79ad('0x64')][_0x79ad('0x35')];_0x1c6455++){var _0x3dc440=_0x115705[_0x79ad('0x64')][_0x1c6455];var _0xdaba2c=path[_0x79ad('0x5f')](_0xaecc00,_0x3dc440['basename']);if(fs[_0x79ad('0x6e')](_0xdaba2c)){_0x23269f[_0x79ad('0x61')][_0x79ad('0x63')]({'name':_0x3dc440[_0x79ad('0x1f')],'contentType':_0x3dc440[_0x79ad('0x26')],'data':fs[_0x79ad('0x6f')](_0xdaba2c)});}}}emlformat[_0x79ad('0x70')](_0x23269f,function(_0x2755f4,_0x49ab97){if(_0x2755f4)return _0x18caa3(_0x2755f4);fs[_0x79ad('0x71')](path[_0x79ad('0x5f')](_0x5ad0e4,util[_0x79ad('0x4d')](_0x79ad('0x72'),_0x4b28d0)),_0x49ab97);return _0x57330b(_0x49ab97);});});})[_0x79ad('0x1b')](function(){return new BPromise(function(_0x3eb91,_0x32ba15){zipdir(_0x5ad0e4,{'saveTo':_0x1f5601},function(_0x4cd16b,_0xf85c18){if(_0x4cd16b)return _0x32ba15(_0x4cd16b);return _0x3eb91(_0xf85c18);});})['then'](function(){return new BPromise(function(_0x82bfd0,_0x5a21fb){rimraf(_0x5ad0e4,function(_0x22d943){if(_0x22d943)_0x5a21fb(_0x22d943);return _0x82bfd0();});});})[_0x79ad('0x1b')](function(){return _0xf791a6[_0x79ad('0x73')](_0x1f5601,_0x1424cc,function(_0x320c58){if(!_0x320c58)fs[_0x79ad('0x74')](_0x1f5601);});});});}else{return _0xf791a6['sendStatus'](0xc8);}})[_0x79ad('0x3a')](handleError(_0xf791a6,null));};
\ No newline at end of file
+var _0xc982=['addMessage','ids','omit','getMessages','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','true','rows','setTags','spread','color','emit','mailInteractionTags:save','removeTags','download','toString','join','server','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','get','each','missing.recipient@your.company.com','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','fieldName','type','key','getOptions','findAll','mail','query','user','show','params','model','keys','MailInteraction','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','catch','MailMessage'];(function(_0x3e2116,_0x58c921){var _0x4e2952=function(_0x380424){while(--_0x380424){_0x3e2116['push'](_0x3e2116['shift']());}};_0x4e2952(++_0x58c921);}(_0xc982,0x180));var _0x2c98=function(_0xf8bd98,_0x722df){_0xf8bd98=_0xf8bd98-0x0;var _0x34e8af=_0xc982[_0xf8bd98];return _0x34e8af;};'use strict';var emlformat=require(_0x2c98('0x0'));var rimraf=require(_0x2c98('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2c98('0x2'));var BPromise=require(_0x2c98('0x3'));var util=require(_0x2c98('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x2c98('0x5'));var juice=require(_0x2c98('0x6'));var Redis=require('ioredis');var interaction=require(_0x2c98('0x7'));var qs=require(_0x2c98('0x8'));var logger=require(_0x2c98('0x9'))(_0x2c98('0xa'));var config=require(_0x2c98('0xb'));var db=require(_0x2c98('0xc'))['db'];var htmlEntities=require(_0x2c98('0xd'));config['redis']=_['defaults'](config[_0x2c98('0xe')],{'host':_0x2c98('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c98('0xe')]));require(_0x2c98('0x10'))[_0x2c98('0x11')](socket);function respondWithStatusCode(_0x50aa3c,_0x59fce5){_0x59fce5=_0x59fce5||0xcc;return function(_0x3ec064){if(_0x3ec064){return _0x50aa3c['sendStatus'](_0x59fce5);}return _0x50aa3c['status'](_0x59fce5)[_0x2c98('0x12')]();};}function respondWithResult(_0x424af1,_0x56a300){_0x56a300=_0x56a300||0xc8;return function(_0x52c83e){if(_0x52c83e){return _0x424af1[_0x2c98('0x13')](_0x56a300)[_0x2c98('0x14')](_0x52c83e);}};}function respondWithFilteredResult(_0x35cb5e,_0x18e462){return function(_0x576fae){if(_0x576fae){var _0x1b9cb9=typeof _0x18e462[_0x2c98('0x15')]===_0x2c98('0x16')&&typeof _0x18e462['limit']===_0x2c98('0x16');var _0x16908f=_0x576fae[_0x2c98('0x17')];var _0x14898d=_0x1b9cb9?0x0:_0x18e462[_0x2c98('0x15')];var _0x53b901=_0x1b9cb9?_0x576fae[_0x2c98('0x17')]:_0x18e462[_0x2c98('0x15')]+_0x18e462[_0x2c98('0x18')];var _0x3f3d06;if(_0x53b901>=_0x16908f){_0x53b901=_0x16908f;_0x3f3d06=0xc8;}else{_0x3f3d06=0xce;}_0x35cb5e[_0x2c98('0x13')](_0x3f3d06);return _0x35cb5e[_0x2c98('0x19')](_0x2c98('0x1a'),_0x14898d+'-'+_0x53b901+'/'+_0x16908f)[_0x2c98('0x14')](_0x576fae);}return null;};}function saveUpdates(_0x48b2f0){return function(_0xfc23a){if(_0xfc23a){return _0xfc23a[_0x2c98('0x1b')](_0x48b2f0)['then'](function(_0x396556){return _0x396556;});}return null;};}function removeEntity(_0x2a0bcc){return function(_0xe33696){if(_0xe33696){return _0xe33696['destroy']()[_0x2c98('0x1c')](function(){_0x2a0bcc[_0x2c98('0x13')](0xcc)[_0x2c98('0x12')]();});}};}function handleEntityNotFound(_0x3bd13f){return function(_0xc9f58a){if(!_0xc9f58a){_0x3bd13f[_0x2c98('0x1d')](0x194);}return _0xc9f58a;};}function handleError(_0x3ef8fe,_0x3d5fbf){_0x3d5fbf=_0x3d5fbf||0x1f4;return function(_0x3555bb){logger[_0x2c98('0x1e')](_0x3555bb[_0x2c98('0x1f')]);if(_0x3555bb[_0x2c98('0x20')]){delete _0x3555bb[_0x2c98('0x20')];}_0x3ef8fe[_0x2c98('0x13')](_0x3d5fbf)[_0x2c98('0x21')](_0x3555bb);};}exports['index']=function(_0x5f247d,_0x200751){var _0x723332={};var _0x4ffae4=_['map'](db['MailInteraction']['rawAttributes'],function(_0x2e7ae9){return{'name':_0x2e7ae9[_0x2c98('0x22')],'type':_0x2e7ae9[_0x2c98('0x23')][_0x2c98('0x24')]};});_0x723332=qs[_0x2c98('0x25')](_0x4ffae4,_0x5f247d);return interaction[_0x2c98('0x26')](_0x2c98('0x27'),_0x5f247d[_0x2c98('0x28')],_0x5f247d[_0x2c98('0x29')],_0x723332,_0x4ffae4)[_0x2c98('0x1c')](respondWithFilteredResult(_0x200751,_0x723332))['catch'](handleError(_0x200751,null));};exports[_0x2c98('0x2a')]=function(_0x182df0,_0x79ec02){var _0x1663ed={'raw':![],'where':{'id':_0x182df0[_0x2c98('0x2b')]['id']}},_0x20f211={};_0x20f211[_0x2c98('0x2c')]=_[_0x2c98('0x2d')](db[_0x2c98('0x2e')]['rawAttributes']);_0x20f211['query']=_['keys'](_0x182df0[_0x2c98('0x28')]);_0x20f211[_0x2c98('0x2f')]=_[_0x2c98('0x30')](_0x20f211[_0x2c98('0x2c')],_0x20f211['query']);_0x1663ed[_0x2c98('0x31')]=_[_0x2c98('0x30')](_0x20f211['model'],qs[_0x2c98('0x32')](_0x182df0[_0x2c98('0x28')]['fields']));_0x1663ed['attributes']=_0x1663ed[_0x2c98('0x31')][_0x2c98('0x33')]?_0x1663ed[_0x2c98('0x31')]:_0x20f211[_0x2c98('0x2c')];if(_0x182df0['query'][_0x2c98('0x34')]){_0x1663ed['include']=[{'all':!![]}];}_0x1663ed=_[_0x2c98('0x35')]({},_0x1663ed,_0x182df0[_0x2c98('0x36')]);return db[_0x2c98('0x2e')][_0x2c98('0x37')](_0x1663ed)[_0x2c98('0x1c')](handleEntityNotFound(_0x79ec02,null))[_0x2c98('0x1c')](respondWithResult(_0x79ec02,null))['catch'](handleError(_0x79ec02,null));};exports[_0x2c98('0x38')]=function(_0x1a6959,_0x310aef){return db[_0x2c98('0x2e')]['create'](_0x1a6959[_0x2c98('0x39')],{})[_0x2c98('0x1c')](respondWithResult(_0x310aef,0xc9))[_0x2c98('0x3a')](handleError(_0x310aef,null));};exports[_0x2c98('0x1b')]=function(_0x4ee2bf,_0x369873){if(_0x4ee2bf['body']['id']){delete _0x4ee2bf[_0x2c98('0x39')]['id'];}return db[_0x2c98('0x2e')][_0x2c98('0x37')]({'where':{'id':_0x4ee2bf[_0x2c98('0x2b')]['id']}})['then'](handleEntityNotFound(_0x369873,null))[_0x2c98('0x1c')](saveUpdates(_0x4ee2bf['body'],null))['then'](respondWithResult(_0x369873,null))[_0x2c98('0x3a')](handleError(_0x369873,null));};exports['destroy']=function(_0x4b5463,_0x48f8d8){return db['MailInteraction'][_0x2c98('0x37')]({'where':{'id':_0x4b5463[_0x2c98('0x2b')]['id']}})['then'](handleEntityNotFound(_0x48f8d8,null))[_0x2c98('0x1c')](removeEntity(_0x48f8d8,null))[_0x2c98('0x3a')](handleError(_0x48f8d8,null));};exports['describe']=function(_0x1c5cf1,_0x396409){return db['MailInteraction']['describe']()[_0x2c98('0x1c')](respondWithResult(_0x396409,null))['catch'](handleError(_0x396409,null));};exports['addMessage']=function(_0x5aaba2,_0x3f3347){return db[_0x2c98('0x3b')][_0x2c98('0x37')]({'where':{'id':_0x5aaba2[_0x2c98('0x2b')]['id']}})[_0x2c98('0x1c')](handleEntityNotFound(_0x3f3347,null))[_0x2c98('0x1c')](function(_0x170dc1){if(_0x170dc1){return _0x170dc1[_0x2c98('0x3c')](_0x5aaba2[_0x2c98('0x39')][_0x2c98('0x3d')],_[_0x2c98('0x3e')](_0x5aaba2[_0x2c98('0x39')],[_0x2c98('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x3f3347,null))[_0x2c98('0x3a')](handleError(_0x3f3347,null));};exports[_0x2c98('0x3f')]=function(_0x39b04b,_0xc239c5){var _0x5cb3fc={'raw':![],'where':{}};var _0x2c8d1f={};var _0x1e5cce={'count':0x0,'rows':[]};return db[_0x2c98('0x2e')]['findOne']({'where':{'id':_0x39b04b[_0x2c98('0x2b')]['id']}})[_0x2c98('0x1c')](handleEntityNotFound(_0xc239c5,null))['then'](function(_0xe2f20c){if(_0xe2f20c){_0x2c8d1f[_0x2c98('0x2c')]=_['keys'](db[_0x2c98('0x3b')][_0x2c98('0x40')]);_0x2c8d1f[_0x2c98('0x28')]=_[_0x2c98('0x2d')](_0x39b04b['query']);_0x2c8d1f[_0x2c98('0x2f')]=_[_0x2c98('0x30')](_0x2c8d1f[_0x2c98('0x2c')],_0x2c8d1f[_0x2c98('0x28')]);_0x5cb3fc[_0x2c98('0x31')]=_[_0x2c98('0x30')](_0x2c8d1f[_0x2c98('0x2c')],qs[_0x2c98('0x32')](_0x39b04b[_0x2c98('0x28')][_0x2c98('0x32')]));_0x5cb3fc[_0x2c98('0x31')]=_0x5cb3fc[_0x2c98('0x31')][_0x2c98('0x33')]?_0x5cb3fc['attributes']:_0x2c8d1f['model'];if(!_0x39b04b[_0x2c98('0x28')][_0x2c98('0x41')](_0x2c98('0x42'))){_0x5cb3fc[_0x2c98('0x18')]=qs[_0x2c98('0x18')](_0x39b04b['query'][_0x2c98('0x18')]);_0x5cb3fc[_0x2c98('0x15')]=qs[_0x2c98('0x15')](_0x39b04b['query']['offset']);}_0x5cb3fc[_0x2c98('0x43')]=qs[_0x2c98('0x44')](_0x39b04b[_0x2c98('0x28')][_0x2c98('0x44')]);_0x5cb3fc['where']=qs[_0x2c98('0x2f')](_[_0x2c98('0x45')](_0x39b04b[_0x2c98('0x28')],_0x2c8d1f[_0x2c98('0x2f')]));_0x5cb3fc['where']['MailInteractionId']=_0xe2f20c['id'];if(_0x39b04b['query']['filter']){_0x5cb3fc[_0x2c98('0x46')]=_[_0x2c98('0x35')](_0x5cb3fc[_0x2c98('0x46')],{'$or':_[_0x2c98('0x47')](_0x5cb3fc[_0x2c98('0x31')],function(_0x56686e){var _0x5f53b2={};_0x5f53b2[_0x56686e]={'$like':'%'+_0x39b04b[_0x2c98('0x28')][_0x2c98('0x48')]+'%'};return _0x5f53b2;})});}if(_0x39b04b[_0x2c98('0x28')]['$gte']){var _0x51bb56=_0x39b04b[_0x2c98('0x28')][_0x2c98('0x49')][_0x2c98('0x4a')](',');var _0x55fb8a={};_0x55fb8a[_0x51bb56[0x0]]={'$gte':moment(_0x51bb56[0x1])[_0x2c98('0x4b')](_0x2c98('0x4c'))};_0x5cb3fc['where']=_['merge'](_0x5cb3fc['where'],_0x55fb8a);}_0x5cb3fc=_[_0x2c98('0x35')]({},_0x5cb3fc,_0x39b04b[_0x2c98('0x36')]);return db[_0x2c98('0x3b')][_0x2c98('0x17')]({'where':_0x5cb3fc['where']})[_0x2c98('0x1c')](function(_0x3f5820){_0x1e5cce[_0x2c98('0x17')]=_0x3f5820;if(_0x39b04b[_0x2c98('0x28')][_0x2c98('0x34')]){_0x5cb3fc[_0x2c98('0x4d')]=[{'all':!![]}];}return db[_0x2c98('0x3b')][_0x2c98('0x26')](_0x5cb3fc);})[_0x2c98('0x1c')](function(_0x1c3273){if(_0x39b04b[_0x2c98('0x28')]['inlineCss']===_0x2c98('0x4e')){for(var _0x394693=0x0;_0x394693<_0x1c3273[_0x2c98('0x33')];_0x394693++){_0x1c3273[_0x394693][_0x2c98('0x39')]=juice(_0x1c3273[_0x394693][_0x2c98('0x39')]);}}_0x1e5cce[_0x2c98('0x4f')]=_0x1c3273;return _0x1e5cce;});}})[_0x2c98('0x1c')](respondWithFilteredResult(_0xc239c5,_0x5cb3fc))['catch'](handleError(_0xc239c5,null));};exports['addTags']=function(_0x152356,_0x1fcab2){return db[_0x2c98('0x2e')]['find']({'where':{'id':_0x152356[_0x2c98('0x2b')]['id']}})[_0x2c98('0x1c')](handleEntityNotFound(_0x1fcab2,null))[_0x2c98('0x1c')](function(_0x182c55){if(_0x182c55){return _0x182c55[_0x2c98('0x50')](_0x152356[_0x2c98('0x39')][_0x2c98('0x3d')],_[_0x2c98('0x3e')](_0x152356['body'],[_0x2c98('0x3d'),'id'])||{})[_0x2c98('0x51')](function(){return db['Tag'][_0x2c98('0x26')]({'attributes':['id',_0x2c98('0x20'),_0x2c98('0x52')],'where':{'id':_0x152356['body'][_0x2c98('0x3d')]}});})[_0x2c98('0x1c')](function(_0x5be482){socket[_0x2c98('0x53')](_0x2c98('0x54'),{'id':Number(_0x152356['params']['id']),'tags':_0x5be482||[]});return{'id':Number(_0x152356['params']['id']),'tags':_0x5be482||[]};});}})[_0x2c98('0x1c')](respondWithResult(_0x1fcab2,null))[_0x2c98('0x3a')](handleError(_0x1fcab2,null));};exports[_0x2c98('0x55')]=function(_0x324788,_0x3b0fd5){return db[_0x2c98('0x2e')][_0x2c98('0x37')]({'where':{'id':_0x324788[_0x2c98('0x2b')]['id']}})[_0x2c98('0x1c')](handleEntityNotFound(_0x3b0fd5,null))['then'](function(_0xa188c9){if(_0xa188c9){return _0xa188c9['removeTags'](_0x324788[_0x2c98('0x28')][_0x2c98('0x3d')]);}})[_0x2c98('0x1c')](respondWithStatusCode(_0x3b0fd5,null))[_0x2c98('0x3a')](handleError(_0x3b0fd5,null));};exports[_0x2c98('0x56')]=function(_0x594d33,_0x3feca4){var _0x5c6073=moment()['unix']()[_0x2c98('0x57')]();var _0x2cd1b6=path[_0x2c98('0x58')](config['root'],_0x2c98('0x59'),'files','tmp');var _0x563325=path[_0x2c98('0x58')](config[_0x2c98('0x5a')],_0x2c98('0x59'),'files',_0x2c98('0x5b'));var _0x6186cb=path[_0x2c98('0x58')](_0x2cd1b6,_0x5c6073);var _0x3f85e2=util[_0x2c98('0x4b')](_0x2c98('0x5c'),_0x594d33['params']['id'],_0x5c6073);var _0x48f4a6=path['join'](_0x2cd1b6,_0x3f85e2);var _0x1f9328=[];if(_0x594d33[_0x2c98('0x28')][_0x2c98('0x5b')]){_0x1f9328['push']({'model':db[_0x2c98('0x5d')],'as':_0x2c98('0x5e'),'raw':!![]});}var _0x586147=[{'model':db[_0x2c98('0x3b')],'as':_0x2c98('0x5f'),'attributes':['id',_0x2c98('0x39'),_0x2c98('0x60'),'to','cc',_0x2c98('0x61'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x2c98('0x44')]('id'),'include':_0x1f9328}];return db[_0x2c98('0x2e')][_0x2c98('0x37')]({'where':{'id':_0x594d33[_0x2c98('0x2b')]['id']},'include':_0x586147})[_0x2c98('0x1c')](handleEntityNotFound(_0x3feca4,null))[_0x2c98('0x1c')](function(_0x3f1d47){if(_0x3f1d47&&_0x3f1d47['Messages']){var _0x43ff41=_0x3f1d47[_0x2c98('0x62')]({'plain':!![]});fs['mkdirSync'](_0x6186cb);return BPromise[_0x2c98('0x63')](_0x43ff41[_0x2c98('0x5f')],function(_0x377850,_0x31c3d6){var _0x4124a3={'from':_0x377850[_0x2c98('0x60')],'to':_0x377850['to']||_0x2c98('0x64'),'subject':_0x377850[_0x2c98('0x65')],'html':htmlEntities[_0x2c98('0x66')](_0x377850[_0x2c98('0x39')]),'headers':{'Date':moment(_0x377850[_0x2c98('0x67')])[_0x2c98('0x4b')](_0x2c98('0x68'))},'attachments':[]};if(_0x377850['cc']){_0x4124a3[_0x2c98('0x69')]['Cc']=_0x377850['cc'];}if(_0x377850[_0x2c98('0x61')]){_0x4124a3[_0x2c98('0x69')]['Bcc']=_0x377850['bcc'];}return new BPromise(function(_0x7a268b,_0x48bb71){if(_0x377850[_0x2c98('0x5e')]){for(var _0x22e8b1=0x0;_0x22e8b1<_0x377850[_0x2c98('0x5e')]['length'];_0x22e8b1++){var _0x120369=_0x377850['Attachments'][_0x22e8b1];var _0x408bbf=path[_0x2c98('0x58')](_0x563325,_0x120369['basename']);if(fs['existsSync'](_0x408bbf)){_0x4124a3[_0x2c98('0x5b')][_0x2c98('0x6a')]({'name':_0x120369['name'],'contentType':_0x120369[_0x2c98('0x23')],'data':fs[_0x2c98('0x6b')](_0x408bbf)});}}}emlformat[_0x2c98('0x6c')](_0x4124a3,function(_0x15f40f,_0x2f547e){if(_0x15f40f)return _0x48bb71(_0x15f40f);fs['writeFileSync'](path[_0x2c98('0x58')](_0x6186cb,util[_0x2c98('0x4b')](_0x2c98('0x6d'),_0x31c3d6)),_0x2f547e);return _0x7a268b(_0x2f547e);});});})[_0x2c98('0x1c')](function(){return new BPromise(function(_0x108f04,_0x2e22db){zipdir(_0x6186cb,{'saveTo':_0x48f4a6},function(_0x23ddfe,_0x1a88d2){if(_0x23ddfe)return _0x2e22db(_0x23ddfe);return _0x108f04(_0x1a88d2);});})[_0x2c98('0x1c')](function(){return new BPromise(function(_0x51566a,_0x562749){rimraf(_0x6186cb,function(_0x25ef36){if(_0x25ef36)_0x562749(_0x25ef36);return _0x51566a();});});})[_0x2c98('0x1c')](function(){return _0x3feca4['download'](_0x48f4a6,_0x3f85e2,function(_0x54dcac){if(!_0x54dcac)fs[_0x2c98('0x6e')](_0x48f4a6);});});});}else{return _0x3feca4[_0x2c98('0x1d')](0xc8);}})[_0x2c98('0x3a')](handleError(_0x3feca4,null));};
\ No newline at end of file
index a2d6463..bbb660f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3fb=['catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x5645fa,_0x29d4c3){var _0x43b6f5=function(_0x177741){while(--_0x177741){_0x5645fa['push'](_0x5645fa['shift']());}};_0x43b6f5(++_0x29d4c3);}(_0xe3fb,0x9c));var _0xbe3f=function(_0x150cc4,_0x15e9f1){_0x150cc4=_0x150cc4-0x0;var _0x22a995=_0xe3fb[_0x150cc4];return _0x22a995;};'use strict';var EventEmitter=require(_0xbe3f('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbe3f('0x1')];var MailMessage=require(_0xbe3f('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbe3f('0x3')](0x0);var events={'afterCreate':_0xbe3f('0x4'),'afterUpdate':_0xbe3f('0x5'),'afterDestroy':_0xbe3f('0x6')};function emitEvent(_0x1269a1){return function(_0x47cf20,_0x1be8b7,_0x331574){_0x47cf20[_0xbe3f('0x7')]({'attributes':['id'],'raw':!![]})[_0xbe3f('0x8')](function(_0x457ba2){_0x47cf20[_0xbe3f('0x9')](_0xbe3f('0xa'),_0x457ba2[_0xbe3f('0xb')](function(_0x149b01){return{'id':_0x149b01['id']};}));return MailMessage[_0xbe3f('0xc')]({'where':{'MailInteractionId':_0x47cf20['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe3f('0x8')](function(_0x110510){_0x47cf20['setDataValue']('unreadMessages',_0x110510[_0xbe3f('0xd')]);MailInteractionEvents['emit'](_0x1269a1+':'+_0x47cf20['id'],_0x47cf20);MailInteractionEvents[_0xbe3f('0xe')](_0x1269a1,_0x47cf20);_0x331574(null);})[_0xbe3f('0xf')](_0x331574(null));};}for(var e in events){if(events[_0xbe3f('0x10')](e)){var event=events[e];MailInteraction[_0xbe3f('0x11')](e,emitEvent(event));}}module[_0xbe3f('0x12')]=MailInteractionEvents;
\ No newline at end of file
+var _0x0031=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x589836,_0xb55c8f){var _0x4da440=function(_0xc1b430){while(--_0xc1b430){_0x589836['push'](_0x589836['shift']());}};_0x4da440(++_0xb55c8f);}(_0x0031,0x198));var _0x1003=function(_0x2b6e30,_0x1d6692){_0x2b6e30=_0x2b6e30-0x0;var _0x8b4af1=_0x0031[_0x2b6e30];return _0x8b4af1;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x1003('0x0'))['db'][_0x1003('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x1003('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1003('0x3')](0x0);var events={'afterCreate':_0x1003('0x4'),'afterUpdate':_0x1003('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f1ddc){return function(_0x40aad1,_0x544730,_0x4f7df4){_0x40aad1[_0x1003('0x6')]({'attributes':['id'],'raw':!![]})[_0x1003('0x7')](function(_0x135223){_0x40aad1[_0x1003('0x8')](_0x1003('0x9'),_0x135223['map'](function(_0x563d50){return{'id':_0x563d50['id']};}));return MailMessage[_0x1003('0xa')]({'where':{'MailInteractionId':_0x40aad1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1003('0x7')](function(_0x23dd12){_0x40aad1['setDataValue'](_0x1003('0xb'),_0x23dd12[_0x1003('0xc')]);MailInteractionEvents['emit'](_0x3f1ddc+':'+_0x40aad1['id'],_0x40aad1);MailInteractionEvents[_0x1003('0xd')](_0x3f1ddc,_0x40aad1);_0x4f7df4(null);})['catch'](_0x4f7df4(null));};}for(var e in events){if(events[_0x1003('0xe')](e)){var event=events[e];MailInteraction[_0x1003('0xf')](e,emitEvent(event));}}module[_0x1003('0x10')]=MailInteractionEvents;
\ No newline at end of file
index cfe44ca..5d525b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb84=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','models','update','then','catch'];(function(_0x53aa19,_0x160986){var _0x3dad7d=function(_0x1a6db5){while(--_0x1a6db5){_0x53aa19['push'](_0x53aa19['shift']());}};_0x3dad7d(++_0x160986);}(_0xcb84,0x199));var _0x4cb8=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xcb84[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0x4cb8('0x0'));var util=require(_0x4cb8('0x1'));var logger=require('../../config/logger')(_0x4cb8('0x2'));var moment=require(_0x4cb8('0x3'));var BPromise=require(_0x4cb8('0x4'));var rp=require(_0x4cb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cb8('0x6'));var config=require('../../config/environment');var attributes=require(_0x4cb8('0x7'));module[_0x4cb8('0x8')]=function(_0x44ef14,_0x1488a6){return _0x44ef14[_0x4cb8('0x9')](_0x4cb8('0xa'),attributes,{'tableName':_0x4cb8('0xb'),'paranoid':![],'indexes':[{'name':_0x4cb8('0xc'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x160029,_0x34e8f3,_0x2f3abe){if(_0x160029[_0x4cb8('0xd')]){_0x160029[_0x4cb8('0xe')]=moment()['format'](_0x4cb8('0xf'));}if(_0x160029[_0x4cb8('0x10')]){_0x160029[_0x4cb8('0x11')]=moment()[_0x4cb8('0x12')](_0x4cb8('0xf'));}_0x2f3abe(null,_0x34e8f3);},'beforeUpdate':function(_0x29a37c,_0x2fac8a,_0x4e9f93){if(_0x29a37c['changed'](_0x4cb8('0xd'))){_0x29a37c[_0x4cb8('0xe')]=_0x29a37c[_0x4cb8('0xd')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x29a37c['changed']('closed')){_0x29a37c[_0x4cb8('0x11')]=moment()['format'](_0x4cb8('0xf'));_0x29a37c['substatus']=null;_0x29a37c[_0x4cb8('0xe')]=null;}_0x4e9f93(null,_0x29a37c);},'afterUpdate':function(_0x97984b,_0x180bb8,_0x595d67){var _0x6f3c3b=_0x44ef14[_0x4cb8('0x13')];var _0x1e142d=_0x97984b['get']({'plain':!![]});if(_0x1e142d[_0x4cb8('0x10')]){return _0x6f3c3b['MailMessage'][_0x4cb8('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x1e142d['id']}})[_0x4cb8('0x15')](function(){_0x595d67();})[_0x4cb8('0x16')](function(_0xce30fa){_0x595d67(_0xce30fa);});}else{_0x595d67();}}},'charset':'utf8mb4','collate':_0x4cb8('0x17')});};
\ No newline at end of file
+var _0x7684=['fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','MailMessage','then','catch','utf8mb4','util','../../config/logger','api','moment','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions'];(function(_0x5e3480,_0x350fa5){var _0x10452e=function(_0x2dd2a9){while(--_0x2dd2a9){_0x5e3480['push'](_0x5e3480['shift']());}};_0x10452e(++_0x350fa5);}(_0x7684,0x139));var _0x4768=function(_0x2b157c,_0x5cf335){_0x2b157c=_0x2b157c-0x0;var _0x2d8d43=_0x7684[_0x2b157c];return _0x2d8d43;};'use strict';var _=require('lodash');var util=require(_0x4768('0x0'));var logger=require(_0x4768('0x1'))(_0x4768('0x2'));var moment=require(_0x4768('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4768('0x4'));var config=require(_0x4768('0x5'));var attributes=require(_0x4768('0x6'));module['exports']=function(_0x4d27da,_0x10aac6){return _0x4d27da['define'](_0x4768('0x7'),attributes,{'tableName':_0x4768('0x8'),'paranoid':![],'indexes':[{'name':_0x4768('0x9'),'fields':[_0x4768('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11fa92,_0x656728,_0x981440){if(_0x11fa92[_0x4768('0xb')]){_0x11fa92['substatusAt']=moment()[_0x4768('0xc')](_0x4768('0xd'));}if(_0x11fa92[_0x4768('0xe')]){_0x11fa92[_0x4768('0xf')]=moment()[_0x4768('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x981440(null,_0x656728);},'beforeUpdate':function(_0x3e1ed0,_0x8c9786,_0x3a698f){if(_0x3e1ed0[_0x4768('0x10')](_0x4768('0xb'))){_0x3e1ed0[_0x4768('0x11')]=_0x3e1ed0[_0x4768('0xb')]?moment()['format'](_0x4768('0xd')):null;}if(_0x3e1ed0[_0x4768('0x10')]('closed')){_0x3e1ed0[_0x4768('0xf')]=moment()[_0x4768('0xc')](_0x4768('0xd'));_0x3e1ed0[_0x4768('0xb')]=null;_0x3e1ed0['substatusAt']=null;}_0x3a698f(null,_0x3e1ed0);},'afterUpdate':function(_0xa146ce,_0x235d4e,_0x300d32){var _0x21081a=_0x4d27da[_0x4768('0x12')];var _0x3e26f1=_0xa146ce['get']({'plain':!![]});if(_0x3e26f1[_0x4768('0xe')]){return _0x21081a[_0x4768('0x13')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3e26f1['id']}})[_0x4768('0x14')](function(){_0x300d32();})[_0x4768('0x15')](function(_0x3102d4){_0x300d32(_0x3102d4);});}else{_0x300d32();}}},'charset':_0x4768('0x16'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index 5b27b22..f2e3376 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc319=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToMailInteraction','MailInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x5d3276,_0xd38063){var _0x3562f5=function(_0x5c5594){while(--_0x5c5594){_0x5d3276['push'](_0x5d3276['shift']());}};_0x3562f5(++_0xd38063);}(_0xc319,0x12e));var _0x9c31=function(_0x64692f,_0x666650){_0x64692f=_0x64692f-0x0;var _0x3c9f4f=_0xc319[_0x64692f];return _0x3c9f4f;};'use strict';var _=require(_0x9c31('0x0'));var util=require(_0x9c31('0x1'));var moment=require(_0x9c31('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c31('0x3'));var fs=require('fs');var Redis=require(_0x9c31('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c31('0x5'));var logger=require(_0x9c31('0x6'))(_0x9c31('0x7'));var config=require(_0x9c31('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9c31('0x9')][_0x9c31('0xa')]({'port':0x232a});config[_0x9c31('0xb')]=_[_0x9c31('0xc')](config[_0x9c31('0xb')],{'host':_0x9c31('0xd'),'port':0x18eb});var socket=require(_0x9c31('0xe'))(new Redis(config[_0x9c31('0xb')]));require(_0x9c31('0xf'))['register'](socket);function respondWithRpcPromise(_0x57a0b3,_0x5de62b,_0x1d8b8b){return new BPromise(function(_0x2c026b,_0x14a649){return client[_0x9c31('0x10')](_0x57a0b3,_0x1d8b8b)[_0x9c31('0x11')](function(_0x5eff74){logger[_0x9c31('0x12')](_0x9c31('0x13'),_0x5de62b,_0x9c31('0x14'));logger['debug'](_0x9c31('0x15'),_0x5de62b,_0x9c31('0x14'),JSON[_0x9c31('0x16')](_0x5eff74));if(_0x5eff74[_0x9c31('0x17')]){if(_0x5eff74[_0x9c31('0x17')]['code']===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5de62b,_0x5eff74['error']['message']);return _0x14a649(_0x5eff74[_0x9c31('0x17')][_0x9c31('0x18')]);}logger['error'](_0x9c31('0x13'),_0x5de62b,_0x5eff74[_0x9c31('0x17')][_0x9c31('0x18')]);return _0x2c026b(_0x5eff74[_0x9c31('0x17')][_0x9c31('0x18')]);}else{logger['info'](_0x9c31('0x13'),_0x5de62b,'request\x20sent');_0x2c026b(_0x5eff74[_0x9c31('0x19')]['message']);}})[_0x9c31('0x1a')](function(_0x54c08a){logger[_0x9c31('0x17')](_0x9c31('0x13'),_0x5de62b,_0x54c08a);_0x14a649(_0x54c08a);});});}exports[_0x9c31('0x1b')]=function(_0x59c053){var _0x1b12d8=this;return new Promise(function(_0x15323e,_0x417360){return db['MailInteraction'][_0x9c31('0x1c')](_0x59c053[_0x9c31('0x1d')],{'raw':_0x59c053['options']?_0x59c053[_0x9c31('0x1e')][_0x9c31('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59c053[_0x9c31('0x1e')]?_0x59c053[_0x9c31('0x1e')]['where']||null:null,'attributes':_0x59c053[_0x9c31('0x1e')]?_0x59c053[_0x9c31('0x1e')][_0x9c31('0x20')]||null:null,'limit':_0x59c053[_0x9c31('0x1e')]?_0x59c053[_0x9c31('0x1e')][_0x9c31('0x21')]||null:null})[_0x9c31('0x11')](function(_0x47f388){logger[_0x9c31('0x12')](_0x9c31('0x1b'),_0x59c053);logger[_0x9c31('0x22')](_0x9c31('0x1b'),_0x59c053,JSON[_0x9c31('0x16')](_0x47f388));_0x15323e(_0x47f388);})[_0x9c31('0x1a')](function(_0x5206c2){logger[_0x9c31('0x17')]('UpdateMailInteraction',_0x5206c2['message'],_0x59c053);_0x417360(_0x1b12d8[_0x9c31('0x17')](0x1f4,_0x5206c2[_0x9c31('0x18')]));});});};exports[_0x9c31('0x23')]=function(_0x3288e0){return new Promise(function(_0x4aab82,_0xa43ac0){return db[_0x9c31('0x24')][_0x9c31('0x25')]({'where':_0x3288e0[_0x9c31('0x1e')]?_0x3288e0[_0x9c31('0x1e')][_0x9c31('0x26')]||null:null})[_0x9c31('0x11')](function(_0x5ae607){if(_0x5ae607){return _0x5ae607[_0x9c31('0x27')](_0x3288e0[_0x9c31('0x1d')][_0x9c31('0x28')],_[_0x9c31('0x29')](_0x3288e0[_0x9c31('0x1d')],[_0x9c31('0x28'),'id'])||{});}})[_0x9c31('0x2a')](function(_0x18e2f3){logger[_0x9c31('0x12')](_0x9c31('0x2b'),_0x3288e0);logger[_0x9c31('0x22')](_0x9c31('0x2b'),_0x3288e0,JSON[_0x9c31('0x16')](_0x18e2f3));_0x4aab82(_0x18e2f3);})['catch'](function(_0x58a7b0){logger[_0x9c31('0x17')](_0x9c31('0x2b'),_0x58a7b0[_0x9c31('0x18')],_0x3288e0);_0xa43ac0(_this[_0x9c31('0x17')](0x1f4,_0x58a7b0['message']));});});};
\ No newline at end of file
+var _0xa973=['then','stringify','find','body','ids','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','./mailInteraction.socket','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','limit'];(function(_0x14199d,_0x176df7){var _0x377f44=function(_0x235de4){while(--_0x235de4){_0x14199d['push'](_0x14199d['shift']());}};_0x377f44(++_0x176df7);}(_0xa973,0x73));var _0x3a97=function(_0x490cbe,_0x3fc51f){_0x490cbe=_0x490cbe-0x0;var _0x58d3e0=_0xa973[_0x490cbe];return _0x58d3e0;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a97('0x4'));var logger=require('../../config/logger')(_0x3a97('0x5'));var config=require(_0x3a97('0x6'));var jayson=require(_0x3a97('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x3a97('0x8')]=_['defaults'](config['redis'],{'host':_0x3a97('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a97('0x8')]));require(_0x3a97('0xa'))[_0x3a97('0xb')](socket);function respondWithRpcPromise(_0x21b409,_0x59c496,_0x149c6d){return new BPromise(function(_0x499bca,_0x21fa2d){return client[_0x3a97('0xc')](_0x21b409,_0x149c6d)['then'](function(_0x11d382){logger[_0x3a97('0xd')]('MailInteraction,\x20%s,\x20%s',_0x59c496,_0x3a97('0xe'));logger[_0x3a97('0xf')](_0x3a97('0x10'),_0x59c496,_0x3a97('0xe'),JSON['stringify'](_0x11d382));if(_0x11d382[_0x3a97('0x11')]){if(_0x11d382[_0x3a97('0x11')][_0x3a97('0x12')]===0x1f4){logger[_0x3a97('0x11')](_0x3a97('0x13'),_0x59c496,_0x11d382[_0x3a97('0x11')][_0x3a97('0x14')]);return _0x21fa2d(_0x11d382[_0x3a97('0x11')]['message']);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x59c496,_0x11d382['error'][_0x3a97('0x14')]);return _0x499bca(_0x11d382['error'][_0x3a97('0x14')]);}else{logger[_0x3a97('0xd')](_0x3a97('0x13'),_0x59c496,'request\x20sent');_0x499bca(_0x11d382[_0x3a97('0x15')]['message']);}})[_0x3a97('0x16')](function(_0x100ae9){logger[_0x3a97('0x11')](_0x3a97('0x13'),_0x59c496,_0x100ae9);_0x21fa2d(_0x100ae9);});});}exports[_0x3a97('0x17')]=function(_0x148cab){var _0x528430=this;return new Promise(function(_0x5ddd0f,_0x1bb912){return db[_0x3a97('0x18')][_0x3a97('0x19')](_0x148cab['body'],{'raw':_0x148cab[_0x3a97('0x1a')]?_0x148cab['options'][_0x3a97('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x148cab[_0x3a97('0x1a')]?_0x148cab['options']['where']||null:null,'attributes':_0x148cab['options']?_0x148cab[_0x3a97('0x1a')]['attributes']||null:null,'limit':_0x148cab[_0x3a97('0x1a')]?_0x148cab[_0x3a97('0x1a')][_0x3a97('0x1c')]||null:null})[_0x3a97('0x1d')](function(_0x384e2f){logger[_0x3a97('0xd')](_0x3a97('0x17'),_0x148cab);logger[_0x3a97('0xf')]('UpdateMailInteraction',_0x148cab,JSON[_0x3a97('0x1e')](_0x384e2f));_0x5ddd0f(_0x384e2f);})['catch'](function(_0x25f82c){logger[_0x3a97('0x11')](_0x3a97('0x17'),_0x25f82c[_0x3a97('0x14')],_0x148cab);_0x1bb912(_0x528430[_0x3a97('0x11')](0x1f4,_0x25f82c[_0x3a97('0x14')]));});});};exports['AddTagsToMailInteraction']=function(_0x154a08){return new Promise(function(_0x332516,_0x425857){return db['MailInteraction'][_0x3a97('0x1f')]({'where':_0x154a08['options']?_0x154a08[_0x3a97('0x1a')]['where']||null:null})[_0x3a97('0x1d')](function(_0x3a81b3){if(_0x3a81b3){return _0x3a81b3['addTags'](_0x154a08[_0x3a97('0x20')]['ids'],_['omit'](_0x154a08[_0x3a97('0x20')],[_0x3a97('0x21'),'id'])||{});}})[_0x3a97('0x22')](function(_0x1324ae){logger[_0x3a97('0xd')]('AddTags',_0x154a08);logger['debug']('AddTags',_0x154a08,JSON[_0x3a97('0x1e')](_0x1324ae));_0x332516(_0x1324ae);})['catch'](function(_0x5ed2b6){logger[_0x3a97('0x11')](_0x3a97('0x23'),_0x5ed2b6[_0x3a97('0x14')],_0x154a08);_0x425857(_this[_0x3a97('0x11')](0x1f4,_0x5ed2b6[_0x3a97('0x14')]));});});};
\ No newline at end of file
index bd3d405..5c103cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53c7=['removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x4d4696,_0x1ab3a2){var _0x455048=function(_0x1548d4){while(--_0x1548d4){_0x4d4696['push'](_0x4d4696['shift']());}};_0x455048(++_0x1ab3a2);}(_0x53c7,0xb3));var _0x753c=function(_0x2dd544,_0x5be67f){_0x2dd544=_0x2dd544-0x0;var _0x5f1b65=_0x53c7[_0x2dd544];return _0x5f1b65;};'use strict';var MailInteractionEvents=require(_0x753c('0x0'));var events=['save','remove','update'];function createListener(_0x1cfb58,_0x3c5aa5){return function(_0x981aa5){_0x3c5aa5['emit'](_0x1cfb58,_0x981aa5);};}function removeListener(_0x2bb4b3,_0x44e874){return function(){MailInteractionEvents[_0x753c('0x1')](_0x2bb4b3,_0x44e874);};}exports[_0x753c('0x2')]=function(_0x377deb){for(var _0x17cf41=0x0,_0x5271c7=events[_0x753c('0x3')];_0x17cf41<_0x5271c7;_0x17cf41++){var _0x3d885b=events[_0x17cf41];var _0xc1a1db=createListener(_0x753c('0x4')+_0x3d885b,_0x377deb);MailInteractionEvents['on'](_0x3d885b,_0xc1a1db);}};
\ No newline at end of file
+var _0x22fa=['removeListener','register','length','mailInteraction:','save','emit'];(function(_0x23f0d0,_0x40ef17){var _0x5544fc=function(_0x171842){while(--_0x171842){_0x23f0d0['push'](_0x23f0d0['shift']());}};_0x5544fc(++_0x40ef17);}(_0x22fa,0x1c6));var _0xa22f=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x22fa[_0x533110];return _0xc3c866;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa22f('0x0'),'remove','update'];function createListener(_0x8ebdd8,_0x30bd61){return function(_0x18473c){_0x30bd61[_0xa22f('0x1')](_0x8ebdd8,_0x18473c);};}function removeListener(_0x136009,_0xd0ea5c){return function(){MailInteractionEvents[_0xa22f('0x2')](_0x136009,_0xd0ea5c);};}exports[_0xa22f('0x3')]=function(_0x494435){for(var _0x35e3e8=0x0,_0x17d84f=events[_0xa22f('0x4')];_0x35e3e8<_0x17d84f;_0x35e3e8++){var _0xc3eb6a=events[_0x35e3e8];var _0x45e717=createListener(_0xa22f('0x5')+_0xc3eb6a,_0x494435);MailInteractionEvents['on'](_0xc3eb6a,_0x45e717);}};
\ No newline at end of file
index bfd708d..91bae8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8caf=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xf9bbca,_0x56c628){var _0x720f5=function(_0x3e08f9){while(--_0x3e08f9){_0xf9bbca['push'](_0xf9bbca['shift']());}};_0x720f5(++_0x56c628);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0x8caf[_0x22cd0c];return _0x439eba;};'use strict';var multer=require('multer');var util=require(_0xf8ca('0x0'));var path=require(_0xf8ca('0x1'));var timeout=require(_0xf8ca('0x2'));var express=require(_0xf8ca('0x3'));var router=express[_0xf8ca('0x4')]();var fs_extra=require(_0xf8ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf8ca('0x6'));var config=require(_0xf8ca('0x7'));var controller=require(_0xf8ca('0x8'));router[_0xf8ca('0x9')]('/',auth[_0xf8ca('0xa')](),controller[_0xf8ca('0xb')]);router['get'](_0xf8ca('0xc'),auth[_0xf8ca('0xa')](),controller[_0xf8ca('0xd')]);router[_0xf8ca('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf8ca('0xe')]);router['get'](_0xf8ca('0xf'),auth[_0xf8ca('0xa')](),controller[_0xf8ca('0x10')]);router[_0xf8ca('0x11')]('/',auth['isAuthenticated'](),interaction[_0xf8ca('0x12')](_0xf8ca('0x13'),_0xf8ca('0x14')),controller[_0xf8ca('0x15')]);router['put'](_0xf8ca('0x16'),auth[_0xf8ca('0xa')](),controller['update']);router[_0xf8ca('0x17')](_0xf8ca('0x18'),auth[_0xf8ca('0xa')](),controller[_0xf8ca('0x19')]);router[_0xf8ca('0x17')](_0xf8ca('0x1a'),auth[_0xf8ca('0xa')](),controller[_0xf8ca('0x1b')]);router[_0xf8ca('0x1c')](_0xf8ca('0x16'),auth['isAuthenticated'](),controller[_0xf8ca('0x1d')]);module[_0xf8ca('0x1e')]=router;
\ No newline at end of file
+var _0xe87e=['reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','mail','mailmessage:create','create','put','update','accept'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe87e,0x17d));var _0xee87=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe87e[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var path=require(_0xee87('0x2'));var timeout=require(_0xee87('0x3'));var express=require(_0xee87('0x4'));var router=express['Router']();var fs_extra=require(_0xee87('0x5'));var auth=require(_0xee87('0x6'));var interaction=require(_0xee87('0x7'));var config=require(_0xee87('0x8'));var controller=require(_0xee87('0x9'));router[_0xee87('0xa')]('/',auth[_0xee87('0xb')](),controller['index']);router['get'](_0xee87('0xc'),auth[_0xee87('0xb')](),controller[_0xee87('0xd')]);router[_0xee87('0xa')](_0xee87('0xe'),auth['isAuthenticated'](),controller[_0xee87('0xf')]);router[_0xee87('0xa')](_0xee87('0x10'),auth[_0xee87('0xb')](),controller['download']);router[_0xee87('0x11')]('/',auth[_0xee87('0xb')](),interaction['tracked'](_0xee87('0x12'),_0xee87('0x13')),controller[_0xee87('0x14')]);router[_0xee87('0x15')](_0xee87('0xe'),auth[_0xee87('0xb')](),controller[_0xee87('0x16')]);router[_0xee87('0x15')]('/:id/accept',auth[_0xee87('0xb')](),controller[_0xee87('0x17')]);router['put']('/:id/reject',auth[_0xee87('0xb')](),controller[_0xee87('0x18')]);router['delete'](_0xee87('0xe'),auth[_0xee87('0xb')](),controller[_0xee87('0x19')]);module[_0xee87('0x1a')]=router;
\ No newline at end of file
index ea808d1..a8aeea8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84d2=['TEXT','medium','ENUM','out','STRING','long','DATE','Email','sequelize','lodash'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x84d2,0x102));var _0x284d=function(_0x3d4085,_0x7558d5){_0x3d4085=_0x3d4085-0x0;var _0x27a386=_0x84d2[_0x3d4085];return _0x27a386;};'use strict';var Sequelize=require(_0x284d('0x0'));var _=require(_0x284d('0x1'));module['exports']={'body':{'type':Sequelize[_0x284d('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x284d('0x2')](_0x284d('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x284d('0x4')]('in','out'),'defaultValue':_0x284d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x284d('0x6')]},'to':{'type':Sequelize[_0x284d('0x2')]('long')},'cc':{'type':Sequelize[_0x284d('0x2')]('long')},'bcc':{'type':Sequelize[_0x284d('0x2')](_0x284d('0x7'))},'subject':{'type':Sequelize[_0x284d('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x284d('0x8')]},'originTo':{'type':Sequelize[_0x284d('0x2')](_0x284d('0x7'))},'originCc':{'type':Sequelize[_0x284d('0x2')]('long')},'originChannel':{'type':Sequelize[_0x284d('0x4')](_0x284d('0x9'),'Chat'),'defaultValue':_0x284d('0x9'),'allowNull':![]}};
\ No newline at end of file
+var _0x9e69=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','STRING','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x352883,_0x2e324a){var _0x232968=function(_0x4e61e5){while(--_0x4e61e5){_0x352883['push'](_0x352883['shift']());}};_0x232968(++_0x2e324a);}(_0x9e69,0x144));var _0x99e6=function(_0x2d0c6b,_0x162605){_0x2d0c6b=_0x2d0c6b-0x0;var _0x31e6b1=_0x9e69[_0x2d0c6b];return _0x31e6b1;};'use strict';var Sequelize=require(_0x99e6('0x0'));var _=require(_0x99e6('0x1'));module[_0x99e6('0x2')]={'body':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x5'))},'read':{'type':Sequelize[_0x99e6('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x99e6('0x7')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x99e6('0x8')](0x1fe)},'from':{'type':Sequelize[_0x99e6('0x8')]},'to':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4'))},'cc':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4'))},'bcc':{'type':Sequelize[_0x99e6('0x3')]('long')},'subject':{'type':Sequelize[_0x99e6('0x3')]},'sentAt':{'type':Sequelize[_0x99e6('0x9')]},'attach':{'type':Sequelize[_0x99e6('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x99e6('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x99e6('0x9')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x99e6('0xb'),_0x99e6('0xc')),'defaultValue':'Email','allowNull':![]}};
\ No newline at end of file
index b0893ee..6247f86 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6672=['stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','SELECT','internal','interface','download','toString','files','server','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','type','build','unlinkSync','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','undefined','limit','count','offset','status','Content-Range','update','destroy','end','sendStatus','stack','name','map','MailMessage','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','rawAttributes','intersection','options','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','MailInteraction','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction'];(function(_0x1ddcd0,_0x35557d){var _0x23f108=function(_0x574dac){while(--_0x574dac){_0x1ddcd0['push'](_0x1ddcd0['shift']());}};_0x23f108(++_0x35557d);}(_0x6672,0xcd));var _0x2667=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6672[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var moment=require(_0x2667('0x0'));var BPromise=require(_0x2667('0x1'));var util=require(_0x2667('0x2'));var path=require(_0x2667('0x3'));var fs=require('fs');var _=require(_0x2667('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x2667('0x5'));var qs=require(_0x2667('0x6'));var logger=require(_0x2667('0x7'))(_0x2667('0x8'));var interaction_log=require(_0x2667('0x7'))(_0x2667('0x9'));var config=require(_0x2667('0xa'));var db=require(_0x2667('0xb'))['db'];config[_0x2667('0xc')]=_[_0x2667('0xd')](config[_0x2667('0xc')],{'host':_0x2667('0xe'),'port':0x18eb});var socket=require(_0x2667('0xf'))(new Redis(config[_0x2667('0xc')]));var htmlEntities=require(_0x2667('0x10'));require('./mailMessage.socket')[_0x2667('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2667('0x12')]['http']({'port':0x232c});var client9003=jayson[_0x2667('0x12')][_0x2667('0x13')]({'port':0x232b});var client9002=jayson[_0x2667('0x12')][_0x2667('0x13')]({'port':0x232a});function respondWithRpcPromise(_0xc15b62,_0x3bfa69,_0x5efa78,_0x2780d6){return new BPromise(function(_0xe9deec,_0x25f564){var _0x26322f=_0x2780d6||client;return _0x26322f[_0x2667('0x14')](_0xc15b62,_0x5efa78)[_0x2667('0x15')](function(_0x34a95a){logger[_0x2667('0x16')](_0x2667('0x17'),_0x3bfa69,_0x2667('0x18'));logger[_0x2667('0x19')](_0x2667('0x1a'),_0x3bfa69,_0x2667('0x18'),JSON['stringify'](_0x34a95a));if(_0x34a95a[_0x2667('0x1b')]){if(_0x34a95a['error'][_0x2667('0x1c')]===0x1f4){logger[_0x2667('0x1b')](_0x2667('0x17'),_0x3bfa69,_0x34a95a[_0x2667('0x1b')]['message']);return _0x25f564(_0x34a95a[_0x2667('0x1b')][_0x2667('0x1d')]);}logger[_0x2667('0x1b')]('MailMessage,\x20%s,\x20%s',_0x3bfa69,_0x34a95a[_0x2667('0x1b')][_0x2667('0x1d')]);return _0xe9deec(_0x34a95a['error']['message']);}else{logger[_0x2667('0x16')]('MailMessage,\x20%s,\x20%s',_0x3bfa69,_0x2667('0x18'));_0xe9deec(_0x34a95a[_0x2667('0x1e')]['message']);}})[_0x2667('0x1f')](function(_0xbe1c){logger[_0x2667('0x1b')](_0x2667('0x17'),_0x3bfa69,_0xbe1c);_0x25f564(_0xbe1c);});});}function respondWithResult(_0x4c73aa,_0x52afa7){_0x52afa7=_0x52afa7||0xc8;return function(_0x61a575){if(_0x61a575){return _0x4c73aa['status'](_0x52afa7)[_0x2667('0x20')](_0x61a575);}};}function respondWithFilteredResult(_0x354839,_0x360079){return function(_0xed5440){if(_0xed5440){var _0x2c00c1=typeof _0x360079['offset']===_0x2667('0x21')&&typeof _0x360079[_0x2667('0x22')]===_0x2667('0x21');var _0xf94163=_0xed5440[_0x2667('0x23')];var _0x164921=_0x2c00c1?0x0:_0x360079[_0x2667('0x24')];var _0x2f8356=_0x2c00c1?_0xed5440[_0x2667('0x23')]:_0x360079[_0x2667('0x24')]+_0x360079[_0x2667('0x22')];var _0x158110;if(_0x2f8356>=_0xf94163){_0x2f8356=_0xf94163;_0x158110=0xc8;}else{_0x158110=0xce;}_0x354839[_0x2667('0x25')](_0x158110);return _0x354839['set'](_0x2667('0x26'),_0x164921+'-'+_0x2f8356+'/'+_0xf94163)['json'](_0xed5440);}return null;};}function saveUpdates(_0x132981){return function(_0x1e4565){if(_0x1e4565){return _0x1e4565[_0x2667('0x27')](_0x132981)[_0x2667('0x15')](function(_0x258054){return _0x258054;});}return null;};}function removeEntity(_0x54a482){return function(_0x4fb09f){if(_0x4fb09f){return _0x4fb09f[_0x2667('0x28')]()['then'](function(){_0x54a482[_0x2667('0x25')](0xcc)[_0x2667('0x29')]();});}};}function handleEntityNotFound(_0x315a86){return function(_0x240458){if(!_0x240458){_0x315a86[_0x2667('0x2a')](0x194);}return _0x240458;};}function handleError(_0x17bd92,_0x2a951c){_0x2a951c=_0x2a951c||0x1f4;return function(_0x2c06ad){logger[_0x2667('0x1b')](_0x2c06ad[_0x2667('0x2b')]);if(_0x2c06ad[_0x2667('0x2c')]){delete _0x2c06ad[_0x2667('0x2c')];}_0x17bd92[_0x2667('0x25')](_0x2a951c)['send'](_0x2c06ad);};}exports['index']=function(_0x393a53,_0x205c11){var _0x51c2c4={},_0x160d06={},_0x1a4e6c={'count':0x0,'rows':[]};var _0x4bb963=_[_0x2667('0x2d')](db[_0x2667('0x2e')]['rawAttributes'],function(_0x2a9834){return{'name':_0x2a9834[_0x2667('0x2f')],'type':_0x2a9834['type'][_0x2667('0x30')]};});_0x160d06[_0x2667('0x31')]=_[_0x2667('0x2d')](_0x4bb963,_0x2667('0x2c'));_0x160d06['query']=_[_0x2667('0x32')](_0x393a53[_0x2667('0x33')]);_0x160d06[_0x2667('0x34')]=_['intersection'](_0x160d06[_0x2667('0x31')],_0x160d06[_0x2667('0x33')]);_0x51c2c4[_0x2667('0x35')]=_['intersection'](_0x160d06[_0x2667('0x31')],qs['fields'](_0x393a53[_0x2667('0x33')][_0x2667('0x36')]));_0x51c2c4['attributes']=_0x51c2c4[_0x2667('0x35')][_0x2667('0x37')]?_0x51c2c4[_0x2667('0x35')]:_0x160d06[_0x2667('0x31')];if(!_0x393a53['query'][_0x2667('0x38')]('nolimit')){_0x51c2c4[_0x2667('0x22')]=qs[_0x2667('0x22')](_0x393a53[_0x2667('0x33')]['limit']);_0x51c2c4[_0x2667('0x24')]=qs[_0x2667('0x24')](_0x393a53[_0x2667('0x33')][_0x2667('0x24')]);}_0x51c2c4['order']=qs[_0x2667('0x39')](_0x393a53[_0x2667('0x33')]['sort']);_0x51c2c4[_0x2667('0x3a')]=qs[_0x2667('0x34')](_[_0x2667('0x3b')](_0x393a53[_0x2667('0x33')],_0x160d06[_0x2667('0x34')]),_0x4bb963);if(_0x393a53[_0x2667('0x33')][_0x2667('0x3c')]){_0x51c2c4['where']=_['merge'](_0x51c2c4['where'],{'$or':_[_0x2667('0x2d')](_0x4bb963,function(_0x29ce5e){if(_0x29ce5e['type']!==_0x2667('0x3d')){var _0x129a6c={};_0x129a6c[_0x29ce5e[_0x2667('0x2c')]]={'$like':'%'+_0x393a53['query'][_0x2667('0x3c')]+'%'};return _0x129a6c;}})});}_0x51c2c4=_[_0x2667('0x3e')]({},_0x51c2c4,_0x393a53['options']);var _0x197881={'where':_0x51c2c4[_0x2667('0x3a')]};return db[_0x2667('0x2e')][_0x2667('0x23')](_0x197881)[_0x2667('0x15')](function(_0x582256){_0x1a4e6c[_0x2667('0x23')]=_0x582256;if(_0x393a53[_0x2667('0x33')][_0x2667('0x3f')]){_0x51c2c4[_0x2667('0x40')]=[{'all':!![]}];}return db[_0x2667('0x2e')][_0x2667('0x41')](_0x51c2c4);})[_0x2667('0x15')](function(_0x174e1d){_0x1a4e6c[_0x2667('0x42')]=_0x174e1d;return _0x1a4e6c;})[_0x2667('0x15')](respondWithFilteredResult(_0x205c11,_0x51c2c4))['catch'](handleError(_0x205c11,null));};exports['show']=function(_0xb7a384,_0x5a3fdd){var _0x3c89f6={'raw':!![],'where':{'id':_0xb7a384[_0x2667('0x43')]['id']}},_0x108e4e={};_0x108e4e['model']=_[_0x2667('0x32')](db[_0x2667('0x2e')][_0x2667('0x44')]);_0x108e4e[_0x2667('0x33')]=_[_0x2667('0x32')](_0xb7a384[_0x2667('0x33')]);_0x108e4e[_0x2667('0x34')]=_[_0x2667('0x45')](_0x108e4e[_0x2667('0x31')],_0x108e4e[_0x2667('0x33')]);_0x3c89f6[_0x2667('0x35')]=_[_0x2667('0x45')](_0x108e4e[_0x2667('0x31')],qs[_0x2667('0x36')](_0xb7a384[_0x2667('0x33')][_0x2667('0x36')]));_0x3c89f6[_0x2667('0x35')]=_0x3c89f6[_0x2667('0x35')][_0x2667('0x37')]?_0x3c89f6[_0x2667('0x35')]:_0x108e4e[_0x2667('0x31')];if(_0xb7a384['query']['includeAll']){_0x3c89f6[_0x2667('0x40')]=[{'all':!![]}];}_0x3c89f6=_[_0x2667('0x3e')]({},_0x3c89f6,_0xb7a384[_0x2667('0x46')]);return db[_0x2667('0x2e')][_0x2667('0x47')](_0x3c89f6)['then'](handleEntityNotFound(_0x5a3fdd,null))[_0x2667('0x15')](respondWithResult(_0x5a3fdd,null))[_0x2667('0x1f')](handleError(_0x5a3fdd,null));};exports[_0x2667('0x27')]=function(_0x44afe9,_0x467942){if(_0x44afe9['body']['id']){delete _0x44afe9[_0x2667('0x48')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x44afe9[_0x2667('0x43')]['id']}})[_0x2667('0x15')](handleEntityNotFound(_0x467942,null))[_0x2667('0x15')](saveUpdates(_0x44afe9[_0x2667('0x48')],null))[_0x2667('0x15')](respondWithResult(_0x467942,null))[_0x2667('0x1f')](handleError(_0x467942,null));};exports[_0x2667('0x28')]=function(_0x4a4eb7,_0x12689f){return db[_0x2667('0x2e')][_0x2667('0x47')]({'where':{'id':_0x4a4eb7[_0x2667('0x43')]['id']}})[_0x2667('0x15')](handleEntityNotFound(_0x12689f,null))[_0x2667('0x15')](removeEntity(_0x12689f,null))[_0x2667('0x1f')](handleError(_0x12689f,null));};exports[_0x2667('0x49')]=function(_0x4b6ef6,_0x461afe){return db['MailMessage']['describe']()[_0x2667('0x15')](respondWithResult(_0x461afe,null))[_0x2667('0x1f')](handleError(_0x461afe,null));};exports['create']=function(_0x418bc5,_0x4847ea){return db[_0x2667('0x2e')][_0x2667('0x4a')](_0x418bc5[_0x2667('0x48')])[_0x2667('0x15')](function(_0x768644){if(_0x768644){if(_0x768644[_0x2667('0x4b')]===_0x2667('0x4c')&&!_0x768644[_0x2667('0x4d')]){var _0x519533,_0x4755f6,_0x17526a;if(_0x418bc5['body']['to']){_0x4755f6=_0x418bc5[_0x2667('0x48')]['to'][_0x2667('0x4e')](',')[0x0];}return db[_0x2667('0x4f')]['findOne']({'where':{'id':_0x768644[_0x2667('0x50')]},'include':[{'model':db[_0x2667('0x51')],'as':_0x2667('0x52'),'include':[{'model':db['CmContact'],'as':_0x2667('0x53'),'where':{'email':_0x4755f6},'limit':0x1,'order':[[_0x2667('0x54'),_0x2667('0x55')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2667('0x56')],'as':_0x2667('0x56'),'raw':!![]}]}]})['then'](function(_0x38611b){_0x519533=_0x38611b;if(!_0x519533||!_0x519533['Smtp'])return;var _0x2941a5=_0x519533[_0x2667('0x57')]();if(_0x418bc5['body']['attachments']&&_0x418bc5[_0x2667('0x48')][_0x2667('0x58')][_0x2667('0x37')]){for(var _0x4b8f83=0x0;_0x4b8f83<_0x418bc5['body'][_0x2667('0x58')][_0x2667('0x37')];_0x4b8f83+=0x1){_0x418bc5['body'][_0x2667('0x58')][_0x4b8f83]={'filename':_0x418bc5[_0x2667('0x48')][_0x2667('0x58')][_0x4b8f83][_0x2667('0x2c')],'path':path[_0x2667('0x59')](config[_0x2667('0x5a')],_0x2667('0x5b'),_0x418bc5[_0x2667('0x48')][_0x2667('0x58')][_0x4b8f83][_0x2667('0x5c')])};}}_0x17526a={'account':_0x2941a5,'message':_0x418bc5[_0x2667('0x48')]};return;})[_0x2667('0x15')](function(){if(_0x519533[_0x2667('0x52')]){if(_0x519533[_0x2667('0x52')][_0x2667('0x53')][_0x2667('0x37')]){return _0x519533[_0x2667('0x52')]['Contacts'][0x0];}else{return db[_0x2667('0x5d')][_0x2667('0x4a')](_['defaults'](_0x418bc5['body'],{'firstName':_0x418bc5[_0x2667('0x48')]['to'],'email':_0x418bc5[_0x2667('0x48')]['to'],'phone':_0x418bc5[_0x2667('0x48')]['to'],'ListId':_0x519533[_0x2667('0x5e')]}));}}else{throw new Error(_0x2667('0x5f'));}})['then'](function(){if(_0x17526a){return respondWithRpcPromise(_0x2667('0x60'),_0x2667('0x61'),_0x17526a,client9003)[_0x2667('0x15')](function(_0x28bd4c){return _0x768644[_0x2667('0x27')]({'read':!![],'messageId':_0x28bd4c[_0x2667('0x62')],'sentAt':moment()[_0x2667('0x63')](_0x2667('0x64'))});})[_0x2667('0x1f')](function(_0x870e22){logger[_0x2667('0x1b')]('%s',JSON['stringify'](_0x870e22));return _0x768644;});}return _0x768644;});}return _0x768644;}})[_0x2667('0x15')](respondWithResult(_0x4847ea,0xc9))['catch'](handleError(_0x4847ea,null));};exports[_0x2667('0x65')]=function(_0x31e927,_0x5c46f3){var _0x1c3946={'agent':{},'channel':_0x2667('0x66')};if(_0x31e927[_0x2667('0x48')]['id']){delete _0x31e927[_0x2667('0x48')]['id'];}_0x31e927[_0x2667('0x48')][_0x2667('0x67')]=!![];_0x31e927[_0x2667('0x48')]['readAt']=moment()['format'](_0x2667('0x64'));_0x31e927[_0x2667('0x48')][_0x2667('0x68')]=_0x31e927[_0x2667('0x48')][_0x2667('0x68')]||_0x31e927[_0x2667('0x69')]['id'];_0x1c3946[_0x2667('0x6a')]['id']=_0x31e927[_0x2667('0x48')]['UserId'];return db[_0x2667('0x2e')][_0x2667('0x47')]({'where':{'id':_0x31e927[_0x2667('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c46f3,null))['then'](saveUpdates(_0x31e927['body'],null))['then'](function(_0x1c8a67){if(_0x1c8a67){_0x1c3946[_0x2667('0x1d')]=_0x1c8a67['get']({'plain':!![]});return db[_0x2667('0x6b')]['find']({'where':{'id':_0x1c8a67[_0x2667('0x6c')]}});}return null;})[_0x2667('0x15')](handleEntityNotFound(_0x5c46f3,null))['then'](function(_0x5df799){if(_0x5df799){return _0x5df799['update']({'UserId':_0x31e927[_0x2667('0x48')][_0x2667('0x68')],'read1stAt':_['isNil'](_0x5df799[_0x2667('0x6d')])?moment()[_0x2667('0x63')](_0x2667('0x64')):undefined});}return null;})[_0x2667('0x15')](function(_0x39971a){if(_0x39971a){_0x1c3946['interaction']=_0x39971a[_0x2667('0x6e')]({'plain':!![]});interaction_log[_0x2667('0x16')](_0x2667('0x6f'),_0x31e927['user']['id'],_0x31e927[_0x2667('0x69')][_0x2667('0x2c')],_0x31e927[_0x2667('0x69')]['role'],_0x1c3946[_0x2667('0x70')]['id'],_0x31e927[_0x2667('0x48')]?JSON[_0x2667('0x71')](_0x31e927[_0x2667('0x48')]):_0x2667('0x72'));return respondWithRpcPromise(_0x2667('0x73'),_0x2667('0x74'),_0x1c3946);}return null;})[_0x2667('0x15')](function(_0x221c6e){var _0x193939=_0x2667('0x75')+_0x221c6e[_0x2667('0x1d')]['ContactId'];return db[_0x2667('0x76')]['query'](_0x193939,{'type':db[_0x2667('0x77')][_0x2667('0x78')]['SELECT'],'raw':!![]})[_0x2667('0x15')](function(_0x44b7e5){return _0x44b7e5;});})['then'](function(_0x510d04){if(_0x510d04){_0x1c3946['message'][_0x2667('0x79')]=_0x510d04[0x0];if(!_0x31e927['body'][_0x2667('0x68')])return;return db[_0x2667('0x7a')][_0x2667('0x47')]({'where':{'id':_0x31e927[_0x2667('0x48')][_0x2667('0x68')],'role':'agent'},'attributes':['id',_0x2667('0x2c'),_0x2667('0x7b'),_0x2667('0x7c'),'internal'],'raw':!![]});}return null;})[_0x2667('0x15')](function(_0x23b8dd){if(!_0x23b8dd)return null;_0x1c3946[_0x2667('0x1d')][_0x2667('0x6a')]=_0x23b8dd;return _0x1c3946;})[_0x2667('0x15')](function(_0x5432f8){if(_0x5432f8){if(_0x31e927[_0x2667('0x48')][_0x2667('0x7d')]){_0x1c3946[_0x2667('0x1d')]['interface']=util[_0x2667('0x63')](_0x2667('0x7e'),_0x31e927[_0x2667('0x69')][_0x2667('0x2c')]);_0x1c3946[_0x2667('0x1d')][_0x2667('0x7f')]=_0x1c3946[_0x2667('0x7f')];_0x1c3946[_0x2667('0x1d')][_0x2667('0x80')]=_0x1c3946[_0x2667('0x7f')];_0x1c3946[_0x2667('0x1d')][_0x2667('0x81')]=_0x2667('0x65');_0x1c3946[_0x2667('0x1d')]['body']=htmlToText[_0x2667('0x82')](_0x1c3946['message'][_0x2667('0x48')]);return respondWithRpcPromise('EventManager',_0x2667('0x83'),{'event':'acceptmessage','message':_0x1c3946[_0x2667('0x1d')]},client9002)[_0x2667('0x15')](function(){return _0x1c3946;});}return _0x1c3946;}return null;})[_0x2667('0x15')](respondWithResult(_0x5c46f3,null))['catch'](handleError(_0x5c46f3,null));};exports[_0x2667('0x84')]=function(_0x4c6dab,_0x996db3){var _0x15f83b={'agent':{},'channel':_0x2667('0x66')};if(_0x4c6dab['body']['id']){delete _0x4c6dab['body']['id'];}_0x4c6dab[_0x2667('0x48')]['UserId']=_0x4c6dab[_0x2667('0x48')][_0x2667('0x68')]||_0x4c6dab[_0x2667('0x69')]['id'];_0x15f83b[_0x2667('0x6a')]['id']=_0x4c6dab[_0x2667('0x48')][_0x2667('0x68')];return db[_0x2667('0x2e')][_0x2667('0x47')]({'where':{'id':_0x4c6dab[_0x2667('0x43')]['id'],'UserId':null}})[_0x2667('0x15')](handleEntityNotFound(_0x996db3,null))['then'](function(_0x2f337e){if(_0x2f337e){_0x15f83b[_0x2667('0x1d')]=_0x2f337e[_0x2667('0x6e')]({'plain':!![]});return db['MailInteraction'][_0x2667('0x47')]({'where':{'id':_0x2f337e[_0x2667('0x6c')]}});}return null;})[_0x2667('0x15')](handleEntityNotFound(_0x996db3,null))[_0x2667('0x15')](function(_0x59bc4e){if(_0x59bc4e){_0x15f83b['interaction']=_0x59bc4e['get']({'plain':!![]});interaction_log[_0x2667('0x16')](_0x2667('0x85'),_0x4c6dab[_0x2667('0x69')]['id'],_0x4c6dab[_0x2667('0x69')][_0x2667('0x2c')],_0x4c6dab[_0x2667('0x69')][_0x2667('0x86')],_0x15f83b[_0x2667('0x70')]['id'],_0x4c6dab['body']?JSON[_0x2667('0x71')](_0x4c6dab['body']):_0x2667('0x72'));return respondWithRpcPromise(_0x2667('0x87'),'rejectMessage',_0x15f83b);}return null;})[_0x2667('0x15')](function(_0x40e98f){var _0x5f2c8e=_0x2667('0x75')+_0x40e98f[_0x2667('0x1d')][_0x2667('0x88')];return db[_0x2667('0x76')][_0x2667('0x33')](_0x5f2c8e,{'type':db[_0x2667('0x77')][_0x2667('0x78')][_0x2667('0x89')],'raw':!![]})[_0x2667('0x15')](function(_0x5e09c7){return _0x5e09c7;});})['then'](function(_0x5c5089){if(_0x5c5089){_0x15f83b[_0x2667('0x1d')][_0x2667('0x79')]=_0x5c5089[0x0];if(!_0x4c6dab['body'][_0x2667('0x68')])return;return db[_0x2667('0x7a')][_0x2667('0x47')]({'where':{'id':_0x4c6dab[_0x2667('0x48')]['UserId'],'role':_0x2667('0x6a')},'attributes':['id',_0x2667('0x2c'),_0x2667('0x7b'),_0x2667('0x7c'),_0x2667('0x8a')],'raw':!![]});}return null;})['then'](function(_0x4e5e59){if(!_0x4e5e59)return null;_0x15f83b[_0x2667('0x1d')]['agent']=_0x4e5e59;return _0x15f83b;})[_0x2667('0x15')](function(_0x449672){if(_0x449672){_0x449672[_0x2667('0x1d')][_0x2667('0x8b')]=util[_0x2667('0x63')](_0x2667('0x7e'),_0x4c6dab[_0x2667('0x69')][_0x2667('0x2c')]);_0x449672[_0x2667('0x1d')]['channel']=_0x15f83b['channel'];_0x449672['message']['motionChannel']=_0x15f83b['channel'];_0x449672[_0x2667('0x1d')][_0x2667('0x81')]='reject';_0x449672[_0x2667('0x1d')]['body']=htmlToText[_0x2667('0x82')](_0x15f83b['message'][_0x2667('0x48')]);respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x449672['message']},client9002);return _0x15f83b;}return null;})[_0x2667('0x15')](respondWithResult(_0x996db3,null))['catch'](handleError(_0x996db3,null));};exports[_0x2667('0x8c')]=function(_0x52e7f5,_0x52b841){var _0x50c916=moment()['unix']()[_0x2667('0x8d')]();var _0x4f69de=path[_0x2667('0x59')](config[_0x2667('0x5a')],'server',_0x2667('0x8e'),'tmp');var _0x456e68=path[_0x2667('0x59')](config['root'],_0x2667('0x8f'),_0x2667('0x8e'),'attachments');var _0xda4811=util[_0x2667('0x63')]('message-%s.eml',_0x50c916);return db[_0x2667('0x2e')][_0x2667('0x47')]({'where':{'id':_0x52e7f5[_0x2667('0x43')]['id']},'attributes':['id','body',_0x2667('0x90'),'to','cc',_0x2667('0x91'),_0x2667('0x92'),_0x2667('0x93')],'include':_0x52e7f5[_0x2667('0x33')][_0x2667('0x58')]?[{'model':db[_0x2667('0x94')],'as':_0x2667('0x95')}]:undefined})[_0x2667('0x15')](handleEntityNotFound(_0x52b841,null))[_0x2667('0x15')](function(_0x7836a1){if(_0x7836a1){var _0x1eb2fe=_0x7836a1;var _0x4bab3c={'from':_0x1eb2fe[_0x2667('0x90')],'to':_0x1eb2fe['to'],'subject':_0x1eb2fe['subject'],'html':htmlEntities[_0x2667('0x96')](_0x1eb2fe[_0x2667('0x48')]),'headers':{'Date':moment(_0x1eb2fe[_0x2667('0x93')])[_0x2667('0x63')](_0x2667('0x97'))},'attachments':[]};if(_0x7836a1['cc']){_0x4bab3c[_0x2667('0x98')]['Cc']=_0x7836a1['cc'];}if(_0x7836a1[_0x2667('0x91')]){_0x4bab3c['headers'][_0x2667('0x99')]=_0x7836a1[_0x2667('0x91')];}return new BPromise(function(_0x44218c,_0x3d2ca6){if(_0x7836a1['Attachments']){for(var _0x429cab=0x0;_0x429cab<_0x7836a1[_0x2667('0x95')][_0x2667('0x37')];_0x429cab++){var _0xcb5f2d=_0x7836a1[_0x2667('0x95')][_0x429cab];var _0x3ecd81=path[_0x2667('0x59')](_0x456e68,_0xcb5f2d[_0x2667('0x5c')]);if(fs[_0x2667('0x9a')](_0x3ecd81)){_0x4bab3c['attachments'][_0x2667('0x9b')]({'name':_0xcb5f2d[_0x2667('0x2c')],'contentType':_0xcb5f2d[_0x2667('0x9c')],'data':fs['readFileSync'](_0x3ecd81)});}}}emlformat[_0x2667('0x9d')](_0x4bab3c,function(_0x3d9aa1,_0x463bc2){if(_0x3d9aa1)return _0x3d2ca6(_0x3d9aa1);fs['writeFileSync'](path[_0x2667('0x59')](_0x4f69de,_0xda4811),_0x463bc2);return _0x44218c(_0x463bc2);});});}})[_0x2667('0x15')](function(_0x4ca8b9){if(_0x4ca8b9){return _0x52b841[_0x2667('0x8c')](path['join'](_0x4f69de,_0xda4811),_0xda4811,function(_0x30109c){if(!_0x30109c)fs[_0x2667('0x9e')](path[_0x2667('0x59')](_0x4f69de,_0xda4811));});}})['catch'](handleError(_0x52b841,null));};
\ No newline at end of file
+var _0x2b74=['internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','Sequelize','email','event','rejectmessage','download','unix','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','headers','Bcc','existsSync','push','build','writeFileSync','eml-format','moment','bluebird','lodash','html-to-text','../../config/logger','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','limit','undefined','count','offset','set','Content-Range','update','destroy','then','status','sendStatus','stack','name','send','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','agent','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname'];(function(_0x105b20,_0x388d13){var _0x357455=function(_0x5b28d7){while(--_0x5b28d7){_0x105b20['push'](_0x105b20['shift']());}};_0x357455(++_0x388d13);}(_0x2b74,0xbf));var _0x42b7=function(_0x1787ce,_0x4cbc90){_0x1787ce=_0x1787ce-0x0;var _0x150c53=_0x2b74[_0x1787ce];return _0x150c53;};'use strict';var emlformat=require(_0x42b7('0x0'));var moment=require(_0x42b7('0x1'));var BPromise=require(_0x42b7('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x42b7('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x42b7('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x42b7('0x5'))('api');var interaction_log=require(_0x42b7('0x5'))(_0x42b7('0x6'));var config=require('../../config/environment');var db=require(_0x42b7('0x7'))['db'];config[_0x42b7('0x8')]=_[_0x42b7('0x9')](config[_0x42b7('0x8')],{'host':_0x42b7('0xa'),'port':0x18eb});var socket=require(_0x42b7('0xb'))(new Redis(config[_0x42b7('0x8')]));var htmlEntities=require(_0x42b7('0xc'));require(_0x42b7('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x42b7('0xe')][_0x42b7('0xf')]({'port':0x232b});var client9002=jayson[_0x42b7('0xe')][_0x42b7('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1b0dd8,_0x41ff2f,_0x31f7f7,_0x181e47){return new BPromise(function(_0xf6d35d,_0x275da8){var _0x19cf60=_0x181e47||client;return _0x19cf60[_0x42b7('0x10')](_0x1b0dd8,_0x31f7f7)['then'](function(_0x5bd812){logger[_0x42b7('0x11')](_0x42b7('0x12'),_0x41ff2f,_0x42b7('0x13'));logger[_0x42b7('0x14')](_0x42b7('0x15'),_0x41ff2f,_0x42b7('0x13'),JSON[_0x42b7('0x16')](_0x5bd812));if(_0x5bd812['error']){if(_0x5bd812[_0x42b7('0x17')][_0x42b7('0x18')]===0x1f4){logger[_0x42b7('0x17')](_0x42b7('0x12'),_0x41ff2f,_0x5bd812[_0x42b7('0x17')][_0x42b7('0x19')]);return _0x275da8(_0x5bd812[_0x42b7('0x17')][_0x42b7('0x19')]);}logger[_0x42b7('0x17')](_0x42b7('0x12'),_0x41ff2f,_0x5bd812[_0x42b7('0x17')][_0x42b7('0x19')]);return _0xf6d35d(_0x5bd812['error'][_0x42b7('0x19')]);}else{logger[_0x42b7('0x11')](_0x42b7('0x12'),_0x41ff2f,_0x42b7('0x13'));_0xf6d35d(_0x5bd812[_0x42b7('0x1a')]['message']);}})[_0x42b7('0x1b')](function(_0x2b7b85){logger[_0x42b7('0x17')](_0x42b7('0x12'),_0x41ff2f,_0x2b7b85);_0x275da8(_0x2b7b85);});});}function respondWithResult(_0x2c1538,_0x359a16){_0x359a16=_0x359a16||0xc8;return function(_0x42217a){if(_0x42217a){return _0x2c1538['status'](_0x359a16)[_0x42b7('0x1c')](_0x42217a);}};}function respondWithFilteredResult(_0x144484,_0x43d24c){return function(_0x4dafad){if(_0x4dafad){var _0x56caaf=typeof _0x43d24c['offset']==='undefined'&&typeof _0x43d24c[_0x42b7('0x1d')]===_0x42b7('0x1e');var _0x24266f=_0x4dafad[_0x42b7('0x1f')];var _0x3d5d2d=_0x56caaf?0x0:_0x43d24c['offset'];var _0x6974ea=_0x56caaf?_0x4dafad[_0x42b7('0x1f')]:_0x43d24c[_0x42b7('0x20')]+_0x43d24c[_0x42b7('0x1d')];var _0x4ac71d;if(_0x6974ea>=_0x24266f){_0x6974ea=_0x24266f;_0x4ac71d=0xc8;}else{_0x4ac71d=0xce;}_0x144484['status'](_0x4ac71d);return _0x144484[_0x42b7('0x21')](_0x42b7('0x22'),_0x3d5d2d+'-'+_0x6974ea+'/'+_0x24266f)['json'](_0x4dafad);}return null;};}function saveUpdates(_0x5ab43d){return function(_0x388a8b){if(_0x388a8b){return _0x388a8b[_0x42b7('0x23')](_0x5ab43d)['then'](function(_0x4305eb){return _0x4305eb;});}return null;};}function removeEntity(_0x4675c0){return function(_0x5b4d3b){if(_0x5b4d3b){return _0x5b4d3b[_0x42b7('0x24')]()[_0x42b7('0x25')](function(){_0x4675c0[_0x42b7('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x678cc3){return function(_0x143826){if(!_0x143826){_0x678cc3[_0x42b7('0x27')](0x194);}return _0x143826;};}function handleError(_0x3af58d,_0x44220b){_0x44220b=_0x44220b||0x1f4;return function(_0x4ab1be){logger[_0x42b7('0x17')](_0x4ab1be[_0x42b7('0x28')]);if(_0x4ab1be[_0x42b7('0x29')]){delete _0x4ab1be[_0x42b7('0x29')];}_0x3af58d[_0x42b7('0x26')](_0x44220b)[_0x42b7('0x2a')](_0x4ab1be);};}exports['index']=function(_0x3dfd63,_0x538e6b){var _0x11ead4={},_0x50b169={},_0x527f16={'count':0x0,'rows':[]};var _0x158b64=_[_0x42b7('0x2b')](db[_0x42b7('0x2c')]['rawAttributes'],function(_0x5943ba){return{'name':_0x5943ba[_0x42b7('0x2d')],'type':_0x5943ba[_0x42b7('0x2e')][_0x42b7('0x2f')]};});_0x50b169[_0x42b7('0x30')]=_[_0x42b7('0x2b')](_0x158b64,_0x42b7('0x29'));_0x50b169[_0x42b7('0x31')]=_[_0x42b7('0x32')](_0x3dfd63[_0x42b7('0x31')]);_0x50b169[_0x42b7('0x33')]=_[_0x42b7('0x34')](_0x50b169[_0x42b7('0x30')],_0x50b169[_0x42b7('0x31')]);_0x11ead4[_0x42b7('0x35')]=_[_0x42b7('0x34')](_0x50b169[_0x42b7('0x30')],qs[_0x42b7('0x36')](_0x3dfd63[_0x42b7('0x31')][_0x42b7('0x36')]));_0x11ead4[_0x42b7('0x35')]=_0x11ead4['attributes'][_0x42b7('0x37')]?_0x11ead4[_0x42b7('0x35')]:_0x50b169[_0x42b7('0x30')];if(!_0x3dfd63[_0x42b7('0x31')][_0x42b7('0x38')]('nolimit')){_0x11ead4['limit']=qs['limit'](_0x3dfd63[_0x42b7('0x31')][_0x42b7('0x1d')]);_0x11ead4[_0x42b7('0x20')]=qs[_0x42b7('0x20')](_0x3dfd63[_0x42b7('0x31')][_0x42b7('0x20')]);}_0x11ead4[_0x42b7('0x39')]=qs[_0x42b7('0x3a')](_0x3dfd63['query'][_0x42b7('0x3a')]);_0x11ead4[_0x42b7('0x3b')]=qs[_0x42b7('0x33')](_[_0x42b7('0x3c')](_0x3dfd63[_0x42b7('0x31')],_0x50b169[_0x42b7('0x33')]),_0x158b64);if(_0x3dfd63['query'][_0x42b7('0x3d')]){_0x11ead4[_0x42b7('0x3b')]=_[_0x42b7('0x3e')](_0x11ead4[_0x42b7('0x3b')],{'$or':_[_0x42b7('0x2b')](_0x158b64,function(_0x45e90e){if(_0x45e90e[_0x42b7('0x2e')]!==_0x42b7('0x3f')){var _0x380195={};_0x380195[_0x45e90e['name']]={'$like':'%'+_0x3dfd63[_0x42b7('0x31')]['filter']+'%'};return _0x380195;}})});}_0x11ead4=_[_0x42b7('0x3e')]({},_0x11ead4,_0x3dfd63[_0x42b7('0x40')]);var _0x120e58={'where':_0x11ead4[_0x42b7('0x3b')]};return db[_0x42b7('0x2c')][_0x42b7('0x1f')](_0x120e58)[_0x42b7('0x25')](function(_0x402cc3){_0x527f16[_0x42b7('0x1f')]=_0x402cc3;if(_0x3dfd63[_0x42b7('0x31')][_0x42b7('0x41')]){_0x11ead4['include']=[{'all':!![]}];}return db[_0x42b7('0x2c')][_0x42b7('0x42')](_0x11ead4);})[_0x42b7('0x25')](function(_0x3fb62f){_0x527f16[_0x42b7('0x43')]=_0x3fb62f;return _0x527f16;})[_0x42b7('0x25')](respondWithFilteredResult(_0x538e6b,_0x11ead4))['catch'](handleError(_0x538e6b,null));};exports['show']=function(_0x455aeb,_0x2cb88b){var _0x43c3c8={'raw':!![],'where':{'id':_0x455aeb[_0x42b7('0x44')]['id']}},_0x1e338a={};_0x1e338a[_0x42b7('0x30')]=_[_0x42b7('0x32')](db[_0x42b7('0x2c')][_0x42b7('0x45')]);_0x1e338a['query']=_[_0x42b7('0x32')](_0x455aeb[_0x42b7('0x31')]);_0x1e338a[_0x42b7('0x33')]=_['intersection'](_0x1e338a[_0x42b7('0x30')],_0x1e338a[_0x42b7('0x31')]);_0x43c3c8['attributes']=_[_0x42b7('0x34')](_0x1e338a[_0x42b7('0x30')],qs['fields'](_0x455aeb['query']['fields']));_0x43c3c8['attributes']=_0x43c3c8[_0x42b7('0x35')][_0x42b7('0x37')]?_0x43c3c8[_0x42b7('0x35')]:_0x1e338a[_0x42b7('0x30')];if(_0x455aeb[_0x42b7('0x31')][_0x42b7('0x41')]){_0x43c3c8[_0x42b7('0x46')]=[{'all':!![]}];}_0x43c3c8=_[_0x42b7('0x3e')]({},_0x43c3c8,_0x455aeb['options']);return db['MailMessage'][_0x42b7('0x47')](_0x43c3c8)[_0x42b7('0x25')](handleEntityNotFound(_0x2cb88b,null))[_0x42b7('0x25')](respondWithResult(_0x2cb88b,null))[_0x42b7('0x1b')](handleError(_0x2cb88b,null));};exports['update']=function(_0x31cdd9,_0x4dfd13){if(_0x31cdd9[_0x42b7('0x48')]['id']){delete _0x31cdd9['body']['id'];}return db[_0x42b7('0x2c')][_0x42b7('0x47')]({'where':{'id':_0x31cdd9['params']['id']}})[_0x42b7('0x25')](handleEntityNotFound(_0x4dfd13,null))[_0x42b7('0x25')](saveUpdates(_0x31cdd9[_0x42b7('0x48')],null))[_0x42b7('0x25')](respondWithResult(_0x4dfd13,null))[_0x42b7('0x1b')](handleError(_0x4dfd13,null));};exports[_0x42b7('0x24')]=function(_0xb999a2,_0x546b16){return db[_0x42b7('0x2c')][_0x42b7('0x47')]({'where':{'id':_0xb999a2[_0x42b7('0x44')]['id']}})[_0x42b7('0x25')](handleEntityNotFound(_0x546b16,null))['then'](removeEntity(_0x546b16,null))[_0x42b7('0x1b')](handleError(_0x546b16,null));};exports[_0x42b7('0x49')]=function(_0x344f3e,_0x4831fe){return db['MailMessage'][_0x42b7('0x49')]()[_0x42b7('0x25')](respondWithResult(_0x4831fe,null))[_0x42b7('0x1b')](handleError(_0x4831fe,null));};exports[_0x42b7('0x4a')]=function(_0x4c85c7,_0x2ba194){return db[_0x42b7('0x2c')]['create'](_0x4c85c7['body'])[_0x42b7('0x25')](function(_0x46f246){if(_0x46f246){if(_0x46f246[_0x42b7('0x4b')]===_0x42b7('0x4c')&&!_0x46f246['secret']){var _0x2a1141,_0x4459e4,_0x5b1d83;if(_0x4c85c7[_0x42b7('0x48')]['to']){_0x4459e4=_0x4c85c7[_0x42b7('0x48')]['to'][_0x42b7('0x4d')](',')[0x0];}return db[_0x42b7('0x4e')][_0x42b7('0x4f')]({'where':{'id':_0x46f246[_0x42b7('0x50')]},'include':[{'model':db['CmList'],'as':_0x42b7('0x51'),'include':[{'model':db[_0x42b7('0x52')],'as':_0x42b7('0x53'),'where':{'email':_0x4459e4},'limit':0x1,'order':[[_0x42b7('0x54'),_0x42b7('0x55')]]}]},{'model':db[_0x42b7('0x56')],'as':_0x42b7('0x57'),'raw':!![],'include':[{'model':db[_0x42b7('0x58')],'as':_0x42b7('0x58'),'raw':!![]}]}]})['then'](function(_0xde16e3){_0x2a1141=_0xde16e3;if(!_0x2a1141||!_0x2a1141[_0x42b7('0x57')])return;var _0x227d66=_0x2a1141[_0x42b7('0x59')]();if(_0x4c85c7[_0x42b7('0x48')]['attachments']&&_0x4c85c7[_0x42b7('0x48')]['attachments'][_0x42b7('0x37')]){for(var _0x2e3cc6=0x0;_0x2e3cc6<_0x4c85c7[_0x42b7('0x48')][_0x42b7('0x5a')]['length'];_0x2e3cc6+=0x1){_0x4c85c7['body'][_0x42b7('0x5a')][_0x2e3cc6]={'filename':_0x4c85c7[_0x42b7('0x48')][_0x42b7('0x5a')][_0x2e3cc6][_0x42b7('0x29')],'path':path[_0x42b7('0x5b')](config[_0x42b7('0x5c')],_0x42b7('0x5d'),_0x4c85c7['body'][_0x42b7('0x5a')][_0x2e3cc6][_0x42b7('0x5e')])};}}_0x5b1d83={'account':_0x227d66,'message':_0x4c85c7['body']};return;})[_0x42b7('0x25')](function(){if(_0x2a1141[_0x42b7('0x51')]){if(_0x2a1141[_0x42b7('0x51')][_0x42b7('0x53')][_0x42b7('0x37')]){return _0x2a1141[_0x42b7('0x51')][_0x42b7('0x53')][0x0];}else{return db[_0x42b7('0x52')]['create'](_['defaults'](_0x4c85c7[_0x42b7('0x48')],{'firstName':_0x4c85c7[_0x42b7('0x48')]['to'],'email':_0x4c85c7[_0x42b7('0x48')]['to'],'phone':_0x4c85c7[_0x42b7('0x48')]['to'],'ListId':_0x2a1141[_0x42b7('0x5f')]}));}}else{throw new Error(_0x42b7('0x60'));}})[_0x42b7('0x25')](function(){if(_0x5b1d83){return respondWithRpcPromise('SendMail',_0x42b7('0x61'),_0x5b1d83,client9003)['then'](function(_0x393770){return _0x46f246[_0x42b7('0x23')]({'read':!![],'messageId':_0x393770[_0x42b7('0x62')],'sentAt':moment()[_0x42b7('0x63')](_0x42b7('0x64'))});})[_0x42b7('0x1b')](function(_0x10c0c1){logger['error']('%s',JSON[_0x42b7('0x16')](_0x10c0c1));return _0x46f246;});}return _0x46f246;});}return _0x46f246;}})[_0x42b7('0x25')](respondWithResult(_0x2ba194,0xc9))['catch'](handleError(_0x2ba194,null));};exports[_0x42b7('0x65')]=function(_0x193686,_0x3162e9){var _0xb04353={'agent':{},'channel':_0x42b7('0x66')};if(_0x193686[_0x42b7('0x48')]['id']){delete _0x193686[_0x42b7('0x48')]['id'];}_0x193686[_0x42b7('0x48')]['read']=!![];_0x193686['body'][_0x42b7('0x67')]=moment()[_0x42b7('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x193686[_0x42b7('0x48')]['UserId']=_0x193686[_0x42b7('0x48')][_0x42b7('0x68')]||_0x193686['user']['id'];_0xb04353[_0x42b7('0x69')]['id']=_0x193686[_0x42b7('0x48')]['UserId'];return db[_0x42b7('0x2c')][_0x42b7('0x47')]({'where':{'id':_0x193686[_0x42b7('0x44')]['id'],'UserId':null}})[_0x42b7('0x25')](handleEntityNotFound(_0x3162e9,null))[_0x42b7('0x25')](saveUpdates(_0x193686[_0x42b7('0x48')],null))[_0x42b7('0x25')](function(_0x5901dc){if(_0x5901dc){_0xb04353[_0x42b7('0x19')]=_0x5901dc[_0x42b7('0x6a')]({'plain':!![]});return db[_0x42b7('0x6b')][_0x42b7('0x47')]({'where':{'id':_0x5901dc['MailInteractionId']}});}return null;})[_0x42b7('0x25')](handleEntityNotFound(_0x3162e9,null))[_0x42b7('0x25')](function(_0x9f4096){if(_0x9f4096){return _0x9f4096[_0x42b7('0x23')]({'UserId':_0x193686[_0x42b7('0x48')][_0x42b7('0x68')],'read1stAt':_['isNil'](_0x9f4096[_0x42b7('0x6c')])?moment()['format'](_0x42b7('0x64')):undefined});}return null;})['then'](function(_0x35ce9f){if(_0x35ce9f){_0xb04353[_0x42b7('0x6d')]=_0x35ce9f[_0x42b7('0x6a')]({'plain':!![]});interaction_log[_0x42b7('0x11')](_0x42b7('0x6e'),_0x193686[_0x42b7('0x6f')]['id'],_0x193686[_0x42b7('0x6f')][_0x42b7('0x29')],_0x193686[_0x42b7('0x6f')][_0x42b7('0x70')],_0xb04353[_0x42b7('0x6d')]['id'],_0x193686[_0x42b7('0x48')]?JSON['stringify'](_0x193686[_0x42b7('0x48')]):_0x42b7('0x71'));return respondWithRpcPromise(_0x42b7('0x72'),_0x42b7('0x73'),_0xb04353);}return null;})['then'](function(_0x2351c4){var _0x38ab33=_0x42b7('0x74')+_0x2351c4[_0x42b7('0x19')][_0x42b7('0x75')];return db['sequelize'][_0x42b7('0x31')](_0x38ab33,{'type':db['Sequelize'][_0x42b7('0x76')][_0x42b7('0x77')],'raw':!![]})[_0x42b7('0x25')](function(_0x20a656){return _0x20a656;});})[_0x42b7('0x25')](function(_0xcbdc4b){if(_0xcbdc4b){_0xb04353[_0x42b7('0x19')][_0x42b7('0x78')]=_0xcbdc4b[0x0];if(!_0x193686[_0x42b7('0x48')][_0x42b7('0x68')])return;return db[_0x42b7('0x79')]['find']({'where':{'id':_0x193686[_0x42b7('0x48')][_0x42b7('0x68')],'role':_0x42b7('0x69')},'attributes':['id','name',_0x42b7('0x7a'),'email',_0x42b7('0x7b')],'raw':!![]});}return null;})[_0x42b7('0x25')](function(_0x43ab98){if(!_0x43ab98)return null;_0xb04353[_0x42b7('0x19')]['agent']=_0x43ab98;return _0xb04353;})[_0x42b7('0x25')](function(_0x37c4e0){if(_0x37c4e0){if(_0x193686[_0x42b7('0x48')][_0x42b7('0x7c')]){_0xb04353[_0x42b7('0x19')][_0x42b7('0x7d')]=util['format'](_0x42b7('0x7e'),_0x193686[_0x42b7('0x6f')][_0x42b7('0x29')]);_0xb04353['message'][_0x42b7('0x7f')]=_0xb04353[_0x42b7('0x7f')];_0xb04353[_0x42b7('0x19')][_0x42b7('0x80')]=_0xb04353['channel'];_0xb04353[_0x42b7('0x19')]['event']='accept';_0xb04353[_0x42b7('0x19')][_0x42b7('0x48')]=htmlToText[_0x42b7('0x81')](_0xb04353[_0x42b7('0x19')][_0x42b7('0x48')]);return respondWithRpcPromise(_0x42b7('0x82'),'EventManager',{'event':'acceptmessage','message':_0xb04353[_0x42b7('0x19')]},client9002)[_0x42b7('0x25')](function(){return _0xb04353;});}return _0xb04353;}return null;})[_0x42b7('0x25')](respondWithResult(_0x3162e9,null))[_0x42b7('0x1b')](handleError(_0x3162e9,null));};exports[_0x42b7('0x83')]=function(_0x4643de,_0x5b08c4){var _0x3c9fc4={'agent':{},'channel':_0x42b7('0x66')};if(_0x4643de['body']['id']){delete _0x4643de[_0x42b7('0x48')]['id'];}_0x4643de[_0x42b7('0x48')][_0x42b7('0x68')]=_0x4643de['body'][_0x42b7('0x68')]||_0x4643de['user']['id'];_0x3c9fc4['agent']['id']=_0x4643de[_0x42b7('0x48')][_0x42b7('0x68')];return db[_0x42b7('0x2c')][_0x42b7('0x47')]({'where':{'id':_0x4643de[_0x42b7('0x44')]['id'],'UserId':null}})[_0x42b7('0x25')](handleEntityNotFound(_0x5b08c4,null))[_0x42b7('0x25')](function(_0xc5d641){if(_0xc5d641){_0x3c9fc4[_0x42b7('0x19')]=_0xc5d641[_0x42b7('0x6a')]({'plain':!![]});return db[_0x42b7('0x6b')]['find']({'where':{'id':_0xc5d641[_0x42b7('0x84')]}});}return null;})[_0x42b7('0x25')](handleEntityNotFound(_0x5b08c4,null))['then'](function(_0x298d44){if(_0x298d44){_0x3c9fc4[_0x42b7('0x6d')]=_0x298d44[_0x42b7('0x6a')]({'plain':!![]});interaction_log['info'](_0x42b7('0x85'),_0x4643de[_0x42b7('0x6f')]['id'],_0x4643de[_0x42b7('0x6f')]['name'],_0x4643de['user']['role'],_0x3c9fc4[_0x42b7('0x6d')]['id'],_0x4643de[_0x42b7('0x48')]?JSON[_0x42b7('0x16')](_0x4643de[_0x42b7('0x48')]):'null');return respondWithRpcPromise(_0x42b7('0x86'),'rejectMessage',_0x3c9fc4);}return null;})[_0x42b7('0x25')](function(_0x1142e1){var _0x5410ab=_0x42b7('0x74')+_0x1142e1[_0x42b7('0x19')][_0x42b7('0x75')];return db[_0x42b7('0x87')]['query'](_0x5410ab,{'type':db[_0x42b7('0x88')][_0x42b7('0x76')][_0x42b7('0x77')],'raw':!![]})['then'](function(_0x592f17){return _0x592f17;});})['then'](function(_0x34ee3f){if(_0x34ee3f){_0x3c9fc4[_0x42b7('0x19')][_0x42b7('0x78')]=_0x34ee3f[0x0];if(!_0x4643de['body']['UserId'])return;return db['User'][_0x42b7('0x47')]({'where':{'id':_0x4643de['body']['UserId'],'role':_0x42b7('0x69')},'attributes':['id',_0x42b7('0x29'),_0x42b7('0x7a'),_0x42b7('0x89'),_0x42b7('0x7b')],'raw':!![]});}return null;})[_0x42b7('0x25')](function(_0x30c0dd){if(!_0x30c0dd)return null;_0x3c9fc4[_0x42b7('0x19')][_0x42b7('0x69')]=_0x30c0dd;return _0x3c9fc4;})[_0x42b7('0x25')](function(_0x55949a){if(_0x55949a){_0x55949a['message'][_0x42b7('0x7d')]=util[_0x42b7('0x63')]('SIP/%s',_0x4643de[_0x42b7('0x6f')][_0x42b7('0x29')]);_0x55949a[_0x42b7('0x19')][_0x42b7('0x7f')]=_0x3c9fc4[_0x42b7('0x7f')];_0x55949a[_0x42b7('0x19')][_0x42b7('0x80')]=_0x3c9fc4['channel'];_0x55949a[_0x42b7('0x19')][_0x42b7('0x8a')]=_0x42b7('0x83');_0x55949a[_0x42b7('0x19')][_0x42b7('0x48')]=htmlToText[_0x42b7('0x81')](_0x3c9fc4[_0x42b7('0x19')][_0x42b7('0x48')]);respondWithRpcPromise(_0x42b7('0x82'),_0x42b7('0x82'),{'event':_0x42b7('0x8b'),'message':_0x55949a[_0x42b7('0x19')]},client9002);return _0x3c9fc4;}return null;})[_0x42b7('0x25')](respondWithResult(_0x5b08c4,null))['catch'](handleError(_0x5b08c4,null));};exports[_0x42b7('0x8c')]=function(_0x59969e,_0x14fa44){var _0x224179=moment()[_0x42b7('0x8d')]()['toString']();var _0x1c405f=path[_0x42b7('0x5b')](config[_0x42b7('0x5c')],_0x42b7('0x8e'),_0x42b7('0x8f'),'tmp');var _0x3937b6=path[_0x42b7('0x5b')](config['root'],_0x42b7('0x8e'),_0x42b7('0x8f'),_0x42b7('0x5a'));var _0x7ddf7b=util[_0x42b7('0x63')](_0x42b7('0x90'),_0x224179);return db[_0x42b7('0x2c')][_0x42b7('0x47')]({'where':{'id':_0x59969e[_0x42b7('0x44')]['id']},'attributes':['id','body',_0x42b7('0x91'),'to','cc',_0x42b7('0x92'),_0x42b7('0x93'),_0x42b7('0x94')],'include':_0x59969e['query'][_0x42b7('0x5a')]?[{'model':db[_0x42b7('0x95')],'as':_0x42b7('0x96')}]:undefined})['then'](handleEntityNotFound(_0x14fa44,null))[_0x42b7('0x25')](function(_0x8dbbc8){if(_0x8dbbc8){var _0x156a2f=_0x8dbbc8;var _0x3d71ff={'from':_0x156a2f[_0x42b7('0x91')],'to':_0x156a2f['to'],'subject':_0x156a2f[_0x42b7('0x93')],'html':htmlEntities['decode'](_0x156a2f[_0x42b7('0x48')]),'headers':{'Date':moment(_0x156a2f['createdAt'])[_0x42b7('0x63')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x8dbbc8['cc']){_0x3d71ff[_0x42b7('0x97')]['Cc']=_0x8dbbc8['cc'];}if(_0x8dbbc8[_0x42b7('0x92')]){_0x3d71ff[_0x42b7('0x97')][_0x42b7('0x98')]=_0x8dbbc8['bcc'];}return new BPromise(function(_0x5d4239,_0x391d62){if(_0x8dbbc8[_0x42b7('0x96')]){for(var _0x326b05=0x0;_0x326b05<_0x8dbbc8['Attachments'][_0x42b7('0x37')];_0x326b05++){var _0x5ce042=_0x8dbbc8[_0x42b7('0x96')][_0x326b05];var _0x6a1ea2=path[_0x42b7('0x5b')](_0x3937b6,_0x5ce042['basename']);if(fs[_0x42b7('0x99')](_0x6a1ea2)){_0x3d71ff['attachments'][_0x42b7('0x9a')]({'name':_0x5ce042[_0x42b7('0x29')],'contentType':_0x5ce042['type'],'data':fs['readFileSync'](_0x6a1ea2)});}}}emlformat[_0x42b7('0x9b')](_0x3d71ff,function(_0x353ade,_0x2fab2a){if(_0x353ade)return _0x391d62(_0x353ade);fs[_0x42b7('0x9c')](path[_0x42b7('0x5b')](_0x1c405f,_0x7ddf7b),_0x2fab2a);return _0x5d4239(_0x2fab2a);});});}})[_0x42b7('0x25')](function(_0xadce1e){if(_0xadce1e){return _0x14fa44[_0x42b7('0x8c')](path[_0x42b7('0x5b')](_0x1c405f,_0x7ddf7b),_0x7ddf7b,function(_0x36345f){if(!_0x36345f)fs['unlinkSync'](path['join'](_0x1c405f,_0x7ddf7b));});}})[_0x42b7('0x1b')](handleError(_0x14fa44,null));};
\ No newline at end of file
index abf0d17..bcfe98d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2058=['events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5759eb,_0x38f708){var _0x531e7a=function(_0x4dffb3){while(--_0x4dffb3){_0x5759eb['push'](_0x5759eb['shift']());}};_0x531e7a(++_0x38f708);}(_0x2058,0x140));var _0x8205=function(_0x42c069,_0xdfa0f9){_0x42c069=_0x42c069-0x0;var _0x4f0740=_0x2058[_0x42c069];return _0x4f0740;};'use strict';var EventEmitter=require(_0x8205('0x0'));var MailMessage=require(_0x8205('0x1'))['db'][_0x8205('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8205('0x3')](0x0);var events={'afterCreate':_0x8205('0x4'),'afterUpdate':'update','afterDestroy':_0x8205('0x5')};function emitEvent(_0x2d5c2b){return function(_0x5784fe,_0x20f82d,_0x5cfe5e){MailMessageEvents[_0x8205('0x6')](_0x2d5c2b+':'+_0x5784fe['id'],_0x5784fe);MailMessageEvents['emit'](_0x2d5c2b,_0x5784fe);_0x5cfe5e(null);};}for(var e in events){if(events[_0x8205('0x7')](e)){var event=events[e];MailMessage[_0x8205('0x8')](e,emitEvent(event));}}module[_0x8205('0x9')]=MailMessageEvents;
\ No newline at end of file
+var _0xc7ec=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x37ac4e,_0x3139f0){var _0x228486=function(_0x1bc945){while(--_0x1bc945){_0x37ac4e['push'](_0x37ac4e['shift']());}};_0x228486(++_0x3139f0);}(_0xc7ec,0xe7));var _0xcc7e=function(_0x1bc750,_0x23f442){_0x1bc750=_0x1bc750-0x0;var _0xcd51da=_0xc7ec[_0x1bc750];return _0xcd51da;};'use strict';var EventEmitter=require(_0xcc7e('0x0'));var MailMessage=require(_0xcc7e('0x1'))['db'][_0xcc7e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcc7e('0x3')](0x0);var events={'afterCreate':_0xcc7e('0x4'),'afterUpdate':_0xcc7e('0x5'),'afterDestroy':_0xcc7e('0x6')};function emitEvent(_0x11b34e){return function(_0x3c6905,_0x5657e6,_0x2c2cf2){MailMessageEvents[_0xcc7e('0x7')](_0x11b34e+':'+_0x3c6905['id'],_0x3c6905);MailMessageEvents[_0xcc7e('0x7')](_0x11b34e,_0x3c6905);_0x2c2cf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xcc7e('0x8')](e,emitEvent(event));}}module[_0xcc7e('0x9')]=MailMessageEvents;
\ No newline at end of file
index e957b80..baea322 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd848=['MailMessage','mail_messages','messageId','plainBody','fromString','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xd848,0xb4));var _0x8d84=function(_0x2387c5,_0xfcc74c){_0x2387c5=_0x2387c5-0x0;var _0x2c414c=_0xd848[_0x2387c5];return _0x2c414c;};'use strict';var _=require(_0x8d84('0x0'));var util=require(_0x8d84('0x1'));var logger=require(_0x8d84('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8d84('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8d84('0x4'));var rimraf=require(_0x8d84('0x5'));var config=require(_0x8d84('0x6'));var attributes=require('./mailMessage.attributes');module[_0x8d84('0x7')]=function(_0x32085c,_0x4c49ee){return _0x32085c[_0x8d84('0x8')](_0x8d84('0x9'),attributes,{'tableName':_0x8d84('0xa'),'paranoid':![],'indexes':[{'name':_0x8d84('0xb'),'fields':[_0x8d84('0xb')]},{'name':'fti_mail_messages','fields':[_0x8d84('0xc'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4912da,_0x10155f,_0x3fffa6){if(_0x4912da['body']){_0x4912da[_0x8d84('0xc')]=htmlToText[_0x8d84('0xd')](_0x4912da['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3fffa6(null,_0x10155f);},'afterCreate':function(_0x1de93f,_0x5aec39,_0x22210d){var _0x13bedf=_0x32085c['models'];var _0x5bd57d=_0x1de93f['get']({'plain':!![]});if(_0x5bd57d[_0x8d84('0xe')]['toLowerCase']()==='in'||_0x5bd57d[_0x8d84('0xe')][_0x8d84('0xf')]()===_0x8d84('0x10')&&!_0x5bd57d[_0x8d84('0x11')]&&!_[_0x8d84('0x12')](_0x5bd57d[_0x8d84('0x13')])){_0x13bedf[_0x8d84('0x14')][_0x8d84('0x15')]({'where':{'id':_0x5bd57d[_0x8d84('0x16')]}})[_0x8d84('0x17')](function(_0xbea767){if(_0xbea767){_0xbea767['update']({'lastMsgAt':_0x5bd57d[_0x8d84('0x18')],'lastMsgDirection':_0x5bd57d[_0x8d84('0xe')][_0x8d84('0xf')]()});}})['catch'](function(_0x3a901b){console[_0x8d84('0x19')](_0x3a901b);});}_0x22210d();}},'charset':'utf8mb4','collate':_0x8d84('0x1a')});};
\ No newline at end of file
+var _0x75bb=['UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil'];(function(_0x15881f,_0x13877b){var _0x53a886=function(_0x2405a5){while(--_0x2405a5){_0x15881f['push'](_0x15881f['shift']());}};_0x53a886(++_0x13877b);}(_0x75bb,0xdd));var _0xb75b=function(_0x4a07d4,_0x25d95f){_0x4a07d4=_0x4a07d4-0x0;var _0x53ee8a=_0x75bb[_0x4a07d4];return _0x53ee8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb75b('0x0'))(_0xb75b('0x1'));var moment=require(_0xb75b('0x2'));var BPromise=require(_0xb75b('0x3'));var rp=require('request-promise');var htmlToText=require(_0xb75b('0x4'));var fs=require('fs');var path=require(_0xb75b('0x5'));var rimraf=require(_0xb75b('0x6'));var config=require(_0xb75b('0x7'));var attributes=require(_0xb75b('0x8'));module[_0xb75b('0x9')]=function(_0xcd3cd4,_0x2536c4){return _0xcd3cd4[_0xb75b('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb75b('0xb')]},{'name':_0xb75b('0xc'),'fields':[_0xb75b('0xd'),_0xb75b('0xe')],'type':_0xb75b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x179fc2,_0x47fff0,_0x27907a){if(_0x179fc2[_0xb75b('0x10')]){_0x179fc2[_0xb75b('0xd')]=htmlToText[_0xb75b('0x11')](_0x179fc2[_0xb75b('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x27907a(null,_0x47fff0);},'afterCreate':function(_0x4a3989,_0x41153f,_0x5bb6a7){var _0x2528bd=_0xcd3cd4[_0xb75b('0x12')];var _0x5f3bc9=_0x4a3989[_0xb75b('0x13')]({'plain':!![]});if(_0x5f3bc9[_0xb75b('0x14')][_0xb75b('0x15')]()==='in'||_0x5f3bc9[_0xb75b('0x14')][_0xb75b('0x15')]()===_0xb75b('0x16')&&!_0x5f3bc9['secret']&&!_[_0xb75b('0x17')](_0x5f3bc9[_0xb75b('0x18')])){_0x2528bd[_0xb75b('0x19')][_0xb75b('0x1a')]({'where':{'id':_0x5f3bc9[_0xb75b('0x1b')]}})[_0xb75b('0x1c')](function(_0x4698ac){if(_0x4698ac){_0x4698ac[_0xb75b('0x1d')]({'lastMsgAt':_0x5f3bc9[_0xb75b('0x1e')],'lastMsgDirection':_0x5f3bc9[_0xb75b('0x14')]['toLowerCase']()});}})[_0xb75b('0x1f')](function(_0x341f2c){console[_0xb75b('0x20')](_0x341f2c);});}_0x5bb6a7();}},'charset':_0xb75b('0x21'),'collate':_0xb75b('0x22')});};
\ No newline at end of file
index ec82b06..5b69856 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x896e=['request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s'];(function(_0xf85781,_0x443952){var _0x57a21f=function(_0xa30d6b){while(--_0xa30d6b){_0xf85781['push'](_0xf85781['shift']());}};_0x57a21f(++_0x443952);}(_0x896e,0x1e9));var _0xe896=function(_0x350d7c,_0x308719){_0x350d7c=_0x350d7c-0x0;var _0x532e95=_0x896e[_0x350d7c];return _0x532e95;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});}exports[_0xe896('0x1d')]=function(_0x3ac8b8){var _0x388c2e=this;return new Promise(function(_0x32d3d3,_0x49547b){return db[_0xe896('0x1e')]['create'](_0x3ac8b8['body'],{'raw':_0x3ac8b8[_0xe896('0x1f')]?_0x3ac8b8[_0xe896('0x1f')][_0xe896('0x20')]===undefined?!![]:![]:!![]})[_0xe896('0x13')](function(_0x498469){logger[_0xe896('0x21')]('CreateMailMessage',_0x3ac8b8);logger['debug'](_0xe896('0x1d'),_0x3ac8b8,JSON[_0xe896('0x17')](_0x498469));_0x32d3d3(_0x498469);})[_0xe896('0x1c')](function(_0x2e2c10){logger[_0xe896('0x18')](_0xe896('0x1d'),_0x2e2c10[_0xe896('0x1a')],_0x3ac8b8);_0x49547b(_0x388c2e['error'](0x1f4,_0x2e2c10[_0xe896('0x1a')]));});});};
\ No newline at end of file
+var _0x9582=['client','http','redis','defaults','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x44ac38,_0x34ca5a){var _0x54c8b5=function(_0x4c4e8d){while(--_0x4c4e8d){_0x44ac38['push'](_0x44ac38['shift']());}};_0x54c8b5(++_0x34ca5a);}(_0x9582,0x95));var _0x2958=function(_0x30f766,_0x3cf140){_0x30f766=_0x30f766-0x0;var _0x4867e4=_0x9582[_0x30f766];return _0x4867e4;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});config[_0x2958('0xd')]=_[_0x2958('0xe')](config[_0x2958('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2958('0xd')]));require('./mailMessage.socket')[_0x2958('0xf')](socket);function respondWithRpcPromise(_0x51e460,_0x44cccc,_0x5ef23c){return new BPromise(function(_0x3aacfa,_0x29776c){return client[_0x2958('0x10')](_0x51e460,_0x5ef23c)[_0x2958('0x11')](function(_0x11ec8d){logger['info'](_0x2958('0x12'),_0x44cccc,_0x2958('0x13'));logger[_0x2958('0x14')](_0x2958('0x15'),_0x44cccc,_0x2958('0x13'),JSON[_0x2958('0x16')](_0x11ec8d));if(_0x11ec8d[_0x2958('0x17')]){if(_0x11ec8d[_0x2958('0x17')]['code']===0x1f4){logger[_0x2958('0x17')](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x29776c(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}logger['error'](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x3aacfa(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x44cccc,_0x2958('0x13'));_0x3aacfa(_0x11ec8d[_0x2958('0x19')][_0x2958('0x18')]);}})[_0x2958('0x1a')](function(_0x27599c){logger['error'](_0x2958('0x12'),_0x44cccc,_0x27599c);_0x29776c(_0x27599c);});});}exports[_0x2958('0x1b')]=function(_0x1a12fa){var _0x57b6c5=this;return new Promise(function(_0x1e77eb,_0x53b100){return db[_0x2958('0x1c')]['create'](_0x1a12fa['body'],{'raw':_0x1a12fa[_0x2958('0x1d')]?_0x1a12fa[_0x2958('0x1d')][_0x2958('0x1e')]===undefined?!![]:![]:!![]})[_0x2958('0x11')](function(_0x2202f8){logger[_0x2958('0x1f')](_0x2958('0x1b'),_0x1a12fa);logger[_0x2958('0x14')](_0x2958('0x1b'),_0x1a12fa,JSON[_0x2958('0x16')](_0x2202f8));_0x1e77eb(_0x2202f8);})[_0x2958('0x1a')](function(_0xd58ae1){logger[_0x2958('0x17')](_0x2958('0x1b'),_0xd58ae1[_0x2958('0x18')],_0x1a12fa);_0x53b100(_0x57b6c5['error'](0x1f4,_0xd58ae1['message']));});});};
\ No newline at end of file
index 03d3bd0..e7552c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd420=['emit','removeListener','register','length','./mailMessage.events','save','update'];(function(_0x473a76,_0x57d391){var _0x5e4440=function(_0x505a97){while(--_0x505a97){_0x473a76['push'](_0x473a76['shift']());}};_0x5e4440(++_0x57d391);}(_0xd420,0x1d9));var _0x0d42=function(_0x32f6f1,_0x1b7974){_0x32f6f1=_0x32f6f1-0x0;var _0x1d316c=_0xd420[_0x32f6f1];return _0x1d316c;};'use strict';var MailMessageEvents=require(_0x0d42('0x0'));var events=[_0x0d42('0x1'),'remove',_0x0d42('0x2')];function createListener(_0x269128,_0x2460f8){return function(_0x47c018){_0x2460f8[_0x0d42('0x3')](_0x269128,_0x47c018);};}function removeListener(_0x4661fd,_0xfbd987){return function(){MailMessageEvents[_0x0d42('0x4')](_0x4661fd,_0xfbd987);};}exports[_0x0d42('0x5')]=function(_0x31804f){for(var _0x1b3425=0x0,_0x46be19=events[_0x0d42('0x6')];_0x1b3425<_0x46be19;_0x1b3425++){var _0x494507=events[_0x1b3425];var _0x3fa332=createListener('mailMessage:'+_0x494507,_0x31804f);MailMessageEvents['on'](_0x494507,_0x3fa332);}};
\ No newline at end of file
+var _0x9cff=['save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x18bd6a,_0x16f14d){var _0x1957e2=function(_0x26ddec){while(--_0x26ddec){_0x18bd6a['push'](_0x18bd6a['shift']());}};_0x1957e2(++_0x16f14d);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x5701ba,_0x2fb60f){_0x5701ba=_0x5701ba-0x0;var _0x3f1567=_0x9cff[_0x5701ba];return _0x3f1567;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xf9cf('0x0'),_0xf9cf('0x1'),_0xf9cf('0x2')];function createListener(_0x55364a,_0x197da2){return function(_0x142fc6){_0x197da2[_0xf9cf('0x3')](_0x55364a,_0x142fc6);};}function removeListener(_0x5060e0,_0x2da91){return function(){MailMessageEvents[_0xf9cf('0x4')](_0x5060e0,_0x2da91);};}exports[_0xf9cf('0x5')]=function(_0x183113){for(var _0xcacbdc=0x0,_0x27e2b1=events[_0xf9cf('0x6')];_0xcacbdc<_0x27e2b1;_0xcacbdc++){var _0x19d7f9=events[_0xcacbdc];var _0x1c29f6=createListener(_0xf9cf('0x7')+_0x19d7f9,_0x183113);MailMessageEvents['on'](_0x19d7f9,_0x1c29f6);}};
\ No newline at end of file
index c508dca..54eee8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaaae=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/users','/:id','update','delete','destroy','/:id/teams','removeTeams','multer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xaaae,0x151));var _0xeaaa=function(_0x6315a2,_0x20e7c2){_0x6315a2=_0x6315a2-0x0;var _0x117e3b=_0xaaae[_0x6315a2];return _0x117e3b;};'use strict';var multer=require(_0xeaaa('0x0'));var util=require('util');var path=require(_0xeaaa('0x1'));var timeout=require(_0xeaaa('0x2'));var express=require('express');var router=express[_0xeaaa('0x3')]();var fs_extra=require(_0xeaaa('0x4'));var auth=require(_0xeaaa('0x5'));var interaction=require(_0xeaaa('0x6'));var config=require('../../config/environment');var controller=require(_0xeaaa('0x7'));router[_0xeaaa('0x8')]('/',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xa')]);router[_0xeaaa('0x8')](_0xeaaa('0xb'),auth[_0xeaaa('0x9')](),controller['describe']);router[_0xeaaa('0x8')]('/:id',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xc')]);router[_0xeaaa('0x8')](_0xeaaa('0xd'),auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xe')]);router[_0xeaaa('0x8')]('/:id/teams',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0xf')]);router[_0xeaaa('0x8')]('/:id/users',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0x10')]);router[_0xeaaa('0x11')]('/',auth['isAuthenticated'](),controller[_0xeaaa('0x12')]);router['post']('/:id/teams',auth[_0xeaaa('0x9')](),controller['addTeams']);router[_0xeaaa('0x11')](_0xeaaa('0x13'),auth[_0xeaaa('0x9')](),controller['addAgents']);router['put'](_0xeaaa('0x14'),auth[_0xeaaa('0x9')](),controller[_0xeaaa('0x15')]);router[_0xeaaa('0x16')]('/:id',auth[_0xeaaa('0x9')](),controller[_0xeaaa('0x17')]);router['delete'](_0xeaaa('0x18'),auth[_0xeaaa('0x9')](),controller[_0xeaaa('0x19')]);router[_0xeaaa('0x16')](_0xeaaa('0x13'),auth[_0xeaaa('0x9')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x5b27=['destroy','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','delete'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x5b27,0x1f0));var _0x75b2=function(_0x1acb50,_0x532124){_0x1acb50=_0x1acb50-0x0;var _0x470c18=_0x5b27[_0x1acb50];return _0x470c18;};'use strict';var multer=require(_0x75b2('0x0'));var util=require(_0x75b2('0x1'));var path=require(_0x75b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x75b2('0x3'));var router=express[_0x75b2('0x4')]();var fs_extra=require(_0x75b2('0x5'));var auth=require(_0x75b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x75b2('0x7'));var controller=require(_0x75b2('0x8'));router[_0x75b2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x75b2('0x9')](_0x75b2('0xa'),auth[_0x75b2('0xb')](),controller[_0x75b2('0xc')]);router[_0x75b2('0x9')](_0x75b2('0xd'),auth[_0x75b2('0xb')](),controller[_0x75b2('0xe')]);router[_0x75b2('0x9')](_0x75b2('0xf'),auth[_0x75b2('0xb')](),controller[_0x75b2('0x10')]);router[_0x75b2('0x9')](_0x75b2('0x11'),auth[_0x75b2('0xb')](),controller[_0x75b2('0x12')]);router[_0x75b2('0x9')](_0x75b2('0x13'),auth['isAuthenticated'](),controller[_0x75b2('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x75b2('0x15')]);router[_0x75b2('0x16')](_0x75b2('0x11'),auth['isAuthenticated'](),controller[_0x75b2('0x17')]);router[_0x75b2('0x16')]('/:id/users',auth[_0x75b2('0xb')](),controller['addAgents']);router[_0x75b2('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x75b2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x75b2('0x1a')]);router[_0x75b2('0x19')](_0x75b2('0x11'),auth[_0x75b2('0xb')](),controller[_0x75b2('0x1b')]);router['delete'](_0x75b2('0x13'),auth['isAuthenticated'](),controller[_0x75b2('0x1c')]);module['exports']=router;
\ No newline at end of file
index 86b68c8..e8fa61b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2031=['INTEGER','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x4781e5,_0x48d5f4){var _0x3f00b0=function(_0x4753cc){while(--_0x4753cc){_0x4781e5['push'](_0x4781e5['shift']());}};_0x3f00b0(++_0x48d5f4);}(_0x2031,0x12a));var _0x1203=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2031[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x1203('0x0')]={'name':{'type':Sequelize[_0x1203('0x1')],'unique':_0x1203('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1203('0x1')]},'timeout':{'type':Sequelize[_0x1203('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1203('0x4'),_0x1203('0x5'),_0x1203('0x6'))}};
\ No newline at end of file
+var _0x5e7f=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x48936c,_0x477494){var _0x27cf2a=function(_0x57731c){while(--_0x57731c){_0x48936c['push'](_0x48936c['shift']());}};_0x27cf2a(++_0x477494);}(_0x5e7f,0x78));var _0xf5e7=function(_0x19db71,_0x528dec){_0x19db71=_0x19db71-0x0;var _0xc71bae=_0x5e7f[_0x19db71];return _0xc71bae;};'use strict';var Sequelize=require(_0xf5e7('0x0'));module[_0xf5e7('0x1')]={'name':{'type':Sequelize[_0xf5e7('0x2')],'unique':_0xf5e7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf5e7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf5e7('0x4')](_0xf5e7('0x5'),_0xf5e7('0x6'),_0xf5e7('0x7'))}};
\ No newline at end of file
index b12363b..7b29188 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe207=['UserMailQueue','pick','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','findAll','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MailQueues','UserProfileResource','end','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne'];(function(_0x1599bf,_0x3cc1fb){var _0x2470f2=function(_0x555023){while(--_0x555023){_0x1599bf['push'](_0x1599bf['shift']());}};_0x2470f2(++_0x3cc1fb);}(_0xe207,0x154));var _0x7e20=function(_0x4de7b6,_0x3aef91){_0x4de7b6=_0x4de7b6-0x0;var _0x4c62b2=_0xe207[_0x4de7b6];return _0x4c62b2;};'use strict';var emlformat=require(_0x7e20('0x0'));var rimraf=require(_0x7e20('0x1'));var zipdir=require(_0x7e20('0x2'));var jsonpatch=require(_0x7e20('0x3'));var rp=require(_0x7e20('0x4'));var moment=require(_0x7e20('0x5'));var BPromise=require(_0x7e20('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7e20('0x7'));var fs=require('fs');var fs_extra=require(_0x7e20('0x8'));var _=require(_0x7e20('0x9'));var squel=require(_0x7e20('0xa'));var crypto=require(_0x7e20('0xb'));var jsforce=require(_0x7e20('0xc'));var deskjs=require(_0x7e20('0xd'));var toCsv=require(_0x7e20('0xe'));var querystring=require(_0x7e20('0xf'));var Papa=require(_0x7e20('0x10'));var Redis=require(_0x7e20('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7e20('0x12'));var as=require(_0x7e20('0x13'));var hardwareService=require(_0x7e20('0x14'));var logger=require('../../config/logger')(_0x7e20('0x15'));var utils=require(_0x7e20('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e20('0x17'));var db=require(_0x7e20('0x18'))['db'];config['redis']=_[_0x7e20('0x19')](config[_0x7e20('0x1a')],{'host':_0x7e20('0x1b'),'port':0x18eb});var socket=require(_0x7e20('0x1c'))(new Redis(config[_0x7e20('0x1a')]));require(_0x7e20('0x1d'))[_0x7e20('0x1e')](socket);function respondWithStatusCode(_0x29da2c,_0x59177c){_0x59177c=_0x59177c||0xcc;return function(_0x47327f){if(_0x47327f){return _0x29da2c[_0x7e20('0x1f')](_0x59177c);}return _0x29da2c[_0x7e20('0x20')](_0x59177c)['end']();};}function respondWithResult(_0x4313f8,_0x212b99){_0x212b99=_0x212b99||0xc8;return function(_0x355527){if(_0x355527){return _0x4313f8[_0x7e20('0x20')](_0x212b99)['json'](_0x355527);}};}function respondWithFilteredResult(_0x1c8314,_0x5c84a4){return function(_0x1438ec){if(_0x1438ec){var _0x446fca=typeof _0x5c84a4[_0x7e20('0x21')]===_0x7e20('0x22')&&typeof _0x5c84a4[_0x7e20('0x23')]===_0x7e20('0x22');var _0x3cd39c=_0x1438ec[_0x7e20('0x24')];var _0x529075=_0x446fca?0x0:_0x5c84a4[_0x7e20('0x21')];var _0x4f4af3=_0x446fca?_0x1438ec['count']:_0x5c84a4[_0x7e20('0x21')]+_0x5c84a4[_0x7e20('0x23')];var _0x54db0d;if(_0x4f4af3>=_0x3cd39c){_0x4f4af3=_0x3cd39c;_0x54db0d=0xc8;}else{_0x54db0d=0xce;}_0x1c8314[_0x7e20('0x20')](_0x54db0d);return _0x1c8314[_0x7e20('0x25')](_0x7e20('0x26'),_0x529075+'-'+_0x4f4af3+'/'+_0x3cd39c)['json'](_0x1438ec);}return null;};}function patchUpdates(_0x1429e9){return function(_0x308ef2){try{jsonpatch[_0x7e20('0x27')](_0x308ef2,_0x1429e9,!![]);}catch(_0x540b34){return BPromise['reject'](_0x540b34);}return _0x308ef2[_0x7e20('0x28')]();};}function saveUpdates(_0x98baba,_0x5e8fff){return function(_0x587025){if(_0x587025){return _0x587025[_0x7e20('0x29')](_0x98baba)[_0x7e20('0x2a')](function(_0x4a9959){return _0x4a9959;});}return null;};}function removeEntity(_0x48cfbf,_0x23cdc5){return function(_0x5700c0){if(_0x5700c0){return _0x5700c0[_0x7e20('0x2b')]()[_0x7e20('0x2a')](function(){var _0x24348a=_0x5700c0[_0x7e20('0x2c')]({'plain':!![]});var _0x1c5b3a=_0x7e20('0x2d');return db[_0x7e20('0x2e')][_0x7e20('0x2b')]({'where':{'type':_0x1c5b3a,'resourceId':_0x24348a['id']}})['then'](function(){return _0x5700c0;});})['then'](function(){_0x48cfbf['status'](0xcc)[_0x7e20('0x2f')]();});}};}function handleEntityNotFound(_0x343e71,_0x35208f){return function(_0xdc9d19){if(!_0xdc9d19){_0x343e71[_0x7e20('0x1f')](0x194);}return _0xdc9d19;};}function handleError(_0x3d3a67,_0x3ad43e){_0x3ad43e=_0x3ad43e||0x1f4;return function(_0x44cf46){logger['error'](_0x44cf46[_0x7e20('0x30')]);if(_0x44cf46[_0x7e20('0x31')]){delete _0x44cf46[_0x7e20('0x31')];}_0x3d3a67[_0x7e20('0x20')](_0x3ad43e)['send'](_0x44cf46);};}exports[_0x7e20('0x32')]=function(_0x4e8323,_0x1ecba7){var _0x102bc0={},_0x12c2c6={},_0x297cc2={'count':0x0,'rows':[]};var _0x5a2475=_[_0x7e20('0x33')](db[_0x7e20('0x34')][_0x7e20('0x35')],function(_0x420591){return{'name':_0x420591[_0x7e20('0x36')],'type':_0x420591['type'][_0x7e20('0x37')]};});_0x12c2c6[_0x7e20('0x38')]=_[_0x7e20('0x33')](_0x5a2475,_0x7e20('0x31'));_0x12c2c6[_0x7e20('0x39')]=_[_0x7e20('0x3a')](_0x4e8323[_0x7e20('0x39')]);_0x12c2c6[_0x7e20('0x3b')]=_[_0x7e20('0x3c')](_0x12c2c6[_0x7e20('0x38')],_0x12c2c6['query']);_0x102bc0[_0x7e20('0x3d')]=_[_0x7e20('0x3c')](_0x12c2c6[_0x7e20('0x38')],qs[_0x7e20('0x3e')](_0x4e8323[_0x7e20('0x39')][_0x7e20('0x3e')]));_0x102bc0[_0x7e20('0x3d')]=_0x102bc0['attributes']['length']?_0x102bc0[_0x7e20('0x3d')]:_0x12c2c6[_0x7e20('0x38')];if(!_0x4e8323[_0x7e20('0x39')][_0x7e20('0x3f')](_0x7e20('0x40'))){_0x102bc0[_0x7e20('0x23')]=qs[_0x7e20('0x23')](_0x4e8323[_0x7e20('0x39')][_0x7e20('0x23')]);_0x102bc0[_0x7e20('0x21')]=qs['offset'](_0x4e8323[_0x7e20('0x39')][_0x7e20('0x21')]);}_0x102bc0[_0x7e20('0x41')]=qs[_0x7e20('0x42')](_0x4e8323[_0x7e20('0x39')][_0x7e20('0x42')]);_0x102bc0[_0x7e20('0x43')]=qs[_0x7e20('0x3b')](_['pick'](_0x4e8323[_0x7e20('0x39')],_0x12c2c6[_0x7e20('0x3b')]),_0x5a2475);if(_0x4e8323[_0x7e20('0x39')][_0x7e20('0x44')]){_0x102bc0[_0x7e20('0x43')]=_['merge'](_0x102bc0[_0x7e20('0x43')],{'$or':_[_0x7e20('0x33')](_0x5a2475,function(_0x90f6bf){if(_0x90f6bf['type']!==_0x7e20('0x45')){var _0x308f95={};_0x308f95[_0x90f6bf[_0x7e20('0x31')]]={'$like':'%'+_0x4e8323[_0x7e20('0x39')][_0x7e20('0x44')]+'%'};return _0x308f95;}})});}_0x102bc0=_[_0x7e20('0x46')]({},_0x102bc0,_0x4e8323[_0x7e20('0x47')]);var _0x2ac40a={'where':_0x102bc0[_0x7e20('0x43')]};return db[_0x7e20('0x34')][_0x7e20('0x24')](_0x2ac40a)['then'](function(_0x4968ba){_0x297cc2[_0x7e20('0x24')]=_0x4968ba;if(_0x4e8323[_0x7e20('0x39')]['includeAll']){_0x102bc0[_0x7e20('0x48')]=[{'all':!![]}];}return db[_0x7e20('0x34')]['findAll'](_0x102bc0);})[_0x7e20('0x2a')](function(_0x3d4cdc){_0x297cc2[_0x7e20('0x49')]=_0x3d4cdc;return _0x297cc2;})[_0x7e20('0x2a')](respondWithFilteredResult(_0x1ecba7,_0x102bc0))[_0x7e20('0x4a')](handleError(_0x1ecba7,null));};exports[_0x7e20('0x4b')]=function(_0x275a76,_0x25dcd3){var _0x7af5af={'raw':!![],'where':{'id':_0x275a76['params']['id']}},_0xeb39fd={};_0xeb39fd['model']=_['keys'](db['MailQueue'][_0x7e20('0x35')]);_0xeb39fd['query']=_['keys'](_0x275a76[_0x7e20('0x39')]);_0xeb39fd[_0x7e20('0x3b')]=_['intersection'](_0xeb39fd['model'],_0xeb39fd['query']);_0x7af5af['attributes']=_[_0x7e20('0x3c')](_0xeb39fd[_0x7e20('0x38')],qs['fields'](_0x275a76[_0x7e20('0x39')]['fields']));_0x7af5af[_0x7e20('0x3d')]=_0x7af5af[_0x7e20('0x3d')][_0x7e20('0x4c')]?_0x7af5af[_0x7e20('0x3d')]:_0xeb39fd[_0x7e20('0x38')];if(_0x275a76[_0x7e20('0x39')][_0x7e20('0x4d')]){_0x7af5af['include']=[{'all':!![]}];}_0x7af5af=_[_0x7e20('0x46')]({},_0x7af5af,_0x275a76[_0x7e20('0x47')]);return db[_0x7e20('0x34')][_0x7e20('0x4e')](_0x7af5af)[_0x7e20('0x2a')](handleEntityNotFound(_0x25dcd3,null))[_0x7e20('0x2a')](respondWithResult(_0x25dcd3,null))[_0x7e20('0x4a')](handleError(_0x25dcd3,null));};exports[_0x7e20('0x4f')]=function(_0xa1552e,_0x536506){return db[_0x7e20('0x34')][_0x7e20('0x4f')](_0xa1552e[_0x7e20('0x50')],{})[_0x7e20('0x2a')](function(_0xc6b339){var _0x3375ae=_0xa1552e[_0x7e20('0x51')]['get']({'plain':!![]});if(!_0x3375ae)throw new Error(_0x7e20('0x52'));if(_0x3375ae['role']===_0x7e20('0x51')){var _0x18302b=_0xc6b339['get']({'plain':!![]});var _0x21898b=_0x7e20('0x2d');return db[_0x7e20('0x53')][_0x7e20('0x4e')]({'where':{'name':_0x21898b,'userProfileId':_0x3375ae[_0x7e20('0x54')]},'raw':!![]})['then'](function(_0x12f131){if(_0x12f131&&_0x12f131[_0x7e20('0x55')]===0x0){return db[_0x7e20('0x2e')][_0x7e20('0x4f')]({'name':_0x18302b['name'],'resourceId':_0x18302b['id'],'type':_0x12f131[_0x7e20('0x31')],'sectionId':_0x12f131['id']},{})['then'](function(){return _0xc6b339;});}else{return _0xc6b339;}})[_0x7e20('0x4a')](function(_0x4f7749){logger[_0x7e20('0x56')](_0x7e20('0x57'),_0x4f7749);throw _0x4f7749;});}return _0xc6b339;})[_0x7e20('0x2a')](respondWithResult(_0x536506,0xc9))['catch'](handleError(_0x536506,null));};exports['update']=function(_0x58eefe,_0x4cfb26){if(_0x58eefe[_0x7e20('0x50')]['id']){delete _0x58eefe['body']['id'];}return db[_0x7e20('0x34')][_0x7e20('0x4e')]({'where':{'id':_0x58eefe[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](handleEntityNotFound(_0x4cfb26,null))[_0x7e20('0x2a')](saveUpdates(_0x58eefe[_0x7e20('0x50')],null))[_0x7e20('0x2a')](respondWithResult(_0x4cfb26,null))[_0x7e20('0x4a')](handleError(_0x4cfb26,null));};exports[_0x7e20('0x2b')]=function(_0x298223,_0x274875){return db[_0x7e20('0x34')][_0x7e20('0x4e')]({'where':{'id':_0x298223[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](handleEntityNotFound(_0x274875,null))[_0x7e20('0x2a')](removeEntity(_0x274875,null))[_0x7e20('0x4a')](handleError(_0x274875,null));};exports[_0x7e20('0x59')]=function(_0x1f2825,_0x2d125){return db['MailQueue'][_0x7e20('0x59')]()[_0x7e20('0x2a')](respondWithResult(_0x2d125,null))['catch'](handleError(_0x2d125,null));};exports[_0x7e20('0x5a')]=function(_0x556ed7,_0x5931a4,_0x530a50){var _0x5b8701={'raw':!![],'where':{}},_0x106b34={},_0x4cc730;return db['MailQueue'][_0x7e20('0x5b')]({'where':{'id':_0x556ed7[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](handleEntityNotFound(_0x5931a4,null))[_0x7e20('0x2a')](function(_0x531958){if(_0x531958){_0x4cc730=_0x531958[_0x7e20('0x2c')]({'plain':!![]});_0x106b34[_0x7e20('0x38')]=_['keys'](db[_0x7e20('0x5c')][_0x7e20('0x35')]);_0x106b34[_0x7e20('0x39')]=_[_0x7e20('0x3a')](_0x556ed7[_0x7e20('0x39')]);_0x106b34[_0x7e20('0x3b')]=_[_0x7e20('0x3c')](_0x106b34[_0x7e20('0x38')],_0x106b34[_0x7e20('0x39')]);_0x5b8701['attributes']=_['intersection'](_0x106b34[_0x7e20('0x38')],qs[_0x7e20('0x3e')](_0x556ed7['query'][_0x7e20('0x3e')]));_0x5b8701[_0x7e20('0x3d')]=_0x5b8701[_0x7e20('0x3d')][_0x7e20('0x4c')]?_0x5b8701[_0x7e20('0x3d')]:_0x106b34[_0x7e20('0x38')];if(!_0x556ed7[_0x7e20('0x39')][_0x7e20('0x3f')](_0x7e20('0x40'))){_0x5b8701[_0x7e20('0x23')]=qs[_0x7e20('0x23')](_0x556ed7[_0x7e20('0x39')][_0x7e20('0x23')]);_0x5b8701[_0x7e20('0x21')]=qs[_0x7e20('0x21')](_0x556ed7[_0x7e20('0x39')][_0x7e20('0x21')]);}_0x5b8701[_0x7e20('0x41')]=qs[_0x7e20('0x42')](_0x556ed7[_0x7e20('0x39')][_0x7e20('0x42')]);_0x5b8701['where']=qs[_0x7e20('0x3b')](_[_0x7e20('0x5d')](_0x556ed7[_0x7e20('0x39')],_0x106b34['filters']));_0x5b8701[_0x7e20('0x43')][_0x7e20('0x5e')]=_0x531958['id'];if(_0x556ed7[_0x7e20('0x39')][_0x7e20('0x44')]){_0x5b8701[_0x7e20('0x43')]=_[_0x7e20('0x46')](_0x5b8701['where'],{'$or':_[_0x7e20('0x33')](_0x5b8701[_0x7e20('0x3d')],function(_0x5d929a){var _0xbb1e22={};_0xbb1e22[_0x5d929a]={'$like':'%'+_0x556ed7[_0x7e20('0x39')][_0x7e20('0x44')]+'%'};return _0xbb1e22;})});}_0x5b8701=_[_0x7e20('0x46')]({},_0x5b8701,_0x556ed7[_0x7e20('0x47')]);return db[_0x7e20('0x5c')]['findAll'](_0x5b8701);}})['then'](function(_0x2b61c2){if(_0x2b61c2){return db[_0x7e20('0x5f')][_0x7e20('0x60')]({'where':{'id':_['map'](_0x2b61c2,'UserId'),'role':_0x7e20('0x61')},'attributes':['id',_0x7e20('0x31'),_0x7e20('0x62'),_0x7e20('0x63'),_0x7e20('0x64')]});}})[_0x7e20('0x2a')](function(_0x25983d){if(_0x25983d){return{'count':_0x25983d[_0x7e20('0x24')],'rows':_['map'](_0x25983d['rows'],function(_0x2b92b7){return{'membername':_0x2b92b7[_0x7e20('0x31')],'UserId':_0x2b92b7['id'],'queue_name':_0x4cc730['name'],'MailQueueId':_0x4cc730['id'],'interface':util[_0x7e20('0x65')]('%s/%s',_0x7e20('0x66'),_0x2b92b7[_0x7e20('0x31')]),'penalty':0x0,'paused':_0x2b92b7[_0x7e20('0x62')],'createdAt':_0x2b92b7[_0x7e20('0x64')],'updatedAt':_0x2b92b7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e20('0x2a')](respondWithFilteredResult(_0x5931a4,_0x5b8701))[_0x7e20('0x4a')](handleError(_0x5931a4,null));};exports[_0x7e20('0x67')]=function(_0x4c5259,_0x453c64,_0x5d4d58){var _0x2a4529={};var _0x2c3bce={};var _0x21be9c;var _0x59663d;return db[_0x7e20('0x34')][_0x7e20('0x5b')]({'where':{'id':_0x4c5259[_0x7e20('0x58')]['id']}})['then'](handleEntityNotFound(_0x453c64,null))[_0x7e20('0x2a')](function(_0xcd9300){if(_0xcd9300){_0x21be9c=_0xcd9300;_0x2c3bce[_0x7e20('0x38')]=_[_0x7e20('0x3a')](db[_0x7e20('0x68')][_0x7e20('0x35')]);_0x2c3bce[_0x7e20('0x39')]=_[_0x7e20('0x3a')](_0x4c5259[_0x7e20('0x39')]);_0x2c3bce[_0x7e20('0x3b')]=_[_0x7e20('0x3c')](_0x2c3bce['model'],_0x2c3bce[_0x7e20('0x39')]);_0x2a4529[_0x7e20('0x3d')]=_[_0x7e20('0x3c')](_0x2c3bce[_0x7e20('0x38')],qs['fields'](_0x4c5259[_0x7e20('0x39')][_0x7e20('0x3e')]));_0x2a4529[_0x7e20('0x3d')]=_0x2a4529[_0x7e20('0x3d')]['length']?_0x2a4529['attributes']:_0x2c3bce[_0x7e20('0x38')];_0x2a4529['order']=qs[_0x7e20('0x42')](_0x4c5259[_0x7e20('0x39')][_0x7e20('0x42')]);_0x2a4529['where']=qs[_0x7e20('0x3b')](_[_0x7e20('0x5d')](_0x4c5259[_0x7e20('0x39')],_0x2c3bce['filters']));if(_0x4c5259[_0x7e20('0x39')]['filter']){_0x2a4529['where']=_['merge'](_0x2a4529[_0x7e20('0x43')],{'$or':_['map'](_0x2a4529[_0x7e20('0x3d')],function(_0x321525){var _0x497e1e={};_0x497e1e[_0x321525]={'$like':'%'+_0x4c5259[_0x7e20('0x39')]['filter']+'%'};return _0x497e1e;})});}_0x2a4529=_[_0x7e20('0x46')]({},_0x2a4529,_0x4c5259['options']);return _0x21be9c[_0x7e20('0x67')](_0x2a4529);}})['then'](function(_0x358fc7){if(_0x358fc7){_0x59663d=_0x358fc7[_0x7e20('0x4c')];if(!_0x4c5259[_0x7e20('0x39')][_0x7e20('0x3f')](_0x7e20('0x40'))){_0x2a4529[_0x7e20('0x23')]=qs[_0x7e20('0x23')](_0x4c5259['query'][_0x7e20('0x23')]);_0x2a4529[_0x7e20('0x21')]=qs['offset'](_0x4c5259[_0x7e20('0x39')][_0x7e20('0x21')]);}return _0x21be9c[_0x7e20('0x67')](_0x2a4529);}})[_0x7e20('0x2a')](function(_0x12a57b){if(_0x12a57b){return _0x12a57b?{'count':_0x59663d,'rows':_0x12a57b}:null;}})[_0x7e20('0x2a')](respondWithResult(_0x453c64,null))[_0x7e20('0x4a')](handleError(_0x453c64,null));};exports[_0x7e20('0x69')]=function(_0x21c94f,_0x58da04,_0x4989c4){var _0x3b3109=_0x21c94f[_0x7e20('0x50')][_0x7e20('0x6a')];return db[_0x7e20('0x68')][_0x7e20('0x6b')]({'where':{'id':_0x3b3109},'attributes':['id'],'include':[{'model':db[_0x7e20('0x5f')],'as':_0x7e20('0x6c'),'attributes':['id',_0x7e20('0x31'),_0x7e20('0x6d'),_0x7e20('0x6e'),_0x7e20('0x6f')],'raw':!![]}]})[_0x7e20('0x2a')](function(_0x12fe0d){if(_0x12fe0d){var _0x27c544=_['flatMap'](_0x12fe0d,function(_0x5d5e42){var _0x357aa5=_0x5d5e42[_0x7e20('0x2c')]({'plain':!![]});return _0x357aa5[_0x7e20('0x6c')];});return db[_0x7e20('0x34')]['find']({'where':{'id':_0x21c94f[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](function(_0x58d9be){return db[_0x7e20('0x70')][_0x7e20('0x71')](function(_0x255659){return _0x58d9be[_0x7e20('0x69')](_0x3b3109,{'transaction':_0x255659})[_0x7e20('0x2a')](function(){return BPromise['each'](_0x27c544,function(_0x14caa7){return db[_0x7e20('0x5c')][_0x7e20('0x72')]({'where':{'UserId':_0x14caa7['id'],'MailQueueId':_0x21c94f[_0x7e20('0x58')]['id']},'transaction':_0x255659});});})[_0x7e20('0x2a')](function(){_0x27c544[_0x7e20('0x73')](function(_0x260305){socket[_0x7e20('0x74')]('userMailQueue:save',{'UserId':_0x260305['id'],'MailQueueId':_0x58d9be['id']});});});});});}})[_0x7e20('0x2a')](respondWithStatusCode(_0x58da04,null))[_0x7e20('0x4a')](handleError(_0x58da04,null));};exports['removeTeams']=function(_0x3b1a4a,_0x5e3e29,_0x5e68ae){return db[_0x7e20('0x68')]['findAll']({'where':{'id':_0x3b1a4a[_0x7e20('0x39')][_0x7e20('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7e20('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e3e29,null))[_0x7e20('0x2a')](function(_0x3d77ce){var _0x5ba2df=_[_0x7e20('0x33')](_0x3d77ce,'id');var _0x132d1a=[];var _0x2edc20=[];var _0x437cfb=squel[_0x7e20('0x75')]();_0x437cfb[_0x7e20('0x76')](_0x7e20('0x77'))['from']('team_has_mail_queues','tq')[_0x7e20('0x78')](_0x7e20('0x79'),'ut',_0x7e20('0x7a'))['where'](_0x7e20('0x7b'),_0x3b1a4a[_0x7e20('0x58')]['id']);for(var _0x3b1cd1=0x0;_0x3b1cd1<_0x3d77ce[_0x7e20('0x4c')];_0x3b1cd1+=0x1){let _0x364293=_0x3d77ce[_0x3b1cd1];for(var _0x481360=0x0;_0x481360<_0x364293[_0x7e20('0x6c')][_0x7e20('0x4c')];_0x481360+=0x1){let _0x2d6d49=_0x364293[_0x7e20('0x6c')][_0x481360];var _0x2b6326=_0x437cfb[_0x7e20('0x7c')]();_0x2b6326[_0x7e20('0x43')](_0x7e20('0x7d'),_0x2d6d49['id']);_0x2edc20[_0x7e20('0x7e')](db[_0x7e20('0x70')][_0x7e20('0x39')](_0x2b6326['toString'](),{'type':db['sequelize'][_0x7e20('0x7f')][_0x7e20('0x80')]})[_0x7e20('0x2a')](function(_0x258854){if(_0x258854[_0x7e20('0x4c')]===0x1){return _0x2d6d49['id'];}else{var _0x1fb8ce=_['every'](_[_0x7e20('0x33')](_0x258854,_0x7e20('0x81')),function(_0x4e1806){return _[_0x7e20('0x82')](_0x5ba2df,_0x4e1806);});if(_0x1fb8ce){return _0x2d6d49['id'];}}}));}}return BPromise['all'](_0x2edc20)[_0x7e20('0x2a')](function(_0xa8a49e){_0x132d1a=_(_0x132d1a)[_0x7e20('0x83')](_0xa8a49e)[_0x7e20('0x84')]()[_0x7e20('0x85')]();return db[_0x7e20('0x34')][_0x7e20('0x4e')]({'where':{'id':_0x3b1a4a[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](function(_0x5762df){return db[_0x7e20('0x70')][_0x7e20('0x71')](function(_0x3e4b5f){return _0x5762df[_0x7e20('0x86')](_0x3b1a4a[_0x7e20('0x39')]['ids'],{'transaction':_0x3e4b5f})[_0x7e20('0x2a')](function(){if(!_[_0x7e20('0x87')](_0x132d1a)){return _0x5762df['removeAgents'](_0x132d1a,{'transaction':_0x3e4b5f});}})[_0x7e20('0x2a')](function(){_0x132d1a[_0x7e20('0x73')](function(_0xe03ebe){socket['emit'](_0x7e20('0x88'),{'UserId':_0xe03ebe,'MailQueueId':_0x5762df['id']});});});});});});})[_0x7e20('0x2a')](respondWithStatusCode(_0x5e3e29,null))[_0x7e20('0x4a')](handleError(_0x5e3e29,null));};exports[_0x7e20('0x89')]=function(_0x62e7a7,_0x22b2bf,_0x5e13db){return db[_0x7e20('0x34')][_0x7e20('0x4e')]({'where':{'id':_0x62e7a7[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](handleEntityNotFound(_0x22b2bf,null))[_0x7e20('0x2a')](function(_0x530e97){if(_0x530e97){return _0x530e97[_0x7e20('0x89')](_0x62e7a7[_0x7e20('0x50')]['ids'],_[_0x7e20('0x8a')](_0x62e7a7[_0x7e20('0x50')],['ids','id'])||{})[_0x7e20('0x8b')](function(_0x45fcf6){for(var _0x24cc6a=0x0;_0x24cc6a<_0x62e7a7['body'][_0x7e20('0x6a')][_0x7e20('0x4c')];_0x24cc6a+=0x1){socket[_0x7e20('0x74')](_0x7e20('0x8c'),{'UserId':Number(_0x62e7a7[_0x7e20('0x50')][_0x7e20('0x6a')][_0x24cc6a]),'MailQueueId':Number(_0x62e7a7['params']['id'])});}return _0x45fcf6;});}})['then'](respondWithResult(_0x22b2bf,null))['catch'](handleError(_0x22b2bf,null));};exports[_0x7e20('0x8d')]=function(_0x4e8f4f,_0x329d8e,_0xb98721){return db['MailQueue'][_0x7e20('0x4e')]({'where':{'id':_0x4e8f4f[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](handleEntityNotFound(_0x329d8e,null))[_0x7e20('0x2a')](function(_0x4eae2d){if(_0x4eae2d){return _0x4eae2d['removeAgents'](_0x4e8f4f[_0x7e20('0x39')][_0x7e20('0x6a')])[_0x7e20('0x2a')](function(){if(_[_0x7e20('0x8e')](_0x4e8f4f[_0x7e20('0x39')][_0x7e20('0x6a')])){for(var _0x514166=0x0;_0x514166<_0x4e8f4f[_0x7e20('0x39')]['ids']['length'];_0x514166+=0x1){socket['emit'](_0x7e20('0x88'),{'UserId':Number(_0x4e8f4f[_0x7e20('0x39')][_0x7e20('0x6a')][_0x514166]),'MailQueueId':Number(_0x4e8f4f[_0x7e20('0x58')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4e8f4f['query']['ids']),'MailQueueId':Number(_0x4e8f4f[_0x7e20('0x58')]['id'])});}});}})[_0x7e20('0x2a')](respondWithStatusCode(_0x329d8e,null))['catch'](handleError(_0x329d8e,null));};exports[_0x7e20('0x8f')]=function(_0x40e25a,_0xc1aaf9,_0x38f537){var _0x1d49de={};var _0x5988a4={};var _0x446f8c;var _0x4704d8;return db['MailQueue'][_0x7e20('0x5b')]({'where':{'id':_0x40e25a[_0x7e20('0x58')]['id']}})[_0x7e20('0x2a')](handleEntityNotFound(_0xc1aaf9,null))['then'](function(_0x32755d){if(_0x32755d){_0x446f8c=_0x32755d;_0x5988a4[_0x7e20('0x38')]=_[_0x7e20('0x3a')](db[_0x7e20('0x5f')][_0x7e20('0x35')]);_0x5988a4[_0x7e20('0x39')]=_[_0x7e20('0x3a')](_0x40e25a[_0x7e20('0x39')]);_0x5988a4[_0x7e20('0x3b')]=_[_0x7e20('0x3c')](_0x5988a4[_0x7e20('0x38')],_0x5988a4[_0x7e20('0x39')]);_0x1d49de['attributes']=_['intersection'](_0x5988a4[_0x7e20('0x38')],qs[_0x7e20('0x3e')](_0x40e25a[_0x7e20('0x39')][_0x7e20('0x3e')]));_0x1d49de[_0x7e20('0x3d')]=_0x1d49de[_0x7e20('0x3d')][_0x7e20('0x4c')]?_0x1d49de['attributes']:_0x5988a4[_0x7e20('0x38')];_0x1d49de[_0x7e20('0x41')]=qs[_0x7e20('0x42')](_0x40e25a[_0x7e20('0x39')][_0x7e20('0x42')]);_0x1d49de[_0x7e20('0x43')]=qs[_0x7e20('0x3b')](_[_0x7e20('0x5d')](_0x40e25a[_0x7e20('0x39')],_0x5988a4[_0x7e20('0x3b')]));if(_0x40e25a[_0x7e20('0x39')][_0x7e20('0x44')]){_0x1d49de[_0x7e20('0x43')]=_[_0x7e20('0x46')](_0x1d49de['where'],{'$or':_[_0x7e20('0x33')](_0x1d49de[_0x7e20('0x3d')],function(_0x26117b){var _0x1b9a1a={};_0x1b9a1a[_0x26117b]={'$like':'%'+_0x40e25a['query'][_0x7e20('0x44')]+'%'};return _0x1b9a1a;})});}_0x1d49de=_[_0x7e20('0x46')]({},_0x1d49de,_0x40e25a[_0x7e20('0x47')]);return _0x446f8c[_0x7e20('0x8f')](_0x1d49de);}})[_0x7e20('0x2a')](function(_0x3a16a3){if(_0x3a16a3){_0x4704d8=_0x3a16a3[_0x7e20('0x4c')];if(!_0x40e25a[_0x7e20('0x39')]['hasOwnProperty'](_0x7e20('0x40'))){_0x1d49de['limit']=qs[_0x7e20('0x23')](_0x40e25a[_0x7e20('0x39')]['limit']);_0x1d49de[_0x7e20('0x21')]=qs['offset'](_0x40e25a[_0x7e20('0x39')][_0x7e20('0x21')]);}return _0x446f8c[_0x7e20('0x8f')](_0x1d49de);}})[_0x7e20('0x2a')](function(_0x8cfab4){if(_0x8cfab4){return _0x8cfab4?{'count':_0x4704d8,'rows':_0x8cfab4}:null;}})[_0x7e20('0x2a')](respondWithResult(_0xc1aaf9,null))[_0x7e20('0x4a')](handleError(_0xc1aaf9,null));};
\ No newline at end of file
+var _0xff30=['destroy','then','get','MailQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','MailQueue','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserMailQueue','hasOwnProperty','MailQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','nolimit','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xff30,0x104));var _0x0ff3=function(_0x135d93,_0x3552e3){_0x135d93=_0x135d93-0x0;var _0x1fbde5=_0xff30[_0x135d93];return _0x1fbde5;};'use strict';var emlformat=require(_0x0ff3('0x0'));var rimraf=require(_0x0ff3('0x1'));var zipdir=require(_0x0ff3('0x2'));var jsonpatch=require(_0x0ff3('0x3'));var rp=require(_0x0ff3('0x4'));var moment=require(_0x0ff3('0x5'));var BPromise=require(_0x0ff3('0x6'));var Mustache=require(_0x0ff3('0x7'));var util=require(_0x0ff3('0x8'));var path=require(_0x0ff3('0x9'));var sox=require(_0x0ff3('0xa'));var csv=require(_0x0ff3('0xb'));var ejs=require(_0x0ff3('0xc'));var fs=require('fs');var fs_extra=require(_0x0ff3('0xd'));var _=require(_0x0ff3('0xe'));var squel=require(_0x0ff3('0xf'));var crypto=require(_0x0ff3('0x10'));var jsforce=require(_0x0ff3('0x11'));var deskjs=require(_0x0ff3('0x12'));var toCsv=require('to-csv');var querystring=require(_0x0ff3('0x13'));var Papa=require(_0x0ff3('0x14'));var Redis=require(_0x0ff3('0x15'));var authService=require(_0x0ff3('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x0ff3('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ff3('0x18'))(_0x0ff3('0x19'));var utils=require(_0x0ff3('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ff3('0x1b'))['db'];config[_0x0ff3('0x1c')]=_[_0x0ff3('0x1d')](config[_0x0ff3('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ff3('0x1e'))(new Redis(config[_0x0ff3('0x1c')]));require('./mailQueue.socket')[_0x0ff3('0x1f')](socket);function respondWithStatusCode(_0x142012,_0x96a3e1){_0x96a3e1=_0x96a3e1||0xcc;return function(_0x4b828d){if(_0x4b828d){return _0x142012[_0x0ff3('0x20')](_0x96a3e1);}return _0x142012[_0x0ff3('0x21')](_0x96a3e1)['end']();};}function respondWithResult(_0x25b6b4,_0x47b25b){_0x47b25b=_0x47b25b||0xc8;return function(_0x5b7021){if(_0x5b7021){return _0x25b6b4[_0x0ff3('0x21')](_0x47b25b)[_0x0ff3('0x22')](_0x5b7021);}};}function respondWithFilteredResult(_0x243351,_0x54294f){return function(_0x30307a){if(_0x30307a){var _0x21a357=typeof _0x54294f[_0x0ff3('0x23')]===_0x0ff3('0x24')&&typeof _0x54294f[_0x0ff3('0x25')]==='undefined';var _0x5cb310=_0x30307a[_0x0ff3('0x26')];var _0x25e25c=_0x21a357?0x0:_0x54294f['offset'];var _0x5c9125=_0x21a357?_0x30307a['count']:_0x54294f[_0x0ff3('0x23')]+_0x54294f[_0x0ff3('0x25')];var _0x2e2ee9;if(_0x5c9125>=_0x5cb310){_0x5c9125=_0x5cb310;_0x2e2ee9=0xc8;}else{_0x2e2ee9=0xce;}_0x243351[_0x0ff3('0x21')](_0x2e2ee9);return _0x243351[_0x0ff3('0x27')](_0x0ff3('0x28'),_0x25e25c+'-'+_0x5c9125+'/'+_0x5cb310)[_0x0ff3('0x22')](_0x30307a);}return null;};}function patchUpdates(_0x3649a6){return function(_0x5ce2f4){try{jsonpatch[_0x0ff3('0x29')](_0x5ce2f4,_0x3649a6,!![]);}catch(_0xfcf74a){return BPromise[_0x0ff3('0x2a')](_0xfcf74a);}return _0x5ce2f4[_0x0ff3('0x2b')]();};}function saveUpdates(_0x53b0b3,_0x12f2bd){return function(_0x5c4c14){if(_0x5c4c14){return _0x5c4c14['update'](_0x53b0b3)['then'](function(_0x4def7b){return _0x4def7b;});}return null;};}function removeEntity(_0x162f0e,_0x7969bc){return function(_0x53007e){if(_0x53007e){return _0x53007e[_0x0ff3('0x2c')]()[_0x0ff3('0x2d')](function(){var _0x151819=_0x53007e[_0x0ff3('0x2e')]({'plain':!![]});var _0x4a7dab=_0x0ff3('0x2f');return db[_0x0ff3('0x30')][_0x0ff3('0x2c')]({'where':{'type':_0x4a7dab,'resourceId':_0x151819['id']}})[_0x0ff3('0x2d')](function(){return _0x53007e;});})['then'](function(){_0x162f0e[_0x0ff3('0x21')](0xcc)[_0x0ff3('0x31')]();});}};}function handleEntityNotFound(_0x5bc412,_0x118ae6){return function(_0x2a3115){if(!_0x2a3115){_0x5bc412['sendStatus'](0x194);}return _0x2a3115;};}function handleError(_0x197ac8,_0x42cda6){_0x42cda6=_0x42cda6||0x1f4;return function(_0x240162){logger[_0x0ff3('0x32')](_0x240162[_0x0ff3('0x33')]);if(_0x240162[_0x0ff3('0x34')]){delete _0x240162[_0x0ff3('0x34')];}_0x197ac8[_0x0ff3('0x21')](_0x42cda6)[_0x0ff3('0x35')](_0x240162);};}exports[_0x0ff3('0x36')]=function(_0x4bc1b5,_0x7e8698){var _0x4fdd9a={},_0x422b09={},_0x26ecac={'count':0x0,'rows':[]};var _0xca7746=_[_0x0ff3('0x37')](db['MailQueue'][_0x0ff3('0x38')],function(_0x49baff){return{'name':_0x49baff[_0x0ff3('0x39')],'type':_0x49baff[_0x0ff3('0x3a')][_0x0ff3('0x3b')]};});_0x422b09[_0x0ff3('0x3c')]=_[_0x0ff3('0x37')](_0xca7746,_0x0ff3('0x34'));_0x422b09[_0x0ff3('0x3d')]=_[_0x0ff3('0x3e')](_0x4bc1b5[_0x0ff3('0x3d')]);_0x422b09['filters']=_[_0x0ff3('0x3f')](_0x422b09[_0x0ff3('0x3c')],_0x422b09[_0x0ff3('0x3d')]);_0x4fdd9a[_0x0ff3('0x40')]=_[_0x0ff3('0x3f')](_0x422b09[_0x0ff3('0x3c')],qs[_0x0ff3('0x41')](_0x4bc1b5[_0x0ff3('0x3d')][_0x0ff3('0x41')]));_0x4fdd9a[_0x0ff3('0x40')]=_0x4fdd9a[_0x0ff3('0x40')][_0x0ff3('0x42')]?_0x4fdd9a[_0x0ff3('0x40')]:_0x422b09['model'];if(!_0x4bc1b5['query']['hasOwnProperty']('nolimit')){_0x4fdd9a[_0x0ff3('0x25')]=qs[_0x0ff3('0x25')](_0x4bc1b5[_0x0ff3('0x3d')][_0x0ff3('0x25')]);_0x4fdd9a[_0x0ff3('0x23')]=qs[_0x0ff3('0x23')](_0x4bc1b5['query'][_0x0ff3('0x23')]);}_0x4fdd9a[_0x0ff3('0x43')]=qs[_0x0ff3('0x44')](_0x4bc1b5[_0x0ff3('0x3d')][_0x0ff3('0x44')]);_0x4fdd9a[_0x0ff3('0x45')]=qs[_0x0ff3('0x46')](_[_0x0ff3('0x47')](_0x4bc1b5[_0x0ff3('0x3d')],_0x422b09[_0x0ff3('0x46')]),_0xca7746);if(_0x4bc1b5['query'][_0x0ff3('0x48')]){_0x4fdd9a[_0x0ff3('0x45')]=_[_0x0ff3('0x49')](_0x4fdd9a[_0x0ff3('0x45')],{'$or':_[_0x0ff3('0x37')](_0xca7746,function(_0x57ed2e){if(_0x57ed2e['type']!==_0x0ff3('0x4a')){var _0x200b2d={};_0x200b2d[_0x57ed2e[_0x0ff3('0x34')]]={'$like':'%'+_0x4bc1b5['query'][_0x0ff3('0x48')]+'%'};return _0x200b2d;}})});}_0x4fdd9a=_[_0x0ff3('0x49')]({},_0x4fdd9a,_0x4bc1b5['options']);var _0x42aff6={'where':_0x4fdd9a[_0x0ff3('0x45')]};return db[_0x0ff3('0x4b')]['count'](_0x42aff6)[_0x0ff3('0x2d')](function(_0x57a608){_0x26ecac[_0x0ff3('0x26')]=_0x57a608;if(_0x4bc1b5[_0x0ff3('0x3d')]['includeAll']){_0x4fdd9a[_0x0ff3('0x4c')]=[{'all':!![]}];}return db['MailQueue'][_0x0ff3('0x4d')](_0x4fdd9a);})[_0x0ff3('0x2d')](function(_0xd6fba8){_0x26ecac[_0x0ff3('0x4e')]=_0xd6fba8;return _0x26ecac;})[_0x0ff3('0x2d')](respondWithFilteredResult(_0x7e8698,_0x4fdd9a))[_0x0ff3('0x4f')](handleError(_0x7e8698,null));};exports[_0x0ff3('0x50')]=function(_0x3ad6ff,_0x54f369){var _0x1f6fbb={'raw':!![],'where':{'id':_0x3ad6ff[_0x0ff3('0x51')]['id']}},_0x25ad47={};_0x25ad47['model']=_[_0x0ff3('0x3e')](db['MailQueue']['rawAttributes']);_0x25ad47[_0x0ff3('0x3d')]=_[_0x0ff3('0x3e')](_0x3ad6ff[_0x0ff3('0x3d')]);_0x25ad47[_0x0ff3('0x46')]=_[_0x0ff3('0x3f')](_0x25ad47['model'],_0x25ad47['query']);_0x1f6fbb[_0x0ff3('0x40')]=_[_0x0ff3('0x3f')](_0x25ad47[_0x0ff3('0x3c')],qs['fields'](_0x3ad6ff['query'][_0x0ff3('0x41')]));_0x1f6fbb['attributes']=_0x1f6fbb[_0x0ff3('0x40')][_0x0ff3('0x42')]?_0x1f6fbb[_0x0ff3('0x40')]:_0x25ad47[_0x0ff3('0x3c')];if(_0x3ad6ff['query'][_0x0ff3('0x52')]){_0x1f6fbb['include']=[{'all':!![]}];}_0x1f6fbb=_[_0x0ff3('0x49')]({},_0x1f6fbb,_0x3ad6ff[_0x0ff3('0x53')]);return db[_0x0ff3('0x4b')][_0x0ff3('0x54')](_0x1f6fbb)[_0x0ff3('0x2d')](handleEntityNotFound(_0x54f369,null))[_0x0ff3('0x2d')](respondWithResult(_0x54f369,null))[_0x0ff3('0x4f')](handleError(_0x54f369,null));};exports[_0x0ff3('0x55')]=function(_0x511145,_0x459687){return db['MailQueue'][_0x0ff3('0x55')](_0x511145[_0x0ff3('0x56')],{})['then'](function(_0x5b21b0){var _0x5876f0=_0x511145['user'][_0x0ff3('0x2e')]({'plain':!![]});if(!_0x5876f0)throw new Error(_0x0ff3('0x57'));if(_0x5876f0[_0x0ff3('0x58')]==='user'){var _0x4550fc=_0x5b21b0[_0x0ff3('0x2e')]({'plain':!![]});var _0x131d9e=_0x0ff3('0x2f');return db[_0x0ff3('0x59')][_0x0ff3('0x54')]({'where':{'name':_0x131d9e,'userProfileId':_0x5876f0[_0x0ff3('0x5a')]},'raw':!![]})[_0x0ff3('0x2d')](function(_0x3bc12b){if(_0x3bc12b&&_0x3bc12b[_0x0ff3('0x5b')]===0x0){return db['UserProfileResource'][_0x0ff3('0x55')]({'name':_0x4550fc[_0x0ff3('0x34')],'resourceId':_0x4550fc['id'],'type':_0x3bc12b['name'],'sectionId':_0x3bc12b['id']},{})[_0x0ff3('0x2d')](function(){return _0x5b21b0;});}else{return _0x5b21b0;}})[_0x0ff3('0x4f')](function(_0x38488f){logger['error'](_0x0ff3('0x5c'),_0x38488f);throw _0x38488f;});}return _0x5b21b0;})[_0x0ff3('0x2d')](respondWithResult(_0x459687,0xc9))[_0x0ff3('0x4f')](handleError(_0x459687,null));};exports[_0x0ff3('0x5d')]=function(_0xfd024d,_0x41432f){if(_0xfd024d[_0x0ff3('0x56')]['id']){delete _0xfd024d[_0x0ff3('0x56')]['id'];}return db[_0x0ff3('0x4b')][_0x0ff3('0x54')]({'where':{'id':_0xfd024d[_0x0ff3('0x51')]['id']}})[_0x0ff3('0x2d')](handleEntityNotFound(_0x41432f,null))[_0x0ff3('0x2d')](saveUpdates(_0xfd024d[_0x0ff3('0x56')],null))['then'](respondWithResult(_0x41432f,null))['catch'](handleError(_0x41432f,null));};exports[_0x0ff3('0x2c')]=function(_0x3a3f07,_0x535742){return db['MailQueue'][_0x0ff3('0x54')]({'where':{'id':_0x3a3f07[_0x0ff3('0x51')]['id']}})['then'](handleEntityNotFound(_0x535742,null))[_0x0ff3('0x2d')](removeEntity(_0x535742,null))[_0x0ff3('0x4f')](handleError(_0x535742,null));};exports[_0x0ff3('0x5e')]=function(_0x5d9bb3,_0x596027){return db[_0x0ff3('0x4b')][_0x0ff3('0x5e')]()[_0x0ff3('0x2d')](respondWithResult(_0x596027,null))[_0x0ff3('0x4f')](handleError(_0x596027,null));};exports['getMembers']=function(_0x20c1cc,_0x46c1f8,_0x25e46d){var _0x18f3bf={'raw':!![],'where':{}},_0x4acf56={},_0x4c1b0d;return db['MailQueue']['findOne']({'where':{'id':_0x20c1cc[_0x0ff3('0x51')]['id']}})[_0x0ff3('0x2d')](handleEntityNotFound(_0x46c1f8,null))[_0x0ff3('0x2d')](function(_0x29ae63){if(_0x29ae63){_0x4c1b0d=_0x29ae63[_0x0ff3('0x2e')]({'plain':!![]});_0x4acf56['model']=_['keys'](db[_0x0ff3('0x5f')][_0x0ff3('0x38')]);_0x4acf56[_0x0ff3('0x3d')]=_['keys'](_0x20c1cc['query']);_0x4acf56[_0x0ff3('0x46')]=_['intersection'](_0x4acf56[_0x0ff3('0x3c')],_0x4acf56[_0x0ff3('0x3d')]);_0x18f3bf[_0x0ff3('0x40')]=_['intersection'](_0x4acf56[_0x0ff3('0x3c')],qs[_0x0ff3('0x41')](_0x20c1cc[_0x0ff3('0x3d')]['fields']));_0x18f3bf[_0x0ff3('0x40')]=_0x18f3bf[_0x0ff3('0x40')]['length']?_0x18f3bf['attributes']:_0x4acf56[_0x0ff3('0x3c')];if(!_0x20c1cc[_0x0ff3('0x3d')][_0x0ff3('0x60')]('nolimit')){_0x18f3bf['limit']=qs[_0x0ff3('0x25')](_0x20c1cc[_0x0ff3('0x3d')][_0x0ff3('0x25')]);_0x18f3bf[_0x0ff3('0x23')]=qs[_0x0ff3('0x23')](_0x20c1cc['query'][_0x0ff3('0x23')]);}_0x18f3bf[_0x0ff3('0x43')]=qs['sort'](_0x20c1cc['query'][_0x0ff3('0x44')]);_0x18f3bf['where']=qs['filters'](_[_0x0ff3('0x47')](_0x20c1cc['query'],_0x4acf56[_0x0ff3('0x46')]));_0x18f3bf[_0x0ff3('0x45')][_0x0ff3('0x61')]=_0x29ae63['id'];if(_0x20c1cc[_0x0ff3('0x3d')][_0x0ff3('0x48')]){_0x18f3bf[_0x0ff3('0x45')]=_[_0x0ff3('0x49')](_0x18f3bf['where'],{'$or':_['map'](_0x18f3bf[_0x0ff3('0x40')],function(_0x983119){var _0x1692a5={};_0x1692a5[_0x983119]={'$like':'%'+_0x20c1cc[_0x0ff3('0x3d')]['filter']+'%'};return _0x1692a5;})});}_0x18f3bf=_[_0x0ff3('0x49')]({},_0x18f3bf,_0x20c1cc[_0x0ff3('0x53')]);return db['UserMailQueue'][_0x0ff3('0x4d')](_0x18f3bf);}})[_0x0ff3('0x2d')](function(_0x6dd22b){if(_0x6dd22b){return db['User'][_0x0ff3('0x62')]({'where':{'id':_[_0x0ff3('0x37')](_0x6dd22b,_0x0ff3('0x63')),'role':_0x0ff3('0x64')},'attributes':['id',_0x0ff3('0x34'),'mailPause',_0x0ff3('0x65'),_0x0ff3('0x66')]});}})[_0x0ff3('0x2d')](function(_0x2834d4){if(_0x2834d4){return{'count':_0x2834d4[_0x0ff3('0x26')],'rows':_[_0x0ff3('0x37')](_0x2834d4[_0x0ff3('0x4e')],function(_0x54833b){return{'membername':_0x54833b[_0x0ff3('0x34')],'UserId':_0x54833b['id'],'queue_name':_0x4c1b0d[_0x0ff3('0x34')],'MailQueueId':_0x4c1b0d['id'],'interface':util[_0x0ff3('0x67')](_0x0ff3('0x68'),_0x0ff3('0x69'),_0x54833b[_0x0ff3('0x34')]),'penalty':0x0,'paused':_0x54833b['mailPause'],'createdAt':_0x54833b['createdAt'],'updatedAt':_0x54833b[_0x0ff3('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x46c1f8,_0x18f3bf))[_0x0ff3('0x4f')](handleError(_0x46c1f8,null));};exports[_0x0ff3('0x6a')]=function(_0x6e4e7b,_0x1ad45c,_0x38e7bc){var _0x5f50e1={};var _0x39327c={};var _0x37218a;var _0x1052d8;return db['MailQueue'][_0x0ff3('0x6b')]({'where':{'id':_0x6e4e7b[_0x0ff3('0x51')]['id']}})[_0x0ff3('0x2d')](handleEntityNotFound(_0x1ad45c,null))[_0x0ff3('0x2d')](function(_0x5252fe){if(_0x5252fe){_0x37218a=_0x5252fe;_0x39327c[_0x0ff3('0x3c')]=_[_0x0ff3('0x3e')](db[_0x0ff3('0x6c')][_0x0ff3('0x38')]);_0x39327c[_0x0ff3('0x3d')]=_['keys'](_0x6e4e7b[_0x0ff3('0x3d')]);_0x39327c['filters']=_[_0x0ff3('0x3f')](_0x39327c[_0x0ff3('0x3c')],_0x39327c[_0x0ff3('0x3d')]);_0x5f50e1[_0x0ff3('0x40')]=_[_0x0ff3('0x3f')](_0x39327c[_0x0ff3('0x3c')],qs[_0x0ff3('0x41')](_0x6e4e7b[_0x0ff3('0x3d')][_0x0ff3('0x41')]));_0x5f50e1[_0x0ff3('0x40')]=_0x5f50e1['attributes'][_0x0ff3('0x42')]?_0x5f50e1[_0x0ff3('0x40')]:_0x39327c[_0x0ff3('0x3c')];_0x5f50e1[_0x0ff3('0x43')]=qs[_0x0ff3('0x44')](_0x6e4e7b[_0x0ff3('0x3d')][_0x0ff3('0x44')]);_0x5f50e1[_0x0ff3('0x45')]=qs[_0x0ff3('0x46')](_[_0x0ff3('0x47')](_0x6e4e7b['query'],_0x39327c[_0x0ff3('0x46')]));if(_0x6e4e7b[_0x0ff3('0x3d')]['filter']){_0x5f50e1[_0x0ff3('0x45')]=_[_0x0ff3('0x49')](_0x5f50e1[_0x0ff3('0x45')],{'$or':_[_0x0ff3('0x37')](_0x5f50e1['attributes'],function(_0x261fb8){var _0x284834={};_0x284834[_0x261fb8]={'$like':'%'+_0x6e4e7b['query'][_0x0ff3('0x48')]+'%'};return _0x284834;})});}_0x5f50e1=_[_0x0ff3('0x49')]({},_0x5f50e1,_0x6e4e7b[_0x0ff3('0x53')]);return _0x37218a[_0x0ff3('0x6a')](_0x5f50e1);}})['then'](function(_0x3b257){if(_0x3b257){_0x1052d8=_0x3b257['length'];if(!_0x6e4e7b[_0x0ff3('0x3d')]['hasOwnProperty'](_0x0ff3('0x6d'))){_0x5f50e1[_0x0ff3('0x25')]=qs[_0x0ff3('0x25')](_0x6e4e7b[_0x0ff3('0x3d')]['limit']);_0x5f50e1[_0x0ff3('0x23')]=qs['offset'](_0x6e4e7b[_0x0ff3('0x3d')][_0x0ff3('0x23')]);}return _0x37218a[_0x0ff3('0x6a')](_0x5f50e1);}})[_0x0ff3('0x2d')](function(_0x2582f0){if(_0x2582f0){return _0x2582f0?{'count':_0x1052d8,'rows':_0x2582f0}:null;}})['then'](respondWithResult(_0x1ad45c,null))[_0x0ff3('0x4f')](handleError(_0x1ad45c,null));};exports[_0x0ff3('0x6e')]=function(_0x32acc4,_0x156631,_0x511cd6){var _0x111549=_0x32acc4[_0x0ff3('0x56')][_0x0ff3('0x6f')];return db[_0x0ff3('0x6c')]['findAll']({'where':{'id':_0x111549},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ff3('0x70'),'attributes':['id',_0x0ff3('0x34'),_0x0ff3('0x71'),_0x0ff3('0x72'),_0x0ff3('0x73')],'raw':!![]}]})[_0x0ff3('0x2d')](function(_0x442a5b){if(_0x442a5b){var _0x5cef09=_['flatMap'](_0x442a5b,function(_0x417eb0){var _0x56fe2e=_0x417eb0[_0x0ff3('0x2e')]({'plain':!![]});return _0x56fe2e[_0x0ff3('0x70')];});return db[_0x0ff3('0x4b')][_0x0ff3('0x54')]({'where':{'id':_0x32acc4[_0x0ff3('0x51')]['id']}})['then'](function(_0x1676e8){return db[_0x0ff3('0x74')][_0x0ff3('0x75')](function(_0xa1e10b){return _0x1676e8[_0x0ff3('0x6e')](_0x111549,{'transaction':_0xa1e10b})['then'](function(){return BPromise[_0x0ff3('0x76')](_0x5cef09,function(_0x3a6aa7){return db[_0x0ff3('0x5f')][_0x0ff3('0x77')]({'where':{'UserId':_0x3a6aa7['id'],'MailQueueId':_0x32acc4[_0x0ff3('0x51')]['id']},'transaction':_0xa1e10b});});})[_0x0ff3('0x2d')](function(){_0x5cef09[_0x0ff3('0x78')](function(_0x1d9b3f){socket[_0x0ff3('0x79')](_0x0ff3('0x7a'),{'UserId':_0x1d9b3f['id'],'MailQueueId':_0x1676e8['id']});});});});});}})[_0x0ff3('0x2d')](respondWithStatusCode(_0x156631,null))[_0x0ff3('0x4f')](handleError(_0x156631,null));};exports[_0x0ff3('0x7b')]=function(_0x5c6dfb,_0x5eb5bd,_0xc286e7){return db[_0x0ff3('0x6c')]['findAll']({'where':{'id':_0x5c6dfb[_0x0ff3('0x3d')][_0x0ff3('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ff3('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5eb5bd,null))['then'](function(_0x31d407){var _0x2490cf=_[_0x0ff3('0x37')](_0x31d407,'id');var _0x43e25c=[];var _0x105b53=[];var _0x55e367=squel[_0x0ff3('0x7c')]();_0x55e367['field'](_0x0ff3('0x7d'))[_0x0ff3('0x7e')](_0x0ff3('0x7f'),'tq')['join'](_0x0ff3('0x80'),'ut',_0x0ff3('0x81'))[_0x0ff3('0x45')](_0x0ff3('0x82'),_0x5c6dfb[_0x0ff3('0x51')]['id']);for(var _0xd0cdf1=0x0;_0xd0cdf1<_0x31d407[_0x0ff3('0x42')];_0xd0cdf1+=0x1){let _0xbe094=_0x31d407[_0xd0cdf1];for(var _0x41da80=0x0;_0x41da80<_0xbe094[_0x0ff3('0x70')][_0x0ff3('0x42')];_0x41da80+=0x1){let _0x3cd1bb=_0xbe094[_0x0ff3('0x70')][_0x41da80];var _0x2f0671=_0x55e367['clone']();_0x2f0671[_0x0ff3('0x45')](_0x0ff3('0x83'),_0x3cd1bb['id']);_0x105b53[_0x0ff3('0x84')](db[_0x0ff3('0x74')]['query'](_0x2f0671[_0x0ff3('0x85')](),{'type':db['sequelize'][_0x0ff3('0x86')][_0x0ff3('0x87')]})[_0x0ff3('0x2d')](function(_0x13a8dc){if(_0x13a8dc[_0x0ff3('0x42')]===0x1){return _0x3cd1bb['id'];}else{var _0x2add4e=_[_0x0ff3('0x88')](_[_0x0ff3('0x37')](_0x13a8dc,_0x0ff3('0x89')),function(_0x27f2ac){return _[_0x0ff3('0x8a')](_0x2490cf,_0x27f2ac);});if(_0x2add4e){return _0x3cd1bb['id'];}}}));}}return BPromise[_0x0ff3('0x8b')](_0x105b53)[_0x0ff3('0x2d')](function(_0x3c444e){_0x43e25c=_(_0x43e25c)[_0x0ff3('0x8c')](_0x3c444e)[_0x0ff3('0x8d')]()[_0x0ff3('0x8e')]();return db[_0x0ff3('0x4b')][_0x0ff3('0x54')]({'where':{'id':_0x5c6dfb[_0x0ff3('0x51')]['id']}})[_0x0ff3('0x2d')](function(_0x41660f){return db['sequelize'][_0x0ff3('0x75')](function(_0x1736c4){return _0x41660f[_0x0ff3('0x7b')](_0x5c6dfb[_0x0ff3('0x3d')][_0x0ff3('0x6f')],{'transaction':_0x1736c4})['then'](function(){if(!_[_0x0ff3('0x8f')](_0x43e25c)){return _0x41660f[_0x0ff3('0x90')](_0x43e25c,{'transaction':_0x1736c4});}})[_0x0ff3('0x2d')](function(){_0x43e25c['forEach'](function(_0x40e82d){socket['emit']('userMailQueue:remove',{'UserId':_0x40e82d,'MailQueueId':_0x41660f['id']});});});});});});})[_0x0ff3('0x2d')](respondWithStatusCode(_0x5eb5bd,null))[_0x0ff3('0x4f')](handleError(_0x5eb5bd,null));};exports[_0x0ff3('0x91')]=function(_0x9cd7f8,_0x586b2e,_0x441b65){return db[_0x0ff3('0x4b')][_0x0ff3('0x54')]({'where':{'id':_0x9cd7f8[_0x0ff3('0x51')]['id']}})[_0x0ff3('0x2d')](handleEntityNotFound(_0x586b2e,null))['then'](function(_0x1acd55){if(_0x1acd55){return _0x1acd55['addAgents'](_0x9cd7f8['body'][_0x0ff3('0x6f')],_[_0x0ff3('0x92')](_0x9cd7f8[_0x0ff3('0x56')],[_0x0ff3('0x6f'),'id'])||{})[_0x0ff3('0x93')](function(_0x2ed6c5){for(var _0x4adaa8=0x0;_0x4adaa8<_0x9cd7f8[_0x0ff3('0x56')]['ids']['length'];_0x4adaa8+=0x1){socket[_0x0ff3('0x79')]('userMailQueue:save',{'UserId':Number(_0x9cd7f8['body'][_0x0ff3('0x6f')][_0x4adaa8]),'MailQueueId':Number(_0x9cd7f8[_0x0ff3('0x51')]['id'])});}return _0x2ed6c5;});}})[_0x0ff3('0x2d')](respondWithResult(_0x586b2e,null))[_0x0ff3('0x4f')](handleError(_0x586b2e,null));};exports['removeAgents']=function(_0x1ce3fe,_0x4930ea,_0x401c4e){return db[_0x0ff3('0x4b')][_0x0ff3('0x54')]({'where':{'id':_0x1ce3fe[_0x0ff3('0x51')]['id']}})['then'](handleEntityNotFound(_0x4930ea,null))[_0x0ff3('0x2d')](function(_0x2b3705){if(_0x2b3705){return _0x2b3705[_0x0ff3('0x90')](_0x1ce3fe[_0x0ff3('0x3d')]['ids'])[_0x0ff3('0x2d')](function(){if(_[_0x0ff3('0x94')](_0x1ce3fe['query'][_0x0ff3('0x6f')])){for(var _0x466250=0x0;_0x466250<_0x1ce3fe['query'][_0x0ff3('0x6f')][_0x0ff3('0x42')];_0x466250+=0x1){socket[_0x0ff3('0x79')](_0x0ff3('0x95'),{'UserId':Number(_0x1ce3fe[_0x0ff3('0x3d')][_0x0ff3('0x6f')][_0x466250]),'MailQueueId':Number(_0x1ce3fe[_0x0ff3('0x51')]['id'])});}}else{socket['emit'](_0x0ff3('0x95'),{'UserId':Number(_0x1ce3fe[_0x0ff3('0x3d')]['ids']),'MailQueueId':Number(_0x1ce3fe[_0x0ff3('0x51')]['id'])});}});}})[_0x0ff3('0x2d')](respondWithStatusCode(_0x4930ea,null))[_0x0ff3('0x4f')](handleError(_0x4930ea,null));};exports[_0x0ff3('0x96')]=function(_0xffbe68,_0x501600,_0x21b831){var _0x38cd0a={};var _0x3e0d4a={};var _0xd89643;var _0x462e3c;return db[_0x0ff3('0x4b')][_0x0ff3('0x6b')]({'where':{'id':_0xffbe68[_0x0ff3('0x51')]['id']}})[_0x0ff3('0x2d')](handleEntityNotFound(_0x501600,null))[_0x0ff3('0x2d')](function(_0x9e75ce){if(_0x9e75ce){_0xd89643=_0x9e75ce;_0x3e0d4a[_0x0ff3('0x3c')]=_['keys'](db[_0x0ff3('0x97')][_0x0ff3('0x38')]);_0x3e0d4a[_0x0ff3('0x3d')]=_[_0x0ff3('0x3e')](_0xffbe68['query']);_0x3e0d4a[_0x0ff3('0x46')]=_[_0x0ff3('0x3f')](_0x3e0d4a['model'],_0x3e0d4a[_0x0ff3('0x3d')]);_0x38cd0a[_0x0ff3('0x40')]=_['intersection'](_0x3e0d4a['model'],qs[_0x0ff3('0x41')](_0xffbe68[_0x0ff3('0x3d')][_0x0ff3('0x41')]));_0x38cd0a['attributes']=_0x38cd0a[_0x0ff3('0x40')][_0x0ff3('0x42')]?_0x38cd0a[_0x0ff3('0x40')]:_0x3e0d4a[_0x0ff3('0x3c')];_0x38cd0a[_0x0ff3('0x43')]=qs['sort'](_0xffbe68[_0x0ff3('0x3d')]['sort']);_0x38cd0a[_0x0ff3('0x45')]=qs[_0x0ff3('0x46')](_['pick'](_0xffbe68[_0x0ff3('0x3d')],_0x3e0d4a[_0x0ff3('0x46')]));if(_0xffbe68[_0x0ff3('0x3d')][_0x0ff3('0x48')]){_0x38cd0a['where']=_['merge'](_0x38cd0a['where'],{'$or':_[_0x0ff3('0x37')](_0x38cd0a[_0x0ff3('0x40')],function(_0x410cf8){var _0x1b1736={};_0x1b1736[_0x410cf8]={'$like':'%'+_0xffbe68[_0x0ff3('0x3d')]['filter']+'%'};return _0x1b1736;})});}_0x38cd0a=_[_0x0ff3('0x49')]({},_0x38cd0a,_0xffbe68['options']);return _0xd89643[_0x0ff3('0x96')](_0x38cd0a);}})[_0x0ff3('0x2d')](function(_0x1da4ea){if(_0x1da4ea){_0x462e3c=_0x1da4ea[_0x0ff3('0x42')];if(!_0xffbe68[_0x0ff3('0x3d')][_0x0ff3('0x60')](_0x0ff3('0x6d'))){_0x38cd0a['limit']=qs['limit'](_0xffbe68[_0x0ff3('0x3d')]['limit']);_0x38cd0a[_0x0ff3('0x23')]=qs[_0x0ff3('0x23')](_0xffbe68[_0x0ff3('0x3d')][_0x0ff3('0x23')]);}return _0xd89643[_0x0ff3('0x96')](_0x38cd0a);}})['then'](function(_0x74d3fe){if(_0x74d3fe){return _0x74d3fe?{'count':_0x462e3c,'rows':_0x74d3fe}:null;}})[_0x0ff3('0x2d')](respondWithResult(_0x501600,null))[_0x0ff3('0x4f')](handleError(_0x501600,null));};
\ No newline at end of file
index d7b9457..653b66e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fed=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','remove','emit'];(function(_0x4edaa8,_0x5512d7){var _0x21590e=function(_0x3d125a){while(--_0x3d125a){_0x4edaa8['push'](_0x4edaa8['shift']());}};_0x21590e(++_0x5512d7);}(_0x7fed,0xaa));var _0xd7fe=function(_0xc09216,_0x3e65cf){_0xc09216=_0xc09216-0x0;var _0x37a09c=_0x7fed[_0xc09216];return _0x37a09c;};'use strict';var EventEmitter=require(_0xd7fe('0x0'));var MailQueue=require(_0xd7fe('0x1'))['db'][_0xd7fe('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd7fe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd7fe('0x4')};function emitEvent(_0x4ce161){return function(_0x3a6723,_0x2f4ec9,_0x38731a){MailQueueEvents['emit'](_0x4ce161+':'+_0x3a6723['id'],_0x3a6723);MailQueueEvents[_0xd7fe('0x5')](_0x4ce161,_0x3a6723);_0x38731a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xd7fe('0x6')](e,emitEvent(event));}}module[_0xd7fe('0x7')]=MailQueueEvents;
\ No newline at end of file
+var _0xd29d=['../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2cda71,_0x87924e){var _0x15aa46=function(_0x975abc){while(--_0x975abc){_0x2cda71['push'](_0x2cda71['shift']());}};_0x15aa46(++_0x87924e);}(_0xd29d,0x6d));var _0xdd29=function(_0x2c37ad,_0x49b45e){_0x2c37ad=_0x2c37ad-0x0;var _0xfb4a30=_0xd29d[_0x2c37ad];return _0xfb4a30;};'use strict';var EventEmitter=require(_0xdd29('0x0'));var MailQueue=require(_0xdd29('0x1'))['db'][_0xdd29('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xdd29('0x3')](0x0);var events={'afterCreate':_0xdd29('0x4'),'afterUpdate':_0xdd29('0x5'),'afterDestroy':_0xdd29('0x6')};function emitEvent(_0x15e6a4){return function(_0x29885a,_0xb4426b,_0x7d41ab){MailQueueEvents[_0xdd29('0x7')](_0x15e6a4+':'+_0x29885a['id'],_0x29885a);MailQueueEvents[_0xdd29('0x7')](_0x15e6a4,_0x29885a);_0x7d41ab(null);};}for(var e in events){if(events[_0xdd29('0x8')](e)){var event=events[e];MailQueue[_0xdd29('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents;
\ No newline at end of file
index 4e66d83..1ddc209 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea8d=['api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea8d,0x1af));var _0xdea8=function(_0x23a061,_0x1a8569){_0x23a061=_0x23a061-0x0;var _0x41fe47=_0xea8d[_0x23a061];return _0x41fe47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdea8('0x0'))(_0xdea8('0x1'));var moment=require('moment');var BPromise=require(_0xdea8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdea8('0x3'));var rimraf=require(_0xdea8('0x4'));var config=require(_0xdea8('0x5'));var attributes=require(_0xdea8('0x6'));module[_0xdea8('0x7')]=function(_0x4132ab,_0x1d497d){return _0x4132ab['define'](_0xdea8('0x8'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xae4f=['./mailQueue.attributes','exports','define','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae4f,0x130));var _0xfae4=function(_0x4bf882,_0x490049){_0x4bf882=_0x4bf882-0x0;var _0x1a01ad=_0xae4f[_0x4bf882];return _0x1a01ad;};'use strict';var _=require(_0xfae4('0x0'));var util=require(_0xfae4('0x1'));var logger=require(_0xfae4('0x2'))(_0xfae4('0x3'));var moment=require(_0xfae4('0x4'));var BPromise=require(_0xfae4('0x5'));var rp=require(_0xfae4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfae4('0x7'));var attributes=require(_0xfae4('0x8'));module[_0xfae4('0x9')]=function(_0xe14b89,_0x45948c){return _0xe14b89[_0xfae4('0xa')](_0xfae4('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5e33ef8..f7f8e73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3505=['result','catch','GetMailQueue','findAll','options','where','attributes','map','include','model','ShowMailQueue','find','raw','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0x2fddb3,_0x4d3999){var _0x312988=function(_0x402178){while(--_0x402178){_0x2fddb3['push'](_0x2fddb3['shift']());}};_0x312988(++_0x4d3999);}(_0x3505,0x10a));var _0x5350=function(_0x3abeeb,_0x488129){_0x3abeeb=_0x3abeeb-0x0;var _0x35131d=_0x3505[_0x3abeeb];return _0x35131d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5350('0x0'));var BPromise=require('bluebird');var rs=require(_0x5350('0x1'));var fs=require('fs');var Redis=require(_0x5350('0x2'));var db=require(_0x5350('0x3'))['db'];var utils=require(_0x5350('0x4'));var logger=require(_0x5350('0x5'))(_0x5350('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5350('0x7')]=_[_0x5350('0x8')](config[_0x5350('0x7')],{'host':_0x5350('0x9'),'port':0x18eb});var socket=require(_0x5350('0xa'))(new Redis(config['redis']));require(_0x5350('0xb'))[_0x5350('0xc')](socket);function respondWithRpcPromise(_0x3476b0,_0x3af858,_0x7d3542){return new BPromise(function(_0x4e11b1,_0x5cb986){return client[_0x5350('0xd')](_0x3476b0,_0x7d3542)[_0x5350('0xe')](function(_0x37031){logger[_0x5350('0xf')](_0x5350('0x10'),_0x3af858,_0x5350('0x11'));logger[_0x5350('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x3af858,_0x5350('0x11'),JSON['stringify'](_0x37031));if(_0x37031['error']){if(_0x37031['error'][_0x5350('0x13')]===0x1f4){logger[_0x5350('0x14')](_0x5350('0x10'),_0x3af858,_0x37031[_0x5350('0x14')][_0x5350('0x15')]);return _0x5cb986(_0x37031[_0x5350('0x14')][_0x5350('0x15')]);}logger[_0x5350('0x14')]('MailQueue,\x20%s,\x20%s',_0x3af858,_0x37031['error'][_0x5350('0x15')]);return _0x4e11b1(_0x37031[_0x5350('0x14')]['message']);}else{logger[_0x5350('0xf')](_0x5350('0x10'),_0x3af858,'request\x20sent');_0x4e11b1(_0x37031[_0x5350('0x16')][_0x5350('0x15')]);}})[_0x5350('0x17')](function(_0x3377db){logger[_0x5350('0x14')](_0x5350('0x10'),_0x3af858,_0x3377db);_0x5cb986(_0x3377db);});});}exports[_0x5350('0x18')]=function(_0x396508){var _0x571392=this;return new Promise(function(_0x433b9d,_0x50da83){return db['MailQueue'][_0x5350('0x19')]({'raw':_0x396508['options']?_0x396508[_0x5350('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x396508[_0x5350('0x1a')]?_0x396508['options'][_0x5350('0x1b')]||null:null,'attributes':_0x396508[_0x5350('0x1a')]?_0x396508[_0x5350('0x1a')][_0x5350('0x1c')]||null:null,'limit':_0x396508[_0x5350('0x1a')]?_0x396508[_0x5350('0x1a')]['limit']||null:null,'include':_0x396508[_0x5350('0x1a')]?_0x396508[_0x5350('0x1a')]['include']?_[_0x5350('0x1d')](_0x396508[_0x5350('0x1a')][_0x5350('0x1e')],function(_0x32b40a){return{'model':db[_0x32b40a['model']],'as':_0x32b40a['as'],'attributes':_0x32b40a[_0x5350('0x1c')],'include':_0x32b40a[_0x5350('0x1e')]?_['map'](_0x32b40a[_0x5350('0x1e')],function(_0x14a4cb){return{'model':db[_0x14a4cb[_0x5350('0x1f')]],'as':_0x14a4cb['as'],'attributes':_0x14a4cb[_0x5350('0x1c')],'include':_0x14a4cb[_0x5350('0x1e')]?_[_0x5350('0x1d')](_0x14a4cb[_0x5350('0x1e')],function(_0x4684a4){return{'model':db[_0x4684a4[_0x5350('0x1f')]],'as':_0x4684a4['as'],'attributes':_0x4684a4[_0x5350('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5350('0xe')](function(_0x356153){logger[_0x5350('0xf')](_0x5350('0x18'),_0x396508);logger[_0x5350('0x12')](_0x5350('0x18'),_0x396508,JSON['stringify'](_0x356153));_0x433b9d(_0x356153);})[_0x5350('0x17')](function(_0xc780fb){logger[_0x5350('0x14')](_0x5350('0x18'),_0xc780fb[_0x5350('0x15')],_0x396508);_0x50da83(_0x571392[_0x5350('0x14')](0x1f4,_0xc780fb[_0x5350('0x15')]));});});};exports[_0x5350('0x20')]=function(_0x3386a2){var _0x150fed=this;return new Promise(function(_0x5eb971,_0x86dd78){return db['MailQueue'][_0x5350('0x21')]({'raw':_0x3386a2[_0x5350('0x1a')]?_0x3386a2[_0x5350('0x1a')][_0x5350('0x22')]===undefined?!![]:![]:!![],'where':_0x3386a2[_0x5350('0x1a')]?_0x3386a2['options']['where']||null:null,'attributes':_0x3386a2[_0x5350('0x1a')]?_0x3386a2['options'][_0x5350('0x1c')]||null:null,'include':_0x3386a2[_0x5350('0x1a')]?_0x3386a2[_0x5350('0x1a')][_0x5350('0x1e')]?_[_0x5350('0x1d')](_0x3386a2['options']['include'],function(_0xca2bbe){return{'model':db[_0xca2bbe['model']],'as':_0xca2bbe['as'],'attributes':_0xca2bbe[_0x5350('0x1c')],'include':_0xca2bbe['include']?_[_0x5350('0x1d')](_0xca2bbe['include'],function(_0x1cd80f){return{'model':db[_0x1cd80f[_0x5350('0x1f')]],'as':_0x1cd80f['as'],'attributes':_0x1cd80f[_0x5350('0x1c')],'include':_0x1cd80f[_0x5350('0x1e')]?_[_0x5350('0x1d')](_0x1cd80f[_0x5350('0x1e')],function(_0x53ba2c){return{'model':db[_0x53ba2c[_0x5350('0x1f')]],'as':_0x53ba2c['as'],'attributes':_0x53ba2c[_0x5350('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1588be){logger[_0x5350('0xf')](_0x5350('0x20'),_0x3386a2);logger[_0x5350('0x12')](_0x5350('0x20'),_0x3386a2,JSON[_0x5350('0x23')](_0x1588be));_0x5eb971(_0x1588be);})[_0x5350('0x17')](function(_0x169c3c){logger['error'](_0x5350('0x20'),_0x169c3c[_0x5350('0x15')],_0x3386a2);_0x86dd78(_0x150fed[_0x5350('0x14')](0x1f4,_0x169c3c[_0x5350('0x15')]));});});};
\ No newline at end of file
+var _0x5b56=['http','redis','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetMailQueue','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x65a691,_0x5be493){var _0x5a285a=function(_0xa63d86){while(--_0xa63d86){_0x65a691['push'](_0x65a691['shift']());}};_0x5a285a(++_0x5be493);}(_0x5b56,0x9a));var _0x65b5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5b56[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x65b5('0x0'));var util=require(_0x65b5('0x1'));var moment=require(_0x65b5('0x2'));var BPromise=require(_0x65b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65b5('0x4'));var db=require(_0x65b5('0x5'))['db'];var utils=require(_0x65b5('0x6'));var logger=require(_0x65b5('0x7'))('rpc');var config=require(_0x65b5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x65b5('0x9')][_0x65b5('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x65b5('0xb')],{'host':_0x65b5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x65b5('0xd'))[_0x65b5('0xe')](socket);function respondWithRpcPromise(_0x546e29,_0x24aea1,_0x19b91d){return new BPromise(function(_0x2b7847,_0x32ee91){return client[_0x65b5('0xf')](_0x546e29,_0x19b91d)[_0x65b5('0x10')](function(_0x125465){logger['info'](_0x65b5('0x11'),_0x24aea1,'request\x20sent');logger[_0x65b5('0x12')](_0x65b5('0x13'),_0x24aea1,_0x65b5('0x14'),JSON[_0x65b5('0x15')](_0x125465));if(_0x125465[_0x65b5('0x16')]){if(_0x125465[_0x65b5('0x16')][_0x65b5('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x24aea1,_0x125465[_0x65b5('0x16')][_0x65b5('0x18')]);return _0x32ee91(_0x125465['error'][_0x65b5('0x18')]);}logger[_0x65b5('0x16')](_0x65b5('0x11'),_0x24aea1,_0x125465['error']['message']);return _0x2b7847(_0x125465[_0x65b5('0x16')]['message']);}else{logger[_0x65b5('0x19')](_0x65b5('0x11'),_0x24aea1,_0x65b5('0x14'));_0x2b7847(_0x125465[_0x65b5('0x1a')]['message']);}})[_0x65b5('0x1b')](function(_0x53fcc1){logger[_0x65b5('0x16')]('MailQueue,\x20%s,\x20%s',_0x24aea1,_0x53fcc1);_0x32ee91(_0x53fcc1);});});}exports['GetMailQueue']=function(_0x5a96cc){var _0x47e19d=this;return new Promise(function(_0x523bc2,_0x1cf92b){return db[_0x65b5('0x1c')][_0x65b5('0x1d')]({'raw':_0x5a96cc[_0x65b5('0x1e')]?_0x5a96cc['options'][_0x65b5('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a96cc['options']?_0x5a96cc[_0x65b5('0x1e')][_0x65b5('0x20')]||null:null,'attributes':_0x5a96cc[_0x65b5('0x1e')]?_0x5a96cc[_0x65b5('0x1e')][_0x65b5('0x21')]||null:null,'limit':_0x5a96cc['options']?_0x5a96cc['options'][_0x65b5('0x22')]||null:null,'include':_0x5a96cc[_0x65b5('0x1e')]?_0x5a96cc[_0x65b5('0x1e')][_0x65b5('0x23')]?_['map'](_0x5a96cc[_0x65b5('0x1e')]['include'],function(_0x219da2){return{'model':db[_0x219da2[_0x65b5('0x24')]],'as':_0x219da2['as'],'attributes':_0x219da2[_0x65b5('0x21')],'include':_0x219da2[_0x65b5('0x23')]?_[_0x65b5('0x25')](_0x219da2['include'],function(_0x2090f5){return{'model':db[_0x2090f5[_0x65b5('0x24')]],'as':_0x2090f5['as'],'attributes':_0x2090f5[_0x65b5('0x21')],'include':_0x2090f5['include']?_[_0x65b5('0x25')](_0x2090f5[_0x65b5('0x23')],function(_0x3c4c0d){return{'model':db[_0x3c4c0d['model']],'as':_0x3c4c0d['as'],'attributes':_0x3c4c0d[_0x65b5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa01d){logger[_0x65b5('0x19')](_0x65b5('0x26'),_0x5a96cc);logger[_0x65b5('0x12')](_0x65b5('0x26'),_0x5a96cc,JSON[_0x65b5('0x15')](_0xaa01d));_0x523bc2(_0xaa01d);})[_0x65b5('0x1b')](function(_0xc2b7d7){logger[_0x65b5('0x16')](_0x65b5('0x26'),_0xc2b7d7[_0x65b5('0x18')],_0x5a96cc);_0x1cf92b(_0x47e19d[_0x65b5('0x16')](0x1f4,_0xc2b7d7[_0x65b5('0x18')]));});});};exports[_0x65b5('0x27')]=function(_0xe568b7){var _0x48ee64=this;return new Promise(function(_0x3edcb4,_0x581dcb){return db['MailQueue'][_0x65b5('0x28')]({'raw':_0xe568b7[_0x65b5('0x1e')]?_0xe568b7[_0x65b5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xe568b7[_0x65b5('0x1e')]?_0xe568b7[_0x65b5('0x1e')][_0x65b5('0x20')]||null:null,'attributes':_0xe568b7[_0x65b5('0x1e')]?_0xe568b7[_0x65b5('0x1e')][_0x65b5('0x21')]||null:null,'include':_0xe568b7[_0x65b5('0x1e')]?_0xe568b7[_0x65b5('0x1e')][_0x65b5('0x23')]?_['map'](_0xe568b7[_0x65b5('0x1e')][_0x65b5('0x23')],function(_0x53f5af){return{'model':db[_0x53f5af['model']],'as':_0x53f5af['as'],'attributes':_0x53f5af['attributes'],'include':_0x53f5af[_0x65b5('0x23')]?_[_0x65b5('0x25')](_0x53f5af[_0x65b5('0x23')],function(_0x120c2e){return{'model':db[_0x120c2e[_0x65b5('0x24')]],'as':_0x120c2e['as'],'attributes':_0x120c2e[_0x65b5('0x21')],'include':_0x120c2e[_0x65b5('0x23')]?_[_0x65b5('0x25')](_0x120c2e['include'],function(_0x3f75c3){return{'model':db[_0x3f75c3[_0x65b5('0x24')]],'as':_0x3f75c3['as'],'attributes':_0x3f75c3[_0x65b5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x65b5('0x10')](function(_0x28bdd2){logger[_0x65b5('0x19')](_0x65b5('0x27'),_0xe568b7);logger[_0x65b5('0x12')]('ShowMailQueue',_0xe568b7,JSON[_0x65b5('0x15')](_0x28bdd2));_0x3edcb4(_0x28bdd2);})[_0x65b5('0x1b')](function(_0x45f2a1){logger['error']('ShowMailQueue',_0x45f2a1['message'],_0xe568b7);_0x581dcb(_0x48ee64[_0x65b5('0x16')](0x1f4,_0x45f2a1[_0x65b5('0x18')]));});});};
\ No newline at end of file
index b8ad9b2..2b2696c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6611=['remove','removeListener','mailQueue:','save'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6611,0x1bb));var _0x1661=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6611[_0x14add3];return _0x4a174f;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x1661('0x0'),_0x1661('0x1'),'update'];function createListener(_0xb6261e,_0x3bcb63){return function(_0x151f98){_0x3bcb63['emit'](_0xb6261e,_0x151f98);};}function removeListener(_0x2d1290,_0x618412){return function(){MailQueueEvents[_0x1661('0x2')](_0x2d1290,_0x618412);};}exports['register']=function(_0xa15a7f){for(var _0x48f930=0x0,_0x1b1485=events['length'];_0x48f930<_0x1b1485;_0x48f930++){var _0x3c873b=events[_0x48f930];var _0x45084d=createListener(_0x1661('0x3')+_0x3c873b,_0xa15a7f);MailQueueEvents['on'](_0x3c873b,_0x45084d);}};
\ No newline at end of file
+var _0x3b6b=['save','update','emit','register','length'];(function(_0x2d620b,_0x371793){var _0x256963=function(_0x47dd0b){while(--_0x47dd0b){_0x2d620b['push'](_0x2d620b['shift']());}};_0x256963(++_0x371793);}(_0x3b6b,0x87));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xb3b6('0x0'),'remove',_0xb3b6('0x1')];function createListener(_0xe471e,_0x25964e){return function(_0x4cec82){_0x25964e[_0xb3b6('0x2')](_0xe471e,_0x4cec82);};}function removeListener(_0x4d4b6e,_0x2da3ee){return function(){MailQueueEvents['removeListener'](_0x4d4b6e,_0x2da3ee);};}exports[_0xb3b6('0x3')]=function(_0x107d64){for(var _0x847895=0x0,_0x5b782e=events[_0xb3b6('0x4')];_0x847895<_0x5b782e;_0x847895++){var _0x3be0b9=events[_0x847895];var _0x34ea2b=createListener('mailQueue:'+_0x3be0b9,_0x107d64);MailQueueEvents['on'](_0x3be0b9,_0x34ea2b);}};
\ No newline at end of file
index 2ac9fd6..189e01b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeded=['put','/:id','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x28989d,_0x5a83da){var _0x23f588=function(_0x3b52a7){while(--_0x3b52a7){_0x28989d['push'](_0x28989d['shift']());}};_0x23f588(++_0x5a83da);}(_0xeded,0x137));var _0xdede=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeded[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xdede('0x0'));var util=require('util');var path=require(_0xdede('0x1'));var timeout=require(_0xdede('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdede('0x3'));var auth=require(_0xdede('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdede('0x5'));var controller=require(_0xdede('0x6'));router[_0xdede('0x7')]('/',auth[_0xdede('0x8')](),controller[_0xdede('0x9')]);router[_0xdede('0x7')](_0xdede('0xa'),auth[_0xdede('0x8')](),controller[_0xdede('0xb')]);router[_0xdede('0x7')]('/:id',auth[_0xdede('0x8')](),controller['show']);router[_0xdede('0xc')]('/',auth[_0xdede('0x8')](),controller['create']);router[_0xdede('0xd')](_0xdede('0xe'),auth[_0xdede('0x8')](),controller[_0xdede('0xf')]);router[_0xdede('0x10')](_0xdede('0xe'),auth['isAuthenticated'](),controller[_0xdede('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0x8c7b=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3e22b2,_0x213163){var _0x1b14a9=function(_0x58302e){while(--_0x58302e){_0x3e22b2['push'](_0x3e22b2['shift']());}};_0x1b14a9(++_0x213163);}(_0x8c7b,0x15b));var _0xb8c7=function(_0x190273,_0x285318){_0x190273=_0x190273-0x0;var _0x57e940=_0x8c7b[_0x190273];return _0x57e940;};'use strict';var multer=require(_0xb8c7('0x0'));var util=require('util');var path=require(_0xb8c7('0x1'));var timeout=require(_0xb8c7('0x2'));var express=require('express');var router=express[_0xb8c7('0x3')]();var fs_extra=require(_0xb8c7('0x4'));var auth=require(_0xb8c7('0x5'));var interaction=require(_0xb8c7('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xb8c7('0x7')]('/',auth[_0xb8c7('0x8')](),controller[_0xb8c7('0x9')]);router[_0xb8c7('0x7')](_0xb8c7('0xa'),auth['isAuthenticated'](),controller[_0xb8c7('0xb')]);router[_0xb8c7('0x7')](_0xb8c7('0xc'),auth[_0xb8c7('0x8')](),controller[_0xb8c7('0xd')]);router[_0xb8c7('0xe')]('/',auth['isAuthenticated'](),controller[_0xb8c7('0xf')]);router[_0xb8c7('0x10')](_0xb8c7('0xc'),auth[_0xb8c7('0x8')](),controller[_0xb8c7('0x11')]);router[_0xb8c7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb8c7('0x13')]);module[_0xb8c7('0x14')]=router;
\ No newline at end of file
index a01f109..58d99ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e8e=['STRING','DATE','moment','sequelize'];(function(_0x5ade35,_0x35cec6){var _0x21d317=function(_0x4369b1){while(--_0x4369b1){_0x5ade35['push'](_0x5ade35['shift']());}};_0x21d317(++_0x35cec6);}(_0x2e8e,0x7e));var _0xe2e8=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x2e8e[_0x31295c];return _0x2c150e;};'use strict';var moment=require(_0xe2e8('0x0'));var Sequelize=require(_0xe2e8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe2e8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe2e8('0x2')]},'joinAt':{'type':Sequelize[_0xe2e8('0x3')]},'leaveAt':{'type':Sequelize[_0xe2e8('0x3')]},'acceptAt':{'type':Sequelize[_0xe2e8('0x3')]},'exitAt':{'type':Sequelize[_0xe2e8('0x3')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x457b=['exports','STRING','DATE'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x457b,0x1b6));var _0xb457=function(_0x16a154,_0x40df38){_0x16a154=_0x16a154-0x0;var _0x5b674c=_0x457b[_0x16a154];return _0x5b674c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb457('0x0')]={'uniqueid':{'type':Sequelize[_0xb457('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb457('0x1')]},'joinAt':{'type':Sequelize[_0xb457('0x2')]},'leaveAt':{'type':Sequelize[_0xb457('0x2')]},'acceptAt':{'type':Sequelize[_0xb457('0x2')]},'exitAt':{'type':Sequelize[_0xb457('0x2')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 6cd74dd..d0fa221 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e2e=['name','send','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','stack'];(function(_0x272eda,_0x1c35ec){var _0x174130=function(_0x44b0b5){while(--_0x44b0b5){_0x272eda['push'](_0x272eda['shift']());}};_0x174130(++_0x1c35ec);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2c2544,_0x2cc950){_0x2c2544=_0x2c2544-0x0;var _0x5ea450=_0x4e2e[_0x2c2544];return _0x5ea450;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)[_0xe4e2('0x1b')]();});}};}function handleEntityNotFound(_0x29143c,_0x3f5265){return function(_0x249b7e){if(!_0x249b7e){_0x29143c['sendStatus'](0x194);}return _0x249b7e;};}function handleError(_0x166610,_0x357903){_0x357903=_0x357903||0x1f4;return function(_0x1f6d1f){logger['error'](_0x1f6d1f[_0xe4e2('0x28')]);if(_0x1f6d1f[_0xe4e2('0x29')]){delete _0x1f6d1f[_0xe4e2('0x29')];}_0x166610['status'](_0x357903)[_0xe4e2('0x2a')](_0x1f6d1f);};}exports['index']=function(_0x477b5c,_0x1e21c0){var _0x52c849={},_0x46926a={},_0x18e2e5={'count':0x0,'rows':[]};var _0x135116=_[_0xe4e2('0x2b')](db[_0xe4e2('0x2c')]['rawAttributes'],function(_0x5f30dc){return{'name':_0x5f30dc[_0xe4e2('0x2d')],'type':_0x5f30dc[_0xe4e2('0x2e')][_0xe4e2('0x2f')]};});_0x46926a[_0xe4e2('0x30')]=_[_0xe4e2('0x2b')](_0x135116,_0xe4e2('0x29'));_0x46926a[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x477b5c[_0xe4e2('0x31')]);_0x46926a[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],_0x46926a['query']);_0x52c849[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x52c849['attributes']=_0x52c849[_0xe4e2('0x35')][_0xe4e2('0x37')]?_0x52c849[_0xe4e2('0x35')]:_0x46926a[_0xe4e2('0x30')];if(!_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x38')](_0xe4e2('0x39'))){_0x52c849[_0xe4e2('0x1d')]=qs[_0xe4e2('0x1d')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x1d')]);_0x52c849['offset']=qs[_0xe4e2('0x1c')](_0x477b5c['query'][_0xe4e2('0x1c')]);}_0x52c849[_0xe4e2('0x3a')]=qs['sort'](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3b')]);_0x52c849[_0xe4e2('0x3c')]=qs[_0xe4e2('0x33')](_['pick'](_0x477b5c[_0xe4e2('0x31')],_0x46926a['filters']),_0x135116);if(_0x477b5c[_0xe4e2('0x31')]['filter']){_0x52c849[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x52c849[_0xe4e2('0x3c')],{'$or':_['map'](_0x135116,function(_0x2f5576){if(_0x2f5576[_0xe4e2('0x2e')]!=='VIRTUAL'){var _0x2b0f61={};_0x2b0f61[_0x2f5576[_0xe4e2('0x29')]]={'$like':'%'+_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3e')]+'%'};return _0x2b0f61;}})});}_0x52c849=_[_0xe4e2('0x3d')]({},_0x52c849,_0x477b5c[_0xe4e2('0x3f')]);var _0x18fa94={'where':_0x52c849[_0xe4e2('0x3c')]};return db[_0xe4e2('0x2c')]['count'](_0x18fa94)['then'](function(_0xf4f15f){_0x18e2e5[_0xe4e2('0x1f')]=_0xf4f15f;if(_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x40')]){_0x52c849['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xe4e2('0x41')](_0x52c849);})[_0xe4e2('0x26')](function(_0x3080d5){_0x18e2e5[_0xe4e2('0x42')]=_0x3080d5;return _0x18e2e5;})['then'](respondWithFilteredResult(_0x1e21c0,_0x52c849))[_0xe4e2('0x43')](handleError(_0x1e21c0,null));};exports[_0xe4e2('0x44')]=function(_0x385572,_0x577d4c){var _0x1b54f6={'raw':!![],'where':{'id':_0x385572[_0xe4e2('0x45')]['id']}},_0x4789cf={};_0x4789cf[_0xe4e2('0x30')]=_['keys'](db['MailQueueReport'][_0xe4e2('0x46')]);_0x4789cf[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x385572['query']);_0x4789cf[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x4789cf['model'],_0x4789cf[_0xe4e2('0x31')]);_0x1b54f6[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x4789cf[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x385572[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x1b54f6[_0xe4e2('0x35')]=_0x1b54f6['attributes'][_0xe4e2('0x37')]?_0x1b54f6[_0xe4e2('0x35')]:_0x4789cf['model'];if(_0x385572['query'][_0xe4e2('0x40')]){_0x1b54f6[_0xe4e2('0x47')]=[{'all':!![]}];}_0x1b54f6=_[_0xe4e2('0x3d')]({},_0x1b54f6,_0x385572['options']);return db[_0xe4e2('0x2c')][_0xe4e2('0x48')](_0x1b54f6)[_0xe4e2('0x26')](handleEntityNotFound(_0x577d4c,null))[_0xe4e2('0x26')](respondWithResult(_0x577d4c,null))['catch'](handleError(_0x577d4c,null));};exports[_0xe4e2('0x49')]=function(_0x918c17,_0x32a7c6){return db[_0xe4e2('0x2c')]['create'](_0x918c17[_0xe4e2('0x4a')],{})[_0xe4e2('0x26')](respondWithResult(_0x32a7c6,0xc9))['catch'](handleError(_0x32a7c6,null));};exports[_0xe4e2('0x4b')]=function(_0xedcd86,_0x21e5d7){if(_0xedcd86['body']['id']){delete _0xedcd86[_0xe4e2('0x4a')]['id'];}return db[_0xe4e2('0x2c')][_0xe4e2('0x48')]({'where':{'id':_0xedcd86['params']['id']}})['then'](handleEntityNotFound(_0x21e5d7,null))[_0xe4e2('0x26')](saveUpdates(_0xedcd86['body'],null))[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,null))['catch'](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x27')]=function(_0x2125df,_0x2a2e76){return db['MailQueueReport'][_0xe4e2('0x48')]({'where':{'id':_0x2125df['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x2a2e76,null))[_0xe4e2('0x26')](removeEntity(_0x2a2e76,null))['catch'](handleError(_0x2a2e76,null));};exports[_0xe4e2('0x4c')]=function(_0x582674,_0x169251){return db[_0xe4e2('0x2c')]['describe']()[_0xe4e2('0x26')](respondWithResult(_0x169251,null))[_0xe4e2('0x43')](handleError(_0x169251,null));};
\ No newline at end of file
+var _0xdf55=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x5f0bb6,_0x1874a9){var _0x14cdcf=function(_0x4373e9){while(--_0x4373e9){_0x5f0bb6['push'](_0x5f0bb6['shift']());}};_0x14cdcf(++_0x1874a9);}(_0xdf55,0x83));var _0x5df5=function(_0x1e6ca5,_0xfb9d62){_0x1e6ca5=_0x1e6ca5-0x0;var _0xf1e27=_0xdf55[_0x1e6ca5];return _0xf1e27;};'use strict';var emlformat=require(_0x5df5('0x0'));var rimraf=require(_0x5df5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5df5('0x2'));var rp=require(_0x5df5('0x3'));var moment=require('moment');var BPromise=require(_0x5df5('0x4'));var Mustache=require(_0x5df5('0x5'));var util=require(_0x5df5('0x6'));var path=require('path');var sox=require(_0x5df5('0x7'));var csv=require(_0x5df5('0x8'));var ejs=require(_0x5df5('0x9'));var fs=require('fs');var fs_extra=require(_0x5df5('0xa'));var _=require(_0x5df5('0xb'));var squel=require(_0x5df5('0xc'));var crypto=require(_0x5df5('0xd'));var jsforce=require(_0x5df5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5df5('0x8'));var querystring=require(_0x5df5('0xf'));var Papa=require(_0x5df5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5df5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5df5('0x12'));var logger=require(_0x5df5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5df5('0x14'));var licenseUtil=require(_0x5df5('0x15'));var db=require(_0x5df5('0x16'))['db'];function respondWithStatusCode(_0x4c3d6f,_0xe8bcd8){_0xe8bcd8=_0xe8bcd8||0xcc;return function(_0xb4a4fe){if(_0xb4a4fe){return _0x4c3d6f[_0x5df5('0x17')](_0xe8bcd8);}return _0x4c3d6f[_0x5df5('0x18')](_0xe8bcd8)[_0x5df5('0x19')]();};}function respondWithResult(_0x956317,_0x555d3f){_0x555d3f=_0x555d3f||0xc8;return function(_0x30fd32){if(_0x30fd32){return _0x956317['status'](_0x555d3f)[_0x5df5('0x1a')](_0x30fd32);}};}function respondWithFilteredResult(_0x33f818,_0x5b0ad9){return function(_0x3657c8){if(_0x3657c8){var _0x282d53=typeof _0x5b0ad9['offset']===_0x5df5('0x1b')&&typeof _0x5b0ad9[_0x5df5('0x1c')]==='undefined';var _0x9a52c9=_0x3657c8[_0x5df5('0x1d')];var _0xb7e1c2=_0x282d53?0x0:_0x5b0ad9[_0x5df5('0x1e')];var _0x215d59=_0x282d53?_0x3657c8['count']:_0x5b0ad9['offset']+_0x5b0ad9[_0x5df5('0x1c')];var _0x5d8dfd;if(_0x215d59>=_0x9a52c9){_0x215d59=_0x9a52c9;_0x5d8dfd=0xc8;}else{_0x5d8dfd=0xce;}_0x33f818[_0x5df5('0x18')](_0x5d8dfd);return _0x33f818[_0x5df5('0x1f')](_0x5df5('0x20'),_0xb7e1c2+'-'+_0x215d59+'/'+_0x9a52c9)[_0x5df5('0x1a')](_0x3657c8);}return null;};}function patchUpdates(_0x1deae7){return function(_0x4b4b57){try{jsonpatch[_0x5df5('0x21')](_0x4b4b57,_0x1deae7,!![]);}catch(_0x39d8a1){return BPromise[_0x5df5('0x22')](_0x39d8a1);}return _0x4b4b57[_0x5df5('0x23')]();};}function saveUpdates(_0x28efc8,_0x382999){return function(_0x59ff67){if(_0x59ff67){return _0x59ff67[_0x5df5('0x24')](_0x28efc8)[_0x5df5('0x25')](function(_0x8742a7){return _0x8742a7;});}return null;};}function removeEntity(_0x446bba,_0x5ca542){return function(_0x4358ba){if(_0x4358ba){return _0x4358ba[_0x5df5('0x26')]()[_0x5df5('0x25')](function(){_0x446bba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x532923,_0x357fb0){return function(_0x3ff82e){if(!_0x3ff82e){_0x532923[_0x5df5('0x17')](0x194);}return _0x3ff82e;};}function handleError(_0xa7f4b3,_0x1baf52){_0x1baf52=_0x1baf52||0x1f4;return function(_0x1fd83c){logger[_0x5df5('0x27')](_0x1fd83c[_0x5df5('0x28')]);if(_0x1fd83c['name']){delete _0x1fd83c[_0x5df5('0x29')];}_0xa7f4b3['status'](_0x1baf52)[_0x5df5('0x2a')](_0x1fd83c);};}exports[_0x5df5('0x2b')]=function(_0x5bc181,_0x3854d0){var _0x4945c6={},_0xd2b213={},_0x4cccf1={'count':0x0,'rows':[]};var _0x2e1885=_['map'](db[_0x5df5('0x2c')]['rawAttributes'],function(_0x2f91e3){return{'name':_0x2f91e3[_0x5df5('0x2d')],'type':_0x2f91e3[_0x5df5('0x2e')]['key']};});_0xd2b213[_0x5df5('0x2f')]=_[_0x5df5('0x30')](_0x2e1885,_0x5df5('0x29'));_0xd2b213[_0x5df5('0x31')]=_[_0x5df5('0x32')](_0x5bc181[_0x5df5('0x31')]);_0xd2b213[_0x5df5('0x33')]=_['intersection'](_0xd2b213['model'],_0xd2b213[_0x5df5('0x31')]);_0x4945c6[_0x5df5('0x34')]=_[_0x5df5('0x35')](_0xd2b213[_0x5df5('0x2f')],qs[_0x5df5('0x36')](_0x5bc181[_0x5df5('0x31')]['fields']));_0x4945c6[_0x5df5('0x34')]=_0x4945c6[_0x5df5('0x34')][_0x5df5('0x37')]?_0x4945c6[_0x5df5('0x34')]:_0xd2b213['model'];if(!_0x5bc181[_0x5df5('0x31')]['hasOwnProperty'](_0x5df5('0x38'))){_0x4945c6[_0x5df5('0x1c')]=qs['limit'](_0x5bc181[_0x5df5('0x31')]['limit']);_0x4945c6[_0x5df5('0x1e')]=qs[_0x5df5('0x1e')](_0x5bc181[_0x5df5('0x31')][_0x5df5('0x1e')]);}_0x4945c6['order']=qs[_0x5df5('0x39')](_0x5bc181[_0x5df5('0x31')][_0x5df5('0x39')]);_0x4945c6[_0x5df5('0x3a')]=qs['filters'](_[_0x5df5('0x3b')](_0x5bc181[_0x5df5('0x31')],_0xd2b213[_0x5df5('0x33')]),_0x2e1885);if(_0x5bc181[_0x5df5('0x31')][_0x5df5('0x3c')]){_0x4945c6[_0x5df5('0x3a')]=_[_0x5df5('0x3d')](_0x4945c6['where'],{'$or':_[_0x5df5('0x30')](_0x2e1885,function(_0x3102c7){if(_0x3102c7['type']!==_0x5df5('0x3e')){var _0x217844={};_0x217844[_0x3102c7['name']]={'$like':'%'+_0x5bc181[_0x5df5('0x31')][_0x5df5('0x3c')]+'%'};return _0x217844;}})});}_0x4945c6=_[_0x5df5('0x3d')]({},_0x4945c6,_0x5bc181[_0x5df5('0x3f')]);var _0x235f3e={'where':_0x4945c6[_0x5df5('0x3a')]};return db[_0x5df5('0x2c')][_0x5df5('0x1d')](_0x235f3e)['then'](function(_0x5e6c93){_0x4cccf1[_0x5df5('0x1d')]=_0x5e6c93;if(_0x5bc181['query'][_0x5df5('0x40')]){_0x4945c6[_0x5df5('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x5df5('0x42')](_0x4945c6);})[_0x5df5('0x25')](function(_0x23e592){_0x4cccf1[_0x5df5('0x43')]=_0x23e592;return _0x4cccf1;})[_0x5df5('0x25')](respondWithFilteredResult(_0x3854d0,_0x4945c6))[_0x5df5('0x44')](handleError(_0x3854d0,null));};exports[_0x5df5('0x45')]=function(_0x3902a1,_0x5824c3){var _0x42b562={'raw':!![],'where':{'id':_0x3902a1[_0x5df5('0x46')]['id']}},_0x4a4057={};_0x4a4057[_0x5df5('0x2f')]=_[_0x5df5('0x32')](db[_0x5df5('0x2c')][_0x5df5('0x47')]);_0x4a4057['query']=_[_0x5df5('0x32')](_0x3902a1[_0x5df5('0x31')]);_0x4a4057[_0x5df5('0x33')]=_['intersection'](_0x4a4057[_0x5df5('0x2f')],_0x4a4057[_0x5df5('0x31')]);_0x42b562['attributes']=_[_0x5df5('0x35')](_0x4a4057[_0x5df5('0x2f')],qs[_0x5df5('0x36')](_0x3902a1[_0x5df5('0x31')]['fields']));_0x42b562[_0x5df5('0x34')]=_0x42b562[_0x5df5('0x34')]['length']?_0x42b562[_0x5df5('0x34')]:_0x4a4057[_0x5df5('0x2f')];if(_0x3902a1[_0x5df5('0x31')]['includeAll']){_0x42b562[_0x5df5('0x41')]=[{'all':!![]}];}_0x42b562=_[_0x5df5('0x3d')]({},_0x42b562,_0x3902a1[_0x5df5('0x3f')]);return db[_0x5df5('0x2c')]['find'](_0x42b562)[_0x5df5('0x25')](handleEntityNotFound(_0x5824c3,null))[_0x5df5('0x25')](respondWithResult(_0x5824c3,null))[_0x5df5('0x44')](handleError(_0x5824c3,null));};exports[_0x5df5('0x48')]=function(_0x14f9ca,_0x5f44cb){return db['MailQueueReport'][_0x5df5('0x48')](_0x14f9ca['body'],{})[_0x5df5('0x25')](respondWithResult(_0x5f44cb,0xc9))[_0x5df5('0x44')](handleError(_0x5f44cb,null));};exports[_0x5df5('0x24')]=function(_0x28108e,_0x48462e){if(_0x28108e[_0x5df5('0x49')]['id']){delete _0x28108e[_0x5df5('0x49')]['id'];}return db[_0x5df5('0x2c')][_0x5df5('0x4a')]({'where':{'id':_0x28108e[_0x5df5('0x46')]['id']}})[_0x5df5('0x25')](handleEntityNotFound(_0x48462e,null))['then'](saveUpdates(_0x28108e[_0x5df5('0x49')],null))['then'](respondWithResult(_0x48462e,null))[_0x5df5('0x44')](handleError(_0x48462e,null));};exports[_0x5df5('0x26')]=function(_0x17288f,_0x4d1ebd){return db[_0x5df5('0x2c')]['find']({'where':{'id':_0x17288f[_0x5df5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d1ebd,null))[_0x5df5('0x25')](removeEntity(_0x4d1ebd,null))[_0x5df5('0x44')](handleError(_0x4d1ebd,null));};exports[_0x5df5('0x4b')]=function(_0x5997c1,_0x3d92a3){return db[_0x5df5('0x2c')]['describe']()[_0x5df5('0x25')](respondWithResult(_0x3d92a3,null))[_0x5df5('0x44')](handleError(_0x3d92a3,null));};
\ No newline at end of file
index 1f966c9..721a407 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6522=['exports','define','MailQueueReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x12c766,_0x56c122){var _0x115acf=function(_0x423e5e){while(--_0x423e5e){_0x12c766['push'](_0x12c766['shift']());}};_0x115acf(++_0x56c122);}(_0x6522,0x1f0));var _0x2652=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6522[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2652('0x0'))(_0x2652('0x1'));var moment=require(_0x2652('0x2'));var BPromise=require(_0x2652('0x3'));var rp=require(_0x2652('0x4'));var fs=require('fs');var path=require(_0x2652('0x5'));var rimraf=require('rimraf');var config=require(_0x2652('0x6'));var attributes=require(_0x2652('0x7'));module[_0x2652('0x8')]=function(_0x4910dd,_0x45492e){return _0x4910dd[_0x2652('0x9')](_0x2652('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x2652('0xb'),'fields':[_0x2652('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0bba=['MailQueueReport','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','./mailQueueReport.attributes','exports','define'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0x0bba,0xe9));var _0xa0bb=function(_0x3adee3,_0x5bda11){_0x3adee3=_0x3adee3-0x0;var _0x15605a=_0x0bba[_0x3adee3];return _0x15605a;};'use strict';var _=require(_0xa0bb('0x0'));var util=require(_0xa0bb('0x1'));var logger=require(_0xa0bb('0x2'))('api');var moment=require(_0xa0bb('0x3'));var BPromise=require('bluebird');var rp=require(_0xa0bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0bb('0x5'));var config=require('../../config/environment');var attributes=require(_0xa0bb('0x6'));module[_0xa0bb('0x7')]=function(_0x3e0c8f,_0x28c5d2){return _0x3e0c8f[_0xa0bb('0x8')](_0xa0bb('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xa0bb('0xa'),'fields':[_0xa0bb('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index d0f95b8..9dab263 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x2ef3,0xba));var _0x32ef=function(_0x505a90,_0x4a3d2a){_0x505a90=_0x505a90-0x0;var _0x3c1012=_0x2ef3[_0x505a90];return _0x3c1012;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});};
\ No newline at end of file
+var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26c334,_0x4ebb05){var _0x145c7b=function(_0x34bf49){while(--_0x34bf49){_0x26c334['push'](_0x26c334['shift']());}};_0x145c7b(++_0x4ebb05);}(_0x326f,0xd1));var _0xf326=function(_0x5a0026,_0xbb4a94){_0x5a0026=_0x5a0026-0x0;var _0x3ced18=_0x326f[_0x5a0026];return _0x3ced18;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});};
\ No newline at end of file
index fa6687e..32ec81d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1382bb,_0x24cbcb){var _0x3a209c=function(_0x4c9e43){while(--_0x4c9e43){_0x1382bb['push'](_0x1382bb['shift']());}};_0x3a209c(++_0x24cbcb);}(_0xedd9,0xfc));var _0x9edd=function(_0x2292dc,_0x51bdc6){_0x2292dc=_0x2292dc-0x0;var _0x4eaa57=_0xedd9[_0x2292dc];return _0x4eaa57;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router;
\ No newline at end of file
+var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4da6c4,_0x2f2213){var _0x48feaa=function(_0x4b42af){while(--_0x4b42af){_0x4da6c4['push'](_0x4da6c4['shift']());}};_0x48feaa(++_0x2f2213);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
index 3f952ba..c16ca7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9126=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9126,0x66));var _0x6912=function(_0x3a0fcf,_0x5d7e49){_0x3a0fcf=_0x3a0fcf-0x0;var _0x467bb6=_0x9126[_0x3a0fcf];return _0x467bb6;};'use strict';var Sequelize=require(_0x6912('0x0'));module[_0x6912('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6912('0x2')]},'authentication':{'type':Sequelize[_0x6912('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6912('0x2')]},'password':{'type':Sequelize[_0x6912('0x2')]},'port':{'type':Sequelize[_0x6912('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6912('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x6912('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6912('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x6912('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x41f7=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0xf8935d,_0x5cdb50){var _0x2d25b8=function(_0x416964){while(--_0x416964){_0xf8935d['push'](_0xf8935d['shift']());}};_0x2d25b8(++_0x5cdb50);}(_0x41f7,0x1c5));var _0x741f=function(_0x202b50,_0x1d440b){_0x202b50=_0x202b50-0x0;var _0x4436ef=_0x41f7[_0x202b50];return _0x4436ef;};'use strict';var Sequelize=require(_0x741f('0x0'));module[_0x741f('0x1')]={'description':{'type':Sequelize[_0x741f('0x2')]},'host':{'type':Sequelize[_0x741f('0x2')]},'authentication':{'type':Sequelize[_0x741f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x741f('0x2')]},'password':{'type':Sequelize[_0x741f('0x2')]},'port':{'type':Sequelize[_0x741f('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x741f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x741f('0x3')],'defaultValue':![]}};
\ No newline at end of file
index 58fd60f..b789099 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfbe1=['api','moment','bluebird','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0xad61b5,_0x48e93c){var _0x1852ff=function(_0x22ef81){while(--_0x22ef81){_0xad61b5['push'](_0xad61b5['shift']());}};_0x1852ff(++_0x48e93c);}(_0xfbe1,0xf4));var _0x1fbe=function(_0x282734,_0x123c5c){_0x282734=_0x282734-0x0;var _0x7e1e9a=_0xfbe1[_0x282734];return _0x7e1e9a;};'use strict';var _=require(_0x1fbe('0x0'));var util=require(_0x1fbe('0x1'));var logger=require(_0x1fbe('0x2'))(_0x1fbe('0x3'));var moment=require(_0x1fbe('0x4'));var BPromise=require(_0x1fbe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fbe('0x6'));var rimraf=require(_0x1fbe('0x7'));var config=require('../../config/environment');var attributes=require(_0x1fbe('0x8'));module[_0x1fbe('0x9')]=function(_0x1d4701,_0x39fec7){return _0x1d4701[_0x1fbe('0xa')](_0x1fbe('0xb'),attributes,{'tableName':_0x1fbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4a0c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','../../config/logger'];(function(_0x1a68e7,_0x379dc3){var _0x3b66f3=function(_0x4b00ae){while(--_0x4b00ae){_0x1a68e7['push'](_0x1a68e7['shift']());}};_0x3b66f3(++_0x379dc3);}(_0x4a0c,0x1e7));var _0xc4a0=function(_0x46ff3f,_0xcc4d4a){_0x46ff3f=_0x46ff3f-0x0;var _0x1a7e94=_0x4a0c[_0x46ff3f];return _0x1a7e94;};'use strict';var _=require(_0xc4a0('0x0'));var util=require(_0xc4a0('0x1'));var logger=require(_0xc4a0('0x2'))(_0xc4a0('0x3'));var moment=require(_0xc4a0('0x4'));var BPromise=require(_0xc4a0('0x5'));var rp=require(_0xc4a0('0x6'));var fs=require('fs');var path=require(_0xc4a0('0x7'));var rimraf=require(_0xc4a0('0x8'));var config=require(_0xc4a0('0x9'));var attributes=require(_0xc4a0('0xa'));module[_0xc4a0('0xb')]=function(_0x1f2e87,_0x4834e4){return _0x1f2e87[_0xc4a0('0xc')](_0xc4a0('0xd'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ffffc7a..f7912e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c38=['GetMailServerIn','options','where','map','model','attributes','include','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','request','then','request\x20sent','debug','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','catch'];(function(_0x343ebf,_0xb2087a){var _0x5cb860=function(_0x18563e){while(--_0x18563e){_0x343ebf['push'](_0x343ebf['shift']());}};_0x5cb860(++_0xb2087a);}(_0x6c38,0x8f));var _0x86c3=function(_0xb9abb9,_0x327bad){_0xb9abb9=_0xb9abb9-0x0;var _0x458278=_0x6c38[_0xb9abb9];return _0x458278;};'use strict';var _=require(_0x86c3('0x0'));var util=require(_0x86c3('0x1'));var moment=require(_0x86c3('0x2'));var BPromise=require(_0x86c3('0x3'));var rs=require(_0x86c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x86c3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49ff58,_0x3a8924,_0xbde89c){return new BPromise(function(_0x224109,_0x5e6afe){return client[_0x86c3('0x8')](_0x49ff58,_0xbde89c)[_0x86c3('0x9')](function(_0x4df76e){logger['info']('MailServerIn,\x20%s,\x20%s',_0x3a8924,_0x86c3('0xa'));logger[_0x86c3('0xb')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3a8924,_0x86c3('0xa'),JSON['stringify'](_0x4df76e));if(_0x4df76e[_0x86c3('0xc')]){if(_0x4df76e[_0x86c3('0xc')][_0x86c3('0xd')]===0x1f4){logger[_0x86c3('0xc')](_0x86c3('0xe'),_0x3a8924,_0x4df76e[_0x86c3('0xc')]['message']);return _0x5e6afe(_0x4df76e[_0x86c3('0xc')][_0x86c3('0xf')]);}logger['error'](_0x86c3('0xe'),_0x3a8924,_0x4df76e[_0x86c3('0xc')]['message']);return _0x224109(_0x4df76e[_0x86c3('0xc')]['message']);}else{logger[_0x86c3('0x10')](_0x86c3('0xe'),_0x3a8924,_0x86c3('0xa'));_0x224109(_0x4df76e[_0x86c3('0x11')][_0x86c3('0xf')]);}})[_0x86c3('0x12')](function(_0x2153dc){logger['error'](_0x86c3('0xe'),_0x3a8924,_0x2153dc);_0x5e6afe(_0x2153dc);});});}exports[_0x86c3('0x13')]=function(_0x277c0e){var _0x1da025=this;return new Promise(function(_0x505453,_0x14f63f){return db['MailServerIn']['findAll']({'raw':_0x277c0e[_0x86c3('0x14')]?_0x277c0e[_0x86c3('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x277c0e[_0x86c3('0x14')]?_0x277c0e[_0x86c3('0x14')][_0x86c3('0x15')]||null:null,'attributes':_0x277c0e[_0x86c3('0x14')]?_0x277c0e[_0x86c3('0x14')]['attributes']||null:null,'limit':_0x277c0e[_0x86c3('0x14')]?_0x277c0e[_0x86c3('0x14')]['limit']||null:null,'include':_0x277c0e[_0x86c3('0x14')]?_0x277c0e[_0x86c3('0x14')]['include']?_[_0x86c3('0x16')](_0x277c0e['options']['include'],function(_0x2d3f98){return{'model':db[_0x2d3f98[_0x86c3('0x17')]],'as':_0x2d3f98['as'],'attributes':_0x2d3f98[_0x86c3('0x18')],'include':_0x2d3f98[_0x86c3('0x19')]?_[_0x86c3('0x16')](_0x2d3f98['include'],function(_0x3b4f66){return{'model':db[_0x3b4f66[_0x86c3('0x17')]],'as':_0x3b4f66['as'],'attributes':_0x3b4f66['attributes'],'include':_0x3b4f66[_0x86c3('0x19')]?_[_0x86c3('0x16')](_0x3b4f66[_0x86c3('0x19')],function(_0x415483){return{'model':db[_0x415483[_0x86c3('0x17')]],'as':_0x415483['as'],'attributes':_0x415483['attributes']};}):[]};}):[]};}):[]:[]})[_0x86c3('0x9')](function(_0x2c5802){logger[_0x86c3('0x10')](_0x86c3('0x13'),_0x277c0e);logger[_0x86c3('0xb')](_0x86c3('0x13'),_0x277c0e,JSON[_0x86c3('0x1a')](_0x2c5802));_0x505453(_0x2c5802);})['catch'](function(_0x38cf3c){logger[_0x86c3('0xc')](_0x86c3('0x13'),_0x38cf3c[_0x86c3('0xf')],_0x277c0e);_0x14f63f(_0x1da025[_0x86c3('0xc')](0x1f4,_0x38cf3c[_0x86c3('0xf')]));});});};
\ No newline at end of file
+var _0x90db=['message','result','catch','GetMailServerIn','options','raw','where','attributes','limit','include','map','model','debug','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x90db,0x1c0));var _0xb90d=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x90db[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require('lodash');var util=require(_0xb90d('0x0'));var moment=require(_0xb90d('0x1'));var BPromise=require(_0xb90d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb90d('0x3'));var config=require(_0xb90d('0x4'));var jayson=require(_0xb90d('0x5'));var client=jayson[_0xb90d('0x6')][_0xb90d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d8398,_0x180781,_0x126e17){return new BPromise(function(_0x2ef5e6,_0x108b88){return client[_0xb90d('0x8')](_0x2d8398,_0x126e17)[_0xb90d('0x9')](function(_0x48c4f6){logger[_0xb90d('0xa')](_0xb90d('0xb'),_0x180781,_0xb90d('0xc'));logger['debug'](_0xb90d('0xd'),_0x180781,_0xb90d('0xc'),JSON[_0xb90d('0xe')](_0x48c4f6));if(_0x48c4f6[_0xb90d('0xf')]){if(_0x48c4f6[_0xb90d('0xf')]['code']===0x1f4){logger[_0xb90d('0xf')]('MailServerIn,\x20%s,\x20%s',_0x180781,_0x48c4f6[_0xb90d('0xf')][_0xb90d('0x10')]);return _0x108b88(_0x48c4f6[_0xb90d('0xf')][_0xb90d('0x10')]);}logger[_0xb90d('0xf')](_0xb90d('0xb'),_0x180781,_0x48c4f6[_0xb90d('0xf')]['message']);return _0x2ef5e6(_0x48c4f6[_0xb90d('0xf')]['message']);}else{logger[_0xb90d('0xa')](_0xb90d('0xb'),_0x180781,'request\x20sent');_0x2ef5e6(_0x48c4f6[_0xb90d('0x11')]['message']);}})[_0xb90d('0x12')](function(_0x396f3f){logger[_0xb90d('0xf')](_0xb90d('0xb'),_0x180781,_0x396f3f);_0x108b88(_0x396f3f);});});}exports[_0xb90d('0x13')]=function(_0x47ee5d){var _0x135bf2=this;return new Promise(function(_0x4bd383,_0x2cd352){return db['MailServerIn']['findAll']({'raw':_0x47ee5d[_0xb90d('0x14')]?_0x47ee5d[_0xb90d('0x14')][_0xb90d('0x15')]===undefined?!![]:![]:!![],'where':_0x47ee5d[_0xb90d('0x14')]?_0x47ee5d[_0xb90d('0x14')][_0xb90d('0x16')]||null:null,'attributes':_0x47ee5d['options']?_0x47ee5d[_0xb90d('0x14')][_0xb90d('0x17')]||null:null,'limit':_0x47ee5d['options']?_0x47ee5d[_0xb90d('0x14')][_0xb90d('0x18')]||null:null,'include':_0x47ee5d[_0xb90d('0x14')]?_0x47ee5d[_0xb90d('0x14')][_0xb90d('0x19')]?_[_0xb90d('0x1a')](_0x47ee5d[_0xb90d('0x14')][_0xb90d('0x19')],function(_0x37b8ec){return{'model':db[_0x37b8ec[_0xb90d('0x1b')]],'as':_0x37b8ec['as'],'attributes':_0x37b8ec[_0xb90d('0x17')],'include':_0x37b8ec[_0xb90d('0x19')]?_[_0xb90d('0x1a')](_0x37b8ec['include'],function(_0x280ec3){return{'model':db[_0x280ec3['model']],'as':_0x280ec3['as'],'attributes':_0x280ec3[_0xb90d('0x17')],'include':_0x280ec3[_0xb90d('0x19')]?_[_0xb90d('0x1a')](_0x280ec3[_0xb90d('0x19')],function(_0x31aee9){return{'model':db[_0x31aee9[_0xb90d('0x1b')]],'as':_0x31aee9['as'],'attributes':_0x31aee9[_0xb90d('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb90d('0x9')](function(_0x29d8ea){logger[_0xb90d('0xa')]('GetMailServerIn',_0x47ee5d);logger[_0xb90d('0x1c')](_0xb90d('0x13'),_0x47ee5d,JSON[_0xb90d('0xe')](_0x29d8ea));_0x4bd383(_0x29d8ea);})[_0xb90d('0x12')](function(_0x1f9151){logger[_0xb90d('0xf')]('GetMailServerIn',_0x1f9151['message'],_0x47ee5d);_0x2cd352(_0x135bf2['error'](0x1f4,_0x1f9151[_0xb90d('0x10')]));});});};
\ No newline at end of file
index 051e86e..5518631 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e11ed,_0xd2e1c3){_0x4e11ed=_0x4e11ed-0x0;var _0x4b8a67=_0x7a54[_0x4e11ed];return _0x4b8a67;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router;
\ No newline at end of file
+var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x368984,_0x4ca8c6){_0x368984=_0x368984-0x0;var _0x2faea3=_0x7a54[_0x368984];return _0x2faea3;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router;
\ No newline at end of file
index 5420404..b24df07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7916=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xdbbdc2,_0x16a3be){var _0x20f387=function(_0x215f7d){while(--_0x215f7d){_0xdbbdc2['push'](_0xdbbdc2['shift']());}};_0x20f387(++_0x16a3be);}(_0x7916,0x128));var _0x6791=function(_0x5f18ff,_0x28c4d1){_0x5f18ff=_0x5f18ff-0x0;var _0x34a6b4=_0x7916[_0x5f18ff];return _0x34a6b4;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'description':{'type':Sequelize[_0x6791('0x1')]},'host':{'type':Sequelize[_0x6791('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x6791('0x1')]},'port':{'type':Sequelize[_0x6791('0x2')]},'secure':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x6791('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]}};
\ No newline at end of file
+var _0x2547=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x2547,0x1cd));var _0x7254=function(_0x401856,_0x57189c){_0x401856=_0x401856-0x0;var _0x5f0d0d=_0x2547[_0x401856];return _0x5f0d0d;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'description':{'type':Sequelize[_0x7254('0x1')]},'host':{'type':Sequelize[_0x7254('0x1')]},'user':{'type':Sequelize[_0x7254('0x1')]},'pass':{'type':Sequelize[_0x7254('0x1')]},'port':{'type':Sequelize[_0x7254('0x2')]},'secure':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x7254('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]}};
\ No newline at end of file
index 6bc7552..8c77123 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5cf8=['map','MailServerOut','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','save','then','sendStatus','error','stack','name','send'];(function(_0x3e6c74,_0x1e5e16){var _0x46f3fc=function(_0x17d9ab){while(--_0x17d9ab){_0x3e6c74['push'](_0x3e6c74['shift']());}};_0x46f3fc(++_0x1e5e16);}(_0x5cf8,0x14c));var _0x85cf=function(_0x50e89b,_0x4bded8){_0x50e89b=_0x50e89b-0x0;var _0x4b9202=_0x5cf8[_0x50e89b];return _0x4b9202;};'use strict';var emlformat=require(_0x85cf('0x0'));var rimraf=require(_0x85cf('0x1'));var zipdir=require(_0x85cf('0x2'));var jsonpatch=require(_0x85cf('0x3'));var rp=require(_0x85cf('0x4'));var moment=require(_0x85cf('0x5'));var BPromise=require(_0x85cf('0x6'));var Mustache=require('mustache');var util=require(_0x85cf('0x7'));var path=require(_0x85cf('0x8'));var sox=require(_0x85cf('0x9'));var csv=require(_0x85cf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85cf('0xb'));var _=require(_0x85cf('0xc'));var squel=require(_0x85cf('0xd'));var crypto=require(_0x85cf('0xe'));var jsforce=require(_0x85cf('0xf'));var deskjs=require(_0x85cf('0x10'));var toCsv=require(_0x85cf('0xa'));var querystring=require(_0x85cf('0x11'));var Papa=require(_0x85cf('0x12'));var Redis=require(_0x85cf('0x13'));var authService=require(_0x85cf('0x14'));var qs=require(_0x85cf('0x15'));var as=require(_0x85cf('0x16'));var hardwareService=require(_0x85cf('0x17'));var logger=require(_0x85cf('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x85cf('0x19'));var licenseUtil=require(_0x85cf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe5de76,_0x58efc2){_0x58efc2=_0x58efc2||0xcc;return function(_0x353159){if(_0x353159){return _0xe5de76['sendStatus'](_0x58efc2);}return _0xe5de76[_0x85cf('0x1b')](_0x58efc2)[_0x85cf('0x1c')]();};}function respondWithResult(_0x14e8c1,_0x19c3fc){_0x19c3fc=_0x19c3fc||0xc8;return function(_0x1c3c0f){if(_0x1c3c0f){return _0x14e8c1[_0x85cf('0x1b')](_0x19c3fc)['json'](_0x1c3c0f);}};}function respondWithFilteredResult(_0x2e0bb5,_0x27d5a6){return function(_0xdeb1e4){if(_0xdeb1e4){var _0x536f37=typeof _0x27d5a6[_0x85cf('0x1d')]===_0x85cf('0x1e')&&typeof _0x27d5a6[_0x85cf('0x1f')]==='undefined';var _0x23afaf=_0xdeb1e4['count'];var _0x2d2e99=_0x536f37?0x0:_0x27d5a6[_0x85cf('0x1d')];var _0x946d44=_0x536f37?_0xdeb1e4[_0x85cf('0x20')]:_0x27d5a6[_0x85cf('0x1d')]+_0x27d5a6[_0x85cf('0x1f')];var _0x5a29a2;if(_0x946d44>=_0x23afaf){_0x946d44=_0x23afaf;_0x5a29a2=0xc8;}else{_0x5a29a2=0xce;}_0x2e0bb5['status'](_0x5a29a2);return _0x2e0bb5[_0x85cf('0x21')]('Content-Range',_0x2d2e99+'-'+_0x946d44+'/'+_0x23afaf)[_0x85cf('0x22')](_0xdeb1e4);}return null;};}function patchUpdates(_0x5579c4){return function(_0x36d4ec){try{jsonpatch[_0x85cf('0x23')](_0x36d4ec,_0x5579c4,!![]);}catch(_0x169dbc){return BPromise['reject'](_0x169dbc);}return _0x36d4ec[_0x85cf('0x24')]();};}function saveUpdates(_0x8c1b1b,_0x30d493){return function(_0x1e0c62){if(_0x1e0c62){return _0x1e0c62['update'](_0x8c1b1b)[_0x85cf('0x25')](function(_0x436234){return _0x436234;});}return null;};}function removeEntity(_0x5b8eec,_0x20f84f){return function(_0x26da4a){if(_0x26da4a){return _0x26da4a['destroy']()[_0x85cf('0x25')](function(){_0x5b8eec[_0x85cf('0x1b')](0xcc)[_0x85cf('0x1c')]();});}};}function handleEntityNotFound(_0x1f23e0,_0x5df5bc){return function(_0x32f587){if(!_0x32f587){_0x1f23e0[_0x85cf('0x26')](0x194);}return _0x32f587;};}function handleError(_0x5ef32f,_0x1f2987){_0x1f2987=_0x1f2987||0x1f4;return function(_0x5193f6){logger[_0x85cf('0x27')](_0x5193f6[_0x85cf('0x28')]);if(_0x5193f6[_0x85cf('0x29')]){delete _0x5193f6['name'];}_0x5ef32f[_0x85cf('0x1b')](_0x1f2987)[_0x85cf('0x2a')](_0x5193f6);};}exports['index']=function(_0x96b242,_0xdc64fb){var _0x5a48c3={},_0xb99a88={},_0x5bda90={'count':0x0,'rows':[]};var _0x5c5699=_[_0x85cf('0x2b')](db[_0x85cf('0x2c')][_0x85cf('0x2d')],function(_0x50a62e){return{'name':_0x50a62e['fieldName'],'type':_0x50a62e['type'][_0x85cf('0x2e')]};});_0xb99a88['model']=_[_0x85cf('0x2b')](_0x5c5699,_0x85cf('0x29'));_0xb99a88[_0x85cf('0x2f')]=_[_0x85cf('0x30')](_0x96b242[_0x85cf('0x2f')]);_0xb99a88[_0x85cf('0x31')]=_[_0x85cf('0x32')](_0xb99a88['model'],_0xb99a88[_0x85cf('0x2f')]);_0x5a48c3[_0x85cf('0x33')]=_[_0x85cf('0x32')](_0xb99a88[_0x85cf('0x34')],qs[_0x85cf('0x35')](_0x96b242[_0x85cf('0x2f')]['fields']));_0x5a48c3[_0x85cf('0x33')]=_0x5a48c3[_0x85cf('0x33')]['length']?_0x5a48c3[_0x85cf('0x33')]:_0xb99a88[_0x85cf('0x34')];if(!_0x96b242['query']['hasOwnProperty'](_0x85cf('0x36'))){_0x5a48c3[_0x85cf('0x1f')]=qs[_0x85cf('0x1f')](_0x96b242['query']['limit']);_0x5a48c3[_0x85cf('0x1d')]=qs[_0x85cf('0x1d')](_0x96b242['query'][_0x85cf('0x1d')]);}_0x5a48c3[_0x85cf('0x37')]=qs[_0x85cf('0x38')](_0x96b242['query'][_0x85cf('0x38')]);_0x5a48c3[_0x85cf('0x39')]=qs[_0x85cf('0x31')](_[_0x85cf('0x3a')](_0x96b242[_0x85cf('0x2f')],_0xb99a88['filters']),_0x5c5699);if(_0x96b242['query']['filter']){_0x5a48c3[_0x85cf('0x39')]=_['merge'](_0x5a48c3[_0x85cf('0x39')],{'$or':_['map'](_0x5c5699,function(_0x4d37aa){if(_0x4d37aa['type']!==_0x85cf('0x3b')){var _0x51c678={};_0x51c678[_0x4d37aa[_0x85cf('0x29')]]={'$like':'%'+_0x96b242[_0x85cf('0x2f')][_0x85cf('0x3c')]+'%'};return _0x51c678;}})});}_0x5a48c3=_[_0x85cf('0x3d')]({},_0x5a48c3,_0x96b242[_0x85cf('0x3e')]);var _0x26510f={'where':_0x5a48c3[_0x85cf('0x39')]};return db[_0x85cf('0x2c')][_0x85cf('0x20')](_0x26510f)['then'](function(_0x2d2828){_0x5bda90[_0x85cf('0x20')]=_0x2d2828;if(_0x96b242[_0x85cf('0x2f')][_0x85cf('0x3f')]){_0x5a48c3[_0x85cf('0x40')]=[{'all':!![]}];}return db[_0x85cf('0x2c')][_0x85cf('0x41')](_0x5a48c3);})['then'](function(_0x297337){_0x5bda90[_0x85cf('0x42')]=_0x297337;return _0x5bda90;})['then'](respondWithFilteredResult(_0xdc64fb,_0x5a48c3))[_0x85cf('0x43')](handleError(_0xdc64fb,null));};exports[_0x85cf('0x44')]=function(_0x3dfb94,_0x260502){var _0x26084e={'raw':!![],'where':{'id':_0x3dfb94[_0x85cf('0x45')]['id']}},_0x4381ac={};_0x4381ac[_0x85cf('0x34')]=_[_0x85cf('0x30')](db[_0x85cf('0x2c')][_0x85cf('0x2d')]);_0x4381ac[_0x85cf('0x2f')]=_['keys'](_0x3dfb94[_0x85cf('0x2f')]);_0x4381ac[_0x85cf('0x31')]=_[_0x85cf('0x32')](_0x4381ac[_0x85cf('0x34')],_0x4381ac['query']);_0x26084e[_0x85cf('0x33')]=_[_0x85cf('0x32')](_0x4381ac[_0x85cf('0x34')],qs[_0x85cf('0x35')](_0x3dfb94['query'][_0x85cf('0x35')]));_0x26084e[_0x85cf('0x33')]=_0x26084e[_0x85cf('0x33')]['length']?_0x26084e[_0x85cf('0x33')]:_0x4381ac[_0x85cf('0x34')];if(_0x3dfb94['query'][_0x85cf('0x3f')]){_0x26084e[_0x85cf('0x40')]=[{'all':!![]}];}_0x26084e=_[_0x85cf('0x3d')]({},_0x26084e,_0x3dfb94['options']);return db[_0x85cf('0x2c')][_0x85cf('0x46')](_0x26084e)[_0x85cf('0x25')](handleEntityNotFound(_0x260502,null))['then'](respondWithResult(_0x260502,null))[_0x85cf('0x43')](handleError(_0x260502,null));};exports[_0x85cf('0x47')]=function(_0x3ca494,_0x367a9e){return db[_0x85cf('0x2c')][_0x85cf('0x47')](_0x3ca494[_0x85cf('0x48')],{})[_0x85cf('0x25')](respondWithResult(_0x367a9e,0xc9))[_0x85cf('0x43')](handleError(_0x367a9e,null));};exports[_0x85cf('0x49')]=function(_0x198b6d,_0x382e6b){if(_0x198b6d[_0x85cf('0x48')]['id']){delete _0x198b6d['body']['id'];}return db[_0x85cf('0x2c')]['find']({'where':{'id':_0x198b6d[_0x85cf('0x45')]['id']}})[_0x85cf('0x25')](handleEntityNotFound(_0x382e6b,null))[_0x85cf('0x25')](saveUpdates(_0x198b6d[_0x85cf('0x48')],null))[_0x85cf('0x25')](respondWithResult(_0x382e6b,null))[_0x85cf('0x43')](handleError(_0x382e6b,null));};exports[_0x85cf('0x4a')]=function(_0x380863,_0x1b1f43){return db[_0x85cf('0x2c')][_0x85cf('0x46')]({'where':{'id':_0x380863[_0x85cf('0x45')]['id']}})[_0x85cf('0x25')](handleEntityNotFound(_0x1b1f43,null))['then'](removeEntity(_0x1b1f43,null))[_0x85cf('0x43')](handleError(_0x1b1f43,null));};
\ No newline at end of file
+var _0x7c75=['model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','rows','show','keys','rawAttributes','length','includeAll','find','create','body','catch','params','destroy','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','then','error','stack','name','index','map','MailServerOut','fieldName','key'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c75,0x69));var _0x57c7=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x7c75[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0x57c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x57c7('0x1'));var rp=require('request-promise');var moment=require(_0x57c7('0x2'));var BPromise=require(_0x57c7('0x3'));var Mustache=require(_0x57c7('0x4'));var util=require('util');var path=require(_0x57c7('0x5'));var sox=require(_0x57c7('0x6'));var csv=require(_0x57c7('0x7'));var ejs=require(_0x57c7('0x8'));var fs=require('fs');var fs_extra=require(_0x57c7('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57c7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x57c7('0x7'));var querystring=require(_0x57c7('0xb'));var Papa=require(_0x57c7('0xc'));var Redis=require(_0x57c7('0xd'));var authService=require(_0x57c7('0xe'));var qs=require(_0x57c7('0xf'));var as=require(_0x57c7('0x10'));var hardwareService=require(_0x57c7('0x11'));var logger=require(_0x57c7('0x12'))(_0x57c7('0x13'));var utils=require(_0x57c7('0x14'));var config=require(_0x57c7('0x15'));var licenseUtil=require(_0x57c7('0x16'));var db=require(_0x57c7('0x17'))['db'];function respondWithStatusCode(_0x5f2d81,_0x16a92c){_0x16a92c=_0x16a92c||0xcc;return function(_0x37f563){if(_0x37f563){return _0x5f2d81[_0x57c7('0x18')](_0x16a92c);}return _0x5f2d81['status'](_0x16a92c)[_0x57c7('0x19')]();};}function respondWithResult(_0x372f35,_0x52adc0){_0x52adc0=_0x52adc0||0xc8;return function(_0x30c3c5){if(_0x30c3c5){return _0x372f35['status'](_0x52adc0)[_0x57c7('0x1a')](_0x30c3c5);}};}function respondWithFilteredResult(_0x84518,_0x1d75b8){return function(_0x10945d){if(_0x10945d){var _0x37a98c=typeof _0x1d75b8[_0x57c7('0x1b')]==='undefined'&&typeof _0x1d75b8[_0x57c7('0x1c')]===_0x57c7('0x1d');var _0x1adaef=_0x10945d[_0x57c7('0x1e')];var _0x12bf2d=_0x37a98c?0x0:_0x1d75b8[_0x57c7('0x1b')];var _0x1322c0=_0x37a98c?_0x10945d['count']:_0x1d75b8['offset']+_0x1d75b8[_0x57c7('0x1c')];var _0x5a3ff1;if(_0x1322c0>=_0x1adaef){_0x1322c0=_0x1adaef;_0x5a3ff1=0xc8;}else{_0x5a3ff1=0xce;}_0x84518[_0x57c7('0x1f')](_0x5a3ff1);return _0x84518[_0x57c7('0x20')](_0x57c7('0x21'),_0x12bf2d+'-'+_0x1322c0+'/'+_0x1adaef)[_0x57c7('0x1a')](_0x10945d);}return null;};}function patchUpdates(_0x1964bf){return function(_0x26d34d){try{jsonpatch[_0x57c7('0x22')](_0x26d34d,_0x1964bf,!![]);}catch(_0x3f1264){return BPromise[_0x57c7('0x23')](_0x3f1264);}return _0x26d34d['save']();};}function saveUpdates(_0x391567,_0x11fe7a){return function(_0xbb811b){if(_0xbb811b){return _0xbb811b['update'](_0x391567)[_0x57c7('0x24')](function(_0x5e0f1f){return _0x5e0f1f;});}return null;};}function removeEntity(_0x7244e6,_0x4f1147){return function(_0x211b09){if(_0x211b09){return _0x211b09['destroy']()[_0x57c7('0x24')](function(){_0x7244e6['status'](0xcc)[_0x57c7('0x19')]();});}};}function handleEntityNotFound(_0x2d3659,_0x451162){return function(_0x5d241c){if(!_0x5d241c){_0x2d3659[_0x57c7('0x18')](0x194);}return _0x5d241c;};}function handleError(_0x2f12ed,_0x38edf9){_0x38edf9=_0x38edf9||0x1f4;return function(_0x4d8174){logger[_0x57c7('0x25')](_0x4d8174[_0x57c7('0x26')]);if(_0x4d8174['name']){delete _0x4d8174[_0x57c7('0x27')];}_0x2f12ed[_0x57c7('0x1f')](_0x38edf9)['send'](_0x4d8174);};}exports[_0x57c7('0x28')]=function(_0x12e250,_0x2c72dd){var _0x7986b7={},_0x32da85={},_0x3cf6e1={'count':0x0,'rows':[]};var _0x51c560=_[_0x57c7('0x29')](db[_0x57c7('0x2a')]['rawAttributes'],function(_0x58617a){return{'name':_0x58617a[_0x57c7('0x2b')],'type':_0x58617a['type'][_0x57c7('0x2c')]};});_0x32da85[_0x57c7('0x2d')]=_['map'](_0x51c560,'name');_0x32da85[_0x57c7('0x2e')]=_['keys'](_0x12e250[_0x57c7('0x2e')]);_0x32da85['filters']=_[_0x57c7('0x2f')](_0x32da85[_0x57c7('0x2d')],_0x32da85['query']);_0x7986b7[_0x57c7('0x30')]=_[_0x57c7('0x2f')](_0x32da85[_0x57c7('0x2d')],qs[_0x57c7('0x31')](_0x12e250[_0x57c7('0x2e')][_0x57c7('0x31')]));_0x7986b7[_0x57c7('0x30')]=_0x7986b7[_0x57c7('0x30')]['length']?_0x7986b7[_0x57c7('0x30')]:_0x32da85['model'];if(!_0x12e250[_0x57c7('0x2e')][_0x57c7('0x32')](_0x57c7('0x33'))){_0x7986b7[_0x57c7('0x1c')]=qs['limit'](_0x12e250['query'][_0x57c7('0x1c')]);_0x7986b7['offset']=qs[_0x57c7('0x1b')](_0x12e250[_0x57c7('0x2e')][_0x57c7('0x1b')]);}_0x7986b7[_0x57c7('0x34')]=qs['sort'](_0x12e250['query'][_0x57c7('0x35')]);_0x7986b7[_0x57c7('0x36')]=qs[_0x57c7('0x37')](_[_0x57c7('0x38')](_0x12e250[_0x57c7('0x2e')],_0x32da85[_0x57c7('0x37')]),_0x51c560);if(_0x12e250[_0x57c7('0x2e')][_0x57c7('0x39')]){_0x7986b7[_0x57c7('0x36')]=_['merge'](_0x7986b7[_0x57c7('0x36')],{'$or':_[_0x57c7('0x29')](_0x51c560,function(_0x40d63f){if(_0x40d63f[_0x57c7('0x3a')]!==_0x57c7('0x3b')){var _0x35d5ee={};_0x35d5ee[_0x40d63f[_0x57c7('0x27')]]={'$like':'%'+_0x12e250[_0x57c7('0x2e')][_0x57c7('0x39')]+'%'};return _0x35d5ee;}})});}_0x7986b7=_[_0x57c7('0x3c')]({},_0x7986b7,_0x12e250[_0x57c7('0x3d')]);var _0x2a0c1d={'where':_0x7986b7[_0x57c7('0x36')]};return db['MailServerOut'][_0x57c7('0x1e')](_0x2a0c1d)[_0x57c7('0x24')](function(_0x459771){_0x3cf6e1['count']=_0x459771;if(_0x12e250[_0x57c7('0x2e')]['includeAll']){_0x7986b7[_0x57c7('0x3e')]=[{'all':!![]}];}return db[_0x57c7('0x2a')]['findAll'](_0x7986b7);})[_0x57c7('0x24')](function(_0x12f7ca){_0x3cf6e1[_0x57c7('0x3f')]=_0x12f7ca;return _0x3cf6e1;})[_0x57c7('0x24')](respondWithFilteredResult(_0x2c72dd,_0x7986b7))['catch'](handleError(_0x2c72dd,null));};exports[_0x57c7('0x40')]=function(_0x295d17,_0x5b2374){var _0x44550f={'raw':!![],'where':{'id':_0x295d17['params']['id']}},_0x456ff7={};_0x456ff7['model']=_[_0x57c7('0x41')](db[_0x57c7('0x2a')][_0x57c7('0x42')]);_0x456ff7[_0x57c7('0x2e')]=_[_0x57c7('0x41')](_0x295d17[_0x57c7('0x2e')]);_0x456ff7[_0x57c7('0x37')]=_[_0x57c7('0x2f')](_0x456ff7[_0x57c7('0x2d')],_0x456ff7[_0x57c7('0x2e')]);_0x44550f['attributes']=_[_0x57c7('0x2f')](_0x456ff7[_0x57c7('0x2d')],qs[_0x57c7('0x31')](_0x295d17['query'][_0x57c7('0x31')]));_0x44550f[_0x57c7('0x30')]=_0x44550f[_0x57c7('0x30')][_0x57c7('0x43')]?_0x44550f[_0x57c7('0x30')]:_0x456ff7[_0x57c7('0x2d')];if(_0x295d17['query'][_0x57c7('0x44')]){_0x44550f[_0x57c7('0x3e')]=[{'all':!![]}];}_0x44550f=_[_0x57c7('0x3c')]({},_0x44550f,_0x295d17[_0x57c7('0x3d')]);return db[_0x57c7('0x2a')][_0x57c7('0x45')](_0x44550f)[_0x57c7('0x24')](handleEntityNotFound(_0x5b2374,null))[_0x57c7('0x24')](respondWithResult(_0x5b2374,null))['catch'](handleError(_0x5b2374,null));};exports[_0x57c7('0x46')]=function(_0x1467ea,_0x451b64){return db[_0x57c7('0x2a')][_0x57c7('0x46')](_0x1467ea[_0x57c7('0x47')],{})[_0x57c7('0x24')](respondWithResult(_0x451b64,0xc9))[_0x57c7('0x48')](handleError(_0x451b64,null));};exports['update']=function(_0x1be097,_0x10315d){if(_0x1be097['body']['id']){delete _0x1be097[_0x57c7('0x47')]['id'];}return db[_0x57c7('0x2a')][_0x57c7('0x45')]({'where':{'id':_0x1be097[_0x57c7('0x49')]['id']}})['then'](handleEntityNotFound(_0x10315d,null))[_0x57c7('0x24')](saveUpdates(_0x1be097[_0x57c7('0x47')],null))['then'](respondWithResult(_0x10315d,null))['catch'](handleError(_0x10315d,null));};exports[_0x57c7('0x4a')]=function(_0xc39909,_0x5c6a15){return db['MailServerOut'][_0x57c7('0x45')]({'where':{'id':_0xc39909['params']['id']}})['then'](handleEntityNotFound(_0x5c6a15,null))[_0x57c7('0x24')](removeEntity(_0x5c6a15,null))['catch'](handleError(_0x5c6a15,null));};
\ No newline at end of file
index dad5212..bdf5387 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4f1=['./mailServerOut.attributes','define','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x290acc,_0x390e04){var _0x1f82a5=function(_0x5d4837){while(--_0x5d4837){_0x290acc['push'](_0x290acc['shift']());}};_0x1f82a5(++_0x390e04);}(_0xa4f1,0x1a6));var _0x1a4f=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa4f1[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x1a4f('0x0'));var util=require(_0x1a4f('0x1'));var logger=require(_0x1a4f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a4f('0x3'));var rp=require(_0x1a4f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1a4f('0x5'));module['exports']=function(_0x16f381,_0x408127){return _0x16f381[_0x1a4f('0x6')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x061d=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x34fedc,_0x30255f){var _0xbd34b=function(_0x25b598){while(--_0x25b598){_0x34fedc['push'](_0x34fedc['shift']());}};_0xbd34b(++_0x30255f);}(_0x061d,0x64));var _0xd061=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x061d[_0x37c22c];return _0x119d79;};'use strict';var _=require('lodash');var util=require(_0xd061('0x0'));var logger=require(_0xd061('0x1'))(_0xd061('0x2'));var moment=require(_0xd061('0x3'));var BPromise=require(_0xd061('0x4'));var rp=require(_0xd061('0x5'));var fs=require('fs');var path=require(_0xd061('0x6'));var rimraf=require(_0xd061('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xd061('0x8')]=function(_0x217bbb,_0x118ec0){return _0x217bbb[_0xd061('0x9')]('MailServerOut',attributes,{'tableName':_0xd061('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d6ae531..9226a5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2ace71,_0xac8058){var _0x815c1b=function(_0x474b48){while(--_0x474b48){_0x2ace71['push'](_0x2ace71['shift']());}};_0x815c1b(++_0xac8058);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44e984,_0x45e8ff){_0x44e984=_0x44e984-0x0;var _0x450b68=_0x5f2f[_0x44e984];return _0x450b68;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}
\ No newline at end of file
+var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x38a977,_0x5ddc61){var _0x138533=function(_0x3bc1f4){while(--_0x3bc1f4){_0x38a977['push'](_0x38a977['shift']());}};_0x138533(++_0x5ddc61);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}
\ No newline at end of file
index 3110dfb..d750d80 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b38=['isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./mailSubstatus.controller','get'];(function(_0x2cfd98,_0x464ec5){var _0x1856a0=function(_0x1350ea){while(--_0x1350ea){_0x2cfd98['push'](_0x2cfd98['shift']());}};_0x1856a0(++_0x464ec5);}(_0x6b38,0x110));var _0x86b3=function(_0x23c4b0,_0x2209f1){_0x23c4b0=_0x23c4b0-0x0;var _0x56692c=_0x6b38[_0x23c4b0];return _0x56692c;};'use strict';var multer=require('multer');var util=require(_0x86b3('0x0'));var path=require(_0x86b3('0x1'));var timeout=require(_0x86b3('0x2'));var express=require(_0x86b3('0x3'));var router=express[_0x86b3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86b3('0x5'));var controller=require(_0x86b3('0x6'));router[_0x86b3('0x7')]('/',auth[_0x86b3('0x8')](),controller[_0x86b3('0x9')]);router[_0x86b3('0x7')](_0x86b3('0xa'),auth[_0x86b3('0x8')](),controller[_0x86b3('0xb')]);router[_0x86b3('0x7')](_0x86b3('0xc'),auth[_0x86b3('0x8')](),controller[_0x86b3('0xd')]);router[_0x86b3('0xe')]('/',auth[_0x86b3('0x8')](),controller['create']);router[_0x86b3('0xf')](_0x86b3('0xc'),auth[_0x86b3('0x8')](),controller[_0x86b3('0x10')]);router[_0x86b3('0x11')](_0x86b3('0xc'),auth['isAuthenticated'](),controller[_0x86b3('0x12')]);module[_0x86b3('0x13')]=router;
\ No newline at end of file
+var _0x255a=['./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ef7fc,_0x397554){var _0x47df5e=function(_0xa593ee){while(--_0xa593ee){_0x3ef7fc['push'](_0x3ef7fc['shift']());}};_0x47df5e(++_0x397554);}(_0x255a,0xdd));var _0xa255=function(_0x4fac9e,_0x44ed3){_0x4fac9e=_0x4fac9e-0x0;var _0x3177a5=_0x255a[_0x4fac9e];return _0x3177a5;};'use strict';var multer=require(_0xa255('0x0'));var util=require('util');var path=require(_0xa255('0x1'));var timeout=require(_0xa255('0x2'));var express=require(_0xa255('0x3'));var router=express[_0xa255('0x4')]();var fs_extra=require(_0xa255('0x5'));var auth=require(_0xa255('0x6'));var interaction=require(_0xa255('0x7'));var config=require(_0xa255('0x8'));var controller=require(_0xa255('0x9'));router[_0xa255('0xa')]('/',auth[_0xa255('0xb')](),controller[_0xa255('0xc')]);router[_0xa255('0xa')](_0xa255('0xd'),auth[_0xa255('0xb')](),controller[_0xa255('0xe')]);router[_0xa255('0xa')](_0xa255('0xf'),auth[_0xa255('0xb')](),controller[_0xa255('0x10')]);router[_0xa255('0x11')]('/',auth[_0xa255('0xb')](),controller['create']);router[_0xa255('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa255('0x13')]);router[_0xa255('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xa255('0x15')]);module[_0xa255('0x16')]=router;
\ No newline at end of file
index 0d51389..3b04eac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4317=['name','exports','STRING'];(function(_0x24f6d2,_0x15b459){var _0x21bb73=function(_0x132a9f){while(--_0x132a9f){_0x24f6d2['push'](_0x24f6d2['shift']());}};_0x21bb73(++_0x15b459);}(_0x4317,0x7c));var _0x7431=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4317[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x7431('0x0')]={'name':{'type':Sequelize[_0x7431('0x1')],'unique':_0x7431('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xeff8=['name','STRING','sequelize','exports'];(function(_0x4c95a7,_0x58159c){var _0x841ebd=function(_0x45551b){while(--_0x45551b){_0x4c95a7['push'](_0x4c95a7['shift']());}};_0x841ebd(++_0x58159c);}(_0xeff8,0x186));var _0x8eff=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xeff8[_0x33bc64];return _0x3fdd34;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8eff('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eff('0x3')]}};
\ No newline at end of file
index 07999bf..14e4573 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a3d=['merge','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','send','rawAttributes','type','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','VIRTUAL'];(function(_0x4557c4,_0xa52527){var _0x11c14a=function(_0x120a7c){while(--_0x120a7c){_0x4557c4['push'](_0x4557c4['shift']());}};_0x11c14a(++_0xa52527);}(_0x4a3d,0x12e));var _0xd4a3=function(_0x16a545,_0x389d6e){_0x16a545=_0x16a545-0x0;var _0x1c8ece=_0x4a3d[_0x16a545];return _0x1c8ece;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd4a3('0x0'));var rp=require(_0xd4a3('0x1'));var moment=require(_0xd4a3('0x2'));var BPromise=require(_0xd4a3('0x3'));var Mustache=require(_0xd4a3('0x4'));var util=require(_0xd4a3('0x5'));var path=require('path');var sox=require(_0xd4a3('0x6'));var csv=require(_0xd4a3('0x7'));var ejs=require(_0xd4a3('0x8'));var fs=require('fs');var fs_extra=require(_0xd4a3('0x9'));var _=require(_0xd4a3('0xa'));var squel=require(_0xd4a3('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4a3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd4a3('0x7'));var querystring=require(_0xd4a3('0xd'));var Papa=require(_0xd4a3('0xe'));var Redis=require(_0xd4a3('0xf'));var authService=require(_0xd4a3('0x10'));var qs=require(_0xd4a3('0x11'));var as=require(_0xd4a3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x13'))(_0xd4a3('0x14'));var utils=require('../../config/utils');var config=require(_0xd4a3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4a3('0x16'))['db'];function respondWithStatusCode(_0x5a7cfd,_0x33384a){_0x33384a=_0x33384a||0xcc;return function(_0x42b3b1){if(_0x42b3b1){return _0x5a7cfd[_0xd4a3('0x17')](_0x33384a);}return _0x5a7cfd[_0xd4a3('0x18')](_0x33384a)[_0xd4a3('0x19')]();};}function respondWithResult(_0xfedf7d,_0x366485){_0x366485=_0x366485||0xc8;return function(_0x3ffe85){if(_0x3ffe85){return _0xfedf7d[_0xd4a3('0x18')](_0x366485)[_0xd4a3('0x1a')](_0x3ffe85);}};}function respondWithFilteredResult(_0x51c691,_0x21eae5){return function(_0x33d18b){if(_0x33d18b){var _0x49b233=typeof _0x21eae5[_0xd4a3('0x1b')]===_0xd4a3('0x1c')&&typeof _0x21eae5[_0xd4a3('0x1d')]===_0xd4a3('0x1c');var _0x3b5f26=_0x33d18b['count'];var _0x502116=_0x49b233?0x0:_0x21eae5[_0xd4a3('0x1b')];var _0x51b462=_0x49b233?_0x33d18b[_0xd4a3('0x1e')]:_0x21eae5[_0xd4a3('0x1b')]+_0x21eae5[_0xd4a3('0x1d')];var _0x28b851;if(_0x51b462>=_0x3b5f26){_0x51b462=_0x3b5f26;_0x28b851=0xc8;}else{_0x28b851=0xce;}_0x51c691[_0xd4a3('0x18')](_0x28b851);return _0x51c691['set'](_0xd4a3('0x1f'),_0x502116+'-'+_0x51b462+'/'+_0x3b5f26)[_0xd4a3('0x1a')](_0x33d18b);}return null;};}function patchUpdates(_0x3c8fc8){return function(_0x300417){try{jsonpatch[_0xd4a3('0x20')](_0x300417,_0x3c8fc8,!![]);}catch(_0x10ed64){return BPromise[_0xd4a3('0x21')](_0x10ed64);}return _0x300417['save']();};}function saveUpdates(_0x310a55,_0x13f817){return function(_0x2deb12){if(_0x2deb12){return _0x2deb12[_0xd4a3('0x22')](_0x310a55)[_0xd4a3('0x23')](function(_0x3fb257){return _0x3fb257;});}return null;};}function removeEntity(_0x4de544,_0x2ce07f){return function(_0x12a439){if(_0x12a439){return _0x12a439[_0xd4a3('0x24')]()['then'](function(){_0x4de544['status'](0xcc)[_0xd4a3('0x19')]();});}};}function handleEntityNotFound(_0x5a8f23,_0x97b526){return function(_0x27c7ee){if(!_0x27c7ee){_0x5a8f23[_0xd4a3('0x17')](0x194);}return _0x27c7ee;};}function handleError(_0x56ca4a,_0x4e88e4){_0x4e88e4=_0x4e88e4||0x1f4;return function(_0x23256e){logger[_0xd4a3('0x25')](_0x23256e['stack']);if(_0x23256e['name']){delete _0x23256e[_0xd4a3('0x26')];}_0x56ca4a[_0xd4a3('0x18')](_0x4e88e4)[_0xd4a3('0x27')](_0x23256e);};}exports['index']=function(_0x42d7ec,_0x227573){var _0x2baaa1={},_0x4cf4cc={},_0x2c69cf={'count':0x0,'rows':[]};var _0x51fe66=_['map'](db['MailSubstatus'][_0xd4a3('0x28')],function(_0x1bc33c){return{'name':_0x1bc33c['fieldName'],'type':_0x1bc33c[_0xd4a3('0x29')]['key']};});_0x4cf4cc['model']=_['map'](_0x51fe66,_0xd4a3('0x26'));_0x4cf4cc[_0xd4a3('0x2a')]=_[_0xd4a3('0x2b')](_0x42d7ec['query']);_0x4cf4cc['filters']=_['intersection'](_0x4cf4cc[_0xd4a3('0x2c')],_0x4cf4cc[_0xd4a3('0x2a')]);_0x2baaa1['attributes']=_[_0xd4a3('0x2d')](_0x4cf4cc[_0xd4a3('0x2c')],qs[_0xd4a3('0x2e')](_0x42d7ec[_0xd4a3('0x2a')][_0xd4a3('0x2e')]));_0x2baaa1[_0xd4a3('0x2f')]=_0x2baaa1[_0xd4a3('0x2f')][_0xd4a3('0x30')]?_0x2baaa1['attributes']:_0x4cf4cc[_0xd4a3('0x2c')];if(!_0x42d7ec[_0xd4a3('0x2a')][_0xd4a3('0x31')](_0xd4a3('0x32'))){_0x2baaa1['limit']=qs[_0xd4a3('0x1d')](_0x42d7ec[_0xd4a3('0x2a')][_0xd4a3('0x1d')]);_0x2baaa1[_0xd4a3('0x1b')]=qs[_0xd4a3('0x1b')](_0x42d7ec[_0xd4a3('0x2a')]['offset']);}_0x2baaa1['order']=qs[_0xd4a3('0x33')](_0x42d7ec['query'][_0xd4a3('0x33')]);_0x2baaa1[_0xd4a3('0x34')]=qs[_0xd4a3('0x35')](_[_0xd4a3('0x36')](_0x42d7ec[_0xd4a3('0x2a')],_0x4cf4cc[_0xd4a3('0x35')]),_0x51fe66);if(_0x42d7ec['query'][_0xd4a3('0x37')]){_0x2baaa1[_0xd4a3('0x34')]=_['merge'](_0x2baaa1[_0xd4a3('0x34')],{'$or':_[_0xd4a3('0x38')](_0x51fe66,function(_0x290245){if(_0x290245['type']!==_0xd4a3('0x39')){var _0x39063a={};_0x39063a[_0x290245['name']]={'$like':'%'+_0x42d7ec[_0xd4a3('0x2a')][_0xd4a3('0x37')]+'%'};return _0x39063a;}})});}_0x2baaa1=_[_0xd4a3('0x3a')]({},_0x2baaa1,_0x42d7ec[_0xd4a3('0x3b')]);var _0x34e54f={'where':_0x2baaa1['where']};return db[_0xd4a3('0x3c')][_0xd4a3('0x1e')](_0x34e54f)['then'](function(_0x299973){_0x2c69cf['count']=_0x299973;if(_0x42d7ec[_0xd4a3('0x2a')][_0xd4a3('0x3d')]){_0x2baaa1[_0xd4a3('0x3e')]=[{'all':!![]}];}return db[_0xd4a3('0x3c')][_0xd4a3('0x3f')](_0x2baaa1);})[_0xd4a3('0x23')](function(_0x2539d3){_0x2c69cf[_0xd4a3('0x40')]=_0x2539d3;return _0x2c69cf;})['then'](respondWithFilteredResult(_0x227573,_0x2baaa1))[_0xd4a3('0x41')](handleError(_0x227573,null));};exports[_0xd4a3('0x42')]=function(_0x5a9e95,_0x18b683){var _0x38fded={'raw':!![],'where':{'id':_0x5a9e95[_0xd4a3('0x43')]['id']}},_0x5ba031={};_0x5ba031[_0xd4a3('0x2c')]=_[_0xd4a3('0x2b')](db[_0xd4a3('0x3c')][_0xd4a3('0x28')]);_0x5ba031[_0xd4a3('0x2a')]=_[_0xd4a3('0x2b')](_0x5a9e95['query']);_0x5ba031[_0xd4a3('0x35')]=_[_0xd4a3('0x2d')](_0x5ba031[_0xd4a3('0x2c')],_0x5ba031[_0xd4a3('0x2a')]);_0x38fded[_0xd4a3('0x2f')]=_[_0xd4a3('0x2d')](_0x5ba031[_0xd4a3('0x2c')],qs[_0xd4a3('0x2e')](_0x5a9e95[_0xd4a3('0x2a')][_0xd4a3('0x2e')]));_0x38fded[_0xd4a3('0x2f')]=_0x38fded[_0xd4a3('0x2f')]['length']?_0x38fded['attributes']:_0x5ba031['model'];if(_0x5a9e95[_0xd4a3('0x2a')][_0xd4a3('0x3d')]){_0x38fded[_0xd4a3('0x3e')]=[{'all':!![]}];}_0x38fded=_['merge']({},_0x38fded,_0x5a9e95[_0xd4a3('0x3b')]);return db[_0xd4a3('0x3c')][_0xd4a3('0x44')](_0x38fded)[_0xd4a3('0x23')](handleEntityNotFound(_0x18b683,null))['then'](respondWithResult(_0x18b683,null))[_0xd4a3('0x41')](handleError(_0x18b683,null));};exports[_0xd4a3('0x45')]=function(_0x213a85,_0x52135d){return db[_0xd4a3('0x3c')][_0xd4a3('0x45')](_0x213a85[_0xd4a3('0x46')],{})[_0xd4a3('0x23')](respondWithResult(_0x52135d,0xc9))[_0xd4a3('0x41')](handleError(_0x52135d,null));};exports['update']=function(_0x86ccef,_0x5d450d){if(_0x86ccef[_0xd4a3('0x46')]['id']){delete _0x86ccef['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x86ccef[_0xd4a3('0x43')]['id']}})[_0xd4a3('0x23')](handleEntityNotFound(_0x5d450d,null))[_0xd4a3('0x23')](saveUpdates(_0x86ccef[_0xd4a3('0x46')],null))[_0xd4a3('0x23')](respondWithResult(_0x5d450d,null))['catch'](handleError(_0x5d450d,null));};exports[_0xd4a3('0x24')]=function(_0x5dc8ac,_0xccceaa){return db[_0xd4a3('0x3c')]['find']({'where':{'id':_0x5dc8ac[_0xd4a3('0x43')]['id']}})['then'](handleEntityNotFound(_0xccceaa,null))[_0xd4a3('0x23')](removeEntity(_0xccceaa,null))['catch'](handleError(_0xccceaa,null));};exports['describe']=function(_0x15efa2,_0x26f1ac){return db['MailSubstatus'][_0xd4a3('0x47')]()[_0xd4a3('0x23')](respondWithResult(_0x26f1ac,null))[_0xd4a3('0x41')](handleError(_0x26f1ac,null));};
\ No newline at end of file
+var _0x1023=['error','stack','name','send','index','MailSubstatus','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','update','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','then','destroy'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x1023,0xc1));var _0x3102=function(_0x6852cf,_0x26e3eb){_0x6852cf=_0x6852cf-0x0;var _0x7fa6cb=_0x1023[_0x6852cf];return _0x7fa6cb;};'use strict';var emlformat=require(_0x3102('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3102('0x1'));var moment=require(_0x3102('0x2'));var BPromise=require(_0x3102('0x3'));var Mustache=require(_0x3102('0x4'));var util=require(_0x3102('0x5'));var path=require(_0x3102('0x6'));var sox=require(_0x3102('0x7'));var csv=require(_0x3102('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3102('0x9'));var _=require(_0x3102('0xa'));var squel=require('squel');var crypto=require(_0x3102('0xb'));var jsforce=require(_0x3102('0xc'));var deskjs=require(_0x3102('0xd'));var toCsv=require(_0x3102('0x8'));var querystring=require(_0x3102('0xe'));var Papa=require(_0x3102('0xf'));var Redis=require(_0x3102('0x10'));var authService=require(_0x3102('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3102('0x12'));var hardwareService=require(_0x3102('0x13'));var logger=require(_0x3102('0x14'))(_0x3102('0x15'));var utils=require('../../config/utils');var config=require(_0x3102('0x16'));var licenseUtil=require(_0x3102('0x17'));var db=require(_0x3102('0x18'))['db'];function respondWithStatusCode(_0x3c37c7,_0x2ef5b4){_0x2ef5b4=_0x2ef5b4||0xcc;return function(_0x5f00f9){if(_0x5f00f9){return _0x3c37c7[_0x3102('0x19')](_0x2ef5b4);}return _0x3c37c7[_0x3102('0x1a')](_0x2ef5b4)[_0x3102('0x1b')]();};}function respondWithResult(_0x184bdc,_0x2f61f8){_0x2f61f8=_0x2f61f8||0xc8;return function(_0x1b95db){if(_0x1b95db){return _0x184bdc[_0x3102('0x1a')](_0x2f61f8)['json'](_0x1b95db);}};}function respondWithFilteredResult(_0x2619fc,_0x36d955){return function(_0x22069f){if(_0x22069f){var _0xb21269=typeof _0x36d955[_0x3102('0x1c')]==='undefined'&&typeof _0x36d955[_0x3102('0x1d')]==='undefined';var _0x425316=_0x22069f[_0x3102('0x1e')];var _0x547f1b=_0xb21269?0x0:_0x36d955['offset'];var _0x25918a=_0xb21269?_0x22069f[_0x3102('0x1e')]:_0x36d955[_0x3102('0x1c')]+_0x36d955['limit'];var _0x326eca;if(_0x25918a>=_0x425316){_0x25918a=_0x425316;_0x326eca=0xc8;}else{_0x326eca=0xce;}_0x2619fc[_0x3102('0x1a')](_0x326eca);return _0x2619fc[_0x3102('0x1f')]('Content-Range',_0x547f1b+'-'+_0x25918a+'/'+_0x425316)[_0x3102('0x20')](_0x22069f);}return null;};}function patchUpdates(_0x27f57e){return function(_0x503e03){try{jsonpatch[_0x3102('0x21')](_0x503e03,_0x27f57e,!![]);}catch(_0x40933b){return BPromise[_0x3102('0x22')](_0x40933b);}return _0x503e03[_0x3102('0x23')]();};}function saveUpdates(_0x3d7e24,_0x2be245){return function(_0x285216){if(_0x285216){return _0x285216['update'](_0x3d7e24)[_0x3102('0x24')](function(_0x41c19d){return _0x41c19d;});}return null;};}function removeEntity(_0x2477f3,_0x55ca3f){return function(_0x11e5de){if(_0x11e5de){return _0x11e5de[_0x3102('0x25')]()[_0x3102('0x24')](function(){_0x2477f3[_0x3102('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2770d9,_0x195039){return function(_0x673b0d){if(!_0x673b0d){_0x2770d9['sendStatus'](0x194);}return _0x673b0d;};}function handleError(_0x178ebb,_0x36231e){_0x36231e=_0x36231e||0x1f4;return function(_0x598a5a){logger[_0x3102('0x26')](_0x598a5a[_0x3102('0x27')]);if(_0x598a5a[_0x3102('0x28')]){delete _0x598a5a['name'];}_0x178ebb[_0x3102('0x1a')](_0x36231e)[_0x3102('0x29')](_0x598a5a);};}exports[_0x3102('0x2a')]=function(_0x24226a,_0x3a7d55){var _0x1768c2={},_0x348eb3={},_0x273c07={'count':0x0,'rows':[]};var _0x4de37d=_['map'](db[_0x3102('0x2b')]['rawAttributes'],function(_0x170491){return{'name':_0x170491[_0x3102('0x2c')],'type':_0x170491[_0x3102('0x2d')][_0x3102('0x2e')]};});_0x348eb3[_0x3102('0x2f')]=_['map'](_0x4de37d,_0x3102('0x28'));_0x348eb3[_0x3102('0x30')]=_['keys'](_0x24226a[_0x3102('0x30')]);_0x348eb3[_0x3102('0x31')]=_[_0x3102('0x32')](_0x348eb3[_0x3102('0x2f')],_0x348eb3[_0x3102('0x30')]);_0x1768c2[_0x3102('0x33')]=_[_0x3102('0x32')](_0x348eb3['model'],qs[_0x3102('0x34')](_0x24226a[_0x3102('0x30')][_0x3102('0x34')]));_0x1768c2[_0x3102('0x33')]=_0x1768c2[_0x3102('0x33')][_0x3102('0x35')]?_0x1768c2[_0x3102('0x33')]:_0x348eb3[_0x3102('0x2f')];if(!_0x24226a[_0x3102('0x30')][_0x3102('0x36')](_0x3102('0x37'))){_0x1768c2[_0x3102('0x1d')]=qs[_0x3102('0x1d')](_0x24226a['query'][_0x3102('0x1d')]);_0x1768c2['offset']=qs[_0x3102('0x1c')](_0x24226a[_0x3102('0x30')][_0x3102('0x1c')]);}_0x1768c2[_0x3102('0x38')]=qs[_0x3102('0x39')](_0x24226a[_0x3102('0x30')][_0x3102('0x39')]);_0x1768c2[_0x3102('0x3a')]=qs[_0x3102('0x31')](_[_0x3102('0x3b')](_0x24226a[_0x3102('0x30')],_0x348eb3[_0x3102('0x31')]),_0x4de37d);if(_0x24226a[_0x3102('0x30')][_0x3102('0x3c')]){_0x1768c2[_0x3102('0x3a')]=_[_0x3102('0x3d')](_0x1768c2[_0x3102('0x3a')],{'$or':_['map'](_0x4de37d,function(_0x5a2586){if(_0x5a2586[_0x3102('0x2d')]!==_0x3102('0x3e')){var _0x4671d0={};_0x4671d0[_0x5a2586[_0x3102('0x28')]]={'$like':'%'+_0x24226a[_0x3102('0x30')]['filter']+'%'};return _0x4671d0;}})});}_0x1768c2=_['merge']({},_0x1768c2,_0x24226a[_0x3102('0x3f')]);var _0x55fdb4={'where':_0x1768c2['where']};return db['MailSubstatus'][_0x3102('0x1e')](_0x55fdb4)['then'](function(_0xadc45){_0x273c07[_0x3102('0x1e')]=_0xadc45;if(_0x24226a['query'][_0x3102('0x40')]){_0x1768c2['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x3102('0x41')](_0x1768c2);})[_0x3102('0x24')](function(_0x53fe0b){_0x273c07[_0x3102('0x42')]=_0x53fe0b;return _0x273c07;})[_0x3102('0x24')](respondWithFilteredResult(_0x3a7d55,_0x1768c2))[_0x3102('0x43')](handleError(_0x3a7d55,null));};exports[_0x3102('0x44')]=function(_0x23b742,_0x2a957a){var _0x28af68={'raw':!![],'where':{'id':_0x23b742[_0x3102('0x45')]['id']}},_0xa07adc={};_0xa07adc[_0x3102('0x2f')]=_['keys'](db['MailSubstatus'][_0x3102('0x46')]);_0xa07adc['query']=_[_0x3102('0x47')](_0x23b742[_0x3102('0x30')]);_0xa07adc['filters']=_[_0x3102('0x32')](_0xa07adc['model'],_0xa07adc[_0x3102('0x30')]);_0x28af68[_0x3102('0x33')]=_[_0x3102('0x32')](_0xa07adc[_0x3102('0x2f')],qs[_0x3102('0x34')](_0x23b742[_0x3102('0x30')][_0x3102('0x34')]));_0x28af68[_0x3102('0x33')]=_0x28af68['attributes'][_0x3102('0x35')]?_0x28af68['attributes']:_0xa07adc[_0x3102('0x2f')];if(_0x23b742['query'][_0x3102('0x40')]){_0x28af68['include']=[{'all':!![]}];}_0x28af68=_['merge']({},_0x28af68,_0x23b742[_0x3102('0x3f')]);return db[_0x3102('0x2b')][_0x3102('0x48')](_0x28af68)['then'](handleEntityNotFound(_0x2a957a,null))[_0x3102('0x24')](respondWithResult(_0x2a957a,null))[_0x3102('0x43')](handleError(_0x2a957a,null));};exports[_0x3102('0x49')]=function(_0x207d6e,_0x1eb6f8){return db[_0x3102('0x2b')][_0x3102('0x49')](_0x207d6e[_0x3102('0x4a')],{})['then'](respondWithResult(_0x1eb6f8,0xc9))[_0x3102('0x43')](handleError(_0x1eb6f8,null));};exports[_0x3102('0x4b')]=function(_0x117be8,_0x69494c){if(_0x117be8['body']['id']){delete _0x117be8[_0x3102('0x4a')]['id'];}return db['MailSubstatus'][_0x3102('0x48')]({'where':{'id':_0x117be8[_0x3102('0x45')]['id']}})[_0x3102('0x24')](handleEntityNotFound(_0x69494c,null))['then'](saveUpdates(_0x117be8[_0x3102('0x4a')],null))[_0x3102('0x24')](respondWithResult(_0x69494c,null))['catch'](handleError(_0x69494c,null));};exports[_0x3102('0x25')]=function(_0x268d95,_0x9aba30){return db['MailSubstatus'][_0x3102('0x48')]({'where':{'id':_0x268d95[_0x3102('0x45')]['id']}})[_0x3102('0x24')](handleEntityNotFound(_0x9aba30,null))[_0x3102('0x24')](removeEntity(_0x9aba30,null))[_0x3102('0x43')](handleError(_0x9aba30,null));};exports[_0x3102('0x4c')]=function(_0x1d1dc9,_0x376600){return db[_0x3102('0x2b')][_0x3102('0x4c')]()[_0x3102('0x24')](respondWithResult(_0x376600,null))['catch'](handleError(_0x376600,null));};
\ No newline at end of file
index a740275..ab7cd3b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1087=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0x1087,0x1ce));var _0x7108=function(_0x32f199,_0x5da034){_0x32f199=_0x32f199-0x0;var _0x40a717=_0x1087[_0x32f199];return _0x40a717;};'use strict';var EventEmitter=require(_0x7108('0x0'));var MailSubstatus=require(_0x7108('0x1'))['db'][_0x7108('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7108('0x3')](0x0);var events={'afterUpdate':_0x7108('0x4')};function emitEvent(_0x8f9252){return function(_0x5ca570,_0x2e0346,_0x3e2957){MailSubstatusEvents['emit'](_0x8f9252+':'+_0x5ca570['id'],_0x5ca570);MailSubstatusEvents[_0x7108('0x5')](_0x8f9252,_0x5ca570);_0x3e2957(null);};}for(var e in events){if(events[_0x7108('0x6')](e)){var event=events[e];MailSubstatus[_0x7108('0x7')](e,emitEvent(event));}}module[_0x7108('0x8')]=MailSubstatusEvents;
\ No newline at end of file
+var _0x8633=['setMaxListeners','update','emit','hook','events','../../mysqldb','MailSubstatus'];(function(_0x56c394,_0x5e9757){var _0x1eeb36=function(_0x302142){while(--_0x302142){_0x56c394['push'](_0x56c394['shift']());}};_0x1eeb36(++_0x5e9757);}(_0x8633,0x66));var _0x3863=function(_0x391cb2,_0x13d9f7){_0x391cb2=_0x391cb2-0x0;var _0xf9bd33=_0x8633[_0x391cb2];return _0xf9bd33;};'use strict';var EventEmitter=require(_0x3863('0x0'));var MailSubstatus=require(_0x3863('0x1'))['db'][_0x3863('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3863('0x3')](0x0);var events={'afterUpdate':_0x3863('0x4')};function emitEvent(_0x1aae83){return function(_0x38faf4,_0x915456,_0x12f854){MailSubstatusEvents['emit'](_0x1aae83+':'+_0x38faf4['id'],_0x38faf4);MailSubstatusEvents[_0x3863('0x5')](_0x1aae83,_0x38faf4);_0x12f854(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x3863('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents;
\ No newline at end of file
index ae0a1d2..f1398a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a53=['Condition','name','mailSubstatus','_previousDataValues','./mailSubstatus.attributes','exports','models','define','mail_substatuses'];(function(_0x2a196c,_0x6fc415){var _0x1abdb5=function(_0x1cb722){while(--_0x1cb722){_0x2a196c['push'](_0x2a196c['shift']());}};_0x1abdb5(++_0x6fc415);}(_0x7a53,0x79));var _0x37a5=function(_0x3c7a3e,_0x8b9be5){_0x3c7a3e=_0x3c7a3e-0x0;var _0x46b063=_0x7a53[_0x3c7a3e];return _0x46b063;};'use strict';var attributes=require(_0x37a5('0x0'));module[_0x37a5('0x1')]=function(_0x3ca12e){var _0x1dd242=_0x3ca12e[_0x37a5('0x2')];return _0x3ca12e[_0x37a5('0x3')]('MailSubstatus',attributes,{'tableName':_0x37a5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xcf8d89,_0x2424eb,_0x1e3d99){return _0x1dd242[_0x37a5('0x5')]['update']({'value':_0xcf8d89[_0x37a5('0x6')]},{'where':{'field':_0x37a5('0x7'),'value':_0xcf8d89[_0x37a5('0x8')]['name']}})['then'](function(){_0x1e3d99();})['catch'](function(_0x41ec3c){_0x1e3d99(_0x41ec3c);});}}});};
\ No newline at end of file
+var _0xba4d=['_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','update','name','mailSubstatus'];(function(_0x469055,_0xda421f){var _0x413d57=function(_0x583ffc){while(--_0x583ffc){_0x469055['push'](_0x469055['shift']());}};_0x413d57(++_0xda421f);}(_0xba4d,0xab));var _0xdba4=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0xba4d[_0x47d6dc];return _0x1a1c93;};'use strict';var attributes=require(_0xdba4('0x0'));module[_0xdba4('0x1')]=function(_0x28d84f){var _0x258243=_0x28d84f[_0xdba4('0x2')];return _0x28d84f[_0xdba4('0x3')]('MailSubstatus',attributes,{'tableName':_0xdba4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x308f68,_0x118578,_0x17c2a4){return _0x258243[_0xdba4('0x5')][_0xdba4('0x6')]({'value':_0x308f68[_0xdba4('0x7')]},{'where':{'field':_0xdba4('0x8'),'value':_0x308f68[_0xdba4('0x9')][_0xdba4('0x7')]}})[_0xdba4('0xa')](function(){_0x17c2a4();})[_0xdba4('0xb')](function(_0x25d9a5){_0x17c2a4(_0x25d9a5);});}}});};
\ No newline at end of file
index 816d35d..80128f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcc3c=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x4723de,_0x4b339c){var _0x27ff91=function(_0x84bbc8){while(--_0x84bbc8){_0x4723de['push'](_0x4723de['shift']());}};_0x27ff91(++_0x4b339c);}(_0xcc3c,0x92));var _0xccc3=function(_0x2b3396,_0x109c27){_0x2b3396=_0x2b3396-0x0;var _0x2d9812=_0xcc3c[_0x2b3396];return _0x2d9812;};'use strict';var _=require(_0xccc3('0x0'));var util=require(_0xccc3('0x1'));var moment=require('moment');var BPromise=require(_0xccc3('0x2'));var rs=require(_0xccc3('0x3'));var fs=require('fs');var Redis=require(_0xccc3('0x4'));var db=require(_0xccc3('0x5'))['db'];var utils=require(_0xccc3('0x6'));var logger=require('../../config/logger')(_0xccc3('0x7'));var config=require('../../config/environment');var jayson=require(_0xccc3('0x8'));var client=jayson[_0xccc3('0x9')][_0xccc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x423684,_0x5eb00c,_0x39d86b){return new BPromise(function(_0x5b53df,_0x317d37){return client[_0xccc3('0xb')](_0x423684,_0x39d86b)[_0xccc3('0xc')](function(_0x221c9c){logger[_0xccc3('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x5eb00c,_0xccc3('0xe'));logger['debug'](_0xccc3('0xf'),_0x5eb00c,'request\x20sent',JSON[_0xccc3('0x10')](_0x221c9c));if(_0x221c9c[_0xccc3('0x11')]){if(_0x221c9c[_0xccc3('0x11')][_0xccc3('0x12')]===0x1f4){logger[_0xccc3('0x11')](_0xccc3('0x13'),_0x5eb00c,_0x221c9c[_0xccc3('0x11')]['message']);return _0x317d37(_0x221c9c[_0xccc3('0x11')][_0xccc3('0x14')]);}logger[_0xccc3('0x11')](_0xccc3('0x13'),_0x5eb00c,_0x221c9c[_0xccc3('0x11')][_0xccc3('0x14')]);return _0x5b53df(_0x221c9c[_0xccc3('0x11')][_0xccc3('0x14')]);}else{logger[_0xccc3('0xd')](_0xccc3('0x13'),_0x5eb00c,_0xccc3('0xe'));_0x5b53df(_0x221c9c[_0xccc3('0x15')][_0xccc3('0x14')]);}})[_0xccc3('0x16')](function(_0xf0b8be){logger['error'](_0xccc3('0x13'),_0x5eb00c,_0xf0b8be);_0x317d37(_0xf0b8be);});});}
\ No newline at end of file
+var _0x2b33=['../../config/utils','../../config/logger','rpc','jayson/promise','http','then','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x1cadd9,_0x4e73e9){var _0x3778e0=function(_0x50fe71){while(--_0x50fe71){_0x1cadd9['push'](_0x1cadd9['shift']());}};_0x3778e0(++_0x4e73e9);}(_0x2b33,0x18b));var _0x32b3=function(_0x43f161,_0x3f5d32){_0x43f161=_0x43f161-0x0;var _0x143df4=_0x2b33[_0x43f161];return _0x143df4;};'use strict';var _=require(_0x32b3('0x0'));var util=require(_0x32b3('0x1'));var moment=require(_0x32b3('0x2'));var BPromise=require(_0x32b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32b3('0x4'))['db'];var utils=require(_0x32b3('0x5'));var logger=require(_0x32b3('0x6'))(_0x32b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x32b3('0x8'));var client=jayson['client'][_0x32b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x565774,_0x431b29,_0x25e607){return new BPromise(function(_0x373bdf,_0x55c029){return client['request'](_0x565774,_0x25e607)[_0x32b3('0xa')](function(_0x1abf00){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x431b29,_0x32b3('0xb'));logger['debug'](_0x32b3('0xc'),_0x431b29,_0x32b3('0xb'),JSON[_0x32b3('0xd')](_0x1abf00));if(_0x1abf00[_0x32b3('0xe')]){if(_0x1abf00['error'][_0x32b3('0xf')]===0x1f4){logger[_0x32b3('0xe')](_0x32b3('0x10'),_0x431b29,_0x1abf00['error'][_0x32b3('0x11')]);return _0x55c029(_0x1abf00[_0x32b3('0xe')][_0x32b3('0x11')]);}logger['error'](_0x32b3('0x10'),_0x431b29,_0x1abf00[_0x32b3('0xe')][_0x32b3('0x11')]);return _0x373bdf(_0x1abf00['error'][_0x32b3('0x11')]);}else{logger[_0x32b3('0x12')](_0x32b3('0x10'),_0x431b29,'request\x20sent');_0x373bdf(_0x1abf00['result'][_0x32b3('0x11')]);}})[_0x32b3('0x13')](function(_0x3ca167){logger[_0x32b3('0xe')](_0x32b3('0x10'),_0x431b29,_0x3ca167);_0x55c029(_0x3ca167);});});}
\ No newline at end of file
index 4332a9a..bc7b6b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x110e=['../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4f156d,_0x1dde3e){var _0x25f22e=function(_0x5d74b6){while(--_0x5d74b6){_0x4f156d['push'](_0x4f156d['shift']());}};_0x25f22e(++_0x1dde3e);}(_0x110e,0x91));var _0xe110=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x110e[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var path=require(_0xe110('0x2'));var timeout=require(_0xe110('0x3'));var express=require(_0xe110('0x4'));var router=express[_0xe110('0x5')]();var fs_extra=require(_0xe110('0x6'));var auth=require(_0xe110('0x7'));var interaction=require(_0xe110('0x8'));var config=require(_0xe110('0x9'));var controller=require(_0xe110('0xa'));router['get']('/',auth[_0xe110('0xb')](),controller[_0xe110('0xc')]);router[_0xe110('0xd')](_0xe110('0xe'),auth[_0xe110('0xb')](),controller['describe']);router[_0xe110('0xd')]('/:id',auth[_0xe110('0xb')](),controller[_0xe110('0xf')]);router[_0xe110('0x10')]('/',auth[_0xe110('0xb')](),controller['create']);router['put'](_0xe110('0x11'),auth[_0xe110('0xb')](),controller[_0xe110('0x12')]);router[_0xe110('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe110('0x14')]);module[_0xe110('0x15')]=router;
\ No newline at end of file
+var _0x1bf2=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x510382,_0x3be94a){var _0x579779=function(_0x41a2d3){while(--_0x41a2d3){_0x510382['push'](_0x510382['shift']());}};_0x579779(++_0x3be94a);}(_0x1bf2,0xb1));var _0x21bf=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x1bf2[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x21bf('0x0'));var util=require(_0x21bf('0x1'));var path=require(_0x21bf('0x2'));var timeout=require('connect-timeout');var express=require(_0x21bf('0x3'));var router=express[_0x21bf('0x4')]();var fs_extra=require(_0x21bf('0x5'));var auth=require(_0x21bf('0x6'));var interaction=require(_0x21bf('0x7'));var config=require(_0x21bf('0x8'));var controller=require(_0x21bf('0x9'));router['get']('/',auth[_0x21bf('0xa')](),controller['index']);router[_0x21bf('0xb')](_0x21bf('0xc'),auth['isAuthenticated'](),controller[_0x21bf('0xd')]);router[_0x21bf('0xb')](_0x21bf('0xe'),auth['isAuthenticated'](),controller[_0x21bf('0xf')]);router[_0x21bf('0x10')]('/',auth[_0x21bf('0xa')](),controller['create']);router[_0x21bf('0x11')](_0x21bf('0xe'),auth[_0x21bf('0xa')](),controller[_0x21bf('0x12')]);router[_0x21bf('0x13')]('/:id',auth[_0x21bf('0xa')](),controller[_0x21bf('0x14')]);module[_0x21bf('0x15')]=router;
\ No newline at end of file
index 7144458..56b6b69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x54ef,0x112));var _0xf54e=function(_0x157d56,_0xfbd72b){_0x157d56=_0x157d56-0x0;var _0x588c92=_0x54ef[_0x157d56];return _0x588c92;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}};
\ No newline at end of file
+var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1bfc31,_0x2c60fb){var _0x31a200=function(_0x5ea834){while(--_0x5ea834){_0x1bfc31['push'](_0x1bfc31['shift']());}};_0x31a200(++_0x2c60fb);}(_0x70e0,0x17b));var _0x070e=function(_0x2582e4,_0x370981){_0x2582e4=_0x2582e4-0x0;var _0x300d14=_0x70e0[_0x2582e4];return _0x300d14;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}};
\ No newline at end of file
index 55527d0..79d1055 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a1d=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','rows','show','find','create','catch','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4a1d,0x79));var _0xd4a1=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x4a1d[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0xd4a1('0x0'));var rimraf=require(_0xd4a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4a1('0x2'));var rp=require(_0xd4a1('0x3'));var moment=require(_0xd4a1('0x4'));var BPromise=require(_0xd4a1('0x5'));var Mustache=require('mustache');var util=require(_0xd4a1('0x6'));var path=require(_0xd4a1('0x7'));var sox=require(_0xd4a1('0x8'));var csv=require(_0xd4a1('0x9'));var ejs=require(_0xd4a1('0xa'));var fs=require('fs');var fs_extra=require(_0xd4a1('0xb'));var _=require(_0xd4a1('0xc'));var squel=require('squel');var crypto=require(_0xd4a1('0xd'));var jsforce=require(_0xd4a1('0xe'));var deskjs=require(_0xd4a1('0xf'));var toCsv=require(_0xd4a1('0x9'));var querystring=require(_0xd4a1('0x10'));var Papa=require(_0xd4a1('0x11'));var Redis=require(_0xd4a1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd4a1('0x13'));var as=require(_0xd4a1('0x14'));var hardwareService=require(_0xd4a1('0x15'));var logger=require('../../config/logger')(_0xd4a1('0x16'));var utils=require(_0xd4a1('0x17'));var config=require(_0xd4a1('0x18'));var licenseUtil=require(_0xd4a1('0x19'));var db=require(_0xd4a1('0x1a'))['db'];function respondWithStatusCode(_0x5002ef,_0x56662b){_0x56662b=_0x56662b||0xcc;return function(_0x20417a){if(_0x20417a){return _0x5002ef['sendStatus'](_0x56662b);}return _0x5002ef[_0xd4a1('0x1b')](_0x56662b)[_0xd4a1('0x1c')]();};}function respondWithResult(_0x9841ce,_0x2739c5){_0x2739c5=_0x2739c5||0xc8;return function(_0x14f335){if(_0x14f335){return _0x9841ce['status'](_0x2739c5)[_0xd4a1('0x1d')](_0x14f335);}};}function respondWithFilteredResult(_0x9a75f6,_0x59d477){return function(_0x72af9c){if(_0x72af9c){var _0x118d73=typeof _0x59d477[_0xd4a1('0x1e')]==='undefined'&&typeof _0x59d477['limit']===_0xd4a1('0x1f');var _0x575c0f=_0x72af9c['count'];var _0x5abe74=_0x118d73?0x0:_0x59d477[_0xd4a1('0x1e')];var _0x53bcad=_0x118d73?_0x72af9c[_0xd4a1('0x20')]:_0x59d477[_0xd4a1('0x1e')]+_0x59d477[_0xd4a1('0x21')];var _0x302638;if(_0x53bcad>=_0x575c0f){_0x53bcad=_0x575c0f;_0x302638=0xc8;}else{_0x302638=0xce;}_0x9a75f6[_0xd4a1('0x1b')](_0x302638);return _0x9a75f6[_0xd4a1('0x22')](_0xd4a1('0x23'),_0x5abe74+'-'+_0x53bcad+'/'+_0x575c0f)[_0xd4a1('0x1d')](_0x72af9c);}return null;};}function patchUpdates(_0x58bb06){return function(_0x4b426c){try{jsonpatch[_0xd4a1('0x24')](_0x4b426c,_0x58bb06,!![]);}catch(_0x1bafd8){return BPromise[_0xd4a1('0x25')](_0x1bafd8);}return _0x4b426c['save']();};}function saveUpdates(_0x7741d0,_0x53c97b){return function(_0x17e359){if(_0x17e359){return _0x17e359[_0xd4a1('0x26')](_0x7741d0)['then'](function(_0x4909e9){return _0x4909e9;});}return null;};}function removeEntity(_0x591518,_0x10eb22){return function(_0x4904e2){if(_0x4904e2){return _0x4904e2[_0xd4a1('0x27')]()[_0xd4a1('0x28')](function(){_0x591518[_0xd4a1('0x1b')](0xcc)[_0xd4a1('0x1c')]();});}};}function handleEntityNotFound(_0x907cba,_0xa66c43){return function(_0x240e45){if(!_0x240e45){_0x907cba['sendStatus'](0x194);}return _0x240e45;};}function handleError(_0x520c0f,_0xed7849){_0xed7849=_0xed7849||0x1f4;return function(_0x350147){logger[_0xd4a1('0x29')](_0x350147['stack']);if(_0x350147[_0xd4a1('0x2a')]){delete _0x350147[_0xd4a1('0x2a')];}_0x520c0f['status'](_0xed7849)[_0xd4a1('0x2b')](_0x350147);};}exports[_0xd4a1('0x2c')]=function(_0x4da4b3,_0x11cbc1){var _0x40effa={},_0x45cb0e={},_0x575c78={'count':0x0,'rows':[]};var _0x22d71a=_[_0xd4a1('0x2d')](db[_0xd4a1('0x2e')][_0xd4a1('0x2f')],function(_0x21736e){return{'name':_0x21736e[_0xd4a1('0x30')],'type':_0x21736e[_0xd4a1('0x31')]['key']};});_0x45cb0e[_0xd4a1('0x32')]=_['map'](_0x22d71a,_0xd4a1('0x2a'));_0x45cb0e[_0xd4a1('0x33')]=_[_0xd4a1('0x34')](_0x4da4b3['query']);_0x45cb0e[_0xd4a1('0x35')]=_[_0xd4a1('0x36')](_0x45cb0e['model'],_0x45cb0e[_0xd4a1('0x33')]);_0x40effa[_0xd4a1('0x37')]=_[_0xd4a1('0x36')](_0x45cb0e[_0xd4a1('0x32')],qs['fields'](_0x4da4b3['query'][_0xd4a1('0x38')]));_0x40effa['attributes']=_0x40effa['attributes'][_0xd4a1('0x39')]?_0x40effa['attributes']:_0x45cb0e[_0xd4a1('0x32')];if(!_0x4da4b3[_0xd4a1('0x33')][_0xd4a1('0x3a')](_0xd4a1('0x3b'))){_0x40effa[_0xd4a1('0x21')]=qs[_0xd4a1('0x21')](_0x4da4b3[_0xd4a1('0x33')]['limit']);_0x40effa[_0xd4a1('0x1e')]=qs['offset'](_0x4da4b3[_0xd4a1('0x33')][_0xd4a1('0x1e')]);}_0x40effa[_0xd4a1('0x3c')]=qs[_0xd4a1('0x3d')](_0x4da4b3[_0xd4a1('0x33')][_0xd4a1('0x3d')]);_0x40effa[_0xd4a1('0x3e')]=qs[_0xd4a1('0x35')](_[_0xd4a1('0x3f')](_0x4da4b3[_0xd4a1('0x33')],_0x45cb0e[_0xd4a1('0x35')]),_0x22d71a);if(_0x4da4b3[_0xd4a1('0x33')]['filter']){_0x40effa[_0xd4a1('0x3e')]=_['merge'](_0x40effa['where'],{'$or':_['map'](_0x22d71a,function(_0x1769c7){if(_0x1769c7['type']!==_0xd4a1('0x40')){var _0x51017f={};_0x51017f[_0x1769c7[_0xd4a1('0x2a')]]={'$like':'%'+_0x4da4b3[_0xd4a1('0x33')]['filter']+'%'};return _0x51017f;}})});}_0x40effa=_['merge']({},_0x40effa,_0x4da4b3[_0xd4a1('0x41')]);var _0x154b11={'where':_0x40effa[_0xd4a1('0x3e')]};return db['MailTransferReport'][_0xd4a1('0x20')](_0x154b11)[_0xd4a1('0x28')](function(_0xbabe96){_0x575c78[_0xd4a1('0x20')]=_0xbabe96;if(_0x4da4b3[_0xd4a1('0x33')][_0xd4a1('0x42')]){_0x40effa['include']=[{'all':!![]}];}return db[_0xd4a1('0x2e')]['findAll'](_0x40effa);})[_0xd4a1('0x28')](function(_0x40935c){_0x575c78[_0xd4a1('0x43')]=_0x40935c;return _0x575c78;})['then'](respondWithFilteredResult(_0x11cbc1,_0x40effa))['catch'](handleError(_0x11cbc1,null));};exports[_0xd4a1('0x44')]=function(_0x57ef74,_0xe2a97c){var _0x1fb81f={'raw':!![],'where':{'id':_0x57ef74['params']['id']}},_0x1d7ea6={};_0x1d7ea6['model']=_[_0xd4a1('0x34')](db[_0xd4a1('0x2e')][_0xd4a1('0x2f')]);_0x1d7ea6['query']=_['keys'](_0x57ef74[_0xd4a1('0x33')]);_0x1d7ea6[_0xd4a1('0x35')]=_[_0xd4a1('0x36')](_0x1d7ea6['model'],_0x1d7ea6['query']);_0x1fb81f[_0xd4a1('0x37')]=_[_0xd4a1('0x36')](_0x1d7ea6[_0xd4a1('0x32')],qs[_0xd4a1('0x38')](_0x57ef74[_0xd4a1('0x33')][_0xd4a1('0x38')]));_0x1fb81f[_0xd4a1('0x37')]=_0x1fb81f[_0xd4a1('0x37')]['length']?_0x1fb81f[_0xd4a1('0x37')]:_0x1d7ea6[_0xd4a1('0x32')];if(_0x57ef74[_0xd4a1('0x33')][_0xd4a1('0x42')]){_0x1fb81f['include']=[{'all':!![]}];}_0x1fb81f=_['merge']({},_0x1fb81f,_0x57ef74[_0xd4a1('0x41')]);return db[_0xd4a1('0x2e')][_0xd4a1('0x45')](_0x1fb81f)[_0xd4a1('0x28')](handleEntityNotFound(_0xe2a97c,null))[_0xd4a1('0x28')](respondWithResult(_0xe2a97c,null))['catch'](handleError(_0xe2a97c,null));};exports[_0xd4a1('0x46')]=function(_0x962ba4,_0x58f809){return db[_0xd4a1('0x2e')][_0xd4a1('0x46')](_0x962ba4['body'],{})[_0xd4a1('0x28')](respondWithResult(_0x58f809,0xc9))[_0xd4a1('0x47')](handleError(_0x58f809,null));};exports[_0xd4a1('0x26')]=function(_0x46538b,_0x3e97c3){if(_0x46538b['body']['id']){delete _0x46538b[_0xd4a1('0x48')]['id'];}return db[_0xd4a1('0x2e')][_0xd4a1('0x45')]({'where':{'id':_0x46538b[_0xd4a1('0x49')]['id']}})[_0xd4a1('0x28')](handleEntityNotFound(_0x3e97c3,null))['then'](saveUpdates(_0x46538b[_0xd4a1('0x48')],null))[_0xd4a1('0x28')](respondWithResult(_0x3e97c3,null))[_0xd4a1('0x47')](handleError(_0x3e97c3,null));};exports['destroy']=function(_0x2cdccf,_0x5a5600){return db[_0xd4a1('0x2e')]['find']({'where':{'id':_0x2cdccf[_0xd4a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a5600,null))[_0xd4a1('0x28')](removeEntity(_0x5a5600,null))[_0xd4a1('0x47')](handleError(_0x5a5600,null));};exports[_0xd4a1('0x4a')]=function(_0x3e65ce,_0x5d4e51){return db[_0xd4a1('0x2e')][_0xd4a1('0x4a')]()[_0xd4a1('0x28')](respondWithResult(_0x5d4e51,null))['catch'](handleError(_0x5d4e51,null));};
\ No newline at end of file
+var _0xa117=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa117,0x178));var _0x7a11=function(_0x32541e,_0x4d0a31){_0x32541e=_0x32541e-0x0;var _0x11e9ad=_0xa117[_0x32541e];return _0x11e9ad;};'use strict';var emlformat=require(_0x7a11('0x0'));var rimraf=require(_0x7a11('0x1'));var zipdir=require(_0x7a11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a11('0x3'));var BPromise=require(_0x7a11('0x4'));var Mustache=require(_0x7a11('0x5'));var util=require(_0x7a11('0x6'));var path=require(_0x7a11('0x7'));var sox=require(_0x7a11('0x8'));var csv=require(_0x7a11('0x9'));var ejs=require(_0x7a11('0xa'));var fs=require('fs');var fs_extra=require(_0x7a11('0xb'));var _=require(_0x7a11('0xc'));var squel=require(_0x7a11('0xd'));var crypto=require(_0x7a11('0xe'));var jsforce=require(_0x7a11('0xf'));var deskjs=require(_0x7a11('0x10'));var toCsv=require(_0x7a11('0x9'));var querystring=require(_0x7a11('0x11'));var Papa=require(_0x7a11('0x12'));var Redis=require(_0x7a11('0x13'));var authService=require(_0x7a11('0x14'));var qs=require(_0x7a11('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a11('0x16'));var logger=require(_0x7a11('0x17'))(_0x7a11('0x18'));var utils=require(_0x7a11('0x19'));var config=require(_0x7a11('0x1a'));var licenseUtil=require(_0x7a11('0x1b'));var db=require(_0x7a11('0x1c'))['db'];function respondWithStatusCode(_0x201d52,_0x1b4348){_0x1b4348=_0x1b4348||0xcc;return function(_0xf10aad){if(_0xf10aad){return _0x201d52['sendStatus'](_0x1b4348);}return _0x201d52['status'](_0x1b4348)[_0x7a11('0x1d')]();};}function respondWithResult(_0x44ae10,_0xbd7f45){_0xbd7f45=_0xbd7f45||0xc8;return function(_0x37d7b6){if(_0x37d7b6){return _0x44ae10[_0x7a11('0x1e')](_0xbd7f45)[_0x7a11('0x1f')](_0x37d7b6);}};}function respondWithFilteredResult(_0xb517b6,_0x3b417c){return function(_0x26609f){if(_0x26609f){var _0x1e924d=typeof _0x3b417c[_0x7a11('0x20')]===_0x7a11('0x21')&&typeof _0x3b417c[_0x7a11('0x22')]===_0x7a11('0x21');var _0x27c204=_0x26609f[_0x7a11('0x23')];var _0x1f11fa=_0x1e924d?0x0:_0x3b417c[_0x7a11('0x20')];var _0x51bca1=_0x1e924d?_0x26609f['count']:_0x3b417c['offset']+_0x3b417c[_0x7a11('0x22')];var _0xbf1fb6;if(_0x51bca1>=_0x27c204){_0x51bca1=_0x27c204;_0xbf1fb6=0xc8;}else{_0xbf1fb6=0xce;}_0xb517b6['status'](_0xbf1fb6);return _0xb517b6[_0x7a11('0x24')]('Content-Range',_0x1f11fa+'-'+_0x51bca1+'/'+_0x27c204)[_0x7a11('0x1f')](_0x26609f);}return null;};}function patchUpdates(_0x5b4fe2){return function(_0x54082f){try{jsonpatch[_0x7a11('0x25')](_0x54082f,_0x5b4fe2,!![]);}catch(_0x599f25){return BPromise['reject'](_0x599f25);}return _0x54082f[_0x7a11('0x26')]();};}function saveUpdates(_0x4c2e17,_0x341db6){return function(_0x37f11d){if(_0x37f11d){return _0x37f11d['update'](_0x4c2e17)[_0x7a11('0x27')](function(_0x5c2f0c){return _0x5c2f0c;});}return null;};}function removeEntity(_0x2aa326,_0x3eb7a0){return function(_0x1964ef){if(_0x1964ef){return _0x1964ef[_0x7a11('0x28')]()[_0x7a11('0x27')](function(){_0x2aa326[_0x7a11('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b62,_0x43344a){return function(_0x2a6ef9){if(!_0x2a6ef9){_0x5e7b62['sendStatus'](0x194);}return _0x2a6ef9;};}function handleError(_0x15a71d,_0x1cb1f8){_0x1cb1f8=_0x1cb1f8||0x1f4;return function(_0x3ccfa1){logger[_0x7a11('0x29')](_0x3ccfa1[_0x7a11('0x2a')]);if(_0x3ccfa1['name']){delete _0x3ccfa1[_0x7a11('0x2b')];}_0x15a71d[_0x7a11('0x1e')](_0x1cb1f8)['send'](_0x3ccfa1);};}exports[_0x7a11('0x2c')]=function(_0x4ffc51,_0x18e0c6){var _0x26d555={},_0x4bfe47={},_0x1b08a7={'count':0x0,'rows':[]};var _0x1ca528=_['map'](db[_0x7a11('0x2d')][_0x7a11('0x2e')],function(_0x515c3b){return{'name':_0x515c3b[_0x7a11('0x2f')],'type':_0x515c3b[_0x7a11('0x30')][_0x7a11('0x31')]};});_0x4bfe47[_0x7a11('0x32')]=_[_0x7a11('0x33')](_0x1ca528,_0x7a11('0x2b'));_0x4bfe47[_0x7a11('0x34')]=_[_0x7a11('0x35')](_0x4ffc51[_0x7a11('0x34')]);_0x4bfe47[_0x7a11('0x36')]=_[_0x7a11('0x37')](_0x4bfe47[_0x7a11('0x32')],_0x4bfe47[_0x7a11('0x34')]);_0x26d555[_0x7a11('0x38')]=_['intersection'](_0x4bfe47[_0x7a11('0x32')],qs[_0x7a11('0x39')](_0x4ffc51[_0x7a11('0x34')][_0x7a11('0x39')]));_0x26d555[_0x7a11('0x38')]=_0x26d555[_0x7a11('0x38')][_0x7a11('0x3a')]?_0x26d555['attributes']:_0x4bfe47[_0x7a11('0x32')];if(!_0x4ffc51[_0x7a11('0x34')][_0x7a11('0x3b')](_0x7a11('0x3c'))){_0x26d555[_0x7a11('0x22')]=qs[_0x7a11('0x22')](_0x4ffc51['query'][_0x7a11('0x22')]);_0x26d555['offset']=qs[_0x7a11('0x20')](_0x4ffc51['query'][_0x7a11('0x20')]);}_0x26d555[_0x7a11('0x3d')]=qs[_0x7a11('0x3e')](_0x4ffc51['query'][_0x7a11('0x3e')]);_0x26d555[_0x7a11('0x3f')]=qs[_0x7a11('0x36')](_['pick'](_0x4ffc51[_0x7a11('0x34')],_0x4bfe47[_0x7a11('0x36')]),_0x1ca528);if(_0x4ffc51['query'][_0x7a11('0x40')]){_0x26d555[_0x7a11('0x3f')]=_[_0x7a11('0x41')](_0x26d555[_0x7a11('0x3f')],{'$or':_[_0x7a11('0x33')](_0x1ca528,function(_0x373fda){if(_0x373fda[_0x7a11('0x30')]!==_0x7a11('0x42')){var _0x13d3ac={};_0x13d3ac[_0x373fda[_0x7a11('0x2b')]]={'$like':'%'+_0x4ffc51[_0x7a11('0x34')][_0x7a11('0x40')]+'%'};return _0x13d3ac;}})});}_0x26d555=_[_0x7a11('0x41')]({},_0x26d555,_0x4ffc51['options']);var _0x1106a3={'where':_0x26d555['where']};return db[_0x7a11('0x2d')][_0x7a11('0x23')](_0x1106a3)[_0x7a11('0x27')](function(_0xf471d7){_0x1b08a7[_0x7a11('0x23')]=_0xf471d7;if(_0x4ffc51[_0x7a11('0x34')]['includeAll']){_0x26d555[_0x7a11('0x43')]=[{'all':!![]}];}return db[_0x7a11('0x2d')][_0x7a11('0x44')](_0x26d555);})[_0x7a11('0x27')](function(_0x6426bd){_0x1b08a7[_0x7a11('0x45')]=_0x6426bd;return _0x1b08a7;})[_0x7a11('0x27')](respondWithFilteredResult(_0x18e0c6,_0x26d555))[_0x7a11('0x46')](handleError(_0x18e0c6,null));};exports['show']=function(_0x1a7dac,_0x941f63){var _0x3793cc={'raw':!![],'where':{'id':_0x1a7dac[_0x7a11('0x47')]['id']}},_0x5f4cdf={};_0x5f4cdf[_0x7a11('0x32')]=_[_0x7a11('0x35')](db[_0x7a11('0x2d')][_0x7a11('0x2e')]);_0x5f4cdf[_0x7a11('0x34')]=_[_0x7a11('0x35')](_0x1a7dac[_0x7a11('0x34')]);_0x5f4cdf['filters']=_[_0x7a11('0x37')](_0x5f4cdf['model'],_0x5f4cdf[_0x7a11('0x34')]);_0x3793cc[_0x7a11('0x38')]=_['intersection'](_0x5f4cdf[_0x7a11('0x32')],qs['fields'](_0x1a7dac[_0x7a11('0x34')]['fields']));_0x3793cc[_0x7a11('0x38')]=_0x3793cc[_0x7a11('0x38')][_0x7a11('0x3a')]?_0x3793cc[_0x7a11('0x38')]:_0x5f4cdf['model'];if(_0x1a7dac[_0x7a11('0x34')][_0x7a11('0x48')]){_0x3793cc[_0x7a11('0x43')]=[{'all':!![]}];}_0x3793cc=_[_0x7a11('0x41')]({},_0x3793cc,_0x1a7dac[_0x7a11('0x49')]);return db[_0x7a11('0x2d')]['find'](_0x3793cc)[_0x7a11('0x27')](handleEntityNotFound(_0x941f63,null))['then'](respondWithResult(_0x941f63,null))[_0x7a11('0x46')](handleError(_0x941f63,null));};exports[_0x7a11('0x4a')]=function(_0x1051b2,_0x4598d3){return db['MailTransferReport'][_0x7a11('0x4a')](_0x1051b2[_0x7a11('0x4b')],{})['then'](respondWithResult(_0x4598d3,0xc9))['catch'](handleError(_0x4598d3,null));};exports[_0x7a11('0x4c')]=function(_0x1d8306,_0x469df1){if(_0x1d8306[_0x7a11('0x4b')]['id']){delete _0x1d8306[_0x7a11('0x4b')]['id'];}return db['MailTransferReport'][_0x7a11('0x4d')]({'where':{'id':_0x1d8306[_0x7a11('0x47')]['id']}})['then'](handleEntityNotFound(_0x469df1,null))[_0x7a11('0x27')](saveUpdates(_0x1d8306[_0x7a11('0x4b')],null))['then'](respondWithResult(_0x469df1,null))[_0x7a11('0x46')](handleError(_0x469df1,null));};exports[_0x7a11('0x28')]=function(_0x598e2c,_0x4eee62){return db[_0x7a11('0x2d')]['find']({'where':{'id':_0x598e2c[_0x7a11('0x47')]['id']}})[_0x7a11('0x27')](handleEntityNotFound(_0x4eee62,null))[_0x7a11('0x27')](removeEntity(_0x4eee62,null))['catch'](handleError(_0x4eee62,null));};exports[_0x7a11('0x4e')]=function(_0x50cebb,_0x2afffb){return db[_0x7a11('0x2d')]['describe']()[_0x7a11('0x27')](respondWithResult(_0x2afffb,null))[_0x7a11('0x46')](handleError(_0x2afffb,null));};
\ No newline at end of file
index 3dd420f..90db2e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8558=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util'];(function(_0x3135fd,_0x2a5c4b){var _0x1b5d7f=function(_0x55663d){while(--_0x55663d){_0x3135fd['push'](_0x3135fd['shift']());}};_0x1b5d7f(++_0x2a5c4b);}(_0x8558,0x103));var _0x8855=function(_0x1b3780,_0x43c82f){_0x1b3780=_0x1b3780-0x0;var _0x5ecab1=_0x8558[_0x1b3780];return _0x5ecab1;};'use strict';var _=require('lodash');var util=require(_0x8855('0x0'));var logger=require(_0x8855('0x1'))(_0x8855('0x2'));var moment=require(_0x8855('0x3'));var BPromise=require(_0x8855('0x4'));var rp=require(_0x8855('0x5'));var fs=require('fs');var path=require(_0x8855('0x6'));var rimraf=require('rimraf');var config=require(_0x8855('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x8855('0x8')]=function(_0x4ed0e8,_0x276ee5){return _0x4ed0e8[_0x8855('0x9')](_0x8855('0xa'),attributes,{'tableName':_0x8855('0xb'),'paranoid':![],'indexes':[{'name':_0x8855('0xc'),'fields':[_0x8855('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0b78=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b78,0x1ad));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var logger=require('../../config/logger')(_0x80b7('0x2'));var moment=require(_0x80b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x80b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var attributes=require(_0x80b7('0x7'));module['exports']=function(_0x49bc7f,_0x167ddd){return _0x49bc7f['define'](_0x80b7('0x8'),attributes,{'tableName':_0x80b7('0x9'),'paranoid':![],'indexes':[{'name':_0x80b7('0xa'),'fields':[_0x80b7('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index 92523e9..de6937b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa297=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xa297,0x154));var _0x7a29=function(_0xc516e8,_0x53a172){_0xc516e8=_0xc516e8-0x0;var _0xf1ef11=_0xa297[_0xc516e8];return _0xf1ef11;};'use strict';var _=require(_0x7a29('0x0'));var util=require(_0x7a29('0x1'));var moment=require(_0x7a29('0x2'));var BPromise=require(_0x7a29('0x3'));var rs=require(_0x7a29('0x4'));var fs=require('fs');var Redis=require(_0x7a29('0x5'));var db=require(_0x7a29('0x6'))['db'];var utils=require(_0x7a29('0x7'));var logger=require(_0x7a29('0x8'))(_0x7a29('0x9'));var config=require(_0x7a29('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27bf0e,_0x40dde8,_0x1df551){return new BPromise(function(_0x37868f,_0x370256){return client[_0x7a29('0xc')](_0x27bf0e,_0x1df551)[_0x7a29('0xd')](function(_0x3c83d5){logger[_0x7a29('0xe')](_0x7a29('0xf'),_0x40dde8,'request\x20sent');logger['debug'](_0x7a29('0x10'),_0x40dde8,_0x7a29('0x11'),JSON['stringify'](_0x3c83d5));if(_0x3c83d5[_0x7a29('0x12')]){if(_0x3c83d5[_0x7a29('0x12')][_0x7a29('0x13')]===0x1f4){logger[_0x7a29('0x12')](_0x7a29('0xf'),_0x40dde8,_0x3c83d5[_0x7a29('0x12')][_0x7a29('0x14')]);return _0x370256(_0x3c83d5[_0x7a29('0x12')][_0x7a29('0x14')]);}logger[_0x7a29('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x40dde8,_0x3c83d5['error'][_0x7a29('0x14')]);return _0x37868f(_0x3c83d5[_0x7a29('0x12')][_0x7a29('0x14')]);}else{logger[_0x7a29('0xe')](_0x7a29('0xf'),_0x40dde8,'request\x20sent');_0x37868f(_0x3c83d5[_0x7a29('0x15')]['message']);}})[_0x7a29('0x16')](function(_0xa057d9){logger['error'](_0x7a29('0xf'),_0x40dde8,_0xa057d9);_0x370256(_0xa057d9);});});}
\ No newline at end of file
+var _0x245e=['MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','info'];(function(_0x183f4f,_0x13fd67){var _0x5f312f=function(_0x12570b){while(--_0x12570b){_0x183f4f['push'](_0x183f4f['shift']());}};_0x5f312f(++_0x13fd67);}(_0x245e,0x16e));var _0xe245=function(_0x109e60,_0x43eff1){_0x109e60=_0x109e60-0x0;var _0x2376d4=_0x245e[_0x109e60];return _0x2376d4;};'use strict';var _=require(_0xe245('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe245('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe245('0x2'));var db=require(_0xe245('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe245('0x4'))('rpc');var config=require(_0xe245('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe245('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd954fb,_0x269e42,_0x1f72fc){return new BPromise(function(_0x4b882e,_0x144537){return client['request'](_0xd954fb,_0x1f72fc)['then'](function(_0x111729){logger[_0xe245('0x7')](_0xe245('0x8'),_0x269e42,_0xe245('0x9'));logger[_0xe245('0xa')](_0xe245('0xb'),_0x269e42,_0xe245('0x9'),JSON[_0xe245('0xc')](_0x111729));if(_0x111729['error']){if(_0x111729[_0xe245('0xd')][_0xe245('0xe')]===0x1f4){logger[_0xe245('0xd')](_0xe245('0x8'),_0x269e42,_0x111729['error']['message']);return _0x144537(_0x111729['error'][_0xe245('0xf')]);}logger['error'](_0xe245('0x8'),_0x269e42,_0x111729[_0xe245('0xd')][_0xe245('0xf')]);return _0x4b882e(_0x111729[_0xe245('0xd')][_0xe245('0xf')]);}else{logger['info'](_0xe245('0x8'),_0x269e42,_0xe245('0x9'));_0x4b882e(_0x111729[_0xe245('0x10')]['message']);}})['catch'](function(_0xe4829){logger[_0xe245('0xd')](_0xe245('0x8'),_0x269e42,_0xe4829);_0x144537(_0xe4829);});});}
\ No newline at end of file
index 29bc1a1..9271143 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x75e0=['exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','update','delete'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0x75e0,0x67));var _0x075e=function(_0x3cf98f,_0x404ce1){_0x3cf98f=_0x3cf98f-0x0;var _0x2a09a8=_0x75e0[_0x3cf98f];return _0x2a09a8;};'use strict';var multer=require(_0x075e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x075e('0x1'));var express=require(_0x075e('0x2'));var router=express[_0x075e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x075e('0x4'));var config=require(_0x075e('0x5'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x075e('0x6')](),controller[_0x075e('0x7')]);router['get'](_0x075e('0x8'),auth[_0x075e('0x6')](),controller[_0x075e('0x9')]);router[_0x075e('0xa')](_0x075e('0xb'),auth['isAuthenticated'](),controller[_0x075e('0xc')]);router[_0x075e('0xd')]('/',auth[_0x075e('0x6')](),controller['create']);router['put'](_0x075e('0xb'),auth['isAuthenticated'](),controller[_0x075e('0xe')]);router[_0x075e('0xf')](_0x075e('0xb'),auth[_0x075e('0x6')](),controller['destroy']);module[_0x075e('0x10')]=router;
\ No newline at end of file
+var _0xeea8=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','get','describe','/:id','create','put','update','destroy','exports','multer','util'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0xeea8,0x1d2));var _0x8eea=function(_0x2e9611,_0x9e39ea){_0x2e9611=_0x2e9611-0x0;var _0xbd817a=_0xeea8[_0x2e9611];return _0xbd817a;};'use strict';var multer=require(_0x8eea('0x0'));var util=require(_0x8eea('0x1'));var path=require(_0x8eea('0x2'));var timeout=require(_0x8eea('0x3'));var express=require(_0x8eea('0x4'));var router=express['Router']();var fs_extra=require(_0x8eea('0x5'));var auth=require(_0x8eea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8eea('0x7'));var controller=require(_0x8eea('0x8'));router['get']('/',auth[_0x8eea('0x9')](),controller['index']);router[_0x8eea('0xa')]('/describe',auth[_0x8eea('0x9')](),controller[_0x8eea('0xb')]);router[_0x8eea('0xa')](_0x8eea('0xc'),auth[_0x8eea('0x9')](),controller['show']);router['post']('/',auth[_0x8eea('0x9')](),controller[_0x8eea('0xd')]);router[_0x8eea('0xe')](_0x8eea('0xc'),auth[_0x8eea('0x9')](),controller[_0x8eea('0xf')]);router['delete'](_0x8eea('0xc'),auth[_0x8eea('0x9')](),controller[_0x8eea('0x10')]);module[_0x8eea('0x11')]=router;
\ No newline at end of file
index 3d36e12..3cc325a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf171=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','exports'];(function(_0x1111f9,_0x158f29){var _0x16cc1f=function(_0x1b1a09){while(--_0x1b1a09){_0x1111f9['push'](_0x1111f9['shift']());}};_0x16cc1f(++_0x158f29);}(_0xf171,0x116));var _0x1f17=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0xf171[_0x1551af];return _0xd8eb82;};'use strict';var Sequelize=require(_0x1f17('0x0'));var moment=require('moment');module[_0x1f17('0x1')]={'channel':{'type':Sequelize[_0x1f17('0x2')]},'membername':{'type':Sequelize[_0x1f17('0x2')]},'interface':{'type':Sequelize[_0x1f17('0x2')]},'type':{'type':Sequelize[_0x1f17('0x2')],'defaultValue':_0x1f17('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x1f17('0x4')]},'enterAt':{'type':Sequelize[_0x1f17('0x5')]},'exitAt':{'type':Sequelize[_0x1f17('0x5')],'set':function(_0x237735){var _0x18f568=moment(_0x237735);var _0x3fca6d=moment(this[_0x1f17('0x6')]('enterAt'));var _0x29cf8a=_0x18f568['diff'](_0x3fca6d,_0x1f17('0x7'));this['setDataValue'](_0x1f17('0x8'),_0x237735);this[_0x1f17('0x9')]('duration',_0x29cf8a>=0x0?_0x29cf8a:null);}},'data1':{'type':Sequelize[_0x1f17('0x2')],'comment':_0x1f17('0xa')},'data2':{'type':Sequelize[_0x1f17('0x2')],'comment':_0x1f17('0xb')},'data3':{'type':Sequelize[_0x1f17('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x1f17('0xc')},'data5':{'type':Sequelize[_0x1f17('0x2')],'comment':_0x1f17('0xd')},'role':{'type':Sequelize[_0x1f17('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1f17('0x2')]}};
\ No newline at end of file
+var _0xe661=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','exports'];(function(_0x533db2,_0x5613ba){var _0x9e98f9=function(_0x5be317){while(--_0x5be317){_0x533db2['push'](_0x533db2['shift']());}};_0x9e98f9(++_0x5613ba);}(_0xe661,0x184));var _0x1e66=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe661[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x1e66('0x0'));var moment=require(_0x1e66('0x1'));module[_0x1e66('0x2')]={'channel':{'type':Sequelize[_0x1e66('0x3')]},'membername':{'type':Sequelize[_0x1e66('0x3')]},'interface':{'type':Sequelize[_0x1e66('0x3')]},'type':{'type':Sequelize[_0x1e66('0x3')],'defaultValue':_0x1e66('0x4'),'comment':_0x1e66('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1e66('0x6')],'set':function(_0x53738f){var _0x5c1dd1=moment(_0x53738f);var _0x29cc44=moment(this[_0x1e66('0x7')](_0x1e66('0x8')));var _0x1801ab=_0x5c1dd1['diff'](_0x29cc44,_0x1e66('0x9'));this[_0x1e66('0xa')]('exitAt',_0x53738f);this[_0x1e66('0xa')](_0x1e66('0xb'),_0x1801ab>=0x0?_0x1801ab:null);}},'data1':{'type':Sequelize[_0x1e66('0x3')],'comment':_0x1e66('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x1e66('0xd')},'data3':{'type':Sequelize[_0x1e66('0x3')],'comment':_0x1e66('0xe')},'data4':{'type':Sequelize[_0x1e66('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x1e66('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x1e66('0x10')]},'uniqueid':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 28cd2a1..f4d7a21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x425ecd,_0x1e1bed){var _0xddc406=function(_0x179638){while(--_0x179638){_0x425ecd['push'](_0x425ecd['shift']());}};_0xddc406(++_0x1e1bed);}(_0x008c,0x188));var _0xc008=function(_0x398437,_0x382e5f){_0x398437=_0x398437-0x0;var _0x539597=_0x008c[_0x398437];return _0x539597;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));};
\ No newline at end of file
+var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x55ca,0x126));var _0xa55c=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x55ca[_0x158da6];return _0x429c30;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));};
\ No newline at end of file
index a1d3b00..732c4b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51ed=['membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0x51ed,0x12f));var _0xd51e=function(_0x46647b,_0x4e8678){_0x46647b=_0x46647b-0x0;var _0x2bef5d=_0x51ed[_0x46647b];return _0x2bef5d;};'use strict';var _=require(_0xd51e('0x0'));var util=require(_0xd51e('0x1'));var logger=require(_0xd51e('0x2'))(_0xd51e('0x3'));var moment=require(_0xd51e('0x4'));var BPromise=require(_0xd51e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd51e('0x6'));var rimraf=require('rimraf');var config=require(_0xd51e('0x7'));var attributes=require(_0xd51e('0x8'));module[_0xd51e('0x9')]=function(_0x541798,_0x437618){return _0x541798[_0xd51e('0xa')](_0xd51e('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd51e('0xc'),'fields':[_0xd51e('0xd'),_0xd51e('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x40b7=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x40b7,0x1e2));var _0x740b=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x40b7[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x740b('0x0'));var util=require(_0x740b('0x1'));var logger=require(_0x740b('0x2'))(_0x740b('0x3'));var moment=require(_0x740b('0x4'));var BPromise=require('bluebird');var rp=require(_0x740b('0x5'));var fs=require('fs');var path=require(_0x740b('0x6'));var rimraf=require(_0x740b('0x7'));var config=require(_0x740b('0x8'));var attributes=require(_0x740b('0x9'));module[_0x740b('0xa')]=function(_0x551015,_0x2c68c0){return _0x551015[_0x740b('0xb')](_0x740b('0xc'),attributes,{'tableName':_0x740b('0xd'),'paranoid':![],'indexes':[{'name':_0x740b('0xe'),'fields':[_0x740b('0xf'),_0x740b('0x10')]}],'timestamps':!![]});};
\ No newline at end of file
index 9fadedc..7688cb1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9bb8=['../../config/environment','jayson/promise','http','then','MemberReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5f33b7,_0x566b11){var _0x4e097b=function(_0x2b84b9){while(--_0x2b84b9){_0x5f33b7['push'](_0x5f33b7['shift']());}};_0x4e097b(++_0x566b11);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89bb('0x0'));var util=require(_0x89bb('0x1'));var moment=require(_0x89bb('0x2'));var BPromise=require(_0x89bb('0x3'));var rs=require(_0x89bb('0x4'));var fs=require('fs');var Redis=require(_0x89bb('0x5'));var db=require(_0x89bb('0x6'))['db'];var utils=require(_0x89bb('0x7'));var logger=require(_0x89bb('0x8'))(_0x89bb('0x9'));var config=require(_0x89bb('0xa'));var jayson=require(_0x89bb('0xb'));var client=jayson['client'][_0x89bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b9e11,_0x3d85a5,_0x39c0eb){return new BPromise(function(_0x288ad3,_0x392260){return client['request'](_0x1b9e11,_0x39c0eb)[_0x89bb('0xd')](function(_0x19a3fd){logger['info'](_0x89bb('0xe'),_0x3d85a5,'request\x20sent');logger[_0x89bb('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3d85a5,_0x89bb('0x10'),JSON['stringify'](_0x19a3fd));if(_0x19a3fd[_0x89bb('0x11')]){if(_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x12')]===0x1f4){logger[_0x89bb('0x11')]('MemberReport,\x20%s,\x20%s',_0x3d85a5,_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);return _0x392260(_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x3d85a5,_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);return _0x288ad3(_0x19a3fd[_0x89bb('0x11')][_0x89bb('0x13')]);}else{logger[_0x89bb('0x14')](_0x89bb('0xe'),_0x3d85a5,'request\x20sent');_0x288ad3(_0x19a3fd[_0x89bb('0x15')][_0x89bb('0x13')]);}})['catch'](function(_0x1c7666){logger[_0x89bb('0x11')](_0x89bb('0xe'),_0x3d85a5,_0x1c7666);_0x392260(_0x1c7666);});});}exports[_0x89bb('0x16')]=function(_0x310e3d){var _0x58f826=this;return new Promise(function(_0x1693cc,_0xfef96d){return db[_0x89bb('0x17')][_0x89bb('0x18')]({'raw':_0x310e3d[_0x89bb('0x19')]?_0x310e3d[_0x89bb('0x19')][_0x89bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x310e3d[_0x89bb('0x19')]?_0x310e3d[_0x89bb('0x19')][_0x89bb('0x1b')]||null:null,'attributes':_0x310e3d['options']?_0x310e3d[_0x89bb('0x19')][_0x89bb('0x1c')]||null:null,'limit':_0x310e3d[_0x89bb('0x19')]?_0x310e3d[_0x89bb('0x19')][_0x89bb('0x1d')]||null:null,'include':_0x310e3d[_0x89bb('0x19')]?_0x310e3d['options'][_0x89bb('0x1e')]?_[_0x89bb('0x1f')](_0x310e3d[_0x89bb('0x19')][_0x89bb('0x1e')],function(_0x3c173b){return{'model':db[_0x3c173b[_0x89bb('0x20')]],'as':_0x3c173b['as'],'attributes':_0x3c173b[_0x89bb('0x1c')],'include':_0x3c173b[_0x89bb('0x1e')]?_[_0x89bb('0x1f')](_0x3c173b[_0x89bb('0x1e')],function(_0x4c25f6){return{'model':db[_0x4c25f6['model']],'as':_0x4c25f6['as'],'attributes':_0x4c25f6[_0x89bb('0x1c')],'include':_0x4c25f6[_0x89bb('0x1e')]?_[_0x89bb('0x1f')](_0x4c25f6[_0x89bb('0x1e')],function(_0xfaf778){return{'model':db[_0xfaf778[_0x89bb('0x20')]],'as':_0xfaf778['as'],'attributes':_0xfaf778[_0x89bb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x89bb('0xd')](function(_0x34b852){logger[_0x89bb('0x14')](_0x89bb('0x16'),_0x310e3d);logger[_0x89bb('0xf')]('GetMemberReport',_0x310e3d,JSON[_0x89bb('0x21')](_0x34b852));_0x1693cc(_0x34b852);})[_0x89bb('0x22')](function(_0x3757e1){logger['error'](_0x89bb('0x16'),_0x3757e1[_0x89bb('0x13')],_0x310e3d);_0xfef96d(_0x58f826[_0x89bb('0x11')](0x1f4,_0x3757e1[_0x89bb('0x13')]));});});};exports['CreateMemberReport']=function(_0x40c0d2){var _0x577515=this;return new Promise(function(_0x7f9529,_0x3b9a13){return db['MemberReport'][_0x89bb('0x23')](_0x40c0d2[_0x89bb('0x24')],{'raw':_0x40c0d2[_0x89bb('0x19')]?_0x40c0d2[_0x89bb('0x19')][_0x89bb('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x378ba1){logger[_0x89bb('0x14')](_0x89bb('0x25'),_0x40c0d2);logger[_0x89bb('0xf')]('CreateMemberReport',_0x40c0d2,JSON[_0x89bb('0x21')](_0x378ba1));_0x7f9529(_0x378ba1);})[_0x89bb('0x22')](function(_0x39e5d8){logger['error'](_0x89bb('0x25'),_0x39e5d8[_0x89bb('0x13')],_0x40c0d2);_0x3b9a13(_0x577515[_0x89bb('0x11')](0x1f4,_0x39e5d8[_0x89bb('0x13')]));});});};exports[_0x89bb('0x26')]=function(_0x3bee56){var _0x3c4eff=this;return new Promise(function(_0x149828,_0xf70e23){return db[_0x89bb('0x17')][_0x89bb('0x27')](_0x3bee56['body'],{'raw':_0x3bee56[_0x89bb('0x19')]?_0x3bee56[_0x89bb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bee56[_0x89bb('0x19')]?_0x3bee56[_0x89bb('0x19')]['where']||null:null,'attributes':_0x3bee56['options']?_0x3bee56['options'][_0x89bb('0x1c')]||null:null,'limit':_0x3bee56['options']?_0x3bee56['options']['limit']||null:null})[_0x89bb('0xd')](function(_0x1b0562){logger[_0x89bb('0x14')]('UpdateMemberReport',_0x3bee56);logger[_0x89bb('0xf')](_0x89bb('0x26'),_0x3bee56,JSON[_0x89bb('0x21')](_0x1b0562));_0x149828(_0x1b0562);})[_0x89bb('0x22')](function(_0x24e4a3){logger[_0x89bb('0x11')]('UpdateMemberReport',_0x24e4a3[_0x89bb('0x13')],_0x3bee56);_0xf70e23(_0x3c4eff[_0x89bb('0x11')](0x1f4,_0x24e4a3['message']));});});};
\ No newline at end of file
+var _0xe5e0=['result','catch','GetMemberReport','findAll','options','raw','attributes','limit','include','map','model','CreateMemberReport','MemberReport','UpdateMemberReport','update','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x3e0aa1,_0xdaf360){_0x3e0aa1=_0x3e0aa1-0x0;var _0x4b1470=_0xe5e0[_0x3e0aa1];return _0x4b1470;};'use strict';var _=require(_0x0e5e('0x0'));var util=require(_0x0e5e('0x1'));var moment=require(_0x0e5e('0x2'));var BPromise=require(_0x0e5e('0x3'));var rs=require(_0x0e5e('0x4'));var fs=require('fs');var Redis=require(_0x0e5e('0x5'));var db=require(_0x0e5e('0x6'))['db'];var utils=require(_0x0e5e('0x7'));var logger=require(_0x0e5e('0x8'))('rpc');var config=require(_0x0e5e('0x9'));var jayson=require(_0x0e5e('0xa'));var client=jayson[_0x0e5e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9800,_0x437362,_0x827738){return new BPromise(function(_0x4093cc,_0x6eba1c){return client[_0x0e5e('0xc')](_0x4b9800,_0x827738)[_0x0e5e('0xd')](function(_0x4b8feb){logger['info']('MemberReport,\x20%s,\x20%s',_0x437362,_0x0e5e('0xe'));logger[_0x0e5e('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x437362,'request\x20sent',JSON[_0x0e5e('0x10')](_0x4b8feb));if(_0x4b8feb[_0x0e5e('0x11')]){if(_0x4b8feb[_0x0e5e('0x11')][_0x0e5e('0x12')]===0x1f4){logger['error'](_0x0e5e('0x13'),_0x437362,_0x4b8feb[_0x0e5e('0x11')]['message']);return _0x6eba1c(_0x4b8feb[_0x0e5e('0x11')][_0x0e5e('0x14')]);}logger[_0x0e5e('0x11')]('MemberReport,\x20%s,\x20%s',_0x437362,_0x4b8feb[_0x0e5e('0x11')][_0x0e5e('0x14')]);return _0x4093cc(_0x4b8feb[_0x0e5e('0x11')][_0x0e5e('0x14')]);}else{logger[_0x0e5e('0x15')](_0x0e5e('0x13'),_0x437362,'request\x20sent');_0x4093cc(_0x4b8feb[_0x0e5e('0x16')][_0x0e5e('0x14')]);}})[_0x0e5e('0x17')](function(_0x245920){logger[_0x0e5e('0x11')]('MemberReport,\x20%s,\x20%s',_0x437362,_0x245920);_0x6eba1c(_0x245920);});});}exports[_0x0e5e('0x18')]=function(_0x2efa7f){var _0x4bfc60=this;return new Promise(function(_0x29597b,_0x3fd280){return db['MemberReport'][_0x0e5e('0x19')]({'raw':_0x2efa7f[_0x0e5e('0x1a')]?_0x2efa7f['options'][_0x0e5e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2efa7f[_0x0e5e('0x1a')]?_0x2efa7f[_0x0e5e('0x1a')]['where']||null:null,'attributes':_0x2efa7f['options']?_0x2efa7f[_0x0e5e('0x1a')][_0x0e5e('0x1c')]||null:null,'limit':_0x2efa7f[_0x0e5e('0x1a')]?_0x2efa7f[_0x0e5e('0x1a')][_0x0e5e('0x1d')]||null:null,'include':_0x2efa7f[_0x0e5e('0x1a')]?_0x2efa7f[_0x0e5e('0x1a')][_0x0e5e('0x1e')]?_[_0x0e5e('0x1f')](_0x2efa7f[_0x0e5e('0x1a')]['include'],function(_0x742ee8){return{'model':db[_0x742ee8[_0x0e5e('0x20')]],'as':_0x742ee8['as'],'attributes':_0x742ee8[_0x0e5e('0x1c')],'include':_0x742ee8[_0x0e5e('0x1e')]?_[_0x0e5e('0x1f')](_0x742ee8[_0x0e5e('0x1e')],function(_0x46cbd7){return{'model':db[_0x46cbd7['model']],'as':_0x46cbd7['as'],'attributes':_0x46cbd7[_0x0e5e('0x1c')],'include':_0x46cbd7['include']?_[_0x0e5e('0x1f')](_0x46cbd7[_0x0e5e('0x1e')],function(_0x5e3a60){return{'model':db[_0x5e3a60[_0x0e5e('0x20')]],'as':_0x5e3a60['as'],'attributes':_0x5e3a60[_0x0e5e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0e5e('0xd')](function(_0x563870){logger[_0x0e5e('0x15')]('GetMemberReport',_0x2efa7f);logger[_0x0e5e('0xf')](_0x0e5e('0x18'),_0x2efa7f,JSON[_0x0e5e('0x10')](_0x563870));_0x29597b(_0x563870);})['catch'](function(_0x38930f){logger[_0x0e5e('0x11')](_0x0e5e('0x18'),_0x38930f[_0x0e5e('0x14')],_0x2efa7f);_0x3fd280(_0x4bfc60[_0x0e5e('0x11')](0x1f4,_0x38930f[_0x0e5e('0x14')]));});});};exports[_0x0e5e('0x21')]=function(_0x4ca32e){var _0x34455b=this;return new Promise(function(_0x43a2be,_0x2c7dff){return db[_0x0e5e('0x22')]['create'](_0x4ca32e['body'],{'raw':_0x4ca32e['options']?_0x4ca32e['options'][_0x0e5e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x44b4e7){logger[_0x0e5e('0x15')](_0x0e5e('0x21'),_0x4ca32e);logger['debug'](_0x0e5e('0x21'),_0x4ca32e,JSON['stringify'](_0x44b4e7));_0x43a2be(_0x44b4e7);})['catch'](function(_0x1fc5c5){logger[_0x0e5e('0x11')](_0x0e5e('0x21'),_0x1fc5c5[_0x0e5e('0x14')],_0x4ca32e);_0x2c7dff(_0x34455b[_0x0e5e('0x11')](0x1f4,_0x1fc5c5['message']));});});};exports[_0x0e5e('0x23')]=function(_0x3621c9){var _0x308f4d=this;return new Promise(function(_0x1744d9,_0x38871b){return db[_0x0e5e('0x22')][_0x0e5e('0x24')](_0x3621c9[_0x0e5e('0x25')],{'raw':_0x3621c9[_0x0e5e('0x1a')]?_0x3621c9['options'][_0x0e5e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3621c9[_0x0e5e('0x1a')]?_0x3621c9[_0x0e5e('0x1a')][_0x0e5e('0x26')]||null:null,'attributes':_0x3621c9['options']?_0x3621c9[_0x0e5e('0x1a')]['attributes']||null:null,'limit':_0x3621c9[_0x0e5e('0x1a')]?_0x3621c9[_0x0e5e('0x1a')][_0x0e5e('0x1d')]||null:null})['then'](function(_0x471b0f){logger[_0x0e5e('0x15')](_0x0e5e('0x23'),_0x3621c9);logger['debug']('UpdateMemberReport',_0x3621c9,JSON[_0x0e5e('0x10')](_0x471b0f));_0x1744d9(_0x471b0f);})[_0x0e5e('0x17')](function(_0x3a962c){logger['error'](_0x0e5e('0x23'),_0x3a962c[_0x0e5e('0x14')],_0x3621c9);_0x38871b(_0x308f4d[_0x0e5e('0x11')](0x1f4,_0x3a962c[_0x0e5e('0x14')]));});});};
\ No newline at end of file
index cb91aea..38f3a28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd2a3=['fs-extra','../../config/environment','index','exports','multer','util','connect-timeout','express','Router'];(function(_0x175696,_0x1b5b89){var _0xd46f05=function(_0xfa562f){while(--_0xfa562f){_0x175696['push'](_0x175696['shift']());}};_0xd46f05(++_0x1b5b89);}(_0xd2a3,0x12d));var _0x3d2a=function(_0x29dd1c,_0x6f8a18){_0x29dd1c=_0x29dd1c-0x0;var _0x2aca13=_0xd2a3[_0x29dd1c];return _0x2aca13;};'use strict';var multer=require(_0x3d2a('0x0'));var util=require(_0x3d2a('0x1'));var path=require('path');var timeout=require(_0x3d2a('0x2'));var express=require(_0x3d2a('0x3'));var router=express[_0x3d2a('0x4')]();var fs_extra=require(_0x3d2a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d2a('0x6'));var controller=require('./migration.controller');router['get']('/',controller[_0x3d2a('0x7')]);module[_0x3d2a('0x8')]=router;
\ No newline at end of file
+var _0xa482=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express'];(function(_0x13b9e9,_0x1d7b9f){var _0xff84d7=function(_0x3b61ba){while(--_0x3b61ba){_0x13b9e9['push'](_0x13b9e9['shift']());}};_0xff84d7(++_0x1d7b9f);}(_0xa482,0x181));var _0x2a48=function(_0x3749b1,_0x4a6576){_0x3749b1=_0x3749b1-0x0;var _0xd86177=_0xa482[_0x3749b1];return _0xd86177;};'use strict';var multer=require(_0x2a48('0x0'));var util=require(_0x2a48('0x1'));var path=require(_0x2a48('0x2'));var timeout=require(_0x2a48('0x3'));var express=require(_0x2a48('0x4'));var router=express[_0x2a48('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2a48('0x6'));var interaction=require(_0x2a48('0x7'));var config=require(_0x2a48('0x8'));var controller=require(_0x2a48('0x9'));router[_0x2a48('0xa')]('/',controller[_0x2a48('0xb')]);module[_0x2a48('0xc')]=router;
\ No newline at end of file
index 0cf8ee2..00189b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc840=['sequelize'];(function(_0x496818,_0x1f9889){var _0x19b7f2=function(_0x1c4624){while(--_0x1c4624){_0x496818['push'](_0x496818['shift']());}};_0x19b7f2(++_0x1f9889);}(_0xc840,0x189));var _0x0c84=function(_0x44a80f,_0x159447){_0x44a80f=_0x44a80f-0x0;var _0x3bc114=_0xc840[_0x44a80f];return _0x3bc114;};'use strict';var Sequelize=require(_0x0c84('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}};
\ No newline at end of file
+var _0x2d7a=['STRING','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d7a,0x104));var _0xa2d7=function(_0x5c80b7,_0x5c6250){_0x5c80b7=_0x5c80b7-0x0;var _0x4a20a7=_0x2d7a[_0x5c80b7];return _0x4a20a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xa2d7('0x0')],'unique':_0xa2d7('0x1')}};
\ No newline at end of file
index de47b57..6088d4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf6a=['type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','Migration'];(function(_0x227cfb,_0x4f42cf){var _0x131407=function(_0x37ddbb){while(--_0x37ddbb){_0x227cfb['push'](_0x227cfb['shift']());}};_0x131407(++_0x4f42cf);}(_0xaf6a,0x1e4));var _0xaaf6=function(_0x434ab8,_0x164e29){_0x434ab8=_0x434ab8-0x0;var _0x4173a2=_0xaf6a[_0x434ab8];return _0x4173a2;};'use strict';var emlformat=require(_0xaaf6('0x0'));var rimraf=require(_0xaaf6('0x1'));var zipdir=require(_0xaaf6('0x2'));var jsonpatch=require(_0xaaf6('0x3'));var rp=require('request-promise');var moment=require(_0xaaf6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaaf6('0x5'));var util=require(_0xaaf6('0x6'));var path=require(_0xaaf6('0x7'));var sox=require('sox');var csv=require(_0xaaf6('0x8'));var ejs=require(_0xaaf6('0x9'));var fs=require('fs');var fs_extra=require(_0xaaf6('0xa'));var _=require(_0xaaf6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaaf6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaaf6('0xd'));var Papa=require(_0xaaf6('0xe'));var Redis=require(_0xaaf6('0xf'));var authService=require(_0xaaf6('0x10'));var qs=require(_0xaaf6('0x11'));var as=require(_0xaaf6('0x12'));var hardwareService=require(_0xaaf6('0x13'));var logger=require(_0xaaf6('0x14'))('api');var utils=require(_0xaaf6('0x15'));var config=require(_0xaaf6('0x16'));var licenseUtil=require(_0xaaf6('0x17'));var db=require(_0xaaf6('0x18'))['db'];function respondWithStatusCode(_0x593e5c,_0xcbb0e8){_0xcbb0e8=_0xcbb0e8||0xcc;return function(_0x3bc7c3){if(_0x3bc7c3){return _0x593e5c[_0xaaf6('0x19')](_0xcbb0e8);}return _0x593e5c[_0xaaf6('0x1a')](_0xcbb0e8)['end']();};}function respondWithResult(_0x5324bd,_0x582fe7){_0x582fe7=_0x582fe7||0xc8;return function(_0x35c11c){if(_0x35c11c){return _0x5324bd['status'](_0x582fe7)[_0xaaf6('0x1b')](_0x35c11c);}};}function respondWithFilteredResult(_0x2bd49c,_0x53aec5){return function(_0x314d86){if(_0x314d86){var _0x1ad1f6=typeof _0x53aec5[_0xaaf6('0x1c')]==='undefined'&&typeof _0x53aec5[_0xaaf6('0x1d')]===_0xaaf6('0x1e');var _0x239ade=_0x314d86['count'];var _0x8a2871=_0x1ad1f6?0x0:_0x53aec5['offset'];var _0x1c1c41=_0x1ad1f6?_0x314d86[_0xaaf6('0x1f')]:_0x53aec5[_0xaaf6('0x1c')]+_0x53aec5[_0xaaf6('0x1d')];var _0x1c0693;if(_0x1c1c41>=_0x239ade){_0x1c1c41=_0x239ade;_0x1c0693=0xc8;}else{_0x1c0693=0xce;}_0x2bd49c[_0xaaf6('0x1a')](_0x1c0693);return _0x2bd49c['set'](_0xaaf6('0x20'),_0x8a2871+'-'+_0x1c1c41+'/'+_0x239ade)[_0xaaf6('0x1b')](_0x314d86);}return null;};}function patchUpdates(_0x4a8219){return function(_0x7e5696){try{jsonpatch[_0xaaf6('0x21')](_0x7e5696,_0x4a8219,!![]);}catch(_0x2fdf82){return BPromise[_0xaaf6('0x22')](_0x2fdf82);}return _0x7e5696[_0xaaf6('0x23')]();};}function saveUpdates(_0x5d0a71,_0x2d36f7){return function(_0x52b389){if(_0x52b389){return _0x52b389['update'](_0x5d0a71)['then'](function(_0x380d3f){return _0x380d3f;});}return null;};}function removeEntity(_0x3fc566,_0x7f5059){return function(_0x5a65a5){if(_0x5a65a5){return _0x5a65a5[_0xaaf6('0x24')]()[_0xaaf6('0x25')](function(){_0x3fc566[_0xaaf6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6e20,_0x540b6f){return function(_0x38ad6e){if(!_0x38ad6e){_0x1a6e20[_0xaaf6('0x19')](0x194);}return _0x38ad6e;};}function handleError(_0x3a7420,_0x11a269){_0x11a269=_0x11a269||0x1f4;return function(_0xb10336){logger[_0xaaf6('0x26')](_0xb10336[_0xaaf6('0x27')]);if(_0xb10336[_0xaaf6('0x28')]){delete _0xb10336['name'];}_0x3a7420[_0xaaf6('0x1a')](_0x11a269)[_0xaaf6('0x29')](_0xb10336);};}exports[_0xaaf6('0x2a')]=function(_0x171b8c,_0x36cf85){var _0x598540={},_0x2ff345={},_0xbefece={'count':0x0,'rows':[]};var _0x3f5521=_['map'](db[_0xaaf6('0x2b')]['rawAttributes'],function(_0xc94412){return{'name':_0xc94412['fieldName'],'type':_0xc94412[_0xaaf6('0x2c')][_0xaaf6('0x2d')]};});_0x2ff345[_0xaaf6('0x2e')]=_[_0xaaf6('0x2f')](_0x3f5521,_0xaaf6('0x28'));_0x2ff345[_0xaaf6('0x30')]=_[_0xaaf6('0x31')](_0x171b8c['query']);_0x2ff345['filters']=_[_0xaaf6('0x32')](_0x2ff345[_0xaaf6('0x2e')],_0x2ff345[_0xaaf6('0x30')]);_0x598540['attributes']=_[_0xaaf6('0x32')](_0x2ff345[_0xaaf6('0x2e')],qs[_0xaaf6('0x33')](_0x171b8c[_0xaaf6('0x30')][_0xaaf6('0x33')]));_0x598540['attributes']=_0x598540[_0xaaf6('0x34')][_0xaaf6('0x35')]?_0x598540[_0xaaf6('0x34')]:_0x2ff345[_0xaaf6('0x2e')];if(!_0x171b8c[_0xaaf6('0x30')][_0xaaf6('0x36')]('nolimit')){_0x598540[_0xaaf6('0x1d')]=qs[_0xaaf6('0x1d')](_0x171b8c[_0xaaf6('0x30')][_0xaaf6('0x1d')]);_0x598540['offset']=qs[_0xaaf6('0x1c')](_0x171b8c['query'][_0xaaf6('0x1c')]);}_0x598540[_0xaaf6('0x37')]=qs['sort'](_0x171b8c[_0xaaf6('0x30')]['sort']);_0x598540[_0xaaf6('0x38')]=qs[_0xaaf6('0x39')](_[_0xaaf6('0x3a')](_0x171b8c[_0xaaf6('0x30')],_0x2ff345['filters']),_0x3f5521);if(_0x171b8c[_0xaaf6('0x30')][_0xaaf6('0x3b')]){_0x598540[_0xaaf6('0x38')]=_['merge'](_0x598540[_0xaaf6('0x38')],{'$or':_[_0xaaf6('0x2f')](_0x3f5521,function(_0x17a21c){if(_0x17a21c[_0xaaf6('0x2c')]!==_0xaaf6('0x3c')){var _0xc2967d={};_0xc2967d[_0x17a21c[_0xaaf6('0x28')]]={'$like':'%'+_0x171b8c['query']['filter']+'%'};return _0xc2967d;}})});}_0x598540=_['merge']({},_0x598540,_0x171b8c[_0xaaf6('0x3d')]);var _0x3bbe7b={'where':_0x598540['where']};return db[_0xaaf6('0x2b')][_0xaaf6('0x1f')](_0x3bbe7b)[_0xaaf6('0x25')](function(_0xb88996){_0xbefece['count']=_0xb88996;if(_0x171b8c[_0xaaf6('0x30')][_0xaaf6('0x3e')]){_0x598540[_0xaaf6('0x3f')]=[{'all':!![]}];}return db[_0xaaf6('0x2b')]['findAll'](_0x598540);})[_0xaaf6('0x25')](function(_0x226f3e){_0xbefece[_0xaaf6('0x40')]=_0x226f3e;return _0xbefece;})[_0xaaf6('0x25')](respondWithFilteredResult(_0x36cf85,_0x598540))[_0xaaf6('0x41')](handleError(_0x36cf85,null));};
\ No newline at end of file
+var _0x3590=['count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','send','index','Migration','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','where','pick','filter','map','VIRTUAL','merge','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x3590,0x130));var _0x0359=function(_0x46979b,_0x1a80da){_0x46979b=_0x46979b-0x0;var _0x19785a=_0x3590[_0x46979b];return _0x19785a;};'use strict';var emlformat=require(_0x0359('0x0'));var rimraf=require(_0x0359('0x1'));var zipdir=require(_0x0359('0x2'));var jsonpatch=require(_0x0359('0x3'));var rp=require(_0x0359('0x4'));var moment=require(_0x0359('0x5'));var BPromise=require(_0x0359('0x6'));var Mustache=require('mustache');var util=require(_0x0359('0x7'));var path=require(_0x0359('0x8'));var sox=require(_0x0359('0x9'));var csv=require(_0x0359('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0359('0xb'));var _=require(_0x0359('0xc'));var squel=require(_0x0359('0xd'));var crypto=require(_0x0359('0xe'));var jsforce=require(_0x0359('0xf'));var deskjs=require(_0x0359('0x10'));var toCsv=require(_0x0359('0xa'));var querystring=require('querystring');var Papa=require(_0x0359('0x11'));var Redis=require(_0x0359('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0359('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0359('0x14'))(_0x0359('0x15'));var utils=require(_0x0359('0x16'));var config=require(_0x0359('0x17'));var licenseUtil=require(_0x0359('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509c1b,_0x260cd3){_0x260cd3=_0x260cd3||0xcc;return function(_0x412a04){if(_0x412a04){return _0x509c1b[_0x0359('0x19')](_0x260cd3);}return _0x509c1b[_0x0359('0x1a')](_0x260cd3)[_0x0359('0x1b')]();};}function respondWithResult(_0x245b25,_0x30bd3d){_0x30bd3d=_0x30bd3d||0xc8;return function(_0x49fd9c){if(_0x49fd9c){return _0x245b25[_0x0359('0x1a')](_0x30bd3d)[_0x0359('0x1c')](_0x49fd9c);}};}function respondWithFilteredResult(_0x2e1fd9,_0x54314e){return function(_0x553574){if(_0x553574){var _0x266747=typeof _0x54314e[_0x0359('0x1d')]===_0x0359('0x1e')&&typeof _0x54314e['limit']===_0x0359('0x1e');var _0x928fcd=_0x553574[_0x0359('0x1f')];var _0x48bc91=_0x266747?0x0:_0x54314e[_0x0359('0x1d')];var _0x245a2d=_0x266747?_0x553574['count']:_0x54314e[_0x0359('0x1d')]+_0x54314e[_0x0359('0x20')];var _0x4bdbc4;if(_0x245a2d>=_0x928fcd){_0x245a2d=_0x928fcd;_0x4bdbc4=0xc8;}else{_0x4bdbc4=0xce;}_0x2e1fd9['status'](_0x4bdbc4);return _0x2e1fd9[_0x0359('0x21')](_0x0359('0x22'),_0x48bc91+'-'+_0x245a2d+'/'+_0x928fcd)['json'](_0x553574);}return null;};}function patchUpdates(_0xf85f49){return function(_0x5d7021){try{jsonpatch[_0x0359('0x23')](_0x5d7021,_0xf85f49,!![]);}catch(_0x5903c0){return BPromise[_0x0359('0x24')](_0x5903c0);}return _0x5d7021['save']();};}function saveUpdates(_0x237e9e,_0xf27df5){return function(_0x2f290e){if(_0x2f290e){return _0x2f290e[_0x0359('0x25')](_0x237e9e)[_0x0359('0x26')](function(_0x4a82b6){return _0x4a82b6;});}return null;};}function removeEntity(_0x2c6852,_0x1a002a){return function(_0x1cd14f){if(_0x1cd14f){return _0x1cd14f[_0x0359('0x27')]()[_0x0359('0x26')](function(){_0x2c6852[_0x0359('0x1a')](0xcc)[_0x0359('0x1b')]();});}};}function handleEntityNotFound(_0x794d2,_0xcdfb3e){return function(_0x28244c){if(!_0x28244c){_0x794d2[_0x0359('0x19')](0x194);}return _0x28244c;};}function handleError(_0x4ad6fd,_0x48c7b8){_0x48c7b8=_0x48c7b8||0x1f4;return function(_0x50cc01){logger['error'](_0x50cc01[_0x0359('0x28')]);if(_0x50cc01['name']){delete _0x50cc01['name'];}_0x4ad6fd[_0x0359('0x1a')](_0x48c7b8)[_0x0359('0x29')](_0x50cc01);};}exports[_0x0359('0x2a')]=function(_0x13cca3,_0x535b72){var _0x3486df={},_0x117773={},_0x37119d={'count':0x0,'rows':[]};var _0x12d3cd=_['map'](db[_0x0359('0x2b')][_0x0359('0x2c')],function(_0x3531d7){return{'name':_0x3531d7[_0x0359('0x2d')],'type':_0x3531d7[_0x0359('0x2e')]['key']};});_0x117773[_0x0359('0x2f')]=_['map'](_0x12d3cd,_0x0359('0x30'));_0x117773[_0x0359('0x31')]=_[_0x0359('0x32')](_0x13cca3[_0x0359('0x31')]);_0x117773[_0x0359('0x33')]=_['intersection'](_0x117773['model'],_0x117773['query']);_0x3486df[_0x0359('0x34')]=_[_0x0359('0x35')](_0x117773['model'],qs['fields'](_0x13cca3[_0x0359('0x31')]['fields']));_0x3486df['attributes']=_0x3486df[_0x0359('0x34')]['length']?_0x3486df[_0x0359('0x34')]:_0x117773['model'];if(!_0x13cca3[_0x0359('0x31')][_0x0359('0x36')](_0x0359('0x37'))){_0x3486df['limit']=qs[_0x0359('0x20')](_0x13cca3[_0x0359('0x31')][_0x0359('0x20')]);_0x3486df[_0x0359('0x1d')]=qs['offset'](_0x13cca3[_0x0359('0x31')][_0x0359('0x1d')]);}_0x3486df[_0x0359('0x38')]=qs['sort'](_0x13cca3['query']['sort']);_0x3486df[_0x0359('0x39')]=qs['filters'](_[_0x0359('0x3a')](_0x13cca3['query'],_0x117773[_0x0359('0x33')]),_0x12d3cd);if(_0x13cca3['query'][_0x0359('0x3b')]){_0x3486df[_0x0359('0x39')]=_['merge'](_0x3486df[_0x0359('0x39')],{'$or':_[_0x0359('0x3c')](_0x12d3cd,function(_0x2a591a){if(_0x2a591a[_0x0359('0x2e')]!==_0x0359('0x3d')){var _0x5bc136={};_0x5bc136[_0x2a591a[_0x0359('0x30')]]={'$like':'%'+_0x13cca3[_0x0359('0x31')][_0x0359('0x3b')]+'%'};return _0x5bc136;}})});}_0x3486df=_[_0x0359('0x3e')]({},_0x3486df,_0x13cca3['options']);var _0x14d215={'where':_0x3486df[_0x0359('0x39')]};return db[_0x0359('0x2b')][_0x0359('0x1f')](_0x14d215)[_0x0359('0x26')](function(_0x22bdc6){_0x37119d[_0x0359('0x1f')]=_0x22bdc6;if(_0x13cca3[_0x0359('0x31')][_0x0359('0x3f')]){_0x3486df['include']=[{'all':!![]}];}return db[_0x0359('0x2b')][_0x0359('0x40')](_0x3486df);})[_0x0359('0x26')](function(_0x9d97f7){_0x37119d[_0x0359('0x41')]=_0x9d97f7;return _0x37119d;})[_0x0359('0x26')](respondWithFilteredResult(_0x535b72,_0x3486df))[_0x0359('0x42')](handleError(_0x535b72,null));};
\ No newline at end of file
index 884dbec..a2a3e3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddf1=['define','Migration','lodash','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4ea6b7,_0x51567e){var _0x3aaca2=function(_0x33fe21){while(--_0x33fe21){_0x4ea6b7['push'](_0x4ea6b7['shift']());}};_0x3aaca2(++_0x51567e);}(_0xddf1,0xda));var _0x1ddf=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xddf1[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x1ddf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ddf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ddf('0x2'));var fs=require('fs');var path=require(_0x1ddf('0x3'));var rimraf=require(_0x1ddf('0x4'));var config=require(_0x1ddf('0x5'));var attributes=require('./migration.attributes');module[_0x1ddf('0x6')]=function(_0x54194c,_0x343697){return _0x54194c[_0x1ddf('0x7')](_0x1ddf('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x06f5=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger'];(function(_0x106343,_0x4526d6){var _0x59bf6b=function(_0x392792){while(--_0x392792){_0x106343['push'](_0x106343['shift']());}};_0x59bf6b(++_0x4526d6);}(_0x06f5,0x76));var _0x506f=function(_0x141d07,_0x2bb46b){_0x141d07=_0x141d07-0x0;var _0x18d21f=_0x06f5[_0x141d07];return _0x18d21f;};'use strict';var _=require(_0x506f('0x0'));var util=require('util');var logger=require(_0x506f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x506f('0x2'));var rp=require(_0x506f('0x3'));var fs=require('fs');var path=require(_0x506f('0x4'));var rimraf=require(_0x506f('0x5'));var config=require(_0x506f('0x6'));var attributes=require(_0x506f('0x7'));module[_0x506f('0x8')]=function(_0x4fbe79,_0x34c352){return _0x4fbe79[_0x506f('0x9')](_0x506f('0xa'),attributes,{'tableName':_0x506f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8a05c38..c8e76e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf290=['message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf290,0xde));var _0x0f29=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xf290[_0x2e5f9c];return _0x538b44;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Migration,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}
\ No newline at end of file
+var _0x35ff=['request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4320f2,_0x5c05a3){var _0x292332=function(_0x3bdea9){while(--_0x3bdea9){_0x4320f2['push'](_0x4320f2['shift']());}};_0x292332(++_0x5c05a3);}(_0x35ff,0xb3));var _0xf35f=function(_0x17f58f,_0x43cdc4){_0x17f58f=_0x17f58f-0x0;var _0x50de75=_0x35ff[_0x17f58f];return _0x50de75;};'use strict';var _=require('lodash');var util=require(_0xf35f('0x0'));var moment=require(_0xf35f('0x1'));var BPromise=require('bluebird');var rs=require(_0xf35f('0x2'));var fs=require('fs');var Redis=require(_0xf35f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf35f('0x4'));var logger=require('../../config/logger')(_0xf35f('0x5'));var config=require(_0xf35f('0x6'));var jayson=require(_0xf35f('0x7'));var client=jayson[_0xf35f('0x8')][_0xf35f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4321e9,_0x58144a,_0x3e3aaa){return new BPromise(function(_0x1922af,_0x37df94){return client[_0xf35f('0xa')](_0x4321e9,_0x3e3aaa)['then'](function(_0x406771){logger[_0xf35f('0xb')](_0xf35f('0xc'),_0x58144a,_0xf35f('0xd'));logger[_0xf35f('0xe')](_0xf35f('0xf'),_0x58144a,_0xf35f('0xd'),JSON['stringify'](_0x406771));if(_0x406771[_0xf35f('0x10')]){if(_0x406771[_0xf35f('0x10')][_0xf35f('0x11')]===0x1f4){logger[_0xf35f('0x10')](_0xf35f('0xc'),_0x58144a,_0x406771[_0xf35f('0x10')][_0xf35f('0x12')]);return _0x37df94(_0x406771[_0xf35f('0x10')]['message']);}logger[_0xf35f('0x10')]('Migration,\x20%s,\x20%s',_0x58144a,_0x406771[_0xf35f('0x10')][_0xf35f('0x12')]);return _0x1922af(_0x406771['error'][_0xf35f('0x12')]);}else{logger[_0xf35f('0xb')](_0xf35f('0xc'),_0x58144a,_0xf35f('0xd'));_0x1922af(_0x406771[_0xf35f('0x13')]['message']);}})[_0xf35f('0x14')](function(_0x3e400b){logger[_0xf35f('0x10')](_0xf35f('0xc'),_0x58144a,_0x3e400b);_0x37df94(_0x3e400b);});});}
\ No newline at end of file
index 0bbb5cb..fcf8cd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe353=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','exports'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xe353,0xdc));var _0x3e35=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe353[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0x3e35('0x0'));var path=require(_0x3e35('0x1'));var timeout=require(_0x3e35('0x2'));var express=require(_0x3e35('0x3'));var router=express[_0x3e35('0x4')]();var fs_extra=require(_0x3e35('0x5'));var auth=require(_0x3e35('0x6'));var interaction=require(_0x3e35('0x7'));var config=require(_0x3e35('0x8'));var controller=require(_0x3e35('0x9'));router[_0x3e35('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e35('0xb')]);router[_0x3e35('0xa')](_0x3e35('0xc'),auth['isAuthenticated'](),controller[_0x3e35('0xd')]);router['post']('/',auth[_0x3e35('0xe')](),controller[_0x3e35('0xf')]);router[_0x3e35('0x10')](_0x3e35('0xc'),auth[_0x3e35('0xe')](),controller[_0x3e35('0x11')]);router[_0x3e35('0x12')](_0x3e35('0xc'),auth[_0x3e35('0xe')](),controller['destroy']);module[_0x3e35('0x13')]=router;
\ No newline at end of file
+var _0x4351=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','create','put','/:id','delete','exports'];(function(_0x5664b0,_0x1ebb39){var _0x22ea5a=function(_0x1bc4ea){while(--_0x1bc4ea){_0x5664b0['push'](_0x5664b0['shift']());}};_0x22ea5a(++_0x1ebb39);}(_0x4351,0x1b5));var _0x1435=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x4351[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var path=require(_0x1435('0x2'));var timeout=require(_0x1435('0x3'));var express=require(_0x1435('0x4'));var router=express[_0x1435('0x5')]();var fs_extra=require(_0x1435('0x6'));var auth=require(_0x1435('0x7'));var interaction=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var controller=require(_0x1435('0xa'));router[_0x1435('0xb')]('/',auth[_0x1435('0xc')](),controller[_0x1435('0xd')]);router[_0x1435('0xb')]('/:id',auth[_0x1435('0xc')](),controller['show']);router['post']('/',auth[_0x1435('0xc')](),controller[_0x1435('0xe')]);router[_0x1435('0xf')](_0x1435('0x10'),auth[_0x1435('0xc')](),controller['update']);router[_0x1435('0x11')](_0x1435('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1435('0x12')]=router;
\ No newline at end of file
index 0ce81f5..5f0e838 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0f7=['STRING','exports','localnet','externip','turn'];(function(_0x3e2896,_0x1da662){var _0x4817fe=function(_0x5b12e2){while(--_0x5b12e2){_0x3e2896['push'](_0x3e2896['shift']());}};_0x4817fe(++_0x1da662);}(_0xd0f7,0x10a));var _0x7d0f=function(_0x599ccc,_0x2387b3){_0x599ccc=_0x599ccc-0x0;var _0xaf9d41=_0xd0f7[_0x599ccc];return _0xaf9d41;};'use strict';var Sequelize=require('sequelize');module[_0x7d0f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7d0f('0x1'),_0x7d0f('0x2'),'stun',_0x7d0f('0x3'))},'value':{'type':Sequelize[_0x7d0f('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7d0f('0x4')]}};
\ No newline at end of file
+var _0x4b69=['stun','turn','STRING','exports','ENUM','localnet','externip'];(function(_0x44143e,_0x2051f3){var _0x4ea47c=function(_0x262f78){while(--_0x262f78){_0x44143e['push'](_0x44143e['shift']());}};_0x4ea47c(++_0x2051f3);}(_0x4b69,0x114));var _0x94b6=function(_0x4d120d,_0x55a2c9){_0x4d120d=_0x4d120d-0x0;var _0x12b156=_0x4b69[_0x4d120d];return _0x12b156;};'use strict';var Sequelize=require('sequelize');module[_0x94b6('0x0')]={'type':{'type':Sequelize[_0x94b6('0x1')](_0x94b6('0x2'),_0x94b6('0x3'),_0x94b6('0x4'),_0x94b6('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x94b6('0x6')]},'password':{'type':Sequelize[_0x94b6('0x6')]}};
\ No newline at end of file
index ca15e2e..4b01512 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd408=['Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','format','toLowerCase','util','path','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17a3c0,_0x5d7db1){var _0x1d537d=function(_0x3140c2){while(--_0x3140c2){_0x17a3c0['push'](_0x17a3c0['shift']());}};_0x1d537d(++_0x5d7db1);}(_0xd408,0x96));var _0x8d40=function(_0x4ee140,_0xddce08){_0x4ee140=_0x4ee140-0x0;var _0x1c14bd=_0xd408[_0x4ee140];return _0x1c14bd;};'use strict';var util=require(_0x8d40('0x0'));var path=require(_0x8d40('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d40('0x2'));var qs=require(_0x8d40('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x8d40('0x4'));var db=require(_0x8d40('0x5'))['db'];var jayson=require(_0x8d40('0x6'));var client=jayson[_0x8d40('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1290ff,_0x59f6c0,_0x3f7899,_0x4c94dd){return new Promise(function(_0x42beae,_0xc43a7f){var _0x1a3421=_0x4c94dd||client;return _0x1a3421[_0x8d40('0x8')](_0x1290ff,_0x3f7899)[_0x8d40('0x9')](function(_0x45245a){logger[_0x8d40('0xa')](_0x8d40('0xb'),_0x59f6c0,_0x8d40('0xc'));logger[_0x8d40('0xd')](_0x8d40('0xe'),_0x59f6c0,_0x8d40('0xc'),JSON[_0x8d40('0xf')](_0x45245a));if(_0x45245a[_0x8d40('0x10')]){if(_0x45245a['error']['code']===0x1f4){logger[_0x8d40('0x10')](_0x8d40('0xb'),_0x59f6c0,_0x45245a[_0x8d40('0x10')][_0x8d40('0x11')]);return _0xc43a7f(_0x45245a['error'][_0x8d40('0x11')]);}logger[_0x8d40('0x10')]('Network,\x20%s,\x20%s',_0x59f6c0,_0x45245a[_0x8d40('0x10')][_0x8d40('0x11')]);return _0x42beae(_0x45245a[_0x8d40('0x10')][_0x8d40('0x11')]);}else{logger[_0x8d40('0xa')](_0x8d40('0xb'),_0x59f6c0,_0x8d40('0xc'));_0x42beae(_0x45245a[_0x8d40('0x12')]['message']);}})['catch'](function(_0xe71ea3){logger['error'](_0x8d40('0xb'),_0x59f6c0,_0xe71ea3);_0xc43a7f(_0xe71ea3);});});}function respondWithResult(_0x45f0ff,_0x467261){_0x467261=_0x467261||0xc8;return function(_0x2f96e0){if(_0x2f96e0){return _0x45f0ff[_0x8d40('0x13')](_0x467261)[_0x8d40('0x14')](_0x2f96e0);}};}function respondWithFilteredResult(_0x5516d0,_0x104e76){return function(_0x4bbb36){if(_0x4bbb36){var _0x5a9d18=typeof _0x104e76[_0x8d40('0x15')]===_0x8d40('0x16')&&typeof _0x104e76[_0x8d40('0x17')]===_0x8d40('0x16');var _0x49042a=_0x4bbb36[_0x8d40('0x18')];var _0x171080=_0x5a9d18?0x0:_0x104e76[_0x8d40('0x15')];var _0x395de3=_0x5a9d18?_0x4bbb36[_0x8d40('0x18')]:_0x104e76[_0x8d40('0x15')]+_0x104e76[_0x8d40('0x17')];var _0x3e30c7;if(_0x395de3>=_0x49042a){_0x395de3=_0x49042a;_0x3e30c7=0xc8;}else{_0x3e30c7=0xce;}_0x5516d0[_0x8d40('0x13')](_0x3e30c7);return _0x5516d0[_0x8d40('0x19')](_0x8d40('0x1a'),_0x171080+'-'+_0x395de3+'/'+_0x49042a)[_0x8d40('0x14')](_0x4bbb36);}return null;};}function saveUpdates(_0xa7a271){return function(_0x1558f0){if(_0x1558f0){return _0x1558f0[_0x8d40('0x1b')](_0xa7a271)[_0x8d40('0x9')](function(_0x3dd345){return _0x3dd345;});}return null;};}function removeEntity(_0x134f3c){return function(_0x34c6c6){if(_0x34c6c6){return _0x34c6c6[_0x8d40('0x1c')]()[_0x8d40('0x9')](function(){_0x134f3c['status'](0xcc)[_0x8d40('0x1d')]();});}};}function handleEntityNotFound(_0xa0aed3){return function(_0x14b1b4){if(!_0x14b1b4){_0xa0aed3['sendStatus'](0x194);}return _0x14b1b4;};}function handleError(_0x3ea8fa,_0x4f7d07){_0x4f7d07=_0x4f7d07||0x1f4;return function(_0x1779e1){logger[_0x8d40('0x10')](_0x1779e1[_0x8d40('0x1e')]);if(_0x1779e1[_0x8d40('0x1f')]){delete _0x1779e1[_0x8d40('0x1f')];}_0x3ea8fa[_0x8d40('0x13')](_0x4f7d07)['send'](_0x1779e1);};}exports[_0x8d40('0x20')]=function(_0x2d85a4,_0x56cfde){var _0x409c4d={},_0x4f6eb6={},_0x2e952b={'count':0x0,'rows':[]};var _0xd20e29=_[_0x8d40('0x21')](db[_0x8d40('0x22')][_0x8d40('0x23')],function(_0x85fa89){return{'name':_0x85fa89[_0x8d40('0x24')],'type':_0x85fa89[_0x8d40('0x25')][_0x8d40('0x26')]};});_0x4f6eb6[_0x8d40('0x27')]=_['map'](_0xd20e29,_0x8d40('0x1f'));_0x4f6eb6[_0x8d40('0x28')]=_[_0x8d40('0x29')](_0x2d85a4[_0x8d40('0x28')]);_0x4f6eb6['filters']=_[_0x8d40('0x2a')](_0x4f6eb6[_0x8d40('0x27')],_0x4f6eb6[_0x8d40('0x28')]);_0x409c4d[_0x8d40('0x2b')]=_[_0x8d40('0x2a')](_0x4f6eb6[_0x8d40('0x27')],qs[_0x8d40('0x2c')](_0x2d85a4[_0x8d40('0x28')]['fields']));_0x409c4d[_0x8d40('0x2b')]=_0x409c4d[_0x8d40('0x2b')][_0x8d40('0x2d')]?_0x409c4d[_0x8d40('0x2b')]:_0x4f6eb6[_0x8d40('0x27')];if(!_0x2d85a4[_0x8d40('0x28')]['hasOwnProperty'](_0x8d40('0x2e'))){_0x409c4d[_0x8d40('0x17')]=qs['limit'](_0x2d85a4['query']['limit']);_0x409c4d['offset']=qs['offset'](_0x2d85a4[_0x8d40('0x28')][_0x8d40('0x15')]);}_0x409c4d[_0x8d40('0x2f')]=qs[_0x8d40('0x30')](_0x2d85a4[_0x8d40('0x28')][_0x8d40('0x30')]);_0x409c4d['where']=qs[_0x8d40('0x31')](_['pick'](_0x2d85a4[_0x8d40('0x28')],_0x4f6eb6[_0x8d40('0x31')]),_0xd20e29);if(_0x2d85a4[_0x8d40('0x28')][_0x8d40('0x32')]){_0x409c4d['where']=_[_0x8d40('0x33')](_0x409c4d[_0x8d40('0x34')],{'$or':_[_0x8d40('0x21')](_0xd20e29,function(_0x4d9b9f){if(_0x4d9b9f[_0x8d40('0x25')]!==_0x8d40('0x35')){var _0x4c562f={};_0x4c562f[_0x4d9b9f[_0x8d40('0x1f')]]={'$like':'%'+_0x2d85a4[_0x8d40('0x28')]['filter']+'%'};return _0x4c562f;}})});}_0x409c4d=_['merge']({},_0x409c4d,_0x2d85a4['options']);var _0x167213={'where':_0x409c4d[_0x8d40('0x34')]};return db[_0x8d40('0x22')]['count'](_0x167213)[_0x8d40('0x9')](function(_0x29ae66){_0x2e952b[_0x8d40('0x18')]=_0x29ae66;if(_0x2d85a4['query'][_0x8d40('0x36')]){_0x409c4d[_0x8d40('0x37')]=[{'all':!![]}];}return db[_0x8d40('0x22')][_0x8d40('0x38')](_0x409c4d);})[_0x8d40('0x9')](function(_0x131a46){_0x2e952b[_0x8d40('0x39')]=_0x131a46;return _0x2e952b;})[_0x8d40('0x9')](respondWithFilteredResult(_0x56cfde,_0x409c4d))[_0x8d40('0x3a')](handleError(_0x56cfde,null));};exports['show']=function(_0x1b23c4,_0x267325){var _0x3ddbe6={'raw':!![],'where':{'id':_0x1b23c4[_0x8d40('0x3b')]['id']}},_0x58089e={};_0x58089e[_0x8d40('0x27')]=_[_0x8d40('0x29')](db[_0x8d40('0x22')]['rawAttributes']);_0x58089e[_0x8d40('0x28')]=_[_0x8d40('0x29')](_0x1b23c4[_0x8d40('0x28')]);_0x58089e[_0x8d40('0x31')]=_[_0x8d40('0x2a')](_0x58089e[_0x8d40('0x27')],_0x58089e[_0x8d40('0x28')]);_0x3ddbe6['attributes']=_['intersection'](_0x58089e['model'],qs['fields'](_0x1b23c4['query'][_0x8d40('0x2c')]));_0x3ddbe6[_0x8d40('0x2b')]=_0x3ddbe6[_0x8d40('0x2b')][_0x8d40('0x2d')]?_0x3ddbe6[_0x8d40('0x2b')]:_0x58089e[_0x8d40('0x27')];if(_0x1b23c4[_0x8d40('0x28')][_0x8d40('0x36')]){_0x3ddbe6[_0x8d40('0x37')]=[{'all':!![]}];}_0x3ddbe6=_[_0x8d40('0x33')]({},_0x3ddbe6,_0x1b23c4['options']);return db[_0x8d40('0x22')][_0x8d40('0x3c')](_0x3ddbe6)[_0x8d40('0x9')](handleEntityNotFound(_0x267325,null))[_0x8d40('0x9')](respondWithResult(_0x267325,null))[_0x8d40('0x3a')](handleError(_0x267325,null));};exports[_0x8d40('0x3d')]=function(_0x2ba1a5,_0xbd1f00){var _0x3ee6e9;return db[_0x8d40('0x22')]['create'](_0x2ba1a5[_0x8d40('0x3e')],{'raw':!![]})[_0x8d40('0x9')](function(_0x395ea5){_0x3ee6e9=_0x395ea5;return db[_0x8d40('0x22')][_0x8d40('0x38')]({'where':{'type':_0x2ba1a5[_0x8d40('0x3e')]['type']},'raw':!![]});})['then'](function(_0x31197e){if(_0x3ee6e9[_0x8d40('0x25')][_0x8d40('0x3f')]()==_0x8d40('0x40')){var _0x2e43f1=fs[_0x8d40('0x41')](path['join'](config[_0x8d40('0x42')],_0x8d40('0x43')),_0x8d40('0x44'));var _0x4f3ac8=ejs['render'](_0x2e43f1,{'networks':_0x31197e||[]});fs[_0x8d40('0x45')](_0x8d40('0x46'),_0x4f3ac8);return respondWithRpcPromise(_0x8d40('0x47'),_0x8d40('0x3d'),{'module':_0x8d40('0x48')});}else if(_0x3ee6e9['type'][_0x8d40('0x3f')]()==_0x8d40('0x49')){var _0x48d6f3=fs[_0x8d40('0x41')](path[_0x8d40('0x4a')](config[_0x8d40('0x42')],_0x8d40('0x4b')),_0x8d40('0x44'));var _0x4e32e4=ejs[_0x8d40('0x4c')](_0x48d6f3,{'networks':_0x31197e||[]});fs[_0x8d40('0x45')](_0x8d40('0x4d'),_0x4e32e4);return respondWithRpcPromise('Reload',_0x8d40('0x3d'),{'module':_0x8d40('0x48')});}else{var _0x54df69=fs[_0x8d40('0x41')](path[_0x8d40('0x4a')](config[_0x8d40('0x42')],_0x8d40('0x4e')),_0x8d40('0x44'));var _0x336004=ejs[_0x8d40('0x4c')](_0x54df69,{'networks':_0x31197e||[]});fs[_0x8d40('0x45')](util['format'](_0x8d40('0x4f'),_0x2ba1a5[_0x8d40('0x3e')]['type']['toLowerCase']()),_0x336004);return respondWithRpcPromise(_0x8d40('0x47'),_0x8d40('0x3d'),{'module':'chan_sip.so'});}})[_0x8d40('0x9')](function(){return _0x3ee6e9;})[_0x8d40('0x9')](respondWithResult(_0xbd1f00,0xc9))[_0x8d40('0x3a')](handleError(_0xbd1f00,null));};exports[_0x8d40('0x1b')]=function(_0x3c03bd,_0x2b49eb){var _0x47ad1f;return db['Network'][_0x8d40('0x3c')]({'where':{'id':_0x3c03bd[_0x8d40('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2b49eb,null))['then'](saveUpdates(_0x3c03bd[_0x8d40('0x3e')],null))[_0x8d40('0x9')](function(_0x2b9907){if(_0x2b9907){_0x47ad1f=_0x2b9907;return db[_0x8d40('0x22')][_0x8d40('0x38')]({'where':{'type':_0x47ad1f[_0x8d40('0x25')]},'raw':!![]});}return null;})['then'](function(_0x408625){if(_0x47ad1f[_0x8d40('0x25')][_0x8d40('0x3f')]()==_0x8d40('0x40')){var _0x4dd76c=fs[_0x8d40('0x41')](path[_0x8d40('0x4a')](config[_0x8d40('0x42')],_0x8d40('0x43')),_0x8d40('0x44'));var _0xecbfc3=ejs[_0x8d40('0x4c')](_0x4dd76c,{'networks':_0x408625||[]});fs['writeFileSync'](_0x8d40('0x46'),_0xecbfc3);return respondWithRpcPromise(_0x8d40('0x47'),'update',{'module':_0x8d40('0x48')});}else if(_0x47ad1f[_0x8d40('0x25')]['toUpperCase']()==_0x8d40('0x49')){var _0x52eb0c=fs['readFileSync'](path['join'](config[_0x8d40('0x42')],_0x8d40('0x4b')),_0x8d40('0x44'));var _0x1ccce2=ejs[_0x8d40('0x4c')](_0x52eb0c,{'networks':_0x408625||[]});fs[_0x8d40('0x45')](_0x8d40('0x4d'),_0x1ccce2);return respondWithRpcPromise(_0x8d40('0x47'),'update',{'module':_0x8d40('0x48')});}else{var _0x521480=fs[_0x8d40('0x41')](path['join'](config[_0x8d40('0x42')],_0x8d40('0x4e')),_0x8d40('0x44'));var _0x58a565=ejs['render'](_0x521480,{'networks':_0x408625||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3c03bd[_0x8d40('0x3e')][_0x8d40('0x25')]['toLowerCase']()),_0x58a565);return respondWithRpcPromise('Reload',_0x8d40('0x1b'),{'module':'chan_sip.so'});}})[_0x8d40('0x9')](function(_0x2cfc83){if(_0x2cfc83){return _0x47ad1f;}return null;})['then'](respondWithResult(_0x2b49eb,null))[_0x8d40('0x3a')](handleError(_0x2b49eb,null));};exports['destroy']=function(_0x4e1f24,_0x194f7c){var _0x3e828c;return db[_0x8d40('0x22')][_0x8d40('0x3c')]({'where':{'id':_0x4e1f24[_0x8d40('0x3b')]['id']}})[_0x8d40('0x9')](function(_0x2738b4){_0x3e828c=_0x2738b4;return _0x2738b4;})[_0x8d40('0x9')](handleEntityNotFound(_0x194f7c,null))[_0x8d40('0x9')](removeEntity(_0x194f7c,null))[_0x8d40('0x9')](function(){if(_0x3e828c){return db[_0x8d40('0x22')][_0x8d40('0x38')]({'where':{'type':_0x3e828c[_0x8d40('0x25')]},'raw':!![]});}})[_0x8d40('0x9')](function(_0x2b5105){if(_0x3e828c['type'][_0x8d40('0x3f')]()==_0x8d40('0x40')){var _0x48a13a=fs[_0x8d40('0x41')](path[_0x8d40('0x4a')](config[_0x8d40('0x42')],_0x8d40('0x43')),_0x8d40('0x44'));var _0x1c3436=ejs['render'](_0x48a13a,{'networks':_0x2b5105||[]});fs[_0x8d40('0x45')](_0x8d40('0x46'),_0x1c3436);return respondWithRpcPromise(_0x8d40('0x47'),_0x8d40('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x3e828c[_0x8d40('0x25')][_0x8d40('0x3f')]()==_0x8d40('0x49')){var _0x567d39=fs[_0x8d40('0x41')](path['join'](config['root'],_0x8d40('0x4b')),_0x8d40('0x44'));var _0x46d492=ejs[_0x8d40('0x4c')](_0x567d39,{'networks':_0x2b5105||[]});fs[_0x8d40('0x45')](_0x8d40('0x4d'),_0x46d492);return respondWithRpcPromise('Reload',_0x8d40('0x1c'),{'module':_0x8d40('0x48')});}else{var _0x59fbfe=fs[_0x8d40('0x41')](path[_0x8d40('0x4a')](config[_0x8d40('0x42')],_0x8d40('0x4e')),_0x8d40('0x44'));var _0x2bcd87=ejs[_0x8d40('0x4c')](_0x59fbfe,{'networks':_0x2b5105||[]});fs[_0x8d40('0x45')](util[_0x8d40('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x3e828c[_0x8d40('0x25')][_0x8d40('0x51')]()),_0x2bcd87);return respondWithRpcPromise(_0x8d40('0x47'),'destroy',{'module':'chan_sip.so'});}})[_0x8d40('0x3a')](handleError(_0x194f7c,null));};
\ No newline at end of file
+var _0x7784=['json','undefined','count','offset','set','Content-Range','update','destroy','end','sendStatus','name','send','index','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','limit','sort','filters','pick','filter','where','VIRTUAL','options','Network','includeAll','include','show','params','keys','length','merge','create','body','findAll','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','root','chan_sip.so','find','toUpperCase','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','ejs','api','../../mysqldb','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','status'];(function(_0x3db3e7,_0x216d9b){var _0x536668=function(_0x381d37){while(--_0x381d37){_0x3db3e7['push'](_0x3db3e7['shift']());}};_0x536668(++_0x216d9b);}(_0x7784,0x17b));var _0x4778=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7784[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x4778('0x0'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4778('0x1'));var config=require('../../config/environment');var db=require(_0x4778('0x2'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x4778('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x502408,_0x514d37,_0x1770e5,_0x46c70b){return new Promise(function(_0x55619f,_0x104662){var _0x233d93=_0x46c70b||client;return _0x233d93[_0x4778('0x4')](_0x502408,_0x1770e5)[_0x4778('0x5')](function(_0x42aed0){logger['info'](_0x4778('0x6'),_0x514d37,_0x4778('0x7'));logger[_0x4778('0x8')](_0x4778('0x9'),_0x514d37,_0x4778('0x7'),JSON['stringify'](_0x42aed0));if(_0x42aed0[_0x4778('0xa')]){if(_0x42aed0[_0x4778('0xa')]['code']===0x1f4){logger[_0x4778('0xa')](_0x4778('0x6'),_0x514d37,_0x42aed0[_0x4778('0xa')][_0x4778('0xb')]);return _0x104662(_0x42aed0[_0x4778('0xa')][_0x4778('0xb')]);}logger['error'](_0x4778('0x6'),_0x514d37,_0x42aed0[_0x4778('0xa')]['message']);return _0x55619f(_0x42aed0['error'][_0x4778('0xb')]);}else{logger[_0x4778('0xc')](_0x4778('0x6'),_0x514d37,_0x4778('0x7'));_0x55619f(_0x42aed0[_0x4778('0xd')][_0x4778('0xb')]);}})[_0x4778('0xe')](function(_0x2e30cb){logger[_0x4778('0xa')](_0x4778('0x6'),_0x514d37,_0x2e30cb);_0x104662(_0x2e30cb);});});}function respondWithResult(_0x5e711a,_0x155b7f){_0x155b7f=_0x155b7f||0xc8;return function(_0x69b1ca){if(_0x69b1ca){return _0x5e711a[_0x4778('0xf')](_0x155b7f)[_0x4778('0x10')](_0x69b1ca);}};}function respondWithFilteredResult(_0x46ddb5,_0x1e4aac){return function(_0xfa3763){if(_0xfa3763){var _0x2eb69c=typeof _0x1e4aac['offset']===_0x4778('0x11')&&typeof _0x1e4aac['limit']===_0x4778('0x11');var _0x578b78=_0xfa3763[_0x4778('0x12')];var _0x2518ca=_0x2eb69c?0x0:_0x1e4aac['offset'];var _0x17e597=_0x2eb69c?_0xfa3763[_0x4778('0x12')]:_0x1e4aac[_0x4778('0x13')]+_0x1e4aac['limit'];var _0x55c997;if(_0x17e597>=_0x578b78){_0x17e597=_0x578b78;_0x55c997=0xc8;}else{_0x55c997=0xce;}_0x46ddb5[_0x4778('0xf')](_0x55c997);return _0x46ddb5[_0x4778('0x14')](_0x4778('0x15'),_0x2518ca+'-'+_0x17e597+'/'+_0x578b78)[_0x4778('0x10')](_0xfa3763);}return null;};}function saveUpdates(_0x23ce09){return function(_0x43b327){if(_0x43b327){return _0x43b327[_0x4778('0x16')](_0x23ce09)[_0x4778('0x5')](function(_0x45ac77){return _0x45ac77;});}return null;};}function removeEntity(_0x519d1e){return function(_0x591be8){if(_0x591be8){return _0x591be8[_0x4778('0x17')]()[_0x4778('0x5')](function(){_0x519d1e['status'](0xcc)[_0x4778('0x18')]();});}};}function handleEntityNotFound(_0x430822){return function(_0x514737){if(!_0x514737){_0x430822[_0x4778('0x19')](0x194);}return _0x514737;};}function handleError(_0x108d60,_0xbdc8ec){_0xbdc8ec=_0xbdc8ec||0x1f4;return function(_0x5f2186){logger[_0x4778('0xa')](_0x5f2186['stack']);if(_0x5f2186[_0x4778('0x1a')]){delete _0x5f2186[_0x4778('0x1a')];}_0x108d60[_0x4778('0xf')](_0xbdc8ec)[_0x4778('0x1b')](_0x5f2186);};}exports[_0x4778('0x1c')]=function(_0x25570c,_0x47c82b){var _0x385459={},_0x5e25c7={},_0x1ff418={'count':0x0,'rows':[]};var _0x1a8fee=_['map'](db['Network'][_0x4778('0x1d')],function(_0x867dcd){return{'name':_0x867dcd[_0x4778('0x1e')],'type':_0x867dcd[_0x4778('0x1f')][_0x4778('0x20')]};});_0x5e25c7['model']=_[_0x4778('0x21')](_0x1a8fee,_0x4778('0x1a'));_0x5e25c7[_0x4778('0x22')]=_['keys'](_0x25570c[_0x4778('0x22')]);_0x5e25c7['filters']=_[_0x4778('0x23')](_0x5e25c7[_0x4778('0x24')],_0x5e25c7[_0x4778('0x22')]);_0x385459[_0x4778('0x25')]=_['intersection'](_0x5e25c7[_0x4778('0x24')],qs[_0x4778('0x26')](_0x25570c[_0x4778('0x22')]['fields']));_0x385459['attributes']=_0x385459['attributes']['length']?_0x385459['attributes']:_0x5e25c7[_0x4778('0x24')];if(!_0x25570c[_0x4778('0x22')]['hasOwnProperty']('nolimit')){_0x385459[_0x4778('0x27')]=qs[_0x4778('0x27')](_0x25570c[_0x4778('0x22')]['limit']);_0x385459[_0x4778('0x13')]=qs[_0x4778('0x13')](_0x25570c['query'][_0x4778('0x13')]);}_0x385459['order']=qs['sort'](_0x25570c[_0x4778('0x22')][_0x4778('0x28')]);_0x385459['where']=qs[_0x4778('0x29')](_[_0x4778('0x2a')](_0x25570c[_0x4778('0x22')],_0x5e25c7[_0x4778('0x29')]),_0x1a8fee);if(_0x25570c[_0x4778('0x22')][_0x4778('0x2b')]){_0x385459['where']=_['merge'](_0x385459[_0x4778('0x2c')],{'$or':_['map'](_0x1a8fee,function(_0x25c6b0){if(_0x25c6b0[_0x4778('0x1f')]!==_0x4778('0x2d')){var _0x20cb9b={};_0x20cb9b[_0x25c6b0[_0x4778('0x1a')]]={'$like':'%'+_0x25570c['query'][_0x4778('0x2b')]+'%'};return _0x20cb9b;}})});}_0x385459=_['merge']({},_0x385459,_0x25570c[_0x4778('0x2e')]);var _0x1f0742={'where':_0x385459[_0x4778('0x2c')]};return db[_0x4778('0x2f')]['count'](_0x1f0742)['then'](function(_0x3291ec){_0x1ff418[_0x4778('0x12')]=_0x3291ec;if(_0x25570c['query'][_0x4778('0x30')]){_0x385459[_0x4778('0x31')]=[{'all':!![]}];}return db[_0x4778('0x2f')]['findAll'](_0x385459);})['then'](function(_0x342b9c){_0x1ff418['rows']=_0x342b9c;return _0x1ff418;})[_0x4778('0x5')](respondWithFilteredResult(_0x47c82b,_0x385459))[_0x4778('0xe')](handleError(_0x47c82b,null));};exports[_0x4778('0x32')]=function(_0x1acba1,_0x1e0327){var _0x34efe7={'raw':!![],'where':{'id':_0x1acba1[_0x4778('0x33')]['id']}},_0x5615b4={};_0x5615b4[_0x4778('0x24')]=_[_0x4778('0x34')](db[_0x4778('0x2f')][_0x4778('0x1d')]);_0x5615b4[_0x4778('0x22')]=_[_0x4778('0x34')](_0x1acba1[_0x4778('0x22')]);_0x5615b4[_0x4778('0x29')]=_['intersection'](_0x5615b4[_0x4778('0x24')],_0x5615b4[_0x4778('0x22')]);_0x34efe7['attributes']=_['intersection'](_0x5615b4[_0x4778('0x24')],qs[_0x4778('0x26')](_0x1acba1[_0x4778('0x22')]['fields']));_0x34efe7[_0x4778('0x25')]=_0x34efe7['attributes'][_0x4778('0x35')]?_0x34efe7[_0x4778('0x25')]:_0x5615b4[_0x4778('0x24')];if(_0x1acba1[_0x4778('0x22')][_0x4778('0x30')]){_0x34efe7[_0x4778('0x31')]=[{'all':!![]}];}_0x34efe7=_[_0x4778('0x36')]({},_0x34efe7,_0x1acba1[_0x4778('0x2e')]);return db['Network']['find'](_0x34efe7)[_0x4778('0x5')](handleEntityNotFound(_0x1e0327,null))['then'](respondWithResult(_0x1e0327,null))[_0x4778('0xe')](handleError(_0x1e0327,null));};exports[_0x4778('0x37')]=function(_0x1cb05f,_0x2fbf44){var _0x106204;return db['Network'][_0x4778('0x37')](_0x1cb05f[_0x4778('0x38')],{'raw':!![]})[_0x4778('0x5')](function(_0x161236){_0x106204=_0x161236;return db[_0x4778('0x2f')][_0x4778('0x39')]({'where':{'type':_0x1cb05f['body'][_0x4778('0x1f')]},'raw':!![]});})[_0x4778('0x5')](function(_0x3fc8f5){if(_0x106204[_0x4778('0x1f')]['toUpperCase']()==_0x4778('0x3a')){var _0x5e9028=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config['root'],_0x4778('0x3d')),_0x4778('0x3e'));var _0x46426f=ejs[_0x4778('0x3f')](_0x5e9028,{'networks':_0x3fc8f5||[]});fs[_0x4778('0x40')](_0x4778('0x41'),_0x46426f);return respondWithRpcPromise(_0x4778('0x42'),_0x4778('0x37'),{'module':'res_stun_monitor.so'});}else if(_0x106204[_0x4778('0x1f')]['toUpperCase']()==_0x4778('0x43')){var _0x4219b9=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config[_0x4778('0x44')],'server/files/templates/turn_multiple.ejs'),_0x4778('0x3e'));var _0x38e147=ejs[_0x4778('0x3f')](_0x4219b9,{'networks':_0x3fc8f5||[]});fs[_0x4778('0x40')]('/etc/asterisk/turn_xcally.conf',_0x38e147);return respondWithRpcPromise(_0x4778('0x42'),_0x4778('0x37'),{'module':'res_stun_monitor.so'});}else{var _0x5aa642=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config[_0x4778('0x44')],'server/files/templates/network.ejs'),'utf8');var _0x201a61=ejs[_0x4778('0x3f')](_0x5aa642,{'networks':_0x3fc8f5||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1cb05f[_0x4778('0x38')][_0x4778('0x1f')]['toLowerCase']()),_0x201a61);return respondWithRpcPromise('Reload',_0x4778('0x37'),{'module':_0x4778('0x45')});}})[_0x4778('0x5')](function(){return _0x106204;})[_0x4778('0x5')](respondWithResult(_0x2fbf44,0xc9))[_0x4778('0xe')](handleError(_0x2fbf44,null));};exports['update']=function(_0x5d6fac,_0x38838b){var _0x534008;return db[_0x4778('0x2f')][_0x4778('0x46')]({'where':{'id':_0x5d6fac[_0x4778('0x33')]['id']}})[_0x4778('0x5')](handleEntityNotFound(_0x38838b,null))[_0x4778('0x5')](saveUpdates(_0x5d6fac[_0x4778('0x38')],null))[_0x4778('0x5')](function(_0x18674e){if(_0x18674e){_0x534008=_0x18674e;return db[_0x4778('0x2f')][_0x4778('0x39')]({'where':{'type':_0x534008[_0x4778('0x1f')]},'raw':!![]});}return null;})[_0x4778('0x5')](function(_0x3cc68c){if(_0x534008[_0x4778('0x1f')][_0x4778('0x47')]()==_0x4778('0x3a')){var _0xdcf121=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config[_0x4778('0x44')],_0x4778('0x3d')),_0x4778('0x3e'));var _0x143ef1=ejs[_0x4778('0x3f')](_0xdcf121,{'networks':_0x3cc68c||[]});fs[_0x4778('0x40')]('/etc/asterisk/stun_xcally.conf',_0x143ef1);return respondWithRpcPromise(_0x4778('0x42'),_0x4778('0x16'),{'module':_0x4778('0x48')});}else if(_0x534008[_0x4778('0x1f')]['toUpperCase']()==_0x4778('0x43')){var _0x23acc9=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config[_0x4778('0x44')],_0x4778('0x49')),_0x4778('0x3e'));var _0x2f3e4f=ejs[_0x4778('0x3f')](_0x23acc9,{'networks':_0x3cc68c||[]});fs[_0x4778('0x40')](_0x4778('0x4a'),_0x2f3e4f);return respondWithRpcPromise(_0x4778('0x42'),_0x4778('0x16'),{'module':'res_stun_monitor.so'});}else{var _0x3ba16f=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config['root'],_0x4778('0x4b')),'utf8');var _0x163fcc=ejs[_0x4778('0x3f')](_0x3ba16f,{'networks':_0x3cc68c||[]});fs[_0x4778('0x40')](util[_0x4778('0x4c')](_0x4778('0x4d'),_0x5d6fac[_0x4778('0x38')]['type'][_0x4778('0x4e')]()),_0x163fcc);return respondWithRpcPromise(_0x4778('0x42'),_0x4778('0x16'),{'module':_0x4778('0x45')});}})[_0x4778('0x5')](function(_0x11d07a){if(_0x11d07a){return _0x534008;}return null;})['then'](respondWithResult(_0x38838b,null))['catch'](handleError(_0x38838b,null));};exports[_0x4778('0x17')]=function(_0x120d7d,_0x153993){var _0x30072b;return db[_0x4778('0x2f')][_0x4778('0x46')]({'where':{'id':_0x120d7d[_0x4778('0x33')]['id']}})[_0x4778('0x5')](function(_0x2d87b5){_0x30072b=_0x2d87b5;return _0x2d87b5;})[_0x4778('0x5')](handleEntityNotFound(_0x153993,null))[_0x4778('0x5')](removeEntity(_0x153993,null))[_0x4778('0x5')](function(){if(_0x30072b){return db['Network'][_0x4778('0x39')]({'where':{'type':_0x30072b['type']},'raw':!![]});}})[_0x4778('0x5')](function(_0x6e6191){if(_0x30072b[_0x4778('0x1f')][_0x4778('0x47')]()==_0x4778('0x3a')){var _0x72e5e1=fs[_0x4778('0x3b')](path['join'](config[_0x4778('0x44')],'server/files/templates/stun_multiple.ejs'),_0x4778('0x3e'));var _0x1a43b7=ejs[_0x4778('0x3f')](_0x72e5e1,{'networks':_0x6e6191||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1a43b7);return respondWithRpcPromise('Reload',_0x4778('0x17'),{'module':_0x4778('0x48')});}else if(_0x30072b[_0x4778('0x1f')]['toUpperCase']()==_0x4778('0x43')){var _0x47a642=fs[_0x4778('0x3b')](path['join'](config[_0x4778('0x44')],_0x4778('0x49')),_0x4778('0x3e'));var _0xa01a0e=ejs[_0x4778('0x3f')](_0x47a642,{'networks':_0x6e6191||[]});fs[_0x4778('0x40')](_0x4778('0x4a'),_0xa01a0e);return respondWithRpcPromise(_0x4778('0x42'),_0x4778('0x17'),{'module':_0x4778('0x48')});}else{var _0x134747=fs[_0x4778('0x3b')](path[_0x4778('0x3c')](config[_0x4778('0x44')],'server/files/templates/network.ejs'),'utf8');var _0x18d21f=ejs['render'](_0x134747,{'networks':_0x6e6191||[]});fs[_0x4778('0x40')](util[_0x4778('0x4c')](_0x4778('0x4d'),_0x30072b[_0x4778('0x1f')]['toLowerCase']()),_0x18d21f);return respondWithRpcPromise('Reload',_0x4778('0x17'),{'module':_0x4778('0x45')});}})[_0x4778('0xe')](handleError(_0x153993,null));};
\ No newline at end of file
index 722e55d..f96a8f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['rimraf','./network.attributes','exports','define','network','../../config/logger','api','moment','bluebird','path'];(function(_0x343721,_0x14b67a){var _0x398326=function(_0x5e8cb1){while(--_0x5e8cb1){_0x343721['push'](_0x343721['shift']());}};_0x398326(++_0x14b67a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xcb91[_0x249e96];return _0x17444c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('Network',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfc03=['./network.attributes','exports','define','network','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x2d170b,_0x507408){var _0x2423da=function(_0x59c266){while(--_0x59c266){_0x2d170b['push'](_0x2d170b['shift']());}};_0x2423da(++_0x507408);}(_0xfc03,0x16f));var _0x3fc0=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xfc03[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var logger=require(_0x3fc0('0x1'))(_0x3fc0('0x2'));var moment=require('moment');var BPromise=require(_0x3fc0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fc0('0x4'));var rimraf=require(_0x3fc0('0x5'));var config=require(_0x3fc0('0x6'));var attributes=require(_0x3fc0('0x7'));module[_0x3fc0('0x8')]=function(_0x389bfb,_0x2b4ef6){return _0x389bfb[_0x3fc0('0x9')]('Network',attributes,{'tableName':_0x3fc0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 970701a..0afaffe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x4487a8,_0x177f31){_0x4487a8=_0x4487a8-0x0;var _0x4da3d1=_0x7a54[_0x4487a8];return _0x4da3d1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
+var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x3e6ed7,_0x3a1aae){_0x3e6ed7=_0x3e6ed7-0x0;var _0x427b09=_0x7a54[_0x3e6ed7];return _0x427b09;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
index d5ae80e..84a57bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x295f=['update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','/describe','describe','/:id','show','get','getDispositions','getApplications','/:id/interactions','getInteractions','getAgents','post','/:id/dispositions','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/users','addAgents','/:id/send','send','put'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x295f,0x1db));var _0xf295=function(_0x5ecb7c,_0x11e342){_0x5ecb7c=_0x5ecb7c-0x0;var _0x2006e5=_0x295f[_0x5ecb7c];return _0x2006e5;};'use strict';var multer=require(_0xf295('0x0'));var util=require(_0xf295('0x1'));var path=require(_0xf295('0x2'));var timeout=require('connect-timeout');var express=require(_0xf295('0x3'));var router=express['Router']();var fs_extra=require(_0xf295('0x4'));var auth=require(_0xf295('0x5'));var interaction=require(_0xf295('0x6'));var config=require(_0xf295('0x7'));var controller=require(_0xf295('0x8'));router['get']('/',auth[_0xf295('0x9')](),controller['index']);router['get'](_0xf295('0xa'),auth[_0xf295('0x9')](),controller[_0xf295('0xb')]);router['get'](_0xf295('0xc'),auth[_0xf295('0x9')](),controller[_0xf295('0xd')]);router[_0xf295('0xe')]('/:id/dispositions',auth[_0xf295('0x9')](),controller[_0xf295('0xf')]);router[_0xf295('0xe')]('/:id/canned_answers',auth[_0xf295('0x9')](),controller['getAnswers']);router[_0xf295('0xe')]('/:id/applications',auth[_0xf295('0x9')](),controller[_0xf295('0x10')]);router[_0xf295('0xe')](_0xf295('0x11'),auth[_0xf295('0x9')](),controller[_0xf295('0x12')]);router[_0xf295('0xe')]('/:id/users',auth[_0xf295('0x9')](),controller[_0xf295('0x13')]);router[_0xf295('0x14')]('/',auth[_0xf295('0x9')](),controller['create']);router[_0xf295('0x14')](_0xf295('0x15'),auth[_0xf295('0x9')](),controller['addDisposition']);router[_0xf295('0x14')]('/:id/canned_answers',auth[_0xf295('0x9')](),controller[_0xf295('0x16')]);router[_0xf295('0x14')](_0xf295('0x17'),controller[_0xf295('0x18')]);router['post'](_0xf295('0x19'),auth['isAuthenticated'](),controller[_0xf295('0x1a')]);router['post'](_0xf295('0x1b'),auth[_0xf295('0x9')](),controller[_0xf295('0x1c')]);router[_0xf295('0x14')](_0xf295('0x1d'),auth[_0xf295('0x9')](),controller[_0xf295('0x1e')]);router[_0xf295('0x1f')]('/:id',auth[_0xf295('0x9')](),controller[_0xf295('0x20')]);router['delete'](_0xf295('0xc'),auth['isAuthenticated'](),controller[_0xf295('0x21')]);router[_0xf295('0x22')](_0xf295('0x15'),auth[_0xf295('0x9')](),controller[_0xf295('0x23')]);router[_0xf295('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf295('0x24')]);router['delete'](_0xf295('0x1b'),auth['isAuthenticated'](),controller[_0xf295('0x25')]);module[_0xf295('0x26')]=router;
\ No newline at end of file
+var _0x6bb6=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','notify','/:id/applications','addApplications','/:id/users','/:id/send','send','put'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x6bb6,0xae));var _0x66bb=function(_0x4cce2f,_0x78a347){_0x4cce2f=_0x4cce2f-0x0;var _0x19b1ba=_0x6bb6[_0x4cce2f];return _0x19b1ba;};'use strict';var multer=require(_0x66bb('0x0'));var util=require(_0x66bb('0x1'));var path=require(_0x66bb('0x2'));var timeout=require(_0x66bb('0x3'));var express=require(_0x66bb('0x4'));var router=express[_0x66bb('0x5')]();var fs_extra=require(_0x66bb('0x6'));var auth=require(_0x66bb('0x7'));var interaction=require(_0x66bb('0x8'));var config=require(_0x66bb('0x9'));var controller=require(_0x66bb('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x66bb('0xb')]);router[_0x66bb('0xc')](_0x66bb('0xd'),auth[_0x66bb('0xe')](),controller[_0x66bb('0xf')]);router['get'](_0x66bb('0x10'),auth[_0x66bb('0xe')](),controller[_0x66bb('0x11')]);router[_0x66bb('0xc')](_0x66bb('0x12'),auth[_0x66bb('0xe')](),controller[_0x66bb('0x13')]);router[_0x66bb('0xc')]('/:id/canned_answers',auth[_0x66bb('0xe')](),controller[_0x66bb('0x14')]);router['get']('/:id/applications',auth[_0x66bb('0xe')](),controller[_0x66bb('0x15')]);router[_0x66bb('0xc')](_0x66bb('0x16'),auth[_0x66bb('0xe')](),controller['getInteractions']);router[_0x66bb('0xc')]('/:id/users',auth[_0x66bb('0xe')](),controller[_0x66bb('0x17')]);router[_0x66bb('0x18')]('/',auth[_0x66bb('0xe')](),controller[_0x66bb('0x19')]);router[_0x66bb('0x18')](_0x66bb('0x12'),auth['isAuthenticated'](),controller[_0x66bb('0x1a')]);router[_0x66bb('0x18')](_0x66bb('0x1b'),auth[_0x66bb('0xe')](),controller[_0x66bb('0x1c')]);router[_0x66bb('0x18')]('/:id/notify',controller[_0x66bb('0x1d')]);router[_0x66bb('0x18')](_0x66bb('0x1e'),auth[_0x66bb('0xe')](),controller[_0x66bb('0x1f')]);router[_0x66bb('0x18')](_0x66bb('0x20'),auth['isAuthenticated'](),controller['addAgents']);router[_0x66bb('0x18')](_0x66bb('0x21'),auth['isAuthenticated'](),controller[_0x66bb('0x22')]);router[_0x66bb('0x23')]('/:id',auth[_0x66bb('0xe')](),controller['update']);router[_0x66bb('0x24')]('/:id',auth[_0x66bb('0xe')](),controller[_0x66bb('0x25')]);router['delete'](_0x66bb('0x12'),auth[_0x66bb('0xe')](),controller[_0x66bb('0x26')]);router[_0x66bb('0x24')](_0x66bb('0x1b'),auth['isAuthenticated'](),controller[_0x66bb('0x27')]);router['delete'](_0x66bb('0x20'),auth['isAuthenticated'](),controller[_0x66bb('0x28')]);module[_0x66bb('0x29')]=router;
\ No newline at end of file
index 0dcf7bf..1a94fe6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f35=['STRING','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f35,0x1ac));var _0x53f3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3f35[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x53f3('0x0'));var rs=require(_0x53f3('0x1'));module[_0x53f3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x53f3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x53f3('0x4')]},'token':{'type':Sequelize[_0x53f3('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x53f3('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x53f3('0x5')],'defaultValue':function(){return _0x53f3('0x6');}},'notificationSound':{'type':Sequelize[_0x53f3('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x53f3('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x53f3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x53f3('0x4')]},'queueTransfer':{'type':Sequelize[_0x53f3('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x53f3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x53f3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x53f3('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x53f3('0x7')],'defaultValue':![],'comment':_0x53f3('0x9'),'set':function(_0x37eaa3){if(!_0x37eaa3)this[_0x53f3('0xa')](_0x53f3('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x37eaa3);}}};
\ No newline at end of file
+var _0x0dc4=['randomstring','exports','STRING','name','generate','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x4a8f71,_0x4c441f){var _0x66afa3=function(_0x5883fd){while(--_0x5883fd){_0x4a8f71['push'](_0x4a8f71['shift']());}};_0x66afa3(++_0x4c441f);}(_0x0dc4,0x74));var _0x40dc=function(_0x166e88,_0x1bae10){_0x166e88=_0x166e88-0x0;var _0x43ec68=_0x0dc4[_0x166e88];return _0x43ec68;};'use strict';var Sequelize=require(_0x40dc('0x0'));var rs=require(_0x40dc('0x1'));module[_0x40dc('0x2')]={'name':{'type':Sequelize[_0x40dc('0x3')],'unique':_0x40dc('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x40dc('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x40dc('0x5')]();}},'replyUri':{'type':Sequelize[_0x40dc('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x40dc('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x40dc('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x40dc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x40dc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x40dc('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x40dc('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x40dc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x40dc('0x8')],'defaultValue':![],'comment':_0x40dc('0xa'),'set':function(_0x9814f3){if(!_0x9814f3)this[_0x40dc('0xb')](_0x40dc('0xc'),null);this[_0x40dc('0xb')]('mandatoryDisposition',_0x9814f3);}}};
\ No newline at end of file
index 6b75548..f77c7da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27c7=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','account','Applications','list','applications','priority','asc','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','then','get','OpenchannelAccounts','UserProfileResource','end','stack','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','name','options','include','findAll','rows','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','destroy','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','notify','openchannel','CmContact','Sequelize','ValidationError'];(function(_0x2d6330,_0x2e2ea0){var _0x202683=function(_0x28ccb9){while(--_0x28ccb9){_0x2d6330['push'](_0x2d6330['shift']());}};_0x202683(++_0x2e2ea0);}(_0x27c7,0x10d));var _0x727c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x27c7[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x727c('0x0'));var rimraf=require(_0x727c('0x1'));var zipdir=require(_0x727c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x727c('0x3'));var moment=require(_0x727c('0x4'));var BPromise=require(_0x727c('0x5'));var Mustache=require('mustache');var util=require(_0x727c('0x6'));var path=require(_0x727c('0x7'));var sox=require(_0x727c('0x8'));var csv=require(_0x727c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x727c('0xa'));var _=require(_0x727c('0xb'));var squel=require(_0x727c('0xc'));var crypto=require(_0x727c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x727c('0xe'));var toCsv=require(_0x727c('0x9'));var querystring=require(_0x727c('0xf'));var Papa=require('papaparse');var Redis=require(_0x727c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x727c('0x11'));var as=require(_0x727c('0x12'));var hardwareService=require(_0x727c('0x13'));var logger=require('../../config/logger')(_0x727c('0x14'));var utils=require(_0x727c('0x15'));var config=require(_0x727c('0x16'));var licenseUtil=require(_0x727c('0x17'));var db=require('../../mysqldb')['db'];config[_0x727c('0x18')]=_[_0x727c('0x19')](config['redis'],{'host':_0x727c('0x1a'),'port':0x18eb});var socket=require(_0x727c('0x1b'))(new Redis(config[_0x727c('0x18')]));require('./openchannelAccount.socket')[_0x727c('0x1c')](socket);var jayson=require(_0x727c('0x1d'));var client=jayson[_0x727c('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x727c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x91a581,_0x52e9f0,_0xf8729d,_0x88d8a7){return new BPromise(function(_0x1633e8,_0x41d96a){var _0x473998=_0x88d8a7||client;return _0x473998[_0x727c('0x20')](_0x91a581,_0xf8729d)['then'](function(_0x3a68bd){logger[_0x727c('0x21')](_0x727c('0x22'),_0x52e9f0,_0x727c('0x23'));logger[_0x727c('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x52e9f0,_0x727c('0x23'),JSON['stringify'](_0x3a68bd));if(_0x3a68bd[_0x727c('0x25')]){if(_0x3a68bd[_0x727c('0x25')][_0x727c('0x26')]===0x1f4){logger[_0x727c('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x52e9f0,_0x3a68bd[_0x727c('0x25')][_0x727c('0x27')]);return _0x41d96a(_0x3a68bd['error'][_0x727c('0x27')]);}logger['error'](_0x727c('0x22'),_0x52e9f0,_0x3a68bd[_0x727c('0x25')][_0x727c('0x27')]);return _0x1633e8(_0x3a68bd[_0x727c('0x25')][_0x727c('0x27')]);}else{logger[_0x727c('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x52e9f0,_0x727c('0x23'));_0x1633e8(_0x3a68bd[_0x727c('0x28')][_0x727c('0x27')]);}})[_0x727c('0x29')](function(_0x32c5d5){logger[_0x727c('0x25')](_0x727c('0x22'),_0x52e9f0,_0x32c5d5);_0x41d96a(_0x32c5d5);});});}function respondWithStatusCode(_0x1c78a6,_0x1ca28c){_0x1ca28c=_0x1ca28c||0xcc;return function(_0x38a65d){if(_0x38a65d){return _0x1c78a6[_0x727c('0x2a')](_0x1ca28c);}return _0x1c78a6[_0x727c('0x2b')](_0x1ca28c)['end']();};}function respondWithResult(_0x4da3e6,_0x413685){_0x413685=_0x413685||0xc8;return function(_0x57e975){if(_0x57e975){return _0x4da3e6['status'](_0x413685)[_0x727c('0x2c')](_0x57e975);}};}function respondWithFilteredResult(_0x55e6af,_0x3609b0){return function(_0x38d7d7){if(_0x38d7d7){var _0x29f8db=typeof _0x3609b0['offset']==='undefined'&&typeof _0x3609b0['limit']===_0x727c('0x2d');var _0x38f0a7=_0x38d7d7[_0x727c('0x2e')];var _0x50b999=_0x29f8db?0x0:_0x3609b0[_0x727c('0x2f')];var _0xc17b0c=_0x29f8db?_0x38d7d7[_0x727c('0x2e')]:_0x3609b0[_0x727c('0x2f')]+_0x3609b0['limit'];var _0x4eb55c;if(_0xc17b0c>=_0x38f0a7){_0xc17b0c=_0x38f0a7;_0x4eb55c=0xc8;}else{_0x4eb55c=0xce;}_0x55e6af[_0x727c('0x2b')](_0x4eb55c);return _0x55e6af[_0x727c('0x30')]('Content-Range',_0x50b999+'-'+_0xc17b0c+'/'+_0x38f0a7)[_0x727c('0x2c')](_0x38d7d7);}return null;};}function patchUpdates(_0x46a14a){return function(_0x171834){try{jsonpatch[_0x727c('0x31')](_0x171834,_0x46a14a,!![]);}catch(_0x153b3a){return BPromise[_0x727c('0x32')](_0x153b3a);}return _0x171834[_0x727c('0x33')]();};}function saveUpdates(_0x3a0a0a,_0x2734b2){return function(_0x5d815f){if(_0x5d815f){return _0x5d815f['update'](_0x3a0a0a)[_0x727c('0x34')](function(_0x324421){return _0x324421;});}return null;};}function removeEntity(_0x1de344,_0x75c867){return function(_0x5a9cf0){if(_0x5a9cf0){return _0x5a9cf0['destroy']()[_0x727c('0x34')](function(){var _0x113679=_0x5a9cf0[_0x727c('0x35')]({'plain':!![]});var _0x5911bd=_0x727c('0x36');return db[_0x727c('0x37')]['destroy']({'where':{'type':_0x5911bd,'resourceId':_0x113679['id']}})[_0x727c('0x34')](function(){return _0x5a9cf0;});})[_0x727c('0x34')](function(){_0x1de344[_0x727c('0x2b')](0xcc)[_0x727c('0x38')]();});}};}function handleEntityNotFound(_0x27de7a,_0x89174e){return function(_0x283f24){if(!_0x283f24){_0x27de7a['sendStatus'](0x194);}return _0x283f24;};}function handleError(_0x3f5671,_0x5429b7){_0x5429b7=_0x5429b7||0x1f4;return function(_0x357ad9){logger[_0x727c('0x25')](_0x357ad9[_0x727c('0x39')]);if(_0x357ad9['name']){delete _0x357ad9['name'];}_0x3f5671[_0x727c('0x2b')](_0x5429b7)[_0x727c('0x3a')](_0x357ad9);};}exports[_0x727c('0x3b')]=function(_0x5b959a,_0x5d4f55){var _0xc0ca41={'include':[{'model':db[_0x727c('0x3c')],'as':_0x727c('0x3d')}]},_0x398f5d={},_0x4a6739={'count':0x0,'rows':[]};var _0x3309d3=_[_0x727c('0x3e')](db[_0x727c('0x3f')][_0x727c('0x40')],function(_0x5b6f9d){return{'name':_0x5b6f9d[_0x727c('0x41')],'type':_0x5b6f9d[_0x727c('0x42')]['key']};});_0x398f5d[_0x727c('0x43')]=_['map'](_0x3309d3,'name');_0x398f5d[_0x727c('0x44')]=_[_0x727c('0x45')](_0x5b959a[_0x727c('0x44')]);_0x398f5d[_0x727c('0x46')]=_['intersection'](_0x398f5d['model'],_0x398f5d[_0x727c('0x44')]);_0xc0ca41[_0x727c('0x47')]=_[_0x727c('0x48')](_0x398f5d[_0x727c('0x43')],qs[_0x727c('0x49')](_0x5b959a[_0x727c('0x44')][_0x727c('0x49')]));_0xc0ca41[_0x727c('0x47')]=_0xc0ca41[_0x727c('0x47')][_0x727c('0x4a')]?_0xc0ca41['attributes']:_0x398f5d[_0x727c('0x43')];if(!_0x5b959a['query'][_0x727c('0x4b')](_0x727c('0x4c'))){_0xc0ca41[_0x727c('0x4d')]=qs['limit'](_0x5b959a[_0x727c('0x44')][_0x727c('0x4d')]);_0xc0ca41['offset']=qs['offset'](_0x5b959a[_0x727c('0x44')][_0x727c('0x2f')]);}_0xc0ca41[_0x727c('0x4e')]=qs[_0x727c('0x4f')](_0x5b959a[_0x727c('0x44')][_0x727c('0x4f')]);_0xc0ca41[_0x727c('0x50')]=qs[_0x727c('0x46')](_['pick'](_0x5b959a['query'],_0x398f5d[_0x727c('0x46')]),_0x3309d3);if(_0x5b959a[_0x727c('0x44')][_0x727c('0x51')]){_0xc0ca41[_0x727c('0x50')]=_[_0x727c('0x52')](_0xc0ca41['where'],{'$or':_['map'](_0x3309d3,function(_0x20bf4e){if(_0x20bf4e[_0x727c('0x42')]!==_0x727c('0x53')){var _0x455292={};_0x455292[_0x20bf4e[_0x727c('0x54')]]={'$like':'%'+_0x5b959a[_0x727c('0x44')]['filter']+'%'};return _0x455292;}})});}_0xc0ca41=_[_0x727c('0x52')]({},_0xc0ca41,_0x5b959a[_0x727c('0x55')]);var _0x49b294={'where':_0xc0ca41['where']};return db[_0x727c('0x3f')]['count'](_0x49b294)[_0x727c('0x34')](function(_0x323e72){_0x4a6739[_0x727c('0x2e')]=_0x323e72;if(_0x5b959a[_0x727c('0x44')]['includeAll']){_0xc0ca41[_0x727c('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x727c('0x57')](_0xc0ca41);})[_0x727c('0x34')](function(_0x2c62f0){_0x4a6739[_0x727c('0x58')]=_0x2c62f0;return _0x4a6739;})['then'](respondWithFilteredResult(_0x5d4f55,_0xc0ca41))[_0x727c('0x29')](handleError(_0x5d4f55,null));};exports[_0x727c('0x59')]=function(_0x2b0ae6,_0x4420f3){var _0x42f8c1={'raw':![],'where':{'id':_0x2b0ae6[_0x727c('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x727c('0x3d')}]},_0x3ec73b={};_0x3ec73b[_0x727c('0x43')]=_[_0x727c('0x45')](db[_0x727c('0x3f')][_0x727c('0x40')]);_0x3ec73b['query']=_[_0x727c('0x45')](_0x2b0ae6[_0x727c('0x44')]);_0x3ec73b[_0x727c('0x46')]=_['intersection'](_0x3ec73b[_0x727c('0x43')],_0x3ec73b[_0x727c('0x44')]);_0x42f8c1['attributes']=_[_0x727c('0x48')](_0x3ec73b[_0x727c('0x43')],qs[_0x727c('0x49')](_0x2b0ae6[_0x727c('0x44')]['fields']));_0x42f8c1['attributes']=_0x42f8c1[_0x727c('0x47')]['length']?_0x42f8c1[_0x727c('0x47')]:_0x3ec73b[_0x727c('0x43')];if(_0x2b0ae6[_0x727c('0x44')][_0x727c('0x5b')]){_0x42f8c1[_0x727c('0x56')]=[{'all':!![]}];}_0x42f8c1=_[_0x727c('0x52')]({},_0x42f8c1,_0x2b0ae6[_0x727c('0x55')]);return db[_0x727c('0x3f')][_0x727c('0x5c')](_0x42f8c1)['then'](handleEntityNotFound(_0x4420f3,null))['then'](respondWithResult(_0x4420f3,null))[_0x727c('0x29')](handleError(_0x4420f3,null));};exports['create']=function(_0x1889d1,_0x494898){return db['OpenchannelAccount'][_0x727c('0x5d')](_0x1889d1['body'],{})[_0x727c('0x34')](function(_0x2e9ff0){var _0xa68f0e=_0x1889d1[_0x727c('0x5e')][_0x727c('0x35')]({'plain':!![]});if(!_0xa68f0e)throw new Error(_0x727c('0x5f'));if(_0xa68f0e[_0x727c('0x60')]==='user'){var _0x776690=_0x2e9ff0['get']({'plain':!![]});var _0x4223f0=_0x727c('0x36');return db[_0x727c('0x61')]['find']({'where':{'name':_0x4223f0,'userProfileId':_0xa68f0e[_0x727c('0x62')]},'raw':!![]})[_0x727c('0x34')](function(_0x422df2){if(_0x422df2&&_0x422df2[_0x727c('0x63')]===0x0){return db[_0x727c('0x37')][_0x727c('0x5d')]({'name':_0x776690['name'],'resourceId':_0x776690['id'],'type':_0x422df2[_0x727c('0x54')],'sectionId':_0x422df2['id']},{})['then'](function(){return _0x2e9ff0;});}else{return _0x2e9ff0;}})[_0x727c('0x29')](function(_0x4a63a4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a63a4);throw _0x4a63a4;});}return _0x2e9ff0;})[_0x727c('0x34')](respondWithResult(_0x494898,0xc9))[_0x727c('0x29')](handleError(_0x494898,null));};exports[_0x727c('0x64')]=function(_0x3bf31b,_0x3b4cad){if(_0x3bf31b[_0x727c('0x65')]['id']){delete _0x3bf31b[_0x727c('0x65')]['id'];}return db[_0x727c('0x3f')][_0x727c('0x5c')]({'where':{'id':_0x3bf31b[_0x727c('0x5a')]['id']},'include':[{'model':db[_0x727c('0x3c')],'as':_0x727c('0x3d')}]})[_0x727c('0x34')](handleEntityNotFound(_0x3b4cad,null))[_0x727c('0x34')](saveUpdates(_0x3bf31b[_0x727c('0x65')],null))['then'](respondWithResult(_0x3b4cad,null))[_0x727c('0x29')](handleError(_0x3b4cad,null));};exports[_0x727c('0x66')]=function(_0x1a3bc4,_0x253584){return db[_0x727c('0x3f')][_0x727c('0x5c')]({'where':{'id':_0x1a3bc4[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x253584,null))[_0x727c('0x34')](removeEntity(_0x253584,null))[_0x727c('0x29')](handleError(_0x253584,null));};exports[_0x727c('0x67')]=function(_0x467591,_0xbb8d5e){return db[_0x727c('0x3f')][_0x727c('0x67')]()['then'](respondWithResult(_0xbb8d5e,null))['catch'](handleError(_0xbb8d5e,null));};exports['addDisposition']=function(_0x383575,_0x1a559c,_0x1072df){if(_0x383575['body']['id']){delete _0x383575[_0x727c('0x65')]['id'];}return db['OpenchannelAccount'][_0x727c('0x5c')]({'where':{'id':_0x383575[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x1a559c,null))['then'](function(_0x350ec6){if(_0x350ec6){_0x383575[_0x727c('0x65')][_0x727c('0x68')]=_0x350ec6['id'];return db[_0x727c('0x69')][_0x727c('0x5d')](_0x383575[_0x727c('0x65')]);}})[_0x727c('0x34')](respondWithResult(_0x1a559c,null))[_0x727c('0x29')](handleError(_0x1a559c,null));};exports[_0x727c('0x6a')]=function(_0x40ab54,_0x4809d8,_0x46dac6){var _0x25218a={'raw':![],'where':{}};var _0x42a31d={};var _0xfadcee={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x727c('0x6b')]({'where':{'id':_0x40ab54[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x4809d8,null))[_0x727c('0x34')](function(_0x3760e1){if(_0x3760e1){_0x42a31d[_0x727c('0x43')]=_['keys'](db[_0x727c('0x69')][_0x727c('0x40')]);_0x42a31d[_0x727c('0x44')]=_[_0x727c('0x45')](_0x40ab54[_0x727c('0x44')]);_0x42a31d['filters']=_[_0x727c('0x48')](_0x42a31d[_0x727c('0x43')],_0x42a31d['query']);_0x25218a[_0x727c('0x47')]=_[_0x727c('0x48')](_0x42a31d[_0x727c('0x43')],qs['fields'](_0x40ab54[_0x727c('0x44')][_0x727c('0x49')]));_0x25218a[_0x727c('0x47')]=_0x25218a[_0x727c('0x47')][_0x727c('0x4a')]?_0x25218a['attributes']:_0x42a31d[_0x727c('0x43')];if(!_0x40ab54['query'][_0x727c('0x4b')]('nolimit')){_0x25218a[_0x727c('0x4d')]=qs[_0x727c('0x4d')](_0x40ab54[_0x727c('0x44')][_0x727c('0x4d')]);_0x25218a[_0x727c('0x2f')]=qs[_0x727c('0x2f')](_0x40ab54[_0x727c('0x44')]['offset']);}_0x25218a[_0x727c('0x4e')]=qs[_0x727c('0x4f')](_0x40ab54[_0x727c('0x44')]['sort']);_0x25218a[_0x727c('0x50')]=qs[_0x727c('0x46')](_['pick'](_0x40ab54[_0x727c('0x44')],_0x42a31d[_0x727c('0x46')]));_0x25218a[_0x727c('0x50')][_0x727c('0x68')]=_0x3760e1['id'];if(_0x40ab54[_0x727c('0x44')][_0x727c('0x51')]){_0x25218a[_0x727c('0x50')]=_['merge'](_0x25218a[_0x727c('0x50')],{'$or':_[_0x727c('0x3e')](_0x25218a['attributes'],function(_0xd5d550){var _0x537171={};_0x537171[_0xd5d550]={'$like':'%'+_0x40ab54[_0x727c('0x44')][_0x727c('0x51')]+'%'};return _0x537171;})});}_0x25218a=_[_0x727c('0x52')]({},_0x25218a,_0x40ab54[_0x727c('0x55')]);return db['Disposition'][_0x727c('0x2e')]({'where':_0x25218a['where']})[_0x727c('0x34')](function(_0x508470){_0xfadcee[_0x727c('0x2e')]=_0x508470;if(_0x40ab54[_0x727c('0x44')]['includeAll']){_0x25218a[_0x727c('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x727c('0x57')](_0x25218a);})[_0x727c('0x34')](function(_0x2dc2b0){_0xfadcee[_0x727c('0x58')]=_0x2dc2b0;return _0xfadcee;});}})['then'](respondWithFilteredResult(_0x4809d8,_0x25218a))['catch'](handleError(_0x4809d8,null));};exports[_0x727c('0x6c')]=function(_0x59d940,_0x136855,_0x21eea3){return db['OpenchannelAccount']['find']({'where':{'id':_0x59d940[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x136855,null))[_0x727c('0x34')](function(_0x25d5f8){if(_0x25d5f8){return _0x25d5f8[_0x727c('0x6c')](_0x59d940[_0x727c('0x44')][_0x727c('0x6d')]);}})['then'](respondWithStatusCode(_0x136855,null))[_0x727c('0x29')](handleError(_0x136855,null));};exports[_0x727c('0x6e')]=function(_0x5b7f48,_0x3ef287,_0x331cd8){if(_0x5b7f48['body']['id']){delete _0x5b7f48['body']['id'];}return db[_0x727c('0x3f')]['find']({'where':{'id':_0x5b7f48[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x3ef287,null))[_0x727c('0x34')](function(_0x1daf73){if(_0x1daf73){_0x5b7f48['body'][_0x727c('0x68')]=_0x1daf73['id'];return db[_0x727c('0x6f')][_0x727c('0x5d')](_0x5b7f48[_0x727c('0x65')]);}})[_0x727c('0x34')](respondWithResult(_0x3ef287,null))['catch'](handleError(_0x3ef287,null));};exports[_0x727c('0x70')]=function(_0x77dcfa,_0x4d3427,_0x46ea7d){var _0x3e1662={'raw':![],'where':{}};var _0x29ea5b={};var _0x15ca91={'count':0x0,'rows':[]};return db[_0x727c('0x3f')][_0x727c('0x6b')]({'where':{'id':_0x77dcfa['params']['id']}})['then'](handleEntityNotFound(_0x4d3427,null))[_0x727c('0x34')](function(_0x5d9b83){if(_0x5d9b83){_0x29ea5b[_0x727c('0x43')]=_['keys'](db[_0x727c('0x6f')][_0x727c('0x40')]);_0x29ea5b[_0x727c('0x44')]=_[_0x727c('0x45')](_0x77dcfa['query']);_0x29ea5b[_0x727c('0x46')]=_[_0x727c('0x48')](_0x29ea5b[_0x727c('0x43')],_0x29ea5b['query']);_0x3e1662[_0x727c('0x47')]=_['intersection'](_0x29ea5b['model'],qs['fields'](_0x77dcfa[_0x727c('0x44')][_0x727c('0x49')]));_0x3e1662[_0x727c('0x47')]=_0x3e1662[_0x727c('0x47')]['length']?_0x3e1662[_0x727c('0x47')]:_0x29ea5b[_0x727c('0x43')];if(!_0x77dcfa[_0x727c('0x44')][_0x727c('0x4b')]('nolimit')){_0x3e1662[_0x727c('0x4d')]=qs[_0x727c('0x4d')](_0x77dcfa[_0x727c('0x44')]['limit']);_0x3e1662[_0x727c('0x2f')]=qs[_0x727c('0x2f')](_0x77dcfa[_0x727c('0x44')]['offset']);}_0x3e1662[_0x727c('0x4e')]=qs['sort'](_0x77dcfa['query'][_0x727c('0x4f')]);_0x3e1662['where']=qs[_0x727c('0x46')](_[_0x727c('0x71')](_0x77dcfa['query'],_0x29ea5b[_0x727c('0x46')]));_0x3e1662[_0x727c('0x50')][_0x727c('0x68')]=_0x5d9b83['id'];if(_0x77dcfa[_0x727c('0x44')]['filter']){_0x3e1662[_0x727c('0x50')]=_['merge'](_0x3e1662[_0x727c('0x50')],{'$or':_['map'](_0x3e1662[_0x727c('0x47')],function(_0x13b19a){var _0x59debd={};_0x59debd[_0x13b19a]={'$like':'%'+_0x77dcfa[_0x727c('0x44')]['filter']+'%'};return _0x59debd;})});}_0x3e1662=_[_0x727c('0x52')]({},_0x3e1662,_0x77dcfa[_0x727c('0x55')]);return db['CannedAnswer'][_0x727c('0x2e')]({'where':_0x3e1662[_0x727c('0x50')]})['then'](function(_0x24ea7a){_0x15ca91[_0x727c('0x2e')]=_0x24ea7a;if(_0x77dcfa['query']['includeAll']){_0x3e1662[_0x727c('0x56')]=[{'all':!![]}];}return db[_0x727c('0x6f')][_0x727c('0x57')](_0x3e1662);})[_0x727c('0x34')](function(_0x5ce070){_0x15ca91[_0x727c('0x58')]=_0x5ce070;return _0x15ca91;});}})[_0x727c('0x34')](respondWithFilteredResult(_0x4d3427,_0x3e1662))[_0x727c('0x29')](handleError(_0x4d3427,null));};exports['removeAnswers']=function(_0x7b0e5f,_0x544a6e,_0x4c486a){return db[_0x727c('0x3f')][_0x727c('0x5c')]({'where':{'id':_0x7b0e5f[_0x727c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x544a6e,null))[_0x727c('0x34')](function(_0x3b0175){if(_0x3b0175){return _0x3b0175['removeAnswers'](_0x7b0e5f[_0x727c('0x44')][_0x727c('0x6d')]);}})['then'](respondWithStatusCode(_0x544a6e,null))[_0x727c('0x29')](handleError(_0x544a6e,null));};exports[_0x727c('0x72')]=function(_0x13e284,_0x23dbcf,_0x106211){var _0x306c76={'body':_0x13e284['body'],'channel':_0x727c('0x73')};var _0x1aeeb1=[];var _0x2c941e=[];var _0x4fa334={};var _0x3432f9=![];return db[_0x727c('0x74')][_0x727c('0x67')]()[_0x727c('0x34')](function(_0x2e933e){if(!_0x2e933e){throw new db[(_0x727c('0x75'))][(_0x727c('0x76'))](_0x727c('0x77'));}_0x1aeeb1=_[_0x727c('0x78')](_[_0x727c('0x45')](_0x2e933e),[_0x727c('0x79'),_0x727c('0x7a')]);_0x2c941e=_[_0x727c('0x78')](_['keys'](_0x2e933e),[_0x727c('0x79'),_0x727c('0x7a'),_0x727c('0x7b'),_0x727c('0x7c')]);if(_0x13e284[_0x727c('0x65')]['id']){delete _0x13e284[_0x727c('0x65')]['id'];}if(_[_0x727c('0x7d')](_0x13e284[_0x727c('0x65')][_0x727c('0x7e')])){throw new db[(_0x727c('0x75'))]['ValidationError'](_0x727c('0x7f'));}if(_['isNil'](_0x13e284[_0x727c('0x65')][_0x727c('0x65')])||_0x13e284['body'][_0x727c('0x65')]===''){throw new db[(_0x727c('0x75'))][(_0x727c('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x727c('0x7d')](_0x13e284[_0x727c('0x65')][_0x727c('0x80')])){throw new db[(_0x727c('0x75'))][(_0x727c('0x76'))](_0x727c('0x81')+_0x2c941e);}if(!_[_0x727c('0x82')](_0x2c941e,_0x13e284[_0x727c('0x65')][_0x727c('0x80')])){throw new db['Sequelize'][(_0x727c('0x76'))](_0x727c('0x83')+_0x2c941e);}_0x4fa334[_0x13e284[_0x727c('0x65')]['mapKey']]=_0x13e284[_0x727c('0x65')][_0x727c('0x7e')];})['then'](function(){return db[_0x727c('0x3f')][_0x727c('0x5c')]({'where':{'id':_0x13e284[_0x727c('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x727c('0x84'),'include':[{'model':db['CmContact'],'as':_0x727c('0x85'),'where':_0x4fa334,'limit':0x1,'order':[['updatedAt',_0x727c('0x86')]]}]},{'model':db[_0x727c('0x87')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x23dbcf,null))[_0x727c('0x34')](function(_0x4439cc){if(_0x4439cc&&_0x4439cc[_0x727c('0x84')]){_0x306c76[_0x727c('0x88')]=_0x4439cc;_0x306c76['applications']=_0x4439cc[_0x727c('0x89')];_0x306c76[_0x727c('0x8a')]=_0x4439cc[_0x727c('0x84')];_0x306c76[_0x727c('0x8b')]=_['orderBy'](_0x306c76['applications'],[_0x727c('0x8c')],[_0x727c('0x8d')]);if(_0x306c76[_0x727c('0x88')][_0x727c('0x89')]){delete _0x306c76[_0x727c('0x88')]['Applications'];}if(_0x306c76[_0x727c('0x88')][_0x727c('0x84')]&&_0x306c76[_0x727c('0x88')]['List']['Contacts']['length']){return _0x306c76[_0x727c('0x88')][_0x727c('0x84')][_0x727c('0x85')][0x0];}var _0x228148=_[_0x727c('0x19')](_0x13e284[_0x727c('0x65')],{'firstName':_0x13e284[_0x727c('0x65')]['from'],'ListId':_0x4439cc['ListId']});_0x228148[_0x13e284['body']['mapKey']]=_0x13e284[_0x727c('0x65')][_0x727c('0x7e')];return db[_0x727c('0x74')][_0x727c('0x5d')](_0x228148,{'fields':_0x1aeeb1,'raw':!![]});}})[_0x727c('0x34')](handleEntityNotFound(_0x23dbcf,null))[_0x727c('0x34')](function(_0x32d338){_0x306c76[_0x727c('0x8e')]=_0x32d338;if(_0x32d338){var _0x466286={'ContactId':_0x32d338['id'],'OpenchannelAccountId':_0x13e284['params']['id'],'from':(_0x32d338[_0x727c('0x8f')]||'')+'\x20'+(_0x32d338[_0x727c('0x90')]||'')};var _0x4900af={'OpenchannelAccountId':_0x13e284[_0x727c('0x5a')]['id'],'closed':![]};if(_0x13e284[_0x727c('0x65')][_0x727c('0x91')]){_0x4900af['threadId']=_0x13e284[_0x727c('0x65')][_0x727c('0x91')];return db['OpenchannelInteraction'][_0x727c('0x5c')]({'where':_0x4900af})['then'](function(_0x46eb1d){if(_0x46eb1d){return[_0x46eb1d,![]];}_0x466286['threadId']=_0x13e284[_0x727c('0x65')][_0x727c('0x91')];_0x466286[_0x727c('0x92')]=_0x13e284['body'][_0x727c('0x92')];return db['OpenchannelInteraction']['create'](_0x466286)[_0x727c('0x34')](function(_0x4dfd44){return[_0x4dfd44,!![]];});});}else{_0x4900af[_0x727c('0x91')]=null;}_0x4900af[_0x727c('0x93')]=_0x32d338['id'];return db[_0x727c('0x94')][_0x727c('0x5c')]({'where':_0x4900af})['then'](function(_0x1ba194){if(_0x1ba194){return[_0x1ba194,![]];}return db[_0x727c('0x94')][_0x727c('0x5d')](_0x466286)[_0x727c('0x34')](function(_0x465447){return[_0x465447,!![]];});});}})[_0x727c('0x95')](function(_0x5b4668,_0x1e4bc0){if(_0x5b4668){_0x3432f9=_0x1e4bc0;if(!_0x1e4bc0){var _0x4871d6={'from':(_0x306c76[_0x727c('0x8e')][_0x727c('0x8f')]||'')+'\x20'+(_0x306c76[_0x727c('0x8e')]['lastName']||'')};if(_0x13e284[_0x727c('0x65')][_0x727c('0x91')]&&_0x13e284['body'][_0x727c('0x96')]&&_0x13e284[_0x727c('0x65')][_0x727c('0x91')]!=_0x13e284[_0x727c('0x65')]['messageId']){_0x4871d6[_0x727c('0x91')]=_0x13e284['body']['messageId'];}return _0x5b4668['update'](_0x4871d6);}else{return _0x5b4668;}}})[_0x727c('0x34')](function(_0x2a7bb5){_0x306c76[_0x727c('0x97')]=_0x2a7bb5['get']({'plain':!![]});_0x306c76[_0x727c('0x97')][_0x727c('0x98')]=_0x3432f9;if(_0x306c76[_0x727c('0x97')][_0x727c('0x98')]){if(_0x306c76[_0x727c('0x88')][_0x727c('0x99')]){_0x306c76[_0x727c('0x8b')][_0x727c('0x9a')]({'id':0x0,'priority':_0x306c76['applications'][_0x727c('0x4a')]+0x1,'app':_0x727c('0x9b'),'appdata':_0x727c('0x9c'),'interval':_0x727c('0x9d')});}}return db['OpenchannelMessage']['create']({'body':_0x13e284['body'][_0x727c('0x65')],'OpenchannelAccountId':_0x13e284[_0x727c('0x5a')]['id'],'OpenchannelInteractionId':_0x2a7bb5['id'],'direction':'in','ContactId':_0x306c76[_0x727c('0x8e')]['id'],'AttachmentId':_0x13e284[_0x727c('0x65')][_0x727c('0x9e')]});})[_0x727c('0x34')](function(_0x26873c){_0x306c76['message']=_0x26873c;if(_0x306c76[_0x727c('0x97')]['UserId']){return db['User'][_0x727c('0x5c')]({'attributes':['id','name'],'where':{'id':_0x306c76['interaction'][_0x727c('0x9f')]}})[_0x727c('0x34')](function(_0x327078){if(_0x327078){_0x306c76[_0x727c('0x8b')][_0x727c('0xa0')]({'id':0x0,'priority':0x0,'app':_0x727c('0xa1'),'appdata':_0x327078[_0x727c('0x54')]+','+(_0x306c76[_0x727c('0x88')][_0x727c('0xa2')]||0xa),'interval':_0x727c('0x9d')});_0x306c76['forcedOwnership']=![];}return respondWithRpcPromise(_0x727c('0xa3'),'startRouting',_0x306c76);});}return respondWithRpcPromise(_0x727c('0xa3'),'startRouting',_0x306c76);})[_0x727c('0x34')](function(_0x6f35df){respondWithRpcPromise(_0x727c('0xa4'),_0x727c('0xa4'),{'event':'notify','message':_0x6f35df},client9002);return _0x6f35df;})[_0x727c('0x34')](respondWithResult(_0x23dbcf,null))[_0x727c('0x29')](handleError(_0x23dbcf,null));};exports[_0x727c('0xa5')]=function(_0x40b1bf,_0x2b3d66){var _0x54db6e=_0x40b1bf[_0x727c('0x5a')]['id'];var _0x2e4ac9=_0x40b1bf['body'];var _0x50692c=0xc8;var _0x1df505=null;return db[_0x727c('0xa6')][_0x727c('0xa7')]({'isolationLevel':db['sequelize'][_0x727c('0xa8')][_0x727c('0xa9')][_0x727c('0xaa')]},function(_0x545edd){return db[_0x727c('0x3f')]['findOne']({'where':{'id':_0x54db6e},'transaction':_0x545edd})[_0x727c('0x34')](function(_0x274ea4){if(_0x274ea4){return db[_0x727c('0x87')][_0x727c('0x66')]({'where':{'OpenchannelAccountId':_0x54db6e},'transaction':_0x545edd})[_0x727c('0x34')](function(){var _0x6cb090=_[_0x727c('0x3e')](_0x2e4ac9,function(_0xd42cd9){_0xd42cd9[_0x727c('0x68')]=_0x54db6e;return _0xd42cd9;});return db['OpenchannelApplication'][_0x727c('0xab')](_0x6cb090,{'transaction':_0x545edd});});}else{_0x50692c=0x194;_0x1df505=[];}});})[_0x727c('0x34')](function(){if(_0x50692c!==0x194){return db[_0x727c('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x54db6e},'order':_0x727c('0x8c')})[_0x727c('0x34')](function(_0x341264){_0x1df505=_0x341264;});}})[_0x727c('0x29')](function(_0x506b43){_0x50692c=0x1f4;logger[_0x727c('0x25')](_0x506b43[_0x727c('0x39')]);if(_0x506b43[_0x727c('0x54')]){delete _0x506b43[_0x727c('0x54')];}_0x1df505=_0x506b43;})[_0x727c('0xac')](function(){if(_0x1df505===null){_0x2b3d66[_0x727c('0x2a')](_0x50692c);}else{if(_0x50692c===0x1f4){_0x2b3d66[_0x727c('0x2b')](_0x50692c)[_0x727c('0x3a')](_0x1df505);}else{_0x2b3d66[_0x727c('0x2b')](_0x50692c)['json'](_0x1df505);}}});};exports['getApplications']=function(_0x4b648c,_0x419781,_0x2c8ce4){var _0x4ee0db={};var _0x2e736c={};var _0x206070;var _0x327add;return db['OpenchannelAccount'][_0x727c('0x6b')]({'where':{'id':_0x4b648c[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x419781,null))[_0x727c('0x34')](function(_0xac2019){if(_0xac2019){_0x206070=_0xac2019;_0x2e736c[_0x727c('0x43')]=_['keys'](db[_0x727c('0x87')]['rawAttributes']);_0x2e736c[_0x727c('0x44')]=_[_0x727c('0x45')](_0x4b648c[_0x727c('0x44')]);_0x2e736c[_0x727c('0x46')]=_[_0x727c('0x48')](_0x2e736c[_0x727c('0x43')],_0x2e736c[_0x727c('0x44')]);_0x4ee0db[_0x727c('0x47')]=_[_0x727c('0x48')](_0x2e736c[_0x727c('0x43')],qs[_0x727c('0x49')](_0x4b648c[_0x727c('0x44')][_0x727c('0x49')]));_0x4ee0db[_0x727c('0x47')]=_0x4ee0db[_0x727c('0x47')][_0x727c('0x4a')]?_0x4ee0db['attributes']:_0x2e736c[_0x727c('0x43')];_0x4ee0db['order']=qs['sort'](_0x4b648c[_0x727c('0x44')][_0x727c('0x4f')]);_0x4ee0db['where']=qs[_0x727c('0x46')](_[_0x727c('0x71')](_0x4b648c[_0x727c('0x44')],_0x2e736c[_0x727c('0x46')]));if(_0x4b648c['query']['filter']){_0x4ee0db[_0x727c('0x50')]=_[_0x727c('0x52')](_0x4ee0db[_0x727c('0x50')],{'$or':_[_0x727c('0x3e')](_0x4ee0db[_0x727c('0x47')],function(_0x2a3e7e){var _0x1c1783={};_0x1c1783[_0x2a3e7e]={'$like':'%'+_0x4b648c['query'][_0x727c('0x51')]+'%'};return _0x1c1783;})});}_0x4ee0db=_['merge']({},_0x4ee0db,_0x4b648c['options']);return _0x206070[_0x727c('0xad')](_0x4ee0db);}})['then'](function(_0x582a98){if(_0x582a98){_0x327add=_0x582a98[_0x727c('0x4a')];if(!_0x4b648c[_0x727c('0x44')][_0x727c('0x4b')](_0x727c('0x4c'))){_0x4ee0db[_0x727c('0x4d')]=qs[_0x727c('0x4d')](_0x4b648c[_0x727c('0x44')][_0x727c('0x4d')]);_0x4ee0db['offset']=qs[_0x727c('0x2f')](_0x4b648c[_0x727c('0x44')]['offset']);}return _0x206070['getApplications'](_0x4ee0db);}})[_0x727c('0x34')](function(_0x360b86){if(_0x360b86){return _0x360b86?{'count':_0x327add,'rows':_0x360b86}:null;}})[_0x727c('0x34')](respondWithResult(_0x419781,null))['catch'](handleError(_0x419781,null));};exports[_0x727c('0xae')]=function(_0x160577,_0x5d7ad0,_0x5099a8){var _0x2a3253={'raw':![],'where':{}};var _0x408571={};var _0x1ccaa8={'count':0x0,'rows':[]};return db[_0x727c('0x3f')][_0x727c('0x6b')]({'where':{'id':_0x160577[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x5d7ad0,null))[_0x727c('0x34')](function(_0x4f17b5){if(_0x4f17b5){_0x408571[_0x727c('0x43')]=_[_0x727c('0x45')](db['OpenchannelInteraction']['rawAttributes']);_0x408571[_0x727c('0x44')]=_[_0x727c('0x45')](_0x160577[_0x727c('0x44')]);_0x408571[_0x727c('0x46')]=_[_0x727c('0x48')](_0x408571['model'],_0x408571['query']);_0x2a3253[_0x727c('0x47')]=_[_0x727c('0x48')](_0x408571[_0x727c('0x43')],qs[_0x727c('0x49')](_0x160577[_0x727c('0x44')][_0x727c('0x49')]));_0x2a3253['attributes']=_0x2a3253[_0x727c('0x47')]['length']?_0x2a3253[_0x727c('0x47')]:_0x408571[_0x727c('0x43')];if(!_0x160577[_0x727c('0x44')][_0x727c('0x4b')](_0x727c('0x4c'))){_0x2a3253[_0x727c('0x4d')]=qs[_0x727c('0x4d')](_0x160577[_0x727c('0x44')][_0x727c('0x4d')]);_0x2a3253[_0x727c('0x2f')]=qs[_0x727c('0x2f')](_0x160577['query']['offset']);}_0x2a3253[_0x727c('0x4e')]=qs[_0x727c('0x4f')](_0x160577[_0x727c('0x44')][_0x727c('0x4f')]);_0x2a3253[_0x727c('0x50')]=qs[_0x727c('0x46')](_['pick'](_0x160577['query'],_0x408571[_0x727c('0x46')]));_0x2a3253[_0x727c('0x50')]['OpenchannelAccountId']=_0x4f17b5['id'];if(_0x160577['query'][_0x727c('0x51')]){_0x2a3253[_0x727c('0x50')]=_[_0x727c('0x52')](_0x2a3253['where'],{'$or':_['map'](_0x2a3253['attributes'],function(_0x562bda){var _0x55249a={};_0x55249a[_0x562bda]={'$like':'%'+_0x160577[_0x727c('0x44')]['filter']+'%'};return _0x55249a;})});}_0x2a3253=_[_0x727c('0x52')]({},_0x2a3253,_0x160577[_0x727c('0x55')]);return db['OpenchannelInteraction'][_0x727c('0x2e')]({'where':_0x2a3253[_0x727c('0x50')]})['then'](function(_0x1c3a1f){_0x1ccaa8[_0x727c('0x2e')]=_0x1c3a1f;if(_0x160577[_0x727c('0x44')][_0x727c('0x5b')]){_0x2a3253['include']=[{'model':db[_0x727c('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x727c('0xaf'),'attributes':['name',_0x727c('0xb0'),_0x727c('0xb1')],'required':![]},{'model':db['Tag'],'as':_0x727c('0xb2'),'attributes':['id',_0x727c('0x54'),_0x727c('0xb3')],'where':_0x160577['query'][_0x727c('0xb4')]?{'id':_0x160577[_0x727c('0x44')]['tag']}:undefined,'required':_0x160577[_0x727c('0x44')][_0x727c('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x727c('0x57')](_0x2a3253);})[_0x727c('0x34')](function(_0x47e219){_0x1ccaa8['rows']=_0x47e219;return _0x1ccaa8;});}})[_0x727c('0x34')](respondWithFilteredResult(_0x5d7ad0,_0x2a3253))[_0x727c('0x29')](handleError(_0x5d7ad0,null));};exports['addAgents']=function(_0x27ae95,_0xef7b29,_0x434fea){return db['OpenchannelAccount'][_0x727c('0x5c')]({'where':{'id':_0x27ae95[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0xef7b29,null))['then'](function(_0x47c179){if(_0x47c179){return _0x47c179['addAgents'](_0x27ae95[_0x727c('0x65')][_0x727c('0x6d')],_[_0x727c('0xb5')](_0x27ae95[_0x727c('0x65')],[_0x727c('0x6d'),'id'])||{})[_0x727c('0x95')](function(_0x36ce9e){for(var _0x557376=0x0;_0x557376<_0x27ae95['body']['ids'][_0x727c('0x4a')];_0x557376+=0x1){socket[_0x727c('0xb6')](_0x727c('0xb7'),{'UserId':Number(_0x27ae95[_0x727c('0x65')]['ids'][_0x557376]),'OpenchannelAccountId':Number(_0x27ae95[_0x727c('0x5a')]['id'])});}return _0x36ce9e;});}})[_0x727c('0x34')](respondWithResult(_0xef7b29,null))[_0x727c('0x29')](handleError(_0xef7b29,null));};exports['removeAgents']=function(_0x53f571,_0x4f55db,_0x55b24e){return db[_0x727c('0x3f')][_0x727c('0x5c')]({'where':{'id':_0x53f571[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x4f55db,null))[_0x727c('0x34')](function(_0x396f6c){if(_0x396f6c){return _0x396f6c[_0x727c('0xb8')](_0x53f571[_0x727c('0x44')][_0x727c('0x6d')])[_0x727c('0x34')](function(){if(_[_0x727c('0xb9')](_0x53f571['query'][_0x727c('0x6d')])){for(var _0x3f21b4=0x0;_0x3f21b4<_0x53f571[_0x727c('0x44')]['ids'][_0x727c('0x4a')];_0x3f21b4+=0x1){socket[_0x727c('0xb6')](_0x727c('0xba'),{'UserId':Number(_0x53f571['query'][_0x727c('0x6d')][_0x3f21b4]),'OpenchannelAccountId':Number(_0x53f571[_0x727c('0x5a')]['id'])});}}else{socket[_0x727c('0xb6')](_0x727c('0xba'),{'UserId':Number(_0x53f571[_0x727c('0x44')][_0x727c('0x6d')]),'OpenchannelAccountId':Number(_0x53f571[_0x727c('0x5a')]['id'])});}});}})[_0x727c('0x34')](respondWithStatusCode(_0x4f55db,null))[_0x727c('0x29')](handleError(_0x4f55db,null));};exports[_0x727c('0xbb')]=function(_0x599e14,_0x31260e,_0x513262){var _0x2fd100={};var _0x5bb00d={};var _0x2bf51c;var _0x38c999;return db[_0x727c('0x3f')][_0x727c('0x6b')]({'where':{'id':_0x599e14['params']['id']}})['then'](handleEntityNotFound(_0x31260e,null))[_0x727c('0x34')](function(_0x28c43b){if(_0x28c43b){_0x2bf51c=_0x28c43b;_0x5bb00d[_0x727c('0x43')]=_[_0x727c('0x45')](db[_0x727c('0xbc')][_0x727c('0x40')]);_0x5bb00d[_0x727c('0x44')]=_['keys'](_0x599e14['query']);_0x5bb00d[_0x727c('0x46')]=_[_0x727c('0x48')](_0x5bb00d[_0x727c('0x43')],_0x5bb00d[_0x727c('0x44')]);_0x2fd100[_0x727c('0x47')]=_[_0x727c('0x48')](_0x5bb00d[_0x727c('0x43')],qs['fields'](_0x599e14[_0x727c('0x44')][_0x727c('0x49')]));_0x2fd100['attributes']=_0x2fd100['attributes'][_0x727c('0x4a')]?_0x2fd100['attributes']:_0x5bb00d['model'];_0x2fd100[_0x727c('0x4e')]=qs[_0x727c('0x4f')](_0x599e14[_0x727c('0x44')][_0x727c('0x4f')]);_0x2fd100[_0x727c('0x50')]=qs[_0x727c('0x46')](_[_0x727c('0x71')](_0x599e14[_0x727c('0x44')],_0x5bb00d[_0x727c('0x46')]));if(_0x599e14[_0x727c('0x44')][_0x727c('0x51')]){_0x2fd100[_0x727c('0x50')]=_['merge'](_0x2fd100[_0x727c('0x50')],{'$or':_[_0x727c('0x3e')](_0x2fd100[_0x727c('0x47')],function(_0x4d1296){var _0x3bff0b={};_0x3bff0b[_0x4d1296]={'$like':'%'+_0x599e14[_0x727c('0x44')][_0x727c('0x51')]+'%'};return _0x3bff0b;})});}_0x2fd100=_[_0x727c('0x52')]({},_0x2fd100,_0x599e14[_0x727c('0x55')]);return _0x2bf51c[_0x727c('0xbb')](_0x2fd100);}})[_0x727c('0x34')](function(_0x2841cf){if(_0x2841cf){_0x38c999=_0x2841cf[_0x727c('0x4a')];if(!_0x599e14[_0x727c('0x44')][_0x727c('0x4b')](_0x727c('0x4c'))){_0x2fd100[_0x727c('0x4d')]=qs[_0x727c('0x4d')](_0x599e14[_0x727c('0x44')]['limit']);_0x2fd100[_0x727c('0x2f')]=qs[_0x727c('0x2f')](_0x599e14['query'][_0x727c('0x2f')]);}return _0x2bf51c[_0x727c('0xbb')](_0x2fd100);}})['then'](function(_0x1f68df){if(_0x1f68df){return _0x1f68df?{'count':_0x38c999,'rows':_0x1f68df}:null;}})[_0x727c('0x34')](respondWithResult(_0x31260e,null))['catch'](handleError(_0x31260e,null));};exports[_0x727c('0x3a')]=function(_0x520d2d,_0x26cb80,_0x2af0b5){var _0x9fc20a,_0x3655e6,_0x2846f3;if(_[_0x727c('0x7d')](_0x520d2d[_0x727c('0x65')][_0x727c('0x65')])||_0x520d2d[_0x727c('0x65')][_0x727c('0x65')]===''){throw new db[(_0x727c('0x75'))][(_0x727c('0x76'))](_0x727c('0xbd'));}if(_['isNil'](_0x520d2d[_0x727c('0x65')]['to'])){}_0x9fc20a=_0x520d2d['body']['to'];return db[_0x727c('0x3f')][_0x727c('0x6b')]({'where':{'id':_0x520d2d[_0x727c('0x5a')]['id']}})[_0x727c('0x34')](handleEntityNotFound(_0x26cb80,null))[_0x727c('0x34')](function(_0x1cb63b){if(_0x1cb63b){return db[_0x727c('0x3f')][_0x727c('0x5c')]({'where':{'id':_0x1cb63b['id']},'include':[{'model':db[_0x727c('0xbe')],'as':_0x727c('0x84'),'include':[{'model':db[_0x727c('0x74')],'as':'Contacts','where':{[_0x1cb63b[_0x727c('0x80')]]:_0x9fc20a},'limit':0x1,'order':[[_0x727c('0x7a'),_0x727c('0x86')]]}]}]})['then'](handleEntityNotFound(_0x26cb80,null))[_0x727c('0x34')](function(_0x1536c4){if(_0x1536c4&&_0x1536c4['List']){_0x3655e6=_0x1536c4[_0x727c('0x35')]({'plain':!![]});if(_0x3655e6['List']&&_0x3655e6[_0x727c('0x84')][_0x727c('0x85')][_0x727c('0x4a')]){return _0x3655e6[_0x727c('0x84')]['Contacts'][0x0];}return db[_0x727c('0x74')][_0x727c('0x5d')](_[_0x727c('0x19')](_0x520d2d[_0x727c('0x65')],{'firstName':_0x9fc20a,[_0x1536c4['mapKey']]:_0x9fc20a,'phone':_0x9fc20a,'ListId':_0x3655e6[_0x727c('0x7c')]}));}})[_0x727c('0x34')](handleEntityNotFound(_0x26cb80,null))['then'](function(_0x32d49a){if(_0x32d49a){_0x2846f3=_0x32d49a;return db['OpenchannelInteraction'][_0x727c('0x5c')]({'where':{'ContactId':_0x2846f3['id'],'closed':![],'OpenchannelAccountId':_0x3655e6['id']}})[_0x727c('0x34')](function(_0x1d0bfd){if(_0x1d0bfd){return[_0x1d0bfd,![]];}return db[_0x727c('0x94')][_0x727c('0x5d')]({'UserId':_0x520d2d['user']['id'],'ContactId':_0x2846f3['id'],'OpenchannelAccountId':_0x3655e6['id'],'lastMsgDirection':_0x727c('0xbf'),'firstMsgDirection':'out','Messages':[_[_0x727c('0x52')](_0x520d2d[_0x727c('0x65')],{'read':![],'body':_0x520d2d['body'][_0x727c('0x65')],'OpenchannelAccountId':_0x3655e6['id'],'UserId':_0x520d2d[_0x727c('0x5e')]['id'],'ContactId':_0x2846f3['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x727c('0x34')](function(_0x2d4c66){return[_0x2d4c66,!![]];});});}})['spread'](function(_0x5e29ff,_0x82c4fd){if(_0x82c4fd){return _0x5e29ff;}return db[_0x727c('0xc0')][_0x727c('0x5d')](_[_0x727c('0x52')](_0x520d2d[_0x727c('0x65')],{'read':![],'body':_0x520d2d[_0x727c('0x65')][_0x727c('0x65')],'OpenchannelAccountId':_0x3655e6['id'],'OpenchannelInteractionId':_0x5e29ff['id'],'UserId':_0x520d2d[_0x727c('0x5e')]['id'],'ContactId':_0x2846f3['id']}))[_0x727c('0x34')](function(_0x1c438f){_0x5e29ff[_0x727c('0xc1')]['Messages']=[];_0x5e29ff[_0x727c('0xc1')]['Messages'][_0x727c('0x9a')](_0x1c438f[_0x727c('0xc1')]);return _0x5e29ff;});});}})['then'](respondWithResult(_0x26cb80,null))[_0x727c('0x29')](handleError(_0x26cb80,null));};
\ No newline at end of file
+var _0x3248=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','contact','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','finally','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','OpenchannelAccount','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','mandatoryDispositionPause','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3248,0x1bc));var _0x8324=function(_0xe5e849,_0x35f26a){_0xe5e849=_0xe5e849-0x0;var _0xec9fe=_0x3248[_0xe5e849];return _0xec9fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8324('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8324('0x1'));var moment=require(_0x8324('0x2'));var BPromise=require(_0x8324('0x3'));var Mustache=require(_0x8324('0x4'));var util=require(_0x8324('0x5'));var path=require(_0x8324('0x6'));var sox=require('sox');var csv=require(_0x8324('0x7'));var ejs=require(_0x8324('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8324('0x9'));var squel=require(_0x8324('0xa'));var crypto=require(_0x8324('0xb'));var jsforce=require(_0x8324('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8324('0x7'));var querystring=require(_0x8324('0xd'));var Papa=require(_0x8324('0xe'));var Redis=require(_0x8324('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8324('0x10'));var as=require(_0x8324('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8324('0x12'))(_0x8324('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8324('0x14'))['db'];config[_0x8324('0x15')]=_[_0x8324('0x16')](config[_0x8324('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x8324('0x17'))(new Redis(config[_0x8324('0x15')]));require(_0x8324('0x18'))[_0x8324('0x19')](socket);var jayson=require(_0x8324('0x1a'));var client=jayson['client'][_0x8324('0x1b')]({'port':0x232c});var client9002=jayson[_0x8324('0x1c')][_0x8324('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3b1a18,_0x3f8f66,_0x5ecb20,_0x8da92c){return new BPromise(function(_0xaf20a5,_0x2c5ab2){var _0x3ea132=_0x8da92c||client;return _0x3ea132['request'](_0x3b1a18,_0x5ecb20)['then'](function(_0x47b5e1){logger['info'](_0x8324('0x1d'),_0x3f8f66,_0x8324('0x1e'));logger[_0x8324('0x1f')](_0x8324('0x20'),_0x3f8f66,'request\x20sent',JSON[_0x8324('0x21')](_0x47b5e1));if(_0x47b5e1[_0x8324('0x22')]){if(_0x47b5e1[_0x8324('0x22')][_0x8324('0x23')]===0x1f4){logger[_0x8324('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f8f66,_0x47b5e1[_0x8324('0x22')][_0x8324('0x24')]);return _0x2c5ab2(_0x47b5e1[_0x8324('0x22')]['message']);}logger[_0x8324('0x22')](_0x8324('0x1d'),_0x3f8f66,_0x47b5e1[_0x8324('0x22')][_0x8324('0x24')]);return _0xaf20a5(_0x47b5e1[_0x8324('0x22')]['message']);}else{logger[_0x8324('0x25')](_0x8324('0x1d'),_0x3f8f66,'request\x20sent');_0xaf20a5(_0x47b5e1[_0x8324('0x26')][_0x8324('0x24')]);}})[_0x8324('0x27')](function(_0x43717d){logger[_0x8324('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f8f66,_0x43717d);_0x2c5ab2(_0x43717d);});});}function respondWithStatusCode(_0x575845,_0x3e5233){_0x3e5233=_0x3e5233||0xcc;return function(_0x3569db){if(_0x3569db){return _0x575845[_0x8324('0x28')](_0x3e5233);}return _0x575845[_0x8324('0x29')](_0x3e5233)[_0x8324('0x2a')]();};}function respondWithResult(_0x41e2fd,_0x5b2a1a){_0x5b2a1a=_0x5b2a1a||0xc8;return function(_0x329ccc){if(_0x329ccc){return _0x41e2fd['status'](_0x5b2a1a)['json'](_0x329ccc);}};}function respondWithFilteredResult(_0x3f8f4b,_0x3afd87){return function(_0x28ba63){if(_0x28ba63){var _0x2cf245=typeof _0x3afd87[_0x8324('0x2b')]==='undefined'&&typeof _0x3afd87['limit']===_0x8324('0x2c');var _0x57cf98=_0x28ba63['count'];var _0x562798=_0x2cf245?0x0:_0x3afd87['offset'];var _0x4f67b0=_0x2cf245?_0x28ba63[_0x8324('0x2d')]:_0x3afd87[_0x8324('0x2b')]+_0x3afd87[_0x8324('0x2e')];var _0x6e06dd;if(_0x4f67b0>=_0x57cf98){_0x4f67b0=_0x57cf98;_0x6e06dd=0xc8;}else{_0x6e06dd=0xce;}_0x3f8f4b['status'](_0x6e06dd);return _0x3f8f4b[_0x8324('0x2f')](_0x8324('0x30'),_0x562798+'-'+_0x4f67b0+'/'+_0x57cf98)[_0x8324('0x31')](_0x28ba63);}return null;};}function patchUpdates(_0x509589){return function(_0x446b4f){try{jsonpatch[_0x8324('0x32')](_0x446b4f,_0x509589,!![]);}catch(_0x9c769){return BPromise['reject'](_0x9c769);}return _0x446b4f[_0x8324('0x33')]();};}function saveUpdates(_0x33bbd7,_0x5a59d9){return function(_0x134dcc){if(_0x134dcc){return _0x134dcc[_0x8324('0x34')](_0x33bbd7)[_0x8324('0x35')](function(_0x70f40f){return _0x70f40f;});}return null;};}function removeEntity(_0x4abc44,_0x200889){return function(_0x8d8ab3){if(_0x8d8ab3){return _0x8d8ab3[_0x8324('0x36')]()[_0x8324('0x35')](function(){var _0x2ac8ca=_0x8d8ab3[_0x8324('0x37')]({'plain':!![]});var _0x57d38d=_0x8324('0x38');return db[_0x8324('0x39')][_0x8324('0x36')]({'where':{'type':_0x57d38d,'resourceId':_0x2ac8ca['id']}})[_0x8324('0x35')](function(){return _0x8d8ab3;});})[_0x8324('0x35')](function(){_0x4abc44[_0x8324('0x29')](0xcc)[_0x8324('0x2a')]();});}};}function handleEntityNotFound(_0x541868,_0x1f37b7){return function(_0x459cb1){if(!_0x459cb1){_0x541868[_0x8324('0x28')](0x194);}return _0x459cb1;};}function handleError(_0x231dd9,_0x2dea70){_0x2dea70=_0x2dea70||0x1f4;return function(_0x135bde){logger[_0x8324('0x22')](_0x135bde[_0x8324('0x3a')]);if(_0x135bde['name']){delete _0x135bde[_0x8324('0x3b')];}_0x231dd9[_0x8324('0x29')](_0x2dea70)[_0x8324('0x3c')](_0x135bde);};}exports[_0x8324('0x3d')]=function(_0x23a6d8,_0x2df903){var _0x1fb84f={'include':[{'model':db[_0x8324('0x3e')],'as':'mandatoryDispositionPause'}]},_0xdf610a={},_0x158b19={'count':0x0,'rows':[]};var _0x3ecc37=_[_0x8324('0x3f')](db[_0x8324('0x40')]['rawAttributes'],function(_0x44e349){return{'name':_0x44e349[_0x8324('0x41')],'type':_0x44e349[_0x8324('0x42')]['key']};});_0xdf610a[_0x8324('0x43')]=_[_0x8324('0x3f')](_0x3ecc37,'name');_0xdf610a['query']=_['keys'](_0x23a6d8[_0x8324('0x44')]);_0xdf610a['filters']=_[_0x8324('0x45')](_0xdf610a[_0x8324('0x43')],_0xdf610a[_0x8324('0x44')]);_0x1fb84f[_0x8324('0x46')]=_[_0x8324('0x45')](_0xdf610a[_0x8324('0x43')],qs[_0x8324('0x47')](_0x23a6d8['query'][_0x8324('0x47')]));_0x1fb84f[_0x8324('0x46')]=_0x1fb84f[_0x8324('0x46')][_0x8324('0x48')]?_0x1fb84f[_0x8324('0x46')]:_0xdf610a['model'];if(!_0x23a6d8[_0x8324('0x44')][_0x8324('0x49')](_0x8324('0x4a'))){_0x1fb84f[_0x8324('0x2e')]=qs[_0x8324('0x2e')](_0x23a6d8[_0x8324('0x44')]['limit']);_0x1fb84f[_0x8324('0x2b')]=qs[_0x8324('0x2b')](_0x23a6d8['query'][_0x8324('0x2b')]);}_0x1fb84f[_0x8324('0x4b')]=qs['sort'](_0x23a6d8[_0x8324('0x44')][_0x8324('0x4c')]);_0x1fb84f[_0x8324('0x4d')]=qs[_0x8324('0x4e')](_[_0x8324('0x4f')](_0x23a6d8[_0x8324('0x44')],_0xdf610a[_0x8324('0x4e')]),_0x3ecc37);if(_0x23a6d8[_0x8324('0x44')][_0x8324('0x50')]){_0x1fb84f['where']=_[_0x8324('0x51')](_0x1fb84f[_0x8324('0x4d')],{'$or':_[_0x8324('0x3f')](_0x3ecc37,function(_0x4bafe6){if(_0x4bafe6[_0x8324('0x42')]!==_0x8324('0x52')){var _0x489b2a={};_0x489b2a[_0x4bafe6[_0x8324('0x3b')]]={'$like':'%'+_0x23a6d8[_0x8324('0x44')]['filter']+'%'};return _0x489b2a;}})});}_0x1fb84f=_['merge']({},_0x1fb84f,_0x23a6d8['options']);var _0x528749={'where':_0x1fb84f[_0x8324('0x4d')]};return db['OpenchannelAccount'][_0x8324('0x2d')](_0x528749)[_0x8324('0x35')](function(_0x6b9fae){_0x158b19[_0x8324('0x2d')]=_0x6b9fae;if(_0x23a6d8[_0x8324('0x44')][_0x8324('0x53')]){_0x1fb84f['include']=[{'all':!![]}];}return db[_0x8324('0x40')][_0x8324('0x54')](_0x1fb84f);})[_0x8324('0x35')](function(_0x3e2d15){_0x158b19[_0x8324('0x55')]=_0x3e2d15;return _0x158b19;})[_0x8324('0x35')](respondWithFilteredResult(_0x2df903,_0x1fb84f))['catch'](handleError(_0x2df903,null));};exports[_0x8324('0x56')]=function(_0x4b7de6,_0x33c0af){var _0x93a07b={'raw':![],'where':{'id':_0x4b7de6[_0x8324('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x8324('0x58')}]},_0x3aee16={};_0x3aee16[_0x8324('0x43')]=_[_0x8324('0x59')](db[_0x8324('0x40')]['rawAttributes']);_0x3aee16[_0x8324('0x44')]=_[_0x8324('0x59')](_0x4b7de6['query']);_0x3aee16['filters']=_[_0x8324('0x45')](_0x3aee16[_0x8324('0x43')],_0x3aee16['query']);_0x93a07b[_0x8324('0x46')]=_[_0x8324('0x45')](_0x3aee16[_0x8324('0x43')],qs['fields'](_0x4b7de6[_0x8324('0x44')][_0x8324('0x47')]));_0x93a07b[_0x8324('0x46')]=_0x93a07b[_0x8324('0x46')][_0x8324('0x48')]?_0x93a07b[_0x8324('0x46')]:_0x3aee16[_0x8324('0x43')];if(_0x4b7de6[_0x8324('0x44')][_0x8324('0x53')]){_0x93a07b[_0x8324('0x5a')]=[{'all':!![]}];}_0x93a07b=_[_0x8324('0x51')]({},_0x93a07b,_0x4b7de6[_0x8324('0x5b')]);return db[_0x8324('0x40')][_0x8324('0x5c')](_0x93a07b)['then'](handleEntityNotFound(_0x33c0af,null))[_0x8324('0x35')](respondWithResult(_0x33c0af,null))[_0x8324('0x27')](handleError(_0x33c0af,null));};exports['create']=function(_0xa43499,_0x24a2e6){return db[_0x8324('0x40')][_0x8324('0x5d')](_0xa43499['body'],{})[_0x8324('0x35')](function(_0x826085){var _0x35b37e=_0xa43499[_0x8324('0x5e')][_0x8324('0x37')]({'plain':!![]});if(!_0x35b37e)throw new Error(_0x8324('0x5f'));if(_0x35b37e[_0x8324('0x60')]===_0x8324('0x5e')){var _0x5b38d8=_0x826085[_0x8324('0x37')]({'plain':!![]});var _0x328f43='OpenchannelAccounts';return db[_0x8324('0x61')][_0x8324('0x5c')]({'where':{'name':_0x328f43,'userProfileId':_0x35b37e[_0x8324('0x62')]},'raw':!![]})[_0x8324('0x35')](function(_0xbf76f8){if(_0xbf76f8&&_0xbf76f8[_0x8324('0x63')]===0x0){return db['UserProfileResource'][_0x8324('0x5d')]({'name':_0x5b38d8['name'],'resourceId':_0x5b38d8['id'],'type':_0xbf76f8[_0x8324('0x3b')],'sectionId':_0xbf76f8['id']},{})[_0x8324('0x35')](function(){return _0x826085;});}else{return _0x826085;}})[_0x8324('0x27')](function(_0x3288d6){logger[_0x8324('0x22')](_0x8324('0x64'),_0x3288d6);throw _0x3288d6;});}return _0x826085;})[_0x8324('0x35')](respondWithResult(_0x24a2e6,0xc9))[_0x8324('0x27')](handleError(_0x24a2e6,null));};exports[_0x8324('0x34')]=function(_0x200e18,_0x1b9148){if(_0x200e18[_0x8324('0x65')]['id']){delete _0x200e18[_0x8324('0x65')]['id'];}return db['OpenchannelAccount'][_0x8324('0x5c')]({'where':{'id':_0x200e18['params']['id']},'include':[{'model':db[_0x8324('0x3e')],'as':_0x8324('0x58')}]})['then'](handleEntityNotFound(_0x1b9148,null))[_0x8324('0x35')](saveUpdates(_0x200e18[_0x8324('0x65')],null))[_0x8324('0x35')](respondWithResult(_0x1b9148,null))[_0x8324('0x27')](handleError(_0x1b9148,null));};exports[_0x8324('0x36')]=function(_0x56a536,_0x59fc5c){return db['OpenchannelAccount'][_0x8324('0x5c')]({'where':{'id':_0x56a536['params']['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x59fc5c,null))[_0x8324('0x35')](removeEntity(_0x59fc5c,null))['catch'](handleError(_0x59fc5c,null));};exports[_0x8324('0x66')]=function(_0x32c619,_0x170664){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x170664,null))[_0x8324('0x27')](handleError(_0x170664,null));};exports[_0x8324('0x67')]=function(_0x804db3,_0x5e77e1,_0x367d45){if(_0x804db3['body']['id']){delete _0x804db3[_0x8324('0x65')]['id'];}return db[_0x8324('0x40')]['find']({'where':{'id':_0x804db3[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x5e77e1,null))[_0x8324('0x35')](function(_0x40d927){if(_0x40d927){_0x804db3[_0x8324('0x65')][_0x8324('0x68')]=_0x40d927['id'];return db[_0x8324('0x69')][_0x8324('0x5d')](_0x804db3[_0x8324('0x65')]);}})[_0x8324('0x35')](respondWithResult(_0x5e77e1,null))['catch'](handleError(_0x5e77e1,null));};exports[_0x8324('0x6a')]=function(_0x5653ac,_0x3a9696,_0x5eded9){var _0x2075c5={'raw':![],'where':{}};var _0x4d8416={};var _0x3674ce={'count':0x0,'rows':[]};return db[_0x8324('0x40')][_0x8324('0x6b')]({'where':{'id':_0x5653ac[_0x8324('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a9696,null))[_0x8324('0x35')](function(_0x4d6188){if(_0x4d6188){_0x4d8416[_0x8324('0x43')]=_[_0x8324('0x59')](db[_0x8324('0x69')][_0x8324('0x6c')]);_0x4d8416['query']=_['keys'](_0x5653ac[_0x8324('0x44')]);_0x4d8416[_0x8324('0x4e')]=_['intersection'](_0x4d8416[_0x8324('0x43')],_0x4d8416[_0x8324('0x44')]);_0x2075c5[_0x8324('0x46')]=_[_0x8324('0x45')](_0x4d8416[_0x8324('0x43')],qs[_0x8324('0x47')](_0x5653ac[_0x8324('0x44')][_0x8324('0x47')]));_0x2075c5[_0x8324('0x46')]=_0x2075c5[_0x8324('0x46')][_0x8324('0x48')]?_0x2075c5['attributes']:_0x4d8416[_0x8324('0x43')];if(!_0x5653ac[_0x8324('0x44')][_0x8324('0x49')](_0x8324('0x4a'))){_0x2075c5[_0x8324('0x2e')]=qs['limit'](_0x5653ac['query'][_0x8324('0x2e')]);_0x2075c5[_0x8324('0x2b')]=qs[_0x8324('0x2b')](_0x5653ac[_0x8324('0x44')][_0x8324('0x2b')]);}_0x2075c5[_0x8324('0x4b')]=qs[_0x8324('0x4c')](_0x5653ac[_0x8324('0x44')][_0x8324('0x4c')]);_0x2075c5[_0x8324('0x4d')]=qs[_0x8324('0x4e')](_[_0x8324('0x4f')](_0x5653ac[_0x8324('0x44')],_0x4d8416['filters']));_0x2075c5[_0x8324('0x4d')][_0x8324('0x68')]=_0x4d6188['id'];if(_0x5653ac[_0x8324('0x44')][_0x8324('0x50')]){_0x2075c5[_0x8324('0x4d')]=_[_0x8324('0x51')](_0x2075c5['where'],{'$or':_[_0x8324('0x3f')](_0x2075c5[_0x8324('0x46')],function(_0x432770){var _0x3e345d={};_0x3e345d[_0x432770]={'$like':'%'+_0x5653ac[_0x8324('0x44')]['filter']+'%'};return _0x3e345d;})});}_0x2075c5=_[_0x8324('0x51')]({},_0x2075c5,_0x5653ac[_0x8324('0x5b')]);return db[_0x8324('0x69')]['count']({'where':_0x2075c5[_0x8324('0x4d')]})[_0x8324('0x35')](function(_0x5d7942){_0x3674ce[_0x8324('0x2d')]=_0x5d7942;if(_0x5653ac['query']['includeAll']){_0x2075c5[_0x8324('0x5a')]=[{'all':!![]}];}return db[_0x8324('0x69')]['findAll'](_0x2075c5);})['then'](function(_0x166813){_0x3674ce[_0x8324('0x55')]=_0x166813;return _0x3674ce;});}})[_0x8324('0x35')](respondWithFilteredResult(_0x3a9696,_0x2075c5))['catch'](handleError(_0x3a9696,null));};exports['removeDispositions']=function(_0x1da881,_0x1e0cd4,_0xff03af){return db[_0x8324('0x40')][_0x8324('0x5c')]({'where':{'id':_0x1da881[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x1e0cd4,null))[_0x8324('0x35')](function(_0x565f8b){if(_0x565f8b){return _0x565f8b[_0x8324('0x6d')](_0x1da881[_0x8324('0x44')][_0x8324('0x6e')]);}})[_0x8324('0x35')](respondWithStatusCode(_0x1e0cd4,null))[_0x8324('0x27')](handleError(_0x1e0cd4,null));};exports[_0x8324('0x6f')]=function(_0x5d035c,_0x7dfc2,_0x1e1a26){if(_0x5d035c[_0x8324('0x65')]['id']){delete _0x5d035c[_0x8324('0x65')]['id'];}return db[_0x8324('0x40')]['find']({'where':{'id':_0x5d035c[_0x8324('0x57')]['id']}})['then'](handleEntityNotFound(_0x7dfc2,null))[_0x8324('0x35')](function(_0x209c03){if(_0x209c03){_0x5d035c[_0x8324('0x65')]['OpenchannelAccountId']=_0x209c03['id'];return db[_0x8324('0x70')][_0x8324('0x5d')](_0x5d035c['body']);}})[_0x8324('0x35')](respondWithResult(_0x7dfc2,null))[_0x8324('0x27')](handleError(_0x7dfc2,null));};exports[_0x8324('0x71')]=function(_0x294219,_0x1f2d59,_0x1ed463){var _0x4c64d4={'raw':![],'where':{}};var _0x1649e2={};var _0x2671cf={'count':0x0,'rows':[]};return db[_0x8324('0x40')][_0x8324('0x6b')]({'where':{'id':_0x294219[_0x8324('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f2d59,null))[_0x8324('0x35')](function(_0x1d3ea2){if(_0x1d3ea2){_0x1649e2[_0x8324('0x43')]=_[_0x8324('0x59')](db[_0x8324('0x70')]['rawAttributes']);_0x1649e2[_0x8324('0x44')]=_[_0x8324('0x59')](_0x294219['query']);_0x1649e2['filters']=_[_0x8324('0x45')](_0x1649e2[_0x8324('0x43')],_0x1649e2[_0x8324('0x44')]);_0x4c64d4[_0x8324('0x46')]=_[_0x8324('0x45')](_0x1649e2[_0x8324('0x43')],qs[_0x8324('0x47')](_0x294219[_0x8324('0x44')][_0x8324('0x47')]));_0x4c64d4[_0x8324('0x46')]=_0x4c64d4[_0x8324('0x46')][_0x8324('0x48')]?_0x4c64d4['attributes']:_0x1649e2[_0x8324('0x43')];if(!_0x294219[_0x8324('0x44')][_0x8324('0x49')](_0x8324('0x4a'))){_0x4c64d4[_0x8324('0x2e')]=qs[_0x8324('0x2e')](_0x294219['query'][_0x8324('0x2e')]);_0x4c64d4['offset']=qs[_0x8324('0x2b')](_0x294219['query'][_0x8324('0x2b')]);}_0x4c64d4[_0x8324('0x4b')]=qs[_0x8324('0x4c')](_0x294219[_0x8324('0x44')]['sort']);_0x4c64d4[_0x8324('0x4d')]=qs[_0x8324('0x4e')](_[_0x8324('0x4f')](_0x294219[_0x8324('0x44')],_0x1649e2[_0x8324('0x4e')]));_0x4c64d4[_0x8324('0x4d')][_0x8324('0x68')]=_0x1d3ea2['id'];if(_0x294219[_0x8324('0x44')][_0x8324('0x50')]){_0x4c64d4[_0x8324('0x4d')]=_[_0x8324('0x51')](_0x4c64d4['where'],{'$or':_[_0x8324('0x3f')](_0x4c64d4[_0x8324('0x46')],function(_0x35bbb4){var _0x52a16b={};_0x52a16b[_0x35bbb4]={'$like':'%'+_0x294219[_0x8324('0x44')][_0x8324('0x50')]+'%'};return _0x52a16b;})});}_0x4c64d4=_[_0x8324('0x51')]({},_0x4c64d4,_0x294219['options']);return db['CannedAnswer'][_0x8324('0x2d')]({'where':_0x4c64d4[_0x8324('0x4d')]})[_0x8324('0x35')](function(_0x2c0342){_0x2671cf['count']=_0x2c0342;if(_0x294219[_0x8324('0x44')][_0x8324('0x53')]){_0x4c64d4[_0x8324('0x5a')]=[{'all':!![]}];}return db[_0x8324('0x70')][_0x8324('0x54')](_0x4c64d4);})[_0x8324('0x35')](function(_0x1a51dd){_0x2671cf[_0x8324('0x55')]=_0x1a51dd;return _0x2671cf;});}})['then'](respondWithFilteredResult(_0x1f2d59,_0x4c64d4))[_0x8324('0x27')](handleError(_0x1f2d59,null));};exports[_0x8324('0x72')]=function(_0xa1286,_0x34d99b,_0x1a159c){return db[_0x8324('0x40')][_0x8324('0x5c')]({'where':{'id':_0xa1286[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x34d99b,null))[_0x8324('0x35')](function(_0x199a99){if(_0x199a99){return _0x199a99[_0x8324('0x72')](_0xa1286[_0x8324('0x44')][_0x8324('0x6e')]);}})[_0x8324('0x35')](respondWithStatusCode(_0x34d99b,null))[_0x8324('0x27')](handleError(_0x34d99b,null));};exports[_0x8324('0x73')]=function(_0x3dbbe9,_0x2d98e9,_0x4e273d){var _0x2abdd1={'body':_0x3dbbe9[_0x8324('0x65')],'channel':'openchannel'};var _0x45b21b=[];var _0x516b4f=[];var _0x1f552a={};var _0x4060aa=![];return db[_0x8324('0x74')][_0x8324('0x66')]()[_0x8324('0x35')](function(_0x38f77b){if(!_0x38f77b){throw new db['Sequelize'][(_0x8324('0x75'))]('no\x20available\x20attributes');}_0x45b21b=_[_0x8324('0x76')](_[_0x8324('0x59')](_0x38f77b),[_0x8324('0x77'),_0x8324('0x78')]);_0x516b4f=_[_0x8324('0x76')](_['keys'](_0x38f77b),[_0x8324('0x77'),_0x8324('0x78'),'CompanyId',_0x8324('0x79')]);if(_0x3dbbe9[_0x8324('0x65')]['id']){delete _0x3dbbe9['body']['id'];}if(_[_0x8324('0x7a')](_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7b')])){throw new db['Sequelize'][(_0x8324('0x75'))](_0x8324('0x7c'));}if(_[_0x8324('0x7a')](_0x3dbbe9[_0x8324('0x65')][_0x8324('0x65')])||_0x3dbbe9[_0x8324('0x65')]['body']===''){throw new db[(_0x8324('0x7d'))][(_0x8324('0x75'))](_0x8324('0x7e'));}if(_[_0x8324('0x7a')](_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7f')])){throw new db[(_0x8324('0x7d'))][(_0x8324('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x516b4f);}if(!_[_0x8324('0x80')](_0x516b4f,_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7f')])){throw new db[(_0x8324('0x7d'))][(_0x8324('0x75'))](_0x8324('0x81')+_0x516b4f);}_0x1f552a[_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7f')]]=_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7b')];})[_0x8324('0x35')](function(){return db[_0x8324('0x40')][_0x8324('0x5c')]({'where':{'id':_0x3dbbe9['params']['id']},'include':[{'model':db[_0x8324('0x82')],'as':_0x8324('0x83'),'include':[{'model':db[_0x8324('0x74')],'as':_0x8324('0x84'),'where':_0x1f552a,'limit':0x1,'order':[[_0x8324('0x78'),_0x8324('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0x8324('0x86')}]});})['then'](handleEntityNotFound(_0x2d98e9,null))[_0x8324('0x35')](function(_0x338a4c){if(_0x338a4c&&_0x338a4c['List']){_0x2abdd1[_0x8324('0x87')]=_0x338a4c;_0x2abdd1[_0x8324('0x88')]=_0x338a4c['Applications'];_0x2abdd1[_0x8324('0x89')]=_0x338a4c[_0x8324('0x83')];_0x2abdd1[_0x8324('0x88')]=_[_0x8324('0x8a')](_0x2abdd1[_0x8324('0x88')],[_0x8324('0x8b')],['asc']);if(_0x2abdd1[_0x8324('0x87')][_0x8324('0x86')]){delete _0x2abdd1[_0x8324('0x87')][_0x8324('0x86')];}if(_0x2abdd1[_0x8324('0x87')][_0x8324('0x83')]&&_0x2abdd1[_0x8324('0x87')][_0x8324('0x83')][_0x8324('0x84')][_0x8324('0x48')]){return _0x2abdd1[_0x8324('0x87')][_0x8324('0x83')][_0x8324('0x84')][0x0];}var _0x51f253=_[_0x8324('0x16')](_0x3dbbe9[_0x8324('0x65')],{'firstName':_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7b')],'ListId':_0x338a4c[_0x8324('0x79')]});_0x51f253[_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7f')]]=_0x3dbbe9[_0x8324('0x65')][_0x8324('0x7b')];return db[_0x8324('0x74')]['create'](_0x51f253,{'fields':_0x45b21b,'raw':!![]});}})[_0x8324('0x35')](handleEntityNotFound(_0x2d98e9,null))[_0x8324('0x35')](function(_0x27983b){_0x2abdd1[_0x8324('0x8c')]=_0x27983b;if(_0x27983b){var _0x51c8b1={'ContactId':_0x27983b['id'],'OpenchannelAccountId':_0x3dbbe9[_0x8324('0x57')]['id'],'from':(_0x27983b['firstName']||'')+'\x20'+(_0x27983b[_0x8324('0x8d')]||'')};var _0x6f1174={'OpenchannelAccountId':_0x3dbbe9[_0x8324('0x57')]['id'],'closed':![]};if(_0x3dbbe9[_0x8324('0x65')]['threadId']){_0x6f1174[_0x8324('0x8e')]=_0x3dbbe9['body'][_0x8324('0x8e')];return db['OpenchannelInteraction'][_0x8324('0x5c')]({'where':_0x6f1174})[_0x8324('0x35')](function(_0x1566d3){if(_0x1566d3){return[_0x1566d3,![]];}_0x51c8b1[_0x8324('0x8e')]=_0x3dbbe9['body']['threadId'];_0x51c8b1[_0x8324('0x8f')]=_0x3dbbe9[_0x8324('0x65')][_0x8324('0x8f')];return db[_0x8324('0x90')][_0x8324('0x5d')](_0x51c8b1)[_0x8324('0x35')](function(_0x170466){return[_0x170466,!![]];});});}else{_0x6f1174[_0x8324('0x8e')]=null;}_0x6f1174[_0x8324('0x91')]=_0x27983b['id'];return db['OpenchannelInteraction'][_0x8324('0x5c')]({'where':_0x6f1174})[_0x8324('0x35')](function(_0x416df6){if(_0x416df6){return[_0x416df6,![]];}return db['OpenchannelInteraction'][_0x8324('0x5d')](_0x51c8b1)['then'](function(_0x51996a){return[_0x51996a,!![]];});});}})[_0x8324('0x92')](function(_0x292d40,_0x5bbd4e){if(_0x292d40){_0x4060aa=_0x5bbd4e;if(!_0x5bbd4e){var _0x4004f1={'from':(_0x2abdd1[_0x8324('0x8c')][_0x8324('0x93')]||'')+'\x20'+(_0x2abdd1[_0x8324('0x8c')][_0x8324('0x8d')]||'')};if(_0x3dbbe9[_0x8324('0x65')][_0x8324('0x8e')]&&_0x3dbbe9[_0x8324('0x65')][_0x8324('0x94')]&&_0x3dbbe9[_0x8324('0x65')]['threadId']!=_0x3dbbe9[_0x8324('0x65')][_0x8324('0x94')]){_0x4004f1[_0x8324('0x8e')]=_0x3dbbe9[_0x8324('0x65')][_0x8324('0x94')];}return _0x292d40[_0x8324('0x34')](_0x4004f1);}else{return _0x292d40;}}})[_0x8324('0x35')](function(_0x25eb75){_0x2abdd1[_0x8324('0x95')]=_0x25eb75['get']({'plain':!![]});_0x2abdd1['interaction']['created']=_0x4060aa;if(_0x2abdd1['interaction'][_0x8324('0x96')]){if(_0x2abdd1[_0x8324('0x87')][_0x8324('0x97')]){_0x2abdd1[_0x8324('0x88')][_0x8324('0x98')]({'id':0x0,'priority':_0x2abdd1[_0x8324('0x88')][_0x8324('0x48')]+0x1,'app':'close','appdata':_0x8324('0x99'),'interval':_0x8324('0x9a')});}}return db[_0x8324('0x9b')][_0x8324('0x5d')]({'body':_0x3dbbe9[_0x8324('0x65')]['body'],'OpenchannelAccountId':_0x3dbbe9[_0x8324('0x57')]['id'],'OpenchannelInteractionId':_0x25eb75['id'],'direction':'in','ContactId':_0x2abdd1['contact']['id'],'AttachmentId':_0x3dbbe9['body'][_0x8324('0x9c')]});})['then'](function(_0x1de60d){_0x2abdd1[_0x8324('0x24')]=_0x1de60d;if(_0x2abdd1[_0x8324('0x95')]['UserId']){return db[_0x8324('0x9d')][_0x8324('0x5c')]({'attributes':['id','name'],'where':{'id':_0x2abdd1[_0x8324('0x95')][_0x8324('0x9e')]}})['then'](function(_0x470f1f){if(_0x470f1f){_0x2abdd1[_0x8324('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8324('0x9f'),'appdata':_0x470f1f['name']+','+(_0x2abdd1['account'][_0x8324('0xa0')]||0xa),'interval':'*,*,*,*'});_0x2abdd1[_0x8324('0xa1')]=![];}return respondWithRpcPromise(_0x8324('0xa2'),_0x8324('0xa3'),_0x2abdd1);});}return respondWithRpcPromise(_0x8324('0xa2'),_0x8324('0xa3'),_0x2abdd1);})[_0x8324('0x35')](function(_0x5aa7e1){respondWithRpcPromise(_0x8324('0xa4'),_0x8324('0xa4'),{'event':_0x8324('0x73'),'message':_0x5aa7e1},client9002);return _0x5aa7e1;})[_0x8324('0x35')](respondWithResult(_0x2d98e9,null))[_0x8324('0x27')](handleError(_0x2d98e9,null));};exports[_0x8324('0xa5')]=function(_0x20d3ef,_0x36bd03){var _0x3c42c3=_0x20d3ef[_0x8324('0x57')]['id'];var _0x1f326e=_0x20d3ef[_0x8324('0x65')];var _0x23d9df=0xc8;var _0x4ade3c=null;return db[_0x8324('0xa6')][_0x8324('0xa7')]({'isolationLevel':db[_0x8324('0xa6')]['Transaction'][_0x8324('0xa8')]['READ_COMMITTED']},function(_0x7201cc){return db[_0x8324('0x40')][_0x8324('0x6b')]({'where':{'id':_0x3c42c3},'transaction':_0x7201cc})[_0x8324('0x35')](function(_0x4de8f1){if(_0x4de8f1){return db['OpenchannelApplication'][_0x8324('0x36')]({'where':{'OpenchannelAccountId':_0x3c42c3},'transaction':_0x7201cc})['then'](function(){var _0x2f4b3c=_[_0x8324('0x3f')](_0x1f326e,function(_0x5491e5){_0x5491e5[_0x8324('0x68')]=_0x3c42c3;return _0x5491e5;});return db[_0x8324('0xa9')][_0x8324('0xaa')](_0x2f4b3c,{'transaction':_0x7201cc});});}else{_0x23d9df=0x194;_0x4ade3c=[];}});})[_0x8324('0x35')](function(){if(_0x23d9df!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3c42c3},'order':'priority'})['then'](function(_0x1b9abe){_0x4ade3c=_0x1b9abe;});}})[_0x8324('0x27')](function(_0x17fc92){_0x23d9df=0x1f4;logger[_0x8324('0x22')](_0x17fc92[_0x8324('0x3a')]);if(_0x17fc92['name']){delete _0x17fc92[_0x8324('0x3b')];}_0x4ade3c=_0x17fc92;})[_0x8324('0xab')](function(){if(_0x4ade3c===null){_0x36bd03[_0x8324('0x28')](_0x23d9df);}else{if(_0x23d9df===0x1f4){_0x36bd03['status'](_0x23d9df)[_0x8324('0x3c')](_0x4ade3c);}else{_0x36bd03[_0x8324('0x29')](_0x23d9df)['json'](_0x4ade3c);}}});};exports[_0x8324('0xac')]=function(_0x47c0f2,_0x51bdc9,_0x32488d){var _0x35e3d6={};var _0x3f472c={};var _0x490fa5;var _0x31efba;return db[_0x8324('0x40')]['findOne']({'where':{'id':_0x47c0f2[_0x8324('0x57')]['id']}})['then'](handleEntityNotFound(_0x51bdc9,null))[_0x8324('0x35')](function(_0xd17505){if(_0xd17505){_0x490fa5=_0xd17505;_0x3f472c[_0x8324('0x43')]=_[_0x8324('0x59')](db[_0x8324('0xa9')]['rawAttributes']);_0x3f472c[_0x8324('0x44')]=_['keys'](_0x47c0f2[_0x8324('0x44')]);_0x3f472c[_0x8324('0x4e')]=_[_0x8324('0x45')](_0x3f472c[_0x8324('0x43')],_0x3f472c[_0x8324('0x44')]);_0x35e3d6[_0x8324('0x46')]=_[_0x8324('0x45')](_0x3f472c[_0x8324('0x43')],qs['fields'](_0x47c0f2[_0x8324('0x44')][_0x8324('0x47')]));_0x35e3d6['attributes']=_0x35e3d6[_0x8324('0x46')][_0x8324('0x48')]?_0x35e3d6[_0x8324('0x46')]:_0x3f472c[_0x8324('0x43')];_0x35e3d6[_0x8324('0x4b')]=qs[_0x8324('0x4c')](_0x47c0f2['query'][_0x8324('0x4c')]);_0x35e3d6[_0x8324('0x4d')]=qs[_0x8324('0x4e')](_['pick'](_0x47c0f2[_0x8324('0x44')],_0x3f472c['filters']));if(_0x47c0f2[_0x8324('0x44')]['filter']){_0x35e3d6[_0x8324('0x4d')]=_[_0x8324('0x51')](_0x35e3d6['where'],{'$or':_[_0x8324('0x3f')](_0x35e3d6[_0x8324('0x46')],function(_0x490b90){var _0x21c09b={};_0x21c09b[_0x490b90]={'$like':'%'+_0x47c0f2['query']['filter']+'%'};return _0x21c09b;})});}_0x35e3d6=_[_0x8324('0x51')]({},_0x35e3d6,_0x47c0f2[_0x8324('0x5b')]);return _0x490fa5[_0x8324('0xac')](_0x35e3d6);}})['then'](function(_0x148622){if(_0x148622){_0x31efba=_0x148622[_0x8324('0x48')];if(!_0x47c0f2[_0x8324('0x44')]['hasOwnProperty'](_0x8324('0x4a'))){_0x35e3d6[_0x8324('0x2e')]=qs[_0x8324('0x2e')](_0x47c0f2[_0x8324('0x44')][_0x8324('0x2e')]);_0x35e3d6['offset']=qs[_0x8324('0x2b')](_0x47c0f2[_0x8324('0x44')][_0x8324('0x2b')]);}return _0x490fa5[_0x8324('0xac')](_0x35e3d6);}})['then'](function(_0x2b828c){if(_0x2b828c){return _0x2b828c?{'count':_0x31efba,'rows':_0x2b828c}:null;}})['then'](respondWithResult(_0x51bdc9,null))[_0x8324('0x27')](handleError(_0x51bdc9,null));};exports['getInteractions']=function(_0x1c6900,_0x42b1c3,_0x260503){var _0x3c5175={'raw':![],'where':{}};var _0x2c8ab5={};var _0x1f6a04={'count':0x0,'rows':[]};return db[_0x8324('0x40')][_0x8324('0x6b')]({'where':{'id':_0x1c6900[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x42b1c3,null))['then'](function(_0x1db061){if(_0x1db061){_0x2c8ab5[_0x8324('0x43')]=_[_0x8324('0x59')](db[_0x8324('0x90')][_0x8324('0x6c')]);_0x2c8ab5['query']=_[_0x8324('0x59')](_0x1c6900[_0x8324('0x44')]);_0x2c8ab5['filters']=_[_0x8324('0x45')](_0x2c8ab5[_0x8324('0x43')],_0x2c8ab5[_0x8324('0x44')]);_0x3c5175['attributes']=_[_0x8324('0x45')](_0x2c8ab5[_0x8324('0x43')],qs[_0x8324('0x47')](_0x1c6900[_0x8324('0x44')]['fields']));_0x3c5175[_0x8324('0x46')]=_0x3c5175['attributes'][_0x8324('0x48')]?_0x3c5175[_0x8324('0x46')]:_0x2c8ab5['model'];if(!_0x1c6900[_0x8324('0x44')][_0x8324('0x49')](_0x8324('0x4a'))){_0x3c5175[_0x8324('0x2e')]=qs['limit'](_0x1c6900[_0x8324('0x44')][_0x8324('0x2e')]);_0x3c5175[_0x8324('0x2b')]=qs[_0x8324('0x2b')](_0x1c6900[_0x8324('0x44')]['offset']);}_0x3c5175['order']=qs[_0x8324('0x4c')](_0x1c6900[_0x8324('0x44')]['sort']);_0x3c5175[_0x8324('0x4d')]=qs['filters'](_[_0x8324('0x4f')](_0x1c6900[_0x8324('0x44')],_0x2c8ab5[_0x8324('0x4e')]));_0x3c5175[_0x8324('0x4d')][_0x8324('0x68')]=_0x1db061['id'];if(_0x1c6900[_0x8324('0x44')][_0x8324('0x50')]){_0x3c5175[_0x8324('0x4d')]=_['merge'](_0x3c5175['where'],{'$or':_[_0x8324('0x3f')](_0x3c5175[_0x8324('0x46')],function(_0x53c9e2){var _0x5e90a7={};_0x5e90a7[_0x53c9e2]={'$like':'%'+_0x1c6900[_0x8324('0x44')]['filter']+'%'};return _0x5e90a7;})});}_0x3c5175=_[_0x8324('0x51')]({},_0x3c5175,_0x1c6900[_0x8324('0x5b')]);return db[_0x8324('0x90')][_0x8324('0x2d')]({'where':_0x3c5175[_0x8324('0x4d')]})[_0x8324('0x35')](function(_0x5d843a){_0x1f6a04['count']=_0x5d843a;if(_0x1c6900['query']['includeAll']){_0x3c5175[_0x8324('0x5a')]=[{'model':db['CmContact'],'as':_0x8324('0xad'),'required':![]},{'model':db['User'],'as':_0x8324('0xae'),'attributes':[_0x8324('0x3b'),_0x8324('0xaf'),_0x8324('0xb0')],'required':![]},{'model':db[_0x8324('0xb1')],'as':'Tags','attributes':['id','name',_0x8324('0xb2')],'where':_0x1c6900[_0x8324('0x44')][_0x8324('0xb3')]?{'id':_0x1c6900[_0x8324('0x44')][_0x8324('0xb3')]}:undefined,'required':_0x1c6900[_0x8324('0x44')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x8324('0x54')](_0x3c5175);})[_0x8324('0x35')](function(_0x2e7e77){_0x1f6a04[_0x8324('0x55')]=_0x2e7e77;return _0x1f6a04;});}})[_0x8324('0x35')](respondWithFilteredResult(_0x42b1c3,_0x3c5175))[_0x8324('0x27')](handleError(_0x42b1c3,null));};exports['addAgents']=function(_0x35f571,_0x36763f,_0xf36bc1){return db[_0x8324('0x40')]['find']({'where':{'id':_0x35f571[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x36763f,null))[_0x8324('0x35')](function(_0x346c46){if(_0x346c46){return _0x346c46[_0x8324('0xb4')](_0x35f571[_0x8324('0x65')][_0x8324('0x6e')],_[_0x8324('0xb5')](_0x35f571[_0x8324('0x65')],['ids','id'])||{})[_0x8324('0x92')](function(_0x265907){for(var _0xe90fd1=0x0;_0xe90fd1<_0x35f571[_0x8324('0x65')][_0x8324('0x6e')][_0x8324('0x48')];_0xe90fd1+=0x1){socket[_0x8324('0xb6')](_0x8324('0xb7'),{'UserId':Number(_0x35f571[_0x8324('0x65')][_0x8324('0x6e')][_0xe90fd1]),'OpenchannelAccountId':Number(_0x35f571[_0x8324('0x57')]['id'])});}return _0x265907;});}})[_0x8324('0x35')](respondWithResult(_0x36763f,null))[_0x8324('0x27')](handleError(_0x36763f,null));};exports[_0x8324('0xb8')]=function(_0x4a1ba5,_0x469b27,_0x2ccf10){return db[_0x8324('0x40')]['find']({'where':{'id':_0x4a1ba5[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x469b27,null))[_0x8324('0x35')](function(_0x3b2426){if(_0x3b2426){return _0x3b2426[_0x8324('0xb8')](_0x4a1ba5[_0x8324('0x44')][_0x8324('0x6e')])[_0x8324('0x35')](function(){if(_[_0x8324('0xb9')](_0x4a1ba5[_0x8324('0x44')]['ids'])){for(var _0x4323a3=0x0;_0x4323a3<_0x4a1ba5['query'][_0x8324('0x6e')]['length'];_0x4323a3+=0x1){socket['emit'](_0x8324('0xba'),{'UserId':Number(_0x4a1ba5[_0x8324('0x44')][_0x8324('0x6e')][_0x4323a3]),'OpenchannelAccountId':Number(_0x4a1ba5[_0x8324('0x57')]['id'])});}}else{socket['emit'](_0x8324('0xba'),{'UserId':Number(_0x4a1ba5[_0x8324('0x44')][_0x8324('0x6e')]),'OpenchannelAccountId':Number(_0x4a1ba5[_0x8324('0x57')]['id'])});}});}})[_0x8324('0x35')](respondWithStatusCode(_0x469b27,null))[_0x8324('0x27')](handleError(_0x469b27,null));};exports['getAgents']=function(_0x154d08,_0x12d296,_0x23f9f7){var _0x302698={};var _0x56459a={};var _0x557ba2;var _0x5ac153;return db[_0x8324('0x40')][_0x8324('0x6b')]({'where':{'id':_0x154d08[_0x8324('0x57')]['id']}})['then'](handleEntityNotFound(_0x12d296,null))[_0x8324('0x35')](function(_0x3c0818){if(_0x3c0818){_0x557ba2=_0x3c0818;_0x56459a[_0x8324('0x43')]=_[_0x8324('0x59')](db[_0x8324('0x9d')]['rawAttributes']);_0x56459a['query']=_[_0x8324('0x59')](_0x154d08['query']);_0x56459a[_0x8324('0x4e')]=_[_0x8324('0x45')](_0x56459a[_0x8324('0x43')],_0x56459a[_0x8324('0x44')]);_0x302698['attributes']=_[_0x8324('0x45')](_0x56459a['model'],qs[_0x8324('0x47')](_0x154d08[_0x8324('0x44')]['fields']));_0x302698[_0x8324('0x46')]=_0x302698['attributes'][_0x8324('0x48')]?_0x302698[_0x8324('0x46')]:_0x56459a[_0x8324('0x43')];_0x302698[_0x8324('0x4b')]=qs[_0x8324('0x4c')](_0x154d08[_0x8324('0x44')]['sort']);_0x302698[_0x8324('0x4d')]=qs[_0x8324('0x4e')](_[_0x8324('0x4f')](_0x154d08[_0x8324('0x44')],_0x56459a['filters']));if(_0x154d08['query'][_0x8324('0x50')]){_0x302698[_0x8324('0x4d')]=_[_0x8324('0x51')](_0x302698[_0x8324('0x4d')],{'$or':_[_0x8324('0x3f')](_0x302698['attributes'],function(_0x944d17){var _0x2954ae={};_0x2954ae[_0x944d17]={'$like':'%'+_0x154d08[_0x8324('0x44')][_0x8324('0x50')]+'%'};return _0x2954ae;})});}_0x302698=_[_0x8324('0x51')]({},_0x302698,_0x154d08['options']);return _0x557ba2[_0x8324('0xbb')](_0x302698);}})[_0x8324('0x35')](function(_0x257c28){if(_0x257c28){_0x5ac153=_0x257c28[_0x8324('0x48')];if(!_0x154d08[_0x8324('0x44')][_0x8324('0x49')](_0x8324('0x4a'))){_0x302698[_0x8324('0x2e')]=qs[_0x8324('0x2e')](_0x154d08[_0x8324('0x44')][_0x8324('0x2e')]);_0x302698[_0x8324('0x2b')]=qs[_0x8324('0x2b')](_0x154d08[_0x8324('0x44')][_0x8324('0x2b')]);}return _0x557ba2[_0x8324('0xbb')](_0x302698);}})[_0x8324('0x35')](function(_0x5d547b){if(_0x5d547b){return _0x5d547b?{'count':_0x5ac153,'rows':_0x5d547b}:null;}})[_0x8324('0x35')](respondWithResult(_0x12d296,null))[_0x8324('0x27')](handleError(_0x12d296,null));};exports[_0x8324('0x3c')]=function(_0x39fd69,_0x46c8ff,_0x490ff2){var _0xe3dccb,_0x25e541,_0x5e2ff4;if(_['isNil'](_0x39fd69['body']['body'])||_0x39fd69[_0x8324('0x65')]['body']===''){throw new db['Sequelize'][(_0x8324('0x75'))](_0x8324('0x7e'));}if(_[_0x8324('0x7a')](_0x39fd69[_0x8324('0x65')]['to'])){}_0xe3dccb=_0x39fd69[_0x8324('0x65')]['to'];return db[_0x8324('0x40')][_0x8324('0x6b')]({'where':{'id':_0x39fd69[_0x8324('0x57')]['id']}})[_0x8324('0x35')](handleEntityNotFound(_0x46c8ff,null))['then'](function(_0x5eac0e){if(_0x5eac0e){return db[_0x8324('0x40')][_0x8324('0x5c')]({'where':{'id':_0x5eac0e['id']},'include':[{'model':db[_0x8324('0x82')],'as':_0x8324('0x83'),'include':[{'model':db[_0x8324('0x74')],'as':_0x8324('0x84'),'where':{[_0x5eac0e[_0x8324('0x7f')]]:_0xe3dccb},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8324('0x35')](handleEntityNotFound(_0x46c8ff,null))['then'](function(_0x12a3c4){if(_0x12a3c4&&_0x12a3c4[_0x8324('0x83')]){_0x25e541=_0x12a3c4['get']({'plain':!![]});if(_0x25e541['List']&&_0x25e541['List']['Contacts'][_0x8324('0x48')]){return _0x25e541[_0x8324('0x83')]['Contacts'][0x0];}return db['CmContact'][_0x8324('0x5d')](_[_0x8324('0x16')](_0x39fd69['body'],{'firstName':_0xe3dccb,[_0x12a3c4['mapKey']]:_0xe3dccb,'phone':_0xe3dccb,'ListId':_0x25e541[_0x8324('0x79')]}));}})[_0x8324('0x35')](handleEntityNotFound(_0x46c8ff,null))[_0x8324('0x35')](function(_0xcbb91f){if(_0xcbb91f){_0x5e2ff4=_0xcbb91f;return db[_0x8324('0x90')][_0x8324('0x5c')]({'where':{'ContactId':_0x5e2ff4['id'],'closed':![],'OpenchannelAccountId':_0x25e541['id']}})['then'](function(_0x2fca09){if(_0x2fca09){return[_0x2fca09,![]];}return db[_0x8324('0x90')][_0x8324('0x5d')]({'UserId':_0x39fd69['user']['id'],'ContactId':_0x5e2ff4['id'],'OpenchannelAccountId':_0x25e541['id'],'lastMsgDirection':_0x8324('0xbc'),'firstMsgDirection':_0x8324('0xbc'),'Messages':[_[_0x8324('0x51')](_0x39fd69['body'],{'read':![],'body':_0x39fd69['body'][_0x8324('0x65')],'OpenchannelAccountId':_0x25e541['id'],'UserId':_0x39fd69['user']['id'],'ContactId':_0x5e2ff4['id']})]},{'include':[{'model':db[_0x8324('0x9b')],'as':_0x8324('0xbd')}]})[_0x8324('0x35')](function(_0x34156d){return[_0x34156d,!![]];});});}})[_0x8324('0x92')](function(_0x529a8b,_0x3fb450){if(_0x3fb450){return _0x529a8b;}return db[_0x8324('0x9b')][_0x8324('0x5d')](_[_0x8324('0x51')](_0x39fd69[_0x8324('0x65')],{'read':![],'body':_0x39fd69[_0x8324('0x65')]['body'],'OpenchannelAccountId':_0x25e541['id'],'OpenchannelInteractionId':_0x529a8b['id'],'UserId':_0x39fd69[_0x8324('0x5e')]['id'],'ContactId':_0x5e2ff4['id']}))[_0x8324('0x35')](function(_0x31c79b){_0x529a8b[_0x8324('0xbe')]['Messages']=[];_0x529a8b[_0x8324('0xbe')][_0x8324('0xbd')]['push'](_0x31c79b['dataValues']);return _0x529a8b;});});}})['then'](respondWithResult(_0x46c8ff,null))['catch'](handleError(_0x46c8ff,null));};
\ No newline at end of file
index 549b484..41f62a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0x668b,0x140));var _0xb668=function(_0x3b085,_0x250543){_0x3b085=_0x3b085-0x0;var _0x476a57=_0x668b[_0x3b085];return _0x476a57;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents;
\ No newline at end of file
+var _0xa571=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa571,0x107));var _0x1a57=function(_0x3c07f8,_0x55082f){_0x3c07f8=_0x3c07f8-0x0;var _0x139006=_0xa571[_0x3c07f8];return _0x139006;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var OpenchannelAccount=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a57('0x4'),'afterDestroy':_0x1a57('0x5')};function emitEvent(_0x4d5f7a){return function(_0x5ec815,_0x1f2c44,_0x5067fa){OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a+':'+_0x5ec815['id'],_0x5ec815);OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a,_0x5ec815);_0x5067fa(null);};}for(var e in events){if(events[_0x1a57('0x7')](e)){var event=events[e];OpenchannelAccount[_0x1a57('0x8')](e,emitEvent(event));}}module[_0x1a57('0x9')]=OpenchannelAccountEvents;
\ No newline at end of file
index 17297cb..4f03690 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x283227,_0xdb754){var _0x5a62d5=function(_0x5ac6b9){while(--_0x5ac6b9){_0x283227['push'](_0x283227['shift']());}};_0x5a62d5(++_0xdb754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x535ab9,_0x4f2747){var _0x199e35=function(_0x4ef1cb){while(--_0x4ef1cb){_0x535ab9['push'](_0x535ab9['shift']());}};_0x199e35(++_0x4f2747);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index db9f365..57b508c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1e3=['catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x2bf3dc,_0x5b5f19){var _0x944dcb=function(_0x233456){while(--_0x233456){_0x2bf3dc['push'](_0x2bf3dc['shift']());}};_0x944dcb(++_0x5b5f19);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x301e40,_0x1e3afe){_0x301e40=_0x301e40-0x0;var _0x54f39c=_0xe1e3[_0x301e40];return _0x54f39c;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});config['redis']=_[_0x3e1e('0xa')](config[_0x3e1e('0xb')],{'host':_0x3e1e('0xc'),'port':0x18eb});var socket=require(_0x3e1e('0xd'))(new Redis(config[_0x3e1e('0xb')]));require(_0x3e1e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c4c25,_0x5060e8,_0x31d205){return new BPromise(function(_0x5b0df8,_0x349460){return client[_0x3e1e('0xf')](_0x5c4c25,_0x31d205)[_0x3e1e('0x10')](function(_0x594c59){logger[_0x3e1e('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x5060e8,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5060e8,'request\x20sent',JSON[_0x3e1e('0x12')](_0x594c59));if(_0x594c59['error']){if(_0x594c59['error'][_0x3e1e('0x13')]===0x1f4){logger[_0x3e1e('0x14')](_0x3e1e('0x15'),_0x5060e8,_0x594c59['error']['message']);return _0x349460(_0x594c59[_0x3e1e('0x14')][_0x3e1e('0x16')]);}logger['error'](_0x3e1e('0x15'),_0x5060e8,_0x594c59[_0x3e1e('0x14')]['message']);return _0x5b0df8(_0x594c59[_0x3e1e('0x14')]['message']);}else{logger[_0x3e1e('0x11')](_0x3e1e('0x15'),_0x5060e8,_0x3e1e('0x17'));_0x5b0df8(_0x594c59[_0x3e1e('0x18')][_0x3e1e('0x16')]);}})[_0x3e1e('0x19')](function(_0x569f49){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5060e8,_0x569f49);_0x349460(_0x569f49);});});}
\ No newline at end of file
+var _0x594d=['defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x1d1c37,_0x5b558f){var _0x439189=function(_0x1fb3ea){while(--_0x1fb3ea){_0x1d1c37['push'](_0x1d1c37['shift']());}};_0x439189(++_0x5b558f);}(_0x594d,0x92));var _0xd594=function(_0x4f2ace,_0x3887b5){_0x4f2ace=_0x4f2ace-0x0;var _0x19e481=_0x594d[_0x4f2ace];return _0x19e481;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});config[_0xd594('0x9')]=_[_0xd594('0xa')](config[_0xd594('0x9')],{'host':_0xd594('0xb'),'port':0x18eb});var socket=require(_0xd594('0xc'))(new Redis(config[_0xd594('0x9')]));require(_0xd594('0xd'))[_0xd594('0xe')](socket);function respondWithRpcPromise(_0x143886,_0x20411b,_0x564835){return new BPromise(function(_0x31e19b,_0x3f0381){return client[_0xd594('0xf')](_0x143886,_0x564835)['then'](function(_0xeba835){logger[_0xd594('0x10')](_0xd594('0x11'),_0x20411b,_0xd594('0x12'));logger[_0xd594('0x13')](_0xd594('0x14'),_0x20411b,_0xd594('0x12'),JSON['stringify'](_0xeba835));if(_0xeba835['error']){if(_0xeba835[_0xd594('0x15')][_0xd594('0x16')]===0x1f4){logger['error'](_0xd594('0x11'),_0x20411b,_0xeba835['error'][_0xd594('0x17')]);return _0x3f0381(_0xeba835[_0xd594('0x15')][_0xd594('0x17')]);}logger['error'](_0xd594('0x11'),_0x20411b,_0xeba835['error']['message']);return _0x31e19b(_0xeba835[_0xd594('0x15')][_0xd594('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x20411b,_0xd594('0x12'));_0x31e19b(_0xeba835[_0xd594('0x18')]['message']);}})[_0xd594('0x19')](function(_0x559962){logger[_0xd594('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x20411b,_0x559962);_0x3f0381(_0x559962);});});}
\ No newline at end of file
index 726189b..0f4d4ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ceb=['save','update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x3408a5,_0x5889e7){var _0x2c04ab=function(_0x83be62){while(--_0x83be62){_0x3408a5['push'](_0x3408a5['shift']());}};_0x2c04ab(++_0x5889e7);}(_0x2ceb,0x110));var _0xb2ce=function(_0x8915c9,_0x37f666){_0x8915c9=_0x8915c9-0x0;var _0x1b1468=_0x2ceb[_0x8915c9];return _0x1b1468;};'use strict';var OpenchannelAccountEvents=require(_0xb2ce('0x0'));var events=[_0xb2ce('0x1'),'remove',_0xb2ce('0x2')];function createListener(_0x1bca5d,_0xc03973){return function(_0x1dbb1e){_0xc03973[_0xb2ce('0x3')](_0x1bca5d,_0x1dbb1e);};}function removeListener(_0x35242f,_0x58daad){return function(){OpenchannelAccountEvents[_0xb2ce('0x4')](_0x35242f,_0x58daad);};}exports[_0xb2ce('0x5')]=function(_0x550455){for(var _0x479153=0x0,_0x3dfaee=events['length'];_0x479153<_0x3dfaee;_0x479153++){var _0x39120a=events[_0x479153];var _0x9fb07c=createListener(_0xb2ce('0x6')+_0x39120a,_0x550455);OpenchannelAccountEvents['on'](_0x39120a,_0x9fb07c);}};
\ No newline at end of file
+var _0xd8cc=['removeListener','length','openchannelAccount:','./openchannelAccount.events','save','emit'];(function(_0x289f45,_0x27317c){var _0x30716b=function(_0x356dde){while(--_0x356dde){_0x289f45['push'](_0x289f45['shift']());}};_0x30716b(++_0x27317c);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xd8cc[_0x3b7a0c];return _0x3bb70f;};'use strict';var OpenchannelAccountEvents=require(_0xcd8c('0x0'));var events=[_0xcd8c('0x1'),'remove','update'];function createListener(_0x1576d8,_0x7f40a7){return function(_0x1a1e1e){_0x7f40a7[_0xcd8c('0x2')](_0x1576d8,_0x1a1e1e);};}function removeListener(_0x58d2c9,_0x2dad29){return function(){OpenchannelAccountEvents[_0xcd8c('0x3')](_0x58d2c9,_0x2dad29);};}exports['register']=function(_0x5776fc){for(var _0x233d52=0x0,_0x55c4ed=events[_0xcd8c('0x4')];_0x233d52<_0x55c4ed;_0x233d52++){var _0x5814b4=events[_0x233d52];var _0x4740bf=createListener(_0xcd8c('0x5')+_0x5814b4,_0x5776fc);OpenchannelAccountEvents['on'](_0x5814b4,_0x4740bf);}};
\ No newline at end of file
index 1870fc2..8a19b72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f40=['exports','multer','util','express','Router','./openchannelApplication.controller','get','index','/:id','isAuthenticated','post','create','update','delete'];(function(_0x3f43,_0xd670da){var _0x35800f=function(_0x3a85c8){while(--_0x3a85c8){_0x3f43['push'](_0x3f43['shift']());}};_0x35800f(++_0xd670da);}(_0x2f40,0xc5));var _0x02f4=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2f40[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x02f4('0x0'));var util=require(_0x02f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02f4('0x2'));var router=express[_0x02f4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x02f4('0x4'));router[_0x02f4('0x5')]('/',auth['isAuthenticated'](),controller[_0x02f4('0x6')]);router['get'](_0x02f4('0x7'),auth[_0x02f4('0x8')](),controller['show']);router[_0x02f4('0x9')]('/',auth[_0x02f4('0x8')](),controller[_0x02f4('0xa')]);router['put']('/:id',auth[_0x02f4('0x8')](),controller[_0x02f4('0xb')]);router[_0x02f4('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x02f4('0xd')]=router;
\ No newline at end of file
+var _0xb086=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4b025d,_0x506030){var _0x479740=function(_0x5a561e){while(--_0x5a561e){_0x4b025d['push'](_0x4b025d['shift']());}};_0x479740(++_0x506030);}(_0xb086,0xa7));var _0x6b08=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb086[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x6b08('0x0'));var util=require(_0x6b08('0x1'));var path=require('path');var timeout=require(_0x6b08('0x2'));var express=require(_0x6b08('0x3'));var router=express[_0x6b08('0x4')]();var fs_extra=require(_0x6b08('0x5'));var auth=require(_0x6b08('0x6'));var interaction=require(_0x6b08('0x7'));var config=require(_0x6b08('0x8'));var controller=require(_0x6b08('0x9'));router[_0x6b08('0xa')]('/',auth[_0x6b08('0xb')](),controller[_0x6b08('0xc')]);router['get'](_0x6b08('0xd'),auth['isAuthenticated'](),controller[_0x6b08('0xe')]);router[_0x6b08('0xf')]('/',auth[_0x6b08('0xb')](),controller[_0x6b08('0x10')]);router[_0x6b08('0x11')]('/:id',auth[_0x6b08('0xb')](),controller[_0x6b08('0x12')]);router['delete']('/:id',auth[_0x6b08('0xb')](),controller[_0x6b08('0x13')]);module[_0x6b08('0x14')]=router;
\ No newline at end of file
index 34d3714..217c568 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c4f=['exports','INTEGER','STRING','TEXT'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x4c4f,0xb8));var _0xf4c4=function(_0x451a3d,_0x23363c){_0x451a3d=_0x451a3d-0x0;var _0x87cded=_0x4c4f[_0x451a3d];return _0x87cded;};'use strict';var Sequelize=require('sequelize');module[_0xf4c4('0x0')]={'priority':{'type':Sequelize[_0xf4c4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf4c4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf4c4('0x3')]()},'description':{'type':Sequelize[_0xf4c4('0x2')]},'interval':{'type':Sequelize[_0xf4c4('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0xf1c4=['STRING','noop','*,*,*,*','INTEGER'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0xf1c4,0x15b));var _0x4f1c=function(_0x562828,_0x20f804){_0x562828=_0x562828-0x0;var _0xa72383=_0xf1c4[_0x562828];return _0xa72383;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x4f1c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x4f1c('0x1')],'allowNull':![],'defaultValue':_0x4f1c('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4f1c('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4f1c('0x3')}};
\ No newline at end of file
index 0545397..ae2d9f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ea4=['sox','ejs','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x1a3d77,_0x5e04aa){var _0x22fc49=function(_0x3c0f39){while(--_0x3c0f39){_0x1a3d77['push'](_0x1a3d77['shift']());}};_0x22fc49(++_0x5e04aa);}(_0x6ea4,0x1f1));var _0x46ea=function(_0x407318,_0x194bcf){_0x407318=_0x407318-0x0;var _0x591de6=_0x6ea4[_0x407318];return _0x591de6;};'use strict';var emlformat=require(_0x46ea('0x0'));var rimraf=require(_0x46ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46ea('0x2'));var rp=require('request-promise');var moment=require(_0x46ea('0x3'));var BPromise=require(_0x46ea('0x4'));var Mustache=require(_0x46ea('0x5'));var util=require('util');var path=require(_0x46ea('0x6'));var sox=require(_0x46ea('0x7'));var csv=require('to-csv');var ejs=require(_0x46ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46ea('0x9'));var crypto=require('crypto');var jsforce=require(_0x46ea('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x46ea('0xb'));var querystring=require(_0x46ea('0xc'));var Papa=require('papaparse');var Redis=require(_0x46ea('0xd'));var authService=require(_0x46ea('0xe'));var qs=require(_0x46ea('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46ea('0x10'));var logger=require('../../config/logger')(_0x46ea('0x11'));var utils=require(_0x46ea('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46ea('0x13'))['db'];function respondWithStatusCode(_0x4de36c,_0x497c81){_0x497c81=_0x497c81||0xcc;return function(_0x2612df){if(_0x2612df){return _0x4de36c['sendStatus'](_0x497c81);}return _0x4de36c[_0x46ea('0x14')](_0x497c81)[_0x46ea('0x15')]();};}function respondWithResult(_0x538577,_0x2498ba){_0x2498ba=_0x2498ba||0xc8;return function(_0x1e7401){if(_0x1e7401){return _0x538577[_0x46ea('0x14')](_0x2498ba)[_0x46ea('0x16')](_0x1e7401);}};}function respondWithFilteredResult(_0x1b5852,_0x1435b3){return function(_0x7570fe){if(_0x7570fe){var _0x16d1c1=typeof _0x1435b3[_0x46ea('0x17')]===_0x46ea('0x18')&&typeof _0x1435b3[_0x46ea('0x19')]==='undefined';var _0x4dd03=_0x7570fe[_0x46ea('0x1a')];var _0x5094af=_0x16d1c1?0x0:_0x1435b3['offset'];var _0xe372dc=_0x16d1c1?_0x7570fe[_0x46ea('0x1a')]:_0x1435b3[_0x46ea('0x17')]+_0x1435b3[_0x46ea('0x19')];var _0x535bf5;if(_0xe372dc>=_0x4dd03){_0xe372dc=_0x4dd03;_0x535bf5=0xc8;}else{_0x535bf5=0xce;}_0x1b5852[_0x46ea('0x14')](_0x535bf5);return _0x1b5852[_0x46ea('0x1b')]('Content-Range',_0x5094af+'-'+_0xe372dc+'/'+_0x4dd03)[_0x46ea('0x16')](_0x7570fe);}return null;};}function patchUpdates(_0x4e6a66){return function(_0x41f01b){try{jsonpatch[_0x46ea('0x1c')](_0x41f01b,_0x4e6a66,!![]);}catch(_0xbe4d8){return BPromise[_0x46ea('0x1d')](_0xbe4d8);}return _0x41f01b[_0x46ea('0x1e')]();};}function saveUpdates(_0x152fbc,_0x4eda40){return function(_0x50f1d6){if(_0x50f1d6){return _0x50f1d6[_0x46ea('0x1f')](_0x152fbc)[_0x46ea('0x20')](function(_0x1894bd){return _0x1894bd;});}return null;};}function removeEntity(_0x344978,_0x3751c0){return function(_0x300b00){if(_0x300b00){return _0x300b00[_0x46ea('0x21')]()[_0x46ea('0x20')](function(){_0x344978[_0x46ea('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6215,_0x2bb45b){return function(_0x481d96){if(!_0x481d96){_0x2a6215[_0x46ea('0x22')](0x194);}return _0x481d96;};}function handleError(_0x252ae1,_0x3468b2){_0x3468b2=_0x3468b2||0x1f4;return function(_0x2f346e){logger['error'](_0x2f346e[_0x46ea('0x23')]);if(_0x2f346e[_0x46ea('0x24')]){delete _0x2f346e['name'];}_0x252ae1['status'](_0x3468b2)[_0x46ea('0x25')](_0x2f346e);};}exports[_0x46ea('0x26')]=function(_0x2d77ef,_0x3420ea){var _0x11321d={},_0xa2cefe={},_0x3bbf90={'count':0x0,'rows':[]};var _0x1d6453=_[_0x46ea('0x27')](db[_0x46ea('0x28')][_0x46ea('0x29')],function(_0x54604d){return{'name':_0x54604d['fieldName'],'type':_0x54604d[_0x46ea('0x2a')][_0x46ea('0x2b')]};});_0xa2cefe[_0x46ea('0x2c')]=_['map'](_0x1d6453,_0x46ea('0x24'));_0xa2cefe[_0x46ea('0x2d')]=_['keys'](_0x2d77ef['query']);_0xa2cefe[_0x46ea('0x2e')]=_[_0x46ea('0x2f')](_0xa2cefe[_0x46ea('0x2c')],_0xa2cefe['query']);_0x11321d[_0x46ea('0x30')]=_[_0x46ea('0x2f')](_0xa2cefe[_0x46ea('0x2c')],qs[_0x46ea('0x31')](_0x2d77ef['query'][_0x46ea('0x31')]));_0x11321d[_0x46ea('0x30')]=_0x11321d[_0x46ea('0x30')][_0x46ea('0x32')]?_0x11321d['attributes']:_0xa2cefe[_0x46ea('0x2c')];if(!_0x2d77ef['query'][_0x46ea('0x33')](_0x46ea('0x34'))){_0x11321d[_0x46ea('0x19')]=qs[_0x46ea('0x19')](_0x2d77ef[_0x46ea('0x2d')][_0x46ea('0x19')]);_0x11321d['offset']=qs[_0x46ea('0x17')](_0x2d77ef['query'][_0x46ea('0x17')]);}_0x11321d[_0x46ea('0x35')]=qs[_0x46ea('0x36')](_0x2d77ef[_0x46ea('0x2d')]['sort']);_0x11321d[_0x46ea('0x37')]=qs[_0x46ea('0x2e')](_[_0x46ea('0x38')](_0x2d77ef[_0x46ea('0x2d')],_0xa2cefe[_0x46ea('0x2e')]),_0x1d6453);if(_0x2d77ef[_0x46ea('0x2d')][_0x46ea('0x39')]){_0x11321d['where']=_[_0x46ea('0x3a')](_0x11321d[_0x46ea('0x37')],{'$or':_['map'](_0x1d6453,function(_0x441f06){if(_0x441f06[_0x46ea('0x2a')]!==_0x46ea('0x3b')){var _0xbcc548={};_0xbcc548[_0x441f06[_0x46ea('0x24')]]={'$like':'%'+_0x2d77ef[_0x46ea('0x2d')]['filter']+'%'};return _0xbcc548;}})});}_0x11321d=_[_0x46ea('0x3a')]({},_0x11321d,_0x2d77ef[_0x46ea('0x3c')]);var _0x55b42c={'where':_0x11321d[_0x46ea('0x37')]};return db[_0x46ea('0x28')][_0x46ea('0x1a')](_0x55b42c)[_0x46ea('0x20')](function(_0x45a86a){_0x3bbf90[_0x46ea('0x1a')]=_0x45a86a;if(_0x2d77ef[_0x46ea('0x2d')][_0x46ea('0x3d')]){_0x11321d['include']=[{'all':!![]}];}return db[_0x46ea('0x28')][_0x46ea('0x3e')](_0x11321d);})[_0x46ea('0x20')](function(_0x4f1dcf){_0x3bbf90[_0x46ea('0x3f')]=_0x4f1dcf;return _0x3bbf90;})[_0x46ea('0x20')](respondWithFilteredResult(_0x3420ea,_0x11321d))[_0x46ea('0x40')](handleError(_0x3420ea,null));};exports[_0x46ea('0x41')]=function(_0x16c54c,_0x51df71){var _0x123f2d={'raw':!![],'where':{'id':_0x16c54c[_0x46ea('0x42')]['id']}},_0x4d21d5={};_0x4d21d5[_0x46ea('0x2c')]=_[_0x46ea('0x43')](db[_0x46ea('0x28')][_0x46ea('0x29')]);_0x4d21d5[_0x46ea('0x2d')]=_['keys'](_0x16c54c['query']);_0x4d21d5['filters']=_[_0x46ea('0x2f')](_0x4d21d5[_0x46ea('0x2c')],_0x4d21d5[_0x46ea('0x2d')]);_0x123f2d[_0x46ea('0x30')]=_[_0x46ea('0x2f')](_0x4d21d5['model'],qs[_0x46ea('0x31')](_0x16c54c[_0x46ea('0x2d')][_0x46ea('0x31')]));_0x123f2d['attributes']=_0x123f2d['attributes'][_0x46ea('0x32')]?_0x123f2d[_0x46ea('0x30')]:_0x4d21d5[_0x46ea('0x2c')];if(_0x16c54c[_0x46ea('0x2d')][_0x46ea('0x3d')]){_0x123f2d[_0x46ea('0x44')]=[{'all':!![]}];}_0x123f2d=_[_0x46ea('0x3a')]({},_0x123f2d,_0x16c54c[_0x46ea('0x3c')]);return db[_0x46ea('0x28')][_0x46ea('0x45')](_0x123f2d)[_0x46ea('0x20')](handleEntityNotFound(_0x51df71,null))[_0x46ea('0x20')](respondWithResult(_0x51df71,null))['catch'](handleError(_0x51df71,null));};exports[_0x46ea('0x46')]=function(_0x5d3b37,_0x2f7735){return db[_0x46ea('0x28')][_0x46ea('0x46')](_0x5d3b37['body'],{})['then'](respondWithResult(_0x2f7735,0xc9))[_0x46ea('0x40')](handleError(_0x2f7735,null));};exports[_0x46ea('0x1f')]=function(_0x469ed3,_0x161b6a){if(_0x469ed3[_0x46ea('0x47')]['id']){delete _0x469ed3[_0x46ea('0x47')]['id'];}return db['OpenchannelApplication'][_0x46ea('0x45')]({'where':{'id':_0x469ed3[_0x46ea('0x42')]['id']}})['then'](handleEntityNotFound(_0x161b6a,null))['then'](saveUpdates(_0x469ed3[_0x46ea('0x47')],null))[_0x46ea('0x20')](respondWithResult(_0x161b6a,null))['catch'](handleError(_0x161b6a,null));};exports[_0x46ea('0x21')]=function(_0x331eec,_0x20ce3e){return db[_0x46ea('0x28')][_0x46ea('0x45')]({'where':{'id':_0x331eec['params']['id']}})['then'](handleEntityNotFound(_0x20ce3e,null))[_0x46ea('0x20')](removeEntity(_0x20ce3e,null))['catch'](handleError(_0x20ce3e,null));};
\ No newline at end of file
+var _0xf529=['stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','error'];(function(_0x27cd32,_0x24ff36){var _0x405e89=function(_0x46c8e2){while(--_0x46c8e2){_0x27cd32['push'](_0x27cd32['shift']());}};_0x405e89(++_0x24ff36);}(_0xf529,0x70));var _0x9f52=function(_0x3e8732,_0x51741d){_0x3e8732=_0x3e8732-0x0;var _0x434ede=_0xf529[_0x3e8732];return _0x434ede;};'use strict';var emlformat=require(_0x9f52('0x0'));var rimraf=require(_0x9f52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f52('0x2'));var rp=require(_0x9f52('0x3'));var moment=require(_0x9f52('0x4'));var BPromise=require(_0x9f52('0x5'));var Mustache=require(_0x9f52('0x6'));var util=require(_0x9f52('0x7'));var path=require(_0x9f52('0x8'));var sox=require(_0x9f52('0x9'));var csv=require(_0x9f52('0xa'));var ejs=require(_0x9f52('0xb'));var fs=require('fs');var fs_extra=require(_0x9f52('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f52('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f52('0xe'));var toCsv=require(_0x9f52('0xa'));var querystring=require('querystring');var Papa=require(_0x9f52('0xf'));var Redis=require(_0x9f52('0x10'));var authService=require(_0x9f52('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f52('0x12'));var hardwareService=require(_0x9f52('0x13'));var logger=require(_0x9f52('0x14'))(_0x9f52('0x15'));var utils=require(_0x9f52('0x16'));var config=require(_0x9f52('0x17'));var licenseUtil=require(_0x9f52('0x18'));var db=require(_0x9f52('0x19'))['db'];function respondWithStatusCode(_0x134cc9,_0x405ccf){_0x405ccf=_0x405ccf||0xcc;return function(_0x18ce88){if(_0x18ce88){return _0x134cc9[_0x9f52('0x1a')](_0x405ccf);}return _0x134cc9['status'](_0x405ccf)[_0x9f52('0x1b')]();};}function respondWithResult(_0x448d7b,_0x576839){_0x576839=_0x576839||0xc8;return function(_0x5b3c84){if(_0x5b3c84){return _0x448d7b[_0x9f52('0x1c')](_0x576839)[_0x9f52('0x1d')](_0x5b3c84);}};}function respondWithFilteredResult(_0x49d817,_0x2a5c0a){return function(_0x3ed1e2){if(_0x3ed1e2){var _0x3cc29b=typeof _0x2a5c0a[_0x9f52('0x1e')]==='undefined'&&typeof _0x2a5c0a[_0x9f52('0x1f')]===_0x9f52('0x20');var _0x4d8539=_0x3ed1e2[_0x9f52('0x21')];var _0x39bdc6=_0x3cc29b?0x0:_0x2a5c0a[_0x9f52('0x1e')];var _0x5eb9ad=_0x3cc29b?_0x3ed1e2[_0x9f52('0x21')]:_0x2a5c0a[_0x9f52('0x1e')]+_0x2a5c0a[_0x9f52('0x1f')];var _0x42819c;if(_0x5eb9ad>=_0x4d8539){_0x5eb9ad=_0x4d8539;_0x42819c=0xc8;}else{_0x42819c=0xce;}_0x49d817[_0x9f52('0x1c')](_0x42819c);return _0x49d817[_0x9f52('0x22')](_0x9f52('0x23'),_0x39bdc6+'-'+_0x5eb9ad+'/'+_0x4d8539)[_0x9f52('0x1d')](_0x3ed1e2);}return null;};}function patchUpdates(_0x40bacc){return function(_0x3e736b){try{jsonpatch['apply'](_0x3e736b,_0x40bacc,!![]);}catch(_0x550f32){return BPromise['reject'](_0x550f32);}return _0x3e736b['save']();};}function saveUpdates(_0x5715b4,_0x457008){return function(_0x5c5df6){if(_0x5c5df6){return _0x5c5df6[_0x9f52('0x24')](_0x5715b4)['then'](function(_0x15655d){return _0x15655d;});}return null;};}function removeEntity(_0x843f69,_0x4e790a){return function(_0x3a4c08){if(_0x3a4c08){return _0x3a4c08[_0x9f52('0x25')]()[_0x9f52('0x26')](function(){_0x843f69[_0x9f52('0x1c')](0xcc)[_0x9f52('0x1b')]();});}};}function handleEntityNotFound(_0x3b9425,_0x21abe3){return function(_0x39ff85){if(!_0x39ff85){_0x3b9425[_0x9f52('0x1a')](0x194);}return _0x39ff85;};}function handleError(_0x46dde1,_0x20808a){_0x20808a=_0x20808a||0x1f4;return function(_0x7fb4cd){logger[_0x9f52('0x27')](_0x7fb4cd[_0x9f52('0x28')]);if(_0x7fb4cd[_0x9f52('0x29')]){delete _0x7fb4cd['name'];}_0x46dde1[_0x9f52('0x1c')](_0x20808a)[_0x9f52('0x2a')](_0x7fb4cd);};}exports[_0x9f52('0x2b')]=function(_0x48b6ab,_0x4557f1){var _0x5263a9={},_0x22ce24={},_0x344c9c={'count':0x0,'rows':[]};var _0x559077=_[_0x9f52('0x2c')](db[_0x9f52('0x2d')]['rawAttributes'],function(_0x125cc9){return{'name':_0x125cc9[_0x9f52('0x2e')],'type':_0x125cc9[_0x9f52('0x2f')][_0x9f52('0x30')]};});_0x22ce24[_0x9f52('0x31')]=_[_0x9f52('0x2c')](_0x559077,_0x9f52('0x29'));_0x22ce24['query']=_['keys'](_0x48b6ab[_0x9f52('0x32')]);_0x22ce24[_0x9f52('0x33')]=_['intersection'](_0x22ce24[_0x9f52('0x31')],_0x22ce24['query']);_0x5263a9[_0x9f52('0x34')]=_[_0x9f52('0x35')](_0x22ce24[_0x9f52('0x31')],qs[_0x9f52('0x36')](_0x48b6ab['query']['fields']));_0x5263a9[_0x9f52('0x34')]=_0x5263a9['attributes'][_0x9f52('0x37')]?_0x5263a9[_0x9f52('0x34')]:_0x22ce24[_0x9f52('0x31')];if(!_0x48b6ab[_0x9f52('0x32')][_0x9f52('0x38')](_0x9f52('0x39'))){_0x5263a9['limit']=qs['limit'](_0x48b6ab[_0x9f52('0x32')][_0x9f52('0x1f')]);_0x5263a9[_0x9f52('0x1e')]=qs['offset'](_0x48b6ab['query'][_0x9f52('0x1e')]);}_0x5263a9['order']=qs[_0x9f52('0x3a')](_0x48b6ab['query']['sort']);_0x5263a9[_0x9f52('0x3b')]=qs['filters'](_[_0x9f52('0x3c')](_0x48b6ab['query'],_0x22ce24[_0x9f52('0x33')]),_0x559077);if(_0x48b6ab['query'][_0x9f52('0x3d')]){_0x5263a9[_0x9f52('0x3b')]=_['merge'](_0x5263a9[_0x9f52('0x3b')],{'$or':_[_0x9f52('0x2c')](_0x559077,function(_0x82d927){if(_0x82d927[_0x9f52('0x2f')]!=='VIRTUAL'){var _0x19fd7a={};_0x19fd7a[_0x82d927[_0x9f52('0x29')]]={'$like':'%'+_0x48b6ab[_0x9f52('0x32')][_0x9f52('0x3d')]+'%'};return _0x19fd7a;}})});}_0x5263a9=_[_0x9f52('0x3e')]({},_0x5263a9,_0x48b6ab[_0x9f52('0x3f')]);var _0x399916={'where':_0x5263a9[_0x9f52('0x3b')]};return db[_0x9f52('0x2d')][_0x9f52('0x21')](_0x399916)['then'](function(_0x3c0999){_0x344c9c[_0x9f52('0x21')]=_0x3c0999;if(_0x48b6ab[_0x9f52('0x32')][_0x9f52('0x40')]){_0x5263a9['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9f52('0x41')](_0x5263a9);})[_0x9f52('0x26')](function(_0x36384b){_0x344c9c[_0x9f52('0x42')]=_0x36384b;return _0x344c9c;})[_0x9f52('0x26')](respondWithFilteredResult(_0x4557f1,_0x5263a9))[_0x9f52('0x43')](handleError(_0x4557f1,null));};exports[_0x9f52('0x44')]=function(_0x2f54b7,_0x32affe){var _0x38529a={'raw':!![],'where':{'id':_0x2f54b7['params']['id']}},_0x4c52ea={};_0x4c52ea['model']=_[_0x9f52('0x45')](db[_0x9f52('0x2d')][_0x9f52('0x46')]);_0x4c52ea[_0x9f52('0x32')]=_[_0x9f52('0x45')](_0x2f54b7['query']);_0x4c52ea[_0x9f52('0x33')]=_[_0x9f52('0x35')](_0x4c52ea[_0x9f52('0x31')],_0x4c52ea[_0x9f52('0x32')]);_0x38529a['attributes']=_[_0x9f52('0x35')](_0x4c52ea[_0x9f52('0x31')],qs[_0x9f52('0x36')](_0x2f54b7[_0x9f52('0x32')]['fields']));_0x38529a[_0x9f52('0x34')]=_0x38529a[_0x9f52('0x34')][_0x9f52('0x37')]?_0x38529a[_0x9f52('0x34')]:_0x4c52ea[_0x9f52('0x31')];if(_0x2f54b7[_0x9f52('0x32')][_0x9f52('0x40')]){_0x38529a[_0x9f52('0x47')]=[{'all':!![]}];}_0x38529a=_['merge']({},_0x38529a,_0x2f54b7[_0x9f52('0x3f')]);return db[_0x9f52('0x2d')][_0x9f52('0x48')](_0x38529a)[_0x9f52('0x26')](handleEntityNotFound(_0x32affe,null))[_0x9f52('0x26')](respondWithResult(_0x32affe,null))[_0x9f52('0x43')](handleError(_0x32affe,null));};exports['create']=function(_0x57708b,_0x215378){return db[_0x9f52('0x2d')][_0x9f52('0x49')](_0x57708b[_0x9f52('0x4a')],{})[_0x9f52('0x26')](respondWithResult(_0x215378,0xc9))[_0x9f52('0x43')](handleError(_0x215378,null));};exports['update']=function(_0x2cffce,_0x46804b){if(_0x2cffce['body']['id']){delete _0x2cffce[_0x9f52('0x4a')]['id'];}return db[_0x9f52('0x2d')][_0x9f52('0x48')]({'where':{'id':_0x2cffce['params']['id']}})[_0x9f52('0x26')](handleEntityNotFound(_0x46804b,null))[_0x9f52('0x26')](saveUpdates(_0x2cffce['body'],null))[_0x9f52('0x26')](respondWithResult(_0x46804b,null))[_0x9f52('0x43')](handleError(_0x46804b,null));};exports[_0x9f52('0x25')]=function(_0x3c088f,_0x897add){return db[_0x9f52('0x2d')][_0x9f52('0x48')]({'where':{'id':_0x3c088f[_0x9f52('0x4b')]['id']}})[_0x9f52('0x26')](handleEntityNotFound(_0x897add,null))[_0x9f52('0x26')](removeEntity(_0x897add,null))['catch'](handleError(_0x897add,null));};
\ No newline at end of file
index 5934faa..eaebfd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f0f=['./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5eaed5,_0x492a7a){var _0x4bd9dd=function(_0xc9e084){while(--_0xc9e084){_0x5eaed5['push'](_0x5eaed5['shift']());}};_0x4bd9dd(++_0x492a7a);}(_0x7f0f,0xad));var _0xf7f0=function(_0x5cf0bc,_0x5318f0){_0x5cf0bc=_0x5cf0bc-0x0;var _0x375d99=_0x7f0f[_0x5cf0bc];return _0x375d99;};'use strict';var _=require(_0xf7f0('0x0'));var util=require(_0xf7f0('0x1'));var logger=require(_0xf7f0('0x2'))(_0xf7f0('0x3'));var moment=require(_0xf7f0('0x4'));var BPromise=require(_0xf7f0('0x5'));var rp=require(_0xf7f0('0x6'));var fs=require('fs');var path=require(_0xf7f0('0x7'));var rimraf=require(_0xf7f0('0x8'));var config=require('../../config/environment');var attributes=require(_0xf7f0('0x9'));module[_0xf7f0('0xa')]=function(_0x1aab10,_0x95c43a){return _0x1aab10['define']('OpenchannelApplication',attributes,{'tableName':_0xf7f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7f0('0xc'),'collate':_0xf7f0('0xd')});};
\ No newline at end of file
+var _0x2477=['bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x13d929,_0xab3e09){var _0x27eb3b=function(_0x4690e9){while(--_0x4690e9){_0x13d929['push'](_0x13d929['shift']());}};_0x27eb3b(++_0xab3e09);}(_0x2477,0x134));var _0x7247=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0x2477[_0x25cd2c];return _0x1e364c;};'use strict';var _=require(_0x7247('0x0'));var util=require('util');var logger=require(_0x7247('0x1'))(_0x7247('0x2'));var moment=require(_0x7247('0x3'));var BPromise=require(_0x7247('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7247('0x5'));var config=require(_0x7247('0x6'));var attributes=require(_0x7247('0x7'));module[_0x7247('0x8')]=function(_0x3b4ac6,_0x22533b){return _0x3b4ac6['define'](_0x7247('0x9'),attributes,{'tableName':_0x7247('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7247('0xb'),'collate':_0x7247('0xc')});};
\ No newline at end of file
index 3619bd8..62fca10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1149=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','moment','ioredis'];(function(_0x5b144f,_0x2871e2){var _0x4e3bf7=function(_0x29a892){while(--_0x29a892){_0x5b144f['push'](_0x5b144f['shift']());}};_0x4e3bf7(++_0x2871e2);}(_0x1149,0xb7));var _0x9114=function(_0xb91f94,_0x1c0bc1){_0xb91f94=_0xb91f94-0x0;var _0x46badb=_0x1149[_0xb91f94];return _0x46badb;};'use strict';var _=require(_0x9114('0x0'));var util=require('util');var moment=require(_0x9114('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9114('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9114('0x3'));var logger=require(_0x9114('0x4'))(_0x9114('0x5'));var config=require(_0x9114('0x6'));var jayson=require(_0x9114('0x7'));var client=jayson[_0x9114('0x8')][_0x9114('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45303e,_0x4a84a3,_0x3803f1){return new BPromise(function(_0x383861,_0x1545e3){return client[_0x9114('0xa')](_0x45303e,_0x3803f1)[_0x9114('0xb')](function(_0x2085f5){logger[_0x9114('0xc')](_0x9114('0xd'),_0x4a84a3,'request\x20sent');logger[_0x9114('0xe')](_0x9114('0xf'),_0x4a84a3,_0x9114('0x10'),JSON[_0x9114('0x11')](_0x2085f5));if(_0x2085f5[_0x9114('0x12')]){if(_0x2085f5[_0x9114('0x12')][_0x9114('0x13')]===0x1f4){logger[_0x9114('0x12')](_0x9114('0xd'),_0x4a84a3,_0x2085f5[_0x9114('0x12')]['message']);return _0x1545e3(_0x2085f5[_0x9114('0x12')][_0x9114('0x14')]);}logger[_0x9114('0x12')](_0x9114('0xd'),_0x4a84a3,_0x2085f5[_0x9114('0x12')]['message']);return _0x383861(_0x2085f5[_0x9114('0x12')][_0x9114('0x14')]);}else{logger[_0x9114('0xc')](_0x9114('0xd'),_0x4a84a3,_0x9114('0x10'));_0x383861(_0x2085f5['result'][_0x9114('0x14')]);}})[_0x9114('0x15')](function(_0x51d6d6){logger[_0x9114('0x12')](_0x9114('0xd'),_0x4a84a3,_0x51d6d6);_0x1545e3(_0x51d6d6);});});}exports[_0x9114('0x16')]=function(_0x10f203){var _0x3401e6=this;return new Promise(function(_0x2a3c8d,_0x49c4f7){return db[_0x9114('0x17')][_0x9114('0x18')](_0x10f203[_0x9114('0x19')],{'raw':_0x10f203[_0x9114('0x1a')]?_0x10f203['options'][_0x9114('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10f203['options']?_0x10f203[_0x9114('0x1a')][_0x9114('0x1c')]||null:null,'attributes':_0x10f203[_0x9114('0x1a')]?_0x10f203[_0x9114('0x1a')][_0x9114('0x1d')]||null:null,'limit':_0x10f203[_0x9114('0x1a')]?_0x10f203[_0x9114('0x1a')][_0x9114('0x1e')]||null:null})[_0x9114('0xb')](function(_0x3d6238){logger['info']('UpdateOpenchannelApplication',_0x10f203);logger[_0x9114('0xe')](_0x9114('0x16'),_0x10f203,JSON[_0x9114('0x11')](_0x3d6238));_0x2a3c8d(_0x3d6238);})[_0x9114('0x15')](function(_0x4cbff1){logger[_0x9114('0x12')]('UpdateOpenchannelApplication',_0x4cbff1[_0x9114('0x14')],_0x10f203);_0x49c4f7(_0x3401e6[_0x9114('0x12')](0x1f4,_0x4cbff1[_0x9114('0x14')]));});});};
\ No newline at end of file
+var _0xdd89=['then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateOpenchannelApplication','body','options','raw','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x12e22b,_0x52f025){var _0x2a6eb8=function(_0x47dd4){while(--_0x47dd4){_0x12e22b['push'](_0x12e22b['shift']());}};_0x2a6eb8(++_0x52f025);}(_0xdd89,0xcb));var _0x9dd8=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xdd89[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var moment=require(_0x9dd8('0x2'));var BPromise=require(_0x9dd8('0x3'));var rs=require(_0x9dd8('0x4'));var fs=require('fs');var Redis=require(_0x9dd8('0x5'));var db=require(_0x9dd8('0x6'))['db'];var utils=require(_0x9dd8('0x7'));var logger=require(_0x9dd8('0x8'))(_0x9dd8('0x9'));var config=require(_0x9dd8('0xa'));var jayson=require(_0x9dd8('0xb'));var client=jayson[_0x9dd8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38daea,_0xbf28f,_0x44f5a7){return new BPromise(function(_0xf84ecc,_0x762d12){return client[_0x9dd8('0xd')](_0x38daea,_0x44f5a7)[_0x9dd8('0xe')](function(_0x569c9c){logger[_0x9dd8('0xf')](_0x9dd8('0x10'),_0xbf28f,'request\x20sent');logger[_0x9dd8('0x11')](_0x9dd8('0x12'),_0xbf28f,_0x9dd8('0x13'),JSON['stringify'](_0x569c9c));if(_0x569c9c[_0x9dd8('0x14')]){if(_0x569c9c['error'][_0x9dd8('0x15')]===0x1f4){logger['error'](_0x9dd8('0x10'),_0xbf28f,_0x569c9c[_0x9dd8('0x14')][_0x9dd8('0x16')]);return _0x762d12(_0x569c9c[_0x9dd8('0x14')][_0x9dd8('0x16')]);}logger[_0x9dd8('0x14')](_0x9dd8('0x10'),_0xbf28f,_0x569c9c[_0x9dd8('0x14')]['message']);return _0xf84ecc(_0x569c9c[_0x9dd8('0x14')]['message']);}else{logger[_0x9dd8('0xf')](_0x9dd8('0x10'),_0xbf28f,_0x9dd8('0x13'));_0xf84ecc(_0x569c9c['result'][_0x9dd8('0x16')]);}})[_0x9dd8('0x17')](function(_0x36a101){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xbf28f,_0x36a101);_0x762d12(_0x36a101);});});}exports[_0x9dd8('0x18')]=function(_0x23b83a){var _0x431295=this;return new Promise(function(_0x3a2e68,_0x357202){return db['OpenchannelApplication']['update'](_0x23b83a[_0x9dd8('0x19')],{'raw':_0x23b83a[_0x9dd8('0x1a')]?_0x23b83a[_0x9dd8('0x1a')][_0x9dd8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23b83a[_0x9dd8('0x1a')]?_0x23b83a[_0x9dd8('0x1a')][_0x9dd8('0x1c')]||null:null,'attributes':_0x23b83a['options']?_0x23b83a[_0x9dd8('0x1a')][_0x9dd8('0x1d')]||null:null,'limit':_0x23b83a[_0x9dd8('0x1a')]?_0x23b83a[_0x9dd8('0x1a')]['limit']||null:null})[_0x9dd8('0xe')](function(_0x1d46db){logger[_0x9dd8('0xf')](_0x9dd8('0x18'),_0x23b83a);logger[_0x9dd8('0x11')](_0x9dd8('0x18'),_0x23b83a,JSON[_0x9dd8('0x1e')](_0x1d46db));_0x3a2e68(_0x1d46db);})[_0x9dd8('0x17')](function(_0x12a8ab){logger[_0x9dd8('0x14')](_0x9dd8('0x18'),_0x12a8ab[_0x9dd8('0x16')],_0x23b83a);_0x357202(_0x431295[_0x9dd8('0x14')](0x1f4,_0x12a8ab[_0x9dd8('0x16')]));});});};
\ No newline at end of file
index 93279f9..e242a66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec5d=['delete','openchannelinteraction:destroy','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update'];(function(_0x503103,_0x54af60){var _0x4ef8f3=function(_0x213e3d){while(--_0x213e3d){_0x503103['push'](_0x503103['shift']());}};_0x4ef8f3(++_0x54af60);}(_0xec5d,0x1a7));var _0xdec5=function(_0x6d04fb,_0x57fc9e){_0x6d04fb=_0x6d04fb-0x0;var _0x3bd644=_0xec5d[_0x6d04fb];return _0x3bd644;};'use strict';var multer=require('multer');var util=require(_0xdec5('0x0'));var path=require(_0xdec5('0x1'));var timeout=require(_0xdec5('0x2'));var express=require('express');var router=express[_0xdec5('0x3')]();var fs_extra=require(_0xdec5('0x4'));var auth=require(_0xdec5('0x5'));var interaction=require(_0xdec5('0x6'));var config=require(_0xdec5('0x7'));var controller=require(_0xdec5('0x8'));router[_0xdec5('0x9')]('/',auth[_0xdec5('0xa')](),controller['index']);router['get']('/describe',auth[_0xdec5('0xa')](),controller['describe']);router[_0xdec5('0x9')](_0xdec5('0xb'),auth[_0xdec5('0xa')](),controller[_0xdec5('0xc')]);router[_0xdec5('0x9')](_0xdec5('0xd'),auth['isAuthenticated'](),controller[_0xdec5('0xe')]);router[_0xdec5('0x9')](_0xdec5('0xf'),auth['isAuthenticated'](),controller[_0xdec5('0x10')]);router[_0xdec5('0x11')]('/',auth[_0xdec5('0xa')](),controller['create']);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xdec5('0x12')]);router[_0xdec5('0x11')](_0xdec5('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0xdec5('0x14'),_0xdec5('0x15')),controller['addTags']);router[_0xdec5('0x16')](_0xdec5('0xb'),auth[_0xdec5('0xa')](),interaction[_0xdec5('0x17')](_0xdec5('0x14'),_0xdec5('0x18')),controller['update']);router[_0xdec5('0x19')]('/:id',auth[_0xdec5('0xa')](),interaction['tracked'](_0xdec5('0x14'),_0xdec5('0x1a')),controller[_0xdec5('0x1b')]);router['delete'](_0xdec5('0x13'),auth[_0xdec5('0xa')](),controller['removeTags']);module['exports']=router;
\ No newline at end of file
+var _0x3708=['addMessage','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','/:id/download','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3708,0x1cb));var _0x8370=function(_0x44f481,_0x307be6){_0x44f481=_0x44f481-0x0;var _0x1462f7=_0x3708[_0x44f481];return _0x1462f7;};'use strict';var multer=require(_0x8370('0x0'));var util=require('util');var path=require(_0x8370('0x1'));var timeout=require(_0x8370('0x2'));var express=require(_0x8370('0x3'));var router=express[_0x8370('0x4')]();var fs_extra=require(_0x8370('0x5'));var auth=require(_0x8370('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8370('0x7'));var controller=require(_0x8370('0x8'));router[_0x8370('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8370('0x9')]('/describe',auth[_0x8370('0xa')](),controller['describe']);router['get'](_0x8370('0xb'),auth['isAuthenticated'](),controller[_0x8370('0xc')]);router[_0x8370('0x9')](_0x8370('0xd'),auth[_0x8370('0xa')](),controller['getMessages']);router[_0x8370('0x9')](_0x8370('0xe'),auth[_0x8370('0xa')](),controller['download']);router[_0x8370('0xf')]('/',auth[_0x8370('0xa')](),controller[_0x8370('0x10')]);router[_0x8370('0xf')](_0x8370('0xd'),auth['isAuthenticated'](),controller[_0x8370('0x11')]);router[_0x8370('0xf')]('/:id/tags',auth[_0x8370('0xa')](),interaction[_0x8370('0x12')](_0x8370('0x13'),'openchannelinteraction:addtags'),controller[_0x8370('0x14')]);router[_0x8370('0x15')](_0x8370('0xb'),auth[_0x8370('0xa')](),interaction[_0x8370('0x12')]('openchannel',_0x8370('0x16')),controller[_0x8370('0x17')]);router[_0x8370('0x18')](_0x8370('0xb'),auth[_0x8370('0xa')](),interaction[_0x8370('0x12')](_0x8370('0x13'),'openchannelinteraction:destroy'),controller[_0x8370('0x19')]);router['delete']('/:id/tags',auth[_0x8370('0xa')](),controller[_0x8370('0x1a')]);module[_0x8370('0x1b')]=router;
\ No newline at end of file
index f7ec698..d751a62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd28=['STRING','DATE','ENUM','out','exports','BOOLEAN'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xfd28,0x148));var _0x8fd2=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xfd28[_0x35fabd];return _0x61a8ee;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'closed':{'type':Sequelize[_0x8fd2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8fd2('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8fd2('0x2')]},'note':{'type':Sequelize[_0x8fd2('0x2')]},'read1stAt':{'type':Sequelize[_0x8fd2('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x8fd2('0x2')]},'lastMsgAt':{'type':Sequelize[_0x8fd2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8fd2('0x4')]('in',_0x8fd2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8fd2('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x8fd2('0x1')],'defaultValue':![]}};
\ No newline at end of file
+var _0xe57e=['ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x1e234f,_0x7da15d){var _0x5cfdab=function(_0x4d060a){while(--_0x4d060a){_0x1e234f['push'](_0x1e234f['shift']());}};_0x5cfdab(++_0x7da15d);}(_0xe57e,0xf2));var _0xee57=function(_0x4a9c8a,_0x2f82ee){_0x4a9c8a=_0x4a9c8a-0x0;var _0x439cc7=_0xe57e[_0x4a9c8a];return _0x439cc7;};'use strict';var Sequelize=require(_0xee57('0x0'));module['exports']={'closed':{'type':Sequelize[_0xee57('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee57('0x2')]},'disposition':{'type':Sequelize[_0xee57('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xee57('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xee57('0x3')]},'externalUrl':{'type':Sequelize[_0xee57('0x3')]},'lastMsgAt':{'type':Sequelize[_0xee57('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xee57('0x4')]('in',_0xee57('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xee57('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xee57('0x1')],'defaultValue':![]}};
\ No newline at end of file
index 1858630..a68de7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4747=['options','findAll','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','files','root','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','attachments','Attachment','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','show','from','params','model','OpenchannelInteraction','filters','attributes','fields','length','includeAll','include','merge','find','create','body','catch','describe','addMessage','ids','omit','findOne','keys','OpenchannelMessage','intersection','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format'];(function(_0x2a6afe,_0x430775){var _0x499551=function(_0x45fb2a){while(--_0x45fb2a){_0x2a6afe['push'](_0x2a6afe['shift']());}};_0x499551(++_0x430775);}(_0x4747,0xb8));var _0x7474=function(_0x4c7ee1,_0xdd33ba){_0x4c7ee1=_0x4c7ee1-0x0;var _0x3576fb=_0x4747[_0x4c7ee1];return _0x3576fb;};'use strict';var rimraf=require(_0x7474('0x0'));var zipdir=require(_0x7474('0x1'));var moment=require(_0x7474('0x2'));var util=require('util');var path=require(_0x7474('0x3'));var ejs=require(_0x7474('0x4'));var fs=require('fs');var _=require(_0x7474('0x5'));var Redis=require(_0x7474('0x6'));var interaction=require(_0x7474('0x7'));var qs=require(_0x7474('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x7474('0x9'))['db'];config[_0x7474('0xa')]=_[_0x7474('0xb')](config['redis'],{'host':_0x7474('0xc'),'port':0x18eb});var socket=require(_0x7474('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x7474('0xe')](socket);function respondWithStatusCode(_0x514844,_0x527850){_0x527850=_0x527850||0xcc;return function(_0x4deb0e){if(_0x4deb0e){return _0x514844[_0x7474('0xf')](_0x527850);}return _0x514844[_0x7474('0x10')](_0x527850)[_0x7474('0x11')]();};}function respondWithResult(_0x8b12b7,_0x1dc68d){_0x1dc68d=_0x1dc68d||0xc8;return function(_0x24b2bd){if(_0x24b2bd){return _0x8b12b7[_0x7474('0x10')](_0x1dc68d)[_0x7474('0x12')](_0x24b2bd);}};}function respondWithFilteredResult(_0x8c3d79,_0x45636b){return function(_0x2d147e){if(_0x2d147e){var _0x547087=typeof _0x45636b['offset']===_0x7474('0x13')&&typeof _0x45636b[_0x7474('0x14')]==='undefined';var _0x40e466=_0x2d147e['count'];var _0x46d110=_0x547087?0x0:_0x45636b['offset'];var _0x5b3e39=_0x547087?_0x2d147e[_0x7474('0x15')]:_0x45636b[_0x7474('0x16')]+_0x45636b[_0x7474('0x14')];var _0x3c705b;if(_0x5b3e39>=_0x40e466){_0x5b3e39=_0x40e466;_0x3c705b=0xc8;}else{_0x3c705b=0xce;}_0x8c3d79[_0x7474('0x10')](_0x3c705b);return _0x8c3d79[_0x7474('0x17')]('Content-Range',_0x46d110+'-'+_0x5b3e39+'/'+_0x40e466)[_0x7474('0x12')](_0x2d147e);}return null;};}function saveUpdates(_0x875d0f){return function(_0x2cdfd2){if(_0x2cdfd2){return _0x2cdfd2[_0x7474('0x18')](_0x875d0f)[_0x7474('0x19')](function(_0x37214c){return _0x37214c;});}return null;};}function removeEntity(_0x3122db){return function(_0x1b9613){if(_0x1b9613){return _0x1b9613[_0x7474('0x1a')]()[_0x7474('0x19')](function(){_0x3122db['status'](0xcc)[_0x7474('0x11')]();});}};}function handleEntityNotFound(_0x569214){return function(_0x2b6f52){if(!_0x2b6f52){_0x569214['sendStatus'](0x194);}return _0x2b6f52;};}function handleError(_0x10bc79,_0x43cf74){_0x43cf74=_0x43cf74||0x1f4;return function(_0x3019c4){logger['error'](_0x3019c4[_0x7474('0x1b')]);if(_0x3019c4[_0x7474('0x1c')]){delete _0x3019c4[_0x7474('0x1c')];}_0x10bc79[_0x7474('0x10')](_0x43cf74)['send'](_0x3019c4);};}exports[_0x7474('0x1d')]=function(_0x5bc7ad,_0xd85a92){var _0x2a7948={};var _0x19924a=_[_0x7474('0x1e')](db['OpenchannelInteraction'][_0x7474('0x1f')],function(_0x344b73){return{'name':_0x344b73[_0x7474('0x20')],'type':_0x344b73[_0x7474('0x21')][_0x7474('0x22')]};});_0x2a7948=qs[_0x7474('0x23')](_0x19924a,_0x5bc7ad);return interaction['findAll'](_0x7474('0x24'),_0x5bc7ad[_0x7474('0x25')],_0x5bc7ad['user'],_0x2a7948,_0x19924a)[_0x7474('0x19')](respondWithFilteredResult(_0xd85a92,_0x2a7948))['catch'](handleError(_0xd85a92,null));};exports[_0x7474('0x26')]=function(_0x597a96,_0x34c4cc){var _0x4e232f={};if(_0x597a96[_0x7474('0x25')][_0x7474('0x21')]&&_0x597a96[_0x7474('0x25')][_0x7474('0x21')]===_0x7474('0x27')){_0x4e232f[_0x7474('0x27')]=_0x597a96[_0x7474('0x28')]['id'];}else{_0x4e232f['id']=_0x597a96['params']['id'];}var _0x445aa6={'raw':![],'where':_0x4e232f},_0x94bcbd={};_0x94bcbd[_0x7474('0x29')]=_['keys'](db[_0x7474('0x2a')][_0x7474('0x1f')]);_0x94bcbd['query']=_['keys'](_0x597a96[_0x7474('0x25')]);_0x94bcbd[_0x7474('0x2b')]=_['intersection'](_0x94bcbd[_0x7474('0x29')],_0x94bcbd['query']);_0x445aa6[_0x7474('0x2c')]=_['intersection'](_0x94bcbd[_0x7474('0x29')],qs[_0x7474('0x2d')](_0x597a96['query'][_0x7474('0x2d')]));_0x445aa6['attributes']=_0x445aa6[_0x7474('0x2c')][_0x7474('0x2e')]?_0x445aa6[_0x7474('0x2c')]:_0x94bcbd['model'];if(_0x597a96[_0x7474('0x25')][_0x7474('0x2f')]){_0x445aa6[_0x7474('0x30')]=[{'all':!![]}];}_0x445aa6=_[_0x7474('0x31')]({},_0x445aa6,_0x597a96['options']);return db['OpenchannelInteraction'][_0x7474('0x32')](_0x445aa6)[_0x7474('0x19')](handleEntityNotFound(_0x34c4cc,null))[_0x7474('0x19')](respondWithResult(_0x34c4cc,null))['catch'](handleError(_0x34c4cc,null));};exports[_0x7474('0x33')]=function(_0x2f6200,_0x192a9b){return db[_0x7474('0x2a')][_0x7474('0x33')](_0x2f6200[_0x7474('0x34')],{})['then'](respondWithResult(_0x192a9b,0xc9))[_0x7474('0x35')](handleError(_0x192a9b,null));};exports[_0x7474('0x18')]=function(_0x23f4b1,_0x49fe50){if(_0x23f4b1[_0x7474('0x34')]['id']){delete _0x23f4b1[_0x7474('0x34')]['id'];}return db[_0x7474('0x2a')][_0x7474('0x32')]({'where':{'id':_0x23f4b1[_0x7474('0x28')]['id']}})[_0x7474('0x19')](handleEntityNotFound(_0x49fe50,null))['then'](saveUpdates(_0x23f4b1[_0x7474('0x34')],null))[_0x7474('0x19')](respondWithResult(_0x49fe50,null))[_0x7474('0x35')](handleError(_0x49fe50,null));};exports['destroy']=function(_0x591072,_0x555669){return db['OpenchannelInteraction'][_0x7474('0x32')]({'where':{'id':_0x591072[_0x7474('0x28')]['id']}})[_0x7474('0x19')](handleEntityNotFound(_0x555669,null))[_0x7474('0x19')](removeEntity(_0x555669,null))[_0x7474('0x35')](handleError(_0x555669,null));};exports[_0x7474('0x36')]=function(_0xd6624b,_0x31fe80){return db[_0x7474('0x2a')][_0x7474('0x36')]()[_0x7474('0x19')](respondWithResult(_0x31fe80,null))[_0x7474('0x35')](handleError(_0x31fe80,null));};exports[_0x7474('0x37')]=function(_0x4ca97f,_0x196c6c){return db['OpenchannelMessage'][_0x7474('0x32')]({'where':{'id':_0x4ca97f[_0x7474('0x28')]['id']}})[_0x7474('0x19')](handleEntityNotFound(_0x196c6c,null))[_0x7474('0x19')](function(_0x4d7a96){if(_0x4d7a96){return _0x4d7a96[_0x7474('0x37')](_0x4ca97f['body'][_0x7474('0x38')],_[_0x7474('0x39')](_0x4ca97f[_0x7474('0x34')],[_0x7474('0x38'),'id'])||{});}})['then'](respondWithResult(_0x196c6c,null))[_0x7474('0x35')](handleError(_0x196c6c,null));};exports['getMessages']=function(_0x14773f,_0x403c2d){var _0x4595b0={'raw':![],'where':{}};var _0x259e20={};var _0x2d6e99={'count':0x0,'rows':[]};return db[_0x7474('0x2a')][_0x7474('0x3a')]({'where':{'id':_0x14773f[_0x7474('0x28')]['id']}})[_0x7474('0x19')](handleEntityNotFound(_0x403c2d,null))[_0x7474('0x19')](function(_0x471352){if(_0x471352){_0x259e20['model']=_[_0x7474('0x3b')](db[_0x7474('0x3c')][_0x7474('0x1f')]);_0x259e20[_0x7474('0x25')]=_['keys'](_0x14773f['query']);_0x259e20[_0x7474('0x2b')]=_[_0x7474('0x3d')](_0x259e20[_0x7474('0x29')],_0x259e20[_0x7474('0x25')]);_0x4595b0['attributes']=_[_0x7474('0x3d')](_0x259e20[_0x7474('0x29')],qs[_0x7474('0x2d')](_0x14773f[_0x7474('0x25')][_0x7474('0x2d')]));_0x4595b0[_0x7474('0x2c')]=_0x4595b0[_0x7474('0x2c')][_0x7474('0x2e')]?_0x4595b0['attributes']:_0x259e20[_0x7474('0x29')];if(!_0x14773f[_0x7474('0x25')][_0x7474('0x3e')](_0x7474('0x3f'))){_0x4595b0[_0x7474('0x14')]=qs[_0x7474('0x14')](_0x14773f['query'][_0x7474('0x14')]);_0x4595b0['offset']=qs[_0x7474('0x16')](_0x14773f[_0x7474('0x25')][_0x7474('0x16')]);}_0x4595b0['order']=qs[_0x7474('0x40')](_0x14773f['query'][_0x7474('0x40')]);_0x4595b0[_0x7474('0x41')]=qs[_0x7474('0x2b')](_[_0x7474('0x42')](_0x14773f[_0x7474('0x25')],_0x259e20['filters']));_0x4595b0[_0x7474('0x41')][_0x7474('0x43')]=_0x471352['id'];if(_0x14773f[_0x7474('0x25')][_0x7474('0x44')]){_0x4595b0[_0x7474('0x41')]=_[_0x7474('0x31')](_0x4595b0[_0x7474('0x41')],{'$or':_[_0x7474('0x1e')](_0x4595b0[_0x7474('0x2c')],function(_0x403115){var _0x494c={};_0x494c[_0x403115]={'$like':'%'+_0x14773f[_0x7474('0x25')][_0x7474('0x44')]+'%'};return _0x494c;})});}if(_0x14773f[_0x7474('0x25')][_0x7474('0x45')]){var _0xc9bacb=_0x14773f[_0x7474('0x25')][_0x7474('0x45')][_0x7474('0x46')](',');var _0x48bfaa={};_0x48bfaa[_0xc9bacb[0x0]]={'$gte':moment(_0xc9bacb[0x1])[_0x7474('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4595b0[_0x7474('0x41')]=_[_0x7474('0x31')](_0x4595b0['where'],_0x48bfaa);}_0x4595b0=_[_0x7474('0x31')]({},_0x4595b0,_0x14773f[_0x7474('0x48')]);return db[_0x7474('0x3c')]['count']({'where':_0x4595b0[_0x7474('0x41')]})[_0x7474('0x19')](function(_0x55235d){_0x2d6e99['count']=_0x55235d;if(_0x14773f[_0x7474('0x25')][_0x7474('0x2f')]){_0x4595b0['include']=[{'all':!![]}];}return db[_0x7474('0x3c')][_0x7474('0x49')](_0x4595b0);})[_0x7474('0x19')](function(_0x3ace05){_0x2d6e99['rows']=_0x3ace05;return _0x2d6e99;});}})[_0x7474('0x19')](respondWithFilteredResult(_0x403c2d,_0x4595b0))[_0x7474('0x35')](handleError(_0x403c2d,null));};exports[_0x7474('0x4a')]=function(_0x2b904a,_0xa01cd9){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2b904a[_0x7474('0x28')]['id']}})[_0x7474('0x19')](handleEntityNotFound(_0xa01cd9,null))['then'](function(_0x472a47){if(_0x472a47){return _0x472a47['setTags'](_0x2b904a[_0x7474('0x34')][_0x7474('0x38')],_['omit'](_0x2b904a[_0x7474('0x34')],[_0x7474('0x38'),'id'])||{})[_0x7474('0x4b')](function(){return db[_0x7474('0x4c')][_0x7474('0x49')]({'attributes':['id','name',_0x7474('0x4d')],'where':{'id':_0x2b904a[_0x7474('0x34')]['ids']}});})[_0x7474('0x19')](function(_0x3fd102){socket[_0x7474('0x4e')](_0x7474('0x4f'),{'id':Number(_0x2b904a[_0x7474('0x28')]['id']),'tags':_0x3fd102||[]});return{'id':Number(_0x2b904a['params']['id']),'tags':_0x3fd102||[]};});}})[_0x7474('0x19')](respondWithResult(_0xa01cd9,null))[_0x7474('0x35')](handleError(_0xa01cd9,null));};exports[_0x7474('0x50')]=function(_0x35299f,_0x53842a){return db[_0x7474('0x2a')][_0x7474('0x32')]({'where':{'id':_0x35299f[_0x7474('0x28')]['id']}})[_0x7474('0x19')](handleEntityNotFound(_0x53842a,null))[_0x7474('0x19')](function(_0x5aaf09){if(_0x5aaf09){return _0x5aaf09[_0x7474('0x50')](_0x35299f[_0x7474('0x25')]['ids']);}})['then'](respondWithStatusCode(_0x53842a,null))['catch'](handleError(_0x53842a,null));};exports[_0x7474('0x51')]=function(_0x131a9e,_0x41f082){var _0x549163=moment()[_0x7474('0x52')]()[_0x7474('0x53')]();var _0x14671b=path[_0x7474('0x54')](config['root'],'server',_0x7474('0x55'),'tmp');var _0x41d4fb=path[_0x7474('0x54')](config[_0x7474('0x56')],_0x7474('0x57'),'files','attachments');var _0x183f11=path[_0x7474('0x54')](_0x14671b,_0x549163);var _0x528ac8=util[_0x7474('0x47')](_0x7474('0x58'),_0x131a9e[_0x7474('0x28')]['id'],_0x549163);var _0x1475bf=path['join'](_0x14671b,_0x528ac8);var _0x5cb253=[];_0x5cb253[_0x7474('0x59')]({'model':db[_0x7474('0x5a')],'as':'User','attributes':['id',_0x7474('0x5b')],'raw':!![]});_0x5cb253[_0x7474('0x59')]({'model':db[_0x7474('0x5c')],'as':_0x7474('0x5d'),'attributes':['id',_0x7474('0x5e'),'lastName'],'raw':!![]});if(_0x131a9e[_0x7474('0x25')][_0x7474('0x5f')]){_0x5cb253[_0x7474('0x59')]({'model':db[_0x7474('0x60')],'as':_0x7474('0x60'),'raw':!![]});}var _0x16decf=[{'model':db[_0x7474('0x3c')],'as':'Messages','attributes':['id',_0x7474('0x34'),_0x7474('0x61'),_0x7474('0x62'),_0x7474('0x63'),_0x7474('0x64')],'include':_0x5cb253}];_0x16decf['push']({'model':db['OpenchannelAccount'],'as':_0x7474('0x65'),'attributes':['id','name']});_0x16decf[_0x7474('0x59')]({'model':db['User'],'as':_0x7474('0x66'),'attributes':['id',_0x7474('0x5b')]});return db[_0x7474('0x2a')][_0x7474('0x32')]({'where':{'id':_0x131a9e[_0x7474('0x28')]['id']},'include':_0x16decf})[_0x7474('0x19')](handleEntityNotFound(_0x41f082,null))[_0x7474('0x19')](function(_0x4d1924){if(_0x4d1924){var _0x1cfe48=_0x4d1924[_0x7474('0x67')]({'plain':!![]});fs[_0x7474('0x68')](_0x183f11);var _0x4af74d={'channel':_0x7474('0x69'),'account':_0x1cfe48[_0x7474('0x65')][_0x7474('0x1c')],'agent':_0x1cfe48[_0x7474('0x66')]?_0x1cfe48[_0x7474('0x66')][_0x7474('0x5b')]:'N.A.','createdAt':moment(_0x1cfe48[_0x7474('0x61')])['format'](_0x7474('0x6a'))[_0x7474('0x53')](),'closedAt':_0x1cfe48[_0x7474('0x6b')]?moment(_0x1cfe48[_0x7474('0x6c')])['format'](_0x7474('0x6a'))[_0x7474('0x53')]():'','disposition':_0x1cfe48[_0x7474('0x6d')],'visibility':_0x1cfe48[_0x7474('0x6e')]?_0x7474('0x6f'):_0x7474('0x70'),'messages':_(_0x1cfe48[_0x7474('0x71')])['filter']({'secret':![]})[_0x7474('0x1e')](function(_0x1748da){if(_0x1748da[_0x7474('0x60')]){var _0x49592c=path[_0x7474('0x54')](_0x41d4fb,_0x1748da[_0x7474('0x60')][_0x7474('0x72')]);if(fs['existsSync'](_0x49592c)){fs[_0x7474('0x73')](_0x49592c)[_0x7474('0x74')](fs[_0x7474('0x75')](path['join'](_0x183f11,_0x1748da[_0x7474('0x60')][_0x7474('0x72')])));}}return{'date':moment(_0x1748da[_0x7474('0x61')])['format'](_0x7474('0x6a'))[_0x7474('0x53')](),'sender':_0x1748da[_0x7474('0x62')]===_0x7474('0x76')?_0x1748da[_0x7474('0x5a')]?_0x1748da[_0x7474('0x5a')][_0x7474('0x5b')]:_0x7474('0x77'):_0x1748da[_0x7474('0x5d')][_0x7474('0x5e')]+(_0x1748da['Contact'][_0x7474('0x78')]?'\x20'+_0x1748da[_0x7474('0x5d')]['lastName']:''),'body':_0x1748da[_0x7474('0x60')]?_0x1748da['Attachment']['basename']:_0x1748da[_0x7474('0x34')],'direction':_0x1748da['direction']===_0x7474('0x76')?'A':'C','secret':_0x1748da[_0x7474('0x63')],'read':_0x1748da[_0x7474('0x64')],'attachment':_0x1748da['Attachment']};})['value']()};return ejs[_0x7474('0x79')](path['join'](config['root'],'server',_0x7474('0x7a'),_0x7474('0x7b')),{'interaction':_0x4af74d})[_0x7474('0x19')](function(_0x4342bd){var _0x1a68f0=path[_0x7474('0x54')](_0x183f11,'transcript-'+_0x1cfe48['id']+'-'+_0x549163+'.pdf');var _0x4c8f7e={'path':_0x1a68f0,'channel':_0x7474('0x69'),'interactionId':_0x1cfe48['id']};return pdf[_0x7474('0x7c')](_0x4342bd,_0x4c8f7e);})['then'](function(){return new Promise(function(_0x5dfcaf,_0x4135b0){zipdir(_0x183f11,{'saveTo':_0x1475bf},function(_0x495250,_0x40f3df){if(_0x495250)return _0x4135b0(_0x495250);return _0x5dfcaf(_0x40f3df);});})[_0x7474('0x19')](function(){return new Promise(function(_0x796a00,_0x395251){rimraf(_0x183f11,function(_0x5e7c2e){if(_0x5e7c2e)_0x395251(_0x5e7c2e);return _0x796a00();});});})[_0x7474('0x19')](function(){return _0x41f082[_0x7474('0x51')](_0x1475bf,_0x528ac8,function(_0x9b7b4d){if(_0x9b7b4d){logger[_0x7474('0x7d')](_0x7474('0x7e'),_0x9b7b4d);}else{fs[_0x7474('0x7f')](_0x1475bf);}});});});}else{return _0x41f082[_0x7474('0xf')](0xc8);}})[_0x7474('0x35')](handleError(_0x41f082,null));};
\ No newline at end of file
+var _0xa74d=['getOptions','findAll','openchannel','query','user','catch','show','from','params','model','rawAttributes','keys','intersection','attributes','fields','length','include','merge','options','find','create','update','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','OpenchannelInteractionId','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','get','mkdirSync','Owner','N.A.','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','value','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','map','OpenchannelInteraction','type'];(function(_0x1dd6eb,_0x40feb4){var _0x288435=function(_0x3ca654){while(--_0x3ca654){_0x1dd6eb['push'](_0x1dd6eb['shift']());}};_0x288435(++_0x40feb4);}(_0xa74d,0x15f));var _0xda74=function(_0x1c240e,_0x17de31){_0x1c240e=_0x1c240e-0x0;var _0x2026de=_0xa74d[_0x1c240e];return _0x2026de;};'use strict';var rimraf=require(_0xda74('0x0'));var zipdir=require(_0xda74('0x1'));var moment=require(_0xda74('0x2'));var util=require('util');var path=require(_0xda74('0x3'));var ejs=require(_0xda74('0x4'));var fs=require('fs');var _=require(_0xda74('0x5'));var Redis=require(_0xda74('0x6'));var interaction=require(_0xda74('0x7'));var qs=require(_0xda74('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require(_0xda74('0x9'));var db=require('../../mysqldb')['db'];config[_0xda74('0xa')]=_[_0xda74('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xda74('0xc'))(new Redis(config[_0xda74('0xa')]));require('./openchannelInteraction.socket')[_0xda74('0xd')](socket);function respondWithStatusCode(_0x449446,_0x515bcb){_0x515bcb=_0x515bcb||0xcc;return function(_0x21efe9){if(_0x21efe9){return _0x449446[_0xda74('0xe')](_0x515bcb);}return _0x449446[_0xda74('0xf')](_0x515bcb)[_0xda74('0x10')]();};}function respondWithResult(_0x16b620,_0x1e9bb0){_0x1e9bb0=_0x1e9bb0||0xc8;return function(_0x3f11fd){if(_0x3f11fd){return _0x16b620[_0xda74('0xf')](_0x1e9bb0)['json'](_0x3f11fd);}};}function respondWithFilteredResult(_0x40e092,_0x436c8f){return function(_0x1db93e){if(_0x1db93e){var _0x23dd42=typeof _0x436c8f[_0xda74('0x11')]===_0xda74('0x12')&&typeof _0x436c8f[_0xda74('0x13')]===_0xda74('0x12');var _0x2d8082=_0x1db93e[_0xda74('0x14')];var _0x2f35ee=_0x23dd42?0x0:_0x436c8f[_0xda74('0x11')];var _0x3e38a4=_0x23dd42?_0x1db93e['count']:_0x436c8f['offset']+_0x436c8f['limit'];var _0x1e1463;if(_0x3e38a4>=_0x2d8082){_0x3e38a4=_0x2d8082;_0x1e1463=0xc8;}else{_0x1e1463=0xce;}_0x40e092['status'](_0x1e1463);return _0x40e092[_0xda74('0x15')](_0xda74('0x16'),_0x2f35ee+'-'+_0x3e38a4+'/'+_0x2d8082)['json'](_0x1db93e);}return null;};}function saveUpdates(_0x148665){return function(_0x49245a){if(_0x49245a){return _0x49245a['update'](_0x148665)[_0xda74('0x17')](function(_0x5de03e){return _0x5de03e;});}return null;};}function removeEntity(_0x110882){return function(_0x4a4acb){if(_0x4a4acb){return _0x4a4acb[_0xda74('0x18')]()[_0xda74('0x17')](function(){_0x110882['status'](0xcc)[_0xda74('0x10')]();});}};}function handleEntityNotFound(_0x4ef851){return function(_0x45c45e){if(!_0x45c45e){_0x4ef851[_0xda74('0xe')](0x194);}return _0x45c45e;};}function handleError(_0x5ac67b,_0x3d1b34){_0x3d1b34=_0x3d1b34||0x1f4;return function(_0x577033){logger[_0xda74('0x19')](_0x577033['stack']);if(_0x577033[_0xda74('0x1a')]){delete _0x577033['name'];}_0x5ac67b['status'](_0x3d1b34)['send'](_0x577033);};}exports['index']=function(_0x4788f8,_0x26fd8e){var _0x3e0f16={};var _0x4f362a=_[_0xda74('0x1b')](db[_0xda74('0x1c')]['rawAttributes'],function(_0x27a3cf){return{'name':_0x27a3cf['fieldName'],'type':_0x27a3cf[_0xda74('0x1d')]['key']};});_0x3e0f16=qs[_0xda74('0x1e')](_0x4f362a,_0x4788f8);return interaction[_0xda74('0x1f')](_0xda74('0x20'),_0x4788f8[_0xda74('0x21')],_0x4788f8[_0xda74('0x22')],_0x3e0f16,_0x4f362a)[_0xda74('0x17')](respondWithFilteredResult(_0x26fd8e,_0x3e0f16))[_0xda74('0x23')](handleError(_0x26fd8e,null));};exports[_0xda74('0x24')]=function(_0x23e1e1,_0x216361){var _0x977446={};if(_0x23e1e1['query'][_0xda74('0x1d')]&&_0x23e1e1['query'][_0xda74('0x1d')]===_0xda74('0x25')){_0x977446['from']=_0x23e1e1['params']['id'];}else{_0x977446['id']=_0x23e1e1[_0xda74('0x26')]['id'];}var _0x50218e={'raw':![],'where':_0x977446},_0xdfa1ea={};_0xdfa1ea[_0xda74('0x27')]=_['keys'](db[_0xda74('0x1c')][_0xda74('0x28')]);_0xdfa1ea[_0xda74('0x21')]=_[_0xda74('0x29')](_0x23e1e1[_0xda74('0x21')]);_0xdfa1ea['filters']=_[_0xda74('0x2a')](_0xdfa1ea[_0xda74('0x27')],_0xdfa1ea[_0xda74('0x21')]);_0x50218e[_0xda74('0x2b')]=_['intersection'](_0xdfa1ea[_0xda74('0x27')],qs['fields'](_0x23e1e1[_0xda74('0x21')][_0xda74('0x2c')]));_0x50218e['attributes']=_0x50218e[_0xda74('0x2b')][_0xda74('0x2d')]?_0x50218e[_0xda74('0x2b')]:_0xdfa1ea[_0xda74('0x27')];if(_0x23e1e1[_0xda74('0x21')]['includeAll']){_0x50218e[_0xda74('0x2e')]=[{'all':!![]}];}_0x50218e=_[_0xda74('0x2f')]({},_0x50218e,_0x23e1e1[_0xda74('0x30')]);return db[_0xda74('0x1c')][_0xda74('0x31')](_0x50218e)[_0xda74('0x17')](handleEntityNotFound(_0x216361,null))[_0xda74('0x17')](respondWithResult(_0x216361,null))['catch'](handleError(_0x216361,null));};exports[_0xda74('0x32')]=function(_0x4fe94e,_0x265c00){return db[_0xda74('0x1c')][_0xda74('0x32')](_0x4fe94e['body'],{})['then'](respondWithResult(_0x265c00,0xc9))[_0xda74('0x23')](handleError(_0x265c00,null));};exports[_0xda74('0x33')]=function(_0x51108d,_0x12b4ff){if(_0x51108d[_0xda74('0x34')]['id']){delete _0x51108d[_0xda74('0x34')]['id'];}return db[_0xda74('0x1c')][_0xda74('0x31')]({'where':{'id':_0x51108d[_0xda74('0x26')]['id']}})[_0xda74('0x17')](handleEntityNotFound(_0x12b4ff,null))['then'](saveUpdates(_0x51108d[_0xda74('0x34')],null))[_0xda74('0x17')](respondWithResult(_0x12b4ff,null))[_0xda74('0x23')](handleError(_0x12b4ff,null));};exports['destroy']=function(_0x1f3a9c,_0x4130ec){return db[_0xda74('0x1c')][_0xda74('0x31')]({'where':{'id':_0x1f3a9c['params']['id']}})[_0xda74('0x17')](handleEntityNotFound(_0x4130ec,null))[_0xda74('0x17')](removeEntity(_0x4130ec,null))['catch'](handleError(_0x4130ec,null));};exports[_0xda74('0x35')]=function(_0x2435eb,_0x4dc500){return db[_0xda74('0x1c')][_0xda74('0x35')]()[_0xda74('0x17')](respondWithResult(_0x4dc500,null))[_0xda74('0x23')](handleError(_0x4dc500,null));};exports[_0xda74('0x36')]=function(_0x537ade,_0x5edc0a){return db[_0xda74('0x37')][_0xda74('0x31')]({'where':{'id':_0x537ade[_0xda74('0x26')]['id']}})['then'](handleEntityNotFound(_0x5edc0a,null))[_0xda74('0x17')](function(_0x305f4f){if(_0x305f4f){return _0x305f4f['addMessage'](_0x537ade[_0xda74('0x34')]['ids'],_[_0xda74('0x38')](_0x537ade[_0xda74('0x34')],[_0xda74('0x39'),'id'])||{});}})['then'](respondWithResult(_0x5edc0a,null))[_0xda74('0x23')](handleError(_0x5edc0a,null));};exports[_0xda74('0x3a')]=function(_0x3428c9,_0xf8a3ca){var _0x74200a={'raw':![],'where':{}};var _0x22b662={};var _0x326cec={'count':0x0,'rows':[]};return db[_0xda74('0x1c')][_0xda74('0x3b')]({'where':{'id':_0x3428c9[_0xda74('0x26')]['id']}})['then'](handleEntityNotFound(_0xf8a3ca,null))[_0xda74('0x17')](function(_0x7020de){if(_0x7020de){_0x22b662['model']=_[_0xda74('0x29')](db[_0xda74('0x37')][_0xda74('0x28')]);_0x22b662['query']=_['keys'](_0x3428c9[_0xda74('0x21')]);_0x22b662[_0xda74('0x3c')]=_['intersection'](_0x22b662[_0xda74('0x27')],_0x22b662[_0xda74('0x21')]);_0x74200a[_0xda74('0x2b')]=_[_0xda74('0x2a')](_0x22b662[_0xda74('0x27')],qs[_0xda74('0x2c')](_0x3428c9[_0xda74('0x21')][_0xda74('0x2c')]));_0x74200a[_0xda74('0x2b')]=_0x74200a[_0xda74('0x2b')]['length']?_0x74200a[_0xda74('0x2b')]:_0x22b662[_0xda74('0x27')];if(!_0x3428c9[_0xda74('0x21')][_0xda74('0x3d')](_0xda74('0x3e'))){_0x74200a[_0xda74('0x13')]=qs[_0xda74('0x13')](_0x3428c9[_0xda74('0x21')][_0xda74('0x13')]);_0x74200a[_0xda74('0x11')]=qs[_0xda74('0x11')](_0x3428c9[_0xda74('0x21')]['offset']);}_0x74200a[_0xda74('0x3f')]=qs['sort'](_0x3428c9[_0xda74('0x21')][_0xda74('0x40')]);_0x74200a['where']=qs[_0xda74('0x3c')](_[_0xda74('0x41')](_0x3428c9[_0xda74('0x21')],_0x22b662[_0xda74('0x3c')]));_0x74200a['where'][_0xda74('0x42')]=_0x7020de['id'];if(_0x3428c9[_0xda74('0x21')]['filter']){_0x74200a['where']=_[_0xda74('0x2f')](_0x74200a[_0xda74('0x43')],{'$or':_[_0xda74('0x1b')](_0x74200a[_0xda74('0x2b')],function(_0x4ef244){var _0xbffffc={};_0xbffffc[_0x4ef244]={'$like':'%'+_0x3428c9[_0xda74('0x21')][_0xda74('0x44')]+'%'};return _0xbffffc;})});}if(_0x3428c9[_0xda74('0x21')][_0xda74('0x45')]){var _0x340de4=_0x3428c9[_0xda74('0x21')][_0xda74('0x45')]['split'](',');var _0x12c088={};_0x12c088[_0x340de4[0x0]]={'$gte':moment(_0x340de4[0x1])[_0xda74('0x46')](_0xda74('0x47'))};_0x74200a['where']=_[_0xda74('0x2f')](_0x74200a[_0xda74('0x43')],_0x12c088);}_0x74200a=_[_0xda74('0x2f')]({},_0x74200a,_0x3428c9[_0xda74('0x30')]);return db[_0xda74('0x37')]['count']({'where':_0x74200a['where']})['then'](function(_0x13461a){_0x326cec[_0xda74('0x14')]=_0x13461a;if(_0x3428c9[_0xda74('0x21')][_0xda74('0x48')]){_0x74200a[_0xda74('0x2e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xda74('0x1f')](_0x74200a);})['then'](function(_0x26f59f){_0x326cec['rows']=_0x26f59f;return _0x326cec;});}})[_0xda74('0x17')](respondWithFilteredResult(_0xf8a3ca,_0x74200a))[_0xda74('0x23')](handleError(_0xf8a3ca,null));};exports['addTags']=function(_0x233e3c,_0x2c7f05){return db[_0xda74('0x1c')][_0xda74('0x31')]({'where':{'id':_0x233e3c[_0xda74('0x26')]['id']}})[_0xda74('0x17')](handleEntityNotFound(_0x2c7f05,null))[_0xda74('0x17')](function(_0xfb498a){if(_0xfb498a){return _0xfb498a[_0xda74('0x49')](_0x233e3c['body'][_0xda74('0x39')],_[_0xda74('0x38')](_0x233e3c[_0xda74('0x34')],[_0xda74('0x39'),'id'])||{})['spread'](function(){return db[_0xda74('0x4a')][_0xda74('0x1f')]({'attributes':['id',_0xda74('0x1a'),_0xda74('0x4b')],'where':{'id':_0x233e3c['body'][_0xda74('0x39')]}});})[_0xda74('0x17')](function(_0x33594d){socket[_0xda74('0x4c')](_0xda74('0x4d'),{'id':Number(_0x233e3c[_0xda74('0x26')]['id']),'tags':_0x33594d||[]});return{'id':Number(_0x233e3c[_0xda74('0x26')]['id']),'tags':_0x33594d||[]};});}})[_0xda74('0x17')](respondWithResult(_0x2c7f05,null))[_0xda74('0x23')](handleError(_0x2c7f05,null));};exports[_0xda74('0x4e')]=function(_0xdae9f9,_0x12b98c){return db['OpenchannelInteraction'][_0xda74('0x31')]({'where':{'id':_0xdae9f9[_0xda74('0x26')]['id']}})[_0xda74('0x17')](handleEntityNotFound(_0x12b98c,null))[_0xda74('0x17')](function(_0x1c2f80){if(_0x1c2f80){return _0x1c2f80[_0xda74('0x4e')](_0xdae9f9[_0xda74('0x21')][_0xda74('0x39')]);}})[_0xda74('0x17')](respondWithStatusCode(_0x12b98c,null))[_0xda74('0x23')](handleError(_0x12b98c,null));};exports[_0xda74('0x4f')]=function(_0x27b1d5,_0x12cd72){var _0x539d1a=moment()[_0xda74('0x50')]()[_0xda74('0x51')]();var _0x2fcc08=path['join'](config[_0xda74('0x52')],_0xda74('0x53'),_0xda74('0x54'),_0xda74('0x55'));var _0x53f3a9=path[_0xda74('0x56')](config[_0xda74('0x52')],_0xda74('0x53'),_0xda74('0x54'),_0xda74('0x57'));var _0x4dcffe=path['join'](_0x2fcc08,_0x539d1a);var _0x2f381d=util[_0xda74('0x46')](_0xda74('0x58'),_0x27b1d5[_0xda74('0x26')]['id'],_0x539d1a);var _0x560741=path['join'](_0x2fcc08,_0x2f381d);var _0x13ed20=[];_0x13ed20[_0xda74('0x59')]({'model':db[_0xda74('0x5a')],'as':_0xda74('0x5a'),'attributes':['id',_0xda74('0x5b')],'raw':!![]});_0x13ed20[_0xda74('0x59')]({'model':db['CmContact'],'as':_0xda74('0x5c'),'attributes':['id',_0xda74('0x5d'),_0xda74('0x5e')],'raw':!![]});if(_0x27b1d5['query'][_0xda74('0x57')]){_0x13ed20[_0xda74('0x59')]({'model':db[_0xda74('0x5f')],'as':_0xda74('0x5f'),'raw':!![]});}var _0x4c184f=[{'model':db[_0xda74('0x37')],'as':_0xda74('0x60'),'attributes':['id',_0xda74('0x34'),_0xda74('0x61'),'direction',_0xda74('0x62'),_0xda74('0x63')],'include':_0x13ed20}];_0x4c184f[_0xda74('0x59')]({'model':db[_0xda74('0x64')],'as':_0xda74('0x65'),'attributes':['id',_0xda74('0x1a')]});_0x4c184f[_0xda74('0x59')]({'model':db[_0xda74('0x5a')],'as':'Owner','attributes':['id',_0xda74('0x5b')]});return db[_0xda74('0x1c')][_0xda74('0x31')]({'where':{'id':_0x27b1d5[_0xda74('0x26')]['id']},'include':_0x4c184f})[_0xda74('0x17')](handleEntityNotFound(_0x12cd72,null))[_0xda74('0x17')](function(_0x1c7103){if(_0x1c7103){var _0x5e1f7e=_0x1c7103[_0xda74('0x66')]({'plain':!![]});fs[_0xda74('0x67')](_0x4dcffe);var _0x1081ee={'channel':'Openchannel','account':_0x5e1f7e['Account'][_0xda74('0x1a')],'agent':_0x5e1f7e[_0xda74('0x68')]?_0x5e1f7e[_0xda74('0x68')][_0xda74('0x5b')]:_0xda74('0x69'),'createdAt':moment(_0x5e1f7e[_0xda74('0x61')])[_0xda74('0x46')](_0xda74('0x47'))['toString'](),'closedAt':_0x5e1f7e[_0xda74('0x6a')]?moment(_0x5e1f7e[_0xda74('0x6b')])[_0xda74('0x46')](_0xda74('0x47'))['toString']():'','disposition':_0x5e1f7e[_0xda74('0x6c')],'visibility':_0x5e1f7e[_0xda74('0x6d')]?'Public':_0xda74('0x6e'),'messages':_(_0x5e1f7e['Messages'])[_0xda74('0x44')]({'secret':![]})[_0xda74('0x1b')](function(_0x5d318b){if(_0x5d318b[_0xda74('0x5f')]){var _0x1ca68f=path['join'](_0x53f3a9,_0x5d318b['Attachment']['basename']);if(fs[_0xda74('0x6f')](_0x1ca68f)){fs[_0xda74('0x70')](_0x1ca68f)[_0xda74('0x71')](fs[_0xda74('0x72')](path[_0xda74('0x56')](_0x4dcffe,_0x5d318b['Attachment'][_0xda74('0x73')])));}}return{'date':moment(_0x5d318b['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xda74('0x51')](),'sender':_0x5d318b[_0xda74('0x74')]===_0xda74('0x75')?_0x5d318b[_0xda74('0x5a')]?_0x5d318b[_0xda74('0x5a')]['fullname']:'System':_0x5d318b[_0xda74('0x5c')]['firstName']+(_0x5d318b['Contact'][_0xda74('0x5e')]?'\x20'+_0x5d318b[_0xda74('0x5c')][_0xda74('0x5e')]:''),'body':_0x5d318b['Attachment']?_0x5d318b[_0xda74('0x5f')][_0xda74('0x73')]:_0x5d318b[_0xda74('0x34')],'direction':_0x5d318b['direction']==='out'?'A':'C','secret':_0x5d318b[_0xda74('0x62')],'read':_0x5d318b['read'],'attachment':_0x5d318b[_0xda74('0x5f')]};})[_0xda74('0x76')]()};return ejs[_0xda74('0x77')](path[_0xda74('0x56')](config[_0xda74('0x52')],_0xda74('0x53'),_0xda74('0x78'),_0xda74('0x79')),{'interaction':_0x1081ee})[_0xda74('0x17')](function(_0x3a9b68){var _0x14679=path[_0xda74('0x56')](_0x4dcffe,_0xda74('0x7a')+_0x5e1f7e['id']+'-'+_0x539d1a+'.pdf');var _0x1b0c82={'path':_0x14679,'channel':_0xda74('0x7b'),'interactionId':_0x5e1f7e['id']};return pdf[_0xda74('0x7c')](_0x3a9b68,_0x1b0c82);})[_0xda74('0x17')](function(){return new Promise(function(_0x15071b,_0x1d6ec1){zipdir(_0x4dcffe,{'saveTo':_0x560741},function(_0x533ca2,_0x575c6b){if(_0x533ca2)return _0x1d6ec1(_0x533ca2);return _0x15071b(_0x575c6b);});})['then'](function(){return new Promise(function(_0x5bd3ea,_0x1e9afd){rimraf(_0x4dcffe,function(_0x1ef6e9){if(_0x1ef6e9)_0x1e9afd(_0x1ef6e9);return _0x5bd3ea();});});})[_0xda74('0x17')](function(){return _0x12cd72[_0xda74('0x4f')](_0x560741,_0x2f381d,function(_0x38ad86){if(_0x38ad86){logger[_0xda74('0x19')](_0xda74('0x7d'),_0x38ad86);}else{fs[_0xda74('0x7e')](_0x560741);}});});});}else{return _0x12cd72[_0xda74('0xe')](0xc8);}})[_0xda74('0x23')](handleError(_0x12cd72,null));};
\ No newline at end of file
index 5b3c874..4a178d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1256=['save','update','remove','getUsers','setDataValue','Users','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners'];(function(_0x10e57d,_0x223327){var _0x499611=function(_0x181a23){while(--_0x181a23){_0x10e57d['push'](_0x10e57d['shift']());}};_0x499611(++_0x223327);}(_0x1256,0xe6));var _0x6125=function(_0x4ab4ef,_0xcde4fa){_0x4ab4ef=_0x4ab4ef-0x0;var _0x333751=_0x1256[_0x4ab4ef];return _0x333751;};'use strict';var EventEmitter=require(_0x6125('0x0'));var OpenchannelInteraction=require(_0x6125('0x1'))['db'][_0x6125('0x2')];var OpenchannelMessage=require(_0x6125('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6125('0x3')](0x0);var events={'afterCreate':_0x6125('0x4'),'afterUpdate':_0x6125('0x5'),'afterDestroy':_0x6125('0x6')};function emitEvent(_0x2b6f39){return function(_0x189fa8,_0x452d3e,_0x3558cb){_0x189fa8[_0x6125('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a0aa2){_0x189fa8[_0x6125('0x8')](_0x6125('0x9'),_0x2a0aa2['map'](function(_0x3c327f){return{'id':_0x3c327f['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x189fa8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6125('0xa')](function(_0x365da5){_0x189fa8[_0x6125('0x8')](_0x6125('0xb'),_0x365da5[_0x6125('0xc')]);OpenchannelInteractionEvents[_0x6125('0xd')](_0x2b6f39+':'+_0x189fa8['id'],_0x189fa8);OpenchannelInteractionEvents['emit'](_0x2b6f39,_0x189fa8);_0x3558cb(null);})[_0x6125('0xe')](_0x3558cb(null));};}for(var e in events){if(events[_0x6125('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x6125('0x10')](e,emitEvent(event));}}module[_0x6125('0x11')]=OpenchannelInteractionEvents;
\ No newline at end of file
+var _0x0393=['setMaxListeners','update','remove','getUsers','then','Users','map','findAll','setDataValue','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0393,0x161));var _0x3039=function(_0x35bec6,_0x4d9a91){_0x35bec6=_0x35bec6-0x0;var _0x4737b5=_0x0393[_0x35bec6];return _0x4737b5;};'use strict';var EventEmitter=require(_0x3039('0x0'));var OpenchannelInteraction=require(_0x3039('0x1'))['db'][_0x3039('0x2')];var OpenchannelMessage=require(_0x3039('0x1'))['db'][_0x3039('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3039('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3039('0x5'),'afterDestroy':_0x3039('0x6')};function emitEvent(_0x2e5202){return function(_0x191b6e,_0x5de3d7,_0x953a28){_0x191b6e[_0x3039('0x7')]({'attributes':['id'],'raw':!![]})[_0x3039('0x8')](function(_0x2f2d3b){_0x191b6e['setDataValue'](_0x3039('0x9'),_0x2f2d3b[_0x3039('0xa')](function(_0x264ecb){return{'id':_0x264ecb['id']};}));return OpenchannelMessage[_0x3039('0xb')]({'where':{'OpenchannelInteractionId':_0x191b6e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x191ab2){_0x191b6e[_0x3039('0xc')]('unreadMessages',_0x191ab2['length']);OpenchannelInteractionEvents[_0x3039('0xd')](_0x2e5202+':'+_0x191b6e['id'],_0x191b6e);OpenchannelInteractionEvents['emit'](_0x2e5202,_0x191b6e);_0x953a28(null);})[_0x3039('0xe')](_0x953a28(null));};}for(var e in events){if(events[_0x3039('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x3039('0x10')]=OpenchannelInteractionEvents;
\ No newline at end of file
index ac0b1f7..5dd1e53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe41f=['moment','bluebird','request-promise','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xe41f,0xb7));var _0xfe41=function(_0x1d009a,_0x2f4405){_0x1d009a=_0x1d009a-0x0;var _0x59a7b5=_0xe41f[_0x1d009a];return _0x59a7b5;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var logger=require(_0xfe41('0x2'))(_0xfe41('0x3'));var moment=require(_0xfe41('0x4'));var BPromise=require(_0xfe41('0x5'));var rp=require(_0xfe41('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe41('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xfe41('0x8')]=function(_0x1cfaf3,_0x3e8086){return _0x1cfaf3[_0xfe41('0x9')](_0xfe41('0xa'),attributes,{'tableName':_0xfe41('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x1cb5ab,_0x45dcb7,_0x1f1d8b){if(_0x1cb5ab[_0xfe41('0xc')](_0xfe41('0xd'))){_0x1cb5ab[_0xfe41('0xe')]=moment()[_0xfe41('0xf')](_0xfe41('0x10'));}_0x1f1d8b(null,_0x1cb5ab);}}});};
\ No newline at end of file
+var _0xa192=['./openchannelInteraction.attributes','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2440df,_0xcab685){var _0x9b9969=function(_0x21b1fc){while(--_0x21b1fc){_0x2440df['push'](_0x2440df['shift']());}};_0x9b9969(++_0xcab685);}(_0xa192,0x16f));var _0x2a19=function(_0x30f5e7,_0x4eba75){_0x30f5e7=_0x30f5e7-0x0;var _0xe798f6=_0xa192[_0x30f5e7];return _0xe798f6;};'use strict';var _=require(_0x2a19('0x0'));var util=require('util');var logger=require(_0x2a19('0x1'))(_0x2a19('0x2'));var moment=require('moment');var BPromise=require(_0x2a19('0x3'));var rp=require(_0x2a19('0x4'));var fs=require('fs');var path=require(_0x2a19('0x5'));var rimraf=require(_0x2a19('0x6'));var config=require(_0x2a19('0x7'));var attributes=require(_0x2a19('0x8'));module['exports']=function(_0x288068,_0x10f994){return _0x288068['define']('OpenchannelInteraction',attributes,{'tableName':_0x2a19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2a19('0xa'),'hooks':{'beforeUpdate':function(_0x11b71c,_0x4d1f20,_0x38f662){if(_0x11b71c[_0x2a19('0xb')](_0x2a19('0xc'))){_0x11b71c['closedAt']=moment()[_0x2a19('0xd')](_0x2a19('0xe'));}_0x38f662(null,_0x11b71c);}}});};
\ No newline at end of file
index 75e3d70..37878e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x842d=['http','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x287524,_0x1c2211){var _0x205827=function(_0x43e5aa){while(--_0x43e5aa){_0x287524['push'](_0x287524['shift']());}};_0x205827(++_0x1c2211);}(_0x842d,0xc8));var _0xd842=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0x842d[_0x2376d1];return _0x443759;};'use strict';var _=require(_0xd842('0x0'));var util=require(_0xd842('0x1'));var moment=require(_0xd842('0x2'));var BPromise=require('bluebird');var rs=require(_0xd842('0x3'));var fs=require('fs');var Redis=require(_0xd842('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd842('0x5'));var logger=require(_0xd842('0x6'))(_0xd842('0x7'));var config=require('../../config/environment');var jayson=require(_0xd842('0x8'));var client=jayson[_0xd842('0x9')][_0xd842('0xa')]({'port':0x232a});config['redis']=_[_0xd842('0xb')](config['redis'],{'host':_0xd842('0xc'),'port':0x18eb});var socket=require(_0xd842('0xd'))(new Redis(config['redis']));require(_0xd842('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c6133,_0x3d136c,_0x932dc5){return new BPromise(function(_0x245a9f,_0x400841){return client[_0xd842('0xf')](_0x5c6133,_0x932dc5)[_0xd842('0x10')](function(_0xae90b7){logger['info'](_0xd842('0x11'),_0x3d136c,_0xd842('0x12'));logger[_0xd842('0x13')](_0xd842('0x14'),_0x3d136c,_0xd842('0x12'),JSON[_0xd842('0x15')](_0xae90b7));if(_0xae90b7[_0xd842('0x16')]){if(_0xae90b7[_0xd842('0x16')][_0xd842('0x17')]===0x1f4){logger[_0xd842('0x16')](_0xd842('0x11'),_0x3d136c,_0xae90b7['error'][_0xd842('0x18')]);return _0x400841(_0xae90b7[_0xd842('0x16')]['message']);}logger[_0xd842('0x16')](_0xd842('0x11'),_0x3d136c,_0xae90b7['error'][_0xd842('0x18')]);return _0x245a9f(_0xae90b7[_0xd842('0x16')][_0xd842('0x18')]);}else{logger[_0xd842('0x19')](_0xd842('0x11'),_0x3d136c,_0xd842('0x12'));_0x245a9f(_0xae90b7[_0xd842('0x1a')][_0xd842('0x18')]);}})['catch'](function(_0x55e8e8){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3d136c,_0x55e8e8);_0x400841(_0x55e8e8);});});}exports[_0xd842('0x1b')]=function(_0x151519){var _0x38b623=this;return new Promise(function(_0x31325d,_0x2526b5){return db['OpenchannelInteraction'][_0xd842('0x1c')](_0x151519[_0xd842('0x1d')],{'raw':_0x151519['options']?_0x151519[_0xd842('0x1e')][_0xd842('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151519['options']?_0x151519[_0xd842('0x1e')][_0xd842('0x20')]||null:null,'attributes':_0x151519[_0xd842('0x1e')]?_0x151519[_0xd842('0x1e')]['attributes']||null:null,'limit':_0x151519[_0xd842('0x1e')]?_0x151519['options'][_0xd842('0x21')]||null:null})[_0xd842('0x10')](function(_0x3e8a97){logger[_0xd842('0x19')](_0xd842('0x1b'),_0x151519);logger[_0xd842('0x13')](_0xd842('0x1b'),_0x151519,JSON[_0xd842('0x15')](_0x3e8a97));_0x31325d(_0x3e8a97);})['catch'](function(_0x7d86f9){logger[_0xd842('0x16')](_0xd842('0x1b'),_0x7d86f9['message'],_0x151519);_0x2526b5(_0x38b623[_0xd842('0x16')](0x1f4,_0x7d86f9[_0xd842('0x18')]));});});};exports[_0xd842('0x22')]=function(_0x1b1e2c){return new Promise(function(_0x2d320,_0x23aecc){return db[_0xd842('0x23')][_0xd842('0x24')]({'where':_0x1b1e2c['options']?_0x1b1e2c[_0xd842('0x1e')][_0xd842('0x20')]||null:null})[_0xd842('0x10')](function(_0xa89ad3){if(_0xa89ad3){return _0xa89ad3[_0xd842('0x25')](_0x1b1e2c[_0xd842('0x1d')][_0xd842('0x26')],_['omit'](_0x1b1e2c[_0xd842('0x1d')],[_0xd842('0x26'),'id'])||{});}})[_0xd842('0x27')](function(_0x27aacc){logger['info'](_0xd842('0x28'),_0x1b1e2c);logger[_0xd842('0x13')](_0xd842('0x28'),_0x1b1e2c,JSON[_0xd842('0x15')](_0x27aacc));_0x2d320(_0x27aacc);})[_0xd842('0x29')](function(_0x4f6a5b){logger[_0xd842('0x16')](_0xd842('0x28'),_0x4f6a5b['message'],_0x1b1e2c);_0x23aecc(_this['error'](0x1f4,_0x4f6a5b[_0xd842('0x18')]));});});};
\ No newline at end of file
+var _0x2a54=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x2a54,0x159));var _0x42a5=function(_0x2b8da9,_0x2cea86){_0x2b8da9=_0x2b8da9-0x0;var _0xed6393=_0x2a54[_0x2b8da9];return _0xed6393;};'use strict';var _=require(_0x42a5('0x0'));var util=require(_0x42a5('0x1'));var moment=require(_0x42a5('0x2'));var BPromise=require(_0x42a5('0x3'));var rs=require(_0x42a5('0x4'));var fs=require('fs');var Redis=require(_0x42a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x42a5('0x6'));var logger=require(_0x42a5('0x7'))(_0x42a5('0x8'));var config=require(_0x42a5('0x9'));var jayson=require(_0x42a5('0xa'));var client=jayson['client'][_0x42a5('0xb')]({'port':0x232a});config[_0x42a5('0xc')]=_[_0x42a5('0xd')](config[_0x42a5('0xc')],{'host':_0x42a5('0xe'),'port':0x18eb});var socket=require(_0x42a5('0xf'))(new Redis(config[_0x42a5('0xc')]));require(_0x42a5('0x10'))['register'](socket);function respondWithRpcPromise(_0x26b67d,_0x1993ef,_0xad08d6){return new BPromise(function(_0x300a53,_0x512bee){return client['request'](_0x26b67d,_0xad08d6)[_0x42a5('0x11')](function(_0x24bf2d){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1993ef,_0x42a5('0x12'));logger[_0x42a5('0x13')](_0x42a5('0x14'),_0x1993ef,_0x42a5('0x12'),JSON[_0x42a5('0x15')](_0x24bf2d));if(_0x24bf2d['error']){if(_0x24bf2d[_0x42a5('0x16')][_0x42a5('0x17')]===0x1f4){logger[_0x42a5('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1993ef,_0x24bf2d[_0x42a5('0x16')][_0x42a5('0x18')]);return _0x512bee(_0x24bf2d[_0x42a5('0x16')][_0x42a5('0x18')]);}logger[_0x42a5('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1993ef,_0x24bf2d['error'][_0x42a5('0x18')]);return _0x300a53(_0x24bf2d[_0x42a5('0x16')]['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1993ef,_0x42a5('0x12'));_0x300a53(_0x24bf2d[_0x42a5('0x19')][_0x42a5('0x18')]);}})['catch'](function(_0x5dde9f){logger[_0x42a5('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1993ef,_0x5dde9f);_0x512bee(_0x5dde9f);});});}exports[_0x42a5('0x1a')]=function(_0x1ebb8c){var _0x2a7ac9=this;return new Promise(function(_0x52e9f1,_0x57bcfb){return db[_0x42a5('0x1b')][_0x42a5('0x1c')](_0x1ebb8c[_0x42a5('0x1d')],{'raw':_0x1ebb8c[_0x42a5('0x1e')]?_0x1ebb8c[_0x42a5('0x1e')][_0x42a5('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ebb8c[_0x42a5('0x1e')]?_0x1ebb8c[_0x42a5('0x1e')][_0x42a5('0x20')]||null:null,'attributes':_0x1ebb8c['options']?_0x1ebb8c[_0x42a5('0x1e')][_0x42a5('0x21')]||null:null,'limit':_0x1ebb8c[_0x42a5('0x1e')]?_0x1ebb8c[_0x42a5('0x1e')][_0x42a5('0x22')]||null:null})[_0x42a5('0x11')](function(_0x45fdbe){logger['info'](_0x42a5('0x1a'),_0x1ebb8c);logger[_0x42a5('0x13')](_0x42a5('0x1a'),_0x1ebb8c,JSON[_0x42a5('0x15')](_0x45fdbe));_0x52e9f1(_0x45fdbe);})[_0x42a5('0x23')](function(_0x1d5aad){logger[_0x42a5('0x16')](_0x42a5('0x1a'),_0x1d5aad['message'],_0x1ebb8c);_0x57bcfb(_0x2a7ac9['error'](0x1f4,_0x1d5aad[_0x42a5('0x18')]));});});};exports[_0x42a5('0x24')]=function(_0xb88e19){return new Promise(function(_0x3eb80f,_0x31e9b0){return db[_0x42a5('0x1b')][_0x42a5('0x25')]({'where':_0xb88e19[_0x42a5('0x1e')]?_0xb88e19['options'][_0x42a5('0x20')]||null:null})['then'](function(_0x408600){if(_0x408600){return _0x408600[_0x42a5('0x26')](_0xb88e19[_0x42a5('0x1d')][_0x42a5('0x27')],_[_0x42a5('0x28')](_0xb88e19['body'],[_0x42a5('0x27'),'id'])||{});}})[_0x42a5('0x29')](function(_0x1097bf){logger[_0x42a5('0x2a')](_0x42a5('0x2b'),_0xb88e19);logger[_0x42a5('0x13')](_0x42a5('0x2b'),_0xb88e19,JSON['stringify'](_0x1097bf));_0x3eb80f(_0x1097bf);})['catch'](function(_0x1df58c){logger['error'](_0x42a5('0x2b'),_0x1df58c[_0x42a5('0x18')],_0xb88e19);_0x31e9b0(_this[_0x42a5('0x16')](0x1f4,_0x1df58c[_0x42a5('0x18')]));});});};
\ No newline at end of file
index 59520bb..08b4f3d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8946=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','length'];(function(_0x16c50c,_0x1256df){var _0x50575f=function(_0x3d55c9){while(--_0x3d55c9){_0x16c50c['push'](_0x16c50c['shift']());}};_0x50575f(++_0x1256df);}(_0x8946,0x8b));var _0x6894=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x8946[_0x1d24eb];return _0x1dc576;};'use strict';var OpenchannelInteractionEvents=require(_0x6894('0x0'));var events=['save',_0x6894('0x1'),_0x6894('0x2')];function createListener(_0x501af9,_0x2b0763){return function(_0x5292cf){_0x2b0763[_0x6894('0x3')](_0x501af9,_0x5292cf);};}function removeListener(_0x1bd873,_0x57925d){return function(){OpenchannelInteractionEvents['removeListener'](_0x1bd873,_0x57925d);};}exports['register']=function(_0x2aa655){for(var _0x4c98b9=0x0,_0x3466a9=events[_0x6894('0x4')];_0x4c98b9<_0x3466a9;_0x4c98b9++){var _0x543647=events[_0x4c98b9];var _0x5b4ed0=createListener(_0x6894('0x5')+_0x543647,_0x2aa655);OpenchannelInteractionEvents['on'](_0x543647,_0x5b4ed0);}};
\ No newline at end of file
+var _0xf019=['remove','update','emit','removeListener','register','length','./openchannelInteraction.events','save'];(function(_0x5acccb,_0x14008f){var _0x395952=function(_0x580c0f){while(--_0x580c0f){_0x5acccb['push'](_0x5acccb['shift']());}};_0x395952(++_0x14008f);}(_0xf019,0x13e));var _0x9f01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf019[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelInteractionEvents=require(_0x9f01('0x0'));var events=[_0x9f01('0x1'),_0x9f01('0x2'),_0x9f01('0x3')];function createListener(_0x35f322,_0x49a603){return function(_0x10b124){_0x49a603[_0x9f01('0x4')](_0x35f322,_0x10b124);};}function removeListener(_0x3d2b21,_0x2dd147){return function(){OpenchannelInteractionEvents[_0x9f01('0x5')](_0x3d2b21,_0x2dd147);};}exports[_0x9f01('0x6')]=function(_0x118db5){for(var _0x5a6236=0x0,_0x5adb1c=events[_0x9f01('0x7')];_0x5a6236<_0x5adb1c;_0x5a6236++){var _0xe677dc=events[_0x5a6236];var _0xa98eb0=createListener('openchannelInteraction:'+_0xe677dc,_0x118db5);OpenchannelInteractionEvents['on'](_0xe677dc,_0xa98eb0);}};
\ No newline at end of file
index 6f70d7d..0ff04a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x1f0d91,_0x24b032){var _0xafee7a=function(_0x2d1295){while(--_0x2d1295){_0x1f0d91['push'](_0x1f0d91['shift']());}};_0xafee7a(++_0x24b032);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router;
\ No newline at end of file
+var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router;
\ No newline at end of file
index c304e78..00fb3ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b20=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2c2dff,_0x302e28){var _0x1177a4=function(_0x2fa930){while(--_0x2fa930){_0x2c2dff['push'](_0x2c2dff['shift']());}};_0x1177a4(++_0x302e28);}(_0x6b20,0xd1));var _0x06b2=function(_0x1df577,_0xc48cf7){_0x1df577=_0x1df577-0x0;var _0x643ff=_0x6b20[_0x1df577];return _0x643ff;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x06b2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x06b2('0x4')]('in',_0x06b2('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x06b2('0x6')]},'providerName':{'type':Sequelize[_0x06b2('0x7')]},'providerResponse':{'type':Sequelize[_0x06b2('0x8')]}};
\ No newline at end of file
+var _0xb9e7=['ENUM','out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xb9e7[_0x3cb3ca];return _0x214366;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'body':{'type':Sequelize[_0x7b9e('0x1')](_0x7b9e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b9e('0x4')]('in','out'),'defaultValue':_0x7b9e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7b9e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7b9e('0x1')]}};
\ No newline at end of file
index 8ba7e5b..c00c0d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x952a=['stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','email','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','sendStatus','stack','send','index','rawAttributes','fieldName','type','key','map','name','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','OpenchannelMessage','includeAll','include','show','fields','options','create','body','params','find','../../config/logger','openchannel-interactions','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user'];(function(_0x448a3e,_0x345728){var _0x18c887=function(_0x2c7d32){while(--_0x2c7d32){_0x448a3e['push'](_0x448a3e['shift']());}};_0x18c887(++_0x345728);}(_0x952a,0x1b1));var _0xa952=function(_0x1f8e1c,_0x1f17a4){_0x1f8e1c=_0x1f8e1c-0x0;var _0x1d9a4b=_0x952a[_0x1f8e1c];return _0x1d9a4b;};'use strict';var emlformat=require(_0xa952('0x0'));var rimraf=require(_0xa952('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa952('0x2'));var rp=require(_0xa952('0x3'));var moment=require(_0xa952('0x4'));var BPromise=require(_0xa952('0x5'));var Mustache=require(_0xa952('0x6'));var util=require('util');var path=require(_0xa952('0x7'));var sox=require(_0xa952('0x8'));var csv=require(_0xa952('0x9'));var ejs=require(_0xa952('0xa'));var fs=require('fs');var fs_extra=require(_0xa952('0xb'));var _=require(_0xa952('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa952('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa952('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa952('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa952('0x10'));var logger=require('../../config/logger')(_0xa952('0x11'));var utils=require(_0xa952('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa952('0x13'));var db=require(_0xa952('0x14'))['db'];config[_0xa952('0x15')]=_[_0xa952('0x16')](config['redis'],{'host':_0xa952('0x17'),'port':0x18eb});var socket=require(_0xa952('0x18'))(new Redis(config[_0xa952('0x15')]));require(_0xa952('0x19'))[_0xa952('0x1a')](socket);var jayson=require(_0xa952('0x1b'));var client=jayson[_0xa952('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa952('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xa89509,_0x2cc488,_0x3e7a7a,_0x50d733){return new BPromise(function(_0x31e997,_0x4d72e3){var _0x34d5e0=_0x50d733||client;return _0x34d5e0[_0xa952('0x1e')](_0xa89509,_0x3e7a7a)[_0xa952('0x1f')](function(_0x47fb31){logger[_0xa952('0x20')](_0xa952('0x21'),_0x2cc488,_0xa952('0x22'));logger[_0xa952('0x23')](_0xa952('0x24'),_0x2cc488,'request\x20sent',JSON['stringify'](_0x47fb31));if(_0x47fb31[_0xa952('0x25')]){if(_0x47fb31[_0xa952('0x25')][_0xa952('0x26')]===0x1f4){logger[_0xa952('0x25')](_0xa952('0x21'),_0x2cc488,_0x47fb31[_0xa952('0x25')]['message']);return _0x4d72e3(_0x47fb31[_0xa952('0x25')][_0xa952('0x27')]);}logger['error'](_0xa952('0x21'),_0x2cc488,_0x47fb31['error'][_0xa952('0x27')]);return _0x31e997(_0x47fb31['error'][_0xa952('0x27')]);}else{logger[_0xa952('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x2cc488,_0xa952('0x22'));_0x31e997(_0x47fb31[_0xa952('0x28')][_0xa952('0x27')]);}})[_0xa952('0x29')](function(_0x173d44){logger[_0xa952('0x25')](_0xa952('0x21'),_0x2cc488,_0x173d44);_0x4d72e3(_0x173d44);});});}function respondWithStatusCode(_0x160644,_0x50be74){_0x50be74=_0x50be74||0xcc;return function(_0x383d0b){if(_0x383d0b){return _0x160644['sendStatus'](_0x50be74);}return _0x160644[_0xa952('0x2a')](_0x50be74)[_0xa952('0x2b')]();};}function respondWithResult(_0x268e69,_0x3af682){_0x3af682=_0x3af682||0xc8;return function(_0x540fd2){if(_0x540fd2){return _0x268e69[_0xa952('0x2a')](_0x3af682)[_0xa952('0x2c')](_0x540fd2);}};}function respondWithFilteredResult(_0x36ea86,_0x17b5e1){return function(_0x122711){if(_0x122711){var _0x53a2eb=typeof _0x17b5e1[_0xa952('0x2d')]==='undefined'&&typeof _0x17b5e1[_0xa952('0x2e')]===_0xa952('0x2f');var _0x1f7057=_0x122711[_0xa952('0x30')];var _0x547a18=_0x53a2eb?0x0:_0x17b5e1['offset'];var _0x189f55=_0x53a2eb?_0x122711[_0xa952('0x30')]:_0x17b5e1[_0xa952('0x2d')]+_0x17b5e1[_0xa952('0x2e')];var _0x2663db;if(_0x189f55>=_0x1f7057){_0x189f55=_0x1f7057;_0x2663db=0xc8;}else{_0x2663db=0xce;}_0x36ea86[_0xa952('0x2a')](_0x2663db);return _0x36ea86[_0xa952('0x31')]('Content-Range',_0x547a18+'-'+_0x189f55+'/'+_0x1f7057)[_0xa952('0x2c')](_0x122711);}return null;};}function patchUpdates(_0x1c51a7){return function(_0x159f03){try{jsonpatch[_0xa952('0x32')](_0x159f03,_0x1c51a7,!![]);}catch(_0x18a043){return BPromise[_0xa952('0x33')](_0x18a043);}return _0x159f03[_0xa952('0x34')]();};}function saveUpdates(_0x3cce90,_0x2f88e5){return function(_0x1766d9){if(_0x1766d9){return _0x1766d9[_0xa952('0x35')](_0x3cce90)[_0xa952('0x1f')](function(_0x46d44a){return _0x46d44a;});}return null;};}function removeEntity(_0x5d13d,_0x85660e){return function(_0x364d12){if(_0x364d12){return _0x364d12[_0xa952('0x36')]()['then'](function(){_0x5d13d[_0xa952('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7e16,_0x3f9e68){return function(_0x2be73f){if(!_0x2be73f){_0x5e7e16[_0xa952('0x37')](0x194);}return _0x2be73f;};}function handleError(_0x14e918,_0x4238f5){_0x4238f5=_0x4238f5||0x1f4;return function(_0x42f11f){logger['error'](_0x42f11f[_0xa952('0x38')]);if(_0x42f11f['name']){delete _0x42f11f['name'];}_0x14e918[_0xa952('0x2a')](_0x4238f5)[_0xa952('0x39')](_0x42f11f);};}exports[_0xa952('0x3a')]=function(_0x125210,_0x665e42){var _0x565b54={},_0x3531fc={},_0x57fa66={'count':0x0,'rows':[]};var _0x558513=_['map'](db['OpenchannelMessage'][_0xa952('0x3b')],function(_0x53167a){return{'name':_0x53167a[_0xa952('0x3c')],'type':_0x53167a[_0xa952('0x3d')][_0xa952('0x3e')]};});_0x3531fc['model']=_[_0xa952('0x3f')](_0x558513,_0xa952('0x40'));_0x3531fc[_0xa952('0x41')]=_[_0xa952('0x42')](_0x125210[_0xa952('0x41')]);_0x3531fc['filters']=_[_0xa952('0x43')](_0x3531fc[_0xa952('0x44')],_0x3531fc[_0xa952('0x41')]);_0x565b54[_0xa952('0x45')]=_[_0xa952('0x43')](_0x3531fc[_0xa952('0x44')],qs['fields'](_0x125210[_0xa952('0x41')]['fields']));_0x565b54[_0xa952('0x45')]=_0x565b54[_0xa952('0x45')][_0xa952('0x46')]?_0x565b54[_0xa952('0x45')]:_0x3531fc[_0xa952('0x44')];if(!_0x125210['query'][_0xa952('0x47')](_0xa952('0x48'))){_0x565b54[_0xa952('0x2e')]=qs['limit'](_0x125210['query']['limit']);_0x565b54[_0xa952('0x2d')]=qs[_0xa952('0x2d')](_0x125210[_0xa952('0x41')][_0xa952('0x2d')]);}_0x565b54[_0xa952('0x49')]=qs[_0xa952('0x4a')](_0x125210['query'][_0xa952('0x4a')]);_0x565b54['where']=qs[_0xa952('0x4b')](_['pick'](_0x125210[_0xa952('0x41')],_0x3531fc[_0xa952('0x4b')]),_0x558513);if(_0x125210[_0xa952('0x41')][_0xa952('0x4c')]){_0x565b54[_0xa952('0x4d')]=_['merge'](_0x565b54[_0xa952('0x4d')],{'$or':_[_0xa952('0x3f')](_0x558513,function(_0x59ffdb){if(_0x59ffdb['type']!==_0xa952('0x4e')){var _0x29db9c={};_0x29db9c[_0x59ffdb[_0xa952('0x40')]]={'$like':'%'+_0x125210['query'][_0xa952('0x4c')]+'%'};return _0x29db9c;}})});}_0x565b54=_[_0xa952('0x4f')]({},_0x565b54,_0x125210['options']);var _0x43fe20={'where':_0x565b54[_0xa952('0x4d')]};return db[_0xa952('0x50')][_0xa952('0x30')](_0x43fe20)[_0xa952('0x1f')](function(_0x21a37f){_0x57fa66[_0xa952('0x30')]=_0x21a37f;if(_0x125210[_0xa952('0x41')][_0xa952('0x51')]){_0x565b54[_0xa952('0x52')]=[{'all':!![]}];}return db[_0xa952('0x50')]['findAll'](_0x565b54);})['then'](function(_0x2a6f58){_0x57fa66['rows']=_0x2a6f58;return _0x57fa66;})[_0xa952('0x1f')](respondWithFilteredResult(_0x665e42,_0x565b54))[_0xa952('0x29')](handleError(_0x665e42,null));};exports[_0xa952('0x53')]=function(_0x294687,_0x391e97){var _0x1c8580={'raw':!![],'where':{'id':_0x294687['params']['id']}},_0x489fb7={};_0x489fb7['model']=_[_0xa952('0x42')](db[_0xa952('0x50')]['rawAttributes']);_0x489fb7['query']=_[_0xa952('0x42')](_0x294687[_0xa952('0x41')]);_0x489fb7[_0xa952('0x4b')]=_[_0xa952('0x43')](_0x489fb7[_0xa952('0x44')],_0x489fb7['query']);_0x1c8580['attributes']=_[_0xa952('0x43')](_0x489fb7['model'],qs[_0xa952('0x54')](_0x294687[_0xa952('0x41')]['fields']));_0x1c8580[_0xa952('0x45')]=_0x1c8580['attributes'][_0xa952('0x46')]?_0x1c8580[_0xa952('0x45')]:_0x489fb7[_0xa952('0x44')];if(_0x294687[_0xa952('0x41')]['includeAll']){_0x1c8580[_0xa952('0x52')]=[{'all':!![]}];}_0x1c8580=_[_0xa952('0x4f')]({},_0x1c8580,_0x294687[_0xa952('0x55')]);return db[_0xa952('0x50')]['find'](_0x1c8580)['then'](handleEntityNotFound(_0x391e97,null))[_0xa952('0x1f')](respondWithResult(_0x391e97,null))[_0xa952('0x29')](handleError(_0x391e97,null));};exports[_0xa952('0x56')]=function(_0x44796d,_0x25ac8c){return db[_0xa952('0x50')]['create'](_0x44796d[_0xa952('0x57')],{})['then'](respondWithResult(_0x25ac8c,0xc9))[_0xa952('0x29')](handleError(_0x25ac8c,null));};exports[_0xa952('0x35')]=function(_0x308d70,_0x423215){if(_0x308d70[_0xa952('0x57')]['id']){delete _0x308d70[_0xa952('0x57')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x308d70[_0xa952('0x58')]['id']}})['then'](handleEntityNotFound(_0x423215,null))[_0xa952('0x1f')](saveUpdates(_0x308d70[_0xa952('0x57')],null))[_0xa952('0x1f')](respondWithResult(_0x423215,null))['catch'](handleError(_0x423215,null));};exports[_0xa952('0x36')]=function(_0x2e37a1,_0x1a19bd){return db[_0xa952('0x50')][_0xa952('0x59')]({'where':{'id':_0x2e37a1[_0xa952('0x58')]['id']}})[_0xa952('0x1f')](handleEntityNotFound(_0x1a19bd,null))['then'](removeEntity(_0x1a19bd,null))[_0xa952('0x29')](handleError(_0x1a19bd,null));};exports['describe']=function(_0x45bc84,_0x348ec9){return db[_0xa952('0x50')]['describe']()[_0xa952('0x1f')](respondWithResult(_0x348ec9,null))[_0xa952('0x29')](handleError(_0x348ec9,null));};var interaction_log=require(_0xa952('0x5a'))(_0xa952('0x5b'));exports['accept']=function(_0x1ed4c2,_0x1c3bdb,_0x3a94f8){var _0x146588={'agent':{},'channel':_0xa952('0x5c')};if(_0x1ed4c2['body']['id']){delete _0x1ed4c2[_0xa952('0x57')]['id'];}_0x1ed4c2['body'][_0xa952('0x5d')]=!![];_0x1ed4c2[_0xa952('0x57')][_0xa952('0x5e')]=moment()['format'](_0xa952('0x5f'));_0x1ed4c2[_0xa952('0x57')][_0xa952('0x60')]=_0x1ed4c2[_0xa952('0x57')][_0xa952('0x60')]||_0x1ed4c2['user']['id'];_0x146588[_0xa952('0x61')]['id']=_0x1ed4c2['body'][_0xa952('0x60')];return db[_0xa952('0x50')][_0xa952('0x59')]({'where':{'id':_0x1ed4c2[_0xa952('0x58')]['id'],'UserId':null}})[_0xa952('0x1f')](handleEntityNotFound(_0x1c3bdb,null))[_0xa952('0x1f')](saveUpdates(_0x1ed4c2[_0xa952('0x57')],null))[_0xa952('0x1f')](function(_0x494f41){if(_0x494f41){_0x146588[_0xa952('0x27')]=_0x494f41[_0xa952('0x62')]({'plain':!![]});return db[_0xa952('0x63')][_0xa952('0x59')]({'where':{'id':_0x494f41[_0xa952('0x64')]}});}return null;})[_0xa952('0x1f')](handleEntityNotFound(_0x1c3bdb,null))[_0xa952('0x1f')](function(_0x2569d4){if(_0x2569d4){return _0x2569d4[_0xa952('0x35')]({'UserId':_0x1ed4c2[_0xa952('0x57')]['UserId'],'read1stAt':_[_0xa952('0x65')](_0x2569d4[_0xa952('0x66')])?moment()[_0xa952('0x67')](_0xa952('0x5f')):undefined});}return null;})[_0xa952('0x1f')](function(_0x204563){if(_0x204563){_0x146588[_0xa952('0x68')]=_0x204563[_0xa952('0x62')]({'plain':!![]});interaction_log[_0xa952('0x20')](_0xa952('0x69'),_0x1ed4c2[_0xa952('0x6a')]['id'],_0x1ed4c2[_0xa952('0x6a')][_0xa952('0x40')],_0x1ed4c2[_0xa952('0x6a')]['role'],_0x146588[_0xa952('0x68')]['id'],_0x1ed4c2[_0xa952('0x57')]?JSON[_0xa952('0x6b')](_0x1ed4c2['body']):_0xa952('0x6c'));return respondWithRpcPromise(_0xa952('0x6d'),_0xa952('0x6e'),_0x146588);}return null;})[_0xa952('0x1f')](function(_0x59a47c){var _0x454c5d=_0xa952('0x6f')+_0x59a47c[_0xa952('0x27')]['ContactId'];return db['sequelize'][_0xa952('0x41')](_0x454c5d,{'type':db[_0xa952('0x70')][_0xa952('0x71')][_0xa952('0x72')],'raw':!![]})[_0xa952('0x1f')](function(_0x4bb9ab){return _0x4bb9ab;});})[_0xa952('0x1f')](function(_0x96158c){if(_0x96158c){_0x146588['message'][_0xa952('0x73')]=_0x96158c[0x0];if(!_0x1ed4c2[_0xa952('0x57')][_0xa952('0x60')])return;return db[_0xa952('0x74')][_0xa952('0x59')]({'where':{'id':_0x1ed4c2[_0xa952('0x57')][_0xa952('0x60')],'role':_0xa952('0x61')},'attributes':['id',_0xa952('0x40'),_0xa952('0x75'),'email',_0xa952('0x76')],'raw':!![]});}return null;})[_0xa952('0x1f')](function(_0x5a1c92){if(!_0x5a1c92)return null;_0x146588[_0xa952('0x27')][_0xa952('0x61')]=_0x5a1c92;return _0x146588;})[_0xa952('0x1f')](function(_0x12ddc7){if(_0x12ddc7){if(_0x1ed4c2[_0xa952('0x57')][_0xa952('0x77')]){_0x146588[_0xa952('0x27')][_0xa952('0x78')]=util[_0xa952('0x67')](_0xa952('0x79'),_0x1ed4c2[_0xa952('0x6a')][_0xa952('0x40')]);_0x146588[_0xa952('0x27')][_0xa952('0x7a')]=_0x146588['channel'];_0x146588[_0xa952('0x27')][_0xa952('0x7b')]=_0x146588[_0xa952('0x7a')];_0x146588[_0xa952('0x27')]['event']=_0xa952('0x7c');return respondWithRpcPromise(_0xa952('0x7d'),_0xa952('0x7d'),{'event':_0xa952('0x7e'),'message':_0x146588[_0xa952('0x27')]},client9002)[_0xa952('0x1f')](function(){return _0x146588;});}return _0x146588;}return null;})[_0xa952('0x1f')](respondWithResult(_0x1c3bdb,null))[_0xa952('0x29')](handleError(_0x1c3bdb,null));};var interaction_log=require('../../config/logger')(_0xa952('0x5b'));exports[_0xa952('0x33')]=function(_0x4bf003,_0x5b0284,_0xda5779){var _0x430bfd={'agent':{},'channel':_0xa952('0x5c')};if(_0x4bf003[_0xa952('0x57')]['id']){delete _0x4bf003[_0xa952('0x57')]['id'];}_0x4bf003['body'][_0xa952('0x60')]=_0x4bf003[_0xa952('0x57')][_0xa952('0x60')]||_0x4bf003['user']['id'];_0x430bfd[_0xa952('0x61')]['id']=_0x4bf003[_0xa952('0x57')][_0xa952('0x60')];return db[_0xa952('0x50')][_0xa952('0x59')]({'where':{'id':_0x4bf003['params']['id'],'UserId':null}})[_0xa952('0x1f')](handleEntityNotFound(_0x5b0284,null))[_0xa952('0x1f')](function(_0x3ab4f8){if(_0x3ab4f8){_0x430bfd[_0xa952('0x27')]=_0x3ab4f8[_0xa952('0x62')]({'plain':!![]});return db[_0xa952('0x63')][_0xa952('0x59')]({'where':{'id':_0x3ab4f8[_0xa952('0x64')]}});}return null;})[_0xa952('0x1f')](handleEntityNotFound(_0x5b0284,null))[_0xa952('0x1f')](function(_0x42cb6c){if(_0x42cb6c){_0x430bfd[_0xa952('0x68')]=_0x42cb6c[_0xa952('0x62')]({'plain':!![]});interaction_log['info'](_0xa952('0x7f'),_0x4bf003[_0xa952('0x6a')]['id'],_0x4bf003[_0xa952('0x6a')][_0xa952('0x40')],_0x4bf003[_0xa952('0x6a')][_0xa952('0x80')],_0x430bfd[_0xa952('0x68')]['id'],_0x4bf003[_0xa952('0x57')]?JSON[_0xa952('0x6b')](_0x4bf003[_0xa952('0x57')]):_0xa952('0x6c'));return respondWithRpcPromise(_0xa952('0x81'),_0xa952('0x82'),_0x430bfd);}return null;})[_0xa952('0x1f')](function(_0x32cde1){var _0x41d962='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x32cde1[_0xa952('0x27')][_0xa952('0x83')];return db[_0xa952('0x84')][_0xa952('0x41')](_0x41d962,{'type':db[_0xa952('0x70')]['QueryTypes'][_0xa952('0x72')],'raw':!![]})[_0xa952('0x1f')](function(_0x315564){return _0x315564;});})[_0xa952('0x1f')](function(_0x445e37){if(_0x445e37){_0x430bfd[_0xa952('0x27')][_0xa952('0x73')]=_0x445e37[0x0];if(!_0x4bf003['body'][_0xa952('0x60')])return;return db[_0xa952('0x74')][_0xa952('0x59')]({'where':{'id':_0x4bf003[_0xa952('0x57')][_0xa952('0x60')],'role':_0xa952('0x61')},'attributes':['id',_0xa952('0x40'),'fullname',_0xa952('0x85'),'internal'],'raw':!![]});}return null;})['then'](function(_0x48d02c){if(!_0x48d02c)return null;_0x430bfd[_0xa952('0x27')][_0xa952('0x61')]=_0x48d02c;return _0x430bfd;})[_0xa952('0x1f')](function(_0x17fdb4){if(_0x17fdb4){_0x17fdb4['message']['interface']=util[_0xa952('0x67')]('SIP/%s',_0x4bf003[_0xa952('0x6a')]['name']);_0x17fdb4[_0xa952('0x27')][_0xa952('0x7a')]=_0x430bfd[_0xa952('0x7a')];_0x17fdb4[_0xa952('0x27')]['motionChannel']=_0x430bfd[_0xa952('0x7a')];_0x17fdb4[_0xa952('0x27')]['event']='reject';respondWithRpcPromise('EventManager',_0xa952('0x7d'),{'event':_0xa952('0x86'),'message':_0x17fdb4[_0xa952('0x27')]},client9002);return _0x430bfd;}return null;})['then'](respondWithResult(_0x5b0284,null))[_0xa952('0x29')](handleError(_0x5b0284,null));};
\ No newline at end of file
+var _0x6a9f=['info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','then'];(function(_0x347498,_0x332242){var _0x334f2b=function(_0x4156d1){while(--_0x4156d1){_0x347498['push'](_0x347498['shift']());}};_0x334f2b(++_0x332242);}(_0x6a9f,0x1e0));var _0xf6a9=function(_0x41943a,_0x1f9064){_0x41943a=_0x41943a-0x0;var _0x447f92=_0x6a9f[_0x41943a];return _0x447f92;};'use strict';var emlformat=require(_0xf6a9('0x0'));var rimraf=require(_0xf6a9('0x1'));var zipdir=require(_0xf6a9('0x2'));var jsonpatch=require(_0xf6a9('0x3'));var rp=require('request-promise');var moment=require(_0xf6a9('0x4'));var BPromise=require(_0xf6a9('0x5'));var Mustache=require('mustache');var util=require(_0xf6a9('0x6'));var path=require('path');var sox=require(_0xf6a9('0x7'));var csv=require(_0xf6a9('0x8'));var ejs=require(_0xf6a9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6a9('0xa'));var squel=require(_0xf6a9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6a9('0xc'));var toCsv=require(_0xf6a9('0x8'));var querystring=require(_0xf6a9('0xd'));var Papa=require(_0xf6a9('0xe'));var Redis=require('ioredis');var authService=require(_0xf6a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf6a9('0x10'));var hardwareService=require(_0xf6a9('0x11'));var logger=require(_0xf6a9('0x12'))('api');var utils=require(_0xf6a9('0x13'));var config=require(_0xf6a9('0x14'));var licenseUtil=require(_0xf6a9('0x15'));var db=require(_0xf6a9('0x16'))['db'];config['redis']=_[_0xf6a9('0x17')](config['redis'],{'host':_0xf6a9('0x18'),'port':0x18eb});var socket=require(_0xf6a9('0x19'))(new Redis(config[_0xf6a9('0x1a')]));require(_0xf6a9('0x1b'))['register'](socket);var jayson=require(_0xf6a9('0x1c'));var client=jayson[_0xf6a9('0x1d')][_0xf6a9('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xf6a9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4ddbd5,_0x14593d,_0x3af325,_0x23bbe4){return new BPromise(function(_0x177e9d,_0x24009f){var _0x10bbd9=_0x23bbe4||client;return _0x10bbd9['request'](_0x4ddbd5,_0x3af325)[_0xf6a9('0x1f')](function(_0x1580e0){logger[_0xf6a9('0x20')](_0xf6a9('0x21'),_0x14593d,'request\x20sent');logger[_0xf6a9('0x22')](_0xf6a9('0x23'),_0x14593d,_0xf6a9('0x24'),JSON[_0xf6a9('0x25')](_0x1580e0));if(_0x1580e0[_0xf6a9('0x26')]){if(_0x1580e0[_0xf6a9('0x26')][_0xf6a9('0x27')]===0x1f4){logger['error'](_0xf6a9('0x21'),_0x14593d,_0x1580e0['error'][_0xf6a9('0x28')]);return _0x24009f(_0x1580e0[_0xf6a9('0x26')][_0xf6a9('0x28')]);}logger[_0xf6a9('0x26')](_0xf6a9('0x21'),_0x14593d,_0x1580e0['error'][_0xf6a9('0x28')]);return _0x177e9d(_0x1580e0[_0xf6a9('0x26')][_0xf6a9('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x14593d,_0xf6a9('0x24'));_0x177e9d(_0x1580e0[_0xf6a9('0x29')]['message']);}})[_0xf6a9('0x2a')](function(_0x3c6bc8){logger[_0xf6a9('0x26')](_0xf6a9('0x21'),_0x14593d,_0x3c6bc8);_0x24009f(_0x3c6bc8);});});}function respondWithStatusCode(_0x37bce7,_0x2744e5){_0x2744e5=_0x2744e5||0xcc;return function(_0x47b3ec){if(_0x47b3ec){return _0x37bce7[_0xf6a9('0x2b')](_0x2744e5);}return _0x37bce7[_0xf6a9('0x2c')](_0x2744e5)[_0xf6a9('0x2d')]();};}function respondWithResult(_0x134a03,_0x3a9677){_0x3a9677=_0x3a9677||0xc8;return function(_0x3a1d56){if(_0x3a1d56){return _0x134a03['status'](_0x3a9677)[_0xf6a9('0x2e')](_0x3a1d56);}};}function respondWithFilteredResult(_0x43f7cb,_0x113d88){return function(_0x26ca94){if(_0x26ca94){var _0x52fb4e=typeof _0x113d88[_0xf6a9('0x2f')]===_0xf6a9('0x30')&&typeof _0x113d88['limit']===_0xf6a9('0x30');var _0x3d4875=_0x26ca94[_0xf6a9('0x31')];var _0xf3ea36=_0x52fb4e?0x0:_0x113d88['offset'];var _0x1edab8=_0x52fb4e?_0x26ca94['count']:_0x113d88['offset']+_0x113d88[_0xf6a9('0x32')];var _0x13bb4c;if(_0x1edab8>=_0x3d4875){_0x1edab8=_0x3d4875;_0x13bb4c=0xc8;}else{_0x13bb4c=0xce;}_0x43f7cb[_0xf6a9('0x2c')](_0x13bb4c);return _0x43f7cb[_0xf6a9('0x33')](_0xf6a9('0x34'),_0xf3ea36+'-'+_0x1edab8+'/'+_0x3d4875)['json'](_0x26ca94);}return null;};}function patchUpdates(_0xf1fd0c){return function(_0x499099){try{jsonpatch[_0xf6a9('0x35')](_0x499099,_0xf1fd0c,!![]);}catch(_0x143415){return BPromise[_0xf6a9('0x36')](_0x143415);}return _0x499099['save']();};}function saveUpdates(_0x226731,_0x29229d){return function(_0x5d8ca0){if(_0x5d8ca0){return _0x5d8ca0['update'](_0x226731)['then'](function(_0x3f6d18){return _0x3f6d18;});}return null;};}function removeEntity(_0x1c5df7,_0x38460d){return function(_0x16eacd){if(_0x16eacd){return _0x16eacd[_0xf6a9('0x37')]()['then'](function(){_0x1c5df7['status'](0xcc)[_0xf6a9('0x2d')]();});}};}function handleEntityNotFound(_0x42c1f0,_0x59a867){return function(_0x3d35da){if(!_0x3d35da){_0x42c1f0['sendStatus'](0x194);}return _0x3d35da;};}function handleError(_0x174e52,_0x428a3e){_0x428a3e=_0x428a3e||0x1f4;return function(_0x2728f8){logger[_0xf6a9('0x26')](_0x2728f8[_0xf6a9('0x38')]);if(_0x2728f8[_0xf6a9('0x39')]){delete _0x2728f8['name'];}_0x174e52[_0xf6a9('0x2c')](_0x428a3e)[_0xf6a9('0x3a')](_0x2728f8);};}exports['index']=function(_0x24aa53,_0x4932a8){var _0x509f9e={},_0x1413aa={},_0xccca96={'count':0x0,'rows':[]};var _0x2139e6=_[_0xf6a9('0x3b')](db[_0xf6a9('0x3c')][_0xf6a9('0x3d')],function(_0x13b8fe){return{'name':_0x13b8fe['fieldName'],'type':_0x13b8fe['type']['key']};});_0x1413aa[_0xf6a9('0x3e')]=_[_0xf6a9('0x3b')](_0x2139e6,'name');_0x1413aa['query']=_[_0xf6a9('0x3f')](_0x24aa53['query']);_0x1413aa[_0xf6a9('0x40')]=_[_0xf6a9('0x41')](_0x1413aa[_0xf6a9('0x3e')],_0x1413aa[_0xf6a9('0x42')]);_0x509f9e[_0xf6a9('0x43')]=_[_0xf6a9('0x41')](_0x1413aa['model'],qs[_0xf6a9('0x44')](_0x24aa53['query']['fields']));_0x509f9e[_0xf6a9('0x43')]=_0x509f9e[_0xf6a9('0x43')]['length']?_0x509f9e['attributes']:_0x1413aa[_0xf6a9('0x3e')];if(!_0x24aa53[_0xf6a9('0x42')][_0xf6a9('0x45')](_0xf6a9('0x46'))){_0x509f9e['limit']=qs[_0xf6a9('0x32')](_0x24aa53[_0xf6a9('0x42')][_0xf6a9('0x32')]);_0x509f9e[_0xf6a9('0x2f')]=qs[_0xf6a9('0x2f')](_0x24aa53['query'][_0xf6a9('0x2f')]);}_0x509f9e[_0xf6a9('0x47')]=qs['sort'](_0x24aa53[_0xf6a9('0x42')]['sort']);_0x509f9e[_0xf6a9('0x48')]=qs['filters'](_[_0xf6a9('0x49')](_0x24aa53['query'],_0x1413aa[_0xf6a9('0x40')]),_0x2139e6);if(_0x24aa53[_0xf6a9('0x42')]['filter']){_0x509f9e[_0xf6a9('0x48')]=_[_0xf6a9('0x4a')](_0x509f9e[_0xf6a9('0x48')],{'$or':_['map'](_0x2139e6,function(_0x4283fe){if(_0x4283fe['type']!==_0xf6a9('0x4b')){var _0x5018b1={};_0x5018b1[_0x4283fe[_0xf6a9('0x39')]]={'$like':'%'+_0x24aa53[_0xf6a9('0x42')][_0xf6a9('0x4c')]+'%'};return _0x5018b1;}})});}_0x509f9e=_[_0xf6a9('0x4a')]({},_0x509f9e,_0x24aa53[_0xf6a9('0x4d')]);var _0x190ac4={'where':_0x509f9e[_0xf6a9('0x48')]};return db['OpenchannelMessage']['count'](_0x190ac4)[_0xf6a9('0x1f')](function(_0x545232){_0xccca96[_0xf6a9('0x31')]=_0x545232;if(_0x24aa53[_0xf6a9('0x42')][_0xf6a9('0x4e')]){_0x509f9e['include']=[{'all':!![]}];}return db[_0xf6a9('0x3c')][_0xf6a9('0x4f')](_0x509f9e);})[_0xf6a9('0x1f')](function(_0x1b96ae){_0xccca96[_0xf6a9('0x50')]=_0x1b96ae;return _0xccca96;})[_0xf6a9('0x1f')](respondWithFilteredResult(_0x4932a8,_0x509f9e))['catch'](handleError(_0x4932a8,null));};exports[_0xf6a9('0x51')]=function(_0x290219,_0x16f3da){var _0x500de6={'raw':!![],'where':{'id':_0x290219['params']['id']}},_0x54cfae={};_0x54cfae['model']=_[_0xf6a9('0x3f')](db[_0xf6a9('0x3c')][_0xf6a9('0x3d')]);_0x54cfae['query']=_[_0xf6a9('0x3f')](_0x290219[_0xf6a9('0x42')]);_0x54cfae['filters']=_[_0xf6a9('0x41')](_0x54cfae['model'],_0x54cfae[_0xf6a9('0x42')]);_0x500de6['attributes']=_[_0xf6a9('0x41')](_0x54cfae[_0xf6a9('0x3e')],qs[_0xf6a9('0x44')](_0x290219[_0xf6a9('0x42')][_0xf6a9('0x44')]));_0x500de6[_0xf6a9('0x43')]=_0x500de6[_0xf6a9('0x43')]['length']?_0x500de6[_0xf6a9('0x43')]:_0x54cfae[_0xf6a9('0x3e')];if(_0x290219['query'][_0xf6a9('0x4e')]){_0x500de6[_0xf6a9('0x52')]=[{'all':!![]}];}_0x500de6=_[_0xf6a9('0x4a')]({},_0x500de6,_0x290219[_0xf6a9('0x4d')]);return db[_0xf6a9('0x3c')][_0xf6a9('0x53')](_0x500de6)['then'](handleEntityNotFound(_0x16f3da,null))[_0xf6a9('0x1f')](respondWithResult(_0x16f3da,null))[_0xf6a9('0x2a')](handleError(_0x16f3da,null));};exports[_0xf6a9('0x54')]=function(_0x3203b6,_0x443ef3){return db[_0xf6a9('0x3c')]['create'](_0x3203b6[_0xf6a9('0x55')],{})['then'](respondWithResult(_0x443ef3,0xc9))[_0xf6a9('0x2a')](handleError(_0x443ef3,null));};exports[_0xf6a9('0x56')]=function(_0x978933,_0x151bd1){if(_0x978933[_0xf6a9('0x55')]['id']){delete _0x978933[_0xf6a9('0x55')]['id'];}return db[_0xf6a9('0x3c')][_0xf6a9('0x53')]({'where':{'id':_0x978933[_0xf6a9('0x57')]['id']}})[_0xf6a9('0x1f')](handleEntityNotFound(_0x151bd1,null))[_0xf6a9('0x1f')](saveUpdates(_0x978933[_0xf6a9('0x55')],null))[_0xf6a9('0x1f')](respondWithResult(_0x151bd1,null))[_0xf6a9('0x2a')](handleError(_0x151bd1,null));};exports[_0xf6a9('0x37')]=function(_0x5b0ab0,_0x41949f){return db['OpenchannelMessage'][_0xf6a9('0x53')]({'where':{'id':_0x5b0ab0[_0xf6a9('0x57')]['id']}})[_0xf6a9('0x1f')](handleEntityNotFound(_0x41949f,null))[_0xf6a9('0x1f')](removeEntity(_0x41949f,null))[_0xf6a9('0x2a')](handleError(_0x41949f,null));};exports[_0xf6a9('0x58')]=function(_0x4e0409,_0x24cc9e){return db[_0xf6a9('0x3c')][_0xf6a9('0x58')]()['then'](respondWithResult(_0x24cc9e,null))[_0xf6a9('0x2a')](handleError(_0x24cc9e,null));};var interaction_log=require(_0xf6a9('0x12'))(_0xf6a9('0x59'));exports[_0xf6a9('0x5a')]=function(_0x431591,_0x326acd,_0xb4d86){var _0x35800b={'agent':{},'channel':_0xf6a9('0x5b')};if(_0x431591[_0xf6a9('0x55')]['id']){delete _0x431591[_0xf6a9('0x55')]['id'];}_0x431591['body'][_0xf6a9('0x5c')]=!![];_0x431591['body']['readAt']=moment()[_0xf6a9('0x5d')](_0xf6a9('0x5e'));_0x431591[_0xf6a9('0x55')][_0xf6a9('0x5f')]=_0x431591['body'][_0xf6a9('0x5f')]||_0x431591[_0xf6a9('0x60')]['id'];_0x35800b[_0xf6a9('0x61')]['id']=_0x431591[_0xf6a9('0x55')]['UserId'];return db[_0xf6a9('0x3c')]['find']({'where':{'id':_0x431591[_0xf6a9('0x57')]['id'],'UserId':null}})[_0xf6a9('0x1f')](handleEntityNotFound(_0x326acd,null))[_0xf6a9('0x1f')](saveUpdates(_0x431591[_0xf6a9('0x55')],null))[_0xf6a9('0x1f')](function(_0x2e8053){if(_0x2e8053){_0x35800b[_0xf6a9('0x28')]=_0x2e8053[_0xf6a9('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf6a9('0x53')]({'where':{'id':_0x2e8053[_0xf6a9('0x63')]}});}return null;})[_0xf6a9('0x1f')](handleEntityNotFound(_0x326acd,null))[_0xf6a9('0x1f')](function(_0xb80df8){if(_0xb80df8){return _0xb80df8[_0xf6a9('0x56')]({'UserId':_0x431591['body']['UserId'],'read1stAt':_[_0xf6a9('0x64')](_0xb80df8['read1stAt'])?moment()[_0xf6a9('0x5d')](_0xf6a9('0x5e')):undefined});}return null;})[_0xf6a9('0x1f')](function(_0x140f09){if(_0x140f09){_0x35800b[_0xf6a9('0x65')]=_0x140f09[_0xf6a9('0x62')]({'plain':!![]});interaction_log[_0xf6a9('0x20')](_0xf6a9('0x66'),_0x431591[_0xf6a9('0x60')]['id'],_0x431591['user']['name'],_0x431591[_0xf6a9('0x60')]['role'],_0x35800b[_0xf6a9('0x65')]['id'],_0x431591[_0xf6a9('0x55')]?JSON['stringify'](_0x431591[_0xf6a9('0x55')]):_0xf6a9('0x67'));return respondWithRpcPromise(_0xf6a9('0x68'),_0xf6a9('0x69'),_0x35800b);}return null;})['then'](function(_0x643f85){var _0x1ecebe=_0xf6a9('0x6a')+_0x643f85[_0xf6a9('0x28')][_0xf6a9('0x6b')];return db[_0xf6a9('0x6c')][_0xf6a9('0x42')](_0x1ecebe,{'type':db[_0xf6a9('0x6d')][_0xf6a9('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x3fc15c){return _0x3fc15c;});})['then'](function(_0x133ea1){if(_0x133ea1){_0x35800b[_0xf6a9('0x28')][_0xf6a9('0x6f')]=_0x133ea1[0x0];if(!_0x431591[_0xf6a9('0x55')][_0xf6a9('0x5f')])return;return db[_0xf6a9('0x70')]['find']({'where':{'id':_0x431591[_0xf6a9('0x55')]['UserId'],'role':'agent'},'attributes':['id','name',_0xf6a9('0x71'),_0xf6a9('0x72'),'internal'],'raw':!![]});}return null;})[_0xf6a9('0x1f')](function(_0x4624ff){if(!_0x4624ff)return null;_0x35800b[_0xf6a9('0x28')][_0xf6a9('0x61')]=_0x4624ff;return _0x35800b;})['then'](function(_0x43dadf){if(_0x43dadf){if(_0x431591[_0xf6a9('0x55')][_0xf6a9('0x73')]){_0x35800b[_0xf6a9('0x28')][_0xf6a9('0x74')]=util['format']('SIP/%s',_0x431591['user'][_0xf6a9('0x39')]);_0x35800b['message'][_0xf6a9('0x75')]=_0x35800b[_0xf6a9('0x75')];_0x35800b[_0xf6a9('0x28')][_0xf6a9('0x76')]=_0x35800b[_0xf6a9('0x75')];_0x35800b['message'][_0xf6a9('0x77')]=_0xf6a9('0x5a');return respondWithRpcPromise('EventManager',_0xf6a9('0x78'),{'event':_0xf6a9('0x79'),'message':_0x35800b[_0xf6a9('0x28')]},client9002)[_0xf6a9('0x1f')](function(){return _0x35800b;});}return _0x35800b;}return null;})[_0xf6a9('0x1f')](respondWithResult(_0x326acd,null))[_0xf6a9('0x2a')](handleError(_0x326acd,null));};var interaction_log=require('../../config/logger')(_0xf6a9('0x59'));exports[_0xf6a9('0x36')]=function(_0x5e99cf,_0x289e86,_0x51cb9b){var _0x5c861d={'agent':{},'channel':_0xf6a9('0x5b')};if(_0x5e99cf[_0xf6a9('0x55')]['id']){delete _0x5e99cf[_0xf6a9('0x55')]['id'];}_0x5e99cf[_0xf6a9('0x55')][_0xf6a9('0x5f')]=_0x5e99cf[_0xf6a9('0x55')][_0xf6a9('0x5f')]||_0x5e99cf[_0xf6a9('0x60')]['id'];_0x5c861d[_0xf6a9('0x61')]['id']=_0x5e99cf[_0xf6a9('0x55')][_0xf6a9('0x5f')];return db[_0xf6a9('0x3c')][_0xf6a9('0x53')]({'where':{'id':_0x5e99cf[_0xf6a9('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x289e86,null))[_0xf6a9('0x1f')](function(_0xeb2fd){if(_0xeb2fd){_0x5c861d[_0xf6a9('0x28')]=_0xeb2fd[_0xf6a9('0x62')]({'plain':!![]});return db[_0xf6a9('0x7a')]['find']({'where':{'id':_0xeb2fd[_0xf6a9('0x63')]}});}return null;})[_0xf6a9('0x1f')](handleEntityNotFound(_0x289e86,null))[_0xf6a9('0x1f')](function(_0xe29065){if(_0xe29065){_0x5c861d['interaction']=_0xe29065[_0xf6a9('0x62')]({'plain':!![]});interaction_log['info'](_0xf6a9('0x7b'),_0x5e99cf[_0xf6a9('0x60')]['id'],_0x5e99cf[_0xf6a9('0x60')][_0xf6a9('0x39')],_0x5e99cf[_0xf6a9('0x60')]['role'],_0x5c861d['interaction']['id'],_0x5e99cf[_0xf6a9('0x55')]?JSON[_0xf6a9('0x25')](_0x5e99cf[_0xf6a9('0x55')]):_0xf6a9('0x67'));return respondWithRpcPromise(_0xf6a9('0x7c'),_0xf6a9('0x7d'),_0x5c861d);}return null;})[_0xf6a9('0x1f')](function(_0x548ab7){var _0x543382=_0xf6a9('0x6a')+_0x548ab7[_0xf6a9('0x28')]['ContactId'];return db[_0xf6a9('0x6c')][_0xf6a9('0x42')](_0x543382,{'type':db[_0xf6a9('0x6d')][_0xf6a9('0x6e')]['SELECT'],'raw':!![]})[_0xf6a9('0x1f')](function(_0x2a3e5e){return _0x2a3e5e;});})[_0xf6a9('0x1f')](function(_0x342d69){if(_0x342d69){_0x5c861d[_0xf6a9('0x28')][_0xf6a9('0x6f')]=_0x342d69[0x0];if(!_0x5e99cf[_0xf6a9('0x55')][_0xf6a9('0x5f')])return;return db[_0xf6a9('0x70')]['find']({'where':{'id':_0x5e99cf[_0xf6a9('0x55')][_0xf6a9('0x5f')],'role':_0xf6a9('0x61')},'attributes':['id',_0xf6a9('0x39'),_0xf6a9('0x71'),'email',_0xf6a9('0x7e')],'raw':!![]});}return null;})['then'](function(_0x405d40){if(!_0x405d40)return null;_0x5c861d[_0xf6a9('0x28')][_0xf6a9('0x61')]=_0x405d40;return _0x5c861d;})[_0xf6a9('0x1f')](function(_0x4bc164){if(_0x4bc164){_0x4bc164[_0xf6a9('0x28')]['interface']=util[_0xf6a9('0x5d')]('SIP/%s',_0x5e99cf[_0xf6a9('0x60')][_0xf6a9('0x39')]);_0x4bc164['message'][_0xf6a9('0x75')]=_0x5c861d[_0xf6a9('0x75')];_0x4bc164[_0xf6a9('0x28')][_0xf6a9('0x76')]=_0x5c861d['channel'];_0x4bc164[_0xf6a9('0x28')][_0xf6a9('0x77')]=_0xf6a9('0x36');respondWithRpcPromise(_0xf6a9('0x78'),_0xf6a9('0x78'),{'event':_0xf6a9('0x7f'),'message':_0x4bc164[_0xf6a9('0x28')]},client9002);return _0x5c861d;}return null;})['then'](respondWithResult(_0x289e86,null))['catch'](handleError(_0x289e86,null));};
\ No newline at end of file
index 4431739..99a06df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d15=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7d15,0x1d5));var _0x57d1=function(_0x22b02a,_0x5ce747){_0x22b02a=_0x22b02a-0x0;var _0x9572b3=_0x7d15[_0x22b02a];return _0x9572b3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x57d1('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x57d1('0x1')](0x0);var events={'afterCreate':_0x57d1('0x2'),'afterUpdate':_0x57d1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e22b0){return function(_0x28ff94,_0x38f9fd,_0x33a6ef){OpenchannelMessageEvents[_0x57d1('0x4')](_0x1e22b0+':'+_0x28ff94['id'],_0x28ff94);OpenchannelMessageEvents[_0x57d1('0x4')](_0x1e22b0,_0x28ff94);_0x33a6ef(null);};}for(var e in events){if(events[_0x57d1('0x5')](e)){var event=events[e];OpenchannelMessage[_0x57d1('0x6')](e,emitEvent(event));}}module[_0x57d1('0x7')]=OpenchannelMessageEvents;
\ No newline at end of file
+var _0x7bed=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x19c57a,_0x5c9c7c){var _0x576a08=function(_0x929c62){while(--_0x929c62){_0x19c57a['push'](_0x19c57a['shift']());}};_0x576a08(++_0x5c9c7c);}(_0x7bed,0x1c8));var _0xd7be=function(_0x29d13f,_0x421cd5){_0x29d13f=_0x29d13f-0x0;var _0x55a873=_0x7bed[_0x29d13f];return _0x55a873;};'use strict';var EventEmitter=require(_0xd7be('0x0'));var OpenchannelMessage=require(_0xd7be('0x1'))['db'][_0xd7be('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd7be('0x3')](0x0);var events={'afterCreate':_0xd7be('0x4'),'afterUpdate':'update','afterDestroy':_0xd7be('0x5')};function emitEvent(_0x30d13c){return function(_0x5645e4,_0x478d73,_0x5d9ca4){OpenchannelMessageEvents[_0xd7be('0x6')](_0x30d13c+':'+_0x5645e4['id'],_0x5645e4);OpenchannelMessageEvents[_0xd7be('0x6')](_0x30d13c,_0x5645e4);_0x5d9ca4(null);};}for(var e in events){if(events[_0xd7be('0x7')](e)){var event=events[e];OpenchannelMessage[_0xd7be('0x8')](e,emitEvent(event));}}module[_0xd7be('0x9')]=OpenchannelMessageEvents;
\ No newline at end of file
index 6f51449..62601ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1370=['OpenchannelInteraction','findOne','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','method','GET','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','get','direction','toLowerCase','out','isNil','UserId'];(function(_0x260e07,_0x2dd0e4){var _0x28ba4e=function(_0x237146){while(--_0x237146){_0x260e07['push'](_0x260e07['shift']());}};_0x28ba4e(++_0x2dd0e4);}(_0x1370,0x81));var _0x0137=function(_0x2b365f,_0x17aa37){_0x2b365f=_0x2b365f-0x0;var _0x26b060=_0x1370[_0x2b365f];return _0x26b060;};'use strict';var _=require('lodash');var util=require(_0x0137('0x0'));var logger=require(_0x0137('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0137('0x2'));var rp=require(_0x0137('0x3'));var fs=require('fs');var path=require(_0x0137('0x4'));var rimraf=require(_0x0137('0x5'));var config=require(_0x0137('0x6'));var attributes=require(_0x0137('0x7'));module[_0x0137('0x8')]=function(_0x296181,_0x23a46e){return _0x296181[_0x0137('0x9')](_0x0137('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x0137('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d5a74,_0x50d33d,_0x769e02){var _0xf81001=_0x296181['models'];var _0x577645=_0x4d5a74[_0x0137('0xc')]({'plain':!![]});if(_0x577645[_0x0137('0xd')][_0x0137('0xe')]()==='in'||_0x577645['direction'][_0x0137('0xe')]()===_0x0137('0xf')&&!_0x577645['secret']&&!_[_0x0137('0x10')](_0x577645[_0x0137('0x11')])){_0xf81001[_0x0137('0x12')][_0x0137('0x13')]({'where':{'id':_0x577645['OpenchannelInteractionId']}})[_0x0137('0x14')](function(_0x50563b){if(_0x50563b){_0x50563b['update']({'lastMsgAt':_0x577645[_0x0137('0x15')],'lastMsgDirection':_0x577645[_0x0137('0xd')][_0x0137('0xe')]()});}})[_0x0137('0x16')](function(_0x21c32f){console[_0x0137('0x17')](_0x21c32f);});}if(_0x577645[_0x0137('0xd')]===_0x0137('0xf')&&!_0x577645['secret']){var _0x3db7ed;_0xf81001[_0x0137('0x18')][_0x0137('0x19')]()['then'](function(_0xc1ac08){return _0xf81001[_0x0137('0x1a')][_0x0137('0x1b')]({'where':{'id':_0x577645['OpenchannelAccountId']},'include':[{'model':_0xf81001['OpenchannelInteraction'],'as':_0x0137('0x1c'),'where':{'id':_0x577645['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xf81001[_0x0137('0x18')],'as':_0x0137('0x1d'),'attributes':_[_0x0137('0x1e')](_0xc1ac08)}]}]});})['then'](function(_0x374e77){_0x3db7ed=_0x374e77[_0x0137('0xc')]({'plain':!![]});if(_0x3db7ed&&_0x3db7ed[_0x0137('0x1f')]){logger[_0x0137('0x20')](_0x0137('0x21'),_0x0137('0x22'),util[_0x0137('0x23')](_0x0137('0x24'),_0x577645['id'],_0x3db7ed[_0x0137('0x1f')]));if(_0x3db7ed[_0x0137('0x1c')]&&_0x3db7ed[_0x0137('0x1c')]['length']){_0x577645['Interaction']=_[_0x0137('0x25')](_0x3db7ed['Interactions'][0x0],_0x0137('0x1d'));_0x577645['Contact']=_0x3db7ed[_0x0137('0x1c')][0x0][_0x0137('0x1d')];}var _0x50d33d={'method':'POST','uri':encodeURI(_0x3db7ed['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x50d33d[_0x0137('0x26')]){case _0x0137('0x27'):_0x50d33d['qs']=_0x577645;break;case _0x0137('0x28'):_0x50d33d[_0x0137('0x29')]=_0x577645;break;}return rp(_0x50d33d)['then'](function(_0x316632){logger[_0x0137('0x20')](_0x0137('0x21'),'afterCreate',util[_0x0137('0x23')](_0x0137('0x2a'),_0x577645['id'],_0x3db7ed[_0x0137('0x1f')]));if(_0x316632[_0x0137('0x29')]['threadId']&&_0x316632[_0x0137('0x29')]['threadId']!=_0x577645['Interaction'][_0x0137('0x2b')]){return _0xf81001[_0x0137('0x12')]['update']({'threadId':_0x316632[_0x0137('0x29')][_0x0137('0x2b')]},{'where':{'id':_0x577645[_0x0137('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x4d5a74[_0x0137('0x2d')]({'read':!![]});})[_0x0137('0x16')](function(_0x5a80da){logger[_0x0137('0x17')](_0x0137('0x21'),'afterCreate',util['inspect'](_0x5a80da,{'showHidden':![],'depth':null}));_0x769e02();});}else{_0x769e02();}})[_0x0137('0x2e')](function(){_0x769e02();});}else{_0x769e02();}}},'charset':_0x0137('0x2f'),'collate':_0x0137('0x30')});};
\ No newline at end of file
+var _0x42ec=['replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','omit','POST','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','direction','catch','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys'];(function(_0x265a2f,_0x2061ce){var _0x4e3e3e=function(_0x20802c){while(--_0x20802c){_0x265a2f['push'](_0x265a2f['shift']());}};_0x4e3e3e(++_0x2061ce);}(_0x42ec,0x73));var _0xc42e=function(_0x3f8d91,_0x5d8882){_0x3f8d91=_0x3f8d91-0x0;var _0x1480e4=_0x42ec[_0x3f8d91];return _0x1480e4;};'use strict';var _=require('lodash');var util=require(_0xc42e('0x0'));var logger=require(_0xc42e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc42e('0x2'));var fs=require('fs');var path=require(_0xc42e('0x3'));var rimraf=require(_0xc42e('0x4'));var config=require(_0xc42e('0x5'));var attributes=require(_0xc42e('0x6'));module['exports']=function(_0x3d356d,_0x137bb6){return _0x3d356d[_0xc42e('0x7')](_0xc42e('0x8'),attributes,{'tableName':_0xc42e('0x9'),'paranoid':![],'indexes':[{'name':_0xc42e('0xa'),'fields':[_0xc42e('0xb')],'type':_0xc42e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x204205,_0x31e2b2,_0x933e30){var _0x2e2a7d=_0x3d356d[_0xc42e('0xd')];var _0xc89097=_0x204205[_0xc42e('0xe')]({'plain':!![]});if(_0xc89097['direction'][_0xc42e('0xf')]()==='in'||_0xc89097['direction']['toLowerCase']()===_0xc42e('0x10')&&!_0xc89097['secret']&&!_[_0xc42e('0x11')](_0xc89097['UserId'])){_0x2e2a7d[_0xc42e('0x12')][_0xc42e('0x13')]({'where':{'id':_0xc89097[_0xc42e('0x14')]}})[_0xc42e('0x15')](function(_0x201498){if(_0x201498){_0x201498[_0xc42e('0x16')]({'lastMsgAt':_0xc89097[_0xc42e('0x17')],'lastMsgDirection':_0xc89097[_0xc42e('0x18')][_0xc42e('0xf')]()});}})[_0xc42e('0x19')](function(_0x53ac5a){console['error'](_0x53ac5a);});}if(_0xc89097[_0xc42e('0x18')]==='out'&&!_0xc89097[_0xc42e('0x1a')]){var _0x43b6fb;_0x2e2a7d[_0xc42e('0x1b')][_0xc42e('0x1c')]()[_0xc42e('0x15')](function(_0x10567b){return _0x2e2a7d[_0xc42e('0x1d')][_0xc42e('0x1e')]({'where':{'id':_0xc89097[_0xc42e('0x1f')]},'include':[{'model':_0x2e2a7d[_0xc42e('0x12')],'as':_0xc42e('0x20'),'where':{'id':_0xc89097['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2e2a7d['CmContact'],'as':_0xc42e('0x21'),'attributes':_[_0xc42e('0x22')](_0x10567b)}]}]});})['then'](function(_0x586c75){_0x43b6fb=_0x586c75[_0xc42e('0xe')]({'plain':!![]});if(_0x43b6fb&&_0x43b6fb[_0xc42e('0x23')]){logger['info'](_0xc42e('0x24'),_0xc42e('0x25'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0xc89097['id'],_0x43b6fb[_0xc42e('0x23')]));if(_0x43b6fb[_0xc42e('0x20')]&&_0x43b6fb[_0xc42e('0x20')][_0xc42e('0x26')]){_0xc89097[_0xc42e('0x27')]=_[_0xc42e('0x28')](_0x43b6fb[_0xc42e('0x20')][0x0],'Contact');_0xc89097[_0xc42e('0x21')]=_0x43b6fb[_0xc42e('0x20')][0x0][_0xc42e('0x21')];}var _0x31e2b2={'method':_0xc42e('0x29'),'uri':encodeURI(_0x43b6fb['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x31e2b2['method']){case _0xc42e('0x2a'):_0x31e2b2['qs']=_0xc89097;break;case'POST':_0x31e2b2[_0xc42e('0xb')]=_0xc89097;break;}return rp(_0x31e2b2)[_0xc42e('0x15')](function(_0x2f440d){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xc42e('0x25'),util[_0xc42e('0x2b')](_0xc42e('0x2c'),_0xc89097['id'],_0x43b6fb[_0xc42e('0x23')]));if(_0x2f440d[_0xc42e('0xb')][_0xc42e('0x2d')]&&_0x2f440d[_0xc42e('0xb')]['threadId']!=_0xc89097[_0xc42e('0x27')][_0xc42e('0x2d')]){return _0x2e2a7d[_0xc42e('0x12')][_0xc42e('0x16')]({'threadId':_0x2f440d[_0xc42e('0xb')][_0xc42e('0x2d')]},{'where':{'id':_0xc89097['Interaction']['id']}});}else{return;}})[_0xc42e('0x15')](function(){return _0x204205[_0xc42e('0x16')]({'read':!![]});})[_0xc42e('0x19')](function(_0x245853){logger[_0xc42e('0x2e')](_0xc42e('0x24'),_0xc42e('0x25'),util[_0xc42e('0x2f')](_0x245853,{'showHidden':![],'depth':null}));_0x933e30();});}else{_0x933e30();}})['finally'](function(){_0x933e30();});}else{_0x933e30();}}},'charset':_0xc42e('0x30'),'collate':_0xc42e('0x31')});};
\ No newline at end of file
index d697877..fe09ce2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0xdb28,0x106));var _0x8db2=function(_0x503cbd,_0x1b02b3){_0x503cbd=_0x503cbd-0x0;var _0x5974c5=_0xdb28[_0x503cbd];return _0x5974c5;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});};
\ No newline at end of file
+var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x567bd7,_0x394cfa){var _0x589c66=function(_0xa2e6d6){while(--_0xa2e6d6){_0x567bd7['push'](_0x567bd7['shift']());}};_0x589c66(++_0x394cfa);}(_0x7a54,0x106));var _0x47a5=function(_0x106c50,_0x79ab97){_0x106c50=_0x106c50-0x0;var _0x9362d4=_0x7a54[_0x106c50];return _0x9362d4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});};
\ No newline at end of file
index 561338c..4bd244a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d5c=['update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d5c,0x98));var _0xc9d5=function(_0x262521,_0x296e11){_0x262521=_0x262521-0x0;var _0xcd2b53=_0x9d5c[_0x262521];return _0xcd2b53;};'use strict';var OpenchannelMessageEvents=require(_0xc9d5('0x0'));var events=['save',_0xc9d5('0x1'),_0xc9d5('0x2')];function createListener(_0x5d161b,_0x1f1d2f){return function(_0x30cb5b){_0x1f1d2f[_0xc9d5('0x3')](_0x5d161b,_0x30cb5b);};}function removeListener(_0x5535d9,_0x44a6eb){return function(){OpenchannelMessageEvents[_0xc9d5('0x4')](_0x5535d9,_0x44a6eb);};}exports['register']=function(_0x207097){for(var _0x26bd2f=0x0,_0x1a91f5=events[_0xc9d5('0x5')];_0x26bd2f<_0x1a91f5;_0x26bd2f++){var _0x2edfbc=events[_0x26bd2f];var _0x3a5810=createListener(_0xc9d5('0x6')+_0x2edfbc,_0x207097);OpenchannelMessageEvents['on'](_0x2edfbc,_0x3a5810);}};
\ No newline at end of file
+var _0xd0c9=['openchannelMessage:','./openchannelMessage.events','save','emit','length'];(function(_0x320465,_0x5eff07){var _0x18414f=function(_0x311959){while(--_0x311959){_0x320465['push'](_0x320465['shift']());}};_0x18414f(++_0x5eff07);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd0c9[_0x346737];return _0x1ade2e;};'use strict';var OpenchannelMessageEvents=require(_0x9d0c('0x0'));var events=[_0x9d0c('0x1'),'remove','update'];function createListener(_0x5d3eb1,_0x154c38){return function(_0x2eff0e){_0x154c38[_0x9d0c('0x2')](_0x5d3eb1,_0x2eff0e);};}function removeListener(_0x5922f1,_0x3b4b50){return function(){OpenchannelMessageEvents['removeListener'](_0x5922f1,_0x3b4b50);};}exports['register']=function(_0x6749){for(var _0x5bcaf9=0x0,_0x3eec5f=events[_0x9d0c('0x3')];_0x5bcaf9<_0x3eec5f;_0x5bcaf9++){var _0x308d9e=events[_0x5bcaf9];var _0x413a70=createListener(_0x9d0c('0x4')+_0x308d9e,_0x6749);OpenchannelMessageEvents['on'](_0x308d9e,_0x413a70);}};
\ No newline at end of file
index f002dc5..cdb327c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2899=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4aca29,_0x3e5c5c){var _0x55cc44=function(_0x517014){while(--_0x517014){_0x4aca29['push'](_0x4aca29['shift']());}};_0x55cc44(++_0x3e5c5c);}(_0x2899,0x144));var _0x9289=function(_0x2d8805,_0x58ed42){_0x2d8805=_0x2d8805-0x0;var _0x51458b=_0x2899[_0x2d8805];return _0x51458b;};'use strict';var multer=require(_0x9289('0x0'));var util=require(_0x9289('0x1'));var path=require('path');var timeout=require(_0x9289('0x2'));var express=require(_0x9289('0x3'));var router=express[_0x9289('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9289('0x5'));var interaction=require(_0x9289('0x6'));var config=require(_0x9289('0x7'));var controller=require(_0x9289('0x8'));router[_0x9289('0x9')]('/',auth[_0x9289('0xa')](),controller[_0x9289('0xb')]);router[_0x9289('0x9')]('/describe',auth[_0x9289('0xa')](),controller[_0x9289('0xc')]);router['get']('/:id',auth[_0x9289('0xa')](),controller[_0x9289('0xd')]);router[_0x9289('0x9')]('/:id/members',auth[_0x9289('0xa')](),controller[_0x9289('0xe')]);router['get'](_0x9289('0xf'),auth[_0x9289('0xa')](),controller[_0x9289('0x10')]);router['get']('/:id/users',auth[_0x9289('0xa')](),controller[_0x9289('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9289('0x12')](_0x9289('0xf'),auth[_0x9289('0xa')](),controller[_0x9289('0x13')]);router[_0x9289('0x12')](_0x9289('0x14'),auth['isAuthenticated'](),controller[_0x9289('0x15')]);router[_0x9289('0x16')](_0x9289('0x17'),auth[_0x9289('0xa')](),controller[_0x9289('0x18')]);router[_0x9289('0x19')](_0x9289('0x17'),auth[_0x9289('0xa')](),controller[_0x9289('0x1a')]);router['delete'](_0x9289('0xf'),auth[_0x9289('0xa')](),controller[_0x9289('0x1b')]);router[_0x9289('0x19')](_0x9289('0x14'),auth['isAuthenticated'](),controller[_0x9289('0x1c')]);module[_0x9289('0x1d')]=router;
\ No newline at end of file
+var _0xd614=['describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','isAuthenticated'];(function(_0x4a24d7,_0x332bba){var _0xdde72c=function(_0x3269f7){while(--_0x3269f7){_0x4a24d7['push'](_0x4a24d7['shift']());}};_0xdde72c(++_0x332bba);}(_0xd614,0xe0));var _0x4d61=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd614[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x4d61('0x0'));var util=require('util');var path=require(_0x4d61('0x1'));var timeout=require(_0x4d61('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d61('0x3'));var auth=require(_0x4d61('0x4'));var interaction=require(_0x4d61('0x5'));var config=require('../../config/environment');var controller=require(_0x4d61('0x6'));router[_0x4d61('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d61('0x8')]);router[_0x4d61('0x7')]('/describe',auth[_0x4d61('0x9')](),controller[_0x4d61('0xa')]);router[_0x4d61('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4d61('0xb')]);router[_0x4d61('0x7')](_0x4d61('0xc'),auth[_0x4d61('0x9')](),controller['getMembers']);router[_0x4d61('0x7')](_0x4d61('0xd'),auth[_0x4d61('0x9')](),controller[_0x4d61('0xe')]);router['get'](_0x4d61('0xf'),auth[_0x4d61('0x9')](),controller[_0x4d61('0x10')]);router[_0x4d61('0x11')]('/',auth[_0x4d61('0x9')](),controller[_0x4d61('0x12')]);router[_0x4d61('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4d61('0x13')]);router[_0x4d61('0x11')](_0x4d61('0xf'),auth['isAuthenticated'](),controller[_0x4d61('0x14')]);router[_0x4d61('0x15')]('/:id',auth[_0x4d61('0x9')](),controller['update']);router[_0x4d61('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4d61('0x17')]);router['delete'](_0x4d61('0xd'),auth[_0x4d61('0x9')](),controller[_0x4d61('0x18')]);router[_0x4d61('0x16')](_0x4d61('0xf'),auth[_0x4d61('0x9')](),controller[_0x4d61('0x19')]);module['exports']=router;
\ No newline at end of file
index 590084f..447f987 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf519=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x46ce14,_0x4f7796){var _0x1f15f0=function(_0x314f19){while(--_0x314f19){_0x46ce14['push'](_0x46ce14['shift']());}};_0x1f15f0(++_0x4f7796);}(_0xf519,0x1e3));var _0x9f51=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xf519[_0x3da832];return _0xe602f2;};'use strict';var Sequelize=require(_0x9f51('0x0'));module[_0x9f51('0x1')]={'name':{'type':Sequelize[_0x9f51('0x2')],'unique':_0x9f51('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9f51('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9f51('0x5'),_0x9f51('0x6'),_0x9f51('0x7'))}};
\ No newline at end of file
+var _0x1dc1=['rrmemory','beepall','sequelize','exports','name'];(function(_0x58cbc5,_0x3de123){var _0x38a8d9=function(_0x3a92be){while(--_0x3a92be){_0x58cbc5['push'](_0x58cbc5['shift']());}};_0x38a8d9(++_0x3de123);}(_0x1dc1,0xa2));var _0x11dc=function(_0x65b0bd,_0x2eeabb){_0x65b0bd=_0x65b0bd-0x0;var _0x2d5306=_0x1dc1[_0x65b0bd];return _0x2d5306;};'use strict';var Sequelize=require(_0x11dc('0x0'));module[_0x11dc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x11dc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x11dc('0x3'),_0x11dc('0x4'),'roundrobin')}};
\ No newline at end of file
index f41334a..6d93478 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5cbf=['format','SIP','Team','getTeams','hasOwnProperty','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','count','apply','reject','save','then','destroy','OpenchannelQueues','UserProfileResource','error','name','send','index','OpenchannelQueue','type','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt'];(function(_0x70822d,_0x5b21d4){var _0x1062dc=function(_0x8ee055){while(--_0x8ee055){_0x70822d['push'](_0x70822d['shift']());}};_0x1062dc(++_0x5b21d4);}(_0x5cbf,0x145));var _0xf5cb=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5cbf[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0xf5cb('0x0'));var rimraf=require(_0xf5cb('0x1'));var zipdir=require(_0xf5cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5cb('0x3'));var moment=require(_0xf5cb('0x4'));var BPromise=require(_0xf5cb('0x5'));var Mustache=require(_0xf5cb('0x6'));var util=require(_0xf5cb('0x7'));var path=require('path');var sox=require(_0xf5cb('0x8'));var csv=require(_0xf5cb('0x9'));var ejs=require(_0xf5cb('0xa'));var fs=require('fs');var fs_extra=require(_0xf5cb('0xb'));var _=require('lodash');var squel=require(_0xf5cb('0xc'));var crypto=require(_0xf5cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf5cb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5cb('0xf'));var Papa=require(_0xf5cb('0x10'));var Redis=require(_0xf5cb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf5cb('0x12'));var as=require(_0xf5cb('0x13'));var hardwareService=require(_0xf5cb('0x14'));var logger=require(_0xf5cb('0x15'))(_0xf5cb('0x16'));var utils=require(_0xf5cb('0x17'));var config=require(_0xf5cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5cb('0x19'))['db'];config[_0xf5cb('0x1a')]=_[_0xf5cb('0x1b')](config[_0xf5cb('0x1a')],{'host':_0xf5cb('0x1c'),'port':0x18eb});var socket=require(_0xf5cb('0x1d'))(new Redis(config[_0xf5cb('0x1a')]));require(_0xf5cb('0x1e'))[_0xf5cb('0x1f')](socket);function respondWithStatusCode(_0x638339,_0x5088e8){_0x5088e8=_0x5088e8||0xcc;return function(_0x309585){if(_0x309585){return _0x638339[_0xf5cb('0x20')](_0x5088e8);}return _0x638339[_0xf5cb('0x21')](_0x5088e8)[_0xf5cb('0x22')]();};}function respondWithResult(_0x5b314c,_0x2b1ade){_0x2b1ade=_0x2b1ade||0xc8;return function(_0xa493a6){if(_0xa493a6){return _0x5b314c[_0xf5cb('0x21')](_0x2b1ade)[_0xf5cb('0x23')](_0xa493a6);}};}function respondWithFilteredResult(_0x4daf2a,_0x549f97){return function(_0x3a13c8){if(_0x3a13c8){var _0x331c41=typeof _0x549f97[_0xf5cb('0x24')]==='undefined'&&typeof _0x549f97[_0xf5cb('0x25')]==='undefined';var _0x3c4038=_0x3a13c8[_0xf5cb('0x26')];var _0x2217e2=_0x331c41?0x0:_0x549f97[_0xf5cb('0x24')];var _0x25a583=_0x331c41?_0x3a13c8[_0xf5cb('0x26')]:_0x549f97[_0xf5cb('0x24')]+_0x549f97[_0xf5cb('0x25')];var _0x1f50db;if(_0x25a583>=_0x3c4038){_0x25a583=_0x3c4038;_0x1f50db=0xc8;}else{_0x1f50db=0xce;}_0x4daf2a[_0xf5cb('0x21')](_0x1f50db);return _0x4daf2a['set']('Content-Range',_0x2217e2+'-'+_0x25a583+'/'+_0x3c4038)[_0xf5cb('0x23')](_0x3a13c8);}return null;};}function patchUpdates(_0x48dbb1){return function(_0x3df14e){try{jsonpatch[_0xf5cb('0x27')](_0x3df14e,_0x48dbb1,!![]);}catch(_0xb736c5){return BPromise[_0xf5cb('0x28')](_0xb736c5);}return _0x3df14e[_0xf5cb('0x29')]();};}function saveUpdates(_0x31591b,_0x210f3a){return function(_0x2cb56d){if(_0x2cb56d){return _0x2cb56d['update'](_0x31591b)[_0xf5cb('0x2a')](function(_0x19375a){return _0x19375a;});}return null;};}function removeEntity(_0x29855a,_0x4a7416){return function(_0x50f419){if(_0x50f419){return _0x50f419[_0xf5cb('0x2b')]()[_0xf5cb('0x2a')](function(){var _0x286b45=_0x50f419['get']({'plain':!![]});var _0x4bffa0=_0xf5cb('0x2c');return db[_0xf5cb('0x2d')][_0xf5cb('0x2b')]({'where':{'type':_0x4bffa0,'resourceId':_0x286b45['id']}})[_0xf5cb('0x2a')](function(){return _0x50f419;});})['then'](function(){_0x29855a[_0xf5cb('0x21')](0xcc)[_0xf5cb('0x22')]();});}};}function handleEntityNotFound(_0x4f69b0,_0x34a664){return function(_0x3f5460){if(!_0x3f5460){_0x4f69b0[_0xf5cb('0x20')](0x194);}return _0x3f5460;};}function handleError(_0x50e19b,_0x38812c){_0x38812c=_0x38812c||0x1f4;return function(_0x585040){logger[_0xf5cb('0x2e')](_0x585040['stack']);if(_0x585040[_0xf5cb('0x2f')]){delete _0x585040[_0xf5cb('0x2f')];}_0x50e19b[_0xf5cb('0x21')](_0x38812c)[_0xf5cb('0x30')](_0x585040);};}exports[_0xf5cb('0x31')]=function(_0xa52dec,_0x5203b9){var _0x287190={},_0x307245={},_0x53c2c9={'count':0x0,'rows':[]};var _0x334349=_['map'](db[_0xf5cb('0x32')]['rawAttributes'],function(_0x2f6b98){return{'name':_0x2f6b98['fieldName'],'type':_0x2f6b98[_0xf5cb('0x33')]['key']};});_0x307245['model']=_[_0xf5cb('0x34')](_0x334349,_0xf5cb('0x2f'));_0x307245[_0xf5cb('0x35')]=_[_0xf5cb('0x36')](_0xa52dec[_0xf5cb('0x35')]);_0x307245[_0xf5cb('0x37')]=_[_0xf5cb('0x38')](_0x307245[_0xf5cb('0x39')],_0x307245['query']);_0x287190[_0xf5cb('0x3a')]=_['intersection'](_0x307245[_0xf5cb('0x39')],qs[_0xf5cb('0x3b')](_0xa52dec[_0xf5cb('0x35')]['fields']));_0x287190[_0xf5cb('0x3a')]=_0x287190['attributes']['length']?_0x287190['attributes']:_0x307245[_0xf5cb('0x39')];if(!_0xa52dec[_0xf5cb('0x35')]['hasOwnProperty'](_0xf5cb('0x3c'))){_0x287190[_0xf5cb('0x25')]=qs[_0xf5cb('0x25')](_0xa52dec[_0xf5cb('0x35')][_0xf5cb('0x25')]);_0x287190[_0xf5cb('0x24')]=qs[_0xf5cb('0x24')](_0xa52dec[_0xf5cb('0x35')][_0xf5cb('0x24')]);}_0x287190[_0xf5cb('0x3d')]=qs[_0xf5cb('0x3e')](_0xa52dec['query'][_0xf5cb('0x3e')]);_0x287190[_0xf5cb('0x3f')]=qs[_0xf5cb('0x37')](_[_0xf5cb('0x40')](_0xa52dec['query'],_0x307245[_0xf5cb('0x37')]),_0x334349);if(_0xa52dec['query']['filter']){_0x287190[_0xf5cb('0x3f')]=_[_0xf5cb('0x41')](_0x287190['where'],{'$or':_['map'](_0x334349,function(_0x4ec69d){if(_0x4ec69d[_0xf5cb('0x33')]!==_0xf5cb('0x42')){var _0x419f68={};_0x419f68[_0x4ec69d[_0xf5cb('0x2f')]]={'$like':'%'+_0xa52dec['query'][_0xf5cb('0x43')]+'%'};return _0x419f68;}})});}_0x287190=_[_0xf5cb('0x41')]({},_0x287190,_0xa52dec[_0xf5cb('0x44')]);var _0x501f88={'where':_0x287190[_0xf5cb('0x3f')]};return db[_0xf5cb('0x32')][_0xf5cb('0x26')](_0x501f88)[_0xf5cb('0x2a')](function(_0x1aa259){_0x53c2c9['count']=_0x1aa259;if(_0xa52dec[_0xf5cb('0x35')]['includeAll']){_0x287190[_0xf5cb('0x45')]=[{'all':!![]}];}return db[_0xf5cb('0x32')][_0xf5cb('0x46')](_0x287190);})[_0xf5cb('0x2a')](function(_0x5d6637){_0x53c2c9[_0xf5cb('0x47')]=_0x5d6637;return _0x53c2c9;})[_0xf5cb('0x2a')](respondWithFilteredResult(_0x5203b9,_0x287190))[_0xf5cb('0x48')](handleError(_0x5203b9,null));};exports[_0xf5cb('0x49')]=function(_0x3c83f2,_0x151433){var _0x477fff={'raw':!![],'where':{'id':_0x3c83f2[_0xf5cb('0x4a')]['id']}},_0x1e3f99={};_0x1e3f99['model']=_['keys'](db['OpenchannelQueue'][_0xf5cb('0x4b')]);_0x1e3f99['query']=_[_0xf5cb('0x36')](_0x3c83f2[_0xf5cb('0x35')]);_0x1e3f99[_0xf5cb('0x37')]=_[_0xf5cb('0x38')](_0x1e3f99[_0xf5cb('0x39')],_0x1e3f99[_0xf5cb('0x35')]);_0x477fff[_0xf5cb('0x3a')]=_[_0xf5cb('0x38')](_0x1e3f99[_0xf5cb('0x39')],qs[_0xf5cb('0x3b')](_0x3c83f2[_0xf5cb('0x35')][_0xf5cb('0x3b')]));_0x477fff['attributes']=_0x477fff[_0xf5cb('0x3a')][_0xf5cb('0x4c')]?_0x477fff[_0xf5cb('0x3a')]:_0x1e3f99['model'];if(_0x3c83f2[_0xf5cb('0x35')][_0xf5cb('0x4d')]){_0x477fff[_0xf5cb('0x45')]=[{'all':!![]}];}_0x477fff=_[_0xf5cb('0x41')]({},_0x477fff,_0x3c83f2[_0xf5cb('0x44')]);return db[_0xf5cb('0x32')][_0xf5cb('0x4e')](_0x477fff)[_0xf5cb('0x2a')](handleEntityNotFound(_0x151433,null))['then'](respondWithResult(_0x151433,null))['catch'](handleError(_0x151433,null));};exports['create']=function(_0x3f548b,_0x3c9e60){return db[_0xf5cb('0x32')][_0xf5cb('0x4f')](_0x3f548b['body'],{})[_0xf5cb('0x2a')](function(_0x54f1b8){var _0x1cc11d=_0x3f548b['user'][_0xf5cb('0x50')]({'plain':!![]});if(!_0x1cc11d)throw new Error(_0xf5cb('0x51'));if(_0x1cc11d[_0xf5cb('0x52')]===_0xf5cb('0x53')){var _0x13cf49=_0x54f1b8[_0xf5cb('0x50')]({'plain':!![]});var _0x28db99=_0xf5cb('0x2c');return db['UserProfileSection'][_0xf5cb('0x4e')]({'where':{'name':_0x28db99,'userProfileId':_0x1cc11d['userProfileId']},'raw':!![]})[_0xf5cb('0x2a')](function(_0x48065d){if(_0x48065d&&_0x48065d[_0xf5cb('0x54')]===0x0){return db[_0xf5cb('0x2d')]['create']({'name':_0x13cf49['name'],'resourceId':_0x13cf49['id'],'type':_0x48065d[_0xf5cb('0x2f')],'sectionId':_0x48065d['id']},{})[_0xf5cb('0x2a')](function(){return _0x54f1b8;});}else{return _0x54f1b8;}})[_0xf5cb('0x48')](function(_0x376a08){logger[_0xf5cb('0x2e')](_0xf5cb('0x55'),_0x376a08);throw _0x376a08;});}return _0x54f1b8;})['then'](respondWithResult(_0x3c9e60,0xc9))['catch'](handleError(_0x3c9e60,null));};exports[_0xf5cb('0x56')]=function(_0x35c556,_0x52cfdc){if(_0x35c556[_0xf5cb('0x57')]['id']){delete _0x35c556[_0xf5cb('0x57')]['id'];}return db[_0xf5cb('0x32')][_0xf5cb('0x4e')]({'where':{'id':_0x35c556[_0xf5cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52cfdc,null))[_0xf5cb('0x2a')](saveUpdates(_0x35c556['body'],null))[_0xf5cb('0x2a')](respondWithResult(_0x52cfdc,null))[_0xf5cb('0x48')](handleError(_0x52cfdc,null));};exports[_0xf5cb('0x2b')]=function(_0x5c5ce4,_0x5aa268){return db[_0xf5cb('0x32')][_0xf5cb('0x4e')]({'where':{'id':_0x5c5ce4[_0xf5cb('0x4a')]['id']}})[_0xf5cb('0x2a')](handleEntityNotFound(_0x5aa268,null))['then'](removeEntity(_0x5aa268,null))[_0xf5cb('0x48')](handleError(_0x5aa268,null));};exports[_0xf5cb('0x58')]=function(_0x7ddfc6,_0x77feb7){return db['OpenchannelQueue'][_0xf5cb('0x58')]()[_0xf5cb('0x2a')](respondWithResult(_0x77feb7,null))[_0xf5cb('0x48')](handleError(_0x77feb7,null));};exports[_0xf5cb('0x59')]=function(_0x42cf5d,_0x530934,_0x2319f8){var _0x387ffe={'raw':!![],'where':{}},_0x3a8f1e={},_0x3d2aba;return db[_0xf5cb('0x32')][_0xf5cb('0x5a')]({'where':{'id':_0x42cf5d[_0xf5cb('0x4a')]['id']}})[_0xf5cb('0x2a')](handleEntityNotFound(_0x530934,null))[_0xf5cb('0x2a')](function(_0x454bf3){if(_0x454bf3){_0x3d2aba=_0x454bf3[_0xf5cb('0x50')]({'plain':!![]});_0x3a8f1e[_0xf5cb('0x39')]=_[_0xf5cb('0x36')](db[_0xf5cb('0x5b')][_0xf5cb('0x4b')]);_0x3a8f1e['query']=_['keys'](_0x42cf5d[_0xf5cb('0x35')]);_0x3a8f1e[_0xf5cb('0x37')]=_[_0xf5cb('0x38')](_0x3a8f1e['model'],_0x3a8f1e[_0xf5cb('0x35')]);_0x387ffe[_0xf5cb('0x3a')]=_[_0xf5cb('0x38')](_0x3a8f1e['model'],qs['fields'](_0x42cf5d[_0xf5cb('0x35')][_0xf5cb('0x3b')]));_0x387ffe[_0xf5cb('0x3a')]=_0x387ffe[_0xf5cb('0x3a')][_0xf5cb('0x4c')]?_0x387ffe[_0xf5cb('0x3a')]:_0x3a8f1e[_0xf5cb('0x39')];if(!_0x42cf5d[_0xf5cb('0x35')]['hasOwnProperty'](_0xf5cb('0x3c'))){_0x387ffe[_0xf5cb('0x25')]=qs[_0xf5cb('0x25')](_0x42cf5d[_0xf5cb('0x35')][_0xf5cb('0x25')]);_0x387ffe['offset']=qs['offset'](_0x42cf5d[_0xf5cb('0x35')][_0xf5cb('0x24')]);}_0x387ffe[_0xf5cb('0x3d')]=qs[_0xf5cb('0x3e')](_0x42cf5d['query'][_0xf5cb('0x3e')]);_0x387ffe[_0xf5cb('0x3f')]=qs[_0xf5cb('0x37')](_[_0xf5cb('0x40')](_0x42cf5d[_0xf5cb('0x35')],_0x3a8f1e['filters']));_0x387ffe[_0xf5cb('0x3f')]['OpenchannelQueueId']=_0x454bf3['id'];if(_0x42cf5d[_0xf5cb('0x35')]['filter']){_0x387ffe[_0xf5cb('0x3f')]=_[_0xf5cb('0x41')](_0x387ffe[_0xf5cb('0x3f')],{'$or':_[_0xf5cb('0x34')](_0x387ffe[_0xf5cb('0x3a')],function(_0xd4a8ee){var _0x2562d8={};_0x2562d8[_0xd4a8ee]={'$like':'%'+_0x42cf5d['query'][_0xf5cb('0x43')]+'%'};return _0x2562d8;})});}_0x387ffe=_['merge']({},_0x387ffe,_0x42cf5d['options']);return db[_0xf5cb('0x5b')][_0xf5cb('0x46')](_0x387ffe);}})[_0xf5cb('0x2a')](function(_0x2f33f6){if(_0x2f33f6){return db['User'][_0xf5cb('0x5c')]({'where':{'id':_[_0xf5cb('0x34')](_0x2f33f6,_0xf5cb('0x5d')),'role':_0xf5cb('0x5e')},'attributes':['id',_0xf5cb('0x2f'),_0xf5cb('0x5f'),_0xf5cb('0x60'),_0xf5cb('0x61')]});}})['then'](function(_0x279c6a){if(_0x279c6a){return{'count':_0x279c6a['count'],'rows':_[_0xf5cb('0x34')](_0x279c6a[_0xf5cb('0x47')],function(_0x5bcef6){return{'membername':_0x5bcef6[_0xf5cb('0x2f')],'UserId':_0x5bcef6['id'],'queue_name':_0x3d2aba[_0xf5cb('0x2f')],'OpenchannelQueueId':_0x3d2aba['id'],'interface':util[_0xf5cb('0x62')]('%s/%s',_0xf5cb('0x63'),_0x5bcef6['name']),'penalty':0x0,'paused':_0x5bcef6[_0xf5cb('0x5f')],'createdAt':_0x5bcef6[_0xf5cb('0x61')],'updatedAt':_0x5bcef6[_0xf5cb('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5cb('0x2a')](respondWithFilteredResult(_0x530934,_0x387ffe))[_0xf5cb('0x48')](handleError(_0x530934,null));};exports['getTeams']=function(_0x4797c5,_0x3ba539,_0x27623c){var _0x544615={};var _0x5b467f={};var _0x2adc96;var _0x499536;return db['OpenchannelQueue'][_0xf5cb('0x5a')]({'where':{'id':_0x4797c5['params']['id']}})['then'](handleEntityNotFound(_0x3ba539,null))[_0xf5cb('0x2a')](function(_0x4ac7e6){if(_0x4ac7e6){_0x2adc96=_0x4ac7e6;_0x5b467f[_0xf5cb('0x39')]=_['keys'](db[_0xf5cb('0x64')][_0xf5cb('0x4b')]);_0x5b467f[_0xf5cb('0x35')]=_[_0xf5cb('0x36')](_0x4797c5[_0xf5cb('0x35')]);_0x5b467f['filters']=_[_0xf5cb('0x38')](_0x5b467f[_0xf5cb('0x39')],_0x5b467f['query']);_0x544615[_0xf5cb('0x3a')]=_[_0xf5cb('0x38')](_0x5b467f['model'],qs['fields'](_0x4797c5[_0xf5cb('0x35')][_0xf5cb('0x3b')]));_0x544615[_0xf5cb('0x3a')]=_0x544615[_0xf5cb('0x3a')][_0xf5cb('0x4c')]?_0x544615['attributes']:_0x5b467f[_0xf5cb('0x39')];_0x544615[_0xf5cb('0x3d')]=qs[_0xf5cb('0x3e')](_0x4797c5['query'][_0xf5cb('0x3e')]);_0x544615[_0xf5cb('0x3f')]=qs['filters'](_[_0xf5cb('0x40')](_0x4797c5[_0xf5cb('0x35')],_0x5b467f[_0xf5cb('0x37')]));if(_0x4797c5[_0xf5cb('0x35')]['filter']){_0x544615[_0xf5cb('0x3f')]=_[_0xf5cb('0x41')](_0x544615[_0xf5cb('0x3f')],{'$or':_['map'](_0x544615[_0xf5cb('0x3a')],function(_0x3a2bec){var _0x190f2c={};_0x190f2c[_0x3a2bec]={'$like':'%'+_0x4797c5[_0xf5cb('0x35')]['filter']+'%'};return _0x190f2c;})});}_0x544615=_[_0xf5cb('0x41')]({},_0x544615,_0x4797c5[_0xf5cb('0x44')]);return _0x2adc96[_0xf5cb('0x65')](_0x544615);}})[_0xf5cb('0x2a')](function(_0x5e07d9){if(_0x5e07d9){_0x499536=_0x5e07d9[_0xf5cb('0x4c')];if(!_0x4797c5[_0xf5cb('0x35')][_0xf5cb('0x66')](_0xf5cb('0x3c'))){_0x544615[_0xf5cb('0x25')]=qs['limit'](_0x4797c5[_0xf5cb('0x35')][_0xf5cb('0x25')]);_0x544615[_0xf5cb('0x24')]=qs[_0xf5cb('0x24')](_0x4797c5['query'][_0xf5cb('0x24')]);}return _0x2adc96[_0xf5cb('0x65')](_0x544615);}})[_0xf5cb('0x2a')](function(_0x241621){if(_0x241621){return _0x241621?{'count':_0x499536,'rows':_0x241621}:null;}})['then'](respondWithResult(_0x3ba539,null))[_0xf5cb('0x48')](handleError(_0x3ba539,null));};exports[_0xf5cb('0x67')]=function(_0x4a91aa,_0x15398c,_0x1b9e03){var _0x167f70=_0x4a91aa[_0xf5cb('0x57')][_0xf5cb('0x68')];return db[_0xf5cb('0x64')][_0xf5cb('0x46')]({'where':{'id':_0x167f70},'attributes':['id'],'include':[{'model':db[_0xf5cb('0x69')],'as':_0xf5cb('0x6a'),'attributes':['id','name',_0xf5cb('0x6b'),'voicePause',_0xf5cb('0x6c')],'raw':!![]}]})[_0xf5cb('0x2a')](function(_0xf5e34c){if(_0xf5e34c){var _0x4b81f1=_[_0xf5cb('0x6d')](_0xf5e34c,function(_0x3752aa){var _0x13bcd8=_0x3752aa['get']({'plain':!![]});return _0x13bcd8[_0xf5cb('0x6a')];});return db[_0xf5cb('0x32')]['find']({'where':{'id':_0x4a91aa[_0xf5cb('0x4a')]['id']}})[_0xf5cb('0x2a')](function(_0x11f0d9){return db[_0xf5cb('0x6e')][_0xf5cb('0x6f')](function(_0x50cbaf){return _0x11f0d9[_0xf5cb('0x67')](_0x167f70,{'transaction':_0x50cbaf})[_0xf5cb('0x2a')](function(){return BPromise[_0xf5cb('0x70')](_0x4b81f1,function(_0x5d1dce){return db[_0xf5cb('0x5b')][_0xf5cb('0x71')]({'where':{'UserId':_0x5d1dce['id'],'OpenchannelQueueId':_0x4a91aa[_0xf5cb('0x4a')]['id']},'transaction':_0x50cbaf});});})[_0xf5cb('0x2a')](function(){_0x4b81f1[_0xf5cb('0x72')](function(_0x2e0c8e){socket['emit'](_0xf5cb('0x73'),{'UserId':_0x2e0c8e['id'],'OpenchannelQueueId':_0x11f0d9['id']});});});});});}})[_0xf5cb('0x2a')](respondWithStatusCode(_0x15398c,null))[_0xf5cb('0x48')](handleError(_0x15398c,null));};exports[_0xf5cb('0x74')]=function(_0x1b11dd,_0x417d23,_0x243b1a){return db[_0xf5cb('0x64')][_0xf5cb('0x46')]({'where':{'id':_0x1b11dd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf5cb('0x69')],'as':_0xf5cb('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf5cb('0x2a')](handleEntityNotFound(_0x417d23,null))[_0xf5cb('0x2a')](function(_0x2c1fb9){var _0x5af497=_['map'](_0x2c1fb9,'id');var _0x27aa76=[];var _0xb6da91=[];var _0x1171b4=squel[_0xf5cb('0x75')]();_0x1171b4['field']('tq.TeamId')[_0xf5cb('0x76')](_0xf5cb('0x77'),'tq')[_0xf5cb('0x78')](_0xf5cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5cb('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x1b11dd['params']['id']);for(var _0x1bbcaf=0x0;_0x1bbcaf<_0x2c1fb9[_0xf5cb('0x4c')];_0x1bbcaf+=0x1){let _0x421ff8=_0x2c1fb9[_0x1bbcaf];for(var _0x2be506=0x0;_0x2be506<_0x421ff8[_0xf5cb('0x6a')]['length'];_0x2be506+=0x1){let _0x1c6162=_0x421ff8['Agents'][_0x2be506];var _0x27dc95=_0x1171b4[_0xf5cb('0x7a')]();_0x27dc95[_0xf5cb('0x3f')](_0xf5cb('0x7b'),_0x1c6162['id']);_0xb6da91[_0xf5cb('0x7c')](db[_0xf5cb('0x6e')][_0xf5cb('0x35')](_0x27dc95['toString'](),{'type':db['sequelize'][_0xf5cb('0x7d')][_0xf5cb('0x7e')]})[_0xf5cb('0x2a')](function(_0x130a8b){if(_0x130a8b[_0xf5cb('0x4c')]===0x1){return _0x1c6162['id'];}else{var _0x3f205b=_[_0xf5cb('0x7f')](_[_0xf5cb('0x34')](_0x130a8b,_0xf5cb('0x80')),function(_0x232650){return _[_0xf5cb('0x81')](_0x5af497,_0x232650);});if(_0x3f205b){return _0x1c6162['id'];}}}));}}return BPromise['all'](_0xb6da91)[_0xf5cb('0x2a')](function(_0x4f3cc4){_0x27aa76=_(_0x27aa76)[_0xf5cb('0x82')](_0x4f3cc4)[_0xf5cb('0x83')]()[_0xf5cb('0x84')]();return db[_0xf5cb('0x32')][_0xf5cb('0x4e')]({'where':{'id':_0x1b11dd['params']['id']}})[_0xf5cb('0x2a')](function(_0x469a39){return db[_0xf5cb('0x6e')][_0xf5cb('0x6f')](function(_0xb141b){return _0x469a39[_0xf5cb('0x74')](_0x1b11dd[_0xf5cb('0x35')][_0xf5cb('0x68')],{'transaction':_0xb141b})['then'](function(){if(!_[_0xf5cb('0x85')](_0x27aa76)){return _0x469a39[_0xf5cb('0x86')](_0x27aa76,{'transaction':_0xb141b});}})[_0xf5cb('0x2a')](function(){_0x27aa76[_0xf5cb('0x72')](function(_0x12bdfe){socket[_0xf5cb('0x87')](_0xf5cb('0x88'),{'UserId':_0x12bdfe,'OpenchannelQueueId':_0x469a39['id']});});});});});});})[_0xf5cb('0x2a')](respondWithStatusCode(_0x417d23,null))[_0xf5cb('0x48')](handleError(_0x417d23,null));};exports['addAgents']=function(_0x5d1732,_0x4e9050,_0x42b77c){return db[_0xf5cb('0x32')][_0xf5cb('0x4e')]({'where':{'id':_0x5d1732[_0xf5cb('0x4a')]['id']}})[_0xf5cb('0x2a')](handleEntityNotFound(_0x4e9050,null))[_0xf5cb('0x2a')](function(_0x5ecc7d){if(_0x5ecc7d){return _0x5ecc7d[_0xf5cb('0x89')](_0x5d1732[_0xf5cb('0x57')][_0xf5cb('0x68')],_['omit'](_0x5d1732[_0xf5cb('0x57')],[_0xf5cb('0x68'),'id'])||{})[_0xf5cb('0x8a')](function(_0x41326b){for(var _0xcf0035=0x0;_0xcf0035<_0x5d1732[_0xf5cb('0x57')][_0xf5cb('0x68')][_0xf5cb('0x4c')];_0xcf0035+=0x1){socket[_0xf5cb('0x87')](_0xf5cb('0x73'),{'UserId':Number(_0x5d1732['body'][_0xf5cb('0x68')][_0xcf0035]),'OpenchannelQueueId':Number(_0x5d1732[_0xf5cb('0x4a')]['id'])});}return _0x41326b;});}})[_0xf5cb('0x2a')](respondWithResult(_0x4e9050,null))[_0xf5cb('0x48')](handleError(_0x4e9050,null));};exports[_0xf5cb('0x86')]=function(_0x5d6d71,_0xce7652,_0x1822cf){return db[_0xf5cb('0x32')][_0xf5cb('0x4e')]({'where':{'id':_0x5d6d71[_0xf5cb('0x4a')]['id']}})[_0xf5cb('0x2a')](handleEntityNotFound(_0xce7652,null))[_0xf5cb('0x2a')](function(_0x28b17b){if(_0x28b17b){return _0x28b17b[_0xf5cb('0x86')](_0x5d6d71['query'][_0xf5cb('0x68')])[_0xf5cb('0x2a')](function(){if(_[_0xf5cb('0x8b')](_0x5d6d71['query'][_0xf5cb('0x68')])){for(var _0x47b9a9=0x0;_0x47b9a9<_0x5d6d71['query'][_0xf5cb('0x68')]['length'];_0x47b9a9+=0x1){socket[_0xf5cb('0x87')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5d6d71[_0xf5cb('0x35')][_0xf5cb('0x68')][_0x47b9a9]),'OpenchannelQueueId':Number(_0x5d6d71['params']['id'])});}}else{socket[_0xf5cb('0x87')](_0xf5cb('0x88'),{'UserId':Number(_0x5d6d71[_0xf5cb('0x35')]['ids']),'OpenchannelQueueId':Number(_0x5d6d71[_0xf5cb('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0xce7652,null))[_0xf5cb('0x48')](handleError(_0xce7652,null));};exports['getAgents']=function(_0x19208e,_0x1347cf,_0x34ae82){var _0x2855be={};var _0x277e36={};var _0x38ace2;var _0x5be04b;return db[_0xf5cb('0x32')][_0xf5cb('0x5a')]({'where':{'id':_0x19208e[_0xf5cb('0x4a')]['id']}})[_0xf5cb('0x2a')](handleEntityNotFound(_0x1347cf,null))[_0xf5cb('0x2a')](function(_0x4cd243){if(_0x4cd243){_0x38ace2=_0x4cd243;_0x277e36[_0xf5cb('0x39')]=_[_0xf5cb('0x36')](db[_0xf5cb('0x69')][_0xf5cb('0x4b')]);_0x277e36['query']=_[_0xf5cb('0x36')](_0x19208e[_0xf5cb('0x35')]);_0x277e36[_0xf5cb('0x37')]=_[_0xf5cb('0x38')](_0x277e36['model'],_0x277e36['query']);_0x2855be[_0xf5cb('0x3a')]=_[_0xf5cb('0x38')](_0x277e36[_0xf5cb('0x39')],qs[_0xf5cb('0x3b')](_0x19208e[_0xf5cb('0x35')]['fields']));_0x2855be[_0xf5cb('0x3a')]=_0x2855be[_0xf5cb('0x3a')][_0xf5cb('0x4c')]?_0x2855be['attributes']:_0x277e36[_0xf5cb('0x39')];_0x2855be['order']=qs[_0xf5cb('0x3e')](_0x19208e[_0xf5cb('0x35')]['sort']);_0x2855be[_0xf5cb('0x3f')]=qs[_0xf5cb('0x37')](_[_0xf5cb('0x40')](_0x19208e[_0xf5cb('0x35')],_0x277e36[_0xf5cb('0x37')]));if(_0x19208e['query']['filter']){_0x2855be[_0xf5cb('0x3f')]=_[_0xf5cb('0x41')](_0x2855be[_0xf5cb('0x3f')],{'$or':_[_0xf5cb('0x34')](_0x2855be[_0xf5cb('0x3a')],function(_0x2973d0){var _0x5292f4={};_0x5292f4[_0x2973d0]={'$like':'%'+_0x19208e[_0xf5cb('0x35')]['filter']+'%'};return _0x5292f4;})});}_0x2855be=_['merge']({},_0x2855be,_0x19208e[_0xf5cb('0x44')]);return _0x38ace2[_0xf5cb('0x8c')](_0x2855be);}})[_0xf5cb('0x2a')](function(_0x507b1c){if(_0x507b1c){_0x5be04b=_0x507b1c[_0xf5cb('0x4c')];if(!_0x19208e[_0xf5cb('0x35')][_0xf5cb('0x66')](_0xf5cb('0x3c'))){_0x2855be[_0xf5cb('0x25')]=qs[_0xf5cb('0x25')](_0x19208e[_0xf5cb('0x35')]['limit']);_0x2855be[_0xf5cb('0x24')]=qs[_0xf5cb('0x24')](_0x19208e['query'][_0xf5cb('0x24')]);}return _0x38ace2['getAgents'](_0x2855be);}})['then'](function(_0x439991){if(_0x439991){return _0x439991?{'count':_0x5be04b,'rows':_0x439991}:null;}})[_0xf5cb('0x2a')](respondWithResult(_0x1347cf,null))['catch'](handleError(_0x1347cf,null));};
\ No newline at end of file
+var _0xc740=['userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','addTeams','Agents','online','interface','flatMap','transaction','each','forEach','removeTeams','Team','select','field','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','union','ids','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','offset','undefined','count','set','Content-Range','reject','update','then','destroy','end','stack','name','index','OpenchannelQueue','rawAttributes','type','key','model','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','options','includeAll','findAll','catch','keys','intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection'];(function(_0x11832c,_0x433277){var _0x38b8c8=function(_0x50a881){while(--_0x50a881){_0x11832c['push'](_0x11832c['shift']());}};_0x38b8c8(++_0x433277);}(_0xc740,0xbf));var _0x0c74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc740[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x0c74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c74('0x1'));var jsonpatch=require(_0x0c74('0x2'));var rp=require(_0x0c74('0x3'));var moment=require(_0x0c74('0x4'));var BPromise=require(_0x0c74('0x5'));var Mustache=require(_0x0c74('0x6'));var util=require(_0x0c74('0x7'));var path=require(_0x0c74('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c74('0x9'));var fs=require('fs');var fs_extra=require(_0x0c74('0xa'));var _=require(_0x0c74('0xb'));var squel=require(_0x0c74('0xc'));var crypto=require(_0x0c74('0xd'));var jsforce=require(_0x0c74('0xe'));var deskjs=require(_0x0c74('0xf'));var toCsv=require(_0x0c74('0x10'));var querystring=require('querystring');var Papa=require(_0x0c74('0x11'));var Redis=require(_0x0c74('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c74('0x13'));var as=require(_0x0c74('0x14'));var hardwareService=require(_0x0c74('0x15'));var logger=require(_0x0c74('0x16'))(_0x0c74('0x17'));var utils=require(_0x0c74('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0c74('0x19'));var db=require(_0x0c74('0x1a'))['db'];config['redis']=_[_0x0c74('0x1b')](config[_0x0c74('0x1c')],{'host':_0x0c74('0x1d'),'port':0x18eb});var socket=require(_0x0c74('0x1e'))(new Redis(config[_0x0c74('0x1c')]));require(_0x0c74('0x1f'))[_0x0c74('0x20')](socket);function respondWithStatusCode(_0x23fe53,_0x3166f7){_0x3166f7=_0x3166f7||0xcc;return function(_0x29e2c0){if(_0x29e2c0){return _0x23fe53[_0x0c74('0x21')](_0x3166f7);}return _0x23fe53[_0x0c74('0x22')](_0x3166f7)['end']();};}function respondWithResult(_0x28a8e5,_0x4ce47a){_0x4ce47a=_0x4ce47a||0xc8;return function(_0x2d7a3b){if(_0x2d7a3b){return _0x28a8e5[_0x0c74('0x22')](_0x4ce47a)['json'](_0x2d7a3b);}};}function respondWithFilteredResult(_0x3a0e5a,_0x31d1dd){return function(_0x411b5f){if(_0x411b5f){var _0x449e50=typeof _0x31d1dd[_0x0c74('0x23')]===_0x0c74('0x24')&&typeof _0x31d1dd['limit']===_0x0c74('0x24');var _0x24768c=_0x411b5f[_0x0c74('0x25')];var _0x4ec762=_0x449e50?0x0:_0x31d1dd[_0x0c74('0x23')];var _0x13938c=_0x449e50?_0x411b5f['count']:_0x31d1dd[_0x0c74('0x23')]+_0x31d1dd['limit'];var _0x310a75;if(_0x13938c>=_0x24768c){_0x13938c=_0x24768c;_0x310a75=0xc8;}else{_0x310a75=0xce;}_0x3a0e5a[_0x0c74('0x22')](_0x310a75);return _0x3a0e5a[_0x0c74('0x26')](_0x0c74('0x27'),_0x4ec762+'-'+_0x13938c+'/'+_0x24768c)['json'](_0x411b5f);}return null;};}function patchUpdates(_0x423aaa){return function(_0x5a350d){try{jsonpatch['apply'](_0x5a350d,_0x423aaa,!![]);}catch(_0x50a722){return BPromise[_0x0c74('0x28')](_0x50a722);}return _0x5a350d['save']();};}function saveUpdates(_0x5d85fb,_0x2a6620){return function(_0x5741ce){if(_0x5741ce){return _0x5741ce[_0x0c74('0x29')](_0x5d85fb)[_0x0c74('0x2a')](function(_0xabcfd){return _0xabcfd;});}return null;};}function removeEntity(_0x236979,_0x531304){return function(_0x12053f){if(_0x12053f){return _0x12053f[_0x0c74('0x2b')]()[_0x0c74('0x2a')](function(){var _0x4992e6=_0x12053f['get']({'plain':!![]});var _0x3a051c='OpenchannelQueues';return db['UserProfileResource'][_0x0c74('0x2b')]({'where':{'type':_0x3a051c,'resourceId':_0x4992e6['id']}})['then'](function(){return _0x12053f;});})[_0x0c74('0x2a')](function(){_0x236979['status'](0xcc)[_0x0c74('0x2c')]();});}};}function handleEntityNotFound(_0x2e7c8b,_0x2d4942){return function(_0x3af450){if(!_0x3af450){_0x2e7c8b[_0x0c74('0x21')](0x194);}return _0x3af450;};}function handleError(_0x43107c,_0x54f3f8){_0x54f3f8=_0x54f3f8||0x1f4;return function(_0x37de83){logger['error'](_0x37de83[_0x0c74('0x2d')]);if(_0x37de83[_0x0c74('0x2e')]){delete _0x37de83['name'];}_0x43107c[_0x0c74('0x22')](_0x54f3f8)['send'](_0x37de83);};}exports[_0x0c74('0x2f')]=function(_0x44d738,_0x107ad2){var _0x2f1eca={},_0x2b0e05={},_0x5bf72e={'count':0x0,'rows':[]};var _0x2719c7=_['map'](db[_0x0c74('0x30')][_0x0c74('0x31')],function(_0x46cb2e){return{'name':_0x46cb2e['fieldName'],'type':_0x46cb2e[_0x0c74('0x32')][_0x0c74('0x33')]};});_0x2b0e05['model']=_['map'](_0x2719c7,'name');_0x2b0e05['query']=_['keys'](_0x44d738['query']);_0x2b0e05['filters']=_['intersection'](_0x2b0e05[_0x0c74('0x34')],_0x2b0e05[_0x0c74('0x35')]);_0x2f1eca['attributes']=_['intersection'](_0x2b0e05[_0x0c74('0x34')],qs['fields'](_0x44d738['query'][_0x0c74('0x36')]));_0x2f1eca[_0x0c74('0x37')]=_0x2f1eca[_0x0c74('0x37')]['length']?_0x2f1eca[_0x0c74('0x37')]:_0x2b0e05[_0x0c74('0x34')];if(!_0x44d738[_0x0c74('0x35')][_0x0c74('0x38')](_0x0c74('0x39'))){_0x2f1eca[_0x0c74('0x3a')]=qs['limit'](_0x44d738[_0x0c74('0x35')][_0x0c74('0x3a')]);_0x2f1eca[_0x0c74('0x23')]=qs[_0x0c74('0x23')](_0x44d738[_0x0c74('0x35')]['offset']);}_0x2f1eca[_0x0c74('0x3b')]=qs[_0x0c74('0x3c')](_0x44d738['query'][_0x0c74('0x3c')]);_0x2f1eca[_0x0c74('0x3d')]=qs[_0x0c74('0x3e')](_[_0x0c74('0x3f')](_0x44d738[_0x0c74('0x35')],_0x2b0e05[_0x0c74('0x3e')]),_0x2719c7);if(_0x44d738['query']['filter']){_0x2f1eca[_0x0c74('0x3d')]=_[_0x0c74('0x40')](_0x2f1eca[_0x0c74('0x3d')],{'$or':_[_0x0c74('0x41')](_0x2719c7,function(_0x590331){if(_0x590331[_0x0c74('0x32')]!==_0x0c74('0x42')){var _0x439c9a={};_0x439c9a[_0x590331[_0x0c74('0x2e')]]={'$like':'%'+_0x44d738[_0x0c74('0x35')]['filter']+'%'};return _0x439c9a;}})});}_0x2f1eca=_[_0x0c74('0x40')]({},_0x2f1eca,_0x44d738[_0x0c74('0x43')]);var _0x796e4e={'where':_0x2f1eca['where']};return db[_0x0c74('0x30')][_0x0c74('0x25')](_0x796e4e)[_0x0c74('0x2a')](function(_0x1be858){_0x5bf72e['count']=_0x1be858;if(_0x44d738[_0x0c74('0x35')][_0x0c74('0x44')]){_0x2f1eca['include']=[{'all':!![]}];}return db[_0x0c74('0x30')][_0x0c74('0x45')](_0x2f1eca);})[_0x0c74('0x2a')](function(_0x26d1b6){_0x5bf72e['rows']=_0x26d1b6;return _0x5bf72e;})[_0x0c74('0x2a')](respondWithFilteredResult(_0x107ad2,_0x2f1eca))[_0x0c74('0x46')](handleError(_0x107ad2,null));};exports['show']=function(_0x88a410,_0x3430b3){var _0xe3aa43={'raw':!![],'where':{'id':_0x88a410['params']['id']}},_0x156b81={};_0x156b81[_0x0c74('0x34')]=_[_0x0c74('0x47')](db[_0x0c74('0x30')][_0x0c74('0x31')]);_0x156b81[_0x0c74('0x35')]=_[_0x0c74('0x47')](_0x88a410[_0x0c74('0x35')]);_0x156b81[_0x0c74('0x3e')]=_[_0x0c74('0x48')](_0x156b81[_0x0c74('0x34')],_0x156b81['query']);_0xe3aa43['attributes']=_[_0x0c74('0x48')](_0x156b81[_0x0c74('0x34')],qs['fields'](_0x88a410['query'][_0x0c74('0x36')]));_0xe3aa43[_0x0c74('0x37')]=_0xe3aa43[_0x0c74('0x37')][_0x0c74('0x49')]?_0xe3aa43[_0x0c74('0x37')]:_0x156b81[_0x0c74('0x34')];if(_0x88a410['query']['includeAll']){_0xe3aa43['include']=[{'all':!![]}];}_0xe3aa43=_['merge']({},_0xe3aa43,_0x88a410[_0x0c74('0x43')]);return db[_0x0c74('0x30')][_0x0c74('0x4a')](_0xe3aa43)[_0x0c74('0x2a')](handleEntityNotFound(_0x3430b3,null))[_0x0c74('0x2a')](respondWithResult(_0x3430b3,null))[_0x0c74('0x46')](handleError(_0x3430b3,null));};exports[_0x0c74('0x4b')]=function(_0x2cc7cf,_0x1acd45){return db[_0x0c74('0x30')][_0x0c74('0x4b')](_0x2cc7cf[_0x0c74('0x4c')],{})['then'](function(_0x3ba779){var _0xcdce05=_0x2cc7cf[_0x0c74('0x4d')][_0x0c74('0x4e')]({'plain':!![]});if(!_0xcdce05)throw new Error(_0x0c74('0x4f'));if(_0xcdce05[_0x0c74('0x50')]===_0x0c74('0x4d')){var _0xaf576c=_0x3ba779[_0x0c74('0x4e')]({'plain':!![]});var _0x140a62=_0x0c74('0x51');return db[_0x0c74('0x52')]['find']({'where':{'name':_0x140a62,'userProfileId':_0xcdce05[_0x0c74('0x53')]},'raw':!![]})['then'](function(_0x40f583){if(_0x40f583&&_0x40f583['autoAssociation']===0x0){return db[_0x0c74('0x54')][_0x0c74('0x4b')]({'name':_0xaf576c[_0x0c74('0x2e')],'resourceId':_0xaf576c['id'],'type':_0x40f583[_0x0c74('0x2e')],'sectionId':_0x40f583['id']},{})[_0x0c74('0x2a')](function(){return _0x3ba779;});}else{return _0x3ba779;}})[_0x0c74('0x46')](function(_0x130427){logger[_0x0c74('0x55')](_0x0c74('0x56'),_0x130427);throw _0x130427;});}return _0x3ba779;})[_0x0c74('0x2a')](respondWithResult(_0x1acd45,0xc9))[_0x0c74('0x46')](handleError(_0x1acd45,null));};exports[_0x0c74('0x29')]=function(_0x3950ec,_0x2d9cb1){if(_0x3950ec[_0x0c74('0x4c')]['id']){delete _0x3950ec[_0x0c74('0x4c')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x3950ec[_0x0c74('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d9cb1,null))[_0x0c74('0x2a')](saveUpdates(_0x3950ec[_0x0c74('0x4c')],null))['then'](respondWithResult(_0x2d9cb1,null))['catch'](handleError(_0x2d9cb1,null));};exports['destroy']=function(_0x479f70,_0x138fd9){return db[_0x0c74('0x30')]['find']({'where':{'id':_0x479f70[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](handleEntityNotFound(_0x138fd9,null))['then'](removeEntity(_0x138fd9,null))[_0x0c74('0x46')](handleError(_0x138fd9,null));};exports['describe']=function(_0x2f9def,_0x46c8c5){return db['OpenchannelQueue'][_0x0c74('0x58')]()['then'](respondWithResult(_0x46c8c5,null))[_0x0c74('0x46')](handleError(_0x46c8c5,null));};exports[_0x0c74('0x59')]=function(_0x2633ef,_0x201fc7,_0xe47ba8){var _0x511f4c={'raw':!![],'where':{}},_0x83a792={},_0x9be6b8;return db['OpenchannelQueue'][_0x0c74('0x5a')]({'where':{'id':_0x2633ef[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](handleEntityNotFound(_0x201fc7,null))[_0x0c74('0x2a')](function(_0x35bf61){if(_0x35bf61){_0x9be6b8=_0x35bf61[_0x0c74('0x4e')]({'plain':!![]});_0x83a792[_0x0c74('0x34')]=_['keys'](db[_0x0c74('0x5b')][_0x0c74('0x31')]);_0x83a792['query']=_[_0x0c74('0x47')](_0x2633ef[_0x0c74('0x35')]);_0x83a792[_0x0c74('0x3e')]=_[_0x0c74('0x48')](_0x83a792[_0x0c74('0x34')],_0x83a792[_0x0c74('0x35')]);_0x511f4c[_0x0c74('0x37')]=_[_0x0c74('0x48')](_0x83a792[_0x0c74('0x34')],qs[_0x0c74('0x36')](_0x2633ef[_0x0c74('0x35')][_0x0c74('0x36')]));_0x511f4c[_0x0c74('0x37')]=_0x511f4c['attributes'][_0x0c74('0x49')]?_0x511f4c[_0x0c74('0x37')]:_0x83a792[_0x0c74('0x34')];if(!_0x2633ef[_0x0c74('0x35')][_0x0c74('0x38')](_0x0c74('0x39'))){_0x511f4c[_0x0c74('0x3a')]=qs[_0x0c74('0x3a')](_0x2633ef[_0x0c74('0x35')]['limit']);_0x511f4c[_0x0c74('0x23')]=qs[_0x0c74('0x23')](_0x2633ef[_0x0c74('0x35')]['offset']);}_0x511f4c['order']=qs[_0x0c74('0x3c')](_0x2633ef['query']['sort']);_0x511f4c['where']=qs[_0x0c74('0x3e')](_[_0x0c74('0x3f')](_0x2633ef[_0x0c74('0x35')],_0x83a792[_0x0c74('0x3e')]));_0x511f4c['where']['OpenchannelQueueId']=_0x35bf61['id'];if(_0x2633ef['query'][_0x0c74('0x5c')]){_0x511f4c[_0x0c74('0x3d')]=_[_0x0c74('0x40')](_0x511f4c[_0x0c74('0x3d')],{'$or':_['map'](_0x511f4c[_0x0c74('0x37')],function(_0xd99f6a){var _0x4aa1e2={};_0x4aa1e2[_0xd99f6a]={'$like':'%'+_0x2633ef[_0x0c74('0x35')][_0x0c74('0x5c')]+'%'};return _0x4aa1e2;})});}_0x511f4c=_['merge']({},_0x511f4c,_0x2633ef['options']);return db[_0x0c74('0x5b')][_0x0c74('0x45')](_0x511f4c);}})[_0x0c74('0x2a')](function(_0x5a5e79){if(_0x5a5e79){return db[_0x0c74('0x5d')][_0x0c74('0x5e')]({'where':{'id':_['map'](_0x5a5e79,_0x0c74('0x5f')),'role':_0x0c74('0x60')},'attributes':['id','name','openchannelPause',_0x0c74('0x61'),_0x0c74('0x62')]});}})[_0x0c74('0x2a')](function(_0x47425c){if(_0x47425c){return{'count':_0x47425c[_0x0c74('0x25')],'rows':_[_0x0c74('0x41')](_0x47425c[_0x0c74('0x63')],function(_0x89af37){return{'membername':_0x89af37[_0x0c74('0x2e')],'UserId':_0x89af37['id'],'queue_name':_0x9be6b8[_0x0c74('0x2e')],'OpenchannelQueueId':_0x9be6b8['id'],'interface':util['format'](_0x0c74('0x64'),_0x0c74('0x65'),_0x89af37['name']),'penalty':0x0,'paused':_0x89af37['openchannelPause'],'createdAt':_0x89af37[_0x0c74('0x62')],'updatedAt':_0x89af37['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x201fc7,_0x511f4c))['catch'](handleError(_0x201fc7,null));};exports[_0x0c74('0x66')]=function(_0x3c5866,_0x209607,_0x46037e){var _0x3f4163={};var _0xfef4a={};var _0x1c5034;var _0x5358e9;return db[_0x0c74('0x30')]['findOne']({'where':{'id':_0x3c5866[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](handleEntityNotFound(_0x209607,null))[_0x0c74('0x2a')](function(_0x39a604){if(_0x39a604){_0x1c5034=_0x39a604;_0xfef4a['model']=_[_0x0c74('0x47')](db['Team']['rawAttributes']);_0xfef4a[_0x0c74('0x35')]=_['keys'](_0x3c5866[_0x0c74('0x35')]);_0xfef4a[_0x0c74('0x3e')]=_[_0x0c74('0x48')](_0xfef4a[_0x0c74('0x34')],_0xfef4a['query']);_0x3f4163['attributes']=_['intersection'](_0xfef4a[_0x0c74('0x34')],qs['fields'](_0x3c5866[_0x0c74('0x35')][_0x0c74('0x36')]));_0x3f4163[_0x0c74('0x37')]=_0x3f4163['attributes'][_0x0c74('0x49')]?_0x3f4163[_0x0c74('0x37')]:_0xfef4a['model'];_0x3f4163['order']=qs[_0x0c74('0x3c')](_0x3c5866[_0x0c74('0x35')]['sort']);_0x3f4163[_0x0c74('0x3d')]=qs[_0x0c74('0x3e')](_[_0x0c74('0x3f')](_0x3c5866[_0x0c74('0x35')],_0xfef4a[_0x0c74('0x3e')]));if(_0x3c5866[_0x0c74('0x35')]['filter']){_0x3f4163[_0x0c74('0x3d')]=_[_0x0c74('0x40')](_0x3f4163['where'],{'$or':_[_0x0c74('0x41')](_0x3f4163[_0x0c74('0x37')],function(_0x51e68a){var _0x584fe2={};_0x584fe2[_0x51e68a]={'$like':'%'+_0x3c5866[_0x0c74('0x35')][_0x0c74('0x5c')]+'%'};return _0x584fe2;})});}_0x3f4163=_[_0x0c74('0x40')]({},_0x3f4163,_0x3c5866[_0x0c74('0x43')]);return _0x1c5034[_0x0c74('0x66')](_0x3f4163);}})[_0x0c74('0x2a')](function(_0x582da5){if(_0x582da5){_0x5358e9=_0x582da5[_0x0c74('0x49')];if(!_0x3c5866['query'][_0x0c74('0x38')](_0x0c74('0x39'))){_0x3f4163[_0x0c74('0x3a')]=qs[_0x0c74('0x3a')](_0x3c5866[_0x0c74('0x35')][_0x0c74('0x3a')]);_0x3f4163[_0x0c74('0x23')]=qs[_0x0c74('0x23')](_0x3c5866[_0x0c74('0x35')][_0x0c74('0x23')]);}return _0x1c5034[_0x0c74('0x66')](_0x3f4163);}})[_0x0c74('0x2a')](function(_0x229c77){if(_0x229c77){return _0x229c77?{'count':_0x5358e9,'rows':_0x229c77}:null;}})[_0x0c74('0x2a')](respondWithResult(_0x209607,null))[_0x0c74('0x46')](handleError(_0x209607,null));};exports[_0x0c74('0x67')]=function(_0x3124cf,_0x239345,_0x3fba22){var _0x5abe71=_0x3124cf[_0x0c74('0x4c')]['ids'];return db['Team'][_0x0c74('0x45')]({'where':{'id':_0x5abe71},'attributes':['id'],'include':[{'model':db[_0x0c74('0x5d')],'as':_0x0c74('0x68'),'attributes':['id','name',_0x0c74('0x69'),'voicePause',_0x0c74('0x6a')],'raw':!![]}]})[_0x0c74('0x2a')](function(_0x3ce14d){if(_0x3ce14d){var _0x260f95=_[_0x0c74('0x6b')](_0x3ce14d,function(_0xc317ea){var _0x4c4f34=_0xc317ea[_0x0c74('0x4e')]({'plain':!![]});return _0x4c4f34[_0x0c74('0x68')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x3124cf[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](function(_0x114133){return db['sequelize'][_0x0c74('0x6c')](function(_0x40e3ff){return _0x114133[_0x0c74('0x67')](_0x5abe71,{'transaction':_0x40e3ff})[_0x0c74('0x2a')](function(){return BPromise[_0x0c74('0x6d')](_0x260f95,function(_0xcbe522){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0xcbe522['id'],'OpenchannelQueueId':_0x3124cf[_0x0c74('0x57')]['id']},'transaction':_0x40e3ff});});})[_0x0c74('0x2a')](function(){_0x260f95[_0x0c74('0x6e')](function(_0x5db687){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x5db687['id'],'OpenchannelQueueId':_0x114133['id']});});});});});}})[_0x0c74('0x2a')](respondWithStatusCode(_0x239345,null))[_0x0c74('0x46')](handleError(_0x239345,null));};exports[_0x0c74('0x6f')]=function(_0x26d01e,_0x257673,_0x4ebf5f){return db[_0x0c74('0x70')][_0x0c74('0x45')]({'where':{'id':_0x26d01e[_0x0c74('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0c74('0x5d')],'as':_0x0c74('0x68'),'attributes':['id'],'raw':!![]}]})[_0x0c74('0x2a')](handleEntityNotFound(_0x257673,null))[_0x0c74('0x2a')](function(_0x422d4c){var _0x2d8354=_[_0x0c74('0x41')](_0x422d4c,'id');var _0x2f60a7=[];var _0x5117bb=[];var _0x486e3b=squel[_0x0c74('0x71')]();_0x486e3b[_0x0c74('0x72')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0x0c74('0x73'))[_0x0c74('0x3d')](_0x0c74('0x74'),_0x26d01e[_0x0c74('0x57')]['id']);for(var _0x3573d6=0x0;_0x3573d6<_0x422d4c[_0x0c74('0x49')];_0x3573d6+=0x1){let _0x39b271=_0x422d4c[_0x3573d6];for(var _0x5d519f=0x0;_0x5d519f<_0x39b271[_0x0c74('0x68')][_0x0c74('0x49')];_0x5d519f+=0x1){let _0xe0320a=_0x39b271['Agents'][_0x5d519f];var _0xa3f128=_0x486e3b[_0x0c74('0x75')]();_0xa3f128[_0x0c74('0x3d')](_0x0c74('0x76'),_0xe0320a['id']);_0x5117bb[_0x0c74('0x77')](db['sequelize']['query'](_0xa3f128[_0x0c74('0x78')](),{'type':db[_0x0c74('0x79')][_0x0c74('0x7a')]['SELECT']})['then'](function(_0x409c19){if(_0x409c19[_0x0c74('0x49')]===0x1){return _0xe0320a['id'];}else{var _0x439668=_[_0x0c74('0x7b')](_['map'](_0x409c19,_0x0c74('0x7c')),function(_0x58d25f){return _['includes'](_0x2d8354,_0x58d25f);});if(_0x439668){return _0xe0320a['id'];}}}));}}return BPromise['all'](_0x5117bb)[_0x0c74('0x2a')](function(_0x336a20){_0x2f60a7=_(_0x2f60a7)[_0x0c74('0x7d')](_0x336a20)['compact']()['value']();return db[_0x0c74('0x30')][_0x0c74('0x4a')]({'where':{'id':_0x26d01e[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](function(_0x2f6578){return db[_0x0c74('0x79')][_0x0c74('0x6c')](function(_0x37df1a){return _0x2f6578[_0x0c74('0x6f')](_0x26d01e[_0x0c74('0x35')][_0x0c74('0x7e')],{'transaction':_0x37df1a})[_0x0c74('0x2a')](function(){if(!_[_0x0c74('0x7f')](_0x2f60a7)){return _0x2f6578[_0x0c74('0x80')](_0x2f60a7,{'transaction':_0x37df1a});}})[_0x0c74('0x2a')](function(){_0x2f60a7[_0x0c74('0x6e')](function(_0x4e3d87){socket[_0x0c74('0x81')](_0x0c74('0x82'),{'UserId':_0x4e3d87,'OpenchannelQueueId':_0x2f6578['id']});});});});});});})[_0x0c74('0x2a')](respondWithStatusCode(_0x257673,null))['catch'](handleError(_0x257673,null));};exports[_0x0c74('0x83')]=function(_0x5e3212,_0x4e52cd,_0x334610){return db[_0x0c74('0x30')][_0x0c74('0x4a')]({'where':{'id':_0x5e3212[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](handleEntityNotFound(_0x4e52cd,null))['then'](function(_0xe1b4a9){if(_0xe1b4a9){return _0xe1b4a9['addAgents'](_0x5e3212[_0x0c74('0x4c')][_0x0c74('0x7e')],_[_0x0c74('0x84')](_0x5e3212['body'],[_0x0c74('0x7e'),'id'])||{})[_0x0c74('0x85')](function(_0xea1b11){for(var _0x4cd6d8=0x0;_0x4cd6d8<_0x5e3212[_0x0c74('0x4c')][_0x0c74('0x7e')][_0x0c74('0x49')];_0x4cd6d8+=0x1){socket[_0x0c74('0x81')](_0x0c74('0x86'),{'UserId':Number(_0x5e3212[_0x0c74('0x4c')][_0x0c74('0x7e')][_0x4cd6d8]),'OpenchannelQueueId':Number(_0x5e3212[_0x0c74('0x57')]['id'])});}return _0xea1b11;});}})[_0x0c74('0x2a')](respondWithResult(_0x4e52cd,null))[_0x0c74('0x46')](handleError(_0x4e52cd,null));};exports['removeAgents']=function(_0x2c378e,_0x1b4674,_0x4da359){return db[_0x0c74('0x30')][_0x0c74('0x4a')]({'where':{'id':_0x2c378e[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](handleEntityNotFound(_0x1b4674,null))[_0x0c74('0x2a')](function(_0x3dc814){if(_0x3dc814){return _0x3dc814[_0x0c74('0x80')](_0x2c378e[_0x0c74('0x35')][_0x0c74('0x7e')])[_0x0c74('0x2a')](function(){if(_[_0x0c74('0x87')](_0x2c378e[_0x0c74('0x35')]['ids'])){for(var _0x3e35bd=0x0;_0x3e35bd<_0x2c378e[_0x0c74('0x35')][_0x0c74('0x7e')][_0x0c74('0x49')];_0x3e35bd+=0x1){socket[_0x0c74('0x81')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2c378e[_0x0c74('0x35')]['ids'][_0x3e35bd]),'OpenchannelQueueId':Number(_0x2c378e[_0x0c74('0x57')]['id'])});}}else{socket[_0x0c74('0x81')](_0x0c74('0x82'),{'UserId':Number(_0x2c378e['query'][_0x0c74('0x7e')]),'OpenchannelQueueId':Number(_0x2c378e[_0x0c74('0x57')]['id'])});}});}})[_0x0c74('0x2a')](respondWithStatusCode(_0x1b4674,null))['catch'](handleError(_0x1b4674,null));};exports[_0x0c74('0x88')]=function(_0x5ec825,_0x53bff7,_0x51bd4f){var _0x2ae67b={};var _0x4ef9dc={};var _0x4ab381;var _0x3b2d01;return db['OpenchannelQueue'][_0x0c74('0x5a')]({'where':{'id':_0x5ec825[_0x0c74('0x57')]['id']}})[_0x0c74('0x2a')](handleEntityNotFound(_0x53bff7,null))[_0x0c74('0x2a')](function(_0xf78ae5){if(_0xf78ae5){_0x4ab381=_0xf78ae5;_0x4ef9dc[_0x0c74('0x34')]=_[_0x0c74('0x47')](db[_0x0c74('0x5d')]['rawAttributes']);_0x4ef9dc[_0x0c74('0x35')]=_[_0x0c74('0x47')](_0x5ec825[_0x0c74('0x35')]);_0x4ef9dc[_0x0c74('0x3e')]=_[_0x0c74('0x48')](_0x4ef9dc['model'],_0x4ef9dc[_0x0c74('0x35')]);_0x2ae67b[_0x0c74('0x37')]=_['intersection'](_0x4ef9dc[_0x0c74('0x34')],qs[_0x0c74('0x36')](_0x5ec825[_0x0c74('0x35')][_0x0c74('0x36')]));_0x2ae67b[_0x0c74('0x37')]=_0x2ae67b['attributes']['length']?_0x2ae67b[_0x0c74('0x37')]:_0x4ef9dc[_0x0c74('0x34')];_0x2ae67b[_0x0c74('0x3b')]=qs['sort'](_0x5ec825[_0x0c74('0x35')][_0x0c74('0x3c')]);_0x2ae67b['where']=qs['filters'](_[_0x0c74('0x3f')](_0x5ec825[_0x0c74('0x35')],_0x4ef9dc[_0x0c74('0x3e')]));if(_0x5ec825[_0x0c74('0x35')][_0x0c74('0x5c')]){_0x2ae67b[_0x0c74('0x3d')]=_[_0x0c74('0x40')](_0x2ae67b[_0x0c74('0x3d')],{'$or':_[_0x0c74('0x41')](_0x2ae67b[_0x0c74('0x37')],function(_0x3d442a){var _0x5cddfb={};_0x5cddfb[_0x3d442a]={'$like':'%'+_0x5ec825['query'][_0x0c74('0x5c')]+'%'};return _0x5cddfb;})});}_0x2ae67b=_[_0x0c74('0x40')]({},_0x2ae67b,_0x5ec825[_0x0c74('0x43')]);return _0x4ab381['getAgents'](_0x2ae67b);}})['then'](function(_0x3f98ba){if(_0x3f98ba){_0x3b2d01=_0x3f98ba[_0x0c74('0x49')];if(!_0x5ec825['query'][_0x0c74('0x38')](_0x0c74('0x39'))){_0x2ae67b[_0x0c74('0x3a')]=qs[_0x0c74('0x3a')](_0x5ec825[_0x0c74('0x35')][_0x0c74('0x3a')]);_0x2ae67b['offset']=qs['offset'](_0x5ec825['query'][_0x0c74('0x23')]);}return _0x4ab381[_0x0c74('0x88')](_0x2ae67b);}})['then'](function(_0x4296d0){if(_0x4296d0){return _0x4296d0?{'count':_0x3b2d01,'rows':_0x4296d0}:null;}})['then'](respondWithResult(_0x53bff7,null))['catch'](handleError(_0x53bff7,null));};
\ No newline at end of file
index 2370de6..6ffe87e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x725b=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x585634,_0x1cfd45){var _0x57afa0=function(_0x6a755b){while(--_0x6a755b){_0x585634['push'](_0x585634['shift']());}};_0x57afa0(++_0x1cfd45);}(_0x725b,0x19b));var _0xb725=function(_0x5a452e,_0x355a90){_0x5a452e=_0x5a452e-0x0;var _0x2c4c43=_0x725b[_0x5a452e];return _0x2c4c43;};'use strict';var EventEmitter=require(_0xb725('0x0'));var OpenchannelQueue=require(_0xb725('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb725('0x2'),'afterDestroy':'remove'};function emitEvent(_0xeb1a3b){return function(_0x703792,_0x27e36e,_0x190791){OpenchannelQueueEvents['emit'](_0xeb1a3b+':'+_0x703792['id'],_0x703792);OpenchannelQueueEvents[_0xb725('0x3')](_0xeb1a3b,_0x703792);_0x190791(null);};}for(var e in events){if(events[_0xb725('0x4')](e)){var event=events[e];OpenchannelQueue[_0xb725('0x5')](e,emitEvent(event));}}module[_0xb725('0x6')]=OpenchannelQueueEvents;
\ No newline at end of file
+var _0x0cb8=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x4f2bec,_0xa74720){var _0x285678=function(_0x3cbabb){while(--_0x3cbabb){_0x4f2bec['push'](_0x4f2bec['shift']());}};_0x285678(++_0xa74720);}(_0x0cb8,0xe7));var _0x80cb=function(_0x48fa0e,_0x245150){_0x48fa0e=_0x48fa0e-0x0;var _0x50fa45=_0x0cb8[_0x48fa0e];return _0x50fa45;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x80cb('0x0'))['db'][_0x80cb('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x80cb('0x2')](0x0);var events={'afterCreate':_0x80cb('0x3'),'afterUpdate':_0x80cb('0x4'),'afterDestroy':_0x80cb('0x5')};function emitEvent(_0x1bb516){return function(_0x9f57e1,_0x3d283b,_0x308a78){OpenchannelQueueEvents[_0x80cb('0x6')](_0x1bb516+':'+_0x9f57e1['id'],_0x9f57e1);OpenchannelQueueEvents['emit'](_0x1bb516,_0x9f57e1);_0x308a78(null);};}for(var e in events){if(events[_0x80cb('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents;
\ No newline at end of file
index 4e0b1ad..f282e1e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9b9=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2188e2,_0xfdd768){var _0x43393a=function(_0x2a50c5){while(--_0x2a50c5){_0x2188e2['push'](_0x2188e2['shift']());}};_0x43393a(++_0xfdd768);}(_0xc9b9,0x1ce));var _0x9c9b=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xc9b9[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x9c9b('0x0'));var util=require(_0x9c9b('0x1'));var logger=require(_0x9c9b('0x2'))(_0x9c9b('0x3'));var moment=require('moment');var BPromise=require(_0x9c9b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c9b('0x5'));var rimraf=require(_0x9c9b('0x6'));var config=require(_0x9c9b('0x7'));var attributes=require(_0x9c9b('0x8'));module[_0x9c9b('0x9')]=function(_0x5824b0,_0x2414bd){return _0x5824b0['define'](_0x9c9b('0xa'),attributes,{'tableName':_0x9c9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb650=['openchannel_queues','util','../../config/logger','api','request-promise','path','../../config/environment','./openchannelQueue.attributes','define'];(function(_0x5de02c,_0x2bca83){var _0x5bee77=function(_0x447356){while(--_0x447356){_0x5de02c['push'](_0x5de02c['shift']());}};_0x5bee77(++_0x2bca83);}(_0xb650,0x1ba));var _0x0b65=function(_0x578c1a,_0x3e720f){_0x578c1a=_0x578c1a-0x0;var _0x1cfbac=_0xb650[_0x578c1a];return _0x1cfbac;};'use strict';var _=require('lodash');var util=require(_0x0b65('0x0'));var logger=require(_0x0b65('0x1'))(_0x0b65('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b65('0x3'));var fs=require('fs');var path=require(_0x0b65('0x4'));var rimraf=require('rimraf');var config=require(_0x0b65('0x5'));var attributes=require(_0x0b65('0x6'));module['exports']=function(_0x3ff1f6,_0x7922e4){return _0x3ff1f6[_0x0b65('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x0b65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 850b947..cae396e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x800e=['register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueue','options','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelQueue.socket'];(function(_0x2a18b7,_0x5041c8){var _0x45e74e=function(_0x1d32d6){while(--_0x1d32d6){_0x2a18b7['push'](_0x2a18b7['shift']());}};_0x45e74e(++_0x5041c8);}(_0x800e,0x101));var _0xe800=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x800e[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xe800('0x0'));var util=require(_0xe800('0x1'));var moment=require(_0xe800('0x2'));var BPromise=require(_0xe800('0x3'));var rs=require(_0xe800('0x4'));var fs=require('fs');var Redis=require(_0xe800('0x5'));var db=require(_0xe800('0x6'))['db'];var utils=require(_0xe800('0x7'));var logger=require('../../config/logger')(_0xe800('0x8'));var config=require(_0xe800('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe800('0xa')][_0xe800('0xb')]({'port':0x232a});config[_0xe800('0xc')]=_[_0xe800('0xd')](config[_0xe800('0xc')],{'host':_0xe800('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe800('0xc')]));require(_0xe800('0xf'))[_0xe800('0x10')](socket);function respondWithRpcPromise(_0x3ce688,_0x15fa85,_0x2c6441){return new BPromise(function(_0x52c373,_0x9f210f){return client[_0xe800('0x11')](_0x3ce688,_0x2c6441)[_0xe800('0x12')](function(_0x1f1aee){logger[_0xe800('0x13')](_0xe800('0x14'),_0x15fa85,'request\x20sent');logger[_0xe800('0x15')](_0xe800('0x16'),_0x15fa85,_0xe800('0x17'),JSON[_0xe800('0x18')](_0x1f1aee));if(_0x1f1aee[_0xe800('0x19')]){if(_0x1f1aee[_0xe800('0x19')][_0xe800('0x1a')]===0x1f4){logger[_0xe800('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x15fa85,_0x1f1aee[_0xe800('0x19')][_0xe800('0x1b')]);return _0x9f210f(_0x1f1aee[_0xe800('0x19')][_0xe800('0x1b')]);}logger[_0xe800('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x15fa85,_0x1f1aee[_0xe800('0x19')][_0xe800('0x1b')]);return _0x52c373(_0x1f1aee[_0xe800('0x19')][_0xe800('0x1b')]);}else{logger[_0xe800('0x13')](_0xe800('0x14'),_0x15fa85,_0xe800('0x17'));_0x52c373(_0x1f1aee[_0xe800('0x1c')][_0xe800('0x1b')]);}})[_0xe800('0x1d')](function(_0x7c12d0){logger[_0xe800('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x15fa85,_0x7c12d0);_0x9f210f(_0x7c12d0);});});}exports['GetOpenchannelQueue']=function(_0x17f6f0){var _0x1cc046=this;return new Promise(function(_0xe9d186,_0x58186a){return db[_0xe800('0x1e')]['findAll']({'raw':_0x17f6f0[_0xe800('0x1f')]?_0x17f6f0[_0xe800('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x17f6f0[_0xe800('0x1f')]?_0x17f6f0[_0xe800('0x1f')][_0xe800('0x20')]||null:null,'attributes':_0x17f6f0[_0xe800('0x1f')]?_0x17f6f0[_0xe800('0x1f')][_0xe800('0x21')]||null:null,'limit':_0x17f6f0[_0xe800('0x1f')]?_0x17f6f0[_0xe800('0x1f')]['limit']||null:null,'include':_0x17f6f0['options']?_0x17f6f0[_0xe800('0x1f')][_0xe800('0x22')]?_[_0xe800('0x23')](_0x17f6f0['options'][_0xe800('0x22')],function(_0xb821bc){return{'model':db[_0xb821bc[_0xe800('0x24')]],'as':_0xb821bc['as'],'attributes':_0xb821bc[_0xe800('0x21')],'include':_0xb821bc[_0xe800('0x22')]?_[_0xe800('0x23')](_0xb821bc[_0xe800('0x22')],function(_0x1a0abd){return{'model':db[_0x1a0abd[_0xe800('0x24')]],'as':_0x1a0abd['as'],'attributes':_0x1a0abd[_0xe800('0x21')],'include':_0x1a0abd['include']?_['map'](_0x1a0abd[_0xe800('0x22')],function(_0x12e9b2){return{'model':db[_0x12e9b2[_0xe800('0x24')]],'as':_0x12e9b2['as'],'attributes':_0x12e9b2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe800('0x12')](function(_0x102873){logger[_0xe800('0x13')]('GetOpenchannelQueue',_0x17f6f0);logger[_0xe800('0x15')](_0xe800('0x25'),_0x17f6f0,JSON[_0xe800('0x18')](_0x102873));_0xe9d186(_0x102873);})[_0xe800('0x1d')](function(_0x39c043){logger[_0xe800('0x19')]('GetOpenchannelQueue',_0x39c043[_0xe800('0x1b')],_0x17f6f0);_0x58186a(_0x1cc046['error'](0x1f4,_0x39c043[_0xe800('0x1b')]));});});};exports[_0xe800('0x26')]=function(_0x37b946){var _0x2e77f9=this;return new Promise(function(_0x5b82f8,_0x2e6df8){return db[_0xe800('0x1e')]['find']({'raw':_0x37b946['options']?_0x37b946['options']['raw']===undefined?!![]:![]:!![],'where':_0x37b946[_0xe800('0x1f')]?_0x37b946[_0xe800('0x1f')]['where']||null:null,'attributes':_0x37b946['options']?_0x37b946[_0xe800('0x1f')][_0xe800('0x21')]||null:null,'include':_0x37b946[_0xe800('0x1f')]?_0x37b946[_0xe800('0x1f')][_0xe800('0x22')]?_['map'](_0x37b946['options'][_0xe800('0x22')],function(_0x18014a){return{'model':db[_0x18014a[_0xe800('0x24')]],'as':_0x18014a['as'],'attributes':_0x18014a['attributes'],'include':_0x18014a[_0xe800('0x22')]?_[_0xe800('0x23')](_0x18014a[_0xe800('0x22')],function(_0x1654b8){return{'model':db[_0x1654b8['model']],'as':_0x1654b8['as'],'attributes':_0x1654b8[_0xe800('0x21')],'include':_0x1654b8[_0xe800('0x22')]?_['map'](_0x1654b8['include'],function(_0x4b7acb){return{'model':db[_0x4b7acb['model']],'as':_0x4b7acb['as'],'attributes':_0x4b7acb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d5fe2){logger[_0xe800('0x13')](_0xe800('0x26'),_0x37b946);logger['debug']('ShowOpenchannelQueue',_0x37b946,JSON[_0xe800('0x18')](_0x5d5fe2));_0x5b82f8(_0x5d5fe2);})[_0xe800('0x1d')](function(_0xd90744){logger['error']('ShowOpenchannelQueue',_0xd90744[_0xe800('0x1b')],_0x37b946);_0x2e6df8(_0x2e77f9[_0xe800('0x19')](0x1f4,_0xd90744[_0xe800('0x1b')]));});});};
\ No newline at end of file
+var _0x09d6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetOpenchannelQueue','options','raw','where','limit','include','map','model','attributes','debug','stringify','OpenchannelQueue','find','ShowOpenchannelQueue','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x25b70c,_0x2383d4){var _0x4ed70e=function(_0x42aa18){while(--_0x42aa18){_0x25b70c['push'](_0x25b70c['shift']());}};_0x4ed70e(++_0x2383d4);}(_0x09d6,0xeb));var _0x609d=function(_0x4238d7,_0x15b20b){_0x4238d7=_0x4238d7-0x0;var _0x284414=_0x09d6[_0x4238d7];return _0x284414;};'use strict';var _=require('lodash');var util=require(_0x609d('0x0'));var moment=require(_0x609d('0x1'));var BPromise=require('bluebird');var rs=require(_0x609d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x609d('0x3'))['db'];var utils=require(_0x609d('0x4'));var logger=require(_0x609d('0x5'))(_0x609d('0x6'));var config=require(_0x609d('0x7'));var jayson=require(_0x609d('0x8'));var client=jayson[_0x609d('0x9')][_0x609d('0xa')]({'port':0x232a});config[_0x609d('0xb')]=_[_0x609d('0xc')](config['redis'],{'host':_0x609d('0xd'),'port':0x18eb});var socket=require(_0x609d('0xe'))(new Redis(config[_0x609d('0xb')]));require('./openchannelQueue.socket')[_0x609d('0xf')](socket);function respondWithRpcPromise(_0x3e96b1,_0x2f1eb2,_0x2d4a33){return new BPromise(function(_0x4bb37d,_0x38f712){return client['request'](_0x3e96b1,_0x2d4a33)[_0x609d('0x10')](function(_0x38a0fd){logger['info'](_0x609d('0x11'),_0x2f1eb2,_0x609d('0x12'));logger['debug'](_0x609d('0x13'),_0x2f1eb2,_0x609d('0x12'),JSON['stringify'](_0x38a0fd));if(_0x38a0fd[_0x609d('0x14')]){if(_0x38a0fd['error'][_0x609d('0x15')]===0x1f4){logger['error'](_0x609d('0x11'),_0x2f1eb2,_0x38a0fd[_0x609d('0x14')][_0x609d('0x16')]);return _0x38f712(_0x38a0fd['error'][_0x609d('0x16')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2f1eb2,_0x38a0fd[_0x609d('0x14')][_0x609d('0x16')]);return _0x4bb37d(_0x38a0fd[_0x609d('0x14')][_0x609d('0x16')]);}else{logger[_0x609d('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f1eb2,'request\x20sent');_0x4bb37d(_0x38a0fd[_0x609d('0x18')][_0x609d('0x16')]);}})[_0x609d('0x19')](function(_0x22d8f3){logger[_0x609d('0x14')](_0x609d('0x11'),_0x2f1eb2,_0x22d8f3);_0x38f712(_0x22d8f3);});});}exports[_0x609d('0x1a')]=function(_0x7da921){var _0x175a46=this;return new Promise(function(_0x61be9,_0xb7a7e6){return db['OpenchannelQueue']['findAll']({'raw':_0x7da921[_0x609d('0x1b')]?_0x7da921[_0x609d('0x1b')][_0x609d('0x1c')]===undefined?!![]:![]:!![],'where':_0x7da921[_0x609d('0x1b')]?_0x7da921[_0x609d('0x1b')][_0x609d('0x1d')]||null:null,'attributes':_0x7da921[_0x609d('0x1b')]?_0x7da921[_0x609d('0x1b')]['attributes']||null:null,'limit':_0x7da921[_0x609d('0x1b')]?_0x7da921['options'][_0x609d('0x1e')]||null:null,'include':_0x7da921[_0x609d('0x1b')]?_0x7da921[_0x609d('0x1b')][_0x609d('0x1f')]?_[_0x609d('0x20')](_0x7da921['options'][_0x609d('0x1f')],function(_0x2ece76){return{'model':db[_0x2ece76[_0x609d('0x21')]],'as':_0x2ece76['as'],'attributes':_0x2ece76['attributes'],'include':_0x2ece76[_0x609d('0x1f')]?_[_0x609d('0x20')](_0x2ece76[_0x609d('0x1f')],function(_0x5757f4){return{'model':db[_0x5757f4['model']],'as':_0x5757f4['as'],'attributes':_0x5757f4[_0x609d('0x22')],'include':_0x5757f4[_0x609d('0x1f')]?_[_0x609d('0x20')](_0x5757f4['include'],function(_0x5b7e41){return{'model':db[_0x5b7e41[_0x609d('0x21')]],'as':_0x5b7e41['as'],'attributes':_0x5b7e41[_0x609d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x609d('0x10')](function(_0x40bc83){logger[_0x609d('0x17')](_0x609d('0x1a'),_0x7da921);logger[_0x609d('0x23')](_0x609d('0x1a'),_0x7da921,JSON[_0x609d('0x24')](_0x40bc83));_0x61be9(_0x40bc83);})[_0x609d('0x19')](function(_0x2aa32f){logger[_0x609d('0x14')]('GetOpenchannelQueue',_0x2aa32f[_0x609d('0x16')],_0x7da921);_0xb7a7e6(_0x175a46[_0x609d('0x14')](0x1f4,_0x2aa32f['message']));});});};exports['ShowOpenchannelQueue']=function(_0x2e3520){var _0x4a800e=this;return new Promise(function(_0x3aecbc,_0x585481){return db[_0x609d('0x25')][_0x609d('0x26')]({'raw':_0x2e3520[_0x609d('0x1b')]?_0x2e3520[_0x609d('0x1b')][_0x609d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e3520[_0x609d('0x1b')]?_0x2e3520[_0x609d('0x1b')][_0x609d('0x1d')]||null:null,'attributes':_0x2e3520[_0x609d('0x1b')]?_0x2e3520[_0x609d('0x1b')]['attributes']||null:null,'include':_0x2e3520[_0x609d('0x1b')]?_0x2e3520[_0x609d('0x1b')][_0x609d('0x1f')]?_[_0x609d('0x20')](_0x2e3520[_0x609d('0x1b')][_0x609d('0x1f')],function(_0x521f87){return{'model':db[_0x521f87[_0x609d('0x21')]],'as':_0x521f87['as'],'attributes':_0x521f87[_0x609d('0x22')],'include':_0x521f87['include']?_['map'](_0x521f87[_0x609d('0x1f')],function(_0x3277fd){return{'model':db[_0x3277fd['model']],'as':_0x3277fd['as'],'attributes':_0x3277fd['attributes'],'include':_0x3277fd[_0x609d('0x1f')]?_[_0x609d('0x20')](_0x3277fd[_0x609d('0x1f')],function(_0x586869){return{'model':db[_0x586869['model']],'as':_0x586869['as'],'attributes':_0x586869['attributes']};}):[]};}):[]};}):[]:[]})[_0x609d('0x10')](function(_0x34d12b){logger[_0x609d('0x17')](_0x609d('0x27'),_0x2e3520);logger[_0x609d('0x23')](_0x609d('0x27'),_0x2e3520,JSON[_0x609d('0x24')](_0x34d12b));_0x3aecbc(_0x34d12b);})[_0x609d('0x19')](function(_0x1c2130){logger[_0x609d('0x14')](_0x609d('0x27'),_0x1c2130['message'],_0x2e3520);_0x585481(_0x4a800e['error'](0x1f4,_0x1c2130[_0x609d('0x16')]));});});};
\ No newline at end of file
index 488cf36..ce2ba68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25cf=['emit','removeListener','register','openchannelQueue:'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x25cf,0x138));var _0xf25c=function(_0x5cb977,_0x13c79c){_0x5cb977=_0x5cb977-0x0;var _0x40c203=_0x25cf[_0x5cb977];return _0x40c203;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove','update'];function createListener(_0x4781d6,_0x36b972){return function(_0x5be5a3){_0x36b972[_0xf25c('0x0')](_0x4781d6,_0x5be5a3);};}function removeListener(_0x50c312,_0x1252e6){return function(){OpenchannelQueueEvents[_0xf25c('0x1')](_0x50c312,_0x1252e6);};}exports[_0xf25c('0x2')]=function(_0x339b11){for(var _0x26e604=0x0,_0x46f2a2=events['length'];_0x26e604<_0x46f2a2;_0x26e604++){var _0x88438e=events[_0x26e604];var _0x5ba877=createListener(_0xf25c('0x3')+_0x88438e,_0x339b11);OpenchannelQueueEvents['on'](_0x88438e,_0x5ba877);}};
\ No newline at end of file
+var _0x25de=['remove','update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x2c82e8,_0xb74690){var _0x4ad3f9=function(_0x5c357f){while(--_0x5c357f){_0x2c82e8['push'](_0x2c82e8['shift']());}};_0x4ad3f9(++_0xb74690);}(_0x25de,0x176));var _0xe25d=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0x25de[_0x233716];return _0x302298;};'use strict';var OpenchannelQueueEvents=require(_0xe25d('0x0'));var events=[_0xe25d('0x1'),_0xe25d('0x2'),_0xe25d('0x3')];function createListener(_0x3fcaf1,_0x1e0121){return function(_0x201d95){_0x1e0121['emit'](_0x3fcaf1,_0x201d95);};}function removeListener(_0x4e02ca,_0x54b97e){return function(){OpenchannelQueueEvents[_0xe25d('0x4')](_0x4e02ca,_0x54b97e);};}exports[_0xe25d('0x5')]=function(_0x22ca71){for(var _0x3f2b78=0x0,_0x417a83=events[_0xe25d('0x6')];_0x3f2b78<_0x417a83;_0x3f2b78++){var _0x2c6cfd=events[_0x3f2b78];var _0x2cac3a=createListener(_0xe25d('0x7')+_0x2c6cfd,_0x22ca71);OpenchannelQueueEvents['on'](_0x2c6cfd,_0x2cac3a);}};
\ No newline at end of file
index 4f05e1a..5166605 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf16c=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf16c,0x154));var _0xcf16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf16c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xcf16('0x0'));var util=require('util');var path=require(_0xcf16('0x1'));var timeout=require(_0xcf16('0x2'));var express=require(_0xcf16('0x3'));var router=express[_0xcf16('0x4')]();var fs_extra=require(_0xcf16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcf16('0x6'));var config=require(_0xcf16('0x7'));var controller=require(_0xcf16('0x8'));router[_0xcf16('0x9')]('/',auth[_0xcf16('0xa')](),controller['index']);router[_0xcf16('0x9')](_0xcf16('0xb'),auth[_0xcf16('0xa')](),controller[_0xcf16('0xc')]);router[_0xcf16('0x9')](_0xcf16('0xd'),auth[_0xcf16('0xa')](),controller[_0xcf16('0xe')]);router[_0xcf16('0xf')]('/',auth[_0xcf16('0xa')](),controller['create']);router[_0xcf16('0x10')](_0xcf16('0xd'),auth['isAuthenticated'](),controller[_0xcf16('0x11')]);router[_0xcf16('0x12')](_0xcf16('0xd'),auth['isAuthenticated'](),controller[_0xcf16('0x13')]);module[_0xcf16('0x14')]=router;
\ No newline at end of file
+var _0x3dc2=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x3dc2,0x92));var _0x23dc=function(_0x22b4f5,_0x2ab6cc){_0x22b4f5=_0x22b4f5-0x0;var _0x24e062=_0x3dc2[_0x22b4f5];return _0x24e062;};'use strict';var multer=require(_0x23dc('0x0'));var util=require(_0x23dc('0x1'));var path=require(_0x23dc('0x2'));var timeout=require(_0x23dc('0x3'));var express=require('express');var router=express[_0x23dc('0x4')]();var fs_extra=require(_0x23dc('0x5'));var auth=require(_0x23dc('0x6'));var interaction=require(_0x23dc('0x7'));var config=require(_0x23dc('0x8'));var controller=require(_0x23dc('0x9'));router[_0x23dc('0xa')]('/',auth[_0x23dc('0xb')](),controller['index']);router[_0x23dc('0xa')](_0x23dc('0xc'),auth['isAuthenticated'](),controller[_0x23dc('0xd')]);router[_0x23dc('0xa')](_0x23dc('0xe'),auth['isAuthenticated'](),controller[_0x23dc('0xf')]);router[_0x23dc('0x10')]('/',auth['isAuthenticated'](),controller[_0x23dc('0x11')]);router[_0x23dc('0x12')](_0x23dc('0xe'),auth[_0x23dc('0xb')](),controller['update']);router[_0x23dc('0x13')](_0x23dc('0xe'),auth['isAuthenticated'](),controller[_0x23dc('0x14')]);module[_0x23dc('0x15')]=router;
\ No newline at end of file
index 84fbe56..9639da2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2c37=['DATE','sequelize','STRING'];(function(_0x3492c5,_0x268e94){var _0x349a38=function(_0x5e9644){while(--_0x5e9644){_0x3492c5['push'](_0x3492c5['shift']());}};_0x349a38(++_0x268e94);}(_0x2c37,0x175));var _0x72c3=function(_0xa66e1c,_0x2c51e1){_0xa66e1c=_0xa66e1c-0x0;var _0x4b7346=_0x2c37[_0xa66e1c];return _0x4b7346;};'use strict';var moment=require('moment');var Sequelize=require(_0x72c3('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x72c3('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x72c3('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x72c3('0x2')]},'reason':{'type':Sequelize[_0x72c3('0x1')]}};
\ No newline at end of file
+var _0x7b06=['DATE','moment','sequelize','exports','STRING'];(function(_0x326f25,_0x9dd03b){var _0x2c876b=function(_0x2691ee){while(--_0x2691ee){_0x326f25['push'](_0x326f25['shift']());}};_0x2c876b(++_0x9dd03b);}(_0x7b06,0x173));var _0x67b0=function(_0x171e4d,_0x4f2493){_0x171e4d=_0x171e4d-0x0;var _0x2d2bf4=_0x7b06[_0x171e4d];return _0x2d2bf4;};'use strict';var moment=require(_0x67b0('0x0'));var Sequelize=require(_0x67b0('0x1'));module[_0x67b0('0x2')]={'uniqueid':{'type':Sequelize[_0x67b0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x67b0('0x3')]},'joinAt':{'type':Sequelize[_0x67b0('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x67b0('0x4')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 362fffc..601312e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76b0=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','length','options','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','OpenchannelQueueReport','fieldName','key','model','map'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x76b0,0xac));var _0x076b=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x76b0[_0x2f45ea];return _0x485a84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x076b('0x0'));var zipdir=require(_0x076b('0x1'));var jsonpatch=require(_0x076b('0x2'));var rp=require('request-promise');var moment=require(_0x076b('0x3'));var BPromise=require(_0x076b('0x4'));var Mustache=require(_0x076b('0x5'));var util=require(_0x076b('0x6'));var path=require(_0x076b('0x7'));var sox=require('sox');var csv=require(_0x076b('0x8'));var ejs=require(_0x076b('0x9'));var fs=require('fs');var fs_extra=require(_0x076b('0xa'));var _=require('lodash');var squel=require(_0x076b('0xb'));var crypto=require(_0x076b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x076b('0xd'));var toCsv=require(_0x076b('0x8'));var querystring=require('querystring');var Papa=require(_0x076b('0xe'));var Redis=require(_0x076b('0xf'));var authService=require(_0x076b('0x10'));var qs=require(_0x076b('0x11'));var as=require(_0x076b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x076b('0x13'))(_0x076b('0x14'));var utils=require(_0x076b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9adcb5,_0x53715d){_0x53715d=_0x53715d||0xcc;return function(_0x4a324b){if(_0x4a324b){return _0x9adcb5[_0x076b('0x16')](_0x53715d);}return _0x9adcb5[_0x076b('0x17')](_0x53715d)['end']();};}function respondWithResult(_0x28ef78,_0x575206){_0x575206=_0x575206||0xc8;return function(_0x578732){if(_0x578732){return _0x28ef78[_0x076b('0x17')](_0x575206)[_0x076b('0x18')](_0x578732);}};}function respondWithFilteredResult(_0xf03847,_0x428cb9){return function(_0x553e4c){if(_0x553e4c){var _0x53a4d3=typeof _0x428cb9['offset']===_0x076b('0x19')&&typeof _0x428cb9['limit']===_0x076b('0x19');var _0x38dd98=_0x553e4c[_0x076b('0x1a')];var _0x14457a=_0x53a4d3?0x0:_0x428cb9[_0x076b('0x1b')];var _0x1a0d07=_0x53a4d3?_0x553e4c[_0x076b('0x1a')]:_0x428cb9[_0x076b('0x1b')]+_0x428cb9['limit'];var _0x365dee;if(_0x1a0d07>=_0x38dd98){_0x1a0d07=_0x38dd98;_0x365dee=0xc8;}else{_0x365dee=0xce;}_0xf03847['status'](_0x365dee);return _0xf03847[_0x076b('0x1c')](_0x076b('0x1d'),_0x14457a+'-'+_0x1a0d07+'/'+_0x38dd98)[_0x076b('0x18')](_0x553e4c);}return null;};}function patchUpdates(_0x2aae26){return function(_0x40415c){try{jsonpatch[_0x076b('0x1e')](_0x40415c,_0x2aae26,!![]);}catch(_0x4ac413){return BPromise[_0x076b('0x1f')](_0x4ac413);}return _0x40415c['save']();};}function saveUpdates(_0x56323d,_0x20b0c7){return function(_0x2d8386){if(_0x2d8386){return _0x2d8386['update'](_0x56323d)[_0x076b('0x20')](function(_0x104a6b){return _0x104a6b;});}return null;};}function removeEntity(_0x2c2214,_0x1ae63f){return function(_0x12fe1c){if(_0x12fe1c){return _0x12fe1c[_0x076b('0x21')]()[_0x076b('0x20')](function(){_0x2c2214['status'](0xcc)[_0x076b('0x22')]();});}};}function handleEntityNotFound(_0x216204,_0xa2063a){return function(_0x3c101b){if(!_0x3c101b){_0x216204[_0x076b('0x16')](0x194);}return _0x3c101b;};}function handleError(_0x583453,_0x2e6310){_0x2e6310=_0x2e6310||0x1f4;return function(_0x1c8722){logger[_0x076b('0x23')](_0x1c8722[_0x076b('0x24')]);if(_0x1c8722['name']){delete _0x1c8722[_0x076b('0x25')];}_0x583453[_0x076b('0x17')](_0x2e6310)['send'](_0x1c8722);};}exports[_0x076b('0x26')]=function(_0x1280a8,_0x4d4806){var _0x454f58={},_0xa1f786={},_0x9edf7={'count':0x0,'rows':[]};var _0x5e8c13=_['map'](db[_0x076b('0x27')]['rawAttributes'],function(_0x4192ce){return{'name':_0x4192ce[_0x076b('0x28')],'type':_0x4192ce['type'][_0x076b('0x29')]};});_0xa1f786[_0x076b('0x2a')]=_[_0x076b('0x2b')](_0x5e8c13,'name');_0xa1f786[_0x076b('0x2c')]=_[_0x076b('0x2d')](_0x1280a8['query']);_0xa1f786[_0x076b('0x2e')]=_[_0x076b('0x2f')](_0xa1f786['model'],_0xa1f786['query']);_0x454f58[_0x076b('0x30')]=_[_0x076b('0x2f')](_0xa1f786[_0x076b('0x2a')],qs[_0x076b('0x31')](_0x1280a8[_0x076b('0x2c')][_0x076b('0x31')]));_0x454f58[_0x076b('0x30')]=_0x454f58[_0x076b('0x30')]['length']?_0x454f58[_0x076b('0x30')]:_0xa1f786['model'];if(!_0x1280a8[_0x076b('0x2c')][_0x076b('0x32')](_0x076b('0x33'))){_0x454f58[_0x076b('0x34')]=qs['limit'](_0x1280a8['query'][_0x076b('0x34')]);_0x454f58[_0x076b('0x1b')]=qs['offset'](_0x1280a8[_0x076b('0x2c')][_0x076b('0x1b')]);}_0x454f58['order']=qs[_0x076b('0x35')](_0x1280a8[_0x076b('0x2c')][_0x076b('0x35')]);_0x454f58[_0x076b('0x36')]=qs[_0x076b('0x2e')](_[_0x076b('0x37')](_0x1280a8['query'],_0xa1f786['filters']),_0x5e8c13);if(_0x1280a8['query'][_0x076b('0x38')]){_0x454f58['where']=_[_0x076b('0x39')](_0x454f58[_0x076b('0x36')],{'$or':_[_0x076b('0x2b')](_0x5e8c13,function(_0x2799b0){if(_0x2799b0[_0x076b('0x3a')]!=='VIRTUAL'){var _0x5b0327={};_0x5b0327[_0x2799b0[_0x076b('0x25')]]={'$like':'%'+_0x1280a8['query'][_0x076b('0x38')]+'%'};return _0x5b0327;}})});}_0x454f58=_[_0x076b('0x39')]({},_0x454f58,_0x1280a8['options']);var _0x1b4a28={'where':_0x454f58[_0x076b('0x36')]};return db[_0x076b('0x27')][_0x076b('0x1a')](_0x1b4a28)[_0x076b('0x20')](function(_0x565fbd){_0x9edf7[_0x076b('0x1a')]=_0x565fbd;if(_0x1280a8[_0x076b('0x2c')][_0x076b('0x3b')]){_0x454f58[_0x076b('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x076b('0x3d')](_0x454f58);})[_0x076b('0x20')](function(_0xbb485d){_0x9edf7[_0x076b('0x3e')]=_0xbb485d;return _0x9edf7;})[_0x076b('0x20')](respondWithFilteredResult(_0x4d4806,_0x454f58))[_0x076b('0x3f')](handleError(_0x4d4806,null));};exports[_0x076b('0x40')]=function(_0x386d7a,_0x1ca7e9){var _0x517f97={'raw':!![],'where':{'id':_0x386d7a['params']['id']}},_0x5098cf={};_0x5098cf[_0x076b('0x2a')]=_[_0x076b('0x2d')](db[_0x076b('0x27')]['rawAttributes']);_0x5098cf[_0x076b('0x2c')]=_[_0x076b('0x2d')](_0x386d7a[_0x076b('0x2c')]);_0x5098cf[_0x076b('0x2e')]=_[_0x076b('0x2f')](_0x5098cf[_0x076b('0x2a')],_0x5098cf['query']);_0x517f97['attributes']=_[_0x076b('0x2f')](_0x5098cf[_0x076b('0x2a')],qs[_0x076b('0x31')](_0x386d7a[_0x076b('0x2c')][_0x076b('0x31')]));_0x517f97[_0x076b('0x30')]=_0x517f97[_0x076b('0x30')][_0x076b('0x41')]?_0x517f97[_0x076b('0x30')]:_0x5098cf[_0x076b('0x2a')];if(_0x386d7a[_0x076b('0x2c')][_0x076b('0x3b')]){_0x517f97[_0x076b('0x3c')]=[{'all':!![]}];}_0x517f97=_[_0x076b('0x39')]({},_0x517f97,_0x386d7a[_0x076b('0x42')]);return db[_0x076b('0x27')]['find'](_0x517f97)[_0x076b('0x20')](handleEntityNotFound(_0x1ca7e9,null))['then'](respondWithResult(_0x1ca7e9,null))[_0x076b('0x3f')](handleError(_0x1ca7e9,null));};exports['create']=function(_0xe93baa,_0x12715a){return db['OpenchannelQueueReport'][_0x076b('0x43')](_0xe93baa[_0x076b('0x44')],{})[_0x076b('0x20')](respondWithResult(_0x12715a,0xc9))[_0x076b('0x3f')](handleError(_0x12715a,null));};exports['update']=function(_0x39a9cc,_0x12faea){if(_0x39a9cc['body']['id']){delete _0x39a9cc['body']['id'];}return db[_0x076b('0x27')][_0x076b('0x45')]({'where':{'id':_0x39a9cc[_0x076b('0x46')]['id']}})[_0x076b('0x20')](handleEntityNotFound(_0x12faea,null))[_0x076b('0x20')](saveUpdates(_0x39a9cc['body'],null))[_0x076b('0x20')](respondWithResult(_0x12faea,null))['catch'](handleError(_0x12faea,null));};exports['destroy']=function(_0x5999eb,_0x311a){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x5999eb[_0x076b('0x46')]['id']}})[_0x076b('0x20')](handleEntityNotFound(_0x311a,null))['then'](removeEntity(_0x311a,null))[_0x076b('0x3f')](handleError(_0x311a,null));};exports[_0x076b('0x47')]=function(_0x198d94,_0x5ec0c9){return db[_0x076b('0x27')][_0x076b('0x47')]()['then'](respondWithResult(_0x5ec0c9,null))['catch'](handleError(_0x5ec0c9,null));};
\ No newline at end of file
+var _0x5494=['bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5494,0xe9));var _0x4549=function(_0x116482,_0x35ddae){_0x116482=_0x116482-0x0;var _0x56db37=_0x5494[_0x116482];return _0x56db37;};'use strict';var emlformat=require(_0x4549('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4549('0x1'));var jsonpatch=require(_0x4549('0x2'));var rp=require(_0x4549('0x3'));var moment=require('moment');var BPromise=require(_0x4549('0x4'));var Mustache=require('mustache');var util=require(_0x4549('0x5'));var path=require(_0x4549('0x6'));var sox=require('sox');var csv=require(_0x4549('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4549('0x8'));var _=require(_0x4549('0x9'));var squel=require(_0x4549('0xa'));var crypto=require(_0x4549('0xb'));var jsforce=require(_0x4549('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4549('0xd'));var Papa=require(_0x4549('0xe'));var Redis=require(_0x4549('0xf'));var authService=require(_0x4549('0x10'));var qs=require(_0x4549('0x11'));var as=require(_0x4549('0x12'));var hardwareService=require(_0x4549('0x13'));var logger=require(_0x4549('0x14'))(_0x4549('0x15'));var utils=require(_0x4549('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4549('0x17'));var db=require(_0x4549('0x18'))['db'];function respondWithStatusCode(_0x480e6d,_0x58ffbd){_0x58ffbd=_0x58ffbd||0xcc;return function(_0x3ef325){if(_0x3ef325){return _0x480e6d[_0x4549('0x19')](_0x58ffbd);}return _0x480e6d[_0x4549('0x1a')](_0x58ffbd)['end']();};}function respondWithResult(_0x2d0fd5,_0x9e8b0f){_0x9e8b0f=_0x9e8b0f||0xc8;return function(_0x554b0d){if(_0x554b0d){return _0x2d0fd5[_0x4549('0x1a')](_0x9e8b0f)[_0x4549('0x1b')](_0x554b0d);}};}function respondWithFilteredResult(_0x351dd0,_0x11a4d9){return function(_0x13edb1){if(_0x13edb1){var _0x3c56b5=typeof _0x11a4d9[_0x4549('0x1c')]===_0x4549('0x1d')&&typeof _0x11a4d9[_0x4549('0x1e')]===_0x4549('0x1d');var _0x302270=_0x13edb1['count'];var _0x389a1b=_0x3c56b5?0x0:_0x11a4d9[_0x4549('0x1c')];var _0x5a0870=_0x3c56b5?_0x13edb1['count']:_0x11a4d9[_0x4549('0x1c')]+_0x11a4d9[_0x4549('0x1e')];var _0x5be0d8;if(_0x5a0870>=_0x302270){_0x5a0870=_0x302270;_0x5be0d8=0xc8;}else{_0x5be0d8=0xce;}_0x351dd0[_0x4549('0x1a')](_0x5be0d8);return _0x351dd0[_0x4549('0x1f')](_0x4549('0x20'),_0x389a1b+'-'+_0x5a0870+'/'+_0x302270)[_0x4549('0x1b')](_0x13edb1);}return null;};}function patchUpdates(_0x31361d){return function(_0x1f473c){try{jsonpatch[_0x4549('0x21')](_0x1f473c,_0x31361d,!![]);}catch(_0x184720){return BPromise[_0x4549('0x22')](_0x184720);}return _0x1f473c['save']();};}function saveUpdates(_0x5b7792,_0x4c0f4e){return function(_0x10b2eb){if(_0x10b2eb){return _0x10b2eb[_0x4549('0x23')](_0x5b7792)['then'](function(_0x461cbd){return _0x461cbd;});}return null;};}function removeEntity(_0x537e18,_0x1e3e17){return function(_0x366fe2){if(_0x366fe2){return _0x366fe2[_0x4549('0x24')]()[_0x4549('0x25')](function(){_0x537e18[_0x4549('0x1a')](0xcc)[_0x4549('0x26')]();});}};}function handleEntityNotFound(_0x46de1c,_0x5d7f9b){return function(_0xe6160b){if(!_0xe6160b){_0x46de1c[_0x4549('0x19')](0x194);}return _0xe6160b;};}function handleError(_0xe9582a,_0x5019a4){_0x5019a4=_0x5019a4||0x1f4;return function(_0xb2ff9){logger[_0x4549('0x27')](_0xb2ff9[_0x4549('0x28')]);if(_0xb2ff9[_0x4549('0x29')]){delete _0xb2ff9[_0x4549('0x29')];}_0xe9582a['status'](_0x5019a4)[_0x4549('0x2a')](_0xb2ff9);};}exports[_0x4549('0x2b')]=function(_0x2c5f01,_0x547628){var _0xb965bf={},_0x4bad24={},_0x227fa0={'count':0x0,'rows':[]};var _0x1a2bca=_[_0x4549('0x2c')](db[_0x4549('0x2d')]['rawAttributes'],function(_0x43c287){return{'name':_0x43c287[_0x4549('0x2e')],'type':_0x43c287[_0x4549('0x2f')][_0x4549('0x30')]};});_0x4bad24[_0x4549('0x31')]=_[_0x4549('0x2c')](_0x1a2bca,_0x4549('0x29'));_0x4bad24[_0x4549('0x32')]=_[_0x4549('0x33')](_0x2c5f01[_0x4549('0x32')]);_0x4bad24[_0x4549('0x34')]=_[_0x4549('0x35')](_0x4bad24[_0x4549('0x31')],_0x4bad24[_0x4549('0x32')]);_0xb965bf['attributes']=_[_0x4549('0x35')](_0x4bad24['model'],qs['fields'](_0x2c5f01[_0x4549('0x32')][_0x4549('0x36')]));_0xb965bf[_0x4549('0x37')]=_0xb965bf[_0x4549('0x37')][_0x4549('0x38')]?_0xb965bf['attributes']:_0x4bad24[_0x4549('0x31')];if(!_0x2c5f01[_0x4549('0x32')][_0x4549('0x39')]('nolimit')){_0xb965bf[_0x4549('0x1e')]=qs[_0x4549('0x1e')](_0x2c5f01['query'][_0x4549('0x1e')]);_0xb965bf[_0x4549('0x1c')]=qs[_0x4549('0x1c')](_0x2c5f01[_0x4549('0x32')][_0x4549('0x1c')]);}_0xb965bf[_0x4549('0x3a')]=qs[_0x4549('0x3b')](_0x2c5f01[_0x4549('0x32')]['sort']);_0xb965bf['where']=qs[_0x4549('0x34')](_[_0x4549('0x3c')](_0x2c5f01[_0x4549('0x32')],_0x4bad24['filters']),_0x1a2bca);if(_0x2c5f01['query'][_0x4549('0x3d')]){_0xb965bf[_0x4549('0x3e')]=_['merge'](_0xb965bf['where'],{'$or':_[_0x4549('0x2c')](_0x1a2bca,function(_0x58fac2){if(_0x58fac2[_0x4549('0x2f')]!==_0x4549('0x3f')){var _0x567d4a={};_0x567d4a[_0x58fac2[_0x4549('0x29')]]={'$like':'%'+_0x2c5f01[_0x4549('0x32')][_0x4549('0x3d')]+'%'};return _0x567d4a;}})});}_0xb965bf=_[_0x4549('0x40')]({},_0xb965bf,_0x2c5f01[_0x4549('0x41')]);var _0x1d83ce={'where':_0xb965bf['where']};return db[_0x4549('0x2d')][_0x4549('0x42')](_0x1d83ce)['then'](function(_0x12487b){_0x227fa0[_0x4549('0x42')]=_0x12487b;if(_0x2c5f01[_0x4549('0x32')][_0x4549('0x43')]){_0xb965bf[_0x4549('0x44')]=[{'all':!![]}];}return db[_0x4549('0x2d')][_0x4549('0x45')](_0xb965bf);})['then'](function(_0x2d7bf8){_0x227fa0[_0x4549('0x46')]=_0x2d7bf8;return _0x227fa0;})[_0x4549('0x25')](respondWithFilteredResult(_0x547628,_0xb965bf))[_0x4549('0x47')](handleError(_0x547628,null));};exports[_0x4549('0x48')]=function(_0x157a9b,_0xbe3ad8){var _0x5e062b={'raw':!![],'where':{'id':_0x157a9b['params']['id']}},_0x1911e2={};_0x1911e2[_0x4549('0x31')]=_[_0x4549('0x33')](db[_0x4549('0x2d')][_0x4549('0x49')]);_0x1911e2['query']=_['keys'](_0x157a9b[_0x4549('0x32')]);_0x1911e2[_0x4549('0x34')]=_[_0x4549('0x35')](_0x1911e2[_0x4549('0x31')],_0x1911e2[_0x4549('0x32')]);_0x5e062b['attributes']=_['intersection'](_0x1911e2['model'],qs[_0x4549('0x36')](_0x157a9b['query'][_0x4549('0x36')]));_0x5e062b[_0x4549('0x37')]=_0x5e062b['attributes']['length']?_0x5e062b[_0x4549('0x37')]:_0x1911e2[_0x4549('0x31')];if(_0x157a9b[_0x4549('0x32')]['includeAll']){_0x5e062b[_0x4549('0x44')]=[{'all':!![]}];}_0x5e062b=_[_0x4549('0x40')]({},_0x5e062b,_0x157a9b[_0x4549('0x41')]);return db['OpenchannelQueueReport'][_0x4549('0x4a')](_0x5e062b)[_0x4549('0x25')](handleEntityNotFound(_0xbe3ad8,null))[_0x4549('0x25')](respondWithResult(_0xbe3ad8,null))[_0x4549('0x47')](handleError(_0xbe3ad8,null));};exports[_0x4549('0x4b')]=function(_0x4e9bdf,_0x36baa9){return db[_0x4549('0x2d')][_0x4549('0x4b')](_0x4e9bdf[_0x4549('0x4c')],{})[_0x4549('0x25')](respondWithResult(_0x36baa9,0xc9))['catch'](handleError(_0x36baa9,null));};exports[_0x4549('0x23')]=function(_0x3eadac,_0x314730){if(_0x3eadac['body']['id']){delete _0x3eadac[_0x4549('0x4c')]['id'];}return db['OpenchannelQueueReport'][_0x4549('0x4a')]({'where':{'id':_0x3eadac[_0x4549('0x4d')]['id']}})[_0x4549('0x25')](handleEntityNotFound(_0x314730,null))[_0x4549('0x25')](saveUpdates(_0x3eadac[_0x4549('0x4c')],null))[_0x4549('0x25')](respondWithResult(_0x314730,null))[_0x4549('0x47')](handleError(_0x314730,null));};exports['destroy']=function(_0x581089,_0xced3b){return db[_0x4549('0x2d')][_0x4549('0x4a')]({'where':{'id':_0x581089[_0x4549('0x4d')]['id']}})[_0x4549('0x25')](handleEntityNotFound(_0xced3b,null))[_0x4549('0x25')](removeEntity(_0xced3b,null))[_0x4549('0x47')](handleError(_0xced3b,null));};exports[_0x4549('0x4e')]=function(_0x5672f,_0x11ad87){return db[_0x4549('0x2d')][_0x4549('0x4e')]()[_0x4549('0x25')](respondWithResult(_0x11ad87,null))[_0x4549('0x47')](handleError(_0x11ad87,null));};
\ No newline at end of file
index e6f60a2..f42ac34 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x814b,0x1a2));var _0xb814=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x814b[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x576be9,_0x5dd358){var _0x5b5e13=function(_0x4bd1c1){while(--_0x4bd1c1){_0x576be9['push'](_0x576be9['shift']());}};_0x5b5e13(++_0x5dd358);}(_0x2ef3,0xba));var _0x32ef=function(_0x3cf580,_0x50e65e){_0x3cf580=_0x3cf580-0x0;var _0x2ba171=_0x2ef3[_0x3cf580];return _0x2ba171;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 2e23dde..860c0a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09df=['info','request\x20sent','debug','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','catch','UpdateOpenchannelQueueReport','update','raw','where','limit','lodash','util','bluebird','../../mysqldb','rpc','../../config/environment','request','then'];(function(_0x2650f9,_0x21589b){var _0x18ddf3=function(_0x3eb74c){while(--_0x3eb74c){_0x2650f9['push'](_0x2650f9['shift']());}};_0x18ddf3(++_0x21589b);}(_0x09df,0x164));var _0xf09d=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x09df[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});}exports[_0xf09d('0xf')]=function(_0x57e3f8){var _0x38083e=this;return new Promise(function(_0xc4b380,_0x106fb0){return db[_0xf09d('0x10')][_0xf09d('0x11')](_0x57e3f8[_0xf09d('0x12')],{'raw':_0x57e3f8['options']?_0x57e3f8[_0xf09d('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xf09d('0x7')](function(_0x342e14){logger[_0xf09d('0x8')](_0xf09d('0xf'),_0x57e3f8);logger[_0xf09d('0xa')](_0xf09d('0xf'),_0x57e3f8,JSON['stringify'](_0x342e14));_0xc4b380(_0x342e14);})[_0xf09d('0x14')](function(_0x2ab436){logger[_0xf09d('0xb')](_0xf09d('0xf'),_0x2ab436[_0xf09d('0xe')],_0x57e3f8);_0x106fb0(_0x38083e[_0xf09d('0xb')](0x1f4,_0x2ab436[_0xf09d('0xe')]));});});};exports[_0xf09d('0x15')]=function(_0x507484){var _0x394934=this;return new Promise(function(_0x59f232,_0x383ff6){return db['OpenchannelQueueReport'][_0xf09d('0x16')](_0x507484[_0xf09d('0x12')],{'raw':_0x507484[_0xf09d('0x13')]?_0x507484[_0xf09d('0x13')][_0xf09d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507484[_0xf09d('0x13')]?_0x507484['options'][_0xf09d('0x18')]||null:null,'attributes':_0x507484[_0xf09d('0x13')]?_0x507484[_0xf09d('0x13')]['attributes']||null:null,'limit':_0x507484['options']?_0x507484['options'][_0xf09d('0x19')]||null:null})[_0xf09d('0x7')](function(_0x28eb98){logger[_0xf09d('0x8')](_0xf09d('0x15'),_0x507484);logger[_0xf09d('0xa')](_0xf09d('0x15'),_0x507484,JSON['stringify'](_0x28eb98));_0x59f232(_0x28eb98);})[_0xf09d('0x14')](function(_0x4b20f5){logger['error'](_0xf09d('0x15'),_0x4b20f5[_0xf09d('0xe')],_0x507484);_0x383ff6(_0x394934['error'](0x1f4,_0x4b20f5[_0xf09d('0xe')]));});});};
\ No newline at end of file
+var _0xd7a0=['where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','catch','CreateOpenchannelQueueReport','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','body'];(function(_0x4fae7c,_0x3ae08e){var _0x55e350=function(_0x54bcb6){while(--_0x54bcb6){_0x4fae7c['push'](_0x4fae7c['shift']());}};_0x55e350(++_0x3ae08e);}(_0xd7a0,0x163));var _0x0d7a=function(_0x4a7d06,_0x4cbb90){_0x4a7d06=_0x4a7d06-0x0;var _0x283136=_0xd7a0[_0x4a7d06];return _0x283136;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16461e,_0x22b404,_0x371b7d){return new BPromise(function(_0x1514ae,_0x55d585){return client[_0x0d7a('0xb')](_0x16461e,_0x371b7d)[_0x0d7a('0xc')](function(_0x450d42){logger[_0x0d7a('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'));logger[_0x0d7a('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'),JSON[_0x0d7a('0x10')](_0x450d42));if(_0x450d42[_0x0d7a('0x11')]){if(_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x12')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x22b404,_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x13')]);return _0x55d585(_0x450d42[_0x0d7a('0x11')]['message']);}logger[_0x0d7a('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x22b404,_0x450d42['error'][_0x0d7a('0x13')]);return _0x1514ae(_0x450d42['error'][_0x0d7a('0x13')]);}else{logger[_0x0d7a('0xd')](_0x0d7a('0x14'),_0x22b404,_0x0d7a('0xe'));_0x1514ae(_0x450d42['result'][_0x0d7a('0x13')]);}})[_0x0d7a('0x15')](function(_0x497cbb){logger[_0x0d7a('0x11')](_0x0d7a('0x14'),_0x22b404,_0x497cbb);_0x55d585(_0x497cbb);});});}exports[_0x0d7a('0x16')]=function(_0x406b0c){var _0x5c54a6=this;return new Promise(function(_0x2180fa,_0x4cfcdc){return db['OpenchannelQueueReport']['create'](_0x406b0c['body'],{'raw':_0x406b0c[_0x0d7a('0x17')]?_0x406b0c['options'][_0x0d7a('0x18')]===undefined?!![]:![]:!![]})[_0x0d7a('0xc')](function(_0x4c997f){logger[_0x0d7a('0xd')](_0x0d7a('0x16'),_0x406b0c);logger[_0x0d7a('0xf')](_0x0d7a('0x16'),_0x406b0c,JSON['stringify'](_0x4c997f));_0x2180fa(_0x4c997f);})[_0x0d7a('0x15')](function(_0x2c11b6){logger[_0x0d7a('0x11')]('CreateOpenchannelQueueReport',_0x2c11b6['message'],_0x406b0c);_0x4cfcdc(_0x5c54a6[_0x0d7a('0x11')](0x1f4,_0x2c11b6[_0x0d7a('0x13')]));});});};exports[_0x0d7a('0x19')]=function(_0x1944ba){var _0x9c73d4=this;return new Promise(function(_0x551171,_0x14670c){return db[_0x0d7a('0x1a')][_0x0d7a('0x1b')](_0x1944ba[_0x0d7a('0x1c')],{'raw':_0x1944ba['options']?_0x1944ba['options'][_0x0d7a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1944ba[_0x0d7a('0x17')]?_0x1944ba[_0x0d7a('0x17')][_0x0d7a('0x1d')]||null:null,'attributes':_0x1944ba[_0x0d7a('0x17')]?_0x1944ba[_0x0d7a('0x17')][_0x0d7a('0x1e')]||null:null,'limit':_0x1944ba[_0x0d7a('0x17')]?_0x1944ba['options'][_0x0d7a('0x1f')]||null:null})['then'](function(_0x33ce6c){logger[_0x0d7a('0xd')](_0x0d7a('0x19'),_0x1944ba);logger[_0x0d7a('0xf')](_0x0d7a('0x19'),_0x1944ba,JSON['stringify'](_0x33ce6c));_0x551171(_0x33ce6c);})[_0x0d7a('0x15')](function(_0xfc200a){logger[_0x0d7a('0x11')]('UpdateOpenchannelQueueReport',_0xfc200a[_0x0d7a('0x13')],_0x1944ba);_0x14670c(_0x9c73d4[_0x0d7a('0x11')](0x1f4,_0xfc200a['message']));});});};
\ No newline at end of file
index b2c34c6..30bfa3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16b1=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy'];(function(_0x7aee79,_0x124af2){var _0xcbf9d1=function(_0x3f9f5f){while(--_0x3f9f5f){_0x7aee79['push'](_0x7aee79['shift']());}};_0xcbf9d1(++_0x124af2);}(_0x16b1,0x99));var _0x116b=function(_0x17c5b8,_0x32ab0d){_0x17c5b8=_0x17c5b8-0x0;var _0x3706af=_0x16b1[_0x17c5b8];return _0x3706af;};'use strict';var multer=require('multer');var util=require(_0x116b('0x0'));var path=require('path');var timeout=require(_0x116b('0x1'));var express=require('express');var router=express[_0x116b('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x116b('0x3'));var config=require(_0x116b('0x4'));var controller=require(_0x116b('0x5'));router[_0x116b('0x6')]('/',auth[_0x116b('0x7')](),controller[_0x116b('0x8')]);router['get'](_0x116b('0x9'),auth[_0x116b('0x7')](),controller[_0x116b('0xa')]);router[_0x116b('0x6')](_0x116b('0xb'),auth['isAuthenticated'](),controller[_0x116b('0xc')]);router[_0x116b('0xd')]('/',auth[_0x116b('0x7')](),controller['create']);router['put'](_0x116b('0xb'),auth[_0x116b('0x7')](),controller[_0x116b('0xe')]);router[_0x116b('0xf')]('/:id',auth[_0x116b('0x7')](),controller[_0x116b('0x10')]);module['exports']=router;
\ No newline at end of file
+var _0x2c98=['../../config/environment','./openchannelTransferReport.controller','get','index','/describe','describe','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x216b45,_0x2e47d9){var _0x589b66=function(_0x275cbd){while(--_0x275cbd){_0x216b45['push'](_0x216b45['shift']());}};_0x589b66(++_0x2e47d9);}(_0x2c98,0xb0));var _0x82c9=function(_0x1eca81,_0x586160){_0x1eca81=_0x1eca81-0x0;var _0x353020=_0x2c98[_0x1eca81];return _0x353020;};'use strict';var multer=require('multer');var util=require(_0x82c9('0x0'));var path=require(_0x82c9('0x1'));var timeout=require(_0x82c9('0x2'));var express=require(_0x82c9('0x3'));var router=express[_0x82c9('0x4')]();var fs_extra=require(_0x82c9('0x5'));var auth=require(_0x82c9('0x6'));var interaction=require(_0x82c9('0x7'));var config=require(_0x82c9('0x8'));var controller=require(_0x82c9('0x9'));router[_0x82c9('0xa')]('/',auth['isAuthenticated'](),controller[_0x82c9('0xb')]);router[_0x82c9('0xa')](_0x82c9('0xc'),auth['isAuthenticated'](),controller[_0x82c9('0xd')]);router[_0x82c9('0xa')]('/:id',auth[_0x82c9('0xe')](),controller[_0x82c9('0xf')]);router[_0x82c9('0x10')]('/',auth['isAuthenticated'](),controller[_0x82c9('0x11')]);router[_0x82c9('0x12')]('/:id',auth[_0x82c9('0xe')](),controller[_0x82c9('0x13')]);router[_0x82c9('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x82c9('0x15')]);module[_0x82c9('0x16')]=router;
\ No newline at end of file
index ab56613..baed225 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xe43c53,_0x4cf46c){var _0x3491f3=function(_0x5cd71d){while(--_0x5cd71d){_0xe43c53['push'](_0xe43c53['shift']());}};_0x3491f3(++_0x4cf46c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0xcb91[_0x25fa5c];return _0x1bade2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}};
\ No newline at end of file
+var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x376705,_0x5d69bf){var _0x66fd62=function(_0x559a3d){while(--_0x559a3d){_0x376705['push'](_0x376705['shift']());}};_0x66fd62(++_0x5d69bf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00bb[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}};
\ No newline at end of file
index ce8cf17..9ac0c14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4629=['bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xc2c13a,_0x1070d3){var _0x2b8e2f=function(_0x3ebc15){while(--_0x3ebc15){_0xc2c13a['push'](_0xc2c13a['shift']());}};_0x2b8e2f(++_0x1070d3);}(_0x4629,0x95));var _0x9462=function(_0x117395,_0x555417){_0x117395=_0x117395-0x0;var _0x4fc350=_0x4629[_0x117395];return _0x4fc350;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9462('0x0'));var zipdir=require(_0x9462('0x1'));var jsonpatch=require(_0x9462('0x2'));var rp=require(_0x9462('0x3'));var moment=require(_0x9462('0x4'));var BPromise=require(_0x9462('0x5'));var Mustache=require(_0x9462('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9462('0x7'));var fs=require('fs');var fs_extra=require(_0x9462('0x8'));var _=require(_0x9462('0x9'));var squel=require(_0x9462('0xa'));var crypto=require(_0x9462('0xb'));var jsforce=require(_0x9462('0xc'));var deskjs=require(_0x9462('0xd'));var toCsv=require(_0x9462('0xe'));var querystring=require(_0x9462('0xf'));var Papa=require(_0x9462('0x10'));var Redis=require('ioredis');var authService=require(_0x9462('0x11'));var qs=require(_0x9462('0x12'));var as=require(_0x9462('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9462('0x14'))(_0x9462('0x15'));var utils=require(_0x9462('0x16'));var config=require(_0x9462('0x17'));var licenseUtil=require(_0x9462('0x18'));var db=require(_0x9462('0x19'))['db'];function respondWithStatusCode(_0x2b0043,_0x45d9ca){_0x45d9ca=_0x45d9ca||0xcc;return function(_0x11480b){if(_0x11480b){return _0x2b0043[_0x9462('0x1a')](_0x45d9ca);}return _0x2b0043[_0x9462('0x1b')](_0x45d9ca)[_0x9462('0x1c')]();};}function respondWithResult(_0x2cb606,_0x22952d){_0x22952d=_0x22952d||0xc8;return function(_0x5ecbae){if(_0x5ecbae){return _0x2cb606[_0x9462('0x1b')](_0x22952d)[_0x9462('0x1d')](_0x5ecbae);}};}function respondWithFilteredResult(_0x24780a,_0x485fc5){return function(_0x3e740d){if(_0x3e740d){var _0x39e47f=typeof _0x485fc5[_0x9462('0x1e')]===_0x9462('0x1f')&&typeof _0x485fc5['limit']===_0x9462('0x1f');var _0x24afe1=_0x3e740d[_0x9462('0x20')];var _0x2347d7=_0x39e47f?0x0:_0x485fc5[_0x9462('0x1e')];var _0x525c00=_0x39e47f?_0x3e740d[_0x9462('0x20')]:_0x485fc5[_0x9462('0x1e')]+_0x485fc5[_0x9462('0x21')];var _0x27cb4a;if(_0x525c00>=_0x24afe1){_0x525c00=_0x24afe1;_0x27cb4a=0xc8;}else{_0x27cb4a=0xce;}_0x24780a[_0x9462('0x1b')](_0x27cb4a);return _0x24780a[_0x9462('0x22')](_0x9462('0x23'),_0x2347d7+'-'+_0x525c00+'/'+_0x24afe1)['json'](_0x3e740d);}return null;};}function patchUpdates(_0x54f1e9){return function(_0x22d196){try{jsonpatch[_0x9462('0x24')](_0x22d196,_0x54f1e9,!![]);}catch(_0xa7aa83){return BPromise[_0x9462('0x25')](_0xa7aa83);}return _0x22d196[_0x9462('0x26')]();};}function saveUpdates(_0x371fa5,_0x30a101){return function(_0x234352){if(_0x234352){return _0x234352[_0x9462('0x27')](_0x371fa5)[_0x9462('0x28')](function(_0x1463e0){return _0x1463e0;});}return null;};}function removeEntity(_0x166081,_0x516b50){return function(_0x2648f9){if(_0x2648f9){return _0x2648f9[_0x9462('0x29')]()[_0x9462('0x28')](function(){_0x166081[_0x9462('0x1b')](0xcc)[_0x9462('0x1c')]();});}};}function handleEntityNotFound(_0x283542,_0x49da3){return function(_0x8bb3ff){if(!_0x8bb3ff){_0x283542[_0x9462('0x1a')](0x194);}return _0x8bb3ff;};}function handleError(_0x264698,_0xbd4771){_0xbd4771=_0xbd4771||0x1f4;return function(_0x12cd04){logger[_0x9462('0x2a')](_0x12cd04[_0x9462('0x2b')]);if(_0x12cd04[_0x9462('0x2c')]){delete _0x12cd04[_0x9462('0x2c')];}_0x264698['status'](_0xbd4771)['send'](_0x12cd04);};}exports[_0x9462('0x2d')]=function(_0x2281e6,_0x3a3a23){var _0x12742c={},_0x5028b6={},_0x5e1383={'count':0x0,'rows':[]};var _0xd6b437=_[_0x9462('0x2e')](db[_0x9462('0x2f')][_0x9462('0x30')],function(_0x795806){return{'name':_0x795806['fieldName'],'type':_0x795806[_0x9462('0x31')][_0x9462('0x32')]};});_0x5028b6['model']=_['map'](_0xd6b437,_0x9462('0x2c'));_0x5028b6['query']=_[_0x9462('0x33')](_0x2281e6[_0x9462('0x34')]);_0x5028b6[_0x9462('0x35')]=_['intersection'](_0x5028b6[_0x9462('0x36')],_0x5028b6[_0x9462('0x34')]);_0x12742c[_0x9462('0x37')]=_[_0x9462('0x38')](_0x5028b6[_0x9462('0x36')],qs['fields'](_0x2281e6['query'][_0x9462('0x39')]));_0x12742c[_0x9462('0x37')]=_0x12742c[_0x9462('0x37')][_0x9462('0x3a')]?_0x12742c[_0x9462('0x37')]:_0x5028b6[_0x9462('0x36')];if(!_0x2281e6[_0x9462('0x34')][_0x9462('0x3b')](_0x9462('0x3c'))){_0x12742c[_0x9462('0x21')]=qs[_0x9462('0x21')](_0x2281e6['query']['limit']);_0x12742c[_0x9462('0x1e')]=qs[_0x9462('0x1e')](_0x2281e6[_0x9462('0x34')][_0x9462('0x1e')]);}_0x12742c['order']=qs['sort'](_0x2281e6['query']['sort']);_0x12742c[_0x9462('0x3d')]=qs[_0x9462('0x35')](_['pick'](_0x2281e6['query'],_0x5028b6[_0x9462('0x35')]),_0xd6b437);if(_0x2281e6[_0x9462('0x34')]['filter']){_0x12742c[_0x9462('0x3d')]=_[_0x9462('0x3e')](_0x12742c['where'],{'$or':_[_0x9462('0x2e')](_0xd6b437,function(_0x1aaaec){if(_0x1aaaec[_0x9462('0x31')]!==_0x9462('0x3f')){var _0x385241={};_0x385241[_0x1aaaec['name']]={'$like':'%'+_0x2281e6[_0x9462('0x34')][_0x9462('0x40')]+'%'};return _0x385241;}})});}_0x12742c=_['merge']({},_0x12742c,_0x2281e6[_0x9462('0x41')]);var _0x3ee2fb={'where':_0x12742c[_0x9462('0x3d')]};return db[_0x9462('0x2f')]['count'](_0x3ee2fb)[_0x9462('0x28')](function(_0x2ab69b){_0x5e1383[_0x9462('0x20')]=_0x2ab69b;if(_0x2281e6['query']['includeAll']){_0x12742c[_0x9462('0x42')]=[{'all':!![]}];}return db[_0x9462('0x2f')][_0x9462('0x43')](_0x12742c);})[_0x9462('0x28')](function(_0x5186d7){_0x5e1383[_0x9462('0x44')]=_0x5186d7;return _0x5e1383;})[_0x9462('0x28')](respondWithFilteredResult(_0x3a3a23,_0x12742c))[_0x9462('0x45')](handleError(_0x3a3a23,null));};exports[_0x9462('0x46')]=function(_0x2bc1ad,_0x5204e7){var _0x4ca734={'raw':!![],'where':{'id':_0x2bc1ad[_0x9462('0x47')]['id']}},_0xa7d44c={};_0xa7d44c[_0x9462('0x36')]=_[_0x9462('0x33')](db[_0x9462('0x2f')][_0x9462('0x30')]);_0xa7d44c['query']=_[_0x9462('0x33')](_0x2bc1ad[_0x9462('0x34')]);_0xa7d44c[_0x9462('0x35')]=_[_0x9462('0x38')](_0xa7d44c[_0x9462('0x36')],_0xa7d44c[_0x9462('0x34')]);_0x4ca734['attributes']=_[_0x9462('0x38')](_0xa7d44c[_0x9462('0x36')],qs['fields'](_0x2bc1ad[_0x9462('0x34')][_0x9462('0x39')]));_0x4ca734[_0x9462('0x37')]=_0x4ca734['attributes'][_0x9462('0x3a')]?_0x4ca734[_0x9462('0x37')]:_0xa7d44c['model'];if(_0x2bc1ad[_0x9462('0x34')][_0x9462('0x48')]){_0x4ca734['include']=[{'all':!![]}];}_0x4ca734=_['merge']({},_0x4ca734,_0x2bc1ad[_0x9462('0x41')]);return db['OpenchannelTransferReport'][_0x9462('0x49')](_0x4ca734)[_0x9462('0x28')](handleEntityNotFound(_0x5204e7,null))['then'](respondWithResult(_0x5204e7,null))[_0x9462('0x45')](handleError(_0x5204e7,null));};exports[_0x9462('0x4a')]=function(_0x49da25,_0x55bcd3){return db[_0x9462('0x2f')][_0x9462('0x4a')](_0x49da25[_0x9462('0x4b')],{})[_0x9462('0x28')](respondWithResult(_0x55bcd3,0xc9))[_0x9462('0x45')](handleError(_0x55bcd3,null));};exports[_0x9462('0x27')]=function(_0x55128c,_0x3a919b){if(_0x55128c[_0x9462('0x4b')]['id']){delete _0x55128c[_0x9462('0x4b')]['id'];}return db[_0x9462('0x2f')][_0x9462('0x49')]({'where':{'id':_0x55128c['params']['id']}})[_0x9462('0x28')](handleEntityNotFound(_0x3a919b,null))[_0x9462('0x28')](saveUpdates(_0x55128c['body'],null))[_0x9462('0x28')](respondWithResult(_0x3a919b,null))[_0x9462('0x45')](handleError(_0x3a919b,null));};exports[_0x9462('0x29')]=function(_0xb537e8,_0xf64d27){return db[_0x9462('0x2f')]['find']({'where':{'id':_0xb537e8[_0x9462('0x47')]['id']}})['then'](handleEntityNotFound(_0xf64d27,null))[_0x9462('0x28')](removeEntity(_0xf64d27,null))[_0x9462('0x45')](handleError(_0xf64d27,null));};exports[_0x9462('0x4c')]=function(_0x28ef33,_0x1086f4){return db[_0x9462('0x2f')]['describe']()[_0x9462('0x28')](respondWithResult(_0x1086f4,null))[_0x9462('0x45')](handleError(_0x1086f4,null));};
\ No newline at end of file
+var _0x18bd=['end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','name','send','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','keys','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x379b8a,_0x29848f){var _0x19266a=function(_0x1aa8b8){while(--_0x1aa8b8){_0x379b8a['push'](_0x379b8a['shift']());}};_0x19266a(++_0x29848f);}(_0x18bd,0x1f3));var _0xd18b=function(_0x542df3,_0x22df83){_0x542df3=_0x542df3-0x0;var _0x14ba9a=_0x18bd[_0x542df3];return _0x14ba9a;};'use strict';var emlformat=require(_0xd18b('0x0'));var rimraf=require(_0xd18b('0x1'));var zipdir=require(_0xd18b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd18b('0x3'));var moment=require(_0xd18b('0x4'));var BPromise=require(_0xd18b('0x5'));var Mustache=require(_0xd18b('0x6'));var util=require(_0xd18b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd18b('0x8'));var ejs=require(_0xd18b('0x9'));var fs=require('fs');var fs_extra=require(_0xd18b('0xa'));var _=require(_0xd18b('0xb'));var squel=require(_0xd18b('0xc'));var crypto=require(_0xd18b('0xd'));var jsforce=require(_0xd18b('0xe'));var deskjs=require(_0xd18b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd18b('0x10'));var Papa=require('papaparse');var Redis=require(_0xd18b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd18b('0x12'));var as=require(_0xd18b('0x13'));var hardwareService=require(_0xd18b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd18b('0x15'));var config=require(_0xd18b('0x16'));var licenseUtil=require(_0xd18b('0x17'));var db=require(_0xd18b('0x18'))['db'];function respondWithStatusCode(_0xa8fd91,_0x428aa1){_0x428aa1=_0x428aa1||0xcc;return function(_0x57aba7){if(_0x57aba7){return _0xa8fd91['sendStatus'](_0x428aa1);}return _0xa8fd91[_0xd18b('0x19')](_0x428aa1)[_0xd18b('0x1a')]();};}function respondWithResult(_0x63ca,_0xca8642){_0xca8642=_0xca8642||0xc8;return function(_0x256ce3){if(_0x256ce3){return _0x63ca[_0xd18b('0x19')](_0xca8642)[_0xd18b('0x1b')](_0x256ce3);}};}function respondWithFilteredResult(_0x5e3724,_0x4eb471){return function(_0x55445e){if(_0x55445e){var _0x5d0257=typeof _0x4eb471[_0xd18b('0x1c')]===_0xd18b('0x1d')&&typeof _0x4eb471[_0xd18b('0x1e')]===_0xd18b('0x1d');var _0x402da5=_0x55445e['count'];var _0xa889f2=_0x5d0257?0x0:_0x4eb471[_0xd18b('0x1c')];var _0x1b9672=_0x5d0257?_0x55445e['count']:_0x4eb471[_0xd18b('0x1c')]+_0x4eb471['limit'];var _0x1b52f0;if(_0x1b9672>=_0x402da5){_0x1b9672=_0x402da5;_0x1b52f0=0xc8;}else{_0x1b52f0=0xce;}_0x5e3724[_0xd18b('0x19')](_0x1b52f0);return _0x5e3724[_0xd18b('0x1f')](_0xd18b('0x20'),_0xa889f2+'-'+_0x1b9672+'/'+_0x402da5)[_0xd18b('0x1b')](_0x55445e);}return null;};}function patchUpdates(_0x48ec45){return function(_0x4da576){try{jsonpatch[_0xd18b('0x21')](_0x4da576,_0x48ec45,!![]);}catch(_0x5d5bbb){return BPromise[_0xd18b('0x22')](_0x5d5bbb);}return _0x4da576[_0xd18b('0x23')]();};}function saveUpdates(_0x19c90d,_0x144cc5){return function(_0x5b13bc){if(_0x5b13bc){return _0x5b13bc[_0xd18b('0x24')](_0x19c90d)[_0xd18b('0x25')](function(_0x3ee2d1){return _0x3ee2d1;});}return null;};}function removeEntity(_0x14514e,_0x2d5bfc){return function(_0x438945){if(_0x438945){return _0x438945['destroy']()[_0xd18b('0x25')](function(){_0x14514e[_0xd18b('0x19')](0xcc)[_0xd18b('0x1a')]();});}};}function handleEntityNotFound(_0x528b86,_0x2b8adb){return function(_0xbb442){if(!_0xbb442){_0x528b86['sendStatus'](0x194);}return _0xbb442;};}function handleError(_0x1d7b09,_0x4dbc27){_0x4dbc27=_0x4dbc27||0x1f4;return function(_0x5073ea){logger['error'](_0x5073ea['stack']);if(_0x5073ea[_0xd18b('0x26')]){delete _0x5073ea['name'];}_0x1d7b09[_0xd18b('0x19')](_0x4dbc27)[_0xd18b('0x27')](_0x5073ea);};}exports['index']=function(_0x352a6,_0x5d3e20){var _0x3df6ab={},_0x4caa0e={},_0x42440f={'count':0x0,'rows':[]};var _0x1ba63f=_['map'](db[_0xd18b('0x28')][_0xd18b('0x29')],function(_0x273e6a){return{'name':_0x273e6a[_0xd18b('0x2a')],'type':_0x273e6a[_0xd18b('0x2b')][_0xd18b('0x2c')]};});_0x4caa0e[_0xd18b('0x2d')]=_[_0xd18b('0x2e')](_0x1ba63f,_0xd18b('0x26'));_0x4caa0e[_0xd18b('0x2f')]=_['keys'](_0x352a6['query']);_0x4caa0e['filters']=_[_0xd18b('0x30')](_0x4caa0e[_0xd18b('0x2d')],_0x4caa0e[_0xd18b('0x2f')]);_0x3df6ab[_0xd18b('0x31')]=_['intersection'](_0x4caa0e[_0xd18b('0x2d')],qs[_0xd18b('0x32')](_0x352a6[_0xd18b('0x2f')][_0xd18b('0x32')]));_0x3df6ab['attributes']=_0x3df6ab[_0xd18b('0x31')][_0xd18b('0x33')]?_0x3df6ab[_0xd18b('0x31')]:_0x4caa0e[_0xd18b('0x2d')];if(!_0x352a6[_0xd18b('0x2f')][_0xd18b('0x34')](_0xd18b('0x35'))){_0x3df6ab[_0xd18b('0x1e')]=qs[_0xd18b('0x1e')](_0x352a6[_0xd18b('0x2f')][_0xd18b('0x1e')]);_0x3df6ab[_0xd18b('0x1c')]=qs['offset'](_0x352a6[_0xd18b('0x2f')][_0xd18b('0x1c')]);}_0x3df6ab[_0xd18b('0x36')]=qs[_0xd18b('0x37')](_0x352a6[_0xd18b('0x2f')][_0xd18b('0x37')]);_0x3df6ab[_0xd18b('0x38')]=qs[_0xd18b('0x39')](_[_0xd18b('0x3a')](_0x352a6[_0xd18b('0x2f')],_0x4caa0e[_0xd18b('0x39')]),_0x1ba63f);if(_0x352a6[_0xd18b('0x2f')][_0xd18b('0x3b')]){_0x3df6ab[_0xd18b('0x38')]=_[_0xd18b('0x3c')](_0x3df6ab['where'],{'$or':_[_0xd18b('0x2e')](_0x1ba63f,function(_0x1516de){if(_0x1516de[_0xd18b('0x2b')]!=='VIRTUAL'){var _0x1bf82b={};_0x1bf82b[_0x1516de[_0xd18b('0x26')]]={'$like':'%'+_0x352a6[_0xd18b('0x2f')][_0xd18b('0x3b')]+'%'};return _0x1bf82b;}})});}_0x3df6ab=_['merge']({},_0x3df6ab,_0x352a6[_0xd18b('0x3d')]);var _0x5e46a1={'where':_0x3df6ab['where']};return db[_0xd18b('0x28')][_0xd18b('0x3e')](_0x5e46a1)[_0xd18b('0x25')](function(_0x2cd7d0){_0x42440f[_0xd18b('0x3e')]=_0x2cd7d0;if(_0x352a6['query'][_0xd18b('0x3f')]){_0x3df6ab[_0xd18b('0x40')]=[{'all':!![]}];}return db[_0xd18b('0x28')][_0xd18b('0x41')](_0x3df6ab);})[_0xd18b('0x25')](function(_0x4f547a){_0x42440f[_0xd18b('0x42')]=_0x4f547a;return _0x42440f;})[_0xd18b('0x25')](respondWithFilteredResult(_0x5d3e20,_0x3df6ab))['catch'](handleError(_0x5d3e20,null));};exports['show']=function(_0x2b09d5,_0x31a524){var _0x1fc937={'raw':!![],'where':{'id':_0x2b09d5[_0xd18b('0x43')]['id']}},_0x4fbcdf={};_0x4fbcdf[_0xd18b('0x2d')]=_[_0xd18b('0x44')](db[_0xd18b('0x28')][_0xd18b('0x29')]);_0x4fbcdf[_0xd18b('0x2f')]=_['keys'](_0x2b09d5['query']);_0x4fbcdf['filters']=_[_0xd18b('0x30')](_0x4fbcdf[_0xd18b('0x2d')],_0x4fbcdf[_0xd18b('0x2f')]);_0x1fc937[_0xd18b('0x31')]=_[_0xd18b('0x30')](_0x4fbcdf['model'],qs['fields'](_0x2b09d5[_0xd18b('0x2f')]['fields']));_0x1fc937[_0xd18b('0x31')]=_0x1fc937[_0xd18b('0x31')][_0xd18b('0x33')]?_0x1fc937[_0xd18b('0x31')]:_0x4fbcdf[_0xd18b('0x2d')];if(_0x2b09d5[_0xd18b('0x2f')][_0xd18b('0x3f')]){_0x1fc937['include']=[{'all':!![]}];}_0x1fc937=_[_0xd18b('0x3c')]({},_0x1fc937,_0x2b09d5[_0xd18b('0x3d')]);return db[_0xd18b('0x28')][_0xd18b('0x45')](_0x1fc937)[_0xd18b('0x25')](handleEntityNotFound(_0x31a524,null))[_0xd18b('0x25')](respondWithResult(_0x31a524,null))['catch'](handleError(_0x31a524,null));};exports[_0xd18b('0x46')]=function(_0x5e2750,_0x377236){return db[_0xd18b('0x28')][_0xd18b('0x46')](_0x5e2750[_0xd18b('0x47')],{})[_0xd18b('0x25')](respondWithResult(_0x377236,0xc9))[_0xd18b('0x48')](handleError(_0x377236,null));};exports[_0xd18b('0x24')]=function(_0x17d4d0,_0x4b47da){if(_0x17d4d0[_0xd18b('0x47')]['id']){delete _0x17d4d0[_0xd18b('0x47')]['id'];}return db['OpenchannelTransferReport'][_0xd18b('0x45')]({'where':{'id':_0x17d4d0[_0xd18b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b47da,null))[_0xd18b('0x25')](saveUpdates(_0x17d4d0[_0xd18b('0x47')],null))[_0xd18b('0x25')](respondWithResult(_0x4b47da,null))['catch'](handleError(_0x4b47da,null));};exports[_0xd18b('0x49')]=function(_0x120411,_0x379317){return db[_0xd18b('0x28')][_0xd18b('0x45')]({'where':{'id':_0x120411[_0xd18b('0x43')]['id']}})['then'](handleEntityNotFound(_0x379317,null))[_0xd18b('0x25')](removeEntity(_0x379317,null))['catch'](handleError(_0x379317,null));};exports[_0xd18b('0x4a')]=function(_0x15302d,_0x143bab){return db[_0xd18b('0x28')][_0xd18b('0x4a')]()['then'](respondWithResult(_0x143bab,null))[_0xd18b('0x48')](handleError(_0x143bab,null));};
\ No newline at end of file
index 135d681..4ff59be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86c0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x352443,_0x5be76c){var _0xd8fd68=function(_0x631cf0){while(--_0x631cf0){_0x352443['push'](_0x352443['shift']());}};_0xd8fd68(++_0x5be76c);}(_0x86c0,0x1a4));var _0x086c=function(_0x30165a,_0x11cb30){_0x30165a=_0x30165a-0x0;var _0x3e44eb=_0x86c0[_0x30165a];return _0x3e44eb;};'use strict';var _=require('lodash');var util=require(_0x086c('0x0'));var logger=require(_0x086c('0x1'))(_0x086c('0x2'));var moment=require(_0x086c('0x3'));var BPromise=require(_0x086c('0x4'));var rp=require(_0x086c('0x5'));var fs=require('fs');var path=require(_0x086c('0x6'));var rimraf=require(_0x086c('0x7'));var config=require('../../config/environment');var attributes=require(_0x086c('0x8'));module['exports']=function(_0x2d7dda,_0x5d2aa3){return _0x2d7dda['define'](_0x086c('0x9'),attributes,{'tableName':_0x086c('0xa'),'paranoid':![],'indexes':[{'name':_0x086c('0xb'),'fields':[_0x086c('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x8877=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x12728d,_0x32395e){var _0x15a6d3=function(_0x26d030){while(--_0x26d030){_0x12728d['push'](_0x12728d['shift']());}};_0x15a6d3(++_0x32395e);}(_0x8877,0x179));var _0x7887=function(_0xf3668b,_0x17bf5d){_0xf3668b=_0xf3668b-0x0;var _0x1007d2=_0x8877[_0xf3668b];return _0x1007d2;};'use strict';var _=require(_0x7887('0x0'));var util=require('util');var logger=require(_0x7887('0x1'))(_0x7887('0x2'));var moment=require(_0x7887('0x3'));var BPromise=require('bluebird');var rp=require(_0x7887('0x4'));var fs=require('fs');var path=require(_0x7887('0x5'));var rimraf=require(_0x7887('0x6'));var config=require(_0x7887('0x7'));var attributes=require(_0x7887('0x8'));module[_0x7887('0x9')]=function(_0x3069dd,_0x286f7a){return _0x3069dd['define'](_0x7887('0xa'),attributes,{'tableName':_0x7887('0xb'),'paranoid':![],'indexes':[{'name':_0x7887('0xc'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 62353d9..d435a8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2494=['../../config/utils','../../config/environment','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x489639,_0x1da4f6){var _0x481ed8=function(_0x13f8ca){while(--_0x13f8ca){_0x489639['push'](_0x489639['shift']());}};_0x481ed8(++_0x1da4f6);}(_0x2494,0x82));var _0x4249=function(_0x2d5131,_0x13e3c5){_0x2d5131=_0x2d5131-0x0;var _0x115dd6=_0x2494[_0x2d5131];return _0x115dd6;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var rs=require(_0x4249('0x3'));var fs=require('fs');var Redis=require(_0x4249('0x4'));var db=require(_0x4249('0x5'))['db'];var utils=require(_0x4249('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4249('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4249('0x8')][_0x4249('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed716a,_0x5b1b17,_0x326336){return new BPromise(function(_0x2b7934,_0x21060d){return client['request'](_0xed716a,_0x326336)['then'](function(_0x3efaa6){logger[_0x4249('0xa')](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));logger[_0x4249('0xd')](_0x4249('0xe'),_0x5b1b17,_0x4249('0xc'),JSON['stringify'](_0x3efaa6));if(_0x3efaa6['error']){if(_0x3efaa6[_0x4249('0xf')]['code']===0x1f4){logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6['error'][_0x4249('0x10')]);return _0x21060d(_0x3efaa6[_0x4249('0xf')]['message']);}logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);return _0x2b7934(_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);}else{logger['info'](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));_0x2b7934(_0x3efaa6['result'][_0x4249('0x10')]);}})['catch'](function(_0x501e9c){logger['error'](_0x4249('0xb'),_0x5b1b17,_0x501e9c);_0x21060d(_0x501e9c);});});}
\ No newline at end of file
+var _0xcb66=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x32f2b5,_0x3e7573){var _0x4acddb=function(_0x2358bb){while(--_0x2358bb){_0x32f2b5['push'](_0x32f2b5['shift']());}};_0x4acddb(++_0x3e7573);}(_0xcb66,0x19f));var _0x6cb6=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0xcb66[_0x20845e];return _0x28cf2b;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));var BPromise=require(_0x6cb6('0x2'));var rs=require(_0x6cb6('0x3'));var fs=require('fs');var Redis=require(_0x6cb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cb6('0x5'));var logger=require(_0x6cb6('0x6'))(_0x6cb6('0x7'));var config=require(_0x6cb6('0x8'));var jayson=require(_0x6cb6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x174f39,_0x1595c9,_0x1028b3){return new BPromise(function(_0x4145f2,_0x1d0ee9){return client[_0x6cb6('0xa')](_0x174f39,_0x1028b3)[_0x6cb6('0xb')](function(_0x2b8e56){logger[_0x6cb6('0xc')](_0x6cb6('0xd'),_0x1595c9,_0x6cb6('0xe'));logger[_0x6cb6('0xf')](_0x6cb6('0x10'),_0x1595c9,'request\x20sent',JSON['stringify'](_0x2b8e56));if(_0x2b8e56['error']){if(_0x2b8e56['error'][_0x6cb6('0x11')]===0x1f4){logger[_0x6cb6('0x12')](_0x6cb6('0xd'),_0x1595c9,_0x2b8e56[_0x6cb6('0x12')]['message']);return _0x1d0ee9(_0x2b8e56[_0x6cb6('0x12')][_0x6cb6('0x13')]);}logger['error'](_0x6cb6('0xd'),_0x1595c9,_0x2b8e56[_0x6cb6('0x12')]['message']);return _0x4145f2(_0x2b8e56[_0x6cb6('0x12')][_0x6cb6('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1595c9,'request\x20sent');_0x4145f2(_0x2b8e56['result'][_0x6cb6('0x13')]);}})[_0x6cb6('0x14')](function(_0x9c901a){logger[_0x6cb6('0x12')](_0x6cb6('0xd'),_0x1595c9,_0x9c901a);_0x1d0ee9(_0x9c901a);});});}
\ No newline at end of file
index 0c99717..1679b47 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe864=['/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe864,0x1ac));var _0x4e86=function(_0x485984,_0x5842d4){_0x485984=_0x485984-0x0;var _0x2586cb=_0xe864[_0x485984];return _0x2586cb;};'use strict';var multer=require(_0x4e86('0x0'));var util=require(_0x4e86('0x1'));var path=require(_0x4e86('0x2'));var timeout=require(_0x4e86('0x3'));var express=require(_0x4e86('0x4'));var router=express[_0x4e86('0x5')]();var fs_extra=require(_0x4e86('0x6'));var auth=require(_0x4e86('0x7'));var interaction=require(_0x4e86('0x8'));var config=require(_0x4e86('0x9'));var controller=require('./pause.controller');router[_0x4e86('0xa')]('/',auth['isAuthenticated'](),controller[_0x4e86('0xb')]);router[_0x4e86('0xa')](_0x4e86('0xc'),auth['isAuthenticated'](),controller[_0x4e86('0xd')]);router[_0x4e86('0xe')]('/',auth['isAuthenticated'](),controller[_0x4e86('0xf')]);router[_0x4e86('0x10')](_0x4e86('0xc'),auth[_0x4e86('0x11')](),controller[_0x4e86('0x12')]);router[_0x4e86('0x13')]('/:id',auth[_0x4e86('0x11')](),controller[_0x4e86('0x14')]);module[_0x4e86('0x15')]=router;
\ No newline at end of file
+var _0xd423=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','multer','util'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xd423,0x7c));var _0x3d42=function(_0x23288c,_0x7bcfcd){_0x23288c=_0x23288c-0x0;var _0x1305a6=_0xd423[_0x23288c];return _0x1305a6;};'use strict';var multer=require(_0x3d42('0x0'));var util=require(_0x3d42('0x1'));var path=require(_0x3d42('0x2'));var timeout=require(_0x3d42('0x3'));var express=require(_0x3d42('0x4'));var router=express[_0x3d42('0x5')]();var fs_extra=require(_0x3d42('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3d42('0x7'));var config=require(_0x3d42('0x8'));var controller=require(_0x3d42('0x9'));router[_0x3d42('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d42('0xa')](_0x3d42('0xb'),auth[_0x3d42('0xc')](),controller[_0x3d42('0xd')]);router[_0x3d42('0xe')]('/',auth[_0x3d42('0xc')](),controller['create']);router[_0x3d42('0xf')]('/:id',auth[_0x3d42('0xc')](),controller['update']);router[_0x3d42('0x10')](_0x3d42('0xb'),auth[_0x3d42('0xc')](),controller[_0x3d42('0x11')]);module['exports']=router;
\ No newline at end of file
index 9fcf785..d00f6c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0944=['sequelize','exports','STRING','name'];(function(_0x3b9a4b,_0xec3ca2){var _0x46cada=function(_0x2b2865){while(--_0x2b2865){_0x3b9a4b['push'](_0x3b9a4b['shift']());}};_0x46cada(++_0xec3ca2);}(_0x0944,0xcc));var _0x4094=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x0944[_0x4653f7];return _0x5454da;};'use strict';var Sequelize=require(_0x4094('0x0'));module[_0x4094('0x1')]={'name':{'type':Sequelize[_0x4094('0x2')],'unique':_0x4094('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4094('0x2')]}};
\ No newline at end of file
+var _0xca67=['sequelize','STRING','name'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xca67,0xae));var _0x7ca6=function(_0x196958,_0x27d26c){_0x196958=_0x196958-0x0;var _0x10ccfb=_0xca67[_0x196958];return _0x10ccfb;};'use strict';var Sequelize=require(_0x7ca6('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ca6('0x1')],'unique':_0x7ca6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7ca6('0x1')]}};
\ No newline at end of file
index 8014bc2..c024e29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca15=['Pauses','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','then','destroy'];(function(_0x278646,_0x25736a){var _0x1bba75=function(_0x5ca68a){while(--_0x5ca68a){_0x278646['push'](_0x278646['shift']());}};_0x1bba75(++_0x25736a);}(_0xca15,0x81));var _0x5ca1=function(_0x181aa4,_0x59aaca){_0x181aa4=_0x181aa4-0x0;var _0x3ac631=_0xca15[_0x181aa4];return _0x3ac631;};'use strict';var emlformat=require(_0x5ca1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ca1('0x1'));var jsonpatch=require(_0x5ca1('0x2'));var rp=require(_0x5ca1('0x3'));var moment=require(_0x5ca1('0x4'));var BPromise=require(_0x5ca1('0x5'));var Mustache=require(_0x5ca1('0x6'));var util=require(_0x5ca1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5ca1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ca1('0x9'));var _=require(_0x5ca1('0xa'));var squel=require(_0x5ca1('0xb'));var crypto=require(_0x5ca1('0xc'));var jsforce=require(_0x5ca1('0xd'));var deskjs=require(_0x5ca1('0xe'));var toCsv=require(_0x5ca1('0x8'));var querystring=require('querystring');var Papa=require(_0x5ca1('0xf'));var Redis=require(_0x5ca1('0x10'));var authService=require(_0x5ca1('0x11'));var qs=require(_0x5ca1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ca1('0x13'));var logger=require(_0x5ca1('0x14'))(_0x5ca1('0x15'));var utils=require(_0x5ca1('0x16'));var config=require(_0x5ca1('0x17'));var licenseUtil=require(_0x5ca1('0x18'));var db=require(_0x5ca1('0x19'))['db'];function respondWithStatusCode(_0x1ad692,_0x286a27){_0x286a27=_0x286a27||0xcc;return function(_0x505951){if(_0x505951){return _0x1ad692[_0x5ca1('0x1a')](_0x286a27);}return _0x1ad692['status'](_0x286a27)[_0x5ca1('0x1b')]();};}function respondWithResult(_0x3ab522,_0x1ee24e){_0x1ee24e=_0x1ee24e||0xc8;return function(_0x28f5c3){if(_0x28f5c3){return _0x3ab522['status'](_0x1ee24e)[_0x5ca1('0x1c')](_0x28f5c3);}};}function respondWithFilteredResult(_0x54bac0,_0x49708e){return function(_0x4ebe74){if(_0x4ebe74){var _0x45f240=typeof _0x49708e[_0x5ca1('0x1d')]===_0x5ca1('0x1e')&&typeof _0x49708e[_0x5ca1('0x1f')]===_0x5ca1('0x1e');var _0x2c91ad=_0x4ebe74[_0x5ca1('0x20')];var _0x4c417c=_0x45f240?0x0:_0x49708e[_0x5ca1('0x1d')];var _0x3c34d2=_0x45f240?_0x4ebe74[_0x5ca1('0x20')]:_0x49708e[_0x5ca1('0x1d')]+_0x49708e[_0x5ca1('0x1f')];var _0x144b15;if(_0x3c34d2>=_0x2c91ad){_0x3c34d2=_0x2c91ad;_0x144b15=0xc8;}else{_0x144b15=0xce;}_0x54bac0[_0x5ca1('0x21')](_0x144b15);return _0x54bac0['set'](_0x5ca1('0x22'),_0x4c417c+'-'+_0x3c34d2+'/'+_0x2c91ad)[_0x5ca1('0x1c')](_0x4ebe74);}return null;};}function patchUpdates(_0x525252){return function(_0x53b38b){try{jsonpatch[_0x5ca1('0x23')](_0x53b38b,_0x525252,!![]);}catch(_0x32ff6d){return BPromise[_0x5ca1('0x24')](_0x32ff6d);}return _0x53b38b['save']();};}function saveUpdates(_0x2c8987,_0x891064){return function(_0x2f84b7){if(_0x2f84b7){return _0x2f84b7['update'](_0x2c8987)[_0x5ca1('0x25')](function(_0x24162d){return _0x24162d;});}return null;};}function removeEntity(_0x348d87,_0x103813){return function(_0x50a36c){if(_0x50a36c){return _0x50a36c[_0x5ca1('0x26')]()[_0x5ca1('0x25')](function(){var _0x3089ea=_0x50a36c['get']({'plain':!![]});var _0x46a5aa=_0x5ca1('0x27');return db[_0x5ca1('0x28')][_0x5ca1('0x26')]({'where':{'type':_0x46a5aa,'resourceId':_0x3089ea['id']}})[_0x5ca1('0x25')](function(){return _0x50a36c;});})[_0x5ca1('0x25')](function(){_0x348d87[_0x5ca1('0x21')](0xcc)[_0x5ca1('0x1b')]();});}};}function handleEntityNotFound(_0x43c541,_0x3fc2ac){return function(_0x165cad){if(!_0x165cad){_0x43c541['sendStatus'](0x194);}return _0x165cad;};}function handleError(_0x228298,_0x1e4d0c){_0x1e4d0c=_0x1e4d0c||0x1f4;return function(_0x2ff4f2){logger['error'](_0x2ff4f2['stack']);if(_0x2ff4f2[_0x5ca1('0x29')]){delete _0x2ff4f2[_0x5ca1('0x29')];}_0x228298[_0x5ca1('0x21')](_0x1e4d0c)[_0x5ca1('0x2a')](_0x2ff4f2);};}exports[_0x5ca1('0x2b')]=function(_0x418fd7,_0x1b707e){var _0x45124e={},_0x1012f7={},_0x1ccfce={'count':0x0,'rows':[]};var _0x340515=_[_0x5ca1('0x2c')](db[_0x5ca1('0x2d')][_0x5ca1('0x2e')],function(_0x33e8e2){return{'name':_0x33e8e2[_0x5ca1('0x2f')],'type':_0x33e8e2[_0x5ca1('0x30')][_0x5ca1('0x31')]};});_0x1012f7[_0x5ca1('0x32')]=_[_0x5ca1('0x2c')](_0x340515,'name');_0x1012f7[_0x5ca1('0x33')]=_[_0x5ca1('0x34')](_0x418fd7[_0x5ca1('0x33')]);_0x1012f7[_0x5ca1('0x35')]=_['intersection'](_0x1012f7[_0x5ca1('0x32')],_0x1012f7['query']);_0x45124e[_0x5ca1('0x36')]=_[_0x5ca1('0x37')](_0x1012f7[_0x5ca1('0x32')],qs['fields'](_0x418fd7[_0x5ca1('0x33')][_0x5ca1('0x38')]));_0x45124e[_0x5ca1('0x36')]=_0x45124e[_0x5ca1('0x36')][_0x5ca1('0x39')]?_0x45124e[_0x5ca1('0x36')]:_0x1012f7['model'];if(!_0x418fd7[_0x5ca1('0x33')][_0x5ca1('0x3a')](_0x5ca1('0x3b'))){_0x45124e[_0x5ca1('0x1f')]=qs['limit'](_0x418fd7['query'][_0x5ca1('0x1f')]);_0x45124e[_0x5ca1('0x1d')]=qs[_0x5ca1('0x1d')](_0x418fd7[_0x5ca1('0x33')][_0x5ca1('0x1d')]);}_0x45124e['order']=qs['sort'](_0x418fd7[_0x5ca1('0x33')][_0x5ca1('0x3c')]);_0x45124e[_0x5ca1('0x3d')]=qs[_0x5ca1('0x35')](_['pick'](_0x418fd7[_0x5ca1('0x33')],_0x1012f7['filters']),_0x340515);if(_0x418fd7[_0x5ca1('0x33')][_0x5ca1('0x3e')]){_0x45124e[_0x5ca1('0x3d')]=_[_0x5ca1('0x3f')](_0x45124e[_0x5ca1('0x3d')],{'$or':_[_0x5ca1('0x2c')](_0x340515,function(_0x3f46a2){if(_0x3f46a2[_0x5ca1('0x30')]!==_0x5ca1('0x40')){var _0x8fd84d={};_0x8fd84d[_0x3f46a2[_0x5ca1('0x29')]]={'$like':'%'+_0x418fd7[_0x5ca1('0x33')]['filter']+'%'};return _0x8fd84d;}})});}_0x45124e=_[_0x5ca1('0x3f')]({},_0x45124e,_0x418fd7[_0x5ca1('0x41')]);var _0x38dd7e={'where':_0x45124e[_0x5ca1('0x3d')]};return db[_0x5ca1('0x2d')][_0x5ca1('0x20')](_0x38dd7e)[_0x5ca1('0x25')](function(_0x3c8fed){_0x1ccfce[_0x5ca1('0x20')]=_0x3c8fed;if(_0x418fd7[_0x5ca1('0x33')]['includeAll']){_0x45124e['include']=[{'all':!![]}];}return db[_0x5ca1('0x2d')][_0x5ca1('0x42')](_0x45124e);})[_0x5ca1('0x25')](function(_0x1e4fe2){_0x1ccfce[_0x5ca1('0x43')]=_0x1e4fe2;return _0x1ccfce;})[_0x5ca1('0x25')](respondWithFilteredResult(_0x1b707e,_0x45124e))[_0x5ca1('0x44')](handleError(_0x1b707e,null));};exports[_0x5ca1('0x45')]=function(_0x3157d1,_0x56f962){var _0xf59fe2={'raw':!![],'where':{'id':_0x3157d1[_0x5ca1('0x46')]['id']}},_0x54b813={};_0x54b813[_0x5ca1('0x32')]=_[_0x5ca1('0x34')](db['Pause'][_0x5ca1('0x2e')]);_0x54b813[_0x5ca1('0x33')]=_[_0x5ca1('0x34')](_0x3157d1['query']);_0x54b813[_0x5ca1('0x35')]=_['intersection'](_0x54b813[_0x5ca1('0x32')],_0x54b813[_0x5ca1('0x33')]);_0xf59fe2[_0x5ca1('0x36')]=_[_0x5ca1('0x37')](_0x54b813[_0x5ca1('0x32')],qs['fields'](_0x3157d1[_0x5ca1('0x33')]['fields']));_0xf59fe2[_0x5ca1('0x36')]=_0xf59fe2[_0x5ca1('0x36')]['length']?_0xf59fe2[_0x5ca1('0x36')]:_0x54b813[_0x5ca1('0x32')];if(_0x3157d1[_0x5ca1('0x33')][_0x5ca1('0x47')]){_0xf59fe2[_0x5ca1('0x48')]=[{'all':!![]}];}_0xf59fe2=_[_0x5ca1('0x3f')]({},_0xf59fe2,_0x3157d1[_0x5ca1('0x41')]);return db[_0x5ca1('0x2d')]['find'](_0xf59fe2)[_0x5ca1('0x25')](handleEntityNotFound(_0x56f962,null))[_0x5ca1('0x25')](respondWithResult(_0x56f962,null))['catch'](handleError(_0x56f962,null));};exports[_0x5ca1('0x49')]=function(_0x5dc58d,_0x16d734){return db['Pause'][_0x5ca1('0x49')](_0x5dc58d[_0x5ca1('0x4a')],{})[_0x5ca1('0x25')](function(_0x35bb2b){var _0x882ee8=_0x5dc58d[_0x5ca1('0x4b')]['get']({'plain':!![]});if(!_0x882ee8)throw new Error(_0x5ca1('0x4c'));if(_0x882ee8[_0x5ca1('0x4d')]===_0x5ca1('0x4b')){var _0x59357e=_0x35bb2b[_0x5ca1('0x4e')]({'plain':!![]});var _0x518916=_0x5ca1('0x27');return db['UserProfileSection'][_0x5ca1('0x4f')]({'where':{'name':_0x518916,'userProfileId':_0x882ee8[_0x5ca1('0x50')]},'raw':!![]})['then'](function(_0x5d7bbc){if(_0x5d7bbc&&_0x5d7bbc['autoAssociation']===0x0){return db[_0x5ca1('0x28')][_0x5ca1('0x49')]({'name':_0x59357e['name'],'resourceId':_0x59357e['id'],'type':_0x5d7bbc[_0x5ca1('0x29')],'sectionId':_0x5d7bbc['id']},{})['then'](function(){return _0x35bb2b;});}else{return _0x35bb2b;}})['catch'](function(_0xe4a0f4){logger[_0x5ca1('0x51')](_0x5ca1('0x52'),_0xe4a0f4);throw _0xe4a0f4;});}return _0x35bb2b;})[_0x5ca1('0x25')](respondWithResult(_0x16d734,0xc9))['catch'](handleError(_0x16d734,null));};exports[_0x5ca1('0x53')]=function(_0x3610e0,_0x4005e1){if(_0x3610e0[_0x5ca1('0x4a')]['id']){delete _0x3610e0[_0x5ca1('0x4a')]['id'];}return db[_0x5ca1('0x2d')][_0x5ca1('0x4f')]({'where':{'id':_0x3610e0[_0x5ca1('0x46')]['id']}})[_0x5ca1('0x25')](handleEntityNotFound(_0x4005e1,null))['then'](saveUpdates(_0x3610e0[_0x5ca1('0x4a')],null))['then'](respondWithResult(_0x4005e1,null))[_0x5ca1('0x44')](handleError(_0x4005e1,null));};exports[_0x5ca1('0x26')]=function(_0x590c1e,_0x74ea70){return db[_0x5ca1('0x2d')][_0x5ca1('0x4f')]({'where':{'id':_0x590c1e['params']['id']}})[_0x5ca1('0x25')](handleEntityNotFound(_0x74ea70,null))[_0x5ca1('0x25')](removeEntity(_0x74ea70,null))['catch'](handleError(_0x74ea70,null));};
\ No newline at end of file
+var _0xc3f5=['sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','then','destroy','Pauses','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Pause','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xc3f5,0xe4));var _0x5c3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc3f5[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x5c3f('0x0'));var rimraf=require(_0x5c3f('0x1'));var zipdir=require(_0x5c3f('0x2'));var jsonpatch=require(_0x5c3f('0x3'));var rp=require(_0x5c3f('0x4'));var moment=require(_0x5c3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c3f('0x6'));var util=require(_0x5c3f('0x7'));var path=require(_0x5c3f('0x8'));var sox=require(_0x5c3f('0x9'));var csv=require(_0x5c3f('0xa'));var ejs=require(_0x5c3f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c3f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5c3f('0xd'));var deskjs=require(_0x5c3f('0xe'));var toCsv=require(_0x5c3f('0xa'));var querystring=require(_0x5c3f('0xf'));var Papa=require(_0x5c3f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c3f('0x11'));var as=require(_0x5c3f('0x12'));var hardwareService=require(_0x5c3f('0x13'));var logger=require(_0x5c3f('0x14'))(_0x5c3f('0x15'));var utils=require(_0x5c3f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5c3f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d3ad,_0x7bf717){_0x7bf717=_0x7bf717||0xcc;return function(_0x397158){if(_0x397158){return _0x25d3ad[_0x5c3f('0x18')](_0x7bf717);}return _0x25d3ad[_0x5c3f('0x19')](_0x7bf717)[_0x5c3f('0x1a')]();};}function respondWithResult(_0x44a01a,_0x4dc10e){_0x4dc10e=_0x4dc10e||0xc8;return function(_0x34bf39){if(_0x34bf39){return _0x44a01a[_0x5c3f('0x19')](_0x4dc10e)[_0x5c3f('0x1b')](_0x34bf39);}};}function respondWithFilteredResult(_0x31975c,_0x3181bf){return function(_0x42c92e){if(_0x42c92e){var _0x5a19e2=typeof _0x3181bf['offset']==='undefined'&&typeof _0x3181bf[_0x5c3f('0x1c')]===_0x5c3f('0x1d');var _0x2d054a=_0x42c92e[_0x5c3f('0x1e')];var _0x218e53=_0x5a19e2?0x0:_0x3181bf[_0x5c3f('0x1f')];var _0xda67ff=_0x5a19e2?_0x42c92e[_0x5c3f('0x1e')]:_0x3181bf[_0x5c3f('0x1f')]+_0x3181bf[_0x5c3f('0x1c')];var _0x5eab81;if(_0xda67ff>=_0x2d054a){_0xda67ff=_0x2d054a;_0x5eab81=0xc8;}else{_0x5eab81=0xce;}_0x31975c[_0x5c3f('0x19')](_0x5eab81);return _0x31975c[_0x5c3f('0x20')]('Content-Range',_0x218e53+'-'+_0xda67ff+'/'+_0x2d054a)['json'](_0x42c92e);}return null;};}function patchUpdates(_0x2681c6){return function(_0x18afc7){try{jsonpatch['apply'](_0x18afc7,_0x2681c6,!![]);}catch(_0x3c1bae){return BPromise[_0x5c3f('0x21')](_0x3c1bae);}return _0x18afc7[_0x5c3f('0x22')]();};}function saveUpdates(_0x57229d,_0x1e3604){return function(_0x290c14){if(_0x290c14){return _0x290c14[_0x5c3f('0x23')](_0x57229d)[_0x5c3f('0x24')](function(_0x2b5cc8){return _0x2b5cc8;});}return null;};}function removeEntity(_0x5e20c6,_0x289cba){return function(_0x382c32){if(_0x382c32){return _0x382c32[_0x5c3f('0x25')]()[_0x5c3f('0x24')](function(){var _0x363367=_0x382c32['get']({'plain':!![]});var _0x224bf2=_0x5c3f('0x26');return db['UserProfileResource'][_0x5c3f('0x25')]({'where':{'type':_0x224bf2,'resourceId':_0x363367['id']}})[_0x5c3f('0x24')](function(){return _0x382c32;});})[_0x5c3f('0x24')](function(){_0x5e20c6['status'](0xcc)[_0x5c3f('0x1a')]();});}};}function handleEntityNotFound(_0x41d04b,_0x1141f1){return function(_0x4f4132){if(!_0x4f4132){_0x41d04b[_0x5c3f('0x18')](0x194);}return _0x4f4132;};}function handleError(_0x4fe03a,_0x2267d0){_0x2267d0=_0x2267d0||0x1f4;return function(_0x2fdd93){logger['error'](_0x2fdd93[_0x5c3f('0x27')]);if(_0x2fdd93[_0x5c3f('0x28')]){delete _0x2fdd93['name'];}_0x4fe03a[_0x5c3f('0x19')](_0x2267d0)[_0x5c3f('0x29')](_0x2fdd93);};}exports[_0x5c3f('0x2a')]=function(_0x758330,_0x1af9b2){var _0x18b60f={},_0x3ad200={},_0x5867b1={'count':0x0,'rows':[]};var _0x1eb1ce=_[_0x5c3f('0x2b')](db['Pause'][_0x5c3f('0x2c')],function(_0x4d56b4){return{'name':_0x4d56b4[_0x5c3f('0x2d')],'type':_0x4d56b4[_0x5c3f('0x2e')][_0x5c3f('0x2f')]};});_0x3ad200[_0x5c3f('0x30')]=_[_0x5c3f('0x2b')](_0x1eb1ce,_0x5c3f('0x28'));_0x3ad200[_0x5c3f('0x31')]=_[_0x5c3f('0x32')](_0x758330[_0x5c3f('0x31')]);_0x3ad200[_0x5c3f('0x33')]=_[_0x5c3f('0x34')](_0x3ad200[_0x5c3f('0x30')],_0x3ad200[_0x5c3f('0x31')]);_0x18b60f[_0x5c3f('0x35')]=_[_0x5c3f('0x34')](_0x3ad200[_0x5c3f('0x30')],qs[_0x5c3f('0x36')](_0x758330['query'][_0x5c3f('0x36')]));_0x18b60f['attributes']=_0x18b60f[_0x5c3f('0x35')][_0x5c3f('0x37')]?_0x18b60f[_0x5c3f('0x35')]:_0x3ad200[_0x5c3f('0x30')];if(!_0x758330[_0x5c3f('0x31')][_0x5c3f('0x38')](_0x5c3f('0x39'))){_0x18b60f[_0x5c3f('0x1c')]=qs[_0x5c3f('0x1c')](_0x758330[_0x5c3f('0x31')][_0x5c3f('0x1c')]);_0x18b60f[_0x5c3f('0x1f')]=qs[_0x5c3f('0x1f')](_0x758330[_0x5c3f('0x31')][_0x5c3f('0x1f')]);}_0x18b60f[_0x5c3f('0x3a')]=qs['sort'](_0x758330[_0x5c3f('0x31')][_0x5c3f('0x3b')]);_0x18b60f[_0x5c3f('0x3c')]=qs[_0x5c3f('0x33')](_[_0x5c3f('0x3d')](_0x758330['query'],_0x3ad200[_0x5c3f('0x33')]),_0x1eb1ce);if(_0x758330[_0x5c3f('0x31')][_0x5c3f('0x3e')]){_0x18b60f[_0x5c3f('0x3c')]=_[_0x5c3f('0x3f')](_0x18b60f[_0x5c3f('0x3c')],{'$or':_[_0x5c3f('0x2b')](_0x1eb1ce,function(_0x34cf43){if(_0x34cf43['type']!=='VIRTUAL'){var _0x55bf2b={};_0x55bf2b[_0x34cf43['name']]={'$like':'%'+_0x758330['query'][_0x5c3f('0x3e')]+'%'};return _0x55bf2b;}})});}_0x18b60f=_[_0x5c3f('0x3f')]({},_0x18b60f,_0x758330[_0x5c3f('0x40')]);var _0x47b215={'where':_0x18b60f[_0x5c3f('0x3c')]};return db[_0x5c3f('0x41')][_0x5c3f('0x1e')](_0x47b215)[_0x5c3f('0x24')](function(_0x4ff61f){_0x5867b1[_0x5c3f('0x1e')]=_0x4ff61f;if(_0x758330[_0x5c3f('0x31')][_0x5c3f('0x42')]){_0x18b60f[_0x5c3f('0x43')]=[{'all':!![]}];}return db[_0x5c3f('0x41')]['findAll'](_0x18b60f);})[_0x5c3f('0x24')](function(_0xedb070){_0x5867b1[_0x5c3f('0x44')]=_0xedb070;return _0x5867b1;})[_0x5c3f('0x24')](respondWithFilteredResult(_0x1af9b2,_0x18b60f))[_0x5c3f('0x45')](handleError(_0x1af9b2,null));};exports[_0x5c3f('0x46')]=function(_0x56c678,_0x420a5b){var _0x360764={'raw':!![],'where':{'id':_0x56c678[_0x5c3f('0x47')]['id']}},_0x2f7984={};_0x2f7984['model']=_['keys'](db['Pause'][_0x5c3f('0x2c')]);_0x2f7984['query']=_[_0x5c3f('0x32')](_0x56c678[_0x5c3f('0x31')]);_0x2f7984[_0x5c3f('0x33')]=_['intersection'](_0x2f7984[_0x5c3f('0x30')],_0x2f7984[_0x5c3f('0x31')]);_0x360764[_0x5c3f('0x35')]=_[_0x5c3f('0x34')](_0x2f7984[_0x5c3f('0x30')],qs[_0x5c3f('0x36')](_0x56c678[_0x5c3f('0x31')][_0x5c3f('0x36')]));_0x360764['attributes']=_0x360764[_0x5c3f('0x35')][_0x5c3f('0x37')]?_0x360764[_0x5c3f('0x35')]:_0x2f7984[_0x5c3f('0x30')];if(_0x56c678['query']['includeAll']){_0x360764['include']=[{'all':!![]}];}_0x360764=_[_0x5c3f('0x3f')]({},_0x360764,_0x56c678['options']);return db[_0x5c3f('0x41')][_0x5c3f('0x48')](_0x360764)['then'](handleEntityNotFound(_0x420a5b,null))[_0x5c3f('0x24')](respondWithResult(_0x420a5b,null))[_0x5c3f('0x45')](handleError(_0x420a5b,null));};exports['create']=function(_0x133e34,_0xbf8f70){return db[_0x5c3f('0x41')][_0x5c3f('0x49')](_0x133e34[_0x5c3f('0x4a')],{})['then'](function(_0x1ea0bc){var _0x3aa218=_0x133e34[_0x5c3f('0x4b')]['get']({'plain':!![]});if(!_0x3aa218)throw new Error(_0x5c3f('0x4c'));if(_0x3aa218[_0x5c3f('0x4d')]==='user'){var _0x1ea526=_0x1ea0bc['get']({'plain':!![]});var _0x12b0a3=_0x5c3f('0x26');return db[_0x5c3f('0x4e')][_0x5c3f('0x48')]({'where':{'name':_0x12b0a3,'userProfileId':_0x3aa218[_0x5c3f('0x4f')]},'raw':!![]})[_0x5c3f('0x24')](function(_0x3ac43e){if(_0x3ac43e&&_0x3ac43e[_0x5c3f('0x50')]===0x0){return db[_0x5c3f('0x51')][_0x5c3f('0x49')]({'name':_0x1ea526[_0x5c3f('0x28')],'resourceId':_0x1ea526['id'],'type':_0x3ac43e[_0x5c3f('0x28')],'sectionId':_0x3ac43e['id']},{})[_0x5c3f('0x24')](function(){return _0x1ea0bc;});}else{return _0x1ea0bc;}})[_0x5c3f('0x45')](function(_0x29e65f){logger[_0x5c3f('0x52')](_0x5c3f('0x53'),_0x29e65f);throw _0x29e65f;});}return _0x1ea0bc;})[_0x5c3f('0x24')](respondWithResult(_0xbf8f70,0xc9))[_0x5c3f('0x45')](handleError(_0xbf8f70,null));};exports[_0x5c3f('0x23')]=function(_0x1e8d34,_0x23a67f){if(_0x1e8d34[_0x5c3f('0x4a')]['id']){delete _0x1e8d34[_0x5c3f('0x4a')]['id'];}return db[_0x5c3f('0x41')][_0x5c3f('0x48')]({'where':{'id':_0x1e8d34['params']['id']}})['then'](handleEntityNotFound(_0x23a67f,null))['then'](saveUpdates(_0x1e8d34[_0x5c3f('0x4a')],null))['then'](respondWithResult(_0x23a67f,null))[_0x5c3f('0x45')](handleError(_0x23a67f,null));};exports[_0x5c3f('0x25')]=function(_0x14155e,_0x4aa179){return db['Pause'][_0x5c3f('0x48')]({'where':{'id':_0x14155e[_0x5c3f('0x47')]['id']}})[_0x5c3f('0x24')](handleEntityNotFound(_0x4aa179,null))[_0x5c3f('0x24')](removeEntity(_0x4aa179,null))[_0x5c3f('0x45')](handleError(_0x4aa179,null));};
\ No newline at end of file
index e346b4c..10e0931 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x47643c,_0x184b8e){var _0x3b8c81=function(_0x315d93){while(--_0x315d93){_0x47643c['push'](_0x47643c['shift']());}};_0x3b8c81(++_0x184b8e);}(_0x814b,0x1a2));var _0xb814=function(_0xc20f22,_0x49698f){_0xc20f22=_0xc20f22-0x0;var _0x1535d5=_0x814b[_0xc20f22];return _0x1535d5;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x40a32f,_0x38c8ba){var _0x30ebb7=function(_0x2f52c9){while(--_0x2f52c9){_0x40a32f['push'](_0x40a32f['shift']());}};_0x30ebb7(++_0x38c8ba);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1e352c,_0x25764c){_0x1e352c=_0x1e352c-0x0;var _0x3bd1ba=_0x1cb9[_0x1e352c];return _0x3bd1ba;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c204dd4..ad0b656 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1a4d07,_0x391cb3){var _0x5c605a=function(_0x16d3a6){while(--_0x16d3a6){_0x1a4d07['push'](_0x1a4d07['shift']());}};_0x5c605a(++_0x391cb3);}(_0x7a54,0x106));var _0x47a5=function(_0x1550eb,_0x21e62f){_0x1550eb=_0x1550eb-0x0;var _0x32f592=_0x7a54[_0x1550eb];return _0x32f592;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});};
\ No newline at end of file
+var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x59715,_0x55cb29){var _0x15b459=function(_0x20fce8){while(--_0x20fce8){_0x59715['push'](_0x59715['shift']());}};_0x15b459(++_0x55cb29);}(_0xb10b,0x12a));var _0xbb10=function(_0xa1ae5c,_0x44beef){_0xa1ae5c=_0xa1ae5c-0x0;var _0x4573c1=_0xb10b[_0xa1ae5c];return _0x4573c1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});};
\ No newline at end of file
index 9185b18..816a064 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b78=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','index','/webhook','webhookGet','get','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','isAuthenticated','update','delete','exports'];(function(_0x80ad87,_0x1a90be){var _0x1dbbe0=function(_0x28600b){while(--_0x28600b){_0x80ad87['push'](_0x80ad87['shift']());}};_0x1dbbe0(++_0x1a90be);}(_0x0b78,0x1ad));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')](_0x80b7('0xc'),auth['isAuthenticated'](),controller[_0x80b7('0xd')]);router[_0x80b7('0xb')](_0x80b7('0xe'),auth['isAuthenticated'](),controller[_0x80b7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1a00,_0x4599c1,_0x3b19da){_0x3b19da(null,path[_0x80b7('0x10')](config[_0x80b7('0x11')],_0x80b7('0x12')));},'filename':function(_0x3f8c16,_0x145241,_0x323d06){_0x145241[_0x80b7('0x13')]=_0x145241[_0x80b7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d06(null,util[_0x80b7('0x14')](_0x80b7('0x15'),path['basename'](_0x145241[_0x80b7('0x13')],path[_0x80b7('0x16')](_0x145241['originalname'])),Date[_0x80b7('0x17')](),path[_0x80b7('0x16')](_0x145241[_0x80b7('0x13')])));}})});router[_0x80b7('0x18')]('/',upload[_0x80b7('0x19')](_0x80b7('0x1a')),controller[_0x80b7('0x1b')]);router[_0x80b7('0x18')](_0x80b7('0x9'),controller[_0x80b7('0x1c')]);router['put'](_0x80b7('0xc'),auth[_0x80b7('0x1d')](),controller[_0x80b7('0x1e')]);router[_0x80b7('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x80b7('0x1f')]);module[_0x80b7('0x20')]=router;
\ No newline at end of file
+var _0x222f=['index','webhookGet','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x222f,0x1a4));var _0xf222=function(_0x53758c,_0x5664af){_0x53758c=_0x53758c-0x0;var _0x425eff=_0x222f[_0x53758c];return _0x425eff;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./plugin.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/webhook',controller[_0xf222('0xa')]);router[_0xf222('0x8')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0xc')]);router[_0xf222('0x8')](_0xf222('0xd'),auth[_0xf222('0xb')](),controller[_0xf222('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e29ad,_0x405080,_0x226dbd){_0x226dbd(null,path[_0xf222('0xf')](config['root'],_0xf222('0x10')));},'filename':function(_0x2850c7,_0x2a6965,_0x3d3d29){_0x2a6965[_0xf222('0x11')]=_0x2a6965[_0xf222('0x11')][_0xf222('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3d29(null,util[_0xf222('0x13')]('%s-%s%s',path['basename'](_0x2a6965[_0xf222('0x11')],path[_0xf222('0x14')](_0x2a6965['originalname'])),Date[_0xf222('0x15')](),path[_0xf222('0x14')](_0x2a6965[_0xf222('0x11')])));}})});router[_0xf222('0x16')]('/',upload[_0xf222('0x17')](_0xf222('0x18')),controller[_0xf222('0x19')]);router['post'](_0xf222('0x1a'),controller[_0xf222('0x1b')]);router[_0xf222('0x1c')](_0xf222('0x1d'),auth[_0xf222('0xb')](),controller[_0xf222('0x1e')]);router[_0xf222('0x1f')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0x1f')]);module[_0xf222('0x20')]=router;
\ No newline at end of file
index c6af4aa..ced66f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x984a=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x984a,0x184));var _0xa984=function(_0x31c779,_0x42de3f){_0x31c779=_0x31c779-0x0;var _0x37a305=_0x984a[_0x31c779];return _0x37a305;};'use strict';var Sequelize=require(_0xa984('0x0'));module['exports']={'name':{'type':Sequelize[_0xa984('0x1')]},'type':{'type':Sequelize[_0xa984('0x2')](_0xa984('0x3'),_0xa984('0x4'))},'description':{'type':Sequelize[_0xa984('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xa984('0x6')},'active':{'type':Sequelize[_0xa984('0x7')],'defaultValue':0x0,'comment':_0xa984('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xa984('0x9'),_0xa984('0xa'),_0xa984('0xb')),'defaultValue':_0xa984('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xa984('0x1')]},'adminUrl':{'type':Sequelize[_0xa984('0x1')]},'agentUrl':{'type':Sequelize[_0xa984('0x1')]},'scriptName':{'type':Sequelize[_0xa984('0x1')]},'scriptPath':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x03af=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x14caa6,_0x25097d){var _0x4d5cc1=function(_0x22d3a3){while(--_0x22d3a3){_0x14caa6['push'](_0x14caa6['shift']());}};_0x4d5cc1(++_0x25097d);}(_0x03af,0xb3));var _0xf03a=function(_0x357b36,_0x3b63e7){_0x357b36=_0x357b36-0x0;var _0x287f03=_0x03af[_0x357b36];return _0x287f03;};'use strict';var Sequelize=require(_0xf03a('0x0'));module[_0xf03a('0x1')]={'name':{'type':Sequelize[_0xf03a('0x2')]},'type':{'type':Sequelize[_0xf03a('0x3')](_0xf03a('0x4'),'script')},'description':{'type':Sequelize[_0xf03a('0x5')]},'version':{'type':Sequelize[_0xf03a('0x5')]},'path':{'type':Sequelize[_0xf03a('0x2')],'comment':_0xf03a('0x6')},'active':{'type':Sequelize[_0xf03a('0x7')],'defaultValue':0x0,'comment':_0xf03a('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xf03a('0x9'),_0xf03a('0xa'),_0xf03a('0xb'),_0xf03a('0xc')),'defaultValue':_0xf03a('0xb'),'comment':_0xf03a('0xd')},'icon':{'type':Sequelize[_0xf03a('0x2')]},'adminUrl':{'type':Sequelize[_0xf03a('0x2')]},'agentUrl':{'type':Sequelize[_0xf03a('0x2')]},'scriptName':{'type':Sequelize[_0xf03a('0x2')]},'scriptPath':{'type':Sequelize[_0xf03a('0x2')]}};
\ No newline at end of file
index a456245..3c8be31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f58=['catch','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','dirname','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','views','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','headers','content-length','content-type','endsWith','statusCode','sendStatus','webhookPost','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','params','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f58,0x1ba));var _0x89f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f58[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x89f5('0x0'));var rimraf=require(_0x89f5('0x1'));var zipdir=require(_0x89f5('0x2'));var jsonpatch=require(_0x89f5('0x3'));var rp=require(_0x89f5('0x4'));var moment=require('moment');var BPromise=require(_0x89f5('0x5'));var Mustache=require(_0x89f5('0x6'));var util=require(_0x89f5('0x7'));var path=require(_0x89f5('0x8'));var sox=require(_0x89f5('0x9'));var csv=require(_0x89f5('0xa'));var ejs=require(_0x89f5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89f5('0xc'));var squel=require(_0x89f5('0xd'));var crypto=require(_0x89f5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x89f5('0xf'));var toCsv=require(_0x89f5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x89f5('0x10'));var rimraf=require(_0x89f5('0x1'));var archiver=require('archiver');var Redis=require(_0x89f5('0x11'));var authService=require(_0x89f5('0x12'));var qs=require(_0x89f5('0x13'));var as=require(_0x89f5('0x14'));var hardwareService=require(_0x89f5('0x15'));var logger=require(_0x89f5('0x16'))(_0x89f5('0x17'));var utils=require(_0x89f5('0x18'));var config=require(_0x89f5('0x19'));var licenseUtil=require(_0x89f5('0x1a'));var db=require(_0x89f5('0x1b'))['db'];config[_0x89f5('0x1c')]=_['defaults'](config['redis'],{'host':_0x89f5('0x1d'),'port':0x18eb});var socket=require(_0x89f5('0x1e'))(new Redis(config['redis']));require(_0x89f5('0x1f'))[_0x89f5('0x20')](socket);function respondWithStatusCode(_0x2a803f,_0x274e9a){_0x274e9a=_0x274e9a||0xcc;return function(_0x2b1af6){if(_0x2b1af6){return _0x2a803f['sendStatus'](_0x274e9a);}return _0x2a803f[_0x89f5('0x21')](_0x274e9a)[_0x89f5('0x22')]();};}function respondWithResult(_0x479a82,_0x3d514e){_0x3d514e=_0x3d514e||0xc8;return function(_0xd04a3d){if(_0xd04a3d){return _0x479a82[_0x89f5('0x21')](_0x3d514e)['json'](_0xd04a3d);}};}function respondWithFilteredResult(_0x471611,_0x20aac3){return function(_0x2e16da){if(_0x2e16da){var _0x5e33b5=typeof _0x20aac3[_0x89f5('0x23')]===_0x89f5('0x24')&&typeof _0x20aac3['limit']===_0x89f5('0x24');var _0x116ed0=_0x2e16da[_0x89f5('0x25')];var _0x35a29b=_0x5e33b5?0x0:_0x20aac3[_0x89f5('0x23')];var _0x11a02d=_0x5e33b5?_0x2e16da[_0x89f5('0x25')]:_0x20aac3[_0x89f5('0x23')]+_0x20aac3[_0x89f5('0x26')];var _0x4fc175;if(_0x11a02d>=_0x116ed0){_0x11a02d=_0x116ed0;_0x4fc175=0xc8;}else{_0x4fc175=0xce;}_0x471611[_0x89f5('0x21')](_0x4fc175);return _0x471611[_0x89f5('0x27')](_0x89f5('0x28'),_0x35a29b+'-'+_0x11a02d+'/'+_0x116ed0)['json'](_0x2e16da);}return null;};}function patchUpdates(_0x416deb){return function(_0x2448e6){try{jsonpatch[_0x89f5('0x29')](_0x2448e6,_0x416deb,!![]);}catch(_0x45eb25){return BPromise[_0x89f5('0x2a')](_0x45eb25);}return _0x2448e6[_0x89f5('0x2b')]();};}function saveUpdates(_0x3ac91a,_0x2f295d){return function(_0xaa05a4){if(_0xaa05a4){return _0xaa05a4[_0x89f5('0x2c')](_0x3ac91a)[_0x89f5('0x2d')](function(_0x3edccc){return _0x3edccc;});}return null;};}function removeEntity(_0x17bccf,_0xa4d51a){return function(_0xe827a6){if(_0xe827a6){return _0xe827a6['destroy']()[_0x89f5('0x2d')](function(){var _0x464ab8=_0xe827a6[_0x89f5('0x2e')]({'plain':!![]});var _0x47f3a5='Plugins';return db[_0x89f5('0x2f')][_0x89f5('0x30')]({'where':{'type':_0x47f3a5,'resourceId':_0x464ab8['id']}})['then'](function(){return _0xe827a6;});})[_0x89f5('0x2d')](function(){_0x17bccf[_0x89f5('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427597,_0x3ea182){return function(_0x4b0c6c){if(!_0x4b0c6c){_0x427597['sendStatus'](0x194);}return _0x4b0c6c;};}function handleError(_0x177cc9,_0x564787){_0x564787=_0x564787||0x1f4;return function(_0x2eca34){logger[_0x89f5('0x31')](_0x2eca34[_0x89f5('0x32')]);if(_0x2eca34[_0x89f5('0x33')]){delete _0x2eca34[_0x89f5('0x33')];}_0x177cc9[_0x89f5('0x21')](_0x564787)['send'](_0x2eca34);};}exports[_0x89f5('0x34')]=function(_0x10df94,_0x530270){var _0xb08c79={},_0x5db5a0={},_0x393002={'count':0x0,'rows':[]};var _0x1b5f0e=_[_0x89f5('0x35')](db[_0x89f5('0x36')][_0x89f5('0x37')],function(_0x6a1c63){return{'name':_0x6a1c63[_0x89f5('0x38')],'type':_0x6a1c63[_0x89f5('0x39')][_0x89f5('0x3a')]};});_0x5db5a0[_0x89f5('0x3b')]=_[_0x89f5('0x35')](_0x1b5f0e,'name');_0x5db5a0[_0x89f5('0x3c')]=_[_0x89f5('0x3d')](_0x10df94[_0x89f5('0x3c')]);_0x5db5a0['filters']=_[_0x89f5('0x3e')](_0x5db5a0[_0x89f5('0x3b')],_0x5db5a0[_0x89f5('0x3c')]);_0xb08c79[_0x89f5('0x3f')]=_[_0x89f5('0x3e')](_0x5db5a0[_0x89f5('0x3b')],qs['fields'](_0x10df94['query'][_0x89f5('0x40')]));_0xb08c79[_0x89f5('0x3f')]=_0xb08c79[_0x89f5('0x3f')][_0x89f5('0x41')]?_0xb08c79[_0x89f5('0x3f')]:_0x5db5a0[_0x89f5('0x3b')];if(!_0x10df94[_0x89f5('0x3c')][_0x89f5('0x42')]('nolimit')){_0xb08c79['limit']=qs[_0x89f5('0x26')](_0x10df94[_0x89f5('0x3c')][_0x89f5('0x26')]);_0xb08c79['offset']=qs[_0x89f5('0x23')](_0x10df94[_0x89f5('0x3c')][_0x89f5('0x23')]);}_0xb08c79['order']=qs[_0x89f5('0x43')](_0x10df94[_0x89f5('0x3c')][_0x89f5('0x43')]);_0xb08c79[_0x89f5('0x44')]=qs[_0x89f5('0x45')](_[_0x89f5('0x46')](_0x10df94[_0x89f5('0x3c')],_0x5db5a0[_0x89f5('0x45')]),_0x1b5f0e);if(_0x10df94[_0x89f5('0x3c')][_0x89f5('0x47')]){_0xb08c79[_0x89f5('0x44')]=_['merge'](_0xb08c79['where'],{'$or':_[_0x89f5('0x35')](_0x1b5f0e,function(_0xb3b48c){if(_0xb3b48c[_0x89f5('0x39')]!==_0x89f5('0x48')){var _0x30452b={};_0x30452b[_0xb3b48c[_0x89f5('0x33')]]={'$like':'%'+_0x10df94[_0x89f5('0x3c')][_0x89f5('0x47')]+'%'};return _0x30452b;}})});}_0xb08c79=_[_0x89f5('0x49')]({},_0xb08c79,_0x10df94[_0x89f5('0x4a')]);var _0x1c5630={'where':_0xb08c79[_0x89f5('0x44')]};return db[_0x89f5('0x36')][_0x89f5('0x25')](_0x1c5630)[_0x89f5('0x2d')](function(_0x5ea15c){_0x393002[_0x89f5('0x25')]=_0x5ea15c;if(_0x10df94[_0x89f5('0x3c')]['includeAll']){_0xb08c79[_0x89f5('0x4b')]=[{'all':!![]}];}return db[_0x89f5('0x36')][_0x89f5('0x4c')](_0xb08c79);})[_0x89f5('0x2d')](function(_0x2a3ade){_0x393002[_0x89f5('0x4d')]=_0x2a3ade;return _0x393002;})[_0x89f5('0x2d')](respondWithFilteredResult(_0x530270,_0xb08c79))['catch'](handleError(_0x530270,null));};exports['show']=function(_0x28077a,_0x377e63){var _0x358160={'raw':!![],'where':{'id':_0x28077a[_0x89f5('0x4e')]['id']}},_0x401629={};_0x401629[_0x89f5('0x3b')]=_[_0x89f5('0x3d')](db[_0x89f5('0x36')][_0x89f5('0x37')]);_0x401629[_0x89f5('0x3c')]=_['keys'](_0x28077a[_0x89f5('0x3c')]);_0x401629['filters']=_[_0x89f5('0x3e')](_0x401629[_0x89f5('0x3b')],_0x401629['query']);_0x358160[_0x89f5('0x3f')]=_['intersection'](_0x401629[_0x89f5('0x3b')],qs[_0x89f5('0x40')](_0x28077a[_0x89f5('0x3c')][_0x89f5('0x40')]));_0x358160[_0x89f5('0x3f')]=_0x358160[_0x89f5('0x3f')][_0x89f5('0x41')]?_0x358160['attributes']:_0x401629[_0x89f5('0x3b')];if(_0x28077a[_0x89f5('0x3c')]['includeAll']){_0x358160['include']=[{'all':!![]}];}_0x358160=_['merge']({},_0x358160,_0x28077a[_0x89f5('0x4a')]);return db[_0x89f5('0x36')][_0x89f5('0x4f')](_0x358160)['then'](handleEntityNotFound(_0x377e63,null))[_0x89f5('0x2d')](respondWithResult(_0x377e63,null))[_0x89f5('0x50')](handleError(_0x377e63,null));};exports[_0x89f5('0x51')]=function(_0x1ee238,_0x471d88,_0x253f26){return db['Plugin'][_0x89f5('0x4f')]({'where':{'id':_0x1ee238['params']['id']},'attributes':[_0x89f5('0x33'),'path'],'raw':!![]})[_0x89f5('0x2d')](handleEntityNotFound(_0x471d88,null))['then'](function(_0x35ba51){if(_0x35ba51){var _0x2d47e9=path[_0x89f5('0x52')](config[_0x89f5('0x53')],_0x89f5('0x54'),util[_0x89f5('0x55')]('%s.zip',path[_0x89f5('0x56')](_0x35ba51[_0x89f5('0x8')])));var _0x54562a=fs[_0x89f5('0x57')](_0x2d47e9);var _0x1cb037=archiver(_0x89f5('0x58'),{'zlib':{'level':0x9}});_0x1cb037['on']('warning',function(_0x363c63){if(_0x363c63[_0x89f5('0x59')]===_0x89f5('0x5a')){logger[_0x89f5('0x31')](_0x363c63);}else{throw new db[(_0x89f5('0x5b'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1cb037['on']('error',function(_0xa193e4){throw new db[(_0x89f5('0x5b'))][(_0x89f5('0x5c'))](_0x89f5('0x5d'));});_0x1cb037['pipe'](_0x54562a);_0x1cb037['glob'](_0x89f5('0x5e'),{'cwd':path[_0x89f5('0x52')](config[_0x89f5('0x53')],_0x89f5('0x54'),path[_0x89f5('0x5f')](_0x35ba51[_0x89f5('0x8')])),'ignore':[path[_0x89f5('0x52')](path[_0x89f5('0x56')](_0x35ba51[_0x89f5('0x8')]),'node_modules/**/*'),path[_0x89f5('0x52')](path[_0x89f5('0x56')](_0x35ba51[_0x89f5('0x8')]),_0x89f5('0x60'))],'nodir':!![]})[_0x89f5('0x61')]();_0x54562a['on']('close',function(){if(!fs[_0x89f5('0x62')](_0x2d47e9)){throw new db[(_0x89f5('0x5b'))][(_0x89f5('0x5c'))](_0x89f5('0x63'));}return _0x471d88[_0x89f5('0x51')](_0x2d47e9,util[_0x89f5('0x55')](_0x89f5('0x64'),path[_0x89f5('0x56')](_0x35ba51['path'])),function(_0x100e89){if(_0x100e89){throw new db[(_0x89f5('0x5b'))]['Error'](_0x89f5('0x65'));}fs[_0x89f5('0x66')](_0x2d47e9);logger[_0x89f5('0x67')]('Download\x20completed');logger[_0x89f5('0x67')](_0x89f5('0x68'));});});}return null;})[_0x89f5('0x50')](handleError(_0x471d88,null));};exports[_0x89f5('0x69')]=function(_0x37e90d,_0x573476,_0x13d6c3){var _0x5ea5e4=path[_0x89f5('0x56')](_0x37e90d[_0x89f5('0x6a')][_0x89f5('0x6b')],path['extname'](_0x37e90d[_0x89f5('0x6a')][_0x89f5('0x6b')]));var _0x7d75eb=path[_0x89f5('0x52')](config[_0x89f5('0x53')],_0x89f5('0x54'),_0x37e90d[_0x89f5('0x6a')]['filename']);var _0x2ce644=path[_0x89f5('0x52')](config[_0x89f5('0x53')],_0x89f5('0x54'),_0x5ea5e4);logger[_0x89f5('0x67')](_0x89f5('0x6c'),_0x7d75eb);logger[_0x89f5('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x2ce644);try{fs[_0x89f5('0x6d')](_0x7d75eb,parseInt(_0x89f5('0x6e'),0x8));extract(_0x7d75eb,{'dir':_0x2ce644},function(_0x371472){if(_0x371472){logger[_0x89f5('0x31')](_0x371472);handleError(_0x371472,!![]);};var _0x20694e=fs['readdirSync'](_0x2ce644);if(_0x20694e[_0x89f5('0x41')]>0x1){removeReferences(_0x7d75eb,_0x2ce644);logger[_0x89f5('0x31')](_0x89f5('0x6f'));return _0x13d6c3(new Error('Invalid\x20plugin\x20structure'));}var _0x416718=fs[_0x89f5('0x70')](path[_0x89f5('0x52')](_0x2ce644,_0x20694e[0x0]));if(_0x416718[_0x89f5('0x71')]()){removeReferences(_0x7d75eb,_0x2ce644);logger[_0x89f5('0x31')]('Invalid\x20plugin\x20structure');return _0x13d6c3(new Error('Invalid\x20plugin\x20structure'));}if(_0x416718[_0x89f5('0x72')]()){var _0x572f0c=fs[_0x89f5('0x73')](path[_0x89f5('0x52')](_0x2ce644,_0x20694e[0x0]));if(_0x572f0c[_0x89f5('0x41')]===0x0){removeReferences(_0x7d75eb,_0x2ce644);logger['error'](_0x89f5('0x6f'));return _0x13d6c3(new Error(_0x89f5('0x6f')));}var _0xd84fec=_0x572f0c[_0x89f5('0x74')](function(_0x1c8749){return _0x1c8749===_0x89f5('0x75');});if(!_0xd84fec){return _0x13d6c3(new Error(_0x89f5('0x76')));}var _0xa3d2a5=fs[_0x89f5('0x77')](path[_0x89f5('0x52')](_0x2ce644,_0x20694e[0x0],_0x89f5('0x75')));var _0x1273fe=JSON['parse'](_0xa3d2a5);if('undefined'==typeof _0x1273fe[_0x89f5('0x33')]){return _0x13d6c3(new Error(_0x89f5('0x78')));}if('undefined'==typeof _0x1273fe['type']){return _0x13d6c3(new Error(_0x89f5('0x79')));}if(_0x89f5('0x24')==typeof _0x1273fe[_0x89f5('0x7a')]){return _0x13d6c3(new Error(_0x89f5('0x7b')));}if(_0x89f5('0x24')==typeof _0x1273fe['parameters']){return _0x13d6c3(new Error(_0x89f5('0x7c')));}if(_0x1273fe['type']==='html'){if(_0x89f5('0x24')==typeof _0x1273fe['parameters'][_0x89f5('0x7d')]){return _0x13d6c3(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x1273fe[_0x89f5('0x7e')]['views'][_0x89f5('0x7f')]&&_0x89f5('0x24')==typeof _0x1273fe['parameters'][_0x89f5('0x7d')][_0x89f5('0x80')]){return _0x13d6c3(new Error(_0x89f5('0x81')));}}else if(_0x1273fe['type']===_0x89f5('0x82')){if('undefined'==typeof _0x1273fe[_0x89f5('0x7e')][_0x89f5('0x83')]){return _0x13d6c3(new Error(_0x89f5('0x84')));}if(_0x89f5('0x24')==typeof _0x1273fe[_0x89f5('0x7e')][_0x89f5('0x85')]){return _0x13d6c3(new Error(_0x89f5('0x86')));}}else{return _0x13d6c3(new Error(_0x89f5('0x87')));}var _0x5dc88d=_0x1273fe['name'];var _0x579447=_0x1273fe[_0x89f5('0x88')];var _0x514dc7=_0x1273fe[_0x89f5('0x39')];var _0x2e1c97=_0x1273fe[_0x89f5('0x89')]?_0x1273fe['sidebar']:_0x89f5('0x8a');var _0x42dc44=_0x1273fe[_0x89f5('0x8b')]?_0x1273fe['icon']:_0x89f5('0x8c');var _0x5c2ad7='';var _0x5dea68='';var _0x168bf2='';var _0x41df24='';var _0x358230=_0x1273fe[_0x89f5('0x7a')];if(_0x514dc7===_0x89f5('0x8d')){if(_0x89f5('0x24')!=typeof _0x1273fe[_0x89f5('0x7e')][_0x89f5('0x7d')][_0x89f5('0x7f')]){var _0x26e257=_0x1273fe[_0x89f5('0x7e')][_0x89f5('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x89f5('0x8e')](_0x26e257)){_0x5c2ad7=path[_0x89f5('0x52')](_0x89f5('0x8f'),_0x5ea5e4,_0x20694e[0x0],_0x26e257);}else{_0x5c2ad7=_0x26e257;}}else{logger[_0x89f5('0x67')](_0x89f5('0x90'));}if('undefined'!=typeof _0x1273fe['parameters']['views'][_0x89f5('0x80')]){var _0x188e7a=_0x1273fe[_0x89f5('0x7e')][_0x89f5('0x7d')][_0x89f5('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x89f5('0x8e')](_0x188e7a)){_0x5dea68=path[_0x89f5('0x52')]('plugins',_0x5ea5e4,_0x20694e[0x0],_0x188e7a);}else{_0x5dea68=_0x188e7a;}}else{logger[_0x89f5('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x514dc7===_0x89f5('0x82')){_0x168bf2=_0x1273fe[_0x89f5('0x7e')][_0x89f5('0x83')];_0x41df24=_0x1273fe[_0x89f5('0x7e')]['scriptPath'];if(_0x89f5('0x24')!=typeof _0x1273fe[_0x89f5('0x7e')]['views']){if(_0x89f5('0x24')!=typeof _0x1273fe[_0x89f5('0x7e')][_0x89f5('0x7d')]['admin']){var _0x26e257=_0x1273fe[_0x89f5('0x7e')]['views'][_0x89f5('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x26e257)){_0x5c2ad7=path[_0x89f5('0x52')](_0x89f5('0x8f'),_0x5ea5e4,_0x20694e[0x0],_0x26e257);}else{_0x5c2ad7=_0x26e257;}}if(_0x89f5('0x24')!=typeof _0x1273fe[_0x89f5('0x7e')][_0x89f5('0x7d')][_0x89f5('0x80')]){var _0x188e7a=_0x1273fe[_0x89f5('0x7e')][_0x89f5('0x7d')][_0x89f5('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x89f5('0x8e')](_0x188e7a)){_0x5dea68=path[_0x89f5('0x52')](_0x89f5('0x8f'),_0x5ea5e4,_0x20694e[0x0],_0x188e7a);}else{_0x5dea68=_0x188e7a;}}}}var _0x4f0c2d={'name':_0x5dc88d,'description':_0x579447,'path':path[_0x89f5('0x52')](_0x5ea5e4,_0x20694e[0x0]),'type':_0x514dc7,'sidebar':_0x2e1c97,'icon':_0x42dc44,'adminUrl':_0x5c2ad7,'agentUrl':_0x5dea68,'scriptName':_0x168bf2,'scriptPath':_0x41df24,'version':_0x358230};removeReferences(_0x7d75eb,null);return db[_0x89f5('0x36')][_0x89f5('0x91')](_0x4f0c2d)[_0x89f5('0x2d')](function(_0x30d512){var _0x4c5f39={'role':_0x37e90d[_0x89f5('0x92')][_0x89f5('0x93')],'userProfileId':_0x37e90d[_0x89f5('0x92')]['userProfileId']};if(!_0x4c5f39)throw new Error(_0x89f5('0x94'));if(_0x4c5f39['role']===_0x89f5('0x95')){var _0x28d2ac=_0x30d512['get']({'plain':!![]});return db['UserProfileSection'][_0x89f5('0x4f')]({'where':{'name':_0x89f5('0x96'),'userProfileId':_0x4c5f39[_0x89f5('0x97')]},'raw':!![]})[_0x89f5('0x2d')](function(_0x50e74c){if(_0x50e74c&&_0x50e74c[_0x89f5('0x98')]===0x0){return db['UserProfileResource'][_0x89f5('0x91')]({'name':_0x28d2ac['name'],'resourceId':_0x28d2ac['id'],'type':_0x50e74c[_0x89f5('0x33')],'sectionId':_0x50e74c['id']},{})[_0x89f5('0x2d')](function(){return _0x30d512;});}else{return _0x30d512;}})[_0x89f5('0x50')](function(_0x3e90c4){logger['error'](_0x89f5('0x99'),_0x3e90c4);throw _0x3e90c4;});}return _0x30d512;})[_0x89f5('0x2d')](respondWithResult(_0x573476,null))[_0x89f5('0x50')](handleError(_0x573476,null));}});}catch(_0x26e17c){_0x573476[_0x89f5('0x21')](0x1f4)[_0x89f5('0x9a')](_0x26e17c);}};function removeReferences(_0x1f2e99,_0x546bdb){try{if(_0x1f2e99){fs[_0x89f5('0x66')](_0x1f2e99);logger[_0x89f5('0x67')]('Zip\x20archive\x20removed');}if(_0x546bdb){rimraf(_0x546bdb,function(){});logger[_0x89f5('0x67')](_0x89f5('0x9b'));}}catch(_0x5c8eaf){logger[_0x89f5('0x31')](_0x5c8eaf);}}exports[_0x89f5('0x2c')]=function(_0xeab817,_0x31eb6d,_0x2187d4){return db[_0x89f5('0x36')][_0x89f5('0x4f')]({'where':{'id':_0xeab817['params']['id']}})[_0x89f5('0x2d')](handleEntityNotFound(_0x31eb6d,null))[_0x89f5('0x2d')](saveUpdates(_0xeab817[_0x89f5('0x92')],null))['then'](respondWithResult(_0x31eb6d,null))['catch'](handleError(_0x31eb6d,null));};exports['delete']=function(_0x53e967,_0x5e4312,_0x595b22){return db[_0x89f5('0x36')][_0x89f5('0x4f')]({'where':{'id':_0x53e967['params']['id']}})[_0x89f5('0x2d')](function(_0x1be0e5){if(_0x1be0e5){return _0x1be0e5[_0x89f5('0x30')]();}})[_0x89f5('0x2d')](function(_0x1d0971){rimraf(path[_0x89f5('0x52')](config['root'],_0x89f5('0x54'),path[_0x89f5('0x5f')](_0x1d0971[_0x89f5('0x8')])),function(){});return _0x1d0971;})['then'](handleEntityNotFound(_0x5e4312,null))['then'](respondWithStatusCode(_0x5e4312,null))[_0x89f5('0x50')](handleError(_0x5e4312,null));};exports[_0x89f5('0x9c')]=function(_0x100ce9,_0xca154c,_0x34e908){return BPromise[_0x89f5('0x9d')]()[_0x89f5('0x2d')](function(){if(!_0x100ce9[_0x89f5('0x3c')]['path']){throw new Error(_0x89f5('0x9e'));}if(!_0x100ce9['query'][_0x89f5('0x9f')]){throw new Error(_0x89f5('0xa0'));}var _0x4bc10f=_0x100ce9[_0x89f5('0x3c')][_0x89f5('0xa1')]?_0x100ce9[_0x89f5('0x3c')]['hostname']+':'+_0x100ce9[_0x89f5('0x3c')][_0x89f5('0x9f')]:_0x89f5('0xa2')+_0x100ce9[_0x89f5('0x3c')][_0x89f5('0x9f')];var _0x1e36d3=_0x100ce9[_0x89f5('0x3c')][_0x89f5('0xa3')]?_0x100ce9['query'][_0x89f5('0xa3')]:!![];var _0x53e888=_0x100ce9[_0x89f5('0x3c')][_0x89f5('0xa4')]?_0x100ce9[_0x89f5('0x3c')][_0x89f5('0xa4')]:null;var _0x1efcdc={'method':_0x100ce9[_0x89f5('0xa5')],'uri':util[_0x89f5('0x55')]('%s%s',_0x4bc10f,_0x100ce9[_0x89f5('0x3c')][_0x89f5('0x8')]),'json':_0x1e36d3,'resolveWithFullResponse':!![],'encoding':_0x53e888,'qs':_0x100ce9[_0x89f5('0x3c')]};if(_0x100ce9['headers']){_0x1efcdc[_0x89f5('0xa6')]=_0x100ce9['headers'];if(_0x1efcdc[_0x89f5('0xa6')]['content-length']){delete _0x1efcdc[_0x89f5('0xa6')][_0x89f5('0xa7')];}}if(_0x1efcdc[_0x89f5('0xa6')][_0x89f5('0xa8')]){delete _0x1efcdc[_0x89f5('0xa6')][_0x89f5('0xa8')];}return rp(_0x1efcdc);})[_0x89f5('0x2d')](function(_0xf6c2f4){if(_0xf6c2f4){_0xca154c['set'](_0xf6c2f4[_0x89f5('0xa6')]);logger[_0x89f5('0x67')](_0xf6c2f4[_0x89f5('0x92')]);if(_[_0x89f5('0xa9')](_0x100ce9[_0x89f5('0x3c')][_0x89f5('0x8')],_0x89f5('0x51'))&&_0xf6c2f4[_0x89f5('0xaa')]==0x1f4){return _0xca154c[_0x89f5('0xab')](_0xf6c2f4[_0x89f5('0xaa')]);}else{return _0xca154c[_0x89f5('0x21')](_0xf6c2f4[_0x89f5('0xaa')])[_0x89f5('0x9a')](_0xf6c2f4['body']);}}else{return _0xca154c[_0x89f5('0xab')](0xc8);}})[_0x89f5('0x50')](handleError(_0xca154c,null));};exports[_0x89f5('0xac')]=function(_0x5d8e05,_0x283d4d,_0x35bea0){return BPromise[_0x89f5('0x9d')]()[_0x89f5('0x2d')](function(){if(!_0x5d8e05[_0x89f5('0x3c')]['path']){throw new Error(_0x89f5('0x9e'));}if(!_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4cef97=_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0xa1')]?_0x5d8e05[_0x89f5('0x3c')]['hostname']+':'+_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0x9f')]:'http://localhost:'+_0x5d8e05['query']['port'];var _0x2c927c=_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0xa3')]?_0x5d8e05[_0x89f5('0x3c')]['json']:!![];var _0x57c4ab=_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0xa4')]?_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0xa4')]:null;var _0x875160={'method':_0x5d8e05[_0x89f5('0xa5')],'uri':util[_0x89f5('0x55')](_0x89f5('0xad'),_0x4cef97,_0x5d8e05[_0x89f5('0x3c')][_0x89f5('0x8')]),'json':_0x2c927c,'resolveWithFullResponse':!![],'encoding':_0x57c4ab,'body':_0x5d8e05['body']};if(_0x5d8e05[_0x89f5('0xa6')]){_0x875160[_0x89f5('0xa6')]=_0x5d8e05[_0x89f5('0xa6')];if(_0x875160[_0x89f5('0xa6')]['content-length']){delete _0x875160['headers'][_0x89f5('0xa7')];}}if(_0x875160[_0x89f5('0xa6')][_0x89f5('0xa8')]){delete _0x875160[_0x89f5('0xa6')][_0x89f5('0xa8')];}return rp(_0x875160);})[_0x89f5('0x2d')](function(_0x1d134e){if(_0x1d134e){_0x283d4d[_0x89f5('0x27')](_0x1d134e['headers']);logger[_0x89f5('0x67')](_0x1d134e['body']);return _0x283d4d[_0x89f5('0x21')](_0x1d134e[_0x89f5('0xaa')])[_0x89f5('0x9a')](_0x1d134e[_0x89f5('0x92')]);}else{return _0x283d4d[_0x89f5('0xab')](0xc8);}})[_0x89f5('0x50')](handleError(_0x283d4d,null));};
\ No newline at end of file
+var _0x7497=['eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Plugin','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','download','path','root','server/files/plugins','format','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','join','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','create','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','sendStatus','webhookPost'];(function(_0x5c46e2,_0x55f667){var _0x2c24c4=function(_0x3f9cfa){while(--_0x3f9cfa){_0x5c46e2['push'](_0x5c46e2['shift']());}};_0x2c24c4(++_0x55f667);}(_0x7497,0xa9));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7749('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7749('0x1'));var jsonpatch=require(_0x7749('0x2'));var rp=require(_0x7749('0x3'));var moment=require('moment');var BPromise=require(_0x7749('0x4'));var Mustache=require('mustache');var util=require(_0x7749('0x5'));var path=require('path');var sox=require(_0x7749('0x6'));var csv=require(_0x7749('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7749('0x8'));var _=require(_0x7749('0x9'));var squel=require(_0x7749('0xa'));var crypto=require('crypto');var jsforce=require(_0x7749('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7749('0x7'));var querystring=require(_0x7749('0xc'));var Papa=require(_0x7749('0xd'));var extract=require(_0x7749('0xe'));var rimraf=require(_0x7749('0xf'));var archiver=require(_0x7749('0x10'));var Redis=require(_0x7749('0x11'));var authService=require(_0x7749('0x12'));var qs=require(_0x7749('0x13'));var as=require(_0x7749('0x14'));var hardwareService=require(_0x7749('0x15'));var logger=require(_0x7749('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7749('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7749('0x18'))['db'];config[_0x7749('0x19')]=_['defaults'](config[_0x7749('0x19')],{'host':_0x7749('0x1a'),'port':0x18eb});var socket=require(_0x7749('0x1b'))(new Redis(config[_0x7749('0x19')]));require(_0x7749('0x1c'))[_0x7749('0x1d')](socket);function respondWithStatusCode(_0x6ac1f0,_0x147d33){_0x147d33=_0x147d33||0xcc;return function(_0x23a1cf){if(_0x23a1cf){return _0x6ac1f0['sendStatus'](_0x147d33);}return _0x6ac1f0[_0x7749('0x1e')](_0x147d33)[_0x7749('0x1f')]();};}function respondWithResult(_0x286a0a,_0x50f0eb){_0x50f0eb=_0x50f0eb||0xc8;return function(_0x5b698a){if(_0x5b698a){return _0x286a0a[_0x7749('0x1e')](_0x50f0eb)[_0x7749('0x20')](_0x5b698a);}};}function respondWithFilteredResult(_0x25d800,_0x146580){return function(_0x47c0dc){if(_0x47c0dc){var _0x5245bb=typeof _0x146580[_0x7749('0x21')]===_0x7749('0x22')&&typeof _0x146580[_0x7749('0x23')]==='undefined';var _0x5282ca=_0x47c0dc[_0x7749('0x24')];var _0x532bb3=_0x5245bb?0x0:_0x146580[_0x7749('0x21')];var _0x3ea5f7=_0x5245bb?_0x47c0dc[_0x7749('0x24')]:_0x146580[_0x7749('0x21')]+_0x146580[_0x7749('0x23')];var _0x489246;if(_0x3ea5f7>=_0x5282ca){_0x3ea5f7=_0x5282ca;_0x489246=0xc8;}else{_0x489246=0xce;}_0x25d800[_0x7749('0x1e')](_0x489246);return _0x25d800[_0x7749('0x25')](_0x7749('0x26'),_0x532bb3+'-'+_0x3ea5f7+'/'+_0x5282ca)['json'](_0x47c0dc);}return null;};}function patchUpdates(_0x64128b){return function(_0x165312){try{jsonpatch[_0x7749('0x27')](_0x165312,_0x64128b,!![]);}catch(_0x10ccdd){return BPromise[_0x7749('0x28')](_0x10ccdd);}return _0x165312[_0x7749('0x29')]();};}function saveUpdates(_0x14882e,_0x21bab9){return function(_0x1a246f){if(_0x1a246f){return _0x1a246f[_0x7749('0x2a')](_0x14882e)[_0x7749('0x2b')](function(_0x333a9b){return _0x333a9b;});}return null;};}function removeEntity(_0x541393,_0x104bcd){return function(_0x1f6630){if(_0x1f6630){return _0x1f6630[_0x7749('0x2c')]()[_0x7749('0x2b')](function(){var _0x46566e=_0x1f6630[_0x7749('0x2d')]({'plain':!![]});var _0x50810f='Plugins';return db[_0x7749('0x2e')][_0x7749('0x2c')]({'where':{'type':_0x50810f,'resourceId':_0x46566e['id']}})[_0x7749('0x2b')](function(){return _0x1f6630;});})['then'](function(){_0x541393[_0x7749('0x1e')](0xcc)[_0x7749('0x1f')]();});}};}function handleEntityNotFound(_0x4e5bce,_0x200869){return function(_0x84d44c){if(!_0x84d44c){_0x4e5bce['sendStatus'](0x194);}return _0x84d44c;};}function handleError(_0x10de84,_0x165161){_0x165161=_0x165161||0x1f4;return function(_0xa78c){logger[_0x7749('0x2f')](_0xa78c['stack']);if(_0xa78c[_0x7749('0x30')]){delete _0xa78c[_0x7749('0x30')];}_0x10de84[_0x7749('0x1e')](_0x165161)['send'](_0xa78c);};}exports[_0x7749('0x31')]=function(_0x2206f2,_0x24e7c5){var _0x4b221d={},_0x360fb6={},_0x26b303={'count':0x0,'rows':[]};var _0x2ceb73=_[_0x7749('0x32')](db[_0x7749('0x33')]['rawAttributes'],function(_0x1a9484){return{'name':_0x1a9484['fieldName'],'type':_0x1a9484[_0x7749('0x34')][_0x7749('0x35')]};});_0x360fb6[_0x7749('0x36')]=_[_0x7749('0x32')](_0x2ceb73,_0x7749('0x30'));_0x360fb6['query']=_['keys'](_0x2206f2[_0x7749('0x37')]);_0x360fb6[_0x7749('0x38')]=_[_0x7749('0x39')](_0x360fb6[_0x7749('0x36')],_0x360fb6[_0x7749('0x37')]);_0x4b221d[_0x7749('0x3a')]=_['intersection'](_0x360fb6[_0x7749('0x36')],qs['fields'](_0x2206f2[_0x7749('0x37')][_0x7749('0x3b')]));_0x4b221d[_0x7749('0x3a')]=_0x4b221d['attributes'][_0x7749('0x3c')]?_0x4b221d[_0x7749('0x3a')]:_0x360fb6['model'];if(!_0x2206f2[_0x7749('0x37')][_0x7749('0x3d')](_0x7749('0x3e'))){_0x4b221d[_0x7749('0x23')]=qs[_0x7749('0x23')](_0x2206f2[_0x7749('0x37')][_0x7749('0x23')]);_0x4b221d[_0x7749('0x21')]=qs['offset'](_0x2206f2[_0x7749('0x37')][_0x7749('0x21')]);}_0x4b221d[_0x7749('0x3f')]=qs[_0x7749('0x40')](_0x2206f2['query'][_0x7749('0x40')]);_0x4b221d[_0x7749('0x41')]=qs[_0x7749('0x38')](_[_0x7749('0x42')](_0x2206f2['query'],_0x360fb6[_0x7749('0x38')]),_0x2ceb73);if(_0x2206f2[_0x7749('0x37')][_0x7749('0x43')]){_0x4b221d[_0x7749('0x41')]=_['merge'](_0x4b221d[_0x7749('0x41')],{'$or':_[_0x7749('0x32')](_0x2ceb73,function(_0x3faa14){if(_0x3faa14['type']!==_0x7749('0x44')){var _0x58cc0e={};_0x58cc0e[_0x3faa14[_0x7749('0x30')]]={'$like':'%'+_0x2206f2['query'][_0x7749('0x43')]+'%'};return _0x58cc0e;}})});}_0x4b221d=_[_0x7749('0x45')]({},_0x4b221d,_0x2206f2[_0x7749('0x46')]);var _0x13f890={'where':_0x4b221d[_0x7749('0x41')]};return db[_0x7749('0x33')][_0x7749('0x24')](_0x13f890)[_0x7749('0x2b')](function(_0x3a66aa){_0x26b303[_0x7749('0x24')]=_0x3a66aa;if(_0x2206f2[_0x7749('0x37')]['includeAll']){_0x4b221d[_0x7749('0x47')]=[{'all':!![]}];}return db[_0x7749('0x33')][_0x7749('0x48')](_0x4b221d);})['then'](function(_0x412997){_0x26b303[_0x7749('0x49')]=_0x412997;return _0x26b303;})[_0x7749('0x2b')](respondWithFilteredResult(_0x24e7c5,_0x4b221d))[_0x7749('0x4a')](handleError(_0x24e7c5,null));};exports[_0x7749('0x4b')]=function(_0x25927a,_0x2e0a65){var _0x180793={'raw':!![],'where':{'id':_0x25927a[_0x7749('0x4c')]['id']}},_0xe6c084={};_0xe6c084[_0x7749('0x36')]=_[_0x7749('0x4d')](db[_0x7749('0x33')][_0x7749('0x4e')]);_0xe6c084[_0x7749('0x37')]=_[_0x7749('0x4d')](_0x25927a[_0x7749('0x37')]);_0xe6c084['filters']=_[_0x7749('0x39')](_0xe6c084[_0x7749('0x36')],_0xe6c084[_0x7749('0x37')]);_0x180793['attributes']=_[_0x7749('0x39')](_0xe6c084['model'],qs['fields'](_0x25927a[_0x7749('0x37')][_0x7749('0x3b')]));_0x180793[_0x7749('0x3a')]=_0x180793[_0x7749('0x3a')][_0x7749('0x3c')]?_0x180793[_0x7749('0x3a')]:_0xe6c084[_0x7749('0x36')];if(_0x25927a['query'][_0x7749('0x4f')]){_0x180793['include']=[{'all':!![]}];}_0x180793=_[_0x7749('0x45')]({},_0x180793,_0x25927a[_0x7749('0x46')]);return db[_0x7749('0x33')][_0x7749('0x50')](_0x180793)[_0x7749('0x2b')](handleEntityNotFound(_0x2e0a65,null))[_0x7749('0x2b')](respondWithResult(_0x2e0a65,null))[_0x7749('0x4a')](handleError(_0x2e0a65,null));};exports[_0x7749('0x51')]=function(_0x9c242a,_0x4b0b5c,_0x6bd0){return db['Plugin']['find']({'where':{'id':_0x9c242a[_0x7749('0x4c')]['id']},'attributes':['name',_0x7749('0x52')],'raw':!![]})[_0x7749('0x2b')](handleEntityNotFound(_0x4b0b5c,null))[_0x7749('0x2b')](function(_0x570128){if(_0x570128){var _0xaba441=path['join'](config[_0x7749('0x53')],_0x7749('0x54'),util[_0x7749('0x55')](_0x7749('0x56'),path[_0x7749('0x57')](_0x570128[_0x7749('0x52')])));var _0x1746fa=fs['createWriteStream'](_0xaba441);var _0x59d0da=archiver(_0x7749('0x58'),{'zlib':{'level':0x9}});_0x59d0da['on'](_0x7749('0x59'),function(_0x307ee3){if(_0x307ee3['code']===_0x7749('0x5a')){logger[_0x7749('0x2f')](_0x307ee3);}else{throw new db[(_0x7749('0x5b'))][(_0x7749('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x59d0da['on'](_0x7749('0x2f'),function(_0x4ad766){throw new db[(_0x7749('0x5b'))][(_0x7749('0x5c'))](_0x7749('0x5d'));});_0x59d0da['pipe'](_0x1746fa);_0x59d0da[_0x7749('0x5e')]('**/*',{'cwd':path[_0x7749('0x5f')](config['root'],_0x7749('0x54'),path[_0x7749('0x60')](_0x570128['path'])),'ignore':[path['join'](path[_0x7749('0x57')](_0x570128[_0x7749('0x52')]),_0x7749('0x61')),path[_0x7749('0x5f')](path[_0x7749('0x57')](_0x570128[_0x7749('0x52')]),'attachments/**/*')],'nodir':!![]})[_0x7749('0x62')]();_0x1746fa['on'](_0x7749('0x63'),function(){if(!fs['existsSync'](_0xaba441)){throw new db['Sequelize'][(_0x7749('0x5c'))](_0x7749('0x64'));}return _0x4b0b5c['download'](_0xaba441,util[_0x7749('0x55')](_0x7749('0x56'),path['basename'](_0x570128['path'])),function(_0x50ae3d){if(_0x50ae3d){throw new db[(_0x7749('0x5b'))]['Error'](_0x7749('0x65'));}fs[_0x7749('0x66')](_0xaba441);logger[_0x7749('0x67')](_0x7749('0x68'));logger[_0x7749('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x7749('0x4a')](handleError(_0x4b0b5c,null));};exports[_0x7749('0x69')]=function(_0x4f7170,_0x5447f5,_0x18d329){var _0x46bdac=path['basename'](_0x4f7170['file'][_0x7749('0x6a')],path['extname'](_0x4f7170['file']['filename']));var _0x59f20a=path[_0x7749('0x5f')](config['root'],'server/files/plugins',_0x4f7170[_0x7749('0x6b')]['filename']);var _0x4b4ab2=path[_0x7749('0x5f')](config[_0x7749('0x53')],_0x7749('0x54'),_0x46bdac);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x59f20a);logger[_0x7749('0x67')](_0x7749('0x6c'),_0x4b4ab2);try{fs[_0x7749('0x6d')](_0x59f20a,parseInt('0777',0x8));extract(_0x59f20a,{'dir':_0x4b4ab2},function(_0x1f250c){if(_0x1f250c){logger[_0x7749('0x2f')](_0x1f250c);handleError(_0x1f250c,!![]);};var _0x3ef527=fs[_0x7749('0x6e')](_0x4b4ab2);if(_0x3ef527[_0x7749('0x3c')]>0x1){removeReferences(_0x59f20a,_0x4b4ab2);logger[_0x7749('0x2f')](_0x7749('0x6f'));return _0x18d329(new Error(_0x7749('0x6f')));}var _0xa62c0e=fs['lstatSync'](path[_0x7749('0x5f')](_0x4b4ab2,_0x3ef527[0x0]));if(_0xa62c0e[_0x7749('0x70')]()){removeReferences(_0x59f20a,_0x4b4ab2);logger[_0x7749('0x2f')]('Invalid\x20plugin\x20structure');return _0x18d329(new Error(_0x7749('0x6f')));}if(_0xa62c0e['isDirectory']()){var _0x4b95de=fs[_0x7749('0x6e')](path[_0x7749('0x5f')](_0x4b4ab2,_0x3ef527[0x0]));if(_0x4b95de[_0x7749('0x3c')]===0x0){removeReferences(_0x59f20a,_0x4b4ab2);logger[_0x7749('0x2f')]('Invalid\x20plugin\x20structure');return _0x18d329(new Error('Invalid\x20plugin\x20structure'));}var _0x2b6b17=_0x4b95de[_0x7749('0x71')](function(_0x745ee2){return _0x745ee2==='manifest.json';});if(!_0x2b6b17){return _0x18d329(new Error(_0x7749('0x72')));}var _0x4f670f=fs[_0x7749('0x73')](path['join'](_0x4b4ab2,_0x3ef527[0x0],_0x7749('0x74')));var _0x190a8d=JSON[_0x7749('0x75')](_0x4f670f);if(_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x30')]){return _0x18d329(new Error(_0x7749('0x76')));}if(_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x34')]){return _0x18d329(new Error(_0x7749('0x77')));}if('undefined'==typeof _0x190a8d['version']){return _0x18d329(new Error(_0x7749('0x78')));}if(_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x79')]){return _0x18d329(new Error(_0x7749('0x7a')));}if(_0x190a8d['type']===_0x7749('0x7b')){if(_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x79')][_0x7749('0x7c')]){return _0x18d329(new Error(_0x7749('0x7d')));}if('undefined'==typeof _0x190a8d['parameters'][_0x7749('0x7c')][_0x7749('0x7e')]&&_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x79')][_0x7749('0x7c')]['agent']){return _0x18d329(new Error(_0x7749('0x7f')));}}else if(_0x190a8d[_0x7749('0x34')]===_0x7749('0x80')){if(_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x79')][_0x7749('0x81')]){return _0x18d329(new Error(_0x7749('0x82')));}if(_0x7749('0x22')==typeof _0x190a8d[_0x7749('0x79')][_0x7749('0x83')]){return _0x18d329(new Error(_0x7749('0x84')));}}else{return _0x18d329(new Error(_0x7749('0x85')));}var _0x73509e=_0x190a8d['name'];var _0x12f35b=_0x190a8d[_0x7749('0x86')];var _0x5d06d3=_0x190a8d['type'];var _0x2b27eb=_0x190a8d[_0x7749('0x87')]?_0x190a8d['sidebar']:_0x7749('0x88');var _0x113f1d=_0x190a8d[_0x7749('0x89')]?_0x190a8d['icon']:_0x7749('0x8a');var _0x426d42='';var _0x38e030='';var _0x1852ac='';var _0x4bf539='';var _0x368637=_0x190a8d['version'];if(_0x5d06d3===_0x7749('0x7b')){if('undefined'!=typeof _0x190a8d[_0x7749('0x79')][_0x7749('0x7c')][_0x7749('0x7e')]){var _0x1898a8=_0x190a8d[_0x7749('0x79')][_0x7749('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1898a8)){_0x426d42=path[_0x7749('0x5f')](_0x7749('0x8b'),_0x46bdac,_0x3ef527[0x0],_0x1898a8);}else{_0x426d42=_0x1898a8;}}else{logger[_0x7749('0x67')](_0x7749('0x8c'));}if('undefined'!=typeof _0x190a8d[_0x7749('0x79')][_0x7749('0x7c')][_0x7749('0x8d')]){var _0x40e5ab=_0x190a8d[_0x7749('0x79')][_0x7749('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x7749('0x8e')](_0x40e5ab)){_0x38e030=path[_0x7749('0x5f')](_0x7749('0x8b'),_0x46bdac,_0x3ef527[0x0],_0x40e5ab);}else{_0x38e030=_0x40e5ab;}}else{logger[_0x7749('0x67')](_0x7749('0x8f'));}}else if(_0x5d06d3===_0x7749('0x80')){_0x1852ac=_0x190a8d['parameters']['scriptName'];_0x4bf539=_0x190a8d['parameters']['scriptPath'];if(_0x7749('0x22')!=typeof _0x190a8d[_0x7749('0x79')]['views']){if(_0x7749('0x22')!=typeof _0x190a8d['parameters'][_0x7749('0x7c')]['admin']){var _0x1898a8=_0x190a8d[_0x7749('0x79')][_0x7749('0x7c')][_0x7749('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x7749('0x8e')](_0x1898a8)){_0x426d42=path['join']('plugins',_0x46bdac,_0x3ef527[0x0],_0x1898a8);}else{_0x426d42=_0x1898a8;}}if('undefined'!=typeof _0x190a8d[_0x7749('0x79')]['views']['agent']){var _0x40e5ab=_0x190a8d[_0x7749('0x79')][_0x7749('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x40e5ab)){_0x38e030=path[_0x7749('0x5f')](_0x7749('0x8b'),_0x46bdac,_0x3ef527[0x0],_0x40e5ab);}else{_0x38e030=_0x40e5ab;}}}}var _0x5af056={'name':_0x73509e,'description':_0x12f35b,'path':path[_0x7749('0x5f')](_0x46bdac,_0x3ef527[0x0]),'type':_0x5d06d3,'sidebar':_0x2b27eb,'icon':_0x113f1d,'adminUrl':_0x426d42,'agentUrl':_0x38e030,'scriptName':_0x1852ac,'scriptPath':_0x4bf539,'version':_0x368637};removeReferences(_0x59f20a,null);return db[_0x7749('0x33')]['create'](_0x5af056)[_0x7749('0x2b')](function(_0x19b168){var _0x115736={'role':_0x4f7170['body'][_0x7749('0x90')],'userProfileId':_0x4f7170[_0x7749('0x91')][_0x7749('0x92')]};if(!_0x115736)throw new Error(_0x7749('0x93'));if(_0x115736['role']==='user'){var _0x5afd4c=_0x19b168[_0x7749('0x2d')]({'plain':!![]});return db[_0x7749('0x94')][_0x7749('0x50')]({'where':{'name':_0x7749('0x95'),'userProfileId':_0x115736['userProfileId']},'raw':!![]})[_0x7749('0x2b')](function(_0x4b22f1){if(_0x4b22f1&&_0x4b22f1['autoAssociation']===0x0){return db[_0x7749('0x2e')][_0x7749('0x96')]({'name':_0x5afd4c[_0x7749('0x30')],'resourceId':_0x5afd4c['id'],'type':_0x4b22f1['name'],'sectionId':_0x4b22f1['id']},{})[_0x7749('0x2b')](function(){return _0x19b168;});}else{return _0x19b168;}})[_0x7749('0x4a')](function(_0x53002c){logger[_0x7749('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53002c);throw _0x53002c;});}return _0x19b168;})[_0x7749('0x2b')](respondWithResult(_0x5447f5,null))['catch'](handleError(_0x5447f5,null));}});}catch(_0x2f6e4f){_0x5447f5['status'](0x1f4)[_0x7749('0x97')](_0x2f6e4f);}};function removeReferences(_0x65cd27,_0x3a0033){try{if(_0x65cd27){fs[_0x7749('0x66')](_0x65cd27);logger[_0x7749('0x67')](_0x7749('0x98'));}if(_0x3a0033){rimraf(_0x3a0033,function(){});logger['info'](_0x7749('0x99'));}}catch(_0x231009){logger[_0x7749('0x2f')](_0x231009);}}exports[_0x7749('0x2a')]=function(_0x4595d1,_0x4c35b9,_0x55ce3a){return db['Plugin'][_0x7749('0x50')]({'where':{'id':_0x4595d1[_0x7749('0x4c')]['id']}})[_0x7749('0x2b')](handleEntityNotFound(_0x4c35b9,null))['then'](saveUpdates(_0x4595d1[_0x7749('0x91')],null))[_0x7749('0x2b')](respondWithResult(_0x4c35b9,null))['catch'](handleError(_0x4c35b9,null));};exports['delete']=function(_0x32e664,_0x5cf0cb,_0x582686){return db[_0x7749('0x33')][_0x7749('0x50')]({'where':{'id':_0x32e664[_0x7749('0x4c')]['id']}})[_0x7749('0x2b')](function(_0x42f18a){if(_0x42f18a){return _0x42f18a[_0x7749('0x2c')]();}})[_0x7749('0x2b')](function(_0x3f24be){rimraf(path['join'](config[_0x7749('0x53')],'server/files/plugins',path[_0x7749('0x60')](_0x3f24be[_0x7749('0x52')])),function(){});return _0x3f24be;})['then'](handleEntityNotFound(_0x5cf0cb,null))[_0x7749('0x2b')](respondWithStatusCode(_0x5cf0cb,null))[_0x7749('0x4a')](handleError(_0x5cf0cb,null));};exports[_0x7749('0x9a')]=function(_0x41a03f,_0x2f1d23,_0x18ac34){return BPromise[_0x7749('0x9b')]()[_0x7749('0x2b')](function(){if(!_0x41a03f['query'][_0x7749('0x52')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x41a03f['query'][_0x7749('0x9c')]){throw new Error(_0x7749('0x9d'));}var _0x3e57c0=_0x41a03f[_0x7749('0x37')][_0x7749('0x9e')]?_0x41a03f[_0x7749('0x37')][_0x7749('0x9e')]+':'+_0x41a03f[_0x7749('0x37')]['port']:_0x7749('0x9f')+_0x41a03f[_0x7749('0x37')][_0x7749('0x9c')];var _0x11cc28=_0x41a03f['query'][_0x7749('0x20')]?_0x41a03f[_0x7749('0x37')][_0x7749('0x20')]:!![];var _0x18e5c3=_0x41a03f['query'][_0x7749('0xa0')]?_0x41a03f['query'][_0x7749('0xa0')]:null;var _0x407d43={'method':_0x41a03f[_0x7749('0xa1')],'uri':util[_0x7749('0x55')](_0x7749('0xa2'),_0x3e57c0,_0x41a03f[_0x7749('0x37')][_0x7749('0x52')]),'json':_0x11cc28,'resolveWithFullResponse':!![],'encoding':_0x18e5c3,'qs':_0x41a03f[_0x7749('0x37')]};if(_0x41a03f[_0x7749('0xa3')]){_0x407d43[_0x7749('0xa3')]=_0x41a03f[_0x7749('0xa3')];if(_0x407d43[_0x7749('0xa3')]['content-length']){delete _0x407d43[_0x7749('0xa3')][_0x7749('0xa4')];}}if(_0x407d43[_0x7749('0xa3')][_0x7749('0xa5')]){delete _0x407d43[_0x7749('0xa3')][_0x7749('0xa5')];}return rp(_0x407d43);})[_0x7749('0x2b')](function(_0x111069){if(_0x111069){_0x2f1d23['set'](_0x111069[_0x7749('0xa3')]);logger['info'](_0x111069[_0x7749('0x91')]);if(_['endsWith'](_0x41a03f[_0x7749('0x37')][_0x7749('0x52')],_0x7749('0x51'))&&_0x111069[_0x7749('0xa6')]==0x1f4){return _0x2f1d23[_0x7749('0xa7')](_0x111069[_0x7749('0xa6')]);}else{return _0x2f1d23[_0x7749('0x1e')](_0x111069['statusCode'])[_0x7749('0x97')](_0x111069[_0x7749('0x91')]);}}else{return _0x2f1d23[_0x7749('0xa7')](0xc8);}})[_0x7749('0x4a')](handleError(_0x2f1d23,null));};exports[_0x7749('0xa8')]=function(_0x270e21,_0x250623,_0x14dba1){return BPromise[_0x7749('0x9b')]()[_0x7749('0x2b')](function(){if(!_0x270e21[_0x7749('0x37')][_0x7749('0x52')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x270e21[_0x7749('0x37')][_0x7749('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x11a8bc=_0x270e21[_0x7749('0x37')]['hostname']?_0x270e21[_0x7749('0x37')]['hostname']+':'+_0x270e21[_0x7749('0x37')]['port']:_0x7749('0x9f')+_0x270e21[_0x7749('0x37')][_0x7749('0x9c')];var _0x251a7e=_0x270e21[_0x7749('0x37')][_0x7749('0x20')]?_0x270e21[_0x7749('0x37')][_0x7749('0x20')]:!![];var _0x25b8b5=_0x270e21[_0x7749('0x37')]['encoding']?_0x270e21[_0x7749('0x37')][_0x7749('0xa0')]:null;var _0x29868f={'method':_0x270e21[_0x7749('0xa1')],'uri':util['format']('%s%s',_0x11a8bc,_0x270e21['query'][_0x7749('0x52')]),'json':_0x251a7e,'resolveWithFullResponse':!![],'encoding':_0x25b8b5,'body':_0x270e21[_0x7749('0x91')]};if(_0x270e21[_0x7749('0xa3')]){_0x29868f[_0x7749('0xa3')]=_0x270e21[_0x7749('0xa3')];if(_0x29868f[_0x7749('0xa3')]['content-length']){delete _0x29868f[_0x7749('0xa3')]['content-length'];}}if(_0x29868f[_0x7749('0xa3')][_0x7749('0xa5')]){delete _0x29868f['headers'][_0x7749('0xa5')];}return rp(_0x29868f);})['then'](function(_0x5073eb){if(_0x5073eb){_0x250623[_0x7749('0x25')](_0x5073eb[_0x7749('0xa3')]);logger['info'](_0x5073eb[_0x7749('0x91')]);return _0x250623['status'](_0x5073eb[_0x7749('0xa6')])[_0x7749('0x97')](_0x5073eb[_0x7749('0x91')]);}else{return _0x250623[_0x7749('0xa7')](0xc8);}})['catch'](handleError(_0x250623,null));};
\ No newline at end of file
index d942102..9c79a92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22ed=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x44b534,_0x6be022){var _0x2e7b00=function(_0x40912f){while(--_0x40912f){_0x44b534['push'](_0x44b534['shift']());}};_0x2e7b00(++_0x6be022);}(_0x22ed,0x1a9));var _0xd22e=function(_0x47681b,_0x3ca200){_0x47681b=_0x47681b-0x0;var _0x2793b1=_0x22ed[_0x47681b];return _0x2793b1;};'use strict';var EventEmitter=require(_0xd22e('0x0'));var Plugin=require(_0xd22e('0x1'))['db'][_0xd22e('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd22e('0x3')](0x0);var events={'afterCreate':_0xd22e('0x4'),'afterUpdate':_0xd22e('0x5'),'afterDestroy':_0xd22e('0x6')};function emitEvent(_0x10244b){return function(_0x3a1306,_0x214c17,_0x3c4894){PluginEvents[_0xd22e('0x7')](_0x10244b+':'+_0x3a1306['id'],_0x3a1306);PluginEvents['emit'](_0x10244b,_0x3a1306);_0x3c4894(null);};}for(var e in events){if(events[_0xd22e('0x8')](e)){var event=events[e];Plugin[_0xd22e('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents;
\ No newline at end of file
+var _0xf360=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save'];(function(_0x49fc33,_0x517141){var _0x3524e3=function(_0x3d1fe1){while(--_0x3d1fe1){_0x49fc33['push'](_0x49fc33['shift']());}};_0x3524e3(++_0x517141);}(_0xf360,0x9e));var _0x0f36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf360[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x0f36('0x0'));var Plugin=require(_0x0f36('0x1'))['db'][_0x0f36('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f36('0x3'),'afterUpdate':'update','afterDestroy':_0x0f36('0x4')};function emitEvent(_0x2906c1){return function(_0x181766,_0x5e1019,_0x43fb76){PluginEvents[_0x0f36('0x5')](_0x2906c1+':'+_0x181766['id'],_0x181766);PluginEvents[_0x0f36('0x5')](_0x2906c1,_0x181766);_0x43fb76(null);};}for(var e in events){if(events[_0x0f36('0x6')](e)){var event=events[e];Plugin[_0x0f36('0x7')](e,emitEvent(event));}}module[_0x0f36('0x8')]=PluginEvents;
\ No newline at end of file
index d4473e7..296691b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92ea=['rimraf','../../config/environment','./plugin.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e576a,_0x18b159){var _0x145007=function(_0x9fc3d1){while(--_0x9fc3d1){_0x2e576a['push'](_0x2e576a['shift']());}};_0x145007(++_0x18b159);}(_0x92ea,0xcc));var _0xa92e=function(_0x1ed034,_0x5d495d){_0x1ed034=_0x1ed034-0x0;var _0x4a82b7=_0x92ea[_0x1ed034];return _0x4a82b7;};'use strict';var _=require(_0xa92e('0x0'));var util=require('util');var logger=require(_0xa92e('0x1'))(_0xa92e('0x2'));var moment=require(_0xa92e('0x3'));var BPromise=require(_0xa92e('0x4'));var rp=require(_0xa92e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa92e('0x6'));var config=require(_0xa92e('0x7'));var attributes=require(_0xa92e('0x8'));module['exports']=function(_0x4c4493,_0x42e7ce){return _0x4c4493[_0xa92e('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf3b1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','lodash'];(function(_0x42e6e7,_0x1fb21e){var _0xea9870=function(_0x729e60){while(--_0x729e60){_0x42e6e7['push'](_0x42e6e7['shift']());}};_0xea9870(++_0x1fb21e);}(_0xf3b1,0x137));var _0x1f3b=function(_0x2d9762,_0x52dfb6){_0x2d9762=_0x2d9762-0x0;var _0x21cf65=_0xf3b1[_0x2d9762];return _0x21cf65;};'use strict';var _=require(_0x1f3b('0x0'));var util=require(_0x1f3b('0x1'));var logger=require(_0x1f3b('0x2'))(_0x1f3b('0x3'));var moment=require(_0x1f3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f3b('0x5'));var fs=require('fs');var path=require(_0x1f3b('0x6'));var rimraf=require(_0x1f3b('0x7'));var config=require(_0x1f3b('0x8'));var attributes=require(_0x1f3b('0x9'));module['exports']=function(_0x5f0f80,_0x1c2f19){return _0x5f0f80[_0x1f3b('0xa')](_0x1f3b('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7520af1..c720bcf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01f5=['./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','create','body','options','then','info','CreatePlugin','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x01f5,0x1f1));var _0x501f=function(_0x284772,_0x4f8dcc){_0x284772=_0x284772-0x0;var _0x4a41ec=_0x01f5[_0x284772];return _0x4a41ec;};'use strict';var _=require('lodash');var util=require(_0x501f('0x0'));var moment=require(_0x501f('0x1'));var BPromise=require(_0x501f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x501f('0x3'));var db=require(_0x501f('0x4'))['db'];var utils=require(_0x501f('0x5'));var logger=require(_0x501f('0x6'))(_0x501f('0x7'));var config=require(_0x501f('0x8'));var jayson=require(_0x501f('0x9'));var client=jayson[_0x501f('0xa')][_0x501f('0xb')]({'port':0x232a});config[_0x501f('0xc')]=_[_0x501f('0xd')](config['redis'],{'host':_0x501f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x501f('0xc')]));require(_0x501f('0xf'))[_0x501f('0x10')](socket);function respondWithRpcPromise(_0x5e7ad3,_0x5e646b,_0x5098ba){return new BPromise(function(_0x33fdd2,_0x2d7ad1){return client[_0x501f('0x11')](_0x5e7ad3,_0x5098ba)['then'](function(_0x35ff0e){logger['info'](_0x501f('0x12'),_0x5e646b,_0x501f('0x13'));logger[_0x501f('0x14')](_0x501f('0x15'),_0x5e646b,_0x501f('0x13'),JSON[_0x501f('0x16')](_0x35ff0e));if(_0x35ff0e[_0x501f('0x17')]){if(_0x35ff0e[_0x501f('0x17')]['code']===0x1f4){logger[_0x501f('0x17')]('Plugin,\x20%s,\x20%s',_0x5e646b,_0x35ff0e[_0x501f('0x17')][_0x501f('0x18')]);return _0x2d7ad1(_0x35ff0e[_0x501f('0x17')]['message']);}logger[_0x501f('0x17')]('Plugin,\x20%s,\x20%s',_0x5e646b,_0x35ff0e[_0x501f('0x17')]['message']);return _0x33fdd2(_0x35ff0e['error'][_0x501f('0x18')]);}else{logger['info'](_0x501f('0x12'),_0x5e646b,_0x501f('0x13'));_0x33fdd2(_0x35ff0e[_0x501f('0x19')]['message']);}})['catch'](function(_0x5ae8a4){logger[_0x501f('0x17')](_0x501f('0x12'),_0x5e646b,_0x5ae8a4);_0x2d7ad1(_0x5ae8a4);});});}exports['CreatePlugin']=function(_0x2441fb){var _0x457e76=this;return new Promise(function(_0xac7d51,_0x18fa17){return db['Plugin'][_0x501f('0x1a')](_0x2441fb[_0x501f('0x1b')],{'raw':_0x2441fb[_0x501f('0x1c')]?_0x2441fb[_0x501f('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x501f('0x1d')](function(_0x5939fa){logger[_0x501f('0x1e')](_0x501f('0x1f'),_0x2441fb);logger[_0x501f('0x14')](_0x501f('0x1f'),_0x2441fb,JSON[_0x501f('0x16')](_0x5939fa));_0xac7d51(_0x5939fa);})['catch'](function(_0x6c4f4e){logger[_0x501f('0x17')]('CreatePlugin',_0x6c4f4e['message'],_0x2441fb);_0x18fa17(_0x457e76[_0x501f('0x17')](0x1f4,_0x6c4f4e[_0x501f('0x18')]));});});};
\ No newline at end of file
+var _0xdda7=['code','error','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','redis','defaults','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1ca995,_0x458edc){var _0x6c1cbb=function(_0x109124){while(--_0x109124){_0x1ca995['push'](_0x1ca995['shift']());}};_0x6c1cbb(++_0x458edc);}(_0xdda7,0x184));var _0x7dda=function(_0x46852d,_0x3fce4f){_0x46852d=_0x46852d-0x0;var _0x40c05a=_0xdda7[_0x46852d];return _0x40c05a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7dda('0x0'));var BPromise=require(_0x7dda('0x1'));var rs=require(_0x7dda('0x2'));var fs=require('fs');var Redis=require(_0x7dda('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dda('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7dda('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7dda('0x6')]({'port':0x232a});config[_0x7dda('0x7')]=_[_0x7dda('0x8')](config['redis'],{'host':_0x7dda('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0x7dda('0xa')](socket);function respondWithRpcPromise(_0xa21e8e,_0x1232d7,_0x610c5f){return new BPromise(function(_0x41354d,_0x5edfc4){return client[_0x7dda('0xb')](_0xa21e8e,_0x610c5f)[_0x7dda('0xc')](function(_0x261b1a){logger[_0x7dda('0xd')](_0x7dda('0xe'),_0x1232d7,_0x7dda('0xf'));logger[_0x7dda('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1232d7,_0x7dda('0xf'),JSON[_0x7dda('0x11')](_0x261b1a));if(_0x261b1a['error']){if(_0x261b1a['error'][_0x7dda('0x12')]===0x1f4){logger[_0x7dda('0x13')]('Plugin,\x20%s,\x20%s',_0x1232d7,_0x261b1a[_0x7dda('0x13')][_0x7dda('0x14')]);return _0x5edfc4(_0x261b1a[_0x7dda('0x13')]['message']);}logger[_0x7dda('0x13')](_0x7dda('0xe'),_0x1232d7,_0x261b1a['error'][_0x7dda('0x14')]);return _0x41354d(_0x261b1a['error'][_0x7dda('0x14')]);}else{logger[_0x7dda('0xd')]('Plugin,\x20%s,\x20%s',_0x1232d7,_0x7dda('0xf'));_0x41354d(_0x261b1a[_0x7dda('0x15')][_0x7dda('0x14')]);}})[_0x7dda('0x16')](function(_0x356b47){logger['error'](_0x7dda('0xe'),_0x1232d7,_0x356b47);_0x5edfc4(_0x356b47);});});}exports['CreatePlugin']=function(_0x497583){var _0x1558c0=this;return new Promise(function(_0x141306,_0x2fa167){return db[_0x7dda('0x17')][_0x7dda('0x18')](_0x497583[_0x7dda('0x19')],{'raw':_0x497583[_0x7dda('0x1a')]?_0x497583[_0x7dda('0x1a')][_0x7dda('0x1b')]===undefined?!![]:![]:!![]})[_0x7dda('0xc')](function(_0x31bba0){logger[_0x7dda('0xd')](_0x7dda('0x1c'),_0x497583);logger[_0x7dda('0x10')](_0x7dda('0x1c'),_0x497583,JSON[_0x7dda('0x11')](_0x31bba0));_0x141306(_0x31bba0);})[_0x7dda('0x16')](function(_0x2b9c11){logger[_0x7dda('0x13')]('CreatePlugin',_0x2b9c11[_0x7dda('0x14')],_0x497583);_0x2fa167(_0x1558c0[_0x7dda('0x13')](0x1f4,_0x2b9c11[_0x7dda('0x14')]));});});};
\ No newline at end of file
index 3e61128..7056de7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfae0=['removeListener','plugin:','save','remove','update'];(function(_0x25261f,_0x127664){var _0x485219=function(_0xdcd262){while(--_0xdcd262){_0x25261f['push'](_0x25261f['shift']());}};_0x485219(++_0x127664);}(_0xfae0,0x188));var _0x0fae=function(_0x4ddc0e,_0x349cab){_0x4ddc0e=_0x4ddc0e-0x0;var _0x17a6a4=_0xfae0[_0x4ddc0e];return _0x17a6a4;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x0fae('0x0'),_0x0fae('0x1'),_0x0fae('0x2')];function createListener(_0xb87fa8,_0x3571ed){return function(_0x450edb){_0x3571ed['emit'](_0xb87fa8,_0x450edb);};}function removeListener(_0x3f907e,_0x7a0f47){return function(){PluginEvents[_0x0fae('0x3')](_0x3f907e,_0x7a0f47);};}exports['register']=function(_0x24194){for(var _0xf54e5d=0x0,_0x3b1ca5=events['length'];_0xf54e5d<_0x3b1ca5;_0xf54e5d++){var _0x219704=events[_0xf54e5d];var _0x47322c=createListener(_0x0fae('0x4')+_0x219704,_0x24194);PluginEvents['on'](_0x219704,_0x47322c);}};
\ No newline at end of file
+var _0xc94d=['remove','update','removeListener','register','length','plugin:','./plugin.events'];(function(_0x36ee36,_0xdf9e87){var _0xb2d25c=function(_0x3820a9){while(--_0x3820a9){_0x36ee36['push'](_0x36ee36['shift']());}};_0xb2d25c(++_0xdf9e87);}(_0xc94d,0x1b1));var _0xdc94=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc94d[_0x14add3];return _0x4a174f;};'use strict';var PluginEvents=require(_0xdc94('0x0'));var events=['save',_0xdc94('0x1'),_0xdc94('0x2')];function createListener(_0x1fbbd0,_0x4d5eee){return function(_0x423560){_0x4d5eee['emit'](_0x1fbbd0,_0x423560);};}function removeListener(_0xa13690,_0x5f5483){return function(){PluginEvents[_0xdc94('0x3')](_0xa13690,_0x5f5483);};}exports[_0xdc94('0x4')]=function(_0x27341c){for(var _0x116dce=0x0,_0x45a0ad=events[_0xdc94('0x5')];_0x116dce<_0x45a0ad;_0x116dce++){var _0x590809=events[_0x116dce];var _0x37f8b4=createListener(_0xdc94('0x6')+_0x590809,_0x27341c);PluginEvents['on'](_0x590809,_0x37f8b4);}};
\ No newline at end of file
index ffcc1fa..dc253c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x21da9d,_0x3c4d4a){var _0x4f3efe=function(_0x444d75){while(--_0x444d75){_0x21da9d['push'](_0x21da9d['shift']());}};_0x4f3efe(++_0x3c4d4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router;
\ No newline at end of file
+var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x370ab6,_0x394181){var _0x437ca0=function(_0x41d305){while(--_0x41d305){_0x370ab6['push'](_0x370ab6['shift']());}};_0x437ca0(++_0x394181);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router;
\ No newline at end of file
index e9d1609..495749a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcea2=['then','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','update','restart','stop','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','status','json','stack','name','send','npm\x20install','info','index','list'];(function(_0x3331f8,_0x492685){var _0x422f06=function(_0x1f950f){while(--_0x1f950f){_0x3331f8['push'](_0x3331f8['shift']());}};_0x422f06(++_0x492685);}(_0xcea2,0x15a));var _0x2cea=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xcea2[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x2cea('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x2cea('0x1'))('api');var path=require(_0x2cea('0x2'));var exec=require(_0x2cea('0x3'))[_0x2cea('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3ff73f,_0x46060b){return function(_0x11596e){if(!_0x11596e){_0x3ff73f['sendStatus'](0x194);;}return _0x11596e;};}function respondWithResult(_0x34f0f2,_0x485c26){_0x485c26=_0x485c26||0xc8;return function(_0x2d69ff){if(_0x2d69ff){return _0x34f0f2[_0x2cea('0x5')](_0x485c26)[_0x2cea('0x6')](_0x2d69ff);}return null;};}function handleError(_0x160cca,_0x11c5c0){_0x11c5c0=_0x11c5c0||0x1f4;return function(_0x1519f6){logger['error'](_0x1519f6[_0x2cea('0x7')]);if(_0x1519f6[_0x2cea('0x8')]){delete _0x1519f6[_0x2cea('0x8')];}_0x160cca[_0x2cea('0x5')](_0x11c5c0)[_0x2cea('0x9')](_0x1519f6);};}function execChildProcess(){return new BPromise(function(_0x439c4d,_0x4298a4){exec(_0x2cea('0xa'),function(_0x58a102,_0x5724b0,_0x2fe9cd){logger[_0x2cea('0xb')](_0x5724b0);logger['info'](_0x2fe9cd);if(_0x58a102){logger['error'](_0x58a102);return _0x4298a4(_0x58a102);}return _0x439c4d(_0x5724b0);});});}exports[_0x2cea('0xc')]=function(_0x4e0da7,_0xa4ce3d){return pm2[_0x2cea('0xd')]()[_0x2cea('0xe')](function(_0x5cf805){if(_0x5cf805){var _0x4d7f8b=_['reject'](_0x5cf805,function(_0x369c72){return _0x369c72['name']===_0x2cea('0xf')||_0x369c72[_0x2cea('0x8')]===_0x2cea('0x10');});return{'rows':_0x4d7f8b,'count':_0x4d7f8b[_0x2cea('0x11')]};}return null;})[_0x2cea('0xe')](respondWithResult(_0xa4ce3d,null))[_0x2cea('0x12')](handleError(_0xa4ce3d,null));};exports[_0x2cea('0x13')]=function(_0x1ead4c,_0x5eee09){return pm2[_0x2cea('0x14')](_0x1ead4c[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](respondWithResult(_0x5eee09,null))[_0x2cea('0xe')](handleEntityNotFound(_0x5eee09,null))[_0x2cea('0x12')](handleError(_0x5eee09,null));};exports[_0x2cea('0x16')]=function(_0x5d75c4,_0x27375b){if(_0x5d75c4['body'][_0x2cea('0x8')]&&_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x18')]){var _0x4fd3d5=path[_0x2cea('0x19')](__dirname,_0x2cea('0x1a'),_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x18')]);var _0x3246bc=process[_0x2cea('0x1b')]();process[_0x2cea('0x1c')](path['dirname'](_0x4fd3d5));return execChildProcess()[_0x2cea('0xe')](function(_0x5e5b46){process[_0x2cea('0x1c')](_0x3246bc);return pm2['start']({'name':_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x8')],'script':_0x4fd3d5});})['then'](function(_0x41d272){pm2[_0x2cea('0x1d')]();return _0x41d272[0x0];})[_0x2cea('0xe')](respondWithResult(_0x27375b,0xc9))[_0x2cea('0x12')](handleError(_0x27375b,null));}else{return _0x27375b[_0x2cea('0x5')](0x1f4)[_0x2cea('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2cea('0x1e')]=function(_0x32b6a3,_0x2bbe9b){if(_0x32b6a3[_0x2cea('0x17')]['id']){delete _0x32b6a3[_0x2cea('0x17')]['id'];}var _0x3ea40c={'online':_0x2cea('0x1f'),'stopped':_0x2cea('0x20')};if(_0x3ea40c['hasOwnProperty'](_0x32b6a3[_0x2cea('0x17')][_0x2cea('0x5')])){return pm2[_0x3ea40c[_0x32b6a3['body'][_0x2cea('0x5')]]](_0x32b6a3[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](respondWithResult(_0x2bbe9b,0xc8))[_0x2cea('0x12')](handleError(_0x2bbe9b,null));}else{return _0x2bbe9b['status'](0x1f4)[_0x2cea('0x9')]({'message':_0x2cea('0x21')});}};exports['destroy']=function(_0x2bf4e9,_0x2e3d44){if(_0x2bf4e9[_0x2cea('0x17')]['id']){delete _0x2bf4e9[_0x2cea('0x17')]['id'];}if(_0x2bf4e9[_0x2cea('0x15')]['id']){return pm2[_0x2cea('0x22')](_0x2bf4e9[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](function(_0x2e1cd6){pm2[_0x2cea('0x1d')]();return _0x2e1cd6[0x0];})[_0x2cea('0xe')](respondWithResult(_0x2e3d44,null))['catch'](handleError(_0x2e3d44,null));}else{return _0x2e3d44[_0x2cea('0x5')](0x1f4)[_0x2cea('0x9')]({'message':_0x2cea('0x23')});}};
\ No newline at end of file
+var _0x2dae=['stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error'];(function(_0x2ecf03,_0x2adccf){var _0x4418ab=function(_0x201f87){while(--_0x201f87){_0x2ecf03['push'](_0x2ecf03['shift']());}};_0x4418ab(++_0x2adccf);}(_0x2dae,0xc3));var _0xe2da=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x2dae[_0xcfc44];return _0x307a25;};'use strict';var _=require(_0xe2da('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var path=require(_0xe2da('0x3'));var exec=require(_0xe2da('0x4'))[_0xe2da('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25b9f2,_0x439b5d){return function(_0x77e45e){if(!_0x77e45e){_0x25b9f2[_0xe2da('0x6')](0x194);;}return _0x77e45e;};}function respondWithResult(_0x523c60,_0x3e3e25){_0x3e3e25=_0x3e3e25||0xc8;return function(_0x89c70b){if(_0x89c70b){return _0x523c60[_0xe2da('0x7')](_0x3e3e25)[_0xe2da('0x8')](_0x89c70b);}return null;};}function handleError(_0x238da3,_0x1c71ea){_0x1c71ea=_0x1c71ea||0x1f4;return function(_0x29960a){logger[_0xe2da('0x9')](_0x29960a[_0xe2da('0xa')]);if(_0x29960a['name']){delete _0x29960a[_0xe2da('0xb')];}_0x238da3[_0xe2da('0x7')](_0x1c71ea)[_0xe2da('0xc')](_0x29960a);};}function execChildProcess(){return new BPromise(function(_0x17086c,_0x3c1309){exec(_0xe2da('0xd'),function(_0x1a29b9,_0x173244,_0x5aab71){logger[_0xe2da('0xe')](_0x173244);logger['info'](_0x5aab71);if(_0x1a29b9){logger[_0xe2da('0x9')](_0x1a29b9);return _0x3c1309(_0x1a29b9);}return _0x17086c(_0x173244);});});}exports[_0xe2da('0xf')]=function(_0x37064e,_0x411b9f){return pm2[_0xe2da('0x10')]()[_0xe2da('0x11')](function(_0x295a86){if(_0x295a86){var _0x48584b=_[_0xe2da('0x12')](_0x295a86,function(_0x5e1702){return _0x5e1702['name']===_0xe2da('0x13')||_0x5e1702[_0xe2da('0xb')]===_0xe2da('0x14');});return{'rows':_0x48584b,'count':_0x48584b['length']};}return null;})[_0xe2da('0x11')](respondWithResult(_0x411b9f,null))[_0xe2da('0x15')](handleError(_0x411b9f,null));};exports[_0xe2da('0x16')]=function(_0x33568f,_0x4e1623){return pm2[_0xe2da('0x17')](_0x33568f[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x4e1623,null))[_0xe2da('0x11')](handleEntityNotFound(_0x4e1623,null))[_0xe2da('0x15')](handleError(_0x4e1623,null));};exports['create']=function(_0x56eeb1,_0x2e16b2){if(_0x56eeb1['body'][_0xe2da('0xb')]&&_0x56eeb1[_0xe2da('0x19')][_0xe2da('0x1a')]){var _0x203d36=path[_0xe2da('0x1b')](__dirname,_0xe2da('0x1c'),_0x56eeb1['body'][_0xe2da('0x1a')]);var _0x53cc4e=process[_0xe2da('0x1d')]();process[_0xe2da('0x1e')](path[_0xe2da('0x1f')](_0x203d36));return execChildProcess()[_0xe2da('0x11')](function(_0x30dea4){process[_0xe2da('0x1e')](_0x53cc4e);return pm2[_0xe2da('0x20')]({'name':_0x56eeb1[_0xe2da('0x19')]['name'],'script':_0x203d36});})[_0xe2da('0x11')](function(_0x357bff){pm2[_0xe2da('0x21')]();return _0x357bff[0x0];})[_0xe2da('0x11')](respondWithResult(_0x2e16b2,0xc9))[_0xe2da('0x15')](handleError(_0x2e16b2,null));}else{return _0x2e16b2[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe2da('0x22')]=function(_0x3e23d7,_0x1dc228){if(_0x3e23d7[_0xe2da('0x19')]['id']){delete _0x3e23d7[_0xe2da('0x19')]['id'];}var _0x2b6c9e={'online':_0xe2da('0x23'),'stopped':_0xe2da('0x24')};if(_0x2b6c9e['hasOwnProperty'](_0x3e23d7['body']['status'])){return pm2[_0x2b6c9e[_0x3e23d7[_0xe2da('0x19')][_0xe2da('0x7')]]](_0x3e23d7[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x1dc228,0xc8))['catch'](handleError(_0x1dc228,null));}else{return _0x1dc228['status'](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x25')});}};exports[_0xe2da('0x26')]=function(_0x39f983,_0x7ab5ee){if(_0x39f983[_0xe2da('0x19')]['id']){delete _0x39f983[_0xe2da('0x19')]['id'];}if(_0x39f983[_0xe2da('0x18')]['id']){return pm2[_0xe2da('0x27')](_0x39f983['params']['id'])['then'](function(_0x672767){pm2[_0xe2da('0x21')]();return _0x672767[0x0];})[_0xe2da('0x11')](respondWithResult(_0x7ab5ee,null))[_0xe2da('0x15')](handleError(_0x7ab5ee,null));}else{return _0x7ab5ee[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x28')});}};
\ No newline at end of file
index cce2004..76b3c06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x081d=['Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','getQueues','express'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x081d,0x15d));var _0xd081=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x081d[_0x144b30];return _0x1bb7bc;};'use strict';var express=require(_0xd081('0x0'));var router=express[_0xd081('0x1')]();var auth=require(_0xd081('0x2'));var controller=require(_0xd081('0x3'));router[_0xd081('0x4')](_0xd081('0x5'),auth['isAuthenticated'](),controller[_0xd081('0x6')]);router[_0xd081('0x4')](_0xd081('0x7'),auth[_0xd081('0x8')](),controller[_0xd081('0x9')]);module['exports']=router;
\ No newline at end of file
+var _0x7484=['/queues','getQueues','exports','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x7484,0x17f));var _0x4748=function(_0x2d736e,_0x5ef3ee){_0x2d736e=_0x2d736e-0x0;var _0x2231c8=_0x7484[_0x2d736e];return _0x2231c8;};'use strict';var express=require(_0x4748('0x0'));var router=express[_0x4748('0x1')]();var auth=require(_0x4748('0x2'));var controller=require('./realtime.controller');router[_0x4748('0x3')](_0x4748('0x4'),auth[_0x4748('0x5')](),controller[_0x4748('0x6')]);router['get'](_0x4748('0x7'),auth[_0x4748('0x5')](),controller[_0x4748('0x8')]);module[_0x4748('0x9')]=router;
\ No newline at end of file
index 1aefa8d..cd2d295 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a09=['undefined','limit','set','Content-Range','json','getChannels','query','globalQueueFilter','globalStatusFilter','*pause','then','format','Channel\x20parameter\x20%s\x20is\x20invalid','channel','sort','includes','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','userProfileId','Agents','extraQueryConditions','UserProfile','getResources','findAndCountAll','count','find','merge','globalStatus','getAgentStatus','Status','fields','split','pick','catch','resolve','isValidChannel','toLowerCase','startCase','Queue','voice','outbound','dialMethod','QueueCampaigns','Queues','name','getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x0a09,0x140));var _0x90a0=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x0a09[_0x3e961c];return _0x474f9c;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0x90a0('0x0'));var rtq=require(_0x90a0('0x1'));var qs=require(_0x90a0('0x2'));var utils=require(_0x90a0('0x3'));var db=require(_0x90a0('0x4'))['db'];var APIBadRequestError=require(_0x90a0('0x5'))['APIBadRequestError'];var APIHandleError=require(_0x90a0('0x5'))[_0x90a0('0x6')];function respondWithFilteredResult(_0x22aae9,_0x315b07){return function(_0x5d5b5b){if(_0x5d5b5b){var _0x2de6cb=typeof _0x315b07[_0x90a0('0x7')]===_0x90a0('0x8')&&typeof _0x315b07[_0x90a0('0x9')]===_0x90a0('0x8');var _0x34acaf=_0x5d5b5b['count'];var _0x1fc275=_0x2de6cb?0x0:_0x315b07[_0x90a0('0x7')];var _0x24dc79=_0x2de6cb?_0x5d5b5b['count']:_0x315b07[_0x90a0('0x7')]+_0x315b07[_0x90a0('0x9')];var _0x586de8;if(_0x24dc79>=_0x34acaf){_0x24dc79=_0x34acaf;_0x586de8=0xc8;}else{_0x586de8=0xce;}_0x22aae9['status'](_0x586de8);return _0x22aae9[_0x90a0('0xa')](_0x90a0('0xb'),_0x1fc275+'-'+_0x24dc79+'/'+_0x34acaf)[_0x90a0('0xc')](_0x5d5b5b);}return null;};}exports['getAgents']=function(_0x4f275a,_0x14dbcc){var _0x4dd4e6={'count':0x0,'rows':[]};var _0x201cee={};var _0x1ac382;var _0x172ee5=utils[_0x90a0('0xd')]();var _0x2ee1ea;var _0x2ab094;var _0x26ad3e=_0x4f275a[_0x90a0('0xe')][_0x90a0('0xf')];var _0x57fb36=_0x4f275a[_0x90a0('0xe')][_0x90a0('0x10')];var _0x44e1fb=_0x4f275a[_0x90a0('0xe')]['pauseTypeFilter'];var _0x49cd7a=_0x57fb36==='pause'||_0x57fb36===_0x90a0('0x11')?!![]:![];var _0x469f29=[];var _0x591068;var _0x258363;Promise['resolve']()[_0x90a0('0x12')](function(){if(_0x4f275a[_0x90a0('0xe')]['channel']){if(!utils['isValidChannel'](_0x4f275a[_0x90a0('0xe')]['channel'])){throw new APIBadRequestError(util[_0x90a0('0x13')](_0x90a0('0x14'),_0x4f275a['query'][_0x90a0('0x15')]));}_0x1ac382=_0x4f275a['query']['channel']['toLowerCase']();}if(!_0x4f275a[_0x90a0('0xe')][_0x90a0('0x16')]||!_0x4f275a[_0x90a0('0xe')][_0x90a0('0x16')][_0x90a0('0x17')]('globalStatus')){_0x4f275a[_0x90a0('0xe')][_0x90a0('0x16')]=rta[_0x90a0('0x18')](_0x4f275a[_0x90a0('0xe')][_0x90a0('0x16')]);return;}var _0x1fd42f=rta[_0x90a0('0x19')](_0x4f275a[_0x90a0('0xe')]['sort']);_0x4f275a['query'][_0x90a0('0x16')]=_0x1fd42f['fields'][_0x90a0('0x1a')](',');_0x591068=_0x1fd42f[_0x90a0('0x1b')];})['then'](function(){if(!_0x26ad3e){return[];}return rta[_0x90a0('0x1c')](_0x26ad3e,_0x1ac382);})[_0x90a0('0x12')](function(_0x5e729b){_0x469f29=_0x5e729b;return rta[_0x90a0('0x1d')]();})['then'](function(_0x44ba8c){_0x2ab094=_0x44ba8c[_0x90a0('0x1e')];if((!_0x57fb36||_0x49cd7a)&&!_0x591068){return _0x469f29;}if(_0x591068&&!_0x57fb36){return rta[_0x90a0('0x1f')](_0x2ab094,_0x469f29,_0x591068);}else{return rta[_0x90a0('0x20')](_0x2ab094,_0x469f29,_0x57fb36);}})['then'](function(_0x5e8ab7){_0x469f29=_0x5e8ab7;var _0x321bcf=![];if(_0x469f29[_0x90a0('0x21')]===0x0){if(_0x26ad3e||_0x57fb36){_0x321bcf=!![];}if(_0x49cd7a){_0x321bcf=![];}}if(_0x321bcf){return _0x4dd4e6;}var _0x2dcea=_[_0x90a0('0x22')](db[_0x90a0('0x23')][_0x90a0('0x24')],function(_0x924c1a){return{'name':_0x924c1a[_0x90a0('0x25')],'type':_0x924c1a[_0x90a0('0x26')][_0x90a0('0x27')]};});_0x4f275a[_0x90a0('0xe')][_0x90a0('0x28')]=_0x90a0('0x29');_0x4f275a[_0x90a0('0xe')][_0x90a0('0x2a')]=!![];_0x201cee=qs[_0x90a0('0x2b')](_0x2dcea,_0x4f275a);_0x201cee[_0x90a0('0x2c')]=!![];var _0x34302d=[];if(_0x469f29[_0x90a0('0x21')]>0x0){_0x34302d[_0x90a0('0x2d')]({'id':{'$in':_0x469f29}});if(_0x591068&&!_0x57fb36){_0x258363=[db[_0x90a0('0x2e')][_0x90a0('0x2f')](_0x90a0('0x30')+_0x469f29+')')];_0x201cee[_0x90a0('0x1b')]=_0x258363;}}if(_0x49cd7a){_0x172ee5[_0x90a0('0x31')](function(_0x3143c8){var _0x51a0a4=!![];if(_0x57fb36===_0x90a0('0x11')&&_0x1ac382!==_0x3143c8){_0x51a0a4=![];}_0x34302d[_0x90a0('0x2d')]({[_0x3143c8+'Pause']:_0x51a0a4});});if(_0x44e1fb){_0x34302d[_0x90a0('0x2d')]({'pauseType':_0x44e1fb});}}else if(_0x57fb36){_0x172ee5[_0x90a0('0x31')](function(_0x583caf){_0x34302d['push']({[_0x583caf+_0x90a0('0x32')]:![]});});}_0x201cee['where']=_['merge'](_0x201cee[_0x90a0('0x33')],{'$and':_0x34302d});if(_0x4f275a[_0x90a0('0x34')][_0x90a0('0x28')]===_0x90a0('0x34')){var _0x3e262d={'params':{'id':_0x4f275a[_0x90a0('0x34')][_0x90a0('0x35')]},'query':{'section':_0x90a0('0x36'),'role':_0x90a0('0x29'),'online':!![],'raw':!![],'ids':_0x469f29,'customSorting':_0x258363}};if(_0x49cd7a){_0x3e262d[_0x90a0('0xe')][_0x90a0('0x37')]=_0x34302d;}_0x3e262d['query']=Object['assign'](_0x3e262d[_0x90a0('0xe')],_0x4f275a[_0x90a0('0xe')]);delete _0x3e262d[_0x90a0('0xe')]['id'];return db[_0x90a0('0x38')][_0x90a0('0x39')](_0x3e262d);}return db[_0x90a0('0x23')][_0x90a0('0x3a')](_0x201cee);})['then'](function(_0x335c4b){_0x4dd4e6[_0x90a0('0x3b')]=_0x335c4b[_0x90a0('0x3b')];_0x2ee1ea=_0x335c4b[_0x90a0('0x1e')];return _0x2ee1ea[_0x90a0('0x22')](function(_0x50c3c0){var _0x27d4b0=_[_0x90a0('0x3c')](_0x2ab094,['id',_0x50c3c0['id']]);if(_0x27d4b0){var _0x24bbaa=rta['filterAgentAttributes'](_0x27d4b0);_[_0x90a0('0x3d')](_0x50c3c0,_0x24bbaa);}_0x50c3c0[_0x90a0('0x3e')]=rta[_0x90a0('0x3f')](_0x50c3c0);if(_0x50c3c0[_0x90a0('0x3e')][_0x90a0('0x17')]('pause')){_0x172ee5['forEach'](function(_0x3015be){if(_0x50c3c0[_0x3015be+_0x90a0('0x32')]){_0x50c3c0[_0x3015be+_0x90a0('0x40')]='pause';}});}return _0x50c3c0;});})[_0x90a0('0x12')](function(_0x5cfb6f){if(!_0x591068||_0x258363){return _0x5cfb6f;}return rta['sortAgentsByStatus'](_0x5cfb6f,_0x591068);})[_0x90a0('0x12')](function(_0x1c86dd){var _0x3e011f=null;if(_0x4f275a['query'][_0x90a0('0x41')]){var _0x6d03a9=_0x4f275a[_0x90a0('0xe')][_0x90a0('0x41')][_0x90a0('0x42')](',');_0x3e011f=_0x1c86dd[_0x90a0('0x22')](function(_0x57bd68){return _[_0x90a0('0x43')](_0x57bd68,_0x6d03a9);});}_0x4dd4e6[_0x90a0('0x1e')]=_0x3e011f||_0x1c86dd;return _0x4dd4e6;})[_0x90a0('0x12')](respondWithFilteredResult(_0x14dbcc,_0x201cee))[_0x90a0('0x44')](APIHandleError(_0x14dbcc));};exports['getQueues']=function(_0x5c24c4,_0x5748a6){var _0x337df4={'count':0x0,'rows':[]};var _0x315055={};var _0x2fec6b;var _0x4b718a;var _0x43a3a4;Promise[_0x90a0('0x45')]()['then'](function(){if(_0x5c24c4[_0x90a0('0xe')]['channel']){if(!utils[_0x90a0('0x46')](_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x15')])){throw new APIBadRequestError(util[_0x90a0('0x13')](_0x90a0('0x14'),_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x15')]));}_0x2fec6b=_0x5c24c4['query'][_0x90a0('0x15')][_0x90a0('0x47')]();}var _0x46e81d=_[_0x90a0('0x48')](_0x2fec6b)+_0x90a0('0x49');var _0x2f7665=_[_0x90a0('0x22')](db[_0x46e81d][_0x90a0('0x24')],function(_0x18f2cc){return{'name':_0x18f2cc[_0x90a0('0x25')],'type':_0x18f2cc['type']['key']};});if(!_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x41')]){var _0x3c9a8c=['id','name'];if(_0x2fec6b===_0x90a0('0x4a')){_0x3c9a8c[_0x90a0('0x2d')]('type');if(_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x26')]===_0x90a0('0x4b')){_0x3c9a8c[_0x90a0('0x2d')](['dialActive',_0x90a0('0x4c')]);}}_0x5c24c4['query'][_0x90a0('0x41')]=_0x3c9a8c[_0x90a0('0x1a')](',');}_0x315055=qs[_0x90a0('0x2b')](_0x2f7665,_0x5c24c4);if(_0x5c24c4['user'][_0x90a0('0x28')]==='user'){var _0x54e634={'params':{'id':_0x5c24c4[_0x90a0('0x34')][_0x90a0('0x35')]},'query':{'section':_0x2fec6b===_0x90a0('0x4a')&&_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x26')]===_0x90a0('0x4b')?_0x90a0('0x4d'):_[_0x90a0('0x48')](_0x2fec6b)+_0x90a0('0x4e'),'type':_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x26')],'nolimit':!![],'sort':_0x90a0('0x4f'),'filter':_0x5c24c4[_0x90a0('0xe')]['filter']}};return db[_0x90a0('0x38')][_0x90a0('0x39')](_0x54e634);}return db[_0x46e81d]['findAndCountAll'](_0x315055);})[_0x90a0('0x12')](function(_0x89b229){_0x337df4[_0x90a0('0x3b')]=_0x89b229['count'];_0x4b718a=_0x89b229['rows'];return rtq[_0x90a0('0x50')](_0x5c24c4,_0x2fec6b);})['then'](function(_0x21c3e9){_0x43a3a4=_0x21c3e9[_0x90a0('0x1e')];return rtq[_0x90a0('0x51')](_0x4b718a,_0x43a3a4,_0x2fec6b,_0x5c24c4[_0x90a0('0xe')][_0x90a0('0x26')]);})['then'](function(_0x44e8aa){_0x337df4[_0x90a0('0x1e')]=_0x44e8aa;return _0x337df4;})[_0x90a0('0x12')](respondWithFilteredResult(_0x5748a6,_0x315055))[_0x90a0('0x44')](APIHandleError(_0x5748a6));};
\ No newline at end of file
+var _0x6453=['../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','globalStatus','sort','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','role','raw','sequelize','literal','forEach','*pause','Pause','push','where','merge','user','userProfileId','Agents','agent','User','findAndCountAll','find','filterAgentAttributes','getAgentStatus','Status','sortAgentsByStatus','split','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','Queue','voice','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','startCase','Queues','name','filter','UserProfile','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents'];(function(_0x58e4cb,_0x322bbc){var _0x3b8a49=function(_0xbd9d4){while(--_0xbd9d4){_0x58e4cb['push'](_0x58e4cb['shift']());}};_0x3b8a49(++_0x322bbc);}(_0x6453,0x1ef));var _0x3645=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x6453[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var rta=require(_0x3645('0x2'));var rtq=require(_0x3645('0x3'));var qs=require(_0x3645('0x4'));var utils=require(_0x3645('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x3645('0x6'))[_0x3645('0x7')];var APIHandleError=require(_0x3645('0x6'))['handleError'];function respondWithFilteredResult(_0x1c4c5c,_0x1615f3){return function(_0x33d294){if(_0x33d294){var _0x150e00=typeof _0x1615f3[_0x3645('0x8')]===_0x3645('0x9')&&typeof _0x1615f3[_0x3645('0xa')]===_0x3645('0x9');var _0x35891a=_0x33d294[_0x3645('0xb')];var _0xb9c62a=_0x150e00?0x0:_0x1615f3[_0x3645('0x8')];var _0x50daa9=_0x150e00?_0x33d294['count']:_0x1615f3[_0x3645('0x8')]+_0x1615f3[_0x3645('0xa')];var _0x1bb1be;if(_0x50daa9>=_0x35891a){_0x50daa9=_0x35891a;_0x1bb1be=0xc8;}else{_0x1bb1be=0xce;}_0x1c4c5c[_0x3645('0xc')](_0x1bb1be);return _0x1c4c5c['set'](_0x3645('0xd'),_0xb9c62a+'-'+_0x50daa9+'/'+_0x35891a)['json'](_0x33d294);}return null;};}exports[_0x3645('0xe')]=function(_0x3575ec,_0x2a80c7){var _0x2310ee={'count':0x0,'rows':[]};var _0x1fc7be={};var _0x5b12cf;var _0x3f4cc1=utils[_0x3645('0xf')]();var _0x20766c;var _0x2cf053;var _0x4d8eec=_0x3575ec[_0x3645('0x10')][_0x3645('0x11')];var _0x4cfc6b=_0x3575ec[_0x3645('0x10')][_0x3645('0x12')];var _0x2fb25a=_0x3575ec[_0x3645('0x10')][_0x3645('0x13')];var _0x94972=_0x4cfc6b===_0x3645('0x14')||_0x4cfc6b==='*pause'?!![]:![];var _0x407a96=[];var _0x15cfde;var _0x3785a3;Promise[_0x3645('0x15')]()[_0x3645('0x16')](function(){if(_0x3575ec[_0x3645('0x10')][_0x3645('0x17')]){if(!utils[_0x3645('0x18')](_0x3575ec[_0x3645('0x10')]['channel'])){throw new APIBadRequestError(util[_0x3645('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3575ec[_0x3645('0x10')][_0x3645('0x17')]));}_0x5b12cf=_0x3575ec[_0x3645('0x10')][_0x3645('0x17')]['toLowerCase']();}if(!_0x3575ec[_0x3645('0x10')]['sort']||!_0x3575ec['query']['sort']['includes'](_0x3645('0x1a'))){_0x3575ec['query'][_0x3645('0x1b')]=rta[_0x3645('0x1c')](_0x3575ec[_0x3645('0x10')]['sort']);return;}var _0x43dd4d=rta[_0x3645('0x1d')](_0x3575ec[_0x3645('0x10')][_0x3645('0x1b')]);_0x3575ec['query']['sort']=_0x43dd4d[_0x3645('0x1e')]['join'](',');_0x15cfde=_0x43dd4d[_0x3645('0x1f')];})['then'](function(){if(!_0x4d8eec){return[];}return rta[_0x3645('0x20')](_0x4d8eec,_0x5b12cf);})['then'](function(_0x67d0d8){_0x407a96=_0x67d0d8;return rta[_0x3645('0x21')]();})[_0x3645('0x16')](function(_0x126838){_0x2cf053=_0x126838[_0x3645('0x22')];if((!_0x4cfc6b||_0x94972)&&!_0x15cfde){return _0x407a96;}if(_0x15cfde&&!_0x4cfc6b){return rta[_0x3645('0x23')](_0x2cf053,_0x407a96,_0x15cfde);}else{return rta[_0x3645('0x24')](_0x2cf053,_0x407a96,_0x4cfc6b);}})[_0x3645('0x16')](function(_0x3d938f){_0x407a96=_0x3d938f;var _0x4d5080=![];if(_0x407a96[_0x3645('0x25')]===0x0){if(_0x4d8eec||_0x4cfc6b){_0x4d5080=!![];}if(_0x94972){_0x4d5080=![];}}if(_0x4d5080){return _0x2310ee;}var _0x40d952=_[_0x3645('0x26')](db['User'][_0x3645('0x27')],function(_0x6becdc){return{'name':_0x6becdc[_0x3645('0x28')],'type':_0x6becdc[_0x3645('0x29')]['key']};});_0x3575ec[_0x3645('0x10')][_0x3645('0x2a')]='agent';_0x3575ec[_0x3645('0x10')]['online']=!![];_0x1fc7be=qs['getOptions'](_0x40d952,_0x3575ec);_0x1fc7be[_0x3645('0x2b')]=!![];var _0x15bb86=[];if(_0x407a96['length']>0x0){_0x15bb86['push']({'id':{'$in':_0x407a96}});if(_0x15cfde&&!_0x4cfc6b){_0x3785a3=[db[_0x3645('0x2c')][_0x3645('0x2d')]('FIELD(id,'+_0x407a96+')')];_0x1fc7be[_0x3645('0x1f')]=_0x3785a3;}}if(_0x94972){_0x3f4cc1[_0x3645('0x2e')](function(_0x3d6170){var _0x57aed2=!![];if(_0x4cfc6b===_0x3645('0x2f')&&_0x5b12cf!==_0x3d6170){_0x57aed2=![];}_0x15bb86['push']({[_0x3d6170+_0x3645('0x30')]:_0x57aed2});});if(_0x2fb25a){_0x15bb86['push']({'pauseType':_0x2fb25a});}}else if(_0x4cfc6b){_0x3f4cc1[_0x3645('0x2e')](function(_0x9677b0){_0x15bb86[_0x3645('0x31')]({[_0x9677b0+_0x3645('0x30')]:![]});});}_0x1fc7be[_0x3645('0x32')]=_[_0x3645('0x33')](_0x1fc7be[_0x3645('0x32')],{'$and':_0x15bb86});if(_0x3575ec[_0x3645('0x34')][_0x3645('0x2a')]===_0x3645('0x34')){var _0x54124d={'params':{'id':_0x3575ec[_0x3645('0x34')][_0x3645('0x35')]},'query':{'section':_0x3645('0x36'),'role':_0x3645('0x37'),'online':!![],'raw':!![],'ids':_0x407a96,'customSorting':_0x3785a3}};if(_0x94972){_0x54124d[_0x3645('0x10')]['extraQueryConditions']=_0x15bb86;}_0x54124d[_0x3645('0x10')]=Object['assign'](_0x54124d[_0x3645('0x10')],_0x3575ec[_0x3645('0x10')]);delete _0x54124d[_0x3645('0x10')]['id'];return db['UserProfile']['getResources'](_0x54124d);}return db[_0x3645('0x38')][_0x3645('0x39')](_0x1fc7be);})[_0x3645('0x16')](function(_0x553960){_0x2310ee[_0x3645('0xb')]=_0x553960[_0x3645('0xb')];_0x20766c=_0x553960[_0x3645('0x22')];return _0x20766c[_0x3645('0x26')](function(_0x533bb3){var _0x4445b2=_[_0x3645('0x3a')](_0x2cf053,['id',_0x533bb3['id']]);if(_0x4445b2){var _0x22c379=rta[_0x3645('0x3b')](_0x4445b2);_['merge'](_0x533bb3,_0x22c379);}_0x533bb3[_0x3645('0x1a')]=rta[_0x3645('0x3c')](_0x533bb3);if(_0x533bb3[_0x3645('0x1a')]['includes'](_0x3645('0x14'))){_0x3f4cc1[_0x3645('0x2e')](function(_0x3702bc){if(_0x533bb3[_0x3702bc+'Pause']){_0x533bb3[_0x3702bc+_0x3645('0x3d')]=_0x3645('0x14');}});}return _0x533bb3;});})[_0x3645('0x16')](function(_0x2fd25f){if(!_0x15cfde||_0x3785a3){return _0x2fd25f;}return rta[_0x3645('0x3e')](_0x2fd25f,_0x15cfde);})[_0x3645('0x16')](function(_0x222679){var _0xef9b80=null;if(_0x3575ec[_0x3645('0x10')][_0x3645('0x1e')]){var _0x2aaadd=_0x3575ec[_0x3645('0x10')][_0x3645('0x1e')][_0x3645('0x3f')](',');_0xef9b80=_0x222679[_0x3645('0x26')](function(_0x35d94a){return _[_0x3645('0x40')](_0x35d94a,_0x2aaadd);});}_0x2310ee[_0x3645('0x22')]=_0xef9b80||_0x222679;return _0x2310ee;})[_0x3645('0x16')](respondWithFilteredResult(_0x2a80c7,_0x1fc7be))[_0x3645('0x41')](APIHandleError(_0x2a80c7));};exports[_0x3645('0x42')]=function(_0x1d802e,_0x6d272b){var _0x3ab782={'count':0x0,'rows':[]};var _0xa96c57={};var _0x446609;var _0x36fa30;var _0x25ac92;Promise[_0x3645('0x15')]()['then'](function(){if(_0x1d802e[_0x3645('0x10')][_0x3645('0x17')]){if(!utils[_0x3645('0x18')](_0x1d802e[_0x3645('0x10')]['channel'])){throw new APIBadRequestError(util[_0x3645('0x19')](_0x3645('0x43'),_0x1d802e[_0x3645('0x10')][_0x3645('0x17')]));}_0x446609=_0x1d802e['query'][_0x3645('0x17')][_0x3645('0x44')]();}var _0x3683c2=_['startCase'](_0x446609)+_0x3645('0x45');var _0x1d948d=_[_0x3645('0x26')](db[_0x3683c2][_0x3645('0x27')],function(_0x14d645){return{'name':_0x14d645[_0x3645('0x28')],'type':_0x14d645[_0x3645('0x29')]['key']};});if(!_0x1d802e[_0x3645('0x10')][_0x3645('0x1e')]){var _0xbd426e=['id','name'];if(_0x446609===_0x3645('0x46')){_0xbd426e[_0x3645('0x31')](_0x3645('0x29'));if(_0x1d802e[_0x3645('0x10')]['type']===_0x3645('0x47')){_0xbd426e[_0x3645('0x31')]([_0x3645('0x48'),_0x3645('0x49')]);}}_0x1d802e[_0x3645('0x10')][_0x3645('0x1e')]=_0xbd426e['join'](',');}_0xa96c57=qs[_0x3645('0x4a')](_0x1d948d,_0x1d802e);if(_0x1d802e[_0x3645('0x34')][_0x3645('0x2a')]===_0x3645('0x34')){var _0x1f828f={'params':{'id':_0x1d802e['user']['userProfileId']},'query':{'section':_0x446609===_0x3645('0x46')&&_0x1d802e[_0x3645('0x10')][_0x3645('0x29')]===_0x3645('0x47')?_0x3645('0x4b'):_[_0x3645('0x4c')](_0x446609)+_0x3645('0x4d'),'type':_0x1d802e[_0x3645('0x10')][_0x3645('0x29')],'nolimit':!![],'sort':_0x3645('0x4e'),'filter':_0x1d802e[_0x3645('0x10')][_0x3645('0x4f')]}};return db[_0x3645('0x50')]['getResources'](_0x1f828f);}return db[_0x3683c2][_0x3645('0x39')](_0xa96c57);})['then'](function(_0x29be2b){_0x3ab782[_0x3645('0xb')]=_0x29be2b['count'];_0x36fa30=_0x29be2b['rows'];return rtq[_0x3645('0x51')](_0x1d802e,_0x446609);})[_0x3645('0x16')](function(_0xf9d465){_0x25ac92=_0xf9d465[_0x3645('0x22')];return rtq[_0x3645('0x52')](_0x36fa30,_0x25ac92,_0x446609,_0x1d802e[_0x3645('0x10')][_0x3645('0x29')]);})[_0x3645('0x16')](function(_0x20a7e8){_0x3ab782[_0x3645('0x22')]=_0x20a7e8;return _0x3ab782;})['then'](respondWithFilteredResult(_0x6d272b,_0xa96c57))[_0x3645('0x41')](APIHandleError(_0x6d272b));};
\ No newline at end of file
index 50f92d2..8b37ecb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x374ed1,_0x1d728c){var _0x12bc51=function(_0x41b3c3){while(--_0x41b3c3){_0x374ed1['push'](_0x374ed1['shift']());}};_0x12bc51(++_0x1d728c);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xca54f9,_0x1d837b){var _0x183c63=function(_0x4729a8){while(--_0x4729a8){_0xca54f9['push'](_0xca54f9['shift']());}};_0x183c63(++_0x1d837b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index 8e2c955..4480401 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c7b=['DATE','INTEGER','STRING','sequelize'];(function(_0x5881e9,_0x5c19ba){var _0x1c6fdd=function(_0x1ca471){while(--_0x1ca471){_0x5881e9['push'](_0x5881e9['shift']());}};_0x1c6fdd(++_0x5c19ba);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x684ef1,_0x5887f7){_0x684ef1=_0x684ef1-0x0;var _0xa80b7a=_0x6c7b[_0x684ef1];return _0xa80b7a;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb6c7('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb6c7('0x1')]},'responsetime':{'type':Sequelize[_0xb6c7('0x1')]},'ringtime':{'type':Sequelize[_0xb6c7('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb6c7('0x3')]},'membername':{'type':Sequelize[_0xb6c7('0x3')]}};
\ No newline at end of file
+var _0x0d91=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2e69bc,_0x598313){var _0xe9c60=function(_0xf9cf85){while(--_0xf9cf85){_0x2e69bc['push'](_0x2e69bc['shift']());}};_0xe9c60(++_0x598313);}(_0x0d91,0x76));var _0x10d9=function(_0x44ccf0,_0x446087){_0x44ccf0=_0x44ccf0-0x0;var _0x101f26=_0x0d91[_0x44ccf0];return _0x101f26;};'use strict';var Sequelize=require(_0x10d9('0x0'));module[_0x10d9('0x1')]={'state':{'type':Sequelize[_0x10d9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x10d9('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x10d9('0x3')]},'starttime':{'type':Sequelize[_0x10d9('0x4')]},'responsetime':{'type':Sequelize[_0x10d9('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x10d9('0x3')]},'campaigntype':{'type':Sequelize[_0x10d9('0x3')]},'membername':{'type':Sequelize[_0x10d9('0x3')]}};
\ No newline at end of file
index 8857b3f..a284b70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21e7=['ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x5cfd70,_0x123847){var _0x5dfe03=function(_0x22f74b){while(--_0x22f74b){_0x5cfd70['push'](_0x5cfd70['shift']());}};_0x5dfe03(++_0x123847);}(_0x21e7,0xb7));var _0x721e=function(_0x5c50f7,_0x312a25){_0x5c50f7=_0x5c50f7-0x0;var _0x41aa2d=_0x21e7[_0x5c50f7];return _0x41aa2d;};'use strict';var _=require(_0x721e('0x0'));var util=require(_0x721e('0x1'));var logger=require(_0x721e('0x2'))(_0x721e('0x3'));var moment=require(_0x721e('0x4'));var BPromise=require(_0x721e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x721e('0x6'));var rimraf=require(_0x721e('0x7'));var config=require(_0x721e('0x8'));var attributes=require(_0x721e('0x9'));module[_0x721e('0xa')]=function(_0x2f2ffa,_0x267cb0){return _0x2f2ffa[_0x721e('0xb')](_0x721e('0xc'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd65f=['report_agent_preview','../../config/logger','api','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview'];(function(_0x35b395,_0x5561a8){var _0x28c3f7=function(_0xd4fcf5){while(--_0xd4fcf5){_0x35b395['push'](_0x35b395['shift']());}};_0x28c3f7(++_0x5561a8);}(_0xd65f,0x121));var _0xfd65=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0xd65f[_0x4be730];return _0x54bbe5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd65('0x0'))(_0xfd65('0x1'));var moment=require('moment');var BPromise=require(_0xfd65('0x2'));var rp=require(_0xfd65('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd65('0x4'));var attributes=require(_0xfd65('0x5'));module['exports']=function(_0x471590,_0x47acaf){return _0x471590[_0xfd65('0x6')](_0xfd65('0x7'),attributes,{'tableName':_0xfd65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9ece182..4489019 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fb3=['util','../../config/utils','../../config/environment','jayson/promise','http','then','info','debug','request\x20sent','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4fb3,0xbd));var _0x34fb=function(_0x13e8c8,_0x291240){_0x13e8c8=_0x13e8c8-0x0;var _0x34156b=_0x4fb3[_0x13e8c8];return _0x34156b;};'use strict';var _=require('lodash');var util=require(_0x34fb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34fb('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x34fb('0x2'));var jayson=require(_0x34fb('0x3'));var client=jayson['client'][_0x34fb('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x555ecd,_0x407150,_0x4ac14e){return new BPromise(function(_0x5a1766,_0x40b6b8){return client['request'](_0x555ecd,_0x4ac14e)[_0x34fb('0x5')](function(_0x2a9a7a){logger[_0x34fb('0x6')]('ReportAgentPreview,\x20%s,\x20%s',_0x407150,'request\x20sent');logger[_0x34fb('0x7')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x407150,_0x34fb('0x8'),JSON['stringify'](_0x2a9a7a));if(_0x2a9a7a['error']){if(_0x2a9a7a[_0x34fb('0x9')][_0x34fb('0xa')]===0x1f4){logger[_0x34fb('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x407150,_0x2a9a7a[_0x34fb('0x9')][_0x34fb('0xb')]);return _0x40b6b8(_0x2a9a7a[_0x34fb('0x9')][_0x34fb('0xb')]);}logger['error'](_0x34fb('0xc'),_0x407150,_0x2a9a7a[_0x34fb('0x9')]['message']);return _0x5a1766(_0x2a9a7a[_0x34fb('0x9')][_0x34fb('0xb')]);}else{logger[_0x34fb('0x6')]('ReportAgentPreview,\x20%s,\x20%s',_0x407150,_0x34fb('0x8'));_0x5a1766(_0x2a9a7a[_0x34fb('0xd')][_0x34fb('0xb')]);}})[_0x34fb('0xe')](function(_0x3c10c1){logger[_0x34fb('0x9')](_0x34fb('0xc'),_0x407150,_0x3c10c1);_0x40b6b8(_0x3c10c1);});});}exports[_0x34fb('0xf')]=function(_0x13dd9d){var _0x5f5034=this;return new Promise(function(_0x499abe,_0x5e58e){return db[_0x34fb('0x10')][_0x34fb('0x11')](_0x13dd9d[_0x34fb('0x12')],{'raw':_0x13dd9d[_0x34fb('0x13')]?_0x13dd9d[_0x34fb('0x13')][_0x34fb('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x244bd5){logger[_0x34fb('0x6')]('CreateReportAgentPreview',_0x13dd9d);logger[_0x34fb('0x7')](_0x34fb('0xf'),_0x13dd9d,JSON['stringify'](_0x244bd5));_0x499abe(_0x244bd5);})[_0x34fb('0xe')](function(_0x1ff9d9){logger[_0x34fb('0x9')](_0x34fb('0xf'),_0x1ff9d9[_0x34fb('0xb')],_0x13dd9d);_0x5e58e(_0x5f5034['error'](0x1f4,_0x1ff9d9[_0x34fb('0xb')]));});});};
\ No newline at end of file
+var _0x75fd=['client','request','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ReportAgentPreview,\x20%s,\x20%s','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9d43fc,_0x6bd984){var _0x53bb19=function(_0x3604b9){while(--_0x3604b9){_0x9d43fc['push'](_0x9d43fc['shift']());}};_0x53bb19(++_0x6bd984);}(_0x75fd,0x197));var _0xd75f=function(_0x497936,_0x591ab1){_0x497936=_0x497936-0x0;var _0x484a28=_0x75fd[_0x497936];return _0x484a28;};'use strict';var _=require(_0xd75f('0x0'));var util=require('util');var moment=require(_0xd75f('0x1'));var BPromise=require(_0xd75f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd75f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd75f('0x4'));var logger=require(_0xd75f('0x5'))(_0xd75f('0x6'));var config=require(_0xd75f('0x7'));var jayson=require(_0xd75f('0x8'));var client=jayson[_0xd75f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4613eb,_0x5dda6b,_0x3c8973){return new BPromise(function(_0x14d6a3,_0x159d55){return client[_0xd75f('0xa')](_0x4613eb,_0x3c8973)['then'](function(_0x1c8026){logger[_0xd75f('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x5dda6b,_0xd75f('0xc'));logger[_0xd75f('0xd')](_0xd75f('0xe'),_0x5dda6b,'request\x20sent',JSON[_0xd75f('0xf')](_0x1c8026));if(_0x1c8026['error']){if(_0x1c8026['error'][_0xd75f('0x10')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5dda6b,_0x1c8026[_0xd75f('0x11')][_0xd75f('0x12')]);return _0x159d55(_0x1c8026[_0xd75f('0x11')]['message']);}logger[_0xd75f('0x11')](_0xd75f('0x13'),_0x5dda6b,_0x1c8026[_0xd75f('0x11')]['message']);return _0x14d6a3(_0x1c8026[_0xd75f('0x11')][_0xd75f('0x12')]);}else{logger[_0xd75f('0xb')](_0xd75f('0x13'),_0x5dda6b,_0xd75f('0xc'));_0x14d6a3(_0x1c8026['result'][_0xd75f('0x12')]);}})[_0xd75f('0x14')](function(_0x588521){logger[_0xd75f('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x5dda6b,_0x588521);_0x159d55(_0x588521);});});}exports['CreateReportAgentPreview']=function(_0x2445fe){var _0x430d5a=this;return new Promise(function(_0x2cb911,_0x114545){return db[_0xd75f('0x15')][_0xd75f('0x16')](_0x2445fe['body'],{'raw':_0x2445fe['options']?_0x2445fe[_0xd75f('0x17')][_0xd75f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x279f82){logger['info'](_0xd75f('0x19'),_0x2445fe);logger[_0xd75f('0xd')](_0xd75f('0x19'),_0x2445fe,JSON[_0xd75f('0xf')](_0x279f82));_0x2cb911(_0x279f82);})[_0xd75f('0x14')](function(_0x56a914){logger[_0xd75f('0x11')](_0xd75f('0x19'),_0x56a914['message'],_0x2445fe);_0x114545(_0x430d5a['error'](0x1f4,_0x56a914[_0xd75f('0x12')]));});});};
\ No newline at end of file
index 5b57a47..a859a21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33eb=['faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x39e54f,_0x1c1f59){var _0x4a6b4f=function(_0x2cad3c){while(--_0x2cad3c){_0x39e54f['push'](_0x39e54f['shift']());}};_0x4a6b4f(++_0x1c1f59);}(_0x33eb,0x6d));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb33e('0x0'));var util=require(_0xb33e('0x1'));var path=require('path');var express=require('express');var router=express[_0xb33e('0x2')]();var auth=require(_0xb33e('0x3'));var controller=require(_0xb33e('0x4'));router[_0xb33e('0x5')](_0xb33e('0x6'),auth['isAuthenticated'](),controller[_0xb33e('0x7')]);router[_0xb33e('0x5')](_0xb33e('0x8'),auth[_0xb33e('0x9')](),controller[_0xb33e('0xa')]);router[_0xb33e('0x5')](_0xb33e('0xb'),auth[_0xb33e('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0xb33e('0x5')]('/voice/queues',auth[_0xb33e('0x9')](),controller['voiceQueues']);router[_0xb33e('0x5')](_0xb33e('0xc'),auth['isAuthenticated'](),controller[_0xb33e('0xd')]);router[_0xb33e('0x5')](_0xb33e('0xe'),auth[_0xb33e('0x9')](),controller[_0xb33e('0xf')]);router['get'](_0xb33e('0x10'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x11')]);router[_0xb33e('0x5')](_0xb33e('0x12'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x13')]);router[_0xb33e('0x5')](_0xb33e('0x14'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x15')]);router[_0xb33e('0x5')](_0xb33e('0x16'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x17')]);router[_0xb33e('0x5')](_0xb33e('0x18'),auth[_0xb33e('0x9')](),controller['faxQueues']);router[_0xb33e('0x5')](_0xb33e('0x19'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x1a')]);router[_0xb33e('0x5')](_0xb33e('0x1b'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x1c')]);router[_0xb33e('0x5')](_0xb33e('0x1d'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x1e')]);router[_0xb33e('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xb33e('0x1f')]);router[_0xb33e('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xb33e('0x20')]);router['get'](_0xb33e('0x21'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x22')]);router[_0xb33e('0x23')](_0xb33e('0x21'),auth['isAuthenticated'](),controller[_0xb33e('0x24')]);router[_0xb33e('0x5')](_0xb33e('0x25'),auth[_0xb33e('0x9')](),controller['outbound']);router[_0xb33e('0x5')](_0xb33e('0x26'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x27')]);router[_0xb33e('0x5')](_0xb33e('0x28'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x29')]);router[_0xb33e('0x23')](_0xb33e('0x2a'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x2b')]);router[_0xb33e('0x5')](_0xb33e('0x2c'),auth[_0xb33e('0x9')](),controller['telephones']);router['get'](_0xb33e('0x2d'),auth['isAuthenticated'](),controller[_0xb33e('0x2e')]);router['get'](_0xb33e('0x2f'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x30')]);router[_0xb33e('0x5')]('/fax/accounts',auth[_0xb33e('0x9')](),controller[_0xb33e('0x31')]);router['get'](_0xb33e('0x32'),auth[_0xb33e('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xb33e('0x5')](_0xb33e('0x33'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x34')]);router[_0xb33e('0x5')](_0xb33e('0x35'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x36')]);router['get'](_0xb33e('0x37'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x38')]);router[_0xb33e('0x5')]('/sms/queues/waitinginteractions',auth[_0xb33e('0x9')](),controller[_0xb33e('0x39')]);router['get'](_0xb33e('0x3a'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x3b')]);router[_0xb33e('0x5')](_0xb33e('0x3c'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x3d')]);router[_0xb33e('0x3e')](_0xb33e('0x3f'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x40')](_0xb33e('0x41')));router[_0xb33e('0x5')](_0xb33e('0x42'),auth['isAuthenticated'](),controller[_0xb33e('0x43')]);router[_0xb33e('0x3e')](_0xb33e('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0xb33e('0x45')));router['get'](_0xb33e('0x46'),auth[_0xb33e('0x9')](),controller['showChatQueues']);router['post'](_0xb33e('0x47'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x40')](_0xb33e('0x48')));router[_0xb33e('0x5')](_0xb33e('0x49'),auth[_0xb33e('0x9')](),controller['showFaxQueues']);router[_0xb33e('0x3e')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb33e('0x40')](_0xb33e('0x4a')));router[_0xb33e('0x5')](_0xb33e('0x4b'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x4c')]);router[_0xb33e('0x3e')](_0xb33e('0x4d'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x40')]('sms'));router['post'](_0xb33e('0x4e'),auth[_0xb33e('0x9')](),controller[_0xb33e('0x40')](_0xb33e('0x4f')));router[_0xb33e('0x5')]('/sms/queues/:id',auth[_0xb33e('0x9')](),controller[_0xb33e('0x50')]);router[_0xb33e('0x5')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xb33e('0x51')]);router[_0xb33e('0x3e')](_0xb33e('0x52'),auth['isAuthenticated'](),controller[_0xb33e('0x53')]);module[_0xb33e('0x54')]=router;
\ No newline at end of file
+var _0xd578=['showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelRedirect','/voice/queues/:id'];(function(_0x887ac3,_0x4e6921){var _0x1afc7b=function(_0x519bba){while(--_0x519bba){_0x887ac3['push'](_0x887ac3['shift']());}};_0x1afc7b(++_0x4e6921);}(_0xd578,0x19c));var _0x8d57=function(_0x21a75b,_0xd941d7){_0x21a75b=_0x21a75b-0x0;var _0x156911=_0xd578[_0x21a75b];return _0x156911;};'use strict';var multer=require(_0x8d57('0x0'));var util=require(_0x8d57('0x1'));var path=require('path');var express=require(_0x8d57('0x2'));var router=express[_0x8d57('0x3')]();var auth=require(_0x8d57('0x4'));var controller=require(_0x8d57('0x5'));router[_0x8d57('0x6')](_0x8d57('0x7'),auth[_0x8d57('0x8')](),controller['voiceChannels']);router[_0x8d57('0x6')](_0x8d57('0x9'),auth[_0x8d57('0x8')](),controller['voiceChannelMixMonitor']);router[_0x8d57('0x6')](_0x8d57('0xa'),auth[_0x8d57('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x8d57('0x6')](_0x8d57('0xb'),auth[_0x8d57('0x8')](),controller['voiceQueues']);router[_0x8d57('0x6')]('/chat/queues',auth[_0x8d57('0x8')](),controller['chatQueues']);router[_0x8d57('0x6')]('/mail/queues',auth[_0x8d57('0x8')](),controller[_0x8d57('0xc')]);router['get'](_0x8d57('0xd'),auth[_0x8d57('0x8')](),controller[_0x8d57('0xe')]);router[_0x8d57('0x6')]('/openchannel/queues',auth[_0x8d57('0x8')](),controller['openchannelQueues']);router['get'](_0x8d57('0xf'),auth['isAuthenticated'](),controller[_0x8d57('0x10')]);router['get'](_0x8d57('0x11'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get']('/fax/queues',auth[_0x8d57('0x8')](),controller[_0x8d57('0x12')]);router['get'](_0x8d57('0x13'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x14')]);router[_0x8d57('0x6')](_0x8d57('0x15'),auth[_0x8d57('0x8')](),controller['voiceQueuesChannels']);router[_0x8d57('0x6')](_0x8d57('0x16'),auth['isAuthenticated'](),controller[_0x8d57('0x17')]);router[_0x8d57('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x8d57('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x8d57('0x8')](),controller[_0x8d57('0x18')]);router[_0x8d57('0x6')](_0x8d57('0x19'),auth['isAuthenticated'](),controller[_0x8d57('0x1a')]);router[_0x8d57('0x1b')](_0x8d57('0x19'),auth['isAuthenticated'](),controller[_0x8d57('0x1c')]);router[_0x8d57('0x6')]('/outbound',auth[_0x8d57('0x8')](),controller['outbound']);router[_0x8d57('0x6')](_0x8d57('0x1d'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x1e')]);router['get'](_0x8d57('0x1f'),auth[_0x8d57('0x8')](),controller['agents']);router[_0x8d57('0x1b')](_0x8d57('0x20'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x21')]);router[_0x8d57('0x6')](_0x8d57('0x22'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x23')]);router[_0x8d57('0x6')](_0x8d57('0x24'),auth['isAuthenticated'](),controller[_0x8d57('0x25')]);router[_0x8d57('0x6')](_0x8d57('0x26'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x27')]);router[_0x8d57('0x6')](_0x8d57('0x28'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x8d57('0x6')](_0x8d57('0x29'),auth['isAuthenticated'](),controller[_0x8d57('0x2a')]);router[_0x8d57('0x6')](_0x8d57('0x2b'),auth[_0x8d57('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x8d57('0x6')](_0x8d57('0x2c'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x2d')]);router[_0x8d57('0x6')](_0x8d57('0x2e'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x2f')]);router[_0x8d57('0x6')]('/sms/queues/waitinginteractions',auth[_0x8d57('0x8')](),controller[_0x8d57('0x30')]);router[_0x8d57('0x6')](_0x8d57('0x31'),auth['isAuthenticated'](),controller[_0x8d57('0x32')]);router[_0x8d57('0x6')]('/fax/queues/waitinginteractions',auth[_0x8d57('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x8d57('0x33')](_0x8d57('0x34'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x35')](_0x8d57('0x36')));router[_0x8d57('0x6')](_0x8d57('0x37'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x8d57('0x33')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8d57('0x35')]('chat'));router[_0x8d57('0x6')](_0x8d57('0x38'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x39')]);router[_0x8d57('0x33')](_0x8d57('0x3a'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x35')](_0x8d57('0x3b')));router[_0x8d57('0x6')](_0x8d57('0x3c'),auth[_0x8d57('0x8')](),controller['showFaxQueues']);router[_0x8d57('0x33')](_0x8d57('0x3d'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x35')](_0x8d57('0x3e')));router[_0x8d57('0x6')](_0x8d57('0x3f'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0x8d57('0x40'),auth['isAuthenticated'](),controller[_0x8d57('0x35')]('sms'));router['post'](_0x8d57('0x41'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x35')](_0x8d57('0x42')));router[_0x8d57('0x6')](_0x8d57('0x43'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x44')]);router['get'](_0x8d57('0x45'),auth[_0x8d57('0x8')](),controller['showWhatsappQueues']);router['post'](_0x8d57('0x46'),auth[_0x8d57('0x8')](),controller[_0x8d57('0x47')]);module[_0x8d57('0x48')]=router;
\ No newline at end of file
index da62ed7..7b75268 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d17=['jayson/promise','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','MemberReport','findAll','length','findOrCreate','INTERACTION','interface','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api'];(function(_0x52c5f0,_0x2a1b61){var _0x596d1f=function(_0x22c24f){while(--_0x22c24f){_0x52c5f0['push'](_0x52c5f0['shift']());}};_0x596d1f(++_0x2a1b61);}(_0x2d17,0x17e));var _0x72d1=function(_0x4e0fbc,_0x3323d8){_0x4e0fbc=_0x4e0fbc-0x0;var _0x404283=_0x2d17[_0x4e0fbc];return _0x404283;};'use strict';var BPromise=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var _=require('lodash');var util=require(_0x72d1('0x2'));var db=require(_0x72d1('0x3'))['db'];var logger=require('../../config/logger')(_0x72d1('0x4'));var jayson=require(_0x72d1('0x5'));var amiClient=jayson['client'][_0x72d1('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x72d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x72d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){var _0x4e7f3e=_0x477264?_0x477264:amiClient;return _0x4e7f3e[_0x72d1('0x7')](_0x239d1f,_0x5b40a9)[_0x72d1('0x8')](function(_0x283775){if(_0x283775['error']){if(_0x283775[_0x72d1('0x9')][_0x72d1('0xa')]===0x1f4){return _0x19e248(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}return _0x422f5a(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}else{_0x422f5a(_0x283775[_0x72d1('0xc')]);}})[_0x72d1('0xd')](function(_0x273ccf){_0x19e248(_0x273ccf);});});}function respondWithResult(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xc8;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0xe')](_0x5ad4df)[_0x72d1('0xf')](_0x3cd1ae);}return _0x2f5a78[_0x72d1('0x10')](0x194);};}function handleError(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0x1f4;return function(_0x143718){logger[_0x72d1('0x9')](_0x143718[_0x72d1('0x11')]);if(_0x143718[_0x72d1('0x12')]){delete _0x143718[_0x72d1('0x12')];}_0x22ac6f[_0x72d1('0xe')](_0x685a27)[_0x72d1('0x13')](_0x143718);};}function findById(_0x491af4){return function(_0x46fa3d){if(!_['isNil'](_0x491af4)&&!_[_0x72d1('0x14')](_0x46fa3d)&&!_[_0x72d1('0x14')](_0x46fa3d['rows'])){return _[_0x72d1('0x15')](_0x46fa3d[_0x72d1('0x16')],function(_0x1ca18d){return _0x1ca18d['id']==_0x491af4;});}return null;};}exports['voiceChannels']=function(_0x4925f6,_0x313d7b){return respondWithRpcPromise(_0x72d1('0x17'),_0x4925f6[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x313d7b,null))[_0x72d1('0xd')](handleError(_0x313d7b,null));};exports[_0x72d1('0x19')]=function(_0x1e2411,_0x5c7982){return respondWithRpcPromise(_0x72d1('0x1a'),_['merge'](_0x1e2411['query'],_0x1e2411['params']))['then'](respondWithResult(_0x5c7982,null))[_0x72d1('0xd')](handleError(_0x5c7982,null));};exports[_0x72d1('0x1b')]=function(_0x573c98,_0x2a421a){return respondWithRpcPromise(_0x72d1('0x1c'),_[_0x72d1('0x1d')](_0x573c98[_0x72d1('0x18')],_0x573c98[_0x72d1('0x1e')]))['then'](respondWithResult(_0x2a421a,null))['catch'](handleError(_0x2a421a,null));};exports[_0x72d1('0x1f')]=function(_0x36bc65,_0x2f661){return respondWithRpcPromise(_0x72d1('0x20'),_0x36bc65[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x2f661,null))[_0x72d1('0xd')](handleError(_0x2f661,null));};exports['showVoiceQueues']=function(_0x57ec9e,_0x1ba258){return respondWithRpcPromise('VoiceQueues',_0x57ec9e[_0x72d1('0x18')])[_0x72d1('0x8')](findById(_0x57ec9e[_0x72d1('0x1e')]['id']))['then'](respondWithResult(_0x1ba258,null))[_0x72d1('0xd')](handleError(_0x1ba258,null));};exports['updateVoiceQueue']=function(_0x707cd0,_0x20055f){return respondWithRpcPromise(_0x72d1('0x21'),_[_0x72d1('0x1d')](_0x707cd0['body'],_0x707cd0[_0x72d1('0x1e')]))['then'](respondWithResult(_0x20055f,null))[_0x72d1('0xd')](handleError(_0x20055f,null));};exports[_0x72d1('0x22')]=function(_0x5cec3f,_0x14d653){return respondWithRpcPromise(_0x72d1('0x23'),_[_0x72d1('0x1d')](_0x5cec3f[_0x72d1('0x18')],_0x5cec3f[_0x72d1('0x1e')]))['then'](respondWithResult(_0x14d653,null))[_0x72d1('0xd')](handleError(_0x14d653,null));};exports[_0x72d1('0x24')]=function(_0x9efc2f,_0x482033){return respondWithRpcPromise(_0x72d1('0x25'),_0x9efc2f[_0x72d1('0x18')])['then'](respondWithResult(_0x482033,null))[_0x72d1('0xd')](handleError(_0x482033,null));};exports[_0x72d1('0x26')]=function(_0x437d79,_0x5a63d9){return respondWithRpcPromise(_0x72d1('0x27'),_['merge'](_0x437d79[_0x72d1('0x18')],_0x437d79[_0x72d1('0x1e')]))[_0x72d1('0x8')](respondWithResult(_0x5a63d9,null))[_0x72d1('0xd')](handleError(_0x5a63d9,null));};exports[_0x72d1('0x28')]=function(_0xc9798a,_0x3ed5de){return respondWithRpcPromise(_0x72d1('0x29'),_[_0x72d1('0x1d')](_0xc9798a[_0x72d1('0x18')],_0xc9798a[_0x72d1('0x1e')]))['then'](respondWithResult(_0x3ed5de,null))[_0x72d1('0xd')](handleError(_0x3ed5de,null));};exports[_0x72d1('0x2a')]=function(_0x4acab,_0x325209){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x72d1('0x1d')](_0x4acab[_0x72d1('0x18')],_0x4acab[_0x72d1('0x1e')]))['then'](respondWithResult(_0x325209,null))[_0x72d1('0xd')](handleError(_0x325209,null));};exports[_0x72d1('0x2b')]=function(_0x163538,_0x5b897f){return respondWithRpcPromise(_0x72d1('0x2c'),_0x163538[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x5b897f,null))['catch'](handleError(_0x5b897f,null));};exports[_0x72d1('0x2d')]=function(_0x40cdbd,_0x1e083e){return respondWithRpcPromise(_0x72d1('0x2e'),_0x40cdbd[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x1e083e,null))[_0x72d1('0xd')](handleError(_0x1e083e,null));};exports['agents']=function(_0x12646c,_0x3ae4b5){var _0x440ac5;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c[_0x72d1('0x18')])[_0x72d1('0x8')](function(_0x2f3080){_0x440ac5=_0x2f3080;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c['query'],routingClient);})[_0x72d1('0x8')](function(_0x1a6dd4){return _[_0x72d1('0x1d')]({},_0x1a6dd4,_0x440ac5);})[_0x72d1('0x8')](respondWithResult(_0x3ae4b5,null))[_0x72d1('0xd')](handleError(_0x3ae4b5,null));};exports[_0x72d1('0x30')]=function(_0xb911fa,_0x3620df){if(_0xb911fa['body']&&_0xb911fa['body'][_0x72d1('0x31')]&&_0xb911fa[_0x72d1('0x32')]&&_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]){for(var _0x5a6bc4 in _0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')]){if(_0xb911fa['body'][_0x72d1('0x31')]['hasOwnProperty'](_0x5a6bc4)){db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa['user'][_0x72d1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xb911fa['body']['interaction'][_0x5a6bc4]&&_0xb911fa[_0x72d1('0x33')]['interaction'][_0x5a6bc4][_0x72d1('0x36')]?{'$notIn':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4]}:{'$ne':null}}})['then'](function(_0x4a5c1c){var _0x263fcb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2cb03d=0x0,_0x397f31=_0x4a5c1c[_0x72d1('0x36')];_0x2cb03d<_0x397f31;_0x2cb03d+=0x1){_0x4a5c1c[_0x2cb03d]['updateAttributes']({'exitAt':_0x263fcb});}});for(var _0x4f772d=0x0;_0x4f772d<_0xb911fa['body']['interaction'][_0x5a6bc4][_0x72d1('0x36')];_0x4f772d+=0x1){db[_0x72d1('0x34')][_0x72d1('0x37')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')],'type':_0x72d1('0x38'),'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d],'exitAt':null},'defaults':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')]['name'],'interface':_[_0x72d1('0x14')](_0xb911fa[_0x72d1('0x32')][_0x72d1('0x39')])?util['format'](_0x72d1('0x3a'),_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]):_0xb911fa['user'][_0x72d1('0x39')],'type':_0x72d1('0x38'),'enterAt':moment()[_0x72d1('0x3b')](_0x72d1('0x3c')),'role':'agent','internal':_0xb911fa['user'][_0x72d1('0x3d')],'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xb911fa[_0x72d1('0x1e')]['id'],'capacity':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x3e')]},routingClient)[_0x72d1('0x8')](respondWithResult(_0x3620df,null))[_0x72d1('0xd')](handleError(_0x3620df,null));};exports[_0x72d1('0x3f')]=function(_0x3146cf,_0xebe855){return respondWithRpcPromise(_0x72d1('0x40'),_0x3146cf[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0xebe855,null))['catch'](handleError(_0xebe855,null));};exports[_0x72d1('0x41')]=function(_0x50d4d4,_0x5dd7b0){return respondWithRpcPromise(_0x72d1('0x42'),_0x50d4d4['query'])[_0x72d1('0x8')](respondWithResult(_0x5dd7b0,null))[_0x72d1('0xd')](handleError(_0x5dd7b0,null));};exports[_0x72d1('0x43')]=function(_0x162248,_0x473a7b){return respondWithRpcPromise(_0x72d1('0x44'),_0x162248[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x473a7b,null))[_0x72d1('0xd')](handleError(_0x473a7b,null));};exports[_0x72d1('0x45')]=function(_0x14f9de,_0x52102e){return respondWithRpcPromise(_0x72d1('0x46'),_0x14f9de[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x52102e,null))['catch'](handleError(_0x52102e,null));};exports['showChatQueues']=function(_0x32f1ea,_0x140f0b){return respondWithRpcPromise(_0x72d1('0x46'),_0x32f1ea[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x32f1ea['params']['id']))[_0x72d1('0x8')](respondWithResult(_0x140f0b,null))['catch'](handleError(_0x140f0b,null));};exports[_0x72d1('0x47')]=function(_0x41c6a6,_0x20daf0){return respondWithRpcPromise(_0x72d1('0x48'),_0x41c6a6[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x20daf0,null))[_0x72d1('0xd')](handleError(_0x20daf0,null));};exports[_0x72d1('0x49')]=function(_0x384f0a,_0x3a2dfe){return respondWithRpcPromise(_0x72d1('0x48'),_0x384f0a[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x384f0a[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x3a2dfe,null))[_0x72d1('0xd')](handleError(_0x3a2dfe,null));};exports[_0x72d1('0x4a')]=function(_0x5e63cc,_0x1b40e8){return respondWithRpcPromise(_0x72d1('0x4b'),_0x5e63cc[_0x72d1('0x18')],mailClient)[_0x72d1('0x8')](respondWithResult(_0x1b40e8,null))[_0x72d1('0xd')](handleError(_0x1b40e8,null));};exports[_0x72d1('0x4c')]=function(_0x4e2d85,_0x1aec3d){return respondWithRpcPromise(_0x72d1('0x4d'),_0x4e2d85[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1aec3d,null))['catch'](handleError(_0x1aec3d,null));};exports[_0x72d1('0x4e')]=function(_0x5f4614,_0x28896f){return respondWithRpcPromise(_0x72d1('0x4d'),_0x5f4614[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x5f4614[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x28896f,null))[_0x72d1('0xd')](handleError(_0x28896f,null));};exports[_0x72d1('0x4f')]=function(_0x28e42b,_0x48cd1e){return respondWithRpcPromise('SmsQueues',_0x28e42b[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x48cd1e,null))[_0x72d1('0xd')](handleError(_0x48cd1e,null));};exports['showSmsQueues']=function(_0x31bfda,_0x333671){return respondWithRpcPromise('SmsQueues',_0x31bfda[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x31bfda[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x333671,null))[_0x72d1('0xd')](handleError(_0x333671,null));};exports[_0x72d1('0x50')]=function(_0x102574,_0x7925ec){return respondWithRpcPromise(_0x72d1('0x51'),_0x102574[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x7925ec,null))[_0x72d1('0xd')](handleError(_0x7925ec,null));};exports['showWhatsappQueues']=function(_0x55f49f,_0x15e0e0){return respondWithRpcPromise(_0x72d1('0x51'),_0x55f49f[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x55f49f[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x15e0e0,null))[_0x72d1('0xd')](handleError(_0x15e0e0,null));};exports[_0x72d1('0x52')]=function(_0x488a14,_0x837b6b){return respondWithRpcPromise('FaxQueues',_0x488a14[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x837b6b,null))['catch'](handleError(_0x837b6b,null));};exports['showFaxQueues']=function(_0xfd39ab,_0x14d59b){return respondWithRpcPromise(_0x72d1('0x53'),_0xfd39ab[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0xfd39ab[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x14d59b,null))['catch'](handleError(_0x14d59b,null));};exports[_0x72d1('0x54')]=function(_0x24bd82,_0x336ca3){return respondWithRpcPromise('FaxAccounts',_0x24bd82[_0x72d1('0x18')])['then'](respondWithResult(_0x336ca3,null))[_0x72d1('0xd')](handleError(_0x336ca3,null));};exports[_0x72d1('0x55')]=function(_0x5158ff,_0x3c0a7e){return respondWithRpcPromise(_0x72d1('0x56'),_0x5158ff['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3c0a7e,null))[_0x72d1('0xd')](handleError(_0x3c0a7e,null));};exports[_0x72d1('0x57')]=function(_0x132a43,_0x4a52ec){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x132a43['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x4a52ec,null))[_0x72d1('0xd')](handleError(_0x4a52ec,null));};exports[_0x72d1('0x58')]=function(_0x240159,_0x146b06){return respondWithRpcPromise(_0x72d1('0x59'),_0x240159['query'],routingClient)['then'](respondWithResult(_0x146b06,null))[_0x72d1('0xd')](handleError(_0x146b06,null));};exports[_0x72d1('0x5a')]=function(_0x36827e,_0x3ef7a3){return respondWithRpcPromise(_0x72d1('0x59'),_0x36827e[_0x72d1('0x18')],routingClient)['then'](function(_0x23f0e3){if(_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')]!==undefined){var _0x53e57b=_(_0x23f0e3[_0x72d1('0x16')])[_0x72d1('0x5c')]([_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')],_0x36827e[_0x72d1('0x1e')]['id']])[_0x72d1('0x5d')](_0x72d1('0x5e'))[_0x72d1('0x5f')]()['value']();return _0x23f0e3[_0x72d1('0x16')][_0x72d1('0x5c')](function(_0x24f5eb){return _0x53e57b[_0x72d1('0x60')](_0x24f5eb['queue_id'])>-0x1;});}else{return _0x23f0e3['rows'][_0x72d1('0x5c')](function(_0x2932bb){return _0x2932bb['queue_id']===parseInt(_0x36827e[_0x72d1('0x1e')]['id']);});}})[_0x72d1('0x8')](respondWithResult(_0x3ef7a3,null))[_0x72d1('0xd')](handleError(_0x3ef7a3,null));};exports[_0x72d1('0x61')]=function(_0x35b9bb,_0x1d1e22){return respondWithRpcPromise(_0x72d1('0x62'),_0x35b9bb[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1d1e22,null))[_0x72d1('0xd')](handleError(_0x1d1e22,null));};exports[_0x72d1('0x63')]=function(_0x38bfd3,_0x3cbe00){return respondWithRpcPromise(_0x72d1('0x64'),_0x38bfd3[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3cbe00,null))[_0x72d1('0xd')](handleError(_0x3cbe00,null));};exports['faxQueuesWaitingInteractions']=function(_0x47585e,_0x466634){return respondWithRpcPromise(_0x72d1('0x65'),_0x47585e[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x466634,null))[_0x72d1('0xd')](handleError(_0x466634,null));};exports['queueNotify']=function(_0x1c6547){return function(_0x369153,_0x4a6607){var _0x266fbc,_0x4057ec;var _0x239cdb=_[_0x72d1('0x66')](_0x1c6547);var _0x27c651=_0x1c6547===_0x72d1('0x67')?'Website':_0x72d1('0x68');return db[_0x239cdb+_0x72d1('0x69')]['findOne']({'raw':!![],'where':{'id':_0x369153['params']['id']}})[_0x72d1('0x8')](function(_0x291b67){if(_[_0x72d1('0x14')](_0x291b67)){throw new Error(_0x239cdb+_0x72d1('0x6a'));}_0x266fbc=_0x291b67;return db[_0x239cdb+'Message'][_0x72d1('0x6b')]({'where':{'id':_0x369153[_0x72d1('0x33')][_0x72d1('0x6c')]},'include':[{'model':db[_0x239cdb+_0x72d1('0x6d')],'as':_0x72d1('0x6d')},{'model':db[_0x239cdb+_0x27c651],'as':_0x72d1('0x68')}]});})[_0x72d1('0x8')](function(_0x14a215){if(_['isNil'](_0x14a215)){throw new Error(_0x239cdb+_0x72d1('0x6e'));}_0x4057ec=_0x14a215;return _0x14a215[_0x72d1('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x1b06f3={'uniqueid':_0x1c6547+'.'+_0x4057ec['id']+'.'+_0x4057ec['Interaction']['id'],'FromUserId':_0x369153[_0x72d1('0x32')]['id'],'type':_0x72d1('0x70')};_0x1b06f3[_0x239cdb+'MessageId']=_0x4057ec['id'];_0x1b06f3[_0x239cdb+_0x72d1('0x71')]=_0x4057ec['Interaction']['id'];_0x1b06f3[_0x72d1('0x72')+_0x239cdb+_0x27c651+'Id']=_0x4057ec['Account']['id'];_0x1b06f3['To'+_0x239cdb+_0x72d1('0x73')]=_0x266fbc['id'];return db[_0x239cdb+_0x72d1('0x74')][_0x72d1('0x75')](_0x1b06f3);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x1c6547,'interaction':_0x4057ec['Interaction'],'message':_0x4057ec,'account':_0x4057ec[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x70'),'appdata':_0x266fbc[_0x72d1('0x12')]+','+(_0x4057ec['Account'][_0x72d1('0x77')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x4a6607,null))[_0x72d1('0xd')](handleError(_0x4a6607,null));};};exports[_0x72d1('0x79')]=function(_0x8d4f0d,_0x5c262e){var _0x1d0db0,_0x39d961;if(_[_0x72d1('0x14')](_0x8d4f0d['body'][_0x72d1('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38a32c=_0x8d4f0d['body'][_0x72d1('0x7a')];var _0x2d45c9=_[_0x72d1('0x66')](_0x38a32c);var _0x21ad86=_0x38a32c==='chat'?_0x72d1('0x7b'):_0x72d1('0x68');return db[_0x72d1('0x7c')][_0x72d1('0x6b')]({'raw':!![],'where':{'id':_0x8d4f0d['params']['id'],'role':_0x72d1('0x7d')}})[_0x72d1('0x8')](function(_0x430905){if(_[_0x72d1('0x14')](_0x430905)){throw new Error(_0x72d1('0x7e'));}_0x1d0db0=_0x430905;return db[_0x2d45c9+_0x72d1('0x7f')][_0x72d1('0x6b')]({'where':{'id':_0x8d4f0d['body']['messageId']},'include':[{'model':db[_0x2d45c9+'Interaction'],'as':_0x72d1('0x6d')},{'model':db[_0x2d45c9+_0x21ad86],'as':'Account'}]});})[_0x72d1('0x8')](function(_0x8f4603){if(_['isNil'](_0x8f4603)){throw new Error(_0x2d45c9+_0x72d1('0x6e'));}_0x39d961=_0x8f4603;return _0x8f4603['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x378cf0={'uniqueid':_0x38a32c+'.'+_0x39d961['id']+'.'+_0x39d961[_0x72d1('0x6d')]['id'],'FromUserId':_0x8d4f0d[_0x72d1('0x32')]['id'],'type':'queue','ToUserId':_0x1d0db0['id']};_0x378cf0[_0x2d45c9+'MessageId']=_0x39d961['id'];_0x378cf0[_0x2d45c9+_0x72d1('0x71')]=_0x39d961['Interaction']['id'];_0x378cf0['From'+_0x2d45c9+_0x21ad86+'Id']=_0x39d961['Account']['id'];return db[_0x2d45c9+_0x72d1('0x74')][_0x72d1('0x75')](_0x378cf0);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x38a32c,'interaction':_0x39d961[_0x72d1('0x6d')],'message':_0x39d961,'account':_0x39d961[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x7d'),'appdata':_0x1d0db0['name']+','+(_0x39d961['Account'][_0x72d1('0x80')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c262e,null))[_0x72d1('0xd')](handleError(_0x5c262e,null));};
\ No newline at end of file
+var _0xed1f=['voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','update','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','catch','json','sendStatus','stack','name','status','isNil','rows','find','VoiceChannels','query'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xed1f,0x6a));var _0xfed1=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xed1f[_0x565ed7];return _0x183ad7;};'use strict';var BPromise=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));var _=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var db=require(_0xfed1('0x4'))['db'];var logger=require(_0xfed1('0x5'))(_0xfed1('0x6'));var jayson=require(_0xfed1('0x7'));var amiClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232a});var mailClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232b});var routingClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){var _0x42dd5c=_0x2a6082?_0x2a6082:amiClient;return _0x42dd5c[_0xfed1('0xa')](_0x380e18,_0x612b38)['then'](function(_0x1414be){if(_0x1414be[_0xfed1('0xb')]){if(_0x1414be['error'][_0xfed1('0xc')]===0x1f4){return _0x568d48(_0x1414be['error'][_0xfed1('0xd')]);}return _0x2967ef(_0x1414be[_0xfed1('0xb')]['message']);}else{_0x2967ef(_0x1414be['result']);}})[_0xfed1('0xe')](function(_0xe84ba6){_0x568d48(_0xe84ba6);});});}function respondWithResult(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xc8;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['status'](_0x17f4fe)[_0xfed1('0xf')](_0x5a3469);}return _0x569a6e[_0xfed1('0x10')](0x194);};}function handleError(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0x1f4;return function(_0x5b9455){logger['error'](_0x5b9455[_0xfed1('0x11')]);if(_0x5b9455[_0xfed1('0x12')]){delete _0x5b9455[_0xfed1('0x12')];}_0x532537[_0xfed1('0x13')](_0x2dde3a)['send'](_0x5b9455);};}function findById(_0x1a00f6){return function(_0x4af928){if(!_[_0xfed1('0x14')](_0x1a00f6)&&!_[_0xfed1('0x14')](_0x4af928)&&!_['isNil'](_0x4af928[_0xfed1('0x15')])){return _[_0xfed1('0x16')](_0x4af928['rows'],function(_0x59509b){return _0x59509b['id']==_0x1a00f6;});}return null;};}exports['voiceChannels']=function(_0x1e5afb,_0x51f12a){return respondWithRpcPromise(_0xfed1('0x17'),_0x1e5afb[_0xfed1('0x18')])['then'](respondWithResult(_0x51f12a,null))[_0xfed1('0xe')](handleError(_0x51f12a,null));};exports[_0xfed1('0x19')]=function(_0x59ee9d,_0x3ce944){return respondWithRpcPromise(_0xfed1('0x1a'),_[_0xfed1('0x1b')](_0x59ee9d[_0xfed1('0x18')],_0x59ee9d['params']))[_0xfed1('0x1c')](respondWithResult(_0x3ce944,null))['catch'](handleError(_0x3ce944,null));};exports[_0xfed1('0x1d')]=function(_0x1317c8,_0x37c384){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xfed1('0x1b')](_0x1317c8['query'],_0x1317c8[_0xfed1('0x1e')]))[_0xfed1('0x1c')](respondWithResult(_0x37c384,null))[_0xfed1('0xe')](handleError(_0x37c384,null));};exports[_0xfed1('0x1f')]=function(_0x186ecc,_0x1199b7){return respondWithRpcPromise('VoiceQueues',_0x186ecc[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x1199b7,null))['catch'](handleError(_0x1199b7,null));};exports[_0xfed1('0x20')]=function(_0x2b9dd2,_0x1b871a){return respondWithRpcPromise(_0xfed1('0x21'),_0x2b9dd2[_0xfed1('0x18')])[_0xfed1('0x1c')](findById(_0x2b9dd2['params']['id']))[_0xfed1('0x1c')](respondWithResult(_0x1b871a,null))['catch'](handleError(_0x1b871a,null));};exports[_0xfed1('0x22')]=function(_0x4e5249,_0x53b0c9){return respondWithRpcPromise(_0xfed1('0x23'),_[_0xfed1('0x1b')](_0x4e5249[_0xfed1('0x24')],_0x4e5249['params']))[_0xfed1('0x1c')](respondWithResult(_0x53b0c9,null))[_0xfed1('0xe')](handleError(_0x53b0c9,null));};exports[_0xfed1('0x25')]=function(_0x383955,_0x12399f){return respondWithRpcPromise(_0xfed1('0x26'),_['merge'](_0x383955[_0xfed1('0x18')],_0x383955[_0xfed1('0x1e')]))['then'](respondWithResult(_0x12399f,null))['catch'](handleError(_0x12399f,null));};exports[_0xfed1('0x27')]=function(_0x2d10f5,_0x2def09){return respondWithRpcPromise(_0xfed1('0x28'),_0x2d10f5[_0xfed1('0x18')])['then'](respondWithResult(_0x2def09,null))[_0xfed1('0xe')](handleError(_0x2def09,null));};exports[_0xfed1('0x29')]=function(_0x10143b,_0x349de1){return respondWithRpcPromise(_0xfed1('0x2a'),_['merge'](_0x10143b[_0xfed1('0x18')],_0x10143b['params']))[_0xfed1('0x1c')](respondWithResult(_0x349de1,null))[_0xfed1('0xe')](handleError(_0x349de1,null));};exports[_0xfed1('0x2b')]=function(_0x321c1b,_0x1c0523){return respondWithRpcPromise(_0xfed1('0x2c'),_[_0xfed1('0x1b')](_0x321c1b[_0xfed1('0x18')],_0x321c1b['params']))[_0xfed1('0x1c')](respondWithResult(_0x1c0523,null))[_0xfed1('0xe')](handleError(_0x1c0523,null));};exports[_0xfed1('0x2d')]=function(_0x28adfc,_0x57da75){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xfed1('0x1b')](_0x28adfc[_0xfed1('0x18')],_0x28adfc[_0xfed1('0x1e')]))[_0xfed1('0x1c')](respondWithResult(_0x57da75,null))[_0xfed1('0xe')](handleError(_0x57da75,null));};exports[_0xfed1('0x2e')]=function(_0x46a150,_0x2f183c){return respondWithRpcPromise('Outbound',_0x46a150['query'])[_0xfed1('0x1c')](respondWithResult(_0x2f183c,null))[_0xfed1('0xe')](handleError(_0x2f183c,null));};exports['outboundChannels']=function(_0x1dae7c,_0x15339c){return respondWithRpcPromise(_0xfed1('0x2f'),_0x1dae7c[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x15339c,null))[_0xfed1('0xe')](handleError(_0x15339c,null));};exports[_0xfed1('0x30')]=function(_0x4118d4,_0x3c27de){var _0x5f3e1f;return respondWithRpcPromise('Agents',_0x4118d4['query'])[_0xfed1('0x1c')](function(_0x340e3c){_0x5f3e1f=_0x340e3c;return respondWithRpcPromise(_0xfed1('0x31'),_0x4118d4['query'],routingClient);})[_0xfed1('0x1c')](function(_0x4a0b04){return _[_0xfed1('0x1b')]({},_0x4a0b04,_0x5f3e1f);})[_0xfed1('0x1c')](respondWithResult(_0x3c27de,null))[_0xfed1('0xe')](handleError(_0x3c27de,null));};exports['agentCapacity']=function(_0x20bdae,_0x6f1647){if(_0x20bdae[_0xfed1('0x24')]&&_0x20bdae['body'][_0xfed1('0x32')]&&_0x20bdae['user']&&_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')]){for(var _0x229fc7 in _0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')]){if(_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0xfed1('0x34')](_0x229fc7)){db[_0xfed1('0x35')]['findAll']({'where':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'type':_0xfed1('0x36'),'exitAt':null,'uniqueid':_0x20bdae['body']['interaction'][_0x229fc7]&&_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xfed1('0x37')]?{'$notIn':_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7]}:{'$ne':null}}})[_0xfed1('0x1c')](function(_0x2547ee){var _0x24bf7a=moment()[_0xfed1('0x38')](_0xfed1('0x39'));for(var _0x61f65b=0x0,_0x1db6dc=_0x2547ee['length'];_0x61f65b<_0x1db6dc;_0x61f65b+=0x1){_0x2547ee[_0x61f65b][_0xfed1('0x3a')]({'exitAt':_0x24bf7a});}});for(var _0xb61d09=0x0;_0xb61d09<_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xfed1('0x37')];_0xb61d09+=0x1){db[_0xfed1('0x35')]['findOrCreate']({'where':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'type':_0xfed1('0x36'),'uniqueid':_0x20bdae['body'][_0xfed1('0x32')][_0x229fc7][_0xb61d09],'exitAt':null},'defaults':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'interface':_[_0xfed1('0x14')](_0x20bdae['user'][_0xfed1('0x3b')])?util[_0xfed1('0x38')](_0xfed1('0x3c'),_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')]):_0x20bdae[_0xfed1('0x33')][_0xfed1('0x3b')],'type':_0xfed1('0x36'),'enterAt':moment()[_0xfed1('0x38')](_0xfed1('0x39')),'role':_0xfed1('0x3d'),'internal':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x3e')],'uniqueid':_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xb61d09]}});}}}}return respondWithRpcPromise(_0xfed1('0x3f'),{'id':_0x20bdae[_0xfed1('0x1e')]['id'],'capacity':_0x20bdae[_0xfed1('0x24')]['capacity']},routingClient)['then'](respondWithResult(_0x6f1647,null))[_0xfed1('0xe')](handleError(_0x6f1647,null));};exports[_0xfed1('0x40')]=function(_0x5be0c3,_0x1358c1){return respondWithRpcPromise('Telephones',_0x5be0c3[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x1358c1,null))['catch'](handleError(_0x1358c1,null));};exports['trunks']=function(_0x49f696,_0x2376b3){return respondWithRpcPromise(_0xfed1('0x41'),_0x49f696[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x2376b3,null))[_0xfed1('0xe')](handleError(_0x2376b3,null));};exports[_0xfed1('0x42')]=function(_0x1a9f22,_0x144102){return respondWithRpcPromise(_0xfed1('0x43'),_0x1a9f22[_0xfed1('0x18')])['then'](respondWithResult(_0x144102,null))['catch'](handleError(_0x144102,null));};exports[_0xfed1('0x44')]=function(_0x2a2eaa,_0x3f4db7){return respondWithRpcPromise(_0xfed1('0x45'),_0x2a2eaa[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x3f4db7,null))[_0xfed1('0xe')](handleError(_0x3f4db7,null));};exports[_0xfed1('0x46')]=function(_0x117e25,_0x427fa6){return respondWithRpcPromise(_0xfed1('0x45'),_0x117e25[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x117e25[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x427fa6,null))[_0xfed1('0xe')](handleError(_0x427fa6,null));};exports[_0xfed1('0x47')]=function(_0x54eb53,_0x5b167b){return respondWithRpcPromise(_0xfed1('0x48'),_0x54eb53[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x5b167b,null))[_0xfed1('0xe')](handleError(_0x5b167b,null));};exports[_0xfed1('0x49')]=function(_0x41a22a,_0x2ccdc3){return respondWithRpcPromise(_0xfed1('0x48'),_0x41a22a[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x41a22a[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x2ccdc3,null))[_0xfed1('0xe')](handleError(_0x2ccdc3,null));};exports[_0xfed1('0x4a')]=function(_0x59ecc4,_0x30cf99){return respondWithRpcPromise('MailAccounts',_0x59ecc4['query'],mailClient)[_0xfed1('0x1c')](respondWithResult(_0x30cf99,null))['catch'](handleError(_0x30cf99,null));};exports[_0xfed1('0x4b')]=function(_0x5acc45,_0x390fc0){return respondWithRpcPromise(_0xfed1('0x4c'),_0x5acc45['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x390fc0,null))[_0xfed1('0xe')](handleError(_0x390fc0,null));};exports['showOpenchannelQueues']=function(_0x29b51e,_0x41b407){return respondWithRpcPromise(_0xfed1('0x4c'),_0x29b51e[_0xfed1('0x18')],routingClient)['then'](findById(_0x29b51e[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x41b407,null))[_0xfed1('0xe')](handleError(_0x41b407,null));};exports[_0xfed1('0x4d')]=function(_0x23347a,_0xf4e660){return respondWithRpcPromise(_0xfed1('0x4e'),_0x23347a[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0xf4e660,null))[_0xfed1('0xe')](handleError(_0xf4e660,null));};exports[_0xfed1('0x4f')]=function(_0x18e958,_0x4112c1){return respondWithRpcPromise(_0xfed1('0x4e'),_0x18e958[_0xfed1('0x18')],routingClient)['then'](findById(_0x18e958['params']['id']))['then'](respondWithResult(_0x4112c1,null))[_0xfed1('0xe')](handleError(_0x4112c1,null));};exports[_0xfed1('0x50')]=function(_0x3aea22,_0x2fb9b2){return respondWithRpcPromise('WhatsappQueues',_0x3aea22[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0x2fb9b2,null))[_0xfed1('0xe')](handleError(_0x2fb9b2,null));};exports[_0xfed1('0x51')]=function(_0x18af7d,_0x3beef3){return respondWithRpcPromise(_0xfed1('0x52'),_0x18af7d['query'],routingClient)[_0xfed1('0x1c')](findById(_0x18af7d[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x3beef3,null))['catch'](handleError(_0x3beef3,null));};exports[_0xfed1('0x53')]=function(_0x103628,_0x28dbaa){return respondWithRpcPromise(_0xfed1('0x54'),_0x103628['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x28dbaa,null))['catch'](handleError(_0x28dbaa,null));};exports[_0xfed1('0x55')]=function(_0x2d64d3,_0x4b685b){return respondWithRpcPromise('FaxQueues',_0x2d64d3[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x2d64d3[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x4b685b,null))['catch'](handleError(_0x4b685b,null));};exports[_0xfed1('0x56')]=function(_0x440e40,_0x42bc11){return respondWithRpcPromise(_0xfed1('0x57'),_0x440e40[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x42bc11,null))['catch'](handleError(_0x42bc11,null));};exports[_0xfed1('0x58')]=function(_0x93411d,_0x5ceedd){return respondWithRpcPromise(_0xfed1('0x59'),_0x93411d[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x5ceedd,null))[_0xfed1('0xe')](handleError(_0x5ceedd,null));};exports[_0xfed1('0x5a')]=function(_0x26ecb9,_0x4fc7b5){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x26ecb9[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0x4fc7b5,null))[_0xfed1('0xe')](handleError(_0x4fc7b5,null));};exports[_0xfed1('0x5b')]=function(_0x5d8742,_0xdc237c){return respondWithRpcPromise(_0xfed1('0x5c'),_0x5d8742[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0xdc237c,null))[_0xfed1('0xe')](handleError(_0xdc237c,null));};exports[_0xfed1('0x5d')]=function(_0x4104fe,_0x49213b){return respondWithRpcPromise(_0xfed1('0x5c'),_0x4104fe[_0xfed1('0x18')],routingClient)['then'](function(_0x544605){if(_0x4104fe[_0xfed1('0x18')]['type']!==undefined){var _0x1f4e2b=_(_0x544605[_0xfed1('0x15')])[_0xfed1('0x5e')]([_0x4104fe['query'][_0xfed1('0x5f')],_0x4104fe[_0xfed1('0x1e')]['id']])[_0xfed1('0x60')](_0xfed1('0x61'))[_0xfed1('0x62')]()['value']();return _0x544605[_0xfed1('0x15')][_0xfed1('0x5e')](function(_0x45348d){return _0x1f4e2b[_0xfed1('0x63')](_0x45348d[_0xfed1('0x61')])>-0x1;});}else{return _0x544605['rows'][_0xfed1('0x5e')](function(_0xe74336){return _0xe74336[_0xfed1('0x61')]===parseInt(_0x4104fe[_0xfed1('0x1e')]['id']);});}})[_0xfed1('0x1c')](respondWithResult(_0x49213b,null))[_0xfed1('0xe')](handleError(_0x49213b,null));};exports[_0xfed1('0x64')]=function(_0x4238bd,_0x390eb0){return respondWithRpcPromise(_0xfed1('0x65'),_0x4238bd['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x390eb0,null))[_0xfed1('0xe')](handleError(_0x390eb0,null));};exports[_0xfed1('0x66')]=function(_0x383d34,_0x194f42){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x383d34[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x194f42,null))[_0xfed1('0xe')](handleError(_0x194f42,null));};exports[_0xfed1('0x67')]=function(_0x221ed8,_0xb76860){return respondWithRpcPromise(_0xfed1('0x68'),_0x221ed8[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0xb76860,null))['catch'](handleError(_0xb76860,null));};exports['queueNotify']=function(_0xc3b72a){return function(_0x547d9c,_0x25cebc){var _0x3ab92e,_0x483b16;var _0x4b355d=_['capitalize'](_0xc3b72a);var _0x304cc0=_0xc3b72a==='chat'?_0xfed1('0x69'):'Account';return db[_0x4b355d+_0xfed1('0x6a')][_0xfed1('0x6b')]({'raw':!![],'where':{'id':_0x547d9c[_0xfed1('0x1e')]['id']}})[_0xfed1('0x1c')](function(_0x3c6ddd){if(_['isNil'](_0x3c6ddd)){throw new Error(_0x4b355d+_0xfed1('0x6c'));}_0x3ab92e=_0x3c6ddd;return db[_0x4b355d+_0xfed1('0x6d')]['findOne']({'where':{'id':_0x547d9c[_0xfed1('0x24')][_0xfed1('0x6e')]},'include':[{'model':db[_0x4b355d+'Interaction'],'as':_0xfed1('0x6f')},{'model':db[_0x4b355d+_0x304cc0],'as':_0xfed1('0x70')}]});})[_0xfed1('0x1c')](function(_0x5cf634){if(_[_0xfed1('0x14')](_0x5cf634)){throw new Error(_0x4b355d+_0xfed1('0x71'));}_0x483b16=_0x5cf634;return _0x5cf634['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xfed1('0x1c')](function(){var _0xc81c8f={'uniqueid':_0xc3b72a+'.'+_0x483b16['id']+'.'+_0x483b16[_0xfed1('0x6f')]['id'],'FromUserId':_0x547d9c['user']['id'],'type':_0xfed1('0x72')};_0xc81c8f[_0x4b355d+_0xfed1('0x73')]=_0x483b16['id'];_0xc81c8f[_0x4b355d+'InteractionId']=_0x483b16['Interaction']['id'];_0xc81c8f[_0xfed1('0x74')+_0x4b355d+_0x304cc0+'Id']=_0x483b16[_0xfed1('0x70')]['id'];_0xc81c8f['To'+_0x4b355d+_0xfed1('0x75')]=_0x3ab92e['id'];return db[_0x4b355d+_0xfed1('0x76')][_0xfed1('0x77')](_0xc81c8f);})[_0xfed1('0x1c')](function(){return respondWithRpcPromise(_0xfed1('0x78'),{'channel':_0xc3b72a,'interaction':_0x483b16[_0xfed1('0x6f')],'message':_0x483b16,'account':_0x483b16[_0xfed1('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfed1('0x72'),'appdata':_0x3ab92e[_0xfed1('0x12')]+','+(_0x483b16[_0xfed1('0x70')]['queueTransferTimeout']||0x12c),'interval':_0xfed1('0x79')}]},routingClient);})[_0xfed1('0x1c')](respondWithResult(_0x25cebc,null))['catch'](handleError(_0x25cebc,null));};};exports[_0xfed1('0x7a')]=function(_0x1f721d,_0x5f5d42){var _0x3d4aee,_0x408ee0;if(_[_0xfed1('0x14')](_0x1f721d[_0xfed1('0x24')]['channel'])){throw new Error(_0xfed1('0x7b'));}var _0x24ab18=_0x1f721d[_0xfed1('0x24')][_0xfed1('0x7c')];var _0x1ecef6=_[_0xfed1('0x7d')](_0x24ab18);var _0x2d0cbb=_0x24ab18===_0xfed1('0x7e')?'Website':_0xfed1('0x70');return db[_0xfed1('0x7f')][_0xfed1('0x6b')]({'raw':!![],'where':{'id':_0x1f721d['params']['id'],'role':_0xfed1('0x3d')}})[_0xfed1('0x1c')](function(_0x45a677){if(_['isNil'](_0x45a677)){throw new Error('Agent\x20not\x20found');}_0x3d4aee=_0x45a677;return db[_0x1ecef6+_0xfed1('0x6d')][_0xfed1('0x6b')]({'where':{'id':_0x1f721d[_0xfed1('0x24')][_0xfed1('0x6e')]},'include':[{'model':db[_0x1ecef6+_0xfed1('0x6f')],'as':_0xfed1('0x6f')},{'model':db[_0x1ecef6+_0x2d0cbb],'as':_0xfed1('0x70')}]});})[_0xfed1('0x1c')](function(_0x130eb2){if(_[_0xfed1('0x14')](_0x130eb2)){throw new Error(_0x1ecef6+_0xfed1('0x71'));}_0x408ee0=_0x130eb2;return _0x130eb2[_0xfed1('0x80')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfed1('0x1c')](function(){var _0x18b086={'uniqueid':_0x24ab18+'.'+_0x408ee0['id']+'.'+_0x408ee0[_0xfed1('0x6f')]['id'],'FromUserId':_0x1f721d[_0xfed1('0x33')]['id'],'type':_0xfed1('0x72'),'ToUserId':_0x3d4aee['id']};_0x18b086[_0x1ecef6+_0xfed1('0x73')]=_0x408ee0['id'];_0x18b086[_0x1ecef6+_0xfed1('0x81')]=_0x408ee0[_0xfed1('0x6f')]['id'];_0x18b086['From'+_0x1ecef6+_0x2d0cbb+'Id']=_0x408ee0[_0xfed1('0x70')]['id'];return db[_0x1ecef6+_0xfed1('0x76')][_0xfed1('0x77')](_0x18b086);})['then'](function(){return respondWithRpcPromise(_0xfed1('0x78'),{'channel':_0x24ab18,'interaction':_0x408ee0[_0xfed1('0x6f')],'message':_0x408ee0,'account':_0x408ee0[_0xfed1('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfed1('0x3d'),'appdata':_0x3d4aee[_0xfed1('0x12')]+','+(_0x408ee0[_0xfed1('0x70')][_0xfed1('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x5f5d42,null))[_0xfed1('0xe')](handleError(_0x5f5d42,null));};
\ No newline at end of file
index 83c802b..5d72a09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94f8=['get','index','/:id','isAuthenticated','/:id/run','run','post','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','./schedule.controller'];(function(_0x5499ab,_0x4c1128){var _0x344478=function(_0x5d767e){while(--_0x5d767e){_0x5499ab['push'](_0x5499ab['shift']());}};_0x344478(++_0x4c1128);}(_0x94f8,0x1b9));var _0x894f=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0x94f8[_0x2b84d5];return _0x51452a;};'use strict';var multer=require(_0x894f('0x0'));var util=require(_0x894f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x894f('0x2'));var router=express[_0x894f('0x3')]();var fs_extra=require(_0x894f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x894f('0x5'));var config=require('../../config/environment');var controller=require(_0x894f('0x6'));router[_0x894f('0x7')]('/',auth['isAuthenticated'](),controller[_0x894f('0x8')]);router[_0x894f('0x7')](_0x894f('0x9'),auth[_0x894f('0xa')](),controller['show']);router['get'](_0x894f('0xb'),auth[_0x894f('0xa')](),controller[_0x894f('0xc')]);router[_0x894f('0xd')]('/',auth[_0x894f('0xa')](),controller['create']);router['put']('/:id',auth[_0x894f('0xa')](),controller['update']);router[_0x894f('0xe')](_0x894f('0x9'),auth['isAuthenticated'](),controller[_0x894f('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0xff2b=['put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id/run','run','post','create'];(function(_0x2c3412,_0x40edf6){var _0x246d2c=function(_0x1760ba){while(--_0x1760ba){_0x2c3412['push'](_0x2c3412['shift']());}};_0x246d2c(++_0x40edf6);}(_0xff2b,0x155));var _0xbff2=function(_0xed1509,_0x37f093){_0xed1509=_0xed1509-0x0;var _0x336cc3=_0xff2b[_0xed1509];return _0x336cc3;};'use strict';var multer=require(_0xbff2('0x0'));var util=require(_0xbff2('0x1'));var path=require(_0xbff2('0x2'));var timeout=require('connect-timeout');var express=require(_0xbff2('0x3'));var router=express[_0xbff2('0x4')]();var fs_extra=require(_0xbff2('0x5'));var auth=require(_0xbff2('0x6'));var interaction=require(_0xbff2('0x7'));var config=require('../../config/environment');var controller=require(_0xbff2('0x8'));router[_0xbff2('0x9')]('/',auth[_0xbff2('0xa')](),controller[_0xbff2('0xb')]);router['get']('/:id',auth[_0xbff2('0xa')](),controller['show']);router[_0xbff2('0x9')](_0xbff2('0xc'),auth['isAuthenticated'](),controller[_0xbff2('0xd')]);router[_0xbff2('0xe')]('/',auth[_0xbff2('0xa')](),controller[_0xbff2('0xf')]);router[_0xbff2('0x10')](_0xbff2('0x11'),auth[_0xbff2('0xa')](),controller[_0xbff2('0x12')]);router[_0xbff2('0x13')]('/:id',auth[_0xbff2('0xa')](),controller['destroy']);module[_0xbff2('0x14')]=router;
\ No newline at end of file
index c900bb5..9afa6c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb4a=['csv','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','minutes','days','xlsx'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeb4a,0x16b));var _0xaeb4=function(_0x343cd7,_0x24c5eb){_0x343cd7=_0x343cd7-0x0;var _0x37c4f3=_0xeb4a[_0x343cd7];return _0x37c4f3;};'use strict';var Sequelize=require(_0xaeb4('0x0'));module['exports']={'name':{'type':Sequelize[_0xaeb4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xaeb4('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xaeb4('0x1')],'allowNull':![],'defaultValue':_0xaeb4('0x3')},'startAt':{'type':Sequelize[_0xaeb4('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xaeb4('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xaeb4('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xaeb4('0x6')](_0xaeb4('0x7'),'quarters',_0xaeb4('0x8'),'weeks','days','hours',_0xaeb4('0x9')),'allowNull':![],'defaultValue':_0xaeb4('0xa')},'output':{'type':Sequelize[_0xaeb4('0x6')]('csv','pdf',_0xaeb4('0xb')),'allowNull':![],'defaultValue':_0xaeb4('0xc')},'type':{'type':Sequelize[_0xaeb4('0x6')]('custom',_0xaeb4('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xaeb4('0x1')]},'cc':{'type':Sequelize[_0xaeb4('0xe')]},'bcc':{'type':Sequelize[_0xaeb4('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xaeb4('0x2')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xbc38=['csv','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','months','weeks','hours','minutes','days'];(function(_0xd28d70,_0x5c2d12){var _0x4aa4f7=function(_0x4222c8){while(--_0x4222c8){_0xd28d70['push'](_0xd28d70['shift']());}};_0x4aa4f7(++_0x5c2d12);}(_0xbc38,0xd4));var _0x8bc3=function(_0xba61fc,_0x4a4fa4){_0xba61fc=_0xba61fc-0x0;var _0x55752c=_0xbc38[_0xba61fc];return _0x55752c;};'use strict';var Sequelize=require('sequelize');module[_0x8bc3('0x0')]={'name':{'type':Sequelize[_0x8bc3('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8bc3('0x1')]},'active':{'type':Sequelize[_0x8bc3('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8bc3('0x1')],'allowNull':![],'defaultValue':_0x8bc3('0x3')},'startAt':{'type':Sequelize[_0x8bc3('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8bc3('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8bc3('0x5')](_0x8bc3('0x6'),'quarters',_0x8bc3('0x7'),_0x8bc3('0x8'),'days',_0x8bc3('0x9'),_0x8bc3('0xa')),'allowNull':![],'defaultValue':_0x8bc3('0xb')},'output':{'type':Sequelize[_0x8bc3('0x5')](_0x8bc3('0xc'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x8bc3('0xc')},'type':{'type':Sequelize[_0x8bc3('0x5')](_0x8bc3('0xd'),_0x8bc3('0xe')),'allowNull':![],'defaultValue':_0x8bc3('0xd')},'sendMail':{'type':Sequelize[_0x8bc3('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x8bc3('0x1')]},'cc':{'type':Sequelize[_0x8bc3('0xf')]},'bcc':{'type':Sequelize[_0x8bc3('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x8bc3('0x2')],'defaultValue':!![]}};
\ No newline at end of file
index d0245d7..f1abe28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9b3=['map','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','params','keys','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','get','then','error','stack','name','send','Schedule','rawAttributes','fieldName','type','key','model'];(function(_0x30ab9d,_0x33df2d){var _0x507ac6=function(_0x3c401a){while(--_0x3c401a){_0x30ab9d['push'](_0x30ab9d['shift']());}};_0x507ac6(++_0x33df2d);}(_0xc9b3,0x7f));var _0x3c9b=function(_0x35ad2c,_0x18b597){_0x35ad2c=_0x35ad2c-0x0;var _0x34b81c=_0xc9b3[_0x35ad2c];return _0x34b81c;};'use strict';var emlformat=require(_0x3c9b('0x0'));var rimraf=require(_0x3c9b('0x1'));var zipdir=require(_0x3c9b('0x2'));var jsonpatch=require(_0x3c9b('0x3'));var rp=require(_0x3c9b('0x4'));var moment=require(_0x3c9b('0x5'));var BPromise=require(_0x3c9b('0x6'));var Mustache=require(_0x3c9b('0x7'));var util=require(_0x3c9b('0x8'));var path=require(_0x3c9b('0x9'));var sox=require(_0x3c9b('0xa'));var csv=require('to-csv');var ejs=require(_0x3c9b('0xb'));var fs=require('fs');var fs_extra=require(_0x3c9b('0xc'));var _=require('lodash');var squel=require(_0x3c9b('0xd'));var crypto=require(_0x3c9b('0xe'));var jsforce=require(_0x3c9b('0xf'));var deskjs=require(_0x3c9b('0x10'));var toCsv=require(_0x3c9b('0x11'));var querystring=require(_0x3c9b('0x12'));var Papa=require(_0x3c9b('0x13'));var Redis=require(_0x3c9b('0x14'));var authService=require(_0x3c9b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x3c9b('0x16'));var hardwareService=require(_0x3c9b('0x17'));var logger=require(_0x3c9b('0x18'))(_0x3c9b('0x19'));var utils=require(_0x3c9b('0x1a'));var config=require(_0x3c9b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c9b('0x1c'))['db'];function respondWithStatusCode(_0x33786a,_0x2755c1){_0x2755c1=_0x2755c1||0xcc;return function(_0x53ddf2){if(_0x53ddf2){return _0x33786a[_0x3c9b('0x1d')](_0x2755c1);}return _0x33786a['status'](_0x2755c1)[_0x3c9b('0x1e')]();};}function respondWithResult(_0x1aaaf9,_0x3448d6){_0x3448d6=_0x3448d6||0xc8;return function(_0x42c690){if(_0x42c690){return _0x1aaaf9[_0x3c9b('0x1f')](_0x3448d6)['json'](_0x42c690);}};}function respondWithFilteredResult(_0xec52c2,_0xfd48b8){return function(_0x26da30){if(_0x26da30){var _0x2182d4=typeof _0xfd48b8[_0x3c9b('0x20')]===_0x3c9b('0x21')&&typeof _0xfd48b8['limit']===_0x3c9b('0x21');var _0x5f5b7a=_0x26da30[_0x3c9b('0x22')];var _0x10043e=_0x2182d4?0x0:_0xfd48b8[_0x3c9b('0x20')];var _0x54073e=_0x2182d4?_0x26da30[_0x3c9b('0x22')]:_0xfd48b8[_0x3c9b('0x20')]+_0xfd48b8[_0x3c9b('0x23')];var _0x517726;if(_0x54073e>=_0x5f5b7a){_0x54073e=_0x5f5b7a;_0x517726=0xc8;}else{_0x517726=0xce;}_0xec52c2[_0x3c9b('0x1f')](_0x517726);return _0xec52c2[_0x3c9b('0x24')](_0x3c9b('0x25'),_0x10043e+'-'+_0x54073e+'/'+_0x5f5b7a)[_0x3c9b('0x26')](_0x26da30);}return null;};}function patchUpdates(_0x1a0284){return function(_0x40541d){try{jsonpatch[_0x3c9b('0x27')](_0x40541d,_0x1a0284,!![]);}catch(_0x2bc159){return BPromise[_0x3c9b('0x28')](_0x2bc159);}return _0x40541d[_0x3c9b('0x29')]();};}function saveUpdates(_0x4a1cb6,_0x245bff){return function(_0x43b9f9){if(_0x43b9f9){return _0x43b9f9['update'](_0x4a1cb6)['then'](function(_0x563793){return _0x563793;});}return null;};}function removeEntity(_0x24857b,_0x5eeb84){return function(_0x1c8f5d){if(_0x1c8f5d){return _0x1c8f5d[_0x3c9b('0x2a')]()['then'](function(){var _0x422a97=_0x1c8f5d[_0x3c9b('0x2b')]({'plain':!![]});var _0x13d0c5='Scheduler';return db['UserProfileResource'][_0x3c9b('0x2a')]({'where':{'type':_0x13d0c5,'resourceId':_0x422a97['id']}})[_0x3c9b('0x2c')](function(){return _0x1c8f5d;});})['then'](function(){_0x24857b[_0x3c9b('0x1f')](0xcc)[_0x3c9b('0x1e')]();});}};}function handleEntityNotFound(_0x269416,_0x36369f){return function(_0x3d8a50){if(!_0x3d8a50){_0x269416[_0x3c9b('0x1d')](0x194);}return _0x3d8a50;};}function handleError(_0x42fba3,_0x2a6d96){_0x2a6d96=_0x2a6d96||0x1f4;return function(_0x21f5ba){logger[_0x3c9b('0x2d')](_0x21f5ba[_0x3c9b('0x2e')]);if(_0x21f5ba[_0x3c9b('0x2f')]){delete _0x21f5ba[_0x3c9b('0x2f')];}_0x42fba3[_0x3c9b('0x1f')](_0x2a6d96)[_0x3c9b('0x30')](_0x21f5ba);};}exports['index']=function(_0x3409ad,_0x5378c9){var _0x3a0f76={},_0xb7709c={},_0x1affce={'count':0x0,'rows':[]};var _0x501a4b=_['map'](db[_0x3c9b('0x31')][_0x3c9b('0x32')],function(_0x3c3248){return{'name':_0x3c3248[_0x3c9b('0x33')],'type':_0x3c3248[_0x3c9b('0x34')][_0x3c9b('0x35')]};});_0xb7709c[_0x3c9b('0x36')]=_[_0x3c9b('0x37')](_0x501a4b,_0x3c9b('0x2f'));_0xb7709c['query']=_['keys'](_0x3409ad['query']);_0xb7709c[_0x3c9b('0x38')]=_[_0x3c9b('0x39')](_0xb7709c[_0x3c9b('0x36')],_0xb7709c['query']);_0x3a0f76['attributes']=_[_0x3c9b('0x39')](_0xb7709c['model'],qs['fields'](_0x3409ad['query'][_0x3c9b('0x3a')]));_0x3a0f76[_0x3c9b('0x3b')]=_0x3a0f76['attributes'][_0x3c9b('0x3c')]?_0x3a0f76[_0x3c9b('0x3b')]:_0xb7709c['model'];if(!_0x3409ad[_0x3c9b('0x3d')][_0x3c9b('0x3e')](_0x3c9b('0x3f'))){_0x3a0f76[_0x3c9b('0x23')]=qs[_0x3c9b('0x23')](_0x3409ad[_0x3c9b('0x3d')][_0x3c9b('0x23')]);_0x3a0f76[_0x3c9b('0x20')]=qs[_0x3c9b('0x20')](_0x3409ad[_0x3c9b('0x3d')][_0x3c9b('0x20')]);}_0x3a0f76[_0x3c9b('0x40')]=qs[_0x3c9b('0x41')](_0x3409ad[_0x3c9b('0x3d')]['sort']);_0x3a0f76['where']=qs[_0x3c9b('0x38')](_[_0x3c9b('0x42')](_0x3409ad[_0x3c9b('0x3d')],_0xb7709c[_0x3c9b('0x38')]),_0x501a4b);if(_0x3409ad['query'][_0x3c9b('0x43')]){_0x3a0f76[_0x3c9b('0x44')]=_[_0x3c9b('0x45')](_0x3a0f76[_0x3c9b('0x44')],{'$or':_[_0x3c9b('0x37')](_0x501a4b,function(_0x4a0551){if(_0x4a0551[_0x3c9b('0x34')]!=='VIRTUAL'){var _0x201473={};_0x201473[_0x4a0551[_0x3c9b('0x2f')]]={'$like':'%'+_0x3409ad[_0x3c9b('0x3d')]['filter']+'%'};return _0x201473;}})});}_0x3a0f76=_[_0x3c9b('0x45')]({},_0x3a0f76,_0x3409ad[_0x3c9b('0x46')]);var _0x149895={'where':_0x3a0f76[_0x3c9b('0x44')]};return db[_0x3c9b('0x31')][_0x3c9b('0x22')](_0x149895)[_0x3c9b('0x2c')](function(_0x4469f4){_0x1affce[_0x3c9b('0x22')]=_0x4469f4;if(_0x3409ad[_0x3c9b('0x3d')][_0x3c9b('0x47')]){_0x3a0f76[_0x3c9b('0x48')]=[{'all':!![]}];}return db['Schedule'][_0x3c9b('0x49')](_0x3a0f76);})['then'](function(_0x3b064f){_0x1affce['rows']=_0x3b064f;return _0x1affce;})[_0x3c9b('0x2c')](respondWithFilteredResult(_0x5378c9,_0x3a0f76))['catch'](handleError(_0x5378c9,null));};exports['show']=function(_0xa0dbcf,_0xfb8d03){var _0x6f1445={'raw':![],'where':{'id':_0xa0dbcf[_0x3c9b('0x4a')]['id']}},_0x292fe6={};_0x292fe6[_0x3c9b('0x36')]=_['keys'](db[_0x3c9b('0x31')][_0x3c9b('0x32')]);_0x292fe6[_0x3c9b('0x3d')]=_[_0x3c9b('0x4b')](_0xa0dbcf['query']);_0x292fe6[_0x3c9b('0x38')]=_[_0x3c9b('0x39')](_0x292fe6[_0x3c9b('0x36')],_0x292fe6[_0x3c9b('0x3d')]);_0x6f1445[_0x3c9b('0x3b')]=_[_0x3c9b('0x39')](_0x292fe6['model'],qs['fields'](_0xa0dbcf[_0x3c9b('0x3d')][_0x3c9b('0x3a')]));_0x6f1445['attributes']=_0x6f1445[_0x3c9b('0x3b')][_0x3c9b('0x3c')]?_0x6f1445[_0x3c9b('0x3b')]:_0x292fe6[_0x3c9b('0x36')];if(_0xa0dbcf[_0x3c9b('0x3d')][_0x3c9b('0x47')]){_0x6f1445[_0x3c9b('0x48')]=[{'all':!![]}];}_0x6f1445=_[_0x3c9b('0x45')]({},_0x6f1445,_0xa0dbcf['options']);return db[_0x3c9b('0x31')][_0x3c9b('0x4c')](_0x6f1445)['then'](handleEntityNotFound(_0xfb8d03,null))[_0x3c9b('0x2c')](respondWithResult(_0xfb8d03,null))['catch'](handleError(_0xfb8d03,null));};exports['create']=function(_0xc2c863,_0x53161f){return db[_0x3c9b('0x31')]['create'](_0xc2c863['body'],{})[_0x3c9b('0x2c')](function(_0x1b66f3){var _0x4caed1=_0xc2c863[_0x3c9b('0x4d')][_0x3c9b('0x2b')]({'plain':!![]});if(!_0x4caed1)throw new Error(_0x3c9b('0x4e'));if(_0x4caed1['role']===_0x3c9b('0x4d')){var _0xb49495=_0x1b66f3[_0x3c9b('0x2b')]({'plain':!![]});var _0x385be3=_0x3c9b('0x4f');return db[_0x3c9b('0x50')][_0x3c9b('0x4c')]({'where':{'name':_0x385be3,'userProfileId':_0x4caed1[_0x3c9b('0x51')]},'raw':!![]})[_0x3c9b('0x2c')](function(_0x43e6b0){if(_0x43e6b0&&_0x43e6b0[_0x3c9b('0x52')]===0x0){return db[_0x3c9b('0x53')][_0x3c9b('0x54')]({'name':_0xb49495[_0x3c9b('0x2f')],'resourceId':_0xb49495['id'],'type':_0x43e6b0[_0x3c9b('0x2f')],'sectionId':_0x43e6b0['id']},{})[_0x3c9b('0x2c')](function(){return _0x1b66f3;});}else{return _0x1b66f3;}})[_0x3c9b('0x55')](function(_0x3b8c3d){logger[_0x3c9b('0x2d')](_0x3c9b('0x56'),_0x3b8c3d);throw _0x3b8c3d;});}return _0x1b66f3;})[_0x3c9b('0x2c')](respondWithResult(_0x53161f,0xc9))[_0x3c9b('0x55')](handleError(_0x53161f,null));};exports[_0x3c9b('0x57')]=function(_0x300242,_0x562363){if(_0x300242[_0x3c9b('0x58')]['id']){delete _0x300242[_0x3c9b('0x58')]['id'];}return db['Schedule'][_0x3c9b('0x4c')]({'where':{'id':_0x300242['params']['id']}})[_0x3c9b('0x2c')](handleEntityNotFound(_0x562363,null))[_0x3c9b('0x2c')](saveUpdates(_0x300242[_0x3c9b('0x58')],null))[_0x3c9b('0x2c')](respondWithResult(_0x562363,null))[_0x3c9b('0x55')](handleError(_0x562363,null));};exports['destroy']=function(_0x472056,_0x24c2b3){return db[_0x3c9b('0x31')][_0x3c9b('0x4c')]({'where':{'id':_0x472056['params']['id']}})[_0x3c9b('0x2c')](handleEntityNotFound(_0x24c2b3,null))[_0x3c9b('0x2c')](removeEntity(_0x24c2b3,null))[_0x3c9b('0x55')](handleError(_0x24c2b3,null));};exports['run']=function(_0x1c1bd6,_0x264d5b,_0x263685){var _0x1ede0e=require(_0x3c9b('0x59'));return db[_0x3c9b('0x31')]['find']({'where':{'id':_0x1c1bd6['params']['id']},'raw':!![]})[_0x3c9b('0x2c')](handleEntityNotFound(_0x264d5b,null))[_0x3c9b('0x2c')](function(){_0x1ede0e[_0x3c9b('0x5a')](_0x1c1bd6[_0x3c9b('0x4a')]['id']);})[_0x3c9b('0x2c')](respondWithStatusCode(_0x264d5b,null))['catch'](handleError(_0x264d5b,null));};
\ No newline at end of file
+var _0xfed0=['bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','save','then','destroy','get','end','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','keys','intersection','attributes','fields','query','length','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','filters','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x38b5db,_0x9555ee){var _0x43bee1=function(_0x2afb12){while(--_0x2afb12){_0x38b5db['push'](_0x38b5db['shift']());}};_0x43bee1(++_0x9555ee);}(_0xfed0,0xeb));var _0x0fed=function(_0x14dfef,_0x1594ef){_0x14dfef=_0x14dfef-0x0;var _0x454ed6=_0xfed0[_0x14dfef];return _0x454ed6;};'use strict';var emlformat=require(_0x0fed('0x0'));var rimraf=require(_0x0fed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fed('0x2'));var rp=require(_0x0fed('0x3'));var moment=require(_0x0fed('0x4'));var BPromise=require(_0x0fed('0x5'));var Mustache=require('mustache');var util=require(_0x0fed('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0fed('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fed('0x8'));var squel=require(_0x0fed('0x9'));var crypto=require('crypto');var jsforce=require(_0x0fed('0xa'));var deskjs=require(_0x0fed('0xb'));var toCsv=require(_0x0fed('0xc'));var querystring=require('querystring');var Papa=require(_0x0fed('0xd'));var Redis=require(_0x0fed('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0fed('0xf'));var as=require(_0x0fed('0x10'));var hardwareService=require(_0x0fed('0x11'));var logger=require('../../config/logger')(_0x0fed('0x12'));var utils=require(_0x0fed('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0fed('0x14'));var db=require(_0x0fed('0x15'))['db'];function respondWithStatusCode(_0x3151d5,_0x154b48){_0x154b48=_0x154b48||0xcc;return function(_0x451ca5){if(_0x451ca5){return _0x3151d5[_0x0fed('0x16')](_0x154b48);}return _0x3151d5[_0x0fed('0x17')](_0x154b48)['end']();};}function respondWithResult(_0x7f1b12,_0x3c997e){_0x3c997e=_0x3c997e||0xc8;return function(_0x193e2f){if(_0x193e2f){return _0x7f1b12['status'](_0x3c997e)[_0x0fed('0x18')](_0x193e2f);}};}function respondWithFilteredResult(_0x3e1ba3,_0x370584){return function(_0x15dc32){if(_0x15dc32){var _0x339e1d=typeof _0x370584[_0x0fed('0x19')]===_0x0fed('0x1a')&&typeof _0x370584[_0x0fed('0x1b')]===_0x0fed('0x1a');var _0x5300f0=_0x15dc32[_0x0fed('0x1c')];var _0x3fe0fa=_0x339e1d?0x0:_0x370584[_0x0fed('0x19')];var _0x7b21f8=_0x339e1d?_0x15dc32[_0x0fed('0x1c')]:_0x370584[_0x0fed('0x19')]+_0x370584[_0x0fed('0x1b')];var _0x306eee;if(_0x7b21f8>=_0x5300f0){_0x7b21f8=_0x5300f0;_0x306eee=0xc8;}else{_0x306eee=0xce;}_0x3e1ba3[_0x0fed('0x17')](_0x306eee);return _0x3e1ba3['set']('Content-Range',_0x3fe0fa+'-'+_0x7b21f8+'/'+_0x5300f0)['json'](_0x15dc32);}return null;};}function patchUpdates(_0x5d520f){return function(_0x10cb8c){try{jsonpatch['apply'](_0x10cb8c,_0x5d520f,!![]);}catch(_0x1652be){return BPromise[_0x0fed('0x1d')](_0x1652be);}return _0x10cb8c[_0x0fed('0x1e')]();};}function saveUpdates(_0x2d2fe2,_0x1d5cd0){return function(_0x245b74){if(_0x245b74){return _0x245b74['update'](_0x2d2fe2)[_0x0fed('0x1f')](function(_0x24fe3c){return _0x24fe3c;});}return null;};}function removeEntity(_0xdb41ec,_0x1552d7){return function(_0x478ed9){if(_0x478ed9){return _0x478ed9[_0x0fed('0x20')]()['then'](function(){var _0x1c395f=_0x478ed9[_0x0fed('0x21')]({'plain':!![]});var _0x588a5a='Scheduler';return db['UserProfileResource'][_0x0fed('0x20')]({'where':{'type':_0x588a5a,'resourceId':_0x1c395f['id']}})[_0x0fed('0x1f')](function(){return _0x478ed9;});})[_0x0fed('0x1f')](function(){_0xdb41ec[_0x0fed('0x17')](0xcc)[_0x0fed('0x22')]();});}};}function handleEntityNotFound(_0x65ca53,_0x27e0ca){return function(_0x20d369){if(!_0x20d369){_0x65ca53[_0x0fed('0x16')](0x194);}return _0x20d369;};}function handleError(_0x2e01ad,_0x1d4d9d){_0x1d4d9d=_0x1d4d9d||0x1f4;return function(_0x30b428){logger['error'](_0x30b428[_0x0fed('0x23')]);if(_0x30b428[_0x0fed('0x24')]){delete _0x30b428[_0x0fed('0x24')];}_0x2e01ad[_0x0fed('0x17')](_0x1d4d9d)[_0x0fed('0x25')](_0x30b428);};}exports[_0x0fed('0x26')]=function(_0x52a441,_0x4fb474){var _0x360ddc={},_0x271066={},_0x383039={'count':0x0,'rows':[]};var _0xa8c13d=_[_0x0fed('0x27')](db[_0x0fed('0x28')][_0x0fed('0x29')],function(_0x293177){return{'name':_0x293177[_0x0fed('0x2a')],'type':_0x293177[_0x0fed('0x2b')]['key']};});_0x271066[_0x0fed('0x2c')]=_['map'](_0xa8c13d,_0x0fed('0x24'));_0x271066['query']=_[_0x0fed('0x2d')](_0x52a441['query']);_0x271066['filters']=_[_0x0fed('0x2e')](_0x271066[_0x0fed('0x2c')],_0x271066['query']);_0x360ddc[_0x0fed('0x2f')]=_[_0x0fed('0x2e')](_0x271066[_0x0fed('0x2c')],qs[_0x0fed('0x30')](_0x52a441[_0x0fed('0x31')][_0x0fed('0x30')]));_0x360ddc[_0x0fed('0x2f')]=_0x360ddc[_0x0fed('0x2f')][_0x0fed('0x32')]?_0x360ddc[_0x0fed('0x2f')]:_0x271066[_0x0fed('0x2c')];if(!_0x52a441['query']['hasOwnProperty'](_0x0fed('0x33'))){_0x360ddc[_0x0fed('0x1b')]=qs[_0x0fed('0x1b')](_0x52a441[_0x0fed('0x31')][_0x0fed('0x1b')]);_0x360ddc[_0x0fed('0x19')]=qs['offset'](_0x52a441['query'][_0x0fed('0x19')]);}_0x360ddc[_0x0fed('0x34')]=qs['sort'](_0x52a441[_0x0fed('0x31')][_0x0fed('0x35')]);_0x360ddc[_0x0fed('0x36')]=qs['filters'](_[_0x0fed('0x37')](_0x52a441[_0x0fed('0x31')],_0x271066['filters']),_0xa8c13d);if(_0x52a441[_0x0fed('0x31')]['filter']){_0x360ddc[_0x0fed('0x36')]=_[_0x0fed('0x38')](_0x360ddc[_0x0fed('0x36')],{'$or':_[_0x0fed('0x27')](_0xa8c13d,function(_0x3f7b7d){if(_0x3f7b7d[_0x0fed('0x2b')]!=='VIRTUAL'){var _0x351a8f={};_0x351a8f[_0x3f7b7d[_0x0fed('0x24')]]={'$like':'%'+_0x52a441[_0x0fed('0x31')][_0x0fed('0x39')]+'%'};return _0x351a8f;}})});}_0x360ddc=_[_0x0fed('0x38')]({},_0x360ddc,_0x52a441[_0x0fed('0x3a')]);var _0x32f651={'where':_0x360ddc[_0x0fed('0x36')]};return db[_0x0fed('0x28')][_0x0fed('0x1c')](_0x32f651)['then'](function(_0x55d4d5){_0x383039[_0x0fed('0x1c')]=_0x55d4d5;if(_0x52a441['query']['includeAll']){_0x360ddc[_0x0fed('0x3b')]=[{'all':!![]}];}return db['Schedule'][_0x0fed('0x3c')](_0x360ddc);})['then'](function(_0x3b8164){_0x383039[_0x0fed('0x3d')]=_0x3b8164;return _0x383039;})['then'](respondWithFilteredResult(_0x4fb474,_0x360ddc))[_0x0fed('0x3e')](handleError(_0x4fb474,null));};exports[_0x0fed('0x3f')]=function(_0x23beb3,_0x27d95e){var _0x228258={'raw':![],'where':{'id':_0x23beb3[_0x0fed('0x40')]['id']}},_0x565cc2={};_0x565cc2['model']=_[_0x0fed('0x2d')](db[_0x0fed('0x28')][_0x0fed('0x29')]);_0x565cc2[_0x0fed('0x31')]=_[_0x0fed('0x2d')](_0x23beb3[_0x0fed('0x31')]);_0x565cc2[_0x0fed('0x41')]=_[_0x0fed('0x2e')](_0x565cc2[_0x0fed('0x2c')],_0x565cc2[_0x0fed('0x31')]);_0x228258['attributes']=_['intersection'](_0x565cc2[_0x0fed('0x2c')],qs[_0x0fed('0x30')](_0x23beb3['query']['fields']));_0x228258[_0x0fed('0x2f')]=_0x228258[_0x0fed('0x2f')][_0x0fed('0x32')]?_0x228258[_0x0fed('0x2f')]:_0x565cc2[_0x0fed('0x2c')];if(_0x23beb3[_0x0fed('0x31')][_0x0fed('0x42')]){_0x228258[_0x0fed('0x3b')]=[{'all':!![]}];}_0x228258=_[_0x0fed('0x38')]({},_0x228258,_0x23beb3[_0x0fed('0x3a')]);return db[_0x0fed('0x28')][_0x0fed('0x43')](_0x228258)[_0x0fed('0x1f')](handleEntityNotFound(_0x27d95e,null))['then'](respondWithResult(_0x27d95e,null))['catch'](handleError(_0x27d95e,null));};exports[_0x0fed('0x44')]=function(_0x5775da,_0x182d99){return db[_0x0fed('0x28')]['create'](_0x5775da[_0x0fed('0x45')],{})[_0x0fed('0x1f')](function(_0x33ec09){var _0x5817cc=_0x5775da[_0x0fed('0x46')][_0x0fed('0x21')]({'plain':!![]});if(!_0x5817cc)throw new Error(_0x0fed('0x47'));if(_0x5817cc[_0x0fed('0x48')]===_0x0fed('0x46')){var _0x1678b0=_0x33ec09[_0x0fed('0x21')]({'plain':!![]});var _0x54f83f='Scheduler';return db['UserProfileSection'][_0x0fed('0x43')]({'where':{'name':_0x54f83f,'userProfileId':_0x5817cc[_0x0fed('0x49')]},'raw':!![]})[_0x0fed('0x1f')](function(_0x5f1139){if(_0x5f1139&&_0x5f1139[_0x0fed('0x4a')]===0x0){return db[_0x0fed('0x4b')][_0x0fed('0x44')]({'name':_0x1678b0[_0x0fed('0x24')],'resourceId':_0x1678b0['id'],'type':_0x5f1139[_0x0fed('0x24')],'sectionId':_0x5f1139['id']},{})['then'](function(){return _0x33ec09;});}else{return _0x33ec09;}})[_0x0fed('0x3e')](function(_0x451579){logger[_0x0fed('0x4c')](_0x0fed('0x4d'),_0x451579);throw _0x451579;});}return _0x33ec09;})['then'](respondWithResult(_0x182d99,0xc9))['catch'](handleError(_0x182d99,null));};exports[_0x0fed('0x4e')]=function(_0xa1bea3,_0x294a9a){if(_0xa1bea3[_0x0fed('0x45')]['id']){delete _0xa1bea3[_0x0fed('0x45')]['id'];}return db[_0x0fed('0x28')][_0x0fed('0x43')]({'where':{'id':_0xa1bea3['params']['id']}})[_0x0fed('0x1f')](handleEntityNotFound(_0x294a9a,null))['then'](saveUpdates(_0xa1bea3['body'],null))[_0x0fed('0x1f')](respondWithResult(_0x294a9a,null))['catch'](handleError(_0x294a9a,null));};exports['destroy']=function(_0x468b3c,_0x476f8c){return db[_0x0fed('0x28')]['find']({'where':{'id':_0x468b3c[_0x0fed('0x40')]['id']}})[_0x0fed('0x1f')](handleEntityNotFound(_0x476f8c,null))['then'](removeEntity(_0x476f8c,null))[_0x0fed('0x3e')](handleError(_0x476f8c,null));};exports[_0x0fed('0x4f')]=function(_0x39e3da,_0x10c21c,_0x477977){var _0x1fc5c7=require('../../config/schedule');return db['Schedule'][_0x0fed('0x43')]({'where':{'id':_0x39e3da[_0x0fed('0x40')]['id']},'raw':!![]})[_0x0fed('0x1f')](handleEntityNotFound(_0x10c21c,null))[_0x0fed('0x1f')](function(){_0x1fc5c7['run'](_0x39e3da[_0x0fed('0x40')]['id']);})[_0x0fed('0x1f')](respondWithStatusCode(_0x10c21c,null))[_0x0fed('0x3e')](handleError(_0x10c21c,null));};
\ No newline at end of file
index 1abe094..9a33ed8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc9b=['path','exports','define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe99eb1,_0x2ce0db){var _0xd4f51a=function(_0x51a644){while(--_0x51a644){_0xe99eb1['push'](_0xe99eb1['shift']());}};_0xd4f51a(++_0x2ce0db);}(_0xbc9b,0xe1));var _0xbbc9=function(_0x4d87cb,_0x2991e6){_0x4d87cb=_0x4d87cb-0x0;var _0xdac206=_0xbc9b[_0x4d87cb];return _0xdac206;};'use strict';var _=require('lodash');var util=require(_0xbbc9('0x0'));var logger=require(_0xbbc9('0x1'))(_0xbbc9('0x2'));var moment=require(_0xbbc9('0x3'));var BPromise=require(_0xbbc9('0x4'));var rp=require(_0xbbc9('0x5'));var fs=require('fs');var path=require(_0xbbc9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xbbc9('0x7')]=function(_0x4dff2e,_0x4982d2){return _0x4dff2e[_0xbbc9('0x8')](_0xbbc9('0x9'),attributes,{'tableName':_0xbbc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0ee9=['tools_schedules','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule'];(function(_0x1d5458,_0x3acf09){var _0x9bf6f=function(_0x8d948c){while(--_0x8d948c){_0x1d5458['push'](_0x1d5458['shift']());}};_0x9bf6f(++_0x3acf09);}(_0x0ee9,0x139));var _0x90ee=function(_0x2b3893,_0x12d9fc){_0x2b3893=_0x2b3893-0x0;var _0xe49e58=_0x0ee9[_0x2b3893];return _0xe49e58;};'use strict';var _=require(_0x90ee('0x0'));var util=require(_0x90ee('0x1'));var logger=require('../../config/logger')(_0x90ee('0x2'));var moment=require('moment');var BPromise=require(_0x90ee('0x3'));var rp=require(_0x90ee('0x4'));var fs=require('fs');var path=require(_0x90ee('0x5'));var rimraf=require(_0x90ee('0x6'));var config=require(_0x90ee('0x7'));var attributes=require(_0x90ee('0x8'));module[_0x90ee('0x9')]=function(_0x3906b3,_0x440cc0){return _0x3906b3[_0x90ee('0xa')](_0x90ee('0xb'),attributes,{'tableName':_0x90ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 335b476..a5456c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a67=['stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x4a67,0x10e));var _0x74a6=function(_0x434f39,_0x219e13){_0x434f39=_0x434f39-0x0;var _0x1b2718=_0x4a67[_0x434f39];return _0x1b2718;};'use strict';var _=require(_0x74a6('0x0'));var util=require(_0x74a6('0x1'));var moment=require(_0x74a6('0x2'));var BPromise=require(_0x74a6('0x3'));var rs=require(_0x74a6('0x4'));var fs=require('fs');var Redis=require(_0x74a6('0x5'));var db=require(_0x74a6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74a6('0x8'));var client=jayson[_0x74a6('0x9')][_0x74a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fde1,_0x55d0c2,_0x5cdd03){return new BPromise(function(_0x25ddbc,_0xcce59e){return client['request'](_0x44fde1,_0x5cdd03)[_0x74a6('0xb')](function(_0x51a2ed){logger[_0x74a6('0xc')]('Schedule,\x20%s,\x20%s',_0x55d0c2,'request\x20sent');logger[_0x74a6('0xd')](_0x74a6('0xe'),_0x55d0c2,_0x74a6('0xf'),JSON[_0x74a6('0x10')](_0x51a2ed));if(_0x51a2ed[_0x74a6('0x11')]){if(_0x51a2ed[_0x74a6('0x11')]['code']===0x1f4){logger[_0x74a6('0x11')](_0x74a6('0x12'),_0x55d0c2,_0x51a2ed['error'][_0x74a6('0x13')]);return _0xcce59e(_0x51a2ed[_0x74a6('0x11')][_0x74a6('0x13')]);}logger[_0x74a6('0x11')](_0x74a6('0x12'),_0x55d0c2,_0x51a2ed[_0x74a6('0x11')][_0x74a6('0x13')]);return _0x25ddbc(_0x51a2ed['error'][_0x74a6('0x13')]);}else{logger[_0x74a6('0xc')]('Schedule,\x20%s,\x20%s',_0x55d0c2,_0x74a6('0xf'));_0x25ddbc(_0x51a2ed[_0x74a6('0x14')][_0x74a6('0x13')]);}})[_0x74a6('0x15')](function(_0x491f03){logger[_0x74a6('0x11')](_0x74a6('0x12'),_0x55d0c2,_0x491f03);_0xcce59e(_0x491f03);});});}
\ No newline at end of file
+var _0x493c=['rpc','../../config/environment','jayson/promise','request','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xa4dc1a,_0x357ff0){var _0x23518e=function(_0x4ddd94){while(--_0x4ddd94){_0xa4dc1a['push'](_0xa4dc1a['shift']());}};_0x23518e(++_0x357ff0);}(_0x493c,0xe9));var _0xc493=function(_0xb0a484,_0x1cbb4f){_0xb0a484=_0xb0a484-0x0;var _0x3f464d=_0x493c[_0xb0a484];return _0x3f464d;};'use strict';var _=require(_0xc493('0x0'));var util=require('util');var moment=require(_0xc493('0x1'));var BPromise=require(_0xc493('0x2'));var rs=require(_0xc493('0x3'));var fs=require('fs');var Redis=require(_0xc493('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc493('0x5'));var logger=require(_0xc493('0x6'))(_0xc493('0x7'));var config=require(_0xc493('0x8'));var jayson=require(_0xc493('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x156cb9,_0x6645ec,_0x2c4c30){return new BPromise(function(_0xa0d6db,_0x1fb113){return client[_0xc493('0xa')](_0x156cb9,_0x2c4c30)[_0xc493('0xb')](function(_0xfaf559){logger['info'](_0xc493('0xc'),_0x6645ec,_0xc493('0xd'));logger['debug'](_0xc493('0xe'),_0x6645ec,'request\x20sent',JSON[_0xc493('0xf')](_0xfaf559));if(_0xfaf559[_0xc493('0x10')]){if(_0xfaf559['error'][_0xc493('0x11')]===0x1f4){logger[_0xc493('0x10')](_0xc493('0xc'),_0x6645ec,_0xfaf559['error'][_0xc493('0x12')]);return _0x1fb113(_0xfaf559[_0xc493('0x10')][_0xc493('0x12')]);}logger[_0xc493('0x10')](_0xc493('0xc'),_0x6645ec,_0xfaf559[_0xc493('0x10')][_0xc493('0x12')]);return _0xa0d6db(_0xfaf559[_0xc493('0x10')][_0xc493('0x12')]);}else{logger['info'](_0xc493('0xc'),_0x6645ec,'request\x20sent');_0xa0d6db(_0xfaf559[_0xc493('0x13')][_0xc493('0x12')]);}})['catch'](function(_0x20c6e7){logger[_0xc493('0x10')](_0xc493('0xc'),_0x6645ec,_0x20c6e7);_0x1fb113(_0x20c6e7);});});}
\ No newline at end of file
index 2b166ea..8dc8553 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4225=['exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe','/:id','/:id/download','isAuthenticated','download','post','create','update','destroy'];(function(_0x1ca838,_0xf482b2){var _0x1cd108=function(_0x361601){while(--_0x361601){_0x1ca838['push'](_0x1ca838['shift']());}};_0x1cd108(++_0xf482b2);}(_0x4225,0xfd));var _0x5422=function(_0x822bcc,_0x29d5e1){_0x822bcc=_0x822bcc-0x0;var _0x440a75=_0x4225[_0x822bcc];return _0x440a75;};'use strict';var multer=require(_0x5422('0x0'));var util=require(_0x5422('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5422('0x2')]();var fs_extra=require(_0x5422('0x3'));var auth=require(_0x5422('0x4'));var interaction=require(_0x5422('0x5'));var config=require(_0x5422('0x6'));var controller=require(_0x5422('0x7'));router[_0x5422('0x8')]('/',auth['isAuthenticated'](),controller[_0x5422('0x9')]);router[_0x5422('0x8')](_0x5422('0xa'),auth['isAuthenticated'](),controller[_0x5422('0xb')]);router[_0x5422('0x8')](_0x5422('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5422('0x8')](_0x5422('0xd'),auth[_0x5422('0xe')](),controller[_0x5422('0xf')]);router[_0x5422('0x10')]('/',auth[_0x5422('0xe')](),controller[_0x5422('0x11')]);router['put'](_0x5422('0xc'),auth[_0x5422('0xe')](),controller[_0x5422('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5422('0x13')]);module[_0x5422('0x14')]=router;
\ No newline at end of file
+var _0xc179=['isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe'];(function(_0x40d683,_0x43a7c7){var _0x17daf6=function(_0x3b2681){while(--_0x3b2681){_0x40d683['push'](_0x40d683['shift']());}};_0x17daf6(++_0x43a7c7);}(_0xc179,0xa2));var _0x9c17=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xc179[_0x487ab4];return _0x3bef77;};'use strict';var multer=require(_0x9c17('0x0'));var util=require(_0x9c17('0x1'));var path=require(_0x9c17('0x2'));var timeout=require(_0x9c17('0x3'));var express=require('express');var router=express[_0x9c17('0x4')]();var fs_extra=require(_0x9c17('0x5'));var auth=require(_0x9c17('0x6'));var interaction=require(_0x9c17('0x7'));var config=require(_0x9c17('0x8'));var controller=require(_0x9c17('0x9'));router[_0x9c17('0xa')]('/',auth['isAuthenticated'](),controller[_0x9c17('0xb')]);router[_0x9c17('0xa')](_0x9c17('0xc'),auth[_0x9c17('0xd')](),controller['describe']);router['get'](_0x9c17('0xe'),auth[_0x9c17('0xd')](),controller[_0x9c17('0xf')]);router['get'](_0x9c17('0x10'),auth[_0x9c17('0xd')](),controller[_0x9c17('0x11')]);router[_0x9c17('0x12')]('/',auth[_0x9c17('0xd')](),controller[_0x9c17('0x13')]);router[_0x9c17('0x14')]('/:id',auth[_0x9c17('0xd')](),controller[_0x9c17('0x15')]);router[_0x9c17('0x16')](_0x9c17('0xe'),auth[_0x9c17('0xd')](),controller[_0x9c17('0x17')]);module[_0x9c17('0x18')]=router;
\ No newline at end of file
index 15631ce..438fd8c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b0d=['extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','moment','path','../../config/environment','exports','getDataValue','value'];(function(_0x1bcd6f,_0x22aaf8){var _0x502397=function(_0x3e2cd0){while(--_0x3e2cd0){_0x1bcd6f['push'](_0x1bcd6f['shift']());}};_0x502397(++_0x22aaf8);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x36066e,_0x5b8e59){_0x36066e=_0x36066e-0x0;var _0x46ea88=_0x9b0d[_0x36066e];return _0x46ea88;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var config=require(_0xd9b0('0x2'));module[_0xd9b0('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd9b0('0x4')](_0xd9b0('0x5'))?path[_0xd9b0('0x6')](this[_0xd9b0('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xd9b0('0x7')]},'channel':{'type':Sequelize[_0xd9b0('0x7')]},'value':{'type':Sequelize[_0xd9b0('0x7')],'set':function(_0x31c012){var _0x58bd64=_0x31c012[_0xd9b0('0x8')](/\\/g,'/');this[_0xd9b0('0x9')]('value',_0x58bd64);}},'rating':{'type':Sequelize[_0xd9b0('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd9b0('0xa')],'set':function(_0x48181a){this[_0xd9b0('0x9')]('startedAt',moment()[_0xd9b0('0xb')](_0x48181a,'ms'));this['setDataValue'](_0xd9b0('0xc'),moment());this[_0xd9b0('0x9')](_0xd9b0('0xd'),_0x48181a);}},'startedAt':{'type':Sequelize[_0xd9b0('0xe')],'get':function(){return moment(this[_0xd9b0('0x4')](_0xd9b0('0xf')))['format'](_0xd9b0('0x10'))[_0xd9b0('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd9b0('0x4')](_0xd9b0('0xc')))[_0xd9b0('0x12')](_0xd9b0('0x10'))[_0xd9b0('0x11')]();}},'createdAt':{'type':Sequelize[_0xd9b0('0xe')],'get':function(){return moment(this['getDataValue'](_0xd9b0('0x13')))['format'](_0xd9b0('0x10'))[_0xd9b0('0x11')]();}},'updatedAt':{'type':Sequelize[_0xd9b0('0xe')],'get':function(){return moment(this[_0xd9b0('0x4')](_0xd9b0('0x14')))[_0xd9b0('0x12')](_0xd9b0('0x10'))['toString']();}}};
\ No newline at end of file
+var _0x5b6e=['setDataValue','INTEGER','subtract','duration','startedAt','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','createdAt','format','updatedAt','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','value','STRING','replace'];(function(_0x1920cf,_0x46bd86){var _0x43d99f=function(_0x3fc706){while(--_0x3fc706){_0x1920cf['push'](_0x1920cf['shift']());}};_0x43d99f(++_0x46bd86);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x484817,_0x27f1dd){_0x484817=_0x484817-0x0;var _0x233d86=_0x5b6e[_0x484817];return _0x233d86;};'use strict';var Sequelize=require(_0xe5b6('0x0'));var moment=require(_0xe5b6('0x1'));var path=require('path');var config=require(_0xe5b6('0x2'));module['exports']={'format':{'type':Sequelize[_0xe5b6('0x3')],'get':function(){return this[_0xe5b6('0x4')](_0xe5b6('0x5'))?path['extname'](this['getDataValue'](_0xe5b6('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xe5b6('0x6')]},'channel':{'type':Sequelize[_0xe5b6('0x6')]},'value':{'type':Sequelize[_0xe5b6('0x6')],'set':function(_0x554d53){var _0x17ec5f=_0x554d53[_0xe5b6('0x7')](/\\/g,'/');this[_0xe5b6('0x8')]('value',_0x17ec5f);}},'rating':{'type':Sequelize[_0xe5b6('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x3f908a){this[_0xe5b6('0x8')]('startedAt',moment()[_0xe5b6('0xa')](_0x3f908a,'ms'));this[_0xe5b6('0x8')]('closedAt',moment());this[_0xe5b6('0x8')](_0xe5b6('0xb'),_0x3f908a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe5b6('0x4')](_0xe5b6('0xc')))['format'](_0xe5b6('0xd'))[_0xe5b6('0xe')]();}},'closedAt':{'type':Sequelize[_0xe5b6('0xf')],'get':function(){return moment(this[_0xe5b6('0x4')](_0xe5b6('0x10')))['format'](_0xe5b6('0xd'))[_0xe5b6('0xe')]();}},'createdAt':{'type':Sequelize[_0xe5b6('0xf')],'get':function(){return moment(this[_0xe5b6('0x4')](_0xe5b6('0x11')))[_0xe5b6('0x12')](_0xe5b6('0xd'))[_0xe5b6('0xe')]();}},'updatedAt':{'type':Sequelize[_0xe5b6('0xf')],'get':function(){return moment(this[_0xe5b6('0x4')](_0xe5b6('0x13')))['format'](_0xe5b6('0xd'))['toString']();}}};
\ No newline at end of file
index 2dc5472..a8e10e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x45a376,_0x57e27a){var _0x5a9da3=function(_0x3fbca7){while(--_0x3fbca7){_0x45a376['push'](_0x45a376['shift']());}};_0x5a9da3(++_0x57e27a);}(_0x33c5,0xe6));var _0x533c=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x33c5[_0x1fa381];return _0x47eefe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));};
\ No newline at end of file
+var _0x81bd=['Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','duration','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','root','%s.cypher','existsSync','secrets','recording','join','server/files/screen_recordings'];(function(_0x4b52c4,_0x5e247e){var _0x59b0cb=function(_0x4eda76){while(--_0x4eda76){_0x4b52c4['push'](_0x4b52c4['shift']());}};_0x59b0cb(++_0x5e247e);}(_0x81bd,0x7c));var _0xd81b=function(_0xb8fd40,_0x23030a){_0xb8fd40=_0xb8fd40-0x0;var _0x46fcde=_0x81bd[_0xb8fd40];return _0x46fcde;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2ccedf,_0x1bf351){return function(_0x596389){if(!_0x596389){_0x2ccedf[_0xd81b('0x1b')](0x194);}return _0x596389;};}function handleError(_0x99dbc9,_0xe3637a){_0xe3637a=_0xe3637a||0x1f4;return function(_0x31b9fd){logger[_0xd81b('0x2a')](_0x31b9fd[_0xd81b('0x2b')]);if(_0x31b9fd[_0xd81b('0x2c')]){delete _0x31b9fd[_0xd81b('0x2c')];}_0x99dbc9[_0xd81b('0x1d')](_0xe3637a)['send'](_0x31b9fd);};}exports[_0xd81b('0x2d')]=function(_0x4e2eff,_0x5c8aee){var _0xb9ff9f={},_0x260310={},_0x5141e6={'count':0x0,'rows':[]};var _0x481454=_[_0xd81b('0x2e')](db[_0xd81b('0x2f')][_0xd81b('0x30')],function(_0x289f54){return{'name':_0x289f54[_0xd81b('0x31')],'type':_0x289f54[_0xd81b('0x32')]['key']};});_0x260310[_0xd81b('0x33')]=_[_0xd81b('0x34')](_['map'](_0x481454,'name'),[_0xd81b('0x35')]);_0x260310[_0xd81b('0x36')]=_['keys'](_0x4e2eff['query']);_0x260310['filters']=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],_0x260310[_0xd81b('0x36')]);_0xb9ff9f[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x4e2eff['query'][_0xd81b('0x39')]));_0xb9ff9f['attributes']=_0xb9ff9f[_0xd81b('0x38')][_0xd81b('0x3a')]?_0xb9ff9f[_0xd81b('0x38')]:_0x260310[_0xd81b('0x33')];if(!_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x3b')](_0xd81b('0x3c'))){_0xb9ff9f[_0xd81b('0x20')]=qs[_0xd81b('0x20')](_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x20')]);_0xb9ff9f[_0xd81b('0x22')]=qs[_0xd81b('0x22')](_0x4e2eff['query']['offset']);}_0xb9ff9f[_0xd81b('0x3d')]=qs[_0xd81b('0x3e')](_0x4e2eff[_0xd81b('0x36')]['sort']);_0xb9ff9f[_0xd81b('0x3f')]=qs[_0xd81b('0x40')](_['pick'](_0x4e2eff[_0xd81b('0x36')],_0x260310[_0xd81b('0x40')]),_0x481454);if(_0x4e2eff['query'][_0xd81b('0x41')]){_0xb9ff9f['where']=_[_0xd81b('0x42')](_0xb9ff9f[_0xd81b('0x3f')],{'$or':_[_0xd81b('0x2e')](_0x481454,function(_0x3f6deb){if(_0x3f6deb['type']!==_0xd81b('0x43')){var _0x3444d4={};_0x3444d4[_0x3f6deb[_0xd81b('0x2c')]]={'$like':'%'+_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x41')]+'%'};return _0x3444d4;}})});}_0xb9ff9f=_[_0xd81b('0x42')]({},_0xb9ff9f,_0x4e2eff[_0xd81b('0x44')]);var _0x532ada={'where':_0xb9ff9f[_0xd81b('0x3f')]};return db[_0xd81b('0x2f')][_0xd81b('0x21')](_0x532ada)['then'](function(_0x3bea7d){_0x5141e6[_0xd81b('0x21')]=_0x3bea7d;if(_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x45')]){_0xb9ff9f[_0xd81b('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd81b('0x47')](_0xb9ff9f);})[_0xd81b('0x28')](function(_0x448e24){_0x5141e6[_0xd81b('0x48')]=_0x448e24;return _0x5141e6;})[_0xd81b('0x28')](respondWithFilteredResult(_0x5c8aee,_0xb9ff9f))[_0xd81b('0x49')](handleError(_0x5c8aee,null));};exports[_0xd81b('0x4a')]=function(_0x486f0d,_0x4405a8){var _0x3ba339={'raw':![],'where':{'id':_0x486f0d['params']['id']}},_0x1e3690={};_0x1e3690[_0xd81b('0x33')]=_[_0xd81b('0x4b')](db[_0xd81b('0x2f')][_0xd81b('0x30')]);_0x1e3690[_0xd81b('0x36')]=_[_0xd81b('0x4b')](_0x486f0d[_0xd81b('0x36')]);_0x1e3690[_0xd81b('0x40')]=_['intersection'](_0x1e3690['model'],_0x1e3690[_0xd81b('0x36')]);_0x3ba339[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x1e3690[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x486f0d[_0xd81b('0x36')][_0xd81b('0x39')]));_0x3ba339[_0xd81b('0x38')]=_0x3ba339[_0xd81b('0x38')][_0xd81b('0x3a')]?_0x3ba339[_0xd81b('0x38')]:_0x1e3690[_0xd81b('0x33')];if(_0x486f0d['query'][_0xd81b('0x45')]){_0x3ba339[_0xd81b('0x46')]=[{'all':!![]}];}_0x3ba339=_[_0xd81b('0x42')]({},_0x3ba339,_0x486f0d[_0xd81b('0x44')]);return db[_0xd81b('0x2f')][_0xd81b('0x4c')](_0x3ba339)[_0xd81b('0x28')](handleEntityNotFound(_0x4405a8,null))[_0xd81b('0x28')](respondWithResult(_0x4405a8,null))[_0xd81b('0x49')](handleError(_0x4405a8,null));};exports['create']=function(_0xf401e0,_0x2368dd){return db[_0xd81b('0x2f')][_0xd81b('0x4d')](_0xf401e0['body'],{})[_0xd81b('0x28')](respondWithResult(_0x2368dd,0xc9))[_0xd81b('0x49')](handleError(_0x2368dd,null));};exports[_0xd81b('0x27')]=function(_0xe874b6,_0x2699e6){if(_0xe874b6[_0xd81b('0x4e')]['id']){delete _0xe874b6[_0xd81b('0x4e')]['id'];}delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x4f')];delete _0xe874b6['body']['createdAt'];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x50')];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x51')];return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0xe874b6[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2699e6,null))['then'](saveUpdates(_0xe874b6[_0xd81b('0x4e')],null))[_0xd81b('0x28')](respondWithResult(_0x2699e6,null))[_0xd81b('0x49')](handleError(_0x2699e6,null));};exports[_0xd81b('0x53')]=function(_0x4651d3,_0x59b13b){return db[_0xd81b('0x2f')][_0xd81b('0x53')]()['then'](respondWithResult(_0x59b13b,null))[_0xd81b('0x49')](handleError(_0x59b13b,null));};exports[_0xd81b('0x54')]=function(_0x100319,_0x3b7ed7,_0x21cd71){var _0xa366c8=require(_0xd81b('0x55'));var _0x22f588=![];var _0x3ed626={};if(_0x100319[_0xd81b('0x36')][_0xd81b('0x32')]&&_0x100319['query'][_0xd81b('0x32')]==='uniqueid'){_0x3ed626[_0xd81b('0x56')]=_0x100319[_0xd81b('0x52')]['id'];}else{_0x3ed626['id']=_0x100319[_0xd81b('0x52')]['id'];}return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':_0x3ed626,'attributes':['id',_0xd81b('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x3b7ed7,null))[_0xd81b('0x28')](function(_0xe0c9c6){if(_0xe0c9c6){var _0x51f5a1=path['join'](config[_0xd81b('0x57')],'server/files/screen_recordings',_0xe0c9c6[_0xd81b('0x51')]);var _0x51f066=util[_0xd81b('0x35')](_0xd81b('0x58'),_0x51f5a1);if(fs[_0xd81b('0x59')](_0x51f066)){_0x22f588=!![];return _0xa366c8['decryptFile'](_0x51f066,_0x51f5a1,config[_0xd81b('0x5a')][_0xd81b('0x5b')])['then'](function(){return _0xe0c9c6;});}return _0xe0c9c6;}})[_0xd81b('0x28')](function(_0x108aaf){if(_0x108aaf){var _0x5951ec=path[_0xd81b('0x5c')](config['root'],_0xd81b('0x5d'),_0x108aaf[_0xd81b('0x51')]);if(!fs[_0xd81b('0x59')](_0x5951ec)){throw new db[(_0xd81b('0x5e'))][(_0xd81b('0x5f'))](_0xd81b('0x60'));}if(_0x108aaf[_0xd81b('0x61')]){return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,_0x108aaf[_0xd81b('0x61')]+path[_0xd81b('0x62')](_0x5951ec),function(){if(_0x22f588){fs['unlink'](_0x5951ec);}});}else{return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,function(_0x434434){if(_0x22f588){fs[_0xd81b('0x63')](_0x5951ec);}});}}})[_0xd81b('0x49')](function(_0x1bdf37){if(_0x1bdf37[_0xd81b('0x64')]===_0xd81b('0x60')){_0x3b7ed7['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x3b7ed7,null);}});};exports[_0xd81b('0x29')]=function(_0x12b0bf,_0x37507e){return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0x12b0bf[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](function(_0x5afecf){if(_[_0xd81b('0x65')](_0x5afecf)){throw new ReferenceError(_0xd81b('0x66'));}return _0x5afecf;})[_0xd81b('0x28')](function(_0x2090e9){var _0x41719b=path[_0xd81b('0x5c')](config[_0xd81b('0x57')],'server/files/screen_recordings',_0x2090e9[_0xd81b('0x51')]);logger[_0xd81b('0x67')](_0xd81b('0x68'),_0x41719b);if(!_[_0xd81b('0x65')](_0x2090e9[_0xd81b('0x51')])&&fs[_0xd81b('0x59')](_0x41719b)){logger[_0xd81b('0x67')](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}_0x41719b=_0x41719b+_0xd81b('0x6c');if(!_[_0xd81b('0x65')](_0x2090e9['value'])&&fs[_0xd81b('0x59')](_0x41719b)){logger['info'](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}return _0x2090e9;})[_0xd81b('0x28')](function(_0xb94a69){if(!_0xb94a69)throw new InternalError();return _0xb94a69[_0xd81b('0x29')]();})[_0xd81b('0x28')](function(){_0x37507e[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();})[_0xd81b('0x49')](handleError(_0x37507e,null));};
\ No newline at end of file
index 15b50cb..adb92af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb3f=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x14436a,_0x122417){var _0xac8e9b=function(_0x38c45c){while(--_0x38c45c){_0x14436a['push'](_0x14436a['shift']());}};_0xac8e9b(++_0x122417);}(_0xeb3f,0x128));var _0xfeb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeb3f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xfeb3('0x0'));var util=require(_0xfeb3('0x1'));var logger=require(_0xfeb3('0x2'))(_0xfeb3('0x3'));var moment=require(_0xfeb3('0x4'));var BPromise=require('bluebird');var rp=require(_0xfeb3('0x5'));var fs=require('fs');var path=require(_0xfeb3('0x6'));var rimraf=require(_0xfeb3('0x7'));var config=require(_0xfeb3('0x8'));var attributes=require('./screenRecording.attributes');module[_0xfeb3('0x9')]=function(_0x31988f,_0x1e1052){return _0x31988f[_0xfeb3('0xa')]('ScreenRecording',attributes,{'tableName':_0xfeb3('0xb'),'paranoid':![],'indexes':[{'name':_0xfeb3('0xc'),'fields':[_0xfeb3('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7c89=['request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','../../config/logger','api','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c89,0x135));var _0x97c8=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7c89[_0x13ea00];return _0x1f7347;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97c8('0x0'))(_0x97c8('0x1'));var moment=require('moment');var BPromise=require(_0x97c8('0x2'));var rp=require(_0x97c8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97c8('0x4'));var config=require(_0x97c8('0x5'));var attributes=require(_0x97c8('0x6'));module[_0x97c8('0x7')]=function(_0xd2c1f1,_0x55a7e6){return _0xd2c1f1[_0x97c8('0x8')](_0x97c8('0x9'),attributes,{'tableName':_0x97c8('0xa'),'paranoid':![],'indexes':[{'name':_0x97c8('0xb'),'fields':[_0x97c8('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 52a9090..5bc38e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba89=['http','request','then','info','debug','request\x20sent','error','code','ScreenRecording,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xba89,0x10f));var _0x9ba8=function(_0x24d91e,_0x5f0df4){_0x24d91e=_0x24d91e-0x0;var _0x34d6f6=_0xba89[_0x24d91e];return _0x34d6f6;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var moment=require('moment');var BPromise=require(_0x9ba8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ba8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9ba8('0x4'))(_0x9ba8('0x5'));var config=require(_0x9ba8('0x6'));var jayson=require(_0x9ba8('0x7'));var client=jayson[_0x9ba8('0x8')][_0x9ba8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10019e,_0x222f79,_0x31c0f0){return new BPromise(function(_0x19fc1b,_0x18473c){return client[_0x9ba8('0xa')](_0x10019e,_0x31c0f0)[_0x9ba8('0xb')](function(_0x482cc7){logger[_0x9ba8('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x222f79,'request\x20sent');logger[_0x9ba8('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x222f79,_0x9ba8('0xe'),JSON['stringify'](_0x482cc7));if(_0x482cc7[_0x9ba8('0xf')]){if(_0x482cc7[_0x9ba8('0xf')][_0x9ba8('0x10')]===0x1f4){logger['error'](_0x9ba8('0x11'),_0x222f79,_0x482cc7['error'][_0x9ba8('0x12')]);return _0x18473c(_0x482cc7['error'][_0x9ba8('0x12')]);}logger[_0x9ba8('0xf')](_0x9ba8('0x11'),_0x222f79,_0x482cc7[_0x9ba8('0xf')][_0x9ba8('0x12')]);return _0x19fc1b(_0x482cc7[_0x9ba8('0xf')][_0x9ba8('0x12')]);}else{logger['info'](_0x9ba8('0x11'),_0x222f79,'request\x20sent');_0x19fc1b(_0x482cc7[_0x9ba8('0x13')][_0x9ba8('0x12')]);}})['catch'](function(_0x315533){logger[_0x9ba8('0xf')](_0x9ba8('0x11'),_0x222f79,_0x315533);_0x18473c(_0x315533);});});}
\ No newline at end of file
+var _0x1910=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b3ee7,_0x4424f5){var _0x1ce8bd=function(_0x5369ff){while(--_0x5369ff){_0x4b3ee7['push'](_0x4b3ee7['shift']());}};_0x1ce8bd(++_0x4424f5);}(_0x1910,0x19b));var _0x0191=function(_0xd4c3d8,_0x1346f4){_0xd4c3d8=_0xd4c3d8-0x0;var _0x28a45c=_0x1910[_0xd4c3d8];return _0x28a45c;};'use strict';var _=require('lodash');var util=require(_0x0191('0x0'));var moment=require(_0x0191('0x1'));var BPromise=require(_0x0191('0x2'));var rs=require(_0x0191('0x3'));var fs=require('fs');var Redis=require(_0x0191('0x4'));var db=require(_0x0191('0x5'))['db'];var utils=require(_0x0191('0x6'));var logger=require(_0x0191('0x7'))('rpc');var config=require(_0x0191('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0191('0x9')][_0x0191('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c25ea,_0x5b8e8b,_0x4f74b5){return new BPromise(function(_0xd168da,_0xc701c){return client[_0x0191('0xb')](_0x5c25ea,_0x4f74b5)[_0x0191('0xc')](function(_0xadd6c8){logger[_0x0191('0xd')](_0x0191('0xe'),_0x5b8e8b,_0x0191('0xf'));logger[_0x0191('0x10')](_0x0191('0x11'),_0x5b8e8b,_0x0191('0xf'),JSON[_0x0191('0x12')](_0xadd6c8));if(_0xadd6c8[_0x0191('0x13')]){if(_0xadd6c8['error'][_0x0191('0x14')]===0x1f4){logger[_0x0191('0x13')](_0x0191('0xe'),_0x5b8e8b,_0xadd6c8[_0x0191('0x13')]['message']);return _0xc701c(_0xadd6c8[_0x0191('0x13')][_0x0191('0x15')]);}logger[_0x0191('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x5b8e8b,_0xadd6c8[_0x0191('0x13')][_0x0191('0x15')]);return _0xd168da(_0xadd6c8[_0x0191('0x13')][_0x0191('0x15')]);}else{logger['info'](_0x0191('0xe'),_0x5b8e8b,'request\x20sent');_0xd168da(_0xadd6c8[_0x0191('0x16')][_0x0191('0x15')]);}})[_0x0191('0x17')](function(_0x506c70){logger[_0x0191('0x13')](_0x0191('0xe'),_0x5b8e8b,_0x506c70);_0xc701c(_0x506c70);});});}
\ No newline at end of file
index fad5959..bdcc9dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb251=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','getPreferred','join','root','format','extname','originalname','post','single','diskStorage','logologin','/:id/logo_login','file','addLogoLogin','server/files/images/logos/','%s%s','addPreferred','favicon','/:id/favicon','addFavicon','put','multer','util','connect-timeout','express'];(function(_0x136df0,_0x735f27){var _0x43e342=function(_0x508af9){while(--_0x508af9){_0x136df0['push'](_0x136df0['shift']());}};_0x43e342(++_0x735f27);}(_0xb251,0x1a9));var _0x1b25=function(_0x58f87b,_0x36bb6d){_0x58f87b=_0x58f87b-0x0;var _0x2b9c4b=_0xb251[_0x58f87b];return _0x2b9c4b;};'use strict';var multer=require(_0x1b25('0x0'));var util=require(_0x1b25('0x1'));var path=require('path');var timeout=require(_0x1b25('0x2'));var express=require(_0x1b25('0x3'));var router=express[_0x1b25('0x4')]();var fs_extra=require(_0x1b25('0x5'));var auth=require(_0x1b25('0x6'));var interaction=require(_0x1b25('0x7'));var config=require(_0x1b25('0x8'));var controller=require(_0x1b25('0x9'));router[_0x1b25('0xa')]('/',auth[_0x1b25('0xb')](),controller[_0x1b25('0xc')]);router[_0x1b25('0xa')](_0x1b25('0xd'),controller['getDate']);router[_0x1b25('0xa')](_0x1b25('0xe'),controller['show']);router[_0x1b25('0xa')](_0x1b25('0xf'),controller[_0x1b25('0x10')]);router[_0x1b25('0xa')]('/:id/logo_login',controller[_0x1b25('0x11')]);router['get'](_0x1b25('0x12'),controller['gdpr']);router[_0x1b25('0xa')]('/:id/preferred',controller[_0x1b25('0x13')]);router[_0x1b25('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x57dd8c,_0xdca887,_0xe9c4a){_0xe9c4a(null,path[_0x1b25('0x14')](config[_0x1b25('0x15')],'server/files/images/logos/'));},'filename':function(_0x2067e5,_0x286c38,_0x42e096){_0x42e096(null,util[_0x1b25('0x16')]('%s%s','logo',path[_0x1b25('0x17')](_0x286c38[_0x1b25('0x18')])));}})});router[_0x1b25('0x19')](_0x1b25('0xf'),upload[_0x1b25('0x1a')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x1b25('0x1b')]({'destination':function(_0x6899fb,_0x53a998,_0x5ecffe){_0x5ecffe(null,path[_0x1b25('0x14')](config[_0x1b25('0x15')],'server/files/images/logos/'));},'filename':function(_0x59d4af,_0x5e698d,_0x449e34){_0x449e34(null,util[_0x1b25('0x16')]('%s%s',_0x1b25('0x1c'),path[_0x1b25('0x17')](_0x5e698d[_0x1b25('0x18')])));}})});router['post'](_0x1b25('0x1d'),upload[_0x1b25('0x1a')](_0x1b25('0x1e')),controller[_0x1b25('0x1f')]);var upload=multer({'storage':multer[_0x1b25('0x1b')]({'destination':function(_0x4ac843,_0x2f34da,_0x49756f){_0x49756f(null,path['join'](config[_0x1b25('0x15')],_0x1b25('0x20')));},'filename':function(_0x5abdff,_0x1be859,_0x4f4b81){_0x4f4b81(null,util[_0x1b25('0x16')](_0x1b25('0x21'),'preferred',path['extname'](_0x1be859[_0x1b25('0x18')])));}})});router[_0x1b25('0x19')]('/:id/preferred',upload[_0x1b25('0x1a')](_0x1b25('0x1e')),controller[_0x1b25('0x22')]);var upload=multer({'storage':multer[_0x1b25('0x1b')]({'destination':function(_0x3ae44c,_0x3c0ab3,_0x34d817){_0x34d817(null,path[_0x1b25('0x14')](config[_0x1b25('0x15')],_0x1b25('0x20')));},'filename':function(_0x356efa,_0x5f4fdd,_0x54142e){_0x54142e(null,util['format'](_0x1b25('0x21'),_0x1b25('0x23'),path[_0x1b25('0x17')](_0x5f4fdd[_0x1b25('0x18')])));}})});router[_0x1b25('0x19')](_0x1b25('0x24'),upload[_0x1b25('0x1a')](_0x1b25('0x1e')),controller[_0x1b25('0x25')]);router[_0x1b25('0x26')](_0x1b25('0xe'),auth[_0x1b25('0xb')](),controller['update']);module['exports']=router;
\ No newline at end of file
+var _0xd5d4=['/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','server/files/images/logos/','format','extname','originalname','post','single','file','addLogo','join','root','%s%s','logologin','addLogoLogin','preferred','addPreferred','diskStorage','addFavicon','put','update','exports','path','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','/now','show','getLogo','/:id/logo_login'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xd5d4,0xc7));var _0x4d5d=function(_0x2ec13e,_0x2ea526){_0x2ec13e=_0x2ec13e-0x0;var _0xb48415=_0xd5d4[_0x2ec13e];return _0xb48415;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d5d('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d5d('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x4d5d('0x2'));var config=require(_0x4d5d('0x3'));var controller=require(_0x4d5d('0x4'));router['get']('/',auth[_0x4d5d('0x5')](),controller['index']);router[_0x4d5d('0x6')](_0x4d5d('0x7'),controller['getDate']);router['get']('/:id',controller[_0x4d5d('0x8')]);router[_0x4d5d('0x6')]('/:id/logo',controller[_0x4d5d('0x9')]);router[_0x4d5d('0x6')](_0x4d5d('0xa'),controller['getLogoLogin']);router[_0x4d5d('0x6')](_0x4d5d('0xb'),controller['gdpr']);router[_0x4d5d('0x6')](_0x4d5d('0xc'),controller['getPreferred']);router['get'](_0x4d5d('0xd'),controller[_0x4d5d('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19da6d,_0x1da944,_0x46c308){_0x46c308(null,path['join'](config['root'],_0x4d5d('0xf')));},'filename':function(_0x21223c,_0x2b8e13,_0x1d98cc){_0x1d98cc(null,util[_0x4d5d('0x10')]('%s%s','logo',path[_0x4d5d('0x11')](_0x2b8e13[_0x4d5d('0x12')])));}})});router[_0x4d5d('0x13')]('/:id/logo',upload[_0x4d5d('0x14')](_0x4d5d('0x15')),controller[_0x4d5d('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55d77a,_0x4c815b,_0x1d0a69){_0x1d0a69(null,path[_0x4d5d('0x17')](config[_0x4d5d('0x18')],_0x4d5d('0xf')));},'filename':function(_0x5b3ac8,_0x126bc7,_0x81ccb5){_0x81ccb5(null,util[_0x4d5d('0x10')](_0x4d5d('0x19'),_0x4d5d('0x1a'),path[_0x4d5d('0x11')](_0x126bc7[_0x4d5d('0x12')])));}})});router[_0x4d5d('0x13')](_0x4d5d('0xa'),upload[_0x4d5d('0x14')](_0x4d5d('0x15')),controller[_0x4d5d('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x583a0f,_0x47196d,_0x53e99){_0x53e99(null,path[_0x4d5d('0x17')](config[_0x4d5d('0x18')],'server/files/images/logos/'));},'filename':function(_0x41aaa4,_0x2b0efb,_0x57d483){_0x57d483(null,util['format'](_0x4d5d('0x19'),_0x4d5d('0x1c'),path[_0x4d5d('0x11')](_0x2b0efb['originalname'])));}})});router[_0x4d5d('0x13')](_0x4d5d('0xc'),upload[_0x4d5d('0x14')](_0x4d5d('0x15')),controller[_0x4d5d('0x1d')]);var upload=multer({'storage':multer[_0x4d5d('0x1e')]({'destination':function(_0x183e91,_0xf0c154,_0x2cc5c9){_0x2cc5c9(null,path[_0x4d5d('0x17')](config[_0x4d5d('0x18')],_0x4d5d('0xf')));},'filename':function(_0x1127ae,_0xdfd382,_0x3cccad){_0x3cccad(null,util[_0x4d5d('0x10')](_0x4d5d('0x19'),'favicon',path[_0x4d5d('0x11')](_0xdfd382[_0x4d5d('0x12')])));}})});router['post'](_0x4d5d('0xd'),upload[_0x4d5d('0x14')](_0x4d5d('0x15')),controller[_0x4d5d('0x1f')]);router[_0x4d5d('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x4d5d('0x21')]);module[_0x4d5d('0x22')]=router;
\ No newline at end of file
index 3570f95..43fccc9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x537e50,_0x7bfa4a){var _0x35b6bf=function(_0x596679){while(--_0x596679){_0x537e50['push'](_0x537e50['shift']());}};_0x35b6bf(++_0x7bfa4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}};
\ No newline at end of file
+var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xb0c760,_0x275897){var _0x1a6dca=function(_0x520d03){while(--_0x520d03){_0xb0c760['push'](_0xb0c760['shift']());}};_0x1a6dca(++_0x275897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}};
\ No newline at end of file
index 757cd82..eec208b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7df=['download','getLogoLogin','defaultLogo','defaultPreferred','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getLicense','default_preferred.png','custom','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','find','addLogo','filename','logo','file','addLogoLogin','loginLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize','\x20not\x20found'];(function(_0x2c4666,_0x5468c2){var _0x28777b=function(_0x3a679){while(--_0x3a679){_0x2c4666['push'](_0x2c4666['shift']());}};_0x28777b(++_0x5468c2);}(_0xf7df,0x10e));var _0xff7d=function(_0x426565,_0xfee6ca){_0x426565=_0x426565-0x0;var _0x1db253=_0xf7df[_0x426565];return _0x1db253;};'use strict';var emlformat=require(_0xff7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff7d('0x1'));var jsonpatch=require(_0xff7d('0x2'));var rp=require(_0xff7d('0x3'));var moment=require(_0xff7d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff7d('0x5'));var util=require('util');var path=require(_0xff7d('0x6'));var sox=require(_0xff7d('0x7'));var csv=require('to-csv');var ejs=require(_0xff7d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff7d('0x9'));var crypto=require(_0xff7d('0xa'));var jsforce=require(_0xff7d('0xb'));var deskjs=require(_0xff7d('0xc'));var toCsv=require(_0xff7d('0xd'));var querystring=require(_0xff7d('0xe'));var Papa=require('papaparse');var Redis=require(_0xff7d('0xf'));var authService=require(_0xff7d('0x10'));var qs=require(_0xff7d('0x11'));var as=require(_0xff7d('0x12'));var hardwareService=require(_0xff7d('0x13'));var logger=require(_0xff7d('0x14'))(_0xff7d('0x15'));var utils=require(_0xff7d('0x16'));var config=require(_0xff7d('0x17'));var licenseUtil=require(_0xff7d('0x18'));var db=require(_0xff7d('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xff7d('0x1a')][_0xff7d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5ceb43,_0x1174c5,_0x19124c,_0x2965e2){return new BPromise(function(_0x3886f5,_0x1d6a4c){var _0x2ea760=_0x2965e2||client;return _0x2ea760['request'](_0x5ceb43,_0x19124c)[_0xff7d('0x1c')](function(_0x10e4ae){logger[_0xff7d('0x1d')](_0xff7d('0x1e'),_0x1174c5,_0xff7d('0x1f'));logger[_0xff7d('0x20')](_0xff7d('0x21'),_0x1174c5,_0xff7d('0x1f'),JSON[_0xff7d('0x22')](_0x10e4ae));if(_0x10e4ae['error']){if(_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x24')]===0x1f4){logger[_0xff7d('0x23')]('Setting,\x20%s,\x20%s',_0x1174c5,_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x25')]);return _0x1d6a4c(_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x25')]);}logger[_0xff7d('0x23')](_0xff7d('0x1e'),_0x1174c5,_0x10e4ae[_0xff7d('0x23')][_0xff7d('0x25')]);return _0x3886f5(_0x10e4ae[_0xff7d('0x23')]['message']);}else{logger[_0xff7d('0x1d')](_0xff7d('0x1e'),_0x1174c5,_0xff7d('0x1f'));_0x3886f5(_0x10e4ae['result'][_0xff7d('0x25')]);}})[_0xff7d('0x26')](function(_0x455ac7){logger['error'](_0xff7d('0x1e'),_0x1174c5,_0x455ac7);_0x1d6a4c(_0x455ac7);});});}function respondWithStatusCode(_0x14e4b4,_0xf42f3c){_0xf42f3c=_0xf42f3c||0xcc;return function(_0x1a6506){if(_0x1a6506){return _0x14e4b4[_0xff7d('0x27')](_0xf42f3c);}return _0x14e4b4[_0xff7d('0x28')](_0xf42f3c)[_0xff7d('0x29')]();};}function respondWithResult(_0x15bbe6,_0x5ef97e){_0x5ef97e=_0x5ef97e||0xc8;return function(_0x457adf){if(_0x457adf){return _0x15bbe6[_0xff7d('0x28')](_0x5ef97e)[_0xff7d('0x2a')](_0x457adf);}};}function respondWithFilteredResult(_0x5a7997,_0x5eb41e){return function(_0x55708a){if(_0x55708a){var _0x24e962=typeof _0x5eb41e['offset']==='undefined'&&typeof _0x5eb41e['limit']===_0xff7d('0x2b');var _0x3642a9=_0x55708a[_0xff7d('0x2c')];var _0x479184=_0x24e962?0x0:_0x5eb41e['offset'];var _0x18bbaa=_0x24e962?_0x55708a[_0xff7d('0x2c')]:_0x5eb41e['offset']+_0x5eb41e['limit'];var _0x4ef328;if(_0x18bbaa>=_0x3642a9){_0x18bbaa=_0x3642a9;_0x4ef328=0xc8;}else{_0x4ef328=0xce;}_0x5a7997[_0xff7d('0x28')](_0x4ef328);return _0x5a7997[_0xff7d('0x2d')](_0xff7d('0x2e'),_0x479184+'-'+_0x18bbaa+'/'+_0x3642a9)[_0xff7d('0x2a')](_0x55708a);}return null;};}function patchUpdates(_0x39ccde){return function(_0x6127ef){try{jsonpatch[_0xff7d('0x2f')](_0x6127ef,_0x39ccde,!![]);}catch(_0xbcb02f){return BPromise['reject'](_0xbcb02f);}return _0x6127ef[_0xff7d('0x30')]();};}function saveUpdates(_0x5d532d,_0xb1dd88){return function(_0x279866){if(_0x279866){return _0x279866[_0xff7d('0x31')](_0x5d532d)['then'](function(_0x5092c4){return _0x5092c4;});}return null;};}function removeEntity(_0x2c8227,_0xccd74f){return function(_0x112dfa){if(_0x112dfa){return _0x112dfa[_0xff7d('0x32')]()[_0xff7d('0x1c')](function(){_0x2c8227[_0xff7d('0x28')](0xcc)[_0xff7d('0x29')]();});}};}function handleEntityNotFound(_0x349c8d,_0xf98cc6){return function(_0x4250eb){if(!_0x4250eb){_0x349c8d['sendStatus'](0x194);}return _0x4250eb;};}function handleError(_0x436f53,_0x38a8d){_0x38a8d=_0x38a8d||0x1f4;return function(_0x3e9f9c){logger['error'](_0x3e9f9c[_0xff7d('0x33')]);if(_0x3e9f9c[_0xff7d('0x34')]){delete _0x3e9f9c['name'];}_0x436f53[_0xff7d('0x28')](_0x38a8d)[_0xff7d('0x35')](_0x3e9f9c);};}exports['index']=function(_0x454042,_0x114508){var _0x42dfce={},_0x4debed={},_0x48f078={'count':0x0,'rows':[]};var _0x3a2a00=_[_0xff7d('0x36')](db[_0xff7d('0x37')][_0xff7d('0x38')],function(_0x3b5a85){return{'name':_0x3b5a85[_0xff7d('0x39')],'type':_0x3b5a85[_0xff7d('0x3a')][_0xff7d('0x3b')]};});_0x4debed[_0xff7d('0x3c')]=_['map'](_0x3a2a00,_0xff7d('0x34'));_0x4debed[_0xff7d('0x3d')]=_[_0xff7d('0x3e')](_0x454042[_0xff7d('0x3d')]);_0x4debed['filters']=_[_0xff7d('0x3f')](_0x4debed[_0xff7d('0x3c')],_0x4debed[_0xff7d('0x3d')]);_0x42dfce[_0xff7d('0x40')]=_['intersection'](_0x4debed[_0xff7d('0x3c')],qs[_0xff7d('0x41')](_0x454042[_0xff7d('0x3d')][_0xff7d('0x41')]));_0x42dfce[_0xff7d('0x40')]=_0x42dfce['attributes'][_0xff7d('0x42')]?_0x42dfce[_0xff7d('0x40')]:_0x4debed[_0xff7d('0x3c')];if(!_0x454042['query'][_0xff7d('0x43')](_0xff7d('0x44'))){_0x42dfce[_0xff7d('0x45')]=qs[_0xff7d('0x45')](_0x454042[_0xff7d('0x3d')][_0xff7d('0x45')]);_0x42dfce[_0xff7d('0x46')]=qs[_0xff7d('0x46')](_0x454042['query'][_0xff7d('0x46')]);}_0x42dfce[_0xff7d('0x47')]=qs[_0xff7d('0x48')](_0x454042[_0xff7d('0x3d')][_0xff7d('0x48')]);_0x42dfce[_0xff7d('0x49')]=qs[_0xff7d('0x4a')](_[_0xff7d('0x4b')](_0x454042[_0xff7d('0x3d')],_0x4debed[_0xff7d('0x4a')]),_0x3a2a00);if(_0x454042['query'][_0xff7d('0x4c')]){_0x42dfce['where']=_[_0xff7d('0x4d')](_0x42dfce['where'],{'$or':_['map'](_0x3a2a00,function(_0x4fa723){if(_0x4fa723['type']!==_0xff7d('0x4e')){var _0x28e747={};_0x28e747[_0x4fa723[_0xff7d('0x34')]]={'$like':'%'+_0x454042[_0xff7d('0x3d')][_0xff7d('0x4c')]+'%'};return _0x28e747;}})});}_0x42dfce=_[_0xff7d('0x4d')]({},_0x42dfce,_0x454042[_0xff7d('0x4f')]);var _0x19620c={'where':_0x42dfce['where']};return db[_0xff7d('0x37')][_0xff7d('0x2c')](_0x19620c)['then'](function(_0xcdc2df){_0x48f078[_0xff7d('0x2c')]=_0xcdc2df;if(_0x454042['query'][_0xff7d('0x50')]){_0x42dfce[_0xff7d('0x51')]=[{'all':!![]}];}return db[_0xff7d('0x37')][_0xff7d('0x52')](_0x42dfce);})[_0xff7d('0x1c')](function(_0x373806){_0x48f078[_0xff7d('0x53')]=_0x373806;return _0x48f078;})[_0xff7d('0x1c')](respondWithFilteredResult(_0x114508,_0x42dfce))['catch'](handleError(_0x114508,null));};exports[_0xff7d('0x54')]=function(_0x313d31,_0xbba471){var _0x469a9d={'raw':![],'where':{'id':_0x313d31[_0xff7d('0x55')]['id']}},_0x107270={};_0x107270[_0xff7d('0x3c')]=_[_0xff7d('0x3e')](db['Setting'][_0xff7d('0x38')]);_0x107270[_0xff7d('0x3d')]=_[_0xff7d('0x3e')](_0x313d31[_0xff7d('0x3d')]);_0x107270[_0xff7d('0x4a')]=_[_0xff7d('0x3f')](_0x107270[_0xff7d('0x3c')],_0x107270[_0xff7d('0x3d')]);_0x469a9d[_0xff7d('0x40')]=_['intersection'](_0x107270[_0xff7d('0x3c')],qs[_0xff7d('0x41')](_0x313d31[_0xff7d('0x3d')][_0xff7d('0x41')]));_0x469a9d[_0xff7d('0x40')]=_0x469a9d[_0xff7d('0x40')][_0xff7d('0x42')]?_0x469a9d[_0xff7d('0x40')]:_0x107270[_0xff7d('0x3c')];if(_0x313d31[_0xff7d('0x3d')][_0xff7d('0x50')]){_0x469a9d[_0xff7d('0x51')]=[{'all':!![]}];}_0x469a9d=_[_0xff7d('0x4d')]({},_0x469a9d,_0x313d31['options']);return db[_0xff7d('0x37')]['find'](_0x469a9d)[_0xff7d('0x1c')](handleEntityNotFound(_0xbba471,null))[_0xff7d('0x1c')](respondWithResult(_0xbba471,null))[_0xff7d('0x26')](handleError(_0xbba471,null));};exports['update']=function(_0x5c2258,_0x43982b){if(_0x5c2258[_0xff7d('0x56')]['id']){delete _0x5c2258['body']['id'];}return db[_0xff7d('0x37')][_0xff7d('0x57')]({'where':{'id':_0x5c2258[_0xff7d('0x55')]['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x43982b,null))[_0xff7d('0x1c')](saveUpdates(_0x5c2258['body'],null))[_0xff7d('0x1c')](respondWithResult(_0x43982b,null))[_0xff7d('0x26')](handleError(_0x43982b,null));};exports[_0xff7d('0x58')]=function(_0x1abe91,_0x576421,_0x1beb2b){if(_0x1abe91['file']&&_0x1abe91['file'][_0xff7d('0x59')]){_0x1abe91[_0xff7d('0x56')][_0xff7d('0x5a')]=_0x1abe91[_0xff7d('0x5b')]['filename'];}return db[_0xff7d('0x37')][_0xff7d('0x57')]({'where':{'id':_0x1abe91['params']['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x576421,null))[_0xff7d('0x1c')](saveUpdates(_0x1abe91[_0xff7d('0x56')],null))['then'](respondWithResult(_0x576421,null))[_0xff7d('0x26')](handleError(_0x576421,null));};exports[_0xff7d('0x5c')]=function(_0x48b4a1,_0x438d23,_0x26bc6e){if(_0x48b4a1[_0xff7d('0x5b')]&&_0x48b4a1['file'][_0xff7d('0x59')]){_0x48b4a1[_0xff7d('0x56')][_0xff7d('0x5d')]=_0x48b4a1['file'][_0xff7d('0x59')];}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x48b4a1[_0xff7d('0x55')]['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x438d23,null))['then'](saveUpdates(_0x48b4a1[_0xff7d('0x56')],null))['then'](respondWithResult(_0x438d23,null))[_0xff7d('0x26')](handleError(_0x438d23,null));};var utilLicense=require(_0xff7d('0x18'));exports['getLogo']=function(_0x4bc561,_0x4c53f5,_0x351772){var _0x47fa32=_0xff7d('0x5e');var _0x551cba={'custom':![]};return utilLicense['getLicense']()[_0xff7d('0x1c')](function(_0x2fdcb5){if(_0x2fdcb5){_0x551cba=_0x2fdcb5;}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x4bc561[_0xff7d('0x55')]['id']},'attributes':[_0xff7d('0x5a'),_0xff7d('0x5d'),_0xff7d('0x5f'),_0xff7d('0x60'),'defaultLogo',_0xff7d('0x61'),'defaultPreferred',_0xff7d('0x62')],'raw':!![]});})[_0xff7d('0x1c')](handleEntityNotFound(_0x4c53f5,null))['then'](function(_0x42f67a){if(_0x42f67a){var _0x2fb34c=_0x42f67a['logo']&&fs[_0xff7d('0x63')](path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')](_0x42f67a[_0xff7d('0x5a')])))?path['join'](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')](_0x42f67a[_0xff7d('0x5a')])):path['join'](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')]('default_logo.svg'));var _0x2dcbe1=_0xff7d('0x67')+_[_0xff7d('0x68')](_0xff7d('0x5a'));if(_0x42f67a[_0x2dcbe1]||!_0x551cba['custom']){_0x2fb34c=path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x47fa32,_[_0xff7d('0x66')](_0xff7d('0x69')));}if(!fs['existsSync'](_0x2fb34c)){throw new db[(_0xff7d('0x6a'))]['ValidationError'](_['upperFirst']('logo')+_0xff7d('0x6b'));}return _0x4c53f5[_0xff7d('0x6c')](_0x2fb34c);}})[_0xff7d('0x26')](handleError(_0x4c53f5,null));};var utilLicense=require('../../config/license/util');exports[_0xff7d('0x6d')]=function(_0x258890,_0x130e16,_0xfb26dd){var _0x2549d3='server/files/images/logos';var _0x1ef0a2={'custom':![]};return utilLicense['getLicense']()[_0xff7d('0x1c')](function(_0x14a209){if(_0x14a209){_0x1ef0a2=_0x14a209;}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x258890[_0xff7d('0x55')]['id']},'attributes':['logo',_0xff7d('0x5d'),_0xff7d('0x5f'),_0xff7d('0x60'),_0xff7d('0x6e'),'defaultLoginLogo',_0xff7d('0x6f'),_0xff7d('0x62')],'raw':!![]});})[_0xff7d('0x1c')](handleEntityNotFound(_0x130e16,null))['then'](function(_0x114865){if(_0x114865){var _0x282999=_0x114865[_0xff7d('0x5d')]&&fs['existsSync'](path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_['toLower'](_0x114865['loginLogo'])))?path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_[_0xff7d('0x66')](_0x114865['loginLogo'])):path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_[_0xff7d('0x66')](_0xff7d('0x70')));var _0x2a070f=_0xff7d('0x67')+_['upperFirst'](_0xff7d('0x5d'));if(_0x114865[_0x2a070f]||!_0x1ef0a2['custom']){_0x282999=path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x2549d3,_[_0xff7d('0x66')](_0xff7d('0x70')));}if(!fs[_0xff7d('0x63')](_0x282999)){throw new db[(_0xff7d('0x6a'))][(_0xff7d('0x71'))](_[_0xff7d('0x68')](_0xff7d('0x5d'))+'\x20not\x20found');}return _0x130e16[_0xff7d('0x6c')](_0x282999);}})['catch'](handleError(_0x130e16,null));};exports[_0xff7d('0x72')]=function(_0x1ba859,_0x5dba31){return db[_0xff7d('0x37')]['find']({'where':{'id':_0x1ba859['params']['id']},'attributes':[_0xff7d('0x73')]})['then'](respondWithResult(_0x5dba31,null))[_0xff7d('0x26')](handleError(_0x5dba31,null));};exports[_0xff7d('0x74')]=function(_0x3e0278,_0x322a84,_0x14c44f){if(_0x3e0278['file']&&_0x3e0278[_0xff7d('0x5b')]['filename']){_0x3e0278[_0xff7d('0x56')][_0xff7d('0x5f')]=_0x3e0278[_0xff7d('0x5b')][_0xff7d('0x59')];}return db[_0xff7d('0x37')][_0xff7d('0x57')]({'where':{'id':_0x3e0278[_0xff7d('0x55')]['id']}})[_0xff7d('0x1c')](handleEntityNotFound(_0x322a84,null))[_0xff7d('0x1c')](saveUpdates(_0x3e0278[_0xff7d('0x56')],null))[_0xff7d('0x1c')](respondWithResult(_0x322a84,null))[_0xff7d('0x26')](handleError(_0x322a84,null));};var utilLicense=require(_0xff7d('0x18'));exports['getPreferred']=function(_0x4685c7,_0x55d40d,_0xc53f53){var _0x1d256a='server/files/images/logos';var _0x1bc030={'custom':![]};return utilLicense[_0xff7d('0x75')]()['then'](function(_0x4b6b99){if(_0x4b6b99){_0x1bc030=_0x4b6b99;}return db['Setting'][_0xff7d('0x57')]({'where':{'id':_0x4685c7['params']['id']},'attributes':[_0xff7d('0x5a'),_0xff7d('0x5d'),_0xff7d('0x5f'),_0xff7d('0x60'),_0xff7d('0x6e'),_0xff7d('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xff7d('0x1c')](handleEntityNotFound(_0x55d40d,null))[_0xff7d('0x1c')](function(_0x38daf2){if(_0x38daf2){var _0x180820=_0x38daf2[_0xff7d('0x5f')]&&fs[_0xff7d('0x63')](path['join'](config[_0xff7d('0x65')],_0x1d256a,_[_0xff7d('0x66')](_0x38daf2['preferred'])))?path['join'](config[_0xff7d('0x65')],_0x1d256a,_[_0xff7d('0x66')](_0x38daf2[_0xff7d('0x5f')])):path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0x1d256a,_[_0xff7d('0x66')](_0xff7d('0x76')));var _0xbed75b=_0xff7d('0x67')+_['upperFirst'](_0xff7d('0x5f'));if(_0x38daf2[_0xbed75b]||!_0x1bc030[_0xff7d('0x77')]||!_0x1bc030[_0xff7d('0x5f')]){_0x180820=path['join'](config['root'],_0x1d256a,_[_0xff7d('0x66')]('default_preferred.png'));}if(!fs[_0xff7d('0x63')](_0x180820)){throw new db[(_0xff7d('0x6a'))]['ValidationError'](_[_0xff7d('0x68')](_0xff7d('0x5f'))+'\x20not\x20found');}return _0x55d40d['download'](_0x180820);}})[_0xff7d('0x26')](handleError(_0x55d40d,null));};exports['addFavicon']=function(_0x5a090a,_0x3ccc29,_0x28cb8c){if(_0x5a090a[_0xff7d('0x5b')]&&_0x5a090a[_0xff7d('0x5b')]['filename']){_0x5a090a[_0xff7d('0x56')]['favicon']=_0x5a090a[_0xff7d('0x5b')][_0xff7d('0x59')];}return db['Setting'][_0xff7d('0x57')]({'where':{'id':_0x5a090a[_0xff7d('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ccc29,null))['then'](saveUpdates(_0x5a090a['body'],null))[_0xff7d('0x1c')](respondWithResult(_0x3ccc29,null))['catch'](handleError(_0x3ccc29,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2b8739,_0x54fb1b,_0x41d1e7){var _0xd3210d='server/files/images/logos';var _0x12bd2b={'custom':![]};return utilLicense[_0xff7d('0x75')]()[_0xff7d('0x1c')](function(_0x498c60){if(_0x498c60){_0x12bd2b=_0x498c60;}return db[_0xff7d('0x37')]['find']({'where':{'id':_0x2b8739[_0xff7d('0x55')]['id']},'attributes':[_0xff7d('0x5a'),_0xff7d('0x5d'),_0xff7d('0x5f'),'favicon',_0xff7d('0x6e'),_0xff7d('0x61'),_0xff7d('0x6f'),_0xff7d('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x54fb1b,null))[_0xff7d('0x1c')](function(_0x574e3c){if(_0x574e3c){var _0x3fa175=_0x574e3c['favicon']&&fs['existsSync'](path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0xd3210d,_[_0xff7d('0x66')](_0x574e3c[_0xff7d('0x60')])))?path[_0xff7d('0x64')](config['root'],_0xd3210d,_[_0xff7d('0x66')](_0x574e3c[_0xff7d('0x60')])):path[_0xff7d('0x64')](config['root'],_0xd3210d,_[_0xff7d('0x66')](_0xff7d('0x78')));var _0x40f74f=_0xff7d('0x67')+_[_0xff7d('0x68')](_0xff7d('0x60'));if(_0x574e3c[_0x40f74f]||!_0x12bd2b[_0xff7d('0x77')]){_0x3fa175=path[_0xff7d('0x64')](config[_0xff7d('0x65')],_0xd3210d,_[_0xff7d('0x66')](_0xff7d('0x78')));}if(!fs[_0xff7d('0x63')](_0x3fa175)){throw new db[(_0xff7d('0x6a'))][(_0xff7d('0x71'))](_[_0xff7d('0x68')](_0xff7d('0x60'))+_0xff7d('0x6b'));}return _0x54fb1b[_0xff7d('0x6c')](_0x3fa175);}})[_0xff7d('0x26')](handleError(_0x54fb1b,null));};exports[_0xff7d('0x79')]=function(_0x4fd1b2,_0x20087d){var _0x342adf={'offset':moment()[_0xff7d('0x7a')]()};_0x342adf[_0xff7d('0x7b')]=moment()[_0xff7d('0x7a')](_0x342adf[_0xff7d('0x46')])[_0xff7d('0x7c')](_0xff7d('0x7d'));return _0x20087d[_0xff7d('0x28')](0xc8)[_0xff7d('0x35')](_0x342adf);};
\ No newline at end of file
+var _0x9ade=['getLicense','default_loginLogo.svg','Sequelize','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','addFavicon','getFavicon','custom','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','show','params','fields','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','ValidationError','download','../../config/license/util','getLogoLogin','server/files/images/logos'];(function(_0x45f4db,_0xfdc476){var _0x53b2fb=function(_0x38f268){while(--_0x38f268){_0x45f4db['push'](_0x45f4db['shift']());}};_0x53b2fb(++_0xfdc476);}(_0x9ade,0x107));var _0xe9ad=function(_0x3e37b3,_0x570305){_0x3e37b3=_0x3e37b3-0x0;var _0x47e724=_0x9ade[_0x3e37b3];return _0x47e724;};'use strict';var emlformat=require(_0xe9ad('0x0'));var rimraf=require(_0xe9ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe9ad('0x2'));var moment=require('moment');var BPromise=require(_0xe9ad('0x3'));var Mustache=require(_0xe9ad('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe9ad('0x5'));var csv=require(_0xe9ad('0x6'));var ejs=require(_0xe9ad('0x7'));var fs=require('fs');var fs_extra=require(_0xe9ad('0x8'));var _=require(_0xe9ad('0x9'));var squel=require(_0xe9ad('0xa'));var crypto=require(_0xe9ad('0xb'));var jsforce=require(_0xe9ad('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe9ad('0x6'));var querystring=require(_0xe9ad('0xd'));var Papa=require(_0xe9ad('0xe'));var Redis=require(_0xe9ad('0xf'));var authService=require(_0xe9ad('0x10'));var qs=require(_0xe9ad('0x11'));var as=require(_0xe9ad('0x12'));var hardwareService=require(_0xe9ad('0x13'));var logger=require(_0xe9ad('0x14'))(_0xe9ad('0x15'));var utils=require(_0xe9ad('0x16'));var config=require(_0xe9ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9ad('0x18'))['db'];var jayson=require(_0xe9ad('0x19'));var client=jayson[_0xe9ad('0x1a')][_0xe9ad('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x502749,_0x30246c,_0x1c29d5,_0x2ea149){return new BPromise(function(_0x208416,_0x4a58b1){var _0x2d4e2e=_0x2ea149||client;return _0x2d4e2e['request'](_0x502749,_0x1c29d5)[_0xe9ad('0x1c')](function(_0x4d018f){logger[_0xe9ad('0x1d')](_0xe9ad('0x1e'),_0x30246c,_0xe9ad('0x1f'));logger[_0xe9ad('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x30246c,_0xe9ad('0x1f'),JSON[_0xe9ad('0x21')](_0x4d018f));if(_0x4d018f[_0xe9ad('0x22')]){if(_0x4d018f[_0xe9ad('0x22')][_0xe9ad('0x23')]===0x1f4){logger[_0xe9ad('0x22')]('Setting,\x20%s,\x20%s',_0x30246c,_0x4d018f[_0xe9ad('0x22')][_0xe9ad('0x24')]);return _0x4a58b1(_0x4d018f[_0xe9ad('0x22')][_0xe9ad('0x24')]);}logger[_0xe9ad('0x22')](_0xe9ad('0x1e'),_0x30246c,_0x4d018f[_0xe9ad('0x22')][_0xe9ad('0x24')]);return _0x208416(_0x4d018f[_0xe9ad('0x22')]['message']);}else{logger[_0xe9ad('0x1d')]('Setting,\x20%s,\x20%s',_0x30246c,_0xe9ad('0x1f'));_0x208416(_0x4d018f['result'][_0xe9ad('0x24')]);}})[_0xe9ad('0x25')](function(_0x17b1f5){logger[_0xe9ad('0x22')](_0xe9ad('0x1e'),_0x30246c,_0x17b1f5);_0x4a58b1(_0x17b1f5);});});}function respondWithStatusCode(_0x479856,_0x5b6c24){_0x5b6c24=_0x5b6c24||0xcc;return function(_0x40a6ce){if(_0x40a6ce){return _0x479856[_0xe9ad('0x26')](_0x5b6c24);}return _0x479856[_0xe9ad('0x27')](_0x5b6c24)[_0xe9ad('0x28')]();};}function respondWithResult(_0x331759,_0x3a910f){_0x3a910f=_0x3a910f||0xc8;return function(_0x431c2f){if(_0x431c2f){return _0x331759[_0xe9ad('0x27')](_0x3a910f)['json'](_0x431c2f);}};}function respondWithFilteredResult(_0x305f51,_0x20b6fc){return function(_0x3842a9){if(_0x3842a9){var _0x136858=typeof _0x20b6fc['offset']===_0xe9ad('0x29')&&typeof _0x20b6fc[_0xe9ad('0x2a')]===_0xe9ad('0x29');var _0x353394=_0x3842a9[_0xe9ad('0x2b')];var _0x3d64ff=_0x136858?0x0:_0x20b6fc['offset'];var _0x546486=_0x136858?_0x3842a9[_0xe9ad('0x2b')]:_0x20b6fc[_0xe9ad('0x2c')]+_0x20b6fc[_0xe9ad('0x2a')];var _0x4e707e;if(_0x546486>=_0x353394){_0x546486=_0x353394;_0x4e707e=0xc8;}else{_0x4e707e=0xce;}_0x305f51[_0xe9ad('0x27')](_0x4e707e);return _0x305f51[_0xe9ad('0x2d')](_0xe9ad('0x2e'),_0x3d64ff+'-'+_0x546486+'/'+_0x353394)[_0xe9ad('0x2f')](_0x3842a9);}return null;};}function patchUpdates(_0x3e2ec5){return function(_0x400556){try{jsonpatch['apply'](_0x400556,_0x3e2ec5,!![]);}catch(_0x155a43){return BPromise['reject'](_0x155a43);}return _0x400556[_0xe9ad('0x30')]();};}function saveUpdates(_0x25117c,_0x180a37){return function(_0x2b4525){if(_0x2b4525){return _0x2b4525[_0xe9ad('0x31')](_0x25117c)[_0xe9ad('0x1c')](function(_0x430ad2){return _0x430ad2;});}return null;};}function removeEntity(_0x2e3de9,_0x546529){return function(_0x29ac2d){if(_0x29ac2d){return _0x29ac2d[_0xe9ad('0x32')]()[_0xe9ad('0x1c')](function(){_0x2e3de9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f987,_0x42dffc){return function(_0x230db5){if(!_0x230db5){_0x22f987[_0xe9ad('0x26')](0x194);}return _0x230db5;};}function handleError(_0x30d1a5,_0x1f5715){_0x1f5715=_0x1f5715||0x1f4;return function(_0x514a67){logger[_0xe9ad('0x22')](_0x514a67[_0xe9ad('0x33')]);if(_0x514a67[_0xe9ad('0x34')]){delete _0x514a67['name'];}_0x30d1a5['status'](_0x1f5715)['send'](_0x514a67);};}exports[_0xe9ad('0x35')]=function(_0x3e33fd,_0x510271){var _0x34f41e={},_0x270cb5={},_0x25576e={'count':0x0,'rows':[]};var _0x335a88=_[_0xe9ad('0x36')](db[_0xe9ad('0x37')][_0xe9ad('0x38')],function(_0xa27be1){return{'name':_0xa27be1[_0xe9ad('0x39')],'type':_0xa27be1[_0xe9ad('0x3a')][_0xe9ad('0x3b')]};});_0x270cb5['model']=_[_0xe9ad('0x36')](_0x335a88,_0xe9ad('0x34'));_0x270cb5[_0xe9ad('0x3c')]=_[_0xe9ad('0x3d')](_0x3e33fd[_0xe9ad('0x3c')]);_0x270cb5[_0xe9ad('0x3e')]=_[_0xe9ad('0x3f')](_0x270cb5['model'],_0x270cb5['query']);_0x34f41e[_0xe9ad('0x40')]=_[_0xe9ad('0x3f')](_0x270cb5[_0xe9ad('0x41')],qs['fields'](_0x3e33fd['query']['fields']));_0x34f41e[_0xe9ad('0x40')]=_0x34f41e[_0xe9ad('0x40')][_0xe9ad('0x42')]?_0x34f41e[_0xe9ad('0x40')]:_0x270cb5[_0xe9ad('0x41')];if(!_0x3e33fd['query']['hasOwnProperty'](_0xe9ad('0x43'))){_0x34f41e[_0xe9ad('0x2a')]=qs[_0xe9ad('0x2a')](_0x3e33fd[_0xe9ad('0x3c')][_0xe9ad('0x2a')]);_0x34f41e[_0xe9ad('0x2c')]=qs[_0xe9ad('0x2c')](_0x3e33fd['query']['offset']);}_0x34f41e[_0xe9ad('0x44')]=qs[_0xe9ad('0x45')](_0x3e33fd['query'][_0xe9ad('0x45')]);_0x34f41e['where']=qs['filters'](_[_0xe9ad('0x46')](_0x3e33fd['query'],_0x270cb5[_0xe9ad('0x3e')]),_0x335a88);if(_0x3e33fd[_0xe9ad('0x3c')]['filter']){_0x34f41e[_0xe9ad('0x47')]=_[_0xe9ad('0x48')](_0x34f41e[_0xe9ad('0x47')],{'$or':_[_0xe9ad('0x36')](_0x335a88,function(_0x10c138){if(_0x10c138[_0xe9ad('0x3a')]!==_0xe9ad('0x49')){var _0x5d0c26={};_0x5d0c26[_0x10c138['name']]={'$like':'%'+_0x3e33fd[_0xe9ad('0x3c')][_0xe9ad('0x4a')]+'%'};return _0x5d0c26;}})});}_0x34f41e=_[_0xe9ad('0x48')]({},_0x34f41e,_0x3e33fd['options']);var _0x1bf9f5={'where':_0x34f41e[_0xe9ad('0x47')]};return db[_0xe9ad('0x37')][_0xe9ad('0x2b')](_0x1bf9f5)[_0xe9ad('0x1c')](function(_0x3f6473){_0x25576e[_0xe9ad('0x2b')]=_0x3f6473;if(_0x3e33fd['query'][_0xe9ad('0x4b')]){_0x34f41e['include']=[{'all':!![]}];}return db[_0xe9ad('0x37')]['findAll'](_0x34f41e);})[_0xe9ad('0x1c')](function(_0x45c186){_0x25576e['rows']=_0x45c186;return _0x25576e;})['then'](respondWithFilteredResult(_0x510271,_0x34f41e))[_0xe9ad('0x25')](handleError(_0x510271,null));};exports[_0xe9ad('0x4c')]=function(_0x117ea2,_0x265a94){var _0x1d6785={'raw':![],'where':{'id':_0x117ea2[_0xe9ad('0x4d')]['id']}},_0x2ae79e={};_0x2ae79e[_0xe9ad('0x41')]=_['keys'](db[_0xe9ad('0x37')][_0xe9ad('0x38')]);_0x2ae79e[_0xe9ad('0x3c')]=_[_0xe9ad('0x3d')](_0x117ea2[_0xe9ad('0x3c')]);_0x2ae79e[_0xe9ad('0x3e')]=_[_0xe9ad('0x3f')](_0x2ae79e[_0xe9ad('0x41')],_0x2ae79e[_0xe9ad('0x3c')]);_0x1d6785[_0xe9ad('0x40')]=_['intersection'](_0x2ae79e[_0xe9ad('0x41')],qs[_0xe9ad('0x4e')](_0x117ea2[_0xe9ad('0x3c')][_0xe9ad('0x4e')]));_0x1d6785['attributes']=_0x1d6785['attributes'][_0xe9ad('0x42')]?_0x1d6785[_0xe9ad('0x40')]:_0x2ae79e[_0xe9ad('0x41')];if(_0x117ea2[_0xe9ad('0x3c')]['includeAll']){_0x1d6785['include']=[{'all':!![]}];}_0x1d6785=_[_0xe9ad('0x48')]({},_0x1d6785,_0x117ea2[_0xe9ad('0x4f')]);return db[_0xe9ad('0x37')][_0xe9ad('0x50')](_0x1d6785)[_0xe9ad('0x1c')](handleEntityNotFound(_0x265a94,null))['then'](respondWithResult(_0x265a94,null))['catch'](handleError(_0x265a94,null));};exports[_0xe9ad('0x31')]=function(_0x2942ce,_0x3e6e65){if(_0x2942ce[_0xe9ad('0x51')]['id']){delete _0x2942ce['body']['id'];}return db[_0xe9ad('0x37')][_0xe9ad('0x50')]({'where':{'id':_0x2942ce['params']['id']}})['then'](handleEntityNotFound(_0x3e6e65,null))['then'](saveUpdates(_0x2942ce[_0xe9ad('0x51')],null))[_0xe9ad('0x1c')](respondWithResult(_0x3e6e65,null))['catch'](handleError(_0x3e6e65,null));};exports[_0xe9ad('0x52')]=function(_0x55f04c,_0x1a6819,_0xc1a8bb){if(_0x55f04c[_0xe9ad('0x53')]&&_0x55f04c[_0xe9ad('0x53')][_0xe9ad('0x54')]){_0x55f04c[_0xe9ad('0x51')][_0xe9ad('0x55')]=_0x55f04c['file'][_0xe9ad('0x54')];}return db[_0xe9ad('0x37')]['find']({'where':{'id':_0x55f04c['params']['id']}})['then'](handleEntityNotFound(_0x1a6819,null))[_0xe9ad('0x1c')](saveUpdates(_0x55f04c[_0xe9ad('0x51')],null))[_0xe9ad('0x1c')](respondWithResult(_0x1a6819,null))[_0xe9ad('0x25')](handleError(_0x1a6819,null));};exports[_0xe9ad('0x56')]=function(_0x5704b9,_0x441b8d,_0x2a0cea){if(_0x5704b9[_0xe9ad('0x53')]&&_0x5704b9[_0xe9ad('0x53')]['filename']){_0x5704b9[_0xe9ad('0x51')][_0xe9ad('0x57')]=_0x5704b9[_0xe9ad('0x53')][_0xe9ad('0x54')];}return db['Setting'][_0xe9ad('0x50')]({'where':{'id':_0x5704b9[_0xe9ad('0x4d')]['id']}})[_0xe9ad('0x1c')](handleEntityNotFound(_0x441b8d,null))['then'](saveUpdates(_0x5704b9[_0xe9ad('0x51')],null))[_0xe9ad('0x1c')](respondWithResult(_0x441b8d,null))[_0xe9ad('0x25')](handleError(_0x441b8d,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x4fb08c,_0x5c0f13,_0x23b8b2){var _0xc76bb8='server/files/images/logos';var _0x5aea79={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1f6d6e){if(_0x1f6d6e){_0x5aea79=_0x1f6d6e;}return db[_0xe9ad('0x37')][_0xe9ad('0x50')]({'where':{'id':_0x4fb08c[_0xe9ad('0x4d')]['id']},'attributes':[_0xe9ad('0x55'),_0xe9ad('0x57'),_0xe9ad('0x58'),_0xe9ad('0x59'),_0xe9ad('0x5a'),_0xe9ad('0x5b'),_0xe9ad('0x5c'),_0xe9ad('0x5d')],'raw':!![]});})[_0xe9ad('0x1c')](handleEntityNotFound(_0x5c0f13,null))[_0xe9ad('0x1c')](function(_0x27bdbe){if(_0x27bdbe){var _0x2f71b6=_0x27bdbe['logo']&&fs[_0xe9ad('0x5e')](path['join'](config[_0xe9ad('0x5f')],_0xc76bb8,_[_0xe9ad('0x60')](_0x27bdbe[_0xe9ad('0x55')])))?path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0xc76bb8,_[_0xe9ad('0x60')](_0x27bdbe[_0xe9ad('0x55')])):path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0xc76bb8,_['toLower'](_0xe9ad('0x62')));var _0x501e36=_0xe9ad('0x63')+_[_0xe9ad('0x64')](_0xe9ad('0x55'));if(_0x27bdbe[_0x501e36]||!_0x5aea79['custom']){_0x2f71b6=path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0xc76bb8,_[_0xe9ad('0x60')](_0xe9ad('0x62')));}if(!fs[_0xe9ad('0x5e')](_0x2f71b6)){throw new db['Sequelize'][(_0xe9ad('0x65'))](_[_0xe9ad('0x64')](_0xe9ad('0x55'))+'\x20not\x20found');}return _0x5c0f13[_0xe9ad('0x66')](_0x2f71b6);}})[_0xe9ad('0x25')](handleError(_0x5c0f13,null));};var utilLicense=require(_0xe9ad('0x67'));exports[_0xe9ad('0x68')]=function(_0x3c0828,_0x5c4f5b,_0x2865fb){var _0x7143b0=_0xe9ad('0x69');var _0x2345ec={'custom':![]};return utilLicense[_0xe9ad('0x6a')]()['then'](function(_0x13cedb){if(_0x13cedb){_0x2345ec=_0x13cedb;}return db['Setting'][_0xe9ad('0x50')]({'where':{'id':_0x3c0828[_0xe9ad('0x4d')]['id']},'attributes':[_0xe9ad('0x55'),_0xe9ad('0x57'),_0xe9ad('0x58'),_0xe9ad('0x59'),'defaultLogo','defaultLoginLogo',_0xe9ad('0x5c'),_0xe9ad('0x5d')],'raw':!![]});})[_0xe9ad('0x1c')](handleEntityNotFound(_0x5c4f5b,null))[_0xe9ad('0x1c')](function(_0x32c478){if(_0x32c478){var _0xa71de9=_0x32c478[_0xe9ad('0x57')]&&fs[_0xe9ad('0x5e')](path[_0xe9ad('0x61')](config['root'],_0x7143b0,_[_0xe9ad('0x60')](_0x32c478[_0xe9ad('0x57')])))?path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x7143b0,_[_0xe9ad('0x60')](_0x32c478[_0xe9ad('0x57')])):path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x7143b0,_['toLower'](_0xe9ad('0x6b')));var _0x3d12f4=_0xe9ad('0x63')+_['upperFirst']('loginLogo');if(_0x32c478[_0x3d12f4]||!_0x2345ec['custom']){_0xa71de9=path[_0xe9ad('0x61')](config['root'],_0x7143b0,_[_0xe9ad('0x60')]('default_loginLogo.svg'));}if(!fs[_0xe9ad('0x5e')](_0xa71de9)){throw new db[(_0xe9ad('0x6c'))]['ValidationError'](_[_0xe9ad('0x64')](_0xe9ad('0x57'))+_0xe9ad('0x6d'));}return _0x5c4f5b['download'](_0xa71de9);}})['catch'](handleError(_0x5c4f5b,null));};exports[_0xe9ad('0x6e')]=function(_0x5cea08,_0x570948){return db[_0xe9ad('0x37')][_0xe9ad('0x50')]({'where':{'id':_0x5cea08[_0xe9ad('0x4d')]['id']},'attributes':[_0xe9ad('0x6f')]})[_0xe9ad('0x1c')](respondWithResult(_0x570948,null))[_0xe9ad('0x25')](handleError(_0x570948,null));};exports[_0xe9ad('0x70')]=function(_0x189573,_0x146d2e,_0xca20ae){if(_0x189573[_0xe9ad('0x53')]&&_0x189573[_0xe9ad('0x53')][_0xe9ad('0x54')]){_0x189573[_0xe9ad('0x51')][_0xe9ad('0x58')]=_0x189573[_0xe9ad('0x53')][_0xe9ad('0x54')];}return db[_0xe9ad('0x37')][_0xe9ad('0x50')]({'where':{'id':_0x189573['params']['id']}})[_0xe9ad('0x1c')](handleEntityNotFound(_0x146d2e,null))[_0xe9ad('0x1c')](saveUpdates(_0x189573[_0xe9ad('0x51')],null))[_0xe9ad('0x1c')](respondWithResult(_0x146d2e,null))[_0xe9ad('0x25')](handleError(_0x146d2e,null));};var utilLicense=require(_0xe9ad('0x67'));exports[_0xe9ad('0x71')]=function(_0x575519,_0x2be270,_0x427e0b){var _0x1c013a=_0xe9ad('0x69');var _0x1f5232={'custom':![]};return utilLicense[_0xe9ad('0x6a')]()[_0xe9ad('0x1c')](function(_0x19e296){if(_0x19e296){_0x1f5232=_0x19e296;}return db[_0xe9ad('0x37')][_0xe9ad('0x50')]({'where':{'id':_0x575519[_0xe9ad('0x4d')]['id']},'attributes':[_0xe9ad('0x55'),_0xe9ad('0x57'),_0xe9ad('0x58'),'favicon','defaultLogo',_0xe9ad('0x5b'),_0xe9ad('0x5c'),_0xe9ad('0x5d')],'raw':!![]});})[_0xe9ad('0x1c')](handleEntityNotFound(_0x2be270,null))[_0xe9ad('0x1c')](function(_0x4fa2cc){if(_0x4fa2cc){var _0x2964c4=_0x4fa2cc[_0xe9ad('0x58')]&&fs['existsSync'](path[_0xe9ad('0x61')](config['root'],_0x1c013a,_[_0xe9ad('0x60')](_0x4fa2cc['preferred'])))?path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x1c013a,_[_0xe9ad('0x60')](_0x4fa2cc[_0xe9ad('0x58')])):path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x1c013a,_[_0xe9ad('0x60')]('default_preferred.png'));var _0x25ca25=_0xe9ad('0x63')+_[_0xe9ad('0x64')](_0xe9ad('0x58'));if(_0x4fa2cc[_0x25ca25]||!_0x1f5232['custom']||!_0x1f5232['preferred']){_0x2964c4=path['join'](config[_0xe9ad('0x5f')],_0x1c013a,_['toLower']('default_preferred.png'));}if(!fs[_0xe9ad('0x5e')](_0x2964c4)){throw new db[(_0xe9ad('0x6c'))][(_0xe9ad('0x65'))](_[_0xe9ad('0x64')](_0xe9ad('0x58'))+_0xe9ad('0x6d'));}return _0x2be270[_0xe9ad('0x66')](_0x2964c4);}})['catch'](handleError(_0x2be270,null));};exports[_0xe9ad('0x72')]=function(_0x371953,_0x13fc69,_0x222946){if(_0x371953[_0xe9ad('0x53')]&&_0x371953[_0xe9ad('0x53')][_0xe9ad('0x54')]){_0x371953[_0xe9ad('0x51')][_0xe9ad('0x59')]=_0x371953[_0xe9ad('0x53')][_0xe9ad('0x54')];}return db[_0xe9ad('0x37')][_0xe9ad('0x50')]({'where':{'id':_0x371953[_0xe9ad('0x4d')]['id']}})[_0xe9ad('0x1c')](handleEntityNotFound(_0x13fc69,null))[_0xe9ad('0x1c')](saveUpdates(_0x371953[_0xe9ad('0x51')],null))[_0xe9ad('0x1c')](respondWithResult(_0x13fc69,null))[_0xe9ad('0x25')](handleError(_0x13fc69,null));};var utilLicense=require(_0xe9ad('0x67'));exports[_0xe9ad('0x73')]=function(_0x263e24,_0x3c112f,_0x3d70ab){var _0x192747=_0xe9ad('0x69');var _0x1ec346={'custom':![]};return utilLicense[_0xe9ad('0x6a')]()[_0xe9ad('0x1c')](function(_0x2c5e23){if(_0x2c5e23){_0x1ec346=_0x2c5e23;}return db['Setting'][_0xe9ad('0x50')]({'where':{'id':_0x263e24[_0xe9ad('0x4d')]['id']},'attributes':[_0xe9ad('0x55'),_0xe9ad('0x57'),_0xe9ad('0x58'),_0xe9ad('0x59'),_0xe9ad('0x5a'),'defaultLoginLogo','defaultPreferred',_0xe9ad('0x5d')],'raw':!![]});})[_0xe9ad('0x1c')](handleEntityNotFound(_0x3c112f,null))['then'](function(_0xdee33d){if(_0xdee33d){var _0x34d631=_0xdee33d[_0xe9ad('0x59')]&&fs[_0xe9ad('0x5e')](path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x192747,_[_0xe9ad('0x60')](_0xdee33d[_0xe9ad('0x59')])))?path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x192747,_[_0xe9ad('0x60')](_0xdee33d[_0xe9ad('0x59')])):path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x192747,_['toLower']('default_favicon.ico'));var _0x17b2c9=_0xe9ad('0x63')+_[_0xe9ad('0x64')](_0xe9ad('0x59'));if(_0xdee33d[_0x17b2c9]||!_0x1ec346[_0xe9ad('0x74')]){_0x34d631=path[_0xe9ad('0x61')](config[_0xe9ad('0x5f')],_0x192747,_['toLower'](_0xe9ad('0x75')));}if(!fs[_0xe9ad('0x5e')](_0x34d631)){throw new db['Sequelize'][(_0xe9ad('0x65'))](_[_0xe9ad('0x64')](_0xe9ad('0x59'))+_0xe9ad('0x6d'));}return _0x3c112f[_0xe9ad('0x66')](_0x34d631);}})[_0xe9ad('0x25')](handleError(_0x3c112f,null));};exports[_0xe9ad('0x76')]=function(_0x2b7efc,_0x1207f2){var _0x4d175e={'offset':moment()[_0xe9ad('0x77')]()};_0x4d175e[_0xe9ad('0x78')]=moment()[_0xe9ad('0x77')](_0x4d175e[_0xe9ad('0x2c')])[_0xe9ad('0x79')](_0xe9ad('0x7a'));return _0x1207f2['status'](0xc8)['send'](_0x4d175e);};
\ No newline at end of file
index 756d6f1..ecdcf9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1e1f5f,_0x535a02){var _0x46f7d5=function(_0x5c5e5e){while(--_0x5c5e5e){_0x1e1f5f['push'](_0x1e1f5f['shift']());}};_0x46f7d5(++_0x535a02);}(_0xe14b,0x93));var _0xbe14=function(_0x256198,_0x1d03e6){_0x256198=_0x256198-0x0;var _0x285a83=_0xe14b[_0x256198];return _0x285a83;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7f88451..aacf378 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf64d=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','ShowSetting','find','options','raw','include','map','model','attributes'];(function(_0x8a0140,_0x4a1b16){var _0x1be8a8=function(_0x3f18a9){while(--_0x3f18a9){_0x8a0140['push'](_0x8a0140['shift']());}};_0x1be8a8(++_0x4a1b16);}(_0xf64d,0x1d1));var _0xdf64=function(_0x40c5e0,_0x3b77ad){_0x40c5e0=_0x40c5e0-0x0;var _0x47ee12=_0xf64d[_0x40c5e0];return _0x47ee12;};'use strict';var _=require(_0xdf64('0x0'));var util=require(_0xdf64('0x1'));var moment=require(_0xdf64('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf64('0x3'));var db=require(_0xdf64('0x4'))['db'];var utils=require(_0xdf64('0x5'));var logger=require(_0xdf64('0x6'))(_0xdf64('0x7'));var config=require(_0xdf64('0x8'));var jayson=require(_0xdf64('0x9'));var client=jayson[_0xdf64('0xa')][_0xdf64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b59,_0x22d898,_0x40ebfe){return new BPromise(function(_0x339a32,_0x3c710d){return client[_0xdf64('0xc')](_0x33b59,_0x40ebfe)[_0xdf64('0xd')](function(_0x3fdf52){logger['info'](_0xdf64('0xe'),_0x22d898,_0xdf64('0xf'));logger[_0xdf64('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x22d898,'request\x20sent',JSON[_0xdf64('0x11')](_0x3fdf52));if(_0x3fdf52[_0xdf64('0x12')]){if(_0x3fdf52[_0xdf64('0x12')][_0xdf64('0x13')]===0x1f4){logger[_0xdf64('0x12')](_0xdf64('0xe'),_0x22d898,_0x3fdf52[_0xdf64('0x12')][_0xdf64('0x14')]);return _0x3c710d(_0x3fdf52[_0xdf64('0x12')][_0xdf64('0x14')]);}logger[_0xdf64('0x12')](_0xdf64('0xe'),_0x22d898,_0x3fdf52[_0xdf64('0x12')]['message']);return _0x339a32(_0x3fdf52[_0xdf64('0x12')][_0xdf64('0x14')]);}else{logger[_0xdf64('0x15')](_0xdf64('0xe'),_0x22d898,'request\x20sent');_0x339a32(_0x3fdf52['result']['message']);}})[_0xdf64('0x16')](function(_0x422747){logger[_0xdf64('0x12')]('Setting,\x20%s,\x20%s',_0x22d898,_0x422747);_0x3c710d(_0x422747);});});}exports[_0xdf64('0x17')]=function(_0x4317a1){var _0x2b4db9=this;return new Promise(function(_0x39440f,_0x407fa6){return db['Setting'][_0xdf64('0x18')]({'raw':_0x4317a1[_0xdf64('0x19')]?_0x4317a1[_0xdf64('0x19')][_0xdf64('0x1a')]===undefined?!![]:![]:!![],'where':_0x4317a1['options']?_0x4317a1['options']['where']||null:null,'attributes':_0x4317a1[_0xdf64('0x19')]?_0x4317a1[_0xdf64('0x19')]['attributes']||null:null,'include':_0x4317a1['options']?_0x4317a1[_0xdf64('0x19')][_0xdf64('0x1b')]?_[_0xdf64('0x1c')](_0x4317a1[_0xdf64('0x19')][_0xdf64('0x1b')],function(_0x3dcb41){return{'model':db[_0x3dcb41[_0xdf64('0x1d')]],'as':_0x3dcb41['as'],'attributes':_0x3dcb41[_0xdf64('0x1e')],'include':_0x3dcb41['include']?_[_0xdf64('0x1c')](_0x3dcb41[_0xdf64('0x1b')],function(_0x344d7e){return{'model':db[_0x344d7e[_0xdf64('0x1d')]],'as':_0x344d7e['as'],'attributes':_0x344d7e[_0xdf64('0x1e')],'include':_0x344d7e['include']?_[_0xdf64('0x1c')](_0x344d7e[_0xdf64('0x1b')],function(_0x4d9e8e){return{'model':db[_0x4d9e8e[_0xdf64('0x1d')]],'as':_0x4d9e8e['as'],'attributes':_0x4d9e8e[_0xdf64('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdf64('0xd')](function(_0x2f930a){logger['info'](_0xdf64('0x17'),_0x4317a1);logger[_0xdf64('0x10')](_0xdf64('0x17'),_0x4317a1,JSON[_0xdf64('0x11')](_0x2f930a));_0x39440f(_0x2f930a);})[_0xdf64('0x16')](function(_0x28b074){logger[_0xdf64('0x12')](_0xdf64('0x17'),_0x28b074[_0xdf64('0x14')],_0x4317a1);_0x407fa6(_0x2b4db9[_0xdf64('0x12')](0x1f4,_0x28b074['message']));});});};
\ No newline at end of file
+var _0xecd0=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Setting','options','raw','where','attributes','include','map','model','ShowSetting'];(function(_0x4edac5,_0x41d853){var _0x572b3b=function(_0x1cc65f){while(--_0x1cc65f){_0x4edac5['push'](_0x4edac5['shift']());}};_0x572b3b(++_0x41d853);}(_0xecd0,0x1ba));var _0x0ecd=function(_0x104993,_0x3f9a6b){_0x104993=_0x104993-0x0;var _0x105a96=_0xecd0[_0x104993];return _0x105a96;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ecd('0x0'));var fs=require('fs');var Redis=require(_0x0ecd('0x1'));var db=require(_0x0ecd('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0ecd('0x3'));var config=require('../../config/environment');var jayson=require(_0x0ecd('0x4'));var client=jayson[_0x0ecd('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x435fc8,_0x2a8bbd,_0x57ba55){return new BPromise(function(_0x6fe39c,_0xa17366){return client[_0x0ecd('0x6')](_0x435fc8,_0x57ba55)[_0x0ecd('0x7')](function(_0x1eec1e){logger[_0x0ecd('0x8')](_0x0ecd('0x9'),_0x2a8bbd,_0x0ecd('0xa'));logger['debug'](_0x0ecd('0xb'),_0x2a8bbd,_0x0ecd('0xa'),JSON[_0x0ecd('0xc')](_0x1eec1e));if(_0x1eec1e[_0x0ecd('0xd')]){if(_0x1eec1e[_0x0ecd('0xd')][_0x0ecd('0xe')]===0x1f4){logger[_0x0ecd('0xd')]('Setting,\x20%s,\x20%s',_0x2a8bbd,_0x1eec1e[_0x0ecd('0xd')][_0x0ecd('0xf')]);return _0xa17366(_0x1eec1e[_0x0ecd('0xd')]['message']);}logger[_0x0ecd('0xd')](_0x0ecd('0x9'),_0x2a8bbd,_0x1eec1e[_0x0ecd('0xd')]['message']);return _0x6fe39c(_0x1eec1e[_0x0ecd('0xd')][_0x0ecd('0xf')]);}else{logger[_0x0ecd('0x8')]('Setting,\x20%s,\x20%s',_0x2a8bbd,'request\x20sent');_0x6fe39c(_0x1eec1e['result']['message']);}})[_0x0ecd('0x10')](function(_0x24424e){logger[_0x0ecd('0xd')](_0x0ecd('0x9'),_0x2a8bbd,_0x24424e);_0xa17366(_0x24424e);});});}exports['ShowSetting']=function(_0x5da3a6){var _0x4697d0=this;return new Promise(function(_0x18d8ff,_0xf7e9bf){return db[_0x0ecd('0x11')]['find']({'raw':_0x5da3a6[_0x0ecd('0x12')]?_0x5da3a6[_0x0ecd('0x12')][_0x0ecd('0x13')]===undefined?!![]:![]:!![],'where':_0x5da3a6[_0x0ecd('0x12')]?_0x5da3a6['options'][_0x0ecd('0x14')]||null:null,'attributes':_0x5da3a6[_0x0ecd('0x12')]?_0x5da3a6['options'][_0x0ecd('0x15')]||null:null,'include':_0x5da3a6[_0x0ecd('0x12')]?_0x5da3a6[_0x0ecd('0x12')][_0x0ecd('0x16')]?_[_0x0ecd('0x17')](_0x5da3a6[_0x0ecd('0x12')][_0x0ecd('0x16')],function(_0x27f42d){return{'model':db[_0x27f42d[_0x0ecd('0x18')]],'as':_0x27f42d['as'],'attributes':_0x27f42d[_0x0ecd('0x15')],'include':_0x27f42d['include']?_['map'](_0x27f42d[_0x0ecd('0x16')],function(_0x481e5e){return{'model':db[_0x481e5e['model']],'as':_0x481e5e['as'],'attributes':_0x481e5e[_0x0ecd('0x15')],'include':_0x481e5e[_0x0ecd('0x16')]?_[_0x0ecd('0x17')](_0x481e5e[_0x0ecd('0x16')],function(_0x7d07ae){return{'model':db[_0x7d07ae[_0x0ecd('0x18')]],'as':_0x7d07ae['as'],'attributes':_0x7d07ae[_0x0ecd('0x15')]};}):[]};}):[]};}):[]:[]})[_0x0ecd('0x7')](function(_0x808100){logger['info'](_0x0ecd('0x19'),_0x5da3a6);logger['debug'](_0x0ecd('0x19'),_0x5da3a6,JSON[_0x0ecd('0xc')](_0x808100));_0x18d8ff(_0x808100);})[_0x0ecd('0x10')](function(_0x163aff){logger[_0x0ecd('0xd')](_0x0ecd('0x19'),_0x163aff[_0x0ecd('0xf')],_0x5da3a6);_0xf7e9bf(_0x4697d0['error'](0x1f4,_0x163aff[_0x0ecd('0xf')]));});});};
\ No newline at end of file
index 09678df..715ab96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7217,0x19e));var _0x7721=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7217[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x4e91b6,_0x3b38af){var _0x5caa6a=function(_0x37d47a){while(--_0x37d47a){_0x4e91b6['push'](_0x4e91b6['shift']());}};_0x5caa6a(++_0x3b38af);}(_0xabce,0x103));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router;
\ No newline at end of file
index a2383e2..cf136e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcea2=['clickatell','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','clicksend','plivo'];(function(_0x4eed5e,_0x30b1c4){var _0xc42f2a=function(_0x34d4aa){while(--_0x34d4aa){_0x4eed5e['push'](_0x4eed5e['shift']());}};_0xc42f2a(++_0x30b1c4);}(_0xcea2,0x1b9));var _0x2cea=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcea2[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x2cea('0x0'));var rs=require(_0x2cea('0x1'));module[_0x2cea('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2cea('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2cea('0x3')],'defaultValue':function(){return rs[_0x2cea('0x4')]();}},'phone':{'type':Sequelize[_0x2cea('0x3')]},'type':{'type':Sequelize[_0x2cea('0x5')]('twilio',_0x2cea('0x6'),'connectel',_0x2cea('0x7'),_0x2cea('0x8'),_0x2cea('0x9'),'bandwidth','csc',_0x2cea('0xa'),_0x2cea('0xb'))},'accountSid':{'type':Sequelize[_0x2cea('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x2cea('0x3')]},'smsMethod':{'type':Sequelize[_0x2cea('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2cea('0x3')]},'password':{'type':Sequelize[_0x2cea('0x3')]},'apiKey':{'type':Sequelize[_0x2cea('0x3')]},'applicationId':{'type':Sequelize[_0x2cea('0x3')]},'accountId':{'type':Sequelize[_0x2cea('0x3')]},'senderString':{'type':Sequelize[_0x2cea('0x3')]},'deliveryReport':{'type':Sequelize[_0x2cea('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x2cea('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2cea('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2cea('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2cea('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2cea('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2cea('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2cea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2cea('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2cea('0xe')],'comment':_0x2cea('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x11247f){if(!_0x11247f)this[_0x2cea('0x10')](_0x2cea('0x11'),null);this[_0x2cea('0x10')]('mandatoryDisposition',_0x11247f);}}};
\ No newline at end of file
+var _0xa3c5=['Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','TEXT'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xa3c5,0x1b5));var _0x5a3c=function(_0x9ea6f8,_0x2cb4b8){_0x9ea6f8=_0x9ea6f8-0x0;var _0x198153=_0xa3c5[_0x9ea6f8];return _0x198153;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5a3c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5a3c('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x5a3c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x5a3c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5a3c('0x2')]},'type':{'type':Sequelize[_0x5a3c('0x3')](_0x5a3c('0x4'),_0x5a3c('0x5'),'connectel',_0x5a3c('0x6'),_0x5a3c('0x7'),_0x5a3c('0x8'),'bandwidth',_0x5a3c('0x9'),'infobip',_0x5a3c('0xa'))},'accountSid':{'type':Sequelize[_0x5a3c('0x2')]},'authId':{'type':Sequelize[_0x5a3c('0x2')]},'authToken':{'type':Sequelize[_0x5a3c('0x2')]},'smsMethod':{'type':Sequelize[_0x5a3c('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5a3c('0x2')]},'password':{'type':Sequelize[_0x5a3c('0x2')]},'apiKey':{'type':Sequelize[_0x5a3c('0x2')]},'applicationId':{'type':Sequelize[_0x5a3c('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x5a3c('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x5a3c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5a3c('0xc')],'defaultValue':function(){return _0x5a3c('0xd');}},'notificationSound':{'type':Sequelize[_0x5a3c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5a3c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5a3c('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a3c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5a3c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a3c('0xe')],'comment':_0x5a3c('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e222a){if(!_0x3e222a)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5a3c('0x10')](_0x5a3c('0x11'),_0x3e222a);}}};
\ No newline at end of file
index 2e0c45c..4ce996d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e46=['DESC','defaults','out','user','Messages','spread','dataValues','push','inspect','skebby','skebby_dispatch_id','requestid','statusInt','groupName','clickatell','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','SmsAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','twilio','from','From','MessageSid','connectel','clicksend','messageId','message_id','Text','MessageUUID','infobip','results','text','csc','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','CmContact','Contacts','omit','contact','SmsInteraction','interaction','created','autoclose','applications','close','unmanaged','SmsMessage','ContactId','UserId','User','unshift','*,*,*,*','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','List'];(function(_0x55d245,_0xd72a83){var _0x2644e1=function(_0x463876){while(--_0x463876){_0x55d245['push'](_0x55d245['shift']());}};_0x2644e1(++_0xd72a83);}(_0x5e46,0x100));var _0x65e4=function(_0x26e58d,_0x7b9393){_0x26e58d=_0x26e58d-0x0;var _0x3b8a6e=_0x5e46[_0x26e58d];return _0x3b8a6e;};'use strict';var emlformat=require(_0x65e4('0x0'));var rimraf=require(_0x65e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65e4('0x2'));var moment=require(_0x65e4('0x3'));var BPromise=require(_0x65e4('0x4'));var Mustache=require('mustache');var util=require(_0x65e4('0x5'));var path=require('path');var sox=require(_0x65e4('0x6'));var csv=require(_0x65e4('0x7'));var ejs=require(_0x65e4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65e4('0x9'));var squel=require(_0x65e4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x65e4('0x7'));var querystring=require(_0x65e4('0xb'));var Papa=require(_0x65e4('0xc'));var Redis=require(_0x65e4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x65e4('0xe'));var as=require(_0x65e4('0xf'));var hardwareService=require(_0x65e4('0x10'));var logger=require(_0x65e4('0x11'))(_0x65e4('0x12'));var utils=require(_0x65e4('0x13'));var config=require(_0x65e4('0x14'));var licenseUtil=require(_0x65e4('0x15'));var db=require(_0x65e4('0x16'))['db'];config[_0x65e4('0x17')]=_['defaults'](config[_0x65e4('0x17')],{'host':_0x65e4('0x18'),'port':0x18eb});var socket=require(_0x65e4('0x19'))(new Redis(config['redis']));require(_0x65e4('0x1a'))[_0x65e4('0x1b')](socket);var jayson=require(_0x65e4('0x1c'));var client=jayson['client'][_0x65e4('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1cb9ca,_0x1423f9,_0x467dba,_0x496553){return new BPromise(function(_0x5dc106,_0x41aeeb){var _0x2b91f8=_0x496553||client;return _0x2b91f8[_0x65e4('0x1e')](_0x1cb9ca,_0x467dba)['then'](function(_0x4e7177){logger[_0x65e4('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x1423f9,_0x65e4('0x20'));logger[_0x65e4('0x21')](_0x65e4('0x22'),_0x1423f9,_0x65e4('0x20'),JSON[_0x65e4('0x23')](_0x4e7177));if(_0x4e7177[_0x65e4('0x24')]){if(_0x4e7177[_0x65e4('0x24')][_0x65e4('0x25')]===0x1f4){logger[_0x65e4('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1423f9,_0x4e7177[_0x65e4('0x24')][_0x65e4('0x26')]);return _0x41aeeb(_0x4e7177[_0x65e4('0x24')][_0x65e4('0x26')]);}logger['error'](_0x65e4('0x27'),_0x1423f9,_0x4e7177[_0x65e4('0x24')][_0x65e4('0x26')]);return _0x5dc106(_0x4e7177['error']['message']);}else{logger[_0x65e4('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x1423f9,_0x65e4('0x20'));_0x5dc106(_0x4e7177[_0x65e4('0x28')][_0x65e4('0x26')]);}})[_0x65e4('0x29')](function(_0xc5f35b){logger[_0x65e4('0x24')](_0x65e4('0x27'),_0x1423f9,_0xc5f35b);_0x41aeeb(_0xc5f35b);});});}function respondWithStatusCode(_0x484c48,_0x5af072){_0x5af072=_0x5af072||0xcc;return function(_0x142360){if(_0x142360){return _0x484c48[_0x65e4('0x2a')](_0x5af072);}return _0x484c48[_0x65e4('0x2b')](_0x5af072)[_0x65e4('0x2c')]();};}function respondWithResult(_0x475848,_0x4559a2){_0x4559a2=_0x4559a2||0xc8;return function(_0x25cd0c){if(_0x25cd0c){return _0x475848[_0x65e4('0x2b')](_0x4559a2)['json'](_0x25cd0c);}};}function respondWithFilteredResult(_0x4b2845,_0x4b7849){return function(_0x4fc09d){if(_0x4fc09d){var _0x22a80b=typeof _0x4b7849[_0x65e4('0x2d')]===_0x65e4('0x2e')&&typeof _0x4b7849['limit']===_0x65e4('0x2e');var _0x504813=_0x4fc09d[_0x65e4('0x2f')];var _0x1f1a56=_0x22a80b?0x0:_0x4b7849[_0x65e4('0x2d')];var _0x1be1ac=_0x22a80b?_0x4fc09d[_0x65e4('0x2f')]:_0x4b7849[_0x65e4('0x2d')]+_0x4b7849[_0x65e4('0x30')];var _0x3f66e5;if(_0x1be1ac>=_0x504813){_0x1be1ac=_0x504813;_0x3f66e5=0xc8;}else{_0x3f66e5=0xce;}_0x4b2845[_0x65e4('0x2b')](_0x3f66e5);return _0x4b2845[_0x65e4('0x31')](_0x65e4('0x32'),_0x1f1a56+'-'+_0x1be1ac+'/'+_0x504813)[_0x65e4('0x33')](_0x4fc09d);}return null;};}function patchUpdates(_0x1290b6){return function(_0x144f3b){try{jsonpatch[_0x65e4('0x34')](_0x144f3b,_0x1290b6,!![]);}catch(_0x5797cd){return BPromise[_0x65e4('0x35')](_0x5797cd);}return _0x144f3b[_0x65e4('0x36')]();};}function saveUpdates(_0xa277f2,_0x3eb867){return function(_0x4b50f4){if(_0x4b50f4){return _0x4b50f4['update'](_0xa277f2)[_0x65e4('0x37')](function(_0x4b5233){return _0x4b5233;});}return null;};}function removeEntity(_0x11ae4c,_0xb97738){return function(_0x2c8b41){if(_0x2c8b41){return _0x2c8b41[_0x65e4('0x38')]()[_0x65e4('0x37')](function(){var _0x19194e=_0x2c8b41[_0x65e4('0x39')]({'plain':!![]});var _0xa2fd46=_0x65e4('0x3a');return db[_0x65e4('0x3b')][_0x65e4('0x38')]({'where':{'type':_0xa2fd46,'resourceId':_0x19194e['id']}})[_0x65e4('0x37')](function(){return _0x2c8b41;});})[_0x65e4('0x37')](function(){_0x11ae4c[_0x65e4('0x2b')](0xcc)[_0x65e4('0x2c')]();});}};}function handleEntityNotFound(_0x406699,_0x189572){return function(_0x3d0a3d){if(!_0x3d0a3d){_0x406699['sendStatus'](0x194);}return _0x3d0a3d;};}function handleError(_0x2fca3b,_0x629e39){_0x629e39=_0x629e39||0x1f4;return function(_0xf8ec7f){logger[_0x65e4('0x24')](_0xf8ec7f[_0x65e4('0x3c')]);if(_0xf8ec7f[_0x65e4('0x3d')]){delete _0xf8ec7f['name'];}_0x2fca3b['status'](_0x629e39)[_0x65e4('0x3e')](_0xf8ec7f);};}exports[_0x65e4('0x3f')]=function(_0x23c405,_0x370175){var _0x2c8711={'include':[{'model':db[_0x65e4('0x40')],'as':_0x65e4('0x41')}]},_0x145cc8={},_0x44b910={'count':0x0,'rows':[]};var _0x169b68=_[_0x65e4('0x42')](db[_0x65e4('0x43')][_0x65e4('0x44')],function(_0x42fab5){return{'name':_0x42fab5[_0x65e4('0x45')],'type':_0x42fab5[_0x65e4('0x46')][_0x65e4('0x47')]};});_0x145cc8[_0x65e4('0x48')]=_[_0x65e4('0x42')](_0x169b68,'name');_0x145cc8[_0x65e4('0x49')]=_['keys'](_0x23c405[_0x65e4('0x49')]);_0x145cc8[_0x65e4('0x4a')]=_[_0x65e4('0x4b')](_0x145cc8['model'],_0x145cc8[_0x65e4('0x49')]);_0x2c8711['attributes']=_[_0x65e4('0x4b')](_0x145cc8[_0x65e4('0x48')],qs[_0x65e4('0x4c')](_0x23c405[_0x65e4('0x49')][_0x65e4('0x4c')]));_0x2c8711['attributes']=_0x2c8711[_0x65e4('0x4d')][_0x65e4('0x4e')]?_0x2c8711['attributes']:_0x145cc8[_0x65e4('0x48')];if(!_0x23c405[_0x65e4('0x49')]['hasOwnProperty'](_0x65e4('0x4f'))){_0x2c8711[_0x65e4('0x30')]=qs[_0x65e4('0x30')](_0x23c405[_0x65e4('0x49')][_0x65e4('0x30')]);_0x2c8711[_0x65e4('0x2d')]=qs['offset'](_0x23c405[_0x65e4('0x49')][_0x65e4('0x2d')]);}_0x2c8711['order']=qs[_0x65e4('0x50')](_0x23c405[_0x65e4('0x49')][_0x65e4('0x50')]);_0x2c8711[_0x65e4('0x51')]=qs['filters'](_[_0x65e4('0x52')](_0x23c405[_0x65e4('0x49')],_0x145cc8[_0x65e4('0x4a')]),_0x169b68);if(_0x23c405[_0x65e4('0x49')]['filter']){_0x2c8711[_0x65e4('0x51')]=_[_0x65e4('0x53')](_0x2c8711[_0x65e4('0x51')],{'$or':_[_0x65e4('0x42')](_0x169b68,function(_0xc1cd72){if(_0xc1cd72[_0x65e4('0x46')]!==_0x65e4('0x54')){var _0x52352f={};_0x52352f[_0xc1cd72[_0x65e4('0x3d')]]={'$like':'%'+_0x23c405[_0x65e4('0x49')][_0x65e4('0x55')]+'%'};return _0x52352f;}})});}_0x2c8711=_[_0x65e4('0x53')]({},_0x2c8711,_0x23c405[_0x65e4('0x56')]);var _0x4858f7={'where':_0x2c8711[_0x65e4('0x51')]};return db[_0x65e4('0x43')][_0x65e4('0x2f')](_0x4858f7)['then'](function(_0xca4e88){_0x44b910[_0x65e4('0x2f')]=_0xca4e88;if(_0x23c405[_0x65e4('0x49')][_0x65e4('0x57')]){_0x2c8711[_0x65e4('0x58')]=[{'all':!![]}];}return db[_0x65e4('0x43')]['findAll'](_0x2c8711);})[_0x65e4('0x37')](function(_0x40f6de){_0x44b910[_0x65e4('0x59')]=_0x40f6de;return _0x44b910;})['then'](respondWithFilteredResult(_0x370175,_0x2c8711))[_0x65e4('0x29')](handleError(_0x370175,null));};exports['show']=function(_0x3925bd,_0x450842){var _0x7875cd={'raw':![],'where':{'id':_0x3925bd[_0x65e4('0x5a')]['id']},'include':[{'model':db[_0x65e4('0x40')],'as':'mandatoryDispositionPause'}]},_0x164c4f={};_0x164c4f[_0x65e4('0x48')]=_['keys'](db[_0x65e4('0x43')][_0x65e4('0x44')]);_0x164c4f[_0x65e4('0x49')]=_[_0x65e4('0x5b')](_0x3925bd['query']);_0x164c4f[_0x65e4('0x4a')]=_['intersection'](_0x164c4f[_0x65e4('0x48')],_0x164c4f[_0x65e4('0x49')]);_0x7875cd[_0x65e4('0x4d')]=_['intersection'](_0x164c4f[_0x65e4('0x48')],qs[_0x65e4('0x4c')](_0x3925bd[_0x65e4('0x49')][_0x65e4('0x4c')]));_0x7875cd[_0x65e4('0x4d')]=_0x7875cd[_0x65e4('0x4d')][_0x65e4('0x4e')]?_0x7875cd[_0x65e4('0x4d')]:_0x164c4f[_0x65e4('0x48')];if(_0x3925bd[_0x65e4('0x49')][_0x65e4('0x57')]){_0x7875cd[_0x65e4('0x58')]=[{'all':!![]}];}_0x7875cd=_[_0x65e4('0x53')]({},_0x7875cd,_0x3925bd[_0x65e4('0x56')]);return db[_0x65e4('0x43')]['find'](_0x7875cd)[_0x65e4('0x37')](handleEntityNotFound(_0x450842,null))[_0x65e4('0x37')](respondWithResult(_0x450842,null))['catch'](handleError(_0x450842,null));};exports[_0x65e4('0x5c')]=function(_0x1e2dbb,_0x30b068){return db[_0x65e4('0x43')][_0x65e4('0x5c')](_0x1e2dbb[_0x65e4('0x5d')],{})[_0x65e4('0x37')](function(_0x2f3abc){var _0x26f95e=_0x1e2dbb['user'][_0x65e4('0x39')]({'plain':!![]});if(!_0x26f95e)throw new Error(_0x65e4('0x5e'));if(_0x26f95e['role']==='user'){var _0x2c3e37=_0x2f3abc[_0x65e4('0x39')]({'plain':!![]});var _0x50d6f4='SmsAccounts';return db[_0x65e4('0x5f')]['find']({'where':{'name':_0x50d6f4,'userProfileId':_0x26f95e['userProfileId']},'raw':!![]})[_0x65e4('0x37')](function(_0x10ba0c){if(_0x10ba0c&&_0x10ba0c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2c3e37['name'],'resourceId':_0x2c3e37['id'],'type':_0x10ba0c[_0x65e4('0x3d')],'sectionId':_0x10ba0c['id']},{})[_0x65e4('0x37')](function(){return _0x2f3abc;});}else{return _0x2f3abc;}})[_0x65e4('0x29')](function(_0x14e8b9){logger[_0x65e4('0x24')](_0x65e4('0x60'),_0x14e8b9);throw _0x14e8b9;});}return _0x2f3abc;})[_0x65e4('0x37')](respondWithResult(_0x30b068,0xc9))['catch'](handleError(_0x30b068,null));};exports[_0x65e4('0x61')]=function(_0x427955,_0xb70d1f){if(_0x427955[_0x65e4('0x5d')]['id']){delete _0x427955[_0x65e4('0x5d')]['id'];}return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x427955['params']['id']},'include':[{'model':db[_0x65e4('0x40')],'as':_0x65e4('0x41')}]})[_0x65e4('0x37')](handleEntityNotFound(_0xb70d1f,null))[_0x65e4('0x37')](saveUpdates(_0x427955[_0x65e4('0x5d')],null))[_0x65e4('0x37')](respondWithResult(_0xb70d1f,null))['catch'](handleError(_0xb70d1f,null));};exports[_0x65e4('0x38')]=function(_0x31f94f,_0x2677b8){return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x31f94f[_0x65e4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2677b8,null))[_0x65e4('0x37')](removeEntity(_0x2677b8,null))[_0x65e4('0x29')](handleError(_0x2677b8,null));};exports[_0x65e4('0x63')]=function(_0x57162e,_0x17d36d){return db[_0x65e4('0x43')]['describe']()['then'](respondWithResult(_0x17d36d,null))[_0x65e4('0x29')](handleError(_0x17d36d,null));};exports['addDisposition']=function(_0x310213,_0x2ffd68,_0x1494af){if(_0x310213[_0x65e4('0x5d')]['id']){delete _0x310213['body']['id'];}return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x310213['params']['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x2ffd68,null))[_0x65e4('0x37')](function(_0x7df3b1){if(_0x7df3b1){_0x310213[_0x65e4('0x5d')][_0x65e4('0x64')]=_0x7df3b1['id'];return db[_0x65e4('0x65')][_0x65e4('0x5c')](_0x310213[_0x65e4('0x5d')]);}})[_0x65e4('0x37')](respondWithResult(_0x2ffd68,null))[_0x65e4('0x29')](handleError(_0x2ffd68,null));};exports[_0x65e4('0x66')]=function(_0x45ecb9,_0x248fb4,_0x1da632){var _0x33fc0c={'raw':![],'where':{}};var _0x340232={};var _0x6d7c1f={'count':0x0,'rows':[]};return db[_0x65e4('0x43')][_0x65e4('0x67')]({'where':{'id':_0x45ecb9[_0x65e4('0x5a')]['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x248fb4,null))[_0x65e4('0x37')](function(_0x287f41){if(_0x287f41){_0x340232[_0x65e4('0x48')]=_['keys'](db[_0x65e4('0x65')][_0x65e4('0x44')]);_0x340232[_0x65e4('0x49')]=_[_0x65e4('0x5b')](_0x45ecb9[_0x65e4('0x49')]);_0x340232['filters']=_['intersection'](_0x340232['model'],_0x340232[_0x65e4('0x49')]);_0x33fc0c['attributes']=_[_0x65e4('0x4b')](_0x340232[_0x65e4('0x48')],qs[_0x65e4('0x4c')](_0x45ecb9['query']['fields']));_0x33fc0c['attributes']=_0x33fc0c[_0x65e4('0x4d')][_0x65e4('0x4e')]?_0x33fc0c['attributes']:_0x340232[_0x65e4('0x48')];if(!_0x45ecb9[_0x65e4('0x49')]['hasOwnProperty'](_0x65e4('0x4f'))){_0x33fc0c[_0x65e4('0x30')]=qs[_0x65e4('0x30')](_0x45ecb9[_0x65e4('0x49')][_0x65e4('0x30')]);_0x33fc0c[_0x65e4('0x2d')]=qs[_0x65e4('0x2d')](_0x45ecb9[_0x65e4('0x49')][_0x65e4('0x2d')]);}_0x33fc0c[_0x65e4('0x68')]=qs['sort'](_0x45ecb9['query'][_0x65e4('0x50')]);_0x33fc0c[_0x65e4('0x51')]=qs[_0x65e4('0x4a')](_[_0x65e4('0x52')](_0x45ecb9[_0x65e4('0x49')],_0x340232[_0x65e4('0x4a')]));_0x33fc0c[_0x65e4('0x51')][_0x65e4('0x64')]=_0x287f41['id'];if(_0x45ecb9[_0x65e4('0x49')]['filter']){_0x33fc0c[_0x65e4('0x51')]=_[_0x65e4('0x53')](_0x33fc0c[_0x65e4('0x51')],{'$or':_[_0x65e4('0x42')](_0x33fc0c['attributes'],function(_0x52e81b){var _0x85ad75={};_0x85ad75[_0x52e81b]={'$like':'%'+_0x45ecb9[_0x65e4('0x49')][_0x65e4('0x55')]+'%'};return _0x85ad75;})});}_0x33fc0c=_[_0x65e4('0x53')]({},_0x33fc0c,_0x45ecb9[_0x65e4('0x56')]);return db['Disposition'][_0x65e4('0x2f')]({'where':_0x33fc0c[_0x65e4('0x51')]})[_0x65e4('0x37')](function(_0x2be17c){_0x6d7c1f[_0x65e4('0x2f')]=_0x2be17c;if(_0x45ecb9[_0x65e4('0x49')][_0x65e4('0x57')]){_0x33fc0c['include']=[{'all':!![]}];}return db[_0x65e4('0x65')][_0x65e4('0x69')](_0x33fc0c);})['then'](function(_0x4b9e61){_0x6d7c1f[_0x65e4('0x59')]=_0x4b9e61;return _0x6d7c1f;});}})[_0x65e4('0x37')](respondWithFilteredResult(_0x248fb4,_0x33fc0c))['catch'](handleError(_0x248fb4,null));};exports['removeDispositions']=function(_0x495af6,_0x190acd,_0x548c17){return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x495af6[_0x65e4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x190acd,null))['then'](function(_0x251f0b){if(_0x251f0b){return _0x251f0b[_0x65e4('0x6a')](_0x495af6['query'][_0x65e4('0x6b')]);}})[_0x65e4('0x37')](respondWithStatusCode(_0x190acd,null))[_0x65e4('0x29')](handleError(_0x190acd,null));};exports[_0x65e4('0x6c')]=function(_0x186c6e,_0x2fa486,_0x47f463){if(_0x186c6e[_0x65e4('0x5d')]['id']){delete _0x186c6e['body']['id'];}return db[_0x65e4('0x43')]['find']({'where':{'id':_0x186c6e['params']['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x2fa486,null))[_0x65e4('0x37')](function(_0x2503ef){if(_0x2503ef){_0x186c6e[_0x65e4('0x5d')][_0x65e4('0x64')]=_0x2503ef['id'];return db[_0x65e4('0x6d')][_0x65e4('0x5c')](_0x186c6e['body']);}})[_0x65e4('0x37')](respondWithResult(_0x2fa486,null))['catch'](handleError(_0x2fa486,null));};exports[_0x65e4('0x6e')]=function(_0x1b97ff,_0x32532e,_0x3371ac){var _0x31ca36={'raw':![],'where':{}};var _0x2f102d={};var _0x5764de={'count':0x0,'rows':[]};return db['SmsAccount'][_0x65e4('0x67')]({'where':{'id':_0x1b97ff[_0x65e4('0x5a')]['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x32532e,null))[_0x65e4('0x37')](function(_0x1c06c0){if(_0x1c06c0){_0x2f102d[_0x65e4('0x48')]=_[_0x65e4('0x5b')](db['CannedAnswer'][_0x65e4('0x44')]);_0x2f102d[_0x65e4('0x49')]=_['keys'](_0x1b97ff['query']);_0x2f102d[_0x65e4('0x4a')]=_[_0x65e4('0x4b')](_0x2f102d['model'],_0x2f102d[_0x65e4('0x49')]);_0x31ca36[_0x65e4('0x4d')]=_[_0x65e4('0x4b')](_0x2f102d['model'],qs[_0x65e4('0x4c')](_0x1b97ff['query'][_0x65e4('0x4c')]));_0x31ca36['attributes']=_0x31ca36['attributes'][_0x65e4('0x4e')]?_0x31ca36[_0x65e4('0x4d')]:_0x2f102d[_0x65e4('0x48')];if(!_0x1b97ff[_0x65e4('0x49')][_0x65e4('0x6f')](_0x65e4('0x4f'))){_0x31ca36[_0x65e4('0x30')]=qs['limit'](_0x1b97ff[_0x65e4('0x49')][_0x65e4('0x30')]);_0x31ca36[_0x65e4('0x2d')]=qs[_0x65e4('0x2d')](_0x1b97ff[_0x65e4('0x49')][_0x65e4('0x2d')]);}_0x31ca36[_0x65e4('0x68')]=qs[_0x65e4('0x50')](_0x1b97ff[_0x65e4('0x49')][_0x65e4('0x50')]);_0x31ca36[_0x65e4('0x51')]=qs[_0x65e4('0x4a')](_[_0x65e4('0x52')](_0x1b97ff[_0x65e4('0x49')],_0x2f102d[_0x65e4('0x4a')]));_0x31ca36[_0x65e4('0x51')][_0x65e4('0x64')]=_0x1c06c0['id'];if(_0x1b97ff['query'][_0x65e4('0x55')]){_0x31ca36[_0x65e4('0x51')]=_[_0x65e4('0x53')](_0x31ca36[_0x65e4('0x51')],{'$or':_[_0x65e4('0x42')](_0x31ca36[_0x65e4('0x4d')],function(_0x23d790){var _0x60bfe4={};_0x60bfe4[_0x23d790]={'$like':'%'+_0x1b97ff[_0x65e4('0x49')][_0x65e4('0x55')]+'%'};return _0x60bfe4;})});}_0x31ca36=_[_0x65e4('0x53')]({},_0x31ca36,_0x1b97ff[_0x65e4('0x56')]);return db[_0x65e4('0x6d')][_0x65e4('0x2f')]({'where':_0x31ca36['where']})[_0x65e4('0x37')](function(_0x2e5120){_0x5764de[_0x65e4('0x2f')]=_0x2e5120;if(_0x1b97ff[_0x65e4('0x49')][_0x65e4('0x57')]){_0x31ca36[_0x65e4('0x58')]=[{'all':!![]}];}return db[_0x65e4('0x6d')]['findAll'](_0x31ca36);})[_0x65e4('0x37')](function(_0x3d5e7f){_0x5764de['rows']=_0x3d5e7f;return _0x5764de;});}})[_0x65e4('0x37')](respondWithFilteredResult(_0x32532e,_0x31ca36))['catch'](handleError(_0x32532e,null));};exports[_0x65e4('0x70')]=function(_0xa94394,_0x33aad2,_0x54c1fe){return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0xa94394[_0x65e4('0x5a')]['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x33aad2,null))[_0x65e4('0x37')](function(_0x515091){if(_0x515091){return _0x515091[_0x65e4('0x70')](_0xa94394[_0x65e4('0x49')][_0x65e4('0x6b')]);}})[_0x65e4('0x37')](respondWithStatusCode(_0x33aad2,null))[_0x65e4('0x29')](handleError(_0x33aad2,null));};exports[_0x65e4('0x71')]=function(_0x2f048a,_0x5c09d4,_0x1b7dbf){var _0x1898ec={'channel':_0x65e4('0x72')};var _0x53b2b4=[];var _0x934ba0=[];var _0x1e6059={};return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x2f048a['params']['id']},'include':[{'model':db[_0x65e4('0x73')],'as':_0x65e4('0x74')}]})['then'](handleEntityNotFound(_0x5c09d4,null))[_0x65e4('0x37')](function(_0x52a442){_0x1898ec[_0x65e4('0x75')]=_0x52a442;_0x1898ec['applications']=_[_0x65e4('0x76')](_0x52a442[_0x65e4('0x74')],[_0x65e4('0x77')],[_0x65e4('0x78')]);if(_0x1898ec['account'][_0x65e4('0x74')]){delete _0x1898ec[_0x65e4('0x75')]['Applications'];}return db['CmContact'][_0x65e4('0x63')]();})[_0x65e4('0x37')](function(_0x11ba43){if(!_0x11ba43){throw new db[(_0x65e4('0x79'))][(_0x65e4('0x7a'))](_0x65e4('0x7b'));}_0x53b2b4=_['difference'](_[_0x65e4('0x5b')](_0x11ba43),[_0x65e4('0x7c'),_0x65e4('0x7d')]);_0x934ba0=_[_0x65e4('0x7e')](_[_0x65e4('0x5b')](_0x11ba43),[_0x65e4('0x7c'),_0x65e4('0x7d'),'CompanyId','ListId']);_0x1898ec[_0x65e4('0x5d')]={'mapKey':'mobile'};if(_0x1898ec['account'][_0x65e4('0x46')]){switch(_0x1898ec[_0x65e4('0x75')]['type']){case _0x65e4('0x7f'):_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x81')];_0x1898ec['body'][_0x65e4('0x5d')]=_0x2f048a[_0x65e4('0x5d')]['Body'];_0x1898ec[_0x65e4('0x5d')]['messageId']=_0x2f048a['body'][_0x65e4('0x82')];break;case'skebby':_0x1898ec['body'][_0x65e4('0x80')]='+'+_0x2f048a[_0x65e4('0x5d')]['sender'];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x5d')]=_0x2f048a[_0x65e4('0x5d')]['text'];break;case _0x65e4('0x83'):_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x80')];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x5d')]=_0x2f048a[_0x65e4('0x5d')]['message'];break;case _0x65e4('0x84'):_0x1898ec['body'][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x80')];_0x1898ec[_0x65e4('0x5d')]['body']=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x5d')];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x85')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x86')];break;case'plivo':_0x1898ec['body'][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x81')];_0x1898ec[_0x65e4('0x5d')]['body']=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x87')];_0x1898ec['body'][_0x65e4('0x85')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x88')];break;case _0x65e4('0x89'):_0x1898ec['body']['from']='+'+_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x8a')][0x0]['from'];_0x1898ec['body'][_0x65e4('0x5d')]=_0x2f048a['body']['results'][0x0][_0x65e4('0x8b')];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x85')]=_0x2f048a[_0x65e4('0x5d')]['results'][0x0][_0x65e4('0x85')];break;case _0x65e4('0x8c'):_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')]['originatingAddress'];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x5d')]=_0x2f048a[_0x65e4('0x5d')]['segmentedMessage'][_0x65e4('0x26')];break;case'clickatell':_0x1898ec['body'][_0x65e4('0x80')]=_0x2f048a['body'][_0x65e4('0x8d')];_0x1898ec['body']['body']=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x8b')];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x85')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x8e')];break;case _0x65e4('0x8f'):_0x1898ec['body'][_0x65e4('0x85')]=_0x2f048a[_0x65e4('0x5d')][0x0][_0x65e4('0x26')]['id'];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')][0x0]['message'][_0x65e4('0x80')];_0x1898ec['body'][_0x65e4('0x5d')]=_0x2f048a['body'][0x0][_0x65e4('0x26')]['text'];break;case _0x65e4('0x90'):_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x80')];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x5d')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x26')];_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x85')]=_0x2f048a[_0x65e4('0x5d')][_0x65e4('0x91')];break;}}if(_0x1898ec[_0x65e4('0x5d')]['id']){delete _0x1898ec['body']['id'];}if(_[_0x65e4('0x92')](_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')])){throw new db['Sequelize'][(_0x65e4('0x7a'))](_0x65e4('0x93'));}if(_[_0x65e4('0x92')](_0x1898ec[_0x65e4('0x5d')]['body'])||_0x1898ec['body'][_0x65e4('0x5d')]===''){throw new db[(_0x65e4('0x79'))][(_0x65e4('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x65e4('0x92')](_0x1898ec[_0x65e4('0x5d')]['mapKey'])){throw new db[(_0x65e4('0x79'))][(_0x65e4('0x7a'))](_0x65e4('0x94')+_0x934ba0);}if(!_[_0x65e4('0x95')](_0x934ba0,_0x1898ec['body'][_0x65e4('0x96')])){throw new db[(_0x65e4('0x79'))][(_0x65e4('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x934ba0);}_0x1e6059[_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x96')]]=_0x1898ec['body'][_0x65e4('0x80')];return db[_0x65e4('0x97')][_0x65e4('0x62')]({'where':{'id':_0x1898ec['account']['ListId']},'include':[{'model':db[_0x65e4('0x98')],'as':_0x65e4('0x99'),'where':_0x1e6059,'limit':0x1,'order':[[_0x65e4('0x7d'),'DESC']]}]});})[_0x65e4('0x37')](handleEntityNotFound(_0x5c09d4,null))[_0x65e4('0x37')](function(_0x37909e){if(_0x37909e){_0x1898ec['list']=_[_0x65e4('0x9a')](_0x37909e,[_0x65e4('0x99')]);if(_0x37909e[_0x65e4('0x99')]['length']){return _0x37909e[_0x65e4('0x99')][0x0];}var _0x3824d0=_['defaults'](_0x1898ec[_0x65e4('0x5d')],{'firstName':_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')],'ListId':_0x37909e['id']});_0x3824d0[_0x1898ec['body']['mapKey']]=_0x1898ec[_0x65e4('0x5d')]['from'];return db[_0x65e4('0x98')][_0x65e4('0x5c')](_0x3824d0,{'fields':_0x53b2b4,'raw':!![]});}})[_0x65e4('0x37')](handleEntityNotFound(_0x5c09d4,null))[_0x65e4('0x37')](function(_0xa0aab2){if(_0xa0aab2){_0x1898ec[_0x65e4('0x9b')]=_0xa0aab2;var _0x21ddaa={'ContactId':_0xa0aab2['id'],'phone':_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')],'SmsAccountId':_0x2f048a['params']['id']};var _0x41b3d1={'ContactId':_0xa0aab2['id'],'SmsAccountId':_0x2f048a['params']['id'],'closed':![]};return db[_0x65e4('0x9c')][_0x65e4('0x62')]({'where':_0x41b3d1})[_0x65e4('0x37')](function(_0x634a77){if(_0x634a77){return[_0x634a77,![]];}return db[_0x65e4('0x9c')][_0x65e4('0x5c')](_0x21ddaa)['then'](function(_0x1354a6){return[_0x1354a6,!![]];});});}})['spread'](function(_0x4982b3,_0x65b216){_0x1898ec[_0x65e4('0x9d')]=_0x4982b3[_0x65e4('0x39')]({'plain':!![]});_0x1898ec[_0x65e4('0x9d')][_0x65e4('0x9e')]=![];if(_0x65b216){if(_0x1898ec[_0x65e4('0x75')][_0x65e4('0x9f')]){_0x1898ec['applications']['push']({'id':0x0,'priority':_0x1898ec[_0x65e4('0xa0')][_0x65e4('0x4e')]+0x1,'app':_0x65e4('0xa1'),'appdata':_0x65e4('0xa2'),'interval':'*,*,*,*'});}_0x1898ec['interaction'][_0x65e4('0x9e')]=!![];}return db[_0x65e4('0xa3')][_0x65e4('0x5c')]({'phone':_0x1898ec[_0x65e4('0x5d')][_0x65e4('0x80')],'messageId':_0x1898ec['body'][_0x65e4('0x85')],'body':_0x1898ec['body']['body'],'SmsAccountId':_0x2f048a[_0x65e4('0x5a')]['id'],'SmsInteractionId':_0x4982b3['id'],'direction':'in','ContactId':_0x4982b3[_0x65e4('0xa4')],'AttachmentId':_0x1898ec[_0x65e4('0x5d')]['AttachmentId']});})['then'](function(_0x596b1a){_0x1898ec['message']=_0x596b1a;if(_0x1898ec['interaction'][_0x65e4('0xa5')]){return db[_0x65e4('0xa6')]['find']({'attributes':['id',_0x65e4('0x3d')],'where':{'id':_0x1898ec[_0x65e4('0x9d')][_0x65e4('0xa5')]}})[_0x65e4('0x37')](function(_0x1743d1){if(_0x1743d1){_0x1898ec[_0x65e4('0xa0')][_0x65e4('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1743d1[_0x65e4('0x3d')]+','+(_0x1898ec[_0x65e4('0x75')]['waitForTheAssignedAgent']||0xa),'interval':_0x65e4('0xa8')});}return respondWithRpcPromise(_0x65e4('0xa9'),_0x65e4('0xaa'),_0x1898ec);});}return respondWithRpcPromise(_0x65e4('0xa9'),_0x65e4('0xaa'),_0x1898ec);})[_0x65e4('0x37')](function(_0x5dba52){if(_0x5dba52){var _0x2368de=0xc8;var _0x20b6ab='receiveMessage';logger['info'](_0x65e4('0x22'),_0x20b6ab,_0x2368de,_0x65e4('0xab'));logger[_0x65e4('0x21')](_0x65e4('0xac'),_0x20b6ab,_0x2368de,_0x65e4('0xab'),JSON[_0x65e4('0x23')](_0x5dba52));if(_0x1898ec[_0x65e4('0x75')]['type']===_0x65e4('0x7f')){return _0x5c09d4[_0x65e4('0x2b')](_0x2368de)[_0x65e4('0x31')]('Content-Type',_0x65e4('0xad'))['send']('<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>');}else{return _0x5c09d4['status'](_0x2368de)[_0x65e4('0x33')](_0x5dba52);}}})[_0x65e4('0x29')](handleError(_0x5c09d4,null));};exports[_0x65e4('0xae')]=function(_0x3eb401,_0x5ea43d){var _0x168690=_0x3eb401['params']['id'];var _0x240345=_0x3eb401[_0x65e4('0x5d')];var _0x4bc8c6=0xc8;var _0x1884aa=null;return db[_0x65e4('0xaf')][_0x65e4('0xb0')]({'isolationLevel':db[_0x65e4('0xaf')][_0x65e4('0xb1')][_0x65e4('0xb2')][_0x65e4('0xb3')]},function(_0x45d192){return db[_0x65e4('0x43')][_0x65e4('0x67')]({'where':{'id':_0x168690},'transaction':_0x45d192})[_0x65e4('0x37')](function(_0x5752de){if(_0x5752de){return db[_0x65e4('0x73')][_0x65e4('0x38')]({'where':{'SmsAccountId':_0x168690},'transaction':_0x45d192})[_0x65e4('0x37')](function(){var _0x21543d=_[_0x65e4('0x42')](_0x240345,function(_0x9cebc8){_0x9cebc8[_0x65e4('0x64')]=_0x168690;return _0x9cebc8;});return db['SmsApplication'][_0x65e4('0xb4')](_0x21543d,{'transaction':_0x45d192});});}else{_0x4bc8c6=0x194;_0x1884aa=[];}});})['then'](function(){if(_0x4bc8c6!==0x194){return db[_0x65e4('0x73')][_0x65e4('0xb5')]({'where':{'SmsAccountId':_0x168690},'order':_0x65e4('0x77')})[_0x65e4('0x37')](function(_0xafcb84){_0x1884aa=_0xafcb84;});}})[_0x65e4('0x29')](function(_0x3c6c5e){_0x4bc8c6=0x1f4;logger[_0x65e4('0x24')](_0x3c6c5e['stack']);if(_0x3c6c5e[_0x65e4('0x3d')]){delete _0x3c6c5e[_0x65e4('0x3d')];}_0x1884aa=_0x3c6c5e;})[_0x65e4('0xb6')](function(){if(_0x1884aa===null){_0x5ea43d['sendStatus'](_0x4bc8c6);}else{if(_0x4bc8c6===0x1f4){_0x5ea43d[_0x65e4('0x2b')](_0x4bc8c6)[_0x65e4('0x3e')](_0x1884aa);}else{_0x5ea43d[_0x65e4('0x2b')](_0x4bc8c6)[_0x65e4('0x33')](_0x1884aa);}}});};exports[_0x65e4('0xb7')]=function(_0x5794ca,_0x304f65,_0x11d39b){var _0x43b4b6={};var _0x4547fe={};var _0x4b8484;var _0x5dc65e;return db[_0x65e4('0x43')][_0x65e4('0x67')]({'where':{'id':_0x5794ca[_0x65e4('0x5a')]['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x304f65,null))[_0x65e4('0x37')](function(_0x50abfb){if(_0x50abfb){_0x4b8484=_0x50abfb;_0x4547fe[_0x65e4('0x48')]=_[_0x65e4('0x5b')](db[_0x65e4('0x73')][_0x65e4('0x44')]);_0x4547fe[_0x65e4('0x49')]=_['keys'](_0x5794ca[_0x65e4('0x49')]);_0x4547fe[_0x65e4('0x4a')]=_['intersection'](_0x4547fe[_0x65e4('0x48')],_0x4547fe[_0x65e4('0x49')]);_0x43b4b6[_0x65e4('0x4d')]=_['intersection'](_0x4547fe[_0x65e4('0x48')],qs[_0x65e4('0x4c')](_0x5794ca[_0x65e4('0x49')][_0x65e4('0x4c')]));_0x43b4b6[_0x65e4('0x4d')]=_0x43b4b6['attributes'][_0x65e4('0x4e')]?_0x43b4b6[_0x65e4('0x4d')]:_0x4547fe['model'];_0x43b4b6[_0x65e4('0x68')]=qs[_0x65e4('0x50')](_0x5794ca[_0x65e4('0x49')][_0x65e4('0x50')]);_0x43b4b6[_0x65e4('0x51')]=qs[_0x65e4('0x4a')](_['pick'](_0x5794ca[_0x65e4('0x49')],_0x4547fe[_0x65e4('0x4a')]));if(_0x5794ca[_0x65e4('0x49')][_0x65e4('0x55')]){_0x43b4b6[_0x65e4('0x51')]=_['merge'](_0x43b4b6['where'],{'$or':_['map'](_0x43b4b6[_0x65e4('0x4d')],function(_0x4dd717){var _0xc74015={};_0xc74015[_0x4dd717]={'$like':'%'+_0x5794ca[_0x65e4('0x49')][_0x65e4('0x55')]+'%'};return _0xc74015;})});}_0x43b4b6=_[_0x65e4('0x53')]({},_0x43b4b6,_0x5794ca['options']);return _0x4b8484[_0x65e4('0xb7')](_0x43b4b6);}})[_0x65e4('0x37')](function(_0x767c23){if(_0x767c23){_0x5dc65e=_0x767c23[_0x65e4('0x4e')];if(!_0x5794ca[_0x65e4('0x49')][_0x65e4('0x6f')]('nolimit')){_0x43b4b6[_0x65e4('0x30')]=qs[_0x65e4('0x30')](_0x5794ca[_0x65e4('0x49')][_0x65e4('0x30')]);_0x43b4b6[_0x65e4('0x2d')]=qs[_0x65e4('0x2d')](_0x5794ca[_0x65e4('0x49')]['offset']);}return _0x4b8484[_0x65e4('0xb7')](_0x43b4b6);}})[_0x65e4('0x37')](function(_0xbe3c1b){if(_0xbe3c1b){return _0xbe3c1b?{'count':_0x5dc65e,'rows':_0xbe3c1b}:null;}})[_0x65e4('0x37')](respondWithResult(_0x304f65,null))['catch'](handleError(_0x304f65,null));};exports[_0x65e4('0xb8')]=function(_0x65f343,_0x56b2b6,_0x383e3d){var _0x1dece6={'raw':![],'where':{}};var _0x5c47a5={};var _0x11c683={'count':0x0,'rows':[]};return db[_0x65e4('0x43')][_0x65e4('0x67')]({'where':{'id':_0x65f343['params']['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x56b2b6,null))['then'](function(_0x48f9e1){if(_0x48f9e1){_0x5c47a5['model']=_['keys'](db['SmsInteraction']['rawAttributes']);_0x5c47a5[_0x65e4('0x49')]=_[_0x65e4('0x5b')](_0x65f343['query']);_0x5c47a5[_0x65e4('0x4a')]=_[_0x65e4('0x4b')](_0x5c47a5[_0x65e4('0x48')],_0x5c47a5[_0x65e4('0x49')]);_0x1dece6[_0x65e4('0x4d')]=_[_0x65e4('0x4b')](_0x5c47a5['model'],qs[_0x65e4('0x4c')](_0x65f343['query'][_0x65e4('0x4c')]));_0x1dece6[_0x65e4('0x4d')]=_0x1dece6['attributes'][_0x65e4('0x4e')]?_0x1dece6[_0x65e4('0x4d')]:_0x5c47a5[_0x65e4('0x48')];if(!_0x65f343[_0x65e4('0x49')][_0x65e4('0x6f')](_0x65e4('0x4f'))){_0x1dece6[_0x65e4('0x30')]=qs[_0x65e4('0x30')](_0x65f343[_0x65e4('0x49')]['limit']);_0x1dece6[_0x65e4('0x2d')]=qs[_0x65e4('0x2d')](_0x65f343[_0x65e4('0x49')][_0x65e4('0x2d')]);}_0x1dece6[_0x65e4('0x68')]=qs[_0x65e4('0x50')](_0x65f343[_0x65e4('0x49')]['sort']);_0x1dece6['where']=qs[_0x65e4('0x4a')](_[_0x65e4('0x52')](_0x65f343[_0x65e4('0x49')],_0x5c47a5['filters']));_0x1dece6['where'][_0x65e4('0x64')]=_0x48f9e1['id'];if(_0x65f343[_0x65e4('0x49')][_0x65e4('0x55')]){_0x1dece6[_0x65e4('0x51')]=_[_0x65e4('0x53')](_0x1dece6[_0x65e4('0x51')],{'$or':_['map'](_0x1dece6[_0x65e4('0x4d')],function(_0x1987ff){var _0x5f44cd={};_0x5f44cd[_0x1987ff]={'$like':'%'+_0x65f343[_0x65e4('0x49')][_0x65e4('0x55')]+'%'};return _0x5f44cd;})});}_0x1dece6=_['merge']({},_0x1dece6,_0x65f343['options']);return db[_0x65e4('0x9c')][_0x65e4('0x2f')]({'where':_0x1dece6[_0x65e4('0x51')]})[_0x65e4('0x37')](function(_0x528f32){_0x11c683[_0x65e4('0x2f')]=_0x528f32;if(_0x65f343[_0x65e4('0x49')][_0x65e4('0x57')]){_0x1dece6[_0x65e4('0x58')]=[{'model':db[_0x65e4('0x98')],'as':_0x65e4('0xb9'),'required':![]},{'model':db[_0x65e4('0xa6')],'as':_0x65e4('0xba'),'attributes':['name',_0x65e4('0xbb'),'internal'],'required':![]},{'model':db[_0x65e4('0xbc')],'as':_0x65e4('0xbd'),'attributes':['id',_0x65e4('0x3d'),'color'],'where':_0x65f343[_0x65e4('0x49')]['tag']?{'id':_0x65f343[_0x65e4('0x49')][_0x65e4('0xbe')]}:undefined,'required':_0x65f343['query'][_0x65e4('0xbe')]?!![]:![]}];}return db[_0x65e4('0x9c')][_0x65e4('0x69')](_0x1dece6);})[_0x65e4('0x37')](function(_0x45aeff){_0x11c683[_0x65e4('0x59')]=_0x45aeff;return _0x11c683;});}})[_0x65e4('0x37')](respondWithFilteredResult(_0x56b2b6,_0x1dece6))['catch'](handleError(_0x56b2b6,null));};exports['send']=function(_0x44dacc,_0x370364,_0x2118bb){var _0x1c8e2d,_0x1447b8,_0x329e0a;if(_[_0x65e4('0x92')](_0x44dacc['body'][_0x65e4('0x5d')])||_0x44dacc[_0x65e4('0x5d')][_0x65e4('0x5d')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x44dacc[_0x65e4('0x5d')]['to'])){throw new db['Sequelize'][(_0x65e4('0x7a'))]('to\x20is\x20mandatory');}_0x1c8e2d=_0x44dacc['body']['to'];return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x44dacc[_0x65e4('0x5a')]['id']},'include':[{'model':db[_0x65e4('0x97')],'as':_0x65e4('0xbf'),'include':[{'model':db['CmContact'],'as':_0x65e4('0x99'),'where':{'mobile':_0x1c8e2d},'limit':0x1,'order':[[_0x65e4('0x7d'),_0x65e4('0xc0')]]}]}]})[_0x65e4('0x37')](handleEntityNotFound(_0x370364,null))[_0x65e4('0x37')](function(_0x2bd6aa){if(_0x2bd6aa&&_0x2bd6aa[_0x65e4('0xbf')]){_0x1447b8=_0x2bd6aa[_0x65e4('0x39')]({'plain':!![]});if(_0x1447b8[_0x65e4('0xbf')]&&_0x1447b8[_0x65e4('0xbf')][_0x65e4('0x99')][_0x65e4('0x4e')]){return _0x1447b8[_0x65e4('0xbf')][_0x65e4('0x99')][0x0];}return db['CmContact'][_0x65e4('0x5c')](_[_0x65e4('0xc1')](_0x44dacc['body'],{'firstName':_0x1c8e2d,'mobile':_0x1c8e2d,'phone':_0x1c8e2d,'ListId':_0x1447b8['ListId']}));}})[_0x65e4('0x37')](handleEntityNotFound(_0x370364,null))[_0x65e4('0x37')](function(_0x2e58c6){if(_0x2e58c6){_0x329e0a=_0x2e58c6;return db[_0x65e4('0x9c')][_0x65e4('0x62')]({'where':{'ContactId':_0x329e0a['id'],'closed':![],'SmsAccountId':_0x1447b8['id']}})[_0x65e4('0x37')](function(_0xcb3b3d){if(_0xcb3b3d){return[_0xcb3b3d,![]];}return db['SmsInteraction'][_0x65e4('0x5c')]({'UserId':_0x44dacc['user']['id'],'ContactId':_0x329e0a['id'],'SmsAccountId':_0x1447b8['id'],'phone':_0x1c8e2d,'firstMsgDirection':_0x65e4('0xc2'),'Messages':[_[_0x65e4('0x53')](_0x44dacc[_0x65e4('0x5d')],{'read':![],'body':_0x44dacc[_0x65e4('0x5d')]['body'],'phone':_0x1c8e2d,'SmsAccountId':_0x1447b8['id'],'UserId':_0x44dacc[_0x65e4('0xc3')]['id'],'ContactId':_0x329e0a['id']})]},{'include':[{'model':db[_0x65e4('0xa3')],'as':_0x65e4('0xc4')}]})[_0x65e4('0x37')](function(_0x4875ad){return[_0x4875ad,!![]];});});}})[_0x65e4('0xc5')](function(_0x3df0e2,_0x48cedc){if(_0x48cedc){return _0x3df0e2;}return db['SmsMessage'][_0x65e4('0x5c')](_[_0x65e4('0x53')](_0x44dacc['body'],{'read':![],'body':_0x44dacc[_0x65e4('0x5d')][_0x65e4('0x5d')],'phone':_0x1c8e2d,'SmsAccountId':_0x1447b8['id'],'SmsInteractionId':_0x3df0e2['id'],'UserId':_0x44dacc[_0x65e4('0xc3')]['id'],'ContactId':_0x329e0a['id']}))[_0x65e4('0x37')](function(_0x20b6b2){_0x3df0e2['dataValues'][_0x65e4('0xc4')]=[];_0x3df0e2[_0x65e4('0xc6')][_0x65e4('0xc4')][_0x65e4('0xc7')](_0x20b6b2[_0x65e4('0xc6')]);return _0x3df0e2;});})[_0x65e4('0x37')](respondWithResult(_0x370364,null))['catch'](handleError(_0x370364,null));};exports[_0x65e4('0x2b')]=function(_0x94755,_0x3c0988,_0x168eb2){if(_0x94755[_0x65e4('0x5d')]['id']){delete _0x94755[_0x65e4('0x5d')]['id'];}var _0x4e046f,_0x57f811,_0x16f836;return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x94755[_0x65e4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3c0988,null))['then'](function(_0xfeaf){if(_0xfeaf){_0x16f836=_0xfeaf;logger[_0x65e4('0x21')](_0x65e4('0x22'),_0x65e4('0x2b'),'received\x20delivery\x20report\x20from',_0xfeaf[_0x65e4('0x46')],util[_0x65e4('0xc8')](_0x94755['body'],{'showHidden':![],'depth':null}));switch(_0xfeaf[_0x65e4('0x46')]){case _0x65e4('0xc9'):if(_0x94755[_0x65e4('0x5d')][_0x65e4('0xca')]&&_0x94755[_0x65e4('0x5d')]['status']){_0x57f811=_0x94755['body'][_0x65e4('0x2b')];return db[_0x65e4('0xa3')][_0x65e4('0x62')]({'where':{'messageId':_0x94755[_0x65e4('0x5d')][_0x65e4('0xca')]}});}break;case _0x65e4('0x83'):if(_0x94755['body'][_0x65e4('0xcb')]&&_0x94755[_0x65e4('0x5d')][_0x65e4('0xcc')]){_0x57f811=_0x94755[_0x65e4('0x5d')][_0x65e4('0xcc')];return db[_0x65e4('0xa3')]['find']({'where':{'messageId':_0x94755['body'][_0x65e4('0xcb')]}});}break;case'clicksend':if(_0x94755[_0x65e4('0x5d')][_0x65e4('0x86')]&&_0x94755['body']['status_code']){_0x57f811=_0x94755[_0x65e4('0x5d')]['status_code'];return db[_0x65e4('0xa3')][_0x65e4('0x62')]({'where':{'messageId':_0x94755['body']['message_id']}});}break;case'infobip':var _0x41c39d=_0x94755[_0x65e4('0x5d')][_0x65e4('0x8a')][0x0];if(_0x41c39d[_0x65e4('0x85')]&&_0x41c39d['status']['groupName']==='DELIVERED'){_0x57f811=_0x41c39d['status'][_0x65e4('0xcd')];return db[_0x65e4('0xa3')][_0x65e4('0x62')]({'where':{'messageId':_0x41c39d[_0x65e4('0x85')]}});}break;case _0x65e4('0xce'):if(_0x94755['body'][_0x65e4('0x85')]&&_0x94755[_0x65e4('0x5d')][_0x65e4('0x2b')]){_0x57f811=_0x94755['body'][_0x65e4('0x2b')];return db['SmsMessage'][_0x65e4('0x62')]({'where':{'messageId':_0x94755[_0x65e4('0x5d')][_0x65e4('0x85')]}});}break;case _0x65e4('0x8f'):if(_0x94755[_0x65e4('0x5d')][0x0][_0x65e4('0x26')]['id']){_0x57f811=_0x94755[_0x65e4('0x5d')][0x0][_0x65e4('0x46')];return db[_0x65e4('0xa3')][_0x65e4('0x62')]({'where':{'messageId':_0x94755['body'][0x0][_0x65e4('0x26')]['id']}});}break;case _0x65e4('0x90'):if(_0x94755[_0x65e4('0x5d')][_0x65e4('0xcf')]&&_0x94755['body'][_0x65e4('0x2b')]){_0x57f811=_0x94755[_0x65e4('0x5d')][_0x65e4('0x2b')];return db[_0x65e4('0xa3')][_0x65e4('0x62')]({'where':{'messageId':_0x94755['body'][_0x65e4('0xcf')]}});}break;}}})[_0x65e4('0x37')](handleEntityNotFound(_0x3c0988,null))[_0x65e4('0x37')](function(_0x357982){if(_0x357982){_0x4e046f=_0x357982;switch(_0x16f836[_0x65e4('0x46')]){case _0x65e4('0xc9'):if(_0x57f811===_0x65e4('0xd0')){return _0x4e046f[_0x65e4('0x61')]({'read':!![]});}else{logger['error'](_0x65e4('0x22'),_0x65e4('0x2b'),_0x65e4('0xc9'),util['inspect'](_0x94755[_0x65e4('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x65e4('0x83'):if(_0x57f811==='1'){return _0x4e046f['update']({'read':!![]});}else{logger[_0x65e4('0x24')](_0x65e4('0x22'),_0x65e4('0x2b'),_0x65e4('0xc9'),util[_0x65e4('0xc8')](_0x94755['body'],{'showHidden':![],'depth':null}));}break;case _0x65e4('0x84'):if(!_0x94755[_0x65e4('0x5d')][_0x65e4('0xd1')]&&_0x57f811>=0xc8&&_0x57f811<=0xce){return _0x4e046f['update']({'read':!![]});}else{logger[_0x65e4('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x65e4('0x2b'),_0x65e4('0x84'),util[_0x65e4('0xc8')](_0x94755[_0x65e4('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x65e4('0x89'):var _0xa59f30=_0x94755['body'][_0x65e4('0x8a')][0x0];if(_0xa59f30[_0x65e4('0x2b')][_0x65e4('0xcd')]==='DELIVERED'){return _0x4e046f[_0x65e4('0x61')]({'read':!![]});}else{logger[_0x65e4('0x24')](_0x65e4('0x22'),_0x65e4('0x2b'),_0x65e4('0x89'),util[_0x65e4('0xc8')](_0x94755[_0x65e4('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x65e4('0xce'):if(_0x57f811==_0x65e4('0xd2')||_0x57f811==_0x65e4('0xd3')){return _0x4e046f['update']({'read':!![]});}else{logger[_0x65e4('0x24')](_0x65e4('0x22'),'status',_0x65e4('0xce'),util[_0x65e4('0xc8')](_0x94755['body'],{'showHidden':![],'depth':null}));}break;case _0x65e4('0x8f'):if(_0x57f811=='message-delivered'){return _0x4e046f[_0x65e4('0x61')]({'read':!![]});}else{logger[_0x65e4('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x65e4('0x8f'),util[_0x65e4('0xc8')](_0x94755[_0x65e4('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x65e4('0x90'):if(_0x57f811==='DELIVRD'||_0x57f811===_0x65e4('0xd4')){return _0x4e046f['update']({'read':!![]});}else{logger[_0x65e4('0x24')](_0x65e4('0x22'),_0x65e4('0x2b'),_0x65e4('0x90'),util[_0x65e4('0xc8')](_0x94755['body'],{'showHidden':![],'depth':null}));}break;}return _0x4e046f;}})[_0x65e4('0x37')](respondWithResult(_0x3c0988,null))['catch'](handleError(_0x3c0988,null));};exports[_0x65e4('0xd5')]=function(_0x51fe9b,_0x10b316,_0x4912ba){var _0x18f897,_0x1fa35d,_0x13e6c6;return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x51fe9b[_0x65e4('0x5a')]['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x10b316,null))['then'](function(_0x3d694c){if(_0x3d694c){_0x13e6c6=_0x3d694c;logger['debug'](_0x65e4('0x22'),_0x65e4('0x2b'),_0x65e4('0xd6'),_0x3d694c[_0x65e4('0x46')],util[_0x65e4('0xc8')](_0x51fe9b[_0x65e4('0x49')],{'showHidden':![],'depth':null}));switch(_0x3d694c[_0x65e4('0x46')]){case _0x65e4('0x8c'):if(_0x51fe9b[_0x65e4('0x49')][_0x65e4('0xd7')]&&_0x51fe9b[_0x65e4('0x49')][_0x65e4('0xd8')]){_0x1fa35d=_0x51fe9b['query'][_0x65e4('0xd8')];return db[_0x65e4('0xa3')][_0x65e4('0x62')]({'where':{'messageId':_0x51fe9b['query'][_0x65e4('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x10b316,null))[_0x65e4('0x37')](function(_0x57e524){if(_0x57e524){_0x18f897=_0x57e524;switch(_0x13e6c6['type']){case'csc':if(_0x1fa35d==='2'||_0x1fa35d==='6'){return _0x18f897['update']({'read':!![]});}else{logger['error'](_0x65e4('0x22'),_0x65e4('0x2b'),_0x65e4('0x8c'),util['inspect'](_0x51fe9b[_0x65e4('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x18f897;}})[_0x65e4('0x37')](respondWithResult(_0x10b316,null))['catch'](handleError(_0x10b316,null));};exports[_0x65e4('0xd9')]=function(_0x1d819e,_0x61afe8,_0x10c305){return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x1d819e[_0x65e4('0x5a')]['id']}})[_0x65e4('0x37')](handleEntityNotFound(_0x61afe8,null))[_0x65e4('0x37')](function(_0xeaa49d){if(_0xeaa49d){return _0xeaa49d['addAgents'](_0x1d819e[_0x65e4('0x5d')]['ids'],_[_0x65e4('0x9a')](_0x1d819e[_0x65e4('0x5d')],['ids','id'])||{})[_0x65e4('0xc5')](function(_0x2b522a){for(var _0xbaf138=0x0;_0xbaf138<_0x1d819e[_0x65e4('0x5d')][_0x65e4('0x6b')]['length'];_0xbaf138+=0x1){socket[_0x65e4('0xda')](_0x65e4('0xdb'),{'UserId':Number(_0x1d819e[_0x65e4('0x5d')]['ids'][_0xbaf138]),'SmsAccountId':Number(_0x1d819e[_0x65e4('0x5a')]['id'])});}return _0x2b522a;});}})['then'](respondWithResult(_0x61afe8,null))[_0x65e4('0x29')](handleError(_0x61afe8,null));};exports[_0x65e4('0xdc')]=function(_0x2bf799,_0x505e36,_0x5662d0){return db[_0x65e4('0x43')][_0x65e4('0x62')]({'where':{'id':_0x2bf799[_0x65e4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x505e36,null))[_0x65e4('0x37')](function(_0x7b5f9f){if(_0x7b5f9f){return _0x7b5f9f['removeAgents'](_0x2bf799[_0x65e4('0x49')][_0x65e4('0x6b')])[_0x65e4('0x37')](function(){if(_[_0x65e4('0xdd')](_0x2bf799[_0x65e4('0x49')][_0x65e4('0x6b')])){for(var _0xb5a2ba=0x0;_0xb5a2ba<_0x2bf799['query'][_0x65e4('0x6b')][_0x65e4('0x4e')];_0xb5a2ba+=0x1){socket['emit'](_0x65e4('0xde'),{'UserId':Number(_0x2bf799['query'][_0x65e4('0x6b')][_0xb5a2ba]),'SmsAccountId':Number(_0x2bf799[_0x65e4('0x5a')]['id'])});}}else{socket[_0x65e4('0xda')](_0x65e4('0xde'),{'UserId':Number(_0x2bf799[_0x65e4('0x49')]['ids']),'SmsAccountId':Number(_0x2bf799['params']['id'])});}});}})['then'](respondWithStatusCode(_0x505e36,null))[_0x65e4('0x29')](handleError(_0x505e36,null));};exports[_0x65e4('0xdf')]=function(_0x3c39b0,_0x1c154e,_0x2edaf3){var _0x39eca3={};var _0x48ed49={};var _0x37a029;var _0x3ae13b;return db['SmsAccount'][_0x65e4('0x67')]({'where':{'id':_0x3c39b0[_0x65e4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c154e,null))[_0x65e4('0x37')](function(_0xfaf9a0){if(_0xfaf9a0){_0x37a029=_0xfaf9a0;_0x48ed49[_0x65e4('0x48')]=_[_0x65e4('0x5b')](db[_0x65e4('0xa6')]['rawAttributes']);_0x48ed49[_0x65e4('0x49')]=_[_0x65e4('0x5b')](_0x3c39b0['query']);_0x48ed49['filters']=_[_0x65e4('0x4b')](_0x48ed49[_0x65e4('0x48')],_0x48ed49[_0x65e4('0x49')]);_0x39eca3['attributes']=_['intersection'](_0x48ed49[_0x65e4('0x48')],qs[_0x65e4('0x4c')](_0x3c39b0['query'][_0x65e4('0x4c')]));_0x39eca3[_0x65e4('0x4d')]=_0x39eca3[_0x65e4('0x4d')]['length']?_0x39eca3['attributes']:_0x48ed49['model'];_0x39eca3[_0x65e4('0x68')]=qs[_0x65e4('0x50')](_0x3c39b0[_0x65e4('0x49')][_0x65e4('0x50')]);_0x39eca3[_0x65e4('0x51')]=qs['filters'](_[_0x65e4('0x52')](_0x3c39b0[_0x65e4('0x49')],_0x48ed49[_0x65e4('0x4a')]));if(_0x3c39b0[_0x65e4('0x49')][_0x65e4('0x55')]){_0x39eca3[_0x65e4('0x51')]=_[_0x65e4('0x53')](_0x39eca3['where'],{'$or':_[_0x65e4('0x42')](_0x39eca3[_0x65e4('0x4d')],function(_0x21461f){var _0xf129a4={};_0xf129a4[_0x21461f]={'$like':'%'+_0x3c39b0[_0x65e4('0x49')][_0x65e4('0x55')]+'%'};return _0xf129a4;})});}_0x39eca3=_['merge']({},_0x39eca3,_0x3c39b0[_0x65e4('0x56')]);return _0x37a029[_0x65e4('0xdf')](_0x39eca3);}})[_0x65e4('0x37')](function(_0xbd025){if(_0xbd025){_0x3ae13b=_0xbd025['length'];if(!_0x3c39b0[_0x65e4('0x49')][_0x65e4('0x6f')](_0x65e4('0x4f'))){_0x39eca3['limit']=qs[_0x65e4('0x30')](_0x3c39b0[_0x65e4('0x49')][_0x65e4('0x30')]);_0x39eca3['offset']=qs['offset'](_0x3c39b0[_0x65e4('0x49')]['offset']);}return _0x37a029[_0x65e4('0xdf')](_0x39eca3);}})['then'](function(_0x1cb343){if(_0x1cb343){return _0x1cb343?{'count':_0x3ae13b,'rows':_0x1cb343}:null;}})[_0x65e4('0x37')](respondWithResult(_0x1c154e,null))[_0x65e4('0x29')](handleError(_0x1c154e,null));};
\ No newline at end of file
+var _0x3c65=['VIRTUAL','merge','findAll','rows','show','mandatoryDispositionPause','includeAll','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','nolimit','order','include','removeDispositions','ids','CannedAnswer','getAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','From','Body','messageId','MessageSid','skebby','from','connectel','clicksend','message_id','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','omit','Contacts','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','update','error_code','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','addAgents','removeAgents','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','Pause','map','SmsAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x3c65,0x88));var _0x53c6=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x3c65[_0x102977];return _0x15c466;};'use strict';var emlformat=require(_0x53c6('0x0'));var rimraf=require(_0x53c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x53c6('0x2'));var moment=require(_0x53c6('0x3'));var BPromise=require(_0x53c6('0x4'));var Mustache=require(_0x53c6('0x5'));var util=require(_0x53c6('0x6'));var path=require('path');var sox=require(_0x53c6('0x7'));var csv=require(_0x53c6('0x8'));var ejs=require(_0x53c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53c6('0xa'));var squel=require(_0x53c6('0xb'));var crypto=require(_0x53c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x53c6('0xd'));var toCsv=require(_0x53c6('0x8'));var querystring=require(_0x53c6('0xe'));var Papa=require(_0x53c6('0xf'));var Redis=require('ioredis');var authService=require(_0x53c6('0x10'));var qs=require(_0x53c6('0x11'));var as=require(_0x53c6('0x12'));var hardwareService=require(_0x53c6('0x13'));var logger=require(_0x53c6('0x14'))('api');var utils=require(_0x53c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x53c6('0x16'));var db=require(_0x53c6('0x17'))['db'];config['redis']=_[_0x53c6('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x53c6('0x19')]));require(_0x53c6('0x1a'))[_0x53c6('0x1b')](socket);var jayson=require(_0x53c6('0x1c'));var client=jayson[_0x53c6('0x1d')][_0x53c6('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xb0c048,_0x1f7514,_0x5dc392,_0x22a8b4){return new BPromise(function(_0x53b8cf,_0x12b690){var _0x360ef3=_0x22a8b4||client;return _0x360ef3[_0x53c6('0x1f')](_0xb0c048,_0x5dc392)[_0x53c6('0x20')](function(_0x22f134){logger['info']('SmsAccount,\x20%s,\x20%s',_0x1f7514,_0x53c6('0x21'));logger['debug'](_0x53c6('0x22'),_0x1f7514,_0x53c6('0x21'),JSON[_0x53c6('0x23')](_0x22f134));if(_0x22f134[_0x53c6('0x24')]){if(_0x22f134[_0x53c6('0x24')][_0x53c6('0x25')]===0x1f4){logger[_0x53c6('0x24')](_0x53c6('0x26'),_0x1f7514,_0x22f134[_0x53c6('0x24')][_0x53c6('0x27')]);return _0x12b690(_0x22f134[_0x53c6('0x24')]['message']);}logger[_0x53c6('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1f7514,_0x22f134[_0x53c6('0x24')][_0x53c6('0x27')]);return _0x53b8cf(_0x22f134[_0x53c6('0x24')][_0x53c6('0x27')]);}else{logger[_0x53c6('0x28')](_0x53c6('0x26'),_0x1f7514,_0x53c6('0x21'));_0x53b8cf(_0x22f134[_0x53c6('0x29')][_0x53c6('0x27')]);}})[_0x53c6('0x2a')](function(_0x9b0652){logger[_0x53c6('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1f7514,_0x9b0652);_0x12b690(_0x9b0652);});});}function respondWithStatusCode(_0x634f96,_0x1655ab){_0x1655ab=_0x1655ab||0xcc;return function(_0x40007c){if(_0x40007c){return _0x634f96[_0x53c6('0x2b')](_0x1655ab);}return _0x634f96['status'](_0x1655ab)['end']();};}function respondWithResult(_0x1747b2,_0x5c383c){_0x5c383c=_0x5c383c||0xc8;return function(_0x10427b){if(_0x10427b){return _0x1747b2[_0x53c6('0x2c')](_0x5c383c)[_0x53c6('0x2d')](_0x10427b);}};}function respondWithFilteredResult(_0x32b90f,_0x714494){return function(_0x56207c){if(_0x56207c){var _0x5ce13e=typeof _0x714494[_0x53c6('0x2e')]==='undefined'&&typeof _0x714494[_0x53c6('0x2f')]==='undefined';var _0x5974dd=_0x56207c[_0x53c6('0x30')];var _0x4b0f30=_0x5ce13e?0x0:_0x714494[_0x53c6('0x2e')];var _0x54ab28=_0x5ce13e?_0x56207c[_0x53c6('0x30')]:_0x714494[_0x53c6('0x2e')]+_0x714494[_0x53c6('0x2f')];var _0x51b802;if(_0x54ab28>=_0x5974dd){_0x54ab28=_0x5974dd;_0x51b802=0xc8;}else{_0x51b802=0xce;}_0x32b90f[_0x53c6('0x2c')](_0x51b802);return _0x32b90f[_0x53c6('0x31')](_0x53c6('0x32'),_0x4b0f30+'-'+_0x54ab28+'/'+_0x5974dd)['json'](_0x56207c);}return null;};}function patchUpdates(_0x41f4cc){return function(_0x224084){try{jsonpatch['apply'](_0x224084,_0x41f4cc,!![]);}catch(_0x16d001){return BPromise[_0x53c6('0x33')](_0x16d001);}return _0x224084[_0x53c6('0x34')]();};}function saveUpdates(_0x3ef2a8,_0xf2ccbe){return function(_0x314889){if(_0x314889){return _0x314889['update'](_0x3ef2a8)['then'](function(_0x293aca){return _0x293aca;});}return null;};}function removeEntity(_0x4ede5b,_0xd6dc92){return function(_0x2e024c){if(_0x2e024c){return _0x2e024c[_0x53c6('0x35')]()[_0x53c6('0x20')](function(){var _0x4c8fb3=_0x2e024c[_0x53c6('0x36')]({'plain':!![]});var _0x45c597=_0x53c6('0x37');return db[_0x53c6('0x38')][_0x53c6('0x35')]({'where':{'type':_0x45c597,'resourceId':_0x4c8fb3['id']}})['then'](function(){return _0x2e024c;});})[_0x53c6('0x20')](function(){_0x4ede5b[_0x53c6('0x2c')](0xcc)[_0x53c6('0x39')]();});}};}function handleEntityNotFound(_0x274323,_0x13cb55){return function(_0x54b7a5){if(!_0x54b7a5){_0x274323[_0x53c6('0x2b')](0x194);}return _0x54b7a5;};}function handleError(_0x26c0d7,_0x2066a9){_0x2066a9=_0x2066a9||0x1f4;return function(_0x39dd27){logger['error'](_0x39dd27[_0x53c6('0x3a')]);if(_0x39dd27[_0x53c6('0x3b')]){delete _0x39dd27[_0x53c6('0x3b')];}_0x26c0d7[_0x53c6('0x2c')](_0x2066a9)['send'](_0x39dd27);};}exports['index']=function(_0x520b3f,_0x5c9e4e){var _0x582c2d={'include':[{'model':db[_0x53c6('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4bf80c={},_0x17ac5e={'count':0x0,'rows':[]};var _0x2387b0=_[_0x53c6('0x3d')](db[_0x53c6('0x3e')][_0x53c6('0x3f')],function(_0x103fdd){return{'name':_0x103fdd['fieldName'],'type':_0x103fdd['type'][_0x53c6('0x40')]};});_0x4bf80c[_0x53c6('0x41')]=_[_0x53c6('0x3d')](_0x2387b0,_0x53c6('0x3b'));_0x4bf80c[_0x53c6('0x42')]=_[_0x53c6('0x43')](_0x520b3f[_0x53c6('0x42')]);_0x4bf80c[_0x53c6('0x44')]=_[_0x53c6('0x45')](_0x4bf80c[_0x53c6('0x41')],_0x4bf80c['query']);_0x582c2d[_0x53c6('0x46')]=_[_0x53c6('0x45')](_0x4bf80c[_0x53c6('0x41')],qs['fields'](_0x520b3f['query'][_0x53c6('0x47')]));_0x582c2d['attributes']=_0x582c2d['attributes'][_0x53c6('0x48')]?_0x582c2d[_0x53c6('0x46')]:_0x4bf80c[_0x53c6('0x41')];if(!_0x520b3f[_0x53c6('0x42')][_0x53c6('0x49')]('nolimit')){_0x582c2d[_0x53c6('0x2f')]=qs['limit'](_0x520b3f['query']['limit']);_0x582c2d[_0x53c6('0x2e')]=qs[_0x53c6('0x2e')](_0x520b3f['query'][_0x53c6('0x2e')]);}_0x582c2d['order']=qs[_0x53c6('0x4a')](_0x520b3f[_0x53c6('0x42')][_0x53c6('0x4a')]);_0x582c2d['where']=qs[_0x53c6('0x44')](_[_0x53c6('0x4b')](_0x520b3f[_0x53c6('0x42')],_0x4bf80c[_0x53c6('0x44')]),_0x2387b0);if(_0x520b3f[_0x53c6('0x42')][_0x53c6('0x4c')]){_0x582c2d[_0x53c6('0x4d')]=_['merge'](_0x582c2d['where'],{'$or':_[_0x53c6('0x3d')](_0x2387b0,function(_0x173879){if(_0x173879[_0x53c6('0x4e')]!==_0x53c6('0x4f')){var _0x20a4d9={};_0x20a4d9[_0x173879[_0x53c6('0x3b')]]={'$like':'%'+_0x520b3f[_0x53c6('0x42')][_0x53c6('0x4c')]+'%'};return _0x20a4d9;}})});}_0x582c2d=_[_0x53c6('0x50')]({},_0x582c2d,_0x520b3f['options']);var _0xc47916={'where':_0x582c2d['where']};return db['SmsAccount']['count'](_0xc47916)['then'](function(_0x55b70e){_0x17ac5e['count']=_0x55b70e;if(_0x520b3f['query']['includeAll']){_0x582c2d['include']=[{'all':!![]}];}return db[_0x53c6('0x3e')][_0x53c6('0x51')](_0x582c2d);})[_0x53c6('0x20')](function(_0x2867b3){_0x17ac5e[_0x53c6('0x52')]=_0x2867b3;return _0x17ac5e;})[_0x53c6('0x20')](respondWithFilteredResult(_0x5c9e4e,_0x582c2d))['catch'](handleError(_0x5c9e4e,null));};exports[_0x53c6('0x53')]=function(_0x1e45ff,_0x4b74d3){var _0x5804a0={'raw':![],'where':{'id':_0x1e45ff['params']['id']},'include':[{'model':db[_0x53c6('0x3c')],'as':_0x53c6('0x54')}]},_0x99f4af={};_0x99f4af[_0x53c6('0x41')]=_[_0x53c6('0x43')](db[_0x53c6('0x3e')][_0x53c6('0x3f')]);_0x99f4af[_0x53c6('0x42')]=_[_0x53c6('0x43')](_0x1e45ff[_0x53c6('0x42')]);_0x99f4af['filters']=_[_0x53c6('0x45')](_0x99f4af[_0x53c6('0x41')],_0x99f4af['query']);_0x5804a0['attributes']=_[_0x53c6('0x45')](_0x99f4af['model'],qs[_0x53c6('0x47')](_0x1e45ff[_0x53c6('0x42')][_0x53c6('0x47')]));_0x5804a0['attributes']=_0x5804a0[_0x53c6('0x46')][_0x53c6('0x48')]?_0x5804a0[_0x53c6('0x46')]:_0x99f4af['model'];if(_0x1e45ff[_0x53c6('0x42')][_0x53c6('0x55')]){_0x5804a0['include']=[{'all':!![]}];}_0x5804a0=_[_0x53c6('0x50')]({},_0x5804a0,_0x1e45ff[_0x53c6('0x56')]);return db[_0x53c6('0x3e')]['find'](_0x5804a0)[_0x53c6('0x20')](handleEntityNotFound(_0x4b74d3,null))[_0x53c6('0x20')](respondWithResult(_0x4b74d3,null))[_0x53c6('0x2a')](handleError(_0x4b74d3,null));};exports[_0x53c6('0x57')]=function(_0x296a43,_0x25c0c4){return db[_0x53c6('0x3e')][_0x53c6('0x57')](_0x296a43[_0x53c6('0x58')],{})[_0x53c6('0x20')](function(_0x4d736d){var _0x859c64=_0x296a43[_0x53c6('0x59')][_0x53c6('0x36')]({'plain':!![]});if(!_0x859c64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x859c64[_0x53c6('0x5a')]===_0x53c6('0x59')){var _0x5abd8f=_0x4d736d[_0x53c6('0x36')]({'plain':!![]});var _0x42d3a6='SmsAccounts';return db[_0x53c6('0x5b')][_0x53c6('0x5c')]({'where':{'name':_0x42d3a6,'userProfileId':_0x859c64[_0x53c6('0x5d')]},'raw':!![]})[_0x53c6('0x20')](function(_0x10665b){if(_0x10665b&&_0x10665b[_0x53c6('0x5e')]===0x0){return db[_0x53c6('0x38')][_0x53c6('0x57')]({'name':_0x5abd8f['name'],'resourceId':_0x5abd8f['id'],'type':_0x10665b[_0x53c6('0x3b')],'sectionId':_0x10665b['id']},{})['then'](function(){return _0x4d736d;});}else{return _0x4d736d;}})[_0x53c6('0x2a')](function(_0xa006a){logger['error'](_0x53c6('0x5f'),_0xa006a);throw _0xa006a;});}return _0x4d736d;})['then'](respondWithResult(_0x25c0c4,0xc9))['catch'](handleError(_0x25c0c4,null));};exports['update']=function(_0x3517f5,_0x382517){if(_0x3517f5['body']['id']){delete _0x3517f5[_0x53c6('0x58')]['id'];}return db[_0x53c6('0x3e')][_0x53c6('0x5c')]({'where':{'id':_0x3517f5['params']['id']},'include':[{'model':db[_0x53c6('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x53c6('0x20')](handleEntityNotFound(_0x382517,null))[_0x53c6('0x20')](saveUpdates(_0x3517f5[_0x53c6('0x58')],null))['then'](respondWithResult(_0x382517,null))[_0x53c6('0x2a')](handleError(_0x382517,null));};exports[_0x53c6('0x35')]=function(_0xff172d,_0x2215c1){return db[_0x53c6('0x3e')]['find']({'where':{'id':_0xff172d[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x2215c1,null))['then'](removeEntity(_0x2215c1,null))[_0x53c6('0x2a')](handleError(_0x2215c1,null));};exports[_0x53c6('0x61')]=function(_0xdd3276,_0x31640d){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x31640d,null))['catch'](handleError(_0x31640d,null));};exports[_0x53c6('0x62')]=function(_0x1a32b0,_0x2a6bf3,_0xabddfa){if(_0x1a32b0[_0x53c6('0x58')]['id']){delete _0x1a32b0['body']['id'];}return db[_0x53c6('0x3e')]['find']({'where':{'id':_0x1a32b0['params']['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x2a6bf3,null))[_0x53c6('0x20')](function(_0x2bda79){if(_0x2bda79){_0x1a32b0[_0x53c6('0x58')][_0x53c6('0x63')]=_0x2bda79['id'];return db['Disposition'][_0x53c6('0x57')](_0x1a32b0['body']);}})[_0x53c6('0x20')](respondWithResult(_0x2a6bf3,null))[_0x53c6('0x2a')](handleError(_0x2a6bf3,null));};exports[_0x53c6('0x64')]=function(_0x1f0ea4,_0x3372a2,_0x4efe70){var _0x40c702={'raw':![],'where':{}};var _0x52e6ce={};var _0x4f0a42={'count':0x0,'rows':[]};return db[_0x53c6('0x3e')][_0x53c6('0x65')]({'where':{'id':_0x1f0ea4[_0x53c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x3372a2,null))['then'](function(_0x2e78a0){if(_0x2e78a0){_0x52e6ce[_0x53c6('0x41')]=_[_0x53c6('0x43')](db[_0x53c6('0x66')]['rawAttributes']);_0x52e6ce[_0x53c6('0x42')]=_[_0x53c6('0x43')](_0x1f0ea4[_0x53c6('0x42')]);_0x52e6ce['filters']=_['intersection'](_0x52e6ce[_0x53c6('0x41')],_0x52e6ce[_0x53c6('0x42')]);_0x40c702[_0x53c6('0x46')]=_['intersection'](_0x52e6ce['model'],qs[_0x53c6('0x47')](_0x1f0ea4[_0x53c6('0x42')][_0x53c6('0x47')]));_0x40c702[_0x53c6('0x46')]=_0x40c702[_0x53c6('0x46')]['length']?_0x40c702[_0x53c6('0x46')]:_0x52e6ce[_0x53c6('0x41')];if(!_0x1f0ea4[_0x53c6('0x42')][_0x53c6('0x49')](_0x53c6('0x67'))){_0x40c702['limit']=qs[_0x53c6('0x2f')](_0x1f0ea4[_0x53c6('0x42')][_0x53c6('0x2f')]);_0x40c702[_0x53c6('0x2e')]=qs[_0x53c6('0x2e')](_0x1f0ea4[_0x53c6('0x42')]['offset']);}_0x40c702[_0x53c6('0x68')]=qs[_0x53c6('0x4a')](_0x1f0ea4[_0x53c6('0x42')][_0x53c6('0x4a')]);_0x40c702['where']=qs[_0x53c6('0x44')](_[_0x53c6('0x4b')](_0x1f0ea4[_0x53c6('0x42')],_0x52e6ce[_0x53c6('0x44')]));_0x40c702[_0x53c6('0x4d')][_0x53c6('0x63')]=_0x2e78a0['id'];if(_0x1f0ea4['query']['filter']){_0x40c702[_0x53c6('0x4d')]=_[_0x53c6('0x50')](_0x40c702[_0x53c6('0x4d')],{'$or':_['map'](_0x40c702[_0x53c6('0x46')],function(_0x3be7ec){var _0x8189e4={};_0x8189e4[_0x3be7ec]={'$like':'%'+_0x1f0ea4[_0x53c6('0x42')]['filter']+'%'};return _0x8189e4;})});}_0x40c702=_[_0x53c6('0x50')]({},_0x40c702,_0x1f0ea4[_0x53c6('0x56')]);return db['Disposition'][_0x53c6('0x30')]({'where':_0x40c702[_0x53c6('0x4d')]})['then'](function(_0x556eeb){_0x4f0a42['count']=_0x556eeb;if(_0x1f0ea4[_0x53c6('0x42')][_0x53c6('0x55')]){_0x40c702[_0x53c6('0x69')]=[{'all':!![]}];}return db[_0x53c6('0x66')][_0x53c6('0x51')](_0x40c702);})[_0x53c6('0x20')](function(_0x26a320){_0x4f0a42['rows']=_0x26a320;return _0x4f0a42;});}})[_0x53c6('0x20')](respondWithFilteredResult(_0x3372a2,_0x40c702))['catch'](handleError(_0x3372a2,null));};exports[_0x53c6('0x6a')]=function(_0x388098,_0x5bf010,_0x2b259d){return db['SmsAccount'][_0x53c6('0x5c')]({'where':{'id':_0x388098[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x5bf010,null))['then'](function(_0x27bdc8){if(_0x27bdc8){return _0x27bdc8[_0x53c6('0x6a')](_0x388098[_0x53c6('0x42')][_0x53c6('0x6b')]);}})[_0x53c6('0x20')](respondWithStatusCode(_0x5bf010,null))[_0x53c6('0x2a')](handleError(_0x5bf010,null));};exports['addAnswer']=function(_0xf73d0c,_0x5da6af,_0x11629c){if(_0xf73d0c['body']['id']){delete _0xf73d0c['body']['id'];}return db[_0x53c6('0x3e')]['find']({'where':{'id':_0xf73d0c[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x5da6af,null))[_0x53c6('0x20')](function(_0x12b96a){if(_0x12b96a){_0xf73d0c[_0x53c6('0x58')]['SmsAccountId']=_0x12b96a['id'];return db[_0x53c6('0x6c')][_0x53c6('0x57')](_0xf73d0c[_0x53c6('0x58')]);}})[_0x53c6('0x20')](respondWithResult(_0x5da6af,null))['catch'](handleError(_0x5da6af,null));};exports[_0x53c6('0x6d')]=function(_0x2c12af,_0x158a4a,_0x53cb65){var _0x5a5837={'raw':![],'where':{}};var _0x29aa71={};var _0x1aaaa0={'count':0x0,'rows':[]};return db[_0x53c6('0x3e')][_0x53c6('0x65')]({'where':{'id':_0x2c12af[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x158a4a,null))[_0x53c6('0x20')](function(_0x25417c){if(_0x25417c){_0x29aa71['model']=_['keys'](db[_0x53c6('0x6c')][_0x53c6('0x3f')]);_0x29aa71[_0x53c6('0x42')]=_['keys'](_0x2c12af[_0x53c6('0x42')]);_0x29aa71[_0x53c6('0x44')]=_[_0x53c6('0x45')](_0x29aa71[_0x53c6('0x41')],_0x29aa71[_0x53c6('0x42')]);_0x5a5837[_0x53c6('0x46')]=_[_0x53c6('0x45')](_0x29aa71[_0x53c6('0x41')],qs[_0x53c6('0x47')](_0x2c12af[_0x53c6('0x42')]['fields']));_0x5a5837['attributes']=_0x5a5837[_0x53c6('0x46')][_0x53c6('0x48')]?_0x5a5837[_0x53c6('0x46')]:_0x29aa71[_0x53c6('0x41')];if(!_0x2c12af['query'][_0x53c6('0x49')]('nolimit')){_0x5a5837[_0x53c6('0x2f')]=qs[_0x53c6('0x2f')](_0x2c12af[_0x53c6('0x42')][_0x53c6('0x2f')]);_0x5a5837[_0x53c6('0x2e')]=qs[_0x53c6('0x2e')](_0x2c12af['query']['offset']);}_0x5a5837[_0x53c6('0x68')]=qs[_0x53c6('0x4a')](_0x2c12af[_0x53c6('0x42')][_0x53c6('0x4a')]);_0x5a5837[_0x53c6('0x4d')]=qs[_0x53c6('0x44')](_[_0x53c6('0x4b')](_0x2c12af[_0x53c6('0x42')],_0x29aa71[_0x53c6('0x44')]));_0x5a5837[_0x53c6('0x4d')][_0x53c6('0x63')]=_0x25417c['id'];if(_0x2c12af[_0x53c6('0x42')]['filter']){_0x5a5837[_0x53c6('0x4d')]=_[_0x53c6('0x50')](_0x5a5837[_0x53c6('0x4d')],{'$or':_['map'](_0x5a5837[_0x53c6('0x46')],function(_0x3076a7){var _0x3ee029={};_0x3ee029[_0x3076a7]={'$like':'%'+_0x2c12af[_0x53c6('0x42')][_0x53c6('0x4c')]+'%'};return _0x3ee029;})});}_0x5a5837=_[_0x53c6('0x50')]({},_0x5a5837,_0x2c12af[_0x53c6('0x56')]);return db[_0x53c6('0x6c')][_0x53c6('0x30')]({'where':_0x5a5837[_0x53c6('0x4d')]})[_0x53c6('0x20')](function(_0x3e0827){_0x1aaaa0[_0x53c6('0x30')]=_0x3e0827;if(_0x2c12af[_0x53c6('0x42')][_0x53c6('0x55')]){_0x5a5837[_0x53c6('0x69')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5a5837);})[_0x53c6('0x20')](function(_0x459c6d){_0x1aaaa0[_0x53c6('0x52')]=_0x459c6d;return _0x1aaaa0;});}})[_0x53c6('0x20')](respondWithFilteredResult(_0x158a4a,_0x5a5837))['catch'](handleError(_0x158a4a,null));};exports['removeAnswers']=function(_0x584822,_0x20d1f6,_0x107179){return db[_0x53c6('0x3e')]['find']({'where':{'id':_0x584822[_0x53c6('0x60')]['id']}})['then'](handleEntityNotFound(_0x20d1f6,null))[_0x53c6('0x20')](function(_0x59da07){if(_0x59da07){return _0x59da07['removeAnswers'](_0x584822[_0x53c6('0x42')][_0x53c6('0x6b')]);}})[_0x53c6('0x20')](respondWithStatusCode(_0x20d1f6,null))[_0x53c6('0x2a')](handleError(_0x20d1f6,null));};exports[_0x53c6('0x6e')]=function(_0x56dc86,_0x42d0ab,_0x49546a){var _0xea7551={'channel':'sms'};var _0x4e1440=[];var _0x1035c0=[];var _0x32fe27={};return db[_0x53c6('0x3e')][_0x53c6('0x5c')]({'where':{'id':_0x56dc86[_0x53c6('0x60')]['id']},'include':[{'model':db[_0x53c6('0x6f')],'as':_0x53c6('0x70')}]})[_0x53c6('0x20')](handleEntityNotFound(_0x42d0ab,null))['then'](function(_0x1fe2e2){_0xea7551[_0x53c6('0x71')]=_0x1fe2e2;_0xea7551[_0x53c6('0x72')]=_[_0x53c6('0x73')](_0x1fe2e2[_0x53c6('0x70')],[_0x53c6('0x74')],['asc']);if(_0xea7551['account']['Applications']){delete _0xea7551[_0x53c6('0x71')][_0x53c6('0x70')];}return db['CmContact'][_0x53c6('0x61')]();})['then'](function(_0x36100d){if(!_0x36100d){throw new db['Sequelize']['ValidationError'](_0x53c6('0x75'));}_0x4e1440=_[_0x53c6('0x76')](_['keys'](_0x36100d),[_0x53c6('0x77'),_0x53c6('0x78')]);_0x1035c0=_[_0x53c6('0x76')](_[_0x53c6('0x43')](_0x36100d),[_0x53c6('0x77'),_0x53c6('0x78'),'CompanyId',_0x53c6('0x79')]);_0xea7551[_0x53c6('0x58')]={'mapKey':_0x53c6('0x7a')};if(_0xea7551[_0x53c6('0x71')]['type']){switch(_0xea7551[_0x53c6('0x71')][_0x53c6('0x4e')]){case'twilio':_0xea7551['body']['from']=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x7b')];_0xea7551[_0x53c6('0x58')][_0x53c6('0x58')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x7c')];_0xea7551[_0x53c6('0x58')][_0x53c6('0x7d')]=_0x56dc86['body'][_0x53c6('0x7e')];break;case _0x53c6('0x7f'):_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')]='+'+_0x56dc86['body']['sender'];_0xea7551['body'][_0x53c6('0x58')]=_0x56dc86[_0x53c6('0x58')]['text'];break;case _0x53c6('0x81'):_0xea7551['body'][_0x53c6('0x80')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x80')];_0xea7551[_0x53c6('0x58')]['body']=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x27')];break;case _0x53c6('0x82'):_0xea7551['body'][_0x53c6('0x80')]=_0x56dc86['body']['from'];_0xea7551['body']['body']=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x58')];_0xea7551[_0x53c6('0x58')][_0x53c6('0x7d')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x83')];break;case'plivo':_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x7b')];_0xea7551['body'][_0x53c6('0x58')]=_0x56dc86[_0x53c6('0x58')]['Text'];_0xea7551[_0x53c6('0x58')]['messageId']=_0x56dc86['body']['MessageUUID'];break;case _0x53c6('0x84'):_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')]='+'+_0x56dc86['body']['results'][0x0][_0x53c6('0x80')];_0xea7551['body'][_0x53c6('0x58')]=_0x56dc86['body'][_0x53c6('0x85')][0x0]['text'];_0xea7551[_0x53c6('0x58')][_0x53c6('0x7d')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x85')][0x0][_0x53c6('0x7d')];break;case _0x53c6('0x86'):_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x87')];_0xea7551[_0x53c6('0x58')][_0x53c6('0x58')]=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x88')]['message'];break;case _0x53c6('0x89'):_0xea7551[_0x53c6('0x58')]['from']=_0x56dc86[_0x53c6('0x58')][_0x53c6('0x8a')];_0xea7551['body'][_0x53c6('0x58')]=_0x56dc86[_0x53c6('0x58')]['text'];_0xea7551[_0x53c6('0x58')][_0x53c6('0x7d')]=_0x56dc86['body'][_0x53c6('0x8b')];break;case _0x53c6('0x8c'):_0xea7551[_0x53c6('0x58')]['messageId']=_0x56dc86[_0x53c6('0x58')][0x0][_0x53c6('0x27')]['id'];_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')]=_0x56dc86[_0x53c6('0x58')][0x0][_0x53c6('0x27')][_0x53c6('0x80')];_0xea7551[_0x53c6('0x58')][_0x53c6('0x58')]=_0x56dc86[_0x53c6('0x58')][0x0][_0x53c6('0x27')]['text'];break;case _0x53c6('0x8d'):_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')]=_0x56dc86['body']['from'];_0xea7551[_0x53c6('0x58')]['body']=_0x56dc86['body']['message'];_0xea7551['body'][_0x53c6('0x7d')]=_0x56dc86[_0x53c6('0x58')]['refid'];break;}}if(_0xea7551['body']['id']){delete _0xea7551[_0x53c6('0x58')]['id'];}if(_[_0x53c6('0x8e')](_0xea7551[_0x53c6('0x58')]['from'])){throw new db[(_0x53c6('0x8f'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0xea7551['body'][_0x53c6('0x58')])||_0xea7551['body']['body']===''){throw new db[(_0x53c6('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x53c6('0x8e')](_0xea7551[_0x53c6('0x58')][_0x53c6('0x90')])){throw new db[(_0x53c6('0x8f'))][(_0x53c6('0x91'))](_0x53c6('0x92')+_0x1035c0);}if(!_['includes'](_0x1035c0,_0xea7551[_0x53c6('0x58')][_0x53c6('0x90')])){throw new db['Sequelize']['ValidationError'](_0x53c6('0x93')+_0x1035c0);}_0x32fe27[_0xea7551[_0x53c6('0x58')][_0x53c6('0x90')]]=_0xea7551[_0x53c6('0x58')]['from'];return db['CmList'][_0x53c6('0x5c')]({'where':{'id':_0xea7551[_0x53c6('0x71')]['ListId']},'include':[{'model':db[_0x53c6('0x94')],'as':'Contacts','where':_0x32fe27,'limit':0x1,'order':[['updatedAt',_0x53c6('0x95')]]}]});})[_0x53c6('0x20')](handleEntityNotFound(_0x42d0ab,null))[_0x53c6('0x20')](function(_0xaf91c2){if(_0xaf91c2){_0xea7551['list']=_[_0x53c6('0x96')](_0xaf91c2,[_0x53c6('0x97')]);if(_0xaf91c2[_0x53c6('0x97')][_0x53c6('0x48')]){return _0xaf91c2[_0x53c6('0x97')][0x0];}var _0x58a6bf=_[_0x53c6('0x18')](_0xea7551[_0x53c6('0x58')],{'firstName':_0xea7551['body'][_0x53c6('0x80')],'ListId':_0xaf91c2['id']});_0x58a6bf[_0xea7551[_0x53c6('0x58')][_0x53c6('0x90')]]=_0xea7551['body'][_0x53c6('0x80')];return db['CmContact']['create'](_0x58a6bf,{'fields':_0x4e1440,'raw':!![]});}})['then'](handleEntityNotFound(_0x42d0ab,null))['then'](function(_0x5e01e4){if(_0x5e01e4){_0xea7551['contact']=_0x5e01e4;var _0x80bfb0={'ContactId':_0x5e01e4['id'],'phone':_0xea7551[_0x53c6('0x58')][_0x53c6('0x80')],'SmsAccountId':_0x56dc86[_0x53c6('0x60')]['id']};var _0x1e8f6a={'ContactId':_0x5e01e4['id'],'SmsAccountId':_0x56dc86[_0x53c6('0x60')]['id'],'closed':![]};return db[_0x53c6('0x98')][_0x53c6('0x5c')]({'where':_0x1e8f6a})[_0x53c6('0x20')](function(_0x924da8){if(_0x924da8){return[_0x924da8,![]];}return db[_0x53c6('0x98')][_0x53c6('0x57')](_0x80bfb0)[_0x53c6('0x20')](function(_0x3cc7e9){return[_0x3cc7e9,!![]];});});}})['spread'](function(_0x504f2e,_0x4bd039){_0xea7551[_0x53c6('0x99')]=_0x504f2e[_0x53c6('0x36')]({'plain':!![]});_0xea7551[_0x53c6('0x99')][_0x53c6('0x9a')]=![];if(_0x4bd039){if(_0xea7551[_0x53c6('0x71')][_0x53c6('0x9b')]){_0xea7551[_0x53c6('0x72')][_0x53c6('0x9c')]({'id':0x0,'priority':_0xea7551[_0x53c6('0x72')]['length']+0x1,'app':_0x53c6('0x9d'),'appdata':_0x53c6('0x9e'),'interval':'*,*,*,*'});}_0xea7551[_0x53c6('0x99')][_0x53c6('0x9a')]=!![];}return db[_0x53c6('0x9f')][_0x53c6('0x57')]({'phone':_0xea7551['body']['from'],'messageId':_0xea7551[_0x53c6('0x58')][_0x53c6('0x7d')],'body':_0xea7551['body']['body'],'SmsAccountId':_0x56dc86[_0x53c6('0x60')]['id'],'SmsInteractionId':_0x504f2e['id'],'direction':'in','ContactId':_0x504f2e[_0x53c6('0xa0')],'AttachmentId':_0xea7551[_0x53c6('0x58')][_0x53c6('0xa1')]});})['then'](function(_0x35e6b9){_0xea7551[_0x53c6('0x27')]=_0x35e6b9;if(_0xea7551[_0x53c6('0x99')][_0x53c6('0xa2')]){return db[_0x53c6('0xa3')]['find']({'attributes':['id','name'],'where':{'id':_0xea7551['interaction'][_0x53c6('0xa2')]}})[_0x53c6('0x20')](function(_0x265350){if(_0x265350){_0xea7551[_0x53c6('0x72')][_0x53c6('0xa4')]({'id':0x0,'priority':0x0,'app':_0x53c6('0xa5'),'appdata':_0x265350[_0x53c6('0x3b')]+','+(_0xea7551[_0x53c6('0x71')][_0x53c6('0xa6')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x53c6('0xa7'),'startRouting',_0xea7551);});}return respondWithRpcPromise(_0x53c6('0xa7'),_0x53c6('0xa8'),_0xea7551);})[_0x53c6('0x20')](function(_0x48cfb7){if(_0x48cfb7){var _0x29b419=0xc8;var _0x570c59=_0x53c6('0xa9');logger[_0x53c6('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x570c59,_0x29b419,_0x53c6('0xaa'));logger[_0x53c6('0xab')](_0x53c6('0xac'),_0x570c59,_0x29b419,_0x53c6('0xaa'),JSON[_0x53c6('0x23')](_0x48cfb7));if(_0xea7551[_0x53c6('0x71')]['type']===_0x53c6('0xad')){return _0x42d0ab[_0x53c6('0x2c')](_0x29b419)[_0x53c6('0x31')]('Content-Type',_0x53c6('0xae'))['send'](_0x53c6('0xaf'));}else{return _0x42d0ab['status'](_0x29b419)['json'](_0x48cfb7);}}})[_0x53c6('0x2a')](handleError(_0x42d0ab,null));};exports[_0x53c6('0xb0')]=function(_0x14ce50,_0x152207){var _0x31d150=_0x14ce50[_0x53c6('0x60')]['id'];var _0x26c458=_0x14ce50['body'];var _0x2870a8=0xc8;var _0x18048d=null;return db[_0x53c6('0xb1')]['transaction']({'isolationLevel':db[_0x53c6('0xb1')]['Transaction'][_0x53c6('0xb2')][_0x53c6('0xb3')]},function(_0x33cf0c){return db['SmsAccount'][_0x53c6('0x65')]({'where':{'id':_0x31d150},'transaction':_0x33cf0c})[_0x53c6('0x20')](function(_0x241447){if(_0x241447){return db[_0x53c6('0x6f')][_0x53c6('0x35')]({'where':{'SmsAccountId':_0x31d150},'transaction':_0x33cf0c})[_0x53c6('0x20')](function(){var _0x2ddd85=_[_0x53c6('0x3d')](_0x26c458,function(_0x5253de){_0x5253de[_0x53c6('0x63')]=_0x31d150;return _0x5253de;});return db['SmsApplication'][_0x53c6('0xb4')](_0x2ddd85,{'transaction':_0x33cf0c});});}else{_0x2870a8=0x194;_0x18048d=[];}});})[_0x53c6('0x20')](function(){if(_0x2870a8!==0x194){return db['SmsApplication'][_0x53c6('0xb5')]({'where':{'SmsAccountId':_0x31d150},'order':_0x53c6('0x74')})[_0x53c6('0x20')](function(_0x336272){_0x18048d=_0x336272;});}})['catch'](function(_0x1ec49d){_0x2870a8=0x1f4;logger[_0x53c6('0x24')](_0x1ec49d[_0x53c6('0x3a')]);if(_0x1ec49d['name']){delete _0x1ec49d['name'];}_0x18048d=_0x1ec49d;})['finally'](function(){if(_0x18048d===null){_0x152207['sendStatus'](_0x2870a8);}else{if(_0x2870a8===0x1f4){_0x152207['status'](_0x2870a8)['send'](_0x18048d);}else{_0x152207['status'](_0x2870a8)[_0x53c6('0x2d')](_0x18048d);}}});};exports[_0x53c6('0xb6')]=function(_0x17fbbe,_0x1b591c,_0x4d3796){var _0x4fb3e3={};var _0x322e85={};var _0x277af9;var _0xbe59ab;return db[_0x53c6('0x3e')][_0x53c6('0x65')]({'where':{'id':_0x17fbbe['params']['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x1b591c,null))[_0x53c6('0x20')](function(_0x52ee8b){if(_0x52ee8b){_0x277af9=_0x52ee8b;_0x322e85[_0x53c6('0x41')]=_[_0x53c6('0x43')](db[_0x53c6('0x6f')][_0x53c6('0x3f')]);_0x322e85[_0x53c6('0x42')]=_['keys'](_0x17fbbe['query']);_0x322e85['filters']=_[_0x53c6('0x45')](_0x322e85[_0x53c6('0x41')],_0x322e85['query']);_0x4fb3e3['attributes']=_[_0x53c6('0x45')](_0x322e85[_0x53c6('0x41')],qs[_0x53c6('0x47')](_0x17fbbe[_0x53c6('0x42')][_0x53c6('0x47')]));_0x4fb3e3['attributes']=_0x4fb3e3['attributes'][_0x53c6('0x48')]?_0x4fb3e3[_0x53c6('0x46')]:_0x322e85[_0x53c6('0x41')];_0x4fb3e3['order']=qs[_0x53c6('0x4a')](_0x17fbbe[_0x53c6('0x42')][_0x53c6('0x4a')]);_0x4fb3e3[_0x53c6('0x4d')]=qs[_0x53c6('0x44')](_[_0x53c6('0x4b')](_0x17fbbe[_0x53c6('0x42')],_0x322e85['filters']));if(_0x17fbbe[_0x53c6('0x42')]['filter']){_0x4fb3e3[_0x53c6('0x4d')]=_[_0x53c6('0x50')](_0x4fb3e3[_0x53c6('0x4d')],{'$or':_[_0x53c6('0x3d')](_0x4fb3e3['attributes'],function(_0x58ef52){var _0x1c27f2={};_0x1c27f2[_0x58ef52]={'$like':'%'+_0x17fbbe[_0x53c6('0x42')]['filter']+'%'};return _0x1c27f2;})});}_0x4fb3e3=_['merge']({},_0x4fb3e3,_0x17fbbe[_0x53c6('0x56')]);return _0x277af9[_0x53c6('0xb6')](_0x4fb3e3);}})[_0x53c6('0x20')](function(_0x3b2ce0){if(_0x3b2ce0){_0xbe59ab=_0x3b2ce0[_0x53c6('0x48')];if(!_0x17fbbe[_0x53c6('0x42')][_0x53c6('0x49')]('nolimit')){_0x4fb3e3['limit']=qs[_0x53c6('0x2f')](_0x17fbbe[_0x53c6('0x42')][_0x53c6('0x2f')]);_0x4fb3e3[_0x53c6('0x2e')]=qs[_0x53c6('0x2e')](_0x17fbbe[_0x53c6('0x42')][_0x53c6('0x2e')]);}return _0x277af9[_0x53c6('0xb6')](_0x4fb3e3);}})['then'](function(_0x4e0b74){if(_0x4e0b74){return _0x4e0b74?{'count':_0xbe59ab,'rows':_0x4e0b74}:null;}})[_0x53c6('0x20')](respondWithResult(_0x1b591c,null))[_0x53c6('0x2a')](handleError(_0x1b591c,null));};exports[_0x53c6('0xb7')]=function(_0x16376c,_0x178ac8,_0x1988d6){var _0x1191de={'raw':![],'where':{}};var _0x558439={};var _0x32ce2b={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x16376c[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x178ac8,null))[_0x53c6('0x20')](function(_0x51f1a2){if(_0x51f1a2){_0x558439[_0x53c6('0x41')]=_[_0x53c6('0x43')](db[_0x53c6('0x98')][_0x53c6('0x3f')]);_0x558439[_0x53c6('0x42')]=_['keys'](_0x16376c[_0x53c6('0x42')]);_0x558439[_0x53c6('0x44')]=_[_0x53c6('0x45')](_0x558439[_0x53c6('0x41')],_0x558439['query']);_0x1191de['attributes']=_[_0x53c6('0x45')](_0x558439[_0x53c6('0x41')],qs['fields'](_0x16376c['query']['fields']));_0x1191de['attributes']=_0x1191de[_0x53c6('0x46')][_0x53c6('0x48')]?_0x1191de[_0x53c6('0x46')]:_0x558439[_0x53c6('0x41')];if(!_0x16376c[_0x53c6('0x42')][_0x53c6('0x49')](_0x53c6('0x67'))){_0x1191de['limit']=qs[_0x53c6('0x2f')](_0x16376c[_0x53c6('0x42')][_0x53c6('0x2f')]);_0x1191de[_0x53c6('0x2e')]=qs['offset'](_0x16376c[_0x53c6('0x42')][_0x53c6('0x2e')]);}_0x1191de[_0x53c6('0x68')]=qs[_0x53c6('0x4a')](_0x16376c[_0x53c6('0x42')][_0x53c6('0x4a')]);_0x1191de[_0x53c6('0x4d')]=qs[_0x53c6('0x44')](_[_0x53c6('0x4b')](_0x16376c[_0x53c6('0x42')],_0x558439['filters']));_0x1191de['where'][_0x53c6('0x63')]=_0x51f1a2['id'];if(_0x16376c[_0x53c6('0x42')]['filter']){_0x1191de[_0x53c6('0x4d')]=_[_0x53c6('0x50')](_0x1191de[_0x53c6('0x4d')],{'$or':_['map'](_0x1191de[_0x53c6('0x46')],function(_0x177e69){var _0x11d012={};_0x11d012[_0x177e69]={'$like':'%'+_0x16376c['query']['filter']+'%'};return _0x11d012;})});}_0x1191de=_[_0x53c6('0x50')]({},_0x1191de,_0x16376c[_0x53c6('0x56')]);return db[_0x53c6('0x98')][_0x53c6('0x30')]({'where':_0x1191de[_0x53c6('0x4d')]})[_0x53c6('0x20')](function(_0x52e1f0){_0x32ce2b[_0x53c6('0x30')]=_0x52e1f0;if(_0x16376c[_0x53c6('0x42')][_0x53c6('0x55')]){_0x1191de[_0x53c6('0x69')]=[{'model':db[_0x53c6('0x94')],'as':_0x53c6('0xb8'),'required':![]},{'model':db[_0x53c6('0xa3')],'as':_0x53c6('0xb9'),'attributes':[_0x53c6('0x3b'),_0x53c6('0xba'),_0x53c6('0xbb')],'required':![]},{'model':db['Tag'],'as':_0x53c6('0xbc'),'attributes':['id',_0x53c6('0x3b'),'color'],'where':_0x16376c[_0x53c6('0x42')]['tag']?{'id':_0x16376c[_0x53c6('0x42')][_0x53c6('0xbd')]}:undefined,'required':_0x16376c[_0x53c6('0x42')]['tag']?!![]:![]}];}return db[_0x53c6('0x98')][_0x53c6('0x51')](_0x1191de);})[_0x53c6('0x20')](function(_0xc853bb){_0x32ce2b[_0x53c6('0x52')]=_0xc853bb;return _0x32ce2b;});}})[_0x53c6('0x20')](respondWithFilteredResult(_0x178ac8,_0x1191de))[_0x53c6('0x2a')](handleError(_0x178ac8,null));};exports['send']=function(_0x245995,_0x1fe62f,_0x5ac8a4){var _0x18dd3b,_0xd0774b,_0x5312f6;if(_['isNil'](_0x245995[_0x53c6('0x58')][_0x53c6('0x58')])||_0x245995[_0x53c6('0x58')]['body']===''){throw new db[(_0x53c6('0x8f'))][(_0x53c6('0x91'))](_0x53c6('0xbe'));}if(_[_0x53c6('0x8e')](_0x245995[_0x53c6('0x58')]['to'])){throw new db['Sequelize'][(_0x53c6('0x91'))](_0x53c6('0xbf'));}_0x18dd3b=_0x245995['body']['to'];return db[_0x53c6('0x3e')][_0x53c6('0x5c')]({'where':{'id':_0x245995[_0x53c6('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x53c6('0xc0'),'include':[{'model':db[_0x53c6('0x94')],'as':_0x53c6('0x97'),'where':{'mobile':_0x18dd3b},'limit':0x1,'order':[[_0x53c6('0x78'),_0x53c6('0x95')]]}]}]})[_0x53c6('0x20')](handleEntityNotFound(_0x1fe62f,null))[_0x53c6('0x20')](function(_0x2d94d8){if(_0x2d94d8&&_0x2d94d8['List']){_0xd0774b=_0x2d94d8[_0x53c6('0x36')]({'plain':!![]});if(_0xd0774b[_0x53c6('0xc0')]&&_0xd0774b[_0x53c6('0xc0')][_0x53c6('0x97')][_0x53c6('0x48')]){return _0xd0774b[_0x53c6('0xc0')][_0x53c6('0x97')][0x0];}return db[_0x53c6('0x94')][_0x53c6('0x57')](_[_0x53c6('0x18')](_0x245995[_0x53c6('0x58')],{'firstName':_0x18dd3b,'mobile':_0x18dd3b,'phone':_0x18dd3b,'ListId':_0xd0774b[_0x53c6('0x79')]}));}})[_0x53c6('0x20')](handleEntityNotFound(_0x1fe62f,null))['then'](function(_0xe29c11){if(_0xe29c11){_0x5312f6=_0xe29c11;return db[_0x53c6('0x98')]['find']({'where':{'ContactId':_0x5312f6['id'],'closed':![],'SmsAccountId':_0xd0774b['id']}})['then'](function(_0x43eb48){if(_0x43eb48){return[_0x43eb48,![]];}return db['SmsInteraction']['create']({'UserId':_0x245995[_0x53c6('0x59')]['id'],'ContactId':_0x5312f6['id'],'SmsAccountId':_0xd0774b['id'],'phone':_0x18dd3b,'firstMsgDirection':_0x53c6('0xc1'),'Messages':[_[_0x53c6('0x50')](_0x245995[_0x53c6('0x58')],{'read':![],'body':_0x245995[_0x53c6('0x58')][_0x53c6('0x58')],'phone':_0x18dd3b,'SmsAccountId':_0xd0774b['id'],'UserId':_0x245995[_0x53c6('0x59')]['id'],'ContactId':_0x5312f6['id']})]},{'include':[{'model':db[_0x53c6('0x9f')],'as':_0x53c6('0xc2')}]})[_0x53c6('0x20')](function(_0x2ebd04){return[_0x2ebd04,!![]];});});}})[_0x53c6('0xc3')](function(_0x3bf508,_0x4c3d20){if(_0x4c3d20){return _0x3bf508;}return db[_0x53c6('0x9f')][_0x53c6('0x57')](_['merge'](_0x245995[_0x53c6('0x58')],{'read':![],'body':_0x245995[_0x53c6('0x58')][_0x53c6('0x58')],'phone':_0x18dd3b,'SmsAccountId':_0xd0774b['id'],'SmsInteractionId':_0x3bf508['id'],'UserId':_0x245995[_0x53c6('0x59')]['id'],'ContactId':_0x5312f6['id']}))[_0x53c6('0x20')](function(_0x524e44){_0x3bf508[_0x53c6('0xc4')]['Messages']=[];_0x3bf508[_0x53c6('0xc4')][_0x53c6('0xc2')][_0x53c6('0x9c')](_0x524e44['dataValues']);return _0x3bf508;});})['then'](respondWithResult(_0x1fe62f,null))[_0x53c6('0x2a')](handleError(_0x1fe62f,null));};exports[_0x53c6('0x2c')]=function(_0xed8f5e,_0x2d2126,_0x513a41){if(_0xed8f5e[_0x53c6('0x58')]['id']){delete _0xed8f5e['body']['id'];}var _0x5c4320,_0x4ff6bf,_0x412e01;return db[_0x53c6('0x3e')][_0x53c6('0x5c')]({'where':{'id':_0xed8f5e[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x2d2126,null))[_0x53c6('0x20')](function(_0x9e2ace){if(_0x9e2ace){_0x412e01=_0x9e2ace;logger[_0x53c6('0xab')](_0x53c6('0x22'),_0x53c6('0x2c'),_0x53c6('0xc5'),_0x9e2ace['type'],util[_0x53c6('0xc6')](_0xed8f5e['body'],{'showHidden':![],'depth':null}));switch(_0x9e2ace['type']){case'skebby':if(_0xed8f5e[_0x53c6('0x58')][_0x53c6('0xc7')]&&_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x2c')]){_0x4ff6bf=_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0xed8f5e[_0x53c6('0x58')][_0x53c6('0xc7')]}});}break;case _0x53c6('0x81'):if(_0xed8f5e[_0x53c6('0x58')][_0x53c6('0xc8')]&&_0xed8f5e['body']['statusInt']){_0x4ff6bf=_0xed8f5e[_0x53c6('0x58')][_0x53c6('0xc9')];return db[_0x53c6('0x9f')][_0x53c6('0x5c')]({'where':{'messageId':_0xed8f5e[_0x53c6('0x58')][_0x53c6('0xc8')]}});}break;case _0x53c6('0x82'):if(_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x83')]&&_0xed8f5e['body']['status_code']){_0x4ff6bf=_0xed8f5e['body'][_0x53c6('0xca')];return db['SmsMessage'][_0x53c6('0x5c')]({'where':{'messageId':_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x83')]}});}break;case _0x53c6('0x84'):var _0x2a2551=_0xed8f5e[_0x53c6('0x58')]['results'][0x0];if(_0x2a2551[_0x53c6('0x7d')]&&_0x2a2551[_0x53c6('0x2c')][_0x53c6('0xcb')]===_0x53c6('0xcc')){_0x4ff6bf=_0x2a2551[_0x53c6('0x2c')][_0x53c6('0xcb')];return db[_0x53c6('0x9f')][_0x53c6('0x5c')]({'where':{'messageId':_0x2a2551['messageId']}});}break;case _0x53c6('0x89'):if(_0xed8f5e['body'][_0x53c6('0x7d')]&&_0xed8f5e['body'][_0x53c6('0x2c')]){_0x4ff6bf=_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x2c')];return db[_0x53c6('0x9f')][_0x53c6('0x5c')]({'where':{'messageId':_0xed8f5e['body']['messageId']}});}break;case _0x53c6('0x8c'):if(_0xed8f5e[_0x53c6('0x58')][0x0][_0x53c6('0x27')]['id']){_0x4ff6bf=_0xed8f5e[_0x53c6('0x58')][0x0][_0x53c6('0x4e')];return db[_0x53c6('0x9f')][_0x53c6('0x5c')]({'where':{'messageId':_0xed8f5e[_0x53c6('0x58')][0x0][_0x53c6('0x27')]['id']}});}break;case _0x53c6('0x8d'):if(_0xed8f5e[_0x53c6('0x58')]['redif']&&_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x2c')]){_0x4ff6bf=_0xed8f5e['body'][_0x53c6('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0xed8f5e[_0x53c6('0x58')]['redif']}});}break;}}})[_0x53c6('0x20')](handleEntityNotFound(_0x2d2126,null))['then'](function(_0x39f49a){if(_0x39f49a){_0x5c4320=_0x39f49a;switch(_0x412e01[_0x53c6('0x4e')]){case _0x53c6('0x7f'):if(_0x4ff6bf==='DELIVERED'){return _0x5c4320[_0x53c6('0xcd')]({'read':!![]});}else{logger[_0x53c6('0x24')](_0x53c6('0x22'),'status',_0x53c6('0x7f'),util[_0x53c6('0xc6')](_0xed8f5e[_0x53c6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53c6('0x81'):if(_0x4ff6bf==='1'){return _0x5c4320[_0x53c6('0xcd')]({'read':!![]});}else{logger[_0x53c6('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53c6('0x2c'),_0x53c6('0x7f'),util[_0x53c6('0xc6')](_0xed8f5e['body'],{'showHidden':![],'depth':null}));}break;case _0x53c6('0x82'):if(!_0xed8f5e[_0x53c6('0x58')][_0x53c6('0xce')]&&_0x4ff6bf>=0xc8&&_0x4ff6bf<=0xce){return _0x5c4320[_0x53c6('0xcd')]({'read':!![]});}else{logger[_0x53c6('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53c6('0x2c'),_0x53c6('0x82'),util[_0x53c6('0xc6')](_0xed8f5e[_0x53c6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53c6('0x84'):var _0x1748a0=_0xed8f5e[_0x53c6('0x58')][_0x53c6('0x85')][0x0];if(_0x1748a0[_0x53c6('0x2c')]['groupName']==='DELIVERED'){return _0x5c4320['update']({'read':!![]});}else{logger['error'](_0x53c6('0x22'),_0x53c6('0x2c'),'infobip',util['inspect'](_0xed8f5e['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4ff6bf==_0x53c6('0xcf')||_0x4ff6bf=='RECEIVED_BY_RECIPIENT'){return _0x5c4320['update']({'read':!![]});}else{logger[_0x53c6('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53c6('0x2c'),_0x53c6('0x89'),util['inspect'](_0xed8f5e[_0x53c6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53c6('0x8c'):if(_0x4ff6bf==_0x53c6('0xd0')){return _0x5c4320[_0x53c6('0xcd')]({'read':!![]});}else{logger[_0x53c6('0x24')](_0x53c6('0x22'),_0x53c6('0x2c'),_0x53c6('0x8c'),util[_0x53c6('0xc6')](_0xed8f5e[_0x53c6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53c6('0x8d'):if(_0x4ff6bf==='DELIVRD'||_0x4ff6bf===_0x53c6('0xd1')){return _0x5c4320[_0x53c6('0xcd')]({'read':!![]});}else{logger[_0x53c6('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53c6('0x2c'),'intelepeer',util[_0x53c6('0xc6')](_0xed8f5e[_0x53c6('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5c4320;}})[_0x53c6('0x20')](respondWithResult(_0x2d2126,null))[_0x53c6('0x2a')](handleError(_0x2d2126,null));};exports['statusGet']=function(_0x21d33e,_0x3fe949,_0x1129a3){var _0x500d5e,_0x384db9,_0x392c31;return db[_0x53c6('0x3e')][_0x53c6('0x5c')]({'where':{'id':_0x21d33e['params']['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x3fe949,null))[_0x53c6('0x20')](function(_0xd16253){if(_0xd16253){_0x392c31=_0xd16253;logger[_0x53c6('0xab')](_0x53c6('0x22'),_0x53c6('0x2c'),_0x53c6('0xc5'),_0xd16253[_0x53c6('0x4e')],util[_0x53c6('0xc6')](_0x21d33e['query'],{'showHidden':![],'depth':null}));switch(_0xd16253['type']){case _0x53c6('0x86'):if(_0x21d33e[_0x53c6('0x42')]['message-id']&&_0x21d33e['query']['state']){_0x384db9=_0x21d33e[_0x53c6('0x42')]['state'];return db[_0x53c6('0x9f')]['find']({'where':{'messageId':_0x21d33e[_0x53c6('0x42')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x3fe949,null))['then'](function(_0x1d9dd0){if(_0x1d9dd0){_0x500d5e=_0x1d9dd0;switch(_0x392c31[_0x53c6('0x4e')]){case'csc':if(_0x384db9==='2'||_0x384db9==='6'){return _0x500d5e[_0x53c6('0xcd')]({'read':!![]});}else{logger[_0x53c6('0x24')](_0x53c6('0x22'),'status',_0x53c6('0x86'),util[_0x53c6('0xc6')](_0x21d33e['query'],{'showHidden':![],'depth':null}));};break;}return _0x500d5e;}})[_0x53c6('0x20')](respondWithResult(_0x3fe949,null))['catch'](handleError(_0x3fe949,null));};exports[_0x53c6('0xd2')]=function(_0x188d58,_0x5e1689,_0x527a0c){return db['SmsAccount'][_0x53c6('0x5c')]({'where':{'id':_0x188d58['params']['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x5e1689,null))['then'](function(_0x5b6b8b){if(_0x5b6b8b){return _0x5b6b8b[_0x53c6('0xd2')](_0x188d58[_0x53c6('0x58')][_0x53c6('0x6b')],_[_0x53c6('0x96')](_0x188d58[_0x53c6('0x58')],[_0x53c6('0x6b'),'id'])||{})[_0x53c6('0xc3')](function(_0xf7656f){for(var _0x41c88f=0x0;_0x41c88f<_0x188d58[_0x53c6('0x58')][_0x53c6('0x6b')][_0x53c6('0x48')];_0x41c88f+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x188d58['body'][_0x53c6('0x6b')][_0x41c88f]),'SmsAccountId':Number(_0x188d58['params']['id'])});}return _0xf7656f;});}})[_0x53c6('0x20')](respondWithResult(_0x5e1689,null))[_0x53c6('0x2a')](handleError(_0x5e1689,null));};exports[_0x53c6('0xd3')]=function(_0x2ce675,_0x6fb1ce,_0x3b1771){return db[_0x53c6('0x3e')][_0x53c6('0x5c')]({'where':{'id':_0x2ce675[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x6fb1ce,null))[_0x53c6('0x20')](function(_0x4aa265){if(_0x4aa265){return _0x4aa265[_0x53c6('0xd3')](_0x2ce675[_0x53c6('0x42')][_0x53c6('0x6b')])[_0x53c6('0x20')](function(){if(_['isArray'](_0x2ce675[_0x53c6('0x42')][_0x53c6('0x6b')])){for(var _0x179d46=0x0;_0x179d46<_0x2ce675[_0x53c6('0x42')]['ids'][_0x53c6('0x48')];_0x179d46+=0x1){socket['emit'](_0x53c6('0xd4'),{'UserId':Number(_0x2ce675[_0x53c6('0x42')]['ids'][_0x179d46]),'SmsAccountId':Number(_0x2ce675[_0x53c6('0x60')]['id'])});}}else{socket[_0x53c6('0xd5')](_0x53c6('0xd4'),{'UserId':Number(_0x2ce675[_0x53c6('0x42')][_0x53c6('0x6b')]),'SmsAccountId':Number(_0x2ce675[_0x53c6('0x60')]['id'])});}});}})[_0x53c6('0x20')](respondWithStatusCode(_0x6fb1ce,null))['catch'](handleError(_0x6fb1ce,null));};exports[_0x53c6('0xd6')]=function(_0x38ae81,_0x545411,_0x2d0578){var _0x3a052d={};var _0x18cf18={};var _0x361d17;var _0x5c03c1;return db['SmsAccount'][_0x53c6('0x65')]({'where':{'id':_0x38ae81[_0x53c6('0x60')]['id']}})[_0x53c6('0x20')](handleEntityNotFound(_0x545411,null))[_0x53c6('0x20')](function(_0x2d744e){if(_0x2d744e){_0x361d17=_0x2d744e;_0x18cf18[_0x53c6('0x41')]=_[_0x53c6('0x43')](db[_0x53c6('0xa3')]['rawAttributes']);_0x18cf18['query']=_['keys'](_0x38ae81[_0x53c6('0x42')]);_0x18cf18[_0x53c6('0x44')]=_[_0x53c6('0x45')](_0x18cf18[_0x53c6('0x41')],_0x18cf18['query']);_0x3a052d['attributes']=_[_0x53c6('0x45')](_0x18cf18[_0x53c6('0x41')],qs['fields'](_0x38ae81[_0x53c6('0x42')]['fields']));_0x3a052d[_0x53c6('0x46')]=_0x3a052d[_0x53c6('0x46')]['length']?_0x3a052d['attributes']:_0x18cf18[_0x53c6('0x41')];_0x3a052d['order']=qs[_0x53c6('0x4a')](_0x38ae81[_0x53c6('0x42')]['sort']);_0x3a052d['where']=qs[_0x53c6('0x44')](_[_0x53c6('0x4b')](_0x38ae81['query'],_0x18cf18[_0x53c6('0x44')]));if(_0x38ae81[_0x53c6('0x42')][_0x53c6('0x4c')]){_0x3a052d[_0x53c6('0x4d')]=_['merge'](_0x3a052d[_0x53c6('0x4d')],{'$or':_[_0x53c6('0x3d')](_0x3a052d[_0x53c6('0x46')],function(_0x5bc90b){var _0x2b649d={};_0x2b649d[_0x5bc90b]={'$like':'%'+_0x38ae81[_0x53c6('0x42')][_0x53c6('0x4c')]+'%'};return _0x2b649d;})});}_0x3a052d=_[_0x53c6('0x50')]({},_0x3a052d,_0x38ae81[_0x53c6('0x56')]);return _0x361d17[_0x53c6('0xd6')](_0x3a052d);}})['then'](function(_0x42b814){if(_0x42b814){_0x5c03c1=_0x42b814[_0x53c6('0x48')];if(!_0x38ae81[_0x53c6('0x42')][_0x53c6('0x49')](_0x53c6('0x67'))){_0x3a052d[_0x53c6('0x2f')]=qs[_0x53c6('0x2f')](_0x38ae81[_0x53c6('0x42')][_0x53c6('0x2f')]);_0x3a052d['offset']=qs['offset'](_0x38ae81[_0x53c6('0x42')][_0x53c6('0x2e')]);}return _0x361d17['getAgents'](_0x3a052d);}})[_0x53c6('0x20')](function(_0x44ab05){if(_0x44ab05){return _0x44ab05?{'count':_0x5c03c1,'rows':_0x44ab05}:null;}})['then'](respondWithResult(_0x545411,null))['catch'](handleError(_0x545411,null));};
\ No newline at end of file
index 5200d10..323d4b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf856=['hook','exports','../../mysqldb','SmsAccount','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x473df6,_0x1ab1cf){var _0x5064d2=function(_0x1b9c82){while(--_0x1b9c82){_0x473df6['push'](_0x473df6['shift']());}};_0x5064d2(++_0x1ab1cf);}(_0xf856,0xb2));var _0x6f85=function(_0x48c9cf,_0x7406c){_0x48c9cf=_0x48c9cf-0x0;var _0x5735cb=_0xf856[_0x48c9cf];return _0x5735cb;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x6f85('0x0'))['db'][_0x6f85('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6f85('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f85('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40c5d0){return function(_0x2e19d6,_0xa89753,_0x57e7de){SmsAccountEvents[_0x6f85('0x4')](_0x40c5d0+':'+_0x2e19d6['id'],_0x2e19d6);SmsAccountEvents[_0x6f85('0x4')](_0x40c5d0,_0x2e19d6);_0x57e7de(null);};}for(var e in events){if(events[_0x6f85('0x5')](e)){var event=events[e];SmsAccount[_0x6f85('0x6')](e,emitEvent(event));}}module[_0x6f85('0x7')]=SmsAccountEvents;
\ No newline at end of file
+var _0xd861=['emit','hook','../../mysqldb','setMaxListeners','save','remove'];(function(_0x2be70d,_0x1a8d5d){var _0x902636=function(_0x4efb74){while(--_0x4efb74){_0x2be70d['push'](_0x2be70d['shift']());}};_0x902636(++_0x1a8d5d);}(_0xd861,0x1c4));var _0x1d86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd861[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x1d86('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1d86('0x1')](0x0);var events={'afterCreate':_0x1d86('0x2'),'afterUpdate':'update','afterDestroy':_0x1d86('0x3')};function emitEvent(_0xd42d5c){return function(_0x4a485f,_0x3191b1,_0x243eb9){SmsAccountEvents['emit'](_0xd42d5c+':'+_0x4a485f['id'],_0x4a485f);SmsAccountEvents[_0x1d86('0x4')](_0xd42d5c,_0x4a485f);_0x243eb9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x1d86('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents;
\ No newline at end of file
index 1879def..0c88f47 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e5a=['path','../../config/environment','./smsAccount.attributes','define','sms_accounts','util','../../config/logger','moment','request-promise'];(function(_0x4979ce,_0x4ff8fc){var _0x20536f=function(_0x466847){while(--_0x466847){_0x4979ce['push'](_0x4979ce['shift']());}};_0x20536f(++_0x4ff8fc);}(_0x5e5a,0x188));var _0xa5e5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5e5a[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xa5e5('0x0'));var logger=require(_0xa5e5('0x1'))('api');var moment=require(_0xa5e5('0x2'));var BPromise=require('bluebird');var rp=require(_0xa5e5('0x3'));var fs=require('fs');var path=require(_0xa5e5('0x4'));var rimraf=require('rimraf');var config=require(_0xa5e5('0x5'));var attributes=require(_0xa5e5('0x6'));module['exports']=function(_0x430bbc,_0x2f2e7b){return _0x430bbc[_0xa5e5('0x7')]('SmsAccount',attributes,{'tableName':_0xa5e5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5b17=['api','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','sms_accounts','util','../../config/logger'];(function(_0x2051c2,_0x2ba395){var _0x15a43f=function(_0x2c9c95){while(--_0x2c9c95){_0x2051c2['push'](_0x2051c2['shift']());}};_0x15a43f(++_0x2ba395);}(_0x5b17,0x174));var _0x75b1=function(_0x23c3ea,_0x587d81){_0x23c3ea=_0x23c3ea-0x0;var _0x2eca1c=_0x5b17[_0x23c3ea];return _0x2eca1c;};'use strict';var _=require('lodash');var util=require(_0x75b1('0x0'));var logger=require(_0x75b1('0x1'))(_0x75b1('0x2'));var moment=require(_0x75b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x75b1('0x4'));var fs=require('fs');var path=require(_0x75b1('0x5'));var rimraf=require(_0x75b1('0x6'));var config=require(_0x75b1('0x7'));var attributes=require(_0x75b1('0x8'));module[_0x75b1('0x9')]=function(_0x3dc170,_0x337180){return _0x3dc170['define']('SmsAccount',attributes,{'tableName':_0x75b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9ac9c74..f755e7c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3fb9=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','lodash'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x3fb9,0xcb));var _0x93fb=function(_0x5e1104,_0x53695d){_0x5e1104=_0x5e1104-0x0;var _0x474e43=_0x3fb9[_0x5e1104];return _0x474e43;};'use strict';var _=require(_0x93fb('0x0'));var util=require(_0x93fb('0x1'));var moment=require(_0x93fb('0x2'));var BPromise=require('bluebird');var rs=require(_0x93fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93fb('0x4'))['db'];var utils=require(_0x93fb('0x5'));var logger=require(_0x93fb('0x6'))(_0x93fb('0x7'));var config=require(_0x93fb('0x8'));var jayson=require(_0x93fb('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x93fb('0xa')]=_[_0x93fb('0xb')](config[_0x93fb('0xa')],{'host':_0x93fb('0xc'),'port':0x18eb});var socket=require(_0x93fb('0xd'))(new Redis(config[_0x93fb('0xa')]));require(_0x93fb('0xe'))['register'](socket);function respondWithRpcPromise(_0x2beafd,_0x417a9d,_0x26a17c){return new BPromise(function(_0x3a2e23,_0x56a652){return client[_0x93fb('0xf')](_0x2beafd,_0x26a17c)[_0x93fb('0x10')](function(_0x29f66f){logger[_0x93fb('0x11')](_0x93fb('0x12'),_0x417a9d,_0x93fb('0x13'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x417a9d,_0x93fb('0x13'),JSON[_0x93fb('0x14')](_0x29f66f));if(_0x29f66f[_0x93fb('0x15')]){if(_0x29f66f[_0x93fb('0x15')][_0x93fb('0x16')]===0x1f4){logger[_0x93fb('0x15')]('SmsAccount,\x20%s,\x20%s',_0x417a9d,_0x29f66f[_0x93fb('0x15')][_0x93fb('0x17')]);return _0x56a652(_0x29f66f[_0x93fb('0x15')][_0x93fb('0x17')]);}logger[_0x93fb('0x15')](_0x93fb('0x12'),_0x417a9d,_0x29f66f[_0x93fb('0x15')]['message']);return _0x3a2e23(_0x29f66f[_0x93fb('0x15')][_0x93fb('0x17')]);}else{logger[_0x93fb('0x11')](_0x93fb('0x12'),_0x417a9d,'request\x20sent');_0x3a2e23(_0x29f66f['result']['message']);}})[_0x93fb('0x18')](function(_0x239424){logger[_0x93fb('0x15')]('SmsAccount,\x20%s,\x20%s',_0x417a9d,_0x239424);_0x56a652(_0x239424);});});}exports[_0x93fb('0x19')]=function(_0x210e4d){var _0x4a09d6=this;return new Promise(function(_0x1b963d,_0x4271b8){return db[_0x93fb('0x1a')][_0x93fb('0x1b')]({'raw':_0x210e4d[_0x93fb('0x1c')]?_0x210e4d['options']['raw']===undefined?!![]:![]:!![],'where':_0x210e4d[_0x93fb('0x1c')]?_0x210e4d['options'][_0x93fb('0x1d')]||null:null,'attributes':_0x210e4d['options']?_0x210e4d[_0x93fb('0x1c')][_0x93fb('0x1e')]||null:null,'include':_0x210e4d[_0x93fb('0x1c')]?_0x210e4d[_0x93fb('0x1c')][_0x93fb('0x1f')]?_[_0x93fb('0x20')](_0x210e4d[_0x93fb('0x1c')][_0x93fb('0x1f')],function(_0x24331c){return{'model':db[_0x24331c[_0x93fb('0x21')]],'as':_0x24331c['as'],'attributes':_0x24331c[_0x93fb('0x1e')],'include':_0x24331c[_0x93fb('0x1f')]?_[_0x93fb('0x20')](_0x24331c['include'],function(_0x3e8387){return{'model':db[_0x3e8387[_0x93fb('0x21')]],'as':_0x3e8387['as'],'attributes':_0x3e8387[_0x93fb('0x1e')],'include':_0x3e8387[_0x93fb('0x1f')]?_[_0x93fb('0x20')](_0x3e8387[_0x93fb('0x1f')],function(_0x14dc7f){return{'model':db[_0x14dc7f[_0x93fb('0x21')]],'as':_0x14dc7f['as'],'attributes':_0x14dc7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x93fb('0x10')](function(_0x27c797){logger[_0x93fb('0x11')](_0x93fb('0x19'),_0x210e4d);logger['debug'](_0x93fb('0x19'),_0x210e4d,JSON[_0x93fb('0x14')](_0x27c797));_0x1b963d(_0x27c797);})['catch'](function(_0x2cbddf){logger['error'](_0x93fb('0x19'),_0x2cbddf[_0x93fb('0x17')],_0x210e4d);_0x4271b8(_0x4a09d6[_0x93fb('0x15')](0x1f4,_0x2cbddf[_0x93fb('0x17')]));});});};
\ No newline at end of file
+var _0x89d9=['model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89d9,0x64));var _0x989d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x89d9[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x989d('0x0'));var util=require(_0x989d('0x1'));var moment=require(_0x989d('0x2'));var BPromise=require('bluebird');var rs=require(_0x989d('0x3'));var fs=require('fs');var Redis=require(_0x989d('0x4'));var db=require(_0x989d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x989d('0x6'))('rpc');var config=require(_0x989d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x989d('0x8')][_0x989d('0x9')]({'port':0x232a});config[_0x989d('0xa')]=_[_0x989d('0xb')](config[_0x989d('0xa')],{'host':_0x989d('0xc'),'port':0x18eb});var socket=require(_0x989d('0xd'))(new Redis(config[_0x989d('0xa')]));require('./smsAccount.socket')[_0x989d('0xe')](socket);function respondWithRpcPromise(_0x5a8969,_0x2c2052,_0x5aa39f){return new BPromise(function(_0x58455c,_0x24b247){return client[_0x989d('0xf')](_0x5a8969,_0x5aa39f)[_0x989d('0x10')](function(_0x577244){logger[_0x989d('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2c2052,_0x989d('0x12'));logger[_0x989d('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c2052,_0x989d('0x12'),JSON[_0x989d('0x14')](_0x577244));if(_0x577244[_0x989d('0x15')]){if(_0x577244[_0x989d('0x15')]['code']===0x1f4){logger[_0x989d('0x15')](_0x989d('0x16'),_0x2c2052,_0x577244[_0x989d('0x15')]['message']);return _0x24b247(_0x577244['error'][_0x989d('0x17')]);}logger[_0x989d('0x15')](_0x989d('0x16'),_0x2c2052,_0x577244[_0x989d('0x15')]['message']);return _0x58455c(_0x577244[_0x989d('0x15')][_0x989d('0x17')]);}else{logger['info'](_0x989d('0x16'),_0x2c2052,'request\x20sent');_0x58455c(_0x577244['result'][_0x989d('0x17')]);}})[_0x989d('0x18')](function(_0x2586aa){logger[_0x989d('0x15')](_0x989d('0x16'),_0x2c2052,_0x2586aa);_0x24b247(_0x2586aa);});});}exports[_0x989d('0x19')]=function(_0x7130ec){var _0x256310=this;return new Promise(function(_0x420f31,_0x4a2c31){return db[_0x989d('0x1a')]['find']({'raw':_0x7130ec['options']?_0x7130ec[_0x989d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x7130ec[_0x989d('0x1b')]?_0x7130ec[_0x989d('0x1b')][_0x989d('0x1c')]||null:null,'attributes':_0x7130ec[_0x989d('0x1b')]?_0x7130ec[_0x989d('0x1b')][_0x989d('0x1d')]||null:null,'include':_0x7130ec[_0x989d('0x1b')]?_0x7130ec[_0x989d('0x1b')][_0x989d('0x1e')]?_[_0x989d('0x1f')](_0x7130ec[_0x989d('0x1b')]['include'],function(_0x1817b5){return{'model':db[_0x1817b5[_0x989d('0x20')]],'as':_0x1817b5['as'],'attributes':_0x1817b5['attributes'],'include':_0x1817b5[_0x989d('0x1e')]?_[_0x989d('0x1f')](_0x1817b5[_0x989d('0x1e')],function(_0x2d5c76){return{'model':db[_0x2d5c76[_0x989d('0x20')]],'as':_0x2d5c76['as'],'attributes':_0x2d5c76[_0x989d('0x1d')],'include':_0x2d5c76[_0x989d('0x1e')]?_[_0x989d('0x1f')](_0x2d5c76[_0x989d('0x1e')],function(_0x5a446d){return{'model':db[_0x5a446d[_0x989d('0x20')]],'as':_0x5a446d['as'],'attributes':_0x5a446d['attributes']};}):[]};}):[]};}):[]:[]})[_0x989d('0x10')](function(_0x27dcef){logger[_0x989d('0x11')](_0x989d('0x19'),_0x7130ec);logger[_0x989d('0x13')](_0x989d('0x19'),_0x7130ec,JSON[_0x989d('0x14')](_0x27dcef));_0x420f31(_0x27dcef);})['catch'](function(_0x447e7b){logger[_0x989d('0x15')]('ShowSmsAccount',_0x447e7b[_0x989d('0x17')],_0x7130ec);_0x4a2c31(_0x256310[_0x989d('0x15')](0x1f4,_0x447e7b['message']));});});};
\ No newline at end of file
index 3becf20..bd08b6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index 79de89f..d1c7571 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x1ebe78,_0x1d0d24){var _0x51783b=function(_0xd3d75a){while(--_0xd3d75a){_0x1ebe78['push'](_0x1ebe78['shift']());}};_0x51783b(++_0x1d0d24);}(_0x008c,0x188));var _0xc008=function(_0x74c6c6,_0x54d54e){_0x74c6c6=_0x74c6c6-0x0;var _0x56ba8b=_0x008c[_0x74c6c6];return _0x56ba8b;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router;
\ No newline at end of file
+var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x581df7,_0x45a97b){var _0x23f532=function(_0x20ce60){while(--_0x20ce60){_0x581df7['push'](_0x581df7['shift']());}};_0x23f532(++_0x45a97b);}(_0x55ca,0x126));var _0xa55c=function(_0x37e9c1,_0x20ff2a){_0x37e9c1=_0x37e9c1-0x0;var _0x3b12bd=_0x55ca[_0x37e9c1];return _0x3b12bd;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router;
\ No newline at end of file
index aa69adb..b1acfe9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2138=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x39846e,_0x730172){var _0x349df9=function(_0x185eab){while(--_0x185eab){_0x39846e['push'](_0x39846e['shift']());}};_0x349df9(++_0x730172);}(_0x2138,0x18b));var _0x8213=function(_0x102ac2,_0x1eaca5){_0x102ac2=_0x102ac2-0x0;var _0x54b175=_0x2138[_0x102ac2];return _0x54b175;};'use strict';var Sequelize=require('sequelize');module[_0x8213('0x0')]={'priority':{'type':Sequelize[_0x8213('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8213('0x2')],'allowNull':![],'defaultValue':_0x8213('0x3')},'appdata':{'type':Sequelize[_0x8213('0x4')]()},'description':{'type':Sequelize[_0x8213('0x2')]},'interval':{'type':Sequelize[_0x8213('0x2')],'defaultValue':_0x8213('0x5')}};
\ No newline at end of file
+var _0xdb51=['INTEGER','STRING','noop','sequelize'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0xdb51,0x6b));var _0x1db5=function(_0xa4a9ef,_0x38a8c4){_0xa4a9ef=_0xa4a9ef-0x0;var _0x3c636a=_0xdb51[_0xa4a9ef];return _0x3c636a;};'use strict';var Sequelize=require(_0x1db5('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1db5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1db5('0x2')],'allowNull':![],'defaultValue':_0x1db5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1db5('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index 402a460..aae8ec3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f49=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','reject','update','destroy','then','stack','name','index','map','SmsApplication','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x6f49,0x113));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x96f4('0x0'));var rimraf=require(_0x96f4('0x1'));var zipdir=require(_0x96f4('0x2'));var jsonpatch=require(_0x96f4('0x3'));var rp=require(_0x96f4('0x4'));var moment=require(_0x96f4('0x5'));var BPromise=require(_0x96f4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x96f4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x96f4('0x8'));var fs=require('fs');var fs_extra=require(_0x96f4('0x9'));var _=require(_0x96f4('0xa'));var squel=require(_0x96f4('0xb'));var crypto=require('crypto');var jsforce=require(_0x96f4('0xc'));var deskjs=require(_0x96f4('0xd'));var toCsv=require(_0x96f4('0xe'));var querystring=require('querystring');var Papa=require(_0x96f4('0xf'));var Redis=require(_0x96f4('0x10'));var authService=require(_0x96f4('0x11'));var qs=require(_0x96f4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96f4('0x13'));var logger=require(_0x96f4('0x14'))('api');var utils=require(_0x96f4('0x15'));var config=require(_0x96f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x96f4('0x17'))['db'];function respondWithStatusCode(_0x4e4570,_0xc29c0e){_0xc29c0e=_0xc29c0e||0xcc;return function(_0x3fb4d1){if(_0x3fb4d1){return _0x4e4570[_0x96f4('0x18')](_0xc29c0e);}return _0x4e4570['status'](_0xc29c0e)['end']();};}function respondWithResult(_0x4516b4,_0x3e3435){_0x3e3435=_0x3e3435||0xc8;return function(_0x2f2c3a){if(_0x2f2c3a){return _0x4516b4['status'](_0x3e3435)[_0x96f4('0x19')](_0x2f2c3a);}};}function respondWithFilteredResult(_0x5d82b1,_0x29bab1){return function(_0x2b170c){if(_0x2b170c){var _0x21af8c=typeof _0x29bab1[_0x96f4('0x1a')]===_0x96f4('0x1b')&&typeof _0x29bab1['limit']==='undefined';var _0x387f46=_0x2b170c[_0x96f4('0x1c')];var _0x394d16=_0x21af8c?0x0:_0x29bab1['offset'];var _0x113981=_0x21af8c?_0x2b170c[_0x96f4('0x1c')]:_0x29bab1[_0x96f4('0x1a')]+_0x29bab1[_0x96f4('0x1d')];var _0x571b59;if(_0x113981>=_0x387f46){_0x113981=_0x387f46;_0x571b59=0xc8;}else{_0x571b59=0xce;}_0x5d82b1[_0x96f4('0x1e')](_0x571b59);return _0x5d82b1[_0x96f4('0x1f')](_0x96f4('0x20'),_0x394d16+'-'+_0x113981+'/'+_0x387f46)[_0x96f4('0x19')](_0x2b170c);}return null;};}function patchUpdates(_0x19c132){return function(_0x20c164){try{jsonpatch['apply'](_0x20c164,_0x19c132,!![]);}catch(_0x112fc0){return BPromise[_0x96f4('0x21')](_0x112fc0);}return _0x20c164['save']();};}function saveUpdates(_0x4f68d5,_0x30de1a){return function(_0x3911c6){if(_0x3911c6){return _0x3911c6[_0x96f4('0x22')](_0x4f68d5)['then'](function(_0x185567){return _0x185567;});}return null;};}function removeEntity(_0xdc7d88,_0x5a2462){return function(_0x3f7661){if(_0x3f7661){return _0x3f7661[_0x96f4('0x23')]()[_0x96f4('0x24')](function(){_0xdc7d88[_0x96f4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1995e1,_0x594941){return function(_0x1f2db5){if(!_0x1f2db5){_0x1995e1[_0x96f4('0x18')](0x194);}return _0x1f2db5;};}function handleError(_0x34128d,_0x164fbf){_0x164fbf=_0x164fbf||0x1f4;return function(_0x1e2911){logger['error'](_0x1e2911[_0x96f4('0x25')]);if(_0x1e2911[_0x96f4('0x26')]){delete _0x1e2911[_0x96f4('0x26')];}_0x34128d['status'](_0x164fbf)['send'](_0x1e2911);};}exports[_0x96f4('0x27')]=function(_0x5a1c3b,_0x3903bc){var _0x2f81be={},_0x951baa={},_0x12167a={'count':0x0,'rows':[]};var _0x57cec0=_[_0x96f4('0x28')](db[_0x96f4('0x29')][_0x96f4('0x2a')],function(_0x21801d){return{'name':_0x21801d[_0x96f4('0x2b')],'type':_0x21801d['type'][_0x96f4('0x2c')]};});_0x951baa[_0x96f4('0x2d')]=_[_0x96f4('0x28')](_0x57cec0,_0x96f4('0x26'));_0x951baa['query']=_[_0x96f4('0x2e')](_0x5a1c3b['query']);_0x951baa[_0x96f4('0x2f')]=_[_0x96f4('0x30')](_0x951baa['model'],_0x951baa[_0x96f4('0x31')]);_0x2f81be[_0x96f4('0x32')]=_[_0x96f4('0x30')](_0x951baa[_0x96f4('0x2d')],qs[_0x96f4('0x33')](_0x5a1c3b[_0x96f4('0x31')][_0x96f4('0x33')]));_0x2f81be['attributes']=_0x2f81be['attributes'][_0x96f4('0x34')]?_0x2f81be['attributes']:_0x951baa[_0x96f4('0x2d')];if(!_0x5a1c3b[_0x96f4('0x31')]['hasOwnProperty'](_0x96f4('0x35'))){_0x2f81be[_0x96f4('0x1d')]=qs[_0x96f4('0x1d')](_0x5a1c3b[_0x96f4('0x31')][_0x96f4('0x1d')]);_0x2f81be['offset']=qs[_0x96f4('0x1a')](_0x5a1c3b[_0x96f4('0x31')][_0x96f4('0x1a')]);}_0x2f81be[_0x96f4('0x36')]=qs[_0x96f4('0x37')](_0x5a1c3b[_0x96f4('0x31')][_0x96f4('0x37')]);_0x2f81be[_0x96f4('0x38')]=qs[_0x96f4('0x2f')](_[_0x96f4('0x39')](_0x5a1c3b[_0x96f4('0x31')],_0x951baa[_0x96f4('0x2f')]),_0x57cec0);if(_0x5a1c3b[_0x96f4('0x31')][_0x96f4('0x3a')]){_0x2f81be[_0x96f4('0x38')]=_['merge'](_0x2f81be['where'],{'$or':_[_0x96f4('0x28')](_0x57cec0,function(_0x2176b1){if(_0x2176b1['type']!=='VIRTUAL'){var _0x38939a={};_0x38939a[_0x2176b1[_0x96f4('0x26')]]={'$like':'%'+_0x5a1c3b['query'][_0x96f4('0x3a')]+'%'};return _0x38939a;}})});}_0x2f81be=_[_0x96f4('0x3b')]({},_0x2f81be,_0x5a1c3b[_0x96f4('0x3c')]);var _0x417832={'where':_0x2f81be[_0x96f4('0x38')]};return db[_0x96f4('0x29')][_0x96f4('0x1c')](_0x417832)['then'](function(_0x5dd116){_0x12167a['count']=_0x5dd116;if(_0x5a1c3b['query'][_0x96f4('0x3d')]){_0x2f81be[_0x96f4('0x3e')]=[{'all':!![]}];}return db[_0x96f4('0x29')][_0x96f4('0x3f')](_0x2f81be);})[_0x96f4('0x24')](function(_0x393d9b){_0x12167a[_0x96f4('0x40')]=_0x393d9b;return _0x12167a;})['then'](respondWithFilteredResult(_0x3903bc,_0x2f81be))[_0x96f4('0x41')](handleError(_0x3903bc,null));};exports[_0x96f4('0x42')]=function(_0x972d9d,_0x529755){var _0x543b9e={'raw':!![],'where':{'id':_0x972d9d['params']['id']}},_0x195d28={};_0x195d28[_0x96f4('0x2d')]=_[_0x96f4('0x2e')](db[_0x96f4('0x29')][_0x96f4('0x2a')]);_0x195d28[_0x96f4('0x31')]=_[_0x96f4('0x2e')](_0x972d9d[_0x96f4('0x31')]);_0x195d28['filters']=_['intersection'](_0x195d28[_0x96f4('0x2d')],_0x195d28['query']);_0x543b9e[_0x96f4('0x32')]=_[_0x96f4('0x30')](_0x195d28[_0x96f4('0x2d')],qs['fields'](_0x972d9d[_0x96f4('0x31')][_0x96f4('0x33')]));_0x543b9e['attributes']=_0x543b9e[_0x96f4('0x32')][_0x96f4('0x34')]?_0x543b9e[_0x96f4('0x32')]:_0x195d28['model'];if(_0x972d9d['query'][_0x96f4('0x3d')]){_0x543b9e[_0x96f4('0x3e')]=[{'all':!![]}];}_0x543b9e=_[_0x96f4('0x3b')]({},_0x543b9e,_0x972d9d[_0x96f4('0x3c')]);return db[_0x96f4('0x29')][_0x96f4('0x43')](_0x543b9e)['then'](handleEntityNotFound(_0x529755,null))[_0x96f4('0x24')](respondWithResult(_0x529755,null))['catch'](handleError(_0x529755,null));};exports[_0x96f4('0x44')]=function(_0x4dd3c9,_0x5542f3){return db[_0x96f4('0x29')][_0x96f4('0x44')](_0x4dd3c9[_0x96f4('0x45')],{})[_0x96f4('0x24')](respondWithResult(_0x5542f3,0xc9))[_0x96f4('0x41')](handleError(_0x5542f3,null));};exports['update']=function(_0x48a910,_0x308572){if(_0x48a910[_0x96f4('0x45')]['id']){delete _0x48a910[_0x96f4('0x45')]['id'];}return db[_0x96f4('0x29')]['find']({'where':{'id':_0x48a910[_0x96f4('0x46')]['id']}})[_0x96f4('0x24')](handleEntityNotFound(_0x308572,null))[_0x96f4('0x24')](saveUpdates(_0x48a910[_0x96f4('0x45')],null))[_0x96f4('0x24')](respondWithResult(_0x308572,null))[_0x96f4('0x41')](handleError(_0x308572,null));};exports[_0x96f4('0x23')]=function(_0x2c078d,_0x5c952c){return db[_0x96f4('0x29')][_0x96f4('0x43')]({'where':{'id':_0x2c078d[_0x96f4('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c952c,null))[_0x96f4('0x24')](removeEntity(_0x5c952c,null))[_0x96f4('0x41')](handleError(_0x5c952c,null));};
\ No newline at end of file
+var _0x07af=['eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','SmsApplication','includeAll','include','findAll','catch','params','keys','create','body','find'];(function(_0x5ddef9,_0x5984cb){var _0x344fb2=function(_0xa06a86){while(--_0xa06a86){_0x5ddef9['push'](_0x5ddef9['shift']());}};_0x344fb2(++_0x5984cb);}(_0x07af,0xd5));var _0xf07a=function(_0x2bc14d,_0x26f23e){_0x2bc14d=_0x2bc14d-0x0;var _0x54caa4=_0x07af[_0x2bc14d];return _0x54caa4;};'use strict';var emlformat=require(_0xf07a('0x0'));var rimraf=require(_0xf07a('0x1'));var zipdir=require(_0xf07a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf07a('0x3'));var moment=require('moment');var BPromise=require(_0xf07a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf07a('0x5'));var sox=require(_0xf07a('0x6'));var csv=require(_0xf07a('0x7'));var ejs=require(_0xf07a('0x8'));var fs=require('fs');var fs_extra=require(_0xf07a('0x9'));var _=require(_0xf07a('0xa'));var squel=require(_0xf07a('0xb'));var crypto=require(_0xf07a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf07a('0x7'));var querystring=require(_0xf07a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf07a('0xe'));var qs=require(_0xf07a('0xf'));var as=require(_0xf07a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf07a('0x11'))(_0xf07a('0x12'));var utils=require(_0xf07a('0x13'));var config=require(_0xf07a('0x14'));var licenseUtil=require(_0xf07a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40e048,_0x48a5cf){_0x48a5cf=_0x48a5cf||0xcc;return function(_0x41a772){if(_0x41a772){return _0x40e048[_0xf07a('0x16')](_0x48a5cf);}return _0x40e048[_0xf07a('0x17')](_0x48a5cf)['end']();};}function respondWithResult(_0x57867c,_0xfd9e38){_0xfd9e38=_0xfd9e38||0xc8;return function(_0x447c5e){if(_0x447c5e){return _0x57867c[_0xf07a('0x17')](_0xfd9e38)[_0xf07a('0x18')](_0x447c5e);}};}function respondWithFilteredResult(_0x1de4b0,_0x3e8534){return function(_0xcefa3c){if(_0xcefa3c){var _0x2a20f6=typeof _0x3e8534[_0xf07a('0x19')]==='undefined'&&typeof _0x3e8534[_0xf07a('0x1a')]===_0xf07a('0x1b');var _0x2c167b=_0xcefa3c[_0xf07a('0x1c')];var _0x355202=_0x2a20f6?0x0:_0x3e8534[_0xf07a('0x19')];var _0x58a2c8=_0x2a20f6?_0xcefa3c[_0xf07a('0x1c')]:_0x3e8534[_0xf07a('0x19')]+_0x3e8534[_0xf07a('0x1a')];var _0x216629;if(_0x58a2c8>=_0x2c167b){_0x58a2c8=_0x2c167b;_0x216629=0xc8;}else{_0x216629=0xce;}_0x1de4b0[_0xf07a('0x17')](_0x216629);return _0x1de4b0[_0xf07a('0x1d')](_0xf07a('0x1e'),_0x355202+'-'+_0x58a2c8+'/'+_0x2c167b)[_0xf07a('0x18')](_0xcefa3c);}return null;};}function patchUpdates(_0x3e97f3){return function(_0x4417c5){try{jsonpatch[_0xf07a('0x1f')](_0x4417c5,_0x3e97f3,!![]);}catch(_0x556f65){return BPromise[_0xf07a('0x20')](_0x556f65);}return _0x4417c5[_0xf07a('0x21')]();};}function saveUpdates(_0x3d2ead,_0x286005){return function(_0x316afc){if(_0x316afc){return _0x316afc[_0xf07a('0x22')](_0x3d2ead)['then'](function(_0x221238){return _0x221238;});}return null;};}function removeEntity(_0x29a9bb,_0x3aad29){return function(_0x20be61){if(_0x20be61){return _0x20be61[_0xf07a('0x23')]()[_0xf07a('0x24')](function(){_0x29a9bb[_0xf07a('0x17')](0xcc)[_0xf07a('0x25')]();});}};}function handleEntityNotFound(_0x49a1aa,_0x5efeb3){return function(_0x162545){if(!_0x162545){_0x49a1aa[_0xf07a('0x16')](0x194);}return _0x162545;};}function handleError(_0x33cc21,_0x44f5d9){_0x44f5d9=_0x44f5d9||0x1f4;return function(_0x494f78){logger[_0xf07a('0x26')](_0x494f78[_0xf07a('0x27')]);if(_0x494f78[_0xf07a('0x28')]){delete _0x494f78[_0xf07a('0x28')];}_0x33cc21[_0xf07a('0x17')](_0x44f5d9)[_0xf07a('0x29')](_0x494f78);};}exports[_0xf07a('0x2a')]=function(_0x2c2273,_0xcd6e52){var _0x10c8d6={},_0x5ca02c={},_0x7013b3={'count':0x0,'rows':[]};var _0x578a78=_['map'](db['SmsApplication']['rawAttributes'],function(_0x9bdb32){return{'name':_0x9bdb32[_0xf07a('0x2b')],'type':_0x9bdb32[_0xf07a('0x2c')]['key']};});_0x5ca02c[_0xf07a('0x2d')]=_[_0xf07a('0x2e')](_0x578a78,_0xf07a('0x28'));_0x5ca02c['query']=_['keys'](_0x2c2273[_0xf07a('0x2f')]);_0x5ca02c[_0xf07a('0x30')]=_[_0xf07a('0x31')](_0x5ca02c[_0xf07a('0x2d')],_0x5ca02c['query']);_0x10c8d6[_0xf07a('0x32')]=_[_0xf07a('0x31')](_0x5ca02c[_0xf07a('0x2d')],qs[_0xf07a('0x33')](_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x33')]));_0x10c8d6[_0xf07a('0x32')]=_0x10c8d6[_0xf07a('0x32')][_0xf07a('0x34')]?_0x10c8d6[_0xf07a('0x32')]:_0x5ca02c[_0xf07a('0x2d')];if(!_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x35')]('nolimit')){_0x10c8d6[_0xf07a('0x1a')]=qs[_0xf07a('0x1a')](_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x1a')]);_0x10c8d6[_0xf07a('0x19')]=qs[_0xf07a('0x19')](_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x19')]);}_0x10c8d6[_0xf07a('0x36')]=qs[_0xf07a('0x37')](_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x37')]);_0x10c8d6[_0xf07a('0x38')]=qs[_0xf07a('0x30')](_[_0xf07a('0x39')](_0x2c2273[_0xf07a('0x2f')],_0x5ca02c[_0xf07a('0x30')]),_0x578a78);if(_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x3a')]){_0x10c8d6[_0xf07a('0x38')]=_[_0xf07a('0x3b')](_0x10c8d6[_0xf07a('0x38')],{'$or':_['map'](_0x578a78,function(_0xa1757e){if(_0xa1757e['type']!=='VIRTUAL'){var _0x1e6ef9={};_0x1e6ef9[_0xa1757e[_0xf07a('0x28')]]={'$like':'%'+_0x2c2273[_0xf07a('0x2f')]['filter']+'%'};return _0x1e6ef9;}})});}_0x10c8d6=_[_0xf07a('0x3b')]({},_0x10c8d6,_0x2c2273[_0xf07a('0x3c')]);var _0x67c9d6={'where':_0x10c8d6[_0xf07a('0x38')]};return db[_0xf07a('0x3d')][_0xf07a('0x1c')](_0x67c9d6)['then'](function(_0x13ca59){_0x7013b3['count']=_0x13ca59;if(_0x2c2273[_0xf07a('0x2f')][_0xf07a('0x3e')]){_0x10c8d6[_0xf07a('0x3f')]=[{'all':!![]}];}return db[_0xf07a('0x3d')][_0xf07a('0x40')](_0x10c8d6);})[_0xf07a('0x24')](function(_0x7d33d4){_0x7013b3['rows']=_0x7d33d4;return _0x7013b3;})[_0xf07a('0x24')](respondWithFilteredResult(_0xcd6e52,_0x10c8d6))[_0xf07a('0x41')](handleError(_0xcd6e52,null));};exports['show']=function(_0x2810d3,_0x37c55e){var _0x448937={'raw':!![],'where':{'id':_0x2810d3[_0xf07a('0x42')]['id']}},_0x39fe39={};_0x39fe39[_0xf07a('0x2d')]=_[_0xf07a('0x43')](db['SmsApplication']['rawAttributes']);_0x39fe39[_0xf07a('0x2f')]=_[_0xf07a('0x43')](_0x2810d3[_0xf07a('0x2f')]);_0x39fe39[_0xf07a('0x30')]=_[_0xf07a('0x31')](_0x39fe39[_0xf07a('0x2d')],_0x39fe39[_0xf07a('0x2f')]);_0x448937[_0xf07a('0x32')]=_[_0xf07a('0x31')](_0x39fe39['model'],qs[_0xf07a('0x33')](_0x2810d3[_0xf07a('0x2f')]['fields']));_0x448937[_0xf07a('0x32')]=_0x448937[_0xf07a('0x32')]['length']?_0x448937[_0xf07a('0x32')]:_0x39fe39[_0xf07a('0x2d')];if(_0x2810d3['query'][_0xf07a('0x3e')]){_0x448937[_0xf07a('0x3f')]=[{'all':!![]}];}_0x448937=_[_0xf07a('0x3b')]({},_0x448937,_0x2810d3[_0xf07a('0x3c')]);return db['SmsApplication']['find'](_0x448937)[_0xf07a('0x24')](handleEntityNotFound(_0x37c55e,null))[_0xf07a('0x24')](respondWithResult(_0x37c55e,null))['catch'](handleError(_0x37c55e,null));};exports[_0xf07a('0x44')]=function(_0x1a3340,_0x4398f9){return db[_0xf07a('0x3d')][_0xf07a('0x44')](_0x1a3340[_0xf07a('0x45')],{})[_0xf07a('0x24')](respondWithResult(_0x4398f9,0xc9))[_0xf07a('0x41')](handleError(_0x4398f9,null));};exports[_0xf07a('0x22')]=function(_0x3a4bf0,_0x14cbe4){if(_0x3a4bf0[_0xf07a('0x45')]['id']){delete _0x3a4bf0[_0xf07a('0x45')]['id'];}return db['SmsApplication'][_0xf07a('0x46')]({'where':{'id':_0x3a4bf0[_0xf07a('0x42')]['id']}})[_0xf07a('0x24')](handleEntityNotFound(_0x14cbe4,null))['then'](saveUpdates(_0x3a4bf0['body'],null))[_0xf07a('0x24')](respondWithResult(_0x14cbe4,null))[_0xf07a('0x41')](handleError(_0x14cbe4,null));};exports['destroy']=function(_0x2687c2,_0x5853aa){return db[_0xf07a('0x3d')][_0xf07a('0x46')]({'where':{'id':_0x2687c2['params']['id']}})['then'](handleEntityNotFound(_0x5853aa,null))[_0xf07a('0x24')](removeEntity(_0x5853aa,null))['catch'](handleError(_0x5853aa,null));};
\ No newline at end of file
index aab8deb..59454e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7061=['SmsApplication','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x204e7d,_0x12e58d){var _0x3c62cf=function(_0x335e2e){while(--_0x335e2e){_0x204e7d['push'](_0x204e7d['shift']());}};_0x3c62cf(++_0x12e58d);}(_0x7061,0x12e));var _0x1706=function(_0xd1680,_0x319ba2){_0xd1680=_0xd1680-0x0;var _0x209a04=_0x7061[_0xd1680];return _0x209a04;};'use strict';var _=require(_0x1706('0x0'));var util=require(_0x1706('0x1'));var logger=require('../../config/logger')(_0x1706('0x2'));var moment=require(_0x1706('0x3'));var BPromise=require(_0x1706('0x4'));var rp=require(_0x1706('0x5'));var fs=require('fs');var path=require(_0x1706('0x6'));var rimraf=require(_0x1706('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x1706('0x8')]=function(_0x3423e3,_0x1b00ad){return _0x3423e3[_0x1706('0x9')](_0x1706('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1706('0xb')});};
\ No newline at end of file
+var _0x1f00=['exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1f00,0x1bf));var _0x01f0=function(_0x16d991,_0x3f07cc){_0x16d991=_0x16d991-0x0;var _0x4f41c3=_0x1f00[_0x16d991];return _0x4f41c3;};'use strict';var _=require(_0x01f0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x01f0('0x1'));var moment=require('moment');var BPromise=require(_0x01f0('0x2'));var rp=require(_0x01f0('0x3'));var fs=require('fs');var path=require(_0x01f0('0x4'));var rimraf=require(_0x01f0('0x5'));var config=require(_0x01f0('0x6'));var attributes=require(_0x01f0('0x7'));module[_0x01f0('0x8')]=function(_0x460ee6,_0x2e8ded){return _0x460ee6['define'](_0x01f0('0x9'),attributes,{'tableName':_0x01f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01f0('0xb'),'collate':_0x01f0('0xc')});};
\ No newline at end of file
index fb058fa..7110bbc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x20d8=['stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0xd09248,_0x256d66){var _0x416fbe=function(_0x12f8c0){while(--_0x12f8c0){_0xd09248['push'](_0xd09248['shift']());}};_0x416fbe(++_0x256d66);}(_0x20d8,0xee));var _0x820d=function(_0x4ce3a4,_0x3d5950){_0x4ce3a4=_0x4ce3a4-0x0;var _0x199899=_0x20d8[_0x4ce3a4];return _0x199899;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var moment=require(_0x820d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x820d('0x3'));var db=require(_0x820d('0x4'))['db'];var utils=require(_0x820d('0x5'));var logger=require(_0x820d('0x6'))(_0x820d('0x7'));var config=require('../../config/environment');var jayson=require(_0x820d('0x8'));var client=jayson[_0x820d('0x9')][_0x820d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e23e3,_0x435a84,_0xa2751d){return new BPromise(function(_0x3b084c,_0x485bde){return client[_0x820d('0xb')](_0x4e23e3,_0xa2751d)['then'](function(_0x45fdd7){logger['info']('SmsApplication,\x20%s,\x20%s',_0x435a84,_0x820d('0xc'));logger['debug'](_0x820d('0xd'),_0x435a84,_0x820d('0xc'),JSON[_0x820d('0xe')](_0x45fdd7));if(_0x45fdd7['error']){if(_0x45fdd7[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger['error'](_0x820d('0x11'),_0x435a84,_0x45fdd7['error'][_0x820d('0x12')]);return _0x485bde(_0x45fdd7[_0x820d('0xf')][_0x820d('0x12')]);}logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x45fdd7[_0x820d('0xf')]['message']);return _0x3b084c(_0x45fdd7['error'][_0x820d('0x12')]);}else{logger['info'](_0x820d('0x11'),_0x435a84,_0x820d('0xc'));_0x3b084c(_0x45fdd7[_0x820d('0x13')]['message']);}})[_0x820d('0x14')](function(_0x3466c1){logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x3466c1);_0x485bde(_0x3466c1);});});}
\ No newline at end of file
+var _0xc00b=['error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d6a2e,_0x4899d1){var _0x10d015=function(_0x3eba62){while(--_0x3eba62){_0x4d6a2e['push'](_0x4d6a2e['shift']());}};_0x10d015(++_0x4899d1);}(_0xc00b,0x1e5));var _0xbc00=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xc00b[_0x2a1b33];return _0x4c50e7;};'use strict';var _=require(_0xbc00('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc00('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc00('0x2'))['db'];var utils=require(_0xbc00('0x3'));var logger=require(_0xbc00('0x4'))(_0xbc00('0x5'));var config=require('../../config/environment');var jayson=require(_0xbc00('0x6'));var client=jayson['client'][_0xbc00('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5362c6,_0x378982,_0x3a4edb){return new BPromise(function(_0x284270,_0x221909){return client[_0xbc00('0x8')](_0x5362c6,_0x3a4edb)[_0xbc00('0x9')](function(_0x51a669){logger[_0xbc00('0xa')]('SmsApplication,\x20%s,\x20%s',_0x378982,_0xbc00('0xb'));logger[_0xbc00('0xc')](_0xbc00('0xd'),_0x378982,'request\x20sent',JSON[_0xbc00('0xe')](_0x51a669));if(_0x51a669['error']){if(_0x51a669[_0xbc00('0xf')]['code']===0x1f4){logger[_0xbc00('0xf')](_0xbc00('0x10'),_0x378982,_0x51a669[_0xbc00('0xf')]['message']);return _0x221909(_0x51a669[_0xbc00('0xf')][_0xbc00('0x11')]);}logger[_0xbc00('0xf')]('SmsApplication,\x20%s,\x20%s',_0x378982,_0x51a669[_0xbc00('0xf')][_0xbc00('0x11')]);return _0x284270(_0x51a669['error'][_0xbc00('0x11')]);}else{logger[_0xbc00('0xa')](_0xbc00('0x10'),_0x378982,_0xbc00('0xb'));_0x284270(_0x51a669[_0xbc00('0x12')][_0xbc00('0x11')]);}})[_0xbc00('0x13')](function(_0x544764){logger['error']('SmsApplication,\x20%s,\x20%s',_0x378982,_0x544764);_0x221909(_0x544764);});});}
\ No newline at end of file
index 380cc23..8399e10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb7e7[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('0x21')]=router;
\ No newline at end of file
+var _0x93e9=['update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update'];(function(_0x5c2d67,_0x4a050f){var _0x591b9f=function(_0xb8f9e3){while(--_0xb8f9e3){_0x5c2d67['push'](_0x5c2d67['shift']());}};_0x591b9f(++_0x4a050f);}(_0x93e9,0xcc));var _0x993e=function(_0x406318,_0x1eff12){_0x406318=_0x406318-0x0;var _0x56e1bc=_0x93e9[_0x406318];return _0x56e1bc;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getMessages']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x993e('0x11')]('/',auth['isAuthenticated'](),controller[_0x993e('0x12')]);router['post']('/:id/messages',auth[_0x993e('0xa')](),controller[_0x993e('0x13')]);router[_0x993e('0x11')](_0x993e('0x14'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x17')),controller[_0x993e('0x18')]);router[_0x993e('0x19')](_0x993e('0xd'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1a')),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')]('/:id',auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1d')),controller[_0x993e('0x1e')]);router[_0x993e('0x1c')]('/:id/tags',auth[_0x993e('0xa')](),controller[_0x993e('0x1f')]);module[_0x993e('0x20')]=router;
\ No newline at end of file
index 57b68a8..8086622 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2ca=['out','BOOLEAN','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x45e7ca,_0x18a786){var _0x306d06=function(_0x355d91){while(--_0x355d91){_0x45e7ca['push'](_0x45e7ca['shift']());}};_0x306d06(++_0x18a786);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xf2ca[_0x1c3370];return _0xa9b358;};'use strict';var Sequelize=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));module[_0xaf2c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaf2c('0x3')]},'disposition':{'type':Sequelize[_0xaf2c('0x4')]},'secondDisposition':{'type':Sequelize[_0xaf2c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaf2c('0x4')]},'note':{'type':Sequelize[_0xaf2c('0x4')]},'phone':{'type':Sequelize[_0xaf2c('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xaf2c('0x5')]('in',_0xaf2c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaf2c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xaf2c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaf2c('0x7')],'defaultValue':![]}};
\ No newline at end of file
+var _0x42b0=['moment','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x48db93,_0x42c34b){var _0x2907bd=function(_0x2a4da2){while(--_0x2a4da2){_0x48db93['push'](_0x48db93['shift']());}};_0x2907bd(++_0x42c34b);}(_0x42b0,0xbc));var _0x042b=function(_0x1f404a,_0x5088b2){_0x1f404a=_0x1f404a-0x0;var _0x2cdcd5=_0x42b0[_0x1f404a];return _0x2cdcd5;};'use strict';var Sequelize=require(_0x042b('0x0'));var moment=require(_0x042b('0x1'));module['exports']={'closed':{'type':Sequelize[_0x042b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x042b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x042b('0x3')]},'phone':{'type':Sequelize[_0x042b('0x3')]},'read1stAt':{'type':Sequelize[_0x042b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x042b('0x5')]('in',_0x042b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x042b('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x042b('0x2')],'defaultValue':![]}};
\ No newline at end of file
index 1bd8065..0578cdc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x720e=['download','toString','join','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','direction','secret','read','Account','Owner','get','Sms','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','out','System','Contact','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','map','SmsInteraction','fieldName','type','key','findAll','sms','catch','show','params','model','keys','rawAttributes','query','filters','intersection','fields','length','include','merge','options','find','create','body','describe','SmsMessage','addMessage','attributes','order','sort','where','SmsInteractionId','filter','$gte','format','rows','setTags','omit','ids','spread','Tag','color','emit','smsInteractionTags:save','removeTags'];(function(_0x50e650,_0xc514f5){var _0x3af3be=function(_0x19f2c6){while(--_0x19f2c6){_0x50e650['push'](_0x50e650['shift']());}};_0x3af3be(++_0xc514f5);}(_0x720e,0x18c));var _0xe720=function(_0x21b74b,_0x543c76){_0x21b74b=_0x21b74b-0x0;var _0x518cc6=_0x720e[_0x21b74b];return _0x518cc6;};'use strict';var rimraf=require(_0xe720('0x0'));var zipdir=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require(_0xe720('0x3'));var util=require(_0xe720('0x4'));var path=require(_0xe720('0x5'));var ejs=require(_0xe720('0x6'));var fs=require('fs');var _=require(_0xe720('0x7'));var Redis=require(_0xe720('0x8'));var interaction=require(_0xe720('0x9'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe720('0xa'));var logger=require(_0xe720('0xb'))('api');var config=require(_0xe720('0xc'));var db=require('../../mysqldb')['db'];config[_0xe720('0xd')]=_[_0xe720('0xe')](config[_0xe720('0xd')],{'host':_0xe720('0xf'),'port':0x18eb});var socket=require(_0xe720('0x10'))(new Redis(config['redis']));require(_0xe720('0x11'))[_0xe720('0x12')](socket);function respondWithStatusCode(_0x9d2a8c,_0x31c2da){_0x31c2da=_0x31c2da||0xcc;return function(_0x5cf3ec){if(_0x5cf3ec){return _0x9d2a8c['sendStatus'](_0x31c2da);}return _0x9d2a8c[_0xe720('0x13')](_0x31c2da)[_0xe720('0x14')]();};}function respondWithResult(_0x441232,_0x4fef87){_0x4fef87=_0x4fef87||0xc8;return function(_0x4dacc9){if(_0x4dacc9){return _0x441232[_0xe720('0x13')](_0x4fef87)[_0xe720('0x15')](_0x4dacc9);}};}function respondWithFilteredResult(_0x1c2022,_0x49f4d8){return function(_0x5ef42b){if(_0x5ef42b){var _0x2999ec=typeof _0x49f4d8[_0xe720('0x16')]===_0xe720('0x17')&&typeof _0x49f4d8[_0xe720('0x18')]===_0xe720('0x17');var _0x24ea59=_0x5ef42b[_0xe720('0x19')];var _0x4f9340=_0x2999ec?0x0:_0x49f4d8[_0xe720('0x16')];var _0x55a3ab=_0x2999ec?_0x5ef42b[_0xe720('0x19')]:_0x49f4d8[_0xe720('0x16')]+_0x49f4d8[_0xe720('0x18')];var _0x4e4c90;if(_0x55a3ab>=_0x24ea59){_0x55a3ab=_0x24ea59;_0x4e4c90=0xc8;}else{_0x4e4c90=0xce;}_0x1c2022[_0xe720('0x13')](_0x4e4c90);return _0x1c2022['set'](_0xe720('0x1a'),_0x4f9340+'-'+_0x55a3ab+'/'+_0x24ea59)[_0xe720('0x15')](_0x5ef42b);}return null;};}function saveUpdates(_0x199567){return function(_0x29ee94){if(_0x29ee94){return _0x29ee94[_0xe720('0x1b')](_0x199567)[_0xe720('0x1c')](function(_0x46cbc6){return _0x46cbc6;});}return null;};}function removeEntity(_0x1b9f84){return function(_0x3b3ead){if(_0x3b3ead){return _0x3b3ead[_0xe720('0x1d')]()[_0xe720('0x1c')](function(){_0x1b9f84['status'](0xcc)[_0xe720('0x14')]();});}};}function handleEntityNotFound(_0x1a81d2){return function(_0xbdbb05){if(!_0xbdbb05){_0x1a81d2[_0xe720('0x1e')](0x194);}return _0xbdbb05;};}function handleError(_0x478d8b,_0x423a75){_0x423a75=_0x423a75||0x1f4;return function(_0x29b3c7){logger[_0xe720('0x1f')](_0x29b3c7[_0xe720('0x20')]);if(_0x29b3c7['name']){delete _0x29b3c7[_0xe720('0x21')];}_0x478d8b[_0xe720('0x13')](_0x423a75)[_0xe720('0x22')](_0x29b3c7);};}exports['index']=function(_0x3f5a8c,_0x22c8c1){var _0x2eabb6={};var _0x39b925=_[_0xe720('0x23')](db[_0xe720('0x24')]['rawAttributes'],function(_0xc501bf){return{'name':_0xc501bf[_0xe720('0x25')],'type':_0xc501bf[_0xe720('0x26')][_0xe720('0x27')]};});_0x2eabb6=qs['getOptions'](_0x39b925,_0x3f5a8c);return interaction[_0xe720('0x28')](_0xe720('0x29'),_0x3f5a8c['query'],_0x3f5a8c['user'],_0x2eabb6,_0x39b925)[_0xe720('0x1c')](respondWithFilteredResult(_0x22c8c1,_0x2eabb6))[_0xe720('0x2a')](handleError(_0x22c8c1,null));};exports[_0xe720('0x2b')]=function(_0x5513d1,_0x1fbdaf){var _0x323547={'raw':![],'where':{'id':_0x5513d1[_0xe720('0x2c')]['id']}},_0x42111b={};_0x42111b[_0xe720('0x2d')]=_[_0xe720('0x2e')](db[_0xe720('0x24')][_0xe720('0x2f')]);_0x42111b['query']=_[_0xe720('0x2e')](_0x5513d1[_0xe720('0x30')]);_0x42111b[_0xe720('0x31')]=_[_0xe720('0x32')](_0x42111b[_0xe720('0x2d')],_0x42111b[_0xe720('0x30')]);_0x323547['attributes']=_[_0xe720('0x32')](_0x42111b[_0xe720('0x2d')],qs[_0xe720('0x33')](_0x5513d1[_0xe720('0x30')]['fields']));_0x323547['attributes']=_0x323547['attributes'][_0xe720('0x34')]?_0x323547['attributes']:_0x42111b['model'];if(_0x5513d1[_0xe720('0x30')]['includeAll']){_0x323547[_0xe720('0x35')]=[{'all':!![]}];}_0x323547=_[_0xe720('0x36')]({},_0x323547,_0x5513d1[_0xe720('0x37')]);return db[_0xe720('0x24')][_0xe720('0x38')](_0x323547)[_0xe720('0x1c')](handleEntityNotFound(_0x1fbdaf,null))[_0xe720('0x1c')](respondWithResult(_0x1fbdaf,null))[_0xe720('0x2a')](handleError(_0x1fbdaf,null));};exports[_0xe720('0x39')]=function(_0xba5f47,_0x3a40fd){return db['SmsInteraction'][_0xe720('0x39')](_0xba5f47[_0xe720('0x3a')],{})[_0xe720('0x1c')](respondWithResult(_0x3a40fd,0xc9))[_0xe720('0x2a')](handleError(_0x3a40fd,null));};exports['update']=function(_0x324d2d,_0xa5493c){if(_0x324d2d['body']['id']){delete _0x324d2d[_0xe720('0x3a')]['id'];}return db[_0xe720('0x24')][_0xe720('0x38')]({'where':{'id':_0x324d2d[_0xe720('0x2c')]['id']}})[_0xe720('0x1c')](handleEntityNotFound(_0xa5493c,null))[_0xe720('0x1c')](saveUpdates(_0x324d2d[_0xe720('0x3a')],null))[_0xe720('0x1c')](respondWithResult(_0xa5493c,null))[_0xe720('0x2a')](handleError(_0xa5493c,null));};exports[_0xe720('0x1d')]=function(_0x136f39,_0x27f6ae){return db[_0xe720('0x24')][_0xe720('0x38')]({'where':{'id':_0x136f39[_0xe720('0x2c')]['id']}})[_0xe720('0x1c')](handleEntityNotFound(_0x27f6ae,null))['then'](removeEntity(_0x27f6ae,null))[_0xe720('0x2a')](handleError(_0x27f6ae,null));};exports[_0xe720('0x3b')]=function(_0x16163f,_0x2816b6){return db[_0xe720('0x24')]['describe']()[_0xe720('0x1c')](respondWithResult(_0x2816b6,null))[_0xe720('0x2a')](handleError(_0x2816b6,null));};exports['addMessage']=function(_0x3ca6e1,_0xba8a7f){return db[_0xe720('0x3c')][_0xe720('0x38')]({'where':{'id':_0x3ca6e1[_0xe720('0x2c')]['id']}})[_0xe720('0x1c')](handleEntityNotFound(_0xba8a7f,null))[_0xe720('0x1c')](function(_0x219610){if(_0x219610){return _0x219610[_0xe720('0x3d')](_0x3ca6e1[_0xe720('0x3a')]['ids'],_['omit'](_0x3ca6e1[_0xe720('0x3a')],['ids','id'])||{});}})[_0xe720('0x1c')](respondWithResult(_0xba8a7f,null))['catch'](handleError(_0xba8a7f,null));};exports['getMessages']=function(_0x38815b,_0x2a1df4){var _0x25d836={'raw':![],'where':{}};var _0x2bc1c7={};var _0xe971d4={'count':0x0,'rows':[]};return db[_0xe720('0x24')]['findOne']({'where':{'id':_0x38815b[_0xe720('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2a1df4,null))[_0xe720('0x1c')](function(_0x27fc0f){if(_0x27fc0f){_0x2bc1c7['model']=_[_0xe720('0x2e')](db['SmsMessage'][_0xe720('0x2f')]);_0x2bc1c7[_0xe720('0x30')]=_['keys'](_0x38815b['query']);_0x2bc1c7[_0xe720('0x31')]=_[_0xe720('0x32')](_0x2bc1c7['model'],_0x2bc1c7[_0xe720('0x30')]);_0x25d836[_0xe720('0x3e')]=_[_0xe720('0x32')](_0x2bc1c7[_0xe720('0x2d')],qs[_0xe720('0x33')](_0x38815b['query'][_0xe720('0x33')]));_0x25d836[_0xe720('0x3e')]=_0x25d836[_0xe720('0x3e')][_0xe720('0x34')]?_0x25d836[_0xe720('0x3e')]:_0x2bc1c7[_0xe720('0x2d')];if(!_0x38815b[_0xe720('0x30')]['hasOwnProperty']('nolimit')){_0x25d836[_0xe720('0x18')]=qs[_0xe720('0x18')](_0x38815b['query'][_0xe720('0x18')]);_0x25d836[_0xe720('0x16')]=qs['offset'](_0x38815b[_0xe720('0x30')][_0xe720('0x16')]);}_0x25d836[_0xe720('0x3f')]=qs[_0xe720('0x40')](_0x38815b[_0xe720('0x30')][_0xe720('0x40')]);_0x25d836[_0xe720('0x41')]=qs['filters'](_['pick'](_0x38815b[_0xe720('0x30')],_0x2bc1c7['filters']));_0x25d836[_0xe720('0x41')][_0xe720('0x42')]=_0x27fc0f['id'];if(_0x38815b[_0xe720('0x30')][_0xe720('0x43')]){_0x25d836['where']=_[_0xe720('0x36')](_0x25d836[_0xe720('0x41')],{'$or':_[_0xe720('0x23')](_0x25d836[_0xe720('0x3e')],function(_0x22fe2c){var _0x3fa038={};_0x3fa038[_0x22fe2c]={'$like':'%'+_0x38815b[_0xe720('0x30')][_0xe720('0x43')]+'%'};return _0x3fa038;})});}if(_0x38815b['query'][_0xe720('0x44')]){var _0x233ba3=_0x38815b[_0xe720('0x30')][_0xe720('0x44')]['split'](',');var _0x40055a={};_0x40055a[_0x233ba3[0x0]]={'$gte':moment(_0x233ba3[0x1])[_0xe720('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x25d836[_0xe720('0x41')]=_[_0xe720('0x36')](_0x25d836[_0xe720('0x41')],_0x40055a);}_0x25d836=_[_0xe720('0x36')]({},_0x25d836,_0x38815b[_0xe720('0x37')]);return db[_0xe720('0x3c')]['count']({'where':_0x25d836[_0xe720('0x41')]})[_0xe720('0x1c')](function(_0x5a8b44){_0xe971d4['count']=_0x5a8b44;if(_0x38815b[_0xe720('0x30')]['includeAll']){_0x25d836[_0xe720('0x35')]=[{'all':!![]}];}return db[_0xe720('0x3c')][_0xe720('0x28')](_0x25d836);})[_0xe720('0x1c')](function(_0x34e165){_0xe971d4[_0xe720('0x46')]=_0x34e165;return _0xe971d4;});}})[_0xe720('0x1c')](respondWithFilteredResult(_0x2a1df4,_0x25d836))['catch'](handleError(_0x2a1df4,null));};exports['addTags']=function(_0x1104f3,_0x23f6b0){return db[_0xe720('0x24')][_0xe720('0x38')]({'where':{'id':_0x1104f3['params']['id']}})['then'](handleEntityNotFound(_0x23f6b0,null))['then'](function(_0x463d6f){if(_0x463d6f){return _0x463d6f[_0xe720('0x47')](_0x1104f3[_0xe720('0x3a')]['ids'],_[_0xe720('0x48')](_0x1104f3[_0xe720('0x3a')],[_0xe720('0x49'),'id'])||{})[_0xe720('0x4a')](function(){return db[_0xe720('0x4b')][_0xe720('0x28')]({'attributes':['id',_0xe720('0x21'),_0xe720('0x4c')],'where':{'id':_0x1104f3[_0xe720('0x3a')]['ids']}});})[_0xe720('0x1c')](function(_0x35b56c){socket[_0xe720('0x4d')](_0xe720('0x4e'),{'id':Number(_0x1104f3[_0xe720('0x2c')]['id']),'tags':_0x35b56c||[]});return{'id':Number(_0x1104f3[_0xe720('0x2c')]['id']),'tags':_0x35b56c||[]};});}})[_0xe720('0x1c')](respondWithResult(_0x23f6b0,null))['catch'](handleError(_0x23f6b0,null));};exports[_0xe720('0x4f')]=function(_0x367615,_0x188f9d){return db[_0xe720('0x24')][_0xe720('0x38')]({'where':{'id':_0x367615[_0xe720('0x2c')]['id']}})[_0xe720('0x1c')](handleEntityNotFound(_0x188f9d,null))[_0xe720('0x1c')](function(_0x42b426){if(_0x42b426){return _0x42b426[_0xe720('0x4f')](_0x367615[_0xe720('0x30')][_0xe720('0x49')]);}})[_0xe720('0x1c')](respondWithStatusCode(_0x188f9d,null))[_0xe720('0x2a')](handleError(_0x188f9d,null));};exports[_0xe720('0x50')]=function(_0x44c28e,_0x28aa44){var _0x4c78b2=moment()['unix']()[_0xe720('0x51')]();var _0x21bae1=path[_0xe720('0x52')](config['root'],_0xe720('0x53'),_0xe720('0x54'),_0xe720('0x55'));var _0x3e3064=path[_0xe720('0x52')](_0x21bae1,_0x4c78b2);var _0x4c4376=util['format'](_0xe720('0x56'),_0x44c28e['params']['id'],_0x4c78b2);var _0x167d4d=path[_0xe720('0x52')](_0x21bae1,_0x4c4376);var _0x553edf=[];_0x553edf[_0xe720('0x57')]({'model':db[_0xe720('0x58')],'as':_0xe720('0x58'),'attributes':['id',_0xe720('0x59')],'raw':!![]});_0x553edf[_0xe720('0x57')]({'model':db[_0xe720('0x5a')],'as':'Contact','attributes':['id',_0xe720('0x5b'),_0xe720('0x5c')],'raw':!![]});var _0x308f85=[{'model':db[_0xe720('0x3c')],'as':'Messages','attributes':['id',_0xe720('0x3a'),'createdAt',_0xe720('0x5d'),_0xe720('0x5e'),_0xe720('0x5f')],'include':_0x553edf}];_0x308f85[_0xe720('0x57')]({'model':db['SmsAccount'],'as':_0xe720('0x60'),'attributes':['id',_0xe720('0x21')]});_0x308f85[_0xe720('0x57')]({'model':db[_0xe720('0x58')],'as':_0xe720('0x61'),'attributes':['id',_0xe720('0x59')]});return db['SmsInteraction'][_0xe720('0x38')]({'where':{'id':_0x44c28e[_0xe720('0x2c')]['id']},'include':_0x308f85})['then'](handleEntityNotFound(_0x28aa44,null))[_0xe720('0x1c')](function(_0x29aac5){if(_0x29aac5){var _0xd6e444=_0x29aac5[_0xe720('0x62')]({'plain':!![]});fs['mkdirSync'](_0x3e3064);var _0x4ddc7e={'channel':_0xe720('0x63'),'account':_0xd6e444[_0xe720('0x60')][_0xe720('0x21')],'agent':_0xd6e444[_0xe720('0x61')]?_0xd6e444['Owner'][_0xe720('0x59')]:_0xe720('0x64'),'createdAt':moment(_0xd6e444[_0xe720('0x65')])[_0xe720('0x45')](_0xe720('0x66'))[_0xe720('0x51')](),'closedAt':_0xd6e444['closed']?moment(_0xd6e444[_0xe720('0x67')])[_0xe720('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe720('0x51')]():'','disposition':_0xd6e444[_0xe720('0x68')],'messages':_(_0xd6e444[_0xe720('0x69')])[_0xe720('0x43')]({'secret':![]})[_0xe720('0x23')](function(_0x5b2892){return{'date':moment(_0x5b2892[_0xe720('0x65')])[_0xe720('0x45')](_0xe720('0x66'))['toString'](),'sender':_0x5b2892['direction']===_0xe720('0x6a')?_0x5b2892[_0xe720('0x58')]?_0x5b2892[_0xe720('0x58')][_0xe720('0x59')]:_0xe720('0x6b'):_0x5b2892[_0xe720('0x6c')][_0xe720('0x5b')]+(_0x5b2892['Contact'][_0xe720('0x5c')]?'\x20'+_0x5b2892[_0xe720('0x6c')][_0xe720('0x5c')]:''),'body':_0x5b2892[_0xe720('0x3a')],'direction':_0x5b2892[_0xe720('0x5d')]==='out'?'A':'C','secret':_0x5b2892[_0xe720('0x5e')],'read':_0x5b2892['read']};})[_0xe720('0x6d')]()};return ejs[_0xe720('0x6e')](path['join'](config[_0xe720('0x6f')],_0xe720('0x53'),_0xe720('0x70'),_0xe720('0x71')),{'interaction':_0x4ddc7e})['then'](function(_0x43cdba){var _0x3ff21c=path[_0xe720('0x52')](_0x3e3064,_0xe720('0x72')+_0xd6e444['id']+'-'+_0x4c78b2+_0xe720('0x73'));var _0x5f47c6={'path':_0x3ff21c,'channel':_0xe720('0x63'),'interactionId':_0xd6e444['id']};return pdf['createPdfFromHTML'](_0x43cdba,_0x5f47c6);})['then'](function(){return new BPromise(function(_0x2bd1b2,_0x163cbe){zipdir(_0x3e3064,{'saveTo':_0x167d4d},function(_0x4c88a9,_0x2f1638){if(_0x4c88a9)return _0x163cbe(_0x4c88a9);return _0x2bd1b2(_0x2f1638);});})[_0xe720('0x1c')](function(){return new BPromise(function(_0x3c78be,_0x3fb694){rimraf(_0x3e3064,function(_0x3d5b94){if(_0x3d5b94)_0x3fb694(_0x3d5b94);return _0x3c78be();});});})[_0xe720('0x1c')](function(){return _0x28aa44[_0xe720('0x50')](_0x167d4d,_0x4c4376,function(_0x4bf832){if(_0x4bf832){console[_0xe720('0x74')](_0xe720('0x75'),_0x4bf832);}else{fs[_0xe720('0x76')](_0x167d4d);}});});});}else{return _0x28aa44[_0xe720('0x1e')](0xc8);}})['catch'](handleError(_0x28aa44,null));};
\ No newline at end of file
+var _0xd482=['root','views','transcript-','.pdf','log','err','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','getOptions','user','catch','show','params','keys','query','intersection','model','attributes','fields','length','include','find','create','describe','addMessage','body','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','sort','where','filters','pick','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','includeAll','rows','addTags','setTags','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','server','tmp','transcript-%d-%s.zip','join','User','fullname','push','CmContact','Contact','lastName','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','Sms','N.A.','closed','closedAt','disposition','out','System','firstName','value','renderFile'];(function(_0xa963e4,_0x27f738){var _0x478bbe=function(_0x2fec6e){while(--_0x2fec6e){_0xa963e4['push'](_0xa963e4['shift']());}};_0x478bbe(++_0x27f738);}(_0xd482,0x1e6));var _0x2d48=function(_0x3721a5,_0xcddc91){_0x3721a5=_0x3721a5-0x0;var _0x4914d3=_0xd482[_0x3721a5];return _0x4914d3;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x2d48('0x0'));var BPromise=require(_0x2d48('0x1'));var util=require(_0x2d48('0x2'));var path=require('path');var ejs=require(_0x2d48('0x3'));var fs=require('fs');var _=require(_0x2d48('0x4'));var Redis=require(_0x2d48('0x5'));var interaction=require(_0x2d48('0x6'));var qs=require(_0x2d48('0x7'));var pdf=require(_0x2d48('0x8'));var logger=require('../../config/logger')(_0x2d48('0x9'));var config=require(_0x2d48('0xa'));var db=require(_0x2d48('0xb'))['db'];config['redis']=_[_0x2d48('0xc')](config[_0x2d48('0xd')],{'host':_0x2d48('0xe'),'port':0x18eb});var socket=require(_0x2d48('0xf'))(new Redis(config[_0x2d48('0xd')]));require(_0x2d48('0x10'))['register'](socket);function respondWithStatusCode(_0x2f4637,_0x2a3732){_0x2a3732=_0x2a3732||0xcc;return function(_0x23d3ed){if(_0x23d3ed){return _0x2f4637[_0x2d48('0x11')](_0x2a3732);}return _0x2f4637['status'](_0x2a3732)[_0x2d48('0x12')]();};}function respondWithResult(_0x49bd7a,_0x408875){_0x408875=_0x408875||0xc8;return function(_0x253114){if(_0x253114){return _0x49bd7a[_0x2d48('0x13')](_0x408875)[_0x2d48('0x14')](_0x253114);}};}function respondWithFilteredResult(_0x4d2841,_0x443602){return function(_0x3b150e){if(_0x3b150e){var _0x301f14=typeof _0x443602[_0x2d48('0x15')]===_0x2d48('0x16')&&typeof _0x443602[_0x2d48('0x17')]===_0x2d48('0x16');var _0x15b136=_0x3b150e[_0x2d48('0x18')];var _0x14f9c0=_0x301f14?0x0:_0x443602[_0x2d48('0x15')];var _0x2b4951=_0x301f14?_0x3b150e[_0x2d48('0x18')]:_0x443602[_0x2d48('0x15')]+_0x443602['limit'];var _0x1b5993;if(_0x2b4951>=_0x15b136){_0x2b4951=_0x15b136;_0x1b5993=0xc8;}else{_0x1b5993=0xce;}_0x4d2841[_0x2d48('0x13')](_0x1b5993);return _0x4d2841['set'](_0x2d48('0x19'),_0x14f9c0+'-'+_0x2b4951+'/'+_0x15b136)[_0x2d48('0x14')](_0x3b150e);}return null;};}function saveUpdates(_0x5a74ff){return function(_0x5b1639){if(_0x5b1639){return _0x5b1639[_0x2d48('0x1a')](_0x5a74ff)[_0x2d48('0x1b')](function(_0x6a9aca){return _0x6a9aca;});}return null;};}function removeEntity(_0xcd99b1){return function(_0x4293db){if(_0x4293db){return _0x4293db[_0x2d48('0x1c')]()[_0x2d48('0x1b')](function(){_0xcd99b1[_0x2d48('0x13')](0xcc)[_0x2d48('0x12')]();});}};}function handleEntityNotFound(_0xbc79a0){return function(_0x51bbd5){if(!_0x51bbd5){_0xbc79a0[_0x2d48('0x11')](0x194);}return _0x51bbd5;};}function handleError(_0x4f7a21,_0x3fed21){_0x3fed21=_0x3fed21||0x1f4;return function(_0x2b04db){logger[_0x2d48('0x1d')](_0x2b04db[_0x2d48('0x1e')]);if(_0x2b04db[_0x2d48('0x1f')]){delete _0x2b04db[_0x2d48('0x1f')];}_0x4f7a21[_0x2d48('0x13')](_0x3fed21)[_0x2d48('0x20')](_0x2b04db);};}exports[_0x2d48('0x21')]=function(_0x5d502f,_0x2892c8){var _0xbf1017={};var _0x4b334a=_[_0x2d48('0x22')](db[_0x2d48('0x23')][_0x2d48('0x24')],function(_0x512393){return{'name':_0x512393[_0x2d48('0x25')],'type':_0x512393['type']['key']};});_0xbf1017=qs[_0x2d48('0x26')](_0x4b334a,_0x5d502f);return interaction['findAll']('sms',_0x5d502f['query'],_0x5d502f[_0x2d48('0x27')],_0xbf1017,_0x4b334a)[_0x2d48('0x1b')](respondWithFilteredResult(_0x2892c8,_0xbf1017))[_0x2d48('0x28')](handleError(_0x2892c8,null));};exports[_0x2d48('0x29')]=function(_0x229291,_0xda22){var _0x54e103={'raw':![],'where':{'id':_0x229291[_0x2d48('0x2a')]['id']}},_0x5b8eea={};_0x5b8eea['model']=_[_0x2d48('0x2b')](db[_0x2d48('0x23')][_0x2d48('0x24')]);_0x5b8eea[_0x2d48('0x2c')]=_[_0x2d48('0x2b')](_0x229291[_0x2d48('0x2c')]);_0x5b8eea['filters']=_[_0x2d48('0x2d')](_0x5b8eea[_0x2d48('0x2e')],_0x5b8eea[_0x2d48('0x2c')]);_0x54e103[_0x2d48('0x2f')]=_[_0x2d48('0x2d')](_0x5b8eea[_0x2d48('0x2e')],qs[_0x2d48('0x30')](_0x229291[_0x2d48('0x2c')][_0x2d48('0x30')]));_0x54e103[_0x2d48('0x2f')]=_0x54e103[_0x2d48('0x2f')][_0x2d48('0x31')]?_0x54e103[_0x2d48('0x2f')]:_0x5b8eea['model'];if(_0x229291['query']['includeAll']){_0x54e103[_0x2d48('0x32')]=[{'all':!![]}];}_0x54e103=_['merge']({},_0x54e103,_0x229291['options']);return db[_0x2d48('0x23')][_0x2d48('0x33')](_0x54e103)['then'](handleEntityNotFound(_0xda22,null))[_0x2d48('0x1b')](respondWithResult(_0xda22,null))['catch'](handleError(_0xda22,null));};exports['create']=function(_0x19eb80,_0x336c21){return db[_0x2d48('0x23')][_0x2d48('0x34')](_0x19eb80['body'],{})[_0x2d48('0x1b')](respondWithResult(_0x336c21,0xc9))[_0x2d48('0x28')](handleError(_0x336c21,null));};exports[_0x2d48('0x1a')]=function(_0x27b4da,_0x171f29){if(_0x27b4da['body']['id']){delete _0x27b4da['body']['id'];}return db[_0x2d48('0x23')][_0x2d48('0x33')]({'where':{'id':_0x27b4da['params']['id']}})[_0x2d48('0x1b')](handleEntityNotFound(_0x171f29,null))[_0x2d48('0x1b')](saveUpdates(_0x27b4da['body'],null))['then'](respondWithResult(_0x171f29,null))[_0x2d48('0x28')](handleError(_0x171f29,null));};exports[_0x2d48('0x1c')]=function(_0x2d939a,_0x4ab141){return db[_0x2d48('0x23')]['find']({'where':{'id':_0x2d939a[_0x2d48('0x2a')]['id']}})[_0x2d48('0x1b')](handleEntityNotFound(_0x4ab141,null))[_0x2d48('0x1b')](removeEntity(_0x4ab141,null))['catch'](handleError(_0x4ab141,null));};exports[_0x2d48('0x35')]=function(_0x477a97,_0x3ed984){return db[_0x2d48('0x23')][_0x2d48('0x35')]()[_0x2d48('0x1b')](respondWithResult(_0x3ed984,null))[_0x2d48('0x28')](handleError(_0x3ed984,null));};exports[_0x2d48('0x36')]=function(_0x477452,_0x225dc5){return db['SmsMessage'][_0x2d48('0x33')]({'where':{'id':_0x477452[_0x2d48('0x2a')]['id']}})['then'](handleEntityNotFound(_0x225dc5,null))[_0x2d48('0x1b')](function(_0x2ed5d0){if(_0x2ed5d0){return _0x2ed5d0[_0x2d48('0x36')](_0x477452[_0x2d48('0x37')][_0x2d48('0x38')],_[_0x2d48('0x39')](_0x477452[_0x2d48('0x37')],['ids','id'])||{});}})[_0x2d48('0x1b')](respondWithResult(_0x225dc5,null))['catch'](handleError(_0x225dc5,null));};exports[_0x2d48('0x3a')]=function(_0x276941,_0x1d947d){var _0x10a0fc={'raw':![],'where':{}};var _0x1b66c7={};var _0x31e5ea={'count':0x0,'rows':[]};return db[_0x2d48('0x23')][_0x2d48('0x3b')]({'where':{'id':_0x276941['params']['id']}})['then'](handleEntityNotFound(_0x1d947d,null))[_0x2d48('0x1b')](function(_0x269bbd){if(_0x269bbd){_0x1b66c7[_0x2d48('0x2e')]=_[_0x2d48('0x2b')](db[_0x2d48('0x3c')][_0x2d48('0x24')]);_0x1b66c7[_0x2d48('0x2c')]=_[_0x2d48('0x2b')](_0x276941[_0x2d48('0x2c')]);_0x1b66c7['filters']=_[_0x2d48('0x2d')](_0x1b66c7[_0x2d48('0x2e')],_0x1b66c7[_0x2d48('0x2c')]);_0x10a0fc[_0x2d48('0x2f')]=_['intersection'](_0x1b66c7[_0x2d48('0x2e')],qs[_0x2d48('0x30')](_0x276941[_0x2d48('0x2c')][_0x2d48('0x30')]));_0x10a0fc[_0x2d48('0x2f')]=_0x10a0fc[_0x2d48('0x2f')]['length']?_0x10a0fc[_0x2d48('0x2f')]:_0x1b66c7[_0x2d48('0x2e')];if(!_0x276941[_0x2d48('0x2c')][_0x2d48('0x3d')](_0x2d48('0x3e'))){_0x10a0fc['limit']=qs[_0x2d48('0x17')](_0x276941[_0x2d48('0x2c')][_0x2d48('0x17')]);_0x10a0fc[_0x2d48('0x15')]=qs['offset'](_0x276941[_0x2d48('0x2c')][_0x2d48('0x15')]);}_0x10a0fc['order']=qs[_0x2d48('0x3f')](_0x276941[_0x2d48('0x2c')]['sort']);_0x10a0fc[_0x2d48('0x40')]=qs[_0x2d48('0x41')](_[_0x2d48('0x42')](_0x276941[_0x2d48('0x2c')],_0x1b66c7[_0x2d48('0x41')]));_0x10a0fc[_0x2d48('0x40')][_0x2d48('0x43')]=_0x269bbd['id'];if(_0x276941[_0x2d48('0x2c')][_0x2d48('0x44')]){_0x10a0fc[_0x2d48('0x40')]=_['merge'](_0x10a0fc[_0x2d48('0x40')],{'$or':_[_0x2d48('0x22')](_0x10a0fc[_0x2d48('0x2f')],function(_0x5b091f){var _0x398ae8={};_0x398ae8[_0x5b091f]={'$like':'%'+_0x276941[_0x2d48('0x2c')][_0x2d48('0x44')]+'%'};return _0x398ae8;})});}if(_0x276941['query'][_0x2d48('0x45')]){var _0xe632a3=_0x276941[_0x2d48('0x2c')][_0x2d48('0x45')]['split'](',');var _0x36ce27={};_0x36ce27[_0xe632a3[0x0]]={'$gte':moment(_0xe632a3[0x1])[_0x2d48('0x46')](_0x2d48('0x47'))};_0x10a0fc[_0x2d48('0x40')]=_[_0x2d48('0x48')](_0x10a0fc[_0x2d48('0x40')],_0x36ce27);}_0x10a0fc=_[_0x2d48('0x48')]({},_0x10a0fc,_0x276941[_0x2d48('0x49')]);return db[_0x2d48('0x3c')][_0x2d48('0x18')]({'where':_0x10a0fc['where']})[_0x2d48('0x1b')](function(_0x5a5d19){_0x31e5ea[_0x2d48('0x18')]=_0x5a5d19;if(_0x276941[_0x2d48('0x2c')][_0x2d48('0x4a')]){_0x10a0fc[_0x2d48('0x32')]=[{'all':!![]}];}return db[_0x2d48('0x3c')]['findAll'](_0x10a0fc);})['then'](function(_0xc21cfe){_0x31e5ea[_0x2d48('0x4b')]=_0xc21cfe;return _0x31e5ea;});}})[_0x2d48('0x1b')](respondWithFilteredResult(_0x1d947d,_0x10a0fc))[_0x2d48('0x28')](handleError(_0x1d947d,null));};exports[_0x2d48('0x4c')]=function(_0x34827a,_0x19795a){return db[_0x2d48('0x23')][_0x2d48('0x33')]({'where':{'id':_0x34827a[_0x2d48('0x2a')]['id']}})[_0x2d48('0x1b')](handleEntityNotFound(_0x19795a,null))[_0x2d48('0x1b')](function(_0x580dc6){if(_0x580dc6){return _0x580dc6[_0x2d48('0x4d')](_0x34827a['body'][_0x2d48('0x38')],_[_0x2d48('0x39')](_0x34827a['body'],[_0x2d48('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x2d48('0x4e')]({'attributes':['id','name',_0x2d48('0x4f')],'where':{'id':_0x34827a[_0x2d48('0x37')][_0x2d48('0x38')]}});})[_0x2d48('0x1b')](function(_0x33cc30){socket[_0x2d48('0x50')](_0x2d48('0x51'),{'id':Number(_0x34827a[_0x2d48('0x2a')]['id']),'tags':_0x33cc30||[]});return{'id':Number(_0x34827a[_0x2d48('0x2a')]['id']),'tags':_0x33cc30||[]};});}})[_0x2d48('0x1b')](respondWithResult(_0x19795a,null))[_0x2d48('0x28')](handleError(_0x19795a,null));};exports[_0x2d48('0x52')]=function(_0x4eee36,_0x4e5fae){return db[_0x2d48('0x23')][_0x2d48('0x33')]({'where':{'id':_0x4eee36['params']['id']}})[_0x2d48('0x1b')](handleEntityNotFound(_0x4e5fae,null))[_0x2d48('0x1b')](function(_0x25a9cc){if(_0x25a9cc){return _0x25a9cc[_0x2d48('0x52')](_0x4eee36[_0x2d48('0x2c')]['ids']);}})[_0x2d48('0x1b')](respondWithStatusCode(_0x4e5fae,null))[_0x2d48('0x28')](handleError(_0x4e5fae,null));};exports[_0x2d48('0x53')]=function(_0x1566cc,_0x1ebd91){var _0x21b25a=moment()[_0x2d48('0x54')]()[_0x2d48('0x55')]();var _0x250d3b=path['join'](config['root'],_0x2d48('0x56'),'files',_0x2d48('0x57'));var _0x5f07f0=path['join'](_0x250d3b,_0x21b25a);var _0x66a15d=util[_0x2d48('0x46')](_0x2d48('0x58'),_0x1566cc[_0x2d48('0x2a')]['id'],_0x21b25a);var _0x3b0655=path[_0x2d48('0x59')](_0x250d3b,_0x66a15d);var _0x467f86=[];_0x467f86['push']({'model':db[_0x2d48('0x5a')],'as':_0x2d48('0x5a'),'attributes':['id',_0x2d48('0x5b')],'raw':!![]});_0x467f86[_0x2d48('0x5c')]({'model':db[_0x2d48('0x5d')],'as':_0x2d48('0x5e'),'attributes':['id','firstName',_0x2d48('0x5f')],'raw':!![]});var _0x208663=[{'model':db[_0x2d48('0x3c')],'as':'Messages','attributes':['id',_0x2d48('0x37'),_0x2d48('0x60'),_0x2d48('0x61'),_0x2d48('0x62'),_0x2d48('0x63')],'include':_0x467f86}];_0x208663[_0x2d48('0x5c')]({'model':db[_0x2d48('0x64')],'as':_0x2d48('0x65'),'attributes':['id',_0x2d48('0x1f')]});_0x208663[_0x2d48('0x5c')]({'model':db[_0x2d48('0x5a')],'as':_0x2d48('0x66'),'attributes':['id',_0x2d48('0x5b')]});return db['SmsInteraction'][_0x2d48('0x33')]({'where':{'id':_0x1566cc['params']['id']},'include':_0x208663})[_0x2d48('0x1b')](handleEntityNotFound(_0x1ebd91,null))[_0x2d48('0x1b')](function(_0x4b1728){if(_0x4b1728){var _0x43b66c=_0x4b1728[_0x2d48('0x67')]({'plain':!![]});fs['mkdirSync'](_0x5f07f0);var _0x3ca719={'channel':_0x2d48('0x68'),'account':_0x43b66c[_0x2d48('0x65')][_0x2d48('0x1f')],'agent':_0x43b66c[_0x2d48('0x66')]?_0x43b66c[_0x2d48('0x66')][_0x2d48('0x5b')]:_0x2d48('0x69'),'createdAt':moment(_0x43b66c[_0x2d48('0x60')])[_0x2d48('0x46')](_0x2d48('0x47'))['toString'](),'closedAt':_0x43b66c[_0x2d48('0x6a')]?moment(_0x43b66c[_0x2d48('0x6b')])[_0x2d48('0x46')](_0x2d48('0x47'))[_0x2d48('0x55')]():'','disposition':_0x43b66c[_0x2d48('0x6c')],'messages':_(_0x43b66c['Messages'])['filter']({'secret':![]})[_0x2d48('0x22')](function(_0x50baa4){return{'date':moment(_0x50baa4[_0x2d48('0x60')])[_0x2d48('0x46')](_0x2d48('0x47'))[_0x2d48('0x55')](),'sender':_0x50baa4[_0x2d48('0x61')]===_0x2d48('0x6d')?_0x50baa4[_0x2d48('0x5a')]?_0x50baa4[_0x2d48('0x5a')][_0x2d48('0x5b')]:_0x2d48('0x6e'):_0x50baa4[_0x2d48('0x5e')][_0x2d48('0x6f')]+(_0x50baa4['Contact'][_0x2d48('0x5f')]?'\x20'+_0x50baa4['Contact'][_0x2d48('0x5f')]:''),'body':_0x50baa4[_0x2d48('0x37')],'direction':_0x50baa4[_0x2d48('0x61')]===_0x2d48('0x6d')?'A':'C','secret':_0x50baa4[_0x2d48('0x62')],'read':_0x50baa4[_0x2d48('0x63')]};})[_0x2d48('0x70')]()};return ejs[_0x2d48('0x71')](path[_0x2d48('0x59')](config[_0x2d48('0x72')],_0x2d48('0x56'),_0x2d48('0x73'),'downloadInteraction.ejs'),{'interaction':_0x3ca719})[_0x2d48('0x1b')](function(_0x5ce1c0){var _0x442c7c=path[_0x2d48('0x59')](_0x5f07f0,_0x2d48('0x74')+_0x43b66c['id']+'-'+_0x21b25a+_0x2d48('0x75'));var _0x45ce9f={'path':_0x442c7c,'channel':_0x2d48('0x68'),'interactionId':_0x43b66c['id']};return pdf['createPdfFromHTML'](_0x5ce1c0,_0x45ce9f);})[_0x2d48('0x1b')](function(){return new BPromise(function(_0x14d736,_0x249b91){zipdir(_0x5f07f0,{'saveTo':_0x3b0655},function(_0x41ab68,_0x2ba97d){if(_0x41ab68)return _0x249b91(_0x41ab68);return _0x14d736(_0x2ba97d);});})[_0x2d48('0x1b')](function(){return new BPromise(function(_0x349c6b,_0x534292){rimraf(_0x5f07f0,function(_0x3fd8a8){if(_0x3fd8a8)_0x534292(_0x3fd8a8);return _0x349c6b();});});})[_0x2d48('0x1b')](function(){return _0x1ebd91['download'](_0x3b0655,_0x66a15d,function(_0x5ce9be){if(_0x5ce9be){console[_0x2d48('0x76')](_0x2d48('0x77'),_0x5ce9be);}else{fs['unlinkSync'](_0x3b0655);}});});});}else{return _0x1ebd91[_0x2d48('0x11')](0xc8);}})[_0x2d48('0x28')](handleError(_0x1ebd91,null));};
\ No newline at end of file
index 466a082..47bae03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x47c5=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x47c5,0x165));var _0x547c=function(_0x261153,_0x174df0){_0x261153=_0x261153-0x0;var _0x5402f9=_0x47c5[_0x261153];return _0x5402f9;};'use strict';var EventEmitter=require(_0x547c('0x0'));var SmsInteraction=require(_0x547c('0x1'))['db'][_0x547c('0x2')];var SmsMessage=require(_0x547c('0x1'))['db'][_0x547c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x547c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x547c('0x5'),'afterDestroy':_0x547c('0x6')};function emitEvent(_0x5b48c9){return function(_0x3e827e,_0x468220,_0x51ab7f){_0x3e827e[_0x547c('0x7')]({'attributes':['id'],'raw':!![]})[_0x547c('0x8')](function(_0x381f2e){_0x3e827e[_0x547c('0x9')](_0x547c('0xa'),_0x381f2e[_0x547c('0xb')](function(_0x3e2279){return{'id':_0x3e2279['id']};}));return SmsMessage[_0x547c('0xc')]({'where':{'SmsInteractionId':_0x3e827e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x547c('0x8')](function(_0x44a581){_0x3e827e[_0x547c('0x9')](_0x547c('0xd'),_0x44a581[_0x547c('0xe')]);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9+':'+_0x3e827e['id'],_0x3e827e);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9,_0x3e827e);_0x51ab7f(null);})[_0x547c('0x10')](_0x51ab7f(null));};}for(var e in events){if(events[_0x547c('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x547c('0x12')]=SmsInteractionEvents;
\ No newline at end of file
+var _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x240686,_0x2efde8){var _0x44c804=function(_0x674767){while(--_0x674767){_0x240686['push'](_0x240686['shift']());}};_0x44c804(++_0x2efde8);}(_0x02ce,0x1ac));var _0xe02c=function(_0x1df804,_0x337349){_0x1df804=_0x1df804-0x0;var _0x20eeb0=_0x02ce[_0x1df804];return _0x20eeb0;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents;
\ No newline at end of file
index 01e4c03..19a7e8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb162=['path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x644f39,_0x29de5a){var _0x153f00=function(_0x5505ef){while(--_0x5505ef){_0x644f39['push'](_0x644f39['shift']());}};_0x153f00(++_0x29de5a);}(_0xb162,0x14b));var _0x2b16=function(_0x17eeb9,_0x3b8685){_0x17eeb9=_0x17eeb9-0x0;var _0x24f777=_0xb162[_0x17eeb9];return _0x24f777;};'use strict';var _=require(_0x2b16('0x0'));var util=require(_0x2b16('0x1'));var logger=require(_0x2b16('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2b16('0x3'));var rp=require(_0x2b16('0x4'));var fs=require('fs');var path=require(_0x2b16('0x5'));var rimraf=require(_0x2b16('0x6'));var config=require(_0x2b16('0x7'));var attributes=require(_0x2b16('0x8'));module['exports']=function(_0x51f33d,_0x3f217f){return _0x51f33d[_0x2b16('0x9')](_0x2b16('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e7a0a,_0x158e64,_0x2095f2){if(_0x5e7a0a[_0x2b16('0xb')](_0x2b16('0xc'))){_0x5e7a0a[_0x2b16('0xd')]=moment()[_0x2b16('0xe')](_0x2b16('0xf'));}_0x2095f2(null,_0x5e7a0a);}}});};
\ No newline at end of file
+var _0x1709=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','path','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x1709,0x84));var _0x9170=function(_0x5459c6,_0x4f3f18){_0x5459c6=_0x5459c6-0x0;var _0x3380e0=_0x1709[_0x5459c6];return _0x3380e0;};'use strict';var _=require(_0x9170('0x0'));var util=require(_0x9170('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9170('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9170('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9170('0x4'));module[_0x9170('0x5')]=function(_0x132dd9,_0x3dcf6d){return _0x132dd9[_0x9170('0x6')](_0x9170('0x7'),attributes,{'tableName':_0x9170('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507f0b,_0x267d10,_0x50b3bb){if(_0x507f0b[_0x9170('0x9')](_0x9170('0xa'))){_0x507f0b[_0x9170('0xb')]=moment()['format'](_0x9170('0xc'));}_0x50b3bb(null,_0x507f0b);}}});};
\ No newline at end of file
index 6058f7a..a62af7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb28b=['redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter'];(function(_0x244a59,_0x7a45bc){var _0x488f8a=function(_0x261105){while(--_0x261105){_0x244a59['push'](_0x244a59['shift']());}};_0x488f8a(++_0x7a45bc);}(_0xb28b,0x11a));var _0xbb28=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb28b[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xbb28('0x0'));var util=require(_0xbb28('0x1'));var moment=require(_0xbb28('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb28('0x3'))['db'];var utils=require(_0xbb28('0x4'));var logger=require(_0xbb28('0x5'))(_0xbb28('0x6'));var config=require(_0xbb28('0x7'));var jayson=require(_0xbb28('0x8'));var client=jayson[_0xbb28('0x9')]['http']({'port':0x232a});config['redis']=_[_0xbb28('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbb28('0xb'))(new Redis(config[_0xbb28('0xc')]));require(_0xbb28('0xd'))[_0xbb28('0xe')](socket);function respondWithRpcPromise(_0x3bda7e,_0x1d9664,_0x16530c){return new BPromise(function(_0x4b6ae3,_0x4c21e3){return client[_0xbb28('0xf')](_0x3bda7e,_0x16530c)[_0xbb28('0x10')](function(_0xa8ece){logger[_0xbb28('0x11')](_0xbb28('0x12'),_0x1d9664,_0xbb28('0x13'));logger['debug'](_0xbb28('0x14'),_0x1d9664,_0xbb28('0x13'),JSON['stringify'](_0xa8ece));if(_0xa8ece['error']){if(_0xa8ece['error'][_0xbb28('0x15')]===0x1f4){logger[_0xbb28('0x16')](_0xbb28('0x12'),_0x1d9664,_0xa8ece['error'][_0xbb28('0x17')]);return _0x4c21e3(_0xa8ece[_0xbb28('0x16')][_0xbb28('0x17')]);}logger[_0xbb28('0x16')](_0xbb28('0x12'),_0x1d9664,_0xa8ece[_0xbb28('0x16')][_0xbb28('0x17')]);return _0x4b6ae3(_0xa8ece['error'][_0xbb28('0x17')]);}else{logger[_0xbb28('0x11')](_0xbb28('0x12'),_0x1d9664,_0xbb28('0x13'));_0x4b6ae3(_0xa8ece[_0xbb28('0x18')][_0xbb28('0x17')]);}})[_0xbb28('0x19')](function(_0x4374e2){logger[_0xbb28('0x16')](_0xbb28('0x12'),_0x1d9664,_0x4374e2);_0x4c21e3(_0x4374e2);});});}exports[_0xbb28('0x1a')]=function(_0x64fdb1){var _0x133406=this;return new Promise(function(_0x48b434,_0x1d3c59){return db[_0xbb28('0x1b')]['update'](_0x64fdb1[_0xbb28('0x1c')],{'raw':_0x64fdb1[_0xbb28('0x1d')]?_0x64fdb1[_0xbb28('0x1d')][_0xbb28('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x64fdb1[_0xbb28('0x1d')]?_0x64fdb1[_0xbb28('0x1d')][_0xbb28('0x1f')]||null:null,'attributes':_0x64fdb1['options']?_0x64fdb1['options'][_0xbb28('0x20')]||null:null,'limit':_0x64fdb1[_0xbb28('0x1d')]?_0x64fdb1[_0xbb28('0x1d')][_0xbb28('0x21')]||null:null})[_0xbb28('0x10')](function(_0x58dd0b){logger[_0xbb28('0x11')](_0xbb28('0x1a'),_0x64fdb1);logger['debug'](_0xbb28('0x1a'),_0x64fdb1,JSON[_0xbb28('0x22')](_0x58dd0b));_0x48b434(_0x58dd0b);})['catch'](function(_0x2e9801){logger[_0xbb28('0x16')](_0xbb28('0x1a'),_0x2e9801[_0xbb28('0x17')],_0x64fdb1);_0x1d3c59(_0x133406[_0xbb28('0x16')](0x1f4,_0x2e9801[_0xbb28('0x17')]));});});};exports[_0xbb28('0x23')]=function(_0x1ef170){return new Promise(function(_0x367dbd,_0x137a15){return db[_0xbb28('0x1b')][_0xbb28('0x24')]({'where':_0x1ef170[_0xbb28('0x1d')]?_0x1ef170[_0xbb28('0x1d')][_0xbb28('0x1f')]||null:null})[_0xbb28('0x10')](function(_0x5495c1){if(_0x5495c1){return _0x5495c1[_0xbb28('0x25')](_0x1ef170[_0xbb28('0x1c')][_0xbb28('0x26')],_[_0xbb28('0x27')](_0x1ef170[_0xbb28('0x1c')],['ids','id'])||{});}})[_0xbb28('0x28')](function(_0x165517){logger[_0xbb28('0x11')](_0xbb28('0x29'),_0x1ef170);logger['debug']('AddTags',_0x1ef170,JSON['stringify'](_0x165517));_0x367dbd(_0x165517);})[_0xbb28('0x19')](function(_0x1bc7ab){logger[_0xbb28('0x16')](_0xbb28('0x29'),_0x1bc7ab[_0xbb28('0x17')],_0x1ef170);_0x137a15(_this[_0xbb28('0x16')](0x1f4,_0x1bc7ab[_0xbb28('0x17')]));});});};
\ No newline at end of file
+var _0xc79d=['omit','AddTags','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','find','addTags','ids'];(function(_0x265793,_0x1184c5){var _0x1fbad1=function(_0x420cb8){while(--_0x420cb8){_0x265793['push'](_0x265793['shift']());}};_0x1fbad1(++_0x1184c5);}(_0xc79d,0xa3));var _0xdc79=function(_0x593512,_0x3bc1e9){_0x593512=_0x593512-0x0;var _0x183500=_0xc79d[_0x593512];return _0x183500;};'use strict';var _=require('lodash');var util=require(_0xdc79('0x0'));var moment=require(_0xdc79('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc79('0x2'));var db=require(_0xdc79('0x3'))['db'];var utils=require(_0xdc79('0x4'));var logger=require(_0xdc79('0x5'))(_0xdc79('0x6'));var config=require(_0xdc79('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdc79('0x8')]['http']({'port':0x232a});config[_0xdc79('0x9')]=_['defaults'](config['redis'],{'host':_0xdc79('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc79('0x9')]));require(_0xdc79('0xb'))[_0xdc79('0xc')](socket);function respondWithRpcPromise(_0x1c24fe,_0x4026cc,_0x246c3e){return new BPromise(function(_0x58aa26,_0x5d846c){return client[_0xdc79('0xd')](_0x1c24fe,_0x246c3e)['then'](function(_0x2fd6af){logger[_0xdc79('0xe')](_0xdc79('0xf'),_0x4026cc,_0xdc79('0x10'));logger[_0xdc79('0x11')](_0xdc79('0x12'),_0x4026cc,_0xdc79('0x10'),JSON[_0xdc79('0x13')](_0x2fd6af));if(_0x2fd6af[_0xdc79('0x14')]){if(_0x2fd6af['error'][_0xdc79('0x15')]===0x1f4){logger[_0xdc79('0x14')](_0xdc79('0xf'),_0x4026cc,_0x2fd6af[_0xdc79('0x14')][_0xdc79('0x16')]);return _0x5d846c(_0x2fd6af['error'][_0xdc79('0x16')]);}logger[_0xdc79('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x4026cc,_0x2fd6af[_0xdc79('0x14')][_0xdc79('0x16')]);return _0x58aa26(_0x2fd6af['error'][_0xdc79('0x16')]);}else{logger['info'](_0xdc79('0xf'),_0x4026cc,_0xdc79('0x10'));_0x58aa26(_0x2fd6af['result']['message']);}})['catch'](function(_0xd2906e){logger[_0xdc79('0x14')](_0xdc79('0xf'),_0x4026cc,_0xd2906e);_0x5d846c(_0xd2906e);});});}exports[_0xdc79('0x17')]=function(_0x1e23a0){var _0x12de16=this;return new Promise(function(_0x1ef475,_0x1f7744){return db[_0xdc79('0x18')][_0xdc79('0x19')](_0x1e23a0[_0xdc79('0x1a')],{'raw':_0x1e23a0[_0xdc79('0x1b')]?_0x1e23a0['options'][_0xdc79('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e23a0['options']?_0x1e23a0[_0xdc79('0x1b')][_0xdc79('0x1d')]||null:null,'attributes':_0x1e23a0['options']?_0x1e23a0[_0xdc79('0x1b')][_0xdc79('0x1e')]||null:null,'limit':_0x1e23a0[_0xdc79('0x1b')]?_0x1e23a0[_0xdc79('0x1b')][_0xdc79('0x1f')]||null:null})[_0xdc79('0x20')](function(_0x39db70){logger[_0xdc79('0xe')](_0xdc79('0x17'),_0x1e23a0);logger[_0xdc79('0x11')](_0xdc79('0x17'),_0x1e23a0,JSON[_0xdc79('0x13')](_0x39db70));_0x1ef475(_0x39db70);})['catch'](function(_0x257635){logger[_0xdc79('0x14')](_0xdc79('0x17'),_0x257635['message'],_0x1e23a0);_0x1f7744(_0x12de16[_0xdc79('0x14')](0x1f4,_0x257635['message']));});});};exports[_0xdc79('0x21')]=function(_0x2de556){return new Promise(function(_0x33e608,_0x2fab5b){return db[_0xdc79('0x18')][_0xdc79('0x22')]({'where':_0x2de556[_0xdc79('0x1b')]?_0x2de556[_0xdc79('0x1b')][_0xdc79('0x1d')]||null:null})['then'](function(_0x13e7f0){if(_0x13e7f0){return _0x13e7f0[_0xdc79('0x23')](_0x2de556['body'][_0xdc79('0x24')],_[_0xdc79('0x25')](_0x2de556[_0xdc79('0x1a')],['ids','id'])||{});}})['spread'](function(_0x2a329a){logger[_0xdc79('0xe')](_0xdc79('0x26'),_0x2de556);logger['debug'](_0xdc79('0x26'),_0x2de556,JSON[_0xdc79('0x13')](_0x2a329a));_0x33e608(_0x2a329a);})[_0xdc79('0x27')](function(_0x5d6c83){logger[_0xdc79('0x14')](_0xdc79('0x26'),_0x5d6c83['message'],_0x2de556);_0x2fab5b(_this['error'](0x1f4,_0x5d6c83[_0xdc79('0x16')]));});});};
\ No newline at end of file
index 59d6d94..c87262e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea52=['update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x54ccfb,_0x42dd2e){var _0x414dcc=function(_0x55981e){while(--_0x55981e){_0x54ccfb['push'](_0x54ccfb['shift']());}};_0x414dcc(++_0x42dd2e);}(_0xea52,0x1ec));var _0x2ea5=function(_0x382d7e,_0x16798c){_0x382d7e=_0x382d7e-0x0;var _0x33c721=_0xea52[_0x382d7e];return _0x33c721;};'use strict';var SmsInteractionEvents=require(_0x2ea5('0x0'));var events=[_0x2ea5('0x1'),_0x2ea5('0x2'),_0x2ea5('0x3')];function createListener(_0x894092,_0x528604){return function(_0x401e42){_0x528604[_0x2ea5('0x4')](_0x894092,_0x401e42);};}function removeListener(_0x13ee33,_0x518c37){return function(){SmsInteractionEvents[_0x2ea5('0x5')](_0x13ee33,_0x518c37);};}exports[_0x2ea5('0x6')]=function(_0x510bb3){for(var _0x315ca7=0x0,_0x1e5ce2=events[_0x2ea5('0x7')];_0x315ca7<_0x1e5ce2;_0x315ca7++){var _0x1521fb=events[_0x315ca7];var _0x43c329=createListener(_0x2ea5('0x8')+_0x1521fb,_0x510bb3);SmsInteractionEvents['on'](_0x1521fb,_0x43c329);}};
\ No newline at end of file
+var _0x089c=['save','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x5a5a98,_0x74f555){var _0x7d43ef=function(_0x36116a){while(--_0x36116a){_0x5a5a98['push'](_0x5a5a98['shift']());}};_0x7d43ef(++_0x74f555);}(_0x089c,0xff));var _0xc089=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x089c[_0xda464c];return _0x19e222;};'use strict';var SmsInteractionEvents=require(_0xc089('0x0'));var events=[_0xc089('0x1'),'remove',_0xc089('0x2')];function createListener(_0x50fa87,_0x48c40c){return function(_0x4f77d8){_0x48c40c[_0xc089('0x3')](_0x50fa87,_0x4f77d8);};}function removeListener(_0x3f1d38,_0xc3aa9a){return function(){SmsInteractionEvents[_0xc089('0x4')](_0x3f1d38,_0xc3aa9a);};}exports[_0xc089('0x5')]=function(_0x50a833){for(var _0x25c391=0x0,_0x15d938=events[_0xc089('0x6')];_0x25c391<_0x15d938;_0x25c391++){var _0x122a56=events[_0x25c391];var _0x1b7247=createListener(_0xc089('0x7')+_0x122a56,_0x50a833);SmsInteractionEvents['on'](_0x122a56,_0x1b7247);}};
\ No newline at end of file
index aba3357..e3da745 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac8e=['/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','post','sms','smsmessage:create','create'];(function(_0xe1eeda,_0x5ddf0d){var _0x1488f6=function(_0x535dfa){while(--_0x535dfa){_0xe1eeda['push'](_0xe1eeda['shift']());}};_0x1488f6(++_0x5ddf0d);}(_0xac8e,0x19f));var _0xeac8=function(_0x41bb70,_0x1fdcd9){_0x41bb70=_0x41bb70-0x0;var _0xd49b9b=_0xac8e[_0x41bb70];return _0xd49b9b;};'use strict';var multer=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var path=require(_0xeac8('0x2'));var timeout=require(_0xeac8('0x3'));var express=require(_0xeac8('0x4'));var router=express[_0xeac8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeac8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeac8('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xeac8('0x8')](),controller[_0xeac8('0x9')]);router[_0xeac8('0xa')]('/describe',auth[_0xeac8('0x8')](),controller[_0xeac8('0xb')]);router[_0xeac8('0xa')](_0xeac8('0xc'),auth[_0xeac8('0x8')](),controller['show']);router[_0xeac8('0xd')]('/',auth[_0xeac8('0x8')](),interaction['tracked'](_0xeac8('0xe'),_0xeac8('0xf')),controller[_0xeac8('0x10')]);router[_0xeac8('0xd')](_0xeac8('0x11'),controller[_0xeac8('0x12')]);router[_0xeac8('0x13')](_0xeac8('0xc'),auth[_0xeac8('0x8')](),controller[_0xeac8('0x14')]);router['put'](_0xeac8('0x15'),auth[_0xeac8('0x8')](),controller[_0xeac8('0x16')]);router[_0xeac8('0x13')](_0xeac8('0x17'),auth[_0xeac8('0x8')](),controller[_0xeac8('0x18')]);router[_0xeac8('0x19')]('/:id',auth[_0xeac8('0x8')](),controller['destroy']);module[_0xeac8('0x1a')]=router;
\ No newline at end of file
+var _0x33d0=['path','Router','fs-extra','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer'];(function(_0x3dd81a,_0x5484c7){var _0x549571=function(_0x2ac948){while(--_0x2ac948){_0x3dd81a['push'](_0x3dd81a['shift']());}};_0x549571(++_0x5484c7);}(_0x33d0,0x99));var _0x033d=function(_0x398ec1,_0x1d63d8){_0x398ec1=_0x398ec1-0x0;var _0xcd9efa=_0x33d0[_0x398ec1];return _0xcd9efa;};'use strict';var multer=require(_0x033d('0x0'));var util=require('util');var path=require(_0x033d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x033d('0x2')]();var fs_extra=require(_0x033d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x033d('0x4'));var controller=require(_0x033d('0x5'));router[_0x033d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x033d('0x6')](_0x033d('0x7'),auth[_0x033d('0x8')](),controller[_0x033d('0x9')]);router[_0x033d('0x6')](_0x033d('0xa'),auth[_0x033d('0x8')](),controller[_0x033d('0xb')]);router[_0x033d('0xc')]('/',auth[_0x033d('0x8')](),interaction['tracked']('sms','smsmessage:create'),controller[_0x033d('0xd')]);router[_0x033d('0xc')](_0x033d('0xe'),controller['status']);router[_0x033d('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x033d('0xf')](_0x033d('0x10'),auth[_0x033d('0x8')](),controller[_0x033d('0x11')]);router['put'](_0x033d('0x12'),auth[_0x033d('0x8')](),controller[_0x033d('0x13')]);router[_0x033d('0x14')](_0x033d('0xa'),auth[_0x033d('0x8')](),controller[_0x033d('0x15')]);module['exports']=router;
\ No newline at end of file
index 963294f..36ae0fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x865e=['BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x153cc3,_0x23bd76){var _0x1ee8e3=function(_0x405d3f){while(--_0x405d3f){_0x153cc3['push'](_0x153cc3['shift']());}};_0x1ee8e3(++_0x23bd76);}(_0x865e,0x6d));var _0xe865=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x865e[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0xe865('0x0'));module[_0xe865('0x1')]={'body':{'type':Sequelize[_0xe865('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe865('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe865('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe865('0x5')](0xbe)},'phone':{'type':Sequelize[_0xe865('0x5')]},'readAt':{'type':Sequelize[_0xe865('0x6')]},'secret':{'type':Sequelize[_0xe865('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe865('0x2')]}};
\ No newline at end of file
+var _0x3620=['out','STRING','DATE','TEXT','medium','BOOLEAN','ENUM'];(function(_0x497ffc,_0x1d2290){var _0x584e1f=function(_0x556330){while(--_0x556330){_0x497ffc['push'](_0x497ffc['shift']());}};_0x584e1f(++_0x1d2290);}(_0x3620,0xcf));var _0x0362=function(_0xbd4b0f,_0x589522){_0xbd4b0f=_0xbd4b0f-0x0;var _0x2e6acf=_0x3620[_0xbd4b0f];return _0x2e6acf;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x0362('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x0362('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0362('0x2')]('in',_0x0362('0x3')),'defaultValue':_0x0362('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0362('0x4')]},'readAt':{'type':Sequelize[_0x0362('0x5')]},'secret':{'type':Sequelize[_0x0362('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0362('0x4')]},'providerResponse':{'type':Sequelize[_0x0362('0x6')]}};
\ No newline at end of file
index a75152d..67ed7a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x17bb=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','stack','send','index','map','rawAttributes','model','name','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsMessage','include','findAll','rows','params','fields','find','create','body','describe','../../config/logger','sms-interactions','accept','readAt','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','contact','User','fullname','email','SIP/%s','channel','motionChannel','event','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','QueryTypes','SELECT','internal','interface','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x17bb,0x188));var _0xb17b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x17bb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb17b('0x0'));var rimraf=require(_0xb17b('0x1'));var zipdir=require(_0xb17b('0x2'));var jsonpatch=require(_0xb17b('0x3'));var rp=require(_0xb17b('0x4'));var moment=require(_0xb17b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb17b('0x6'));var util=require(_0xb17b('0x7'));var path=require(_0xb17b('0x8'));var sox=require(_0xb17b('0x9'));var csv=require('to-csv');var ejs=require(_0xb17b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb17b('0xb'));var squel=require(_0xb17b('0xc'));var crypto=require(_0xb17b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb17b('0xe'));var toCsv=require(_0xb17b('0xf'));var querystring=require(_0xb17b('0x10'));var Papa=require(_0xb17b('0x11'));var Redis=require(_0xb17b('0x12'));var authService=require(_0xb17b('0x13'));var qs=require(_0xb17b('0x14'));var as=require(_0xb17b('0x15'));var hardwareService=require(_0xb17b('0x16'));var logger=require('../../config/logger')(_0xb17b('0x17'));var utils=require('../../config/utils');var config=require(_0xb17b('0x18'));var licenseUtil=require(_0xb17b('0x19'));var db=require(_0xb17b('0x1a'))['db'];config['redis']=_['defaults'](config[_0xb17b('0x1b')],{'host':_0xb17b('0x1c'),'port':0x18eb});var socket=require(_0xb17b('0x1d'))(new Redis(config[_0xb17b('0x1b')]));require(_0xb17b('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xb17b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x518482,_0x428426,_0x56b821,_0x40c600){return new BPromise(function(_0x46bfaf,_0x27b9b6){var _0x2ffc42=_0x40c600||client;return _0x2ffc42['request'](_0x518482,_0x56b821)[_0xb17b('0x20')](function(_0x20853d){logger[_0xb17b('0x21')](_0xb17b('0x22'),_0x428426,_0xb17b('0x23'));logger[_0xb17b('0x24')](_0xb17b('0x25'),_0x428426,_0xb17b('0x23'),JSON[_0xb17b('0x26')](_0x20853d));if(_0x20853d[_0xb17b('0x27')]){if(_0x20853d[_0xb17b('0x27')][_0xb17b('0x28')]===0x1f4){logger['error'](_0xb17b('0x22'),_0x428426,_0x20853d['error'][_0xb17b('0x29')]);return _0x27b9b6(_0x20853d['error'][_0xb17b('0x29')]);}logger[_0xb17b('0x27')](_0xb17b('0x22'),_0x428426,_0x20853d[_0xb17b('0x27')]['message']);return _0x46bfaf(_0x20853d[_0xb17b('0x27')][_0xb17b('0x29')]);}else{logger[_0xb17b('0x21')](_0xb17b('0x22'),_0x428426,_0xb17b('0x23'));_0x46bfaf(_0x20853d[_0xb17b('0x2a')][_0xb17b('0x29')]);}})[_0xb17b('0x2b')](function(_0x35f25b){logger[_0xb17b('0x27')](_0xb17b('0x22'),_0x428426,_0x35f25b);_0x27b9b6(_0x35f25b);});});}function respondWithStatusCode(_0x48533c,_0x3879fb){_0x3879fb=_0x3879fb||0xcc;return function(_0x2387ea){if(_0x2387ea){return _0x48533c['sendStatus'](_0x3879fb);}return _0x48533c[_0xb17b('0x2c')](_0x3879fb)[_0xb17b('0x2d')]();};}function respondWithResult(_0x4f6c96,_0x32a3b6){_0x32a3b6=_0x32a3b6||0xc8;return function(_0x49b4e4){if(_0x49b4e4){return _0x4f6c96[_0xb17b('0x2c')](_0x32a3b6)['json'](_0x49b4e4);}};}function respondWithFilteredResult(_0x425fb4,_0x33d0b2){return function(_0x50ec97){if(_0x50ec97){var _0xf45626=typeof _0x33d0b2[_0xb17b('0x2e')]===_0xb17b('0x2f')&&typeof _0x33d0b2[_0xb17b('0x30')]===_0xb17b('0x2f');var _0x3d0d58=_0x50ec97[_0xb17b('0x31')];var _0x306548=_0xf45626?0x0:_0x33d0b2[_0xb17b('0x2e')];var _0x223998=_0xf45626?_0x50ec97[_0xb17b('0x31')]:_0x33d0b2['offset']+_0x33d0b2[_0xb17b('0x30')];var _0x597e49;if(_0x223998>=_0x3d0d58){_0x223998=_0x3d0d58;_0x597e49=0xc8;}else{_0x597e49=0xce;}_0x425fb4[_0xb17b('0x2c')](_0x597e49);return _0x425fb4['set'](_0xb17b('0x32'),_0x306548+'-'+_0x223998+'/'+_0x3d0d58)[_0xb17b('0x33')](_0x50ec97);}return null;};}function patchUpdates(_0x88c4f1){return function(_0xbce175){try{jsonpatch['apply'](_0xbce175,_0x88c4f1,!![]);}catch(_0x54eb95){return BPromise[_0xb17b('0x34')](_0x54eb95);}return _0xbce175[_0xb17b('0x35')]();};}function saveUpdates(_0x5e2532,_0x39d102){return function(_0x471381){if(_0x471381){return _0x471381[_0xb17b('0x36')](_0x5e2532)[_0xb17b('0x20')](function(_0x2b090e){return _0x2b090e;});}return null;};}function removeEntity(_0x4002f5,_0x505b3b){return function(_0x4e94bb){if(_0x4e94bb){return _0x4e94bb[_0xb17b('0x37')]()[_0xb17b('0x20')](function(){_0x4002f5['status'](0xcc)[_0xb17b('0x2d')]();});}};}function handleEntityNotFound(_0x545c0d,_0x3c7d7d){return function(_0x2b44ec){if(!_0x2b44ec){_0x545c0d['sendStatus'](0x194);}return _0x2b44ec;};}function handleError(_0x18aac1,_0x4b8934){_0x4b8934=_0x4b8934||0x1f4;return function(_0x2bc2d1){logger[_0xb17b('0x27')](_0x2bc2d1[_0xb17b('0x38')]);if(_0x2bc2d1['name']){delete _0x2bc2d1['name'];}_0x18aac1[_0xb17b('0x2c')](_0x4b8934)[_0xb17b('0x39')](_0x2bc2d1);};}exports[_0xb17b('0x3a')]=function(_0x3d9407,_0x3eaa43){var _0x5af286={},_0x6a1e4d={},_0x1e6954={'count':0x0,'rows':[]};var _0xa109dc=_[_0xb17b('0x3b')](db['SmsMessage'][_0xb17b('0x3c')],function(_0x1bf04c){return{'name':_0x1bf04c['fieldName'],'type':_0x1bf04c['type']['key']};});_0x6a1e4d[_0xb17b('0x3d')]=_[_0xb17b('0x3b')](_0xa109dc,_0xb17b('0x3e'));_0x6a1e4d[_0xb17b('0x3f')]=_[_0xb17b('0x40')](_0x3d9407[_0xb17b('0x3f')]);_0x6a1e4d[_0xb17b('0x41')]=_[_0xb17b('0x42')](_0x6a1e4d['model'],_0x6a1e4d['query']);_0x5af286[_0xb17b('0x43')]=_['intersection'](_0x6a1e4d[_0xb17b('0x3d')],qs['fields'](_0x3d9407[_0xb17b('0x3f')]['fields']));_0x5af286[_0xb17b('0x43')]=_0x5af286[_0xb17b('0x43')][_0xb17b('0x44')]?_0x5af286['attributes']:_0x6a1e4d[_0xb17b('0x3d')];if(!_0x3d9407['query']['hasOwnProperty'](_0xb17b('0x45'))){_0x5af286['limit']=qs['limit'](_0x3d9407[_0xb17b('0x3f')][_0xb17b('0x30')]);_0x5af286[_0xb17b('0x2e')]=qs[_0xb17b('0x2e')](_0x3d9407[_0xb17b('0x3f')][_0xb17b('0x2e')]);}_0x5af286['order']=qs[_0xb17b('0x46')](_0x3d9407['query'][_0xb17b('0x46')]);_0x5af286[_0xb17b('0x47')]=qs['filters'](_[_0xb17b('0x48')](_0x3d9407[_0xb17b('0x3f')],_0x6a1e4d[_0xb17b('0x41')]),_0xa109dc);if(_0x3d9407[_0xb17b('0x3f')][_0xb17b('0x49')]){_0x5af286['where']=_[_0xb17b('0x4a')](_0x5af286['where'],{'$or':_[_0xb17b('0x3b')](_0xa109dc,function(_0x186596){if(_0x186596[_0xb17b('0x4b')]!==_0xb17b('0x4c')){var _0x545dee={};_0x545dee[_0x186596['name']]={'$like':'%'+_0x3d9407[_0xb17b('0x3f')][_0xb17b('0x49')]+'%'};return _0x545dee;}})});}_0x5af286=_['merge']({},_0x5af286,_0x3d9407[_0xb17b('0x4d')]);var _0x2412ac={'where':_0x5af286[_0xb17b('0x47')]};return db[_0xb17b('0x4e')]['count'](_0x2412ac)['then'](function(_0x522102){_0x1e6954[_0xb17b('0x31')]=_0x522102;if(_0x3d9407[_0xb17b('0x3f')]['includeAll']){_0x5af286[_0xb17b('0x4f')]=[{'all':!![]}];}return db[_0xb17b('0x4e')][_0xb17b('0x50')](_0x5af286);})[_0xb17b('0x20')](function(_0x210237){_0x1e6954[_0xb17b('0x51')]=_0x210237;return _0x1e6954;})[_0xb17b('0x20')](respondWithFilteredResult(_0x3eaa43,_0x5af286))[_0xb17b('0x2b')](handleError(_0x3eaa43,null));};exports['show']=function(_0x5171f1,_0x285f45){var _0x53b308={'raw':!![],'where':{'id':_0x5171f1[_0xb17b('0x52')]['id']}},_0x347c64={};_0x347c64[_0xb17b('0x3d')]=_['keys'](db[_0xb17b('0x4e')][_0xb17b('0x3c')]);_0x347c64['query']=_[_0xb17b('0x40')](_0x5171f1[_0xb17b('0x3f')]);_0x347c64[_0xb17b('0x41')]=_[_0xb17b('0x42')](_0x347c64['model'],_0x347c64[_0xb17b('0x3f')]);_0x53b308[_0xb17b('0x43')]=_['intersection'](_0x347c64['model'],qs[_0xb17b('0x53')](_0x5171f1[_0xb17b('0x3f')][_0xb17b('0x53')]));_0x53b308['attributes']=_0x53b308[_0xb17b('0x43')][_0xb17b('0x44')]?_0x53b308[_0xb17b('0x43')]:_0x347c64[_0xb17b('0x3d')];if(_0x5171f1['query']['includeAll']){_0x53b308[_0xb17b('0x4f')]=[{'all':!![]}];}_0x53b308=_[_0xb17b('0x4a')]({},_0x53b308,_0x5171f1['options']);return db[_0xb17b('0x4e')][_0xb17b('0x54')](_0x53b308)[_0xb17b('0x20')](handleEntityNotFound(_0x285f45,null))[_0xb17b('0x20')](respondWithResult(_0x285f45,null))[_0xb17b('0x2b')](handleError(_0x285f45,null));};exports[_0xb17b('0x55')]=function(_0x51427b,_0x32a022){return db['SmsMessage']['create'](_0x51427b[_0xb17b('0x56')],{})['then'](respondWithResult(_0x32a022,0xc9))['catch'](handleError(_0x32a022,null));};exports[_0xb17b('0x36')]=function(_0xbc27fe,_0x200161){if(_0xbc27fe[_0xb17b('0x56')]['id']){delete _0xbc27fe[_0xb17b('0x56')]['id'];}return db[_0xb17b('0x4e')][_0xb17b('0x54')]({'where':{'id':_0xbc27fe[_0xb17b('0x52')]['id']}})[_0xb17b('0x20')](handleEntityNotFound(_0x200161,null))[_0xb17b('0x20')](saveUpdates(_0xbc27fe['body'],null))['then'](respondWithResult(_0x200161,null))[_0xb17b('0x2b')](handleError(_0x200161,null));};exports['destroy']=function(_0x46929f,_0x24d181){return db[_0xb17b('0x4e')][_0xb17b('0x54')]({'where':{'id':_0x46929f[_0xb17b('0x52')]['id']}})[_0xb17b('0x20')](handleEntityNotFound(_0x24d181,null))[_0xb17b('0x20')](removeEntity(_0x24d181,null))[_0xb17b('0x2b')](handleError(_0x24d181,null));};exports[_0xb17b('0x57')]=function(_0x214299,_0xbddd73){return db[_0xb17b('0x4e')][_0xb17b('0x57')]()[_0xb17b('0x20')](respondWithResult(_0xbddd73,null))[_0xb17b('0x2b')](handleError(_0xbddd73,null));};var interaction_log=require(_0xb17b('0x58'))(_0xb17b('0x59'));exports[_0xb17b('0x5a')]=function(_0x1db897,_0x4b4fcc,_0x32466b){var _0x2f4c62={'agent':{},'channel':'sms'};if(_0x1db897[_0xb17b('0x56')]['id']){delete _0x1db897[_0xb17b('0x56')]['id'];}_0x1db897[_0xb17b('0x56')]['read']=!![];_0x1db897[_0xb17b('0x56')][_0xb17b('0x5b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1db897['body'][_0xb17b('0x5c')]=_0x1db897[_0xb17b('0x56')][_0xb17b('0x5c')]||_0x1db897[_0xb17b('0x5d')]['id'];_0x2f4c62[_0xb17b('0x5e')]['id']=_0x1db897[_0xb17b('0x56')][_0xb17b('0x5c')];return db['SmsMessage'][_0xb17b('0x54')]({'where':{'id':_0x1db897[_0xb17b('0x52')]['id'],'UserId':null}})[_0xb17b('0x20')](handleEntityNotFound(_0x4b4fcc,null))['then'](saveUpdates(_0x1db897[_0xb17b('0x56')],null))[_0xb17b('0x20')](function(_0x20f613){if(_0x20f613){_0x2f4c62[_0xb17b('0x29')]=_0x20f613[_0xb17b('0x5f')]({'plain':!![]});return db[_0xb17b('0x60')]['find']({'where':{'id':_0x20f613[_0xb17b('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x4b4fcc,null))[_0xb17b('0x20')](function(_0x4a653a){if(_0x4a653a){return _0x4a653a['update']({'UserId':_0x1db897[_0xb17b('0x56')][_0xb17b('0x5c')],'read1stAt':_[_0xb17b('0x62')](_0x4a653a[_0xb17b('0x63')])?moment()[_0xb17b('0x64')](_0xb17b('0x65')):undefined});}return null;})['then'](function(_0x380533){if(_0x380533){_0x2f4c62[_0xb17b('0x66')]=_0x380533['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1db897[_0xb17b('0x5d')]['id'],_0x1db897['user'][_0xb17b('0x3e')],_0x1db897[_0xb17b('0x5d')]['role'],_0x2f4c62[_0xb17b('0x66')]['id'],_0x1db897[_0xb17b('0x56')]?JSON[_0xb17b('0x26')](_0x1db897[_0xb17b('0x56')]):_0xb17b('0x67'));return respondWithRpcPromise(_0xb17b('0x68'),'acceptMessage',_0x2f4c62);}return null;})[_0xb17b('0x20')](function(_0x51bb6c){var _0x1c6bf2=_0xb17b('0x69')+_0x51bb6c['message'][_0xb17b('0x6a')];return db['sequelize'][_0xb17b('0x3f')](_0x1c6bf2,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x2a9d07){return _0x2a9d07;});})[_0xb17b('0x20')](function(_0x4b3158){if(_0x4b3158){_0x2f4c62[_0xb17b('0x29')][_0xb17b('0x6b')]=_0x4b3158[0x0];if(!_0x1db897[_0xb17b('0x56')][_0xb17b('0x5c')])return;return db[_0xb17b('0x6c')][_0xb17b('0x54')]({'where':{'id':_0x1db897['body'][_0xb17b('0x5c')],'role':_0xb17b('0x5e')},'attributes':['id',_0xb17b('0x3e'),_0xb17b('0x6d'),_0xb17b('0x6e'),'internal'],'raw':!![]});}return null;})[_0xb17b('0x20')](function(_0x143606){if(!_0x143606)return null;_0x2f4c62[_0xb17b('0x29')][_0xb17b('0x5e')]=_0x143606;return _0x2f4c62;})[_0xb17b('0x20')](function(_0x322ee7){if(_0x322ee7){if(_0x1db897[_0xb17b('0x56')]['manual']){_0x2f4c62[_0xb17b('0x29')]['interface']=util[_0xb17b('0x64')](_0xb17b('0x6f'),_0x1db897[_0xb17b('0x5d')][_0xb17b('0x3e')]);_0x2f4c62[_0xb17b('0x29')][_0xb17b('0x70')]=_0x2f4c62['channel'];_0x2f4c62['message'][_0xb17b('0x71')]=_0x2f4c62['channel'];_0x2f4c62[_0xb17b('0x29')][_0xb17b('0x72')]=_0xb17b('0x5a');return respondWithRpcPromise(_0xb17b('0x73'),_0xb17b('0x73'),{'event':'acceptmessage','message':_0x2f4c62[_0xb17b('0x29')]},client9002)[_0xb17b('0x20')](function(){return _0x2f4c62;});}return _0x2f4c62;}return null;})[_0xb17b('0x20')](respondWithResult(_0x4b4fcc,null))['catch'](handleError(_0x4b4fcc,null));};var interaction_log=require('../../config/logger')(_0xb17b('0x59'));exports[_0xb17b('0x34')]=function(_0x4e4e54,_0x3eaa41,_0x21f331){var _0x24a8de={'agent':{},'channel':_0xb17b('0x74')};if(_0x4e4e54['body']['id']){delete _0x4e4e54['body']['id'];}_0x4e4e54[_0xb17b('0x56')][_0xb17b('0x5c')]=_0x4e4e54[_0xb17b('0x56')]['UserId']||_0x4e4e54[_0xb17b('0x5d')]['id'];_0x24a8de[_0xb17b('0x5e')]['id']=_0x4e4e54[_0xb17b('0x56')]['UserId'];return db[_0xb17b('0x4e')][_0xb17b('0x54')]({'where':{'id':_0x4e4e54[_0xb17b('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3eaa41,null))[_0xb17b('0x20')](function(_0x8b15ea){if(_0x8b15ea){_0x24a8de['message']=_0x8b15ea['get']({'plain':!![]});return db[_0xb17b('0x60')][_0xb17b('0x54')]({'where':{'id':_0x8b15ea[_0xb17b('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3eaa41,null))['then'](function(_0x5eb39f){if(_0x5eb39f){_0x24a8de[_0xb17b('0x66')]=_0x5eb39f[_0xb17b('0x5f')]({'plain':!![]});interaction_log[_0xb17b('0x21')](_0xb17b('0x75'),_0x4e4e54['user']['id'],_0x4e4e54[_0xb17b('0x5d')]['name'],_0x4e4e54[_0xb17b('0x5d')]['role'],_0x24a8de[_0xb17b('0x66')]['id'],_0x4e4e54[_0xb17b('0x56')]?JSON[_0xb17b('0x26')](_0x4e4e54['body']):_0xb17b('0x67'));return respondWithRpcPromise(_0xb17b('0x76'),_0xb17b('0x77'),_0x24a8de);}return null;})[_0xb17b('0x20')](function(_0x119838){var _0x479b80=_0xb17b('0x69')+_0x119838['message'][_0xb17b('0x6a')];return db[_0xb17b('0x78')][_0xb17b('0x3f')](_0x479b80,{'type':db[_0xb17b('0x79')][_0xb17b('0x7a')][_0xb17b('0x7b')],'raw':!![]})['then'](function(_0x3de604){return _0x3de604;});})[_0xb17b('0x20')](function(_0x291ff0){if(_0x291ff0){_0x24a8de[_0xb17b('0x29')]['contact']=_0x291ff0[0x0];if(!_0x4e4e54[_0xb17b('0x56')]['UserId'])return;return db[_0xb17b('0x6c')]['find']({'where':{'id':_0x4e4e54[_0xb17b('0x56')][_0xb17b('0x5c')],'role':_0xb17b('0x5e')},'attributes':['id',_0xb17b('0x3e'),_0xb17b('0x6d'),'email',_0xb17b('0x7c')],'raw':!![]});}return null;})['then'](function(_0x2bd699){if(!_0x2bd699)return null;_0x24a8de[_0xb17b('0x29')][_0xb17b('0x5e')]=_0x2bd699;return _0x24a8de;})[_0xb17b('0x20')](function(_0x303b15){if(_0x303b15){_0x303b15[_0xb17b('0x29')][_0xb17b('0x7d')]=util[_0xb17b('0x64')]('SIP/%s',_0x4e4e54[_0xb17b('0x5d')][_0xb17b('0x3e')]);_0x303b15[_0xb17b('0x29')][_0xb17b('0x70')]=_0x24a8de[_0xb17b('0x70')];_0x303b15['message'][_0xb17b('0x71')]=_0x24a8de[_0xb17b('0x70')];_0x303b15[_0xb17b('0x29')][_0xb17b('0x72')]='reject';respondWithRpcPromise(_0xb17b('0x73'),_0xb17b('0x73'),{'event':'rejectmessage','message':_0x303b15['message']},client9002);return _0x24a8de;}return null;})[_0xb17b('0x20')](respondWithResult(_0x3eaa41,null))[_0xb17b('0x2b')](handleError(_0x3eaa41,null));};exports[_0xb17b('0x2c')]=function(_0x281bce,_0x37d711,_0x418acd){if(_0x281bce[_0xb17b('0x56')]['id']){delete _0x281bce[_0xb17b('0x56')]['id'];}var _0x453b4e;return db['SmsMessage'][_0xb17b('0x54')]({'where':{'id':_0x281bce[_0xb17b('0x52')]['id']}})[_0xb17b('0x20')](handleEntityNotFound(_0x37d711,null))[_0xb17b('0x20')](function(_0x320232){if(_0x320232){_0x453b4e=_0x320232;return db[_0xb17b('0x7e')][_0xb17b('0x54')]({'where':{'id':_0x320232[_0xb17b('0x7f')]}});}})[_0xb17b('0x20')](handleEntityNotFound(_0x37d711,null))[_0xb17b('0x20')](function(_0x2aa9e8){if(_0x2aa9e8){logger['debug'](_0xb17b('0x25'),_0xb17b('0x2c'),_0xb17b('0x80'),_0x2aa9e8[_0xb17b('0x4b')],util[_0xb17b('0x81')](_0x281bce[_0xb17b('0x56')],{'showHidden':![],'depth':null}));switch(_0x2aa9e8[_0xb17b('0x4b')]){case _0xb17b('0x82'):if(_0x281bce[_0xb17b('0x56')][_0xb17b('0x83')]&&_0x281bce[_0xb17b('0x56')][_0xb17b('0x83')]===_0x453b4e[_0xb17b('0x84')]){return _0x453b4e[_0xb17b('0x36')]({'read':!![]});}else{logger[_0xb17b('0x27')](_0xb17b('0x85'),_0xb17b('0x2c'),'twilio',util[_0xb17b('0x81')](_0x281bce[_0xb17b('0x56')],{'showHidden':![],'depth':null}));}break;case _0xb17b('0x86'):if(_0x281bce['body'][_0xb17b('0x87')]&&_0x281bce['body'][_0xb17b('0x87')]===_0x453b4e[_0xb17b('0x84')]&&_[_0xb17b('0x88')]([_0xb17b('0x89'),_0xb17b('0x8a')],_0x281bce[_0xb17b('0x56')][_0xb17b('0x8b')])>=0x0){return _0x453b4e[_0xb17b('0x36')]({'read':!![]});}else{logger[_0xb17b('0x27')](_0xb17b('0x85'),_0xb17b('0x2c'),_0xb17b('0x8c'),util['inspect'](_0x281bce[_0xb17b('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x493a98=_0x281bce['body'][_0xb17b('0x8d')][0x0];if(_0x493a98[_0xb17b('0x2c')]['groupName']===_0xb17b('0x8e')){return _0x453b4e[_0xb17b('0x36')]({'read':!![]});}else{logger[_0xb17b('0x27')](_0xb17b('0x85'),'status','infobip',util[_0xb17b('0x81')](_0x281bce['body'],{'showHidden':![],'depth':null}));}break;}return _0x453b4e;}})[_0xb17b('0x20')](respondWithResult(_0x37d711,null))[_0xb17b('0x2b')](handleError(_0x37d711,null));};
\ No newline at end of file
+var _0xe651=['client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','params','rawAttributes','fields','create','body','find','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','interaction','get','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise'];(function(_0x327841,_0x40ade0){var _0x18a99f=function(_0x1ae7de){while(--_0x1ae7de){_0x327841['push'](_0x327841['shift']());}};_0x18a99f(++_0x40ade0);}(_0xe651,0x1a5));var _0x1e65=function(_0x461930,_0x329a2a){_0x461930=_0x461930-0x0;var _0x382394=_0xe651[_0x461930];return _0x382394;};'use strict';var emlformat=require(_0x1e65('0x0'));var rimraf=require(_0x1e65('0x1'));var zipdir=require(_0x1e65('0x2'));var jsonpatch=require(_0x1e65('0x3'));var rp=require(_0x1e65('0x4'));var moment=require(_0x1e65('0x5'));var BPromise=require(_0x1e65('0x6'));var Mustache=require('mustache');var util=require(_0x1e65('0x7'));var path=require(_0x1e65('0x8'));var sox=require(_0x1e65('0x9'));var csv=require(_0x1e65('0xa'));var ejs=require(_0x1e65('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1e65('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e65('0xd'));var deskjs=require(_0x1e65('0xe'));var toCsv=require(_0x1e65('0xa'));var querystring=require(_0x1e65('0xf'));var Papa=require(_0x1e65('0x10'));var Redis=require(_0x1e65('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1e65('0x12'));var as=require(_0x1e65('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e65('0x14'))(_0x1e65('0x15'));var utils=require(_0x1e65('0x16'));var config=require(_0x1e65('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e65('0x18'))['db'];config[_0x1e65('0x19')]=_['defaults'](config[_0x1e65('0x19')],{'host':_0x1e65('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x1e65('0x1b')](socket);var jayson=require(_0x1e65('0x1c'));var client=jayson[_0x1e65('0x1d')][_0x1e65('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x1e65('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x13472d,_0x3c0f80,_0x3360d1,_0x3cf3f5){return new BPromise(function(_0x3acde6,_0x441e79){var _0x381b93=_0x3cf3f5||client;return _0x381b93[_0x1e65('0x1f')](_0x13472d,_0x3360d1)['then'](function(_0x413d48){logger[_0x1e65('0x20')](_0x1e65('0x21'),_0x3c0f80,_0x1e65('0x22'));logger[_0x1e65('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c0f80,_0x1e65('0x22'),JSON['stringify'](_0x413d48));if(_0x413d48[_0x1e65('0x24')]){if(_0x413d48[_0x1e65('0x24')]['code']===0x1f4){logger[_0x1e65('0x24')](_0x1e65('0x21'),_0x3c0f80,_0x413d48['error'][_0x1e65('0x25')]);return _0x441e79(_0x413d48[_0x1e65('0x24')]['message']);}logger[_0x1e65('0x24')](_0x1e65('0x21'),_0x3c0f80,_0x413d48[_0x1e65('0x24')][_0x1e65('0x25')]);return _0x3acde6(_0x413d48[_0x1e65('0x24')][_0x1e65('0x25')]);}else{logger[_0x1e65('0x20')]('SmsMessage,\x20%s,\x20%s',_0x3c0f80,'request\x20sent');_0x3acde6(_0x413d48[_0x1e65('0x26')]['message']);}})[_0x1e65('0x27')](function(_0x116b0f){logger[_0x1e65('0x24')]('SmsMessage,\x20%s,\x20%s',_0x3c0f80,_0x116b0f);_0x441e79(_0x116b0f);});});}function respondWithStatusCode(_0x3c2a8d,_0x2db73c){_0x2db73c=_0x2db73c||0xcc;return function(_0x2db213){if(_0x2db213){return _0x3c2a8d['sendStatus'](_0x2db73c);}return _0x3c2a8d['status'](_0x2db73c)['end']();};}function respondWithResult(_0x15d172,_0x38193a){_0x38193a=_0x38193a||0xc8;return function(_0x263704){if(_0x263704){return _0x15d172['status'](_0x38193a)[_0x1e65('0x28')](_0x263704);}};}function respondWithFilteredResult(_0x43a9e2,_0x2a248a){return function(_0x386bd5){if(_0x386bd5){var _0x1960c5=typeof _0x2a248a[_0x1e65('0x29')]===_0x1e65('0x2a')&&typeof _0x2a248a[_0x1e65('0x2b')]===_0x1e65('0x2a');var _0x19dcae=_0x386bd5[_0x1e65('0x2c')];var _0xe0e23e=_0x1960c5?0x0:_0x2a248a['offset'];var _0x1b4e4e=_0x1960c5?_0x386bd5[_0x1e65('0x2c')]:_0x2a248a[_0x1e65('0x29')]+_0x2a248a[_0x1e65('0x2b')];var _0x59aef5;if(_0x1b4e4e>=_0x19dcae){_0x1b4e4e=_0x19dcae;_0x59aef5=0xc8;}else{_0x59aef5=0xce;}_0x43a9e2[_0x1e65('0x2d')](_0x59aef5);return _0x43a9e2['set'](_0x1e65('0x2e'),_0xe0e23e+'-'+_0x1b4e4e+'/'+_0x19dcae)[_0x1e65('0x28')](_0x386bd5);}return null;};}function patchUpdates(_0xc84483){return function(_0x12f51f){try{jsonpatch[_0x1e65('0x2f')](_0x12f51f,_0xc84483,!![]);}catch(_0x1a7fdf){return BPromise[_0x1e65('0x30')](_0x1a7fdf);}return _0x12f51f[_0x1e65('0x31')]();};}function saveUpdates(_0x52dbf0,_0x1fb128){return function(_0x1ff5a0){if(_0x1ff5a0){return _0x1ff5a0[_0x1e65('0x32')](_0x52dbf0)['then'](function(_0x3b4f1b){return _0x3b4f1b;});}return null;};}function removeEntity(_0x4337ab,_0x3c433c){return function(_0x82f43b){if(_0x82f43b){return _0x82f43b[_0x1e65('0x33')]()[_0x1e65('0x34')](function(){_0x4337ab['status'](0xcc)[_0x1e65('0x35')]();});}};}function handleEntityNotFound(_0x20d2c7,_0x474fc){return function(_0x5779d0){if(!_0x5779d0){_0x20d2c7[_0x1e65('0x36')](0x194);}return _0x5779d0;};}function handleError(_0x651e3d,_0xb25d24){_0xb25d24=_0xb25d24||0x1f4;return function(_0x56481a){logger[_0x1e65('0x24')](_0x56481a[_0x1e65('0x37')]);if(_0x56481a[_0x1e65('0x38')]){delete _0x56481a[_0x1e65('0x38')];}_0x651e3d[_0x1e65('0x2d')](_0xb25d24)['send'](_0x56481a);};}exports[_0x1e65('0x39')]=function(_0x52d846,_0x1917a6){var _0x3b4f43={},_0x5171a8={},_0x22ed13={'count':0x0,'rows':[]};var _0x3d7547=_[_0x1e65('0x3a')](db['SmsMessage']['rawAttributes'],function(_0x1a4765){return{'name':_0x1a4765[_0x1e65('0x3b')],'type':_0x1a4765['type'][_0x1e65('0x3c')]};});_0x5171a8[_0x1e65('0x3d')]=_[_0x1e65('0x3a')](_0x3d7547,_0x1e65('0x38'));_0x5171a8[_0x1e65('0x3e')]=_[_0x1e65('0x3f')](_0x52d846[_0x1e65('0x3e')]);_0x5171a8[_0x1e65('0x40')]=_[_0x1e65('0x41')](_0x5171a8[_0x1e65('0x3d')],_0x5171a8[_0x1e65('0x3e')]);_0x3b4f43[_0x1e65('0x42')]=_['intersection'](_0x5171a8[_0x1e65('0x3d')],qs['fields'](_0x52d846[_0x1e65('0x3e')]['fields']));_0x3b4f43[_0x1e65('0x42')]=_0x3b4f43[_0x1e65('0x42')][_0x1e65('0x43')]?_0x3b4f43['attributes']:_0x5171a8[_0x1e65('0x3d')];if(!_0x52d846[_0x1e65('0x3e')][_0x1e65('0x44')]('nolimit')){_0x3b4f43[_0x1e65('0x2b')]=qs['limit'](_0x52d846[_0x1e65('0x3e')][_0x1e65('0x2b')]);_0x3b4f43[_0x1e65('0x29')]=qs['offset'](_0x52d846[_0x1e65('0x3e')][_0x1e65('0x29')]);}_0x3b4f43['order']=qs[_0x1e65('0x45')](_0x52d846['query']['sort']);_0x3b4f43[_0x1e65('0x46')]=qs[_0x1e65('0x40')](_[_0x1e65('0x47')](_0x52d846[_0x1e65('0x3e')],_0x5171a8[_0x1e65('0x40')]),_0x3d7547);if(_0x52d846[_0x1e65('0x3e')][_0x1e65('0x48')]){_0x3b4f43[_0x1e65('0x46')]=_[_0x1e65('0x49')](_0x3b4f43[_0x1e65('0x46')],{'$or':_[_0x1e65('0x3a')](_0x3d7547,function(_0x423198){if(_0x423198[_0x1e65('0x4a')]!==_0x1e65('0x4b')){var _0x5041ae={};_0x5041ae[_0x423198[_0x1e65('0x38')]]={'$like':'%'+_0x52d846[_0x1e65('0x3e')]['filter']+'%'};return _0x5041ae;}})});}_0x3b4f43=_['merge']({},_0x3b4f43,_0x52d846[_0x1e65('0x4c')]);var _0x23b8a8={'where':_0x3b4f43[_0x1e65('0x46')]};return db[_0x1e65('0x4d')][_0x1e65('0x2c')](_0x23b8a8)[_0x1e65('0x34')](function(_0x3c5026){_0x22ed13[_0x1e65('0x2c')]=_0x3c5026;if(_0x52d846[_0x1e65('0x3e')][_0x1e65('0x4e')]){_0x3b4f43[_0x1e65('0x4f')]=[{'all':!![]}];}return db[_0x1e65('0x4d')][_0x1e65('0x50')](_0x3b4f43);})[_0x1e65('0x34')](function(_0x3d92bb){_0x22ed13[_0x1e65('0x51')]=_0x3d92bb;return _0x22ed13;})['then'](respondWithFilteredResult(_0x1917a6,_0x3b4f43))[_0x1e65('0x27')](handleError(_0x1917a6,null));};exports['show']=function(_0x11a74c,_0x10eecc){var _0x54f395={'raw':!![],'where':{'id':_0x11a74c[_0x1e65('0x52')]['id']}},_0x51e046={};_0x51e046['model']=_[_0x1e65('0x3f')](db[_0x1e65('0x4d')][_0x1e65('0x53')]);_0x51e046['query']=_['keys'](_0x11a74c[_0x1e65('0x3e')]);_0x51e046[_0x1e65('0x40')]=_[_0x1e65('0x41')](_0x51e046[_0x1e65('0x3d')],_0x51e046[_0x1e65('0x3e')]);_0x54f395[_0x1e65('0x42')]=_[_0x1e65('0x41')](_0x51e046[_0x1e65('0x3d')],qs[_0x1e65('0x54')](_0x11a74c[_0x1e65('0x3e')]['fields']));_0x54f395['attributes']=_0x54f395[_0x1e65('0x42')][_0x1e65('0x43')]?_0x54f395[_0x1e65('0x42')]:_0x51e046['model'];if(_0x11a74c['query']['includeAll']){_0x54f395['include']=[{'all':!![]}];}_0x54f395=_[_0x1e65('0x49')]({},_0x54f395,_0x11a74c[_0x1e65('0x4c')]);return db[_0x1e65('0x4d')]['find'](_0x54f395)[_0x1e65('0x34')](handleEntityNotFound(_0x10eecc,null))[_0x1e65('0x34')](respondWithResult(_0x10eecc,null))[_0x1e65('0x27')](handleError(_0x10eecc,null));};exports['create']=function(_0x317c20,_0x4c70b8){return db[_0x1e65('0x4d')][_0x1e65('0x55')](_0x317c20['body'],{})[_0x1e65('0x34')](respondWithResult(_0x4c70b8,0xc9))['catch'](handleError(_0x4c70b8,null));};exports[_0x1e65('0x32')]=function(_0x3c492c,_0x4ef5ce){if(_0x3c492c['body']['id']){delete _0x3c492c['body']['id'];}return db[_0x1e65('0x4d')]['find']({'where':{'id':_0x3c492c['params']['id']}})['then'](handleEntityNotFound(_0x4ef5ce,null))[_0x1e65('0x34')](saveUpdates(_0x3c492c[_0x1e65('0x56')],null))['then'](respondWithResult(_0x4ef5ce,null))[_0x1e65('0x27')](handleError(_0x4ef5ce,null));};exports[_0x1e65('0x33')]=function(_0x41d4f9,_0x129b30){return db[_0x1e65('0x4d')][_0x1e65('0x57')]({'where':{'id':_0x41d4f9[_0x1e65('0x52')]['id']}})[_0x1e65('0x34')](handleEntityNotFound(_0x129b30,null))[_0x1e65('0x34')](removeEntity(_0x129b30,null))['catch'](handleError(_0x129b30,null));};exports['describe']=function(_0xa41e7c,_0x56ad80){return db[_0x1e65('0x4d')][_0x1e65('0x58')]()[_0x1e65('0x34')](respondWithResult(_0x56ad80,null))[_0x1e65('0x27')](handleError(_0x56ad80,null));};var interaction_log=require(_0x1e65('0x14'))(_0x1e65('0x59'));exports[_0x1e65('0x5a')]=function(_0xa0069b,_0x204957,_0x3ab46a){var _0x101730={'agent':{},'channel':'sms'};if(_0xa0069b[_0x1e65('0x56')]['id']){delete _0xa0069b[_0x1e65('0x56')]['id'];}_0xa0069b['body'][_0x1e65('0x5b')]=!![];_0xa0069b[_0x1e65('0x56')][_0x1e65('0x5c')]=moment()[_0x1e65('0x5d')](_0x1e65('0x5e'));_0xa0069b[_0x1e65('0x56')][_0x1e65('0x5f')]=_0xa0069b['body']['UserId']||_0xa0069b[_0x1e65('0x60')]['id'];_0x101730[_0x1e65('0x61')]['id']=_0xa0069b[_0x1e65('0x56')][_0x1e65('0x5f')];return db[_0x1e65('0x4d')][_0x1e65('0x57')]({'where':{'id':_0xa0069b['params']['id'],'UserId':null}})[_0x1e65('0x34')](handleEntityNotFound(_0x204957,null))[_0x1e65('0x34')](saveUpdates(_0xa0069b[_0x1e65('0x56')],null))['then'](function(_0x4c228e){if(_0x4c228e){_0x101730[_0x1e65('0x25')]=_0x4c228e['get']({'plain':!![]});return db[_0x1e65('0x62')][_0x1e65('0x57')]({'where':{'id':_0x4c228e[_0x1e65('0x63')]}});}return null;})[_0x1e65('0x34')](handleEntityNotFound(_0x204957,null))[_0x1e65('0x34')](function(_0x370f40){if(_0x370f40){return _0x370f40[_0x1e65('0x32')]({'UserId':_0xa0069b[_0x1e65('0x56')]['UserId'],'read1stAt':_[_0x1e65('0x64')](_0x370f40['read1stAt'])?moment()[_0x1e65('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1e65('0x34')](function(_0x78dbef){if(_0x78dbef){_0x101730[_0x1e65('0x65')]=_0x78dbef[_0x1e65('0x66')]({'plain':!![]});interaction_log[_0x1e65('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa0069b[_0x1e65('0x60')]['id'],_0xa0069b[_0x1e65('0x60')][_0x1e65('0x38')],_0xa0069b['user'][_0x1e65('0x67')],_0x101730['interaction']['id'],_0xa0069b[_0x1e65('0x56')]?JSON[_0x1e65('0x68')](_0xa0069b[_0x1e65('0x56')]):_0x1e65('0x69'));return respondWithRpcPromise(_0x1e65('0x6a'),'acceptMessage',_0x101730);}return null;})[_0x1e65('0x34')](function(_0x21b01e){var _0x23d3b0=_0x1e65('0x6b')+_0x21b01e['message']['ContactId'];return db[_0x1e65('0x6c')][_0x1e65('0x3e')](_0x23d3b0,{'type':db[_0x1e65('0x6d')][_0x1e65('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x24b312){return _0x24b312;});})[_0x1e65('0x34')](function(_0x58d6f9){if(_0x58d6f9){_0x101730[_0x1e65('0x25')][_0x1e65('0x6f')]=_0x58d6f9[0x0];if(!_0xa0069b['body'][_0x1e65('0x5f')])return;return db[_0x1e65('0x70')][_0x1e65('0x57')]({'where':{'id':_0xa0069b[_0x1e65('0x56')]['UserId'],'role':'agent'},'attributes':['id','name',_0x1e65('0x71'),_0x1e65('0x72'),_0x1e65('0x73')],'raw':!![]});}return null;})[_0x1e65('0x34')](function(_0x4f5d56){if(!_0x4f5d56)return null;_0x101730[_0x1e65('0x25')]['agent']=_0x4f5d56;return _0x101730;})[_0x1e65('0x34')](function(_0x1b36e6){if(_0x1b36e6){if(_0xa0069b[_0x1e65('0x56')][_0x1e65('0x74')]){_0x101730[_0x1e65('0x25')][_0x1e65('0x75')]=util[_0x1e65('0x5d')](_0x1e65('0x76'),_0xa0069b[_0x1e65('0x60')][_0x1e65('0x38')]);_0x101730[_0x1e65('0x25')][_0x1e65('0x77')]=_0x101730[_0x1e65('0x77')];_0x101730[_0x1e65('0x25')][_0x1e65('0x78')]=_0x101730[_0x1e65('0x77')];_0x101730[_0x1e65('0x25')][_0x1e65('0x79')]=_0x1e65('0x5a');return respondWithRpcPromise(_0x1e65('0x7a'),_0x1e65('0x7a'),{'event':_0x1e65('0x7b'),'message':_0x101730[_0x1e65('0x25')]},client9002)[_0x1e65('0x34')](function(){return _0x101730;});}return _0x101730;}return null;})['then'](respondWithResult(_0x204957,null))[_0x1e65('0x27')](handleError(_0x204957,null));};var interaction_log=require(_0x1e65('0x14'))(_0x1e65('0x59'));exports[_0x1e65('0x30')]=function(_0x58aef8,_0x1efcda,_0x35417a){var _0x3cd777={'agent':{},'channel':_0x1e65('0x7c')};if(_0x58aef8[_0x1e65('0x56')]['id']){delete _0x58aef8[_0x1e65('0x56')]['id'];}_0x58aef8['body'][_0x1e65('0x5f')]=_0x58aef8[_0x1e65('0x56')][_0x1e65('0x5f')]||_0x58aef8[_0x1e65('0x60')]['id'];_0x3cd777[_0x1e65('0x61')]['id']=_0x58aef8[_0x1e65('0x56')][_0x1e65('0x5f')];return db[_0x1e65('0x4d')][_0x1e65('0x57')]({'where':{'id':_0x58aef8[_0x1e65('0x52')]['id'],'UserId':null}})[_0x1e65('0x34')](handleEntityNotFound(_0x1efcda,null))[_0x1e65('0x34')](function(_0x213d18){if(_0x213d18){_0x3cd777['message']=_0x213d18[_0x1e65('0x66')]({'plain':!![]});return db[_0x1e65('0x62')][_0x1e65('0x57')]({'where':{'id':_0x213d18[_0x1e65('0x63')]}});}return null;})[_0x1e65('0x34')](handleEntityNotFound(_0x1efcda,null))[_0x1e65('0x34')](function(_0xa6a42f){if(_0xa6a42f){_0x3cd777['interaction']=_0xa6a42f[_0x1e65('0x66')]({'plain':!![]});interaction_log[_0x1e65('0x20')](_0x1e65('0x7d'),_0x58aef8[_0x1e65('0x60')]['id'],_0x58aef8[_0x1e65('0x60')][_0x1e65('0x38')],_0x58aef8['user'][_0x1e65('0x67')],_0x3cd777['interaction']['id'],_0x58aef8[_0x1e65('0x56')]?JSON[_0x1e65('0x68')](_0x58aef8[_0x1e65('0x56')]):'null');return respondWithRpcPromise(_0x1e65('0x7e'),_0x1e65('0x7f'),_0x3cd777);}return null;})[_0x1e65('0x34')](function(_0x418c34){var _0x5d5dd9=_0x1e65('0x6b')+_0x418c34[_0x1e65('0x25')][_0x1e65('0x80')];return db[_0x1e65('0x6c')][_0x1e65('0x3e')](_0x5d5dd9,{'type':db[_0x1e65('0x6d')][_0x1e65('0x6e')][_0x1e65('0x81')],'raw':!![]})[_0x1e65('0x34')](function(_0x2f8258){return _0x2f8258;});})[_0x1e65('0x34')](function(_0x3e61c3){if(_0x3e61c3){_0x3cd777[_0x1e65('0x25')][_0x1e65('0x6f')]=_0x3e61c3[0x0];if(!_0x58aef8['body'][_0x1e65('0x5f')])return;return db[_0x1e65('0x70')][_0x1e65('0x57')]({'where':{'id':_0x58aef8[_0x1e65('0x56')][_0x1e65('0x5f')],'role':_0x1e65('0x61')},'attributes':['id',_0x1e65('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x39c18b){if(!_0x39c18b)return null;_0x3cd777[_0x1e65('0x25')][_0x1e65('0x61')]=_0x39c18b;return _0x3cd777;})[_0x1e65('0x34')](function(_0x32f37e){if(_0x32f37e){_0x32f37e[_0x1e65('0x25')][_0x1e65('0x75')]=util[_0x1e65('0x5d')](_0x1e65('0x76'),_0x58aef8['user'][_0x1e65('0x38')]);_0x32f37e[_0x1e65('0x25')]['channel']=_0x3cd777[_0x1e65('0x77')];_0x32f37e['message'][_0x1e65('0x78')]=_0x3cd777[_0x1e65('0x77')];_0x32f37e['message']['event']=_0x1e65('0x30');respondWithRpcPromise(_0x1e65('0x7a'),'EventManager',{'event':_0x1e65('0x82'),'message':_0x32f37e['message']},client9002);return _0x3cd777;}return null;})[_0x1e65('0x34')](respondWithResult(_0x1efcda,null))[_0x1e65('0x27')](handleError(_0x1efcda,null));};exports['status']=function(_0x12886d,_0x5a8ab9,_0x41fd81){if(_0x12886d['body']['id']){delete _0x12886d[_0x1e65('0x56')]['id'];}var _0x59b601;return db['SmsMessage'][_0x1e65('0x57')]({'where':{'id':_0x12886d[_0x1e65('0x52')]['id']}})[_0x1e65('0x34')](handleEntityNotFound(_0x5a8ab9,null))[_0x1e65('0x34')](function(_0x247f95){if(_0x247f95){_0x59b601=_0x247f95;return db[_0x1e65('0x83')][_0x1e65('0x57')]({'where':{'id':_0x247f95[_0x1e65('0x84')]}});}})['then'](handleEntityNotFound(_0x5a8ab9,null))[_0x1e65('0x34')](function(_0x5543fd){if(_0x5543fd){logger[_0x1e65('0x23')](_0x1e65('0x85'),_0x1e65('0x2d'),_0x1e65('0x86'),_0x5543fd[_0x1e65('0x4a')],util[_0x1e65('0x87')](_0x12886d['body'],{'showHidden':![],'depth':null}));switch(_0x5543fd['type']){case'twilio':if(_0x12886d['body'][_0x1e65('0x88')]&&_0x12886d['body'][_0x1e65('0x88')]===_0x59b601[_0x1e65('0x89')]){return _0x59b601['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1e65('0x2d'),_0x1e65('0x8a'),util[_0x1e65('0x87')](_0x12886d[_0x1e65('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1e65('0x8b'):if(_0x12886d[_0x1e65('0x56')][_0x1e65('0x8c')]&&_0x12886d[_0x1e65('0x56')][_0x1e65('0x8c')]===_0x59b601[_0x1e65('0x89')]&&_[_0x1e65('0x8d')]([_0x1e65('0x8e'),_0x1e65('0x8f')],_0x12886d[_0x1e65('0x56')]['Status'])>=0x0){return _0x59b601['update']({'read':!![]});}else{logger['error'](_0x1e65('0x90'),_0x1e65('0x2d'),_0x1e65('0x91'),util[_0x1e65('0x87')](_0x12886d[_0x1e65('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1e65('0x92'):var _0x42c474=_0x12886d[_0x1e65('0x56')][_0x1e65('0x93')][0x0];if(_0x42c474[_0x1e65('0x2d')][_0x1e65('0x94')]===_0x1e65('0x95')){return _0x59b601[_0x1e65('0x32')]({'read':!![]});}else{logger[_0x1e65('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1e65('0x2d'),_0x1e65('0x92'),util[_0x1e65('0x87')](_0x12886d[_0x1e65('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x59b601;}})[_0x1e65('0x34')](respondWithResult(_0x5a8ab9,null))[_0x1e65('0x27')](handleError(_0x5a8ab9,null));};
\ No newline at end of file
index 137bad7..c70c68a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad69=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x37185d,_0x5cf5c3){var _0x3bd1b4=function(_0x1e4bbd){while(--_0x1e4bbd){_0x37185d['push'](_0x37185d['shift']());}};_0x3bd1b4(++_0x5cf5c3);}(_0xad69,0x1af));var _0x9ad6=function(_0x5e2bed,_0x1ecf57){_0x5e2bed=_0x5e2bed-0x0;var _0x1ef264=_0xad69[_0x5e2bed];return _0x1ef264;};'use strict';var EventEmitter=require(_0x9ad6('0x0'));var SmsMessage=require(_0x9ad6('0x1'))['db'][_0x9ad6('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9ad6('0x3')](0x0);var events={'afterCreate':_0x9ad6('0x4'),'afterUpdate':_0x9ad6('0x5'),'afterDestroy':_0x9ad6('0x6')};function emitEvent(_0x4e9dd6){return function(_0x77849e,_0x21df82,_0x50ef8f){SmsMessageEvents[_0x9ad6('0x7')](_0x4e9dd6+':'+_0x77849e['id'],_0x77849e);SmsMessageEvents[_0x9ad6('0x7')](_0x4e9dd6,_0x77849e);_0x50ef8f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x9ad6('0x8')](e,emitEvent(event));}}module[_0x9ad6('0x9')]=SmsMessageEvents;
\ No newline at end of file
+var _0x5753=['hasOwnProperty','exports','events','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x201bda,_0x180641){var _0x4074cd=function(_0x3c2dff){while(--_0x3c2dff){_0x201bda['push'](_0x201bda['shift']());}};_0x4074cd(++_0x180641);}(_0x5753,0xfe));var _0x3575=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5753[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x3575('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x3575('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3575('0x2')](0x0);var events={'afterCreate':_0x3575('0x3'),'afterUpdate':_0x3575('0x4'),'afterDestroy':_0x3575('0x5')};function emitEvent(_0x49ee55){return function(_0xd73360,_0x2482aa,_0x2f080c){SmsMessageEvents[_0x3575('0x6')](_0x49ee55+':'+_0xd73360['id'],_0xd73360);SmsMessageEvents[_0x3575('0x6')](_0x49ee55,_0xd73360);_0x2f080c(null);};}for(var e in events){if(events[_0x3575('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x3575('0x8')]=SmsMessageEvents;
\ No newline at end of file
index d6ad695..0099bd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8564=['update','createdAt','direction','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','error','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/api/sms/messages/','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','keys','sort','length','createHash','hex','signature=','/external/get/send.php?','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x8564,0x1e3));var _0x4856=function(_0xa4b9bf,_0x4a612e){_0xa4b9bf=_0xa4b9bf-0x0;var _0x103455=_0x8564[_0xa4b9bf];return _0x103455;};'use strict';var _=require(_0x4856('0x0'));var util=require(_0x4856('0x1'));var logger=require('../../config/logger')(_0x4856('0x2'));var moment=require(_0x4856('0x3'));var BPromise=require(_0x4856('0x4'));var rp=require(_0x4856('0x5'));var fs=require('fs');var path=require(_0x4856('0x6'));var rimraf=require(_0x4856('0x7'));var config=require(_0x4856('0x8'));var attributes=require(_0x4856('0x9'));module[_0x4856('0xa')]=function(_0x339a0d,_0x4792b3){return _0x339a0d[_0x4856('0xb')](_0x4856('0xc'),attributes,{'tableName':_0x4856('0xd'),'paranoid':![],'indexes':[{'name':_0x4856('0xe'),'fields':[_0x4856('0xe')]},{'name':_0x4856('0xf'),'fields':[_0x4856('0x10')],'type':_0x4856('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d8612,_0x569448,_0x50fe45){var _0x574783=_0x339a0d[_0x4856('0x12')];var _0x3ba53b=_0x5d8612[_0x4856('0x13')]({'plain':!![]});if(_0x3ba53b['direction'][_0x4856('0x14')]()==='in'||_0x3ba53b['direction'][_0x4856('0x14')]()===_0x4856('0x15')&&!_0x3ba53b[_0x4856('0x16')]&&!_['isNil'](_0x3ba53b[_0x4856('0x17')])&&!_[_0x4856('0x18')](_0x3ba53b[_0x4856('0x19')])){_0x574783[_0x4856('0x1a')][_0x4856('0x1b')]({'where':{'id':_0x3ba53b['SmsInteractionId']}})[_0x4856('0x1c')](function(_0x3e584f){if(_0x3e584f){_0x3e584f[_0x4856('0x1d')]({'lastMsgAt':_0x3ba53b[_0x4856('0x1e')],'lastMsgDirection':_0x3ba53b[_0x4856('0x1f')][_0x4856('0x14')]()});}})[_0x4856('0x20')](function(_0x43bac9){console['error'](_0x43bac9);});}if(_0x3ba53b[_0x4856('0x1f')]===_0x4856('0x15')&&!_0x3ba53b['secret']){var _0x1ffdb3;_0x574783[_0x4856('0x21')][_0x4856('0x22')]({'where':{'id':_0x3ba53b[_0x4856('0x23')]},'raw':!![]})[_0x4856('0x1c')](function(_0x1b85bd){_0x1ffdb3=_0x1b85bd;if(_0x1ffdb3&&_0x1ffdb3[_0x4856('0x24')]){switch(_0x1ffdb3[_0x4856('0x24')]){case _0x4856('0x25'):var _0x17f895=require('twilio');if(_0x1ffdb3[_0x4856('0x26')]&&_0x1ffdb3[_0x4856('0x27')]&&_0x1ffdb3[_0x4856('0x28')]){var _0x42b7f1=new _0x17f895(_0x1ffdb3[_0x4856('0x26')],_0x1ffdb3[_0x4856('0x27')]);_0x42b7f1['messages'][_0x4856('0x29')]({'body':_0x3ba53b[_0x4856('0x10')],'to':_0x3ba53b[_0x4856('0x28')],'from':_0x1ffdb3['phone'],'statusCallback':_0x1ffdb3[_0x4856('0x2a')]+'/api/sms/messages/'+_0x3ba53b['id']+'/status?token='+_0x1ffdb3[_0x4856('0x2b')]})[_0x4856('0x1c')](function(_0x134634){if(_0x134634['sid']){return _0x5d8612[_0x4856('0x1d')]({'messageId':_0x134634[_0x4856('0x2c')]});}})[_0x4856('0x20')](function(_0x378ad5){logger['error'](_0x4856('0x2d'),'afterCreate',_0x4856('0x25'),util[_0x4856('0x2e')](_0x378ad5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x25'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x4856('0x30'):var _0x5d12b2=_0x4856('0x31');if(_0x1ffdb3[_0x4856('0x32')]&&_0x1ffdb3[_0x4856('0x33')]){var _0x522507={'recipient':[_0x3ba53b['phone']],'message':_0x3ba53b[_0x4856('0x10')],'message_type':_0x1ffdb3[_0x4856('0x34')]};if(_0x1ffdb3[_0x4856('0x34')]&&_0x1ffdb3[_0x4856('0x34')]!=='SI'){_0x522507[_0x4856('0x35')]=_0x1ffdb3['phone'];}var _0x1fc853={'url':_0x5d12b2+_0x4856('0x36')+_0x1ffdb3['username']+_0x4856('0x37')+_0x1ffdb3[_0x4856('0x33')],'method':_0x4856('0x38')};rp(_0x1fc853)[_0x4856('0x1c')](function(_0x261045){var _0x12cf9e=_0x261045[_0x4856('0x39')](';');var _0x1752aa={'user_key':_0x12cf9e[0x0],'session_key':_0x12cf9e[0x1]};_0x1fc853={'url':_0x5d12b2+'sms','method':_0x4856('0x3a'),'headers':{'user_key':_0x1752aa[_0x4856('0x3b')],'Session_key':_0x1752aa['session_key']},'json':!![],'body':_0x522507};return rp(_0x1fc853);})['then'](function(_0x5d8bb6){if(_0x5d8bb6[_0x4856('0x3c')]>=0x1){var _0x3a59db={'messageId':_0x5d8bb6[_0x4856('0x3d')]};if(_0x1ffdb3[_0x4856('0x34')]!=='GP'||!_0x1ffdb3[_0x4856('0x3e')]){_0x3a59db[_0x4856('0x3f')]=!![];}return _0x5d8612['update'](_0x3a59db);}else{return logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x30'),util[_0x4856('0x2e')](_0x5d8bb6,{'showHidden':![],'depth':null}));}})[_0x4856('0x20')](function(_0x1522b6){return logger['error'](_0x4856('0x2d'),'afterCreate',_0x4856('0x30'),util[_0x4856('0x2e')](_0x1522b6,{'showHidden':![],'depth':null}));});}else{logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4856('0x41'):if(_0x1ffdb3[_0x4856('0x27')]){var _0x408e59={'recipient':_0x3ba53b[_0x4856('0x28')],'message':_0x3ba53b[_0x4856('0x10')],'sender':_0x1ffdb3['senderString']||_0x1ffdb3['phone'],'authorization':_0x1ffdb3[_0x4856('0x27')]};var _0x569448={'method':_0x4856('0x3a'),'uri':_0x4856('0x42'),'body':_0x408e59,'json':!![]};rp(_0x569448)[_0x4856('0x1c')](function(_0x5ab454){var _0x155a11={'messageId':_0x5ab454[_0x4856('0x43')]};if(!_0x1ffdb3[_0x4856('0x3e')]){_0x155a11[_0x4856('0x3f')]=!![];}return _0x5d8612[_0x4856('0x1d')](_0x155a11);})['catch'](function(_0x5e4329){logger[_0x4856('0x40')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4856('0x2f'),_0x4856('0x41'),util['inspect'](_0x5e4329,{'showHidden':![],'depth':null}));});}else{logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x41'),_0x4856('0x44'));}break;case _0x4856('0x45'):if(_0x1ffdb3[_0x4856('0x32')]&&_0x1ffdb3[_0x4856('0x33')]){var _0x408e59={'messages':[{'source':_0x4856('0x46'),'to':_0x3ba53b[_0x4856('0x28')],'body':_0x3ba53b[_0x4856('0x10')],'from':_0x1ffdb3[_0x4856('0x47')]||_0x1ffdb3[_0x4856('0x28')]}]};var _0x3263fc=util[_0x4856('0x48')](_0x4856('0x49'),_0x1ffdb3[_0x4856('0x32')],_0x1ffdb3[_0x4856('0x33')]);var _0x569448={'method':_0x4856('0x3a'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x408e59,'headers':{'Authorization':util[_0x4856('0x48')](_0x4856('0x4a'),new Buffer(_0x3263fc)[_0x4856('0x4b')](_0x4856('0x4c')))},'json':!![]};rp(_0x569448)[_0x4856('0x1c')](function(_0x9dc589){if(_0x9dc589[_0x4856('0x4d')]>=0xc8&&_0x9dc589[_0x4856('0x4d')]<=0xce){if(_0x9dc589['data']&&_0x9dc589[_0x4856('0x4e')][_0x4856('0x4f')]>0x0){var _0x12d703=_[_0x4856('0x50')](_0x9dc589[_0x4856('0x4e')][_0x4856('0x51')]);var _0x9708dc={'messageId':_0x12d703[_0x4856('0x52')]};if(!_0x1ffdb3[_0x4856('0x3e')]){_0x9708dc[_0x4856('0x3f')]=!![];}return _0x5d8612[_0x4856('0x1d')](_0x9708dc);}else{logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x53'),util[_0x4856('0x2e')](_0x9dc589,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0x9dc589,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e331e){logger[_0x4856('0x40')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4856('0x53'),util['inspect'](_0x2e331e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x53'),_0x4856('0x54'));}break;case _0x4856('0x55'):if(_0x1ffdb3[_0x4856('0x56')]&&_0x1ffdb3[_0x4856('0x27')]){var _0x408e59={'dst':_0x3ba53b[_0x4856('0x28')],'text':_0x3ba53b[_0x4856('0x10')],'src':_0x1ffdb3[_0x4856('0x47')]||_0x1ffdb3[_0x4856('0x28')],'url':_0x1ffdb3[_0x4856('0x2a')]+'/api/sms/messages/'+_0x3ba53b['id']+_0x4856('0x57')+_0x1ffdb3[_0x4856('0x2b')]};var _0x3263fc=util[_0x4856('0x48')]('%s:%s',_0x1ffdb3[_0x4856('0x56')],_0x1ffdb3[_0x4856('0x27')]);var _0x569448={'method':'POST','uri':util['format'](_0x4856('0x58'),_0x1ffdb3[_0x4856('0x56')]),'body':_0x408e59,'headers':{'Authorization':util[_0x4856('0x48')](_0x4856('0x4a'),new Buffer(_0x3263fc)['toString']('base64'))},'json':!![]};rp(_0x569448)[_0x4856('0x1c')](function(_0x13a8c0){var _0x6e637b={'messageId':_0x13a8c0['message_uuid'][0x0]};return _0x5d8612[_0x4856('0x1d')](_0x6e637b);})[_0x4856('0x20')](function(_0x268c0b){logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x55'),util['inspect'](_0x268c0b,{'showHidden':![],'depth':null}));});}else{logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x55'),_0x4856('0x59'));}break;case _0x4856('0x5a'):if(_0x1ffdb3[_0x4856('0x32')]&&_0x1ffdb3['password']){if(_0x1ffdb3[_0x4856('0x5b')]){var _0x17e6e3={'method':_0x4856('0x3a'),'uri':_0x1ffdb3[_0x4856('0x5b')]+_0x4856('0x5c'),'body':{'username':_0x1ffdb3[_0x4856('0x32')],'password':_0x1ffdb3[_0x4856('0x33')]},'json':!![]};return rp(_0x17e6e3)[_0x4856('0x1c')](function(_0x330b9b){var _0x3e105b={'method':'POST','uri':_0x1ffdb3[_0x4856('0x5b')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1ffdb3[_0x4856('0x28')],'destinations':[{'to':_0x3ba53b[_0x4856('0x28')]}],'text':_0x3ba53b['body'],'notifyUrl':_0x1ffdb3[_0x4856('0x2a')]+_0x4856('0x5d')+_0x3ba53b['id']+_0x4856('0x57')+_0x1ffdb3[_0x4856('0x2b')],'notifyContentType':_0x4856('0x5e'),'callbackData':_0x1ffdb3[_0x4856('0x28')]+';'+_0x3ba53b[_0x4856('0x10')]}]},'headers':{'Authorization':_0x4856('0x5f')+_0x330b9b[_0x4856('0x2b')]},'json':!![]};return rp(_0x3e105b)[_0x4856('0x1c')](function(_0x41e990){if(_0x41e990['messages']){var _0x550550={'messageId':_0x41e990['messages'][0x0]['messageId']};if(!_0x1ffdb3['deliveryReport']){_0x550550[_0x4856('0x3f')]=!![];}return _0x5d8612[_0x4856('0x1d')](_0x550550);}else{return logger[_0x4856('0x40')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4856('0x2f'),_0x4856('0x5a'),util[_0x4856('0x2e')](_0x41e990,{'showHidden':![],'depth':null}));}});})[_0x4856('0x20')](function(_0x305052){return logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),'infobip',util['inspect'](_0x305052,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4856('0x2d'),'afterCreate','infobip',_0x4856('0x60'));}}else{logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x5a'),_0x4856('0x54'));}break;case'csc':var _0x534f8a=require(_0x4856('0x61'));if(_0x1ffdb3[_0x4856('0x62')]){var _0x457cc2={};_0x457cc2[_0x4856('0x63')]=_0x1ffdb3[_0x4856('0x32')];_0x457cc2[_0x4856('0x28')]=_0x3ba53b[_0x4856('0x28')];_0x457cc2[_0x4856('0x35')]=_0x1ffdb3[_0x4856('0x28')];_0x457cc2[_0x4856('0x64')]=_0x3ba53b[_0x4856('0x10')];_0x457cc2['timestamp']=+new Date();var _0x476149='';var _0x9b1d0='';var _0x5a7413=Object[_0x4856('0x65')](_0x457cc2);_0x5a7413[_0x4856('0x66')]();for(var _0xb05d5e=0x0;_0xb05d5e<_0x5a7413[_0x4856('0x67')];_0xb05d5e++){if(_0x476149!=''){_0x476149+='&';}_0x476149+=_0x5a7413[_0xb05d5e]+'='+encodeURIComponent(_0x457cc2[_0x5a7413[_0xb05d5e]]);_0x9b1d0+=_0x457cc2[_0x5a7413[_0xb05d5e]];}_0x9b1d0+=_0x1ffdb3[_0x4856('0x62')];_0x9b1d0=_0x534f8a[_0x4856('0x68')]('md5')[_0x4856('0x1d')](_0x9b1d0)['digest'](_0x4856('0x69'));if(_0x476149!==''){_0x476149+='&';}_0x476149+=_0x4856('0x6a')+_0x9b1d0;var _0x1fc853={'method':_0x4856('0x38'),'uri':_0x1ffdb3['baseUrl']+_0x4856('0x6b')+_0x476149,'json':!![]};return rp(_0x1fc853)[_0x4856('0x1c')](function(_0x39b1a2){var _0x3eb3cc=Object[_0x4856('0x65')](_0x39b1a2);if(_0x39b1a2[_0x3eb3cc[0x0]][_0x4856('0x40')]&&parseInt(_0x39b1a2[_0x3eb3cc[0x0]]['error'])===0x0){var _0x53b9ed={'messageId':_0x39b1a2[_0x3eb3cc[0x0]][_0x4856('0x6c')]};if(!_0x1ffdb3[_0x4856('0x3e')]){_0x53b9ed[_0x4856('0x3f')]=!![];}return _0x5d8612['update'](_0x53b9ed);}else{return logger[_0x4856('0x40')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x4856('0x2e')](_0x39b1a2['error'],{'showHidden':![],'depth':null}));}})[_0x4856('0x20')](function(_0x41d2ca){return logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x6d'),util['inspect'](_0x41d2ca,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4856('0x2d'),_0x4856('0x2f'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x4856('0x6e'):if(_0x1ffdb3[_0x4856('0x62')]){var _0x2ca2c7={'method':'POST','uri':_0x4856('0x6f'),'headers':{'Authorization':_0x1ffdb3[_0x4856('0x62')]},'body':{'content':_0x3ba53b[_0x4856('0x10')],'to':[_0x3ba53b[_0x4856('0x28')]],'from':_0x1ffdb3[_0x4856('0x28')],'binary':![],'clientMessageId':_0x4856('0x70'),'charset':_0x4856('0x71')},'json':!![]};rp(_0x2ca2c7)[_0x4856('0x1c')](function(_0x56b82d){if(!_0x56b82d[_0x4856('0x40')]){var _0x4b2ec5={'messageId':_0x56b82d[_0x4856('0x51')][0x0][_0x4856('0x72')]};if(!_0x1ffdb3[_0x4856('0x3e')]){_0x4b2ec5['read']=!![];}return _0x5d8612[_0x4856('0x1d')](_0x4b2ec5);}else{return logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x6e'),util[_0x4856('0x2e')](_0x56b82d[_0x4856('0x40')],{'showHidden':![],'depth':null}));}})[_0x4856('0x20')](function(_0x52cae1){return logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x6e'),util[_0x4856('0x2e')](_0x52cae1,{'showHidden':![],'depth':null}));});}else{logger[_0x4856('0x40')](_0x4856('0x2d'),'afterCreate','clickatell',_0x4856('0x73'));}break;case'bandwidth':if(_0x1ffdb3[_0x4856('0x32')]&&_0x1ffdb3[_0x4856('0x33')]){var _0x3263fc=util[_0x4856('0x48')](_0x4856('0x49'),_0x1ffdb3[_0x4856('0x32')],_0x1ffdb3[_0x4856('0x33')]);var _0x569448={'method':_0x4856('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1ffdb3['accountId']+_0x4856('0x74'),'body':{'to':[_0x3ba53b['phone']],'text':_0x3ba53b[_0x4856('0x10')],'from':_0x1ffdb3[_0x4856('0x28')],'applicationId':_0x1ffdb3[_0x4856('0x75')]},'headers':{'Authorization':util['format'](_0x4856('0x4a'),new Buffer(_0x3263fc)[_0x4856('0x4b')](_0x4856('0x4c')))},'json':!![]};rp(_0x569448)[_0x4856('0x1c')](function(_0x4b6d98){if(_0x4b6d98['id']){var _0x24e6f2={'messageId':_0x4b6d98['id']};return _0x5d8612[_0x4856('0x1d')](_0x24e6f2);}else{logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x76'),util[_0x4856('0x2e')](_0x4b6d98,{'showHidden':![],'depth':null}));}})[_0x4856('0x20')](function(_0x204039){logger[_0x4856('0x40')](_0x4856('0x2d'),_0x4856('0x2f'),_0x4856('0x76'),util[_0x4856('0x2e')](_0x204039,{'showHidden':![],'depth':null}));});}else{logger[_0x4856('0x40')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4856('0x2f'),_0x4856('0x76'),_0x4856('0x54'));}break;case'intelepeer':if(_0x1ffdb3[_0x4856('0x62')]){var _0x58fc3b={};var _0x1fc853={'method':_0x4856('0x3a'),'uri':_0x4856('0x77'),'headers':{'Authorization':_0x4856('0x78')+_0x1ffdb3[_0x4856('0x62')],'Content-Type':'application/json'},'body':{'from':_0x1ffdb3[_0x4856('0x28')],'to':_0x3ba53b['phone'],'text':_0x3ba53b[_0x4856('0x10')]},'json':!![]};return rp(_0x1fc853)[_0x4856('0x1c')](function(_0x51719a){if(_0x51719a[_0x4856('0x79')]==0xca){_0x58fc3b['message']=_0x51719a;var _0x4148a3={'method':_0x4856('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4856('0x78')+_0x1ffdb3['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x58fc3b[_0x4856('0x7a')]['refid']},'json':!![]};return rp(_0x4148a3)[_0x4856('0x1c')](function(_0x413383){_0x58fc3b['status']=_0x413383;var _0x5d5c08={'messageId':_0x58fc3b[_0x4856('0x7a')][_0x4856('0x7b')],'read':!![]};return _0x5d8612[_0x4856('0x1d')](_0x5d5c08);});}else{return logger[_0x4856('0x40')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4856('0x2f'),'intelepeer',util['inspect'](_0x51719a,{'showHidden':![],'depth':null}));}})[_0x4856('0x20')](function(_0x27cbed){return logger['error'](_0x4856('0x2d'),'afterCreate',_0x4856('0x7c'),util[_0x4856('0x2e')](_0x27cbed,{'showHidden':![],'depth':null}));});}else{return logger[_0x4856('0x40')](_0x4856('0x2d'),'afterCreate',_0x4856('0x7c'),_0x4856('0x7d'));}break;}}})['finally'](function(){_0x50fe45();});}else{_0x50fe45();}}},'charset':_0x4856('0x7e'),'collate':_0x4856('0x7f')});};
\ No newline at end of file
+var _0xab94=['SmsAccount','find','SmsAccountId','twilio','accountSid','authToken','phone','/status?token=','token','sid','update','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','authId','remote','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','text','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','uuid','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','applicationId','bandwidth','intelepeer','apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','UserId','isNil','SmsInteraction','findOne','then','error'];(function(_0x53ad14,_0x454a90){var _0x3d4ac4=function(_0x5c47ef){while(--_0x5c47ef){_0x53ad14['push'](_0x53ad14['shift']());}};_0x3d4ac4(++_0x454a90);}(_0xab94,0x14d));var _0x4ab9=function(_0x21d83c,_0x2b9c10){_0x21d83c=_0x21d83c-0x0;var _0x2d7c76=_0xab94[_0x21d83c];return _0x2d7c76;};'use strict';var _=require(_0x4ab9('0x0'));var util=require(_0x4ab9('0x1'));var logger=require(_0x4ab9('0x2'))('api');var moment=require(_0x4ab9('0x3'));var BPromise=require(_0x4ab9('0x4'));var rp=require(_0x4ab9('0x5'));var fs=require('fs');var path=require(_0x4ab9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ab9('0x7'));module[_0x4ab9('0x8')]=function(_0xe940c6,_0x122a31){return _0xe940c6[_0x4ab9('0x9')](_0x4ab9('0xa'),attributes,{'tableName':_0x4ab9('0xb'),'paranoid':![],'indexes':[{'name':_0x4ab9('0xc'),'fields':['messageId']},{'name':_0x4ab9('0xd'),'fields':[_0x4ab9('0xe')],'type':_0x4ab9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x82c95e,_0x197fdd,_0x95996f){var _0x2b44d0=_0xe940c6[_0x4ab9('0x10')];var _0x1248c7=_0x82c95e[_0x4ab9('0x11')]({'plain':!![]});if(_0x1248c7['direction'][_0x4ab9('0x12')]()==='in'||_0x1248c7[_0x4ab9('0x13')][_0x4ab9('0x12')]()===_0x4ab9('0x14')&&!_0x1248c7['secret']&&!_['isNil'](_0x1248c7[_0x4ab9('0x15')])&&!_[_0x4ab9('0x16')](_0x1248c7['SmsInteractionId'])){_0x2b44d0[_0x4ab9('0x17')][_0x4ab9('0x18')]({'where':{'id':_0x1248c7['SmsInteractionId']}})[_0x4ab9('0x19')](function(_0x5a8395){if(_0x5a8395){_0x5a8395['update']({'lastMsgAt':_0x1248c7['createdAt'],'lastMsgDirection':_0x1248c7[_0x4ab9('0x13')][_0x4ab9('0x12')]()});}})['catch'](function(_0x5421bd){console[_0x4ab9('0x1a')](_0x5421bd);});}if(_0x1248c7[_0x4ab9('0x13')]===_0x4ab9('0x14')&&!_0x1248c7['secret']){var _0x40aed4;_0x2b44d0[_0x4ab9('0x1b')][_0x4ab9('0x1c')]({'where':{'id':_0x1248c7[_0x4ab9('0x1d')]},'raw':!![]})[_0x4ab9('0x19')](function(_0x268a03){_0x40aed4=_0x268a03;if(_0x40aed4&&_0x40aed4['type']){switch(_0x40aed4['type']){case _0x4ab9('0x1e'):var _0x2a5d06=require(_0x4ab9('0x1e'));if(_0x40aed4[_0x4ab9('0x1f')]&&_0x40aed4[_0x4ab9('0x20')]&&_0x40aed4['phone']){var _0x54cbe4=new _0x2a5d06(_0x40aed4[_0x4ab9('0x1f')],_0x40aed4['authToken']);_0x54cbe4['messages']['create']({'body':_0x1248c7[_0x4ab9('0xe')],'to':_0x1248c7[_0x4ab9('0x21')],'from':_0x40aed4[_0x4ab9('0x21')],'statusCallback':_0x40aed4['remote']+'/api/sms/messages/'+_0x1248c7['id']+_0x4ab9('0x22')+_0x40aed4[_0x4ab9('0x23')]})[_0x4ab9('0x19')](function(_0x23e906){if(_0x23e906[_0x4ab9('0x24')]){return _0x82c95e[_0x4ab9('0x25')]({'messageId':_0x23e906[_0x4ab9('0x24')]});}})[_0x4ab9('0x26')](function(_0x49cd84){logger[_0x4ab9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),_0x4ab9('0x1e'),util[_0x4ab9('0x28')](_0x49cd84,{'showHidden':![],'depth':null}));});}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x1e'),_0x4ab9('0x2a'));}break;case _0x4ab9('0x2b'):var _0x547626=_0x4ab9('0x2c');if(_0x40aed4[_0x4ab9('0x2d')]&&_0x40aed4[_0x4ab9('0x2e')]){var _0x1dacb3={'recipient':[_0x1248c7['phone']],'message':_0x1248c7[_0x4ab9('0xe')],'message_type':_0x40aed4['smsMethod']};if(_0x40aed4[_0x4ab9('0x2f')]&&_0x40aed4[_0x4ab9('0x2f')]!=='SI'){_0x1dacb3[_0x4ab9('0x30')]=_0x40aed4['phone'];}var _0x3c9818={'url':_0x547626+_0x4ab9('0x31')+_0x40aed4[_0x4ab9('0x2d')]+_0x4ab9('0x32')+_0x40aed4[_0x4ab9('0x2e')],'method':_0x4ab9('0x33')};rp(_0x3c9818)[_0x4ab9('0x19')](function(_0x1eedcb){var _0x276a12=_0x1eedcb[_0x4ab9('0x34')](';');var _0x3a23d8={'user_key':_0x276a12[0x0],'session_key':_0x276a12[0x1]};_0x3c9818={'url':_0x547626+_0x4ab9('0x35'),'method':_0x4ab9('0x36'),'headers':{'user_key':_0x3a23d8[_0x4ab9('0x37')],'Session_key':_0x3a23d8[_0x4ab9('0x38')]},'json':!![],'body':_0x1dacb3};return rp(_0x3c9818);})[_0x4ab9('0x19')](function(_0x39f414){if(_0x39f414[_0x4ab9('0x39')]>=0x1){var _0x5bdc76={'messageId':_0x39f414['internal_order_id']};if(_0x40aed4[_0x4ab9('0x2f')]!=='GP'||!_0x40aed4['deliveryReport']){_0x5bdc76['read']=!![];}return _0x82c95e[_0x4ab9('0x25')](_0x5bdc76);}else{return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x2b'),util[_0x4ab9('0x28')](_0x39f414,{'showHidden':![],'depth':null}));}})[_0x4ab9('0x26')](function(_0xc30c09){return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x2b'),util[_0x4ab9('0x28')](_0xc30c09,{'showHidden':![],'depth':null}));});}else{logger[_0x4ab9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),'skebby',_0x4ab9('0x3a'));}break;case _0x4ab9('0x3b'):if(_0x40aed4[_0x4ab9('0x20')]){var _0x1abb96={'recipient':_0x1248c7[_0x4ab9('0x21')],'message':_0x1248c7[_0x4ab9('0xe')],'sender':_0x40aed4[_0x4ab9('0x3c')]||_0x40aed4['phone'],'authorization':_0x40aed4[_0x4ab9('0x20')]};var _0x197fdd={'method':_0x4ab9('0x36'),'uri':_0x4ab9('0x3d'),'body':_0x1abb96,'json':!![]};rp(_0x197fdd)[_0x4ab9('0x19')](function(_0x39b503){var _0x1d7f79={'messageId':_0x39b503[_0x4ab9('0x3e')]};if(!_0x40aed4['deliveryReport']){_0x1d7f79[_0x4ab9('0x3f')]=!![];}return _0x82c95e['update'](_0x1d7f79);})[_0x4ab9('0x26')](function(_0x53b5cb){logger[_0x4ab9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),_0x4ab9('0x3b'),util[_0x4ab9('0x28')](_0x53b5cb,{'showHidden':![],'depth':null}));});}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x3b'),_0x4ab9('0x40'));}break;case _0x4ab9('0x41'):if(_0x40aed4[_0x4ab9('0x2d')]&&_0x40aed4[_0x4ab9('0x2e')]){var _0x1abb96={'messages':[{'source':_0x4ab9('0x42'),'to':_0x1248c7['phone'],'body':_0x1248c7[_0x4ab9('0xe')],'from':_0x40aed4[_0x4ab9('0x3c')]||_0x40aed4['phone']}]};var _0x5d5033=util['format'](_0x4ab9('0x43'),_0x40aed4[_0x4ab9('0x2d')],_0x40aed4[_0x4ab9('0x2e')]);var _0x197fdd={'method':_0x4ab9('0x36'),'uri':_0x4ab9('0x44'),'body':_0x1abb96,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x5d5033)[_0x4ab9('0x45')](_0x4ab9('0x46')))},'json':!![]};rp(_0x197fdd)[_0x4ab9('0x19')](function(_0xc438e4){if(_0xc438e4[_0x4ab9('0x47')]>=0xc8&&_0xc438e4['http_code']<=0xce){if(_0xc438e4['data']&&_0xc438e4[_0x4ab9('0x48')][_0x4ab9('0x49')]>0x0){var _0x267248=_[_0x4ab9('0x4a')](_0xc438e4[_0x4ab9('0x48')]['messages']);var _0x4817a={'messageId':_0x267248[_0x4ab9('0x4b')]};if(!_0x40aed4[_0x4ab9('0x4c')]){_0x4817a['read']=!![];}return _0x82c95e['update'](_0x4817a);}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),'clickSend',util[_0x4ab9('0x28')](_0xc438e4,{'showHidden':![],'depth':null}));}}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x4d'),util[_0x4ab9('0x28')](_0xc438e4,{'showHidden':![],'depth':null}));}})[_0x4ab9('0x26')](function(_0x42aa98){logger[_0x4ab9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),_0x4ab9('0x4d'),util[_0x4ab9('0x28')](_0x42aa98,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4ab9('0x29'),_0x4ab9('0x27'),'clickSend',_0x4ab9('0x3a'));}break;case _0x4ab9('0x4e'):if(_0x40aed4[_0x4ab9('0x4f')]&&_0x40aed4[_0x4ab9('0x20')]){var _0x1abb96={'dst':_0x1248c7[_0x4ab9('0x21')],'text':_0x1248c7['body'],'src':_0x40aed4[_0x4ab9('0x3c')]||_0x40aed4[_0x4ab9('0x21')],'url':_0x40aed4[_0x4ab9('0x50')]+'/api/sms/messages/'+_0x1248c7['id']+'/status?token='+_0x40aed4[_0x4ab9('0x23')]};var _0x5d5033=util[_0x4ab9('0x51')](_0x4ab9('0x43'),_0x40aed4['authId'],_0x40aed4['authToken']);var _0x197fdd={'method':_0x4ab9('0x36'),'uri':util[_0x4ab9('0x51')](_0x4ab9('0x52'),_0x40aed4[_0x4ab9('0x4f')]),'body':_0x1abb96,'headers':{'Authorization':util[_0x4ab9('0x51')]('Basic\x20%s',new Buffer(_0x5d5033)[_0x4ab9('0x45')](_0x4ab9('0x46')))},'json':!![]};rp(_0x197fdd)[_0x4ab9('0x19')](function(_0x205397){var _0xfe3ca0={'messageId':_0x205397[_0x4ab9('0x53')][0x0]};return _0x82c95e[_0x4ab9('0x25')](_0xfe3ca0);})[_0x4ab9('0x26')](function(_0x4b0007){logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),'afterCreate',_0x4ab9('0x4e'),util[_0x4ab9('0x28')](_0x4b0007,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x4e'),_0x4ab9('0x54'));}break;case _0x4ab9('0x55'):if(_0x40aed4[_0x4ab9('0x2d')]&&_0x40aed4[_0x4ab9('0x2e')]){if(_0x40aed4[_0x4ab9('0x56')]){var _0x35f35c={'method':_0x4ab9('0x36'),'uri':_0x40aed4[_0x4ab9('0x56')]+_0x4ab9('0x57'),'body':{'username':_0x40aed4['username'],'password':_0x40aed4['password']},'json':!![]};return rp(_0x35f35c)['then'](function(_0x16c167){var _0x154014={'method':_0x4ab9('0x36'),'uri':_0x40aed4[_0x4ab9('0x56')]+_0x4ab9('0x58'),'body':{'messages':[{'from':_0x40aed4[_0x4ab9('0x21')],'destinations':[{'to':_0x1248c7[_0x4ab9('0x21')]}],'text':_0x1248c7['body'],'notifyUrl':_0x40aed4[_0x4ab9('0x50')]+'/api/sms/messages/'+_0x1248c7['id']+_0x4ab9('0x22')+_0x40aed4[_0x4ab9('0x23')],'notifyContentType':_0x4ab9('0x59'),'callbackData':_0x40aed4['phone']+';'+_0x1248c7[_0x4ab9('0xe')]}]},'headers':{'Authorization':_0x4ab9('0x5a')+_0x16c167[_0x4ab9('0x23')]},'json':!![]};return rp(_0x154014)['then'](function(_0x4c0e9e){if(_0x4c0e9e['messages']){var _0x516e99={'messageId':_0x4c0e9e[_0x4ab9('0x5b')][0x0][_0x4ab9('0xc')]};if(!_0x40aed4[_0x4ab9('0x4c')]){_0x516e99['read']=!![];}return _0x82c95e[_0x4ab9('0x25')](_0x516e99);}else{return logger['error'](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x55'),util[_0x4ab9('0x28')](_0x4c0e9e,{'showHidden':![],'depth':null}));}});})[_0x4ab9('0x26')](function(_0x1ce707){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),'infobip',util['inspect'](_0x1ce707,{'showHidden':![],'depth':null}));});}else{logger[_0x4ab9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),_0x4ab9('0x55'),_0x4ab9('0x5c'));}}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),'afterCreate',_0x4ab9('0x55'),_0x4ab9('0x3a'));}break;case _0x4ab9('0x5d'):var _0x3e6ef5=require(_0x4ab9('0x5e'));if(_0x40aed4['apiKey']){var _0x201b9a={};_0x201b9a['login']=_0x40aed4[_0x4ab9('0x2d')];_0x201b9a[_0x4ab9('0x21')]=_0x1248c7[_0x4ab9('0x21')];_0x201b9a[_0x4ab9('0x30')]=_0x40aed4[_0x4ab9('0x21')];_0x201b9a[_0x4ab9('0x5f')]=_0x1248c7[_0x4ab9('0xe')];_0x201b9a['timestamp']=+new Date();var _0x548a79='';var _0x4f2b2c='';var _0x2c511d=Object[_0x4ab9('0x60')](_0x201b9a);_0x2c511d['sort']();for(var _0x24263a=0x0;_0x24263a<_0x2c511d[_0x4ab9('0x61')];_0x24263a++){if(_0x548a79!=''){_0x548a79+='&';}_0x548a79+=_0x2c511d[_0x24263a]+'='+encodeURIComponent(_0x201b9a[_0x2c511d[_0x24263a]]);_0x4f2b2c+=_0x201b9a[_0x2c511d[_0x24263a]];}_0x4f2b2c+=_0x40aed4['apiKey'];_0x4f2b2c=_0x3e6ef5[_0x4ab9('0x62')](_0x4ab9('0x63'))[_0x4ab9('0x25')](_0x4f2b2c)[_0x4ab9('0x64')](_0x4ab9('0x65'));if(_0x548a79!==''){_0x548a79+='&';}_0x548a79+=_0x4ab9('0x66')+_0x4f2b2c;var _0x3c9818={'method':_0x4ab9('0x33'),'uri':_0x40aed4['baseUrl']+_0x4ab9('0x67')+_0x548a79,'json':!![]};return rp(_0x3c9818)[_0x4ab9('0x19')](function(_0x4d6c20){var _0x20144e=Object[_0x4ab9('0x60')](_0x4d6c20);if(_0x4d6c20[_0x20144e[0x0]]['error']&&parseInt(_0x4d6c20[_0x20144e[0x0]]['error'])===0x0){var _0x15c7ec={'messageId':_0x4d6c20[_0x20144e[0x0]]['id_sms']};if(!_0x40aed4['deliveryReport']){_0x15c7ec['read']=!![];}return _0x82c95e[_0x4ab9('0x25')](_0x15c7ec);}else{return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),'afterCreate',_0x4ab9('0x5d'),util['inspect'](_0x4d6c20[_0x4ab9('0x1a')],{'showHidden':![],'depth':null}));}})[_0x4ab9('0x26')](function(_0x461a59){return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),'csc',util[_0x4ab9('0x28')](_0x461a59,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x5d'),'Missing\x20parameters:\x20apiKey');}break;case _0x4ab9('0x68'):if(_0x40aed4['apiKey']){var _0x31581c={'method':_0x4ab9('0x36'),'uri':_0x4ab9('0x69'),'headers':{'Authorization':_0x40aed4['apiKey']},'body':{'content':_0x1248c7[_0x4ab9('0xe')],'to':[_0x1248c7[_0x4ab9('0x21')]],'from':_0x40aed4['phone'],'binary':![],'clientMessageId':_0x4ab9('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x31581c)[_0x4ab9('0x19')](function(_0x4dd1ec){if(!_0x4dd1ec[_0x4ab9('0x1a')]){var _0x5b4eeb={'messageId':_0x4dd1ec['messages'][0x0]['apiMessageId']};if(!_0x40aed4[_0x4ab9('0x4c')]){_0x5b4eeb[_0x4ab9('0x3f')]=!![];}return _0x82c95e[_0x4ab9('0x25')](_0x5b4eeb);}else{return logger['error'](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x68'),util['inspect'](_0x4dd1ec[_0x4ab9('0x1a')],{'showHidden':![],'depth':null}));}})[_0x4ab9('0x26')](function(_0x9ba2f4){return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),'clickatell',util[_0x4ab9('0x28')](_0x9ba2f4,{'showHidden':![],'depth':null}));});}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),'clickatell',_0x4ab9('0x6b'));}break;case'bandwidth':if(_0x40aed4['username']&&_0x40aed4[_0x4ab9('0x2e')]){var _0x5d5033=util[_0x4ab9('0x51')](_0x4ab9('0x43'),_0x40aed4[_0x4ab9('0x2d')],_0x40aed4['password']);var _0x197fdd={'method':_0x4ab9('0x36'),'uri':_0x4ab9('0x6c')+_0x40aed4['accountId']+'/messages','body':{'to':[_0x1248c7[_0x4ab9('0x21')]],'text':_0x1248c7['body'],'from':_0x40aed4['phone'],'applicationId':_0x40aed4[_0x4ab9('0x6d')]},'headers':{'Authorization':util[_0x4ab9('0x51')]('Basic\x20%s',new Buffer(_0x5d5033)[_0x4ab9('0x45')]('base64'))},'json':!![]};rp(_0x197fdd)['then'](function(_0x39a095){if(_0x39a095['id']){var _0x17b645={'messageId':_0x39a095['id']};return _0x82c95e[_0x4ab9('0x25')](_0x17b645);}else{logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),'afterCreate',_0x4ab9('0x6e'),util[_0x4ab9('0x28')](_0x39a095,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2df2d0){logger['error'](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x6e'),util['inspect'](_0x2df2d0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4ab9('0x6e'),_0x4ab9('0x3a'));}break;case _0x4ab9('0x6f'):if(_0x40aed4[_0x4ab9('0x70')]){var _0xad1fc6={};var _0x3c9818={'method':'POST','uri':_0x4ab9('0x71'),'headers':{'Authorization':_0x4ab9('0x72')+_0x40aed4[_0x4ab9('0x70')],'Content-Type':_0x4ab9('0x59')},'body':{'from':_0x40aed4['phone'],'to':_0x1248c7[_0x4ab9('0x21')],'text':_0x1248c7[_0x4ab9('0xe')]},'json':!![]};return rp(_0x3c9818)[_0x4ab9('0x19')](function(_0x8452b5){if(_0x8452b5[_0x4ab9('0x73')]==0xca){_0xad1fc6[_0x4ab9('0x74')]=_0x8452b5;var _0x5ca8af={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4ab9('0x72')+_0x40aed4[_0x4ab9('0x70')],'Content-Type':'application/json'},'body':{'refid':_0xad1fc6['message'][_0x4ab9('0x75')]},'json':!![]};return rp(_0x5ca8af)[_0x4ab9('0x19')](function(_0x3f3eba){_0xad1fc6['status']=_0x3f3eba;var _0xa6246a={'messageId':_0xad1fc6[_0x4ab9('0x74')]['refid'],'read':!![]};return _0x82c95e[_0x4ab9('0x25')](_0xa6246a);});}else{return logger[_0x4ab9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab9('0x27'),'intelepeer',util['inspect'](_0x8452b5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x130a76){return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),_0x4ab9('0x27'),_0x4ab9('0x6f'),util[_0x4ab9('0x28')](_0x130a76,{'showHidden':![],'depth':null}));});}else{return logger[_0x4ab9('0x1a')](_0x4ab9('0x29'),'afterCreate','intelepeer',_0x4ab9('0x76'));}break;}}})[_0x4ab9('0x77')](function(){_0x95996f();});}else{_0x95996f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index bae433e..9878450 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b10=['SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info'];(function(_0x57228b,_0x1fc843){var _0x2e5cc5=function(_0x6f058a){while(--_0x6f058a){_0x57228b['push'](_0x57228b['shift']());}};_0x2e5cc5(++_0x1fc843);}(_0x3b10,0x181));var _0x03b1=function(_0x1003c5,_0x12ac5b){_0x1003c5=_0x1003c5-0x0;var _0x3a8ac1=_0x3b10[_0x1003c5];return _0x3a8ac1;};'use strict';var _=require(_0x03b1('0x0'));var util=require(_0x03b1('0x1'));var moment=require(_0x03b1('0x2'));var BPromise=require(_0x03b1('0x3'));var rs=require(_0x03b1('0x4'));var fs=require('fs');var Redis=require(_0x03b1('0x5'));var db=require(_0x03b1('0x6'))['db'];var utils=require(_0x03b1('0x7'));var logger=require(_0x03b1('0x8'))(_0x03b1('0x9'));var config=require(_0x03b1('0xa'));var jayson=require(_0x03b1('0xb'));var client=jayson[_0x03b1('0xc')][_0x03b1('0xd')]({'port':0x232a});config[_0x03b1('0xe')]=_[_0x03b1('0xf')](config[_0x03b1('0xe')],{'host':_0x03b1('0x10'),'port':0x18eb});var socket=require(_0x03b1('0x11'))(new Redis(config[_0x03b1('0xe')]));require(_0x03b1('0x12'))['register'](socket);function respondWithRpcPromise(_0x274398,_0x306e8d,_0x1e9d57){return new BPromise(function(_0xdadd13,_0x5585f4){return client[_0x03b1('0x13')](_0x274398,_0x1e9d57)[_0x03b1('0x14')](function(_0x269581){logger[_0x03b1('0x15')](_0x03b1('0x16'),_0x306e8d,_0x03b1('0x17'));logger['debug'](_0x03b1('0x18'),_0x306e8d,'request\x20sent',JSON[_0x03b1('0x19')](_0x269581));if(_0x269581[_0x03b1('0x1a')]){if(_0x269581[_0x03b1('0x1a')][_0x03b1('0x1b')]===0x1f4){logger['error'](_0x03b1('0x16'),_0x306e8d,_0x269581['error'][_0x03b1('0x1c')]);return _0x5585f4(_0x269581[_0x03b1('0x1a')][_0x03b1('0x1c')]);}logger['error'](_0x03b1('0x16'),_0x306e8d,_0x269581['error']['message']);return _0xdadd13(_0x269581[_0x03b1('0x1a')][_0x03b1('0x1c')]);}else{logger['info'](_0x03b1('0x16'),_0x306e8d,_0x03b1('0x17'));_0xdadd13(_0x269581[_0x03b1('0x1d')][_0x03b1('0x1c')]);}})[_0x03b1('0x1e')](function(_0x494413){logger[_0x03b1('0x1a')](_0x03b1('0x16'),_0x306e8d,_0x494413);_0x5585f4(_0x494413);});});}exports[_0x03b1('0x1f')]=function(_0x5928f3){var _0x2a5d41=this;return new Promise(function(_0x3545b9,_0x4aab96){return db[_0x03b1('0x20')][_0x03b1('0x21')](_0x5928f3[_0x03b1('0x22')],{'raw':_0x5928f3[_0x03b1('0x23')]?_0x5928f3[_0x03b1('0x23')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4721b0){logger[_0x03b1('0x15')](_0x03b1('0x1f'),_0x5928f3);logger[_0x03b1('0x24')](_0x03b1('0x1f'),_0x5928f3,JSON['stringify'](_0x4721b0));_0x3545b9(_0x4721b0);})['catch'](function(_0xc38db1){logger[_0x03b1('0x1a')]('CreateSmsMessage',_0xc38db1[_0x03b1('0x1c')],_0x5928f3);_0x4aab96(_0x2a5d41['error'](0x1f4,_0xc38db1[_0x03b1('0x1c')]));});});};
\ No newline at end of file
+var _0x7377=['error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7377,0x12b));var _0x7737=function(_0x50c12f,_0x28e72b){_0x50c12f=_0x50c12f-0x0;var _0x544cb6=_0x7377[_0x50c12f];return _0x544cb6;};'use strict';var _=require(_0x7737('0x0'));var util=require(_0x7737('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7737('0x2'));var fs=require('fs');var Redis=require(_0x7737('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7737('0x4'));var logger=require(_0x7737('0x5'))(_0x7737('0x6'));var config=require('../../config/environment');var jayson=require(_0x7737('0x7'));var client=jayson['client'][_0x7737('0x8')]({'port':0x232a});config[_0x7737('0x9')]=_['defaults'](config[_0x7737('0x9')],{'host':_0x7737('0xa'),'port':0x18eb});var socket=require(_0x7737('0xb'))(new Redis(config[_0x7737('0x9')]));require(_0x7737('0xc'))['register'](socket);function respondWithRpcPromise(_0x40ae4e,_0x34b776,_0x113cf9){return new BPromise(function(_0x9bff4f,_0x5ead79){return client[_0x7737('0xd')](_0x40ae4e,_0x113cf9)[_0x7737('0xe')](function(_0x3a51df){logger['info'](_0x7737('0xf'),_0x34b776,_0x7737('0x10'));logger[_0x7737('0x11')](_0x7737('0x12'),_0x34b776,_0x7737('0x10'),JSON[_0x7737('0x13')](_0x3a51df));if(_0x3a51df[_0x7737('0x14')]){if(_0x3a51df['error'][_0x7737('0x15')]===0x1f4){logger['error'](_0x7737('0xf'),_0x34b776,_0x3a51df[_0x7737('0x14')][_0x7737('0x16')]);return _0x5ead79(_0x3a51df[_0x7737('0x14')][_0x7737('0x16')]);}logger[_0x7737('0x14')](_0x7737('0xf'),_0x34b776,_0x3a51df[_0x7737('0x14')][_0x7737('0x16')]);return _0x9bff4f(_0x3a51df[_0x7737('0x14')][_0x7737('0x16')]);}else{logger['info'](_0x7737('0xf'),_0x34b776,_0x7737('0x10'));_0x9bff4f(_0x3a51df[_0x7737('0x17')][_0x7737('0x16')]);}})['catch'](function(_0x14839e){logger[_0x7737('0x14')](_0x7737('0xf'),_0x34b776,_0x14839e);_0x5ead79(_0x14839e);});});}exports[_0x7737('0x18')]=function(_0x18fa96){var _0x210646=this;return new Promise(function(_0x1bf8af,_0x524cea){return db[_0x7737('0x19')][_0x7737('0x1a')](_0x18fa96[_0x7737('0x1b')],{'raw':_0x18fa96['options']?_0x18fa96[_0x7737('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4d80e9){logger['info'](_0x7737('0x18'),_0x18fa96);logger[_0x7737('0x11')](_0x7737('0x18'),_0x18fa96,JSON[_0x7737('0x13')](_0x4d80e9));_0x1bf8af(_0x4d80e9);})['catch'](function(_0x369b00){logger[_0x7737('0x14')]('CreateSmsMessage',_0x369b00[_0x7737('0x16')],_0x18fa96);_0x524cea(_0x210646['error'](0x1f4,_0x369b00[_0x7737('0x16')]));});});};
\ No newline at end of file
index 87ab629..b1575f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bb9=['length','smsMessage:','update','emit','removeListener','register'];(function(_0x2562c6,_0x5e6df4){var _0x50f5e6=function(_0x20a555){while(--_0x20a555){_0x2562c6['push'](_0x2562c6['shift']());}};_0x50f5e6(++_0x5e6df4);}(_0x2bb9,0x170));var _0x92bb=function(_0x52b0a9,_0x29da5f){_0x52b0a9=_0x52b0a9-0x0;var _0x270232=_0x2bb9[_0x52b0a9];return _0x270232;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove',_0x92bb('0x0')];function createListener(_0x4aba19,_0x31c11d){return function(_0x8129b2){_0x31c11d[_0x92bb('0x1')](_0x4aba19,_0x8129b2);};}function removeListener(_0x27d987,_0x203502){return function(){SmsMessageEvents[_0x92bb('0x2')](_0x27d987,_0x203502);};}exports[_0x92bb('0x3')]=function(_0x1189be){for(var _0x39efcf=0x0,_0x4de869=events[_0x92bb('0x4')];_0x39efcf<_0x4de869;_0x39efcf++){var _0x3d632d=events[_0x39efcf];var _0x2ae10f=createListener(_0x92bb('0x5')+_0x3d632d,_0x1189be);SmsMessageEvents['on'](_0x3d632d,_0x2ae10f);}};
\ No newline at end of file
+var _0x896f=['length','smsMessage:','save','remove','update','emit','removeListener'];(function(_0x7e4e90,_0x4b2115){var _0xcecb5b=function(_0x883e92){while(--_0x883e92){_0x7e4e90['push'](_0x7e4e90['shift']());}};_0xcecb5b(++_0x4b2115);}(_0x896f,0x1b4));var _0xf896=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x896f[_0x2f6f50];return _0x2cf365;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xf896('0x0'),_0xf896('0x1'),_0xf896('0x2')];function createListener(_0x25f660,_0x21e3ec){return function(_0x450677){_0x21e3ec[_0xf896('0x3')](_0x25f660,_0x450677);};}function removeListener(_0x16627a,_0x5d0071){return function(){SmsMessageEvents[_0xf896('0x4')](_0x16627a,_0x5d0071);};}exports['register']=function(_0x1d38b9){for(var _0x22c619=0x0,_0x29eefc=events[_0xf896('0x5')];_0x22c619<_0x29eefc;_0x22c619++){var _0x5ce695=events[_0x22c619];var _0x4262f5=createListener(_0xf896('0x6')+_0x5ce695,_0x1d38b9);SmsMessageEvents['on'](_0x5ce695,_0x4262f5);}};
\ No newline at end of file
index 1b7bd99..6e4877a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33f6=['post','create','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x16f6fd,_0x1afabf){var _0x54af5b=function(_0x545104){while(--_0x545104){_0x16f6fd['push'](_0x16f6fd['shift']());}};_0x54af5b(++_0x1afabf);}(_0x33f6,0x1ae));var _0x633f=function(_0x45c675,_0x22ee5e){_0x45c675=_0x45c675-0x0;var _0x5cc444=_0x33f6[_0x45c675];return _0x5cc444;};'use strict';var multer=require('multer');var util=require(_0x633f('0x0'));var path=require(_0x633f('0x1'));var timeout=require(_0x633f('0x2'));var express=require(_0x633f('0x3'));var router=express[_0x633f('0x4')]();var fs_extra=require(_0x633f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x633f('0x6'));var config=require(_0x633f('0x7'));var controller=require('./smsQueue.controller');router[_0x633f('0x8')]('/',auth[_0x633f('0x9')](),controller[_0x633f('0xa')]);router[_0x633f('0x8')](_0x633f('0xb'),auth['isAuthenticated'](),controller[_0x633f('0xc')]);router[_0x633f('0x8')]('/:id',auth[_0x633f('0x9')](),controller[_0x633f('0xd')]);router[_0x633f('0x8')](_0x633f('0xe'),auth[_0x633f('0x9')](),controller['getMembers']);router['get'](_0x633f('0xf'),auth[_0x633f('0x9')](),controller[_0x633f('0x10')]);router[_0x633f('0x8')](_0x633f('0x11'),auth[_0x633f('0x9')](),controller['getAgents']);router[_0x633f('0x12')]('/',auth['isAuthenticated'](),controller[_0x633f('0x13')]);router[_0x633f('0x12')](_0x633f('0xf'),auth[_0x633f('0x9')](),controller[_0x633f('0x14')]);router[_0x633f('0x12')](_0x633f('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x633f('0x15')](_0x633f('0x16'),auth[_0x633f('0x9')](),controller[_0x633f('0x17')]);router[_0x633f('0x18')](_0x633f('0x16'),auth['isAuthenticated'](),controller[_0x633f('0x19')]);router[_0x633f('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x633f('0x1a')]);router[_0x633f('0x18')](_0x633f('0x11'),auth[_0x633f('0x9')](),controller[_0x633f('0x1b')]);module['exports']=router;
\ No newline at end of file
+var _0xa545=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','destroy','delete','/:id/teams','exports'];(function(_0x481557,_0x3333cc){var _0x102fbf=function(_0x5ae51b){while(--_0x5ae51b){_0x481557['push'](_0x481557['shift']());}};_0x102fbf(++_0x3333cc);}(_0xa545,0x14a));var _0x5a54=function(_0x5382db,_0xb7e59b){_0x5382db=_0x5382db-0x0;var _0x2f4b39=_0xa545[_0x5382db];return _0x2f4b39;};'use strict';var multer=require('multer');var util=require(_0x5a54('0x0'));var path=require('path');var timeout=require(_0x5a54('0x1'));var express=require(_0x5a54('0x2'));var router=express[_0x5a54('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5a54('0x4'));var interaction=require(_0x5a54('0x5'));var config=require(_0x5a54('0x6'));var controller=require(_0x5a54('0x7'));router[_0x5a54('0x8')]('/',auth[_0x5a54('0x9')](),controller[_0x5a54('0xa')]);router[_0x5a54('0x8')](_0x5a54('0xb'),auth['isAuthenticated'](),controller[_0x5a54('0xc')]);router[_0x5a54('0x8')](_0x5a54('0xd'),auth[_0x5a54('0x9')](),controller[_0x5a54('0xe')]);router['get'](_0x5a54('0xf'),auth[_0x5a54('0x9')](),controller[_0x5a54('0x10')]);router[_0x5a54('0x8')]('/:id/teams',auth[_0x5a54('0x9')](),controller[_0x5a54('0x11')]);router['get'](_0x5a54('0x12'),auth[_0x5a54('0x9')](),controller[_0x5a54('0x13')]);router['post']('/',auth[_0x5a54('0x9')](),controller[_0x5a54('0x14')]);router[_0x5a54('0x15')]('/:id/teams',auth[_0x5a54('0x9')](),controller[_0x5a54('0x16')]);router[_0x5a54('0x15')](_0x5a54('0x12'),auth[_0x5a54('0x9')](),controller[_0x5a54('0x17')]);router[_0x5a54('0x18')](_0x5a54('0xd'),auth[_0x5a54('0x9')](),controller[_0x5a54('0x19')]);router['delete'](_0x5a54('0xd'),auth[_0x5a54('0x9')](),controller[_0x5a54('0x1a')]);router[_0x5a54('0x1b')](_0x5a54('0x1c'),auth[_0x5a54('0x9')](),controller['removeTeams']);router['delete'](_0x5a54('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5a54('0x1d')]=router;
\ No newline at end of file
index c5bbd34..c431e99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x872f=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0xac0468,_0x5790e9){var _0x49a1d5=function(_0x4910f5){while(--_0x4910f5){_0xac0468['push'](_0xac0468['shift']());}};_0x49a1d5(++_0x5790e9);}(_0x872f,0xdb));var _0xf872=function(_0x467ef6,_0x932cef){_0x467ef6=_0x467ef6-0x0;var _0x3e4aa2=_0x872f[_0x467ef6];return _0x3e4aa2;};'use strict';var Sequelize=require(_0xf872('0x0'));module[_0xf872('0x1')]={'name':{'type':Sequelize[_0xf872('0x2')],'unique':_0xf872('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf872('0x2')]},'timeout':{'type':Sequelize[_0xf872('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf872('0x5')](_0xf872('0x6'),_0xf872('0x7'),'roundrobin')}};
\ No newline at end of file
+var _0x7012=['roundrobin','sequelize','STRING','ENUM','rrmemory'];(function(_0x8e68a5,_0x2f1360){var _0x3bce80=function(_0x3fe316){while(--_0x3fe316){_0x8e68a5['push'](_0x8e68a5['shift']());}};_0x3bce80(++_0x2f1360);}(_0x7012,0xdd));var _0x2701=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x7012[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0x2701('0x0'));module['exports']={'name':{'type':Sequelize[_0x2701('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2701('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2701('0x2')](_0x2701('0x3'),'beepall',_0x2701('0x4'))}};
\ No newline at end of file
index fe25369..c14b8d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b64=['../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','then','get','SmsQueues','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','SmsQueue','length','includeAll','options','find','catch','body','user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x569abc,_0x5ae096){var _0x274622=function(_0x33f07d){while(--_0x33f07d){_0x569abc['push'](_0x569abc['shift']());}};_0x274622(++_0x5ae096);}(_0x1b64,0x76));var _0x41b6=function(_0xd24358,_0x1a3b6e){_0xd24358=_0xd24358-0x0;var _0x59144d=_0x1b64[_0xd24358];return _0x59144d;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41b6('0x3'));var util=require(_0x41b6('0x4'));var path=require(_0x41b6('0x5'));var sox=require(_0x41b6('0x6'));var csv=require('to-csv');var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41b6('0x9'));var deskjs=require(_0x41b6('0xa'));var toCsv=require(_0x41b6('0xb'));var querystring=require(_0x41b6('0xc'));var Papa=require(_0x41b6('0xd'));var Redis=require(_0x41b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41b6('0xf'));var as=require(_0x41b6('0x10'));var hardwareService=require(_0x41b6('0x11'));var logger=require(_0x41b6('0x12'))(_0x41b6('0x13'));var utils=require(_0x41b6('0x14'));var config=require(_0x41b6('0x15'));var licenseUtil=require(_0x41b6('0x16'));var db=require(_0x41b6('0x17'))['db'];config[_0x41b6('0x18')]=_[_0x41b6('0x19')](config[_0x41b6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x41b6('0x1a'))(new Redis(config[_0x41b6('0x18')]));require(_0x41b6('0x1b'))[_0x41b6('0x1c')](socket);function respondWithStatusCode(_0x549976,_0x1d41e3){_0x1d41e3=_0x1d41e3||0xcc;return function(_0xed7e7f){if(_0xed7e7f){return _0x549976[_0x41b6('0x1d')](_0x1d41e3);}return _0x549976[_0x41b6('0x1e')](_0x1d41e3)[_0x41b6('0x1f')]();};}function respondWithResult(_0x1bd0b0,_0x30f076){_0x30f076=_0x30f076||0xc8;return function(_0x4805de){if(_0x4805de){return _0x1bd0b0[_0x41b6('0x1e')](_0x30f076)[_0x41b6('0x20')](_0x4805de);}};}function respondWithFilteredResult(_0x1b2500,_0x3b5e9e){return function(_0x14a786){if(_0x14a786){var _0x47feb9=typeof _0x3b5e9e['offset']==='undefined'&&typeof _0x3b5e9e['limit']===_0x41b6('0x21');var _0x5a427a=_0x14a786[_0x41b6('0x22')];var _0xbd99c5=_0x47feb9?0x0:_0x3b5e9e[_0x41b6('0x23')];var _0x3da7de=_0x47feb9?_0x14a786[_0x41b6('0x22')]:_0x3b5e9e[_0x41b6('0x23')]+_0x3b5e9e['limit'];var _0x59948c;if(_0x3da7de>=_0x5a427a){_0x3da7de=_0x5a427a;_0x59948c=0xc8;}else{_0x59948c=0xce;}_0x1b2500[_0x41b6('0x1e')](_0x59948c);return _0x1b2500['set'](_0x41b6('0x24'),_0xbd99c5+'-'+_0x3da7de+'/'+_0x5a427a)[_0x41b6('0x20')](_0x14a786);}return null;};}function patchUpdates(_0x309eba){return function(_0x371fff){try{jsonpatch[_0x41b6('0x25')](_0x371fff,_0x309eba,!![]);}catch(_0x1c8e7a){return BPromise[_0x41b6('0x26')](_0x1c8e7a);}return _0x371fff[_0x41b6('0x27')]();};}function saveUpdates(_0x2f8e9c,_0x3e47bf){return function(_0x137942){if(_0x137942){return _0x137942['update'](_0x2f8e9c)[_0x41b6('0x28')](function(_0x2c1290){return _0x2c1290;});}return null;};}function removeEntity(_0x5a984b,_0x7e3269){return function(_0x358872){if(_0x358872){return _0x358872['destroy']()[_0x41b6('0x28')](function(){var _0x454b5f=_0x358872[_0x41b6('0x29')]({'plain':!![]});var _0x5a9624=_0x41b6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x5a9624,'resourceId':_0x454b5f['id']}})['then'](function(){return _0x358872;});})[_0x41b6('0x28')](function(){_0x5a984b[_0x41b6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dee1f,_0x45f9e2){return function(_0x102345){if(!_0x102345){_0x2dee1f[_0x41b6('0x1d')](0x194);}return _0x102345;};}function handleError(_0x3fc486,_0x52d37e){_0x52d37e=_0x52d37e||0x1f4;return function(_0x5a0554){logger[_0x41b6('0x2b')](_0x5a0554[_0x41b6('0x2c')]);if(_0x5a0554[_0x41b6('0x2d')]){delete _0x5a0554['name'];}_0x3fc486[_0x41b6('0x1e')](_0x52d37e)[_0x41b6('0x2e')](_0x5a0554);};}exports['index']=function(_0x27a737,_0x55f9bd){var _0x452c28={},_0x45b2c4={},_0x30542e={'count':0x0,'rows':[]};var _0x2ac3a7=_[_0x41b6('0x2f')](db['SmsQueue'][_0x41b6('0x30')],function(_0x57a206){return{'name':_0x57a206['fieldName'],'type':_0x57a206[_0x41b6('0x31')]['key']};});_0x45b2c4[_0x41b6('0x32')]=_[_0x41b6('0x2f')](_0x2ac3a7,_0x41b6('0x2d'));_0x45b2c4[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x27a737[_0x41b6('0x33')]);_0x45b2c4[_0x41b6('0x35')]=_[_0x41b6('0x36')](_0x45b2c4['model'],_0x45b2c4[_0x41b6('0x33')]);_0x452c28[_0x41b6('0x37')]=_[_0x41b6('0x36')](_0x45b2c4[_0x41b6('0x32')],qs[_0x41b6('0x38')](_0x27a737[_0x41b6('0x33')][_0x41b6('0x38')]));_0x452c28['attributes']=_0x452c28[_0x41b6('0x37')]['length']?_0x452c28['attributes']:_0x45b2c4[_0x41b6('0x32')];if(!_0x27a737[_0x41b6('0x33')][_0x41b6('0x39')](_0x41b6('0x3a'))){_0x452c28[_0x41b6('0x3b')]=qs[_0x41b6('0x3b')](_0x27a737['query'][_0x41b6('0x3b')]);_0x452c28[_0x41b6('0x23')]=qs[_0x41b6('0x23')](_0x27a737[_0x41b6('0x33')][_0x41b6('0x23')]);}_0x452c28[_0x41b6('0x3c')]=qs[_0x41b6('0x3d')](_0x27a737['query'][_0x41b6('0x3d')]);_0x452c28[_0x41b6('0x3e')]=qs[_0x41b6('0x35')](_[_0x41b6('0x3f')](_0x27a737[_0x41b6('0x33')],_0x45b2c4[_0x41b6('0x35')]),_0x2ac3a7);if(_0x27a737[_0x41b6('0x33')][_0x41b6('0x40')]){_0x452c28[_0x41b6('0x3e')]=_[_0x41b6('0x41')](_0x452c28[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x2f')](_0x2ac3a7,function(_0x5de194){if(_0x5de194[_0x41b6('0x31')]!==_0x41b6('0x42')){var _0x146de4={};_0x146de4[_0x5de194[_0x41b6('0x2d')]]={'$like':'%'+_0x27a737[_0x41b6('0x33')][_0x41b6('0x40')]+'%'};return _0x146de4;}})});}_0x452c28=_['merge']({},_0x452c28,_0x27a737['options']);var _0x146f73={'where':_0x452c28[_0x41b6('0x3e')]};return db['SmsQueue']['count'](_0x146f73)[_0x41b6('0x28')](function(_0x2e72ae){_0x30542e[_0x41b6('0x22')]=_0x2e72ae;if(_0x27a737['query']['includeAll']){_0x452c28[_0x41b6('0x43')]=[{'all':!![]}];}return db['SmsQueue'][_0x41b6('0x44')](_0x452c28);})[_0x41b6('0x28')](function(_0x2cee5e){_0x30542e[_0x41b6('0x45')]=_0x2cee5e;return _0x30542e;})[_0x41b6('0x28')](respondWithFilteredResult(_0x55f9bd,_0x452c28))['catch'](handleError(_0x55f9bd,null));};exports[_0x41b6('0x46')]=function(_0x22103e,_0x1c4a3e){var _0x10efd4={'raw':!![],'where':{'id':_0x22103e[_0x41b6('0x47')]['id']}},_0x5f0e3b={};_0x5f0e3b[_0x41b6('0x32')]=_[_0x41b6('0x34')](db[_0x41b6('0x48')][_0x41b6('0x30')]);_0x5f0e3b[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x22103e['query']);_0x5f0e3b[_0x41b6('0x35')]=_['intersection'](_0x5f0e3b[_0x41b6('0x32')],_0x5f0e3b[_0x41b6('0x33')]);_0x10efd4['attributes']=_[_0x41b6('0x36')](_0x5f0e3b[_0x41b6('0x32')],qs['fields'](_0x22103e[_0x41b6('0x33')][_0x41b6('0x38')]));_0x10efd4[_0x41b6('0x37')]=_0x10efd4[_0x41b6('0x37')][_0x41b6('0x49')]?_0x10efd4['attributes']:_0x5f0e3b[_0x41b6('0x32')];if(_0x22103e[_0x41b6('0x33')][_0x41b6('0x4a')]){_0x10efd4['include']=[{'all':!![]}];}_0x10efd4=_[_0x41b6('0x41')]({},_0x10efd4,_0x22103e[_0x41b6('0x4b')]);return db[_0x41b6('0x48')][_0x41b6('0x4c')](_0x10efd4)[_0x41b6('0x28')](handleEntityNotFound(_0x1c4a3e,null))[_0x41b6('0x28')](respondWithResult(_0x1c4a3e,null))[_0x41b6('0x4d')](handleError(_0x1c4a3e,null));};exports['create']=function(_0x565d5d,_0x2384bb){return db['SmsQueue']['create'](_0x565d5d[_0x41b6('0x4e')],{})[_0x41b6('0x28')](function(_0x39d4a0){var _0x21b6c1=_0x565d5d[_0x41b6('0x4f')][_0x41b6('0x29')]({'plain':!![]});if(!_0x21b6c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21b6c1[_0x41b6('0x50')]==='user'){var _0x439833=_0x39d4a0['get']({'plain':!![]});var _0x1d11f5=_0x41b6('0x2a');return db['UserProfileSection'][_0x41b6('0x4c')]({'where':{'name':_0x1d11f5,'userProfileId':_0x21b6c1[_0x41b6('0x51')]},'raw':!![]})[_0x41b6('0x28')](function(_0x26e0e1){if(_0x26e0e1&&_0x26e0e1[_0x41b6('0x52')]===0x0){return db[_0x41b6('0x53')][_0x41b6('0x54')]({'name':_0x439833[_0x41b6('0x2d')],'resourceId':_0x439833['id'],'type':_0x26e0e1[_0x41b6('0x2d')],'sectionId':_0x26e0e1['id']},{})[_0x41b6('0x28')](function(){return _0x39d4a0;});}else{return _0x39d4a0;}})[_0x41b6('0x4d')](function(_0x7d3cfd){logger[_0x41b6('0x2b')](_0x41b6('0x55'),_0x7d3cfd);throw _0x7d3cfd;});}return _0x39d4a0;})[_0x41b6('0x28')](respondWithResult(_0x2384bb,0xc9))[_0x41b6('0x4d')](handleError(_0x2384bb,null));};exports['update']=function(_0x4fe369,_0x5cbb13){if(_0x4fe369[_0x41b6('0x4e')]['id']){delete _0x4fe369[_0x41b6('0x4e')]['id'];}return db[_0x41b6('0x48')][_0x41b6('0x4c')]({'where':{'id':_0x4fe369[_0x41b6('0x47')]['id']}})[_0x41b6('0x28')](handleEntityNotFound(_0x5cbb13,null))[_0x41b6('0x28')](saveUpdates(_0x4fe369[_0x41b6('0x4e')],null))[_0x41b6('0x28')](respondWithResult(_0x5cbb13,null))[_0x41b6('0x4d')](handleError(_0x5cbb13,null));};exports['destroy']=function(_0x5df302,_0x15dcf1){return db[_0x41b6('0x48')][_0x41b6('0x4c')]({'where':{'id':_0x5df302[_0x41b6('0x47')]['id']}})[_0x41b6('0x28')](handleEntityNotFound(_0x15dcf1,null))[_0x41b6('0x28')](removeEntity(_0x15dcf1,null))[_0x41b6('0x4d')](handleError(_0x15dcf1,null));};exports[_0x41b6('0x56')]=function(_0x3db501,_0x4252d5){return db[_0x41b6('0x48')][_0x41b6('0x56')]()['then'](respondWithResult(_0x4252d5,null))[_0x41b6('0x4d')](handleError(_0x4252d5,null));};exports[_0x41b6('0x57')]=function(_0x178089,_0x10fa2d,_0x4e916a){var _0x4f7a14={'raw':!![],'where':{}},_0x1e8ddb={},_0x575806;return db['SmsQueue'][_0x41b6('0x58')]({'where':{'id':_0x178089[_0x41b6('0x47')]['id']}})[_0x41b6('0x28')](handleEntityNotFound(_0x10fa2d,null))[_0x41b6('0x28')](function(_0x2ea2cd){if(_0x2ea2cd){_0x575806=_0x2ea2cd[_0x41b6('0x29')]({'plain':!![]});_0x1e8ddb['model']=_[_0x41b6('0x34')](db[_0x41b6('0x59')]['rawAttributes']);_0x1e8ddb[_0x41b6('0x33')]=_[_0x41b6('0x34')](_0x178089['query']);_0x1e8ddb[_0x41b6('0x35')]=_[_0x41b6('0x36')](_0x1e8ddb[_0x41b6('0x32')],_0x1e8ddb[_0x41b6('0x33')]);_0x4f7a14[_0x41b6('0x37')]=_[_0x41b6('0x36')](_0x1e8ddb[_0x41b6('0x32')],qs[_0x41b6('0x38')](_0x178089[_0x41b6('0x33')][_0x41b6('0x38')]));_0x4f7a14['attributes']=_0x4f7a14[_0x41b6('0x37')][_0x41b6('0x49')]?_0x4f7a14[_0x41b6('0x37')]:_0x1e8ddb[_0x41b6('0x32')];if(!_0x178089[_0x41b6('0x33')][_0x41b6('0x39')]('nolimit')){_0x4f7a14[_0x41b6('0x3b')]=qs[_0x41b6('0x3b')](_0x178089[_0x41b6('0x33')]['limit']);_0x4f7a14['offset']=qs[_0x41b6('0x23')](_0x178089[_0x41b6('0x33')]['offset']);}_0x4f7a14['order']=qs[_0x41b6('0x3d')](_0x178089['query'][_0x41b6('0x3d')]);_0x4f7a14[_0x41b6('0x3e')]=qs[_0x41b6('0x35')](_['pick'](_0x178089[_0x41b6('0x33')],_0x1e8ddb[_0x41b6('0x35')]));_0x4f7a14['where'][_0x41b6('0x5a')]=_0x2ea2cd['id'];if(_0x178089['query'][_0x41b6('0x40')]){_0x4f7a14[_0x41b6('0x3e')]=_[_0x41b6('0x41')](_0x4f7a14[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x2f')](_0x4f7a14[_0x41b6('0x37')],function(_0x55013b){var _0x51ba97={};_0x51ba97[_0x55013b]={'$like':'%'+_0x178089[_0x41b6('0x33')]['filter']+'%'};return _0x51ba97;})});}_0x4f7a14=_[_0x41b6('0x41')]({},_0x4f7a14,_0x178089[_0x41b6('0x4b')]);return db[_0x41b6('0x59')][_0x41b6('0x44')](_0x4f7a14);}})['then'](function(_0x590194){if(_0x590194){return db[_0x41b6('0x5b')][_0x41b6('0x5c')]({'where':{'id':_['map'](_0x590194,_0x41b6('0x5d')),'role':_0x41b6('0x5e')},'attributes':['id','name',_0x41b6('0x5f'),_0x41b6('0x60'),_0x41b6('0x61')]});}})[_0x41b6('0x28')](function(_0x252347){if(_0x252347){return{'count':_0x252347[_0x41b6('0x22')],'rows':_[_0x41b6('0x2f')](_0x252347['rows'],function(_0x419ca0){return{'membername':_0x419ca0[_0x41b6('0x2d')],'UserId':_0x419ca0['id'],'queue_name':_0x575806[_0x41b6('0x2d')],'SmsQueueId':_0x575806['id'],'interface':util[_0x41b6('0x62')](_0x41b6('0x63'),'SIP',_0x419ca0[_0x41b6('0x2d')]),'penalty':0x0,'paused':_0x419ca0[_0x41b6('0x5f')],'createdAt':_0x419ca0[_0x41b6('0x61')],'updatedAt':_0x419ca0[_0x41b6('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x41b6('0x28')](respondWithFilteredResult(_0x10fa2d,_0x4f7a14))[_0x41b6('0x4d')](handleError(_0x10fa2d,null));};exports[_0x41b6('0x64')]=function(_0x1a1a8a,_0x1c57bb,_0x3048bf){var _0x139c80={};var _0x231a0f={};var _0xbcf800;var _0x976f9b;return db['SmsQueue'][_0x41b6('0x58')]({'where':{'id':_0x1a1a8a[_0x41b6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c57bb,null))[_0x41b6('0x28')](function(_0x200e00){if(_0x200e00){_0xbcf800=_0x200e00;_0x231a0f[_0x41b6('0x32')]=_['keys'](db[_0x41b6('0x65')]['rawAttributes']);_0x231a0f[_0x41b6('0x33')]=_['keys'](_0x1a1a8a[_0x41b6('0x33')]);_0x231a0f[_0x41b6('0x35')]=_[_0x41b6('0x36')](_0x231a0f['model'],_0x231a0f[_0x41b6('0x33')]);_0x139c80['attributes']=_[_0x41b6('0x36')](_0x231a0f[_0x41b6('0x32')],qs['fields'](_0x1a1a8a[_0x41b6('0x33')][_0x41b6('0x38')]));_0x139c80[_0x41b6('0x37')]=_0x139c80[_0x41b6('0x37')][_0x41b6('0x49')]?_0x139c80[_0x41b6('0x37')]:_0x231a0f['model'];_0x139c80['order']=qs[_0x41b6('0x3d')](_0x1a1a8a['query']['sort']);_0x139c80[_0x41b6('0x3e')]=qs[_0x41b6('0x35')](_['pick'](_0x1a1a8a[_0x41b6('0x33')],_0x231a0f[_0x41b6('0x35')]));if(_0x1a1a8a[_0x41b6('0x33')][_0x41b6('0x40')]){_0x139c80[_0x41b6('0x3e')]=_['merge'](_0x139c80['where'],{'$or':_[_0x41b6('0x2f')](_0x139c80[_0x41b6('0x37')],function(_0x18cff3){var _0xd12aa4={};_0xd12aa4[_0x18cff3]={'$like':'%'+_0x1a1a8a['query']['filter']+'%'};return _0xd12aa4;})});}_0x139c80=_[_0x41b6('0x41')]({},_0x139c80,_0x1a1a8a[_0x41b6('0x4b')]);return _0xbcf800[_0x41b6('0x64')](_0x139c80);}})[_0x41b6('0x28')](function(_0x55afd3){if(_0x55afd3){_0x976f9b=_0x55afd3['length'];if(!_0x1a1a8a[_0x41b6('0x33')][_0x41b6('0x39')](_0x41b6('0x3a'))){_0x139c80[_0x41b6('0x3b')]=qs[_0x41b6('0x3b')](_0x1a1a8a['query'][_0x41b6('0x3b')]);_0x139c80['offset']=qs[_0x41b6('0x23')](_0x1a1a8a[_0x41b6('0x33')][_0x41b6('0x23')]);}return _0xbcf800['getTeams'](_0x139c80);}})['then'](function(_0x18dfd3){if(_0x18dfd3){return _0x18dfd3?{'count':_0x976f9b,'rows':_0x18dfd3}:null;}})['then'](respondWithResult(_0x1c57bb,null))[_0x41b6('0x4d')](handleError(_0x1c57bb,null));};exports[_0x41b6('0x66')]=function(_0x5e3cfe,_0xd16eb7,_0x3d213a){var _0x2919b2=_0x5e3cfe[_0x41b6('0x4e')]['ids'];return db[_0x41b6('0x65')][_0x41b6('0x44')]({'where':{'id':_0x2919b2},'attributes':['id'],'include':[{'model':db[_0x41b6('0x5b')],'as':_0x41b6('0x67'),'attributes':['id',_0x41b6('0x2d'),_0x41b6('0x68'),_0x41b6('0x69'),'interface'],'raw':!![]}]})[_0x41b6('0x28')](function(_0x30283a){if(_0x30283a){var _0x6afdc3=_['flatMap'](_0x30283a,function(_0x11858){var _0x594a57=_0x11858[_0x41b6('0x29')]({'plain':!![]});return _0x594a57[_0x41b6('0x67')];});return db[_0x41b6('0x48')]['find']({'where':{'id':_0x5e3cfe['params']['id']}})[_0x41b6('0x28')](function(_0x48f083){return db[_0x41b6('0x6a')][_0x41b6('0x6b')](function(_0x9e743d){return _0x48f083['addTeams'](_0x2919b2,{'transaction':_0x9e743d})['then'](function(){return BPromise[_0x41b6('0x6c')](_0x6afdc3,function(_0x57dca5){return db[_0x41b6('0x59')][_0x41b6('0x6d')]({'where':{'UserId':_0x57dca5['id'],'SmsQueueId':_0x5e3cfe[_0x41b6('0x47')]['id']},'transaction':_0x9e743d});});})['then'](function(){_0x6afdc3[_0x41b6('0x6e')](function(_0x5efc75){socket[_0x41b6('0x6f')](_0x41b6('0x70'),{'UserId':_0x5efc75['id'],'SmsQueueId':_0x48f083['id']});});});});});}})[_0x41b6('0x28')](respondWithStatusCode(_0xd16eb7,null))[_0x41b6('0x4d')](handleError(_0xd16eb7,null));};exports['removeTeams']=function(_0x377091,_0x44dac2,_0x6e97dc){return db[_0x41b6('0x65')][_0x41b6('0x44')]({'where':{'id':_0x377091['query'][_0x41b6('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x41b6('0x67'),'attributes':['id'],'raw':!![]}]})[_0x41b6('0x28')](handleEntityNotFound(_0x44dac2,null))[_0x41b6('0x28')](function(_0x4230ce){var _0x4df30d=_[_0x41b6('0x2f')](_0x4230ce,'id');var _0x4ae731=[];var _0x2d24c0=[];var _0x18476c=squel['select']();_0x18476c[_0x41b6('0x72')](_0x41b6('0x73'))[_0x41b6('0x74')](_0x41b6('0x75'),'tq')[_0x41b6('0x76')](_0x41b6('0x77'),'ut',_0x41b6('0x78'))['where'](_0x41b6('0x79'),_0x377091[_0x41b6('0x47')]['id']);for(var _0x30e04c=0x0;_0x30e04c<_0x4230ce[_0x41b6('0x49')];_0x30e04c+=0x1){let _0x1675f8=_0x4230ce[_0x30e04c];for(var _0x509913=0x0;_0x509913<_0x1675f8[_0x41b6('0x67')][_0x41b6('0x49')];_0x509913+=0x1){let _0x476c31=_0x1675f8[_0x41b6('0x67')][_0x509913];var _0x19b547=_0x18476c[_0x41b6('0x7a')]();_0x19b547[_0x41b6('0x3e')](_0x41b6('0x7b'),_0x476c31['id']);_0x2d24c0[_0x41b6('0x7c')](db[_0x41b6('0x6a')][_0x41b6('0x33')](_0x19b547[_0x41b6('0x7d')](),{'type':db['sequelize']['QueryTypes'][_0x41b6('0x7e')]})[_0x41b6('0x28')](function(_0x231453){if(_0x231453['length']===0x1){return _0x476c31['id'];}else{var _0x183a14=_[_0x41b6('0x7f')](_[_0x41b6('0x2f')](_0x231453,_0x41b6('0x80')),function(_0x4c709c){return _[_0x41b6('0x81')](_0x4df30d,_0x4c709c);});if(_0x183a14){return _0x476c31['id'];}}}));}}return BPromise[_0x41b6('0x82')](_0x2d24c0)[_0x41b6('0x28')](function(_0x49753f){_0x4ae731=_(_0x4ae731)['union'](_0x49753f)['compact']()[_0x41b6('0x83')]();return db[_0x41b6('0x48')]['find']({'where':{'id':_0x377091[_0x41b6('0x47')]['id']}})[_0x41b6('0x28')](function(_0x2225d8){return db['sequelize'][_0x41b6('0x6b')](function(_0x345378){return _0x2225d8['removeTeams'](_0x377091[_0x41b6('0x33')]['ids'],{'transaction':_0x345378})[_0x41b6('0x28')](function(){if(!_[_0x41b6('0x84')](_0x4ae731)){return _0x2225d8[_0x41b6('0x85')](_0x4ae731,{'transaction':_0x345378});}})[_0x41b6('0x28')](function(){_0x4ae731['forEach'](function(_0x49ea6a){socket[_0x41b6('0x6f')]('userSmsQueue:remove',{'UserId':_0x49ea6a,'SmsQueueId':_0x2225d8['id']});});});});});});})['then'](respondWithStatusCode(_0x44dac2,null))['catch'](handleError(_0x44dac2,null));};exports[_0x41b6('0x86')]=function(_0x1c9e83,_0x2a5a7d,_0x499078){return db[_0x41b6('0x48')][_0x41b6('0x4c')]({'where':{'id':_0x1c9e83['params']['id']}})[_0x41b6('0x28')](handleEntityNotFound(_0x2a5a7d,null))[_0x41b6('0x28')](function(_0x5bba47){if(_0x5bba47){return _0x5bba47[_0x41b6('0x86')](_0x1c9e83[_0x41b6('0x4e')][_0x41b6('0x71')],_[_0x41b6('0x87')](_0x1c9e83[_0x41b6('0x4e')],[_0x41b6('0x71'),'id'])||{})[_0x41b6('0x88')](function(_0x69d479){for(var _0x29a2a4=0x0;_0x29a2a4<_0x1c9e83[_0x41b6('0x4e')]['ids']['length'];_0x29a2a4+=0x1){socket[_0x41b6('0x6f')](_0x41b6('0x70'),{'UserId':Number(_0x1c9e83[_0x41b6('0x4e')][_0x41b6('0x71')][_0x29a2a4]),'SmsQueueId':Number(_0x1c9e83[_0x41b6('0x47')]['id'])});}return _0x69d479;});}})['then'](respondWithResult(_0x2a5a7d,null))[_0x41b6('0x4d')](handleError(_0x2a5a7d,null));};exports['removeAgents']=function(_0x4faa17,_0x1c8f1d,_0x439930){return db['SmsQueue'][_0x41b6('0x4c')]({'where':{'id':_0x4faa17[_0x41b6('0x47')]['id']}})[_0x41b6('0x28')](handleEntityNotFound(_0x1c8f1d,null))['then'](function(_0x43dfe1){if(_0x43dfe1){return _0x43dfe1['removeAgents'](_0x4faa17['query']['ids'])[_0x41b6('0x28')](function(){if(_[_0x41b6('0x89')](_0x4faa17[_0x41b6('0x33')][_0x41b6('0x71')])){for(var _0x399b60=0x0;_0x399b60<_0x4faa17['query']['ids'][_0x41b6('0x49')];_0x399b60+=0x1){socket[_0x41b6('0x6f')](_0x41b6('0x8a'),{'UserId':Number(_0x4faa17[_0x41b6('0x33')][_0x41b6('0x71')][_0x399b60]),'SmsQueueId':Number(_0x4faa17['params']['id'])});}}else{socket[_0x41b6('0x6f')](_0x41b6('0x8a'),{'UserId':Number(_0x4faa17[_0x41b6('0x33')][_0x41b6('0x71')]),'SmsQueueId':Number(_0x4faa17['params']['id'])});}});}})[_0x41b6('0x28')](respondWithStatusCode(_0x1c8f1d,null))[_0x41b6('0x4d')](handleError(_0x1c8f1d,null));};exports['getAgents']=function(_0x1af08b,_0x2a73db,_0x20ee3f){var _0x244949={};var _0x4798b2={};var _0x41f45a;var _0x5a9f97;return db[_0x41b6('0x48')][_0x41b6('0x58')]({'where':{'id':_0x1af08b[_0x41b6('0x47')]['id']}})[_0x41b6('0x28')](handleEntityNotFound(_0x2a73db,null))[_0x41b6('0x28')](function(_0x1610dc){if(_0x1610dc){_0x41f45a=_0x1610dc;_0x4798b2[_0x41b6('0x32')]=_[_0x41b6('0x34')](db[_0x41b6('0x5b')][_0x41b6('0x30')]);_0x4798b2[_0x41b6('0x33')]=_['keys'](_0x1af08b[_0x41b6('0x33')]);_0x4798b2[_0x41b6('0x35')]=_[_0x41b6('0x36')](_0x4798b2[_0x41b6('0x32')],_0x4798b2[_0x41b6('0x33')]);_0x244949['attributes']=_[_0x41b6('0x36')](_0x4798b2[_0x41b6('0x32')],qs['fields'](_0x1af08b['query'][_0x41b6('0x38')]));_0x244949[_0x41b6('0x37')]=_0x244949['attributes'][_0x41b6('0x49')]?_0x244949[_0x41b6('0x37')]:_0x4798b2['model'];_0x244949[_0x41b6('0x3c')]=qs[_0x41b6('0x3d')](_0x1af08b['query']['sort']);_0x244949['where']=qs[_0x41b6('0x35')](_[_0x41b6('0x3f')](_0x1af08b[_0x41b6('0x33')],_0x4798b2[_0x41b6('0x35')]));if(_0x1af08b[_0x41b6('0x33')][_0x41b6('0x40')]){_0x244949['where']=_['merge'](_0x244949[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x2f')](_0x244949[_0x41b6('0x37')],function(_0x22243a){var _0x2c1fcf={};_0x2c1fcf[_0x22243a]={'$like':'%'+_0x1af08b[_0x41b6('0x33')][_0x41b6('0x40')]+'%'};return _0x2c1fcf;})});}_0x244949=_['merge']({},_0x244949,_0x1af08b[_0x41b6('0x4b')]);return _0x41f45a['getAgents'](_0x244949);}})['then'](function(_0x2c6946){if(_0x2c6946){_0x5a9f97=_0x2c6946[_0x41b6('0x49')];if(!_0x1af08b['query'][_0x41b6('0x39')](_0x41b6('0x3a'))){_0x244949[_0x41b6('0x3b')]=qs['limit'](_0x1af08b[_0x41b6('0x33')][_0x41b6('0x3b')]);_0x244949[_0x41b6('0x23')]=qs[_0x41b6('0x23')](_0x1af08b[_0x41b6('0x33')][_0x41b6('0x23')]);}return _0x41f45a[_0x41b6('0x8b')](_0x244949);}})[_0x41b6('0x28')](function(_0xf4daba){if(_0xf4daba){return _0xf4daba?{'count':_0x5a9f97,'rows':_0xf4daba}:null;}})[_0x41b6('0x28')](respondWithResult(_0x2a73db,null))['catch'](handleError(_0x2a73db,null));};
\ No newline at end of file
+var _0xda72=['emit','removeTeams','ids','User','select','field','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMembers','UserSmsQueue','pick','SmsQueueId','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','smsPause','updatedAt','getTeams','findOne','Team','addTeams','Agents','sequelize','transaction','findOrCreate','forEach'];(function(_0x47894b,_0x57fc57){var _0x4c69a7=function(_0x58cc3d){while(--_0x58cc3d){_0x47894b['push'](_0x47894b['shift']());}};_0x4c69a7(++_0x57fc57);}(_0xda72,0x135));var _0x2da7=function(_0x34be7e,_0x17c9ba){_0x34be7e=_0x34be7e-0x0;var _0x36482c=_0xda72[_0x34be7e];return _0x36482c;};'use strict';var emlformat=require(_0x2da7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2da7('0x1'));var jsonpatch=require(_0x2da7('0x2'));var rp=require(_0x2da7('0x3'));var moment=require(_0x2da7('0x4'));var BPromise=require(_0x2da7('0x5'));var Mustache=require('mustache');var util=require(_0x2da7('0x6'));var path=require(_0x2da7('0x7'));var sox=require(_0x2da7('0x8'));var csv=require('to-csv');var ejs=require(_0x2da7('0x9'));var fs=require('fs');var fs_extra=require(_0x2da7('0xa'));var _=require(_0x2da7('0xb'));var squel=require(_0x2da7('0xc'));var crypto=require('crypto');var jsforce=require(_0x2da7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2da7('0xe'));var querystring=require(_0x2da7('0xf'));var Papa=require(_0x2da7('0x10'));var Redis=require(_0x2da7('0x11'));var authService=require(_0x2da7('0x12'));var qs=require(_0x2da7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2da7('0x14'));var logger=require('../../config/logger')(_0x2da7('0x15'));var utils=require(_0x2da7('0x16'));var config=require(_0x2da7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2da7('0x18'))['db'];config['redis']=_['defaults'](config[_0x2da7('0x19')],{'host':_0x2da7('0x1a'),'port':0x18eb});var socket=require(_0x2da7('0x1b'))(new Redis(config[_0x2da7('0x19')]));require(_0x2da7('0x1c'))[_0x2da7('0x1d')](socket);function respondWithStatusCode(_0x26530a,_0x13a8bd){_0x13a8bd=_0x13a8bd||0xcc;return function(_0xe22217){if(_0xe22217){return _0x26530a[_0x2da7('0x1e')](_0x13a8bd);}return _0x26530a['status'](_0x13a8bd)[_0x2da7('0x1f')]();};}function respondWithResult(_0x4d39ee,_0x326c41){_0x326c41=_0x326c41||0xc8;return function(_0x2be5fa){if(_0x2be5fa){return _0x4d39ee[_0x2da7('0x20')](_0x326c41)[_0x2da7('0x21')](_0x2be5fa);}};}function respondWithFilteredResult(_0x4c7800,_0x7e9e42){return function(_0x3ca519){if(_0x3ca519){var _0x34fdbc=typeof _0x7e9e42[_0x2da7('0x22')]==='undefined'&&typeof _0x7e9e42[_0x2da7('0x23')]===_0x2da7('0x24');var _0x2fb801=_0x3ca519[_0x2da7('0x25')];var _0x4167b4=_0x34fdbc?0x0:_0x7e9e42[_0x2da7('0x22')];var _0x7ccc4b=_0x34fdbc?_0x3ca519[_0x2da7('0x25')]:_0x7e9e42[_0x2da7('0x22')]+_0x7e9e42[_0x2da7('0x23')];var _0x5abe38;if(_0x7ccc4b>=_0x2fb801){_0x7ccc4b=_0x2fb801;_0x5abe38=0xc8;}else{_0x5abe38=0xce;}_0x4c7800[_0x2da7('0x20')](_0x5abe38);return _0x4c7800[_0x2da7('0x26')]('Content-Range',_0x4167b4+'-'+_0x7ccc4b+'/'+_0x2fb801)[_0x2da7('0x21')](_0x3ca519);}return null;};}function patchUpdates(_0x315b6b){return function(_0x32e7f6){try{jsonpatch[_0x2da7('0x27')](_0x32e7f6,_0x315b6b,!![]);}catch(_0x5203ab){return BPromise[_0x2da7('0x28')](_0x5203ab);}return _0x32e7f6[_0x2da7('0x29')]();};}function saveUpdates(_0x1668a2,_0x57df82){return function(_0x148568){if(_0x148568){return _0x148568[_0x2da7('0x2a')](_0x1668a2)['then'](function(_0xfacd07){return _0xfacd07;});}return null;};}function removeEntity(_0x41f146,_0x583ce8){return function(_0x45568d){if(_0x45568d){return _0x45568d['destroy']()[_0x2da7('0x2b')](function(){var _0x1062c1=_0x45568d[_0x2da7('0x2c')]({'plain':!![]});var _0x40cea9=_0x2da7('0x2d');return db[_0x2da7('0x2e')]['destroy']({'where':{'type':_0x40cea9,'resourceId':_0x1062c1['id']}})[_0x2da7('0x2b')](function(){return _0x45568d;});})['then'](function(){_0x41f146[_0x2da7('0x20')](0xcc)[_0x2da7('0x1f')]();});}};}function handleEntityNotFound(_0x8ac33a,_0x166046){return function(_0x798b4a){if(!_0x798b4a){_0x8ac33a[_0x2da7('0x1e')](0x194);}return _0x798b4a;};}function handleError(_0x307282,_0x4339ce){_0x4339ce=_0x4339ce||0x1f4;return function(_0xf4dd0f){logger['error'](_0xf4dd0f[_0x2da7('0x2f')]);if(_0xf4dd0f[_0x2da7('0x30')]){delete _0xf4dd0f[_0x2da7('0x30')];}_0x307282[_0x2da7('0x20')](_0x4339ce)[_0x2da7('0x31')](_0xf4dd0f);};}exports[_0x2da7('0x32')]=function(_0x45b237,_0x1d0ee1){var _0x399fa3={},_0x2bda6c={},_0x559399={'count':0x0,'rows':[]};var _0x36ec3d=_[_0x2da7('0x33')](db[_0x2da7('0x34')]['rawAttributes'],function(_0x37198e){return{'name':_0x37198e[_0x2da7('0x35')],'type':_0x37198e[_0x2da7('0x36')]['key']};});_0x2bda6c[_0x2da7('0x37')]=_['map'](_0x36ec3d,_0x2da7('0x30'));_0x2bda6c['query']=_[_0x2da7('0x38')](_0x45b237[_0x2da7('0x39')]);_0x2bda6c['filters']=_[_0x2da7('0x3a')](_0x2bda6c[_0x2da7('0x37')],_0x2bda6c[_0x2da7('0x39')]);_0x399fa3['attributes']=_['intersection'](_0x2bda6c[_0x2da7('0x37')],qs[_0x2da7('0x3b')](_0x45b237[_0x2da7('0x39')][_0x2da7('0x3b')]));_0x399fa3['attributes']=_0x399fa3[_0x2da7('0x3c')][_0x2da7('0x3d')]?_0x399fa3[_0x2da7('0x3c')]:_0x2bda6c[_0x2da7('0x37')];if(!_0x45b237[_0x2da7('0x39')][_0x2da7('0x3e')](_0x2da7('0x3f'))){_0x399fa3['limit']=qs['limit'](_0x45b237[_0x2da7('0x39')]['limit']);_0x399fa3[_0x2da7('0x22')]=qs[_0x2da7('0x22')](_0x45b237[_0x2da7('0x39')][_0x2da7('0x22')]);}_0x399fa3[_0x2da7('0x40')]=qs['sort'](_0x45b237[_0x2da7('0x39')][_0x2da7('0x41')]);_0x399fa3[_0x2da7('0x42')]=qs['filters'](_['pick'](_0x45b237[_0x2da7('0x39')],_0x2bda6c[_0x2da7('0x43')]),_0x36ec3d);if(_0x45b237['query']['filter']){_0x399fa3[_0x2da7('0x42')]=_[_0x2da7('0x44')](_0x399fa3[_0x2da7('0x42')],{'$or':_['map'](_0x36ec3d,function(_0x5d328d){if(_0x5d328d[_0x2da7('0x36')]!==_0x2da7('0x45')){var _0x3b4f47={};_0x3b4f47[_0x5d328d[_0x2da7('0x30')]]={'$like':'%'+_0x45b237[_0x2da7('0x39')][_0x2da7('0x46')]+'%'};return _0x3b4f47;}})});}_0x399fa3=_[_0x2da7('0x44')]({},_0x399fa3,_0x45b237[_0x2da7('0x47')]);var _0x50376e={'where':_0x399fa3[_0x2da7('0x42')]};return db['SmsQueue']['count'](_0x50376e)['then'](function(_0x209169){_0x559399[_0x2da7('0x25')]=_0x209169;if(_0x45b237[_0x2da7('0x39')][_0x2da7('0x48')]){_0x399fa3['include']=[{'all':!![]}];}return db[_0x2da7('0x34')][_0x2da7('0x49')](_0x399fa3);})['then'](function(_0x3e83a9){_0x559399['rows']=_0x3e83a9;return _0x559399;})['then'](respondWithFilteredResult(_0x1d0ee1,_0x399fa3))[_0x2da7('0x4a')](handleError(_0x1d0ee1,null));};exports[_0x2da7('0x4b')]=function(_0x13eb58,_0x335e58){var _0x32bca7={'raw':!![],'where':{'id':_0x13eb58[_0x2da7('0x4c')]['id']}},_0x33e26c={};_0x33e26c[_0x2da7('0x37')]=_['keys'](db['SmsQueue'][_0x2da7('0x4d')]);_0x33e26c['query']=_['keys'](_0x13eb58['query']);_0x33e26c['filters']=_['intersection'](_0x33e26c[_0x2da7('0x37')],_0x33e26c[_0x2da7('0x39')]);_0x32bca7[_0x2da7('0x3c')]=_[_0x2da7('0x3a')](_0x33e26c[_0x2da7('0x37')],qs['fields'](_0x13eb58[_0x2da7('0x39')]['fields']));_0x32bca7[_0x2da7('0x3c')]=_0x32bca7[_0x2da7('0x3c')]['length']?_0x32bca7[_0x2da7('0x3c')]:_0x33e26c[_0x2da7('0x37')];if(_0x13eb58[_0x2da7('0x39')][_0x2da7('0x48')]){_0x32bca7[_0x2da7('0x4e')]=[{'all':!![]}];}_0x32bca7=_['merge']({},_0x32bca7,_0x13eb58['options']);return db[_0x2da7('0x34')][_0x2da7('0x4f')](_0x32bca7)['then'](handleEntityNotFound(_0x335e58,null))[_0x2da7('0x2b')](respondWithResult(_0x335e58,null))[_0x2da7('0x4a')](handleError(_0x335e58,null));};exports[_0x2da7('0x50')]=function(_0x495436,_0x45b04f){return db[_0x2da7('0x34')]['create'](_0x495436[_0x2da7('0x51')],{})[_0x2da7('0x2b')](function(_0x52a6b8){var _0x22cf08=_0x495436['user']['get']({'plain':!![]});if(!_0x22cf08)throw new Error(_0x2da7('0x52'));if(_0x22cf08['role']===_0x2da7('0x53')){var _0x47810f=_0x52a6b8[_0x2da7('0x2c')]({'plain':!![]});var _0x4340a3=_0x2da7('0x2d');return db['UserProfileSection'][_0x2da7('0x4f')]({'where':{'name':_0x4340a3,'userProfileId':_0x22cf08[_0x2da7('0x54')]},'raw':!![]})[_0x2da7('0x2b')](function(_0x532a99){if(_0x532a99&&_0x532a99[_0x2da7('0x55')]===0x0){return db[_0x2da7('0x2e')][_0x2da7('0x50')]({'name':_0x47810f[_0x2da7('0x30')],'resourceId':_0x47810f['id'],'type':_0x532a99[_0x2da7('0x30')],'sectionId':_0x532a99['id']},{})[_0x2da7('0x2b')](function(){return _0x52a6b8;});}else{return _0x52a6b8;}})[_0x2da7('0x4a')](function(_0x53df74){logger[_0x2da7('0x56')](_0x2da7('0x57'),_0x53df74);throw _0x53df74;});}return _0x52a6b8;})[_0x2da7('0x2b')](respondWithResult(_0x45b04f,0xc9))[_0x2da7('0x4a')](handleError(_0x45b04f,null));};exports['update']=function(_0x478a03,_0x59bc83){if(_0x478a03[_0x2da7('0x51')]['id']){delete _0x478a03['body']['id'];}return db[_0x2da7('0x34')][_0x2da7('0x4f')]({'where':{'id':_0x478a03['params']['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x59bc83,null))[_0x2da7('0x2b')](saveUpdates(_0x478a03[_0x2da7('0x51')],null))[_0x2da7('0x2b')](respondWithResult(_0x59bc83,null))[_0x2da7('0x4a')](handleError(_0x59bc83,null));};exports[_0x2da7('0x58')]=function(_0x44bab1,_0x3b8384){return db['SmsQueue'][_0x2da7('0x4f')]({'where':{'id':_0x44bab1[_0x2da7('0x4c')]['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x3b8384,null))[_0x2da7('0x2b')](removeEntity(_0x3b8384,null))[_0x2da7('0x4a')](handleError(_0x3b8384,null));};exports['describe']=function(_0x20b3e5,_0x5eb0c0){return db['SmsQueue']['describe']()[_0x2da7('0x2b')](respondWithResult(_0x5eb0c0,null))[_0x2da7('0x4a')](handleError(_0x5eb0c0,null));};exports[_0x2da7('0x59')]=function(_0x37bbe9,_0x513916,_0x4214c8){var _0x48ba07={'raw':!![],'where':{}},_0x380cf4={},_0x386d63;return db[_0x2da7('0x34')]['findOne']({'where':{'id':_0x37bbe9['params']['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x513916,null))[_0x2da7('0x2b')](function(_0x339d35){if(_0x339d35){_0x386d63=_0x339d35['get']({'plain':!![]});_0x380cf4[_0x2da7('0x37')]=_[_0x2da7('0x38')](db[_0x2da7('0x5a')][_0x2da7('0x4d')]);_0x380cf4[_0x2da7('0x39')]=_[_0x2da7('0x38')](_0x37bbe9[_0x2da7('0x39')]);_0x380cf4[_0x2da7('0x43')]=_['intersection'](_0x380cf4['model'],_0x380cf4[_0x2da7('0x39')]);_0x48ba07[_0x2da7('0x3c')]=_[_0x2da7('0x3a')](_0x380cf4[_0x2da7('0x37')],qs[_0x2da7('0x3b')](_0x37bbe9[_0x2da7('0x39')][_0x2da7('0x3b')]));_0x48ba07['attributes']=_0x48ba07[_0x2da7('0x3c')]['length']?_0x48ba07[_0x2da7('0x3c')]:_0x380cf4['model'];if(!_0x37bbe9[_0x2da7('0x39')][_0x2da7('0x3e')](_0x2da7('0x3f'))){_0x48ba07['limit']=qs[_0x2da7('0x23')](_0x37bbe9['query'][_0x2da7('0x23')]);_0x48ba07[_0x2da7('0x22')]=qs[_0x2da7('0x22')](_0x37bbe9[_0x2da7('0x39')][_0x2da7('0x22')]);}_0x48ba07[_0x2da7('0x40')]=qs[_0x2da7('0x41')](_0x37bbe9[_0x2da7('0x39')][_0x2da7('0x41')]);_0x48ba07['where']=qs[_0x2da7('0x43')](_[_0x2da7('0x5b')](_0x37bbe9[_0x2da7('0x39')],_0x380cf4['filters']));_0x48ba07[_0x2da7('0x42')][_0x2da7('0x5c')]=_0x339d35['id'];if(_0x37bbe9[_0x2da7('0x39')][_0x2da7('0x46')]){_0x48ba07[_0x2da7('0x42')]=_['merge'](_0x48ba07[_0x2da7('0x42')],{'$or':_[_0x2da7('0x33')](_0x48ba07['attributes'],function(_0x45ed9c){var _0xbdc5c9={};_0xbdc5c9[_0x45ed9c]={'$like':'%'+_0x37bbe9[_0x2da7('0x39')][_0x2da7('0x46')]+'%'};return _0xbdc5c9;})});}_0x48ba07=_[_0x2da7('0x44')]({},_0x48ba07,_0x37bbe9['options']);return db[_0x2da7('0x5a')]['findAll'](_0x48ba07);}})[_0x2da7('0x2b')](function(_0x25a0bb){if(_0x25a0bb){return db['User'][_0x2da7('0x5d')]({'where':{'id':_[_0x2da7('0x33')](_0x25a0bb,_0x2da7('0x5e')),'role':'agent'},'attributes':['id',_0x2da7('0x30'),'smsPause','updatedAt',_0x2da7('0x5f')]});}})[_0x2da7('0x2b')](function(_0x2a49c4){if(_0x2a49c4){return{'count':_0x2a49c4[_0x2da7('0x25')],'rows':_[_0x2da7('0x33')](_0x2a49c4[_0x2da7('0x60')],function(_0x4f334c){return{'membername':_0x4f334c[_0x2da7('0x30')],'UserId':_0x4f334c['id'],'queue_name':_0x386d63[_0x2da7('0x30')],'SmsQueueId':_0x386d63['id'],'interface':util[_0x2da7('0x61')](_0x2da7('0x62'),_0x2da7('0x63'),_0x4f334c[_0x2da7('0x30')]),'penalty':0x0,'paused':_0x4f334c[_0x2da7('0x64')],'createdAt':_0x4f334c[_0x2da7('0x5f')],'updatedAt':_0x4f334c[_0x2da7('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2da7('0x2b')](respondWithFilteredResult(_0x513916,_0x48ba07))['catch'](handleError(_0x513916,null));};exports[_0x2da7('0x66')]=function(_0x109898,_0x26043d,_0x5d3976){var _0x2ef0dd={};var _0x3e2714={};var _0x5032a5;var _0x15ebe8;return db[_0x2da7('0x34')][_0x2da7('0x67')]({'where':{'id':_0x109898['params']['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x26043d,null))[_0x2da7('0x2b')](function(_0x17c769){if(_0x17c769){_0x5032a5=_0x17c769;_0x3e2714['model']=_[_0x2da7('0x38')](db[_0x2da7('0x68')][_0x2da7('0x4d')]);_0x3e2714['query']=_[_0x2da7('0x38')](_0x109898[_0x2da7('0x39')]);_0x3e2714[_0x2da7('0x43')]=_[_0x2da7('0x3a')](_0x3e2714[_0x2da7('0x37')],_0x3e2714[_0x2da7('0x39')]);_0x2ef0dd[_0x2da7('0x3c')]=_[_0x2da7('0x3a')](_0x3e2714[_0x2da7('0x37')],qs['fields'](_0x109898[_0x2da7('0x39')][_0x2da7('0x3b')]));_0x2ef0dd['attributes']=_0x2ef0dd['attributes'][_0x2da7('0x3d')]?_0x2ef0dd[_0x2da7('0x3c')]:_0x3e2714[_0x2da7('0x37')];_0x2ef0dd[_0x2da7('0x40')]=qs['sort'](_0x109898[_0x2da7('0x39')][_0x2da7('0x41')]);_0x2ef0dd[_0x2da7('0x42')]=qs[_0x2da7('0x43')](_[_0x2da7('0x5b')](_0x109898['query'],_0x3e2714[_0x2da7('0x43')]));if(_0x109898['query'][_0x2da7('0x46')]){_0x2ef0dd[_0x2da7('0x42')]=_[_0x2da7('0x44')](_0x2ef0dd[_0x2da7('0x42')],{'$or':_[_0x2da7('0x33')](_0x2ef0dd[_0x2da7('0x3c')],function(_0x4538b0){var _0x355e88={};_0x355e88[_0x4538b0]={'$like':'%'+_0x109898['query'][_0x2da7('0x46')]+'%'};return _0x355e88;})});}_0x2ef0dd=_[_0x2da7('0x44')]({},_0x2ef0dd,_0x109898[_0x2da7('0x47')]);return _0x5032a5[_0x2da7('0x66')](_0x2ef0dd);}})[_0x2da7('0x2b')](function(_0x433841){if(_0x433841){_0x15ebe8=_0x433841[_0x2da7('0x3d')];if(!_0x109898[_0x2da7('0x39')][_0x2da7('0x3e')](_0x2da7('0x3f'))){_0x2ef0dd[_0x2da7('0x23')]=qs[_0x2da7('0x23')](_0x109898[_0x2da7('0x39')][_0x2da7('0x23')]);_0x2ef0dd[_0x2da7('0x22')]=qs[_0x2da7('0x22')](_0x109898['query'][_0x2da7('0x22')]);}return _0x5032a5[_0x2da7('0x66')](_0x2ef0dd);}})[_0x2da7('0x2b')](function(_0x2f6fb6){if(_0x2f6fb6){return _0x2f6fb6?{'count':_0x15ebe8,'rows':_0x2f6fb6}:null;}})[_0x2da7('0x2b')](respondWithResult(_0x26043d,null))[_0x2da7('0x4a')](handleError(_0x26043d,null));};exports[_0x2da7('0x69')]=function(_0x3d0d09,_0x10cace,_0x2c31e4){var _0x2b0538=_0x3d0d09[_0x2da7('0x51')]['ids'];return db[_0x2da7('0x68')][_0x2da7('0x49')]({'where':{'id':_0x2b0538},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2da7('0x6a'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x2da7('0x2b')](function(_0x5288e1){if(_0x5288e1){var _0x38f412=_['flatMap'](_0x5288e1,function(_0x54f3ae){var _0xdc4fe2=_0x54f3ae[_0x2da7('0x2c')]({'plain':!![]});return _0xdc4fe2[_0x2da7('0x6a')];});return db[_0x2da7('0x34')][_0x2da7('0x4f')]({'where':{'id':_0x3d0d09['params']['id']}})[_0x2da7('0x2b')](function(_0x301762){return db[_0x2da7('0x6b')][_0x2da7('0x6c')](function(_0x301137){return _0x301762[_0x2da7('0x69')](_0x2b0538,{'transaction':_0x301137})[_0x2da7('0x2b')](function(){return BPromise['each'](_0x38f412,function(_0x468b85){return db[_0x2da7('0x5a')][_0x2da7('0x6d')]({'where':{'UserId':_0x468b85['id'],'SmsQueueId':_0x3d0d09[_0x2da7('0x4c')]['id']},'transaction':_0x301137});});})[_0x2da7('0x2b')](function(){_0x38f412[_0x2da7('0x6e')](function(_0x58dd7e){socket[_0x2da7('0x6f')]('userSmsQueue:save',{'UserId':_0x58dd7e['id'],'SmsQueueId':_0x301762['id']});});});});});}})[_0x2da7('0x2b')](respondWithStatusCode(_0x10cace,null))['catch'](handleError(_0x10cace,null));};exports[_0x2da7('0x70')]=function(_0x3da901,_0x421c1c,_0x241d8f){return db[_0x2da7('0x68')][_0x2da7('0x49')]({'where':{'id':_0x3da901[_0x2da7('0x39')][_0x2da7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x2da7('0x72')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x421c1c,null))['then'](function(_0x9ba865){var _0x152a50=_[_0x2da7('0x33')](_0x9ba865,'id');var _0x3b713a=[];var _0xdc9735=[];var _0x3752cd=squel[_0x2da7('0x73')]();_0x3752cd[_0x2da7('0x74')]('tq.TeamId')[_0x2da7('0x75')](_0x2da7('0x76'),'tq')['join']('user_has_teams','ut',_0x2da7('0x77'))['where'](_0x2da7('0x78'),_0x3da901[_0x2da7('0x4c')]['id']);for(var _0x233f94=0x0;_0x233f94<_0x9ba865[_0x2da7('0x3d')];_0x233f94+=0x1){let _0x5b388a=_0x9ba865[_0x233f94];for(var _0xbb0e3e=0x0;_0xbb0e3e<_0x5b388a[_0x2da7('0x6a')]['length'];_0xbb0e3e+=0x1){let _0x4d2314=_0x5b388a['Agents'][_0xbb0e3e];var _0x43b642=_0x3752cd[_0x2da7('0x79')]();_0x43b642[_0x2da7('0x42')](_0x2da7('0x7a'),_0x4d2314['id']);_0xdc9735['push'](db[_0x2da7('0x6b')]['query'](_0x43b642[_0x2da7('0x7b')](),{'type':db[_0x2da7('0x6b')][_0x2da7('0x7c')][_0x2da7('0x7d')]})[_0x2da7('0x2b')](function(_0x3a1e69){if(_0x3a1e69['length']===0x1){return _0x4d2314['id'];}else{var _0x29c381=_[_0x2da7('0x7e')](_[_0x2da7('0x33')](_0x3a1e69,'TeamId'),function(_0x4dafa9){return _[_0x2da7('0x7f')](_0x152a50,_0x4dafa9);});if(_0x29c381){return _0x4d2314['id'];}}}));}}return BPromise[_0x2da7('0x80')](_0xdc9735)[_0x2da7('0x2b')](function(_0x34424c){_0x3b713a=_(_0x3b713a)[_0x2da7('0x81')](_0x34424c)[_0x2da7('0x82')]()[_0x2da7('0x83')]();return db['SmsQueue']['find']({'where':{'id':_0x3da901[_0x2da7('0x4c')]['id']}})[_0x2da7('0x2b')](function(_0x2862ab){return db[_0x2da7('0x6b')]['transaction'](function(_0x4ed7b2){return _0x2862ab['removeTeams'](_0x3da901[_0x2da7('0x39')]['ids'],{'transaction':_0x4ed7b2})[_0x2da7('0x2b')](function(){if(!_[_0x2da7('0x84')](_0x3b713a)){return _0x2862ab['removeAgents'](_0x3b713a,{'transaction':_0x4ed7b2});}})['then'](function(){_0x3b713a[_0x2da7('0x6e')](function(_0x34a885){socket[_0x2da7('0x6f')](_0x2da7('0x85'),{'UserId':_0x34a885,'SmsQueueId':_0x2862ab['id']});});});});});});})[_0x2da7('0x2b')](respondWithStatusCode(_0x421c1c,null))[_0x2da7('0x4a')](handleError(_0x421c1c,null));};exports[_0x2da7('0x86')]=function(_0x345302,_0x406163,_0xbadd1b){return db[_0x2da7('0x34')][_0x2da7('0x4f')]({'where':{'id':_0x345302[_0x2da7('0x4c')]['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x406163,null))[_0x2da7('0x2b')](function(_0x591424){if(_0x591424){return _0x591424['addAgents'](_0x345302[_0x2da7('0x51')]['ids'],_[_0x2da7('0x87')](_0x345302[_0x2da7('0x51')],['ids','id'])||{})[_0x2da7('0x88')](function(_0xe5e003){for(var _0x34ef6f=0x0;_0x34ef6f<_0x345302['body'][_0x2da7('0x71')][_0x2da7('0x3d')];_0x34ef6f+=0x1){socket[_0x2da7('0x6f')](_0x2da7('0x89'),{'UserId':Number(_0x345302['body'][_0x2da7('0x71')][_0x34ef6f]),'SmsQueueId':Number(_0x345302['params']['id'])});}return _0xe5e003;});}})[_0x2da7('0x2b')](respondWithResult(_0x406163,null))[_0x2da7('0x4a')](handleError(_0x406163,null));};exports[_0x2da7('0x8a')]=function(_0x5cb0a9,_0x552ed9,_0x5eda6f){return db[_0x2da7('0x34')]['find']({'where':{'id':_0x5cb0a9[_0x2da7('0x4c')]['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x552ed9,null))['then'](function(_0x174287){if(_0x174287){return _0x174287[_0x2da7('0x8a')](_0x5cb0a9[_0x2da7('0x39')]['ids'])[_0x2da7('0x2b')](function(){if(_['isArray'](_0x5cb0a9[_0x2da7('0x39')]['ids'])){for(var _0x43e35f=0x0;_0x43e35f<_0x5cb0a9['query'][_0x2da7('0x71')][_0x2da7('0x3d')];_0x43e35f+=0x1){socket[_0x2da7('0x6f')](_0x2da7('0x85'),{'UserId':Number(_0x5cb0a9[_0x2da7('0x39')]['ids'][_0x43e35f]),'SmsQueueId':Number(_0x5cb0a9[_0x2da7('0x4c')]['id'])});}}else{socket['emit'](_0x2da7('0x85'),{'UserId':Number(_0x5cb0a9[_0x2da7('0x39')][_0x2da7('0x71')]),'SmsQueueId':Number(_0x5cb0a9['params']['id'])});}});}})[_0x2da7('0x2b')](respondWithStatusCode(_0x552ed9,null))[_0x2da7('0x4a')](handleError(_0x552ed9,null));};exports[_0x2da7('0x8b')]=function(_0x476ad2,_0x46babd,_0x35f89c){var _0x1d15a5={};var _0x5a7969={};var _0x583bb4;var _0x1496e1;return db[_0x2da7('0x34')][_0x2da7('0x67')]({'where':{'id':_0x476ad2[_0x2da7('0x4c')]['id']}})[_0x2da7('0x2b')](handleEntityNotFound(_0x46babd,null))[_0x2da7('0x2b')](function(_0xc3bc02){if(_0xc3bc02){_0x583bb4=_0xc3bc02;_0x5a7969[_0x2da7('0x37')]=_[_0x2da7('0x38')](db[_0x2da7('0x72')][_0x2da7('0x4d')]);_0x5a7969[_0x2da7('0x39')]=_[_0x2da7('0x38')](_0x476ad2['query']);_0x5a7969['filters']=_[_0x2da7('0x3a')](_0x5a7969[_0x2da7('0x37')],_0x5a7969['query']);_0x1d15a5[_0x2da7('0x3c')]=_[_0x2da7('0x3a')](_0x5a7969['model'],qs[_0x2da7('0x3b')](_0x476ad2[_0x2da7('0x39')]['fields']));_0x1d15a5[_0x2da7('0x3c')]=_0x1d15a5[_0x2da7('0x3c')]['length']?_0x1d15a5['attributes']:_0x5a7969[_0x2da7('0x37')];_0x1d15a5['order']=qs[_0x2da7('0x41')](_0x476ad2[_0x2da7('0x39')][_0x2da7('0x41')]);_0x1d15a5['where']=qs['filters'](_['pick'](_0x476ad2[_0x2da7('0x39')],_0x5a7969['filters']));if(_0x476ad2[_0x2da7('0x39')]['filter']){_0x1d15a5[_0x2da7('0x42')]=_[_0x2da7('0x44')](_0x1d15a5[_0x2da7('0x42')],{'$or':_[_0x2da7('0x33')](_0x1d15a5[_0x2da7('0x3c')],function(_0x1b6006){var _0x1e9b1e={};_0x1e9b1e[_0x1b6006]={'$like':'%'+_0x476ad2[_0x2da7('0x39')]['filter']+'%'};return _0x1e9b1e;})});}_0x1d15a5=_[_0x2da7('0x44')]({},_0x1d15a5,_0x476ad2['options']);return _0x583bb4[_0x2da7('0x8b')](_0x1d15a5);}})[_0x2da7('0x2b')](function(_0x16aace){if(_0x16aace){_0x1496e1=_0x16aace['length'];if(!_0x476ad2[_0x2da7('0x39')][_0x2da7('0x3e')](_0x2da7('0x3f'))){_0x1d15a5['limit']=qs[_0x2da7('0x23')](_0x476ad2[_0x2da7('0x39')]['limit']);_0x1d15a5[_0x2da7('0x22')]=qs[_0x2da7('0x22')](_0x476ad2['query'][_0x2da7('0x22')]);}return _0x583bb4[_0x2da7('0x8b')](_0x1d15a5);}})[_0x2da7('0x2b')](function(_0x469384){if(_0x469384){return _0x469384?{'count':_0x1496e1,'rows':_0x469384}:null;}})[_0x2da7('0x2b')](respondWithResult(_0x46babd,null))[_0x2da7('0x4a')](handleError(_0x46babd,null));};
\ No newline at end of file
index dd3f52f..4f6ac13 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8111=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','save'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8111,0x146));var _0x1811=function(_0x1c752f,_0x5e3bbd){_0x1c752f=_0x1c752f-0x0;var _0x118ff9=_0x8111[_0x1c752f];return _0x118ff9;};'use strict';var EventEmitter=require(_0x1811('0x0'));var SmsQueue=require(_0x1811('0x1'))['db'][_0x1811('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1811('0x3'),'afterUpdate':_0x1811('0x4'),'afterDestroy':_0x1811('0x5')};function emitEvent(_0x2bcd4e){return function(_0x61eb24,_0x2d15b5,_0x4da077){SmsQueueEvents[_0x1811('0x6')](_0x2bcd4e+':'+_0x61eb24['id'],_0x61eb24);SmsQueueEvents[_0x1811('0x6')](_0x2bcd4e,_0x61eb24);_0x4da077(null);};}for(var e in events){if(events[_0x1811('0x7')](e)){var event=events[e];SmsQueue[_0x1811('0x8')](e,emitEvent(event));}}module[_0x1811('0x9')]=SmsQueueEvents;
\ No newline at end of file
+var _0xc607=['remove','emit','exports','events','../../mysqldb','SmsQueue','update'];(function(_0x5841ee,_0x9ebb10){var _0x326344=function(_0x5ddb2c){while(--_0x5ddb2c){_0x5841ee['push'](_0x5841ee['shift']());}};_0x326344(++_0x9ebb10);}(_0xc607,0x192));var _0x7c60=function(_0x18fa30,_0x55a097){_0x18fa30=_0x18fa30-0x0;var _0x170ea4=_0xc607[_0x18fa30];return _0x170ea4;};'use strict';var EventEmitter=require(_0x7c60('0x0'));var SmsQueue=require(_0x7c60('0x1'))['db'][_0x7c60('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c60('0x3'),'afterDestroy':_0x7c60('0x4')};function emitEvent(_0x17c5c0){return function(_0x13f3b4,_0x247d6a,_0x74774b){SmsQueueEvents[_0x7c60('0x5')](_0x17c5c0+':'+_0x13f3b4['id'],_0x13f3b4);SmsQueueEvents[_0x7c60('0x5')](_0x17c5c0,_0x13f3b4);_0x74774b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x7c60('0x6')]=SmsQueueEvents;
\ No newline at end of file
index d32bc13..2e31a41 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6568=['exports','SmsQueue','sms_queues','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6568,0x10b));var _0x8656=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6568[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0x8656('0x0'));var logger=require(_0x8656('0x1'))(_0x8656('0x2'));var moment=require(_0x8656('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8656('0x4'));var rimraf=require(_0x8656('0x5'));var config=require(_0x8656('0x6'));var attributes=require(_0x8656('0x7'));module[_0x8656('0x8')]=function(_0xd82d6f,_0x592703){return _0xd82d6f['define'](_0x8656('0x9'),attributes,{'tableName':_0x8656('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2b9b=['request-promise','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','moment','bluebird'];(function(_0x7785d0,_0x2076f5){var _0x1a167e=function(_0x4439d3){while(--_0x4439d3){_0x7785d0['push'](_0x7785d0['shift']());}};_0x1a167e(++_0x2076f5);}(_0x2b9b,0x1b4));var _0xb2b9=function(_0x25b0c9,_0x598bcf){_0x25b0c9=_0x25b0c9-0x0;var _0x43885f=_0x2b9b[_0x25b0c9];return _0x43885f;};'use strict';var _=require(_0xb2b9('0x0'));var util=require(_0xb2b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb2b9('0x2'));var BPromise=require(_0xb2b9('0x3'));var rp=require(_0xb2b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb2b9('0x5'));module[_0xb2b9('0x6')]=function(_0x1bdafd,_0x37effd){return _0x1bdafd[_0xb2b9('0x7')](_0xb2b9('0x8'),attributes,{'tableName':_0xb2b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6f998a6..9ec6f96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x858a=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','then','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0x858a,0x17d));var _0xa858=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x858a[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xa858('0x0'));var util=require(_0xa858('0x1'));var moment=require(_0xa858('0x2'));var BPromise=require(_0xa858('0x3'));var rs=require(_0xa858('0x4'));var fs=require('fs');var Redis=require(_0xa858('0x5'));var db=require(_0xa858('0x6'))['db'];var utils=require(_0xa858('0x7'));var logger=require(_0xa858('0x8'))(_0xa858('0x9'));var config=require(_0xa858('0xa'));var jayson=require(_0xa858('0xb'));var client=jayson['client'][_0xa858('0xc')]({'port':0x232a});config[_0xa858('0xd')]=_[_0xa858('0xe')](config[_0xa858('0xd')],{'host':_0xa858('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa858('0xd')]));require(_0xa858('0x10'))['register'](socket);function respondWithRpcPromise(_0x1db117,_0x16744d,_0x1d420b){return new BPromise(function(_0x39f53f,_0x14b544){return client['request'](_0x1db117,_0x1d420b)['then'](function(_0x33a994){logger[_0xa858('0x11')](_0xa858('0x12'),_0x16744d,_0xa858('0x13'));logger[_0xa858('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x16744d,'request\x20sent',JSON[_0xa858('0x15')](_0x33a994));if(_0x33a994['error']){if(_0x33a994[_0xa858('0x16')][_0xa858('0x17')]===0x1f4){logger[_0xa858('0x16')](_0xa858('0x12'),_0x16744d,_0x33a994['error'][_0xa858('0x18')]);return _0x14b544(_0x33a994[_0xa858('0x16')][_0xa858('0x18')]);}logger[_0xa858('0x16')](_0xa858('0x12'),_0x16744d,_0x33a994['error'][_0xa858('0x18')]);return _0x39f53f(_0x33a994[_0xa858('0x16')][_0xa858('0x18')]);}else{logger[_0xa858('0x11')](_0xa858('0x12'),_0x16744d,_0xa858('0x13'));_0x39f53f(_0x33a994['result'][_0xa858('0x18')]);}})[_0xa858('0x19')](function(_0x4d6075){logger[_0xa858('0x16')](_0xa858('0x12'),_0x16744d,_0x4d6075);_0x14b544(_0x4d6075);});});}exports[_0xa858('0x1a')]=function(_0x3184d6){var _0x218d0f=this;return new Promise(function(_0x379966,_0x1b269f){return db[_0xa858('0x1b')]['findAll']({'raw':_0x3184d6[_0xa858('0x1c')]?_0x3184d6[_0xa858('0x1c')][_0xa858('0x1d')]===undefined?!![]:![]:!![],'where':_0x3184d6[_0xa858('0x1c')]?_0x3184d6['options'][_0xa858('0x1e')]||null:null,'attributes':_0x3184d6[_0xa858('0x1c')]?_0x3184d6[_0xa858('0x1c')][_0xa858('0x1f')]||null:null,'limit':_0x3184d6[_0xa858('0x1c')]?_0x3184d6[_0xa858('0x1c')][_0xa858('0x20')]||null:null,'include':_0x3184d6[_0xa858('0x1c')]?_0x3184d6[_0xa858('0x1c')][_0xa858('0x21')]?_[_0xa858('0x22')](_0x3184d6['options']['include'],function(_0x63c39f){return{'model':db[_0x63c39f[_0xa858('0x23')]],'as':_0x63c39f['as'],'attributes':_0x63c39f[_0xa858('0x1f')],'include':_0x63c39f['include']?_[_0xa858('0x22')](_0x63c39f[_0xa858('0x21')],function(_0x4543c3){return{'model':db[_0x4543c3[_0xa858('0x23')]],'as':_0x4543c3['as'],'attributes':_0x4543c3['attributes'],'include':_0x4543c3[_0xa858('0x21')]?_[_0xa858('0x22')](_0x4543c3[_0xa858('0x21')],function(_0x352c31){return{'model':db[_0x352c31[_0xa858('0x23')]],'as':_0x352c31['as'],'attributes':_0x352c31[_0xa858('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa858('0x24')](function(_0x706c61){logger[_0xa858('0x11')](_0xa858('0x1a'),_0x3184d6);logger[_0xa858('0x14')](_0xa858('0x1a'),_0x3184d6,JSON[_0xa858('0x15')](_0x706c61));_0x379966(_0x706c61);})[_0xa858('0x19')](function(_0x5ea2b0){logger[_0xa858('0x16')](_0xa858('0x1a'),_0x5ea2b0[_0xa858('0x18')],_0x3184d6);_0x1b269f(_0x218d0f[_0xa858('0x16')](0x1f4,_0x5ea2b0[_0xa858('0x18')]));});});};exports[_0xa858('0x25')]=function(_0x54edae){var _0x191cd5=this;return new Promise(function(_0x1657b6,_0x1e0f92){return db[_0xa858('0x1b')][_0xa858('0x26')]({'raw':_0x54edae['options']?_0x54edae[_0xa858('0x1c')][_0xa858('0x1d')]===undefined?!![]:![]:!![],'where':_0x54edae[_0xa858('0x1c')]?_0x54edae['options'][_0xa858('0x1e')]||null:null,'attributes':_0x54edae[_0xa858('0x1c')]?_0x54edae['options']['attributes']||null:null,'include':_0x54edae[_0xa858('0x1c')]?_0x54edae[_0xa858('0x1c')][_0xa858('0x21')]?_[_0xa858('0x22')](_0x54edae[_0xa858('0x1c')][_0xa858('0x21')],function(_0x2d5795){return{'model':db[_0x2d5795[_0xa858('0x23')]],'as':_0x2d5795['as'],'attributes':_0x2d5795['attributes'],'include':_0x2d5795[_0xa858('0x21')]?_[_0xa858('0x22')](_0x2d5795['include'],function(_0x1447c0){return{'model':db[_0x1447c0[_0xa858('0x23')]],'as':_0x1447c0['as'],'attributes':_0x1447c0[_0xa858('0x1f')],'include':_0x1447c0['include']?_[_0xa858('0x22')](_0x1447c0[_0xa858('0x21')],function(_0xd7d435){return{'model':db[_0xd7d435[_0xa858('0x23')]],'as':_0xd7d435['as'],'attributes':_0xd7d435[_0xa858('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa858('0x24')](function(_0x43bd02){logger[_0xa858('0x11')]('ShowSmsQueue',_0x54edae);logger['debug'](_0xa858('0x25'),_0x54edae,JSON[_0xa858('0x15')](_0x43bd02));_0x1657b6(_0x43bd02);})[_0xa858('0x19')](function(_0x28853f){logger[_0xa858('0x16')](_0xa858('0x25'),_0x28853f[_0xa858('0x18')],_0x54edae);_0x1e0f92(_0x191cd5['error'](0x1f4,_0x28853f[_0xa858('0x18')]));});});};
\ No newline at end of file
+var _0x4b60=['SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','include','model','map','attributes','ShowSmsQueue','find','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','request\x20sent','debug'];(function(_0x22c755,_0x133055){var _0x1c0411=function(_0x58858b){while(--_0x58858b){_0x22c755['push'](_0x22c755['shift']());}};_0x1c0411(++_0x133055);}(_0x4b60,0xaa));var _0x04b6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4b60[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x04b6('0x0'));var util=require(_0x04b6('0x1'));var moment=require('moment');var BPromise=require(_0x04b6('0x2'));var rs=require(_0x04b6('0x3'));var fs=require('fs');var Redis=require(_0x04b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04b6('0x5'));var logger=require(_0x04b6('0x6'))(_0x04b6('0x7'));var config=require(_0x04b6('0x8'));var jayson=require(_0x04b6('0x9'));var client=jayson[_0x04b6('0xa')][_0x04b6('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x04b6('0xc'),'port':0x18eb});var socket=require(_0x04b6('0xd'))(new Redis(config['redis']));require(_0x04b6('0xe'))['register'](socket);function respondWithRpcPromise(_0x1eea99,_0x3f5788,_0x2ec544){return new BPromise(function(_0x560186,_0x160218){return client[_0x04b6('0xf')](_0x1eea99,_0x2ec544)[_0x04b6('0x10')](function(_0x17c635){logger[_0x04b6('0x11')]('SmsQueue,\x20%s,\x20%s',_0x3f5788,_0x04b6('0x12'));logger[_0x04b6('0x13')](_0x04b6('0x14'),_0x3f5788,'request\x20sent',JSON[_0x04b6('0x15')](_0x17c635));if(_0x17c635[_0x04b6('0x16')]){if(_0x17c635[_0x04b6('0x16')]['code']===0x1f4){logger[_0x04b6('0x16')](_0x04b6('0x17'),_0x3f5788,_0x17c635[_0x04b6('0x16')][_0x04b6('0x18')]);return _0x160218(_0x17c635[_0x04b6('0x16')]['message']);}logger['error'](_0x04b6('0x17'),_0x3f5788,_0x17c635[_0x04b6('0x16')][_0x04b6('0x18')]);return _0x560186(_0x17c635[_0x04b6('0x16')]['message']);}else{logger[_0x04b6('0x11')](_0x04b6('0x17'),_0x3f5788,'request\x20sent');_0x560186(_0x17c635['result'][_0x04b6('0x18')]);}})[_0x04b6('0x19')](function(_0x125d6c){logger[_0x04b6('0x16')]('SmsQueue,\x20%s,\x20%s',_0x3f5788,_0x125d6c);_0x160218(_0x125d6c);});});}exports[_0x04b6('0x1a')]=function(_0x2a7e27){var _0x562c8a=this;return new Promise(function(_0x171880,_0x239c58){return db[_0x04b6('0x1b')][_0x04b6('0x1c')]({'raw':_0x2a7e27[_0x04b6('0x1d')]?_0x2a7e27[_0x04b6('0x1d')][_0x04b6('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a7e27['options']?_0x2a7e27[_0x04b6('0x1d')]['where']||null:null,'attributes':_0x2a7e27[_0x04b6('0x1d')]?_0x2a7e27[_0x04b6('0x1d')]['attributes']||null:null,'limit':_0x2a7e27[_0x04b6('0x1d')]?_0x2a7e27[_0x04b6('0x1d')]['limit']||null:null,'include':_0x2a7e27[_0x04b6('0x1d')]?_0x2a7e27[_0x04b6('0x1d')][_0x04b6('0x1f')]?_['map'](_0x2a7e27[_0x04b6('0x1d')][_0x04b6('0x1f')],function(_0x4a76b5){return{'model':db[_0x4a76b5[_0x04b6('0x20')]],'as':_0x4a76b5['as'],'attributes':_0x4a76b5['attributes'],'include':_0x4a76b5['include']?_[_0x04b6('0x21')](_0x4a76b5[_0x04b6('0x1f')],function(_0x3d14ef){return{'model':db[_0x3d14ef[_0x04b6('0x20')]],'as':_0x3d14ef['as'],'attributes':_0x3d14ef[_0x04b6('0x22')],'include':_0x3d14ef[_0x04b6('0x1f')]?_['map'](_0x3d14ef[_0x04b6('0x1f')],function(_0x342d80){return{'model':db[_0x342d80[_0x04b6('0x20')]],'as':_0x342d80['as'],'attributes':_0x342d80[_0x04b6('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xabe9f5){logger[_0x04b6('0x11')](_0x04b6('0x1a'),_0x2a7e27);logger[_0x04b6('0x13')](_0x04b6('0x1a'),_0x2a7e27,JSON[_0x04b6('0x15')](_0xabe9f5));_0x171880(_0xabe9f5);})['catch'](function(_0x47c3f7){logger[_0x04b6('0x16')]('GetSmsQueue',_0x47c3f7[_0x04b6('0x18')],_0x2a7e27);_0x239c58(_0x562c8a[_0x04b6('0x16')](0x1f4,_0x47c3f7['message']));});});};exports[_0x04b6('0x23')]=function(_0x3dc8ae){var _0x3e5080=this;return new Promise(function(_0x57556f,_0x1056f7){return db['SmsQueue'][_0x04b6('0x24')]({'raw':_0x3dc8ae[_0x04b6('0x1d')]?_0x3dc8ae[_0x04b6('0x1d')][_0x04b6('0x1e')]===undefined?!![]:![]:!![],'where':_0x3dc8ae['options']?_0x3dc8ae['options'][_0x04b6('0x25')]||null:null,'attributes':_0x3dc8ae[_0x04b6('0x1d')]?_0x3dc8ae[_0x04b6('0x1d')][_0x04b6('0x22')]||null:null,'include':_0x3dc8ae[_0x04b6('0x1d')]?_0x3dc8ae[_0x04b6('0x1d')][_0x04b6('0x1f')]?_[_0x04b6('0x21')](_0x3dc8ae[_0x04b6('0x1d')][_0x04b6('0x1f')],function(_0x1b2220){return{'model':db[_0x1b2220[_0x04b6('0x20')]],'as':_0x1b2220['as'],'attributes':_0x1b2220[_0x04b6('0x22')],'include':_0x1b2220[_0x04b6('0x1f')]?_[_0x04b6('0x21')](_0x1b2220[_0x04b6('0x1f')],function(_0x279f97){return{'model':db[_0x279f97['model']],'as':_0x279f97['as'],'attributes':_0x279f97['attributes'],'include':_0x279f97[_0x04b6('0x1f')]?_['map'](_0x279f97['include'],function(_0x2ee012){return{'model':db[_0x2ee012['model']],'as':_0x2ee012['as'],'attributes':_0x2ee012[_0x04b6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x04b6('0x10')](function(_0x49c211){logger[_0x04b6('0x11')](_0x04b6('0x23'),_0x3dc8ae);logger[_0x04b6('0x13')](_0x04b6('0x23'),_0x3dc8ae,JSON[_0x04b6('0x15')](_0x49c211));_0x57556f(_0x49c211);})[_0x04b6('0x19')](function(_0x434795){logger['error'](_0x04b6('0x23'),_0x434795[_0x04b6('0x18')],_0x3dc8ae);_0x1056f7(_0x3e5080[_0x04b6('0x16')](0x1f4,_0x434795[_0x04b6('0x18')]));});});};
\ No newline at end of file
index f8d381a..ebbd79e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf251=['remove','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xf251,0x13e));var _0x1f25=function(_0x105b20,_0x388d13){_0x105b20=_0x105b20-0x0;var _0x357455=_0xf251[_0x105b20];return _0x357455;};'use strict';var SmsQueueEvents=require(_0x1f25('0x0'));var events=[_0x1f25('0x1'),_0x1f25('0x2'),'update'];function createListener(_0x53c14a,_0x46fbb0){return function(_0x254afe){_0x46fbb0[_0x1f25('0x3')](_0x53c14a,_0x254afe);};}function removeListener(_0x5129b6,_0x546d38){return function(){SmsQueueEvents[_0x1f25('0x4')](_0x5129b6,_0x546d38);};}exports[_0x1f25('0x5')]=function(_0x7c2d9c){for(var _0x4dd9d8=0x0,_0x103301=events[_0x1f25('0x6')];_0x4dd9d8<_0x103301;_0x4dd9d8++){var _0x217bca=events[_0x4dd9d8];var _0x37d403=createListener(_0x1f25('0x7')+_0x217bca,_0x7c2d9c);SmsQueueEvents['on'](_0x217bca,_0x37d403);}};
\ No newline at end of file
+var _0x385b=['removeListener','smsQueue:','save','remove','update'];(function(_0x5434b9,_0xade01c){var _0x4adbce=function(_0xe0b012){while(--_0xe0b012){_0x5434b9['push'](_0x5434b9['shift']());}};_0x4adbce(++_0xade01c);}(_0x385b,0x89));var _0xb385=function(_0x53468a,_0x286986){_0x53468a=_0x53468a-0x0;var _0x205efd=_0x385b[_0x53468a];return _0x205efd;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xb385('0x0'),_0xb385('0x1'),_0xb385('0x2')];function createListener(_0xbc3093,_0x290850){return function(_0x402e2a){_0x290850['emit'](_0xbc3093,_0x402e2a);};}function removeListener(_0x5509df,_0x588a64){return function(){SmsQueueEvents[_0xb385('0x3')](_0x5509df,_0x588a64);};}exports['register']=function(_0x865ff8){for(var _0x41ae46=0x0,_0x331622=events['length'];_0x41ae46<_0x331622;_0x41ae46++){var _0x597970=events[_0x41ae46];var _0x3192b0=createListener(_0xb385('0x4')+_0x597970,_0x865ff8);SmsQueueEvents['on'](_0x597970,_0x3192b0);}};
\ No newline at end of file
index a01dad9..896378b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6cae=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x2a89f9,_0x14a34a){var _0x14e0aa=function(_0xdb5e46){while(--_0xdb5e46){_0x2a89f9['push'](_0x2a89f9['shift']());}};_0x14e0aa(++_0x14a34a);}(_0x6cae,0xf0));var _0xe6ca=function(_0x54d44b,_0x3589ce){_0x54d44b=_0x54d44b-0x0;var _0x1f6f9d=_0x6cae[_0x54d44b];return _0x1f6f9d;};'use strict';var multer=require(_0xe6ca('0x0'));var util=require(_0xe6ca('0x1'));var path=require('path');var timeout=require(_0xe6ca('0x2'));var express=require(_0xe6ca('0x3'));var router=express[_0xe6ca('0x4')]();var fs_extra=require(_0xe6ca('0x5'));var auth=require(_0xe6ca('0x6'));var interaction=require(_0xe6ca('0x7'));var config=require(_0xe6ca('0x8'));var controller=require('./smsQueueReport.controller');router[_0xe6ca('0x9')]('/',auth[_0xe6ca('0xa')](),controller[_0xe6ca('0xb')]);router[_0xe6ca('0x9')](_0xe6ca('0xc'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0xd')]);router[_0xe6ca('0x9')](_0xe6ca('0xe'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0xf')]);router[_0xe6ca('0x10')]('/',auth['isAuthenticated'](),controller[_0xe6ca('0x11')]);router['put'](_0xe6ca('0xe'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x12')]);router[_0xe6ca('0x13')](_0xe6ca('0xe'),auth['isAuthenticated'](),controller[_0xe6ca('0x14')]);module[_0xe6ca('0x15')]=router;
\ No newline at end of file
+var _0x1269=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x8d53c9,_0x5c06ef){var _0x42902b=function(_0x2ac5a8){while(--_0x2ac5a8){_0x8d53c9['push'](_0x8d53c9['shift']());}};_0x42902b(++_0x5c06ef);}(_0x1269,0x8b));var _0x9126=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x1269[_0x2b2c53];return _0x311ec2;};'use strict';var multer=require(_0x9126('0x0'));var util=require(_0x9126('0x1'));var path=require('path');var timeout=require(_0x9126('0x2'));var express=require('express');var router=express[_0x9126('0x3')]();var fs_extra=require(_0x9126('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9126('0x5'));var config=require('../../config/environment');var controller=require(_0x9126('0x6'));router[_0x9126('0x7')]('/',auth[_0x9126('0x8')](),controller[_0x9126('0x9')]);router[_0x9126('0x7')](_0x9126('0xa'),auth[_0x9126('0x8')](),controller[_0x9126('0xb')]);router[_0x9126('0x7')](_0x9126('0xc'),auth[_0x9126('0x8')](),controller[_0x9126('0xd')]);router['post']('/',auth[_0x9126('0x8')](),controller[_0x9126('0xe')]);router[_0x9126('0xf')](_0x9126('0xc'),auth[_0x9126('0x8')](),controller[_0x9126('0x10')]);router[_0x9126('0x11')](_0x9126('0xc'),auth[_0x9126('0x8')](),controller[_0x9126('0x12')]);module[_0x9126('0x13')]=router;
\ No newline at end of file
index 2043849..7e3fd12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bbf=['sequelize','exports','STRING','DATE'];(function(_0xa69509,_0x2822e5){var _0x2f5296=function(_0x392f3a){while(--_0x392f3a){_0xa69509['push'](_0xa69509['shift']());}};_0x2f5296(++_0x2822e5);}(_0x3bbf,0x130));var _0xf3bb=function(_0x1b95a9,_0x571b50){_0x1b95a9=_0x1b95a9-0x0;var _0x18441b=_0x3bbf[_0x1b95a9];return _0x18441b;};'use strict';var moment=require('moment');var Sequelize=require(_0xf3bb('0x0'));module[_0xf3bb('0x1')]={'uniqueid':{'type':Sequelize[_0xf3bb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf3bb('0x2')]},'joinAt':{'type':Sequelize[_0xf3bb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf3bb('0x3')]},'exitAt':{'type':Sequelize[_0xf3bb('0x3')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x14d9=['exports','STRING','DATE','moment'];(function(_0x555b58,_0x1f0bde){var _0x651cd4=function(_0x59dbad){while(--_0x59dbad){_0x555b58['push'](_0x555b58['shift']());}};_0x651cd4(++_0x1f0bde);}(_0x14d9,0x193));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x914d('0x0'));var Sequelize=require('sequelize');module[_0x914d('0x1')]={'uniqueid':{'type':Sequelize[_0x914d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x914d('0x2')]},'joinAt':{'type':Sequelize[_0x914d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x914d('0x3')]},'reason':{'type':Sequelize[_0x914d('0x2')]}};
\ No newline at end of file
index f7d57da..2585b44 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88c9=['include','findAll','catch','params','keys','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','offset','count','status','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SmsQueueReport','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','where','merge','filter','options','includeAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x88c9,0x177));var _0x988c=function(_0x22a971,_0x564874){_0x22a971=_0x22a971-0x0;var _0x701c62=_0x88c9[_0x22a971];return _0x701c62;};'use strict';var emlformat=require(_0x988c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x988c('0x1'));var jsonpatch=require(_0x988c('0x2'));var rp=require(_0x988c('0x3'));var moment=require(_0x988c('0x4'));var BPromise=require(_0x988c('0x5'));var Mustache=require(_0x988c('0x6'));var util=require(_0x988c('0x7'));var path=require(_0x988c('0x8'));var sox=require(_0x988c('0x9'));var csv=require('to-csv');var ejs=require(_0x988c('0xa'));var fs=require('fs');var fs_extra=require(_0x988c('0xb'));var _=require(_0x988c('0xc'));var squel=require(_0x988c('0xd'));var crypto=require(_0x988c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x988c('0xf'));var toCsv=require(_0x988c('0x10'));var querystring=require('querystring');var Papa=require(_0x988c('0x11'));var Redis=require('ioredis');var authService=require(_0x988c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x988c('0x13'));var hardwareService=require(_0x988c('0x14'));var logger=require('../../config/logger')(_0x988c('0x15'));var utils=require(_0x988c('0x16'));var config=require(_0x988c('0x17'));var licenseUtil=require(_0x988c('0x18'));var db=require(_0x988c('0x19'))['db'];function respondWithStatusCode(_0x91f3f7,_0x2062d7){_0x2062d7=_0x2062d7||0xcc;return function(_0x20c641){if(_0x20c641){return _0x91f3f7[_0x988c('0x1a')](_0x2062d7);}return _0x91f3f7['status'](_0x2062d7)[_0x988c('0x1b')]();};}function respondWithResult(_0x769ddb,_0x112818){_0x112818=_0x112818||0xc8;return function(_0x5e9fb6){if(_0x5e9fb6){return _0x769ddb['status'](_0x112818)['json'](_0x5e9fb6);}};}function respondWithFilteredResult(_0xa7c5c2,_0x1ae0e5){return function(_0x14f4e8){if(_0x14f4e8){var _0x518042=typeof _0x1ae0e5['offset']===_0x988c('0x1c')&&typeof _0x1ae0e5[_0x988c('0x1d')]===_0x988c('0x1c');var _0x5d28e8=_0x14f4e8['count'];var _0x2e9ec6=_0x518042?0x0:_0x1ae0e5[_0x988c('0x1e')];var _0x10e727=_0x518042?_0x14f4e8[_0x988c('0x1f')]:_0x1ae0e5[_0x988c('0x1e')]+_0x1ae0e5[_0x988c('0x1d')];var _0x500bd5;if(_0x10e727>=_0x5d28e8){_0x10e727=_0x5d28e8;_0x500bd5=0xc8;}else{_0x500bd5=0xce;}_0xa7c5c2[_0x988c('0x20')](_0x500bd5);return _0xa7c5c2['set'](_0x988c('0x21'),_0x2e9ec6+'-'+_0x10e727+'/'+_0x5d28e8)[_0x988c('0x22')](_0x14f4e8);}return null;};}function patchUpdates(_0x27c0d4){return function(_0x23aef6){try{jsonpatch[_0x988c('0x23')](_0x23aef6,_0x27c0d4,!![]);}catch(_0x5009e6){return BPromise[_0x988c('0x24')](_0x5009e6);}return _0x23aef6[_0x988c('0x25')]();};}function saveUpdates(_0x3161dc,_0x4abfa7){return function(_0x5b25d9){if(_0x5b25d9){return _0x5b25d9[_0x988c('0x26')](_0x3161dc)['then'](function(_0x29eae4){return _0x29eae4;});}return null;};}function removeEntity(_0x24beb5,_0x175323){return function(_0x3120ca){if(_0x3120ca){return _0x3120ca[_0x988c('0x27')]()[_0x988c('0x28')](function(){_0x24beb5[_0x988c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x143ef5,_0x1e52c9){return function(_0x1110ec){if(!_0x1110ec){_0x143ef5[_0x988c('0x1a')](0x194);}return _0x1110ec;};}function handleError(_0x1c74e7,_0x531d85){_0x531d85=_0x531d85||0x1f4;return function(_0x594f30){logger[_0x988c('0x29')](_0x594f30[_0x988c('0x2a')]);if(_0x594f30[_0x988c('0x2b')]){delete _0x594f30['name'];}_0x1c74e7['status'](_0x531d85)[_0x988c('0x2c')](_0x594f30);};}exports[_0x988c('0x2d')]=function(_0x31831d,_0x4857ff){var _0x1d8318={},_0x18f6de={},_0x1378f0={'count':0x0,'rows':[]};var _0x2e250f=_[_0x988c('0x2e')](db[_0x988c('0x2f')]['rawAttributes'],function(_0x88c740){return{'name':_0x88c740['fieldName'],'type':_0x88c740[_0x988c('0x30')][_0x988c('0x31')]};});_0x18f6de[_0x988c('0x32')]=_[_0x988c('0x2e')](_0x2e250f,_0x988c('0x2b'));_0x18f6de[_0x988c('0x33')]=_['keys'](_0x31831d['query']);_0x18f6de[_0x988c('0x34')]=_['intersection'](_0x18f6de['model'],_0x18f6de['query']);_0x1d8318[_0x988c('0x35')]=_[_0x988c('0x36')](_0x18f6de[_0x988c('0x32')],qs[_0x988c('0x37')](_0x31831d[_0x988c('0x33')][_0x988c('0x37')]));_0x1d8318[_0x988c('0x35')]=_0x1d8318[_0x988c('0x35')]['length']?_0x1d8318[_0x988c('0x35')]:_0x18f6de[_0x988c('0x32')];if(!_0x31831d[_0x988c('0x33')][_0x988c('0x38')]('nolimit')){_0x1d8318['limit']=qs[_0x988c('0x1d')](_0x31831d[_0x988c('0x33')][_0x988c('0x1d')]);_0x1d8318[_0x988c('0x1e')]=qs[_0x988c('0x1e')](_0x31831d[_0x988c('0x33')][_0x988c('0x1e')]);}_0x1d8318[_0x988c('0x39')]=qs['sort'](_0x31831d[_0x988c('0x33')]['sort']);_0x1d8318[_0x988c('0x3a')]=qs[_0x988c('0x34')](_['pick'](_0x31831d[_0x988c('0x33')],_0x18f6de[_0x988c('0x34')]),_0x2e250f);if(_0x31831d[_0x988c('0x33')]['filter']){_0x1d8318[_0x988c('0x3a')]=_[_0x988c('0x3b')](_0x1d8318[_0x988c('0x3a')],{'$or':_[_0x988c('0x2e')](_0x2e250f,function(_0x4f427e){if(_0x4f427e[_0x988c('0x30')]!=='VIRTUAL'){var _0x39d65e={};_0x39d65e[_0x4f427e[_0x988c('0x2b')]]={'$like':'%'+_0x31831d[_0x988c('0x33')][_0x988c('0x3c')]+'%'};return _0x39d65e;}})});}_0x1d8318=_['merge']({},_0x1d8318,_0x31831d[_0x988c('0x3d')]);var _0x298b53={'where':_0x1d8318[_0x988c('0x3a')]};return db['SmsQueueReport'][_0x988c('0x1f')](_0x298b53)['then'](function(_0x2ae926){_0x1378f0[_0x988c('0x1f')]=_0x2ae926;if(_0x31831d['query'][_0x988c('0x3e')]){_0x1d8318[_0x988c('0x3f')]=[{'all':!![]}];}return db[_0x988c('0x2f')][_0x988c('0x40')](_0x1d8318);})['then'](function(_0x11872f){_0x1378f0['rows']=_0x11872f;return _0x1378f0;})[_0x988c('0x28')](respondWithFilteredResult(_0x4857ff,_0x1d8318))[_0x988c('0x41')](handleError(_0x4857ff,null));};exports['show']=function(_0x3b04eb,_0x2f0e73){var _0x1517bb={'raw':!![],'where':{'id':_0x3b04eb[_0x988c('0x42')]['id']}},_0x2961c3={};_0x2961c3['model']=_['keys'](db[_0x988c('0x2f')]['rawAttributes']);_0x2961c3[_0x988c('0x33')]=_[_0x988c('0x43')](_0x3b04eb[_0x988c('0x33')]);_0x2961c3[_0x988c('0x34')]=_[_0x988c('0x36')](_0x2961c3['model'],_0x2961c3[_0x988c('0x33')]);_0x1517bb[_0x988c('0x35')]=_['intersection'](_0x2961c3[_0x988c('0x32')],qs[_0x988c('0x37')](_0x3b04eb['query'][_0x988c('0x37')]));_0x1517bb[_0x988c('0x35')]=_0x1517bb['attributes'][_0x988c('0x44')]?_0x1517bb[_0x988c('0x35')]:_0x2961c3[_0x988c('0x32')];if(_0x3b04eb['query'][_0x988c('0x3e')]){_0x1517bb[_0x988c('0x3f')]=[{'all':!![]}];}_0x1517bb=_[_0x988c('0x3b')]({},_0x1517bb,_0x3b04eb[_0x988c('0x3d')]);return db['SmsQueueReport'][_0x988c('0x45')](_0x1517bb)[_0x988c('0x28')](handleEntityNotFound(_0x2f0e73,null))['then'](respondWithResult(_0x2f0e73,null))['catch'](handleError(_0x2f0e73,null));};exports[_0x988c('0x46')]=function(_0x249e59,_0x1374aa){return db[_0x988c('0x2f')][_0x988c('0x46')](_0x249e59[_0x988c('0x47')],{})[_0x988c('0x28')](respondWithResult(_0x1374aa,0xc9))[_0x988c('0x41')](handleError(_0x1374aa,null));};exports[_0x988c('0x26')]=function(_0xd2676,_0x28d7a6){if(_0xd2676[_0x988c('0x47')]['id']){delete _0xd2676['body']['id'];}return db[_0x988c('0x2f')][_0x988c('0x45')]({'where':{'id':_0xd2676[_0x988c('0x42')]['id']}})[_0x988c('0x28')](handleEntityNotFound(_0x28d7a6,null))[_0x988c('0x28')](saveUpdates(_0xd2676['body'],null))[_0x988c('0x28')](respondWithResult(_0x28d7a6,null))[_0x988c('0x41')](handleError(_0x28d7a6,null));};exports[_0x988c('0x27')]=function(_0x22e496,_0x20c513){return db['SmsQueueReport'][_0x988c('0x45')]({'where':{'id':_0x22e496[_0x988c('0x42')]['id']}})[_0x988c('0x28')](handleEntityNotFound(_0x20c513,null))[_0x988c('0x28')](removeEntity(_0x20c513,null))[_0x988c('0x41')](handleError(_0x20c513,null));};exports[_0x988c('0x48')]=function(_0x1d836e,_0xb4ff5a){return db['SmsQueueReport'][_0x988c('0x48')]()['then'](respondWithResult(_0xb4ff5a,null))[_0x988c('0x41')](handleError(_0xb4ff5a,null));};
\ No newline at end of file
+var _0x699f=['eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x699f,0xdb));var _0xf699=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x699f[_0x47568e];return _0x33815b;};'use strict';var emlformat=require(_0xf699('0x0'));var rimraf=require(_0xf699('0x1'));var zipdir=require(_0xf699('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf699('0x3'));var Mustache=require(_0xf699('0x4'));var util=require('util');var path=require(_0xf699('0x5'));var sox=require(_0xf699('0x6'));var csv=require('to-csv');var ejs=require(_0xf699('0x7'));var fs=require('fs');var fs_extra=require(_0xf699('0x8'));var _=require('lodash');var squel=require(_0xf699('0x9'));var crypto=require(_0xf699('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf699('0xb'));var toCsv=require(_0xf699('0xc'));var querystring=require(_0xf699('0xd'));var Papa=require(_0xf699('0xe'));var Redis=require(_0xf699('0xf'));var authService=require(_0xf699('0x10'));var qs=require(_0xf699('0x11'));var as=require(_0xf699('0x12'));var hardwareService=require(_0xf699('0x13'));var logger=require('../../config/logger')(_0xf699('0x14'));var utils=require(_0xf699('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf699('0x16'));var db=require(_0xf699('0x17'))['db'];function respondWithStatusCode(_0x11f522,_0x481e7e){_0x481e7e=_0x481e7e||0xcc;return function(_0x24dc06){if(_0x24dc06){return _0x11f522['sendStatus'](_0x481e7e);}return _0x11f522[_0xf699('0x18')](_0x481e7e)[_0xf699('0x19')]();};}function respondWithResult(_0x141c74,_0x2a4d18){_0x2a4d18=_0x2a4d18||0xc8;return function(_0x12ba15){if(_0x12ba15){return _0x141c74[_0xf699('0x18')](_0x2a4d18)[_0xf699('0x1a')](_0x12ba15);}};}function respondWithFilteredResult(_0x3938fb,_0x108f0c){return function(_0x5cfb8f){if(_0x5cfb8f){var _0x349cde=typeof _0x108f0c['offset']===_0xf699('0x1b')&&typeof _0x108f0c[_0xf699('0x1c')]===_0xf699('0x1b');var _0x35d2c4=_0x5cfb8f[_0xf699('0x1d')];var _0x964f1e=_0x349cde?0x0:_0x108f0c[_0xf699('0x1e')];var _0x5c2277=_0x349cde?_0x5cfb8f[_0xf699('0x1d')]:_0x108f0c[_0xf699('0x1e')]+_0x108f0c[_0xf699('0x1c')];var _0x22e282;if(_0x5c2277>=_0x35d2c4){_0x5c2277=_0x35d2c4;_0x22e282=0xc8;}else{_0x22e282=0xce;}_0x3938fb['status'](_0x22e282);return _0x3938fb[_0xf699('0x1f')](_0xf699('0x20'),_0x964f1e+'-'+_0x5c2277+'/'+_0x35d2c4)['json'](_0x5cfb8f);}return null;};}function patchUpdates(_0x43b793){return function(_0x3181ee){try{jsonpatch[_0xf699('0x21')](_0x3181ee,_0x43b793,!![]);}catch(_0x3f2344){return BPromise['reject'](_0x3f2344);}return _0x3181ee[_0xf699('0x22')]();};}function saveUpdates(_0x59e6f5,_0x2c125c){return function(_0x48d35f){if(_0x48d35f){return _0x48d35f[_0xf699('0x23')](_0x59e6f5)[_0xf699('0x24')](function(_0x3c4c49){return _0x3c4c49;});}return null;};}function removeEntity(_0x526f9d,_0x3a9a6a){return function(_0x378c8c){if(_0x378c8c){return _0x378c8c[_0xf699('0x25')]()[_0xf699('0x24')](function(){_0x526f9d[_0xf699('0x18')](0xcc)[_0xf699('0x19')]();});}};}function handleEntityNotFound(_0x14297f,_0x2afd6d){return function(_0x187a5d){if(!_0x187a5d){_0x14297f[_0xf699('0x26')](0x194);}return _0x187a5d;};}function handleError(_0x427a7f,_0x5cab8f){_0x5cab8f=_0x5cab8f||0x1f4;return function(_0x1383bc){logger[_0xf699('0x27')](_0x1383bc[_0xf699('0x28')]);if(_0x1383bc[_0xf699('0x29')]){delete _0x1383bc['name'];}_0x427a7f['status'](_0x5cab8f)[_0xf699('0x2a')](_0x1383bc);};}exports[_0xf699('0x2b')]=function(_0x5313c7,_0x51957d){var _0x56b48b={},_0x4090bc={},_0x3040fd={'count':0x0,'rows':[]};var _0x48e3cf=_[_0xf699('0x2c')](db[_0xf699('0x2d')][_0xf699('0x2e')],function(_0x2df2ca){return{'name':_0x2df2ca[_0xf699('0x2f')],'type':_0x2df2ca['type']['key']};});_0x4090bc[_0xf699('0x30')]=_[_0xf699('0x2c')](_0x48e3cf,_0xf699('0x29'));_0x4090bc['query']=_[_0xf699('0x31')](_0x5313c7[_0xf699('0x32')]);_0x4090bc['filters']=_[_0xf699('0x33')](_0x4090bc[_0xf699('0x30')],_0x4090bc['query']);_0x56b48b[_0xf699('0x34')]=_[_0xf699('0x33')](_0x4090bc[_0xf699('0x30')],qs[_0xf699('0x35')](_0x5313c7['query'][_0xf699('0x35')]));_0x56b48b['attributes']=_0x56b48b[_0xf699('0x34')]['length']?_0x56b48b['attributes']:_0x4090bc['model'];if(!_0x5313c7[_0xf699('0x32')][_0xf699('0x36')](_0xf699('0x37'))){_0x56b48b[_0xf699('0x1c')]=qs[_0xf699('0x1c')](_0x5313c7[_0xf699('0x32')]['limit']);_0x56b48b[_0xf699('0x1e')]=qs['offset'](_0x5313c7[_0xf699('0x32')]['offset']);}_0x56b48b[_0xf699('0x38')]=qs['sort'](_0x5313c7[_0xf699('0x32')]['sort']);_0x56b48b['where']=qs['filters'](_[_0xf699('0x39')](_0x5313c7[_0xf699('0x32')],_0x4090bc['filters']),_0x48e3cf);if(_0x5313c7['query'][_0xf699('0x3a')]){_0x56b48b['where']=_['merge'](_0x56b48b[_0xf699('0x3b')],{'$or':_[_0xf699('0x2c')](_0x48e3cf,function(_0x1a9320){if(_0x1a9320[_0xf699('0x3c')]!=='VIRTUAL'){var _0x594f28={};_0x594f28[_0x1a9320[_0xf699('0x29')]]={'$like':'%'+_0x5313c7['query']['filter']+'%'};return _0x594f28;}})});}_0x56b48b=_[_0xf699('0x3d')]({},_0x56b48b,_0x5313c7[_0xf699('0x3e')]);var _0x552cf7={'where':_0x56b48b['where']};return db[_0xf699('0x2d')]['count'](_0x552cf7)[_0xf699('0x24')](function(_0x444de4){_0x3040fd['count']=_0x444de4;if(_0x5313c7[_0xf699('0x32')][_0xf699('0x3f')]){_0x56b48b[_0xf699('0x40')]=[{'all':!![]}];}return db[_0xf699('0x2d')][_0xf699('0x41')](_0x56b48b);})[_0xf699('0x24')](function(_0x1338ef){_0x3040fd[_0xf699('0x42')]=_0x1338ef;return _0x3040fd;})[_0xf699('0x24')](respondWithFilteredResult(_0x51957d,_0x56b48b))[_0xf699('0x43')](handleError(_0x51957d,null));};exports['show']=function(_0x20e652,_0x44ec8e){var _0x3640a1={'raw':!![],'where':{'id':_0x20e652[_0xf699('0x44')]['id']}},_0x2dcf58={};_0x2dcf58[_0xf699('0x30')]=_[_0xf699('0x31')](db[_0xf699('0x2d')][_0xf699('0x2e')]);_0x2dcf58['query']=_['keys'](_0x20e652[_0xf699('0x32')]);_0x2dcf58['filters']=_[_0xf699('0x33')](_0x2dcf58[_0xf699('0x30')],_0x2dcf58[_0xf699('0x32')]);_0x3640a1['attributes']=_[_0xf699('0x33')](_0x2dcf58[_0xf699('0x30')],qs[_0xf699('0x35')](_0x20e652['query'][_0xf699('0x35')]));_0x3640a1[_0xf699('0x34')]=_0x3640a1[_0xf699('0x34')][_0xf699('0x45')]?_0x3640a1[_0xf699('0x34')]:_0x2dcf58[_0xf699('0x30')];if(_0x20e652[_0xf699('0x32')][_0xf699('0x3f')]){_0x3640a1['include']=[{'all':!![]}];}_0x3640a1=_[_0xf699('0x3d')]({},_0x3640a1,_0x20e652[_0xf699('0x3e')]);return db[_0xf699('0x2d')][_0xf699('0x46')](_0x3640a1)[_0xf699('0x24')](handleEntityNotFound(_0x44ec8e,null))[_0xf699('0x24')](respondWithResult(_0x44ec8e,null))[_0xf699('0x43')](handleError(_0x44ec8e,null));};exports[_0xf699('0x47')]=function(_0x5bd484,_0x12b6a4){return db[_0xf699('0x2d')]['create'](_0x5bd484['body'],{})[_0xf699('0x24')](respondWithResult(_0x12b6a4,0xc9))['catch'](handleError(_0x12b6a4,null));};exports['update']=function(_0x27aa35,_0x31da7c){if(_0x27aa35[_0xf699('0x48')]['id']){delete _0x27aa35[_0xf699('0x48')]['id'];}return db[_0xf699('0x2d')][_0xf699('0x46')]({'where':{'id':_0x27aa35[_0xf699('0x44')]['id']}})['then'](handleEntityNotFound(_0x31da7c,null))[_0xf699('0x24')](saveUpdates(_0x27aa35[_0xf699('0x48')],null))[_0xf699('0x24')](respondWithResult(_0x31da7c,null))[_0xf699('0x43')](handleError(_0x31da7c,null));};exports[_0xf699('0x25')]=function(_0x3f4aad,_0x581e49){return db[_0xf699('0x2d')][_0xf699('0x46')]({'where':{'id':_0x3f4aad[_0xf699('0x44')]['id']}})[_0xf699('0x24')](handleEntityNotFound(_0x581e49,null))[_0xf699('0x24')](removeEntity(_0x581e49,null))[_0xf699('0x43')](handleError(_0x581e49,null));};exports['describe']=function(_0x60f112,_0x1b0747){return db[_0xf699('0x2d')]['describe']()[_0xf699('0x24')](respondWithResult(_0x1b0747,null))['catch'](handleError(_0x1b0747,null));};
\ No newline at end of file
index 7f7b145..2043f8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x5cce26,_0x35aa54){var _0x29f1e0=function(_0xca16ed){while(--_0xca16ed){_0x5cce26['push'](_0x5cce26['shift']());}};_0x29f1e0(++_0x35aa54);}(_0x70e0,0x17b));var _0x070e=function(_0x232b5c,_0x307862){_0x232b5c=_0x232b5c-0x0;var _0x5ac5df=_0x70e0[_0x232b5c];return _0x5ac5df;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x3e52bb,_0x42aad8){var _0x5b91ae=function(_0x36846a){while(--_0x36846a){_0x3e52bb['push'](_0x3e52bb['shift']());}};_0x5b91ae(++_0x42aad8);}(_0x70e0,0x17b));var _0x070e=function(_0x35cb24,_0x25ecb1){_0x35cb24=_0x35cb24-0x0;var _0x3702c4=_0x70e0[_0x35cb24];return _0x3702c4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
index 8b50d5a..b312413 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x66c6=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1ad0e3,_0x38bd34){var _0xda89c7=function(_0x233e4e){while(--_0x233e4e){_0x1ad0e3['push'](_0x1ad0e3['shift']());}};_0xda89c7(++_0x38bd34);}(_0x66c6,0x131));var _0x666c=function(_0x1403b0,_0x52b0fe){_0x1403b0=_0x1403b0-0x0;var _0x25541c=_0x66c6[_0x1403b0];return _0x25541c;};'use strict';var _=require(_0x666c('0x0'));var util=require(_0x666c('0x1'));var moment=require(_0x666c('0x2'));var BPromise=require(_0x666c('0x3'));var rs=require(_0x666c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x666c('0x5'));var logger=require(_0x666c('0x6'))('rpc');var config=require(_0x666c('0x7'));var jayson=require(_0x666c('0x8'));var client=jayson[_0x666c('0x9')][_0x666c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37ecf7,_0x400c4d,_0x3b3ebc){return new BPromise(function(_0x1a95ff,_0x67cd2a){return client[_0x666c('0xb')](_0x37ecf7,_0x3b3ebc)[_0x666c('0xc')](function(_0x23741e){logger[_0x666c('0xd')](_0x666c('0xe'),_0x400c4d,_0x666c('0xf'));logger[_0x666c('0x10')](_0x666c('0x11'),_0x400c4d,_0x666c('0xf'),JSON['stringify'](_0x23741e));if(_0x23741e[_0x666c('0x12')]){if(_0x23741e['error'][_0x666c('0x13')]===0x1f4){logger[_0x666c('0x12')](_0x666c('0xe'),_0x400c4d,_0x23741e[_0x666c('0x12')]['message']);return _0x67cd2a(_0x23741e[_0x666c('0x12')][_0x666c('0x14')]);}logger['error'](_0x666c('0xe'),_0x400c4d,_0x23741e[_0x666c('0x12')]['message']);return _0x1a95ff(_0x23741e['error'][_0x666c('0x14')]);}else{logger[_0x666c('0xd')](_0x666c('0xe'),_0x400c4d,'request\x20sent');_0x1a95ff(_0x23741e[_0x666c('0x15')][_0x666c('0x14')]);}})[_0x666c('0x16')](function(_0x324a40){logger[_0x666c('0x12')](_0x666c('0xe'),_0x400c4d,_0x324a40);_0x67cd2a(_0x324a40);});});}exports['CreateSmsQueueReport']=function(_0x209fd1){var _0x121a23=this;return new Promise(function(_0x949df0,_0x47effd){return db[_0x666c('0x17')][_0x666c('0x18')](_0x209fd1[_0x666c('0x19')],{'raw':_0x209fd1[_0x666c('0x1a')]?_0x209fd1['options'][_0x666c('0x1b')]===undefined?!![]:![]:!![]})[_0x666c('0xc')](function(_0xdda736){logger[_0x666c('0xd')](_0x666c('0x1c'),_0x209fd1);logger[_0x666c('0x10')]('CreateSmsQueueReport',_0x209fd1,JSON[_0x666c('0x1d')](_0xdda736));_0x949df0(_0xdda736);})[_0x666c('0x16')](function(_0x1f095c){logger['error'](_0x666c('0x1c'),_0x1f095c[_0x666c('0x14')],_0x209fd1);_0x47effd(_0x121a23[_0x666c('0x12')](0x1f4,_0x1f095c[_0x666c('0x14')]));});});};exports[_0x666c('0x1e')]=function(_0x9c8609){var _0x58e0a0=this;return new Promise(function(_0x2400cd,_0x1e0e2b){return db[_0x666c('0x17')][_0x666c('0x1f')](_0x9c8609[_0x666c('0x19')],{'raw':_0x9c8609['options']?_0x9c8609[_0x666c('0x1a')][_0x666c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9c8609['options']?_0x9c8609[_0x666c('0x1a')][_0x666c('0x20')]||null:null,'attributes':_0x9c8609['options']?_0x9c8609['options'][_0x666c('0x21')]||null:null,'limit':_0x9c8609[_0x666c('0x1a')]?_0x9c8609[_0x666c('0x1a')][_0x666c('0x22')]||null:null})[_0x666c('0xc')](function(_0x2d3878){logger['info']('UpdateSmsQueueReport',_0x9c8609);logger['debug'](_0x666c('0x1e'),_0x9c8609,JSON[_0x666c('0x1d')](_0x2d3878));_0x2400cd(_0x2d3878);})['catch'](function(_0x1bf0f4){logger['error'](_0x666c('0x1e'),_0x1bf0f4[_0x666c('0x14')],_0x9c8609);_0x1e0e2b(_0x58e0a0[_0x666c('0x12')](0x1f4,_0x1bf0f4[_0x666c('0x14')]));});});};
\ No newline at end of file
+var _0x2453=['body','options','UpdateSmsQueueReport','SmsQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','create'];(function(_0x55fb18,_0x22ca43){var _0x4c7217=function(_0x3bac21){while(--_0x3bac21){_0x55fb18['push'](_0x55fb18['shift']());}};_0x4c7217(++_0x22ca43);}(_0x2453,0x167));var _0x3245=function(_0x202e4d,_0x4684f9){_0x202e4d=_0x202e4d-0x0;var _0x1d113c=_0x2453[_0x202e4d];return _0x1d113c;};'use strict';var _=require(_0x3245('0x0'));var util=require(_0x3245('0x1'));var moment=require(_0x3245('0x2'));var BPromise=require(_0x3245('0x3'));var rs=require(_0x3245('0x4'));var fs=require('fs');var Redis=require(_0x3245('0x5'));var db=require(_0x3245('0x6'))['db'];var utils=require(_0x3245('0x7'));var logger=require(_0x3245('0x8'))(_0x3245('0x9'));var config=require(_0x3245('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3245('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d3af7,_0x3dfcd2,_0x17e7b2){return new BPromise(function(_0x189054,_0x5e6273){return client[_0x3245('0xc')](_0x4d3af7,_0x17e7b2)[_0x3245('0xd')](function(_0x1316eb){logger['info'](_0x3245('0xe'),_0x3dfcd2,_0x3245('0xf'));logger[_0x3245('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3dfcd2,'request\x20sent',JSON[_0x3245('0x11')](_0x1316eb));if(_0x1316eb[_0x3245('0x12')]){if(_0x1316eb[_0x3245('0x12')][_0x3245('0x13')]===0x1f4){logger['error'](_0x3245('0xe'),_0x3dfcd2,_0x1316eb['error'][_0x3245('0x14')]);return _0x5e6273(_0x1316eb[_0x3245('0x12')][_0x3245('0x14')]);}logger[_0x3245('0x12')](_0x3245('0xe'),_0x3dfcd2,_0x1316eb[_0x3245('0x12')][_0x3245('0x14')]);return _0x189054(_0x1316eb[_0x3245('0x12')][_0x3245('0x14')]);}else{logger[_0x3245('0x15')](_0x3245('0xe'),_0x3dfcd2,_0x3245('0xf'));_0x189054(_0x1316eb[_0x3245('0x16')]['message']);}})[_0x3245('0x17')](function(_0x4929d1){logger['error'](_0x3245('0xe'),_0x3dfcd2,_0x4929d1);_0x5e6273(_0x4929d1);});});}exports[_0x3245('0x18')]=function(_0x59c491){var _0x2f2b10=this;return new Promise(function(_0x24f3f8,_0x4f1d64){return db['SmsQueueReport'][_0x3245('0x19')](_0x59c491[_0x3245('0x1a')],{'raw':_0x59c491[_0x3245('0x1b')]?_0x59c491[_0x3245('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3245('0xd')](function(_0x57be78){logger[_0x3245('0x15')](_0x3245('0x18'),_0x59c491);logger['debug'](_0x3245('0x18'),_0x59c491,JSON[_0x3245('0x11')](_0x57be78));_0x24f3f8(_0x57be78);})['catch'](function(_0x47c690){logger[_0x3245('0x12')](_0x3245('0x18'),_0x47c690['message'],_0x59c491);_0x4f1d64(_0x2f2b10[_0x3245('0x12')](0x1f4,_0x47c690['message']));});});};exports[_0x3245('0x1c')]=function(_0x5ce877){var _0x396e83=this;return new Promise(function(_0x3a8e07,_0x1d3cbd){return db[_0x3245('0x1d')][_0x3245('0x1e')](_0x5ce877[_0x3245('0x1a')],{'raw':_0x5ce877[_0x3245('0x1b')]?_0x5ce877[_0x3245('0x1b')][_0x3245('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce877['options']?_0x5ce877['options'][_0x3245('0x20')]||null:null,'attributes':_0x5ce877[_0x3245('0x1b')]?_0x5ce877[_0x3245('0x1b')][_0x3245('0x21')]||null:null,'limit':_0x5ce877[_0x3245('0x1b')]?_0x5ce877[_0x3245('0x1b')][_0x3245('0x22')]||null:null})[_0x3245('0xd')](function(_0x2ce8a2){logger[_0x3245('0x15')]('UpdateSmsQueueReport',_0x5ce877);logger[_0x3245('0x10')]('UpdateSmsQueueReport',_0x5ce877,JSON[_0x3245('0x11')](_0x2ce8a2));_0x3a8e07(_0x2ce8a2);})[_0x3245('0x17')](function(_0x9341b4){logger[_0x3245('0x12')](_0x3245('0x1c'),_0x9341b4[_0x3245('0x14')],_0x5ce877);_0x1d3cbd(_0x396e83[_0x3245('0x12')](0x1f4,_0x9341b4['message']));});});};
\ No newline at end of file
index d530043..3969222 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfe8=['describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x553a87,_0x1d621f){var _0x12d1e6=function(_0x41ae48){while(--_0x41ae48){_0x553a87['push'](_0x553a87['shift']());}};_0x12d1e6(++_0x1d621f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x262e53,_0x5a9acd){_0x262e53=_0x262e53-0x0;var _0x5bcca7=_0xbfe8[_0x262e53];return _0x5bcca7;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bfe('0x3'));var interaction=require(_0x8bfe('0x4'));var config=require('../../config/environment');var controller=require(_0x8bfe('0x5'));router[_0x8bfe('0x6')]('/',auth[_0x8bfe('0x7')](),controller['index']);router[_0x8bfe('0x6')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0x6')](_0x8bfe('0xa'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0xc')]('/',auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')](_0x8bfe('0xa'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xf')]);router['delete'](_0x8bfe('0xa'),auth['isAuthenticated'](),controller[_0x8bfe('0x10')]);module[_0x8bfe('0x11')]=router;
\ No newline at end of file
+var _0xe0c3=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x33a3a1,_0x325366){var _0x1c1b70=function(_0x5c3e95){while(--_0x5c3e95){_0x33a3a1['push'](_0x33a3a1['shift']());}};_0x1c1b70(++_0x325366);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3e0c('0x0'));var util=require('util');var path=require(_0x3e0c('0x1'));var timeout=require(_0x3e0c('0x2'));var express=require(_0x3e0c('0x3'));var router=express[_0x3e0c('0x4')]();var fs_extra=require(_0x3e0c('0x5'));var auth=require(_0x3e0c('0x6'));var interaction=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var controller=require(_0x3e0c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3e0c('0xa')]);router[_0x3e0c('0xb')](_0x3e0c('0xc'),auth[_0x3e0c('0xd')](),controller[_0x3e0c('0xe')]);router[_0x3e0c('0xb')](_0x3e0c('0xf'),auth[_0x3e0c('0xd')](),controller[_0x3e0c('0x10')]);router[_0x3e0c('0x11')]('/',auth[_0x3e0c('0xd')](),controller['create']);router['put'](_0x3e0c('0xf'),auth[_0x3e0c('0xd')](),controller[_0x3e0c('0x12')]);router[_0x3e0c('0x13')](_0x3e0c('0xf'),auth[_0x3e0c('0xd')](),controller[_0x3e0c('0x14')]);module['exports']=router;
\ No newline at end of file
index 375da4b..f054dd2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4d8790,_0x521730){var _0x5e99c4=function(_0x3c34af){while(--_0x3c34af){_0x4d8790['push'](_0x4d8790['shift']());}};_0x5e99c4(++_0x521730);}(_0x54ef,0x112));var _0xf54e=function(_0x5f18d7,_0x3f3953){_0x5f18d7=_0x5f18d7-0x0;var _0xff43dd=_0x54ef[_0x5f18d7];return _0xff43dd;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}};
\ No newline at end of file
+var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x9bde,0xe1));var _0xe9bd=function(_0xc98702,_0x40a9f4){_0xc98702=_0xc98702-0x0;var _0x33ff9d=_0x9bde[_0xc98702];return _0x33ff9d;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}};
\ No newline at end of file
index 392d8b5..2f263df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9703=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto'];(function(_0x398494,_0x535c06){var _0x5019fa=function(_0x1da351){while(--_0x1da351){_0x398494['push'](_0x398494['shift']());}};_0x5019fa(++_0x535c06);}(_0x9703,0x16c));var _0x3970=function(_0x155fca,_0xbad4f2){_0x155fca=_0x155fca-0x0;var _0x2320da=_0x9703[_0x155fca];return _0x2320da;};'use strict';var emlformat=require(_0x3970('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3970('0x1'));var rp=require(_0x3970('0x2'));var moment=require('moment');var BPromise=require(_0x3970('0x3'));var Mustache=require(_0x3970('0x4'));var util=require(_0x3970('0x5'));var path=require(_0x3970('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3970('0x7'));var _=require(_0x3970('0x8'));var squel=require(_0x3970('0x9'));var crypto=require(_0x3970('0xa'));var jsforce=require(_0x3970('0xb'));var deskjs=require(_0x3970('0xc'));var toCsv=require(_0x3970('0xd'));var querystring=require(_0x3970('0xe'));var Papa=require(_0x3970('0xf'));var Redis=require(_0x3970('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3970('0x11'));var as=require(_0x3970('0x12'));var hardwareService=require(_0x3970('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3970('0x14'));var config=require(_0x3970('0x15'));var licenseUtil=require(_0x3970('0x16'));var db=require(_0x3970('0x17'))['db'];function respondWithStatusCode(_0x3e7a52,_0x404542){_0x404542=_0x404542||0xcc;return function(_0x5aa2b6){if(_0x5aa2b6){return _0x3e7a52[_0x3970('0x18')](_0x404542);}return _0x3e7a52[_0x3970('0x19')](_0x404542)[_0x3970('0x1a')]();};}function respondWithResult(_0x20bdd0,_0x2cd03c){_0x2cd03c=_0x2cd03c||0xc8;return function(_0x1a81ab){if(_0x1a81ab){return _0x20bdd0[_0x3970('0x19')](_0x2cd03c)[_0x3970('0x1b')](_0x1a81ab);}};}function respondWithFilteredResult(_0x5bc498,_0x1362af){return function(_0x123550){if(_0x123550){var _0x3ce17d=typeof _0x1362af[_0x3970('0x1c')]==='undefined'&&typeof _0x1362af[_0x3970('0x1d')]===_0x3970('0x1e');var _0x2df225=_0x123550['count'];var _0x2467f4=_0x3ce17d?0x0:_0x1362af[_0x3970('0x1c')];var _0x3f0aa6=_0x3ce17d?_0x123550[_0x3970('0x1f')]:_0x1362af[_0x3970('0x1c')]+_0x1362af[_0x3970('0x1d')];var _0x2b4b82;if(_0x3f0aa6>=_0x2df225){_0x3f0aa6=_0x2df225;_0x2b4b82=0xc8;}else{_0x2b4b82=0xce;}_0x5bc498['status'](_0x2b4b82);return _0x5bc498[_0x3970('0x20')]('Content-Range',_0x2467f4+'-'+_0x3f0aa6+'/'+_0x2df225)[_0x3970('0x1b')](_0x123550);}return null;};}function patchUpdates(_0x413ec5){return function(_0xa366a9){try{jsonpatch[_0x3970('0x21')](_0xa366a9,_0x413ec5,!![]);}catch(_0x5cecdd){return BPromise[_0x3970('0x22')](_0x5cecdd);}return _0xa366a9[_0x3970('0x23')]();};}function saveUpdates(_0x1218c4,_0x57dcfb){return function(_0x57505a){if(_0x57505a){return _0x57505a[_0x3970('0x24')](_0x1218c4)[_0x3970('0x25')](function(_0x564592){return _0x564592;});}return null;};}function removeEntity(_0x44f653,_0x1096e7){return function(_0x3a2b80){if(_0x3a2b80){return _0x3a2b80[_0x3970('0x26')]()[_0x3970('0x25')](function(){_0x44f653[_0x3970('0x19')](0xcc)[_0x3970('0x1a')]();});}};}function handleEntityNotFound(_0x3d7327,_0x49b128){return function(_0x5a660f){if(!_0x5a660f){_0x3d7327[_0x3970('0x18')](0x194);}return _0x5a660f;};}function handleError(_0x225667,_0x4efed8){_0x4efed8=_0x4efed8||0x1f4;return function(_0x2e9c5c){logger[_0x3970('0x27')](_0x2e9c5c[_0x3970('0x28')]);if(_0x2e9c5c[_0x3970('0x29')]){delete _0x2e9c5c[_0x3970('0x29')];}_0x225667[_0x3970('0x19')](_0x4efed8)['send'](_0x2e9c5c);};}exports['index']=function(_0x48adeb,_0x1bedee){var _0x1d4a76={},_0x494a37={},_0x198890={'count':0x0,'rows':[]};var _0x381150=_[_0x3970('0x2a')](db[_0x3970('0x2b')][_0x3970('0x2c')],function(_0x35dc69){return{'name':_0x35dc69[_0x3970('0x2d')],'type':_0x35dc69['type'][_0x3970('0x2e')]};});_0x494a37[_0x3970('0x2f')]=_[_0x3970('0x2a')](_0x381150,_0x3970('0x29'));_0x494a37[_0x3970('0x30')]=_[_0x3970('0x31')](_0x48adeb[_0x3970('0x30')]);_0x494a37[_0x3970('0x32')]=_['intersection'](_0x494a37['model'],_0x494a37[_0x3970('0x30')]);_0x1d4a76[_0x3970('0x33')]=_[_0x3970('0x34')](_0x494a37[_0x3970('0x2f')],qs['fields'](_0x48adeb[_0x3970('0x30')][_0x3970('0x35')]));_0x1d4a76[_0x3970('0x33')]=_0x1d4a76[_0x3970('0x33')][_0x3970('0x36')]?_0x1d4a76['attributes']:_0x494a37[_0x3970('0x2f')];if(!_0x48adeb[_0x3970('0x30')][_0x3970('0x37')](_0x3970('0x38'))){_0x1d4a76[_0x3970('0x1d')]=qs['limit'](_0x48adeb[_0x3970('0x30')]['limit']);_0x1d4a76[_0x3970('0x1c')]=qs[_0x3970('0x1c')](_0x48adeb['query'][_0x3970('0x1c')]);}_0x1d4a76[_0x3970('0x39')]=qs[_0x3970('0x3a')](_0x48adeb[_0x3970('0x30')]['sort']);_0x1d4a76[_0x3970('0x3b')]=qs[_0x3970('0x32')](_['pick'](_0x48adeb[_0x3970('0x30')],_0x494a37[_0x3970('0x32')]),_0x381150);if(_0x48adeb[_0x3970('0x30')][_0x3970('0x3c')]){_0x1d4a76['where']=_[_0x3970('0x3d')](_0x1d4a76['where'],{'$or':_['map'](_0x381150,function(_0x454257){if(_0x454257[_0x3970('0x3e')]!=='VIRTUAL'){var _0x4f209f={};_0x4f209f[_0x454257[_0x3970('0x29')]]={'$like':'%'+_0x48adeb[_0x3970('0x30')][_0x3970('0x3c')]+'%'};return _0x4f209f;}})});}_0x1d4a76=_[_0x3970('0x3d')]({},_0x1d4a76,_0x48adeb[_0x3970('0x3f')]);var _0x356395={'where':_0x1d4a76[_0x3970('0x3b')]};return db['SmsTransferReport'][_0x3970('0x1f')](_0x356395)[_0x3970('0x25')](function(_0x2eb72d){_0x198890[_0x3970('0x1f')]=_0x2eb72d;if(_0x48adeb[_0x3970('0x30')][_0x3970('0x40')]){_0x1d4a76[_0x3970('0x41')]=[{'all':!![]}];}return db[_0x3970('0x2b')][_0x3970('0x42')](_0x1d4a76);})[_0x3970('0x25')](function(_0x49e26f){_0x198890[_0x3970('0x43')]=_0x49e26f;return _0x198890;})[_0x3970('0x25')](respondWithFilteredResult(_0x1bedee,_0x1d4a76))[_0x3970('0x44')](handleError(_0x1bedee,null));};exports[_0x3970('0x45')]=function(_0x3bb7a7,_0x3eb54c){var _0x5af7f9={'raw':!![],'where':{'id':_0x3bb7a7['params']['id']}},_0x5c8c7b={};_0x5c8c7b[_0x3970('0x2f')]=_[_0x3970('0x31')](db[_0x3970('0x2b')]['rawAttributes']);_0x5c8c7b[_0x3970('0x30')]=_[_0x3970('0x31')](_0x3bb7a7[_0x3970('0x30')]);_0x5c8c7b[_0x3970('0x32')]=_[_0x3970('0x34')](_0x5c8c7b[_0x3970('0x2f')],_0x5c8c7b[_0x3970('0x30')]);_0x5af7f9[_0x3970('0x33')]=_[_0x3970('0x34')](_0x5c8c7b[_0x3970('0x2f')],qs[_0x3970('0x35')](_0x3bb7a7['query'][_0x3970('0x35')]));_0x5af7f9[_0x3970('0x33')]=_0x5af7f9[_0x3970('0x33')][_0x3970('0x36')]?_0x5af7f9[_0x3970('0x33')]:_0x5c8c7b[_0x3970('0x2f')];if(_0x3bb7a7[_0x3970('0x30')][_0x3970('0x40')]){_0x5af7f9[_0x3970('0x41')]=[{'all':!![]}];}_0x5af7f9=_[_0x3970('0x3d')]({},_0x5af7f9,_0x3bb7a7[_0x3970('0x3f')]);return db[_0x3970('0x2b')][_0x3970('0x46')](_0x5af7f9)[_0x3970('0x25')](handleEntityNotFound(_0x3eb54c,null))[_0x3970('0x25')](respondWithResult(_0x3eb54c,null))[_0x3970('0x44')](handleError(_0x3eb54c,null));};exports[_0x3970('0x47')]=function(_0x2dc459,_0x11b67c){return db['SmsTransferReport'][_0x3970('0x47')](_0x2dc459['body'],{})['then'](respondWithResult(_0x11b67c,0xc9))[_0x3970('0x44')](handleError(_0x11b67c,null));};exports[_0x3970('0x24')]=function(_0x9b90bc,_0x5aa254){if(_0x9b90bc[_0x3970('0x48')]['id']){delete _0x9b90bc['body']['id'];}return db[_0x3970('0x2b')][_0x3970('0x46')]({'where':{'id':_0x9b90bc[_0x3970('0x49')]['id']}})[_0x3970('0x25')](handleEntityNotFound(_0x5aa254,null))['then'](saveUpdates(_0x9b90bc[_0x3970('0x48')],null))['then'](respondWithResult(_0x5aa254,null))[_0x3970('0x44')](handleError(_0x5aa254,null));};exports[_0x3970('0x26')]=function(_0x2dfdde,_0x25f2a6){return db[_0x3970('0x2b')][_0x3970('0x46')]({'where':{'id':_0x2dfdde[_0x3970('0x49')]['id']}})[_0x3970('0x25')](handleEntityNotFound(_0x25f2a6,null))[_0x3970('0x25')](removeEntity(_0x25f2a6,null))['catch'](handleError(_0x25f2a6,null));};exports[_0x3970('0x4a')]=function(_0x3d2442,_0xd3c1dc){return db[_0x3970('0x2b')]['describe']()[_0x3970('0x25')](respondWithResult(_0xd3c1dc,null))[_0x3970('0x44')](handleError(_0xd3c1dc,null));};
\ No newline at end of file
+var _0xeb43=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','reject','then','stack','name','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','update','describe','eml-format','rimraf','zip-dir'];(function(_0xfebc2a,_0x34f46c){var _0xb999a1=function(_0x29a134){while(--_0x29a134){_0xfebc2a['push'](_0xfebc2a['shift']());}};_0xb999a1(++_0x34f46c);}(_0xeb43,0x1b3));var _0x3eb4=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0xeb43[_0x5814ca];return _0xeb1833;};'use strict';var emlformat=require(_0x3eb4('0x0'));var rimraf=require(_0x3eb4('0x1'));var zipdir=require(_0x3eb4('0x2'));var jsonpatch=require(_0x3eb4('0x3'));var rp=require(_0x3eb4('0x4'));var moment=require(_0x3eb4('0x5'));var BPromise=require(_0x3eb4('0x6'));var Mustache=require(_0x3eb4('0x7'));var util=require(_0x3eb4('0x8'));var path=require(_0x3eb4('0x9'));var sox=require('sox');var csv=require(_0x3eb4('0xa'));var ejs=require(_0x3eb4('0xb'));var fs=require('fs');var fs_extra=require(_0x3eb4('0xc'));var _=require(_0x3eb4('0xd'));var squel=require(_0x3eb4('0xe'));var crypto=require(_0x3eb4('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3eb4('0xa'));var querystring=require(_0x3eb4('0x10'));var Papa=require(_0x3eb4('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3eb4('0x12'));var logger=require(_0x3eb4('0x13'))(_0x3eb4('0x14'));var utils=require(_0x3eb4('0x15'));var config=require(_0x3eb4('0x16'));var licenseUtil=require(_0x3eb4('0x17'));var db=require(_0x3eb4('0x18'))['db'];function respondWithStatusCode(_0x1066ec,_0x529159){_0x529159=_0x529159||0xcc;return function(_0x5ba520){if(_0x5ba520){return _0x1066ec[_0x3eb4('0x19')](_0x529159);}return _0x1066ec['status'](_0x529159)[_0x3eb4('0x1a')]();};}function respondWithResult(_0x498a62,_0x3197b5){_0x3197b5=_0x3197b5||0xc8;return function(_0x331960){if(_0x331960){return _0x498a62[_0x3eb4('0x1b')](_0x3197b5)[_0x3eb4('0x1c')](_0x331960);}};}function respondWithFilteredResult(_0x2971d8,_0x54dd14){return function(_0x2bbbc4){if(_0x2bbbc4){var _0x50e53c=typeof _0x54dd14['offset']===_0x3eb4('0x1d')&&typeof _0x54dd14[_0x3eb4('0x1e')]===_0x3eb4('0x1d');var _0x32f1dd=_0x2bbbc4[_0x3eb4('0x1f')];var _0x3e90ce=_0x50e53c?0x0:_0x54dd14['offset'];var _0x2e91d2=_0x50e53c?_0x2bbbc4[_0x3eb4('0x1f')]:_0x54dd14['offset']+_0x54dd14[_0x3eb4('0x1e')];var _0x22e2d0;if(_0x2e91d2>=_0x32f1dd){_0x2e91d2=_0x32f1dd;_0x22e2d0=0xc8;}else{_0x22e2d0=0xce;}_0x2971d8[_0x3eb4('0x1b')](_0x22e2d0);return _0x2971d8[_0x3eb4('0x20')](_0x3eb4('0x21'),_0x3e90ce+'-'+_0x2e91d2+'/'+_0x32f1dd)[_0x3eb4('0x1c')](_0x2bbbc4);}return null;};}function patchUpdates(_0x234b6c){return function(_0x30a4c2){try{jsonpatch['apply'](_0x30a4c2,_0x234b6c,!![]);}catch(_0x23cc0f){return BPromise[_0x3eb4('0x22')](_0x23cc0f);}return _0x30a4c2['save']();};}function saveUpdates(_0x3bc153,_0x3e892f){return function(_0x51ac5b){if(_0x51ac5b){return _0x51ac5b['update'](_0x3bc153)['then'](function(_0x1644d6){return _0x1644d6;});}return null;};}function removeEntity(_0x254608,_0x4f883e){return function(_0x3bedf7){if(_0x3bedf7){return _0x3bedf7['destroy']()[_0x3eb4('0x23')](function(){_0x254608['status'](0xcc)[_0x3eb4('0x1a')]();});}};}function handleEntityNotFound(_0x5126e5,_0x2e2441){return function(_0x17696b){if(!_0x17696b){_0x5126e5[_0x3eb4('0x19')](0x194);}return _0x17696b;};}function handleError(_0xf5bc78,_0x118c4b){_0x118c4b=_0x118c4b||0x1f4;return function(_0x898c43){logger['error'](_0x898c43[_0x3eb4('0x24')]);if(_0x898c43[_0x3eb4('0x25')]){delete _0x898c43[_0x3eb4('0x25')];}_0xf5bc78['status'](_0x118c4b)['send'](_0x898c43);};}exports['index']=function(_0x2a29f6,_0x4826ab){var _0x520b34={},_0x465d10={},_0x253852={'count':0x0,'rows':[]};var _0x13af07=_[_0x3eb4('0x26')](db[_0x3eb4('0x27')][_0x3eb4('0x28')],function(_0x50ba31){return{'name':_0x50ba31[_0x3eb4('0x29')],'type':_0x50ba31[_0x3eb4('0x2a')][_0x3eb4('0x2b')]};});_0x465d10[_0x3eb4('0x2c')]=_[_0x3eb4('0x26')](_0x13af07,_0x3eb4('0x25'));_0x465d10['query']=_[_0x3eb4('0x2d')](_0x2a29f6[_0x3eb4('0x2e')]);_0x465d10[_0x3eb4('0x2f')]=_[_0x3eb4('0x30')](_0x465d10[_0x3eb4('0x2c')],_0x465d10[_0x3eb4('0x2e')]);_0x520b34[_0x3eb4('0x31')]=_[_0x3eb4('0x30')](_0x465d10[_0x3eb4('0x2c')],qs['fields'](_0x2a29f6[_0x3eb4('0x2e')]['fields']));_0x520b34[_0x3eb4('0x31')]=_0x520b34['attributes'][_0x3eb4('0x32')]?_0x520b34['attributes']:_0x465d10['model'];if(!_0x2a29f6[_0x3eb4('0x2e')][_0x3eb4('0x33')]('nolimit')){_0x520b34['limit']=qs[_0x3eb4('0x1e')](_0x2a29f6[_0x3eb4('0x2e')][_0x3eb4('0x1e')]);_0x520b34[_0x3eb4('0x34')]=qs[_0x3eb4('0x34')](_0x2a29f6[_0x3eb4('0x2e')][_0x3eb4('0x34')]);}_0x520b34[_0x3eb4('0x35')]=qs[_0x3eb4('0x36')](_0x2a29f6[_0x3eb4('0x2e')]['sort']);_0x520b34['where']=qs[_0x3eb4('0x2f')](_[_0x3eb4('0x37')](_0x2a29f6[_0x3eb4('0x2e')],_0x465d10['filters']),_0x13af07);if(_0x2a29f6[_0x3eb4('0x2e')][_0x3eb4('0x38')]){_0x520b34[_0x3eb4('0x39')]=_[_0x3eb4('0x3a')](_0x520b34[_0x3eb4('0x39')],{'$or':_[_0x3eb4('0x26')](_0x13af07,function(_0x16cc0d){if(_0x16cc0d[_0x3eb4('0x2a')]!==_0x3eb4('0x3b')){var _0x1f86df={};_0x1f86df[_0x16cc0d[_0x3eb4('0x25')]]={'$like':'%'+_0x2a29f6[_0x3eb4('0x2e')][_0x3eb4('0x38')]+'%'};return _0x1f86df;}})});}_0x520b34=_['merge']({},_0x520b34,_0x2a29f6['options']);var _0x451fde={'where':_0x520b34[_0x3eb4('0x39')]};return db['SmsTransferReport']['count'](_0x451fde)[_0x3eb4('0x23')](function(_0x17c012){_0x253852[_0x3eb4('0x1f')]=_0x17c012;if(_0x2a29f6[_0x3eb4('0x2e')][_0x3eb4('0x3c')]){_0x520b34['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x3eb4('0x3d')](_0x520b34);})['then'](function(_0x119796){_0x253852[_0x3eb4('0x3e')]=_0x119796;return _0x253852;})['then'](respondWithFilteredResult(_0x4826ab,_0x520b34))[_0x3eb4('0x3f')](handleError(_0x4826ab,null));};exports[_0x3eb4('0x40')]=function(_0x25258c,_0x390c83){var _0x372cd8={'raw':!![],'where':{'id':_0x25258c[_0x3eb4('0x41')]['id']}},_0x5d3e80={};_0x5d3e80[_0x3eb4('0x2c')]=_[_0x3eb4('0x2d')](db['SmsTransferReport'][_0x3eb4('0x28')]);_0x5d3e80[_0x3eb4('0x2e')]=_[_0x3eb4('0x2d')](_0x25258c['query']);_0x5d3e80[_0x3eb4('0x2f')]=_['intersection'](_0x5d3e80[_0x3eb4('0x2c')],_0x5d3e80[_0x3eb4('0x2e')]);_0x372cd8[_0x3eb4('0x31')]=_[_0x3eb4('0x30')](_0x5d3e80[_0x3eb4('0x2c')],qs[_0x3eb4('0x42')](_0x25258c[_0x3eb4('0x2e')]['fields']));_0x372cd8[_0x3eb4('0x31')]=_0x372cd8[_0x3eb4('0x31')][_0x3eb4('0x32')]?_0x372cd8[_0x3eb4('0x31')]:_0x5d3e80[_0x3eb4('0x2c')];if(_0x25258c[_0x3eb4('0x2e')][_0x3eb4('0x3c')]){_0x372cd8[_0x3eb4('0x43')]=[{'all':!![]}];}_0x372cd8=_['merge']({},_0x372cd8,_0x25258c['options']);return db[_0x3eb4('0x27')][_0x3eb4('0x44')](_0x372cd8)['then'](handleEntityNotFound(_0x390c83,null))[_0x3eb4('0x23')](respondWithResult(_0x390c83,null))['catch'](handleError(_0x390c83,null));};exports[_0x3eb4('0x45')]=function(_0x297dff,_0xb3a265){return db[_0x3eb4('0x27')][_0x3eb4('0x45')](_0x297dff[_0x3eb4('0x46')],{})['then'](respondWithResult(_0xb3a265,0xc9))[_0x3eb4('0x3f')](handleError(_0xb3a265,null));};exports[_0x3eb4('0x47')]=function(_0x22c9f7,_0x13815d){if(_0x22c9f7[_0x3eb4('0x46')]['id']){delete _0x22c9f7['body']['id'];}return db['SmsTransferReport'][_0x3eb4('0x44')]({'where':{'id':_0x22c9f7['params']['id']}})['then'](handleEntityNotFound(_0x13815d,null))['then'](saveUpdates(_0x22c9f7[_0x3eb4('0x46')],null))[_0x3eb4('0x23')](respondWithResult(_0x13815d,null))[_0x3eb4('0x3f')](handleError(_0x13815d,null));};exports['destroy']=function(_0x1f5254,_0x1326ab){return db[_0x3eb4('0x27')][_0x3eb4('0x44')]({'where':{'id':_0x1f5254[_0x3eb4('0x41')]['id']}})['then'](handleEntityNotFound(_0x1326ab,null))[_0x3eb4('0x23')](removeEntity(_0x1326ab,null))[_0x3eb4('0x3f')](handleError(_0x1326ab,null));};exports[_0x3eb4('0x48')]=function(_0x20728e,_0x140a02){return db['SmsTransferReport']['describe']()[_0x3eb4('0x23')](respondWithResult(_0x140a02,null))['catch'](handleError(_0x140a02,null));};
\ No newline at end of file
index 8f851cb..a02fdea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x498a=['exports','define','report_sms_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x5b800e,_0x32e114){var _0x1ca4b7=function(_0x5c0aea){while(--_0x5c0aea){_0x5b800e['push'](_0x5b800e['shift']());}};_0x1ca4b7(++_0x32e114);}(_0x498a,0x1bc));var _0xa498=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x498a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa498('0x0'));var util=require(_0xa498('0x1'));var logger=require('../../config/logger')(_0xa498('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa498('0x3'));var fs=require('fs');var path=require(_0xa498('0x4'));var rimraf=require(_0xa498('0x5'));var config=require(_0xa498('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xa498('0x7')]=function(_0x4a8acb,_0x7d2d8b){return _0x4a8acb[_0xa498('0x8')]('SmsTransferReport',attributes,{'tableName':_0xa498('0x9'),'paranoid':![],'indexes':[{'name':_0xa498('0xa'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa179=['moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x59249c,_0x278139){var _0x4b3321=function(_0x306d98){while(--_0x306d98){_0x59249c['push'](_0x59249c['shift']());}};_0x4b3321(++_0x278139);}(_0xa179,0x191));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a17('0x0'));var util=require(_0x9a17('0x1'));var logger=require(_0x9a17('0x2'))(_0x9a17('0x3'));var moment=require(_0x9a17('0x4'));var BPromise=require(_0x9a17('0x5'));var rp=require(_0x9a17('0x6'));var fs=require('fs');var path=require(_0x9a17('0x7'));var rimraf=require(_0x9a17('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a17('0x9'));module[_0x9a17('0xa')]=function(_0x6c3df0,_0x217339){return _0x6c3df0[_0x9a17('0xb')](_0x9a17('0xc'),attributes,{'tableName':_0x9a17('0xd'),'paranoid':![],'indexes':[{'name':_0x9a17('0xe'),'fields':[_0x9a17('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index 7a7357d..689f0ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2dd3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x28fbd6,_0x3ff48f){var _0x267f1b=function(_0x2da9b0){while(--_0x2da9b0){_0x28fbd6['push'](_0x28fbd6['shift']());}};_0x267f1b(++_0x3ff48f);}(_0x2dd3,0x6e));var _0x32dd=function(_0x5bf468,_0x512130){_0x5bf468=_0x5bf468-0x0;var _0x40b3bb=_0x2dd3[_0x5bf468];return _0x40b3bb;};'use strict';var _=require('lodash');var util=require(_0x32dd('0x0'));var moment=require(_0x32dd('0x1'));var BPromise=require(_0x32dd('0x2'));var rs=require(_0x32dd('0x3'));var fs=require('fs');var Redis=require(_0x32dd('0x4'));var db=require(_0x32dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32dd('0x6'))(_0x32dd('0x7'));var config=require(_0x32dd('0x8'));var jayson=require(_0x32dd('0x9'));var client=jayson[_0x32dd('0xa')][_0x32dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f65d9,_0x26f2df,_0xbee4fe){return new BPromise(function(_0x174720,_0x4b1801){return client[_0x32dd('0xc')](_0x3f65d9,_0xbee4fe)['then'](function(_0x37b4c1){logger[_0x32dd('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x26f2df,_0x32dd('0xe'));logger[_0x32dd('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x26f2df,_0x32dd('0xe'),JSON[_0x32dd('0x10')](_0x37b4c1));if(_0x37b4c1[_0x32dd('0x11')]){if(_0x37b4c1[_0x32dd('0x11')]['code']===0x1f4){logger[_0x32dd('0x11')](_0x32dd('0x12'),_0x26f2df,_0x37b4c1[_0x32dd('0x11')][_0x32dd('0x13')]);return _0x4b1801(_0x37b4c1[_0x32dd('0x11')][_0x32dd('0x13')]);}logger[_0x32dd('0x11')](_0x32dd('0x12'),_0x26f2df,_0x37b4c1['error'][_0x32dd('0x13')]);return _0x174720(_0x37b4c1[_0x32dd('0x11')][_0x32dd('0x13')]);}else{logger[_0x32dd('0xd')](_0x32dd('0x12'),_0x26f2df,'request\x20sent');_0x174720(_0x37b4c1[_0x32dd('0x14')][_0x32dd('0x13')]);}})[_0x32dd('0x15')](function(_0x4edac4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x26f2df,_0x4edac4);_0x4b1801(_0x4edac4);});});}
\ No newline at end of file
+var _0xc23a=['jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x36206d,_0xfb581d){var _0x38affe=function(_0x184c86){while(--_0x184c86){_0x36206d['push'](_0x36206d['shift']());}};_0x38affe(++_0xfb581d);}(_0xc23a,0xd2));var _0xac23=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0xc23a[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var moment=require(_0xac23('0x1'));var BPromise=require(_0xac23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac23('0x4'))('rpc');var config=require(_0xac23('0x5'));var jayson=require(_0xac23('0x6'));var client=jayson[_0xac23('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47b021,_0x44b7d2,_0x3b6647){return new BPromise(function(_0x20342c,_0x5b2705){return client[_0xac23('0x8')](_0x47b021,_0x3b6647)[_0xac23('0x9')](function(_0x3f5fa6){logger[_0xac23('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,'request\x20sent');logger['debug'](_0xac23('0xb'),_0x44b7d2,_0xac23('0xc'),JSON['stringify'](_0x3f5fa6));if(_0x3f5fa6[_0xac23('0xd')]){if(_0x3f5fa6[_0xac23('0xd')][_0xac23('0xe')]===0x1f4){logger[_0xac23('0xd')](_0xac23('0xf'),_0x44b7d2,_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);return _0x5b2705(_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);}logger[_0xac23('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);return _0x20342c(_0x3f5fa6['error']['message']);}else{logger[_0xac23('0xa')](_0xac23('0xf'),_0x44b7d2,_0xac23('0xc'));_0x20342c(_0x3f5fa6['result'][_0xac23('0x10')]);}})[_0xac23('0x11')](function(_0xaf49de){logger[_0xac23('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,_0xaf49de);_0x5b2705(_0xaf49de);});});}
\ No newline at end of file
index b3f4ed4..9bf9f0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90ed=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','download','diskStorage','join','root','server/files/sounds/original/'];(function(_0x42a5ac,_0x7a6823){var _0x404ae1=function(_0x412820){while(--_0x412820){_0x42a5ac['push'](_0x42a5ac['shift']());}};_0x404ae1(++_0x7a6823);}(_0x90ed,0x97));var _0xd90e=function(_0x3bc9aa,_0x13a0e1){_0x3bc9aa=_0x3bc9aa-0x0;var _0x475579=_0x90ed[_0x3bc9aa];return _0x475579;};'use strict';var multer=require(_0xd90e('0x0'));var util=require(_0xd90e('0x1'));var path=require(_0xd90e('0x2'));var timeout=require(_0xd90e('0x3'));var express=require(_0xd90e('0x4'));var router=express[_0xd90e('0x5')]();var fs_extra=require(_0xd90e('0x6'));var auth=require(_0xd90e('0x7'));var interaction=require(_0xd90e('0x8'));var config=require(_0xd90e('0x9'));var controller=require('./sound.controller');router[_0xd90e('0xa')]('/',auth[_0xd90e('0xb')](),controller[_0xd90e('0xc')]);router[_0xd90e('0xa')](_0xd90e('0xd'),auth[_0xd90e('0xb')](),controller['show']);router[_0xd90e('0xa')]('/:id/download',auth[_0xd90e('0xb')](),controller[_0xd90e('0xe')]);var upload=multer({'storage':multer[_0xd90e('0xf')]({'destination':function(_0x432abe,_0x103ba9,_0x558204){_0x558204(null,path[_0xd90e('0x10')](config[_0xd90e('0x11')],_0xd90e('0x12')));},'filename':function(_0x33190c,_0x940c78,_0x526fa4){_0x940c78[_0xd90e('0x13')]=_0x940c78[_0xd90e('0x13')][_0xd90e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x526fa4(null,util[_0xd90e('0x15')](_0xd90e('0x16'),path[_0xd90e('0x17')](_0x940c78[_0xd90e('0x13')],path[_0xd90e('0x18')](_0x940c78['originalname'])),Date[_0xd90e('0x19')](),path[_0xd90e('0x18')](_0x940c78[_0xd90e('0x13')])));}})});router[_0xd90e('0x1a')]('/',upload[_0xd90e('0x1b')](_0xd90e('0x1c')),controller[_0xd90e('0x1d')]);router[_0xd90e('0x1e')](_0xd90e('0xd'),auth['isAuthenticated'](),controller[_0xd90e('0x1f')]);router[_0xd90e('0x20')](_0xd90e('0xd'),auth[_0xd90e('0xb')](),controller[_0xd90e('0x20')]);module[_0xd90e('0x21')]=router;
\ No newline at end of file
+var _0xd252=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','now','file','create','put','delete','multer'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xd252,0xb3));var _0x2d25=function(_0x134b6e,_0x21b5ca){_0x134b6e=_0x134b6e-0x0;var _0x2229a9=_0xd252[_0x134b6e];return _0x2229a9;};'use strict';var multer=require(_0x2d25('0x0'));var util=require(_0x2d25('0x1'));var path=require(_0x2d25('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d25('0x3'));var router=express[_0x2d25('0x4')]();var fs_extra=require(_0x2d25('0x5'));var auth=require(_0x2d25('0x6'));var interaction=require(_0x2d25('0x7'));var config=require(_0x2d25('0x8'));var controller=require(_0x2d25('0x9'));router[_0x2d25('0xa')]('/',auth[_0x2d25('0xb')](),controller[_0x2d25('0xc')]);router['get'](_0x2d25('0xd'),auth[_0x2d25('0xb')](),controller[_0x2d25('0xe')]);router[_0x2d25('0xa')](_0x2d25('0xf'),auth[_0x2d25('0xb')](),controller[_0x2d25('0x10')]);var upload=multer({'storage':multer[_0x2d25('0x11')]({'destination':function(_0x25ac27,_0x2ced1a,_0x3c76e7){_0x3c76e7(null,path[_0x2d25('0x12')](config[_0x2d25('0x13')],'server/files/sounds/original/'));},'filename':function(_0x390ac0,_0xfc3766,_0x53a611){_0xfc3766[_0x2d25('0x14')]=_0xfc3766['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53a611(null,util[_0x2d25('0x15')](_0x2d25('0x16'),path[_0x2d25('0x17')](_0xfc3766[_0x2d25('0x14')],path[_0x2d25('0x18')](_0xfc3766['originalname'])),Date[_0x2d25('0x19')](),path[_0x2d25('0x18')](_0xfc3766[_0x2d25('0x14')])));}})});router['post']('/',upload['single'](_0x2d25('0x1a')),controller[_0x2d25('0x1b')]);router[_0x2d25('0x1c')](_0x2d25('0xd'),auth[_0x2d25('0xb')](),controller['update']);router[_0x2d25('0x1d')](_0x2d25('0xd'),auth[_0x2d25('0xb')](),controller['delete']);module['exports']=router;
\ No newline at end of file
index 64f5319..54a8fba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x346e=['BIGINT','INTEGER','FLOAT','exports','STRING','name'];(function(_0x284430,_0x48818e){var _0x527a0a=function(_0x35c609){while(--_0x35c609){_0x284430['push'](_0x284430['shift']());}};_0x527a0a(++_0x48818e);}(_0x346e,0x69));var _0xe346=function(_0xdc66e7,_0x13a216){_0xdc66e7=_0xdc66e7-0x0;var _0x1a46af=_0x346e[_0xdc66e7];return _0x1a46af;};'use strict';var Sequelize=require('sequelize');module[_0xe346('0x0')]={'name':{'type':Sequelize[_0xe346('0x1')],'unique':_0xe346('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe346('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xe346('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xe346('0x3')]},'original_channelCount':{'type':Sequelize[_0xe346('0x4')]},'original_bitRate':{'type':Sequelize[_0xe346('0x3')]},'original_sampleRate':{'type':Sequelize[_0xe346('0x4')]},'converted_format':{'type':Sequelize[_0xe346('0x1')]},'converted_duration':{'type':Sequelize[_0xe346('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xe346('0x3')]},'converted_channelCount':{'type':Sequelize[_0xe346('0x4')]},'converted_bitRate':{'type':Sequelize[_0xe346('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0xc098=['FLOAT','BIGINT','sequelize','exports','STRING','name','INTEGER'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc098,0x183));var _0x8c09=function(_0x38fc4e,_0x435455){_0x38fc4e=_0x38fc4e-0x0;var _0x284359=_0xc098[_0x38fc4e];return _0x284359;};'use strict';var Sequelize=require(_0x8c09('0x0'));module[_0x8c09('0x1')]={'name':{'type':Sequelize[_0x8c09('0x2')],'unique':_0x8c09('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8c09('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x8c09('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x8c09('0x4')]},'converted_format':{'type':Sequelize[_0x8c09('0x2')]},'converted_duration':{'type':Sequelize[_0x8c09('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x8c09('0x4')]},'converted_bitRate':{'type':Sequelize[_0x8c09('0x6')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index d547a3d..e1ff3c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00e2=['../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','save','update','then','get','Sounds','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','catch','download','save_name','existsSync','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','join','root','format','%s.%s','converted_format','create','file','originalname','basename','filename','extname','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','end','chmodSync','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x30c662,_0xb48b52){var _0x2428a2=function(_0x48404e){while(--_0x48404e){_0x30c662['push'](_0x30c662['shift']());}};_0x2428a2(++_0xb48b52);}(_0x00e2,0x69));var _0x200e=function(_0x26b9cb,_0x12bc4c){_0x26b9cb=_0x26b9cb-0x0;var _0x3f44e6=_0x00e2[_0x26b9cb];return _0x3f44e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x200e('0x0'));var rp=require(_0x200e('0x1'));var moment=require('moment');var BPromise=require(_0x200e('0x2'));var Mustache=require(_0x200e('0x3'));var util=require('util');var path=require('path');var sox=require(_0x200e('0x4'));var csv=require(_0x200e('0x5'));var ejs=require(_0x200e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x200e('0x7'));var squel=require(_0x200e('0x8'));var crypto=require(_0x200e('0x9'));var jsforce=require(_0x200e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x200e('0x5'));var querystring=require(_0x200e('0xb'));var Papa=require('papaparse');var Redis=require(_0x200e('0xc'));var authService=require(_0x200e('0xd'));var qs=require(_0x200e('0xe'));var as=require(_0x200e('0xf'));var hardwareService=require(_0x200e('0x10'));var logger=require(_0x200e('0x11'))('api');var utils=require(_0x200e('0x12'));var config=require(_0x200e('0x13'));var licenseUtil=require(_0x200e('0x14'));var db=require(_0x200e('0x15'))['db'];function respondWithStatusCode(_0x77fe5c,_0x1bc8c2){_0x1bc8c2=_0x1bc8c2||0xcc;return function(_0x470440){if(_0x470440){return _0x77fe5c['sendStatus'](_0x1bc8c2);}return _0x77fe5c[_0x200e('0x16')](_0x1bc8c2)['end']();};}function respondWithResult(_0x12c205,_0x10a805){_0x10a805=_0x10a805||0xc8;return function(_0x11b284){if(_0x11b284){return _0x12c205[_0x200e('0x16')](_0x10a805)['json'](_0x11b284);}};}function respondWithFilteredResult(_0x726b66,_0x496e3e){return function(_0x9afbc4){if(_0x9afbc4){var _0x354e6a=typeof _0x496e3e[_0x200e('0x17')]===_0x200e('0x18')&&typeof _0x496e3e[_0x200e('0x19')]===_0x200e('0x18');var _0x5cf5f4=_0x9afbc4['count'];var _0x1af069=_0x354e6a?0x0:_0x496e3e[_0x200e('0x17')];var _0x346045=_0x354e6a?_0x9afbc4[_0x200e('0x1a')]:_0x496e3e[_0x200e('0x17')]+_0x496e3e['limit'];var _0x236f61;if(_0x346045>=_0x5cf5f4){_0x346045=_0x5cf5f4;_0x236f61=0xc8;}else{_0x236f61=0xce;}_0x726b66[_0x200e('0x16')](_0x236f61);return _0x726b66[_0x200e('0x1b')]('Content-Range',_0x1af069+'-'+_0x346045+'/'+_0x5cf5f4)[_0x200e('0x1c')](_0x9afbc4);}return null;};}function patchUpdates(_0x24a274){return function(_0x479359){try{jsonpatch['apply'](_0x479359,_0x24a274,!![]);}catch(_0x1d77fb){return BPromise['reject'](_0x1d77fb);}return _0x479359[_0x200e('0x1d')]();};}function saveUpdates(_0x497cd3,_0x3e605f){return function(_0xa930a4){if(_0xa930a4){return _0xa930a4[_0x200e('0x1e')](_0x497cd3)[_0x200e('0x1f')](function(_0x31d8de){return _0x31d8de;});}return null;};}function removeEntity(_0x345729,_0x1c1c63){return function(_0x6a3df0){if(_0x6a3df0){return _0x6a3df0['destroy']()['then'](function(){var _0x5d99ea=_0x6a3df0[_0x200e('0x20')]({'plain':!![]});var _0x4796c1=_0x200e('0x21');return db[_0x200e('0x22')][_0x200e('0x23')]({'where':{'type':_0x4796c1,'resourceId':_0x5d99ea['id']}})[_0x200e('0x1f')](function(){return _0x6a3df0;});})[_0x200e('0x1f')](function(){_0x345729[_0x200e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x278faf,_0x5f195a){return function(_0x277231){if(!_0x277231){_0x278faf[_0x200e('0x24')](0x194);}return _0x277231;};}function handleError(_0xc2303f,_0x2b12f1){_0x2b12f1=_0x2b12f1||0x1f4;return function(_0xb339a6){logger[_0x200e('0x25')](_0xb339a6[_0x200e('0x26')]);if(_0xb339a6[_0x200e('0x27')]){delete _0xb339a6[_0x200e('0x27')];}_0xc2303f[_0x200e('0x16')](_0x2b12f1)[_0x200e('0x28')](_0xb339a6);};}exports[_0x200e('0x29')]=function(_0x4a097d,_0x1e5bbc){var _0x193bc9={},_0x1c1460={},_0x34fc55={'count':0x0,'rows':[]};var _0x43c0db=_['map'](db['Sound']['rawAttributes'],function(_0x1fe479){return{'name':_0x1fe479[_0x200e('0x2a')],'type':_0x1fe479[_0x200e('0x2b')][_0x200e('0x2c')]};});_0x1c1460[_0x200e('0x2d')]=_[_0x200e('0x2e')](_0x43c0db,'name');_0x1c1460[_0x200e('0x2f')]=_[_0x200e('0x30')](_0x4a097d[_0x200e('0x2f')]);_0x1c1460[_0x200e('0x31')]=_[_0x200e('0x32')](_0x1c1460['model'],_0x1c1460['query']);_0x193bc9[_0x200e('0x33')]=_[_0x200e('0x32')](_0x1c1460[_0x200e('0x2d')],qs[_0x200e('0x34')](_0x4a097d[_0x200e('0x2f')][_0x200e('0x34')]));_0x193bc9[_0x200e('0x33')]=_0x193bc9['attributes']['length']?_0x193bc9['attributes']:_0x1c1460[_0x200e('0x2d')];if(!_0x4a097d['query'][_0x200e('0x35')](_0x200e('0x36'))){_0x193bc9[_0x200e('0x19')]=qs[_0x200e('0x19')](_0x4a097d[_0x200e('0x2f')][_0x200e('0x19')]);_0x193bc9[_0x200e('0x17')]=qs[_0x200e('0x17')](_0x4a097d[_0x200e('0x2f')][_0x200e('0x17')]);}_0x193bc9[_0x200e('0x37')]=qs[_0x200e('0x38')](_0x4a097d[_0x200e('0x2f')]['sort']);_0x193bc9[_0x200e('0x39')]=qs[_0x200e('0x31')](_[_0x200e('0x3a')](_0x4a097d[_0x200e('0x2f')],_0x1c1460['filters']),_0x43c0db);if(_0x4a097d[_0x200e('0x2f')][_0x200e('0x3b')]){_0x193bc9[_0x200e('0x39')]=_[_0x200e('0x3c')](_0x193bc9['where'],{'$or':_['map'](_0x43c0db,function(_0x28c6e7){if(_0x28c6e7[_0x200e('0x2b')]!==_0x200e('0x3d')){var _0xcf6941={};_0xcf6941[_0x28c6e7['name']]={'$like':'%'+_0x4a097d[_0x200e('0x2f')][_0x200e('0x3b')]+'%'};return _0xcf6941;}})});}_0x193bc9=_[_0x200e('0x3c')]({},_0x193bc9,_0x4a097d[_0x200e('0x3e')]);var _0x14c261={'where':_0x193bc9[_0x200e('0x39')]};return db[_0x200e('0x3f')]['count'](_0x14c261)[_0x200e('0x1f')](function(_0x402026){_0x34fc55['count']=_0x402026;if(_0x4a097d['query'][_0x200e('0x40')]){_0x193bc9['include']=[{'all':!![]}];}return db[_0x200e('0x3f')][_0x200e('0x41')](_0x193bc9);})['then'](function(_0x127558){_0x34fc55[_0x200e('0x42')]=_0x127558;return _0x34fc55;})[_0x200e('0x1f')](respondWithFilteredResult(_0x1e5bbc,_0x193bc9))['catch'](handleError(_0x1e5bbc,null));};exports[_0x200e('0x43')]=function(_0x1a9ac3,_0x5dfb5d){var _0x1966d5={'raw':!![],'where':{'id':_0x1a9ac3[_0x200e('0x44')]['id']}},_0x19578a={};_0x19578a['model']=_[_0x200e('0x30')](db[_0x200e('0x3f')][_0x200e('0x45')]);_0x19578a['query']=_[_0x200e('0x30')](_0x1a9ac3[_0x200e('0x2f')]);_0x19578a[_0x200e('0x31')]=_[_0x200e('0x32')](_0x19578a[_0x200e('0x2d')],_0x19578a['query']);_0x1966d5[_0x200e('0x33')]=_[_0x200e('0x32')](_0x19578a[_0x200e('0x2d')],qs[_0x200e('0x34')](_0x1a9ac3[_0x200e('0x2f')]['fields']));_0x1966d5[_0x200e('0x33')]=_0x1966d5[_0x200e('0x33')][_0x200e('0x46')]?_0x1966d5[_0x200e('0x33')]:_0x19578a[_0x200e('0x2d')];if(_0x1a9ac3[_0x200e('0x2f')][_0x200e('0x40')]){_0x1966d5[_0x200e('0x47')]=[{'all':!![]}];}_0x1966d5=_['merge']({},_0x1966d5,_0x1a9ac3[_0x200e('0x3e')]);return db[_0x200e('0x3f')][_0x200e('0x48')](_0x1966d5)[_0x200e('0x1f')](handleEntityNotFound(_0x5dfb5d,null))[_0x200e('0x1f')](respondWithResult(_0x5dfb5d,null))[_0x200e('0x49')](handleError(_0x5dfb5d,null));};exports[_0x200e('0x4a')]=function(_0x14e82a,_0x45311a,_0x48b478){return db[_0x200e('0x3f')][_0x200e('0x48')]({'where':{'id':_0x14e82a[_0x200e('0x44')]['id']},'attributes':['name',_0x200e('0x4b'),'converted_format'],'raw':!![]})[_0x200e('0x1f')](handleEntityNotFound(_0x45311a,null))[_0x200e('0x1f')](function(_0x282683){if(_0x282683){if(!fs[_0x200e('0x4c')](path['join'](config['root'],_0x200e('0x4d'),_0x282683['save_name']+'.'+_0x282683['converted_format']))){throw new db[(_0x200e('0x4e'))]['ValidationError'](_0x200e('0x4f'));}return _0x45311a[_0x200e('0x4a')](path[_0x200e('0x50')](config[_0x200e('0x51')],_0x200e('0x4d'),util[_0x200e('0x52')](_0x200e('0x53'),_0x282683[_0x200e('0x4b')],_0x282683[_0x200e('0x54')])),util[_0x200e('0x52')](_0x200e('0x53'),_0x282683[_0x200e('0x27')],_0x282683['converted_format']));}return null;})[_0x200e('0x49')](handleError(_0x45311a,null));};exports[_0x200e('0x55')]=function(_0x1da667,_0x86534f,_0x44ddf3){var _0x5e95af={'name':path['basename'](_0x1da667['file']['originalname'],path['extname'](_0x1da667[_0x200e('0x56')][_0x200e('0x57')])),'save_name':path[_0x200e('0x58')](_0x1da667['file'][_0x200e('0x59')],path[_0x200e('0x5a')](_0x1da667[_0x200e('0x56')]['filename'])),'original_format':path[_0x200e('0x5a')](_0x1da667[_0x200e('0x56')]['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x47a0e2=path['join'](config['root'],_0x200e('0x5b'),_0x1da667['file'][_0x200e('0x59')]);var _0x348947=path[_0x200e('0x50')](config['root'],_0x200e('0x4d'),util[_0x200e('0x52')](_0x200e('0x53'),path['basename'](_0x1da667[_0x200e('0x56')][_0x200e('0x59')],path[_0x200e('0x5a')](_0x1da667[_0x200e('0x56')][_0x200e('0x59')])),_0x5e95af[_0x200e('0x54')]));logger[_0x200e('0x5c')](_0x200e('0x5d'),_0x47a0e2);logger[_0x200e('0x5c')](_0x200e('0x5e'),_0x348947);try{fs['chmodSync'](_0x47a0e2,parseInt('0777',0x8));var _0x2c85ae=sox[_0x200e('0x5f')](_0x47a0e2,_0x348947,{'sampleRate':0x1f40,'format':_0x200e('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c85ae['on'](_0x200e('0x25'),function(_0x572546){fs[_0x200e('0x61')](_0x47a0e2);_0x86534f[_0x200e('0x16')](0x1f4)['send'](_0x572546);});_0x2c85ae['on'](_0x200e('0x62'),function(_0x47479c){_0x5e95af[_0x200e('0x63')]=isNaN(_0x47479c[_0x200e('0x64')])?null:_0x47479c[_0x200e('0x64')]*0x3e8;_0x5e95af[_0x200e('0x65')]=isNaN(_0x47479c[_0x200e('0x66')])?null:_0x47479c[_0x200e('0x66')];_0x5e95af[_0x200e('0x67')]=isNaN(_0x47479c['channelCount'])?null:_0x47479c[_0x200e('0x68')];_0x5e95af[_0x200e('0x69')]=isNaN(_0x47479c[_0x200e('0x6a')])?null:_0x47479c[_0x200e('0x6a')];_0x5e95af['original_sampleRate']=isNaN(_0x47479c[_0x200e('0x6b')])?null:_0x47479c[_0x200e('0x6b')];});_0x2c85ae['on'](_0x200e('0x6c'),function(_0x37e5b7){_0x5e95af[_0x200e('0x6d')]=isNaN(_0x37e5b7[_0x200e('0x64')])?null:_0x37e5b7[_0x200e('0x64')]*0x3e8;_0x5e95af[_0x200e('0x6e')]=isNaN(_0x37e5b7[_0x200e('0x66')])?null:_0x37e5b7[_0x200e('0x66')];_0x5e95af[_0x200e('0x6f')]=isNaN(_0x37e5b7['channelCount'])?null:_0x37e5b7[_0x200e('0x68')];_0x5e95af[_0x200e('0x70')]=isNaN(_0x37e5b7[_0x200e('0x6a')])?null:_0x37e5b7[_0x200e('0x6a')];_0x5e95af[_0x200e('0x71')]=isNaN(_0x37e5b7[_0x200e('0x6b')])?null:_0x37e5b7['sampleRate'];});_0x2c85ae['on'](_0x200e('0x72'),function(){fs[_0x200e('0x73')](_0x348947,parseInt(_0x200e('0x74'),0x8));return db[_0x200e('0x3f')][_0x200e('0x55')](_0x5e95af)[_0x200e('0x1f')](function(_0x4142a2){var _0x525ae1={'role':_0x1da667['body']['role'],'userProfileId':_0x1da667[_0x200e('0x75')][_0x200e('0x76')]};if(!_0x525ae1)throw new Error(_0x200e('0x77'));if(_0x525ae1[_0x200e('0x78')]==='user'){var _0x56de0f=_0x4142a2[_0x200e('0x20')]({'plain':!![]});return db['UserProfileSection'][_0x200e('0x48')]({'where':{'name':'Sounds','userProfileId':_0x525ae1[_0x200e('0x76')]},'raw':!![]})['then'](function(_0x5c2c35){if(_0x5c2c35&&_0x5c2c35['autoAssociation']===0x0){return db[_0x200e('0x22')][_0x200e('0x55')]({'name':_0x56de0f[_0x200e('0x27')],'resourceId':_0x56de0f['id'],'type':_0x5c2c35[_0x200e('0x27')],'sectionId':_0x5c2c35['id']},{})[_0x200e('0x1f')](function(){return _0x4142a2;});}else{return _0x4142a2;}})[_0x200e('0x49')](function(_0x8b5838){logger[_0x200e('0x25')](_0x200e('0x79'),_0x8b5838);throw _0x8b5838;});}return _0x4142a2;})[_0x200e('0x1f')](respondWithResult(_0x86534f,null))[_0x200e('0x49')](handleError(_0x86534f,null));});_0x2c85ae[_0x200e('0x7a')]();}catch(_0x311e2f){_0x86534f[_0x200e('0x16')](0x1f4)[_0x200e('0x28')](_0x311e2f);}};exports[_0x200e('0x1e')]=function(_0x3759ac,_0x21ffd8,_0x1473f5){return db[_0x200e('0x3f')]['find']({'where':{'id':_0x3759ac['params']['id']}})[_0x200e('0x1f')](handleEntityNotFound(_0x21ffd8,null))[_0x200e('0x1f')](saveUpdates(_['pick'](_0x3759ac[_0x200e('0x75')],[_0x200e('0x27'),_0x200e('0x7b')]),null))[_0x200e('0x1f')](respondWithResult(_0x21ffd8,null))[_0x200e('0x49')](handleError(_0x21ffd8,null));};exports[_0x200e('0x7c')]=function(_0x349d3c,_0x225e13,_0x427000){return db['Sound'][_0x200e('0x48')]({'where':{'id':_0x349d3c['params']['id']}})['then'](function(_0x49bc35){if(_0x49bc35){return _0x49bc35['destroy']();}})[_0x200e('0x1f')](function(_0x2285b5){var _0x39e9d9=path[_0x200e('0x50')](config['root'],_0x200e('0x5b'),util[_0x200e('0x52')](_0x200e('0x53'),_0x2285b5[_0x200e('0x4b')],_0x2285b5['original_format']));var _0x2550a2=path[_0x200e('0x50')](config[_0x200e('0x51')],_0x200e('0x4d'),util[_0x200e('0x52')](_0x200e('0x53'),_0x2285b5['save_name'],_0x2285b5[_0x200e('0x54')]));fs['unlinkSync'](_0x39e9d9);fs['unlinkSync'](_0x2550a2);return _0x2285b5;})['then'](function(_0x838f6c){if(_0x838f6c){return _0x225e13[_0x200e('0x16')](0xcc)[_0x200e('0x72')]();}})[_0x200e('0x1f')](handleEntityNotFound(_0x225e13,null))[_0x200e('0x49')](handleError(_0x225e13,null));};
\ No newline at end of file
+var _0x6a74=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','apply','reject','save','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','send','index','map','Sound','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','rows','rawAttributes','include','find','download','params','converted_format','existsSync','root','save_name','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','catch','create','basename','originalname','extname','file','filename','substring','wav','join','server/files/sounds/converted','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','pick','body','description','delete','server/files/sounds/original','original_format','eml-format'];(function(_0x24c970,_0x1199ef){var _0x48f700=function(_0x5d22fe){while(--_0x5d22fe){_0x24c970['push'](_0x24c970['shift']());}};_0x48f700(++_0x1199ef);}(_0x6a74,0xfd));var _0x46a7=function(_0x8b2a7f,_0x5987a7){_0x8b2a7f=_0x8b2a7f-0x0;var _0x2116e4=_0x6a74[_0x8b2a7f];return _0x2116e4;};'use strict';var emlformat=require(_0x46a7('0x0'));var rimraf=require(_0x46a7('0x1'));var zipdir=require(_0x46a7('0x2'));var jsonpatch=require(_0x46a7('0x3'));var rp=require(_0x46a7('0x4'));var moment=require(_0x46a7('0x5'));var BPromise=require(_0x46a7('0x6'));var Mustache=require(_0x46a7('0x7'));var util=require(_0x46a7('0x8'));var path=require(_0x46a7('0x9'));var sox=require('sox');var csv=require(_0x46a7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46a7('0xb'));var squel=require(_0x46a7('0xc'));var crypto=require(_0x46a7('0xd'));var jsforce=require(_0x46a7('0xe'));var deskjs=require(_0x46a7('0xf'));var toCsv=require(_0x46a7('0xa'));var querystring=require(_0x46a7('0x10'));var Papa=require('papaparse');var Redis=require(_0x46a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x46a7('0x12'));var as=require(_0x46a7('0x13'));var hardwareService=require(_0x46a7('0x14'));var logger=require('../../config/logger')(_0x46a7('0x15'));var utils=require('../../config/utils');var config=require(_0x46a7('0x16'));var licenseUtil=require(_0x46a7('0x17'));var db=require(_0x46a7('0x18'))['db'];function respondWithStatusCode(_0x2c9363,_0x12e087){_0x12e087=_0x12e087||0xcc;return function(_0x2a14e7){if(_0x2a14e7){return _0x2c9363[_0x46a7('0x19')](_0x12e087);}return _0x2c9363[_0x46a7('0x1a')](_0x12e087)['end']();};}function respondWithResult(_0x367381,_0x5f553f){_0x5f553f=_0x5f553f||0xc8;return function(_0x44d7c7){if(_0x44d7c7){return _0x367381[_0x46a7('0x1a')](_0x5f553f)['json'](_0x44d7c7);}};}function respondWithFilteredResult(_0x19f187,_0x1a7a72){return function(_0x369768){if(_0x369768){var _0x20d9f0=typeof _0x1a7a72[_0x46a7('0x1b')]==='undefined'&&typeof _0x1a7a72[_0x46a7('0x1c')]===_0x46a7('0x1d');var _0x1e8eca=_0x369768[_0x46a7('0x1e')];var _0x290873=_0x20d9f0?0x0:_0x1a7a72[_0x46a7('0x1b')];var _0x1b6880=_0x20d9f0?_0x369768[_0x46a7('0x1e')]:_0x1a7a72[_0x46a7('0x1b')]+_0x1a7a72[_0x46a7('0x1c')];var _0x4c2982;if(_0x1b6880>=_0x1e8eca){_0x1b6880=_0x1e8eca;_0x4c2982=0xc8;}else{_0x4c2982=0xce;}_0x19f187[_0x46a7('0x1a')](_0x4c2982);return _0x19f187[_0x46a7('0x1f')]('Content-Range',_0x290873+'-'+_0x1b6880+'/'+_0x1e8eca)['json'](_0x369768);}return null;};}function patchUpdates(_0x58e6d3){return function(_0x1e24c6){try{jsonpatch[_0x46a7('0x20')](_0x1e24c6,_0x58e6d3,!![]);}catch(_0x3778e2){return BPromise[_0x46a7('0x21')](_0x3778e2);}return _0x1e24c6[_0x46a7('0x22')]();};}function saveUpdates(_0x5eef91,_0x18a7fd){return function(_0x269661){if(_0x269661){return _0x269661['update'](_0x5eef91)[_0x46a7('0x23')](function(_0x5553e4){return _0x5553e4;});}return null;};}function removeEntity(_0x205cfa,_0x484bd9){return function(_0xfeba6c){if(_0xfeba6c){return _0xfeba6c['destroy']()['then'](function(){var _0x3e94b4=_0xfeba6c[_0x46a7('0x24')]({'plain':!![]});var _0x1392f0=_0x46a7('0x25');return db[_0x46a7('0x26')][_0x46a7('0x27')]({'where':{'type':_0x1392f0,'resourceId':_0x3e94b4['id']}})[_0x46a7('0x23')](function(){return _0xfeba6c;});})[_0x46a7('0x23')](function(){_0x205cfa[_0x46a7('0x1a')](0xcc)[_0x46a7('0x28')]();});}};}function handleEntityNotFound(_0x58d7d6,_0xfc840e){return function(_0x7e3082){if(!_0x7e3082){_0x58d7d6[_0x46a7('0x19')](0x194);}return _0x7e3082;};}function handleError(_0x7d3aec,_0x54f609){_0x54f609=_0x54f609||0x1f4;return function(_0x3507cc){logger[_0x46a7('0x29')](_0x3507cc[_0x46a7('0x2a')]);if(_0x3507cc[_0x46a7('0x2b')]){delete _0x3507cc[_0x46a7('0x2b')];}_0x7d3aec[_0x46a7('0x1a')](_0x54f609)[_0x46a7('0x2c')](_0x3507cc);};}exports[_0x46a7('0x2d')]=function(_0x393ef0,_0xe7046e){var _0x5ad839={},_0x417d91={},_0x18d04f={'count':0x0,'rows':[]};var _0x5bb90e=_[_0x46a7('0x2e')](db[_0x46a7('0x2f')]['rawAttributes'],function(_0x285900){return{'name':_0x285900[_0x46a7('0x30')],'type':_0x285900['type']['key']};});_0x417d91[_0x46a7('0x31')]=_[_0x46a7('0x2e')](_0x5bb90e,'name');_0x417d91['query']=_[_0x46a7('0x32')](_0x393ef0['query']);_0x417d91[_0x46a7('0x33')]=_[_0x46a7('0x34')](_0x417d91[_0x46a7('0x31')],_0x417d91[_0x46a7('0x35')]);_0x5ad839[_0x46a7('0x36')]=_[_0x46a7('0x34')](_0x417d91[_0x46a7('0x31')],qs[_0x46a7('0x37')](_0x393ef0[_0x46a7('0x35')]['fields']));_0x5ad839[_0x46a7('0x36')]=_0x5ad839[_0x46a7('0x36')][_0x46a7('0x38')]?_0x5ad839[_0x46a7('0x36')]:_0x417d91[_0x46a7('0x31')];if(!_0x393ef0['query'][_0x46a7('0x39')](_0x46a7('0x3a'))){_0x5ad839[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0x393ef0[_0x46a7('0x35')][_0x46a7('0x1c')]);_0x5ad839['offset']=qs[_0x46a7('0x1b')](_0x393ef0[_0x46a7('0x35')][_0x46a7('0x1b')]);}_0x5ad839[_0x46a7('0x3b')]=qs[_0x46a7('0x3c')](_0x393ef0[_0x46a7('0x35')][_0x46a7('0x3c')]);_0x5ad839[_0x46a7('0x3d')]=qs[_0x46a7('0x33')](_['pick'](_0x393ef0[_0x46a7('0x35')],_0x417d91[_0x46a7('0x33')]),_0x5bb90e);if(_0x393ef0['query']['filter']){_0x5ad839[_0x46a7('0x3d')]=_[_0x46a7('0x3e')](_0x5ad839[_0x46a7('0x3d')],{'$or':_['map'](_0x5bb90e,function(_0x1efeef){if(_0x1efeef[_0x46a7('0x3f')]!==_0x46a7('0x40')){var _0x4caa70={};_0x4caa70[_0x1efeef['name']]={'$like':'%'+_0x393ef0[_0x46a7('0x35')][_0x46a7('0x41')]+'%'};return _0x4caa70;}})});}_0x5ad839=_[_0x46a7('0x3e')]({},_0x5ad839,_0x393ef0[_0x46a7('0x42')]);var _0x346cbd={'where':_0x5ad839['where']};return db['Sound'][_0x46a7('0x1e')](_0x346cbd)['then'](function(_0x1712fd){_0x18d04f[_0x46a7('0x1e')]=_0x1712fd;if(_0x393ef0[_0x46a7('0x35')]['includeAll']){_0x5ad839['include']=[{'all':!![]}];}return db[_0x46a7('0x2f')][_0x46a7('0x43')](_0x5ad839);})[_0x46a7('0x23')](function(_0x5c835a){_0x18d04f[_0x46a7('0x44')]=_0x5c835a;return _0x18d04f;})[_0x46a7('0x23')](respondWithFilteredResult(_0xe7046e,_0x5ad839))['catch'](handleError(_0xe7046e,null));};exports['show']=function(_0x5f2e0c,_0x5e7548){var _0x4a9909={'raw':!![],'where':{'id':_0x5f2e0c['params']['id']}},_0x4a7e00={};_0x4a7e00[_0x46a7('0x31')]=_['keys'](db[_0x46a7('0x2f')][_0x46a7('0x45')]);_0x4a7e00[_0x46a7('0x35')]=_[_0x46a7('0x32')](_0x5f2e0c['query']);_0x4a7e00[_0x46a7('0x33')]=_[_0x46a7('0x34')](_0x4a7e00[_0x46a7('0x31')],_0x4a7e00[_0x46a7('0x35')]);_0x4a9909[_0x46a7('0x36')]=_['intersection'](_0x4a7e00['model'],qs[_0x46a7('0x37')](_0x5f2e0c[_0x46a7('0x35')][_0x46a7('0x37')]));_0x4a9909[_0x46a7('0x36')]=_0x4a9909[_0x46a7('0x36')][_0x46a7('0x38')]?_0x4a9909[_0x46a7('0x36')]:_0x4a7e00[_0x46a7('0x31')];if(_0x5f2e0c[_0x46a7('0x35')]['includeAll']){_0x4a9909[_0x46a7('0x46')]=[{'all':!![]}];}_0x4a9909=_[_0x46a7('0x3e')]({},_0x4a9909,_0x5f2e0c[_0x46a7('0x42')]);return db[_0x46a7('0x2f')][_0x46a7('0x47')](_0x4a9909)[_0x46a7('0x23')](handleEntityNotFound(_0x5e7548,null))[_0x46a7('0x23')](respondWithResult(_0x5e7548,null))['catch'](handleError(_0x5e7548,null));};exports[_0x46a7('0x48')]=function(_0x460c40,_0x552260,_0x9d2a10){return db[_0x46a7('0x2f')]['find']({'where':{'id':_0x460c40[_0x46a7('0x49')]['id']},'attributes':[_0x46a7('0x2b'),'save_name',_0x46a7('0x4a')],'raw':!![]})[_0x46a7('0x23')](handleEntityNotFound(_0x552260,null))[_0x46a7('0x23')](function(_0x2e0a4f){if(_0x2e0a4f){if(!fs[_0x46a7('0x4b')](path['join'](config[_0x46a7('0x4c')],'server/files/sounds/converted',_0x2e0a4f[_0x46a7('0x4d')]+'.'+_0x2e0a4f['converted_format']))){throw new db[(_0x46a7('0x4e'))][(_0x46a7('0x4f'))](_0x46a7('0x50'));}return _0x552260[_0x46a7('0x48')](path['join'](config[_0x46a7('0x4c')],'server/files/sounds/converted',util['format'](_0x46a7('0x51'),_0x2e0a4f[_0x46a7('0x4d')],_0x2e0a4f['converted_format'])),util['format'](_0x46a7('0x51'),_0x2e0a4f[_0x46a7('0x2b')],_0x2e0a4f[_0x46a7('0x4a')]));}return null;})[_0x46a7('0x52')](handleError(_0x552260,null));};exports[_0x46a7('0x53')]=function(_0x51c825,_0x14d95d,_0x5f26ad){var _0x3a1332={'name':path[_0x46a7('0x54')](_0x51c825['file'][_0x46a7('0x55')],path[_0x46a7('0x56')](_0x51c825[_0x46a7('0x57')]['originalname'])),'save_name':path['basename'](_0x51c825[_0x46a7('0x57')]['filename'],path[_0x46a7('0x56')](_0x51c825[_0x46a7('0x57')][_0x46a7('0x58')])),'original_format':path[_0x46a7('0x56')](_0x51c825['file'][_0x46a7('0x55')])[_0x46a7('0x59')](0x1),'converted_format':_0x46a7('0x5a')};var _0x4f74d=path[_0x46a7('0x5b')](config[_0x46a7('0x4c')],'server/files/sounds/original',_0x51c825['file'][_0x46a7('0x58')]);var _0x4fcda2=path[_0x46a7('0x5b')](config['root'],_0x46a7('0x5c'),util[_0x46a7('0x5d')](_0x46a7('0x51'),path[_0x46a7('0x54')](_0x51c825[_0x46a7('0x57')][_0x46a7('0x58')],path['extname'](_0x51c825[_0x46a7('0x57')][_0x46a7('0x58')])),_0x3a1332[_0x46a7('0x4a')]));logger[_0x46a7('0x5e')](_0x46a7('0x5f'),_0x4f74d);logger[_0x46a7('0x5e')](_0x46a7('0x60'),_0x4fcda2);try{fs[_0x46a7('0x61')](_0x4f74d,parseInt(_0x46a7('0x62'),0x8));var _0xeca9d9=sox[_0x46a7('0x63')](_0x4f74d,_0x4fcda2,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xeca9d9['on']('error',function(_0x34c4f6){fs[_0x46a7('0x64')](_0x4f74d);_0x14d95d[_0x46a7('0x1a')](0x1f4)[_0x46a7('0x2c')](_0x34c4f6);});_0xeca9d9['on'](_0x46a7('0x65'),function(_0x484953){_0x3a1332[_0x46a7('0x66')]=isNaN(_0x484953['duration'])?null:_0x484953[_0x46a7('0x67')]*0x3e8;_0x3a1332[_0x46a7('0x68')]=isNaN(_0x484953[_0x46a7('0x69')])?null:_0x484953['sampleCount'];_0x3a1332['original_channelCount']=isNaN(_0x484953[_0x46a7('0x6a')])?null:_0x484953[_0x46a7('0x6a')];_0x3a1332['original_bitRate']=isNaN(_0x484953['bitRate'])?null:_0x484953[_0x46a7('0x6b')];_0x3a1332[_0x46a7('0x6c')]=isNaN(_0x484953[_0x46a7('0x6d')])?null:_0x484953['sampleRate'];});_0xeca9d9['on'](_0x46a7('0x6e'),function(_0x34ef7b){_0x3a1332['converted_duration']=isNaN(_0x34ef7b['duration'])?null:_0x34ef7b[_0x46a7('0x67')]*0x3e8;_0x3a1332[_0x46a7('0x6f')]=isNaN(_0x34ef7b[_0x46a7('0x69')])?null:_0x34ef7b[_0x46a7('0x69')];_0x3a1332[_0x46a7('0x70')]=isNaN(_0x34ef7b[_0x46a7('0x6a')])?null:_0x34ef7b[_0x46a7('0x6a')];_0x3a1332['converted_bitRate']=isNaN(_0x34ef7b[_0x46a7('0x6b')])?null:_0x34ef7b['bitRate'];_0x3a1332[_0x46a7('0x71')]=isNaN(_0x34ef7b[_0x46a7('0x6d')])?null:_0x34ef7b[_0x46a7('0x6d')];});_0xeca9d9['on'](_0x46a7('0x28'),function(){fs[_0x46a7('0x61')](_0x4fcda2,parseInt(_0x46a7('0x62'),0x8));return db[_0x46a7('0x2f')][_0x46a7('0x53')](_0x3a1332)[_0x46a7('0x23')](function(_0x38eb1e){var _0x51b5b8={'role':_0x51c825['body'][_0x46a7('0x72')],'userProfileId':_0x51c825['body'][_0x46a7('0x73')]};if(!_0x51b5b8)throw new Error(_0x46a7('0x74'));if(_0x51b5b8['role']===_0x46a7('0x75')){var _0x2a5d71=_0x38eb1e[_0x46a7('0x24')]({'plain':!![]});return db[_0x46a7('0x76')]['find']({'where':{'name':_0x46a7('0x25'),'userProfileId':_0x51b5b8[_0x46a7('0x73')]},'raw':!![]})['then'](function(_0x4526ca){if(_0x4526ca&&_0x4526ca[_0x46a7('0x77')]===0x0){return db[_0x46a7('0x26')][_0x46a7('0x53')]({'name':_0x2a5d71[_0x46a7('0x2b')],'resourceId':_0x2a5d71['id'],'type':_0x4526ca[_0x46a7('0x2b')],'sectionId':_0x4526ca['id']},{})[_0x46a7('0x23')](function(){return _0x38eb1e;});}else{return _0x38eb1e;}})[_0x46a7('0x52')](function(_0x48bfd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48bfd4);throw _0x48bfd4;});}return _0x38eb1e;})[_0x46a7('0x23')](respondWithResult(_0x14d95d,null))['catch'](handleError(_0x14d95d,null));});_0xeca9d9[_0x46a7('0x78')]();}catch(_0x4cada1){_0x14d95d['status'](0x1f4)[_0x46a7('0x2c')](_0x4cada1);}};exports['update']=function(_0x3693f2,_0x3167ca,_0x1ef068){return db[_0x46a7('0x2f')][_0x46a7('0x47')]({'where':{'id':_0x3693f2[_0x46a7('0x49')]['id']}})[_0x46a7('0x23')](handleEntityNotFound(_0x3167ca,null))['then'](saveUpdates(_[_0x46a7('0x79')](_0x3693f2[_0x46a7('0x7a')],[_0x46a7('0x2b'),_0x46a7('0x7b')]),null))[_0x46a7('0x23')](respondWithResult(_0x3167ca,null))[_0x46a7('0x52')](handleError(_0x3167ca,null));};exports[_0x46a7('0x7c')]=function(_0x32d9b0,_0x2ba16b,_0x2b5eb5){return db['Sound'][_0x46a7('0x47')]({'where':{'id':_0x32d9b0[_0x46a7('0x49')]['id']}})[_0x46a7('0x23')](function(_0x586589){if(_0x586589){return _0x586589[_0x46a7('0x27')]();}})['then'](function(_0x3fc9fc){var _0x3ab021=path[_0x46a7('0x5b')](config[_0x46a7('0x4c')],_0x46a7('0x7d'),util[_0x46a7('0x5d')](_0x46a7('0x51'),_0x3fc9fc['save_name'],_0x3fc9fc[_0x46a7('0x7e')]));var _0x339016=path[_0x46a7('0x5b')](config[_0x46a7('0x4c')],_0x46a7('0x5c'),util[_0x46a7('0x5d')](_0x46a7('0x51'),_0x3fc9fc[_0x46a7('0x4d')],_0x3fc9fc['converted_format']));fs[_0x46a7('0x64')](_0x3ab021);fs[_0x46a7('0x64')](_0x339016);return _0x3fc9fc;})[_0x46a7('0x23')](function(_0x419019){if(_0x419019){return _0x2ba16b['status'](0xcc)['end']();}})[_0x46a7('0x23')](handleEntityNotFound(_0x2ba16b,null))['catch'](handleError(_0x2ba16b,null));};
\ No newline at end of file
index 1684427..40bffc3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca0a=['../../config/logger','moment','request-promise','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x338442,_0x1974d1){var _0x11179b=function(_0x5bd177){while(--_0x5bd177){_0x338442['push'](_0x338442['shift']());}};_0x11179b(++_0x1974d1);}(_0xca0a,0x77));var _0xaca0=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xca0a[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0xaca0('0x0'));var util=require(_0xaca0('0x1'));var logger=require(_0xaca0('0x2'))('api');var moment=require(_0xaca0('0x3'));var BPromise=require('bluebird');var rp=require(_0xaca0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaca0('0x5'));var config=require('../../config/environment');var attributes=require(_0xaca0('0x6'));module[_0xaca0('0x7')]=function(_0x22c5f5,_0x130974){return _0x22c5f5[_0xaca0('0x8')](_0xaca0('0x9'),attributes,{'tableName':_0xaca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbf69=['bluebird','path','rimraf','../../config/environment','./sound.attributes','tools_sounds','util'];(function(_0x355bb7,_0x46613b){var _0x92a867=function(_0x444a56){while(--_0x444a56){_0x355bb7['push'](_0x355bb7['shift']());}};_0x92a867(++_0x46613b);}(_0xbf69,0xa0));var _0x9bf6=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xbf69[_0x31991b];return _0x307304;};'use strict';var _=require('lodash');var util=require(_0x9bf6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9bf6('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bf6('0x2'));var rimraf=require(_0x9bf6('0x3'));var config=require(_0x9bf6('0x4'));var attributes=require(_0x9bf6('0x5'));module['exports']=function(_0x34fd44,_0x388ea0){return _0x34fd44['define']('Sound',attributes,{'tableName':_0x9bf6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ee0e184..0dc6797 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09b8=['map','model','then','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','where','attributes','include'];(function(_0x178d6d,_0x393b86){var _0x1eef31=function(_0x1cf715){while(--_0x1cf715){_0x178d6d['push'](_0x178d6d['shift']());}};_0x1eef31(++_0x393b86);}(_0x09b8,0xa3));var _0x809b=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x09b8[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x809b('0x0'));var BPromise=require(_0x809b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x809b('0x2'));var db=require(_0x809b('0x3'))['db'];var utils=require(_0x809b('0x4'));var logger=require(_0x809b('0x5'))(_0x809b('0x6'));var config=require(_0x809b('0x7'));var jayson=require(_0x809b('0x8'));var client=jayson[_0x809b('0x9')][_0x809b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c916c,_0x1bbd91,_0x584199){return new BPromise(function(_0x2474a2,_0xfd4746){return client[_0x809b('0xb')](_0x4c916c,_0x584199)['then'](function(_0xc3eb49){logger[_0x809b('0xc')](_0x809b('0xd'),_0x1bbd91,_0x809b('0xe'));logger[_0x809b('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x1bbd91,'request\x20sent',JSON[_0x809b('0x10')](_0xc3eb49));if(_0xc3eb49['error']){if(_0xc3eb49[_0x809b('0x11')][_0x809b('0x12')]===0x1f4){logger[_0x809b('0x11')]('Sound,\x20%s,\x20%s',_0x1bbd91,_0xc3eb49[_0x809b('0x11')][_0x809b('0x13')]);return _0xfd4746(_0xc3eb49['error'][_0x809b('0x13')]);}logger['error']('Sound,\x20%s,\x20%s',_0x1bbd91,_0xc3eb49[_0x809b('0x11')][_0x809b('0x13')]);return _0x2474a2(_0xc3eb49[_0x809b('0x11')][_0x809b('0x13')]);}else{logger[_0x809b('0xc')](_0x809b('0xd'),_0x1bbd91,_0x809b('0xe'));_0x2474a2(_0xc3eb49[_0x809b('0x14')]['message']);}})[_0x809b('0x15')](function(_0x36e355){logger[_0x809b('0x11')]('Sound,\x20%s,\x20%s',_0x1bbd91,_0x36e355);_0xfd4746(_0x36e355);});});}exports[_0x809b('0x16')]=function(_0x25923a){var _0x24f779=this;return new Promise(function(_0x425f12,_0x32cc9f){return db[_0x809b('0x17')][_0x809b('0x18')]({'raw':_0x25923a[_0x809b('0x19')]?_0x25923a[_0x809b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x25923a[_0x809b('0x19')]?_0x25923a['options'][_0x809b('0x1a')]||null:null,'attributes':_0x25923a[_0x809b('0x19')]?_0x25923a[_0x809b('0x19')][_0x809b('0x1b')]||null:null,'include':_0x25923a['options']?_0x25923a[_0x809b('0x19')][_0x809b('0x1c')]?_[_0x809b('0x1d')](_0x25923a['options'][_0x809b('0x1c')],function(_0x2f00d6){return{'model':db[_0x2f00d6[_0x809b('0x1e')]],'as':_0x2f00d6['as'],'attributes':_0x2f00d6['attributes'],'include':_0x2f00d6['include']?_[_0x809b('0x1d')](_0x2f00d6[_0x809b('0x1c')],function(_0x214e04){return{'model':db[_0x214e04[_0x809b('0x1e')]],'as':_0x214e04['as'],'attributes':_0x214e04[_0x809b('0x1b')],'include':_0x214e04[_0x809b('0x1c')]?_[_0x809b('0x1d')](_0x214e04[_0x809b('0x1c')],function(_0x1c2206){return{'model':db[_0x1c2206[_0x809b('0x1e')]],'as':_0x1c2206['as'],'attributes':_0x1c2206['attributes']};}):[]};}):[]};}):[]:[]})[_0x809b('0x1f')](function(_0x4ed5f5){logger[_0x809b('0xc')](_0x809b('0x16'),_0x25923a);logger[_0x809b('0xf')]('ShowSound',_0x25923a,JSON['stringify'](_0x4ed5f5));_0x425f12(_0x4ed5f5);})[_0x809b('0x15')](function(_0x2e80bb){logger[_0x809b('0x11')](_0x809b('0x16'),_0x2e80bb['message'],_0x25923a);_0x32cc9f(_0x24f779[_0x809b('0x11')](0x1f4,_0x2e80bb[_0x809b('0x13')]));});});};
\ No newline at end of file
+var _0x20c1=['lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','raw','options','where','map','include','model','attributes','then'];(function(_0x97aafe,_0x1269a8){var _0x21225c=function(_0x3bc2e6){while(--_0x3bc2e6){_0x97aafe['push'](_0x97aafe['shift']());}};_0x21225c(++_0x1269a8);}(_0x20c1,0x10e));var _0x120c=function(_0x54b281,_0x48a469){_0x54b281=_0x54b281-0x0;var _0xe2b133=_0x20c1[_0x54b281];return _0xe2b133;};'use strict';var _=require(_0x120c('0x0'));var util=require('util');var moment=require(_0x120c('0x1'));var BPromise=require('bluebird');var rs=require(_0x120c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x120c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x120c('0x4'))(_0x120c('0x5'));var config=require(_0x120c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x120c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x382aa8,_0x344738,_0x24eae6){return new BPromise(function(_0x5b2099,_0xd14986){return client[_0x120c('0x8')](_0x382aa8,_0x24eae6)['then'](function(_0x290981){logger[_0x120c('0x9')](_0x120c('0xa'),_0x344738,_0x120c('0xb'));logger[_0x120c('0xc')](_0x120c('0xd'),_0x344738,_0x120c('0xb'),JSON[_0x120c('0xe')](_0x290981));if(_0x290981[_0x120c('0xf')]){if(_0x290981[_0x120c('0xf')][_0x120c('0x10')]===0x1f4){logger[_0x120c('0xf')]('Sound,\x20%s,\x20%s',_0x344738,_0x290981[_0x120c('0xf')][_0x120c('0x11')]);return _0xd14986(_0x290981['error'][_0x120c('0x11')]);}logger[_0x120c('0xf')](_0x120c('0xa'),_0x344738,_0x290981[_0x120c('0xf')][_0x120c('0x11')]);return _0x5b2099(_0x290981[_0x120c('0xf')]['message']);}else{logger[_0x120c('0x9')]('Sound,\x20%s,\x20%s',_0x344738,'request\x20sent');_0x5b2099(_0x290981[_0x120c('0x12')][_0x120c('0x11')]);}})[_0x120c('0x13')](function(_0x25735f){logger[_0x120c('0xf')]('Sound,\x20%s,\x20%s',_0x344738,_0x25735f);_0xd14986(_0x25735f);});});}exports[_0x120c('0x14')]=function(_0x16b0ba){var _0x260e20=this;return new Promise(function(_0x3167c1,_0x2c5da0){return db[_0x120c('0x15')]['find']({'raw':_0x16b0ba['options']?_0x16b0ba['options'][_0x120c('0x16')]===undefined?!![]:![]:!![],'where':_0x16b0ba[_0x120c('0x17')]?_0x16b0ba[_0x120c('0x17')][_0x120c('0x18')]||null:null,'attributes':_0x16b0ba[_0x120c('0x17')]?_0x16b0ba[_0x120c('0x17')]['attributes']||null:null,'include':_0x16b0ba[_0x120c('0x17')]?_0x16b0ba['options']['include']?_[_0x120c('0x19')](_0x16b0ba[_0x120c('0x17')][_0x120c('0x1a')],function(_0x1f1cf7){return{'model':db[_0x1f1cf7[_0x120c('0x1b')]],'as':_0x1f1cf7['as'],'attributes':_0x1f1cf7['attributes'],'include':_0x1f1cf7[_0x120c('0x1a')]?_['map'](_0x1f1cf7[_0x120c('0x1a')],function(_0x525154){return{'model':db[_0x525154['model']],'as':_0x525154['as'],'attributes':_0x525154[_0x120c('0x1c')],'include':_0x525154[_0x120c('0x1a')]?_[_0x120c('0x19')](_0x525154[_0x120c('0x1a')],function(_0x384b03){return{'model':db[_0x384b03[_0x120c('0x1b')]],'as':_0x384b03['as'],'attributes':_0x384b03[_0x120c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x120c('0x1d')](function(_0x3d6110){logger[_0x120c('0x9')]('ShowSound',_0x16b0ba);logger['debug']('ShowSound',_0x16b0ba,JSON[_0x120c('0xe')](_0x3d6110));_0x3167c1(_0x3d6110);})['catch'](function(_0xdacd02){logger['error'](_0x120c('0x14'),_0xdacd02[_0x120c('0x11')],_0x16b0ba);_0x2c5da0(_0x260e20[_0x120c('0xf')](0x1f4,_0xdacd02[_0x120c('0x11')]));});});};
\ No newline at end of file
index c8a21f1..01e987a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x301c77,_0x19c3d4){var _0x591a71=function(_0x54d436){while(--_0x54d436){_0x301c77['push'](_0x301c77['shift']());}};_0x591a71(++_0x19c3d4);}(_0xb10b,0x12a));var _0xbb10=function(_0x53080e,_0x252127){_0x53080e=_0x53080e-0x0;var _0x1a0c14=_0xb10b[_0x53080e];return _0x1a0c14;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x3edcd6,_0xa464c2){var _0xc64623=function(_0x3056c6){while(--_0x3056c6){_0x3edcd6['push'](_0x3edcd6['shift']());}};_0xc64623(++_0xa464c2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router;
\ No newline at end of file
index 0e3e29c..6684679 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaedc=['out','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaedc,0x70));var _0xcaed=function(_0x454162,_0x4ecb89){_0x454162=_0x454162-0x0;var _0x245bbc=_0xaedc[_0x454162];return _0x245bbc;};'use strict';var Sequelize=require('sequelize');module[_0xcaed('0x0')]={'uniqueid':{'type':Sequelize[_0xcaed('0x1')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcaed('0x2')),'defaultValue':_0xcaed('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0xce03=['TEXT','medium','ENUM','out','STRING','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xce03,0x132));var _0x3ce0=function(_0x4512c2,_0x3f52ad){_0x4512c2=_0x4512c2-0x0;var _0x6822db=_0xce03[_0x4512c2];return _0x6822db;};'use strict';var Sequelize=require(_0x3ce0('0x0'));module[_0x3ce0('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x3ce0('0x2')](_0x3ce0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x3ce0('0x4')]('in','out'),'defaultValue':_0x3ce0('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3ce0('0x6')]},'providerResponse':{'type':Sequelize[_0x3ce0('0x2')]}};
\ No newline at end of file
index 1f6cb14..6baf8ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe02a=['findAll','rows','catch','show','options','find','create','body','params','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe02a,0xa3));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xae02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae02('0x1'));var BPromise=require(_0xae02('0x2'));var Mustache=require(_0xae02('0x3'));var util=require(_0xae02('0x4'));var path=require(_0xae02('0x5'));var sox=require(_0xae02('0x6'));var csv=require(_0xae02('0x7'));var ejs=require(_0xae02('0x8'));var fs=require('fs');var fs_extra=require(_0xae02('0x9'));var _=require(_0xae02('0xa'));var squel=require(_0xae02('0xb'));var crypto=require(_0xae02('0xc'));var jsforce=require(_0xae02('0xd'));var deskjs=require(_0xae02('0xe'));var toCsv=require(_0xae02('0x7'));var querystring=require(_0xae02('0xf'));var Papa=require(_0xae02('0x10'));var Redis=require(_0xae02('0x11'));var authService=require(_0xae02('0x12'));var qs=require(_0xae02('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae02('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xae02('0x15'));var config=require(_0xae02('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae02('0x17'))['db'];function respondWithStatusCode(_0x94990c,_0xbb3cea){_0xbb3cea=_0xbb3cea||0xcc;return function(_0x5b6618){if(_0x5b6618){return _0x94990c[_0xae02('0x18')](_0xbb3cea);}return _0x94990c['status'](_0xbb3cea)[_0xae02('0x19')]();};}function respondWithResult(_0x277588,_0xecd25b){_0xecd25b=_0xecd25b||0xc8;return function(_0x526928){if(_0x526928){return _0x277588[_0xae02('0x1a')](_0xecd25b)['json'](_0x526928);}};}function respondWithFilteredResult(_0x597d6e,_0xf1ef23){return function(_0x29d574){if(_0x29d574){var _0x110ccb=typeof _0xf1ef23[_0xae02('0x1b')]===_0xae02('0x1c')&&typeof _0xf1ef23[_0xae02('0x1d')]===_0xae02('0x1c');var _0x1bfa33=_0x29d574['count'];var _0x560114=_0x110ccb?0x0:_0xf1ef23[_0xae02('0x1b')];var _0x4369c9=_0x110ccb?_0x29d574[_0xae02('0x1e')]:_0xf1ef23['offset']+_0xf1ef23['limit'];var _0x57753b;if(_0x4369c9>=_0x1bfa33){_0x4369c9=_0x1bfa33;_0x57753b=0xc8;}else{_0x57753b=0xce;}_0x597d6e['status'](_0x57753b);return _0x597d6e[_0xae02('0x1f')](_0xae02('0x20'),_0x560114+'-'+_0x4369c9+'/'+_0x1bfa33)[_0xae02('0x21')](_0x29d574);}return null;};}function patchUpdates(_0xe22675){return function(_0x1f594a){try{jsonpatch[_0xae02('0x22')](_0x1f594a,_0xe22675,!![]);}catch(_0x177b83){return BPromise[_0xae02('0x23')](_0x177b83);}return _0x1f594a[_0xae02('0x24')]();};}function saveUpdates(_0x2d905e,_0x1fbff5){return function(_0x79917c){if(_0x79917c){return _0x79917c[_0xae02('0x25')](_0x2d905e)[_0xae02('0x26')](function(_0x5a738d){return _0x5a738d;});}return null;};}function removeEntity(_0x557c54,_0x10f4b9){return function(_0x13e2a){if(_0x13e2a){return _0x13e2a[_0xae02('0x27')]()[_0xae02('0x26')](function(){_0x557c54[_0xae02('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x261851,_0x319456){return function(_0x6bcee8){if(!_0x6bcee8){_0x261851[_0xae02('0x18')](0x194);}return _0x6bcee8;};}function handleError(_0x23a32b,_0x374576){_0x374576=_0x374576||0x1f4;return function(_0x2d6fe6){logger[_0xae02('0x28')](_0x2d6fe6[_0xae02('0x29')]);if(_0x2d6fe6[_0xae02('0x2a')]){delete _0x2d6fe6[_0xae02('0x2a')];}_0x23a32b[_0xae02('0x1a')](_0x374576)['send'](_0x2d6fe6);};}exports[_0xae02('0x2b')]=function(_0xe8b9a4,_0x111af2){var _0x50c35e={},_0x536694={},_0x2b3b08={'count':0x0,'rows':[]};var _0x10a8ad=_[_0xae02('0x2c')](db[_0xae02('0x2d')][_0xae02('0x2e')],function(_0x3dd29b){return{'name':_0x3dd29b['fieldName'],'type':_0x3dd29b[_0xae02('0x2f')][_0xae02('0x30')]};});_0x536694['model']=_[_0xae02('0x2c')](_0x10a8ad,_0xae02('0x2a'));_0x536694[_0xae02('0x31')]=_[_0xae02('0x32')](_0xe8b9a4[_0xae02('0x31')]);_0x536694['filters']=_[_0xae02('0x33')](_0x536694[_0xae02('0x34')],_0x536694[_0xae02('0x31')]);_0x50c35e[_0xae02('0x35')]=_[_0xae02('0x33')](_0x536694[_0xae02('0x34')],qs[_0xae02('0x36')](_0xe8b9a4[_0xae02('0x31')][_0xae02('0x36')]));_0x50c35e[_0xae02('0x35')]=_0x50c35e['attributes'][_0xae02('0x37')]?_0x50c35e['attributes']:_0x536694['model'];if(!_0xe8b9a4[_0xae02('0x31')][_0xae02('0x38')](_0xae02('0x39'))){_0x50c35e[_0xae02('0x1d')]=qs[_0xae02('0x1d')](_0xe8b9a4[_0xae02('0x31')]['limit']);_0x50c35e[_0xae02('0x1b')]=qs[_0xae02('0x1b')](_0xe8b9a4[_0xae02('0x31')][_0xae02('0x1b')]);}_0x50c35e[_0xae02('0x3a')]=qs[_0xae02('0x3b')](_0xe8b9a4['query'][_0xae02('0x3b')]);_0x50c35e[_0xae02('0x3c')]=qs[_0xae02('0x3d')](_[_0xae02('0x3e')](_0xe8b9a4[_0xae02('0x31')],_0x536694[_0xae02('0x3d')]),_0x10a8ad);if(_0xe8b9a4[_0xae02('0x31')][_0xae02('0x3f')]){_0x50c35e[_0xae02('0x3c')]=_['merge'](_0x50c35e[_0xae02('0x3c')],{'$or':_[_0xae02('0x2c')](_0x10a8ad,function(_0x2141d0){if(_0x2141d0[_0xae02('0x2f')]!==_0xae02('0x40')){var _0x440972={};_0x440972[_0x2141d0['name']]={'$like':'%'+_0xe8b9a4[_0xae02('0x31')][_0xae02('0x3f')]+'%'};return _0x440972;}})});}_0x50c35e=_[_0xae02('0x41')]({},_0x50c35e,_0xe8b9a4['options']);var _0x3685f1={'where':_0x50c35e[_0xae02('0x3c')]};return db['SquareMessage'][_0xae02('0x1e')](_0x3685f1)[_0xae02('0x26')](function(_0x273eba){_0x2b3b08['count']=_0x273eba;if(_0xe8b9a4[_0xae02('0x31')][_0xae02('0x42')]){_0x50c35e[_0xae02('0x43')]=[{'all':!![]}];}return db[_0xae02('0x2d')][_0xae02('0x44')](_0x50c35e);})['then'](function(_0x5db078){_0x2b3b08[_0xae02('0x45')]=_0x5db078;return _0x2b3b08;})[_0xae02('0x26')](respondWithFilteredResult(_0x111af2,_0x50c35e))[_0xae02('0x46')](handleError(_0x111af2,null));};exports[_0xae02('0x47')]=function(_0x40ed68,_0x207895){var _0x59448a={'raw':!![],'where':{'id':_0x40ed68['params']['id']}},_0x3ddeca={};_0x3ddeca[_0xae02('0x34')]=_[_0xae02('0x32')](db[_0xae02('0x2d')][_0xae02('0x2e')]);_0x3ddeca[_0xae02('0x31')]=_[_0xae02('0x32')](_0x40ed68[_0xae02('0x31')]);_0x3ddeca[_0xae02('0x3d')]=_[_0xae02('0x33')](_0x3ddeca[_0xae02('0x34')],_0x3ddeca['query']);_0x59448a['attributes']=_[_0xae02('0x33')](_0x3ddeca[_0xae02('0x34')],qs['fields'](_0x40ed68[_0xae02('0x31')][_0xae02('0x36')]));_0x59448a[_0xae02('0x35')]=_0x59448a[_0xae02('0x35')][_0xae02('0x37')]?_0x59448a[_0xae02('0x35')]:_0x3ddeca[_0xae02('0x34')];if(_0x40ed68[_0xae02('0x31')][_0xae02('0x42')]){_0x59448a[_0xae02('0x43')]=[{'all':!![]}];}_0x59448a=_[_0xae02('0x41')]({},_0x59448a,_0x40ed68[_0xae02('0x48')]);return db['SquareMessage'][_0xae02('0x49')](_0x59448a)[_0xae02('0x26')](handleEntityNotFound(_0x207895,null))['then'](respondWithResult(_0x207895,null))[_0xae02('0x46')](handleError(_0x207895,null));};exports[_0xae02('0x4a')]=function(_0x74ecc7,_0x3a6a88){return db[_0xae02('0x2d')][_0xae02('0x4a')](_0x74ecc7['body'],{})[_0xae02('0x26')](respondWithResult(_0x3a6a88,0xc9))[_0xae02('0x46')](handleError(_0x3a6a88,null));};exports[_0xae02('0x25')]=function(_0x13fbc2,_0x4aab2b){if(_0x13fbc2[_0xae02('0x4b')]['id']){delete _0x13fbc2['body']['id'];}return db[_0xae02('0x2d')][_0xae02('0x49')]({'where':{'id':_0x13fbc2[_0xae02('0x4c')]['id']}})[_0xae02('0x26')](handleEntityNotFound(_0x4aab2b,null))[_0xae02('0x26')](saveUpdates(_0x13fbc2['body'],null))[_0xae02('0x26')](respondWithResult(_0x4aab2b,null))[_0xae02('0x46')](handleError(_0x4aab2b,null));};exports[_0xae02('0x27')]=function(_0x219cf1,_0x32bd01){return db['SquareMessage'][_0xae02('0x49')]({'where':{'id':_0x219cf1[_0xae02('0x4c')]['id']}})['then'](handleEntityNotFound(_0x32bd01,null))[_0xae02('0x26')](removeEntity(_0x32bd01,null))[_0xae02('0x46')](handleError(_0x32bd01,null));};
\ No newline at end of file
+var _0xcf3d=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','reject','update','destroy','then','end','stack','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','catch','params','keys','options','find','create','body'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x15b601,_0x174629){_0x15b601=_0x15b601-0x0;var _0x542991=_0xcf3d[_0x15b601];return _0x542991;};'use strict';var emlformat=require(_0xdcf3('0x0'));var rimraf=require(_0xdcf3('0x1'));var zipdir=require(_0xdcf3('0x2'));var jsonpatch=require(_0xdcf3('0x3'));var rp=require('request-promise');var moment=require(_0xdcf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf3('0x5'));var util=require(_0xdcf3('0x6'));var path=require(_0xdcf3('0x7'));var sox=require(_0xdcf3('0x8'));var csv=require(_0xdcf3('0x9'));var ejs=require(_0xdcf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf3('0xb'));var squel=require('squel');var crypto=require(_0xdcf3('0xc'));var jsforce=require(_0xdcf3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdcf3('0xe'));var Redis=require(_0xdcf3('0xf'));var authService=require(_0xdcf3('0x10'));var qs=require(_0xdcf3('0x11'));var as=require(_0xdcf3('0x12'));var hardwareService=require(_0xdcf3('0x13'));var logger=require(_0xdcf3('0x14'))(_0xdcf3('0x15'));var utils=require(_0xdcf3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdcf3('0x17'));var db=require(_0xdcf3('0x18'))['db'];function respondWithStatusCode(_0x4b1623,_0x40ddf7){_0x40ddf7=_0x40ddf7||0xcc;return function(_0x2e1fff){if(_0x2e1fff){return _0x4b1623[_0xdcf3('0x19')](_0x40ddf7);}return _0x4b1623[_0xdcf3('0x1a')](_0x40ddf7)['end']();};}function respondWithResult(_0x2d0bc2,_0x4b003f){_0x4b003f=_0x4b003f||0xc8;return function(_0x4d5417){if(_0x4d5417){return _0x2d0bc2[_0xdcf3('0x1a')](_0x4b003f)['json'](_0x4d5417);}};}function respondWithFilteredResult(_0x1b34b4,_0x2ebc69){return function(_0x1af727){if(_0x1af727){var _0x2c5436=typeof _0x2ebc69['offset']===_0xdcf3('0x1b')&&typeof _0x2ebc69[_0xdcf3('0x1c')]==='undefined';var _0xc64c2a=_0x1af727[_0xdcf3('0x1d')];var _0x441142=_0x2c5436?0x0:_0x2ebc69[_0xdcf3('0x1e')];var _0x1c1df7=_0x2c5436?_0x1af727[_0xdcf3('0x1d')]:_0x2ebc69[_0xdcf3('0x1e')]+_0x2ebc69[_0xdcf3('0x1c')];var _0x27a958;if(_0x1c1df7>=_0xc64c2a){_0x1c1df7=_0xc64c2a;_0x27a958=0xc8;}else{_0x27a958=0xce;}_0x1b34b4[_0xdcf3('0x1a')](_0x27a958);return _0x1b34b4[_0xdcf3('0x1f')]('Content-Range',_0x441142+'-'+_0x1c1df7+'/'+_0xc64c2a)['json'](_0x1af727);}return null;};}function patchUpdates(_0x3a4512){return function(_0x427890){try{jsonpatch['apply'](_0x427890,_0x3a4512,!![]);}catch(_0x4e3e41){return BPromise[_0xdcf3('0x20')](_0x4e3e41);}return _0x427890['save']();};}function saveUpdates(_0x5622de,_0x71009c){return function(_0x273591){if(_0x273591){return _0x273591[_0xdcf3('0x21')](_0x5622de)['then'](function(_0x40b9f1){return _0x40b9f1;});}return null;};}function removeEntity(_0x4d340a,_0x2cc3ce){return function(_0x524ab0){if(_0x524ab0){return _0x524ab0[_0xdcf3('0x22')]()[_0xdcf3('0x23')](function(){_0x4d340a[_0xdcf3('0x1a')](0xcc)[_0xdcf3('0x24')]();});}};}function handleEntityNotFound(_0x5b6fc3,_0x16ea83){return function(_0x5c8557){if(!_0x5c8557){_0x5b6fc3[_0xdcf3('0x19')](0x194);}return _0x5c8557;};}function handleError(_0x3fbd96,_0x7df45){_0x7df45=_0x7df45||0x1f4;return function(_0x4c7412){logger['error'](_0x4c7412[_0xdcf3('0x25')]);if(_0x4c7412['name']){delete _0x4c7412['name'];}_0x3fbd96['status'](_0x7df45)['send'](_0x4c7412);};}exports[_0xdcf3('0x26')]=function(_0x4cd417,_0x3165a5){var _0x56964c={},_0x3b34a5={},_0x4cc17a={'count':0x0,'rows':[]};var _0x23a893=_[_0xdcf3('0x27')](db[_0xdcf3('0x28')][_0xdcf3('0x29')],function(_0x18a560){return{'name':_0x18a560[_0xdcf3('0x2a')],'type':_0x18a560[_0xdcf3('0x2b')][_0xdcf3('0x2c')]};});_0x3b34a5[_0xdcf3('0x2d')]=_[_0xdcf3('0x27')](_0x23a893,_0xdcf3('0x2e'));_0x3b34a5[_0xdcf3('0x2f')]=_['keys'](_0x4cd417[_0xdcf3('0x2f')]);_0x3b34a5[_0xdcf3('0x30')]=_[_0xdcf3('0x31')](_0x3b34a5[_0xdcf3('0x2d')],_0x3b34a5[_0xdcf3('0x2f')]);_0x56964c[_0xdcf3('0x32')]=_[_0xdcf3('0x31')](_0x3b34a5[_0xdcf3('0x2d')],qs[_0xdcf3('0x33')](_0x4cd417['query'][_0xdcf3('0x33')]));_0x56964c['attributes']=_0x56964c[_0xdcf3('0x32')][_0xdcf3('0x34')]?_0x56964c[_0xdcf3('0x32')]:_0x3b34a5[_0xdcf3('0x2d')];if(!_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x35')]('nolimit')){_0x56964c[_0xdcf3('0x1c')]=qs[_0xdcf3('0x1c')](_0x4cd417['query'][_0xdcf3('0x1c')]);_0x56964c[_0xdcf3('0x1e')]=qs['offset'](_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x1e')]);}_0x56964c[_0xdcf3('0x36')]=qs[_0xdcf3('0x37')](_0x4cd417['query'][_0xdcf3('0x37')]);_0x56964c[_0xdcf3('0x38')]=qs['filters'](_['pick'](_0x4cd417['query'],_0x3b34a5[_0xdcf3('0x30')]),_0x23a893);if(_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x39')]){_0x56964c[_0xdcf3('0x38')]=_[_0xdcf3('0x3a')](_0x56964c[_0xdcf3('0x38')],{'$or':_[_0xdcf3('0x27')](_0x23a893,function(_0x321978){if(_0x321978[_0xdcf3('0x2b')]!=='VIRTUAL'){var _0x48d9bb={};_0x48d9bb[_0x321978[_0xdcf3('0x2e')]]={'$like':'%'+_0x4cd417['query'][_0xdcf3('0x39')]+'%'};return _0x48d9bb;}})});}_0x56964c=_[_0xdcf3('0x3a')]({},_0x56964c,_0x4cd417['options']);var _0x5ba362={'where':_0x56964c[_0xdcf3('0x38')]};return db['SquareMessage']['count'](_0x5ba362)[_0xdcf3('0x23')](function(_0x5b472c){_0x4cc17a[_0xdcf3('0x1d')]=_0x5b472c;if(_0x4cd417[_0xdcf3('0x2f')][_0xdcf3('0x3b')]){_0x56964c['include']=[{'all':!![]}];}return db[_0xdcf3('0x28')][_0xdcf3('0x3c')](_0x56964c);})[_0xdcf3('0x23')](function(_0x169848){_0x4cc17a[_0xdcf3('0x3d')]=_0x169848;return _0x4cc17a;})[_0xdcf3('0x23')](respondWithFilteredResult(_0x3165a5,_0x56964c))[_0xdcf3('0x3e')](handleError(_0x3165a5,null));};exports['show']=function(_0x3a32c6,_0x2e2ba0){var _0x649485={'raw':!![],'where':{'id':_0x3a32c6[_0xdcf3('0x3f')]['id']}},_0x499c8e={};_0x499c8e[_0xdcf3('0x2d')]=_['keys'](db[_0xdcf3('0x28')][_0xdcf3('0x29')]);_0x499c8e['query']=_[_0xdcf3('0x40')](_0x3a32c6[_0xdcf3('0x2f')]);_0x499c8e[_0xdcf3('0x30')]=_[_0xdcf3('0x31')](_0x499c8e['model'],_0x499c8e[_0xdcf3('0x2f')]);_0x649485['attributes']=_[_0xdcf3('0x31')](_0x499c8e[_0xdcf3('0x2d')],qs[_0xdcf3('0x33')](_0x3a32c6[_0xdcf3('0x2f')][_0xdcf3('0x33')]));_0x649485[_0xdcf3('0x32')]=_0x649485[_0xdcf3('0x32')][_0xdcf3('0x34')]?_0x649485['attributes']:_0x499c8e[_0xdcf3('0x2d')];if(_0x3a32c6[_0xdcf3('0x2f')][_0xdcf3('0x3b')]){_0x649485['include']=[{'all':!![]}];}_0x649485=_['merge']({},_0x649485,_0x3a32c6[_0xdcf3('0x41')]);return db[_0xdcf3('0x28')][_0xdcf3('0x42')](_0x649485)[_0xdcf3('0x23')](handleEntityNotFound(_0x2e2ba0,null))[_0xdcf3('0x23')](respondWithResult(_0x2e2ba0,null))['catch'](handleError(_0x2e2ba0,null));};exports[_0xdcf3('0x43')]=function(_0x51f4d4,_0x4ded3f){return db[_0xdcf3('0x28')][_0xdcf3('0x43')](_0x51f4d4[_0xdcf3('0x44')],{})[_0xdcf3('0x23')](respondWithResult(_0x4ded3f,0xc9))[_0xdcf3('0x3e')](handleError(_0x4ded3f,null));};exports[_0xdcf3('0x21')]=function(_0x48abd5,_0x1ebf31){if(_0x48abd5[_0xdcf3('0x44')]['id']){delete _0x48abd5[_0xdcf3('0x44')]['id'];}return db[_0xdcf3('0x28')]['find']({'where':{'id':_0x48abd5[_0xdcf3('0x3f')]['id']}})[_0xdcf3('0x23')](handleEntityNotFound(_0x1ebf31,null))[_0xdcf3('0x23')](saveUpdates(_0x48abd5[_0xdcf3('0x44')],null))[_0xdcf3('0x23')](respondWithResult(_0x1ebf31,null))[_0xdcf3('0x3e')](handleError(_0x1ebf31,null));};exports[_0xdcf3('0x22')]=function(_0x20cdbc,_0x7dded8){return db['SquareMessage']['find']({'where':{'id':_0x20cdbc[_0xdcf3('0x3f')]['id']}})[_0xdcf3('0x23')](handleEntityNotFound(_0x7dded8,null))[_0xdcf3('0x23')](removeEntity(_0x7dded8,null))['catch'](handleError(_0x7dded8,null));};
\ No newline at end of file
index 26339df..6a8f6e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc25a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash'];(function(_0x915101,_0x3e389b){var _0x3c9651=function(_0x92a7be){while(--_0x92a7be){_0x915101['push'](_0x915101['shift']());}};_0x3c9651(++_0x3e389b);}(_0xc25a,0xb5));var _0xac25=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc25a[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xac25('0x0'));var util=require('util');var logger=require(_0xac25('0x1'))(_0xac25('0x2'));var moment=require(_0xac25('0x3'));var BPromise=require(_0xac25('0x4'));var rp=require(_0xac25('0x5'));var fs=require('fs');var path=require(_0xac25('0x6'));var rimraf=require(_0xac25('0x7'));var config=require(_0xac25('0x8'));var attributes=require('./squareMessage.attributes');module[_0xac25('0x9')]=function(_0x4a5880,_0x7b854){return _0x4a5880[_0xac25('0xa')](_0xac25('0xb'),attributes,{'tableName':_0xac25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc1fa=['square_messages','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage'];(function(_0x20823f,_0x394ac5){var _0x239c4b=function(_0x5af436){while(--_0x5af436){_0x20823f['push'](_0x20823f['shift']());}};_0x239c4b(++_0x394ac5);}(_0xc1fa,0xc1));var _0xac1f=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xc1fa[_0x5cb97e];return _0x1714b4;};'use strict';var _=require(_0xac1f('0x0'));var util=require('util');var logger=require(_0xac1f('0x1'))(_0xac1f('0x2'));var moment=require(_0xac1f('0x3'));var BPromise=require(_0xac1f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac1f('0x5'));var rimraf=require(_0xac1f('0x6'));var config=require(_0xac1f('0x7'));var attributes=require(_0xac1f('0x8'));module[_0xac1f('0x9')]=function(_0x351efd,_0x218012){return _0x351efd['define'](_0xac1f('0xa'),attributes,{'tableName':_0xac1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 078c876..1f8742a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29f3=['create','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','SquareMessage'];(function(_0x4998e4,_0x47a4ed){var _0x1bef53=function(_0x458797){while(--_0x458797){_0x4998e4['push'](_0x4998e4['shift']());}};_0x1bef53(++_0x47a4ed);}(_0x29f3,0x9a));var _0x329f=function(_0x14b9b3,_0x1c952c){_0x14b9b3=_0x14b9b3-0x0;var _0x3095ba=_0x29f3[_0x14b9b3];return _0x3095ba;};'use strict';var _=require(_0x329f('0x0'));var util=require(_0x329f('0x1'));var moment=require(_0x329f('0x2'));var BPromise=require(_0x329f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x329f('0x4'));var db=require(_0x329f('0x5'))['db'];var utils=require(_0x329f('0x6'));var logger=require('../../config/logger')(_0x329f('0x7'));var config=require(_0x329f('0x8'));var jayson=require(_0x329f('0x9'));var client=jayson[_0x329f('0xa')][_0x329f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bf6e,_0x350370,_0x8609f7){return new BPromise(function(_0x5919f5,_0x3b5b33){return client[_0x329f('0xc')](_0x54bf6e,_0x8609f7)[_0x329f('0xd')](function(_0x585a24){logger[_0x329f('0xe')]('SquareMessage,\x20%s,\x20%s',_0x350370,'request\x20sent');logger[_0x329f('0xf')](_0x329f('0x10'),_0x350370,_0x329f('0x11'),JSON[_0x329f('0x12')](_0x585a24));if(_0x585a24[_0x329f('0x13')]){if(_0x585a24[_0x329f('0x13')][_0x329f('0x14')]===0x1f4){logger['error'](_0x329f('0x15'),_0x350370,_0x585a24[_0x329f('0x13')][_0x329f('0x16')]);return _0x3b5b33(_0x585a24[_0x329f('0x13')][_0x329f('0x16')]);}logger[_0x329f('0x13')](_0x329f('0x15'),_0x350370,_0x585a24[_0x329f('0x13')]['message']);return _0x5919f5(_0x585a24[_0x329f('0x13')][_0x329f('0x16')]);}else{logger[_0x329f('0xe')](_0x329f('0x15'),_0x350370,'request\x20sent');_0x5919f5(_0x585a24[_0x329f('0x17')][_0x329f('0x16')]);}})['catch'](function(_0x209898){logger['error'](_0x329f('0x15'),_0x350370,_0x209898);_0x3b5b33(_0x209898);});});}exports[_0x329f('0x18')]=function(_0x1a070a){var _0x257918=this;return new Promise(function(_0xb3c5b0,_0x45e1e5){return db[_0x329f('0x19')][_0x329f('0x1a')](_0x1a070a['body'],{'raw':_0x1a070a[_0x329f('0x1b')]?_0x1a070a[_0x329f('0x1b')][_0x329f('0x1c')]===undefined?!![]:![]:!![]})[_0x329f('0xd')](function(_0x4a3745){logger['info'](_0x329f('0x18'),_0x1a070a);logger[_0x329f('0xf')](_0x329f('0x18'),_0x1a070a,JSON[_0x329f('0x12')](_0x4a3745));_0xb3c5b0(_0x4a3745);})[_0x329f('0x1d')](function(_0x4f8df8){logger[_0x329f('0x13')]('CreateSquareMessage',_0x4f8df8['message'],_0x1a070a);_0x45e1e5(_0x257918[_0x329f('0x13')](0x1f4,_0x4f8df8[_0x329f('0x16')]));});});};
\ No newline at end of file
+var _0x054e=['http','then','info','debug','error','code','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','SquareMessage','body','options','CreateSquareMessage','stringify','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1bfa04,_0x14891d){var _0x277539=function(_0x4f842d){while(--_0x4f842d){_0x1bfa04['push'](_0x1bfa04['shift']());}};_0x277539(++_0x14891d);}(_0x054e,0x123));var _0xe054=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x054e[_0x460150];return _0x340677;};'use strict';var _=require('lodash');var util=require(_0xe054('0x0'));var moment=require('moment');var BPromise=require(_0xe054('0x1'));var rs=require(_0xe054('0x2'));var fs=require('fs');var Redis=require(_0xe054('0x3'));var db=require(_0xe054('0x4'))['db'];var utils=require(_0xe054('0x5'));var logger=require(_0xe054('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe054('0x7'));var client=jayson[_0xe054('0x8')][_0xe054('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366564,_0x169e00,_0x266315){return new BPromise(function(_0x22672e,_0x120096){return client['request'](_0x366564,_0x266315)[_0xe054('0xa')](function(_0x302b7d){logger[_0xe054('0xb')]('SquareMessage,\x20%s,\x20%s',_0x169e00,'request\x20sent');logger[_0xe054('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x169e00,'request\x20sent',JSON['stringify'](_0x302b7d));if(_0x302b7d[_0xe054('0xd')]){if(_0x302b7d[_0xe054('0xd')][_0xe054('0xe')]===0x1f4){logger[_0xe054('0xd')](_0xe054('0xf'),_0x169e00,_0x302b7d[_0xe054('0xd')][_0xe054('0x10')]);return _0x120096(_0x302b7d[_0xe054('0xd')]['message']);}logger['error'](_0xe054('0xf'),_0x169e00,_0x302b7d[_0xe054('0xd')][_0xe054('0x10')]);return _0x22672e(_0x302b7d[_0xe054('0xd')][_0xe054('0x10')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x169e00,_0xe054('0x11'));_0x22672e(_0x302b7d[_0xe054('0x12')][_0xe054('0x10')]);}})['catch'](function(_0x149727){logger['error'](_0xe054('0xf'),_0x169e00,_0x149727);_0x120096(_0x149727);});});}exports['CreateSquareMessage']=function(_0x42d014){var _0x36ab84=this;return new Promise(function(_0x41b543,_0x554d86){return db[_0xe054('0x13')]['create'](_0x42d014[_0xe054('0x14')],{'raw':_0x42d014[_0xe054('0x15')]?_0x42d014[_0xe054('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x40f432){logger[_0xe054('0xb')](_0xe054('0x16'),_0x42d014);logger[_0xe054('0xc')](_0xe054('0x16'),_0x42d014,JSON[_0xe054('0x17')](_0x40f432));_0x41b543(_0x40f432);})[_0xe054('0x18')](function(_0x2d797d){logger[_0xe054('0xd')](_0xe054('0x16'),_0x2d797d['message'],_0x42d014);_0x554d86(_0x36ab84[_0xe054('0xd')](0x1f4,_0x2d797d[_0xe054('0x10')]));});});};
\ No newline at end of file
index 8353c24..74e144e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1abf=['isAuthenticated','index','/:id','/:id/test','15s','test','put','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get'];(function(_0x19ecd0,_0x5e2a2d){var _0x212fbb=function(_0x5ad553){while(--_0x5ad553){_0x19ecd0['push'](_0x19ecd0['shift']());}};_0x212fbb(++_0x5e2a2d);}(_0x1abf,0x1cc));var _0xf1ab=function(_0x121a0f,_0x1539eb){_0x121a0f=_0x121a0f-0x0;var _0x18d0f0=_0x1abf[_0x121a0f];return _0x18d0f0;};'use strict';var multer=require('multer');var util=require(_0xf1ab('0x0'));var path=require(_0xf1ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xf1ab('0x2'));var router=express[_0xf1ab('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf1ab('0x4'));var interaction=require(_0xf1ab('0x5'));var config=require('../../config/environment');var controller=require(_0xf1ab('0x6'));router[_0xf1ab('0x7')]('/',auth[_0xf1ab('0x8')](),controller[_0xf1ab('0x9')]);router[_0xf1ab('0x7')](_0xf1ab('0xa'),auth[_0xf1ab('0x8')](),controller['show']);router['get'](_0xf1ab('0xb'),auth[_0xf1ab('0x8')](),timeout(_0xf1ab('0xc')),controller[_0xf1ab('0xd')]);router['post']('/',auth[_0xf1ab('0x8')](),controller['create']);router[_0xf1ab('0xe')]('/:id',auth[_0xf1ab('0x8')](),controller[_0xf1ab('0xf')]);router[_0xf1ab('0x10')]('/:id',auth[_0xf1ab('0x8')](),controller[_0xf1ab('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0x73dd=['/:id','show','test','post','create','update','destroy','exports','util','path','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x73dd,0x178));var _0xd73d=function(_0x236307,_0x6ab302){_0x236307=_0x236307-0x0;var _0x10b9b6=_0x73dd[_0x236307];return _0x10b9b6;};'use strict';var multer=require('multer');var util=require(_0xd73d('0x0'));var path=require(_0xd73d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd73d('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd73d('0x3'));var controller=require(_0xd73d('0x4'));router[_0xd73d('0x5')]('/',auth[_0xd73d('0x6')](),controller[_0xd73d('0x7')]);router[_0xd73d('0x5')](_0xd73d('0x8'),auth['isAuthenticated'](),controller[_0xd73d('0x9')]);router[_0xd73d('0x5')]('/:id/test',auth[_0xd73d('0x6')](),timeout('15s'),controller[_0xd73d('0xa')]);router[_0xd73d('0xb')]('/',auth[_0xd73d('0x6')](),controller[_0xd73d('0xc')]);router['put'](_0xd73d('0x8'),auth[_0xd73d('0x6')](),controller[_0xd73d('0xd')]);router['delete'](_0xd73d('0x8'),auth[_0xd73d('0x6')](),controller[_0xd73d('0xe')]);module[_0xd73d('0xf')]=router;
\ No newline at end of file
index e2fd717..969aa28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7632=['exports','STRING','name'];(function(_0xdaf3d1,_0x4d7ed5){var _0x1b25ce=function(_0x1d7d34){while(--_0x1d7d34){_0xdaf3d1['push'](_0xdaf3d1['shift']());}};_0x1b25ce(++_0x4d7ed5);}(_0x7632,0x11a));var _0x2763=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x7632[_0xd22d95];return _0x15d7a3;};'use strict';var Sequelize=require('sequelize');module[_0x2763('0x0')]={'name':{'type':Sequelize[_0x2763('0x1')],'unique':_0x2763('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2763('0x1')]}};
\ No newline at end of file
+var _0x526f=['sequelize','exports','name','STRING'];(function(_0x3bd012,_0x532da7){var _0x3cbb1b=function(_0x326382){while(--_0x326382){_0x3bd012['push'](_0x3bd012['shift']());}};_0x3cbb1b(++_0x532da7);}(_0x526f,0xc0));var _0xf526=function(_0x1720af,_0x1986d6){_0x1720af=_0x1720af-0x0;var _0x31c7de=_0x526f[_0x1720af];return _0x31c7de;};'use strict';var Sequelize=require(_0xf526('0x0'));module[_0xf526('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf526('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf526('0x3')]},'description':{'type':Sequelize[_0xf526('0x3')]}};
\ No newline at end of file
index 38dbe50..bb333fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b15=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x8b15,0x1a3));var _0x58b1=function(_0x48efbd,_0x10398f){_0x48efbd=_0x48efbd-0x0;var _0x57fe53=_0x8b15[_0x48efbd];return _0x57fe53;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x58b1('0x0'));var rp=require('request-promise');var moment=require(_0x58b1('0x1'));var BPromise=require(_0x58b1('0x2'));var Mustache=require(_0x58b1('0x3'));var util=require(_0x58b1('0x4'));var path=require(_0x58b1('0x5'));var sox=require('sox');var csv=require(_0x58b1('0x6'));var ejs=require(_0x58b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x58b1('0x8'));var crypto=require(_0x58b1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x58b1('0xa'));var toCsv=require(_0x58b1('0x6'));var querystring=require(_0x58b1('0xb'));var Papa=require(_0x58b1('0xc'));var Redis=require('ioredis');var authService=require(_0x58b1('0xd'));var qs=require(_0x58b1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x58b1('0xf'))('api');var utils=require(_0x58b1('0x10'));var config=require(_0x58b1('0x11'));var licenseUtil=require(_0x58b1('0x12'));var db=require(_0x58b1('0x13'))['db'];function respondWithStatusCode(_0x1022b9,_0x13a142){_0x13a142=_0x13a142||0xcc;return function(_0x4f8160){if(_0x4f8160){return _0x1022b9['sendStatus'](_0x13a142);}return _0x1022b9['status'](_0x13a142)[_0x58b1('0x14')]();};}function respondWithResult(_0x39f4e6,_0xdfea67){_0xdfea67=_0xdfea67||0xc8;return function(_0x502609){if(_0x502609){return _0x39f4e6[_0x58b1('0x15')](_0xdfea67)['json'](_0x502609);}};}function respondWithFilteredResult(_0x75daf,_0x2172db){return function(_0x532185){if(_0x532185){var _0x13a274=typeof _0x2172db[_0x58b1('0x16')]===_0x58b1('0x17')&&typeof _0x2172db[_0x58b1('0x18')]===_0x58b1('0x17');var _0x3ff366=_0x532185[_0x58b1('0x19')];var _0x2add58=_0x13a274?0x0:_0x2172db[_0x58b1('0x16')];var _0x3ce463=_0x13a274?_0x532185[_0x58b1('0x19')]:_0x2172db[_0x58b1('0x16')]+_0x2172db['limit'];var _0x553327;if(_0x3ce463>=_0x3ff366){_0x3ce463=_0x3ff366;_0x553327=0xc8;}else{_0x553327=0xce;}_0x75daf[_0x58b1('0x15')](_0x553327);return _0x75daf['set'](_0x58b1('0x1a'),_0x2add58+'-'+_0x3ce463+'/'+_0x3ff366)[_0x58b1('0x1b')](_0x532185);}return null;};}function patchUpdates(_0x580f36){return function(_0x76ff8b){try{jsonpatch['apply'](_0x76ff8b,_0x580f36,!![]);}catch(_0x381413){return BPromise[_0x58b1('0x1c')](_0x381413);}return _0x76ff8b[_0x58b1('0x1d')]();};}function saveUpdates(_0x5cd61d,_0x25d9ac){return function(_0x30ee8b){if(_0x30ee8b){return _0x30ee8b[_0x58b1('0x1e')](_0x5cd61d)[_0x58b1('0x1f')](function(_0x3370cb){return _0x3370cb;});}return null;};}function removeEntity(_0x17a863,_0x16b533){return function(_0x55863b){if(_0x55863b){return _0x55863b[_0x58b1('0x20')]()[_0x58b1('0x1f')](function(){var _0x4da24a=_0x55863b[_0x58b1('0x21')]({'plain':!![]});var _0x128f49=_0x58b1('0x22');return db[_0x58b1('0x23')][_0x58b1('0x20')]({'where':{'type':_0x128f49,'resourceId':_0x4da24a['id']}})['then'](function(){return _0x55863b;});})['then'](function(){_0x17a863[_0x58b1('0x15')](0xcc)[_0x58b1('0x14')]();});}};}function handleEntityNotFound(_0x3f1469,_0x37782c){return function(_0x2327ce){if(!_0x2327ce){_0x3f1469['sendStatus'](0x194);}return _0x2327ce;};}function handleError(_0x124cde,_0xcdf3e1){_0xcdf3e1=_0xcdf3e1||0x1f4;return function(_0x33ccb2){logger[_0x58b1('0x24')](_0x33ccb2[_0x58b1('0x25')]);if(_0x33ccb2[_0x58b1('0x26')]){delete _0x33ccb2[_0x58b1('0x26')];}_0x124cde[_0x58b1('0x15')](_0xcdf3e1)[_0x58b1('0x27')](_0x33ccb2);};}exports['index']=function(_0x47b3bc,_0x15cb02){var _0x3e19d2={},_0x1de173={},_0x195ec1={'count':0x0,'rows':[]};var _0x4f271e=_[_0x58b1('0x28')](db[_0x58b1('0x29')][_0x58b1('0x2a')],function(_0x411ce1){return{'name':_0x411ce1[_0x58b1('0x2b')],'type':_0x411ce1[_0x58b1('0x2c')][_0x58b1('0x2d')]};});_0x1de173[_0x58b1('0x2e')]=_[_0x58b1('0x28')](_0x4f271e,_0x58b1('0x26'));_0x1de173['query']=_[_0x58b1('0x2f')](_0x47b3bc[_0x58b1('0x30')]);_0x1de173[_0x58b1('0x31')]=_[_0x58b1('0x32')](_0x1de173['model'],_0x1de173[_0x58b1('0x30')]);_0x3e19d2[_0x58b1('0x33')]=_['intersection'](_0x1de173['model'],qs['fields'](_0x47b3bc['query'][_0x58b1('0x34')]));_0x3e19d2[_0x58b1('0x33')]=_0x3e19d2[_0x58b1('0x33')]['length']?_0x3e19d2['attributes']:_0x1de173['model'];if(!_0x47b3bc[_0x58b1('0x30')][_0x58b1('0x35')](_0x58b1('0x36'))){_0x3e19d2[_0x58b1('0x18')]=qs[_0x58b1('0x18')](_0x47b3bc['query'][_0x58b1('0x18')]);_0x3e19d2['offset']=qs[_0x58b1('0x16')](_0x47b3bc[_0x58b1('0x30')][_0x58b1('0x16')]);}_0x3e19d2[_0x58b1('0x37')]=qs[_0x58b1('0x38')](_0x47b3bc[_0x58b1('0x30')][_0x58b1('0x38')]);_0x3e19d2['where']=qs['filters'](_[_0x58b1('0x39')](_0x47b3bc[_0x58b1('0x30')],_0x1de173[_0x58b1('0x31')]),_0x4f271e);if(_0x47b3bc[_0x58b1('0x30')][_0x58b1('0x3a')]){_0x3e19d2[_0x58b1('0x3b')]=_[_0x58b1('0x3c')](_0x3e19d2[_0x58b1('0x3b')],{'$or':_[_0x58b1('0x28')](_0x4f271e,function(_0x53be14){if(_0x53be14[_0x58b1('0x2c')]!=='VIRTUAL'){var _0x1ea870={};_0x1ea870[_0x53be14[_0x58b1('0x26')]]={'$like':'%'+_0x47b3bc[_0x58b1('0x30')][_0x58b1('0x3a')]+'%'};return _0x1ea870;}})});}_0x3e19d2=_[_0x58b1('0x3c')]({},_0x3e19d2,_0x47b3bc[_0x58b1('0x3d')]);var _0x1435da={'where':_0x3e19d2[_0x58b1('0x3b')]};return db[_0x58b1('0x29')][_0x58b1('0x19')](_0x1435da)['then'](function(_0x398d9c){_0x195ec1[_0x58b1('0x19')]=_0x398d9c;if(_0x47b3bc['query'][_0x58b1('0x3e')]){_0x3e19d2[_0x58b1('0x3f')]=[{'all':!![]}];}return db[_0x58b1('0x29')][_0x58b1('0x40')](_0x3e19d2);})[_0x58b1('0x1f')](function(_0x2ed2d1){_0x195ec1['rows']=_0x2ed2d1;return _0x195ec1;})[_0x58b1('0x1f')](respondWithFilteredResult(_0x15cb02,_0x3e19d2))[_0x58b1('0x41')](handleError(_0x15cb02,null));};exports[_0x58b1('0x42')]=function(_0x550751,_0x201170){var _0x1afc6f={'raw':!![],'where':{'id':_0x550751[_0x58b1('0x43')]['id']}},_0x128028={};_0x128028[_0x58b1('0x2e')]=_['keys'](db[_0x58b1('0x29')]['rawAttributes']);_0x128028[_0x58b1('0x30')]=_['keys'](_0x550751['query']);_0x128028['filters']=_[_0x58b1('0x32')](_0x128028[_0x58b1('0x2e')],_0x128028[_0x58b1('0x30')]);_0x1afc6f['attributes']=_[_0x58b1('0x32')](_0x128028[_0x58b1('0x2e')],qs[_0x58b1('0x34')](_0x550751['query'][_0x58b1('0x34')]));_0x1afc6f['attributes']=_0x1afc6f[_0x58b1('0x33')][_0x58b1('0x44')]?_0x1afc6f['attributes']:_0x128028[_0x58b1('0x2e')];if(_0x550751[_0x58b1('0x30')][_0x58b1('0x3e')]){_0x1afc6f['include']=[{'all':!![]}];}_0x1afc6f=_[_0x58b1('0x3c')]({},_0x1afc6f,_0x550751[_0x58b1('0x3d')]);return db[_0x58b1('0x29')][_0x58b1('0x45')](_0x1afc6f)[_0x58b1('0x1f')](handleEntityNotFound(_0x201170,null))[_0x58b1('0x1f')](respondWithResult(_0x201170,null))[_0x58b1('0x41')](handleError(_0x201170,null));};exports['create']=function(_0x25ce2e,_0x51432f){return db[_0x58b1('0x29')][_0x58b1('0x46')](_0x25ce2e[_0x58b1('0x47')],{})[_0x58b1('0x1f')](function(_0xbcdcdc){var _0x20908f=_0x25ce2e[_0x58b1('0x48')][_0x58b1('0x21')]({'plain':!![]});if(!_0x20908f)throw new Error(_0x58b1('0x49'));if(_0x20908f[_0x58b1('0x4a')]===_0x58b1('0x48')){var _0x5b1a5f=_0xbcdcdc[_0x58b1('0x21')]({'plain':!![]});var _0x4dc3d2=_0x58b1('0x22');return db[_0x58b1('0x4b')][_0x58b1('0x45')]({'where':{'name':_0x4dc3d2,'userProfileId':_0x20908f[_0x58b1('0x4c')]},'raw':!![]})[_0x58b1('0x1f')](function(_0x558c11){if(_0x558c11&&_0x558c11['autoAssociation']===0x0){return db[_0x58b1('0x23')][_0x58b1('0x46')]({'name':_0x5b1a5f['name'],'resourceId':_0x5b1a5f['id'],'type':_0x558c11[_0x58b1('0x26')],'sectionId':_0x558c11['id']},{})[_0x58b1('0x1f')](function(){return _0xbcdcdc;});}else{return _0xbcdcdc;}})[_0x58b1('0x41')](function(_0x208681){logger[_0x58b1('0x24')](_0x58b1('0x4d'),_0x208681);throw _0x208681;});}return _0xbcdcdc;})[_0x58b1('0x1f')](respondWithResult(_0x51432f,0xc9))['catch'](handleError(_0x51432f,null));};exports[_0x58b1('0x1e')]=function(_0x1326a1,_0xe05143){if(_0x1326a1[_0x58b1('0x47')]['id']){delete _0x1326a1['body']['id'];}return db[_0x58b1('0x29')]['find']({'where':{'id':_0x1326a1[_0x58b1('0x43')]['id']}})['then'](handleEntityNotFound(_0xe05143,null))[_0x58b1('0x1f')](saveUpdates(_0x1326a1[_0x58b1('0x47')],null))[_0x58b1('0x1f')](respondWithResult(_0xe05143,null))[_0x58b1('0x41')](handleError(_0xe05143,null));};exports['destroy']=function(_0x51fca6,_0xa235){return db['SquareOdbc'][_0x58b1('0x45')]({'where':{'id':_0x51fca6[_0x58b1('0x43')]['id']}})[_0x58b1('0x1f')](handleEntityNotFound(_0xa235,null))[_0x58b1('0x1f')](removeEntity(_0xa235,null))[_0x58b1('0x41')](handleError(_0xa235,null));};exports[_0x58b1('0x4e')]=function(_0x35b2d9,_0x1b1670,_0x4a8130){var _0x2a373f;return db['SquareOdbc'][_0x58b1('0x45')]({'where':{'id':_0x35b2d9[_0x58b1('0x43')]['id']},'attributes':['id',_0x58b1('0x4f')]})[_0x58b1('0x1f')](handleEntityNotFound(_0x1b1670,null))[_0x58b1('0x1f')](function(_0x4e1397){if(_0x4e1397){var _0x376dba=require(_0x58b1('0x50'))();_0x376dba['openSync'](_0x4e1397['dsn']);_0x376dba[_0x58b1('0x51')]();return _0x4e1397;}})[_0x58b1('0x1f')](respondWithResult(_0x1b1670,null))['catch'](handleError(_0x1b1670,null));};
\ No newline at end of file
+var _0x1d06=['request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','show','params','keys','filters','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','test','dsn','odbc','openSync','eml-format','zip-dir','fast-json-patch'];(function(_0x3aeb49,_0x1920ee){var _0x2f5e81=function(_0x2dfa6b){while(--_0x2dfa6b){_0x3aeb49['push'](_0x3aeb49['shift']());}};_0x2f5e81(++_0x1920ee);}(_0x1d06,0x105));var _0x61d0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1d06[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x61d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x61d0('0x1'));var jsonpatch=require(_0x61d0('0x2'));var rp=require(_0x61d0('0x3'));var moment=require(_0x61d0('0x4'));var BPromise=require(_0x61d0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x61d0('0x6'));var sox=require(_0x61d0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61d0('0x8'));var _=require(_0x61d0('0x9'));var squel=require(_0x61d0('0xa'));var crypto=require(_0x61d0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x61d0('0xc'));var toCsv=require(_0x61d0('0xd'));var querystring=require(_0x61d0('0xe'));var Papa=require(_0x61d0('0xf'));var Redis=require(_0x61d0('0x10'));var authService=require(_0x61d0('0x11'));var qs=require(_0x61d0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61d0('0x13'));var logger=require('../../config/logger')(_0x61d0('0x14'));var utils=require('../../config/utils');var config=require(_0x61d0('0x15'));var licenseUtil=require(_0x61d0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x244960,_0xee654c){_0xee654c=_0xee654c||0xcc;return function(_0x52a619){if(_0x52a619){return _0x244960[_0x61d0('0x17')](_0xee654c);}return _0x244960[_0x61d0('0x18')](_0xee654c)[_0x61d0('0x19')]();};}function respondWithResult(_0x10972f,_0x17a5bf){_0x17a5bf=_0x17a5bf||0xc8;return function(_0x252dfd){if(_0x252dfd){return _0x10972f['status'](_0x17a5bf)[_0x61d0('0x1a')](_0x252dfd);}};}function respondWithFilteredResult(_0x1a5ff7,_0x1cb775){return function(_0x5b377c){if(_0x5b377c){var _0x27d086=typeof _0x1cb775['offset']===_0x61d0('0x1b')&&typeof _0x1cb775[_0x61d0('0x1c')]===_0x61d0('0x1b');var _0x5dc2e7=_0x5b377c[_0x61d0('0x1d')];var _0x553c31=_0x27d086?0x0:_0x1cb775['offset'];var _0x353222=_0x27d086?_0x5b377c['count']:_0x1cb775[_0x61d0('0x1e')]+_0x1cb775[_0x61d0('0x1c')];var _0x86554c;if(_0x353222>=_0x5dc2e7){_0x353222=_0x5dc2e7;_0x86554c=0xc8;}else{_0x86554c=0xce;}_0x1a5ff7[_0x61d0('0x18')](_0x86554c);return _0x1a5ff7['set']('Content-Range',_0x553c31+'-'+_0x353222+'/'+_0x5dc2e7)['json'](_0x5b377c);}return null;};}function patchUpdates(_0x2732ef){return function(_0x241824){try{jsonpatch[_0x61d0('0x1f')](_0x241824,_0x2732ef,!![]);}catch(_0x1260cf){return BPromise[_0x61d0('0x20')](_0x1260cf);}return _0x241824[_0x61d0('0x21')]();};}function saveUpdates(_0x128e66,_0x4c950a){return function(_0x4ea662){if(_0x4ea662){return _0x4ea662[_0x61d0('0x22')](_0x128e66)[_0x61d0('0x23')](function(_0x2e9832){return _0x2e9832;});}return null;};}function removeEntity(_0x4d85c5,_0xd04840){return function(_0x1be90c){if(_0x1be90c){return _0x1be90c[_0x61d0('0x24')]()[_0x61d0('0x23')](function(){var _0x901871=_0x1be90c[_0x61d0('0x25')]({'plain':!![]});var _0x24e260=_0x61d0('0x26');return db[_0x61d0('0x27')]['destroy']({'where':{'type':_0x24e260,'resourceId':_0x901871['id']}})[_0x61d0('0x23')](function(){return _0x1be90c;});})[_0x61d0('0x23')](function(){_0x4d85c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x359a80,_0x590175){return function(_0x4f476a){if(!_0x4f476a){_0x359a80[_0x61d0('0x17')](0x194);}return _0x4f476a;};}function handleError(_0x54c6a8,_0x38db26){_0x38db26=_0x38db26||0x1f4;return function(_0x3e444d){logger[_0x61d0('0x28')](_0x3e444d[_0x61d0('0x29')]);if(_0x3e444d['name']){delete _0x3e444d['name'];}_0x54c6a8[_0x61d0('0x18')](_0x38db26)[_0x61d0('0x2a')](_0x3e444d);};}exports[_0x61d0('0x2b')]=function(_0x3dffda,_0x1cf637){var _0x1bd75f={},_0x15fb89={},_0x4532cb={'count':0x0,'rows':[]};var _0x1c6742=_['map'](db[_0x61d0('0x2c')][_0x61d0('0x2d')],function(_0x348081){return{'name':_0x348081[_0x61d0('0x2e')],'type':_0x348081[_0x61d0('0x2f')][_0x61d0('0x30')]};});_0x15fb89[_0x61d0('0x31')]=_[_0x61d0('0x32')](_0x1c6742,'name');_0x15fb89[_0x61d0('0x33')]=_['keys'](_0x3dffda[_0x61d0('0x33')]);_0x15fb89['filters']=_[_0x61d0('0x34')](_0x15fb89[_0x61d0('0x31')],_0x15fb89[_0x61d0('0x33')]);_0x1bd75f[_0x61d0('0x35')]=_[_0x61d0('0x34')](_0x15fb89[_0x61d0('0x31')],qs[_0x61d0('0x36')](_0x3dffda[_0x61d0('0x33')][_0x61d0('0x36')]));_0x1bd75f[_0x61d0('0x35')]=_0x1bd75f[_0x61d0('0x35')][_0x61d0('0x37')]?_0x1bd75f['attributes']:_0x15fb89[_0x61d0('0x31')];if(!_0x3dffda['query'][_0x61d0('0x38')](_0x61d0('0x39'))){_0x1bd75f[_0x61d0('0x1c')]=qs[_0x61d0('0x1c')](_0x3dffda[_0x61d0('0x33')]['limit']);_0x1bd75f[_0x61d0('0x1e')]=qs[_0x61d0('0x1e')](_0x3dffda['query'][_0x61d0('0x1e')]);}_0x1bd75f[_0x61d0('0x3a')]=qs[_0x61d0('0x3b')](_0x3dffda['query'][_0x61d0('0x3b')]);_0x1bd75f[_0x61d0('0x3c')]=qs['filters'](_[_0x61d0('0x3d')](_0x3dffda[_0x61d0('0x33')],_0x15fb89['filters']),_0x1c6742);if(_0x3dffda[_0x61d0('0x33')]['filter']){_0x1bd75f[_0x61d0('0x3c')]=_[_0x61d0('0x3e')](_0x1bd75f['where'],{'$or':_['map'](_0x1c6742,function(_0x291fd5){if(_0x291fd5[_0x61d0('0x2f')]!==_0x61d0('0x3f')){var _0x2931e4={};_0x2931e4[_0x291fd5[_0x61d0('0x40')]]={'$like':'%'+_0x3dffda['query'][_0x61d0('0x41')]+'%'};return _0x2931e4;}})});}_0x1bd75f=_[_0x61d0('0x3e')]({},_0x1bd75f,_0x3dffda[_0x61d0('0x42')]);var _0x2a7237={'where':_0x1bd75f[_0x61d0('0x3c')]};return db[_0x61d0('0x2c')][_0x61d0('0x1d')](_0x2a7237)['then'](function(_0x287b45){_0x4532cb['count']=_0x287b45;if(_0x3dffda[_0x61d0('0x33')][_0x61d0('0x43')]){_0x1bd75f[_0x61d0('0x44')]=[{'all':!![]}];}return db[_0x61d0('0x2c')][_0x61d0('0x45')](_0x1bd75f);})['then'](function(_0x2995d0){_0x4532cb[_0x61d0('0x46')]=_0x2995d0;return _0x4532cb;})[_0x61d0('0x23')](respondWithFilteredResult(_0x1cf637,_0x1bd75f))['catch'](handleError(_0x1cf637,null));};exports[_0x61d0('0x47')]=function(_0x1f5b8c,_0x38c2db){var _0x22ab9c={'raw':!![],'where':{'id':_0x1f5b8c[_0x61d0('0x48')]['id']}},_0x933a0f={};_0x933a0f[_0x61d0('0x31')]=_[_0x61d0('0x49')](db[_0x61d0('0x2c')]['rawAttributes']);_0x933a0f['query']=_[_0x61d0('0x49')](_0x1f5b8c[_0x61d0('0x33')]);_0x933a0f[_0x61d0('0x4a')]=_['intersection'](_0x933a0f[_0x61d0('0x31')],_0x933a0f[_0x61d0('0x33')]);_0x22ab9c[_0x61d0('0x35')]=_[_0x61d0('0x34')](_0x933a0f[_0x61d0('0x31')],qs[_0x61d0('0x36')](_0x1f5b8c[_0x61d0('0x33')][_0x61d0('0x36')]));_0x22ab9c['attributes']=_0x22ab9c[_0x61d0('0x35')]['length']?_0x22ab9c[_0x61d0('0x35')]:_0x933a0f[_0x61d0('0x31')];if(_0x1f5b8c[_0x61d0('0x33')][_0x61d0('0x43')]){_0x22ab9c[_0x61d0('0x44')]=[{'all':!![]}];}_0x22ab9c=_['merge']({},_0x22ab9c,_0x1f5b8c[_0x61d0('0x42')]);return db[_0x61d0('0x2c')][_0x61d0('0x4b')](_0x22ab9c)['then'](handleEntityNotFound(_0x38c2db,null))[_0x61d0('0x23')](respondWithResult(_0x38c2db,null))['catch'](handleError(_0x38c2db,null));};exports['create']=function(_0x579529,_0x51f77c){return db['SquareOdbc'][_0x61d0('0x4c')](_0x579529['body'],{})['then'](function(_0x7fb276){var _0x3c63fc=_0x579529['user'][_0x61d0('0x25')]({'plain':!![]});if(!_0x3c63fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c63fc[_0x61d0('0x4d')]===_0x61d0('0x4e')){var _0x40b5a5=_0x7fb276['get']({'plain':!![]});var _0x41f904=_0x61d0('0x26');return db[_0x61d0('0x4f')][_0x61d0('0x4b')]({'where':{'name':_0x41f904,'userProfileId':_0x3c63fc[_0x61d0('0x50')]},'raw':!![]})[_0x61d0('0x23')](function(_0x211355){if(_0x211355&&_0x211355['autoAssociation']===0x0){return db[_0x61d0('0x27')][_0x61d0('0x4c')]({'name':_0x40b5a5[_0x61d0('0x40')],'resourceId':_0x40b5a5['id'],'type':_0x211355['name'],'sectionId':_0x211355['id']},{})[_0x61d0('0x23')](function(){return _0x7fb276;});}else{return _0x7fb276;}})['catch'](function(_0x1247e3){logger[_0x61d0('0x28')](_0x61d0('0x51'),_0x1247e3);throw _0x1247e3;});}return _0x7fb276;})['then'](respondWithResult(_0x51f77c,0xc9))[_0x61d0('0x52')](handleError(_0x51f77c,null));};exports[_0x61d0('0x22')]=function(_0x4a3ee4,_0x491286){if(_0x4a3ee4['body']['id']){delete _0x4a3ee4[_0x61d0('0x53')]['id'];}return db[_0x61d0('0x2c')][_0x61d0('0x4b')]({'where':{'id':_0x4a3ee4[_0x61d0('0x48')]['id']}})[_0x61d0('0x23')](handleEntityNotFound(_0x491286,null))['then'](saveUpdates(_0x4a3ee4[_0x61d0('0x53')],null))['then'](respondWithResult(_0x491286,null))[_0x61d0('0x52')](handleError(_0x491286,null));};exports[_0x61d0('0x24')]=function(_0xb78997,_0x4233f8){return db['SquareOdbc'][_0x61d0('0x4b')]({'where':{'id':_0xb78997['params']['id']}})[_0x61d0('0x23')](handleEntityNotFound(_0x4233f8,null))[_0x61d0('0x23')](removeEntity(_0x4233f8,null))[_0x61d0('0x52')](handleError(_0x4233f8,null));};exports[_0x61d0('0x54')]=function(_0x511207,_0xecce4b,_0x4b397b){var _0x20fa83;return db[_0x61d0('0x2c')][_0x61d0('0x4b')]({'where':{'id':_0x511207[_0x61d0('0x48')]['id']},'attributes':['id',_0x61d0('0x55')]})[_0x61d0('0x23')](handleEntityNotFound(_0xecce4b,null))[_0x61d0('0x23')](function(_0x9f867c){if(_0x9f867c){var _0x3c3a12=require(_0x61d0('0x56'))();_0x3c3a12[_0x61d0('0x57')](_0x9f867c[_0x61d0('0x55')]);_0x3c3a12['closeSync']();return _0x9f867c;}})[_0x61d0('0x23')](respondWithResult(_0xecce4b,null))[_0x61d0('0x52')](handleError(_0xecce4b,null));};
\ No newline at end of file
index 5c258ad..5d8cef5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb21f=['rimraf','./squareOdbc.attributes','define','SquareOdbc','square_odbc','util','../../config/logger','moment','bluebird','path'];(function(_0x16dcf2,_0x401aea){var _0x50b300=function(_0x29389e){while(--_0x29389e){_0x16dcf2['push'](_0x16dcf2['shift']());}};_0x50b300(++_0x401aea);}(_0xb21f,0x13b));var _0xfb21=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb21f[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0xfb21('0x0'));var logger=require(_0xfb21('0x1'))('api');var moment=require(_0xfb21('0x2'));var BPromise=require(_0xfb21('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb21('0x4'));var rimraf=require(_0xfb21('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb21('0x6'));module['exports']=function(_0x1ee835,_0x3912e8){return _0x1ee835[_0xfb21('0x7')](_0xfb21('0x8'),attributes,{'tableName':_0xfb21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc076=['exports','define','SquareOdbc','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareOdbc.attributes'];(function(_0x203959,_0x237b3f){var _0x3e5b55=function(_0x1581db){while(--_0x1581db){_0x203959['push'](_0x203959['shift']());}};_0x3e5b55(++_0x237b3f);}(_0xc076,0xf5));var _0x6c07=function(_0x51b8dd,_0x15f50b){_0x51b8dd=_0x51b8dd-0x0;var _0x1906c9=_0xc076[_0x51b8dd];return _0x1906c9;};'use strict';var _=require('lodash');var util=require(_0x6c07('0x0'));var logger=require(_0x6c07('0x1'))(_0x6c07('0x2'));var moment=require(_0x6c07('0x3'));var BPromise=require(_0x6c07('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c07('0x5'));var rimraf=require('rimraf');var config=require(_0x6c07('0x6'));var attributes=require(_0x6c07('0x7'));module[_0x6c07('0x8')]=function(_0x4cb3db,_0x33739f){return _0x4cb3db[_0x6c07('0x9')](_0x6c07('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 293d219..786fe9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6033=['stringify','error','code','message','request\x20sent','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x91a150,_0x50a17b){var _0x48de6c=function(_0x452d8a){while(--_0x452d8a){_0x91a150['push'](_0x91a150['shift']());}};_0x48de6c(++_0x50a17b);}(_0x6033,0xd7));var _0x3603=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6033[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3603('0x0'));var util=require(_0x3603('0x1'));var moment=require(_0x3603('0x2'));var BPromise=require(_0x3603('0x3'));var rs=require(_0x3603('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3603('0x5'))['db'];var utils=require(_0x3603('0x6'));var logger=require('../../config/logger')(_0x3603('0x7'));var config=require('../../config/environment');var jayson=require(_0x3603('0x8'));var client=jayson[_0x3603('0x9')][_0x3603('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26cb80,_0xd6d5d7,_0x1fc7e3){return new BPromise(function(_0x10660d,_0x35f7ec){return client[_0x3603('0xb')](_0x26cb80,_0x1fc7e3)[_0x3603('0xc')](function(_0x559ff2){logger['info'](_0x3603('0xd'),_0xd6d5d7,'request\x20sent');logger[_0x3603('0xe')](_0x3603('0xf'),_0xd6d5d7,'request\x20sent',JSON[_0x3603('0x10')](_0x559ff2));if(_0x559ff2[_0x3603('0x11')]){if(_0x559ff2[_0x3603('0x11')][_0x3603('0x12')]===0x1f4){logger[_0x3603('0x11')](_0x3603('0xd'),_0xd6d5d7,_0x559ff2[_0x3603('0x11')][_0x3603('0x13')]);return _0x35f7ec(_0x559ff2[_0x3603('0x11')]['message']);}logger['error'](_0x3603('0xd'),_0xd6d5d7,_0x559ff2[_0x3603('0x11')]['message']);return _0x10660d(_0x559ff2[_0x3603('0x11')][_0x3603('0x13')]);}else{logger['info'](_0x3603('0xd'),_0xd6d5d7,_0x3603('0x14'));_0x10660d(_0x559ff2[_0x3603('0x15')]['message']);}})[_0x3603('0x16')](function(_0x1f4fcb){logger[_0x3603('0x11')](_0x3603('0xd'),_0xd6d5d7,_0x1f4fcb);_0x35f7ec(_0x1f4fcb);});});}exports[_0x3603('0x17')]=function(_0x532741){var _0x52f083=this;return new Promise(function(_0x24e4af,_0x47f67a){return db['SquareOdbc'][_0x3603('0x18')]({'raw':_0x532741[_0x3603('0x19')]?_0x532741['options'][_0x3603('0x1a')]===undefined?!![]:![]:!![],'where':_0x532741[_0x3603('0x19')]?_0x532741[_0x3603('0x19')][_0x3603('0x1b')]||null:null,'attributes':_0x532741[_0x3603('0x19')]?_0x532741[_0x3603('0x19')][_0x3603('0x1c')]||null:null,'include':_0x532741[_0x3603('0x19')]?_0x532741[_0x3603('0x19')][_0x3603('0x1d')]?_[_0x3603('0x1e')](_0x532741[_0x3603('0x19')][_0x3603('0x1d')],function(_0x456861){return{'model':db[_0x456861[_0x3603('0x1f')]],'as':_0x456861['as'],'attributes':_0x456861[_0x3603('0x1c')],'include':_0x456861['include']?_[_0x3603('0x1e')](_0x456861[_0x3603('0x1d')],function(_0xc20444){return{'model':db[_0xc20444[_0x3603('0x1f')]],'as':_0xc20444['as'],'attributes':_0xc20444[_0x3603('0x1c')],'include':_0xc20444[_0x3603('0x1d')]?_[_0x3603('0x1e')](_0xc20444[_0x3603('0x1d')],function(_0x759d1f){return{'model':db[_0x759d1f[_0x3603('0x1f')]],'as':_0x759d1f['as'],'attributes':_0x759d1f[_0x3603('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3603('0xc')](function(_0x1ec868){logger[_0x3603('0x20')](_0x3603('0x17'),_0x532741);logger[_0x3603('0xe')](_0x3603('0x17'),_0x532741,JSON[_0x3603('0x10')](_0x1ec868));_0x24e4af(_0x1ec868);})[_0x3603('0x16')](function(_0x4ce3d0){logger[_0x3603('0x11')](_0x3603('0x17'),_0x4ce3d0[_0x3603('0x13')],_0x532741);_0x47f67a(_0x52f083['error'](0x1f4,_0x4ce3d0[_0x3603('0x13')]));});});};
\ No newline at end of file
+var _0x7f88=['map','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','where','include','model','attributes'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7f88,0xf1));var _0x87f8=function(_0xa2b93c,_0x6c94df){_0xa2b93c=_0xa2b93c-0x0;var _0x1cfeed=_0x7f88[_0xa2b93c];return _0x1cfeed;};'use strict';var _=require('lodash');var util=require(_0x87f8('0x0'));var moment=require(_0x87f8('0x1'));var BPromise=require(_0x87f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x87f8('0x4'));var logger=require(_0x87f8('0x5'))(_0x87f8('0x6'));var config=require(_0x87f8('0x7'));var jayson=require(_0x87f8('0x8'));var client=jayson['client'][_0x87f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40dda8,_0x2ea153,_0x5ad0a2){return new BPromise(function(_0x38f1d8,_0x3ad4e9){return client[_0x87f8('0xa')](_0x40dda8,_0x5ad0a2)[_0x87f8('0xb')](function(_0x1ac7b4){logger[_0x87f8('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x2ea153,'request\x20sent');logger[_0x87f8('0xd')](_0x87f8('0xe'),_0x2ea153,_0x87f8('0xf'),JSON[_0x87f8('0x10')](_0x1ac7b4));if(_0x1ac7b4[_0x87f8('0x11')]){if(_0x1ac7b4[_0x87f8('0x11')]['code']===0x1f4){logger[_0x87f8('0x11')](_0x87f8('0x12'),_0x2ea153,_0x1ac7b4['error']['message']);return _0x3ad4e9(_0x1ac7b4['error'][_0x87f8('0x13')]);}logger['error'](_0x87f8('0x12'),_0x2ea153,_0x1ac7b4[_0x87f8('0x11')][_0x87f8('0x13')]);return _0x38f1d8(_0x1ac7b4[_0x87f8('0x11')][_0x87f8('0x13')]);}else{logger['info'](_0x87f8('0x12'),_0x2ea153,_0x87f8('0xf'));_0x38f1d8(_0x1ac7b4['result']['message']);}})[_0x87f8('0x14')](function(_0x3afdd6){logger[_0x87f8('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x2ea153,_0x3afdd6);_0x3ad4e9(_0x3afdd6);});});}exports[_0x87f8('0x15')]=function(_0x3cf518){var _0x358bd4=this;return new Promise(function(_0x3c8041,_0x1a990b){return db[_0x87f8('0x16')][_0x87f8('0x17')]({'raw':_0x3cf518[_0x87f8('0x18')]?_0x3cf518[_0x87f8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3cf518[_0x87f8('0x18')]?_0x3cf518[_0x87f8('0x18')][_0x87f8('0x19')]||null:null,'attributes':_0x3cf518[_0x87f8('0x18')]?_0x3cf518[_0x87f8('0x18')]['attributes']||null:null,'include':_0x3cf518['options']?_0x3cf518['options']['include']?_['map'](_0x3cf518[_0x87f8('0x18')][_0x87f8('0x1a')],function(_0x237dea){return{'model':db[_0x237dea[_0x87f8('0x1b')]],'as':_0x237dea['as'],'attributes':_0x237dea[_0x87f8('0x1c')],'include':_0x237dea['include']?_['map'](_0x237dea['include'],function(_0x57746f){return{'model':db[_0x57746f[_0x87f8('0x1b')]],'as':_0x57746f['as'],'attributes':_0x57746f[_0x87f8('0x1c')],'include':_0x57746f['include']?_[_0x87f8('0x1d')](_0x57746f[_0x87f8('0x1a')],function(_0xdbf70f){return{'model':db[_0xdbf70f['model']],'as':_0xdbf70f['as'],'attributes':_0xdbf70f['attributes']};}):[]};}):[]};}):[]:[]})[_0x87f8('0xb')](function(_0x23ad04){logger[_0x87f8('0xc')](_0x87f8('0x15'),_0x3cf518);logger[_0x87f8('0xd')](_0x87f8('0x15'),_0x3cf518,JSON['stringify'](_0x23ad04));_0x3c8041(_0x23ad04);})[_0x87f8('0x14')](function(_0x2823a7){logger[_0x87f8('0x11')](_0x87f8('0x15'),_0x2823a7[_0x87f8('0x13')],_0x3cf518);_0x1a990b(_0x358bd4[_0x87f8('0x11')](0x1f4,_0x2823a7[_0x87f8('0x13')]));});});};
\ No newline at end of file
index a91bdb4..82ef6f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f25=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x6f25,0x199));var _0x56f2=function(_0x1a0568,_0x16e5bc){_0x1a0568=_0x1a0568-0x0;var _0x593d78=_0x6f25[_0x1a0568];return _0x593d78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x56f2('0x0'));var timeout=require(_0x56f2('0x1'));var express=require(_0x56f2('0x2'));var router=express[_0x56f2('0x3')]();var fs_extra=require(_0x56f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x56f2('0x5'));var config=require(_0x56f2('0x6'));var controller=require('./squareProject.controller');router[_0x56f2('0x7')]('/',auth[_0x56f2('0x8')](),controller[_0x56f2('0x9')]);router[_0x56f2('0x7')](_0x56f2('0xa'),auth[_0x56f2('0x8')](),controller[_0x56f2('0xb')]);router['post']('/',auth[_0x56f2('0x8')](),controller[_0x56f2('0xc')]);router[_0x56f2('0xd')]('/:id',auth[_0x56f2('0x8')](),controller[_0x56f2('0xe')]);router[_0x56f2('0xf')](_0x56f2('0xa'),auth[_0x56f2('0x8')](),controller[_0x56f2('0x10')]);module[_0x56f2('0x11')]=router;
\ No newline at end of file
+var _0x9853=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports'];(function(_0x3a340f,_0x18653e){var _0x14ca55=function(_0x2e2fd6){while(--_0x2e2fd6){_0x3a340f['push'](_0x3a340f['shift']());}};_0x14ca55(++_0x18653e);}(_0x9853,0x120));var _0x3985=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x9853[_0x50fda9];return _0x36b92b;};'use strict';var multer=require(_0x3985('0x0'));var util=require(_0x3985('0x1'));var path=require(_0x3985('0x2'));var timeout=require(_0x3985('0x3'));var express=require(_0x3985('0x4'));var router=express[_0x3985('0x5')]();var fs_extra=require(_0x3985('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3985('0x7'));var config=require(_0x3985('0x8'));var controller=require('./squareProject.controller');router[_0x3985('0x9')]('/',auth[_0x3985('0xa')](),controller['index']);router['get']('/:id',auth[_0x3985('0xa')](),controller[_0x3985('0xb')]);router['post']('/',auth[_0x3985('0xa')](),controller['create']);router[_0x3985('0xc')](_0x3985('0xd'),auth['isAuthenticated'](),controller[_0x3985('0xe')]);router[_0x3985('0xf')](_0x3985('0xd'),auth[_0x3985('0xa')](),controller[_0x3985('0x10')]);module[_0x3985('0x11')]=router;
\ No newline at end of file
index 819ee58..3638c76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ba7=['toString','production','utf8','DATE','exports','name','STRING','TEXT','BLOB','long','preproduction','getDataValue'];(function(_0x4e3b5e,_0x2548e6){var _0x10a8ce=function(_0x4f409c){while(--_0x4f409c){_0x4e3b5e['push'](_0x4e3b5e['shift']());}};_0x10a8ce(++_0x2548e6);}(_0x6ba7,0x94));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x76ba('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x76ba('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x76ba('0x2')]},'notes':{'type':Sequelize[_0x76ba('0x3')]},'preproduction':{'type':Sequelize[_0x76ba('0x4')](_0x76ba('0x5')),'get':function(){if(this['getDataValue'](_0x76ba('0x6'))){return this[_0x76ba('0x7')](_0x76ba('0x6'))[_0x76ba('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x76ba('0x4')](_0x76ba('0x5')),'get':function(){if(this[_0x76ba('0x7')](_0x76ba('0x9'))){return this[_0x76ba('0x7')](_0x76ba('0x9'))[_0x76ba('0x8')](_0x76ba('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x76ba('0xb')]}};
\ No newline at end of file
+var _0x5ce3=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','BLOB'];(function(_0x20802b,_0x523829){var _0x45679a=function(_0x1b1f8e){while(--_0x1b1f8e){_0x20802b['push'](_0x20802b['shift']());}};_0x45679a(++_0x523829);}(_0x5ce3,0x80));var _0x35ce=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x5ce3[_0x25701b];return _0x3a8a2c;};'use strict';var Sequelize=require(_0x35ce('0x0'));module[_0x35ce('0x1')]={'name':{'type':Sequelize[_0x35ce('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x35ce('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x35ce('0x3')](_0x35ce('0x4')),'get':function(){if(this[_0x35ce('0x5')](_0x35ce('0x6'))){return this[_0x35ce('0x5')](_0x35ce('0x6'))[_0x35ce('0x7')](_0x35ce('0x8'));}}},'production':{'type':Sequelize[_0x35ce('0x3')](_0x35ce('0x4')),'get':function(){if(this['getDataValue'](_0x35ce('0x9'))){return this['getDataValue'](_0x35ce('0x9'))[_0x35ce('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x35ce('0xa')]},'publishedAt':{'type':Sequelize[_0x35ce('0xa')]}};
\ No newline at end of file
index b4d3ac0..ebf0f45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3ed=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','UserProfileResource','destroy','publish','agi','stringify','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','SquareProject','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xc3ed,0x16f));var _0xdc3e=function(_0x6cfbf7,_0x374cbb){_0x6cfbf7=_0x6cfbf7-0x0;var _0x407dd1=_0xc3ed[_0x6cfbf7];return _0x407dd1;};'use strict';var _=require(_0xdc3e('0x0'));var Redis=require(_0xdc3e('0x1'));var qs=require(_0xdc3e('0x2'));var logger=require(_0xdc3e('0x3'))(_0xdc3e('0x4'));var config=require(_0xdc3e('0x5'));var db=require('../../mysqldb')['db'];config[_0xdc3e('0x6')]=_['defaults'](config[_0xdc3e('0x6')],{'host':_0xdc3e('0x7'),'port':0x18eb});var socket=require(_0xdc3e('0x8'))(new Redis(config[_0xdc3e('0x6')]));require(_0xdc3e('0x9'))['register'](socket);function respondWithResult(_0x232072,_0xbaa910){_0xbaa910=_0xbaa910||0xc8;return function(_0x1730ef){if(_0x1730ef){return _0x232072[_0xdc3e('0xa')](_0xbaa910)[_0xdc3e('0xb')](_0x1730ef);}};}function respondWithFilteredResult(_0x13e1a2,_0x501d19){return function(_0xf7bfb7){if(_0xf7bfb7){var _0x2d7220=typeof _0x501d19[_0xdc3e('0xc')]===_0xdc3e('0xd')&&typeof _0x501d19['limit']==='undefined';var _0x1ae507=_0xf7bfb7['count'];var _0x2ae542=_0x2d7220?0x0:_0x501d19[_0xdc3e('0xc')];var _0x41c6f5=_0x2d7220?_0xf7bfb7[_0xdc3e('0xe')]:_0x501d19[_0xdc3e('0xc')]+_0x501d19[_0xdc3e('0xf')];var _0x516e3d;if(_0x41c6f5>=_0x1ae507){_0x41c6f5=_0x1ae507;_0x516e3d=0xc8;}else{_0x516e3d=0xce;}_0x13e1a2['status'](_0x516e3d);return _0x13e1a2[_0xdc3e('0x10')](_0xdc3e('0x11'),_0x2ae542+'-'+_0x41c6f5+'/'+_0x1ae507)[_0xdc3e('0xb')](_0xf7bfb7);}return null;};}function saveUpdates(_0x430ea2){return function(_0x42d0e5){if(_0x42d0e5){return _0x42d0e5[_0xdc3e('0x12')](_0x430ea2)[_0xdc3e('0x13')](function(_0x143532){return _0x143532;});}return null;};}function removeEntity(_0x3a74b2){return function(_0x988f1){if(_0x988f1){return _0x988f1['destroy']()[_0xdc3e('0x13')](function(){var _0x3d0b14=_0x988f1[_0xdc3e('0x14')]({'plain':!![]});var _0xcd7c17='SquareProjects';return db[_0xdc3e('0x15')][_0xdc3e('0x16')]({'where':{'type':_0xcd7c17,'resourceId':_0x3d0b14['id']}})['then'](function(){return _0x988f1;});})[_0xdc3e('0x13')](function(){var _0x456518=new Redis(config[_0xdc3e('0x6')]);_0x456518[_0xdc3e('0x17')](_0xdc3e('0x18'),JSON[_0xdc3e('0x19')]({'id':_0x988f1['id'],'deleted':!![]}));})['then'](function(){_0x3a74b2['status'](0xcc)[_0xdc3e('0x1a')]();});}};}function handleEntityNotFound(_0x5f49ca){return function(_0x2424ac){if(!_0x2424ac){_0x5f49ca[_0xdc3e('0x1b')](0x194);}return _0x2424ac;};}function handleError(_0x2b5895,_0xd8402b){_0xd8402b=_0xd8402b||0x1f4;return function(_0x47e1e7){logger[_0xdc3e('0x1c')](_0x47e1e7[_0xdc3e('0x1d')]);if(_0x47e1e7['name']){delete _0x47e1e7[_0xdc3e('0x1e')];}_0x2b5895[_0xdc3e('0xa')](_0xd8402b)['send'](_0x47e1e7);};}exports[_0xdc3e('0x1f')]=function(_0x26e65f,_0x5d76cc){var _0x3ca11d={},_0x16d3b0={},_0x3c93d7={'count':0x0,'rows':[]};var _0x28e65c=_[_0xdc3e('0x20')](db['SquareProject'][_0xdc3e('0x21')],function(_0x1feefd){return{'name':_0x1feefd['fieldName'],'type':_0x1feefd[_0xdc3e('0x22')][_0xdc3e('0x23')]};});_0x16d3b0[_0xdc3e('0x24')]=_[_0xdc3e('0x20')](_0x28e65c,_0xdc3e('0x1e'));_0x16d3b0[_0xdc3e('0x25')]=_[_0xdc3e('0x26')](_0x26e65f['query']);_0x16d3b0[_0xdc3e('0x27')]=_[_0xdc3e('0x28')](_0x16d3b0[_0xdc3e('0x24')],_0x16d3b0['query']);_0x3ca11d[_0xdc3e('0x29')]=_['intersection'](_0x16d3b0[_0xdc3e('0x24')],qs[_0xdc3e('0x2a')](_0x26e65f[_0xdc3e('0x25')][_0xdc3e('0x2a')]));_0x3ca11d['attributes']=_0x3ca11d[_0xdc3e('0x29')][_0xdc3e('0x2b')]?_0x3ca11d['attributes']:_0x16d3b0[_0xdc3e('0x24')];if(!_0x26e65f[_0xdc3e('0x25')]['hasOwnProperty'](_0xdc3e('0x2c'))){_0x3ca11d[_0xdc3e('0xf')]=qs['limit'](_0x26e65f['query'][_0xdc3e('0xf')]);_0x3ca11d[_0xdc3e('0xc')]=qs['offset'](_0x26e65f[_0xdc3e('0x25')]['offset']);}_0x3ca11d['order']=qs[_0xdc3e('0x2d')](_0x26e65f['query']['sort']);_0x3ca11d[_0xdc3e('0x2e')]=qs['filters'](_['pick'](_0x26e65f[_0xdc3e('0x25')],_0x16d3b0[_0xdc3e('0x27')]),_0x28e65c);if(_0x26e65f['query'][_0xdc3e('0x2f')]){_0x3ca11d[_0xdc3e('0x2e')]=_[_0xdc3e('0x30')](_0x3ca11d[_0xdc3e('0x2e')],{'$or':_[_0xdc3e('0x20')](_0x28e65c,function(_0x5090da){if(_0x5090da['type']!==_0xdc3e('0x31')){var _0x50595a={};_0x50595a[_0x5090da['name']]={'$like':'%'+_0x26e65f[_0xdc3e('0x25')]['filter']+'%'};return _0x50595a;}})});}_0x3ca11d=_['merge']({},_0x3ca11d,_0x26e65f[_0xdc3e('0x32')]);var _0x3ceed9={'where':_0x3ca11d[_0xdc3e('0x2e')]};return db[_0xdc3e('0x33')][_0xdc3e('0xe')](_0x3ceed9)[_0xdc3e('0x13')](function(_0xa44134){_0x3c93d7[_0xdc3e('0xe')]=_0xa44134;if(_0x26e65f[_0xdc3e('0x25')][_0xdc3e('0x34')]){_0x3ca11d['include']=[{'all':!![]}];}return db['SquareProject'][_0xdc3e('0x35')](_0x3ca11d);})[_0xdc3e('0x13')](function(_0x2b735f){_0x3c93d7[_0xdc3e('0x36')]=_0x2b735f;return _0x3c93d7;})['then'](respondWithFilteredResult(_0x5d76cc,_0x3ca11d))[_0xdc3e('0x37')](handleError(_0x5d76cc,null));};exports[_0xdc3e('0x38')]=function(_0x153e85,_0x1f5b06){var _0x506766={'raw':![],'where':{'id':_0x153e85[_0xdc3e('0x39')]['id']}},_0x3704d6={};_0x3704d6[_0xdc3e('0x24')]=_['keys'](db['SquareProject']['rawAttributes']);_0x3704d6[_0xdc3e('0x25')]=_[_0xdc3e('0x26')](_0x153e85[_0xdc3e('0x25')]);_0x3704d6[_0xdc3e('0x27')]=_[_0xdc3e('0x28')](_0x3704d6[_0xdc3e('0x24')],_0x3704d6[_0xdc3e('0x25')]);_0x506766['attributes']=_[_0xdc3e('0x28')](_0x3704d6[_0xdc3e('0x24')],qs[_0xdc3e('0x2a')](_0x153e85['query'][_0xdc3e('0x2a')]));_0x506766[_0xdc3e('0x29')]=_0x506766[_0xdc3e('0x29')]['length']?_0x506766[_0xdc3e('0x29')]:_0x3704d6[_0xdc3e('0x24')];if(_0x153e85['query'][_0xdc3e('0x34')]){_0x506766[_0xdc3e('0x3a')]=[{'all':!![]}];}_0x506766=_[_0xdc3e('0x30')]({},_0x506766,_0x153e85[_0xdc3e('0x32')]);return db[_0xdc3e('0x33')][_0xdc3e('0x3b')](_0x506766)[_0xdc3e('0x13')](handleEntityNotFound(_0x1f5b06,null))[_0xdc3e('0x13')](respondWithResult(_0x1f5b06,null))['catch'](handleError(_0x1f5b06,null));};exports[_0xdc3e('0x3c')]=function(_0x2ca5c6,_0x208dfa){return db['SquareProject'][_0xdc3e('0x3c')](_0x2ca5c6['body'],{})[_0xdc3e('0x13')](function(_0x25bbdb){var _0x5eb0a6=_0x2ca5c6[_0xdc3e('0x3d')]['get']({'plain':!![]});if(!_0x5eb0a6)throw new Error(_0xdc3e('0x3e'));if(_0x5eb0a6[_0xdc3e('0x3f')]===_0xdc3e('0x3d')){var _0x486389=_0x25bbdb[_0xdc3e('0x14')]({'plain':!![]});var _0x50eb0e=_0xdc3e('0x40');return db[_0xdc3e('0x41')][_0xdc3e('0x3b')]({'where':{'name':_0x50eb0e,'userProfileId':_0x5eb0a6[_0xdc3e('0x42')]},'raw':!![]})[_0xdc3e('0x13')](function(_0x3421d2){if(_0x3421d2&&_0x3421d2[_0xdc3e('0x43')]===0x0){return db[_0xdc3e('0x15')][_0xdc3e('0x3c')]({'name':_0x486389['name'],'resourceId':_0x486389['id'],'type':_0x3421d2[_0xdc3e('0x1e')],'sectionId':_0x3421d2['id']},{})['then'](function(){return _0x25bbdb;});}else{return _0x25bbdb;}})[_0xdc3e('0x37')](function(_0x66eba7){logger['error'](_0xdc3e('0x44'),_0x66eba7);throw _0x66eba7;});}return _0x25bbdb;})[_0xdc3e('0x13')](respondWithResult(_0x208dfa,0xc9))['catch'](handleError(_0x208dfa,null));};exports[_0xdc3e('0x12')]=function(_0x2877af,_0x2e9493){if(_0x2877af[_0xdc3e('0x45')]['id']){delete _0x2877af[_0xdc3e('0x45')]['id'];}return db[_0xdc3e('0x33')][_0xdc3e('0x3b')]({'where':{'id':_0x2877af[_0xdc3e('0x39')]['id']}})[_0xdc3e('0x13')](handleEntityNotFound(_0x2e9493,null))[_0xdc3e('0x13')](saveUpdates(_0x2877af[_0xdc3e('0x45')],null))[_0xdc3e('0x13')](function(_0x40c1e7){if(!_0x40c1e7)return;var _0x48c5ce=_0x40c1e7[_0xdc3e('0x14')]({'plain':!![]});return _0x48c5ce;})[_0xdc3e('0x13')](function(_0x2d79b6){var _0xc70991=new Redis(config['redis']);_0xc70991['publish'](_0xdc3e('0x18'),JSON['stringify'](_[_0xdc3e('0x46')](_0x2d79b6,['id',_0xdc3e('0x1e'),_0xdc3e('0x47')])));return _0x2d79b6;})['then'](respondWithResult(_0x2e9493,null))[_0xdc3e('0x37')](handleError(_0x2e9493,null));};exports['destroy']=function(_0x595767,_0x4eb461){return db[_0xdc3e('0x33')][_0xdc3e('0x3b')]({'where':{'id':_0x595767[_0xdc3e('0x39')]['id']}})['then'](handleEntityNotFound(_0x4eb461,null))['then'](removeEntity(_0x4eb461,null))[_0xdc3e('0x37')](handleError(_0x4eb461,null));};
\ No newline at end of file
+var _0x3072=['where','pick','filters','filter','VIRTUAL','merge','SquareProject','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','agi','stringify','end','error','stack','name','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x3072,0x9f));var _0x2307=function(_0x41bb9e,_0x360d92){_0x41bb9e=_0x41bb9e-0x0;var _0x4840a2=_0x3072[_0x41bb9e];return _0x4840a2;};'use strict';var _=require('lodash');var Redis=require(_0x2307('0x0'));var qs=require(_0x2307('0x1'));var logger=require('../../config/logger')('api');var config=require(_0x2307('0x2'));var db=require(_0x2307('0x3'))['db'];config[_0x2307('0x4')]=_['defaults'](config[_0x2307('0x4')],{'host':_0x2307('0x5'),'port':0x18eb});var socket=require(_0x2307('0x6'))(new Redis(config['redis']));require(_0x2307('0x7'))[_0x2307('0x8')](socket);function respondWithResult(_0x50488d,_0x1ae9c8){_0x1ae9c8=_0x1ae9c8||0xc8;return function(_0x3213d7){if(_0x3213d7){return _0x50488d[_0x2307('0x9')](_0x1ae9c8)[_0x2307('0xa')](_0x3213d7);}};}function respondWithFilteredResult(_0x2a7c39,_0xa2aaee){return function(_0x454d20){if(_0x454d20){var _0x39585d=typeof _0xa2aaee[_0x2307('0xb')]===_0x2307('0xc')&&typeof _0xa2aaee[_0x2307('0xd')]==='undefined';var _0x115ee1=_0x454d20[_0x2307('0xe')];var _0x31c97f=_0x39585d?0x0:_0xa2aaee[_0x2307('0xb')];var _0x29f0da=_0x39585d?_0x454d20['count']:_0xa2aaee[_0x2307('0xb')]+_0xa2aaee['limit'];var _0xd39138;if(_0x29f0da>=_0x115ee1){_0x29f0da=_0x115ee1;_0xd39138=0xc8;}else{_0xd39138=0xce;}_0x2a7c39[_0x2307('0x9')](_0xd39138);return _0x2a7c39[_0x2307('0xf')](_0x2307('0x10'),_0x31c97f+'-'+_0x29f0da+'/'+_0x115ee1)['json'](_0x454d20);}return null;};}function saveUpdates(_0x864fab){return function(_0x3244e5){if(_0x3244e5){return _0x3244e5[_0x2307('0x11')](_0x864fab)['then'](function(_0x1c98ca){return _0x1c98ca;});}return null;};}function removeEntity(_0x449705){return function(_0x3dcca0){if(_0x3dcca0){return _0x3dcca0[_0x2307('0x12')]()[_0x2307('0x13')](function(){var _0x3c0cdd=_0x3dcca0[_0x2307('0x14')]({'plain':!![]});var _0x3709c9=_0x2307('0x15');return db[_0x2307('0x16')][_0x2307('0x12')]({'where':{'type':_0x3709c9,'resourceId':_0x3c0cdd['id']}})[_0x2307('0x13')](function(){return _0x3dcca0;});})[_0x2307('0x13')](function(){var _0x20863c=new Redis(config[_0x2307('0x4')]);_0x20863c['publish'](_0x2307('0x17'),JSON[_0x2307('0x18')]({'id':_0x3dcca0['id'],'deleted':!![]}));})[_0x2307('0x13')](function(){_0x449705['status'](0xcc)[_0x2307('0x19')]();});}};}function handleEntityNotFound(_0x399b75){return function(_0x364d3b){if(!_0x364d3b){_0x399b75['sendStatus'](0x194);}return _0x364d3b;};}function handleError(_0x39fc19,_0xbe64c2){_0xbe64c2=_0xbe64c2||0x1f4;return function(_0x39343c){logger[_0x2307('0x1a')](_0x39343c[_0x2307('0x1b')]);if(_0x39343c[_0x2307('0x1c')]){delete _0x39343c[_0x2307('0x1c')];}_0x39fc19[_0x2307('0x9')](_0xbe64c2)['send'](_0x39343c);};}exports[_0x2307('0x1d')]=function(_0x3fcaa2,_0x541208){var _0x21ce7a={},_0xe1f3a5={},_0x41baad={'count':0x0,'rows':[]};var _0x19b8b5=_['map'](db['SquareProject']['rawAttributes'],function(_0x218644){return{'name':_0x218644[_0x2307('0x1e')],'type':_0x218644[_0x2307('0x1f')][_0x2307('0x20')]};});_0xe1f3a5[_0x2307('0x21')]=_[_0x2307('0x22')](_0x19b8b5,_0x2307('0x1c'));_0xe1f3a5[_0x2307('0x23')]=_[_0x2307('0x24')](_0x3fcaa2[_0x2307('0x23')]);_0xe1f3a5['filters']=_[_0x2307('0x25')](_0xe1f3a5[_0x2307('0x21')],_0xe1f3a5[_0x2307('0x23')]);_0x21ce7a[_0x2307('0x26')]=_[_0x2307('0x25')](_0xe1f3a5['model'],qs[_0x2307('0x27')](_0x3fcaa2[_0x2307('0x23')][_0x2307('0x27')]));_0x21ce7a[_0x2307('0x26')]=_0x21ce7a[_0x2307('0x26')][_0x2307('0x28')]?_0x21ce7a[_0x2307('0x26')]:_0xe1f3a5[_0x2307('0x21')];if(!_0x3fcaa2[_0x2307('0x23')][_0x2307('0x29')](_0x2307('0x2a'))){_0x21ce7a[_0x2307('0xd')]=qs['limit'](_0x3fcaa2[_0x2307('0x23')]['limit']);_0x21ce7a[_0x2307('0xb')]=qs['offset'](_0x3fcaa2[_0x2307('0x23')][_0x2307('0xb')]);}_0x21ce7a[_0x2307('0x2b')]=qs[_0x2307('0x2c')](_0x3fcaa2[_0x2307('0x23')]['sort']);_0x21ce7a[_0x2307('0x2d')]=qs['filters'](_[_0x2307('0x2e')](_0x3fcaa2[_0x2307('0x23')],_0xe1f3a5[_0x2307('0x2f')]),_0x19b8b5);if(_0x3fcaa2['query'][_0x2307('0x30')]){_0x21ce7a[_0x2307('0x2d')]=_['merge'](_0x21ce7a[_0x2307('0x2d')],{'$or':_[_0x2307('0x22')](_0x19b8b5,function(_0xccc3fc){if(_0xccc3fc['type']!==_0x2307('0x31')){var _0x11fc83={};_0x11fc83[_0xccc3fc[_0x2307('0x1c')]]={'$like':'%'+_0x3fcaa2[_0x2307('0x23')]['filter']+'%'};return _0x11fc83;}})});}_0x21ce7a=_[_0x2307('0x32')]({},_0x21ce7a,_0x3fcaa2['options']);var _0x10819f={'where':_0x21ce7a[_0x2307('0x2d')]};return db[_0x2307('0x33')][_0x2307('0xe')](_0x10819f)['then'](function(_0x4fb60a){_0x41baad[_0x2307('0xe')]=_0x4fb60a;if(_0x3fcaa2[_0x2307('0x23')][_0x2307('0x34')]){_0x21ce7a[_0x2307('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0x2307('0x36')](_0x21ce7a);})[_0x2307('0x13')](function(_0x445dcf){_0x41baad['rows']=_0x445dcf;return _0x41baad;})['then'](respondWithFilteredResult(_0x541208,_0x21ce7a))[_0x2307('0x37')](handleError(_0x541208,null));};exports[_0x2307('0x38')]=function(_0x23cb26,_0x1d7fc6){var _0x134f34={'raw':![],'where':{'id':_0x23cb26[_0x2307('0x39')]['id']}},_0x3f00bb={};_0x3f00bb['model']=_[_0x2307('0x24')](db[_0x2307('0x33')][_0x2307('0x3a')]);_0x3f00bb[_0x2307('0x23')]=_[_0x2307('0x24')](_0x23cb26['query']);_0x3f00bb[_0x2307('0x2f')]=_[_0x2307('0x25')](_0x3f00bb[_0x2307('0x21')],_0x3f00bb[_0x2307('0x23')]);_0x134f34[_0x2307('0x26')]=_[_0x2307('0x25')](_0x3f00bb[_0x2307('0x21')],qs[_0x2307('0x27')](_0x23cb26[_0x2307('0x23')][_0x2307('0x27')]));_0x134f34[_0x2307('0x26')]=_0x134f34[_0x2307('0x26')][_0x2307('0x28')]?_0x134f34[_0x2307('0x26')]:_0x3f00bb['model'];if(_0x23cb26[_0x2307('0x23')][_0x2307('0x34')]){_0x134f34['include']=[{'all':!![]}];}_0x134f34=_[_0x2307('0x32')]({},_0x134f34,_0x23cb26['options']);return db[_0x2307('0x33')][_0x2307('0x3b')](_0x134f34)[_0x2307('0x13')](handleEntityNotFound(_0x1d7fc6,null))[_0x2307('0x13')](respondWithResult(_0x1d7fc6,null))['catch'](handleError(_0x1d7fc6,null));};exports['create']=function(_0x4215f2,_0x1c6dd7){return db['SquareProject']['create'](_0x4215f2[_0x2307('0x3c')],{})['then'](function(_0x2b5c03){var _0x2222a9=_0x4215f2[_0x2307('0x3d')][_0x2307('0x14')]({'plain':!![]});if(!_0x2222a9)throw new Error(_0x2307('0x3e'));if(_0x2222a9[_0x2307('0x3f')]===_0x2307('0x3d')){var _0x290f1f=_0x2b5c03['get']({'plain':!![]});var _0x15804f=_0x2307('0x15');return db[_0x2307('0x40')]['find']({'where':{'name':_0x15804f,'userProfileId':_0x2222a9['userProfileId']},'raw':!![]})['then'](function(_0x5544b4){if(_0x5544b4&&_0x5544b4['autoAssociation']===0x0){return db['UserProfileResource'][_0x2307('0x41')]({'name':_0x290f1f['name'],'resourceId':_0x290f1f['id'],'type':_0x5544b4[_0x2307('0x1c')],'sectionId':_0x5544b4['id']},{})[_0x2307('0x13')](function(){return _0x2b5c03;});}else{return _0x2b5c03;}})[_0x2307('0x37')](function(_0x5d2202){logger[_0x2307('0x1a')](_0x2307('0x42'),_0x5d2202);throw _0x5d2202;});}return _0x2b5c03;})[_0x2307('0x13')](respondWithResult(_0x1c6dd7,0xc9))['catch'](handleError(_0x1c6dd7,null));};exports[_0x2307('0x11')]=function(_0x6691c6,_0x4bf820){if(_0x6691c6[_0x2307('0x3c')]['id']){delete _0x6691c6[_0x2307('0x3c')]['id'];}return db['SquareProject'][_0x2307('0x3b')]({'where':{'id':_0x6691c6[_0x2307('0x39')]['id']}})['then'](handleEntityNotFound(_0x4bf820,null))[_0x2307('0x13')](saveUpdates(_0x6691c6[_0x2307('0x3c')],null))[_0x2307('0x13')](function(_0x34a9f3){if(!_0x34a9f3)return;var _0x45ee19=_0x34a9f3[_0x2307('0x14')]({'plain':!![]});return _0x45ee19;})[_0x2307('0x13')](function(_0x37b182){var _0xc69f0e=new Redis(config['redis']);_0xc69f0e[_0x2307('0x43')](_0x2307('0x17'),JSON[_0x2307('0x18')](_[_0x2307('0x2e')](_0x37b182,['id',_0x2307('0x1c'),'production'])));return _0x37b182;})[_0x2307('0x13')](respondWithResult(_0x4bf820,null))['catch'](handleError(_0x4bf820,null));};exports['destroy']=function(_0x45108f,_0x5a04d3){return db['SquareProject'][_0x2307('0x3b')]({'where':{'id':_0x45108f[_0x2307('0x39')]['id']}})[_0x2307('0x13')](handleEntityNotFound(_0x5a04d3,null))['then'](removeEntity(_0x5a04d3,null))[_0x2307('0x37')](handleError(_0x5a04d3,null));};
\ No newline at end of file
index a3a348d..f511dc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a76=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject'];(function(_0x3f5e6e,_0x274084){var _0x30fdfb=function(_0x1c745b){while(--_0x1c745b){_0x3f5e6e['push'](_0x3f5e6e['shift']());}};_0x30fdfb(++_0x274084);}(_0x9a76,0x180));var _0x69a7=function(_0x437fcb,_0x584ef0){_0x437fcb=_0x437fcb-0x0;var _0x10e0b1=_0x9a76[_0x437fcb];return _0x10e0b1;};'use strict';var EventEmitter=require(_0x69a7('0x0'));var SquareProject=require(_0x69a7('0x1'))['db'][_0x69a7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x69a7('0x3')](0x0);var events={'afterCreate':_0x69a7('0x4'),'afterUpdate':_0x69a7('0x5'),'afterDestroy':_0x69a7('0x6')};function emitEvent(_0x34f7c9){return function(_0x4a6fc3,_0x5ef4f8,_0x49e17e){SquareProjectEvents[_0x69a7('0x7')](_0x34f7c9+':'+_0x4a6fc3['id'],_0x4a6fc3);SquareProjectEvents[_0x69a7('0x7')](_0x34f7c9,_0x4a6fc3);_0x49e17e(null);};}for(var e in events){if(events[_0x69a7('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents;
\ No newline at end of file
+var _0x9f00=['remove','hasOwnProperty','exports','SquareProject','setMaxListeners','save','update'];(function(_0x258d86,_0x2ac3f3){var _0x46ff28=function(_0x3ce486){while(--_0x3ce486){_0x258d86['push'](_0x258d86['shift']());}};_0x46ff28(++_0x2ac3f3);}(_0x9f00,0x1d1));var _0x09f0=function(_0x470252,_0x457603){_0x470252=_0x470252-0x0;var _0xeec8b4=_0x9f00[_0x470252];return _0xeec8b4;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x09f0('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x09f0('0x1')](0x0);var events={'afterCreate':_0x09f0('0x2'),'afterUpdate':_0x09f0('0x3'),'afterDestroy':_0x09f0('0x4')};function emitEvent(_0x445fcc){return function(_0x580dd1,_0x4549db,_0x1ea6b5){SquareProjectEvents['emit'](_0x445fcc+':'+_0x580dd1['id'],_0x580dd1);SquareProjectEvents['emit'](_0x445fcc,_0x580dd1);_0x1ea6b5(null);};}for(var e in events){if(events[_0x09f0('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x09f0('0x6')]=SquareProjectEvents;
\ No newline at end of file
index b596228..81a3f1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe062=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','savedAt','changed','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x17742b,_0x353a22){var _0x42e121=function(_0x3bcd16){while(--_0x3bcd16){_0x17742b['push'](_0x17742b['shift']());}};_0x42e121(++_0x353a22);}(_0xe062,0x17b));var _0x2e06=function(_0x7c232,_0x2f8405){_0x7c232=_0x7c232-0x0;var _0x169bd2=_0xe062[_0x7c232];return _0x169bd2;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var logger=require(_0x2e06('0x2'))('api');var moment=require(_0x2e06('0x3'));var BPromise=require(_0x2e06('0x4'));var rp=require(_0x2e06('0x5'));var fs=require('fs');var path=require(_0x2e06('0x6'));var rimraf=require(_0x2e06('0x7'));var config=require(_0x2e06('0x8'));var attributes=require(_0x2e06('0x9'));module[_0x2e06('0xa')]=function(_0x22f776,_0x292fe9){return _0x22f776['define'](_0x2e06('0xb'),attributes,{'tableName':_0x2e06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf46a9e,_0xd68e3b,_0x48c25b){if(_0xf46a9e['changed']('preproduction')){_0xf46a9e[_0x2e06('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xf46a9e[_0x2e06('0xe')](_0x2e06('0xf'))){_0xf46a9e[_0x2e06('0x10')]=moment()[_0x2e06('0x11')](_0x2e06('0x12'));}_0x48c25b(null,_0xf46a9e);}}});};
\ No newline at end of file
+var _0x03b9=['changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x03b9,0xd1));var _0x903b=function(_0x20218c,_0x2adb72){_0x20218c=_0x20218c-0x0;var _0xdfb388=_0x03b9[_0x20218c];return _0xdfb388;};'use strict';var _=require('lodash');var util=require(_0x903b('0x0'));var logger=require(_0x903b('0x1'))(_0x903b('0x2'));var moment=require(_0x903b('0x3'));var BPromise=require(_0x903b('0x4'));var rp=require(_0x903b('0x5'));var fs=require('fs');var path=require(_0x903b('0x6'));var rimraf=require('rimraf');var config=require(_0x903b('0x7'));var attributes=require(_0x903b('0x8'));module['exports']=function(_0x15db40,_0x1d425a){return _0x15db40[_0x903b('0x9')](_0x903b('0xa'),attributes,{'tableName':_0x903b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d10c9,_0x588eed,_0xf02239){if(_0x3d10c9[_0x903b('0xc')](_0x903b('0xd'))){_0x3d10c9[_0x903b('0xe')]=moment()['format'](_0x903b('0xf'));}if(_0x3d10c9[_0x903b('0xc')]('production')){_0x3d10c9[_0x903b('0x10')]=moment()['format'](_0x903b('0xf'));}_0xf02239(null,_0x3d10c9);}}});};
\ No newline at end of file
index d0da10f..e5581f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfd4=['include','map','model','then','info','error','message','ShowSquareProject','SquareProject','find','raw','debug','stringify','catch','../../mysqldb','redis','./squareProject.socket','GetSquareProjects','findAll','options','where','attributes'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xbfd4,0x116));var _0x4bfd=function(_0x165b11,_0x13a822){_0x165b11=_0x165b11-0x0;var _0x2f71ec=_0xbfd4[_0x165b11];return _0x2f71ec;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x4bfd('0x0'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x4bfd('0x1')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4bfd('0x1')]));require(_0x4bfd('0x2'))['register'](socket);exports[_0x4bfd('0x3')]=function(_0x2b40e3){var _0x2289d7=this;return new Promise(function(_0x33dfcd,_0xa974cd){return db['SquareProject'][_0x4bfd('0x4')]({'raw':_0x2b40e3['options']?_0x2b40e3[_0x4bfd('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x2b40e3['options']?_0x2b40e3[_0x4bfd('0x5')][_0x4bfd('0x6')]||null:null,'attributes':_0x2b40e3[_0x4bfd('0x5')]?_0x2b40e3[_0x4bfd('0x5')][_0x4bfd('0x7')]||null:null,'limit':_0x2b40e3[_0x4bfd('0x5')]?_0x2b40e3[_0x4bfd('0x5')]['limit']||null:null,'include':_0x2b40e3['options']?_0x2b40e3['options'][_0x4bfd('0x8')]?_[_0x4bfd('0x9')](_0x2b40e3[_0x4bfd('0x5')][_0x4bfd('0x8')],function(_0x4ba3fe){return{'model':db[_0x4ba3fe[_0x4bfd('0xa')]],'as':_0x4ba3fe['as'],'attributes':_0x4ba3fe[_0x4bfd('0x7')],'include':_0x4ba3fe[_0x4bfd('0x8')]?_[_0x4bfd('0x9')](_0x4ba3fe['include'],function(_0x200d02){return{'model':db[_0x200d02[_0x4bfd('0xa')]],'as':_0x200d02['as'],'attributes':_0x200d02[_0x4bfd('0x7')],'include':_0x200d02[_0x4bfd('0x8')]?_[_0x4bfd('0x9')](_0x200d02[_0x4bfd('0x8')],function(_0xabbb06){return{'model':db[_0xabbb06['model']],'as':_0xabbb06['as'],'attributes':_0xabbb06[_0x4bfd('0x7')]};}):[]};}):[]};}):[]:[]})[_0x4bfd('0xb')](function(_0x14e164){logger[_0x4bfd('0xc')](_0x4bfd('0x3'),_0x2b40e3);logger['debug'](_0x4bfd('0x3'),_0x2b40e3,JSON['stringify'](_0x14e164));_0x33dfcd(_0x14e164);})['catch'](function(_0x1fe9c2){logger[_0x4bfd('0xd')](_0x4bfd('0x3'),_0x1fe9c2['message'],_0x2b40e3);_0xa974cd(_0x2289d7[_0x4bfd('0xd')](0x1f4,_0x1fe9c2[_0x4bfd('0xe')]));});});};exports[_0x4bfd('0xf')]=function(_0x226dca){var _0x8d16b6=this;return new Promise(function(_0x3a7c3b,_0x113f56){return db[_0x4bfd('0x10')][_0x4bfd('0x11')]({'raw':_0x226dca[_0x4bfd('0x5')]?_0x226dca[_0x4bfd('0x5')][_0x4bfd('0x12')]===undefined?!![]:![]:!![],'where':_0x226dca[_0x4bfd('0x5')]?_0x226dca[_0x4bfd('0x5')][_0x4bfd('0x6')]||null:null,'attributes':_0x226dca[_0x4bfd('0x5')]?_0x226dca[_0x4bfd('0x5')][_0x4bfd('0x7')]||null:null,'include':_0x226dca[_0x4bfd('0x5')]?_0x226dca['options']['include']?_[_0x4bfd('0x9')](_0x226dca[_0x4bfd('0x5')]['include'],function(_0x3120e5){return{'model':db[_0x3120e5[_0x4bfd('0xa')]],'as':_0x3120e5['as'],'attributes':_0x3120e5['attributes'],'include':_0x3120e5[_0x4bfd('0x8')]?_['map'](_0x3120e5[_0x4bfd('0x8')],function(_0x1f3da8){return{'model':db[_0x1f3da8[_0x4bfd('0xa')]],'as':_0x1f3da8['as'],'attributes':_0x1f3da8['attributes'],'include':_0x1f3da8[_0x4bfd('0x8')]?_[_0x4bfd('0x9')](_0x1f3da8['include'],function(_0x36cf64){return{'model':db[_0x36cf64[_0x4bfd('0xa')]],'as':_0x36cf64['as'],'attributes':_0x36cf64[_0x4bfd('0x7')]};}):[]};}):[]};}):[]:[]})[_0x4bfd('0xb')](function(_0xe3fda3){logger['info'](_0x4bfd('0xf'),_0x226dca);logger[_0x4bfd('0x13')]('ShowSquareProject',_0x226dca,JSON[_0x4bfd('0x14')](_0xe3fda3));_0x3a7c3b(_0xe3fda3);})[_0x4bfd('0x15')](function(_0x5be19a){logger[_0x4bfd('0xd')](_0x4bfd('0xf'),_0x5be19a['message'],_0x226dca);_0x113f56(_0x8d16b6[_0x4bfd('0xd')](0x1f4,_0x5be19a['message']));});});};
\ No newline at end of file
+var _0x7305=['register','findAll','options','where','attributes','limit','include','map','model','then','info','debug','GetSquareProjects','stringify','catch','error','message','ShowSquareProject','SquareProject','find','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7305,0xd8));var _0x5730=function(_0x231b93,_0x5cd93f){_0x231b93=_0x231b93-0x0;var _0x34c6b7=_0x7305[_0x231b93];return _0x34c6b7;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x5730('0x0'))['db'];var logger=require(_0x5730('0x1'))(_0x5730('0x2'));var config=require('../../config/environment');config[_0x5730('0x3')]=_[_0x5730('0x4')](config['redis'],{'host':_0x5730('0x5'),'port':0x18eb});var socket=require(_0x5730('0x6'))(new Redis(config[_0x5730('0x3')]));require(_0x5730('0x7'))[_0x5730('0x8')](socket);exports['GetSquareProjects']=function(_0x1be59b){var _0x49ea99=this;return new Promise(function(_0x566396,_0x287ed8){return db['SquareProject'][_0x5730('0x9')]({'raw':_0x1be59b[_0x5730('0xa')]?_0x1be59b[_0x5730('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x1be59b[_0x5730('0xa')]?_0x1be59b['options'][_0x5730('0xb')]||null:null,'attributes':_0x1be59b[_0x5730('0xa')]?_0x1be59b[_0x5730('0xa')][_0x5730('0xc')]||null:null,'limit':_0x1be59b['options']?_0x1be59b['options'][_0x5730('0xd')]||null:null,'include':_0x1be59b[_0x5730('0xa')]?_0x1be59b[_0x5730('0xa')][_0x5730('0xe')]?_[_0x5730('0xf')](_0x1be59b[_0x5730('0xa')]['include'],function(_0xacc91b){return{'model':db[_0xacc91b[_0x5730('0x10')]],'as':_0xacc91b['as'],'attributes':_0xacc91b[_0x5730('0xc')],'include':_0xacc91b[_0x5730('0xe')]?_[_0x5730('0xf')](_0xacc91b[_0x5730('0xe')],function(_0x183a9b){return{'model':db[_0x183a9b['model']],'as':_0x183a9b['as'],'attributes':_0x183a9b['attributes'],'include':_0x183a9b[_0x5730('0xe')]?_[_0x5730('0xf')](_0x183a9b[_0x5730('0xe')],function(_0x234ff8){return{'model':db[_0x234ff8['model']],'as':_0x234ff8['as'],'attributes':_0x234ff8[_0x5730('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5730('0x11')](function(_0x255356){logger[_0x5730('0x12')]('GetSquareProjects',_0x1be59b);logger[_0x5730('0x13')](_0x5730('0x14'),_0x1be59b,JSON[_0x5730('0x15')](_0x255356));_0x566396(_0x255356);})[_0x5730('0x16')](function(_0x4adf1f){logger[_0x5730('0x17')](_0x5730('0x14'),_0x4adf1f['message'],_0x1be59b);_0x287ed8(_0x49ea99[_0x5730('0x17')](0x1f4,_0x4adf1f[_0x5730('0x18')]));});});};exports[_0x5730('0x19')]=function(_0x5f97ec){var _0x109299=this;return new Promise(function(_0xf46b10,_0x37f500){return db[_0x5730('0x1a')][_0x5730('0x1b')]({'raw':_0x5f97ec[_0x5730('0xa')]?_0x5f97ec[_0x5730('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x5f97ec[_0x5730('0xa')]?_0x5f97ec[_0x5730('0xa')][_0x5730('0xb')]||null:null,'attributes':_0x5f97ec[_0x5730('0xa')]?_0x5f97ec[_0x5730('0xa')][_0x5730('0xc')]||null:null,'include':_0x5f97ec[_0x5730('0xa')]?_0x5f97ec['options'][_0x5730('0xe')]?_['map'](_0x5f97ec[_0x5730('0xa')][_0x5730('0xe')],function(_0x3f0d71){return{'model':db[_0x3f0d71[_0x5730('0x10')]],'as':_0x3f0d71['as'],'attributes':_0x3f0d71[_0x5730('0xc')],'include':_0x3f0d71[_0x5730('0xe')]?_[_0x5730('0xf')](_0x3f0d71[_0x5730('0xe')],function(_0x228840){return{'model':db[_0x228840['model']],'as':_0x228840['as'],'attributes':_0x228840[_0x5730('0xc')],'include':_0x228840['include']?_['map'](_0x228840['include'],function(_0x26b27e){return{'model':db[_0x26b27e['model']],'as':_0x26b27e['as'],'attributes':_0x26b27e[_0x5730('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5730('0x11')](function(_0x1c8bc1){logger[_0x5730('0x12')](_0x5730('0x19'),_0x5f97ec);logger[_0x5730('0x13')](_0x5730('0x19'),_0x5f97ec,JSON[_0x5730('0x15')](_0x1c8bc1));_0xf46b10(_0x1c8bc1);})[_0x5730('0x16')](function(_0x21d1a0){logger[_0x5730('0x17')](_0x5730('0x19'),_0x21d1a0[_0x5730('0x18')],_0x5f97ec);_0x37f500(_0x109299[_0x5730('0x17')](0x1f4,_0x21d1a0[_0x5730('0x18')]));});});};
\ No newline at end of file
index 0f2c533..5099927 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5795=['./squareProject.events','removeListener','length','squareProject:'];(function(_0x3e8d09,_0x5c8cd1){var _0x413bbc=function(_0x2c9f73){while(--_0x2c9f73){_0x3e8d09['push'](_0x3e8d09['shift']());}};_0x413bbc(++_0x5c8cd1);}(_0x5795,0xc4));var _0x5579=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x5795[_0x23e7c1];return _0x1add43;};'use strict';var SquareProjectEvents=require(_0x5579('0x0'));var events=['save','remove','update'];function createListener(_0x46d3eb,_0x1a4a18){return function(_0x4c3bdf){_0x1a4a18['emit'](_0x46d3eb,_0x4c3bdf);};}function removeListener(_0x8a1fad,_0x21fdc0){return function(){SquareProjectEvents[_0x5579('0x1')](_0x8a1fad,_0x21fdc0);};}exports['register']=function(_0x40b23d){for(var _0x2db7c6=0x0,_0xb3a056=events[_0x5579('0x2')];_0x2db7c6<_0xb3a056;_0x2db7c6++){var _0x21490c=events[_0x2db7c6];var _0x3e2780=createListener(_0x5579('0x3')+_0x21490c,_0x40b23d);SquareProjectEvents['on'](_0x21490c,_0x3e2780);}};
\ No newline at end of file
+var _0x5822=['squareProject:','save','remove','emit','register'];(function(_0x58c7b0,_0x4cb178){var _0x22a17d=function(_0xdb4bc){while(--_0xdb4bc){_0x58c7b0['push'](_0x58c7b0['shift']());}};_0x22a17d(++_0x4cb178);}(_0x5822,0x173));var _0x2582=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x5822[_0xb833b1];return _0x1ab87a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x2582('0x0'),_0x2582('0x1'),'update'];function createListener(_0x51be31,_0x35e00d){return function(_0xc42bba){_0x35e00d[_0x2582('0x2')](_0x51be31,_0xc42bba);};}function removeListener(_0x3f6674,_0xd7f9df){return function(){SquareProjectEvents['removeListener'](_0x3f6674,_0xd7f9df);};}exports[_0x2582('0x3')]=function(_0x3734df){for(var _0x432a80=0x0,_0x3b5671=events['length'];_0x432a80<_0x3b5671;_0x432a80++){var _0x4c19f1=events[_0x432a80];var _0x32e837=createListener(_0x2582('0x4')+_0x4c19f1,_0x3734df);SquareProjectEvents['on'](_0x4c19f1,_0x32e837);}};
\ No newline at end of file
index c04622b..f9a7946 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x25d273,_0x573026){var _0x222c5a=function(_0x5606f8){while(--_0x5606f8){_0x25d273['push'](_0x25d273['shift']());}};_0x222c5a(++_0x573026);}(_0x814b,0x1a2));var _0xb814=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x814b[_0x34d346];return _0x122d76;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router;
\ No newline at end of file
+var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x0295,0x1f0));var _0x5029=function(_0x188832,_0x49101d){_0x188832=_0x188832-0x0;var _0x2b990f=_0x0295[_0x188832];return _0x2b990f;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router;
\ No newline at end of file
index 44f736f..c287cd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabce=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xabce,0x103));var _0xeabc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xabce[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'callerid':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'dnid':{'type':Sequelize[_0xeabc('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xeabc('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xeabc('0x3')],'get':function(){var _0x52ede8='';var _0x3bdc29=this[_0xeabc('0x4')](_0xeabc('0x5'));if(_0x3bdc29){_0x52ede8=_0x3bdc29['substring'](_0x3bdc29[_0xeabc('0x6')]('.'));}return _0x52ede8;}}};
\ No newline at end of file
+var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x701320,_0x1c07ae){var _0x53e92d=function(_0x2205b6){while(--_0x2205b6){_0x701320['push'](_0x701320['shift']());}};_0x53e92d(++_0x1c07ae);}(_0x7c09,0x102));var _0x97c0=function(_0x807410,_0x23ffc9){_0x807410=_0x807410-0x0;var _0x522bdf=_0x7c09[_0x807410];return _0x522bdf;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}};
\ No newline at end of file
index 32c0d7f..a73c578 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x47fd=['undefined','limit','count','set','Content-Range','apply','save','then','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','create','update','body','find','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','extname','unlink','message','SquareRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x5d9732,_0x5dc85e){var _0x3a5c39=function(_0x1c66ed){while(--_0x1c66ed){_0x5d9732['push'](_0x5d9732['shift']());}};_0x3a5c39(++_0x5dc85e);}(_0x47fd,0x1a9));var _0xd47f=function(_0x40acca,_0x497442){_0x40acca=_0x40acca-0x0;var _0x3b0ce3=_0x47fd[_0x40acca];return _0x3b0ce3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd47f('0x0'));var zipdir=require(_0xd47f('0x1'));var jsonpatch=require(_0xd47f('0x2'));var rp=require(_0xd47f('0x3'));var moment=require(_0xd47f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd47f('0x5'));var util=require('util');var path=require(_0xd47f('0x6'));var sox=require(_0xd47f('0x7'));var csv=require(_0xd47f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd47f('0x9'));var crypto=require(_0xd47f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd47f('0xb'));var Papa=require(_0xd47f('0xc'));var Redis=require(_0xd47f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd47f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd47f('0xf'));var logger=require(_0xd47f('0x10'))(_0xd47f('0x11'));var utils=require('../../config/utils');var config=require(_0xd47f('0x12'));var licenseUtil=require(_0xd47f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2657f2,_0x319986){_0x319986=_0x319986||0xcc;return function(_0xd86fb6){if(_0xd86fb6){return _0x2657f2[_0xd47f('0x14')](_0x319986);}return _0x2657f2[_0xd47f('0x15')](_0x319986)[_0xd47f('0x16')]();};}function respondWithResult(_0x942259,_0x429fd9){_0x429fd9=_0x429fd9||0xc8;return function(_0x459d06){if(_0x459d06){return _0x942259['status'](_0x429fd9)[_0xd47f('0x17')](_0x459d06);}};}function respondWithFilteredResult(_0x50432e,_0x2c2f0c){return function(_0x73fc04){if(_0x73fc04){var _0x49b595=typeof _0x2c2f0c[_0xd47f('0x18')]===_0xd47f('0x19')&&typeof _0x2c2f0c[_0xd47f('0x1a')]===_0xd47f('0x19');var _0x1c723c=_0x73fc04[_0xd47f('0x1b')];var _0x55ea99=_0x49b595?0x0:_0x2c2f0c[_0xd47f('0x18')];var _0x14e304=_0x49b595?_0x73fc04[_0xd47f('0x1b')]:_0x2c2f0c[_0xd47f('0x18')]+_0x2c2f0c[_0xd47f('0x1a')];var _0x1b76e7;if(_0x14e304>=_0x1c723c){_0x14e304=_0x1c723c;_0x1b76e7=0xc8;}else{_0x1b76e7=0xce;}_0x50432e[_0xd47f('0x15')](_0x1b76e7);return _0x50432e[_0xd47f('0x1c')](_0xd47f('0x1d'),_0x55ea99+'-'+_0x14e304+'/'+_0x1c723c)[_0xd47f('0x17')](_0x73fc04);}return null;};}function patchUpdates(_0x23d205){return function(_0x4a77bf){try{jsonpatch[_0xd47f('0x1e')](_0x4a77bf,_0x23d205,!![]);}catch(_0x5420a5){return BPromise['reject'](_0x5420a5);}return _0x4a77bf[_0xd47f('0x1f')]();};}function saveUpdates(_0x3d3635,_0x22f4f2){return function(_0x5d137d){if(_0x5d137d){return _0x5d137d['update'](_0x3d3635)[_0xd47f('0x20')](function(_0x4dc215){return _0x4dc215;});}return null;};}function removeEntity(_0x5ae8ed,_0xeb7d37){return function(_0x44d535){if(_0x44d535){return _0x44d535['destroy']()[_0xd47f('0x20')](function(){_0x5ae8ed[_0xd47f('0x15')](0xcc)[_0xd47f('0x16')]();});}};}function handleEntityNotFound(_0x3fe010,_0x4d4582){return function(_0x158ea3){if(!_0x158ea3){_0x3fe010[_0xd47f('0x14')](0x194);}return _0x158ea3;};}function handleError(_0x4a1386,_0x1ffb00){_0x1ffb00=_0x1ffb00||0x1f4;return function(_0x266046){logger[_0xd47f('0x21')](_0x266046['stack']);if(_0x266046[_0xd47f('0x22')]){delete _0x266046[_0xd47f('0x22')];}_0x4a1386[_0xd47f('0x15')](_0x1ffb00)[_0xd47f('0x23')](_0x266046);};}exports[_0xd47f('0x24')]=function(_0x2490e9,_0x4d3aff){var _0x55e861={},_0x4c2a9f={},_0x4ae643={'count':0x0,'rows':[]};var _0x32ca82=_[_0xd47f('0x25')](db[_0xd47f('0x26')][_0xd47f('0x27')],function(_0x4702b1){return{'name':_0x4702b1[_0xd47f('0x28')],'type':_0x4702b1[_0xd47f('0x29')][_0xd47f('0x2a')]};});_0x4c2a9f[_0xd47f('0x2b')]=_[_0xd47f('0x25')](_0x32ca82,'name');_0x4c2a9f[_0xd47f('0x2c')]=_[_0xd47f('0x2d')](_0x2490e9[_0xd47f('0x2c')]);_0x4c2a9f[_0xd47f('0x2e')]=_[_0xd47f('0x2f')](_0x4c2a9f[_0xd47f('0x2b')],_0x4c2a9f[_0xd47f('0x2c')]);_0x55e861[_0xd47f('0x30')]=_[_0xd47f('0x2f')](_0x4c2a9f['model'],qs[_0xd47f('0x31')](_0x2490e9[_0xd47f('0x2c')]['fields']));_0x55e861[_0xd47f('0x30')]=_0x55e861[_0xd47f('0x30')][_0xd47f('0x32')]?_0x55e861[_0xd47f('0x30')]:_0x4c2a9f[_0xd47f('0x2b')];if(!_0x2490e9[_0xd47f('0x2c')]['hasOwnProperty'](_0xd47f('0x33'))){_0x55e861[_0xd47f('0x1a')]=qs['limit'](_0x2490e9[_0xd47f('0x2c')][_0xd47f('0x1a')]);_0x55e861[_0xd47f('0x18')]=qs['offset'](_0x2490e9['query'][_0xd47f('0x18')]);}_0x55e861['order']=qs[_0xd47f('0x34')](_0x2490e9['query'][_0xd47f('0x34')]);_0x55e861[_0xd47f('0x35')]=qs[_0xd47f('0x2e')](_[_0xd47f('0x36')](_0x2490e9[_0xd47f('0x2c')],_0x4c2a9f[_0xd47f('0x2e')]),_0x32ca82);if(_0x2490e9[_0xd47f('0x2c')][_0xd47f('0x37')]){_0x55e861['where']=_[_0xd47f('0x38')](_0x55e861[_0xd47f('0x35')],{'$or':_[_0xd47f('0x25')](_0x32ca82,function(_0xc913c){if(_0xc913c[_0xd47f('0x29')]!=='VIRTUAL'){var _0x3f271f={};_0x3f271f[_0xc913c[_0xd47f('0x22')]]={'$like':'%'+_0x2490e9[_0xd47f('0x2c')][_0xd47f('0x37')]+'%'};return _0x3f271f;}})});}_0x55e861=_['merge']({},_0x55e861,_0x2490e9['options']);var _0xfbb6d3={'where':_0x55e861[_0xd47f('0x35')]};return db[_0xd47f('0x26')][_0xd47f('0x1b')](_0xfbb6d3)[_0xd47f('0x20')](function(_0x4c7059){_0x4ae643['count']=_0x4c7059;if(_0x2490e9['query'][_0xd47f('0x39')]){_0x55e861[_0xd47f('0x3a')]=[{'all':!![]}];}return db[_0xd47f('0x26')]['findAll'](_0x55e861);})['then'](function(_0x4d2286){_0x4ae643[_0xd47f('0x3b')]=_0x4d2286;return _0x4ae643;})[_0xd47f('0x20')](respondWithFilteredResult(_0x4d3aff,_0x55e861))[_0xd47f('0x3c')](handleError(_0x4d3aff,null));};exports[_0xd47f('0x3d')]=function(_0x1099d3,_0x106078){var _0x201fcf={'raw':!![],'where':{'id':_0x1099d3[_0xd47f('0x3e')]['id']}},_0x3c0776={};_0x3c0776['model']=_['keys'](db[_0xd47f('0x26')][_0xd47f('0x27')]);_0x3c0776['query']=_[_0xd47f('0x2d')](_0x1099d3['query']);_0x3c0776['filters']=_[_0xd47f('0x2f')](_0x3c0776[_0xd47f('0x2b')],_0x3c0776[_0xd47f('0x2c')]);_0x201fcf[_0xd47f('0x30')]=_[_0xd47f('0x2f')](_0x3c0776[_0xd47f('0x2b')],qs[_0xd47f('0x31')](_0x1099d3[_0xd47f('0x2c')][_0xd47f('0x31')]));_0x201fcf[_0xd47f('0x30')]=_0x201fcf[_0xd47f('0x30')][_0xd47f('0x32')]?_0x201fcf[_0xd47f('0x30')]:_0x3c0776['model'];if(_0x1099d3[_0xd47f('0x2c')][_0xd47f('0x39')]){_0x201fcf[_0xd47f('0x3a')]=[{'all':!![]}];}_0x201fcf=_[_0xd47f('0x38')]({},_0x201fcf,_0x1099d3['options']);return db[_0xd47f('0x26')]['find'](_0x201fcf)['then'](handleEntityNotFound(_0x106078,null))[_0xd47f('0x20')](respondWithResult(_0x106078,null))[_0xd47f('0x3c')](handleError(_0x106078,null));};exports[_0xd47f('0x3f')]=function(_0x241579,_0xc40de8){return db[_0xd47f('0x26')]['create'](_0x241579['body'],{})['then'](respondWithResult(_0xc40de8,0xc9))[_0xd47f('0x3c')](handleError(_0xc40de8,null));};exports[_0xd47f('0x40')]=function(_0x1395b4,_0x2e13a4){if(_0x1395b4[_0xd47f('0x41')]['id']){delete _0x1395b4[_0xd47f('0x41')]['id'];}return db[_0xd47f('0x26')][_0xd47f('0x42')]({'where':{'id':_0x1395b4[_0xd47f('0x3e')]['id']}})[_0xd47f('0x20')](handleEntityNotFound(_0x2e13a4,null))[_0xd47f('0x20')](saveUpdates(_0x1395b4['body'],null))[_0xd47f('0x20')](respondWithResult(_0x2e13a4,null))[_0xd47f('0x3c')](handleError(_0x2e13a4,null));};exports[_0xd47f('0x43')]=function(_0x4f8606,_0x5c9db2,_0x21aab2){var _0x5cad9d=require(_0xd47f('0x44'));var _0x5a2483=![];var _0x15ea09={};if(_0x4f8606[_0xd47f('0x2c')][_0xd47f('0x29')]&&_0x4f8606[_0xd47f('0x2c')][_0xd47f('0x29')]===_0xd47f('0x45')){_0x15ea09[_0xd47f('0x45')]=_0x4f8606['params']['id'];}else{_0x15ea09['id']=_0x4f8606[_0xd47f('0x3e')]['id'];}return db['SquareRecording'][_0xd47f('0x42')]({'where':_0x15ea09,'attributes':['id',_0xd47f('0x46'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x5c9db2,null))[_0xd47f('0x20')](function(_0x5b4d5e){if(_0x5b4d5e){var _0x406f6b=_0x5b4d5e['savePath'];var _0x3bed13=util[_0xd47f('0x47')]('%s.cypher',_0x406f6b);if(fs[_0xd47f('0x48')](_0x3bed13)){_0x5a2483=!![];return _0x5cad9d[_0xd47f('0x49')](_0x3bed13,_0x406f6b,config[_0xd47f('0x4a')]['recording'])['then'](function(){return _0x5b4d5e;});}return _0x5b4d5e;}})[_0xd47f('0x20')](function(_0x1fd9fa){if(_0x1fd9fa){var _0x17c296=_0x1fd9fa[_0xd47f('0x46')];if(!fs['existsSync'](_0x17c296)){throw new db[(_0xd47f('0x4b'))][(_0xd47f('0x4c'))]('SquareRecording\x20not\x20found');}if(_0x1fd9fa[_0xd47f('0x4d')]){return _0x5c9db2[_0xd47f('0x43')](_0x17c296,_0x1fd9fa['filename']+path[_0xd47f('0x4e')](_0x17c296),function(){if(_0x5a2483){fs[_0xd47f('0x4f')](_0x17c296);}});}else{return _0x5c9db2[_0xd47f('0x43')](_0x17c296,function(_0x1b30a5){if(_0x5a2483){fs[_0xd47f('0x4f')](_0x17c296);}});}}})[_0xd47f('0x3c')](function(_0xf1496a){if(_0xf1496a[_0xd47f('0x50')]===_0xd47f('0x51')){_0x5c9db2[_0xd47f('0x15')](0x194)[_0xd47f('0x23')]('Not\x20found');}else{return handleError(_0x5c9db2,null);}});};exports[_0xd47f('0x52')]=function(_0x76a2d9,_0x127ec9){return db['SquareRecording']['find']({'where':{'id':_0x76a2d9[_0xd47f('0x3e')]['id']}})[_0xd47f('0x20')](function(_0x5a4596){if(_[_0xd47f('0x53')](_0x5a4596)){throw new ReferenceError(_0xd47f('0x54'));}return _0x5a4596;})[_0xd47f('0x20')](function(_0x4344c6){var _0x10c974=_0x4344c6[_0xd47f('0x46')];logger[_0xd47f('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x10c974);if(!_['isNil'](_0x4344c6[_0xd47f('0x46')])&&fs[_0xd47f('0x48')](_0x10c974)){logger[_0xd47f('0x55')](_0xd47f('0x56')+_0x10c974+_0xd47f('0x57'));fs[_0xd47f('0x58')](_0x10c974);}_0x10c974=_0x10c974+_0xd47f('0x59');if(!_['isNil'](_0x4344c6['savePath'])&&fs[_0xd47f('0x48')](_0x10c974)){logger[_0xd47f('0x55')](_0xd47f('0x56')+_0x10c974+_0xd47f('0x57'));fs[_0xd47f('0x58')](_0x10c974);}return _0x4344c6;})[_0xd47f('0x20')](function(_0x2777d8){if(!_0x2777d8)throw new InternalError();return _0x2777d8[_0xd47f('0x52')]();})[_0xd47f('0x20')](function(){_0x127ec9[_0xd47f('0x15')](0xcc)[_0xd47f('0x16')]();})[_0xd47f('0x3c')](handleError(_0x127ec9,null));};
\ No newline at end of file
+var _0xcde0=['zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','destroy','error','name','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','find','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','download','SquareRecording\x20not\x20found','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','unlinkSync','.cypher','eml-format','rimraf'];(function(_0x1b5358,_0x27aecc){var _0x241519=function(_0x36163e){while(--_0x36163e){_0x1b5358['push'](_0x1b5358['shift']());}};_0x241519(++_0x27aecc);}(_0xcde0,0x10f));var _0x0cde=function(_0x1633ea,_0x33f811){_0x1633ea=_0x1633ea-0x0;var _0x3f07c1=_0xcde0[_0x1633ea];return _0x3f07c1;};'use strict';var emlformat=require(_0x0cde('0x0'));var rimraf=require(_0x0cde('0x1'));var zipdir=require(_0x0cde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0cde('0x3'));var BPromise=require(_0x0cde('0x4'));var Mustache=require(_0x0cde('0x5'));var util=require(_0x0cde('0x6'));var path=require(_0x0cde('0x7'));var sox=require(_0x0cde('0x8'));var csv=require('to-csv');var ejs=require(_0x0cde('0x9'));var fs=require('fs');var fs_extra=require(_0x0cde('0xa'));var _=require(_0x0cde('0xb'));var squel=require('squel');var crypto=require(_0x0cde('0xc'));var jsforce=require(_0x0cde('0xd'));var deskjs=require(_0x0cde('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cde('0xf'));var Redis=require(_0x0cde('0x10'));var authService=require(_0x0cde('0x11'));var qs=require(_0x0cde('0x12'));var as=require(_0x0cde('0x13'));var hardwareService=require(_0x0cde('0x14'));var logger=require('../../config/logger')(_0x0cde('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cde('0x16'))['db'];function respondWithStatusCode(_0x4cdd04,_0xb7c81a){_0xb7c81a=_0xb7c81a||0xcc;return function(_0x2f4b60){if(_0x2f4b60){return _0x4cdd04[_0x0cde('0x17')](_0xb7c81a);}return _0x4cdd04[_0x0cde('0x18')](_0xb7c81a)[_0x0cde('0x19')]();};}function respondWithResult(_0x4ac604,_0x1920fa){_0x1920fa=_0x1920fa||0xc8;return function(_0x4c2341){if(_0x4c2341){return _0x4ac604['status'](_0x1920fa)['json'](_0x4c2341);}};}function respondWithFilteredResult(_0x267e20,_0x3a4954){return function(_0x6f9986){if(_0x6f9986){var _0x21ae1=typeof _0x3a4954[_0x0cde('0x1a')]==='undefined'&&typeof _0x3a4954[_0x0cde('0x1b')]===_0x0cde('0x1c');var _0x4fe324=_0x6f9986[_0x0cde('0x1d')];var _0x3960d2=_0x21ae1?0x0:_0x3a4954[_0x0cde('0x1a')];var _0xe678d1=_0x21ae1?_0x6f9986[_0x0cde('0x1d')]:_0x3a4954[_0x0cde('0x1a')]+_0x3a4954[_0x0cde('0x1b')];var _0x5c1051;if(_0xe678d1>=_0x4fe324){_0xe678d1=_0x4fe324;_0x5c1051=0xc8;}else{_0x5c1051=0xce;}_0x267e20[_0x0cde('0x18')](_0x5c1051);return _0x267e20[_0x0cde('0x1e')]('Content-Range',_0x3960d2+'-'+_0xe678d1+'/'+_0x4fe324)[_0x0cde('0x1f')](_0x6f9986);}return null;};}function patchUpdates(_0x3fcaa2){return function(_0x1d613e){try{jsonpatch[_0x0cde('0x20')](_0x1d613e,_0x3fcaa2,!![]);}catch(_0x52954c){return BPromise[_0x0cde('0x21')](_0x52954c);}return _0x1d613e['save']();};}function saveUpdates(_0x163332,_0x29d24d){return function(_0x1a69d4){if(_0x1a69d4){return _0x1a69d4[_0x0cde('0x22')](_0x163332)[_0x0cde('0x23')](function(_0x257b81){return _0x257b81;});}return null;};}function removeEntity(_0x4d3acb,_0x13cd1d){return function(_0x532996){if(_0x532996){return _0x532996[_0x0cde('0x24')]()[_0x0cde('0x23')](function(){_0x4d3acb[_0x0cde('0x18')](0xcc)[_0x0cde('0x19')]();});}};}function handleEntityNotFound(_0x866509,_0xfbbe44){return function(_0x335a3c){if(!_0x335a3c){_0x866509[_0x0cde('0x17')](0x194);}return _0x335a3c;};}function handleError(_0x5af1f1,_0x5374a3){_0x5374a3=_0x5374a3||0x1f4;return function(_0x828593){logger[_0x0cde('0x25')](_0x828593['stack']);if(_0x828593[_0x0cde('0x26')]){delete _0x828593[_0x0cde('0x26')];}_0x5af1f1[_0x0cde('0x18')](_0x5374a3)['send'](_0x828593);};}exports['index']=function(_0x225ad8,_0x377416){var _0x57304f={},_0x2caca1={},_0x56c33d={'count':0x0,'rows':[]};var _0x16a74c=_[_0x0cde('0x27')](db[_0x0cde('0x28')][_0x0cde('0x29')],function(_0x199f64){return{'name':_0x199f64[_0x0cde('0x2a')],'type':_0x199f64[_0x0cde('0x2b')][_0x0cde('0x2c')]};});_0x2caca1[_0x0cde('0x2d')]=_['map'](_0x16a74c,_0x0cde('0x26'));_0x2caca1[_0x0cde('0x2e')]=_[_0x0cde('0x2f')](_0x225ad8[_0x0cde('0x2e')]);_0x2caca1[_0x0cde('0x30')]=_[_0x0cde('0x31')](_0x2caca1[_0x0cde('0x2d')],_0x2caca1[_0x0cde('0x2e')]);_0x57304f[_0x0cde('0x32')]=_[_0x0cde('0x31')](_0x2caca1[_0x0cde('0x2d')],qs[_0x0cde('0x33')](_0x225ad8['query']['fields']));_0x57304f[_0x0cde('0x32')]=_0x57304f[_0x0cde('0x32')][_0x0cde('0x34')]?_0x57304f[_0x0cde('0x32')]:_0x2caca1[_0x0cde('0x2d')];if(!_0x225ad8[_0x0cde('0x2e')][_0x0cde('0x35')]('nolimit')){_0x57304f[_0x0cde('0x1b')]=qs[_0x0cde('0x1b')](_0x225ad8['query'][_0x0cde('0x1b')]);_0x57304f['offset']=qs['offset'](_0x225ad8['query'][_0x0cde('0x1a')]);}_0x57304f[_0x0cde('0x36')]=qs[_0x0cde('0x37')](_0x225ad8[_0x0cde('0x2e')][_0x0cde('0x37')]);_0x57304f['where']=qs[_0x0cde('0x30')](_[_0x0cde('0x38')](_0x225ad8[_0x0cde('0x2e')],_0x2caca1['filters']),_0x16a74c);if(_0x225ad8[_0x0cde('0x2e')][_0x0cde('0x39')]){_0x57304f[_0x0cde('0x3a')]=_[_0x0cde('0x3b')](_0x57304f[_0x0cde('0x3a')],{'$or':_[_0x0cde('0x27')](_0x16a74c,function(_0x1e9f82){if(_0x1e9f82['type']!==_0x0cde('0x3c')){var _0x18eda8={};_0x18eda8[_0x1e9f82['name']]={'$like':'%'+_0x225ad8['query'][_0x0cde('0x39')]+'%'};return _0x18eda8;}})});}_0x57304f=_[_0x0cde('0x3b')]({},_0x57304f,_0x225ad8[_0x0cde('0x3d')]);var _0x2ba5a1={'where':_0x57304f[_0x0cde('0x3a')]};return db[_0x0cde('0x28')][_0x0cde('0x1d')](_0x2ba5a1)[_0x0cde('0x23')](function(_0x42793c){_0x56c33d['count']=_0x42793c;if(_0x225ad8[_0x0cde('0x2e')][_0x0cde('0x3e')]){_0x57304f[_0x0cde('0x3f')]=[{'all':!![]}];}return db[_0x0cde('0x28')]['findAll'](_0x57304f);})[_0x0cde('0x23')](function(_0x51bcff){_0x56c33d[_0x0cde('0x40')]=_0x51bcff;return _0x56c33d;})['then'](respondWithFilteredResult(_0x377416,_0x57304f))['catch'](handleError(_0x377416,null));};exports[_0x0cde('0x41')]=function(_0x5a5855,_0x1bdf59){var _0x31c813={'raw':!![],'where':{'id':_0x5a5855[_0x0cde('0x42')]['id']}},_0x3181dd={};_0x3181dd['model']=_[_0x0cde('0x2f')](db[_0x0cde('0x28')]['rawAttributes']);_0x3181dd[_0x0cde('0x2e')]=_[_0x0cde('0x2f')](_0x5a5855[_0x0cde('0x2e')]);_0x3181dd[_0x0cde('0x30')]=_['intersection'](_0x3181dd[_0x0cde('0x2d')],_0x3181dd[_0x0cde('0x2e')]);_0x31c813[_0x0cde('0x32')]=_[_0x0cde('0x31')](_0x3181dd['model'],qs[_0x0cde('0x33')](_0x5a5855[_0x0cde('0x2e')][_0x0cde('0x33')]));_0x31c813['attributes']=_0x31c813['attributes']['length']?_0x31c813[_0x0cde('0x32')]:_0x3181dd[_0x0cde('0x2d')];if(_0x5a5855[_0x0cde('0x2e')]['includeAll']){_0x31c813[_0x0cde('0x3f')]=[{'all':!![]}];}_0x31c813=_['merge']({},_0x31c813,_0x5a5855[_0x0cde('0x3d')]);return db[_0x0cde('0x28')]['find'](_0x31c813)['then'](handleEntityNotFound(_0x1bdf59,null))[_0x0cde('0x23')](respondWithResult(_0x1bdf59,null))[_0x0cde('0x43')](handleError(_0x1bdf59,null));};exports['create']=function(_0x5e04ad,_0x6e124e){return db[_0x0cde('0x28')][_0x0cde('0x44')](_0x5e04ad['body'],{})[_0x0cde('0x23')](respondWithResult(_0x6e124e,0xc9))[_0x0cde('0x43')](handleError(_0x6e124e,null));};exports[_0x0cde('0x22')]=function(_0x4538d7,_0x5eb1f6){if(_0x4538d7[_0x0cde('0x45')]['id']){delete _0x4538d7[_0x0cde('0x45')]['id'];}return db['SquareRecording'][_0x0cde('0x46')]({'where':{'id':_0x4538d7[_0x0cde('0x42')]['id']}})[_0x0cde('0x23')](handleEntityNotFound(_0x5eb1f6,null))['then'](saveUpdates(_0x4538d7['body'],null))[_0x0cde('0x23')](respondWithResult(_0x5eb1f6,null))['catch'](handleError(_0x5eb1f6,null));};exports['download']=function(_0x534dfe,_0x5aa49c,_0x771abb){var _0x28d741=require(_0x0cde('0x47'));var _0xa2ef97=![];var _0x36e54e={};if(_0x534dfe[_0x0cde('0x2e')][_0x0cde('0x2b')]&&_0x534dfe[_0x0cde('0x2e')][_0x0cde('0x2b')]==='uniqueid'){_0x36e54e[_0x0cde('0x48')]=_0x534dfe[_0x0cde('0x42')]['id'];}else{_0x36e54e['id']=_0x534dfe['params']['id'];}return db[_0x0cde('0x28')][_0x0cde('0x46')]({'where':_0x36e54e,'attributes':['id','savePath',_0x0cde('0x49')],'raw':!![]})[_0x0cde('0x23')](handleEntityNotFound(_0x5aa49c,null))[_0x0cde('0x23')](function(_0x1555b2){if(_0x1555b2){var _0x2bff1b=_0x1555b2[_0x0cde('0x4a')];var _0x6e5e6e=util[_0x0cde('0x4b')](_0x0cde('0x4c'),_0x2bff1b);if(fs[_0x0cde('0x4d')](_0x6e5e6e)){_0xa2ef97=!![];return _0x28d741[_0x0cde('0x4e')](_0x6e5e6e,_0x2bff1b,config['secrets'][_0x0cde('0x4f')])[_0x0cde('0x23')](function(){return _0x1555b2;});}return _0x1555b2;}})['then'](function(_0x4b35e3){if(_0x4b35e3){var _0x60fc94=_0x4b35e3[_0x0cde('0x4a')];if(!fs[_0x0cde('0x4d')](_0x60fc94)){throw new db[(_0x0cde('0x50'))][(_0x0cde('0x51'))]('SquareRecording\x20not\x20found');}if(_0x4b35e3[_0x0cde('0x49')]){return _0x5aa49c['download'](_0x60fc94,_0x4b35e3[_0x0cde('0x49')]+path['extname'](_0x60fc94),function(){if(_0xa2ef97){fs['unlink'](_0x60fc94);}});}else{return _0x5aa49c[_0x0cde('0x52')](_0x60fc94,function(_0x3ca063){if(_0xa2ef97){fs['unlink'](_0x60fc94);}});}}})[_0x0cde('0x43')](function(_0x2f6b43){if(_0x2f6b43['message']===_0x0cde('0x53')){_0x5aa49c[_0x0cde('0x18')](0x194)[_0x0cde('0x54')](_0x0cde('0x55'));}else{return handleError(_0x5aa49c,null);}});};exports[_0x0cde('0x24')]=function(_0x61874f,_0x4acb92){return db[_0x0cde('0x28')][_0x0cde('0x46')]({'where':{'id':_0x61874f[_0x0cde('0x42')]['id']}})[_0x0cde('0x23')](function(_0x4afbeb){if(_[_0x0cde('0x56')](_0x4afbeb)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4afbeb;})['then'](function(_0x5e0e73){var _0x51f6b6=_0x5e0e73[_0x0cde('0x4a')];logger['info'](_0x0cde('0x57'),_0x51f6b6);if(!_[_0x0cde('0x56')](_0x5e0e73[_0x0cde('0x4a')])&&fs[_0x0cde('0x4d')](_0x51f6b6)){logger[_0x0cde('0x58')]('File:\x20\x22'+_0x51f6b6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0cde('0x59')](_0x51f6b6);}_0x51f6b6=_0x51f6b6+_0x0cde('0x5a');if(!_[_0x0cde('0x56')](_0x5e0e73[_0x0cde('0x4a')])&&fs[_0x0cde('0x4d')](_0x51f6b6)){logger[_0x0cde('0x58')]('File:\x20\x22'+_0x51f6b6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0cde('0x59')](_0x51f6b6);}return _0x5e0e73;})['then'](function(_0x27752d){if(!_0x27752d)throw new InternalError();return _0x27752d[_0x0cde('0x24')]();})[_0x0cde('0x23')](function(){_0x4acb92['status'](0xcc)[_0x0cde('0x19')]();})[_0x0cde('0x43')](handleError(_0x4acb92,null));};
\ No newline at end of file
index b492c33..594e669 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5532=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./squareRecording.attributes','define','square_recordings'];(function(_0x2a20e2,_0x4e9231){var _0x18b408=function(_0x4f38a2){while(--_0x4f38a2){_0x2a20e2['push'](_0x2a20e2['shift']());}};_0x18b408(++_0x4e9231);}(_0x5532,0x19a));var _0x2553=function(_0x272c15,_0x4d3bc5){_0x272c15=_0x272c15-0x0;var _0x46af26=_0x5532[_0x272c15];return _0x46af26;};'use strict';var _=require(_0x2553('0x0'));var util=require(_0x2553('0x1'));var logger=require(_0x2553('0x2'))('api');var moment=require(_0x2553('0x3'));var BPromise=require('bluebird');var rp=require(_0x2553('0x4'));var fs=require('fs');var path=require(_0x2553('0x5'));var rimraf=require(_0x2553('0x6'));var config=require('../../config/environment');var attributes=require(_0x2553('0x7'));module['exports']=function(_0x506c9a,_0x45358c){return _0x506c9a[_0x2553('0x8')]('SquareRecording',attributes,{'tableName':_0x2553('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb5f3=['exports','define','SquareRecording','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./squareRecording.attributes'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xb5f3,0x137));var _0x3b5f=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xb5f3[_0x32d457];return _0x338386;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var logger=require(_0x3b5f('0x2'))('api');var moment=require(_0x3b5f('0x3'));var BPromise=require(_0x3b5f('0x4'));var rp=require(_0x3b5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b5f('0x6'));var attributes=require(_0x3b5f('0x7'));module[_0x3b5f('0x8')]=function(_0x42d102,_0x55c7b4){return _0x42d102[_0x3b5f('0x9')](_0x3b5f('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index cbd49e5..f68212f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4484=['SquareRecording','create','body','options','raw','debug','CreateSquareRecording','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4484,0x1b7));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4448('0x0'));var BPromise=require(_0x4448('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4448('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4448('0x3'))(_0x4448('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4448('0x5')][_0x4448('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2b5239,_0x45530e,_0xcb1bab){return new BPromise(function(_0x2c6e68,_0x2af903){return client[_0x4448('0x7')](_0x2b5239,_0xcb1bab)['then'](function(_0x4721b5){logger[_0x4448('0x8')]('SquareRecording,\x20%s,\x20%s',_0x45530e,_0x4448('0x9'));logger['debug'](_0x4448('0xa'),_0x45530e,_0x4448('0x9'),JSON[_0x4448('0xb')](_0x4721b5));if(_0x4721b5[_0x4448('0xc')]){if(_0x4721b5['error'][_0x4448('0xd')]===0x1f4){logger[_0x4448('0xc')]('SquareRecording,\x20%s,\x20%s',_0x45530e,_0x4721b5[_0x4448('0xc')]['message']);return _0x2af903(_0x4721b5[_0x4448('0xc')][_0x4448('0xe')]);}logger['error'](_0x4448('0xf'),_0x45530e,_0x4721b5[_0x4448('0xc')][_0x4448('0xe')]);return _0x2c6e68(_0x4721b5['error'][_0x4448('0xe')]);}else{logger[_0x4448('0x8')](_0x4448('0xf'),_0x45530e,'request\x20sent');_0x2c6e68(_0x4721b5['result'][_0x4448('0xe')]);}})[_0x4448('0x10')](function(_0x22070f){logger[_0x4448('0xc')](_0x4448('0xf'),_0x45530e,_0x22070f);_0x2af903(_0x22070f);});});}exports['CreateSquareRecording']=function(_0x34ab41){var _0x5b1ff5=this;return new Promise(function(_0x37a1d2,_0x400ac0){return db[_0x4448('0x11')][_0x4448('0x12')](_0x34ab41[_0x4448('0x13')],{'raw':_0x34ab41[_0x4448('0x14')]?_0x34ab41[_0x4448('0x14')][_0x4448('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x40bf3a){logger['info']('CreateSquareRecording',_0x34ab41);logger[_0x4448('0x16')](_0x4448('0x17'),_0x34ab41,JSON[_0x4448('0xb')](_0x40bf3a));_0x37a1d2(_0x40bf3a);})[_0x4448('0x10')](function(_0x475aee){logger[_0x4448('0xc')]('CreateSquareRecording',_0x475aee[_0x4448('0xe')],_0x34ab41);_0x400ac0(_0x5b1ff5[_0x4448('0xc')](0x1f4,_0x475aee[_0x4448('0xe')]));});});};
\ No newline at end of file
+var _0x5b11=['rpc','../../config/environment','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','create','body','options','CreateSquareRecording','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x162efc,_0x9244b7){var _0x12ca3d=function(_0x57ce4a){while(--_0x57ce4a){_0x162efc['push'](_0x162efc['shift']());}};_0x12ca3d(++_0x9244b7);}(_0x5b11,0x1bb));var _0x15b1=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5b11[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x15b1('0x0'));var util=require(_0x15b1('0x1'));var moment=require('moment');var BPromise=require(_0x15b1('0x2'));var rs=require(_0x15b1('0x3'));var fs=require('fs');var Redis=require(_0x15b1('0x4'));var db=require(_0x15b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15b1('0x6'))(_0x15b1('0x7'));var config=require(_0x15b1('0x8'));var jayson=require(_0x15b1('0x9'));var client=jayson[_0x15b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d71dc,_0x39e50d,_0x345aa1){return new BPromise(function(_0x3251bb,_0x18dca3){return client['request'](_0x1d71dc,_0x345aa1)[_0x15b1('0xb')](function(_0x33d3cd){logger[_0x15b1('0xc')]('SquareRecording,\x20%s,\x20%s',_0x39e50d,'request\x20sent');logger['debug'](_0x15b1('0xd'),_0x39e50d,_0x15b1('0xe'),JSON[_0x15b1('0xf')](_0x33d3cd));if(_0x33d3cd['error']){if(_0x33d3cd[_0x15b1('0x10')]['code']===0x1f4){logger[_0x15b1('0x10')](_0x15b1('0x11'),_0x39e50d,_0x33d3cd[_0x15b1('0x10')]['message']);return _0x18dca3(_0x33d3cd[_0x15b1('0x10')][_0x15b1('0x12')]);}logger[_0x15b1('0x10')](_0x15b1('0x11'),_0x39e50d,_0x33d3cd[_0x15b1('0x10')][_0x15b1('0x12')]);return _0x3251bb(_0x33d3cd[_0x15b1('0x10')][_0x15b1('0x12')]);}else{logger[_0x15b1('0xc')](_0x15b1('0x11'),_0x39e50d,_0x15b1('0xe'));_0x3251bb(_0x33d3cd['result'][_0x15b1('0x12')]);}})[_0x15b1('0x13')](function(_0x559359){logger['error'](_0x15b1('0x11'),_0x39e50d,_0x559359);_0x18dca3(_0x559359);});});}exports['CreateSquareRecording']=function(_0x51880f){var _0x16f7cf=this;return new Promise(function(_0x7773db,_0x395053){return db['SquareRecording'][_0x15b1('0x14')](_0x51880f[_0x15b1('0x15')],{'raw':_0x51880f[_0x15b1('0x16')]?_0x51880f['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x27fd14){logger[_0x15b1('0xc')](_0x15b1('0x17'),_0x51880f);logger[_0x15b1('0x18')]('CreateSquareRecording',_0x51880f,JSON[_0x15b1('0xf')](_0x27fd14));_0x7773db(_0x27fd14);})['catch'](function(_0x3d7891){logger[_0x15b1('0x10')](_0x15b1('0x17'),_0x3d7891[_0x15b1('0x12')],_0x51880f);_0x395053(_0x16f7cf[_0x15b1('0x10')](0x1f4,_0x3d7891['message']));});});};
\ No newline at end of file
index 7980ae5..12748c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x248451,_0xb75598){var _0x3732a5=function(_0x269731){while(--_0x269731){_0x248451['push'](_0x248451['shift']());}};_0x3732a5(++_0xb75598);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router;
\ No newline at end of file
+var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x34b225,_0x5f0125){var _0x471f43=function(_0x2250a9){while(--_0x2250a9){_0x34b225['push'](_0x34b225['shift']());}};_0x471f43(++_0x5f0125);}(_0xe706,0xa3));var _0x6e70=function(_0x132787,_0x49aebb){_0x132787=_0x132787-0x0;var _0x281428=_0xe706[_0x132787];return _0x281428;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router;
\ No newline at end of file
index e0edbab..d9705f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09af=['STRING','DATE','sequelize','exports'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x09af,0x1ba));var _0xf09a=function(_0x1a367d,_0x2fa8af){_0x1a367d=_0x1a367d-0x0;var _0x50ff92=_0x09af[_0x1a367d];return _0x50ff92;};'use strict';var Sequelize=require(_0xf09a('0x0'));module[_0xf09a('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xf09a('0x2')]},'channel':{'type':Sequelize[_0xf09a('0x2')]},'language':{'type':Sequelize[_0xf09a('0x2')]},'type':{'type':Sequelize[_0xf09a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xf09a('0x2')]},'callerid':{'type':Sequelize[_0xf09a('0x2')]},'calleridname':{'type':Sequelize[_0xf09a('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf09a('0x2')]},'callington':{'type':Sequelize[_0xf09a('0x2')]},'callingtns':{'type':Sequelize[_0xf09a('0x2')]},'dnid':{'type':Sequelize[_0xf09a('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf09a('0x2')]},'enhanced':{'type':Sequelize[_0xf09a('0x2')]},'accountcode':{'type':Sequelize[_0xf09a('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf09a('0x2')]},'joinAt':{'type':Sequelize[_0xf09a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x4c4a=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2e68db,_0x275d04){var _0x12df4c=function(_0x1b6701){while(--_0x1b6701){_0x2e68db['push'](_0x2e68db['shift']());}};_0x12df4c(++_0x275d04);}(_0x4c4a,0x1c6));var _0xa4c4=function(_0x57f6a3,_0x233306){_0x57f6a3=_0x57f6a3-0x0;var _0x571cdf=_0x4c4a[_0x57f6a3];return _0x571cdf;};'use strict';var Sequelize=require(_0xa4c4('0x0'));module[_0xa4c4('0x1')]={'network':{'type':Sequelize[_0xa4c4('0x2')]},'network_script':{'type':Sequelize[_0xa4c4('0x2')]},'request':{'type':Sequelize[_0xa4c4('0x2')]},'channel':{'type':Sequelize[_0xa4c4('0x2')]},'language':{'type':Sequelize[_0xa4c4('0x2')]},'type':{'type':Sequelize[_0xa4c4('0x2')]},'uniqueid':{'type':Sequelize[_0xa4c4('0x2')]},'version':{'type':Sequelize[_0xa4c4('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa4c4('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xa4c4('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xa4c4('0x2')]},'rdnis':{'type':Sequelize[_0xa4c4('0x2')]},'context':{'type':Sequelize[_0xa4c4('0x2')]},'extension':{'type':Sequelize[_0xa4c4('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xa4c4('0x2')]},'accountcode':{'type':Sequelize[_0xa4c4('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa4c4('0x2')]},'joinAt':{'type':Sequelize[_0xa4c4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xa4c4('0x4')],'defaultValue':![]}};
\ No newline at end of file
index 5e5b7e3..807e21c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7ad=['name','send','index','map','SquareReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','fields','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','error','stack'];(function(_0x3971e6,_0x3ecbc5){var _0x283781=function(_0x3d78d1){while(--_0x3d78d1){_0x3971e6['push'](_0x3971e6['shift']());}};_0x283781(++_0x3ecbc5);}(_0xd7ad,0x144));var _0xdd7a=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xd7ad[_0xbf8ebe];return _0x1e25e8;};'use strict';var emlformat=require(_0xdd7a('0x0'));var rimraf=require(_0xdd7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd7a('0x2'));var rp=require(_0xdd7a('0x3'));var moment=require('moment');var BPromise=require(_0xdd7a('0x4'));var Mustache=require('mustache');var util=require(_0xdd7a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xdd7a('0x6'));var ejs=require(_0xdd7a('0x7'));var fs=require('fs');var fs_extra=require(_0xdd7a('0x8'));var _=require('lodash');var squel=require(_0xdd7a('0x9'));var crypto=require('crypto');var jsforce=require(_0xdd7a('0xa'));var deskjs=require(_0xdd7a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdd7a('0xc'));var Papa=require(_0xdd7a('0xd'));var Redis=require(_0xdd7a('0xe'));var authService=require(_0xdd7a('0xf'));var qs=require(_0xdd7a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd7a('0x11'));var logger=require(_0xdd7a('0x12'))('api');var utils=require(_0xdd7a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xdd7a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54cdb1,_0x515afb){_0x515afb=_0x515afb||0xcc;return function(_0x3ae447){if(_0x3ae447){return _0x54cdb1[_0xdd7a('0x15')](_0x515afb);}return _0x54cdb1['status'](_0x515afb)['end']();};}function respondWithResult(_0x57062a,_0xc5c29b){_0xc5c29b=_0xc5c29b||0xc8;return function(_0x5b0eb6){if(_0x5b0eb6){return _0x57062a[_0xdd7a('0x16')](_0xc5c29b)['json'](_0x5b0eb6);}};}function respondWithFilteredResult(_0x1c4ae7,_0x459cdd){return function(_0x3f6218){if(_0x3f6218){var _0x272410=typeof _0x459cdd[_0xdd7a('0x17')]===_0xdd7a('0x18')&&typeof _0x459cdd['limit']===_0xdd7a('0x18');var _0x36868e=_0x3f6218[_0xdd7a('0x19')];var _0x35fa83=_0x272410?0x0:_0x459cdd[_0xdd7a('0x17')];var _0x3b9850=_0x272410?_0x3f6218[_0xdd7a('0x19')]:_0x459cdd[_0xdd7a('0x17')]+_0x459cdd['limit'];var _0x2d527a;if(_0x3b9850>=_0x36868e){_0x3b9850=_0x36868e;_0x2d527a=0xc8;}else{_0x2d527a=0xce;}_0x1c4ae7[_0xdd7a('0x16')](_0x2d527a);return _0x1c4ae7['set'](_0xdd7a('0x1a'),_0x35fa83+'-'+_0x3b9850+'/'+_0x36868e)['json'](_0x3f6218);}return null;};}function patchUpdates(_0x162f96){return function(_0x391c7a){try{jsonpatch[_0xdd7a('0x1b')](_0x391c7a,_0x162f96,!![]);}catch(_0x31887c){return BPromise[_0xdd7a('0x1c')](_0x31887c);}return _0x391c7a[_0xdd7a('0x1d')]();};}function saveUpdates(_0x352dd3,_0x45c17b){return function(_0x2b540d){if(_0x2b540d){return _0x2b540d[_0xdd7a('0x1e')](_0x352dd3)['then'](function(_0x5719dd){return _0x5719dd;});}return null;};}function removeEntity(_0xf3bbe7,_0xb0541b){return function(_0x7ade56){if(_0x7ade56){return _0x7ade56[_0xdd7a('0x1f')]()[_0xdd7a('0x20')](function(){_0xf3bbe7[_0xdd7a('0x16')](0xcc)[_0xdd7a('0x21')]();});}};}function handleEntityNotFound(_0x2538ba,_0x1320cf){return function(_0x548004){if(!_0x548004){_0x2538ba[_0xdd7a('0x15')](0x194);}return _0x548004;};}function handleError(_0x254e52,_0x298ea5){_0x298ea5=_0x298ea5||0x1f4;return function(_0xaa76c9){logger[_0xdd7a('0x22')](_0xaa76c9[_0xdd7a('0x23')]);if(_0xaa76c9[_0xdd7a('0x24')]){delete _0xaa76c9['name'];}_0x254e52['status'](_0x298ea5)[_0xdd7a('0x25')](_0xaa76c9);};}exports[_0xdd7a('0x26')]=function(_0x3ce6c0,_0x53943a){var _0x34f338={},_0x4fb236={},_0x4e5c49={'count':0x0,'rows':[]};var _0x5d9c8f=_[_0xdd7a('0x27')](db[_0xdd7a('0x28')][_0xdd7a('0x29')],function(_0x2c67e9){return{'name':_0x2c67e9['fieldName'],'type':_0x2c67e9[_0xdd7a('0x2a')][_0xdd7a('0x2b')]};});_0x4fb236[_0xdd7a('0x2c')]=_[_0xdd7a('0x27')](_0x5d9c8f,_0xdd7a('0x24'));_0x4fb236['query']=_[_0xdd7a('0x2d')](_0x3ce6c0[_0xdd7a('0x2e')]);_0x4fb236[_0xdd7a('0x2f')]=_[_0xdd7a('0x30')](_0x4fb236['model'],_0x4fb236[_0xdd7a('0x2e')]);_0x34f338[_0xdd7a('0x31')]=_[_0xdd7a('0x30')](_0x4fb236[_0xdd7a('0x2c')],qs['fields'](_0x3ce6c0[_0xdd7a('0x2e')]['fields']));_0x34f338['attributes']=_0x34f338[_0xdd7a('0x31')][_0xdd7a('0x32')]?_0x34f338[_0xdd7a('0x31')]:_0x4fb236[_0xdd7a('0x2c')];if(!_0x3ce6c0[_0xdd7a('0x2e')]['hasOwnProperty'](_0xdd7a('0x33'))){_0x34f338[_0xdd7a('0x34')]=qs['limit'](_0x3ce6c0[_0xdd7a('0x2e')][_0xdd7a('0x34')]);_0x34f338[_0xdd7a('0x17')]=qs[_0xdd7a('0x17')](_0x3ce6c0[_0xdd7a('0x2e')][_0xdd7a('0x17')]);}_0x34f338[_0xdd7a('0x35')]=qs['sort'](_0x3ce6c0[_0xdd7a('0x2e')][_0xdd7a('0x36')]);_0x34f338['where']=qs[_0xdd7a('0x2f')](_[_0xdd7a('0x37')](_0x3ce6c0[_0xdd7a('0x2e')],_0x4fb236[_0xdd7a('0x2f')]),_0x5d9c8f);if(_0x3ce6c0[_0xdd7a('0x2e')][_0xdd7a('0x38')]){_0x34f338['where']=_[_0xdd7a('0x39')](_0x34f338['where'],{'$or':_[_0xdd7a('0x27')](_0x5d9c8f,function(_0x37abc0){if(_0x37abc0[_0xdd7a('0x2a')]!==_0xdd7a('0x3a')){var _0x198b21={};_0x198b21[_0x37abc0['name']]={'$like':'%'+_0x3ce6c0[_0xdd7a('0x2e')][_0xdd7a('0x38')]+'%'};return _0x198b21;}})});}_0x34f338=_[_0xdd7a('0x39')]({},_0x34f338,_0x3ce6c0['options']);var _0x40e62f={'where':_0x34f338['where']};return db[_0xdd7a('0x28')]['count'](_0x40e62f)[_0xdd7a('0x20')](function(_0x8861fd){_0x4e5c49['count']=_0x8861fd;if(_0x3ce6c0['query'][_0xdd7a('0x3b')]){_0x34f338[_0xdd7a('0x3c')]=[{'all':!![]}];}return db[_0xdd7a('0x28')][_0xdd7a('0x3d')](_0x34f338);})[_0xdd7a('0x20')](function(_0xda48f5){_0x4e5c49[_0xdd7a('0x3e')]=_0xda48f5;return _0x4e5c49;})['then'](respondWithFilteredResult(_0x53943a,_0x34f338))[_0xdd7a('0x3f')](handleError(_0x53943a,null));};exports[_0xdd7a('0x40')]=function(_0x4233a8,_0x2232a6){var _0x353943={'raw':!![],'where':{'id':_0x4233a8['params']['id']}},_0x47db4f={};_0x47db4f[_0xdd7a('0x2c')]=_[_0xdd7a('0x2d')](db[_0xdd7a('0x28')]['rawAttributes']);_0x47db4f[_0xdd7a('0x2e')]=_[_0xdd7a('0x2d')](_0x4233a8['query']);_0x47db4f[_0xdd7a('0x2f')]=_[_0xdd7a('0x30')](_0x47db4f[_0xdd7a('0x2c')],_0x47db4f['query']);_0x353943[_0xdd7a('0x31')]=_['intersection'](_0x47db4f[_0xdd7a('0x2c')],qs[_0xdd7a('0x41')](_0x4233a8[_0xdd7a('0x2e')][_0xdd7a('0x41')]));_0x353943[_0xdd7a('0x31')]=_0x353943[_0xdd7a('0x31')]['length']?_0x353943[_0xdd7a('0x31')]:_0x47db4f['model'];if(_0x4233a8[_0xdd7a('0x2e')]['includeAll']){_0x353943['include']=[{'all':!![]}];}_0x353943=_['merge']({},_0x353943,_0x4233a8[_0xdd7a('0x42')]);return db[_0xdd7a('0x28')]['find'](_0x353943)[_0xdd7a('0x20')](handleEntityNotFound(_0x2232a6,null))[_0xdd7a('0x20')](respondWithResult(_0x2232a6,null))[_0xdd7a('0x3f')](handleError(_0x2232a6,null));};exports['create']=function(_0xb0724a,_0x147e23){return db[_0xdd7a('0x28')][_0xdd7a('0x43')](_0xb0724a['body'],{})[_0xdd7a('0x20')](respondWithResult(_0x147e23,0xc9))[_0xdd7a('0x3f')](handleError(_0x147e23,null));};exports[_0xdd7a('0x1e')]=function(_0x32e25a,_0x22059f){if(_0x32e25a[_0xdd7a('0x44')]['id']){delete _0x32e25a['body']['id'];}return db[_0xdd7a('0x28')][_0xdd7a('0x45')]({'where':{'id':_0x32e25a[_0xdd7a('0x46')]['id']}})[_0xdd7a('0x20')](handleEntityNotFound(_0x22059f,null))['then'](saveUpdates(_0x32e25a['body'],null))[_0xdd7a('0x20')](respondWithResult(_0x22059f,null))[_0xdd7a('0x3f')](handleError(_0x22059f,null));};exports[_0xdd7a('0x1f')]=function(_0x16442c,_0x3ddf34){return db[_0xdd7a('0x28')][_0xdd7a('0x45')]({'where':{'id':_0x16442c[_0xdd7a('0x46')]['id']}})[_0xdd7a('0x20')](handleEntityNotFound(_0x3ddf34,null))[_0xdd7a('0x20')](removeEntity(_0x3ddf34,null))[_0xdd7a('0x3f')](handleError(_0x3ddf34,null));};exports[_0xdd7a('0x47')]=function(_0x5dc7ff,_0x4c3e4b){return db[_0xdd7a('0x28')][_0xdd7a('0x47')]()[_0xdd7a('0x20')](respondWithResult(_0x4c3e4b,null))[_0xdd7a('0x3f')](handleError(_0x4c3e4b,null));};
\ No newline at end of file
+var _0xc9fb=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','offset','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','index','SquareReport','rawAttributes','type','key','model','map','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','name','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc9fb,0x1ac));var _0xbc9f=function(_0xcca33c,_0x35cbf3){_0xcca33c=_0xcca33c-0x0;var _0x31cf8a=_0xc9fb[_0xcca33c];return _0x31cf8a;};'use strict';var emlformat=require(_0xbc9f('0x0'));var rimraf=require(_0xbc9f('0x1'));var zipdir=require(_0xbc9f('0x2'));var jsonpatch=require(_0xbc9f('0x3'));var rp=require(_0xbc9f('0x4'));var moment=require(_0xbc9f('0x5'));var BPromise=require(_0xbc9f('0x6'));var Mustache=require(_0xbc9f('0x7'));var util=require('util');var path=require(_0xbc9f('0x8'));var sox=require(_0xbc9f('0x9'));var csv=require(_0xbc9f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc9f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbc9f('0xc'));var deskjs=require(_0xbc9f('0xd'));var toCsv=require(_0xbc9f('0xa'));var querystring=require(_0xbc9f('0xe'));var Papa=require(_0xbc9f('0xf'));var Redis=require(_0xbc9f('0x10'));var authService=require(_0xbc9f('0x11'));var qs=require(_0xbc9f('0x12'));var as=require(_0xbc9f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc9f('0x14'))(_0xbc9f('0x15'));var utils=require('../../config/utils');var config=require(_0xbc9f('0x16'));var licenseUtil=require(_0xbc9f('0x17'));var db=require(_0xbc9f('0x18'))['db'];function respondWithStatusCode(_0x562c07,_0x449e74){_0x449e74=_0x449e74||0xcc;return function(_0x193d18){if(_0x193d18){return _0x562c07['sendStatus'](_0x449e74);}return _0x562c07[_0xbc9f('0x19')](_0x449e74)[_0xbc9f('0x1a')]();};}function respondWithResult(_0xd1e3,_0xe57931){_0xe57931=_0xe57931||0xc8;return function(_0x207d49){if(_0x207d49){return _0xd1e3[_0xbc9f('0x19')](_0xe57931)[_0xbc9f('0x1b')](_0x207d49);}};}function respondWithFilteredResult(_0x31f1c7,_0x4f175b){return function(_0x933756){if(_0x933756){var _0x41684c=typeof _0x4f175b['offset']==='undefined'&&typeof _0x4f175b[_0xbc9f('0x1c')]==='undefined';var _0x1a718d=_0x933756['count'];var _0x26706f=_0x41684c?0x0:_0x4f175b[_0xbc9f('0x1d')];var _0x37299b=_0x41684c?_0x933756[_0xbc9f('0x1e')]:_0x4f175b['offset']+_0x4f175b[_0xbc9f('0x1c')];var _0x527243;if(_0x37299b>=_0x1a718d){_0x37299b=_0x1a718d;_0x527243=0xc8;}else{_0x527243=0xce;}_0x31f1c7['status'](_0x527243);return _0x31f1c7[_0xbc9f('0x1f')](_0xbc9f('0x20'),_0x26706f+'-'+_0x37299b+'/'+_0x1a718d)[_0xbc9f('0x1b')](_0x933756);}return null;};}function patchUpdates(_0x91c2a4){return function(_0x336a79){try{jsonpatch[_0xbc9f('0x21')](_0x336a79,_0x91c2a4,!![]);}catch(_0x2fd4b9){return BPromise[_0xbc9f('0x22')](_0x2fd4b9);}return _0x336a79['save']();};}function saveUpdates(_0x23fd86,_0x12c6c){return function(_0xcd0881){if(_0xcd0881){return _0xcd0881['update'](_0x23fd86)[_0xbc9f('0x23')](function(_0xfeb54a){return _0xfeb54a;});}return null;};}function removeEntity(_0x5d9bc5,_0x118678){return function(_0x145b2b){if(_0x145b2b){return _0x145b2b[_0xbc9f('0x24')]()['then'](function(){_0x5d9bc5[_0xbc9f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573702,_0x279eb6){return function(_0x43b0ba){if(!_0x43b0ba){_0x573702[_0xbc9f('0x25')](0x194);}return _0x43b0ba;};}function handleError(_0x50e922,_0x308022){_0x308022=_0x308022||0x1f4;return function(_0x40beb7){logger[_0xbc9f('0x26')](_0x40beb7[_0xbc9f('0x27')]);if(_0x40beb7['name']){delete _0x40beb7['name'];}_0x50e922[_0xbc9f('0x19')](_0x308022)['send'](_0x40beb7);};}exports[_0xbc9f('0x28')]=function(_0x153096,_0x4cbf10){var _0x4a0b7d={},_0x5c2e15={},_0x37143e={'count':0x0,'rows':[]};var _0x443429=_['map'](db[_0xbc9f('0x29')][_0xbc9f('0x2a')],function(_0x782299){return{'name':_0x782299['fieldName'],'type':_0x782299[_0xbc9f('0x2b')][_0xbc9f('0x2c')]};});_0x5c2e15[_0xbc9f('0x2d')]=_[_0xbc9f('0x2e')](_0x443429,'name');_0x5c2e15['query']=_['keys'](_0x153096['query']);_0x5c2e15[_0xbc9f('0x2f')]=_[_0xbc9f('0x30')](_0x5c2e15['model'],_0x5c2e15['query']);_0x4a0b7d[_0xbc9f('0x31')]=_[_0xbc9f('0x30')](_0x5c2e15[_0xbc9f('0x2d')],qs['fields'](_0x153096['query'][_0xbc9f('0x32')]));_0x4a0b7d[_0xbc9f('0x31')]=_0x4a0b7d[_0xbc9f('0x31')][_0xbc9f('0x33')]?_0x4a0b7d[_0xbc9f('0x31')]:_0x5c2e15[_0xbc9f('0x2d')];if(!_0x153096[_0xbc9f('0x34')][_0xbc9f('0x35')](_0xbc9f('0x36'))){_0x4a0b7d[_0xbc9f('0x1c')]=qs[_0xbc9f('0x1c')](_0x153096[_0xbc9f('0x34')][_0xbc9f('0x1c')]);_0x4a0b7d[_0xbc9f('0x1d')]=qs[_0xbc9f('0x1d')](_0x153096[_0xbc9f('0x34')][_0xbc9f('0x1d')]);}_0x4a0b7d[_0xbc9f('0x37')]=qs[_0xbc9f('0x38')](_0x153096['query']['sort']);_0x4a0b7d['where']=qs['filters'](_[_0xbc9f('0x39')](_0x153096[_0xbc9f('0x34')],_0x5c2e15[_0xbc9f('0x2f')]),_0x443429);if(_0x153096[_0xbc9f('0x34')][_0xbc9f('0x3a')]){_0x4a0b7d[_0xbc9f('0x3b')]=_[_0xbc9f('0x3c')](_0x4a0b7d['where'],{'$or':_[_0xbc9f('0x2e')](_0x443429,function(_0x5be8cb){if(_0x5be8cb[_0xbc9f('0x2b')]!=='VIRTUAL'){var _0x1e18c7={};_0x1e18c7[_0x5be8cb[_0xbc9f('0x3d')]]={'$like':'%'+_0x153096[_0xbc9f('0x34')][_0xbc9f('0x3a')]+'%'};return _0x1e18c7;}})});}_0x4a0b7d=_[_0xbc9f('0x3c')]({},_0x4a0b7d,_0x153096['options']);var _0x5360bd={'where':_0x4a0b7d['where']};return db[_0xbc9f('0x29')]['count'](_0x5360bd)[_0xbc9f('0x23')](function(_0x5230d3){_0x37143e[_0xbc9f('0x1e')]=_0x5230d3;if(_0x153096[_0xbc9f('0x34')][_0xbc9f('0x3e')]){_0x4a0b7d[_0xbc9f('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0xbc9f('0x40')](_0x4a0b7d);})[_0xbc9f('0x23')](function(_0x5de635){_0x37143e[_0xbc9f('0x41')]=_0x5de635;return _0x37143e;})[_0xbc9f('0x23')](respondWithFilteredResult(_0x4cbf10,_0x4a0b7d))[_0xbc9f('0x42')](handleError(_0x4cbf10,null));};exports[_0xbc9f('0x43')]=function(_0x5ee01e,_0x2e92f3){var _0x52e8ca={'raw':!![],'where':{'id':_0x5ee01e[_0xbc9f('0x44')]['id']}},_0x197bf2={};_0x197bf2[_0xbc9f('0x2d')]=_[_0xbc9f('0x45')](db[_0xbc9f('0x29')]['rawAttributes']);_0x197bf2['query']=_['keys'](_0x5ee01e[_0xbc9f('0x34')]);_0x197bf2[_0xbc9f('0x2f')]=_[_0xbc9f('0x30')](_0x197bf2[_0xbc9f('0x2d')],_0x197bf2['query']);_0x52e8ca['attributes']=_[_0xbc9f('0x30')](_0x197bf2[_0xbc9f('0x2d')],qs[_0xbc9f('0x32')](_0x5ee01e[_0xbc9f('0x34')][_0xbc9f('0x32')]));_0x52e8ca[_0xbc9f('0x31')]=_0x52e8ca[_0xbc9f('0x31')][_0xbc9f('0x33')]?_0x52e8ca[_0xbc9f('0x31')]:_0x197bf2[_0xbc9f('0x2d')];if(_0x5ee01e[_0xbc9f('0x34')][_0xbc9f('0x3e')]){_0x52e8ca[_0xbc9f('0x3f')]=[{'all':!![]}];}_0x52e8ca=_[_0xbc9f('0x3c')]({},_0x52e8ca,_0x5ee01e['options']);return db[_0xbc9f('0x29')][_0xbc9f('0x46')](_0x52e8ca)['then'](handleEntityNotFound(_0x2e92f3,null))[_0xbc9f('0x23')](respondWithResult(_0x2e92f3,null))[_0xbc9f('0x42')](handleError(_0x2e92f3,null));};exports[_0xbc9f('0x47')]=function(_0x289ae7,_0x447780){return db[_0xbc9f('0x29')][_0xbc9f('0x47')](_0x289ae7[_0xbc9f('0x48')],{})[_0xbc9f('0x23')](respondWithResult(_0x447780,0xc9))['catch'](handleError(_0x447780,null));};exports['update']=function(_0x30207d,_0x468013){if(_0x30207d['body']['id']){delete _0x30207d[_0xbc9f('0x48')]['id'];}return db[_0xbc9f('0x29')][_0xbc9f('0x46')]({'where':{'id':_0x30207d[_0xbc9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x468013,null))[_0xbc9f('0x23')](saveUpdates(_0x30207d[_0xbc9f('0x48')],null))[_0xbc9f('0x23')](respondWithResult(_0x468013,null))[_0xbc9f('0x42')](handleError(_0x468013,null));};exports[_0xbc9f('0x24')]=function(_0x2b70c9,_0x219a7b){return db[_0xbc9f('0x29')][_0xbc9f('0x46')]({'where':{'id':_0x2b70c9['params']['id']}})[_0xbc9f('0x23')](handleEntityNotFound(_0x219a7b,null))[_0xbc9f('0x23')](removeEntity(_0x219a7b,null))[_0xbc9f('0x42')](handleError(_0x219a7b,null));};exports[_0xbc9f('0x49')]=function(_0x3ac438,_0x1bf2e8){return db[_0xbc9f('0x29')][_0xbc9f('0x49')]()[_0xbc9f('0x23')](respondWithResult(_0x1bf2e8,null))[_0xbc9f('0x42')](handleError(_0x1bf2e8,null));};
\ No newline at end of file
index c572cf2..fde9c43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x680f=['SquareReport','report_square','uniqueid','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x680f,0x11c));var _0xf680=function(_0xc315de,_0x5dc877){_0xc315de=_0xc315de-0x0;var _0x11a627=_0x680f[_0xc315de];return _0x11a627;};'use strict';var _=require(_0xf680('0x0'));var util=require(_0xf680('0x1'));var logger=require(_0xf680('0x2'))('api');var moment=require(_0xf680('0x3'));var BPromise=require(_0xf680('0x4'));var rp=require(_0xf680('0x5'));var fs=require('fs');var path=require(_0xf680('0x6'));var rimraf=require(_0xf680('0x7'));var config=require(_0xf680('0x8'));var attributes=require('./squareReport.attributes');module[_0xf680('0x9')]=function(_0xca150b,_0x2b5b2e){return _0xca150b['define'](_0xf680('0xa'),attributes,{'tableName':_0xf680('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xf680('0xc'),'project_name']},{'name':'leaveAt','fields':[_0xf680('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xc1de=['SquareReport','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define'];(function(_0x4a23f7,_0x503cbc){var _0x285847=function(_0x1ca9fd){while(--_0x1ca9fd){_0x4a23f7['push'](_0x4a23f7['shift']());}};_0x285847(++_0x503cbc);}(_0xc1de,0xaa));var _0xec1d=function(_0x7de1f6,_0x55d02f){_0x7de1f6=_0x7de1f6-0x0;var _0x21e950=_0xc1de[_0x7de1f6];return _0x21e950;};'use strict';var _=require('lodash');var util=require(_0xec1d('0x0'));var logger=require(_0xec1d('0x1'))(_0xec1d('0x2'));var moment=require(_0xec1d('0x3'));var BPromise=require(_0xec1d('0x4'));var rp=require(_0xec1d('0x5'));var fs=require('fs');var path=require(_0xec1d('0x6'));var rimraf=require('rimraf');var config=require(_0xec1d('0x7'));var attributes=require(_0xec1d('0x8'));module['exports']=function(_0x51521d,_0xb4d156){return _0x51521d[_0xec1d('0x9')](_0xec1d('0xa'),attributes,{'tableName':_0xec1d('0xb'),'paranoid':![],'indexes':[{'name':_0xec1d('0xc'),'fields':[_0xec1d('0xd'),'project_name']},{'name':_0xec1d('0xe'),'fields':[_0xec1d('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index a5fc376..16e3613 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3987=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSquareReport','SquareReport','body','options','raw','then','debug','stringify','UpdateSquareReport','update','attributes','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x3987,0x9b));var _0x7398=function(_0xb6b33a,_0x1427c5){_0xb6b33a=_0xb6b33a-0x0;var _0x2f747f=_0x3987[_0xb6b33a];return _0x2f747f;};'use strict';var _=require(_0x7398('0x0'));var util=require(_0x7398('0x1'));var moment=require('moment');var BPromise=require(_0x7398('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7398('0x3'));var db=require(_0x7398('0x4'))['db'];var utils=require(_0x7398('0x5'));var logger=require(_0x7398('0x6'))(_0x7398('0x7'));var config=require('../../config/environment');var jayson=require(_0x7398('0x8'));var client=jayson[_0x7398('0x9')][_0x7398('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22458e,_0xb5094,_0x1297e9){return new BPromise(function(_0x13de25,_0xa46629){return client[_0x7398('0xb')](_0x22458e,_0x1297e9)['then'](function(_0x5e3bae){logger['info'](_0x7398('0xc'),_0xb5094,_0x7398('0xd'));logger['debug'](_0x7398('0xe'),_0xb5094,_0x7398('0xd'),JSON['stringify'](_0x5e3bae));if(_0x5e3bae['error']){if(_0x5e3bae[_0x7398('0xf')][_0x7398('0x10')]===0x1f4){logger[_0x7398('0xf')](_0x7398('0xc'),_0xb5094,_0x5e3bae['error'][_0x7398('0x11')]);return _0xa46629(_0x5e3bae[_0x7398('0xf')]['message']);}logger[_0x7398('0xf')]('SquareReport,\x20%s,\x20%s',_0xb5094,_0x5e3bae[_0x7398('0xf')][_0x7398('0x11')]);return _0x13de25(_0x5e3bae['error'][_0x7398('0x11')]);}else{logger[_0x7398('0x12')](_0x7398('0xc'),_0xb5094,_0x7398('0xd'));_0x13de25(_0x5e3bae[_0x7398('0x13')]['message']);}})[_0x7398('0x14')](function(_0x1106a1){logger[_0x7398('0xf')]('SquareReport,\x20%s,\x20%s',_0xb5094,_0x1106a1);_0xa46629(_0x1106a1);});});}exports[_0x7398('0x15')]=function(_0x515931){var _0x46e6a1=this;return new Promise(function(_0x1f888f,_0x46d85f){return db[_0x7398('0x16')]['create'](_0x515931[_0x7398('0x17')],{'raw':_0x515931[_0x7398('0x18')]?_0x515931[_0x7398('0x18')][_0x7398('0x19')]===undefined?!![]:![]:!![]})[_0x7398('0x1a')](function(_0x5135ab){logger[_0x7398('0x12')]('CreateSquareReport',_0x515931);logger[_0x7398('0x1b')](_0x7398('0x15'),_0x515931,JSON[_0x7398('0x1c')](_0x5135ab));_0x1f888f(_0x5135ab);})['catch'](function(_0x356002){logger['error']('CreateSquareReport',_0x356002['message'],_0x515931);_0x46d85f(_0x46e6a1[_0x7398('0xf')](0x1f4,_0x356002[_0x7398('0x11')]));});});};exports[_0x7398('0x1d')]=function(_0x3d093c){var _0x3a82e4=this;return new Promise(function(_0x464ef5,_0x8219d0){return db[_0x7398('0x16')][_0x7398('0x1e')](_0x3d093c[_0x7398('0x17')],{'raw':_0x3d093c[_0x7398('0x18')]?_0x3d093c[_0x7398('0x18')][_0x7398('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d093c[_0x7398('0x18')]?_0x3d093c['options']['where']||null:null,'attributes':_0x3d093c[_0x7398('0x18')]?_0x3d093c[_0x7398('0x18')][_0x7398('0x1f')]||null:null,'limit':_0x3d093c[_0x7398('0x18')]?_0x3d093c[_0x7398('0x18')]['limit']||null:null})[_0x7398('0x1a')](function(_0x23f0dc){logger[_0x7398('0x12')]('UpdateSquareReport',_0x3d093c);logger[_0x7398('0x1b')]('UpdateSquareReport',_0x3d093c,JSON['stringify'](_0x23f0dc));_0x464ef5(_0x23f0dc);})[_0x7398('0x14')](function(_0x204b1b){logger[_0x7398('0xf')]('UpdateSquareReport',_0x204b1b[_0x7398('0x11')],_0x3d093c);_0x8219d0(_0x3a82e4[_0x7398('0xf')](0x1f4,_0x204b1b[_0x7398('0x11')]));});});};
\ No newline at end of file
+var _0x9457=['request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','debug','catch','UpdateSquareReport','where','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x29f48d,_0x433334){var _0x173358=function(_0x1ad9ec){while(--_0x1ad9ec){_0x29f48d['push'](_0x29f48d['shift']());}};_0x173358(++_0x433334);}(_0x9457,0xef));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7945('0x0'));var moment=require('moment');var BPromise=require(_0x7945('0x1'));var rs=require(_0x7945('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7945('0x3'))['db'];var utils=require(_0x7945('0x4'));var logger=require('../../config/logger')(_0x7945('0x5'));var config=require(_0x7945('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7945('0x7')][_0x7945('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43ee6e,_0xe42823,_0x12a3ac){return new BPromise(function(_0x3a71a3,_0x1ad365){return client[_0x7945('0x9')](_0x43ee6e,_0x12a3ac)[_0x7945('0xa')](function(_0x46ff36){logger[_0x7945('0xb')](_0x7945('0xc'),_0xe42823,_0x7945('0xd'));logger['debug'](_0x7945('0xe'),_0xe42823,_0x7945('0xd'),JSON[_0x7945('0xf')](_0x46ff36));if(_0x46ff36[_0x7945('0x10')]){if(_0x46ff36[_0x7945('0x10')][_0x7945('0x11')]===0x1f4){logger[_0x7945('0x10')](_0x7945('0xc'),_0xe42823,_0x46ff36[_0x7945('0x10')]['message']);return _0x1ad365(_0x46ff36[_0x7945('0x10')]['message']);}logger['error'](_0x7945('0xc'),_0xe42823,_0x46ff36[_0x7945('0x10')][_0x7945('0x12')]);return _0x3a71a3(_0x46ff36[_0x7945('0x10')][_0x7945('0x12')]);}else{logger[_0x7945('0xb')](_0x7945('0xc'),_0xe42823,_0x7945('0xd'));_0x3a71a3(_0x46ff36[_0x7945('0x13')][_0x7945('0x12')]);}})['catch'](function(_0x559504){logger[_0x7945('0x10')](_0x7945('0xc'),_0xe42823,_0x559504);_0x1ad365(_0x559504);});});}exports[_0x7945('0x14')]=function(_0x18935e){var _0x40a009=this;return new Promise(function(_0x35c685,_0x6f7b5b){return db[_0x7945('0x15')][_0x7945('0x16')](_0x18935e[_0x7945('0x17')],{'raw':_0x18935e[_0x7945('0x18')]?_0x18935e[_0x7945('0x18')][_0x7945('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3e6a74){logger[_0x7945('0xb')](_0x7945('0x14'),_0x18935e);logger[_0x7945('0x1a')](_0x7945('0x14'),_0x18935e,JSON[_0x7945('0xf')](_0x3e6a74));_0x35c685(_0x3e6a74);})[_0x7945('0x1b')](function(_0xbe2d9a){logger[_0x7945('0x10')]('CreateSquareReport',_0xbe2d9a[_0x7945('0x12')],_0x18935e);_0x6f7b5b(_0x40a009[_0x7945('0x10')](0x1f4,_0xbe2d9a[_0x7945('0x12')]));});});};exports[_0x7945('0x1c')]=function(_0x2dc4e4){var _0x37e3cf=this;return new Promise(function(_0x1be40c,_0x2a6fca){return db[_0x7945('0x15')]['update'](_0x2dc4e4[_0x7945('0x17')],{'raw':_0x2dc4e4[_0x7945('0x18')]?_0x2dc4e4['options'][_0x7945('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dc4e4[_0x7945('0x18')]?_0x2dc4e4[_0x7945('0x18')][_0x7945('0x1d')]||null:null,'attributes':_0x2dc4e4[_0x7945('0x18')]?_0x2dc4e4['options']['attributes']||null:null,'limit':_0x2dc4e4[_0x7945('0x18')]?_0x2dc4e4[_0x7945('0x18')][_0x7945('0x1e')]||null:null})[_0x7945('0xa')](function(_0x352a57){logger[_0x7945('0xb')](_0x7945('0x1c'),_0x2dc4e4);logger[_0x7945('0x1a')](_0x7945('0x1c'),_0x2dc4e4,JSON[_0x7945('0xf')](_0x352a57));_0x1be40c(_0x352a57);})[_0x7945('0x1b')](function(_0x233d02){logger['error'](_0x7945('0x1c'),_0x233d02[_0x7945('0x12')],_0x2dc4e4);_0x2a6fca(_0x37e3cf['error'](0x1f4,_0x233d02[_0x7945('0x12')]));});});};
\ No newline at end of file
index be15b84..7076618 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf5eb=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./squareReportDetail.controller','get','index','/describe','describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf5eb,0x1ce));var _0xbf5e=function(_0xab326c,_0x4c0bd8){_0xab326c=_0xab326c-0x0;var _0x3a4648=_0xf5eb[_0xab326c];return _0x3a4648;};'use strict';var multer=require(_0xbf5e('0x0'));var util=require(_0xbf5e('0x1'));var path=require('path');var timeout=require(_0xbf5e('0x2'));var express=require(_0xbf5e('0x3'));var router=express[_0xbf5e('0x4')]();var fs_extra=require(_0xbf5e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf5e('0x6'));var controller=require(_0xbf5e('0x7'));router[_0xbf5e('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf5e('0x9')]);router['get'](_0xbf5e('0xa'),auth['isAuthenticated'](),controller[_0xbf5e('0xb')]);router[_0xbf5e('0x8')]('/:id',auth[_0xbf5e('0xc')](),controller[_0xbf5e('0xd')]);router[_0xbf5e('0xe')]('/',auth[_0xbf5e('0xc')](),controller['create']);router[_0xbf5e('0xf')](_0xbf5e('0x10'),auth[_0xbf5e('0xc')](),controller[_0xbf5e('0x11')]);router['delete'](_0xbf5e('0x10'),auth['isAuthenticated'](),controller[_0xbf5e('0x12')]);module[_0xbf5e('0x13')]=router;
\ No newline at end of file
+var _0xc1aa=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x414f45,_0x1ee7d3){var _0x3bc907=function(_0x2e22de){while(--_0x2e22de){_0x414f45['push'](_0x414f45['shift']());}};_0x3bc907(++_0x1ee7d3);}(_0xc1aa,0x111));var _0xac1a=function(_0x3126d6,_0x2dd984){_0x3126d6=_0x3126d6-0x0;var _0x22a899=_0xc1aa[_0x3126d6];return _0x22a899;};'use strict';var multer=require(_0xac1a('0x0'));var util=require(_0xac1a('0x1'));var path=require('path');var timeout=require(_0xac1a('0x2'));var express=require(_0xac1a('0x3'));var router=express[_0xac1a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac1a('0x5'));var interaction=require(_0xac1a('0x6'));var config=require('../../config/environment');var controller=require(_0xac1a('0x7'));router['get']('/',auth[_0xac1a('0x8')](),controller[_0xac1a('0x9')]);router[_0xac1a('0xa')](_0xac1a('0xb'),auth[_0xac1a('0x8')](),controller[_0xac1a('0xc')]);router['get']('/:id',auth[_0xac1a('0x8')](),controller[_0xac1a('0xd')]);router[_0xac1a('0xe')]('/',auth[_0xac1a('0x8')](),controller[_0xac1a('0xf')]);router[_0xac1a('0x10')](_0xac1a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xac1a('0x12')](_0xac1a('0x11'),auth['isAuthenticated'](),controller[_0xac1a('0x13')]);module[_0xac1a('0x14')]=router;
\ No newline at end of file
index d0cdfc7..71eab15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2cb6=['STRING','TEXT','exports'];(function(_0x24d474,_0x5ee0fe){var _0x46dab2=function(_0x216510){while(--_0x216510){_0x24d474['push'](_0x24d474['shift']());}};_0x46dab2(++_0x5ee0fe);}(_0x2cb6,0xe6));var _0x62cb=function(_0x445dd8,_0x58ef88){_0x445dd8=_0x445dd8-0x0;var _0x583930=_0x2cb6[_0x445dd8];return _0x583930;};'use strict';var Sequelize=require('sequelize');module[_0x62cb('0x0')]={'uniqueid':{'type':Sequelize[_0x62cb('0x1')]},'node':{'type':Sequelize[_0x62cb('0x1')]},'application':{'type':Sequelize[_0x62cb('0x1')]},'data':{'type':Sequelize[_0x62cb('0x2')]},'project_name':{'type':Sequelize[_0x62cb('0x1')]},'callerid':{'type':Sequelize[_0x62cb('0x1')]}};
\ No newline at end of file
+var _0xbfa5=['STRING','exports'];(function(_0x512b21,_0x321ed0){var _0x17adf5=function(_0x1f9ad1){while(--_0x1f9ad1){_0x512b21['push'](_0x512b21['shift']());}};_0x17adf5(++_0x321ed0);}(_0xbfa5,0x155));var _0x5bfa=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xbfa5[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0x5bfa('0x0')]={'uniqueid':{'type':Sequelize[_0x5bfa('0x1')]},'node':{'type':Sequelize[_0x5bfa('0x1')]},'application':{'type':Sequelize[_0x5bfa('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5bfa('0x1')]}};
\ No newline at end of file
index 2dd4cd4..42713eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe15=['attributes','fields','length','nolimit','order','sort','where','filter','merge','options','include','rows','show','params','includeAll','create','body','find','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x1be1e2,_0x18ab4f){var _0x3c125d=function(_0x577ba8){while(--_0x577ba8){_0x1be1e2['push'](_0x1be1e2['shift']());}};_0x3c125d(++_0x18ab4f);}(_0xbe15,0xaa));var _0x5be1=function(_0x568358,_0x55bda0){_0x568358=_0x568358-0x0;var _0x2c0bbd=_0xbe15[_0x568358];return _0x2c0bbd;};'use strict';var emlformat=require(_0x5be1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5be1('0x1'));var jsonpatch=require(_0x5be1('0x2'));var rp=require(_0x5be1('0x3'));var moment=require(_0x5be1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5be1('0x5'));var util=require(_0x5be1('0x6'));var path=require(_0x5be1('0x7'));var sox=require(_0x5be1('0x8'));var csv=require(_0x5be1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5be1('0xa'));var _=require(_0x5be1('0xb'));var squel=require('squel');var crypto=require(_0x5be1('0xc'));var jsforce=require(_0x5be1('0xd'));var deskjs=require(_0x5be1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5be1('0xf'));var Papa=require(_0x5be1('0x10'));var Redis=require('ioredis');var authService=require(_0x5be1('0x11'));var qs=require(_0x5be1('0x12'));var as=require(_0x5be1('0x13'));var hardwareService=require(_0x5be1('0x14'));var logger=require(_0x5be1('0x15'))(_0x5be1('0x16'));var utils=require(_0x5be1('0x17'));var config=require(_0x5be1('0x18'));var licenseUtil=require(_0x5be1('0x19'));var db=require(_0x5be1('0x1a'))['db'];function respondWithStatusCode(_0x1d595f,_0xb73a1d){_0xb73a1d=_0xb73a1d||0xcc;return function(_0x515e0f){if(_0x515e0f){return _0x1d595f[_0x5be1('0x1b')](_0xb73a1d);}return _0x1d595f[_0x5be1('0x1c')](_0xb73a1d)[_0x5be1('0x1d')]();};}function respondWithResult(_0x59055a,_0x26921e){_0x26921e=_0x26921e||0xc8;return function(_0x5db6d1){if(_0x5db6d1){return _0x59055a[_0x5be1('0x1c')](_0x26921e)[_0x5be1('0x1e')](_0x5db6d1);}};}function respondWithFilteredResult(_0x39c51f,_0x389b23){return function(_0x272dd6){if(_0x272dd6){var _0x3ee7a1=typeof _0x389b23['offset']===_0x5be1('0x1f')&&typeof _0x389b23[_0x5be1('0x20')]==='undefined';var _0x992b57=_0x272dd6[_0x5be1('0x21')];var _0x53f627=_0x3ee7a1?0x0:_0x389b23[_0x5be1('0x22')];var _0x1076e8=_0x3ee7a1?_0x272dd6[_0x5be1('0x21')]:_0x389b23['offset']+_0x389b23[_0x5be1('0x20')];var _0x26766f;if(_0x1076e8>=_0x992b57){_0x1076e8=_0x992b57;_0x26766f=0xc8;}else{_0x26766f=0xce;}_0x39c51f[_0x5be1('0x1c')](_0x26766f);return _0x39c51f['set'](_0x5be1('0x23'),_0x53f627+'-'+_0x1076e8+'/'+_0x992b57)['json'](_0x272dd6);}return null;};}function patchUpdates(_0x166088){return function(_0x561388){try{jsonpatch[_0x5be1('0x24')](_0x561388,_0x166088,!![]);}catch(_0x49dcd6){return BPromise[_0x5be1('0x25')](_0x49dcd6);}return _0x561388['save']();};}function saveUpdates(_0x44867b,_0x25c030){return function(_0x3662f6){if(_0x3662f6){return _0x3662f6[_0x5be1('0x26')](_0x44867b)[_0x5be1('0x27')](function(_0x3f0d68){return _0x3f0d68;});}return null;};}function removeEntity(_0x1ca4f4,_0x3330f4){return function(_0x462859){if(_0x462859){return _0x462859[_0x5be1('0x28')]()[_0x5be1('0x27')](function(){_0x1ca4f4[_0x5be1('0x1c')](0xcc)[_0x5be1('0x1d')]();});}};}function handleEntityNotFound(_0x4695dd,_0x3ae48e){return function(_0x51f506){if(!_0x51f506){_0x4695dd['sendStatus'](0x194);}return _0x51f506;};}function handleError(_0x14b0a3,_0x1befd2){_0x1befd2=_0x1befd2||0x1f4;return function(_0x5da41a){logger[_0x5be1('0x29')](_0x5da41a[_0x5be1('0x2a')]);if(_0x5da41a[_0x5be1('0x2b')]){delete _0x5da41a['name'];}_0x14b0a3[_0x5be1('0x1c')](_0x1befd2)['send'](_0x5da41a);};}exports[_0x5be1('0x2c')]=function(_0xf37ad7,_0x2c408c){var _0x24ff45={},_0x429ac5={},_0x2c4278={'count':0x0,'rows':[]};var _0x20acd5=_[_0x5be1('0x2d')](db[_0x5be1('0x2e')][_0x5be1('0x2f')],function(_0xd4c43e){return{'name':_0xd4c43e[_0x5be1('0x30')],'type':_0xd4c43e[_0x5be1('0x31')][_0x5be1('0x32')]};});_0x429ac5[_0x5be1('0x33')]=_[_0x5be1('0x2d')](_0x20acd5,_0x5be1('0x2b'));_0x429ac5[_0x5be1('0x34')]=_[_0x5be1('0x35')](_0xf37ad7['query']);_0x429ac5['filters']=_[_0x5be1('0x36')](_0x429ac5[_0x5be1('0x33')],_0x429ac5[_0x5be1('0x34')]);_0x24ff45[_0x5be1('0x37')]=_[_0x5be1('0x36')](_0x429ac5[_0x5be1('0x33')],qs[_0x5be1('0x38')](_0xf37ad7['query'][_0x5be1('0x38')]));_0x24ff45[_0x5be1('0x37')]=_0x24ff45[_0x5be1('0x37')][_0x5be1('0x39')]?_0x24ff45[_0x5be1('0x37')]:_0x429ac5[_0x5be1('0x33')];if(!_0xf37ad7['query']['hasOwnProperty'](_0x5be1('0x3a'))){_0x24ff45[_0x5be1('0x20')]=qs[_0x5be1('0x20')](_0xf37ad7[_0x5be1('0x34')]['limit']);_0x24ff45[_0x5be1('0x22')]=qs[_0x5be1('0x22')](_0xf37ad7['query'][_0x5be1('0x22')]);}_0x24ff45[_0x5be1('0x3b')]=qs[_0x5be1('0x3c')](_0xf37ad7[_0x5be1('0x34')][_0x5be1('0x3c')]);_0x24ff45[_0x5be1('0x3d')]=qs['filters'](_['pick'](_0xf37ad7[_0x5be1('0x34')],_0x429ac5['filters']),_0x20acd5);if(_0xf37ad7[_0x5be1('0x34')][_0x5be1('0x3e')]){_0x24ff45[_0x5be1('0x3d')]=_['merge'](_0x24ff45[_0x5be1('0x3d')],{'$or':_[_0x5be1('0x2d')](_0x20acd5,function(_0x1c2654){if(_0x1c2654[_0x5be1('0x31')]!=='VIRTUAL'){var _0x2d67d7={};_0x2d67d7[_0x1c2654[_0x5be1('0x2b')]]={'$like':'%'+_0xf37ad7[_0x5be1('0x34')][_0x5be1('0x3e')]+'%'};return _0x2d67d7;}})});}_0x24ff45=_[_0x5be1('0x3f')]({},_0x24ff45,_0xf37ad7[_0x5be1('0x40')]);var _0x345b54={'where':_0x24ff45[_0x5be1('0x3d')]};return db['SquareDetailsReport']['count'](_0x345b54)[_0x5be1('0x27')](function(_0x16f1ca){_0x2c4278[_0x5be1('0x21')]=_0x16f1ca;if(_0xf37ad7['query']['includeAll']){_0x24ff45[_0x5be1('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x24ff45);})[_0x5be1('0x27')](function(_0x275241){_0x2c4278[_0x5be1('0x42')]=_0x275241;return _0x2c4278;})['then'](respondWithFilteredResult(_0x2c408c,_0x24ff45))['catch'](handleError(_0x2c408c,null));};exports[_0x5be1('0x43')]=function(_0x190249,_0x418b61){var _0x3ea026={'raw':!![],'where':{'id':_0x190249[_0x5be1('0x44')]['id']}},_0x871091={};_0x871091[_0x5be1('0x33')]=_[_0x5be1('0x35')](db[_0x5be1('0x2e')][_0x5be1('0x2f')]);_0x871091[_0x5be1('0x34')]=_['keys'](_0x190249[_0x5be1('0x34')]);_0x871091['filters']=_[_0x5be1('0x36')](_0x871091[_0x5be1('0x33')],_0x871091['query']);_0x3ea026[_0x5be1('0x37')]=_[_0x5be1('0x36')](_0x871091[_0x5be1('0x33')],qs[_0x5be1('0x38')](_0x190249[_0x5be1('0x34')][_0x5be1('0x38')]));_0x3ea026[_0x5be1('0x37')]=_0x3ea026['attributes']['length']?_0x3ea026[_0x5be1('0x37')]:_0x871091[_0x5be1('0x33')];if(_0x190249['query'][_0x5be1('0x45')]){_0x3ea026[_0x5be1('0x41')]=[{'all':!![]}];}_0x3ea026=_[_0x5be1('0x3f')]({},_0x3ea026,_0x190249[_0x5be1('0x40')]);return db[_0x5be1('0x2e')]['find'](_0x3ea026)[_0x5be1('0x27')](handleEntityNotFound(_0x418b61,null))['then'](respondWithResult(_0x418b61,null))['catch'](handleError(_0x418b61,null));};exports[_0x5be1('0x46')]=function(_0x1a10e7,_0x42f0b6){return db['SquareDetailsReport'][_0x5be1('0x46')](_0x1a10e7['body'],{})[_0x5be1('0x27')](respondWithResult(_0x42f0b6,0xc9))['catch'](handleError(_0x42f0b6,null));};exports[_0x5be1('0x26')]=function(_0x416a3f,_0x4d2b01){if(_0x416a3f[_0x5be1('0x47')]['id']){delete _0x416a3f[_0x5be1('0x47')]['id'];}return db[_0x5be1('0x2e')][_0x5be1('0x48')]({'where':{'id':_0x416a3f[_0x5be1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d2b01,null))['then'](saveUpdates(_0x416a3f[_0x5be1('0x47')],null))['then'](respondWithResult(_0x4d2b01,null))[_0x5be1('0x49')](handleError(_0x4d2b01,null));};exports[_0x5be1('0x28')]=function(_0x245f26,_0x5e64a5){return db[_0x5be1('0x2e')][_0x5be1('0x48')]({'where':{'id':_0x245f26['params']['id']}})['then'](handleEntityNotFound(_0x5e64a5,null))[_0x5be1('0x27')](removeEntity(_0x5e64a5,null))[_0x5be1('0x49')](handleError(_0x5e64a5,null));};exports[_0x5be1('0x4a')]=function(_0x1d9c9f,_0xc6cc06){return db[_0x5be1('0x2e')][_0x5be1('0x4a')]()[_0x5be1('0x27')](respondWithResult(_0xc6cc06,null))[_0x5be1('0x49')](handleError(_0xc6cc06,null));};
\ No newline at end of file
+var _0x7c69=['params','rawAttributes','options','find','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','count','limit','set','json','apply','save','then','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch'];(function(_0x2ad6e0,_0x13bf28){var _0x33f4f3=function(_0x23d377){while(--_0x23d377){_0x2ad6e0['push'](_0x2ad6e0['shift']());}};_0x33f4f3(++_0x13bf28);}(_0x7c69,0x1c5));var _0x97c6=function(_0x95a28c,_0x4ba797){_0x95a28c=_0x95a28c-0x0;var _0x1f7c7b=_0x7c69[_0x95a28c];return _0x1f7c7b;};'use strict';var emlformat=require(_0x97c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97c6('0x1'));var jsonpatch=require(_0x97c6('0x2'));var rp=require('request-promise');var moment=require(_0x97c6('0x3'));var BPromise=require(_0x97c6('0x4'));var Mustache=require(_0x97c6('0x5'));var util=require('util');var path=require(_0x97c6('0x6'));var sox=require(_0x97c6('0x7'));var csv=require(_0x97c6('0x8'));var ejs=require(_0x97c6('0x9'));var fs=require('fs');var fs_extra=require(_0x97c6('0xa'));var _=require(_0x97c6('0xb'));var squel=require(_0x97c6('0xc'));var crypto=require(_0x97c6('0xd'));var jsforce=require(_0x97c6('0xe'));var deskjs=require(_0x97c6('0xf'));var toCsv=require(_0x97c6('0x8'));var querystring=require(_0x97c6('0x10'));var Papa=require(_0x97c6('0x11'));var Redis=require(_0x97c6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x97c6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c6('0x14'));var logger=require(_0x97c6('0x15'))(_0x97c6('0x16'));var utils=require('../../config/utils');var config=require(_0x97c6('0x17'));var licenseUtil=require(_0x97c6('0x18'));var db=require(_0x97c6('0x19'))['db'];function respondWithStatusCode(_0x14d00b,_0x7a28d0){_0x7a28d0=_0x7a28d0||0xcc;return function(_0x2a785f){if(_0x2a785f){return _0x14d00b[_0x97c6('0x1a')](_0x7a28d0);}return _0x14d00b['status'](_0x7a28d0)[_0x97c6('0x1b')]();};}function respondWithResult(_0x1a1f05,_0x3723b){_0x3723b=_0x3723b||0xc8;return function(_0x438bcf){if(_0x438bcf){return _0x1a1f05[_0x97c6('0x1c')](_0x3723b)['json'](_0x438bcf);}};}function respondWithFilteredResult(_0xb8fdcc,_0x133582){return function(_0x2d4735){if(_0x2d4735){var _0xbdaff7=typeof _0x133582[_0x97c6('0x1d')]==='undefined'&&typeof _0x133582['limit']==='undefined';var _0x4319a1=_0x2d4735[_0x97c6('0x1e')];var _0x31e488=_0xbdaff7?0x0:_0x133582[_0x97c6('0x1d')];var _0x5bc509=_0xbdaff7?_0x2d4735['count']:_0x133582['offset']+_0x133582[_0x97c6('0x1f')];var _0x1db212;if(_0x5bc509>=_0x4319a1){_0x5bc509=_0x4319a1;_0x1db212=0xc8;}else{_0x1db212=0xce;}_0xb8fdcc[_0x97c6('0x1c')](_0x1db212);return _0xb8fdcc[_0x97c6('0x20')]('Content-Range',_0x31e488+'-'+_0x5bc509+'/'+_0x4319a1)[_0x97c6('0x21')](_0x2d4735);}return null;};}function patchUpdates(_0x1fe1ad){return function(_0x4ffb2c){try{jsonpatch[_0x97c6('0x22')](_0x4ffb2c,_0x1fe1ad,!![]);}catch(_0x31ff6a){return BPromise['reject'](_0x31ff6a);}return _0x4ffb2c[_0x97c6('0x23')]();};}function saveUpdates(_0x708141,_0x3b4cb4){return function(_0x5e771b){if(_0x5e771b){return _0x5e771b['update'](_0x708141)['then'](function(_0x296fdb){return _0x296fdb;});}return null;};}function removeEntity(_0x35f35b,_0x36cee1){return function(_0x3b4271){if(_0x3b4271){return _0x3b4271['destroy']()[_0x97c6('0x24')](function(){_0x35f35b[_0x97c6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac7a9,_0x43fc69){return function(_0x2c3c1a){if(!_0x2c3c1a){_0x2ac7a9[_0x97c6('0x1a')](0x194);}return _0x2c3c1a;};}function handleError(_0x15a2cf,_0x52e252){_0x52e252=_0x52e252||0x1f4;return function(_0x31a29c){logger['error'](_0x31a29c[_0x97c6('0x25')]);if(_0x31a29c[_0x97c6('0x26')]){delete _0x31a29c[_0x97c6('0x26')];}_0x15a2cf[_0x97c6('0x1c')](_0x52e252)[_0x97c6('0x27')](_0x31a29c);};}exports[_0x97c6('0x28')]=function(_0x39a7b3,_0x2af420){var _0x2d5b34={},_0x50f534={},_0x48827d={'count':0x0,'rows':[]};var _0x920a7c=_[_0x97c6('0x29')](db[_0x97c6('0x2a')]['rawAttributes'],function(_0x3fbce1){return{'name':_0x3fbce1[_0x97c6('0x2b')],'type':_0x3fbce1[_0x97c6('0x2c')][_0x97c6('0x2d')]};});_0x50f534[_0x97c6('0x2e')]=_[_0x97c6('0x29')](_0x920a7c,_0x97c6('0x26'));_0x50f534[_0x97c6('0x2f')]=_[_0x97c6('0x30')](_0x39a7b3[_0x97c6('0x2f')]);_0x50f534[_0x97c6('0x31')]=_[_0x97c6('0x32')](_0x50f534[_0x97c6('0x2e')],_0x50f534['query']);_0x2d5b34['attributes']=_['intersection'](_0x50f534['model'],qs['fields'](_0x39a7b3['query'][_0x97c6('0x33')]));_0x2d5b34[_0x97c6('0x34')]=_0x2d5b34['attributes'][_0x97c6('0x35')]?_0x2d5b34[_0x97c6('0x34')]:_0x50f534[_0x97c6('0x2e')];if(!_0x39a7b3['query']['hasOwnProperty'](_0x97c6('0x36'))){_0x2d5b34[_0x97c6('0x1f')]=qs['limit'](_0x39a7b3[_0x97c6('0x2f')][_0x97c6('0x1f')]);_0x2d5b34['offset']=qs[_0x97c6('0x1d')](_0x39a7b3[_0x97c6('0x2f')]['offset']);}_0x2d5b34[_0x97c6('0x37')]=qs[_0x97c6('0x38')](_0x39a7b3[_0x97c6('0x2f')][_0x97c6('0x38')]);_0x2d5b34[_0x97c6('0x39')]=qs[_0x97c6('0x31')](_[_0x97c6('0x3a')](_0x39a7b3[_0x97c6('0x2f')],_0x50f534[_0x97c6('0x31')]),_0x920a7c);if(_0x39a7b3['query'][_0x97c6('0x3b')]){_0x2d5b34[_0x97c6('0x39')]=_['merge'](_0x2d5b34[_0x97c6('0x39')],{'$or':_['map'](_0x920a7c,function(_0x1bb21c){if(_0x1bb21c[_0x97c6('0x2c')]!==_0x97c6('0x3c')){var _0x4c588b={};_0x4c588b[_0x1bb21c[_0x97c6('0x26')]]={'$like':'%'+_0x39a7b3[_0x97c6('0x2f')][_0x97c6('0x3b')]+'%'};return _0x4c588b;}})});}_0x2d5b34=_[_0x97c6('0x3d')]({},_0x2d5b34,_0x39a7b3['options']);var _0x5bfad3={'where':_0x2d5b34['where']};return db[_0x97c6('0x2a')][_0x97c6('0x1e')](_0x5bfad3)[_0x97c6('0x24')](function(_0x2ff128){_0x48827d[_0x97c6('0x1e')]=_0x2ff128;if(_0x39a7b3[_0x97c6('0x2f')][_0x97c6('0x3e')]){_0x2d5b34['include']=[{'all':!![]}];}return db[_0x97c6('0x2a')]['findAll'](_0x2d5b34);})['then'](function(_0x54d9fc){_0x48827d[_0x97c6('0x3f')]=_0x54d9fc;return _0x48827d;})[_0x97c6('0x24')](respondWithFilteredResult(_0x2af420,_0x2d5b34))[_0x97c6('0x40')](handleError(_0x2af420,null));};exports['show']=function(_0x38a81a,_0x3793af){var _0x164915={'raw':!![],'where':{'id':_0x38a81a[_0x97c6('0x41')]['id']}},_0xc51835={};_0xc51835[_0x97c6('0x2e')]=_[_0x97c6('0x30')](db[_0x97c6('0x2a')][_0x97c6('0x42')]);_0xc51835[_0x97c6('0x2f')]=_['keys'](_0x38a81a['query']);_0xc51835[_0x97c6('0x31')]=_['intersection'](_0xc51835[_0x97c6('0x2e')],_0xc51835[_0x97c6('0x2f')]);_0x164915['attributes']=_['intersection'](_0xc51835[_0x97c6('0x2e')],qs[_0x97c6('0x33')](_0x38a81a[_0x97c6('0x2f')][_0x97c6('0x33')]));_0x164915['attributes']=_0x164915[_0x97c6('0x34')]['length']?_0x164915[_0x97c6('0x34')]:_0xc51835[_0x97c6('0x2e')];if(_0x38a81a[_0x97c6('0x2f')][_0x97c6('0x3e')]){_0x164915['include']=[{'all':!![]}];}_0x164915=_[_0x97c6('0x3d')]({},_0x164915,_0x38a81a[_0x97c6('0x43')]);return db[_0x97c6('0x2a')][_0x97c6('0x44')](_0x164915)[_0x97c6('0x24')](handleEntityNotFound(_0x3793af,null))[_0x97c6('0x24')](respondWithResult(_0x3793af,null))[_0x97c6('0x40')](handleError(_0x3793af,null));};exports['create']=function(_0x24af84,_0x3db6ac){return db[_0x97c6('0x2a')][_0x97c6('0x45')](_0x24af84['body'],{})[_0x97c6('0x24')](respondWithResult(_0x3db6ac,0xc9))[_0x97c6('0x40')](handleError(_0x3db6ac,null));};exports[_0x97c6('0x46')]=function(_0x1fa34e,_0x3451d0){if(_0x1fa34e[_0x97c6('0x47')]['id']){delete _0x1fa34e[_0x97c6('0x47')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x1fa34e[_0x97c6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3451d0,null))[_0x97c6('0x24')](saveUpdates(_0x1fa34e[_0x97c6('0x47')],null))[_0x97c6('0x24')](respondWithResult(_0x3451d0,null))[_0x97c6('0x40')](handleError(_0x3451d0,null));};exports[_0x97c6('0x48')]=function(_0x11d422,_0x3b425c){return db[_0x97c6('0x2a')][_0x97c6('0x44')]({'where':{'id':_0x11d422['params']['id']}})[_0x97c6('0x24')](handleEntityNotFound(_0x3b425c,null))[_0x97c6('0x24')](removeEntity(_0x3b425c,null))[_0x97c6('0x40')](handleError(_0x3b425c,null));};exports[_0x97c6('0x49')]=function(_0x134455,_0x5e94a6){return db[_0x97c6('0x2a')]['describe']()[_0x97c6('0x24')](respondWithResult(_0x5e94a6,null))['catch'](handleError(_0x5e94a6,null));};
\ No newline at end of file
index 8bd7743..6c8ae03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0caf=['exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','./squareReportDetail.attributes'];(function(_0x59de4f,_0x43e02a){var _0x32fc14=function(_0x39464d){while(--_0x39464d){_0x59de4f['push'](_0x59de4f['shift']());}};_0x32fc14(++_0x43e02a);}(_0x0caf,0x159));var _0xf0ca=function(_0x5e681d,_0x182b4b){_0x5e681d=_0x5e681d-0x0;var _0x32f634=_0x0caf[_0x5e681d];return _0x32f634;};'use strict';var _=require(_0xf0ca('0x0'));var util=require('util');var logger=require(_0xf0ca('0x1'))(_0xf0ca('0x2'));var moment=require(_0xf0ca('0x3'));var BPromise=require(_0xf0ca('0x4'));var rp=require(_0xf0ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0ca('0x6'));module[_0xf0ca('0x7')]=function(_0x247fb5,_0x4b9f7f){return _0x247fb5[_0xf0ca('0x8')](_0xf0ca('0x9'),attributes,{'tableName':_0xf0ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x861a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','lodash','util'];(function(_0x46ea07,_0x481a6c){var _0x1d7ecf=function(_0x4e2cf2){while(--_0x4e2cf2){_0x46ea07['push'](_0x46ea07['shift']());}};_0x1d7ecf(++_0x481a6c);}(_0x861a,0xda));var _0xa861=function(_0x2ea176,_0x2eb2e9){_0x2ea176=_0x2ea176-0x0;var _0x5ee67c=_0x861a[_0x2ea176];return _0x5ee67c;};'use strict';var _=require(_0xa861('0x0'));var util=require(_0xa861('0x1'));var logger=require(_0xa861('0x2'))(_0xa861('0x3'));var moment=require(_0xa861('0x4'));var BPromise=require(_0xa861('0x5'));var rp=require(_0xa861('0x6'));var fs=require('fs');var path=require(_0xa861('0x7'));var rimraf=require(_0xa861('0x8'));var config=require('../../config/environment');var attributes=require(_0xa861('0x9'));module['exports']=function(_0x7c51ad,_0xd44d0e){return _0x7c51ad['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0d7120c..e366dd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef0f=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xef0f,0x168));var _0xfef0=function(_0x4d7764,_0x6b033c){_0x4d7764=_0x4d7764-0x0;var _0x133542=_0xef0f[_0x4d7764];return _0x133542;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![]})[_0xfef0('0xc')](function(_0x28dee1){logger['info'](_0xfef0('0x18'),_0x581459);logger['debug'](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x28dee1));_0x1642cd(_0x28dee1);})['catch'](function(_0x4897af){logger['error'](_0xfef0('0x18'),_0x4897af['message'],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x4897af[_0xfef0('0x15')]));});});};
\ No newline at end of file
+var _0x693f=['code','message','info','SquareDetailsReport,\x20%s,\x20%s','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','error'];(function(_0x38abf8,_0x3a5e9d){var _0x3828cc=function(_0x261db3){while(--_0x261db3){_0x38abf8['push'](_0x38abf8['shift']());}};_0x3828cc(++_0x3a5e9d);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33305c,_0x5b91c5,_0x22f362){return new BPromise(function(_0x594505,_0x38e78a){return client['request'](_0x33305c,_0x22f362)[_0xf693('0xc')](function(_0x17075d){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,'request\x20sent');logger[_0xf693('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5b91c5,_0xf693('0xe'),JSON[_0xf693('0xf')](_0x17075d));if(_0x17075d[_0xf693('0x10')]){if(_0x17075d[_0xf693('0x10')][_0xf693('0x11')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);return _0x38e78a(_0x17075d['error'][_0xf693('0x12')]);}logger[_0xf693('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d['error'][_0xf693('0x12')]);return _0x594505(_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);}else{logger[_0xf693('0x13')](_0xf693('0x14'),_0x5b91c5,'request\x20sent');_0x594505(_0x17075d[_0xf693('0x15')][_0xf693('0x12')]);}})[_0xf693('0x16')](function(_0x2a5e1b){logger[_0xf693('0x10')](_0xf693('0x14'),_0x5b91c5,_0x2a5e1b);_0x38e78a(_0x2a5e1b);});});}exports['CreateSquareDetailsReport']=function(_0x5e02e0){var _0x4a5964=this;return new Promise(function(_0x2474d4,_0xf4d20e){return db[_0xf693('0x17')][_0xf693('0x18')](_0x5e02e0[_0xf693('0x19')],{'raw':_0x5e02e0['options']?_0x5e02e0[_0xf693('0x1a')][_0xf693('0x1b')]===undefined?!![]:![]:!![]})[_0xf693('0xc')](function(_0x31b887){logger[_0xf693('0x13')](_0xf693('0x1c'),_0x5e02e0);logger[_0xf693('0xd')](_0xf693('0x1c'),_0x5e02e0,JSON['stringify'](_0x31b887));_0x2474d4(_0x31b887);})[_0xf693('0x16')](function(_0x1188c6){logger[_0xf693('0x10')](_0xf693('0x1c'),_0x1188c6[_0xf693('0x12')],_0x5e02e0);_0xf4d20e(_0x4a5964[_0xf693('0x10')](0x1f4,_0x1188c6[_0xf693('0x12')]));});});};
\ No newline at end of file
index 1c604f0..faf70d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x405f=['express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill'];(function(_0x533c04,_0x6bb2da){var _0x2d3098=function(_0x33cd97){while(--_0x33cd97){_0x533c04['push'](_0x533c04['shift']());}};_0x2d3098(++_0x6bb2da);}(_0x405f,0x1f1));var _0xf405=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x405f[_0x5834bc];return _0x3e183a;};'use strict';var express=require(_0xf405('0x0'));var router=express[_0xf405('0x1')]();var auth=require(_0xf405('0x2'));var controller=require(_0xf405('0x3'));router['get']('/',auth[_0xf405('0x4')](),controller[_0xf405('0x5')]);router['get'](_0xf405('0x6'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router;
\ No newline at end of file
+var _0x4301=['/process/:pid/kill','exports','express','./system.controller','isAuthenticated','get'];(function(_0x4e9de1,_0x189225){var _0x59fe48=function(_0x346f4a){while(--_0x346f4a){_0x4e9de1['push'](_0x4e9de1['shift']());}};_0x59fe48(++_0x189225);}(_0x4301,0x68));var _0x1430=function(_0x218296,_0x31976b){_0x218296=_0x218296-0x0;var _0x2c147c=_0x4301[_0x218296];return _0x2c147c;};'use strict';var express=require(_0x1430('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x1430('0x1'));router['get']('/',auth[_0x1430('0x2')](),controller['index']);router[_0x1430('0x3')](_0x1430('0x4'),auth[_0x1430('0x2')](),controller['killProcess']);module[_0x1430('0x5')]=router;
\ No newline at end of file
index 3f05e8c..4a2a683 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5678=['killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','getAllData','json','catch'];(function(_0x355f33,_0xa51db9){var _0x3221bf=function(_0x57e27c){while(--_0x57e27c){_0x355f33['push'](_0x355f33['shift']());}};_0x3221bf(++_0xa51db9);}(_0x5678,0x1b5));var _0x8567=function(_0x3306d7,_0x399a95){_0x3306d7=_0x3306d7-0x0;var _0x177aa7=_0x5678[_0x3306d7];return _0x177aa7;};'use strict';var info=require(_0x8567('0x0'));var exec=require(_0x8567('0x1'))[_0x8567('0x2')];var logger=require(_0x8567('0x3'))(_0x8567('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x8567('0x5'));function handleError(_0x2def05,_0x148c45,_0x43f54a){_0x148c45=_0x148c45||0x1f4;return function(_0x1e0bbd){logger['error'](_0x8567('0x6'),_0x43f54a,_0x148c45,util['inspect'](_0x1e0bbd,{'showHidden':![],'depth':null}));delete _0x1e0bbd[_0x8567('0x7')];_0x2def05[_0x8567('0x8')](_0x148c45)['send'](_0x1e0bbd);};}exports[_0x8567('0x9')]=function(_0x32f773,_0x50ba01){return info[_0x8567('0xa')]()['then'](function(_0x56c6b5){return _0x50ba01[_0x8567('0x8')](0xc8)[_0x8567('0xb')](_0x56c6b5);})[_0x8567('0xc')](function(_0x5141a0){return _0x50ba01['status'](0x1f4)[_0x8567('0xb')](_0x5141a0);});};exports[_0x8567('0xd')]=function(_0x4f651a,_0x56570d){var _0x5df62c=[_0x8567('0xe')];return new BPromise(function(_0x94797f,_0x44fffd){return exec(util['format'](_0x8567('0xf'),_0x4f651a[_0x8567('0x10')][_0x8567('0x11')]),function(_0x12c466,_0x29c2d0,_0x505220){if(_0x12c466){return _0x44fffd(_0x12c466);}return _0x94797f(_0x29c2d0);});})[_0x8567('0x12')](function(_0x2a7fcf){var _0x39f89e=![];var _0x342bcc=_0x2a7fcf['split'](/\n/);for(var _0x2c27e9=0x0,_0x45bfc3=_0x5df62c[_0x8567('0x13')];_0x2c27e9<_0x45bfc3,_0x39f89e===![];_0x2c27e9+=0x1){if(_0x2a7fcf[_0x8567('0x14')](_0x5df62c[_0x2c27e9])>=0x0){_0x39f89e=!![];}}if(!_0x39f89e){throw new Error(util[_0x8567('0x15')](_0x8567('0x16'),_0x4f651a[_0x8567('0x10')]['pid']));}process['kill'](_0x4f651a['params']['pid'],_0x8567('0x17'));return _0x56570d[_0x8567('0x8')](0xc8)[_0x8567('0xb')]({'message':util[_0x8567('0x15')](_0x8567('0x18'),_0x4f651a[_0x8567('0x10')][_0x8567('0x11')])});})['catch'](handleError(_0x56570d,null,_0x8567('0xd')));};
\ No newline at end of file
+var _0x7aa1=['../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','SIGINT','systeminformation','child_process'];(function(_0x16e2e6,_0x17f35f){var _0x34cea1=function(_0x31b6e5){while(--_0x31b6e5){_0x16e2e6['push'](_0x16e2e6['shift']());}};_0x34cea1(++_0x17f35f);}(_0x7aa1,0x184));var _0x17aa=function(_0x1bbbd9,_0x3e598a){_0x1bbbd9=_0x1bbbd9-0x0;var _0x54952e=_0x7aa1[_0x1bbbd9];return _0x54952e;};'use strict';var info=require(_0x17aa('0x0'));var exec=require(_0x17aa('0x1'))['exec'];var logger=require(_0x17aa('0x2'))('api');var util=require(_0x17aa('0x3'));var BPromise=require(_0x17aa('0x4'));var _=require(_0x17aa('0x5'));function handleError(_0x4125aa,_0x343f21,_0x4cf5dc){_0x343f21=_0x343f21||0x1f4;return function(_0x184da8){logger['error'](_0x17aa('0x6'),_0x4cf5dc,_0x343f21,util[_0x17aa('0x7')](_0x184da8,{'showHidden':![],'depth':null}));delete _0x184da8[_0x17aa('0x8')];_0x4125aa[_0x17aa('0x9')](_0x343f21)['send'](_0x184da8);};}exports[_0x17aa('0xa')]=function(_0x18af4a,_0x22785d){return info[_0x17aa('0xb')]()[_0x17aa('0xc')](function(_0x1cffc4){return _0x22785d[_0x17aa('0x9')](0xc8)[_0x17aa('0xd')](_0x1cffc4);})[_0x17aa('0xe')](function(_0x43bfbf){return _0x22785d['status'](0x1f4)[_0x17aa('0xd')](_0x43bfbf);});};exports[_0x17aa('0xf')]=function(_0x69eded,_0x35467f){var _0x2ab818=[_0x17aa('0x10')];return new BPromise(function(_0x5d76cb,_0x1e185a){return exec(util[_0x17aa('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x69eded['params']['pid']),function(_0x5834ef,_0x12d02c,_0x11e4e8){if(_0x5834ef){return _0x1e185a(_0x5834ef);}return _0x5d76cb(_0x12d02c);});})[_0x17aa('0xc')](function(_0x4c241c){var _0x539758=![];var _0x353029=_0x4c241c[_0x17aa('0x12')](/\n/);for(var _0x17e7f9=0x0,_0x36bc2d=_0x2ab818[_0x17aa('0x13')];_0x17e7f9<_0x36bc2d,_0x539758===![];_0x17e7f9+=0x1){if(_0x4c241c[_0x17aa('0x14')](_0x2ab818[_0x17e7f9])>=0x0){_0x539758=!![];}}if(!_0x539758){throw new Error(util['format'](_0x17aa('0x15'),_0x69eded[_0x17aa('0x16')][_0x17aa('0x17')]));}process[_0x17aa('0x18')](_0x69eded['params'][_0x17aa('0x17')],_0x17aa('0x19'));return _0x35467f[_0x17aa('0x9')](0xc8)[_0x17aa('0xd')]({'message':util[_0x17aa('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x69eded[_0x17aa('0x16')]['pid'])});})['catch'](handleError(_0x35467f,null,'killProcess'));};
\ No newline at end of file
index 872a3d9..780190b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f25=['Router','fs-extra','../../components/auth/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','multer','util','path','connect-timeout','express'];(function(_0x4a9666,_0x3e6c86){var _0x322fa8=function(_0x4d4833){while(--_0x4d4833){_0x4a9666['push'](_0x4a9666['shift']());}};_0x322fa8(++_0x3e6c86);}(_0x2f25,0x15b));var _0x52f2=function(_0x5a8d6c,_0x3c0ea0){_0x5a8d6c=_0x5a8d6c-0x0;var _0x13b85c=_0x2f25[_0x5a8d6c];return _0x13b85c;};'use strict';var multer=require(_0x52f2('0x0'));var util=require(_0x52f2('0x1'));var path=require(_0x52f2('0x2'));var timeout=require(_0x52f2('0x3'));var express=require(_0x52f2('0x4'));var router=express[_0x52f2('0x5')]();var fs_extra=require(_0x52f2('0x6'));var auth=require(_0x52f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x52f2('0x8'));router[_0x52f2('0x9')]('/',auth[_0x52f2('0xa')](),controller[_0x52f2('0xb')]);router['get'](_0x52f2('0xc'),auth[_0x52f2('0xa')](),controller[_0x52f2('0xd')]);router[_0x52f2('0xe')]('/',auth[_0x52f2('0xa')](),controller[_0x52f2('0xf')]);router['put'](_0x52f2('0xc'),auth[_0x52f2('0xa')](),controller['update']);router['delete'](_0x52f2('0xc'),auth[_0x52f2('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xb8a0=['connect-timeout','Router','./tag.controller','get','isAuthenticated','/:id','show','create','update','util','path'];(function(_0x8ae2ec,_0x217b67){var _0x21b154=function(_0x2a5992){while(--_0x2a5992){_0x8ae2ec['push'](_0x8ae2ec['shift']());}};_0x21b154(++_0x217b67);}(_0xb8a0,0x111));var _0x0b8a=function(_0x5a6fc8,_0x31162d){_0x5a6fc8=_0x5a6fc8-0x0;var _0x1b001b=_0xb8a0[_0x5a6fc8];return _0x1b001b;};'use strict';var multer=require('multer');var util=require(_0x0b8a('0x0'));var path=require(_0x0b8a('0x1'));var timeout=require(_0x0b8a('0x2'));var express=require('express');var router=express[_0x0b8a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0b8a('0x4'));router[_0x0b8a('0x5')]('/',auth[_0x0b8a('0x6')](),controller['index']);router[_0x0b8a('0x5')](_0x0b8a('0x7'),auth[_0x0b8a('0x6')](),controller[_0x0b8a('0x8')]);router['post']('/',auth[_0x0b8a('0x6')](),controller[_0x0b8a('0x9')]);router['put'](_0x0b8a('0x7'),auth[_0x0b8a('0x6')](),controller[_0x0b8a('0xa')]);router['delete'](_0x0b8a('0x7'),auth[_0x0b8a('0x6')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 192a574..4c2495b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3264=['name','exports','STRING'];(function(_0x1352f0,_0x4cd565){var _0x1c2a82=function(_0x2a9b63){while(--_0x2a9b63){_0x1352f0['push'](_0x1352f0['shift']());}};_0x1c2a82(++_0x4cd565);}(_0x3264,0x7f));var _0x4326=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3264[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'name':{'type':Sequelize[_0x4326('0x1')],'unique':_0x4326('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4326('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xbfcc=['#0091EA','sequelize','name','STRING'];(function(_0x55d47b,_0x746ef4){var _0x7aa983=function(_0x4a2888){while(--_0x4a2888){_0x55d47b['push'](_0x55d47b['shift']());}};_0x7aa983(++_0x746ef4);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xbfcc[_0xd2d54];return _0x78b113;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcbfc('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcbfc('0x2')],'defaultValue':_0xcbfc('0x3')},'description':{'type':Sequelize[_0xcbfc('0x2')]}};
\ No newline at end of file
index 130e84f..704ffb9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14d=['status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2fccfd,_0x3fd136){var _0x278ea6=function(_0x1eadc3){while(--_0x1eadc3){_0x2fccfd['push'](_0x2fccfd['shift']());}};_0x278ea6(++_0x3fd136);}(_0xe14d,0x1ee));var _0xde14=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xe14d[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];function respondWithStatusCode(_0x34e28f,_0x29e3ca){_0x29e3ca=_0x29e3ca||0xcc;return function(_0x105f96){if(_0x105f96){return _0x34e28f[_0xde14('0x1b')](_0x29e3ca);}return _0x34e28f[_0xde14('0x1c')](_0x29e3ca)[_0xde14('0x1d')]();};}function respondWithResult(_0x1489e9,_0x54c58b){_0x54c58b=_0x54c58b||0xc8;return function(_0x584959){if(_0x584959){return _0x1489e9[_0xde14('0x1c')](_0x54c58b)[_0xde14('0x1e')](_0x584959);}};}function respondWithFilteredResult(_0x26c1ec,_0x4c86ff){return function(_0x16aa55){if(_0x16aa55){var _0x31adb3=typeof _0x4c86ff[_0xde14('0x1f')]===_0xde14('0x20')&&typeof _0x4c86ff[_0xde14('0x21')]===_0xde14('0x20');var _0x29e243=_0x16aa55[_0xde14('0x22')];var _0x3cc317=_0x31adb3?0x0:_0x4c86ff[_0xde14('0x1f')];var _0x590a8b=_0x31adb3?_0x16aa55[_0xde14('0x22')]:_0x4c86ff[_0xde14('0x1f')]+_0x4c86ff[_0xde14('0x21')];var _0x44ce4c;if(_0x590a8b>=_0x29e243){_0x590a8b=_0x29e243;_0x44ce4c=0xc8;}else{_0x44ce4c=0xce;}_0x26c1ec['status'](_0x44ce4c);return _0x26c1ec[_0xde14('0x23')]('Content-Range',_0x3cc317+'-'+_0x590a8b+'/'+_0x29e243)[_0xde14('0x1e')](_0x16aa55);}return null;};}function patchUpdates(_0x4c24a8){return function(_0xa50687){try{jsonpatch[_0xde14('0x24')](_0xa50687,_0x4c24a8,!![]);}catch(_0x51ee8d){return BPromise[_0xde14('0x25')](_0x51ee8d);}return _0xa50687[_0xde14('0x26')]();};}function saveUpdates(_0x11a4d9,_0x40b648){return function(_0x2dd9e7){if(_0x2dd9e7){return _0x2dd9e7[_0xde14('0x27')](_0x11a4d9)[_0xde14('0x28')](function(_0x475f2f){return _0x475f2f;});}return null;};}function removeEntity(_0xbaa078,_0x8f8033){return function(_0x5ae4c1){if(_0x5ae4c1){return _0x5ae4c1[_0xde14('0x29')]()[_0xde14('0x28')](function(){var _0x24a390=_0x5ae4c1[_0xde14('0x2a')]({'plain':!![]});var _0x1bb7be=_0xde14('0x2b');return db[_0xde14('0x2c')][_0xde14('0x29')]({'where':{'type':_0x1bb7be,'resourceId':_0x24a390['id']}})[_0xde14('0x28')](function(){return _0x5ae4c1;});})[_0xde14('0x28')](function(){_0xbaa078['status'](0xcc)[_0xde14('0x1d')]();});}};}function handleEntityNotFound(_0x1696ee,_0x3eaee5){return function(_0xf8279a){if(!_0xf8279a){_0x1696ee['sendStatus'](0x194);}return _0xf8279a;};}function handleError(_0x3fc2a4,_0x2c9822){_0x2c9822=_0x2c9822||0x1f4;return function(_0x30c4a8){logger['error'](_0x30c4a8[_0xde14('0x2d')]);if(_0x30c4a8['name']){delete _0x30c4a8[_0xde14('0x2e')];}_0x3fc2a4[_0xde14('0x1c')](_0x2c9822)[_0xde14('0x2f')](_0x30c4a8);};}exports[_0xde14('0x30')]=function(_0x2aca96,_0x237d3f){var _0xae9dca={},_0x464666={},_0x4e7c5b={'count':0x0,'rows':[]};var _0xbfc01b=_[_0xde14('0x31')](db['Tag'][_0xde14('0x32')],function(_0x4c9b15){return{'name':_0x4c9b15[_0xde14('0x33')],'type':_0x4c9b15[_0xde14('0x34')][_0xde14('0x35')]};});_0x464666[_0xde14('0x36')]=_[_0xde14('0x31')](_0xbfc01b,'name');_0x464666[_0xde14('0x37')]=_[_0xde14('0x38')](_0x2aca96['query']);_0x464666[_0xde14('0x39')]=_[_0xde14('0x3a')](_0x464666[_0xde14('0x36')],_0x464666[_0xde14('0x37')]);_0xae9dca[_0xde14('0x3b')]=_[_0xde14('0x3a')](_0x464666[_0xde14('0x36')],qs[_0xde14('0x3c')](_0x2aca96[_0xde14('0x37')]['fields']));_0xae9dca['attributes']=_0xae9dca[_0xde14('0x3b')][_0xde14('0x3d')]?_0xae9dca[_0xde14('0x3b')]:_0x464666[_0xde14('0x36')];if(!_0x2aca96[_0xde14('0x37')][_0xde14('0x3e')](_0xde14('0x3f'))){_0xae9dca[_0xde14('0x21')]=qs[_0xde14('0x21')](_0x2aca96['query'][_0xde14('0x21')]);_0xae9dca['offset']=qs['offset'](_0x2aca96['query'][_0xde14('0x1f')]);}_0xae9dca[_0xde14('0x40')]=qs[_0xde14('0x41')](_0x2aca96[_0xde14('0x37')][_0xde14('0x41')]);_0xae9dca[_0xde14('0x42')]=qs[_0xde14('0x39')](_[_0xde14('0x43')](_0x2aca96['query'],_0x464666[_0xde14('0x39')]),_0xbfc01b);if(_0x2aca96[_0xde14('0x37')][_0xde14('0x44')]){_0xae9dca[_0xde14('0x42')]=_[_0xde14('0x45')](_0xae9dca[_0xde14('0x42')],{'$or':_[_0xde14('0x31')](_0xbfc01b,function(_0xf6443e){if(_0xf6443e['type']!==_0xde14('0x46')){var _0xb6b2ee={};_0xb6b2ee[_0xf6443e[_0xde14('0x2e')]]={'$like':'%'+_0x2aca96[_0xde14('0x37')]['filter']+'%'};return _0xb6b2ee;}})});}_0xae9dca=_['merge']({},_0xae9dca,_0x2aca96[_0xde14('0x47')]);var _0x16e7d1={'where':_0xae9dca[_0xde14('0x42')]};return db[_0xde14('0x48')][_0xde14('0x22')](_0x16e7d1)['then'](function(_0x24b02c){_0x4e7c5b[_0xde14('0x22')]=_0x24b02c;if(_0x2aca96[_0xde14('0x37')]['includeAll']){_0xae9dca[_0xde14('0x49')]=[{'all':!![]}];}return db['Tag'][_0xde14('0x4a')](_0xae9dca);})['then'](function(_0x102770){_0x4e7c5b[_0xde14('0x4b')]=_0x102770;return _0x4e7c5b;})[_0xde14('0x28')](respondWithFilteredResult(_0x237d3f,_0xae9dca))[_0xde14('0x4c')](handleError(_0x237d3f,null));};exports[_0xde14('0x4d')]=function(_0x22f75a,_0x253bc8){var _0xbc951e={'raw':!![],'where':{'id':_0x22f75a[_0xde14('0x4e')]['id']}},_0x5b18b0={};_0x5b18b0['model']=_[_0xde14('0x38')](db['Tag'][_0xde14('0x32')]);_0x5b18b0[_0xde14('0x37')]=_[_0xde14('0x38')](_0x22f75a[_0xde14('0x37')]);_0x5b18b0[_0xde14('0x39')]=_[_0xde14('0x3a')](_0x5b18b0[_0xde14('0x36')],_0x5b18b0[_0xde14('0x37')]);_0xbc951e['attributes']=_[_0xde14('0x3a')](_0x5b18b0[_0xde14('0x36')],qs[_0xde14('0x3c')](_0x22f75a[_0xde14('0x37')]['fields']));_0xbc951e[_0xde14('0x3b')]=_0xbc951e[_0xde14('0x3b')][_0xde14('0x3d')]?_0xbc951e[_0xde14('0x3b')]:_0x5b18b0[_0xde14('0x36')];if(_0x22f75a[_0xde14('0x37')]['includeAll']){_0xbc951e[_0xde14('0x49')]=[{'all':!![]}];}_0xbc951e=_['merge']({},_0xbc951e,_0x22f75a[_0xde14('0x47')]);return db[_0xde14('0x48')]['find'](_0xbc951e)[_0xde14('0x28')](handleEntityNotFound(_0x253bc8,null))[_0xde14('0x28')](respondWithResult(_0x253bc8,null))[_0xde14('0x4c')](handleError(_0x253bc8,null));};exports[_0xde14('0x4f')]=function(_0x2d05c7,_0x1c87e1){return db[_0xde14('0x48')]['create'](_0x2d05c7[_0xde14('0x50')],{})['then'](function(_0xfa80c8){var _0x6aa9ab=_0x2d05c7[_0xde14('0x51')][_0xde14('0x2a')]({'plain':!![]});if(!_0x6aa9ab)throw new Error(_0xde14('0x52'));if(_0x6aa9ab[_0xde14('0x53')]===_0xde14('0x51')){var _0x1f7316=_0xfa80c8[_0xde14('0x2a')]({'plain':!![]});var _0x14bf78='Tags';return db[_0xde14('0x54')][_0xde14('0x55')]({'where':{'name':_0x14bf78,'userProfileId':_0x6aa9ab[_0xde14('0x56')]},'raw':!![]})[_0xde14('0x28')](function(_0x14b781){if(_0x14b781&&_0x14b781['autoAssociation']===0x0){return db[_0xde14('0x2c')]['create']({'name':_0x1f7316[_0xde14('0x2e')],'resourceId':_0x1f7316['id'],'type':_0x14b781[_0xde14('0x2e')],'sectionId':_0x14b781['id']},{})[_0xde14('0x28')](function(){return _0xfa80c8;});}else{return _0xfa80c8;}})[_0xde14('0x4c')](function(_0x30d230){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30d230);throw _0x30d230;});}return _0xfa80c8;})[_0xde14('0x28')](respondWithResult(_0x1c87e1,0xc9))['catch'](handleError(_0x1c87e1,null));};exports[_0xde14('0x27')]=function(_0x31111d,_0x15e2fb){if(_0x31111d[_0xde14('0x50')]['id']){delete _0x31111d[_0xde14('0x50')]['id'];}return db[_0xde14('0x48')][_0xde14('0x55')]({'where':{'id':_0x31111d[_0xde14('0x4e')]['id']}})[_0xde14('0x28')](handleEntityNotFound(_0x15e2fb,null))['then'](saveUpdates(_0x31111d[_0xde14('0x50')],null))[_0xde14('0x28')](respondWithResult(_0x15e2fb,null))[_0xde14('0x4c')](handleError(_0x15e2fb,null));};exports[_0xde14('0x29')]=function(_0x249ccc,_0x5965e1){return db[_0xde14('0x48')]['find']({'where':{'id':_0x249ccc[_0xde14('0x4e')]['id']}})[_0xde14('0x28')](handleEntityNotFound(_0x5965e1,null))[_0xde14('0x28')](removeEntity(_0x5965e1,null))[_0xde14('0x4c')](handleError(_0x5965e1,null));};
\ No newline at end of file
+var _0x984b=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','reject','update','then','destroy','get','Tags','UserProfileResource','error','name','send','map','Tag','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find'];(function(_0x54655b,_0x2dcd1d){var _0x44e2d7=function(_0x7bd9d){while(--_0x7bd9d){_0x54655b['push'](_0x54655b['shift']());}};_0x44e2d7(++_0x2dcd1d);}(_0x984b,0xee));var _0xb984=function(_0xcd2a90,_0x2dd38b){_0xcd2a90=_0xcd2a90-0x0;var _0x5a4f64=_0x984b[_0xcd2a90];return _0x5a4f64;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb984('0x0'));var rp=require(_0xb984('0x1'));var moment=require(_0xb984('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb984('0x3'));var path=require(_0xb984('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb984('0x5'));var fs=require('fs');var fs_extra=require(_0xb984('0x6'));var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var as=require(_0xb984('0xf'));var hardwareService=require(_0xb984('0x10'));var logger=require(_0xb984('0x11'))(_0xb984('0x12'));var utils=require(_0xb984('0x13'));var config=require(_0xb984('0x14'));var licenseUtil=require(_0xb984('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b922b,_0x4b9c75){_0x4b9c75=_0x4b9c75||0xcc;return function(_0x61432f){if(_0x61432f){return _0x1b922b[_0xb984('0x16')](_0x4b9c75);}return _0x1b922b['status'](_0x4b9c75)[_0xb984('0x17')]();};}function respondWithResult(_0x2e7986,_0x564d24){_0x564d24=_0x564d24||0xc8;return function(_0x203dba){if(_0x203dba){return _0x2e7986[_0xb984('0x18')](_0x564d24)['json'](_0x203dba);}};}function respondWithFilteredResult(_0xede12d,_0x4073cb){return function(_0x57365c){if(_0x57365c){var _0x6fae41=typeof _0x4073cb['offset']===_0xb984('0x19')&&typeof _0x4073cb[_0xb984('0x1a')]===_0xb984('0x19');var _0x3f7cff=_0x57365c['count'];var _0x396c36=_0x6fae41?0x0:_0x4073cb[_0xb984('0x1b')];var _0x3a5c96=_0x6fae41?_0x57365c[_0xb984('0x1c')]:_0x4073cb[_0xb984('0x1b')]+_0x4073cb[_0xb984('0x1a')];var _0x5c2e25;if(_0x3a5c96>=_0x3f7cff){_0x3a5c96=_0x3f7cff;_0x5c2e25=0xc8;}else{_0x5c2e25=0xce;}_0xede12d[_0xb984('0x18')](_0x5c2e25);return _0xede12d[_0xb984('0x1d')](_0xb984('0x1e'),_0x396c36+'-'+_0x3a5c96+'/'+_0x3f7cff)[_0xb984('0x1f')](_0x57365c);}return null;};}function patchUpdates(_0x32831b){return function(_0xcf9365){try{jsonpatch['apply'](_0xcf9365,_0x32831b,!![]);}catch(_0x39d16f){return BPromise[_0xb984('0x20')](_0x39d16f);}return _0xcf9365['save']();};}function saveUpdates(_0x44b570,_0x97af5c){return function(_0x14734a){if(_0x14734a){return _0x14734a[_0xb984('0x21')](_0x44b570)[_0xb984('0x22')](function(_0x286033){return _0x286033;});}return null;};}function removeEntity(_0x41510a,_0x52c581){return function(_0x391a1e){if(_0x391a1e){return _0x391a1e[_0xb984('0x23')]()[_0xb984('0x22')](function(){var _0x5d4d38=_0x391a1e[_0xb984('0x24')]({'plain':!![]});var _0x2e806e=_0xb984('0x25');return db[_0xb984('0x26')][_0xb984('0x23')]({'where':{'type':_0x2e806e,'resourceId':_0x5d4d38['id']}})[_0xb984('0x22')](function(){return _0x391a1e;});})[_0xb984('0x22')](function(){_0x41510a[_0xb984('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249d47,_0x469af6){return function(_0x3e254b){if(!_0x3e254b){_0x249d47[_0xb984('0x16')](0x194);}return _0x3e254b;};}function handleError(_0x4fb896,_0xa44895){_0xa44895=_0xa44895||0x1f4;return function(_0x67e4d3){logger[_0xb984('0x27')](_0x67e4d3['stack']);if(_0x67e4d3[_0xb984('0x28')]){delete _0x67e4d3[_0xb984('0x28')];}_0x4fb896[_0xb984('0x18')](_0xa44895)[_0xb984('0x29')](_0x67e4d3);};}exports['index']=function(_0x5b8da1,_0x4dcf73){var _0x10b9ac={},_0x23ecf6={},_0x58a98c={'count':0x0,'rows':[]};var _0x320bef=_[_0xb984('0x2a')](db[_0xb984('0x2b')][_0xb984('0x2c')],function(_0x518bef){return{'name':_0x518bef['fieldName'],'type':_0x518bef[_0xb984('0x2d')][_0xb984('0x2e')]};});_0x23ecf6[_0xb984('0x2f')]=_[_0xb984('0x2a')](_0x320bef,'name');_0x23ecf6[_0xb984('0x30')]=_[_0xb984('0x31')](_0x5b8da1[_0xb984('0x30')]);_0x23ecf6[_0xb984('0x32')]=_[_0xb984('0x33')](_0x23ecf6[_0xb984('0x2f')],_0x23ecf6['query']);_0x10b9ac[_0xb984('0x34')]=_[_0xb984('0x33')](_0x23ecf6[_0xb984('0x2f')],qs[_0xb984('0x35')](_0x5b8da1[_0xb984('0x30')][_0xb984('0x35')]));_0x10b9ac['attributes']=_0x10b9ac[_0xb984('0x34')][_0xb984('0x36')]?_0x10b9ac['attributes']:_0x23ecf6['model'];if(!_0x5b8da1[_0xb984('0x30')]['hasOwnProperty'](_0xb984('0x37'))){_0x10b9ac[_0xb984('0x1a')]=qs['limit'](_0x5b8da1[_0xb984('0x30')]['limit']);_0x10b9ac[_0xb984('0x1b')]=qs['offset'](_0x5b8da1[_0xb984('0x30')]['offset']);}_0x10b9ac['order']=qs[_0xb984('0x38')](_0x5b8da1[_0xb984('0x30')]['sort']);_0x10b9ac[_0xb984('0x39')]=qs[_0xb984('0x32')](_['pick'](_0x5b8da1[_0xb984('0x30')],_0x23ecf6[_0xb984('0x32')]),_0x320bef);if(_0x5b8da1[_0xb984('0x30')][_0xb984('0x3a')]){_0x10b9ac['where']=_[_0xb984('0x3b')](_0x10b9ac[_0xb984('0x39')],{'$or':_[_0xb984('0x2a')](_0x320bef,function(_0x474fbd){if(_0x474fbd[_0xb984('0x2d')]!==_0xb984('0x3c')){var _0xc257ee={};_0xc257ee[_0x474fbd[_0xb984('0x28')]]={'$like':'%'+_0x5b8da1[_0xb984('0x30')][_0xb984('0x3a')]+'%'};return _0xc257ee;}})});}_0x10b9ac=_['merge']({},_0x10b9ac,_0x5b8da1[_0xb984('0x3d')]);var _0xd10521={'where':_0x10b9ac[_0xb984('0x39')]};return db[_0xb984('0x2b')][_0xb984('0x1c')](_0xd10521)[_0xb984('0x22')](function(_0x1e8323){_0x58a98c[_0xb984('0x1c')]=_0x1e8323;if(_0x5b8da1['query']['includeAll']){_0x10b9ac[_0xb984('0x3e')]=[{'all':!![]}];}return db['Tag'][_0xb984('0x3f')](_0x10b9ac);})[_0xb984('0x22')](function(_0x216df6){_0x58a98c[_0xb984('0x40')]=_0x216df6;return _0x58a98c;})['then'](respondWithFilteredResult(_0x4dcf73,_0x10b9ac))[_0xb984('0x41')](handleError(_0x4dcf73,null));};exports[_0xb984('0x42')]=function(_0x5d5e85,_0x21a5bb){var _0xb61add={'raw':!![],'where':{'id':_0x5d5e85[_0xb984('0x43')]['id']}},_0x38a025={};_0x38a025[_0xb984('0x2f')]=_[_0xb984('0x31')](db[_0xb984('0x2b')]['rawAttributes']);_0x38a025[_0xb984('0x30')]=_[_0xb984('0x31')](_0x5d5e85['query']);_0x38a025['filters']=_[_0xb984('0x33')](_0x38a025[_0xb984('0x2f')],_0x38a025[_0xb984('0x30')]);_0xb61add[_0xb984('0x34')]=_[_0xb984('0x33')](_0x38a025['model'],qs[_0xb984('0x35')](_0x5d5e85[_0xb984('0x30')][_0xb984('0x35')]));_0xb61add[_0xb984('0x34')]=_0xb61add[_0xb984('0x34')][_0xb984('0x36')]?_0xb61add[_0xb984('0x34')]:_0x38a025[_0xb984('0x2f')];if(_0x5d5e85[_0xb984('0x30')][_0xb984('0x44')]){_0xb61add['include']=[{'all':!![]}];}_0xb61add=_[_0xb984('0x3b')]({},_0xb61add,_0x5d5e85[_0xb984('0x3d')]);return db['Tag'][_0xb984('0x45')](_0xb61add)[_0xb984('0x22')](handleEntityNotFound(_0x21a5bb,null))[_0xb984('0x22')](respondWithResult(_0x21a5bb,null))[_0xb984('0x41')](handleError(_0x21a5bb,null));};exports[_0xb984('0x46')]=function(_0x49dde7,_0x10f813){return db[_0xb984('0x2b')][_0xb984('0x46')](_0x49dde7[_0xb984('0x47')],{})['then'](function(_0x2753e3){var _0x303280=_0x49dde7[_0xb984('0x48')][_0xb984('0x24')]({'plain':!![]});if(!_0x303280)throw new Error(_0xb984('0x49'));if(_0x303280[_0xb984('0x4a')]===_0xb984('0x48')){var _0x445f90=_0x2753e3[_0xb984('0x24')]({'plain':!![]});var _0x5c3d82=_0xb984('0x25');return db[_0xb984('0x4b')][_0xb984('0x45')]({'where':{'name':_0x5c3d82,'userProfileId':_0x303280['userProfileId']},'raw':!![]})[_0xb984('0x22')](function(_0x42a9f8){if(_0x42a9f8&&_0x42a9f8['autoAssociation']===0x0){return db[_0xb984('0x26')]['create']({'name':_0x445f90[_0xb984('0x28')],'resourceId':_0x445f90['id'],'type':_0x42a9f8[_0xb984('0x28')],'sectionId':_0x42a9f8['id']},{})['then'](function(){return _0x2753e3;});}else{return _0x2753e3;}})[_0xb984('0x41')](function(_0x38b1cb){logger[_0xb984('0x27')](_0xb984('0x4c'),_0x38b1cb);throw _0x38b1cb;});}return _0x2753e3;})[_0xb984('0x22')](respondWithResult(_0x10f813,0xc9))[_0xb984('0x41')](handleError(_0x10f813,null));};exports['update']=function(_0x1774a3,_0x5d06f8){if(_0x1774a3[_0xb984('0x47')]['id']){delete _0x1774a3[_0xb984('0x47')]['id'];}return db[_0xb984('0x2b')]['find']({'where':{'id':_0x1774a3['params']['id']}})[_0xb984('0x22')](handleEntityNotFound(_0x5d06f8,null))[_0xb984('0x22')](saveUpdates(_0x1774a3['body'],null))['then'](respondWithResult(_0x5d06f8,null))[_0xb984('0x41')](handleError(_0x5d06f8,null));};exports[_0xb984('0x23')]=function(_0x38cca4,_0x3daaa0){return db[_0xb984('0x2b')][_0xb984('0x45')]({'where':{'id':_0x38cca4['params']['id']}})['then'](handleEntityNotFound(_0x3daaa0,null))[_0xb984('0x22')](removeEntity(_0x3daaa0,null))[_0xb984('0x41')](handleError(_0x3daaa0,null));};
\ No newline at end of file
index 019597f..612bb1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85b7=['../../config/environment','./tag.attributes','exports','define','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3520d0,_0x32b2cf){var _0x1d2118=function(_0x548d7d){while(--_0x548d7d){_0x3520d0['push'](_0x3520d0['shift']());}};_0x1d2118(++_0x32b2cf);}(_0x85b7,0x1f1));var _0x785b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x85b7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x785b('0x0'));var logger=require(_0x785b('0x1'))(_0x785b('0x2'));var moment=require(_0x785b('0x3'));var BPromise=require(_0x785b('0x4'));var rp=require(_0x785b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x785b('0x6'));var config=require(_0x785b('0x7'));var attributes=require(_0x785b('0x8'));module[_0x785b('0x9')]=function(_0x472831,_0x2fdd3f){return _0x472831[_0x785b('0xa')]('Tag',attributes,{'tableName':_0x785b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfeb3=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfeb3,0x19b));var _0x3feb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfeb3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3feb('0x0'));var util=require(_0x3feb('0x1'));var logger=require(_0x3feb('0x2'))(_0x3feb('0x3'));var moment=require(_0x3feb('0x4'));var BPromise=require('bluebird');var rp=require(_0x3feb('0x5'));var fs=require('fs');var path=require(_0x3feb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x3feb('0x7')]=function(_0x5b4838,_0x762e44){return _0x5b4838[_0x3feb('0x8')](_0x3feb('0x9'),attributes,{'tableName':_0x3feb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4c8a621..4f22c68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f0d=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x1c5c9b,_0x599547){var _0x5790e9=function(_0x5e1d8f){while(--_0x5e1d8f){_0x1c5c9b['push'](_0x1c5c9b['shift']());}};_0x5790e9(++_0x599547);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4dbdd4,_0x4e3141){_0x4dbdd4=_0x4dbdd4-0x0;var _0x5ceede=_0x6f0d[_0x4dbdd4];return _0x5ceede;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('Tag,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});}
\ No newline at end of file
+var _0x68fc=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23fde6,_0x8063f3){var _0x212570=function(_0x7545ee){while(--_0x7545ee){_0x23fde6['push'](_0x23fde6['shift']());}};_0x212570(++_0x8063f3);}(_0x68fc,0xa5));var _0xc68f=function(_0x4123d8,_0xff9e20){_0x4123d8=_0x4123d8-0x0;var _0x5a60d3=_0x68fc[_0x4123d8];return _0x5a60d3;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var moment=require(_0xc68f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc68f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc68f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc68f('0x5'));var jayson=require(_0xc68f('0x6'));var client=jayson[_0xc68f('0x7')][_0xc68f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fcce4,_0x4a6f7d,_0x9f2705){return new BPromise(function(_0x2bf3fd,_0x370977){return client[_0xc68f('0x9')](_0x4fcce4,_0x9f2705)[_0xc68f('0xa')](function(_0x1ee022){logger[_0xc68f('0xb')](_0xc68f('0xc'),_0x4a6f7d,_0xc68f('0xd'));logger[_0xc68f('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x4a6f7d,_0xc68f('0xd'),JSON[_0xc68f('0xf')](_0x1ee022));if(_0x1ee022[_0xc68f('0x10')]){if(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x11')]===0x1f4){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0x4a6f7d,_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x370977(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);}logger['error'](_0xc68f('0xc'),_0x4a6f7d,_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x2bf3fd(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);}else{logger[_0xc68f('0xb')](_0xc68f('0xc'),_0x4a6f7d,_0xc68f('0xd'));_0x2bf3fd(_0x1ee022[_0xc68f('0x13')]['message']);}})['catch'](function(_0x3a6c06){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0x4a6f7d,_0x3a6c06);_0x370977(_0x3a6c06);});});}
\ No newline at end of file
index a67dd84..f295698 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router;
\ No newline at end of file
index 8e0ecbd..7eced08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7e7=['STRING','sequelize'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb7e7,0x121));var _0x7b7e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb7e7[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}};
\ No newline at end of file
+var _0x0713=['STRING','name'];(function(_0x240552,_0x43d97f){var _0x6d4e3b=function(_0x4f2894){while(--_0x4f2894){_0x240552['push'](_0x240552['shift']());}};_0x6d4e3b(++_0x43d97f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}};
\ No newline at end of file
index 6729c02..168d6c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x004e=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','fields','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId','UserChatQueue','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','Teams','getQueues','channel','Unknown\x20channel','toLowerCase','Queue','order','capitalize','Queues','findOne','ValidationError','add','ids','isValidChannel','remove','isArray','Voice','Chat','Mail','Sms','Openchannel','through','penalty','User','findOrCreate','emit','user','Queue:save','QueueId','voicePause','interface','upsert','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','Fax','Whatsapp','removeAgents','Queue:remove','UserVoiceQueueRt','VoicePrefixId','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x48a8d3,_0xb4890b){var _0x547b58=function(_0x2937b2){while(--_0x2937b2){_0x48a8d3['push'](_0x48a8d3['shift']());}};_0x547b58(++_0xb4890b);}(_0x004e,0x82));var _0xe004=function(_0x4e9365,_0x3268e8){_0x4e9365=_0x4e9365-0x0;var _0x533711=_0x004e[_0x4e9365];return _0x533711;};'use strict';var emlformat=require(_0xe004('0x0'));var rimraf=require(_0xe004('0x1'));var zipdir=require(_0xe004('0x2'));var jsonpatch=require(_0xe004('0x3'));var rp=require(_0xe004('0x4'));var moment=require(_0xe004('0x5'));var BPromise=require(_0xe004('0x6'));var Mustache=require(_0xe004('0x7'));var util=require('util');var path=require(_0xe004('0x8'));var sox=require('sox');var csv=require(_0xe004('0x9'));var ejs=require(_0xe004('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe004('0xb'));var squel=require(_0xe004('0xc'));var crypto=require(_0xe004('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe004('0xe'));var toCsv=require(_0xe004('0x9'));var querystring=require(_0xe004('0xf'));var Papa=require('papaparse');var Redis=require(_0xe004('0x10'));var authService=require(_0xe004('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe004('0x12'));var hardwareService=require(_0xe004('0x13'));var logger=require(_0xe004('0x14'))(_0xe004('0x15'));var utils=require(_0xe004('0x16'));var config=require(_0xe004('0x17'));var licenseUtil=require(_0xe004('0x18'));var db=require(_0xe004('0x19'))['db'];config[_0xe004('0x1a')]=_[_0xe004('0x1b')](config[_0xe004('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe004('0x1c'))(new Redis(config[_0xe004('0x1a')]));require(_0xe004('0x1d'))[_0xe004('0x1e')](socket);function respondWithStatusCode(_0x1a29ac,_0x37861b){_0x37861b=_0x37861b||0xcc;return function(_0x517f8e){if(_0x517f8e){return _0x1a29ac['sendStatus'](_0x37861b);}return _0x1a29ac[_0xe004('0x1f')](_0x37861b)[_0xe004('0x20')]();};}function respondWithResult(_0x476c56,_0x596738){_0x596738=_0x596738||0xc8;return function(_0xfa9e16){if(_0xfa9e16){return _0x476c56[_0xe004('0x1f')](_0x596738)[_0xe004('0x21')](_0xfa9e16);}};}function respondWithFilteredResult(_0x349a9f,_0x10e0cb){return function(_0x1dcf29){if(_0x1dcf29){var _0x443967=typeof _0x10e0cb[_0xe004('0x22')]==='undefined'&&typeof _0x10e0cb['limit']===_0xe004('0x23');var _0x406e1c=_0x1dcf29[_0xe004('0x24')];var _0x4393e3=_0x443967?0x0:_0x10e0cb[_0xe004('0x22')];var _0x42cdab=_0x443967?_0x1dcf29['count']:_0x10e0cb[_0xe004('0x22')]+_0x10e0cb[_0xe004('0x25')];var _0x36f92a;if(_0x42cdab>=_0x406e1c){_0x42cdab=_0x406e1c;_0x36f92a=0xc8;}else{_0x36f92a=0xce;}_0x349a9f[_0xe004('0x1f')](_0x36f92a);return _0x349a9f[_0xe004('0x26')](_0xe004('0x27'),_0x4393e3+'-'+_0x42cdab+'/'+_0x406e1c)[_0xe004('0x21')](_0x1dcf29);}return null;};}function patchUpdates(_0x283824){return function(_0x40169c){try{jsonpatch[_0xe004('0x28')](_0x40169c,_0x283824,!![]);}catch(_0x1e467b){return BPromise[_0xe004('0x29')](_0x1e467b);}return _0x40169c[_0xe004('0x2a')]();};}function saveUpdates(_0x20006e,_0x5e5e65){return function(_0x48ff7a){if(_0x48ff7a){return _0x48ff7a[_0xe004('0x2b')](_0x20006e)[_0xe004('0x2c')](function(_0x2eed9a){return _0x2eed9a;});}return null;};}function handleEntityNotFound(_0x13a856,_0x2fa658){return function(_0x5f3fe2){if(!_0x5f3fe2){_0x13a856['sendStatus'](0x194);}return _0x5f3fe2;};}function handleError(_0x48d66a,_0xfed2ae){_0xfed2ae=_0xfed2ae||0x1f4;return function(_0x482786){logger[_0xe004('0x2d')](_0x482786['stack']);if(_0x482786['name']){delete _0x482786[_0xe004('0x2e')];}_0x48d66a[_0xe004('0x1f')](_0xfed2ae)[_0xe004('0x2f')](_0x482786);};}exports['index']=function(_0x3a7c08,_0xcb9bc1){var _0x51f1be={},_0x1a4b50={},_0x507704={'count':0x0,'rows':[]};var _0x7d37a4=_[_0xe004('0x30')](db[_0xe004('0x31')][_0xe004('0x32')],function(_0x860211){return{'name':_0x860211[_0xe004('0x33')],'type':_0x860211[_0xe004('0x34')][_0xe004('0x35')]};});_0x1a4b50[_0xe004('0x36')]=_[_0xe004('0x30')](_0x7d37a4,_0xe004('0x2e'));_0x1a4b50[_0xe004('0x37')]=_[_0xe004('0x38')](_0x3a7c08[_0xe004('0x37')]);_0x1a4b50['filters']=_[_0xe004('0x39')](_0x1a4b50['model'],_0x1a4b50[_0xe004('0x37')]);_0x51f1be[_0xe004('0x3a')]=_[_0xe004('0x39')](_0x1a4b50[_0xe004('0x36')],qs['fields'](_0x3a7c08[_0xe004('0x37')]['fields']));_0x51f1be[_0xe004('0x3a')]=_0x51f1be[_0xe004('0x3a')][_0xe004('0x3b')]?_0x51f1be['attributes']:_0x1a4b50[_0xe004('0x36')];if(!_0x3a7c08['query'][_0xe004('0x3c')](_0xe004('0x3d'))){_0x51f1be[_0xe004('0x25')]=qs['limit'](_0x3a7c08[_0xe004('0x37')]['limit']);_0x51f1be[_0xe004('0x22')]=qs[_0xe004('0x22')](_0x3a7c08[_0xe004('0x37')]['offset']);}_0x51f1be['order']=qs[_0xe004('0x3e')](_0x3a7c08[_0xe004('0x37')][_0xe004('0x3e')]);_0x51f1be[_0xe004('0x3f')]=qs[_0xe004('0x40')](_[_0xe004('0x41')](_0x3a7c08[_0xe004('0x37')],_0x1a4b50['filters']),_0x7d37a4);if(_0x3a7c08['query'][_0xe004('0x42')]){_0x51f1be[_0xe004('0x3f')]=_[_0xe004('0x43')](_0x51f1be[_0xe004('0x3f')],{'$or':_[_0xe004('0x30')](_0x7d37a4,function(_0x4989b2){if(_0x4989b2['type']!==_0xe004('0x44')){var _0x5e99da={};_0x5e99da[_0x4989b2[_0xe004('0x2e')]]={'$like':'%'+_0x3a7c08[_0xe004('0x37')][_0xe004('0x42')]+'%'};return _0x5e99da;}})});}_0x51f1be=_[_0xe004('0x43')]({},_0x51f1be,_0x3a7c08[_0xe004('0x45')]);var _0x306795={'where':_0x51f1be[_0xe004('0x3f')]};return db[_0xe004('0x31')][_0xe004('0x24')](_0x306795)[_0xe004('0x2c')](function(_0x27281b){_0x507704[_0xe004('0x24')]=_0x27281b;if(_0x3a7c08['query']['includeAll']){_0x51f1be['include']=[{'all':!![]}];}return db[_0xe004('0x31')][_0xe004('0x46')](_0x51f1be);})[_0xe004('0x2c')](function(_0x5c55b8){_0x507704[_0xe004('0x47')]=_0x5c55b8;return _0x507704;})[_0xe004('0x2c')](respondWithFilteredResult(_0xcb9bc1,_0x51f1be))[_0xe004('0x48')](handleError(_0xcb9bc1,null));};exports['show']=function(_0x4f90a6,_0x370cd6){var _0x29e698={'raw':![],'where':{'id':_0x4f90a6[_0xe004('0x49')]['id']}},_0x108b49={};_0x108b49['model']=_[_0xe004('0x38')](db['Team'][_0xe004('0x32')]);_0x108b49['query']=_[_0xe004('0x38')](_0x4f90a6['query']);_0x108b49['filters']=_['intersection'](_0x108b49[_0xe004('0x36')],_0x108b49[_0xe004('0x37')]);_0x29e698['attributes']=_['intersection'](_0x108b49[_0xe004('0x36')],qs[_0xe004('0x4a')](_0x4f90a6[_0xe004('0x37')][_0xe004('0x4a')]));_0x29e698[_0xe004('0x3a')]=_0x29e698['attributes']['length']?_0x29e698[_0xe004('0x3a')]:_0x108b49[_0xe004('0x36')];if(_0x4f90a6[_0xe004('0x37')]['includeAll']){_0x29e698[_0xe004('0x4b')]=[{'all':!![]}];}_0x29e698=_[_0xe004('0x43')]({},_0x29e698,_0x4f90a6[_0xe004('0x45')]);return db['Team'][_0xe004('0x4c')](_0x29e698)['then'](handleEntityNotFound(_0x370cd6,null))[_0xe004('0x2c')](respondWithResult(_0x370cd6,null))[_0xe004('0x48')](handleError(_0x370cd6,null));};exports[_0xe004('0x4d')]=function(_0x9ec6c,_0x5102f4){return db[_0xe004('0x31')][_0xe004('0x4d')](_0x9ec6c[_0xe004('0x4e')],{})[_0xe004('0x2c')](function(_0x5a34a6){var _0x51f288=_0x9ec6c['user'][_0xe004('0x4f')]({'plain':!![]});if(!_0x51f288)throw new Error(_0xe004('0x50'));if(_0x51f288[_0xe004('0x51')]==='user'){var _0x58f7cc=_0x5a34a6['get']({'plain':!![]});var _0x122ddb='Teams';return db[_0xe004('0x52')][_0xe004('0x4c')]({'where':{'name':_0x122ddb,'userProfileId':_0x51f288[_0xe004('0x53')]},'raw':!![]})[_0xe004('0x2c')](function(_0x2bd3af){if(_0x2bd3af&&_0x2bd3af[_0xe004('0x54')]===0x0){return db[_0xe004('0x55')][_0xe004('0x4d')]({'name':_0x58f7cc['name'],'resourceId':_0x58f7cc['id'],'type':_0x2bd3af['name'],'sectionId':_0x2bd3af['id']},{})[_0xe004('0x2c')](function(){return _0x5a34a6;});}else{return _0x5a34a6;}})[_0xe004('0x48')](function(_0x1bf95c){logger['error'](_0xe004('0x56'),_0x1bf95c);throw _0x1bf95c;});}return _0x5a34a6;})['then'](respondWithResult(_0x5102f4,0xc9))[_0xe004('0x48')](handleError(_0x5102f4,null));};exports[_0xe004('0x2b')]=function(_0x10d800,_0x9bcf62){if(_0x10d800['body']['id']){delete _0x10d800['body']['id'];}return db[_0xe004('0x31')][_0xe004('0x4c')]({'where':{'id':_0x10d800['params']['id']}})[_0xe004('0x2c')](handleEntityNotFound(_0x9bcf62,null))[_0xe004('0x2c')](saveUpdates(_0x10d800[_0xe004('0x4e')],null))[_0xe004('0x2c')](respondWithResult(_0x9bcf62,null))['catch'](handleError(_0x9bcf62,null));};exports['destroy']=function(_0x5f15ab,_0x4f5b44){var _0x376f35=_0x5f15ab[_0xe004('0x49')]['id'];var _0x5d7685=[];return db[_0xe004('0x57')][_0xe004('0x58')](function(_0x29c208){var _0x22e87c=_0xe004('0x59')+_0x376f35;return db['sequelize'][_0xe004('0x37')](_0x22e87c,{'type':db['Sequelize'][_0xe004('0x5a')][_0xe004('0x5b')],'raw':!![],'transaction':_0x29c208})['then'](function(_0x54ff21){_0x5d7685=_[_0xe004('0x30')](_0x54ff21,function(_0x144f9f){return Number(_0x144f9f[_0xe004('0x5c')]);});})['then'](function(){var _0x13e593='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x376f35;return db[_0xe004('0x57')][_0xe004('0x37')](_0x13e593,{'type':db['Sequelize'][_0xe004('0x5a')]['SELECT'],'raw':!![],'transaction':_0x29c208});})[_0xe004('0x2c')](function(_0x5cb1f8){var _0x3ac413=_[_0xe004('0x30')](_0x5cb1f8,function(_0x4a359d){return Number(_0x4a359d[_0xe004('0x5d')]);});return db['UserVoiceQueue'][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'VoiceQueueId':{'$in':_0x3ac413}},'transaction':_0x29c208});})['then'](function(){var _0xdf0d01=_0xe004('0x5f')+_0x376f35;return db['sequelize']['query'](_0xdf0d01,{'type':db[_0xe004('0x60')][_0xe004('0x5a')][_0xe004('0x5b')],'raw':!![],'transaction':_0x29c208});})[_0xe004('0x2c')](function(_0x2c36e0){var _0x422c48=_[_0xe004('0x30')](_0x2c36e0,function(_0x35128d){return Number(_0x35128d['MailQueueId']);});return db[_0xe004('0x61')][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'MailQueueId':{'$in':_0x422c48}},'transaction':_0x29c208});})['then'](function(){var _0x4c406d=_0xe004('0x62')+_0x376f35;return db['sequelize'][_0xe004('0x37')](_0x4c406d,{'type':db[_0xe004('0x60')]['QueryTypes'][_0xe004('0x5b')],'raw':!![],'transaction':_0x29c208});})[_0xe004('0x2c')](function(_0x6614b1){var _0x2da292=_[_0xe004('0x30')](_0x6614b1,function(_0x47afa5){return Number(_0x47afa5[_0xe004('0x63')]);});return db['UserSmsQueue'][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'SmsQueueId':{'$in':_0x2da292}},'transaction':_0x29c208});})[_0xe004('0x2c')](function(){var _0x53b8f5='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x376f35;return db[_0xe004('0x57')][_0xe004('0x37')](_0x53b8f5,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x29c208});})[_0xe004('0x2c')](function(_0x45bb0a){var _0x195d61=_[_0xe004('0x30')](_0x45bb0a,function(_0x386af5){return Number(_0x386af5[_0xe004('0x64')]);});return db[_0xe004('0x65')][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'ChatQueueId':{'$in':_0x195d61}},'transaction':_0x29c208});})[_0xe004('0x2c')](function(){var _0x1e2ba7='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x376f35;return db[_0xe004('0x57')][_0xe004('0x37')](_0x1e2ba7,{'type':db[_0xe004('0x60')][_0xe004('0x5a')][_0xe004('0x5b')],'raw':!![],'transaction':_0x29c208});})[_0xe004('0x2c')](function(_0x1f3443){var _0x7e0b82=_[_0xe004('0x30')](_0x1f3443,function(_0x1a6cde){return Number(_0x1a6cde[_0xe004('0x66')]);});return db['UserFaxQueue'][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'FaxQueueId':{'$in':_0x7e0b82}},'transaction':_0x29c208});})['then'](function(){var _0x16165e=_0xe004('0x67')+_0x376f35;return db[_0xe004('0x57')][_0xe004('0x37')](_0x16165e,{'type':db[_0xe004('0x60')][_0xe004('0x5a')][_0xe004('0x5b')],'raw':!![],'transaction':_0x29c208});})['then'](function(_0x390694){var _0x581568=_[_0xe004('0x30')](_0x390694,function(_0x4918af){return Number(_0x4918af[_0xe004('0x68')]);});return db[_0xe004('0x69')][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'OpenchannelQueueId':{'$in':_0x581568}},'transaction':_0x29c208});})[_0xe004('0x2c')](function(){var _0x40cfe5=_0xe004('0x6a')+_0x376f35;return db[_0xe004('0x57')][_0xe004('0x37')](_0x40cfe5,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x29c208});})['then'](function(_0x122e6){var _0x259233=_[_0xe004('0x30')](_0x122e6,function(_0x4170b4){return Number(_0x4170b4['WhatsappQueueId']);});return db[_0xe004('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x5d7685},'WhatsappQueueId':{'$in':_0x259233}},'transaction':_0x29c208});})['then'](function(){return db['TeamVoicePrefix'][_0xe004('0x4c')]({'where':{'TeamId':_0x376f35}});})[_0xe004('0x2c')](function(_0x120dce){if(_0x120dce===null){return;}return db[_0xe004('0x6c')][_0xe004('0x5e')]({'where':{'UserId':{'$in':_0x5d7685},'VoicePrefixId':_0x120dce['VoicePrefixId']},'transaction':_0x29c208});})[_0xe004('0x2c')](function(){return db[_0xe004('0x31')]['destroy']({'where':{'id':_0x376f35},'cascade':!![],'transaction':_0x29c208});})[_0xe004('0x2c')](function(_0x2c906a){if(_0x2c906a===0x0){_0x4f5b44['sendStatus'](0x194);}else{return db[_0xe004('0x55')][_0xe004('0x5e')]({'where':{'type':_0xe004('0x6d'),'resourceId':_0x376f35},'cascade':!![],'transaction':_0x29c208})[_0xe004('0x2c')](function(){_0x4f5b44['status'](0xcc)[_0xe004('0x20')]();});}})[_0xe004('0x48')](function(_0xa08647){_0x4f5b44[_0xe004('0x1f')](0x1f4)[_0xe004('0x2f')](_0xa08647);});});};exports[_0xe004('0x6e')]=function(_0x527ac9,_0xff739,_0x452e43){return db[_0xe004('0x31')]['findOne']({'where':{'id':_0x527ac9[_0xe004('0x49')]['id']}})[_0xe004('0x2c')](handleEntityNotFound(_0xff739,null))[_0xe004('0x2c')](function(_0x337285){if(!_0x527ac9[_0xe004('0x37')][_0xe004('0x6f')]||!utils['isValidChannel'](_0x527ac9[_0xe004('0x37')][_0xe004('0x6f')])){throw new db['Sequelize']['ValidationError'](_0xe004('0x70'));}var _0x481eb0={};var _0x4b33ca={};_0x4b33ca[_0xe004('0x36')]=_[_0xe004('0x38')](db[_['capitalize'](_0x527ac9[_0xe004('0x37')][_0xe004('0x6f')][_0xe004('0x71')]())+_0xe004('0x72')][_0xe004('0x32')]);_0x4b33ca[_0xe004('0x37')]=_['keys'](_0x527ac9[_0xe004('0x37')]);_0x4b33ca[_0xe004('0x40')]=_[_0xe004('0x39')](_0x4b33ca['model'],_0x4b33ca['query']);_0x481eb0['attributes']=_[_0xe004('0x39')](_0x4b33ca[_0xe004('0x36')],qs[_0xe004('0x4a')](_0x527ac9[_0xe004('0x37')][_0xe004('0x4a')]));_0x481eb0[_0xe004('0x3a')]=_0x481eb0[_0xe004('0x3a')][_0xe004('0x3b')]?_0x481eb0[_0xe004('0x3a')]:_0x4b33ca['model'];_0x481eb0[_0xe004('0x25')]=qs[_0xe004('0x25')](_0x527ac9[_0xe004('0x37')]['limit']);_0x481eb0['offset']=qs[_0xe004('0x22')](_0x527ac9[_0xe004('0x37')]['offset']);_0x481eb0[_0xe004('0x73')]=qs[_0xe004('0x3e')](_0x527ac9[_0xe004('0x37')][_0xe004('0x3e')]);_0x481eb0['where']=qs['filters'](_[_0xe004('0x41')](_0x527ac9['query'],_0x4b33ca['filters']));_0x481eb0=_[_0xe004('0x43')]({},_0x481eb0,_0x527ac9['options']);return _0x337285['get'+_[_0xe004('0x74')](_0x527ac9['query']['channel']['toLowerCase']())+_0xe004('0x75')](_0x481eb0);})[_0xe004('0x2c')](respondWithResult(_0xff739,null))[_0xe004('0x48')](handleError(_0xff739,null));};exports['addQueues']=function(_0x4ac750,_0x207f4c,_0x19ed21){return db[_0xe004('0x31')][_0xe004('0x76')]({'where':{'id':_0x4ac750[_0xe004('0x49')]['id']}})[_0xe004('0x2c')](function(_0x5418ae){if(_0x5418ae){if(!_0x4ac750[_0xe004('0x4e')][_0xe004('0x6f')]||!utils['isValidChannel'](_0x4ac750[_0xe004('0x4e')][_0xe004('0x6f')])){throw new db[(_0xe004('0x60'))][(_0xe004('0x77'))](_0xe004('0x70'));}return _0x5418ae[_0xe004('0x78')+_[_0xe004('0x74')](_0x4ac750[_0xe004('0x4e')][_0xe004('0x6f')][_0xe004('0x71')]())+_0xe004('0x75')](_0x4ac750[_0xe004('0x4e')][_0xe004('0x79')]);}return null;})[_0xe004('0x2c')](handleEntityNotFound(_0x207f4c,null))[_0xe004('0x2c')](respondWithStatusCode(_0x207f4c,null))['catch'](handleError(_0x207f4c,null));};exports['removeQueues']=function(_0x488eb9,_0x240ef2,_0x38ad18){return db[_0xe004('0x31')][_0xe004('0x76')]({'where':{'id':_0x488eb9[_0xe004('0x49')]['id']}})[_0xe004('0x2c')](function(_0x56f0ff){if(_0x56f0ff){if(!_0x488eb9[_0xe004('0x37')]['channel']||!utils[_0xe004('0x7a')](_0x488eb9[_0xe004('0x37')][_0xe004('0x6f')])){throw new db[(_0xe004('0x60'))][(_0xe004('0x77'))](_0xe004('0x70'));}return _0x56f0ff[_0xe004('0x7b')+_[_0xe004('0x74')](_0x488eb9['query']['channel'][_0xe004('0x71')]())+_0xe004('0x75')](_0x488eb9[_0xe004('0x37')][_0xe004('0x79')]);}return null;})['then'](handleEntityNotFound(_0x240ef2,null))[_0xe004('0x2c')](respondWithStatusCode(_0x240ef2,null))[_0xe004('0x48')](handleError(_0x240ef2,null));};exports['addAgents']=function(_0x43d2f2,_0x27e098){var _0x10a72e=_[_0xe004('0x7c')](_0x43d2f2['body'][_0xe004('0x79')])?_0x43d2f2[_0xe004('0x4e')][_0xe004('0x79')]:[_0x43d2f2[_0xe004('0x4e')][_0xe004('0x79')]];var _0x5e6c3a=_0x43d2f2[_0xe004('0x49')]['id'];return db[_0xe004('0x31')][_0xe004('0x4c')]({'where':{'id':_0x5e6c3a}})[_0xe004('0x2c')](handleEntityNotFound(_0x27e098,null))[_0xe004('0x2c')](function(_0x22268e){if(_0x22268e){var _0x5821fa=[_0xe004('0x7d'),_0xe004('0x7e'),_0xe004('0x7f'),_0xe004('0x80'),'Fax',_0xe004('0x81'),'Whatsapp'];return db[_0xe004('0x57')][_0xe004('0x58')](function(_0x36c68c){var _0x30d35e=_[_0xe004('0x30')](_0x5821fa,function(_0x3cf265){var _0x1710b3={'attributes':['id','name']};if(_0x3cf265===_0xe004('0x7d')){_0x1710b3[_0xe004('0x82')]={'attributes':['penalty']};}return _0x22268e[_0xe004('0x4f')+_0x3cf265+_0xe004('0x75')](_0x1710b3)[_0xe004('0x2c')](function(_0x596994){var _0x4ab975=_[_0xe004('0x30')](_0x596994,function(_0x2016c9){var _0x4b1d4a=_[_0xe004('0x30')](_0x10a72e,function(_0x193c1c){var _0x5c7bdf={'where':{'UserId':_0x193c1c,[_0x3cf265+'QueueId']:_0x2016c9['id']},'transaction':_0x36c68c};if(_0x3cf265===_0xe004('0x7d')){_0x5c7bdf[_0xe004('0x1b')]={'penalty':_0x2016c9['TeamVoiceQueue'][_0xe004('0x83')]};}return db[_0xe004('0x84')+_0x3cf265+_0xe004('0x72')][_0xe004('0x85')](_0x5c7bdf)[_0xe004('0x2c')](function(){socket[_0xe004('0x86')](_0xe004('0x87')+_0x3cf265+_0xe004('0x88'),{'UserId':_0x193c1c,[_0x3cf265+_0xe004('0x89')]:_0x2016c9['id']});if(_0x3cf265!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x10a72e,'online':0x1},'attributes':['id',_0xe004('0x2e'),'online',_0xe004('0x8a'),_0xe004('0x8b')],'raw':!![]})[_0xe004('0x2c')](function(_0x645c6f){var _0x52802b=_[_0xe004('0x30')](_0x645c6f,function(_0x5c22e2){return db['UserVoiceQueueRt'][_0xe004('0x8c')]({'membername':_0x5c22e2['name'],'UserId':_0x5c22e2['id'],'queue_name':_0x2016c9[_0xe004('0x2e')],'VoiceQueueId':_0x2016c9['id'],'interface':_['isNil'](_0x5c22e2[_0xe004('0x8b')])?util['format'](_0xe004('0x8d'),_0x5c22e2[_0xe004('0x2e')]):_0x5c22e2[_0xe004('0x8b')],'paused':_0x5c22e2[_0xe004('0x8a')]||![],'penalty':_0x2016c9[_0xe004('0x8e')]['penalty']},{'transaction':_0x36c68c});});return Promise[_0xe004('0x8f')](_0x52802b);});});});return Promise['all'](_0x4b1d4a);});return Promise[_0xe004('0x8f')](_0x4ab975);})[_0xe004('0x2c')](function(){return db[_0xe004('0x90')]['findOne']({'where':{'teamId':_0x5e6c3a}})['then'](function(_0x262846){if(_0x262846){var _0x15ef25=_['map'](_0x10a72e,function(_0x3957ba){db[_0xe004('0x6c')][_0xe004('0x8c')]({'UserId':_0x3957ba,'VoicePrefixId':_0x262846['VoicePrefixId']});});return Promise[_0xe004('0x8f')](_0x15ef25);}});});});return Promise[_0xe004('0x8f')](_0x30d35e)[_0xe004('0x2c')](function(){return _0x22268e['addAgents'](_0x10a72e,{'transaction':_0x36c68c})['spread'](function(_0x2ce26d){return _0x2ce26d;});});});}})[_0xe004('0x2c')](respondWithResult(_0x27e098,null))[_0xe004('0x48')](handleError(_0x27e098,null));};exports['removeAgents']=function(_0x48ba3e,_0x241c23){var _0x2caac2=_[_0xe004('0x7c')](_0x48ba3e[_0xe004('0x37')][_0xe004('0x79')])?_0x48ba3e[_0xe004('0x37')][_0xe004('0x79')]:[_0x48ba3e['query']['ids']];var _0x13cf99=_0x48ba3e[_0xe004('0x49')]['id'];return db[_0xe004('0x31')][_0xe004('0x4c')]({'where':{'id':_0x13cf99}})[_0xe004('0x2c')](handleEntityNotFound(_0x241c23,null))[_0xe004('0x2c')](function(_0x1c333b){if(_0x1c333b){var _0x55e439=[_0xe004('0x7d'),'Chat',_0xe004('0x7f'),_0xe004('0x80'),_0xe004('0x91'),'Openchannel',_0xe004('0x92')];return db[_0xe004('0x57')]['transaction'](function(_0x2fc113){var _0x103c73=_[_0xe004('0x30')](_0x55e439,function(_0x1a1e94){var _0x49d178={'attributes':['id',_0xe004('0x2e')]};return _0x1c333b[_0xe004('0x4f')+_0x1a1e94+_0xe004('0x75')](_0x49d178)[_0xe004('0x2c')](function(_0x5bf5a1){var _0x5a966c=_[_0xe004('0x30')](_0x5bf5a1,function(_0x3c23ae){return _0x3c23ae[_0xe004('0x93')](_0x2caac2,{'transaction':_0x2fc113})[_0xe004('0x2c')](function(){var _0x24417d=_[_0xe004('0x30')](_0x2caac2,function(_0x189f85){socket['emit'](_0xe004('0x87')+_0x1a1e94+_0xe004('0x94'),{'UserId':Number(_0x189f85),[_0x1a1e94+_0xe004('0x89')]:_0x3c23ae['id']});if(_0x1a1e94!==_0xe004('0x7d')){return;}return db[_0xe004('0x95')][_0xe004('0x5e')]({'where':{'VoiceQueueId':_0x3c23ae['id'],'UserId':_0x189f85},'transaction':_0x2fc113});});return Promise[_0xe004('0x8f')](_0x24417d);});});return Promise['all'](_0x5a966c);});});return Promise[_0xe004('0x8f')](_0x103c73)[_0xe004('0x2c')](function(){return _0x1c333b[_0xe004('0x93')](_0x2caac2,{'transaction':_0x2fc113});})[_0xe004('0x2c')](function(){return db['TeamVoicePrefix'][_0xe004('0x76')]({'where':{'teamId':_0x13cf99}})['then'](function(_0xb437e){if(_0xb437e){var _0x392a72=_[_0xe004('0x30')](_0x2caac2,function(_0x2d41cb){db[_0xe004('0x6c')][_0xe004('0x5e')]({'where':{'UserId':_0x2d41cb,'VoicePrefixId':_0xb437e[_0xe004('0x96')]}});});return Promise[_0xe004('0x8f')](_0x392a72);}});});});}})['then'](respondWithStatusCode(_0x241c23,null))[_0xe004('0x48')](handleError(_0x241c23,null));};exports['getAgents']=function(_0xb87ecf,_0x476a1c,_0x2427f4){var _0x27960e={};var _0x140798={};var _0x6613d6;var _0x566e6f;return db[_0xe004('0x31')][_0xe004('0x76')]({'where':{'id':_0xb87ecf[_0xe004('0x49')]['id']}})[_0xe004('0x2c')](handleEntityNotFound(_0x476a1c,null))[_0xe004('0x2c')](function(_0xc77dc0){if(_0xc77dc0){_0x6613d6=_0xc77dc0;_0x140798[_0xe004('0x36')]=_[_0xe004('0x38')](db[_0xe004('0x84')][_0xe004('0x32')]);_0x140798['query']=_[_0xe004('0x38')](_0xb87ecf[_0xe004('0x37')]);_0x140798['filters']=_[_0xe004('0x39')](_0x140798['model'],_0x140798['query']);_0x27960e[_0xe004('0x3a')]=_['intersection'](_0x140798[_0xe004('0x36')],qs[_0xe004('0x4a')](_0xb87ecf[_0xe004('0x37')][_0xe004('0x4a')]));_0x27960e[_0xe004('0x3a')]=_0x27960e[_0xe004('0x3a')]['length']?_0x27960e[_0xe004('0x3a')]:_0x140798[_0xe004('0x36')];_0x27960e[_0xe004('0x73')]=qs[_0xe004('0x3e')](_0xb87ecf[_0xe004('0x37')][_0xe004('0x3e')]);_0x27960e[_0xe004('0x3f')]=qs['filters'](_['pick'](_0xb87ecf[_0xe004('0x37')],_0x140798[_0xe004('0x40')]));if(_0xb87ecf['query']['filter']){_0x27960e[_0xe004('0x3f')]=_[_0xe004('0x43')](_0x27960e['where'],{'$or':_[_0xe004('0x30')](_0x27960e[_0xe004('0x3a')],function(_0x2fc4f2){var _0x4377f4={};_0x4377f4[_0x2fc4f2]={'$like':'%'+_0xb87ecf[_0xe004('0x37')][_0xe004('0x42')]+'%'};return _0x4377f4;})});}_0x27960e=_[_0xe004('0x43')]({},_0x27960e,_0xb87ecf[_0xe004('0x45')]);return _0x6613d6[_0xe004('0x97')](_0x27960e);}})[_0xe004('0x2c')](function(_0x159729){if(_0x159729){_0x566e6f=_0x159729[_0xe004('0x3b')];if(!_0xb87ecf[_0xe004('0x37')][_0xe004('0x3c')](_0xe004('0x3d'))){_0x27960e[_0xe004('0x25')]=qs[_0xe004('0x25')](_0xb87ecf['query'][_0xe004('0x25')]);_0x27960e[_0xe004('0x22')]=qs[_0xe004('0x22')](_0xb87ecf['query']['offset']);}return _0x6613d6['getAgents'](_0x27960e);}})[_0xe004('0x2c')](function(_0x578068){if(_0x578068){return _0x578068?{'count':_0x566e6f,'rows':_0x578068}:null;}})[_0xe004('0x2c')](respondWithResult(_0x476a1c,null))[_0xe004('0x48')](handleError(_0x476a1c,null));};
\ No newline at end of file
+var _0x8fcd=['through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','isArray','Mail','Openchannel','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Team','includeAll','rows','catch','params','fields','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','UserProfileResource','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','Sequelize','SmsQueueId','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel','channel','Unknown\x20channel','toLowerCase','Queue','options','capitalize','Queues','addQueues','ValidationError','removeQueues','ids','addAgents','Voice','Chat','Sms','Fax','Whatsapp','transaction'];(function(_0x5bf35e,_0x4ccc17){var _0x35b3d7=function(_0xefa9e4){while(--_0xefa9e4){_0x5bf35e['push'](_0x5bf35e['shift']());}};_0x35b3d7(++_0x4ccc17);}(_0x8fcd,0x143));var _0xd8fc=function(_0x54dc48,_0xf3557c){_0x54dc48=_0x54dc48-0x0;var _0x57237b=_0x8fcd[_0x54dc48];return _0x57237b;};'use strict';var emlformat=require(_0xd8fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8fc('0x1'));var jsonpatch=require(_0xd8fc('0x2'));var rp=require('request-promise');var moment=require(_0xd8fc('0x3'));var BPromise=require(_0xd8fc('0x4'));var Mustache=require(_0xd8fc('0x5'));var util=require(_0xd8fc('0x6'));var path=require('path');var sox=require(_0xd8fc('0x7'));var csv=require(_0xd8fc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8fc('0x9'));var _=require(_0xd8fc('0xa'));var squel=require(_0xd8fc('0xb'));var crypto=require(_0xd8fc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0x8'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require(_0xd8fc('0xf'));var authService=require(_0xd8fc('0x10'));var qs=require(_0xd8fc('0x11'));var as=require(_0xd8fc('0x12'));var hardwareService=require(_0xd8fc('0x13'));var logger=require(_0xd8fc('0x14'))('api');var utils=require(_0xd8fc('0x15'));var config=require(_0xd8fc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd8fc('0x17')](config[_0xd8fc('0x18')],{'host':_0xd8fc('0x19'),'port':0x18eb});var socket=require(_0xd8fc('0x1a'))(new Redis(config[_0xd8fc('0x18')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x27315e,_0x9e722a){_0x9e722a=_0x9e722a||0xcc;return function(_0x467908){if(_0x467908){return _0x27315e[_0xd8fc('0x1b')](_0x9e722a);}return _0x27315e[_0xd8fc('0x1c')](_0x9e722a)[_0xd8fc('0x1d')]();};}function respondWithResult(_0x202b9d,_0xf9bf46){_0xf9bf46=_0xf9bf46||0xc8;return function(_0x52cc1a){if(_0x52cc1a){return _0x202b9d['status'](_0xf9bf46)[_0xd8fc('0x1e')](_0x52cc1a);}};}function respondWithFilteredResult(_0x4d3fdf,_0x1df3d5){return function(_0x15fac4){if(_0x15fac4){var _0x3844c9=typeof _0x1df3d5['offset']===_0xd8fc('0x1f')&&typeof _0x1df3d5[_0xd8fc('0x20')]===_0xd8fc('0x1f');var _0x305e2f=_0x15fac4['count'];var _0x4d9a3e=_0x3844c9?0x0:_0x1df3d5[_0xd8fc('0x21')];var _0x5430e4=_0x3844c9?_0x15fac4[_0xd8fc('0x22')]:_0x1df3d5[_0xd8fc('0x21')]+_0x1df3d5['limit'];var _0x1e2a35;if(_0x5430e4>=_0x305e2f){_0x5430e4=_0x305e2f;_0x1e2a35=0xc8;}else{_0x1e2a35=0xce;}_0x4d3fdf[_0xd8fc('0x1c')](_0x1e2a35);return _0x4d3fdf[_0xd8fc('0x23')]('Content-Range',_0x4d9a3e+'-'+_0x5430e4+'/'+_0x305e2f)[_0xd8fc('0x1e')](_0x15fac4);}return null;};}function patchUpdates(_0x1c572c){return function(_0x3d36bd){try{jsonpatch[_0xd8fc('0x24')](_0x3d36bd,_0x1c572c,!![]);}catch(_0x2c2164){return BPromise[_0xd8fc('0x25')](_0x2c2164);}return _0x3d36bd[_0xd8fc('0x26')]();};}function saveUpdates(_0x421518,_0x261836){return function(_0x525419){if(_0x525419){return _0x525419[_0xd8fc('0x27')](_0x421518)[_0xd8fc('0x28')](function(_0x3f8a17){return _0x3f8a17;});}return null;};}function handleEntityNotFound(_0x1e6bea,_0x11ae0a){return function(_0x4ef465){if(!_0x4ef465){_0x1e6bea[_0xd8fc('0x1b')](0x194);}return _0x4ef465;};}function handleError(_0x334eda,_0xcca1f0){_0xcca1f0=_0xcca1f0||0x1f4;return function(_0x2f65ee){logger[_0xd8fc('0x29')](_0x2f65ee[_0xd8fc('0x2a')]);if(_0x2f65ee[_0xd8fc('0x2b')]){delete _0x2f65ee[_0xd8fc('0x2b')];}_0x334eda[_0xd8fc('0x1c')](_0xcca1f0)[_0xd8fc('0x2c')](_0x2f65ee);};}exports['index']=function(_0x41dea0,_0x554f15){var _0x1444ab={},_0x45e6bf={},_0x1bad1f={'count':0x0,'rows':[]};var _0x23a6f4=_[_0xd8fc('0x2d')](db['Team'][_0xd8fc('0x2e')],function(_0x2da618){return{'name':_0x2da618[_0xd8fc('0x2f')],'type':_0x2da618[_0xd8fc('0x30')][_0xd8fc('0x31')]};});_0x45e6bf[_0xd8fc('0x32')]=_[_0xd8fc('0x2d')](_0x23a6f4,_0xd8fc('0x2b'));_0x45e6bf['query']=_[_0xd8fc('0x33')](_0x41dea0[_0xd8fc('0x34')]);_0x45e6bf[_0xd8fc('0x35')]=_[_0xd8fc('0x36')](_0x45e6bf[_0xd8fc('0x32')],_0x45e6bf[_0xd8fc('0x34')]);_0x1444ab[_0xd8fc('0x37')]=_['intersection'](_0x45e6bf[_0xd8fc('0x32')],qs['fields'](_0x41dea0['query']['fields']));_0x1444ab[_0xd8fc('0x37')]=_0x1444ab['attributes']['length']?_0x1444ab[_0xd8fc('0x37')]:_0x45e6bf['model'];if(!_0x41dea0[_0xd8fc('0x34')][_0xd8fc('0x38')](_0xd8fc('0x39'))){_0x1444ab['limit']=qs[_0xd8fc('0x20')](_0x41dea0[_0xd8fc('0x34')]['limit']);_0x1444ab[_0xd8fc('0x21')]=qs[_0xd8fc('0x21')](_0x41dea0[_0xd8fc('0x34')][_0xd8fc('0x21')]);}_0x1444ab[_0xd8fc('0x3a')]=qs[_0xd8fc('0x3b')](_0x41dea0['query'][_0xd8fc('0x3b')]);_0x1444ab['where']=qs[_0xd8fc('0x35')](_[_0xd8fc('0x3c')](_0x41dea0[_0xd8fc('0x34')],_0x45e6bf['filters']),_0x23a6f4);if(_0x41dea0[_0xd8fc('0x34')][_0xd8fc('0x3d')]){_0x1444ab[_0xd8fc('0x3e')]=_[_0xd8fc('0x3f')](_0x1444ab[_0xd8fc('0x3e')],{'$or':_[_0xd8fc('0x2d')](_0x23a6f4,function(_0x410306){if(_0x410306[_0xd8fc('0x30')]!==_0xd8fc('0x40')){var _0x542d73={};_0x542d73[_0x410306[_0xd8fc('0x2b')]]={'$like':'%'+_0x41dea0['query'][_0xd8fc('0x3d')]+'%'};return _0x542d73;}})});}_0x1444ab=_[_0xd8fc('0x3f')]({},_0x1444ab,_0x41dea0['options']);var _0x2b54ea={'where':_0x1444ab['where']};return db[_0xd8fc('0x41')]['count'](_0x2b54ea)[_0xd8fc('0x28')](function(_0x278a52){_0x1bad1f[_0xd8fc('0x22')]=_0x278a52;if(_0x41dea0['query'][_0xd8fc('0x42')]){_0x1444ab['include']=[{'all':!![]}];}return db[_0xd8fc('0x41')]['findAll'](_0x1444ab);})[_0xd8fc('0x28')](function(_0x4c6a87){_0x1bad1f[_0xd8fc('0x43')]=_0x4c6a87;return _0x1bad1f;})[_0xd8fc('0x28')](respondWithFilteredResult(_0x554f15,_0x1444ab))[_0xd8fc('0x44')](handleError(_0x554f15,null));};exports['show']=function(_0x4fe69d,_0x12e7f2){var _0x4dc5ed={'raw':![],'where':{'id':_0x4fe69d[_0xd8fc('0x45')]['id']}},_0x1857b7={};_0x1857b7['model']=_[_0xd8fc('0x33')](db[_0xd8fc('0x41')][_0xd8fc('0x2e')]);_0x1857b7[_0xd8fc('0x34')]=_[_0xd8fc('0x33')](_0x4fe69d[_0xd8fc('0x34')]);_0x1857b7[_0xd8fc('0x35')]=_[_0xd8fc('0x36')](_0x1857b7[_0xd8fc('0x32')],_0x1857b7['query']);_0x4dc5ed[_0xd8fc('0x37')]=_['intersection'](_0x1857b7[_0xd8fc('0x32')],qs['fields'](_0x4fe69d[_0xd8fc('0x34')][_0xd8fc('0x46')]));_0x4dc5ed['attributes']=_0x4dc5ed[_0xd8fc('0x37')][_0xd8fc('0x47')]?_0x4dc5ed[_0xd8fc('0x37')]:_0x1857b7['model'];if(_0x4fe69d['query'][_0xd8fc('0x42')]){_0x4dc5ed[_0xd8fc('0x48')]=[{'all':!![]}];}_0x4dc5ed=_['merge']({},_0x4dc5ed,_0x4fe69d['options']);return db[_0xd8fc('0x41')][_0xd8fc('0x49')](_0x4dc5ed)[_0xd8fc('0x28')](handleEntityNotFound(_0x12e7f2,null))[_0xd8fc('0x28')](respondWithResult(_0x12e7f2,null))[_0xd8fc('0x44')](handleError(_0x12e7f2,null));};exports[_0xd8fc('0x4a')]=function(_0x3e8199,_0x2d331f){return db[_0xd8fc('0x41')]['create'](_0x3e8199['body'],{})['then'](function(_0x324258){var _0x44e851=_0x3e8199[_0xd8fc('0x4b')]['get']({'plain':!![]});if(!_0x44e851)throw new Error(_0xd8fc('0x4c'));if(_0x44e851[_0xd8fc('0x4d')]===_0xd8fc('0x4b')){var _0x2f68b3=_0x324258[_0xd8fc('0x4e')]({'plain':!![]});var _0x2567d1=_0xd8fc('0x4f');return db['UserProfileSection'][_0xd8fc('0x49')]({'where':{'name':_0x2567d1,'userProfileId':_0x44e851[_0xd8fc('0x50')]},'raw':!![]})['then'](function(_0x430d75){if(_0x430d75&&_0x430d75[_0xd8fc('0x51')]===0x0){return db[_0xd8fc('0x52')][_0xd8fc('0x4a')]({'name':_0x2f68b3['name'],'resourceId':_0x2f68b3['id'],'type':_0x430d75[_0xd8fc('0x2b')],'sectionId':_0x430d75['id']},{})['then'](function(){return _0x324258;});}else{return _0x324258;}})[_0xd8fc('0x44')](function(_0x32e38a){logger[_0xd8fc('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32e38a);throw _0x32e38a;});}return _0x324258;})['then'](respondWithResult(_0x2d331f,0xc9))[_0xd8fc('0x44')](handleError(_0x2d331f,null));};exports[_0xd8fc('0x27')]=function(_0xc7ae38,_0x461a5f){if(_0xc7ae38[_0xd8fc('0x53')]['id']){delete _0xc7ae38[_0xd8fc('0x53')]['id'];}return db[_0xd8fc('0x41')][_0xd8fc('0x49')]({'where':{'id':_0xc7ae38[_0xd8fc('0x45')]['id']}})[_0xd8fc('0x28')](handleEntityNotFound(_0x461a5f,null))[_0xd8fc('0x28')](saveUpdates(_0xc7ae38['body'],null))[_0xd8fc('0x28')](respondWithResult(_0x461a5f,null))['catch'](handleError(_0x461a5f,null));};exports[_0xd8fc('0x54')]=function(_0x234711,_0x4f973d){var _0x5492b5=_0x234711[_0xd8fc('0x45')]['id'];var _0x33b36c=[];return db[_0xd8fc('0x55')]['transaction'](function(_0x25f5fa){var _0x3ead23=_0xd8fc('0x56')+_0x5492b5;return db[_0xd8fc('0x55')][_0xd8fc('0x34')](_0x3ead23,{'type':db['Sequelize'][_0xd8fc('0x57')][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa})[_0xd8fc('0x28')](function(_0x5439f0){_0x33b36c=_['map'](_0x5439f0,function(_0x45f69e){return Number(_0x45f69e[_0xd8fc('0x59')]);});})[_0xd8fc('0x28')](function(){var _0x436a0f=_0xd8fc('0x5a')+_0x5492b5;return db[_0xd8fc('0x55')][_0xd8fc('0x34')](_0x436a0f,{'type':db['Sequelize'][_0xd8fc('0x57')][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x16da6d){var _0x3d9088=_[_0xd8fc('0x2d')](_0x16da6d,function(_0x5cf77f){return Number(_0x5cf77f[_0xd8fc('0x5b')]);});return db[_0xd8fc('0x5c')][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'VoiceQueueId':{'$in':_0x3d9088}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){var _0x2a9d00=_0xd8fc('0x5d')+_0x5492b5;return db[_0xd8fc('0x55')][_0xd8fc('0x34')](_0x2a9d00,{'type':db['Sequelize'][_0xd8fc('0x57')][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x4e7cef){var _0x2b8e3a=_[_0xd8fc('0x2d')](_0x4e7cef,function(_0x3792cb){return Number(_0x3792cb['MailQueueId']);});return db[_0xd8fc('0x5e')][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'MailQueueId':{'$in':_0x2b8e3a}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){var _0x129f77='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5492b5;return db['sequelize'][_0xd8fc('0x34')](_0x129f77,{'type':db[_0xd8fc('0x5f')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x38fcdb){var _0x43311d=_[_0xd8fc('0x2d')](_0x38fcdb,function(_0x2694c4){return Number(_0x2694c4[_0xd8fc('0x60')]);});return db['UserSmsQueue'][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'SmsQueueId':{'$in':_0x43311d}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){var _0x2ba296='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5492b5;return db['sequelize'][_0xd8fc('0x34')](_0x2ba296,{'type':db[_0xd8fc('0x5f')][_0xd8fc('0x57')][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x195e79){var _0x15f33f=_[_0xd8fc('0x2d')](_0x195e79,function(_0x1e85e2){return Number(_0x1e85e2['ChatQueueId']);});return db['UserChatQueue'][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'ChatQueueId':{'$in':_0x15f33f}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){var _0x14c20f='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5492b5;return db[_0xd8fc('0x55')]['query'](_0x14c20f,{'type':db[_0xd8fc('0x5f')][_0xd8fc('0x57')][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa});})['then'](function(_0x36a821){var _0x24a293=_['map'](_0x36a821,function(_0x13af6e){return Number(_0x13af6e[_0xd8fc('0x61')]);});return db['UserFaxQueue'][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'FaxQueueId':{'$in':_0x24a293}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){var _0x22d4f5=_0xd8fc('0x62')+_0x5492b5;return db[_0xd8fc('0x55')]['query'](_0x22d4f5,{'type':db['Sequelize']['QueryTypes'][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x163851){var _0x591ac4=_[_0xd8fc('0x2d')](_0x163851,function(_0x3628ed){return Number(_0x3628ed['OpenchannelQueueId']);});return db[_0xd8fc('0x63')]['destroy']({'where':{'UserId':{'$in':_0x33b36c},'OpenchannelQueueId':{'$in':_0x591ac4}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){var _0x5c45b2=_0xd8fc('0x64')+_0x5492b5;return db[_0xd8fc('0x55')][_0xd8fc('0x34')](_0x5c45b2,{'type':db[_0xd8fc('0x5f')]['QueryTypes'][_0xd8fc('0x58')],'raw':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x446b53){var _0x4cdfb1=_[_0xd8fc('0x2d')](_0x446b53,function(_0x1e3003){return Number(_0x1e3003[_0xd8fc('0x65')]);});return db[_0xd8fc('0x66')][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'WhatsappQueueId':{'$in':_0x4cdfb1}},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){return db[_0xd8fc('0x67')][_0xd8fc('0x49')]({'where':{'TeamId':_0x5492b5}});})[_0xd8fc('0x28')](function(_0xa7df00){if(_0xa7df00===null){return;}return db[_0xd8fc('0x68')][_0xd8fc('0x54')]({'where':{'UserId':{'$in':_0x33b36c},'VoicePrefixId':_0xa7df00[_0xd8fc('0x69')]},'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(){return db[_0xd8fc('0x41')]['destroy']({'where':{'id':_0x5492b5},'cascade':!![],'transaction':_0x25f5fa});})[_0xd8fc('0x28')](function(_0x3de896){if(_0x3de896===0x0){_0x4f973d[_0xd8fc('0x1b')](0x194);}else{return db[_0xd8fc('0x52')][_0xd8fc('0x54')]({'where':{'type':'Teams','resourceId':_0x5492b5},'cascade':!![],'transaction':_0x25f5fa})[_0xd8fc('0x28')](function(){_0x4f973d[_0xd8fc('0x1c')](0xcc)[_0xd8fc('0x1d')]();});}})[_0xd8fc('0x44')](function(_0x1c8eb0){_0x4f973d[_0xd8fc('0x1c')](0x1f4)[_0xd8fc('0x2c')](_0x1c8eb0);});});};exports[_0xd8fc('0x6a')]=function(_0x13237e,_0x5c64ff,_0x5985fc){return db[_0xd8fc('0x41')][_0xd8fc('0x6b')]({'where':{'id':_0x13237e['params']['id']}})[_0xd8fc('0x28')](handleEntityNotFound(_0x5c64ff,null))[_0xd8fc('0x28')](function(_0x20c025){if(!_0x13237e[_0xd8fc('0x34')]['channel']||!utils[_0xd8fc('0x6c')](_0x13237e[_0xd8fc('0x34')][_0xd8fc('0x6d')])){throw new db['Sequelize']['ValidationError'](_0xd8fc('0x6e'));}var _0x36caef={};var _0x2d96f2={};_0x2d96f2[_0xd8fc('0x32')]=_[_0xd8fc('0x33')](db[_['capitalize'](_0x13237e[_0xd8fc('0x34')][_0xd8fc('0x6d')][_0xd8fc('0x6f')]())+_0xd8fc('0x70')][_0xd8fc('0x2e')]);_0x2d96f2[_0xd8fc('0x34')]=_[_0xd8fc('0x33')](_0x13237e[_0xd8fc('0x34')]);_0x2d96f2[_0xd8fc('0x35')]=_[_0xd8fc('0x36')](_0x2d96f2[_0xd8fc('0x32')],_0x2d96f2[_0xd8fc('0x34')]);_0x36caef[_0xd8fc('0x37')]=_[_0xd8fc('0x36')](_0x2d96f2[_0xd8fc('0x32')],qs[_0xd8fc('0x46')](_0x13237e[_0xd8fc('0x34')][_0xd8fc('0x46')]));_0x36caef['attributes']=_0x36caef[_0xd8fc('0x37')]['length']?_0x36caef['attributes']:_0x2d96f2[_0xd8fc('0x32')];_0x36caef[_0xd8fc('0x20')]=qs['limit'](_0x13237e['query'][_0xd8fc('0x20')]);_0x36caef['offset']=qs['offset'](_0x13237e['query'][_0xd8fc('0x21')]);_0x36caef['order']=qs[_0xd8fc('0x3b')](_0x13237e[_0xd8fc('0x34')][_0xd8fc('0x3b')]);_0x36caef[_0xd8fc('0x3e')]=qs[_0xd8fc('0x35')](_[_0xd8fc('0x3c')](_0x13237e[_0xd8fc('0x34')],_0x2d96f2[_0xd8fc('0x35')]));_0x36caef=_['merge']({},_0x36caef,_0x13237e[_0xd8fc('0x71')]);return _0x20c025[_0xd8fc('0x4e')+_[_0xd8fc('0x72')](_0x13237e[_0xd8fc('0x34')][_0xd8fc('0x6d')][_0xd8fc('0x6f')]())+_0xd8fc('0x73')](_0x36caef);})[_0xd8fc('0x28')](respondWithResult(_0x5c64ff,null))['catch'](handleError(_0x5c64ff,null));};exports[_0xd8fc('0x74')]=function(_0x552e82,_0x59086a,_0xfab491){return db[_0xd8fc('0x41')][_0xd8fc('0x6b')]({'where':{'id':_0x552e82['params']['id']}})[_0xd8fc('0x28')](function(_0x1971f2){if(_0x1971f2){if(!_0x552e82[_0xd8fc('0x53')][_0xd8fc('0x6d')]||!utils[_0xd8fc('0x6c')](_0x552e82[_0xd8fc('0x53')]['channel'])){throw new db[(_0xd8fc('0x5f'))][(_0xd8fc('0x75'))](_0xd8fc('0x6e'));}return _0x1971f2['add'+_[_0xd8fc('0x72')](_0x552e82[_0xd8fc('0x53')][_0xd8fc('0x6d')][_0xd8fc('0x6f')]())+_0xd8fc('0x73')](_0x552e82[_0xd8fc('0x53')]['ids']);}return null;})[_0xd8fc('0x28')](handleEntityNotFound(_0x59086a,null))['then'](respondWithStatusCode(_0x59086a,null))['catch'](handleError(_0x59086a,null));};exports[_0xd8fc('0x76')]=function(_0x340f86,_0x35ba9f,_0x3109f5){return db['Team'][_0xd8fc('0x6b')]({'where':{'id':_0x340f86[_0xd8fc('0x45')]['id']}})[_0xd8fc('0x28')](function(_0x52256a){if(_0x52256a){if(!_0x340f86[_0xd8fc('0x34')][_0xd8fc('0x6d')]||!utils[_0xd8fc('0x6c')](_0x340f86[_0xd8fc('0x34')][_0xd8fc('0x6d')])){throw new db[(_0xd8fc('0x5f'))][(_0xd8fc('0x75'))](_0xd8fc('0x6e'));}return _0x52256a['remove'+_[_0xd8fc('0x72')](_0x340f86[_0xd8fc('0x34')][_0xd8fc('0x6d')][_0xd8fc('0x6f')]())+_0xd8fc('0x73')](_0x340f86[_0xd8fc('0x34')][_0xd8fc('0x77')]);}return null;})[_0xd8fc('0x28')](handleEntityNotFound(_0x35ba9f,null))['then'](respondWithStatusCode(_0x35ba9f,null))['catch'](handleError(_0x35ba9f,null));};exports[_0xd8fc('0x78')]=function(_0x106325,_0xc3e3fa){var _0xabe97c=_['isArray'](_0x106325[_0xd8fc('0x53')][_0xd8fc('0x77')])?_0x106325[_0xd8fc('0x53')]['ids']:[_0x106325['body']['ids']];var _0x1c463a=_0x106325[_0xd8fc('0x45')]['id'];return db[_0xd8fc('0x41')][_0xd8fc('0x49')]({'where':{'id':_0x1c463a}})['then'](handleEntityNotFound(_0xc3e3fa,null))['then'](function(_0x2b5fbb){if(_0x2b5fbb){var _0x49a5cc=[_0xd8fc('0x79'),_0xd8fc('0x7a'),'Mail',_0xd8fc('0x7b'),_0xd8fc('0x7c'),'Openchannel',_0xd8fc('0x7d')];return db[_0xd8fc('0x55')][_0xd8fc('0x7e')](function(_0x3ce756){var _0x1f61ab=_[_0xd8fc('0x2d')](_0x49a5cc,function(_0xe3801b){var _0x5c9acb={'attributes':['id',_0xd8fc('0x2b')]};if(_0xe3801b===_0xd8fc('0x79')){_0x5c9acb[_0xd8fc('0x7f')]={'attributes':['penalty']};}return _0x2b5fbb[_0xd8fc('0x4e')+_0xe3801b+'Queues'](_0x5c9acb)[_0xd8fc('0x28')](function(_0x339e50){var _0x408ddf=_[_0xd8fc('0x2d')](_0x339e50,function(_0x485605){var _0x9b3350=_[_0xd8fc('0x2d')](_0xabe97c,function(_0x3bcfbf){var _0x3d95ff={'where':{'UserId':_0x3bcfbf,[_0xe3801b+_0xd8fc('0x80')]:_0x485605['id']},'transaction':_0x3ce756};if(_0xe3801b==='Voice'){_0x3d95ff['defaults']={'penalty':_0x485605[_0xd8fc('0x81')][_0xd8fc('0x82')]};}return db[_0xd8fc('0x83')+_0xe3801b+_0xd8fc('0x70')][_0xd8fc('0x84')](_0x3d95ff)[_0xd8fc('0x28')](function(){socket[_0xd8fc('0x85')]('user'+_0xe3801b+_0xd8fc('0x86'),{'UserId':_0x3bcfbf,[_0xe3801b+_0xd8fc('0x80')]:_0x485605['id']});if(_0xe3801b!=='Voice'){return;}return db[_0xd8fc('0x83')]['findAll']({'where':{'id':_0xabe97c,'online':0x1},'attributes':['id',_0xd8fc('0x2b'),_0xd8fc('0x87'),'voicePause',_0xd8fc('0x88')],'raw':!![]})[_0xd8fc('0x28')](function(_0x44a70f){var _0x3f7315=_[_0xd8fc('0x2d')](_0x44a70f,function(_0x11d8fb){return db[_0xd8fc('0x89')][_0xd8fc('0x8a')]({'membername':_0x11d8fb[_0xd8fc('0x2b')],'UserId':_0x11d8fb['id'],'queue_name':_0x485605[_0xd8fc('0x2b')],'VoiceQueueId':_0x485605['id'],'interface':_[_0xd8fc('0x8b')](_0x11d8fb[_0xd8fc('0x88')])?util[_0xd8fc('0x8c')](_0xd8fc('0x8d'),_0x11d8fb[_0xd8fc('0x2b')]):_0x11d8fb['interface'],'paused':_0x11d8fb[_0xd8fc('0x8e')]||![],'penalty':_0x485605['TeamVoiceQueue'][_0xd8fc('0x82')]},{'transaction':_0x3ce756});});return Promise[_0xd8fc('0x8f')](_0x3f7315);});});});return Promise[_0xd8fc('0x8f')](_0x9b3350);});return Promise[_0xd8fc('0x8f')](_0x408ddf);})[_0xd8fc('0x28')](function(){return db[_0xd8fc('0x67')]['findOne']({'where':{'teamId':_0x1c463a}})[_0xd8fc('0x28')](function(_0x8d82d){if(_0x8d82d){var _0x5b2573=_[_0xd8fc('0x2d')](_0xabe97c,function(_0x188fcd){db[_0xd8fc('0x68')][_0xd8fc('0x8a')]({'UserId':_0x188fcd,'VoicePrefixId':_0x8d82d['VoicePrefixId']});});return Promise[_0xd8fc('0x8f')](_0x5b2573);}});});});return Promise['all'](_0x1f61ab)[_0xd8fc('0x28')](function(){return _0x2b5fbb['addAgents'](_0xabe97c,{'transaction':_0x3ce756})[_0xd8fc('0x90')](function(_0x346f00){return _0x346f00;});});});}})[_0xd8fc('0x28')](respondWithResult(_0xc3e3fa,null))[_0xd8fc('0x44')](handleError(_0xc3e3fa,null));};exports[_0xd8fc('0x91')]=function(_0x3eef54,_0x4e8d8d){var _0x48454b=_[_0xd8fc('0x92')](_0x3eef54[_0xd8fc('0x34')]['ids'])?_0x3eef54[_0xd8fc('0x34')]['ids']:[_0x3eef54[_0xd8fc('0x34')][_0xd8fc('0x77')]];var _0x5ad1b9=_0x3eef54['params']['id'];return db[_0xd8fc('0x41')][_0xd8fc('0x49')]({'where':{'id':_0x5ad1b9}})[_0xd8fc('0x28')](handleEntityNotFound(_0x4e8d8d,null))[_0xd8fc('0x28')](function(_0x3d838b){if(_0x3d838b){var _0x20208a=[_0xd8fc('0x79'),_0xd8fc('0x7a'),_0xd8fc('0x93'),_0xd8fc('0x7b'),_0xd8fc('0x7c'),_0xd8fc('0x94'),_0xd8fc('0x7d')];return db[_0xd8fc('0x55')][_0xd8fc('0x7e')](function(_0x224090){var _0x31406c=_[_0xd8fc('0x2d')](_0x20208a,function(_0x492e0f){var _0x110c80={'attributes':['id',_0xd8fc('0x2b')]};return _0x3d838b['get'+_0x492e0f+_0xd8fc('0x73')](_0x110c80)[_0xd8fc('0x28')](function(_0x730fdd){var _0x47657e=_[_0xd8fc('0x2d')](_0x730fdd,function(_0xed605c){return _0xed605c[_0xd8fc('0x91')](_0x48454b,{'transaction':_0x224090})[_0xd8fc('0x28')](function(){var _0x5b5ce9=_[_0xd8fc('0x2d')](_0x48454b,function(_0x8c8e24){socket[_0xd8fc('0x85')]('user'+_0x492e0f+'Queue:remove',{'UserId':Number(_0x8c8e24),[_0x492e0f+_0xd8fc('0x80')]:_0xed605c['id']});if(_0x492e0f!==_0xd8fc('0x79')){return;}return db['UserVoiceQueueRt'][_0xd8fc('0x54')]({'where':{'VoiceQueueId':_0xed605c['id'],'UserId':_0x8c8e24},'transaction':_0x224090});});return Promise[_0xd8fc('0x8f')](_0x5b5ce9);});});return Promise[_0xd8fc('0x8f')](_0x47657e);});});return Promise[_0xd8fc('0x8f')](_0x31406c)[_0xd8fc('0x28')](function(){return _0x3d838b[_0xd8fc('0x91')](_0x48454b,{'transaction':_0x224090});})[_0xd8fc('0x28')](function(){return db[_0xd8fc('0x67')][_0xd8fc('0x6b')]({'where':{'teamId':_0x5ad1b9}})['then'](function(_0x37fc6f){if(_0x37fc6f){var _0x2c5c55=_[_0xd8fc('0x2d')](_0x48454b,function(_0x155410){db[_0xd8fc('0x68')][_0xd8fc('0x54')]({'where':{'UserId':_0x155410,'VoicePrefixId':_0x37fc6f['VoicePrefixId']}});});return Promise[_0xd8fc('0x8f')](_0x2c5c55);}});});});}})[_0xd8fc('0x28')](respondWithStatusCode(_0x4e8d8d,null))[_0xd8fc('0x44')](handleError(_0x4e8d8d,null));};exports[_0xd8fc('0x95')]=function(_0x5b5179,_0x10957d,_0x6712e5){var _0x2e7bd8={};var _0x815323={};var _0x15866e;var _0x60d325;return db['Team'][_0xd8fc('0x6b')]({'where':{'id':_0x5b5179['params']['id']}})[_0xd8fc('0x28')](handleEntityNotFound(_0x10957d,null))[_0xd8fc('0x28')](function(_0x383373){if(_0x383373){_0x15866e=_0x383373;_0x815323[_0xd8fc('0x32')]=_[_0xd8fc('0x33')](db[_0xd8fc('0x83')][_0xd8fc('0x2e')]);_0x815323[_0xd8fc('0x34')]=_[_0xd8fc('0x33')](_0x5b5179['query']);_0x815323[_0xd8fc('0x35')]=_[_0xd8fc('0x36')](_0x815323[_0xd8fc('0x32')],_0x815323[_0xd8fc('0x34')]);_0x2e7bd8[_0xd8fc('0x37')]=_['intersection'](_0x815323[_0xd8fc('0x32')],qs[_0xd8fc('0x46')](_0x5b5179[_0xd8fc('0x34')][_0xd8fc('0x46')]));_0x2e7bd8[_0xd8fc('0x37')]=_0x2e7bd8[_0xd8fc('0x37')][_0xd8fc('0x47')]?_0x2e7bd8['attributes']:_0x815323[_0xd8fc('0x32')];_0x2e7bd8['order']=qs['sort'](_0x5b5179[_0xd8fc('0x34')][_0xd8fc('0x3b')]);_0x2e7bd8[_0xd8fc('0x3e')]=qs[_0xd8fc('0x35')](_[_0xd8fc('0x3c')](_0x5b5179[_0xd8fc('0x34')],_0x815323[_0xd8fc('0x35')]));if(_0x5b5179[_0xd8fc('0x34')][_0xd8fc('0x3d')]){_0x2e7bd8['where']=_['merge'](_0x2e7bd8[_0xd8fc('0x3e')],{'$or':_[_0xd8fc('0x2d')](_0x2e7bd8['attributes'],function(_0x1b9b9a){var _0x28a822={};_0x28a822[_0x1b9b9a]={'$like':'%'+_0x5b5179[_0xd8fc('0x34')][_0xd8fc('0x3d')]+'%'};return _0x28a822;})});}_0x2e7bd8=_[_0xd8fc('0x3f')]({},_0x2e7bd8,_0x5b5179[_0xd8fc('0x71')]);return _0x15866e[_0xd8fc('0x95')](_0x2e7bd8);}})[_0xd8fc('0x28')](function(_0x5679c7){if(_0x5679c7){_0x60d325=_0x5679c7['length'];if(!_0x5b5179['query']['hasOwnProperty'](_0xd8fc('0x39'))){_0x2e7bd8[_0xd8fc('0x20')]=qs[_0xd8fc('0x20')](_0x5b5179[_0xd8fc('0x34')]['limit']);_0x2e7bd8[_0xd8fc('0x21')]=qs['offset'](_0x5b5179[_0xd8fc('0x34')][_0xd8fc('0x21')]);}return _0x15866e[_0xd8fc('0x95')](_0x2e7bd8);}})['then'](function(_0x5bdd2f){if(_0x5bdd2f){return _0x5bdd2f?{'count':_0x60d325,'rows':_0x5bdd2f}:null;}})[_0xd8fc('0x28')](respondWithResult(_0x10957d,null))['catch'](handleError(_0x10957d,null));};
\ No newline at end of file
index 83e6275..6d0fd61 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34d2=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4abe2d,_0x1a5460){var _0x5ce871=function(_0x460a4c){while(--_0x460a4c){_0x4abe2d['push'](_0x4abe2d['shift']());}};_0x5ce871(++_0x1a5460);}(_0x34d2,0x16d));var _0x234d=function(_0x481ee4,_0x4f2aa3){_0x481ee4=_0x481ee4-0x0;var _0x442628=_0x34d2[_0x481ee4];return _0x442628;};'use strict';var EventEmitter=require(_0x234d('0x0'));var Team=require(_0x234d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x234d('0x2')](0x0);var events={'afterCreate':_0x234d('0x3'),'afterUpdate':_0x234d('0x4'),'afterDestroy':_0x234d('0x5')};function emitEvent(_0x2e24f9){return function(_0x3970ef,_0x446105,_0x8870e1){TeamEvents['emit'](_0x2e24f9+':'+_0x3970ef['id'],_0x3970ef);TeamEvents[_0x234d('0x6')](_0x2e24f9,_0x3970ef);_0x8870e1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x234d('0x7')](e,emitEvent(event));}}module[_0x234d('0x8')]=TeamEvents;
\ No newline at end of file
+var _0x92e3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x7c457f,_0x15d290){var _0x3a98ad=function(_0xb6ed4e){while(--_0xb6ed4e){_0x7c457f['push'](_0x7c457f['shift']());}};_0x3a98ad(++_0x15d290);}(_0x92e3,0x1d2));var _0x392e=function(_0x68a151,_0x21c4cc){_0x68a151=_0x68a151-0x0;var _0x5bb5ea=_0x92e3[_0x68a151];return _0x5bb5ea;};'use strict';var EventEmitter=require(_0x392e('0x0'));var Team=require(_0x392e('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x392e('0x2')](0x0);var events={'afterCreate':_0x392e('0x3'),'afterUpdate':_0x392e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x183f43){return function(_0x462903,_0x4ed2df,_0x436d40){TeamEvents[_0x392e('0x5')](_0x183f43+':'+_0x462903['id'],_0x462903);TeamEvents['emit'](_0x183f43,_0x462903);_0x436d40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x392e('0x6')](e,emitEvent(event));}}module[_0x392e('0x7')]=TeamEvents;
\ No newline at end of file
index 5a553f8..6132e17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c22=['all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0c22,0x13c));var _0x20c2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0c22[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x20c2('0x0'));var attributes=require(_0x20c2('0x1'));function getQueuesByChannel(_0x1eae29,_0x36de0c){var _0x5a3207=_0x20c2('0x2')+_0x36de0c+_0x20c2('0x3');return _0x1eae29[_0x5a3207]()[_0x20c2('0x4')](function(_0x27be87){return _[_0x20c2('0x5')](_0x27be87,function(_0x2693f7){_0x2693f7[_0x20c2('0x6')](_0x20c2('0x7'),_0x36de0c);return _0x2693f7;});})[_0x20c2('0x8')](function(_0x1ba04e){throw _0x1ba04e;});}module[_0x20c2('0x9')]=function(_0x348894){return _0x348894[_0x20c2('0xa')](_0x20c2('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5cb007=this;var _0x24f1ae=[_0x20c2('0xc'),_0x20c2('0xd'),_0x20c2('0xe'),_0x20c2('0xf'),_0x20c2('0x10'),_0x20c2('0x11'),_0x20c2('0x12')];return Promise[_0x20c2('0x13')]()[_0x20c2('0x4')](function(){var _0x4762e7=_[_0x20c2('0x5')](_0x24f1ae,function(_0x58e4d8){return getQueuesByChannel(_0x5cb007,_0x58e4d8);});return Promise[_0x20c2('0x14')](_0x4762e7);})['catch'](function(_0x134df3){throw _0x134df3;});}}});};
\ No newline at end of file
+var _0xb775=['map','all','lodash','./team.attributes','get','Queues','setDataValue','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve'];(function(_0x157c25,_0xbec233){var _0x225ddc=function(_0x261fd6){while(--_0x261fd6){_0x157c25['push'](_0x157c25['shift']());}};_0x225ddc(++_0xbec233);}(_0xb775,0x16b));var _0x5b77=function(_0x403179,_0x502c6a){_0x403179=_0x403179-0x0;var _0x104d8c=_0xb775[_0x403179];return _0x104d8c;};'use strict';var _=require(_0x5b77('0x0'));var attributes=require(_0x5b77('0x1'));function getQueuesByChannel(_0x34ec36,_0x2dcb45){var _0x575663=_0x5b77('0x2')+_0x2dcb45+_0x5b77('0x3');return _0x34ec36[_0x575663]()['then'](function(_0x21a041){return _['map'](_0x21a041,function(_0x257618){_0x257618[_0x5b77('0x4')]('channel',_0x2dcb45);return _0x257618;});})['catch'](function(_0x4b0f3e){throw _0x4b0f3e;});}module[_0x5b77('0x5')]=function(_0x5d4b8e){return _0x5d4b8e[_0x5b77('0x6')](_0x5b77('0x7'),attributes,{'tableName':_0x5b77('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x20680e=this;var _0x15b6c7=[_0x5b77('0x9'),_0x5b77('0xa'),_0x5b77('0xb'),_0x5b77('0xc'),_0x5b77('0xd'),_0x5b77('0xe'),_0x5b77('0xf')];return Promise[_0x5b77('0x10')]()['then'](function(){var _0x3b058b=_[_0x5b77('0x11')](_0x15b6c7,function(_0x2502a0){return getQueuesByChannel(_0x20680e,_0x2502a0);});return Promise[_0x5b77('0x12')](_0x3b058b);})['catch'](function(_0x269511){throw _0x269511;});}}});};
\ No newline at end of file
index 55989c1..d1793dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a5f=['message','Team,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error'];(function(_0x5e98e1,_0x435754){var _0x34d167=function(_0x45531d){while(--_0x45531d){_0x5e98e1['push'](_0x5e98e1['shift']());}};_0x34d167(++_0x435754);}(_0x0a5f,0x155));var _0xf0a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a5f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf0a5('0x0'));var util=require(_0xf0a5('0x1'));var moment=require(_0xf0a5('0x2'));var BPromise=require(_0xf0a5('0x3'));var rs=require(_0xf0a5('0x4'));var fs=require('fs');var Redis=require(_0xf0a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf0a5('0x6'))('rpc');var config=require(_0xf0a5('0x7'));var jayson=require(_0xf0a5('0x8'));var client=jayson[_0xf0a5('0x9')][_0xf0a5('0xa')]({'port':0x232a});config[_0xf0a5('0xb')]=_[_0xf0a5('0xc')](config[_0xf0a5('0xb')],{'host':_0xf0a5('0xd'),'port':0x18eb});var socket=require(_0xf0a5('0xe'))(new Redis(config['redis']));require('./team.socket')[_0xf0a5('0xf')](socket);function respondWithRpcPromise(_0x57c75b,_0x8f7a83,_0x226e99){return new BPromise(function(_0x12c606,_0xe81968){return client[_0xf0a5('0x10')](_0x57c75b,_0x226e99)[_0xf0a5('0x11')](function(_0x5978c3){logger[_0xf0a5('0x12')]('Team,\x20%s,\x20%s',_0x8f7a83,_0xf0a5('0x13'));logger[_0xf0a5('0x14')](_0xf0a5('0x15'),_0x8f7a83,_0xf0a5('0x13'),JSON['stringify'](_0x5978c3));if(_0x5978c3[_0xf0a5('0x16')]){if(_0x5978c3[_0xf0a5('0x16')]['code']===0x1f4){logger[_0xf0a5('0x16')]('Team,\x20%s,\x20%s',_0x8f7a83,_0x5978c3['error']['message']);return _0xe81968(_0x5978c3['error'][_0xf0a5('0x17')]);}logger[_0xf0a5('0x16')](_0xf0a5('0x18'),_0x8f7a83,_0x5978c3['error'][_0xf0a5('0x17')]);return _0x12c606(_0x5978c3[_0xf0a5('0x16')][_0xf0a5('0x17')]);}else{logger[_0xf0a5('0x12')]('Team,\x20%s,\x20%s',_0x8f7a83,'request\x20sent');_0x12c606(_0x5978c3['result'][_0xf0a5('0x17')]);}})[_0xf0a5('0x19')](function(_0x31fd37){logger[_0xf0a5('0x16')](_0xf0a5('0x18'),_0x8f7a83,_0x31fd37);_0xe81968(_0x31fd37);});});}
\ No newline at end of file
+var _0xe02e=['then','info','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x2715a9,_0x14247e){var _0x224ef6=function(_0x284c0e){while(--_0x284c0e){_0x2715a9['push'](_0x2715a9['shift']());}};_0x224ef6(++_0x14247e);}(_0xe02e,0x1f0));var _0xee02=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe02e[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xee02('0x0'));var moment=require(_0xee02('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee02('0x2'));var db=require(_0xee02('0x3'))['db'];var utils=require(_0xee02('0x4'));var logger=require(_0xee02('0x5'))(_0xee02('0x6'));var config=require(_0xee02('0x7'));var jayson=require(_0xee02('0x8'));var client=jayson[_0xee02('0x9')]['http']({'port':0x232a});config[_0xee02('0xa')]=_[_0xee02('0xb')](config[_0xee02('0xa')],{'host':_0xee02('0xc'),'port':0x18eb});var socket=require(_0xee02('0xd'))(new Redis(config['redis']));require(_0xee02('0xe'))[_0xee02('0xf')](socket);function respondWithRpcPromise(_0x56200b,_0x461c97,_0x59b56e){return new BPromise(function(_0x2297bf,_0x1eb312){return client[_0xee02('0x10')](_0x56200b,_0x59b56e)[_0xee02('0x11')](function(_0x5ab718){logger[_0xee02('0x12')](_0xee02('0x13'),_0x461c97,_0xee02('0x14'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x461c97,_0xee02('0x14'),JSON[_0xee02('0x15')](_0x5ab718));if(_0x5ab718[_0xee02('0x16')]){if(_0x5ab718[_0xee02('0x16')][_0xee02('0x17')]===0x1f4){logger[_0xee02('0x16')](_0xee02('0x13'),_0x461c97,_0x5ab718[_0xee02('0x16')]['message']);return _0x1eb312(_0x5ab718[_0xee02('0x16')][_0xee02('0x18')]);}logger[_0xee02('0x16')](_0xee02('0x13'),_0x461c97,_0x5ab718[_0xee02('0x16')][_0xee02('0x18')]);return _0x2297bf(_0x5ab718['error'][_0xee02('0x18')]);}else{logger[_0xee02('0x12')]('Team,\x20%s,\x20%s',_0x461c97,_0xee02('0x14'));_0x2297bf(_0x5ab718[_0xee02('0x19')][_0xee02('0x18')]);}})[_0xee02('0x1a')](function(_0x7ba582){logger[_0xee02('0x16')](_0xee02('0x13'),_0x461c97,_0x7ba582);_0x1eb312(_0x7ba582);});});}
\ No newline at end of file
index d0552b5..cb15381 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a83=['remove','update','emit','register','team:','save'];(function(_0x5d1d55,_0x101459){var _0x5e3c4e=function(_0x5f2b02){while(--_0x5f2b02){_0x5d1d55['push'](_0x5d1d55['shift']());}};_0x5e3c4e(++_0x101459);}(_0x4a83,0x125));var _0x34a8=function(_0x2f9eb9,_0x210440){_0x2f9eb9=_0x2f9eb9-0x0;var _0x23662f=_0x4a83[_0x2f9eb9];return _0x23662f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x34a8('0x0'),_0x34a8('0x1'),_0x34a8('0x2')];function createListener(_0x46ee74,_0x59dc42){return function(_0x4c8c97){_0x59dc42[_0x34a8('0x3')](_0x46ee74,_0x4c8c97);};}function removeListener(_0xb811f8,_0xb6b7cc){return function(){TeamEvents['removeListener'](_0xb811f8,_0xb6b7cc);};}exports[_0x34a8('0x4')]=function(_0x33bc73){for(var _0xa51ac4=0x0,_0x2405a6=events['length'];_0xa51ac4<_0x2405a6;_0xa51ac4++){var _0x47b304=events[_0xa51ac4];var _0x4e4c99=createListener(_0x34a8('0x5')+_0x47b304,_0x33bc73);TeamEvents['on'](_0x47b304,_0x4e4c99);}};
\ No newline at end of file
+var _0x761b=['./team.events','save','remove','update','emit','removeListener','length','team:'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x761b,0xa8));var _0xb761=function(_0x535a47,_0x36c699){_0x535a47=_0x535a47-0x0;var _0xd3a444=_0x761b[_0x535a47];return _0xd3a444;};'use strict';var TeamEvents=require(_0xb761('0x0'));var events=[_0xb761('0x1'),_0xb761('0x2'),_0xb761('0x3')];function createListener(_0x319d63,_0x46379f){return function(_0x4383e4){_0x46379f[_0xb761('0x4')](_0x319d63,_0x4383e4);};}function removeListener(_0x4cc124,_0x31910a){return function(){TeamEvents[_0xb761('0x5')](_0x4cc124,_0x31910a);};}exports['register']=function(_0x417fc8){for(var _0x49cd36=0x0,_0x1aaeaf=events[_0xb761('0x6')];_0x49cd36<_0x1aaeaf;_0x49cd36++){var _0x51f718=events[_0x49cd36];var _0x260aaf=createListener(_0xb761('0x7')+_0x51f718,_0x417fc8);TeamEvents['on'](_0x51f718,_0x260aaf);}};
\ No newline at end of file
index 1a73c57..c7011c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38d0=['INTEGER','exports'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0x38d0,0x123));var _0x038d=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x38d0[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0x038d('0x0')]={'TeamId':{'type':Sequelize[_0x038d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x038d('0x1')]}};
\ No newline at end of file
+var _0xd71d=['INTEGER','sequelize','exports'];(function(_0x5d6d10,_0x3634c4){var _0x12ab5c=function(_0x1302a5){while(--_0x1302a5){_0x5d6d10['push'](_0x5d6d10['shift']());}};_0x12ab5c(++_0x3634c4);}(_0xd71d,0x1a5));var _0xdd71=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0xd71d[_0x495b3d];return _0x4cb329;};'use strict';var Sequelize=require(_0xdd71('0x0'));module[_0xdd71('0x1')]={'TeamId':{'type':Sequelize[_0xdd71('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xdd71('0x2')]}};
\ No newline at end of file
index 47ee027..d88b50e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2be0=['moment','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2be0,0x128));var _0x02be=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x2be0[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x02be('0x0'));var util=require(_0x02be('0x1'));var logger=require(_0x02be('0x2'))(_0x02be('0x3'));var moment=require(_0x02be('0x4'));var BPromise=require('bluebird');var rp=require(_0x02be('0x5'));var fs=require('fs');var path=require(_0x02be('0x6'));var rimraf=require(_0x02be('0x7'));var config=require('../../config/environment');var attributes=require(_0x02be('0x8'));module[_0x02be('0x9')]=function(_0x46392d,_0x184bf6){return _0x46392d['define'](_0x02be('0xa'),attributes,{'tableName':_0x02be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a40=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','lodash'];(function(_0x1791d3,_0x199233){var _0x3e2b15=function(_0xcfdc18){while(--_0xcfdc18){_0x1791d3['push'](_0x1791d3['shift']());}};_0x3e2b15(++_0x199233);}(_0x7a40,0x197));var _0x07a4=function(_0x1b8d7b,_0x1edb18){_0x1b8d7b=_0x1b8d7b-0x0;var _0x252f14=_0x7a40[_0x1b8d7b];return _0x252f14;};'use strict';var _=require(_0x07a4('0x0'));var util=require(_0x07a4('0x1'));var logger=require(_0x07a4('0x2'))('api');var moment=require(_0x07a4('0x3'));var BPromise=require(_0x07a4('0x4'));var rp=require(_0x07a4('0x5'));var fs=require('fs');var path=require(_0x07a4('0x6'));var rimraf=require(_0x07a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x07a4('0x8'));module[_0x07a4('0x9')]=function(_0x3a53fb,_0x399d0f){return _0x3a53fb[_0x07a4('0xa')]('TeamVoicePrefix',attributes,{'tableName':_0x07a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 050e07b..69167f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ebc1e,_0x26dc8b){var _0x5ec4dc=function(_0x27a8d9){while(--_0x27a8d9){_0x1ebc1e['push'](_0x1ebc1e['shift']());}};_0x5ec4dc(++_0x26dc8b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x158431,_0x398297){var _0x1c563a=function(_0x549c70){while(--_0x549c70){_0x158431['push'](_0x158431['shift']());}};_0x1c563a(++_0x398297);}(_0x70e0,0x17b));var _0x070e=function(_0x4e73e2,_0x35b10d){_0x4e73e2=_0x4e73e2-0x0;var _0x2f2844=_0x70e0[_0x4e73e2];return _0x2f2844;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index e9a145c..69e886f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4d=['sequelize','INTEGER'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x6d4d,0x86));var _0xd6d4=function(_0x25cde9,_0x37919d){_0x25cde9=_0x25cde9-0x0;var _0x5a4b6a=_0x6d4d[_0x25cde9];return _0x5a4b6a;};'use strict';var Sequelize=require(_0xd6d4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd6d4('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xdb13=['exports','INTEGER'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0xdb13,0x1a0));var _0x3db1=function(_0x4eeae1,_0x31ee59){_0x4eeae1=_0x4eeae1-0x0;var _0x102310=_0xdb13[_0x4eeae1];return _0x102310;};'use strict';var Sequelize=require('sequelize');module[_0x3db1('0x0')]={'penalty':{'type':Sequelize[_0x3db1('0x1')],'defaultValue':0x0}};
\ No newline at end of file
index 8bdc63b..7dd881e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc964=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','api','moment','bluebird','path'];(function(_0x5ebacb,_0x375ce9){var _0xe0fb8e=function(_0x30abb0){while(--_0x30abb0){_0x5ebacb['push'](_0x5ebacb['shift']());}};_0xe0fb8e(++_0x375ce9);}(_0xc964,0x7e));var _0x4c96=function(_0x47587a,_0x736f9c){_0x47587a=_0x47587a-0x0;var _0x37a0be=_0xc964[_0x47587a];return _0x37a0be;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var logger=require('../../config/logger')(_0x4c96('0x2'));var moment=require(_0x4c96('0x3'));var BPromise=require(_0x4c96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c96('0x5'));var rimraf=require('rimraf');var config=require(_0x4c96('0x6'));var attributes=require(_0x4c96('0x7'));module[_0x4c96('0x8')]=function(_0x2f6461,_0x45bb27){return _0x2f6461[_0x4c96('0x9')](_0x4c96('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcee8=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xcee8,0xb1));var _0x8cee=function(_0x703343,_0x214548){_0x703343=_0x703343-0x0;var _0x30bddb=_0xcee8[_0x703343];return _0x30bddb;};'use strict';var _=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var logger=require(_0x8cee('0x2'))(_0x8cee('0x3'));var moment=require(_0x8cee('0x4'));var BPromise=require(_0x8cee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cee('0x6'));var rimraf=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var attributes=require(_0x8cee('0x9'));module['exports']=function(_0x295471,_0xfea4e3){return _0x295471['define']('TeamVoiceQueue',attributes,{'tableName':_0x8cee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 392c07f..5ffa03d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x406e=['code','message','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d2d16,_0x1af613){var _0x4d2180=function(_0x12c0f6){while(--_0x12c0f6){_0x4d2d16['push'](_0x4d2d16['shift']());}};_0x4d2180(++_0x1af613);}(_0x406e,0x16b));var _0xe406=function(_0x20cdd2,_0x24da9b){_0x20cdd2=_0x20cdd2-0x0;var _0x8bd09e=_0x406e[_0x20cdd2];return _0x8bd09e;};'use strict';var _=require(_0xe406('0x0'));var util=require('util');var moment=require(_0xe406('0x1'));var BPromise=require('bluebird');var rs=require(_0xe406('0x2'));var fs=require('fs');var Redis=require(_0xe406('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe406('0x4'));var logger=require('../../config/logger')(_0xe406('0x5'));var config=require(_0xe406('0x6'));var jayson=require(_0xe406('0x7'));var client=jayson[_0xe406('0x8')][_0xe406('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x528f1f,_0x3c7f52,_0x106aee){return new BPromise(function(_0x3bfed3,_0x177458){return client[_0xe406('0xa')](_0x528f1f,_0x106aee)['then'](function(_0x4181bd){logger[_0xe406('0xb')](_0xe406('0xc'),_0x3c7f52,_0xe406('0xd'));logger['debug'](_0xe406('0xe'),_0x3c7f52,_0xe406('0xd'),JSON[_0xe406('0xf')](_0x4181bd));if(_0x4181bd[_0xe406('0x10')]){if(_0x4181bd[_0xe406('0x10')][_0xe406('0x11')]===0x1f4){logger[_0xe406('0x10')](_0xe406('0xc'),_0x3c7f52,_0x4181bd[_0xe406('0x10')]['message']);return _0x177458(_0x4181bd[_0xe406('0x10')][_0xe406('0x12')]);}logger[_0xe406('0x10')](_0xe406('0xc'),_0x3c7f52,_0x4181bd[_0xe406('0x10')][_0xe406('0x12')]);return _0x3bfed3(_0x4181bd[_0xe406('0x10')]['message']);}else{logger['info'](_0xe406('0xc'),_0x3c7f52,'request\x20sent');_0x3bfed3(_0x4181bd['result'][_0xe406('0x12')]);}})['catch'](function(_0x2bb3ad){logger[_0xe406('0x10')](_0xe406('0xc'),_0x3c7f52,_0x2bb3ad);_0x177458(_0x2bb3ad);});});}
\ No newline at end of file
+var _0x6c2a=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2aac91,_0x1d30d0){var _0x180ede=function(_0x256373){while(--_0x256373){_0x2aac91['push'](_0x2aac91['shift']());}};_0x180ede(++_0x1d30d0);}(_0x6c2a,0x177));var _0xa6c2=function(_0xc67a54,_0x4bab73){_0xc67a54=_0xc67a54-0x0;var _0x3f8767=_0x6c2a[_0xc67a54];return _0x3f8767;};'use strict';var _=require(_0xa6c2('0x0'));var util=require(_0xa6c2('0x1'));var moment=require(_0xa6c2('0x2'));var BPromise=require(_0xa6c2('0x3'));var rs=require(_0xa6c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6c2('0x5'))['db'];var utils=require(_0xa6c2('0x6'));var logger=require(_0xa6c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa6c2('0x8'));var client=jayson[_0xa6c2('0x9')][_0xa6c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dd946,_0x3bd6dd,_0xb718d3){return new BPromise(function(_0x3b5f49,_0x2e617f){return client[_0xa6c2('0xb')](_0x1dd946,_0xb718d3)[_0xa6c2('0xc')](function(_0x35d297){logger[_0xa6c2('0xd')](_0xa6c2('0xe'),_0x3bd6dd,_0xa6c2('0xf'));logger[_0xa6c2('0x10')](_0xa6c2('0x11'),_0x3bd6dd,_0xa6c2('0xf'),JSON[_0xa6c2('0x12')](_0x35d297));if(_0x35d297[_0xa6c2('0x13')]){if(_0x35d297['error'][_0xa6c2('0x14')]===0x1f4){logger[_0xa6c2('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3bd6dd,_0x35d297['error'][_0xa6c2('0x15')]);return _0x2e617f(_0x35d297['error'][_0xa6c2('0x15')]);}logger['error'](_0xa6c2('0xe'),_0x3bd6dd,_0x35d297[_0xa6c2('0x13')][_0xa6c2('0x15')]);return _0x3b5f49(_0x35d297['error'][_0xa6c2('0x15')]);}else{logger[_0xa6c2('0xd')](_0xa6c2('0xe'),_0x3bd6dd,_0xa6c2('0xf'));_0x3b5f49(_0x35d297[_0xa6c2('0x16')][_0xa6c2('0x15')]);}})['catch'](function(_0x1093e8){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3bd6dd,_0x1093e8);_0x2e617f(_0x1093e8);});});}
\ No newline at end of file
index fa5142b..1cf8862 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x419f=['express','Router','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x581667,_0x2c6d8a){var _0xe47e58=function(_0x3baa0b){while(--_0x3baa0b){_0x581667['push'](_0x581667['shift']());}};_0xe47e58(++_0x2c6d8a);}(_0x419f,0x176));var _0xf419=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x419f[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var path=require(_0xf419('0x2'));var timeout=require(_0xf419('0x3'));var express=require(_0xf419('0x4'));var router=express[_0xf419('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf419('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf419('0x7'));var controller=require(_0xf419('0x8'));router[_0xf419('0x9')]('/',auth[_0xf419('0xa')](),controller[_0xf419('0xb')]);router[_0xf419('0x9')](_0xf419('0xc'),auth[_0xf419('0xa')](),controller[_0xf419('0xd')]);router['post']('/',auth[_0xf419('0xa')](),controller[_0xf419('0xe')]);router['put'](_0xf419('0xc'),auth[_0xf419('0xa')](),controller[_0xf419('0xf')]);router['delete'](_0xf419('0xc'),auth[_0xf419('0xa')](),controller[_0xf419('0x10')]);module[_0xf419('0x11')]=router;
\ No newline at end of file
+var _0x6b47=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x48b122,_0x2e66d2){var _0x5f573a=function(_0x3b0901){while(--_0x3b0901){_0x48b122['push'](_0x48b122['shift']());}};_0x5f573a(++_0x2e66d2);}(_0x6b47,0xe9));var _0x76b4=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0x6b47[_0xfcc030];return _0x5caa66;};'use strict';var multer=require('multer');var util=require(_0x76b4('0x0'));var path=require('path');var timeout=require(_0x76b4('0x1'));var express=require(_0x76b4('0x2'));var router=express[_0x76b4('0x3')]();var fs_extra=require(_0x76b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x76b4('0x5'));var config=require(_0x76b4('0x6'));var controller=require(_0x76b4('0x7'));router[_0x76b4('0x8')]('/',auth[_0x76b4('0x9')](),controller['index']);router[_0x76b4('0x8')](_0x76b4('0xa'),auth[_0x76b4('0x9')](),controller[_0x76b4('0xb')]);router[_0x76b4('0xc')]('/',auth[_0x76b4('0x9')](),controller[_0x76b4('0xd')]);router[_0x76b4('0xe')](_0x76b4('0xa'),auth[_0x76b4('0x9')](),controller[_0x76b4('0xf')]);router[_0x76b4('0x10')](_0x76b4('0xa'),auth['isAuthenticated'](),controller[_0x76b4('0x11')]);module[_0x76b4('0x12')]=router;
\ No newline at end of file
index ecd1cb1..c8f967a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13d0=['exports','STRING','TEXT','sequelize'];(function(_0xbb2c02,_0x35b5d2){var _0x472d52=function(_0x5e458b){while(--_0x5e458b){_0xbb2c02['push'](_0xbb2c02['shift']());}};_0x472d52(++_0x35b5d2);}(_0x13d0,0x97));var _0x013d=function(_0x2744e4,_0x2dbb98){_0x2744e4=_0x2744e4-0x0;var _0x1c5cb3=_0x13d0[_0x2744e4];return _0x1c5cb3;};'use strict';var Sequelize=require(_0x013d('0x0'));module[_0x013d('0x1')]={'name':{'type':Sequelize[_0x013d('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x013d('0x3')]}};
\ No newline at end of file
+var _0xa3ef=['TEXT','sequelize','exports','STRING'];(function(_0x1a74e2,_0x4938c3){var _0x34338e=function(_0x45ac43){while(--_0x45ac43){_0x1a74e2['push'](_0x1a74e2['shift']());}};_0x34338e(++_0x4938c3);}(_0xa3ef,0xc5));var _0xfa3e=function(_0x56f872,_0xe46288){_0x56f872=_0x56f872-0x0;var _0x1c826f=_0xa3ef[_0x56f872];return _0x1c826f;};'use strict';var Sequelize=require(_0xfa3e('0x0'));module[_0xfa3e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfa3e('0x2')]},'html':{'type':Sequelize[_0xfa3e('0x3')]}};
\ No newline at end of file
index db917be..644c924 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x443c=['reject','save','update','then','get','Templates','sendStatus','error','stack','name','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','apply'];(function(_0x1251b6,_0x1246e7){var _0x309627=function(_0x44c098){while(--_0x44c098){_0x1251b6['push'](_0x1251b6['shift']());}};_0x309627(++_0x1246e7);}(_0x443c,0x89));var _0xc443=function(_0x5a5d55,_0x1bef36){_0x5a5d55=_0x5a5d55-0x0;var _0x35e31e=_0x443c[_0x5a5d55];return _0x35e31e;};'use strict';var emlformat=require(_0xc443('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc443('0x1'));var moment=require(_0xc443('0x2'));var BPromise=require(_0xc443('0x3'));var Mustache=require(_0xc443('0x4'));var util=require(_0xc443('0x5'));var path=require(_0xc443('0x6'));var sox=require(_0xc443('0x7'));var csv=require(_0xc443('0x8'));var ejs=require(_0xc443('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc443('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc443('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc443('0xc'));var Papa=require('papaparse');var Redis=require(_0xc443('0xd'));var authService=require(_0xc443('0xe'));var qs=require(_0xc443('0xf'));var as=require(_0xc443('0x10'));var hardwareService=require(_0xc443('0x11'));var logger=require(_0xc443('0x12'))(_0xc443('0x13'));var utils=require(_0xc443('0x14'));var config=require(_0xc443('0x15'));var licenseUtil=require(_0xc443('0x16'));var db=require(_0xc443('0x17'))['db'];function respondWithStatusCode(_0x9bd1ca,_0x12e736){_0x12e736=_0x12e736||0xcc;return function(_0x21b80b){if(_0x21b80b){return _0x9bd1ca['sendStatus'](_0x12e736);}return _0x9bd1ca[_0xc443('0x18')](_0x12e736)[_0xc443('0x19')]();};}function respondWithResult(_0x9c3b5f,_0x4ef8ea){_0x4ef8ea=_0x4ef8ea||0xc8;return function(_0x5efceb){if(_0x5efceb){return _0x9c3b5f['status'](_0x4ef8ea)[_0xc443('0x1a')](_0x5efceb);}};}function respondWithFilteredResult(_0x1c7724,_0x3ed40d){return function(_0x337c12){if(_0x337c12){var _0x4e0e2c=typeof _0x3ed40d['offset']==='undefined'&&typeof _0x3ed40d['limit']===_0xc443('0x1b');var _0x416f39=_0x337c12[_0xc443('0x1c')];var _0x4057c8=_0x4e0e2c?0x0:_0x3ed40d[_0xc443('0x1d')];var _0x2ad445=_0x4e0e2c?_0x337c12[_0xc443('0x1c')]:_0x3ed40d[_0xc443('0x1d')]+_0x3ed40d['limit'];var _0x43dcb3;if(_0x2ad445>=_0x416f39){_0x2ad445=_0x416f39;_0x43dcb3=0xc8;}else{_0x43dcb3=0xce;}_0x1c7724[_0xc443('0x18')](_0x43dcb3);return _0x1c7724[_0xc443('0x1e')](_0xc443('0x1f'),_0x4057c8+'-'+_0x2ad445+'/'+_0x416f39)['json'](_0x337c12);}return null;};}function patchUpdates(_0x3605e9){return function(_0x526274){try{jsonpatch[_0xc443('0x20')](_0x526274,_0x3605e9,!![]);}catch(_0x5e17a1){return BPromise[_0xc443('0x21')](_0x5e17a1);}return _0x526274[_0xc443('0x22')]();};}function saveUpdates(_0x42b89a,_0x2b732a){return function(_0x1d1c0d){if(_0x1d1c0d){return _0x1d1c0d[_0xc443('0x23')](_0x42b89a)[_0xc443('0x24')](function(_0x4e1062){return _0x4e1062;});}return null;};}function removeEntity(_0x3b5c08,_0x2e00cc){return function(_0x224917){if(_0x224917){return _0x224917['destroy']()[_0xc443('0x24')](function(){var _0x5b7180=_0x224917[_0xc443('0x25')]({'plain':!![]});var _0x385b57=_0xc443('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x385b57,'resourceId':_0x5b7180['id']}})['then'](function(){return _0x224917;});})[_0xc443('0x24')](function(){_0x3b5c08[_0xc443('0x18')](0xcc)[_0xc443('0x19')]();});}};}function handleEntityNotFound(_0x3b5ec6,_0x31d488){return function(_0x5e02d){if(!_0x5e02d){_0x3b5ec6[_0xc443('0x27')](0x194);}return _0x5e02d;};}function handleError(_0x5aa1e1,_0x588ef0){_0x588ef0=_0x588ef0||0x1f4;return function(_0x3a3247){logger[_0xc443('0x28')](_0x3a3247[_0xc443('0x29')]);if(_0x3a3247[_0xc443('0x2a')]){delete _0x3a3247[_0xc443('0x2a')];}_0x5aa1e1[_0xc443('0x18')](_0x588ef0)['send'](_0x3a3247);};}exports['index']=function(_0x2f059c,_0x53b6f1){var _0x250b37={},_0xcd3cc5={},_0x1fe5c0={'count':0x0,'rows':[]};var _0x5611a9=_[_0xc443('0x2b')](db[_0xc443('0x2c')][_0xc443('0x2d')],function(_0x2242b8){return{'name':_0x2242b8[_0xc443('0x2e')],'type':_0x2242b8['type'][_0xc443('0x2f')]};});_0xcd3cc5[_0xc443('0x30')]=_[_0xc443('0x2b')](_0x5611a9,'name');_0xcd3cc5[_0xc443('0x31')]=_[_0xc443('0x32')](_0x2f059c[_0xc443('0x31')]);_0xcd3cc5[_0xc443('0x33')]=_['intersection'](_0xcd3cc5[_0xc443('0x30')],_0xcd3cc5['query']);_0x250b37[_0xc443('0x34')]=_[_0xc443('0x35')](_0xcd3cc5[_0xc443('0x30')],qs[_0xc443('0x36')](_0x2f059c[_0xc443('0x31')][_0xc443('0x36')]));_0x250b37[_0xc443('0x34')]=_0x250b37[_0xc443('0x34')][_0xc443('0x37')]?_0x250b37['attributes']:_0xcd3cc5[_0xc443('0x30')];if(!_0x2f059c['query'][_0xc443('0x38')]('nolimit')){_0x250b37[_0xc443('0x39')]=qs['limit'](_0x2f059c[_0xc443('0x31')][_0xc443('0x39')]);_0x250b37[_0xc443('0x1d')]=qs[_0xc443('0x1d')](_0x2f059c[_0xc443('0x31')][_0xc443('0x1d')]);}_0x250b37[_0xc443('0x3a')]=qs[_0xc443('0x3b')](_0x2f059c[_0xc443('0x31')][_0xc443('0x3b')]);_0x250b37[_0xc443('0x3c')]=qs[_0xc443('0x33')](_[_0xc443('0x3d')](_0x2f059c[_0xc443('0x31')],_0xcd3cc5[_0xc443('0x33')]),_0x5611a9);if(_0x2f059c[_0xc443('0x31')][_0xc443('0x3e')]){_0x250b37[_0xc443('0x3c')]=_[_0xc443('0x3f')](_0x250b37['where'],{'$or':_[_0xc443('0x2b')](_0x5611a9,function(_0x2bcd31){if(_0x2bcd31[_0xc443('0x40')]!==_0xc443('0x41')){var _0x350b50={};_0x350b50[_0x2bcd31['name']]={'$like':'%'+_0x2f059c[_0xc443('0x31')][_0xc443('0x3e')]+'%'};return _0x350b50;}})});}_0x250b37=_[_0xc443('0x3f')]({},_0x250b37,_0x2f059c['options']);var _0x5c28ef={'where':_0x250b37[_0xc443('0x3c')]};return db[_0xc443('0x2c')][_0xc443('0x1c')](_0x5c28ef)[_0xc443('0x24')](function(_0x29f9dc){_0x1fe5c0[_0xc443('0x1c')]=_0x29f9dc;if(_0x2f059c[_0xc443('0x31')][_0xc443('0x42')]){_0x250b37['include']=[{'all':!![]}];}return db[_0xc443('0x2c')][_0xc443('0x43')](_0x250b37);})[_0xc443('0x24')](function(_0x9a1cb9){_0x1fe5c0[_0xc443('0x44')]=_0x9a1cb9;return _0x1fe5c0;})[_0xc443('0x24')](respondWithFilteredResult(_0x53b6f1,_0x250b37))['catch'](handleError(_0x53b6f1,null));};exports[_0xc443('0x45')]=function(_0xad3f80,_0x35294a){var _0x3255e0={'raw':!![],'where':{'id':_0xad3f80['params']['id']}},_0x4e9687={};_0x4e9687[_0xc443('0x30')]=_[_0xc443('0x32')](db[_0xc443('0x2c')][_0xc443('0x2d')]);_0x4e9687[_0xc443('0x31')]=_['keys'](_0xad3f80[_0xc443('0x31')]);_0x4e9687[_0xc443('0x33')]=_['intersection'](_0x4e9687[_0xc443('0x30')],_0x4e9687[_0xc443('0x31')]);_0x3255e0['attributes']=_[_0xc443('0x35')](_0x4e9687[_0xc443('0x30')],qs[_0xc443('0x36')](_0xad3f80[_0xc443('0x31')][_0xc443('0x36')]));_0x3255e0[_0xc443('0x34')]=_0x3255e0['attributes'][_0xc443('0x37')]?_0x3255e0[_0xc443('0x34')]:_0x4e9687[_0xc443('0x30')];if(_0xad3f80[_0xc443('0x31')][_0xc443('0x42')]){_0x3255e0[_0xc443('0x46')]=[{'all':!![]}];}_0x3255e0=_[_0xc443('0x3f')]({},_0x3255e0,_0xad3f80['options']);return db[_0xc443('0x2c')][_0xc443('0x47')](_0x3255e0)[_0xc443('0x24')](handleEntityNotFound(_0x35294a,null))[_0xc443('0x24')](respondWithResult(_0x35294a,null))[_0xc443('0x48')](handleError(_0x35294a,null));};exports[_0xc443('0x49')]=function(_0x1bf83d,_0x88e89b){return db['Template'][_0xc443('0x49')](_0x1bf83d[_0xc443('0x4a')],{})[_0xc443('0x24')](function(_0x2dc7b0){var _0x1a4c57=_0x1bf83d[_0xc443('0x4b')][_0xc443('0x25')]({'plain':!![]});if(!_0x1a4c57)throw new Error(_0xc443('0x4c'));if(_0x1a4c57[_0xc443('0x4d')]===_0xc443('0x4b')){var _0x3afbf3=_0x2dc7b0[_0xc443('0x25')]({'plain':!![]});var _0x3bf98b=_0xc443('0x26');return db[_0xc443('0x4e')]['find']({'where':{'name':_0x3bf98b,'userProfileId':_0x1a4c57[_0xc443('0x4f')]},'raw':!![]})['then'](function(_0x53d58e){if(_0x53d58e&&_0x53d58e[_0xc443('0x50')]===0x0){return db[_0xc443('0x51')][_0xc443('0x49')]({'name':_0x3afbf3[_0xc443('0x2a')],'resourceId':_0x3afbf3['id'],'type':_0x53d58e[_0xc443('0x2a')],'sectionId':_0x53d58e['id']},{})[_0xc443('0x24')](function(){return _0x2dc7b0;});}else{return _0x2dc7b0;}})[_0xc443('0x48')](function(_0xa791c8){logger['error'](_0xc443('0x52'),_0xa791c8);throw _0xa791c8;});}return _0x2dc7b0;})['then'](respondWithResult(_0x88e89b,0xc9))['catch'](handleError(_0x88e89b,null));};exports['update']=function(_0x223555,_0x269a5e){if(_0x223555['body']['id']){delete _0x223555[_0xc443('0x4a')]['id'];}return db[_0xc443('0x2c')][_0xc443('0x47')]({'where':{'id':_0x223555[_0xc443('0x53')]['id']}})[_0xc443('0x24')](handleEntityNotFound(_0x269a5e,null))[_0xc443('0x24')](saveUpdates(_0x223555['body'],null))[_0xc443('0x24')](respondWithResult(_0x269a5e,null))[_0xc443('0x48')](handleError(_0x269a5e,null));};exports[_0xc443('0x54')]=function(_0x1e5670,_0x4691fd){return db[_0xc443('0x2c')][_0xc443('0x47')]({'where':{'id':_0x1e5670[_0xc443('0x53')]['id']}})[_0xc443('0x24')](handleEntityNotFound(_0x4691fd,null))['then'](removeEntity(_0x4691fd,null))[_0xc443('0x48')](handleError(_0x4691fd,null));};
\ No newline at end of file
+var _0xf031=['../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','UserProfileResource','stack','name','send','Template','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','find','body','user','get','role','Templates','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0xd65a0a,_0x158401){var _0x1cf7f2=function(_0xd1d6b5){while(--_0xd1d6b5){_0xd65a0a['push'](_0xd65a0a['shift']());}};_0x1cf7f2(++_0x158401);}(_0xf031,0xd9));var _0x1f03=function(_0xf71825,_0x25f06e){_0xf71825=_0xf71825-0x0;var _0x2d65a6=_0xf031[_0xf71825];return _0x2d65a6;};'use strict';var emlformat=require(_0x1f03('0x0'));var rimraf=require(_0x1f03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f03('0x2'));var rp=require(_0x1f03('0x3'));var moment=require(_0x1f03('0x4'));var BPromise=require(_0x1f03('0x5'));var Mustache=require(_0x1f03('0x6'));var util=require(_0x1f03('0x7'));var path=require(_0x1f03('0x8'));var sox=require(_0x1f03('0x9'));var csv=require(_0x1f03('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f03('0xb'));var squel=require(_0x1f03('0xc'));var crypto=require(_0x1f03('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f03('0xe'));var toCsv=require(_0x1f03('0xa'));var querystring=require(_0x1f03('0xf'));var Papa=require(_0x1f03('0x10'));var Redis=require(_0x1f03('0x11'));var authService=require(_0x1f03('0x12'));var qs=require(_0x1f03('0x13'));var as=require(_0x1f03('0x14'));var hardwareService=require(_0x1f03('0x15'));var logger=require(_0x1f03('0x16'))(_0x1f03('0x17'));var utils=require('../../config/utils');var config=require(_0x1f03('0x18'));var licenseUtil=require(_0x1f03('0x19'));var db=require(_0x1f03('0x1a'))['db'];function respondWithStatusCode(_0x2d39ec,_0x23d680){_0x23d680=_0x23d680||0xcc;return function(_0x31a161){if(_0x31a161){return _0x2d39ec['sendStatus'](_0x23d680);}return _0x2d39ec['status'](_0x23d680)[_0x1f03('0x1b')]();};}function respondWithResult(_0xa61632,_0x3a0308){_0x3a0308=_0x3a0308||0xc8;return function(_0x23358e){if(_0x23358e){return _0xa61632[_0x1f03('0x1c')](_0x3a0308)[_0x1f03('0x1d')](_0x23358e);}};}function respondWithFilteredResult(_0x74223,_0x117e87){return function(_0x28d196){if(_0x28d196){var _0x626db7=typeof _0x117e87[_0x1f03('0x1e')]===_0x1f03('0x1f')&&typeof _0x117e87[_0x1f03('0x20')]===_0x1f03('0x1f');var _0x427627=_0x28d196[_0x1f03('0x21')];var _0x5ae0e8=_0x626db7?0x0:_0x117e87[_0x1f03('0x1e')];var _0x1a075a=_0x626db7?_0x28d196[_0x1f03('0x21')]:_0x117e87[_0x1f03('0x1e')]+_0x117e87[_0x1f03('0x20')];var _0x6925a3;if(_0x1a075a>=_0x427627){_0x1a075a=_0x427627;_0x6925a3=0xc8;}else{_0x6925a3=0xce;}_0x74223[_0x1f03('0x1c')](_0x6925a3);return _0x74223[_0x1f03('0x22')](_0x1f03('0x23'),_0x5ae0e8+'-'+_0x1a075a+'/'+_0x427627)['json'](_0x28d196);}return null;};}function patchUpdates(_0x4bc022){return function(_0x2e1097){try{jsonpatch['apply'](_0x2e1097,_0x4bc022,!![]);}catch(_0x205c81){return BPromise['reject'](_0x205c81);}return _0x2e1097[_0x1f03('0x24')]();};}function saveUpdates(_0x3840c0,_0x40448d){return function(_0x19b687){if(_0x19b687){return _0x19b687[_0x1f03('0x25')](_0x3840c0)['then'](function(_0x317b5d){return _0x317b5d;});}return null;};}function removeEntity(_0xd8da32,_0x32b0a4){return function(_0x94daa6){if(_0x94daa6){return _0x94daa6[_0x1f03('0x26')]()[_0x1f03('0x27')](function(){var _0x501e6e=_0x94daa6['get']({'plain':!![]});var _0x5d25c4='Templates';return db[_0x1f03('0x28')]['destroy']({'where':{'type':_0x5d25c4,'resourceId':_0x501e6e['id']}})[_0x1f03('0x27')](function(){return _0x94daa6;});})['then'](function(){_0xd8da32[_0x1f03('0x1c')](0xcc)[_0x1f03('0x1b')]();});}};}function handleEntityNotFound(_0x107f23,_0x3a03a3){return function(_0x302da3){if(!_0x302da3){_0x107f23['sendStatus'](0x194);}return _0x302da3;};}function handleError(_0x449be5,_0x170d5b){_0x170d5b=_0x170d5b||0x1f4;return function(_0x27419d){logger['error'](_0x27419d[_0x1f03('0x29')]);if(_0x27419d['name']){delete _0x27419d[_0x1f03('0x2a')];}_0x449be5['status'](_0x170d5b)[_0x1f03('0x2b')](_0x27419d);};}exports['index']=function(_0x3bd936,_0x46e7f5){var _0x533c6d={},_0x5d95a5={},_0x18ce5f={'count':0x0,'rows':[]};var _0x491bd3=_['map'](db[_0x1f03('0x2c')][_0x1f03('0x2d')],function(_0x2aba86){return{'name':_0x2aba86[_0x1f03('0x2e')],'type':_0x2aba86[_0x1f03('0x2f')]['key']};});_0x5d95a5[_0x1f03('0x30')]=_['map'](_0x491bd3,_0x1f03('0x2a'));_0x5d95a5[_0x1f03('0x31')]=_[_0x1f03('0x32')](_0x3bd936[_0x1f03('0x31')]);_0x5d95a5[_0x1f03('0x33')]=_[_0x1f03('0x34')](_0x5d95a5[_0x1f03('0x30')],_0x5d95a5['query']);_0x533c6d[_0x1f03('0x35')]=_[_0x1f03('0x34')](_0x5d95a5[_0x1f03('0x30')],qs['fields'](_0x3bd936[_0x1f03('0x31')][_0x1f03('0x36')]));_0x533c6d[_0x1f03('0x35')]=_0x533c6d['attributes'][_0x1f03('0x37')]?_0x533c6d['attributes']:_0x5d95a5[_0x1f03('0x30')];if(!_0x3bd936['query']['hasOwnProperty'](_0x1f03('0x38'))){_0x533c6d['limit']=qs['limit'](_0x3bd936[_0x1f03('0x31')][_0x1f03('0x20')]);_0x533c6d[_0x1f03('0x1e')]=qs[_0x1f03('0x1e')](_0x3bd936[_0x1f03('0x31')][_0x1f03('0x1e')]);}_0x533c6d[_0x1f03('0x39')]=qs[_0x1f03('0x3a')](_0x3bd936['query']['sort']);_0x533c6d[_0x1f03('0x3b')]=qs[_0x1f03('0x33')](_[_0x1f03('0x3c')](_0x3bd936[_0x1f03('0x31')],_0x5d95a5[_0x1f03('0x33')]),_0x491bd3);if(_0x3bd936[_0x1f03('0x31')][_0x1f03('0x3d')]){_0x533c6d[_0x1f03('0x3b')]=_['merge'](_0x533c6d[_0x1f03('0x3b')],{'$or':_[_0x1f03('0x3e')](_0x491bd3,function(_0x82cd75){if(_0x82cd75[_0x1f03('0x2f')]!=='VIRTUAL'){var _0x5c0500={};_0x5c0500[_0x82cd75[_0x1f03('0x2a')]]={'$like':'%'+_0x3bd936[_0x1f03('0x31')]['filter']+'%'};return _0x5c0500;}})});}_0x533c6d=_[_0x1f03('0x3f')]({},_0x533c6d,_0x3bd936['options']);var _0x53ca0b={'where':_0x533c6d[_0x1f03('0x3b')]};return db['Template']['count'](_0x53ca0b)['then'](function(_0x51eae7){_0x18ce5f[_0x1f03('0x21')]=_0x51eae7;if(_0x3bd936[_0x1f03('0x31')][_0x1f03('0x40')]){_0x533c6d[_0x1f03('0x41')]=[{'all':!![]}];}return db[_0x1f03('0x2c')][_0x1f03('0x42')](_0x533c6d);})[_0x1f03('0x27')](function(_0x411c18){_0x18ce5f['rows']=_0x411c18;return _0x18ce5f;})[_0x1f03('0x27')](respondWithFilteredResult(_0x46e7f5,_0x533c6d))[_0x1f03('0x43')](handleError(_0x46e7f5,null));};exports[_0x1f03('0x44')]=function(_0xd1ff8a,_0x4dff40){var _0x350a91={'raw':!![],'where':{'id':_0xd1ff8a[_0x1f03('0x45')]['id']}},_0x2650dc={};_0x2650dc[_0x1f03('0x30')]=_[_0x1f03('0x32')](db[_0x1f03('0x2c')]['rawAttributes']);_0x2650dc[_0x1f03('0x31')]=_['keys'](_0xd1ff8a[_0x1f03('0x31')]);_0x2650dc[_0x1f03('0x33')]=_[_0x1f03('0x34')](_0x2650dc['model'],_0x2650dc['query']);_0x350a91[_0x1f03('0x35')]=_['intersection'](_0x2650dc[_0x1f03('0x30')],qs[_0x1f03('0x36')](_0xd1ff8a[_0x1f03('0x31')][_0x1f03('0x36')]));_0x350a91[_0x1f03('0x35')]=_0x350a91['attributes'][_0x1f03('0x37')]?_0x350a91[_0x1f03('0x35')]:_0x2650dc[_0x1f03('0x30')];if(_0xd1ff8a['query'][_0x1f03('0x40')]){_0x350a91[_0x1f03('0x41')]=[{'all':!![]}];}_0x350a91=_[_0x1f03('0x3f')]({},_0x350a91,_0xd1ff8a['options']);return db[_0x1f03('0x2c')][_0x1f03('0x46')](_0x350a91)['then'](handleEntityNotFound(_0x4dff40,null))['then'](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['create']=function(_0x403fb9,_0x235c94){return db[_0x1f03('0x2c')]['create'](_0x403fb9[_0x1f03('0x47')],{})[_0x1f03('0x27')](function(_0x28d56d){var _0x77b6ff=_0x403fb9[_0x1f03('0x48')][_0x1f03('0x49')]({'plain':!![]});if(!_0x77b6ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x77b6ff[_0x1f03('0x4a')]==='user'){var _0x57d8a9=_0x28d56d[_0x1f03('0x49')]({'plain':!![]});var _0x2939c1=_0x1f03('0x4b');return db[_0x1f03('0x4c')][_0x1f03('0x46')]({'where':{'name':_0x2939c1,'userProfileId':_0x77b6ff[_0x1f03('0x4d')]},'raw':!![]})[_0x1f03('0x27')](function(_0x30298a){if(_0x30298a&&_0x30298a[_0x1f03('0x4e')]===0x0){return db[_0x1f03('0x28')][_0x1f03('0x4f')]({'name':_0x57d8a9['name'],'resourceId':_0x57d8a9['id'],'type':_0x30298a[_0x1f03('0x2a')],'sectionId':_0x30298a['id']},{})[_0x1f03('0x27')](function(){return _0x28d56d;});}else{return _0x28d56d;}})['catch'](function(_0xf52368){logger['error'](_0x1f03('0x50'),_0xf52368);throw _0xf52368;});}return _0x28d56d;})['then'](respondWithResult(_0x235c94,0xc9))[_0x1f03('0x43')](handleError(_0x235c94,null));};exports[_0x1f03('0x25')]=function(_0x2c70cd,_0x190bfd){if(_0x2c70cd[_0x1f03('0x47')]['id']){delete _0x2c70cd['body']['id'];}return db['Template'][_0x1f03('0x46')]({'where':{'id':_0x2c70cd[_0x1f03('0x45')]['id']}})['then'](handleEntityNotFound(_0x190bfd,null))[_0x1f03('0x27')](saveUpdates(_0x2c70cd[_0x1f03('0x47')],null))['then'](respondWithResult(_0x190bfd,null))[_0x1f03('0x43')](handleError(_0x190bfd,null));};exports['destroy']=function(_0x388168,_0x47f6a2){return db['Template']['find']({'where':{'id':_0x388168[_0x1f03('0x45')]['id']}})[_0x1f03('0x27')](handleEntityNotFound(_0x47f6a2,null))[_0x1f03('0x27')](removeEntity(_0x47f6a2,null))[_0x1f03('0x43')](handleError(_0x47f6a2,null));};
\ No newline at end of file
index 28a9863..b8c7768 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49cf=['../../config/logger','api','moment','request-promise','path','rimraf','./template.attributes','tools_templates','lodash','util'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0x49cf,0xd0));var _0xf49c=function(_0x653eab,_0x2b48b6){_0x653eab=_0x653eab-0x0;var _0x4e86fc=_0x49cf[_0x653eab];return _0x4e86fc;};'use strict';var _=require(_0xf49c('0x0'));var util=require(_0xf49c('0x1'));var logger=require(_0xf49c('0x2'))(_0xf49c('0x3'));var moment=require(_0xf49c('0x4'));var BPromise=require('bluebird');var rp=require(_0xf49c('0x5'));var fs=require('fs');var path=require(_0xf49c('0x6'));var rimraf=require(_0xf49c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf49c('0x8'));module['exports']=function(_0x32d90d,_0x474297){return _0x32d90d['define']('Template',attributes,{'tableName':_0xf49c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8239=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x167b19,_0x56081a){var _0x1fcca2=function(_0x544ca4){while(--_0x544ca4){_0x167b19['push'](_0x167b19['shift']());}};_0x1fcca2(++_0x56081a);}(_0x8239,0x1bd));var _0x9823=function(_0x4cd6b3,_0x47cc34){_0x4cd6b3=_0x4cd6b3-0x0;var _0x3f1c97=_0x8239[_0x4cd6b3];return _0x3f1c97;};'use strict';var _=require(_0x9823('0x0'));var util=require(_0x9823('0x1'));var logger=require(_0x9823('0x2'))(_0x9823('0x3'));var moment=require(_0x9823('0x4'));var BPromise=require(_0x9823('0x5'));var rp=require(_0x9823('0x6'));var fs=require('fs');var path=require(_0x9823('0x7'));var rimraf=require(_0x9823('0x8'));var config=require(_0x9823('0x9'));var attributes=require(_0x9823('0xa'));module['exports']=function(_0x5f4f5a,_0xbc76af){return _0x5f4f5a[_0x9823('0xb')](_0x9823('0xc'),attributes,{'tableName':_0x9823('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d2f5f92..ce27478 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0dfd=['info','result','catch','GetTemplate','Template','options','raw','where','attributes','include','model','map','then','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x184d86,_0x180b98){var _0x4f3c4e=function(_0x39ff24){while(--_0x39ff24){_0x184d86['push'](_0x184d86['shift']());}};_0x4f3c4e(++_0x180b98);}(_0x0dfd,0x6e));var _0xd0df=function(_0x1c6bc7,_0x5af521){_0x1c6bc7=_0x1c6bc7-0x0;var _0x3fb172=_0x0dfd[_0x1c6bc7];return _0x3fb172;};'use strict';var _=require(_0xd0df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd0df('0x1'));var rs=require(_0xd0df('0x2'));var fs=require('fs');var Redis=require(_0xd0df('0x3'));var db=require(_0xd0df('0x4'))['db'];var utils=require(_0xd0df('0x5'));var logger=require('../../config/logger')(_0xd0df('0x6'));var config=require(_0xd0df('0x7'));var jayson=require(_0xd0df('0x8'));var client=jayson[_0xd0df('0x9')][_0xd0df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ff7ab,_0x17bc36,_0x544625){return new BPromise(function(_0x23cab1,_0x151a5f){return client['request'](_0x4ff7ab,_0x544625)['then'](function(_0x45bb80){logger['info'](_0xd0df('0xb'),_0x17bc36,'request\x20sent');logger['debug'](_0xd0df('0xc'),_0x17bc36,_0xd0df('0xd'),JSON[_0xd0df('0xe')](_0x45bb80));if(_0x45bb80[_0xd0df('0xf')]){if(_0x45bb80[_0xd0df('0xf')][_0xd0df('0x10')]===0x1f4){logger['error'](_0xd0df('0xb'),_0x17bc36,_0x45bb80[_0xd0df('0xf')][_0xd0df('0x11')]);return _0x151a5f(_0x45bb80[_0xd0df('0xf')][_0xd0df('0x11')]);}logger[_0xd0df('0xf')](_0xd0df('0xb'),_0x17bc36,_0x45bb80[_0xd0df('0xf')][_0xd0df('0x11')]);return _0x23cab1(_0x45bb80[_0xd0df('0xf')]['message']);}else{logger[_0xd0df('0x12')](_0xd0df('0xb'),_0x17bc36,_0xd0df('0xd'));_0x23cab1(_0x45bb80[_0xd0df('0x13')][_0xd0df('0x11')]);}})[_0xd0df('0x14')](function(_0x467a26){logger['error'](_0xd0df('0xb'),_0x17bc36,_0x467a26);_0x151a5f(_0x467a26);});});}exports[_0xd0df('0x15')]=function(_0x5f4e2d){var _0x13c9df=this;return new Promise(function(_0xb5bc54,_0x916188){return db[_0xd0df('0x16')]['findAll']({'raw':_0x5f4e2d[_0xd0df('0x17')]?_0x5f4e2d[_0xd0df('0x17')][_0xd0df('0x18')]===undefined?!![]:![]:!![],'where':_0x5f4e2d[_0xd0df('0x17')]?_0x5f4e2d[_0xd0df('0x17')][_0xd0df('0x19')]||null:null,'attributes':_0x5f4e2d[_0xd0df('0x17')]?_0x5f4e2d[_0xd0df('0x17')][_0xd0df('0x1a')]||null:null,'limit':_0x5f4e2d[_0xd0df('0x17')]?_0x5f4e2d[_0xd0df('0x17')]['limit']||null:null,'include':_0x5f4e2d[_0xd0df('0x17')]?_0x5f4e2d['options'][_0xd0df('0x1b')]?_['map'](_0x5f4e2d[_0xd0df('0x17')][_0xd0df('0x1b')],function(_0x46ab23){return{'model':db[_0x46ab23[_0xd0df('0x1c')]],'as':_0x46ab23['as'],'attributes':_0x46ab23[_0xd0df('0x1a')],'include':_0x46ab23[_0xd0df('0x1b')]?_['map'](_0x46ab23[_0xd0df('0x1b')],function(_0x55098f){return{'model':db[_0x55098f[_0xd0df('0x1c')]],'as':_0x55098f['as'],'attributes':_0x55098f[_0xd0df('0x1a')],'include':_0x55098f[_0xd0df('0x1b')]?_[_0xd0df('0x1d')](_0x55098f[_0xd0df('0x1b')],function(_0x3c759e){return{'model':db[_0x3c759e['model']],'as':_0x3c759e['as'],'attributes':_0x3c759e[_0xd0df('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd0df('0x1e')](function(_0x181f79){logger[_0xd0df('0x12')](_0xd0df('0x15'),_0x5f4e2d);logger[_0xd0df('0x1f')](_0xd0df('0x15'),_0x5f4e2d,JSON[_0xd0df('0xe')](_0x181f79));_0xb5bc54(_0x181f79);})[_0xd0df('0x14')](function(_0x5892d6){logger[_0xd0df('0xf')](_0xd0df('0x15'),_0x5892d6[_0xd0df('0x11')],_0x5f4e2d);_0x916188(_0x13c9df[_0xd0df('0xf')](0x1f4,_0x5892d6[_0xd0df('0x11')]));});});};
\ No newline at end of file
+var _0xe7e8=['include','map','model','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xe7e8,0xe3));var _0x8e7e=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xe7e8[_0x31a938];return _0x1bf341;};'use strict';var _=require('lodash');var util=require(_0x8e7e('0x0'));var moment=require(_0x8e7e('0x1'));var BPromise=require(_0x8e7e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e7e('0x4'))(_0x8e7e('0x5'));var config=require(_0x8e7e('0x6'));var jayson=require(_0x8e7e('0x7'));var client=jayson[_0x8e7e('0x8')][_0x8e7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11cdd0,_0x35b205,_0x505978){return new BPromise(function(_0x2b134f,_0x57e198){return client[_0x8e7e('0xa')](_0x11cdd0,_0x505978)[_0x8e7e('0xb')](function(_0x579b7a){logger[_0x8e7e('0xc')](_0x8e7e('0xd'),_0x35b205,_0x8e7e('0xe'));logger['debug'](_0x8e7e('0xf'),_0x35b205,'request\x20sent',JSON[_0x8e7e('0x10')](_0x579b7a));if(_0x579b7a['error']){if(_0x579b7a['error'][_0x8e7e('0x11')]===0x1f4){logger[_0x8e7e('0x12')](_0x8e7e('0xd'),_0x35b205,_0x579b7a['error'][_0x8e7e('0x13')]);return _0x57e198(_0x579b7a['error'][_0x8e7e('0x13')]);}logger[_0x8e7e('0x12')](_0x8e7e('0xd'),_0x35b205,_0x579b7a[_0x8e7e('0x12')]['message']);return _0x2b134f(_0x579b7a[_0x8e7e('0x12')]['message']);}else{logger[_0x8e7e('0xc')](_0x8e7e('0xd'),_0x35b205,_0x8e7e('0xe'));_0x2b134f(_0x579b7a[_0x8e7e('0x14')][_0x8e7e('0x13')]);}})[_0x8e7e('0x15')](function(_0x49c719){logger['error'](_0x8e7e('0xd'),_0x35b205,_0x49c719);_0x57e198(_0x49c719);});});}exports[_0x8e7e('0x16')]=function(_0x25afe1){var _0x3720cb=this;return new Promise(function(_0x9812f0,_0x1cdeec){return db['Template'][_0x8e7e('0x17')]({'raw':_0x25afe1[_0x8e7e('0x18')]?_0x25afe1[_0x8e7e('0x18')][_0x8e7e('0x19')]===undefined?!![]:![]:!![],'where':_0x25afe1[_0x8e7e('0x18')]?_0x25afe1['options'][_0x8e7e('0x1a')]||null:null,'attributes':_0x25afe1[_0x8e7e('0x18')]?_0x25afe1['options'][_0x8e7e('0x1b')]||null:null,'limit':_0x25afe1[_0x8e7e('0x18')]?_0x25afe1['options'][_0x8e7e('0x1c')]||null:null,'include':_0x25afe1[_0x8e7e('0x18')]?_0x25afe1['options'][_0x8e7e('0x1d')]?_['map'](_0x25afe1[_0x8e7e('0x18')]['include'],function(_0xcd74b8){return{'model':db[_0xcd74b8['model']],'as':_0xcd74b8['as'],'attributes':_0xcd74b8[_0x8e7e('0x1b')],'include':_0xcd74b8[_0x8e7e('0x1d')]?_[_0x8e7e('0x1e')](_0xcd74b8['include'],function(_0x42b0be){return{'model':db[_0x42b0be[_0x8e7e('0x1f')]],'as':_0x42b0be['as'],'attributes':_0x42b0be['attributes'],'include':_0x42b0be[_0x8e7e('0x1d')]?_[_0x8e7e('0x1e')](_0x42b0be[_0x8e7e('0x1d')],function(_0x5d5a92){return{'model':db[_0x5d5a92[_0x8e7e('0x1f')]],'as':_0x5d5a92['as'],'attributes':_0x5d5a92[_0x8e7e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8a7f34){logger['info'](_0x8e7e('0x16'),_0x25afe1);logger['debug'](_0x8e7e('0x16'),_0x25afe1,JSON[_0x8e7e('0x10')](_0x8a7f34));_0x9812f0(_0x8a7f34);})[_0x8e7e('0x15')](function(_0xd1688e){logger['error'](_0x8e7e('0x16'),_0xd1688e['message'],_0x25afe1);_0x1cdeec(_0x3720cb[_0x8e7e('0x12')](0x1f4,_0xd1688e[_0x8e7e('0x13')]));});});};
\ No newline at end of file
index f6d9cb7..2f422f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0db9=['addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post'];(function(_0x1ba88b,_0x279d8c){var _0x20c1ad=function(_0x2883d4){while(--_0x2883d4){_0x1ba88b['push'](_0x1ba88b['shift']());}};_0x20c1ad(++_0x279d8c);}(_0x0db9,0xa3));var _0x90db=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x0db9[_0x3a2118];return _0x1d181d;};'use strict';var multer=require(_0x90db('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90db('0x1'));var router=express[_0x90db('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x90db('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x90db('0x4'));var controller=require(_0x90db('0x5'));router['get']('/',auth[_0x90db('0x6')](),controller[_0x90db('0x7')]);router[_0x90db('0x8')](_0x90db('0x9'),auth[_0x90db('0x6')](),controller[_0x90db('0xa')]);router['get'](_0x90db('0xb'),auth[_0x90db('0x6')](),controller[_0x90db('0xc')]);router[_0x90db('0x8')](_0x90db('0xd'),auth[_0x90db('0x6')](),controller[_0x90db('0xe')]);router[_0x90db('0x8')](_0x90db('0xf'),auth[_0x90db('0x6')](),controller[_0x90db('0x10')]);router['post']('/',auth[_0x90db('0x6')](),controller[_0x90db('0x11')]);router[_0x90db('0x12')](_0x90db('0xb'),auth[_0x90db('0x6')](),controller[_0x90db('0x13')]);router[_0x90db('0x12')](_0x90db('0xd'),auth[_0x90db('0x6')](),controller[_0x90db('0x14')]);router[_0x90db('0x12')](_0x90db('0xf'),auth[_0x90db('0x6')](),controller[_0x90db('0x15')]);router['put'](_0x90db('0x9'),auth['isAuthenticated'](),controller[_0x90db('0x16')]);router[_0x90db('0x17')](_0x90db('0x9'),auth[_0x90db('0x6')](),controller[_0x90db('0x18')]);module[_0x90db('0x19')]=router;
\ No newline at end of file
+var _0xd5e5=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','destroy'];(function(_0x26da6d,_0x44a7c9){var _0x20a7f7=function(_0x377e87){while(--_0x377e87){_0x26da6d['push'](_0x26da6d['shift']());}};_0x20a7f7(++_0x44a7c9);}(_0xd5e5,0x187));var _0x5d5e=function(_0x2c09bb,_0x279c10){_0x2c09bb=_0x2c09bb-0x0;var _0x47da2a=_0xd5e5[_0x2c09bb];return _0x47da2a;};'use strict';var multer=require('multer');var util=require(_0x5d5e('0x0'));var path=require('path');var timeout=require(_0x5d5e('0x1'));var express=require('express');var router=express[_0x5d5e('0x2')]();var fs_extra=require(_0x5d5e('0x3'));var auth=require(_0x5d5e('0x4'));var interaction=require(_0x5d5e('0x5'));var config=require(_0x5d5e('0x6'));var controller=require(_0x5d5e('0x7'));router[_0x5d5e('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d5e('0x9')]);router[_0x5d5e('0x8')](_0x5d5e('0xa'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0xc')]);router[_0x5d5e('0x8')](_0x5d5e('0xd'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0xe')]);router['get'](_0x5d5e('0xf'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x10')]);router[_0x5d5e('0x8')](_0x5d5e('0x11'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x12')]);router[_0x5d5e('0x13')]('/',auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x14')]);router[_0x5d5e('0x13')](_0x5d5e('0xd'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x15')]);router[_0x5d5e('0x13')](_0x5d5e('0xf'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x16')]);router[_0x5d5e('0x13')]('/:id/actions',auth['isAuthenticated'](),controller[_0x5d5e('0x17')]);router['put']('/:id',auth[_0x5d5e('0xb')](),controller['update']);router['delete'](_0x5d5e('0xa'),auth[_0x5d5e('0xb')](),controller[_0x5d5e('0x18')]);module[_0x5d5e('0x19')]=router;
\ No newline at end of file
index 9a1628e..0b46b56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3536=['BOOLEAN','exports'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x3536,0x157));var _0x6353=function(_0x2ea2b1,_0x581c43){_0x2ea2b1=_0x2ea2b1-0x0;var _0x32eff9=_0x3536[_0x2ea2b1];return _0x32eff9;};'use strict';var Sequelize=require('sequelize');module[_0x6353('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6353('0x1')],'defaultValue':![]}};
\ No newline at end of file
+var _0x6316=['STRING','BOOLEAN','sequelize'];(function(_0x5a32d0,_0x582011){var _0x44e238=function(_0xf6646d){while(--_0xf6646d){_0x5a32d0['push'](_0x5a32d0['shift']());}};_0x44e238(++_0x582011);}(_0x6316,0x1d6));var _0x6631=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6316[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x6631('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6631('0x1')]},'status':{'type':Sequelize[_0x6631('0x2')],'defaultValue':![]}};
\ No newline at end of file
index 5e0f472..ce9ed4c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d2a=['moment','mustache','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','error','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x343485,_0x149494){var _0x1e8259=function(_0x4b83fb){while(--_0x4b83fb){_0x343485['push'](_0x343485['shift']());}};_0x1e8259(++_0x149494);}(_0x2d2a,0x16f));var _0xa2d2=function(_0x46aa01,_0x5016fe){_0x46aa01=_0x46aa01-0x0;var _0xbaf9e3=_0x2d2a[_0x46aa01];return _0xbaf9e3;};'use strict';var emlformat=require(_0xa2d2('0x0'));var rimraf=require(_0xa2d2('0x1'));var zipdir=require(_0xa2d2('0x2'));var jsonpatch=require(_0xa2d2('0x3'));var rp=require(_0xa2d2('0x4'));var moment=require(_0xa2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa2d2('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa2d2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2d2('0x8'));var _=require(_0xa2d2('0x9'));var squel=require(_0xa2d2('0xa'));var crypto=require(_0xa2d2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa2d2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2d2('0xd'));var Redis=require(_0xa2d2('0xe'));var authService=require(_0xa2d2('0xf'));var qs=require(_0xa2d2('0x10'));var as=require(_0xa2d2('0x11'));var hardwareService=require(_0xa2d2('0x12'));var logger=require(_0xa2d2('0x13'))(_0xa2d2('0x14'));var utils=require('../../config/utils');var config=require(_0xa2d2('0x15'));var licenseUtil=require(_0xa2d2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f474d,_0x384eea){_0x384eea=_0x384eea||0xcc;return function(_0x16c447){if(_0x16c447){return _0x3f474d['sendStatus'](_0x384eea);}return _0x3f474d[_0xa2d2('0x17')](_0x384eea)[_0xa2d2('0x18')]();};}function respondWithResult(_0x8821c9,_0x3d3970){_0x3d3970=_0x3d3970||0xc8;return function(_0x5b7c63){if(_0x5b7c63){return _0x8821c9[_0xa2d2('0x17')](_0x3d3970)['json'](_0x5b7c63);}};}function respondWithFilteredResult(_0x310c5f,_0x73eb11){return function(_0x4f67b1){if(_0x4f67b1){var _0x462a13=typeof _0x73eb11['offset']===_0xa2d2('0x19')&&typeof _0x73eb11[_0xa2d2('0x1a')]===_0xa2d2('0x19');var _0x223b7f=_0x4f67b1[_0xa2d2('0x1b')];var _0x4b4a8f=_0x462a13?0x0:_0x73eb11['offset'];var _0x2fab6d=_0x462a13?_0x4f67b1[_0xa2d2('0x1b')]:_0x73eb11[_0xa2d2('0x1c')]+_0x73eb11['limit'];var _0x1668db;if(_0x2fab6d>=_0x223b7f){_0x2fab6d=_0x223b7f;_0x1668db=0xc8;}else{_0x1668db=0xce;}_0x310c5f[_0xa2d2('0x17')](_0x1668db);return _0x310c5f['set'](_0xa2d2('0x1d'),_0x4b4a8f+'-'+_0x2fab6d+'/'+_0x223b7f)[_0xa2d2('0x1e')](_0x4f67b1);}return null;};}function patchUpdates(_0x4d3b6c){return function(_0xf2f7fa){try{jsonpatch[_0xa2d2('0x1f')](_0xf2f7fa,_0x4d3b6c,!![]);}catch(_0xe9e34e){return BPromise[_0xa2d2('0x20')](_0xe9e34e);}return _0xf2f7fa[_0xa2d2('0x21')]();};}function saveUpdates(_0x105574,_0x48ec3f){return function(_0x48f2cd){if(_0x48f2cd){return _0x48f2cd[_0xa2d2('0x22')](_0x105574)[_0xa2d2('0x23')](function(_0x597e25){return _0x597e25;});}return null;};}function removeEntity(_0xfce1a1,_0xedc0ed){return function(_0x92bf77){if(_0x92bf77){return _0x92bf77[_0xa2d2('0x24')]()['then'](function(){var _0x4fa4c8=_0x92bf77[_0xa2d2('0x25')]({'plain':!![]});var _0x201835='Triggers';return db[_0xa2d2('0x26')][_0xa2d2('0x24')]({'where':{'type':_0x201835,'resourceId':_0x4fa4c8['id']}})[_0xa2d2('0x23')](function(){return _0x92bf77;});})[_0xa2d2('0x23')](function(){_0xfce1a1[_0xa2d2('0x17')](0xcc)[_0xa2d2('0x18')]();});}};}function handleEntityNotFound(_0x2c9f50,_0x2b4d58){return function(_0x1474d0){if(!_0x1474d0){_0x2c9f50['sendStatus'](0x194);}return _0x1474d0;};}function handleError(_0x25ffc9,_0x481cdf){_0x481cdf=_0x481cdf||0x1f4;return function(_0xda2c62){logger['error'](_0xda2c62[_0xa2d2('0x27')]);if(_0xda2c62[_0xa2d2('0x28')]){delete _0xda2c62['name'];}_0x25ffc9['status'](_0x481cdf)[_0xa2d2('0x29')](_0xda2c62);};}exports[_0xa2d2('0x2a')]=function(_0x1f6651,_0x38b9bd){var _0x58e215={},_0x515547={},_0x155344={'count':0x0,'rows':[]};var _0x5d80e8=_[_0xa2d2('0x2b')](db[_0xa2d2('0x2c')][_0xa2d2('0x2d')],function(_0x25b149){return{'name':_0x25b149[_0xa2d2('0x2e')],'type':_0x25b149[_0xa2d2('0x2f')][_0xa2d2('0x30')]};});_0x515547[_0xa2d2('0x31')]=_['map'](_0x5d80e8,_0xa2d2('0x28'));_0x515547[_0xa2d2('0x32')]=_[_0xa2d2('0x33')](_0x1f6651[_0xa2d2('0x32')]);_0x515547[_0xa2d2('0x34')]=_[_0xa2d2('0x35')](_0x515547[_0xa2d2('0x31')],_0x515547[_0xa2d2('0x32')]);_0x58e215[_0xa2d2('0x36')]=_[_0xa2d2('0x35')](_0x515547[_0xa2d2('0x31')],qs[_0xa2d2('0x37')](_0x1f6651[_0xa2d2('0x32')][_0xa2d2('0x37')]));_0x58e215['attributes']=_0x58e215[_0xa2d2('0x36')][_0xa2d2('0x38')]?_0x58e215['attributes']:_0x515547['model'];if(!_0x1f6651[_0xa2d2('0x32')]['hasOwnProperty'](_0xa2d2('0x39'))){_0x58e215[_0xa2d2('0x1a')]=qs[_0xa2d2('0x1a')](_0x1f6651[_0xa2d2('0x32')][_0xa2d2('0x1a')]);_0x58e215['offset']=qs[_0xa2d2('0x1c')](_0x1f6651['query']['offset']);}_0x58e215[_0xa2d2('0x3a')]=qs[_0xa2d2('0x3b')](_0x1f6651['query'][_0xa2d2('0x3b')]);_0x58e215['where']=qs[_0xa2d2('0x34')](_[_0xa2d2('0x3c')](_0x1f6651[_0xa2d2('0x32')],_0x515547[_0xa2d2('0x34')]),_0x5d80e8);if(_0x1f6651[_0xa2d2('0x32')][_0xa2d2('0x3d')]){_0x58e215[_0xa2d2('0x3e')]=_[_0xa2d2('0x3f')](_0x58e215[_0xa2d2('0x3e')],{'$or':_[_0xa2d2('0x2b')](_0x5d80e8,function(_0x478bf9){if(_0x478bf9[_0xa2d2('0x2f')]!==_0xa2d2('0x40')){var _0x47119b={};_0x47119b[_0x478bf9[_0xa2d2('0x28')]]={'$like':'%'+_0x1f6651[_0xa2d2('0x32')][_0xa2d2('0x3d')]+'%'};return _0x47119b;}})});}_0x58e215=_[_0xa2d2('0x3f')]({},_0x58e215,_0x1f6651['options']);var _0x922221={'where':_0x58e215[_0xa2d2('0x3e')]};return db[_0xa2d2('0x2c')][_0xa2d2('0x1b')](_0x922221)[_0xa2d2('0x23')](function(_0x1f38ad){_0x155344['count']=_0x1f38ad;if(_0x1f6651[_0xa2d2('0x32')][_0xa2d2('0x41')]){_0x58e215[_0xa2d2('0x42')]=[{'all':!![]}];}return db[_0xa2d2('0x2c')][_0xa2d2('0x43')](_0x58e215);})[_0xa2d2('0x23')](function(_0x3a93f4){_0x155344[_0xa2d2('0x44')]=_0x3a93f4;return _0x155344;})['then'](respondWithFilteredResult(_0x38b9bd,_0x58e215))[_0xa2d2('0x45')](handleError(_0x38b9bd,null));};exports[_0xa2d2('0x46')]=function(_0x35c212,_0x4d8bb9){var _0x453587={'raw':![],'where':{'id':_0x35c212[_0xa2d2('0x47')]['id']}},_0x1017ac={};_0x1017ac[_0xa2d2('0x31')]=_['keys'](db[_0xa2d2('0x2c')][_0xa2d2('0x2d')]);_0x1017ac[_0xa2d2('0x32')]=_[_0xa2d2('0x33')](_0x35c212[_0xa2d2('0x32')]);_0x1017ac[_0xa2d2('0x34')]=_[_0xa2d2('0x35')](_0x1017ac[_0xa2d2('0x31')],_0x1017ac[_0xa2d2('0x32')]);_0x453587[_0xa2d2('0x36')]=_[_0xa2d2('0x35')](_0x1017ac['model'],qs['fields'](_0x35c212[_0xa2d2('0x32')][_0xa2d2('0x37')]));_0x453587['attributes']=_0x453587['attributes'][_0xa2d2('0x38')]?_0x453587[_0xa2d2('0x36')]:_0x1017ac[_0xa2d2('0x31')];if(_0x35c212[_0xa2d2('0x32')][_0xa2d2('0x41')]){_0x453587[_0xa2d2('0x42')]=[{'all':!![]}];}_0x453587=_[_0xa2d2('0x3f')]({},_0x453587,_0x35c212[_0xa2d2('0x48')]);return db['Trigger']['find'](_0x453587)[_0xa2d2('0x23')](handleEntityNotFound(_0x4d8bb9,null))[_0xa2d2('0x23')](respondWithResult(_0x4d8bb9,null))[_0xa2d2('0x45')](handleError(_0x4d8bb9,null));};exports[_0xa2d2('0x49')]=function(_0x1f1855,_0x311d84){return db['Trigger'][_0xa2d2('0x49')](_0x1f1855['body'],{})[_0xa2d2('0x23')](function(_0x274a74){var _0x1e2e95=_0x1f1855[_0xa2d2('0x4a')][_0xa2d2('0x25')]({'plain':!![]});if(!_0x1e2e95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e2e95[_0xa2d2('0x4b')]===_0xa2d2('0x4a')){var _0x321f9d=_0x274a74[_0xa2d2('0x25')]({'plain':!![]});var _0x1c6b44=_0xa2d2('0x4c');return db[_0xa2d2('0x4d')][_0xa2d2('0x4e')]({'where':{'name':_0x1c6b44,'userProfileId':_0x1e2e95[_0xa2d2('0x4f')]},'raw':!![]})['then'](function(_0x383910){if(_0x383910&&_0x383910[_0xa2d2('0x50')]===0x0){return db[_0xa2d2('0x26')]['create']({'name':_0x321f9d[_0xa2d2('0x28')],'resourceId':_0x321f9d['id'],'type':_0x383910[_0xa2d2('0x28')],'sectionId':_0x383910['id']},{})[_0xa2d2('0x23')](function(){return _0x274a74;});}else{return _0x274a74;}})[_0xa2d2('0x45')](function(_0xb47106){logger[_0xa2d2('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb47106);throw _0xb47106;});}return _0x274a74;})['then'](respondWithResult(_0x311d84,0xc9))[_0xa2d2('0x45')](handleError(_0x311d84,null));};exports[_0xa2d2('0x22')]=function(_0x1d9fe9,_0x10eb54){if(_0x1d9fe9[_0xa2d2('0x52')]['id']){delete _0x1d9fe9[_0xa2d2('0x52')]['id'];}return db['Trigger'][_0xa2d2('0x4e')]({'where':{'id':_0x1d9fe9['params']['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x10eb54,null))[_0xa2d2('0x23')](saveUpdates(_0x1d9fe9[_0xa2d2('0x52')],null))[_0xa2d2('0x23')](respondWithResult(_0x10eb54,null))[_0xa2d2('0x45')](handleError(_0x10eb54,null));};exports[_0xa2d2('0x24')]=function(_0x88b0ae,_0x19e5b5){return db[_0xa2d2('0x2c')][_0xa2d2('0x4e')]({'where':{'id':_0x88b0ae['params']['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x19e5b5,null))[_0xa2d2('0x23')](removeEntity(_0x19e5b5,null))[_0xa2d2('0x45')](handleError(_0x19e5b5,null));};exports[_0xa2d2('0x53')]=function(_0x5866e3,_0x3aaacf,_0x2f8dc4){if(_0x5866e3[_0xa2d2('0x52')]['id']){delete _0x5866e3[_0xa2d2('0x52')]['id'];}return db[_0xa2d2('0x2c')][_0xa2d2('0x4e')]({'where':{'id':_0x5866e3['params']['id']}})['then'](handleEntityNotFound(_0x3aaacf,null))[_0xa2d2('0x23')](function(_0x344a58){if(_0x344a58){_0x5866e3[_0xa2d2('0x52')]['TriggerAllId']=_0x344a58['id'];return db[_0xa2d2('0x54')]['create'](_0x5866e3[_0xa2d2('0x52')]);}})[_0xa2d2('0x23')](respondWithResult(_0x3aaacf,null))[_0xa2d2('0x45')](handleError(_0x3aaacf,null));};exports[_0xa2d2('0x55')]=function(_0x590a25,_0x5408e6,_0x1acf44){if(_0x590a25[_0xa2d2('0x52')]['id']){delete _0x590a25[_0xa2d2('0x52')]['id'];}return db[_0xa2d2('0x2c')][_0xa2d2('0x4e')]({'where':{'id':_0x590a25[_0xa2d2('0x47')]['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x5408e6,null))[_0xa2d2('0x23')](function(_0xfe0458){if(_0xfe0458){_0x590a25[_0xa2d2('0x52')]['TriggerAnyId']=_0xfe0458['id'];return db[_0xa2d2('0x54')][_0xa2d2('0x49')](_0x590a25['body']);}})[_0xa2d2('0x23')](respondWithResult(_0x5408e6,null))[_0xa2d2('0x45')](handleError(_0x5408e6,null));};exports[_0xa2d2('0x56')]=function(_0x459438,_0x3dbec1,_0x28a81f){var _0x22a44b={};var _0x566f36={};var _0x12fb41;var _0x7b6178;return db['Trigger'][_0xa2d2('0x57')]({'where':{'id':_0x459438[_0xa2d2('0x47')]['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x3dbec1,null))[_0xa2d2('0x23')](function(_0x306868){if(_0x306868){_0x12fb41=_0x306868;_0x566f36[_0xa2d2('0x31')]=_['keys'](db[_0xa2d2('0x54')][_0xa2d2('0x2d')]);_0x566f36[_0xa2d2('0x32')]=_[_0xa2d2('0x33')](_0x459438['query']);_0x566f36[_0xa2d2('0x34')]=_[_0xa2d2('0x35')](_0x566f36[_0xa2d2('0x31')],_0x566f36['query']);_0x22a44b[_0xa2d2('0x36')]=_[_0xa2d2('0x35')](_0x566f36[_0xa2d2('0x31')],qs[_0xa2d2('0x37')](_0x459438[_0xa2d2('0x32')][_0xa2d2('0x37')]));_0x22a44b[_0xa2d2('0x36')]=_0x22a44b[_0xa2d2('0x36')][_0xa2d2('0x38')]?_0x22a44b[_0xa2d2('0x36')]:_0x566f36['model'];_0x22a44b['order']=qs[_0xa2d2('0x3b')](_0x459438[_0xa2d2('0x32')]['sort']);_0x22a44b[_0xa2d2('0x3e')]=qs['filters'](_[_0xa2d2('0x3c')](_0x459438[_0xa2d2('0x32')],_0x566f36[_0xa2d2('0x34')]));if(_0x459438[_0xa2d2('0x32')]['filter']){_0x22a44b[_0xa2d2('0x3e')]=_[_0xa2d2('0x3f')](_0x22a44b[_0xa2d2('0x3e')],{'$or':_[_0xa2d2('0x2b')](_0x22a44b['attributes'],function(_0x229735){var _0x923e3={};_0x923e3[_0x229735]={'$like':'%'+_0x459438[_0xa2d2('0x32')][_0xa2d2('0x3d')]+'%'};return _0x923e3;})});}_0x22a44b=_[_0xa2d2('0x3f')]({},_0x22a44b,_0x459438[_0xa2d2('0x48')]);return _0x12fb41[_0xa2d2('0x56')](_0x22a44b);}})[_0xa2d2('0x23')](function(_0x2cf18b){if(_0x2cf18b){_0x7b6178=_0x2cf18b[_0xa2d2('0x38')];if(!_0x459438['query'][_0xa2d2('0x58')](_0xa2d2('0x39'))){_0x22a44b[_0xa2d2('0x1a')]=qs['limit'](_0x459438[_0xa2d2('0x32')][_0xa2d2('0x1a')]);_0x22a44b[_0xa2d2('0x1c')]=qs['offset'](_0x459438['query'][_0xa2d2('0x1c')]);}return _0x12fb41[_0xa2d2('0x56')](_0x22a44b);}})[_0xa2d2('0x23')](function(_0x868f42){if(_0x868f42){return _0x868f42?{'count':_0x7b6178,'rows':_0x868f42}:null;}})[_0xa2d2('0x23')](respondWithResult(_0x3dbec1,null))[_0xa2d2('0x45')](handleError(_0x3dbec1,null));};exports['getAnyConditions']=function(_0x3ed61d,_0x2340a2,_0x26e0a3){var _0x5d320c={};var _0x5837d5={};var _0x1f0a8f;var _0x4b2f44;return db[_0xa2d2('0x2c')]['findOne']({'where':{'id':_0x3ed61d['params']['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x2340a2,null))[_0xa2d2('0x23')](function(_0x4b3137){if(_0x4b3137){_0x1f0a8f=_0x4b3137;_0x5837d5[_0xa2d2('0x31')]=_[_0xa2d2('0x33')](db[_0xa2d2('0x54')]['rawAttributes']);_0x5837d5[_0xa2d2('0x32')]=_[_0xa2d2('0x33')](_0x3ed61d[_0xa2d2('0x32')]);_0x5837d5[_0xa2d2('0x34')]=_[_0xa2d2('0x35')](_0x5837d5[_0xa2d2('0x31')],_0x5837d5['query']);_0x5d320c['attributes']=_[_0xa2d2('0x35')](_0x5837d5[_0xa2d2('0x31')],qs[_0xa2d2('0x37')](_0x3ed61d['query']['fields']));_0x5d320c[_0xa2d2('0x36')]=_0x5d320c['attributes'][_0xa2d2('0x38')]?_0x5d320c[_0xa2d2('0x36')]:_0x5837d5[_0xa2d2('0x31')];_0x5d320c[_0xa2d2('0x3a')]=qs[_0xa2d2('0x3b')](_0x3ed61d[_0xa2d2('0x32')][_0xa2d2('0x3b')]);_0x5d320c[_0xa2d2('0x3e')]=qs[_0xa2d2('0x34')](_[_0xa2d2('0x3c')](_0x3ed61d[_0xa2d2('0x32')],_0x5837d5['filters']));if(_0x3ed61d['query'][_0xa2d2('0x3d')]){_0x5d320c[_0xa2d2('0x3e')]=_['merge'](_0x5d320c['where'],{'$or':_['map'](_0x5d320c['attributes'],function(_0x7627dc){var _0xb46937={};_0xb46937[_0x7627dc]={'$like':'%'+_0x3ed61d[_0xa2d2('0x32')][_0xa2d2('0x3d')]+'%'};return _0xb46937;})});}_0x5d320c=_[_0xa2d2('0x3f')]({},_0x5d320c,_0x3ed61d[_0xa2d2('0x48')]);return _0x1f0a8f[_0xa2d2('0x59')](_0x5d320c);}})[_0xa2d2('0x23')](function(_0x28149f){if(_0x28149f){_0x4b2f44=_0x28149f[_0xa2d2('0x38')];if(!_0x3ed61d[_0xa2d2('0x32')]['hasOwnProperty'](_0xa2d2('0x39'))){_0x5d320c[_0xa2d2('0x1a')]=qs[_0xa2d2('0x1a')](_0x3ed61d[_0xa2d2('0x32')][_0xa2d2('0x1a')]);_0x5d320c[_0xa2d2('0x1c')]=qs[_0xa2d2('0x1c')](_0x3ed61d[_0xa2d2('0x32')]['offset']);}return _0x1f0a8f[_0xa2d2('0x59')](_0x5d320c);}})[_0xa2d2('0x23')](function(_0x535511){if(_0x535511){return _0x535511?{'count':_0x4b2f44,'rows':_0x535511}:null;}})['then'](respondWithResult(_0x2340a2,null))[_0xa2d2('0x45')](handleError(_0x2340a2,null));};exports[_0xa2d2('0x5a')]=function(_0x3e9fed,_0x3c9f62,_0x4a9bbf){if(_0x3e9fed[_0xa2d2('0x52')]['id']){delete _0x3e9fed[_0xa2d2('0x52')]['id'];}return db[_0xa2d2('0x2c')][_0xa2d2('0x4e')]({'where':{'id':_0x3e9fed['params']['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x3c9f62,null))[_0xa2d2('0x23')](function(_0x243077){if(_0x243077){_0x3e9fed['body']['TriggerId']=_0x243077['id'];return db[_0xa2d2('0x5b')][_0xa2d2('0x49')](_0x3e9fed[_0xa2d2('0x52')]);}})['then'](respondWithResult(_0x3c9f62,null))['catch'](handleError(_0x3c9f62,null));};exports[_0xa2d2('0x5c')]=function(_0x4ec55f,_0x3cc559,_0xc6502){var _0x358828={};var _0x4c3e19={};var _0x1e14fb;var _0x2eabc2;return db['Trigger'][_0xa2d2('0x57')]({'where':{'id':_0x4ec55f[_0xa2d2('0x47')]['id']}})[_0xa2d2('0x23')](handleEntityNotFound(_0x3cc559,null))[_0xa2d2('0x23')](function(_0x1357a7){if(_0x1357a7){_0x1e14fb=_0x1357a7;_0x4c3e19[_0xa2d2('0x31')]=_[_0xa2d2('0x33')](db[_0xa2d2('0x5b')][_0xa2d2('0x2d')]);_0x4c3e19['query']=_[_0xa2d2('0x33')](_0x4ec55f[_0xa2d2('0x32')]);_0x4c3e19[_0xa2d2('0x34')]=_['intersection'](_0x4c3e19[_0xa2d2('0x31')],_0x4c3e19['query']);_0x358828['attributes']=_[_0xa2d2('0x35')](_0x4c3e19[_0xa2d2('0x31')],qs[_0xa2d2('0x37')](_0x4ec55f[_0xa2d2('0x32')][_0xa2d2('0x37')]));_0x358828[_0xa2d2('0x36')]=_0x358828[_0xa2d2('0x36')]['length']?_0x358828['attributes']:_0x4c3e19[_0xa2d2('0x31')];_0x358828[_0xa2d2('0x3a')]=qs['sort'](_0x4ec55f[_0xa2d2('0x32')][_0xa2d2('0x3b')]);_0x358828['where']=qs[_0xa2d2('0x34')](_[_0xa2d2('0x3c')](_0x4ec55f[_0xa2d2('0x32')],_0x4c3e19[_0xa2d2('0x34')]));if(_0x4ec55f['query'][_0xa2d2('0x3d')]){_0x358828[_0xa2d2('0x3e')]=_[_0xa2d2('0x3f')](_0x358828['where'],{'$or':_['map'](_0x358828[_0xa2d2('0x36')],function(_0x1d554e){var _0x2ec0db={};_0x2ec0db[_0x1d554e]={'$like':'%'+_0x4ec55f['query'][_0xa2d2('0x3d')]+'%'};return _0x2ec0db;})});}_0x358828=_[_0xa2d2('0x3f')]({},_0x358828,_0x4ec55f[_0xa2d2('0x48')]);return _0x1e14fb[_0xa2d2('0x5c')](_0x358828);}})[_0xa2d2('0x23')](function(_0x248c55){if(_0x248c55){_0x2eabc2=_0x248c55[_0xa2d2('0x38')];if(!_0x4ec55f['query'][_0xa2d2('0x58')](_0xa2d2('0x39'))){_0x358828[_0xa2d2('0x1a')]=qs[_0xa2d2('0x1a')](_0x4ec55f[_0xa2d2('0x32')][_0xa2d2('0x1a')]);_0x358828[_0xa2d2('0x1c')]=qs['offset'](_0x4ec55f[_0xa2d2('0x32')][_0xa2d2('0x1c')]);}return _0x1e14fb[_0xa2d2('0x5c')](_0x358828);}})[_0xa2d2('0x23')](function(_0x3100d0){if(_0x3100d0){return _0x3100d0?{'count':_0x2eabc2,'rows':_0x3100d0}:null;}})[_0xa2d2('0x23')](respondWithResult(_0x3cc559,null))[_0xa2d2('0x45')](handleError(_0x3cc559,null));};
\ No newline at end of file
+var _0x9e92=['sendStatus','error','stack','name','send','index','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','sort','where','filters','pick','merge','map','type','VIRTUAL','options','Trigger','includeAll','include','findAll','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','catch','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','filter','hasOwnProperty','nolimit','getAnyConditions','order','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Triggers','UserProfileResource','then'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x9e92,0x1af));var _0x29e9=function(_0x4acad8,_0x2f44fe){_0x4acad8=_0x4acad8-0x0;var _0x7885f4=_0x9e92[_0x4acad8];return _0x7885f4;};'use strict';var emlformat=require(_0x29e9('0x0'));var rimraf=require(_0x29e9('0x1'));var zipdir=require(_0x29e9('0x2'));var jsonpatch=require(_0x29e9('0x3'));var rp=require(_0x29e9('0x4'));var moment=require(_0x29e9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x29e9('0x6'));var util=require(_0x29e9('0x7'));var path=require('path');var sox=require(_0x29e9('0x8'));var csv=require(_0x29e9('0x9'));var ejs=require(_0x29e9('0xa'));var fs=require('fs');var fs_extra=require(_0x29e9('0xb'));var _=require(_0x29e9('0xc'));var squel=require('squel');var crypto=require(_0x29e9('0xd'));var jsforce=require(_0x29e9('0xe'));var deskjs=require(_0x29e9('0xf'));var toCsv=require(_0x29e9('0x9'));var querystring=require('querystring');var Papa=require(_0x29e9('0x10'));var Redis=require(_0x29e9('0x11'));var authService=require(_0x29e9('0x12'));var qs=require(_0x29e9('0x13'));var as=require(_0x29e9('0x14'));var hardwareService=require(_0x29e9('0x15'));var logger=require('../../config/logger')(_0x29e9('0x16'));var utils=require(_0x29e9('0x17'));var config=require(_0x29e9('0x18'));var licenseUtil=require(_0x29e9('0x19'));var db=require(_0x29e9('0x1a'))['db'];function respondWithStatusCode(_0x4c1575,_0x2627fc){_0x2627fc=_0x2627fc||0xcc;return function(_0x34a1fb){if(_0x34a1fb){return _0x4c1575['sendStatus'](_0x2627fc);}return _0x4c1575[_0x29e9('0x1b')](_0x2627fc)[_0x29e9('0x1c')]();};}function respondWithResult(_0x2385e3,_0x39bf78){_0x39bf78=_0x39bf78||0xc8;return function(_0x5d618c){if(_0x5d618c){return _0x2385e3['status'](_0x39bf78)[_0x29e9('0x1d')](_0x5d618c);}};}function respondWithFilteredResult(_0x4ada72,_0x116938){return function(_0x58d125){if(_0x58d125){var _0x2ef1a8=typeof _0x116938[_0x29e9('0x1e')]==='undefined'&&typeof _0x116938[_0x29e9('0x1f')]==='undefined';var _0xd5e324=_0x58d125[_0x29e9('0x20')];var _0x5c5e52=_0x2ef1a8?0x0:_0x116938[_0x29e9('0x1e')];var _0x3fad75=_0x2ef1a8?_0x58d125[_0x29e9('0x20')]:_0x116938[_0x29e9('0x1e')]+_0x116938[_0x29e9('0x1f')];var _0x54c2f5;if(_0x3fad75>=_0xd5e324){_0x3fad75=_0xd5e324;_0x54c2f5=0xc8;}else{_0x54c2f5=0xce;}_0x4ada72[_0x29e9('0x1b')](_0x54c2f5);return _0x4ada72[_0x29e9('0x21')](_0x29e9('0x22'),_0x5c5e52+'-'+_0x3fad75+'/'+_0xd5e324)[_0x29e9('0x1d')](_0x58d125);}return null;};}function patchUpdates(_0x3e2e6a){return function(_0x38d312){try{jsonpatch[_0x29e9('0x23')](_0x38d312,_0x3e2e6a,!![]);}catch(_0x2bc796){return BPromise[_0x29e9('0x24')](_0x2bc796);}return _0x38d312[_0x29e9('0x25')]();};}function saveUpdates(_0x4bbc20,_0x32a2e0){return function(_0x48792b){if(_0x48792b){return _0x48792b[_0x29e9('0x26')](_0x4bbc20)['then'](function(_0x469b4b){return _0x469b4b;});}return null;};}function removeEntity(_0xf32824,_0x319960){return function(_0x509d19){if(_0x509d19){return _0x509d19[_0x29e9('0x27')]()['then'](function(){var _0x424be5=_0x509d19[_0x29e9('0x28')]({'plain':!![]});var _0x1c7108=_0x29e9('0x29');return db[_0x29e9('0x2a')][_0x29e9('0x27')]({'where':{'type':_0x1c7108,'resourceId':_0x424be5['id']}})[_0x29e9('0x2b')](function(){return _0x509d19;});})[_0x29e9('0x2b')](function(){_0xf32824['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a484f,_0x4103aa){return function(_0xcdaf81){if(!_0xcdaf81){_0x2a484f[_0x29e9('0x2c')](0x194);}return _0xcdaf81;};}function handleError(_0x9bc408,_0x1fd2fc){_0x1fd2fc=_0x1fd2fc||0x1f4;return function(_0x379c65){logger[_0x29e9('0x2d')](_0x379c65[_0x29e9('0x2e')]);if(_0x379c65[_0x29e9('0x2f')]){delete _0x379c65[_0x29e9('0x2f')];}_0x9bc408['status'](_0x1fd2fc)[_0x29e9('0x30')](_0x379c65);};}exports[_0x29e9('0x31')]=function(_0x28c8fa,_0x2552e7){var _0x6bdcce={},_0x120d44={},_0x341efa={'count':0x0,'rows':[]};var _0x288c1d=_['map'](db['Trigger'][_0x29e9('0x32')],function(_0x4f0e2d){return{'name':_0x4f0e2d['fieldName'],'type':_0x4f0e2d['type'][_0x29e9('0x33')]};});_0x120d44[_0x29e9('0x34')]=_['map'](_0x288c1d,_0x29e9('0x2f'));_0x120d44['query']=_[_0x29e9('0x35')](_0x28c8fa[_0x29e9('0x36')]);_0x120d44['filters']=_['intersection'](_0x120d44[_0x29e9('0x34')],_0x120d44['query']);_0x6bdcce[_0x29e9('0x37')]=_[_0x29e9('0x38')](_0x120d44['model'],qs[_0x29e9('0x39')](_0x28c8fa['query']['fields']));_0x6bdcce[_0x29e9('0x37')]=_0x6bdcce['attributes'][_0x29e9('0x3a')]?_0x6bdcce['attributes']:_0x120d44[_0x29e9('0x34')];if(!_0x28c8fa[_0x29e9('0x36')]['hasOwnProperty']('nolimit')){_0x6bdcce[_0x29e9('0x1f')]=qs['limit'](_0x28c8fa[_0x29e9('0x36')]['limit']);_0x6bdcce[_0x29e9('0x1e')]=qs['offset'](_0x28c8fa[_0x29e9('0x36')]['offset']);}_0x6bdcce['order']=qs[_0x29e9('0x3b')](_0x28c8fa[_0x29e9('0x36')][_0x29e9('0x3b')]);_0x6bdcce[_0x29e9('0x3c')]=qs[_0x29e9('0x3d')](_[_0x29e9('0x3e')](_0x28c8fa[_0x29e9('0x36')],_0x120d44[_0x29e9('0x3d')]),_0x288c1d);if(_0x28c8fa['query']['filter']){_0x6bdcce['where']=_[_0x29e9('0x3f')](_0x6bdcce[_0x29e9('0x3c')],{'$or':_[_0x29e9('0x40')](_0x288c1d,function(_0x641672){if(_0x641672[_0x29e9('0x41')]!==_0x29e9('0x42')){var _0x4e08f0={};_0x4e08f0[_0x641672['name']]={'$like':'%'+_0x28c8fa['query']['filter']+'%'};return _0x4e08f0;}})});}_0x6bdcce=_[_0x29e9('0x3f')]({},_0x6bdcce,_0x28c8fa[_0x29e9('0x43')]);var _0x54997a={'where':_0x6bdcce[_0x29e9('0x3c')]};return db[_0x29e9('0x44')][_0x29e9('0x20')](_0x54997a)[_0x29e9('0x2b')](function(_0x2c28ba){_0x341efa[_0x29e9('0x20')]=_0x2c28ba;if(_0x28c8fa[_0x29e9('0x36')][_0x29e9('0x45')]){_0x6bdcce[_0x29e9('0x46')]=[{'all':!![]}];}return db[_0x29e9('0x44')][_0x29e9('0x47')](_0x6bdcce);})[_0x29e9('0x2b')](function(_0x39c7fb){_0x341efa['rows']=_0x39c7fb;return _0x341efa;})['then'](respondWithFilteredResult(_0x2552e7,_0x6bdcce))['catch'](handleError(_0x2552e7,null));};exports[_0x29e9('0x48')]=function(_0x2e6446,_0x48e364){var _0x19c85e={'raw':![],'where':{'id':_0x2e6446[_0x29e9('0x49')]['id']}},_0x4063a7={};_0x4063a7[_0x29e9('0x34')]=_[_0x29e9('0x35')](db[_0x29e9('0x44')]['rawAttributes']);_0x4063a7[_0x29e9('0x36')]=_['keys'](_0x2e6446[_0x29e9('0x36')]);_0x4063a7[_0x29e9('0x3d')]=_[_0x29e9('0x38')](_0x4063a7['model'],_0x4063a7[_0x29e9('0x36')]);_0x19c85e[_0x29e9('0x37')]=_[_0x29e9('0x38')](_0x4063a7[_0x29e9('0x34')],qs[_0x29e9('0x39')](_0x2e6446[_0x29e9('0x36')][_0x29e9('0x39')]));_0x19c85e[_0x29e9('0x37')]=_0x19c85e['attributes'][_0x29e9('0x3a')]?_0x19c85e[_0x29e9('0x37')]:_0x4063a7[_0x29e9('0x34')];if(_0x2e6446[_0x29e9('0x36')][_0x29e9('0x45')]){_0x19c85e[_0x29e9('0x46')]=[{'all':!![]}];}_0x19c85e=_[_0x29e9('0x3f')]({},_0x19c85e,_0x2e6446[_0x29e9('0x43')]);return db[_0x29e9('0x44')][_0x29e9('0x4a')](_0x19c85e)[_0x29e9('0x2b')](handleEntityNotFound(_0x48e364,null))[_0x29e9('0x2b')](respondWithResult(_0x48e364,null))['catch'](handleError(_0x48e364,null));};exports[_0x29e9('0x4b')]=function(_0x3e7a56,_0x4b7273){return db[_0x29e9('0x44')][_0x29e9('0x4b')](_0x3e7a56[_0x29e9('0x4c')],{})[_0x29e9('0x2b')](function(_0x532461){var _0x5eafbe=_0x3e7a56['user'][_0x29e9('0x28')]({'plain':!![]});if(!_0x5eafbe)throw new Error(_0x29e9('0x4d'));if(_0x5eafbe[_0x29e9('0x4e')]===_0x29e9('0x4f')){var _0x56e581=_0x532461[_0x29e9('0x28')]({'plain':!![]});var _0xeff880='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0xeff880,'userProfileId':_0x5eafbe['userProfileId']},'raw':!![]})[_0x29e9('0x2b')](function(_0x2f48df){if(_0x2f48df&&_0x2f48df['autoAssociation']===0x0){return db[_0x29e9('0x2a')]['create']({'name':_0x56e581[_0x29e9('0x2f')],'resourceId':_0x56e581['id'],'type':_0x2f48df[_0x29e9('0x2f')],'sectionId':_0x2f48df['id']},{})['then'](function(){return _0x532461;});}else{return _0x532461;}})[_0x29e9('0x50')](function(_0x2f75b9){logger[_0x29e9('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f75b9);throw _0x2f75b9;});}return _0x532461;})[_0x29e9('0x2b')](respondWithResult(_0x4b7273,0xc9))[_0x29e9('0x50')](handleError(_0x4b7273,null));};exports[_0x29e9('0x26')]=function(_0x10a41f,_0xd7e176){if(_0x10a41f['body']['id']){delete _0x10a41f[_0x29e9('0x4c')]['id'];}return db[_0x29e9('0x44')][_0x29e9('0x4a')]({'where':{'id':_0x10a41f[_0x29e9('0x49')]['id']}})[_0x29e9('0x2b')](handleEntityNotFound(_0xd7e176,null))['then'](saveUpdates(_0x10a41f[_0x29e9('0x4c')],null))[_0x29e9('0x2b')](respondWithResult(_0xd7e176,null))[_0x29e9('0x50')](handleError(_0xd7e176,null));};exports[_0x29e9('0x27')]=function(_0x4270c3,_0x1e4c00){return db[_0x29e9('0x44')][_0x29e9('0x4a')]({'where':{'id':_0x4270c3[_0x29e9('0x49')]['id']}})[_0x29e9('0x2b')](handleEntityNotFound(_0x1e4c00,null))[_0x29e9('0x2b')](removeEntity(_0x1e4c00,null))[_0x29e9('0x50')](handleError(_0x1e4c00,null));};exports['addAllCondition']=function(_0x2d8d1b,_0x40eb8c,_0x9ddc07){if(_0x2d8d1b[_0x29e9('0x4c')]['id']){delete _0x2d8d1b[_0x29e9('0x4c')]['id'];}return db[_0x29e9('0x44')][_0x29e9('0x4a')]({'where':{'id':_0x2d8d1b[_0x29e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x40eb8c,null))[_0x29e9('0x2b')](function(_0x3a1492){if(_0x3a1492){_0x2d8d1b['body'][_0x29e9('0x51')]=_0x3a1492['id'];return db[_0x29e9('0x52')]['create'](_0x2d8d1b[_0x29e9('0x4c')]);}})['then'](respondWithResult(_0x40eb8c,null))[_0x29e9('0x50')](handleError(_0x40eb8c,null));};exports[_0x29e9('0x53')]=function(_0x1486a1,_0x6e6fcd,_0x41fc95){if(_0x1486a1[_0x29e9('0x4c')]['id']){delete _0x1486a1[_0x29e9('0x4c')]['id'];}return db[_0x29e9('0x44')]['find']({'where':{'id':_0x1486a1[_0x29e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x6e6fcd,null))[_0x29e9('0x2b')](function(_0x3aa4d9){if(_0x3aa4d9){_0x1486a1['body'][_0x29e9('0x54')]=_0x3aa4d9['id'];return db[_0x29e9('0x52')][_0x29e9('0x4b')](_0x1486a1[_0x29e9('0x4c')]);}})['then'](respondWithResult(_0x6e6fcd,null))[_0x29e9('0x50')](handleError(_0x6e6fcd,null));};exports[_0x29e9('0x55')]=function(_0x403b8b,_0x2ea641,_0x83c36a){var _0x2fe385={};var _0x3e10e2={};var _0x4db500;var _0x40478b;return db[_0x29e9('0x44')][_0x29e9('0x56')]({'where':{'id':_0x403b8b[_0x29e9('0x49')]['id']}})[_0x29e9('0x2b')](handleEntityNotFound(_0x2ea641,null))[_0x29e9('0x2b')](function(_0x234596){if(_0x234596){_0x4db500=_0x234596;_0x3e10e2[_0x29e9('0x34')]=_[_0x29e9('0x35')](db[_0x29e9('0x52')]['rawAttributes']);_0x3e10e2['query']=_[_0x29e9('0x35')](_0x403b8b[_0x29e9('0x36')]);_0x3e10e2['filters']=_['intersection'](_0x3e10e2[_0x29e9('0x34')],_0x3e10e2[_0x29e9('0x36')]);_0x2fe385[_0x29e9('0x37')]=_[_0x29e9('0x38')](_0x3e10e2[_0x29e9('0x34')],qs[_0x29e9('0x39')](_0x403b8b['query'][_0x29e9('0x39')]));_0x2fe385[_0x29e9('0x37')]=_0x2fe385[_0x29e9('0x37')][_0x29e9('0x3a')]?_0x2fe385[_0x29e9('0x37')]:_0x3e10e2['model'];_0x2fe385['order']=qs['sort'](_0x403b8b[_0x29e9('0x36')][_0x29e9('0x3b')]);_0x2fe385[_0x29e9('0x3c')]=qs[_0x29e9('0x3d')](_[_0x29e9('0x3e')](_0x403b8b['query'],_0x3e10e2[_0x29e9('0x3d')]));if(_0x403b8b[_0x29e9('0x36')][_0x29e9('0x57')]){_0x2fe385[_0x29e9('0x3c')]=_[_0x29e9('0x3f')](_0x2fe385['where'],{'$or':_[_0x29e9('0x40')](_0x2fe385[_0x29e9('0x37')],function(_0x558b85){var _0x4e3f5a={};_0x4e3f5a[_0x558b85]={'$like':'%'+_0x403b8b[_0x29e9('0x36')][_0x29e9('0x57')]+'%'};return _0x4e3f5a;})});}_0x2fe385=_['merge']({},_0x2fe385,_0x403b8b[_0x29e9('0x43')]);return _0x4db500[_0x29e9('0x55')](_0x2fe385);}})[_0x29e9('0x2b')](function(_0x56ccc2){if(_0x56ccc2){_0x40478b=_0x56ccc2[_0x29e9('0x3a')];if(!_0x403b8b['query'][_0x29e9('0x58')](_0x29e9('0x59'))){_0x2fe385[_0x29e9('0x1f')]=qs[_0x29e9('0x1f')](_0x403b8b[_0x29e9('0x36')][_0x29e9('0x1f')]);_0x2fe385[_0x29e9('0x1e')]=qs[_0x29e9('0x1e')](_0x403b8b[_0x29e9('0x36')][_0x29e9('0x1e')]);}return _0x4db500[_0x29e9('0x55')](_0x2fe385);}})[_0x29e9('0x2b')](function(_0x2022dd){if(_0x2022dd){return _0x2022dd?{'count':_0x40478b,'rows':_0x2022dd}:null;}})[_0x29e9('0x2b')](respondWithResult(_0x2ea641,null))['catch'](handleError(_0x2ea641,null));};exports[_0x29e9('0x5a')]=function(_0xaaadf9,_0x166baf,_0x4b45c9){var _0x55f864={};var _0x1a5371={};var _0x4f3a48;var _0x3be3b9;return db[_0x29e9('0x44')]['findOne']({'where':{'id':_0xaaadf9['params']['id']}})['then'](handleEntityNotFound(_0x166baf,null))[_0x29e9('0x2b')](function(_0x97db33){if(_0x97db33){_0x4f3a48=_0x97db33;_0x1a5371[_0x29e9('0x34')]=_[_0x29e9('0x35')](db[_0x29e9('0x52')]['rawAttributes']);_0x1a5371[_0x29e9('0x36')]=_[_0x29e9('0x35')](_0xaaadf9[_0x29e9('0x36')]);_0x1a5371['filters']=_[_0x29e9('0x38')](_0x1a5371[_0x29e9('0x34')],_0x1a5371[_0x29e9('0x36')]);_0x55f864[_0x29e9('0x37')]=_[_0x29e9('0x38')](_0x1a5371[_0x29e9('0x34')],qs[_0x29e9('0x39')](_0xaaadf9[_0x29e9('0x36')][_0x29e9('0x39')]));_0x55f864['attributes']=_0x55f864[_0x29e9('0x37')][_0x29e9('0x3a')]?_0x55f864[_0x29e9('0x37')]:_0x1a5371[_0x29e9('0x34')];_0x55f864[_0x29e9('0x5b')]=qs[_0x29e9('0x3b')](_0xaaadf9[_0x29e9('0x36')][_0x29e9('0x3b')]);_0x55f864[_0x29e9('0x3c')]=qs['filters'](_[_0x29e9('0x3e')](_0xaaadf9['query'],_0x1a5371[_0x29e9('0x3d')]));if(_0xaaadf9['query'][_0x29e9('0x57')]){_0x55f864['where']=_[_0x29e9('0x3f')](_0x55f864[_0x29e9('0x3c')],{'$or':_[_0x29e9('0x40')](_0x55f864[_0x29e9('0x37')],function(_0x49f7ba){var _0x1e4d8d={};_0x1e4d8d[_0x49f7ba]={'$like':'%'+_0xaaadf9[_0x29e9('0x36')][_0x29e9('0x57')]+'%'};return _0x1e4d8d;})});}_0x55f864=_[_0x29e9('0x3f')]({},_0x55f864,_0xaaadf9[_0x29e9('0x43')]);return _0x4f3a48[_0x29e9('0x5a')](_0x55f864);}})[_0x29e9('0x2b')](function(_0x4d3374){if(_0x4d3374){_0x3be3b9=_0x4d3374[_0x29e9('0x3a')];if(!_0xaaadf9[_0x29e9('0x36')][_0x29e9('0x58')](_0x29e9('0x59'))){_0x55f864[_0x29e9('0x1f')]=qs[_0x29e9('0x1f')](_0xaaadf9[_0x29e9('0x36')][_0x29e9('0x1f')]);_0x55f864[_0x29e9('0x1e')]=qs['offset'](_0xaaadf9[_0x29e9('0x36')][_0x29e9('0x1e')]);}return _0x4f3a48['getAnyConditions'](_0x55f864);}})['then'](function(_0x3f58e0){if(_0x3f58e0){return _0x3f58e0?{'count':_0x3be3b9,'rows':_0x3f58e0}:null;}})[_0x29e9('0x2b')](respondWithResult(_0x166baf,null))[_0x29e9('0x50')](handleError(_0x166baf,null));};exports[_0x29e9('0x5c')]=function(_0x41bad1,_0x4a98e7,_0x4de805){if(_0x41bad1[_0x29e9('0x4c')]['id']){delete _0x41bad1['body']['id'];}return db[_0x29e9('0x44')][_0x29e9('0x4a')]({'where':{'id':_0x41bad1[_0x29e9('0x49')]['id']}})[_0x29e9('0x2b')](handleEntityNotFound(_0x4a98e7,null))[_0x29e9('0x2b')](function(_0x520759){if(_0x520759){_0x41bad1[_0x29e9('0x4c')]['TriggerId']=_0x520759['id'];return db[_0x29e9('0x5d')]['create'](_0x41bad1[_0x29e9('0x4c')]);}})[_0x29e9('0x2b')](respondWithResult(_0x4a98e7,null))['catch'](handleError(_0x4a98e7,null));};exports[_0x29e9('0x5e')]=function(_0x59260b,_0x851bd,_0x3a8330){var _0x9da297={};var _0x41af1a={};var _0x38ba7f;var _0x214157;return db[_0x29e9('0x44')]['findOne']({'where':{'id':_0x59260b[_0x29e9('0x49')]['id']}})[_0x29e9('0x2b')](handleEntityNotFound(_0x851bd,null))['then'](function(_0x3ca8ef){if(_0x3ca8ef){_0x38ba7f=_0x3ca8ef;_0x41af1a[_0x29e9('0x34')]=_[_0x29e9('0x35')](db[_0x29e9('0x5d')]['rawAttributes']);_0x41af1a[_0x29e9('0x36')]=_[_0x29e9('0x35')](_0x59260b['query']);_0x41af1a[_0x29e9('0x3d')]=_[_0x29e9('0x38')](_0x41af1a[_0x29e9('0x34')],_0x41af1a[_0x29e9('0x36')]);_0x9da297['attributes']=_[_0x29e9('0x38')](_0x41af1a[_0x29e9('0x34')],qs[_0x29e9('0x39')](_0x59260b[_0x29e9('0x36')][_0x29e9('0x39')]));_0x9da297[_0x29e9('0x37')]=_0x9da297[_0x29e9('0x37')]['length']?_0x9da297['attributes']:_0x41af1a['model'];_0x9da297['order']=qs[_0x29e9('0x3b')](_0x59260b['query'][_0x29e9('0x3b')]);_0x9da297[_0x29e9('0x3c')]=qs[_0x29e9('0x3d')](_[_0x29e9('0x3e')](_0x59260b[_0x29e9('0x36')],_0x41af1a['filters']));if(_0x59260b['query'][_0x29e9('0x57')]){_0x9da297['where']=_[_0x29e9('0x3f')](_0x9da297[_0x29e9('0x3c')],{'$or':_[_0x29e9('0x40')](_0x9da297[_0x29e9('0x37')],function(_0x39243f){var _0x35d742={};_0x35d742[_0x39243f]={'$like':'%'+_0x59260b[_0x29e9('0x36')][_0x29e9('0x57')]+'%'};return _0x35d742;})});}_0x9da297=_[_0x29e9('0x3f')]({},_0x9da297,_0x59260b[_0x29e9('0x43')]);return _0x38ba7f[_0x29e9('0x5e')](_0x9da297);}})['then'](function(_0x192f27){if(_0x192f27){_0x214157=_0x192f27[_0x29e9('0x3a')];if(!_0x59260b[_0x29e9('0x36')]['hasOwnProperty'](_0x29e9('0x59'))){_0x9da297[_0x29e9('0x1f')]=qs[_0x29e9('0x1f')](_0x59260b[_0x29e9('0x36')][_0x29e9('0x1f')]);_0x9da297[_0x29e9('0x1e')]=qs[_0x29e9('0x1e')](_0x59260b[_0x29e9('0x36')]['offset']);}return _0x38ba7f[_0x29e9('0x5e')](_0x9da297);}})[_0x29e9('0x2b')](function(_0x481976){if(_0x481976){return _0x481976?{'count':_0x214157,'rows':_0x481976}:null;}})[_0x29e9('0x2b')](respondWithResult(_0x851bd,null))[_0x29e9('0x50')](handleError(_0x851bd,null));};
\ No newline at end of file
index 564354a..4414df5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab86=['util','../../config/logger','bluebird','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x59a895,_0x195c3d){var _0x2de8f9=function(_0x2a4084){while(--_0x2a4084){_0x59a895['push'](_0x59a895['shift']());}};_0x2de8f9(++_0x195c3d);}(_0xab86,0x13e));var _0x6ab8=function(_0x423ccb,_0x210002){_0x423ccb=_0x423ccb-0x0;var _0xafea3f=_0xab86[_0x423ccb];return _0xafea3f;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb26e=['moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x217bfc,_0x3361f1){var _0x5f4a09=function(_0x28d6e9){while(--_0x28d6e9){_0x217bfc['push'](_0x217bfc['shift']());}};_0x5f4a09(++_0x3361f1);}(_0xb26e,0x11d));var _0xeb26=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xb26e[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0xeb26('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeb26('0x1'));var BPromise=require(_0xeb26('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb26('0x3'));var rimraf=require(_0xeb26('0x4'));var config=require(_0xeb26('0x5'));var attributes=require(_0xeb26('0x6'));module[_0xeb26('0x7')]=function(_0x17f489,_0x2351f9){return _0x17f489[_0xeb26('0x8')](_0xeb26('0x9'),attributes,{'tableName':_0xeb26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 818e192..b063a51 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa46b=['map','then','debug','ShowTrigger','Trigger','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','options','raw','where','attributes','limit','include','model'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa46b,0xb5));var _0xba46=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa46b[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xba46('0x0'));var util=require(_0xba46('0x1'));var moment=require('moment');var BPromise=require(_0xba46('0x2'));var rs=require(_0xba46('0x3'));var fs=require('fs');var Redis=require(_0xba46('0x4'));var db=require(_0xba46('0x5'))['db'];var utils=require(_0xba46('0x6'));var logger=require(_0xba46('0x7'))(_0xba46('0x8'));var config=require(_0xba46('0x9'));var jayson=require(_0xba46('0xa'));var client=jayson[_0xba46('0xb')][_0xba46('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f8143,_0x5c9e47,_0x5963cc){return new BPromise(function(_0x194358,_0x3542f6){return client['request'](_0x2f8143,_0x5963cc)['then'](function(_0x1fc9fa){logger[_0xba46('0xd')](_0xba46('0xe'),_0x5c9e47,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x5c9e47,_0xba46('0xf'),JSON[_0xba46('0x10')](_0x1fc9fa));if(_0x1fc9fa[_0xba46('0x11')]){if(_0x1fc9fa['error']['code']===0x1f4){logger[_0xba46('0x11')](_0xba46('0xe'),_0x5c9e47,_0x1fc9fa[_0xba46('0x11')]['message']);return _0x3542f6(_0x1fc9fa[_0xba46('0x11')][_0xba46('0x12')]);}logger[_0xba46('0x11')](_0xba46('0xe'),_0x5c9e47,_0x1fc9fa[_0xba46('0x11')]['message']);return _0x194358(_0x1fc9fa[_0xba46('0x11')][_0xba46('0x12')]);}else{logger[_0xba46('0xd')](_0xba46('0xe'),_0x5c9e47,_0xba46('0xf'));_0x194358(_0x1fc9fa[_0xba46('0x13')]['message']);}})[_0xba46('0x14')](function(_0x6ef060){logger[_0xba46('0x11')](_0xba46('0xe'),_0x5c9e47,_0x6ef060);_0x3542f6(_0x6ef060);});});}exports[_0xba46('0x15')]=function(_0x5bdae8){var _0x5447d0=this;return new Promise(function(_0x2c4927,_0x12aed3){return db['Trigger']['findAll']({'raw':_0x5bdae8[_0xba46('0x16')]?_0x5bdae8[_0xba46('0x16')][_0xba46('0x17')]===undefined?!![]:![]:!![],'where':_0x5bdae8[_0xba46('0x16')]?_0x5bdae8[_0xba46('0x16')][_0xba46('0x18')]||null:null,'attributes':_0x5bdae8[_0xba46('0x16')]?_0x5bdae8['options'][_0xba46('0x19')]||null:null,'limit':_0x5bdae8[_0xba46('0x16')]?_0x5bdae8[_0xba46('0x16')][_0xba46('0x1a')]||null:null,'include':_0x5bdae8[_0xba46('0x16')]?_0x5bdae8[_0xba46('0x16')][_0xba46('0x1b')]?_['map'](_0x5bdae8[_0xba46('0x16')][_0xba46('0x1b')],function(_0x33101c){return{'model':db[_0x33101c[_0xba46('0x1c')]],'as':_0x33101c['as'],'attributes':_0x33101c[_0xba46('0x19')],'include':_0x33101c[_0xba46('0x1b')]?_[_0xba46('0x1d')](_0x33101c[_0xba46('0x1b')],function(_0xb23854){return{'model':db[_0xb23854['model']],'as':_0xb23854['as'],'attributes':_0xb23854[_0xba46('0x19')],'include':_0xb23854[_0xba46('0x1b')]?_[_0xba46('0x1d')](_0xb23854[_0xba46('0x1b')],function(_0x2a6e3c){return{'model':db[_0x2a6e3c['model']],'as':_0x2a6e3c['as'],'attributes':_0x2a6e3c[_0xba46('0x19')]};}):[]};}):[]};}):[]:[]})[_0xba46('0x1e')](function(_0x47c2bf){logger[_0xba46('0xd')](_0xba46('0x15'),_0x5bdae8);logger[_0xba46('0x1f')](_0xba46('0x15'),_0x5bdae8,JSON['stringify'](_0x47c2bf));_0x2c4927(_0x47c2bf);})[_0xba46('0x14')](function(_0x2af8a2){logger[_0xba46('0x11')]('GetTrigger',_0x2af8a2[_0xba46('0x12')],_0x5bdae8);_0x12aed3(_0x5447d0[_0xba46('0x11')](0x1f4,_0x2af8a2[_0xba46('0x12')]));});});};exports[_0xba46('0x20')]=function(_0x362ded){var _0x5d0223=this;return new Promise(function(_0x3df25e,_0x1621d1){return db[_0xba46('0x21')][_0xba46('0x22')]({'raw':_0x362ded[_0xba46('0x16')]?_0x362ded['options'][_0xba46('0x17')]===undefined?!![]:![]:!![],'where':_0x362ded[_0xba46('0x16')]?_0x362ded[_0xba46('0x16')]['where']||null:null,'attributes':_0x362ded['options']?_0x362ded[_0xba46('0x16')][_0xba46('0x19')]||null:null,'include':_0x362ded[_0xba46('0x16')]?_0x362ded['options'][_0xba46('0x1b')]?_[_0xba46('0x1d')](_0x362ded[_0xba46('0x16')][_0xba46('0x1b')],function(_0x15936a){return{'model':db[_0x15936a['model']],'as':_0x15936a['as'],'attributes':_0x15936a[_0xba46('0x19')],'include':_0x15936a[_0xba46('0x1b')]?_[_0xba46('0x1d')](_0x15936a[_0xba46('0x1b')],function(_0x4f49df){return{'model':db[_0x4f49df[_0xba46('0x1c')]],'as':_0x4f49df['as'],'attributes':_0x4f49df['attributes'],'include':_0x4f49df[_0xba46('0x1b')]?_[_0xba46('0x1d')](_0x4f49df[_0xba46('0x1b')],function(_0x8f314a){return{'model':db[_0x8f314a[_0xba46('0x1c')]],'as':_0x8f314a['as'],'attributes':_0x8f314a[_0xba46('0x19')]};}):[]};}):[]};}):[]:[]})[_0xba46('0x1e')](function(_0x3295da){logger[_0xba46('0xd')](_0xba46('0x20'),_0x362ded);logger[_0xba46('0x1f')]('ShowTrigger',_0x362ded,JSON[_0xba46('0x10')](_0x3295da));_0x3df25e(_0x3295da);})['catch'](function(_0x5d9126){logger[_0xba46('0x11')](_0xba46('0x20'),_0x5d9126[_0xba46('0x12')],_0x362ded);_0x1621d1(_0x5d0223[_0xba46('0x11')](0x1f4,_0x5d9126[_0xba46('0x12')]));});});};
\ No newline at end of file
+var _0x217a=['model','attributes','include','catch','ShowTrigger','find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','where','map'];(function(_0x3fb520,_0x9d07d5){var _0x42d9f7=function(_0x3faf8f){while(--_0x3faf8f){_0x3fb520['push'](_0x3fb520['shift']());}};_0x42d9f7(++_0x9d07d5);}(_0x217a,0x15d));var _0xa217=function(_0x5adf06,_0x559e16){_0x5adf06=_0x5adf06-0x0;var _0x45f6f7=_0x217a[_0x5adf06];return _0x45f6f7;};'use strict';var _=require('lodash');var util=require(_0xa217('0x0'));var moment=require(_0xa217('0x1'));var BPromise=require(_0xa217('0x2'));var rs=require(_0xa217('0x3'));var fs=require('fs');var Redis=require(_0xa217('0x4'));var db=require(_0xa217('0x5'))['db'];var utils=require(_0xa217('0x6'));var logger=require(_0xa217('0x7'))(_0xa217('0x8'));var config=require(_0xa217('0x9'));var jayson=require(_0xa217('0xa'));var client=jayson[_0xa217('0xb')][_0xa217('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53ffd7,_0x32b40b,_0x3b2516){return new BPromise(function(_0x1d9ea4,_0x4a5eeb){return client[_0xa217('0xd')](_0x53ffd7,_0x3b2516)[_0xa217('0xe')](function(_0xdb1370){logger[_0xa217('0xf')]('Trigger,\x20%s,\x20%s',_0x32b40b,'request\x20sent');logger['debug'](_0xa217('0x10'),_0x32b40b,_0xa217('0x11'),JSON[_0xa217('0x12')](_0xdb1370));if(_0xdb1370[_0xa217('0x13')]){if(_0xdb1370[_0xa217('0x13')][_0xa217('0x14')]===0x1f4){logger[_0xa217('0x13')](_0xa217('0x15'),_0x32b40b,_0xdb1370[_0xa217('0x13')][_0xa217('0x16')]);return _0x4a5eeb(_0xdb1370['error'][_0xa217('0x16')]);}logger[_0xa217('0x13')](_0xa217('0x15'),_0x32b40b,_0xdb1370[_0xa217('0x13')][_0xa217('0x16')]);return _0x1d9ea4(_0xdb1370[_0xa217('0x13')][_0xa217('0x16')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x32b40b,_0xa217('0x11'));_0x1d9ea4(_0xdb1370[_0xa217('0x17')][_0xa217('0x16')]);}})['catch'](function(_0x28760e){logger[_0xa217('0x13')](_0xa217('0x15'),_0x32b40b,_0x28760e);_0x4a5eeb(_0x28760e);});});}exports[_0xa217('0x18')]=function(_0x19888e){var _0x303744=this;return new Promise(function(_0x2dcd3e,_0x2e414f){return db[_0xa217('0x19')][_0xa217('0x1a')]({'raw':_0x19888e[_0xa217('0x1b')]?_0x19888e[_0xa217('0x1b')][_0xa217('0x1c')]===undefined?!![]:![]:!![],'where':_0x19888e[_0xa217('0x1b')]?_0x19888e[_0xa217('0x1b')][_0xa217('0x1d')]||null:null,'attributes':_0x19888e['options']?_0x19888e[_0xa217('0x1b')]['attributes']||null:null,'limit':_0x19888e[_0xa217('0x1b')]?_0x19888e[_0xa217('0x1b')]['limit']||null:null,'include':_0x19888e[_0xa217('0x1b')]?_0x19888e[_0xa217('0x1b')]['include']?_[_0xa217('0x1e')](_0x19888e[_0xa217('0x1b')]['include'],function(_0x38b246){return{'model':db[_0x38b246[_0xa217('0x1f')]],'as':_0x38b246['as'],'attributes':_0x38b246[_0xa217('0x20')],'include':_0x38b246[_0xa217('0x21')]?_['map'](_0x38b246['include'],function(_0x46c7ba){return{'model':db[_0x46c7ba['model']],'as':_0x46c7ba['as'],'attributes':_0x46c7ba[_0xa217('0x20')],'include':_0x46c7ba[_0xa217('0x21')]?_[_0xa217('0x1e')](_0x46c7ba[_0xa217('0x21')],function(_0x31e8e7){return{'model':db[_0x31e8e7['model']],'as':_0x31e8e7['as'],'attributes':_0x31e8e7[_0xa217('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa217('0xe')](function(_0xd8bb3c){logger[_0xa217('0xf')](_0xa217('0x18'),_0x19888e);logger['debug'](_0xa217('0x18'),_0x19888e,JSON[_0xa217('0x12')](_0xd8bb3c));_0x2dcd3e(_0xd8bb3c);})[_0xa217('0x22')](function(_0x47a76b){logger[_0xa217('0x13')](_0xa217('0x18'),_0x47a76b[_0xa217('0x16')],_0x19888e);_0x2e414f(_0x303744['error'](0x1f4,_0x47a76b[_0xa217('0x16')]));});});};exports[_0xa217('0x23')]=function(_0xbf53df){var _0xd6fb0f=this;return new Promise(function(_0x972898,_0x1652de){return db[_0xa217('0x19')][_0xa217('0x24')]({'raw':_0xbf53df[_0xa217('0x1b')]?_0xbf53df[_0xa217('0x1b')][_0xa217('0x1c')]===undefined?!![]:![]:!![],'where':_0xbf53df['options']?_0xbf53df[_0xa217('0x1b')][_0xa217('0x1d')]||null:null,'attributes':_0xbf53df[_0xa217('0x1b')]?_0xbf53df[_0xa217('0x1b')][_0xa217('0x20')]||null:null,'include':_0xbf53df[_0xa217('0x1b')]?_0xbf53df['options'][_0xa217('0x21')]?_[_0xa217('0x1e')](_0xbf53df[_0xa217('0x1b')][_0xa217('0x21')],function(_0x4ea594){return{'model':db[_0x4ea594[_0xa217('0x1f')]],'as':_0x4ea594['as'],'attributes':_0x4ea594[_0xa217('0x20')],'include':_0x4ea594[_0xa217('0x21')]?_[_0xa217('0x1e')](_0x4ea594['include'],function(_0x5ebe22){return{'model':db[_0x5ebe22[_0xa217('0x1f')]],'as':_0x5ebe22['as'],'attributes':_0x5ebe22['attributes'],'include':_0x5ebe22['include']?_[_0xa217('0x1e')](_0x5ebe22[_0xa217('0x21')],function(_0x392b59){return{'model':db[_0x392b59[_0xa217('0x1f')]],'as':_0x392b59['as'],'attributes':_0x392b59['attributes']};}):[]};}):[]};}):[]:[]})[_0xa217('0xe')](function(_0x58505c){logger['info'](_0xa217('0x23'),_0xbf53df);logger[_0xa217('0x25')](_0xa217('0x23'),_0xbf53df,JSON[_0xa217('0x12')](_0x58505c));_0x972898(_0x58505c);})[_0xa217('0x22')](function(_0xab4977){logger[_0xa217('0x13')](_0xa217('0x23'),_0xab4977[_0xa217('0x16')],_0xbf53df);_0x1652de(_0xd6fb0f['error'](0x1f4,_0xab4977[_0xa217('0x16')]));});});};
\ No newline at end of file
index e1ca094..f7b2166 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdded=['index','get','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated'];(function(_0x494110,_0x544437){var _0x220669=function(_0x4ac3aa){while(--_0x4ac3aa){_0x494110['push'](_0x494110['shift']());}};_0x220669(++_0x544437);}(_0xdded,0x115));var _0xddde=function(_0x3fe6ce,_0x4e364e){_0x3fe6ce=_0x3fe6ce-0x0;var _0xc81b00=_0xdded[_0x3fe6ce];return _0xc81b00;};'use strict';var multer=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var path=require(_0xddde('0x2'));var timeout=require(_0xddde('0x3'));var express=require('express');var router=express[_0xddde('0x4')]();var fs_extra=require(_0xddde('0x5'));var auth=require(_0xddde('0x6'));var interaction=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));var controller=require(_0xddde('0x9'));router['get']('/',auth[_0xddde('0xa')](),controller[_0xddde('0xb')]);router[_0xddde('0xc')](_0xddde('0xd'),auth[_0xddde('0xa')](),controller[_0xddde('0xe')]);router[_0xddde('0xf')](_0xddde('0x10'),auth[_0xddde('0xa')](),controller[_0xddde('0x11')]);router['post']('/',auth[_0xddde('0xa')](),controller[_0xddde('0x12')]);router[_0xddde('0x13')](_0xddde('0xd'),auth[_0xddde('0xa')](),controller[_0xddde('0x14')]);router[_0xddde('0x15')]('/:id',auth[_0xddde('0xa')](),controller[_0xddde('0x16')]);module[_0xddde('0x17')]=router;
\ No newline at end of file
+var _0x18fa=['create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone'];(function(_0x2932df,_0x26b713){var _0x2faf60=function(_0x2c3b68){while(--_0x2c3b68){_0x2932df['push'](_0x2932df['shift']());}};_0x2faf60(++_0x26b713);}(_0x18fa,0xc1));var _0xa18f=function(_0x4d4baa,_0x515e4d){_0x4d4baa=_0x4d4baa-0x0;var _0x5ccf09=_0x18fa[_0x4d4baa];return _0x5ccf09;};'use strict';var multer=require(_0xa18f('0x0'));var util=require(_0xa18f('0x1'));var path=require(_0xa18f('0x2'));var timeout=require(_0xa18f('0x3'));var express=require('express');var router=express[_0xa18f('0x4')]();var fs_extra=require(_0xa18f('0x5'));var auth=require(_0xa18f('0x6'));var interaction=require(_0xa18f('0x7'));var config=require(_0xa18f('0x8'));var controller=require(_0xa18f('0x9'));router[_0xa18f('0xa')]('/',auth[_0xa18f('0xb')](),controller['index']);router[_0xa18f('0xa')](_0xa18f('0xc'),auth[_0xa18f('0xb')](),controller[_0xa18f('0xd')]);router[_0xa18f('0xe')](_0xa18f('0xf'),auth['isAuthenticated'](),controller[_0xa18f('0x10')]);router[_0xa18f('0xe')]('/',auth['isAuthenticated'](),controller[_0xa18f('0x11')]);router[_0xa18f('0x12')](_0xa18f('0xc'),auth[_0xa18f('0xb')](),controller[_0xa18f('0x13')]);router[_0xa18f('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 1baf802..5a624bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6165=['getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','nonat','outgoing','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join'];(function(_0x3cc29f,_0x353898){var _0x5609de=function(_0x1cb9ae){while(--_0x1cb9ae){_0x3cc29f['push'](_0x3cc29f['shift']());}};_0x5609de(++_0x353898);}(_0x6165,0x178));var _0x5616=function(_0x31be43,_0x563806){_0x31be43=_0x31be43-0x0;var _0x17d934=_0x6165[_0x31be43];return _0x17d934;};'use strict';var Sequelize=require(_0x5616('0x0'));module[_0x5616('0x1')]={'name':{'type':Sequelize[_0x5616('0x2')],'allowNull':![],'unique':_0x5616('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x5'),_0x5616('0x6'),_0x5616('0x7')),'allowNull':![],'defaultValue':_0x5616('0x5')},'context':{'type':Sequelize[_0x5616('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x5616('0x8'),'ALLOWED',_0x5616('0x9'),_0x5616('0xa'),_0x5616('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x5616('0x2')]},'permit':{'type':Sequelize[_0x5616('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5616('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x5616('0x2')],'defaultValue':_0x5616('0xc'),'set':function(_0x7d74d4){this[_0x5616('0xd')](_0x5616('0xe'),_0x7d74d4?_0x7d74d4[_0x5616('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x5616('0xe'))?this[_0x5616('0x10')](_0x5616('0xe'))[_0x5616('0x11')](','):null;},'comment':_0x5616('0x12')},'dtmfmode':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x13'),_0x5616('0x14'),'shortinfo','inband','auto'),'defaultValue':_0x5616('0x13')},'directmedia':{'type':Sequelize[_0x5616('0x4')]('yes','no',_0x5616('0x15'),'update',_0x5616('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5616('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5616('0x2')]},'directmediadeny':{'type':Sequelize[_0x5616('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x50510b){this[_0x5616('0xd')]('nat',_0x50510b?_0x50510b[_0x5616('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x5616('0x17'))?this[_0x5616('0x10')](_0x5616('0x17'))[_0x5616('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5616('0x2')]},'namedcallgroup':{'type':Sequelize[_0x5616('0x2')]},'pickupgroup':{'type':Sequelize[_0x5616('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5616('0x2')]},'language':{'type':Sequelize[_0x5616('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5616('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5616('0x2')],'defaultValue':_0x5616('0x18')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4914b7){this['setDataValue'](_0x5616('0x19'),_0x4914b7?_0x4914b7[_0x5616('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x5616('0x19'))?this[_0x5616('0x10')]('allow')[_0x5616('0x11')](';'):null;},'comment':_0x5616('0x1a')},'autoframing':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'insecure':{'type':Sequelize[_0x5616('0x2')],'defaultValue':_0x5616('0x1c'),'set':function(_0x25dcd8){this[_0x5616('0xd')](_0x5616('0x1d'),_0x25dcd8?_0x25dcd8[_0x5616('0xf')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x5616('0x11')](','):null;},'comment':_0x5616('0x1e')},'trustrpid':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no',_0x5616('0x1f'))},'promiscredir':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x5616('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x5616('0x20')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x5616('0x21')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x5616('0x4')]('yes','no'),'defaultValue':_0x5616('0x1b')},'busylevel':{'type':Sequelize[_0x5616('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x5616('0x2')]},'videosupport':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5616('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5616('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x22'),_0x5616('0x23'),_0x5616('0x24'))},'session_expires':{'type':Sequelize[_0x5616('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x5616('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x25'),_0x5616('0x26')),'defaultValue':_0x5616('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x5616('0x2')]},'regexten':{'type':Sequelize[_0x5616('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x5616('0x2')]},'port':{'type':Sequelize[_0x5616('0x20')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x5616('0x1b'),'no'),'defaultValue':_0x5616('0x1b')},'keepalive':{'type':Sequelize[_0x5616('0x20')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x5616('0x2')]},'rtptimeout':{'type':Sequelize[_0x5616('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5616('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5616('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no',_0x5616('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5616('0x2')]},'callbackextension':{'type':Sequelize[_0x5616('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x5616('0x20')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x5616('0x2')]},'contactdeny':{'type':Sequelize[_0x5616('0x2')]},'contactacl':{'type':Sequelize[_0x5616('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x5616('0x2')]},'maxforwards':{'type':Sequelize[_0x5616('0x20')](0xb)},'encryption':{'type':Sequelize[_0x5616('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x5616('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x5616('0x1b'),'no',_0x5616('0x28'),_0x5616('0x29'))},'dtlsrekey':{'type':Sequelize[_0x5616('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5616('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x5616('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x5616('0x2')]},'dtlscapath':{'type':Sequelize[_0x5616('0x2')]},'dtlssetup':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x2a'),_0x5616('0x2b'),_0x5616('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5616('0x2')]},'usereqphone':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5616('0x2')]},'recordofffeature':{'type':Sequelize[_0x5616('0x2')]},'call_limit':{'type':Sequelize[_0x5616('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x5616('0x4')](_0x5616('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x5616('0x2')]},'mohinterpret':{'type':Sequelize[_0x5616('0x2')]},'mohsuggest':{'type':Sequelize[_0x5616('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5616('0x2')]},'host':{'type':Sequelize[_0x5616('0x2')],'defaultValue':_0x5616('0x2d')},'canreinvite':{'type':Sequelize[_0x5616('0x4')]('yes','no','nonat',_0x5616('0x2e'),_0x5616('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5616('0x2')]},'otherFields':{'type':Sequelize[_0x5616('0x2')]},'active':{'type':Sequelize[_0x5616('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}};
\ No newline at end of file
+var _0xf44a=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','update','outgoing','yes','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure'];(function(_0x41c661,_0x37ae24){var _0xad7228=function(_0x2e3800){while(--_0x2e3800){_0x41c661['push'](_0x41c661['shift']());}};_0xad7228(++_0x37ae24);}(_0xf44a,0x7e));var _0xaf44=function(_0x91fe43,_0x1b51e4){_0x91fe43=_0x91fe43-0x0;var _0x5d3b51=_0xf44a[_0x91fe43];return _0x5d3b51;};'use strict';var Sequelize=require(_0xaf44('0x0'));module[_0xaf44('0x1')]={'name':{'type':Sequelize[_0xaf44('0x2')],'allowNull':![],'unique':_0xaf44('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaf44('0x4')]('friend',_0xaf44('0x5'),_0xaf44('0x6')),'allowNull':![],'defaultValue':_0xaf44('0x7')},'context':{'type':Sequelize[_0xaf44('0x2')],'allowNull':![],'defaultValue':_0xaf44('0x8')},'callingpres':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x9'),_0xaf44('0xa'),_0xaf44('0xb'),_0xaf44('0xc'),_0xaf44('0xd'),_0xaf44('0xe'),_0xaf44('0xf'),_0xaf44('0x10'))},'deny':{'type':Sequelize[_0xaf44('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xaf44('0x2')]},'transport':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':'udp','set':function(_0x317bcf){this[_0xaf44('0x11')](_0xaf44('0x12'),_0x317bcf?_0x317bcf['join'](','):null);},'get':function(){return this[_0xaf44('0x13')]('transport')?this[_0xaf44('0x13')]('transport')[_0xaf44('0x14')](','):null;},'comment':_0xaf44('0x15')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info',_0xaf44('0x16'),_0xaf44('0x17'),_0xaf44('0x18')),'defaultValue':_0xaf44('0x19')},'directmedia':{'type':Sequelize[_0xaf44('0x4')]('yes','no','nonat',_0xaf44('0x1a'),_0xaf44('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaf44('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x3a0568){this['setDataValue']('nat',_0x3a0568?_0x3a0568[_0xaf44('0x1d')](','):null);},'get':function(){return this[_0xaf44('0x13')](_0xaf44('0x1e'))?this[_0xaf44('0x13')](_0xaf44('0x1e'))[_0xaf44('0x14')](','):null;},'comment':_0xaf44('0x1f')},'callgroup':{'type':Sequelize[_0xaf44('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xaf44('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xaf44('0x2')],'allowNull':![],'defaultValue':_0xaf44('0x20'),'set':function(_0xf74604){this[_0xaf44('0x11')](_0xaf44('0x21'),_0xf74604?_0xf74604[_0xaf44('0x1d')](';'):_0xaf44('0x20'));},'get':function(){return this['getDataValue'](_0xaf44('0x21'))?this[_0xaf44('0x13')]('allow')['split'](';'):null;},'comment':_0xaf44('0x22')},'autoframing':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'insecure':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':'port,invite','set':function(_0x5d5783){this[_0xaf44('0x11')](_0xaf44('0x23'),_0x5d5783?_0x5d5783[_0xaf44('0x1d')](','):null);},'get':function(){return this[_0xaf44('0x13')]('insecure')?this[_0xaf44('0x13')]('insecure')[_0xaf44('0x14')](','):null;},'comment':_0xaf44('0x24')},'trustrpid':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xaf44('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xaf44('0x25'))},'promiscredir':{'type':Sequelize[_0xaf44('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'accountcode':{'type':Sequelize[_0xaf44('0x26')](0xb)},'setvar':{'type':Sequelize[_0xaf44('0x2')]},'callerid':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':_0xaf44('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaf44('0x1c')},'busylevel':{'type':Sequelize[_0xaf44('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'allowtransfer':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0xaf44('0x2')]},'template':{'type':Sequelize[_0xaf44('0x2')]},'videosupport':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xaf44('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'mailbox':{'type':Sequelize[_0xaf44('0x2')]},'session_timers':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x28'),_0xaf44('0x29'),_0xaf44('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x2b'),_0xaf44('0x2c')),'defaultValue':_0xaf44('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xaf44('0x2')]},'regexten':{'type':Sequelize[_0xaf44('0x2')]},'fromdomain':{'type':Sequelize[_0xaf44('0x2')]},'fromuser':{'type':Sequelize[_0xaf44('0x2')]},'port':{'type':Sequelize[_0xaf44('0x26')](0x5)},'qualify':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no'),'defaultValue':_0xaf44('0x1c')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xaf44('0x2')]},'defaultuser':{'type':Sequelize[_0xaf44('0x2')]},'rtptimeout':{'type':Sequelize[_0xaf44('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no',_0xaf44('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xaf44('0x2')]},'callbackextension':{'type':Sequelize[_0xaf44('0x2')]},'timert1':{'type':Sequelize[_0xaf44('0x26')](0xb)},'timerb':{'type':Sequelize[_0xaf44('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xaf44('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xaf44('0x2')]},'contactdeny':{'type':Sequelize[_0xaf44('0x2')]},'contactacl':{'type':Sequelize[_0xaf44('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xaf44('0x26')](0xb)},'encryption':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaf44('0x4')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xaf44('0x1c'),'no')},'icesupport':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0xaf44('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xaf44('0x2e'),_0xaf44('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xaf44('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xaf44('0x2')]},'dtlscipher':{'type':Sequelize[_0xaf44('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xaf44('0x2')]},'dtlssetup':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x30'),'passive',_0xaf44('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xaf44('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xaf44('0x2')]},'recordofffeature':{'type':Sequelize[_0xaf44('0x2')]},'call_limit':{'type':Sequelize[_0xaf44('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xaf44('0x4')](_0xaf44('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0xaf44('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xaf44('0x2')]},'mohinterpret':{'type':Sequelize[_0xaf44('0x2')]},'mohsuggest':{'type':Sequelize[_0xaf44('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf44('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xaf44('0x32')},'canreinvite':{'type':Sequelize[_0xaf44('0x4')]('yes','no',_0xaf44('0x33'),'update',_0xaf44('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xaf44('0x2')]},'otherFields':{'type':Sequelize[_0xaf44('0x2')]},'active':{'type':Sequelize[_0xaf44('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xaf44('0x2')],'defaultValue':'no'}};
\ No newline at end of file
index cff24e4..a53740d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x136bc0,_0x56e162){var _0x513218=function(_0x5b1417){while(--_0x5b1417){_0x136bc0['push'](_0x136bc0['shift']());}};_0x513218(++_0x56e162);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x44d0e7,_0x2df9fd){_0x44d0e7=_0x44d0e7-0x0;var _0x2c8e97=_0xd6d6[_0x44d0e7];return _0x2c8e97;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));};
\ No newline at end of file
+var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x5c1b90,_0x43e602){var _0x1f7ab6=function(_0x31c36e){while(--_0x31c36e){_0x5c1b90['push'](_0x5c1b90['shift']());}};_0x1f7ab6(++_0x43e602);}(_0xa41a,0x6b));var _0xaa41=function(_0x3d8896,_0x46934c){_0x3d8896=_0x3d8896-0x0;var _0x31431f=_0xa41a[_0x3d8896];return _0x31431f;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));};
\ No newline at end of file
index 444d5df..73194f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed96=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0xed96,0x90));var _0x6ed9=function(_0x3eb926,_0x27e966){_0x3eb926=_0x3eb926-0x0;var _0x29460d=_0xed96[_0x3eb926];return _0x29460d;};'use strict';var _=require(_0x6ed9('0x0'));var util=require(_0x6ed9('0x1'));var logger=require('../../config/logger')(_0x6ed9('0x2'));var moment=require(_0x6ed9('0x3'));var BPromise=require(_0x6ed9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ed9('0x5'));var rimraf=require(_0x6ed9('0x6'));var config=require(_0x6ed9('0x7'));var attributes=require(_0x6ed9('0x8'));module[_0x6ed9('0x9')]=function(_0x129e88,_0x441755){return _0x129e88['define'](_0x6ed9('0xa'),attributes,{'tableName':_0x6ed9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x218c=['../../config/logger','moment','bluebird','path','./trunk.attributes','define','Trunk','tools_trunks','lodash'];(function(_0x15408c,_0x2a2258){var _0x5a801d=function(_0x29a395){while(--_0x29a395){_0x15408c['push'](_0x15408c['shift']());}};_0x5a801d(++_0x2a2258);}(_0x218c,0x10d));var _0xc218=function(_0x291e0e,_0x792683){_0x291e0e=_0x291e0e-0x0;var _0x3f85f3=_0x218c[_0x291e0e];return _0x3f85f3;};'use strict';var _=require(_0xc218('0x0'));var util=require('util');var logger=require(_0xc218('0x1'))('api');var moment=require(_0xc218('0x2'));var BPromise=require(_0xc218('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc218('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc218('0x5'));module['exports']=function(_0x20aaf5,_0xcb5546){return _0x20aaf5[_0xc218('0x6')](_0xc218('0x7'),attributes,{'tableName':_0xc218('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 74dfc45..0e0d21a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde69=['jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','stringify','ShowTrunk','find','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0xde69,0x160));var _0x9de6=function(_0x5f0ecc,_0x36e3de){_0x5f0ecc=_0x5f0ecc-0x0;var _0x47b0ed=_0xde69[_0x5f0ecc];return _0x47b0ed;};'use strict';var _=require('lodash');var util=require(_0x9de6('0x0'));var moment=require('moment');var BPromise=require(_0x9de6('0x1'));var rs=require(_0x9de6('0x2'));var fs=require('fs');var Redis=require(_0x9de6('0x3'));var db=require(_0x9de6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9de6('0x5'))(_0x9de6('0x6'));var config=require(_0x9de6('0x7'));var jayson=require(_0x9de6('0x8'));var client=jayson[_0x9de6('0x9')][_0x9de6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad25d,_0x4f8d36,_0x16eb95){return new BPromise(function(_0x1f24bd,_0x1b7487){return client[_0x9de6('0xb')](_0x5ad25d,_0x16eb95)[_0x9de6('0xc')](function(_0x38ac30){logger[_0x9de6('0xd')](_0x9de6('0xe'),_0x4f8d36,_0x9de6('0xf'));logger[_0x9de6('0x10')](_0x9de6('0x11'),_0x4f8d36,_0x9de6('0xf'),JSON['stringify'](_0x38ac30));if(_0x38ac30[_0x9de6('0x12')]){if(_0x38ac30[_0x9de6('0x12')][_0x9de6('0x13')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x4f8d36,_0x38ac30[_0x9de6('0x12')][_0x9de6('0x14')]);return _0x1b7487(_0x38ac30[_0x9de6('0x12')][_0x9de6('0x14')]);}logger[_0x9de6('0x12')](_0x9de6('0xe'),_0x4f8d36,_0x38ac30['error'][_0x9de6('0x14')]);return _0x1f24bd(_0x38ac30['error']['message']);}else{logger[_0x9de6('0xd')](_0x9de6('0xe'),_0x4f8d36,_0x9de6('0xf'));_0x1f24bd(_0x38ac30[_0x9de6('0x15')][_0x9de6('0x14')]);}})[_0x9de6('0x16')](function(_0x1b51cb){logger[_0x9de6('0x12')](_0x9de6('0xe'),_0x4f8d36,_0x1b51cb);_0x1b7487(_0x1b51cb);});});}exports[_0x9de6('0x17')]=function(_0x4d0f20){var _0x5f366f=this;return new Promise(function(_0x1c59fe,_0x46ac6f){return db[_0x9de6('0x18')][_0x9de6('0x19')]({'raw':_0x4d0f20['options']?_0x4d0f20[_0x9de6('0x1a')][_0x9de6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d0f20[_0x9de6('0x1a')]?_0x4d0f20[_0x9de6('0x1a')][_0x9de6('0x1c')]||null:null,'attributes':_0x4d0f20['options']?_0x4d0f20[_0x9de6('0x1a')][_0x9de6('0x1d')]||null:null,'limit':_0x4d0f20['options']?_0x4d0f20[_0x9de6('0x1a')]['limit']||null:null,'include':_0x4d0f20[_0x9de6('0x1a')]?_0x4d0f20[_0x9de6('0x1a')][_0x9de6('0x1e')]?_[_0x9de6('0x1f')](_0x4d0f20['options'][_0x9de6('0x1e')],function(_0xbec19a){return{'model':db[_0xbec19a['model']],'as':_0xbec19a['as'],'attributes':_0xbec19a[_0x9de6('0x1d')],'include':_0xbec19a[_0x9de6('0x1e')]?_[_0x9de6('0x1f')](_0xbec19a['include'],function(_0x5d2b27){return{'model':db[_0x5d2b27['model']],'as':_0x5d2b27['as'],'attributes':_0x5d2b27[_0x9de6('0x1d')],'include':_0x5d2b27[_0x9de6('0x1e')]?_[_0x9de6('0x1f')](_0x5d2b27[_0x9de6('0x1e')],function(_0x64f1c2){return{'model':db[_0x64f1c2['model']],'as':_0x64f1c2['as'],'attributes':_0x64f1c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x9de6('0xc')](function(_0x4ebe09){logger[_0x9de6('0xd')](_0x9de6('0x17'),_0x4d0f20);logger[_0x9de6('0x10')](_0x9de6('0x17'),_0x4d0f20,JSON[_0x9de6('0x20')](_0x4ebe09));_0x1c59fe(_0x4ebe09);})[_0x9de6('0x16')](function(_0x6ad46f){logger[_0x9de6('0x12')](_0x9de6('0x17'),_0x6ad46f[_0x9de6('0x14')],_0x4d0f20);_0x46ac6f(_0x5f366f[_0x9de6('0x12')](0x1f4,_0x6ad46f[_0x9de6('0x14')]));});});};exports[_0x9de6('0x21')]=function(_0x27a92a){var _0xa2e2bc=this;return new Promise(function(_0x4c1caa,_0x4fc08a){return db[_0x9de6('0x18')][_0x9de6('0x22')]({'raw':_0x27a92a[_0x9de6('0x1a')]?_0x27a92a[_0x9de6('0x1a')][_0x9de6('0x1b')]===undefined?!![]:![]:!![],'where':_0x27a92a[_0x9de6('0x1a')]?_0x27a92a[_0x9de6('0x1a')][_0x9de6('0x1c')]||null:null,'attributes':_0x27a92a[_0x9de6('0x1a')]?_0x27a92a[_0x9de6('0x1a')]['attributes']||null:null,'include':_0x27a92a[_0x9de6('0x1a')]?_0x27a92a[_0x9de6('0x1a')][_0x9de6('0x1e')]?_[_0x9de6('0x1f')](_0x27a92a['options'][_0x9de6('0x1e')],function(_0x194475){return{'model':db[_0x194475[_0x9de6('0x23')]],'as':_0x194475['as'],'attributes':_0x194475['attributes'],'include':_0x194475[_0x9de6('0x1e')]?_[_0x9de6('0x1f')](_0x194475[_0x9de6('0x1e')],function(_0x703baf){return{'model':db[_0x703baf['model']],'as':_0x703baf['as'],'attributes':_0x703baf[_0x9de6('0x1d')],'include':_0x703baf['include']?_[_0x9de6('0x1f')](_0x703baf[_0x9de6('0x1e')],function(_0x51b33d){return{'model':db[_0x51b33d[_0x9de6('0x23')]],'as':_0x51b33d['as'],'attributes':_0x51b33d[_0x9de6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9de6('0xc')](function(_0x40cf07){logger[_0x9de6('0xd')]('ShowTrunk',_0x27a92a);logger[_0x9de6('0x10')]('ShowTrunk',_0x27a92a,JSON['stringify'](_0x40cf07));_0x4c1caa(_0x40cf07);})[_0x9de6('0x16')](function(_0x259216){logger[_0x9de6('0x12')](_0x9de6('0x21'),_0x259216['message'],_0x27a92a);_0x4fc08a(_0xa2e2bc[_0x9de6('0x12')](0x1f4,_0x259216[_0x9de6('0x14')]));});});};
\ No newline at end of file
+var _0xd656=['Trunk','find','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','options','raw','where','attributes','limit','include','map','model','ShowTrunk'];(function(_0x10e621,_0x5c1ac3){var _0x224ef8=function(_0x39da41){while(--_0x39da41){_0x10e621['push'](_0x10e621['shift']());}};_0x224ef8(++_0x5c1ac3);}(_0xd656,0xdb));var _0x6d65=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd656[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x6d65('0x0'));var util=require(_0x6d65('0x1'));var moment=require(_0x6d65('0x2'));var BPromise=require(_0x6d65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d65('0x4'));var db=require(_0x6d65('0x5'))['db'];var utils=require(_0x6d65('0x6'));var logger=require(_0x6d65('0x7'))(_0x6d65('0x8'));var config=require('../../config/environment');var jayson=require(_0x6d65('0x9'));var client=jayson[_0x6d65('0xa')][_0x6d65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32c98e,_0x8e3136,_0x40abab){return new BPromise(function(_0x16a7b7,_0x31dce0){return client['request'](_0x32c98e,_0x40abab)[_0x6d65('0xc')](function(_0x246cd3){logger[_0x6d65('0xd')](_0x6d65('0xe'),_0x8e3136,_0x6d65('0xf'));logger['debug'](_0x6d65('0x10'),_0x8e3136,_0x6d65('0xf'),JSON[_0x6d65('0x11')](_0x246cd3));if(_0x246cd3[_0x6d65('0x12')]){if(_0x246cd3[_0x6d65('0x12')][_0x6d65('0x13')]===0x1f4){logger[_0x6d65('0x12')]('Trunk,\x20%s,\x20%s',_0x8e3136,_0x246cd3[_0x6d65('0x12')][_0x6d65('0x14')]);return _0x31dce0(_0x246cd3[_0x6d65('0x12')]['message']);}logger[_0x6d65('0x12')]('Trunk,\x20%s,\x20%s',_0x8e3136,_0x246cd3['error'][_0x6d65('0x14')]);return _0x16a7b7(_0x246cd3['error']['message']);}else{logger['info'](_0x6d65('0xe'),_0x8e3136,'request\x20sent');_0x16a7b7(_0x246cd3[_0x6d65('0x15')][_0x6d65('0x14')]);}})[_0x6d65('0x16')](function(_0x1b5fe7){logger[_0x6d65('0x12')](_0x6d65('0xe'),_0x8e3136,_0x1b5fe7);_0x31dce0(_0x1b5fe7);});});}exports[_0x6d65('0x17')]=function(_0x11cbbb){var _0x50af37=this;return new Promise(function(_0x710501,_0xa7d8a0){return db['Trunk']['findAll']({'raw':_0x11cbbb[_0x6d65('0x18')]?_0x11cbbb['options'][_0x6d65('0x19')]===undefined?!![]:![]:!![],'where':_0x11cbbb[_0x6d65('0x18')]?_0x11cbbb['options'][_0x6d65('0x1a')]||null:null,'attributes':_0x11cbbb[_0x6d65('0x18')]?_0x11cbbb[_0x6d65('0x18')][_0x6d65('0x1b')]||null:null,'limit':_0x11cbbb[_0x6d65('0x18')]?_0x11cbbb['options'][_0x6d65('0x1c')]||null:null,'include':_0x11cbbb[_0x6d65('0x18')]?_0x11cbbb[_0x6d65('0x18')][_0x6d65('0x1d')]?_[_0x6d65('0x1e')](_0x11cbbb[_0x6d65('0x18')][_0x6d65('0x1d')],function(_0x36df1b){return{'model':db[_0x36df1b[_0x6d65('0x1f')]],'as':_0x36df1b['as'],'attributes':_0x36df1b[_0x6d65('0x1b')],'include':_0x36df1b[_0x6d65('0x1d')]?_[_0x6d65('0x1e')](_0x36df1b['include'],function(_0x3826e4){return{'model':db[_0x3826e4[_0x6d65('0x1f')]],'as':_0x3826e4['as'],'attributes':_0x3826e4[_0x6d65('0x1b')],'include':_0x3826e4['include']?_[_0x6d65('0x1e')](_0x3826e4['include'],function(_0x4c80d4){return{'model':db[_0x4c80d4[_0x6d65('0x1f')]],'as':_0x4c80d4['as'],'attributes':_0x4c80d4[_0x6d65('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32d2f1){logger[_0x6d65('0xd')]('GetTrunk',_0x11cbbb);logger['debug'](_0x6d65('0x17'),_0x11cbbb,JSON[_0x6d65('0x11')](_0x32d2f1));_0x710501(_0x32d2f1);})['catch'](function(_0xdc17b6){logger[_0x6d65('0x12')](_0x6d65('0x17'),_0xdc17b6[_0x6d65('0x14')],_0x11cbbb);_0xa7d8a0(_0x50af37[_0x6d65('0x12')](0x1f4,_0xdc17b6[_0x6d65('0x14')]));});});};exports[_0x6d65('0x20')]=function(_0x52e6b7){var _0x4c935e=this;return new Promise(function(_0x52e713,_0x52c400){return db[_0x6d65('0x21')][_0x6d65('0x22')]({'raw':_0x52e6b7[_0x6d65('0x18')]?_0x52e6b7['options'][_0x6d65('0x19')]===undefined?!![]:![]:!![],'where':_0x52e6b7[_0x6d65('0x18')]?_0x52e6b7[_0x6d65('0x18')]['where']||null:null,'attributes':_0x52e6b7[_0x6d65('0x18')]?_0x52e6b7['options'][_0x6d65('0x1b')]||null:null,'include':_0x52e6b7[_0x6d65('0x18')]?_0x52e6b7[_0x6d65('0x18')][_0x6d65('0x1d')]?_[_0x6d65('0x1e')](_0x52e6b7[_0x6d65('0x18')][_0x6d65('0x1d')],function(_0x4325c0){return{'model':db[_0x4325c0['model']],'as':_0x4325c0['as'],'attributes':_0x4325c0[_0x6d65('0x1b')],'include':_0x4325c0[_0x6d65('0x1d')]?_[_0x6d65('0x1e')](_0x4325c0[_0x6d65('0x1d')],function(_0x14ed47){return{'model':db[_0x14ed47['model']],'as':_0x14ed47['as'],'attributes':_0x14ed47[_0x6d65('0x1b')],'include':_0x14ed47[_0x6d65('0x1d')]?_[_0x6d65('0x1e')](_0x14ed47[_0x6d65('0x1d')],function(_0x49a6e1){return{'model':db[_0x49a6e1[_0x6d65('0x1f')]],'as':_0x49a6e1['as'],'attributes':_0x49a6e1[_0x6d65('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d65('0xc')](function(_0x204b94){logger[_0x6d65('0xd')]('ShowTrunk',_0x52e6b7);logger[_0x6d65('0x23')]('ShowTrunk',_0x52e6b7,JSON['stringify'](_0x204b94));_0x52e713(_0x204b94);})[_0x6d65('0x16')](function(_0x3cebda){logger[_0x6d65('0x12')]('ShowTrunk',_0x3cebda[_0x6d65('0x14')],_0x52e6b7);_0x52c400(_0x4c935e[_0x6d65('0x12')](0x1f4,_0x3cebda['message']));});});};
\ No newline at end of file
index cbeb01d..4867059 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd29a=['update','express','Router','../../components/auth/service','./user-setting.controller','put','isAuthenticated'];(function(_0xf4770b,_0xe68669){var _0x4a672b=function(_0x5a8971){while(--_0x5a8971){_0xf4770b['push'](_0xf4770b['shift']());}};_0x4a672b(++_0xe68669);}(_0xd29a,0xa2));var _0xad29=function(_0x4735ed,_0x43c9cc){_0x4735ed=_0x4735ed-0x0;var _0x394889=_0xd29a[_0x4735ed];return _0x394889;};'use strict';var express=require(_0xad29('0x0'));var router=express[_0xad29('0x1')]();var auth=require(_0xad29('0x2'));var controller=require(_0xad29('0x3'));router[_0xad29('0x4')]('/:id',auth[_0xad29('0x5')](),controller[_0xad29('0x6')]);module['exports']=router;
\ No newline at end of file
+var _0x6ff0=['../../components/auth/service','put','/:id','isAuthenticated','update','exports','Router'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6ff0,0xae));var _0x06ff=function(_0x4de1a4,_0x3d21d7){_0x4de1a4=_0x4de1a4-0x0;var _0x2be3fb=_0x6ff0[_0x4de1a4];return _0x2be3fb;};'use strict';var express=require('express');var router=express[_0x06ff('0x0')]();var auth=require(_0x06ff('0x1'));var controller=require('./user-setting.controller');router[_0x06ff('0x2')](_0x06ff('0x3'),auth[_0x06ff('0x4')](),controller[_0x06ff('0x5')]);module[_0x06ff('0x6')]=router;
\ No newline at end of file
index ea67b53..3780c28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3abb=['warning','info','debug','exports','error','BOOLEAN','TEXT','DATE','INTEGER','sequelize'];(function(_0x375984,_0x1815d2){var _0x5b5e47=function(_0x383ee8){while(--_0x383ee8){_0x375984['push'](_0x375984['shift']());}};_0x5b5e47(++_0x1815d2);}(_0x3abb,0x17b));var _0xb3ab=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x3abb[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0xb3ab('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb3ab('0x1'),_0xb3ab('0x2'),_0xb3ab('0x3')];module[_0xb3ab('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb3ab('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb3ab('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb3ab('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb3ab('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb3ab('0x9')],'unique':'UserId'}};
\ No newline at end of file
+var _0x8a9a=['UserId','sequelize','error','warning','info','exports','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x127ec9,_0x1055fe){var _0xdbf116=function(_0x3a344b){while(--_0x3a344b){_0x127ec9['push'](_0x127ec9['shift']());}};_0xdbf116(++_0x1055fe);}(_0x8a9a,0xdd));var _0xa8a9=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x8a9a[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0xa8a9('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa8a9('0x1'),_0xa8a9('0x2'),_0xa8a9('0x3'),'debug'];module[_0xa8a9('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa8a9('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xa8a9('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa8a9('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa8a9('0x8')],'unique':_0xa8a9('0x9')}};
\ No newline at end of file
index b60067a..63d76c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28aa=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x32c0c9,_0x40cb27){var _0x908e05=function(_0x4c2089){while(--_0x4c2089){_0x32c0c9['push'](_0x32c0c9['shift']());}};_0x908e05(++_0x40cb27);}(_0x28aa,0xf8));var _0xa28a=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x28aa[_0x18a79d];return _0x4f8848;};'use strict';var _=require('lodash');var Redis=require(_0xa28a('0x0'));var logger=require(_0xa28a('0x1'))(_0xa28a('0x2'));var config=require(_0xa28a('0x3'));var db=require(_0xa28a('0x4'))['db'];var socket=require(_0xa28a('0x5'))(new Redis(config['redis']));require(_0xa28a('0x6'))[_0xa28a('0x7')](socket);config[_0xa28a('0x8')]=_[_0xa28a('0x9')](config['redis'],{'host':_0xa28a('0xa'),'port':0x18eb});function respondWithResult(_0x33cda2,_0x150568){_0x150568=_0x150568||0xc8;return function(_0x1d2e08){if(_0x1d2e08){return _0x33cda2[_0xa28a('0xb')](_0x150568)[_0xa28a('0xc')](_0x1d2e08);}};}function saveUpdates(_0x2ab985){return function(_0x102a61){if(_0x102a61){return _0x102a61[_0xa28a('0xd')](_0x2ab985)[_0xa28a('0xe')](function(_0x3e8701){return _0x3e8701;});}return null;};}function handleEntityNotFound(_0xc23755){return function(_0x19a508){if(!_0x19a508){_0xc23755[_0xa28a('0xf')](0x194);}return _0x19a508;};}function handleError(_0x1d0a82,_0x5b3abd){_0x5b3abd=_0x5b3abd||0x1f4;return function(_0x1c223c){logger[_0xa28a('0x10')](_0x1c223c[_0xa28a('0x11')]);if(_0x1c223c[_0xa28a('0x12')]){delete _0x1c223c['name'];}_0x1d0a82[_0xa28a('0xb')](_0x5b3abd)[_0xa28a('0x13')](_0x1c223c);};}exports['update']=function(_0x500cef,_0x3350d6){if(_0x500cef[_0xa28a('0x14')][_0xa28a('0x15')]!==_0xa28a('0x16'))throw new Error(_0xa28a('0x17'));if(isNaN(Number(_0x500cef[_0xa28a('0x18')]['id'])))throw new Error(_0xa28a('0x19'));return db[_0xa28a('0x1a')][_0xa28a('0x1b')]({'where':{'id':_0x500cef['params']['id']}})[_0xa28a('0xe')](handleEntityNotFound(_0x3350d6,null))[_0xa28a('0xe')](saveUpdates(_0x500cef[_0xa28a('0x1c')],null))['then'](respondWithResult(_0x3350d6,null))[_0xa28a('0x1d')](handleError(_0x3350d6,null));};
\ No newline at end of file
+var _0x6611=['../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','update','then','sendStatus','stack','name','status','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','ioredis','../../config/logger','api','../../config/environment'];(function(_0x438853,_0x277d1c){var _0x366d31=function(_0x2fd42e){while(--_0x2fd42e){_0x438853['push'](_0x438853['shift']());}};_0x366d31(++_0x277d1c);}(_0x6611,0xdd));var _0x1661=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6611[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var Redis=require(_0x1661('0x0'));var logger=require(_0x1661('0x1'))(_0x1661('0x2'));var config=require(_0x1661('0x3'));var db=require(_0x1661('0x4'))['db'];var socket=require(_0x1661('0x5'))(new Redis(config[_0x1661('0x6')]));require(_0x1661('0x7'))[_0x1661('0x8')](socket);config[_0x1661('0x6')]=_[_0x1661('0x9')](config[_0x1661('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x516d22,_0x3f32f3){_0x3f32f3=_0x3f32f3||0xc8;return function(_0x3be60f){if(_0x3be60f){return _0x516d22['status'](_0x3f32f3)['json'](_0x3be60f);}};}function saveUpdates(_0x9a6c9b){return function(_0x403afc){if(_0x403afc){return _0x403afc[_0x1661('0xa')](_0x9a6c9b)[_0x1661('0xb')](function(_0x352ca0){return _0x352ca0;});}return null;};}function handleEntityNotFound(_0x478300){return function(_0x11a269){if(!_0x11a269){_0x478300[_0x1661('0xc')](0x194);}return _0x11a269;};}function handleError(_0x4beb37,_0x156822){_0x156822=_0x156822||0x1f4;return function(_0x2197f2){logger['error'](_0x2197f2[_0x1661('0xd')]);if(_0x2197f2['name']){delete _0x2197f2[_0x1661('0xe')];}_0x4beb37[_0x1661('0xf')](_0x156822)[_0x1661('0x10')](_0x2197f2);};}exports[_0x1661('0xa')]=function(_0x3a2de4,_0x11843d){if(_0x3a2de4[_0x1661('0x11')][_0x1661('0x12')]!==_0x1661('0x13'))throw new Error(_0x1661('0x14'));if(isNaN(Number(_0x3a2de4[_0x1661('0x15')]['id'])))throw new Error(_0x1661('0x16'));return db[_0x1661('0x17')]['find']({'where':{'id':_0x3a2de4['params']['id']}})[_0x1661('0xb')](handleEntityNotFound(_0x11843d,null))[_0x1661('0xb')](saveUpdates(_0x3a2de4['body'],null))[_0x1661('0xb')](respondWithResult(_0x11843d,null))[_0x1661('0x18')](handleError(_0x11843d,null));};
\ No newline at end of file
index 560a105..e210cf1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2015=['emit','hasOwnProperty','events','UserSetting','setMaxListeners','save','update','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2015,0x122));var _0x5201=function(_0x128cfd,_0x14c32b){_0x128cfd=_0x128cfd-0x0;var _0x375d19=_0x2015[_0x128cfd];return _0x375d19;};'use strict';var EventEmitter=require(_0x5201('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x5201('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x5201('0x2')](0x0);var events={'afterCreate':_0x5201('0x3'),'afterUpdate':_0x5201('0x4'),'afterDestroy':_0x5201('0x5')};function emitEvent(_0x10ba98){return function(_0x52e899,_0x2a4ecd,_0x4a50ea){UserSettingEvents[_0x5201('0x6')](_0x10ba98+':'+_0x52e899['id'],_0x52e899);UserSettingEvents[_0x5201('0x6')](_0x10ba98,_0x52e899);_0x4a50ea(null);};}for(var e in events){if(events[_0x5201('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents;
\ No newline at end of file
+var _0xd2e1=['UserSetting','setMaxListeners','emit','exports'];(function(_0x569de8,_0x1dbf83){var _0x3da95b=function(_0x442016){while(--_0x442016){_0x569de8['push'](_0x569de8['shift']());}};_0x3da95b(++_0x1dbf83);}(_0xd2e1,0x1b8));var _0x1d2e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd2e1[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x1d2e('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1d2e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4622d1){return function(_0x25c3dc,_0x4f9ced,_0x1d473f){UserSettingEvents['emit'](_0x4622d1+':'+_0x25c3dc['id'],_0x25c3dc);UserSettingEvents[_0x1d2e('0x2')](_0x4622d1,_0x25c3dc);_0x1d473f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x1d2e('0x3')]=UserSettingEvents;
\ No newline at end of file
index fffaeac..ebd83b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa477=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0xa477,0xe6));var _0x7a47=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa477[_0x17d9e3];return _0x14192d;};'use strict';var attributes=require(_0x7a47('0x0'));module[_0x7a47('0x1')]=function(_0x576699){return _0x576699[_0x7a47('0x2')](_0x7a47('0x3'),attributes,{'tableName':_0x7a47('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19697b){if(!_0x19697b[_0x7a47('0x5')])_0x19697b[_0x7a47('0x6')]=null;else if(_0x19697b[_0x7a47('0x6')]===null)_0x19697b['clientSideLoggingEnabledSince']=new Date();}}});};
\ No newline at end of file
+var _0xea28=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0xea28,0x13a));var _0x8ea2=function(_0x3d693c,_0x3ce609){_0x3d693c=_0x3d693c-0x0;var _0xf6102f=_0xea28[_0x3d693c];return _0xf6102f;};'use strict';var attributes=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]=function(_0x389e8f){return _0x389e8f[_0x8ea2('0x2')](_0x8ea2('0x3'),attributes,{'tableName':_0x8ea2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3309d9){if(!_0x3309d9[_0x8ea2('0x5')])_0x3309d9['clientSideLoggingEnabledSince']=null;else if(_0x3309d9[_0x8ea2('0x6')]===null)_0x3309d9[_0x8ea2('0x6')]=new Date();}}});};
\ No newline at end of file
index 3731a69..3cab905 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b63=['update','user-setting:update','emit','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events'];(function(_0x280049,_0xf27818){var _0x511486=function(_0x4984ee){while(--_0x4984ee){_0x280049['push'](_0x280049['shift']());}};_0x511486(++_0xf27818);}(_0x0b63,0xe7));var _0x30b6=function(_0x5aedb3,_0x42c1be){_0x5aedb3=_0x5aedb3-0x0;var _0x35ec9c=_0x0b63[_0x5aedb3];return _0x35ec9c;};'use strict';var UserSettingEvents=require(_0x30b6('0x0'));var events=['save','remove',_0x30b6('0x1')];function createListener(_0x862463,_0x4023ed){return function(_0x13ecc9){_0x4023ed['emit'](_0x862463,_0x13ecc9);if(_0x862463===_0x30b6('0x2')){_0x4023ed[_0x30b6('0x3')](_0x30b6('0x4')+_0x13ecc9[_0x30b6('0x5')],_0x13ecc9);}};}exports[_0x30b6('0x6')]=function(_0x2fddeb){for(var _0x4fb35e=0x0,_0x11a637=events['length'];_0x4fb35e<_0x11a637;_0x4fb35e++){var _0x4488c6=events[_0x4fb35e];var _0x4eb0af=createListener(_0x30b6('0x7')+_0x4488c6,_0x2fddeb);UserSettingEvents['on'](_0x4488c6,_0x4eb0af);}};
\ No newline at end of file
+var _0xd456=['remove','emit','user-setting:update','user-setting:update:user-','UserId','register','length','save'];(function(_0x5f0f7a,_0x244c53){var _0x8742e7=function(_0x48ff6e){while(--_0x48ff6e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8742e7(++_0x244c53);}(_0xd456,0x107));var _0x6d45=function(_0x1287db,_0x4705e3){_0x1287db=_0x1287db-0x0;var _0x4d84be=_0xd456[_0x1287db];return _0x4d84be;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x6d45('0x0'),_0x6d45('0x1'),'update'];function createListener(_0x1b3ab0,_0x5a858c){return function(_0xebb571){_0x5a858c[_0x6d45('0x2')](_0x1b3ab0,_0xebb571);if(_0x1b3ab0===_0x6d45('0x3')){_0x5a858c[_0x6d45('0x2')](_0x6d45('0x4')+_0xebb571[_0x6d45('0x5')],_0xebb571);}};}exports[_0x6d45('0x6')]=function(_0x686a62){for(var _0x4711a5=0x0,_0x51c3e7=events[_0x6d45('0x7')];_0x4711a5<_0x51c3e7;_0x4711a5++){var _0x5aaab=events[_0x4711a5];var _0x49f30a=createListener('user-setting:'+_0x5aaab,_0x686a62);UserSettingEvents['on'](_0x5aaab,_0x49f30a);}};
\ No newline at end of file
index c140ad7..f48b43e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1ee=['put','/:id','update','/:id/password','changePassword','removeQueues','delete','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','whoami','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','addQueues','join','root','server/files/images/','%s-%s','now','originalname','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey'];(function(_0x9d5a92,_0x34875d){var _0x3d84f2=function(_0x4bde89){while(--_0x4bde89){_0x9d5a92['push'](_0x9d5a92['shift']());}};_0x3d84f2(++_0x34875d);}(_0xe1ee,0x158));var _0xee1e=function(_0xecb7da,_0x1bcc50){_0xecb7da=_0xecb7da-0x0;var _0x571c35=_0xe1ee[_0xecb7da];return _0x571c35;};'use strict';var multer=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var path=require('path');var timeout=require(_0xee1e('0x2'));var express=require(_0xee1e('0x3'));var router=express['Router']();var fs_extra=require(_0xee1e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xee1e('0x5'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xee1e('0x6')]('/',auth[_0xee1e('0x7')](),controller[_0xee1e('0x8')]);router[_0xee1e('0x6')]('/describe',auth[_0xee1e('0x7')](),controller['describe']);router['get']('/whoami',auth[_0xee1e('0x7')](),controller[_0xee1e('0x9')]);router[_0xee1e('0x6')]('/presence',auth['isAuthenticated'](),controller[_0xee1e('0xa')]);router[_0xee1e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xee1e('0xb')]);router[_0xee1e('0x6')](_0xee1e('0xc'),controller[_0xee1e('0xd')]);router[_0xee1e('0x6')]('/:id/open_tabs',auth[_0xee1e('0x7')](),controller[_0xee1e('0xe')]);router[_0xee1e('0x6')](_0xee1e('0xf'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x10')]);router['get'](_0xee1e('0x11'),auth['isAuthenticated'](),controller[_0xee1e('0x12')]);router['get'](_0xee1e('0x13'),auth['isAuthenticated'](),controller[_0xee1e('0x14')]);router[_0xee1e('0x6')](_0xee1e('0x15'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x16')]);router[_0xee1e('0x6')](_0xee1e('0x17'),auth['isAuthenticated'](),controller[_0xee1e('0x18')]);router[_0xee1e('0x6')](_0xee1e('0x19'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x1a')]);router[_0xee1e('0x6')](_0xee1e('0x1b'),auth['isAuthenticated'](),controller[_0xee1e('0x1c')]);router[_0xee1e('0x6')]('/:id/openchannel/interactions',auth[_0xee1e('0x7')](),controller[_0xee1e('0x1d')]);router['get'](_0xee1e('0x1e'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x1f')]);router[_0xee1e('0x6')](_0xee1e('0x20'),auth[_0xee1e('0x7')](),controller['getSmsInteractions']);router[_0xee1e('0x6')](_0xee1e('0x21'),auth[_0xee1e('0x7')](),controller['getFaxInteractions']);router[_0xee1e('0x6')](_0xee1e('0x22'),auth[_0xee1e('0x7')](),controller['getWhatsappInteractions']);router['get'](_0xee1e('0x23'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x24')]);router[_0xee1e('0x6')](_0xee1e('0x25'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x26')]);router[_0xee1e('0x6')](_0xee1e('0x27'),auth[_0xee1e('0x7')](),controller['getAgents']);router[_0xee1e('0x6')]('/:id/prefixes',auth[_0xee1e('0x7')](),controller[_0xee1e('0x28')]);router[_0xee1e('0x6')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xee1e('0x29')]);router[_0xee1e('0x6')]('/:id/mail_accounts',auth[_0xee1e('0x7')](),controller[_0xee1e('0x2a')]);router['get'](_0xee1e('0x2b'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x2c')]);router[_0xee1e('0x6')]('/:id/sms_accounts',auth[_0xee1e('0x7')](),controller[_0xee1e('0x2d')]);router[_0xee1e('0x6')](_0xee1e('0x2e'),auth[_0xee1e('0x7')](),controller['getChatWebsites']);router[_0xee1e('0x6')](_0xee1e('0x2f'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x30')]);router[_0xee1e('0x6')](_0xee1e('0x31'),auth['isAuthenticated'](),controller[_0xee1e('0x32')]);router[_0xee1e('0x6')](_0xee1e('0x33'),auth[_0xee1e('0x7')](),controller['getApiKey']);router[_0xee1e('0x34')](_0xee1e('0xf'),auth['isAuthenticated'](),controller[_0xee1e('0x35')]);router[_0xee1e('0x34')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xee1e('0x36'),auth[_0xee1e('0x7')](),controller['bulkCreate']);router[_0xee1e('0x34')](_0xee1e('0x11'),auth['isAuthenticated'](),controller[_0xee1e('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1aa62e,_0x2a1a50,_0x40f389){_0x40f389(null,path[_0xee1e('0x38')](config[_0xee1e('0x39')],_0xee1e('0x3a')));},'filename':function(_0x509923,_0x2041d9,_0x273b42){_0x273b42(null,util['format'](_0xee1e('0x3b'),Date[_0xee1e('0x3c')](),_0x2041d9[_0xee1e('0x3d')]));}})});router['post'](_0xee1e('0xc'),upload[_0xee1e('0x3e')](_0xee1e('0x3f')),controller['addAvatar']);router['post']('/:id/login',auth[_0xee1e('0x7')](),controller[_0xee1e('0x40')]);router[_0xee1e('0x34')](_0xee1e('0x41'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x42')]);router[_0xee1e('0x34')](_0xee1e('0x43'),auth['isAuthenticated'](),controller[_0xee1e('0x44')]);router['post'](_0xee1e('0x45'),auth[_0xee1e('0x7')](),controller['unpause']);router[_0xee1e('0x34')](_0xee1e('0x23'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x46')]);router[_0xee1e('0x34')](_0xee1e('0x47'),auth[_0xee1e('0x7')](),controller['addChatInteractions']);router['post'](_0xee1e('0x48'),auth[_0xee1e('0x7')](),controller['addMailInteractions']);router[_0xee1e('0x34')](_0xee1e('0x49'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x4a')]);router[_0xee1e('0x34')](_0xee1e('0x4b'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x4c')]);router['post']('/:id/openchannel_interactions',auth[_0xee1e('0x7')](),controller[_0xee1e('0x4d')]);router['post'](_0xee1e('0x4e'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x4f')]);router['post']('/:id/fax_accounts',auth[_0xee1e('0x7')](),controller[_0xee1e('0x50')]);router[_0xee1e('0x34')](_0xee1e('0x51'),auth[_0xee1e('0x7')](),controller['addMailAccounts']);router['post'](_0xee1e('0x2b'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x52')]);router[_0xee1e('0x34')](_0xee1e('0x53'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x54')]);router[_0xee1e('0x34')](_0xee1e('0x2e'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x55')]);router[_0xee1e('0x34')]('/:id/whatsapp_accounts',auth[_0xee1e('0x7')](),controller[_0xee1e('0x56')]);router[_0xee1e('0x34')](_0xee1e('0x33'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x57')]);router[_0xee1e('0x58')](_0xee1e('0x59'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x5a')]);router[_0xee1e('0x58')](_0xee1e('0x5b'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x5c')]);router['delete'](_0xee1e('0x11'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x5d')]);router[_0xee1e('0x5e')](_0xee1e('0x23'),auth[_0xee1e('0x7')](),controller['removeTeams']);router[_0xee1e('0x5e')](_0xee1e('0x59'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x5f')]);router[_0xee1e('0x5e')](_0xee1e('0x47'),auth[_0xee1e('0x7')](),controller['removeChatInteractions']);router[_0xee1e('0x5e')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xee1e('0x60')]);router['delete'](_0xee1e('0x49'),auth['isAuthenticated'](),controller[_0xee1e('0x61')]);router[_0xee1e('0x5e')]('/:id/sms_interactions',auth[_0xee1e('0x7')](),controller[_0xee1e('0x62')]);router[_0xee1e('0x5e')](_0xee1e('0x63'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x64')]);router[_0xee1e('0x5e')](_0xee1e('0x4e'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x65')]);router[_0xee1e('0x5e')](_0xee1e('0x66'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x67')]);router['delete']('/:id/mail_accounts',auth[_0xee1e('0x7')](),controller[_0xee1e('0x68')]);router['delete'](_0xee1e('0x2b'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x69')]);router[_0xee1e('0x5e')](_0xee1e('0x53'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x6a')]);router[_0xee1e('0x5e')]('/:id/chat_websites',auth[_0xee1e('0x7')](),controller[_0xee1e('0x6b')]);router[_0xee1e('0x5e')]('/:id/whatsapp_accounts',auth[_0xee1e('0x7')](),controller['removeWhatsappAccounts']);router[_0xee1e('0x5e')](_0xee1e('0x33'),auth[_0xee1e('0x7')](),controller['removeApiKey']);module['exports']=router;
\ No newline at end of file
+var _0xf150=['addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','/:id/queues','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','getPresence','/:id','show','getAvatar','/:id/open_tabs','/:id/contacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','server/files/images/','format','%s-%s','originalname','/:id/avatar','single','file','/:id/login','login','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions'];(function(_0x609443,_0x3e4c99){var _0x62cb30=function(_0x3dc499){while(--_0x3dc499){_0x609443['push'](_0x609443['shift']());}};_0x62cb30(++_0x3e4c99);}(_0xf150,0x106));var _0x0f15=function(_0x4b33dc,_0x5031dc){_0x4b33dc=_0x4b33dc-0x0;var _0x104bb9=_0xf150[_0x4b33dc];return _0x104bb9;};'use strict';var multer=require(_0x0f15('0x0'));var util=require(_0x0f15('0x1'));var path=require(_0x0f15('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f15('0x3'));var router=express[_0x0f15('0x4')]();var fs_extra=require(_0x0f15('0x5'));var auth=require(_0x0f15('0x6'));var interaction=require(_0x0f15('0x7'));var config=require(_0x0f15('0x8'));var controller=require(_0x0f15('0x9'));router[_0x0f15('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0f15('0xa')](_0x0f15('0xb'),auth[_0x0f15('0xc')](),controller[_0x0f15('0xd')]);router['get'](_0x0f15('0xe'),auth['isAuthenticated'](),controller[_0x0f15('0xf')]);router[_0x0f15('0xa')]('/presence',auth['isAuthenticated'](),controller[_0x0f15('0x10')]);router[_0x0f15('0xa')](_0x0f15('0x11'),auth['isAuthenticated'](),controller[_0x0f15('0x12')]);router['get']('/:id/avatar',controller[_0x0f15('0x13')]);router[_0x0f15('0xa')](_0x0f15('0x14'),auth[_0x0f15('0xc')](),controller['getOpenTabs']);router[_0x0f15('0xa')](_0x0f15('0x15'),auth[_0x0f15('0xc')](),controller['getContacts']);router[_0x0f15('0xa')]('/:id/queues',auth[_0x0f15('0xc')](),controller[_0x0f15('0x16')]);router['get']('/:id/queues_rt',auth[_0x0f15('0xc')](),controller[_0x0f15('0x17')]);router[_0x0f15('0xa')](_0x0f15('0x18'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x19')]);router[_0x0f15('0xa')]('/:id/recordings',auth[_0x0f15('0xc')](),controller[_0x0f15('0x1a')]);router['get'](_0x0f15('0x1b'),auth['isAuthenticated'](),controller[_0x0f15('0x1c')]);router['get'](_0x0f15('0x1d'),auth[_0x0f15('0xc')](),controller['getChatInteractions']);router[_0x0f15('0xa')](_0x0f15('0x1e'),auth['isAuthenticated'](),controller[_0x0f15('0x1f')]);router['get']('/:id/mail/interactions',auth[_0x0f15('0xc')](),controller['getMailInteractions']);router['get']('/:id/sms/interactions',auth[_0x0f15('0xc')](),controller[_0x0f15('0x20')]);router[_0x0f15('0xa')](_0x0f15('0x21'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x22')]);router[_0x0f15('0xa')](_0x0f15('0x23'),auth[_0x0f15('0xc')](),controller['getWhatsappInteractions']);router[_0x0f15('0xa')](_0x0f15('0x24'),auth[_0x0f15('0xc')](),controller['getTeams']);router[_0x0f15('0xa')](_0x0f15('0x25'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x26')]);router[_0x0f15('0xa')](_0x0f15('0x27'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x28')]);router[_0x0f15('0xa')](_0x0f15('0x29'),auth[_0x0f15('0xc')](),controller['getVoicePrefixes']);router[_0x0f15('0xa')](_0x0f15('0x2a'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x2b')]);router[_0x0f15('0xa')](_0x0f15('0x2c'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x2d')]);router['get'](_0x0f15('0x2e'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x2f')]);router[_0x0f15('0xa')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x0f15('0xa')](_0x0f15('0x30'),auth['isAuthenticated'](),controller[_0x0f15('0x31')]);router[_0x0f15('0xa')](_0x0f15('0x32'),auth['isAuthenticated'](),controller[_0x0f15('0x33')]);router[_0x0f15('0xa')](_0x0f15('0x34'),auth[_0x0f15('0xc')](),controller['getScheduledCalls']);router['get'](_0x0f15('0x35'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x36')]);router[_0x0f15('0x37')](_0x0f15('0x15'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x38')]);router[_0x0f15('0x37')]('/',auth[_0x0f15('0xc')](),controller[_0x0f15('0x39')]);router[_0x0f15('0x37')](_0x0f15('0x3a'),auth[_0x0f15('0xc')](),controller['bulkCreate']);router[_0x0f15('0x37')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0f15('0x3b')]);var upload=multer({'storage':multer[_0x0f15('0x3c')]({'destination':function(_0x4d4903,_0x44f2e1,_0x52b7fc){_0x52b7fc(null,path['join'](config['root'],_0x0f15('0x3d')));},'filename':function(_0x23ec36,_0x38725d,_0x3b9a55){_0x3b9a55(null,util[_0x0f15('0x3e')](_0x0f15('0x3f'),Date['now'](),_0x38725d[_0x0f15('0x40')]));}})});router[_0x0f15('0x37')](_0x0f15('0x41'),upload[_0x0f15('0x42')](_0x0f15('0x43')),controller['addAvatar']);router[_0x0f15('0x37')](_0x0f15('0x44'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x45')]);router['post']('/:id/logout',auth[_0x0f15('0xc')](),controller[_0x0f15('0x46')]);router[_0x0f15('0x37')]('/:id/pause',auth[_0x0f15('0xc')](),controller[_0x0f15('0x47')]);router[_0x0f15('0x37')](_0x0f15('0x48'),auth['isAuthenticated'](),controller[_0x0f15('0x49')]);router[_0x0f15('0x37')](_0x0f15('0x24'),auth['isAuthenticated'](),controller[_0x0f15('0x4a')]);router[_0x0f15('0x37')](_0x0f15('0x4b'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x4c')]);router[_0x0f15('0x37')](_0x0f15('0x4d'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x4e')]);router[_0x0f15('0x37')]('/:id/fax_interactions',auth[_0x0f15('0xc')](),controller[_0x0f15('0x4f')]);router['post'](_0x0f15('0x50'),auth[_0x0f15('0xc')](),controller['addSmsInteractions']);router['post'](_0x0f15('0x51'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x52')]);router['post']('/:id/whatsapp_interactions',auth[_0x0f15('0xc')](),controller[_0x0f15('0x53')]);router[_0x0f15('0x37')](_0x0f15('0x2a'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x54')]);router[_0x0f15('0x37')]('/:id/mail_accounts',auth[_0x0f15('0xc')](),controller[_0x0f15('0x55')]);router[_0x0f15('0x37')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x0f15('0x56')]);router['post'](_0x0f15('0x57'),auth['isAuthenticated'](),controller[_0x0f15('0x58')]);router[_0x0f15('0x37')](_0x0f15('0x30'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x59')]);router[_0x0f15('0x37')]('/:id/whatsapp_accounts',auth[_0x0f15('0xc')](),controller[_0x0f15('0x5a')]);router[_0x0f15('0x37')]('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router[_0x0f15('0x5b')](_0x0f15('0x11'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x5c')]);router[_0x0f15('0x5b')](_0x0f15('0x5d'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x5e')]);router['delete'](_0x0f15('0x5f'),auth['isAuthenticated'](),controller[_0x0f15('0x60')]);router[_0x0f15('0x61')](_0x0f15('0x24'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x0f15('0x61')](_0x0f15('0x11'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x62')]);router['delete']('/:id/chat_interactions',auth[_0x0f15('0xc')](),controller[_0x0f15('0x63')]);router[_0x0f15('0x61')](_0x0f15('0x4d'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x64')]);router[_0x0f15('0x61')](_0x0f15('0x65'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x66')]);router['delete'](_0x0f15('0x50'),auth['isAuthenticated'](),controller[_0x0f15('0x67')]);router['delete'](_0x0f15('0x51'),auth['isAuthenticated'](),controller[_0x0f15('0x68')]);router[_0x0f15('0x61')](_0x0f15('0x69'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x6a')]);router[_0x0f15('0x61')](_0x0f15('0x2a'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x6b')]);router[_0x0f15('0x61')](_0x0f15('0x2c'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x6c')]);router[_0x0f15('0x61')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x0f15('0x6d')]);router[_0x0f15('0x61')]('/:id/sms_accounts',auth[_0x0f15('0xc')](),controller[_0x0f15('0x6e')]);router[_0x0f15('0x61')](_0x0f15('0x30'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x6f')]);router[_0x0f15('0x61')](_0x0f15('0x32'),auth[_0x0f15('0xc')](),controller[_0x0f15('0x70')]);router[_0x0f15('0x61')]('/:id/api_key',auth[_0x0f15('0xc')](),controller[_0x0f15('0x71')]);module[_0x0f15('0x72')]=router;
\ No newline at end of file
index da48174..1ba92ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}};
\ No newline at end of file
index 0e9b631..4be0009 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed58=['DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','removeTeams','VoicePrefixId','CmList','getLists','getAgents','values','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$lt','$lte','$eq','$not','$between','$notBetween','$in','$iLike','$notILike','$like','$overlap','$contains','$contained','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','removeApiKey','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','teams','queues','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','idle','unavailable','ringing','busy','charAt','toUpperCase','slice','QueryTypes','SELECT','field','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','limit','count','offset','status','set','Content-Range','agent','destroy','get','admin','Users','filter','map','value','includes','find','role','UserProfileResource','name','send','index','User','fieldName','type','key','password','getOptions','where','query','includeAll','include','userSetting','UserSetting','attributes','push','findAll','rows','openTabs','true','length','dataValues','sms','mail','whatsapp','show','keys','rawAttributes','salt','filters','intersection','model','fields','merge','options','chat','openchannel','all','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','106','107','108','109','100','111','114','115','user','checkUserLimits','settingsEnabled','create','UserProfileSection','Agents','Telephones','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','some','telephone','isEmpty','changePassword','params','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','online','SIP/%s','voicePause','penalty','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','userpic','file','join','root','server/files/images/logos/default_profile.png','isNil','download','existsSync','server/files/images/','fax','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','hasOwnProperty','Tag','Tags','color','tag','getQueues','pick','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','format','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','update','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','updateAttributes','getChannels'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xed58,0x89));var _0x8ed5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xed58[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require(_0x8ed5('0x0'));var util=require(_0x8ed5('0x1'));var path=require(_0x8ed5('0x2'));var fs=require('fs');var _=require(_0x8ed5('0x3'));var squel=require(_0x8ed5('0x4'));var jayson=require('jayson/promise');var Redis=require(_0x8ed5('0x5'));var authService=require(_0x8ed5('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x8ed5('0x7'))('api');var utils=require(_0x8ed5('0x8'));var config=require(_0x8ed5('0x9'));var licenseUtil=require(_0x8ed5('0xa'));var APIBadRequestError=require(_0x8ed5('0xb'))[_0x8ed5('0xc')];var APINotFoundError=require(_0x8ed5('0xb'))['APINotFoundError'];var APIHandleError=require(_0x8ed5('0xb'))[_0x8ed5('0xd')];var db=require(_0x8ed5('0xe'))['db'];var socket=require(_0x8ed5('0xf'))(new Redis(config[_0x8ed5('0x10')]));require(_0x8ed5('0x11'))[_0x8ed5('0x12')](socket);config[_0x8ed5('0x10')]=_['defaults'](config[_0x8ed5('0x10')],{'host':_0x8ed5('0x13'),'port':0x18eb});var amiClient=jayson[_0x8ed5('0x14')][_0x8ed5('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x3f56f6,_0x364382,_0x5ec515,_0x36fabf){return new Promise(function(_0xdefdb,_0x57d867){var _0x4defd9=_0x36fabf||amiClient;return _0x4defd9['request'](_0x3f56f6,_0x5ec515)[_0x8ed5('0x16')](function(_0x3c9737){logger[_0x8ed5('0x17')](_0x8ed5('0x18'),_0x364382,_0x8ed5('0x19'));logger['debug'](_0x8ed5('0x1a'),_0x364382,_0x8ed5('0x19'),JSON[_0x8ed5('0x1b')](_0x3c9737));if(_0x3c9737[_0x8ed5('0x1c')]){if(_0x3c9737[_0x8ed5('0x1c')]['code']===0x1f4){logger['error'](_0x8ed5('0x18'),_0x364382,_0x3c9737[_0x8ed5('0x1c')][_0x8ed5('0x1d')]);return _0x57d867(_0x3c9737[_0x8ed5('0x1c')][_0x8ed5('0x1d')]);}logger[_0x8ed5('0x1c')]('User,\x20%s,\x20%s',_0x364382,_0x3c9737[_0x8ed5('0x1c')][_0x8ed5('0x1d')]);return _0xdefdb(_0x3c9737['error'][_0x8ed5('0x1d')]);}else{logger[_0x8ed5('0x17')](_0x8ed5('0x18'),_0x364382,_0x8ed5('0x19'));_0xdefdb(_0x3c9737['result']['message']);}})[_0x8ed5('0x1e')](function(_0x37e96f){logger[_0x8ed5('0x1c')]('User,\x20%s,\x20%s',_0x364382,_0x37e96f);_0x57d867(_0x37e96f);});});}function respondWithStatusCode(_0x2a5a97,_0x61fdf1){_0x61fdf1=_0x61fdf1||0xcc;return function(_0x1571a3){if(_0x1571a3){return _0x2a5a97[_0x8ed5('0x1f')](_0x61fdf1);}return _0x2a5a97['status'](_0x61fdf1)[_0x8ed5('0x20')]();};}function respondWithResult(_0x116b5e,_0x4c9f80){_0x4c9f80=_0x4c9f80||0xc8;return function(_0xeddc61){if(_0xeddc61){return _0x116b5e['status'](_0x4c9f80)[_0x8ed5('0x21')](_0xeddc61);}};}function respondWithFilteredResult(_0x4cc90d,_0x332801){return function(_0x511334){if(_0x511334){var _0x4e205e=typeof _0x332801['offset']==='undefined'&&typeof _0x332801[_0x8ed5('0x22')]==='undefined';var _0x48c0e2=_0x511334[_0x8ed5('0x23')];var _0x158d7c=_0x4e205e?0x0:_0x332801[_0x8ed5('0x24')];var _0x4b8d76=_0x4e205e?_0x511334[_0x8ed5('0x23')]:_0x332801[_0x8ed5('0x24')]+_0x332801[_0x8ed5('0x22')];var _0x3f482c;if(_0x4b8d76>=_0x48c0e2){_0x4b8d76=_0x48c0e2;_0x3f482c=0xc8;}else{_0x3f482c=0xce;}_0x4cc90d[_0x8ed5('0x25')](_0x3f482c);return _0x4cc90d[_0x8ed5('0x26')](_0x8ed5('0x27'),_0x158d7c+'-'+_0x4b8d76+'/'+_0x48c0e2)[_0x8ed5('0x21')](_0x511334);}return null;};}function saveUpdates(_0x1a4e48){return function(_0xbccd96){if(_0xbccd96){return _0xbccd96['update'](_0x1a4e48)['then'](function(_0x3d913f){if(_0x3d913f['role']===_0x8ed5('0x28')){socket['emit']('userNotification:recalc:'+_0x3d913f['id'],_0x3d913f);}return _0x3d913f;});}return null;};}function removeEntity(_0xe385fa){return function(_0x401a78){if(_0x401a78){return _0x401a78[_0x8ed5('0x29')]()['then'](function(){var _0x26fae3=_0x401a78[_0x8ed5('0x2a')]({'plain':!![]});if(_0x26fae3['role']===_0x8ed5('0x2b'))return;var _0x2e869e=[{'name':_0x8ed5('0x2c'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x29cafb=_(_0x2e869e)[_0x8ed5('0x2d')]('ignore')[_0x8ed5('0x2e')](_0x8ed5('0x2f'))['value']();if(_[_0x8ed5('0x30')](_0x29cafb,_0x26fae3['role'])){return;}var _0xa45a20=_[_0x8ed5('0x31')](_0x2e869e,[_0x8ed5('0x2f'),_0x26fae3[_0x8ed5('0x32')]])['name'];return db[_0x8ed5('0x33')][_0x8ed5('0x29')]({'where':{'type':_0xa45a20,'resourceId':_0x26fae3['id']}})[_0x8ed5('0x16')](function(){return _0x401a78;});})[_0x8ed5('0x16')](function(){_0xe385fa['status'](0xcc)[_0x8ed5('0x20')]();});}};}function handleEntityNotFound(_0xf4d1b6){return function(_0x1de272){if(!_0x1de272){_0xf4d1b6[_0x8ed5('0x1f')](0x194);}return _0x1de272;};}function handleError(_0x1a3dd9,_0x1ecfff){_0x1ecfff=_0x1ecfff||0x1f4;return function(_0x55e64f){logger[_0x8ed5('0x1c')](_0x55e64f['stack']);if(_0x55e64f[_0x8ed5('0x34')]){delete _0x55e64f['name'];}_0x1a3dd9[_0x8ed5('0x25')](_0x1ecfff)[_0x8ed5('0x35')](_0x55e64f);};}exports[_0x8ed5('0x36')]=function(_0x52572b,_0xd759){var _0x526112={},_0x490a5d={'count':0x0,'rows':[]};var _0x43674d=_(db[_0x8ed5('0x37')]['rawAttributes'])[_0x8ed5('0x2e')](function(_0x27f904){return{'name':_0x27f904[_0x8ed5('0x38')],'type':_0x27f904[_0x8ed5('0x39')][_0x8ed5('0x3a')]};})[_0x8ed5('0x2d')](function(_0x11e091){return!_[_0x8ed5('0x30')]([_0x8ed5('0x3b'),'salt'],_0x11e091[_0x8ed5('0x34')]);})[_0x8ed5('0x2f')]();_0x526112=qs[_0x8ed5('0x3c')](_0x43674d,_0x52572b);var _0x599897={'where':_0x526112[_0x8ed5('0x3d')]};return db[_0x8ed5('0x37')][_0x8ed5('0x23')](_0x599897)[_0x8ed5('0x16')](function(_0x3e5ec9){_0x490a5d[_0x8ed5('0x23')]=_0x3e5ec9;if(_0x52572b[_0x8ed5('0x3e')][_0x8ed5('0x3f')]){_0x526112[_0x8ed5('0x40')]=[{'all':!![]}];}if(_0x52572b[_0x8ed5('0x3e')][_0x8ed5('0x41')]==='true'){_0x526112[_0x8ed5('0x40')]=[{'model':db[_0x8ed5('0x42')],'as':_0x8ed5('0x41')}];}if(!_[_0x8ed5('0x30')](_0x526112[_0x8ed5('0x43')],'id')){_0x526112['attributes'][_0x8ed5('0x44')]('id');}return db['User'][_0x8ed5('0x45')](_0x526112);})['then'](function(_0x50bb66){_0x490a5d[_0x8ed5('0x46')]=_0x50bb66;if(_0x52572b[_0x8ed5('0x3e')][_0x8ed5('0x47')]===_0x8ed5('0x48')){var _0x39c4f2=[];for(var _0x235435=0x0;_0x235435<_0x490a5d[_0x8ed5('0x46')][_0x8ed5('0x49')];_0x235435++){_0x39c4f2[_0x8ed5('0x44')](get_open_tabs('chat',_0x490a5d[_0x8ed5('0x46')][_0x235435][_0x8ed5('0x4a')]));_0x39c4f2[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0x4b'),_0x490a5d[_0x8ed5('0x46')][_0x235435][_0x8ed5('0x4a')]));_0x39c4f2[_0x8ed5('0x44')](get_open_tabs('fax',_0x490a5d[_0x8ed5('0x46')][_0x235435][_0x8ed5('0x4a')]));_0x39c4f2['push'](get_open_tabs(_0x8ed5('0x4c'),_0x490a5d[_0x8ed5('0x46')][_0x235435][_0x8ed5('0x4a')]));_0x39c4f2[_0x8ed5('0x44')](get_open_tabs('openchannel',_0x490a5d['rows'][_0x235435][_0x8ed5('0x4a')]));_0x39c4f2[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0x4d'),_0x490a5d[_0x8ed5('0x46')][_0x235435][_0x8ed5('0x4a')]));}return Promise['all'](_0x39c4f2)['then'](function(){return _0x490a5d;});}else{return _0x490a5d;}})[_0x8ed5('0x16')](respondWithFilteredResult(_0xd759,_0x526112))[_0x8ed5('0x1e')](handleError(_0xd759,null));};exports[_0x8ed5('0x4e')]=function(_0x4fa91a,_0x321b10){var _0x26c993={'raw':![],'where':{'id':_0x4fa91a['params']['id']}},_0x84d326={};_0x84d326['model']=_['differenceBy'](_[_0x8ed5('0x4f')](db[_0x8ed5('0x37')][_0x8ed5('0x50')]),[_0x8ed5('0x3b'),_0x8ed5('0x51')]);_0x84d326[_0x8ed5('0x3e')]=_['keys'](_0x4fa91a[_0x8ed5('0x3e')]);_0x84d326[_0x8ed5('0x52')]=_['intersection'](_0x84d326['model'],_0x84d326['query']);_0x26c993[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x84d326[_0x8ed5('0x54')],qs['fields'](_0x4fa91a[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x26c993[_0x8ed5('0x43')]=_0x26c993[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x26c993[_0x8ed5('0x43')]:_0x84d326[_0x8ed5('0x54')];if(_0x4fa91a['query']['includeAll']){_0x26c993[_0x8ed5('0x40')]=[{'all':!![]}];}if(_0x4fa91a[_0x8ed5('0x3e')][_0x8ed5('0x41')]==='true'){_0x26c993[_0x8ed5('0x40')]=[{'model':db[_0x8ed5('0x42')],'as':_0x8ed5('0x41')}];}_0x26c993=_[_0x8ed5('0x56')]({},_0x26c993,_0x4fa91a[_0x8ed5('0x57')]);if(!_['includes'](_0x26c993[_0x8ed5('0x43')],'id')){_0x26c993[_0x8ed5('0x43')]['push']('id');}return db[_0x8ed5('0x37')][_0x8ed5('0x31')](_0x26c993)['then'](handleEntityNotFound(_0x321b10,null))[_0x8ed5('0x16')](function(_0x1ca373){var _0x11056f=[];values=_0x1ca373;if(_0x4fa91a['query']['openTabs']===_0x8ed5('0x48')){_0x11056f[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0x58'),_0x1ca373[_0x8ed5('0x4a')]));_0x11056f[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0x4b'),_0x1ca373[_0x8ed5('0x4a')]));_0x11056f['push'](get_open_tabs(_0x8ed5('0x59'),_0x1ca373[_0x8ed5('0x4a')]));_0x11056f[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0x4d'),_0x1ca373[_0x8ed5('0x4a')]));_0x11056f[_0x8ed5('0x44')](get_open_tabs('fax',_0x1ca373['dataValues']));_0x11056f[_0x8ed5('0x44')](get_open_tabs('mail',_0x1ca373['dataValues']));return Promise[_0x8ed5('0x5a')](_0x11056f);}else{return values;}})[_0x8ed5('0x16')](function(){return values;})['then'](respondWithResult(_0x321b10,null))['catch'](handleError(_0x321b10,null));};exports['update']=function(_0x300082,_0x39b52a){if(_0x300082[_0x8ed5('0x5b')]['id']){delete _0x300082[_0x8ed5('0x5b')]['id'];}delete _0x300082[_0x8ed5('0x5b')]['role'];return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x300082['params']['id']}})['then'](handleEntityNotFound(_0x39b52a,null))[_0x8ed5('0x16')](saveUpdates(_0x300082[_0x8ed5('0x5b')],null))['then'](respondWithResult(_0x39b52a,null))[_0x8ed5('0x1e')](handleError(_0x39b52a,null));};exports[_0x8ed5('0x5c')]=function(_0x1fd6c,_0x303f78){return db[_0x8ed5('0x37')][_0x8ed5('0x5c')]()[_0x8ed5('0x16')](respondWithResult(_0x303f78,null))['catch'](handleError(_0x303f78,null));};exports[_0x8ed5('0x5d')]=function(_0x195423,_0x51e54e){return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x195423['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x51e54e,null))['then'](function(_0x376f1d){if(_0x376f1d){return _0x376f1d['addContacts'](_0x195423[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x195423[_0x8ed5('0x5b')],['ids','id'])||{});}})[_0x8ed5('0x16')](respondWithResult(_0x51e54e,null))['catch'](handleError(_0x51e54e,null));};function validateUser(_0x199de3){return new Promise(function(_0x2b0c58,_0x200394){if(_0x199de3['internal'])return _0x2b0c58(_0x199de3);return db[_0x8ed5('0x60')][_0x8ed5('0x61')](0x1)['then'](function(_0x3ad9cf){if(_0x3ad9cf[_0x8ed5('0x62')])authService[_0x8ed5('0x63')](_0x199de3[_0x8ed5('0x3b')]);db[_0x8ed5('0x37')][_0x8ed5('0x64')](_0x8ed5('0x65'))[_0x8ed5('0x16')](function(_0x1088d9){if(_['isNil'](_0x1088d9)){_0x199de3[_0x8ed5('0x65')]=_0x3ad9cf[_0x8ed5('0x66')]||0x1;return;}if(_['isNil'](_0x3ad9cf['min_internal'])||_0x3ad9cf['min_internal']===_0x1088d9){_0x199de3['internal']=_0x1088d9+0x1;return;}if(_0x3ad9cf[_0x8ed5('0x66')]>_0x1088d9){_0x199de3[_0x8ed5('0x65')]=_0x3ad9cf[_0x8ed5('0x66')];return;}return db[_0x8ed5('0x67')][_0x8ed5('0x3e')](_0x8ed5('0x68'),{'type':db[_0x8ed5('0x67')]['QueryTypes']['SELECT']})['then'](function(_0x2c6ba2){if(_0x2c6ba2&&_0x2c6ba2[_0x8ed5('0x49')]){for(var _0x28720f=0x0,_0x40b6f5=_0x2c6ba2[_0x8ed5('0x49')];_0x28720f<_0x40b6f5&&_['isNil'](_0x199de3[_0x8ed5('0x65')]);_0x28720f++){if(_0x3ad9cf[_0x8ed5('0x66')]<=_0x2c6ba2[_0x28720f][_0x8ed5('0x69')]){_0x199de3[_0x8ed5('0x65')]=_0x2c6ba2[_0x28720f][_0x8ed5('0x69')];}else if(_0x3ad9cf[_0x8ed5('0x66')]>_0x2c6ba2[_0x28720f][_0x8ed5('0x69')]&&_0x3ad9cf[_0x8ed5('0x66')]<=_0x2c6ba2[_0x28720f]['to']){_0x199de3[_0x8ed5('0x65')]=_0x3ad9cf[_0x8ed5('0x66')];}}}if(_['isNil'](_0x199de3['internal'])){_0x199de3[_0x8ed5('0x65')]=_0x1088d9+0x1;}return _0x2b0c58(_0x199de3);});});})['catch'](function(_0x352ccc){_0x200394(_0x352ccc);});});}function updateUser(_0x3e74b4){return new Promise(function(_0x42213b,_0x55bb01){try{if(_0x3e74b4[_0x8ed5('0x6a')]){_0x3e74b4[_0x8ed5('0x6b')]=_0x3e74b4['internal'];_0x3e74b4[_0x8ed5('0x6c')]={'mailbox':_0x3e74b4[_0x8ed5('0x65')],'password':_0x3e74b4[_0x8ed5('0x3b')],'fullname':_0x3e74b4['fullname'],'email':_0x3e74b4[_0x8ed5('0x6d')]};}if(_0x3e74b4['role']===_0x8ed5('0x28')){if(!_0x3e74b4['permissions'])_0x3e74b4[_0x8ed5('0x6e')]=[_0x8ed5('0x6f'),_0x8ed5('0x70'),_0x8ed5('0x71'),_0x8ed5('0x72'),_0x8ed5('0x73'),'104','105',_0x8ed5('0x74'),_0x8ed5('0x75'),_0x8ed5('0x76'),_0x8ed5('0x77'),_0x8ed5('0x78'),_0x8ed5('0x79'),_0x8ed5('0x7a'),_0x8ed5('0x7b')];}_0x42213b(_0x3e74b4);}catch(_0x53e362){_0x55bb01(_0x53e362);}});}exports['create']=function(_0x2ddb83,_0x490ad1){if(_0x2ddb83[_0x8ed5('0x7c')]['role']==='agent')throw new Error('Unauthorized');if(_0x2ddb83[_0x8ed5('0x5b')]['role']===_0x8ed5('0x7c')&&_0x2ddb83[_0x8ed5('0x7c')][_0x8ed5('0x32')]!==_0x8ed5('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2ddb83[_0x8ed5('0x5b')][_0x8ed5('0x32')]===_0x8ed5('0x2b')&&_0x2ddb83[_0x8ed5('0x7c')][_0x8ed5('0x32')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x8ed5('0x7d')]([_0x2ddb83[_0x8ed5('0x5b')]])[_0x8ed5('0x16')](function(){return validateUser(_0x2ddb83[_0x8ed5('0x5b')]);})['then'](function(_0x1c5999){return updateUser(_0x1c5999)[_0x8ed5('0x16')](function(_0x471ae4){if(_0x471ae4[_0x8ed5('0x32')]===_0x8ed5('0x2b')){_0x471ae4[_0x8ed5('0x7e')]=_0x2ddb83[_0x8ed5('0x7c')]['settingsEnabled'];delete _0x471ae4['userProfileId'];}return _0x471ae4;});})[_0x8ed5('0x16')](function(_0x5cd2c3){return db[_0x8ed5('0x37')][_0x8ed5('0x7f')](_0x5cd2c3,{'include':[{'model':db[_0x8ed5('0x6c')],'as':_0x8ed5('0x6c')}]});})[_0x8ed5('0x16')](function(_0x246878){if(_0x2ddb83['body'][_0x8ed5('0x32')]==='user')return _0x246878;if(_0x2ddb83[_0x8ed5('0x7c')]['role']!==_0x8ed5('0x7c'))return _0x246878;return db[_0x8ed5('0x80')]['find']({'where':{'name':_0x246878[_0x8ed5('0x32')]===_0x8ed5('0x28')?_0x8ed5('0x81'):_0x8ed5('0x82'),'userProfileId':_0x2ddb83[_0x8ed5('0x7c')][_0x8ed5('0x83')]},'raw':!![]})[_0x8ed5('0x16')](function(_0x1a2a44){if(!_0x1a2a44||_0x1a2a44[_0x8ed5('0x84')]!=0x0)return _0x246878;return db[_0x8ed5('0x33')][_0x8ed5('0x7f')]({'name':_0x246878[_0x8ed5('0x34')],'resourceId':_0x246878['id'],'type':_0x1a2a44['name'],'sectionId':_0x1a2a44['id']},{})[_0x8ed5('0x16')](function(){return _0x246878;});})[_0x8ed5('0x1e')](function(_0x1d848b){logger[_0x8ed5('0x1c')](_0x8ed5('0x85'),_0x1d848b);throw _0x1d848b;});})[_0x8ed5('0x16')](respondWithResult(_0x490ad1,0xc9))[_0x8ed5('0x1e')](handleError(_0x490ad1,null));};exports['bulkCreate']=function(_0x1ddb67,_0x160a1c){var _0x1f8a54=_0x1ddb67[_0x8ed5('0x5b')];var _0x216ba8=[];if(_0x1ddb67[_0x8ed5('0x7c')][_0x8ed5('0x32')]===_0x8ed5('0x28'))throw new Error('Unauthorized');if(_['some'](_0x1f8a54,[_0x8ed5('0x32'),_0x8ed5('0x7c')])&&_0x1ddb67['user'][_0x8ed5('0x32')]!==_0x8ed5('0x2b')){throw new Error(_0x8ed5('0x86'));}if(_['some'](_0x1f8a54,[_0x8ed5('0x32'),_0x8ed5('0x2b')])&&_0x1ddb67[_0x8ed5('0x7c')][_0x8ed5('0x32')]!==_0x8ed5('0x2b')){throw new Error(_0x8ed5('0x87'));}return licenseUtil['checkUserLimits'](_0x1f8a54)[_0x8ed5('0x16')](function(){return validateUser(_0x1f8a54[0x0]);})[_0x8ed5('0x16')](function(){for(var _0x4f303f=0x1;_0x4f303f<_0x1f8a54[_0x8ed5('0x49')];_0x4f303f++){var _0x2c1893=_0x1f8a54[_0x4f303f-0x1][_0x8ed5('0x65')];if(!_0x1f8a54[_0x4f303f]['internal'])_0x1f8a54[_0x4f303f][_0x8ed5('0x65')]=_0x2c1893+0x1;_0x216ba8[_0x8ed5('0x44')](validateUser(_0x1f8a54[_0x4f303f]));}return Promise[_0x8ed5('0x5a')](_0x216ba8);})[_0x8ed5('0x16')](function(){_0x216ba8=[];for(var _0x566a37=0x0;_0x566a37<_0x1f8a54[_0x8ed5('0x49')];_0x566a37++){_0x216ba8[_0x8ed5('0x44')](updateUser(_0x1f8a54[_0x566a37]));}return Promise[_0x8ed5('0x5a')](_0x216ba8);})[_0x8ed5('0x16')](function(){_0x216ba8=_0x1f8a54['map'](function(_0x29afbf){return db[_0x8ed5('0x37')][_0x8ed5('0x7f')](_0x29afbf,{'include':[{'model':db['VoiceMail'],'as':_0x8ed5('0x6c')}]})['then'](function(_0x118681){_0x29afbf['id']=_0x118681['id'];return _0x29afbf;});});return Promise['all'](_0x216ba8);})[_0x8ed5('0x16')](function(_0x590500){if(_0x1ddb67[_0x8ed5('0x5b')][_0x8ed5('0x32')]===_0x8ed5('0x7c'))return _0x590500;if(_0x1ddb67[_0x8ed5('0x7c')][_0x8ed5('0x32')]!==_0x8ed5('0x7c'))return _0x590500;var _0x3590f4=_[_0x8ed5('0x88')](_0x590500,function(_0x4d5b5e){return _0x4d5b5e[_0x8ed5('0x32')]===_0x8ed5('0x28')||_0x4d5b5e['role']===_0x8ed5('0x89');});if(!_0x3590f4)return _0x590500;return db[_0x8ed5('0x80')][_0x8ed5('0x45')]({'where':{'name':{'$or':[_0x8ed5('0x81'),_0x8ed5('0x82')]},'userProfileId':_0x1ddb67[_0x8ed5('0x7c')][_0x8ed5('0x83')]},'raw':!![]})['then'](function(_0x3d33e7){if(_[_0x8ed5('0x8a')](_0x3d33e7)||!_[_0x8ed5('0x88')](_0x3d33e7,[_0x8ed5('0x84'),0x0]))return _0x590500;_0x216ba8=[];var _0x575876=_(_0x3d33e7)[_0x8ed5('0x2e')](function(_0x230062){if(_0x230062[_0x8ed5('0x84')]===0x1)return;return _0x230062[_0x8ed5('0x34')]===_0x8ed5('0x81')?'agent':_0x8ed5('0x89');})['compact']()[_0x8ed5('0x2f')]();for(var _0x2d3308=0x0;_0x2d3308<_0x590500[_0x8ed5('0x49')];_0x2d3308++){if(!_[_0x8ed5('0x30')](_0x575876,_0x590500[_0x2d3308][_0x8ed5('0x32')]))return;var _0x390485=_0x590500[_0x2d3308][_0x8ed5('0x32')]==='agent'?_0x8ed5('0x81'):_0x8ed5('0x82');_0x216ba8['push'](db[_0x8ed5('0x33')][_0x8ed5('0x7f')]({'name':_0x590500[_0x2d3308][_0x8ed5('0x34')],'resourceId':_0x590500[_0x2d3308]['id'],'type':_0x390485,'sectionId':_[_0x8ed5('0x31')](_0x3d33e7,['name',_0x390485])['id']},{}));}return Promise[_0x8ed5('0x5a')](_0x216ba8);});})[_0x8ed5('0x16')](respondWithResult(_0x160a1c,0xc9))[_0x8ed5('0x1e')](handleError(_0x160a1c,null));};exports[_0x8ed5('0x8b')]=function(_0x553204,_0x35a15f){if(_0x553204['body']['id']){delete _0x553204['body']['id'];}return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x553204[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](function(_0x1e89fb){if(!_0x1e89fb)return null;if(_0x1e89fb['id']===_0x553204['user']['id']){if(!_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8d')]||!_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')]){throw new db[(_0x8ed5('0x8f'))]['ValidationError'](_0x8ed5('0x90'));}if(!_0x1e89fb['authenticate'](_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8d')])){throw new db[(_0x8ed5('0x8f'))][(_0x8ed5('0x91'))](_0x8ed5('0x92'));}if(_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8d')]===_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')]){throw new db[(_0x8ed5('0x8f'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x553204[_0x8ed5('0x7c')][_0x8ed5('0x32')]===_0x8ed5('0x2b')){if(!_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')]){throw new db[(_0x8ed5('0x8f'))]['ValidationError'](_0x8ed5('0x93'));}}else if(_0x553204[_0x8ed5('0x7c')]['role']==='user'){if(!_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')]){throw new db[(_0x8ed5('0x8f'))][(_0x8ed5('0x91'))](_0x8ed5('0x93'));}if(_0x1e89fb[_0x8ed5('0x32')]!==_0x8ed5('0x28')){throw new db[(_0x8ed5('0x8f'))][(_0x8ed5('0x91'))](_0x8ed5('0x94'));}}else{throw new db[(_0x8ed5('0x8f'))][(_0x8ed5('0x91'))](_0x8ed5('0x94'));}return _0x1e89fb;})['then'](handleEntityNotFound(_0x35a15f,null))[_0x8ed5('0x16')](function(_0x2d7c36){return db[_0x8ed5('0x60')][_0x8ed5('0x95')]({'attributes':['id',_0x8ed5('0x62'),_0x8ed5('0x96'),_0x8ed5('0x97')]})['then'](function(_0x210db9){if(_0x210db9[_0x8ed5('0x62')])authService['validatePasswordPattern'](_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')]);if(!_0x210db9[_0x8ed5('0x96')]||!_0x2d7c36[_0x8ed5('0x98')])return _0x2d7c36;authService[_0x8ed5('0x99')](_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')],_0x2d7c36['previousPasswords'],_0x210db9[_0x8ed5('0x97')]);return _0x2d7c36;})[_0x8ed5('0x16')](saveUpdates({'password':_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')],'passwordResetAt':_0x553204[_0x8ed5('0x7c')]['id']==_0x553204['params']['id']?moment():null,'previousPasswords':authService[_0x8ed5('0x9a')](_0x553204[_0x8ed5('0x5b')][_0x8ed5('0x8e')],_0x2d7c36[_0x8ed5('0x98')])},null));})['then'](respondWithResult(_0x35a15f,null))[_0x8ed5('0x1e')](handleError(_0x35a15f,null));};exports[_0x8ed5('0x9b')]=function(_0x1fadc3,_0x88b720){var _0x1aa083=_0x1fadc3[_0x8ed5('0x5b')][_0x8ed5('0x9c')];return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x1fadc3[_0x8ed5('0x8c')]['id']},'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x32'),'online','loginInPause','voicePause',_0x8ed5('0x9d')]})[_0x8ed5('0x16')](handleEntityNotFound(_0x88b720,null))[_0x8ed5('0x16')](function(_0x4f53b2){if(_0x4f53b2){if(!utils[_0x8ed5('0x9e')](_0x1aa083)){throw new db['Sequelize'][(_0x8ed5('0x91'))](_0x8ed5('0x9f'));}return _0x4f53b2[_0x8ed5('0xa0')+_[_0x8ed5('0xa1')](_0x1aa083['toLowerCase']())+_0x8ed5('0xa2')](_0x1fadc3[_0x8ed5('0x5b')][_0x8ed5('0x5e')],{'penalty':_0x1fadc3[_0x8ed5('0x5b')]['penalty']||0x0})['spread'](function(_0x389e24){for(var _0x2954c4=0x0;_0x2954c4<_0x1fadc3[_0x8ed5('0x5b')]['ids'][_0x8ed5('0x49')];_0x2954c4+=0x1){var _0x3da900={'UserId':Number(_0x1fadc3[_0x8ed5('0x8c')]['id'])};_0x3da900[_['capitalize'](_0x1aa083[_0x8ed5('0xa3')]())+_0x8ed5('0xa4')]=Number(_0x1fadc3['body']['ids'][_0x2954c4]);socket[_0x8ed5('0xa5')](_0x8ed5('0x7c')+_[_0x8ed5('0xa1')](_0x1aa083['toLowerCase']())+_0x8ed5('0xa6'),_0x3da900);}return _0x389e24;})[_0x8ed5('0x16')](function(){if(_0x1aa083===_0x8ed5('0xa7')){return db[_0x8ed5('0xa8')][_0x8ed5('0x45')]({'where':{'id':_0x1fadc3[_0x8ed5('0x5b')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x8ed5('0x16')](function(_0x53ca63){var _0x2bc72f=_0x4f53b2[_0x8ed5('0x2a')]({'plain':!![]});var _0x2469c1=[];if(_0x1aa083==='voice'&&_0x2bc72f[_0x8ed5('0x32')]==='agent'&&_0x2bc72f[_0x8ed5('0xa9')]){for(let _0x198022=0x0;_0x198022<_0x53ca63[_0x8ed5('0x49')];_0x198022+=0x1){_0x2469c1[_0x8ed5('0x44')]({'membername':_0x2bc72f[_0x8ed5('0x34')],'UserId':_0x2bc72f['id'],'queue_name':_0x53ca63[_0x198022][_0x8ed5('0x34')],'VoiceQueueId':_0x53ca63[_0x198022]['id'],'interface':_['isNil'](_0x2bc72f['interface'])?util['format'](_0x8ed5('0xaa'),_0x2bc72f['name']):_0x2bc72f['interface'],'paused':_0x2bc72f[_0x8ed5('0xab')]||![],'penalty':_0x1fadc3[_0x8ed5('0x5b')][_0x8ed5('0xac')]||0x0});}return Promise[_0x8ed5('0x5a')](_0x2469c1[_0x8ed5('0x2e')](function(_0x2bed93){return db[_0x8ed5('0xad')]['upsert'](_0x2bed93);}));}return _0x4f53b2;});}})[_0x8ed5('0x16')](respondWithStatusCode(_0x88b720,null))[_0x8ed5('0x1e')](handleError(_0x88b720,null));};exports[_0x8ed5('0xae')]=function(_0x80507e,_0x4fa380){var _0x4ce1ef,_0x5932fa;return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x80507e[_0x8ed5('0x8c')]['id']},'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x32')]})[_0x8ed5('0x16')](handleEntityNotFound(_0x4fa380,null))[_0x8ed5('0x16')](function(_0x3f0616){if(_0x3f0616){_0x4ce1ef=_0x3f0616;if(!_0x80507e['query'][_0x8ed5('0x9c')]||!utils['isValidChannel'](_0x80507e[_0x8ed5('0x3e')][_0x8ed5('0x9c')])){throw new db[(_0x8ed5('0x8f'))]['ValidationError'](_0x8ed5('0x9f'));}return _0x3f0616[_0x8ed5('0xaf')+_[_0x8ed5('0xa1')](_0x80507e[_0x8ed5('0x3e')]['channel'][_0x8ed5('0xa3')]())+_0x8ed5('0xa2')](_0x80507e[_0x8ed5('0x3e')][_0x8ed5('0x5e')]);}})[_0x8ed5('0x16')](function(_0x3750e6){if(_[_0x8ed5('0xb0')](_0x80507e[_0x8ed5('0x3e')][_0x8ed5('0x5e')])){for(var _0x340e59=0x0;_0x340e59<_0x80507e[_0x8ed5('0x3e')][_0x8ed5('0x5e')]['length'];_0x340e59+=0x1){_0x5932fa={'UserId':Number(_0x80507e['params']['id'])};_0x5932fa[_['capitalize'](_0x80507e['query'][_0x8ed5('0x9c')][_0x8ed5('0xa3')]())+_0x8ed5('0xa4')]=Number(_0x80507e['query'][_0x8ed5('0x5e')][_0x340e59]);socket[_0x8ed5('0xa5')]('user'+_[_0x8ed5('0xa1')](_0x80507e['query'][_0x8ed5('0x9c')][_0x8ed5('0xa3')]())+_0x8ed5('0xb1'),_0x5932fa);}}else{_0x5932fa={'UserId':Number(_0x80507e['params']['id'])};_0x5932fa[_['capitalize'](_0x80507e['query'][_0x8ed5('0x9c')]['toLowerCase']())+_0x8ed5('0xa4')]=Number(_0x80507e[_0x8ed5('0x3e')]['ids']);socket[_0x8ed5('0xa5')](_0x8ed5('0x7c')+_['capitalize'](_0x80507e[_0x8ed5('0x3e')][_0x8ed5('0x9c')][_0x8ed5('0xa3')]())+_0x8ed5('0xb1'),_0x5932fa);}return _0x3750e6;})['then'](function(){if(_0x80507e['query'][_0x8ed5('0x9c')]===_0x8ed5('0xa7')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x80507e[_0x8ed5('0x8c')]['id'],'VoiceQueueId':_0x80507e[_0x8ed5('0x3e')]['ids']},'individualHooks':!![]})[_0x8ed5('0x16')](function(){return _0x4ce1ef;});}return _0x4ce1ef;})[_0x8ed5('0x16')](respondWithStatusCode(_0x4fa380,null))['catch'](handleError(_0x4fa380,null));};exports[_0x8ed5('0xb2')]=function(_0x23a2a3,_0x45c057){_0x23a2a3[_0x8ed5('0x5b')][_0x8ed5('0xb3')]=_0x23a2a3[_0x8ed5('0xb4')]['filename'];return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x23a2a3[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x45c057,null))['then'](saveUpdates(_0x23a2a3[_0x8ed5('0x5b')],null))[_0x8ed5('0x16')](respondWithResult(_0x45c057,null))[_0x8ed5('0x1e')](handleError(_0x45c057,null));};exports['getAvatar']=function(_0x2939eb,_0xe514cf){var _0x26caae=path[_0x8ed5('0xb5')](config[_0x8ed5('0xb6')],_0x8ed5('0xb7'));return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x2939eb['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8ed5('0x16')](handleEntityNotFound(_0xe514cf,null))[_0x8ed5('0x16')](function(_0x5b924a){if(_0x5b924a){if(_[_0x8ed5('0xb8')](_0x5b924a['userpic'])){return _0xe514cf[_0x8ed5('0xb9')](_0x26caae);}else{if(!fs[_0x8ed5('0xba')](path[_0x8ed5('0xb5')](config[_0x8ed5('0xb6')],_0x8ed5('0xbb'),_0x5b924a['userpic']))){return _0xe514cf[_0x8ed5('0xb9')](_0x26caae);}return _0xe514cf['download'](path['join'](config[_0x8ed5('0xb6')],_0x8ed5('0xbb'),_0x5b924a[_0x8ed5('0xb3')]));}}})[_0x8ed5('0x1e')](handleError(_0xe514cf,null));};exports['getOpenTabs']=function(_0x4d4135,_0x3be51d){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x4d4135[_0x8ed5('0x8c')]['id']},'attributes':['id']})[_0x8ed5('0x16')](handleEntityNotFound(_0x3be51d,null))['then'](function(_0x10b1ec){var _0x56e6f7=[];values=_0x10b1ec[_0x8ed5('0x4a')];_0x56e6f7['push'](get_open_tabs(_0x8ed5('0x58'),_0x10b1ec['dataValues']));_0x56e6f7['push'](get_open_tabs(_0x8ed5('0x4b'),_0x10b1ec[_0x8ed5('0x4a')]));_0x56e6f7[_0x8ed5('0x44')](get_open_tabs('openchannel',_0x10b1ec['dataValues']));_0x56e6f7[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0x4d'),_0x10b1ec[_0x8ed5('0x4a')]));_0x56e6f7[_0x8ed5('0x44')](get_open_tabs(_0x8ed5('0xbc'),_0x10b1ec[_0x8ed5('0x4a')]));_0x56e6f7['push'](get_open_tabs(_0x8ed5('0x4c'),_0x10b1ec['dataValues']));return Promise[_0x8ed5('0x5a')](_0x56e6f7);})[_0x8ed5('0x16')](function(_0x566c49){if(_0x566c49){var _0x322360=_['map'](values[_0x8ed5('0xbd')],function(_0x5521b8){return{'channel':_0x8ed5('0xbe'),'id':_0x5521b8['id'],'createdAt':_0x5521b8[_0x8ed5('0xbf')]};});var _0x14c9a6=_[_0x8ed5('0x2e')](values[_0x8ed5('0xc0')],function(_0x19754c){return{'channel':_0x8ed5('0xc1'),'id':_0x19754c['id'],'createdAt':_0x19754c[_0x8ed5('0xbf')]};});var _0x593b27=_[_0x8ed5('0x2e')](values[_0x8ed5('0xc2')],function(_0x5deba2){return{'channel':_0x8ed5('0xc3'),'id':_0x5deba2['id'],'createdAt':_0x5deba2['createdAt']};});var _0x2da9f2=_[_0x8ed5('0x2e')](values[_0x8ed5('0xc4')],function(_0x595a61){return{'channel':_0x8ed5('0xc5'),'id':_0x595a61['id'],'createdAt':_0x595a61[_0x8ed5('0xbf')]};});var _0x1cd212=_[_0x8ed5('0x2e')](values[_0x8ed5('0xc6')],function(_0x45c97f){return{'channel':'SMS','id':_0x45c97f['id'],'createdAt':_0x45c97f[_0x8ed5('0xbf')]};});var _0x15d973=_['map'](values[_0x8ed5('0xc7')],function(_0x4937c2){return{'channel':_0x8ed5('0xc8'),'id':_0x4937c2['id'],'createdAt':_0x4937c2[_0x8ed5('0xbf')]};});var _0x3195f0=_[_0x8ed5('0xc9')](_0x322360,_0x14c9a6,_0x593b27,_0x2da9f2,_0x1cd212,_0x15d973);var _0x27823d={'count':_0x3195f0[_0x8ed5('0x49')],'rows':_0x3195f0};return _0x27823d;}else return null;})['then'](respondWithResult(_0x3be51d,null))['catch'](handleError(_0x3be51d,null));};exports[_0x8ed5('0xca')]=function(_0x5899c7,_0x1ce5f5){var _0x2ae36b={};var _0x372efa={};var _0x11c6e0;var _0x3c3666;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x5899c7[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x1ce5f5,null))[_0x8ed5('0x16')](function(_0x2774fb){if(_0x2774fb){_0x11c6e0=_0x2774fb;_0x372efa[_0x8ed5('0x54')]=_['keys'](db[_0x8ed5('0xcb')][_0x8ed5('0x50')]);_0x372efa['query']=_[_0x8ed5('0x4f')](_0x5899c7['query']);_0x372efa[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x372efa[_0x8ed5('0x54')],_0x372efa['query']);_0x2ae36b[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x372efa['model'],qs['fields'](_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x2ae36b[_0x8ed5('0x43')]=_0x2ae36b[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x2ae36b[_0x8ed5('0x43')]:_0x372efa[_0x8ed5('0x54')];_0x2ae36b[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x5899c7['query'][_0x8ed5('0xcd')]);_0x2ae36b[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_['pick'](_0x5899c7[_0x8ed5('0x3e')],_0x372efa[_0x8ed5('0x52')]));if(_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x2ae36b[_0x8ed5('0x3d')]=_['merge'](_0x2ae36b['where'],{'$or':_[_0x8ed5('0x2e')](_0x2ae36b['attributes'],function(_0x8bd467){var _0x1d7686={};_0x1d7686[_0x8bd467]={'$like':'%'+_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x1d7686;})});}_0x2ae36b=_['merge']({},_0x2ae36b,_0x5899c7[_0x8ed5('0x57')]);return _0x11c6e0['getContacts'](_0x2ae36b);}})[_0x8ed5('0x16')](function(_0x183124){if(_0x183124){_0x3c3666=_0x183124['length'];if(_0x5899c7['query'][_0x8ed5('0xce')](_0x8ed5('0x3f'))){_0x2ae36b[_0x8ed5('0x40')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x8ed5('0xcf')],'as':_0x8ed5('0xd0'),'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0xd1')],'where':_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0xd2')]?{'id':_0x5899c7[_0x8ed5('0x3e')]['tag']}:undefined,'required':_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0xd2')]?!![]:![]}];}if(!_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0xce')]('nolimit')){_0x2ae36b['limit']=qs[_0x8ed5('0x22')](_0x5899c7[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x2ae36b['offset']=qs[_0x8ed5('0x24')](_0x5899c7['query']['offset']);}return _0x11c6e0['getContacts'](_0x2ae36b);}})[_0x8ed5('0x16')](function(_0x3d0060){if(_0x3d0060){return _0x3d0060?{'count':_0x3c3666,'rows':_0x3d0060}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x1ce5f5,null))[_0x8ed5('0x1e')](handleError(_0x1ce5f5,null));};exports[_0x8ed5('0xd3')]=function(_0x1ee914,_0x39375a){var _0x5f3ec7;var _0x2bc08c={};var _0x1d6be2;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x1ee914[_0x8ed5('0x8c')]['id']},'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x32')]})[_0x8ed5('0x16')](handleEntityNotFound(_0x39375a,null))[_0x8ed5('0x16')](function(_0x5ada1b){if(!utils[_0x8ed5('0x9e')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x9c')])){throw new db[(_0x8ed5('0x8f'))][(_0x8ed5('0x91'))](_0x8ed5('0x9f'));}_0x5f3ec7=_0x5ada1b;var _0x37dbf7={};_0x37dbf7[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_[_0x8ed5('0xa1')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x9c')])+'Queue'][_0x8ed5('0x50')]);_0x37dbf7[_0x8ed5('0x3e')]=_['keys'](_0x1ee914[_0x8ed5('0x3e')]);_0x37dbf7[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x37dbf7['model'],_0x37dbf7[_0x8ed5('0x3e')]);_0x2bc08c[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x37dbf7[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x2bc08c['attributes']=_0x2bc08c[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x2bc08c['attributes']:_0x37dbf7[_0x8ed5('0x54')];_0x2bc08c[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x2bc08c[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x1ee914['query'],_0x37dbf7[_0x8ed5('0x52')]));if(_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x2bc08c[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x2bc08c[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x2bc08c[_0x8ed5('0x43')],function(_0x5238c7){var _0x4c43cd={};_0x4c43cd[_0x5238c7]={'$like':'%'+_0x1ee914['query']['filter']+'%'};return _0x4c43cd;})});}_0x2bc08c=_[_0x8ed5('0x56')]({},_0x2bc08c,_0x1ee914['options']);switch(_0x5f3ec7[_0x8ed5('0x32')]){case'admin':return db[_[_0x8ed5('0xa1')](_0x1ee914['query'][_0x8ed5('0x9c')])+_0x8ed5('0xd5')][_0x8ed5('0x45')](_0x2bc08c);case _0x8ed5('0x7c'):case'agent':return _0x5f3ec7[_0x8ed5('0x2a')+_[_0x8ed5('0xa1')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x9c')])+_0x8ed5('0xa2')](_0x2bc08c);default:throw new db[(_0x8ed5('0x8f'))][(_0x8ed5('0x91'))](_0x8ed5('0xd6'));}})['then'](function(_0x52150a){_0x1d6be2=_0x52150a[_0x8ed5('0x49')];if(!_0x1ee914['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x2bc08c[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x2bc08c[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}switch(_0x5f3ec7['role']){case _0x8ed5('0x2b'):return db[_[_0x8ed5('0xa1')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x9c')])+'Queue']['findAll'](_0x2bc08c);case _0x8ed5('0x7c'):case _0x8ed5('0x28'):return _0x5f3ec7[_0x8ed5('0x2a')+_[_0x8ed5('0xa1')](_0x1ee914[_0x8ed5('0x3e')][_0x8ed5('0x9c')])+'Queues'](_0x2bc08c);}})[_0x8ed5('0x16')](function(_0x194a0c){return{'count':_0x1d6be2,'rows':_0x194a0c};})['then'](respondWithResult(_0x39375a,null))[_0x8ed5('0x1e')](handleError(_0x39375a,null));};exports[_0x8ed5('0xd8')]=function(_0x11f9af,_0x54919c){var _0x8b9c5a={};var _0x816035={};var _0x4fcdef;var _0x21f773;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x11f9af['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x54919c,null))[_0x8ed5('0x16')](function(_0x878c1e){if(_0x878c1e){_0x4fcdef=_0x878c1e;_0x816035[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0xad')][_0x8ed5('0x50')]);_0x816035[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x11f9af[_0x8ed5('0x3e')]);_0x816035[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x816035['model'],_0x816035['query']);_0x8b9c5a['attributes']=_[_0x8ed5('0x53')](_0x816035[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x11f9af[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x8b9c5a[_0x8ed5('0x43')]=_0x8b9c5a['attributes'][_0x8ed5('0x49')]?_0x8b9c5a[_0x8ed5('0x43')]:_0x816035[_0x8ed5('0x54')];_0x8b9c5a[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x11f9af[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x8b9c5a[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x11f9af[_0x8ed5('0x3e')],_0x816035[_0x8ed5('0x52')]));if(_0x11f9af[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x8b9c5a[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x8b9c5a[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x8b9c5a[_0x8ed5('0x43')],function(_0x234e46){var _0x25b026={};_0x25b026[_0x234e46]={'$like':'%'+_0x11f9af['query'][_0x8ed5('0x2d')]+'%'};return _0x25b026;})});}_0x8b9c5a=_[_0x8ed5('0x56')]({},_0x8b9c5a,_0x11f9af[_0x8ed5('0x57')]);return _0x4fcdef[_0x8ed5('0xd8')](_0x8b9c5a);}})[_0x8ed5('0x16')](function(_0x410f38){if(_0x410f38){_0x21f773=_0x410f38['length'];if(!_0x11f9af[_0x8ed5('0x3e')][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x8b9c5a[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x11f9af[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x8b9c5a[_0x8ed5('0x24')]=qs['offset'](_0x11f9af[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x4fcdef[_0x8ed5('0xd8')](_0x8b9c5a);}})[_0x8ed5('0x16')](function(_0x492b7e){if(_0x492b7e){return _0x492b7e?{'count':_0x21f773,'rows':_0x492b7e}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x54919c,null))[_0x8ed5('0x1e')](handleError(_0x54919c,null));};exports[_0x8ed5('0xd9')]=function(_0x464ffd,_0x416634){var _0x44864c={};var _0x100a4a={};var _0x5ea8f2;var _0x3264bc;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x464ffd[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x416634,null))[_0x8ed5('0x16')](function(_0x567ea5){if(_0x567ea5){_0x5ea8f2=_0x567ea5;_0x100a4a[_0x8ed5('0x54')]=_['keys'](db[_0x8ed5('0xda')][_0x8ed5('0x50')]);_0x100a4a['query']=_[_0x8ed5('0x4f')](_0x464ffd[_0x8ed5('0x3e')]);_0x100a4a['filters']=_['intersection'](_0x100a4a[_0x8ed5('0x54')],_0x100a4a['query']);_0x44864c[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x100a4a[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x464ffd['query']['fields']));_0x44864c[_0x8ed5('0x43')]=_0x44864c[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x44864c[_0x8ed5('0x43')]:_0x100a4a['model'];_0x44864c['order']=qs[_0x8ed5('0xcd')](_0x464ffd[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x44864c[_0x8ed5('0x3d')]=qs['filters'](_[_0x8ed5('0xd4')](_0x464ffd['query'],_0x100a4a['filters']));if(_0x464ffd[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x44864c[_0x8ed5('0x3d')]=_['merge'](_0x44864c[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x44864c[_0x8ed5('0x43')],function(_0x769716){var _0x5ed7ce={};_0x5ed7ce[_0x769716]={'$like':'%'+_0x464ffd[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x5ed7ce;})});}_0x44864c=_[_0x8ed5('0x56')]({},_0x44864c,_0x464ffd[_0x8ed5('0x57')]);return _0x5ea8f2[_0x8ed5('0xd9')](_0x44864c);}})[_0x8ed5('0x16')](function(_0x4638c2){if(_0x4638c2){_0x3264bc=_0x4638c2[_0x8ed5('0x49')];if(!_0x464ffd[_0x8ed5('0x3e')]['hasOwnProperty'](_0x8ed5('0xd7'))){_0x44864c['limit']=qs[_0x8ed5('0x22')](_0x464ffd[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x44864c[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x464ffd['query'][_0x8ed5('0x24')]);}return _0x5ea8f2[_0x8ed5('0xd9')](_0x44864c);}})[_0x8ed5('0x16')](function(_0x334029){if(_0x334029){return _0x334029?{'count':_0x3264bc,'rows':_0x334029}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x416634,null))['catch'](handleError(_0x416634,null));};exports[_0x8ed5('0xdb')]=function(_0x5841b8,_0x18d7bf){var _0x1cf85c={'raw':!![],'where':{}};var _0x196096={};var _0x2da655={'count':0x0,'rows':[]};return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x5841b8[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x18d7bf,null))['then'](function(_0x12c99e){if(_0x12c99e){_0x196096['model']=_['keys'](db[_0x8ed5('0xdc')][_0x8ed5('0x50')]);_0x196096[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x5841b8[_0x8ed5('0x3e')]);_0x196096[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x196096['model'],_0x196096[_0x8ed5('0x3e')]);_0x1cf85c[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x196096[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x5841b8[_0x8ed5('0x3e')]['fields']));_0x1cf85c[_0x8ed5('0x43')]=_0x1cf85c[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x1cf85c[_0x8ed5('0x43')]:_0x196096['model'];if(!_0x5841b8['query'][_0x8ed5('0xce')]('nolimit')){_0x1cf85c['limit']=qs[_0x8ed5('0x22')](_0x5841b8[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x1cf85c[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x5841b8['query'][_0x8ed5('0x24')]);}_0x1cf85c['order']=qs[_0x8ed5('0xcd')](_0x5841b8[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x1cf85c[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x5841b8['query'],_0x196096[_0x8ed5('0x52')]));_0x1cf85c[_0x8ed5('0x3d')]['UserId']=_0x12c99e['id'];if(_0x5841b8[_0x8ed5('0x3e')]['filter']){_0x1cf85c['where']=_['merge'](_0x1cf85c[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x1cf85c[_0x8ed5('0x43')],function(_0xa74b78){var _0x4ea666={};_0x4ea666[_0xa74b78]={'$like':'%'+_0x5841b8[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x4ea666;})});}_0x1cf85c=_[_0x8ed5('0x56')]({},_0x1cf85c,_0x5841b8[_0x8ed5('0x57')]);return db[_0x8ed5('0xdc')][_0x8ed5('0x23')]({'where':_0x1cf85c[_0x8ed5('0x3d')]})[_0x8ed5('0x16')](function(_0xcb8433){_0x2da655[_0x8ed5('0x23')]=_0xcb8433;if(_0x5841b8['query'][_0x8ed5('0x3f')]){_0x1cf85c[_0x8ed5('0x40')]=[{'all':!![]}];}return db['VoiceRecording'][_0x8ed5('0x45')](_0x1cf85c);})[_0x8ed5('0x16')](function(_0x4bc723){_0x2da655['rows']=_0x4bc723;return _0x2da655;});}})[_0x8ed5('0x16')](respondWithFilteredResult(_0x18d7bf,_0x1cf85c))[_0x8ed5('0x1e')](handleError(_0x18d7bf,null));};exports['getScreenRecordings']=function(_0x443496,_0x35ed00){var _0x240d39={'raw':!![],'where':{}};var _0x41213d={};var _0x28ab08={'count':0x0,'rows':[]};return db[_0x8ed5('0x37')]['findOne']({'where':{'id':_0x443496[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x35ed00,null))[_0x8ed5('0x16')](function(_0x3c54f4){if(_0x3c54f4){_0x41213d[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0xdd')][_0x8ed5('0x50')]);_0x41213d[_0x8ed5('0x3e')]=_['keys'](_0x443496[_0x8ed5('0x3e')]);_0x41213d[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x41213d[_0x8ed5('0x54')],_0x41213d[_0x8ed5('0x3e')]);_0x240d39[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x41213d['model'],qs['fields'](_0x443496[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x240d39[_0x8ed5('0x43')]=_0x240d39[_0x8ed5('0x43')]['length']?_0x240d39['attributes']:_0x41213d[_0x8ed5('0x54')];if(!_0x443496[_0x8ed5('0x3e')][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x240d39[_0x8ed5('0x22')]=qs['limit'](_0x443496['query']['limit']);_0x240d39['offset']=qs[_0x8ed5('0x24')](_0x443496[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}_0x240d39[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x443496[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x240d39[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_['pick'](_0x443496[_0x8ed5('0x3e')],_0x41213d[_0x8ed5('0x52')]));_0x240d39[_0x8ed5('0x3d')][_0x8ed5('0xde')]=_0x3c54f4['id'];if(_0x443496[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x240d39[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x240d39[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x240d39[_0x8ed5('0x43')],function(_0xfbe05e){var _0x584933={};_0x584933[_0xfbe05e]={'$like':'%'+_0x443496[_0x8ed5('0x3e')]['filter']+'%'};return _0x584933;})});}_0x240d39=_[_0x8ed5('0x56')]({},_0x240d39,_0x443496['options']);return db[_0x8ed5('0xdd')][_0x8ed5('0x23')]({'where':_0x240d39['where']})['then'](function(_0x19e497){_0x28ab08[_0x8ed5('0x23')]=_0x19e497;if(_0x443496[_0x8ed5('0x3e')][_0x8ed5('0x3f')]){_0x240d39[_0x8ed5('0x40')]=[{'all':!![]}];}return db[_0x8ed5('0xdd')]['findAll'](_0x240d39);})[_0x8ed5('0x16')](function(_0x40f231){_0x28ab08[_0x8ed5('0x46')]=_0x40f231;return _0x28ab08;});}})[_0x8ed5('0x16')](respondWithFilteredResult(_0x35ed00,_0x240d39))['catch'](handleError(_0x35ed00,null));};exports[_0x8ed5('0xdf')]=function(_0x4cbbf5,_0x218938){var _0x1967d7={};var _0x13feee={};var _0x542c61;var _0x1dfe62;return db[_0x8ed5('0x37')]['findOne']({'where':{'id':_0x4cbbf5[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x218938,null))[_0x8ed5('0x16')](function(_0xdb33ff){if(_0xdb33ff){_0x542c61=_0xdb33ff;_0x13feee[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0xe0')][_0x8ed5('0x50')]);_0x13feee[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x4cbbf5['query']);_0x13feee[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x13feee[_0x8ed5('0x54')],_0x13feee['query']);_0x1967d7[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x13feee[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x4cbbf5[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x1967d7[_0x8ed5('0x43')]=_0x1967d7[_0x8ed5('0x43')]['length']?_0x1967d7[_0x8ed5('0x43')]:_0x13feee[_0x8ed5('0x54')];_0x1967d7[_0x8ed5('0xcc')]=qs['sort'](_0x4cbbf5['query'][_0x8ed5('0xcd')]);_0x1967d7['where']=qs[_0x8ed5('0x52')](_['pick'](_0x4cbbf5['query'],_0x13feee[_0x8ed5('0x52')]));if(_0x4cbbf5[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x1967d7[_0x8ed5('0x3d')]=_['merge'](_0x1967d7[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x1967d7[_0x8ed5('0x43')],function(_0x373b76){var _0xa6afec={};_0xa6afec[_0x373b76]={'$like':'%'+_0x4cbbf5[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0xa6afec;})});}_0x1967d7=_[_0x8ed5('0x56')]({},_0x1967d7,_0x4cbbf5[_0x8ed5('0x57')]);return _0x542c61[_0x8ed5('0xdf')](_0x1967d7);}})[_0x8ed5('0x16')](function(_0x519f53){if(_0x519f53){_0x1dfe62=_0x519f53[_0x8ed5('0x49')];if(!_0x4cbbf5['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x1967d7['limit']=qs['limit'](_0x4cbbf5[_0x8ed5('0x3e')]['limit']);_0x1967d7['offset']=qs[_0x8ed5('0x24')](_0x4cbbf5[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x542c61[_0x8ed5('0xdf')](_0x1967d7);}})[_0x8ed5('0x16')](function(_0x338548){if(_0x338548){return _0x338548?{'count':_0x1dfe62,'rows':_0x338548}:null;}})['then'](respondWithResult(_0x218938,null))['catch'](handleError(_0x218938,null));};exports[_0x8ed5('0xe1')]=function(_0x29d8b0,_0x45eac0){var _0x1caae2={};var _0x147d66={};var _0x445d3c;var _0x317883;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x29d8b0['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x45eac0,null))[_0x8ed5('0x16')](function(_0x575e71){if(_0x575e71){_0x445d3c=_0x575e71;_0x147d66[_0x8ed5('0x54')]=_['keys'](db['OpenchannelInteraction'][_0x8ed5('0x50')]);_0x147d66[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x29d8b0['query']);_0x147d66[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x147d66[_0x8ed5('0x54')],_0x147d66['query']);_0x1caae2['attributes']=_[_0x8ed5('0x53')](_0x147d66[_0x8ed5('0x54')],qs['fields'](_0x29d8b0['query'][_0x8ed5('0x55')]));_0x1caae2[_0x8ed5('0x43')]=_0x1caae2[_0x8ed5('0x43')]['length']?_0x1caae2[_0x8ed5('0x43')]:_0x147d66[_0x8ed5('0x54')];_0x1caae2[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x29d8b0[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x1caae2[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x29d8b0['query'],_0x147d66[_0x8ed5('0x52')]));if(_0x29d8b0[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x1caae2[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x1caae2[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x1caae2['attributes'],function(_0x957f08){var _0x3ad873={};_0x3ad873[_0x957f08]={'$like':'%'+_0x29d8b0['query']['filter']+'%'};return _0x3ad873;})});}_0x1caae2=_[_0x8ed5('0x56')]({},_0x1caae2,_0x29d8b0[_0x8ed5('0x57')]);return _0x445d3c[_0x8ed5('0xe1')](_0x1caae2);}})['then'](function(_0x24b861){if(_0x24b861){_0x317883=_0x24b861[_0x8ed5('0x49')];if(!_0x29d8b0['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x1caae2[_0x8ed5('0x22')]=qs['limit'](_0x29d8b0[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x1caae2[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x29d8b0['query'][_0x8ed5('0x24')]);}return _0x445d3c[_0x8ed5('0xe1')](_0x1caae2);}})[_0x8ed5('0x16')](function(_0x4a7996){if(_0x4a7996){return _0x4a7996?{'count':_0x317883,'rows':_0x4a7996}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x45eac0,null))['catch'](handleError(_0x45eac0,null));};exports['getMailInteractions']=function(_0x5b285d,_0xfe5803){var _0x24a5a0={'raw':!![],'where':{}};var _0x1abc4d={};var _0x4789bc={'count':0x0,'rows':[]};return db[_0x8ed5('0x37')]['findOne']({'where':{'id':_0x5b285d[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0xfe5803,null))[_0x8ed5('0x16')](function(_0x1b6090){if(_0x1b6090){_0x1abc4d['model']=_[_0x8ed5('0x4f')](db['MailInteraction'][_0x8ed5('0x50')]);_0x1abc4d[_0x8ed5('0x3e')]=_['keys'](_0x5b285d[_0x8ed5('0x3e')]);_0x1abc4d[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x1abc4d[_0x8ed5('0x54')],_0x1abc4d['query']);_0x24a5a0[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x1abc4d[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x5b285d['query'][_0x8ed5('0x55')]));_0x24a5a0[_0x8ed5('0x43')]=_0x24a5a0[_0x8ed5('0x43')]['length']?_0x24a5a0[_0x8ed5('0x43')]:_0x1abc4d[_0x8ed5('0x54')];if(!_0x5b285d['query']['hasOwnProperty']('nolimit')){_0x24a5a0['limit']=qs[_0x8ed5('0x22')](_0x5b285d[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x24a5a0[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x5b285d['query']['offset']);}_0x24a5a0[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x5b285d[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x24a5a0[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_['pick'](_0x5b285d['query'],_0x1abc4d[_0x8ed5('0x52')]));_0x24a5a0[_0x8ed5('0x3d')]['UserId']=_0x1b6090['id'];if(_0x5b285d[_0x8ed5('0x3e')]['filter']){_0x24a5a0[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x24a5a0['where'],{'$or':_[_0x8ed5('0x2e')](_0x24a5a0[_0x8ed5('0x43')],function(_0x247ee1){var _0x3c1c13={};_0x3c1c13[_0x247ee1]={'$like':'%'+_0x5b285d['query'][_0x8ed5('0x2d')]+'%'};return _0x3c1c13;})});}_0x24a5a0=_['merge']({},_0x24a5a0,_0x5b285d[_0x8ed5('0x57')]);return db[_0x8ed5('0xe2')][_0x8ed5('0x23')]({'where':_0x24a5a0[_0x8ed5('0x3d')]})['then'](function(_0x138580){_0x4789bc[_0x8ed5('0x23')]=_0x138580;if(_0x5b285d[_0x8ed5('0x3e')][_0x8ed5('0x3f')]){_0x24a5a0[_0x8ed5('0x40')]=[{'all':!![]}];}return db['MailInteraction'][_0x8ed5('0x45')](_0x24a5a0);})[_0x8ed5('0x16')](function(_0x4b32c4){_0x4789bc[_0x8ed5('0x46')]=_0x4b32c4;return _0x4789bc;});}})[_0x8ed5('0x16')](respondWithFilteredResult(_0xfe5803,_0x24a5a0))[_0x8ed5('0x1e')](handleError(_0xfe5803,null));};exports[_0x8ed5('0xe3')]=function(_0x38c43a,_0x1f8cff){var _0x22bb11={};var _0x4f4bb5={};var _0x2f2dcc;var _0x24edf4;return db[_0x8ed5('0x37')]['findOne']({'where':{'id':_0x38c43a[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x1f8cff,null))['then'](function(_0x2583b8){if(_0x2583b8){_0x2f2dcc=_0x2583b8;_0x4f4bb5['model']=_[_0x8ed5('0x4f')](db[_0x8ed5('0xe4')]['rawAttributes']);_0x4f4bb5[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x38c43a[_0x8ed5('0x3e')]);_0x4f4bb5[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x4f4bb5['model'],_0x4f4bb5[_0x8ed5('0x3e')]);_0x22bb11[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x4f4bb5[_0x8ed5('0x54')],qs['fields'](_0x38c43a[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x22bb11[_0x8ed5('0x43')]=_0x22bb11[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x22bb11[_0x8ed5('0x43')]:_0x4f4bb5[_0x8ed5('0x54')];_0x22bb11[_0x8ed5('0xcc')]=qs['sort'](_0x38c43a[_0x8ed5('0x3e')]['sort']);_0x22bb11[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_['pick'](_0x38c43a[_0x8ed5('0x3e')],_0x4f4bb5[_0x8ed5('0x52')]));if(_0x38c43a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x22bb11[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x22bb11[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x22bb11[_0x8ed5('0x43')],function(_0x4f11e5){var _0x4efef9={};_0x4efef9[_0x4f11e5]={'$like':'%'+_0x38c43a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x4efef9;})});}_0x22bb11=_['merge']({},_0x22bb11,_0x38c43a[_0x8ed5('0x57')]);return _0x2f2dcc[_0x8ed5('0xe3')](_0x22bb11);}})[_0x8ed5('0x16')](function(_0x1cbe77){if(_0x1cbe77){_0x24edf4=_0x1cbe77['length'];if(!_0x38c43a['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x22bb11[_0x8ed5('0x22')]=qs['limit'](_0x38c43a['query'][_0x8ed5('0x22')]);_0x22bb11[_0x8ed5('0x24')]=qs['offset'](_0x38c43a[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x2f2dcc[_0x8ed5('0xe3')](_0x22bb11);}})['then'](function(_0x4c573f){if(_0x4c573f){return _0x4c573f?{'count':_0x24edf4,'rows':_0x4c573f}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x1f8cff,null))[_0x8ed5('0x1e')](handleError(_0x1f8cff,null));};exports['getFaxInteractions']=function(_0x16bb6c,_0x52993c){var _0x52d2b7={};var _0xa4ca4b={};var _0x151f75;var _0x255303;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x16bb6c['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x52993c,null))[_0x8ed5('0x16')](function(_0x13cf56){if(_0x13cf56){_0x151f75=_0x13cf56;_0xa4ca4b['model']=_[_0x8ed5('0x4f')](db[_0x8ed5('0xe5')][_0x8ed5('0x50')]);_0xa4ca4b[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x16bb6c['query']);_0xa4ca4b[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0xa4ca4b[_0x8ed5('0x54')],_0xa4ca4b[_0x8ed5('0x3e')]);_0x52d2b7[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0xa4ca4b['model'],qs['fields'](_0x16bb6c[_0x8ed5('0x3e')]['fields']));_0x52d2b7[_0x8ed5('0x43')]=_0x52d2b7['attributes']['length']?_0x52d2b7[_0x8ed5('0x43')]:_0xa4ca4b[_0x8ed5('0x54')];_0x52d2b7['order']=qs[_0x8ed5('0xcd')](_0x16bb6c[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x52d2b7[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_['pick'](_0x16bb6c[_0x8ed5('0x3e')],_0xa4ca4b['filters']));if(_0x16bb6c[_0x8ed5('0x3e')]['filter']){_0x52d2b7[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x52d2b7[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x52d2b7[_0x8ed5('0x43')],function(_0xfd5762){var _0xa53598={};_0xa53598[_0xfd5762]={'$like':'%'+_0x16bb6c['query']['filter']+'%'};return _0xa53598;})});}_0x52d2b7=_[_0x8ed5('0x56')]({},_0x52d2b7,_0x16bb6c['options']);return _0x151f75[_0x8ed5('0xe6')](_0x52d2b7);}})[_0x8ed5('0x16')](function(_0x7f544d){if(_0x7f544d){_0x255303=_0x7f544d[_0x8ed5('0x49')];if(!_0x16bb6c[_0x8ed5('0x3e')]['hasOwnProperty'](_0x8ed5('0xd7'))){_0x52d2b7['limit']=qs[_0x8ed5('0x22')](_0x16bb6c[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x52d2b7['offset']=qs[_0x8ed5('0x24')](_0x16bb6c[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x151f75[_0x8ed5('0xe6')](_0x52d2b7);}})['then'](function(_0x500ee4){if(_0x500ee4){return _0x500ee4?{'count':_0x255303,'rows':_0x500ee4}:null;}})['then'](respondWithResult(_0x52993c,null))[_0x8ed5('0x1e')](handleError(_0x52993c,null));};exports['getWhatsappInteractions']=function(_0x57f419,_0xe20a3a){var _0x265f75={};var _0x407d32={};var _0x33b47e;var _0x59aaa6;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x57f419['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0xe20a3a,null))[_0x8ed5('0x16')](function(_0x152269){if(_0x152269){_0x33b47e=_0x152269;_0x407d32[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0xe7')][_0x8ed5('0x50')]);_0x407d32['query']=_[_0x8ed5('0x4f')](_0x57f419['query']);_0x407d32[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x407d32['model'],_0x407d32[_0x8ed5('0x3e')]);_0x265f75['attributes']=_[_0x8ed5('0x53')](_0x407d32[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x57f419[_0x8ed5('0x3e')]['fields']));_0x265f75[_0x8ed5('0x43')]=_0x265f75[_0x8ed5('0x43')]['length']?_0x265f75[_0x8ed5('0x43')]:_0x407d32[_0x8ed5('0x54')];_0x265f75['order']=qs[_0x8ed5('0xcd')](_0x57f419['query'][_0x8ed5('0xcd')]);_0x265f75[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x57f419[_0x8ed5('0x3e')],_0x407d32[_0x8ed5('0x52')]));if(_0x57f419[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x265f75['where']=_['merge'](_0x265f75[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x265f75[_0x8ed5('0x43')],function(_0x3a7ff2){var _0x1a34fe={};_0x1a34fe[_0x3a7ff2]={'$like':'%'+_0x57f419[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x1a34fe;})});}_0x265f75=_[_0x8ed5('0x56')]({},_0x265f75,_0x57f419[_0x8ed5('0x57')]);return _0x33b47e['getWhatsappInteractions'](_0x265f75);}})['then'](function(_0x39886f){if(_0x39886f){_0x59aaa6=_0x39886f['length'];if(!_0x57f419[_0x8ed5('0x3e')][_0x8ed5('0xce')]('nolimit')){_0x265f75[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x57f419[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x265f75[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x57f419['query']['offset']);}return _0x33b47e[_0x8ed5('0xe8')](_0x265f75);}})['then'](function(_0x3b2d30){if(_0x3b2d30){return _0x3b2d30?{'count':_0x59aaa6,'rows':_0x3b2d30}:null;}})['then'](respondWithResult(_0xe20a3a,null))[_0x8ed5('0x1e')](handleError(_0xe20a3a,null));};exports[_0x8ed5('0xe9')]=function(_0x2ee176,_0x1491c1,_0x341b96){var _0x28b325;var _0x504c9c;var _0x23ecd8;var _0x200afd=!_[_0x8ed5('0xb8')](_0x2ee176['params']['id'])?_0x2ee176['params']['id']:!_['isNil'](_0x2ee176['user']['id'])?_0x2ee176['user']['id']:null;return db[_0x8ed5('0x37')]['find']({'where':{'id':_0x200afd,'role':{'$or':['admin','user',_0x8ed5('0x28')]}},'attributes':['id','name',_0x8ed5('0xea'),_0x8ed5('0xeb'),_0x8ed5('0x32'),_0x8ed5('0x65'),_0x8ed5('0xec')]})[_0x8ed5('0x16')](function(_0x5bd4e0){if(_0x5bd4e0){if(_0x5bd4e0[_0x8ed5('0x32')]===_0x8ed5('0x28')){_0x28b325=_0x5bd4e0;if(_0x2ee176['body']['interface']){_0x23ecd8=util['format'](_0x8ed5('0xed'),_0x28b325[_0x2ee176[_0x8ed5('0x5b')][_0x8ed5('0x9d')]]);}else if(_0x2ee176[_0x8ed5('0x5b')][_0x8ed5('0xee')]){_0x23ecd8=util[_0x8ed5('0xef')](_0x8ed5('0xaa'),_0x2ee176['body'][_0x8ed5('0xee')]);}else{_0x23ecd8=util[_0x8ed5('0xef')]('SIP/%s',_0x28b325[_0x8ed5('0x34')]);}socket['to'](util['format'](_0x8ed5('0xf0'),_0x28b325[_0x8ed5('0x34')]))[_0x8ed5('0xa5')](_0x8ed5('0xf1'),{'user':{'id':_0x28b325['id'],'name':_0x28b325[_0x8ed5('0x34')]},'ip':_0x2ee176[_0x8ed5('0xf2')][_0x8ed5('0xf3')]||_0x2ee176[_0x8ed5('0xf4')][_0x8ed5('0xf5')]||_0x2ee176[_0x8ed5('0xf6')]['remoteAddress']||_0x2ee176[_0x8ed5('0xf4')][_0x8ed5('0xf6')][_0x8ed5('0xf5')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x28b325[_0x8ed5('0x34')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x8ed5('0x91'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x8ed5('0x16')](function(){if(_0x28b325){return _0x28b325[_0x8ed5('0xf7')]({'raw':!![]});}})[_0x8ed5('0x16')](function(_0x5d3a71){if(_0x28b325){if(_0x5d3a71){_0x504c9c=_0x5d3a71;if(_0x504c9c[_0x8ed5('0x49')]){var _0xbcf73f=_0x504c9c[_0x8ed5('0x2e')](function(_0x29f25c){var _0x305317={'membername':_0x28b325[_0x8ed5('0x34')],'UserId':_0x28b325['id'],'queue_name':_0x29f25c[_0x8ed5('0x34')],'VoiceQueueId':_0x29f25c['id'],'interface':_0x23ecd8,'paused':_0x28b325['loginInPause']||![],'penalty':_0x29f25c[_0x8ed5('0xf8')]||0x0};return db[_0x8ed5('0xad')][_0x8ed5('0xf9')](_0x305317);});return Promise['all'](_0xbcf73f);}}}})[_0x8ed5('0x16')](function(){if(_0x28b325){return db[_0x8ed5('0xfa')][_0x8ed5('0x45')]({'where':{'membername':_0x28b325[_0x8ed5('0x34')],'exitAt':null}});}})[_0x8ed5('0x16')](function(_0x1de2d0){if(_0x28b325){var _0x1e8517=[];_0x1de2d0[_0x8ed5('0xfb')](function(_0x5a2ef6){_0x1e8517[_0x8ed5('0x44')](_0x5a2ef6[_0x8ed5('0xfc')]({'exitAt':moment()[_0x8ed5('0xef')](_0x8ed5('0xfd'))}));});return Promise[_0x8ed5('0x5a')](_0x1e8517);}})[_0x8ed5('0x16')](function(){if(_0x28b325){var _0x5c8476=[];var _0x5a80d6=[];var _0x46c62a=utils['getChannels']();var _0x10f742={'membername':_0x28b325[_0x8ed5('0x34')],'interface':_0x23ecd8,'enterAt':moment()['format'](_0x8ed5('0xfd')),'role':_0x28b325[_0x8ed5('0x32')],'internal':_0x28b325['internal']};_0x46c62a[_0x8ed5('0xfb')](function(_0x1c1764){_0x5c8476[_0x8ed5('0x44')](_['merge']({'channel':_0x1c1764,'type':_0x8ed5('0xfe'),'data1':_0x2ee176[_0x8ed5('0x5b')][_0x8ed5('0xff')],'data2':_0x23ecd8},_0x10f742));if(_0x28b325[_0x8ed5('0xec')]){_0x5a80d6[_0x8ed5('0x44')](_[_0x8ed5('0x56')]({'channel':_0x1c1764,'type':_0x8ed5('0x100'),'data1':_0x8ed5('0x101')},_0x10f742));}});return db[_0x8ed5('0xfa')][_0x8ed5('0x102')](_0x5c8476[_0x8ed5('0xc9')](_0x5a80d6),{'individualHooks':!![]});}})[_0x8ed5('0x16')](function(){if(_0x28b325){return _0x28b325[_0x8ed5('0xfc')]({'online':!![],'lastLoginAt':moment()['format'](_0x8ed5('0xfd')),'voicePause':_0x28b325[_0x8ed5('0xec')]||![],'mailPause':_0x28b325['loginInPause']||![],'chatPause':_0x28b325[_0x8ed5('0xec')]||![],'faxPause':_0x28b325[_0x8ed5('0xec')]||![],'smsPause':_0x28b325[_0x8ed5('0xec')]||![],'openchannelPause':_0x28b325[_0x8ed5('0xec')]||![],'whatsappPause':_0x28b325['loginInPause']||![],'pauseType':_0x28b325[_0x8ed5('0xec')]?'LOGININPAUSE':null,'interface':_0x23ecd8,'lastPauseAt':moment()['format'](_0x8ed5('0xfd'))});}})[_0x8ed5('0x16')](function(_0x448290){if(_0x2ee176[_0x8ed5('0x103')]){return _0x341b96();}else{return Promise[_0x8ed5('0x104')](_0x448290)[_0x8ed5('0x16')](respondWithResult(_0x1491c1,null));}})[_0x8ed5('0x1e')](handleError(_0x1491c1,null));};exports[_0x8ed5('0x105')]=function(_0x483482,_0x4965ce){var _0x9fb17;return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x483482[_0x8ed5('0x8c')]['id'],'role':'agent'},'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x32')]})['then'](handleEntityNotFound(_0x4965ce,null))[_0x8ed5('0x16')](function(_0x53cdbe){if(_0x53cdbe){_0x9fb17=_0x53cdbe;return db[_0x8ed5('0xad')][_0x8ed5('0x29')]({'where':{'membername':_0x9fb17[_0x8ed5('0x34')]},'individualHooks':!![]});}})[_0x8ed5('0x16')](function(){return db[_0x8ed5('0xfa')][_0x8ed5('0x45')]({'where':{'membername':_0x9fb17[_0x8ed5('0x34')],'exitAt':null}});})[_0x8ed5('0x16')](function(_0x32fa34){var _0x29478c=[];_0x32fa34[_0x8ed5('0xfb')](function(_0x9e7044){_0x29478c[_0x8ed5('0x44')](_0x9e7044[_0x8ed5('0xfc')]({'exitAt':moment()[_0x8ed5('0xef')](_0x8ed5('0xfd'))}));});return Promise[_0x8ed5('0x5a')](_0x29478c);})[_0x8ed5('0x16')](function(){return _0x9fb17['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8ed5('0x16')](respondWithResult(_0x4965ce,null))[_0x8ed5('0x1e')](handleError(_0x4965ce,null));};exports[_0x8ed5('0x106')]=function(_0x16c2da,_0x5e8749){var _0x9f04c0;return db[_0x8ed5('0xad')][_0x8ed5('0xfc')]({'paused':0x1},{'where':{'UserId':_0x16c2da[_0x8ed5('0x8c')]['id']},'individualHooks':!![]})[_0x8ed5('0x16')](function(){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x16c2da[_0x8ed5('0x8c')]['id'],'role':_0x8ed5('0x28')},'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x32'),_0x8ed5('0x65'),_0x8ed5('0x9d'),_0x8ed5('0xa9')]});})[_0x8ed5('0x16')](handleEntityNotFound(_0x5e8749,null))[_0x8ed5('0x16')](function(_0x132003){if(_0x132003){_0x9f04c0=_0x132003;return respondWithRpcPromise('QueuePause',_0x8ed5('0x106'),{'id':_0x9f04c0['id'],'name':_0x9f04c0['name'],'pause':!![]});}})['then'](function(){if(_0x9f04c0){return db[_0x8ed5('0xfa')][_0x8ed5('0x45')]({'where':{'membername':_0x9f04c0[_0x8ed5('0x34')],'type':_0x8ed5('0x100'),'exitAt':null}});}})[_0x8ed5('0x16')](function(_0x3dbe13){if(_0x3dbe13[_0x8ed5('0x49')]){var _0xff0410=moment()['format'](_0x8ed5('0xfd'));for(var _0x1cbfce=0x0,_0x3d6a8d=_0x3dbe13['length'];_0x1cbfce<_0x3d6a8d;_0x1cbfce++){_0x3dbe13[_0x1cbfce][_0x8ed5('0x107')]({'exitAt':_0xff0410});}}})[_0x8ed5('0x16')](function(){var _0x4d5b19=[];var _0x52b1b5=utils[_0x8ed5('0x108')]();_0x52b1b5[_0x8ed5('0xfb')](function(_0x1b51cd){_0x4d5b19[_0x8ed5('0x44')]({'channel':_0x1b51cd,'membername':_0x9f04c0[_0x8ed5('0x34')],'interface':_[_0x8ed5('0xb8')](_0x9f04c0[_0x8ed5('0x9d')])?util['format'](_0x8ed5('0xaa'),_0x9f04c0[_0x8ed5('0x34')]):_0x9f04c0[_0x8ed5('0x9d')],'type':_0x8ed5('0x100'),'enterAt':moment()[_0x8ed5('0xef')](_0x8ed5('0xfd')),'data1':_0x16c2da[_0x8ed5('0x5b')][_0x8ed5('0x39')]||_0x8ed5('0x109'),'role':_0x9f04c0[_0x8ed5('0x32')],'internal':_0x9f04c0[_0x8ed5('0x65')]});});return db[_0x8ed5('0xfa')][_0x8ed5('0x102')](_0x4d5b19,{'individualHooks':!![]});})[_0x8ed5('0x16')](function(){return _0x9f04c0[_0x8ed5('0xfc')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x16c2da[_0x8ed5('0x5b')][_0x8ed5('0x39')]||_0x8ed5('0x109'),'lastPauseAt':moment()[_0x8ed5('0xef')](_0x8ed5('0xfd'))});})[_0x8ed5('0x16')](respondWithResult(_0x5e8749,null))[_0x8ed5('0x1e')](handleError(_0x5e8749,null));};exports['unpause']=function(_0x3d4fe4,_0x33f7f5){if(_0x3d4fe4[_0x8ed5('0x5b')][_0x8ed5('0x9c')]&&!utils[_0x8ed5('0x9e')](_0x3d4fe4[_0x8ed5('0x5b')][_0x8ed5('0x9c')])){throw new APIBadRequestError(util[_0x8ed5('0xef')](_0x8ed5('0x10a'),_0x3d4fe4['body'][_0x8ed5('0x9c')]));}return db[_0x8ed5('0x37')]['find']({'where':{'id':_0x3d4fe4['params']['id']},'attributes':['id',_0x8ed5('0x34'),'role',_0x8ed5('0x65'),_0x8ed5('0x9d'),'online',_0x8ed5('0xab'),'mailPause',_0x8ed5('0x10b'),'faxPause',_0x8ed5('0x10c'),_0x8ed5('0x10d'),'whatsappPause',_0x8ed5('0x10e'),_0x8ed5('0x10f')]})['then'](function(_0x5ad996){if(!_0x5ad996){throw new APINotFoundError(util[_0x8ed5('0xef')](_0x8ed5('0x110'),_0x3d4fe4['params']['id']));}return _0x5ad996[_0x8ed5('0x111')](_0x3d4fe4[_0x8ed5('0x5b')][_0x8ed5('0x9c')]);})[_0x8ed5('0x16')](respondWithResult(_0x33f7f5,null))[_0x8ed5('0x1e')](APIHandleError(_0x33f7f5));};exports[_0x8ed5('0x112')]=function(_0x393548,_0x69ac11){var _0x3549c4={};var _0xc5c3e6={};var _0x353197;var _0x5c99c1;return db[_0x8ed5('0x37')]['findOne']({'where':{'id':_0x393548[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x69ac11,null))[_0x8ed5('0x16')](function(_0x5eace2){if(_0x5eace2){_0x353197=_0x5eace2;_0xc5c3e6[_0x8ed5('0x54')]=_['keys'](db[_0x8ed5('0x113')][_0x8ed5('0x50')]);_0xc5c3e6['query']=_[_0x8ed5('0x4f')](_0x393548['query']);_0xc5c3e6[_0x8ed5('0x52')]=_['intersection'](_0xc5c3e6[_0x8ed5('0x54')],_0xc5c3e6[_0x8ed5('0x3e')]);_0x3549c4[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0xc5c3e6[_0x8ed5('0x54')],qs['fields'](_0x393548['query'][_0x8ed5('0x55')]));_0x3549c4['attributes']=_0x3549c4[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x3549c4[_0x8ed5('0x43')]:_0xc5c3e6[_0x8ed5('0x54')];_0x3549c4['order']=qs[_0x8ed5('0xcd')](_0x393548[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x3549c4[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x393548[_0x8ed5('0x3e')],_0xc5c3e6[_0x8ed5('0x52')]));if(_0x393548[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x3549c4['where']=_[_0x8ed5('0x56')](_0x3549c4['where'],{'$or':_[_0x8ed5('0x2e')](_0x3549c4[_0x8ed5('0x43')],function(_0x2619de){var _0x4cb271={};_0x4cb271[_0x2619de]={'$like':'%'+_0x393548['query'][_0x8ed5('0x2d')]+'%'};return _0x4cb271;})});}_0x3549c4=_[_0x8ed5('0x56')]({},_0x3549c4,_0x393548[_0x8ed5('0x57')]);return _0x353197[_0x8ed5('0x112')](_0x3549c4);}})['then'](function(_0x2fc6e5){if(_0x2fc6e5){_0x5c99c1=_0x2fc6e5[_0x8ed5('0x49')];if(!_0x393548['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x3549c4['limit']=qs[_0x8ed5('0x22')](_0x393548[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x3549c4[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x393548[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x353197[_0x8ed5('0x112')](_0x3549c4);}})[_0x8ed5('0x16')](function(_0xa32633){if(_0xa32633){return _0xa32633?{'count':_0x5c99c1,'rows':_0xa32633}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x69ac11,null))[_0x8ed5('0x1e')](handleError(_0x69ac11,null));};exports[_0x8ed5('0x114')]=function(_0xd8aed9,_0x1a8ccc){var _0x4fd36c=_0xd8aed9[_0x8ed5('0x8c')]['id'];var _0x5ad0d6=_0xd8aed9['body']?_0xd8aed9[_0x8ed5('0x5b')]['ids']:null;var _0x485121=[];return Promise['resolve']()[_0x8ed5('0x16')](function(){if(!_0x5ad0d6)throw new APIBadRequestError(_0x8ed5('0x115'));})[_0x8ed5('0x16')](function(){return db['User']['findOne']({'where':{'id':_0x4fd36c}});})[_0x8ed5('0x16')](function(_0x3ce1c8){if(!_0x3ce1c8)throw new APINotFoundError(util[_0x8ed5('0xef')]('User\x20with\x20id\x20%s\x20not\x20found',_0xd8aed9[_0x8ed5('0x8c')]['id']));return db['sequelize'][_0x8ed5('0x116')](function(_0x26a020){return _0x3ce1c8[_0x8ed5('0x114')](_0x5ad0d6,{'transaction':_0x26a020})[_0x8ed5('0x16')](function(){return db[_0x8ed5('0x113')][_0x8ed5('0x45')]({'where':{'id':{'$in':_0x5ad0d6}}});})['then'](function(_0x4835f2){var _0x44d220=_[_0x8ed5('0x2e')](_0x4835f2,function(_0x31f19e){return _0x31f19e[_0x8ed5('0x117')]();});return Promise[_0x8ed5('0x5a')](_0x44d220);})[_0x8ed5('0x16')](function(_0x410786){_0x485121=_[_0x8ed5('0x118')](_0x410786);var _0x1170af=_[_0x8ed5('0x2e')](_0x485121,function(_0x2536b9){return _0x2536b9[_0x8ed5('0x119')](_0x3ce1c8['id'],{'transaction':_0x26a020});});return Promise[_0x8ed5('0x5a')](_0x1170af);})[_0x8ed5('0x16')](function(){if(!_0x3ce1c8['online'])return;var _0x62c697=_[_0x8ed5('0x2d')](_0x485121,function(_0x531ccf){return _0x531ccf[_0x8ed5('0x11a')](_0x8ed5('0x9c'))===_0x8ed5('0x11b');});var _0xb3db1c=_[_0x8ed5('0x2e')](_0x62c697,function(_0x7fe54e){return db[_0x8ed5('0xad')][_0x8ed5('0xf9')]({'membername':_0x3ce1c8[_0x8ed5('0x34')],'UserId':_0x3ce1c8['id'],'queue_name':_0x7fe54e['name'],'VoiceQueueId':_0x7fe54e['id'],'interface':_[_0x8ed5('0xb8')](_0x3ce1c8[_0x8ed5('0x9d')])?util[_0x8ed5('0xef')](_0x8ed5('0xaa'),_0x3ce1c8[_0x8ed5('0x34')]):_0x3ce1c8['interface'],'paused':_0x3ce1c8[_0x8ed5('0xab')]||![],'penalty':_0x3ce1c8['penalty']},{'transaction':_0x26a020});});return Promise[_0x8ed5('0x5a')](_0xb3db1c);})[_0x8ed5('0x16')](function(){return db[_0x8ed5('0x11c')][_0x8ed5('0x45')]({'where':{'teamId':{'$in':_0x5ad0d6}}});})[_0x8ed5('0x16')](function(_0x20705e){var _0x1d8010=_[_0x8ed5('0x2e')](_0x20705e,function(_0xc058d0){return db[_0x8ed5('0x11d')][_0x8ed5('0x7f')]({'UserId':_0x3ce1c8['id'],'VoicePrefixId':_0xc058d0['VoicePrefixId']},{'transaction':_0x26a020});});return Promise[_0x8ed5('0x5a')](_0x1d8010);});});})['then'](function(){for(var _0x31f96b=0x0;_0x31f96b<_0x485121[_0x8ed5('0x49')];_0x31f96b++){var _0x4f44f8=_0x485121[_0x31f96b]['getDataValue'](_0x8ed5('0x9c'));var _0x541f2e=_0x4f44f8+'QueueId';socket[_0x8ed5('0xa5')]('user'+_0x4f44f8+_0x8ed5('0xa6'),{'UserId':_0x4fd36c,['queueField']:_0x485121[_0x31f96b]['id']});}})[_0x8ed5('0x16')](respondWithStatusCode(_0x1a8ccc,null))[_0x8ed5('0x1e')](APIHandleError(_0x1a8ccc));};exports['removeTeams']=function(_0x33a7f3,_0x20b380){var _0x34269c=_0x33a7f3['params']['id'];var _0x532684=null;if(_0x33a7f3[_0x8ed5('0x3e')][_0x8ed5('0x5e')]){_0x532684=_[_0x8ed5('0xb0')](_0x33a7f3[_0x8ed5('0x3e')][_0x8ed5('0x5e')])?_0x33a7f3['query']['ids']:[_0x33a7f3[_0x8ed5('0x3e')][_0x8ed5('0x5e')]];}var _0x1827b1=[];return Promise[_0x8ed5('0x104')]()[_0x8ed5('0x16')](function(){if(!_0x532684)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x34269c}});})['then'](function(_0xed5fae){if(!_0xed5fae)throw new APINotFoundError(util[_0x8ed5('0xef')](_0x8ed5('0x110'),_0x33a7f3[_0x8ed5('0x8c')]['id']));return db[_0x8ed5('0x67')][_0x8ed5('0x116')](function(_0x44c3e1){return _0xed5fae[_0x8ed5('0x11e')](_0x532684,{'transaction':_0x44c3e1})['then'](function(){return db[_0x8ed5('0x113')]['findAll']({'where':{'id':{'$in':_0x532684}}});})[_0x8ed5('0x16')](function(_0x102add){var _0xa853a9=_[_0x8ed5('0x2e')](_0x102add,function(_0x1b7435){return _0x1b7435['getAssociatedQueues']();});return Promise[_0x8ed5('0x5a')](_0xa853a9);})[_0x8ed5('0x16')](function(_0x16c10d){_0x1827b1=_[_0x8ed5('0x118')](_0x16c10d);var _0x3cf8d7=_[_0x8ed5('0x2e')](_0x1827b1,function(_0x42c727){return _0x42c727['removeAgent'](_0xed5fae['id'],{'transaction':_0x44c3e1});});return Promise[_0x8ed5('0x5a')](_0x3cf8d7);})[_0x8ed5('0x16')](function(){if(!_0xed5fae['online'])return;var _0x322fcb=_[_0x8ed5('0x2d')](_0x1827b1,function(_0x43995b){return _0x43995b[_0x8ed5('0x11a')](_0x8ed5('0x9c'))==='Voice';});var _0x1da903=_[_0x8ed5('0x2e')](_0x322fcb,function(_0x57a759){return db[_0x8ed5('0xad')]['destroy']({'where':{'VoiceQueueId':_0x57a759['id'],'UserId':_0xed5fae['id']},'transaction':_0x44c3e1});});return Promise[_0x8ed5('0x5a')](_0x1da903);})[_0x8ed5('0x16')](function(){return db[_0x8ed5('0x11c')][_0x8ed5('0x45')]({'where':{'teamId':{'$in':_0x532684}}});})['then'](function(_0x524758){var _0x3aff5e=_[_0x8ed5('0x2e')](_0x524758,function(_0x214a12){return db[_0x8ed5('0x11d')][_0x8ed5('0x29')]({'where':{'UserId':_0xed5fae['id'],'VoicePrefixId':_0x214a12[_0x8ed5('0x11f')]}},{'transaction':_0x44c3e1});});return Promise[_0x8ed5('0x5a')](_0x3aff5e);});});})[_0x8ed5('0x16')](function(){for(var _0x2d5ae4=0x0;_0x2d5ae4<_0x1827b1[_0x8ed5('0x49')];_0x2d5ae4++){var _0x427bd3=_0x1827b1[_0x2d5ae4][_0x8ed5('0x11a')](_0x8ed5('0x9c'));var _0x130438=_0x427bd3+_0x8ed5('0xa4');socket[_0x8ed5('0xa5')](_0x8ed5('0x7c')+_0x427bd3+_0x8ed5('0xb1'),{'UserId':_0x34269c,['queueField']:_0x1827b1[_0x2d5ae4]['id']});}})[_0x8ed5('0x16')](respondWithStatusCode(_0x20b380,null))['catch'](APIHandleError(_0x20b380));};exports['getLists']=function(_0x12de5a,_0x5dbd7a){var _0x2227e4={};var _0x3efe3e={};var _0x5dbd6d;var _0x607f3e;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x12de5a['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x5dbd7a,null))[_0x8ed5('0x16')](function(_0x122e4c){if(_0x122e4c){_0x5dbd6d=_0x122e4c;_0x3efe3e[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0x120')][_0x8ed5('0x50')]);_0x3efe3e['query']=_['keys'](_0x12de5a[_0x8ed5('0x3e')]);_0x3efe3e[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x3efe3e['model'],_0x3efe3e[_0x8ed5('0x3e')]);_0x2227e4['attributes']=_[_0x8ed5('0x53')](_0x3efe3e[_0x8ed5('0x54')],qs['fields'](_0x12de5a[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x2227e4['attributes']=_0x2227e4[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x2227e4[_0x8ed5('0x43')]:_0x3efe3e['model'];_0x2227e4['order']=qs[_0x8ed5('0xcd')](_0x12de5a['query'][_0x8ed5('0xcd')]);_0x2227e4[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x12de5a[_0x8ed5('0x3e')],_0x3efe3e[_0x8ed5('0x52')]));if(_0x12de5a['query'][_0x8ed5('0x2d')]){_0x2227e4[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x2227e4['where'],{'$or':_['map'](_0x2227e4[_0x8ed5('0x43')],function(_0x4b0729){var _0x5bc702={};_0x5bc702[_0x4b0729]={'$like':'%'+_0x12de5a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x5bc702;})});}_0x2227e4=_[_0x8ed5('0x56')]({},_0x2227e4,_0x12de5a[_0x8ed5('0x57')]);return _0x5dbd6d['getLists'](_0x2227e4);}})[_0x8ed5('0x16')](function(_0x2e49b5){if(_0x2e49b5){_0x607f3e=_0x2e49b5[_0x8ed5('0x49')];if(!_0x12de5a[_0x8ed5('0x3e')]['hasOwnProperty'](_0x8ed5('0xd7'))){_0x2227e4[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x12de5a[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x2227e4[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x12de5a[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x5dbd6d[_0x8ed5('0x121')](_0x2227e4);}})['then'](function(_0xd72c67){if(_0xd72c67){return _0xd72c67?{'count':_0x607f3e,'rows':_0xd72c67}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x5dbd7a,null))[_0x8ed5('0x1e')](handleError(_0x5dbd7a,null));};exports[_0x8ed5('0x122')]=function(_0x360efd,_0x23ad12){var _0x2c9cec={};var _0x3222f4={};var _0x185418;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x360efd[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x23ad12,null))['then'](function(_0x458877){if(_0x458877){_0x185418=_0x458877;_0x3222f4[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0x37')][_0x8ed5('0x50')]);_0x3222f4[_0x8ed5('0x3e')]=_['keys'](_0x360efd[_0x8ed5('0x3e')]);_0x3222f4[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x3222f4[_0x8ed5('0x54')],_0x3222f4[_0x8ed5('0x3e')]);_0x2c9cec['attributes']=_[_0x8ed5('0x53')](_0x3222f4[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x360efd[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x2c9cec[_0x8ed5('0x43')]=_0x2c9cec[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x2c9cec[_0x8ed5('0x43')]:_0x3222f4['model'];_0x2c9cec[_0x8ed5('0xcc')]=qs['sort'](_0x360efd[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x2c9cec[_0x8ed5('0x3d')]=qs['filters'](_[_0x8ed5('0xd4')](_0x360efd[_0x8ed5('0x3e')],_0x3222f4[_0x8ed5('0x52')]));if(_0x360efd[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x2c9cec[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x2c9cec['where'],{'$or':_[_0x8ed5('0x2e')](_0x2c9cec['attributes'],function(_0xe96959){var _0x3af338={};_0x3af338[_0xe96959]={'$like':'%'+_0x360efd['query'][_0x8ed5('0x2d')]+'%'};return _0x3af338;})});}_0x2c9cec['model']=db[_0x8ed5('0x37')];_0x2c9cec['as']=_0x8ed5('0x81');_0x2c9cec=_[_0x8ed5('0x56')]({},_0x2c9cec,_0x360efd[_0x8ed5('0x57')]);return _0x185418['getVoiceQueues']({'include':[_0x2c9cec]});}})[_0x8ed5('0x16')](function(_0x171e32){if(_0x171e32){var _0x2ed943={},_0x2beb72=[];for(var _0x133d40=0x0;_0x133d40<_0x171e32['length'];_0x133d40+=0x1){for(var _0x26d249=0x0,_0x26d457;_0x26d249<_0x171e32[_0x133d40][_0x8ed5('0x81')][_0x8ed5('0x49')];_0x26d249+=0x1){_0x26d457=_0x171e32[_0x133d40][_0x8ed5('0x81')][_0x26d249][_0x8ed5('0x2a')]({'plain':!![]});_0x2ed943[_0x26d457['id']]=_0x26d457;}}_0x2ed943=_[_0x8ed5('0x123')](_0x2ed943);for(var _0x3bea37=qs[_0x8ed5('0x24')](_0x360efd['query'][_0x8ed5('0x24')]);_0x3bea37<_0x2ed943[_0x8ed5('0x49')]&&_0x2beb72['length']<qs[_0x8ed5('0x22')](_0x360efd[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x3bea37+=0x1){if(_0x2ed943[_0x3bea37]){_0x2beb72['push'](_0x2ed943[_0x3bea37]);}}return{'count':_0x2ed943[_0x8ed5('0x49')],'rows':_0x2beb72};}})[_0x8ed5('0x16')](respondWithResult(_0x23ad12,null))[_0x8ed5('0x1e')](handleError(_0x23ad12,null));};exports[_0x8ed5('0x29')]=function(_0x2ce3f1,_0x193482){if(_0x2ce3f1[_0x8ed5('0x7c')]['id']==_0x2ce3f1['params']['id']){return _0x193482[_0x8ed5('0x25')](0x1f4)[_0x8ed5('0x35')]({'message':'You\x20can\x27t\x20delete\x20yourself'});}return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x2ce3f1['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x193482,null))[_0x8ed5('0x16')](removeEntity(_0x193482,null))[_0x8ed5('0x1e')](handleError(_0x193482,null));};exports[_0x8ed5('0x124')]=function(_0x2815f6,_0x496a4b){return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x2815f6[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x496a4b,null))[_0x8ed5('0x16')](function(_0x2a14a3){if(_0x2a14a3){return _0x2a14a3[_0x8ed5('0x124')](_0x2815f6['body'][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x2815f6[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{})[_0x8ed5('0x125')](function(){for(var _0x3e7d22=0x0;_0x3e7d22<_0x2815f6[_0x8ed5('0x5b')]['ids'][_0x8ed5('0x49')];_0x3e7d22+=0x1){socket['emit'](_0x8ed5('0x126'),{'ChatInteractionId':Number(_0x2815f6[_0x8ed5('0x5b')]['ids'][_0x3e7d22]),'UserId':Number(_0x2815f6[_0x8ed5('0x8c')]['id'])});}return _0x2815f6[_0x8ed5('0x5b')][_0x8ed5('0x5e')];});}})['then'](respondWithResult(_0x496a4b,null))[_0x8ed5('0x1e')](handleError(_0x496a4b,null));};exports[_0x8ed5('0x127')]=function(_0x6eb4c5,_0x3a2ba7){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x6eb4c5[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x3a2ba7,null))[_0x8ed5('0x16')](function(_0x4b962b){if(_0x4b962b){return _0x4b962b[_0x8ed5('0x127')](_0x6eb4c5[_0x8ed5('0x3e')][_0x8ed5('0x5e')])['then'](function(){if(_[_0x8ed5('0xb0')](_0x6eb4c5['query'][_0x8ed5('0x5e')])){for(var _0x1d5ced=0x0;_0x1d5ced<_0x6eb4c5[_0x8ed5('0x3e')][_0x8ed5('0x5e')][_0x8ed5('0x49')];_0x1d5ced+=0x1){socket[_0x8ed5('0xa5')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6eb4c5[_0x8ed5('0x3e')]['ids'][_0x1d5ced]),'UserId':Number(_0x6eb4c5[_0x8ed5('0x8c')]['id'])});}}else{socket[_0x8ed5('0xa5')](_0x8ed5('0x128'),{'ChatInteractionId':Number(_0x6eb4c5[_0x8ed5('0x3e')][_0x8ed5('0x5e')]),'UserId':Number(_0x6eb4c5['params']['id'])});}});}})[_0x8ed5('0x16')](respondWithStatusCode(_0x3a2ba7,null))[_0x8ed5('0x1e')](handleError(_0x3a2ba7,null));};exports[_0x8ed5('0x129')]=function(_0x56e20d,_0x2da8e4){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x56e20d[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x2da8e4,null))['then'](function(_0x2dc777){if(_0x2dc777){return _0x2dc777[_0x8ed5('0x129')](_0x56e20d[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x56e20d['body'],['ids','id'])||{})[_0x8ed5('0x125')](function(){for(var _0x270f11=0x0;_0x270f11<_0x56e20d[_0x8ed5('0x5b')][_0x8ed5('0x5e')]['length'];_0x270f11+=0x1){socket[_0x8ed5('0xa5')](_0x8ed5('0x12a'),{'MailInteractionId':Number(_0x56e20d[_0x8ed5('0x5b')][_0x8ed5('0x5e')][_0x270f11]),'UserId':Number(_0x56e20d[_0x8ed5('0x8c')]['id'])});}return _0x56e20d[_0x8ed5('0x5b')]['ids'];});}})['then'](respondWithResult(_0x2da8e4,null))[_0x8ed5('0x1e')](handleError(_0x2da8e4,null));};exports['removeMailInteractions']=function(_0x5bf310,_0x10695e){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x5bf310[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x10695e,null))[_0x8ed5('0x16')](function(_0x5edacc){if(_0x5edacc){return _0x5edacc[_0x8ed5('0x12b')](_0x5bf310[_0x8ed5('0x3e')][_0x8ed5('0x5e')])[_0x8ed5('0x16')](function(){if(_['isArray'](_0x5bf310[_0x8ed5('0x3e')]['ids'])){for(var _0x3f0763=0x0;_0x3f0763<_0x5bf310[_0x8ed5('0x3e')][_0x8ed5('0x5e')]['length'];_0x3f0763+=0x1){socket[_0x8ed5('0xa5')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5bf310['query']['ids'][_0x3f0763]),'UserId':Number(_0x5bf310[_0x8ed5('0x8c')]['id'])});}}else{socket[_0x8ed5('0xa5')](_0x8ed5('0x12c'),{'MailInteractionId':Number(_0x5bf310[_0x8ed5('0x3e')][_0x8ed5('0x5e')]),'UserId':Number(_0x5bf310[_0x8ed5('0x8c')]['id'])});}});}})['then'](respondWithStatusCode(_0x10695e,null))[_0x8ed5('0x1e')](handleError(_0x10695e,null));};exports[_0x8ed5('0x12d')]=function(_0x4a2175,_0x88f621){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x4a2175[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x88f621,null))[_0x8ed5('0x16')](function(_0x486083){if(_0x486083){return _0x486083[_0x8ed5('0x12d')](_0x4a2175[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_['omit'](_0x4a2175[_0x8ed5('0x5b')],['ids','id'])||{})['spread'](function(){for(var _0x594490=0x0;_0x594490<_0x4a2175['body'][_0x8ed5('0x5e')][_0x8ed5('0x49')];_0x594490+=0x1){socket['emit'](_0x8ed5('0x12e'),{'FaxInteractionId':Number(_0x4a2175[_0x8ed5('0x5b')][_0x8ed5('0x5e')][_0x594490]),'UserId':Number(_0x4a2175['params']['id'])});}return _0x4a2175[_0x8ed5('0x5b')][_0x8ed5('0x5e')];});}})[_0x8ed5('0x16')](respondWithResult(_0x88f621,null))[_0x8ed5('0x1e')](handleError(_0x88f621,null));};exports[_0x8ed5('0x12f')]=function(_0x3ae117,_0x22624f){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x3ae117['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x22624f,null))[_0x8ed5('0x16')](function(_0x1dbed1){if(_0x1dbed1){return _0x1dbed1[_0x8ed5('0x12f')](_0x3ae117[_0x8ed5('0x3e')][_0x8ed5('0x5e')])[_0x8ed5('0x16')](function(){if(_[_0x8ed5('0xb0')](_0x3ae117[_0x8ed5('0x3e')]['ids'])){for(var _0x31ce7e=0x0;_0x31ce7e<_0x3ae117['query'][_0x8ed5('0x5e')]['length'];_0x31ce7e+=0x1){socket[_0x8ed5('0xa5')](_0x8ed5('0x130'),{'FaxInteractionId':Number(_0x3ae117['query'][_0x8ed5('0x5e')][_0x31ce7e]),'UserId':Number(_0x3ae117['params']['id'])});}}else{socket[_0x8ed5('0xa5')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3ae117[_0x8ed5('0x3e')][_0x8ed5('0x5e')]),'UserId':Number(_0x3ae117[_0x8ed5('0x8c')]['id'])});}});}})['then'](respondWithStatusCode(_0x22624f,null))[_0x8ed5('0x1e')](handleError(_0x22624f,null));};exports['addSmsInteractions']=function(_0x4b3635,_0x7a0fb4){return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x4b3635['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x7a0fb4,null))['then'](function(_0x25e1c3){if(_0x25e1c3){return _0x25e1c3[_0x8ed5('0x131')](_0x4b3635[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x4b3635[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{})[_0x8ed5('0x125')](function(){for(var _0x1e4153=0x0;_0x1e4153<_0x4b3635[_0x8ed5('0x5b')][_0x8ed5('0x5e')][_0x8ed5('0x49')];_0x1e4153+=0x1){socket[_0x8ed5('0xa5')](_0x8ed5('0x132'),{'SmsInteractionId':Number(_0x4b3635[_0x8ed5('0x5b')][_0x8ed5('0x5e')][_0x1e4153]),'UserId':Number(_0x4b3635[_0x8ed5('0x8c')]['id'])});}return _0x4b3635[_0x8ed5('0x5b')][_0x8ed5('0x5e')];});}})['then'](respondWithResult(_0x7a0fb4,null))['catch'](handleError(_0x7a0fb4,null));};exports[_0x8ed5('0x133')]=function(_0x590324,_0x3eaa9d){return db[_0x8ed5('0x37')]['find']({'where':{'id':_0x590324[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x3eaa9d,null))['then'](function(_0x5d2197){if(_0x5d2197){return _0x5d2197[_0x8ed5('0x133')](_0x590324[_0x8ed5('0x3e')][_0x8ed5('0x5e')])[_0x8ed5('0x16')](function(){if(_[_0x8ed5('0xb0')](_0x590324[_0x8ed5('0x3e')]['ids'])){for(var _0x3167ef=0x0;_0x3167ef<_0x590324[_0x8ed5('0x3e')][_0x8ed5('0x5e')][_0x8ed5('0x49')];_0x3167ef+=0x1){socket[_0x8ed5('0xa5')](_0x8ed5('0x134'),{'SmsInteractionId':Number(_0x590324['query'][_0x8ed5('0x5e')][_0x3167ef]),'UserId':Number(_0x590324['params']['id'])});}}else{socket[_0x8ed5('0xa5')](_0x8ed5('0x134'),{'SmsInteractionId':Number(_0x590324[_0x8ed5('0x3e')][_0x8ed5('0x5e')]),'UserId':Number(_0x590324['params']['id'])});}});}})[_0x8ed5('0x16')](respondWithStatusCode(_0x3eaa9d,null))[_0x8ed5('0x1e')](handleError(_0x3eaa9d,null));};exports[_0x8ed5('0x135')]=function(_0x14d026,_0x186881){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x14d026[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x186881,null))[_0x8ed5('0x16')](function(_0x29f08d){if(_0x29f08d){return _0x29f08d[_0x8ed5('0x135')](_0x14d026[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_['omit'](_0x14d026[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{})[_0x8ed5('0x125')](function(){for(var _0x4aba56=0x0;_0x4aba56<_0x14d026[_0x8ed5('0x5b')][_0x8ed5('0x5e')][_0x8ed5('0x49')];_0x4aba56+=0x1){socket['emit'](_0x8ed5('0x136'),{'OpenchannelInteractionId':Number(_0x14d026[_0x8ed5('0x5b')]['ids'][_0x4aba56]),'UserId':Number(_0x14d026['params']['id'])});}return _0x14d026[_0x8ed5('0x5b')][_0x8ed5('0x5e')];});}})[_0x8ed5('0x16')](respondWithResult(_0x186881,null))[_0x8ed5('0x1e')](handleError(_0x186881,null));};exports[_0x8ed5('0x137')]=function(_0x10dfe9,_0x18c1f8){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x10dfe9[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x18c1f8,null))[_0x8ed5('0x16')](function(_0x30c1b1){if(_0x30c1b1){return _0x30c1b1[_0x8ed5('0x137')](_0x10dfe9[_0x8ed5('0x3e')][_0x8ed5('0x5e')])[_0x8ed5('0x16')](function(){if(_[_0x8ed5('0xb0')](_0x10dfe9['query'][_0x8ed5('0x5e')])){for(var _0x6bb1ae=0x0;_0x6bb1ae<_0x10dfe9['query'][_0x8ed5('0x5e')]['length'];_0x6bb1ae+=0x1){socket[_0x8ed5('0xa5')](_0x8ed5('0x138'),{'OpenchannelInteractionId':Number(_0x10dfe9['query'][_0x8ed5('0x5e')][_0x6bb1ae]),'UserId':Number(_0x10dfe9[_0x8ed5('0x8c')]['id'])});}}else{socket[_0x8ed5('0xa5')](_0x8ed5('0x138'),{'OpenchannelInteractionId':Number(_0x10dfe9['query'][_0x8ed5('0x5e')]),'UserId':Number(_0x10dfe9[_0x8ed5('0x8c')]['id'])});}});}})[_0x8ed5('0x16')](respondWithStatusCode(_0x18c1f8,null))[_0x8ed5('0x1e')](handleError(_0x18c1f8,null));};exports[_0x8ed5('0x139')]=function(_0x391140,_0x1cab81){return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x391140[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x1cab81,null))[_0x8ed5('0x16')](function(_0x32775e){if(_0x32775e){return _0x32775e[_0x8ed5('0x139')](_0x391140[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_['omit'](_0x391140[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{})[_0x8ed5('0x125')](function(){for(var _0x4afd41=0x0;_0x4afd41<_0x391140[_0x8ed5('0x5b')][_0x8ed5('0x5e')][_0x8ed5('0x49')];_0x4afd41+=0x1){socket[_0x8ed5('0xa5')](_0x8ed5('0x13a'),{'WhatsappInteractionId':Number(_0x391140['body']['ids'][_0x4afd41]),'UserId':Number(_0x391140[_0x8ed5('0x8c')]['id'])});}return _0x391140[_0x8ed5('0x5b')]['ids'];});}})['then'](respondWithResult(_0x1cab81,null))[_0x8ed5('0x1e')](handleError(_0x1cab81,null));};exports[_0x8ed5('0x13b')]=function(_0x24eb82,_0x2f2c53){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x24eb82[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x2f2c53,null))[_0x8ed5('0x16')](function(_0x4c88eb){if(_0x4c88eb){return _0x4c88eb['removeWhatsappInteractions'](_0x24eb82[_0x8ed5('0x3e')][_0x8ed5('0x5e')]);}})[_0x8ed5('0x16')](respondWithStatusCode(_0x2f2c53,null))[_0x8ed5('0x1e')](handleError(_0x2f2c53,null));};exports[_0x8ed5('0x13c')]=function(_0xd38cf9,_0x5dc2e9){var _0x101bcd={};var _0x3c5cd6={};var _0x3ed709;var _0x2f502c;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0xd38cf9['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x5dc2e9,null))[_0x8ed5('0x16')](function(_0x5e8036){if(_0x5e8036){_0x3ed709=_0x5e8036;_0x3c5cd6[_0x8ed5('0x54')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x3c5cd6[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0xd38cf9['query']);_0x3c5cd6[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x3c5cd6[_0x8ed5('0x54')],_0x3c5cd6['query']);_0x101bcd['attributes']=_[_0x8ed5('0x53')](_0x3c5cd6[_0x8ed5('0x54')],qs['fields'](_0xd38cf9[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x101bcd['attributes']=_0x101bcd['attributes'][_0x8ed5('0x49')]?_0x101bcd[_0x8ed5('0x43')]:_0x3c5cd6[_0x8ed5('0x54')];_0x101bcd[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0xd38cf9['query']['sort']);_0x101bcd[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0xd38cf9['query'],_0x3c5cd6[_0x8ed5('0x52')]));if(_0xd38cf9[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x101bcd['where']=_['merge'](_0x101bcd[_0x8ed5('0x3d')],{'$or':_['map'](_0x101bcd[_0x8ed5('0x43')],function(_0x66ed53){var _0x3764f8={};_0x3764f8[_0x66ed53]={'$like':'%'+_0xd38cf9[_0x8ed5('0x3e')]['filter']+'%'};return _0x3764f8;})});}_0x101bcd=_[_0x8ed5('0x56')]({},_0x101bcd,_0xd38cf9[_0x8ed5('0x57')]);return _0x3ed709[_0x8ed5('0x13c')](_0x101bcd);}})[_0x8ed5('0x16')](function(_0x5071d2){if(_0x5071d2){_0x2f502c=_0x5071d2[_0x8ed5('0x49')];if(!_0xd38cf9[_0x8ed5('0x3e')][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x101bcd[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0xd38cf9[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x101bcd[_0x8ed5('0x24')]=qs['offset'](_0xd38cf9[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x3ed709[_0x8ed5('0x13c')](_0x101bcd);}})[_0x8ed5('0x16')](function(_0xa020ba){if(_0xa020ba){return _0xa020ba?{'count':_0x2f502c,'rows':_0xa020ba}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x5dc2e9,null))[_0x8ed5('0x1e')](handleError(_0x5dc2e9,null));};exports[_0x8ed5('0x13d')]=function(_0x1a2731,_0x4cad26){var _0x466cbb={};var _0x2dbd13={};var _0x59b720;var _0x5f333d;return db[_0x8ed5('0x37')]['findOne']({'where':{'id':_0x1a2731[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x4cad26,null))['then'](function(_0x2fa19e){if(_0x2fa19e){_0x59b720=_0x2fa19e;_0x2dbd13['model']=_[_0x8ed5('0x4f')](db['FaxAccount'][_0x8ed5('0x50')]);_0x2dbd13['query']=_[_0x8ed5('0x4f')](_0x1a2731[_0x8ed5('0x3e')]);_0x2dbd13[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x2dbd13['model'],_0x2dbd13[_0x8ed5('0x3e')]);_0x466cbb[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x2dbd13[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x1a2731[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x466cbb['attributes']=_0x466cbb[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x466cbb[_0x8ed5('0x43')]:_0x2dbd13[_0x8ed5('0x54')];_0x466cbb['order']=qs[_0x8ed5('0xcd')](_0x1a2731[_0x8ed5('0x3e')]['sort']);_0x466cbb['where']=qs[_0x8ed5('0x52')](_['pick'](_0x1a2731[_0x8ed5('0x3e')],_0x2dbd13[_0x8ed5('0x52')]));if(_0x1a2731[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x466cbb[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x466cbb[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x466cbb[_0x8ed5('0x43')],function(_0x576153){var _0xc1ee23={};_0xc1ee23[_0x576153]={'$like':'%'+_0x1a2731[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0xc1ee23;})});}_0x466cbb=_[_0x8ed5('0x56')]({},_0x466cbb,_0x1a2731[_0x8ed5('0x57')]);return _0x59b720[_0x8ed5('0x13d')](_0x466cbb);}})['then'](function(_0x5d35b8){if(_0x5d35b8){_0x5f333d=_0x5d35b8[_0x8ed5('0x49')];if(!_0x1a2731['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x466cbb[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x1a2731['query']['limit']);_0x466cbb[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x1a2731[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x59b720['getFaxAccounts'](_0x466cbb);}})[_0x8ed5('0x16')](function(_0x3eb35d){if(_0x3eb35d){return _0x3eb35d?{'count':_0x5f333d,'rows':_0x3eb35d}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x4cad26,null))[_0x8ed5('0x1e')](handleError(_0x4cad26,null));};exports[_0x8ed5('0x13e')]=function(_0x2465be,_0x537fc5){return db[_0x8ed5('0x37')]['find']({'where':{'id':_0x2465be[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x537fc5,null))[_0x8ed5('0x16')](function(_0x3ee521){if(_0x3ee521){return _0x3ee521[_0x8ed5('0x13e')](_0x2465be[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x2465be[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x537fc5,null))[_0x8ed5('0x1e')](handleError(_0x537fc5,null));};exports['removeFaxAccounts']=function(_0x45aefb,_0x1aa8ca){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x45aefb['params']['id']}})['then'](handleEntityNotFound(_0x1aa8ca,null))[_0x8ed5('0x16')](function(_0x5668b6){if(_0x5668b6){return _0x5668b6['removeFaxAccounts'](_0x45aefb['query'][_0x8ed5('0x5e')]);}})['then'](respondWithStatusCode(_0x1aa8ca,null))[_0x8ed5('0x1e')](handleError(_0x1aa8ca,null));};exports[_0x8ed5('0x13f')]=function(_0x56467a,_0x1ba537){var _0x135031={};var _0x2933e3={};var _0x363610;var _0x45d3be;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x56467a[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x1ba537,null))[_0x8ed5('0x16')](function(_0x58d263){if(_0x58d263){_0x363610=_0x58d263;_0x2933e3['model']=_[_0x8ed5('0x4f')](db[_0x8ed5('0x140')][_0x8ed5('0x50')]);_0x2933e3[_0x8ed5('0x3e')]=_['keys'](_0x56467a['query']);_0x2933e3['filters']=_[_0x8ed5('0x53')](_0x2933e3[_0x8ed5('0x54')],_0x2933e3[_0x8ed5('0x3e')]);_0x135031[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x2933e3['model'],qs[_0x8ed5('0x55')](_0x56467a['query']['fields']));_0x135031[_0x8ed5('0x43')]=_0x135031['attributes'][_0x8ed5('0x49')]?_0x135031[_0x8ed5('0x43')]:_0x2933e3[_0x8ed5('0x54')];_0x135031[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x56467a[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x135031[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x56467a['query'],_0x2933e3['filters']));if(_0x56467a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x135031[_0x8ed5('0x3d')]=_['merge'](_0x135031[_0x8ed5('0x3d')],{'$or':_['map'](_0x135031[_0x8ed5('0x43')],function(_0x150bac){var _0x377a9a={};_0x377a9a[_0x150bac]={'$like':'%'+_0x56467a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x377a9a;})});}_0x135031=_[_0x8ed5('0x56')]({},_0x135031,_0x56467a['options']);return _0x363610[_0x8ed5('0x13f')](_0x135031);}})['then'](function(_0x39e678){if(_0x39e678){_0x45d3be=_0x39e678['length'];if(!_0x56467a[_0x8ed5('0x3e')][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x135031[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x56467a[_0x8ed5('0x3e')]['limit']);_0x135031[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x56467a[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x363610['getMailAccounts'](_0x135031);}})['then'](function(_0xdf2583){if(_0xdf2583){return _0xdf2583?{'count':_0x45d3be,'rows':_0xdf2583}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x1ba537,null))[_0x8ed5('0x1e')](handleError(_0x1ba537,null));};exports[_0x8ed5('0x141')]=function(_0x3b73e0,_0x92535d){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x3b73e0[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x92535d,null))[_0x8ed5('0x16')](function(_0x57e696){if(_0x57e696){return _0x57e696[_0x8ed5('0x141')](_0x3b73e0[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x3b73e0[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{});}})[_0x8ed5('0x16')](respondWithResult(_0x92535d,null))[_0x8ed5('0x1e')](handleError(_0x92535d,null));};exports[_0x8ed5('0x142')]=function(_0x51bfa2,_0x4ec992){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x51bfa2['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x4ec992,null))[_0x8ed5('0x16')](function(_0x4b8ffd){if(_0x4b8ffd){return _0x4b8ffd[_0x8ed5('0x142')](_0x51bfa2[_0x8ed5('0x3e')][_0x8ed5('0x5e')]);}})[_0x8ed5('0x16')](respondWithStatusCode(_0x4ec992,null))[_0x8ed5('0x1e')](handleError(_0x4ec992,null));};exports[_0x8ed5('0x143')]=function(_0x1c883b,_0x2d40b2){var _0x58f542={};var _0x1ba74b={};var _0x555faa;var _0x4a4420;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x1c883b[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x2d40b2,null))[_0x8ed5('0x16')](function(_0x2c8807){if(_0x2c8807){_0x555faa=_0x2c8807;_0x1ba74b[_0x8ed5('0x54')]=_['keys'](db['OpenchannelAccount'][_0x8ed5('0x50')]);_0x1ba74b[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x1c883b[_0x8ed5('0x3e')]);_0x1ba74b[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x1ba74b['model'],_0x1ba74b[_0x8ed5('0x3e')]);_0x58f542['attributes']=_[_0x8ed5('0x53')](_0x1ba74b[_0x8ed5('0x54')],qs['fields'](_0x1c883b['query']['fields']));_0x58f542[_0x8ed5('0x43')]=_0x58f542['attributes'][_0x8ed5('0x49')]?_0x58f542[_0x8ed5('0x43')]:_0x1ba74b[_0x8ed5('0x54')];_0x58f542[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x1c883b[_0x8ed5('0x3e')]['sort']);_0x58f542[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x1c883b[_0x8ed5('0x3e')],_0x1ba74b[_0x8ed5('0x52')]));if(_0x1c883b[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x58f542[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x58f542[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x58f542[_0x8ed5('0x43')],function(_0x504369){var _0x2528eb={};_0x2528eb[_0x504369]={'$like':'%'+_0x1c883b[_0x8ed5('0x3e')]['filter']+'%'};return _0x2528eb;})});}_0x58f542=_[_0x8ed5('0x56')]({},_0x58f542,_0x1c883b['options']);return _0x555faa[_0x8ed5('0x143')](_0x58f542);}})[_0x8ed5('0x16')](function(_0x5c12c8){if(_0x5c12c8){_0x4a4420=_0x5c12c8[_0x8ed5('0x49')];if(!_0x1c883b[_0x8ed5('0x3e')][_0x8ed5('0xce')]('nolimit')){_0x58f542[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x1c883b[_0x8ed5('0x3e')]['limit']);_0x58f542[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x1c883b[_0x8ed5('0x3e')]['offset']);}return _0x555faa[_0x8ed5('0x143')](_0x58f542);}})[_0x8ed5('0x16')](function(_0x4f4f1a){if(_0x4f4f1a){return _0x4f4f1a?{'count':_0x4a4420,'rows':_0x4f4f1a}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x2d40b2,null))[_0x8ed5('0x1e')](handleError(_0x2d40b2,null));};exports[_0x8ed5('0x144')]=function(_0x358fb2,_0x1700b0){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x358fb2[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x1700b0,null))['then'](function(_0x164267){if(_0x164267){return _0x164267[_0x8ed5('0x144')](_0x358fb2[_0x8ed5('0x5b')][_0x8ed5('0x5e')],_['omit'](_0x358fb2[_0x8ed5('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x1700b0,null))[_0x8ed5('0x1e')](handleError(_0x1700b0,null));};exports[_0x8ed5('0x145')]=function(_0x93d0eb,_0x14157c){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x93d0eb['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x14157c,null))[_0x8ed5('0x16')](function(_0x4e50fa){if(_0x4e50fa){return _0x4e50fa['removeOpenchannelAccounts'](_0x93d0eb[_0x8ed5('0x3e')]['ids']);}})[_0x8ed5('0x16')](respondWithStatusCode(_0x14157c,null))[_0x8ed5('0x1e')](handleError(_0x14157c,null));};exports['getSmsAccounts']=function(_0x20aaeb,_0x43864e){var _0x4bc538={};var _0x557a70={};var _0x867296;var _0x3c3464;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x20aaeb[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x43864e,null))['then'](function(_0x2d451a){if(_0x2d451a){_0x867296=_0x2d451a;_0x557a70[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0x146')][_0x8ed5('0x50')]);_0x557a70[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x20aaeb['query']);_0x557a70['filters']=_[_0x8ed5('0x53')](_0x557a70[_0x8ed5('0x54')],_0x557a70[_0x8ed5('0x3e')]);_0x4bc538[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x557a70[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x20aaeb[_0x8ed5('0x3e')]['fields']));_0x4bc538[_0x8ed5('0x43')]=_0x4bc538[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x4bc538[_0x8ed5('0x43')]:_0x557a70[_0x8ed5('0x54')];_0x4bc538[_0x8ed5('0xcc')]=qs['sort'](_0x20aaeb['query'][_0x8ed5('0xcd')]);_0x4bc538[_0x8ed5('0x3d')]=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x20aaeb[_0x8ed5('0x3e')],_0x557a70[_0x8ed5('0x52')]));if(_0x20aaeb[_0x8ed5('0x3e')]['filter']){_0x4bc538[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x4bc538[_0x8ed5('0x3d')],{'$or':_['map'](_0x4bc538[_0x8ed5('0x43')],function(_0x529b53){var _0x585b32={};_0x585b32[_0x529b53]={'$like':'%'+_0x20aaeb[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x585b32;})});}_0x4bc538=_[_0x8ed5('0x56')]({},_0x4bc538,_0x20aaeb[_0x8ed5('0x57')]);return _0x867296[_0x8ed5('0x147')](_0x4bc538);}})[_0x8ed5('0x16')](function(_0x476103){if(_0x476103){_0x3c3464=_0x476103[_0x8ed5('0x49')];if(!_0x20aaeb[_0x8ed5('0x3e')][_0x8ed5('0xce')]('nolimit')){_0x4bc538['limit']=qs['limit'](_0x20aaeb[_0x8ed5('0x3e')][_0x8ed5('0x22')]);_0x4bc538['offset']=qs[_0x8ed5('0x24')](_0x20aaeb[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x867296[_0x8ed5('0x147')](_0x4bc538);}})[_0x8ed5('0x16')](function(_0xdd65ec){if(_0xdd65ec){return _0xdd65ec?{'count':_0x3c3464,'rows':_0xdd65ec}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x43864e,null))['catch'](handleError(_0x43864e,null));};exports['addSmsAccounts']=function(_0x4684ee,_0x11beed){return db[_0x8ed5('0x37')]['find']({'where':{'id':_0x4684ee[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x11beed,null))[_0x8ed5('0x16')](function(_0x378594){if(_0x378594){return _0x378594[_0x8ed5('0x148')](_0x4684ee[_0x8ed5('0x5b')]['ids'],_[_0x8ed5('0x5f')](_0x4684ee['body'],[_0x8ed5('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x11beed,null))['catch'](handleError(_0x11beed,null));};exports['removeSmsAccounts']=function(_0x5416d6,_0xb5ba04){return db[_0x8ed5('0x37')]['find']({'where':{'id':_0x5416d6['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0xb5ba04,null))[_0x8ed5('0x16')](function(_0xc812f3){if(_0xc812f3){return _0xc812f3['removeSmsAccounts'](_0x5416d6[_0x8ed5('0x3e')][_0x8ed5('0x5e')]);}})['then'](respondWithStatusCode(_0xb5ba04,null))[_0x8ed5('0x1e')](handleError(_0xb5ba04,null));};exports[_0x8ed5('0x149')]=function(_0x1972c8,_0x1fd7b2){var _0x21796e={};var _0x566054={};var _0x31a2b7;var _0x2b5d02;return db[_0x8ed5('0x37')][_0x8ed5('0x95')]({'where':{'id':_0x1972c8[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x1fd7b2,null))[_0x8ed5('0x16')](function(_0x1661c6){if(_0x1661c6){_0x31a2b7=_0x1661c6;_0x566054[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0x14a')][_0x8ed5('0x50')]);_0x566054[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x1972c8[_0x8ed5('0x3e')]);_0x566054[_0x8ed5('0x52')]=_[_0x8ed5('0x53')](_0x566054[_0x8ed5('0x54')],_0x566054[_0x8ed5('0x3e')]);_0x21796e[_0x8ed5('0x43')]=_['intersection'](_0x566054['model'],qs[_0x8ed5('0x55')](_0x1972c8[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x21796e[_0x8ed5('0x43')]=_0x21796e[_0x8ed5('0x43')]['length']?_0x21796e[_0x8ed5('0x43')]:_0x566054['model'];_0x21796e[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x1972c8[_0x8ed5('0x3e')]['sort']);_0x21796e[_0x8ed5('0x3d')]=qs['filters'](_[_0x8ed5('0xd4')](_0x1972c8[_0x8ed5('0x3e')],_0x566054['filters']));if(_0x1972c8['query'][_0x8ed5('0x2d')]){_0x21796e[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x21796e[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x21796e[_0x8ed5('0x43')],function(_0x49bce0){var _0x195d15={};_0x195d15[_0x49bce0]={'$like':'%'+_0x1972c8[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x195d15;})});}_0x21796e=_[_0x8ed5('0x56')]({},_0x21796e,_0x1972c8[_0x8ed5('0x57')]);return _0x31a2b7['getChatWebsites'](_0x21796e);}})[_0x8ed5('0x16')](function(_0x23ce68){if(_0x23ce68){_0x2b5d02=_0x23ce68[_0x8ed5('0x49')];if(!_0x1972c8['query'][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x21796e['limit']=qs[_0x8ed5('0x22')](_0x1972c8[_0x8ed5('0x3e')]['limit']);_0x21796e['offset']=qs[_0x8ed5('0x24')](_0x1972c8[_0x8ed5('0x3e')][_0x8ed5('0x24')]);}return _0x31a2b7[_0x8ed5('0x149')](_0x21796e);}})[_0x8ed5('0x16')](function(_0x390c42){if(_0x390c42){return _0x390c42?{'count':_0x2b5d02,'rows':_0x390c42}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x1fd7b2,null))[_0x8ed5('0x1e')](handleError(_0x1fd7b2,null));};exports[_0x8ed5('0x14b')]=function(_0x4ce21c,_0x1a63e5){return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x4ce21c['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x1a63e5,null))[_0x8ed5('0x16')](function(_0x45b232){if(_0x45b232){return _0x45b232[_0x8ed5('0x14b')](_0x4ce21c['body'][_0x8ed5('0x5e')],_[_0x8ed5('0x5f')](_0x4ce21c['body'],[_0x8ed5('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x1a63e5,null))[_0x8ed5('0x1e')](handleError(_0x1a63e5,null));};exports[_0x8ed5('0x14c')]=function(_0xebe2b5,_0x45bcc7){return db['User']['find']({'where':{'id':_0xebe2b5['params']['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x45bcc7,null))[_0x8ed5('0x16')](function(_0xcbcdfc){if(_0xcbcdfc){return _0xcbcdfc['removeChatWebsites'](_0xebe2b5[_0x8ed5('0x3e')][_0x8ed5('0x5e')]);}})[_0x8ed5('0x16')](respondWithStatusCode(_0x45bcc7,null))[_0x8ed5('0x1e')](handleError(_0x45bcc7,null));};exports[_0x8ed5('0x14d')]=function(_0x1d858d,_0x360612){var _0x376d2e={};var _0x309912={};var _0xb4908a;var _0x56c13a;return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x1d858d[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x360612,null))[_0x8ed5('0x16')](function(_0x5e3e38){if(_0x5e3e38){_0xb4908a=_0x5e3e38;_0x309912[_0x8ed5('0x54')]=_[_0x8ed5('0x4f')](db[_0x8ed5('0x14e')][_0x8ed5('0x50')]);_0x309912[_0x8ed5('0x3e')]=_[_0x8ed5('0x4f')](_0x1d858d[_0x8ed5('0x3e')]);_0x309912['filters']=_[_0x8ed5('0x53')](_0x309912[_0x8ed5('0x54')],_0x309912[_0x8ed5('0x3e')]);_0x376d2e[_0x8ed5('0x43')]=_[_0x8ed5('0x53')](_0x309912['model'],qs[_0x8ed5('0x55')](_0x1d858d[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x376d2e['attributes']=_0x376d2e[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x376d2e['attributes']:_0x309912[_0x8ed5('0x54')];_0x376d2e[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x1d858d['query'][_0x8ed5('0xcd')]);_0x376d2e['where']=qs[_0x8ed5('0x52')](_[_0x8ed5('0xd4')](_0x1d858d[_0x8ed5('0x3e')],_0x309912[_0x8ed5('0x52')]));if(_0x1d858d[_0x8ed5('0x3e')]['filter']){_0x376d2e[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x376d2e[_0x8ed5('0x3d')],{'$or':_[_0x8ed5('0x2e')](_0x376d2e[_0x8ed5('0x43')],function(_0x1c0ca3){var _0x558594={};_0x558594[_0x1c0ca3]={'$like':'%'+_0x1d858d[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'};return _0x558594;})});}_0x376d2e=_[_0x8ed5('0x56')]({},_0x376d2e,_0x1d858d[_0x8ed5('0x57')]);return _0xb4908a['getWhatsappAccounts'](_0x376d2e);}})['then'](function(_0x5a5b4c){if(_0x5a5b4c){_0x56c13a=_0x5a5b4c['length'];if(!_0x1d858d[_0x8ed5('0x3e')][_0x8ed5('0xce')](_0x8ed5('0xd7'))){_0x376d2e[_0x8ed5('0x22')]=qs[_0x8ed5('0x22')](_0x1d858d[_0x8ed5('0x3e')]['limit']);_0x376d2e[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x1d858d[_0x8ed5('0x3e')]['offset']);}return _0xb4908a[_0x8ed5('0x14d')](_0x376d2e);}})[_0x8ed5('0x16')](function(_0x57d992){if(_0x57d992){return _0x57d992?{'count':_0x56c13a,'rows':_0x57d992}:null;}})[_0x8ed5('0x16')](respondWithResult(_0x360612,null))[_0x8ed5('0x1e')](handleError(_0x360612,null));};exports[_0x8ed5('0x14f')]=function(_0x82279,_0x1dce61){return db['User'][_0x8ed5('0x31')]({'where':{'id':_0x82279[_0x8ed5('0x8c')]['id']}})['then'](handleEntityNotFound(_0x1dce61,null))[_0x8ed5('0x16')](function(_0xdbaef0){if(_0xdbaef0){return _0xdbaef0[_0x8ed5('0x14f')](_0x82279[_0x8ed5('0x5b')]['ids'],_['omit'](_0x82279[_0x8ed5('0x5b')],[_0x8ed5('0x5e'),'id'])||{});}})[_0x8ed5('0x16')](respondWithResult(_0x1dce61,null))['catch'](handleError(_0x1dce61,null));};exports[_0x8ed5('0x150')]=function(_0x53af49,_0x2d57d2){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x53af49[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x2d57d2,null))[_0x8ed5('0x16')](function(_0x5f0058){if(_0x5f0058){return _0x5f0058[_0x8ed5('0x150')](_0x53af49['query'][_0x8ed5('0x5e')]);}})[_0x8ed5('0x16')](respondWithStatusCode(_0x2d57d2,null))[_0x8ed5('0x1e')](handleError(_0x2d57d2,null));};exports[_0x8ed5('0x151')]=function(_0x266c4c,_0x532fa4){var _0x5b4115={},_0x495827={},_0x3b20bc={'count':0x0,'rows':[]};var _0x28baa5=db[_0x8ed5('0x152')][_0x8ed5('0x50')];_0x495827['model']=_[_0x8ed5('0x4f')](_0x28baa5);_0x495827[_0x8ed5('0x3e')]=_['keys'](_0x266c4c[_0x8ed5('0x3e')]);_0x495827[_0x8ed5('0x52')]=_['intersection'](_0x495827[_0x8ed5('0x54')],_0x495827[_0x8ed5('0x3e')]);_0x495827['filters']=_[_0x8ed5('0xc9')](_0x495827[_0x8ed5('0x52')],[_0x8ed5('0x153'),_0x8ed5('0x154'),_0x8ed5('0x155'),'$gte',_0x8ed5('0x156'),_0x8ed5('0x157'),'$ne',_0x8ed5('0x158'),_0x8ed5('0x159'),_0x8ed5('0x15a'),_0x8ed5('0x15b'),_0x8ed5('0x15c'),'$notIn','$like','$notLike',_0x8ed5('0x15d'),_0x8ed5('0x15e'),_0x8ed5('0x15f'),_0x8ed5('0x160'),_0x8ed5('0x161'),_0x8ed5('0x162'),'$any']);_0x5b4115[_0x8ed5('0x43')]=_['intersection'](_0x495827[_0x8ed5('0x54')],qs[_0x8ed5('0x55')](_0x266c4c[_0x8ed5('0x3e')][_0x8ed5('0x55')]));_0x5b4115['attributes']=_0x5b4115[_0x8ed5('0x43')][_0x8ed5('0x49')]?_0x5b4115[_0x8ed5('0x43')]:_0x495827[_0x8ed5('0x54')];if(!_0x266c4c[_0x8ed5('0x3e')]['hasOwnProperty'](_0x8ed5('0xd7'))){_0x5b4115['limit']=qs[_0x8ed5('0x22')](_0x266c4c['query'][_0x8ed5('0x22')]);_0x5b4115['offset']=qs[_0x8ed5('0x24')](_0x266c4c[_0x8ed5('0x3e')]['offset']);}_0x5b4115[_0x8ed5('0xcc')]=qs[_0x8ed5('0xcd')](_0x266c4c[_0x8ed5('0x3e')][_0x8ed5('0xcd')]);_0x5b4115[_0x8ed5('0x3d')]=qs['filters'](_['pick'](_0x266c4c['query'],_0x495827[_0x8ed5('0x52')]));if(_0x266c4c[_0x8ed5('0x3e')][_0x8ed5('0x2d')]){_0x5b4115[_0x8ed5('0x3d')]=_[_0x8ed5('0x56')](_0x5b4115['where'],{'$or':_[_0x8ed5('0x2e')](_0x5b4115[_0x8ed5('0x43')],function(_0x2536a8){var _0xe776d={};_0xe776d[_0x2536a8]={'$like':'%'+_0x266c4c['query'][_0x8ed5('0x2d')]+'%'};return _0xe776d;})});}_0x5b4115['where']={'$and':[_0x5b4115[_0x8ed5('0x3d')],{'$or':[{'UserId':_0x266c4c[_0x8ed5('0x8c')]['id']},{'OwnerId':_0x266c4c['params']['id']}]}]};_0x5b4115=_[_0x8ed5('0x56')]({},_0x5b4115,_0x266c4c[_0x8ed5('0x57')]);var _0x2c4915={'where':_0x5b4115[_0x8ed5('0x3d')]};return db[_0x8ed5('0x152')][_0x8ed5('0x23')](_0x2c4915)['then'](function(_0xae5322){_0x3b20bc[_0x8ed5('0x23')]=_0xae5322;if(_0x266c4c[_0x8ed5('0x3e')]['includeAll']){_0x5b4115[_0x8ed5('0x40')]=[{'attributes':['id',_0x8ed5('0x163'),_0x8ed5('0x164'),_0x8ed5('0xea')],'model':db['CmContact'],'as':_0x8ed5('0x165')},{'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x166')],'model':db[_0x8ed5('0xa8')],'as':_0x8ed5('0xd5')}];}return db[_0x8ed5('0x152')][_0x8ed5('0x45')](_0x5b4115);})[_0x8ed5('0x16')](function(_0x1371bb){_0x3b20bc[_0x8ed5('0x46')]=_0x1371bb;return _0x3b20bc;})[_0x8ed5('0x16')](respondWithFilteredResult(_0x532fa4,_0x5b4115))['catch'](handleError(_0x532fa4,null));};exports[_0x8ed5('0x167')]=function(_0x13f861,_0x1a1396){if(!_[_0x8ed5('0xb8')](_0x13f861[_0x8ed5('0x7c')]['id'])&&(_0x13f861[_0x8ed5('0x7c')]['role']==_0x8ed5('0x2b')||_0x13f861['user'][_0x8ed5('0x32')]==_0x8ed5('0x7c'))){return db['User'][_0x8ed5('0x95')]({'where':{'id':_0x13f861[_0x8ed5('0x8c')]['id']},'raw':!![]})[_0x8ed5('0x16')](function(_0x2323f2){return authService[_0x8ed5('0x168')](_0x2323f2);})['then'](function(_0x5f2784){if(_0x5f2784){return _0x1a1396[_0x8ed5('0x25')](0xc8)[_0x8ed5('0x21')]({'api_key':_0x5f2784[_0x8ed5('0x169')]});}else{return _0x1a1396[_0x8ed5('0x25')](0xcc)[_0x8ed5('0x21')]({'message':_0x8ed5('0x16a')});}})['catch'](handleError(_0x1a1396,0x193));}else{return _0x1a1396[_0x8ed5('0x25')](0x191)[_0x8ed5('0x21')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports[_0x8ed5('0x16b')]=function(_0x3a33ff,_0x359335){if(!_[_0x8ed5('0xb8')](_0x3a33ff[_0x8ed5('0x7c')]['id'])&&(_0x3a33ff[_0x8ed5('0x7c')][_0x8ed5('0x32')]==_0x8ed5('0x2b')||_0x3a33ff[_0x8ed5('0x7c')][_0x8ed5('0x32')]==_0x8ed5('0x7c'))){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0x3a33ff[_0x8ed5('0x8c')]['id']}})['then'](function(_0x37be52){return authService[_0x8ed5('0x16c')](_0x37be52);})[_0x8ed5('0x16')](function(_0x57a169){return db['User'][_0x8ed5('0xfc')]({'apiKeyIat':_0x57a169[_0x8ed5('0x16d')],'apiKeyNonce':_0x57a169[_0x8ed5('0x16e')]},{'where':{'id':_0x3a33ff[_0x8ed5('0x8c')]['id']}})['then'](function(){return _0x359335[_0x8ed5('0x25')](0xc8)[_0x8ed5('0x21')]({'api_key':_0x57a169[_0x8ed5('0x169')]});});})[_0x8ed5('0x1e')](handleError(_0x359335,0x193));}else{return _0x359335['status'](0x191)['json']({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports[_0x8ed5('0x16f')]=function(_0xf3c328,_0x4a2e8f){if(!_[_0x8ed5('0xb8')](_0xf3c328[_0x8ed5('0x7c')]['id'])&&(_0xf3c328['user']['role']==_0x8ed5('0x2b')||_0xf3c328[_0x8ed5('0x7c')][_0x8ed5('0x32')]==_0x8ed5('0x7c'))){return db[_0x8ed5('0x37')][_0x8ed5('0x31')]({'where':{'id':_0xf3c328[_0x8ed5('0x8c')]['id']}})[_0x8ed5('0x16')](handleEntityNotFound(_0x4a2e8f,null))['then'](function(_0x19669e){if(_0x19669e&&_0x19669e['apiKeyNonce']&&_0x19669e['apiKeyIat'])return _0x19669e;else throw{'message':_0x8ed5('0x170')};})['then'](function(){return db[_0x8ed5('0x37')]['update']({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0xf3c328[_0x8ed5('0x8c')]['id']}});})[_0x8ed5('0x16')](respondWithStatusCode(_0x4a2e8f,0xc8))['catch'](handleError(_0x4a2e8f,0x193));}else{return _0x4a2e8f[_0x8ed5('0x25')](0x191)[_0x8ed5('0x21')]({'message':_0x8ed5('0x171')});}};exports[_0x8ed5('0x172')]=function(_0xe92898,_0xa78c52){var _0x563a8d=_0xe92898[_0x8ed5('0x7c')][_0x8ed5('0x2a')]({'plain':!![]});if(!_0x563a8d){return _0xa78c52[_0x8ed5('0x25')](0x191)['send'](_0x8ed5('0x173'));}else{Promise[_0x8ed5('0x104')]()[_0x8ed5('0x16')](function(){if(_0xe92898[_0x8ed5('0x3e')][_0x8ed5('0x41')]!==_0x8ed5('0x48'))return;return _0xe92898['user']['getUserSetting']();})[_0x8ed5('0x16')](function(_0x3de495){if(!_0x3de495)return;return _0x3de495['get']({'plain':!![]});})[_0x8ed5('0x16')](function(_0x5356e2){_0x563a8d[_0x8ed5('0x41')]=_0x5356e2;return _0xa78c52[_0x8ed5('0x25')](0xc8)[_0x8ed5('0x21')](_0x563a8d);});}};exports['getPresence']=function(_0x21232a,_0x12377c){var _0x541354={'offset':0x0},_0x22b2c9={'count':0x0,'rows':[]};Promise[_0x8ed5('0x104')]()['then'](function(){if(!_0x21232a[_0x8ed5('0x3e')]['filter']&&!_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x174')]&&!_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x175')])return[];return Promise[_0x8ed5('0x104')]()[_0x8ed5('0x16')](function(){var _0x4978b9=[];if(!_[_0x8ed5('0x8a')](_0x21232a[_0x8ed5('0x3e')]['teams'])){_0x4978b9['push'](db[_0x8ed5('0x113')][_0x8ed5('0x45')]({'attributes':['id','name'],'where':{'id':_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x174')]}}));}if(!_[_0x8ed5('0x8a')](_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x175')])){_0x4978b9[_0x8ed5('0x44')](db[_0x8ed5('0xa8')]['findAll']({'attributes':['id',_0x8ed5('0x34')],'type':'inbound','where':{'id':_0x21232a['query'][_0x8ed5('0x175')]}}));}return Promise[_0x8ed5('0x5a')](_0x4978b9);})['then'](function(_0x3e61f0){var _0xaec673=_[_0x8ed5('0x176')](_0x3e61f0)['map'](function(_0x355370){return _0x355370['getAgents']({'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x65'),_0x8ed5('0xa9')],'raw':!![]});});return Promise[_0x8ed5('0x5a')](_0xaec673);})[_0x8ed5('0x16')](function(_0x478669){var _0x116afc=_['flatten'](_0x478669);if(!_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x2d')])return _0x116afc;if(_[_0x8ed5('0x8a')](_0x116afc)){return db[_0x8ed5('0x37')]['findAll']({'attributes':['id',_0x8ed5('0x34'),_0x8ed5('0x65'),_0x8ed5('0xa9')],'where':{'role':'agent','$or':[db[_0x8ed5('0x67')][_0x8ed5('0x3d')](db['sequelize']['fn'](_0x8ed5('0x177'),db[_0x8ed5('0x67')][_0x8ed5('0x178')](_0x8ed5('0x34'))),{'$like':'%'+_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x2d')][_0x8ed5('0xa3')]()+'%'}),{'internal':{'$like':'%'+_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]+'%'}}]},'raw':!![]});}else{return _(_0x116afc)[_0x8ed5('0x176')]()[_0x8ed5('0x2d')](function(_0x209982){return _0x209982[_0x8ed5('0x34')][_0x8ed5('0xa3')]()[_0x8ed5('0x30')](_0x21232a['query'][_0x8ed5('0x2d')][_0x8ed5('0xa3')]())||_0x209982[_0x8ed5('0x65')]['toString']()[_0x8ed5('0x30')](_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x2d')]);})['value']();}})[_0x8ed5('0x16')](function(_0x3d2200){var _0x400a2d='name';var _0xc4d7aa=_0x8ed5('0x179');if(_0x21232a['query']['sort']){_0xc4d7aa=_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0xcd')][0x0]==='-'?_0x8ed5('0x17a'):_0x8ed5('0x179');_0x400a2d=_0xc4d7aa==='asc'?_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0xcd')]:_0x21232a['query'][_0x8ed5('0xcd')][_0x8ed5('0x17b')](0x1);}return _(_0x3d2200)[_0x8ed5('0x17c')]('id')[_0x8ed5('0x17d')]([function(_0x2fe0ee){return _0x400a2d===_0x8ed5('0x34')?_0x2fe0ee[_0x400a2d][_0x8ed5('0xa3')]():_0x2fe0ee[_0x400a2d];}],[_0xc4d7aa])[_0x8ed5('0x2e')](function(_0x18b6c7){return _['pick'](_0x18b6c7,['id',_0x8ed5('0x34'),_0x8ed5('0x65'),_0x8ed5('0xa9')]);})['value']();})[_0x8ed5('0x16')](function(_0x262b4c){return amiClient[_0x8ed5('0x17e')](_0x8ed5('0x81'),_0x21232a)[_0x8ed5('0x16')](function(_0x5f1fda){if(_0x5f1fda[_0x8ed5('0x1c')])throw new Error(_0x8ed5('0x17f'));var _0x288ddd=_0x5f1fda[_0x8ed5('0x180')];var _0x401d65=jayson[_0x8ed5('0x14')]['http']({'port':0x232c});return _0x401d65['request'](_0x8ed5('0x81'),_0x21232a)[_0x8ed5('0x16')](function(_0x5a2c96){if(_0x5a2c96['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0xced033=_0x5a2c96[_0x8ed5('0x180')];return _[_0x8ed5('0x56')]({},_0xced033,_0x288ddd);});})[_0x8ed5('0x16')](function(_0x4f56a0){return _[_0x8ed5('0x2e')](_0x262b4c,function(_0x51a186){var _0x22700a=_['find'](_0x4f56a0[_0x8ed5('0x46')],['id',_0x51a186['id']]);if(!_0x22700a||!_0x51a186[_0x8ed5('0xa9')]){_0x51a186[_0x8ed5('0x25')]=_0x8ed5('0x181');}else if(_0x22700a['voicePause']){_0x51a186[_0x8ed5('0x25')]=_0x8ed5('0x106');}else{_0x51a186[_0x8ed5('0x25')]=_[_0x8ed5('0x30')]([_0x8ed5('0x182'),'unknown',_0x8ed5('0x183'),_0x8ed5('0x184'),null,undefined],_0x22700a['voiceStatus'])?_0x8ed5('0xa9'):_0x8ed5('0x185');}return _0x51a186;});});});})[_0x8ed5('0x16')](function(_0x5196fa){if(!_0x21232a[_0x8ed5('0x3e')]['hasOwnProperty'](_0x8ed5('0xd7'))){_0x541354[_0x8ed5('0x22')]=qs['limit'](_0x21232a[_0x8ed5('0x3e')][_0x8ed5('0x22')]||0xa);_0x541354[_0x8ed5('0x24')]=qs[_0x8ed5('0x24')](_0x21232a[_0x8ed5('0x3e')]['offset']);}_0x22b2c9[_0x8ed5('0x23')]=_0x5196fa[_0x8ed5('0x49')];_0x22b2c9[_0x8ed5('0x46')]=_0x541354['limit']?_0x5196fa['slice'](_0x541354[_0x8ed5('0x24')],_0x541354[_0x8ed5('0x24')]+_0x541354['limit']):_0x5196fa;return _0x22b2c9;})[_0x8ed5('0x16')](respondWithFilteredResult(_0x12377c,_0x541354))['catch'](handleError(_0x12377c,null));};function get_open_tabs(_0x9b92dd,_0x180a61){var _0x59d2ab=_0x9b92dd[_0x8ed5('0x186')](0x0)[_0x8ed5('0x187')]()+_0x9b92dd[_0x8ed5('0x188')](0x1);var _0x107d7c={'type':db[_0x8ed5('0x8f')][_0x8ed5('0x189')][_0x8ed5('0x18a')],'raw':!![]};return new Promise(function(_0x51afd0,_0x4f7d30){var _0x151568=squel['select']()[_0x8ed5('0x18b')](_0x8ed5('0x18c')+_0x59d2ab+'InteractionId','id')[_0x8ed5('0x18b')](_0x8ed5('0x18d'))['from'](_0x8ed5('0x18e')+_0x9b92dd+_0x8ed5('0x18f'),'ui')[_0x8ed5('0x3d')](_0x8ed5('0x190'),_0x180a61['id']);return db[_0x8ed5('0x67')]['query'](_0x151568['toString'](),_0x107d7c)[_0x8ed5('0x16')](function(_0x7068df){_0x180a61[_0x59d2ab+_0x8ed5('0x191')]=_0x7068df;_0x51afd0(_0x7068df);})[_0x8ed5('0x1e')](function(_0x246a58){_0x4f7d30(_0x246a58);});});}
\ No newline at end of file
+var _0x0275=['Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','Telephones','userProfileId','compact','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','newPassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','online','isValidChannel','Queues','penalty','QueueId','emit','toLowerCase','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','channel','Unknown\x20channel','remove','capitalize','isArray','Queue:remove','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','sort','filters','hasOwnProperty','CmList','Tag','Tags','color','tag','nolimit','getQueues','pick','Queue','Unknown\x20role','UserVoiceQueueRt','order','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','forEach','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','isMiddleware','logout','MemberReport','pause','QueuePause','updateAttributes','getChannels','bulkCreate','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','getTeams','Team','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','Voice','voicePause','VoicePrefixId','getDataValue','removeTeams','TeamVoicePrefix','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','phone','CmContact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','queues','isEmpty','teams','inbound','flatten','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','util','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','role','userNotification:recalc:','destroy','get','Users','user','Agents','telephone','filter','ignore','map','value','includes','find','name','stack','send','fieldName','type','key','password','salt','where','User','query','includeAll','include','userSetting','true','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','mail','openchannel','all','params','model','differenceBy','keys','rawAttributes','intersection','fields','UserSetting','merge','options','whatsapp','fax','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','104','106','108','109','100','111','114','115','create','agent','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some'];(function(_0x3ab8db,_0x442eb0){var _0x24d98e=function(_0x49ecb1){while(--_0x49ecb1){_0x3ab8db['push'](_0x3ab8db['shift']());}};_0x24d98e(++_0x442eb0);}(_0x0275,0x108));var _0x5027=function(_0x1819eb,_0x5df8c2){_0x1819eb=_0x1819eb-0x0;var _0x5a74d2=_0x0275[_0x1819eb];return _0x5a74d2;};'use strict';var moment=require('moment');var util=require(_0x5027('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x5027('0x1'));var squel=require(_0x5027('0x2'));var jayson=require(_0x5027('0x3'));var Redis=require('ioredis');var authService=require(_0x5027('0x4'));var qs=require(_0x5027('0x5'));var logger=require(_0x5027('0x6'))(_0x5027('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5027('0x8'));var APIBadRequestError=require(_0x5027('0x9'))[_0x5027('0xa')];var APINotFoundError=require('../../errors/api')[_0x5027('0xb')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0x5027('0xc'))['db'];var socket=require(_0x5027('0xd'))(new Redis(config[_0x5027('0xe')]));require(_0x5027('0xf'))[_0x5027('0x10')](socket);config['redis']=_[_0x5027('0x11')](config[_0x5027('0xe')],{'host':_0x5027('0x12'),'port':0x18eb});var amiClient=jayson[_0x5027('0x13')][_0x5027('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x1fdc8a,_0x15e66b,_0x5899e4,_0x4a5c6c){return new Promise(function(_0xd558ad,_0x5de1d9){var _0x48aec0=_0x4a5c6c||amiClient;return _0x48aec0[_0x5027('0x15')](_0x1fdc8a,_0x5899e4)[_0x5027('0x16')](function(_0x525781){logger[_0x5027('0x17')](_0x5027('0x18'),_0x15e66b,_0x5027('0x19'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x15e66b,_0x5027('0x19'),JSON['stringify'](_0x525781));if(_0x525781['error']){if(_0x525781[_0x5027('0x1a')][_0x5027('0x1b')]===0x1f4){logger[_0x5027('0x1a')](_0x5027('0x18'),_0x15e66b,_0x525781[_0x5027('0x1a')][_0x5027('0x1c')]);return _0x5de1d9(_0x525781['error'][_0x5027('0x1c')]);}logger[_0x5027('0x1a')](_0x5027('0x18'),_0x15e66b,_0x525781[_0x5027('0x1a')]['message']);return _0xd558ad(_0x525781[_0x5027('0x1a')][_0x5027('0x1c')]);}else{logger[_0x5027('0x17')](_0x5027('0x18'),_0x15e66b,_0x5027('0x19'));_0xd558ad(_0x525781[_0x5027('0x1d')]['message']);}})[_0x5027('0x1e')](function(_0x487ecb){logger[_0x5027('0x1a')]('User,\x20%s,\x20%s',_0x15e66b,_0x487ecb);_0x5de1d9(_0x487ecb);});});}function respondWithStatusCode(_0x58bd83,_0x18b694){_0x18b694=_0x18b694||0xcc;return function(_0x318624){if(_0x318624){return _0x58bd83[_0x5027('0x1f')](_0x18b694);}return _0x58bd83[_0x5027('0x20')](_0x18b694)[_0x5027('0x21')]();};}function respondWithResult(_0xda51b5,_0x43d44a){_0x43d44a=_0x43d44a||0xc8;return function(_0x110e46){if(_0x110e46){return _0xda51b5[_0x5027('0x20')](_0x43d44a)[_0x5027('0x22')](_0x110e46);}};}function respondWithFilteredResult(_0xb821fc,_0x5515fd){return function(_0x37ae3c){if(_0x37ae3c){var _0x28d30a=typeof _0x5515fd[_0x5027('0x23')]===_0x5027('0x24')&&typeof _0x5515fd[_0x5027('0x25')]===_0x5027('0x24');var _0x31307a=_0x37ae3c[_0x5027('0x26')];var _0x10f99d=_0x28d30a?0x0:_0x5515fd[_0x5027('0x23')];var _0x7dc3ca=_0x28d30a?_0x37ae3c[_0x5027('0x26')]:_0x5515fd[_0x5027('0x23')]+_0x5515fd[_0x5027('0x25')];var _0x452266;if(_0x7dc3ca>=_0x31307a){_0x7dc3ca=_0x31307a;_0x452266=0xc8;}else{_0x452266=0xce;}_0xb821fc['status'](_0x452266);return _0xb821fc[_0x5027('0x27')](_0x5027('0x28'),_0x10f99d+'-'+_0x7dc3ca+'/'+_0x31307a)[_0x5027('0x22')](_0x37ae3c);}return null;};}function saveUpdates(_0x339a60){return function(_0x5dbde1){if(_0x5dbde1){return _0x5dbde1[_0x5027('0x29')](_0x339a60)['then'](function(_0x49528a){if(_0x49528a[_0x5027('0x2a')]==='agent'){socket['emit'](_0x5027('0x2b')+_0x49528a['id'],_0x49528a);}return _0x49528a;});}return null;};}function removeEntity(_0x31eb16){return function(_0x40a2cb){if(_0x40a2cb){return _0x40a2cb[_0x5027('0x2c')]()[_0x5027('0x16')](function(){var _0x3a9d2d=_0x40a2cb[_0x5027('0x2d')]({'plain':!![]});if(_0x3a9d2d[_0x5027('0x2a')]==='admin')return;var _0x37a533=[{'name':_0x5027('0x2e'),'value':_0x5027('0x2f'),'ignore':!![]},{'name':_0x5027('0x30'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x5027('0x31'),'ignore':![]}];var _0x345e03=_(_0x37a533)[_0x5027('0x32')](_0x5027('0x33'))[_0x5027('0x34')](_0x5027('0x35'))[_0x5027('0x35')]();if(_[_0x5027('0x36')](_0x345e03,_0x3a9d2d[_0x5027('0x2a')])){return;}var _0x1d50f3=_[_0x5027('0x37')](_0x37a533,['value',_0x3a9d2d[_0x5027('0x2a')]])[_0x5027('0x38')];return db['UserProfileResource'][_0x5027('0x2c')]({'where':{'type':_0x1d50f3,'resourceId':_0x3a9d2d['id']}})['then'](function(){return _0x40a2cb;});})[_0x5027('0x16')](function(){_0x31eb16[_0x5027('0x20')](0xcc)[_0x5027('0x21')]();});}};}function handleEntityNotFound(_0x16eb2b){return function(_0x43078b){if(!_0x43078b){_0x16eb2b[_0x5027('0x1f')](0x194);}return _0x43078b;};}function handleError(_0x1fb2fd,_0x32927d){_0x32927d=_0x32927d||0x1f4;return function(_0x3eafed){logger['error'](_0x3eafed[_0x5027('0x39')]);if(_0x3eafed[_0x5027('0x38')]){delete _0x3eafed['name'];}_0x1fb2fd['status'](_0x32927d)[_0x5027('0x3a')](_0x3eafed);};}exports['index']=function(_0x5f0dd2,_0x49f327){var _0x202881={},_0x40d1a9={'count':0x0,'rows':[]};var _0x53ad25=_(db['User']['rawAttributes'])['map'](function(_0x16c884){return{'name':_0x16c884[_0x5027('0x3b')],'type':_0x16c884[_0x5027('0x3c')][_0x5027('0x3d')]};})[_0x5027('0x32')](function(_0x47de8e){return!_[_0x5027('0x36')]([_0x5027('0x3e'),_0x5027('0x3f')],_0x47de8e[_0x5027('0x38')]);})['value']();_0x202881=qs['getOptions'](_0x53ad25,_0x5f0dd2);var _0x694e8d={'where':_0x202881[_0x5027('0x40')]};return db[_0x5027('0x41')][_0x5027('0x26')](_0x694e8d)[_0x5027('0x16')](function(_0x2bc943){_0x40d1a9[_0x5027('0x26')]=_0x2bc943;if(_0x5f0dd2[_0x5027('0x42')][_0x5027('0x43')]){_0x202881[_0x5027('0x44')]=[{'all':!![]}];}if(_0x5f0dd2[_0x5027('0x42')][_0x5027('0x45')]===_0x5027('0x46')){_0x202881[_0x5027('0x44')]=[{'model':db['UserSetting'],'as':_0x5027('0x45')}];}if(!_[_0x5027('0x36')](_0x202881[_0x5027('0x47')],'id')){_0x202881[_0x5027('0x47')][_0x5027('0x48')]('id');}return db['User'][_0x5027('0x49')](_0x202881);})[_0x5027('0x16')](function(_0x2d9ff8){_0x40d1a9[_0x5027('0x4a')]=_0x2d9ff8;if(_0x5f0dd2[_0x5027('0x42')][_0x5027('0x4b')]===_0x5027('0x46')){var _0xf5ea1c=[];for(var _0x130f8a=0x0;_0x130f8a<_0x40d1a9[_0x5027('0x4a')][_0x5027('0x4c')];_0x130f8a++){_0xf5ea1c[_0x5027('0x48')](get_open_tabs(_0x5027('0x4d'),_0x40d1a9[_0x5027('0x4a')][_0x130f8a][_0x5027('0x4e')]));_0xf5ea1c[_0x5027('0x48')](get_open_tabs(_0x5027('0x4f'),_0x40d1a9['rows'][_0x130f8a][_0x5027('0x4e')]));_0xf5ea1c[_0x5027('0x48')](get_open_tabs('fax',_0x40d1a9[_0x5027('0x4a')][_0x130f8a][_0x5027('0x4e')]));_0xf5ea1c[_0x5027('0x48')](get_open_tabs(_0x5027('0x50'),_0x40d1a9[_0x5027('0x4a')][_0x130f8a][_0x5027('0x4e')]));_0xf5ea1c[_0x5027('0x48')](get_open_tabs(_0x5027('0x51'),_0x40d1a9[_0x5027('0x4a')][_0x130f8a][_0x5027('0x4e')]));_0xf5ea1c[_0x5027('0x48')](get_open_tabs('whatsapp',_0x40d1a9[_0x5027('0x4a')][_0x130f8a][_0x5027('0x4e')]));}return Promise[_0x5027('0x52')](_0xf5ea1c)[_0x5027('0x16')](function(){return _0x40d1a9;});}else{return _0x40d1a9;}})[_0x5027('0x16')](respondWithFilteredResult(_0x49f327,_0x202881))[_0x5027('0x1e')](handleError(_0x49f327,null));};exports['show']=function(_0x4f3ca0,_0x46ccaf){var _0x15511d={'raw':![],'where':{'id':_0x4f3ca0[_0x5027('0x53')]['id']}},_0x1c6285={};_0x1c6285[_0x5027('0x54')]=_[_0x5027('0x55')](_[_0x5027('0x56')](db['User'][_0x5027('0x57')]),[_0x5027('0x3e'),'salt']);_0x1c6285['query']=_['keys'](_0x4f3ca0['query']);_0x1c6285['filters']=_[_0x5027('0x58')](_0x1c6285[_0x5027('0x54')],_0x1c6285[_0x5027('0x42')]);_0x15511d[_0x5027('0x47')]=_[_0x5027('0x58')](_0x1c6285[_0x5027('0x54')],qs['fields'](_0x4f3ca0[_0x5027('0x42')][_0x5027('0x59')]));_0x15511d[_0x5027('0x47')]=_0x15511d[_0x5027('0x47')][_0x5027('0x4c')]?_0x15511d[_0x5027('0x47')]:_0x1c6285[_0x5027('0x54')];if(_0x4f3ca0['query']['includeAll']){_0x15511d[_0x5027('0x44')]=[{'all':!![]}];}if(_0x4f3ca0[_0x5027('0x42')]['userSetting']===_0x5027('0x46')){_0x15511d[_0x5027('0x44')]=[{'model':db[_0x5027('0x5a')],'as':_0x5027('0x45')}];}_0x15511d=_[_0x5027('0x5b')]({},_0x15511d,_0x4f3ca0[_0x5027('0x5c')]);if(!_[_0x5027('0x36')](_0x15511d[_0x5027('0x47')],'id')){_0x15511d[_0x5027('0x47')][_0x5027('0x48')]('id');}return db[_0x5027('0x41')][_0x5027('0x37')](_0x15511d)[_0x5027('0x16')](handleEntityNotFound(_0x46ccaf,null))[_0x5027('0x16')](function(_0xdc38de){var _0x102279=[];values=_0xdc38de;if(_0x4f3ca0[_0x5027('0x42')][_0x5027('0x4b')]===_0x5027('0x46')){_0x102279[_0x5027('0x48')](get_open_tabs(_0x5027('0x4d'),_0xdc38de[_0x5027('0x4e')]));_0x102279[_0x5027('0x48')](get_open_tabs(_0x5027('0x4f'),_0xdc38de[_0x5027('0x4e')]));_0x102279[_0x5027('0x48')](get_open_tabs('openchannel',_0xdc38de[_0x5027('0x4e')]));_0x102279[_0x5027('0x48')](get_open_tabs(_0x5027('0x5d'),_0xdc38de['dataValues']));_0x102279[_0x5027('0x48')](get_open_tabs(_0x5027('0x5e'),_0xdc38de[_0x5027('0x4e')]));_0x102279['push'](get_open_tabs(_0x5027('0x50'),_0xdc38de[_0x5027('0x4e')]));return Promise[_0x5027('0x52')](_0x102279);}else{return values;}})[_0x5027('0x16')](function(){return values;})[_0x5027('0x16')](respondWithResult(_0x46ccaf,null))[_0x5027('0x1e')](handleError(_0x46ccaf,null));};exports[_0x5027('0x29')]=function(_0x117d40,_0x587490){if(_0x117d40[_0x5027('0x5f')]['id']){delete _0x117d40[_0x5027('0x5f')]['id'];}delete _0x117d40[_0x5027('0x5f')][_0x5027('0x2a')];return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x117d40[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x587490,null))[_0x5027('0x16')](saveUpdates(_0x117d40['body'],null))['then'](respondWithResult(_0x587490,null))['catch'](handleError(_0x587490,null));};exports[_0x5027('0x60')]=function(_0x54279c,_0x513754){return db['User'][_0x5027('0x60')]()[_0x5027('0x16')](respondWithResult(_0x513754,null))[_0x5027('0x1e')](handleError(_0x513754,null));};exports[_0x5027('0x61')]=function(_0x133644,_0x5ad478){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x133644[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x5ad478,null))[_0x5027('0x16')](function(_0x4d911b){if(_0x4d911b){return _0x4d911b['addContacts'](_0x133644[_0x5027('0x5f')][_0x5027('0x62')],_[_0x5027('0x63')](_0x133644[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{});}})[_0x5027('0x16')](respondWithResult(_0x5ad478,null))['catch'](handleError(_0x5ad478,null));};function validateUser(_0xbae019){return new Promise(function(_0x14b9c9,_0x4dcd34){if(_0xbae019[_0x5027('0x64')])return _0x14b9c9(_0xbae019);return db['Setting'][_0x5027('0x65')](0x1)[_0x5027('0x16')](function(_0x38d491){if(_0x38d491[_0x5027('0x66')])authService[_0x5027('0x67')](_0xbae019[_0x5027('0x3e')]);db['User'][_0x5027('0x68')]('internal')['then'](function(_0x4128ff){if(_['isNil'](_0x4128ff)){_0xbae019[_0x5027('0x64')]=_0x38d491[_0x5027('0x69')]||0x1;return;}if(_[_0x5027('0x6a')](_0x38d491[_0x5027('0x69')])||_0x38d491[_0x5027('0x69')]===_0x4128ff){_0xbae019[_0x5027('0x64')]=_0x4128ff+0x1;return;}if(_0x38d491[_0x5027('0x69')]>_0x4128ff){_0xbae019[_0x5027('0x64')]=_0x38d491['min_internal'];return;}return db[_0x5027('0x6b')][_0x5027('0x42')](_0x5027('0x6c'),{'type':db[_0x5027('0x6b')][_0x5027('0x6d')][_0x5027('0x6e')]})['then'](function(_0x55a1f5){if(_0x55a1f5&&_0x55a1f5['length']){for(var _0x14b0c5=0x0,_0x18a35e=_0x55a1f5[_0x5027('0x4c')];_0x14b0c5<_0x18a35e&&_[_0x5027('0x6a')](_0xbae019[_0x5027('0x64')]);_0x14b0c5++){if(_0x38d491[_0x5027('0x69')]<=_0x55a1f5[_0x14b0c5]['from']){_0xbae019['internal']=_0x55a1f5[_0x14b0c5][_0x5027('0x6f')];}else if(_0x38d491['min_internal']>_0x55a1f5[_0x14b0c5][_0x5027('0x6f')]&&_0x38d491['min_internal']<=_0x55a1f5[_0x14b0c5]['to']){_0xbae019[_0x5027('0x64')]=_0x38d491[_0x5027('0x69')];}}}if(_[_0x5027('0x6a')](_0xbae019[_0x5027('0x64')])){_0xbae019[_0x5027('0x64')]=_0x4128ff+0x1;}return _0x14b9c9(_0xbae019);});});})[_0x5027('0x1e')](function(_0x2b2af4){_0x4dcd34(_0x2b2af4);});});}function updateUser(_0x4da57b){return new Promise(function(_0x38774e,_0x3c87b8){try{if(_0x4da57b[_0x5027('0x70')]){_0x4da57b[_0x5027('0x71')]=_0x4da57b[_0x5027('0x64')];_0x4da57b[_0x5027('0x72')]={'mailbox':_0x4da57b[_0x5027('0x64')],'password':_0x4da57b[_0x5027('0x3e')],'fullname':_0x4da57b[_0x5027('0x73')],'email':_0x4da57b[_0x5027('0x74')]};}if(_0x4da57b[_0x5027('0x2a')]==='agent'){if(!_0x4da57b[_0x5027('0x75')])_0x4da57b['permissions']=[_0x5027('0x76'),_0x5027('0x77'),_0x5027('0x78'),_0x5027('0x79'),_0x5027('0x7a'),_0x5027('0x7b'),'105',_0x5027('0x7c'),'107',_0x5027('0x7d'),_0x5027('0x7e'),_0x5027('0x7f'),_0x5027('0x80'),_0x5027('0x81'),_0x5027('0x82')];}_0x38774e(_0x4da57b);}catch(_0xb08cf2){_0x3c87b8(_0xb08cf2);}});}exports[_0x5027('0x83')]=function(_0x554c13,_0x11f7bd){if(_0x554c13[_0x5027('0x2f')][_0x5027('0x2a')]===_0x5027('0x84'))throw new Error('Unauthorized');if(_0x554c13[_0x5027('0x5f')][_0x5027('0x2a')]===_0x5027('0x2f')&&_0x554c13[_0x5027('0x2f')][_0x5027('0x2a')]!==_0x5027('0x85')){throw new Error(_0x5027('0x86'));}if(_0x554c13['body'][_0x5027('0x2a')]==='admin'&&_0x554c13[_0x5027('0x2f')]['role']!==_0x5027('0x85')){throw new Error(_0x5027('0x87'));}return licenseUtil[_0x5027('0x88')]([_0x554c13[_0x5027('0x5f')]])[_0x5027('0x16')](function(){return validateUser(_0x554c13[_0x5027('0x5f')]);})[_0x5027('0x16')](function(_0x3a0983){return updateUser(_0x3a0983)[_0x5027('0x16')](function(_0x375b5d){if(_0x375b5d[_0x5027('0x2a')]===_0x5027('0x85')){_0x375b5d[_0x5027('0x89')]=_0x554c13[_0x5027('0x2f')][_0x5027('0x89')];delete _0x375b5d['userProfileId'];}return _0x375b5d;});})['then'](function(_0x9b6261){return db[_0x5027('0x41')]['create'](_0x9b6261,{'include':[{'model':db[_0x5027('0x72')],'as':_0x5027('0x72')}]});})[_0x5027('0x16')](function(_0x51ebd8){if(_0x554c13[_0x5027('0x5f')][_0x5027('0x2a')]===_0x5027('0x2f'))return _0x51ebd8;if(_0x554c13[_0x5027('0x2f')][_0x5027('0x2a')]!=='user')return _0x51ebd8;return db[_0x5027('0x8a')][_0x5027('0x37')]({'where':{'name':_0x51ebd8['role']===_0x5027('0x84')?'Agents':'Telephones','userProfileId':_0x554c13['user']['userProfileId']},'raw':!![]})['then'](function(_0x4899d1){if(!_0x4899d1||_0x4899d1[_0x5027('0x8b')]!=0x0)return _0x51ebd8;return db[_0x5027('0x8c')][_0x5027('0x83')]({'name':_0x51ebd8[_0x5027('0x38')],'resourceId':_0x51ebd8['id'],'type':_0x4899d1[_0x5027('0x38')],'sectionId':_0x4899d1['id']},{})[_0x5027('0x16')](function(){return _0x51ebd8;});})['catch'](function(_0x4813ef){logger[_0x5027('0x1a')](_0x5027('0x8d'),_0x4813ef);throw _0x4813ef;});})[_0x5027('0x16')](respondWithResult(_0x11f7bd,0xc9))[_0x5027('0x1e')](handleError(_0x11f7bd,null));};exports['bulkCreate']=function(_0x126b3b,_0x25ad74){var _0x1dd3d6=_0x126b3b[_0x5027('0x5f')];var _0x4cff7d=[];if(_0x126b3b[_0x5027('0x2f')]['role']===_0x5027('0x84'))throw new Error(_0x5027('0x8e'));if(_[_0x5027('0x8f')](_0x1dd3d6,[_0x5027('0x2a'),'user'])&&_0x126b3b[_0x5027('0x2f')][_0x5027('0x2a')]!==_0x5027('0x85')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x5027('0x8f')](_0x1dd3d6,['role','admin'])&&_0x126b3b[_0x5027('0x2f')][_0x5027('0x2a')]!==_0x5027('0x85')){throw new Error(_0x5027('0x90'));}return licenseUtil[_0x5027('0x88')](_0x1dd3d6)['then'](function(){return validateUser(_0x1dd3d6[0x0]);})['then'](function(){for(var _0x90b63=0x1;_0x90b63<_0x1dd3d6['length'];_0x90b63++){var _0x1c0626=_0x1dd3d6[_0x90b63-0x1]['internal'];if(!_0x1dd3d6[_0x90b63][_0x5027('0x64')])_0x1dd3d6[_0x90b63][_0x5027('0x64')]=_0x1c0626+0x1;_0x4cff7d[_0x5027('0x48')](validateUser(_0x1dd3d6[_0x90b63]));}return Promise[_0x5027('0x52')](_0x4cff7d);})[_0x5027('0x16')](function(){_0x4cff7d=[];for(var _0xbe3422=0x0;_0xbe3422<_0x1dd3d6[_0x5027('0x4c')];_0xbe3422++){_0x4cff7d[_0x5027('0x48')](updateUser(_0x1dd3d6[_0xbe3422]));}return Promise[_0x5027('0x52')](_0x4cff7d);})['then'](function(){_0x4cff7d=_0x1dd3d6[_0x5027('0x34')](function(_0x5cba){return db[_0x5027('0x41')][_0x5027('0x83')](_0x5cba,{'include':[{'model':db[_0x5027('0x72')],'as':_0x5027('0x72')}]})['then'](function(_0xf07a30){_0x5cba['id']=_0xf07a30['id'];return _0x5cba;});});return Promise[_0x5027('0x52')](_0x4cff7d);})[_0x5027('0x16')](function(_0x2a17aa){if(_0x126b3b[_0x5027('0x5f')]['role']===_0x5027('0x2f'))return _0x2a17aa;if(_0x126b3b['user'][_0x5027('0x2a')]!=='user')return _0x2a17aa;var _0x47cf16=_[_0x5027('0x8f')](_0x2a17aa,function(_0x1083e7){return _0x1083e7[_0x5027('0x2a')]===_0x5027('0x84')||_0x1083e7[_0x5027('0x2a')]===_0x5027('0x31');});if(!_0x47cf16)return _0x2a17aa;return db[_0x5027('0x8a')][_0x5027('0x49')]({'where':{'name':{'$or':['Agents',_0x5027('0x91')]},'userProfileId':_0x126b3b[_0x5027('0x2f')][_0x5027('0x92')]},'raw':!![]})[_0x5027('0x16')](function(_0x2e4155){if(_['isEmpty'](_0x2e4155)||!_[_0x5027('0x8f')](_0x2e4155,[_0x5027('0x8b'),0x0]))return _0x2a17aa;_0x4cff7d=[];var _0x48a43e=_(_0x2e4155)[_0x5027('0x34')](function(_0x441acd){if(_0x441acd[_0x5027('0x8b')]===0x1)return;return _0x441acd[_0x5027('0x38')]===_0x5027('0x30')?_0x5027('0x84'):_0x5027('0x31');})[_0x5027('0x93')]()[_0x5027('0x35')]();for(var _0x2a5360=0x0;_0x2a5360<_0x2a17aa[_0x5027('0x4c')];_0x2a5360++){if(!_['includes'](_0x48a43e,_0x2a17aa[_0x2a5360]['role']))return;var _0x2a2124=_0x2a17aa[_0x2a5360][_0x5027('0x2a')]===_0x5027('0x84')?_0x5027('0x30'):'Telephones';_0x4cff7d[_0x5027('0x48')](db[_0x5027('0x8c')][_0x5027('0x83')]({'name':_0x2a17aa[_0x2a5360][_0x5027('0x38')],'resourceId':_0x2a17aa[_0x2a5360]['id'],'type':_0x2a2124,'sectionId':_['find'](_0x2e4155,[_0x5027('0x38'),_0x2a2124])['id']},{}));}return Promise[_0x5027('0x52')](_0x4cff7d);});})['then'](respondWithResult(_0x25ad74,0xc9))[_0x5027('0x1e')](handleError(_0x25ad74,null));};exports['changePassword']=function(_0x6f9591,_0x462a10){if(_0x6f9591[_0x5027('0x5f')]['id']){delete _0x6f9591['body']['id'];}return db[_0x5027('0x41')]['find']({'where':{'id':_0x6f9591['params']['id']}})[_0x5027('0x16')](function(_0x43aafd){if(!_0x43aafd)return null;if(_0x43aafd['id']===_0x6f9591[_0x5027('0x2f')]['id']){if(!_0x6f9591[_0x5027('0x5f')]['oldPassword']||!_0x6f9591['body']['newPassword']){throw new db[(_0x5027('0x94'))][(_0x5027('0x95'))](_0x5027('0x96'));}if(!_0x43aafd[_0x5027('0x97')](_0x6f9591[_0x5027('0x5f')][_0x5027('0x98')])){throw new db[(_0x5027('0x94'))]['ValidationError'](_0x5027('0x99'));}if(_0x6f9591[_0x5027('0x5f')][_0x5027('0x98')]===_0x6f9591[_0x5027('0x5f')]['newPassword']){throw new db['Sequelize'][(_0x5027('0x95'))](_0x5027('0x9a'));}}else if(_0x6f9591['user'][_0x5027('0x2a')]===_0x5027('0x85')){if(!_0x6f9591[_0x5027('0x5f')]['newPassword']){throw new db[(_0x5027('0x94'))][(_0x5027('0x95'))](_0x5027('0x9b'));}}else if(_0x6f9591[_0x5027('0x2f')]['role']==='user'){if(!_0x6f9591['body']['newPassword']){throw new db[(_0x5027('0x94'))][(_0x5027('0x95'))](_0x5027('0x9b'));}if(_0x43aafd[_0x5027('0x2a')]!=='agent'){throw new db['Sequelize'][(_0x5027('0x95'))](_0x5027('0x8e'));}}else{throw new db[(_0x5027('0x94'))]['ValidationError'](_0x5027('0x8e'));}return _0x43aafd;})[_0x5027('0x16')](handleEntityNotFound(_0x462a10,null))['then'](function(_0x3405b0){return db['Setting'][_0x5027('0x9c')]({'attributes':['id',_0x5027('0x66'),'enforcePasswordHistory',_0x5027('0x9d')]})[_0x5027('0x16')](function(_0x36e865){if(_0x36e865['securePassword'])authService[_0x5027('0x67')](_0x6f9591['body'][_0x5027('0x9e')]);if(!_0x36e865[_0x5027('0x9f')]||!_0x3405b0[_0x5027('0xa0')])return _0x3405b0;authService[_0x5027('0xa1')](_0x6f9591[_0x5027('0x5f')][_0x5027('0x9e')],_0x3405b0[_0x5027('0xa0')],_0x36e865[_0x5027('0x9d')]);return _0x3405b0;})['then'](saveUpdates({'password':_0x6f9591[_0x5027('0x5f')]['newPassword'],'passwordResetAt':_0x6f9591[_0x5027('0x2f')]['id']==_0x6f9591[_0x5027('0x53')]['id']?moment():null,'previousPasswords':authService[_0x5027('0xa2')](_0x6f9591[_0x5027('0x5f')][_0x5027('0x9e')],_0x3405b0[_0x5027('0xa0')])},null));})[_0x5027('0x16')](respondWithResult(_0x462a10,null))['catch'](handleError(_0x462a10,null));};exports['addQueues']=function(_0x548157,_0x58979d){var _0x5b67a0=_0x548157[_0x5027('0x5f')]['channel'];return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x548157[_0x5027('0x53')]['id']},'attributes':['id',_0x5027('0x38'),_0x5027('0x2a'),_0x5027('0xa3'),'loginInPause','voicePause','interface']})['then'](handleEntityNotFound(_0x58979d,null))[_0x5027('0x16')](function(_0x3f1c23){if(_0x3f1c23){if(!utils[_0x5027('0xa4')](_0x5b67a0)){throw new db['Sequelize'][(_0x5027('0x95'))]('Unknown\x20channel');}return _0x3f1c23['add'+_['capitalize'](_0x5b67a0['toLowerCase']())+_0x5027('0xa5')](_0x548157[_0x5027('0x5f')]['ids'],{'penalty':_0x548157[_0x5027('0x5f')][_0x5027('0xa6')]||0x0})['spread'](function(_0x43a50d){for(var _0x534ffc=0x0;_0x534ffc<_0x548157['body'][_0x5027('0x62')][_0x5027('0x4c')];_0x534ffc+=0x1){var _0x4c8f08={'UserId':Number(_0x548157[_0x5027('0x53')]['id'])};_0x4c8f08[_['capitalize'](_0x5b67a0['toLowerCase']())+_0x5027('0xa7')]=Number(_0x548157[_0x5027('0x5f')]['ids'][_0x534ffc]);socket[_0x5027('0xa8')](_0x5027('0x2f')+_['capitalize'](_0x5b67a0[_0x5027('0xa9')]())+_0x5027('0xaa'),_0x4c8f08);}return _0x43a50d;})[_0x5027('0x16')](function(){if(_0x5b67a0===_0x5027('0xab')){return db[_0x5027('0xac')]['findAll']({'where':{'id':_0x548157[_0x5027('0x5f')][_0x5027('0x62')]||[]},'raw':!![],'attributes':['id',_0x5027('0x38')]});}})[_0x5027('0x16')](function(_0x1aea24){var _0x375cbf=_0x3f1c23[_0x5027('0x2d')]({'plain':!![]});var _0x5375f0=[];if(_0x5b67a0===_0x5027('0xab')&&_0x375cbf[_0x5027('0x2a')]===_0x5027('0x84')&&_0x375cbf[_0x5027('0xa3')]){for(let _0x25a52d=0x0;_0x25a52d<_0x1aea24[_0x5027('0x4c')];_0x25a52d+=0x1){_0x5375f0[_0x5027('0x48')]({'membername':_0x375cbf[_0x5027('0x38')],'UserId':_0x375cbf['id'],'queue_name':_0x1aea24[_0x25a52d]['name'],'VoiceQueueId':_0x1aea24[_0x25a52d]['id'],'interface':_[_0x5027('0x6a')](_0x375cbf[_0x5027('0xad')])?util[_0x5027('0xae')](_0x5027('0xaf'),_0x375cbf['name']):_0x375cbf[_0x5027('0xad')],'paused':_0x375cbf['voicePause']||![],'penalty':_0x548157[_0x5027('0x5f')]['penalty']||0x0});}return Promise[_0x5027('0x52')](_0x5375f0['map'](function(_0x1f5307){return db['UserVoiceQueueRt']['upsert'](_0x1f5307);}));}return _0x3f1c23;});}})[_0x5027('0x16')](respondWithStatusCode(_0x58979d,null))[_0x5027('0x1e')](handleError(_0x58979d,null));};exports['removeQueues']=function(_0xafe6cb,_0x4f05ec){var _0x36b16c,_0x2896f8;return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0xafe6cb[_0x5027('0x53')]['id']},'attributes':['id','name',_0x5027('0x2a')]})[_0x5027('0x16')](handleEntityNotFound(_0x4f05ec,null))[_0x5027('0x16')](function(_0x4eac83){if(_0x4eac83){_0x36b16c=_0x4eac83;if(!_0xafe6cb[_0x5027('0x42')][_0x5027('0xb0')]||!utils[_0x5027('0xa4')](_0xafe6cb[_0x5027('0x42')][_0x5027('0xb0')])){throw new db['Sequelize'][(_0x5027('0x95'))](_0x5027('0xb1'));}return _0x4eac83[_0x5027('0xb2')+_[_0x5027('0xb3')](_0xafe6cb[_0x5027('0x42')][_0x5027('0xb0')][_0x5027('0xa9')]())+_0x5027('0xa5')](_0xafe6cb[_0x5027('0x42')][_0x5027('0x62')]);}})['then'](function(_0x197b49){if(_[_0x5027('0xb4')](_0xafe6cb[_0x5027('0x42')][_0x5027('0x62')])){for(var _0x26f376=0x0;_0x26f376<_0xafe6cb[_0x5027('0x42')][_0x5027('0x62')]['length'];_0x26f376+=0x1){_0x2896f8={'UserId':Number(_0xafe6cb[_0x5027('0x53')]['id'])};_0x2896f8[_[_0x5027('0xb3')](_0xafe6cb[_0x5027('0x42')][_0x5027('0xb0')][_0x5027('0xa9')]())+_0x5027('0xa7')]=Number(_0xafe6cb['query'][_0x5027('0x62')][_0x26f376]);socket[_0x5027('0xa8')]('user'+_[_0x5027('0xb3')](_0xafe6cb['query'][_0x5027('0xb0')]['toLowerCase']())+_0x5027('0xb5'),_0x2896f8);}}else{_0x2896f8={'UserId':Number(_0xafe6cb[_0x5027('0x53')]['id'])};_0x2896f8[_['capitalize'](_0xafe6cb[_0x5027('0x42')]['channel'][_0x5027('0xa9')]())+'QueueId']=Number(_0xafe6cb[_0x5027('0x42')][_0x5027('0x62')]);socket['emit'](_0x5027('0x2f')+_[_0x5027('0xb3')](_0xafe6cb[_0x5027('0x42')][_0x5027('0xb0')]['toLowerCase']())+_0x5027('0xb5'),_0x2896f8);}return _0x197b49;})[_0x5027('0x16')](function(){if(_0xafe6cb['query'][_0x5027('0xb0')]===_0x5027('0xab')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0xafe6cb[_0x5027('0x53')]['id'],'VoiceQueueId':_0xafe6cb[_0x5027('0x42')][_0x5027('0x62')]},'individualHooks':!![]})['then'](function(){return _0x36b16c;});}return _0x36b16c;})[_0x5027('0x16')](respondWithStatusCode(_0x4f05ec,null))[_0x5027('0x1e')](handleError(_0x4f05ec,null));};exports[_0x5027('0xb6')]=function(_0x57f491,_0x93a65){_0x57f491[_0x5027('0x5f')][_0x5027('0xb7')]=_0x57f491[_0x5027('0xb8')]['filename'];return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x57f491[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x93a65,null))['then'](saveUpdates(_0x57f491[_0x5027('0x5f')],null))[_0x5027('0x16')](respondWithResult(_0x93a65,null))[_0x5027('0x1e')](handleError(_0x93a65,null));};exports[_0x5027('0xb9')]=function(_0x405677,_0x2a3e8f){var _0x3dc953=path[_0x5027('0xba')](config[_0x5027('0xbb')],_0x5027('0xbc'));return db['User']['find']({'where':{'id':_0x405677[_0x5027('0x53')]['id']},'attributes':['id',_0x5027('0xb7')],'raw':!![]})[_0x5027('0x16')](handleEntityNotFound(_0x2a3e8f,null))[_0x5027('0x16')](function(_0x1a8b33){if(_0x1a8b33){if(_[_0x5027('0x6a')](_0x1a8b33[_0x5027('0xb7')])){return _0x2a3e8f[_0x5027('0xbd')](_0x3dc953);}else{if(!fs['existsSync'](path['join'](config['root'],_0x5027('0xbe'),_0x1a8b33[_0x5027('0xb7')]))){return _0x2a3e8f['download'](_0x3dc953);}return _0x2a3e8f[_0x5027('0xbd')](path['join'](config['root'],_0x5027('0xbe'),_0x1a8b33['userpic']));}}})['catch'](handleError(_0x2a3e8f,null));};exports[_0x5027('0xbf')]=function(_0x31c44e,_0x33a3ca){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x31c44e['params']['id']},'attributes':['id']})[_0x5027('0x16')](handleEntityNotFound(_0x33a3ca,null))[_0x5027('0x16')](function(_0x897337){var _0x2f4d3c=[];values=_0x897337[_0x5027('0x4e')];_0x2f4d3c[_0x5027('0x48')](get_open_tabs('chat',_0x897337[_0x5027('0x4e')]));_0x2f4d3c[_0x5027('0x48')](get_open_tabs(_0x5027('0x4f'),_0x897337[_0x5027('0x4e')]));_0x2f4d3c[_0x5027('0x48')](get_open_tabs(_0x5027('0x51'),_0x897337[_0x5027('0x4e')]));_0x2f4d3c[_0x5027('0x48')](get_open_tabs(_0x5027('0x5d'),_0x897337[_0x5027('0x4e')]));_0x2f4d3c[_0x5027('0x48')](get_open_tabs(_0x5027('0x5e'),_0x897337['dataValues']));_0x2f4d3c['push'](get_open_tabs(_0x5027('0x50'),_0x897337[_0x5027('0x4e')]));return Promise[_0x5027('0x52')](_0x2f4d3c);})['then'](function(_0x3a6f5e){if(_0x3a6f5e){var _0x12e4be=_[_0x5027('0x34')](values[_0x5027('0xc0')],function(_0x1aa103){return{'channel':'CHAT','id':_0x1aa103['id'],'createdAt':_0x1aa103[_0x5027('0xc1')]};});var _0x190be7=_['map'](values[_0x5027('0xc2')],function(_0x29a803){return{'channel':_0x5027('0xc3'),'id':_0x29a803['id'],'createdAt':_0x29a803['createdAt']};});var _0x477cb3=_['map'](values[_0x5027('0xc4')],function(_0x41b3d6){return{'channel':_0x5027('0xc5'),'id':_0x41b3d6['id'],'createdAt':_0x41b3d6[_0x5027('0xc1')]};});var _0x38d898=_[_0x5027('0x34')](values[_0x5027('0xc6')],function(_0x421ed8){return{'channel':_0x5027('0xc7'),'id':_0x421ed8['id'],'createdAt':_0x421ed8[_0x5027('0xc1')]};});var _0x5f047d=_[_0x5027('0x34')](values[_0x5027('0xc8')],function(_0x55d191){return{'channel':_0x5027('0xc9'),'id':_0x55d191['id'],'createdAt':_0x55d191[_0x5027('0xc1')]};});var _0x2b9ac8=_[_0x5027('0x34')](values[_0x5027('0xca')],function(_0xc8bfa7){return{'channel':_0x5027('0xcb'),'id':_0xc8bfa7['id'],'createdAt':_0xc8bfa7['createdAt']};});var _0x114e4c=_[_0x5027('0xcc')](_0x12e4be,_0x190be7,_0x477cb3,_0x38d898,_0x5f047d,_0x2b9ac8);var _0x5853a9={'count':_0x114e4c['length'],'rows':_0x114e4c};return _0x5853a9;}else return null;})[_0x5027('0x16')](respondWithResult(_0x33a3ca,null))[_0x5027('0x1e')](handleError(_0x33a3ca,null));};exports[_0x5027('0xcd')]=function(_0xf4a823,_0x11cc4d){var _0x184aa5={};var _0x38b8cd={};var _0x1464e5;var _0x2a3bae;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0xf4a823[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x11cc4d,null))[_0x5027('0x16')](function(_0x449a32){if(_0x449a32){_0x1464e5=_0x449a32;_0x38b8cd[_0x5027('0x54')]=_[_0x5027('0x56')](db['CmContact'][_0x5027('0x57')]);_0x38b8cd[_0x5027('0x42')]=_['keys'](_0xf4a823['query']);_0x38b8cd['filters']=_[_0x5027('0x58')](_0x38b8cd[_0x5027('0x54')],_0x38b8cd[_0x5027('0x42')]);_0x184aa5[_0x5027('0x47')]=_[_0x5027('0x58')](_0x38b8cd[_0x5027('0x54')],qs['fields'](_0xf4a823[_0x5027('0x42')]['fields']));_0x184aa5[_0x5027('0x47')]=_0x184aa5[_0x5027('0x47')][_0x5027('0x4c')]?_0x184aa5[_0x5027('0x47')]:_0x38b8cd['model'];_0x184aa5['order']=qs[_0x5027('0xce')](_0xf4a823['query'][_0x5027('0xce')]);_0x184aa5[_0x5027('0x40')]=qs['filters'](_['pick'](_0xf4a823['query'],_0x38b8cd[_0x5027('0xcf')]));if(_0xf4a823[_0x5027('0x42')][_0x5027('0x32')]){_0x184aa5[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x184aa5[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x184aa5['attributes'],function(_0x1664f4){var _0xbe7c2a={};_0xbe7c2a[_0x1664f4]={'$like':'%'+_0xf4a823[_0x5027('0x42')]['filter']+'%'};return _0xbe7c2a;})});}_0x184aa5=_[_0x5027('0x5b')]({},_0x184aa5,_0xf4a823[_0x5027('0x5c')]);return _0x1464e5[_0x5027('0xcd')](_0x184aa5);}})[_0x5027('0x16')](function(_0x60b168){if(_0x60b168){_0x2a3bae=_0x60b168['length'];if(_0xf4a823[_0x5027('0x42')][_0x5027('0xd0')](_0x5027('0x43'))){_0x184aa5[_0x5027('0x44')]=[{'model':db[_0x5027('0xd1')],'as':'List','required':![]},{'model':db[_0x5027('0xd2')],'as':_0x5027('0xd3'),'attributes':['id',_0x5027('0x38'),_0x5027('0xd4')],'where':_0xf4a823[_0x5027('0x42')][_0x5027('0xd5')]?{'id':_0xf4a823[_0x5027('0x42')][_0x5027('0xd5')]}:undefined,'required':_0xf4a823['query'][_0x5027('0xd5')]?!![]:![]}];}if(!_0xf4a823[_0x5027('0x42')][_0x5027('0xd0')](_0x5027('0xd6'))){_0x184aa5[_0x5027('0x25')]=qs[_0x5027('0x25')](_0xf4a823[_0x5027('0x42')][_0x5027('0x25')]);_0x184aa5[_0x5027('0x23')]=qs[_0x5027('0x23')](_0xf4a823['query']['offset']);}return _0x1464e5[_0x5027('0xcd')](_0x184aa5);}})['then'](function(_0x4b5ccf){if(_0x4b5ccf){return _0x4b5ccf?{'count':_0x2a3bae,'rows':_0x4b5ccf}:null;}})[_0x5027('0x16')](respondWithResult(_0x11cc4d,null))[_0x5027('0x1e')](handleError(_0x11cc4d,null));};exports[_0x5027('0xd7')]=function(_0x314d12,_0x1d8dfe){var _0x13c2da;var _0x5b5741={};var _0x56b1a2;return db['User'][_0x5027('0x9c')]({'where':{'id':_0x314d12[_0x5027('0x53')]['id']},'attributes':['id',_0x5027('0x38'),_0x5027('0x2a')]})[_0x5027('0x16')](handleEntityNotFound(_0x1d8dfe,null))[_0x5027('0x16')](function(_0x3d3fdf){if(!utils[_0x5027('0xa4')](_0x314d12['query']['channel'])){throw new db[(_0x5027('0x94'))]['ValidationError'](_0x5027('0xb1'));}_0x13c2da=_0x3d3fdf;var _0x2f4a58={};_0x2f4a58[_0x5027('0x54')]=_[_0x5027('0x56')](db[_[_0x5027('0xb3')](_0x314d12['query'][_0x5027('0xb0')])+'Queue'][_0x5027('0x57')]);_0x2f4a58[_0x5027('0x42')]=_[_0x5027('0x56')](_0x314d12[_0x5027('0x42')]);_0x2f4a58['filters']=_['intersection'](_0x2f4a58[_0x5027('0x54')],_0x2f4a58[_0x5027('0x42')]);_0x5b5741['attributes']=_[_0x5027('0x58')](_0x2f4a58['model'],qs[_0x5027('0x59')](_0x314d12['query'][_0x5027('0x59')]));_0x5b5741[_0x5027('0x47')]=_0x5b5741[_0x5027('0x47')][_0x5027('0x4c')]?_0x5b5741[_0x5027('0x47')]:_0x2f4a58[_0x5027('0x54')];_0x5b5741['order']=qs[_0x5027('0xce')](_0x314d12[_0x5027('0x42')][_0x5027('0xce')]);_0x5b5741[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x314d12['query'],_0x2f4a58[_0x5027('0xcf')]));if(_0x314d12['query']['filter']){_0x5b5741[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x5b5741['where'],{'$or':_['map'](_0x5b5741[_0x5027('0x47')],function(_0x3df77b){var _0x4faf9a={};_0x4faf9a[_0x3df77b]={'$like':'%'+_0x314d12['query'][_0x5027('0x32')]+'%'};return _0x4faf9a;})});}_0x5b5741=_['merge']({},_0x5b5741,_0x314d12[_0x5027('0x5c')]);switch(_0x13c2da['role']){case'admin':return db[_['capitalize'](_0x314d12[_0x5027('0x42')][_0x5027('0xb0')])+_0x5027('0xd9')]['findAll'](_0x5b5741);case _0x5027('0x2f'):case'agent':return _0x13c2da['get'+_['capitalize'](_0x314d12['query']['channel'])+_0x5027('0xa5')](_0x5b5741);default:throw new db['Sequelize'][(_0x5027('0x95'))](_0x5027('0xda'));}})[_0x5027('0x16')](function(_0x934677){_0x56b1a2=_0x934677[_0x5027('0x4c')];if(!_0x314d12[_0x5027('0x42')][_0x5027('0xd0')](_0x5027('0xd6'))){_0x5b5741['limit']=qs[_0x5027('0x25')](_0x314d12[_0x5027('0x42')][_0x5027('0x25')]);_0x5b5741[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x314d12['query'][_0x5027('0x23')]);}switch(_0x13c2da[_0x5027('0x2a')]){case _0x5027('0x85'):return db[_[_0x5027('0xb3')](_0x314d12[_0x5027('0x42')][_0x5027('0xb0')])+'Queue'][_0x5027('0x49')](_0x5b5741);case'user':case _0x5027('0x84'):return _0x13c2da[_0x5027('0x2d')+_[_0x5027('0xb3')](_0x314d12[_0x5027('0x42')]['channel'])+_0x5027('0xa5')](_0x5b5741);}})[_0x5027('0x16')](function(_0x2b069a){return{'count':_0x56b1a2,'rows':_0x2b069a};})[_0x5027('0x16')](respondWithResult(_0x1d8dfe,null))['catch'](handleError(_0x1d8dfe,null));};exports['getVoiceQueuesRt']=function(_0x2211bc,_0x2dea77){var _0x5a8372={};var _0x1a7e16={};var _0x463c70;var _0x23973f;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x2211bc[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dea77,null))[_0x5027('0x16')](function(_0x1c6288){if(_0x1c6288){_0x463c70=_0x1c6288;_0x1a7e16[_0x5027('0x54')]=_['keys'](db[_0x5027('0xdb')][_0x5027('0x57')]);_0x1a7e16['query']=_[_0x5027('0x56')](_0x2211bc[_0x5027('0x42')]);_0x1a7e16[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x1a7e16[_0x5027('0x54')],_0x1a7e16[_0x5027('0x42')]);_0x5a8372['attributes']=_['intersection'](_0x1a7e16[_0x5027('0x54')],qs[_0x5027('0x59')](_0x2211bc[_0x5027('0x42')][_0x5027('0x59')]));_0x5a8372[_0x5027('0x47')]=_0x5a8372[_0x5027('0x47')][_0x5027('0x4c')]?_0x5a8372[_0x5027('0x47')]:_0x1a7e16[_0x5027('0x54')];_0x5a8372[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x2211bc['query'][_0x5027('0xce')]);_0x5a8372[_0x5027('0x40')]=qs['filters'](_[_0x5027('0xd8')](_0x2211bc[_0x5027('0x42')],_0x1a7e16[_0x5027('0xcf')]));if(_0x2211bc[_0x5027('0x42')]['filter']){_0x5a8372[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x5a8372[_0x5027('0x40')],{'$or':_['map'](_0x5a8372['attributes'],function(_0x2763bd){var _0x394998={};_0x394998[_0x2763bd]={'$like':'%'+_0x2211bc[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x394998;})});}_0x5a8372=_[_0x5027('0x5b')]({},_0x5a8372,_0x2211bc[_0x5027('0x5c')]);return _0x463c70[_0x5027('0xdd')](_0x5a8372);}})[_0x5027('0x16')](function(_0x1a42d3){if(_0x1a42d3){_0x23973f=_0x1a42d3[_0x5027('0x4c')];if(!_0x2211bc['query']['hasOwnProperty'](_0x5027('0xd6'))){_0x5a8372[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x2211bc[_0x5027('0x42')][_0x5027('0x25')]);_0x5a8372['offset']=qs[_0x5027('0x23')](_0x2211bc[_0x5027('0x42')][_0x5027('0x23')]);}return _0x463c70[_0x5027('0xdd')](_0x5a8372);}})[_0x5027('0x16')](function(_0x542bb9){if(_0x542bb9){return _0x542bb9?{'count':_0x23973f,'rows':_0x542bb9}:null;}})[_0x5027('0x16')](respondWithResult(_0x2dea77,null))[_0x5027('0x1e')](handleError(_0x2dea77,null));};exports[_0x5027('0xde')]=function(_0x11d446,_0x133b7f){var _0x4ced29={};var _0x301de3={};var _0x405f4a;var _0x476e29;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x11d446[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x133b7f,null))[_0x5027('0x16')](function(_0x268751){if(_0x268751){_0x405f4a=_0x268751;_0x301de3['model']=_['keys'](db[_0x5027('0xdf')][_0x5027('0x57')]);_0x301de3[_0x5027('0x42')]=_[_0x5027('0x56')](_0x11d446[_0x5027('0x42')]);_0x301de3['filters']=_[_0x5027('0x58')](_0x301de3['model'],_0x301de3[_0x5027('0x42')]);_0x4ced29[_0x5027('0x47')]=_[_0x5027('0x58')](_0x301de3[_0x5027('0x54')],qs[_0x5027('0x59')](_0x11d446[_0x5027('0x42')][_0x5027('0x59')]));_0x4ced29[_0x5027('0x47')]=_0x4ced29[_0x5027('0x47')][_0x5027('0x4c')]?_0x4ced29[_0x5027('0x47')]:_0x301de3[_0x5027('0x54')];_0x4ced29['order']=qs[_0x5027('0xce')](_0x11d446[_0x5027('0x42')][_0x5027('0xce')]);_0x4ced29[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x11d446[_0x5027('0x42')],_0x301de3[_0x5027('0xcf')]));if(_0x11d446['query'][_0x5027('0x32')]){_0x4ced29['where']=_[_0x5027('0x5b')](_0x4ced29[_0x5027('0x40')],{'$or':_['map'](_0x4ced29[_0x5027('0x47')],function(_0xee7c55){var _0x42aa90={};_0x42aa90[_0xee7c55]={'$like':'%'+_0x11d446[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x42aa90;})});}_0x4ced29=_[_0x5027('0x5b')]({},_0x4ced29,_0x11d446['options']);return _0x405f4a[_0x5027('0xde')](_0x4ced29);}})[_0x5027('0x16')](function(_0x42312e){if(_0x42312e){_0x476e29=_0x42312e[_0x5027('0x4c')];if(!_0x11d446[_0x5027('0x42')]['hasOwnProperty'](_0x5027('0xd6'))){_0x4ced29[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x11d446[_0x5027('0x42')][_0x5027('0x25')]);_0x4ced29[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x11d446[_0x5027('0x42')][_0x5027('0x23')]);}return _0x405f4a['getGroups'](_0x4ced29);}})[_0x5027('0x16')](function(_0xbe0bd7){if(_0xbe0bd7){return _0xbe0bd7?{'count':_0x476e29,'rows':_0xbe0bd7}:null;}})[_0x5027('0x16')](respondWithResult(_0x133b7f,null))[_0x5027('0x1e')](handleError(_0x133b7f,null));};exports[_0x5027('0xe0')]=function(_0x273fb1,_0x42c7fe){var _0x5cf01f={'raw':!![],'where':{}};var _0x3f91ff={};var _0x24f8e7={'count':0x0,'rows':[]};return db[_0x5027('0x41')]['findOne']({'where':{'id':_0x273fb1[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x42c7fe,null))['then'](function(_0x8089e2){if(_0x8089e2){_0x3f91ff[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0xe1')][_0x5027('0x57')]);_0x3f91ff['query']=_['keys'](_0x273fb1['query']);_0x3f91ff['filters']=_[_0x5027('0x58')](_0x3f91ff[_0x5027('0x54')],_0x3f91ff[_0x5027('0x42')]);_0x5cf01f[_0x5027('0x47')]=_[_0x5027('0x58')](_0x3f91ff[_0x5027('0x54')],qs[_0x5027('0x59')](_0x273fb1[_0x5027('0x42')]['fields']));_0x5cf01f['attributes']=_0x5cf01f[_0x5027('0x47')][_0x5027('0x4c')]?_0x5cf01f[_0x5027('0x47')]:_0x3f91ff[_0x5027('0x54')];if(!_0x273fb1['query'][_0x5027('0xd0')]('nolimit')){_0x5cf01f['limit']=qs[_0x5027('0x25')](_0x273fb1['query']['limit']);_0x5cf01f[_0x5027('0x23')]=qs['offset'](_0x273fb1['query']['offset']);}_0x5cf01f['order']=qs['sort'](_0x273fb1[_0x5027('0x42')]['sort']);_0x5cf01f[_0x5027('0x40')]=qs[_0x5027('0xcf')](_['pick'](_0x273fb1[_0x5027('0x42')],_0x3f91ff[_0x5027('0xcf')]));_0x5cf01f['where']['UserId']=_0x8089e2['id'];if(_0x273fb1[_0x5027('0x42')]['filter']){_0x5cf01f[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x5cf01f[_0x5027('0x40')],{'$or':_['map'](_0x5cf01f[_0x5027('0x47')],function(_0x5748d2){var _0x1bf0c2={};_0x1bf0c2[_0x5748d2]={'$like':'%'+_0x273fb1[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x1bf0c2;})});}_0x5cf01f=_[_0x5027('0x5b')]({},_0x5cf01f,_0x273fb1['options']);return db[_0x5027('0xe1')][_0x5027('0x26')]({'where':_0x5cf01f[_0x5027('0x40')]})[_0x5027('0x16')](function(_0x5a057d){_0x24f8e7[_0x5027('0x26')]=_0x5a057d;if(_0x273fb1[_0x5027('0x42')]['includeAll']){_0x5cf01f[_0x5027('0x44')]=[{'all':!![]}];}return db[_0x5027('0xe1')]['findAll'](_0x5cf01f);})[_0x5027('0x16')](function(_0x1b5779){_0x24f8e7[_0x5027('0x4a')]=_0x1b5779;return _0x24f8e7;});}})['then'](respondWithFilteredResult(_0x42c7fe,_0x5cf01f))[_0x5027('0x1e')](handleError(_0x42c7fe,null));};exports[_0x5027('0xe2')]=function(_0x3bdef2,_0x49f719){var _0x523dbf={'raw':!![],'where':{}};var _0xbc011f={};var _0x5e634c={'count':0x0,'rows':[]};return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x3bdef2[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x49f719,null))[_0x5027('0x16')](function(_0x1ef313){if(_0x1ef313){_0xbc011f['model']=_[_0x5027('0x56')](db['ScreenRecording'][_0x5027('0x57')]);_0xbc011f[_0x5027('0x42')]=_['keys'](_0x3bdef2['query']);_0xbc011f[_0x5027('0xcf')]=_[_0x5027('0x58')](_0xbc011f[_0x5027('0x54')],_0xbc011f[_0x5027('0x42')]);_0x523dbf[_0x5027('0x47')]=_['intersection'](_0xbc011f[_0x5027('0x54')],qs[_0x5027('0x59')](_0x3bdef2[_0x5027('0x42')][_0x5027('0x59')]));_0x523dbf[_0x5027('0x47')]=_0x523dbf['attributes'][_0x5027('0x4c')]?_0x523dbf[_0x5027('0x47')]:_0xbc011f['model'];if(!_0x3bdef2[_0x5027('0x42')][_0x5027('0xd0')]('nolimit')){_0x523dbf[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x3bdef2[_0x5027('0x42')][_0x5027('0x25')]);_0x523dbf[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x3bdef2[_0x5027('0x42')]['offset']);}_0x523dbf[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x3bdef2['query'][_0x5027('0xce')]);_0x523dbf[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x3bdef2['query'],_0xbc011f[_0x5027('0xcf')]));_0x523dbf[_0x5027('0x40')][_0x5027('0xe3')]=_0x1ef313['id'];if(_0x3bdef2[_0x5027('0x42')]['filter']){_0x523dbf[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x523dbf[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x523dbf[_0x5027('0x47')],function(_0x35d849){var _0x4c2844={};_0x4c2844[_0x35d849]={'$like':'%'+_0x3bdef2[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x4c2844;})});}_0x523dbf=_[_0x5027('0x5b')]({},_0x523dbf,_0x3bdef2[_0x5027('0x5c')]);return db[_0x5027('0xe4')][_0x5027('0x26')]({'where':_0x523dbf[_0x5027('0x40')]})[_0x5027('0x16')](function(_0x351388){_0x5e634c['count']=_0x351388;if(_0x3bdef2[_0x5027('0x42')][_0x5027('0x43')]){_0x523dbf[_0x5027('0x44')]=[{'all':!![]}];}return db[_0x5027('0xe4')][_0x5027('0x49')](_0x523dbf);})[_0x5027('0x16')](function(_0x3f7137){_0x5e634c[_0x5027('0x4a')]=_0x3f7137;return _0x5e634c;});}})[_0x5027('0x16')](respondWithFilteredResult(_0x49f719,_0x523dbf))['catch'](handleError(_0x49f719,null));};exports[_0x5027('0xe5')]=function(_0x18a3da,_0x2dbd76){var _0x3b698d={};var _0x27cfa0={};var _0x565ed7;var _0x54e924;return db['User'][_0x5027('0x9c')]({'where':{'id':_0x18a3da[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x2dbd76,null))['then'](function(_0x4f3ed0){if(_0x4f3ed0){_0x565ed7=_0x4f3ed0;_0x27cfa0[_0x5027('0x54')]=_[_0x5027('0x56')](db['ChatInteraction']['rawAttributes']);_0x27cfa0[_0x5027('0x42')]=_[_0x5027('0x56')](_0x18a3da['query']);_0x27cfa0[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x27cfa0[_0x5027('0x54')],_0x27cfa0['query']);_0x3b698d[_0x5027('0x47')]=_[_0x5027('0x58')](_0x27cfa0[_0x5027('0x54')],qs['fields'](_0x18a3da[_0x5027('0x42')]['fields']));_0x3b698d[_0x5027('0x47')]=_0x3b698d[_0x5027('0x47')][_0x5027('0x4c')]?_0x3b698d[_0x5027('0x47')]:_0x27cfa0[_0x5027('0x54')];_0x3b698d[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x18a3da[_0x5027('0x42')][_0x5027('0xce')]);_0x3b698d[_0x5027('0x40')]=qs['filters'](_['pick'](_0x18a3da[_0x5027('0x42')],_0x27cfa0[_0x5027('0xcf')]));if(_0x18a3da[_0x5027('0x42')][_0x5027('0x32')]){_0x3b698d[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x3b698d[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x3b698d['attributes'],function(_0x27b382){var _0x63d19c={};_0x63d19c[_0x27b382]={'$like':'%'+_0x18a3da[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x63d19c;})});}_0x3b698d=_['merge']({},_0x3b698d,_0x18a3da[_0x5027('0x5c')]);return _0x565ed7[_0x5027('0xe5')](_0x3b698d);}})['then'](function(_0x5bf77e){if(_0x5bf77e){_0x54e924=_0x5bf77e['length'];if(!_0x18a3da[_0x5027('0x42')][_0x5027('0xd0')]('nolimit')){_0x3b698d[_0x5027('0x25')]=qs['limit'](_0x18a3da[_0x5027('0x42')][_0x5027('0x25')]);_0x3b698d[_0x5027('0x23')]=qs['offset'](_0x18a3da[_0x5027('0x42')][_0x5027('0x23')]);}return _0x565ed7[_0x5027('0xe5')](_0x3b698d);}})[_0x5027('0x16')](function(_0x2fdcb5){if(_0x2fdcb5){return _0x2fdcb5?{'count':_0x54e924,'rows':_0x2fdcb5}:null;}})[_0x5027('0x16')](respondWithResult(_0x2dbd76,null))[_0x5027('0x1e')](handleError(_0x2dbd76,null));};exports[_0x5027('0xe6')]=function(_0x2882b0,_0x53cbd8){var _0x3c7846={};var _0x3f3af4={};var _0x10c248;var _0x22084c;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x2882b0[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x53cbd8,null))[_0x5027('0x16')](function(_0xf846b4){if(_0xf846b4){_0x10c248=_0xf846b4;_0x3f3af4['model']=_['keys'](db[_0x5027('0xe7')]['rawAttributes']);_0x3f3af4['query']=_[_0x5027('0x56')](_0x2882b0[_0x5027('0x42')]);_0x3f3af4[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x3f3af4[_0x5027('0x54')],_0x3f3af4[_0x5027('0x42')]);_0x3c7846['attributes']=_[_0x5027('0x58')](_0x3f3af4[_0x5027('0x54')],qs[_0x5027('0x59')](_0x2882b0[_0x5027('0x42')][_0x5027('0x59')]));_0x3c7846['attributes']=_0x3c7846[_0x5027('0x47')][_0x5027('0x4c')]?_0x3c7846[_0x5027('0x47')]:_0x3f3af4[_0x5027('0x54')];_0x3c7846[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x2882b0[_0x5027('0x42')]['sort']);_0x3c7846[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x2882b0['query'],_0x3f3af4[_0x5027('0xcf')]));if(_0x2882b0['query'][_0x5027('0x32')]){_0x3c7846[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x3c7846['where'],{'$or':_['map'](_0x3c7846[_0x5027('0x47')],function(_0x3aa8ee){var _0x29f235={};_0x29f235[_0x3aa8ee]={'$like':'%'+_0x2882b0[_0x5027('0x42')]['filter']+'%'};return _0x29f235;})});}_0x3c7846=_[_0x5027('0x5b')]({},_0x3c7846,_0x2882b0[_0x5027('0x5c')]);return _0x10c248[_0x5027('0xe6')](_0x3c7846);}})['then'](function(_0x3e7969){if(_0x3e7969){_0x22084c=_0x3e7969[_0x5027('0x4c')];if(!_0x2882b0[_0x5027('0x42')]['hasOwnProperty'](_0x5027('0xd6'))){_0x3c7846['limit']=qs[_0x5027('0x25')](_0x2882b0[_0x5027('0x42')][_0x5027('0x25')]);_0x3c7846[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x2882b0['query'][_0x5027('0x23')]);}return _0x10c248[_0x5027('0xe6')](_0x3c7846);}})[_0x5027('0x16')](function(_0x4d2388){if(_0x4d2388){return _0x4d2388?{'count':_0x22084c,'rows':_0x4d2388}:null;}})[_0x5027('0x16')](respondWithResult(_0x53cbd8,null))[_0x5027('0x1e')](handleError(_0x53cbd8,null));};exports[_0x5027('0xe8')]=function(_0x323c5e,_0x5b5407){var _0x4d13da={'raw':!![],'where':{}};var _0x1e706c={};var _0x5206c1={'count':0x0,'rows':[]};return db[_0x5027('0x41')]['findOne']({'where':{'id':_0x323c5e[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x5b5407,null))['then'](function(_0x5c42f1){if(_0x5c42f1){_0x1e706c[_0x5027('0x54')]=_['keys'](db[_0x5027('0xe9')][_0x5027('0x57')]);_0x1e706c[_0x5027('0x42')]=_['keys'](_0x323c5e[_0x5027('0x42')]);_0x1e706c['filters']=_[_0x5027('0x58')](_0x1e706c[_0x5027('0x54')],_0x1e706c['query']);_0x4d13da[_0x5027('0x47')]=_[_0x5027('0x58')](_0x1e706c['model'],qs[_0x5027('0x59')](_0x323c5e[_0x5027('0x42')][_0x5027('0x59')]));_0x4d13da[_0x5027('0x47')]=_0x4d13da[_0x5027('0x47')][_0x5027('0x4c')]?_0x4d13da[_0x5027('0x47')]:_0x1e706c[_0x5027('0x54')];if(!_0x323c5e[_0x5027('0x42')][_0x5027('0xd0')](_0x5027('0xd6'))){_0x4d13da[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x323c5e['query'][_0x5027('0x25')]);_0x4d13da[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x323c5e['query']['offset']);}_0x4d13da['order']=qs[_0x5027('0xce')](_0x323c5e[_0x5027('0x42')][_0x5027('0xce')]);_0x4d13da['where']=qs[_0x5027('0xcf')](_['pick'](_0x323c5e[_0x5027('0x42')],_0x1e706c[_0x5027('0xcf')]));_0x4d13da[_0x5027('0x40')][_0x5027('0xe3')]=_0x5c42f1['id'];if(_0x323c5e[_0x5027('0x42')][_0x5027('0x32')]){_0x4d13da[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x4d13da[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x4d13da[_0x5027('0x47')],function(_0xe12796){var _0x11683d={};_0x11683d[_0xe12796]={'$like':'%'+_0x323c5e[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x11683d;})});}_0x4d13da=_[_0x5027('0x5b')]({},_0x4d13da,_0x323c5e[_0x5027('0x5c')]);return db[_0x5027('0xe9')][_0x5027('0x26')]({'where':_0x4d13da[_0x5027('0x40')]})[_0x5027('0x16')](function(_0x173c52){_0x5206c1['count']=_0x173c52;if(_0x323c5e['query'][_0x5027('0x43')]){_0x4d13da[_0x5027('0x44')]=[{'all':!![]}];}return db[_0x5027('0xe9')][_0x5027('0x49')](_0x4d13da);})[_0x5027('0x16')](function(_0x151530){_0x5206c1[_0x5027('0x4a')]=_0x151530;return _0x5206c1;});}})['then'](respondWithFilteredResult(_0x5b5407,_0x4d13da))[_0x5027('0x1e')](handleError(_0x5b5407,null));};exports[_0x5027('0xea')]=function(_0x56b03e,_0xcacf72){var _0x3a366a={};var _0x4cd733={};var _0x5a5502;var _0x54731d;return db['User']['findOne']({'where':{'id':_0x56b03e[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0xcacf72,null))[_0x5027('0x16')](function(_0x26ebba){if(_0x26ebba){_0x5a5502=_0x26ebba;_0x4cd733['model']=_[_0x5027('0x56')](db['SmsInteraction'][_0x5027('0x57')]);_0x4cd733[_0x5027('0x42')]=_[_0x5027('0x56')](_0x56b03e[_0x5027('0x42')]);_0x4cd733[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x4cd733[_0x5027('0x54')],_0x4cd733[_0x5027('0x42')]);_0x3a366a[_0x5027('0x47')]=_['intersection'](_0x4cd733[_0x5027('0x54')],qs[_0x5027('0x59')](_0x56b03e[_0x5027('0x42')]['fields']));_0x3a366a[_0x5027('0x47')]=_0x3a366a['attributes'][_0x5027('0x4c')]?_0x3a366a['attributes']:_0x4cd733[_0x5027('0x54')];_0x3a366a[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x56b03e[_0x5027('0x42')][_0x5027('0xce')]);_0x3a366a[_0x5027('0x40')]=qs[_0x5027('0xcf')](_['pick'](_0x56b03e[_0x5027('0x42')],_0x4cd733['filters']));if(_0x56b03e[_0x5027('0x42')]['filter']){_0x3a366a['where']=_['merge'](_0x3a366a['where'],{'$or':_['map'](_0x3a366a[_0x5027('0x47')],function(_0x3bb0ad){var _0x1b2770={};_0x1b2770[_0x3bb0ad]={'$like':'%'+_0x56b03e[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x1b2770;})});}_0x3a366a=_['merge']({},_0x3a366a,_0x56b03e['options']);return _0x5a5502['getSmsInteractions'](_0x3a366a);}})[_0x5027('0x16')](function(_0x408cd3){if(_0x408cd3){_0x54731d=_0x408cd3[_0x5027('0x4c')];if(!_0x56b03e['query'][_0x5027('0xd0')](_0x5027('0xd6'))){_0x3a366a['limit']=qs[_0x5027('0x25')](_0x56b03e[_0x5027('0x42')][_0x5027('0x25')]);_0x3a366a[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x56b03e['query'][_0x5027('0x23')]);}return _0x5a5502[_0x5027('0xea')](_0x3a366a);}})['then'](function(_0x58256f){if(_0x58256f){return _0x58256f?{'count':_0x54731d,'rows':_0x58256f}:null;}})['then'](respondWithResult(_0xcacf72,null))[_0x5027('0x1e')](handleError(_0xcacf72,null));};exports[_0x5027('0xeb')]=function(_0x59bdec,_0x3456b2){var _0xb93ab4={};var _0x29b967={};var _0x1c3aa3;var _0x7b03b;return db['User'][_0x5027('0x9c')]({'where':{'id':_0x59bdec['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x3456b2,null))['then'](function(_0x385f1b){if(_0x385f1b){_0x1c3aa3=_0x385f1b;_0x29b967[_0x5027('0x54')]=_[_0x5027('0x56')](db['FaxInteraction']['rawAttributes']);_0x29b967[_0x5027('0x42')]=_[_0x5027('0x56')](_0x59bdec['query']);_0x29b967[_0x5027('0xcf')]=_['intersection'](_0x29b967[_0x5027('0x54')],_0x29b967[_0x5027('0x42')]);_0xb93ab4[_0x5027('0x47')]=_[_0x5027('0x58')](_0x29b967[_0x5027('0x54')],qs['fields'](_0x59bdec[_0x5027('0x42')][_0x5027('0x59')]));_0xb93ab4[_0x5027('0x47')]=_0xb93ab4[_0x5027('0x47')][_0x5027('0x4c')]?_0xb93ab4[_0x5027('0x47')]:_0x29b967[_0x5027('0x54')];_0xb93ab4[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x59bdec[_0x5027('0x42')]['sort']);_0xb93ab4['where']=qs[_0x5027('0xcf')](_['pick'](_0x59bdec[_0x5027('0x42')],_0x29b967[_0x5027('0xcf')]));if(_0x59bdec['query'][_0x5027('0x32')]){_0xb93ab4[_0x5027('0x40')]=_[_0x5027('0x5b')](_0xb93ab4[_0x5027('0x40')],{'$or':_['map'](_0xb93ab4['attributes'],function(_0x4e015c){var _0x1743f8={};_0x1743f8[_0x4e015c]={'$like':'%'+_0x59bdec[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x1743f8;})});}_0xb93ab4=_[_0x5027('0x5b')]({},_0xb93ab4,_0x59bdec[_0x5027('0x5c')]);return _0x1c3aa3[_0x5027('0xeb')](_0xb93ab4);}})[_0x5027('0x16')](function(_0x1c6176){if(_0x1c6176){_0x7b03b=_0x1c6176['length'];if(!_0x59bdec[_0x5027('0x42')][_0x5027('0xd0')]('nolimit')){_0xb93ab4[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x59bdec[_0x5027('0x42')][_0x5027('0x25')]);_0xb93ab4[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x59bdec[_0x5027('0x42')]['offset']);}return _0x1c3aa3[_0x5027('0xeb')](_0xb93ab4);}})[_0x5027('0x16')](function(_0x1effb0){if(_0x1effb0){return _0x1effb0?{'count':_0x7b03b,'rows':_0x1effb0}:null;}})[_0x5027('0x16')](respondWithResult(_0x3456b2,null))[_0x5027('0x1e')](handleError(_0x3456b2,null));};exports[_0x5027('0xec')]=function(_0x4bddd0,_0x4d25b4){var _0x21d1c5={};var _0x4b7a97={};var _0x15320c;var _0x3bc43f;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x4bddd0['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x4d25b4,null))[_0x5027('0x16')](function(_0x91ad4b){if(_0x91ad4b){_0x15320c=_0x91ad4b;_0x4b7a97[_0x5027('0x54')]=_['keys'](db['WhatsappInteraction'][_0x5027('0x57')]);_0x4b7a97[_0x5027('0x42')]=_['keys'](_0x4bddd0['query']);_0x4b7a97[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x4b7a97[_0x5027('0x54')],_0x4b7a97[_0x5027('0x42')]);_0x21d1c5[_0x5027('0x47')]=_[_0x5027('0x58')](_0x4b7a97[_0x5027('0x54')],qs[_0x5027('0x59')](_0x4bddd0[_0x5027('0x42')]['fields']));_0x21d1c5['attributes']=_0x21d1c5[_0x5027('0x47')][_0x5027('0x4c')]?_0x21d1c5['attributes']:_0x4b7a97['model'];_0x21d1c5['order']=qs[_0x5027('0xce')](_0x4bddd0[_0x5027('0x42')][_0x5027('0xce')]);_0x21d1c5[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x4bddd0[_0x5027('0x42')],_0x4b7a97[_0x5027('0xcf')]));if(_0x4bddd0['query'][_0x5027('0x32')]){_0x21d1c5[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x21d1c5[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x21d1c5[_0x5027('0x47')],function(_0x10692a){var _0x31d766={};_0x31d766[_0x10692a]={'$like':'%'+_0x4bddd0[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x31d766;})});}_0x21d1c5=_[_0x5027('0x5b')]({},_0x21d1c5,_0x4bddd0[_0x5027('0x5c')]);return _0x15320c[_0x5027('0xec')](_0x21d1c5);}})[_0x5027('0x16')](function(_0x18fff2){if(_0x18fff2){_0x3bc43f=_0x18fff2['length'];if(!_0x4bddd0['query'][_0x5027('0xd0')](_0x5027('0xd6'))){_0x21d1c5[_0x5027('0x25')]=qs['limit'](_0x4bddd0[_0x5027('0x42')][_0x5027('0x25')]);_0x21d1c5[_0x5027('0x23')]=qs['offset'](_0x4bddd0[_0x5027('0x42')][_0x5027('0x23')]);}return _0x15320c[_0x5027('0xec')](_0x21d1c5);}})[_0x5027('0x16')](function(_0x2461f2){if(_0x2461f2){return _0x2461f2?{'count':_0x3bc43f,'rows':_0x2461f2}:null;}})['then'](respondWithResult(_0x4d25b4,null))['catch'](handleError(_0x4d25b4,null));};exports[_0x5027('0xed')]=function(_0x42ee5c,_0x5e354f,_0x377f15){var _0x8c6fd9;var _0x24e25d;var _0x1b0e01;var _0x25f002=!_['isNil'](_0x42ee5c[_0x5027('0x53')]['id'])?_0x42ee5c['params']['id']:!_[_0x5027('0x6a')](_0x42ee5c[_0x5027('0x2f')]['id'])?_0x42ee5c[_0x5027('0x2f')]['id']:null;return db[_0x5027('0x41')]['find']({'where':{'id':_0x25f002,'role':{'$or':[_0x5027('0x85'),_0x5027('0x2f'),'agent']}},'attributes':['id','name','phone','mobile',_0x5027('0x2a'),'internal','loginInPause']})[_0x5027('0x16')](function(_0x392638){if(_0x392638){if(_0x392638[_0x5027('0x2a')]===_0x5027('0x84')){_0x8c6fd9=_0x392638;if(_0x42ee5c[_0x5027('0x5f')][_0x5027('0xad')]){_0x1b0e01=util[_0x5027('0xae')](_0x5027('0xee'),_0x8c6fd9[_0x42ee5c['body'][_0x5027('0xad')]]);}else if(_0x42ee5c[_0x5027('0x5f')][_0x5027('0xef')]){_0x1b0e01=util[_0x5027('0xae')](_0x5027('0xaf'),_0x42ee5c[_0x5027('0x5f')][_0x5027('0xef')]);}else{_0x1b0e01=util[_0x5027('0xae')]('SIP/%s',_0x8c6fd9[_0x5027('0x38')]);}socket['to'](util[_0x5027('0xae')](_0x5027('0xf0'),_0x8c6fd9[_0x5027('0x38')]))[_0x5027('0xa8')](_0x5027('0xf1'),{'user':{'id':_0x8c6fd9['id'],'name':_0x8c6fd9[_0x5027('0x38')]},'ip':_0x42ee5c['headers'][_0x5027('0xf2')]||_0x42ee5c['connection'][_0x5027('0xf3')]||_0x42ee5c[_0x5027('0xf4')][_0x5027('0xf3')]||_0x42ee5c[_0x5027('0xf5')][_0x5027('0xf4')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x5027('0x2c')]({'where':{'membername':_0x8c6fd9[_0x5027('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0x5027('0x94'))]['ValidationError'](_0x5027('0xf6'));}})[_0x5027('0x16')](function(){if(_0x8c6fd9){return _0x8c6fd9[_0x5027('0xf7')]({'raw':!![]});}})[_0x5027('0x16')](function(_0x14e7e5){if(_0x8c6fd9){if(_0x14e7e5){_0x24e25d=_0x14e7e5;if(_0x24e25d['length']){var _0x5471ee=_0x24e25d['map'](function(_0x5e309c){var _0x5f2c99={'membername':_0x8c6fd9[_0x5027('0x38')],'UserId':_0x8c6fd9['id'],'queue_name':_0x5e309c[_0x5027('0x38')],'VoiceQueueId':_0x5e309c['id'],'interface':_0x1b0e01,'paused':_0x8c6fd9[_0x5027('0xf8')]||![],'penalty':_0x5e309c['UserVoiceQueue.penalty']||0x0};return db[_0x5027('0xdb')]['upsert'](_0x5f2c99);});return Promise[_0x5027('0x52')](_0x5471ee);}}}})['then'](function(){if(_0x8c6fd9){return db['MemberReport']['findAll']({'where':{'membername':_0x8c6fd9['name'],'exitAt':null}});}})[_0x5027('0x16')](function(_0x460819){if(_0x8c6fd9){var _0x2d01a5=[];_0x460819[_0x5027('0xf9')](function(_0x9974a0){_0x2d01a5[_0x5027('0x48')](_0x9974a0['update']({'exitAt':moment()[_0x5027('0xae')](_0x5027('0xfa'))}));});return Promise['all'](_0x2d01a5);}})[_0x5027('0x16')](function(){if(_0x8c6fd9){var _0x289907=[];var _0x46083f=[];var _0x127073=utils['getChannels']();var _0x1263dc={'membername':_0x8c6fd9[_0x5027('0x38')],'interface':_0x1b0e01,'enterAt':moment()[_0x5027('0xae')](_0x5027('0xfa')),'role':_0x8c6fd9[_0x5027('0x2a')],'internal':_0x8c6fd9[_0x5027('0x64')]};_0x127073[_0x5027('0xf9')](function(_0x3396b3){_0x289907[_0x5027('0x48')](_[_0x5027('0x5b')]({'channel':_0x3396b3,'type':'LOGIN','data1':_0x42ee5c[_0x5027('0x5f')][_0x5027('0xfb')],'data2':_0x1b0e01},_0x1263dc));if(_0x8c6fd9[_0x5027('0xf8')]){_0x46083f[_0x5027('0x48')](_[_0x5027('0x5b')]({'channel':_0x3396b3,'type':_0x5027('0xfc'),'data1':'LOGININPAUSE'},_0x1263dc));}});return db['MemberReport']['bulkCreate'](_0x289907[_0x5027('0xcc')](_0x46083f),{'individualHooks':!![]});}})[_0x5027('0x16')](function(){if(_0x8c6fd9){return _0x8c6fd9[_0x5027('0x29')]({'online':!![],'lastLoginAt':moment()[_0x5027('0xae')](_0x5027('0xfa')),'voicePause':_0x8c6fd9[_0x5027('0xf8')]||![],'mailPause':_0x8c6fd9[_0x5027('0xf8')]||![],'chatPause':_0x8c6fd9[_0x5027('0xf8')]||![],'faxPause':_0x8c6fd9[_0x5027('0xf8')]||![],'smsPause':_0x8c6fd9[_0x5027('0xf8')]||![],'openchannelPause':_0x8c6fd9[_0x5027('0xf8')]||![],'whatsappPause':_0x8c6fd9[_0x5027('0xf8')]||![],'pauseType':_0x8c6fd9[_0x5027('0xf8')]?_0x5027('0xfd'):null,'interface':_0x1b0e01,'lastPauseAt':moment()[_0x5027('0xae')](_0x5027('0xfa'))});}})[_0x5027('0x16')](function(_0x3178b3){if(_0x42ee5c[_0x5027('0xfe')]){return _0x377f15();}else{return Promise['resolve'](_0x3178b3)['then'](respondWithResult(_0x5e354f,null));}})[_0x5027('0x1e')](handleError(_0x5e354f,null));};exports[_0x5027('0xff')]=function(_0x8f20f6,_0x40003e){var _0x2215ab;return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x8f20f6[_0x5027('0x53')]['id'],'role':'agent'},'attributes':['id',_0x5027('0x38'),_0x5027('0x2a')]})[_0x5027('0x16')](handleEntityNotFound(_0x40003e,null))[_0x5027('0x16')](function(_0x5579af){if(_0x5579af){_0x2215ab=_0x5579af;return db[_0x5027('0xdb')][_0x5027('0x2c')]({'where':{'membername':_0x2215ab['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x5027('0x100')][_0x5027('0x49')]({'where':{'membername':_0x2215ab['name'],'exitAt':null}});})[_0x5027('0x16')](function(_0x1ab4ce){var _0x5e8e05=[];_0x1ab4ce[_0x5027('0xf9')](function(_0xf717ee){_0x5e8e05[_0x5027('0x48')](_0xf717ee[_0x5027('0x29')]({'exitAt':moment()[_0x5027('0xae')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x5027('0x52')](_0x5e8e05);})[_0x5027('0x16')](function(){return _0x2215ab['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5027('0x16')](respondWithResult(_0x40003e,null))[_0x5027('0x1e')](handleError(_0x40003e,null));};exports[_0x5027('0x101')]=function(_0x46f262,_0x4ee4eb){var _0x51413c;return db[_0x5027('0xdb')][_0x5027('0x29')]({'paused':0x1},{'where':{'UserId':_0x46f262['params']['id']},'individualHooks':!![]})[_0x5027('0x16')](function(){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x46f262[_0x5027('0x53')]['id'],'role':'agent'},'attributes':['id','name',_0x5027('0x2a'),_0x5027('0x64'),_0x5027('0xad'),_0x5027('0xa3')]});})[_0x5027('0x16')](handleEntityNotFound(_0x4ee4eb,null))[_0x5027('0x16')](function(_0x84d5ab){if(_0x84d5ab){_0x51413c=_0x84d5ab;return respondWithRpcPromise(_0x5027('0x102'),_0x5027('0x101'),{'id':_0x51413c['id'],'name':_0x51413c[_0x5027('0x38')],'pause':!![]});}})[_0x5027('0x16')](function(){if(_0x51413c){return db['MemberReport']['findAll']({'where':{'membername':_0x51413c[_0x5027('0x38')],'type':_0x5027('0xfc'),'exitAt':null}});}})[_0x5027('0x16')](function(_0x4b340e){if(_0x4b340e[_0x5027('0x4c')]){var _0x146ccc=moment()['format'](_0x5027('0xfa'));for(var _0x20c01f=0x0,_0xc7c8ac=_0x4b340e['length'];_0x20c01f<_0xc7c8ac;_0x20c01f++){_0x4b340e[_0x20c01f][_0x5027('0x103')]({'exitAt':_0x146ccc});}}})[_0x5027('0x16')](function(){var _0x308631=[];var _0x404b90=utils[_0x5027('0x104')]();_0x404b90[_0x5027('0xf9')](function(_0x403a1f){_0x308631[_0x5027('0x48')]({'channel':_0x403a1f,'membername':_0x51413c[_0x5027('0x38')],'interface':_[_0x5027('0x6a')](_0x51413c['interface'])?util[_0x5027('0xae')](_0x5027('0xaf'),_0x51413c[_0x5027('0x38')]):_0x51413c[_0x5027('0xad')],'type':_0x5027('0xfc'),'enterAt':moment()[_0x5027('0xae')](_0x5027('0xfa')),'data1':_0x46f262[_0x5027('0x5f')][_0x5027('0x3c')]||'DEFAULT\x20PAUSE','role':_0x51413c['role'],'internal':_0x51413c[_0x5027('0x64')]});});return db['MemberReport'][_0x5027('0x105')](_0x308631,{'individualHooks':!![]});})['then'](function(){return _0x51413c[_0x5027('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x46f262[_0x5027('0x5f')][_0x5027('0x3c')]||_0x5027('0x106'),'lastPauseAt':moment()[_0x5027('0xae')](_0x5027('0xfa'))});})['then'](respondWithResult(_0x4ee4eb,null))[_0x5027('0x1e')](handleError(_0x4ee4eb,null));};exports[_0x5027('0x107')]=function(_0x381468,_0x4e7ea5){if(_0x381468[_0x5027('0x5f')][_0x5027('0xb0')]&&!utils[_0x5027('0xa4')](_0x381468[_0x5027('0x5f')][_0x5027('0xb0')])){throw new APIBadRequestError(util[_0x5027('0xae')](_0x5027('0x108'),_0x381468[_0x5027('0x5f')][_0x5027('0xb0')]));}return db['User'][_0x5027('0x37')]({'where':{'id':_0x381468[_0x5027('0x53')]['id']},'attributes':['id',_0x5027('0x38'),_0x5027('0x2a'),_0x5027('0x64'),_0x5027('0xad'),_0x5027('0xa3'),'voicePause',_0x5027('0x109'),_0x5027('0x10a'),_0x5027('0x10b'),_0x5027('0x10c'),_0x5027('0x10d'),_0x5027('0x10e'),_0x5027('0x10f'),'lastPauseAt']})[_0x5027('0x16')](function(_0x5a691a){if(!_0x5a691a){throw new APINotFoundError(util[_0x5027('0xae')]('User\x20with\x20id\x20%s\x20not\x20found',_0x381468['params']['id']));}return _0x5a691a[_0x5027('0x107')](_0x381468[_0x5027('0x5f')][_0x5027('0xb0')]);})[_0x5027('0x16')](respondWithResult(_0x4e7ea5,null))[_0x5027('0x1e')](APIHandleError(_0x4e7ea5));};exports[_0x5027('0x110')]=function(_0x389625,_0xf40fb2){var _0x181adc={};var _0xf81a4c={};var _0x46dd1b;var _0x4762a4;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x389625[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0xf40fb2,null))[_0x5027('0x16')](function(_0x19f17a){if(_0x19f17a){_0x46dd1b=_0x19f17a;_0xf81a4c[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x111')][_0x5027('0x57')]);_0xf81a4c['query']=_['keys'](_0x389625[_0x5027('0x42')]);_0xf81a4c[_0x5027('0xcf')]=_[_0x5027('0x58')](_0xf81a4c['model'],_0xf81a4c[_0x5027('0x42')]);_0x181adc['attributes']=_[_0x5027('0x58')](_0xf81a4c[_0x5027('0x54')],qs['fields'](_0x389625[_0x5027('0x42')][_0x5027('0x59')]));_0x181adc[_0x5027('0x47')]=_0x181adc[_0x5027('0x47')]['length']?_0x181adc['attributes']:_0xf81a4c[_0x5027('0x54')];_0x181adc['order']=qs[_0x5027('0xce')](_0x389625[_0x5027('0x42')][_0x5027('0xce')]);_0x181adc[_0x5027('0x40')]=qs[_0x5027('0xcf')](_['pick'](_0x389625[_0x5027('0x42')],_0xf81a4c['filters']));if(_0x389625[_0x5027('0x42')]['filter']){_0x181adc['where']=_[_0x5027('0x5b')](_0x181adc[_0x5027('0x40')],{'$or':_['map'](_0x181adc[_0x5027('0x47')],function(_0x1a9274){var _0x2e79f4={};_0x2e79f4[_0x1a9274]={'$like':'%'+_0x389625['query'][_0x5027('0x32')]+'%'};return _0x2e79f4;})});}_0x181adc=_[_0x5027('0x5b')]({},_0x181adc,_0x389625[_0x5027('0x5c')]);return _0x46dd1b[_0x5027('0x110')](_0x181adc);}})['then'](function(_0x1cab77){if(_0x1cab77){_0x4762a4=_0x1cab77[_0x5027('0x4c')];if(!_0x389625['query'][_0x5027('0xd0')](_0x5027('0xd6'))){_0x181adc[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x389625[_0x5027('0x42')]['limit']);_0x181adc[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x389625[_0x5027('0x42')][_0x5027('0x23')]);}return _0x46dd1b[_0x5027('0x110')](_0x181adc);}})[_0x5027('0x16')](function(_0x116c38){if(_0x116c38){return _0x116c38?{'count':_0x4762a4,'rows':_0x116c38}:null;}})[_0x5027('0x16')](respondWithResult(_0xf40fb2,null))[_0x5027('0x1e')](handleError(_0xf40fb2,null));};exports['addTeams']=function(_0x1a16d6,_0x150a0c){var _0x4385fd=_0x1a16d6[_0x5027('0x53')]['id'];var _0x1e1ea3=_0x1a16d6[_0x5027('0x5f')]?_0x1a16d6[_0x5027('0x5f')][_0x5027('0x62')]:null;var _0x3b6e71=[];return Promise[_0x5027('0x112')]()[_0x5027('0x16')](function(){if(!_0x1e1ea3)throw new APIBadRequestError(_0x5027('0x113'));})[_0x5027('0x16')](function(){return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x4385fd}});})[_0x5027('0x16')](function(_0x5048e8){if(!_0x5048e8)throw new APINotFoundError(util[_0x5027('0xae')](_0x5027('0x114'),_0x1a16d6[_0x5027('0x53')]['id']));return db[_0x5027('0x6b')][_0x5027('0x115')](function(_0x2f8fec){return _0x5048e8['addTeams'](_0x1e1ea3,{'transaction':_0x2f8fec})[_0x5027('0x16')](function(){return db[_0x5027('0x111')][_0x5027('0x49')]({'where':{'id':{'$in':_0x1e1ea3}}});})['then'](function(_0x20f650){var _0x1b8d89=_[_0x5027('0x34')](_0x20f650,function(_0x32c225){return _0x32c225[_0x5027('0x116')]();});return Promise['all'](_0x1b8d89);})[_0x5027('0x16')](function(_0x208266){_0x3b6e71=_[_0x5027('0x117')](_0x208266);var _0x1f0758=_['map'](_0x3b6e71,function(_0xa9e563){return _0xa9e563['addAgent'](_0x5048e8['id'],{'transaction':_0x2f8fec});});return Promise[_0x5027('0x52')](_0x1f0758);})['then'](function(){if(!_0x5048e8[_0x5027('0xa3')])return;var _0x2f4243=_[_0x5027('0x32')](_0x3b6e71,function(_0x47658f){return _0x47658f['getDataValue']('channel')===_0x5027('0x118');});var _0x953715=_['map'](_0x2f4243,function(_0x53240a){return db[_0x5027('0xdb')]['upsert']({'membername':_0x5048e8[_0x5027('0x38')],'UserId':_0x5048e8['id'],'queue_name':_0x53240a['name'],'VoiceQueueId':_0x53240a['id'],'interface':_[_0x5027('0x6a')](_0x5048e8[_0x5027('0xad')])?util[_0x5027('0xae')](_0x5027('0xaf'),_0x5048e8[_0x5027('0x38')]):_0x5048e8[_0x5027('0xad')],'paused':_0x5048e8[_0x5027('0x119')]||![],'penalty':_0x5048e8['penalty']},{'transaction':_0x2f8fec});});return Promise[_0x5027('0x52')](_0x953715);})['then'](function(){return db['TeamVoicePrefix'][_0x5027('0x49')]({'where':{'teamId':{'$in':_0x1e1ea3}}});})[_0x5027('0x16')](function(_0x3a819f){var _0x1f7572=_['map'](_0x3a819f,function(_0xfbbd47){return db['UserVoicePrefix'][_0x5027('0x83')]({'UserId':_0x5048e8['id'],'VoicePrefixId':_0xfbbd47[_0x5027('0x11a')]},{'transaction':_0x2f8fec});});return Promise[_0x5027('0x52')](_0x1f7572);});});})[_0x5027('0x16')](function(){for(var _0x4cf3ec=0x0;_0x4cf3ec<_0x3b6e71['length'];_0x4cf3ec++){var _0xc259ab=_0x3b6e71[_0x4cf3ec][_0x5027('0x11b')](_0x5027('0xb0'));var _0x265950=_0xc259ab+_0x5027('0xa7');socket[_0x5027('0xa8')]('user'+_0xc259ab+_0x5027('0xaa'),{'UserId':_0x4385fd,['queueField']:_0x3b6e71[_0x4cf3ec]['id']});}})['then'](respondWithStatusCode(_0x150a0c,null))[_0x5027('0x1e')](APIHandleError(_0x150a0c));};exports[_0x5027('0x11c')]=function(_0x4f0f6a,_0x31fd14){var _0x293dfc=_0x4f0f6a[_0x5027('0x53')]['id'];var _0x1c9b1f=null;if(_0x4f0f6a[_0x5027('0x42')][_0x5027('0x62')]){_0x1c9b1f=_[_0x5027('0xb4')](_0x4f0f6a[_0x5027('0x42')][_0x5027('0x62')])?_0x4f0f6a['query'][_0x5027('0x62')]:[_0x4f0f6a['query'][_0x5027('0x62')]];}var _0x2f8f16=[];return Promise['resolve']()[_0x5027('0x16')](function(){if(!_0x1c9b1f)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x5027('0x41')]['findOne']({'where':{'id':_0x293dfc}});})[_0x5027('0x16')](function(_0x48b5f3){if(!_0x48b5f3)throw new APINotFoundError(util[_0x5027('0xae')](_0x5027('0x114'),_0x4f0f6a[_0x5027('0x53')]['id']));return db['sequelize'][_0x5027('0x115')](function(_0x3e755c){return _0x48b5f3[_0x5027('0x11c')](_0x1c9b1f,{'transaction':_0x3e755c})[_0x5027('0x16')](function(){return db[_0x5027('0x111')][_0x5027('0x49')]({'where':{'id':{'$in':_0x1c9b1f}}});})[_0x5027('0x16')](function(_0x37fcc1){var _0x4a263d=_[_0x5027('0x34')](_0x37fcc1,function(_0x20693b){return _0x20693b[_0x5027('0x116')]();});return Promise[_0x5027('0x52')](_0x4a263d);})[_0x5027('0x16')](function(_0x18d32e){_0x2f8f16=_[_0x5027('0x117')](_0x18d32e);var _0x43876b=_[_0x5027('0x34')](_0x2f8f16,function(_0xcc38fd){return _0xcc38fd['removeAgent'](_0x48b5f3['id'],{'transaction':_0x3e755c});});return Promise[_0x5027('0x52')](_0x43876b);})[_0x5027('0x16')](function(){if(!_0x48b5f3[_0x5027('0xa3')])return;var _0x299c0b=_['filter'](_0x2f8f16,function(_0x397a19){return _0x397a19[_0x5027('0x11b')](_0x5027('0xb0'))===_0x5027('0x118');});var _0x1b672f=_[_0x5027('0x34')](_0x299c0b,function(_0x20cf1a){return db[_0x5027('0xdb')][_0x5027('0x2c')]({'where':{'VoiceQueueId':_0x20cf1a['id'],'UserId':_0x48b5f3['id']},'transaction':_0x3e755c});});return Promise['all'](_0x1b672f);})[_0x5027('0x16')](function(){return db[_0x5027('0x11d')][_0x5027('0x49')]({'where':{'teamId':{'$in':_0x1c9b1f}}});})[_0x5027('0x16')](function(_0xe17616){var _0xd8b0a2=_[_0x5027('0x34')](_0xe17616,function(_0x2e2c44){return db[_0x5027('0x11e')][_0x5027('0x2c')]({'where':{'UserId':_0x48b5f3['id'],'VoicePrefixId':_0x2e2c44[_0x5027('0x11a')]}},{'transaction':_0x3e755c});});return Promise[_0x5027('0x52')](_0xd8b0a2);});});})[_0x5027('0x16')](function(){for(var _0x2f0ce1=0x0;_0x2f0ce1<_0x2f8f16[_0x5027('0x4c')];_0x2f0ce1++){var _0x3c2cea=_0x2f8f16[_0x2f0ce1][_0x5027('0x11b')]('channel');var _0x4e136d=_0x3c2cea+_0x5027('0xa7');socket[_0x5027('0xa8')](_0x5027('0x2f')+_0x3c2cea+'Queue:remove',{'UserId':_0x293dfc,['queueField']:_0x2f8f16[_0x2f0ce1]['id']});}})[_0x5027('0x16')](respondWithStatusCode(_0x31fd14,null))['catch'](APIHandleError(_0x31fd14));};exports[_0x5027('0x11f')]=function(_0x887db1,_0x2c1558){var _0x5d85fb={};var _0x6cea27={};var _0x15febf;var _0x573526;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x887db1['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x2c1558,null))['then'](function(_0x4693d9){if(_0x4693d9){_0x15febf=_0x4693d9;_0x6cea27[_0x5027('0x54')]=_['keys'](db['CmList'][_0x5027('0x57')]);_0x6cea27[_0x5027('0x42')]=_[_0x5027('0x56')](_0x887db1[_0x5027('0x42')]);_0x6cea27['filters']=_['intersection'](_0x6cea27[_0x5027('0x54')],_0x6cea27[_0x5027('0x42')]);_0x5d85fb[_0x5027('0x47')]=_['intersection'](_0x6cea27['model'],qs[_0x5027('0x59')](_0x887db1[_0x5027('0x42')][_0x5027('0x59')]));_0x5d85fb[_0x5027('0x47')]=_0x5d85fb[_0x5027('0x47')]['length']?_0x5d85fb[_0x5027('0x47')]:_0x6cea27[_0x5027('0x54')];_0x5d85fb['order']=qs[_0x5027('0xce')](_0x887db1[_0x5027('0x42')][_0x5027('0xce')]);_0x5d85fb['where']=qs['filters'](_['pick'](_0x887db1['query'],_0x6cea27['filters']));if(_0x887db1[_0x5027('0x42')][_0x5027('0x32')]){_0x5d85fb[_0x5027('0x40')]=_['merge'](_0x5d85fb[_0x5027('0x40')],{'$or':_['map'](_0x5d85fb[_0x5027('0x47')],function(_0x13cb3b){var _0xd9dd84={};_0xd9dd84[_0x13cb3b]={'$like':'%'+_0x887db1[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0xd9dd84;})});}_0x5d85fb=_[_0x5027('0x5b')]({},_0x5d85fb,_0x887db1['options']);return _0x15febf[_0x5027('0x11f')](_0x5d85fb);}})['then'](function(_0x4f6eb9){if(_0x4f6eb9){_0x573526=_0x4f6eb9[_0x5027('0x4c')];if(!_0x887db1[_0x5027('0x42')][_0x5027('0xd0')]('nolimit')){_0x5d85fb[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x887db1[_0x5027('0x42')][_0x5027('0x25')]);_0x5d85fb['offset']=qs['offset'](_0x887db1[_0x5027('0x42')][_0x5027('0x23')]);}return _0x15febf[_0x5027('0x11f')](_0x5d85fb);}})['then'](function(_0x4303a4){if(_0x4303a4){return _0x4303a4?{'count':_0x573526,'rows':_0x4303a4}:null;}})[_0x5027('0x16')](respondWithResult(_0x2c1558,null))[_0x5027('0x1e')](handleError(_0x2c1558,null));};exports[_0x5027('0x120')]=function(_0x2e5850,_0x193f13){var _0xbe8e5d={};var _0x26738b={};var _0x411c5a;return db[_0x5027('0x41')]['findOne']({'where':{'id':_0x2e5850['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x193f13,null))[_0x5027('0x16')](function(_0x4a2d62){if(_0x4a2d62){_0x411c5a=_0x4a2d62;_0x26738b[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x41')][_0x5027('0x57')]);_0x26738b[_0x5027('0x42')]=_['keys'](_0x2e5850[_0x5027('0x42')]);_0x26738b[_0x5027('0xcf')]=_['intersection'](_0x26738b[_0x5027('0x54')],_0x26738b[_0x5027('0x42')]);_0xbe8e5d['attributes']=_[_0x5027('0x58')](_0x26738b[_0x5027('0x54')],qs['fields'](_0x2e5850[_0x5027('0x42')][_0x5027('0x59')]));_0xbe8e5d[_0x5027('0x47')]=_0xbe8e5d['attributes'][_0x5027('0x4c')]?_0xbe8e5d[_0x5027('0x47')]:_0x26738b[_0x5027('0x54')];_0xbe8e5d[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x2e5850[_0x5027('0x42')][_0x5027('0xce')]);_0xbe8e5d[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x2e5850[_0x5027('0x42')],_0x26738b['filters']));if(_0x2e5850[_0x5027('0x42')][_0x5027('0x32')]){_0xbe8e5d[_0x5027('0x40')]=_[_0x5027('0x5b')](_0xbe8e5d[_0x5027('0x40')],{'$or':_['map'](_0xbe8e5d[_0x5027('0x47')],function(_0x32b58d){var _0x40edfa={};_0x40edfa[_0x32b58d]={'$like':'%'+_0x2e5850[_0x5027('0x42')]['filter']+'%'};return _0x40edfa;})});}_0xbe8e5d[_0x5027('0x54')]=db[_0x5027('0x41')];_0xbe8e5d['as']='Agents';_0xbe8e5d=_[_0x5027('0x5b')]({},_0xbe8e5d,_0x2e5850[_0x5027('0x5c')]);return _0x411c5a['getVoiceQueues']({'include':[_0xbe8e5d]});}})[_0x5027('0x16')](function(_0x155622){if(_0x155622){var _0x470e19={},_0x17aca1=[];for(var _0x3ed126=0x0;_0x3ed126<_0x155622[_0x5027('0x4c')];_0x3ed126+=0x1){for(var _0x24bf91=0x0,_0x21334a;_0x24bf91<_0x155622[_0x3ed126][_0x5027('0x30')]['length'];_0x24bf91+=0x1){_0x21334a=_0x155622[_0x3ed126][_0x5027('0x30')][_0x24bf91][_0x5027('0x2d')]({'plain':!![]});_0x470e19[_0x21334a['id']]=_0x21334a;}}_0x470e19=_[_0x5027('0x121')](_0x470e19);for(var _0xaa00eb=qs['offset'](_0x2e5850['query'][_0x5027('0x23')]);_0xaa00eb<_0x470e19[_0x5027('0x4c')]&&_0x17aca1[_0x5027('0x4c')]<qs[_0x5027('0x25')](_0x2e5850[_0x5027('0x42')][_0x5027('0x25')]);_0xaa00eb+=0x1){if(_0x470e19[_0xaa00eb]){_0x17aca1[_0x5027('0x48')](_0x470e19[_0xaa00eb]);}}return{'count':_0x470e19['length'],'rows':_0x17aca1};}})['then'](respondWithResult(_0x193f13,null))[_0x5027('0x1e')](handleError(_0x193f13,null));};exports[_0x5027('0x2c')]=function(_0x380553,_0x44bdbb){if(_0x380553[_0x5027('0x2f')]['id']==_0x380553[_0x5027('0x53')]['id']){return _0x44bdbb[_0x5027('0x20')](0x1f4)[_0x5027('0x3a')]({'message':_0x5027('0x122')});}return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x380553[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x44bdbb,null))[_0x5027('0x16')](removeEntity(_0x44bdbb,null))['catch'](handleError(_0x44bdbb,null));};exports[_0x5027('0x123')]=function(_0x35c13e,_0x1c6f50){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x35c13e[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x1c6f50,null))['then'](function(_0x341b5b){if(_0x341b5b){return _0x341b5b[_0x5027('0x123')](_0x35c13e['body'][_0x5027('0x62')],_[_0x5027('0x63')](_0x35c13e['body'],['ids','id'])||{})[_0x5027('0x124')](function(){for(var _0x5a55cb=0x0;_0x5a55cb<_0x35c13e[_0x5027('0x5f')][_0x5027('0x62')]['length'];_0x5a55cb+=0x1){socket[_0x5027('0xa8')](_0x5027('0x125'),{'ChatInteractionId':Number(_0x35c13e[_0x5027('0x5f')][_0x5027('0x62')][_0x5a55cb]),'UserId':Number(_0x35c13e[_0x5027('0x53')]['id'])});}return _0x35c13e['body'][_0x5027('0x62')];});}})[_0x5027('0x16')](respondWithResult(_0x1c6f50,null))[_0x5027('0x1e')](handleError(_0x1c6f50,null));};exports[_0x5027('0x126')]=function(_0x43da65,_0x4bc020){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x43da65[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x4bc020,null))[_0x5027('0x16')](function(_0x584452){if(_0x584452){return _0x584452['removeChatInteractions'](_0x43da65[_0x5027('0x42')][_0x5027('0x62')])[_0x5027('0x16')](function(){if(_[_0x5027('0xb4')](_0x43da65[_0x5027('0x42')][_0x5027('0x62')])){for(var _0x5a8bc4=0x0;_0x5a8bc4<_0x43da65[_0x5027('0x42')][_0x5027('0x62')][_0x5027('0x4c')];_0x5a8bc4+=0x1){socket['emit'](_0x5027('0x127'),{'ChatInteractionId':Number(_0x43da65[_0x5027('0x42')]['ids'][_0x5a8bc4]),'UserId':Number(_0x43da65[_0x5027('0x53')]['id'])});}}else{socket[_0x5027('0xa8')](_0x5027('0x127'),{'ChatInteractionId':Number(_0x43da65[_0x5027('0x42')][_0x5027('0x62')]),'UserId':Number(_0x43da65[_0x5027('0x53')]['id'])});}});}})[_0x5027('0x16')](respondWithStatusCode(_0x4bc020,null))[_0x5027('0x1e')](handleError(_0x4bc020,null));};exports[_0x5027('0x128')]=function(_0x5b1720,_0x229433){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x5b1720[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x229433,null))[_0x5027('0x16')](function(_0x3f5cae){if(_0x3f5cae){return _0x3f5cae[_0x5027('0x128')](_0x5b1720[_0x5027('0x5f')][_0x5027('0x62')],_[_0x5027('0x63')](_0x5b1720[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{})[_0x5027('0x124')](function(){for(var _0x554b88=0x0;_0x554b88<_0x5b1720[_0x5027('0x5f')]['ids'][_0x5027('0x4c')];_0x554b88+=0x1){socket['emit']('user_has_mail_interactions:save',{'MailInteractionId':Number(_0x5b1720[_0x5027('0x5f')][_0x5027('0x62')][_0x554b88]),'UserId':Number(_0x5b1720[_0x5027('0x53')]['id'])});}return _0x5b1720[_0x5027('0x5f')]['ids'];});}})[_0x5027('0x16')](respondWithResult(_0x229433,null))[_0x5027('0x1e')](handleError(_0x229433,null));};exports[_0x5027('0x129')]=function(_0x4098e2,_0x549e71){return db['User'][_0x5027('0x37')]({'where':{'id':_0x4098e2[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x549e71,null))[_0x5027('0x16')](function(_0x3702d3){if(_0x3702d3){return _0x3702d3[_0x5027('0x129')](_0x4098e2['query'][_0x5027('0x62')])['then'](function(){if(_[_0x5027('0xb4')](_0x4098e2['query'][_0x5027('0x62')])){for(var _0x1cc041=0x0;_0x1cc041<_0x4098e2[_0x5027('0x42')]['ids'][_0x5027('0x4c')];_0x1cc041+=0x1){socket[_0x5027('0xa8')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4098e2[_0x5027('0x42')][_0x5027('0x62')][_0x1cc041]),'UserId':Number(_0x4098e2['params']['id'])});}}else{socket[_0x5027('0xa8')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4098e2[_0x5027('0x42')]['ids']),'UserId':Number(_0x4098e2[_0x5027('0x53')]['id'])});}});}})[_0x5027('0x16')](respondWithStatusCode(_0x549e71,null))[_0x5027('0x1e')](handleError(_0x549e71,null));};exports[_0x5027('0x12a')]=function(_0xb3146b,_0x49626a){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0xb3146b['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x49626a,null))['then'](function(_0x13b94c){if(_0x13b94c){return _0x13b94c['addFaxInteractions'](_0xb3146b[_0x5027('0x5f')][_0x5027('0x62')],_[_0x5027('0x63')](_0xb3146b[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{})['spread'](function(){for(var _0x54e255=0x0;_0x54e255<_0xb3146b[_0x5027('0x5f')]['ids'][_0x5027('0x4c')];_0x54e255+=0x1){socket[_0x5027('0xa8')](_0x5027('0x12b'),{'FaxInteractionId':Number(_0xb3146b['body']['ids'][_0x54e255]),'UserId':Number(_0xb3146b[_0x5027('0x53')]['id'])});}return _0xb3146b[_0x5027('0x5f')][_0x5027('0x62')];});}})[_0x5027('0x16')](respondWithResult(_0x49626a,null))[_0x5027('0x1e')](handleError(_0x49626a,null));};exports['removeFaxInteractions']=function(_0x2178c3,_0x2db5c0){return db['User'][_0x5027('0x37')]({'where':{'id':_0x2178c3[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x2db5c0,null))[_0x5027('0x16')](function(_0x49d4fe){if(_0x49d4fe){return _0x49d4fe[_0x5027('0x12c')](_0x2178c3['query'][_0x5027('0x62')])[_0x5027('0x16')](function(){if(_['isArray'](_0x2178c3['query'][_0x5027('0x62')])){for(var _0x33d16c=0x0;_0x33d16c<_0x2178c3[_0x5027('0x42')][_0x5027('0x62')]['length'];_0x33d16c+=0x1){socket[_0x5027('0xa8')](_0x5027('0x12d'),{'FaxInteractionId':Number(_0x2178c3[_0x5027('0x42')][_0x5027('0x62')][_0x33d16c]),'UserId':Number(_0x2178c3['params']['id'])});}}else{socket[_0x5027('0xa8')](_0x5027('0x12d'),{'FaxInteractionId':Number(_0x2178c3[_0x5027('0x42')]['ids']),'UserId':Number(_0x2178c3[_0x5027('0x53')]['id'])});}});}})[_0x5027('0x16')](respondWithStatusCode(_0x2db5c0,null))[_0x5027('0x1e')](handleError(_0x2db5c0,null));};exports[_0x5027('0x12e')]=function(_0x33424d,_0x541165){return db[_0x5027('0x41')]['find']({'where':{'id':_0x33424d[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x541165,null))['then'](function(_0xbf11b5){if(_0xbf11b5){return _0xbf11b5[_0x5027('0x12e')](_0x33424d[_0x5027('0x5f')]['ids'],_[_0x5027('0x63')](_0x33424d[_0x5027('0x5f')],['ids','id'])||{})[_0x5027('0x124')](function(){for(var _0x155834=0x0;_0x155834<_0x33424d[_0x5027('0x5f')][_0x5027('0x62')][_0x5027('0x4c')];_0x155834+=0x1){socket[_0x5027('0xa8')](_0x5027('0x12f'),{'SmsInteractionId':Number(_0x33424d[_0x5027('0x5f')][_0x5027('0x62')][_0x155834]),'UserId':Number(_0x33424d[_0x5027('0x53')]['id'])});}return _0x33424d[_0x5027('0x5f')][_0x5027('0x62')];});}})[_0x5027('0x16')](respondWithResult(_0x541165,null))[_0x5027('0x1e')](handleError(_0x541165,null));};exports[_0x5027('0x130')]=function(_0x12be32,_0x37dfd2){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x12be32[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x37dfd2,null))['then'](function(_0x2b9fee){if(_0x2b9fee){return _0x2b9fee[_0x5027('0x130')](_0x12be32[_0x5027('0x42')][_0x5027('0x62')])['then'](function(){if(_[_0x5027('0xb4')](_0x12be32[_0x5027('0x42')][_0x5027('0x62')])){for(var _0x5390a3=0x0;_0x5390a3<_0x12be32[_0x5027('0x42')][_0x5027('0x62')][_0x5027('0x4c')];_0x5390a3+=0x1){socket[_0x5027('0xa8')](_0x5027('0x131'),{'SmsInteractionId':Number(_0x12be32[_0x5027('0x42')][_0x5027('0x62')][_0x5390a3]),'UserId':Number(_0x12be32['params']['id'])});}}else{socket[_0x5027('0xa8')](_0x5027('0x131'),{'SmsInteractionId':Number(_0x12be32[_0x5027('0x42')][_0x5027('0x62')]),'UserId':Number(_0x12be32[_0x5027('0x53')]['id'])});}});}})[_0x5027('0x16')](respondWithStatusCode(_0x37dfd2,null))[_0x5027('0x1e')](handleError(_0x37dfd2,null));};exports['addOpenchannelInteractions']=function(_0x47425c,_0x2bdecc){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x47425c['params']['id']}})['then'](handleEntityNotFound(_0x2bdecc,null))[_0x5027('0x16')](function(_0x1e430b){if(_0x1e430b){return _0x1e430b[_0x5027('0x132')](_0x47425c[_0x5027('0x5f')][_0x5027('0x62')],_[_0x5027('0x63')](_0x47425c[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{})[_0x5027('0x124')](function(){for(var _0x570296=0x0;_0x570296<_0x47425c['body'][_0x5027('0x62')]['length'];_0x570296+=0x1){socket[_0x5027('0xa8')](_0x5027('0x133'),{'OpenchannelInteractionId':Number(_0x47425c['body'][_0x5027('0x62')][_0x570296]),'UserId':Number(_0x47425c[_0x5027('0x53')]['id'])});}return _0x47425c['body'][_0x5027('0x62')];});}})['then'](respondWithResult(_0x2bdecc,null))[_0x5027('0x1e')](handleError(_0x2bdecc,null));};exports[_0x5027('0x134')]=function(_0x838793,_0x55e1db){return db[_0x5027('0x41')]['find']({'where':{'id':_0x838793[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x55e1db,null))[_0x5027('0x16')](function(_0x5c125d){if(_0x5c125d){return _0x5c125d['removeOpenchannelInteractions'](_0x838793[_0x5027('0x42')]['ids'])[_0x5027('0x16')](function(){if(_[_0x5027('0xb4')](_0x838793[_0x5027('0x42')][_0x5027('0x62')])){for(var _0x52da52=0x0;_0x52da52<_0x838793['query'][_0x5027('0x62')][_0x5027('0x4c')];_0x52da52+=0x1){socket['emit'](_0x5027('0x135'),{'OpenchannelInteractionId':Number(_0x838793[_0x5027('0x42')][_0x5027('0x62')][_0x52da52]),'UserId':Number(_0x838793['params']['id'])});}}else{socket['emit'](_0x5027('0x135'),{'OpenchannelInteractionId':Number(_0x838793[_0x5027('0x42')][_0x5027('0x62')]),'UserId':Number(_0x838793[_0x5027('0x53')]['id'])});}});}})[_0x5027('0x16')](respondWithStatusCode(_0x55e1db,null))[_0x5027('0x1e')](handleError(_0x55e1db,null));};exports[_0x5027('0x136')]=function(_0xe512cf,_0x109ae4){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0xe512cf['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x109ae4,null))[_0x5027('0x16')](function(_0x547b64){if(_0x547b64){return _0x547b64[_0x5027('0x136')](_0xe512cf[_0x5027('0x5f')]['ids'],_['omit'](_0xe512cf[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{})['spread'](function(){for(var _0x153b78=0x0;_0x153b78<_0xe512cf[_0x5027('0x5f')]['ids'][_0x5027('0x4c')];_0x153b78+=0x1){socket['emit'](_0x5027('0x137'),{'WhatsappInteractionId':Number(_0xe512cf['body'][_0x5027('0x62')][_0x153b78]),'UserId':Number(_0xe512cf[_0x5027('0x53')]['id'])});}return _0xe512cf['body'][_0x5027('0x62')];});}})['then'](respondWithResult(_0x109ae4,null))[_0x5027('0x1e')](handleError(_0x109ae4,null));};exports['removeWhatsappInteractions']=function(_0x2fc10a,_0x529363){return db['User']['find']({'where':{'id':_0x2fc10a['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x529363,null))[_0x5027('0x16')](function(_0x1f4afa){if(_0x1f4afa){return _0x1f4afa[_0x5027('0x138')](_0x2fc10a[_0x5027('0x42')][_0x5027('0x62')]);}})[_0x5027('0x16')](respondWithStatusCode(_0x529363,null))['catch'](handleError(_0x529363,null));};exports[_0x5027('0x139')]=function(_0x3b6a93,_0x49a97c){var _0x2b7d04={};var _0xf28fe5={};var _0x5c0458;var _0x3422d7;return db['User'][_0x5027('0x9c')]({'where':{'id':_0x3b6a93[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x49a97c,null))['then'](function(_0x341b10){if(_0x341b10){_0x5c0458=_0x341b10;_0xf28fe5[_0x5027('0x54')]=_[_0x5027('0x56')](db['VoicePrefix'][_0x5027('0x57')]);_0xf28fe5[_0x5027('0x42')]=_[_0x5027('0x56')](_0x3b6a93[_0x5027('0x42')]);_0xf28fe5['filters']=_[_0x5027('0x58')](_0xf28fe5['model'],_0xf28fe5[_0x5027('0x42')]);_0x2b7d04[_0x5027('0x47')]=_['intersection'](_0xf28fe5[_0x5027('0x54')],qs['fields'](_0x3b6a93[_0x5027('0x42')][_0x5027('0x59')]));_0x2b7d04[_0x5027('0x47')]=_0x2b7d04['attributes']['length']?_0x2b7d04[_0x5027('0x47')]:_0xf28fe5[_0x5027('0x54')];_0x2b7d04[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x3b6a93['query'][_0x5027('0xce')]);_0x2b7d04['where']=qs[_0x5027('0xcf')](_['pick'](_0x3b6a93[_0x5027('0x42')],_0xf28fe5[_0x5027('0xcf')]));if(_0x3b6a93[_0x5027('0x42')][_0x5027('0x32')]){_0x2b7d04[_0x5027('0x40')]=_['merge'](_0x2b7d04[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x2b7d04['attributes'],function(_0x51a9c5){var _0x12e2f5={};_0x12e2f5[_0x51a9c5]={'$like':'%'+_0x3b6a93[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x12e2f5;})});}_0x2b7d04=_['merge']({},_0x2b7d04,_0x3b6a93[_0x5027('0x5c')]);return _0x5c0458[_0x5027('0x139')](_0x2b7d04);}})[_0x5027('0x16')](function(_0x51bcf2){if(_0x51bcf2){_0x3422d7=_0x51bcf2['length'];if(!_0x3b6a93['query']['hasOwnProperty'](_0x5027('0xd6'))){_0x2b7d04['limit']=qs[_0x5027('0x25')](_0x3b6a93[_0x5027('0x42')][_0x5027('0x25')]);_0x2b7d04[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x3b6a93[_0x5027('0x42')]['offset']);}return _0x5c0458[_0x5027('0x139')](_0x2b7d04);}})['then'](function(_0x266d8a){if(_0x266d8a){return _0x266d8a?{'count':_0x3422d7,'rows':_0x266d8a}:null;}})[_0x5027('0x16')](respondWithResult(_0x49a97c,null))[_0x5027('0x1e')](handleError(_0x49a97c,null));};exports[_0x5027('0x13a')]=function(_0x28b6a9,_0x202a24){var _0x45c36f={};var _0x48105a={};var _0x4a71d0;var _0x45bede;return db['User'][_0x5027('0x9c')]({'where':{'id':_0x28b6a9['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x202a24,null))[_0x5027('0x16')](function(_0x2d74e9){if(_0x2d74e9){_0x4a71d0=_0x2d74e9;_0x48105a[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x13b')][_0x5027('0x57')]);_0x48105a[_0x5027('0x42')]=_[_0x5027('0x56')](_0x28b6a9[_0x5027('0x42')]);_0x48105a[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x48105a['model'],_0x48105a[_0x5027('0x42')]);_0x45c36f['attributes']=_[_0x5027('0x58')](_0x48105a[_0x5027('0x54')],qs[_0x5027('0x59')](_0x28b6a9[_0x5027('0x42')][_0x5027('0x59')]));_0x45c36f['attributes']=_0x45c36f['attributes'][_0x5027('0x4c')]?_0x45c36f[_0x5027('0x47')]:_0x48105a[_0x5027('0x54')];_0x45c36f[_0x5027('0xdc')]=qs['sort'](_0x28b6a9[_0x5027('0x42')][_0x5027('0xce')]);_0x45c36f['where']=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x28b6a9[_0x5027('0x42')],_0x48105a['filters']));if(_0x28b6a9[_0x5027('0x42')][_0x5027('0x32')]){_0x45c36f[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x45c36f[_0x5027('0x40')],{'$or':_['map'](_0x45c36f[_0x5027('0x47')],function(_0x25b476){var _0x4b04b9={};_0x4b04b9[_0x25b476]={'$like':'%'+_0x28b6a9[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x4b04b9;})});}_0x45c36f=_[_0x5027('0x5b')]({},_0x45c36f,_0x28b6a9[_0x5027('0x5c')]);return _0x4a71d0['getFaxAccounts'](_0x45c36f);}})[_0x5027('0x16')](function(_0x4167a0){if(_0x4167a0){_0x45bede=_0x4167a0[_0x5027('0x4c')];if(!_0x28b6a9['query'][_0x5027('0xd0')](_0x5027('0xd6'))){_0x45c36f['limit']=qs[_0x5027('0x25')](_0x28b6a9['query'][_0x5027('0x25')]);_0x45c36f['offset']=qs[_0x5027('0x23')](_0x28b6a9['query'][_0x5027('0x23')]);}return _0x4a71d0[_0x5027('0x13a')](_0x45c36f);}})[_0x5027('0x16')](function(_0x3616a0){if(_0x3616a0){return _0x3616a0?{'count':_0x45bede,'rows':_0x3616a0}:null;}})[_0x5027('0x16')](respondWithResult(_0x202a24,null))[_0x5027('0x1e')](handleError(_0x202a24,null));};exports[_0x5027('0x13c')]=function(_0x1bc9de,_0xb3d185){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x1bc9de[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0xb3d185,null))[_0x5027('0x16')](function(_0x42aca6){if(_0x42aca6){return _0x42aca6[_0x5027('0x13c')](_0x1bc9de['body']['ids'],_[_0x5027('0x63')](_0x1bc9de[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{});}})[_0x5027('0x16')](respondWithResult(_0xb3d185,null))[_0x5027('0x1e')](handleError(_0xb3d185,null));};exports[_0x5027('0x13d')]=function(_0x3a3ee4,_0x198de9){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x3a3ee4['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x198de9,null))[_0x5027('0x16')](function(_0x28df4b){if(_0x28df4b){return _0x28df4b['removeFaxAccounts'](_0x3a3ee4[_0x5027('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x198de9,null))['catch'](handleError(_0x198de9,null));};exports[_0x5027('0x13e')]=function(_0x13933f,_0x1a09e2){var _0x3d3240={};var _0x4fb80a={};var _0x17668d;var _0x102ca9;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x13933f['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x1a09e2,null))[_0x5027('0x16')](function(_0x25dc8a){if(_0x25dc8a){_0x17668d=_0x25dc8a;_0x4fb80a[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x13f')]['rawAttributes']);_0x4fb80a['query']=_[_0x5027('0x56')](_0x13933f[_0x5027('0x42')]);_0x4fb80a['filters']=_[_0x5027('0x58')](_0x4fb80a[_0x5027('0x54')],_0x4fb80a[_0x5027('0x42')]);_0x3d3240[_0x5027('0x47')]=_[_0x5027('0x58')](_0x4fb80a['model'],qs[_0x5027('0x59')](_0x13933f[_0x5027('0x42')][_0x5027('0x59')]));_0x3d3240[_0x5027('0x47')]=_0x3d3240[_0x5027('0x47')]['length']?_0x3d3240[_0x5027('0x47')]:_0x4fb80a[_0x5027('0x54')];_0x3d3240['order']=qs[_0x5027('0xce')](_0x13933f[_0x5027('0x42')][_0x5027('0xce')]);_0x3d3240[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x13933f[_0x5027('0x42')],_0x4fb80a[_0x5027('0xcf')]));if(_0x13933f[_0x5027('0x42')][_0x5027('0x32')]){_0x3d3240[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x3d3240[_0x5027('0x40')],{'$or':_['map'](_0x3d3240[_0x5027('0x47')],function(_0x513dac){var _0x3534d0={};_0x3534d0[_0x513dac]={'$like':'%'+_0x13933f[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x3534d0;})});}_0x3d3240=_[_0x5027('0x5b')]({},_0x3d3240,_0x13933f[_0x5027('0x5c')]);return _0x17668d['getMailAccounts'](_0x3d3240);}})[_0x5027('0x16')](function(_0x3e9f58){if(_0x3e9f58){_0x102ca9=_0x3e9f58[_0x5027('0x4c')];if(!_0x13933f[_0x5027('0x42')]['hasOwnProperty'](_0x5027('0xd6'))){_0x3d3240['limit']=qs[_0x5027('0x25')](_0x13933f[_0x5027('0x42')][_0x5027('0x25')]);_0x3d3240[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x13933f[_0x5027('0x42')][_0x5027('0x23')]);}return _0x17668d[_0x5027('0x13e')](_0x3d3240);}})[_0x5027('0x16')](function(_0x9d43c6){if(_0x9d43c6){return _0x9d43c6?{'count':_0x102ca9,'rows':_0x9d43c6}:null;}})[_0x5027('0x16')](respondWithResult(_0x1a09e2,null))[_0x5027('0x1e')](handleError(_0x1a09e2,null));};exports[_0x5027('0x140')]=function(_0x5d9ffc,_0x59c919){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x5d9ffc[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x59c919,null))[_0x5027('0x16')](function(_0x2848bc){if(_0x2848bc){return _0x2848bc[_0x5027('0x140')](_0x5d9ffc[_0x5027('0x5f')]['ids'],_[_0x5027('0x63')](_0x5d9ffc[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{});}})[_0x5027('0x16')](respondWithResult(_0x59c919,null))[_0x5027('0x1e')](handleError(_0x59c919,null));};exports[_0x5027('0x141')]=function(_0x12f0a3,_0x34fcae){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x12f0a3[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x34fcae,null))[_0x5027('0x16')](function(_0x3a1a27){if(_0x3a1a27){return _0x3a1a27[_0x5027('0x141')](_0x12f0a3[_0x5027('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x34fcae,null))[_0x5027('0x1e')](handleError(_0x34fcae,null));};exports['getOpenchannelAccounts']=function(_0x25d9bf,_0x723dc4){var _0x2ee474={};var _0x472759={};var _0xbaf1cf;var _0x56b81c;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x25d9bf['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x723dc4,null))[_0x5027('0x16')](function(_0x29675f){if(_0x29675f){_0xbaf1cf=_0x29675f;_0x472759[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x142')][_0x5027('0x57')]);_0x472759[_0x5027('0x42')]=_['keys'](_0x25d9bf[_0x5027('0x42')]);_0x472759[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x472759['model'],_0x472759[_0x5027('0x42')]);_0x2ee474['attributes']=_[_0x5027('0x58')](_0x472759['model'],qs[_0x5027('0x59')](_0x25d9bf[_0x5027('0x42')][_0x5027('0x59')]));_0x2ee474['attributes']=_0x2ee474[_0x5027('0x47')][_0x5027('0x4c')]?_0x2ee474[_0x5027('0x47')]:_0x472759['model'];_0x2ee474[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x25d9bf[_0x5027('0x42')][_0x5027('0xce')]);_0x2ee474[_0x5027('0x40')]=qs[_0x5027('0xcf')](_['pick'](_0x25d9bf[_0x5027('0x42')],_0x472759['filters']));if(_0x25d9bf['query'][_0x5027('0x32')]){_0x2ee474[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x2ee474[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x2ee474[_0x5027('0x47')],function(_0x892863){var _0x5802dc={};_0x5802dc[_0x892863]={'$like':'%'+_0x25d9bf['query'][_0x5027('0x32')]+'%'};return _0x5802dc;})});}_0x2ee474=_['merge']({},_0x2ee474,_0x25d9bf[_0x5027('0x5c')]);return _0xbaf1cf[_0x5027('0x143')](_0x2ee474);}})[_0x5027('0x16')](function(_0x66e301){if(_0x66e301){_0x56b81c=_0x66e301['length'];if(!_0x25d9bf[_0x5027('0x42')][_0x5027('0xd0')]('nolimit')){_0x2ee474['limit']=qs[_0x5027('0x25')](_0x25d9bf[_0x5027('0x42')][_0x5027('0x25')]);_0x2ee474[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x25d9bf['query'][_0x5027('0x23')]);}return _0xbaf1cf[_0x5027('0x143')](_0x2ee474);}})['then'](function(_0x100c8a){if(_0x100c8a){return _0x100c8a?{'count':_0x56b81c,'rows':_0x100c8a}:null;}})[_0x5027('0x16')](respondWithResult(_0x723dc4,null))[_0x5027('0x1e')](handleError(_0x723dc4,null));};exports[_0x5027('0x144')]=function(_0x561f4b,_0x52535a){return db['User'][_0x5027('0x37')]({'where':{'id':_0x561f4b[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x52535a,null))[_0x5027('0x16')](function(_0x49c300){if(_0x49c300){return _0x49c300[_0x5027('0x144')](_0x561f4b[_0x5027('0x5f')][_0x5027('0x62')],_['omit'](_0x561f4b[_0x5027('0x5f')],['ids','id'])||{});}})[_0x5027('0x16')](respondWithResult(_0x52535a,null))[_0x5027('0x1e')](handleError(_0x52535a,null));};exports[_0x5027('0x145')]=function(_0x40f7ca,_0x362275){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x40f7ca['params']['id']}})['then'](handleEntityNotFound(_0x362275,null))['then'](function(_0x3e6e46){if(_0x3e6e46){return _0x3e6e46[_0x5027('0x145')](_0x40f7ca[_0x5027('0x42')]['ids']);}})[_0x5027('0x16')](respondWithStatusCode(_0x362275,null))['catch'](handleError(_0x362275,null));};exports[_0x5027('0x146')]=function(_0x75742,_0x5f37ef){var _0x5b2ba2={};var _0x52cbdd={};var _0x2cd614;var _0x4ee153;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x75742[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x5f37ef,null))[_0x5027('0x16')](function(_0x5294c1){if(_0x5294c1){_0x2cd614=_0x5294c1;_0x52cbdd[_0x5027('0x54')]=_['keys'](db[_0x5027('0x147')]['rawAttributes']);_0x52cbdd['query']=_[_0x5027('0x56')](_0x75742[_0x5027('0x42')]);_0x52cbdd[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x52cbdd[_0x5027('0x54')],_0x52cbdd[_0x5027('0x42')]);_0x5b2ba2['attributes']=_['intersection'](_0x52cbdd['model'],qs[_0x5027('0x59')](_0x75742[_0x5027('0x42')][_0x5027('0x59')]));_0x5b2ba2[_0x5027('0x47')]=_0x5b2ba2[_0x5027('0x47')][_0x5027('0x4c')]?_0x5b2ba2[_0x5027('0x47')]:_0x52cbdd[_0x5027('0x54')];_0x5b2ba2[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x75742[_0x5027('0x42')][_0x5027('0xce')]);_0x5b2ba2['where']=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x75742[_0x5027('0x42')],_0x52cbdd[_0x5027('0xcf')]));if(_0x75742['query']['filter']){_0x5b2ba2[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x5b2ba2['where'],{'$or':_[_0x5027('0x34')](_0x5b2ba2[_0x5027('0x47')],function(_0x22a3e5){var _0x27bb49={};_0x27bb49[_0x22a3e5]={'$like':'%'+_0x75742[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x27bb49;})});}_0x5b2ba2=_[_0x5027('0x5b')]({},_0x5b2ba2,_0x75742[_0x5027('0x5c')]);return _0x2cd614['getSmsAccounts'](_0x5b2ba2);}})[_0x5027('0x16')](function(_0x32c38c){if(_0x32c38c){_0x4ee153=_0x32c38c[_0x5027('0x4c')];if(!_0x75742[_0x5027('0x42')][_0x5027('0xd0')](_0x5027('0xd6'))){_0x5b2ba2[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x75742[_0x5027('0x42')][_0x5027('0x25')]);_0x5b2ba2[_0x5027('0x23')]=qs['offset'](_0x75742['query']['offset']);}return _0x2cd614[_0x5027('0x146')](_0x5b2ba2);}})['then'](function(_0x535d66){if(_0x535d66){return _0x535d66?{'count':_0x4ee153,'rows':_0x535d66}:null;}})[_0x5027('0x16')](respondWithResult(_0x5f37ef,null))[_0x5027('0x1e')](handleError(_0x5f37ef,null));};exports[_0x5027('0x148')]=function(_0x3d8874,_0x44cc75){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x3d8874[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x44cc75,null))[_0x5027('0x16')](function(_0x1b779b){if(_0x1b779b){return _0x1b779b[_0x5027('0x148')](_0x3d8874[_0x5027('0x5f')][_0x5027('0x62')],_[_0x5027('0x63')](_0x3d8874[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{});}})[_0x5027('0x16')](respondWithResult(_0x44cc75,null))[_0x5027('0x1e')](handleError(_0x44cc75,null));};exports[_0x5027('0x149')]=function(_0x436c2c,_0x50aad1){return db['User']['find']({'where':{'id':_0x436c2c['params']['id']}})['then'](handleEntityNotFound(_0x50aad1,null))[_0x5027('0x16')](function(_0x1e90fa){if(_0x1e90fa){return _0x1e90fa[_0x5027('0x149')](_0x436c2c[_0x5027('0x42')]['ids']);}})[_0x5027('0x16')](respondWithStatusCode(_0x50aad1,null))[_0x5027('0x1e')](handleError(_0x50aad1,null));};exports[_0x5027('0x14a')]=function(_0x1cb95c,_0x2fee8f){var _0x33fce8={};var _0x23fffa={};var _0x4106b5;var _0x25e368;return db[_0x5027('0x41')]['findOne']({'where':{'id':_0x1cb95c[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x2fee8f,null))[_0x5027('0x16')](function(_0x4e6f73){if(_0x4e6f73){_0x4106b5=_0x4e6f73;_0x23fffa[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x14b')][_0x5027('0x57')]);_0x23fffa['query']=_[_0x5027('0x56')](_0x1cb95c['query']);_0x23fffa[_0x5027('0xcf')]=_[_0x5027('0x58')](_0x23fffa[_0x5027('0x54')],_0x23fffa[_0x5027('0x42')]);_0x33fce8[_0x5027('0x47')]=_['intersection'](_0x23fffa['model'],qs[_0x5027('0x59')](_0x1cb95c[_0x5027('0x42')][_0x5027('0x59')]));_0x33fce8[_0x5027('0x47')]=_0x33fce8[_0x5027('0x47')][_0x5027('0x4c')]?_0x33fce8[_0x5027('0x47')]:_0x23fffa['model'];_0x33fce8['order']=qs[_0x5027('0xce')](_0x1cb95c['query']['sort']);_0x33fce8[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x1cb95c[_0x5027('0x42')],_0x23fffa[_0x5027('0xcf')]));if(_0x1cb95c[_0x5027('0x42')][_0x5027('0x32')]){_0x33fce8[_0x5027('0x40')]=_[_0x5027('0x5b')](_0x33fce8['where'],{'$or':_[_0x5027('0x34')](_0x33fce8[_0x5027('0x47')],function(_0x244a52){var _0x17712b={};_0x17712b[_0x244a52]={'$like':'%'+_0x1cb95c[_0x5027('0x42')][_0x5027('0x32')]+'%'};return _0x17712b;})});}_0x33fce8=_[_0x5027('0x5b')]({},_0x33fce8,_0x1cb95c['options']);return _0x4106b5[_0x5027('0x14a')](_0x33fce8);}})[_0x5027('0x16')](function(_0x8bbc61){if(_0x8bbc61){_0x25e368=_0x8bbc61['length'];if(!_0x1cb95c['query'][_0x5027('0xd0')](_0x5027('0xd6'))){_0x33fce8[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x1cb95c[_0x5027('0x42')][_0x5027('0x25')]);_0x33fce8['offset']=qs[_0x5027('0x23')](_0x1cb95c['query'][_0x5027('0x23')]);}return _0x4106b5[_0x5027('0x14a')](_0x33fce8);}})[_0x5027('0x16')](function(_0x4867c4){if(_0x4867c4){return _0x4867c4?{'count':_0x25e368,'rows':_0x4867c4}:null;}})[_0x5027('0x16')](respondWithResult(_0x2fee8f,null))[_0x5027('0x1e')](handleError(_0x2fee8f,null));};exports[_0x5027('0x14c')]=function(_0x22e338,_0x135839){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x22e338[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x135839,null))[_0x5027('0x16')](function(_0x20ad9c){if(_0x20ad9c){return _0x20ad9c[_0x5027('0x14c')](_0x22e338[_0x5027('0x5f')]['ids'],_[_0x5027('0x63')](_0x22e338[_0x5027('0x5f')],[_0x5027('0x62'),'id'])||{});}})[_0x5027('0x16')](respondWithResult(_0x135839,null))['catch'](handleError(_0x135839,null));};exports[_0x5027('0x14d')]=function(_0x478763,_0x1a1c97){return db['User'][_0x5027('0x37')]({'where':{'id':_0x478763['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x1a1c97,null))['then'](function(_0x5d5406){if(_0x5d5406){return _0x5d5406['removeChatWebsites'](_0x478763[_0x5027('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x1a1c97,null))[_0x5027('0x1e')](handleError(_0x1a1c97,null));};exports['getWhatsappAccounts']=function(_0x361ea9,_0x35b0cd){var _0xba15b={};var _0x29f43a={};var _0x380c43;var _0x3826ae;return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x361ea9['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x35b0cd,null))['then'](function(_0x24b0f3){if(_0x24b0f3){_0x380c43=_0x24b0f3;_0x29f43a[_0x5027('0x54')]=_[_0x5027('0x56')](db[_0x5027('0x14e')][_0x5027('0x57')]);_0x29f43a['query']=_[_0x5027('0x56')](_0x361ea9[_0x5027('0x42')]);_0x29f43a['filters']=_['intersection'](_0x29f43a[_0x5027('0x54')],_0x29f43a[_0x5027('0x42')]);_0xba15b['attributes']=_[_0x5027('0x58')](_0x29f43a['model'],qs[_0x5027('0x59')](_0x361ea9[_0x5027('0x42')]['fields']));_0xba15b[_0x5027('0x47')]=_0xba15b[_0x5027('0x47')]['length']?_0xba15b['attributes']:_0x29f43a['model'];_0xba15b['order']=qs[_0x5027('0xce')](_0x361ea9[_0x5027('0x42')][_0x5027('0xce')]);_0xba15b[_0x5027('0x40')]=qs[_0x5027('0xcf')](_[_0x5027('0xd8')](_0x361ea9[_0x5027('0x42')],_0x29f43a[_0x5027('0xcf')]));if(_0x361ea9['query']['filter']){_0xba15b[_0x5027('0x40')]=_[_0x5027('0x5b')](_0xba15b[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0xba15b[_0x5027('0x47')],function(_0x432766){var _0x3a5557={};_0x3a5557[_0x432766]={'$like':'%'+_0x361ea9['query'][_0x5027('0x32')]+'%'};return _0x3a5557;})});}_0xba15b=_[_0x5027('0x5b')]({},_0xba15b,_0x361ea9[_0x5027('0x5c')]);return _0x380c43[_0x5027('0x14f')](_0xba15b);}})[_0x5027('0x16')](function(_0x306bfa){if(_0x306bfa){_0x3826ae=_0x306bfa[_0x5027('0x4c')];if(!_0x361ea9[_0x5027('0x42')]['hasOwnProperty'](_0x5027('0xd6'))){_0xba15b[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x361ea9[_0x5027('0x42')][_0x5027('0x25')]);_0xba15b[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x361ea9[_0x5027('0x42')][_0x5027('0x23')]);}return _0x380c43[_0x5027('0x14f')](_0xba15b);}})[_0x5027('0x16')](function(_0x3bbc7e){if(_0x3bbc7e){return _0x3bbc7e?{'count':_0x3826ae,'rows':_0x3bbc7e}:null;}})[_0x5027('0x16')](respondWithResult(_0x35b0cd,null))['catch'](handleError(_0x35b0cd,null));};exports[_0x5027('0x150')]=function(_0x45a0f7,_0x5980ac){return db[_0x5027('0x41')][_0x5027('0x37')]({'where':{'id':_0x45a0f7[_0x5027('0x53')]['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x5980ac,null))['then'](function(_0x4f3c57){if(_0x4f3c57){return _0x4f3c57['addWhatsappAccounts'](_0x45a0f7[_0x5027('0x5f')][_0x5027('0x62')],_['omit'](_0x45a0f7[_0x5027('0x5f')],['ids','id'])||{});}})[_0x5027('0x16')](respondWithResult(_0x5980ac,null))['catch'](handleError(_0x5980ac,null));};exports['removeWhatsappAccounts']=function(_0x37ceeb,_0x3f248c){return db['User'][_0x5027('0x37')]({'where':{'id':_0x37ceeb[_0x5027('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f248c,null))['then'](function(_0x378944){if(_0x378944){return _0x378944[_0x5027('0x151')](_0x37ceeb[_0x5027('0x42')]['ids']);}})[_0x5027('0x16')](respondWithStatusCode(_0x3f248c,null))['catch'](handleError(_0x3f248c,null));};exports[_0x5027('0x152')]=function(_0x15aef3,_0x5a26b0){var _0x3be66a={},_0x42ccc5={},_0x18d055={'count':0x0,'rows':[]};var _0x139606=db[_0x5027('0x153')][_0x5027('0x57')];_0x42ccc5[_0x5027('0x54')]=_[_0x5027('0x56')](_0x139606);_0x42ccc5[_0x5027('0x42')]=_[_0x5027('0x56')](_0x15aef3['query']);_0x42ccc5['filters']=_[_0x5027('0x58')](_0x42ccc5['model'],_0x42ccc5[_0x5027('0x42')]);_0x42ccc5[_0x5027('0xcf')]=_[_0x5027('0xcc')](_0x42ccc5[_0x5027('0xcf')],[_0x5027('0x154'),_0x5027('0x155'),_0x5027('0x156'),_0x5027('0x157'),_0x5027('0x158'),_0x5027('0x159'),'$ne',_0x5027('0x15a'),_0x5027('0x15b'),_0x5027('0x15c'),_0x5027('0x15d'),_0x5027('0x15e'),_0x5027('0x15f'),'$like',_0x5027('0x160'),_0x5027('0x161'),_0x5027('0x162'),_0x5027('0x163'),_0x5027('0x164'),_0x5027('0x165'),_0x5027('0x166'),_0x5027('0x167')]);_0x3be66a[_0x5027('0x47')]=_[_0x5027('0x58')](_0x42ccc5[_0x5027('0x54')],qs[_0x5027('0x59')](_0x15aef3[_0x5027('0x42')]['fields']));_0x3be66a[_0x5027('0x47')]=_0x3be66a[_0x5027('0x47')][_0x5027('0x4c')]?_0x3be66a[_0x5027('0x47')]:_0x42ccc5[_0x5027('0x54')];if(!_0x15aef3['query'][_0x5027('0xd0')](_0x5027('0xd6'))){_0x3be66a[_0x5027('0x25')]=qs[_0x5027('0x25')](_0x15aef3[_0x5027('0x42')][_0x5027('0x25')]);_0x3be66a['offset']=qs[_0x5027('0x23')](_0x15aef3[_0x5027('0x42')][_0x5027('0x23')]);}_0x3be66a[_0x5027('0xdc')]=qs[_0x5027('0xce')](_0x15aef3[_0x5027('0x42')][_0x5027('0xce')]);_0x3be66a['where']=qs[_0x5027('0xcf')](_['pick'](_0x15aef3['query'],_0x42ccc5[_0x5027('0xcf')]));if(_0x15aef3[_0x5027('0x42')][_0x5027('0x32')]){_0x3be66a[_0x5027('0x40')]=_['merge'](_0x3be66a[_0x5027('0x40')],{'$or':_[_0x5027('0x34')](_0x3be66a[_0x5027('0x47')],function(_0x36a797){var _0xd5427c={};_0xd5427c[_0x36a797]={'$like':'%'+_0x15aef3['query']['filter']+'%'};return _0xd5427c;})});}_0x3be66a['where']={'$and':[_0x3be66a[_0x5027('0x40')],{'$or':[{'UserId':_0x15aef3['params']['id']},{'OwnerId':_0x15aef3[_0x5027('0x53')]['id']}]}]};_0x3be66a=_['merge']({},_0x3be66a,_0x15aef3[_0x5027('0x5c')]);var _0xb97938={'where':_0x3be66a[_0x5027('0x40')]};return db[_0x5027('0x153')][_0x5027('0x26')](_0xb97938)[_0x5027('0x16')](function(_0x237686){_0x18d055[_0x5027('0x26')]=_0x237686;if(_0x15aef3[_0x5027('0x42')][_0x5027('0x43')]){_0x3be66a[_0x5027('0x44')]=[{'attributes':['id',_0x5027('0x168'),_0x5027('0x169'),_0x5027('0x16a')],'model':db[_0x5027('0x16b')],'as':'Contact'},{'attributes':['id',_0x5027('0x38'),_0x5027('0x16c')],'model':db[_0x5027('0xac')],'as':'Queue'}];}return db['CmHopper'][_0x5027('0x49')](_0x3be66a);})[_0x5027('0x16')](function(_0x4544ad){_0x18d055[_0x5027('0x4a')]=_0x4544ad;return _0x18d055;})[_0x5027('0x16')](respondWithFilteredResult(_0x5a26b0,_0x3be66a))[_0x5027('0x1e')](handleError(_0x5a26b0,null));};exports[_0x5027('0x16d')]=function(_0x46eece,_0x7434c6){if(!_[_0x5027('0x6a')](_0x46eece[_0x5027('0x2f')]['id'])&&(_0x46eece['user'][_0x5027('0x2a')]==_0x5027('0x85')||_0x46eece[_0x5027('0x2f')][_0x5027('0x2a')]==_0x5027('0x2f'))){return db[_0x5027('0x41')][_0x5027('0x9c')]({'where':{'id':_0x46eece['params']['id']},'raw':!![]})[_0x5027('0x16')](function(_0x4d49b9){return authService[_0x5027('0x16e')](_0x4d49b9);})[_0x5027('0x16')](function(_0x5997e3){if(_0x5997e3){return _0x7434c6['status'](0xc8)[_0x5027('0x22')]({'api_key':_0x5997e3[_0x5027('0x16f')]});}else{return _0x7434c6[_0x5027('0x20')](0xcc)['json']({'message':_0x5027('0x170')});}})[_0x5027('0x1e')](handleError(_0x7434c6,0x193));}else{return _0x7434c6[_0x5027('0x20')](0x191)['json']({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports[_0x5027('0x171')]=function(_0x5eb030,_0x58a07f){if(!_[_0x5027('0x6a')](_0x5eb030[_0x5027('0x2f')]['id'])&&(_0x5eb030[_0x5027('0x2f')][_0x5027('0x2a')]==_0x5027('0x85')||_0x5eb030[_0x5027('0x2f')][_0x5027('0x2a')]=='user')){return db['User'][_0x5027('0x37')]({'where':{'id':_0x5eb030['params']['id']}})[_0x5027('0x16')](function(_0x2106c5){return authService['generateApiKey'](_0x2106c5);})[_0x5027('0x16')](function(_0x2245c8){return db['User'][_0x5027('0x29')]({'apiKeyIat':_0x2245c8[_0x5027('0x172')],'apiKeyNonce':_0x2245c8[_0x5027('0x173')]},{'where':{'id':_0x5eb030['params']['id']}})[_0x5027('0x16')](function(){return _0x58a07f['status'](0xc8)['json']({'api_key':_0x2245c8[_0x5027('0x16f')]});});})[_0x5027('0x1e')](handleError(_0x58a07f,0x193));}else{return _0x58a07f[_0x5027('0x20')](0x191)[_0x5027('0x22')]({'message':_0x5027('0x174')});}};exports[_0x5027('0x175')]=function(_0x5825e0,_0x58ac82){if(!_[_0x5027('0x6a')](_0x5825e0[_0x5027('0x2f')]['id'])&&(_0x5825e0['user']['role']==_0x5027('0x85')||_0x5825e0['user'][_0x5027('0x2a')]==_0x5027('0x2f'))){return db['User']['find']({'where':{'id':_0x5825e0['params']['id']}})[_0x5027('0x16')](handleEntityNotFound(_0x58ac82,null))['then'](function(_0x53feb4){if(_0x53feb4&&_0x53feb4[_0x5027('0x176')]&&_0x53feb4[_0x5027('0x177')])return _0x53feb4;else throw{'message':_0x5027('0x178')};})[_0x5027('0x16')](function(){return db['User']['update']({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x5825e0['params']['id']}});})[_0x5027('0x16')](respondWithStatusCode(_0x58ac82,0xc8))[_0x5027('0x1e')](handleError(_0x58ac82,0x193));}else{return _0x58ac82[_0x5027('0x20')](0x191)[_0x5027('0x22')]({'message':_0x5027('0x174')});}};exports[_0x5027('0x179')]=function(_0x525629,_0x16d974){var _0x22522f=_0x525629[_0x5027('0x2f')][_0x5027('0x2d')]({'plain':!![]});if(!_0x22522f){return _0x16d974['status'](0x191)[_0x5027('0x3a')](_0x5027('0x17a'));}else{Promise['resolve']()['then'](function(){if(_0x525629[_0x5027('0x42')][_0x5027('0x45')]!==_0x5027('0x46'))return;return _0x525629['user'][_0x5027('0x17b')]();})[_0x5027('0x16')](function(_0xf832e1){if(!_0xf832e1)return;return _0xf832e1[_0x5027('0x2d')]({'plain':!![]});})['then'](function(_0x5ee5a8){_0x22522f[_0x5027('0x45')]=_0x5ee5a8;return _0x16d974[_0x5027('0x20')](0xc8)[_0x5027('0x22')](_0x22522f);});}};exports['getPresence']=function(_0x4201e9,_0xce16c2){var _0x537b16={'offset':0x0},_0x565593={'count':0x0,'rows':[]};Promise['resolve']()[_0x5027('0x16')](function(){if(!_0x4201e9[_0x5027('0x42')][_0x5027('0x32')]&&!_0x4201e9['query']['teams']&&!_0x4201e9[_0x5027('0x42')][_0x5027('0x17c')])return[];return Promise[_0x5027('0x112')]()[_0x5027('0x16')](function(){var _0x2b689f=[];if(!_[_0x5027('0x17d')](_0x4201e9['query'][_0x5027('0x17e')])){_0x2b689f[_0x5027('0x48')](db['Team']['findAll']({'attributes':['id',_0x5027('0x38')],'where':{'id':_0x4201e9[_0x5027('0x42')][_0x5027('0x17e')]}}));}if(!_[_0x5027('0x17d')](_0x4201e9[_0x5027('0x42')][_0x5027('0x17c')])){_0x2b689f['push'](db[_0x5027('0xac')][_0x5027('0x49')]({'attributes':['id',_0x5027('0x38')],'type':_0x5027('0x17f'),'where':{'id':_0x4201e9['query'][_0x5027('0x17c')]}}));}return Promise[_0x5027('0x52')](_0x2b689f);})[_0x5027('0x16')](function(_0x5c200c){var _0x5cfb1b=_[_0x5027('0x180')](_0x5c200c)[_0x5027('0x34')](function(_0x56a54d){return _0x56a54d[_0x5027('0x120')]({'attributes':['id',_0x5027('0x38'),_0x5027('0x64'),_0x5027('0xa3')],'raw':!![]});});return Promise[_0x5027('0x52')](_0x5cfb1b);})['then'](function(_0x464907){var _0x4f5115=_['flatten'](_0x464907);if(!_0x4201e9[_0x5027('0x42')][_0x5027('0x32')])return _0x4f5115;if(_[_0x5027('0x17d')](_0x4f5115)){return db['User']['findAll']({'attributes':['id','name',_0x5027('0x64'),_0x5027('0xa3')],'where':{'role':_0x5027('0x84'),'$or':[db[_0x5027('0x6b')][_0x5027('0x40')](db['sequelize']['fn'](_0x5027('0x181'),db[_0x5027('0x6b')][_0x5027('0x182')](_0x5027('0x38'))),{'$like':'%'+_0x4201e9[_0x5027('0x42')]['filter'][_0x5027('0xa9')]()+'%'}),{'internal':{'$like':'%'+_0x4201e9[_0x5027('0x42')][_0x5027('0x32')]+'%'}}]},'raw':!![]});}else{return _(_0x4f5115)[_0x5027('0x180')]()['filter'](function(_0xda60b4){return _0xda60b4[_0x5027('0x38')]['toLowerCase']()[_0x5027('0x36')](_0x4201e9[_0x5027('0x42')][_0x5027('0x32')][_0x5027('0xa9')]())||_0xda60b4[_0x5027('0x64')][_0x5027('0x183')]()[_0x5027('0x36')](_0x4201e9[_0x5027('0x42')][_0x5027('0x32')]);})[_0x5027('0x35')]();}})[_0x5027('0x16')](function(_0x5716a4){var _0x436c41=_0x5027('0x38');var _0x226131=_0x5027('0x184');if(_0x4201e9[_0x5027('0x42')][_0x5027('0xce')]){_0x226131=_0x4201e9[_0x5027('0x42')][_0x5027('0xce')][0x0]==='-'?_0x5027('0x185'):_0x5027('0x184');_0x436c41=_0x226131===_0x5027('0x184')?_0x4201e9[_0x5027('0x42')][_0x5027('0xce')]:_0x4201e9[_0x5027('0x42')][_0x5027('0xce')][_0x5027('0x186')](0x1);}return _(_0x5716a4)[_0x5027('0x187')]('id')['orderBy']([function(_0x9b239b){return _0x436c41===_0x5027('0x38')?_0x9b239b[_0x436c41][_0x5027('0xa9')]():_0x9b239b[_0x436c41];}],[_0x226131])[_0x5027('0x34')](function(_0x152fe5){return _['pick'](_0x152fe5,['id',_0x5027('0x38'),_0x5027('0x64'),_0x5027('0xa3')]);})[_0x5027('0x35')]();})[_0x5027('0x16')](function(_0x30c9b3){return amiClient[_0x5027('0x15')]('Agents',_0x4201e9)[_0x5027('0x16')](function(_0x204300){if(_0x204300[_0x5027('0x1a')])throw new Error(_0x5027('0x188'));var _0x5032af=_0x204300[_0x5027('0x1d')];var _0x43168a=jayson[_0x5027('0x13')][_0x5027('0x14')]({'port':0x232c});return _0x43168a[_0x5027('0x15')](_0x5027('0x30'),_0x4201e9)[_0x5027('0x16')](function(_0xc6ac48){if(_0xc6ac48[_0x5027('0x1a')])throw new Error(_0x5027('0x189'));var _0x8178a3=_0xc6ac48['result'];return _[_0x5027('0x5b')]({},_0x8178a3,_0x5032af);});})[_0x5027('0x16')](function(_0x3683a1){return _[_0x5027('0x34')](_0x30c9b3,function(_0x66ef3a){var _0x1f335c=_[_0x5027('0x37')](_0x3683a1[_0x5027('0x4a')],['id',_0x66ef3a['id']]);if(!_0x1f335c||!_0x66ef3a[_0x5027('0xa3')]){_0x66ef3a[_0x5027('0x20')]=_0x5027('0x18a');}else if(_0x1f335c[_0x5027('0x119')]){_0x66ef3a[_0x5027('0x20')]=_0x5027('0x101');}else{_0x66ef3a[_0x5027('0x20')]=_['includes'](['idle',_0x5027('0x18b'),'unavailable',_0x5027('0x18c'),null,undefined],_0x1f335c[_0x5027('0x18d')])?_0x5027('0xa3'):_0x5027('0x18e');}return _0x66ef3a;});});});})['then'](function(_0x3ae8f2){if(!_0x4201e9[_0x5027('0x42')][_0x5027('0xd0')](_0x5027('0xd6'))){_0x537b16['limit']=qs[_0x5027('0x25')](_0x4201e9[_0x5027('0x42')][_0x5027('0x25')]||0xa);_0x537b16[_0x5027('0x23')]=qs[_0x5027('0x23')](_0x4201e9[_0x5027('0x42')][_0x5027('0x23')]);}_0x565593['count']=_0x3ae8f2[_0x5027('0x4c')];_0x565593[_0x5027('0x4a')]=_0x537b16[_0x5027('0x25')]?_0x3ae8f2[_0x5027('0x18f')](_0x537b16[_0x5027('0x23')],_0x537b16[_0x5027('0x23')]+_0x537b16[_0x5027('0x25')]):_0x3ae8f2;return _0x565593;})['then'](respondWithFilteredResult(_0xce16c2,_0x537b16))['catch'](handleError(_0xce16c2,null));};function get_open_tabs(_0x2c3361,_0x209b06){var _0x484f12=_0x2c3361[_0x5027('0x190')](0x0)[_0x5027('0x191')]()+_0x2c3361[_0x5027('0x18f')](0x1);var _0x28ca30={'type':db[_0x5027('0x94')][_0x5027('0x6d')][_0x5027('0x6e')],'raw':!![]};return new Promise(function(_0x44a1b7,_0x5d0e96){var _0x12f52b=squel[_0x5027('0x192')]()[_0x5027('0x193')](_0x5027('0x194')+_0x484f12+_0x5027('0x195'),'id')[_0x5027('0x193')]('ui.createdAt')['from'](_0x5027('0x196')+_0x2c3361+'_interactions','ui')[_0x5027('0x40')](_0x5027('0x197'),_0x209b06['id']);return db['sequelize']['query'](_0x12f52b['toString'](),_0x28ca30)['then'](function(_0x404279){_0x209b06[_0x484f12+'OpenTabs']=_0x404279;_0x44a1b7(_0x404279);})[_0x5027('0x1e')](function(_0x64e183){_0x5d0e96(_0x64e183);});});}
\ No newline at end of file
index a53b878..1d25a4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x925b=['update','emit','hasOwnProperty','events','../../mysqldb','User','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x925b,0x8b));var _0xb925=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0x925b[_0x34bc94];return _0xee41e7;};'use strict';var EventEmitter=require(_0xb925('0x0'));var User=require(_0xb925('0x1'))['db'][_0xb925('0x2')];var UserEvents=new EventEmitter();UserEvents[_0xb925('0x3')](0x0);var events={'afterCreate':_0xb925('0x4'),'afterUpdate':_0xb925('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c3e51){return function(_0x19f80e,_0x3977e1,_0x91b635){UserEvents['emit'](_0x4c3e51+':'+_0x19f80e['id'],_0x19f80e);UserEvents[_0xb925('0x6')](_0x4c3e51,_0x19f80e);_0x91b635(null);};}for(var e in events){if(events[_0xb925('0x7')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module['exports']=UserEvents;
\ No newline at end of file
+var _0xf766=['save','hasOwnProperty','hook','exports','../../mysqldb','User','setMaxListeners'];(function(_0x5811e5,_0x946ee2){var _0x1642da=function(_0x52d73d){while(--_0x52d73d){_0x5811e5['push'](_0x5811e5['shift']());}};_0x1642da(++_0x946ee2);}(_0xf766,0xb3));var _0x6f76=function(_0x151553,_0x295f9c){_0x151553=_0x151553-0x0;var _0x1a0ad6=_0xf766[_0x151553];return _0x1a0ad6;};'use strict';var EventEmitter=require('events');var User=require(_0x6f76('0x0'))['db'][_0x6f76('0x1')];var UserEvents=new EventEmitter();UserEvents[_0x6f76('0x2')](0x0);var events={'afterCreate':_0x6f76('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2ac33f){return function(_0x1c89ab,_0x234a64,_0x2b24fd){UserEvents['emit'](_0x2ac33f+':'+_0x1c89ab['id'],_0x1c89ab);UserEvents['emit'](_0x2ac33f,_0x1c89ab);_0x2b24fd(null);};}for(var e in events){if(events[_0x6f76('0x4')](e)){var event=events[e];User[_0x6f76('0x5')](e,emitEvent(event));}}module[_0x6f76('0x6')]=UserEvents;
\ No newline at end of file
index de6b922..0fc959a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa991=['isArray','map','all','mailPause','chatPause','faxPause','whatsappPause','openchannelPause','getRealtimeData','../../config/utils','Status','bluebird','util','md5','moment','lodash','jayson/promise','google','length','from-sip','format','prefix','push','merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','wav','WAV','gsm','context','system','Set','CDR(type)=internal','extensionMonitor','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','SIP/%s,,tTxXU(xcally-mixmonitor-context)','Hangup','priority','defaults','findAll','then','internal','concat','exports','models','User','users','utf8','utf8_bin','undefined','resolve','find','privacyEnabled','updateMd5Password','updatePassword','catch','changed','userProfileId','UserProfile','userSetting','error','chanspy','VoiceExtension','destroy','bulkCreate','encryptPassword','function','Missing\x20Callback','randomBytes','base64','from','pbkdf2Sync','sha1','toString','provider','salt','md5secret',':asterisk:','client','http','request','Agents','result','manual','voice','QueuePause','Unable\x20to\x20unpause\x20agent\x20%s:$s','message','UserVoiceQueueRt','update','findOne','channel','MemberReport'];(function(_0x4dadeb,_0x4f99b9){var _0x39d793=function(_0x513e3e){while(--_0x513e3e){_0x4dadeb['push'](_0x4dadeb['shift']());}};_0x39d793(++_0x4f99b9);}(_0xa991,0x143));var _0x1a99=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa991[_0x4f9b18];return _0x29f20c;};'use strict';var BPromise=require(_0x1a99('0x0'));var crypto=require('crypto');var util=require(_0x1a99('0x1'));var md5=require(_0x1a99('0x2'));var moment=require(_0x1a99('0x3'));var _=require(_0x1a99('0x4'));var jayson=require(_0x1a99('0x5'));var attributes=require('./user.attributes');var authTypes=[_0x1a99('0x6')];var validatePresenceOf=function(_0x1fe48a){return _0x1fe48a&&_0x1fe48a[_0x1a99('0x7')];};var getChanSpyApplications=function(_0xe41781,_0x22990b,_0xabf36a){var _0xbaf427={'context':_0xe41781['context']||_0x1a99('0x8'),'type':'system','isApp':![],'UserId':_0xe41781['id']};var _0x334f61=[];for(var _0x43fb13=0x0,_0x36f9b2=0x1;_0x43fb13<_0xabf36a[_0x1a99('0x7')];_0x43fb13++,_0x36f9b2=0x1){var _0x12b8f7={'exten':util[_0x1a99('0x9')]('%s%s',_0xabf36a[_0x43fb13][_0x1a99('0xa')],_0x22990b),'ChanSpyId':_0xabf36a[_0x43fb13]['id']};_0x334f61[_0x1a99('0xb')](_[_0x1a99('0xc')]({'app':'Set','appdata':util[_0x1a99('0x9')](_0x1a99('0xd'),'chanspy'),'priority':_0x36f9b2++},_0xbaf427,_0x12b8f7));if(_0xabf36a[_0x43fb13][_0x1a99('0xe')]){_0x334f61['push'](_['merge']({'app':_0x1a99('0xf'),'appdata':util[_0x1a99('0x9')](_0x1a99('0x10'),_0xabf36a[_0x43fb13][_0x1a99('0x11')]),'priority':_0x36f9b2++},_0xbaf427,_0x12b8f7));}if(_0xabf36a[_0x43fb13]['auth']){_0x334f61[_0x1a99('0xb')](_[_0x1a99('0xc')]({'app':_0x1a99('0x12'),'appdata':_0xabf36a[_0x43fb13][_0x1a99('0x13')],'priority':_0x36f9b2++},_0xbaf427,_0x12b8f7));}_0x334f61[_0x1a99('0xb')](_['merge']({'app':_0x1a99('0x14'),'appdata':util['format'](_0x1a99('0x15'),_0xe41781[_0x1a99('0x16')],_0xabf36a[_0x43fb13][_0x1a99('0x17')]?_0xabf36a[_0x43fb13][_0x1a99('0x17')][_0x1a99('0x18')](''):''),'priority':_0x36f9b2++},_0xbaf427,_0x12b8f7));if(_0xabf36a[_0x43fb13][_0x1a99('0xe')]){_0x334f61['push'](_['merge']({'app':_0x1a99('0x19'),'priority':_0x36f9b2++},_0xbaf427,_0x12b8f7));}}return _0x334f61;};var getUserApplications=function(_0x50af8e,_0x780b3e){var _0x2855f7=[_0x1a99('0x1a'),_0x1a99('0x1b'),_0x1a99('0x1c')];var _0x1d55ed={'context':_0x50af8e[_0x1a99('0x1d')]||'from-sip','exten':_0x780b3e,'type':_0x1a99('0x1e'),'isApp':![],'UserId':_0x50af8e['id']};var _0x904364=[{'app':_0x1a99('0x1f'),'appdata':_0x1a99('0x20')}];if(_0x50af8e[_0x1a99('0x21')]&&_['includes'](_0x2855f7,_0x50af8e[_0x1a99('0x21')])){_0x904364[_0x1a99('0xb')]({'app':_0x1a99('0x1f'),'appdata':_0x1a99('0x22')});_0x904364['push']({'app':_0x1a99('0x1f'),'appdata':util[_0x1a99('0x9')]('_XCALLY_MIXMONITOR_FORMAT=%s',_0x50af8e[_0x1a99('0x21')])});_0x904364[_0x1a99('0xb')]({'app':'Dial','appdata':util[_0x1a99('0x9')](_0x1a99('0x23'),_0x50af8e[_0x1a99('0x16')])});}else{_0x904364['push']({'app':'Dial','appdata':util[_0x1a99('0x9')]('SIP/%s,,tTxX',_0x50af8e[_0x1a99('0x16')])});}_0x904364[_0x1a99('0xb')]({'app':_0x1a99('0x24')});for(var _0x19321b=0x0;_0x19321b<_0x904364[_0x1a99('0x7')];_0x19321b++){_0x904364[_0x19321b][_0x1a99('0x25')]=_0x19321b+0x1;_0x904364[_0x19321b]=_[_0x1a99('0x26')](_0x904364[_0x19321b],_0x1d55ed);}return _0x904364;};var getChanSpyPromise=function(_0x25be9b,_0x66b7a4){return new BPromise(function(_0xe92ae1,_0x5ddaf4){return _0x25be9b['VoiceChanSpy'][_0x1a99('0x27')]()[_0x1a99('0x28')](function(_0x53f80f){if(_0x53f80f){var _0x2867a4=getChanSpyApplications(_0x66b7a4,_0x66b7a4[_0x1a99('0x29')],_0x53f80f);if(_0x66b7a4[_0x1a99('0x29')]!=_0x66b7a4[_0x1a99('0x16')]){_0x2867a4=_0x2867a4[_0x1a99('0x2a')](getChanSpyApplications(_0x66b7a4,_0x66b7a4[_0x1a99('0x16')],_0x53f80f));}return _0xe92ae1(_0x2867a4);}return _0xe92ae1([]);})['catch'](function(_0x4ef981){_0x5ddaf4(_0x4ef981);});});};module[_0x1a99('0x2b')]=function(_0xfdb994){var _0xdd2511=_0xfdb994[_0x1a99('0x2c')];return _0xfdb994['define'](_0x1a99('0x2d'),attributes,{'tableName':_0x1a99('0x2e'),'charset':_0x1a99('0x2f'),'collate':_0x1a99('0x30'),'hooks':{'beforeCreate':function(_0x156f09,_0x3689d6,_0x5f3f00){var _0x474c45=typeof _0x156f09['userProfileId']===_0x1a99('0x31')?BPromise[_0x1a99('0x32')](null):_0xdd2511['UserProfile'][_0x1a99('0x33')]({'where':{'id':_0x156f09['userProfileId']}});_0x474c45['then'](function(_0x2acbd9){if(_0x2acbd9){_0x156f09['privacyEnabled']=_0x2acbd9[_0x1a99('0x34')];}})[_0x1a99('0x28')](function(){_0x156f09[_0x1a99('0x35')]();_0x156f09[_0x1a99('0x36')](_0x5f3f00);})[_0x1a99('0x37')](function(_0x2d4b46){_0x5f3f00(_0x2d4b46);});},'beforeUpdate':function(_0x352bb5,_0x15d0e3,_0x79df07){Promise['resolve']()[_0x1a99('0x28')](function(){if(_0x352bb5[_0x1a99('0x38')](_0x1a99('0x39'))===![])return;return _0xdd2511[_0x1a99('0x3a')][_0x1a99('0x33')]({'where':{'id':_0x352bb5[_0x1a99('0x39')]}})[_0x1a99('0x28')](function(_0x44bbdd){if(_0x44bbdd)_0x352bb5['privacyEnabled']=_0x44bbdd[_0x1a99('0x34')];return;});})[_0x1a99('0x28')](function(){if(_0x352bb5[_0x1a99('0x38')]('password')){_0x352bb5[_0x1a99('0x35')]();return _0x352bb5[_0x1a99('0x36')](_0x79df07);}_0x79df07();})[_0x1a99('0x37')](function(_0x2d3ebf){_0x79df07(_0x2d3ebf);});},'afterCreate':function(_0x548dcb,_0x257388,_0x27a888){var _0x34be49=getUserApplications(_0x548dcb,_0x548dcb[_0x1a99('0x29')]);if(_0x548dcb[_0x1a99('0x29')]!=_0x548dcb['name']){_0x34be49=_0x34be49[_0x1a99('0x2a')](getUserApplications(_0x548dcb,_0x548dcb[_0x1a99('0x16')]));}return Promise[_0x1a99('0x32')]()[_0x1a99('0x28')](function(){if(!_0x548dcb[_0x1a99('0x3b')]){return _0x548dcb['createUserSetting']({'clientSideLoggingLevel':_0x1a99('0x3c'),'clientSideLoggingEnabled':![]});}})[_0x1a99('0x28')](function(){return _0xdd2511['VoiceExtension']['bulkCreate'](_0x34be49);})['then'](function(){if(_0x548dcb[_0x1a99('0x3d')]){return getChanSpyPromise(_0xdd2511,_0x548dcb);}})[_0x1a99('0x28')](function(_0x2e1dd0){if(_0x2e1dd0&&_0x2e1dd0['length']){return _0xdd2511[_0x1a99('0x3e')]['bulkCreate'](_0x2e1dd0);}})[_0x1a99('0x28')](function(){_0x27a888();})[_0x1a99('0x37')](function(_0x398cc9){_0x27a888(_0x398cc9);});},'afterUpdate':function(_0x328910,_0x6dd134,_0x7327d7){return BPromise[_0x1a99('0x32')]()[_0x1a99('0x28')](function(){if(_0x328910[_0x1a99('0x38')](_0x1a99('0x3d'))||_0x328910[_0x1a99('0x38')](_0x1a99('0x1d'))){return _0xdd2511[_0x1a99('0x3e')][_0x1a99('0x3f')]({'where':{'UserId':_0x328910['id'],'type':'system','ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x328910[_0x1a99('0x3d')]){return getChanSpyPromise(_0xdd2511,_0x328910)['then'](function(_0x4318ec){if(_0x4318ec&&_0x4318ec[_0x1a99('0x7')]){return _0xdd2511['VoiceExtension']['bulkCreate'](_0x4318ec);}});}});}})[_0x1a99('0x28')](function(){if(_0x328910[_0x1a99('0x38')](_0x1a99('0x21'))||_0x328910[_0x1a99('0x38')](_0x1a99('0x1d'))){return _0xdd2511['VoiceExtension']['destroy']({'where':{'UserId':_0x328910['id'],'type':_0x1a99('0x1e'),'ChanSpyId':null}})[_0x1a99('0x28')](function(){var _0x1d9ca5=getUserApplications(_0x328910,_0x328910[_0x1a99('0x29')]);if(_0x328910[_0x1a99('0x29')]!=_0x328910['name']){_0x1d9ca5=_0x1d9ca5[_0x1a99('0x2a')](getUserApplications(_0x328910,_0x328910[_0x1a99('0x16')]));}return _0xdd2511[_0x1a99('0x3e')][_0x1a99('0x40')](_0x1d9ca5);});}})['then'](function(){_0x7327d7();})[_0x1a99('0x37')](function(_0x46e3c4){_0x7327d7(_0x46e3c4);});},'afterDestroy':function(_0x2fd14a){return _0xdd2511['VoiceExtension']['destroy']({'where':{'UserId':_0x2fd14a['id'],'type':_0x1a99('0x1e')}});}},'instanceMethods':{'authenticate':function(_0x349c30,_0x43bb8e){if(!_0x43bb8e){return this[_0x1a99('0x13')]===this[_0x1a99('0x41')](_0x349c30);}var _0x3d70d0=this;this['encryptPassword'](_0x349c30,function(_0x29b2b6,_0x549b40){if(_0x29b2b6){_0x43bb8e(_0x29b2b6);}if(_0x3d70d0['password']===_0x549b40){_0x43bb8e(null,!![]);}else{_0x43bb8e(null,![]);}});},'makeSalt':function(_0x29ced7,_0x566d15){var _0x2f5260=0x10;if(typeof arguments[0x0]===_0x1a99('0x42')){_0x566d15=arguments[0x0];_0x29ced7=_0x2f5260;}else if(typeof arguments[0x1]==='function'){_0x566d15=arguments[0x1];}else{throw new Error(_0x1a99('0x43'));}if(!_0x29ced7){_0x29ced7=_0x2f5260;}return crypto[_0x1a99('0x44')](_0x29ced7,function(_0x527aeb,_0x5320d6){if(_0x527aeb){_0x566d15(_0x527aeb);}return _0x566d15(null,_0x5320d6['toString'](_0x1a99('0x45')));});},'encryptPassword':function(_0x438b98,_0x12bcb5){if(!_0x438b98||!this['salt']){return _0x12bcb5?_0x12bcb5(null):null;}var _0x2b9369=0x2710;var _0x2d4a01=0x40;var _0x2628d5=Buffer[_0x1a99('0x46')](this['salt'],_0x1a99('0x45'));if(!_0x12bcb5){return crypto[_0x1a99('0x47')](_0x438b98,_0x2628d5,_0x2b9369,_0x2d4a01,_0x1a99('0x48'))[_0x1a99('0x49')](_0x1a99('0x45'));}return crypto['pbkdf2'](_0x438b98,_0x2628d5,_0x2b9369,_0x2d4a01,_0x1a99('0x48'),function(_0x1080b1,_0x4c34df){if(_0x1080b1){_0x12bcb5(_0x1080b1);}return _0x12bcb5(null,_0x4c34df[_0x1a99('0x49')](_0x1a99('0x45')));});},'updatePassword':function(_0x6be549){if(!this[_0x1a99('0x13')]){return _0x6be549(null);}if(!validatePresenceOf(this[_0x1a99('0x13')])&&authTypes['indexOf'](this[_0x1a99('0x4a')])===-0x1){_0x6be549(new Error('Invalid\x20password'));}var _0x174e1b=this;this['makeSalt'](function(_0x355ed1,_0x3ec282){if(_0x355ed1){return _0x6be549(_0x355ed1);}_0x174e1b[_0x1a99('0x4b')]=_0x3ec282;_0x174e1b[_0x1a99('0x41')](_0x174e1b['password'],function(_0xaaee2f,_0x2fc147){if(_0xaaee2f){_0x6be549(_0xaaee2f);}_0x174e1b['password']=_0x2fc147;_0x6be549(null);});});},'updateMd5Password':function(){this[_0x1a99('0x4c')]=md5(this[_0x1a99('0x16')]+_0x1a99('0x4d')+this[_0x1a99('0x13')]);return this[_0x1a99('0x4c')];},'getRealtimeData':function(){var _0x1ec415={'id':this['id']};var _0x3a9d25=jayson['client']['http']({'port':0x232a});var _0x132e33=jayson[_0x1a99('0x4e')][_0x1a99('0x4f')]({'port':0x232c});var _0x16e79a={};var _0x43b8ea={};return _0x3a9d25[_0x1a99('0x50')](_0x1a99('0x51'),_0x1ec415)[_0x1a99('0x28')](function(_0x347a4c){if(_0x347a4c[_0x1a99('0x3c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agent\x20(AMI)');}_0x16e79a=_0x347a4c[_0x1a99('0x52')];return _0x132e33[_0x1a99('0x50')](_0x1a99('0x51'),_0x1ec415);})[_0x1a99('0x28')](function(_0x42555c){if(_0x42555c[_0x1a99('0x3c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agent\x20(Routing)');}_0x43b8ea=_0x42555c['result'];var _0x11702f=_[_0x1a99('0xc')]({},_0x16e79a,_0x43b8ea);return _0x11702f;})[_0x1a99('0x37')](function(_0x616653){throw _0x616653;});},'unpause':function(_0x41c87a,_0x3f845f=_0x1a99('0x53')){var _0x104ffe=this;var _0x3e1349={};return Promise['resolve']()[_0x1a99('0x28')](function(){if(!_0x41c87a||_0x41c87a===_0x1a99('0x54')&&_0x3f845f===_0x1a99('0x53')){var _0x28deb0=jayson[_0x1a99('0x4e')]['http']({'port':0x232a});return _0x28deb0[_0x1a99('0x50')](_0x1a99('0x55'),{'id':_0x104ffe['id'],'name':_0x104ffe[_0x1a99('0x16')],'pause':![]})[_0x1a99('0x28')](function(_0x48b8d0){if(_0x48b8d0['error']){throw new Error(util[_0x1a99('0x9')](_0x1a99('0x56'),_0x104ffe['id'],_0x104ffe[_0x1a99('0x16')]));}return _0x48b8d0[_0x1a99('0x52')][_0x1a99('0x57')];});}})['then'](function(){if(!_0x41c87a||_0x41c87a==='voice'){return _0xdd2511[_0x1a99('0x58')][_0x1a99('0x59')]({'paused':0x0},{'where':{'UserId':_0x104ffe['id']},'individualHooks':!![]});}})[_0x1a99('0x28')](function(){var _0x190ab7=!_0x41c87a?_0x1a99('0x27'):_0x1a99('0x5a');var _0x37d7a0={'membername':_0x104ffe[_0x1a99('0x16')],'type':'PAUSE','exitAt':null};if(_0x41c87a){_0x37d7a0[_0x1a99('0x5b')]=_0x41c87a;}return _0xdd2511[_0x1a99('0x5c')][_0x190ab7]({'where':_0x37d7a0});})['then'](function(_0x1050f8){if(_0x1050f8){var _0x482574=Array[_0x1a99('0x5d')](_0x1050f8)?_0x1050f8:[_0x1050f8];var _0x8ea021=_0x482574[_0x1a99('0x5e')](function(_0x27dc1c){return _0x27dc1c[_0x1a99('0x59')]({'exitAt':moment()[_0x1a99('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x3f845f});});return Promise[_0x1a99('0x5f')](_0x8ea021);}})[_0x1a99('0x28')](function(){if(!_0x41c87a){_0x3e1349['voicePause']=![];_0x3e1349[_0x1a99('0x60')]=![];_0x3e1349[_0x1a99('0x61')]=![];_0x3e1349[_0x1a99('0x62')]=![];_0x3e1349['smsPause']=![];_0x3e1349[_0x1a99('0x63')]=![];_0x3e1349[_0x1a99('0x64')]=![];}else{_0x3e1349[_0x41c87a+'Pause']=![];}return _0x104ffe[_0x1a99('0x65')]();})[_0x1a99('0x28')](function(_0x5140b6){var _0x5977a4=require(_0x1a99('0x66'));var _0x2ff79f=_0x5977a4['getChannels']();_0x2ff79f['forEach'](function(_0x242ae1){var _0x1b9d77=_0x242ae1+_0x1a99('0x67');_0x104ffe['setDataValue']([_0x1b9d77],_0x5140b6[_0x1b9d77]);});return _0x104ffe['update'](_0x3e1349);})['catch'](function(_0x24c46e){throw _0x24c46e;});}}});};
\ No newline at end of file
+var _0x6726=['channel','isArray','map','all','voicePause','mailPause','chatPause','openchannelPause','Pause','getRealtimeData','getChannels','Status','setDataValue','crypto','util','moment','lodash','./user.attributes','length','context','from-sip','system','%s%s','prefix','merge','Set','format','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','WAV','includes','extensionMonitor','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','priority','VoiceChanSpy','findAll','internal','models','define','User','users','utf8','utf8_bin','undefined','UserProfile','find','userProfileId','privacyEnabled','resolve','then','changed','updatePassword','userSetting','createUserSetting','error','bulkCreate','VoiceExtension','destroy','catch','encryptPassword','function','base64','salt','pbkdf2Sync','sha1','toString','provider','Invalid\x20password','makeSalt','md5secret','client','http','request','Unable\x20to\x20retrieve\x20RPC\x20agent\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agent\x20(Routing)','result','manual','voice','Unable\x20to\x20unpause\x20agent\x20%s:$s','message','UserVoiceQueueRt','update','findOne','PAUSE'];(function(_0x48fc6f,_0x3681db){var _0x16fc2b=function(_0x6ee044){while(--_0x6ee044){_0x48fc6f['push'](_0x48fc6f['shift']());}};_0x16fc2b(++_0x3681db);}(_0x6726,0xdb));var _0x6672=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x6726[_0x2d9c6a];return _0xf3c918;};'use strict';var BPromise=require('bluebird');var crypto=require(_0x6672('0x0'));var util=require(_0x6672('0x1'));var md5=require('md5');var moment=require(_0x6672('0x2'));var _=require(_0x6672('0x3'));var jayson=require('jayson/promise');var attributes=require(_0x6672('0x4'));var authTypes=['google'];var validatePresenceOf=function(_0x32e5c6){return _0x32e5c6&&_0x32e5c6[_0x6672('0x5')];};var getChanSpyApplications=function(_0x2aac16,_0x40ba7e,_0x5701b9){var _0xa1d3b7={'context':_0x2aac16[_0x6672('0x6')]||_0x6672('0x7'),'type':_0x6672('0x8'),'isApp':![],'UserId':_0x2aac16['id']};var _0xc53855=[];for(var _0x1d7f31=0x0,_0x13add3=0x1;_0x1d7f31<_0x5701b9[_0x6672('0x5')];_0x1d7f31++,_0x13add3=0x1){var _0x7357d1={'exten':util['format'](_0x6672('0x9'),_0x5701b9[_0x1d7f31][_0x6672('0xa')],_0x40ba7e),'ChanSpyId':_0x5701b9[_0x1d7f31]['id']};_0xc53855['push'](_[_0x6672('0xb')]({'app':_0x6672('0xc'),'appdata':util[_0x6672('0xd')](_0x6672('0xe'),_0x6672('0xf')),'priority':_0x13add3++},_0xa1d3b7,_0x7357d1));if(_0x5701b9[_0x1d7f31][_0x6672('0x10')]){_0xc53855[_0x6672('0x11')](_[_0x6672('0xb')]({'app':_0x6672('0x12'),'appdata':util['format'](_0x6672('0x13'),_0x5701b9[_0x1d7f31][_0x6672('0x14')]),'priority':_0x13add3++},_0xa1d3b7,_0x7357d1));}if(_0x5701b9[_0x1d7f31][_0x6672('0x15')]){_0xc53855[_0x6672('0x11')](_[_0x6672('0xb')]({'app':_0x6672('0x16'),'appdata':_0x5701b9[_0x1d7f31][_0x6672('0x17')],'priority':_0x13add3++},_0xa1d3b7,_0x7357d1));}_0xc53855['push'](_[_0x6672('0xb')]({'app':_0x6672('0x18'),'appdata':util[_0x6672('0xd')](_0x6672('0x19'),_0x2aac16[_0x6672('0x1a')],_0x5701b9[_0x1d7f31][_0x6672('0x1b')]?_0x5701b9[_0x1d7f31][_0x6672('0x1b')][_0x6672('0x1c')](''):''),'priority':_0x13add3++},_0xa1d3b7,_0x7357d1));if(_0x5701b9[_0x1d7f31]['record']){_0xc53855[_0x6672('0x11')](_[_0x6672('0xb')]({'app':_0x6672('0x1d'),'priority':_0x13add3++},_0xa1d3b7,_0x7357d1));}}return _0xc53855;};var getUserApplications=function(_0x6ded3f,_0x5d401b){var _0x1639f6=['wav',_0x6672('0x1e'),'gsm'];var _0x467ead={'context':_0x6ded3f[_0x6672('0x6')]||'from-sip','exten':_0x5d401b,'type':_0x6672('0x8'),'isApp':![],'UserId':_0x6ded3f['id']};var _0x14bd07=[{'app':_0x6672('0xc'),'appdata':'CDR(type)=internal'}];if(_0x6ded3f['extensionMonitor']&&_[_0x6672('0x1f')](_0x1639f6,_0x6ded3f[_0x6672('0x20')])){_0x14bd07[_0x6672('0x11')]({'app':_0x6672('0xc'),'appdata':_0x6672('0x21')});_0x14bd07[_0x6672('0x11')]({'app':_0x6672('0xc'),'appdata':util[_0x6672('0xd')](_0x6672('0x22'),_0x6ded3f[_0x6672('0x20')])});_0x14bd07[_0x6672('0x11')]({'app':_0x6672('0x23'),'appdata':util[_0x6672('0xd')](_0x6672('0x24'),_0x6ded3f[_0x6672('0x1a')])});}else{_0x14bd07[_0x6672('0x11')]({'app':_0x6672('0x23'),'appdata':util[_0x6672('0xd')](_0x6672('0x25'),_0x6ded3f['name'])});}_0x14bd07[_0x6672('0x11')]({'app':'Hangup'});for(var _0x257e8f=0x0;_0x257e8f<_0x14bd07['length'];_0x257e8f++){_0x14bd07[_0x257e8f][_0x6672('0x26')]=_0x257e8f+0x1;_0x14bd07[_0x257e8f]=_['defaults'](_0x14bd07[_0x257e8f],_0x467ead);}return _0x14bd07;};var getChanSpyPromise=function(_0x4db955,_0x4fcd14){return new BPromise(function(_0x302306,_0x39da71){return _0x4db955[_0x6672('0x27')][_0x6672('0x28')]()['then'](function(_0x7e2b99){if(_0x7e2b99){var _0x595f3c=getChanSpyApplications(_0x4fcd14,_0x4fcd14[_0x6672('0x29')],_0x7e2b99);if(_0x4fcd14[_0x6672('0x29')]!=_0x4fcd14[_0x6672('0x1a')]){_0x595f3c=_0x595f3c['concat'](getChanSpyApplications(_0x4fcd14,_0x4fcd14[_0x6672('0x1a')],_0x7e2b99));}return _0x302306(_0x595f3c);}return _0x302306([]);})['catch'](function(_0x1bbd6b){_0x39da71(_0x1bbd6b);});});};module['exports']=function(_0x555a13){var _0x3d00e6=_0x555a13[_0x6672('0x2a')];return _0x555a13[_0x6672('0x2b')](_0x6672('0x2c'),attributes,{'tableName':_0x6672('0x2d'),'charset':_0x6672('0x2e'),'collate':_0x6672('0x2f'),'hooks':{'beforeCreate':function(_0x2aa482,_0x24fa23,_0x41c411){var _0x2649e0=typeof _0x2aa482['userProfileId']===_0x6672('0x30')?BPromise['resolve'](null):_0x3d00e6[_0x6672('0x31')][_0x6672('0x32')]({'where':{'id':_0x2aa482[_0x6672('0x33')]}});_0x2649e0['then'](function(_0x26e439){if(_0x26e439){_0x2aa482[_0x6672('0x34')]=_0x26e439['privacyEnabled'];}})['then'](function(){_0x2aa482['updateMd5Password']();_0x2aa482['updatePassword'](_0x41c411);})['catch'](function(_0x5e8065){_0x41c411(_0x5e8065);});},'beforeUpdate':function(_0x4d565f,_0x3e8cd5,_0x28e5ac){Promise[_0x6672('0x35')]()[_0x6672('0x36')](function(){if(_0x4d565f[_0x6672('0x37')]('userProfileId')===![])return;return _0x3d00e6[_0x6672('0x31')][_0x6672('0x32')]({'where':{'id':_0x4d565f['userProfileId']}})[_0x6672('0x36')](function(_0x4bc3a5){if(_0x4bc3a5)_0x4d565f[_0x6672('0x34')]=_0x4bc3a5['privacyEnabled'];return;});})['then'](function(){if(_0x4d565f[_0x6672('0x37')](_0x6672('0x17'))){_0x4d565f['updateMd5Password']();return _0x4d565f[_0x6672('0x38')](_0x28e5ac);}_0x28e5ac();})['catch'](function(_0x3f9860){_0x28e5ac(_0x3f9860);});},'afterCreate':function(_0x3285b4,_0x3eef69,_0x58354d){var _0x4b2ae7=getUserApplications(_0x3285b4,_0x3285b4[_0x6672('0x29')]);if(_0x3285b4[_0x6672('0x29')]!=_0x3285b4[_0x6672('0x1a')]){_0x4b2ae7=_0x4b2ae7['concat'](getUserApplications(_0x3285b4,_0x3285b4['name']));}return Promise['resolve']()['then'](function(){if(!_0x3285b4[_0x6672('0x39')]){return _0x3285b4[_0x6672('0x3a')]({'clientSideLoggingLevel':_0x6672('0x3b'),'clientSideLoggingEnabled':![]});}})['then'](function(){return _0x3d00e6['VoiceExtension'][_0x6672('0x3c')](_0x4b2ae7);})[_0x6672('0x36')](function(){if(_0x3285b4[_0x6672('0xf')]){return getChanSpyPromise(_0x3d00e6,_0x3285b4);}})[_0x6672('0x36')](function(_0x4ef58b){if(_0x4ef58b&&_0x4ef58b[_0x6672('0x5')]){return _0x3d00e6['VoiceExtension'][_0x6672('0x3c')](_0x4ef58b);}})[_0x6672('0x36')](function(){_0x58354d();})['catch'](function(_0x4ae214){_0x58354d(_0x4ae214);});},'afterUpdate':function(_0x504a10,_0x376c75,_0x3c3bda){return BPromise[_0x6672('0x35')]()[_0x6672('0x36')](function(){if(_0x504a10[_0x6672('0x37')](_0x6672('0xf'))||_0x504a10['changed']('context')){return _0x3d00e6[_0x6672('0x3d')]['destroy']({'where':{'UserId':_0x504a10['id'],'type':_0x6672('0x8'),'ChanSpyId':{'$ne':null}}})[_0x6672('0x36')](function(){if(_0x504a10[_0x6672('0xf')]){return getChanSpyPromise(_0x3d00e6,_0x504a10)[_0x6672('0x36')](function(_0x65cbea){if(_0x65cbea&&_0x65cbea[_0x6672('0x5')]){return _0x3d00e6[_0x6672('0x3d')]['bulkCreate'](_0x65cbea);}});}});}})[_0x6672('0x36')](function(){if(_0x504a10[_0x6672('0x37')]('extensionMonitor')||_0x504a10['changed'](_0x6672('0x6'))){return _0x3d00e6[_0x6672('0x3d')][_0x6672('0x3e')]({'where':{'UserId':_0x504a10['id'],'type':_0x6672('0x8'),'ChanSpyId':null}})[_0x6672('0x36')](function(){var _0x1705fc=getUserApplications(_0x504a10,_0x504a10[_0x6672('0x29')]);if(_0x504a10[_0x6672('0x29')]!=_0x504a10[_0x6672('0x1a')]){_0x1705fc=_0x1705fc['concat'](getUserApplications(_0x504a10,_0x504a10[_0x6672('0x1a')]));}return _0x3d00e6['VoiceExtension'][_0x6672('0x3c')](_0x1705fc);});}})['then'](function(){_0x3c3bda();})[_0x6672('0x3f')](function(_0x554222){_0x3c3bda(_0x554222);});},'afterDestroy':function(_0x419d3f){return _0x3d00e6[_0x6672('0x3d')][_0x6672('0x3e')]({'where':{'UserId':_0x419d3f['id'],'type':_0x6672('0x8')}});}},'instanceMethods':{'authenticate':function(_0x5c4e61,_0x45bbe6){if(!_0x45bbe6){return this[_0x6672('0x17')]===this[_0x6672('0x40')](_0x5c4e61);}var _0x4f6152=this;this[_0x6672('0x40')](_0x5c4e61,function(_0x49e67e,_0x2b6666){if(_0x49e67e){_0x45bbe6(_0x49e67e);}if(_0x4f6152[_0x6672('0x17')]===_0x2b6666){_0x45bbe6(null,!![]);}else{_0x45bbe6(null,![]);}});},'makeSalt':function(_0x2df079,_0x41dd74){var _0x1bbb51=0x10;if(typeof arguments[0x0]===_0x6672('0x41')){_0x41dd74=arguments[0x0];_0x2df079=_0x1bbb51;}else if(typeof arguments[0x1]===_0x6672('0x41')){_0x41dd74=arguments[0x1];}else{throw new Error('Missing\x20Callback');}if(!_0x2df079){_0x2df079=_0x1bbb51;}return crypto['randomBytes'](_0x2df079,function(_0x18ebf5,_0x308b70){if(_0x18ebf5){_0x41dd74(_0x18ebf5);}return _0x41dd74(null,_0x308b70['toString'](_0x6672('0x42')));});},'encryptPassword':function(_0x1800aa,_0x15ff9e){if(!_0x1800aa||!this[_0x6672('0x43')]){return _0x15ff9e?_0x15ff9e(null):null;}var _0x288b2d=0x2710;var _0x496494=0x40;var _0x1468c8=Buffer['from'](this[_0x6672('0x43')],_0x6672('0x42'));if(!_0x15ff9e){return crypto[_0x6672('0x44')](_0x1800aa,_0x1468c8,_0x288b2d,_0x496494,_0x6672('0x45'))[_0x6672('0x46')](_0x6672('0x42'));}return crypto['pbkdf2'](_0x1800aa,_0x1468c8,_0x288b2d,_0x496494,_0x6672('0x45'),function(_0x2364d4,_0x5d1eb1){if(_0x2364d4){_0x15ff9e(_0x2364d4);}return _0x15ff9e(null,_0x5d1eb1['toString'](_0x6672('0x42')));});},'updatePassword':function(_0x3dabde){if(!this[_0x6672('0x17')]){return _0x3dabde(null);}if(!validatePresenceOf(this['password'])&&authTypes['indexOf'](this[_0x6672('0x47')])===-0x1){_0x3dabde(new Error(_0x6672('0x48')));}var _0x24ca6f=this;this[_0x6672('0x49')](function(_0x58a165,_0x4a3ba7){if(_0x58a165){return _0x3dabde(_0x58a165);}_0x24ca6f[_0x6672('0x43')]=_0x4a3ba7;_0x24ca6f[_0x6672('0x40')](_0x24ca6f[_0x6672('0x17')],function(_0x862cff,_0xc16196){if(_0x862cff){_0x3dabde(_0x862cff);}_0x24ca6f[_0x6672('0x17')]=_0xc16196;_0x3dabde(null);});});},'updateMd5Password':function(){this[_0x6672('0x4a')]=md5(this[_0x6672('0x1a')]+':asterisk:'+this['password']);return this[_0x6672('0x4a')];},'getRealtimeData':function(){var _0x3a2643={'id':this['id']};var _0x561e2b=jayson[_0x6672('0x4b')][_0x6672('0x4c')]({'port':0x232a});var _0x5652ca=jayson['client']['http']({'port':0x232c});var _0x1a39af={};var _0xf3d156={};return _0x561e2b[_0x6672('0x4d')]('Agents',_0x3a2643)[_0x6672('0x36')](function(_0x241ab9){if(_0x241ab9[_0x6672('0x3b')]){throw new Error(_0x6672('0x4e'));}_0x1a39af=_0x241ab9['result'];return _0x5652ca['request'](_0x6672('0x4f'),_0x3a2643);})[_0x6672('0x36')](function(_0xfd7895){if(_0xfd7895[_0x6672('0x3b')]){throw new Error(_0x6672('0x50'));}_0xf3d156=_0xfd7895[_0x6672('0x51')];var _0x3c1489=_[_0x6672('0xb')]({},_0x1a39af,_0xf3d156);return _0x3c1489;})['catch'](function(_0xd97a22){throw _0xd97a22;});},'unpause':function(_0x115ce6,_0x1b0eb0=_0x6672('0x52')){var _0x577a3c=this;var _0x3aa5ba={};return Promise[_0x6672('0x35')]()[_0x6672('0x36')](function(){if(!_0x115ce6||_0x115ce6===_0x6672('0x53')&&_0x1b0eb0==='manual'){var _0xe4bc17=jayson[_0x6672('0x4b')][_0x6672('0x4c')]({'port':0x232a});return _0xe4bc17[_0x6672('0x4d')]('QueuePause',{'id':_0x577a3c['id'],'name':_0x577a3c['name'],'pause':![]})[_0x6672('0x36')](function(_0x3daae0){if(_0x3daae0['error']){throw new Error(util[_0x6672('0xd')](_0x6672('0x54'),_0x577a3c['id'],_0x577a3c[_0x6672('0x1a')]));}return _0x3daae0[_0x6672('0x51')][_0x6672('0x55')];});}})[_0x6672('0x36')](function(){if(!_0x115ce6||_0x115ce6===_0x6672('0x53')){return _0x3d00e6[_0x6672('0x56')][_0x6672('0x57')]({'paused':0x0},{'where':{'UserId':_0x577a3c['id']},'individualHooks':!![]});}})[_0x6672('0x36')](function(){var _0x24a424=!_0x115ce6?_0x6672('0x28'):_0x6672('0x58');var _0x2882d6={'membername':_0x577a3c[_0x6672('0x1a')],'type':_0x6672('0x59'),'exitAt':null};if(_0x115ce6){_0x2882d6[_0x6672('0x5a')]=_0x115ce6;}return _0x3d00e6['MemberReport'][_0x24a424]({'where':_0x2882d6});})[_0x6672('0x36')](function(_0xd34da9){if(_0xd34da9){var _0x44d867=Array[_0x6672('0x5b')](_0xd34da9)?_0xd34da9:[_0xd34da9];var _0x348696=_0x44d867[_0x6672('0x5c')](function(_0x3aceb0){return _0x3aceb0[_0x6672('0x57')]({'exitAt':moment()[_0x6672('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x1b0eb0});});return Promise[_0x6672('0x5d')](_0x348696);}})[_0x6672('0x36')](function(){if(!_0x115ce6){_0x3aa5ba[_0x6672('0x5e')]=![];_0x3aa5ba[_0x6672('0x5f')]=![];_0x3aa5ba[_0x6672('0x60')]=![];_0x3aa5ba['faxPause']=![];_0x3aa5ba['smsPause']=![];_0x3aa5ba['whatsappPause']=![];_0x3aa5ba[_0x6672('0x61')]=![];}else{_0x3aa5ba[_0x115ce6+_0x6672('0x62')]=![];}return _0x577a3c[_0x6672('0x63')]();})[_0x6672('0x36')](function(_0x4a9ff0){var _0x3e0b0e=require('../../config/utils');var _0x227f0e=_0x3e0b0e[_0x6672('0x64')]();_0x227f0e['forEach'](function(_0x325566){var _0x3a61d3=_0x325566+_0x6672('0x65');_0x577a3c[_0x6672('0x66')]([_0x3a61d3],_0x4a9ff0[_0x3a61d3]);});return _0x577a3c['update'](_0x3aa5ba);})[_0x6672('0x3f')](function(_0x3eddf1){throw _0x3eddf1;});}}});};
\ No newline at end of file
index 61fb59e..ac4bb7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe9e0=['params','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','SIP/%s','interface','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','body','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','faxPause','smsPause','whatsappPause','lastPauseAt','unpause','LogoutUser','destroy','all','phone','count','getLicense','agents','getVoiceQueues','loginInPause','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','User','findAll','options','where','attributes','limit','include','map','model','then','info','GetUser','debug','stringify','catch','error','ShowUser','find','message','PauseUser','name','internal','format','User\x20with\x20id\x20%s\x20not\x20found'];(function(_0x52f213,_0x4a9e5c){var _0xbcd8c5=function(_0x36b1d9){while(--_0x36b1d9){_0x52f213['push'](_0x52f213['shift']());}};_0xbcd8c5(++_0x4a9e5c);}(_0xe9e0,0x1c9));var _0x0e9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0e9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var Redis=require(_0x0e9e('0x1'));var db=require(_0x0e9e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e9e('0x3'))('rpc');var config=require(_0x0e9e('0x4'));config[_0x0e9e('0x5')]=_[_0x0e9e('0x6')](config[_0x0e9e('0x5')],{'host':_0x0e9e('0x7'),'port':0x18eb});var socket=require(_0x0e9e('0x8'))(new Redis(config[_0x0e9e('0x5')]));require(_0x0e9e('0x9'))[_0x0e9e('0xa')](socket);exports['GetUser']=function(_0x137a03){var _0x207931=this;return new Promise(function(_0x34901d,_0x2330de){return db[_0x0e9e('0xb')][_0x0e9e('0xc')]({'raw':_0x137a03['options']?_0x137a03[_0x0e9e('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x137a03['options']?_0x137a03[_0x0e9e('0xd')][_0x0e9e('0xe')]||null:null,'attributes':_0x137a03[_0x0e9e('0xd')]?_0x137a03[_0x0e9e('0xd')][_0x0e9e('0xf')]||null:null,'limit':_0x137a03[_0x0e9e('0xd')]?_0x137a03[_0x0e9e('0xd')][_0x0e9e('0x10')]||null:null,'include':_0x137a03[_0x0e9e('0xd')]?_0x137a03['options'][_0x0e9e('0x11')]?_[_0x0e9e('0x12')](_0x137a03[_0x0e9e('0xd')][_0x0e9e('0x11')],function(_0xfb4294){return{'model':db[_0xfb4294['model']],'as':_0xfb4294['as'],'attributes':_0xfb4294[_0x0e9e('0xf')],'include':_0xfb4294[_0x0e9e('0x11')]?_[_0x0e9e('0x12')](_0xfb4294['include'],function(_0x206bc6){return{'model':db[_0x206bc6[_0x0e9e('0x13')]],'as':_0x206bc6['as'],'attributes':_0x206bc6[_0x0e9e('0xf')],'include':_0x206bc6[_0x0e9e('0x11')]?_[_0x0e9e('0x12')](_0x206bc6[_0x0e9e('0x11')],function(_0xf65f9b){return{'model':db[_0xf65f9b[_0x0e9e('0x13')]],'as':_0xf65f9b['as'],'attributes':_0xf65f9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e9e('0x14')](function(_0xed3b7a){logger[_0x0e9e('0x15')](_0x0e9e('0x16'),_0x137a03);logger[_0x0e9e('0x17')](_0x0e9e('0x16'),_0x137a03,JSON[_0x0e9e('0x18')](_0xed3b7a));_0x34901d(_0xed3b7a);})[_0x0e9e('0x19')](function(_0xeda937){logger['error']('GetUser',_0xeda937['message'],_0x137a03);_0x2330de(_0x207931[_0x0e9e('0x1a')](0x1f4,_0xeda937['message']));});});};exports[_0x0e9e('0x1b')]=function(_0x559292){var _0x6984e0=this;return new Promise(function(_0x2dfa65,_0x188e6d){return db[_0x0e9e('0xb')][_0x0e9e('0x1c')]({'raw':_0x559292[_0x0e9e('0xd')]?_0x559292[_0x0e9e('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x559292['options']?_0x559292[_0x0e9e('0xd')][_0x0e9e('0xe')]||null:null,'attributes':_0x559292['options']?_0x559292[_0x0e9e('0xd')][_0x0e9e('0xf')]||null:null,'include':_0x559292['options']?_0x559292[_0x0e9e('0xd')][_0x0e9e('0x11')]?_[_0x0e9e('0x12')](_0x559292['options'][_0x0e9e('0x11')],function(_0x543a8f){return{'model':db[_0x543a8f[_0x0e9e('0x13')]],'as':_0x543a8f['as'],'attributes':_0x543a8f[_0x0e9e('0xf')],'include':_0x543a8f[_0x0e9e('0x11')]?_[_0x0e9e('0x12')](_0x543a8f[_0x0e9e('0x11')],function(_0x13045c){return{'model':db[_0x13045c[_0x0e9e('0x13')]],'as':_0x13045c['as'],'attributes':_0x13045c[_0x0e9e('0xf')],'include':_0x13045c[_0x0e9e('0x11')]?_[_0x0e9e('0x12')](_0x13045c[_0x0e9e('0x11')],function(_0x978f24){return{'model':db[_0x978f24[_0x0e9e('0x13')]],'as':_0x978f24['as'],'attributes':_0x978f24[_0x0e9e('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x111904){logger[_0x0e9e('0x15')](_0x0e9e('0x1b'),_0x559292);logger[_0x0e9e('0x17')](_0x0e9e('0x1b'),_0x559292,JSON[_0x0e9e('0x18')](_0x111904));_0x2dfa65(_0x111904);})[_0x0e9e('0x19')](function(_0xf056a5){logger['error'](_0x0e9e('0x1b'),_0xf056a5[_0x0e9e('0x1d')],_0x559292);_0x188e6d(_0x6984e0[_0x0e9e('0x1a')](0x1f4,_0xf056a5['message']));});});};exports[_0x0e9e('0x1e')]=function(_0x58b636){var _0x1d1e5d;return db[_0x0e9e('0xb')][_0x0e9e('0x1c')]({'where':_0x58b636[_0x0e9e('0xd')][_0x0e9e('0xe')]||{},'attributes':['id',_0x0e9e('0x1f'),'role',_0x0e9e('0x20'),'interface']})[_0x0e9e('0x14')](function(_0x419985){if(!_0x419985){throw new Error(util[_0x0e9e('0x21')](_0x0e9e('0x22'),_0x58b636[_0x0e9e('0x23')]['id']));}_0x1d1e5d=_0x419985;return db[_0x0e9e('0x24')][_0x0e9e('0x25')]({'paused':0x1},{'where':{'UserId':_0x1d1e5d['id']},'individualHooks':!![]});})[_0x0e9e('0x14')](function(){return db[_0x0e9e('0x26')][_0x0e9e('0xc')]({'where':{'membername':_0x1d1e5d[_0x0e9e('0x1f')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x54b9ad){if(_0x54b9ad&&_0x54b9ad[_0x0e9e('0x27')]){var _0x238f0e=moment()[_0x0e9e('0x21')](_0x0e9e('0x28'));for(var _0x5a43f0=0x0,_0x2a8885=_0x54b9ad[_0x0e9e('0x27')];_0x5a43f0<_0x2a8885;_0x5a43f0++){_0x54b9ad[_0x5a43f0][_0x0e9e('0x29')]({'exitAt':_0x238f0e});}}})[_0x0e9e('0x14')](function(){var _0xe5b3f5=[];var _0x3f386e=utils['getChannels']();_0x3f386e[_0x0e9e('0x2a')](function(_0x6ba5c8){_0xe5b3f5[_0x0e9e('0x2b')]({'channel':_0x6ba5c8,'membername':_0x1d1e5d[_0x0e9e('0x1f')],'interface':_[_0x0e9e('0x2c')](_0x1d1e5d['interface'])?util[_0x0e9e('0x21')](_0x0e9e('0x2d'),_0x1d1e5d[_0x0e9e('0x1f')]):_0x1d1e5d[_0x0e9e('0x2e')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x58b636['body'][_0x0e9e('0x2f')]||_0x0e9e('0x30'),'role':_0x1d1e5d[_0x0e9e('0x31')],'internal':_0x1d1e5d['internal'],'uniqueid':_0x58b636['body'][_0x0e9e('0x32')]||null});});return db[_0x0e9e('0x26')][_0x0e9e('0x33')](_0xe5b3f5,{'individualHooks':!![]});})[_0x0e9e('0x14')](function(){return _0x1d1e5d[_0x0e9e('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x58b636[_0x0e9e('0x34')][_0x0e9e('0x2f')]||_0x0e9e('0x30'),'lastPauseAt':moment()[_0x0e9e('0x21')](_0x0e9e('0x28'))});})[_0x0e9e('0x19')](function(_0x3e9190){throw _0x3e9190;});};exports[_0x0e9e('0x35')]=function(_0x4d4494){return Promise[_0x0e9e('0x36')]()[_0x0e9e('0x14')](function(){if(_0x4d4494[_0x0e9e('0x34')][_0x0e9e('0x37')]&&!utils[_0x0e9e('0x38')](_0x4d4494['body'][_0x0e9e('0x37')])){throw new Error(util['format'](_0x0e9e('0x39'),_0x4d4494[_0x0e9e('0x34')]['channel']));}return db[_0x0e9e('0xb')][_0x0e9e('0x3a')]({'where':_0x4d4494[_0x0e9e('0xd')][_0x0e9e('0xe')]||{},'attributes':['id',_0x0e9e('0x1f'),_0x0e9e('0x31'),_0x0e9e('0x20'),'interface',_0x0e9e('0x3b'),'voicePause',_0x0e9e('0x3c'),_0x0e9e('0x3d'),_0x0e9e('0x3e'),'openchannelPause',_0x0e9e('0x3f'),_0x0e9e('0x40'),'pauseType',_0x0e9e('0x41')]});})[_0x0e9e('0x14')](function(_0x1cdaa2){if(!_0x1cdaa2){throw new Error(util[_0x0e9e('0x21')](_0x0e9e('0x22'),_0x4d4494[_0x0e9e('0x23')]['id']));}return _0x1cdaa2[_0x0e9e('0x42')](_0x4d4494['body'][_0x0e9e('0x37')],'system');})[_0x0e9e('0x19')](function(_0x562d8d){throw _0x562d8d;});};exports[_0x0e9e('0x43')]=function(_0x453bb4){var _0x320c31=this;return new Promise(function(_0x36d4e9,_0x33e4a4){var _0x5113cf;return db[_0x0e9e('0xb')]['findOne']({'where':_0x453bb4[_0x0e9e('0xd')][_0x0e9e('0xe')]||{},'attributes':['id',_0x0e9e('0x1f')]})[_0x0e9e('0x14')](function(_0x3864e3){if(_0x3864e3){_0x5113cf=_0x3864e3;return db[_0x0e9e('0x24')][_0x0e9e('0x44')]({'where':{'membername':_0x5113cf['name']},'individualHooks':!![]});}})['then'](function(){if(_0x5113cf){return db['MemberReport']['findAll']({'where':{'membername':_0x5113cf['name'],'exitAt':null}});}})['then'](function(_0x14caf2){if(_0x5113cf){if(_0x14caf2&&_0x14caf2['length']){var _0x3d15a2=[];_0x14caf2['forEach'](function(_0x4c7ae9){_0x3d15a2['push'](_0x4c7ae9[_0x0e9e('0x25')]({'exitAt':moment()[_0x0e9e('0x21')](_0x0e9e('0x28'))}));});return BPromise[_0x0e9e('0x45')](_0x3d15a2);}}})[_0x0e9e('0x14')](function(){if(_0x5113cf){return _0x5113cf[_0x0e9e('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x2f1181){_0x36d4e9(_0x2f1181);})[_0x0e9e('0x19')](function(_0x417c64){_0x33e4a4(_0x320c31[_0x0e9e('0x1a')](0x1f4,_0x417c64[_0x0e9e('0x1d')]));});});};exports['LoginUser']=function(_0x3b53d5){var _0x3d6352=this;return new Promise(function(_0x1ec273,_0x665878){var _0x115ef1;var _0x312a9b;var _0x2bdb5c;var _0x9f4f12;return db[_0x0e9e('0xb')][_0x0e9e('0x3a')]({'where':_0x3b53d5[_0x0e9e('0xd')][_0x0e9e('0xe')]||{},'attributes':['id','name',_0x0e9e('0x31'),'mobile',_0x0e9e('0x46'),_0x0e9e('0x20'),'loginInPause',_0x0e9e('0x2e')]})[_0x0e9e('0x14')](function(_0x5dc755){if(_0x5dc755){_0x115ef1=_0x5dc755;_0x9f4f12=_0x3b53d5['body']['interface']?_0x3b53d5['body'][_0x0e9e('0x2e')]:util[_0x0e9e('0x21')](_0x0e9e('0x2d'),_0x115ef1['name']);return db[_0x0e9e('0xb')][_0x0e9e('0x47')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x115ef1['id']}}});}})['then'](function(_0x48bcbd){if(_0x48bcbd){_0x2bdb5c=_0x48bcbd;return require('../../config/license/util')[_0x0e9e('0x48')]();}})[_0x0e9e('0x14')](function(_0x7cadd0){if(_0x7cadd0&&_0x7cadd0[_0x0e9e('0x49')]&&_0x2bdb5c>=_0x7cadd0[_0x0e9e('0x49')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0e9e('0x14')](function(){if(_0x115ef1){return db[_0x0e9e('0x24')][_0x0e9e('0x44')]({'where':{'membername':_0x115ef1['name']},'individualHooks':!![]});}})[_0x0e9e('0x14')](function(){if(_0x115ef1){return _0x115ef1[_0x0e9e('0x4a')]({'raw':!![]});}})[_0x0e9e('0x14')](function(_0x454b80){if(_0x115ef1){if(_0x454b80){var _0x1aac0f=[];_0x312a9b=_0x454b80;if(_0x312a9b[_0x0e9e('0x27')]){for(var _0xbb92f2=0x0;_0xbb92f2<_0x312a9b[_0x0e9e('0x27')];_0xbb92f2++){_0x1aac0f['push'](db[_0x0e9e('0x24')]['upsert']({'membername':_0x115ef1[_0x0e9e('0x1f')],'UserId':_0x115ef1['id'],'queue_name':_0x312a9b[_0xbb92f2]['name'],'VoiceQueueId':_0x312a9b[_0xbb92f2]['id'],'interface':_0x9f4f12,'paused':_0x115ef1[_0x0e9e('0x4b')]||![],'penalty':_0x312a9b[_0xbb92f2]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x1aac0f);}}}})['then'](function(){if(_0x115ef1){return db[_0x0e9e('0x26')][_0x0e9e('0xc')]({'where':{'membername':_0x115ef1[_0x0e9e('0x1f')],'exitAt':null}});}})[_0x0e9e('0x14')](function(_0x25bdc1){if(_0x115ef1){if(_0x25bdc1&&_0x25bdc1['length']){var _0x16c20c=[];_0x25bdc1['forEach'](function(_0x455ef0){_0x16c20c[_0x0e9e('0x2b')](_0x455ef0[_0x0e9e('0x25')]({'exitAt':moment()[_0x0e9e('0x21')](_0x0e9e('0x28'))}));});return BPromise[_0x0e9e('0x45')](_0x16c20c);}}})[_0x0e9e('0x14')](function(){if(_0x115ef1){var _0x4842f8=[];var _0x5d469f=[];var _0xd184d1=utils[_0x0e9e('0x4c')]();var _0x3cb4a6={'membername':_0x115ef1[_0x0e9e('0x1f')],'interface':_0x9f4f12,'enterAt':moment()[_0x0e9e('0x21')](_0x0e9e('0x28')),'role':_0x115ef1[_0x0e9e('0x31')],'internal':_0x115ef1['internal']};_0xd184d1['forEach'](function(_0x2b2c27){_0x4842f8[_0x0e9e('0x2b')](_[_0x0e9e('0x4d')]({'channel':_0x2b2c27,'type':_0x0e9e('0x4e'),'data1':_0x0e9e('0x4f'),'data2':_0x9f4f12},_0x3cb4a6));if(_0x115ef1[_0x0e9e('0x4b')]){_0x5d469f['push'](_[_0x0e9e('0x4d')]({'channel':_0x2b2c27,'type':'PAUSE','data1':_0x0e9e('0x50')},_0x3cb4a6));}});return db[_0x0e9e('0x26')][_0x0e9e('0x33')](_0x4842f8[_0x0e9e('0x51')](_0x5d469f),{'individualHooks':!![]});}})[_0x0e9e('0x14')](function(){if(_0x115ef1){return _0x115ef1['update']({'online':!![],'lastLoginAt':moment()['format'](_0x0e9e('0x28')),'voicePause':_0x115ef1[_0x0e9e('0x4b')]||![],'mailPause':_0x115ef1[_0x0e9e('0x4b')]||![],'chatPause':_0x115ef1[_0x0e9e('0x4b')]||![],'faxPause':_0x115ef1['loginInPause']||![],'smsPause':_0x115ef1[_0x0e9e('0x4b')]||![],'openchannelPause':_0x115ef1['loginInPause']||![],'pauseType':_0x115ef1[_0x0e9e('0x4b')]?_0x0e9e('0x50'):null,'lastPauseAt':moment()[_0x0e9e('0x21')](_0x0e9e('0x28')),'interface':_0x9f4f12});}})[_0x0e9e('0x14')](function(_0x1b156e){_0x1ec273(_0x1b156e);})[_0x0e9e('0x19')](function(_0x1427ba){_0x665878(_0x3d6352['error'](0x1f4,_0x1427ba[_0x0e9e('0x1d')]));});});};
\ No newline at end of file
+var _0x1300=['then','debug','message','error','ShowUser','find','info','stringify','catch','PauseUser','where','name','role','internal','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','openchannelPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','all','merge','LOGIN','callysquare','lodash','util','moment','bluebird','redis','localhost','./user.socket','register','GetUser','User','options','raw','attributes','limit','map','model','include'];(function(_0x19649f,_0x1b2dca){var _0x18fd11=function(_0x3a7081){while(--_0x3a7081){_0x19649f['push'](_0x19649f['shift']());}};_0x18fd11(++_0x1b2dca);}(_0x1300,0x18e));var _0x0130=function(_0x1a9730,_0xbb4703){_0x1a9730=_0x1a9730-0x0;var _0x1b66e6=_0x1300[_0x1a9730];return _0x1b66e6;};'use strict';var _=require(_0x0130('0x0'));var util=require(_0x0130('0x1'));var moment=require(_0x0130('0x2'));var BPromise=require(_0x0130('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config[_0x0130('0x4')]=_['defaults'](config[_0x0130('0x4')],{'host':_0x0130('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0130('0x4')]));require(_0x0130('0x6'))[_0x0130('0x7')](socket);exports[_0x0130('0x8')]=function(_0x5cc662){var _0xd34317=this;return new Promise(function(_0x4bfc7a,_0x312b92){return db[_0x0130('0x9')]['findAll']({'raw':_0x5cc662['options']?_0x5cc662[_0x0130('0xa')][_0x0130('0xb')]===undefined?!![]:![]:!![],'where':_0x5cc662[_0x0130('0xa')]?_0x5cc662[_0x0130('0xa')]['where']||null:null,'attributes':_0x5cc662[_0x0130('0xa')]?_0x5cc662[_0x0130('0xa')][_0x0130('0xc')]||null:null,'limit':_0x5cc662[_0x0130('0xa')]?_0x5cc662[_0x0130('0xa')][_0x0130('0xd')]||null:null,'include':_0x5cc662[_0x0130('0xa')]?_0x5cc662[_0x0130('0xa')]['include']?_[_0x0130('0xe')](_0x5cc662['options']['include'],function(_0x234734){return{'model':db[_0x234734[_0x0130('0xf')]],'as':_0x234734['as'],'attributes':_0x234734['attributes'],'include':_0x234734[_0x0130('0x10')]?_[_0x0130('0xe')](_0x234734['include'],function(_0x4608fd){return{'model':db[_0x4608fd[_0x0130('0xf')]],'as':_0x4608fd['as'],'attributes':_0x4608fd[_0x0130('0xc')],'include':_0x4608fd[_0x0130('0x10')]?_[_0x0130('0xe')](_0x4608fd[_0x0130('0x10')],function(_0x2e3b6c){return{'model':db[_0x2e3b6c[_0x0130('0xf')]],'as':_0x2e3b6c['as'],'attributes':_0x2e3b6c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0130('0x11')](function(_0x215288){logger['info']('GetUser',_0x5cc662);logger[_0x0130('0x12')](_0x0130('0x8'),_0x5cc662,JSON['stringify'](_0x215288));_0x4bfc7a(_0x215288);})['catch'](function(_0x59cc79){logger['error'](_0x0130('0x8'),_0x59cc79[_0x0130('0x13')],_0x5cc662);_0x312b92(_0xd34317[_0x0130('0x14')](0x1f4,_0x59cc79[_0x0130('0x13')]));});});};exports[_0x0130('0x15')]=function(_0x4d470d){var _0x3929a4=this;return new Promise(function(_0x20ebe9,_0x4312dd){return db[_0x0130('0x9')][_0x0130('0x16')]({'raw':_0x4d470d[_0x0130('0xa')]?_0x4d470d[_0x0130('0xa')][_0x0130('0xb')]===undefined?!![]:![]:!![],'where':_0x4d470d['options']?_0x4d470d[_0x0130('0xa')]['where']||null:null,'attributes':_0x4d470d[_0x0130('0xa')]?_0x4d470d[_0x0130('0xa')][_0x0130('0xc')]||null:null,'include':_0x4d470d['options']?_0x4d470d[_0x0130('0xa')][_0x0130('0x10')]?_[_0x0130('0xe')](_0x4d470d['options'][_0x0130('0x10')],function(_0x57004e){return{'model':db[_0x57004e['model']],'as':_0x57004e['as'],'attributes':_0x57004e[_0x0130('0xc')],'include':_0x57004e['include']?_[_0x0130('0xe')](_0x57004e[_0x0130('0x10')],function(_0x3bbaa2){return{'model':db[_0x3bbaa2[_0x0130('0xf')]],'as':_0x3bbaa2['as'],'attributes':_0x3bbaa2[_0x0130('0xc')],'include':_0x3bbaa2['include']?_[_0x0130('0xe')](_0x3bbaa2[_0x0130('0x10')],function(_0x42a4ed){return{'model':db[_0x42a4ed['model']],'as':_0x42a4ed['as'],'attributes':_0x42a4ed[_0x0130('0xc')]};}):[]};}):[]};}):[]:[]})[_0x0130('0x11')](function(_0x56ba53){logger[_0x0130('0x17')](_0x0130('0x15'),_0x4d470d);logger[_0x0130('0x12')]('ShowUser',_0x4d470d,JSON[_0x0130('0x18')](_0x56ba53));_0x20ebe9(_0x56ba53);})[_0x0130('0x19')](function(_0x1644e3){logger[_0x0130('0x14')](_0x0130('0x15'),_0x1644e3['message'],_0x4d470d);_0x4312dd(_0x3929a4['error'](0x1f4,_0x1644e3[_0x0130('0x13')]));});});};exports[_0x0130('0x1a')]=function(_0x211b1f){var _0x23bc0f;return db['User'][_0x0130('0x16')]({'where':_0x211b1f[_0x0130('0xa')][_0x0130('0x1b')]||{},'attributes':['id',_0x0130('0x1c'),_0x0130('0x1d'),_0x0130('0x1e'),'interface']})[_0x0130('0x11')](function(_0x59c0d8){if(!_0x59c0d8){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x211b1f['params']['id']));}_0x23bc0f=_0x59c0d8;return db[_0x0130('0x1f')][_0x0130('0x20')]({'paused':0x1},{'where':{'UserId':_0x23bc0f['id']},'individualHooks':!![]});})[_0x0130('0x11')](function(){return db[_0x0130('0x21')][_0x0130('0x22')]({'where':{'membername':_0x23bc0f[_0x0130('0x1c')],'type':_0x0130('0x23'),'exitAt':null}});})[_0x0130('0x11')](function(_0x329ab5){if(_0x329ab5&&_0x329ab5[_0x0130('0x24')]){var _0x5d18b5=moment()[_0x0130('0x25')](_0x0130('0x26'));for(var _0x2a28c0=0x0,_0x5f04b4=_0x329ab5[_0x0130('0x24')];_0x2a28c0<_0x5f04b4;_0x2a28c0++){_0x329ab5[_0x2a28c0][_0x0130('0x27')]({'exitAt':_0x5d18b5});}}})[_0x0130('0x11')](function(){var _0x5bc162=[];var _0x55f972=utils[_0x0130('0x28')]();_0x55f972[_0x0130('0x29')](function(_0x488a06){_0x5bc162[_0x0130('0x2a')]({'channel':_0x488a06,'membername':_0x23bc0f[_0x0130('0x1c')],'interface':_[_0x0130('0x2b')](_0x23bc0f[_0x0130('0x2c')])?util[_0x0130('0x25')]('SIP/%s',_0x23bc0f['name']):_0x23bc0f[_0x0130('0x2c')],'type':_0x0130('0x23'),'enterAt':moment()[_0x0130('0x25')](_0x0130('0x26')),'data1':_0x211b1f[_0x0130('0x2d')][_0x0130('0x2e')]||_0x0130('0x2f'),'role':_0x23bc0f[_0x0130('0x1d')],'internal':_0x23bc0f[_0x0130('0x1e')],'uniqueid':_0x211b1f[_0x0130('0x2d')][_0x0130('0x30')]||null});});return db['MemberReport'][_0x0130('0x31')](_0x5bc162,{'individualHooks':!![]});})['then'](function(){return _0x23bc0f[_0x0130('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x211b1f[_0x0130('0x2d')][_0x0130('0x2e')]||_0x0130('0x2f'),'lastPauseAt':moment()[_0x0130('0x25')](_0x0130('0x26'))});})[_0x0130('0x19')](function(_0xec32ac){throw _0xec32ac;});};exports[_0x0130('0x32')]=function(_0x308cd6){return Promise[_0x0130('0x33')]()[_0x0130('0x11')](function(){if(_0x308cd6[_0x0130('0x2d')][_0x0130('0x34')]&&!utils[_0x0130('0x35')](_0x308cd6[_0x0130('0x2d')][_0x0130('0x34')])){throw new Error(util['format'](_0x0130('0x36'),_0x308cd6[_0x0130('0x2d')][_0x0130('0x34')]));}return db[_0x0130('0x9')][_0x0130('0x37')]({'where':_0x308cd6[_0x0130('0xa')][_0x0130('0x1b')]||{},'attributes':['id',_0x0130('0x1c'),_0x0130('0x1d'),_0x0130('0x1e'),_0x0130('0x2c'),_0x0130('0x38'),_0x0130('0x39'),'mailPause',_0x0130('0x3a'),'faxPause',_0x0130('0x3b'),'smsPause',_0x0130('0x3c'),_0x0130('0x3d'),'lastPauseAt']});})['then'](function(_0x1d263e){if(!_0x1d263e){throw new Error(util[_0x0130('0x25')](_0x0130('0x3e'),_0x308cd6[_0x0130('0x3f')]['id']));}return _0x1d263e[_0x0130('0x40')](_0x308cd6[_0x0130('0x2d')][_0x0130('0x34')],_0x0130('0x41'));})[_0x0130('0x19')](function(_0x1d8200){throw _0x1d8200;});};exports['LogoutUser']=function(_0x3d24ed){var _0x305cce=this;return new Promise(function(_0x317e87,_0x2501fa){var _0x2307ce;return db[_0x0130('0x9')]['findOne']({'where':_0x3d24ed[_0x0130('0xa')][_0x0130('0x1b')]||{},'attributes':['id',_0x0130('0x1c')]})[_0x0130('0x11')](function(_0x251bff){if(_0x251bff){_0x2307ce=_0x251bff;return db[_0x0130('0x1f')][_0x0130('0x42')]({'where':{'membername':_0x2307ce[_0x0130('0x1c')]},'individualHooks':!![]});}})['then'](function(){if(_0x2307ce){return db[_0x0130('0x21')]['findAll']({'where':{'membername':_0x2307ce[_0x0130('0x1c')],'exitAt':null}});}})['then'](function(_0x3bb4c5){if(_0x2307ce){if(_0x3bb4c5&&_0x3bb4c5['length']){var _0x33f2c7=[];_0x3bb4c5['forEach'](function(_0x52a3c0){_0x33f2c7[_0x0130('0x2a')](_0x52a3c0[_0x0130('0x20')]({'exitAt':moment()['format'](_0x0130('0x26'))}));});return BPromise['all'](_0x33f2c7);}}})[_0x0130('0x11')](function(){if(_0x2307ce){return _0x2307ce[_0x0130('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0130('0x11')](function(_0x3e8d64){_0x317e87(_0x3e8d64);})[_0x0130('0x19')](function(_0x3105e8){_0x2501fa(_0x305cce[_0x0130('0x14')](0x1f4,_0x3105e8[_0x0130('0x13')]));});});};exports[_0x0130('0x43')]=function(_0x56279e){var _0x2d27f3=this;return new Promise(function(_0x598be8,_0x3b2d14){var _0x230981;var _0x2b0730;var _0x46ac72;var _0x3a8c4e;return db[_0x0130('0x9')][_0x0130('0x37')]({'where':_0x56279e[_0x0130('0xa')][_0x0130('0x1b')]||{},'attributes':['id',_0x0130('0x1c'),_0x0130('0x1d'),_0x0130('0x44'),_0x0130('0x45'),_0x0130('0x1e'),_0x0130('0x46'),_0x0130('0x2c')]})[_0x0130('0x11')](function(_0x531f94){if(_0x531f94){_0x230981=_0x531f94;_0x3a8c4e=_0x56279e[_0x0130('0x2d')][_0x0130('0x2c')]?_0x56279e[_0x0130('0x2d')][_0x0130('0x2c')]:util['format']('SIP/%s',_0x230981[_0x0130('0x1c')]);return db['User'][_0x0130('0x47')]({'where':{'role':_0x0130('0x48'),'online':!![],'id':{'$ne':_0x230981['id']}}});}})['then'](function(_0x390c5d){if(_0x390c5d){_0x46ac72=_0x390c5d;return require(_0x0130('0x49'))[_0x0130('0x4a')]();}})['then'](function(_0x4d4e0f){if(_0x4d4e0f&&_0x4d4e0f[_0x0130('0x4b')]&&_0x46ac72>=_0x4d4e0f['agents']){throw new Error(_0x0130('0x4c'));}})[_0x0130('0x11')](function(){if(_0x230981){return db[_0x0130('0x1f')][_0x0130('0x42')]({'where':{'membername':_0x230981[_0x0130('0x1c')]},'individualHooks':!![]});}})[_0x0130('0x11')](function(){if(_0x230981){return _0x230981['getVoiceQueues']({'raw':!![]});}})[_0x0130('0x11')](function(_0x182f69){if(_0x230981){if(_0x182f69){var _0x578470=[];_0x2b0730=_0x182f69;if(_0x2b0730['length']){for(var _0x414e99=0x0;_0x414e99<_0x2b0730['length'];_0x414e99++){_0x578470[_0x0130('0x2a')](db['UserVoiceQueueRt'][_0x0130('0x4d')]({'membername':_0x230981['name'],'UserId':_0x230981['id'],'queue_name':_0x2b0730[_0x414e99][_0x0130('0x1c')],'VoiceQueueId':_0x2b0730[_0x414e99]['id'],'interface':_0x3a8c4e,'paused':_0x230981[_0x0130('0x46')]||![],'penalty':_0x2b0730[_0x414e99][_0x0130('0x4e')]||0x0}));}return BPromise['all'](_0x578470);}}}})[_0x0130('0x11')](function(){if(_0x230981){return db['MemberReport']['findAll']({'where':{'membername':_0x230981[_0x0130('0x1c')],'exitAt':null}});}})[_0x0130('0x11')](function(_0x338822){if(_0x230981){if(_0x338822&&_0x338822[_0x0130('0x24')]){var _0x1785ab=[];_0x338822[_0x0130('0x29')](function(_0x3d8744){_0x1785ab[_0x0130('0x2a')](_0x3d8744[_0x0130('0x20')]({'exitAt':moment()[_0x0130('0x25')](_0x0130('0x26'))}));});return BPromise[_0x0130('0x4f')](_0x1785ab);}}})[_0x0130('0x11')](function(){if(_0x230981){var _0x92053b=[];var _0x45273d=[];var _0x2d6d1d=utils[_0x0130('0x28')]();var _0x1b247a={'membername':_0x230981[_0x0130('0x1c')],'interface':_0x3a8c4e,'enterAt':moment()[_0x0130('0x25')](_0x0130('0x26')),'role':_0x230981[_0x0130('0x1d')],'internal':_0x230981[_0x0130('0x1e')]};_0x2d6d1d[_0x0130('0x29')](function(_0x3fd183){_0x92053b[_0x0130('0x2a')](_[_0x0130('0x50')]({'channel':_0x3fd183,'type':_0x0130('0x51'),'data1':_0x0130('0x52'),'data2':_0x3a8c4e},_0x1b247a));if(_0x230981[_0x0130('0x46')]){_0x45273d[_0x0130('0x2a')](_[_0x0130('0x50')]({'channel':_0x3fd183,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1b247a));}});return db[_0x0130('0x21')][_0x0130('0x31')](_0x92053b['concat'](_0x45273d),{'individualHooks':!![]});}})[_0x0130('0x11')](function(){if(_0x230981){return _0x230981[_0x0130('0x20')]({'online':!![],'lastLoginAt':moment()[_0x0130('0x25')](_0x0130('0x26')),'voicePause':_0x230981[_0x0130('0x46')]||![],'mailPause':_0x230981['loginInPause']||![],'chatPause':_0x230981[_0x0130('0x46')]||![],'faxPause':_0x230981[_0x0130('0x46')]||![],'smsPause':_0x230981[_0x0130('0x46')]||![],'openchannelPause':_0x230981[_0x0130('0x46')]||![],'pauseType':_0x230981[_0x0130('0x46')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3a8c4e});}})[_0x0130('0x11')](function(_0x357d6f){_0x598be8(_0x357d6f);})[_0x0130('0x19')](function(_0x1aacb7){_0x3b2d14(_0x2d27f3[_0x0130('0x14')](0x1f4,_0x1aacb7[_0x0130('0x13')]));});});};
\ No newline at end of file
index 4b3f20b..003b3a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf21a=['save','remove','emit','removeListener','register','length','./user.events'];(function(_0x12403d,_0x875c57){var _0x36ca44=function(_0x2a0fca){while(--_0x2a0fca){_0x12403d['push'](_0x12403d['shift']());}};_0x36ca44(++_0x875c57);}(_0xf21a,0xd8));var _0xaf21=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf21a[_0x321bb2];return _0x9c12ed;};'use strict';var UserEvents=require(_0xaf21('0x0'));var events=[_0xaf21('0x1'),_0xaf21('0x2'),'update'];function createListener(_0x5b1f37,_0x357635){return function(_0x1914bc){_0x357635[_0xaf21('0x3')](_0x5b1f37,_0x1914bc);};}function removeListener(_0x11d85c,_0x61652c){return function(){UserEvents[_0xaf21('0x4')](_0x11d85c,_0x61652c);};}exports[_0xaf21('0x5')]=function(_0x2516a7){for(var _0x231475=0x0,_0x3e5425=events[_0xaf21('0x6')];_0x231475<_0x3e5425;_0x231475++){var _0x3b93bc=events[_0x231475];var _0x4b7be0=createListener('user:'+_0x3b93bc,_0x2516a7);UserEvents['on'](_0x3b93bc,_0x4b7be0);}};
\ No newline at end of file
+var _0xfa8c=['removeListener','register','length','user:','./user.events','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa8c,0x19c));var _0xcfa8=function(_0x596122,_0x593f71){_0x596122=_0x596122-0x0;var _0x5d0909=_0xfa8c[_0x596122];return _0x5d0909;};'use strict';var UserEvents=require(_0xcfa8('0x0'));var events=['save',_0xcfa8('0x1'),_0xcfa8('0x2')];function createListener(_0x8973e1,_0x44face){return function(_0x3a4ef1){_0x44face[_0xcfa8('0x3')](_0x8973e1,_0x3a4ef1);};}function removeListener(_0x23cfcb,_0x1666d3){return function(){UserEvents[_0xcfa8('0x4')](_0x23cfcb,_0x1666d3);};}exports[_0xcfa8('0x5')]=function(_0x14d74a){for(var _0x44c728=0x0,_0x25834c=events[_0xcfa8('0x6')];_0x44c728<_0x25834c;_0x44c728++){var _0x147859=events[_0x44c728];var _0x3d1f52=createListener(_0xcfa8('0x7')+_0x147859,_0x14d74a);UserEvents['on'](_0x147859,_0x3d1f52);}};
\ No newline at end of file
index 2fee171..7e874b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x307cec,_0x1cf922){var _0x285c73=function(_0x2602e7){while(--_0x2602e7){_0x307cec['push'](_0x307cec['shift']());}};_0x285c73(++_0x1cf922);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x551455,_0x571544){var _0x1b4d69=function(_0x50d37b){while(--_0x50d37b){_0x551455['push'](_0x551455['shift']());}};_0x1b4d69(++_0x571544);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xcb91[_0x576266];return _0x18234f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
index 259feb7..fed6058 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x517d=['sequelize','exports','INTEGER'];(function(_0x50da1d,_0x1fa929){var _0x30cd08=function(_0x337a45){while(--_0x337a45){_0x50da1d['push'](_0x50da1d['shift']());}};_0x30cd08(++_0x1fa929);}(_0x517d,0x12f));var _0xd517=function(_0x182142,_0x564118){_0x182142=_0x182142-0x0;var _0x3b307a=_0x517d[_0x182142];return _0x3b307a;};'use strict';var Sequelize=require(_0xd517('0x0'));module[_0xd517('0x1')]={'penalty':{'type':Sequelize[_0xd517('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x1be4=['sequelize','exports','INTEGER'];(function(_0x3b9766,_0x71c19f){var _0x289d45=function(_0x51122b){while(--_0x51122b){_0x3b9766['push'](_0x3b9766['shift']());}};_0x289d45(++_0x71c19f);}(_0x1be4,0x198));var _0x41be=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x1be4[_0x251e8c];return _0x1e0c1d;};'use strict';var Sequelize=require(_0x41be('0x0'));module[_0x41be('0x1')]={'penalty':{'type':Sequelize[_0x41be('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index c888dad..3bde632 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd3f=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xbd3f,0x103));var _0xfbd3=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0xbd3f[_0xb6e43];return _0x47c40f;};'use strict';var _=require(_0xfbd3('0x0'));var util=require(_0xfbd3('0x1'));var logger=require(_0xfbd3('0x2'))(_0xfbd3('0x3'));var moment=require(_0xfbd3('0x4'));var BPromise=require('bluebird');var rp=require(_0xfbd3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbd3('0x6'));var config=require(_0xfbd3('0x7'));var attributes=require(_0xfbd3('0x8'));module[_0xfbd3('0x9')]=function(_0xe29472,_0x2bfcd9){return _0xe29472[_0xfbd3('0xa')](_0xfbd3('0xb'),attributes,{'tableName':_0xfbd3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x887c=['./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x887c,0xb8));var _0xc887=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0x887c[_0x188c88];return _0x4e4c38;};'use strict';var _=require(_0xc887('0x0'));var util=require('util');var logger=require(_0xc887('0x1'))(_0xc887('0x2'));var moment=require('moment');var BPromise=require(_0xc887('0x3'));var rp=require(_0xc887('0x4'));var fs=require('fs');var path=require(_0xc887('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc887('0x6'));module[_0xc887('0x7')]=function(_0x582bda,_0x39403a){return _0x582bda[_0xc887('0x8')]('UserChatQueue',attributes,{'tableName':_0xc887('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b37aef4..1e530f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc637=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0xeba865,_0xaa973){var _0xfbe83b=function(_0x26c88a){while(--_0x26c88a){_0xeba865['push'](_0xeba865['shift']());}};_0xfbe83b(++_0xaa973);}(_0xc637,0x13b));var _0x7c63=function(_0x35292f,_0x2ed644){_0x35292f=_0x35292f-0x0;var _0x450e0c=_0xc637[_0x35292f];return _0x450e0c;};'use strict';var _=require('lodash');var util=require(_0x7c63('0x0'));var moment=require(_0x7c63('0x1'));var BPromise=require(_0x7c63('0x2'));var rs=require(_0x7c63('0x3'));var fs=require('fs');var Redis=require(_0x7c63('0x4'));var db=require(_0x7c63('0x5'))['db'];var utils=require(_0x7c63('0x6'));var logger=require(_0x7c63('0x7'))(_0x7c63('0x8'));var config=require(_0x7c63('0x9'));var jayson=require(_0x7c63('0xa'));var client=jayson[_0x7c63('0xb')][_0x7c63('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdf69,_0x35b653,_0x5d6c3f){return new BPromise(function(_0x285dec,_0x1a963a){return client[_0x7c63('0xd')](_0xdf69,_0x5d6c3f)[_0x7c63('0xe')](function(_0x220e08){logger['info'](_0x7c63('0xf'),_0x35b653,_0x7c63('0x10'));logger[_0x7c63('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x35b653,_0x7c63('0x10'),JSON['stringify'](_0x220e08));if(_0x220e08['error']){if(_0x220e08[_0x7c63('0x12')][_0x7c63('0x13')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x35b653,_0x220e08['error']['message']);return _0x1a963a(_0x220e08[_0x7c63('0x12')]['message']);}logger[_0x7c63('0x12')](_0x7c63('0xf'),_0x35b653,_0x220e08[_0x7c63('0x12')][_0x7c63('0x14')]);return _0x285dec(_0x220e08['error'][_0x7c63('0x14')]);}else{logger[_0x7c63('0x15')](_0x7c63('0xf'),_0x35b653,'request\x20sent');_0x285dec(_0x220e08[_0x7c63('0x16')][_0x7c63('0x14')]);}})[_0x7c63('0x17')](function(_0x51656c){logger[_0x7c63('0x12')](_0x7c63('0xf'),_0x35b653,_0x51656c);_0x1a963a(_0x51656c);});});}
\ No newline at end of file
+var _0x77d7=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c9e9d,_0xa5faf7){var _0x2f8cfa=function(_0x469ede){while(--_0x469ede){_0x2c9e9d['push'](_0x2c9e9d['shift']());}};_0x2f8cfa(++_0xa5faf7);}(_0x77d7,0xca));var _0x777d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x77d7[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x777d('0x0'));var util=require('util');var moment=require(_0x777d('0x1'));var BPromise=require('bluebird');var rs=require(_0x777d('0x2'));var fs=require('fs');var Redis=require(_0x777d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x777d('0x4'));var logger=require(_0x777d('0x5'))(_0x777d('0x6'));var config=require(_0x777d('0x7'));var jayson=require(_0x777d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31e021,_0x28df61,_0x17621d){return new BPromise(function(_0x3dd158,_0x352d57){return client[_0x777d('0x9')](_0x31e021,_0x17621d)[_0x777d('0xa')](function(_0x174d41){logger['info'](_0x777d('0xb'),_0x28df61,_0x777d('0xc'));logger[_0x777d('0xd')](_0x777d('0xe'),_0x28df61,_0x777d('0xc'),JSON[_0x777d('0xf')](_0x174d41));if(_0x174d41[_0x777d('0x10')]){if(_0x174d41[_0x777d('0x10')][_0x777d('0x11')]===0x1f4){logger[_0x777d('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x28df61,_0x174d41['error'][_0x777d('0x12')]);return _0x352d57(_0x174d41['error']['message']);}logger[_0x777d('0x10')](_0x777d('0xb'),_0x28df61,_0x174d41[_0x777d('0x10')][_0x777d('0x12')]);return _0x3dd158(_0x174d41[_0x777d('0x10')]['message']);}else{logger[_0x777d('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x28df61,_0x777d('0xc'));_0x3dd158(_0x174d41[_0x777d('0x14')][_0x777d('0x12')]);}})[_0x777d('0x15')](function(_0x4406bd){logger[_0x777d('0x10')](_0x777d('0xb'),_0x28df61,_0x4406bd);_0x352d57(_0x4406bd);});});}
\ No newline at end of file
index 531834c..4db5365 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5f0f2c,_0x9817bf){var _0x104e69=function(_0x6915cc){while(--_0x6915cc){_0x5f0f2c['push'](_0x5f0f2c['shift']());}};_0x104e69(++_0x9817bf);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf3223a,_0x4f8397){var _0x28f07a=function(_0x2003c3){while(--_0x2003c3){_0xf3223a['push'](_0xf3223a['shift']());}};_0x28f07a(++_0x4f8397);}(_0x70e0,0x17b));var _0x070e=function(_0x5c7174,_0x187d72){_0x5c7174=_0x5c7174-0x0;var _0x16fbd6=_0x70e0[_0x5c7174];return _0x16fbd6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index d7de372..1f6ffe2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2989=['STRING','sequelize','exports','INTEGER'];(function(_0x192331,_0x535ca2){var _0x403fb4=function(_0x135216){while(--_0x135216){_0x192331['push'](_0x192331['shift']());}};_0x403fb4(++_0x535ca2);}(_0x2989,0x175));var _0x9298=function(_0x2de0e8,_0x1f7201){_0x2de0e8=_0x2de0e8-0x0;var _0x394685=_0x2989[_0x2de0e8];return _0x394685;};'use strict';var Sequelize=require(_0x9298('0x0'));module[_0x9298('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9298('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9298('0x3')]}};
\ No newline at end of file
+var _0x8a35=['exports','INTEGER','STRING','sequelize'];(function(_0x56c1e7,_0x541442){var _0x4234c7=function(_0x5311b6){while(--_0x5311b6){_0x56c1e7['push'](_0x56c1e7['shift']());}};_0x4234c7(++_0x541442);}(_0x8a35,0x14b));var _0x58a3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8a35[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x58a3('0x0'));module[_0x58a3('0x1')]={'penalty':{'type':Sequelize[_0x58a3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58a3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x58a3('0x3')]}};
\ No newline at end of file
index be263f4..8e268c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1f0=['define','UserFaxQueue','user_has_fax_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x28c249,_0x380399){var _0x38b10f=function(_0x4e7610){while(--_0x4e7610){_0x28c249['push'](_0x28c249['shift']());}};_0x38b10f(++_0x380399);}(_0xc1f0,0x92));var _0x0c1f=function(_0x34fe54,_0x32ca32){_0x34fe54=_0x34fe54-0x0;var _0x507c89=_0xc1f0[_0x34fe54];return _0x507c89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c1f('0x0'))(_0x0c1f('0x1'));var moment=require(_0x0c1f('0x2'));var BPromise=require(_0x0c1f('0x3'));var rp=require(_0x0c1f('0x4'));var fs=require('fs');var path=require(_0x0c1f('0x5'));var rimraf=require(_0x0c1f('0x6'));var config=require(_0x0c1f('0x7'));var attributes=require(_0x0c1f('0x8'));module[_0x0c1f('0x9')]=function(_0x4f3d7f,_0x36b89f){return _0x4f3d7f[_0x0c1f('0xa')](_0x0c1f('0xb'),attributes,{'tableName':_0x0c1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x14e3=['user_has_fax_queues','lodash','util','api','moment','request-promise','../../config/environment','exports','UserFaxQueue'];(function(_0x50026f,_0x5c2b57){var _0x1fd7f6=function(_0x48dc6d){while(--_0x48dc6d){_0x50026f['push'](_0x50026f['shift']());}};_0x1fd7f6(++_0x5c2b57);}(_0x14e3,0x184));var _0x314e=function(_0x1a6f8f,_0x4c8dc0){_0x1a6f8f=_0x1a6f8f-0x0;var _0x975649=_0x14e3[_0x1a6f8f];return _0x975649;};'use strict';var _=require(_0x314e('0x0'));var util=require(_0x314e('0x1'));var logger=require('../../config/logger')(_0x314e('0x2'));var moment=require(_0x314e('0x3'));var BPromise=require('bluebird');var rp=require(_0x314e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x314e('0x5'));var attributes=require('./userFaxQueue.attributes');module[_0x314e('0x6')]=function(_0x270f68,_0x3438bb){return _0x270f68['define'](_0x314e('0x7'),attributes,{'tableName':_0x314e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 07a25a0..3554145 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf14b=['stringify','error','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf14b,0x88));var _0xbf14=function(_0x3ea360,_0x4a3b9e){_0x3ea360=_0x3ea360-0x0;var _0x330457=_0xf14b[_0x3ea360];return _0x330457;};'use strict';var _=require(_0xbf14('0x0'));var util=require(_0xbf14('0x1'));var moment=require(_0xbf14('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf14('0x3'));var db=require(_0xbf14('0x4'))['db'];var utils=require(_0xbf14('0x5'));var logger=require(_0xbf14('0x6'))(_0xbf14('0x7'));var config=require(_0xbf14('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf14('0x9')][_0xbf14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcd583c,_0x33bbd1,_0x5a7f1e){return new BPromise(function(_0x2bf3ae,_0xcfd31f){return client['request'](_0xcd583c,_0x5a7f1e)[_0xbf14('0xb')](function(_0x48de83){logger[_0xbf14('0xc')](_0xbf14('0xd'),_0x33bbd1,_0xbf14('0xe'));logger[_0xbf14('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x33bbd1,'request\x20sent',JSON[_0xbf14('0x10')](_0x48de83));if(_0x48de83[_0xbf14('0x11')]){if(_0x48de83[_0xbf14('0x11')]['code']===0x1f4){logger[_0xbf14('0x11')](_0xbf14('0xd'),_0x33bbd1,_0x48de83[_0xbf14('0x11')]['message']);return _0xcfd31f(_0x48de83[_0xbf14('0x11')]['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x33bbd1,_0x48de83[_0xbf14('0x11')][_0xbf14('0x12')]);return _0x2bf3ae(_0x48de83[_0xbf14('0x11')][_0xbf14('0x12')]);}else{logger['info'](_0xbf14('0xd'),_0x33bbd1,'request\x20sent');_0x2bf3ae(_0x48de83['result'][_0xbf14('0x12')]);}})['catch'](function(_0x5f0e87){logger[_0xbf14('0x11')](_0xbf14('0xd'),_0x33bbd1,_0x5f0e87);_0xcfd31f(_0x5f0e87);});});}
\ No newline at end of file
+var _0xd742=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd742,0xdc));var _0x2d74=function(_0x3f1b5b,_0x3d444f){_0x3f1b5b=_0x3f1b5b-0x0;var _0xaa5f31=_0xd742[_0x3f1b5b];return _0xaa5f31;};'use strict';var _=require(_0x2d74('0x0'));var util=require(_0x2d74('0x1'));var moment=require(_0x2d74('0x2'));var BPromise=require(_0x2d74('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d74('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d74('0x5'));var logger=require(_0x2d74('0x6'))(_0x2d74('0x7'));var config=require(_0x2d74('0x8'));var jayson=require(_0x2d74('0x9'));var client=jayson[_0x2d74('0xa')][_0x2d74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b2689,_0x30ccc3,_0x7a119b){return new BPromise(function(_0x5a3885,_0x35887d){return client[_0x2d74('0xc')](_0x1b2689,_0x7a119b)[_0x2d74('0xd')](function(_0x3fce98){logger[_0x2d74('0xe')](_0x2d74('0xf'),_0x30ccc3,_0x2d74('0x10'));logger[_0x2d74('0x11')](_0x2d74('0x12'),_0x30ccc3,_0x2d74('0x10'),JSON[_0x2d74('0x13')](_0x3fce98));if(_0x3fce98['error']){if(_0x3fce98[_0x2d74('0x14')][_0x2d74('0x15')]===0x1f4){logger['error'](_0x2d74('0xf'),_0x30ccc3,_0x3fce98[_0x2d74('0x14')]['message']);return _0x35887d(_0x3fce98[_0x2d74('0x14')][_0x2d74('0x16')]);}logger[_0x2d74('0x14')](_0x2d74('0xf'),_0x30ccc3,_0x3fce98[_0x2d74('0x14')][_0x2d74('0x16')]);return _0x5a3885(_0x3fce98[_0x2d74('0x14')][_0x2d74('0x16')]);}else{logger['info'](_0x2d74('0xf'),_0x30ccc3,_0x2d74('0x10'));_0x5a3885(_0x3fce98[_0x2d74('0x17')][_0x2d74('0x16')]);}})[_0x2d74('0x18')](function(_0x39e202){logger['error'](_0x2d74('0xf'),_0x30ccc3,_0x39e202);_0x35887d(_0x39e202);});});}
\ No newline at end of file
index 7b189e4..6a790c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x540311,_0x53ca8b){var _0x56beef=function(_0x2cb4e8){while(--_0x2cb4e8){_0x540311['push'](_0x540311['shift']());}};_0x56beef(++_0x53ca8b);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
index 15922ec..024fde6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86ce=['sequelize','exports'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x86ce,0x174));var _0xe86c=function(_0x4bcb3c,_0x192122){_0x4bcb3c=_0x4bcb3c-0x0;var _0xfe09bb=_0x86ce[_0x4bcb3c];return _0xfe09bb;};'use strict';var Sequelize=require(_0xe86c('0x0'));module[_0xe86c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x285f=['INTEGER','sequelize','exports'];(function(_0xeb65c,_0x5036c3){var _0x2afc4b=function(_0x6665ca){while(--_0x6665ca){_0xeb65c['push'](_0xeb65c['shift']());}};_0x2afc4b(++_0x5036c3);}(_0x285f,0x18d));var _0xf285=function(_0x38319f,_0x2f62ab){_0x38319f=_0x38319f-0x0;var _0xe082e=_0x285f[_0x38319f];return _0xe082e;};'use strict';var Sequelize=require(_0xf285('0x0'));module[_0xf285('0x1')]={'penalty':{'type':Sequelize[_0xf285('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 8f8970a..9af2e21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8ee=['bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','../../config/logger','api','moment'];(function(_0x397014,_0x17cc12){var _0x1163f7=function(_0x290ac1){while(--_0x290ac1){_0x397014['push'](_0x397014['shift']());}};_0x1163f7(++_0x17cc12);}(_0xd8ee,0x11b));var _0xed8e=function(_0x525290,_0x493c29){_0x525290=_0x525290-0x0;var _0x1231ca=_0xd8ee[_0x525290];return _0x1231ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xed8e('0x0'))(_0xed8e('0x1'));var moment=require(_0xed8e('0x2'));var BPromise=require(_0xed8e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed8e('0x4'));var rimraf=require(_0xed8e('0x5'));var config=require(_0xed8e('0x6'));var attributes=require(_0xed8e('0x7'));module[_0xed8e('0x8')]=function(_0x344442,_0x1c1e83){return _0x344442[_0xed8e('0x9')]('UserMailQueue',attributes,{'tableName':_0xed8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1a50=['exports','define','UserMailQueue','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userMailQueue.attributes'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x1a50,0x125));var _0x01a5=function(_0x12c32c,_0x13af3b){_0x12c32c=_0x12c32c-0x0;var _0x39b809=_0x1a50[_0x12c32c];return _0x39b809;};'use strict';var _=require('lodash');var util=require(_0x01a5('0x0'));var logger=require(_0x01a5('0x1'))(_0x01a5('0x2'));var moment=require('moment');var BPromise=require(_0x01a5('0x3'));var rp=require(_0x01a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01a5('0x5'));var attributes=require(_0x01a5('0x6'));module[_0x01a5('0x7')]=function(_0x5f3ebf,_0x35c4f4){return _0x5f3ebf[_0x01a5('0x8')](_0x01a5('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 822694a..b41c13c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x48f369,_0x3a7a90){var _0x45a957=function(_0x597ccd){while(--_0x597ccd){_0x48f369['push'](_0x48f369['shift']());}};_0x45a957(++_0x3a7a90);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}
\ No newline at end of file
+var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x13bf1f,_0x2d146b){var _0x5007e7=function(_0x2f3065){while(--_0x2f3065){_0x13bf1f['push'](_0x13bf1f['shift']());}};_0x5007e7(++_0x2d146b);}(_0x55ca,0x126));var _0xa55c=function(_0x3e2040,_0x660381){_0x3e2040=_0x3e2040-0x0;var _0x38e3ec=_0x55ca[_0x3e2040];return _0x38e3ec;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}
\ No newline at end of file
index b688f1d..f530e23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb129=['Router','fs-extra','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','multer','path','connect-timeout','express'];(function(_0xa706e0,_0x471bec){var _0xc6e0a8=function(_0xbe3a80){while(--_0xbe3a80){_0xa706e0['push'](_0xa706e0['shift']());}};_0xc6e0a8(++_0x471bec);}(_0xb129,0x15a));var _0x9b12=function(_0x26bff1,_0x34c8ec){_0x26bff1=_0x26bff1-0x0;var _0x71a8d5=_0xb129[_0x26bff1];return _0x71a8d5;};'use strict';var multer=require(_0x9b12('0x0'));var util=require('util');var path=require(_0x9b12('0x1'));var timeout=require(_0x9b12('0x2'));var express=require(_0x9b12('0x3'));var router=express[_0x9b12('0x4')]();var fs_extra=require(_0x9b12('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b12('0x6'));var config=require('../../config/environment');var controller=require(_0x9b12('0x7'));router['post']('/',auth[_0x9b12('0x8')](),controller[_0x9b12('0x9')]);module['exports']=router;
\ No newline at end of file
+var _0x7495=['./userNotification.controller','post','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x502cc8,_0x4fd1f9){var _0x44c83e=function(_0x383e85){while(--_0x383e85){_0x502cc8['push'](_0x502cc8['shift']());}};_0x44c83e(++_0x4fd1f9);}(_0x7495,0x17e));var _0x5749=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x7495[_0x178856];return _0x3c7fe7;};'use strict';var multer=require(_0x5749('0x0'));var util=require(_0x5749('0x1'));var path=require(_0x5749('0x2'));var timeout=require(_0x5749('0x3'));var express=require(_0x5749('0x4'));var router=express[_0x5749('0x5')]();var fs_extra=require(_0x5749('0x6'));var auth=require(_0x5749('0x7'));var interaction=require(_0x5749('0x8'));var config=require(_0x5749('0x9'));var controller=require(_0x5749('0xa'));router[_0x5749('0xb')]('/',auth['isAuthenticated'](),controller[_0x5749('0xc')]);module[_0x5749('0xd')]=router;
\ No newline at end of file
index 1332e21..5ce6fd3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2aa=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0xbd4746,_0x9ca2c8){var _0x2afcef=function(_0x5c6a0b){while(--_0x5c6a0b){_0xbd4746['push'](_0xbd4746['shift']());}};_0x2afcef(++_0x9ca2c8);}(_0xf2aa,0x129));var _0xaf2a=function(_0x5b9de6,_0x3bd267){_0x5b9de6=_0x5b9de6-0x0;var _0x558207=_0xf2aa[_0x5b9de6];return _0x558207;};'use strict';var Sequelize=require(_0xaf2a('0x0'));module['exports']={'body':{'type':Sequelize[_0xaf2a('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xaf2a('0x1')]},'recipientsDescription':{'type':Sequelize[_0xaf2a('0x2')]},'beep':{'type':Sequelize[_0xaf2a('0x3')]}};
\ No newline at end of file
+var _0xd12e=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x231399,_0x3784a2){var _0x233a05=function(_0x1da096){while(--_0x1da096){_0x231399['push'](_0x231399['shift']());}};_0x233a05(++_0x3784a2);}(_0xd12e,0x132));var _0xed12=function(_0x48571f,_0x4c86f4){_0x48571f=_0x48571f-0x0;var _0x495a93=_0xd12e[_0x48571f];return _0x495a93;};'use strict';var Sequelize=require(_0xed12('0x0'));module[_0xed12('0x1')]={'body':{'type':Sequelize[_0xed12('0x2')]},'senderName':{'type':Sequelize[_0xed12('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xed12('0x3')]},'beep':{'type':Sequelize[_0xed12('0x4')]}};
\ No newline at end of file
index a365726..8868b0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x87ec=['send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','forEach','startCase','User','union','queue','replace','Queue','push','all','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','status','error','stack','name'];(function(_0x2a535b,_0x452b6f){var _0x59e74d=function(_0x3928a4){while(--_0x3928a4){_0x2a535b['push'](_0x2a535b['shift']());}};_0x59e74d(++_0x452b6f);}(_0x87ec,0x158));var _0xc87e=function(_0x388d01,_0x38bf51){_0x388d01=_0x388d01-0x0;var _0x23bf5c=_0x87ec[_0x388d01];return _0x23bf5c;};'use strict';var emlformat=require(_0xc87e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc87e('0x1'));var jsonpatch=require(_0xc87e('0x2'));var rp=require(_0xc87e('0x3'));var moment=require(_0xc87e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc87e('0x5'));var util=require(_0xc87e('0x6'));var path=require(_0xc87e('0x7'));var sox=require(_0xc87e('0x8'));var csv=require(_0xc87e('0x9'));var ejs=require(_0xc87e('0xa'));var fs=require('fs');var fs_extra=require(_0xc87e('0xb'));var _=require(_0xc87e('0xc'));var squel=require(_0xc87e('0xd'));var crypto=require(_0xc87e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc87e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc87e('0x10'));var Papa=require('papaparse');var Redis=require(_0xc87e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc87e('0x12'));var hardwareService=require(_0xc87e('0x13'));var logger=require(_0xc87e('0x14'))(_0xc87e('0x15'));var utils=require(_0xc87e('0x16'));var config=require(_0xc87e('0x17'));var licenseUtil=require(_0xc87e('0x18'));var db=require(_0xc87e('0x19'))['db'];config[_0xc87e('0x1a')]=_[_0xc87e('0x1b')](config[_0xc87e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc87e('0x1c'))(new Redis(config[_0xc87e('0x1a')]));require('./userNotification.socket')[_0xc87e('0x1d')](socket);function respondWithStatusCode(_0x231cc6,_0x2cacff){_0x2cacff=_0x2cacff||0xcc;return function(_0x30374a){if(_0x30374a){return _0x231cc6[_0xc87e('0x1e')](_0x2cacff);}return _0x231cc6['status'](_0x2cacff)[_0xc87e('0x1f')]();};}function respondWithResult(_0x3d7ebf,_0x6855c3){_0x6855c3=_0x6855c3||0xc8;return function(_0x5e4ae1){if(_0x5e4ae1){return _0x3d7ebf['status'](_0x6855c3)[_0xc87e('0x20')](_0x5e4ae1);}};}function respondWithFilteredResult(_0x30c1a3,_0x1cce59){return function(_0x51d2d1){if(_0x51d2d1){var _0x58b975=typeof _0x1cce59[_0xc87e('0x21')]==='undefined'&&typeof _0x1cce59[_0xc87e('0x22')]===_0xc87e('0x23');var _0x5ce6b1=_0x51d2d1[_0xc87e('0x24')];var _0x31d836=_0x58b975?0x0:_0x1cce59[_0xc87e('0x21')];var _0x1cd0fb=_0x58b975?_0x51d2d1[_0xc87e('0x24')]:_0x1cce59['offset']+_0x1cce59[_0xc87e('0x22')];var _0x3d6468;if(_0x1cd0fb>=_0x5ce6b1){_0x1cd0fb=_0x5ce6b1;_0x3d6468=0xc8;}else{_0x3d6468=0xce;}_0x30c1a3['status'](_0x3d6468);return _0x30c1a3['set'](_0xc87e('0x25'),_0x31d836+'-'+_0x1cd0fb+'/'+_0x5ce6b1)[_0xc87e('0x20')](_0x51d2d1);}return null;};}function patchUpdates(_0x5dcbdb){return function(_0x3b32bd){try{jsonpatch[_0xc87e('0x26')](_0x3b32bd,_0x5dcbdb,!![]);}catch(_0x46a4e3){return BPromise[_0xc87e('0x27')](_0x46a4e3);}return _0x3b32bd[_0xc87e('0x28')]();};}function saveUpdates(_0x669be,_0x3e4aa3){return function(_0x317b9f){if(_0x317b9f){return _0x317b9f[_0xc87e('0x29')](_0x669be)['then'](function(_0x109ad1){return _0x109ad1;});}return null;};}function removeEntity(_0x5058bc,_0x383889){return function(_0x447395){if(_0x447395){return _0x447395[_0xc87e('0x2a')]()[_0xc87e('0x2b')](function(){_0x5058bc[_0xc87e('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d24f0,_0x21a45f){return function(_0x1ea52c){if(!_0x1ea52c){_0x4d24f0[_0xc87e('0x1e')](0x194);}return _0x1ea52c;};}function handleError(_0x467abd,_0x478c99){_0x478c99=_0x478c99||0x1f4;return function(_0x529f43){logger[_0xc87e('0x2d')](_0x529f43[_0xc87e('0x2e')]);if(_0x529f43[_0xc87e('0x2f')]){delete _0x529f43[_0xc87e('0x2f')];}_0x467abd['status'](_0x478c99)[_0xc87e('0x30')](_0x529f43);};}exports['sendUserNotification']=function(_0x39461d,_0x4f5af8,_0x4309db){if(!_0x39461d[_0xc87e('0x31')][_0xc87e('0x32')](_0xc87e('0x33'))&&!_0x39461d[_0xc87e('0x31')][_0xc87e('0x32')](_0xc87e('0x34'))){throw new db[(_0xc87e('0x35'))][(_0xc87e('0x36'))](_0xc87e('0x37'));}else{if(_0x39461d[_0xc87e('0x31')][_0xc87e('0x32')](_0xc87e('0x34'))&&!_0x39461d[_0xc87e('0x31')]['hasOwnProperty'](_0xc87e('0x38'))){throw new db[(_0xc87e('0x35'))][(_0xc87e('0x36'))](_0xc87e('0x39'));}if(!_0x39461d['body']['hasOwnProperty'](_0xc87e('0x3a'))){throw new db['Sequelize'][(_0xc87e('0x36'))](_0xc87e('0x3b'));}else{try{var _0x527c9e=JSON[_0xc87e('0x3c')](_0x39461d[_0xc87e('0x31')]['recipients']);}catch(_0xfb01b5){logger[_0xc87e('0x2d')](_0xfb01b5);throw new db[(_0xc87e('0x35'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x502a32=[_0xc87e('0x3d'),_0xc87e('0x3e'),_0xc87e('0x3f'),_0xc87e('0x40'),'smsqueue','voicequeue',_0xc87e('0x41'),'team',_0xc87e('0x42')];if(_[_0xc87e('0x43')](_0x527c9e,function(_0x5ca4da){return!_[_0xc87e('0x44')](_0x502a32,_0x5ca4da[_0xc87e('0x45')][_0xc87e('0x46')]());})){throw new db[(_0xc87e('0x35'))][(_0xc87e('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x114114={};_0x114114[_0xc87e('0x47')]=_0x39461d['body'][_0xc87e('0x32')](_0xc87e('0x47'))?_0x39461d[_0xc87e('0x31')][_0xc87e('0x47')]:_0x39461d[_0xc87e('0x42')][_0xc87e('0x48')];_0x114114['recipientsDescription']=_['isEmpty'](_0x39461d[_0xc87e('0x31')][_0xc87e('0x49')])?null:_0x39461d[_0xc87e('0x31')][_0xc87e('0x49')];_0x114114[_0xc87e('0x4a')]=_0x39461d[_0xc87e('0x31')][_0xc87e('0x4a')]||![];_0x114114[_0xc87e('0x4b')]=_0x39461d[_0xc87e('0x42')]['id'];return getContent(_0x39461d[_0xc87e('0x31')])[_0xc87e('0x2b')](function(_0x39c9ba){_0x114114[_0xc87e('0x31')]=_0x39c9ba;return getRecipients(_0x527c9e);})['then'](function(_0x26790d){_0x114114[_0xc87e('0x4c')]=_[_0xc87e('0x4d')](_0x26790d)[_0xc87e('0x4e')](',');return db[_0xc87e('0x4f')][_0xc87e('0x50')](function(_0x24eab4){return db[_0xc87e('0x51')]['create'](_0x114114,{'raw':!![],'transaction':_0x24eab4})['then'](function(_0x450eff){var _0x2e7a38={'sender':_0x114114[_0xc87e('0x47')],'description':_0x114114[_0xc87e('0x49')],'content':_0x114114[_0xc87e('0x31')],'beep':_0x114114[_0xc87e('0x4a')]};_0x26790d['forEach'](function(_0x45e9a5){_0x2e7a38[_0xc87e('0x52')]=_0x45e9a5;socket[_0xc87e('0x53')]('userNotification:send',_0x2e7a38);});return _0x450eff;});});})[_0xc87e('0x2b')](respondWithResult(_0x4f5af8,0xc9))[_0xc87e('0x54')](handleError(_0x4f5af8,null));};function getContent(_0x4de013){return new BPromise(function(_0x38653a,_0x55b1f2){if(_0x4de013[_0xc87e('0x33')]){_0x38653a(_0x4de013['text']);return;}return db['Template'][_0xc87e('0x55')]({'attributes':['html'],'where':{'id':_0x4de013['TemplateId']},'raw':!![]})['then'](function(_0x30c947){if(!_0x30c947)throw new db[(_0xc87e('0x35'))][(_0xc87e('0x36'))](_0xc87e('0x56'));var _0x10c0d9=Mustache['render'](_0x30c947[_0xc87e('0x57')],_0x4de013[_0xc87e('0x38')]);_0x38653a(_0x10c0d9);})[_0xc87e('0x54')](function(_0x18d41d){_0x55b1f2(_0x18d41d);});});}function getRecipients(_0x3b351a){return new BPromise(function(_0x291497,_0x1c7eb5){var _0x10fd8c=[];var _0x4263ba=[];_0x3b351a[_0xc87e('0x58')](function(_0x316850){var _0x240c4a=_[_0xc87e('0x59')](_0x316850[_0xc87e('0x45')][_0xc87e('0x46')]());if(_0x240c4a===_0xc87e('0x5a')){_0x10fd8c=_[_0xc87e('0x5b')](_0x10fd8c,_0x316850['ids']);}else{if(_[_0xc87e('0x44')](_0x240c4a,_0xc87e('0x5c')))_0x240c4a=_0x240c4a[_0xc87e('0x5d')](_0xc87e('0x5c'),_0xc87e('0x5e'));_0x316850['ids'][_0xc87e('0x58')](function(_0x2e66b6){_0x4263ba[_0xc87e('0x5f')](getAgents(_0x240c4a,_0x2e66b6));});}});return BPromise[_0xc87e('0x60')](_0x4263ba)[_0xc87e('0x2b')](function(_0x1c2152){_0x10fd8c=_['union'](_0x10fd8c,_['flatten'](_0x1c2152));_0x291497(_0x10fd8c);})[_0xc87e('0x54')](function(_0xd4e447){_0x1c7eb5(_0xd4e447);});});}function getAgents(_0x46f448,_0x1036c5){return new BPromise(function(_0x93cecd,_0x228b02){return db[_0x46f448][_0xc87e('0x55')]({'where':{'id':_0x1036c5}})[_0xc87e('0x2b')](function(_0xfa008d){return _0xfa008d[_0xc87e('0x61')]({'attributes':['id'],'raw':!![]})[_0xc87e('0x2b')](function(_0x36bd9b){var _0x2ce092=_['map'](_0x36bd9b,'id');_0x93cecd(_0x2ce092);});})[_0xc87e('0x54')](function(_0x4f6dc9){_0x228b02(_0x4f6dc9);});});}
\ No newline at end of file
+var _0xa4bd=['redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','UserNotification','create','forEach','recipient','emit','userNotification:send','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','model','union','ids','includes','queue','replace','push','all','flatten','findOne','getAgents','map','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2d2201,_0x3cfe3d){var _0x12e6cd=function(_0x5e4cf6){while(--_0x5e4cf6){_0x2d2201['push'](_0x2d2201['shift']());}};_0x12e6cd(++_0x3cfe3d);}(_0xa4bd,0x1df));var _0xda4b=function(_0x2a43d7,_0x4c05d0){_0x2a43d7=_0x2a43d7-0x0;var _0x2bb20f=_0xa4bd[_0x2a43d7];return _0x2bb20f;};'use strict';var emlformat=require(_0xda4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda4b('0x1'));var jsonpatch=require(_0xda4b('0x2'));var rp=require(_0xda4b('0x3'));var moment=require(_0xda4b('0x4'));var BPromise=require(_0xda4b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xda4b('0x6'));var csv=require(_0xda4b('0x7'));var ejs=require(_0xda4b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda4b('0x9'));var squel=require('squel');var crypto=require(_0xda4b('0xa'));var jsforce=require(_0xda4b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xda4b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xda4b('0xc'));var authService=require(_0xda4b('0xd'));var qs=require(_0xda4b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda4b('0xf'));var logger=require(_0xda4b('0x10'))(_0xda4b('0x11'));var utils=require(_0xda4b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xda4b('0x13'));var db=require(_0xda4b('0x14'))['db'];config[_0xda4b('0x15')]=_[_0xda4b('0x16')](config[_0xda4b('0x15')],{'host':_0xda4b('0x17'),'port':0x18eb});var socket=require(_0xda4b('0x18'))(new Redis(config[_0xda4b('0x15')]));require(_0xda4b('0x19'))['register'](socket);function respondWithStatusCode(_0x34c6ea,_0x1a22a2){_0x1a22a2=_0x1a22a2||0xcc;return function(_0xc1bd50){if(_0xc1bd50){return _0x34c6ea[_0xda4b('0x1a')](_0x1a22a2);}return _0x34c6ea[_0xda4b('0x1b')](_0x1a22a2)[_0xda4b('0x1c')]();};}function respondWithResult(_0x1f2578,_0x50147d){_0x50147d=_0x50147d||0xc8;return function(_0x148a75){if(_0x148a75){return _0x1f2578['status'](_0x50147d)[_0xda4b('0x1d')](_0x148a75);}};}function respondWithFilteredResult(_0x494a2d,_0x23d92d){return function(_0x4ca83f){if(_0x4ca83f){var _0x42da1c=typeof _0x23d92d['offset']===_0xda4b('0x1e')&&typeof _0x23d92d[_0xda4b('0x1f')]===_0xda4b('0x1e');var _0x631cb2=_0x4ca83f[_0xda4b('0x20')];var _0x176b5=_0x42da1c?0x0:_0x23d92d[_0xda4b('0x21')];var _0xfed404=_0x42da1c?_0x4ca83f['count']:_0x23d92d[_0xda4b('0x21')]+_0x23d92d[_0xda4b('0x1f')];var _0x3db4f5;if(_0xfed404>=_0x631cb2){_0xfed404=_0x631cb2;_0x3db4f5=0xc8;}else{_0x3db4f5=0xce;}_0x494a2d[_0xda4b('0x1b')](_0x3db4f5);return _0x494a2d[_0xda4b('0x22')](_0xda4b('0x23'),_0x176b5+'-'+_0xfed404+'/'+_0x631cb2)['json'](_0x4ca83f);}return null;};}function patchUpdates(_0x26644a){return function(_0x52b454){try{jsonpatch[_0xda4b('0x24')](_0x52b454,_0x26644a,!![]);}catch(_0x4da5d0){return BPromise[_0xda4b('0x25')](_0x4da5d0);}return _0x52b454[_0xda4b('0x26')]();};}function saveUpdates(_0x52b658,_0xecd8c3){return function(_0x1701dc){if(_0x1701dc){return _0x1701dc['update'](_0x52b658)[_0xda4b('0x27')](function(_0x482a1a){return _0x482a1a;});}return null;};}function removeEntity(_0x199012,_0x56cdc1){return function(_0x31e92e){if(_0x31e92e){return _0x31e92e[_0xda4b('0x28')]()[_0xda4b('0x27')](function(){_0x199012[_0xda4b('0x1b')](0xcc)[_0xda4b('0x1c')]();});}};}function handleEntityNotFound(_0x17567f,_0x28ba98){return function(_0x38cd73){if(!_0x38cd73){_0x17567f[_0xda4b('0x1a')](0x194);}return _0x38cd73;};}function handleError(_0x562d81,_0x5e03de){_0x5e03de=_0x5e03de||0x1f4;return function(_0x38a917){logger['error'](_0x38a917[_0xda4b('0x29')]);if(_0x38a917[_0xda4b('0x2a')]){delete _0x38a917[_0xda4b('0x2a')];}_0x562d81['status'](_0x5e03de)[_0xda4b('0x2b')](_0x38a917);};}exports[_0xda4b('0x2c')]=function(_0x53b9f3,_0x6ebfb5,_0x2321b7){if(!_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x2e')](_0xda4b('0x2f'))&&!_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x2e')](_0xda4b('0x30'))){throw new db[(_0xda4b('0x31'))]['ValidationError'](_0xda4b('0x32'));}else{if(_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x2e')](_0xda4b('0x30'))&&!_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x2e')]('view')){throw new db[(_0xda4b('0x31'))][(_0xda4b('0x33'))](_0xda4b('0x34'));}if(!_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x2e')](_0xda4b('0x35'))){throw new db['Sequelize'][(_0xda4b('0x33'))](_0xda4b('0x36'));}else{try{var _0x2d4a11=JSON[_0xda4b('0x37')](_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x35')]);}catch(_0xa7ed2d){logger[_0xda4b('0x38')](_0xa7ed2d);throw new db[(_0xda4b('0x31'))][(_0xda4b('0x33'))](_0xda4b('0x39'));}var _0x433fac=['chatqueue',_0xda4b('0x3a'),_0xda4b('0x3b'),_0xda4b('0x3c'),_0xda4b('0x3d'),_0xda4b('0x3e'),_0xda4b('0x3f'),'team',_0xda4b('0x40')];if(_[_0xda4b('0x41')](_0x2d4a11,function(_0x46a110){return!_['includes'](_0x433fac,_0x46a110['model'][_0xda4b('0x42')]());})){throw new db[(_0xda4b('0x31'))][(_0xda4b('0x33'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x54d6b0={};_0x54d6b0[_0xda4b('0x43')]=_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x2e')](_0xda4b('0x43'))?_0x53b9f3['body'][_0xda4b('0x43')]:_0x53b9f3[_0xda4b('0x40')][_0xda4b('0x44')];_0x54d6b0['recipientsDescription']=_[_0xda4b('0x45')](_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x46')])?null:_0x53b9f3[_0xda4b('0x2d')]['recipientsDescription'];_0x54d6b0[_0xda4b('0x47')]=_0x53b9f3[_0xda4b('0x2d')][_0xda4b('0x47')]||![];_0x54d6b0[_0xda4b('0x48')]=_0x53b9f3['user']['id'];return getContent(_0x53b9f3['body'])[_0xda4b('0x27')](function(_0x5ed012){_0x54d6b0[_0xda4b('0x2d')]=_0x5ed012;return getRecipients(_0x2d4a11);})['then'](function(_0x422c06){_0x54d6b0[_0xda4b('0x49')]=_['sortBy'](_0x422c06)[_0xda4b('0x4a')](',');return db['sequelize']['transaction'](function(_0x3f75ec){return db[_0xda4b('0x4b')][_0xda4b('0x4c')](_0x54d6b0,{'raw':!![],'transaction':_0x3f75ec})['then'](function(_0xcf15a8){var _0x50e502={'sender':_0x54d6b0['senderName'],'description':_0x54d6b0['recipientsDescription'],'content':_0x54d6b0[_0xda4b('0x2d')],'beep':_0x54d6b0['beep']};_0x422c06[_0xda4b('0x4d')](function(_0x56c395){_0x50e502[_0xda4b('0x4e')]=_0x56c395;socket[_0xda4b('0x4f')](_0xda4b('0x50'),_0x50e502);});return _0xcf15a8;});});})[_0xda4b('0x27')](respondWithResult(_0x6ebfb5,0xc9))['catch'](handleError(_0x6ebfb5,null));};function getContent(_0x2d71f3){return new BPromise(function(_0x1f17f5,_0x26b9bb){if(_0x2d71f3[_0xda4b('0x2f')]){_0x1f17f5(_0x2d71f3[_0xda4b('0x2f')]);return;}return db[_0xda4b('0x51')]['findOne']({'attributes':[_0xda4b('0x52')],'where':{'id':_0x2d71f3[_0xda4b('0x30')]},'raw':!![]})['then'](function(_0x56ea35){if(!_0x56ea35)throw new db[(_0xda4b('0x31'))][(_0xda4b('0x33'))](_0xda4b('0x53'));var _0x3eecf6=Mustache[_0xda4b('0x54')](_0x56ea35[_0xda4b('0x52')],_0x2d71f3[_0xda4b('0x55')]);_0x1f17f5(_0x3eecf6);})['catch'](function(_0x33db99){_0x26b9bb(_0x33db99);});});}function getRecipients(_0x537229){return new BPromise(function(_0x82a034,_0x242e50){var _0x53ea7b=[];var _0x54c573=[];_0x537229[_0xda4b('0x4d')](function(_0x4b4942){var _0x28baa6=_[_0xda4b('0x56')](_0x4b4942[_0xda4b('0x57')][_0xda4b('0x42')]());if(_0x28baa6==='User'){_0x53ea7b=_[_0xda4b('0x58')](_0x53ea7b,_0x4b4942[_0xda4b('0x59')]);}else{if(_[_0xda4b('0x5a')](_0x28baa6,_0xda4b('0x5b')))_0x28baa6=_0x28baa6[_0xda4b('0x5c')](_0xda4b('0x5b'),'Queue');_0x4b4942['ids'][_0xda4b('0x4d')](function(_0x10df6c){_0x54c573[_0xda4b('0x5d')](getAgents(_0x28baa6,_0x10df6c));});}});return BPromise[_0xda4b('0x5e')](_0x54c573)[_0xda4b('0x27')](function(_0x4b1efc){_0x53ea7b=_['union'](_0x53ea7b,_[_0xda4b('0x5f')](_0x4b1efc));_0x82a034(_0x53ea7b);})['catch'](function(_0x73f6c0){_0x242e50(_0x73f6c0);});});}function getAgents(_0x3b6bf6,_0x5cffa4){return new BPromise(function(_0x1ecd6b,_0x32be07){return db[_0x3b6bf6][_0xda4b('0x60')]({'where':{'id':_0x5cffa4}})['then'](function(_0x2aa07d){return _0x2aa07d[_0xda4b('0x61')]({'attributes':['id'],'raw':!![]})[_0xda4b('0x27')](function(_0x36e88f){var _0x2c22e6=_[_0xda4b('0x62')](_0x36e88f,'id');_0x1ecd6b(_0x2c22e6);});})[_0xda4b('0x63')](function(_0x3c41bc){_0x32be07(_0x3c41bc);});});}
\ No newline at end of file
index 4652a07..ac68868 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21f7=['exports','events','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x21f7,0x121));var _0x721f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x21f7[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x721f('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x721f('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x721f('0x2')](0x0);var events={'afterCreate':_0x721f('0x3'),'afterUpdate':'update','afterDestroy':_0x721f('0x4')};function emitEvent(_0x4d4f62){return function(_0x318ca4,_0xed5d06,_0x100f90){UserNotificationEvents[_0x721f('0x5')](_0x4d4f62+':'+_0x318ca4['id'],_0x318ca4);UserNotificationEvents['emit'](_0x4d4f62,_0x318ca4);_0x100f90(null);};}for(var e in events){if(events[_0x721f('0x6')](e)){var event=events[e];UserNotification[_0x721f('0x7')](e,emitEvent(event));}}module[_0x721f('0x8')]=UserNotificationEvents;
\ No newline at end of file
+var _0xba9e=['exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x45d6cb,_0x349309){var _0x4120bf=function(_0x3aaab6){while(--_0x3aaab6){_0x45d6cb['push'](_0x45d6cb['shift']());}};_0x4120bf(++_0x349309);}(_0xba9e,0x6f));var _0xeba9=function(_0x559922,_0x4d95c2){_0x559922=_0x559922-0x0;var _0x40e044=_0xba9e[_0x559922];return _0x40e044;};'use strict';var EventEmitter=require(_0xeba9('0x0'));var UserNotification=require(_0xeba9('0x1'))['db'][_0xeba9('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xeba9('0x3')](0x0);var events={'afterCreate':_0xeba9('0x4'),'afterUpdate':_0xeba9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25fef5){return function(_0x407478,_0x2f7fb1,_0x2a9399){UserNotificationEvents[_0xeba9('0x6')](_0x25fef5+':'+_0x407478['id'],_0x407478);UserNotificationEvents['emit'](_0x25fef5,_0x407478);_0x2a9399(null);};}for(var e in events){if(events[_0xeba9('0x7')](e)){var event=events[e];UserNotification[_0xeba9('0x8')](e,emitEvent(event));}}module[_0xeba9('0x9')]=UserNotificationEvents;
\ No newline at end of file
index 25060c6..c2809c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ea6=['request-promise','path','rimraf','define','UserNotification','userNotifications','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc1c184,_0x29966d){var _0x124ac6=function(_0x44ca80){while(--_0x44ca80){_0xc1c184['push'](_0xc1c184['shift']());}};_0x124ac6(++_0x29966d);}(_0x7ea6,0x72));var _0x67ea=function(_0x2716c3,_0x4cc7c5){_0x2716c3=_0x2716c3-0x0;var _0x2fb080=_0x7ea6[_0x2716c3];return _0x2fb080;};'use strict';var _=require(_0x67ea('0x0'));var util=require(_0x67ea('0x1'));var logger=require(_0x67ea('0x2'))(_0x67ea('0x3'));var moment=require(_0x67ea('0x4'));var BPromise=require(_0x67ea('0x5'));var rp=require(_0x67ea('0x6'));var fs=require('fs');var path=require(_0x67ea('0x7'));var rimraf=require(_0x67ea('0x8'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x53aade,_0x133a30){return _0x53aade[_0x67ea('0x9')](_0x67ea('0xa'),attributes,{'tableName':_0x67ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x1e00=['request-promise','rimraf','../../config/environment','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','moment'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0x1e00,0xa9));var _0x01e0=function(_0x118547,_0x180993){_0x118547=_0x118547-0x0;var _0x94afb=_0x1e00[_0x118547];return _0x94afb;};'use strict';var _=require(_0x01e0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x01e0('0x1'));var BPromise=require('bluebird');var rp=require(_0x01e0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01e0('0x3'));var config=require(_0x01e0('0x4'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x2340e9,_0x3ac7d6){return _0x2340e9['define'](_0x01e0('0x5'),attributes,{'tableName':_0x01e0('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01e0('0x7'),'collate':_0x01e0('0x8')});};
\ No newline at end of file
index e3046a2..800c22c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1262=['UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1ebc11,_0xaeefe8){var _0x27757b=function(_0x2b4755){while(--_0x2b4755){_0x1ebc11['push'](_0x1ebc11['shift']());}};_0x27757b(++_0xaeefe8);}(_0x1262,0xa1));var _0x2126=function(_0x640033,_0x298768){_0x640033=_0x640033-0x0;var _0x1c39bc=_0x1262[_0x640033];return _0x1c39bc;};'use strict';var _=require(_0x2126('0x0'));var util=require(_0x2126('0x1'));var moment=require('moment');var BPromise=require(_0x2126('0x2'));var rs=require(_0x2126('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2126('0x4'))['db'];var utils=require(_0x2126('0x5'));var logger=require(_0x2126('0x6'))(_0x2126('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2126('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2126('0x9')](config[_0x2126('0xa')],{'host':_0x2126('0xb'),'port':0x18eb});var socket=require(_0x2126('0xc'))(new Redis(config[_0x2126('0xa')]));require(_0x2126('0xd'))[_0x2126('0xe')](socket);function respondWithRpcPromise(_0x4303ea,_0x1fbf9d,_0x992824){return new BPromise(function(_0x504d65,_0x304185){return client[_0x2126('0xf')](_0x4303ea,_0x992824)['then'](function(_0x3c7495){logger['info']('UserNotification,\x20%s,\x20%s',_0x1fbf9d,_0x2126('0x10'));logger['debug'](_0x2126('0x11'),_0x1fbf9d,_0x2126('0x10'),JSON[_0x2126('0x12')](_0x3c7495));if(_0x3c7495[_0x2126('0x13')]){if(_0x3c7495['error'][_0x2126('0x14')]===0x1f4){logger[_0x2126('0x13')](_0x2126('0x15'),_0x1fbf9d,_0x3c7495['error'][_0x2126('0x16')]);return _0x304185(_0x3c7495[_0x2126('0x13')][_0x2126('0x16')]);}logger[_0x2126('0x13')]('UserNotification,\x20%s,\x20%s',_0x1fbf9d,_0x3c7495['error']['message']);return _0x504d65(_0x3c7495[_0x2126('0x13')][_0x2126('0x16')]);}else{logger[_0x2126('0x17')]('UserNotification,\x20%s,\x20%s',_0x1fbf9d,_0x2126('0x10'));_0x504d65(_0x3c7495[_0x2126('0x18')][_0x2126('0x16')]);}})[_0x2126('0x19')](function(_0x3e8674){logger[_0x2126('0x13')](_0x2126('0x15'),_0x1fbf9d,_0x3e8674);_0x304185(_0x3e8674);});});}
\ No newline at end of file
+var _0x2c54=['code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a3a4c,_0x50e07b){var _0x8054c0=function(_0x504e18){while(--_0x504e18){_0x1a3a4c['push'](_0x1a3a4c['shift']());}};_0x8054c0(++_0x50e07b);}(_0x2c54,0x16b));var _0x42c5=function(_0x1664cb,_0x57a951){_0x1664cb=_0x1664cb-0x0;var _0x4edd61=_0x2c54[_0x1664cb];return _0x4edd61;};'use strict';var _=require('lodash');var util=require(_0x42c5('0x0'));var moment=require('moment');var BPromise=require(_0x42c5('0x1'));var rs=require(_0x42c5('0x2'));var fs=require('fs');var Redis=require(_0x42c5('0x3'));var db=require(_0x42c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x42c5('0x5'))(_0x42c5('0x6'));var config=require(_0x42c5('0x7'));var jayson=require(_0x42c5('0x8'));var client=jayson[_0x42c5('0x9')][_0x42c5('0xa')]({'port':0x232a});config[_0x42c5('0xb')]=_[_0x42c5('0xc')](config[_0x42c5('0xb')],{'host':_0x42c5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42c5('0xb')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x54f164,_0x39b641,_0x22e225){return new BPromise(function(_0x4dc8e2,_0x18552b){return client[_0x42c5('0xe')](_0x54f164,_0x22e225)['then'](function(_0x22d547){logger[_0x42c5('0xf')](_0x42c5('0x10'),_0x39b641,_0x42c5('0x11'));logger['debug'](_0x42c5('0x12'),_0x39b641,_0x42c5('0x11'),JSON[_0x42c5('0x13')](_0x22d547));if(_0x22d547[_0x42c5('0x14')]){if(_0x22d547['error'][_0x42c5('0x15')]===0x1f4){logger['error'](_0x42c5('0x10'),_0x39b641,_0x22d547[_0x42c5('0x14')][_0x42c5('0x16')]);return _0x18552b(_0x22d547[_0x42c5('0x14')][_0x42c5('0x16')]);}logger['error'](_0x42c5('0x10'),_0x39b641,_0x22d547['error'][_0x42c5('0x16')]);return _0x4dc8e2(_0x22d547[_0x42c5('0x14')][_0x42c5('0x16')]);}else{logger[_0x42c5('0xf')]('UserNotification,\x20%s,\x20%s',_0x39b641,_0x42c5('0x11'));_0x4dc8e2(_0x22d547['result'][_0x42c5('0x16')]);}})[_0x42c5('0x17')](function(_0x57be15){logger[_0x42c5('0x14')](_0x42c5('0x10'),_0x39b641,_0x57be15);_0x18552b(_0x57be15);});});}
\ No newline at end of file
index f8c402e..9a4a311 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92a6=['save','remove','update','emit','register','length','./userNotification.events'];(function(_0x84db0e,_0x3e0083){var _0x19f095=function(_0x1c959c){while(--_0x1c959c){_0x84db0e['push'](_0x84db0e['shift']());}};_0x19f095(++_0x3e0083);}(_0x92a6,0x117));var _0x692a=function(_0x4c2711,_0x28ba27){_0x4c2711=_0x4c2711-0x0;var _0x405be4=_0x92a6[_0x4c2711];return _0x405be4;};'use strict';var UserNotificationEvents=require(_0x692a('0x0'));var events=[_0x692a('0x1'),_0x692a('0x2'),_0x692a('0x3')];function createListener(_0x4aec12,_0x2ef64f){return function(_0x3efd12){_0x2ef64f[_0x692a('0x4')](_0x4aec12,_0x3efd12);};}function removeListener(_0x25e489,_0x39c3a0){return function(){UserNotificationEvents['removeListener'](_0x25e489,_0x39c3a0);};}exports[_0x692a('0x5')]=function(_0x3a1db4){for(var _0x17df29=0x0,_0x433ca1=events[_0x692a('0x6')];_0x17df29<_0x433ca1;_0x17df29++){var _0x25ddb8=events[_0x17df29];var _0x39e8fc=createListener('userNotification:'+_0x25ddb8,_0x3a1db4);UserNotificationEvents['on'](_0x25ddb8,_0x39e8fc);}};
\ No newline at end of file
+var _0x60e6=['update','userNotification:','./userNotification.events','save','remove'];(function(_0x447455,_0x206d8c){var _0x305cf3=function(_0x3738a2){while(--_0x3738a2){_0x447455['push'](_0x447455['shift']());}};_0x305cf3(++_0x206d8c);}(_0x60e6,0xac));var _0x660e=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x60e6[_0x1bc013];return _0x55df36;};'use strict';var UserNotificationEvents=require(_0x660e('0x0'));var events=[_0x660e('0x1'),_0x660e('0x2'),_0x660e('0x3')];function createListener(_0x5959f9,_0x106f1f){return function(_0x8eef07){_0x106f1f['emit'](_0x5959f9,_0x8eef07);};}function removeListener(_0x301bde,_0x51fd40){return function(){UserNotificationEvents['removeListener'](_0x301bde,_0x51fd40);};}exports['register']=function(_0x4c9b51){for(var _0x4ff76f=0x0,_0x3f8c86=events['length'];_0x4ff76f<_0x3f8c86;_0x4ff76f++){var _0x28a300=events[_0x4ff76f];var _0x21434b=createListener(_0x660e('0x4')+_0x28a300,_0x4c9b51);UserNotificationEvents['on'](_0x28a300,_0x21434b);}};
\ No newline at end of file
index c272595..13f64ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x8b3288,_0x18f349){var _0x465281=function(_0x5ba1d4){while(--_0x5ba1d4){_0x8b3288['push'](_0x8b3288['shift']());}};_0x465281(++_0x18f349);}(_0x70e0,0x17b));var _0x070e=function(_0x3bf0e5,_0x22488b){_0x3bf0e5=_0x3bf0e5-0x0;var _0x379975=_0x70e0[_0x3bf0e5];return _0x379975;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2bc2a2,_0x51e95f){var _0x20de67=function(_0x27f2d2){while(--_0x27f2d2){_0x2bc2a2['push'](_0x2bc2a2['shift']());}};_0x20de67(++_0x51e95f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index 3b86765..dd6efb3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45fd=['exports','INTEGER'];(function(_0x5555eb,_0xd55f90){var _0x2ea319=function(_0x48af2e){while(--_0x48af2e){_0x5555eb['push'](_0x5555eb['shift']());}};_0x2ea319(++_0xd55f90);}(_0x45fd,0xa4));var _0xd45f=function(_0x159225,_0x167ace){_0x159225=_0x159225-0x0;var _0x117fcf=_0x45fd[_0x159225];return _0x117fcf;};'use strict';var Sequelize=require('sequelize');module[_0xd45f('0x0')]={'penalty':{'type':Sequelize[_0xd45f('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x9ac8=['INTEGER','sequelize','exports'];(function(_0x3ecb01,_0x2a127f){var _0x2dcef4=function(_0x284910){while(--_0x284910){_0x3ecb01['push'](_0x3ecb01['shift']());}};_0x2dcef4(++_0x2a127f);}(_0x9ac8,0x184));var _0x89ac=function(_0x507acf,_0x3ad8fb){_0x507acf=_0x507acf-0x0;var _0x43baad=_0x9ac8[_0x507acf];return _0x43baad;};'use strict';var Sequelize=require(_0x89ac('0x0'));module[_0x89ac('0x1')]={'penalty':{'type':Sequelize[_0x89ac('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index c8fe199..ed973f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a9e=['path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api','request-promise'];(function(_0x36b261,_0x504c02){var _0x2cf069=function(_0x2d61cc){while(--_0x2d61cc){_0x36b261['push'](_0x36b261['shift']());}};_0x2cf069(++_0x504c02);}(_0x5a9e,0x15a));var _0xe5a9=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0x5a9e[_0x469ac7];return _0x22f3b0;};'use strict';var _=require(_0xe5a9('0x0'));var util=require('util');var logger=require(_0xe5a9('0x1'))(_0xe5a9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe5a9('0x3'));var fs=require('fs');var path=require(_0xe5a9('0x4'));var rimraf=require('rimraf');var config=require(_0xe5a9('0x5'));var attributes=require(_0xe5a9('0x6'));module[_0xe5a9('0x7')]=function(_0x1ca71c,_0x41925c){return _0x1ca71c[_0xe5a9('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0xe5a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7f3d=['user_has_openchannel_queues','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue'];(function(_0x53287e,_0x4f4c6d){var _0x3e4467=function(_0xc0812){while(--_0xc0812){_0x53287e['push'](_0x53287e['shift']());}};_0x3e4467(++_0x4f4c6d);}(_0x7f3d,0x14b));var _0xd7f3=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x7f3d[_0x2cfb48];return _0xc4594f;};'use strict';var _=require(_0xd7f3('0x0'));var util=require('util');var logger=require(_0xd7f3('0x1'))(_0xd7f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd7f3('0x3'));var fs=require('fs');var path=require(_0xd7f3('0x4'));var rimraf=require(_0xd7f3('0x5'));var config=require(_0xd7f3('0x6'));var attributes=require(_0xd7f3('0x7'));module[_0xd7f3('0x8')]=function(_0x2b2606,_0x46c81e){return _0x2b2606['define'](_0xd7f3('0x9'),attributes,{'tableName':_0xd7f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c82f286..9aca711 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d63=['error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c6e54,_0x413139){var _0x4cc87c=function(_0x12365b){while(--_0x12365b){_0x1c6e54['push'](_0x1c6e54['shift']());}};_0x4cc87c(++_0x413139);}(_0x6d63,0x1a7));var _0x36d6=function(_0x31b24e,_0x18041c){_0x31b24e=_0x31b24e-0x0;var _0xd7f411=_0x6d63[_0x31b24e];return _0xd7f411;};'use strict';var _=require(_0x36d6('0x0'));var util=require(_0x36d6('0x1'));var moment=require(_0x36d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x36d6('0x3'));var fs=require('fs');var Redis=require(_0x36d6('0x4'));var db=require(_0x36d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36d6('0x6'))(_0x36d6('0x7'));var config=require(_0x36d6('0x8'));var jayson=require(_0x36d6('0x9'));var client=jayson[_0x36d6('0xa')][_0x36d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xed71bc,_0x2128b1,_0xa92624){return new BPromise(function(_0x588be6,_0x12de7f){return client['request'](_0xed71bc,_0xa92624)['then'](function(_0x978637){logger[_0x36d6('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2128b1,_0x36d6('0xd'));logger[_0x36d6('0xe')](_0x36d6('0xf'),_0x2128b1,_0x36d6('0xd'),JSON[_0x36d6('0x10')](_0x978637));if(_0x978637[_0x36d6('0x11')]){if(_0x978637[_0x36d6('0x11')][_0x36d6('0x12')]===0x1f4){logger[_0x36d6('0x11')](_0x36d6('0x13'),_0x2128b1,_0x978637[_0x36d6('0x11')][_0x36d6('0x14')]);return _0x12de7f(_0x978637[_0x36d6('0x11')][_0x36d6('0x14')]);}logger[_0x36d6('0x11')](_0x36d6('0x13'),_0x2128b1,_0x978637[_0x36d6('0x11')][_0x36d6('0x14')]);return _0x588be6(_0x978637[_0x36d6('0x11')][_0x36d6('0x14')]);}else{logger['info'](_0x36d6('0x13'),_0x2128b1,_0x36d6('0xd'));_0x588be6(_0x978637['result'][_0x36d6('0x14')]);}})[_0x36d6('0x15')](function(_0x2d3163){logger[_0x36d6('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2128b1,_0x2d3163);_0x12de7f(_0x2d3163);});});}
\ No newline at end of file
+var _0x652a=['error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x652a,0xc2));var _0xa652=function(_0x5ff364,_0x5243d4){_0x5ff364=_0x5ff364-0x0;var _0x29e72e=_0x652a[_0x5ff364];return _0x29e72e;};'use strict';var _=require(_0xa652('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa652('0x1'));var rs=require(_0xa652('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa652('0x3'));var logger=require(_0xa652('0x4'))(_0xa652('0x5'));var config=require('../../config/environment');var jayson=require(_0xa652('0x6'));var client=jayson[_0xa652('0x7')][_0xa652('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a89b6,_0x1f97b8,_0x1b92a6){return new BPromise(function(_0x1ebfb1,_0x474d1d){return client[_0xa652('0x9')](_0x5a89b6,_0x1b92a6)[_0xa652('0xa')](function(_0x19dc97){logger[_0xa652('0xb')](_0xa652('0xc'),_0x1f97b8,'request\x20sent');logger['debug'](_0xa652('0xd'),_0x1f97b8,_0xa652('0xe'),JSON[_0xa652('0xf')](_0x19dc97));if(_0x19dc97[_0xa652('0x10')]){if(_0x19dc97['error'][_0xa652('0x11')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f97b8,_0x19dc97[_0xa652('0x10')][_0xa652('0x12')]);return _0x474d1d(_0x19dc97['error']['message']);}logger[_0xa652('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f97b8,_0x19dc97[_0xa652('0x10')]['message']);return _0x1ebfb1(_0x19dc97['error'][_0xa652('0x12')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f97b8,_0xa652('0xe'));_0x1ebfb1(_0x19dc97[_0xa652('0x13')][_0xa652('0x12')]);}})[_0xa652('0x14')](function(_0x496158){logger[_0xa652('0x10')](_0xa652('0xc'),_0x1f97b8,_0x496158);_0x474d1d(_0x496158);});});}
\ No newline at end of file
index 4766e09..3be9737 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28dc=['/:id/resources','post','create','/:id/clone','clone','addSections','put','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','/describe','describe','get','show','/:id/sections','getSections'];(function(_0x9b95ab,_0x2e2f67){var _0x589def=function(_0x180d23){while(--_0x180d23){_0x9b95ab['push'](_0x9b95ab['shift']());}};_0x589def(++_0x2e2f67);}(_0x28dc,0xe6));var _0xc28d=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x28dc[_0x3fe042];return _0x7d4a1f;};'use strict';var multer=require('multer');var util=require(_0xc28d('0x0'));var path=require(_0xc28d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc28d('0x2'));var interaction=require(_0xc28d('0x3'));var config=require('../../config/environment');var controller=require(_0xc28d('0x4'));router['get']('/',auth[_0xc28d('0x5')](),controller[_0xc28d('0x6')]);router['get'](_0xc28d('0x7'),auth[_0xc28d('0x5')](),controller[_0xc28d('0x8')]);router[_0xc28d('0x9')]('/:id',auth[_0xc28d('0x5')](),controller[_0xc28d('0xa')]);router[_0xc28d('0x9')](_0xc28d('0xb'),auth['isAuthenticated'](),controller[_0xc28d('0xc')]);router[_0xc28d('0x9')](_0xc28d('0xd'),auth[_0xc28d('0x5')](),controller['getResources']);router[_0xc28d('0xe')]('/',auth[_0xc28d('0x5')](),controller[_0xc28d('0xf')]);router[_0xc28d('0xe')](_0xc28d('0x10'),auth[_0xc28d('0x5')](),controller[_0xc28d('0x11')]);router['post'](_0xc28d('0xb'),auth[_0xc28d('0x5')](),controller[_0xc28d('0x12')]);router['post'](_0xc28d('0xd'),auth[_0xc28d('0x5')](),controller['addResources']);router[_0xc28d('0x13')](_0xc28d('0x14'),auth['isAuthenticated'](),controller[_0xc28d('0x15')]);router[_0xc28d('0x16')](_0xc28d('0x14'),auth['isAuthenticated'](),controller[_0xc28d('0x17')]);router['delete'](_0xc28d('0xb'),auth['isAuthenticated'](),controller[_0xc28d('0x18')]);router[_0xc28d('0x16')]('/:id/resources',auth[_0xc28d('0x5')](),controller[_0xc28d('0x19')]);module[_0xc28d('0x1a')]=router;
\ No newline at end of file
+var _0x2e29=['removeResources','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sections','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','/:id/resources'];(function(_0x257544,_0x524c55){var _0x589d7d=function(_0x120396){while(--_0x120396){_0x257544['push'](_0x257544['shift']());}};_0x589d7d(++_0x524c55);}(_0x2e29,0xda));var _0x92e2=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x2e29[_0x39096d];return _0x13da4f;};'use strict';var multer=require('multer');var util=require(_0x92e2('0x0'));var path=require(_0x92e2('0x1'));var timeout=require(_0x92e2('0x2'));var express=require(_0x92e2('0x3'));var router=express['Router']();var fs_extra=require(_0x92e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92e2('0x5'));var config=require(_0x92e2('0x6'));var controller=require('./userProfile.controller');router[_0x92e2('0x7')]('/',auth[_0x92e2('0x8')](),controller['index']);router[_0x92e2('0x7')]('/describe',auth[_0x92e2('0x8')](),controller['describe']);router[_0x92e2('0x7')](_0x92e2('0x9'),auth['isAuthenticated'](),controller[_0x92e2('0xa')]);router[_0x92e2('0x7')](_0x92e2('0xb'),auth['isAuthenticated'](),controller['getSections']);router[_0x92e2('0x7')]('/:id/resources',auth[_0x92e2('0x8')](),controller['getResources']);router[_0x92e2('0xc')]('/',auth[_0x92e2('0x8')](),controller[_0x92e2('0xd')]);router[_0x92e2('0xc')](_0x92e2('0xe'),auth[_0x92e2('0x8')](),controller[_0x92e2('0xf')]);router['post'](_0x92e2('0xb'),auth[_0x92e2('0x8')](),controller[_0x92e2('0x10')]);router['post']('/:id/resources',auth[_0x92e2('0x8')](),controller['addResources']);router[_0x92e2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x92e2('0x12')]);router[_0x92e2('0x13')](_0x92e2('0x9'),auth[_0x92e2('0x8')](),controller[_0x92e2('0x14')]);router['delete'](_0x92e2('0xb'),auth[_0x92e2('0x8')](),controller['removeSections']);router['delete'](_0x92e2('0x15'),auth[_0x92e2('0x8')](),controller[_0x92e2('0x16')]);module[_0x92e2('0x17')]=router;
\ No newline at end of file
index 05f4157..8b0bc6c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84e0=['join','getDataValue','BOOLEAN','sequelize','exports','name','STRING','crudPermissions'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x84e0,0x1f3));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x084e('0x0'));module[_0x084e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x084e('0x2')},'crudPermissions':{'type':Sequelize[_0x084e('0x3')],'set':function(_0x393c25){this['setDataValue'](_0x084e('0x4'),_0x393c25?_0x393c25[_0x084e('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x084e('0x4'))?this[_0x084e('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x084e('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x084e('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x084e('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x084e('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x084e('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x084e('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x084e('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x084e('0x7')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xbb86=['name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','STRING'];(function(_0x36930d,_0x5adae5){var _0x34e91f=function(_0x1a6e87){while(--_0x1a6e87){_0x36930d['push'](_0x36930d['shift']());}};_0x34e91f(++_0x5adae5);}(_0xbb86,0x13f));var _0x6bb8=function(_0x244706,_0x225097){_0x244706=_0x244706-0x0;var _0x286e3e=_0xbb86[_0x244706];return _0x286e3e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6bb8('0x0')],'allowNull':![],'unique':_0x6bb8('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4cd9d6){this[_0x6bb8('0x2')]('crudPermissions',_0x4cd9d6?_0x4cd9d6[_0x6bb8('0x3')](''):[]);},'get':function(){return this[_0x6bb8('0x4')](_0x6bb8('0x5'))?this[_0x6bb8('0x4')](_0x6bb8('0x5'))[_0x6bb8('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6bb8('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6bb8('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6bb8('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6bb8('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6bb8('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6bb8('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6bb8('0x7')],'defaultValue':!![]}};
\ No newline at end of file
index 711d75c..1ae92d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x05d0=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','send','index','map','UserProfile','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','clone','find','get','omit','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','createdAt','sectionId','userProfileId','Resources','describe','addSections','each','push','removeSections','destroy','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','status','end'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0x05d0,0xcc));var _0x005d=function(_0x363d89,_0xce001d){_0x363d89=_0x363d89-0x0;var _0x4e2cdf=_0x05d0[_0x363d89];return _0x4e2cdf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x005d('0x0'));var zipdir=require(_0x005d('0x1'));var jsonpatch=require(_0x005d('0x2'));var rp=require(_0x005d('0x3'));var moment=require('moment');var BPromise=require(_0x005d('0x4'));var Mustache=require(_0x005d('0x5'));var util=require(_0x005d('0x6'));var path=require(_0x005d('0x7'));var sox=require(_0x005d('0x8'));var csv=require(_0x005d('0x9'));var ejs=require(_0x005d('0xa'));var fs=require('fs');var fs_extra=require(_0x005d('0xb'));var _=require(_0x005d('0xc'));var squel=require(_0x005d('0xd'));var crypto=require(_0x005d('0xe'));var jsforce=require(_0x005d('0xf'));var deskjs=require(_0x005d('0x10'));var toCsv=require(_0x005d('0x9'));var querystring=require(_0x005d('0x11'));var Papa=require(_0x005d('0x12'));var Redis=require('ioredis');var authService=require(_0x005d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x005d('0x14'));var logger=require(_0x005d('0x15'))('api');var utils=require(_0x005d('0x16'));var config=require(_0x005d('0x17'));var licenseUtil=require(_0x005d('0x18'));var db=require(_0x005d('0x19'))['db'];config[_0x005d('0x1a')]=_[_0x005d('0x1b')](config[_0x005d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x005d('0x1c'))(new Redis(config[_0x005d('0x1a')]));require(_0x005d('0x1d'))['register'](socket);function respondWithStatusCode(_0x20147d,_0x408287){_0x408287=_0x408287||0xcc;return function(_0xf4ec9e){if(_0xf4ec9e){return _0x20147d['sendStatus'](_0x408287);}return _0x20147d[_0x005d('0x1e')](_0x408287)[_0x005d('0x1f')]();};}function respondWithResult(_0x3f0968,_0x43cfe1){_0x43cfe1=_0x43cfe1||0xc8;return function(_0x21f158){if(_0x21f158){return _0x3f0968[_0x005d('0x1e')](_0x43cfe1)[_0x005d('0x20')](_0x21f158);}};}function respondWithFilteredResult(_0x1ef5ba,_0x13493a){return function(_0x247f12){if(_0x247f12){var _0x48d5cd=typeof _0x13493a[_0x005d('0x21')]===_0x005d('0x22')&&typeof _0x13493a[_0x005d('0x23')]===_0x005d('0x22');var _0xeeedc=_0x247f12[_0x005d('0x24')];var _0x57280b=_0x48d5cd?0x0:_0x13493a[_0x005d('0x21')];var _0x3b7760=_0x48d5cd?_0x247f12[_0x005d('0x24')]:_0x13493a[_0x005d('0x21')]+_0x13493a['limit'];var _0x280bc8;if(_0x3b7760>=_0xeeedc){_0x3b7760=_0xeeedc;_0x280bc8=0xc8;}else{_0x280bc8=0xce;}_0x1ef5ba[_0x005d('0x1e')](_0x280bc8);return _0x1ef5ba[_0x005d('0x25')](_0x005d('0x26'),_0x57280b+'-'+_0x3b7760+'/'+_0xeeedc)['json'](_0x247f12);}return null;};}function patchUpdates(_0x130f97){return function(_0x4996ae){try{jsonpatch[_0x005d('0x27')](_0x4996ae,_0x130f97,!![]);}catch(_0x2dc5d7){return BPromise[_0x005d('0x28')](_0x2dc5d7);}return _0x4996ae[_0x005d('0x29')]();};}function saveUpdates(_0x2a7e1b,_0x5d8a70){return function(_0xc207b8){if(_0xc207b8){return _0xc207b8[_0x005d('0x2a')](_0x2a7e1b)[_0x005d('0x2b')](function(_0x2f3daf){return _0x2f3daf;});}return null;};}function removeEntity(_0x28cf28,_0x3a25ea){return function(_0x1ab0fc){if(_0x1ab0fc){return _0x1ab0fc['destroy']()['then'](function(){_0x28cf28[_0x005d('0x1e')](0xcc)[_0x005d('0x1f')]();});}};}function handleEntityNotFound(_0x2ab313,_0x8c79ee){return function(_0x18eed1){if(!_0x18eed1){_0x2ab313[_0x005d('0x2c')](0x194);}return _0x18eed1;};}function handleError(_0x43fd9c,_0xb9c7ab){_0xb9c7ab=_0xb9c7ab||0x1f4;return function(_0x274f79){logger[_0x005d('0x2d')](_0x274f79['stack']);if(_0x274f79['name']){delete _0x274f79['name'];}_0x43fd9c[_0x005d('0x1e')](_0xb9c7ab)[_0x005d('0x2e')](_0x274f79);};}exports[_0x005d('0x2f')]=function(_0x4ae54e,_0x4fe09b){var _0x20d04a={},_0x33159d={},_0xfd1907={'count':0x0,'rows':[]};var _0x59c9c7=_[_0x005d('0x30')](db[_0x005d('0x31')][_0x005d('0x32')],function(_0x3556f7){return{'name':_0x3556f7[_0x005d('0x33')],'type':_0x3556f7['type'][_0x005d('0x34')]};});_0x33159d[_0x005d('0x35')]=_[_0x005d('0x30')](_0x59c9c7,_0x005d('0x36'));_0x33159d[_0x005d('0x37')]=_[_0x005d('0x38')](_0x4ae54e[_0x005d('0x37')]);_0x33159d[_0x005d('0x39')]=_[_0x005d('0x3a')](_0x33159d[_0x005d('0x35')],_0x33159d[_0x005d('0x37')]);_0x20d04a[_0x005d('0x3b')]=_[_0x005d('0x3a')](_0x33159d['model'],qs[_0x005d('0x3c')](_0x4ae54e[_0x005d('0x37')]['fields']));_0x20d04a[_0x005d('0x3b')]=_0x20d04a[_0x005d('0x3b')][_0x005d('0x3d')]?_0x20d04a[_0x005d('0x3b')]:_0x33159d[_0x005d('0x35')];if(!_0x4ae54e[_0x005d('0x37')]['hasOwnProperty']('nolimit')){_0x20d04a[_0x005d('0x23')]=qs['limit'](_0x4ae54e[_0x005d('0x37')]['limit']);_0x20d04a['offset']=qs[_0x005d('0x21')](_0x4ae54e[_0x005d('0x37')][_0x005d('0x21')]);}_0x20d04a['order']=qs[_0x005d('0x3e')](_0x4ae54e[_0x005d('0x37')]['sort']);_0x20d04a[_0x005d('0x3f')]=qs[_0x005d('0x39')](_[_0x005d('0x40')](_0x4ae54e[_0x005d('0x37')],_0x33159d[_0x005d('0x39')]),_0x59c9c7);if(_0x4ae54e[_0x005d('0x37')]['filter']){_0x20d04a[_0x005d('0x3f')]=_[_0x005d('0x41')](_0x20d04a['where'],{'$or':_[_0x005d('0x30')](_0x59c9c7,function(_0x589d8a){if(_0x589d8a[_0x005d('0x42')]!==_0x005d('0x43')){var _0x2e7456={};_0x2e7456[_0x589d8a['name']]={'$like':'%'+_0x4ae54e['query'][_0x005d('0x44')]+'%'};return _0x2e7456;}})});}_0x20d04a=_[_0x005d('0x41')]({},_0x20d04a,_0x4ae54e[_0x005d('0x45')]);var _0x3adf62={'where':_0x20d04a['where']};return db['UserProfile'][_0x005d('0x24')](_0x3adf62)['then'](function(_0x3553a5){_0xfd1907[_0x005d('0x24')]=_0x3553a5;if(_0x4ae54e[_0x005d('0x37')]['includeAll']){_0x20d04a[_0x005d('0x46')]=[{'all':!![]}];}return db[_0x005d('0x31')][_0x005d('0x47')](_0x20d04a);})[_0x005d('0x2b')](function(_0x4c55fa){_0xfd1907[_0x005d('0x48')]=_0x4c55fa;return _0xfd1907;})[_0x005d('0x2b')](respondWithFilteredResult(_0x4fe09b,_0x20d04a))[_0x005d('0x49')](handleError(_0x4fe09b,null));};exports[_0x005d('0x4a')]=function(_0x1b2cdd,_0x1a47b5){var _0x284ccc={'raw':![],'where':{'id':_0x1b2cdd[_0x005d('0x4b')]['id']}},_0x218575={};_0x218575[_0x005d('0x35')]=_['keys'](db['UserProfile'][_0x005d('0x32')]);_0x218575[_0x005d('0x37')]=_['keys'](_0x1b2cdd[_0x005d('0x37')]);_0x218575[_0x005d('0x39')]=_[_0x005d('0x3a')](_0x218575[_0x005d('0x35')],_0x218575[_0x005d('0x37')]);_0x284ccc[_0x005d('0x3b')]=_['intersection'](_0x218575[_0x005d('0x35')],qs[_0x005d('0x3c')](_0x1b2cdd[_0x005d('0x37')][_0x005d('0x3c')]));_0x284ccc['attributes']=_0x284ccc['attributes'][_0x005d('0x3d')]?_0x284ccc['attributes']:_0x218575[_0x005d('0x35')];if(_0x1b2cdd['query'][_0x005d('0x4c')]){_0x284ccc[_0x005d('0x46')]=[{'all':!![]}];}_0x284ccc=_['merge']({},_0x284ccc,_0x1b2cdd[_0x005d('0x45')]);return db[_0x005d('0x31')]['find'](_0x284ccc)[_0x005d('0x2b')](handleEntityNotFound(_0x1a47b5,null))['then'](respondWithResult(_0x1a47b5,null))[_0x005d('0x49')](handleError(_0x1a47b5,null));};exports[_0x005d('0x4d')]=function(_0x4381d5,_0x36e626){return db['UserProfile'][_0x005d('0x4d')](_0x4381d5[_0x005d('0x4e')],{})[_0x005d('0x2b')](respondWithResult(_0x36e626,0xc9))['catch'](handleError(_0x36e626,null));};exports[_0x005d('0x4f')]=function(_0x1c3e5a,_0x1c889b){var _0x149f1c={'where':{'id':_0x1c3e5a['params']['id']}},_0x4461ff={};_0x4461ff['model']=_['keys'](db[_0x005d('0x31')][_0x005d('0x32')]);_0x149f1c['attributes']=_[_0x005d('0x3a')](_0x4461ff['model'],qs[_0x005d('0x3c')](_0x1c3e5a[_0x005d('0x37')][_0x005d('0x3c')]));_0x149f1c[_0x005d('0x3b')]=_0x149f1c[_0x005d('0x3b')]['length']?_0x149f1c['attributes']:_0x4461ff[_0x005d('0x35')];if(_0x1c3e5a[_0x005d('0x37')][_0x005d('0x4c')]){_0x149f1c[_0x005d('0x46')]=[{'all':!![]}];}_0x149f1c=_[_0x005d('0x41')]({},_0x149f1c,_0x1c3e5a[_0x005d('0x45')]);return db[_0x005d('0x31')][_0x005d('0x50')](_0x149f1c)[_0x005d('0x2b')](handleEntityNotFound(_0x1c889b,null))[_0x005d('0x2b')](function(_0xc7a73d){if(_0xc7a73d){var _0x1e4d99=_0xc7a73d[_0x005d('0x51')]({'plain':!![]});_0x1e4d99=qs[_0x005d('0x52')](_0x1e4d99,['id','createdAt',_0x005d('0x53'),_0x005d('0x54')]);_0x1c3e5a[_0x005d('0x4e')]=_[_0x005d('0x52')](_0x1c3e5a['body'],['id','createdAt',_0x005d('0x53')]);return db[_0x005d('0x55')][_0x005d('0x56')](function(_0x2cb2fb){return db[_0x005d('0x31')][_0x005d('0x4d')](_[_0x005d('0x41')](_0x1e4d99,_0x1c3e5a[_0x005d('0x4e')]),{'include':_0x1c3e5a[_0x005d('0x37')][_0x005d('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x2cb2fb})[_0x005d('0x2b')](function(_0x27b81d){var _0x576be0=_0x27b81d[_0x005d('0x51')]({'plain':!![]});return db[_0x005d('0x57')]['findAll']({'where':{'userProfileId':_0x1c3e5a['params']['id']},'raw':!![]})[_0x005d('0x2b')](function(_0x525218){if(_0x525218){return BPromise['each'](_0x525218,function(_0xd69b9e){return new BPromise(function(_0xc9b8da,_0x4e371e){if(_0xd69b9e[_0x005d('0x58')]===null||_0xd69b9e['autoAssociation']===0x1)_0xc9b8da(null);return db[_0x005d('0x59')]['findAll']({'where':{'sectionId':_0xd69b9e['id']},'raw':!![]})['then'](function(_0x2ed36b){var _0x13fe32=_[_0x005d('0x30')](_0x2ed36b,function(_0x35a8bf){return qs['omit'](_0x35a8bf,['id',_0x005d('0x5a'),_0x005d('0x53'),_0x005d('0x5b')]);});_0xc9b8da(_0x13fe32);})[_0x005d('0x49')](function(_0x173b64){_0x4e371e(_0x173b64);});})[_0x005d('0x2b')](function(_0x576e3f){var _0x1c13c5=qs['omit'](_0xd69b9e,['id',_0x005d('0x5a'),_0x005d('0x53')]);_0x1c13c5[_0x005d('0x5c')]=_0x576be0['id'];if(_0x576e3f)_0x1c13c5[_0x005d('0x5d')]=_0x576e3f;return _0x1c13c5;})[_0x005d('0x2b')](function(_0x4db2f4){return db[_0x005d('0x57')][_0x005d('0x4d')](_0x4db2f4,{'include':[{'model':db['UserProfileResource'],'as':_0x005d('0x5d')}],'raw':!![],'transaction':_0x2cb2fb});});})['then'](function(){return _0x576be0;});}});});});}})[_0x005d('0x2b')](respondWithResult(_0x1c889b,0xc9))[_0x005d('0x49')](handleError(_0x1c889b,null));};exports[_0x005d('0x2a')]=function(_0x27e06d,_0x97351){if(_0x27e06d[_0x005d('0x4e')]['id']){delete _0x27e06d[_0x005d('0x4e')]['id'];}return db[_0x005d('0x31')][_0x005d('0x50')]({'where':{'id':_0x27e06d[_0x005d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x97351,null))['then'](saveUpdates(_0x27e06d['body'],null))['then'](respondWithResult(_0x97351,null))['catch'](handleError(_0x97351,null));};exports['destroy']=function(_0x4ad6fe,_0x3bc9a2){return db[_0x005d('0x31')]['find']({'where':{'id':_0x4ad6fe[_0x005d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3bc9a2,null))[_0x005d('0x2b')](removeEntity(_0x3bc9a2,null))[_0x005d('0x49')](handleError(_0x3bc9a2,null));};exports[_0x005d('0x5e')]=function(_0xa258e7,_0x5f2b98){return db[_0x005d('0x31')][_0x005d('0x5e')]()[_0x005d('0x2b')](respondWithResult(_0x5f2b98,null))['catch'](handleError(_0x5f2b98,null));};exports[_0x005d('0x5f')]=function(_0x323d9e,_0x650c2f){var _0x3ba205=_0x323d9e[_0x005d('0x4e')];return db[_0x005d('0x31')]['find']({'where':{'id':_0x323d9e[_0x005d('0x4b')]['id']}})[_0x005d('0x2b')](handleEntityNotFound(_0x650c2f,null))[_0x005d('0x2b')](function(_0x4a86b2){if(_0x4a86b2){return db['sequelize'][_0x005d('0x56')](function(_0x4aec7c){return db[_0x005d('0x57')]['destroy']({'where':{'userProfileId':_0x323d9e[_0x005d('0x4b')]['id'],'sectionId':_[_0x005d('0x30')](_0x3ba205,function(_0xed464){return _0xed464[_0x005d('0x5b')];})},'transaction':_0x4aec7c})[_0x005d('0x2b')](function(){var _0x224b4e=_['map'](_0x3ba205,function(_0x1f8de2){_0x1f8de2[_0x005d('0x5c')]=_0x323d9e[_0x005d('0x4b')]['id'];return _0x1f8de2;});var _0x5c84c3=[];return BPromise[_0x005d('0x60')](_0x224b4e,function(_0x50ab0c){return db[_0x005d('0x57')][_0x005d('0x4d')](_0x50ab0c,{'include':[{'model':db[_0x005d('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x4aec7c})[_0x005d('0x2b')](function(_0x169ad6){_0x5c84c3[_0x005d('0x61')](_0x169ad6['get']({'plain':!![]}));});})['then'](function(){return _0x5c84c3;});});});}})['then'](function(_0xceae3c){return _0xceae3c;})[_0x005d('0x2b')](respondWithResult(_0x650c2f,null))['catch'](handleError(_0x650c2f,null));};exports[_0x005d('0x62')]=function(_0xb63596,_0x46bde3){var _0x2d84de;return db['UserProfile'][_0x005d('0x50')]({'where':{'id':_0xb63596[_0x005d('0x4b')]['id']},'attributes':['id',_0x005d('0x36')]})[_0x005d('0x2b')](handleEntityNotFound(_0x46bde3,null))['then'](function(_0x4c7aea){if(_0x4c7aea){_0x2d84de=_0x4c7aea;return db[_0x005d('0x57')][_0x005d('0x63')]({'where':{'userProfileId':_0xb63596[_0x005d('0x4b')]['id'],'sectionId':_0xb63596[_0x005d('0x37')]['ids']}});}})[_0x005d('0x2b')](function(){return _0x2d84de;})['then'](respondWithStatusCode(_0x46bde3,null))[_0x005d('0x49')](handleError(_0x46bde3,null));};exports[_0x005d('0x64')]=function(_0x3418f6,_0xef1d57){var _0x30174c=[];var _0x3435a9=[];return db[_0x005d('0x57')][_0x005d('0x47')]({'where':{'userProfileId':_0x3418f6['params']['id']},'raw':!![]})[_0x005d('0x2b')](function(_0x9c88e1){_0x30174c=_['filter'](_0x9c88e1,function(_0x9776ef){return _0x9776ef[_0x005d('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x9776ef[_0x005d('0x5b')]);});if(!_['isEmpty'](_0x30174c)){return _[_0x005d('0x30')](_0x30174c,function(_0x381d3e){return _0x381d3e['sectionId'];});}else{return;}})[_0x005d('0x2b')](function(_0x2999fb){if(_0x2999fb)_0x3435a9=_0x2999fb;if(_[_0x005d('0x66')](_0x3435a9,0x64)){var _0x5ec475=_['find'](_0x30174c,{'sectionId':0x64});return hasDefaultDashboard(_0x5ec475)[_0x005d('0x2b')](function(_0x25b63a){return _[_0x005d('0x30')](_0x30174c,function(_0x171c0b){if(_0x171c0b[_0x005d('0x5b')]===0x64){_0x171c0b[_0x005d('0x67')]=_0x25b63a;}return _0x171c0b;});});}else{return;}})[_0x005d('0x2b')](function(_0x465f3d){if(_0x465f3d)_0x30174c=_0x465f3d;if(_['includes'](_0x3435a9,0x3eb)){var _0x43fe66=_['find'](_0x30174c,{'sectionId':0x3eb});return getCustomDashboards(_0x43fe66)['then'](function(_0x1fa5e1){return _[_0x005d('0x30')](_0x30174c,function(_0x2a4714){if(_0x43fe66['enabled']){if(_0x2a4714['sectionId']===0x3eb){_0x2a4714[_0x005d('0x67')]=_0x1fa5e1;}}else{if(_0x2a4714['sectionId']===0x64){if(!_0x2a4714[_0x005d('0x67')]){_0x2a4714[_0x005d('0x67')]=[];}_0x2a4714[_0x005d('0x67')]=_0x2a4714[_0x005d('0x67')][_0x005d('0x68')](_0x1fa5e1);}}return _0x2a4714;});});}else{return;}})[_0x005d('0x2b')](function(_0x406b5d){if(_0x406b5d)_0x30174c=_0x406b5d;if(_[_0x005d('0x66')](_0x3435a9,0x709)){var _0x285de9=_[_0x005d('0x50')](_0x30174c,{'sectionId':0x709});return getPlugins(_0x285de9)[_0x005d('0x2b')](function(_0x385718){if(_0x285de9[_0x005d('0x65')]){return _[_0x005d('0x30')](_0x30174c,function(_0x4b0771){if(_0x4b0771['sectionId']===0x709){_0x4b0771[_0x005d('0x67')]=_0x385718;}return _0x4b0771;});}else{var _0x1a6bf5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x385718};var _0xc2f892=_[_0x005d('0x30')](_0x30174c);_0xc2f892[_0x005d('0x61')](_0x1a6bf5);return _0xc2f892;}});}else{return;}})[_0x005d('0x2b')](function(_0x5f5331){if(_0x5f5331)_0x30174c=_0x5f5331;return _[_0x005d('0x44')](_0x30174c,[_0x005d('0x65'),0x1]);})[_0x005d('0x2b')](respondWithResult(_0xef1d57,null))[_0x005d('0x49')](handleError(_0xef1d57,null));};function hasDefaultDashboard(_0x13fc31){var _0x402560=[0x65];return new BPromise(function(_0x5d9597,_0x3700a0){try{if(_0x13fc31[_0x005d('0x58')]){_0x5d9597(_0x402560);}else{return db[_0x005d('0x59')][_0x005d('0x69')]({'where':{'sectionId':_0x13fc31['id']},'raw':!![]})[_0x005d('0x2b')](function(_0x2e71e1){_0x2e71e1?_0x5d9597(_0x402560):_0x5d9597();});}}catch(_0x5f0e73){_0x3700a0(_0x5f0e73);}});}function getCustomDashboards(_0x218cd8){var _0x511d96=[];return new BPromise(function(_0x2b62cd,_0xffd6bb){try{if(_0x218cd8['autoAssociation']){return db[_0x005d('0x6a')]['findAll']({'raw':!![]})[_0x005d('0x2b')](function(_0x464379){_0x464379[_0x005d('0x6b')](function(_0x23fb07){_0x511d96['push'](_0x23fb07['id']+0x1869f);});_0x2b62cd(_0x511d96);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x218cd8['id']},'raw':!![]})[_0x005d('0x2b')](function(_0x4944ad){_0x4944ad[_0x005d('0x6b')](function(_0x42d453){_0x511d96[_0x005d('0x61')](_0x42d453['resourceId']+0x1869f);});_0x2b62cd(_0x511d96);});}}catch(_0x100892){_0xffd6bb(_0x100892);}});}function getPlugins(_0x27774d){var _0x2ce76e=[];return new BPromise(function(_0x5506b1,_0x11d191){try{if(_0x27774d[_0x005d('0x58')]){return db['Plugin'][_0x005d('0x47')]({'raw':!![]})[_0x005d('0x2b')](function(_0x373b85){_0x373b85[_0x005d('0x6b')](function(_0x6b0cba){_0x2ce76e[_0x005d('0x61')](_0x6b0cba['id']+0x15b38);});_0x5506b1(_0x2ce76e);});}else{return db[_0x005d('0x59')][_0x005d('0x47')]({'where':{'sectionId':_0x27774d['id']},'raw':!![]})[_0x005d('0x2b')](function(_0x5197a0){_0x5197a0[_0x005d('0x6b')](function(_0x45c294){_0x2ce76e[_0x005d('0x61')](_0x45c294[_0x005d('0x6c')]+0x15b38);});_0x5506b1(_0x2ce76e);});}}catch(_0x5df41e){_0x11d191(_0x5df41e);}});}exports['addResources']=function(_0x2c2de1,_0xb98a04){return db[_0x005d('0x31')][_0x005d('0x50')]({'where':{'id':_0x2c2de1[_0x005d('0x4b')]['id']}})[_0x005d('0x2b')](handleEntityNotFound(_0xb98a04,null))[_0x005d('0x2b')](function(_0x296744){if(_0x296744){return db[_0x005d('0x55')][_0x005d('0x56')](function(_0xdb166){return db[_0x005d('0x57')][_0x005d('0x47')]({'where':{'userProfileId':_0x2c2de1[_0x005d('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x005d('0x2b')](function(_0x25c77b){if(_0x25c77b){return db['UserProfileSection'][_0x005d('0x63')]({'where':{'userProfileId':_0x2c2de1[_0x005d('0x4b')]['id'],'id':_[_0x005d('0x30')](_0x25c77b,function(_0x2141c2){return _0x2141c2['id'];})},'transaction':_0xdb166});}})[_0x005d('0x2b')](function(_0x1c1bcc){var _0x4d42ed=_[_0x005d('0x30')](_0x2c2de1[_0x005d('0x4e')],function(_0x144b92){_0x144b92[_0x005d('0x5c')]=_0x2c2de1[_0x005d('0x4b')]['id'];return _0x144b92;});return db[_0x005d('0x57')][_0x005d('0x6d')](_0x4d42ed,{'raw':!![],'transaction':_0xdb166});})[_0x005d('0x2b')](function(_0x401e51){var _0x505d37=_[_0x005d('0x44')](_[_0x005d('0x30')](_0x401e51,function(_0x1bf170){return _0x1bf170[_0x005d('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x505d37){return db[_0x005d('0x57')]['findAll']({'where':{'userProfileId':_0x2c2de1[_0x005d('0x4b')]['id'],'sectionId':_[_0x005d('0x30')](_0x505d37,function(_0x544eb4){return _0x544eb4[_0x005d('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x005d('0x2b')](function(_0x46db69){var _0x181269=_[_0x005d('0x30')](_0x2c2de1[_0x005d('0x4e')],function(_0x3b96c9){_0x3b96c9[_0x005d('0x5c')]=_0x2c2de1[_0x005d('0x4b')]['id'];return _0x3b96c9;});return db[_0x005d('0x59')][_0x005d('0x6d')](_0x181269,{'raw':!![],'transaction':_0xdb166});});}})[_0x005d('0x49')](handleError(_0xb98a04,null));});}})['then'](function(_0x498e68){var _0x1d265a=_['map'](_0x498e68,function(_0x3a87c){return _0x3a87c[_0x005d('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0xb98a04,null))[_0x005d('0x49')](handleError(_0xb98a04,null));};exports[_0x005d('0x6e')]=function(_0x48eedb,_0x304226,_0x2e150e){return db[_0x005d('0x31')][_0x005d('0x50')]({'where':{'id':_0x48eedb[_0x005d('0x4b')]['id']}})[_0x005d('0x2b')](handleEntityNotFound(_0x304226,null))['then'](function(_0x4f9d14){if(_0x4f9d14){return _0x4f9d14[_0x005d('0x6e')](_0x48eedb['query'][_0x005d('0x6f')]);}})[_0x005d('0x2b')](respondWithStatusCode(_0x304226,null))[_0x005d('0x49')](handleError(_0x304226,null));};exports[_0x005d('0x70')]=function(_0x14d89f,_0x30578c){var _0x5ef7ec={};if(!_0x14d89f[_0x005d('0x37')][_0x005d('0x71')])throw new Error(_0x005d('0x72'));if(!_0x14d89f['query'][_0x005d('0x73')](_0x005d('0x74'))){_0x5ef7ec['limit']=qs[_0x005d('0x23')](_0x14d89f[_0x005d('0x37')][_0x005d('0x23')]);_0x5ef7ec['offset']=qs['offset'](_0x14d89f[_0x005d('0x37')][_0x005d('0x21')]);}return db[_0x005d('0x31')]['find']({'where':{'id':_0x14d89f['params']['id']}})[_0x005d('0x2b')](function(_0x2fab6b){if(!_0x2fab6b)throw new Error(_0x005d('0x75')+_0x14d89f[_0x005d('0x4b')]['id']);return db[_0x005d('0x31')]['getResources'](_0x14d89f);})[_0x005d('0x2b')](respondWithFilteredResult(_0x30578c,_0x5ef7ec))[_0x005d('0x49')](handleError(_0x30578c,null));};
\ No newline at end of file
+var _0x1245=['concat','push','findOne','Dashboard','resourceId','forEach','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','then','destroy','error','stack','name','send','index','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','show','params','create','body','catch','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','autoAssociation','map','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','update','addSections','each','removeSections','ids','getSections','isEmpty','subsections','includes','enabled'];(function(_0x25efc3,_0x555aae){var _0x4d3891=function(_0x149c0a){while(--_0x149c0a){_0x25efc3['push'](_0x25efc3['shift']());}};_0x4d3891(++_0x555aae);}(_0x1245,0x1cc));var _0x5124=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1245[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5124('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5124('0x1'));var moment=require(_0x5124('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5124('0x3'));var util=require(_0x5124('0x4'));var path=require(_0x5124('0x5'));var sox=require(_0x5124('0x6'));var csv=require('to-csv');var ejs=require(_0x5124('0x7'));var fs=require('fs');var fs_extra=require(_0x5124('0x8'));var _=require(_0x5124('0x9'));var squel=require(_0x5124('0xa'));var crypto=require(_0x5124('0xb'));var jsforce=require(_0x5124('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5124('0xd'));var querystring=require(_0x5124('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5124('0xf'));var as=require(_0x5124('0x10'));var hardwareService=require(_0x5124('0x11'));var logger=require('../../config/logger')(_0x5124('0x12'));var utils=require(_0x5124('0x13'));var config=require(_0x5124('0x14'));var licenseUtil=require(_0x5124('0x15'));var db=require(_0x5124('0x16'))['db'];config[_0x5124('0x17')]=_[_0x5124('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5124('0x19'))[_0x5124('0x1a')](socket);function respondWithStatusCode(_0xb42e83,_0xa6b437){_0xa6b437=_0xa6b437||0xcc;return function(_0x544cb4){if(_0x544cb4){return _0xb42e83[_0x5124('0x1b')](_0xa6b437);}return _0xb42e83[_0x5124('0x1c')](_0xa6b437)[_0x5124('0x1d')]();};}function respondWithResult(_0x2418ac,_0x327e5b){_0x327e5b=_0x327e5b||0xc8;return function(_0x211e24){if(_0x211e24){return _0x2418ac[_0x5124('0x1c')](_0x327e5b)[_0x5124('0x1e')](_0x211e24);}};}function respondWithFilteredResult(_0x2f9352,_0x2b84cc){return function(_0x4243b8){if(_0x4243b8){var _0x14515f=typeof _0x2b84cc['offset']==='undefined'&&typeof _0x2b84cc['limit']===_0x5124('0x1f');var _0x48436b=_0x4243b8[_0x5124('0x20')];var _0xdcaf45=_0x14515f?0x0:_0x2b84cc[_0x5124('0x21')];var _0x38ad52=_0x14515f?_0x4243b8[_0x5124('0x20')]:_0x2b84cc[_0x5124('0x21')]+_0x2b84cc[_0x5124('0x22')];var _0x191417;if(_0x38ad52>=_0x48436b){_0x38ad52=_0x48436b;_0x191417=0xc8;}else{_0x191417=0xce;}_0x2f9352[_0x5124('0x1c')](_0x191417);return _0x2f9352[_0x5124('0x23')]('Content-Range',_0xdcaf45+'-'+_0x38ad52+'/'+_0x48436b)[_0x5124('0x1e')](_0x4243b8);}return null;};}function patchUpdates(_0x781dba){return function(_0xe1ebe7){try{jsonpatch['apply'](_0xe1ebe7,_0x781dba,!![]);}catch(_0x2d8903){return BPromise['reject'](_0x2d8903);}return _0xe1ebe7['save']();};}function saveUpdates(_0x126162,_0xf9c13){return function(_0x3ee081){if(_0x3ee081){return _0x3ee081['update'](_0x126162)[_0x5124('0x24')](function(_0x474a26){return _0x474a26;});}return null;};}function removeEntity(_0xc0a860,_0x531faf){return function(_0x5b2296){if(_0x5b2296){return _0x5b2296[_0x5124('0x25')]()[_0x5124('0x24')](function(){_0xc0a860[_0x5124('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x335a1b,_0x478270){return function(_0x9dbc90){if(!_0x9dbc90){_0x335a1b[_0x5124('0x1b')](0x194);}return _0x9dbc90;};}function handleError(_0x35518e,_0x190d02){_0x190d02=_0x190d02||0x1f4;return function(_0x5ccc0b){logger[_0x5124('0x26')](_0x5ccc0b[_0x5124('0x27')]);if(_0x5ccc0b[_0x5124('0x28')]){delete _0x5ccc0b[_0x5124('0x28')];}_0x35518e[_0x5124('0x1c')](_0x190d02)[_0x5124('0x29')](_0x5ccc0b);};}exports[_0x5124('0x2a')]=function(_0x33c3a9,_0x178d25){var _0x58ad57={},_0x4271ee={},_0x2418ff={'count':0x0,'rows':[]};var _0x17ed17=_['map'](db['UserProfile'][_0x5124('0x2b')],function(_0x254244){return{'name':_0x254244['fieldName'],'type':_0x254244['type'][_0x5124('0x2c')]};});_0x4271ee[_0x5124('0x2d')]=_['map'](_0x17ed17,'name');_0x4271ee[_0x5124('0x2e')]=_[_0x5124('0x2f')](_0x33c3a9[_0x5124('0x2e')]);_0x4271ee['filters']=_[_0x5124('0x30')](_0x4271ee[_0x5124('0x2d')],_0x4271ee['query']);_0x58ad57['attributes']=_[_0x5124('0x30')](_0x4271ee['model'],qs[_0x5124('0x31')](_0x33c3a9[_0x5124('0x2e')][_0x5124('0x31')]));_0x58ad57[_0x5124('0x32')]=_0x58ad57[_0x5124('0x32')][_0x5124('0x33')]?_0x58ad57[_0x5124('0x32')]:_0x4271ee[_0x5124('0x2d')];if(!_0x33c3a9[_0x5124('0x2e')][_0x5124('0x34')](_0x5124('0x35'))){_0x58ad57['limit']=qs[_0x5124('0x22')](_0x33c3a9[_0x5124('0x2e')][_0x5124('0x22')]);_0x58ad57[_0x5124('0x21')]=qs[_0x5124('0x21')](_0x33c3a9[_0x5124('0x2e')][_0x5124('0x21')]);}_0x58ad57[_0x5124('0x36')]=qs[_0x5124('0x37')](_0x33c3a9['query']['sort']);_0x58ad57[_0x5124('0x38')]=qs['filters'](_[_0x5124('0x39')](_0x33c3a9['query'],_0x4271ee[_0x5124('0x3a')]),_0x17ed17);if(_0x33c3a9[_0x5124('0x2e')][_0x5124('0x3b')]){_0x58ad57[_0x5124('0x38')]=_[_0x5124('0x3c')](_0x58ad57[_0x5124('0x38')],{'$or':_['map'](_0x17ed17,function(_0x18a4e5){if(_0x18a4e5[_0x5124('0x3d')]!==_0x5124('0x3e')){var _0x369f1a={};_0x369f1a[_0x18a4e5[_0x5124('0x28')]]={'$like':'%'+_0x33c3a9[_0x5124('0x2e')]['filter']+'%'};return _0x369f1a;}})});}_0x58ad57=_[_0x5124('0x3c')]({},_0x58ad57,_0x33c3a9[_0x5124('0x3f')]);var _0x24d8dd={'where':_0x58ad57[_0x5124('0x38')]};return db[_0x5124('0x40')][_0x5124('0x20')](_0x24d8dd)['then'](function(_0x347244){_0x2418ff[_0x5124('0x20')]=_0x347244;if(_0x33c3a9[_0x5124('0x2e')][_0x5124('0x41')]){_0x58ad57[_0x5124('0x42')]=[{'all':!![]}];}return db[_0x5124('0x40')][_0x5124('0x43')](_0x58ad57);})[_0x5124('0x24')](function(_0x505548){_0x2418ff[_0x5124('0x44')]=_0x505548;return _0x2418ff;})[_0x5124('0x24')](respondWithFilteredResult(_0x178d25,_0x58ad57))['catch'](handleError(_0x178d25,null));};exports[_0x5124('0x45')]=function(_0x3bfb19,_0x5b851a){var _0x248346={'raw':![],'where':{'id':_0x3bfb19[_0x5124('0x46')]['id']}},_0x125c84={};_0x125c84[_0x5124('0x2d')]=_[_0x5124('0x2f')](db[_0x5124('0x40')]['rawAttributes']);_0x125c84['query']=_['keys'](_0x3bfb19[_0x5124('0x2e')]);_0x125c84[_0x5124('0x3a')]=_[_0x5124('0x30')](_0x125c84[_0x5124('0x2d')],_0x125c84[_0x5124('0x2e')]);_0x248346[_0x5124('0x32')]=_['intersection'](_0x125c84[_0x5124('0x2d')],qs[_0x5124('0x31')](_0x3bfb19[_0x5124('0x2e')][_0x5124('0x31')]));_0x248346[_0x5124('0x32')]=_0x248346[_0x5124('0x32')][_0x5124('0x33')]?_0x248346['attributes']:_0x125c84[_0x5124('0x2d')];if(_0x3bfb19[_0x5124('0x2e')][_0x5124('0x41')]){_0x248346[_0x5124('0x42')]=[{'all':!![]}];}_0x248346=_['merge']({},_0x248346,_0x3bfb19[_0x5124('0x3f')]);return db['UserProfile']['find'](_0x248346)['then'](handleEntityNotFound(_0x5b851a,null))[_0x5124('0x24')](respondWithResult(_0x5b851a,null))['catch'](handleError(_0x5b851a,null));};exports[_0x5124('0x47')]=function(_0x2aa157,_0x5a7d36){return db[_0x5124('0x40')][_0x5124('0x47')](_0x2aa157[_0x5124('0x48')],{})['then'](respondWithResult(_0x5a7d36,0xc9))[_0x5124('0x49')](handleError(_0x5a7d36,null));};exports[_0x5124('0x4a')]=function(_0x4b7c91,_0x403ebb){var _0x2821fb={'where':{'id':_0x4b7c91[_0x5124('0x46')]['id']}},_0x1a67b7={};_0x1a67b7[_0x5124('0x2d')]=_[_0x5124('0x2f')](db[_0x5124('0x40')][_0x5124('0x2b')]);_0x2821fb[_0x5124('0x32')]=_[_0x5124('0x30')](_0x1a67b7[_0x5124('0x2d')],qs[_0x5124('0x31')](_0x4b7c91[_0x5124('0x2e')][_0x5124('0x31')]));_0x2821fb['attributes']=_0x2821fb[_0x5124('0x32')][_0x5124('0x33')]?_0x2821fb[_0x5124('0x32')]:_0x1a67b7[_0x5124('0x2d')];if(_0x4b7c91['query'][_0x5124('0x41')]){_0x2821fb[_0x5124('0x42')]=[{'all':!![]}];}_0x2821fb=_[_0x5124('0x3c')]({},_0x2821fb,_0x4b7c91[_0x5124('0x3f')]);return db[_0x5124('0x40')][_0x5124('0x4b')](_0x2821fb)[_0x5124('0x24')](handleEntityNotFound(_0x403ebb,null))[_0x5124('0x24')](function(_0x12a6de){if(_0x12a6de){var _0x52db1a=_0x12a6de[_0x5124('0x4c')]({'plain':!![]});_0x52db1a=qs[_0x5124('0x4d')](_0x52db1a,['id',_0x5124('0x4e'),_0x5124('0x4f'),_0x5124('0x50')]);_0x4b7c91[_0x5124('0x48')]=_['omit'](_0x4b7c91[_0x5124('0x48')],['id',_0x5124('0x4e'),_0x5124('0x4f')]);return db[_0x5124('0x51')][_0x5124('0x52')](function(_0x1c8bd8){return db[_0x5124('0x40')][_0x5124('0x47')](_['merge'](_0x52db1a,_0x4b7c91[_0x5124('0x48')]),{'include':_0x4b7c91[_0x5124('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1c8bd8})[_0x5124('0x24')](function(_0x29abe3){var _0x33e27c=_0x29abe3[_0x5124('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0x5124('0x43')]({'where':{'userProfileId':_0x4b7c91['params']['id']},'raw':!![]})[_0x5124('0x24')](function(_0x117352){if(_0x117352){return BPromise['each'](_0x117352,function(_0x5c8d90){return new BPromise(function(_0x2e48ea,_0x1f614b){if(_0x5c8d90[_0x5124('0x53')]===null||_0x5c8d90['autoAssociation']===0x1)_0x2e48ea(null);return db['UserProfileResource'][_0x5124('0x43')]({'where':{'sectionId':_0x5c8d90['id']},'raw':!![]})['then'](function(_0x4863ad){var _0x4536bf=_[_0x5124('0x54')](_0x4863ad,function(_0x18ecac){return qs[_0x5124('0x4d')](_0x18ecac,['id',_0x5124('0x4e'),'updatedAt',_0x5124('0x55')]);});_0x2e48ea(_0x4536bf);})[_0x5124('0x49')](function(_0x13467d){_0x1f614b(_0x13467d);});})['then'](function(_0x279049){var _0xcd286=qs[_0x5124('0x4d')](_0x5c8d90,['id',_0x5124('0x4e'),_0x5124('0x4f')]);_0xcd286[_0x5124('0x56')]=_0x33e27c['id'];if(_0x279049)_0xcd286[_0x5124('0x57')]=_0x279049;return _0xcd286;})[_0x5124('0x24')](function(_0xfd2b4b){return db[_0x5124('0x58')][_0x5124('0x47')](_0xfd2b4b,{'include':[{'model':db[_0x5124('0x59')],'as':_0x5124('0x57')}],'raw':!![],'transaction':_0x1c8bd8});});})['then'](function(){return _0x33e27c;});}});});});}})[_0x5124('0x24')](respondWithResult(_0x403ebb,0xc9))[_0x5124('0x49')](handleError(_0x403ebb,null));};exports[_0x5124('0x5a')]=function(_0x26e217,_0x3cfaa7){if(_0x26e217[_0x5124('0x48')]['id']){delete _0x26e217[_0x5124('0x48')]['id'];}return db[_0x5124('0x40')][_0x5124('0x4b')]({'where':{'id':_0x26e217[_0x5124('0x46')]['id']}})[_0x5124('0x24')](handleEntityNotFound(_0x3cfaa7,null))[_0x5124('0x24')](saveUpdates(_0x26e217[_0x5124('0x48')],null))[_0x5124('0x24')](respondWithResult(_0x3cfaa7,null))['catch'](handleError(_0x3cfaa7,null));};exports['destroy']=function(_0x2f065d,_0x22f349){return db[_0x5124('0x40')][_0x5124('0x4b')]({'where':{'id':_0x2f065d[_0x5124('0x46')]['id']}})[_0x5124('0x24')](handleEntityNotFound(_0x22f349,null))[_0x5124('0x24')](removeEntity(_0x22f349,null))['catch'](handleError(_0x22f349,null));};exports['describe']=function(_0x516511,_0x5a0138){return db[_0x5124('0x40')]['describe']()['then'](respondWithResult(_0x5a0138,null))['catch'](handleError(_0x5a0138,null));};exports[_0x5124('0x5b')]=function(_0x49baea,_0x1c091b){var _0x57ac00=_0x49baea['body'];return db[_0x5124('0x40')][_0x5124('0x4b')]({'where':{'id':_0x49baea['params']['id']}})[_0x5124('0x24')](handleEntityNotFound(_0x1c091b,null))[_0x5124('0x24')](function(_0x3b04a9){if(_0x3b04a9){return db[_0x5124('0x51')][_0x5124('0x52')](function(_0x3d7dd3){return db['UserProfileSection'][_0x5124('0x25')]({'where':{'userProfileId':_0x49baea[_0x5124('0x46')]['id'],'sectionId':_['map'](_0x57ac00,function(_0x411366){return _0x411366[_0x5124('0x55')];})},'transaction':_0x3d7dd3})[_0x5124('0x24')](function(){var _0x372344=_[_0x5124('0x54')](_0x57ac00,function(_0x333c66){_0x333c66[_0x5124('0x56')]=_0x49baea[_0x5124('0x46')]['id'];return _0x333c66;});var _0x36a76c=[];return BPromise[_0x5124('0x5c')](_0x372344,function(_0x3458e4){return db['UserProfileSection'][_0x5124('0x47')](_0x3458e4,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3d7dd3})['then'](function(_0x53be5e){_0x36a76c['push'](_0x53be5e[_0x5124('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x36a76c;});});});}})[_0x5124('0x24')](function(_0x5b5fa8){return _0x5b5fa8;})[_0x5124('0x24')](respondWithResult(_0x1c091b,null))[_0x5124('0x49')](handleError(_0x1c091b,null));};exports[_0x5124('0x5d')]=function(_0x542fa7,_0x475161){var _0x4bfb30;return db['UserProfile'][_0x5124('0x4b')]({'where':{'id':_0x542fa7[_0x5124('0x46')]['id']},'attributes':['id',_0x5124('0x28')]})['then'](handleEntityNotFound(_0x475161,null))[_0x5124('0x24')](function(_0x5ee9b3){if(_0x5ee9b3){_0x4bfb30=_0x5ee9b3;return db[_0x5124('0x58')][_0x5124('0x25')]({'where':{'userProfileId':_0x542fa7[_0x5124('0x46')]['id'],'sectionId':_0x542fa7[_0x5124('0x2e')][_0x5124('0x5e')]}});}})[_0x5124('0x24')](function(){return _0x4bfb30;})[_0x5124('0x24')](respondWithStatusCode(_0x475161,null))[_0x5124('0x49')](handleError(_0x475161,null));};exports[_0x5124('0x5f')]=function(_0x777fbd,_0x25afa4){var _0x276e0a=[];var _0x4b0a04=[];return db[_0x5124('0x58')]['findAll']({'where':{'userProfileId':_0x777fbd['params']['id']},'raw':!![]})[_0x5124('0x24')](function(_0x5789ad){_0x276e0a=_[_0x5124('0x3b')](_0x5789ad,function(_0x89bd44){return _0x89bd44['enabled']===0x1||_['includes']([0x3eb,0x709],_0x89bd44[_0x5124('0x55')]);});if(!_[_0x5124('0x60')](_0x276e0a)){return _[_0x5124('0x54')](_0x276e0a,function(_0x460d88){return _0x460d88['sectionId'];});}else{return;}})[_0x5124('0x24')](function(_0x13da73){if(_0x13da73)_0x4b0a04=_0x13da73;if(_['includes'](_0x4b0a04,0x64)){var _0x341542=_[_0x5124('0x4b')](_0x276e0a,{'sectionId':0x64});return hasDefaultDashboard(_0x341542)[_0x5124('0x24')](function(_0x118f45){return _[_0x5124('0x54')](_0x276e0a,function(_0x54dc5){if(_0x54dc5[_0x5124('0x55')]===0x64){_0x54dc5[_0x5124('0x61')]=_0x118f45;}return _0x54dc5;});});}else{return;}})['then'](function(_0x8af952){if(_0x8af952)_0x276e0a=_0x8af952;if(_[_0x5124('0x62')](_0x4b0a04,0x3eb)){var _0x2dca17=_[_0x5124('0x4b')](_0x276e0a,{'sectionId':0x3eb});return getCustomDashboards(_0x2dca17)['then'](function(_0x16a1fe){return _[_0x5124('0x54')](_0x276e0a,function(_0x34f8e5){if(_0x2dca17[_0x5124('0x63')]){if(_0x34f8e5[_0x5124('0x55')]===0x3eb){_0x34f8e5[_0x5124('0x61')]=_0x16a1fe;}}else{if(_0x34f8e5[_0x5124('0x55')]===0x64){if(!_0x34f8e5['subsections']){_0x34f8e5[_0x5124('0x61')]=[];}_0x34f8e5[_0x5124('0x61')]=_0x34f8e5[_0x5124('0x61')][_0x5124('0x64')](_0x16a1fe);}}return _0x34f8e5;});});}else{return;}})['then'](function(_0x30cec6){if(_0x30cec6)_0x276e0a=_0x30cec6;if(_[_0x5124('0x62')](_0x4b0a04,0x709)){var _0x290ea9=_['find'](_0x276e0a,{'sectionId':0x709});return getPlugins(_0x290ea9)['then'](function(_0x264e9c){if(_0x290ea9[_0x5124('0x63')]){return _['map'](_0x276e0a,function(_0x38e780){if(_0x38e780[_0x5124('0x55')]===0x709){_0x38e780[_0x5124('0x61')]=_0x264e9c;}return _0x38e780;});}else{var _0x3bbe4c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x264e9c};var _0x47aa86=_[_0x5124('0x54')](_0x276e0a);_0x47aa86[_0x5124('0x65')](_0x3bbe4c);return _0x47aa86;}});}else{return;}})[_0x5124('0x24')](function(_0x5050af){if(_0x5050af)_0x276e0a=_0x5050af;return _['filter'](_0x276e0a,['enabled',0x1]);})[_0x5124('0x24')](respondWithResult(_0x25afa4,null))['catch'](handleError(_0x25afa4,null));};function hasDefaultDashboard(_0x38af89){var _0x394476=[0x65];return new BPromise(function(_0x34a839,_0x54df3b){try{if(_0x38af89['autoAssociation']){_0x34a839(_0x394476);}else{return db[_0x5124('0x59')][_0x5124('0x66')]({'where':{'sectionId':_0x38af89['id']},'raw':!![]})[_0x5124('0x24')](function(_0x5f5dc2){_0x5f5dc2?_0x34a839(_0x394476):_0x34a839();});}}catch(_0x39ff92){_0x54df3b(_0x39ff92);}});}function getCustomDashboards(_0x4cd1e3){var _0x2fe3ab=[];return new BPromise(function(_0xa6a2cd,_0x1f5b82){try{if(_0x4cd1e3[_0x5124('0x53')]){return db[_0x5124('0x67')]['findAll']({'raw':!![]})[_0x5124('0x24')](function(_0x400d32){_0x400d32['forEach'](function(_0x4ccd4c){_0x2fe3ab['push'](_0x4ccd4c['id']+0x1869f);});_0xa6a2cd(_0x2fe3ab);});}else{return db[_0x5124('0x59')]['findAll']({'where':{'sectionId':_0x4cd1e3['id']},'raw':!![]})[_0x5124('0x24')](function(_0x1f156d){_0x1f156d['forEach'](function(_0x20cc24){_0x2fe3ab[_0x5124('0x65')](_0x20cc24[_0x5124('0x68')]+0x1869f);});_0xa6a2cd(_0x2fe3ab);});}}catch(_0x4cb0c0){_0x1f5b82(_0x4cb0c0);}});}function getPlugins(_0x16ee4a){var _0x1e6dbe=[];return new BPromise(function(_0xae48e5,_0x456532){try{if(_0x16ee4a['autoAssociation']){return db['Plugin'][_0x5124('0x43')]({'raw':!![]})[_0x5124('0x24')](function(_0x5df032){_0x5df032[_0x5124('0x69')](function(_0x34edf5){_0x1e6dbe[_0x5124('0x65')](_0x34edf5['id']+0x15b38);});_0xae48e5(_0x1e6dbe);});}else{return db[_0x5124('0x59')][_0x5124('0x43')]({'where':{'sectionId':_0x16ee4a['id']},'raw':!![]})['then'](function(_0x18aac9){_0x18aac9[_0x5124('0x69')](function(_0x30f2bb){_0x1e6dbe['push'](_0x30f2bb[_0x5124('0x68')]+0x15b38);});_0xae48e5(_0x1e6dbe);});}}catch(_0x55fd57){_0x456532(_0x55fd57);}});}exports[_0x5124('0x6a')]=function(_0x2857ab,_0x40c1be){return db[_0x5124('0x40')][_0x5124('0x4b')]({'where':{'id':_0x2857ab[_0x5124('0x46')]['id']}})[_0x5124('0x24')](handleEntityNotFound(_0x40c1be,null))['then'](function(_0x2f5ca9){if(_0x2f5ca9){return db[_0x5124('0x51')][_0x5124('0x52')](function(_0x2536c6){return db[_0x5124('0x58')][_0x5124('0x43')]({'where':{'userProfileId':_0x2857ab[_0x5124('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x5124('0x24')](function(_0x5866c6){if(_0x5866c6){return db['UserProfileSection'][_0x5124('0x25')]({'where':{'userProfileId':_0x2857ab['params']['id'],'id':_[_0x5124('0x54')](_0x5866c6,function(_0x2d6da6){return _0x2d6da6['id'];})},'transaction':_0x2536c6});}})[_0x5124('0x24')](function(_0x512df5){var _0x40dee8=_[_0x5124('0x54')](_0x2857ab['body'],function(_0x418af3){_0x418af3['userProfileId']=_0x2857ab[_0x5124('0x46')]['id'];return _0x418af3;});return db[_0x5124('0x58')][_0x5124('0x6b')](_0x40dee8,{'raw':!![],'transaction':_0x2536c6});})[_0x5124('0x24')](function(_0x424148){var _0x596851=_['filter'](_[_0x5124('0x54')](_0x424148,function(_0x4ca06d){return _0x4ca06d[_0x5124('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x596851){return db[_0x5124('0x58')][_0x5124('0x43')]({'where':{'userProfileId':_0x2857ab['params']['id'],'sectionId':_[_0x5124('0x54')](_0x596851,function(_0x303c20){return _0x303c20[_0x5124('0x55')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x2eb7d4){var _0x27fd79=_[_0x5124('0x54')](_0x2857ab[_0x5124('0x48')],function(_0x33ee1e){_0x33ee1e['userProfileId']=_0x2857ab[_0x5124('0x46')]['id'];return _0x33ee1e;});return db['UserProfileResource'][_0x5124('0x6b')](_0x27fd79,{'raw':!![],'transaction':_0x2536c6});});}})[_0x5124('0x49')](handleError(_0x40c1be,null));});}})[_0x5124('0x24')](function(_0x326ad4){var _0x14aa83=_[_0x5124('0x54')](_0x326ad4,function(_0x480202){return _0x480202[_0x5124('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x40c1be,null))[_0x5124('0x49')](handleError(_0x40c1be,null));};exports['removeResources']=function(_0x18cfa8,_0x27c851,_0x67c40b){return db['UserProfile']['find']({'where':{'id':_0x18cfa8[_0x5124('0x46')]['id']}})[_0x5124('0x24')](handleEntityNotFound(_0x27c851,null))[_0x5124('0x24')](function(_0x4d57ed){if(_0x4d57ed){return _0x4d57ed['removeResources'](_0x18cfa8[_0x5124('0x2e')][_0x5124('0x5e')]);}})[_0x5124('0x24')](respondWithStatusCode(_0x27c851,null))[_0x5124('0x49')](handleError(_0x27c851,null));};exports[_0x5124('0x6c')]=function(_0x3b4251,_0x3844d8){var _0x2ee16d={};if(!_0x3b4251[_0x5124('0x2e')][_0x5124('0x6d')])throw new Error(_0x5124('0x6e'));if(!_0x3b4251[_0x5124('0x2e')][_0x5124('0x34')](_0x5124('0x35'))){_0x2ee16d[_0x5124('0x22')]=qs[_0x5124('0x22')](_0x3b4251['query'][_0x5124('0x22')]);_0x2ee16d[_0x5124('0x21')]=qs[_0x5124('0x21')](_0x3b4251[_0x5124('0x2e')]['offset']);}return db[_0x5124('0x40')][_0x5124('0x4b')]({'where':{'id':_0x3b4251[_0x5124('0x46')]['id']}})['then'](function(_0x2e70ef){if(!_0x2e70ef)throw new Error(_0x5124('0x6f')+_0x3b4251[_0x5124('0x46')]['id']);return db[_0x5124('0x40')][_0x5124('0x6c')](_0x3b4251);})['then'](respondWithFilteredResult(_0x3844d8,_0x2ee16d))['catch'](handleError(_0x3844d8,null));};
\ No newline at end of file
index 15d0567..fc5910d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3588=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x335712,_0x321dd0){var _0x13949a=function(_0x594320){while(--_0x594320){_0x335712['push'](_0x335712['shift']());}};_0x13949a(++_0x321dd0);}(_0x3588,0x82));var _0x8358=function(_0x59df9c,_0x5668b9){_0x59df9c=_0x59df9c-0x0;var _0x248b8a=_0x3588[_0x59df9c];return _0x248b8a;};'use strict';var EventEmitter=require(_0x8358('0x0'));var UserProfile=require(_0x8358('0x1'))['db'][_0x8358('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8358('0x3')](0x0);var events={'afterCreate':_0x8358('0x4'),'afterUpdate':_0x8358('0x5'),'afterDestroy':_0x8358('0x6')};function emitEvent(_0x586dd2){return function(_0x3fd803,_0xa7a3d4,_0x146ed6){UserProfileEvents[_0x8358('0x7')](_0x586dd2+':'+_0x3fd803['id'],_0x3fd803);UserProfileEvents['emit'](_0x586dd2,_0x3fd803);_0x146ed6(null);};}for(var e in events){if(events[_0x8358('0x8')](e)){var event=events[e];UserProfile[_0x8358('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents;
\ No newline at end of file
+var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x2040dd,_0x156a63){var _0x27688f=function(_0xb90c80){while(--_0xb90c80){_0x2040dd['push'](_0x2040dd['shift']());}};_0x27688f(++_0x156a63);}(_0x2ef3,0xba));var _0x32ef=function(_0x3279ee,_0x173d3b){_0x3279ee=_0x3279ee-0x0;var _0x4dcd29=_0x2ef3[_0x3279ee];return _0x4dcd29;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var UserProfile=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){UserProfileEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);UserProfileEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=UserProfileEvents;
\ No newline at end of file
index ec8ba31..f87038b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c11=['options','includeAll','include','reportType','default','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','Tag','Tags','tag','openTabs','true','chat','sms','dataValues','fax','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','then','associatedResources','model','findAll','map','name','catch','resolve','UserProfileResource','field','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','mailqueues','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Dashboard','intervals','pauses','scheduler','Sound','tags','templates','Template','triggers','trunks','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','SELECT','select','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','union','length','ignore','push','autoAssociation','all','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach'];(function(_0x29aed5,_0x245b34){var _0x432488=function(_0x579062){while(--_0x579062){_0x29aed5['push'](_0x29aed5['shift']());}};_0x432488(++_0x245b34);}(_0x6c11,0x19a));var _0x16c1=function(_0x2c286f,_0x5c75ce){_0x2c286f=_0x2c286f-0x0;var _0x5d8f64=_0x6c11[_0x2c286f];return _0x5d8f64;};'use strict';var _=require(_0x16c1('0x0'));var attributes=require(_0x16c1('0x1'));var qs=require(_0x16c1('0x2'));var squel=require(_0x16c1('0x3'));module[_0x16c1('0x4')]=function(_0x3b4717){var _0x59280b=_0x3b4717[_0x16c1('0x5')];function _0x4f754f(_0x33be98,_0x174ce7){return new Promise(function(_0x2158f1,_0x24076b){if(!_0x174ce7)return _0x2158f1(null);var _0x3ef2ce=_0x174ce7[_0x16c1('0x6')]?{[_0x174ce7[_0x16c1('0x6')]['field']]:_0x174ce7[_0x16c1('0x6')]['value']}:undefined;return _0x59280b[_0x33be98]['findAll']({'where':_0x3ef2ce,'raw':!![]})[_0x16c1('0x7')](function(_0x54f0dc){_0x174ce7[_0x16c1('0x8')]=_['map'](_0x54f0dc,'id');_0x2158f1(_0x174ce7);})['catch'](function(_0x420a9f){_0x24076b(_0x420a9f);});});}function _0x1d002e(_0xf47b19,_0x2fe7f7){return new Promise(function(_0x38b57c,_0x5de4a1){var _0x43b984=_0xf47b19[_0x16c1('0x6')]?{[_0xf47b19[_0x16c1('0x6')]['field']]:_0xf47b19[_0x16c1('0x6')]['value']}:undefined;return _0x59280b[_0xf47b19[_0x16c1('0x9')]][_0x16c1('0xa')]({'where':_0x43b984,'raw':!![]})[_0x16c1('0x7')](function(_0x52c950){_0x2fe7f7[_0x16c1('0x8')]=_[_0x16c1('0xb')](_0x52c950,function(_0x3a5fe2){return _0x3a5fe2[_0x16c1('0xc')];});_0x38b57c(_0x2fe7f7);})[_0x16c1('0xd')](function(_0x28841c){_0x5de4a1(_0x28841c);});});}function _0x284797(_0x3acd02,_0x279670,_0xe23422){if(!_0x279670)return Promise[_0x16c1('0xe')](null);return new Promise(function(_0xf26216,_0x2636cc){return _0x59280b[_0x16c1('0xf')]['findAll']({'where':{'sectionId':_0x279670['id']},'raw':!![]})[_0x16c1('0x7')](function(_0x5484cb){if(_0x3acd02[_0x16c1('0x10')]&&_0x3acd02[_0x16c1('0x10')]!=='id'){_0x279670[_0x16c1('0x8')]=_[_0x16c1('0xb')](_0x5484cb,function(_0x5d8bf7){return _0x5d8bf7[_0x3acd02[_0x16c1('0x10')]];});}else{if(_0xe23422===_0x16c1('0x11')){_0x279670[_0x16c1('0x8')]=_[_0x16c1('0xb')](_0x5484cb,function(_0x19019e){return{'id':_0x19019e['resourceId'],'type':_0x19019e[_0x16c1('0x12')]};});}else{_0x279670['associatedResources']=_[_0x16c1('0xb')](_0x5484cb,function(_0x40f38c){return _0x40f38c[_0x16c1('0x13')];});}}_0xf26216(_0x279670);})[_0x16c1('0xd')](function(_0x1c4a7b){_0x2636cc(_0x1c4a7b);});});}function _0x32af69(_0x188f97,_0x193de6){var _0x38703c={'parentSections':[]};switch(_0x188f97[_0x16c1('0x14')]()){case _0x16c1('0x15'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x17');break;case _0x16c1('0x18'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x19');break;case _0x16c1('0x1a'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x1b');_0x38703c[_0x16c1('0x1c')]=[{'name':_0x16c1('0x1d'),'field':'name','foreignKey':_0x16c1('0x1e')}];break;case _0x16c1('0x1f'):_0x38703c['childModel']=_0x16c1('0x20');break;case'contacts':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x21');_0x38703c['parentSections']=[{'name':_0x16c1('0x22'),'field':'id','foreignKey':_0x16c1('0x23')}];break;case'lists':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x24');break;case _0x16c1('0x25'):_0x38703c['childModel']=_0x16c1('0x26');break;case _0x16c1('0x27'):_0x38703c[_0x16c1('0x16')]='CmCustomField';break;case _0x16c1('0x28'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x29');break;case _0x16c1('0x2a'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x2b');break;case _0x16c1('0x2c'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x2d');break;case'faxaccounts':_0x38703c[_0x16c1('0x16')]='FaxAccount';break;case'inboundroutes':case _0x16c1('0x2e'):case'outboundroutes':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x2f');break;case _0x16c1('0x30'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x31');break;case _0x16c1('0x32'):_0x38703c['childModel']=_0x16c1('0x33');break;case _0x16c1('0x34'):_0x38703c['childModel']=_0x16c1('0x35');_0x38703c['parentSections']=[{'name':'Agents','field':_0x16c1('0xc'),'foreignKey':_0x16c1('0x36'),'model':_0x16c1('0x37'),'filter':{'field':'role','value':['agent']}},{'name':'Telephones','field':_0x16c1('0xc'),'foreignKey':'membername','model':_0x16c1('0x37'),'filter':{'field':_0x16c1('0x38'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x16c1('0xc'),'foreignKey':_0x16c1('0x39'),'model':_0x16c1('0x3a'),'filter':{'field':_0x16c1('0x12'),'value':[_0x16c1('0x3b')]}},{'name':_0x16c1('0x3c'),'field':_0x16c1('0xc'),'foreignKey':_0x16c1('0x39'),'model':_0x16c1('0x3a'),'filter':{'field':'type','value':[_0x16c1('0x3d')]}}];break;case _0x16c1('0x3e'):_0x38703c['childModel']=_0x16c1('0x3f');break;case _0x16c1('0x40'):_0x38703c[_0x16c1('0x16')]='VoiceChanSpy';break;case _0x16c1('0x41'):_0x38703c['childModel']='VoicePrefix';break;case _0x16c1('0x42'):_0x38703c[_0x16c1('0x16')]='Campaign';break;case _0x16c1('0x43'):_0x38703c[_0x16c1('0x16')]='MailQueue';break;case _0x16c1('0x44'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x45');break;case _0x16c1('0x46'):_0x38703c[_0x16c1('0x16')]='MailSubstatus';break;case'openchannelqueues':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x47');break;case _0x16c1('0x48'):_0x38703c[_0x16c1('0x16')]='OpenchannelAccount';break;case _0x16c1('0x49'):_0x38703c['childModel']=_0x16c1('0x4a');break;case'smsaccounts':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x4b');break;case'whatsappqueues':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x4c');break;case _0x16c1('0x4d'):_0x38703c['childModel']=_0x16c1('0x4e');break;case _0x16c1('0x4f'):_0x38703c['childModel']=_0x16c1('0x50');break;case _0x16c1('0x51'):case _0x16c1('0x52'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x3a');if(_0x193de6){_0x38703c[_0x16c1('0x1c')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x16c1('0x53'):case _0x16c1('0x54'):case _0x16c1('0x55'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x37');if(_0x193de6){_0x38703c[_0x16c1('0x1c')]=[{'name':_0x16c1('0x56'),'filter':{'field':_0x16c1('0x38'),'value':[_0x16c1('0x57'),_0x16c1('0x58')]},'ignore':!![]},{'name':_0x16c1('0x59')},{'name':'Telephones'}];}break;case _0x16c1('0x5a'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x5b');break;case _0x16c1('0x5c'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x5d');break;case _0x16c1('0x5e'):_0x38703c['childModel']=_0x16c1('0x5f');break;case _0x16c1('0x60'):_0x38703c['childModel']=_0x16c1('0x61');break;case _0x16c1('0x62'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x63');break;case'zohoaccounts':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x64');break;case _0x16c1('0x65'):_0x38703c['childModel']=_0x16c1('0x37');break;case'cannedanswers':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x66');break;case _0x16c1('0x67'):_0x38703c[_0x16c1('0x16')]='Disposition';break;case'customdashboards':_0x38703c['childModel']=_0x16c1('0x68');break;case _0x16c1('0x69'):_0x38703c[_0x16c1('0x16')]='Interval';break;case _0x16c1('0x6a'):_0x38703c[_0x16c1('0x16')]='Pause';break;case _0x16c1('0x6b'):_0x38703c[_0x16c1('0x16')]='Schedule';break;case'sounds':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x6c');break;case _0x16c1('0x6d'):_0x38703c[_0x16c1('0x16')]='Tag';break;case _0x16c1('0x6e'):_0x38703c['childModel']=_0x16c1('0x6f');break;case _0x16c1('0x70'):_0x38703c['childModel']='Trigger';break;case _0x16c1('0x71'):_0x38703c[_0x16c1('0x16')]='Trunk';break;case'variables':_0x38703c[_0x16c1('0x16')]=_0x16c1('0x72');break;case _0x16c1('0x73'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x74');break;case _0x16c1('0x75'):_0x38703c[_0x16c1('0x16')]=_0x16c1('0x11');_0x38703c[_0x16c1('0x1c')]=[{'name':'Reports','field':'id','foreignKey':_0x16c1('0x76')}];break;case _0x16c1('0x77'):_0x38703c['childModel']=_0x16c1('0x78');break;}return _0x38703c;}function _0x8b185(_0x2473ff,_0x39392a){var _0x63122b=_0x2473ff[_0x16c1('0x79')](0x0)[_0x16c1('0x7a')]()+_0x2473ff[_0x16c1('0x7b')](0x1);var _0x59810a={'type':_0x59280b['Sequelize']['QueryTypes'][_0x16c1('0x7c')],'raw':!![]};return new Promise(function(_0x36262f,_0x1a6056){var _0x55d8cf=squel[_0x16c1('0x7d')]()[_0x16c1('0x10')]('ui.'+_0x63122b+_0x16c1('0x7e'),'id')[_0x16c1('0x10')](_0x16c1('0x7f'))[_0x16c1('0x80')]('user_has_'+_0x2473ff+_0x16c1('0x81'),'ui')[_0x16c1('0x82')](_0x16c1('0x83'),_0x39392a['id']);return _0x59280b[_0x16c1('0x84')][_0x16c1('0x85')](_0x55d8cf[_0x16c1('0x86')](),_0x59810a)['then'](function(_0x3182fe){_0x39392a[_0x63122b+_0x16c1('0x87')]=_0x3182fe;_0x36262f(_0x3182fe);})['catch'](function(_0x3bbec2){_0x1a6056(_0x3bbec2);});});}return _0x3b4717[_0x16c1('0x88')](_0x16c1('0x89'),attributes,{'tableName':_0x16c1('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x9b3f15){var _0x5c05ad={'raw':_0x9b3f15[_0x16c1('0x85')][_0x16c1('0x8b')],'where':{}};var _0x3d81a0={};var _0x3ba2df={'count':0x0,'rows':[]};var _0x1ae1d1=_0x9b3f15[_0x16c1('0x85')][_0x16c1('0x8c')];var _0x380f64=_0x9b3f15[_0x16c1('0x85')][_0x16c1('0x8d')]||![];var _0x362e0d=_0x32af69(_0x1ae1d1,_0x380f64);if(!_0x362e0d[_0x16c1('0x16')])throw new Error(_0x16c1('0x8e')+_0x1ae1d1+'\x27');var _0x17ee04=[{'name':_0x1ae1d1}];if(!_[_0x16c1('0x8f')](_0x362e0d[_0x16c1('0x1c')]))_0x17ee04=_0x362e0d[_0x16c1('0x1c')];var _0x2a4e8b=[];for(var _0xd7c740=0x0;_0xd7c740<_0x17ee04['length'];_0xd7c740++){_0x2a4e8b['push'](_0x59280b[_0x16c1('0x90')][_0x16c1('0x91')]({'where':{'userProfileId':_0x9b3f15[_0x16c1('0x92')]['id'],'name':_0x17ee04[_0xd7c740][_0x16c1('0xc')]},'raw':!![]}));}return Promise['all'](_0x2a4e8b)[_0x16c1('0x7')](function(_0x4af66e){var _0x541cca=_['filter'](_0x4af66e,function(_0x5af80b){return _0x5af80b?_0x5af80b:undefined;});var _0x29622f=_[_0x16c1('0x6')](_0x17ee04,['ignore',!![]]);var _0x91a26d=_[_0x16c1('0x8f')](_0x541cca)&&_[_0x16c1('0x8f')](_0x29622f)?null:_[_0x16c1('0x93')](_0x29622f,_0x541cca);if(!_0x91a26d)return null;var _0xc79ac3=[];for(var _0x3700cf=0x0;_0x3700cf<_0x91a26d[_0x16c1('0x94')];_0x3700cf++){var _0x23b5a2=_[_0x16c1('0x91')](_0x17ee04,function(_0x37247d){return _0x91a26d[_0x3700cf]?_0x37247d[_0x16c1('0xc')]===_0x91a26d[_0x3700cf]['name']:null;});if(_0x23b5a2){if(_0x91a26d[_0x3700cf][_0x16c1('0x95')]){_0xc79ac3[_0x16c1('0x96')](_0x4f754f(_0x362e0d['childModel'],_0x91a26d[_0x3700cf]));}else{if(!_0x91a26d[_0x3700cf][_0x16c1('0x97')]){_0xc79ac3[_0x16c1('0x96')](_0x284797(_0x23b5a2,_0x91a26d[_0x3700cf],_0x362e0d[_0x16c1('0x16')]));}else{if(_0x23b5a2[_0x16c1('0x9')]){_0xc79ac3[_0x16c1('0x96')](_0x1d002e(_0x23b5a2,_0x91a26d[_0x3700cf]));}}}}}return Promise[_0x16c1('0x98')](_0xc79ac3);})[_0x16c1('0x7')](function(_0x489d61){var _0x2ff8bf=_0x489d61;var _0x2ac59f=null;if(_0x2ff8bf){_0x2ac59f=_0x2ff8bf['length']===0x1?_0x2ff8bf[0x0]:null;}if(!_0x2ac59f&&!_0x2ff8bf)return _0x3ba2df;var _0xdfe970=_0x59280b[_0x362e0d[_0x16c1('0x16')]]['rawAttributes'];_0x3d81a0[_0x16c1('0x9')]=_[_0x16c1('0x99')](_0xdfe970);_0x3d81a0[_0x16c1('0x85')]=_['keys'](_0x9b3f15['query']);_0x3d81a0[_0x16c1('0x9a')]=_[_0x16c1('0x9b')](_0x3d81a0[_0x16c1('0x9')],_0x3d81a0['query']);_0x5c05ad[_0x16c1('0x9c')]=_[_0x16c1('0x9b')](_0x3d81a0[_0x16c1('0x9')],qs[_0x16c1('0x9d')](_0x9b3f15[_0x16c1('0x85')][_0x16c1('0x9d')]));_0x5c05ad[_0x16c1('0x9c')]=_0x5c05ad[_0x16c1('0x9c')][_0x16c1('0x94')]?_0x5c05ad[_0x16c1('0x9c')]:_0x3d81a0[_0x16c1('0x9')];if(!_0x9b3f15['query'][_0x16c1('0x9e')](_0x16c1('0x9f'))){_0x5c05ad[_0x16c1('0xa0')]=qs[_0x16c1('0xa0')](_0x9b3f15['query'][_0x16c1('0xa0')]);_0x5c05ad['offset']=qs['offset'](_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xa1')]);}_0x5c05ad['order']=qs[_0x16c1('0xa2')](_0x9b3f15[_0x16c1('0x85')]['sort']);_0x5c05ad['where']=qs[_0x16c1('0x9a')](_[_0x16c1('0xa3')](_0x9b3f15[_0x16c1('0x85')],_0x3d81a0[_0x16c1('0x9a')]));if(_0x9b3f15['query'][_0x16c1('0x6')]){_0x5c05ad[_0x16c1('0x82')]=_[_0x16c1('0xa4')](_0x5c05ad['where'],{'$or':_[_0x16c1('0xb')](_0xdfe970,function(_0x5d4c48){if(_0x5d4c48['type'][_0x16c1('0xa5')]!==_0x16c1('0xa6')){var _0x535112={};_0x535112[_0x5d4c48[_0x16c1('0x10')]]={'$like':'%'+_0x9b3f15[_0x16c1('0x85')][_0x16c1('0x6')]+'%'};return _0x535112;}})});}var _0x29160f=[];var _0x2f01f5=null;var _0x163e90={};if(_0x2ac59f){_0x2f01f5=_['find'](_0x17ee04,[_0x16c1('0xc'),_0x2ac59f[_0x16c1('0xc')]]);if(_0x2f01f5[_0x16c1('0x10')]){_0x163e90={};if(_0x362e0d['childModel']==='AnalyticExtractedReport'){_0x163e90[_0x2f01f5['foreignKey']]=_[_0x16c1('0xb')](_0x2ac59f[_0x16c1('0x8')],'id');}else{_0x163e90[_0x2f01f5[_0x16c1('0xa7')]]=_0x2ac59f[_0x16c1('0x8')];}_0x29160f[_0x16c1('0x96')](_0x163e90);}else{_0x5c05ad[_0x16c1('0x82')]['id']=_0x2ac59f['associatedResources'];}}else{for(var _0x412d5a=0x0;_0x412d5a<_0x2ff8bf[_0x16c1('0x94')];_0x412d5a++){_0x2f01f5=_[_0x16c1('0x91')](_0x17ee04,['name',_0x2ff8bf[_0x412d5a]['name']]);if(_0x2f01f5[_0x16c1('0x10')]){_0x163e90={};_0x163e90[_0x2f01f5[_0x16c1('0xa7')]]=_0x2ff8bf[_0x412d5a][_0x16c1('0x8')];_0x29160f['push'](_0x163e90);}else{if(!_0x5c05ad[_0x16c1('0x82')]['id'])_0x5c05ad[_0x16c1('0x82')]['id']=[];_0x2ff8bf[_0x412d5a][_0x16c1('0x8')][_0x16c1('0xa8')](function(_0x47d028){_0x5c05ad[_0x16c1('0x82')]['id'][_0x16c1('0x96')](_0x47d028);});}}}if(!_[_0x16c1('0x8f')](_0x29160f)){_0x5c05ad[_0x16c1('0x82')]=_[_0x16c1('0xa4')](_0x5c05ad['where'],{'$and':{'$or':_0x29160f}});}_0x5c05ad=_[_0x16c1('0xa4')]({},_0x5c05ad,_0x9b3f15[_0x16c1('0xa9')]);if(_0x2ac59f&&!_0x2ac59f['autoAssociation']&&_0x362e0d[_0x16c1('0x16')]==='AnalyticExtractedReport'){if(_0x9b3f15['query'][_0x16c1('0xaa')]){_0x5c05ad[_0x16c1('0xab')]=[{'all':!![]}];}return _0x59280b[_0x362e0d[_0x16c1('0x16')]][_0x16c1('0xa')](_0x5c05ad)[_0x16c1('0x7')](function(_0xb0c4af){var _0x282424=[];_0xb0c4af[_0x16c1('0xa8')](function(_0xb23119){var _0x1015bc;switch(_0xb23119[_0x16c1('0xac')]){case _0x16c1('0xad'):_0x1015bc=_[_0x16c1('0x91')](_0x2ac59f['associatedResources'],function(_0x52d22e){return _0x52d22e['id']===_0xb23119['reportId']&&_0x52d22e[_0x16c1('0x12')]==='DefaultReports';});break;case _0x16c1('0xae'):_0x1015bc=_[_0x16c1('0x91')](_0x2ac59f[_0x16c1('0x8')],function(_0x4d6fb5){return _0x4d6fb5['id']===_0xb23119[_0x16c1('0x76')]&&_0x4d6fb5['type']===_0x16c1('0xaf');});break;}if(_0x1015bc)_0x282424[_0x16c1('0x96')](_0xb23119);});_0x3ba2df[_0x16c1('0xb0')]=_0x282424[_0x16c1('0x94')];_0x3ba2df[_0x16c1('0xb1')]=_0x282424;return _0x3ba2df;});}else{if(!_[_0x16c1('0x8f')](_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb2')])){_0x5c05ad[_0x16c1('0x82')]['id']=_0x5c05ad[_0x16c1('0x82')]['id']?_[_0x16c1('0x9b')](_0x5c05ad[_0x16c1('0x82')]['id'],_0x9b3f15[_0x16c1('0x85')]['ids']):_0x9b3f15[_0x16c1('0x85')]['ids'];if(_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb3')]){_0x5c05ad[_0x16c1('0xb4')]=_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb3')];}}if(_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb5')]){_0x5c05ad[_0x16c1('0x82')]=_[_0x16c1('0xa4')](_0x5c05ad[_0x16c1('0x82')],{'$and':_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb5')]});}return _0x59280b[_0x362e0d['childModel']]['count']({'where':_0x5c05ad['where']})['then'](function(_0x2241d3){_0x3ba2df[_0x16c1('0xb0')]=_0x2241d3;if(_0x9b3f15[_0x16c1('0x85')]['includeAll']){if(_0x362e0d[_0x16c1('0x16')]===_0x16c1('0x21')){_0x5c05ad[_0x16c1('0xab')]=[{'model':_0x59280b[_0x16c1('0xb6')],'as':_0x16c1('0xb7'),'attributes':['id',_0x16c1('0xc'),'color'],'required':_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb8')]?!![]:![]},{'model':_0x59280b[_0x16c1('0xb6')],'as':'ThroughTags','attributes':['id',_0x16c1('0xc'),'color'],'through':_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb8')]?{'attributes':[],'where':{'TagId':_0x9b3f15[_0x16c1('0x85')]['tag']||undefined}}:{},'required':_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb8')]?!![]:![]}];}else{_0x5c05ad[_0x16c1('0xab')]=[{'all':!![]}];}}return _0x59280b[_0x362e0d[_0x16c1('0x16')]][_0x16c1('0xa')](_0x5c05ad);})[_0x16c1('0x7')](function(_0x42d531){_0x3ba2df[_0x16c1('0xb1')]=_0x42d531;if(_0x1ae1d1===_0x16c1('0x59')&&_0x9b3f15[_0x16c1('0x85')][_0x16c1('0xb9')]===_0x16c1('0xba')){var _0x2ef720=[];for(var _0x35f8a7=0x0;_0x35f8a7<_0x3ba2df[_0x16c1('0xb1')][_0x16c1('0x94')];_0x35f8a7++){_0x2ef720[_0x16c1('0x96')](_0x8b185(_0x16c1('0xbb'),_0x3ba2df['rows'][_0x35f8a7]['dataValues']));_0x2ef720[_0x16c1('0x96')](_0x8b185(_0x16c1('0xbc'),_0x3ba2df[_0x16c1('0xb1')][_0x35f8a7][_0x16c1('0xbd')]));_0x2ef720['push'](_0x8b185(_0x16c1('0xbe'),_0x3ba2df[_0x16c1('0xb1')][_0x35f8a7][_0x16c1('0xbd')]));_0x2ef720[_0x16c1('0x96')](_0x8b185('mail',_0x3ba2df[_0x16c1('0xb1')][_0x35f8a7][_0x16c1('0xbd')]));_0x2ef720[_0x16c1('0x96')](_0x8b185(_0x16c1('0xbf'),_0x3ba2df[_0x16c1('0xb1')][_0x35f8a7][_0x16c1('0xbd')]));_0x2ef720[_0x16c1('0x96')](_0x8b185(_0x16c1('0xc0'),_0x3ba2df['rows'][_0x35f8a7][_0x16c1('0xbd')]));}return Promise[_0x16c1('0x98')](_0x2ef720)[_0x16c1('0x7')](function(){return _0x3ba2df;});}return _0x3ba2df;});}});}}});};
\ No newline at end of file
+var _0xb7fa=['musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','sounds','Sound','tags','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','section','mergeResources','Invalid\x20section\x20\x27','length','push','params','ignore','find','autoAssociation','all','keys','attributes','hasOwnProperty','nolimit','limit','offset','order','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','isEmpty','options','include','DefaultReports','custom','CustomReports','count','rows','intersection','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tag','color','ThroughTags','tag','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','catch','model','then','map','UserProfileResource','AnalyticExtractedReport','type','associatedResources','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','name','projectName','projects','JscriptyProject','contacts','parentSections','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','QueueCampaigns','VoiceQueue','outbound'];(function(_0x3858cf,_0xb76175){var _0x31300c=function(_0x47f875){while(--_0x47f875){_0x3858cf['push'](_0x3858cf['shift']());}};_0x31300c(++_0xb76175);}(_0xb7fa,0x7f));var _0xab7f=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xb7fa[_0x5a1a51];return _0x47edd7;};'use strict';var _=require(_0xab7f('0x0'));var attributes=require(_0xab7f('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0xab7f('0x2'));module[_0xab7f('0x3')]=function(_0x154b1c){var _0x8800a3=_0x154b1c[_0xab7f('0x4')];function _0x4f8573(_0x12ecca,_0x4ec797){return new Promise(function(_0x19ab4a,_0x11fde7){if(!_0x4ec797)return _0x19ab4a(null);var _0x21457b=_0x4ec797[_0xab7f('0x5')]?{[_0x4ec797[_0xab7f('0x5')][_0xab7f('0x6')]]:_0x4ec797[_0xab7f('0x5')][_0xab7f('0x7')]}:undefined;return _0x8800a3[_0x12ecca][_0xab7f('0x8')]({'where':_0x21457b,'raw':!![]})['then'](function(_0x441d57){_0x4ec797['associatedResources']=_['map'](_0x441d57,'id');_0x19ab4a(_0x4ec797);})[_0xab7f('0x9')](function(_0x326c2f){_0x11fde7(_0x326c2f);});});}function _0x2514cf(_0xbcb469,_0x414e47){return new Promise(function(_0x5f49f2,_0x46e18c){var _0x2b74b5=_0xbcb469['filter']?{[_0xbcb469[_0xab7f('0x5')][_0xab7f('0x6')]]:_0xbcb469[_0xab7f('0x5')][_0xab7f('0x7')]}:undefined;return _0x8800a3[_0xbcb469[_0xab7f('0xa')]][_0xab7f('0x8')]({'where':_0x2b74b5,'raw':!![]})[_0xab7f('0xb')](function(_0x1f96eb){_0x414e47['associatedResources']=_[_0xab7f('0xc')](_0x1f96eb,function(_0x34a0d3){return _0x34a0d3['name'];});_0x5f49f2(_0x414e47);})[_0xab7f('0x9')](function(_0x2596aa){_0x46e18c(_0x2596aa);});});}function _0x526b32(_0x62fbf0,_0x22107b,_0x18014f){if(!_0x22107b)return Promise['resolve'](null);return new Promise(function(_0x306a97,_0x2b9acf){return _0x8800a3[_0xab7f('0xd')][_0xab7f('0x8')]({'where':{'sectionId':_0x22107b['id']},'raw':!![]})[_0xab7f('0xb')](function(_0x4adfc2){if(_0x62fbf0[_0xab7f('0x6')]&&_0x62fbf0[_0xab7f('0x6')]!=='id'){_0x22107b['associatedResources']=_[_0xab7f('0xc')](_0x4adfc2,function(_0x26b0d3){return _0x26b0d3[_0x62fbf0[_0xab7f('0x6')]];});}else{if(_0x18014f===_0xab7f('0xe')){_0x22107b['associatedResources']=_[_0xab7f('0xc')](_0x4adfc2,function(_0x52f41f){return{'id':_0x52f41f['resourceId'],'type':_0x52f41f[_0xab7f('0xf')]};});}else{_0x22107b[_0xab7f('0x10')]=_[_0xab7f('0xc')](_0x4adfc2,function(_0x3a423b){return _0x3a423b['resourceId'];});}}_0x306a97(_0x22107b);})['catch'](function(_0x1c5e4d){_0x2b9acf(_0x1c5e4d);});});}function _0x1bc3d2(_0x3bb729,_0x3d185b){var _0x2e0065={'parentSections':[]};switch(_0x3bb729[_0xab7f('0x11')]()){case _0xab7f('0x12'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x14');break;case _0xab7f('0x15'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x16');break;case _0xab7f('0x17'):_0x2e0065[_0xab7f('0x13')]='SquareRecording';_0x2e0065['parentSections']=[{'name':'SquareProjects','field':_0xab7f('0x18'),'foreignKey':_0xab7f('0x19')}];break;case _0xab7f('0x1a'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x1b');break;case _0xab7f('0x1c'):_0x2e0065[_0xab7f('0x13')]='CmContact';_0x2e0065[_0xab7f('0x1d')]=[{'name':_0xab7f('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0xab7f('0x1f'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x20');break;case _0xab7f('0x21'):_0x2e0065['childModel']=_0xab7f('0x22');break;case _0xab7f('0x23'):_0x2e0065['childModel']=_0xab7f('0x24');break;case'chatqueues':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x25');break;case'chatwebsites':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x26');break;case _0xab7f('0x27'):_0x2e0065['childModel']=_0xab7f('0x28');break;case _0xab7f('0x29'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x2a');break;case _0xab7f('0x2b'):case _0xab7f('0x2c'):case _0xab7f('0x2d'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x2e');break;case'contexts':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x2f');break;case _0xab7f('0x30'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x31');break;case _0xab7f('0x32'):_0x2e0065['childModel']=_0xab7f('0x33');_0x2e0065[_0xab7f('0x1d')]=[{'name':_0xab7f('0x34'),'field':_0xab7f('0x18'),'foreignKey':_0xab7f('0x35'),'model':_0xab7f('0x36'),'filter':{'field':_0xab7f('0x37'),'value':[_0xab7f('0x38')]}},{'name':_0xab7f('0x39'),'field':'name','foreignKey':_0xab7f('0x35'),'model':_0xab7f('0x36'),'filter':{'field':'role','value':['telephone']}},{'name':_0xab7f('0x3a'),'field':_0xab7f('0x18'),'foreignKey':_0xab7f('0x3b'),'model':'VoiceQueue','filter':{'field':_0xab7f('0xf'),'value':['inbound']}},{'name':_0xab7f('0x3c'),'field':_0xab7f('0x18'),'foreignKey':'queue','model':_0xab7f('0x3d'),'filter':{'field':_0xab7f('0xf'),'value':[_0xab7f('0x3e')]}}];break;case _0xab7f('0x3f'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x40');break;case _0xab7f('0x41'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x42');break;case _0xab7f('0x43'):_0x2e0065[_0xab7f('0x13')]='VoicePrefix';break;case'ivrcampaigns':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x44');break;case'mailqueues':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x45');break;case _0xab7f('0x46'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x47');break;case _0xab7f('0x48'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x49');break;case _0xab7f('0x4a'):_0x2e0065['childModel']=_0xab7f('0x4b');break;case _0xab7f('0x4c'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x4d');break;case'smsqueues':_0x2e0065['childModel']='SmsQueue';break;case _0xab7f('0x4e'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x4f');break;case _0xab7f('0x50'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x51');break;case _0xab7f('0x52'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x53');break;case _0xab7f('0x54'):_0x2e0065[_0xab7f('0x13')]='Team';break;case _0xab7f('0x55'):case _0xab7f('0x56'):_0x2e0065['childModel']=_0xab7f('0x3d');if(_0x3d185b){_0x2e0065[_0xab7f('0x1d')]=[{'name':_0xab7f('0x3a')},{'name':'QueueCampaigns'}];}break;case _0xab7f('0x57'):case _0xab7f('0x58'):case'telephones':_0x2e0065[_0xab7f('0x13')]='User';if(_0x3d185b){_0x2e0065[_0xab7f('0x1d')]=[{'name':'Users','filter':{'field':_0xab7f('0x37'),'value':[_0xab7f('0x59'),_0xab7f('0x5a')]},'ignore':!![]},{'name':_0xab7f('0x34')},{'name':_0xab7f('0x39')}];}break;case _0xab7f('0x5b'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x5c');break;case _0xab7f('0x5d'):_0x2e0065[_0xab7f('0x13')]='SalesforceAccount';break;case _0xab7f('0x5e'):_0x2e0065[_0xab7f('0x13')]='FreshdeskAccount';break;case _0xab7f('0x5f'):_0x2e0065[_0xab7f('0x13')]='SugarcrmAccount';break;case _0xab7f('0x60'):_0x2e0065['childModel']=_0xab7f('0x61');break;case _0xab7f('0x62'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x63');break;case _0xab7f('0x64'):_0x2e0065['childModel']=_0xab7f('0x36');break;case _0xab7f('0x65'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x66');break;case _0xab7f('0x67'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x68');break;case _0xab7f('0x69'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x6a');break;case'intervals':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x6b');break;case _0xab7f('0x6c'):_0x2e0065['childModel']='Pause';break;case _0xab7f('0x6d'):_0x2e0065[_0xab7f('0x13')]='Schedule';break;case _0xab7f('0x6e'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x6f');break;case _0xab7f('0x70'):_0x2e0065['childModel']='Tag';break;case'templates':_0x2e0065[_0xab7f('0x13')]='Template';break;case'triggers':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x71');break;case _0xab7f('0x72'):_0x2e0065['childModel']=_0xab7f('0x73');break;case _0xab7f('0x74'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x75');break;case _0xab7f('0x76'):_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x77');break;case'extractedreports':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0xe');_0x2e0065[_0xab7f('0x1d')]=[{'name':_0xab7f('0x78'),'field':'id','foreignKey':_0xab7f('0x79')}];break;case'metrics':_0x2e0065[_0xab7f('0x13')]=_0xab7f('0x7a');break;}return _0x2e0065;}function _0x1a5778(_0xade7d7,_0xb16d00){var _0x44069e=_0xade7d7['charAt'](0x0)[_0xab7f('0x7b')]()+_0xade7d7[_0xab7f('0x7c')](0x1);var _0x8dea7f={'type':_0x8800a3[_0xab7f('0x7d')][_0xab7f('0x7e')][_0xab7f('0x7f')],'raw':!![]};return new Promise(function(_0x5a5de8,_0x57043a){var _0x455080=squel['select']()['field'](_0xab7f('0x80')+_0x44069e+_0xab7f('0x81'),'id')[_0xab7f('0x6')](_0xab7f('0x82'))['from'](_0xab7f('0x83')+_0xade7d7+_0xab7f('0x84'),'ui')[_0xab7f('0x85')](_0xab7f('0x86'),_0xb16d00['id']);return _0x8800a3[_0xab7f('0x87')][_0xab7f('0x88')](_0x455080[_0xab7f('0x89')](),_0x8dea7f)[_0xab7f('0xb')](function(_0x28fa0c){_0xb16d00[_0x44069e+_0xab7f('0x8a')]=_0x28fa0c;_0x5a5de8(_0x28fa0c);})[_0xab7f('0x9')](function(_0x142dd2){_0x57043a(_0x142dd2);});});}return _0x154b1c[_0xab7f('0x8b')](_0xab7f('0x8c'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x41b50){var _0x5784fd={'raw':_0x41b50['query']['raw'],'where':{}};var _0xaa3bd0={};var _0x29f1a6={'count':0x0,'rows':[]};var _0xd431ed=_0x41b50[_0xab7f('0x88')][_0xab7f('0x8d')];var _0x5e4f82=_0x41b50[_0xab7f('0x88')][_0xab7f('0x8e')]||![];var _0x294822=_0x1bc3d2(_0xd431ed,_0x5e4f82);if(!_0x294822[_0xab7f('0x13')])throw new Error(_0xab7f('0x8f')+_0xd431ed+'\x27');var _0x1b3e99=[{'name':_0xd431ed}];if(!_['isEmpty'](_0x294822[_0xab7f('0x1d')]))_0x1b3e99=_0x294822[_0xab7f('0x1d')];var _0x500e1e=[];for(var _0x44180c=0x0;_0x44180c<_0x1b3e99[_0xab7f('0x90')];_0x44180c++){_0x500e1e[_0xab7f('0x91')](_0x8800a3['UserProfileSection']['find']({'where':{'userProfileId':_0x41b50[_0xab7f('0x92')]['id'],'name':_0x1b3e99[_0x44180c][_0xab7f('0x18')]},'raw':!![]}));}return Promise['all'](_0x500e1e)['then'](function(_0x15f334){var _0x5c75e4=_[_0xab7f('0x5')](_0x15f334,function(_0x3e4fa3){return _0x3e4fa3?_0x3e4fa3:undefined;});var _0x40c3ab=_[_0xab7f('0x5')](_0x1b3e99,[_0xab7f('0x93'),!![]]);var _0x5176b8=_['isEmpty'](_0x5c75e4)&&_['isEmpty'](_0x40c3ab)?null:_['union'](_0x40c3ab,_0x5c75e4);if(!_0x5176b8)return null;var _0x144046=[];for(var _0x276ae7=0x0;_0x276ae7<_0x5176b8[_0xab7f('0x90')];_0x276ae7++){var _0x369107=_[_0xab7f('0x94')](_0x1b3e99,function(_0x23c49d){return _0x5176b8[_0x276ae7]?_0x23c49d[_0xab7f('0x18')]===_0x5176b8[_0x276ae7][_0xab7f('0x18')]:null;});if(_0x369107){if(_0x5176b8[_0x276ae7][_0xab7f('0x93')]){_0x144046[_0xab7f('0x91')](_0x4f8573(_0x294822[_0xab7f('0x13')],_0x5176b8[_0x276ae7]));}else{if(!_0x5176b8[_0x276ae7][_0xab7f('0x95')]){_0x144046[_0xab7f('0x91')](_0x526b32(_0x369107,_0x5176b8[_0x276ae7],_0x294822[_0xab7f('0x13')]));}else{if(_0x369107[_0xab7f('0xa')]){_0x144046[_0xab7f('0x91')](_0x2514cf(_0x369107,_0x5176b8[_0x276ae7]));}}}}}return Promise[_0xab7f('0x96')](_0x144046);})[_0xab7f('0xb')](function(_0x36d394){var _0x31f18b=_0x36d394;var _0x243ce7=null;if(_0x31f18b){_0x243ce7=_0x31f18b[_0xab7f('0x90')]===0x1?_0x31f18b[0x0]:null;}if(!_0x243ce7&&!_0x31f18b)return _0x29f1a6;var _0x2bef3a=_0x8800a3[_0x294822[_0xab7f('0x13')]]['rawAttributes'];_0xaa3bd0[_0xab7f('0xa')]=_[_0xab7f('0x97')](_0x2bef3a);_0xaa3bd0['query']=_[_0xab7f('0x97')](_0x41b50[_0xab7f('0x88')]);_0xaa3bd0['filters']=_['intersection'](_0xaa3bd0[_0xab7f('0xa')],_0xaa3bd0[_0xab7f('0x88')]);_0x5784fd['attributes']=_['intersection'](_0xaa3bd0[_0xab7f('0xa')],qs['fields'](_0x41b50['query']['fields']));_0x5784fd['attributes']=_0x5784fd[_0xab7f('0x98')][_0xab7f('0x90')]?_0x5784fd[_0xab7f('0x98')]:_0xaa3bd0[_0xab7f('0xa')];if(!_0x41b50[_0xab7f('0x88')][_0xab7f('0x99')](_0xab7f('0x9a'))){_0x5784fd[_0xab7f('0x9b')]=qs['limit'](_0x41b50['query'][_0xab7f('0x9b')]);_0x5784fd['offset']=qs[_0xab7f('0x9c')](_0x41b50['query'][_0xab7f('0x9c')]);}_0x5784fd[_0xab7f('0x9d')]=qs['sort'](_0x41b50[_0xab7f('0x88')]['sort']);_0x5784fd[_0xab7f('0x85')]=qs[_0xab7f('0x9e')](_[_0xab7f('0x9f')](_0x41b50[_0xab7f('0x88')],_0xaa3bd0[_0xab7f('0x9e')]));if(_0x41b50[_0xab7f('0x88')][_0xab7f('0x5')]){_0x5784fd[_0xab7f('0x85')]=_[_0xab7f('0xa0')](_0x5784fd[_0xab7f('0x85')],{'$or':_[_0xab7f('0xc')](_0x2bef3a,function(_0x4bae1e){if(_0x4bae1e[_0xab7f('0xf')][_0xab7f('0xa1')]!==_0xab7f('0xa2')){var _0x55efa2={};_0x55efa2[_0x4bae1e[_0xab7f('0x6')]]={'$like':'%'+_0x41b50[_0xab7f('0x88')]['filter']+'%'};return _0x55efa2;}})});}var _0x296d9b=[];var _0x261135=null;var _0x4339f5={};if(_0x243ce7){_0x261135=_[_0xab7f('0x94')](_0x1b3e99,[_0xab7f('0x18'),_0x243ce7['name']]);if(_0x261135[_0xab7f('0x6')]){_0x4339f5={};if(_0x294822[_0xab7f('0x13')]===_0xab7f('0xe')){_0x4339f5[_0x261135['foreignKey']]=_[_0xab7f('0xc')](_0x243ce7[_0xab7f('0x10')],'id');}else{_0x4339f5[_0x261135[_0xab7f('0xa3')]]=_0x243ce7[_0xab7f('0x10')];}_0x296d9b[_0xab7f('0x91')](_0x4339f5);}else{_0x5784fd['where']['id']=_0x243ce7[_0xab7f('0x10')];}}else{for(var _0x4ead65=0x0;_0x4ead65<_0x31f18b['length'];_0x4ead65++){_0x261135=_[_0xab7f('0x94')](_0x1b3e99,[_0xab7f('0x18'),_0x31f18b[_0x4ead65][_0xab7f('0x18')]]);if(_0x261135[_0xab7f('0x6')]){_0x4339f5={};_0x4339f5[_0x261135[_0xab7f('0xa3')]]=_0x31f18b[_0x4ead65][_0xab7f('0x10')];_0x296d9b[_0xab7f('0x91')](_0x4339f5);}else{if(!_0x5784fd[_0xab7f('0x85')]['id'])_0x5784fd['where']['id']=[];_0x31f18b[_0x4ead65]['associatedResources'][_0xab7f('0xa4')](function(_0x26e7a8){_0x5784fd['where']['id'][_0xab7f('0x91')](_0x26e7a8);});}}}if(!_[_0xab7f('0xa5')](_0x296d9b)){_0x5784fd[_0xab7f('0x85')]=_[_0xab7f('0xa0')](_0x5784fd[_0xab7f('0x85')],{'$and':{'$or':_0x296d9b}});}_0x5784fd=_[_0xab7f('0xa0')]({},_0x5784fd,_0x41b50[_0xab7f('0xa6')]);if(_0x243ce7&&!_0x243ce7[_0xab7f('0x95')]&&_0x294822[_0xab7f('0x13')]===_0xab7f('0xe')){if(_0x41b50[_0xab7f('0x88')]['includeAll']){_0x5784fd[_0xab7f('0xa7')]=[{'all':!![]}];}return _0x8800a3[_0x294822[_0xab7f('0x13')]]['findAll'](_0x5784fd)[_0xab7f('0xb')](function(_0x29e104){var _0x32b328=[];_0x29e104['forEach'](function(_0x57c038){var _0x4ea779;switch(_0x57c038['reportType']){case'default':_0x4ea779=_['find'](_0x243ce7[_0xab7f('0x10')],function(_0x165a32){return _0x165a32['id']===_0x57c038[_0xab7f('0x79')]&&_0x165a32[_0xab7f('0xf')]===_0xab7f('0xa8');});break;case _0xab7f('0xa9'):_0x4ea779=_[_0xab7f('0x94')](_0x243ce7[_0xab7f('0x10')],function(_0x32fdba){return _0x32fdba['id']===_0x57c038[_0xab7f('0x79')]&&_0x32fdba[_0xab7f('0xf')]===_0xab7f('0xaa');});break;}if(_0x4ea779)_0x32b328[_0xab7f('0x91')](_0x57c038);});_0x29f1a6[_0xab7f('0xab')]=_0x32b328[_0xab7f('0x90')];_0x29f1a6[_0xab7f('0xac')]=_0x32b328;return _0x29f1a6;});}else{if(!_[_0xab7f('0xa5')](_0x41b50[_0xab7f('0x88')]['ids'])){_0x5784fd[_0xab7f('0x85')]['id']=_0x5784fd['where']['id']?_[_0xab7f('0xad')](_0x5784fd['where']['id'],_0x41b50['query'][_0xab7f('0xae')]):_0x41b50['query'][_0xab7f('0xae')];if(_0x41b50['query']['customSorting']){_0x5784fd[_0xab7f('0x9d')]=_0x41b50[_0xab7f('0x88')][_0xab7f('0xaf')];}}if(_0x41b50[_0xab7f('0x88')][_0xab7f('0xb0')]){_0x5784fd[_0xab7f('0x85')]=_['merge'](_0x5784fd[_0xab7f('0x85')],{'$and':_0x41b50[_0xab7f('0x88')][_0xab7f('0xb0')]});}return _0x8800a3[_0x294822[_0xab7f('0x13')]][_0xab7f('0xab')]({'where':_0x5784fd[_0xab7f('0x85')]})[_0xab7f('0xb')](function(_0x534765){_0x29f1a6[_0xab7f('0xab')]=_0x534765;if(_0x41b50['query'][_0xab7f('0xb1')]){if(_0x294822['childModel']===_0xab7f('0xb2')){_0x5784fd[_0xab7f('0xa7')]=[{'model':_0x8800a3[_0xab7f('0xb3')],'as':'Tags','attributes':['id','name',_0xab7f('0xb4')],'required':_0x41b50[_0xab7f('0x88')]['tag']?!![]:![]},{'model':_0x8800a3['Tag'],'as':_0xab7f('0xb5'),'attributes':['id',_0xab7f('0x18'),_0xab7f('0xb4')],'through':_0x41b50['query'][_0xab7f('0xb6')]?{'attributes':[],'where':{'TagId':_0x41b50[_0xab7f('0x88')][_0xab7f('0xb6')]||undefined}}:{},'required':_0x41b50[_0xab7f('0x88')][_0xab7f('0xb6')]?!![]:![]}];}else{_0x5784fd[_0xab7f('0xa7')]=[{'all':!![]}];}}return _0x8800a3[_0x294822[_0xab7f('0x13')]][_0xab7f('0x8')](_0x5784fd);})[_0xab7f('0xb')](function(_0xb8f6d4){_0x29f1a6['rows']=_0xb8f6d4;if(_0xd431ed===_0xab7f('0x34')&&_0x41b50[_0xab7f('0x88')]['openTabs']===_0xab7f('0xb7')){var _0x3fe1b4=[];for(var _0x2b22fe=0x0;_0x2b22fe<_0x29f1a6[_0xab7f('0xac')][_0xab7f('0x90')];_0x2b22fe++){_0x3fe1b4['push'](_0x1a5778(_0xab7f('0xb8'),_0x29f1a6[_0xab7f('0xac')][_0x2b22fe][_0xab7f('0xb9')]));_0x3fe1b4[_0xab7f('0x91')](_0x1a5778(_0xab7f('0xba'),_0x29f1a6[_0xab7f('0xac')][_0x2b22fe][_0xab7f('0xb9')]));_0x3fe1b4[_0xab7f('0x91')](_0x1a5778(_0xab7f('0xbb'),_0x29f1a6['rows'][_0x2b22fe][_0xab7f('0xb9')]));_0x3fe1b4[_0xab7f('0x91')](_0x1a5778(_0xab7f('0xbc'),_0x29f1a6['rows'][_0x2b22fe][_0xab7f('0xb9')]));_0x3fe1b4['push'](_0x1a5778('openchannel',_0x29f1a6[_0xab7f('0xac')][_0x2b22fe][_0xab7f('0xb9')]));_0x3fe1b4[_0xab7f('0x91')](_0x1a5778(_0xab7f('0xbd'),_0x29f1a6[_0xab7f('0xac')][_0x2b22fe]['dataValues']));}return Promise['all'](_0x3fe1b4)[_0xab7f('0xb')](function(){return _0x29f1a6;});}return _0x29f1a6;});}});}}});};
\ No newline at end of file
index fce2e40..16c83a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06ae=['UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','then','info','UserProfile,\x20%s,\x20%s','debug'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});config[_0xe06a('0xa')]=_[_0xe06a('0xb')](config[_0xe06a('0xa')],{'host':_0xe06a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe06a('0xa')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x1a9f4e,_0x4eedc5,_0x2212e2){return new BPromise(function(_0x48e52a,_0x521741){return client[_0xe06a('0xd')](_0x1a9f4e,_0x2212e2)[_0xe06a('0xe')](function(_0x574fd0){logger[_0xe06a('0xf')](_0xe06a('0x10'),_0x4eedc5,'request\x20sent');logger[_0xe06a('0x11')](_0xe06a('0x12'),_0x4eedc5,_0xe06a('0x13'),JSON['stringify'](_0x574fd0));if(_0x574fd0[_0xe06a('0x14')]){if(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x15')]===0x1f4){logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0['error'][_0xe06a('0x16')]);return _0x521741(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x16')]);}logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0[_0xe06a('0x14')]['message']);return _0x48e52a(_0x574fd0[_0xe06a('0x14')]['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x4eedc5,_0xe06a('0x13'));_0x48e52a(_0x574fd0[_0xe06a('0x17')][_0xe06a('0x16')]);}})['catch'](function(_0x614743){logger[_0xe06a('0x14')]('UserProfile,\x20%s,\x20%s',_0x4eedc5,_0x614743);_0x521741(_0x614743);});});}
\ No newline at end of file
+var _0x4317=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x503be0,_0x254ab5){var _0x2300f6=function(_0x17c3c4){while(--_0x17c3c4){_0x503be0['push'](_0x503be0['shift']());}};_0x2300f6(++_0x254ab5);}(_0x4317,0x7c));var _0x7431=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4317[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var moment=require(_0x7431('0x1'));var BPromise=require(_0x7431('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7431('0x3'));var db=require(_0x7431('0x4'))['db'];var utils=require(_0x7431('0x5'));var logger=require(_0x7431('0x6'))(_0x7431('0x7'));var config=require(_0x7431('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7431('0x9')]({'port':0x232a});config[_0x7431('0xa')]=_[_0x7431('0xb')](config[_0x7431('0xa')],{'host':_0x7431('0xc'),'port':0x18eb});var socket=require(_0x7431('0xd'))(new Redis(config[_0x7431('0xa')]));require(_0x7431('0xe'))[_0x7431('0xf')](socket);function respondWithRpcPromise(_0xcf3ea4,_0x9a8b79,_0x13bf7b){return new BPromise(function(_0x11303d,_0x2adf0c){return client[_0x7431('0x10')](_0xcf3ea4,_0x13bf7b)[_0x7431('0x11')](function(_0xb01fee){logger[_0x7431('0x12')](_0x7431('0x13'),_0x9a8b79,_0x7431('0x14'));logger[_0x7431('0x15')](_0x7431('0x16'),_0x9a8b79,_0x7431('0x14'),JSON[_0x7431('0x17')](_0xb01fee));if(_0xb01fee['error']){if(_0xb01fee[_0x7431('0x18')][_0x7431('0x19')]===0x1f4){logger[_0x7431('0x18')]('UserProfile,\x20%s,\x20%s',_0x9a8b79,_0xb01fee[_0x7431('0x18')][_0x7431('0x1a')]);return _0x2adf0c(_0xb01fee[_0x7431('0x18')]['message']);}logger[_0x7431('0x18')]('UserProfile,\x20%s,\x20%s',_0x9a8b79,_0xb01fee['error']['message']);return _0x11303d(_0xb01fee[_0x7431('0x18')][_0x7431('0x1a')]);}else{logger[_0x7431('0x12')](_0x7431('0x13'),_0x9a8b79,'request\x20sent');_0x11303d(_0xb01fee['result'][_0x7431('0x1a')]);}})[_0x7431('0x1b')](function(_0x37bf74){logger[_0x7431('0x18')](_0x7431('0x13'),_0x9a8b79,_0x37bf74);_0x2adf0c(_0x37bf74);});});}
\ No newline at end of file
index de994da..28a8646 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x944c=['register','length','./userProfile.events','remove','update','emit','removeListener'];(function(_0x15e715,_0x5d5502){var _0x4f419f=function(_0x27722d){while(--_0x27722d){_0x15e715['push'](_0x15e715['shift']());}};_0x4f419f(++_0x5d5502);}(_0x944c,0x1de));var _0xc944=function(_0x9e3354,_0x53a6f9){_0x9e3354=_0x9e3354-0x0;var _0x312a11=_0x944c[_0x9e3354];return _0x312a11;};'use strict';var UserProfileEvents=require(_0xc944('0x0'));var events=['save',_0xc944('0x1'),_0xc944('0x2')];function createListener(_0x4f0c4f,_0x26defe){return function(_0x20caf1){_0x26defe[_0xc944('0x3')](_0x4f0c4f,_0x20caf1);};}function removeListener(_0x288b26,_0x35e6f5){return function(){UserProfileEvents[_0xc944('0x4')](_0x288b26,_0x35e6f5);};}exports[_0xc944('0x5')]=function(_0x219ce2){for(var _0x48671e=0x0,_0x18c445=events[_0xc944('0x6')];_0x48671e<_0x18c445;_0x48671e++){var _0x5db20f=events[_0x48671e];var _0x45e7f3=createListener('userProfile:'+_0x5db20f,_0x219ce2);UserProfileEvents['on'](_0x5db20f,_0x45e7f3);}};
\ No newline at end of file
+var _0xd983=['./userProfile.events','save','remove','update','emit','register','length'];(function(_0x485f52,_0x7a120c){var _0xfccf21=function(_0x1ffeaf){while(--_0x1ffeaf){_0x485f52['push'](_0x485f52['shift']());}};_0xfccf21(++_0x7a120c);}(_0xd983,0xbd));var _0x3d98=function(_0x41ff8f,_0x4a54e8){_0x41ff8f=_0x41ff8f-0x0;var _0x134e8d=_0xd983[_0x41ff8f];return _0x134e8d;};'use strict';var UserProfileEvents=require(_0x3d98('0x0'));var events=[_0x3d98('0x1'),_0x3d98('0x2'),_0x3d98('0x3')];function createListener(_0x3cac2e,_0x51ed79){return function(_0x31fd9d){_0x51ed79[_0x3d98('0x4')](_0x3cac2e,_0x31fd9d);};}function removeListener(_0x11ca43,_0x2a47fa){return function(){UserProfileEvents['removeListener'](_0x11ca43,_0x2a47fa);};}exports[_0x3d98('0x5')]=function(_0x4f7809){for(var _0x541ee9=0x0,_0x38112c=events[_0x3d98('0x6')];_0x541ee9<_0x38112c;_0x541ee9++){var _0x541fd7=events[_0x541ee9];var _0x4baf61=createListener('userProfile:'+_0x541fd7,_0x4f7809);UserProfileEvents['on'](_0x541fd7,_0x4baf61);}};
\ No newline at end of file
index f3dbf4f..7c1a98b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3a00=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x2ffda1,_0x297ecb){var _0x59e35a=function(_0x23a128){while(--_0x23a128){_0x2ffda1['push'](_0x2ffda1['shift']());}};_0x59e35a(++_0x297ecb);}(_0x3a00,0x1a3));var _0x03a0=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x3a00[_0x261522];return _0x98a25a;};'use strict';var multer=require(_0x03a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03a0('0x1'));var express=require(_0x03a0('0x2'));var router=express[_0x03a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x03a0('0x4'));var interaction=require(_0x03a0('0x5'));var config=require(_0x03a0('0x6'));var controller=require(_0x03a0('0x7'));router['get']('/',auth[_0x03a0('0x8')](),controller[_0x03a0('0x9')]);router[_0x03a0('0xa')](_0x03a0('0xb'),auth['isAuthenticated'](),controller[_0x03a0('0xc')]);router[_0x03a0('0xa')](_0x03a0('0xd'),auth['isAuthenticated'](),controller[_0x03a0('0xe')]);router[_0x03a0('0xf')]('/',auth[_0x03a0('0x8')](),controller[_0x03a0('0x10')]);router[_0x03a0('0x11')](_0x03a0('0xd'),auth[_0x03a0('0x8')](),controller[_0x03a0('0x12')]);router['delete'](_0x03a0('0xd'),auth['isAuthenticated'](),controller[_0x03a0('0x13')]);module[_0x03a0('0x14')]=router;
\ No newline at end of file
+var _0x32b8=['delete','util','connect-timeout','express','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/describe','describe','show','post','create','/:id','update'];(function(_0x2de15d,_0x28e8d7){var _0x1c39c4=function(_0xf58515){while(--_0xf58515){_0x2de15d['push'](_0x2de15d['shift']());}};_0x1c39c4(++_0x28e8d7);}(_0x32b8,0x1f0));var _0x832b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x32b8[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x832b('0x0'));var path=require('path');var timeout=require(_0x832b('0x1'));var express=require(_0x832b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x832b('0x3'));var config=require('../../config/environment');var controller=require(_0x832b('0x4'));router[_0x832b('0x5')]('/',auth[_0x832b('0x6')](),controller['index']);router[_0x832b('0x5')](_0x832b('0x7'),auth[_0x832b('0x6')](),controller[_0x832b('0x8')]);router[_0x832b('0x5')]('/:id',auth[_0x832b('0x6')](),controller[_0x832b('0x9')]);router[_0x832b('0xa')]('/',auth['isAuthenticated'](),controller[_0x832b('0xb')]);router['put'](_0x832b('0xc'),auth[_0x832b('0x6')](),controller[_0x832b('0xd')]);router[_0x832b('0xe')](_0x832b('0xc'),auth[_0x832b('0x6')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 8da9dd6..9a97377 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64d3=['sequelize','STRING','INTEGER'];(function(_0x1ad659,_0x1ab26a){var _0x56d7e2=function(_0x3c3f02){while(--_0x3c3f02){_0x1ad659['push'](_0x1ad659['shift']());}};_0x56d7e2(++_0x1ab26a);}(_0x64d3,0x1aa));var _0x364d=function(_0x2937ac,_0xc8b1b2){_0x2937ac=_0x2937ac-0x0;var _0x788104=_0x64d3[_0x2937ac];return _0x788104;};'use strict';var Sequelize=require(_0x364d('0x0'));module['exports']={'name':{'type':Sequelize[_0x364d('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x364d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x364d('0x1')],'allowNull':![]}};
\ No newline at end of file
+var _0x923c=['INTEGER','sequelize','exports','STRING'];(function(_0x104540,_0x555ac1){var _0x3c53cf=function(_0x41180a){while(--_0x41180a){_0x104540['push'](_0x104540['shift']());}};_0x3c53cf(++_0x555ac1);}(_0x923c,0x1e9));var _0xc923=function(_0x2cb6b9,_0x175b9a){_0x2cb6b9=_0x2cb6b9-0x0;var _0xbbcba1=_0x923c[_0x2cb6b9];return _0xbbcba1;};'use strict';var Sequelize=require(_0xc923('0x0'));module[_0xc923('0x1')]={'name':{'type':Sequelize[_0xc923('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc923('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc923('0x2')],'allowNull':![]}};
\ No newline at end of file
index 547bc24..4d1ee82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x38d672,_0xc41411){var _0x33b0ca=function(_0x1022ee){while(--_0x1022ee){_0x38d672['push'](_0x38d672['shift']());}};_0x33b0ca(++_0xc41411);}(_0x7a54,0x106));var _0x47a5=function(_0x399cf8,_0x778f){_0x399cf8=_0x399cf8-0x0;var _0x2dc5d4=_0x7a54[_0x399cf8];return _0x2dc5d4;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['UserProfileResource'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['UserProfileResource']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));};
\ No newline at end of file
+var _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x367e7e,_0x564aa4){var _0x90036e=function(_0x45ec9e){while(--_0x45ec9e){_0x367e7e['push'](_0x367e7e['shift']());}};_0x90036e(++_0x564aa4);}(_0xb016,0x159));var _0x6b01=function(_0x4d2eb5,_0x46531e){_0x4d2eb5=_0x4d2eb5-0x0;var _0x5958f0=_0xb016[_0x4d2eb5];return _0x5958f0;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));};
\ No newline at end of file
index 252d8fe..09db7f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2149=['compositeIndex','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource'];(function(_0x889ab5,_0x4214e4){var _0x4db94b=function(_0x4d0d9d){while(--_0x4d0d9d){_0x889ab5['push'](_0x889ab5['shift']());}};_0x4db94b(++_0x4214e4);}(_0x2149,0x1c9));var _0x9214=function(_0x504b9e,_0x3b95b4){_0x504b9e=_0x504b9e-0x0;var _0x530a04=_0x2149[_0x504b9e];return _0x530a04;};'use strict';var _=require(_0x9214('0x0'));var util=require('util');var logger=require(_0x9214('0x1'))(_0x9214('0x2'));var moment=require(_0x9214('0x3'));var BPromise=require(_0x9214('0x4'));var rp=require(_0x9214('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9214('0x6'));var config=require(_0x9214('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x9214('0x8')]=function(_0x56133d,_0x2dff8c){return _0x56133d[_0x9214('0x9')](_0x9214('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x9214('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x6f7c=['define','resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x37eff2,_0x5c1639){var _0x3c9e7f=function(_0x17c6c6){while(--_0x17c6c6){_0x37eff2['push'](_0x37eff2['shift']());}};_0x3c9e7f(++_0x5c1639);}(_0x6f7c,0x64));var _0xc6f7=function(_0xddafcc,_0x5e601f){_0xddafcc=_0xddafcc-0x0;var _0x511cb1=_0x6f7c[_0xddafcc];return _0x511cb1;};'use strict';var _=require(_0xc6f7('0x0'));var util=require(_0xc6f7('0x1'));var logger=require(_0xc6f7('0x2'))(_0xc6f7('0x3'));var moment=require(_0xc6f7('0x4'));var BPromise=require(_0xc6f7('0x5'));var rp=require(_0xc6f7('0x6'));var fs=require('fs');var path=require(_0xc6f7('0x7'));var rimraf=require(_0xc6f7('0x8'));var config=require(_0xc6f7('0x9'));var attributes=require(_0xc6f7('0xa'));module[_0xc6f7('0xb')]=function(_0x477ca9,_0x4593dd){return _0x477ca9[_0xc6f7('0xc')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc6f7('0xd'),'sectionId']}],'timestamps':!![]});};
\ No newline at end of file
index 2d94b06..0707ce0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x553d=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x553d,0x192));var _0xd553=function(_0x281bc8,_0x570aad){_0x281bc8=_0x281bc8-0x0;var _0x1d35b4=_0x553d[_0x281bc8];return _0x1d35b4;};'use strict';var _=require(_0xd553('0x0'));var util=require('util');var moment=require(_0xd553('0x1'));var BPromise=require(_0xd553('0x2'));var rs=require(_0xd553('0x3'));var fs=require('fs');var Redis=require(_0xd553('0x4'));var db=require(_0xd553('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd553('0x6'));var config=require('../../config/environment');var jayson=require(_0xd553('0x7'));var client=jayson['client'][_0xd553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ce4f4,_0xea700a,_0x134d71){return new BPromise(function(_0x5bd6ab,_0x317e08){return client[_0xd553('0x9')](_0x5ce4f4,_0x134d71)[_0xd553('0xa')](function(_0x4f1cd3){logger[_0xd553('0xb')](_0xd553('0xc'),_0xea700a,_0xd553('0xd'));logger[_0xd553('0xe')](_0xd553('0xf'),_0xea700a,_0xd553('0xd'),JSON[_0xd553('0x10')](_0x4f1cd3));if(_0x4f1cd3[_0xd553('0x11')]){if(_0x4f1cd3[_0xd553('0x11')][_0xd553('0x12')]===0x1f4){logger['error'](_0xd553('0xc'),_0xea700a,_0x4f1cd3[_0xd553('0x11')][_0xd553('0x13')]);return _0x317e08(_0x4f1cd3[_0xd553('0x11')]['message']);}logger[_0xd553('0x11')](_0xd553('0xc'),_0xea700a,_0x4f1cd3['error'][_0xd553('0x13')]);return _0x5bd6ab(_0x4f1cd3[_0xd553('0x11')]['message']);}else{logger[_0xd553('0xb')](_0xd553('0xc'),_0xea700a,_0xd553('0xd'));_0x5bd6ab(_0x4f1cd3[_0xd553('0x14')]['message']);}})[_0xd553('0x15')](function(_0x103ab0){logger['error']('UserProfileResource,\x20%s,\x20%s',_0xea700a,_0x103ab0);_0x317e08(_0x103ab0);});});}
\ No newline at end of file
+var _0x7ae6=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x7ae6,0x94));var _0x67ae=function(_0x4d9e21,_0x55793d){_0x4d9e21=_0x4d9e21-0x0;var _0x1c58e7=_0x7ae6[_0x4d9e21];return _0x1c58e7;};'use strict';var _=require('lodash');var util=require(_0x67ae('0x0'));var moment=require('moment');var BPromise=require(_0x67ae('0x1'));var rs=require(_0x67ae('0x2'));var fs=require('fs');var Redis=require(_0x67ae('0x3'));var db=require(_0x67ae('0x4'))['db'];var utils=require(_0x67ae('0x5'));var logger=require(_0x67ae('0x6'))('rpc');var config=require(_0x67ae('0x7'));var jayson=require(_0x67ae('0x8'));var client=jayson[_0x67ae('0x9')][_0x67ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33bc99,_0x51f7f2,_0x456ca9){return new BPromise(function(_0x460304,_0x2591a1){return client[_0x67ae('0xb')](_0x33bc99,_0x456ca9)[_0x67ae('0xc')](function(_0x11c49a){logger[_0x67ae('0xd')](_0x67ae('0xe'),_0x51f7f2,_0x67ae('0xf'));logger[_0x67ae('0x10')](_0x67ae('0x11'),_0x51f7f2,_0x67ae('0xf'),JSON[_0x67ae('0x12')](_0x11c49a));if(_0x11c49a[_0x67ae('0x13')]){if(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x14')]===0x1f4){logger[_0x67ae('0x13')](_0x67ae('0xe'),_0x51f7f2,_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);return _0x2591a1(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);}logger[_0x67ae('0x13')](_0x67ae('0xe'),_0x51f7f2,_0x11c49a['error'][_0x67ae('0x15')]);return _0x460304(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x51f7f2,_0x67ae('0xf'));_0x460304(_0x11c49a['result']['message']);}})[_0x67ae('0x16')](function(_0x2c47f9){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x51f7f2,_0x2c47f9);_0x2591a1(_0x2c47f9);});});}
\ No newline at end of file
index 6db2d26..891bbed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22d9=['isAuthenticated','/describe','show','create','put','/:id','update','delete','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x5a3202,_0x4a9c0d){var _0xb4cf2=function(_0x169a51){while(--_0x169a51){_0x5a3202['push'](_0x5a3202['shift']());}};_0xb4cf2(++_0x4a9c0d);}(_0x22d9,0x1e5));var _0x922d=function(_0x505f50,_0x1f6978){_0x505f50=_0x505f50-0x0;var _0x235de6=_0x22d9[_0x505f50];return _0x235de6;};'use strict';var multer=require(_0x922d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x922d('0x1'));var router=express[_0x922d('0x2')]();var fs_extra=require(_0x922d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x922d('0x4'));var config=require(_0x922d('0x5'));var controller=require(_0x922d('0x6'));router[_0x922d('0x7')]('/',auth[_0x922d('0x8')](),controller['index']);router[_0x922d('0x7')](_0x922d('0x9'),auth[_0x922d('0x8')](),controller['describe']);router['get']('/:id',auth[_0x922d('0x8')](),controller[_0x922d('0xa')]);router['post']('/',auth[_0x922d('0x8')](),controller[_0x922d('0xb')]);router[_0x922d('0xc')](_0x922d('0xd'),auth[_0x922d('0x8')](),controller[_0x922d('0xe')]);router[_0x922d('0xf')](_0x922d('0xd'),auth[_0x922d('0x8')](),controller['destroy']);module[_0x922d('0x10')]=router;
\ No newline at end of file
+var _0xd496=['../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd496,0xcd));var _0x6d49=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xd496[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0x6d49('0x0'));var util=require(_0x6d49('0x1'));var path=require(_0x6d49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6d49('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d49('0x4'));var controller=require(_0x6d49('0x5'));router['get']('/',auth[_0x6d49('0x6')](),controller[_0x6d49('0x7')]);router[_0x6d49('0x8')](_0x6d49('0x9'),auth[_0x6d49('0x6')](),controller['describe']);router['get'](_0x6d49('0xa'),auth[_0x6d49('0x6')](),controller[_0x6d49('0xb')]);router[_0x6d49('0xc')]('/',auth[_0x6d49('0x6')](),controller[_0x6d49('0xd')]);router[_0x6d49('0xe')]('/:id',auth[_0x6d49('0x6')](),controller[_0x6d49('0xf')]);router[_0x6d49('0x10')](_0x6d49('0xa'),auth['isAuthenticated'](),controller[_0x6d49('0x11')]);module[_0x6d49('0x12')]=router;
\ No newline at end of file
index 710b6be..99fb272 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d25=['INTEGER','BOOLEAN','getDataValue','crudPermissions','split','exports','STRING'];(function(_0x4abb10,_0x26897f){var _0x2494fe=function(_0x44c085){while(--_0x44c085){_0x4abb10['push'](_0x4abb10['shift']());}};_0x2494fe(++_0x26897f);}(_0x7d25,0x8a));var _0x57d2=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x7d25[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x57d2('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x57d2('0x1')],'set':function(_0x5c1baa){this['setDataValue']('crudPermissions',_0x5c1baa?_0x5c1baa['join'](''):[]);},'get':function(){return this[_0x57d2('0x4')]('crudPermissions')?this[_0x57d2('0x4')](_0x57d2('0x5'))[_0x57d2('0x6')](''):[];}}};
\ No newline at end of file
+var _0xd914=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0xd7e379,_0x25d5a9){var _0x502489=function(_0x2bdff8){while(--_0x2bdff8){_0xd7e379['push'](_0xd7e379['shift']());}};_0x502489(++_0x25d5a9);}(_0xd914,0x17f));var _0x4d91=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0xd914[_0x50cfc3];return _0x5c11ef;};'use strict';var Sequelize=require(_0x4d91('0x0'));module[_0x4d91('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4d91('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d91('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d91('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d91('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d91('0x2')],'set':function(_0x2db8c5){this['setDataValue'](_0x4d91('0x5'),_0x2db8c5?_0x2db8c5['join'](''):[]);},'get':function(){return this[_0x4d91('0x6')](_0x4d91('0x5'))?this[_0x4d91('0x6')](_0x4d91('0x5'))[_0x4d91('0x7')](''):[];}}};
\ No newline at end of file
index 7f3af7a..7466e7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdcff=['VIRTUAL','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter'];(function(_0x1b0092,_0x3d344b){var _0x199073=function(_0x3733fc){while(--_0x3733fc){_0x1b0092['push'](_0x1b0092['shift']());}};_0x199073(++_0x3d344b);}(_0xdcff,0x1c4));var _0xfdcf=function(_0x172703,_0x179101){_0x172703=_0x172703-0x0;var _0x11b24c=_0xdcff[_0x172703];return _0x11b24c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdcf('0x0'));var zipdir=require(_0xfdcf('0x1'));var jsonpatch=require(_0xfdcf('0x2'));var rp=require(_0xfdcf('0x3'));var moment=require(_0xfdcf('0x4'));var BPromise=require(_0xfdcf('0x5'));var Mustache=require(_0xfdcf('0x6'));var util=require('util');var path=require(_0xfdcf('0x7'));var sox=require(_0xfdcf('0x8'));var csv=require(_0xfdcf('0x9'));var ejs=require(_0xfdcf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfdcf('0xb'));var crypto=require('crypto');var jsforce=require(_0xfdcf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfdcf('0x9'));var querystring=require('querystring');var Papa=require(_0xfdcf('0xd'));var Redis=require(_0xfdcf('0xe'));var authService=require(_0xfdcf('0xf'));var qs=require(_0xfdcf('0x10'));var as=require(_0xfdcf('0x11'));var hardwareService=require(_0xfdcf('0x12'));var logger=require(_0xfdcf('0x13'))('api');var utils=require(_0xfdcf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfdcf('0x15'));var db=require(_0xfdcf('0x16'))['db'];function respondWithStatusCode(_0x2abf7d,_0xe730f8){_0xe730f8=_0xe730f8||0xcc;return function(_0x4f21f0){if(_0x4f21f0){return _0x2abf7d[_0xfdcf('0x17')](_0xe730f8);}return _0x2abf7d['status'](_0xe730f8)['end']();};}function respondWithResult(_0xb1502c,_0x591ebc){_0x591ebc=_0x591ebc||0xc8;return function(_0x32b9d5){if(_0x32b9d5){return _0xb1502c[_0xfdcf('0x18')](_0x591ebc)[_0xfdcf('0x19')](_0x32b9d5);}};}function respondWithFilteredResult(_0x54eb76,_0x55b9cf){return function(_0x3d77e5){if(_0x3d77e5){var _0x10a670=typeof _0x55b9cf[_0xfdcf('0x1a')]===_0xfdcf('0x1b')&&typeof _0x55b9cf[_0xfdcf('0x1c')]==='undefined';var _0x210620=_0x3d77e5[_0xfdcf('0x1d')];var _0x4bfe4b=_0x10a670?0x0:_0x55b9cf['offset'];var _0x74f5d3=_0x10a670?_0x3d77e5[_0xfdcf('0x1d')]:_0x55b9cf['offset']+_0x55b9cf[_0xfdcf('0x1c')];var _0x1861c5;if(_0x74f5d3>=_0x210620){_0x74f5d3=_0x210620;_0x1861c5=0xc8;}else{_0x1861c5=0xce;}_0x54eb76[_0xfdcf('0x18')](_0x1861c5);return _0x54eb76[_0xfdcf('0x1e')](_0xfdcf('0x1f'),_0x4bfe4b+'-'+_0x74f5d3+'/'+_0x210620)['json'](_0x3d77e5);}return null;};}function patchUpdates(_0x21266e){return function(_0x7ad855){try{jsonpatch['apply'](_0x7ad855,_0x21266e,!![]);}catch(_0x4bde67){return BPromise[_0xfdcf('0x20')](_0x4bde67);}return _0x7ad855['save']();};}function saveUpdates(_0x56f304,_0x41e901){return function(_0x2db769){if(_0x2db769){return _0x2db769[_0xfdcf('0x21')](_0x56f304)['then'](function(_0x283bbd){return _0x283bbd;});}return null;};}function removeEntity(_0x237f53,_0x5b4d6c){return function(_0x2b5de8){if(_0x2b5de8){return _0x2b5de8[_0xfdcf('0x22')]()[_0xfdcf('0x23')](function(){_0x237f53[_0xfdcf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x490c17,_0x2b7b37){return function(_0x5af58f){if(!_0x5af58f){_0x490c17['sendStatus'](0x194);}return _0x5af58f;};}function handleError(_0x4cc2b5,_0x383eab){_0x383eab=_0x383eab||0x1f4;return function(_0x5c3128){logger[_0xfdcf('0x24')](_0x5c3128[_0xfdcf('0x25')]);if(_0x5c3128['name']){delete _0x5c3128[_0xfdcf('0x26')];}_0x4cc2b5[_0xfdcf('0x18')](_0x383eab)[_0xfdcf('0x27')](_0x5c3128);};}exports[_0xfdcf('0x28')]=function(_0x517b20,_0x9d65be){var _0x547e1f={},_0x4a13e3={},_0x586cb4={'count':0x0,'rows':[]};var _0x565f83=_['map'](db['UserProfileSection'][_0xfdcf('0x29')],function(_0x5b2b90){return{'name':_0x5b2b90[_0xfdcf('0x2a')],'type':_0x5b2b90[_0xfdcf('0x2b')][_0xfdcf('0x2c')]};});_0x4a13e3[_0xfdcf('0x2d')]=_[_0xfdcf('0x2e')](_0x565f83,_0xfdcf('0x26'));_0x4a13e3[_0xfdcf('0x2f')]=_[_0xfdcf('0x30')](_0x517b20[_0xfdcf('0x2f')]);_0x4a13e3[_0xfdcf('0x31')]=_[_0xfdcf('0x32')](_0x4a13e3[_0xfdcf('0x2d')],_0x4a13e3[_0xfdcf('0x2f')]);_0x547e1f[_0xfdcf('0x33')]=_[_0xfdcf('0x32')](_0x4a13e3['model'],qs['fields'](_0x517b20[_0xfdcf('0x2f')][_0xfdcf('0x34')]));_0x547e1f[_0xfdcf('0x33')]=_0x547e1f[_0xfdcf('0x33')][_0xfdcf('0x35')]?_0x547e1f[_0xfdcf('0x33')]:_0x4a13e3[_0xfdcf('0x2d')];if(!_0x517b20[_0xfdcf('0x2f')][_0xfdcf('0x36')](_0xfdcf('0x37'))){_0x547e1f[_0xfdcf('0x1c')]=qs['limit'](_0x517b20[_0xfdcf('0x2f')]['limit']);_0x547e1f[_0xfdcf('0x1a')]=qs[_0xfdcf('0x1a')](_0x517b20['query'][_0xfdcf('0x1a')]);}_0x547e1f['order']=qs['sort'](_0x517b20[_0xfdcf('0x2f')]['sort']);_0x547e1f[_0xfdcf('0x38')]=qs[_0xfdcf('0x31')](_[_0xfdcf('0x39')](_0x517b20[_0xfdcf('0x2f')],_0x4a13e3['filters']),_0x565f83);if(_0x517b20[_0xfdcf('0x2f')][_0xfdcf('0x3a')]){_0x547e1f[_0xfdcf('0x38')]=_['merge'](_0x547e1f[_0xfdcf('0x38')],{'$or':_['map'](_0x565f83,function(_0x183b45){if(_0x183b45[_0xfdcf('0x2b')]!==_0xfdcf('0x3b')){var _0x4d3a1c={};_0x4d3a1c[_0x183b45[_0xfdcf('0x26')]]={'$like':'%'+_0x517b20[_0xfdcf('0x2f')][_0xfdcf('0x3a')]+'%'};return _0x4d3a1c;}})});}_0x547e1f=_[_0xfdcf('0x3c')]({},_0x547e1f,_0x517b20[_0xfdcf('0x3d')]);var _0x253d72={'where':_0x547e1f[_0xfdcf('0x38')]};return db[_0xfdcf('0x3e')][_0xfdcf('0x1d')](_0x253d72)[_0xfdcf('0x23')](function(_0x297bc2){_0x586cb4[_0xfdcf('0x1d')]=_0x297bc2;if(_0x517b20[_0xfdcf('0x2f')][_0xfdcf('0x3f')]){_0x547e1f[_0xfdcf('0x40')]=[{'all':!![]}];}return db[_0xfdcf('0x3e')][_0xfdcf('0x41')](_0x547e1f);})['then'](function(_0x54cbf9){_0x586cb4[_0xfdcf('0x42')]=_0x54cbf9;return _0x586cb4;})[_0xfdcf('0x23')](respondWithFilteredResult(_0x9d65be,_0x547e1f))[_0xfdcf('0x43')](handleError(_0x9d65be,null));};exports[_0xfdcf('0x44')]=function(_0x5a29ef,_0x30b603){var _0x37520e={'raw':![],'where':{'id':_0x5a29ef[_0xfdcf('0x45')]['id']}},_0x3497f3={};_0x3497f3[_0xfdcf('0x2d')]=_[_0xfdcf('0x30')](db[_0xfdcf('0x3e')][_0xfdcf('0x29')]);_0x3497f3['query']=_[_0xfdcf('0x30')](_0x5a29ef['query']);_0x3497f3['filters']=_[_0xfdcf('0x32')](_0x3497f3[_0xfdcf('0x2d')],_0x3497f3[_0xfdcf('0x2f')]);_0x37520e[_0xfdcf('0x33')]=_['intersection'](_0x3497f3[_0xfdcf('0x2d')],qs[_0xfdcf('0x34')](_0x5a29ef[_0xfdcf('0x2f')][_0xfdcf('0x34')]));_0x37520e[_0xfdcf('0x33')]=_0x37520e[_0xfdcf('0x33')][_0xfdcf('0x35')]?_0x37520e['attributes']:_0x3497f3[_0xfdcf('0x2d')];if(_0x5a29ef[_0xfdcf('0x2f')][_0xfdcf('0x3f')]){_0x37520e[_0xfdcf('0x40')]=[{'all':!![]}];}_0x37520e=_['merge']({},_0x37520e,_0x5a29ef[_0xfdcf('0x3d')]);return db['UserProfileSection'][_0xfdcf('0x46')](_0x37520e)[_0xfdcf('0x23')](handleEntityNotFound(_0x30b603,null))[_0xfdcf('0x23')](respondWithResult(_0x30b603,null))[_0xfdcf('0x43')](handleError(_0x30b603,null));};exports['create']=function(_0x507423,_0x158667){return db['UserProfileSection']['create'](_0x507423[_0xfdcf('0x47')],{})[_0xfdcf('0x23')](respondWithResult(_0x158667,0xc9))[_0xfdcf('0x43')](handleError(_0x158667,null));};exports[_0xfdcf('0x21')]=function(_0xe92135,_0x56ca5d){if(_0xe92135[_0xfdcf('0x47')]['id']){delete _0xe92135[_0xfdcf('0x47')]['id'];}return db[_0xfdcf('0x3e')][_0xfdcf('0x46')]({'where':{'id':_0xe92135[_0xfdcf('0x45')]['id']}})[_0xfdcf('0x23')](handleEntityNotFound(_0x56ca5d,null))[_0xfdcf('0x23')](saveUpdates(_0xe92135[_0xfdcf('0x47')],null))[_0xfdcf('0x23')](respondWithResult(_0x56ca5d,null))['catch'](handleError(_0x56ca5d,null));};exports[_0xfdcf('0x22')]=function(_0x1fbbeb,_0x313e4f){return db[_0xfdcf('0x3e')][_0xfdcf('0x46')]({'where':{'id':_0x1fbbeb[_0xfdcf('0x45')]['id']}})[_0xfdcf('0x23')](handleEntityNotFound(_0x313e4f,null))['then'](removeEntity(_0x313e4f,null))[_0xfdcf('0x43')](handleError(_0x313e4f,null));};exports[_0xfdcf('0x48')]=function(_0x483e59,_0x260028){return db['UserProfileSection']['describe']()[_0xfdcf('0x23')](respondWithResult(_0x260028,null))[_0xfdcf('0x43')](handleError(_0x260028,null));};
\ No newline at end of file
+var _0x1bd7=['to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','then','error','stack','name','UserProfileSection','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x1584b9,_0x400684){var _0x12dc05=function(_0x369e04){while(--_0x369e04){_0x1584b9['push'](_0x1584b9['shift']());}};_0x12dc05(++_0x400684);}(_0x1bd7,0x11f));var _0x71bd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bd7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x71bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71bd('0x1'));var jsonpatch=require(_0x71bd('0x2'));var rp=require('request-promise');var moment=require(_0x71bd('0x3'));var BPromise=require(_0x71bd('0x4'));var Mustache=require(_0x71bd('0x5'));var util=require(_0x71bd('0x6'));var path=require(_0x71bd('0x7'));var sox=require(_0x71bd('0x8'));var csv=require(_0x71bd('0x9'));var ejs=require(_0x71bd('0xa'));var fs=require('fs');var fs_extra=require(_0x71bd('0xb'));var _=require('lodash');var squel=require(_0x71bd('0xc'));var crypto=require(_0x71bd('0xd'));var jsforce=require(_0x71bd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x71bd('0x9'));var querystring=require(_0x71bd('0xf'));var Papa=require(_0x71bd('0x10'));var Redis=require('ioredis');var authService=require(_0x71bd('0x11'));var qs=require(_0x71bd('0x12'));var as=require(_0x71bd('0x13'));var hardwareService=require(_0x71bd('0x14'));var logger=require('../../config/logger')(_0x71bd('0x15'));var utils=require(_0x71bd('0x16'));var config=require(_0x71bd('0x17'));var licenseUtil=require(_0x71bd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57339b,_0x458941){_0x458941=_0x458941||0xcc;return function(_0x4711c9){if(_0x4711c9){return _0x57339b[_0x71bd('0x19')](_0x458941);}return _0x57339b['status'](_0x458941)['end']();};}function respondWithResult(_0x4db196,_0xfda2fd){_0xfda2fd=_0xfda2fd||0xc8;return function(_0x4e9df5){if(_0x4e9df5){return _0x4db196[_0x71bd('0x1a')](_0xfda2fd)[_0x71bd('0x1b')](_0x4e9df5);}};}function respondWithFilteredResult(_0x550820,_0x56c25a){return function(_0x5c1b14){if(_0x5c1b14){var _0x10558d=typeof _0x56c25a['offset']===_0x71bd('0x1c')&&typeof _0x56c25a[_0x71bd('0x1d')]===_0x71bd('0x1c');var _0x4308fe=_0x5c1b14[_0x71bd('0x1e')];var _0x17cacf=_0x10558d?0x0:_0x56c25a['offset'];var _0x9bd43d=_0x10558d?_0x5c1b14['count']:_0x56c25a[_0x71bd('0x1f')]+_0x56c25a[_0x71bd('0x1d')];var _0x224c46;if(_0x9bd43d>=_0x4308fe){_0x9bd43d=_0x4308fe;_0x224c46=0xc8;}else{_0x224c46=0xce;}_0x550820['status'](_0x224c46);return _0x550820[_0x71bd('0x20')]('Content-Range',_0x17cacf+'-'+_0x9bd43d+'/'+_0x4308fe)[_0x71bd('0x1b')](_0x5c1b14);}return null;};}function patchUpdates(_0x3c9513){return function(_0x5f5a6c){try{jsonpatch[_0x71bd('0x21')](_0x5f5a6c,_0x3c9513,!![]);}catch(_0x53b646){return BPromise['reject'](_0x53b646);}return _0x5f5a6c[_0x71bd('0x22')]();};}function saveUpdates(_0x33ad46,_0x45dd3d){return function(_0x5ee053){if(_0x5ee053){return _0x5ee053[_0x71bd('0x23')](_0x33ad46)['then'](function(_0x5f4905){return _0x5f4905;});}return null;};}function removeEntity(_0xa8318f,_0x3380b0){return function(_0x197fed){if(_0x197fed){return _0x197fed['destroy']()[_0x71bd('0x24')](function(){_0xa8318f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ce49d,_0x52609){return function(_0x4f15ea){if(!_0x4f15ea){_0x4ce49d[_0x71bd('0x19')](0x194);}return _0x4f15ea;};}function handleError(_0x586723,_0x373e22){_0x373e22=_0x373e22||0x1f4;return function(_0x1c6c73){logger[_0x71bd('0x25')](_0x1c6c73[_0x71bd('0x26')]);if(_0x1c6c73[_0x71bd('0x27')]){delete _0x1c6c73[_0x71bd('0x27')];}_0x586723[_0x71bd('0x1a')](_0x373e22)['send'](_0x1c6c73);};}exports['index']=function(_0x5e5d6e,_0x65722c){var _0x73b5a6={},_0x53b669={},_0xe21917={'count':0x0,'rows':[]};var _0x8a0224=_['map'](db[_0x71bd('0x28')]['rawAttributes'],function(_0x5d98db){return{'name':_0x5d98db[_0x71bd('0x29')],'type':_0x5d98db[_0x71bd('0x2a')][_0x71bd('0x2b')]};});_0x53b669[_0x71bd('0x2c')]=_[_0x71bd('0x2d')](_0x8a0224,'name');_0x53b669[_0x71bd('0x2e')]=_[_0x71bd('0x2f')](_0x5e5d6e[_0x71bd('0x2e')]);_0x53b669[_0x71bd('0x30')]=_['intersection'](_0x53b669[_0x71bd('0x2c')],_0x53b669[_0x71bd('0x2e')]);_0x73b5a6[_0x71bd('0x31')]=_[_0x71bd('0x32')](_0x53b669['model'],qs[_0x71bd('0x33')](_0x5e5d6e['query'][_0x71bd('0x33')]));_0x73b5a6[_0x71bd('0x31')]=_0x73b5a6[_0x71bd('0x31')][_0x71bd('0x34')]?_0x73b5a6['attributes']:_0x53b669[_0x71bd('0x2c')];if(!_0x5e5d6e[_0x71bd('0x2e')][_0x71bd('0x35')](_0x71bd('0x36'))){_0x73b5a6[_0x71bd('0x1d')]=qs[_0x71bd('0x1d')](_0x5e5d6e[_0x71bd('0x2e')][_0x71bd('0x1d')]);_0x73b5a6[_0x71bd('0x1f')]=qs[_0x71bd('0x1f')](_0x5e5d6e[_0x71bd('0x2e')]['offset']);}_0x73b5a6[_0x71bd('0x37')]=qs[_0x71bd('0x38')](_0x5e5d6e[_0x71bd('0x2e')]['sort']);_0x73b5a6[_0x71bd('0x39')]=qs[_0x71bd('0x30')](_[_0x71bd('0x3a')](_0x5e5d6e[_0x71bd('0x2e')],_0x53b669[_0x71bd('0x30')]),_0x8a0224);if(_0x5e5d6e[_0x71bd('0x2e')][_0x71bd('0x3b')]){_0x73b5a6[_0x71bd('0x39')]=_[_0x71bd('0x3c')](_0x73b5a6[_0x71bd('0x39')],{'$or':_[_0x71bd('0x2d')](_0x8a0224,function(_0x520665){if(_0x520665[_0x71bd('0x2a')]!==_0x71bd('0x3d')){var _0x25f58={};_0x25f58[_0x520665['name']]={'$like':'%'+_0x5e5d6e[_0x71bd('0x2e')][_0x71bd('0x3b')]+'%'};return _0x25f58;}})});}_0x73b5a6=_['merge']({},_0x73b5a6,_0x5e5d6e['options']);var _0x482963={'where':_0x73b5a6[_0x71bd('0x39')]};return db[_0x71bd('0x28')][_0x71bd('0x1e')](_0x482963)[_0x71bd('0x24')](function(_0x560d8d){_0xe21917[_0x71bd('0x1e')]=_0x560d8d;if(_0x5e5d6e[_0x71bd('0x2e')][_0x71bd('0x3e')]){_0x73b5a6['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x71bd('0x3f')](_0x73b5a6);})[_0x71bd('0x24')](function(_0x1c1c24){_0xe21917[_0x71bd('0x40')]=_0x1c1c24;return _0xe21917;})[_0x71bd('0x24')](respondWithFilteredResult(_0x65722c,_0x73b5a6))[_0x71bd('0x41')](handleError(_0x65722c,null));};exports[_0x71bd('0x42')]=function(_0x370a76,_0x2a5c99){var _0x376db4={'raw':![],'where':{'id':_0x370a76[_0x71bd('0x43')]['id']}},_0x15b13a={};_0x15b13a[_0x71bd('0x2c')]=_[_0x71bd('0x2f')](db['UserProfileSection']['rawAttributes']);_0x15b13a[_0x71bd('0x2e')]=_[_0x71bd('0x2f')](_0x370a76['query']);_0x15b13a[_0x71bd('0x30')]=_[_0x71bd('0x32')](_0x15b13a[_0x71bd('0x2c')],_0x15b13a[_0x71bd('0x2e')]);_0x376db4[_0x71bd('0x31')]=_[_0x71bd('0x32')](_0x15b13a[_0x71bd('0x2c')],qs[_0x71bd('0x33')](_0x370a76[_0x71bd('0x2e')][_0x71bd('0x33')]));_0x376db4['attributes']=_0x376db4[_0x71bd('0x31')][_0x71bd('0x34')]?_0x376db4[_0x71bd('0x31')]:_0x15b13a['model'];if(_0x370a76[_0x71bd('0x2e')][_0x71bd('0x3e')]){_0x376db4['include']=[{'all':!![]}];}_0x376db4=_[_0x71bd('0x3c')]({},_0x376db4,_0x370a76[_0x71bd('0x44')]);return db[_0x71bd('0x28')]['find'](_0x376db4)['then'](handleEntityNotFound(_0x2a5c99,null))['then'](respondWithResult(_0x2a5c99,null))[_0x71bd('0x41')](handleError(_0x2a5c99,null));};exports[_0x71bd('0x45')]=function(_0x373fc1,_0x5d1eb9){return db[_0x71bd('0x28')][_0x71bd('0x45')](_0x373fc1[_0x71bd('0x46')],{})['then'](respondWithResult(_0x5d1eb9,0xc9))[_0x71bd('0x41')](handleError(_0x5d1eb9,null));};exports[_0x71bd('0x23')]=function(_0x268627,_0x1838b9){if(_0x268627['body']['id']){delete _0x268627[_0x71bd('0x46')]['id'];}return db['UserProfileSection'][_0x71bd('0x47')]({'where':{'id':_0x268627[_0x71bd('0x43')]['id']}})[_0x71bd('0x24')](handleEntityNotFound(_0x1838b9,null))[_0x71bd('0x24')](saveUpdates(_0x268627[_0x71bd('0x46')],null))[_0x71bd('0x24')](respondWithResult(_0x1838b9,null))[_0x71bd('0x41')](handleError(_0x1838b9,null));};exports[_0x71bd('0x48')]=function(_0x529024,_0x18329c){return db[_0x71bd('0x28')]['find']({'where':{'id':_0x529024['params']['id']}})[_0x71bd('0x24')](handleEntityNotFound(_0x18329c,null))['then'](removeEntity(_0x18329c,null))['catch'](handleError(_0x18329c,null));};exports[_0x71bd('0x49')]=function(_0x4d3c45,_0x493bef){return db[_0x71bd('0x28')]['describe']()[_0x71bd('0x24')](respondWithResult(_0x493bef,null))['catch'](handleError(_0x493bef,null));};
\ No newline at end of file
index 6cd3c25..cb41114 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34c1=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','compositeIndex','userProfileId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34c1,0x16c));var _0x134c=function(_0x33ac75,_0x4953e3){_0x33ac75=_0x33ac75-0x0;var _0x34d5f2=_0x34c1[_0x33ac75];return _0x34d5f2;};'use strict';var _=require(_0x134c('0x0'));var util=require(_0x134c('0x1'));var logger=require('../../config/logger')(_0x134c('0x2'));var moment=require(_0x134c('0x3'));var BPromise=require(_0x134c('0x4'));var rp=require(_0x134c('0x5'));var fs=require('fs');var path=require(_0x134c('0x6'));var rimraf=require(_0x134c('0x7'));var config=require(_0x134c('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x134c('0x9')]=function(_0x4305f1,_0x5718d6){return _0x4305f1[_0x134c('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x134c('0xb'),'fields':['sectionId',_0x134c('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xf161=['bluebird','request-promise','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','util','api'];(function(_0xc77de0,_0x56ffa1){var _0x351219=function(_0x3cf1b8){while(--_0x3cf1b8){_0xc77de0['push'](_0xc77de0['shift']());}};_0x351219(++_0x56ffa1);}(_0xf161,0xa2));var _0x1f16=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xf161[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var logger=require('../../config/logger')(_0x1f16('0x2'));var moment=require('moment');var BPromise=require(_0x1f16('0x3'));var rp=require(_0x1f16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f16('0x5'));var config=require(_0x1f16('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x1f16('0x7')]=function(_0x4ffc93,_0x232f9a){return _0x4ffc93['define'](_0x1f16('0x8'),attributes,{'tableName':_0x1f16('0x9'),'paranoid':![],'indexes':[{'name':_0x1f16('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});};
\ No newline at end of file
index b4ab4a5..58955b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd5f7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x16ccdd,_0x6c9fa3){var _0x18916d=function(_0x58dad6){while(--_0x58dad6){_0x16ccdd['push'](_0x16ccdd['shift']());}};_0x18916d(++_0x6c9fa3);}(_0xd5f7,0x16f));var _0x7d5f=function(_0x55adb5,_0x41bd54){_0x55adb5=_0x55adb5-0x0;var _0x56fb45=_0xd5f7[_0x55adb5];return _0x56fb45;};'use strict';var _=require(_0x7d5f('0x0'));var util=require(_0x7d5f('0x1'));var moment=require(_0x7d5f('0x2'));var BPromise=require(_0x7d5f('0x3'));var rs=require(_0x7d5f('0x4'));var fs=require('fs');var Redis=require(_0x7d5f('0x5'));var db=require(_0x7d5f('0x6'))['db'];var utils=require(_0x7d5f('0x7'));var logger=require(_0x7d5f('0x8'))(_0x7d5f('0x9'));var config=require(_0x7d5f('0xa'));var jayson=require(_0x7d5f('0xb'));var client=jayson['client'][_0x7d5f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x92c404,_0x2b191d,_0x3b7e34){return new BPromise(function(_0x470589,_0x1e404a){return client['request'](_0x92c404,_0x3b7e34)[_0x7d5f('0xd')](function(_0x416872){logger[_0x7d5f('0xe')](_0x7d5f('0xf'),_0x2b191d,_0x7d5f('0x10'));logger[_0x7d5f('0x11')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2b191d,_0x7d5f('0x10'),JSON[_0x7d5f('0x12')](_0x416872));if(_0x416872[_0x7d5f('0x13')]){if(_0x416872['error']['code']===0x1f4){logger[_0x7d5f('0x13')](_0x7d5f('0xf'),_0x2b191d,_0x416872[_0x7d5f('0x13')][_0x7d5f('0x14')]);return _0x1e404a(_0x416872[_0x7d5f('0x13')][_0x7d5f('0x14')]);}logger[_0x7d5f('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x2b191d,_0x416872[_0x7d5f('0x13')]['message']);return _0x470589(_0x416872[_0x7d5f('0x13')][_0x7d5f('0x14')]);}else{logger[_0x7d5f('0xe')](_0x7d5f('0xf'),_0x2b191d,_0x7d5f('0x10'));_0x470589(_0x416872[_0x7d5f('0x15')][_0x7d5f('0x14')]);}})[_0x7d5f('0x16')](function(_0x5965cc){logger[_0x7d5f('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x2b191d,_0x5965cc);_0x1e404a(_0x5965cc);});});}
\ No newline at end of file
+var _0x403d=['lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x26913d,_0x306f60){var _0x242cec=function(_0x30e185){while(--_0x30e185){_0x26913d['push'](_0x26913d['shift']());}};_0x242cec(++_0x306f60);}(_0x403d,0x111));var _0xd403=function(_0x487524,_0x292ba6){_0x487524=_0x487524-0x0;var _0x3f3543=_0x403d[_0x487524];return _0x3f3543;};'use strict';var _=require(_0xd403('0x0'));var util=require(_0xd403('0x1'));var moment=require('moment');var BPromise=require(_0xd403('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd403('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd403('0x4'));var config=require(_0xd403('0x5'));var jayson=require(_0xd403('0x6'));var client=jayson[_0xd403('0x7')][_0xd403('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26110b,_0x4095bb,_0x109ea7){return new BPromise(function(_0x3f8190,_0x572675){return client[_0xd403('0x9')](_0x26110b,_0x109ea7)[_0xd403('0xa')](function(_0x3d1fe5){logger[_0xd403('0xb')](_0xd403('0xc'),_0x4095bb,_0xd403('0xd'));logger[_0xd403('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4095bb,'request\x20sent',JSON[_0xd403('0xf')](_0x3d1fe5));if(_0x3d1fe5[_0xd403('0x10')]){if(_0x3d1fe5[_0xd403('0x10')][_0xd403('0x11')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4095bb,_0x3d1fe5[_0xd403('0x10')][_0xd403('0x12')]);return _0x572675(_0x3d1fe5[_0xd403('0x10')][_0xd403('0x12')]);}logger[_0xd403('0x10')](_0xd403('0xc'),_0x4095bb,_0x3d1fe5[_0xd403('0x10')][_0xd403('0x12')]);return _0x3f8190(_0x3d1fe5[_0xd403('0x10')]['message']);}else{logger[_0xd403('0xb')](_0xd403('0xc'),_0x4095bb,'request\x20sent');_0x3f8190(_0x3d1fe5[_0xd403('0x13')]['message']);}})[_0xd403('0x14')](function(_0x1d1abd){logger[_0xd403('0x10')](_0xd403('0xc'),_0x4095bb,_0x1d1abd);_0x572675(_0x1d1abd);});});}
\ No newline at end of file
index 2d633b3..d1d5b4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3d1f8e,_0x279486){var _0x3ebcb3=function(_0x544b2e){while(--_0x544b2e){_0x3d1f8e['push'](_0x3d1f8e['shift']());}};_0x3ebcb3(++_0x279486);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2ca892,_0x11af43){var _0x3d3f77=function(_0xe39e57){while(--_0xe39e57){_0x2ca892['push'](_0x2ca892['shift']());}};_0x3d3f77(++_0x11af43);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index e374c12..ee6ba51 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28dc=['exports','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x28dc,0xe6));var _0xc28d=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0x28dc[_0x134448];return _0x2d52a1;};'use strict';var Sequelize=require('sequelize');module[_0xc28d('0x0')]={'penalty':{'type':Sequelize[_0xc28d('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xacea=['INTEGER','sequelize','exports'];(function(_0x2edf51,_0x593da9){var _0x570bde=function(_0x1ae76f){while(--_0x1ae76f){_0x2edf51['push'](_0x2edf51['shift']());}};_0x570bde(++_0x593da9);}(_0xacea,0x1d2));var _0xaace=function(_0x479723,_0x1b6d50){_0x479723=_0x479723-0x0;var _0x3d1e76=_0xacea[_0x479723];return _0x3d1e76;};'use strict';var Sequelize=require(_0xaace('0x0'));module[_0xaace('0x1')]={'penalty':{'type':Sequelize[_0xaace('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 096231b..698e1ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fd4=['rimraf','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x26390f,_0x5e1005){_0x26390f=_0x26390f-0x0;var _0x3d9d11=_0x9fd4[_0x26390f];return _0x3d9d11;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('UserSmsQueue',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x90b1=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x8d3a24,_0x32201a){var _0x3977ae=function(_0x895da2){while(--_0x895da2){_0x8d3a24['push'](_0x8d3a24['shift']());}};_0x3977ae(++_0x32201a);}(_0x90b1,0x1bb));var _0x190b=function(_0x1837da,_0x5e3681){_0x1837da=_0x1837da-0x0;var _0x3b0ba2=_0x90b1[_0x1837da];return _0x3b0ba2;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ece8b4a..003d79d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9788=['stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3c08ea,_0x419b25){var _0x4b6e51=function(_0x4e53b3){while(--_0x4e53b3){_0x3c08ea['push'](_0x3c08ea['shift']());}};_0x4b6e51(++_0x419b25);}(_0x9788,0x15d));var _0x8978=function(_0x2cf429,_0x4f79b1){_0x2cf429=_0x2cf429-0x0;var _0x4e352f=_0x9788[_0x2cf429];return _0x4e352f;};'use strict';var _=require(_0x8978('0x0'));var util=require('util');var moment=require(_0x8978('0x1'));var BPromise=require(_0x8978('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8978('0x3'));var db=require(_0x8978('0x4'))['db'];var utils=require(_0x8978('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8978('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8978('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x22f7af,_0x1ead70,_0x5b9c39){return new BPromise(function(_0x376312,_0x39d7e7){return client['request'](_0x22f7af,_0x5b9c39)[_0x8978('0x8')](function(_0x30b60c){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x1ead70,_0x8978('0x9'));logger[_0x8978('0xa')](_0x8978('0xb'),_0x1ead70,_0x8978('0x9'),JSON[_0x8978('0xc')](_0x30b60c));if(_0x30b60c[_0x8978('0xd')]){if(_0x30b60c[_0x8978('0xd')][_0x8978('0xe')]===0x1f4){logger['error'](_0x8978('0xf'),_0x1ead70,_0x30b60c[_0x8978('0xd')][_0x8978('0x10')]);return _0x39d7e7(_0x30b60c[_0x8978('0xd')][_0x8978('0x10')]);}logger[_0x8978('0xd')](_0x8978('0xf'),_0x1ead70,_0x30b60c[_0x8978('0xd')][_0x8978('0x10')]);return _0x376312(_0x30b60c[_0x8978('0xd')][_0x8978('0x10')]);}else{logger[_0x8978('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x1ead70,_0x8978('0x9'));_0x376312(_0x30b60c[_0x8978('0x12')][_0x8978('0x10')]);}})['catch'](function(_0x14d05c){logger[_0x8978('0xd')](_0x8978('0xf'),_0x1ead70,_0x14d05c);_0x39d7e7(_0x14d05c);});});}
\ No newline at end of file
+var _0xdc9c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xdc9c,0x114));var _0xcdc9=function(_0x54970d,_0x4d1401){_0x54970d=_0x54970d-0x0;var _0x1abe8f=_0xdc9c[_0x54970d];return _0x1abe8f;};'use strict';var _=require(_0xcdc9('0x0'));var util=require('util');var moment=require(_0xcdc9('0x1'));var BPromise=require(_0xcdc9('0x2'));var rs=require(_0xcdc9('0x3'));var fs=require('fs');var Redis=require(_0xcdc9('0x4'));var db=require(_0xcdc9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdc9('0x6'))(_0xcdc9('0x7'));var config=require(_0xcdc9('0x8'));var jayson=require(_0xcdc9('0x9'));var client=jayson[_0xcdc9('0xa')][_0xcdc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c4cc7,_0x543e69,_0x13d385){return new BPromise(function(_0x2be415,_0x1a4817){return client[_0xcdc9('0xc')](_0x3c4cc7,_0x13d385)[_0xcdc9('0xd')](function(_0x48dc2c){logger[_0xcdc9('0xe')](_0xcdc9('0xf'),_0x543e69,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x543e69,_0xcdc9('0x10'),JSON[_0xcdc9('0x11')](_0x48dc2c));if(_0x48dc2c[_0xcdc9('0x12')]){if(_0x48dc2c['error'][_0xcdc9('0x13')]===0x1f4){logger[_0xcdc9('0x12')](_0xcdc9('0xf'),_0x543e69,_0x48dc2c[_0xcdc9('0x12')]['message']);return _0x1a4817(_0x48dc2c['error'][_0xcdc9('0x14')]);}logger[_0xcdc9('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x543e69,_0x48dc2c[_0xcdc9('0x12')][_0xcdc9('0x14')]);return _0x2be415(_0x48dc2c[_0xcdc9('0x12')][_0xcdc9('0x14')]);}else{logger[_0xcdc9('0xe')](_0xcdc9('0xf'),_0x543e69,_0xcdc9('0x10'));_0x2be415(_0x48dc2c[_0xcdc9('0x15')][_0xcdc9('0x14')]);}})[_0xcdc9('0x16')](function(_0x427639){logger[_0xcdc9('0x12')](_0xcdc9('0xf'),_0x543e69,_0x427639);_0x1a4817(_0x427639);});});}
\ No newline at end of file
index c64943e..ed6da42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9841=['exports','sequelize'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9841,0xf7));var _0x1984=function(_0x1c4e98,_0x187001){_0x1c4e98=_0x1c4e98-0x0;var _0x1f2420=_0x9841[_0x1c4e98];return _0x1f2420;};'use strict';var Sequelize=require(_0x1984('0x0'));module[_0x1984('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0xa304=['exports','INTEGER','sequelize'];(function(_0x574d53,_0x11971c){var _0x23c94e=function(_0x23c12c){while(--_0x23c12c){_0x574d53['push'](_0x574d53['shift']());}};_0x23c94e(++_0x11971c);}(_0xa304,0x113));var _0x4a30=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0xa304[_0x4629ed];return _0x52ca04;};'use strict';var Sequelize=require(_0x4a30('0x0'));module[_0x4a30('0x1')]={'UserId':{'type':Sequelize[_0x4a30('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4a30('0x2')]}};
\ No newline at end of file
index 6e9b5ab..e74a222 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3d8807,_0x19bda0){var _0x1f9ad9=function(_0x415f3e){while(--_0x415f3e){_0x3d8807['push'](_0x3d8807['shift']());}};_0x1f9ad9(++_0x19bda0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x260a52,_0x282428){var _0x400724=function(_0x3c86a9){while(--_0x3c86a9){_0x260a52['push'](_0x260a52['shift']());}};_0x400724(++_0x282428);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ed9aeef..c614e30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x94c8d3,_0x1d58ce){var _0x1ad94f=function(_0x5e3cbc){while(--_0x5e3cbc){_0x94c8d3['push'](_0x94c8d3['shift']());}};_0x1ad94f(++_0x1d58ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x288ab8,_0x3ddadb){_0x288ab8=_0x288ab8-0x0;var _0x449669=_0xedd9[_0x288ab8];return _0x449669;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x14a79a,_0x281ce9){var _0x55d55b=function(_0x1cd245){while(--_0x1cd245){_0x14a79a['push'](_0x14a79a['shift']());}};_0x55d55b(++_0x281ce9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index 0bd2d4b..3220a54 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0efc=['sequelize','exports'];(function(_0x12cebf,_0x26fbdd){var _0x100c9c=function(_0x2b042b){while(--_0x2b042b){_0x12cebf['push'](_0x12cebf['shift']());}};_0x100c9c(++_0x26fbdd);}(_0x0efc,0x1b2));var _0xc0ef=function(_0x421b7b,_0x566ee9){_0x421b7b=_0x421b7b-0x0;var _0x2c472c=_0x0efc[_0x421b7b];return _0x2c472c;};'use strict';var Sequelize=require(_0xc0ef('0x0'));module[_0xc0ef('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x0699=['INTEGER','sequelize','exports'];(function(_0x2c9b5e,_0x4dc264){var _0x218887=function(_0x5e86e8){while(--_0x5e86e8){_0x2c9b5e['push'](_0x2c9b5e['shift']());}};_0x218887(++_0x4dc264);}(_0x0699,0x181));var _0x9069=function(_0x40bd07,_0x1cc48f){_0x40bd07=_0x40bd07-0x0;var _0x34562b=_0x0699[_0x40bd07];return _0x34562b;};'use strict';var Sequelize=require(_0x9069('0x0'));module[_0x9069('0x1')]={'penalty':{'type':Sequelize[_0x9069('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 32644e4..984149c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1932=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','./userVoiceQueue.attributes'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1932,0xa8));var _0x2193=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1932[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x2193('0x0'));var util=require(_0x2193('0x1'));var logger=require(_0x2193('0x2'))(_0x2193('0x3'));var moment=require(_0x2193('0x4'));var BPromise=require('bluebird');var rp=require(_0x2193('0x5'));var fs=require('fs');var path=require(_0x2193('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2193('0x7'));module['exports']=function(_0x3aaed8,_0x3a749c){return _0x3aaed8[_0x2193('0x8')](_0x2193('0x9'),attributes,{'tableName':_0x2193('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x326a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x489df9,_0x5d63b8){var _0x1f2679=function(_0x4de304){while(--_0x4de304){_0x489df9['push'](_0x489df9['shift']());}};_0x1f2679(++_0x5d63b8);}(_0x326a,0x131));var _0xa326=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x326a[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0xa326('0x0'));var util=require(_0xa326('0x1'));var logger=require(_0xa326('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa326('0x3'));var rp=require(_0xa326('0x4'));var fs=require('fs');var path=require(_0xa326('0x5'));var rimraf=require(_0xa326('0x6'));var config=require(_0xa326('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xa326('0x8')]=function(_0x4590ae,_0x2a1425){return _0x4590ae['define'](_0xa326('0x9'),attributes,{'tableName':_0xa326('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d8e0077..38454e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe92=['UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x14a97c,_0x56f11){var _0x5b1302=function(_0x317165){while(--_0x317165){_0x14a97c['push'](_0x14a97c['shift']());}};_0x5b1302(++_0x56f11);}(_0xbe92,0x1e9));var _0x2be9=function(_0x37a887,_0x5abb88){_0x37a887=_0x37a887-0x0;var _0x52ff95=_0xbe92[_0x37a887];return _0x52ff95;};'use strict';var _=require('lodash');var util=require(_0x2be9('0x0'));var moment=require(_0x2be9('0x1'));var BPromise=require('bluebird');var rs=require(_0x2be9('0x2'));var fs=require('fs');var Redis=require(_0x2be9('0x3'));var db=require(_0x2be9('0x4'))['db'];var utils=require(_0x2be9('0x5'));var logger=require(_0x2be9('0x6'))('rpc');var config=require(_0x2be9('0x7'));var jayson=require(_0x2be9('0x8'));var client=jayson[_0x2be9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13f8f2,_0x3fc019,_0x466c16){return new BPromise(function(_0x1108d9,_0x172ad0){return client['request'](_0x13f8f2,_0x466c16)[_0x2be9('0xa')](function(_0x5156f5){logger['info'](_0x2be9('0xb'),_0x3fc019,'request\x20sent');logger['debug'](_0x2be9('0xc'),_0x3fc019,_0x2be9('0xd'),JSON[_0x2be9('0xe')](_0x5156f5));if(_0x5156f5['error']){if(_0x5156f5[_0x2be9('0xf')][_0x2be9('0x10')]===0x1f4){logger[_0x2be9('0xf')](_0x2be9('0xb'),_0x3fc019,_0x5156f5[_0x2be9('0xf')]['message']);return _0x172ad0(_0x5156f5['error'][_0x2be9('0x11')]);}logger[_0x2be9('0xf')](_0x2be9('0xb'),_0x3fc019,_0x5156f5[_0x2be9('0xf')][_0x2be9('0x11')]);return _0x1108d9(_0x5156f5[_0x2be9('0xf')][_0x2be9('0x11')]);}else{logger[_0x2be9('0x12')](_0x2be9('0xb'),_0x3fc019,_0x2be9('0xd'));_0x1108d9(_0x5156f5['result']['message']);}})[_0x2be9('0x13')](function(_0xa79fdf){logger['error'](_0x2be9('0xb'),_0x3fc019,_0xa79fdf);_0x172ad0(_0xa79fdf);});});}
\ No newline at end of file
+var _0xf83d=['jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x159fec,_0xa2a8c){var _0x5ea21a=function(_0x409153){while(--_0x409153){_0x159fec['push'](_0x159fec['shift']());}};_0x5ea21a(++_0xa2a8c);}(_0xf83d,0x162));var _0xdf83=function(_0x49dbb6,_0xa76da7){_0x49dbb6=_0x49dbb6-0x0;var _0x435e02=_0xf83d[_0x49dbb6];return _0x435e02;};'use strict';var _=require('lodash');var util=require(_0xdf83('0x0'));var moment=require(_0xdf83('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf83('0x2'));var fs=require('fs');var Redis=require(_0xdf83('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf83('0x4'));var logger=require('../../config/logger')(_0xdf83('0x5'));var config=require(_0xdf83('0x6'));var jayson=require(_0xdf83('0x7'));var client=jayson[_0xdf83('0x8')][_0xdf83('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34e4da,_0x38b999,_0x224290){return new BPromise(function(_0x35ba64,_0x17b910){return client['request'](_0x34e4da,_0x224290)[_0xdf83('0xa')](function(_0x45c163){logger['info'](_0xdf83('0xb'),_0x38b999,_0xdf83('0xc'));logger[_0xdf83('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x38b999,_0xdf83('0xc'),JSON[_0xdf83('0xe')](_0x45c163));if(_0x45c163[_0xdf83('0xf')]){if(_0x45c163['error']['code']===0x1f4){logger[_0xdf83('0xf')](_0xdf83('0xb'),_0x38b999,_0x45c163[_0xdf83('0xf')][_0xdf83('0x10')]);return _0x17b910(_0x45c163[_0xdf83('0xf')][_0xdf83('0x10')]);}logger[_0xdf83('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x38b999,_0x45c163[_0xdf83('0xf')]['message']);return _0x35ba64(_0x45c163[_0xdf83('0xf')][_0xdf83('0x10')]);}else{logger['info'](_0xdf83('0xb'),_0x38b999,'request\x20sent');_0x35ba64(_0x45c163[_0xdf83('0x11')][_0xdf83('0x10')]);}})[_0xdf83('0x12')](function(_0xb7272b){logger[_0xdf83('0xf')](_0xdf83('0xb'),_0x38b999,_0xb7272b);_0x17b910(_0xb7272b);});});}
\ No newline at end of file
index dd1e7a9..04d07b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x469101,_0x5808cf){var _0x3a92ff=function(_0x4e344b){while(--_0x4e344b){_0x469101['push'](_0x469101['shift']());}};_0x3a92ff(++_0x5808cf);}(_0xe706,0xa3));var _0x6e70=function(_0x569744,_0x30c532){_0x569744=_0x569744-0x0;var _0x57e918=_0xe706[_0x569744];return _0x57e918;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x48f62a,_0x1b3782){var _0x4ebe15=function(_0x7f7728){while(--_0x7f7728){_0x48f62a['push'](_0x48f62a['shift']());}};_0x4ebe15(++_0x1b3782);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index c5a99ff..7bca581 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd021=['Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xd021,0x15e));var _0x1d02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd021[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1d02('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1d02('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1d02('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1d02('0x2')},'UserId':{'type':Sequelize[_0x1d02('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1d02('0x3'),'comment':_0x1d02('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1d02('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1d02('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1d02('0x2')},'paused':{'type':Sequelize[_0x1d02('0x1')](0xb),'defaultValue':0x0,'comment':_0x1d02('0x2')}};
\ No newline at end of file
+var _0x179d=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x179d,0xce));var _0xd179=function(_0x51f740,_0x5040e7){_0x51f740=_0x51f740-0x0;var _0x1442c7=_0x179d[_0x51f740];return _0x1442c7;};'use strict';var Sequelize=require(_0xd179('0x0'));module[_0xd179('0x1')]={'uniqueid':{'type':Sequelize[_0xd179('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd179('0x3')},'membername':{'type':Sequelize[_0xd179('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xd179('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xd179('0x4')],'allowNull':![],'unique':_0xd179('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xd179('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xd179('0x4')],'allowNull':![],'unique':_0xd179('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xd179('0x2')](0xb),'defaultValue':0x0,'comment':_0xd179('0x3')},'paused':{'type':Sequelize[_0xd179('0x2')](0xb),'defaultValue':0x0,'comment':_0xd179('0x3')}};
\ No newline at end of file
index 0df2722..d88d02e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ee2=['hook','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5bd7d9,_0x9a830f){var _0x53c9a7=function(_0x595d9e){while(--_0x595d9e){_0x5bd7d9['push'](_0x5bd7d9['shift']());}};_0x53c9a7(++_0x9a830f);}(_0x5ee2,0x9b));var _0x25ee=function(_0x367731,_0x2bc225){_0x367731=_0x367731-0x0;var _0x174b03=_0x5ee2[_0x367731];return _0x174b03;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x25ee('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x25ee('0x1')](0x0);var events={'afterCreate':_0x25ee('0x2'),'afterUpdate':_0x25ee('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2e640c){return function(_0x9d511b,_0x1fadba,_0x518420){UserVoiceQueueRtEvents[_0x25ee('0x4')](_0x2e640c+':'+_0x9d511b['id'],_0x9d511b);UserVoiceQueueRtEvents[_0x25ee('0x4')](_0x2e640c,_0x9d511b);_0x518420(null);};}for(var e in events){if(events[_0x25ee('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x25ee('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents;
\ No newline at end of file
+var _0x9d19=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xe29886,_0x16714d){var _0x4b8bf4=function(_0x36f075){while(--_0x36f075){_0xe29886['push'](_0xe29886['shift']());}};_0x4b8bf4(++_0x16714d);}(_0x9d19,0xfa));var _0x99d1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x9d19[_0x4baae2];return _0x1a2285;};'use strict';var EventEmitter=require(_0x99d1('0x0'));var UserVoiceQueueRt=require(_0x99d1('0x1'))['db'][_0x99d1('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x99d1('0x3')](0x0);var events={'afterCreate':_0x99d1('0x4'),'afterUpdate':_0x99d1('0x5'),'afterDestroy':_0x99d1('0x6')};function emitEvent(_0x3ba592){return function(_0x14828f,_0x1b094a,_0x4324c3){UserVoiceQueueRtEvents['emit'](_0x3ba592+':'+_0x14828f['id'],_0x14828f);UserVoiceQueueRtEvents[_0x99d1('0x7')](_0x3ba592,_0x14828f);_0x4324c3(null);};}for(var e in events){if(events[_0x99d1('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x99d1('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents;
\ No newline at end of file
index 91a3a99..b2639d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2eb1=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','util','moment','bluebird'];(function(_0x2e3d82,_0x18a7f0){var _0x57ecc4=function(_0x363749){while(--_0x363749){_0x2e3d82['push'](_0x2e3d82['shift']());}};_0x57ecc4(++_0x18a7f0);}(_0x2eb1,0x102));var _0x12eb=function(_0x1d97a3,_0x5015cf){_0x1d97a3=_0x1d97a3-0x0;var _0x20e3f0=_0x2eb1[_0x1d97a3];return _0x20e3f0;};'use strict';var _=require('lodash');var util=require(_0x12eb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x12eb('0x1'));var BPromise=require(_0x12eb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12eb('0x3'));var rimraf=require(_0x12eb('0x4'));var config=require(_0x12eb('0x5'));var attributes=require(_0x12eb('0x6'));module[_0x12eb('0x7')]=function(_0x17a19c,_0x3af95a){return _0x17a19c[_0x12eb('0x8')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x16af=['rimraf','./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','lodash','api','moment','request-promise','path'];(function(_0x2c959b,_0x268959){var _0xa8b43d=function(_0x4a088a){while(--_0x4a088a){_0x2c959b['push'](_0x2c959b['shift']());}};_0xa8b43d(++_0x268959);}(_0x16af,0xe5));var _0xf16a=function(_0x3af23e,_0x778b08){_0x3af23e=_0x3af23e-0x0;var _0x3d7dd9=_0x16af[_0x3af23e];return _0x3d7dd9;};'use strict';var _=require(_0xf16a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf16a('0x1'));var moment=require(_0xf16a('0x2'));var BPromise=require('bluebird');var rp=require(_0xf16a('0x3'));var fs=require('fs');var path=require(_0xf16a('0x4'));var rimraf=require(_0xf16a('0x5'));var config=require('../../config/environment');var attributes=require(_0xf16a('0x6'));module['exports']=function(_0x43756f,_0x3efc34){return _0x43756f[_0xf16a('0x7')]('UserVoiceQueueRt',attributes,{'tableName':_0xf16a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4b441ba..ba8bf03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ebb=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util'];(function(_0x24f885,_0x93dbf){var _0x3b4bdd=function(_0x4b4a3e){while(--_0x4b4a3e){_0x24f885['push'](_0x24f885['shift']());}};_0x3b4bdd(++_0x93dbf);}(_0x1ebb,0x1df));var _0xb1eb=function(_0x420945,_0x1b3ffc){_0x420945=_0x420945-0x0;var _0x218795=_0x1ebb[_0x420945];return _0x218795;};'use strict';var _=require(_0xb1eb('0x0'));var util=require(_0xb1eb('0x1'));var moment=require('moment');var BPromise=require(_0xb1eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1eb('0x4'));var logger=require(_0xb1eb('0x5'))(_0xb1eb('0x6'));var config=require(_0xb1eb('0x7'));var jayson=require(_0xb1eb('0x8'));var client=jayson[_0xb1eb('0x9')][_0xb1eb('0xa')]({'port':0x232a});config[_0xb1eb('0xb')]=_[_0xb1eb('0xc')](config['redis'],{'host':_0xb1eb('0xd'),'port':0x18eb});var socket=require(_0xb1eb('0xe'))(new Redis(config[_0xb1eb('0xb')]));require('./userVoiceQueueRt.socket')[_0xb1eb('0xf')](socket);function respondWithRpcPromise(_0x527069,_0x1c5c6d,_0x5a65fe){return new BPromise(function(_0x48d1d7,_0x1c0bf4){return client[_0xb1eb('0x10')](_0x527069,_0x5a65fe)[_0xb1eb('0x11')](function(_0x9f7195){logger[_0xb1eb('0x12')](_0xb1eb('0x13'),_0x1c5c6d,_0xb1eb('0x14'));logger[_0xb1eb('0x15')](_0xb1eb('0x16'),_0x1c5c6d,_0xb1eb('0x14'),JSON[_0xb1eb('0x17')](_0x9f7195));if(_0x9f7195['error']){if(_0x9f7195[_0xb1eb('0x18')][_0xb1eb('0x19')]===0x1f4){logger['error'](_0xb1eb('0x13'),_0x1c5c6d,_0x9f7195[_0xb1eb('0x18')]['message']);return _0x1c0bf4(_0x9f7195[_0xb1eb('0x18')][_0xb1eb('0x1a')]);}logger[_0xb1eb('0x18')](_0xb1eb('0x13'),_0x1c5c6d,_0x9f7195[_0xb1eb('0x18')][_0xb1eb('0x1a')]);return _0x48d1d7(_0x9f7195['error'][_0xb1eb('0x1a')]);}else{logger[_0xb1eb('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c5c6d,_0xb1eb('0x14'));_0x48d1d7(_0x9f7195[_0xb1eb('0x1b')][_0xb1eb('0x1a')]);}})[_0xb1eb('0x1c')](function(_0xe5a7f4){logger[_0xb1eb('0x18')](_0xb1eb('0x13'),_0x1c5c6d,_0xe5a7f4);_0x1c0bf4(_0xe5a7f4);});});}exports[_0xb1eb('0x1d')]=function(_0x1af209){var _0x209ba4=this;return new Promise(function(_0x114cc3,_0x3e307a){return db['UserVoiceQueueRt'][_0xb1eb('0x1e')]({'raw':_0x1af209['options']?_0x1af209[_0xb1eb('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1af209['options']?_0x1af209['options'][_0xb1eb('0x20')]||null:null,'attributes':[[db[_0xb1eb('0x21')]['fn'](_0xb1eb('0x22'),db[_0xb1eb('0x21')]['fn']('IF',db['sequelize'][_0xb1eb('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xb1eb('0x24')]]})[_0xb1eb('0x11')](function(_0x5827b0){logger[_0xb1eb('0x12')](_0xb1eb('0x1d'),_0x1af209);logger[_0xb1eb('0x15')]('GetVoiceQueueRtPauses',_0x1af209,JSON[_0xb1eb('0x17')](_0x5827b0));_0x114cc3(_0x5827b0);})[_0xb1eb('0x1c')](function(_0x415169){logger[_0xb1eb('0x18')]('GetVoiceQueueRtPauses',_0x415169['message'],_0x1af209);_0x3e307a(_0x209ba4[_0xb1eb('0x18')](0x1f4,_0x415169[_0xb1eb('0x1a')]));});});};
\ No newline at end of file
+var _0x0803=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','info','result','catch','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','lodash','util','bluebird','randomstring'];(function(_0x407c58,_0x4135a8){var _0x3a733d=function(_0x37e31d){while(--_0x37e31d){_0x407c58['push'](_0x407c58['shift']());}};_0x3a733d(++_0x4135a8);}(_0x0803,0x9c));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3080('0x0'));var util=require(_0x3080('0x1'));var moment=require('moment');var BPromise=require(_0x3080('0x2'));var rs=require(_0x3080('0x3'));var fs=require('fs');var Redis=require(_0x3080('0x4'));var db=require(_0x3080('0x5'))['db'];var utils=require(_0x3080('0x6'));var logger=require(_0x3080('0x7'))(_0x3080('0x8'));var config=require(_0x3080('0x9'));var jayson=require(_0x3080('0xa'));var client=jayson[_0x3080('0xb')][_0x3080('0xc')]({'port':0x232a});config['redis']=_[_0x3080('0xd')](config[_0x3080('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3080('0xf'))(new Redis(config['redis']));require(_0x3080('0x10'))[_0x3080('0x11')](socket);function respondWithRpcPromise(_0x32d5b9,_0x32cc79,_0x2d96b3){return new BPromise(function(_0x3529ce,_0xc3ed80){return client[_0x3080('0x12')](_0x32d5b9,_0x2d96b3)[_0x3080('0x13')](function(_0x2fbf89){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x32cc79,_0x3080('0x14'));logger[_0x3080('0x15')](_0x3080('0x16'),_0x32cc79,_0x3080('0x14'),JSON[_0x3080('0x17')](_0x2fbf89));if(_0x2fbf89[_0x3080('0x18')]){if(_0x2fbf89['error'][_0x3080('0x19')]===0x1f4){logger[_0x3080('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x32cc79,_0x2fbf89[_0x3080('0x18')][_0x3080('0x1a')]);return _0xc3ed80(_0x2fbf89[_0x3080('0x18')][_0x3080('0x1a')]);}logger[_0x3080('0x18')](_0x3080('0x1b'),_0x32cc79,_0x2fbf89[_0x3080('0x18')][_0x3080('0x1a')]);return _0x3529ce(_0x2fbf89[_0x3080('0x18')][_0x3080('0x1a')]);}else{logger[_0x3080('0x1c')](_0x3080('0x1b'),_0x32cc79,_0x3080('0x14'));_0x3529ce(_0x2fbf89[_0x3080('0x1d')][_0x3080('0x1a')]);}})[_0x3080('0x1e')](function(_0x178386){logger[_0x3080('0x18')](_0x3080('0x1b'),_0x32cc79,_0x178386);_0xc3ed80(_0x178386);});});}exports['GetVoiceQueueRtPauses']=function(_0x1d1016){var _0x2a8740=this;return new Promise(function(_0x3e64cb,_0x102614){return db[_0x3080('0x1f')][_0x3080('0x20')]({'raw':_0x1d1016['options']?_0x1d1016[_0x3080('0x21')][_0x3080('0x22')]===undefined?!![]:![]:!![],'where':_0x1d1016[_0x3080('0x21')]?_0x1d1016[_0x3080('0x21')]['where']||null:null,'attributes':[[db[_0x3080('0x23')]['fn'](_0x3080('0x24'),db[_0x3080('0x23')]['fn']('IF',db[_0x3080('0x23')][_0x3080('0x25')](_0x3080('0x26')))),'outboundQueuePauses']]})[_0x3080('0x13')](function(_0x2f73a7){logger[_0x3080('0x1c')]('GetVoiceQueueRtPauses',_0x1d1016);logger[_0x3080('0x15')](_0x3080('0x27'),_0x1d1016,JSON[_0x3080('0x17')](_0x2f73a7));_0x3e64cb(_0x2f73a7);})[_0x3080('0x1e')](function(_0xe21a9f){logger[_0x3080('0x18')](_0x3080('0x27'),_0xe21a9f[_0x3080('0x1a')],_0x1d1016);_0x102614(_0x2a8740[_0x3080('0x18')](0x1f4,_0xe21a9f[_0x3080('0x1a')]));});});};
\ No newline at end of file
index 93c475e..7af7fc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0619=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x17dcd1,_0x3b7ccb){var _0x12af77=function(_0x5c3bac){while(--_0x5c3bac){_0x17dcd1['push'](_0x17dcd1['shift']());}};_0x12af77(++_0x3b7ccb);}(_0x0619,0x90));var _0x9061=function(_0x53df9d,_0x2e1b80){_0x53df9d=_0x53df9d-0x0;var _0x5186e3=_0x0619[_0x53df9d];return _0x5186e3;};'use strict';var UserVoiceQueueRtEvents=require(_0x9061('0x0'));var events=[_0x9061('0x1'),_0x9061('0x2'),_0x9061('0x3')];function createListener(_0x4f2ab6,_0x3a207b){return function(_0x69e4c){_0x3a207b[_0x9061('0x4')](_0x4f2ab6,_0x69e4c);};}function removeListener(_0x1384a7,_0x1bc8ce){return function(){UserVoiceQueueRtEvents[_0x9061('0x5')](_0x1384a7,_0x1bc8ce);};}exports[_0x9061('0x6')]=function(_0x3a79a8){for(var _0xac2b69=0x0,_0x259fbd=events[_0x9061('0x7')];_0xac2b69<_0x259fbd;_0xac2b69++){var _0x5a950f=events[_0xac2b69];var _0x3ab87c=createListener('userVoiceQueueRt:'+_0x5a950f,_0x3a79a8);UserVoiceQueueRtEvents['on'](_0x5a950f,_0x3ab87c);}};
\ No newline at end of file
+var _0xc73a=['register','length','save','remove','update','emit','removeListener'];(function(_0x58c09e,_0x16ae6f){var _0x47636a=function(_0x241b56){while(--_0x241b56){_0x58c09e['push'](_0x58c09e['shift']());}};_0x47636a(++_0x16ae6f);}(_0xc73a,0x72));var _0xac73=function(_0x5e980f,_0x20acb5){_0x5e980f=_0x5e980f-0x0;var _0x2b366d=_0xc73a[_0x5e980f];return _0x2b366d;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xac73('0x0'),_0xac73('0x1'),_0xac73('0x2')];function createListener(_0x4eb4db,_0x5dac0f){return function(_0x32e40e){_0x5dac0f[_0xac73('0x3')](_0x4eb4db,_0x32e40e);};}function removeListener(_0x36d689,_0x53ef2e){return function(){UserVoiceQueueRtEvents[_0xac73('0x4')](_0x36d689,_0x53ef2e);};}exports[_0xac73('0x5')]=function(_0x23fa68){for(var _0x57992a=0x0,_0x9eb408=events[_0xac73('0x6')];_0x57992a<_0x9eb408;_0x57992a++){var _0x1cc38a=events[_0x57992a];var _0x22638a=createListener('userVoiceQueueRt:'+_0x1cc38a,_0x23fa68);UserVoiceQueueRtEvents['on'](_0x1cc38a,_0x22638a);}};
\ No newline at end of file
index 704f05f..d9d7a9a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x29ddf8,_0x3e0086){var _0x32e88b=function(_0x3ff20e){while(--_0x3ff20e){_0x29ddf8['push'](_0x29ddf8['shift']());}};_0x32e88b(++_0x3e0086);}(_0x70e0,0x17b));var _0x070e=function(_0x5186c4,_0x457707){_0x5186c4=_0x5186c4-0x0;var _0x533bd0=_0x70e0[_0x5186c4];return _0x533bd0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x429257,_0x4379bd){var _0x51c104=function(_0x1f1af2){while(--_0x1f1af2){_0x429257['push'](_0x429257['shift']());}};_0x51c104(++_0x4379bd);}(_0x70e0,0x17b));var _0x070e=function(_0x112000,_0x4d2bc0){_0x112000=_0x112000-0x0;var _0x2a64b4=_0x70e0[_0x112000];return _0x2a64b4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index 9471864..f038e17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9489=['INTEGER','sequelize','exports'];(function(_0x4d03d1,_0x170d7f){var _0xcbf37f=function(_0x3736c2){while(--_0x3736c2){_0x4d03d1['push'](_0x4d03d1['shift']());}};_0xcbf37f(++_0x170d7f);}(_0x9489,0xb2));var _0x9948=function(_0x456633,_0x2976da){_0x456633=_0x456633-0x0;var _0x4e3b1c=_0x9489[_0x456633];return _0x4e3b1c;};'use strict';var Sequelize=require(_0x9948('0x0'));module[_0x9948('0x1')]={'penalty':{'type':Sequelize[_0x9948('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x0a9e=['sequelize','exports','INTEGER'];(function(_0x1c1680,_0x498198){var _0x937fc9=function(_0xacc79d){while(--_0xacc79d){_0x1c1680['push'](_0x1c1680['shift']());}};_0x937fc9(++_0x498198);}(_0x0a9e,0x1c5));var _0xe0a9=function(_0x2c5c40,_0x3a3487){_0x2c5c40=_0x2c5c40-0x0;var _0x5394c7=_0x0a9e[_0x2c5c40];return _0x5394c7;};'use strict';var Sequelize=require(_0xe0a9('0x0'));module[_0xe0a9('0x1')]={'penalty':{'type':Sequelize[_0xe0a9('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index f42a867..c971c2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad6d=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','lodash'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xad6d,0x149));var _0xdad6=function(_0x4895d7,_0x1c2920){_0x4895d7=_0x4895d7-0x0;var _0xc0253b=_0xad6d[_0x4895d7];return _0xc0253b;};'use strict';var _=require(_0xdad6('0x0'));var util=require(_0xdad6('0x1'));var logger=require(_0xdad6('0x2'))('api');var moment=require(_0xdad6('0x3'));var BPromise=require(_0xdad6('0x4'));var rp=require(_0xdad6('0x5'));var fs=require('fs');var path=require(_0xdad6('0x6'));var rimraf=require(_0xdad6('0x7'));var config=require(_0xdad6('0x8'));var attributes=require(_0xdad6('0x9'));module[_0xdad6('0xa')]=function(_0x484367,_0x404754){return _0x484367['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x69ed=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x3a1058,_0x255329){var _0x2509c5=function(_0x5a06fe){while(--_0x5a06fe){_0x3a1058['push'](_0x3a1058['shift']());}};_0x2509c5(++_0x255329);}(_0x69ed,0x138));var _0xd69e=function(_0x3c4d76,_0x2d422e){_0x3c4d76=_0x3c4d76-0x0;var _0x30fd44=_0x69ed[_0x3c4d76];return _0x30fd44;};'use strict';var _=require(_0xd69e('0x0'));var util=require(_0xd69e('0x1'));var logger=require(_0xd69e('0x2'))(_0xd69e('0x3'));var moment=require(_0xd69e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd69e('0x5'));var fs=require('fs');var path=require(_0xd69e('0x6'));var rimraf=require(_0xd69e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd69e('0x8'));module[_0xd69e('0x9')]=function(_0x4f1ab7,_0x2c04a6){return _0x4f1ab7[_0xd69e('0xa')](_0xd69e('0xb'),attributes,{'tableName':_0xd69e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c45a774..e220e96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6dd9=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x6dd9,0x143));var _0x96dd=function(_0x1008df,_0x32a725){_0x1008df=_0x1008df-0x0;var _0x55cd48=_0x6dd9[_0x1008df];return _0x55cd48;};'use strict';var _=require(_0x96dd('0x0'));var util=require(_0x96dd('0x1'));var moment=require(_0x96dd('0x2'));var BPromise=require(_0x96dd('0x3'));var rs=require(_0x96dd('0x4'));var fs=require('fs');var Redis=require(_0x96dd('0x5'));var db=require(_0x96dd('0x6'))['db'];var utils=require(_0x96dd('0x7'));var logger=require(_0x96dd('0x8'))(_0x96dd('0x9'));var config=require(_0x96dd('0xa'));var jayson=require(_0x96dd('0xb'));var client=jayson[_0x96dd('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bba6c,_0x337b86,_0x14c855){return new BPromise(function(_0x2e86f0,_0x2a5aea){return client[_0x96dd('0xd')](_0x5bba6c,_0x14c855)['then'](function(_0x32ab73){logger[_0x96dd('0xe')](_0x96dd('0xf'),_0x337b86,_0x96dd('0x10'));logger[_0x96dd('0x11')](_0x96dd('0x12'),_0x337b86,_0x96dd('0x10'),JSON['stringify'](_0x32ab73));if(_0x32ab73[_0x96dd('0x13')]){if(_0x32ab73[_0x96dd('0x13')]['code']===0x1f4){logger[_0x96dd('0x13')](_0x96dd('0xf'),_0x337b86,_0x32ab73['error'][_0x96dd('0x14')]);return _0x2a5aea(_0x32ab73[_0x96dd('0x13')][_0x96dd('0x14')]);}logger[_0x96dd('0x13')](_0x96dd('0xf'),_0x337b86,_0x32ab73[_0x96dd('0x13')]['message']);return _0x2e86f0(_0x32ab73[_0x96dd('0x13')][_0x96dd('0x14')]);}else{logger['info'](_0x96dd('0xf'),_0x337b86,'request\x20sent');_0x2e86f0(_0x32ab73[_0x96dd('0x15')]['message']);}})[_0x96dd('0x16')](function(_0x584960){logger['error'](_0x96dd('0xf'),_0x337b86,_0x584960);_0x2a5aea(_0x584960);});});}
\ No newline at end of file
+var _0x8c2f=['../../config/utils','rpc','../../config/environment','client','http','then','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','ioredis'];(function(_0x296e27,_0x3410f5){var _0x1fc4c4=function(_0x22cce2){while(--_0x22cce2){_0x296e27['push'](_0x296e27['shift']());}};_0x1fc4c4(++_0x3410f5);}(_0x8c2f,0x176));var _0xf8c2=function(_0x56968c,_0x1e4877){_0x56968c=_0x56968c-0x0;var _0x3e3524=_0x8c2f[_0x56968c];return _0x3e3524;};'use strict';var _=require(_0xf8c2('0x0'));var util=require(_0xf8c2('0x1'));var moment=require('moment');var BPromise=require(_0xf8c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8c2('0x4'));var logger=require('../../config/logger')(_0xf8c2('0x5'));var config=require(_0xf8c2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf8c2('0x7')][_0xf8c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11f282,_0xf2558c,_0x2bb02a){return new BPromise(function(_0x298f84,_0x3cc474){return client['request'](_0x11f282,_0x2bb02a)[_0xf8c2('0x9')](function(_0x3dd50c){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xf2558c,_0xf8c2('0xa'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xf2558c,_0xf8c2('0xa'),JSON[_0xf8c2('0xb')](_0x3dd50c));if(_0x3dd50c[_0xf8c2('0xc')]){if(_0x3dd50c[_0xf8c2('0xc')][_0xf8c2('0xd')]===0x1f4){logger[_0xf8c2('0xc')](_0xf8c2('0xe'),_0xf2558c,_0x3dd50c[_0xf8c2('0xc')][_0xf8c2('0xf')]);return _0x3cc474(_0x3dd50c[_0xf8c2('0xc')][_0xf8c2('0xf')]);}logger[_0xf8c2('0xc')](_0xf8c2('0xe'),_0xf2558c,_0x3dd50c['error'][_0xf8c2('0xf')]);return _0x298f84(_0x3dd50c['error']['message']);}else{logger[_0xf8c2('0x10')](_0xf8c2('0xe'),_0xf2558c,_0xf8c2('0xa'));_0x298f84(_0x3dd50c['result'][_0xf8c2('0xf')]);}})[_0xf8c2('0x11')](function(_0x4f7179){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0xf2558c,_0x4f7179);_0x3cc474(_0x4f7179);});});}
\ No newline at end of file
index 9729428..bceda08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ba7=['create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x0ba7,0x16d));var _0x70ba=function(_0x33bc25,_0x45c46c){_0x33bc25=_0x33bc25-0x0;var _0x22f2bd=_0x0ba7[_0x33bc25];return _0x22f2bd;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xd')]);router[_0x70ba('0xe')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x10')]('/:id',auth[_0x70ba('0xa')](),controller['update']);router[_0x70ba('0x11')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0xa3e6=['../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','create','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x5669b6,_0x511dd8){var _0xb7af51=function(_0x4632a3){while(--_0x4632a3){_0x5669b6['push'](_0x5669b6['shift']());}};_0xb7af51(++_0x511dd8);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x410734,_0x1d6bc5){_0x410734=_0x410734-0x0;var _0x5ab7cd=_0xa3e6[_0x410734];return _0x5ab7cd;};'use strict';var multer=require(_0x6a3e('0x0'));var util=require('util');var path=require(_0x6a3e('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a3e('0x2'));var router=express[_0x6a3e('0x3')]();var fs_extra=require(_0x6a3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a3e('0x5'));var config=require('../../config/environment');var controller=require(_0x6a3e('0x6'));router[_0x6a3e('0x7')]('/',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x9')]);router[_0x6a3e('0x7')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a3e('0xb')]);router['put']('/:id',auth[_0x6a3e('0x8')](),controller['update']);router[_0x6a3e('0xc')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xd')]);module[_0x6a3e('0xe')]=router;
\ No newline at end of file
index 38acabc..4244b5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd772=['STRING','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd772,0xd7));var _0x2d77=function(_0x1b5053,_0x1cca7a){_0x1b5053=_0x1b5053-0x0;var _0x378cae=_0xd772[_0x1b5053];return _0x378cae;};'use strict';var Sequelize=require('sequelize');module[_0x2d77('0x0')]={'name':{'type':Sequelize[_0x2d77('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xfaba=['STRING','name','sequelize','exports'];(function(_0x40cd8b,_0x2fac2e){var _0x49b33b=function(_0x4b8516){while(--_0x4b8516){_0x40cd8b['push'](_0x40cd8b['shift']());}};_0x49b33b(++_0x2fac2e);}(_0xfaba,0xa2));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xafab('0x0'));module[_0xafab('0x1')]={'name':{'type':Sequelize[_0xafab('0x2')],'unique':_0xafab('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index a5b5577..e783296 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa855=['options','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','get','UserProfileSection','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','where','pick','filter','VIRTUAL','merge'];(function(_0x243ecd,_0x5d27ee){var _0x5e33df=function(_0x222ccb){while(--_0x222ccb){_0x243ecd['push'](_0x243ecd['shift']());}};_0x5e33df(++_0x5d27ee);}(_0xa855,0xae));var _0x5a85=function(_0x407e38,_0x30e1cb){_0x407e38=_0x407e38-0x0;var _0x996a91=_0xa855[_0x407e38];return _0x996a91;};'use strict';var emlformat=require(_0x5a85('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a85('0x1'));var jsonpatch=require(_0x5a85('0x2'));var rp=require(_0x5a85('0x3'));var moment=require('moment');var BPromise=require(_0x5a85('0x4'));var Mustache=require(_0x5a85('0x5'));var util=require('util');var path=require(_0x5a85('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a85('0x7'));var fs=require('fs');var fs_extra=require(_0x5a85('0x8'));var _=require(_0x5a85('0x9'));var squel=require(_0x5a85('0xa'));var crypto=require(_0x5a85('0xb'));var jsforce=require(_0x5a85('0xc'));var deskjs=require(_0x5a85('0xd'));var toCsv=require(_0x5a85('0xe'));var querystring=require(_0x5a85('0xf'));var Papa=require(_0x5a85('0x10'));var Redis=require(_0x5a85('0x11'));var authService=require(_0x5a85('0x12'));var qs=require(_0x5a85('0x13'));var as=require(_0x5a85('0x14'));var hardwareService=require(_0x5a85('0x15'));var logger=require(_0x5a85('0x16'))(_0x5a85('0x17'));var utils=require(_0x5a85('0x18'));var config=require(_0x5a85('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403f40,_0x3d9f84){_0x3d9f84=_0x3d9f84||0xcc;return function(_0x2b3efe){if(_0x2b3efe){return _0x403f40['sendStatus'](_0x3d9f84);}return _0x403f40['status'](_0x3d9f84)[_0x5a85('0x1a')]();};}function respondWithResult(_0x28b2b4,_0x1d5de3){_0x1d5de3=_0x1d5de3||0xc8;return function(_0x489188){if(_0x489188){return _0x28b2b4[_0x5a85('0x1b')](_0x1d5de3)[_0x5a85('0x1c')](_0x489188);}};}function respondWithFilteredResult(_0x12fe4d,_0x4cd40f){return function(_0x398d79){if(_0x398d79){var _0x454b9f=typeof _0x4cd40f['offset']===_0x5a85('0x1d')&&typeof _0x4cd40f['limit']===_0x5a85('0x1d');var _0x2f585c=_0x398d79[_0x5a85('0x1e')];var _0x4d7504=_0x454b9f?0x0:_0x4cd40f[_0x5a85('0x1f')];var _0x457859=_0x454b9f?_0x398d79[_0x5a85('0x1e')]:_0x4cd40f['offset']+_0x4cd40f[_0x5a85('0x20')];var _0x175501;if(_0x457859>=_0x2f585c){_0x457859=_0x2f585c;_0x175501=0xc8;}else{_0x175501=0xce;}_0x12fe4d['status'](_0x175501);return _0x12fe4d[_0x5a85('0x21')](_0x5a85('0x22'),_0x4d7504+'-'+_0x457859+'/'+_0x2f585c)[_0x5a85('0x1c')](_0x398d79);}return null;};}function patchUpdates(_0x20c72f){return function(_0x4a8634){try{jsonpatch[_0x5a85('0x23')](_0x4a8634,_0x20c72f,!![]);}catch(_0x389814){return BPromise['reject'](_0x389814);}return _0x4a8634['save']();};}function saveUpdates(_0xfa9698,_0x356ce3){return function(_0x2d1eaf){if(_0x2d1eaf){return _0x2d1eaf[_0x5a85('0x24')](_0xfa9698)[_0x5a85('0x25')](function(_0x5403a4){return _0x5403a4;});}return null;};}function removeEntity(_0x2a1d37,_0x21f282){return function(_0x16cd19){if(_0x16cd19){return _0x16cd19[_0x5a85('0x26')]()[_0x5a85('0x25')](function(){var _0x588ed3=_0x16cd19['get']({'plain':!![]});var _0x2cb7e2=_0x5a85('0x27');return db[_0x5a85('0x28')]['destroy']({'where':{'type':_0x2cb7e2,'resourceId':_0x588ed3['id']}})[_0x5a85('0x25')](function(){return _0x16cd19;});})['then'](function(){_0x2a1d37[_0x5a85('0x1b')](0xcc)[_0x5a85('0x1a')]();});}};}function handleEntityNotFound(_0xd73a37,_0x3a7389){return function(_0x581f68){if(!_0x581f68){_0xd73a37[_0x5a85('0x29')](0x194);}return _0x581f68;};}function handleError(_0x2e62e0,_0x4fec75){_0x4fec75=_0x4fec75||0x1f4;return function(_0x1a1e8b){logger[_0x5a85('0x2a')](_0x1a1e8b[_0x5a85('0x2b')]);if(_0x1a1e8b[_0x5a85('0x2c')]){delete _0x1a1e8b[_0x5a85('0x2c')];}_0x2e62e0[_0x5a85('0x1b')](_0x4fec75)[_0x5a85('0x2d')](_0x1a1e8b);};}exports[_0x5a85('0x2e')]=function(_0x192036,_0x23934d){var _0x40df51={},_0xf6b1ca={},_0x279f9e={'count':0x0,'rows':[]};var _0x4b3cfb=_[_0x5a85('0x2f')](db[_0x5a85('0x30')][_0x5a85('0x31')],function(_0x12ae0a){return{'name':_0x12ae0a['fieldName'],'type':_0x12ae0a[_0x5a85('0x32')][_0x5a85('0x33')]};});_0xf6b1ca[_0x5a85('0x34')]=_[_0x5a85('0x2f')](_0x4b3cfb,_0x5a85('0x2c'));_0xf6b1ca[_0x5a85('0x35')]=_[_0x5a85('0x36')](_0x192036[_0x5a85('0x35')]);_0xf6b1ca[_0x5a85('0x37')]=_['intersection'](_0xf6b1ca['model'],_0xf6b1ca[_0x5a85('0x35')]);_0x40df51[_0x5a85('0x38')]=_[_0x5a85('0x39')](_0xf6b1ca[_0x5a85('0x34')],qs[_0x5a85('0x3a')](_0x192036['query'][_0x5a85('0x3a')]));_0x40df51[_0x5a85('0x38')]=_0x40df51[_0x5a85('0x38')][_0x5a85('0x3b')]?_0x40df51['attributes']:_0xf6b1ca[_0x5a85('0x34')];if(!_0x192036[_0x5a85('0x35')]['hasOwnProperty'](_0x5a85('0x3c'))){_0x40df51['limit']=qs[_0x5a85('0x20')](_0x192036[_0x5a85('0x35')][_0x5a85('0x20')]);_0x40df51[_0x5a85('0x1f')]=qs[_0x5a85('0x1f')](_0x192036[_0x5a85('0x35')][_0x5a85('0x1f')]);}_0x40df51['order']=qs['sort'](_0x192036[_0x5a85('0x35')]['sort']);_0x40df51[_0x5a85('0x3d')]=qs[_0x5a85('0x37')](_[_0x5a85('0x3e')](_0x192036[_0x5a85('0x35')],_0xf6b1ca[_0x5a85('0x37')]),_0x4b3cfb);if(_0x192036[_0x5a85('0x35')][_0x5a85('0x3f')]){_0x40df51['where']=_['merge'](_0x40df51[_0x5a85('0x3d')],{'$or':_['map'](_0x4b3cfb,function(_0x57c7d2){if(_0x57c7d2[_0x5a85('0x32')]!==_0x5a85('0x40')){var _0x23a429={};_0x23a429[_0x57c7d2[_0x5a85('0x2c')]]={'$like':'%'+_0x192036[_0x5a85('0x35')][_0x5a85('0x3f')]+'%'};return _0x23a429;}})});}_0x40df51=_[_0x5a85('0x41')]({},_0x40df51,_0x192036[_0x5a85('0x42')]);var _0x202e11={'where':_0x40df51[_0x5a85('0x3d')]};return db['Variable'][_0x5a85('0x1e')](_0x202e11)[_0x5a85('0x25')](function(_0x4c33b0){_0x279f9e[_0x5a85('0x1e')]=_0x4c33b0;if(_0x192036['query']['includeAll']){_0x40df51['include']=[{'all':!![]}];}return db[_0x5a85('0x30')][_0x5a85('0x43')](_0x40df51);})['then'](function(_0xf637a1){_0x279f9e[_0x5a85('0x44')]=_0xf637a1;return _0x279f9e;})[_0x5a85('0x25')](respondWithFilteredResult(_0x23934d,_0x40df51))[_0x5a85('0x45')](handleError(_0x23934d,null));};exports[_0x5a85('0x46')]=function(_0x5c2ca2,_0x60b907){var _0x2f9efd={'raw':!![],'where':{'id':_0x5c2ca2[_0x5a85('0x47')]['id']}},_0x535e31={};_0x535e31[_0x5a85('0x34')]=_[_0x5a85('0x36')](db[_0x5a85('0x30')][_0x5a85('0x31')]);_0x535e31[_0x5a85('0x35')]=_[_0x5a85('0x36')](_0x5c2ca2[_0x5a85('0x35')]);_0x535e31[_0x5a85('0x37')]=_['intersection'](_0x535e31[_0x5a85('0x34')],_0x535e31[_0x5a85('0x35')]);_0x2f9efd[_0x5a85('0x38')]=_[_0x5a85('0x39')](_0x535e31['model'],qs[_0x5a85('0x3a')](_0x5c2ca2[_0x5a85('0x35')][_0x5a85('0x3a')]));_0x2f9efd[_0x5a85('0x38')]=_0x2f9efd[_0x5a85('0x38')]['length']?_0x2f9efd[_0x5a85('0x38')]:_0x535e31[_0x5a85('0x34')];if(_0x5c2ca2[_0x5a85('0x35')][_0x5a85('0x48')]){_0x2f9efd['include']=[{'all':!![]}];}_0x2f9efd=_[_0x5a85('0x41')]({},_0x2f9efd,_0x5c2ca2['options']);return db[_0x5a85('0x30')][_0x5a85('0x49')](_0x2f9efd)['then'](handleEntityNotFound(_0x60b907,null))[_0x5a85('0x25')](respondWithResult(_0x60b907,null))['catch'](handleError(_0x60b907,null));};exports[_0x5a85('0x4a')]=function(_0x3840da,_0x27cccd){return db[_0x5a85('0x30')][_0x5a85('0x4a')](_0x3840da[_0x5a85('0x4b')],{})[_0x5a85('0x25')](function(_0x4e16ec){var _0x22758c=_0x3840da[_0x5a85('0x4c')]['get']({'plain':!![]});if(!_0x22758c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22758c[_0x5a85('0x4d')]===_0x5a85('0x4c')){var _0x40a297=_0x4e16ec[_0x5a85('0x4e')]({'plain':!![]});var _0x160663=_0x5a85('0x27');return db[_0x5a85('0x4f')][_0x5a85('0x49')]({'where':{'name':_0x160663,'userProfileId':_0x22758c['userProfileId']},'raw':!![]})[_0x5a85('0x25')](function(_0x651a53){if(_0x651a53&&_0x651a53['autoAssociation']===0x0){return db[_0x5a85('0x28')][_0x5a85('0x4a')]({'name':_0x40a297[_0x5a85('0x2c')],'resourceId':_0x40a297['id'],'type':_0x651a53[_0x5a85('0x2c')],'sectionId':_0x651a53['id']},{})[_0x5a85('0x25')](function(){return _0x4e16ec;});}else{return _0x4e16ec;}})[_0x5a85('0x45')](function(_0x2b1bc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b1bc);throw _0x2b1bc;});}return _0x4e16ec;})[_0x5a85('0x25')](respondWithResult(_0x27cccd,0xc9))[_0x5a85('0x45')](handleError(_0x27cccd,null));};exports[_0x5a85('0x24')]=function(_0xf4cad5,_0x59c301){if(_0xf4cad5[_0x5a85('0x4b')]['id']){delete _0xf4cad5['body']['id'];}return db[_0x5a85('0x30')][_0x5a85('0x49')]({'where':{'id':_0xf4cad5[_0x5a85('0x47')]['id']}})[_0x5a85('0x25')](handleEntityNotFound(_0x59c301,null))[_0x5a85('0x25')](saveUpdates(_0xf4cad5[_0x5a85('0x4b')],null))[_0x5a85('0x25')](respondWithResult(_0x59c301,null))[_0x5a85('0x45')](handleError(_0x59c301,null));};exports[_0x5a85('0x26')]=function(_0xa010e,_0x4071ba){return db[_0x5a85('0x30')][_0x5a85('0x49')]({'where':{'id':_0xa010e[_0x5a85('0x47')]['id']}})[_0x5a85('0x25')](handleEntityNotFound(_0x4071ba,null))[_0x5a85('0x25')](removeEntity(_0x4071ba,null))[_0x5a85('0x45')](handleError(_0x4071ba,null));};
\ No newline at end of file
+var _0xd622=['userProfileId','error','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','save','update','destroy','get','Variables','UserProfileResource','then','name','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Variable','includeAll','include','rows','catch','show','params','rawAttributes','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x425811,_0x12fc69){var _0x47d6a9=function(_0x51f166){while(--_0x51f166){_0x425811['push'](_0x425811['shift']());}};_0x47d6a9(++_0x12fc69);}(_0xd622,0x197));var _0x2d62=function(_0x3d5b6b,_0x489f1b){_0x3d5b6b=_0x3d5b6b-0x0;var _0x163824=_0xd622[_0x3d5b6b];return _0x163824;};'use strict';var emlformat=require(_0x2d62('0x0'));var rimraf=require(_0x2d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d62('0x2'));var rp=require(_0x2d62('0x3'));var moment=require(_0x2d62('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d62('0x5'));var util=require(_0x2d62('0x6'));var path=require(_0x2d62('0x7'));var sox=require(_0x2d62('0x8'));var csv=require(_0x2d62('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d62('0xa'));var _=require(_0x2d62('0xb'));var squel=require(_0x2d62('0xc'));var crypto=require(_0x2d62('0xd'));var jsforce=require(_0x2d62('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2d62('0x9'));var querystring=require(_0x2d62('0xf'));var Papa=require(_0x2d62('0x10'));var Redis=require('ioredis');var authService=require(_0x2d62('0x11'));var qs=require(_0x2d62('0x12'));var as=require(_0x2d62('0x13'));var hardwareService=require(_0x2d62('0x14'));var logger=require(_0x2d62('0x15'))(_0x2d62('0x16'));var utils=require(_0x2d62('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d62('0x18'));var db=require(_0x2d62('0x19'))['db'];function respondWithStatusCode(_0x2bafc0,_0x1364df){_0x1364df=_0x1364df||0xcc;return function(_0x13fcfd){if(_0x13fcfd){return _0x2bafc0[_0x2d62('0x1a')](_0x1364df);}return _0x2bafc0[_0x2d62('0x1b')](_0x1364df)[_0x2d62('0x1c')]();};}function respondWithResult(_0x31d86e,_0x1ec4c8){_0x1ec4c8=_0x1ec4c8||0xc8;return function(_0x1ed9b2){if(_0x1ed9b2){return _0x31d86e[_0x2d62('0x1b')](_0x1ec4c8)['json'](_0x1ed9b2);}};}function respondWithFilteredResult(_0x29f7aa,_0x5536df){return function(_0x328458){if(_0x328458){var _0x3406ad=typeof _0x5536df[_0x2d62('0x1d')]==='undefined'&&typeof _0x5536df[_0x2d62('0x1e')]===_0x2d62('0x1f');var _0x278381=_0x328458[_0x2d62('0x20')];var _0x2e586b=_0x3406ad?0x0:_0x5536df[_0x2d62('0x1d')];var _0x148462=_0x3406ad?_0x328458[_0x2d62('0x20')]:_0x5536df[_0x2d62('0x1d')]+_0x5536df[_0x2d62('0x1e')];var _0x52efa2;if(_0x148462>=_0x278381){_0x148462=_0x278381;_0x52efa2=0xc8;}else{_0x52efa2=0xce;}_0x29f7aa[_0x2d62('0x1b')](_0x52efa2);return _0x29f7aa[_0x2d62('0x21')]('Content-Range',_0x2e586b+'-'+_0x148462+'/'+_0x278381)[_0x2d62('0x22')](_0x328458);}return null;};}function patchUpdates(_0x569193){return function(_0x54c0e5){try{jsonpatch['apply'](_0x54c0e5,_0x569193,!![]);}catch(_0x8ca39c){return BPromise[_0x2d62('0x23')](_0x8ca39c);}return _0x54c0e5[_0x2d62('0x24')]();};}function saveUpdates(_0x50a7f5,_0x42cf1){return function(_0xc9d3d6){if(_0xc9d3d6){return _0xc9d3d6[_0x2d62('0x25')](_0x50a7f5)['then'](function(_0x3fed5f){return _0x3fed5f;});}return null;};}function removeEntity(_0x2ad102,_0x1eb4fc){return function(_0x254426){if(_0x254426){return _0x254426[_0x2d62('0x26')]()['then'](function(){var _0x5b2a4f=_0x254426[_0x2d62('0x27')]({'plain':!![]});var _0x2211ce=_0x2d62('0x28');return db[_0x2d62('0x29')][_0x2d62('0x26')]({'where':{'type':_0x2211ce,'resourceId':_0x5b2a4f['id']}})[_0x2d62('0x2a')](function(){return _0x254426;});})[_0x2d62('0x2a')](function(){_0x2ad102['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4609ee,_0x1c028b){return function(_0x40de6c){if(!_0x40de6c){_0x4609ee[_0x2d62('0x1a')](0x194);}return _0x40de6c;};}function handleError(_0x2c760e,_0x2d94cb){_0x2d94cb=_0x2d94cb||0x1f4;return function(_0x5df304){logger['error'](_0x5df304['stack']);if(_0x5df304[_0x2d62('0x2b')]){delete _0x5df304[_0x2d62('0x2b')];}_0x2c760e[_0x2d62('0x1b')](_0x2d94cb)['send'](_0x5df304);};}exports['index']=function(_0x4c88d6,_0x3cc77d){var _0xc37571={},_0x48be38={},_0x34aa9a={'count':0x0,'rows':[]};var _0x1631b1=_['map'](db['Variable']['rawAttributes'],function(_0x5d5463){return{'name':_0x5d5463[_0x2d62('0x2c')],'type':_0x5d5463[_0x2d62('0x2d')][_0x2d62('0x2e')]};});_0x48be38[_0x2d62('0x2f')]=_[_0x2d62('0x30')](_0x1631b1,_0x2d62('0x2b'));_0x48be38[_0x2d62('0x31')]=_[_0x2d62('0x32')](_0x4c88d6[_0x2d62('0x31')]);_0x48be38['filters']=_['intersection'](_0x48be38[_0x2d62('0x2f')],_0x48be38[_0x2d62('0x31')]);_0xc37571[_0x2d62('0x33')]=_[_0x2d62('0x34')](_0x48be38[_0x2d62('0x2f')],qs[_0x2d62('0x35')](_0x4c88d6[_0x2d62('0x31')]['fields']));_0xc37571[_0x2d62('0x33')]=_0xc37571[_0x2d62('0x33')][_0x2d62('0x36')]?_0xc37571[_0x2d62('0x33')]:_0x48be38[_0x2d62('0x2f')];if(!_0x4c88d6['query'][_0x2d62('0x37')](_0x2d62('0x38'))){_0xc37571[_0x2d62('0x1e')]=qs['limit'](_0x4c88d6['query'][_0x2d62('0x1e')]);_0xc37571[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x4c88d6[_0x2d62('0x31')][_0x2d62('0x1d')]);}_0xc37571[_0x2d62('0x39')]=qs[_0x2d62('0x3a')](_0x4c88d6[_0x2d62('0x31')][_0x2d62('0x3a')]);_0xc37571[_0x2d62('0x3b')]=qs['filters'](_['pick'](_0x4c88d6[_0x2d62('0x31')],_0x48be38['filters']),_0x1631b1);if(_0x4c88d6['query'][_0x2d62('0x3c')]){_0xc37571[_0x2d62('0x3b')]=_[_0x2d62('0x3d')](_0xc37571[_0x2d62('0x3b')],{'$or':_[_0x2d62('0x30')](_0x1631b1,function(_0x1f93e6){if(_0x1f93e6['type']!==_0x2d62('0x3e')){var _0x35d81d={};_0x35d81d[_0x1f93e6[_0x2d62('0x2b')]]={'$like':'%'+_0x4c88d6[_0x2d62('0x31')][_0x2d62('0x3c')]+'%'};return _0x35d81d;}})});}_0xc37571=_[_0x2d62('0x3d')]({},_0xc37571,_0x4c88d6[_0x2d62('0x3f')]);var _0x4c6382={'where':_0xc37571['where']};return db[_0x2d62('0x40')]['count'](_0x4c6382)[_0x2d62('0x2a')](function(_0x23035d){_0x34aa9a['count']=_0x23035d;if(_0x4c88d6['query'][_0x2d62('0x41')]){_0xc37571[_0x2d62('0x42')]=[{'all':!![]}];}return db[_0x2d62('0x40')]['findAll'](_0xc37571);})[_0x2d62('0x2a')](function(_0x5092a5){_0x34aa9a[_0x2d62('0x43')]=_0x5092a5;return _0x34aa9a;})[_0x2d62('0x2a')](respondWithFilteredResult(_0x3cc77d,_0xc37571))[_0x2d62('0x44')](handleError(_0x3cc77d,null));};exports[_0x2d62('0x45')]=function(_0x239ae2,_0xabd8a4){var _0x4284c5={'raw':!![],'where':{'id':_0x239ae2[_0x2d62('0x46')]['id']}},_0x317ad5={};_0x317ad5['model']=_[_0x2d62('0x32')](db[_0x2d62('0x40')][_0x2d62('0x47')]);_0x317ad5[_0x2d62('0x31')]=_[_0x2d62('0x32')](_0x239ae2['query']);_0x317ad5[_0x2d62('0x48')]=_[_0x2d62('0x34')](_0x317ad5['model'],_0x317ad5[_0x2d62('0x31')]);_0x4284c5[_0x2d62('0x33')]=_[_0x2d62('0x34')](_0x317ad5['model'],qs[_0x2d62('0x35')](_0x239ae2[_0x2d62('0x31')]['fields']));_0x4284c5[_0x2d62('0x33')]=_0x4284c5['attributes'][_0x2d62('0x36')]?_0x4284c5[_0x2d62('0x33')]:_0x317ad5['model'];if(_0x239ae2[_0x2d62('0x31')][_0x2d62('0x41')]){_0x4284c5[_0x2d62('0x42')]=[{'all':!![]}];}_0x4284c5=_[_0x2d62('0x3d')]({},_0x4284c5,_0x239ae2['options']);return db['Variable'][_0x2d62('0x49')](_0x4284c5)[_0x2d62('0x2a')](handleEntityNotFound(_0xabd8a4,null))['then'](respondWithResult(_0xabd8a4,null))[_0x2d62('0x44')](handleError(_0xabd8a4,null));};exports[_0x2d62('0x4a')]=function(_0x4f3fb4,_0x2fec3e){return db[_0x2d62('0x40')]['create'](_0x4f3fb4[_0x2d62('0x4b')],{})['then'](function(_0x4bac63){var _0x6112bc=_0x4f3fb4[_0x2d62('0x4c')][_0x2d62('0x27')]({'plain':!![]});if(!_0x6112bc)throw new Error(_0x2d62('0x4d'));if(_0x6112bc[_0x2d62('0x4e')]===_0x2d62('0x4c')){var _0x1092c3=_0x4bac63['get']({'plain':!![]});var _0x5de42f=_0x2d62('0x28');return db['UserProfileSection'][_0x2d62('0x49')]({'where':{'name':_0x5de42f,'userProfileId':_0x6112bc[_0x2d62('0x4f')]},'raw':!![]})[_0x2d62('0x2a')](function(_0x483b95){if(_0x483b95&&_0x483b95['autoAssociation']===0x0){return db['UserProfileResource'][_0x2d62('0x4a')]({'name':_0x1092c3[_0x2d62('0x2b')],'resourceId':_0x1092c3['id'],'type':_0x483b95[_0x2d62('0x2b')],'sectionId':_0x483b95['id']},{})[_0x2d62('0x2a')](function(){return _0x4bac63;});}else{return _0x4bac63;}})[_0x2d62('0x44')](function(_0x1e0fb5){logger[_0x2d62('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e0fb5);throw _0x1e0fb5;});}return _0x4bac63;})[_0x2d62('0x2a')](respondWithResult(_0x2fec3e,0xc9))[_0x2d62('0x44')](handleError(_0x2fec3e,null));};exports[_0x2d62('0x25')]=function(_0x40f1d1,_0x436ea9){if(_0x40f1d1[_0x2d62('0x4b')]['id']){delete _0x40f1d1[_0x2d62('0x4b')]['id'];}return db[_0x2d62('0x40')]['find']({'where':{'id':_0x40f1d1['params']['id']}})[_0x2d62('0x2a')](handleEntityNotFound(_0x436ea9,null))[_0x2d62('0x2a')](saveUpdates(_0x40f1d1[_0x2d62('0x4b')],null))[_0x2d62('0x2a')](respondWithResult(_0x436ea9,null))[_0x2d62('0x44')](handleError(_0x436ea9,null));};exports['destroy']=function(_0x482c0f,_0x2b3817){return db[_0x2d62('0x40')][_0x2d62('0x49')]({'where':{'id':_0x482c0f[_0x2d62('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b3817,null))['then'](removeEntity(_0x2b3817,null))[_0x2d62('0x44')](handleError(_0x2b3817,null));};
\ No newline at end of file
index 4ad0c1f..6c23784 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa459=['tools_variables','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','Variable'];(function(_0x56b9ec,_0x49cfed){var _0x535b5d=function(_0x3de705){while(--_0x3de705){_0x56b9ec['push'](_0x56b9ec['shift']());}};_0x535b5d(++_0x49cfed);}(_0xa459,0xfe));var _0x9a45=function(_0x4b82a9,_0x13626b){_0x4b82a9=_0x4b82a9-0x0;var _0x418eea=_0xa459[_0x4b82a9];return _0x418eea;};'use strict';var _=require(_0x9a45('0x0'));var util=require(_0x9a45('0x1'));var logger=require(_0x9a45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9a45('0x3'));var rp=require(_0x9a45('0x4'));var fs=require('fs');var path=require(_0x9a45('0x5'));var rimraf=require(_0x9a45('0x6'));var config=require(_0x9a45('0x7'));var attributes=require('./variable.attributes');module['exports']=function(_0x221924,_0x3a795d){return _0x221924[_0x9a45('0x8')](_0x9a45('0x9'),attributes,{'tableName':_0x9a45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4979=['Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports'];(function(_0x3fd2d5,_0x11a61b){var _0x14f7da=function(_0x3bf89b){while(--_0x3bf89b){_0x3fd2d5['push'](_0x3fd2d5['shift']());}};_0x14f7da(++_0x11a61b);}(_0x4979,0x142));var _0x9497=function(_0x503e4e,_0x5e9fba){_0x503e4e=_0x503e4e-0x0;var _0x30e5fd=_0x4979[_0x503e4e];return _0x30e5fd;};'use strict';var _=require(_0x9497('0x0'));var util=require(_0x9497('0x1'));var logger=require(_0x9497('0x2'))(_0x9497('0x3'));var moment=require(_0x9497('0x4'));var BPromise=require('bluebird');var rp=require(_0x9497('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9497('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x9497('0x7')]=function(_0x462684,_0x30d462){return _0x462684['define'](_0x9497('0x8'),attributes,{'tableName':_0x9497('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index df0db61..a9c13e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x2d4372,_0x384e41){var _0x2833ae=function(_0x4d6887){while(--_0x4d6887){_0x2d4372['push'](_0x2d4372['shift']());}};_0x2833ae(++_0x384e41);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});};
\ No newline at end of file
+var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x397e57,_0xcfd1bd){var _0xd60a69=function(_0x286a9d){while(--_0x286a9d){_0x397e57['push'](_0x397e57['shift']());}};_0xd60a69(++_0xcfd1bd);}(_0xabce,0x103));var _0xeabc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xabce[_0x543084];return _0x306a57;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});};
\ No newline at end of file
index e1e7fb0..fc78bbe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d39=['./version.controller','get','index','/fetch','fetch','isAuthenticated','reset','/pull','canUpdate','pull','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service'];(function(_0xdb1acd,_0x5ee69b){var _0x479c66=function(_0x3eb1e3){while(--_0x3eb1e3){_0xdb1acd['push'](_0xdb1acd['shift']());}};_0x479c66(++_0x5ee69b);}(_0x3d39,0xb9));var _0x93d3=function(_0x219fd8,_0x134841){_0x219fd8=_0x219fd8-0x0;var _0x46cf3f=_0x3d39[_0x219fd8];return _0x46cf3f;};'use strict';var express=require('express');var router=express[_0x93d3('0x0')]();var auth=require(_0x93d3('0x1'));var controller=require(_0x93d3('0x2'));router[_0x93d3('0x3')]('/',controller[_0x93d3('0x4')]);router[_0x93d3('0x3')](_0x93d3('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x93d3('0x6')]);router['get']('/reset',auth[_0x93d3('0x7')](),auth['canUpdate'](),controller[_0x93d3('0x8')]);router[_0x93d3('0x3')](_0x93d3('0x9'),auth[_0x93d3('0x7')](),auth[_0x93d3('0xa')](),controller[_0x93d3('0xb')]);router[_0x93d3('0x3')](_0x93d3('0xc'),auth[_0x93d3('0x7')](),controller[_0x93d3('0xd')]);router[_0x93d3('0x3')](_0x93d3('0xe'),controller[_0x93d3('0xf')]);module[_0x93d3('0x10')]=router;
\ No newline at end of file
+var _0x4fdf=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fdf,0x1bd));var _0xf4fd=function(_0x117807,_0x26badd){_0x117807=_0x117807-0x0;var _0x332257=_0x4fdf[_0x117807];return _0x332257;};'use strict';var express=require(_0xf4fd('0x0'));var router=express[_0xf4fd('0x1')]();var auth=require(_0xf4fd('0x2'));var controller=require(_0xf4fd('0x3'));router[_0xf4fd('0x4')]('/',controller[_0xf4fd('0x5')]);router[_0xf4fd('0x4')](_0xf4fd('0x6'),auth[_0xf4fd('0x7')](),auth[_0xf4fd('0x8')](),controller[_0xf4fd('0x9')]);router['get'](_0xf4fd('0xa'),auth[_0xf4fd('0x7')](),auth[_0xf4fd('0x8')](),controller[_0xf4fd('0xb')]);router[_0xf4fd('0x4')](_0xf4fd('0xc'),auth[_0xf4fd('0x7')](),auth[_0xf4fd('0x8')](),controller[_0xf4fd('0xd')]);router[_0xf4fd('0x4')](_0xf4fd('0xe'),auth[_0xf4fd('0x7')](),controller[_0xf4fd('0xf')]);router[_0xf4fd('0x4')](_0xf4fd('0x10'),controller[_0xf4fd('0x11')]);module['exports']=router;
\ No newline at end of file
index e95c94e..15e56ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x602c=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','query','fetch','tags','latest','json','status','origin','master','error','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','.js','push','sequelize','Migration','getQueryInterface','constructor'];(function(_0x51ab33,_0x71a8a8){var _0x5e1298=function(_0x1bd8cf){while(--_0x1bd8cf){_0x51ab33['push'](_0x51ab33['shift']());}};_0x5e1298(++_0x71a8a8);}(_0x602c,0x15c));var _0xc602=function(_0x35f4a1,_0x4160bf){_0x35f4a1=_0x35f4a1-0x0;var _0x3b2175=_0x602c[_0x35f4a1];return _0x3b2175;};'use strict';var Umzug=require(_0xc602('0x0'));var path=require(_0xc602('0x1'));var fs=require('fs');var _=require(_0xc602('0x2'));var pkginfo=require(_0xc602('0x3'))(module,_0xc602('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xc602('0x5'))[_0xc602('0x6')];var db=require(_0xc602('0x7'))['db'];var config=require(_0xc602('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xc602('0x9'))('update');var git=require(_0xc602('0xa'))(config[_0xc602('0xb')]);exports[_0xc602('0xc')]=function(_0x7132f8,_0x442ddc){var _0x30b1f5={'current':module[_0xc602('0xd')]['version'],'phonebar':0x2};if(_0x7132f8['query']&&_0x7132f8[_0xc602('0xe')]['latest']){return git[_0xc602('0xf')]()[_0xc602('0x10')](function(_0x4ecf9e,_0x108a58){_0x30b1f5[_0xc602('0x11')]=(_0x4ecf9e?module[_0xc602('0xd')]['version']:_0x108a58[_0xc602('0x11')])||'2.0.0';return _0x442ddc['status'](0xc8)[_0xc602('0x12')](_0x30b1f5);});}else{return _0x442ddc[_0xc602('0x13')](0xc8)[_0xc602('0x12')](_0x30b1f5);}};exports[_0xc602('0xf')]=function(_0x404967,_0x2c1f1c){return git[_0xc602('0xf')]([_0xc602('0x14'),_0xc602('0x15')],function(_0x568560){if(_0x568560){logger[_0xc602('0x16')](_0x568560);return _0x2c1f1c[_0xc602('0x13')](0x1f4)['json'](_0x568560);}logger['info']('git\x20fetch');return _0x2c1f1c[_0xc602('0x13')](0xc8)[_0xc602('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc602('0x17')]=function(_0x42771d,_0x32a3da){return git[_0xc602('0x17')]([_0xc602('0x18'),'FETCH_HEAD'],function(_0xd8f8b9){if(_0xd8f8b9){logger['error'](_0xd8f8b9);return _0x32a3da[_0xc602('0x13')](0x1f4)[_0xc602('0x12')](_0xd8f8b9);}logger[_0xc602('0x19')](_0xc602('0x1a'));return _0x32a3da['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0xaa5c61,_0x1aead7){exec(_0xc602('0x1b'),function(_0x43b7c2,_0x5bc2f0,_0x22bb46){logger[_0xc602('0x19')](_0x5bc2f0);logger[_0xc602('0x19')](_0x22bb46);if(_0x43b7c2){logger[_0xc602('0x16')](_0x43b7c2);return _0x1aead7[_0xc602('0x13')](0x1f4)[_0xc602('0x12')](_0x43b7c2);}return _0x1aead7[_0xc602('0x13')](0xc8)[_0xc602('0x12')]({'output':_0x5bc2f0});});};exports[_0xc602('0x1c')]=function(_0x49f6d7,_0x51c460){return pm2['restart'](_0xc602('0x1d'))['then'](function(_0x456359){logger['info'](_0xc602('0x1e'),_0x456359);return _0x51c460['status'](0xc8)['json']({'output':_0xc602('0x1f')});})[_0xc602('0x20')](function(_0x3a4e91){logger['error'](_0x3a4e91);return _0x51c460[_0xc602('0x13')](0x1f4)[_0xc602('0x12')](_0x3a4e91);});};exports['migrations']=function(_0x2c8d74,_0x4436f4){var _0x363480=fs[_0xc602('0x21')](path[_0xc602('0x22')](config[_0xc602('0xb')],_0xc602('0x23'),_0xc602('0x24')));var _0x3c40bd=[];for(var _0xf15f1a=0x0;_0xf15f1a<_0x363480[_0xc602('0x25')];_0xf15f1a++){var _0xc1aed8=_0x363480[_0xf15f1a]['replace'](_0xc602('0x26'),'');if(compareVersions(module[_0xc602('0xd')][_0xc602('0x4')],_0xc1aed8)===-0x1){_0x3c40bd[_0xc602('0x27')](_0xc1aed8);}}if(_0x3c40bd[_0xc602('0x25')]){var _0x2618f7=_0x3c40bd['sort'](compareVersions);var _0x5470b7=new Umzug({'storage':_0xc602('0x28'),'storageOptions':{'model':db[_0xc602('0x29')],'modelName':_0xc602('0x29'),'columnName':_0xc602('0x4')},'migrations':{'params':[db['sequelize'][_0xc602('0x2a')](),db[_0xc602('0x28')][_0xc602('0x2b')],function(){throw new Error(_0xc602('0x2c'));}],'path':path['join'](config[_0xc602('0xb')],_0xc602('0x23'),'migrations'),'pattern':/\.js$/}});_0x5470b7['up']({'migrations':_[_0xc602('0x2d')](_0x2618f7,function(_0x3ce657){return _0x3ce657+_0xc602('0x26');})})[_0xc602('0x2e')](function(){return _0x4436f4[_0xc602('0x13')](0xc8)[_0xc602('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xc602('0x4')]+'\x20to\x20'+_[_0xc602('0x2f')](_0x2618f7),'migrations':_['join'](_0x2618f7)});})['catch'](function(_0x5796a7){if(_0x5796a7 instanceof db[_0xc602('0x28')]['UniqueConstraintError']){return _0x4436f4[_0xc602('0x13')](0xc8)[_0xc602('0x12')]({'output':_0xc602('0x30')});}else{return _0x4436f4[_0xc602('0x13')](0x1f4)[_0xc602('0x12')](_0x5796a7);}});}else{return _0x4436f4[_0xc602('0x13')](0xc8)[_0xc602('0x12')]({'output':_0xc602('0x30')});}};
\ No newline at end of file
+var _0x78a7=['umzug','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','exports','query','latest','2.0.0','status','json','fetch','origin','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','replace','.js','push','length','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','then','UniqueConstraintError'];(function(_0xb73a22,_0x2959f9){var _0x222a47=function(_0x295933){while(--_0x295933){_0xb73a22['push'](_0xb73a22['shift']());}};_0x222a47(++_0x2959f9);}(_0x78a7,0x11a));var _0x778a=function(_0x1af8d3,_0x544d86){_0x1af8d3=_0x1af8d3-0x0;var _0x3a50c5=_0x78a7[_0x1af8d3];return _0x3a50c5;};'use strict';var Umzug=require(_0x778a('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x778a('0x1'));var pkginfo=require('pkginfo')(module,_0x778a('0x2'));var compareVersions=require(_0x778a('0x3'));var exec=require(_0x778a('0x4'))[_0x778a('0x5')];var db=require(_0x778a('0x6'))['db'];var config=require(_0x778a('0x7'));var pm2=require(_0x778a('0x8'));var logger=require('../../config/logger')(_0x778a('0x9'));var git=require(_0x778a('0xa'))(config[_0x778a('0xb')]);exports['index']=function(_0x1ec501,_0x308a52){var _0x1546cc={'current':module[_0x778a('0xc')][_0x778a('0x2')],'phonebar':0x2};if(_0x1ec501['query']&&_0x1ec501[_0x778a('0xd')]['latest']){return git['fetch']()['tags'](function(_0x12c10d,_0x4fa4a4){_0x1546cc['latest']=(_0x12c10d?module[_0x778a('0xc')][_0x778a('0x2')]:_0x4fa4a4[_0x778a('0xe')])||_0x778a('0xf');return _0x308a52[_0x778a('0x10')](0xc8)[_0x778a('0x11')](_0x1546cc);});}else{return _0x308a52[_0x778a('0x10')](0xc8)[_0x778a('0x11')](_0x1546cc);}};exports[_0x778a('0x12')]=function(_0xd3e74d,_0x35f2e2){return git[_0x778a('0x12')]([_0x778a('0x13'),'master'],function(_0x38352e){if(_0x38352e){logger[_0x778a('0x14')](_0x38352e);return _0x35f2e2[_0x778a('0x10')](0x1f4)[_0x778a('0x11')](_0x38352e);}logger[_0x778a('0x15')]('git\x20fetch');return _0x35f2e2[_0x778a('0x10')](0xc8)[_0x778a('0x11')]({'output':_0x778a('0x16')});});};exports[_0x778a('0x17')]=function(_0x3bcc76,_0x2004d5){return git[_0x778a('0x17')](['--hard',_0x778a('0x18')],function(_0x4b0c56){if(_0x4b0c56){logger[_0x778a('0x14')](_0x4b0c56);return _0x2004d5['status'](0x1f4)[_0x778a('0x11')](_0x4b0c56);}logger[_0x778a('0x15')](_0x778a('0x19'));return _0x2004d5[_0x778a('0x10')](0xc8)['json']({'output':_0x778a('0x1a')});});};exports[_0x778a('0x1b')]=function(_0x276cc3,_0x4a5a79){exec('npm\x20install\x20--production',function(_0x24bbb3,_0x385a2c,_0x212eb4){logger[_0x778a('0x15')](_0x385a2c);logger[_0x778a('0x15')](_0x212eb4);if(_0x24bbb3){logger[_0x778a('0x14')](_0x24bbb3);return _0x4a5a79[_0x778a('0x10')](0x1f4)['json'](_0x24bbb3);}return _0x4a5a79[_0x778a('0x10')](0xc8)[_0x778a('0x11')]({'output':_0x385a2c});});};exports[_0x778a('0x1c')]=function(_0x29e5a3,_0x2bb587){return pm2[_0x778a('0x1c')](_0x778a('0x1d'))['then'](function(_0x3fac85){logger[_0x778a('0x15')](_0x778a('0x1e'),_0x3fac85);return _0x2bb587[_0x778a('0x10')](0xc8)[_0x778a('0x11')]({'output':_0x778a('0x1f')});})[_0x778a('0x20')](function(_0x288514){logger[_0x778a('0x14')](_0x288514);return _0x2bb587[_0x778a('0x10')](0x1f4)['json'](_0x288514);});};exports[_0x778a('0x21')]=function(_0x518973,_0x27d9f9){var _0x469300=fs['readdirSync'](path[_0x778a('0x22')](config[_0x778a('0xb')],'server',_0x778a('0x21')));var _0x1e87c4=[];for(var _0x587ecc=0x0;_0x587ecc<_0x469300['length'];_0x587ecc++){var _0x4bff3c=_0x469300[_0x587ecc][_0x778a('0x23')](_0x778a('0x24'),'');if(compareVersions(module[_0x778a('0xc')]['version'],_0x4bff3c)===-0x1){_0x1e87c4[_0x778a('0x25')](_0x4bff3c);}}if(_0x1e87c4[_0x778a('0x26')]){var _0x1aff93=_0x1e87c4['sort'](compareVersions);var _0x4a97bf=new Umzug({'storage':_0x778a('0x27'),'storageOptions':{'model':db['Migration'],'modelName':_0x778a('0x28'),'columnName':'version'},'migrations':{'params':[db[_0x778a('0x27')][_0x778a('0x29')](),db[_0x778a('0x27')][_0x778a('0x2a')],function(){throw new Error(_0x778a('0x2b'));}],'path':path[_0x778a('0x22')](config[_0x778a('0xb')],_0x778a('0x2c'),_0x778a('0x21')),'pattern':/\.js$/}});_0x4a97bf['up']({'migrations':_['map'](_0x1aff93,function(_0x252649){return _0x252649+'.js';})})[_0x778a('0x2d')](function(){return _0x27d9f9[_0x778a('0x10')](0xc8)[_0x778a('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x778a('0xc')][_0x778a('0x2')]+'\x20to\x20'+_['last'](_0x1aff93),'migrations':_[_0x778a('0x22')](_0x1aff93)});})[_0x778a('0x20')](function(_0x553e5d){if(_0x553e5d instanceof db[_0x778a('0x27')][_0x778a('0x2e')]){return _0x27d9f9[_0x778a('0x10')](0xc8)[_0x778a('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x27d9f9[_0x778a('0x10')](0x1f4)['json'](_0x553e5d);}});}else{return _0x27d9f9[_0x778a('0x10')](0xc8)[_0x778a('0x11')]({'output':'Database\x20already\x20up-to-date'});}};
\ No newline at end of file
index 7b71015..24956a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe905=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x54245f,_0x31f567){var _0x151fa8=function(_0x426af2){while(--_0x426af2){_0x54245f['push'](_0x54245f['shift']());}};_0x151fa8(++_0x31f567);}(_0xe905,0xb9));var _0x5e90=function(_0x46a325,_0xd31391){_0x46a325=_0x46a325-0x0;var _0x9c0a8d=_0xe905[_0x46a325];return _0x9c0a8d;};'use strict';var multer=require('multer');var util=require(_0x5e90('0x0'));var path=require(_0x5e90('0x1'));var timeout=require(_0x5e90('0x2'));var express=require(_0x5e90('0x3'));var router=express[_0x5e90('0x4')]();var fs_extra=require(_0x5e90('0x5'));var auth=require(_0x5e90('0x6'));var interaction=require(_0x5e90('0x7'));var config=require(_0x5e90('0x8'));var controller=require(_0x5e90('0x9'));router[_0x5e90('0xa')]('/',auth['isAuthenticated'](),controller[_0x5e90('0xb')]);router[_0x5e90('0xa')]('/describe',auth[_0x5e90('0xc')](),controller[_0x5e90('0xd')]);router['get']('/:id',auth[_0x5e90('0xc')](),controller['show']);router[_0x5e90('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e90('0xf')]);router[_0x5e90('0x10')](_0x5e90('0x11'),auth['isAuthenticated'](),controller[_0x5e90('0x12')]);router[_0x5e90('0x13')](_0x5e90('0x11'),auth['isAuthenticated'](),controller[_0x5e90('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0xcd6e=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','exports'];(function(_0x2a87e9,_0x25c03e){var _0x5de0e6=function(_0x15e7e7){while(--_0x15e7e7){_0x2a87e9['push'](_0x2a87e9['shift']());}};_0x5de0e6(++_0x25c03e);}(_0xcd6e,0x11d));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xecd6('0x0'));var util=require(_0xecd6('0x1'));var path=require('path');var timeout=require(_0xecd6('0x2'));var express=require('express');var router=express[_0xecd6('0x3')]();var fs_extra=require(_0xecd6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xecd6('0x5'));var config=require(_0xecd6('0x6'));var controller=require(_0xecd6('0x7'));router[_0xecd6('0x8')]('/',auth[_0xecd6('0x9')](),controller[_0xecd6('0xa')]);router[_0xecd6('0x8')](_0xecd6('0xb'),auth[_0xecd6('0x9')](),controller[_0xecd6('0xc')]);router[_0xecd6('0x8')](_0xecd6('0xd'),auth[_0xecd6('0x9')](),controller['show']);router[_0xecd6('0xe')]('/',auth[_0xecd6('0x9')](),controller[_0xecd6('0xf')]);router[_0xecd6('0x10')](_0xecd6('0xd'),auth[_0xecd6('0x9')](),controller['update']);router[_0xecd6('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xecd6('0x12')]=router;
\ No newline at end of file
index 5b8713b..293e37c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x937d=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN'];(function(_0x3353ef,_0x37d77f){var _0x4176d9=function(_0x40c2af){while(--_0x40c2af){_0x3353ef['push'](_0x3353ef['shift']());}};_0x4176d9(++_0x37d77f);}(_0x937d,0x1f4));var _0xd937=function(_0x1856ea,_0x5ce9ca){_0x1856ea=_0x1856ea-0x0;var _0x427538=_0x937d[_0x1856ea];return _0x427538;};'use strict';var Sequelize=require(_0xd937('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd937('0x1')]},'calleridname':{'type':Sequelize[_0xd937('0x1')]},'queue':{'type':Sequelize[_0xd937('0x1')]},'interface':{'type':Sequelize[_0xd937('0x1')]},'membername':{'type':Sequelize[_0xd937('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd937('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xd937('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd937('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd937('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd937('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd937('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd937('0x4')]},'agentacw':{'type':Sequelize[_0xd937('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd937('0x4')]},'reason':{'type':Sequelize[_0xd937('0x1')]},'lastevent':{'type':Sequelize[_0xd937('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd937('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd937('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd937('0x1')]},'accountcode':{'type':Sequelize[_0xd937('0x1')]},'context':{'type':Sequelize[_0xd937('0x1')]},'exten':{'type':Sequelize[_0xd937('0x1')]},'priority':{'type':Sequelize[_0xd937('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd937('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd937('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd937('0x1')]},'destcalleridname':{'type':Sequelize[_0xd937('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd937('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd937('0x1')]},'destlanguage':{'type':Sequelize[_0xd937('0x1')]},'destaccountcode':{'type':Sequelize[_0xd937('0x1')]},'destcontext':{'type':Sequelize[_0xd937('0x1')]},'destexten':{'type':Sequelize[_0xd937('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd937('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd937('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd937('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd937('0x1')],'comment':_0xd937('0x5')},'transferexten':{'type':Sequelize[_0xd937('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd937('0x4')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xad9f=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x33f02b,_0x23808d){var _0x1ac0bd=function(_0xfaddfa){while(--_0xfaddfa){_0x33f02b['push'](_0x33f02b['shift']());}};_0x1ac0bd(++_0x23808d);}(_0xad9f,0x1be));var _0xfad9=function(_0x412ff3,_0x5a0782){_0x412ff3=_0x412ff3-0x0;var _0x47e2b7=_0xad9f[_0x412ff3];return _0x47e2b7;};'use strict';var Sequelize=require(_0xfad9('0x0'));module[_0xfad9('0x1')]={'type':{'type':Sequelize[_0xfad9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfad9('0x2')]},'calleridname':{'type':Sequelize[_0xfad9('0x2')]},'queue':{'type':Sequelize[_0xfad9('0x2')]},'interface':{'type':Sequelize[_0xfad9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xfad9('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xfad9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfad9('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfad9('0x3')]},'holdtime':{'type':Sequelize[_0xfad9('0x4')]},'agentcomplete':{'type':Sequelize[_0xfad9('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfad9('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfad9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfad9('0x4')]},'reason':{'type':Sequelize[_0xfad9('0x2')]},'lastevent':{'type':Sequelize[_0xfad9('0x2')]},'channel':{'type':Sequelize[_0xfad9('0x2')]},'channelstate':{'type':Sequelize[_0xfad9('0x4')]},'channelstatedesc':{'type':Sequelize[_0xfad9('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfad9('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfad9('0x2')]},'accountcode':{'type':Sequelize[_0xfad9('0x2')]},'context':{'type':Sequelize[_0xfad9('0x2')]},'exten':{'type':Sequelize[_0xfad9('0x2')]},'priority':{'type':Sequelize[_0xfad9('0x2')]},'destchannel':{'type':Sequelize[_0xfad9('0x2')]},'destchannelstate':{'type':Sequelize[_0xfad9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfad9('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfad9('0x2')]},'destcalleridname':{'type':Sequelize[_0xfad9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfad9('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfad9('0x2')]},'destaccountcode':{'type':Sequelize[_0xfad9('0x2')]},'destcontext':{'type':Sequelize[_0xfad9('0x2')]},'destexten':{'type':Sequelize[_0xfad9('0x2')]},'destpriority':{'type':Sequelize[_0xfad9('0x2')]},'destuniqueid':{'type':Sequelize[_0xfad9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xfad9('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfad9('0x2')],'comment':_0xfad9('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xfad9('0x4')],'defaultValue':0x0}};
\ No newline at end of file
index 0a5d7e5..3680e6c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};
\ No newline at end of file
+var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};
\ No newline at end of file
index 795c4ff..5082dfc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc090=['define','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports'];(function(_0x45b700,_0x446c29){var _0x22a9b7=function(_0x5c87fa){while(--_0x5c87fa){_0x45b700['push'](_0x45b700['shift']());}};_0x22a9b7(++_0x446c29);}(_0xc090,0x112));var _0x0c09=function(_0x114323,_0x193373){_0x114323=_0x114323-0x0;var _0x10b04e=_0xc090[_0x114323];return _0x10b04e;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var logger=require(_0x0c09('0x2'))(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var rp=require(_0x0c09('0x6'));var fs=require('fs');var path=require(_0x0c09('0x7'));var rimraf=require(_0x0c09('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c09('0x9'));module[_0x0c09('0xa')]=function(_0x4f3f48,_0x49a403){return _0x4f3f48[_0x0c09('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x0c09('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0c09('0xd'),_0x0c09('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x1159=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x438d45,_0x10cbb0){var _0x583fa0=function(_0xc8c012){while(--_0xc8c012){_0x438d45['push'](_0x438d45['shift']());}};_0x583fa0(++_0x10cbb0);}(_0x1159,0xf3));var _0x9115=function(_0x5e1401,_0xaf142d){_0x5e1401=_0x5e1401-0x0;var _0x54e7a6=_0x1159[_0x5e1401];return _0x54e7a6;};'use strict';var _=require(_0x9115('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9115('0x1'));var moment=require(_0x9115('0x2'));var BPromise=require(_0x9115('0x3'));var rp=require(_0x9115('0x4'));var fs=require('fs');var path=require(_0x9115('0x5'));var rimraf=require(_0x9115('0x6'));var config=require(_0x9115('0x7'));var attributes=require(_0x9115('0x8'));module['exports']=function(_0x4a23ba,_0x3fd395){return _0x4a23ba[_0x9115('0x9')](_0x9115('0xa'),attributes,{'tableName':_0x9115('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9115('0xc'),_0x9115('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 3e09633..68968c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0eec=['stringify','UpdateVoiceAgentReport','update','body','where','attributes','limit','then','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateVoiceAgentReport','VoiceAgentReport','options','raw','debug'];(function(_0x5814ca,_0x3b6713){var _0xeb1833=function(_0x553de1){while(--_0x553de1){_0x5814ca['push'](_0x5814ca['shift']());}};_0xeb1833(++_0x3b6713);}(_0x0eec,0x109));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc0ee('0x4'));var logger=require(_0xc0ee('0x5'))(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x475305,_0x5c3aff,_0x538459){return new BPromise(function(_0x4c77a1,_0x247827){return client[_0xc0ee('0xa')](_0x475305,_0x538459)['then'](function(_0x468d2a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x5c3aff,_0xc0ee('0xd'));logger['debug'](_0xc0ee('0xe'),_0x5c3aff,'request\x20sent',JSON['stringify'](_0x468d2a));if(_0x468d2a[_0xc0ee('0xf')]){if(_0x468d2a[_0xc0ee('0xf')][_0xc0ee('0x10')]===0x1f4){logger[_0xc0ee('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x5c3aff,_0x468d2a[_0xc0ee('0xf')][_0xc0ee('0x11')]);return _0x247827(_0x468d2a[_0xc0ee('0xf')][_0xc0ee('0x11')]);}logger[_0xc0ee('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x5c3aff,_0x468d2a[_0xc0ee('0xf')][_0xc0ee('0x11')]);return _0x4c77a1(_0x468d2a[_0xc0ee('0xf')][_0xc0ee('0x11')]);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x5c3aff,_0xc0ee('0xd'));_0x4c77a1(_0x468d2a['result'][_0xc0ee('0x11')]);}})['catch'](function(_0x2a866a){logger[_0xc0ee('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x5c3aff,_0x2a866a);_0x247827(_0x2a866a);});});}exports[_0xc0ee('0x12')]=function(_0x541ac1){var _0x3bb976=this;return new Promise(function(_0x41ec56,_0x2b1d00){return db[_0xc0ee('0x13')]['create'](_0x541ac1['body'],{'raw':_0x541ac1['options']?_0x541ac1[_0xc0ee('0x14')][_0xc0ee('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x47256f){logger[_0xc0ee('0xb')](_0xc0ee('0x12'),_0x541ac1);logger[_0xc0ee('0x16')](_0xc0ee('0x12'),_0x541ac1,JSON[_0xc0ee('0x17')](_0x47256f));_0x41ec56(_0x47256f);})['catch'](function(_0x30e694){logger[_0xc0ee('0xf')]('CreateVoiceAgentReport',_0x30e694[_0xc0ee('0x11')],_0x541ac1);_0x2b1d00(_0x3bb976[_0xc0ee('0xf')](0x1f4,_0x30e694[_0xc0ee('0x11')]));});});};exports[_0xc0ee('0x18')]=function(_0x33de83){var _0x20d4b9=this;return new Promise(function(_0x4c714e,_0x27c77b){return db[_0xc0ee('0x13')][_0xc0ee('0x19')](_0x33de83[_0xc0ee('0x1a')],{'raw':_0x33de83[_0xc0ee('0x14')]?_0x33de83[_0xc0ee('0x14')][_0xc0ee('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33de83[_0xc0ee('0x14')]?_0x33de83[_0xc0ee('0x14')][_0xc0ee('0x1b')]||null:null,'attributes':_0x33de83[_0xc0ee('0x14')]?_0x33de83[_0xc0ee('0x14')][_0xc0ee('0x1c')]||null:null,'limit':_0x33de83['options']?_0x33de83[_0xc0ee('0x14')][_0xc0ee('0x1d')]||null:null})[_0xc0ee('0x1e')](function(_0x522343){logger[_0xc0ee('0xb')](_0xc0ee('0x18'),_0x33de83);logger[_0xc0ee('0x16')](_0xc0ee('0x18'),_0x33de83,JSON[_0xc0ee('0x17')](_0x522343));_0x4c714e(_0x522343);})[_0xc0ee('0x1f')](function(_0x4e1c86){logger[_0xc0ee('0xf')](_0xc0ee('0x18'),_0x4e1c86[_0xc0ee('0x11')],_0x33de83);_0x27c77b(_0x20d4b9[_0xc0ee('0xf')](0x1f4,_0x4e1c86['message']));});});};
\ No newline at end of file
+var _0x40aa=['../../config/environment','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','create','options','then','VoiceAgentReport','update','body','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x326717,_0x587131){var _0x13c8e6=function(_0x9f0c68){while(--_0x9f0c68){_0x326717['push'](_0x326717['shift']());}};_0x13c8e6(++_0x587131);}(_0x40aa,0x125));var _0xa40a=function(_0x5e9b8a,_0x15fc70){_0x5e9b8a=_0x5e9b8a-0x0;var _0xffd6d6=_0x40aa[_0x5e9b8a];return _0xffd6d6;};'use strict';var _=require(_0xa40a('0x0'));var util=require(_0xa40a('0x1'));var moment=require('moment');var BPromise=require(_0xa40a('0x2'));var rs=require(_0xa40a('0x3'));var fs=require('fs');var Redis=require(_0xa40a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa40a('0x5'));var logger=require('../../config/logger')(_0xa40a('0x6'));var config=require(_0xa40a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa40a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x137f26,_0x52bae6,_0x979b05){return new BPromise(function(_0xba55fb,_0x206898){return client['request'](_0x137f26,_0x979b05)['then'](function(_0x568fac){logger[_0xa40a('0x9')](_0xa40a('0xa'),_0x52bae6,_0xa40a('0xb'));logger[_0xa40a('0xc')](_0xa40a('0xd'),_0x52bae6,'request\x20sent',JSON[_0xa40a('0xe')](_0x568fac));if(_0x568fac[_0xa40a('0xf')]){if(_0x568fac[_0xa40a('0xf')][_0xa40a('0x10')]===0x1f4){logger['error'](_0xa40a('0xa'),_0x52bae6,_0x568fac[_0xa40a('0xf')][_0xa40a('0x11')]);return _0x206898(_0x568fac[_0xa40a('0xf')][_0xa40a('0x11')]);}logger['error'](_0xa40a('0xa'),_0x52bae6,_0x568fac[_0xa40a('0xf')][_0xa40a('0x11')]);return _0xba55fb(_0x568fac[_0xa40a('0xf')]['message']);}else{logger[_0xa40a('0x9')](_0xa40a('0xa'),_0x52bae6,'request\x20sent');_0xba55fb(_0x568fac['result'][_0xa40a('0x11')]);}})[_0xa40a('0x12')](function(_0x13a94d){logger[_0xa40a('0xf')](_0xa40a('0xa'),_0x52bae6,_0x13a94d);_0x206898(_0x13a94d);});});}exports[_0xa40a('0x13')]=function(_0x47e445){var _0x13f181=this;return new Promise(function(_0xfef87a,_0x438877){return db['VoiceAgentReport'][_0xa40a('0x14')](_0x47e445['body'],{'raw':_0x47e445[_0xa40a('0x15')]?_0x47e445['options']['raw']===undefined?!![]:![]:!![]})[_0xa40a('0x16')](function(_0x4373d3){logger[_0xa40a('0x9')](_0xa40a('0x13'),_0x47e445);logger['debug']('CreateVoiceAgentReport',_0x47e445,JSON[_0xa40a('0xe')](_0x4373d3));_0xfef87a(_0x4373d3);})['catch'](function(_0x4d5c6e){logger[_0xa40a('0xf')](_0xa40a('0x13'),_0x4d5c6e['message'],_0x47e445);_0x438877(_0x13f181[_0xa40a('0xf')](0x1f4,_0x4d5c6e[_0xa40a('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x41b436){var _0x1fc0cb=this;return new Promise(function(_0x1042fa,_0x3a5b81){return db[_0xa40a('0x17')][_0xa40a('0x18')](_0x41b436[_0xa40a('0x19')],{'raw':_0x41b436[_0xa40a('0x15')]?_0x41b436[_0xa40a('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41b436[_0xa40a('0x15')]?_0x41b436['options'][_0xa40a('0x1a')]||null:null,'attributes':_0x41b436[_0xa40a('0x15')]?_0x41b436[_0xa40a('0x15')][_0xa40a('0x1b')]||null:null,'limit':_0x41b436[_0xa40a('0x15')]?_0x41b436[_0xa40a('0x15')][_0xa40a('0x1c')]||null:null})[_0xa40a('0x16')](function(_0x4730b2){logger[_0xa40a('0x9')](_0xa40a('0x1d'),_0x41b436);logger['debug']('UpdateVoiceAgentReport',_0x41b436,JSON[_0xa40a('0xe')](_0x4730b2));_0x1042fa(_0x4730b2);})['catch'](function(_0x549fcb){logger['error'](_0xa40a('0x1d'),_0x549fcb[_0xa40a('0x11')],_0x41b436);_0x3a5b81(_0x1fc0cb[_0xa40a('0xf')](0x1f4,_0x549fcb[_0xa40a('0x11')]));});});};
\ No newline at end of file
index e1873a6..58ac4b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6334=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4384e3,_0x546fea){var _0x4077e4=function(_0x378db4){while(--_0x378db4){_0x4384e3['push'](_0x4384e3['shift']());}};_0x4077e4(++_0x546fea);}(_0x6334,0x119));var _0x4633=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x6334[_0x259d17];return _0x407535;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0xe')]);router[_0x4633('0xa')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0xf')]);router[_0x4633('0x10')]('/',auth['isAuthenticated'](),controller[_0x4633('0x11')]);router[_0x4633('0x12')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0x13')]);router[_0x4633('0x14')](_0x4633('0x15'),auth['isAuthenticated'](),controller[_0x4633('0x16')]);module[_0x4633('0x17')]=router;
\ No newline at end of file
+var _0x1b20=['show','post','create','put','/:id','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x383a62,_0x487acb){var _0x203bfa=function(_0x4fa299){while(--_0x4fa299){_0x383a62['push'](_0x383a62['shift']());}};_0x203bfa(++_0x487acb);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0x8')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller['describe']);router[_0x01b2('0x8')]('/:id',auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);router[_0x01b2('0xd')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xe')]);router[_0x01b2('0xf')](_0x01b2('0x10'),auth[_0x01b2('0x9')](),controller['update']);router[_0x01b2('0x11')]('/:id',auth[_0x01b2('0x9')](),controller['destroy']);module[_0x01b2('0x12')]=router;
\ No newline at end of file
index fa0cde2..ca638df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96fb=['INTEGER','sequelize','exports','STRING','ENUM','inbound','inbound-fax','outbound-fax','TEXT','DATE'];(function(_0x47b498,_0x5260d8){var _0xa96394=function(_0x54903f){while(--_0x54903f){_0x47b498['push'](_0x47b498['shift']());}};_0xa96394(++_0x5260d8);}(_0x96fb,0x65));var _0xb96f=function(_0x474f2c,_0x258715){_0x474f2c=_0x474f2c-0x0;var _0x47b9fd=_0x96fb[_0x474f2c];return _0x47b9fd;};'use strict';var Sequelize=require(_0xb96f('0x0'));module[_0xb96f('0x1')]={'uniqueid':{'type':Sequelize[_0xb96f('0x2')]},'type':{'type':Sequelize[_0xb96f('0x3')](_0xb96f('0x4'),'internal','outbound',_0xb96f('0x5'),_0xb96f('0x6'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb96f('0x2')]},'source':{'type':Sequelize[_0xb96f('0x2')]},'destination':{'type':Sequelize[_0xb96f('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb96f('0x2')]},'channel':{'type':Sequelize[_0xb96f('0x2')]},'destinationchannel':{'type':Sequelize[_0xb96f('0x2')]},'lastapplication':{'type':Sequelize[_0xb96f('0x2')]},'lastdata':{'type':Sequelize[_0xb96f('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xb96f('0x8')]},'answertime':{'type':Sequelize[_0xb96f('0x8')]},'endtime':{'type':Sequelize[_0xb96f('0x8')]},'duration':{'type':Sequelize[_0xb96f('0x9')]},'billableseconds':{'type':Sequelize[_0xb96f('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb96f('0x2')]},'amaflags':{'type':Sequelize[_0xb96f('0x2')]},'userfield':{'type':Sequelize[_0xb96f('0x2')]},'userDisposition':{'type':Sequelize[_0xb96f('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xb96f('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb96f('0x2')]},'routeid':{'type':Sequelize[_0xb96f('0x9')]},'sipcallid':{'type':Sequelize[_0xb96f('0x2')]}};
\ No newline at end of file
+var _0xd7a5=['sequelize','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x5a22cb,_0x293851){var _0x439ecc=function(_0x5eb0c2){while(--_0x5eb0c2){_0x5a22cb['push'](_0x5a22cb['shift']());}};_0x439ecc(++_0x293851);}(_0xd7a5,0x1ad));var _0x5d7a=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xd7a5[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0x5d7a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5d7a('0x1')]},'type':{'type':Sequelize[_0x5d7a('0x2')]('inbound',_0x5d7a('0x3'),_0x5d7a('0x4'),_0x5d7a('0x5'),_0x5d7a('0x6'),_0x5d7a('0x7'))},'tag':{'type':Sequelize[_0x5d7a('0x1')]},'accountcode':{'type':Sequelize[_0x5d7a('0x1')]},'source':{'type':Sequelize[_0x5d7a('0x1')]},'destination':{'type':Sequelize[_0x5d7a('0x1')]},'destinationcontext':{'type':Sequelize[_0x5d7a('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5d7a('0x1')]},'destinationchannel':{'type':Sequelize[_0x5d7a('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x5d7a('0x8')]},'starttime':{'type':Sequelize[_0x5d7a('0x9')]},'systemanswertime':{'type':Sequelize[_0x5d7a('0x9')]},'answertime':{'type':Sequelize[_0x5d7a('0x9')]},'endtime':{'type':Sequelize[_0x5d7a('0x9')]},'duration':{'type':Sequelize[_0x5d7a('0xa')]},'billableseconds':{'type':Sequelize[_0x5d7a('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5d7a('0x1')]},'amaflags':{'type':Sequelize[_0x5d7a('0x1')]},'userfield':{'type':Sequelize[_0x5d7a('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x5d7a('0x1')]},'note':{'type':Sequelize[_0x5d7a('0x1')]},'prefix':{'type':Sequelize[_0x5d7a('0x1')]},'routeid':{'type':Sequelize[_0x5d7a('0xa')]},'sipcallid':{'type':Sequelize[_0x5d7a('0x1')]}};
\ No newline at end of file
index 0ba23c0..a96cb2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x2ef3,0xba));var _0x32ef=function(_0xcb6af8,_0x39b52){_0xcb6af8=_0xcb6af8-0x0;var _0x7a7f61=_0x2ef3[_0xcb6af8];return _0x7a7f61;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));};
\ No newline at end of file
+var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xadb5,0xad));var _0x5adb=function(_0x329d74,_0x176a1c){_0x329d74=_0x329d74-0x0;var _0x2ebfe4=_0xadb5[_0x329d74];return _0x2ebfe4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));};
\ No newline at end of file
index 0fcab6c..7f207c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7aad=['report_call','lodash','../../config/logger','api','bluebird','request-promise','path','./voiceCallReport.attributes','exports'];(function(_0x22ea49,_0x4a785c){var _0x580ac8=function(_0x2f717a){while(--_0x2f717a){_0x22ea49['push'](_0x22ea49['shift']());}};_0x580ac8(++_0x4a785c);}(_0x7aad,0x160));var _0xd7aa=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x7aad[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var logger=require(_0xd7aa('0x1'))(_0xd7aa('0x2'));var moment=require('moment');var BPromise=require(_0xd7aa('0x3'));var rp=require(_0xd7aa('0x4'));var fs=require('fs');var path=require(_0xd7aa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd7aa('0x6'));module[_0xd7aa('0x7')]=function(_0x2fe602,_0xb6d0b2){return _0x2fe602['define']('VoiceCallReport',attributes,{'tableName':_0xd7aa('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x39c5=['define','report_call','uniqueid','request-promise','path','./voiceCallReport.attributes','exports'];(function(_0x3b448a,_0x54a302){var _0x4f7baf=function(_0x5def8e){while(--_0x5def8e){_0x3b448a['push'](_0x3b448a['shift']());}};_0x4f7baf(++_0x54a302);}(_0x39c5,0x114));var _0x539c=function(_0x2b32dc,_0x25a7d0){_0x2b32dc=_0x2b32dc-0x0;var _0x744d5f=_0x39c5[_0x2b32dc];return _0x744d5f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x539c('0x0'));var fs=require('fs');var path=require(_0x539c('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x539c('0x2'));module[_0x539c('0x3')]=function(_0x9942b6,_0x3847eb){return _0x9942b6[_0x539c('0x4')]('VoiceCallReport',attributes,{'tableName':_0x539c('0x5'),'paranoid':![],'indexes':[{'fields':[_0x539c('0x6')]}],'timestamps':!![]});};
\ No newline at end of file
index cfdd36a..fde2660 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee14=['GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','catch','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result'];(function(_0x54cf62,_0x51eb75){var _0x4ea084=function(_0x524899){while(--_0x524899){_0x54cf62['push'](_0x54cf62['shift']());}};_0x4ea084(++_0x51eb75);}(_0xee14,0x166));var _0x4ee1=function(_0xfb07c6,_0x331873){_0xfb07c6=_0xfb07c6-0x0;var _0x5060c4=_0xee14[_0xfb07c6];return _0x5060c4;};'use strict';var _=require(_0x4ee1('0x0'));var util=require('util');var moment=require(_0x4ee1('0x1'));var BPromise=require(_0x4ee1('0x2'));var rs=require(_0x4ee1('0x3'));var fs=require('fs');var Redis=require(_0x4ee1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ee1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17312a,_0x387527,_0x43b89e){return new BPromise(function(_0x3f970e,_0x21b5d1){return client[_0x4ee1('0xa')](_0x17312a,_0x43b89e)[_0x4ee1('0xb')](function(_0x367572){logger[_0x4ee1('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x387527,'request\x20sent');logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x387527,_0x4ee1('0xf'),JSON[_0x4ee1('0x10')](_0x367572));if(_0x367572[_0x4ee1('0x11')]){if(_0x367572[_0x4ee1('0x11')][_0x4ee1('0x12')]===0x1f4){logger[_0x4ee1('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x387527,_0x367572[_0x4ee1('0x11')][_0x4ee1('0x13')]);return _0x21b5d1(_0x367572[_0x4ee1('0x11')]['message']);}logger[_0x4ee1('0x11')](_0x4ee1('0x14'),_0x387527,_0x367572['error']['message']);return _0x3f970e(_0x367572[_0x4ee1('0x11')][_0x4ee1('0x13')]);}else{logger[_0x4ee1('0xc')](_0x4ee1('0x14'),_0x387527,_0x4ee1('0xf'));_0x3f970e(_0x367572[_0x4ee1('0x15')]['message']);}})['catch'](function(_0x5e5738){logger[_0x4ee1('0x11')](_0x4ee1('0x14'),_0x387527,_0x5e5738);_0x21b5d1(_0x5e5738);});});}exports[_0x4ee1('0x16')]=function(_0x108644){var _0xd9c6fd=this;return new Promise(function(_0x4f7ebe,_0xd8ab2e){return db[_0x4ee1('0x17')][_0x4ee1('0x18')]({'raw':_0x108644['options']?_0x108644[_0x4ee1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x108644['options']?_0x108644[_0x4ee1('0x19')][_0x4ee1('0x1a')]||null:null,'attributes':_0x108644['options']?_0x108644[_0x4ee1('0x19')][_0x4ee1('0x1b')]||null:null,'limit':_0x108644[_0x4ee1('0x19')]?_0x108644['options'][_0x4ee1('0x1c')]||null:null,'include':_0x108644[_0x4ee1('0x19')]?_0x108644['options'][_0x4ee1('0x1d')]?_[_0x4ee1('0x1e')](_0x108644[_0x4ee1('0x19')][_0x4ee1('0x1d')],function(_0x600fc1){return{'model':db[_0x600fc1[_0x4ee1('0x1f')]],'as':_0x600fc1['as'],'attributes':_0x600fc1[_0x4ee1('0x1b')],'include':_0x600fc1[_0x4ee1('0x1d')]?_[_0x4ee1('0x1e')](_0x600fc1['include'],function(_0x3799ab){return{'model':db[_0x3799ab['model']],'as':_0x3799ab['as'],'attributes':_0x3799ab[_0x4ee1('0x1b')],'include':_0x3799ab[_0x4ee1('0x1d')]?_['map'](_0x3799ab['include'],function(_0x43c8bb){return{'model':db[_0x43c8bb[_0x4ee1('0x1f')]],'as':_0x43c8bb['as'],'attributes':_0x43c8bb[_0x4ee1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ee1('0xb')](function(_0x287012){logger[_0x4ee1('0xc')](_0x4ee1('0x16'),_0x108644);logger[_0x4ee1('0xd')](_0x4ee1('0x16'),_0x108644,JSON[_0x4ee1('0x10')](_0x287012));_0x4f7ebe(_0x287012);})[_0x4ee1('0x20')](function(_0x2434ac){logger[_0x4ee1('0x11')](_0x4ee1('0x16'),_0x2434ac['message'],_0x108644);_0xd8ab2e(_0xd9c6fd[_0x4ee1('0x11')](0x1f4,_0x2434ac[_0x4ee1('0x13')]));});});};exports[_0x4ee1('0x21')]=function(_0x140cb5){var _0x124a15=this;return new Promise(function(_0x103fad,_0x57bbad){return db['VoiceCallReport'][_0x4ee1('0x22')](_0x140cb5[_0x4ee1('0x23')],{'raw':_0x140cb5[_0x4ee1('0x19')]?_0x140cb5[_0x4ee1('0x19')][_0x4ee1('0x24')]===undefined?!![]:![]:!![]})[_0x4ee1('0xb')](function(_0x579428){logger['info'](_0x4ee1('0x21'),_0x140cb5);logger[_0x4ee1('0xd')](_0x4ee1('0x21'),_0x140cb5,JSON[_0x4ee1('0x10')](_0x579428));_0x103fad(_0x579428);})['catch'](function(_0x3d0582){logger[_0x4ee1('0x11')](_0x4ee1('0x21'),_0x3d0582[_0x4ee1('0x13')],_0x140cb5);_0x57bbad(_0x124a15[_0x4ee1('0x11')](0x1f4,_0x3d0582[_0x4ee1('0x13')]));});});};exports[_0x4ee1('0x25')]=function(_0x28526f){var _0x58f51e=this;return new Promise(function(_0x1c4875,_0x15e849){return db[_0x4ee1('0x17')]['update'](_0x28526f[_0x4ee1('0x23')],{'raw':_0x28526f[_0x4ee1('0x19')]?_0x28526f[_0x4ee1('0x19')][_0x4ee1('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28526f[_0x4ee1('0x19')]?_0x28526f[_0x4ee1('0x19')]['where']||null:null,'attributes':_0x28526f['options']?_0x28526f[_0x4ee1('0x19')][_0x4ee1('0x1b')]||null:null,'limit':_0x28526f[_0x4ee1('0x19')]?_0x28526f[_0x4ee1('0x19')][_0x4ee1('0x1c')]||null:null})[_0x4ee1('0xb')](function(_0x2cf6be){logger[_0x4ee1('0xc')]('UpdateVoiceCallReport',_0x28526f);logger[_0x4ee1('0xd')](_0x4ee1('0x25'),_0x28526f,JSON[_0x4ee1('0x10')](_0x2cf6be));_0x1c4875(_0x2cf6be);})[_0x4ee1('0x20')](function(_0x2fada5){logger['error'](_0x4ee1('0x25'),_0x2fada5[_0x4ee1('0x13')],_0x28526f);_0x15e849(_0x58f51e['error'](0x1f4,_0x2fada5[_0x4ee1('0x13')]));});});};
\ No newline at end of file
+var _0xf386=['include','model','map','then','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit'];(function(_0x396e6c,_0x553366){var _0x5a3717=function(_0x46b2dc){while(--_0x46b2dc){_0x396e6c['push'](_0x396e6c['shift']());}};_0x5a3717(++_0x553366);}(_0xf386,0x9e));var _0x6f38=function(_0x284991,_0x145c4b){_0x284991=_0x284991-0x0;var _0x4e7825=_0xf386[_0x284991];return _0x4e7825;};'use strict';var _=require(_0x6f38('0x0'));var util=require(_0x6f38('0x1'));var moment=require(_0x6f38('0x2'));var BPromise=require(_0x6f38('0x3'));var rs=require(_0x6f38('0x4'));var fs=require('fs');var Redis=require(_0x6f38('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6f38('0x6'))('rpc');var config=require(_0x6f38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f38('0x8')][_0x6f38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ba733,_0x1a7c5a,_0x3816f8){return new BPromise(function(_0x48d4aa,_0x14c093){return client[_0x6f38('0xa')](_0x3ba733,_0x3816f8)['then'](function(_0x23c404){logger[_0x6f38('0xb')](_0x6f38('0xc'),_0x1a7c5a,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1a7c5a,_0x6f38('0xd'),JSON[_0x6f38('0xe')](_0x23c404));if(_0x23c404[_0x6f38('0xf')]){if(_0x23c404['error'][_0x6f38('0x10')]===0x1f4){logger['error'](_0x6f38('0xc'),_0x1a7c5a,_0x23c404[_0x6f38('0xf')][_0x6f38('0x11')]);return _0x14c093(_0x23c404[_0x6f38('0xf')][_0x6f38('0x11')]);}logger[_0x6f38('0xf')](_0x6f38('0xc'),_0x1a7c5a,_0x23c404[_0x6f38('0xf')][_0x6f38('0x11')]);return _0x48d4aa(_0x23c404[_0x6f38('0xf')][_0x6f38('0x11')]);}else{logger[_0x6f38('0xb')](_0x6f38('0xc'),_0x1a7c5a,_0x6f38('0xd'));_0x48d4aa(_0x23c404[_0x6f38('0x12')][_0x6f38('0x11')]);}})[_0x6f38('0x13')](function(_0x461ab5){logger['error'](_0x6f38('0xc'),_0x1a7c5a,_0x461ab5);_0x14c093(_0x461ab5);});});}exports[_0x6f38('0x14')]=function(_0x317aea){var _0x400ed6=this;return new Promise(function(_0x326a94,_0x1f5c77){return db[_0x6f38('0x15')][_0x6f38('0x16')]({'raw':_0x317aea['options']?_0x317aea[_0x6f38('0x17')][_0x6f38('0x18')]===undefined?!![]:![]:!![],'where':_0x317aea['options']?_0x317aea['options']['where']||null:null,'attributes':_0x317aea['options']?_0x317aea[_0x6f38('0x17')][_0x6f38('0x19')]||null:null,'limit':_0x317aea['options']?_0x317aea[_0x6f38('0x17')][_0x6f38('0x1a')]||null:null,'include':_0x317aea[_0x6f38('0x17')]?_0x317aea[_0x6f38('0x17')][_0x6f38('0x1b')]?_['map'](_0x317aea[_0x6f38('0x17')][_0x6f38('0x1b')],function(_0x322fb3){return{'model':db[_0x322fb3[_0x6f38('0x1c')]],'as':_0x322fb3['as'],'attributes':_0x322fb3[_0x6f38('0x19')],'include':_0x322fb3[_0x6f38('0x1b')]?_[_0x6f38('0x1d')](_0x322fb3[_0x6f38('0x1b')],function(_0x5e9fac){return{'model':db[_0x5e9fac[_0x6f38('0x1c')]],'as':_0x5e9fac['as'],'attributes':_0x5e9fac[_0x6f38('0x19')],'include':_0x5e9fac[_0x6f38('0x1b')]?_[_0x6f38('0x1d')](_0x5e9fac[_0x6f38('0x1b')],function(_0x8bd2e1){return{'model':db[_0x8bd2e1[_0x6f38('0x1c')]],'as':_0x8bd2e1['as'],'attributes':_0x8bd2e1[_0x6f38('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f38('0x1e')](function(_0x196707){logger[_0x6f38('0xb')](_0x6f38('0x14'),_0x317aea);logger[_0x6f38('0x1f')](_0x6f38('0x14'),_0x317aea,JSON[_0x6f38('0xe')](_0x196707));_0x326a94(_0x196707);})[_0x6f38('0x13')](function(_0x296e71){logger[_0x6f38('0xf')](_0x6f38('0x14'),_0x296e71[_0x6f38('0x11')],_0x317aea);_0x1f5c77(_0x400ed6[_0x6f38('0xf')](0x1f4,_0x296e71[_0x6f38('0x11')]));});});};exports[_0x6f38('0x20')]=function(_0x554ba0){var _0x25bb60=this;return new Promise(function(_0x5f0295,_0xe54161){return db[_0x6f38('0x15')][_0x6f38('0x21')](_0x554ba0[_0x6f38('0x22')],{'raw':_0x554ba0['options']?_0x554ba0['options']['raw']===undefined?!![]:![]:!![]})[_0x6f38('0x1e')](function(_0x324fe0){logger[_0x6f38('0xb')](_0x6f38('0x20'),_0x554ba0);logger['debug']('CreateVoiceCallReport',_0x554ba0,JSON['stringify'](_0x324fe0));_0x5f0295(_0x324fe0);})[_0x6f38('0x13')](function(_0x2edfa1){logger['error'](_0x6f38('0x20'),_0x2edfa1['message'],_0x554ba0);_0xe54161(_0x25bb60[_0x6f38('0xf')](0x1f4,_0x2edfa1[_0x6f38('0x11')]));});});};exports[_0x6f38('0x23')]=function(_0x22bf4b){var _0x39f01d=this;return new Promise(function(_0x4e8bde,_0x5e127a){return db[_0x6f38('0x15')][_0x6f38('0x24')](_0x22bf4b[_0x6f38('0x22')],{'raw':_0x22bf4b[_0x6f38('0x17')]?_0x22bf4b['options'][_0x6f38('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22bf4b[_0x6f38('0x17')]?_0x22bf4b[_0x6f38('0x17')]['where']||null:null,'attributes':_0x22bf4b[_0x6f38('0x17')]?_0x22bf4b[_0x6f38('0x17')][_0x6f38('0x19')]||null:null,'limit':_0x22bf4b[_0x6f38('0x17')]?_0x22bf4b[_0x6f38('0x17')][_0x6f38('0x1a')]||null:null})[_0x6f38('0x1e')](function(_0x211e8f){logger[_0x6f38('0xb')](_0x6f38('0x23'),_0x22bf4b);logger[_0x6f38('0x1f')]('UpdateVoiceCallReport',_0x22bf4b,JSON[_0x6f38('0xe')](_0x211e8f));_0x4e8bde(_0x211e8f);})[_0x6f38('0x13')](function(_0x4f55aa){logger[_0x6f38('0xf')](_0x6f38('0x23'),_0x4f55aa[_0x6f38('0x11')],_0x22bf4b);_0x5e127a(_0x39f01d[_0x6f38('0xf')](0x1f4,_0x4f55aa[_0x6f38('0x11')]));});});};
\ No newline at end of file
index d40e600..269b110 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e6b=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x536c07,_0x5c4c1a){var _0x5dd8e4=function(_0x44b010){while(--_0x44b010){_0x536c07['push'](_0x536c07['shift']());}};_0x5dd8e4(++_0x5c4c1a);}(_0x0e6b,0x161));var _0xb0e6=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x0e6b[_0x3f4891];return _0x54f2d8;};'use strict';var multer=require(_0xb0e6('0x0'));var util=require(_0xb0e6('0x1'));var path=require(_0xb0e6('0x2'));var timeout=require(_0xb0e6('0x3'));var express=require(_0xb0e6('0x4'));var router=express[_0xb0e6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb0e6('0x6'));var interaction=require(_0xb0e6('0x7'));var config=require(_0xb0e6('0x8'));var controller=require(_0xb0e6('0x9'));router[_0xb0e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xb0e6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0e6('0xc')]);router[_0xb0e6('0xd')]('/',auth[_0xb0e6('0xe')](),controller[_0xb0e6('0xf')]);router[_0xb0e6('0x10')](_0xb0e6('0x11'),auth[_0xb0e6('0xe')](),controller[_0xb0e6('0x12')]);router['delete'](_0xb0e6('0x11'),auth['isAuthenticated'](),controller[_0xb0e6('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0xc394=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','show','create','put','/:id','delete','destroy','multer'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc394,0xc5));var _0x4c39=function(_0x2136bc,_0x36363b){_0x2136bc=_0x2136bc-0x0;var _0x3a50de=_0xc394[_0x2136bc];return _0x3a50de;};'use strict';var multer=require(_0x4c39('0x0'));var util=require(_0x4c39('0x1'));var path=require(_0x4c39('0x2'));var timeout=require(_0x4c39('0x3'));var express=require(_0x4c39('0x4'));var router=express[_0x4c39('0x5')]();var fs_extra=require(_0x4c39('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4c39('0x7'));var config=require(_0x4c39('0x8'));var controller=require(_0x4c39('0x9'));router['get']('/',auth[_0x4c39('0xa')](),controller['index']);router[_0x4c39('0xb')]('/:id',auth[_0x4c39('0xa')](),controller[_0x4c39('0xc')]);router['post']('/',auth[_0x4c39('0xa')](),controller[_0x4c39('0xd')]);router[_0x4c39('0xe')](_0x4c39('0xf'),auth[_0x4c39('0xa')](),controller['update']);router[_0x4c39('0x10')](_0x4c39('0xf'),auth['isAuthenticated'](),controller[_0x4c39('0x11')]);module['exports']=router;
\ No newline at end of file
index 62f2234..04bdfa2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf406=['STRING','name','setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xf406,0x6a));var _0x6f40=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0xf406[_0x2f1ac4];return _0x18e1a5;};'use strict';var Sequelize=require(_0x6f40('0x0'));module[_0x6f40('0x1')]={'name':{'type':Sequelize[_0x6f40('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x6f40('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6f40('0x2')],'set':function(_0x3b594c){this[_0x6f40('0x4')](_0x6f40('0x5'),_0x3b594c?_0x3b594c['join'](''):[]);},'get':function(){return this[_0x6f40('0x6')](_0x6f40('0x5'))?this[_0x6f40('0x6')](_0x6f40('0x5'))[_0x6f40('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6f40('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6f40('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6f40('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x6eb2=['join','getDataValue','split','sequelize','exports','STRING','name','options'];(function(_0x11ed52,_0xe2c31f){var _0xeee5ea=function(_0x4ea7af){while(--_0x4ea7af){_0x11ed52['push'](_0x11ed52['shift']());}};_0xeee5ea(++_0xe2c31f);}(_0x6eb2,0x19b));var _0x26eb=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0x6eb2[_0x58b6c7];return _0x5f50d0;};'use strict';var Sequelize=require(_0x26eb('0x0'));module[_0x26eb('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x26eb('0x2')],'unique':_0x26eb('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x26eb('0x2')],'set':function(_0x4d0a46){this['setDataValue'](_0x26eb('0x4'),_0x4d0a46?_0x4d0a46[_0x26eb('0x5')](''):[]);},'get':function(){return this[_0x26eb('0x6')](_0x26eb('0x4'))?this[_0x26eb('0x6')](_0x26eb('0x4'))[_0x26eb('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x26eb('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x26eb('0x2')]},'description':{'type':Sequelize[_0x26eb('0x2')]}};
\ No newline at end of file
index ad903dc..d28e647 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0834=['catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','params','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','save','then','get','ChanSpies','destroy','end','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','offset','sort','filters','filter','where','VIRTUAL','options','include','findAll','rows'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x0834,0x18e));var _0x4083=function(_0x4de2f6,_0xc8ab81){_0x4de2f6=_0x4de2f6-0x0;var _0x271c41=_0x0834[_0x4de2f6];return _0x271c41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4083('0x0'));var jsonpatch=require(_0x4083('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4083('0x2'));var util=require(_0x4083('0x3'));var path=require('path');var sox=require(_0x4083('0x4'));var csv=require(_0x4083('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4083('0x6'));var _=require('lodash');var squel=require(_0x4083('0x7'));var crypto=require(_0x4083('0x8'));var jsforce=require(_0x4083('0x9'));var deskjs=require(_0x4083('0xa'));var toCsv=require(_0x4083('0x5'));var querystring=require(_0x4083('0xb'));var Papa=require(_0x4083('0xc'));var Redis=require(_0x4083('0xd'));var authService=require(_0x4083('0xe'));var qs=require(_0x4083('0xf'));var as=require(_0x4083('0x10'));var hardwareService=require(_0x4083('0x11'));var logger=require(_0x4083('0x12'))(_0x4083('0x13'));var utils=require(_0x4083('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4083('0x15'))['db'];function respondWithStatusCode(_0x3dfd39,_0x4e6fb2){_0x4e6fb2=_0x4e6fb2||0xcc;return function(_0x2a24ac){if(_0x2a24ac){return _0x3dfd39[_0x4083('0x16')](_0x4e6fb2);}return _0x3dfd39[_0x4083('0x17')](_0x4e6fb2)['end']();};}function respondWithResult(_0x4bef74,_0xb5badb){_0xb5badb=_0xb5badb||0xc8;return function(_0x392f82){if(_0x392f82){return _0x4bef74['status'](_0xb5badb)[_0x4083('0x18')](_0x392f82);}};}function respondWithFilteredResult(_0x316e54,_0xc7c267){return function(_0x146632){if(_0x146632){var _0x38757d=typeof _0xc7c267['offset']===_0x4083('0x19')&&typeof _0xc7c267[_0x4083('0x1a')]===_0x4083('0x19');var _0x2658b0=_0x146632['count'];var _0x4e7d59=_0x38757d?0x0:_0xc7c267['offset'];var _0xafda0c=_0x38757d?_0x146632[_0x4083('0x1b')]:_0xc7c267['offset']+_0xc7c267[_0x4083('0x1a')];var _0x4a16dc;if(_0xafda0c>=_0x2658b0){_0xafda0c=_0x2658b0;_0x4a16dc=0xc8;}else{_0x4a16dc=0xce;}_0x316e54[_0x4083('0x17')](_0x4a16dc);return _0x316e54[_0x4083('0x1c')](_0x4083('0x1d'),_0x4e7d59+'-'+_0xafda0c+'/'+_0x2658b0)[_0x4083('0x18')](_0x146632);}return null;};}function patchUpdates(_0x4b32e9){return function(_0x3b29b1){try{jsonpatch['apply'](_0x3b29b1,_0x4b32e9,!![]);}catch(_0x3d8045){return BPromise[_0x4083('0x1e')](_0x3d8045);}return _0x3b29b1[_0x4083('0x1f')]();};}function saveUpdates(_0x94d72c,_0x5d7461){return function(_0x328efe){if(_0x328efe){return _0x328efe['update'](_0x94d72c)[_0x4083('0x20')](function(_0x3f990d){return _0x3f990d;});}return null;};}function removeEntity(_0x577a80,_0x52a440){return function(_0x3ce623){if(_0x3ce623){return _0x3ce623['destroy']()['then'](function(){var _0x5f034c=_0x3ce623[_0x4083('0x21')]({'plain':!![]});var _0xb2fbb5=_0x4083('0x22');return db['UserProfileResource'][_0x4083('0x23')]({'where':{'type':_0xb2fbb5,'resourceId':_0x5f034c['id']}})[_0x4083('0x20')](function(){return _0x3ce623;});})[_0x4083('0x20')](function(){_0x577a80['status'](0xcc)[_0x4083('0x24')]();});}};}function handleEntityNotFound(_0x323736,_0x5f5679){return function(_0x315458){if(!_0x315458){_0x323736[_0x4083('0x16')](0x194);}return _0x315458;};}function handleError(_0x2daca5,_0xabc8c7){_0xabc8c7=_0xabc8c7||0x1f4;return function(_0xdf4d9e){logger[_0x4083('0x25')](_0xdf4d9e[_0x4083('0x26')]);if(_0xdf4d9e[_0x4083('0x27')]){delete _0xdf4d9e[_0x4083('0x27')];}_0x2daca5['status'](_0xabc8c7)['send'](_0xdf4d9e);};}exports[_0x4083('0x28')]=function(_0x189e4d,_0x2d4dc6){var _0x108453={},_0x2621ff={},_0x191f79={'count':0x0,'rows':[]};var _0x55832a=_[_0x4083('0x29')](db[_0x4083('0x2a')][_0x4083('0x2b')],function(_0x414ac9){return{'name':_0x414ac9[_0x4083('0x2c')],'type':_0x414ac9[_0x4083('0x2d')]['key']};});_0x2621ff[_0x4083('0x2e')]=_[_0x4083('0x29')](_0x55832a,_0x4083('0x27'));_0x2621ff[_0x4083('0x2f')]=_[_0x4083('0x30')](_0x189e4d[_0x4083('0x2f')]);_0x2621ff['filters']=_[_0x4083('0x31')](_0x2621ff['model'],_0x2621ff[_0x4083('0x2f')]);_0x108453[_0x4083('0x32')]=_['intersection'](_0x2621ff[_0x4083('0x2e')],qs[_0x4083('0x33')](_0x189e4d[_0x4083('0x2f')][_0x4083('0x33')]));_0x108453['attributes']=_0x108453['attributes'][_0x4083('0x34')]?_0x108453[_0x4083('0x32')]:_0x2621ff['model'];if(!_0x189e4d[_0x4083('0x2f')]['hasOwnProperty'](_0x4083('0x35'))){_0x108453['limit']=qs['limit'](_0x189e4d['query'][_0x4083('0x1a')]);_0x108453[_0x4083('0x36')]=qs[_0x4083('0x36')](_0x189e4d[_0x4083('0x2f')][_0x4083('0x36')]);}_0x108453['order']=qs['sort'](_0x189e4d[_0x4083('0x2f')][_0x4083('0x37')]);_0x108453['where']=qs[_0x4083('0x38')](_['pick'](_0x189e4d['query'],_0x2621ff['filters']),_0x55832a);if(_0x189e4d[_0x4083('0x2f')][_0x4083('0x39')]){_0x108453[_0x4083('0x3a')]=_['merge'](_0x108453['where'],{'$or':_[_0x4083('0x29')](_0x55832a,function(_0x4bdbee){if(_0x4bdbee[_0x4083('0x2d')]!==_0x4083('0x3b')){var _0x3264ec={};_0x3264ec[_0x4bdbee[_0x4083('0x27')]]={'$like':'%'+_0x189e4d[_0x4083('0x2f')][_0x4083('0x39')]+'%'};return _0x3264ec;}})});}_0x108453=_['merge']({},_0x108453,_0x189e4d[_0x4083('0x3c')]);var _0x1ad1f1={'where':_0x108453['where']};return db['VoiceChanSpy'][_0x4083('0x1b')](_0x1ad1f1)['then'](function(_0x25aded){_0x191f79[_0x4083('0x1b')]=_0x25aded;if(_0x189e4d[_0x4083('0x2f')]['includeAll']){_0x108453[_0x4083('0x3d')]=[{'all':!![]}];}return db[_0x4083('0x2a')][_0x4083('0x3e')](_0x108453);})['then'](function(_0x116161){_0x191f79[_0x4083('0x3f')]=_0x116161;return _0x191f79;})[_0x4083('0x20')](respondWithFilteredResult(_0x2d4dc6,_0x108453))[_0x4083('0x40')](handleError(_0x2d4dc6,null));};exports[_0x4083('0x41')]=function(_0x468242,_0x4717d5){var _0x466ab6={'raw':![],'where':{'id':_0x468242['params']['id']}},_0x595a4f={};_0x595a4f[_0x4083('0x2e')]=_[_0x4083('0x30')](db[_0x4083('0x2a')][_0x4083('0x2b')]);_0x595a4f[_0x4083('0x2f')]=_[_0x4083('0x30')](_0x468242[_0x4083('0x2f')]);_0x595a4f['filters']=_[_0x4083('0x31')](_0x595a4f[_0x4083('0x2e')],_0x595a4f[_0x4083('0x2f')]);_0x466ab6[_0x4083('0x32')]=_[_0x4083('0x31')](_0x595a4f['model'],qs[_0x4083('0x33')](_0x468242['query']['fields']));_0x466ab6[_0x4083('0x32')]=_0x466ab6[_0x4083('0x32')][_0x4083('0x34')]?_0x466ab6[_0x4083('0x32')]:_0x595a4f['model'];if(_0x468242[_0x4083('0x2f')]['includeAll']){_0x466ab6[_0x4083('0x3d')]=[{'all':!![]}];}_0x466ab6=_[_0x4083('0x42')]({},_0x466ab6,_0x468242[_0x4083('0x3c')]);return db['VoiceChanSpy'][_0x4083('0x43')](_0x466ab6)[_0x4083('0x20')](handleEntityNotFound(_0x4717d5,null))[_0x4083('0x20')](respondWithResult(_0x4717d5,null))['catch'](handleError(_0x4717d5,null));};exports[_0x4083('0x44')]=function(_0x36b5fd,_0x4776d3){return db[_0x4083('0x2a')][_0x4083('0x44')](_0x36b5fd[_0x4083('0x45')],{})[_0x4083('0x20')](function(_0x56da3e){var _0x607d65=_0x36b5fd[_0x4083('0x46')][_0x4083('0x21')]({'plain':!![]});if(!_0x607d65)throw new Error(_0x4083('0x47'));if(_0x607d65['role']===_0x4083('0x46')){var _0x5bf897=_0x56da3e[_0x4083('0x21')]({'plain':!![]});var _0x2c7e01='ChanSpies';return db[_0x4083('0x48')][_0x4083('0x43')]({'where':{'name':_0x2c7e01,'userProfileId':_0x607d65[_0x4083('0x49')]},'raw':!![]})[_0x4083('0x20')](function(_0x2194ef){if(_0x2194ef&&_0x2194ef[_0x4083('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x5bf897[_0x4083('0x27')],'resourceId':_0x5bf897['id'],'type':_0x2194ef[_0x4083('0x27')],'sectionId':_0x2194ef['id']},{})['then'](function(){return _0x56da3e;});}else{return _0x56da3e;}})[_0x4083('0x40')](function(_0x367e67){logger[_0x4083('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x367e67);throw _0x367e67;});}return _0x56da3e;})[_0x4083('0x20')](respondWithResult(_0x4776d3,0xc9))['catch'](handleError(_0x4776d3,null));};exports[_0x4083('0x4b')]=function(_0x402690,_0x209be3){if(_0x402690[_0x4083('0x45')]['id']){delete _0x402690[_0x4083('0x45')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x402690[_0x4083('0x4c')]['id']}})['then'](handleEntityNotFound(_0x209be3,null))[_0x4083('0x20')](saveUpdates(_0x402690[_0x4083('0x45')],null))['then'](respondWithResult(_0x209be3,null))['catch'](handleError(_0x209be3,null));};exports[_0x4083('0x23')]=function(_0x450dce,_0x2b7ded){return db[_0x4083('0x2a')][_0x4083('0x43')]({'where':{'id':_0x450dce['params']['id']}})[_0x4083('0x20')](handleEntityNotFound(_0x2b7ded,null))['then'](removeEntity(_0x2b7ded,null))[_0x4083('0x40')](handleError(_0x2b7ded,null));};
\ No newline at end of file
+var _0x8128=['filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','get','ChanSpies','then','status','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x71fbb7,_0x7c2055){var _0x192185=function(_0xeef1bd){while(--_0xeef1bd){_0x71fbb7['push'](_0x71fbb7['shift']());}};_0x192185(++_0x7c2055);}(_0x8128,0x1b1));var _0x8812=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8128[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x8812('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8812('0x1'));var rp=require(_0x8812('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8812('0x3'));var util=require(_0x8812('0x4'));var path=require(_0x8812('0x5'));var sox=require('sox');var csv=require(_0x8812('0x6'));var ejs=require(_0x8812('0x7'));var fs=require('fs');var fs_extra=require(_0x8812('0x8'));var _=require(_0x8812('0x9'));var squel=require('squel');var crypto=require(_0x8812('0xa'));var jsforce=require(_0x8812('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8812('0xc'));var Redis=require(_0x8812('0xd'));var authService=require(_0x8812('0xe'));var qs=require(_0x8812('0xf'));var as=require(_0x8812('0x10'));var hardwareService=require(_0x8812('0x11'));var logger=require(_0x8812('0x12'))(_0x8812('0x13'));var utils=require(_0x8812('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8812('0x15'));var db=require(_0x8812('0x16'))['db'];function respondWithStatusCode(_0x405af2,_0xc68540){_0xc68540=_0xc68540||0xcc;return function(_0x30ab14){if(_0x30ab14){return _0x405af2[_0x8812('0x17')](_0xc68540);}return _0x405af2['status'](_0xc68540)[_0x8812('0x18')]();};}function respondWithResult(_0x43bb44,_0x589fd9){_0x589fd9=_0x589fd9||0xc8;return function(_0x557c5c){if(_0x557c5c){return _0x43bb44['status'](_0x589fd9)[_0x8812('0x19')](_0x557c5c);}};}function respondWithFilteredResult(_0x11f760,_0x554ddb){return function(_0x50f04c){if(_0x50f04c){var _0x554cfa=typeof _0x554ddb['offset']==='undefined'&&typeof _0x554ddb[_0x8812('0x1a')]==='undefined';var _0x15acbe=_0x50f04c['count'];var _0x447f9b=_0x554cfa?0x0:_0x554ddb[_0x8812('0x1b')];var _0x4ae563=_0x554cfa?_0x50f04c[_0x8812('0x1c')]:_0x554ddb[_0x8812('0x1b')]+_0x554ddb[_0x8812('0x1a')];var _0x5096fc;if(_0x4ae563>=_0x15acbe){_0x4ae563=_0x15acbe;_0x5096fc=0xc8;}else{_0x5096fc=0xce;}_0x11f760['status'](_0x5096fc);return _0x11f760[_0x8812('0x1d')](_0x8812('0x1e'),_0x447f9b+'-'+_0x4ae563+'/'+_0x15acbe)[_0x8812('0x19')](_0x50f04c);}return null;};}function patchUpdates(_0x38a2df){return function(_0x423ba1){try{jsonpatch[_0x8812('0x1f')](_0x423ba1,_0x38a2df,!![]);}catch(_0x4be5e9){return BPromise[_0x8812('0x20')](_0x4be5e9);}return _0x423ba1[_0x8812('0x21')]();};}function saveUpdates(_0xa20398,_0x5e2280){return function(_0x22e8bc){if(_0x22e8bc){return _0x22e8bc[_0x8812('0x22')](_0xa20398)['then'](function(_0x392778){return _0x392778;});}return null;};}function removeEntity(_0x545ec7,_0x29572a){return function(_0x16e486){if(_0x16e486){return _0x16e486[_0x8812('0x23')]()['then'](function(){var _0x22fb2d=_0x16e486[_0x8812('0x24')]({'plain':!![]});var _0x115215=_0x8812('0x25');return db['UserProfileResource'][_0x8812('0x23')]({'where':{'type':_0x115215,'resourceId':_0x22fb2d['id']}})[_0x8812('0x26')](function(){return _0x16e486;});})[_0x8812('0x26')](function(){_0x545ec7[_0x8812('0x27')](0xcc)[_0x8812('0x18')]();});}};}function handleEntityNotFound(_0xd33f4b,_0x46f113){return function(_0x117a24){if(!_0x117a24){_0xd33f4b[_0x8812('0x17')](0x194);}return _0x117a24;};}function handleError(_0xdea554,_0x5f150d){_0x5f150d=_0x5f150d||0x1f4;return function(_0x501d4a){logger['error'](_0x501d4a['stack']);if(_0x501d4a[_0x8812('0x28')]){delete _0x501d4a[_0x8812('0x28')];}_0xdea554[_0x8812('0x27')](_0x5f150d)[_0x8812('0x29')](_0x501d4a);};}exports[_0x8812('0x2a')]=function(_0x54bec0,_0x2914f6){var _0xef8778={},_0x2ca077={},_0x288092={'count':0x0,'rows':[]};var _0x502d48=_[_0x8812('0x2b')](db[_0x8812('0x2c')][_0x8812('0x2d')],function(_0x381fbf){return{'name':_0x381fbf[_0x8812('0x2e')],'type':_0x381fbf[_0x8812('0x2f')][_0x8812('0x30')]};});_0x2ca077['model']=_[_0x8812('0x2b')](_0x502d48,_0x8812('0x28'));_0x2ca077[_0x8812('0x31')]=_[_0x8812('0x32')](_0x54bec0['query']);_0x2ca077['filters']=_['intersection'](_0x2ca077[_0x8812('0x33')],_0x2ca077[_0x8812('0x31')]);_0xef8778[_0x8812('0x34')]=_['intersection'](_0x2ca077['model'],qs['fields'](_0x54bec0[_0x8812('0x31')][_0x8812('0x35')]));_0xef8778['attributes']=_0xef8778[_0x8812('0x34')][_0x8812('0x36')]?_0xef8778[_0x8812('0x34')]:_0x2ca077[_0x8812('0x33')];if(!_0x54bec0['query'][_0x8812('0x37')](_0x8812('0x38'))){_0xef8778['limit']=qs['limit'](_0x54bec0[_0x8812('0x31')][_0x8812('0x1a')]);_0xef8778['offset']=qs['offset'](_0x54bec0[_0x8812('0x31')][_0x8812('0x1b')]);}_0xef8778['order']=qs[_0x8812('0x39')](_0x54bec0['query']['sort']);_0xef8778[_0x8812('0x3a')]=qs[_0x8812('0x3b')](_[_0x8812('0x3c')](_0x54bec0['query'],_0x2ca077[_0x8812('0x3b')]),_0x502d48);if(_0x54bec0[_0x8812('0x31')][_0x8812('0x3d')]){_0xef8778['where']=_['merge'](_0xef8778[_0x8812('0x3a')],{'$or':_[_0x8812('0x2b')](_0x502d48,function(_0x19f40e){if(_0x19f40e[_0x8812('0x2f')]!=='VIRTUAL'){var _0x3adca6={};_0x3adca6[_0x19f40e[_0x8812('0x28')]]={'$like':'%'+_0x54bec0[_0x8812('0x31')][_0x8812('0x3d')]+'%'};return _0x3adca6;}})});}_0xef8778=_[_0x8812('0x3e')]({},_0xef8778,_0x54bec0[_0x8812('0x3f')]);var _0x19eb04={'where':_0xef8778[_0x8812('0x3a')]};return db['VoiceChanSpy']['count'](_0x19eb04)[_0x8812('0x26')](function(_0x4dc2b4){_0x288092[_0x8812('0x1c')]=_0x4dc2b4;if(_0x54bec0[_0x8812('0x31')][_0x8812('0x40')]){_0xef8778[_0x8812('0x41')]=[{'all':!![]}];}return db[_0x8812('0x2c')][_0x8812('0x42')](_0xef8778);})['then'](function(_0x3e7bc0){_0x288092['rows']=_0x3e7bc0;return _0x288092;})[_0x8812('0x26')](respondWithFilteredResult(_0x2914f6,_0xef8778))[_0x8812('0x43')](handleError(_0x2914f6,null));};exports[_0x8812('0x44')]=function(_0xdca303,_0x1dc070){var _0x2dc717={'raw':![],'where':{'id':_0xdca303[_0x8812('0x45')]['id']}},_0x3917bb={};_0x3917bb[_0x8812('0x33')]=_[_0x8812('0x32')](db[_0x8812('0x2c')][_0x8812('0x2d')]);_0x3917bb[_0x8812('0x31')]=_['keys'](_0xdca303[_0x8812('0x31')]);_0x3917bb['filters']=_['intersection'](_0x3917bb[_0x8812('0x33')],_0x3917bb[_0x8812('0x31')]);_0x2dc717[_0x8812('0x34')]=_[_0x8812('0x46')](_0x3917bb['model'],qs['fields'](_0xdca303[_0x8812('0x31')][_0x8812('0x35')]));_0x2dc717['attributes']=_0x2dc717[_0x8812('0x34')]['length']?_0x2dc717['attributes']:_0x3917bb['model'];if(_0xdca303[_0x8812('0x31')][_0x8812('0x40')]){_0x2dc717[_0x8812('0x41')]=[{'all':!![]}];}_0x2dc717=_['merge']({},_0x2dc717,_0xdca303[_0x8812('0x3f')]);return db['VoiceChanSpy'][_0x8812('0x47')](_0x2dc717)[_0x8812('0x26')](handleEntityNotFound(_0x1dc070,null))['then'](respondWithResult(_0x1dc070,null))[_0x8812('0x43')](handleError(_0x1dc070,null));};exports[_0x8812('0x48')]=function(_0x2baeda,_0x572304){return db[_0x8812('0x2c')][_0x8812('0x48')](_0x2baeda[_0x8812('0x49')],{})['then'](function(_0x360c0c){var _0x53f712=_0x2baeda[_0x8812('0x4a')][_0x8812('0x24')]({'plain':!![]});if(!_0x53f712)throw new Error(_0x8812('0x4b'));if(_0x53f712[_0x8812('0x4c')]===_0x8812('0x4a')){var _0x4bed02=_0x360c0c[_0x8812('0x24')]({'plain':!![]});var _0x3aae37=_0x8812('0x25');return db[_0x8812('0x4d')]['find']({'where':{'name':_0x3aae37,'userProfileId':_0x53f712[_0x8812('0x4e')]},'raw':!![]})[_0x8812('0x26')](function(_0x34f710){if(_0x34f710&&_0x34f710[_0x8812('0x4f')]===0x0){return db[_0x8812('0x50')]['create']({'name':_0x4bed02[_0x8812('0x28')],'resourceId':_0x4bed02['id'],'type':_0x34f710[_0x8812('0x28')],'sectionId':_0x34f710['id']},{})[_0x8812('0x26')](function(){return _0x360c0c;});}else{return _0x360c0c;}})[_0x8812('0x43')](function(_0x364a0){logger['error'](_0x8812('0x51'),_0x364a0);throw _0x364a0;});}return _0x360c0c;})[_0x8812('0x26')](respondWithResult(_0x572304,0xc9))[_0x8812('0x43')](handleError(_0x572304,null));};exports[_0x8812('0x22')]=function(_0x4f904c,_0x4e0324){if(_0x4f904c[_0x8812('0x49')]['id']){delete _0x4f904c[_0x8812('0x49')]['id'];}return db['VoiceChanSpy'][_0x8812('0x47')]({'where':{'id':_0x4f904c[_0x8812('0x45')]['id']}})[_0x8812('0x26')](handleEntityNotFound(_0x4e0324,null))[_0x8812('0x26')](saveUpdates(_0x4f904c[_0x8812('0x49')],null))[_0x8812('0x26')](respondWithResult(_0x4e0324,null))[_0x8812('0x43')](handleError(_0x4e0324,null));};exports[_0x8812('0x23')]=function(_0x3106e1,_0x4ca570){return db[_0x8812('0x2c')][_0x8812('0x47')]({'where':{'id':_0x3106e1['params']['id']}})[_0x8812('0x26')](handleEntityNotFound(_0x4ca570,null))[_0x8812('0x26')](removeEntity(_0x4ca570,null))['catch'](handleError(_0x4ca570,null));};
\ No newline at end of file
index f201343..66c41d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1d7=['define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','push','Set','CDR(type)=%s','chanspy','record','merge','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','then','catch','models'];(function(_0x859340,_0x44c527){var _0x3f69f8=function(_0x4a9cd5){while(--_0x4a9cd5){_0x859340['push'](_0x859340['shift']());}};_0x3f69f8(++_0x44c527);}(_0xc1d7,0xd1));var _0x7c1d=function(_0x82305a,_0x46a9fb){_0x82305a=_0x82305a-0x0;var _0x5b57e6=_0xc1d7[_0x82305a];return _0x5b57e6;};'use strict';var _=require(_0x7c1d('0x0'));var util=require(_0x7c1d('0x1'));var BPromise=require(_0x7c1d('0x2'));var attributes=require(_0x7c1d('0x3'));var getUserApplications=function(_0xd87b54,_0x43ce30,_0x3b3723){var _0x39039e=0x1;var _0x2911bb=[];var _0x51ad82={'context':_0x43ce30['context']||'from-sip','exten':util[_0x7c1d('0x4')](_0x7c1d('0x5'),_0xd87b54[_0x7c1d('0x6')],_0x3b3723),'type':'system','isApp':![],'ChanSpyId':_0xd87b54['id'],'UserId':_0x43ce30['id']};_0x2911bb[_0x7c1d('0x7')](_['merge']({'app':_0x7c1d('0x8'),'appdata':util['format'](_0x7c1d('0x9'),_0x7c1d('0xa')),'priority':_0x39039e++},_0x51ad82));if(_0xd87b54[_0x7c1d('0xb')]){_0x2911bb['push'](_[_0x7c1d('0xc')]({'app':'MixMonitor','appdata':util[_0x7c1d('0x4')](_0x7c1d('0xd'),_0xd87b54['recordingFormat']),'priority':_0x39039e++},_0x51ad82));}if(_0xd87b54[_0x7c1d('0xe')]){_0x2911bb[_0x7c1d('0x7')](_[_0x7c1d('0xc')]({'app':_0x7c1d('0xf'),'appdata':_0xd87b54[_0x7c1d('0x10')],'priority':_0x39039e++},_0x51ad82));}_0x2911bb[_0x7c1d('0x7')](_[_0x7c1d('0xc')]({'app':_0x7c1d('0x11'),'appdata':util[_0x7c1d('0x4')](_0x7c1d('0x12'),_0x43ce30[_0x7c1d('0x13')],_0xd87b54[_0x7c1d('0x14')]?_0xd87b54[_0x7c1d('0x14')]['join'](''):''),'priority':_0x39039e++},_0x51ad82));if(_0xd87b54[_0x7c1d('0xb')]){_0x2911bb[_0x7c1d('0x7')](_[_0x7c1d('0xc')]({'app':_0x7c1d('0x15'),'priority':_0x39039e++},_0x51ad82));}return _0x2911bb;};var getChanSpyApplications=function(_0x146837,_0x4e00b2){var _0x17762d=[];for(var _0x243e09=0x0,_0x379b26=0x1;_0x243e09<_0x4e00b2[_0x7c1d('0x16')];_0x243e09++,_0x379b26=0x1){_0x17762d=_0x17762d[_0x7c1d('0x17')](getUserApplications(_0x146837,_0x4e00b2[_0x243e09],_0x4e00b2[_0x243e09][_0x7c1d('0x18')]));if(_0x4e00b2[_0x243e09][_0x7c1d('0x18')]!=_0x4e00b2[_0x243e09][_0x7c1d('0x13')]){_0x17762d=_0x17762d[_0x7c1d('0x17')](getUserApplications(_0x146837,_0x4e00b2[_0x243e09],_0x4e00b2[_0x243e09][_0x7c1d('0x13')]));}}return _0x17762d;};var getChanSpyPromise=function(_0xe80ee6,_0x9715e9){return new BPromise(function(_0x44027c,_0x557a03){return _0xe80ee6[_0x7c1d('0x19')]['findAll']({'attributes':['id','name',_0x7c1d('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x7c1d('0x1a')](function(_0xa7220c){if(_0xa7220c){return _0x44027c(getChanSpyApplications(_0x9715e9,_0xa7220c));}return _0x44027c([]);})[_0x7c1d('0x1b')](function(_0x5b3449){_0x557a03(_0x5b3449);});});};module['exports']=function(_0x5b88b5,_0x24f0cb){var _0x512bd2=_0x5b88b5[_0x7c1d('0x1c')];return _0x5b88b5[_0x7c1d('0x1d')]('VoiceChanSpy',attributes,{'tableName':_0x7c1d('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37d56f,_0x19b2f3,_0x35d455){return getChanSpyPromise(_0x512bd2,_0x37d56f)[_0x7c1d('0x1a')](function(_0x2906f9){if(_0x2906f9&&_0x2906f9[_0x7c1d('0x16')]){return _0x512bd2[_0x7c1d('0x1f')][_0x7c1d('0x20')](_0x2906f9);}})['then'](function(){_0x35d455();})[_0x7c1d('0x1b')](function(_0xd297f5){_0x35d455(_0xd297f5);});},'afterUpdate':function(_0x498ac1,_0x5466d5,_0xd6272f){return _0x512bd2[_0x7c1d('0x1f')][_0x7c1d('0x21')]({'where':{'ChanSpyId':_0x498ac1['id']}})[_0x7c1d('0x1a')](function(){return getChanSpyPromise(_0x512bd2,_0x498ac1);})[_0x7c1d('0x1a')](function(_0x2b8192){if(_0x2b8192&&_0x2b8192[_0x7c1d('0x16')]){return _0x512bd2[_0x7c1d('0x1f')]['bulkCreate'](_0x2b8192);}})['then'](function(){_0xd6272f();})[_0x7c1d('0x1b')](function(_0x40b62a){_0xd6272f(_0x40b62a);});},'afterDestroy':function(_0xc332a3,_0x6983a6,_0x252648){return _0x512bd2['VoiceExtension'][_0x7c1d('0x21')]({'where':{'ChanSpyId':_0xc332a3['id']}})[_0x7c1d('0x1a')](function(){_0x252648();})[_0x7c1d('0x1b')](function(_0x4b8bbb){_0x252648(_0x4b8bbb);});}}});};
\ No newline at end of file
+var _0x12df=['findAll','agent','catch','exports','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','Authenticate','SIP/%s,%s','name','options','join','length','concat','internal','User'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x12df,0xbf));var _0xf12d=function(_0x329a3b,_0x26a267){_0x329a3b=_0x329a3b-0x0;var _0x42117d=_0x12df[_0x329a3b];return _0x42117d;};'use strict';var _=require(_0xf12d('0x0'));var util=require(_0xf12d('0x1'));var BPromise=require('bluebird');var attributes=require(_0xf12d('0x2'));var getUserApplications=function(_0x1d72d6,_0xb5816d,_0x583f8f){var _0x4e78d3=0x1;var _0xc02729=[];var _0x36792c={'context':_0xb5816d[_0xf12d('0x3')]||_0xf12d('0x4'),'exten':util[_0xf12d('0x5')](_0xf12d('0x6'),_0x1d72d6['prefix'],_0x583f8f),'type':'system','isApp':![],'ChanSpyId':_0x1d72d6['id'],'UserId':_0xb5816d['id']};_0xc02729[_0xf12d('0x7')](_[_0xf12d('0x8')]({'app':_0xf12d('0x9'),'appdata':util[_0xf12d('0x5')](_0xf12d('0xa'),_0xf12d('0xb')),'priority':_0x4e78d3++},_0x36792c));if(_0x1d72d6[_0xf12d('0xc')]){_0xc02729[_0xf12d('0x7')](_[_0xf12d('0x8')]({'app':_0xf12d('0xd'),'appdata':util[_0xf12d('0x5')]('${UNIQUEID}.%s,a',_0x1d72d6[_0xf12d('0xe')]),'priority':_0x4e78d3++},_0x36792c));}if(_0x1d72d6[_0xf12d('0xf')]){_0xc02729['push'](_['merge']({'app':_0xf12d('0x10'),'appdata':_0x1d72d6['password'],'priority':_0x4e78d3++},_0x36792c));}_0xc02729[_0xf12d('0x7')](_[_0xf12d('0x8')]({'app':'ChanSpy','appdata':util[_0xf12d('0x5')](_0xf12d('0x11'),_0xb5816d[_0xf12d('0x12')],_0x1d72d6[_0xf12d('0x13')]?_0x1d72d6[_0xf12d('0x13')][_0xf12d('0x14')](''):''),'priority':_0x4e78d3++},_0x36792c));if(_0x1d72d6[_0xf12d('0xc')]){_0xc02729['push'](_[_0xf12d('0x8')]({'app':'StopMixMonitor','priority':_0x4e78d3++},_0x36792c));}return _0xc02729;};var getChanSpyApplications=function(_0x7e6364,_0x285c33){var _0x494525=[];for(var _0x782ba4=0x0,_0x4dd1df=0x1;_0x782ba4<_0x285c33[_0xf12d('0x15')];_0x782ba4++,_0x4dd1df=0x1){_0x494525=_0x494525[_0xf12d('0x16')](getUserApplications(_0x7e6364,_0x285c33[_0x782ba4],_0x285c33[_0x782ba4][_0xf12d('0x17')]));if(_0x285c33[_0x782ba4]['internal']!=_0x285c33[_0x782ba4][_0xf12d('0x12')]){_0x494525=_0x494525[_0xf12d('0x16')](getUserApplications(_0x7e6364,_0x285c33[_0x782ba4],_0x285c33[_0x782ba4]['name']));}}return _0x494525;};var getChanSpyPromise=function(_0x4f2dad,_0x5d4217){return new BPromise(function(_0x138221,_0x1d4e2f){return _0x4f2dad[_0xf12d('0x18')][_0xf12d('0x19')]({'attributes':['id','name',_0xf12d('0x17')],'where':{'role':_0xf12d('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x51beea){if(_0x51beea){return _0x138221(getChanSpyApplications(_0x5d4217,_0x51beea));}return _0x138221([]);})[_0xf12d('0x1b')](function(_0x471a74){_0x1d4e2f(_0x471a74);});});};module[_0xf12d('0x1c')]=function(_0x4695f5,_0xc7c6cb){var _0x2361a5=_0x4695f5['models'];return _0x4695f5[_0xf12d('0x1d')](_0xf12d('0x1e'),attributes,{'tableName':_0xf12d('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x6b9a68,_0x19571b,_0x4f7bc8){return getChanSpyPromise(_0x2361a5,_0x6b9a68)[_0xf12d('0x20')](function(_0x1fd9e6){if(_0x1fd9e6&&_0x1fd9e6[_0xf12d('0x15')]){return _0x2361a5[_0xf12d('0x21')][_0xf12d('0x22')](_0x1fd9e6);}})['then'](function(){_0x4f7bc8();})[_0xf12d('0x1b')](function(_0x331862){_0x4f7bc8(_0x331862);});},'afterUpdate':function(_0x3bc44a,_0xd73a9c,_0x5f3af1){return _0x2361a5['VoiceExtension'][_0xf12d('0x23')]({'where':{'ChanSpyId':_0x3bc44a['id']}})[_0xf12d('0x20')](function(){return getChanSpyPromise(_0x2361a5,_0x3bc44a);})[_0xf12d('0x20')](function(_0x1a91e6){if(_0x1a91e6&&_0x1a91e6[_0xf12d('0x15')]){return _0x2361a5['VoiceExtension'][_0xf12d('0x22')](_0x1a91e6);}})['then'](function(){_0x5f3af1();})[_0xf12d('0x1b')](function(_0x19b01c){_0x5f3af1(_0x19b01c);});},'afterDestroy':function(_0x1935a0,_0x50efe7,_0x4606b7){return _0x2361a5[_0xf12d('0x21')]['destroy']({'where':{'ChanSpyId':_0x1935a0['id']}})[_0xf12d('0x20')](function(){_0x4606b7();})[_0xf12d('0x1b')](function(_0x22069c){_0x4606b7(_0x22069c);});}}});};
\ No newline at end of file
index 0a1d40a..95e7ef8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bb0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring'];(function(_0x46affb,_0x5e62dd){var _0x56611d=function(_0x28f2e7){while(--_0x28f2e7){_0x46affb['push'](_0x46affb['shift']());}};_0x56611d(++_0x5e62dd);}(_0x2bb0,0xf3));var _0x02bb=function(_0x279887,_0x5ddee7){_0x279887=_0x279887-0x0;var _0x25a214=_0x2bb0[_0x279887];return _0x25a214;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var moment=require(_0x02bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x02bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02bb('0x4'));var logger=require('../../config/logger')(_0x02bb('0x5'));var config=require(_0x02bb('0x6'));var jayson=require(_0x02bb('0x7'));var client=jayson[_0x02bb('0x8')][_0x02bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16bb7c,_0x440f9c,_0x47d7ae){return new BPromise(function(_0x6d064a,_0x15e425){return client[_0x02bb('0xa')](_0x16bb7c,_0x47d7ae)['then'](function(_0x3d28d5){logger['info'](_0x02bb('0xb'),_0x440f9c,_0x02bb('0xc'));logger['debug'](_0x02bb('0xd'),_0x440f9c,_0x02bb('0xc'),JSON[_0x02bb('0xe')](_0x3d28d5));if(_0x3d28d5['error']){if(_0x3d28d5[_0x02bb('0xf')]['code']===0x1f4){logger[_0x02bb('0xf')](_0x02bb('0xb'),_0x440f9c,_0x3d28d5[_0x02bb('0xf')]['message']);return _0x15e425(_0x3d28d5[_0x02bb('0xf')][_0x02bb('0x10')]);}logger[_0x02bb('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x440f9c,_0x3d28d5[_0x02bb('0xf')]['message']);return _0x6d064a(_0x3d28d5[_0x02bb('0xf')][_0x02bb('0x10')]);}else{logger[_0x02bb('0x11')](_0x02bb('0xb'),_0x440f9c,_0x02bb('0xc'));_0x6d064a(_0x3d28d5[_0x02bb('0x12')]['message']);}})['catch'](function(_0x4711fb){logger[_0x02bb('0xf')](_0x02bb('0xb'),_0x440f9c,_0x4711fb);_0x15e425(_0x4711fb);});});}
\ No newline at end of file
+var _0x4e81=['VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x907a79,_0x4192cc){var _0xf2fc52=function(_0x32ace8){while(--_0x32ace8){_0x907a79['push'](_0x907a79['shift']());}};_0xf2fc52(++_0x4192cc);}(_0x4e81,0x1bc));var _0x14e8=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x4e81[_0x231b2e];return _0x3feb2a;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}
\ No newline at end of file
index 18b536e..e346902 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b67=['isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','/:id','show'];(function(_0x320fa7,_0x45c9a2){var _0xf5281a=function(_0x257f8e){while(--_0x257f8e){_0x320fa7['push'](_0x320fa7['shift']());}};_0xf5281a(++_0x45c9a2);}(_0x4b67,0x1ba));var _0x74b6=function(_0x3f40d5,_0x4a5602){_0x3f40d5=_0x3f40d5-0x0;var _0x55546f=_0x4b67[_0x3f40d5];return _0x55546f;};'use strict';var multer=require(_0x74b6('0x0'));var util=require(_0x74b6('0x1'));var path=require(_0x74b6('0x2'));var timeout=require(_0x74b6('0x3'));var express=require(_0x74b6('0x4'));var router=express[_0x74b6('0x5')]();var fs_extra=require(_0x74b6('0x6'));var auth=require(_0x74b6('0x7'));var interaction=require(_0x74b6('0x8'));var config=require('../../config/environment');var controller=require(_0x74b6('0x9'));router[_0x74b6('0xa')]('/',auth['isAuthenticated'](),controller[_0x74b6('0xb')]);router['get'](_0x74b6('0xc'),auth['isAuthenticated'](),controller[_0x74b6('0xd')]);router['post']('/',auth[_0x74b6('0xe')](),controller[_0x74b6('0xf')]);router['put']('/:id',auth[_0x74b6('0xe')](),controller[_0x74b6('0x10')]);router[_0x74b6('0x11')]('/:id',auth[_0x74b6('0xe')](),controller['destroy']);module[_0x74b6('0x12')]=router;
\ No newline at end of file
+var _0x263f=['update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x263f,0x1f4));var _0xf263=function(_0x21f3c3,_0x42e32c){_0x21f3c3=_0x21f3c3-0x0;var _0x15957=_0x263f[_0x21f3c3];return _0x15957;};'use strict';var multer=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var path=require('path');var timeout=require(_0xf263('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf263('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf263('0x4'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xf263('0x5')]('/',auth[_0xf263('0x6')](),controller['index']);router[_0xf263('0x5')](_0xf263('0x7'),auth[_0xf263('0x6')](),controller[_0xf263('0x8')]);router[_0xf263('0x9')]('/',auth[_0xf263('0x6')](),controller[_0xf263('0xa')]);router[_0xf263('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf263('0xc')]);router[_0xf263('0xd')](_0xf263('0x7'),auth['isAuthenticated'](),controller[_0xf263('0xe')]);module[_0xf263('0xf')]=router;
\ No newline at end of file
index 649cd53..44e5b85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25e3=['exports','STRING','sequelize'];(function(_0x348191,_0xb71b74){var _0x42ccbe=function(_0x4deae3){while(--_0x4deae3){_0x348191['push'](_0x348191['shift']());}};_0x42ccbe(++_0xb71b74);}(_0x25e3,0x7d));var _0x325e=function(_0x88e992,_0x36e0da){_0x88e992=_0x88e992-0x0;var _0x8b10f5=_0x25e3[_0x88e992];return _0x8b10f5;};'use strict';var Sequelize=require(_0x325e('0x0'));module[_0x325e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x325e('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}};
\ No newline at end of file
+var _0xa67c=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xa67c,0x179));var _0xca67=function(_0x1076d3,_0x3103b7){_0x1076d3=_0x1076d3-0x0;var _0x5c7a59=_0xa67c[_0x1076d3];return _0x5c7a59;};'use strict';var Sequelize=require(_0xca67('0x0'));module[_0xca67('0x1')]={'name':{'type':Sequelize[_0xca67('0x2')],'unique':_0xca67('0x3')},'description':{'type':Sequelize[_0xca67('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xca67('0x4')],'defaultValue':0x0}};
\ No newline at end of file
index 3dd5f5c..400387b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa4f=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','end','json','offset','undefined','limit','count','status','set','reject','update','destroy','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','includeAll','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','writeFileSync','Reload','user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','eml-format'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xfa4f,0x1e4));var _0xffa4=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xfa4f[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xffa4('0x0'));var rimraf=require(_0xffa4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffa4('0x2'));var rp=require(_0xffa4('0x3'));var moment=require(_0xffa4('0x4'));var BPromise=require(_0xffa4('0x5'));var Mustache=require(_0xffa4('0x6'));var util=require(_0xffa4('0x7'));var path=require(_0xffa4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xffa4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffa4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xffa4('0xb'));var toCsv=require('to-csv');var querystring=require(_0xffa4('0xc'));var Papa=require('papaparse');var Redis=require(_0xffa4('0xd'));var authService=require(_0xffa4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xffa4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffa4('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xffa4('0x11'));var db=require(_0xffa4('0x12'))['db'];var jayson=require(_0xffa4('0x13'));var client=jayson[_0xffa4('0x14')][_0xffa4('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x537b29,_0x52ffa4,_0x2be01f,_0x371dac){return new BPromise(function(_0x4acb07,_0x4ad372){var _0x14c3db=_0x371dac||client;return _0x14c3db[_0xffa4('0x16')](_0x537b29,_0x2be01f)[_0xffa4('0x17')](function(_0xd6dae4){logger[_0xffa4('0x18')]('VoiceContext,\x20%s,\x20%s',_0x52ffa4,_0xffa4('0x19'));logger['debug'](_0xffa4('0x1a'),_0x52ffa4,_0xffa4('0x19'),JSON[_0xffa4('0x1b')](_0xd6dae4));if(_0xd6dae4[_0xffa4('0x1c')]){if(_0xd6dae4[_0xffa4('0x1c')][_0xffa4('0x1d')]===0x1f4){logger[_0xffa4('0x1c')](_0xffa4('0x1e'),_0x52ffa4,_0xd6dae4[_0xffa4('0x1c')]['message']);return _0x4ad372(_0xd6dae4[_0xffa4('0x1c')][_0xffa4('0x1f')]);}logger[_0xffa4('0x1c')](_0xffa4('0x1e'),_0x52ffa4,_0xd6dae4['error'][_0xffa4('0x1f')]);return _0x4acb07(_0xd6dae4['error'][_0xffa4('0x1f')]);}else{logger[_0xffa4('0x18')](_0xffa4('0x1e'),_0x52ffa4,_0xffa4('0x19'));_0x4acb07(_0xd6dae4[_0xffa4('0x20')][_0xffa4('0x1f')]);}})[_0xffa4('0x21')](function(_0x39760e){logger[_0xffa4('0x1c')](_0xffa4('0x1e'),_0x52ffa4,_0x39760e);_0x4ad372(_0x39760e);});});}function respondWithStatusCode(_0x314c50,_0x12476e){_0x12476e=_0x12476e||0xcc;return function(_0x33a9c2){if(_0x33a9c2){return _0x314c50['sendStatus'](_0x12476e);}return _0x314c50['status'](_0x12476e)[_0xffa4('0x22')]();};}function respondWithResult(_0x3d9439,_0x5859f1){_0x5859f1=_0x5859f1||0xc8;return function(_0x24a36f){if(_0x24a36f){return _0x3d9439['status'](_0x5859f1)[_0xffa4('0x23')](_0x24a36f);}};}function respondWithFilteredResult(_0x506b6b,_0x31ff16){return function(_0x168444){if(_0x168444){var _0x8a349a=typeof _0x31ff16[_0xffa4('0x24')]===_0xffa4('0x25')&&typeof _0x31ff16[_0xffa4('0x26')]===_0xffa4('0x25');var _0x4f0dee=_0x168444[_0xffa4('0x27')];var _0x28f319=_0x8a349a?0x0:_0x31ff16[_0xffa4('0x24')];var _0x1fbba8=_0x8a349a?_0x168444[_0xffa4('0x27')]:_0x31ff16['offset']+_0x31ff16['limit'];var _0x2bdff7;if(_0x1fbba8>=_0x4f0dee){_0x1fbba8=_0x4f0dee;_0x2bdff7=0xc8;}else{_0x2bdff7=0xce;}_0x506b6b[_0xffa4('0x28')](_0x2bdff7);return _0x506b6b[_0xffa4('0x29')]('Content-Range',_0x28f319+'-'+_0x1fbba8+'/'+_0x4f0dee)[_0xffa4('0x23')](_0x168444);}return null;};}function patchUpdates(_0x4bdf98){return function(_0x1fe468){try{jsonpatch['apply'](_0x1fe468,_0x4bdf98,!![]);}catch(_0x4c21a6){return BPromise[_0xffa4('0x2a')](_0x4c21a6);}return _0x1fe468['save']();};}function saveUpdates(_0x8ea1ab,_0x5c2e2c){return function(_0x2902fa){if(_0x2902fa){return _0x2902fa[_0xffa4('0x2b')](_0x8ea1ab)[_0xffa4('0x17')](function(_0x5039e0){return _0x5039e0;});}return null;};}function removeEntity(_0x24689a,_0x31e5b1){return function(_0x2c3f88){if(_0x2c3f88){return _0x2c3f88[_0xffa4('0x2c')]()[_0xffa4('0x17')](function(){var _0x7eba0a=_0x2c3f88['get']({'plain':!![]});var _0x1d0e19='Contexts';return db[_0xffa4('0x2d')][_0xffa4('0x2c')]({'where':{'type':_0x1d0e19,'resourceId':_0x7eba0a['id']}})[_0xffa4('0x17')](function(){return _0x2c3f88;});})[_0xffa4('0x17')](function(){_0x24689a['status'](0xcc)[_0xffa4('0x22')]();});}};}function handleEntityNotFound(_0x45abb4,_0x1d1a5c){return function(_0x302cd0){if(!_0x302cd0){_0x45abb4['sendStatus'](0x194);}return _0x302cd0;};}function handleError(_0xbc8973,_0x2ebc32){_0x2ebc32=_0x2ebc32||0x1f4;return function(_0x4cdc27){logger[_0xffa4('0x1c')](_0x4cdc27[_0xffa4('0x2e')]);if(_0x4cdc27[_0xffa4('0x2f')]){delete _0x4cdc27[_0xffa4('0x2f')];}_0xbc8973[_0xffa4('0x28')](_0x2ebc32)[_0xffa4('0x30')](_0x4cdc27);};}exports[_0xffa4('0x31')]=function(_0xb7512e,_0x49948d){var _0x1cc5a4={},_0x3321f0={},_0x33b9fa={'count':0x0,'rows':[]};var _0x1f2a19=_[_0xffa4('0x32')](db[_0xffa4('0x33')]['rawAttributes'],function(_0x47dc37){return{'name':_0x47dc37[_0xffa4('0x34')],'type':_0x47dc37[_0xffa4('0x35')]['key']};});_0x3321f0[_0xffa4('0x36')]=_[_0xffa4('0x32')](_0x1f2a19,_0xffa4('0x2f'));_0x3321f0[_0xffa4('0x37')]=_[_0xffa4('0x38')](_0xb7512e[_0xffa4('0x37')]);_0x3321f0[_0xffa4('0x39')]=_[_0xffa4('0x3a')](_0x3321f0[_0xffa4('0x36')],_0x3321f0['query']);_0x1cc5a4[_0xffa4('0x3b')]=_[_0xffa4('0x3a')](_0x3321f0[_0xffa4('0x36')],qs['fields'](_0xb7512e[_0xffa4('0x37')][_0xffa4('0x3c')]));_0x1cc5a4[_0xffa4('0x3b')]=_0x1cc5a4[_0xffa4('0x3b')][_0xffa4('0x3d')]?_0x1cc5a4[_0xffa4('0x3b')]:_0x3321f0[_0xffa4('0x36')];if(!_0xb7512e[_0xffa4('0x37')][_0xffa4('0x3e')](_0xffa4('0x3f'))){_0x1cc5a4[_0xffa4('0x26')]=qs[_0xffa4('0x26')](_0xb7512e[_0xffa4('0x37')][_0xffa4('0x26')]);_0x1cc5a4['offset']=qs[_0xffa4('0x24')](_0xb7512e['query'][_0xffa4('0x24')]);}_0x1cc5a4[_0xffa4('0x40')]=qs['sort'](_0xb7512e[_0xffa4('0x37')][_0xffa4('0x41')]);_0x1cc5a4[_0xffa4('0x42')]=qs['filters'](_['pick'](_0xb7512e[_0xffa4('0x37')],_0x3321f0['filters']),_0x1f2a19);if(_0xb7512e['query'][_0xffa4('0x43')]){_0x1cc5a4[_0xffa4('0x42')]=_[_0xffa4('0x44')](_0x1cc5a4['where'],{'$or':_['map'](_0x1f2a19,function(_0x4e6ffa){if(_0x4e6ffa[_0xffa4('0x35')]!==_0xffa4('0x45')){var _0x463102={};_0x463102[_0x4e6ffa['name']]={'$like':'%'+_0xb7512e[_0xffa4('0x37')][_0xffa4('0x43')]+'%'};return _0x463102;}})});}_0x1cc5a4=_['merge']({},_0x1cc5a4,_0xb7512e[_0xffa4('0x46')]);var _0x23c948={'where':_0x1cc5a4[_0xffa4('0x42')]};return db[_0xffa4('0x33')][_0xffa4('0x27')](_0x23c948)[_0xffa4('0x17')](function(_0x23b993){_0x33b9fa[_0xffa4('0x27')]=_0x23b993;if(_0xb7512e[_0xffa4('0x37')]['includeAll']){_0x1cc5a4[_0xffa4('0x47')]=[{'all':!![]}];}return db[_0xffa4('0x33')][_0xffa4('0x48')](_0x1cc5a4);})['then'](function(_0x386ab7){_0x33b9fa['rows']=_0x386ab7;return _0x33b9fa;})[_0xffa4('0x17')](respondWithFilteredResult(_0x49948d,_0x1cc5a4))[_0xffa4('0x21')](handleError(_0x49948d,null));};exports[_0xffa4('0x49')]=function(_0x3f6c49,_0x54da3e){var _0x2d1c02={'raw':![],'where':{'id':_0x3f6c49[_0xffa4('0x4a')]['id']}},_0x34e3e2={};_0x34e3e2['model']=_['keys'](db[_0xffa4('0x33')][_0xffa4('0x4b')]);_0x34e3e2['query']=_[_0xffa4('0x38')](_0x3f6c49[_0xffa4('0x37')]);_0x34e3e2[_0xffa4('0x39')]=_[_0xffa4('0x3a')](_0x34e3e2[_0xffa4('0x36')],_0x34e3e2[_0xffa4('0x37')]);_0x2d1c02[_0xffa4('0x3b')]=_[_0xffa4('0x3a')](_0x34e3e2[_0xffa4('0x36')],qs[_0xffa4('0x3c')](_0x3f6c49['query'][_0xffa4('0x3c')]));_0x2d1c02['attributes']=_0x2d1c02[_0xffa4('0x3b')][_0xffa4('0x3d')]?_0x2d1c02[_0xffa4('0x3b')]:_0x34e3e2['model'];if(_0x3f6c49['query'][_0xffa4('0x4c')]){_0x2d1c02[_0xffa4('0x47')]=[{'all':!![]}];}_0x2d1c02=_['merge']({},_0x2d1c02,_0x3f6c49['options']);return db[_0xffa4('0x33')][_0xffa4('0x4d')](_0x2d1c02)[_0xffa4('0x17')](handleEntityNotFound(_0x54da3e,null))['then'](respondWithResult(_0x54da3e,null))['catch'](handleError(_0x54da3e,null));};exports['create']=function(_0x36cedc,_0x20b6a7,_0x1844fb){var _0x4454c0;return db[_0xffa4('0x33')][_0xffa4('0x4e')](_0x36cedc[_0xffa4('0x4f')],{'raw':!![]})[_0xffa4('0x17')](function(_0x38c826){_0x4454c0=_0x38c826;return db['VoiceContext'][_0xffa4('0x48')]({'raw':!![]});})[_0xffa4('0x17')](function(_0x42dea1){var _0x48662b=fs[_0xffa4('0x50')](path[_0xffa4('0x51')](config['root'],_0xffa4('0x52')),_0xffa4('0x53'));var _0x1bd36c=ejs['render'](_0x48662b,{'contexts':_0x42dea1||[]});fs[_0xffa4('0x54')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1bd36c);})[_0xffa4('0x17')](function(){return respondWithRpcPromise(_0xffa4('0x55'),'create',{'module':'chan_sip.so'});})[_0xffa4('0x17')](function(){var _0x3fc4de=_0x36cedc[_0xffa4('0x56')]['get']({'plain':!![]});if(!_0x3fc4de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fc4de[_0xffa4('0x57')]===_0xffa4('0x56')){var _0x5db3be=_0x4454c0['get']({'plain':!![]});return db[_0xffa4('0x58')][_0xffa4('0x4d')]({'where':{'name':_0xffa4('0x59'),'userProfileId':_0x3fc4de[_0xffa4('0x5a')]},'raw':!![]})['then'](function(_0x58d084){if(_0x58d084&&_0x58d084[_0xffa4('0x5b')]===0x0){return db[_0xffa4('0x2d')][_0xffa4('0x4e')]({'name':_0x5db3be[_0xffa4('0x2f')],'resourceId':_0x5db3be['id'],'type':_0x58d084[_0xffa4('0x2f')],'sectionId':_0x58d084['id']},{})[_0xffa4('0x17')](function(){return _0x4454c0;});}else{return _0x4454c0;}})['catch'](function(_0x1d3032){logger[_0xffa4('0x1c')](_0xffa4('0x5c'),_0x1d3032);throw _0x1d3032;});}return _0x4454c0;})[_0xffa4('0x17')](respondWithResult(_0x20b6a7,0xc9))['catch'](handleError(_0x20b6a7,null));};exports[_0xffa4('0x2b')]=function(_0x4354b0,_0x14e42f,_0x35734d){var _0x16fa1a;return db[_0xffa4('0x33')]['find']({'where':{'id':_0x4354b0['params']['id']}})['then'](handleEntityNotFound(_0x14e42f,null))[_0xffa4('0x17')](saveUpdates(_0x4354b0[_0xffa4('0x4f')],null))[_0xffa4('0x17')](function(_0x1d8c42){if(_0x1d8c42){_0x16fa1a=_0x1d8c42;return db[_0xffa4('0x33')]['findAll']({'raw':!![]});}})['then'](function(_0x12d62b){var _0x579c33=fs[_0xffa4('0x50')](path[_0xffa4('0x51')](config[_0xffa4('0x5d')],_0xffa4('0x52')),_0xffa4('0x53'));var _0xe97f33=ejs[_0xffa4('0x5e')](_0x579c33,{'contexts':_0x12d62b||[]});fs[_0xffa4('0x54')](_0xffa4('0x5f'),_0xe97f33);})[_0xffa4('0x17')](function(){return respondWithRpcPromise(_0xffa4('0x55'),_0xffa4('0x2b'),{'module':_0xffa4('0x60')});})[_0xffa4('0x17')](function(){return _0x16fa1a;})['then'](respondWithResult(_0x14e42f,null))[_0xffa4('0x21')](handleError(_0x14e42f,null));};exports[_0xffa4('0x2c')]=function(_0x2056a5,_0x3dea00,_0x4e0ec8){var _0x5e8bb1;return db['VoiceContext'][_0xffa4('0x4d')]({'where':{'id':_0x2056a5['params']['id']}})[_0xffa4('0x17')](handleEntityNotFound(_0x3dea00,null))[_0xffa4('0x17')](removeEntity(_0x3dea00,null))['then'](function(){return db[_0xffa4('0x33')][_0xffa4('0x48')]({'raw':!![]});})[_0xffa4('0x17')](function(_0x568f4a){var _0x46bc79=fs[_0xffa4('0x50')](path[_0xffa4('0x51')](config[_0xffa4('0x5d')],'server/files/templates/context.ejs'),'utf8');var _0x2afe4f=ejs[_0xffa4('0x5e')](_0x46bc79,{'contexts':_0x568f4a});fs[_0xffa4('0x54')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2afe4f);return respondWithRpcPromise(_0xffa4('0x55'),_0xffa4('0x2c'),{'module':_0xffa4('0x60')});})[_0xffa4('0x21')](handleError(_0x3dea00,null));};
\ No newline at end of file
+var _0x8572=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','end','offset','limit','count','status','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','intersection','includeAll','find','create','body','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user'];(function(_0x3f37c8,_0x2de1ad){var _0x1c3bc2=function(_0x45caf0){while(--_0x45caf0){_0x3f37c8['push'](_0x3f37c8['shift']());}};_0x1c3bc2(++_0x2de1ad);}(_0x8572,0x142));var _0x2857=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x8572[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0x2857('0x0'));var rimraf=require(_0x2857('0x1'));var zipdir=require(_0x2857('0x2'));var jsonpatch=require(_0x2857('0x3'));var rp=require('request-promise');var moment=require(_0x2857('0x4'));var BPromise=require(_0x2857('0x5'));var Mustache=require(_0x2857('0x6'));var util=require(_0x2857('0x7'));var path=require(_0x2857('0x8'));var sox=require(_0x2857('0x9'));var csv=require(_0x2857('0xa'));var ejs=require(_0x2857('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2857('0xc'));var squel=require(_0x2857('0xd'));var crypto=require(_0x2857('0xe'));var jsforce=require(_0x2857('0xf'));var deskjs=require(_0x2857('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2857('0x11'));var Papa=require(_0x2857('0x12'));var Redis=require('ioredis');var authService=require(_0x2857('0x13'));var qs=require(_0x2857('0x14'));var as=require(_0x2857('0x15'));var hardwareService=require(_0x2857('0x16'));var logger=require(_0x2857('0x17'))(_0x2857('0x18'));var utils=require(_0x2857('0x19'));var config=require(_0x2857('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2857('0x1b'))['db'];var jayson=require(_0x2857('0x1c'));var client=jayson['client'][_0x2857('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5adead,_0x185492,_0x2ad110,_0x4d164a){return new BPromise(function(_0x569b79,_0x4a578f){var _0x520809=_0x4d164a||client;return _0x520809['request'](_0x5adead,_0x2ad110)[_0x2857('0x1e')](function(_0x392748){logger[_0x2857('0x1f')](_0x2857('0x20'),_0x185492,'request\x20sent');logger[_0x2857('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x185492,'request\x20sent',JSON[_0x2857('0x22')](_0x392748));if(_0x392748['error']){if(_0x392748[_0x2857('0x23')]['code']===0x1f4){logger[_0x2857('0x23')](_0x2857('0x20'),_0x185492,_0x392748['error'][_0x2857('0x24')]);return _0x4a578f(_0x392748[_0x2857('0x23')][_0x2857('0x24')]);}logger[_0x2857('0x23')](_0x2857('0x20'),_0x185492,_0x392748[_0x2857('0x23')][_0x2857('0x24')]);return _0x569b79(_0x392748['error'][_0x2857('0x24')]);}else{logger[_0x2857('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x185492,_0x2857('0x25'));_0x569b79(_0x392748[_0x2857('0x26')][_0x2857('0x24')]);}})[_0x2857('0x27')](function(_0x173a7d){logger[_0x2857('0x23')](_0x2857('0x20'),_0x185492,_0x173a7d);_0x4a578f(_0x173a7d);});});}function respondWithStatusCode(_0x16faee,_0x5a9f34){_0x5a9f34=_0x5a9f34||0xcc;return function(_0x478ebf){if(_0x478ebf){return _0x16faee[_0x2857('0x28')](_0x5a9f34);}return _0x16faee['status'](_0x5a9f34)[_0x2857('0x29')]();};}function respondWithResult(_0xc76e0,_0x50a539){_0x50a539=_0x50a539||0xc8;return function(_0x43a924){if(_0x43a924){return _0xc76e0['status'](_0x50a539)['json'](_0x43a924);}};}function respondWithFilteredResult(_0x598fd5,_0x2f97cc){return function(_0x3496c5){if(_0x3496c5){var _0x4476e5=typeof _0x2f97cc[_0x2857('0x2a')]==='undefined'&&typeof _0x2f97cc[_0x2857('0x2b')]==='undefined';var _0xc37226=_0x3496c5[_0x2857('0x2c')];var _0xb548ef=_0x4476e5?0x0:_0x2f97cc[_0x2857('0x2a')];var _0x5033d5=_0x4476e5?_0x3496c5['count']:_0x2f97cc['offset']+_0x2f97cc[_0x2857('0x2b')];var _0x3c60c3;if(_0x5033d5>=_0xc37226){_0x5033d5=_0xc37226;_0x3c60c3=0xc8;}else{_0x3c60c3=0xce;}_0x598fd5[_0x2857('0x2d')](_0x3c60c3);return _0x598fd5[_0x2857('0x2e')]('Content-Range',_0xb548ef+'-'+_0x5033d5+'/'+_0xc37226)['json'](_0x3496c5);}return null;};}function patchUpdates(_0x11ec2b){return function(_0x425d5e){try{jsonpatch[_0x2857('0x2f')](_0x425d5e,_0x11ec2b,!![]);}catch(_0x3bbb2b){return BPromise[_0x2857('0x30')](_0x3bbb2b);}return _0x425d5e[_0x2857('0x31')]();};}function saveUpdates(_0x334baa,_0x2cb66e){return function(_0x2e035b){if(_0x2e035b){return _0x2e035b[_0x2857('0x32')](_0x334baa)[_0x2857('0x1e')](function(_0x4abc0c){return _0x4abc0c;});}return null;};}function removeEntity(_0x5f5c5a,_0x23eb0e){return function(_0x1c84e9){if(_0x1c84e9){return _0x1c84e9[_0x2857('0x33')]()[_0x2857('0x1e')](function(){var _0x2ef982=_0x1c84e9[_0x2857('0x34')]({'plain':!![]});var _0x23e441=_0x2857('0x35');return db[_0x2857('0x36')][_0x2857('0x33')]({'where':{'type':_0x23e441,'resourceId':_0x2ef982['id']}})[_0x2857('0x1e')](function(){return _0x1c84e9;});})[_0x2857('0x1e')](function(){_0x5f5c5a[_0x2857('0x2d')](0xcc)[_0x2857('0x29')]();});}};}function handleEntityNotFound(_0x371d47,_0x56335c){return function(_0x3962f4){if(!_0x3962f4){_0x371d47[_0x2857('0x28')](0x194);}return _0x3962f4;};}function handleError(_0x4434ed,_0x460bc3){_0x460bc3=_0x460bc3||0x1f4;return function(_0x1488ab){logger['error'](_0x1488ab[_0x2857('0x37')]);if(_0x1488ab['name']){delete _0x1488ab[_0x2857('0x38')];}_0x4434ed['status'](_0x460bc3)['send'](_0x1488ab);};}exports['index']=function(_0x3766e6,_0x3c338f){var _0x306668={},_0xc6f8f2={},_0x5d0732={'count':0x0,'rows':[]};var _0x5cce4c=_[_0x2857('0x39')](db[_0x2857('0x3a')][_0x2857('0x3b')],function(_0x27b34a){return{'name':_0x27b34a[_0x2857('0x3c')],'type':_0x27b34a[_0x2857('0x3d')][_0x2857('0x3e')]};});_0xc6f8f2['model']=_['map'](_0x5cce4c,_0x2857('0x38'));_0xc6f8f2[_0x2857('0x3f')]=_[_0x2857('0x40')](_0x3766e6[_0x2857('0x3f')]);_0xc6f8f2[_0x2857('0x41')]=_['intersection'](_0xc6f8f2[_0x2857('0x42')],_0xc6f8f2['query']);_0x306668['attributes']=_['intersection'](_0xc6f8f2['model'],qs[_0x2857('0x43')](_0x3766e6['query'][_0x2857('0x43')]));_0x306668[_0x2857('0x44')]=_0x306668['attributes'][_0x2857('0x45')]?_0x306668[_0x2857('0x44')]:_0xc6f8f2[_0x2857('0x42')];if(!_0x3766e6[_0x2857('0x3f')][_0x2857('0x46')](_0x2857('0x47'))){_0x306668[_0x2857('0x2b')]=qs[_0x2857('0x2b')](_0x3766e6[_0x2857('0x3f')][_0x2857('0x2b')]);_0x306668['offset']=qs[_0x2857('0x2a')](_0x3766e6[_0x2857('0x3f')][_0x2857('0x2a')]);}_0x306668[_0x2857('0x48')]=qs[_0x2857('0x49')](_0x3766e6[_0x2857('0x3f')][_0x2857('0x49')]);_0x306668[_0x2857('0x4a')]=qs[_0x2857('0x41')](_[_0x2857('0x4b')](_0x3766e6[_0x2857('0x3f')],_0xc6f8f2['filters']),_0x5cce4c);if(_0x3766e6[_0x2857('0x3f')][_0x2857('0x4c')]){_0x306668['where']=_['merge'](_0x306668[_0x2857('0x4a')],{'$or':_['map'](_0x5cce4c,function(_0x29c0e6){if(_0x29c0e6['type']!==_0x2857('0x4d')){var _0x3e7b8d={};_0x3e7b8d[_0x29c0e6[_0x2857('0x38')]]={'$like':'%'+_0x3766e6[_0x2857('0x3f')]['filter']+'%'};return _0x3e7b8d;}})});}_0x306668=_[_0x2857('0x4e')]({},_0x306668,_0x3766e6[_0x2857('0x4f')]);var _0x4d19f3={'where':_0x306668[_0x2857('0x4a')]};return db['VoiceContext'][_0x2857('0x2c')](_0x4d19f3)[_0x2857('0x1e')](function(_0x4115ad){_0x5d0732[_0x2857('0x2c')]=_0x4115ad;if(_0x3766e6['query']['includeAll']){_0x306668[_0x2857('0x50')]=[{'all':!![]}];}return db[_0x2857('0x3a')][_0x2857('0x51')](_0x306668);})[_0x2857('0x1e')](function(_0x8175a0){_0x5d0732['rows']=_0x8175a0;return _0x5d0732;})['then'](respondWithFilteredResult(_0x3c338f,_0x306668))[_0x2857('0x27')](handleError(_0x3c338f,null));};exports[_0x2857('0x52')]=function(_0x5c7e81,_0x5dabd6){var _0x3dfb7a={'raw':![],'where':{'id':_0x5c7e81[_0x2857('0x53')]['id']}},_0x2dc0f8={};_0x2dc0f8[_0x2857('0x42')]=_[_0x2857('0x40')](db[_0x2857('0x3a')][_0x2857('0x3b')]);_0x2dc0f8[_0x2857('0x3f')]=_[_0x2857('0x40')](_0x5c7e81[_0x2857('0x3f')]);_0x2dc0f8[_0x2857('0x41')]=_[_0x2857('0x54')](_0x2dc0f8[_0x2857('0x42')],_0x2dc0f8[_0x2857('0x3f')]);_0x3dfb7a[_0x2857('0x44')]=_[_0x2857('0x54')](_0x2dc0f8[_0x2857('0x42')],qs['fields'](_0x5c7e81[_0x2857('0x3f')][_0x2857('0x43')]));_0x3dfb7a[_0x2857('0x44')]=_0x3dfb7a[_0x2857('0x44')][_0x2857('0x45')]?_0x3dfb7a[_0x2857('0x44')]:_0x2dc0f8['model'];if(_0x5c7e81[_0x2857('0x3f')][_0x2857('0x55')]){_0x3dfb7a[_0x2857('0x50')]=[{'all':!![]}];}_0x3dfb7a=_[_0x2857('0x4e')]({},_0x3dfb7a,_0x5c7e81[_0x2857('0x4f')]);return db[_0x2857('0x3a')][_0x2857('0x56')](_0x3dfb7a)[_0x2857('0x1e')](handleEntityNotFound(_0x5dabd6,null))[_0x2857('0x1e')](respondWithResult(_0x5dabd6,null))[_0x2857('0x27')](handleError(_0x5dabd6,null));};exports[_0x2857('0x57')]=function(_0x3393a9,_0x54b6d9,_0x4df36e){var _0x16d192;return db[_0x2857('0x3a')]['create'](_0x3393a9[_0x2857('0x58')],{'raw':!![]})[_0x2857('0x1e')](function(_0x45b94a){_0x16d192=_0x45b94a;return db[_0x2857('0x3a')]['findAll']({'raw':!![]});})[_0x2857('0x1e')](function(_0x195cc0){var _0x3b6d75=fs['readFileSync'](path[_0x2857('0x59')](config[_0x2857('0x5a')],'server/files/templates/context.ejs'),_0x2857('0x5b'));var _0x109145=ejs[_0x2857('0x5c')](_0x3b6d75,{'contexts':_0x195cc0||[]});fs[_0x2857('0x5d')](_0x2857('0x5e'),_0x109145);})[_0x2857('0x1e')](function(){return respondWithRpcPromise(_0x2857('0x5f'),'create',{'module':_0x2857('0x60')});})[_0x2857('0x1e')](function(){var _0x4676b6=_0x3393a9[_0x2857('0x61')]['get']({'plain':!![]});if(!_0x4676b6)throw new Error(_0x2857('0x62'));if(_0x4676b6['role']===_0x2857('0x61')){var _0x35c567=_0x16d192['get']({'plain':!![]});return db[_0x2857('0x63')]['find']({'where':{'name':'Contexts','userProfileId':_0x4676b6[_0x2857('0x64')]},'raw':!![]})[_0x2857('0x1e')](function(_0x38d873){if(_0x38d873&&_0x38d873[_0x2857('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x35c567[_0x2857('0x38')],'resourceId':_0x35c567['id'],'type':_0x38d873[_0x2857('0x38')],'sectionId':_0x38d873['id']},{})[_0x2857('0x1e')](function(){return _0x16d192;});}else{return _0x16d192;}})['catch'](function(_0x290af5){logger[_0x2857('0x23')](_0x2857('0x66'),_0x290af5);throw _0x290af5;});}return _0x16d192;})[_0x2857('0x1e')](respondWithResult(_0x54b6d9,0xc9))[_0x2857('0x27')](handleError(_0x54b6d9,null));};exports[_0x2857('0x32')]=function(_0x4235d9,_0x31b858,_0x279f14){var _0x43b927;return db[_0x2857('0x3a')][_0x2857('0x56')]({'where':{'id':_0x4235d9[_0x2857('0x53')]['id']}})[_0x2857('0x1e')](handleEntityNotFound(_0x31b858,null))[_0x2857('0x1e')](saveUpdates(_0x4235d9[_0x2857('0x58')],null))[_0x2857('0x1e')](function(_0x2ca12c){if(_0x2ca12c){_0x43b927=_0x2ca12c;return db['VoiceContext'][_0x2857('0x51')]({'raw':!![]});}})[_0x2857('0x1e')](function(_0x19c2e0){var _0x23b94b=fs[_0x2857('0x67')](path[_0x2857('0x59')](config[_0x2857('0x5a')],_0x2857('0x68')),_0x2857('0x5b'));var _0x324028=ejs['render'](_0x23b94b,{'contexts':_0x19c2e0||[]});fs[_0x2857('0x5d')](_0x2857('0x5e'),_0x324028);})['then'](function(){return respondWithRpcPromise('Reload',_0x2857('0x32'),{'module':_0x2857('0x60')});})[_0x2857('0x1e')](function(){return _0x43b927;})[_0x2857('0x1e')](respondWithResult(_0x31b858,null))[_0x2857('0x27')](handleError(_0x31b858,null));};exports[_0x2857('0x33')]=function(_0x5dd80e,_0x312efc,_0x4153fe){var _0x224b5f;return db['VoiceContext'][_0x2857('0x56')]({'where':{'id':_0x5dd80e['params']['id']}})[_0x2857('0x1e')](handleEntityNotFound(_0x312efc,null))[_0x2857('0x1e')](removeEntity(_0x312efc,null))['then'](function(){return db[_0x2857('0x3a')][_0x2857('0x51')]({'raw':!![]});})[_0x2857('0x1e')](function(_0x194a79){var _0x3cd7da=fs[_0x2857('0x67')](path[_0x2857('0x59')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x33c099=ejs[_0x2857('0x5c')](_0x3cd7da,{'contexts':_0x194a79});fs[_0x2857('0x5d')](_0x2857('0x5e'),_0x33c099);return respondWithRpcPromise(_0x2857('0x5f'),'destroy',{'module':_0x2857('0x60')});})[_0x2857('0x27')](handleError(_0x312efc,null));};
\ No newline at end of file
index ef76033..1f44faa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab46=['./voiceContext.attributes','exports','define','VoiceContext','api','moment','request-promise','path','rimraf'];(function(_0x8f10f9,_0x44280b){var _0x32b6c1=function(_0x3d6f6a){while(--_0x3d6f6a){_0x8f10f9['push'](_0x8f10f9['shift']());}};_0x32b6c1(++_0x44280b);}(_0xab46,0x190));var _0x6ab4=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xab46[_0x1d0499];return _0x153fb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6ab4('0x0'));var moment=require(_0x6ab4('0x1'));var BPromise=require('bluebird');var rp=require(_0x6ab4('0x2'));var fs=require('fs');var path=require(_0x6ab4('0x3'));var rimraf=require(_0x6ab4('0x4'));var config=require('../../config/environment');var attributes=require(_0x6ab4('0x5'));module[_0x6ab4('0x6')]=function(_0x379870,_0xcc1983){return _0x379870[_0x6ab4('0x7')](_0x6ab4('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa440=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','VoiceContext','voice_contexts'];(function(_0x1fc02d,_0x29427b){var _0xc72c71=function(_0x39bf22){while(--_0x39bf22){_0x1fc02d['push'](_0x1fc02d['shift']());}};_0xc72c71(++_0x29427b);}(_0xa440,0x6e));var _0x0a44=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0xa440[_0x1b8d87];return _0x182b74;};'use strict';var _=require(_0x0a44('0x0'));var util=require(_0x0a44('0x1'));var logger=require('../../config/logger')(_0x0a44('0x2'));var moment=require(_0x0a44('0x3'));var BPromise=require(_0x0a44('0x4'));var rp=require(_0x0a44('0x5'));var fs=require('fs');var path=require(_0x0a44('0x6'));var rimraf=require(_0x0a44('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x0a44('0x8')]=function(_0x2698a7,_0x16a1de){return _0x2698a7['define'](_0x0a44('0x9'),attributes,{'tableName':_0x0a44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 93efad3..5f6599e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa478=['http','then','info','request\x20sent','debug','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xa478,0x136));var _0x8a47=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa478[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VoiceContext,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});}
\ No newline at end of file
+var _0x4e64=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x235983,_0x3e6e7c){var _0x21f20d=function(_0x532bd0){while(--_0x532bd0){_0x235983['push'](_0x235983['shift']());}};_0x21f20d(++_0x3e6e7c);}(_0x4e64,0x165));var _0x44e6=function(_0x16db18,_0x43fd3f){_0x16db18=_0x16db18-0x0;var _0x48cc3a=_0x4e64[_0x16db18];return _0x48cc3a;};'use strict';var _=require(_0x44e6('0x0'));var util=require('util');var moment=require(_0x44e6('0x1'));var BPromise=require(_0x44e6('0x2'));var rs=require(_0x44e6('0x3'));var fs=require('fs');var Redis=require(_0x44e6('0x4'));var db=require(_0x44e6('0x5'))['db'];var utils=require(_0x44e6('0x6'));var logger=require(_0x44e6('0x7'))('rpc');var config=require(_0x44e6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x44e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f956a,_0x5c6460,_0x3e489f){return new BPromise(function(_0x4ff58e,_0x27669c){return client[_0x44e6('0xa')](_0x2f956a,_0x3e489f)[_0x44e6('0xb')](function(_0x1a9d61){logger[_0x44e6('0xc')](_0x44e6('0xd'),_0x5c6460,_0x44e6('0xe'));logger[_0x44e6('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5c6460,_0x44e6('0xe'),JSON[_0x44e6('0x10')](_0x1a9d61));if(_0x1a9d61[_0x44e6('0x11')]){if(_0x1a9d61[_0x44e6('0x11')][_0x44e6('0x12')]===0x1f4){logger['error'](_0x44e6('0xd'),_0x5c6460,_0x1a9d61[_0x44e6('0x11')][_0x44e6('0x13')]);return _0x27669c(_0x1a9d61[_0x44e6('0x11')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x5c6460,_0x1a9d61[_0x44e6('0x11')][_0x44e6('0x13')]);return _0x4ff58e(_0x1a9d61[_0x44e6('0x11')][_0x44e6('0x13')]);}else{logger['info'](_0x44e6('0xd'),_0x5c6460,_0x44e6('0xe'));_0x4ff58e(_0x1a9d61[_0x44e6('0x14')][_0x44e6('0x13')]);}})[_0x44e6('0x15')](function(_0xed1d89){logger[_0x44e6('0x11')](_0x44e6('0xd'),_0x5c6460,_0xed1d89);_0x27669c(_0xed1d89);});});}
\ No newline at end of file
index 49b3b77..0409a6b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5e6=['get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x246f11,_0x4198fe){var _0x340053=function(_0x43f720){while(--_0x43f720){_0x246f11['push'](_0x246f11['shift']());}};_0x340053(++_0x4198fe);}(_0xc5e6,0x83));var _0x6c5e=function(_0x65d13d,_0x49e929){_0x65d13d=_0x65d13d-0x0;var _0x309bb3=_0xc5e6[_0x65d13d];return _0x309bb3;};'use strict';var multer=require(_0x6c5e('0x0'));var util=require(_0x6c5e('0x1'));var path=require(_0x6c5e('0x2'));var timeout=require(_0x6c5e('0x3'));var express=require(_0x6c5e('0x4'));var router=express[_0x6c5e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c5e('0x6'));var config=require(_0x6c5e('0x7'));var controller=require(_0x6c5e('0x8'));router[_0x6c5e('0x9')]('/',auth['isAuthenticated'](),controller[_0x6c5e('0xa')]);router[_0x6c5e('0x9')](_0x6c5e('0xb'),auth[_0x6c5e('0xc')](),controller[_0x6c5e('0xd')]);router['get'](_0x6c5e('0xe'),auth[_0x6c5e('0xc')](),controller[_0x6c5e('0xf')]);router[_0x6c5e('0x10')]('/',auth[_0x6c5e('0xc')](),controller['create']);router[_0x6c5e('0x11')]('/:id',auth[_0x6c5e('0xc')](),controller[_0x6c5e('0x12')]);router['delete'](_0x6c5e('0xe'),auth[_0x6c5e('0xc')](),controller['destroy']);module[_0x6c5e('0x13')]=router;
\ No newline at end of file
+var _0x8f1f=['post','create','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x2f935a,_0x271a26){var _0x5c67f7=function(_0x42de2b){while(--_0x42de2b){_0x2f935a['push'](_0x2f935a['shift']());}};_0x5c67f7(++_0x271a26);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x494452,_0x5b9635){_0x494452=_0x494452-0x0;var _0x456e08=_0x8f1f[_0x494452];return _0x456e08;};'use strict';var multer=require(_0xf8f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf8f1('0x1'));var express=require(_0xf8f1('0x2'));var router=express[_0xf8f1('0x3')]();var fs_extra=require(_0xf8f1('0x4'));var auth=require(_0xf8f1('0x5'));var interaction=require(_0xf8f1('0x6'));var config=require(_0xf8f1('0x7'));var controller=require(_0xf8f1('0x8'));router['get']('/',auth[_0xf8f1('0x9')](),controller[_0xf8f1('0xa')]);router[_0xf8f1('0xb')](_0xf8f1('0xc'),auth[_0xf8f1('0x9')](),controller['describe']);router[_0xf8f1('0xb')](_0xf8f1('0xd'),auth[_0xf8f1('0x9')](),controller[_0xf8f1('0xe')]);router[_0xf8f1('0xf')]('/',auth[_0xf8f1('0x9')](),controller[_0xf8f1('0x10')]);router['put'](_0xf8f1('0xd'),auth[_0xf8f1('0x9')](),controller[_0xf8f1('0x11')]);router[_0xf8f1('0x12')](_0xf8f1('0xd'),auth[_0xf8f1('0x9')](),controller['destroy']);module[_0xf8f1('0x13')]=router;
\ No newline at end of file
index 39b65f6..a27dadc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x54ef,0x112));var _0xf54e=function(_0x20b516,_0x5ce54d){_0x20b516=_0x20b516-0x0;var _0x372769=_0x54ef[_0x20b516];return _0x372769;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}};
\ No newline at end of file
+var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x55add2,_0xb0bc42){var _0x3b2322=function(_0x2ca281){while(--_0x2ca281){_0x55add2['push'](_0x55add2['shift']());}};_0x3b2322(++_0xb0bc42);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0xedd9[_0x4d093a];return _0x5d7227;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}};
\ No newline at end of file
index b8e74e2..f45efd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b2f=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','VoiceDialReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x27a46c,_0x32d860){var _0x1b1ac8=function(_0x2cac51){while(--_0x2cac51){_0x27a46c['push'](_0x27a46c['shift']());}};_0x1b1ac8(++_0x32d860);}(_0x3b2f,0xcb));var _0xf3b2=function(_0x1e1059,_0x406e2f){_0x1e1059=_0x1e1059-0x0;var _0x5e39cd=_0x3b2f[_0x1e1059];return _0x5e39cd;};'use strict';var emlformat=require(_0xf3b2('0x0'));var rimraf=require(_0xf3b2('0x1'));var zipdir=require(_0xf3b2('0x2'));var jsonpatch=require(_0xf3b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf3b2('0x4'));var util=require(_0xf3b2('0x5'));var path=require(_0xf3b2('0x6'));var sox=require('sox');var csv=require(_0xf3b2('0x7'));var ejs=require(_0xf3b2('0x8'));var fs=require('fs');var fs_extra=require(_0xf3b2('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf3b2('0xa'));var jsforce=require(_0xf3b2('0xb'));var deskjs=require(_0xf3b2('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf3b2('0xd'));var Papa=require('papaparse');var Redis=require(_0xf3b2('0xe'));var authService=require(_0xf3b2('0xf'));var qs=require(_0xf3b2('0x10'));var as=require(_0xf3b2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3b2('0x12'))(_0xf3b2('0x13'));var utils=require(_0xf3b2('0x14'));var config=require(_0xf3b2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3b2('0x16'))['db'];function respondWithStatusCode(_0x553838,_0x139731){_0x139731=_0x139731||0xcc;return function(_0x1e6d04){if(_0x1e6d04){return _0x553838['sendStatus'](_0x139731);}return _0x553838[_0xf3b2('0x17')](_0x139731)[_0xf3b2('0x18')]();};}function respondWithResult(_0x3ac236,_0x2e5285){_0x2e5285=_0x2e5285||0xc8;return function(_0x196e7a){if(_0x196e7a){return _0x3ac236[_0xf3b2('0x17')](_0x2e5285)['json'](_0x196e7a);}};}function respondWithFilteredResult(_0x20e5b5,_0x58006a){return function(_0x36e37c){if(_0x36e37c){var _0x21fa5e=typeof _0x58006a['offset']==='undefined'&&typeof _0x58006a['limit']===_0xf3b2('0x19');var _0x5b0a3b=_0x36e37c[_0xf3b2('0x1a')];var _0x50f00d=_0x21fa5e?0x0:_0x58006a[_0xf3b2('0x1b')];var _0x5729c1=_0x21fa5e?_0x36e37c[_0xf3b2('0x1a')]:_0x58006a[_0xf3b2('0x1b')]+_0x58006a['limit'];var _0x363ce1;if(_0x5729c1>=_0x5b0a3b){_0x5729c1=_0x5b0a3b;_0x363ce1=0xc8;}else{_0x363ce1=0xce;}_0x20e5b5[_0xf3b2('0x17')](_0x363ce1);return _0x20e5b5['set'](_0xf3b2('0x1c'),_0x50f00d+'-'+_0x5729c1+'/'+_0x5b0a3b)['json'](_0x36e37c);}return null;};}function patchUpdates(_0x1622aa){return function(_0x46cd53){try{jsonpatch[_0xf3b2('0x1d')](_0x46cd53,_0x1622aa,!![]);}catch(_0x24afb7){return BPromise[_0xf3b2('0x1e')](_0x24afb7);}return _0x46cd53['save']();};}function saveUpdates(_0x4b267f,_0x50e0dd){return function(_0x50feef){if(_0x50feef){return _0x50feef['update'](_0x4b267f)[_0xf3b2('0x1f')](function(_0x542ff7){return _0x542ff7;});}return null;};}function removeEntity(_0x192170,_0x38c49e){return function(_0xe4dbd8){if(_0xe4dbd8){return _0xe4dbd8[_0xf3b2('0x20')]()[_0xf3b2('0x1f')](function(){_0x192170['status'](0xcc)[_0xf3b2('0x18')]();});}};}function handleEntityNotFound(_0x201418,_0x32a794){return function(_0x572166){if(!_0x572166){_0x201418[_0xf3b2('0x21')](0x194);}return _0x572166;};}function handleError(_0x580c83,_0x42a1b6){_0x42a1b6=_0x42a1b6||0x1f4;return function(_0x1c9316){logger[_0xf3b2('0x22')](_0x1c9316[_0xf3b2('0x23')]);if(_0x1c9316[_0xf3b2('0x24')]){delete _0x1c9316[_0xf3b2('0x24')];}_0x580c83[_0xf3b2('0x17')](_0x42a1b6)[_0xf3b2('0x25')](_0x1c9316);};}exports[_0xf3b2('0x26')]=function(_0x32183c,_0x28688e){var _0x110b1a={},_0xed7f7e={},_0x278103={'count':0x0,'rows':[]};var _0x107f1c=_['map'](db[_0xf3b2('0x27')][_0xf3b2('0x28')],function(_0x539f33){return{'name':_0x539f33['fieldName'],'type':_0x539f33[_0xf3b2('0x29')][_0xf3b2('0x2a')]};});_0xed7f7e[_0xf3b2('0x2b')]=_[_0xf3b2('0x2c')](_0x107f1c,_0xf3b2('0x24'));_0xed7f7e[_0xf3b2('0x2d')]=_[_0xf3b2('0x2e')](_0x32183c[_0xf3b2('0x2d')]);_0xed7f7e[_0xf3b2('0x2f')]=_[_0xf3b2('0x30')](_0xed7f7e[_0xf3b2('0x2b')],_0xed7f7e['query']);_0x110b1a[_0xf3b2('0x31')]=_['intersection'](_0xed7f7e['model'],qs[_0xf3b2('0x32')](_0x32183c[_0xf3b2('0x2d')][_0xf3b2('0x32')]));_0x110b1a[_0xf3b2('0x31')]=_0x110b1a[_0xf3b2('0x31')]['length']?_0x110b1a[_0xf3b2('0x31')]:_0xed7f7e[_0xf3b2('0x2b')];if(!_0x32183c[_0xf3b2('0x2d')]['hasOwnProperty'](_0xf3b2('0x33'))){_0x110b1a[_0xf3b2('0x34')]=qs['limit'](_0x32183c[_0xf3b2('0x2d')][_0xf3b2('0x34')]);_0x110b1a['offset']=qs[_0xf3b2('0x1b')](_0x32183c['query'][_0xf3b2('0x1b')]);}_0x110b1a[_0xf3b2('0x35')]=qs[_0xf3b2('0x36')](_0x32183c['query'][_0xf3b2('0x36')]);_0x110b1a[_0xf3b2('0x37')]=qs['filters'](_[_0xf3b2('0x38')](_0x32183c['query'],_0xed7f7e[_0xf3b2('0x2f')]),_0x107f1c);if(_0x32183c[_0xf3b2('0x2d')][_0xf3b2('0x39')]){_0x110b1a['where']=_[_0xf3b2('0x3a')](_0x110b1a[_0xf3b2('0x37')],{'$or':_['map'](_0x107f1c,function(_0x149b5e){if(_0x149b5e[_0xf3b2('0x29')]!==_0xf3b2('0x3b')){var _0x32af93={};_0x32af93[_0x149b5e[_0xf3b2('0x24')]]={'$like':'%'+_0x32183c[_0xf3b2('0x2d')][_0xf3b2('0x39')]+'%'};return _0x32af93;}})});}_0x110b1a=_[_0xf3b2('0x3a')]({},_0x110b1a,_0x32183c[_0xf3b2('0x3c')]);var _0x6afb2f={'where':_0x110b1a[_0xf3b2('0x37')]};return db['VoiceDialReport'][_0xf3b2('0x1a')](_0x6afb2f)[_0xf3b2('0x1f')](function(_0x20966d){_0x278103[_0xf3b2('0x1a')]=_0x20966d;if(_0x32183c[_0xf3b2('0x2d')][_0xf3b2('0x3d')]){_0x110b1a[_0xf3b2('0x3e')]=[{'all':!![]}];}return db[_0xf3b2('0x27')][_0xf3b2('0x3f')](_0x110b1a);})[_0xf3b2('0x1f')](function(_0x1e8fdd){_0x278103[_0xf3b2('0x40')]=_0x1e8fdd;return _0x278103;})[_0xf3b2('0x1f')](respondWithFilteredResult(_0x28688e,_0x110b1a))['catch'](handleError(_0x28688e,null));};exports[_0xf3b2('0x41')]=function(_0x16991e,_0x5ee359){var _0x394c17={'raw':!![],'where':{'id':_0x16991e['params']['id']}},_0x4a71a5={};_0x4a71a5[_0xf3b2('0x2b')]=_[_0xf3b2('0x2e')](db[_0xf3b2('0x27')][_0xf3b2('0x28')]);_0x4a71a5['query']=_[_0xf3b2('0x2e')](_0x16991e[_0xf3b2('0x2d')]);_0x4a71a5[_0xf3b2('0x2f')]=_[_0xf3b2('0x30')](_0x4a71a5['model'],_0x4a71a5[_0xf3b2('0x2d')]);_0x394c17['attributes']=_['intersection'](_0x4a71a5[_0xf3b2('0x2b')],qs['fields'](_0x16991e['query']['fields']));_0x394c17['attributes']=_0x394c17[_0xf3b2('0x31')]['length']?_0x394c17[_0xf3b2('0x31')]:_0x4a71a5[_0xf3b2('0x2b')];if(_0x16991e[_0xf3b2('0x2d')][_0xf3b2('0x3d')]){_0x394c17['include']=[{'all':!![]}];}_0x394c17=_[_0xf3b2('0x3a')]({},_0x394c17,_0x16991e['options']);return db[_0xf3b2('0x27')][_0xf3b2('0x42')](_0x394c17)['then'](handleEntityNotFound(_0x5ee359,null))['then'](respondWithResult(_0x5ee359,null))['catch'](handleError(_0x5ee359,null));};exports[_0xf3b2('0x43')]=function(_0x5c9f80,_0x303285){return db[_0xf3b2('0x27')]['create'](_0x5c9f80['body'],{})[_0xf3b2('0x1f')](respondWithResult(_0x303285,0xc9))[_0xf3b2('0x44')](handleError(_0x303285,null));};exports['update']=function(_0x556823,_0x4737bf){if(_0x556823[_0xf3b2('0x45')]['id']){delete _0x556823[_0xf3b2('0x45')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x556823[_0xf3b2('0x46')]['id']}})[_0xf3b2('0x1f')](handleEntityNotFound(_0x4737bf,null))[_0xf3b2('0x1f')](saveUpdates(_0x556823[_0xf3b2('0x45')],null))[_0xf3b2('0x1f')](respondWithResult(_0x4737bf,null))[_0xf3b2('0x44')](handleError(_0x4737bf,null));};exports['destroy']=function(_0x3447ea,_0x49a844){return db['VoiceDialReport'][_0xf3b2('0x42')]({'where':{'id':_0x3447ea[_0xf3b2('0x46')]['id']}})['then'](handleEntityNotFound(_0x49a844,null))[_0xf3b2('0x1f')](removeEntity(_0x49a844,null))[_0xf3b2('0x44')](handleError(_0x49a844,null));};exports[_0xf3b2('0x47')]=function(_0x3ac530,_0x294ff3){return db['VoiceDialReport'][_0xf3b2('0x47')]()['then'](respondWithResult(_0x294ff3,null))[_0xf3b2('0x44')](handleError(_0x294ff3,null));};
\ No newline at end of file
+var _0x01b7=['fs-extra','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01b7,0x163));var _0x701b=function(_0x4af7e7,_0x512806){_0x4af7e7=_0x4af7e7-0x0;var _0x3a43ab=_0x01b7[_0x4af7e7];return _0x3a43ab;};'use strict';var emlformat=require(_0x701b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x701b('0x1'));var jsonpatch=require(_0x701b('0x2'));var rp=require(_0x701b('0x3'));var moment=require('moment');var BPromise=require(_0x701b('0x4'));var Mustache=require(_0x701b('0x5'));var util=require(_0x701b('0x6'));var path=require(_0x701b('0x7'));var sox=require('sox');var csv=require(_0x701b('0x8'));var ejs=require(_0x701b('0x9'));var fs=require('fs');var fs_extra=require(_0x701b('0xa'));var _=require(_0x701b('0xb'));var squel=require(_0x701b('0xc'));var crypto=require(_0x701b('0xd'));var jsforce=require(_0x701b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x701b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x701b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x701b('0x10'));var logger=require('../../config/logger')(_0x701b('0x11'));var utils=require(_0x701b('0x12'));var config=require(_0x701b('0x13'));var licenseUtil=require(_0x701b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f4fbc,_0x4a32f0){_0x4a32f0=_0x4a32f0||0xcc;return function(_0x257c15){if(_0x257c15){return _0x5f4fbc[_0x701b('0x15')](_0x4a32f0);}return _0x5f4fbc[_0x701b('0x16')](_0x4a32f0)[_0x701b('0x17')]();};}function respondWithResult(_0x16a976,_0x3c3627){_0x3c3627=_0x3c3627||0xc8;return function(_0x4e50e6){if(_0x4e50e6){return _0x16a976[_0x701b('0x16')](_0x3c3627)[_0x701b('0x18')](_0x4e50e6);}};}function respondWithFilteredResult(_0x2ce3ff,_0x2dba70){return function(_0x20c840){if(_0x20c840){var _0x2571ab=typeof _0x2dba70[_0x701b('0x19')]===_0x701b('0x1a')&&typeof _0x2dba70['limit']===_0x701b('0x1a');var _0x19d101=_0x20c840[_0x701b('0x1b')];var _0xd5311b=_0x2571ab?0x0:_0x2dba70[_0x701b('0x19')];var _0x173bfc=_0x2571ab?_0x20c840['count']:_0x2dba70['offset']+_0x2dba70[_0x701b('0x1c')];var _0x58dc71;if(_0x173bfc>=_0x19d101){_0x173bfc=_0x19d101;_0x58dc71=0xc8;}else{_0x58dc71=0xce;}_0x2ce3ff['status'](_0x58dc71);return _0x2ce3ff[_0x701b('0x1d')](_0x701b('0x1e'),_0xd5311b+'-'+_0x173bfc+'/'+_0x19d101)[_0x701b('0x18')](_0x20c840);}return null;};}function patchUpdates(_0x9e88ec){return function(_0x340efd){try{jsonpatch[_0x701b('0x1f')](_0x340efd,_0x9e88ec,!![]);}catch(_0x1c891a){return BPromise[_0x701b('0x20')](_0x1c891a);}return _0x340efd[_0x701b('0x21')]();};}function saveUpdates(_0x28f452,_0x130664){return function(_0x50b92c){if(_0x50b92c){return _0x50b92c[_0x701b('0x22')](_0x28f452)[_0x701b('0x23')](function(_0x206984){return _0x206984;});}return null;};}function removeEntity(_0x36d103,_0x3709e3){return function(_0x166cf8){if(_0x166cf8){return _0x166cf8[_0x701b('0x24')]()[_0x701b('0x23')](function(){_0x36d103[_0x701b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc1f6,_0x39cef1){return function(_0x572c6a){if(!_0x572c6a){_0x4fc1f6[_0x701b('0x15')](0x194);}return _0x572c6a;};}function handleError(_0x14f81d,_0x407ce3){_0x407ce3=_0x407ce3||0x1f4;return function(_0x5886d9){logger[_0x701b('0x25')](_0x5886d9['stack']);if(_0x5886d9[_0x701b('0x26')]){delete _0x5886d9[_0x701b('0x26')];}_0x14f81d[_0x701b('0x16')](_0x407ce3)[_0x701b('0x27')](_0x5886d9);};}exports[_0x701b('0x28')]=function(_0x5b1e27,_0x460c3c){var _0x5273b3={},_0x17426d={},_0x4ab949={'count':0x0,'rows':[]};var _0xa22c13=_['map'](db[_0x701b('0x29')][_0x701b('0x2a')],function(_0x4b88d6){return{'name':_0x4b88d6[_0x701b('0x2b')],'type':_0x4b88d6['type'][_0x701b('0x2c')]};});_0x17426d[_0x701b('0x2d')]=_['map'](_0xa22c13,_0x701b('0x26'));_0x17426d[_0x701b('0x2e')]=_[_0x701b('0x2f')](_0x5b1e27[_0x701b('0x2e')]);_0x17426d[_0x701b('0x30')]=_[_0x701b('0x31')](_0x17426d[_0x701b('0x2d')],_0x17426d[_0x701b('0x2e')]);_0x5273b3[_0x701b('0x32')]=_['intersection'](_0x17426d[_0x701b('0x2d')],qs[_0x701b('0x33')](_0x5b1e27['query'][_0x701b('0x33')]));_0x5273b3[_0x701b('0x32')]=_0x5273b3[_0x701b('0x32')]['length']?_0x5273b3[_0x701b('0x32')]:_0x17426d[_0x701b('0x2d')];if(!_0x5b1e27[_0x701b('0x2e')][_0x701b('0x34')](_0x701b('0x35'))){_0x5273b3[_0x701b('0x1c')]=qs['limit'](_0x5b1e27[_0x701b('0x2e')]['limit']);_0x5273b3[_0x701b('0x19')]=qs[_0x701b('0x19')](_0x5b1e27['query'][_0x701b('0x19')]);}_0x5273b3[_0x701b('0x36')]=qs[_0x701b('0x37')](_0x5b1e27[_0x701b('0x2e')][_0x701b('0x37')]);_0x5273b3[_0x701b('0x38')]=qs[_0x701b('0x30')](_[_0x701b('0x39')](_0x5b1e27['query'],_0x17426d[_0x701b('0x30')]),_0xa22c13);if(_0x5b1e27[_0x701b('0x2e')][_0x701b('0x3a')]){_0x5273b3[_0x701b('0x38')]=_[_0x701b('0x3b')](_0x5273b3[_0x701b('0x38')],{'$or':_[_0x701b('0x3c')](_0xa22c13,function(_0x514a01){if(_0x514a01['type']!==_0x701b('0x3d')){var _0x21233f={};_0x21233f[_0x514a01[_0x701b('0x26')]]={'$like':'%'+_0x5b1e27[_0x701b('0x2e')][_0x701b('0x3a')]+'%'};return _0x21233f;}})});}_0x5273b3=_[_0x701b('0x3b')]({},_0x5273b3,_0x5b1e27[_0x701b('0x3e')]);var _0x495073={'where':_0x5273b3[_0x701b('0x38')]};return db[_0x701b('0x29')][_0x701b('0x1b')](_0x495073)[_0x701b('0x23')](function(_0x376f52){_0x4ab949[_0x701b('0x1b')]=_0x376f52;if(_0x5b1e27[_0x701b('0x2e')][_0x701b('0x3f')]){_0x5273b3['include']=[{'all':!![]}];}return db[_0x701b('0x29')][_0x701b('0x40')](_0x5273b3);})[_0x701b('0x23')](function(_0xe170b9){_0x4ab949[_0x701b('0x41')]=_0xe170b9;return _0x4ab949;})[_0x701b('0x23')](respondWithFilteredResult(_0x460c3c,_0x5273b3))[_0x701b('0x42')](handleError(_0x460c3c,null));};exports[_0x701b('0x43')]=function(_0x30ab2f,_0x260d8e){var _0xf9406={'raw':!![],'where':{'id':_0x30ab2f[_0x701b('0x44')]['id']}},_0x2f9c0a={};_0x2f9c0a[_0x701b('0x2d')]=_[_0x701b('0x2f')](db[_0x701b('0x29')][_0x701b('0x2a')]);_0x2f9c0a[_0x701b('0x2e')]=_[_0x701b('0x2f')](_0x30ab2f[_0x701b('0x2e')]);_0x2f9c0a[_0x701b('0x30')]=_[_0x701b('0x31')](_0x2f9c0a['model'],_0x2f9c0a[_0x701b('0x2e')]);_0xf9406[_0x701b('0x32')]=_['intersection'](_0x2f9c0a['model'],qs[_0x701b('0x33')](_0x30ab2f['query']['fields']));_0xf9406[_0x701b('0x32')]=_0xf9406[_0x701b('0x32')]['length']?_0xf9406[_0x701b('0x32')]:_0x2f9c0a[_0x701b('0x2d')];if(_0x30ab2f[_0x701b('0x2e')]['includeAll']){_0xf9406['include']=[{'all':!![]}];}_0xf9406=_[_0x701b('0x3b')]({},_0xf9406,_0x30ab2f['options']);return db[_0x701b('0x29')]['find'](_0xf9406)['then'](handleEntityNotFound(_0x260d8e,null))[_0x701b('0x23')](respondWithResult(_0x260d8e,null))[_0x701b('0x42')](handleError(_0x260d8e,null));};exports[_0x701b('0x45')]=function(_0x4c4f29,_0x177cfe){return db['VoiceDialReport'][_0x701b('0x45')](_0x4c4f29[_0x701b('0x46')],{})['then'](respondWithResult(_0x177cfe,0xc9))[_0x701b('0x42')](handleError(_0x177cfe,null));};exports[_0x701b('0x22')]=function(_0xdafd1e,_0xfcabf8){if(_0xdafd1e['body']['id']){delete _0xdafd1e['body']['id'];}return db['VoiceDialReport'][_0x701b('0x47')]({'where':{'id':_0xdafd1e[_0x701b('0x44')]['id']}})['then'](handleEntityNotFound(_0xfcabf8,null))[_0x701b('0x23')](saveUpdates(_0xdafd1e[_0x701b('0x46')],null))[_0x701b('0x23')](respondWithResult(_0xfcabf8,null))[_0x701b('0x42')](handleError(_0xfcabf8,null));};exports[_0x701b('0x24')]=function(_0x560eb0,_0x4f73eb){return db[_0x701b('0x29')]['find']({'where':{'id':_0x560eb0[_0x701b('0x44')]['id']}})[_0x701b('0x23')](handleEntityNotFound(_0x4f73eb,null))['then'](removeEntity(_0x4f73eb,null))[_0x701b('0x42')](handleError(_0x4f73eb,null));};exports[_0x701b('0x48')]=function(_0x562a42,_0x4648b9){return db[_0x701b('0x29')][_0x701b('0x48')]()[_0x701b('0x23')](respondWithResult(_0x4648b9,null))[_0x701b('0x42')](handleError(_0x4648b9,null));};
\ No newline at end of file
index 87dd0ee..c297bf5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x93b6=['VoiceDialReport','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x40c5b1,_0x1ee8fb){var _0xadf958=function(_0x2efb71){while(--_0x2efb71){_0x40c5b1['push'](_0x40c5b1['shift']());}};_0xadf958(++_0x1ee8fb);}(_0x93b6,0x151));var _0x693b=function(_0x123776,_0x323fa2){_0x123776=_0x123776-0x0;var _0xd95647=_0x93b6[_0x123776];return _0xd95647;};'use strict';var _=require(_0x693b('0x0'));var util=require(_0x693b('0x1'));var logger=require('../../config/logger')(_0x693b('0x2'));var moment=require(_0x693b('0x3'));var BPromise=require('bluebird');var rp=require(_0x693b('0x4'));var fs=require('fs');var path=require(_0x693b('0x5'));var rimraf=require(_0x693b('0x6'));var config=require(_0x693b('0x7'));var attributes=require(_0x693b('0x8'));module[_0x693b('0x9')]=function(_0x2a3f16,_0x2a2473){return _0x2a3f16[_0x693b('0xa')](_0x693b('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x59ec=['path','rimraf','./voiceDialReport.attributes','exports','define','report_dial','lodash','../../config/logger','api','moment','request-promise'];(function(_0x1e2ff0,_0x2f3e3b){var _0x3324d7=function(_0x43ff4c){while(--_0x43ff4c){_0x1e2ff0['push'](_0x1e2ff0['shift']());}};_0x3324d7(++_0x2f3e3b);}(_0x59ec,0x192));var _0xc59e=function(_0x3120ee,_0x6c2ba6){_0x3120ee=_0x3120ee-0x0;var _0x106f19=_0x59ec[_0x3120ee];return _0x106f19;};'use strict';var _=require(_0xc59e('0x0'));var util=require('util');var logger=require(_0xc59e('0x1'))(_0xc59e('0x2'));var moment=require(_0xc59e('0x3'));var BPromise=require('bluebird');var rp=require(_0xc59e('0x4'));var fs=require('fs');var path=require(_0xc59e('0x5'));var rimraf=require(_0xc59e('0x6'));var config=require('../../config/environment');var attributes=require(_0xc59e('0x7'));module[_0xc59e('0x8')]=function(_0x2de680,_0x20b570){return _0x2de680[_0xc59e('0x9')]('VoiceDialReport',attributes,{'tableName':_0xc59e('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index b659f74..e48b1b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc317=['bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','limit','lodash','util','moment'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xc317,0xd6));var _0x7c31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc317[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7c31('0x0'));var util=require(_0x7c31('0x1'));var moment=require(_0x7c31('0x2'));var BPromise=require(_0x7c31('0x3'));var rs=require(_0x7c31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c31('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c31('0x6'))('rpc');var config=require(_0x7c31('0x7'));var jayson=require(_0x7c31('0x8'));var client=jayson[_0x7c31('0x9')][_0x7c31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1da0b8,_0x4191ad,_0x2c994b){return new BPromise(function(_0x49c341,_0xbd8134){return client[_0x7c31('0xb')](_0x1da0b8,_0x2c994b)['then'](function(_0x4fc15a){logger[_0x7c31('0xc')](_0x7c31('0xd'),_0x4191ad,'request\x20sent');logger[_0x7c31('0xe')](_0x7c31('0xf'),_0x4191ad,_0x7c31('0x10'),JSON[_0x7c31('0x11')](_0x4fc15a));if(_0x4fc15a[_0x7c31('0x12')]){if(_0x4fc15a[_0x7c31('0x12')][_0x7c31('0x13')]===0x1f4){logger['error'](_0x7c31('0xd'),_0x4191ad,_0x4fc15a['error'][_0x7c31('0x14')]);return _0xbd8134(_0x4fc15a['error'][_0x7c31('0x14')]);}logger[_0x7c31('0x12')](_0x7c31('0xd'),_0x4191ad,_0x4fc15a[_0x7c31('0x12')]['message']);return _0x49c341(_0x4fc15a['error']['message']);}else{logger[_0x7c31('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x4191ad,'request\x20sent');_0x49c341(_0x4fc15a[_0x7c31('0x15')][_0x7c31('0x14')]);}})[_0x7c31('0x16')](function(_0x20d9b9){logger[_0x7c31('0x12')](_0x7c31('0xd'),_0x4191ad,_0x20d9b9);_0xbd8134(_0x20d9b9);});});}exports[_0x7c31('0x17')]=function(_0x3c97b9){var _0x1afac8=this;return new Promise(function(_0x5ca96f,_0xb34786){return db[_0x7c31('0x18')]['create'](_0x3c97b9[_0x7c31('0x19')],{'raw':_0x3c97b9[_0x7c31('0x1a')]?_0x3c97b9[_0x7c31('0x1a')][_0x7c31('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3e5dba){logger[_0x7c31('0xc')]('CreateVoiceDialReport',_0x3c97b9);logger[_0x7c31('0xe')](_0x7c31('0x17'),_0x3c97b9,JSON[_0x7c31('0x11')](_0x3e5dba));_0x5ca96f(_0x3e5dba);})[_0x7c31('0x16')](function(_0x127cb7){logger[_0x7c31('0x12')]('CreateVoiceDialReport',_0x127cb7[_0x7c31('0x14')],_0x3c97b9);_0xb34786(_0x1afac8[_0x7c31('0x12')](0x1f4,_0x127cb7['message']));});});};exports[_0x7c31('0x1c')]=function(_0x4874b9){var _0x450b3e=this;return new Promise(function(_0x22c22c,_0x9808a){return db[_0x7c31('0x18')][_0x7c31('0x1d')](_0x4874b9[_0x7c31('0x19')],{'raw':_0x4874b9[_0x7c31('0x1a')]?_0x4874b9[_0x7c31('0x1a')][_0x7c31('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4874b9[_0x7c31('0x1a')]?_0x4874b9[_0x7c31('0x1a')]['where']||null:null,'attributes':_0x4874b9['options']?_0x4874b9[_0x7c31('0x1a')]['attributes']||null:null,'limit':_0x4874b9[_0x7c31('0x1a')]?_0x4874b9[_0x7c31('0x1a')][_0x7c31('0x1e')]||null:null})['then'](function(_0x586ca2){logger[_0x7c31('0xc')](_0x7c31('0x1c'),_0x4874b9);logger['debug'](_0x7c31('0x1c'),_0x4874b9,JSON[_0x7c31('0x11')](_0x586ca2));_0x22c22c(_0x586ca2);})[_0x7c31('0x16')](function(_0x3dba26){logger['error']('UpdateVoiceDialReport',_0x3dba26['message'],_0x4874b9);_0x9808a(_0x450b3e['error'](0x1f4,_0x3dba26[_0x7c31('0x14')]));});});};
\ No newline at end of file
+var _0x878e=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceDialReport','body','options','VoiceDialReport','update','raw','where','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0xaaae09,_0x18b2f7){var _0xadbd0d=function(_0x2cf6a9){while(--_0x2cf6a9){_0xaaae09['push'](_0xaaae09['shift']());}};_0xadbd0d(++_0x18b2f7);}(_0x878e,0x1b6));var _0xe878=function(_0x4c16aa,_0x20af4b){_0x4c16aa=_0x4c16aa-0x0;var _0x475649=_0x878e[_0x4c16aa];return _0x475649;};'use strict';var _=require(_0xe878('0x0'));var util=require(_0xe878('0x1'));var moment=require('moment');var BPromise=require(_0xe878('0x2'));var rs=require(_0xe878('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe878('0x4'))(_0xe878('0x5'));var config=require(_0xe878('0x6'));var jayson=require(_0xe878('0x7'));var client=jayson['client'][_0xe878('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b9a06,_0x58a82,_0x18d971){return new BPromise(function(_0x3a2df6,_0x193fb3){return client[_0xe878('0x9')](_0x5b9a06,_0x18d971)[_0xe878('0xa')](function(_0x2a9daf){logger[_0xe878('0xb')](_0xe878('0xc'),_0x58a82,_0xe878('0xd'));logger[_0xe878('0xe')](_0xe878('0xf'),_0x58a82,_0xe878('0xd'),JSON[_0xe878('0x10')](_0x2a9daf));if(_0x2a9daf['error']){if(_0x2a9daf[_0xe878('0x11')]['code']===0x1f4){logger['error'](_0xe878('0xc'),_0x58a82,_0x2a9daf[_0xe878('0x11')]['message']);return _0x193fb3(_0x2a9daf[_0xe878('0x11')][_0xe878('0x12')]);}logger[_0xe878('0x11')](_0xe878('0xc'),_0x58a82,_0x2a9daf[_0xe878('0x11')][_0xe878('0x12')]);return _0x3a2df6(_0x2a9daf['error'][_0xe878('0x12')]);}else{logger[_0xe878('0xb')](_0xe878('0xc'),_0x58a82,_0xe878('0xd'));_0x3a2df6(_0x2a9daf['result'][_0xe878('0x12')]);}})[_0xe878('0x13')](function(_0x420a71){logger[_0xe878('0x11')](_0xe878('0xc'),_0x58a82,_0x420a71);_0x193fb3(_0x420a71);});});}exports[_0xe878('0x14')]=function(_0x41899f){var _0x280ccd=this;return new Promise(function(_0x4ed8a3,_0x331a79){return db['VoiceDialReport']['create'](_0x41899f[_0xe878('0x15')],{'raw':_0x41899f[_0xe878('0x16')]?_0x41899f[_0xe878('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe878('0xa')](function(_0x406510){logger[_0xe878('0xb')]('CreateVoiceDialReport',_0x41899f);logger[_0xe878('0xe')](_0xe878('0x14'),_0x41899f,JSON[_0xe878('0x10')](_0x406510));_0x4ed8a3(_0x406510);})['catch'](function(_0x2fce49){logger[_0xe878('0x11')]('CreateVoiceDialReport',_0x2fce49['message'],_0x41899f);_0x331a79(_0x280ccd[_0xe878('0x11')](0x1f4,_0x2fce49['message']));});});};exports['UpdateVoiceDialReport']=function(_0x54a5a8){var _0x5035af=this;return new Promise(function(_0x5dfd15,_0xb1520b){return db[_0xe878('0x17')][_0xe878('0x18')](_0x54a5a8[_0xe878('0x15')],{'raw':_0x54a5a8[_0xe878('0x16')]?_0x54a5a8['options'][_0xe878('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a5a8[_0xe878('0x16')]?_0x54a5a8[_0xe878('0x16')][_0xe878('0x1a')]||null:null,'attributes':_0x54a5a8[_0xe878('0x16')]?_0x54a5a8[_0xe878('0x16')][_0xe878('0x1b')]||null:null,'limit':_0x54a5a8['options']?_0x54a5a8['options'][_0xe878('0x1c')]||null:null})[_0xe878('0xa')](function(_0x1e373f){logger[_0xe878('0xb')](_0xe878('0x1d'),_0x54a5a8);logger['debug'](_0xe878('0x1d'),_0x54a5a8,JSON['stringify'](_0x1e373f));_0x5dfd15(_0x1e373f);})[_0xe878('0x13')](function(_0x19ac46){logger['error'](_0xe878('0x1d'),_0x19ac46[_0xe878('0x12')],_0x54a5a8);_0xb1520b(_0x5035af[_0xe878('0x11')](0x1f4,_0x19ac46[_0xe878('0x12')]));});});};
\ No newline at end of file
index 2184f99..a18a84a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb259=['post','create','/:id/applications','addApplications','put','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4f41e2,_0x2e4497){var _0x23327f=function(_0x27dbf8){while(--_0x27dbf8){_0x4f41e2['push'](_0x4f41e2['shift']());}};_0x23327f(++_0x2e4497);}(_0xb259,0xc1));var _0x9b25=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xb259[_0x16dbfd];return _0x382254;};'use strict';var multer=require(_0x9b25('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b25('0x1'));var express=require('express');var router=express[_0x9b25('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9b25('0x3'));var interaction=require(_0x9b25('0x4'));var config=require(_0x9b25('0x5'));var controller=require('./voiceExtension.controller');router[_0x9b25('0x6')]('/',auth[_0x9b25('0x7')](),controller[_0x9b25('0x8')]);router[_0x9b25('0x6')](_0x9b25('0x9'),auth['isAuthenticated'](),controller[_0x9b25('0xa')]);router[_0x9b25('0xb')]('/',auth[_0x9b25('0x7')](),controller[_0x9b25('0xc')]);router[_0x9b25('0xb')](_0x9b25('0xd'),auth[_0x9b25('0x7')](),controller[_0x9b25('0xe')]);router[_0x9b25('0xf')](_0x9b25('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x9b25('0x7')](),controller['destroy']);module[_0x9b25('0x10')]=router;
\ No newline at end of file
+var _0x8d3d=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','delete','multer'];(function(_0x4acefe,_0xa7d40e){var _0x17bf5f=function(_0x10a8a7){while(--_0x10a8a7){_0x4acefe['push'](_0x4acefe['shift']());}};_0x17bf5f(++_0xa7d40e);}(_0x8d3d,0x153));var _0xd8d3=function(_0x29c991,_0x571145){_0x29c991=_0x29c991-0x0;var _0x4eac15=_0x8d3d[_0x29c991];return _0x4eac15;};'use strict';var multer=require(_0xd8d3('0x0'));var util=require(_0xd8d3('0x1'));var path=require(_0xd8d3('0x2'));var timeout=require(_0xd8d3('0x3'));var express=require('express');var router=express[_0xd8d3('0x4')]();var fs_extra=require(_0xd8d3('0x5'));var auth=require(_0xd8d3('0x6'));var interaction=require(_0xd8d3('0x7'));var config=require(_0xd8d3('0x8'));var controller=require(_0xd8d3('0x9'));router[_0xd8d3('0xa')]('/',auth[_0xd8d3('0xb')](),controller['index']);router[_0xd8d3('0xa')](_0xd8d3('0xc'),auth[_0xd8d3('0xb')](),controller[_0xd8d3('0xd')]);router[_0xd8d3('0xe')]('/',auth['isAuthenticated'](),controller[_0xd8d3('0xf')]);router[_0xd8d3('0xe')](_0xd8d3('0x10'),auth[_0xd8d3('0xb')](),controller[_0xd8d3('0x11')]);router[_0xd8d3('0x12')](_0xd8d3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd8d3('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 392bcc4..a2c2544 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x382d=['inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x382d,0xf3));var _0xd382=function(_0x46cbc6,_0x477112){_0x46cbc6=_0x46cbc6-0x0;var _0x335ca5=_0x382d[_0x46cbc6];return _0x335ca5;};'use strict';var Sequelize=require(_0xd382('0x0'));module[_0xd382('0x1')]={'context':{'type':Sequelize[_0xd382('0x2')],'allowNull':![],'unique':_0xd382('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd382('0x2')],'allowNull':![],'unique':_0xd382('0x3')},'priority':{'type':Sequelize[_0xd382('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xd382('0x3')},'tag':{'type':Sequelize[_0xd382('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd382('0x4')},'appdata':{'type':Sequelize[_0xd382('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd382('0x5')](_0xd382('0x6'),_0xd382('0x7'),_0xd382('0x8'),_0xd382('0x9'),'outbound-fax',_0xd382('0xa'),_0xd382('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xd382('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd382('0xc')},'IntervalId':{'type':Sequelize[_0xd382('0xd')]},'isApp':{'type':Sequelize[_0xd382('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd382('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd382('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd382('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd382('0xd')]},'recordingFormat':{'type':Sequelize[_0xd382('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd382('0xf')],'get':function(_0x295bd1){return this[_0xd382('0x10')](_0xd382('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}};
\ No newline at end of file
+var _0x8037=['STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','wav','sequelize','exports'];(function(_0x3c58b6,_0x35a6ae){var _0x5e4de0=function(_0xaae435){while(--_0xaae435){_0x3c58b6['push'](_0x3c58b6['shift']());}};_0x5e4de0(++_0x35a6ae);}(_0x8037,0x12a));var _0x7803=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8037[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7803('0x0'));module[_0x7803('0x1')]={'context':{'type':Sequelize[_0x7803('0x2')],'allowNull':![],'unique':_0x7803('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7803('0x2')],'allowNull':![],'unique':_0x7803('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7803('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x7803('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7803('0x4')](_0x7803('0x5'),_0x7803('0x6'),_0x7803('0x7'),_0x7803('0x8'),_0x7803('0x9'),_0x7803('0xa'),_0x7803('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x7803('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x7803('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x7803('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7803('0xc')]},'recordingFormat':{'type':Sequelize[_0x7803('0x2')],'defaultValue':_0x7803('0xe')},'answer':{'type':Sequelize[_0x7803('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3b2dda){return this['getDataValue']('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}};
\ No newline at end of file
index 24c9b1d..9817f21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b59=['pick','filter','VIRTUAL','merge','options','rows','show','params','includeAll','include','catch','create','body','exten','concat','role','inbound','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','count','offset','set','get','InboundRoutes','outbound','InternalRoutes','internal','ignore','value','includes','type','name','destroy','then','error','stack','send','index','map','VoiceExtension','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','where'];(function(_0x17b0db,_0x4ad022){var _0x43ade3=function(_0x18b216){while(--_0x18b216){_0x17b0db['push'](_0x17b0db['shift']());}};_0x43ade3(++_0x4ad022);}(_0x0b59,0xdd));var _0x90b5=function(_0x1df0f6,_0x40e364){_0x1df0f6=_0x1df0f6-0x0;var _0x30e439=_0x0b59[_0x1df0f6];return _0x30e439;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x90b5('0x0'));var logger=require(_0x90b5('0x1'))('api');var config=require(_0x90b5('0x2'));var db=require('../../mysqldb')['db'];config[_0x90b5('0x3')]=_[_0x90b5('0x4')](config[_0x90b5('0x3')],{'host':_0x90b5('0x5'),'port':0x18eb});var socket=require(_0x90b5('0x6'))(new Redis(config[_0x90b5('0x3')]));require(_0x90b5('0x7'))[_0x90b5('0x8')](socket);function respondWithStatusCode(_0x5b1fd5,_0x56e3e7){_0x56e3e7=_0x56e3e7||0xcc;return function(_0x1613c4){if(_0x1613c4){return _0x5b1fd5[_0x90b5('0x9')](_0x56e3e7);}return _0x5b1fd5[_0x90b5('0xa')](_0x56e3e7)[_0x90b5('0xb')]();};}function respondWithResult(_0x2102a6,_0x1bcfa3){_0x1bcfa3=_0x1bcfa3||0xc8;return function(_0x1eaf02){if(_0x1eaf02){return _0x2102a6[_0x90b5('0xa')](_0x1bcfa3)[_0x90b5('0xc')](_0x1eaf02);}};}function respondWithFilteredResult(_0x4c5fb3,_0x4563c9){return function(_0x404447){if(_0x404447){var _0x8ee381=typeof _0x4563c9['offset']===_0x90b5('0xd')&&typeof _0x4563c9['limit']==='undefined';var _0x2582cd=_0x404447[_0x90b5('0xe')];var _0x57275e=_0x8ee381?0x0:_0x4563c9[_0x90b5('0xf')];var _0x584bf8=_0x8ee381?_0x404447[_0x90b5('0xe')]:_0x4563c9[_0x90b5('0xf')]+_0x4563c9['limit'];var _0x4ee791;if(_0x584bf8>=_0x2582cd){_0x584bf8=_0x2582cd;_0x4ee791=0xc8;}else{_0x4ee791=0xce;}_0x4c5fb3['status'](_0x4ee791);return _0x4c5fb3[_0x90b5('0x10')]('Content-Range',_0x57275e+'-'+_0x584bf8+'/'+_0x2582cd)[_0x90b5('0xc')](_0x404447);}return null;};}function removeEntity(_0x56a63a){return function(_0xb79845){if(_0xb79845){return _0xb79845['destroy']()['then'](function(){var _0x495fec=_0xb79845[_0x90b5('0x11')]({'plain':!![]});var _0x516710=[{'name':_0x90b5('0x12'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x90b5('0x13'),'ignore':![]},{'name':_0x90b5('0x14'),'value':_0x90b5('0x15'),'ignore':![]}];var _0x588b33=_(_0x516710)['filter'](_0x90b5('0x16'))['map'](_0x90b5('0x17'))['value']();if(_[_0x90b5('0x18')](_0x588b33,_0x495fec[_0x90b5('0x19')])){return;}var _0x11832d=_['find'](_0x516710,['value',_0x495fec[_0x90b5('0x19')]])[_0x90b5('0x1a')];return db['UserProfileResource'][_0x90b5('0x1b')]({'where':{'type':_0x11832d,'resourceId':_0x495fec['id']}})[_0x90b5('0x1c')](function(){return _0xb79845;});})[_0x90b5('0x1c')](function(){_0x56a63a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e932){return function(_0x13563e){if(!_0x13563e){_0x21e932['sendStatus'](0x194);}return _0x13563e;};}function handleError(_0x2245b2,_0x28be4d){_0x28be4d=_0x28be4d||0x1f4;return function(_0x5022d8){logger[_0x90b5('0x1d')](_0x5022d8[_0x90b5('0x1e')]);if(_0x5022d8['name']){delete _0x5022d8['name'];}_0x2245b2[_0x90b5('0xa')](_0x28be4d)[_0x90b5('0x1f')](_0x5022d8);};}exports[_0x90b5('0x20')]=function(_0x468b0d,_0x9fb05d){var _0x2ff0b8={},_0x4aec8f={},_0x1e97b6={'count':0x0,'rows':[]};var _0x52487d=_[_0x90b5('0x21')](db[_0x90b5('0x22')][_0x90b5('0x23')],function(_0x4b802b){return{'name':_0x4b802b['fieldName'],'type':_0x4b802b[_0x90b5('0x19')]['key']};});_0x4aec8f['model']=_['map'](_0x52487d,_0x90b5('0x1a'));_0x4aec8f[_0x90b5('0x24')]=_[_0x90b5('0x25')](_0x468b0d[_0x90b5('0x24')]);_0x4aec8f[_0x90b5('0x26')]=_[_0x90b5('0x27')](_0x4aec8f['model'],_0x4aec8f['query']);_0x2ff0b8[_0x90b5('0x28')]=_[_0x90b5('0x27')](_0x4aec8f[_0x90b5('0x29')],qs[_0x90b5('0x2a')](_0x468b0d['query'][_0x90b5('0x2a')]));_0x2ff0b8[_0x90b5('0x28')]=_0x2ff0b8[_0x90b5('0x28')][_0x90b5('0x2b')]?_0x2ff0b8[_0x90b5('0x28')]:_0x4aec8f['model'];if(!_0x468b0d[_0x90b5('0x24')][_0x90b5('0x2c')](_0x90b5('0x2d'))){_0x2ff0b8['limit']=qs[_0x90b5('0x2e')](_0x468b0d[_0x90b5('0x24')]['limit']);_0x2ff0b8[_0x90b5('0xf')]=qs[_0x90b5('0xf')](_0x468b0d[_0x90b5('0x24')][_0x90b5('0xf')]);}_0x2ff0b8[_0x90b5('0x2f')]=qs['sort'](_0x468b0d[_0x90b5('0x24')]['sort']);_0x2ff0b8[_0x90b5('0x30')]=qs['filters'](_[_0x90b5('0x31')](_0x468b0d['query'],_0x4aec8f[_0x90b5('0x26')]),_0x52487d);if(_0x468b0d[_0x90b5('0x24')][_0x90b5('0x32')]){_0x2ff0b8['where']=_['merge'](_0x2ff0b8[_0x90b5('0x30')],{'$or':_[_0x90b5('0x21')](_0x52487d,function(_0x529c82){if(_0x529c82[_0x90b5('0x19')]!==_0x90b5('0x33')){var _0x387383={};_0x387383[_0x529c82['name']]={'$like':'%'+_0x468b0d[_0x90b5('0x24')][_0x90b5('0x32')]+'%'};return _0x387383;}})});}_0x2ff0b8=_[_0x90b5('0x34')]({},_0x2ff0b8,_0x468b0d[_0x90b5('0x35')]);var _0x17c498={'where':_0x2ff0b8[_0x90b5('0x30')]};return db[_0x90b5('0x22')][_0x90b5('0xe')](_0x17c498)[_0x90b5('0x1c')](function(_0xdd5ae9){_0x1e97b6[_0x90b5('0xe')]=_0xdd5ae9;if(_0x468b0d['query']['includeAll']){_0x2ff0b8['include']=[{'all':!![]}];}return db[_0x90b5('0x22')]['findAll'](_0x2ff0b8);})[_0x90b5('0x1c')](function(_0x108eec){_0x1e97b6[_0x90b5('0x36')]=_0x108eec;return _0x1e97b6;})['then'](respondWithFilteredResult(_0x9fb05d,_0x2ff0b8))['catch'](handleError(_0x9fb05d,null));};exports[_0x90b5('0x37')]=function(_0x39ec32,_0x4ee5ba){var _0x4f2932={'raw':![],'where':{'id':_0x39ec32[_0x90b5('0x38')]['id']}},_0x38b06c={};_0x38b06c[_0x90b5('0x29')]=_['keys'](db[_0x90b5('0x22')][_0x90b5('0x23')]);_0x38b06c[_0x90b5('0x24')]=_['keys'](_0x39ec32[_0x90b5('0x24')]);_0x38b06c[_0x90b5('0x26')]=_[_0x90b5('0x27')](_0x38b06c['model'],_0x38b06c[_0x90b5('0x24')]);_0x4f2932['attributes']=_[_0x90b5('0x27')](_0x38b06c[_0x90b5('0x29')],qs[_0x90b5('0x2a')](_0x39ec32['query']['fields']));_0x4f2932[_0x90b5('0x28')]=_0x4f2932[_0x90b5('0x28')]['length']?_0x4f2932[_0x90b5('0x28')]:_0x38b06c[_0x90b5('0x29')];if(_0x39ec32[_0x90b5('0x24')][_0x90b5('0x39')]){_0x4f2932[_0x90b5('0x3a')]=[{'all':!![]}];}_0x4f2932=_[_0x90b5('0x34')]({},_0x4f2932,_0x39ec32[_0x90b5('0x35')]);return db['VoiceExtension']['find'](_0x4f2932)[_0x90b5('0x1c')](handleEntityNotFound(_0x4ee5ba,null))[_0x90b5('0x1c')](respondWithResult(_0x4ee5ba,null))[_0x90b5('0x3b')](handleError(_0x4ee5ba,null));};exports['destroy']=function(_0x23ea35,_0x32c44e){return db['VoiceExtension']['find']({'where':{'id':_0x23ea35['params']['id']}})[_0x90b5('0x1c')](handleEntityNotFound(_0x32c44e,null))[_0x90b5('0x1c')](removeEntity(_0x32c44e,null))[_0x90b5('0x3b')](handleError(_0x32c44e,null));};exports[_0x90b5('0x3c')]=function(_0x1351b3,_0x5b4c1){if(_0x1351b3['body'][_0x90b5('0x19')]===_0x90b5('0x13')&&!_['startsWith'](_0x1351b3[_0x90b5('0x3d')][_0x90b5('0x3e')],'_')){_0x1351b3[_0x90b5('0x3d')][_0x90b5('0x3e')]='_'[_0x90b5('0x3f')](_0x1351b3[_0x90b5('0x3d')][_0x90b5('0x3e')]);}return db[_0x90b5('0x22')]['create'](_0x1351b3['body'],{'raw':![]})['then'](function(_0x38cb4a){var _0x4186b9=_0x1351b3['user'][_0x90b5('0x11')]({'plain':!![]});if(!_0x4186b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4186b9[_0x90b5('0x40')]==='user'){var _0x21a7f2=_0x38cb4a['get']({'plain':!![]});var _0x5f36d9=[{'name':_0x90b5('0x12'),'value':_0x90b5('0x41')},{'name':'OutboundRoutes','value':_0x90b5('0x13')},{'name':_0x90b5('0x14'),'value':_0x90b5('0x15')}];var _0x5be5bd=_['find'](_0x5f36d9,[_0x90b5('0x17'),_0x21a7f2[_0x90b5('0x19')]])[_0x90b5('0x1a')];return db[_0x90b5('0x42')][_0x90b5('0x43')]({'where':{'name':_0x5be5bd,'userProfileId':_0x4186b9[_0x90b5('0x44')]},'raw':!![]})[_0x90b5('0x1c')](function(_0x9f8d5e){if(_0x9f8d5e&&_0x9f8d5e[_0x90b5('0x45')]===0x0){return db[_0x90b5('0x46')][_0x90b5('0x3c')]({'name':_0x21a7f2[_0x90b5('0x1a')],'resourceId':_0x21a7f2['id'],'type':_0x9f8d5e['name'],'sectionId':_0x9f8d5e['id']},{})[_0x90b5('0x1c')](function(){return _0x38cb4a;});}else{return _0x38cb4a;}})[_0x90b5('0x3b')](function(_0x1f6ae3){logger['error'](_0x90b5('0x47'),_0x1f6ae3);throw _0x1f6ae3;});}return _0x38cb4a;})['then'](respondWithResult(_0x5b4c1,0xc9))[_0x90b5('0x3b')](handleError(_0x5b4c1,null));};exports[_0x90b5('0x48')]=function(_0x489d24,_0x1d5b24){if(_0x489d24[_0x90b5('0x3d')]['id']){delete _0x489d24['body']['id'];}return db[_0x90b5('0x22')]['find']({'where':{'id':_0x489d24[_0x90b5('0x38')]['id']}})[_0x90b5('0x1c')](handleEntityNotFound(_0x1d5b24,null))['then'](function(_0x18f415){if(_0x18f415){return db['VoiceExtension'][_0x90b5('0x48')](_[_0x90b5('0x31')](_0x489d24[_0x90b5('0x3d')],['exten','context',_0x90b5('0x49'),_0x90b5('0x4a'),_0x90b5('0x4b'),_0x90b5('0x4c'),_0x90b5('0x4d')]),{'where':{'context':_0x18f415['context'],'exten':_0x18f415[_0x90b5('0x3e')]},'individualHooks':!![]})[_0x90b5('0x1c')](function(_0x147f48){return _0x147f48;});}return null;})[_0x90b5('0x1c')](respondWithStatusCode(_0x1d5b24,null))[_0x90b5('0x3b')](handleError(_0x1d5b24,null));};exports[_0x90b5('0x4e')]=function(_0x58f700,_0x120d0d){var _0x1b5ac0=_0x58f700[_0x90b5('0x38')]['id'];var _0x448d62=_0x58f700[_0x90b5('0x3d')];var _0x1d8148=0xc8;var _0x18ddf9=null;return db[_0x90b5('0x4f')][_0x90b5('0x50')]({'isolationLevel':db[_0x90b5('0x4f')]['Transaction'][_0x90b5('0x51')][_0x90b5('0x52')]},function(_0x17f9ff){return db[_0x90b5('0x22')][_0x90b5('0x53')]({'where':{'id':_0x1b5ac0},'transaction':_0x17f9ff})[_0x90b5('0x1c')](function(_0x5d9cae){if(_0x5d9cae){return db[_0x90b5('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x1b5ac0},'transaction':_0x17f9ff})[_0x90b5('0x1c')](function(){var _0x178ee5=_[_0x90b5('0x21')](_0x448d62,function(_0x1608c7){_0x1608c7[_0x90b5('0x54')]=_0x1b5ac0;_0x1608c7[_0x90b5('0x55')]=!![];return _0x1608c7;});return _0x5d9cae['createRouting'](_0x178ee5);})[_0x90b5('0x1c')](function(_0x389593){return db[_0x90b5('0x22')][_0x90b5('0x56')](_0x389593,{'transaction':_0x17f9ff});});}else{_0x1d8148=0x194;_0x18ddf9=[];}});})[_0x90b5('0x1c')](function(){if(_0x1d8148!==0x194){return db[_0x90b5('0x22')][_0x90b5('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1b5ac0},'order':_0x90b5('0x58')})[_0x90b5('0x1c')](function(_0x45a46f){_0x18ddf9=_0x45a46f;});}})['catch'](function(_0x3022a3){_0x1d8148=0x1f4;logger['error'](_0x3022a3[_0x90b5('0x1e')]);if(_0x3022a3[_0x90b5('0x1a')]){delete _0x3022a3[_0x90b5('0x1a')];}_0x18ddf9=_0x3022a3;})[_0x90b5('0x59')](function(){if(_0x18ddf9===null){_0x120d0d[_0x90b5('0x9')](_0x1d8148);}else{if(_0x1d8148===0x1f4){_0x120d0d[_0x90b5('0xa')](_0x1d8148)['send'](_0x18ddf9);}else{_0x120d0d[_0x90b5('0xa')](_0x1d8148)[_0x90b5('0xc')](_0x18ddf9);}}});};
\ No newline at end of file
+var _0x307c=['catch','show','params','keys','length','includeAll','find','create','exten','body','user','role','userProfileId','autoAssociation','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','internal','filter','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceExtension','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x30917d,_0x362452){var _0x589c75=function(_0x336355){while(--_0x336355){_0x30917d['push'](_0x30917d['shift']());}};_0x589c75(++_0x362452);}(_0x307c,0xc9));var _0xc307=function(_0x25782d,_0x24bd6e){_0x25782d=_0x25782d-0x0;var _0x587bcf=_0x307c[_0x25782d];return _0x587bcf;};'use strict';var _=require(_0xc307('0x0'));var Redis=require(_0xc307('0x1'));var qs=require(_0xc307('0x2'));var logger=require(_0xc307('0x3'))(_0xc307('0x4'));var config=require(_0xc307('0x5'));var db=require('../../mysqldb')['db'];config[_0xc307('0x6')]=_[_0xc307('0x7')](config[_0xc307('0x6')],{'host':_0xc307('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc307('0x6')]));require(_0xc307('0x9'))[_0xc307('0xa')](socket);function respondWithStatusCode(_0x4da663,_0x1bf696){_0x1bf696=_0x1bf696||0xcc;return function(_0x10073a){if(_0x10073a){return _0x4da663[_0xc307('0xb')](_0x1bf696);}return _0x4da663['status'](_0x1bf696)[_0xc307('0xc')]();};}function respondWithResult(_0x515a7c,_0x52de1f){_0x52de1f=_0x52de1f||0xc8;return function(_0x172b84){if(_0x172b84){return _0x515a7c[_0xc307('0xd')](_0x52de1f)[_0xc307('0xe')](_0x172b84);}};}function respondWithFilteredResult(_0x46bc56,_0x213dfb){return function(_0x418c41){if(_0x418c41){var _0x328a26=typeof _0x213dfb[_0xc307('0xf')]===_0xc307('0x10')&&typeof _0x213dfb[_0xc307('0x11')]===_0xc307('0x10');var _0x1a7d42=_0x418c41[_0xc307('0x12')];var _0x1ccdf1=_0x328a26?0x0:_0x213dfb[_0xc307('0xf')];var _0x501397=_0x328a26?_0x418c41[_0xc307('0x12')]:_0x213dfb[_0xc307('0xf')]+_0x213dfb['limit'];var _0x13ba8a;if(_0x501397>=_0x1a7d42){_0x501397=_0x1a7d42;_0x13ba8a=0xc8;}else{_0x13ba8a=0xce;}_0x46bc56[_0xc307('0xd')](_0x13ba8a);return _0x46bc56['set'](_0xc307('0x13'),_0x1ccdf1+'-'+_0x501397+'/'+_0x1a7d42)[_0xc307('0xe')](_0x418c41);}return null;};}function removeEntity(_0x5eacb7){return function(_0x422d41){if(_0x422d41){return _0x422d41[_0xc307('0x14')]()[_0xc307('0x15')](function(){var _0x5a8fb8=_0x422d41[_0xc307('0x16')]({'plain':!![]});var _0x1b3151=[{'name':_0xc307('0x17'),'value':_0xc307('0x18'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc307('0x19'),'ignore':![]},{'name':'InternalRoutes','value':_0xc307('0x1a'),'ignore':![]}];var _0x39fe6f=_(_0x1b3151)[_0xc307('0x1b')]('ignore')[_0xc307('0x1c')](_0xc307('0x1d'))[_0xc307('0x1d')]();if(_[_0xc307('0x1e')](_0x39fe6f,_0x5a8fb8[_0xc307('0x1f')])){return;}var _0x59b194=_['find'](_0x1b3151,[_0xc307('0x1d'),_0x5a8fb8[_0xc307('0x1f')]])[_0xc307('0x20')];return db[_0xc307('0x21')][_0xc307('0x14')]({'where':{'type':_0x59b194,'resourceId':_0x5a8fb8['id']}})[_0xc307('0x15')](function(){return _0x422d41;});})['then'](function(){_0x5eacb7[_0xc307('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x217502){return function(_0x1c34bf){if(!_0x1c34bf){_0x217502['sendStatus'](0x194);}return _0x1c34bf;};}function handleError(_0x4e9475,_0x410561){_0x410561=_0x410561||0x1f4;return function(_0x40a6c1){logger[_0xc307('0x22')](_0x40a6c1['stack']);if(_0x40a6c1[_0xc307('0x20')]){delete _0x40a6c1[_0xc307('0x20')];}_0x4e9475[_0xc307('0xd')](_0x410561)[_0xc307('0x23')](_0x40a6c1);};}exports[_0xc307('0x24')]=function(_0x24e1b3,_0x32ed65){var _0x2ff59a={},_0x1e808d={},_0x42e75b={'count':0x0,'rows':[]};var _0xe82bc2=_[_0xc307('0x1c')](db[_0xc307('0x25')][_0xc307('0x26')],function(_0x5b5903){return{'name':_0x5b5903[_0xc307('0x27')],'type':_0x5b5903[_0xc307('0x1f')]['key']};});_0x1e808d[_0xc307('0x28')]=_[_0xc307('0x1c')](_0xe82bc2,_0xc307('0x20'));_0x1e808d['query']=_['keys'](_0x24e1b3[_0xc307('0x29')]);_0x1e808d[_0xc307('0x2a')]=_[_0xc307('0x2b')](_0x1e808d[_0xc307('0x28')],_0x1e808d[_0xc307('0x29')]);_0x2ff59a[_0xc307('0x2c')]=_[_0xc307('0x2b')](_0x1e808d['model'],qs[_0xc307('0x2d')](_0x24e1b3[_0xc307('0x29')]['fields']));_0x2ff59a[_0xc307('0x2c')]=_0x2ff59a[_0xc307('0x2c')]['length']?_0x2ff59a[_0xc307('0x2c')]:_0x1e808d[_0xc307('0x28')];if(!_0x24e1b3[_0xc307('0x29')][_0xc307('0x2e')](_0xc307('0x2f'))){_0x2ff59a['limit']=qs[_0xc307('0x11')](_0x24e1b3[_0xc307('0x29')][_0xc307('0x11')]);_0x2ff59a[_0xc307('0xf')]=qs['offset'](_0x24e1b3['query'][_0xc307('0xf')]);}_0x2ff59a['order']=qs[_0xc307('0x30')](_0x24e1b3[_0xc307('0x29')][_0xc307('0x30')]);_0x2ff59a[_0xc307('0x31')]=qs[_0xc307('0x2a')](_[_0xc307('0x32')](_0x24e1b3[_0xc307('0x29')],_0x1e808d[_0xc307('0x2a')]),_0xe82bc2);if(_0x24e1b3['query'][_0xc307('0x1b')]){_0x2ff59a[_0xc307('0x31')]=_[_0xc307('0x33')](_0x2ff59a['where'],{'$or':_[_0xc307('0x1c')](_0xe82bc2,function(_0x5b9ec6){if(_0x5b9ec6[_0xc307('0x1f')]!==_0xc307('0x34')){var _0x50db72={};_0x50db72[_0x5b9ec6['name']]={'$like':'%'+_0x24e1b3[_0xc307('0x29')]['filter']+'%'};return _0x50db72;}})});}_0x2ff59a=_[_0xc307('0x33')]({},_0x2ff59a,_0x24e1b3[_0xc307('0x35')]);var _0x57fb33={'where':_0x2ff59a['where']};return db[_0xc307('0x25')]['count'](_0x57fb33)[_0xc307('0x15')](function(_0x58dcec){_0x42e75b['count']=_0x58dcec;if(_0x24e1b3[_0xc307('0x29')]['includeAll']){_0x2ff59a[_0xc307('0x36')]=[{'all':!![]}];}return db[_0xc307('0x25')][_0xc307('0x37')](_0x2ff59a);})[_0xc307('0x15')](function(_0x75b3d1){_0x42e75b[_0xc307('0x38')]=_0x75b3d1;return _0x42e75b;})['then'](respondWithFilteredResult(_0x32ed65,_0x2ff59a))[_0xc307('0x39')](handleError(_0x32ed65,null));};exports[_0xc307('0x3a')]=function(_0x12b4fe,_0x13f6cb){var _0x483aa2={'raw':![],'where':{'id':_0x12b4fe[_0xc307('0x3b')]['id']}},_0x1a1a02={};_0x1a1a02[_0xc307('0x28')]=_[_0xc307('0x3c')](db['VoiceExtension']['rawAttributes']);_0x1a1a02[_0xc307('0x29')]=_[_0xc307('0x3c')](_0x12b4fe[_0xc307('0x29')]);_0x1a1a02[_0xc307('0x2a')]=_[_0xc307('0x2b')](_0x1a1a02[_0xc307('0x28')],_0x1a1a02[_0xc307('0x29')]);_0x483aa2[_0xc307('0x2c')]=_[_0xc307('0x2b')](_0x1a1a02[_0xc307('0x28')],qs[_0xc307('0x2d')](_0x12b4fe[_0xc307('0x29')][_0xc307('0x2d')]));_0x483aa2[_0xc307('0x2c')]=_0x483aa2[_0xc307('0x2c')][_0xc307('0x3d')]?_0x483aa2['attributes']:_0x1a1a02['model'];if(_0x12b4fe[_0xc307('0x29')][_0xc307('0x3e')]){_0x483aa2['include']=[{'all':!![]}];}_0x483aa2=_[_0xc307('0x33')]({},_0x483aa2,_0x12b4fe[_0xc307('0x35')]);return db[_0xc307('0x25')][_0xc307('0x3f')](_0x483aa2)[_0xc307('0x15')](handleEntityNotFound(_0x13f6cb,null))[_0xc307('0x15')](respondWithResult(_0x13f6cb,null))['catch'](handleError(_0x13f6cb,null));};exports[_0xc307('0x14')]=function(_0x19a14a,_0x317b3d){return db[_0xc307('0x25')]['find']({'where':{'id':_0x19a14a['params']['id']}})[_0xc307('0x15')](handleEntityNotFound(_0x317b3d,null))[_0xc307('0x15')](removeEntity(_0x317b3d,null))[_0xc307('0x39')](handleError(_0x317b3d,null));};exports[_0xc307('0x40')]=function(_0x2d4fa5,_0x449287){if(_0x2d4fa5['body'][_0xc307('0x1f')]===_0xc307('0x19')&&!_['startsWith'](_0x2d4fa5['body']['exten'],'_')){_0x2d4fa5['body'][_0xc307('0x41')]='_'['concat'](_0x2d4fa5['body'][_0xc307('0x41')]);}return db[_0xc307('0x25')][_0xc307('0x40')](_0x2d4fa5[_0xc307('0x42')],{'raw':![]})[_0xc307('0x15')](function(_0x4628b3){var _0x507c91=_0x2d4fa5[_0xc307('0x43')]['get']({'plain':!![]});if(!_0x507c91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x507c91[_0xc307('0x44')]===_0xc307('0x43')){var _0x2f4841=_0x4628b3[_0xc307('0x16')]({'plain':!![]});var _0x193ae5=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':_0xc307('0x19')},{'name':'InternalRoutes','value':_0xc307('0x1a')}];var _0x1f4bf8=_[_0xc307('0x3f')](_0x193ae5,[_0xc307('0x1d'),_0x2f4841['type']])['name'];return db['UserProfileSection'][_0xc307('0x3f')]({'where':{'name':_0x1f4bf8,'userProfileId':_0x507c91[_0xc307('0x45')]},'raw':!![]})[_0xc307('0x15')](function(_0x49de64){if(_0x49de64&&_0x49de64[_0xc307('0x46')]===0x0){return db[_0xc307('0x21')][_0xc307('0x40')]({'name':_0x2f4841['name'],'resourceId':_0x2f4841['id'],'type':_0x49de64['name'],'sectionId':_0x49de64['id']},{})[_0xc307('0x15')](function(){return _0x4628b3;});}else{return _0x4628b3;}})['catch'](function(_0x2f3756){logger[_0xc307('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f3756);throw _0x2f3756;});}return _0x4628b3;})[_0xc307('0x15')](respondWithResult(_0x449287,0xc9))['catch'](handleError(_0x449287,null));};exports['update']=function(_0x4a5e6c,_0x321db5){if(_0x4a5e6c[_0xc307('0x42')]['id']){delete _0x4a5e6c[_0xc307('0x42')]['id'];}return db['VoiceExtension'][_0xc307('0x3f')]({'where':{'id':_0x4a5e6c[_0xc307('0x3b')]['id']}})[_0xc307('0x15')](handleEntityNotFound(_0x321db5,null))[_0xc307('0x15')](function(_0x56429e){if(_0x56429e){return db[_0xc307('0x25')][_0xc307('0x47')](_['pick'](_0x4a5e6c[_0xc307('0x42')],['exten','context','description',_0xc307('0x48'),_0xc307('0x49'),_0xc307('0x4a'),_0xc307('0x4b')]),{'where':{'context':_0x56429e[_0xc307('0x4c')],'exten':_0x56429e[_0xc307('0x41')]},'individualHooks':!![]})['then'](function(_0x165bb9){return _0x165bb9;});}return null;})[_0xc307('0x15')](respondWithStatusCode(_0x321db5,null))[_0xc307('0x39')](handleError(_0x321db5,null));};exports[_0xc307('0x4d')]=function(_0x268a7f,_0x1fef66){var _0x556899=_0x268a7f['params']['id'];var _0x19dc24=_0x268a7f[_0xc307('0x42')];var _0x43b9db=0xc8;var _0x5de250=null;return db['sequelize'][_0xc307('0x4e')]({'isolationLevel':db[_0xc307('0x4f')][_0xc307('0x50')][_0xc307('0x51')][_0xc307('0x52')]},function(_0x1254af){return db[_0xc307('0x25')]['findOne']({'where':{'id':_0x556899},'transaction':_0x1254af})[_0xc307('0x15')](function(_0x35e5be){if(_0x35e5be){return db['VoiceExtension'][_0xc307('0x14')]({'where':{'VoiceExtensionId':_0x556899},'transaction':_0x1254af})[_0xc307('0x15')](function(){var _0x27cdf3=_['map'](_0x19dc24,function(_0x45284c){_0x45284c[_0xc307('0x53')]=_0x556899;_0x45284c['isApp']=!![];return _0x45284c;});return _0x35e5be[_0xc307('0x54')](_0x27cdf3);})[_0xc307('0x15')](function(_0x4e6aca){return db[_0xc307('0x25')]['bulkCreate'](_0x4e6aca,{'transaction':_0x1254af});});}else{_0x43b9db=0x194;_0x5de250=[];}});})['then'](function(){if(_0x43b9db!==0x194){return db[_0xc307('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x556899},'order':'cast(priority\x20as\x20unsigned)'})[_0xc307('0x15')](function(_0x218e0f){_0x5de250=_0x218e0f;});}})[_0xc307('0x39')](function(_0x5a134b){_0x43b9db=0x1f4;logger[_0xc307('0x22')](_0x5a134b['stack']);if(_0x5a134b[_0xc307('0x20')]){delete _0x5a134b[_0xc307('0x20')];}_0x5de250=_0x5a134b;})[_0xc307('0x55')](function(){if(_0x5de250===null){_0x1fef66[_0xc307('0xb')](_0x43b9db);}else{if(_0x43b9db===0x1f4){_0x1fef66[_0xc307('0xd')](_0x43b9db)['send'](_0x5de250);}else{_0x1fef66['status'](_0x43b9db)[_0xc307('0xe')](_0x5de250);}}});};
\ No newline at end of file
index 2535930..468bb6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ed7=['hasOwnProperty','exports','../../mysqldb','VoiceExtension','setMaxListeners','update'];(function(_0x355141,_0x4ce3bd){var _0x328382=function(_0x44e03c){while(--_0x44e03c){_0x355141['push'](_0x355141['shift']());}};_0x328382(++_0x4ce3bd);}(_0x7ed7,0x116));var _0x77ed=function(_0x1e376d,_0x2d317d){_0x1e376d=_0x1e376d-0x0;var _0x3e2488=_0x7ed7[_0x1e376d];return _0x3e2488;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x77ed('0x0'))['db'][_0x77ed('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x77ed('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77ed('0x3'),'afterDestroy':'remove'};function emitEvent(_0x39ddbf){return function(_0x4d124e,_0x39d0f6,_0x4f0273){VoiceExtensionEvents['emit'](_0x39ddbf+':'+_0x4d124e['id'],_0x4d124e);VoiceExtensionEvents['emit'](_0x39ddbf,_0x4d124e);_0x4f0273(null);};}for(var e in events){if(events[_0x77ed('0x4')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x77ed('0x5')]=VoiceExtensionEvents;
\ No newline at end of file
+var _0x421d=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','emit','exports'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x421d,0x18f));var _0xd421=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x421d[_0x33032e];return _0x13316b;};'use strict';var EventEmitter=require(_0xd421('0x0'));var VoiceExtension=require(_0xd421('0x1'))['db'][_0xd421('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd421('0x3')](0x0);var events={'afterCreate':_0xd421('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3df055){return function(_0x17b5ef,_0x5c6096,_0xaeccb2){VoiceExtensionEvents[_0xd421('0x5')](_0x3df055+':'+_0x17b5ef['id'],_0x17b5ef);VoiceExtensionEvents['emit'](_0x3df055,_0x17b5ef);_0xaeccb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xd421('0x6')]=VoiceExtensionEvents;
\ No newline at end of file
index aff5ccf..8ae8096 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x254a=['Set','CDR(type)=','type','alias','NoOp','CDR(routeAlias)=','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','context','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','No\x20alias\x20set','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','length','name','trunk','param','split','phone','prefix','${EXTEN}','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','playback','includes','app','appType','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','concat','lodash','./voiceExtension.attributes','exports','models'];(function(_0x332b8a,_0x43f444){var _0x4a891b=function(_0x5e6a04){while(--_0x5e6a04){_0x332b8a['push'](_0x332b8a['shift']());}};_0x4a891b(++_0x43f444);}(_0x254a,0x138));var _0xa254=function(_0x1915e5,_0xe53420){_0x1915e5=_0x1915e5-0x0;var _0x148dd0=_0x254a[_0x1915e5];return _0x148dd0;};'use strict';var _=require(_0xa254('0x0'));var attributes=require(_0xa254('0x1'));module[_0xa254('0x2')]=function(_0x51d166){var _0xdd386c=_0x51d166[_0xa254('0x3')];function _0x34467a(_0x425c63){var _0x500e29=0x2;var _0x8fbfaf=[{'type':_0x425c63['type'],'app':_0xa254('0x4'),'appdata':_0xa254('0x5')+_0x425c63[_0xa254('0x6')],'context':_0x425c63['context'],'exten':_0x425c63['exten'],'priority':_0x500e29++,'VoiceExtensionId':_0x425c63['id']},{'type':_0x425c63[_0xa254('0x6')],'app':_0x425c63[_0xa254('0x7')]?'Set':_0xa254('0x8'),'appdata':_0x425c63['alias']?_0xa254('0x9')+_0x425c63[_0xa254('0x7')]:'No\x20alias\x20set','context':_0x425c63['context'],'exten':_0x425c63[_0xa254('0xa')],'priority':_0x500e29++,'VoiceExtensionId':_0x425c63['id']}];if(_0x425c63[_0xa254('0x6')]===_0xa254('0xb')){_0x8fbfaf[_0xa254('0xc')]({'type':_0xa254('0xb'),'app':'Set','appdata':_0xa254('0xd')+_0x425c63['id'],'context':_0x425c63['context'],'exten':_0x425c63['exten'],'priority':_0x500e29++,'VoiceExtensionId':_0x425c63['id']});}_0x8fbfaf[_0xa254('0xc')]({'type':_0x425c63[_0xa254('0x6')],'app':'Set','appdata':_0xa254('0xe'),'context':_0x425c63[_0xa254('0xf')],'exten':_0x425c63[_0xa254('0xa')],'priority':_0x500e29++,'VoiceExtensionId':_0x425c63['id']},{'type':_0x425c63[_0xa254('0x6')],'app':_0xa254('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x425c63[_0xa254('0xf')],'exten':_0x425c63[_0xa254('0xa')],'priority':_0x500e29++,'VoiceExtensionId':_0x425c63['id']},{'type':_0x425c63[_0xa254('0x6')],'app':_0xa254('0x4'),'appdata':_0xa254('0x10'),'context':_0x425c63[_0xa254('0xf')],'exten':_0x425c63[_0xa254('0xa')],'priority':_0x500e29++,'VoiceExtensionId':_0x425c63['id']});return _0x8fbfaf;}function _0x1f21ae(_0x348a64){var _0x5b5de4=0x2;var _0x547205=[{'type':'outbound','app':_0xa254('0x4'),'appdata':_0xa254('0x11'),'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0x348a64[_0xa254('0x7')]?_0xa254('0x4'):'NoOp','appdata':_0x348a64[_0xa254('0x7')]?'CDR(routeAlias)='+_0x348a64[_0xa254('0x7')]:_0xa254('0x13'),'context':_0x348a64['context'],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':'Set','appdata':'CDR(destination)='+(_0x348a64[_0xa254('0x14')]?_0xa254('0x15')+_0x348a64[_0xa254('0x14')]+'}':'${EXTEN}'),'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':'Set','appdata':'CDR(routeid)='+_0x348a64['id'],'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0xa254('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5b5de4+0x2)+_0xa254('0x17')+(_0x5b5de4+0x1)+')','context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0xa254('0x4'),'appdata':_0x348a64[_0xa254('0x14')]?_0xa254('0x18')+_0x348a64[_0xa254('0x14')]+'}':_0xa254('0x19'),'context':_0x348a64['context'],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0xa254('0x4'),'appdata':_0xa254('0xe'),'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64['exten'],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0xa254('0x4'),'appdata':_0xa254('0x1a'),'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64['exten'],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0xa254('0x4'),'appdata':_0xa254('0x10'),'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':_0xa254('0x4'),'appdata':_0xa254('0x1b')+_0x348a64['id'],'context':_0x348a64['context'],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']}];if(_0x348a64[_0xa254('0x1c')](_0xa254('0x1d'))&&_0x348a64[_0xa254('0x1d')]!=='none'){_0x547205[_0xa254('0xc')]({'type':_0xa254('0x12'),'app':_0xa254('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']},{'type':_0xa254('0x12'),'app':'Set','appdata':_0xa254('0x1e')+_0x348a64[_0xa254('0x1d')]||_0xa254('0x1f'),'context':_0x348a64[_0xa254('0xf')],'exten':_0x348a64[_0xa254('0xa')],'priority':_0x5b5de4++,'VoiceExtensionId':_0x348a64['id']});}return _0x547205;}function _0x667f32(_0x1f37df,_0x26bfd6){var _0x172d0d=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0xa254('0x20'),'param':0x2},{'name':_0xa254('0x21'),'param':0x3}];var _0x4e0f32={};var _0x264205=_0x26bfd6['split'](',');var _0x5d1cd0=[];for(var _0x288c66=0x0;_0x288c66<_0x172d0d[_0xa254('0x22')];_0x288c66++){switch(_0x172d0d[_0x288c66][_0xa254('0x23')]){case _0xa254('0x24'):_0x4e0f32['trunk']=_0x264205[_0x172d0d[_0x288c66][_0xa254('0x25')]][_0xa254('0x26')]('/')[0x1];_0x4e0f32[_0xa254('0x27')]=_0x264205[_0x172d0d[_0x288c66][_0xa254('0x25')]][_0xa254('0x26')]('/')[0x2];_0x4e0f32[_0xa254('0x28')]=_0x4e0f32[_0xa254('0x27')]?_0x4e0f32[_0xa254('0x27')][_0xa254('0x26')]('$')[0x0]:undefined;_0x4e0f32[_0xa254('0x27')]=_0x1f37df[_0xa254('0x14')]?(_0x4e0f32[_0xa254('0x28')]||'')+_0xa254('0x15')+_0x1f37df['cutdigits']+'}':(_0x4e0f32['prefix']||'')+_0xa254('0x29');_0x5d1cd0[_0x172d0d[_0x288c66][_0xa254('0x25')]]=['SIP',_0x4e0f32['trunk'],_0x4e0f32[_0xa254('0x27')]][_0xa254('0x2a')]('/');break;case _0xa254('0x20'):_0x4e0f32[_0xa254('0x20')]=_0x264205[_0x172d0d[_0x288c66][_0xa254('0x25')]];if(_0x1f37df[_0xa254('0x1d')]!==_0xa254('0x2b')){if(_0x4e0f32['options'][_0xa254('0x2c')](_0xa254('0x2d'))<0x0){_0x4e0f32[_0xa254('0x20')]+=_0xa254('0x2d');}}else{_0x4e0f32[_0xa254('0x20')]=_0x4e0f32[_0xa254('0x20')]['replace'](_0xa254('0x2d'),'');}_0x5d1cd0[_0x172d0d[_0x288c66][_0xa254('0x25')]]=_0x4e0f32[_0xa254('0x20')];break;default:_0x5d1cd0[_0x172d0d[_0x288c66][_0xa254('0x25')]]=_0x264205[_0x172d0d[_0x288c66][_0xa254('0x25')]];}}return _0x5d1cd0[_0xa254('0x2a')](',');}function _0x3a3458(_0x32c60e,_0x171d57,_0x15bbba){return new Promise(function(_0x21f446,_0x5d16e7){var _0x5d42df=[];if(_[_0xa254('0x2e')](_0x171d57))return _0x21f446(_0x5d42df);_0xdd386c[_0xa254('0x2f')][_0xa254('0x30')]({'attributes':['id','interval',_0xa254('0x31')],'raw':!![]})['then'](function(_0x1b589f){for(var _0x1ef195=0x0,_0x8c18af=0x0;_0x1ef195<_0x171d57['length'];_0x1ef195++,_0x8c18af=0x0){var _0x32d7a5=_0x171d57[_0x1ef195];var _0x5049e8=[];var _0xb4381=[];delete _0x32d7a5['id'];if(_0x32d7a5[_0xa254('0x32')]!==_0xa254('0x33')){_0x32d7a5[_0xa254('0x34')]=[_0x32d7a5[_0xa254('0x32')]];}else{_0x32d7a5['intervals']=_0x32d7a5[_0xa254('0x31')]?_['map'](_[_0xa254('0x35')](_0x1b589f,{'IntervalId':_0x32d7a5[_0xa254('0x31')]}),'interval'):[];}_0x32d7a5[_0xa254('0xf')]=_0x32c60e[_0xa254('0xf')];_0x32d7a5[_0xa254('0xa')]=_0x32c60e[_0xa254('0xa')];if(_0x32d7a5[_0xa254('0x6')])_0x32d7a5[_0xa254('0x6')]=_0x32d7a5[_0xa254('0x6')][_0xa254('0x36')]();if(_0x32c60e['type']==='outbound'){if(_0x32d7a5['hasOwnProperty'](_0xa254('0x37'))&&_0x32d7a5['tag']&&_0x32d7a5[_0xa254('0x37')]!=='--'){_0x5049e8[_0xa254('0xc')]({'type':_0x32d7a5['type'][_0xa254('0x36')](),'app':'Set','appdata':_0xa254('0x38')+_0x32d7a5[_0xa254('0x37')],'context':_0x32c60e[_0xa254('0xf')],'exten':_0x32c60e[_0xa254('0xa')],'priority':_0x32d7a5[_0xa254('0x34')][_0xa254('0x22')]+_0x15bbba+_0x8c18af++,'VoiceExtensionId':_0x32c60e['id']});}_0x5049e8[_0xa254('0xc')]({'type':_0x32d7a5[_0xa254('0x6')][_0xa254('0x36')](),'app':_0xa254('0x16'),'appdata':_0xa254('0x39')+(_0x32d7a5['callerID']?_0xa254('0x3a')+_0x32d7a5[_0xa254('0x3b')]+')':_0xa254('0x3c')),'context':_0x32c60e[_0xa254('0xf')],'exten':_0x32c60e[_0xa254('0xa')],'priority':_0x32d7a5[_0xa254('0x34')]['length']+_0x15bbba+_0x8c18af++,'VoiceExtensionId':_0x32c60e['id']});}else{if(_0x32d7a5[_0xa254('0x1c')]('answer')){if(['queue',_0xa254('0x3d')][_0xa254('0x3e')](_0x32d7a5[_0xa254('0x3f')]['toLowerCase']())&&_0x32d7a5[_0xa254('0x40')]!=='custom'){if(_0x32d7a5[_0xa254('0x41')]){_0x5049e8[_0xa254('0xc')]({'type':_0x32d7a5[_0xa254('0x6')][_0xa254('0x36')](),'app':_0xa254('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x32c60e[_0xa254('0xf')],'exten':_0x32c60e[_0xa254('0xa')],'priority':_0x32d7a5[_0xa254('0x34')][_0xa254('0x22')]+_0x15bbba+_0x8c18af++,'VoiceExtensionId':_0x32c60e['id']});_0x5049e8[_0xa254('0xc')]({'type':_0x32d7a5[_0xa254('0x6')][_0xa254('0x36')](),'app':_0xa254('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x32c60e[_0xa254('0xf')],'exten':_0x32c60e[_0xa254('0xa')],'priority':_0x32d7a5['intervals'][_0xa254('0x22')]+_0x15bbba+_0x8c18af++,'VoiceExtensionId':_0x32c60e['id']});}else{_0x5049e8[_0xa254('0xc')]({'type':_0x32d7a5[_0xa254('0x6')]['toLowerCase'](),'app':'ExecIf','appdata':_0xa254('0x42'),'context':_0x32c60e[_0xa254('0xf')],'exten':_0x32c60e[_0xa254('0xa')],'priority':_0x32d7a5[_0xa254('0x34')]['length']+_0x15bbba+_0x8c18af++,'VoiceExtensionId':_0x32c60e['id']});_0x5049e8[_0xa254('0xc')]({'type':_0x32d7a5[_0xa254('0x6')][_0xa254('0x36')](),'app':_0xa254('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x32c60e[_0xa254('0xf')],'exten':_0x32c60e[_0xa254('0xa')],'priority':_0x32d7a5[_0xa254('0x34')]['length']+_0x15bbba+_0x8c18af++,'VoiceExtensionId':_0x32c60e['id']});}}}}for(var _0x35e28b=0x0;_0x35e28b<_0x32d7a5[_0xa254('0x34')][_0xa254('0x22')];_0x35e28b++){var _0x4c1d2b=_0x15bbba+_0x32d7a5[_0xa254('0x34')][_0xa254('0x22')];var _0x1bd93d=_0x35e28b===_0x32d7a5[_0xa254('0x34')][_0xa254('0x22')]-0x1?_0x15bbba+_0x5049e8['length']+_0xb4381['length']+0x2:_0x15bbba+_0x35e28b+0x1;_0x5049e8[_0xa254('0x43')](_0x35e28b,0x0,{'type':_0x32c60e[_0xa254('0x6')],'app':_0xa254('0x44'),'appdata':_0x32d7a5['intervals'][_0x35e28b]+'?'+_0x32c60e[_0xa254('0xf')]+_0xa254('0x45')+_0x4c1d2b+':'+_0x32c60e['context']+_0xa254('0x45')+_0x1bd93d,'exten':_0x32c60e[_0xa254('0xa')],'context':_0x32c60e[_0xa254('0xf')],'priority':_0x15bbba+_0x35e28b,'VoiceExtensionId':_0x32c60e['id']});}if(_0x32d7a5[_0xa254('0x40')]===_0xa254('0x46'))_0x32d7a5[_0xa254('0x47')]=_0x667f32(_0x32c60e,_0x32d7a5[_0xa254('0x47')]);_0x32d7a5[_0xa254('0x48')]=_0x5049e8['length']?_[_0xa254('0x49')](_0x5049e8)[_0xa254('0x48')]+0x1:_0x15bbba;_0x5d42df=_['concat'](_0x5d42df,_0x5049e8,[_0x32d7a5],_0xb4381);_0x15bbba=_[_0xa254('0x49')](_0x5d42df)[_0xa254('0x48')]+0x1;}return _0x21f446(_0x5d42df);})[_0xa254('0x4a')](function(_0xb21c9){_0x5d16e7(_0xb21c9);});});}return _0x51d166[_0xa254('0x4b')](_0xa254('0x4c'),attributes,{'tableName':_0xa254('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x294d2b){var _0x346ee9=this['get']({'plain':!![]});var _0x489cea=_0x346ee9[_0xa254('0x6')]==='outbound'?_0x1f21ae(_0x346ee9):_0x34467a(_0x346ee9);return _0x3a3458(_0x346ee9,_0x294d2b,_[_0xa254('0x49')](_0x489cea)[_0xa254('0x48')]+0x1)['then'](function(_0x2b8d83){var _0x28d224=_[_0xa254('0x4e')](_0x489cea,_0x2b8d83);_0x28d224[_0xa254('0xc')]({'type':_0x346ee9[_0xa254('0x6')],'app':'Hangup','exten':_0x346ee9[_0xa254('0xa')],'context':_0x346ee9[_0xa254('0xf')],'priority':_[_0xa254('0x49')](_0x28d224)[_0xa254('0x48')]+0x1,'VoiceExtensionId':_0x346ee9['id']});return _0x28d224;});}}});};
\ No newline at end of file
+var _0xfc17=['cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','split','length','name','param','prefix','phone','SIP','join','options','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','playback','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten','alias','Set','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','NoOp','No\x20alias\x20set'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfc17,0x1b4));var _0x7fc1=function(_0xfb3c97,_0xb06691){_0xfb3c97=_0xfb3c97-0x0;var _0x1c23d0=_0xfc17[_0xfb3c97];return _0x1c23d0;};'use strict';var _=require(_0x7fc1('0x0'));var attributes=require(_0x7fc1('0x1'));module[_0x7fc1('0x2')]=function(_0x3de7bf){var _0x524e76=_0x3de7bf[_0x7fc1('0x3')];function _0x3bbf44(_0x2b9b74){var _0x1f6079=0x2;var _0x44101d=[{'type':_0x2b9b74[_0x7fc1('0x4')],'app':'Set','appdata':_0x7fc1('0x5')+_0x2b9b74[_0x7fc1('0x4')],'context':_0x2b9b74[_0x7fc1('0x6')],'exten':_0x2b9b74[_0x7fc1('0x7')],'priority':_0x1f6079++,'VoiceExtensionId':_0x2b9b74['id']},{'type':_0x2b9b74[_0x7fc1('0x4')],'app':_0x2b9b74[_0x7fc1('0x8')]?_0x7fc1('0x9'):'NoOp','appdata':_0x2b9b74[_0x7fc1('0x8')]?_0x7fc1('0xa')+_0x2b9b74[_0x7fc1('0x8')]:'No\x20alias\x20set','context':_0x2b9b74[_0x7fc1('0x6')],'exten':_0x2b9b74['exten'],'priority':_0x1f6079++,'VoiceExtensionId':_0x2b9b74['id']}];if(_0x2b9b74['type']===_0x7fc1('0xb')){_0x44101d[_0x7fc1('0xc')]({'type':_0x7fc1('0xb'),'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0xd')+_0x2b9b74['id'],'context':_0x2b9b74[_0x7fc1('0x6')],'exten':_0x2b9b74[_0x7fc1('0x7')],'priority':_0x1f6079++,'VoiceExtensionId':_0x2b9b74['id']});}_0x44101d[_0x7fc1('0xc')]({'type':_0x2b9b74[_0x7fc1('0x4')],'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0xe'),'context':_0x2b9b74[_0x7fc1('0x6')],'exten':_0x2b9b74['exten'],'priority':_0x1f6079++,'VoiceExtensionId':_0x2b9b74['id']},{'type':_0x2b9b74['type'],'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0xf'),'context':_0x2b9b74[_0x7fc1('0x6')],'exten':_0x2b9b74[_0x7fc1('0x7')],'priority':_0x1f6079++,'VoiceExtensionId':_0x2b9b74['id']},{'type':_0x2b9b74[_0x7fc1('0x4')],'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0x10'),'context':_0x2b9b74[_0x7fc1('0x6')],'exten':_0x2b9b74[_0x7fc1('0x7')],'priority':_0x1f6079++,'VoiceExtensionId':_0x2b9b74['id']});return _0x44101d;}function _0x442176(_0x5e634a){var _0x419170=0x2;var _0x5e89b1=[{'type':_0x7fc1('0x11'),'app':_0x7fc1('0x9'),'appdata':'CDR(type)=outbound','context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':'outbound','app':_0x5e634a[_0x7fc1('0x8')]?_0x7fc1('0x9'):_0x7fc1('0x12'),'appdata':_0x5e634a[_0x7fc1('0x8')]?_0x7fc1('0xa')+_0x5e634a[_0x7fc1('0x8')]:_0x7fc1('0x13'),'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':'Set','appdata':'CDR(destination)='+(_0x5e634a[_0x7fc1('0x14')]?'${EXTEN:'+_0x5e634a[_0x7fc1('0x14')]+'}':_0x7fc1('0x15')),'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':'outbound','app':_0x7fc1('0x9'),'appdata':_0x7fc1('0xd')+_0x5e634a['id'],'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a['exten'],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':_0x7fc1('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x419170+0x2)+'):Goto('+(_0x419170+0x1)+')','context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':_0x7fc1('0x9'),'appdata':_0x5e634a['cutdigits']?_0x7fc1('0x17')+_0x5e634a[_0x7fc1('0x14')]+'}':_0x7fc1('0x18'),'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a['exten'],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':'Set','appdata':_0x7fc1('0xe'),'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':_0x7fc1('0x9'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a['exten'],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':'outbound','app':_0x7fc1('0x9'),'appdata':_0x7fc1('0x10'),'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0x19')+_0x5e634a['id'],'context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']}];if(_0x5e634a[_0x7fc1('0x1a')](_0x7fc1('0x1b'))&&_0x5e634a[_0x7fc1('0x1b')]!==_0x7fc1('0x1c')){_0x5e89b1[_0x7fc1('0xc')]({'type':_0x7fc1('0x11'),'app':_0x7fc1('0x9'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']},{'type':_0x7fc1('0x11'),'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0x1d')+_0x5e634a[_0x7fc1('0x1b')]||'wav','context':_0x5e634a[_0x7fc1('0x6')],'exten':_0x5e634a[_0x7fc1('0x7')],'priority':_0x419170++,'VoiceExtensionId':_0x5e634a['id']});}return _0x5e89b1;}function _0x4f36c8(_0x295268,_0x2b1788){var _0x1e3a6f=[{'name':_0x7fc1('0x1e'),'param':0x0},{'name':_0x7fc1('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0xa74afb={};var _0x289ba2=_0x2b1788[_0x7fc1('0x20')](',');var _0x3aa2b2=[];for(var _0x12ac96=0x0;_0x12ac96<_0x1e3a6f[_0x7fc1('0x21')];_0x12ac96++){switch(_0x1e3a6f[_0x12ac96][_0x7fc1('0x22')]){case _0x7fc1('0x1e'):_0xa74afb['trunk']=_0x289ba2[_0x1e3a6f[_0x12ac96][_0x7fc1('0x23')]][_0x7fc1('0x20')]('/')[0x1];_0xa74afb['phone']=_0x289ba2[_0x1e3a6f[_0x12ac96][_0x7fc1('0x23')]][_0x7fc1('0x20')]('/')[0x2];_0xa74afb[_0x7fc1('0x24')]=_0xa74afb['phone']?_0xa74afb['phone'][_0x7fc1('0x20')]('$')[0x0]:undefined;_0xa74afb[_0x7fc1('0x25')]=_0x295268[_0x7fc1('0x14')]?(_0xa74afb['prefix']||'')+'${EXTEN:'+_0x295268['cutdigits']+'}':(_0xa74afb[_0x7fc1('0x24')]||'')+_0x7fc1('0x15');_0x3aa2b2[_0x1e3a6f[_0x12ac96][_0x7fc1('0x23')]]=[_0x7fc1('0x26'),_0xa74afb['trunk'],_0xa74afb['phone']][_0x7fc1('0x27')]('/');break;case _0x7fc1('0x28'):_0xa74afb[_0x7fc1('0x28')]=_0x289ba2[_0x1e3a6f[_0x12ac96]['param']];if(_0x295268['recordingFormat']!=='none'){if(_0xa74afb['options']['indexOf'](_0x7fc1('0x29'))<0x0){_0xa74afb['options']+=_0x7fc1('0x29');}}else{_0xa74afb[_0x7fc1('0x28')]=_0xa74afb['options'][_0x7fc1('0x2a')](_0x7fc1('0x29'),'');}_0x3aa2b2[_0x1e3a6f[_0x12ac96][_0x7fc1('0x23')]]=_0xa74afb[_0x7fc1('0x28')];break;default:_0x3aa2b2[_0x1e3a6f[_0x12ac96]['param']]=_0x289ba2[_0x1e3a6f[_0x12ac96][_0x7fc1('0x23')]];}}return _0x3aa2b2['join'](',');}function _0xf8603c(_0x173ba7,_0x7fcb7e,_0x17f48c){return new Promise(function(_0x51453f,_0x38684c){var _0x1aa362=[];if(_['isEmpty'](_0x7fcb7e))return _0x51453f(_0x1aa362);_0x524e76[_0x7fc1('0x2b')][_0x7fc1('0x2c')]({'attributes':['id','interval',_0x7fc1('0x2d')],'raw':!![]})[_0x7fc1('0x2e')](function(_0x5ead7a){for(var _0xcbf5e4=0x0,_0x1242ee=0x0;_0xcbf5e4<_0x7fcb7e[_0x7fc1('0x21')];_0xcbf5e4++,_0x1242ee=0x0){var _0x538ce5=_0x7fcb7e[_0xcbf5e4];var _0x3ae3b5=[];var _0x750284=[];delete _0x538ce5['id'];if(_0x538ce5[_0x7fc1('0x2f')]!==_0x7fc1('0x30')){_0x538ce5['intervals']=[_0x538ce5['interval']];}else{_0x538ce5[_0x7fc1('0x31')]=_0x538ce5[_0x7fc1('0x2d')]?_[_0x7fc1('0x32')](_[_0x7fc1('0x33')](_0x5ead7a,{'IntervalId':_0x538ce5[_0x7fc1('0x2d')]}),_0x7fc1('0x2f')):[];}_0x538ce5[_0x7fc1('0x6')]=_0x173ba7[_0x7fc1('0x6')];_0x538ce5[_0x7fc1('0x7')]=_0x173ba7['exten'];if(_0x538ce5['type'])_0x538ce5['type']=_0x538ce5[_0x7fc1('0x4')][_0x7fc1('0x34')]();if(_0x173ba7[_0x7fc1('0x4')]===_0x7fc1('0x11')){if(_0x538ce5['hasOwnProperty'](_0x7fc1('0x35'))&&_0x538ce5[_0x7fc1('0x35')]&&_0x538ce5[_0x7fc1('0x35')]!=='--'){_0x3ae3b5[_0x7fc1('0xc')]({'type':_0x538ce5['type'][_0x7fc1('0x34')](),'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0x36')+_0x538ce5[_0x7fc1('0x35')],'context':_0x173ba7[_0x7fc1('0x6')],'exten':_0x173ba7[_0x7fc1('0x7')],'priority':_0x538ce5[_0x7fc1('0x31')]['length']+_0x17f48c+_0x1242ee++,'VoiceExtensionId':_0x173ba7['id']});}_0x3ae3b5[_0x7fc1('0xc')]({'type':_0x538ce5['type'][_0x7fc1('0x34')](),'app':'ExecIf','appdata':_0x7fc1('0x37')+(_0x538ce5[_0x7fc1('0x38')]?'Set(CALLERID(all)='+_0x538ce5[_0x7fc1('0x38')]+')':_0x7fc1('0x39')),'context':_0x173ba7['context'],'exten':_0x173ba7[_0x7fc1('0x7')],'priority':_0x538ce5[_0x7fc1('0x31')][_0x7fc1('0x21')]+_0x17f48c+_0x1242ee++,'VoiceExtensionId':_0x173ba7['id']});}else{if(_0x538ce5[_0x7fc1('0x1a')]('answer')){if(['queue',_0x7fc1('0x3a')]['includes'](_0x538ce5[_0x7fc1('0x3b')][_0x7fc1('0x34')]())&&_0x538ce5[_0x7fc1('0x3c')]!==_0x7fc1('0x3d')){if(_0x538ce5[_0x7fc1('0x3e')]){_0x3ae3b5[_0x7fc1('0xc')]({'type':_0x538ce5[_0x7fc1('0x4')][_0x7fc1('0x34')](),'app':_0x7fc1('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x173ba7['context'],'exten':_0x173ba7[_0x7fc1('0x7')],'priority':_0x538ce5['intervals'][_0x7fc1('0x21')]+_0x17f48c+_0x1242ee++,'VoiceExtensionId':_0x173ba7['id']});_0x3ae3b5['push']({'type':_0x538ce5[_0x7fc1('0x4')][_0x7fc1('0x34')](),'app':_0x7fc1('0x9'),'appdata':_0x7fc1('0x3f'),'context':_0x173ba7[_0x7fc1('0x6')],'exten':_0x173ba7[_0x7fc1('0x7')],'priority':_0x538ce5[_0x7fc1('0x31')][_0x7fc1('0x21')]+_0x17f48c+_0x1242ee++,'VoiceExtensionId':_0x173ba7['id']});}else{_0x3ae3b5['push']({'type':_0x538ce5[_0x7fc1('0x4')]['toLowerCase'](),'app':_0x7fc1('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x173ba7[_0x7fc1('0x6')],'exten':_0x173ba7['exten'],'priority':_0x538ce5[_0x7fc1('0x31')][_0x7fc1('0x21')]+_0x17f48c+_0x1242ee++,'VoiceExtensionId':_0x173ba7['id']});_0x3ae3b5[_0x7fc1('0xc')]({'type':_0x538ce5[_0x7fc1('0x4')]['toLowerCase'](),'app':_0x7fc1('0x9'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x173ba7[_0x7fc1('0x6')],'exten':_0x173ba7[_0x7fc1('0x7')],'priority':_0x538ce5[_0x7fc1('0x31')][_0x7fc1('0x21')]+_0x17f48c+_0x1242ee++,'VoiceExtensionId':_0x173ba7['id']});}}}}for(var _0x18cdea=0x0;_0x18cdea<_0x538ce5[_0x7fc1('0x31')]['length'];_0x18cdea++){var _0x4e9b22=_0x17f48c+_0x538ce5['intervals'][_0x7fc1('0x21')];var _0x30bc86=_0x18cdea===_0x538ce5[_0x7fc1('0x31')][_0x7fc1('0x21')]-0x1?_0x17f48c+_0x3ae3b5[_0x7fc1('0x21')]+_0x750284[_0x7fc1('0x21')]+0x2:_0x17f48c+_0x18cdea+0x1;_0x3ae3b5[_0x7fc1('0x40')](_0x18cdea,0x0,{'type':_0x173ba7[_0x7fc1('0x4')],'app':_0x7fc1('0x41'),'appdata':_0x538ce5['intervals'][_0x18cdea]+'?'+_0x173ba7[_0x7fc1('0x6')]+_0x7fc1('0x42')+_0x4e9b22+':'+_0x173ba7[_0x7fc1('0x6')]+_0x7fc1('0x42')+_0x30bc86,'exten':_0x173ba7[_0x7fc1('0x7')],'context':_0x173ba7['context'],'priority':_0x17f48c+_0x18cdea,'VoiceExtensionId':_0x173ba7['id']});}if(_0x538ce5['appType']===_0x7fc1('0x43'))_0x538ce5[_0x7fc1('0x44')]=_0x4f36c8(_0x173ba7,_0x538ce5[_0x7fc1('0x44')]);_0x538ce5[_0x7fc1('0x45')]=_0x3ae3b5[_0x7fc1('0x21')]?_[_0x7fc1('0x46')](_0x3ae3b5)['priority']+0x1:_0x17f48c;_0x1aa362=_[_0x7fc1('0x47')](_0x1aa362,_0x3ae3b5,[_0x538ce5],_0x750284);_0x17f48c=_[_0x7fc1('0x46')](_0x1aa362)[_0x7fc1('0x45')]+0x1;}return _0x51453f(_0x1aa362);})[_0x7fc1('0x48')](function(_0x3d070f){_0x38684c(_0x3d070f);});});}return _0x3de7bf[_0x7fc1('0x49')](_0x7fc1('0x4a'),attributes,{'tableName':_0x7fc1('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4a82cf){var _0x3cea9a=this['get']({'plain':!![]});var _0x95e960=_0x3cea9a[_0x7fc1('0x4')]===_0x7fc1('0x11')?_0x442176(_0x3cea9a):_0x3bbf44(_0x3cea9a);return _0xf8603c(_0x3cea9a,_0x4a82cf,_[_0x7fc1('0x46')](_0x95e960)[_0x7fc1('0x45')]+0x1)['then'](function(_0x19acde){var _0x33d54b=_[_0x7fc1('0x47')](_0x95e960,_0x19acde);_0x33d54b['push']({'type':_0x3cea9a[_0x7fc1('0x4')],'app':'Hangup','exten':_0x3cea9a[_0x7fc1('0x7')],'context':_0x3cea9a[_0x7fc1('0x6')],'priority':_['last'](_0x33d54b)[_0x7fc1('0x45')]+0x1,'VoiceExtensionId':_0x3cea9a['id']});return _0x33d54b;});}}});};
\ No newline at end of file
index f2f6ae7..358b523 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7409=['model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','error','VoiceExtension,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map'];(function(_0x2bde9f,_0x3ccd1b){var _0x3e8886=function(_0x3984bf){while(--_0x3984bf){_0x2bde9f['push'](_0x2bde9f['shift']());}};_0x3e8886(++_0x3ccd1b);}(_0x7409,0x6e));var _0x9740=function(_0x35db17,_0x8d64da){_0x35db17=_0x35db17-0x0;var _0x73f088=_0x7409[_0x35db17];return _0x73f088;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var moment=require('moment');var BPromise=require(_0x9740('0x2'));var rs=require(_0x9740('0x3'));var fs=require('fs');var Redis=require(_0x9740('0x4'));var db=require(_0x9740('0x5'))['db'];var utils=require(_0x9740('0x6'));var logger=require(_0x9740('0x7'))(_0x9740('0x8'));var config=require(_0x9740('0x9'));var jayson=require(_0x9740('0xa'));var client=jayson['client'][_0x9740('0xb')]({'port':0x232a});config[_0x9740('0xc')]=_[_0x9740('0xd')](config['redis'],{'host':_0x9740('0xe'),'port':0x18eb});var socket=require(_0x9740('0xf'))(new Redis(config[_0x9740('0xc')]));require('./voiceExtension.socket')[_0x9740('0x10')](socket);function respondWithRpcPromise(_0x548bf8,_0x1a6ff9,_0xc27c18){return new BPromise(function(_0x4e39f9,_0x59dd44){return client['request'](_0x548bf8,_0xc27c18)[_0x9740('0x11')](function(_0x3bc357){logger[_0x9740('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent',JSON['stringify'](_0x3bc357));if(_0x3bc357['error']){if(_0x3bc357[_0x9740('0x13')]['code']===0x1f4){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x3bc357['error'][_0x9740('0x15')]);return _0x59dd44(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}logger[_0x9740('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x1a6ff9,_0x3bc357[_0x9740('0x13')]['message']);return _0x4e39f9(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}else{logger[_0x9740('0x12')](_0x9740('0x14'),_0x1a6ff9,_0x9740('0x16'));_0x4e39f9(_0x3bc357[_0x9740('0x17')][_0x9740('0x15')]);}})[_0x9740('0x18')](function(_0x206c4d){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x206c4d);_0x59dd44(_0x206c4d);});});}exports[_0x9740('0x19')]=function(_0x3fb57c){var _0x31d4f7=this;return new Promise(function(_0x3f9e9d,_0xdf62fc){return db[_0x9740('0x1a')][_0x9740('0x1b')]({'raw':_0x3fb57c['options']?_0x3fb57c[_0x9740('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb57c[_0x9740('0x1c')]?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x1d')]||null:null,'attributes':_0x3fb57c[_0x9740('0x1c')]?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x1e')]||null:null,'limit':_0x3fb57c['options']?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x1f')]||null:null,'include':_0x3fb57c[_0x9740('0x1c')]?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x20')]?_[_0x9740('0x21')](_0x3fb57c[_0x9740('0x1c')][_0x9740('0x20')],function(_0x11ee90){return{'model':db[_0x11ee90['model']],'as':_0x11ee90['as'],'attributes':_0x11ee90[_0x9740('0x1e')],'include':_0x11ee90['include']?_['map'](_0x11ee90['include'],function(_0x4d2e0d){return{'model':db[_0x4d2e0d[_0x9740('0x22')]],'as':_0x4d2e0d['as'],'attributes':_0x4d2e0d[_0x9740('0x1e')],'include':_0x4d2e0d[_0x9740('0x20')]?_['map'](_0x4d2e0d[_0x9740('0x20')],function(_0x353630){return{'model':db[_0x353630[_0x9740('0x22')]],'as':_0x353630['as'],'attributes':_0x353630[_0x9740('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bfa1f){logger[_0x9740('0x12')](_0x9740('0x19'),_0x3fb57c);logger['debug'](_0x9740('0x19'),_0x3fb57c,JSON[_0x9740('0x23')](_0x3bfa1f));_0x3f9e9d(_0x3bfa1f);})[_0x9740('0x18')](function(_0x2bba86){logger[_0x9740('0x13')](_0x9740('0x19'),_0x2bba86[_0x9740('0x15')],_0x3fb57c);_0xdf62fc(_0x31d4f7[_0x9740('0x13')](0x1f4,_0x2bba86[_0x9740('0x15')]));});});};
\ No newline at end of file
+var _0xc9b0=['findAll','options','raw','where','attributes','include','map','model','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','VoiceExtension'];(function(_0x248fc8,_0x121ebf){var _0x1ec5d1=function(_0x4784fc){while(--_0x4784fc){_0x248fc8['push'](_0x248fc8['shift']());}};_0x1ec5d1(++_0x121ebf);}(_0xc9b0,0x143));var _0x0c9b=function(_0x236c63,_0x12ff67){_0x236c63=_0x236c63-0x0;var _0x583e91=_0xc9b0[_0x236c63];return _0x583e91;};'use strict';var _=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var moment=require(_0x0c9b('0x2'));var BPromise=require(_0x0c9b('0x3'));var rs=require(_0x0c9b('0x4'));var fs=require('fs');var Redis=require(_0x0c9b('0x5'));var db=require(_0x0c9b('0x6'))['db'];var utils=require(_0x0c9b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c9b('0x8'));var jayson=require(_0x0c9b('0x9'));var client=jayson[_0x0c9b('0xa')][_0x0c9b('0xb')]({'port':0x232a});config[_0x0c9b('0xc')]=_[_0x0c9b('0xd')](config[_0x0c9b('0xc')],{'host':_0x0c9b('0xe'),'port':0x18eb});var socket=require(_0x0c9b('0xf'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x1108b4,_0x16bde2,_0x1b6d84){return new BPromise(function(_0x3e271f,_0x1a8ee2){return client[_0x0c9b('0x10')](_0x1108b4,_0x1b6d84)['then'](function(_0x156cc7){logger[_0x0c9b('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x16bde2,_0x0c9b('0x12'));logger['debug'](_0x0c9b('0x13'),_0x16bde2,_0x0c9b('0x12'),JSON[_0x0c9b('0x14')](_0x156cc7));if(_0x156cc7[_0x0c9b('0x15')]){if(_0x156cc7[_0x0c9b('0x15')][_0x0c9b('0x16')]===0x1f4){logger[_0x0c9b('0x15')](_0x0c9b('0x17'),_0x16bde2,_0x156cc7[_0x0c9b('0x15')][_0x0c9b('0x18')]);return _0x1a8ee2(_0x156cc7['error']['message']);}logger['error'](_0x0c9b('0x17'),_0x16bde2,_0x156cc7[_0x0c9b('0x15')]['message']);return _0x3e271f(_0x156cc7[_0x0c9b('0x15')][_0x0c9b('0x18')]);}else{logger[_0x0c9b('0x11')](_0x0c9b('0x17'),_0x16bde2,_0x0c9b('0x12'));_0x3e271f(_0x156cc7[_0x0c9b('0x19')][_0x0c9b('0x18')]);}})['catch'](function(_0x5502d5){logger[_0x0c9b('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x16bde2,_0x5502d5);_0x1a8ee2(_0x5502d5);});});}exports[_0x0c9b('0x1a')]=function(_0x2cb320){var _0x1b8e61=this;return new Promise(function(_0xb5ce29,_0x1bf9f1){return db[_0x0c9b('0x1b')][_0x0c9b('0x1c')]({'raw':_0x2cb320[_0x0c9b('0x1d')]?_0x2cb320[_0x0c9b('0x1d')][_0x0c9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cb320['options']?_0x2cb320[_0x0c9b('0x1d')][_0x0c9b('0x1f')]||null:null,'attributes':_0x2cb320[_0x0c9b('0x1d')]?_0x2cb320['options'][_0x0c9b('0x20')]||null:null,'limit':_0x2cb320[_0x0c9b('0x1d')]?_0x2cb320[_0x0c9b('0x1d')]['limit']||null:null,'include':_0x2cb320[_0x0c9b('0x1d')]?_0x2cb320['options'][_0x0c9b('0x21')]?_[_0x0c9b('0x22')](_0x2cb320[_0x0c9b('0x1d')][_0x0c9b('0x21')],function(_0xd0733f){return{'model':db[_0xd0733f[_0x0c9b('0x23')]],'as':_0xd0733f['as'],'attributes':_0xd0733f[_0x0c9b('0x20')],'include':_0xd0733f[_0x0c9b('0x21')]?_[_0x0c9b('0x22')](_0xd0733f[_0x0c9b('0x21')],function(_0x4367df){return{'model':db[_0x4367df['model']],'as':_0x4367df['as'],'attributes':_0x4367df['attributes'],'include':_0x4367df[_0x0c9b('0x21')]?_[_0x0c9b('0x22')](_0x4367df[_0x0c9b('0x21')],function(_0x2c9f63){return{'model':db[_0x2c9f63['model']],'as':_0x2c9f63['as'],'attributes':_0x2c9f63[_0x0c9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0c9b('0x24')](function(_0x54f75e){logger[_0x0c9b('0x11')](_0x0c9b('0x1a'),_0x2cb320);logger[_0x0c9b('0x25')](_0x0c9b('0x1a'),_0x2cb320,JSON[_0x0c9b('0x14')](_0x54f75e));_0xb5ce29(_0x54f75e);})[_0x0c9b('0x26')](function(_0x523fad){logger[_0x0c9b('0x15')](_0x0c9b('0x1a'),_0x523fad['message'],_0x2cb320);_0x1bf9f1(_0x1b8e61[_0x0c9b('0x15')](0x1f4,_0x523fad[_0x0c9b('0x18')]));});});};
\ No newline at end of file
index 4097467..e2db222 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0xfdb399,_0x1d68e0){var _0xe1f875=function(_0x5f2791){while(--_0x5f2791){_0xfdb399['push'](_0xfdb399['shift']());}};_0xe1f875(++_0x1d68e0);}(_0xf494,0x1c6));var _0x4f49=function(_0x2659b3,_0x47c8b5){_0x2659b3=_0x2659b3-0x0;var _0x5c9617=_0xf494[_0x2659b3];return _0x5c9617;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}};
\ No newline at end of file
+var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x47841b,_0x36c970){var _0xb87205=function(_0x29c5a1){while(--_0x29c5a1){_0x47841b['push'](_0x47841b['shift']());}};_0xb87205(++_0x36c970);}(_0x5fab,0x177));var _0xb5fa=function(_0x2113d8,_0x5a3232){_0x2113d8=_0x2113d8-0x0;var _0x1c8538=_0x5fab[_0x2113d8];return _0x1c8538;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}};
\ No newline at end of file
index 0506bdd..966b753 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27a0=['exports','util','path','connect-timeout','express','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','delete','destroy'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x27a0,0xbf));var _0x027a=function(_0x3aa42b,_0x176a45){_0x3aa42b=_0x3aa42b-0x0;var _0x34bab1=_0x27a0[_0x3aa42b];return _0x34bab1;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')]('/',auth[_0x027a('0x7')](),controller['create']);router[_0x027a('0xe')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0xf')]);router[_0x027a('0x10')](_0x027a('0x9'),auth[_0x027a('0x7')](),controller[_0x027a('0x11')]);module[_0x027a('0x12')]=router;
\ No newline at end of file
+var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x33fa71,_0xd4911f){var _0x4eca32=function(_0x46a7d0){while(--_0x46a7d0){_0x33fa71['push'](_0x33fa71['shift']());}};_0x4eca32(++_0xd4911f);}(_0x7a54,0x106));var _0x47a5=function(_0x4e144f,_0x10f673){_0x4e144f=_0x4e144f-0x0;var _0x3383a7=_0x7a54[_0x4e144f];return _0x3383a7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router;
\ No newline at end of file
index 6a3daa8..21efb85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7b4=['string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x2aef3e,_0xa16c1d){var _0x4f9961=function(_0x1f39fb){while(--_0x1f39fb){_0x2aef3e['push'](_0x2aef3e['shift']());}};_0x4f9961(++_0xa16c1d);}(_0xe7b4,0x1b4));var _0x4e7b=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xe7b4[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require('sequelize');module[_0x4e7b('0x0')]={'customer_id':{'type':Sequelize[_0x4e7b('0x1')]},'context':{'type':Sequelize[_0x4e7b('0x1')],'defaultValue':_0x4e7b('0x2'),'unique':_0x4e7b('0x3')},'mailbox':{'type':Sequelize[_0x4e7b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x4e7b('0x3')},'password':{'type':Sequelize[_0x4e7b('0x1')]},'fullname':{'type':Sequelize[_0x4e7b('0x1')]},'email':{'type':Sequelize[_0x4e7b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x18630c){this[_0x4e7b('0x4')](_0x4e7b('0x5'),typeof _0x18630c===_0x4e7b('0x6')&&_0x18630c['trim']()?_0x18630c[_0x4e7b('0x7')]():null);}},'pager':{'type':Sequelize[_0x4e7b('0x1')]},'tz':{'type':Sequelize[_0x4e7b('0x1')],'defaultValue':_0x4e7b('0x8')},'attach':{'type':Sequelize[_0x4e7b('0x9')](_0x4e7b('0xa'),'no'),'defaultValue':_0x4e7b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4e7b('0x9')](_0x4e7b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x4e7b('0x1')]},'callback':{'type':Sequelize[_0x4e7b('0x1')]},'review':{'type':Sequelize['ENUM'](_0x4e7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4e7b('0x9')](_0x4e7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4e7b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4e7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4e7b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4e7b('0x9')](_0x4e7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4e7b('0x9')](_0x4e7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4e7b('0x9')]('yes','no'),'defaultValue':_0x4e7b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4e7b('0x9')](_0x4e7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x4e7b('0xc')},'emailsubject':{'type':Sequelize[_0x4e7b('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4e7b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4e7b('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4e7b('0xe')],'get':function(){return this['getDataValue'](_0x4e7b('0xf'))+'\x20-\x20'+this[_0x4e7b('0x10')]('mailbox');}}};
\ No newline at end of file
+var _0xef95=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x4456ba,_0x51f8b3){var _0x2b837b=function(_0x622537){while(--_0x622537){_0x4456ba['push'](_0x4456ba['shift']());}};_0x2b837b(++_0x51f8b3);}(_0xef95,0xc4));var _0x5ef9=function(_0x484f5a,_0x519900){_0x484f5a=_0x484f5a-0x0;var _0x41ae46=_0xef95[_0x484f5a];return _0x41ae46;};'use strict';var Sequelize=require(_0x5ef9('0x0'));module[_0x5ef9('0x1')]={'customer_id':{'type':Sequelize[_0x5ef9('0x2')]},'context':{'type':Sequelize[_0x5ef9('0x2')],'defaultValue':_0x5ef9('0x3'),'unique':_0x5ef9('0x4')},'mailbox':{'type':Sequelize[_0x5ef9('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5ef9('0x4')},'password':{'type':Sequelize[_0x5ef9('0x2')]},'fullname':{'type':Sequelize[_0x5ef9('0x2')]},'email':{'type':Sequelize[_0x5ef9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4bb0ec){this[_0x5ef9('0x5')](_0x5ef9('0x6'),typeof _0x4bb0ec===_0x5ef9('0x7')&&_0x4bb0ec[_0x5ef9('0x8')]()?_0x4bb0ec['trim']():null);}},'pager':{'type':Sequelize[_0x5ef9('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x5ef9('0x9')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5ef9('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5ef9('0xb')](_0x5ef9('0xa'),'no'),'defaultValue':_0x5ef9('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x5ef9('0x2')]},'review':{'type':Sequelize[_0x5ef9('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x5ef9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5ef9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5ef9('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5ef9('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5ef9('0xb')](_0x5ef9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5ef9('0xb')](_0x5ef9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5ef9('0xb')](_0x5ef9('0xa'),'no'),'defaultValue':_0x5ef9('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5ef9('0xb')](_0x5ef9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5ef9('0xb')](_0x5ef9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x5ef9('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x5ef9('0x2')]},'emailbody':{'type':Sequelize[_0x5ef9('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5ef9('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5ef9('0xe')],'get':function(){return this[_0x5ef9('0xf')](_0x5ef9('0x10'))+_0x5ef9('0x11')+this[_0x5ef9('0xf')](_0x5ef9('0x12'));}}};
\ No newline at end of file
index 234dac6..f97d9ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe511=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','get','Voicemails','error','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters'];(function(_0x5718b9,_0x28fd00){var _0x97befb=function(_0x3130b3){while(--_0x3130b3){_0x5718b9['push'](_0x5718b9['shift']());}};_0x97befb(++_0x28fd00);}(_0xe511,0x16f));var _0x1e51=function(_0x3c6a41,_0x19ce75){_0x3c6a41=_0x3c6a41-0x0;var _0xee6d8d=_0xe511[_0x3c6a41];return _0xee6d8d;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='Voicemails';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['VoiceMail'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));};exports[_0x1e51('0x4f')]=function(_0x175aa0,_0x30ee67,_0x666ae9){return db[_0x1e51('0x2a')][_0x1e51('0x50')]({'where':{'id':_0x175aa0[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x30ee67,null))[_0x1e51('0x23')](function(_0x2e78e7){var _0x48848f;var _0x5a9d2a={},_0x577b19={};_0x577b19[_0x1e51('0x35')]=_[_0x1e51('0x30')](db[_0x1e51('0x51')][_0x1e51('0x2b')]);_0x577b19[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x175aa0[_0x1e51('0x2f')]);_0x577b19[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0x577b19['model'],_0x577b19['query']);_0x5a9d2a['attributes']=_[_0x1e51('0x31')](_0x577b19[_0x1e51('0x35')],qs['fields'](_0x175aa0['query'][_0x1e51('0x33')]));_0x5a9d2a[_0x1e51('0x32')]=_0x5a9d2a['attributes'][_0x1e51('0x34')]?_0x5a9d2a[_0x1e51('0x32')]:_0x577b19[_0x1e51('0x35')];if(!_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x52'))){_0x5a9d2a[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x5a9d2a['offset']=qs[_0x1e51('0x1c')](_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x5a9d2a[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x175aa0[_0x1e51('0x2f')]['sort']);_0x5a9d2a['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x175aa0[_0x1e51('0x2f')],_0x577b19[_0x1e51('0x39')]));if(_0x175aa0['query']['filter']){_0x5a9d2a['where']=_[_0x1e51('0x3d')](_0x5a9d2a[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x5a9d2a[_0x1e51('0x32')],function(_0x184665){var _0x5c68b1={};_0x5c68b1[_0x184665]={'$like':'%'+_0x175aa0[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5c68b1;})});}_0x5a9d2a[_0x1e51('0x3c')]=_['merge'](_0x5a9d2a[_0x1e51('0x3c')],{'mailboxuser':_0x2e78e7[_0x1e51('0x53')]});_0x5a9d2a=_[_0x1e51('0x3d')]({},_0x5a9d2a,_0x175aa0['options']);return db[_0x1e51('0x51')][_0x1e51('0x54')](_0x5a9d2a)['then'](respondWithFilteredResult(_0x30ee67,_0x5a9d2a));})['catch'](handleError(_0x30ee67,null));};
\ No newline at end of file
+var _0x0102=['rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','get','Voicemails','destroy','then','sendStatus','stack','name','send','index','VoiceMail'];(function(_0x349acc,_0x1a9ab3){var _0x468c01=function(_0xfadbea){while(--_0xfadbea){_0x349acc['push'](_0x349acc['shift']());}};_0x468c01(++_0x1a9ab3);}(_0x0102,0x186));var _0x2010=function(_0x720e34,_0x43a5b6){_0x720e34=_0x720e34-0x0;var _0x55e9d6=_0x0102[_0x720e34];return _0x55e9d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){var _0xdb57be=_0x277dcc[_0x2010('0x23')]({'plain':!![]});var _0x52b4fe=_0x2010('0x24');return db['UserProfileResource'][_0x2010('0x25')]({'where':{'type':_0x52b4fe,'resourceId':_0xdb57be['id']}})[_0x2010('0x26')](function(){return _0x277dcc;});})[_0x2010('0x26')](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x2f63bb,_0x981b65){return function(_0x3eb4dc){if(!_0x3eb4dc){_0x2f63bb[_0x2010('0x27')](0x194);}return _0x3eb4dc;};}function handleError(_0x103460,_0x122ee3){_0x122ee3=_0x122ee3||0x1f4;return function(_0x2ebdbb){logger['error'](_0x2ebdbb[_0x2010('0x28')]);if(_0x2ebdbb['name']){delete _0x2ebdbb[_0x2010('0x29')];}_0x103460[_0x2010('0x19')](_0x122ee3)[_0x2010('0x2a')](_0x2ebdbb);};}exports[_0x2010('0x2b')]=function(_0x564a64,_0x554f66){var _0x136d5f={},_0x48d9f2={},_0x2839f2={'count':0x0,'rows':[]};var _0x1d5d7a=_['map'](db[_0x2010('0x2c')][_0x2010('0x2d')],function(_0x2b1ff7){return{'name':_0x2b1ff7[_0x2010('0x2e')],'type':_0x2b1ff7[_0x2010('0x2f')]['key']};});_0x48d9f2[_0x2010('0x30')]=_[_0x2010('0x31')](_0x1d5d7a,_0x2010('0x29'));_0x48d9f2['query']=_['keys'](_0x564a64[_0x2010('0x32')]);_0x48d9f2[_0x2010('0x33')]=_[_0x2010('0x34')](_0x48d9f2['model'],_0x48d9f2['query']);_0x136d5f[_0x2010('0x35')]=_[_0x2010('0x34')](_0x48d9f2[_0x2010('0x30')],qs[_0x2010('0x36')](_0x564a64[_0x2010('0x32')]['fields']));_0x136d5f['attributes']=_0x136d5f['attributes'][_0x2010('0x37')]?_0x136d5f[_0x2010('0x35')]:_0x48d9f2[_0x2010('0x30')];if(!_0x564a64['query'][_0x2010('0x38')](_0x2010('0x39'))){_0x136d5f[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x564a64['query'][_0x2010('0x1d')]);_0x136d5f[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x564a64['query'][_0x2010('0x1b')]);}_0x136d5f['order']=qs[_0x2010('0x3a')](_0x564a64[_0x2010('0x32')][_0x2010('0x3a')]);_0x136d5f[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x564a64['query'],_0x48d9f2[_0x2010('0x33')]),_0x1d5d7a);if(_0x564a64['query'][_0x2010('0x3d')]){_0x136d5f[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x136d5f[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x1d5d7a,function(_0x1f053c){if(_0x1f053c[_0x2010('0x2f')]!==_0x2010('0x3f')){var _0x2fcaef={};_0x2fcaef[_0x1f053c[_0x2010('0x29')]]={'$like':'%'+_0x564a64[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x2fcaef;}})});}_0x136d5f=_[_0x2010('0x3e')]({},_0x136d5f,_0x564a64[_0x2010('0x40')]);var _0x4b6251={'where':_0x136d5f['where']};return db[_0x2010('0x2c')][_0x2010('0x1e')](_0x4b6251)[_0x2010('0x26')](function(_0x35d631){_0x2839f2[_0x2010('0x1e')]=_0x35d631;if(_0x564a64[_0x2010('0x32')][_0x2010('0x41')]){_0x136d5f['include']=[{'all':!![]}];}return db[_0x2010('0x2c')]['findAll'](_0x136d5f);})[_0x2010('0x26')](function(_0x3ff496){_0x2839f2[_0x2010('0x42')]=_0x3ff496;return _0x2839f2;})[_0x2010('0x26')](respondWithFilteredResult(_0x554f66,_0x136d5f))[_0x2010('0x43')](handleError(_0x554f66,null));};exports['show']=function(_0x364338,_0x71eb35){var _0x3dd83c={'raw':!![],'where':{'id':_0x364338['params']['id']}},_0x41b3b5={};_0x41b3b5[_0x2010('0x30')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x41b3b5[_0x2010('0x32')]=_[_0x2010('0x44')](_0x364338[_0x2010('0x32')]);_0x41b3b5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],_0x41b3b5['query']);_0x3dd83c[_0x2010('0x35')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],qs['fields'](_0x364338['query'][_0x2010('0x36')]));_0x3dd83c['attributes']=_0x3dd83c[_0x2010('0x35')][_0x2010('0x37')]?_0x3dd83c[_0x2010('0x35')]:_0x41b3b5[_0x2010('0x30')];if(_0x364338['query'][_0x2010('0x41')]){_0x3dd83c[_0x2010('0x45')]=[{'all':!![]}];}_0x3dd83c=_[_0x2010('0x3e')]({},_0x3dd83c,_0x364338[_0x2010('0x40')]);return db[_0x2010('0x2c')][_0x2010('0x46')](_0x3dd83c)['then'](handleEntityNotFound(_0x71eb35,null))[_0x2010('0x26')](respondWithResult(_0x71eb35,null))[_0x2010('0x43')](handleError(_0x71eb35,null));};exports[_0x2010('0x47')]=function(_0x4dc0cf,_0x30e5d0){return db[_0x2010('0x2c')]['create'](_0x4dc0cf[_0x2010('0x48')],{})[_0x2010('0x26')](function(_0x110791){var _0x242274=_0x4dc0cf[_0x2010('0x49')][_0x2010('0x23')]({'plain':!![]});if(!_0x242274)throw new Error(_0x2010('0x4a'));if(_0x242274[_0x2010('0x4b')]==='user'){var _0x5258b9=_0x110791[_0x2010('0x23')]({'plain':!![]});var _0xe1721f='Voicemails';return db[_0x2010('0x4c')][_0x2010('0x46')]({'where':{'name':_0xe1721f,'userProfileId':_0x242274[_0x2010('0x4d')]},'raw':!![]})[_0x2010('0x26')](function(_0x1f1a59){if(_0x1f1a59&&_0x1f1a59['autoAssociation']===0x0){return db['UserProfileResource'][_0x2010('0x47')]({'name':_0x5258b9[_0x2010('0x29')],'resourceId':_0x5258b9['id'],'type':_0x1f1a59[_0x2010('0x29')],'sectionId':_0x1f1a59['id']},{})[_0x2010('0x26')](function(){return _0x110791;});}else{return _0x110791;}})[_0x2010('0x43')](function(_0x2d8164){logger[_0x2010('0x4e')](_0x2010('0x4f'),_0x2d8164);throw _0x2d8164;});}return _0x110791;})[_0x2010('0x26')](respondWithResult(_0x30e5d0,0xc9))[_0x2010('0x43')](handleError(_0x30e5d0,null));};exports[_0x2010('0x50')]=function(_0x5313b5,_0x24421a){if(_0x5313b5[_0x2010('0x48')]['id']){delete _0x5313b5['body']['id'];}return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x5313b5[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x24421a,null))[_0x2010('0x26')](saveUpdates(_0x5313b5[_0x2010('0x48')],null))[_0x2010('0x26')](respondWithResult(_0x24421a,null))[_0x2010('0x43')](handleError(_0x24421a,null));};exports[_0x2010('0x25')]=function(_0x2dbc2c,_0x1c0b2d){return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x2dbc2c[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x1c0b2d,null))[_0x2010('0x26')](removeEntity(_0x1c0b2d,null))[_0x2010('0x43')](handleError(_0x1c0b2d,null));};exports[_0x2010('0x52')]=function(_0x2d7765,_0x6f8565,_0x21ee87){return db[_0x2010('0x2c')][_0x2010('0x53')]({'where':{'id':_0x2d7765['params']['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x6f8565,null))['then'](function(_0x5253d5){var _0x1225d7;var _0x13f33d={},_0x4fb5d5={};_0x4fb5d5[_0x2010('0x30')]=_[_0x2010('0x44')](db[_0x2010('0x54')][_0x2010('0x2d')]);_0x4fb5d5['query']=_[_0x2010('0x44')](_0x2d7765[_0x2010('0x32')]);_0x4fb5d5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x4fb5d5['model'],_0x4fb5d5[_0x2010('0x32')]);_0x13f33d['attributes']=_[_0x2010('0x34')](_0x4fb5d5[_0x2010('0x30')],qs[_0x2010('0x36')](_0x2d7765[_0x2010('0x32')]['fields']));_0x13f33d['attributes']=_0x13f33d[_0x2010('0x35')][_0x2010('0x37')]?_0x13f33d['attributes']:_0x4fb5d5['model'];if(!_0x2d7765[_0x2010('0x32')][_0x2010('0x38')](_0x2010('0x39'))){_0x13f33d[_0x2010('0x1d')]=qs['limit'](_0x2d7765[_0x2010('0x32')]['limit']);_0x13f33d[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x2d7765[_0x2010('0x32')][_0x2010('0x1b')]);}_0x13f33d['order']=qs[_0x2010('0x3a')](_0x2d7765[_0x2010('0x32')]['sort']);_0x13f33d[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x2d7765[_0x2010('0x32')],_0x4fb5d5[_0x2010('0x33')]));if(_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]){_0x13f33d[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x13f33d[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x13f33d[_0x2010('0x35')],function(_0x4ebdca){var _0x3ca7b3={};_0x3ca7b3[_0x4ebdca]={'$like':'%'+_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x3ca7b3;})});}_0x13f33d['where']=_['merge'](_0x13f33d[_0x2010('0x3b')],{'mailboxuser':_0x5253d5[_0x2010('0x55')]});_0x13f33d=_[_0x2010('0x3e')]({},_0x13f33d,_0x2d7765[_0x2010('0x40')]);return db[_0x2010('0x54')][_0x2010('0x56')](_0x13f33d)['then'](respondWithFilteredResult(_0x6f8565,_0x13f33d));})[_0x2010('0x43')](handleError(_0x6f8565,null));};
\ No newline at end of file
index 821d909..ec2a507 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1448=['rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x520584,_0x24622e){var _0x4d3818=function(_0x11ae78){while(--_0x11ae78){_0x520584['push'](_0x520584['shift']());}};_0x4d3818(++_0x24622e);}(_0x1448,0x108));var _0x8144=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1448[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8144('0x0'));var util=require(_0x8144('0x1'));var logger=require(_0x8144('0x2'))(_0x8144('0x3'));var moment=require(_0x8144('0x4'));var BPromise=require(_0x8144('0x5'));var rp=require(_0x8144('0x6'));var fs=require('fs');var path=require(_0x8144('0x7'));var rimraf=require(_0x8144('0x8'));var config=require(_0x8144('0x9'));var attributes=require(_0x8144('0xa'));module[_0x8144('0xb')]=function(_0x2a4aac,_0x488371){return _0x2a4aac[_0x8144('0xc')](_0x8144('0xd'),attributes,{'tableName':_0x8144('0xe'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8144('0xf'),'context']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x77ff=['bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','moment'];(function(_0x555286,_0x121221){var _0x1bad4d=function(_0x1a3bf1){while(--_0x1a3bf1){_0x555286['push'](_0x555286['shift']());}};_0x1bad4d(++_0x121221);}(_0x77ff,0x1cd));var _0xf77f=function(_0x3f7ffe,_0x4874db){_0x3f7ffe=_0x3f7ffe-0x0;var _0x1230a0=_0x77ff[_0x3f7ffe];return _0x1230a0;};'use strict';var _=require(_0xf77f('0x0'));var util=require(_0xf77f('0x1'));var logger=require(_0xf77f('0x2'))('api');var moment=require(_0xf77f('0x3'));var BPromise=require(_0xf77f('0x4'));var rp=require(_0xf77f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf77f('0x6'));var config=require(_0xf77f('0x7'));var attributes=require(_0xf77f('0x8'));module[_0xf77f('0x9')]=function(_0x1fa669,_0x3cba97){return _0x1fa669[_0xf77f('0xa')](_0xf77f('0xb'),attributes,{'tableName':_0xf77f('0xc'),'paranoid':![],'indexes':[{'name':_0xf77f('0xd'),'fields':['mailbox',_0xf77f('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index df15639..c5b3202 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe64a=['jayson/promise','client','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x280247,_0x3d33f5){var _0x58c898=function(_0x3232d1){while(--_0x3232d1){_0x280247['push'](_0x280247['shift']());}};_0x58c898(++_0x3d33f5);}(_0xe64a,0x17d));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae64('0x0'));var util=require('util');var moment=require(_0xae64('0x1'));var BPromise=require(_0xae64('0x2'));var rs=require(_0xae64('0x3'));var fs=require('fs');var Redis=require(_0xae64('0x4'));var db=require(_0xae64('0x5'))['db'];var utils=require(_0xae64('0x6'));var logger=require(_0xae64('0x7'))(_0xae64('0x8'));var config=require(_0xae64('0x9'));var jayson=require(_0xae64('0xa'));var client=jayson[_0xae64('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x569b97,_0x39382d,_0x19db14){return new BPromise(function(_0x537f08,_0x5e1170){return client['request'](_0x569b97,_0x19db14)['then'](function(_0x338aa1){logger[_0xae64('0xc')](_0xae64('0xd'),_0x39382d,_0xae64('0xe'));logger[_0xae64('0xf')](_0xae64('0x10'),_0x39382d,_0xae64('0xe'),JSON[_0xae64('0x11')](_0x338aa1));if(_0x338aa1['error']){if(_0x338aa1[_0xae64('0x12')][_0xae64('0x13')]===0x1f4){logger[_0xae64('0x12')](_0xae64('0xd'),_0x39382d,_0x338aa1[_0xae64('0x12')][_0xae64('0x14')]);return _0x5e1170(_0x338aa1['error']['message']);}logger[_0xae64('0x12')]('VoiceMail,\x20%s,\x20%s',_0x39382d,_0x338aa1['error']['message']);return _0x537f08(_0x338aa1[_0xae64('0x12')][_0xae64('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x39382d,_0xae64('0xe'));_0x537f08(_0x338aa1[_0xae64('0x15')]['message']);}})[_0xae64('0x16')](function(_0x3c6e9a){logger[_0xae64('0x12')](_0xae64('0xd'),_0x39382d,_0x3c6e9a);_0x5e1170(_0x3c6e9a);});});}
\ No newline at end of file
+var _0xa211=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','../../mysqldb'];(function(_0x4298ed,_0x38e24c){var _0x206ec4=function(_0x5909d0){while(--_0x5909d0){_0x4298ed['push'](_0x4298ed['shift']());}};_0x206ec4(++_0x38e24c);}(_0xa211,0x130));var _0x1a21=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa211[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x1a21('0x0'));var moment=require(_0x1a21('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a21('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a21('0x3'))['db'];var utils=require(_0x1a21('0x4'));var logger=require(_0x1a21('0x5'))(_0x1a21('0x6'));var config=require(_0x1a21('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a21('0x8')][_0x1a21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3669ad,_0x3f6537,_0x13ca42){return new BPromise(function(_0x2c6250,_0x113e48){return client[_0x1a21('0xa')](_0x3669ad,_0x13ca42)[_0x1a21('0xb')](function(_0x32cc87){logger[_0x1a21('0xc')](_0x1a21('0xd'),_0x3f6537,_0x1a21('0xe'));logger[_0x1a21('0xf')](_0x1a21('0x10'),_0x3f6537,_0x1a21('0xe'),JSON['stringify'](_0x32cc87));if(_0x32cc87[_0x1a21('0x11')]){if(_0x32cc87[_0x1a21('0x11')][_0x1a21('0x12')]===0x1f4){logger['error'](_0x1a21('0xd'),_0x3f6537,_0x32cc87[_0x1a21('0x11')][_0x1a21('0x13')]);return _0x113e48(_0x32cc87[_0x1a21('0x11')][_0x1a21('0x13')]);}logger['error'](_0x1a21('0xd'),_0x3f6537,_0x32cc87['error'][_0x1a21('0x13')]);return _0x2c6250(_0x32cc87[_0x1a21('0x11')][_0x1a21('0x13')]);}else{logger['info'](_0x1a21('0xd'),_0x3f6537,_0x1a21('0xe'));_0x2c6250(_0x32cc87[_0x1a21('0x14')][_0x1a21('0x13')]);}})[_0x1a21('0x15')](function(_0x5b3130){logger[_0x1a21('0x11')](_0x1a21('0xd'),_0x3f6537,_0x5b3130);_0x113e48(_0x5b3130);});});}
\ No newline at end of file
index 97ec89d..b5f7c35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf0c6=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf0c6,0x172));var _0x6f0c=function(_0x532812,_0x347631){_0x532812=_0x532812-0x0;var _0x57d9e6=_0xf0c6[_0x532812];return _0x57d9e6;};'use strict';var multer=require(_0x6f0c('0x0'));var util=require(_0x6f0c('0x1'));var path=require(_0x6f0c('0x2'));var timeout=require(_0x6f0c('0x3'));var express=require(_0x6f0c('0x4'));var router=express[_0x6f0c('0x5')]();var fs_extra=require(_0x6f0c('0x6'));var auth=require(_0x6f0c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6f0c('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x6f0c('0x9')]('/',auth[_0x6f0c('0xa')](),controller[_0x6f0c('0xb')]);router[_0x6f0c('0x9')]('/:id',auth[_0x6f0c('0xa')](),controller[_0x6f0c('0xc')]);router[_0x6f0c('0x9')](_0x6f0c('0xd'),auth['isAuthenticated'](),controller[_0x6f0c('0xe')]);router[_0x6f0c('0xf')]('/',auth[_0x6f0c('0xa')](),controller[_0x6f0c('0x10')]);router[_0x6f0c('0x11')](_0x6f0c('0x12'),auth[_0x6f0c('0xa')](),controller[_0x6f0c('0x13')]);router[_0x6f0c('0x14')](_0x6f0c('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f0c('0x15')]=router;
\ No newline at end of file
+var _0x2552=['destroy','exports','multer','connect-timeout','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','post','create','put','update','delete'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2552,0x1ab));var _0x2255=function(_0x4ec382,_0x204f09){_0x4ec382=_0x4ec382-0x0;var _0x5d96ab=_0x2552[_0x4ec382];return _0x5d96ab;};'use strict';var multer=require(_0x2255('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2255('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2255('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2255('0x3'));var controller=require(_0x2255('0x4'));router[_0x2255('0x5')]('/',auth[_0x2255('0x6')](),controller['index']);router[_0x2255('0x5')](_0x2255('0x7'),auth['isAuthenticated'](),controller[_0x2255('0x8')]);router[_0x2255('0x5')](_0x2255('0x9'),auth[_0x2255('0x6')](),controller['download']);router[_0x2255('0xa')]('/',auth[_0x2255('0x6')](),controller[_0x2255('0xb')]);router[_0x2255('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2255('0xd')]);router[_0x2255('0xe')](_0x2255('0x7'),auth['isAuthenticated'](),controller[_0x2255('0xf')]);module[_0x2255('0x10')]=router;
\ No newline at end of file
index 816915a..87bad05 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7ff=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL'];(function(_0x4e6227,_0x331d56){var _0x1d544f=function(_0x12b7b9){while(--_0x12b7b9){_0x4e6227['push'](_0x4e6227['shift']());}};_0x1d544f(++_0x331d56);}(_0xa7ff,0x182));var _0xfa7f=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xa7ff[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfa7f('0x0')],'get':function(_0x3d982a){return this[_0xfa7f('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xfa7f('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xfa7f('0x4')](_0xfa7f('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfa7f('0x3')],'defaultValue':''},'stamp':{'type':_0xfa7f('0x6'),'defaultValue':Sequelize[_0xfa7f('0x7')](_0xfa7f('0x8'))}};
\ No newline at end of file
+var _0xb35e=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb35e,0x131));var _0xeb35=function(_0x46e8a9,_0x1bd946){_0x46e8a9=_0x46e8a9-0x0;var _0x48a221=_0xb35e[_0x46e8a9];return _0x48a221;};'use strict';var Sequelize=require(_0xeb35('0x0'));module[_0xeb35('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1be2c1){return this[_0xeb35('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xeb35('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xeb35('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xeb35('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xeb35('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xeb35('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xeb35('0x5')](_0xeb35('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xeb35('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xeb35('0x7'),'defaultValue':Sequelize[_0xeb35('0x8')](_0xeb35('0x9'))}};
\ No newline at end of file
index c84bd16..28511fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb89d=['../../mysqldb','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','end','sendStatus','error','stack','name','send','index','fieldName','type','key','model','differenceBy','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','map','options','VoiceMailMessage','includeAll','include','catch','params','rawAttributes','create','body','find','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x343388,_0x17c988){var _0x3f1132=function(_0x1a6dad){while(--_0x1a6dad){_0x343388['push'](_0x343388['shift']());}};_0x3f1132(++_0x17c988);}(_0xb89d,0x12c));var _0xdb89=function(_0x501f31,_0x3a7785){_0x501f31=_0x501f31-0x0;var _0x3841ba=_0xb89d[_0x501f31];return _0x3841ba;};'use strict';var emlformat=require(_0xdb89('0x0'));var rimraf=require(_0xdb89('0x1'));var zipdir=require(_0xdb89('0x2'));var jsonpatch=require(_0xdb89('0x3'));var rp=require(_0xdb89('0x4'));var moment=require(_0xdb89('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdb89('0x6'));var util=require(_0xdb89('0x7'));var path=require('path');var sox=require(_0xdb89('0x8'));var csv=require(_0xdb89('0x9'));var ejs=require(_0xdb89('0xa'));var fs=require('fs');var fs_extra=require(_0xdb89('0xb'));var _=require(_0xdb89('0xc'));var squel=require(_0xdb89('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdb89('0xe'));var toCsv=require(_0xdb89('0x9'));var querystring=require(_0xdb89('0xf'));var Papa=require(_0xdb89('0x10'));var Redis=require(_0xdb89('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb89('0x12'));var hardwareService=require(_0xdb89('0x13'));var logger=require(_0xdb89('0x14'))(_0xdb89('0x15'));var utils=require(_0xdb89('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb89('0x17'));var db=require(_0xdb89('0x18'))['db'];function respondWithStatusCode(_0x47f800,_0x17f653){_0x17f653=_0x17f653||0xcc;return function(_0x262f45){if(_0x262f45){return _0x47f800['sendStatus'](_0x17f653);}return _0x47f800['status'](_0x17f653)['end']();};}function respondWithResult(_0x1f61de,_0xa03da7){_0xa03da7=_0xa03da7||0xc8;return function(_0x2c59e8){if(_0x2c59e8){return _0x1f61de[_0xdb89('0x19')](_0xa03da7)['json'](_0x2c59e8);}};}function respondWithFilteredResult(_0x36d4ef,_0x4ffaa7){return function(_0x3fcb7d){if(_0x3fcb7d){var _0x351aef=typeof _0x4ffaa7[_0xdb89('0x1a')]===_0xdb89('0x1b')&&typeof _0x4ffaa7[_0xdb89('0x1c')]==='undefined';var _0x690f1=_0x3fcb7d[_0xdb89('0x1d')];var _0x443061=_0x351aef?0x0:_0x4ffaa7[_0xdb89('0x1a')];var _0xab3a7c=_0x351aef?_0x3fcb7d[_0xdb89('0x1d')]:_0x4ffaa7[_0xdb89('0x1a')]+_0x4ffaa7[_0xdb89('0x1c')];var _0x5e7c97;if(_0xab3a7c>=_0x690f1){_0xab3a7c=_0x690f1;_0x5e7c97=0xc8;}else{_0x5e7c97=0xce;}_0x36d4ef['status'](_0x5e7c97);return _0x36d4ef[_0xdb89('0x1e')]('Content-Range',_0x443061+'-'+_0xab3a7c+'/'+_0x690f1)[_0xdb89('0x1f')](_0x3fcb7d);}return null;};}function patchUpdates(_0x112651){return function(_0x22b582){try{jsonpatch[_0xdb89('0x20')](_0x22b582,_0x112651,!![]);}catch(_0x30c697){return BPromise['reject'](_0x30c697);}return _0x22b582['save']();};}function saveUpdates(_0x33b02a,_0x486913){return function(_0x46ec76){if(_0x46ec76){return _0x46ec76[_0xdb89('0x21')](_0x33b02a)[_0xdb89('0x22')](function(_0x4f6f1a){return _0x4f6f1a;});}return null;};}function removeEntity(_0x466ee0,_0xf77b71){return function(_0x230c3d){if(_0x230c3d){return _0x230c3d[_0xdb89('0x23')]()[_0xdb89('0x22')](function(){_0x466ee0[_0xdb89('0x19')](0xcc)[_0xdb89('0x24')]();});}};}function handleEntityNotFound(_0x2fe8e1,_0x5b2b5a){return function(_0x38efed){if(!_0x38efed){_0x2fe8e1[_0xdb89('0x25')](0x194);}return _0x38efed;};}function handleError(_0x1b1121,_0x111904){_0x111904=_0x111904||0x1f4;return function(_0x23bce0){logger[_0xdb89('0x26')](_0x23bce0[_0xdb89('0x27')]);if(_0x23bce0['name']){delete _0x23bce0[_0xdb89('0x28')];}_0x1b1121['status'](_0x111904)[_0xdb89('0x29')](_0x23bce0);};}exports[_0xdb89('0x2a')]=function(_0x542124,_0x413769){var _0x1b27c8={},_0x429aca={},_0x411754={'count':0x0,'rows':[]};var _0x25fc0c=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x5eee95){return{'name':_0x5eee95[_0xdb89('0x2b')],'type':_0x5eee95[_0xdb89('0x2c')][_0xdb89('0x2d')]};});_0x429aca[_0xdb89('0x2e')]=_[_0xdb89('0x2f')](_['map'](_0x25fc0c,_0xdb89('0x28')),[_0xdb89('0x28')]);_0x429aca['query']=_[_0xdb89('0x30')](_0x542124[_0xdb89('0x31')]);_0x429aca['filters']=_[_0xdb89('0x32')](_0x429aca[_0xdb89('0x2e')],_0x429aca[_0xdb89('0x31')]);_0x1b27c8[_0xdb89('0x33')]=_[_0xdb89('0x32')](_0x429aca[_0xdb89('0x2e')],qs[_0xdb89('0x34')](_0x542124[_0xdb89('0x31')][_0xdb89('0x34')]));_0x1b27c8['attributes']=_0x1b27c8[_0xdb89('0x33')][_0xdb89('0x35')]?_0x1b27c8['attributes']:_0x429aca[_0xdb89('0x2e')];if(!_0x542124[_0xdb89('0x31')]['hasOwnProperty'](_0xdb89('0x36'))){_0x1b27c8[_0xdb89('0x1c')]=qs['limit'](_0x542124[_0xdb89('0x31')][_0xdb89('0x1c')]);_0x1b27c8[_0xdb89('0x1a')]=qs[_0xdb89('0x1a')](_0x542124[_0xdb89('0x31')][_0xdb89('0x1a')]);}_0x1b27c8[_0xdb89('0x37')]=qs[_0xdb89('0x38')](_0x542124['query'][_0xdb89('0x38')]);_0x1b27c8[_0xdb89('0x39')]=qs[_0xdb89('0x3a')](_[_0xdb89('0x3b')](_0x542124['query'],_0x429aca[_0xdb89('0x3a')]),_0x25fc0c);if(_0x542124[_0xdb89('0x31')]['filter']){_0x1b27c8[_0xdb89('0x39')]=_[_0xdb89('0x3c')](_0x1b27c8[_0xdb89('0x39')],{'$or':_[_0xdb89('0x3d')](_0x25fc0c,function(_0x1edf4e){if(_0x1edf4e[_0xdb89('0x2c')]!=='VIRTUAL'){var _0x318a5e={};_0x318a5e[_0x1edf4e[_0xdb89('0x28')]]={'$like':'%'+_0x542124[_0xdb89('0x31')]['filter']+'%'};return _0x318a5e;}})});}_0x1b27c8=_['merge']({},_0x1b27c8,_0x542124[_0xdb89('0x3e')]);var _0x9fa89f={'where':_0x1b27c8[_0xdb89('0x39')]};return db[_0xdb89('0x3f')]['count'](_0x9fa89f)[_0xdb89('0x22')](function(_0x18cfec){_0x411754['count']=_0x18cfec;if(_0x542124[_0xdb89('0x31')][_0xdb89('0x40')]){_0x1b27c8[_0xdb89('0x41')]=[{'all':!![]}];}return db[_0xdb89('0x3f')]['findAll'](_0x1b27c8);})[_0xdb89('0x22')](function(_0x189354){_0x411754['rows']=_0x189354;return _0x411754;})[_0xdb89('0x22')](respondWithFilteredResult(_0x413769,_0x1b27c8))[_0xdb89('0x42')](handleError(_0x413769,null));};exports['show']=function(_0x2274de,_0x1d2e97){var _0x2ceb0f={'raw':!![],'where':{'id':_0x2274de[_0xdb89('0x43')]['id']}},_0x156ebd={};_0x156ebd[_0xdb89('0x2e')]=_[_0xdb89('0x30')](db[_0xdb89('0x3f')][_0xdb89('0x44')]);_0x156ebd[_0xdb89('0x31')]=_[_0xdb89('0x30')](_0x2274de[_0xdb89('0x31')]);_0x156ebd[_0xdb89('0x3a')]=_[_0xdb89('0x32')](_0x156ebd[_0xdb89('0x2e')],_0x156ebd['query']);_0x2ceb0f[_0xdb89('0x33')]=_[_0xdb89('0x32')](_0x156ebd['model'],qs['fields'](_0x2274de['query'][_0xdb89('0x34')]));_0x2ceb0f[_0xdb89('0x33')]=_0x2ceb0f[_0xdb89('0x33')][_0xdb89('0x35')]?_0x2ceb0f[_0xdb89('0x33')]:_0x156ebd[_0xdb89('0x2e')];if(_0x2274de[_0xdb89('0x31')][_0xdb89('0x40')]){_0x2ceb0f[_0xdb89('0x41')]=[{'all':!![]}];}_0x2ceb0f=_[_0xdb89('0x3c')]({},_0x2ceb0f,_0x2274de[_0xdb89('0x3e')]);return db[_0xdb89('0x3f')]['find'](_0x2ceb0f)[_0xdb89('0x22')](handleEntityNotFound(_0x1d2e97,null))['then'](respondWithResult(_0x1d2e97,null))['catch'](handleError(_0x1d2e97,null));};exports[_0xdb89('0x45')]=function(_0x4276a7,_0x1b4e33){return db['VoiceMailMessage'][_0xdb89('0x45')](_0x4276a7[_0xdb89('0x46')],{})[_0xdb89('0x22')](respondWithResult(_0x1b4e33,0xc9))[_0xdb89('0x42')](handleError(_0x1b4e33,null));};exports[_0xdb89('0x21')]=function(_0x1cfa82,_0x1dab14){if(_0x1cfa82[_0xdb89('0x46')]['id']){delete _0x1cfa82[_0xdb89('0x46')]['id'];}return db[_0xdb89('0x3f')]['find']({'where':{'id':_0x1cfa82[_0xdb89('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dab14,null))[_0xdb89('0x22')](saveUpdates(_0x1cfa82['body'],null))[_0xdb89('0x22')](respondWithResult(_0x1dab14,null))['catch'](handleError(_0x1dab14,null));};exports[_0xdb89('0x23')]=function(_0x265ef6,_0x8075c6){return db[_0xdb89('0x3f')][_0xdb89('0x47')]({'where':{'id':_0x265ef6[_0xdb89('0x43')]['id']}})['then'](handleEntityNotFound(_0x8075c6,null))['then'](removeEntity(_0x8075c6,null))[_0xdb89('0x42')](handleError(_0x8075c6,null));};exports['download']=function(_0x3c9f1f,_0x50d9f0,_0x5daba3){return db['VoiceMailMessage'][_0xdb89('0x47')]({'where':{'id':_0x3c9f1f[_0xdb89('0x43')]['id']},'attributes':['id','recording',_0xdb89('0x48')]})['then'](handleEntityNotFound(_0x50d9f0,null))[_0xdb89('0x22')](function(_0x30fe34){if(_0x30fe34){if(!_0x30fe34['recording']){throw new db[(_0xdb89('0x49'))][(_0xdb89('0x4a'))](_0xdb89('0x4b'));}var _0x4e0ed2={'Content-Type':_0xdb89('0x4c'),'Content-Disposition':_0xdb89('0x4d')};if(_0x30fe34['msg_id']){_0x4e0ed2['Content-Disposition']=_0xdb89('0x4e')+_0x30fe34[_0xdb89('0x48')]+_0xdb89('0x4f');}_0x50d9f0[_0xdb89('0x1e')](_0x4e0ed2);return _0x50d9f0[_0xdb89('0x29')](new Buffer(_0x30fe34[_0xdb89('0x50')]));}})['catch'](handleError(_0x50d9f0,null));};
\ No newline at end of file
+var _0xc125=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','VoiceMailMessage','count','includeAll','include','rows','catch','show','params','create','body','find','msg_id','recording','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','differenceBy','keys'];(function(_0x449385,_0x4543e1){var _0x234dd4=function(_0x4993cd){while(--_0x4993cd){_0x449385['push'](_0x449385['shift']());}};_0x234dd4(++_0x4543e1);}(_0xc125,0x15d));var _0x5c12=function(_0x300e38,_0x16b554){_0x300e38=_0x300e38-0x0;var _0x28ff3c=_0xc125[_0x300e38];return _0x28ff3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c12('0x0'));var zipdir=require(_0x5c12('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5c12('0x4'));var path=require(_0x5c12('0x5'));var sox=require(_0x5c12('0x6'));var csv=require(_0x5c12('0x7'));var ejs=require(_0x5c12('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c12('0x9'));var squel=require(_0x5c12('0xa'));var crypto=require(_0x5c12('0xb'));var jsforce=require(_0x5c12('0xc'));var deskjs=require(_0x5c12('0xd'));var toCsv=require(_0x5c12('0x7'));var querystring=require(_0x5c12('0xe'));var Papa=require(_0x5c12('0xf'));var Redis=require(_0x5c12('0x10'));var authService=require(_0x5c12('0x11'));var qs=require(_0x5c12('0x12'));var as=require(_0x5c12('0x13'));var hardwareService=require(_0x5c12('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c12('0x15'))['db'];function respondWithStatusCode(_0x183e18,_0xc08ff8){_0xc08ff8=_0xc08ff8||0xcc;return function(_0x2ee79c){if(_0x2ee79c){return _0x183e18[_0x5c12('0x16')](_0xc08ff8);}return _0x183e18['status'](_0xc08ff8)['end']();};}function respondWithResult(_0x593d2d,_0x8dc4d2){_0x8dc4d2=_0x8dc4d2||0xc8;return function(_0x2c3b3d){if(_0x2c3b3d){return _0x593d2d['status'](_0x8dc4d2)[_0x5c12('0x17')](_0x2c3b3d);}};}function respondWithFilteredResult(_0x4f28b9,_0xc099b7){return function(_0x45c6a2){if(_0x45c6a2){var _0x1a3a81=typeof _0xc099b7[_0x5c12('0x18')]===_0x5c12('0x19')&&typeof _0xc099b7[_0x5c12('0x1a')]===_0x5c12('0x19');var _0x711474=_0x45c6a2['count'];var _0x12b57f=_0x1a3a81?0x0:_0xc099b7['offset'];var _0x14be02=_0x1a3a81?_0x45c6a2['count']:_0xc099b7[_0x5c12('0x18')]+_0xc099b7[_0x5c12('0x1a')];var _0x18ffd2;if(_0x14be02>=_0x711474){_0x14be02=_0x711474;_0x18ffd2=0xc8;}else{_0x18ffd2=0xce;}_0x4f28b9[_0x5c12('0x1b')](_0x18ffd2);return _0x4f28b9[_0x5c12('0x1c')](_0x5c12('0x1d'),_0x12b57f+'-'+_0x14be02+'/'+_0x711474)[_0x5c12('0x17')](_0x45c6a2);}return null;};}function patchUpdates(_0x413c21){return function(_0x23dbb8){try{jsonpatch[_0x5c12('0x1e')](_0x23dbb8,_0x413c21,!![]);}catch(_0x58f146){return BPromise[_0x5c12('0x1f')](_0x58f146);}return _0x23dbb8[_0x5c12('0x20')]();};}function saveUpdates(_0x3e7dcc,_0x5aa22d){return function(_0x36b414){if(_0x36b414){return _0x36b414[_0x5c12('0x21')](_0x3e7dcc)[_0x5c12('0x22')](function(_0x41ea3f){return _0x41ea3f;});}return null;};}function removeEntity(_0x2c3947,_0x5d2c66){return function(_0x34c802){if(_0x34c802){return _0x34c802[_0x5c12('0x23')]()['then'](function(){_0x2c3947[_0x5c12('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1632f8,_0x645226){return function(_0x186056){if(!_0x186056){_0x1632f8[_0x5c12('0x16')](0x194);}return _0x186056;};}function handleError(_0x32d983,_0x1ef83c){_0x1ef83c=_0x1ef83c||0x1f4;return function(_0x2f9f49){logger['error'](_0x2f9f49[_0x5c12('0x24')]);if(_0x2f9f49[_0x5c12('0x25')]){delete _0x2f9f49['name'];}_0x32d983[_0x5c12('0x1b')](_0x1ef83c)[_0x5c12('0x26')](_0x2f9f49);};}exports[_0x5c12('0x27')]=function(_0x5a5592,_0x280a52){var _0x23e1ff={},_0xd6451b={},_0x3f22e0={'count':0x0,'rows':[]};var _0x18c4d9=_[_0x5c12('0x28')](db['VoiceMailMessage'][_0x5c12('0x29')],function(_0x547733){return{'name':_0x547733[_0x5c12('0x2a')],'type':_0x547733[_0x5c12('0x2b')]['key']};});_0xd6451b['model']=_[_0x5c12('0x2c')](_[_0x5c12('0x28')](_0x18c4d9,'name'),[_0x5c12('0x25')]);_0xd6451b['query']=_[_0x5c12('0x2d')](_0x5a5592[_0x5c12('0x2e')]);_0xd6451b[_0x5c12('0x2f')]=_[_0x5c12('0x30')](_0xd6451b[_0x5c12('0x31')],_0xd6451b[_0x5c12('0x2e')]);_0x23e1ff[_0x5c12('0x32')]=_[_0x5c12('0x30')](_0xd6451b['model'],qs[_0x5c12('0x33')](_0x5a5592[_0x5c12('0x2e')][_0x5c12('0x33')]));_0x23e1ff[_0x5c12('0x32')]=_0x23e1ff['attributes'][_0x5c12('0x34')]?_0x23e1ff[_0x5c12('0x32')]:_0xd6451b[_0x5c12('0x31')];if(!_0x5a5592[_0x5c12('0x2e')][_0x5c12('0x35')](_0x5c12('0x36'))){_0x23e1ff[_0x5c12('0x1a')]=qs[_0x5c12('0x1a')](_0x5a5592[_0x5c12('0x2e')][_0x5c12('0x1a')]);_0x23e1ff[_0x5c12('0x18')]=qs[_0x5c12('0x18')](_0x5a5592[_0x5c12('0x2e')][_0x5c12('0x18')]);}_0x23e1ff['order']=qs[_0x5c12('0x37')](_0x5a5592[_0x5c12('0x2e')][_0x5c12('0x37')]);_0x23e1ff[_0x5c12('0x38')]=qs[_0x5c12('0x2f')](_['pick'](_0x5a5592[_0x5c12('0x2e')],_0xd6451b[_0x5c12('0x2f')]),_0x18c4d9);if(_0x5a5592['query']['filter']){_0x23e1ff[_0x5c12('0x38')]=_[_0x5c12('0x39')](_0x23e1ff[_0x5c12('0x38')],{'$or':_[_0x5c12('0x28')](_0x18c4d9,function(_0x882046){if(_0x882046[_0x5c12('0x2b')]!==_0x5c12('0x3a')){var _0x11b08e={};_0x11b08e[_0x882046[_0x5c12('0x25')]]={'$like':'%'+_0x5a5592[_0x5c12('0x2e')]['filter']+'%'};return _0x11b08e;}})});}_0x23e1ff=_[_0x5c12('0x39')]({},_0x23e1ff,_0x5a5592[_0x5c12('0x3b')]);var _0x59598e={'where':_0x23e1ff[_0x5c12('0x38')]};return db[_0x5c12('0x3c')]['count'](_0x59598e)[_0x5c12('0x22')](function(_0x17b735){_0x3f22e0[_0x5c12('0x3d')]=_0x17b735;if(_0x5a5592[_0x5c12('0x2e')][_0x5c12('0x3e')]){_0x23e1ff[_0x5c12('0x3f')]=[{'all':!![]}];}return db[_0x5c12('0x3c')]['findAll'](_0x23e1ff);})[_0x5c12('0x22')](function(_0x1665f8){_0x3f22e0[_0x5c12('0x40')]=_0x1665f8;return _0x3f22e0;})[_0x5c12('0x22')](respondWithFilteredResult(_0x280a52,_0x23e1ff))[_0x5c12('0x41')](handleError(_0x280a52,null));};exports[_0x5c12('0x42')]=function(_0x32d0b9,_0x1edc09){var _0x21103f={'raw':!![],'where':{'id':_0x32d0b9[_0x5c12('0x43')]['id']}},_0x22a09c={};_0x22a09c[_0x5c12('0x31')]=_['keys'](db[_0x5c12('0x3c')][_0x5c12('0x29')]);_0x22a09c[_0x5c12('0x2e')]=_[_0x5c12('0x2d')](_0x32d0b9[_0x5c12('0x2e')]);_0x22a09c[_0x5c12('0x2f')]=_['intersection'](_0x22a09c[_0x5c12('0x31')],_0x22a09c['query']);_0x21103f[_0x5c12('0x32')]=_[_0x5c12('0x30')](_0x22a09c[_0x5c12('0x31')],qs[_0x5c12('0x33')](_0x32d0b9[_0x5c12('0x2e')][_0x5c12('0x33')]));_0x21103f[_0x5c12('0x32')]=_0x21103f[_0x5c12('0x32')]['length']?_0x21103f[_0x5c12('0x32')]:_0x22a09c[_0x5c12('0x31')];if(_0x32d0b9[_0x5c12('0x2e')][_0x5c12('0x3e')]){_0x21103f[_0x5c12('0x3f')]=[{'all':!![]}];}_0x21103f=_[_0x5c12('0x39')]({},_0x21103f,_0x32d0b9[_0x5c12('0x3b')]);return db['VoiceMailMessage']['find'](_0x21103f)[_0x5c12('0x22')](handleEntityNotFound(_0x1edc09,null))['then'](respondWithResult(_0x1edc09,null))[_0x5c12('0x41')](handleError(_0x1edc09,null));};exports[_0x5c12('0x44')]=function(_0x505a74,_0x57d2f7){return db[_0x5c12('0x3c')]['create'](_0x505a74[_0x5c12('0x45')],{})[_0x5c12('0x22')](respondWithResult(_0x57d2f7,0xc9))['catch'](handleError(_0x57d2f7,null));};exports[_0x5c12('0x21')]=function(_0x12b901,_0x4cc5bc){if(_0x12b901['body']['id']){delete _0x12b901[_0x5c12('0x45')]['id'];}return db[_0x5c12('0x3c')][_0x5c12('0x46')]({'where':{'id':_0x12b901[_0x5c12('0x43')]['id']}})[_0x5c12('0x22')](handleEntityNotFound(_0x4cc5bc,null))[_0x5c12('0x22')](saveUpdates(_0x12b901[_0x5c12('0x45')],null))[_0x5c12('0x22')](respondWithResult(_0x4cc5bc,null))[_0x5c12('0x41')](handleError(_0x4cc5bc,null));};exports[_0x5c12('0x23')]=function(_0x49792b,_0x1d12ba){return db['VoiceMailMessage'][_0x5c12('0x46')]({'where':{'id':_0x49792b[_0x5c12('0x43')]['id']}})[_0x5c12('0x22')](handleEntityNotFound(_0x1d12ba,null))['then'](removeEntity(_0x1d12ba,null))[_0x5c12('0x41')](handleError(_0x1d12ba,null));};exports['download']=function(_0x2b492e,_0x4f1fa0,_0x479b24){return db['VoiceMailMessage'][_0x5c12('0x46')]({'where':{'id':_0x2b492e[_0x5c12('0x43')]['id']},'attributes':['id','recording',_0x5c12('0x47')]})[_0x5c12('0x22')](handleEntityNotFound(_0x4f1fa0,null))[_0x5c12('0x22')](function(_0x5b8ecb){if(_0x5b8ecb){if(!_0x5b8ecb[_0x5c12('0x48')]){throw new db[(_0x5c12('0x49'))][(_0x5c12('0x4a'))]('VoiceMailMessage\x20not\x20found');}var _0x36a99c={'Content-Type':_0x5c12('0x4b'),'Content-Disposition':'attachment'};if(_0x5b8ecb['msg_id']){_0x36a99c[_0x5c12('0x4c')]=_0x5c12('0x4d')+_0x5b8ecb[_0x5c12('0x47')]+_0x5c12('0x4e');}_0x4f1fa0[_0x5c12('0x1c')](_0x36a99c);return _0x4f1fa0[_0x5c12('0x26')](new Buffer(_0x5b8ecb[_0x5c12('0x48')]));}})[_0x5c12('0x41')](handleError(_0x4f1fa0,null));};
\ No newline at end of file
index b838f76..f7ffe97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb967=['../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x23548f,_0x5e27df){var _0x12dabe=function(_0x2cd30c){while(--_0x2cd30c){_0x23548f['push'](_0x23548f['shift']());}};_0x12dabe(++_0x5e27df);}(_0xb967,0x10a));var _0x7b96=function(_0x5341d2,_0x2da6d6){_0x5341d2=_0x5341d2-0x0;var _0x3a4d6a=_0xb967[_0x5341d2];return _0x3a4d6a;};'use strict';var _=require(_0x7b96('0x0'));var util=require(_0x7b96('0x1'));var logger=require(_0x7b96('0x2'))(_0x7b96('0x3'));var moment=require(_0x7b96('0x4'));var BPromise=require(_0x7b96('0x5'));var rp=require(_0x7b96('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b96('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x7b96('0x8')]=function(_0x3d3849,_0x36c61e){return _0x3d3849[_0x7b96('0x9')](_0x7b96('0xa'),attributes,{'tableName':_0x7b96('0xb'),'paranoid':![],'indexes':[{'name':_0x7b96('0xc'),'fields':[_0x7b96('0xc')]}],'timestamps':![]});};
\ No newline at end of file
+var _0xa09e=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash'];(function(_0x574e54,_0x2c5784){var _0x581fc5=function(_0x281c81){while(--_0x281c81){_0x574e54['push'](_0x574e54['shift']());}};_0x581fc5(++_0x2c5784);}(_0xa09e,0x113));var _0xea09=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0xa09e[_0x467e9e];return _0x10376a;};'use strict';var _=require(_0xea09('0x0'));var util=require(_0xea09('0x1'));var logger=require(_0xea09('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea09('0x3'));var fs=require('fs');var path=require(_0xea09('0x4'));var rimraf=require(_0xea09('0x5'));var config=require(_0xea09('0x6'));var attributes=require(_0xea09('0x7'));module[_0xea09('0x8')]=function(_0x1c3f05,_0x4652d2){return _0x1c3f05[_0xea09('0x9')]('VoiceMailMessage',attributes,{'tableName':_0xea09('0xa'),'paranoid':![],'indexes':[{'name':_0xea09('0xb'),'fields':[_0xea09('0xb')]}],'timestamps':![]});};
\ No newline at end of file
index 2a121fc..263438b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74e3=['client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1e78ca,_0x1f6466){var _0x486a60=function(_0x109460){while(--_0x109460){_0x1e78ca['push'](_0x1e78ca['shift']());}};_0x486a60(++_0x1f6466);}(_0x74e3,0x187));var _0x374e=function(_0x7d9758,_0xf4d2eb){_0x7d9758=_0x7d9758-0x0;var _0x9e9815=_0x74e3[_0x7d9758];return _0x9e9815;};'use strict';var _=require('lodash');var util=require(_0x374e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x374e('0x1'));var fs=require('fs');var Redis=require(_0x374e('0x2'));var db=require(_0x374e('0x3'))['db'];var utils=require(_0x374e('0x4'));var logger=require(_0x374e('0x5'))(_0x374e('0x6'));var config=require('../../config/environment');var jayson=require(_0x374e('0x7'));var client=jayson[_0x374e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a0ad,_0x599fc1,_0xda1ee3){return new BPromise(function(_0x25d2bf,_0x4776de){return client[_0x374e('0x9')](_0x17a0ad,_0xda1ee3)[_0x374e('0xa')](function(_0x55fd63){logger[_0x374e('0xb')](_0x374e('0xc'),_0x599fc1,'request\x20sent');logger[_0x374e('0xd')](_0x374e('0xe'),_0x599fc1,'request\x20sent',JSON[_0x374e('0xf')](_0x55fd63));if(_0x55fd63[_0x374e('0x10')]){if(_0x55fd63[_0x374e('0x10')][_0x374e('0x11')]===0x1f4){logger[_0x374e('0x10')](_0x374e('0xc'),_0x599fc1,_0x55fd63[_0x374e('0x10')][_0x374e('0x12')]);return _0x4776de(_0x55fd63[_0x374e('0x10')]['message']);}logger[_0x374e('0x10')](_0x374e('0xc'),_0x599fc1,_0x55fd63[_0x374e('0x10')][_0x374e('0x12')]);return _0x25d2bf(_0x55fd63[_0x374e('0x10')][_0x374e('0x12')]);}else{logger['info'](_0x374e('0xc'),_0x599fc1,'request\x20sent');_0x25d2bf(_0x55fd63[_0x374e('0x13')][_0x374e('0x12')]);}})[_0x374e('0x14')](function(_0x590f07){logger[_0x374e('0x10')](_0x374e('0xc'),_0x599fc1,_0x590f07);_0x4776de(_0x590f07);});});}
\ No newline at end of file
+var _0x7c00=['../../config/utils','rpc','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x293b3d,_0x14f112){var _0x385438=function(_0x5cc69f){while(--_0x5cc69f){_0x293b3d['push'](_0x293b3d['shift']());}};_0x385438(++_0x14f112);}(_0x7c00,0x9d));var _0x07c0=function(_0x542ea5,_0x405542){_0x542ea5=_0x542ea5-0x0;var _0x4dc38c=_0x7c00[_0x542ea5];return _0x4dc38c;};'use strict';var _=require(_0x07c0('0x0'));var util=require(_0x07c0('0x1'));var moment=require(_0x07c0('0x2'));var BPromise=require(_0x07c0('0x3'));var rs=require(_0x07c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x07c0('0x5'));var logger=require('../../config/logger')(_0x07c0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x07c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x58507c,_0x41a5d1,_0x395e90){return new BPromise(function(_0x5987b3,_0x24eb5a){return client[_0x07c0('0x8')](_0x58507c,_0x395e90)[_0x07c0('0x9')](function(_0x8fdd3b){logger[_0x07c0('0xa')](_0x07c0('0xb'),_0x41a5d1,_0x07c0('0xc'));logger['debug'](_0x07c0('0xd'),_0x41a5d1,_0x07c0('0xc'),JSON['stringify'](_0x8fdd3b));if(_0x8fdd3b[_0x07c0('0xe')]){if(_0x8fdd3b[_0x07c0('0xe')][_0x07c0('0xf')]===0x1f4){logger[_0x07c0('0xe')](_0x07c0('0xb'),_0x41a5d1,_0x8fdd3b[_0x07c0('0xe')][_0x07c0('0x10')]);return _0x24eb5a(_0x8fdd3b['error'][_0x07c0('0x10')]);}logger[_0x07c0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x41a5d1,_0x8fdd3b[_0x07c0('0xe')]['message']);return _0x5987b3(_0x8fdd3b[_0x07c0('0xe')][_0x07c0('0x10')]);}else{logger[_0x07c0('0xa')](_0x07c0('0xb'),_0x41a5d1,_0x07c0('0xc'));_0x5987b3(_0x8fdd3b[_0x07c0('0x11')][_0x07c0('0x10')]);}})['catch'](function(_0x49a2f6){logger[_0x07c0('0xe')](_0x07c0('0xb'),_0x41a5d1,_0x49a2f6);_0x24eb5a(_0x49a2f6);});});}
\ No newline at end of file
index a00cb06..6225783 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa543=['post','create','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x2e67f7,_0x3111ab){var _0x175e11=function(_0x7619){while(--_0x7619){_0x2e67f7['push'](_0x2e67f7['shift']());}};_0x175e11(++_0x3111ab);}(_0xa543,0x11d));var _0x3a54=function(_0x34ad33,_0x37ff19){_0x34ad33=_0x34ad33-0x0;var _0x2c629e=_0xa543[_0x34ad33];return _0x2c629e;};'use strict';var multer=require('multer');var util=require(_0x3a54('0x0'));var path=require('path');var timeout=require(_0x3a54('0x1'));var express=require(_0x3a54('0x2'));var router=express[_0x3a54('0x3')]();var fs_extra=require(_0x3a54('0x4'));var auth=require(_0x3a54('0x5'));var interaction=require(_0x3a54('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x3a54('0x7')]('/',auth[_0x3a54('0x8')](),controller[_0x3a54('0x9')]);router['get'](_0x3a54('0xa'),auth['isAuthenticated'](),controller[_0x3a54('0xb')]);router[_0x3a54('0x7')](_0x3a54('0xc'),auth['isAuthenticated'](),controller[_0x3a54('0xd')]);router[_0x3a54('0xe')]('/',auth[_0x3a54('0x8')](),controller[_0x3a54('0xf')]);router[_0x3a54('0xe')]('/:id/sounds',auth[_0x3a54('0x8')](),controller['addSound']);router[_0x3a54('0x10')](_0x3a54('0xa'),auth[_0x3a54('0x8')](),controller[_0x3a54('0x11')]);router[_0x3a54('0x12')]('/:id',auth[_0x3a54('0x8')](),controller[_0x3a54('0x13')]);router[_0x3a54('0x12')](_0x3a54('0x14'),auth[_0x3a54('0x8')](),controller[_0x3a54('0x15')]);module[_0x3a54('0x16')]=router;
\ No newline at end of file
+var _0x2c58=['/:id','show','get','isAuthenticated','getSounds','post','create','/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','index'];(function(_0x10bb87,_0x3d04e3){var _0x4e663f=function(_0x55ec0f){while(--_0x55ec0f){_0x10bb87['push'](_0x10bb87['shift']());}};_0x4e663f(++_0x3d04e3);}(_0x2c58,0xf5));var _0x82c5=function(_0xd1cb11,_0x3a421e){_0xd1cb11=_0xd1cb11-0x0;var _0x519e1d=_0x2c58[_0xd1cb11];return _0x519e1d;};'use strict';var multer=require(_0x82c5('0x0'));var util=require(_0x82c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x82c5('0x2'));var router=express[_0x82c5('0x3')]();var fs_extra=require(_0x82c5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82c5('0x5'));var config=require('../../config/environment');var controller=require(_0x82c5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x82c5('0x7')]);router['get'](_0x82c5('0x8'),auth['isAuthenticated'](),controller[_0x82c5('0x9')]);router[_0x82c5('0xa')]('/:id/sounds',auth[_0x82c5('0xb')](),controller[_0x82c5('0xc')]);router[_0x82c5('0xd')]('/',auth[_0x82c5('0xb')](),controller[_0x82c5('0xe')]);router[_0x82c5('0xd')](_0x82c5('0xf'),auth[_0x82c5('0xb')](),controller[_0x82c5('0x10')]);router[_0x82c5('0x11')](_0x82c5('0x8'),auth['isAuthenticated'](),controller[_0x82c5('0x12')]);router[_0x82c5('0x13')](_0x82c5('0x8'),auth[_0x82c5('0xb')](),controller['destroy']);router[_0x82c5('0x13')](_0x82c5('0x14'),auth[_0x82c5('0xb')](),controller[_0x82c5('0x15')]);module[_0x82c5('0x16')]=router;
\ No newline at end of file
index 4cbab76..0e02091 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9a6=['quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','ENUM','files','mp3nb'];(function(_0x150ea6,_0x44495e){var _0x3c26aa=function(_0x335f31){while(--_0x335f31){_0x150ea6['push'](_0x150ea6['shift']());}};_0x3c26aa(++_0x44495e);}(_0xa9a6,0x94));var _0x6a9a=function(_0x5ed922,_0x1e165c){_0x5ed922=_0x5ed922-0x0;var _0x218492=_0xa9a6[_0x5ed922];return _0x218492;};'use strict';var Sequelize=require(_0x6a9a('0x0'));module[_0x6a9a('0x1')]={'name':{'type':Sequelize[_0x6a9a('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x6a9a('0x3')]('custom',_0x6a9a('0x4'),_0x6a9a('0x5'),_0x6a9a('0x6'),_0x6a9a('0x7'),_0x6a9a('0x8')),'allowNull':!![],'defaultValue':_0x6a9a('0x4')},'directory':{'type':Sequelize[_0x6a9a('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x6a9a('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6a9a('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x6a9a('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x7845=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x21ff3a,_0x41e335){var _0x53ce14=function(_0x5cb2b6){while(--_0x5cb2b6){_0x21ff3a['push'](_0x21ff3a['shift']());}};_0x53ce14(++_0x41e335);}(_0x7845,0x1e3));var _0x5784=function(_0x4e5bb4,_0x7521ad){_0x4e5bb4=_0x4e5bb4-0x0;var _0x1f3bd5=_0x7845[_0x4e5bb4];return _0x1f3bd5;};'use strict';var Sequelize=require(_0x5784('0x0'));module[_0x5784('0x1')]={'name':{'type':Sequelize[_0x5784('0x2')],'allowNull':![],'unique':_0x5784('0x3')},'mode':{'type':Sequelize[_0x5784('0x4')](_0x5784('0x5'),_0x5784('0x6'),_0x5784('0x7'),_0x5784('0x8'),_0x5784('0x9'),_0x5784('0xa')),'allowNull':!![],'defaultValue':_0x5784('0x6')},'directory':{'type':Sequelize[_0x5784('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5784('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5784('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x5784('0x2')],'allowNull':!![]},'stamp':{'type':_0x5784('0xb')},'defaultEntry':{'type':Sequelize[_0x5784('0xc')],'defaultValue':0x0}};
\ No newline at end of file
index 6c38160..9f2e7c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d60=['UserProfileResource','sendStatus','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','find','update','body','create','sequelize','mode','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','extname','converted_format','symlinkSync','removeSound','id2','Sound','order','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','get'];(function(_0x11b34c,_0x3927d1){var _0x3fc1d3=function(_0x4dd148){while(--_0x4dd148){_0x11b34c['push'](_0x11b34c['shift']());}};_0x3fc1d3(++_0x3927d1);}(_0x8d60,0x1a2));var _0x08d6=function(_0x3c6ba1,_0x3443cc){_0x3c6ba1=_0x3c6ba1-0x0;var _0x463e78=_0x8d60[_0x3c6ba1];return _0x463e78;};'use strict';var emlformat=require(_0x08d6('0x0'));var rimraf=require(_0x08d6('0x1'));var zipdir=require(_0x08d6('0x2'));var jsonpatch=require(_0x08d6('0x3'));var rp=require(_0x08d6('0x4'));var moment=require(_0x08d6('0x5'));var BPromise=require(_0x08d6('0x6'));var Mustache=require(_0x08d6('0x7'));var util=require(_0x08d6('0x8'));var path=require(_0x08d6('0x9'));var sox=require(_0x08d6('0xa'));var csv=require(_0x08d6('0xb'));var ejs=require(_0x08d6('0xc'));var fs=require('fs');var fs_extra=require(_0x08d6('0xd'));var _=require(_0x08d6('0xe'));var squel=require('squel');var crypto=require(_0x08d6('0xf'));var jsforce=require(_0x08d6('0x10'));var deskjs=require(_0x08d6('0x11'));var toCsv=require(_0x08d6('0xb'));var querystring=require(_0x08d6('0x12'));var Papa=require(_0x08d6('0x13'));var Redis=require('ioredis');var authService=require(_0x08d6('0x14'));var qs=require(_0x08d6('0x15'));var as=require(_0x08d6('0x16'));var hardwareService=require(_0x08d6('0x17'));var logger=require(_0x08d6('0x18'))(_0x08d6('0x19'));var utils=require(_0x08d6('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x08d6('0x1b'));var db=require(_0x08d6('0x1c'))['db'];function respondWithStatusCode(_0x5d5d17,_0x44093b){_0x44093b=_0x44093b||0xcc;return function(_0x3a9326){if(_0x3a9326){return _0x5d5d17['sendStatus'](_0x44093b);}return _0x5d5d17[_0x08d6('0x1d')](_0x44093b)[_0x08d6('0x1e')]();};}function respondWithResult(_0x260145,_0x52c90c){_0x52c90c=_0x52c90c||0xc8;return function(_0x179075){if(_0x179075){return _0x260145[_0x08d6('0x1d')](_0x52c90c)[_0x08d6('0x1f')](_0x179075);}};}function respondWithFilteredResult(_0x5d0da9,_0xb8dec1){return function(_0x5f25b9){if(_0x5f25b9){var _0x42ac1e=typeof _0xb8dec1[_0x08d6('0x20')]===_0x08d6('0x21')&&typeof _0xb8dec1[_0x08d6('0x22')]===_0x08d6('0x21');var _0x2d706d=_0x5f25b9['count'];var _0x31919a=_0x42ac1e?0x0:_0xb8dec1[_0x08d6('0x20')];var _0x3d7422=_0x42ac1e?_0x5f25b9[_0x08d6('0x23')]:_0xb8dec1[_0x08d6('0x20')]+_0xb8dec1[_0x08d6('0x22')];var _0x4db283;if(_0x3d7422>=_0x2d706d){_0x3d7422=_0x2d706d;_0x4db283=0xc8;}else{_0x4db283=0xce;}_0x5d0da9[_0x08d6('0x1d')](_0x4db283);return _0x5d0da9['set'](_0x08d6('0x24'),_0x31919a+'-'+_0x3d7422+'/'+_0x2d706d)[_0x08d6('0x1f')](_0x5f25b9);}return null;};}function patchUpdates(_0x24e09d){return function(_0x31216b){try{jsonpatch[_0x08d6('0x25')](_0x31216b,_0x24e09d,!![]);}catch(_0x3ae949){return BPromise[_0x08d6('0x26')](_0x3ae949);}return _0x31216b['save']();};}function saveUpdates(_0x25cfa2,_0x46d0fd){return function(_0x496795){if(_0x496795){return _0x496795['update'](_0x25cfa2)['then'](function(_0x3def2d){return _0x3def2d;});}return null;};}function removeEntity(_0x118cf1,_0x43127d){return function(_0x1e7702){if(_0x1e7702){return _0x1e7702[_0x08d6('0x27')]()[_0x08d6('0x28')](function(){var _0x445403=_0x1e7702[_0x08d6('0x29')]({'plain':!![]});var _0x333866='MusicOnHolds';return db[_0x08d6('0x2a')][_0x08d6('0x27')]({'where':{'type':_0x333866,'resourceId':_0x445403['id']}})['then'](function(){return _0x1e7702;});})['then'](function(){_0x118cf1[_0x08d6('0x1d')](0xcc)[_0x08d6('0x1e')]();});}};}function handleEntityNotFound(_0x2e5e4a,_0x2be1b3){return function(_0x2f7771){if(!_0x2f7771){_0x2e5e4a[_0x08d6('0x2b')](0x194);}return _0x2f7771;};}function handleError(_0x712433,_0xc5f131){_0xc5f131=_0xc5f131||0x1f4;return function(_0x2ffae0){logger[_0x08d6('0x2c')](_0x2ffae0[_0x08d6('0x2d')]);if(_0x2ffae0[_0x08d6('0x2e')]){delete _0x2ffae0[_0x08d6('0x2e')];}_0x712433[_0x08d6('0x1d')](_0xc5f131)['send'](_0x2ffae0);};}exports[_0x08d6('0x2f')]=function(_0x2abc56,_0x566b77){var _0x377983={},_0x52b665={},_0x2cfa59={'count':0x0,'rows':[]};var _0xc967fc=_[_0x08d6('0x30')](db[_0x08d6('0x31')][_0x08d6('0x32')],function(_0x36fc2f){return{'name':_0x36fc2f[_0x08d6('0x33')],'type':_0x36fc2f[_0x08d6('0x34')][_0x08d6('0x35')]};});_0x52b665[_0x08d6('0x36')]=_['map'](_0xc967fc,'name');_0x52b665[_0x08d6('0x37')]=_['keys'](_0x2abc56[_0x08d6('0x37')]);_0x52b665[_0x08d6('0x38')]=_[_0x08d6('0x39')](_0x52b665[_0x08d6('0x36')],_0x52b665[_0x08d6('0x37')]);_0x377983[_0x08d6('0x3a')]=_['intersection'](_0x52b665[_0x08d6('0x36')],qs[_0x08d6('0x3b')](_0x2abc56['query'][_0x08d6('0x3b')]));_0x377983[_0x08d6('0x3a')]=_0x377983[_0x08d6('0x3a')][_0x08d6('0x3c')]?_0x377983[_0x08d6('0x3a')]:_0x52b665[_0x08d6('0x36')];if(!_0x2abc56['query'][_0x08d6('0x3d')](_0x08d6('0x3e'))){_0x377983[_0x08d6('0x22')]=qs[_0x08d6('0x22')](_0x2abc56[_0x08d6('0x37')][_0x08d6('0x22')]);_0x377983['offset']=qs[_0x08d6('0x20')](_0x2abc56[_0x08d6('0x37')][_0x08d6('0x20')]);}_0x377983['order']=qs[_0x08d6('0x3f')](_0x2abc56['query']['sort']);delete _0x2abc56['query'][_0x08d6('0x3f')];_0x377983[_0x08d6('0x40')]=qs['filters'](_[_0x08d6('0x41')](_0x2abc56[_0x08d6('0x37')],_0x52b665['filters']),_0xc967fc);if(_0x2abc56[_0x08d6('0x37')][_0x08d6('0x42')]){_0x377983[_0x08d6('0x40')]=_[_0x08d6('0x43')](_0x377983[_0x08d6('0x40')],{'$or':_['map'](_0xc967fc,function(_0x80d5bd){if(_0x80d5bd[_0x08d6('0x34')]!=='VIRTUAL'){var _0x4ff6e7={};_0x4ff6e7[_0x80d5bd['name']]={'$like':'%'+_0x2abc56['query'][_0x08d6('0x42')]+'%'};return _0x4ff6e7;}})});}_0x377983=_[_0x08d6('0x43')]({},_0x377983,_0x2abc56[_0x08d6('0x44')]);var _0x1062a0={'where':_0x377983[_0x08d6('0x40')]};return db[_0x08d6('0x31')][_0x08d6('0x23')](_0x1062a0)['then'](function(_0x58acda){_0x2cfa59[_0x08d6('0x23')]=_0x58acda;if(_0x2abc56['query'][_0x08d6('0x45')]){_0x377983[_0x08d6('0x46')]=[{'all':!![]}];}return db[_0x08d6('0x31')][_0x08d6('0x47')](_0x377983);})[_0x08d6('0x28')](function(_0xa170d){_0x2cfa59['rows']=_0xa170d;return _0x2cfa59;})[_0x08d6('0x28')](respondWithFilteredResult(_0x566b77,_0x377983))[_0x08d6('0x48')](handleError(_0x566b77,null));};exports[_0x08d6('0x49')]=function(_0x19d8c0,_0x13ad45){var _0x5e794f={'raw':![],'where':{'id':_0x19d8c0[_0x08d6('0x4a')]['id']}},_0x5745a1={};_0x5745a1[_0x08d6('0x36')]=_[_0x08d6('0x4b')](db[_0x08d6('0x31')][_0x08d6('0x32')]);_0x5745a1[_0x08d6('0x37')]=_[_0x08d6('0x4b')](_0x19d8c0[_0x08d6('0x37')]);_0x5745a1[_0x08d6('0x38')]=_[_0x08d6('0x39')](_0x5745a1[_0x08d6('0x36')],_0x5745a1[_0x08d6('0x37')]);_0x5e794f[_0x08d6('0x3a')]=_['intersection'](_0x5745a1[_0x08d6('0x36')],qs[_0x08d6('0x3b')](_0x19d8c0[_0x08d6('0x37')][_0x08d6('0x3b')]));_0x5e794f[_0x08d6('0x3a')]=_0x5e794f[_0x08d6('0x3a')][_0x08d6('0x3c')]?_0x5e794f['attributes']:_0x5745a1[_0x08d6('0x36')];if(_0x19d8c0['query'][_0x08d6('0x45')]){_0x5e794f[_0x08d6('0x46')]=[{'all':!![]}];}_0x5e794f=_[_0x08d6('0x43')]({},_0x5e794f,_0x19d8c0[_0x08d6('0x44')]);return db[_0x08d6('0x31')][_0x08d6('0x4c')](_0x5e794f)[_0x08d6('0x28')](handleEntityNotFound(_0x13ad45,null))[_0x08d6('0x28')](respondWithResult(_0x13ad45,null))[_0x08d6('0x48')](handleError(_0x13ad45,null));};exports[_0x08d6('0x4d')]=function(_0x3b7cb4,_0x273a84){if(_0x3b7cb4[_0x08d6('0x4e')]['id']){delete _0x3b7cb4['body']['id'];}return db[_0x08d6('0x31')]['find']({'where':{'id':_0x3b7cb4[_0x08d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x273a84,null))[_0x08d6('0x28')](saveUpdates(_0x3b7cb4[_0x08d6('0x4e')],null))[_0x08d6('0x28')](respondWithResult(_0x273a84,null))['catch'](handleError(_0x273a84,null));};exports[_0x08d6('0x4f')]=function(_0x21813a,_0x15384f,_0x4684dd){return db[_0x08d6('0x50')]['transaction'](function(_0x5c82ce){if(_0x21813a[_0x08d6('0x4e')][_0x08d6('0x51')]==='files'){_0x21813a[_0x08d6('0x4e')][_0x08d6('0x52')]=path[_0x08d6('0x53')](config[_0x08d6('0x54')],_0x08d6('0x55'),_0x21813a[_0x08d6('0x4e')][_0x08d6('0x2e')]);}return db[_0x08d6('0x31')][_0x08d6('0x4f')](_0x21813a[_0x08d6('0x4e')],{'transaction':_0x5c82ce})[_0x08d6('0x28')](function(_0x3c20f2){if(_0x21813a[_0x08d6('0x4e')][_0x08d6('0x51')]==='files'){fs[_0x08d6('0x56')](_0x3c20f2['directory'],parseInt(_0x08d6('0x57'),0x8));}var _0x48cc01=_0x21813a[_0x08d6('0x58')][_0x08d6('0x29')]({'plain':!![]});if(!_0x48cc01)throw new Error(_0x08d6('0x59'));if(_0x48cc01[_0x08d6('0x5a')]==='user'){var _0x536830=_0x3c20f2[_0x08d6('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x08d6('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x48cc01['userProfileId']},'raw':!![]})[_0x08d6('0x28')](function(_0x2ed757){if(_0x2ed757&&_0x2ed757['autoAssociation']===0x0){return db[_0x08d6('0x2a')][_0x08d6('0x4f')]({'name':_0x536830[_0x08d6('0x2e')],'resourceId':_0x536830['id'],'type':_0x2ed757[_0x08d6('0x2e')],'sectionId':_0x2ed757['id']},{})[_0x08d6('0x28')](function(){return _0x3c20f2;});}else{return _0x3c20f2;}})[_0x08d6('0x48')](function(_0x5efcba){logger[_0x08d6('0x2c')](_0x08d6('0x5b'),_0x5efcba);});}return _0x3c20f2;});})[_0x08d6('0x28')](respondWithResult(_0x15384f,0xc9))[_0x08d6('0x48')](handleError(_0x15384f,null));};exports[_0x08d6('0x27')]=function(_0x4b287e,_0x386ee9,_0x11f985){var _0x5b41ba;return db[_0x08d6('0x31')][_0x08d6('0x4c')]({'where':{'id':_0x4b287e[_0x08d6('0x4a')]['id']}})[_0x08d6('0x28')](function(_0x5c49c3){if(_0x5c49c3){return db[_0x08d6('0x50')][_0x08d6('0x5c')](function(_0xb41f85){return _0x5c49c3['destroy']({'transaction':_0xb41f85,'raw':!![]})[_0x08d6('0x28')](function(_0x5dbc3c){if(_0x5dbc3c[_0x08d6('0x52')]){fs[_0x08d6('0x5d')](_0x5dbc3c[_0x08d6('0x52')])[_0x08d6('0x5e')](function(_0x5e2d54){fs[_0x08d6('0x5f')](path[_0x08d6('0x53')](_0x5dbc3c[_0x08d6('0x52')],_0x5e2d54));});fs[_0x08d6('0x60')](_0x5dbc3c[_0x08d6('0x52')]);}return _0x5dbc3c;});})['catch'](function(_0x46f71d){throw new db[(_0x08d6('0x61'))][(_0x08d6('0x62'))](_0x46f71d[_0x08d6('0x63')]);});}})[_0x08d6('0x28')](handleEntityNotFound(_0x386ee9,null))[_0x08d6('0x28')](removeEntity(_0x386ee9,null))[_0x08d6('0x48')](handleError(_0x386ee9,null));};exports[_0x08d6('0x64')]=function(_0x3ef92f,_0x50d349,_0x1c4c21){return db[_0x08d6('0x50')][_0x08d6('0x5c')](function(_0x414c80){var _0x69f8e7;return db[_0x08d6('0x31')][_0x08d6('0x4c')]({'where':{'id':_0x3ef92f[_0x08d6('0x4a')]['id']}})[_0x08d6('0x28')](function(_0xa572d7){if(_0xa572d7){_0x69f8e7=_0xa572d7;return _0xa572d7[_0x08d6('0x64')](_0x3ef92f['body']['id'],{'transaction':_0x414c80});}})[_0x08d6('0x28')](function(_0x54d234){if(_0x54d234){return db['Sound'][_0x08d6('0x65')]({'where':{'id':_0x3ef92f[_0x08d6('0x4e')]['id']},'attributes':['id',_0x08d6('0x2e'),_0x08d6('0x66'),'converted_format',_0x08d6('0x67')],'raw':!![]});}})['then'](function(_0xfc9176){if(_0xfc9176){var _0x57f21d=path['join'](config[_0x08d6('0x54')],_0x08d6('0x68'),util[_0x08d6('0x69')](_0x08d6('0x6a'),path['basename'](_0xfc9176[_0x08d6('0x66')],path[_0x08d6('0x6b')](_0xfc9176['save_name'])),_0xfc9176[_0x08d6('0x6c')]));var _0x3d0c03=path['join'](config[_0x08d6('0x54')],'server/files/moh',_0x69f8e7[_0x08d6('0x2e')],util[_0x08d6('0x69')](_0x08d6('0x6a'),_0xfc9176[_0x08d6('0x2e')],_0xfc9176[_0x08d6('0x6c')]));fs[_0x08d6('0x6d')](_0x57f21d,_0x3d0c03);return _0xfc9176;}})[_0x08d6('0x48')](function(_0x59cf13){throw new db[(_0x08d6('0x61'))][(_0x08d6('0x62'))](_0x59cf13[_0x08d6('0x63')]);});})['then'](handleEntityNotFound(_0x50d349,null))[_0x08d6('0x28')](respondWithResult(_0x50d349,0xc9))[_0x08d6('0x48')](handleError(_0x50d349,null));};exports[_0x08d6('0x6e')]=function(_0x4db4f8,_0x258d39,_0x48823d){return db[_0x08d6('0x50')]['transaction'](function(_0x10eb0b){var _0x224f9d;return db[_0x08d6('0x31')][_0x08d6('0x65')]({'where':{'id':_0x4db4f8['params']['id']}})[_0x08d6('0x28')](handleEntityNotFound(_0x258d39,null))[_0x08d6('0x28')](function(_0x1c7530){if(_0x1c7530){_0x224f9d=_0x1c7530;return _0x1c7530[_0x08d6('0x6e')](_0x4db4f8['params'][_0x08d6('0x6f')]);}})[_0x08d6('0x28')](function(_0x287d7b){if(_0x287d7b){return db[_0x08d6('0x70')][_0x08d6('0x65')]({'where':{'id':_0x4db4f8[_0x08d6('0x4a')][_0x08d6('0x6f')]},'attributes':['id','name','save_name',_0x08d6('0x6c'),_0x08d6('0x67')],'raw':!![]});}})[_0x08d6('0x28')](function(_0x5941da){if(_0x5941da){fs[_0x08d6('0x5f')](path['join'](_0x224f9d[_0x08d6('0x52')],util[_0x08d6('0x69')](_0x08d6('0x6a'),_0x5941da[_0x08d6('0x2e')],_0x5941da['converted_format'])));return _0x5941da;}})[_0x08d6('0x48')](function(_0x4c9eb7){throw new db['Sequelize'][(_0x08d6('0x62'))](_0x4c9eb7[_0x08d6('0x63')]);});})['then'](handleEntityNotFound(_0x258d39,null))[_0x08d6('0x28')](respondWithStatusCode(_0x258d39,0xcc))['catch'](handleError(_0x258d39,null));};exports['getSounds']=function(_0x177470,_0x5c0a1b,_0x53520c){var _0x5da0d9={};var _0x5bf2b2={};var _0x1ac4f8;var _0x137ce8;return db[_0x08d6('0x31')]['findOne']({'where':{'id':_0x177470[_0x08d6('0x4a')]['id']}})[_0x08d6('0x28')](handleEntityNotFound(_0x5c0a1b,null))['then'](function(_0x5bce3e){if(_0x5bce3e){_0x1ac4f8=_0x5bce3e;_0x5bf2b2[_0x08d6('0x36')]=_['keys'](db['Sound'][_0x08d6('0x32')]);_0x5bf2b2[_0x08d6('0x37')]=_[_0x08d6('0x4b')](_0x177470['query']);_0x5bf2b2[_0x08d6('0x38')]=_[_0x08d6('0x39')](_0x5bf2b2['model'],_0x5bf2b2[_0x08d6('0x37')]);_0x5da0d9[_0x08d6('0x3a')]=_[_0x08d6('0x39')](_0x5bf2b2['model'],qs['fields'](_0x177470[_0x08d6('0x37')][_0x08d6('0x3b')]));_0x5da0d9[_0x08d6('0x3a')]=_0x5da0d9[_0x08d6('0x3a')][_0x08d6('0x3c')]?_0x5da0d9[_0x08d6('0x3a')]:_0x5bf2b2[_0x08d6('0x36')];_0x5da0d9[_0x08d6('0x71')]=qs[_0x08d6('0x3f')](_0x177470[_0x08d6('0x37')][_0x08d6('0x3f')]);_0x5da0d9[_0x08d6('0x40')]=qs[_0x08d6('0x38')](_[_0x08d6('0x41')](_0x177470['query'],_0x5bf2b2[_0x08d6('0x38')]));if(_0x177470['query'][_0x08d6('0x42')]){_0x5da0d9[_0x08d6('0x40')]=_['merge'](_0x5da0d9['where'],{'$or':_[_0x08d6('0x30')](_0x5da0d9['attributes'],function(_0x4a320e){var _0x15bccb={};_0x15bccb[_0x4a320e]={'$like':'%'+_0x177470[_0x08d6('0x37')][_0x08d6('0x42')]+'%'};return _0x15bccb;})});}_0x5da0d9=_[_0x08d6('0x43')]({},_0x5da0d9,_0x177470[_0x08d6('0x44')]);return _0x1ac4f8[_0x08d6('0x72')](_0x5da0d9);}})[_0x08d6('0x28')](function(_0x366a06){if(_0x366a06){_0x137ce8=_0x366a06['length'];if(!_0x177470[_0x08d6('0x37')]['hasOwnProperty']('nolimit')){_0x5da0d9[_0x08d6('0x22')]=qs[_0x08d6('0x22')](_0x177470['query'][_0x08d6('0x22')]);_0x5da0d9[_0x08d6('0x20')]=qs[_0x08d6('0x20')](_0x177470[_0x08d6('0x37')][_0x08d6('0x20')]);}return _0x1ac4f8[_0x08d6('0x72')](_0x5da0d9);}})['then'](function(_0x457cb1){if(_0x457cb1){return _0x457cb1?{'count':_0x137ce8,'rows':_0x457cb1}:null;}})['then'](respondWithResult(_0x5c0a1b,null))[_0x08d6('0x48')](handleError(_0x5c0a1b,null));};
\ No newline at end of file
+var _0x340c=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','error','stack','name','index','VoiceMusicOnHold','rawAttributes','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','show','keys','length','find','body','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','Sound','unlinkSync','getSounds','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x340c,0xc2));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc340('0x1'));var jsonpatch=require(_0xc340('0x2'));var rp=require('request-promise');var moment=require(_0xc340('0x3'));var BPromise=require(_0xc340('0x4'));var Mustache=require(_0xc340('0x5'));var util=require(_0xc340('0x6'));var path=require(_0xc340('0x7'));var sox=require(_0xc340('0x8'));var csv=require(_0xc340('0x9'));var ejs=require(_0xc340('0xa'));var fs=require('fs');var fs_extra=require(_0xc340('0xb'));var _=require(_0xc340('0xc'));var squel=require(_0xc340('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc340('0xe'));var toCsv=require(_0xc340('0x9'));var querystring=require(_0xc340('0xf'));var Papa=require(_0xc340('0x10'));var Redis=require(_0xc340('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc340('0x12'));var hardwareService=require(_0xc340('0x13'));var logger=require(_0xc340('0x14'))(_0xc340('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc340('0x16'));var db=require(_0xc340('0x17'))['db'];function respondWithStatusCode(_0x305a93,_0x5581c3){_0x5581c3=_0x5581c3||0xcc;return function(_0x333a48){if(_0x333a48){return _0x305a93[_0xc340('0x18')](_0x5581c3);}return _0x305a93[_0xc340('0x19')](_0x5581c3)['end']();};}function respondWithResult(_0x46469c,_0xfce112){_0xfce112=_0xfce112||0xc8;return function(_0x2b6773){if(_0x2b6773){return _0x46469c['status'](_0xfce112)[_0xc340('0x1a')](_0x2b6773);}};}function respondWithFilteredResult(_0x5af2a1,_0x150f8c){return function(_0x8a4877){if(_0x8a4877){var _0x508a0b=typeof _0x150f8c[_0xc340('0x1b')]===_0xc340('0x1c')&&typeof _0x150f8c[_0xc340('0x1d')]===_0xc340('0x1c');var _0x30bcfb=_0x8a4877['count'];var _0x3f870d=_0x508a0b?0x0:_0x150f8c[_0xc340('0x1b')];var _0x52c900=_0x508a0b?_0x8a4877[_0xc340('0x1e')]:_0x150f8c[_0xc340('0x1b')]+_0x150f8c[_0xc340('0x1d')];var _0x35959c;if(_0x52c900>=_0x30bcfb){_0x52c900=_0x30bcfb;_0x35959c=0xc8;}else{_0x35959c=0xce;}_0x5af2a1[_0xc340('0x19')](_0x35959c);return _0x5af2a1[_0xc340('0x1f')](_0xc340('0x20'),_0x3f870d+'-'+_0x52c900+'/'+_0x30bcfb)[_0xc340('0x1a')](_0x8a4877);}return null;};}function patchUpdates(_0x347fc6){return function(_0x4c18c0){try{jsonpatch[_0xc340('0x21')](_0x4c18c0,_0x347fc6,!![]);}catch(_0x13303b){return BPromise[_0xc340('0x22')](_0x13303b);}return _0x4c18c0['save']();};}function saveUpdates(_0x554e1a,_0x375623){return function(_0x38626b){if(_0x38626b){return _0x38626b[_0xc340('0x23')](_0x554e1a)[_0xc340('0x24')](function(_0x209367){return _0x209367;});}return null;};}function removeEntity(_0x481673,_0x4fe2a3){return function(_0x4613a8){if(_0x4613a8){return _0x4613a8[_0xc340('0x25')]()[_0xc340('0x24')](function(){var _0x43c6e6=_0x4613a8['get']({'plain':!![]});var _0x51d8fb='MusicOnHolds';return db[_0xc340('0x26')][_0xc340('0x25')]({'where':{'type':_0x51d8fb,'resourceId':_0x43c6e6['id']}})['then'](function(){return _0x4613a8;});})[_0xc340('0x24')](function(){_0x481673[_0xc340('0x19')](0xcc)[_0xc340('0x27')]();});}};}function handleEntityNotFound(_0x4531d9,_0x504a43){return function(_0x1ebc91){if(!_0x1ebc91){_0x4531d9[_0xc340('0x18')](0x194);}return _0x1ebc91;};}function handleError(_0x13afe3,_0x2c395e){_0x2c395e=_0x2c395e||0x1f4;return function(_0x4787a9){logger[_0xc340('0x28')](_0x4787a9[_0xc340('0x29')]);if(_0x4787a9[_0xc340('0x2a')]){delete _0x4787a9['name'];}_0x13afe3[_0xc340('0x19')](_0x2c395e)['send'](_0x4787a9);};}exports[_0xc340('0x2b')]=function(_0x281350,_0x5bed98){var _0x43e942={},_0x27ef3a={},_0x544863={'count':0x0,'rows':[]};var _0x319b47=_['map'](db[_0xc340('0x2c')][_0xc340('0x2d')],function(_0x28aefd){return{'name':_0x28aefd['fieldName'],'type':_0x28aefd['type'][_0xc340('0x2e')]};});_0x27ef3a['model']=_[_0xc340('0x2f')](_0x319b47,_0xc340('0x2a'));_0x27ef3a[_0xc340('0x30')]=_['keys'](_0x281350['query']);_0x27ef3a[_0xc340('0x31')]=_[_0xc340('0x32')](_0x27ef3a[_0xc340('0x33')],_0x27ef3a['query']);_0x43e942['attributes']=_[_0xc340('0x32')](_0x27ef3a['model'],qs[_0xc340('0x34')](_0x281350[_0xc340('0x30')][_0xc340('0x34')]));_0x43e942[_0xc340('0x35')]=_0x43e942[_0xc340('0x35')]['length']?_0x43e942[_0xc340('0x35')]:_0x27ef3a[_0xc340('0x33')];if(!_0x281350[_0xc340('0x30')][_0xc340('0x36')]('nolimit')){_0x43e942[_0xc340('0x1d')]=qs[_0xc340('0x1d')](_0x281350[_0xc340('0x30')][_0xc340('0x1d')]);_0x43e942['offset']=qs[_0xc340('0x1b')](_0x281350[_0xc340('0x30')][_0xc340('0x1b')]);}_0x43e942[_0xc340('0x37')]=qs[_0xc340('0x38')](_0x281350['query'][_0xc340('0x38')]);delete _0x281350[_0xc340('0x30')][_0xc340('0x38')];_0x43e942['where']=qs['filters'](_[_0xc340('0x39')](_0x281350[_0xc340('0x30')],_0x27ef3a[_0xc340('0x31')]),_0x319b47);if(_0x281350[_0xc340('0x30')][_0xc340('0x3a')]){_0x43e942[_0xc340('0x3b')]=_['merge'](_0x43e942[_0xc340('0x3b')],{'$or':_[_0xc340('0x2f')](_0x319b47,function(_0x130c43){if(_0x130c43['type']!==_0xc340('0x3c')){var _0x430b3c={};_0x430b3c[_0x130c43[_0xc340('0x2a')]]={'$like':'%'+_0x281350[_0xc340('0x30')]['filter']+'%'};return _0x430b3c;}})});}_0x43e942=_[_0xc340('0x3d')]({},_0x43e942,_0x281350[_0xc340('0x3e')]);var _0x6447c5={'where':_0x43e942[_0xc340('0x3b')]};return db[_0xc340('0x2c')][_0xc340('0x1e')](_0x6447c5)[_0xc340('0x24')](function(_0x333f){_0x544863[_0xc340('0x1e')]=_0x333f;if(_0x281350['query'][_0xc340('0x3f')]){_0x43e942[_0xc340('0x40')]=[{'all':!![]}];}return db[_0xc340('0x2c')]['findAll'](_0x43e942);})[_0xc340('0x24')](function(_0x30d702){_0x544863['rows']=_0x30d702;return _0x544863;})[_0xc340('0x24')](respondWithFilteredResult(_0x5bed98,_0x43e942))[_0xc340('0x41')](handleError(_0x5bed98,null));};exports[_0xc340('0x42')]=function(_0x5009c2,_0x17ecef){var _0x19d520={'raw':![],'where':{'id':_0x5009c2['params']['id']}},_0x1d11fe={};_0x1d11fe[_0xc340('0x33')]=_[_0xc340('0x43')](db['VoiceMusicOnHold']['rawAttributes']);_0x1d11fe[_0xc340('0x30')]=_[_0xc340('0x43')](_0x5009c2[_0xc340('0x30')]);_0x1d11fe[_0xc340('0x31')]=_[_0xc340('0x32')](_0x1d11fe[_0xc340('0x33')],_0x1d11fe[_0xc340('0x30')]);_0x19d520[_0xc340('0x35')]=_[_0xc340('0x32')](_0x1d11fe[_0xc340('0x33')],qs['fields'](_0x5009c2['query'][_0xc340('0x34')]));_0x19d520[_0xc340('0x35')]=_0x19d520['attributes'][_0xc340('0x44')]?_0x19d520[_0xc340('0x35')]:_0x1d11fe[_0xc340('0x33')];if(_0x5009c2['query'][_0xc340('0x3f')]){_0x19d520[_0xc340('0x40')]=[{'all':!![]}];}_0x19d520=_['merge']({},_0x19d520,_0x5009c2['options']);return db[_0xc340('0x2c')][_0xc340('0x45')](_0x19d520)[_0xc340('0x24')](handleEntityNotFound(_0x17ecef,null))[_0xc340('0x24')](respondWithResult(_0x17ecef,null))['catch'](handleError(_0x17ecef,null));};exports[_0xc340('0x23')]=function(_0x3d3818,_0x5b8332){if(_0x3d3818[_0xc340('0x46')]['id']){delete _0x3d3818['body']['id'];}return db[_0xc340('0x2c')][_0xc340('0x45')]({'where':{'id':_0x3d3818['params']['id']}})[_0xc340('0x24')](handleEntityNotFound(_0x5b8332,null))[_0xc340('0x24')](saveUpdates(_0x3d3818[_0xc340('0x46')],null))[_0xc340('0x24')](respondWithResult(_0x5b8332,null))[_0xc340('0x41')](handleError(_0x5b8332,null));};exports[_0xc340('0x47')]=function(_0x4fae9e,_0x9d5450,_0x1eeb36){return db[_0xc340('0x48')][_0xc340('0x49')](function(_0x2748d0){if(_0x4fae9e[_0xc340('0x46')]['mode']===_0xc340('0x4a')){_0x4fae9e[_0xc340('0x46')]['directory']=path[_0xc340('0x4b')](config[_0xc340('0x4c')],_0xc340('0x4d'),_0x4fae9e[_0xc340('0x46')][_0xc340('0x2a')]);}return db[_0xc340('0x2c')][_0xc340('0x47')](_0x4fae9e[_0xc340('0x46')],{'transaction':_0x2748d0})[_0xc340('0x24')](function(_0x1a2d2d){if(_0x4fae9e[_0xc340('0x46')][_0xc340('0x4e')]===_0xc340('0x4a')){fs[_0xc340('0x4f')](_0x1a2d2d[_0xc340('0x50')],parseInt(_0xc340('0x51'),0x8));}var _0x180089=_0x4fae9e['user'][_0xc340('0x52')]({'plain':!![]});if(!_0x180089)throw new Error(_0xc340('0x53'));if(_0x180089[_0xc340('0x54')]==='user'){var _0x5e9852=_0x1a2d2d[_0xc340('0x52')]({'plain':!![]});return db[_0xc340('0x55')][_0xc340('0x45')]({'where':{'name':_0xc340('0x56'),'userProfileId':_0x180089[_0xc340('0x57')]},'raw':!![]})[_0xc340('0x24')](function(_0x18bcda){if(_0x18bcda&&_0x18bcda[_0xc340('0x58')]===0x0){return db[_0xc340('0x26')][_0xc340('0x47')]({'name':_0x5e9852[_0xc340('0x2a')],'resourceId':_0x5e9852['id'],'type':_0x18bcda[_0xc340('0x2a')],'sectionId':_0x18bcda['id']},{})[_0xc340('0x24')](function(){return _0x1a2d2d;});}else{return _0x1a2d2d;}})[_0xc340('0x41')](function(_0x257f96){logger[_0xc340('0x28')](_0xc340('0x59'),_0x257f96);});}return _0x1a2d2d;});})['then'](respondWithResult(_0x9d5450,0xc9))[_0xc340('0x41')](handleError(_0x9d5450,null));};exports[_0xc340('0x25')]=function(_0x46180d,_0x3b4c7e,_0x51c764){var _0x2ae3b6;return db['VoiceMusicOnHold'][_0xc340('0x45')]({'where':{'id':_0x46180d[_0xc340('0x5a')]['id']}})[_0xc340('0x24')](function(_0x2e2f5d){if(_0x2e2f5d){return db[_0xc340('0x48')][_0xc340('0x49')](function(_0x2cfbcc){return _0x2e2f5d[_0xc340('0x25')]({'transaction':_0x2cfbcc,'raw':!![]})[_0xc340('0x24')](function(_0x50805a){if(_0x50805a[_0xc340('0x50')]){fs[_0xc340('0x5b')](_0x50805a[_0xc340('0x50')])['forEach'](function(_0x24c16f){fs['unlinkSync'](path['join'](_0x50805a[_0xc340('0x50')],_0x24c16f));});fs['rmdirSync'](_0x50805a[_0xc340('0x50')]);}return _0x50805a;});})[_0xc340('0x41')](function(_0x2af166){throw new db[(_0xc340('0x5c'))][(_0xc340('0x5d'))](_0x2af166[_0xc340('0x5e')]);});}})[_0xc340('0x24')](handleEntityNotFound(_0x3b4c7e,null))[_0xc340('0x24')](removeEntity(_0x3b4c7e,null))['catch'](handleError(_0x3b4c7e,null));};exports[_0xc340('0x5f')]=function(_0x2d71ce,_0x4dc684,_0x11fceb){return db[_0xc340('0x48')][_0xc340('0x49')](function(_0x2cbad5){var _0x3ad240;return db['VoiceMusicOnHold'][_0xc340('0x45')]({'where':{'id':_0x2d71ce['params']['id']}})['then'](function(_0x5ded74){if(_0x5ded74){_0x3ad240=_0x5ded74;return _0x5ded74['addSound'](_0x2d71ce[_0xc340('0x46')]['id'],{'transaction':_0x2cbad5});}})[_0xc340('0x24')](function(_0x59a5f4){if(_0x59a5f4){return db['Sound'][_0xc340('0x60')]({'where':{'id':_0x2d71ce[_0xc340('0x46')]['id']},'attributes':['id',_0xc340('0x2a'),_0xc340('0x61'),_0xc340('0x62'),_0xc340('0x63')],'raw':!![]});}})['then'](function(_0x592dd7){if(_0x592dd7){var _0x34697b=path['join'](config['root'],_0xc340('0x64'),util[_0xc340('0x65')](_0xc340('0x66'),path[_0xc340('0x67')](_0x592dd7['save_name'],path[_0xc340('0x68')](_0x592dd7[_0xc340('0x61')])),_0x592dd7['converted_format']));var _0x1d1542=path[_0xc340('0x4b')](config[_0xc340('0x4c')],'server/files/moh',_0x3ad240[_0xc340('0x2a')],util[_0xc340('0x65')]('%s.%s',_0x592dd7[_0xc340('0x2a')],_0x592dd7[_0xc340('0x62')]));fs['symlinkSync'](_0x34697b,_0x1d1542);return _0x592dd7;}})['catch'](function(_0x3318bf){throw new db[(_0xc340('0x5c'))]['ValidationError'](_0x3318bf[_0xc340('0x5e')]);});})['then'](handleEntityNotFound(_0x4dc684,null))[_0xc340('0x24')](respondWithResult(_0x4dc684,0xc9))[_0xc340('0x41')](handleError(_0x4dc684,null));};exports[_0xc340('0x69')]=function(_0x10dcb1,_0xa89af1,_0x394f68){return db[_0xc340('0x48')][_0xc340('0x49')](function(_0xf32806){var _0x574c6e;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x10dcb1[_0xc340('0x5a')]['id']}})[_0xc340('0x24')](handleEntityNotFound(_0xa89af1,null))['then'](function(_0x195c88){if(_0x195c88){_0x574c6e=_0x195c88;return _0x195c88[_0xc340('0x69')](_0x10dcb1['params'][_0xc340('0x6a')]);}})[_0xc340('0x24')](function(_0x1397d5){if(_0x1397d5){return db[_0xc340('0x6b')][_0xc340('0x60')]({'where':{'id':_0x10dcb1[_0xc340('0x5a')][_0xc340('0x6a')]},'attributes':['id','name',_0xc340('0x61'),_0xc340('0x62'),_0xc340('0x63')],'raw':!![]});}})[_0xc340('0x24')](function(_0x5df925){if(_0x5df925){fs[_0xc340('0x6c')](path['join'](_0x574c6e['directory'],util['format'](_0xc340('0x66'),_0x5df925['name'],_0x5df925['converted_format'])));return _0x5df925;}})[_0xc340('0x41')](function(_0x1a71bd){throw new db['Sequelize'][(_0xc340('0x5d'))](_0x1a71bd[_0xc340('0x5e')]);});})[_0xc340('0x24')](handleEntityNotFound(_0xa89af1,null))[_0xc340('0x24')](respondWithStatusCode(_0xa89af1,0xcc))[_0xc340('0x41')](handleError(_0xa89af1,null));};exports[_0xc340('0x6d')]=function(_0x30286a,_0x1a3921,_0x1a2448){var _0x4a0801={};var _0x1bcaf3={};var _0x2d8d12;var _0xae417c;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x30286a['params']['id']}})['then'](handleEntityNotFound(_0x1a3921,null))['then'](function(_0x283828){if(_0x283828){_0x2d8d12=_0x283828;_0x1bcaf3[_0xc340('0x33')]=_[_0xc340('0x43')](db['Sound'][_0xc340('0x2d')]);_0x1bcaf3[_0xc340('0x30')]=_[_0xc340('0x43')](_0x30286a[_0xc340('0x30')]);_0x1bcaf3['filters']=_[_0xc340('0x32')](_0x1bcaf3[_0xc340('0x33')],_0x1bcaf3[_0xc340('0x30')]);_0x4a0801['attributes']=_[_0xc340('0x32')](_0x1bcaf3[_0xc340('0x33')],qs[_0xc340('0x34')](_0x30286a[_0xc340('0x30')][_0xc340('0x34')]));_0x4a0801['attributes']=_0x4a0801[_0xc340('0x35')]['length']?_0x4a0801[_0xc340('0x35')]:_0x1bcaf3[_0xc340('0x33')];_0x4a0801[_0xc340('0x37')]=qs[_0xc340('0x38')](_0x30286a[_0xc340('0x30')][_0xc340('0x38')]);_0x4a0801[_0xc340('0x3b')]=qs['filters'](_[_0xc340('0x39')](_0x30286a[_0xc340('0x30')],_0x1bcaf3[_0xc340('0x31')]));if(_0x30286a[_0xc340('0x30')]['filter']){_0x4a0801['where']=_[_0xc340('0x3d')](_0x4a0801['where'],{'$or':_['map'](_0x4a0801['attributes'],function(_0x3a81f7){var _0x170957={};_0x170957[_0x3a81f7]={'$like':'%'+_0x30286a[_0xc340('0x30')][_0xc340('0x3a')]+'%'};return _0x170957;})});}_0x4a0801=_[_0xc340('0x3d')]({},_0x4a0801,_0x30286a['options']);return _0x2d8d12['getSounds'](_0x4a0801);}})[_0xc340('0x24')](function(_0x4a526c){if(_0x4a526c){_0xae417c=_0x4a526c[_0xc340('0x44')];if(!_0x30286a[_0xc340('0x30')]['hasOwnProperty'](_0xc340('0x6e'))){_0x4a0801[_0xc340('0x1d')]=qs['limit'](_0x30286a[_0xc340('0x30')][_0xc340('0x1d')]);_0x4a0801[_0xc340('0x1b')]=qs[_0xc340('0x1b')](_0x30286a[_0xc340('0x30')][_0xc340('0x1b')]);}return _0x2d8d12[_0xc340('0x6d')](_0x4a0801);}})[_0xc340('0x24')](function(_0x682a0b){if(_0x682a0b){return _0x682a0b?{'count':_0xae417c,'rows':_0x682a0b}:null;}})[_0xc340('0x24')](respondWithResult(_0x1a3921,null))[_0xc340('0x41')](handleError(_0x1a3921,null));};
\ No newline at end of file
index f6f48c4..2b50843 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd38a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x4db54c,_0x5a9c7a){var _0x4fa9c5=function(_0x446dc3){while(--_0x446dc3){_0x4db54c['push'](_0x4db54c['shift']());}};_0x4fa9c5(++_0x5a9c7a);}(_0xd38a,0x1b6));var _0xad38=function(_0x1ca9e1,_0x8480c3){_0x1ca9e1=_0x1ca9e1-0x0;var _0x2be0f6=_0xd38a[_0x1ca9e1];return _0x2be0f6;};'use strict';var _=require(_0xad38('0x0'));var util=require(_0xad38('0x1'));var logger=require(_0xad38('0x2'))('api');var moment=require(_0xad38('0x3'));var BPromise=require(_0xad38('0x4'));var rp=require(_0xad38('0x5'));var fs=require('fs');var path=require(_0xad38('0x6'));var rimraf=require(_0xad38('0x7'));var config=require('../../config/environment');var attributes=require(_0xad38('0x8'));module['exports']=function(_0x2e1082,_0x10c73b){return _0x2e1082['define'](_0xad38('0x9'),attributes,{'tableName':_0xad38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb9c7=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb9c7,0x140));var _0x7b9c=function(_0x3e8a37,_0x37ffbe){_0x3e8a37=_0x3e8a37-0x0;var _0x4de8f1=_0xb9c7[_0x3e8a37];return _0x4de8f1;};'use strict';var _=require(_0x7b9c('0x0'));var util=require('util');var logger=require(_0x7b9c('0x1'))(_0x7b9c('0x2'));var moment=require(_0x7b9c('0x3'));var BPromise=require(_0x7b9c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b9c('0x5'));var rimraf=require(_0x7b9c('0x6'));var config=require(_0x7b9c('0x7'));var attributes=require(_0x7b9c('0x8'));module[_0x7b9c('0x9')]=function(_0x255613,_0x323bf5){return _0x255613[_0x7b9c('0xa')](_0x7b9c('0xb'),attributes,{'tableName':_0x7b9c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index cb74875..d8bb833 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x24e58f,_0x49a913){var _0x2cf3ab=function(_0x1f67ee){while(--_0x1f67ee){_0x24e58f['push'](_0x24e58f['shift']());}};_0x2cf3ab(++_0x49a913);}(_0xedd9,0xfc));var _0x9edd=function(_0x5cfb93,_0x35b4d4){_0x5cfb93=_0x5cfb93-0x0;var _0x668eee=_0xedd9[_0x5cfb93];return _0x668eee;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}
\ No newline at end of file
+var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0xc132e4,_0x1bd4ed){var _0x1e9186=function(_0x280a15){while(--_0x280a15){_0xc132e4['push'](_0xc132e4['shift']());}};_0x1e9186(++_0x1bd4ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e0000,_0x4e491a){_0x4e0000=_0x4e0000-0x0;var _0x52c3f1=_0xedd9[_0x4e0000];return _0x52c3f1;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}
\ No newline at end of file
index edf954c..5479bd8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae4a=['create','addAgents','addTeams','put','/:id','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xae4a,0x68));var _0xaae4=function(_0x20ba74,_0x533a84){_0x20ba74=_0x20ba74-0x0;var _0x249229=_0xae4a[_0x20ba74];return _0x249229;};'use strict';var multer=require(_0xaae4('0x0'));var util=require(_0xaae4('0x1'));var path=require('path');var timeout=require(_0xaae4('0x2'));var express=require(_0xaae4('0x3'));var router=express['Router']();var fs_extra=require(_0xaae4('0x4'));var auth=require(_0xaae4('0x5'));var interaction=require(_0xaae4('0x6'));var config=require(_0xaae4('0x7'));var controller=require(_0xaae4('0x8'));router[_0xaae4('0x9')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0xb')]);router[_0xaae4('0x9')](_0xaae4('0xc'),auth[_0xaae4('0xa')](),controller[_0xaae4('0xd')]);router[_0xaae4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaae4('0xe')]);router[_0xaae4('0x9')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x10')]);router[_0xaae4('0x9')](_0xaae4('0x11'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x12')]);router[_0xaae4('0x13')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0x14')]);router[_0xaae4('0x13')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x15')]);router[_0xaae4('0x13')](_0xaae4('0x11'),auth['isAuthenticated'](),controller[_0xaae4('0x16')]);router[_0xaae4('0x17')](_0xaae4('0x18'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x19')]);router['delete'](_0xaae4('0x18'),auth['isAuthenticated'](),controller[_0xaae4('0x1a')]);router[_0xaae4('0x1b')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x1c')]);router[_0xaae4('0x1b')]('/:id/teams',auth[_0xaae4('0xa')](),controller[_0xaae4('0x1d')]);module[_0xaae4('0x1e')]=router;
\ No newline at end of file
+var _0xe5d5=['index','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','post','/:id/teams','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x3ea595,_0x443025){var _0x5d30ff=function(_0x1f560e){while(--_0x1f560e){_0x3ea595['push'](_0x3ea595['shift']());}};_0x5d30ff(++_0x443025);}(_0xe5d5,0x156));var _0x5e5d=function(_0x340ff6,_0x525d55){_0x340ff6=_0x340ff6-0x0;var _0x313a4e=_0xe5d5[_0x340ff6];return _0x313a4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e5d('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e5d('0x1'));var router=express['Router']();var fs_extra=require(_0x5e5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var controller=require(_0x5e5d('0x5'));router[_0x5e5d('0x6')]('/',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x8')]);router[_0x5e5d('0x6')](_0x5e5d('0x9'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xa')]);router[_0x5e5d('0x6')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xc')]);router['get'](_0x5e5d('0xd'),auth['isAuthenticated'](),controller[_0x5e5d('0xe')]);router[_0x5e5d('0x6')]('/:id/teams',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xf')]);router[_0x5e5d('0x10')]('/',auth[_0x5e5d('0x7')](),controller['create']);router['post'](_0x5e5d('0xd'),auth[_0x5e5d('0x7')](),controller['addAgents']);router[_0x5e5d('0x10')](_0x5e5d('0x11'),auth['isAuthenticated'](),controller[_0x5e5d('0x12')]);router[_0x5e5d('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5e5d('0x14')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x15')]);router['delete'](_0x5e5d('0xd'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x16')]);router[_0x5e5d('0x14')](_0x5e5d('0x11'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x17')]);module[_0x5e5d('0x18')]=router;
\ No newline at end of file
index 17ce9aa..85df999 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbad4=['VIRTUAL','STRING','INTEGER','sequelize','exports','name'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xbad4,0x15f));var _0x4bad=function(_0x302ad7,_0x4a5160){_0x302ad7=_0x302ad7-0x0;var _0xe388f6=_0xbad4[_0x302ad7];return _0xe388f6;};'use strict';var Sequelize=require(_0x4bad('0x0'));module[_0x4bad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4bad('0x2')},'prefix':{'type':Sequelize[_0x4bad('0x3')],'get':function(_0xf25431){return'system-'+this['getDataValue'](_0x4bad('0x2'))+'-';}},'description':{'type':Sequelize[_0x4bad('0x4')]},'callerIdAll':{'type':Sequelize[_0x4bad('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x4bad('0x5')]}};
\ No newline at end of file
+var _0xbcb2=['VIRTUAL','system-','STRING','INTEGER','sequelize','exports','name'];(function(_0xa58f19,_0x401b31){var _0x272c68=function(_0x4af47d){while(--_0x4af47d){_0xa58f19['push'](_0xa58f19['shift']());}};_0x272c68(++_0x401b31);}(_0xbcb2,0x17e));var _0x2bcb=function(_0x53774d,_0x4b1229){_0x53774d=_0x53774d-0x0;var _0x20ef70=_0xbcb2[_0x53774d];return _0x20ef70;};'use strict';var Sequelize=require(_0x2bcb('0x0'));module[_0x2bcb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2bcb('0x2')},'prefix':{'type':Sequelize[_0x2bcb('0x3')],'get':function(_0x4ed1d2){return _0x2bcb('0x4')+this['getDataValue'](_0x2bcb('0x2'))+'-';}},'description':{'type':Sequelize[_0x2bcb('0x5')]},'callerIdAll':{'type':Sequelize[_0x2bcb('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x2bcb('0x6')]}};
\ No newline at end of file
index 428f30b..6460862 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x065e=['localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','VoicePrefixes','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoicePrefix','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','callerIdAll','push','Set','PREFIX-CALLERIDALL=','NoOp','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','findAll','Agents','voicePause','interface','each','upsert','UserVoicePrefix','forEach','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','every','TeamId','includes','all','union','compact','isEmpty','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x6a650f,_0x2bb822){var _0x5b0372=function(_0x1adcff){while(--_0x1adcff){_0x6a650f['push'](_0x6a650f['shift']());}};_0x5b0372(++_0x2bb822);}(_0x065e,0x1a7));var _0xe065=function(_0x5ab05b,_0x59ba0f){_0x5ab05b=_0x5ab05b-0x0;var _0x47b4ac=_0x065e[_0x5ab05b];return _0x47b4ac;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];config[_0xe065('0x16')]=_[_0xe065('0x17')](config['redis'],{'host':_0xe065('0x18'),'port':0x18eb});var socket=require(_0xe065('0x19'))(new Redis(config[_0xe065('0x16')]));require(_0xe065('0x1a'))[_0xe065('0x1b')](socket);function respondWithStatusCode(_0x541985,_0x3d3557){_0x3d3557=_0x3d3557||0xcc;return function(_0x2b4789){if(_0x2b4789){return _0x541985[_0xe065('0x1c')](_0x3d3557);}return _0x541985[_0xe065('0x1d')](_0x3d3557)[_0xe065('0x1e')]();};}function respondWithResult(_0x352206,_0x2e5feb){_0x2e5feb=_0x2e5feb||0xc8;return function(_0x545100){if(_0x545100){return _0x352206[_0xe065('0x1d')](_0x2e5feb)[_0xe065('0x1f')](_0x545100);}};}function respondWithFilteredResult(_0x54d260,_0x2bfec0){return function(_0x1d2f7a){if(_0x1d2f7a){var _0x397f05=typeof _0x2bfec0[_0xe065('0x20')]===_0xe065('0x21')&&typeof _0x2bfec0[_0xe065('0x22')]===_0xe065('0x21');var _0x5000e1=_0x1d2f7a[_0xe065('0x23')];var _0x52e9b2=_0x397f05?0x0:_0x2bfec0[_0xe065('0x20')];var _0x23233d=_0x397f05?_0x1d2f7a['count']:_0x2bfec0[_0xe065('0x20')]+_0x2bfec0['limit'];var _0xe26e9b;if(_0x23233d>=_0x5000e1){_0x23233d=_0x5000e1;_0xe26e9b=0xc8;}else{_0xe26e9b=0xce;}_0x54d260[_0xe065('0x1d')](_0xe26e9b);return _0x54d260[_0xe065('0x24')](_0xe065('0x25'),_0x52e9b2+'-'+_0x23233d+'/'+_0x5000e1)[_0xe065('0x1f')](_0x1d2f7a);}return null;};}function patchUpdates(_0x105cb2){return function(_0x22a0cb){try{jsonpatch[_0xe065('0x26')](_0x22a0cb,_0x105cb2,!![]);}catch(_0x1c5dd9){return BPromise['reject'](_0x1c5dd9);}return _0x22a0cb[_0xe065('0x27')]();};}function saveUpdates(_0x43b712,_0x44ec95){return function(_0x13f6e5){if(_0x13f6e5){return _0x13f6e5['update'](_0x43b712)['then'](function(_0x164965){return _0x164965;});}return null;};}function removeEntity(_0x530dc0,_0x14e6b6){return function(_0x27e669){if(_0x27e669){return _0x27e669[_0xe065('0x28')]()[_0xe065('0x29')](function(){var _0x418731=_0x27e669[_0xe065('0x2a')]({'plain':!![]});var _0x3b1caf=_0xe065('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b1caf,'resourceId':_0x418731['id']}})[_0xe065('0x29')](function(){return _0x27e669;});})[_0xe065('0x29')](function(){_0x530dc0[_0xe065('0x1d')](0xcc)[_0xe065('0x1e')]();});}};}function handleEntityNotFound(_0x5b1220,_0x23f573){return function(_0x55ecaa){if(!_0x55ecaa){_0x5b1220['sendStatus'](0x194);}return _0x55ecaa;};}function handleError(_0x182743,_0x2659e6){_0x2659e6=_0x2659e6||0x1f4;return function(_0x2aa766){logger['error'](_0x2aa766[_0xe065('0x2c')]);if(_0x2aa766['name']){delete _0x2aa766[_0xe065('0x2d')];}_0x182743[_0xe065('0x1d')](_0x2659e6)[_0xe065('0x2e')](_0x2aa766);};}exports[_0xe065('0x2f')]=function(_0x58c49b,_0x3f02b2){var _0x4940cf={},_0x3fa56f={},_0x2e4e4a={'count':0x0,'rows':[]};var _0x5d0864=_[_0xe065('0x30')](db['VoicePrefix'][_0xe065('0x31')],function(_0x4999b0){return{'name':_0x4999b0[_0xe065('0x32')],'type':_0x4999b0[_0xe065('0x33')][_0xe065('0x34')]};});_0x3fa56f[_0xe065('0x35')]=_['map'](_0x5d0864,_0xe065('0x2d'));_0x3fa56f[_0xe065('0x36')]=_[_0xe065('0x37')](_0x58c49b[_0xe065('0x36')]);_0x3fa56f[_0xe065('0x38')]=_[_0xe065('0x39')](_0x3fa56f['model'],_0x3fa56f[_0xe065('0x36')]);_0x4940cf[_0xe065('0x3a')]=_['intersection'](_0x3fa56f[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3b')]));_0x4940cf[_0xe065('0x3a')]=_0x4940cf[_0xe065('0x3a')][_0xe065('0x3c')]?_0x4940cf['attributes']:_0x3fa56f[_0xe065('0x35')];if(!_0x58c49b['query'][_0xe065('0x3d')](_0xe065('0x3e'))){_0x4940cf[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x58c49b[_0xe065('0x36')][_0xe065('0x22')]);_0x4940cf['offset']=qs[_0xe065('0x20')](_0x58c49b[_0xe065('0x36')][_0xe065('0x20')]);}_0x4940cf['order']=qs[_0xe065('0x3f')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3f')]);_0x4940cf[_0xe065('0x40')]=qs[_0xe065('0x38')](_['pick'](_0x58c49b[_0xe065('0x36')],_0x3fa56f[_0xe065('0x38')]),_0x5d0864);if(_0x58c49b['query'][_0xe065('0x41')]){_0x4940cf['where']=_[_0xe065('0x42')](_0x4940cf[_0xe065('0x40')],{'$or':_['map'](_0x5d0864,function(_0x3c7e70){if(_0x3c7e70[_0xe065('0x33')]!=='VIRTUAL'){var _0x16b5da={};_0x16b5da[_0x3c7e70[_0xe065('0x2d')]]={'$like':'%'+_0x58c49b[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x16b5da;}})});}_0x4940cf=_[_0xe065('0x42')]({},_0x4940cf,_0x58c49b[_0xe065('0x43')]);var _0x395cc2={'where':_0x4940cf[_0xe065('0x40')]};return db[_0xe065('0x44')][_0xe065('0x23')](_0x395cc2)[_0xe065('0x29')](function(_0x4364c3){_0x2e4e4a[_0xe065('0x23')]=_0x4364c3;if(_0x58c49b['query']['includeAll']){_0x4940cf[_0xe065('0x45')]=[{'all':!![]}];}return db[_0xe065('0x44')]['findAll'](_0x4940cf);})[_0xe065('0x29')](function(_0x448044){_0x2e4e4a[_0xe065('0x46')]=_0x448044;return _0x2e4e4a;})[_0xe065('0x29')](respondWithFilteredResult(_0x3f02b2,_0x4940cf))[_0xe065('0x47')](handleError(_0x3f02b2,null));};exports[_0xe065('0x48')]=function(_0x39440c,_0x11e82d){var _0x1f93e9={'raw':![],'where':{'id':_0x39440c[_0xe065('0x49')]['id']}},_0x52073d={};_0x52073d[_0xe065('0x35')]=_[_0xe065('0x37')](db['VoicePrefix'][_0xe065('0x31')]);_0x52073d[_0xe065('0x36')]=_[_0xe065('0x37')](_0x39440c[_0xe065('0x36')]);_0x52073d['filters']=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],_0x52073d[_0xe065('0x36')]);_0x1f93e9[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x39440c['query'][_0xe065('0x3b')]));_0x1f93e9[_0xe065('0x3a')]=_0x1f93e9[_0xe065('0x3a')][_0xe065('0x3c')]?_0x1f93e9[_0xe065('0x3a')]:_0x52073d[_0xe065('0x35')];if(_0x39440c[_0xe065('0x36')]['includeAll']){_0x1f93e9[_0xe065('0x45')]=[{'all':!![]}];}_0x1f93e9=_['merge']({},_0x1f93e9,_0x39440c[_0xe065('0x43')]);return db[_0xe065('0x44')][_0xe065('0x4a')](_0x1f93e9)['then'](handleEntityNotFound(_0x11e82d,null))[_0xe065('0x29')](respondWithResult(_0x11e82d,null))[_0xe065('0x47')](handleError(_0x11e82d,null));};exports[_0xe065('0x28')]=function(_0x162d11,_0x3c6880){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x162d11[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x3c6880,null))[_0xe065('0x29')](removeEntity(_0x3c6880,null))[_0xe065('0x47')](handleError(_0x3c6880,null));};exports[_0xe065('0x4b')]=function(_0x14327f,_0x490498){return db['VoicePrefix']['describe']()[_0xe065('0x29')](respondWithResult(_0x490498,null))['catch'](handleError(_0x490498,null));};exports[_0xe065('0x4c')]=function(_0x2c5e42,_0x5a7a98){var _0x480aec;return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5cce78){return db[_0xe065('0x44')][_0xe065('0x4c')](_0x2c5e42[_0xe065('0x4f')],{'transaction':_0x5cce78})[_0xe065('0x29')](function(_0x12df39){_0x480aec=_0x12df39[_0xe065('0x2a')]({'plain':!![]});return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0x480aec[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0x49a367){return createVoicePrefixExtensions(_0x480aec,_0x49a367,_0x5cce78);});});})[_0xe065('0x29')](function(){var _0x18eb92=_0x2c5e42[_0xe065('0x52')][_0xe065('0x2a')]({'plain':!![]});if(!_0x18eb92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18eb92[_0xe065('0x53')]===_0xe065('0x52')){var _0x21884d=_0x480aec;return db[_0xe065('0x54')]['find']({'where':{'name':_0xe065('0x2b'),'userProfileId':_0x18eb92[_0xe065('0x55')]},'raw':!![]})[_0xe065('0x29')](function(_0x5320c6){if(_0x5320c6&&_0x5320c6[_0xe065('0x56')]===0x0){return db[_0xe065('0x57')][_0xe065('0x4c')]({'name':_0x21884d[_0xe065('0x2d')],'resourceId':_0x21884d['id'],'type':_0x5320c6[_0xe065('0x2d')],'sectionId':_0x5320c6['id']},{})[_0xe065('0x29')](function(){return _0x480aec;});}else{return _0x480aec;}})[_0xe065('0x47')](function(_0x464ef7){logger[_0xe065('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464ef7);throw _0x464ef7;});}return _0x480aec;})[_0xe065('0x29')](respondWithResult(_0x5a7a98,null))['catch'](handleError(_0x5a7a98,null));};function Extension(_0x44edf0,_0x24fc1c,_0x3c1229,_0x4e9e85){this['context']='from-sip';this[_0xe065('0x59')]=_0x44edf0;this[_0xe065('0x5a')]=_0x3c1229;this[_0xe065('0x33')]=_0xe065('0x5b');this[_0xe065('0x5c')]=_0xe065('0x5d');this[_0xe065('0x5e')]=_0x24fc1c;this[_0xe065('0x5f')]=_0x4e9e85;}function createVoicePrefixExtensions(_0x20abe0,_0x3169fa,_0x25ec8a){return new BPromise(function(_0x590429,_0x544bff){var _0x2fe0ac=new Extension(formatPrefixName(_0x20abe0[_0xe065('0x60')]),0x1,'NoOp',_0xe065('0x61'));_0x2fe0ac['VoicePrefixId']=_0x20abe0['id'];return db['VoiceExtension'][_0xe065('0x4c')](_0x2fe0ac,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4e7275){var _0x96355e=_0x4e7275[_0xe065('0x2a')]({'plain':!![]});var _0x817baf=_[_0xe065('0x30')](addVoicePrefixExtensions(_0x20abe0,_0x3169fa),function(_0x5edc0f){_0x5edc0f[_0xe065('0x51')]=_0x96355e['id'];_0x5edc0f[_0xe065('0x62')]=_0x20abe0['id'];return _0x5edc0f;});return db[_0xe065('0x50')][_0xe065('0x63')](_0x817baf,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4f35a6){if(!_0x4f35a6){return _0x544bff(_0xe065('0x64'));}else{return _0x590429(_0x4f35a6);}})[_0xe065('0x47')](function(_0x29b3f0){return _0x544bff(_0x29b3f0);});});;});};function addVoicePrefixExtensions(_0x155133,_0x2968c5){var _0xfce2e=[];var _0x5af9d5=formatPrefixName(_0x155133['prefix']);_0xfce2e['push'](new Extension(_0x5af9d5,0x2,'Set','CDR(prefix)='+_0x155133[_0xe065('0x2d')]));if(_0x155133[_0xe065('0x65')]){_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x67'),_0xe065('0x68')+_0x155133[_0xe065('0x65')]));}else{_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x69'),'No\x20callerid\x20available'));}_0xfce2e['push'](new Extension(_0x5af9d5,0x4,_0xe065('0x6a'),_0x2968c5[_0xe065('0x6b')]+','+_0xe065('0x6c')+(0x8+_0x155133['name'][_0xe065('0x3c')])+'}'+','+0x1));return _0xfce2e;}function formatPrefixName(_0x268428){var _0x113a0f='_';for(var _0x4765a0=0x0;_0x4765a0<_0x268428[_0xe065('0x3c')];_0x4765a0++){if(_0x268428[_0xe065('0x6d')](_0x4765a0)=='-'){_0x113a0f+=_0x268428[_0xe065('0x6d')](_0x4765a0);}else{_0x113a0f+='['+_0x268428[_0xe065('0x6d')](_0x4765a0)+']';}}_0x113a0f+='.';return _0x113a0f;}exports[_0xe065('0x6e')]=function(_0xecef2,_0x213feb,_0x4493db){var _0xa5310c=_0xecef2[_0xe065('0x4f')];_0xa5310c[_0xe065('0x60')]=_0xe065('0x6f')+_0xa5310c[_0xe065('0x2d')]+'-';return db[_0xe065('0x4d')]['transaction'](function(_0x31d6cb){return db[_0xe065('0x44')][_0xe065('0x6e')](_0xa5310c,{'where':{'id':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x28')]({'where':{'VoicePrefixId':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0xa5310c[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0xa08631){return createVoicePrefixExtensions(_0xa5310c,_0xa08631,_0x31d6cb);});});});})[_0xe065('0x29')](function(){return db[_0xe065('0x44')][_0xe065('0x70')](_0xa5310c['id']);})[_0xe065('0x29')](respondWithResult(_0x213feb,null))[_0xe065('0x47')](handleError(_0x213feb,null));};exports['addAgents']=function(_0x256eef,_0x185b5b,_0x3e2241){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x256eef[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x185b5b,null))[_0xe065('0x29')](function(_0x54b1f2){if(_0x54b1f2){return _0x54b1f2[_0xe065('0x71')](_0x256eef['body']['ids'],_[_0xe065('0x72')](_0x256eef['body'],[_0xe065('0x73'),'id'])||{})['spread'](function(_0x1df721){for(var _0x162482=0x0;_0x162482<_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0xe065('0x3c')];_0x162482+=0x1){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':Number(_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0x162482]),'VoicePrefixId':Number(_0x256eef['params']['id'])});}return _0x1df721;});}})[_0xe065('0x29')](respondWithResult(_0x185b5b,null))[_0xe065('0x47')](handleError(_0x185b5b,null));};exports[_0xe065('0x76')]=function(_0x3f8e32,_0x5858d9,_0x26c427){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3f8e32['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x5858d9,null))[_0xe065('0x29')](function(_0x3c024b){if(_0x3c024b){return _0x3c024b['removeAgents'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])['then'](function(){if(_['isArray'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])){for(var _0x1b8c33=0x0;_0x1b8c33<_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]['length'];_0x1b8c33+=0x1){socket['emit'](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')]['ids'][_0x1b8c33]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}}else{socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}});}})[_0xe065('0x29')](respondWithStatusCode(_0x5858d9,null))[_0xe065('0x47')](handleError(_0x5858d9,null));};exports[_0xe065('0x78')]=function(_0x1ec81f,_0x4d25b9,_0x5d940d){var _0x34174f={};var _0x5336e3={};var _0x2451ec;var _0x45b479;return db[_0xe065('0x44')]['findOne']({'where':{'id':_0x1ec81f[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x4d25b9,null))[_0xe065('0x29')](function(_0x124054){if(_0x124054){_0x2451ec=_0x124054;_0x5336e3[_0xe065('0x35')]=_[_0xe065('0x37')](db[_0xe065('0x79')][_0xe065('0x31')]);_0x5336e3[_0xe065('0x36')]=_[_0xe065('0x37')](_0x1ec81f[_0xe065('0x36')]);_0x5336e3['filters']=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],_0x5336e3[_0xe065('0x36')]);_0x34174f[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3b')]));_0x34174f[_0xe065('0x3a')]=_0x34174f[_0xe065('0x3a')][_0xe065('0x3c')]?_0x34174f['attributes']:_0x5336e3[_0xe065('0x35')];_0x34174f[_0xe065('0x7a')]=qs[_0xe065('0x3f')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3f')]);_0x34174f[_0xe065('0x40')]=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0x1ec81f[_0xe065('0x36')],_0x5336e3[_0xe065('0x38')]));if(_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]){_0x34174f[_0xe065('0x40')]=_[_0xe065('0x42')](_0x34174f[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x34174f[_0xe065('0x3a')],function(_0x47792d){var _0x105eaa={};_0x105eaa[_0x47792d]={'$like':'%'+_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x105eaa;})});}_0x34174f=_[_0xe065('0x42')]({},_0x34174f,_0x1ec81f[_0xe065('0x43')]);return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x428745){if(_0x428745){_0x45b479=_0x428745[_0xe065('0x3c')];if(!_0x1ec81f[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x34174f[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x22')]);_0x34174f[_0xe065('0x20')]=qs[_0xe065('0x20')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x20')]);}return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x4da03f){if(_0x4da03f){return _0x4da03f?{'count':_0x45b479,'rows':_0x4da03f}:null;}})[_0xe065('0x29')](respondWithResult(_0x4d25b9,null))[_0xe065('0x47')](handleError(_0x4d25b9,null));};exports[_0xe065('0x7c')]=function(_0xe199d7,_0x40231d,_0x34b37c){var _0x24ebbd={};var _0x22bc5c={};var _0x5d6761;var _0x2f2f53;return db['VoicePrefix'][_0xe065('0x7d')]({'where':{'id':_0xe199d7['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x40231d,null))[_0xe065('0x29')](function(_0x19e3cf){if(_0x19e3cf){_0x5d6761=_0x19e3cf;_0x22bc5c[_0xe065('0x35')]=_['keys'](db['Team'][_0xe065('0x31')]);_0x22bc5c[_0xe065('0x36')]=_[_0xe065('0x37')](_0xe199d7['query']);_0x22bc5c[_0xe065('0x38')]=_[_0xe065('0x39')](_0x22bc5c[_0xe065('0x35')],_0x22bc5c['query']);_0x24ebbd['attributes']=_['intersection'](_0x22bc5c['model'],qs[_0xe065('0x3b')](_0xe199d7[_0xe065('0x36')][_0xe065('0x3b')]));_0x24ebbd[_0xe065('0x3a')]=_0x24ebbd[_0xe065('0x3a')]['length']?_0x24ebbd[_0xe065('0x3a')]:_0x22bc5c[_0xe065('0x35')];_0x24ebbd['order']=qs[_0xe065('0x3f')](_0xe199d7['query'][_0xe065('0x3f')]);_0x24ebbd['where']=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0xe199d7[_0xe065('0x36')],_0x22bc5c[_0xe065('0x38')]));if(_0xe199d7[_0xe065('0x36')][_0xe065('0x41')]){_0x24ebbd[_0xe065('0x40')]=_[_0xe065('0x42')](_0x24ebbd[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x24ebbd[_0xe065('0x3a')],function(_0x242712){var _0xa89a0e={};_0xa89a0e[_0x242712]={'$like':'%'+_0xe199d7[_0xe065('0x36')]['filter']+'%'};return _0xa89a0e;})});}_0x24ebbd=_['merge']({},_0x24ebbd,_0xe199d7[_0xe065('0x43')]);return _0x5d6761[_0xe065('0x7c')](_0x24ebbd);}})['then'](function(_0x33a5b9){if(_0x33a5b9){_0x2f2f53=_0x33a5b9[_0xe065('0x3c')];if(!_0xe199d7[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x24ebbd[_0xe065('0x22')]=qs[_0xe065('0x22')](_0xe199d7['query']['limit']);_0x24ebbd[_0xe065('0x20')]=qs[_0xe065('0x20')](_0xe199d7[_0xe065('0x36')][_0xe065('0x20')]);}return _0x5d6761['getTeams'](_0x24ebbd);}})[_0xe065('0x29')](function(_0x33f41c){if(_0x33f41c){return _0x33f41c?{'count':_0x2f2f53,'rows':_0x33f41c}:null;}})[_0xe065('0x29')](respondWithResult(_0x40231d,null))[_0xe065('0x47')](handleError(_0x40231d,null));};exports[_0xe065('0x7e')]=function(_0x123188,_0x490961,_0x3cd1c8){var _0x4a63da=_0x123188['body'][_0xe065('0x73')];var _0x14440a;return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x4a63da},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe065('0x81'),'attributes':['id',_0xe065('0x2d'),'online',_0xe065('0x82'),_0xe065('0x83')],'raw':!![]}]})[_0xe065('0x29')](function(_0x29ecc6){if(_0x29ecc6){_0x14440a=_0x29ecc6;var _0x2aab25=_['flatMap'](_0x29ecc6,function(_0x1998ee){var _0x5df1f5=_0x1998ee[_0xe065('0x2a')]({'plain':!![]});return _0x5df1f5['Agents'];});return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x123188[_0xe065('0x49')]['id']}})['then'](function(_0x4d68c2){return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5c61df){return _0x4d68c2[_0xe065('0x7e')](_0x4a63da,{'transaction':_0x5c61df})['then'](function(){return BPromise[_0xe065('0x84')](_0x14440a,function(_0x41c62a){return db['TeamVoicePrefix'][_0xe065('0x85')]({'TeamId':_0x41c62a['id'],'VoicePrefixId':_0x123188[_0xe065('0x49')]['id']},{'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){return BPromise[_0xe065('0x84')](_0x2aab25,function(_0xd8b280){return db[_0xe065('0x86')]['findOrCreate']({'where':{'UserId':_0xd8b280['id'],'VoicePrefixId':_0x123188['params']['id']},'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){_0x2aab25[_0xe065('0x87')](function(_0x41d5b5){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':_0x41d5b5['id'],'VoicePrefixId':_0x4d68c2['id']});});});});});}})['then'](respondWithStatusCode(_0x490961,null))['catch'](handleError(_0x490961,null));};exports['removeTeams']=function(_0x3e51b4,_0xab9cb,_0x5d64af){return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x3e51b4[_0xe065('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe065('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xab9cb,null))[_0xe065('0x29')](function(_0x42afb3){var _0x38119f=_[_0xe065('0x30')](_0x42afb3,'id');var _0x5b7ce9=[];var _0xa80c6d=[];var _0x3a46d3=squel['select']();_0x3a46d3[_0xe065('0x88')](_0xe065('0x89'))[_0xe065('0x8a')]('team_has_voice_prefixes','tq')[_0xe065('0x8b')]('user_has_teams','ut',_0xe065('0x8c'))[_0xe065('0x40')]('VoicePrefixId\x20=\x20?',_0x3e51b4['params']['id']);for(var _0x451186=0x0;_0x451186<_0x42afb3[_0xe065('0x3c')];_0x451186+=0x1){let _0x16e82a=_0x42afb3[_0x451186];for(var _0x243415=0x0;_0x243415<_0x16e82a[_0xe065('0x81')][_0xe065('0x3c')];_0x243415+=0x1){let _0x2b8d04=_0x16e82a['Agents'][_0x243415];var _0x572836=_0x3a46d3['clone']();_0x572836[_0xe065('0x40')](_0xe065('0x8d'),_0x2b8d04['id']);_0xa80c6d['push'](db[_0xe065('0x4d')][_0xe065('0x36')](_0x572836['toString'](),{'type':db[_0xe065('0x4d')]['QueryTypes']['SELECT']})[_0xe065('0x29')](function(_0x1a21c0){if(_0x1a21c0[_0xe065('0x3c')]===0x1){return _0x2b8d04['id'];}else{var _0x5c7e10=_[_0xe065('0x8e')](_[_0xe065('0x30')](_0x1a21c0,_0xe065('0x8f')),function(_0x10a15e){return _[_0xe065('0x90')](_0x38119f,_0x10a15e);});if(_0x5c7e10){return _0x2b8d04['id'];}}}));}}return BPromise[_0xe065('0x91')](_0xa80c6d)[_0xe065('0x29')](function(_0x20c16c){_0x5b7ce9=_(_0x5b7ce9)[_0xe065('0x92')](_0x20c16c)[_0xe065('0x93')]()['value']();return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3e51b4[_0xe065('0x49')]['id']}})[_0xe065('0x29')](function(_0x97b140){return db['sequelize'][_0xe065('0x4e')](function(_0x257ea2){return _0x97b140['removeTeams'](_0x3e51b4['query'][_0xe065('0x73')],{'transaction':_0x257ea2})[_0xe065('0x29')](function(){if(!_[_0xe065('0x94')](_0x5b7ce9)){return _0x97b140[_0xe065('0x76')](_0x5b7ce9,{'transaction':_0x257ea2});}})['then'](function(){_0x5b7ce9[_0xe065('0x87')](function(_0x1113fa){socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':_0x1113fa,'VoicePrefixId':_0x97b140['id']});});});});});});})['then'](respondWithStatusCode(_0xab9cb,null))[_0xe065('0x47')](handleError(_0xab9cb,null));};
\ No newline at end of file
+var _0xb62e=['all','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','describe','create','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','nolimit','getTeams','Team','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','SELECT','every','TeamId','includes'];(function(_0x51318c,_0x839354){var _0x52d589=function(_0x3997f9){while(--_0x3997f9){_0x51318c['push'](_0x51318c['shift']());}};_0x52d589(++_0x839354);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1b')]=_[_0xeb62('0x1c')](config[_0xeb62('0x1b')],{'host':_0xeb62('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1b')]));require(_0xeb62('0x1e'))[_0xeb62('0x1f')](socket);function respondWithStatusCode(_0x4da178,_0x26c3fd){_0x26c3fd=_0x26c3fd||0xcc;return function(_0x195837){if(_0x195837){return _0x4da178[_0xeb62('0x20')](_0x26c3fd);}return _0x4da178['status'](_0x26c3fd)[_0xeb62('0x21')]();};}function respondWithResult(_0x15b3e8,_0x184106){_0x184106=_0x184106||0xc8;return function(_0x353e2c){if(_0x353e2c){return _0x15b3e8[_0xeb62('0x22')](_0x184106)[_0xeb62('0x23')](_0x353e2c);}};}function respondWithFilteredResult(_0x1fb460,_0x1324d7){return function(_0x39b138){if(_0x39b138){var _0x27fd84=typeof _0x1324d7[_0xeb62('0x24')]===_0xeb62('0x25')&&typeof _0x1324d7[_0xeb62('0x26')]==='undefined';var _0x38c5e4=_0x39b138[_0xeb62('0x27')];var _0x332396=_0x27fd84?0x0:_0x1324d7[_0xeb62('0x24')];var _0x425817=_0x27fd84?_0x39b138[_0xeb62('0x27')]:_0x1324d7[_0xeb62('0x24')]+_0x1324d7['limit'];var _0x599d0b;if(_0x425817>=_0x38c5e4){_0x425817=_0x38c5e4;_0x599d0b=0xc8;}else{_0x599d0b=0xce;}_0x1fb460[_0xeb62('0x22')](_0x599d0b);return _0x1fb460[_0xeb62('0x28')](_0xeb62('0x29'),_0x332396+'-'+_0x425817+'/'+_0x38c5e4)[_0xeb62('0x23')](_0x39b138);}return null;};}function patchUpdates(_0x122b15){return function(_0x4cafcf){try{jsonpatch['apply'](_0x4cafcf,_0x122b15,!![]);}catch(_0x4664ce){return BPromise[_0xeb62('0x2a')](_0x4664ce);}return _0x4cafcf[_0xeb62('0x2b')]();};}function saveUpdates(_0x395b70,_0x55a169){return function(_0x4e92f5){if(_0x4e92f5){return _0x4e92f5[_0xeb62('0x2c')](_0x395b70)['then'](function(_0x448327){return _0x448327;});}return null;};}function removeEntity(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(_0x516a72){return _0x516a72[_0xeb62('0x2d')]()[_0xeb62('0x2e')](function(){var _0x46d1bb=_0x516a72['get']({'plain':!![]});var _0x3ef784=_0xeb62('0x2f');return db[_0xeb62('0x30')][_0xeb62('0x2d')]({'where':{'type':_0x3ef784,'resourceId':_0x46d1bb['id']}})[_0xeb62('0x2e')](function(){return _0x516a72;});})[_0xeb62('0x2e')](function(){_0x4b0f46['status'](0xcc)[_0xeb62('0x21')]();});}};}function handleEntityNotFound(_0x1616ee,_0x57169a){return function(_0x157474){if(!_0x157474){_0x1616ee[_0xeb62('0x20')](0x194);}return _0x157474;};}function handleError(_0x2c967c,_0x2c308c){_0x2c308c=_0x2c308c||0x1f4;return function(_0x235448){logger['error'](_0x235448['stack']);if(_0x235448[_0xeb62('0x31')]){delete _0x235448[_0xeb62('0x31')];}_0x2c967c[_0xeb62('0x22')](_0x2c308c)[_0xeb62('0x32')](_0x235448);};}exports[_0xeb62('0x33')]=function(_0x2ad3ec,_0x1ae51e){var _0x4be25d={},_0x411062={},_0x47a94b={'count':0x0,'rows':[]};var _0x555db1=_[_0xeb62('0x34')](db[_0xeb62('0x35')]['rawAttributes'],function(_0x1ade38){return{'name':_0x1ade38['fieldName'],'type':_0x1ade38[_0xeb62('0x36')][_0xeb62('0x37')]};});_0x411062['model']=_[_0xeb62('0x34')](_0x555db1,_0xeb62('0x31'));_0x411062['query']=_[_0xeb62('0x38')](_0x2ad3ec[_0xeb62('0x39')]);_0x411062[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x411062['model'],_0x411062[_0xeb62('0x39')]);_0x4be25d[_0xeb62('0x3c')]=_['intersection'](_0x411062['model'],qs[_0xeb62('0x3d')](_0x2ad3ec[_0xeb62('0x39')]['fields']));_0x4be25d[_0xeb62('0x3c')]=_0x4be25d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x4be25d[_0xeb62('0x3c')]:_0x411062[_0xeb62('0x3f')];if(!_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x40')]('nolimit')){_0x4be25d['limit']=qs[_0xeb62('0x26')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x26')]);_0x4be25d[_0xeb62('0x24')]=qs['offset'](_0x2ad3ec[_0xeb62('0x39')]['offset']);}_0x4be25d[_0xeb62('0x41')]=qs[_0xeb62('0x42')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x42')]);_0x4be25d[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x2ad3ec[_0xeb62('0x39')],_0x411062['filters']),_0x555db1);if(_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x45')]){_0x4be25d[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0x4be25d['where'],{'$or':_['map'](_0x555db1,function(_0x46a560){if(_0x46a560[_0xeb62('0x36')]!=='VIRTUAL'){var _0x1f7036={};_0x1f7036[_0x46a560[_0xeb62('0x31')]]={'$like':'%'+_0x2ad3ec['query'][_0xeb62('0x45')]+'%'};return _0x1f7036;}})});}_0x4be25d=_['merge']({},_0x4be25d,_0x2ad3ec[_0xeb62('0x47')]);var _0x47b815={'where':_0x4be25d[_0xeb62('0x43')]};return db['VoicePrefix'][_0xeb62('0x27')](_0x47b815)[_0xeb62('0x2e')](function(_0x317f50){_0x47a94b['count']=_0x317f50;if(_0x2ad3ec['query'][_0xeb62('0x48')]){_0x4be25d[_0xeb62('0x49')]=[{'all':!![]}];}return db[_0xeb62('0x35')][_0xeb62('0x4a')](_0x4be25d);})[_0xeb62('0x2e')](function(_0x4afd5e){_0x47a94b[_0xeb62('0x4b')]=_0x4afd5e;return _0x47a94b;})['then'](respondWithFilteredResult(_0x1ae51e,_0x4be25d))[_0xeb62('0x4c')](handleError(_0x1ae51e,null));};exports['show']=function(_0xeeced2,_0x4d2f80){var _0x26c77d={'raw':![],'where':{'id':_0xeeced2[_0xeb62('0x4d')]['id']}},_0x4dbcac={};_0x4dbcac[_0xeb62('0x3f')]=_[_0xeb62('0x38')](db[_0xeb62('0x35')][_0xeb62('0x4e')]);_0x4dbcac[_0xeb62('0x39')]=_['keys'](_0xeeced2[_0xeb62('0x39')]);_0x4dbcac[_0xeb62('0x3a')]=_['intersection'](_0x4dbcac['model'],_0x4dbcac['query']);_0x26c77d['attributes']=_[_0xeb62('0x3b')](_0x4dbcac[_0xeb62('0x3f')],qs['fields'](_0xeeced2[_0xeb62('0x39')][_0xeb62('0x3d')]));_0x26c77d[_0xeb62('0x3c')]=_0x26c77d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x26c77d['attributes']:_0x4dbcac[_0xeb62('0x3f')];if(_0xeeced2['query'][_0xeb62('0x48')]){_0x26c77d[_0xeb62('0x49')]=[{'all':!![]}];}_0x26c77d=_[_0xeb62('0x46')]({},_0x26c77d,_0xeeced2[_0xeb62('0x47')]);return db[_0xeb62('0x35')][_0xeb62('0x4f')](_0x26c77d)[_0xeb62('0x2e')](handleEntityNotFound(_0x4d2f80,null))[_0xeb62('0x2e')](respondWithResult(_0x4d2f80,null))[_0xeb62('0x4c')](handleError(_0x4d2f80,null));};exports[_0xeb62('0x2d')]=function(_0xe13846,_0x13e102){return db['VoicePrefix'][_0xeb62('0x4f')]({'where':{'id':_0xe13846['params']['id']}})['then'](handleEntityNotFound(_0x13e102,null))[_0xeb62('0x2e')](removeEntity(_0x13e102,null))[_0xeb62('0x4c')](handleError(_0x13e102,null));};exports['describe']=function(_0x373505,_0x462760){return db['VoicePrefix'][_0xeb62('0x50')]()[_0xeb62('0x2e')](respondWithResult(_0x462760,null))[_0xeb62('0x4c')](handleError(_0x462760,null));};exports[_0xeb62('0x51')]=function(_0xe71e83,_0x1e6238){var _0x351027;return db[_0xeb62('0x52')]['transaction'](function(_0x3e2be9){return db['VoicePrefix'][_0xeb62('0x51')](_0xe71e83[_0xeb62('0x53')],{'transaction':_0x3e2be9})[_0xeb62('0x2e')](function(_0x289af0){_0x351027=_0x289af0[_0xeb62('0x54')]({'plain':!![]});return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x351027[_0xeb62('0x56')]},'raw':!![]})['then'](function(_0x4d31a1){return createVoicePrefixExtensions(_0x351027,_0x4d31a1,_0x3e2be9);});});})['then'](function(){var _0x5033eb=_0xe71e83[_0xeb62('0x57')]['get']({'plain':!![]});if(!_0x5033eb)throw new Error(_0xeb62('0x58'));if(_0x5033eb['role']===_0xeb62('0x57')){var _0x342768=_0x351027;return db[_0xeb62('0x59')]['find']({'where':{'name':_0xeb62('0x2f'),'userProfileId':_0x5033eb[_0xeb62('0x5a')]},'raw':!![]})['then'](function(_0x35982a){if(_0x35982a&&_0x35982a[_0xeb62('0x5b')]===0x0){return db[_0xeb62('0x30')][_0xeb62('0x51')]({'name':_0x342768['name'],'resourceId':_0x342768['id'],'type':_0x35982a[_0xeb62('0x31')],'sectionId':_0x35982a['id']},{})[_0xeb62('0x2e')](function(){return _0x351027;});}else{return _0x351027;}})['catch'](function(_0x2eba52){logger[_0xeb62('0x5c')](_0xeb62('0x5d'),_0x2eba52);throw _0x2eba52;});}return _0x351027;})[_0xeb62('0x2e')](respondWithResult(_0x1e6238,null))[_0xeb62('0x4c')](handleError(_0x1e6238,null));};function Extension(_0x46da69,_0x3e55bf,_0x1b354d,_0x222d0c){this[_0xeb62('0x5e')]=_0xeb62('0x5f');this[_0xeb62('0x60')]=_0x46da69;this[_0xeb62('0x61')]=_0x1b354d;this[_0xeb62('0x36')]=_0xeb62('0x62');this[_0xeb62('0x63')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3e55bf;this['appdata']=_0x222d0c;}function createVoicePrefixExtensions(_0x5b28ec,_0x279b83,_0x5f363d){return new BPromise(function(_0x10cc40,_0x136d81){var _0x5b8c4=new Extension(formatPrefixName(_0x5b28ec[_0xeb62('0x64')]),0x1,_0xeb62('0x65'),_0xeb62('0x66'));_0x5b8c4[_0xeb62('0x67')]=_0x5b28ec['id'];return db[_0xeb62('0x55')][_0xeb62('0x51')](_0x5b8c4,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x52dfbd){var _0x113302=_0x52dfbd[_0xeb62('0x54')]({'plain':!![]});var _0x42e992=_[_0xeb62('0x34')](addVoicePrefixExtensions(_0x5b28ec,_0x279b83),function(_0x4aba1f){_0x4aba1f[_0xeb62('0x56')]=_0x113302['id'];_0x4aba1f[_0xeb62('0x67')]=_0x5b28ec['id'];return _0x4aba1f;});return db[_0xeb62('0x55')][_0xeb62('0x68')](_0x42e992,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x1679a7){if(!_0x1679a7){return _0x136d81(_0xeb62('0x69'));}else{return _0x10cc40(_0x1679a7);}})[_0xeb62('0x4c')](function(_0x2e1fb8){return _0x136d81(_0x2e1fb8);});});;});};function addVoicePrefixExtensions(_0x2b788e,_0x1d8675){var _0x510275=[];var _0x110224=formatPrefixName(_0x2b788e[_0xeb62('0x64')]);_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x2,_0xeb62('0x6b'),_0xeb62('0x6c')+_0x2b788e[_0xeb62('0x31')]));if(_0x2b788e[_0xeb62('0x6d')]){_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x6b'),_0xeb62('0x6e')+_0x2b788e['callerIdAll']));}else{_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x65'),_0xeb62('0x6f')));}_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x4,'goto',_0x1d8675[_0xeb62('0x5e')]+','+_0xeb62('0x70')+(0x8+_0x2b788e[_0xeb62('0x31')][_0xeb62('0x3e')])+'}'+','+0x1));return _0x510275;}function formatPrefixName(_0xc81d4c){var _0x32642f='_';for(var _0x48488c=0x0;_0x48488c<_0xc81d4c[_0xeb62('0x3e')];_0x48488c++){if(_0xc81d4c[_0xeb62('0x71')](_0x48488c)=='-'){_0x32642f+=_0xc81d4c[_0xeb62('0x71')](_0x48488c);}else{_0x32642f+='['+_0xc81d4c[_0xeb62('0x71')](_0x48488c)+']';}}_0x32642f+='.';return _0x32642f;}exports[_0xeb62('0x2c')]=function(_0x28d0ff,_0x2e4502,_0x313d33){var _0x233715=_0x28d0ff[_0xeb62('0x53')];_0x233715[_0xeb62('0x64')]=_0xeb62('0x72')+_0x233715[_0xeb62('0x31')]+'-';return db[_0xeb62('0x52')][_0xeb62('0x73')](function(_0x2bbbff){return db['VoicePrefix'][_0xeb62('0x2c')](_0x233715,{'where':{'id':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x2d')]({'where':{'VoicePrefixId':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x233715[_0xeb62('0x56')]},'raw':!![]})[_0xeb62('0x2e')](function(_0x206e77){return createVoicePrefixExtensions(_0x233715,_0x206e77,_0x2bbbff);});});});})[_0xeb62('0x2e')](function(){return db[_0xeb62('0x35')][_0xeb62('0x74')](_0x233715['id']);})[_0xeb62('0x2e')](respondWithResult(_0x2e4502,null))[_0xeb62('0x4c')](handleError(_0x2e4502,null));};exports[_0xeb62('0x75')]=function(_0x146174,_0x910940,_0x4c6b69){return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146174['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x910940,null))['then'](function(_0x32679a){if(_0x32679a){return _0x32679a[_0xeb62('0x75')](_0x146174[_0xeb62('0x53')][_0xeb62('0x76')],_[_0xeb62('0x77')](_0x146174[_0xeb62('0x53')],['ids','id'])||{})[_0xeb62('0x78')](function(_0x4fc07f){for(var _0x42ee4d=0x0;_0x42ee4d<_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x42ee4d+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':Number(_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0x42ee4d]),'VoicePrefixId':Number(_0x146174[_0xeb62('0x4d')]['id'])});}return _0x4fc07f;});}})['then'](respondWithResult(_0x910940,null))[_0xeb62('0x4c')](handleError(_0x910940,null));};exports[_0xeb62('0x7a')]=function(_0x8a8ef3,_0x7ca547,_0x16c28d){return db[_0xeb62('0x35')]['find']({'where':{'id':_0x8a8ef3['params']['id']}})['then'](handleEntityNotFound(_0x7ca547,null))['then'](function(_0x5bf6f6){if(_0x5bf6f6){return _0x5bf6f6[_0xeb62('0x7a')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])[_0xeb62('0x2e')](function(){if(_[_0xeb62('0x7b')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])){for(var _0x1c01ae=0x0;_0x1c01ae<_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x1c01ae+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0x1c01ae]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}}else{socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x7ca547,null))[_0xeb62('0x4c')](handleError(_0x7ca547,null));};exports[_0xeb62('0x7d')]=function(_0x17beef,_0x45b2a3,_0x42c384){var _0xfff29b={};var _0x1cbfab={};var _0x29648f;var _0x2f5f2f;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x17beef['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x45b2a3,null))[_0xeb62('0x2e')](function(_0x48dcf6){if(_0x48dcf6){_0x29648f=_0x48dcf6;_0x1cbfab[_0xeb62('0x3f')]=_['keys'](db['User'][_0xeb62('0x4e')]);_0x1cbfab[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x17beef[_0xeb62('0x39')]);_0x1cbfab['filters']=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],_0x1cbfab['query']);_0xfff29b[_0xeb62('0x3c')]=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x17beef[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xfff29b[_0xeb62('0x3c')]=_0xfff29b[_0xeb62('0x3c')]['length']?_0xfff29b[_0xeb62('0x3c')]:_0x1cbfab[_0xeb62('0x3f')];_0xfff29b['order']=qs[_0xeb62('0x42')](_0x17beef['query']['sort']);_0xfff29b[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x17beef[_0xeb62('0x39')],_0x1cbfab[_0xeb62('0x3a')]));if(_0x17beef['query'][_0xeb62('0x45')]){_0xfff29b[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0xfff29b[_0xeb62('0x43')],{'$or':_[_0xeb62('0x34')](_0xfff29b[_0xeb62('0x3c')],function(_0x401ad1){var _0x50170b={};_0x50170b[_0x401ad1]={'$like':'%'+_0x17beef['query']['filter']+'%'};return _0x50170b;})});}_0xfff29b=_[_0xeb62('0x46')]({},_0xfff29b,_0x17beef[_0xeb62('0x47')]);return _0x29648f[_0xeb62('0x7d')](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x599418){if(_0x599418){_0x2f5f2f=_0x599418[_0xeb62('0x3e')];if(!_0x17beef['query']['hasOwnProperty'](_0xeb62('0x7f'))){_0xfff29b[_0xeb62('0x26')]=qs['limit'](_0x17beef[_0xeb62('0x39')]['limit']);_0xfff29b[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x17beef[_0xeb62('0x39')]['offset']);}return _0x29648f['getAgents'](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x276e06){if(_0x276e06){return _0x276e06?{'count':_0x2f5f2f,'rows':_0x276e06}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x45b2a3,null))['catch'](handleError(_0x45b2a3,null));};exports[_0xeb62('0x80')]=function(_0x162993,_0x3f5c93,_0x3b15ec){var _0xca3f0e={};var _0x2e4d99={};var _0x518655;var _0x4cd599;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x162993['params']['id']}})['then'](handleEntityNotFound(_0x3f5c93,null))[_0xeb62('0x2e')](function(_0x49d2c7){if(_0x49d2c7){_0x518655=_0x49d2c7;_0x2e4d99['model']=_['keys'](db[_0xeb62('0x81')]['rawAttributes']);_0x2e4d99[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x162993[_0xeb62('0x39')]);_0x2e4d99[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x2e4d99[_0xeb62('0x3f')],_0x2e4d99[_0xeb62('0x39')]);_0xca3f0e['attributes']=_['intersection'](_0x2e4d99[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x162993[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xca3f0e[_0xeb62('0x3c')]=_0xca3f0e['attributes'][_0xeb62('0x3e')]?_0xca3f0e[_0xeb62('0x3c')]:_0x2e4d99[_0xeb62('0x3f')];_0xca3f0e['order']=qs[_0xeb62('0x42')](_0x162993['query'][_0xeb62('0x42')]);_0xca3f0e[_0xeb62('0x43')]=qs['filters'](_['pick'](_0x162993[_0xeb62('0x39')],_0x2e4d99[_0xeb62('0x3a')]));if(_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]){_0xca3f0e['where']=_[_0xeb62('0x46')](_0xca3f0e[_0xeb62('0x43')],{'$or':_['map'](_0xca3f0e['attributes'],function(_0x12adf6){var _0x1b9569={};_0x1b9569[_0x12adf6]={'$like':'%'+_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]+'%'};return _0x1b9569;})});}_0xca3f0e=_[_0xeb62('0x46')]({},_0xca3f0e,_0x162993[_0xeb62('0x47')]);return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})[_0xeb62('0x2e')](function(_0x144bc8){if(_0x144bc8){_0x4cd599=_0x144bc8[_0xeb62('0x3e')];if(!_0x162993[_0xeb62('0x39')][_0xeb62('0x40')](_0xeb62('0x7f'))){_0xca3f0e[_0xeb62('0x26')]=qs[_0xeb62('0x26')](_0x162993[_0xeb62('0x39')]['limit']);_0xca3f0e[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x162993[_0xeb62('0x39')][_0xeb62('0x24')]);}return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})['then'](function(_0x54984f){if(_0x54984f){return _0x54984f?{'count':_0x4cd599,'rows':_0x54984f}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x3f5c93,null))[_0xeb62('0x4c')](handleError(_0x3f5c93,null));};exports[_0xeb62('0x82')]=function(_0x3d957d,_0x5af4d7,_0x3a0b12){var _0x5f2c1e=_0x3d957d[_0xeb62('0x53')][_0xeb62('0x76')];var _0x3409db;return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x5f2c1e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb62('0x83'),'attributes':['id',_0xeb62('0x31'),'online',_0xeb62('0x84'),'interface'],'raw':!![]}]})[_0xeb62('0x2e')](function(_0x43107d){if(_0x43107d){_0x3409db=_0x43107d;var _0x2e503b=_[_0xeb62('0x85')](_0x43107d,function(_0x45a197){var _0x3394e6=_0x45a197['get']({'plain':!![]});return _0x3394e6['Agents'];});return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x3d957d[_0xeb62('0x4d')]['id']}})[_0xeb62('0x2e')](function(_0x582217){return db['sequelize'][_0xeb62('0x73')](function(_0x527de3){return _0x582217[_0xeb62('0x82')](_0x5f2c1e,{'transaction':_0x527de3})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x3409db,function(_0x5e43f0){return db[_0xeb62('0x87')][_0xeb62('0x88')]({'TeamId':_0x5e43f0['id'],'VoicePrefixId':_0x3d957d[_0xeb62('0x4d')]['id']},{'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x2e503b,function(_0x10731b){return db[_0xeb62('0x89')][_0xeb62('0x8a')]({'where':{'UserId':_0x10731b['id'],'VoicePrefixId':_0x3d957d['params']['id']},'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){_0x2e503b[_0xeb62('0x8b')](function(_0x35d372){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':_0x35d372['id'],'VoicePrefixId':_0x582217['id']});});});});});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x5af4d7,null))[_0xeb62('0x4c')](handleError(_0x5af4d7,null));};exports[_0xeb62('0x8c')]=function(_0x146c7e,_0x24c285,_0x59bb00){return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')]},'attributes':['id'],'include':[{'model':db[_0xeb62('0x8d')],'as':_0xeb62('0x83'),'attributes':['id'],'raw':!![]}]})[_0xeb62('0x2e')](handleEntityNotFound(_0x24c285,null))[_0xeb62('0x2e')](function(_0x30625f){var _0x94d0c9=_['map'](_0x30625f,'id');var _0x3ae667=[];var _0x3338ba=[];var _0x50cf9b=squel['select']();_0x50cf9b[_0xeb62('0x8e')](_0xeb62('0x8f'))[_0xeb62('0x90')](_0xeb62('0x91'),'tq')[_0xeb62('0x92')](_0xeb62('0x93'),'ut',_0xeb62('0x94'))[_0xeb62('0x43')](_0xeb62('0x95'),_0x146c7e['params']['id']);for(var _0x535e7a=0x0;_0x535e7a<_0x30625f[_0xeb62('0x3e')];_0x535e7a+=0x1){let _0x43daef=_0x30625f[_0x535e7a];for(var _0x58ffb2=0x0;_0x58ffb2<_0x43daef['Agents'][_0xeb62('0x3e')];_0x58ffb2+=0x1){let _0x341bd8=_0x43daef[_0xeb62('0x83')][_0x58ffb2];var _0x55ef9d=_0x50cf9b['clone']();_0x55ef9d[_0xeb62('0x43')]('ut.UserId\x20=\x20?',_0x341bd8['id']);_0x3338ba[_0xeb62('0x6a')](db[_0xeb62('0x52')][_0xeb62('0x39')](_0x55ef9d['toString'](),{'type':db['sequelize']['QueryTypes'][_0xeb62('0x96')]})[_0xeb62('0x2e')](function(_0x3517db){if(_0x3517db[_0xeb62('0x3e')]===0x1){return _0x341bd8['id'];}else{var _0x5bd3b6=_[_0xeb62('0x97')](_[_0xeb62('0x34')](_0x3517db,_0xeb62('0x98')),function(_0x22eb23){return _[_0xeb62('0x99')](_0x94d0c9,_0x22eb23);});if(_0x5bd3b6){return _0x341bd8['id'];}}}));}}return BPromise[_0xeb62('0x9a')](_0x3338ba)[_0xeb62('0x2e')](function(_0x394573){_0x3ae667=_(_0x3ae667)['union'](_0x394573)[_0xeb62('0x9b')]()[_0xeb62('0x9c')]();return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146c7e['params']['id']}})[_0xeb62('0x2e')](function(_0x1f84f0){return db['sequelize'][_0xeb62('0x73')](function(_0x26b456){return _0x1f84f0[_0xeb62('0x8c')](_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')],{'transaction':_0x26b456})[_0xeb62('0x2e')](function(){if(!_[_0xeb62('0x9d')](_0x3ae667)){return _0x1f84f0['removeAgents'](_0x3ae667,{'transaction':_0x26b456});}})[_0xeb62('0x2e')](function(){_0x3ae667['forEach'](function(_0x3578a9){socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':_0x3578a9,'VoicePrefixId':_0x1f84f0['id']});});});});});});})['then'](respondWithStatusCode(_0x24c285,null))['catch'](handleError(_0x24c285,null));};
\ No newline at end of file
index ba6efd4..0311fcd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b54=['../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit','hook','events'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x5b54,0xd7));var _0x45b5=function(_0x28b8be,_0x4d310c){_0x28b8be=_0x28b8be-0x0;var _0x3f7601=_0x5b54[_0x28b8be];return _0x3f7601;};'use strict';var EventEmitter=require(_0x45b5('0x0'));var VoicePrefix=require(_0x45b5('0x1'))['db'][_0x45b5('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x45b5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x45b5('0x4'),'afterDestroy':_0x45b5('0x5')};function emitEvent(_0x1afd57){return function(_0x33b59e,_0x1ce370,_0x29332a){VoicePrefixEvents[_0x45b5('0x6')](_0x1afd57+':'+_0x33b59e['id'],_0x33b59e);VoicePrefixEvents[_0x45b5('0x6')](_0x1afd57,_0x33b59e);_0x29332a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x45b5('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents;
\ No newline at end of file
+var _0x6234=['exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x57d73b,_0x15ac08){var _0x3c296b=function(_0x38e561){while(--_0x38e561){_0x57d73b['push'](_0x57d73b['shift']());}};_0x3c296b(++_0x15ac08);}(_0x6234,0x10f));var _0x4623=function(_0x16067d,_0x2a78c2){_0x16067d=_0x16067d-0x0;var _0x291483=_0x6234[_0x16067d];return _0x291483;};'use strict';var EventEmitter=require(_0x4623('0x0'));var VoicePrefix=require(_0x4623('0x1'))['db'][_0x4623('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4623('0x3')](0x0);var events={'afterCreate':_0x4623('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41e83e){return function(_0x5c4115,_0x178afb,_0x587e8b){VoicePrefixEvents[_0x4623('0x5')](_0x41e83e+':'+_0x5c4115['id'],_0x5c4115);VoicePrefixEvents['emit'](_0x41e83e,_0x5c4115);_0x587e8b(null);};}for(var e in events){if(events[_0x4623('0x6')](e)){var event=events[e];VoicePrefix[_0x4623('0x7')](e,emitEvent(event));}}module[_0x4623('0x8')]=VoicePrefixEvents;
\ No newline at end of file
index d82bccd..0587fbb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe214=['lodash','util','../../config/logger','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0xe214,0xaa));var _0x4e21=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe214[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x4e21('0x0'));var util=require(_0x4e21('0x1'));var logger=require(_0x4e21('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e21('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e21('0x4'));var attributes=require(_0x4e21('0x5'));module[_0x4e21('0x6')]=function(_0x1a920b,_0x50d87b){return _0x1a920b[_0x4e21('0x7')](_0x4e21('0x8'),attributes,{'tableName':_0x4e21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2119=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','voice_prefixes'];(function(_0x5e4ce1,_0x226ce9){var _0x4ef150=function(_0x4c7f7d){while(--_0x4c7f7d){_0x5e4ce1['push'](_0x5e4ce1['shift']());}};_0x4ef150(++_0x226ce9);}(_0x2119,0xa8));var _0x9211=function(_0x139cf3,_0x135e44){_0x139cf3=_0x139cf3-0x0;var _0x4322a7=_0x2119[_0x139cf3];return _0x4322a7;};'use strict';var _=require(_0x9211('0x0'));var util=require(_0x9211('0x1'));var logger=require(_0x9211('0x2'))(_0x9211('0x3'));var moment=require(_0x9211('0x4'));var BPromise=require('bluebird');var rp=require(_0x9211('0x5'));var fs=require('fs');var path=require(_0x9211('0x6'));var rimraf=require(_0x9211('0x7'));var config=require(_0x9211('0x8'));var attributes=require(_0x9211('0x9'));module[_0x9211('0xa')]=function(_0x537ceb,_0x3ee36c){return _0x537ceb['define']('VoicePrefix',attributes,{'tableName':_0x9211('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index fed84fc..2f7cfeb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6a2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xc6a2,0x69));var _0x2c6a=function(_0x18eb68,_0x3d7d45){_0x18eb68=_0x18eb68-0x0;var _0x46599e=_0xc6a2[_0x18eb68];return _0x46599e;};'use strict';var _=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var moment=require('moment');var BPromise=require(_0x2c6a('0x2'));var rs=require(_0x2c6a('0x3'));var fs=require('fs');var Redis=require(_0x2c6a('0x4'));var db=require(_0x2c6a('0x5'))['db'];var utils=require(_0x2c6a('0x6'));var logger=require(_0x2c6a('0x7'))(_0x2c6a('0x8'));var config=require(_0x2c6a('0x9'));var jayson=require(_0x2c6a('0xa'));var client=jayson[_0x2c6a('0xb')][_0x2c6a('0xc')]({'port':0x232a});config[_0x2c6a('0xd')]=_[_0x2c6a('0xe')](config[_0x2c6a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c6a('0xf'))(new Redis(config[_0x2c6a('0xd')]));require(_0x2c6a('0x10'))[_0x2c6a('0x11')](socket);function respondWithRpcPromise(_0x261e90,_0x28b169,_0x25d67f){return new BPromise(function(_0x2a7040,_0x4aa0a3){return client['request'](_0x261e90,_0x25d67f)[_0x2c6a('0x12')](function(_0x46531e){logger[_0x2c6a('0x13')](_0x2c6a('0x14'),_0x28b169,'request\x20sent');logger['debug'](_0x2c6a('0x15'),_0x28b169,_0x2c6a('0x16'),JSON[_0x2c6a('0x17')](_0x46531e));if(_0x46531e['error']){if(_0x46531e['error']['code']===0x1f4){logger[_0x2c6a('0x18')](_0x2c6a('0x14'),_0x28b169,_0x46531e[_0x2c6a('0x18')][_0x2c6a('0x19')]);return _0x4aa0a3(_0x46531e[_0x2c6a('0x18')][_0x2c6a('0x19')]);}logger[_0x2c6a('0x18')](_0x2c6a('0x14'),_0x28b169,_0x46531e[_0x2c6a('0x18')]['message']);return _0x2a7040(_0x46531e[_0x2c6a('0x18')][_0x2c6a('0x19')]);}else{logger['info'](_0x2c6a('0x14'),_0x28b169,'request\x20sent');_0x2a7040(_0x46531e['result'][_0x2c6a('0x19')]);}})[_0x2c6a('0x1a')](function(_0x15fa74){logger[_0x2c6a('0x18')](_0x2c6a('0x14'),_0x28b169,_0x15fa74);_0x4aa0a3(_0x15fa74);});});}
\ No newline at end of file
+var _0x46cb=['../../config/environment','jayson/promise','client','redis','localhost','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d1309,_0x295fb5){var _0x51881b=function(_0x1783ef){while(--_0x1783ef){_0x1d1309['push'](_0x1d1309['shift']());}};_0x51881b(++_0x295fb5);}(_0x46cb,0x84));var _0xb46c=function(_0x315861,_0x735b4){_0x315861=_0x315861-0x0;var _0x3e2b76=_0x46cb[_0x315861];return _0x3e2b76;};'use strict';var _=require(_0xb46c('0x0'));var util=require(_0xb46c('0x1'));var moment=require(_0xb46c('0x2'));var BPromise=require(_0xb46c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb46c('0x4'));var db=require(_0xb46c('0x5'))['db'];var utils=require(_0xb46c('0x6'));var logger=require(_0xb46c('0x7'))('rpc');var config=require(_0xb46c('0x8'));var jayson=require(_0xb46c('0x9'));var client=jayson[_0xb46c('0xa')]['http']({'port':0x232a});config[_0xb46c('0xb')]=_['defaults'](config[_0xb46c('0xb')],{'host':_0xb46c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb46c('0xd'))[_0xb46c('0xe')](socket);function respondWithRpcPromise(_0x79bc47,_0x4715eb,_0x41da61){return new BPromise(function(_0x645386,_0x567d9e){return client[_0xb46c('0xf')](_0x79bc47,_0x41da61)[_0xb46c('0x10')](function(_0x3ff3ee){logger[_0xb46c('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x4715eb,_0xb46c('0x12'));logger[_0xb46c('0x13')](_0xb46c('0x14'),_0x4715eb,'request\x20sent',JSON[_0xb46c('0x15')](_0x3ff3ee));if(_0x3ff3ee[_0xb46c('0x16')]){if(_0x3ff3ee['error'][_0xb46c('0x17')]===0x1f4){logger[_0xb46c('0x16')](_0xb46c('0x18'),_0x4715eb,_0x3ff3ee[_0xb46c('0x16')][_0xb46c('0x19')]);return _0x567d9e(_0x3ff3ee[_0xb46c('0x16')][_0xb46c('0x19')]);}logger['error'](_0xb46c('0x18'),_0x4715eb,_0x3ff3ee[_0xb46c('0x16')][_0xb46c('0x19')]);return _0x645386(_0x3ff3ee[_0xb46c('0x16')][_0xb46c('0x19')]);}else{logger[_0xb46c('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x4715eb,'request\x20sent');_0x645386(_0x3ff3ee[_0xb46c('0x1a')]['message']);}})[_0xb46c('0x1b')](function(_0x2d0eac){logger[_0xb46c('0x16')](_0xb46c('0x18'),_0x4715eb,_0x2d0eac);_0x567d9e(_0x2d0eac);});});}
\ No newline at end of file
index 3eb7606..f3da33c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2be0=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x6d5377,_0x1f10af){var _0x4e305e=function(_0x53c40b){while(--_0x53c40b){_0x6d5377['push'](_0x6d5377['shift']());}};_0x4e305e(++_0x1f10af);}(_0x2be0,0x128));var _0x02be=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2be0[_0x42245d];return _0x4b211a;};'use strict';var VoicePrefixEvents=require(_0x02be('0x0'));var events=[_0x02be('0x1'),_0x02be('0x2'),_0x02be('0x3')];function createListener(_0x2aa17c,_0x51708c){return function(_0x12d55f){_0x51708c[_0x02be('0x4')](_0x2aa17c,_0x12d55f);};}function removeListener(_0xb18781,_0x5e05a0){return function(){VoicePrefixEvents[_0x02be('0x5')](_0xb18781,_0x5e05a0);};}exports[_0x02be('0x6')]=function(_0x46392d){for(var _0x184bf6=0x0,_0x522686=events[_0x02be('0x7')];_0x184bf6<_0x522686;_0x184bf6++){var _0x3eaa8a=events[_0x184bf6];var _0x22686f=createListener(_0x02be('0x8')+_0x3eaa8a,_0x46392d);VoicePrefixEvents['on'](_0x3eaa8a,_0x22686f);}};
\ No newline at end of file
+var _0xc560=['./voicePrefix.events','remove','emit','removeListener','length'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xc560,0x82));var _0x0c56=function(_0x142961,_0x4407b6){_0x142961=_0x142961-0x0;var _0x3080fe=_0xc560[_0x142961];return _0x3080fe;};'use strict';var VoicePrefixEvents=require(_0x0c56('0x0'));var events=['save',_0x0c56('0x1'),'update'];function createListener(_0x2c4115,_0x5b4dfe){return function(_0x5c33dd){_0x5b4dfe[_0x0c56('0x2')](_0x2c4115,_0x5c33dd);};}function removeListener(_0x39dbc7,_0x37c584){return function(){VoicePrefixEvents[_0x0c56('0x3')](_0x39dbc7,_0x37c584);};}exports['register']=function(_0x2b5654){for(var _0x2bc0a0=0x0,_0x35b4ee=events[_0x0c56('0x4')];_0x2bc0a0<_0x35b4ee;_0x2bc0a0++){var _0x501a0b=events[_0x2bc0a0];var _0x429ad1=createListener('voicePrefix:'+_0x501a0b,_0x2b5654);VoicePrefixEvents['on'](_0x501a0b,_0x429ad1);}};
\ No newline at end of file
index 6ccb36f..0f248f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3e3221,_0x392851){var _0x190da4=function(_0x13d601){while(--_0x13d601){_0x3e3221['push'](_0x3e3221['shift']());}};_0x190da4(++_0x392851);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0xb10b[_0x5eff86];return _0x4b3010;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router;
\ No newline at end of file
+var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xb10b,0x12a));var _0xbb10=function(_0x16af01,_0x9c623c){_0x16af01=_0x16af01-0x0;var _0x4d4b9a=_0xb10b[_0x16af01];return _0x4d4b9a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router;
\ No newline at end of file
index 2cfd451..8fab4a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4879=['all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','type','dialMethod','getDataValue','strategy','preview','booked','roundrobin','INTEGER','yes'];(function(_0x28bbdb,_0x55936f){var _0x3c1636=function(_0x179daa){while(--_0x179daa){_0x28bbdb['push'](_0x28bbdb['shift']());}};_0x3c1636(++_0x55936f);}(_0x4879,0x132));var _0x9487=function(_0x1c9f77,_0x1ee32c){_0x1c9f77=_0x1c9f77-0x0;var _0x726168=_0x4879[_0x1c9f77];return _0x726168;};'use strict';var Sequelize=require(_0x9487('0x0'));module[_0x9487('0x1')]={'name':{'type':Sequelize[_0x9487('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9487('0x3')]('inbound',_0x9487('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x9487('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x9487('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x9487('0x5'),_0x9487('0x6'),_0x9487('0x7'),_0x9487('0x8'),_0x9487('0x9'),'linear',_0x9487('0xa'),_0x9487('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x52f69f){this[_0x9487('0xc')]('strategy',_0x52f69f?_0x52f69f:_0x9487('0x9'));},'get':function(){var _0x342214=this['getDataValue'](_0x9487('0xd'));var _0x544163=this['getDataValue'](_0x9487('0xe'));var _0x1f5d47=this[_0x9487('0xf')](_0x9487('0x10'));if(_0x342214==='outbound'){if(_0x544163===_0x9487('0x11')){return null;}if(_0x544163===_0x9487('0x12')&&!['rrmemory',_0x9487('0x13')]['includes'](_0x1f5d47)){this[_0x9487('0xc')](_0x9487('0x10'),_0x9487('0x9'));}}return _0x1f5d47;}},'servicelevel':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9487('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9487('0x14')](0xb)},'timeout':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9487('0x2')]},'weight':{'type':Sequelize[_0x9487('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9487('0x3')]('yes','no'),'defaultValue':_0x9487('0x15')},'autopause':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no',_0x9487('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9487('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9487('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x9487('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9487('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9487('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9487('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9487('0x3')]('yes','no'),'defaultValue':_0x9487('0x15')},'announce_holdtime':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no',_0x9487('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9487('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x9487('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9487('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9487('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9487('0x2')]},'queue_youarenext':{'type':Sequelize[_0x9487('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9487('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9487('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9487('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9487('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x9487('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x9487('0x2')]},'queue_less_than':{'type':Sequelize[_0x9487('0x2')]},'periodic_announce':{'type':Sequelize[_0x9487('0x18')],'set':function(_0x22f267){this[_0x9487('0xc')]('periodic_announce',_0x22f267?_0x22f267[_0x9487('0x19')](','):[]);},'get':function(){return this[_0x9487('0xf')]('periodic_announce')?this['getDataValue'](_0x9487('0x1a'))[_0x9487('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x3a434f){this[_0x9487('0xc')](_0x9487('0x1c'),_0x3a434f?_0x3a434f[_0x9487('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x9487('0x1c'))?this[_0x9487('0xf')](_0x9487('0x1c'))[_0x9487('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9487('0x2')],'defaultValue':'no','set':function(_0x27cd5e){this[_0x9487('0xc')](_0x9487('0x1d'),_0x27cd5e?_0x27cd5e[_0x9487('0x19')](','):undefined);},'get':function(){return this[_0x9487('0xf')]('leavewhenempty')?this[_0x9487('0xf')](_0x9487('0x1d'))[_0x9487('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9487('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9487('0x2')]},'acw':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':0x0,'set':function(_0x2d9a15){this[_0x9487('0xc')](_0x9487('0x1f'),_0x2d9a15);if(_0x2d9a15){if(this[_0x9487('0xf')](_0x9487('0x20'))<0x2){this[_0x9487('0xc')](_0x9487('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9487('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':0x0,'comment':_0x9487('0x21')},'dialMethod':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x11'),'progressive',_0x9487('0x22'),'predictive','booked'),'defaultValue':_0x9487('0x23'),'comment':_0x9487('0x24')},'dialLimitChannel':{'type':Sequelize[_0x9487('0x14')](0x4)[_0x9487('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x9487('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9487('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x9487('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x9487('0x27'),'comment':_0x9487('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9487('0x29')](0x2)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9487('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9487('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9487('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x9487('0x2')],'defaultValue':_0x9487('0x2d'),'comment':_0x9487('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x2f')},'dialQueueProject':{'type':Sequelize[_0x9487('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9487('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9487('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9487('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9487('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9487('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9487('0x2')],'defaultValue':_0x9487('0x37')},'dialPrefix':{'type':Sequelize[_0x9487('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9487('0x3')]('always',_0x9487('0x38'),_0x9487('0x39')),'defaultValue':_0x9487('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9487('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9487('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9487('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9487('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9487('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9487('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x9487('0x14')](0x9)[_0x9487('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9487('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9487('0x14')](0x9)[_0x9487('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9487('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9487('0x14')](0x9)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9487('0x14')](0x5)[_0x9487('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9487('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x9487('0x14')](0x5)[_0x9487('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9487('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':0x0,'comment':_0x9487('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9487('0x3')](_0x9487('0x43'),_0x9487('0x44')),'defaultValue':_0x9487('0x43')},'dialQueueProject2':{'type':Sequelize[_0x9487('0x2')],'comment':_0x9487('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9487('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x9487('0x14')](0x5)[_0x9487('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9487('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9487('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9487('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9487('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9487('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9487('0x14')],'allowNull':!![],'comment':_0x9487('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x277f53){if(!_0x277f53)this['setDataValue'](_0x9487('0x50'),null);this[_0x9487('0xc')](_0x9487('0x51'),_0x277f53);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9487('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9487('0x14')](0x3)[_0x9487('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9487('0x1e')],'defaultValue':![]}};
\ No newline at end of file
+var _0xc4bf=['BOOLEAN','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','inbound','outbound','ENUM','ringall','leastrecent','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','all','once','TEXT','periodic_announce','join','getDataValue','split','joinempty','leavewhenempty','acw','wrapuptime'];(function(_0x10af36,_0x153be3){var _0x426c39=function(_0x16dee7){while(--_0x16dee7){_0x10af36['push'](_0x10af36['shift']());}};_0x426c39(++_0x153be3);}(_0xc4bf,0xde));var _0xfc4b=function(_0x5d44d7,_0x1dcff5){_0x5d44d7=_0x5d44d7-0x0;var _0x4ac265=_0xc4bf[_0x5d44d7];return _0x4ac265;};'use strict';var Sequelize=require(_0xfc4b('0x0'));module[_0xfc4b('0x1')]={'name':{'type':Sequelize[_0xfc4b('0x2')],'allowNull':![],'unique':_0xfc4b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xfc4b('0x4'),_0xfc4b('0x5')),'allowNull':![],'defaultValue':_0xfc4b('0x4')},'musiconhold':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xfc4b('0x6')]('rr',_0xfc4b('0x7'),_0xfc4b('0x8'),'fewestcalls','random',_0xfc4b('0x9'),_0xfc4b('0xa'),_0xfc4b('0xb'),_0xfc4b('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x32ce34){this[_0xfc4b('0xd')](_0xfc4b('0xe'),_0x32ce34?_0x32ce34:_0xfc4b('0x9'));},'get':function(){var _0x23bdf1=this['getDataValue'](_0xfc4b('0xf'));var _0x5009d5=this['getDataValue'](_0xfc4b('0x10'));var _0x47d569=this['getDataValue'](_0xfc4b('0xe'));if(_0x23bdf1===_0xfc4b('0x5')){if(_0x5009d5===_0xfc4b('0x11')){return null;}if(_0x5009d5===_0xfc4b('0x12')&&![_0xfc4b('0x9'),_0xfc4b('0x13')]['includes'](_0x47d569)){this[_0xfc4b('0xd')](_0xfc4b('0xe'),'rrmemory');}}return _0x47d569;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfc4b('0x14')](0xb)},'timeout':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfc4b('0x2')]},'weight':{'type':Sequelize[_0xfc4b('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xfc4b('0x6')]('yes','no'),'defaultValue':_0xfc4b('0x15')},'autopause':{'type':Sequelize[_0xfc4b('0x6')]('yes','no',_0xfc4b('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfc4b('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xfc4b('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfc4b('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no',_0xfc4b('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xfc4b('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xfc4b('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfc4b('0x2')]},'queue_youarenext':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfc4b('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfc4b('0x2')]},'queue_quantity1':{'type':Sequelize[_0xfc4b('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xfc4b('0x2')]},'queue_less_than':{'type':Sequelize[_0xfc4b('0x2')]},'periodic_announce':{'type':Sequelize[_0xfc4b('0x18')],'set':function(_0x37b597){this[_0xfc4b('0xd')](_0xfc4b('0x19'),_0x37b597?_0x37b597[_0xfc4b('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xfc4b('0x19'))?this[_0xfc4b('0x1b')]('periodic_announce')[_0xfc4b('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':_0xfc4b('0x15'),'set':function(_0x5ad7dd){this['setDataValue']('joinempty',_0x5ad7dd?_0x5ad7dd['join'](','):undefined);},'get':function(){return this[_0xfc4b('0x1b')](_0xfc4b('0x1d'))?this[_0xfc4b('0x1b')](_0xfc4b('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':'no','set':function(_0xef1f19){this[_0xfc4b('0xd')](_0xfc4b('0x1e'),_0xef1f19?_0xef1f19['join'](','):undefined);},'get':function(){return this[_0xfc4b('0x1b')](_0xfc4b('0x1e'))?this[_0xfc4b('0x1b')](_0xfc4b('0x1e'))[_0xfc4b('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfc4b('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xfc4b('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfc4b('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5a7fa3){this[_0xfc4b('0xd')](_0xfc4b('0x1f'),_0x5a7fa3);if(_0x5a7fa3){if(this['getDataValue'](_0xfc4b('0x20'))<0x2){this[_0xfc4b('0xd')](_0xfc4b('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':0x0,'comment':_0xfc4b('0x22')},'dialMethod':{'type':Sequelize[_0xfc4b('0x6')](_0xfc4b('0x11'),'progressive','power',_0xfc4b('0x23'),'booked'),'defaultValue':_0xfc4b('0x24'),'comment':_0xfc4b('0x25')},'dialLimitChannel':{'type':Sequelize[_0xfc4b('0x14')](0x4)[_0xfc4b('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfc4b('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xfc4b('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfc4b('0x28')},'dialPowerLevel':{'type':Sequelize[_0xfc4b('0x29')](0x2)[_0xfc4b('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfc4b('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xfc4b('0x2b'),_0xfc4b('0x2c')),'defaultValue':_0xfc4b('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfc4b('0x29')](0x2)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfc4b('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfc4b('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfc4b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfc4b('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xfc4b('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':_0xfc4b('0x30'),'comment':_0xfc4b('0x31')},'dialQueueTimeout':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x32')},'dialQueueProject':{'type':Sequelize[_0xfc4b('0x2')],'comment':_0xfc4b('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfc4b('0x14')](0x5)[_0xfc4b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc4b('0x35')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfc4b('0x14')](0x5)[_0xfc4b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'comment':_0xfc4b('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfc4b('0x14')](0x5)[_0xfc4b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc4b('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfc4b('0x39')},'dialTimezone':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':_0xfc4b('0x3a')},'dialPrefix':{'type':Sequelize[_0xfc4b('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xfc4b('0x3b'),_0xfc4b('0x3c'),_0xfc4b('0x3d')),'defaultValue':_0xfc4b('0x3b')},'dialAMDActive':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':0x0,'comment':_0xfc4b('0x3e')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfc4b('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfc4b('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0xfc4b('0x14')](0x9)[_0xfc4b('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfc4b('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfc4b('0x14')](0x9)[_0xfc4b('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfc4b('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xfc4b('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfc4b('0x42')},'dialAMDMinWordLength':{'type':Sequelize[_0xfc4b('0x14')](0x9)[_0xfc4b('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfc4b('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfc4b('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfc4b('0x44')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfc4b('0x14')](0x9)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfc4b('0x45')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfc4b('0x14')](0x5)[_0xfc4b('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfc4b('0x46')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfc4b('0x14')](0x9)[_0xfc4b('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfc4b('0x47')},'dialRecallMeTimeout':{'type':Sequelize[_0xfc4b('0x14')](0x5)[_0xfc4b('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfc4b('0x48')},'dialRecallInQueue':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':0x0,'comment':_0xfc4b('0x49')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfc4b('0x6')]('DESC','ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfc4b('0x2')],'comment':_0xfc4b('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfc4b('0x4a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xfc4b('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfc4b('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfc4b('0x14')](0x5)[_0xfc4b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc4b('0x4c')},'dialDropMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x4d')},'dialDropRetryFrequency':{'type':Sequelize[_0xfc4b('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc4b('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x50')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfc4b('0x51')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfc4b('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfc4b('0x52')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfc4b('0x14')],'allowNull':!![],'comment':_0xfc4b('0x53')},'mandatoryDisposition':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':![],'comment':_0xfc4b('0x54'),'set':function(_0x19af61){if(!_0x19af61)this[_0xfc4b('0xd')]('mandatoryDispositionPauseId',null);this[_0xfc4b('0xd')]('mandatoryDisposition',_0x19af61);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfc4b('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfc4b('0x14')](0x3)[_0xfc4b('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xfc4b('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfc4b('0x21')],'defaultValue':![]}};
\ No newline at end of file
index aa3e784..3409e20 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc43c=['CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','error','stack','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','userVoiceQueue:save','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','TeamId','union','compact','removeTeams','isEmpty','removeAgents','emit','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','scheduledAt','cm_contacts','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','fromQuery','cm_hopper_additional_phones'];(function(_0x157b4a,_0xfb274c){var _0x3d8901=function(_0x5d14ab){while(--_0x5d14ab){_0x157b4a['push'](_0x157b4a['shift']());}};_0x3d8901(++_0xfb274c);}(_0xc43c,0xd4));var _0xcc43=function(_0xfd2d5f,_0x51feea){_0xfd2d5f=_0xfd2d5f-0x0;var _0x51dabe=_0xc43c[_0xfd2d5f];return _0x51dabe;};'use strict';var emlformat=require(_0xcc43('0x0'));var rimraf=require(_0xcc43('0x1'));var zipdir=require(_0xcc43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcc43('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcc43('0x4'));var csv=require(_0xcc43('0x5'));var ejs=require(_0xcc43('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc43('0x7'));var squel=require(_0xcc43('0x8'));var crypto=require(_0xcc43('0x9'));var jsforce=require(_0xcc43('0xa'));var deskjs=require(_0xcc43('0xb'));var toCsv=require(_0xcc43('0x5'));var querystring=require(_0xcc43('0xc'));var Papa=require(_0xcc43('0xd'));var Redis=require('ioredis');var authService=require(_0xcc43('0xe'));var qs=require(_0xcc43('0xf'));var as=require(_0xcc43('0x10'));var hardwareService=require(_0xcc43('0x11'));var logger=require(_0xcc43('0x12'))(_0xcc43('0x13'));var utils=require(_0xcc43('0x14'));var config=require(_0xcc43('0x15'));var licenseUtil=require(_0xcc43('0x16'));var db=require(_0xcc43('0x17'))['db'];config[_0xcc43('0x18')]=_['defaults'](config[_0xcc43('0x18')],{'host':_0xcc43('0x19'),'port':0x18eb});var socket=require(_0xcc43('0x1a'))(new Redis(config[_0xcc43('0x18')]));require('./voiceQueue.socket')[_0xcc43('0x1b')](socket);function respondWithStatusCode(_0x446095,_0x12fec8){_0x12fec8=_0x12fec8||0xcc;return function(_0x97c8ec){if(_0x97c8ec){return _0x446095[_0xcc43('0x1c')](_0x12fec8);}return _0x446095['status'](_0x12fec8)[_0xcc43('0x1d')]();};}function respondWithResult(_0x3a1933,_0x519321){_0x519321=_0x519321||0xc8;return function(_0x3fb33c){if(_0x3fb33c){return _0x3a1933['status'](_0x519321)[_0xcc43('0x1e')](_0x3fb33c);}};}function respondWithFilteredResult(_0x43ed95,_0xfbff32){return function(_0x50348a){if(_0x50348a){var _0x44628c=typeof _0xfbff32[_0xcc43('0x1f')]===_0xcc43('0x20')&&typeof _0xfbff32[_0xcc43('0x21')]==='undefined';var _0x2d526e=_0x50348a[_0xcc43('0x22')];var _0x57bd2d=_0x44628c?0x0:_0xfbff32[_0xcc43('0x1f')];var _0x58d7fb=_0x44628c?_0x50348a[_0xcc43('0x22')]:_0xfbff32['offset']+_0xfbff32[_0xcc43('0x21')];var _0x2a604e;if(_0x58d7fb>=_0x2d526e){_0x58d7fb=_0x2d526e;_0x2a604e=0xc8;}else{_0x2a604e=0xce;}_0x43ed95[_0xcc43('0x23')](_0x2a604e);return _0x43ed95['set'](_0xcc43('0x24'),_0x57bd2d+'-'+_0x58d7fb+'/'+_0x2d526e)['json'](_0x50348a);}return null;};}function patchUpdates(_0x1a578f){return function(_0x3c94e8){try{jsonpatch[_0xcc43('0x25')](_0x3c94e8,_0x1a578f,!![]);}catch(_0x948783){return BPromise[_0xcc43('0x26')](_0x948783);}return _0x3c94e8['save']();};}function saveUpdates(_0x2ba3d0,_0x164551){return function(_0x5caa7a){if(_0x5caa7a){return _0x5caa7a[_0xcc43('0x27')](_0x2ba3d0)[_0xcc43('0x28')](function(_0x7838d0){return _0x7838d0;});}return null;};}function removeEntity(_0x55fd66,_0x35d2a1){return function(_0x480662){if(_0x480662){return _0x480662[_0xcc43('0x29')]()[_0xcc43('0x28')](function(){var _0x399d3a=_0x480662[_0xcc43('0x2a')]({'plain':!![]});var _0x1f25fe=[{'name':'VoiceQueues','value':_0xcc43('0x2b'),'ignore':![]},{'name':_0xcc43('0x2c'),'value':_0xcc43('0x2d'),'ignore':![]}];var _0x200f72=_(_0x1f25fe)[_0xcc43('0x2e')](_0xcc43('0x2f'))['map'](_0xcc43('0x30'))[_0xcc43('0x30')]();if(_[_0xcc43('0x31')](_0x200f72,_0x399d3a[_0xcc43('0x32')])){return;}var _0x532526=_[_0xcc43('0x33')](_0x1f25fe,[_0xcc43('0x30'),_0x399d3a[_0xcc43('0x32')]])[_0xcc43('0x34')];return db['UserProfileResource'][_0xcc43('0x29')]({'where':{'type':_0x532526,'resourceId':_0x399d3a['id']}})[_0xcc43('0x28')](function(){return _0x480662;});})[_0xcc43('0x28')](function(){_0x55fd66[_0xcc43('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e68dc,_0x234b98){return function(_0x1b2b0f){if(!_0x1b2b0f){_0x4e68dc[_0xcc43('0x1c')](0x194);}return _0x1b2b0f;};}function handleError(_0x799a9d,_0x1ea5e9){_0x1ea5e9=_0x1ea5e9||0x1f4;return function(_0x1b8e47){logger[_0xcc43('0x35')](_0x1b8e47[_0xcc43('0x36')]);if(_0x1b8e47['name']){delete _0x1b8e47[_0xcc43('0x34')];}_0x799a9d['status'](_0x1ea5e9)['send'](_0x1b8e47);};}exports[_0xcc43('0x37')]=function(_0x125d24,_0xc4f761){var _0x1c9f99={},_0x257c58={},_0x5a79d1={'count':0x0,'rows':[]};var _0x52e8e9=_['map'](db['VoiceQueue'][_0xcc43('0x38')],function(_0x2144e3){return{'name':_0x2144e3[_0xcc43('0x39')],'type':_0x2144e3['type'][_0xcc43('0x3a')]};});_0x257c58[_0xcc43('0x3b')]=_[_0xcc43('0x3c')](_0x52e8e9,'name');_0x257c58[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x125d24['query']);_0x257c58[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0x257c58[_0xcc43('0x3b')],_0x257c58[_0xcc43('0x3d')]);_0x1c9f99[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x257c58[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x125d24[_0xcc43('0x3d')][_0xcc43('0x42')]));_0x1c9f99[_0xcc43('0x41')]=_0x1c9f99[_0xcc43('0x41')][_0xcc43('0x43')]?_0x1c9f99[_0xcc43('0x41')]:_0x257c58['model'];if(!_0x125d24[_0xcc43('0x3d')][_0xcc43('0x44')]('nolimit')){_0x1c9f99[_0xcc43('0x21')]=qs['limit'](_0x125d24[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x1c9f99[_0xcc43('0x1f')]=qs[_0xcc43('0x1f')](_0x125d24[_0xcc43('0x3d')][_0xcc43('0x1f')]);}_0x1c9f99[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x125d24['query']['sort']);_0x1c9f99['where']=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x125d24[_0xcc43('0x3d')],_0x257c58[_0xcc43('0x3f')]),_0x52e8e9);if(_0x125d24['query'][_0xcc43('0x2e')]){_0x1c9f99[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0x1c9f99['where'],{'$or':_['map'](_0x52e8e9,function(_0xfb9c30){if(_0xfb9c30[_0xcc43('0x32')]!==_0xcc43('0x4a')){var _0x255d2d={};_0x255d2d[_0xfb9c30['name']]={'$like':'%'+_0x125d24[_0xcc43('0x3d')]['filter']+'%'};return _0x255d2d;}})});}_0x1c9f99=_['merge']({},_0x1c9f99,_0x125d24[_0xcc43('0x4b')]);var _0x77db19={'where':_0x1c9f99[_0xcc43('0x48')]};return db[_0xcc43('0x4c')]['count'](_0x77db19)['then'](function(_0x11ba03){_0x5a79d1[_0xcc43('0x22')]=_0x11ba03;if(_0x125d24[_0xcc43('0x3d')][_0xcc43('0x4d')]){_0x1c9f99[_0xcc43('0x4e')]=[{'all':!![]}];}return db[_0xcc43('0x4c')][_0xcc43('0x4f')](_0x1c9f99);})[_0xcc43('0x28')](function(_0x2f78d9){_0x5a79d1[_0xcc43('0x50')]=_0x2f78d9;return _0x5a79d1;})[_0xcc43('0x28')](respondWithFilteredResult(_0xc4f761,_0x1c9f99))[_0xcc43('0x51')](handleError(_0xc4f761,null));};exports[_0xcc43('0x52')]=function(_0x46c167,_0x318ca7){var _0x949ae9={'raw':![],'where':{'id':_0x46c167[_0xcc43('0x53')]['id']}},_0x15b6a5={};_0x15b6a5['model']=_[_0xcc43('0x3e')](db['VoiceQueue'][_0xcc43('0x38')]);_0x15b6a5[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x46c167[_0xcc43('0x3d')]);_0x15b6a5['filters']=_[_0xcc43('0x40')](_0x15b6a5[_0xcc43('0x3b')],_0x15b6a5['query']);_0x949ae9[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x15b6a5[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x46c167[_0xcc43('0x3d')][_0xcc43('0x42')]));_0x949ae9[_0xcc43('0x41')]=_0x949ae9[_0xcc43('0x41')][_0xcc43('0x43')]?_0x949ae9[_0xcc43('0x41')]:_0x15b6a5[_0xcc43('0x3b')];if(_0x46c167['query'][_0xcc43('0x4d')]){_0x949ae9[_0xcc43('0x4e')]=[{'all':!![]}];}_0x949ae9=_['merge']({},_0x949ae9,_0x46c167[_0xcc43('0x4b')]);return db[_0xcc43('0x4c')][_0xcc43('0x33')](_0x949ae9)[_0xcc43('0x28')](handleEntityNotFound(_0x318ca7,null))[_0xcc43('0x28')](respondWithResult(_0x318ca7,null))['catch'](handleError(_0x318ca7,null));};exports[_0xcc43('0x54')]=function(_0x216208,_0x4334dd){return db[_0xcc43('0x4c')][_0xcc43('0x54')](_0x216208[_0xcc43('0x55')],{})[_0xcc43('0x28')](function(_0x426fe2){var _0x3b93e5=_0x216208[_0xcc43('0x56')][_0xcc43('0x2a')]({'plain':!![]});if(!_0x3b93e5)throw new Error(_0xcc43('0x57'));if(_0x3b93e5[_0xcc43('0x58')]==='user'){var _0x395c76=_0x426fe2['get']({'plain':!![]});var _0xc1e590=[{'name':_0xcc43('0x59'),'value':_0xcc43('0x2b')},{'name':_0xcc43('0x2c'),'value':_0xcc43('0x2d')}];var _0x57f6bc=_[_0xcc43('0x33')](_0xc1e590,['value',_0x395c76[_0xcc43('0x32')]])[_0xcc43('0x34')];return db[_0xcc43('0x5a')][_0xcc43('0x33')]({'where':{'name':_0x57f6bc,'userProfileId':_0x3b93e5[_0xcc43('0x5b')]},'raw':!![]})[_0xcc43('0x28')](function(_0x87253f){if(_0x87253f&&_0x87253f[_0xcc43('0x5c')]===0x0){return db[_0xcc43('0x5d')][_0xcc43('0x54')]({'name':_0x395c76[_0xcc43('0x34')],'resourceId':_0x395c76['id'],'type':_0x87253f[_0xcc43('0x34')],'sectionId':_0x87253f['id']},{})[_0xcc43('0x28')](function(){return _0x426fe2;});}else{return _0x426fe2;}})[_0xcc43('0x51')](function(_0x8a15d){logger[_0xcc43('0x35')](_0xcc43('0x5e'),_0x8a15d);throw _0x8a15d;});}return _0x426fe2;})['then'](respondWithResult(_0x4334dd,0xc9))[_0xcc43('0x51')](handleError(_0x4334dd,null));};exports[_0xcc43('0x5f')]=function(_0x10a5f1,_0x1a3f09){var _0xfa62ad={'where':{'id':_0x10a5f1[_0xcc43('0x53')]['id']}},_0x44fc66={};_0x44fc66[_0xcc43('0x3b')]=_[_0xcc43('0x3e')](db['VoiceQueue'][_0xcc43('0x38')]);_0xfa62ad['attributes']=_['intersection'](_0x44fc66[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x10a5f1[_0xcc43('0x3d')][_0xcc43('0x42')]));_0xfa62ad[_0xcc43('0x41')]=_0xfa62ad['attributes'][_0xcc43('0x43')]?_0xfa62ad[_0xcc43('0x41')]:_0x44fc66[_0xcc43('0x3b')];if(_0x10a5f1[_0xcc43('0x3d')][_0xcc43('0x4d')]){_0xfa62ad[_0xcc43('0x4e')]=[{'all':!![]}];}_0xfa62ad=_[_0xcc43('0x49')]({},_0xfa62ad,_0x10a5f1['options']);return db[_0xcc43('0x4c')][_0xcc43('0x33')](_0xfa62ad)[_0xcc43('0x28')](handleEntityNotFound(_0x1a3f09,null))['then'](function(_0x274896){if(_0x274896){var _0x3b55b9=_0x274896[_0xcc43('0x2a')]({'plain':!![]});_0x3b55b9=qs[_0xcc43('0x60')](_0x3b55b9,['id',_0xcc43('0x61'),_0xcc43('0x62')]);_0x10a5f1['body']=_['omit'](_0x10a5f1[_0xcc43('0x55')],['id',_0xcc43('0x61'),_0xcc43('0x62')]);return db[_0xcc43('0x4c')]['create'](_[_0xcc43('0x49')](_0x3b55b9,_0x10a5f1[_0xcc43('0x55')]),{'include':_0x10a5f1['query'][_0xcc43('0x4d')]?[{'all':!![]}]:undefined})[_0xcc43('0x28')](function(_0x44bb3d){var _0x4b4cd1=_0x10a5f1[_0xcc43('0x56')][_0xcc43('0x2a')]({'plain':!![]});if(!_0x4b4cd1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b4cd1[_0xcc43('0x58')]===_0xcc43('0x56')){var _0x2a54c0=_0x44bb3d[_0xcc43('0x2a')]({'plain':!![]});var _0x204d6b=[{'name':_0xcc43('0x59'),'value':_0xcc43('0x2b')},{'name':_0xcc43('0x2c'),'value':_0xcc43('0x2d')}];var _0x2c584f=_[_0xcc43('0x33')](_0x204d6b,[_0xcc43('0x30'),_0x2a54c0[_0xcc43('0x32')]])[_0xcc43('0x34')];return db[_0xcc43('0x5a')][_0xcc43('0x33')]({'where':{'name':_0x2c584f,'userProfileId':_0x4b4cd1[_0xcc43('0x5b')]},'raw':!![]})[_0xcc43('0x28')](function(_0x5058a7){if(_0x5058a7&&_0x5058a7[_0xcc43('0x5c')]===0x0){return db[_0xcc43('0x5d')][_0xcc43('0x54')]({'name':_0x2a54c0[_0xcc43('0x34')],'resourceId':_0x2a54c0['id'],'type':_0x5058a7[_0xcc43('0x34')],'sectionId':_0x5058a7['id']},{})[_0xcc43('0x28')](function(){return _0x44bb3d;});}else{return _0x44bb3d;}})[_0xcc43('0x51')](function(_0x30b807){logger[_0xcc43('0x35')](_0xcc43('0x5e'),_0x30b807);throw _0x30b807;});}return _0x44bb3d;});}})[_0xcc43('0x28')](respondWithResult(_0x1a3f09,0xc9))[_0xcc43('0x51')](handleError(_0x1a3f09,null));};exports['update']=function(_0x5cc52e,_0x2ebb74){if(_0x5cc52e[_0xcc43('0x55')]['id']){delete _0x5cc52e[_0xcc43('0x55')]['id'];}return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x5cc52e['params']['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x2ebb74,null))[_0xcc43('0x28')](saveUpdates(_0x5cc52e[_0xcc43('0x55')],null))['then'](respondWithResult(_0x2ebb74,null))[_0xcc43('0x51')](handleError(_0x2ebb74,null));};exports[_0xcc43('0x29')]=function(_0xb827aa,_0x1df26d){return db[_0xcc43('0x4c')]['find']({'where':{'id':_0xb827aa[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x1df26d,null))[_0xcc43('0x28')](removeEntity(_0x1df26d,null))[_0xcc43('0x51')](handleError(_0x1df26d,null));};exports[_0xcc43('0x63')]=function(_0x4bc0ef,_0x503a8e,_0x1f7db3){var _0x4336cb={'raw':![],'where':{}};var _0x5c1d48={};var _0x4d7b56={'count':0x0,'rows':[]};return db[_0xcc43('0x4c')][_0xcc43('0x64')]({'where':{'id':_0x4bc0ef[_0xcc43('0x53')]['id']}})['then'](handleEntityNotFound(_0x503a8e,null))[_0xcc43('0x28')](function(_0x57510f){if(_0x57510f){_0x5c1d48[_0xcc43('0x3b')]=_[_0xcc43('0x3e')](db[_0xcc43('0x65')][_0xcc43('0x38')]);_0x5c1d48[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x4bc0ef[_0xcc43('0x3d')]);_0x5c1d48['filters']=_['intersection'](_0x5c1d48[_0xcc43('0x3b')],_0x5c1d48[_0xcc43('0x3d')]);_0x4336cb[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x5c1d48[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x42')]));_0x4336cb['attributes']=_0x4336cb[_0xcc43('0x41')][_0xcc43('0x43')]?_0x4336cb[_0xcc43('0x41')]:_0x5c1d48[_0xcc43('0x3b')];if(!_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x44')](_0xcc43('0x66'))){_0x4336cb['limit']=qs[_0xcc43('0x21')](_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x4336cb[_0xcc43('0x1f')]=qs[_0xcc43('0x1f')](_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x1f')]);}_0x4336cb[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x46')]);_0x4336cb[_0xcc43('0x48')]=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x4bc0ef[_0xcc43('0x3d')],_0x5c1d48[_0xcc43('0x3f')]));_0x4336cb[_0xcc43('0x48')][_0xcc43('0x67')]=_0x57510f['id'];if(_0x4bc0ef['query']['filter']){_0x4336cb[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0x4336cb[_0xcc43('0x48')],{'$or':_['map'](_0x4336cb['attributes'],function(_0xaa6dc1){var _0x2dae8d={};_0x2dae8d[_0xaa6dc1]={'$like':'%'+_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x2e')]+'%'};return _0x2dae8d;})});}_0x4336cb=_['merge']({},_0x4336cb,_0x4bc0ef[_0xcc43('0x4b')]);return db['CmHopper']['count']({'where':_0x4336cb['where']})[_0xcc43('0x28')](function(_0x21156c){_0x4d7b56[_0xcc43('0x22')]=_0x21156c;if(_0x4bc0ef[_0xcc43('0x3d')][_0xcc43('0x4d')]){_0x4336cb[_0xcc43('0x4e')]=[{'all':!![]}];}return db[_0xcc43('0x65')][_0xcc43('0x4f')](_0x4336cb);})[_0xcc43('0x28')](function(_0x23b24d){_0x4d7b56[_0xcc43('0x50')]=_0x23b24d;return _0x4d7b56;});}})['then'](respondWithFilteredResult(_0x503a8e,_0x4336cb))['catch'](handleError(_0x503a8e,null));};exports[_0xcc43('0x68')]=function(_0x49c1fb,_0xb9a885,_0x3b776d){var _0x55df07={'raw':!![],'where':{}};var _0x588c8c={};var _0x1b4a9e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xcc43('0x64')]({'where':{'id':_0x49c1fb[_0xcc43('0x53')]['id']}})['then'](handleEntityNotFound(_0xb9a885,null))[_0xcc43('0x28')](function(_0x2f9cab){if(_0x2f9cab){_0x588c8c['model']=_[_0xcc43('0x3e')](db['CmHopperHistory']['rawAttributes']);_0x588c8c[_0xcc43('0x3d')]=_['keys'](_0x49c1fb[_0xcc43('0x3d')]);_0x588c8c[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0x588c8c[_0xcc43('0x3b')],_0x588c8c[_0xcc43('0x3d')]);_0x55df07[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x588c8c[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x49c1fb[_0xcc43('0x3d')][_0xcc43('0x42')]));_0x55df07[_0xcc43('0x41')]=_0x55df07[_0xcc43('0x41')]['length']?_0x55df07[_0xcc43('0x41')]:_0x588c8c[_0xcc43('0x3b')];if(!_0x49c1fb['query'][_0xcc43('0x44')](_0xcc43('0x66'))){_0x55df07[_0xcc43('0x21')]=qs[_0xcc43('0x21')](_0x49c1fb['query'][_0xcc43('0x21')]);_0x55df07[_0xcc43('0x1f')]=qs['offset'](_0x49c1fb[_0xcc43('0x3d')][_0xcc43('0x1f')]);}_0x55df07[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x49c1fb['query'][_0xcc43('0x46')]);_0x55df07['where']=qs['filters'](_[_0xcc43('0x47')](_0x49c1fb[_0xcc43('0x3d')],_0x588c8c[_0xcc43('0x3f')]));_0x55df07[_0xcc43('0x48')][_0xcc43('0x67')]=_0x2f9cab['id'];if(_0x49c1fb[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x55df07['where']=_[_0xcc43('0x49')](_0x55df07['where'],{'$or':_[_0xcc43('0x3c')](_0x55df07[_0xcc43('0x41')],function(_0x3eda5a){var _0x26cd31={};_0x26cd31[_0x3eda5a]={'$like':'%'+_0x49c1fb[_0xcc43('0x3d')][_0xcc43('0x2e')]+'%'};return _0x26cd31;})});}_0x55df07=_[_0xcc43('0x49')]({},_0x55df07,_0x49c1fb[_0xcc43('0x4b')]);return db['CmHopperHistory'][_0xcc43('0x22')]({'where':_0x55df07[_0xcc43('0x48')]})[_0xcc43('0x28')](function(_0x54b4b5){_0x1b4a9e[_0xcc43('0x22')]=_0x54b4b5;if(_0x49c1fb[_0xcc43('0x3d')][_0xcc43('0x4d')]){_0x55df07[_0xcc43('0x4e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xcc43('0x4f')](_0x55df07);})[_0xcc43('0x28')](function(_0x1c1500){_0x1b4a9e[_0xcc43('0x50')]=_0x1c1500;return _0x1b4a9e;});}})['then'](respondWithFilteredResult(_0xb9a885,_0x55df07))[_0xcc43('0x51')](handleError(_0xb9a885,null));};exports[_0xcc43('0x69')]=function(_0x237889,_0x474a80,_0x1bd453){var _0xff6053={'raw':!![],'where':{}};var _0x3a8f62={};var _0xa750c3={'count':0x0,'rows':[]};return db[_0xcc43('0x4c')]['findOne']({'where':{'id':_0x237889['params']['id']}})['then'](handleEntityNotFound(_0x474a80,null))['then'](function(_0x289524){if(_0x289524){_0x3a8f62['model']=_['keys'](db['CmHopperFinal'][_0xcc43('0x38')]);_0x3a8f62[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x237889[_0xcc43('0x3d')]);_0x3a8f62[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0x3a8f62[_0xcc43('0x3b')],_0x3a8f62[_0xcc43('0x3d')]);_0xff6053[_0xcc43('0x41')]=_['intersection'](_0x3a8f62[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x237889[_0xcc43('0x3d')]['fields']));_0xff6053[_0xcc43('0x41')]=_0xff6053[_0xcc43('0x41')][_0xcc43('0x43')]?_0xff6053[_0xcc43('0x41')]:_0x3a8f62[_0xcc43('0x3b')];if(!_0x237889[_0xcc43('0x3d')]['hasOwnProperty']('nolimit')){_0xff6053[_0xcc43('0x21')]=qs[_0xcc43('0x21')](_0x237889[_0xcc43('0x3d')][_0xcc43('0x21')]);_0xff6053[_0xcc43('0x1f')]=qs[_0xcc43('0x1f')](_0x237889[_0xcc43('0x3d')][_0xcc43('0x1f')]);}_0xff6053[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x237889[_0xcc43('0x3d')]['sort']);_0xff6053[_0xcc43('0x48')]=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x237889['query'],_0x3a8f62['filters']));_0xff6053[_0xcc43('0x48')][_0xcc43('0x67')]=_0x289524['id'];if(_0x237889[_0xcc43('0x3d')]['filter']){_0xff6053[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0xff6053[_0xcc43('0x48')],{'$or':_[_0xcc43('0x3c')](_0xff6053['attributes'],function(_0x4e50ef){var _0xd4fe35={};_0xd4fe35[_0x4e50ef]={'$like':'%'+_0x237889[_0xcc43('0x3d')]['filter']+'%'};return _0xd4fe35;})});}_0xff6053=_[_0xcc43('0x49')]({},_0xff6053,_0x237889[_0xcc43('0x4b')]);return db[_0xcc43('0x6a')]['count']({'where':_0xff6053[_0xcc43('0x48')]})[_0xcc43('0x28')](function(_0x111eda){_0xa750c3['count']=_0x111eda;if(_0x237889['query'][_0xcc43('0x4d')]){_0xff6053['include']=[{'all':!![]}];}return db[_0xcc43('0x6a')][_0xcc43('0x4f')](_0xff6053);})['then'](function(_0x46b7c1){_0xa750c3[_0xcc43('0x50')]=_0x46b7c1;return _0xa750c3;});}})[_0xcc43('0x28')](respondWithFilteredResult(_0x474a80,_0xff6053))[_0xcc43('0x51')](handleError(_0x474a80,null));};exports[_0xcc43('0x6b')]=function(_0x563561,_0x3a3ac9,_0x6beb0f){var _0x5754d1={'raw':!![],'where':{}};var _0x45b3b6={};var _0x35466a={'count':0x0,'rows':[]};return db[_0xcc43('0x4c')][_0xcc43('0x64')]({'where':{'id':_0x563561['params']['id']}})['then'](handleEntityNotFound(_0x3a3ac9,null))['then'](function(_0x9c7291){if(_0x9c7291){_0x45b3b6[_0xcc43('0x3b')]=_['keys'](db[_0xcc43('0x6c')]['rawAttributes']);_0x45b3b6[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x563561[_0xcc43('0x3d')]);_0x45b3b6['filters']=_[_0xcc43('0x40')](_0x45b3b6[_0xcc43('0x3b')],_0x45b3b6[_0xcc43('0x3d')]);_0x5754d1[_0xcc43('0x41')]=_['intersection'](_0x45b3b6['model'],qs[_0xcc43('0x42')](_0x563561['query'][_0xcc43('0x42')]));_0x5754d1[_0xcc43('0x41')]=_0x5754d1[_0xcc43('0x41')][_0xcc43('0x43')]?_0x5754d1[_0xcc43('0x41')]:_0x45b3b6['model'];if(!_0x563561['query']['hasOwnProperty'](_0xcc43('0x66'))){_0x5754d1['limit']=qs[_0xcc43('0x21')](_0x563561[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x5754d1[_0xcc43('0x1f')]=qs['offset'](_0x563561['query'][_0xcc43('0x1f')]);}_0x5754d1[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x563561[_0xcc43('0x3d')][_0xcc43('0x46')]);_0x5754d1[_0xcc43('0x48')]=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x563561['query'],_0x45b3b6['filters']));_0x5754d1[_0xcc43('0x48')][_0xcc43('0x67')]=_0x9c7291['id'];if(_0x563561[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x5754d1[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0x5754d1[_0xcc43('0x48')],{'$or':_[_0xcc43('0x3c')](_0x5754d1[_0xcc43('0x41')],function(_0x34ef96){var _0x1010a1={};_0x1010a1[_0x34ef96]={'$like':'%'+_0x563561[_0xcc43('0x3d')]['filter']+'%'};return _0x1010a1;})});}_0x5754d1=_[_0xcc43('0x49')]({},_0x5754d1,_0x563561[_0xcc43('0x4b')]);return db[_0xcc43('0x6c')][_0xcc43('0x22')]({'where':_0x5754d1[_0xcc43('0x48')]})['then'](function(_0x3054e5){_0x35466a[_0xcc43('0x22')]=_0x3054e5;if(_0x563561['query']['includeAll']){_0x5754d1[_0xcc43('0x4e')]=[{'all':!![]}];}return db[_0xcc43('0x6c')][_0xcc43('0x4f')](_0x5754d1);})[_0xcc43('0x28')](function(_0x311283){_0x35466a[_0xcc43('0x50')]=_0x311283;return _0x35466a;});}})['then'](respondWithFilteredResult(_0x3a3ac9,_0x5754d1))[_0xcc43('0x51')](handleError(_0x3a3ac9,null));};exports['getTeams']=function(_0x1a91d4,_0x5757b6,_0x16cdbb){var _0x243076={};var _0x21b95c={};var _0x274026;var _0x26ffa2;return db['VoiceQueue']['findOne']({'where':{'id':_0x1a91d4[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x5757b6,null))[_0xcc43('0x28')](function(_0x1604f9){if(_0x1604f9){_0x274026=_0x1604f9;_0x21b95c[_0xcc43('0x3b')]=_[_0xcc43('0x3e')](db[_0xcc43('0x6d')][_0xcc43('0x38')]);_0x21b95c[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x1a91d4[_0xcc43('0x3d')]);_0x21b95c[_0xcc43('0x3f')]=_['intersection'](_0x21b95c['model'],_0x21b95c[_0xcc43('0x3d')]);_0x243076[_0xcc43('0x41')]=_['intersection'](_0x21b95c[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x1a91d4[_0xcc43('0x3d')][_0xcc43('0x42')]));_0x243076[_0xcc43('0x41')]=_0x243076[_0xcc43('0x41')][_0xcc43('0x43')]?_0x243076[_0xcc43('0x41')]:_0x21b95c[_0xcc43('0x3b')];_0x243076['order']=qs['sort'](_0x1a91d4[_0xcc43('0x3d')][_0xcc43('0x46')]);_0x243076[_0xcc43('0x48')]=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x1a91d4['query'],_0x21b95c['filters']));if(_0x1a91d4[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x243076[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0x243076['where'],{'$or':_[_0xcc43('0x3c')](_0x243076['attributes'],function(_0x3895f4){var _0x243b4f={};_0x243b4f[_0x3895f4]={'$like':'%'+_0x1a91d4['query'][_0xcc43('0x2e')]+'%'};return _0x243b4f;})});}_0x243076=_[_0xcc43('0x49')]({},_0x243076,_0x1a91d4[_0xcc43('0x4b')]);return _0x274026[_0xcc43('0x6e')](_0x243076);}})[_0xcc43('0x28')](function(_0x26fa7f){if(_0x26fa7f){_0x26ffa2=_0x26fa7f[_0xcc43('0x43')];if(!_0x1a91d4[_0xcc43('0x3d')][_0xcc43('0x44')](_0xcc43('0x66'))){_0x243076[_0xcc43('0x21')]=qs[_0xcc43('0x21')](_0x1a91d4[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x243076[_0xcc43('0x1f')]=qs[_0xcc43('0x1f')](_0x1a91d4[_0xcc43('0x3d')]['offset']);}return _0x274026[_0xcc43('0x6e')](_0x243076);}})[_0xcc43('0x28')](function(_0x190f3a){if(_0x190f3a){return _0x190f3a?{'count':_0x26ffa2,'rows':_0x190f3a}:null;}})[_0xcc43('0x28')](respondWithResult(_0x5757b6,null))[_0xcc43('0x51')](handleError(_0x5757b6,null));};exports[_0xcc43('0x6f')]=function(_0x49b802,_0x42f59d,_0x832063){var _0x24bac3=_0x49b802[_0xcc43('0x55')][_0xcc43('0x70')];var _0x25e5b8=_[_0xcc43('0x3c')](_0x24bac3,'id');return db['Team'][_0xcc43('0x4f')]({'where':{'id':_0x25e5b8},'attributes':['id'],'include':[{'model':db[_0xcc43('0x71')],'as':'Agents','attributes':['id',_0xcc43('0x34'),_0xcc43('0x72'),'voicePause',_0xcc43('0x73')],'raw':!![]}]})[_0xcc43('0x28')](function(_0x431989){if(_0x431989){var _0x421a57=_[_0xcc43('0x74')](_0x431989,function(_0x2b767e){var _0x39bbf0=_0x2b767e[_0xcc43('0x2a')]({'plain':!![]});_0x39bbf0[_0xcc43('0x75')][_0xcc43('0x76')](function(_0xab4020){_0xab4020[_0xcc43('0x77')]=_['find'](_0x24bac3,{'id':_0x39bbf0['id']})[_0xcc43('0x77')];});return _0x39bbf0[_0xcc43('0x75')];});return db[_0xcc43('0x4c')]['find']({'where':{'id':_0x49b802[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](function(_0xe55ab9){return db[_0xcc43('0x78')][_0xcc43('0x79')](function(_0x3722b3){return _0xe55ab9[_0xcc43('0x6f')](_0x25e5b8,{'transaction':_0x3722b3})[_0xcc43('0x28')](function(){return BPromise[_0xcc43('0x7a')](_0x24bac3,function(_0x40880d){return db[_0xcc43('0x7b')][_0xcc43('0x7c')]({'TeamId':_0x40880d['id'],'VoiceQueueId':_0x49b802[_0xcc43('0x53')]['id'],'penalty':_0x40880d[_0xcc43('0x77')]},{'transaction':_0x3722b3});});})['then'](function(){return BPromise[_0xcc43('0x7a')](_0x421a57,function(_0x3ef8e3){return db[_0xcc43('0x7d')][_0xcc43('0x7e')]({'where':{'UserId':_0x3ef8e3['id'],'VoiceQueueId':_0x49b802[_0xcc43('0x53')]['id']},'defaults':{'penalty':_0x3ef8e3[_0xcc43('0x77')]},'transaction':_0x3722b3});});})['then'](function(){return BPromise[_0xcc43('0x7a')](_[_0xcc43('0x2e')](_0x421a57,{'online':!![]}),function(_0x2784dd){return db[_0xcc43('0x7f')][_0xcc43('0x7c')]({'membername':_0x2784dd[_0xcc43('0x34')],'UserId':_0x2784dd['id'],'queue_name':_0xe55ab9[_0xcc43('0x34')],'VoiceQueueId':_0xe55ab9['id'],'interface':_[_0xcc43('0x80')](_0x2784dd[_0xcc43('0x73')])?util[_0xcc43('0x81')](_0xcc43('0x82'),_0x2784dd[_0xcc43('0x34')]):_0x2784dd[_0xcc43('0x73')],'paused':_0x2784dd[_0xcc43('0x83')]||![],'penalty':_0x2784dd[_0xcc43('0x77')]},{'transaction':_0x3722b3});});})[_0xcc43('0x28')](function(){_0x421a57[_0xcc43('0x76')](function(_0x4093a8){socket['emit'](_0xcc43('0x84'),{'UserId':_0x4093a8['id'],'VoiceQueueId':_0xe55ab9['id']});});});});});}})[_0xcc43('0x28')](respondWithStatusCode(_0x42f59d,null))[_0xcc43('0x51')](handleError(_0x42f59d,null));};exports['removeTeams']=function(_0x564a7a,_0x1977b7,_0x32d718){return db[_0xcc43('0x6d')][_0xcc43('0x4f')]({'where':{'id':_0x564a7a[_0xcc43('0x3d')][_0xcc43('0x85')]},'attributes':['id'],'include':[{'model':db[_0xcc43('0x71')],'as':_0xcc43('0x75'),'attributes':['id'],'raw':!![]}]})[_0xcc43('0x28')](handleEntityNotFound(_0x1977b7,null))['then'](function(_0x26b208){var _0x1a422c=_[_0xcc43('0x3c')](_0x26b208,'id');var _0x3a3e1e=[];var _0x27f810=[];var _0x51db2e=squel['select']();_0x51db2e[_0xcc43('0x86')](_0xcc43('0x87'))[_0xcc43('0x88')]('team_has_voice_queues','tq')[_0xcc43('0x89')](_0xcc43('0x8a'),'ut',_0xcc43('0x8b'))['where']('VoiceQueueId\x20=\x20?',_0x564a7a['params']['id']);for(var _0x27e0a0=0x0;_0x27e0a0<_0x26b208[_0xcc43('0x43')];_0x27e0a0+=0x1){let _0x54dd83=_0x26b208[_0x27e0a0];for(var _0x95fcc8=0x0;_0x95fcc8<_0x54dd83[_0xcc43('0x75')][_0xcc43('0x43')];_0x95fcc8+=0x1){let _0x5272e1=_0x54dd83[_0xcc43('0x75')][_0x95fcc8];var _0x2dc13d=_0x51db2e['clone']();_0x2dc13d[_0xcc43('0x48')]('ut.UserId\x20=\x20?',_0x5272e1['id']);_0x27f810[_0xcc43('0x8c')](db[_0xcc43('0x78')][_0xcc43('0x3d')](_0x2dc13d[_0xcc43('0x8d')](),{'type':db[_0xcc43('0x78')][_0xcc43('0x8e')]['SELECT']})[_0xcc43('0x28')](function(_0x22cc53){if(_0x22cc53[_0xcc43('0x43')]===0x1){return _0x5272e1['id'];}else{var _0x17c5d2=_['every'](_['map'](_0x22cc53,_0xcc43('0x8f')),function(_0x159d32){return _[_0xcc43('0x31')](_0x1a422c,_0x159d32);});if(_0x17c5d2){return _0x5272e1['id'];}}}));}}return BPromise['all'](_0x27f810)['then'](function(_0xaeb436){_0x3a3e1e=_(_0x3a3e1e)[_0xcc43('0x90')](_0xaeb436)[_0xcc43('0x91')]()[_0xcc43('0x30')]();return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x564a7a[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](function(_0x44115b){return db[_0xcc43('0x78')]['transaction'](function(_0x26ba7e){return _0x44115b[_0xcc43('0x92')](_0x564a7a[_0xcc43('0x3d')]['ids'],{'transaction':_0x26ba7e})[_0xcc43('0x28')](function(){if(!_[_0xcc43('0x93')](_0x3a3e1e)){return _0x44115b[_0xcc43('0x94')](_0x3a3e1e,{'transaction':_0x26ba7e})[_0xcc43('0x28')](function(){return db[_0xcc43('0x7f')][_0xcc43('0x29')]({'where':{'VoiceQueueId':_0x564a7a[_0xcc43('0x53')]['id'],'UserId':_0x3a3e1e},'transaction':_0x26ba7e});});}})[_0xcc43('0x28')](function(){_0x3a3e1e['forEach'](function(_0x46b84d){socket[_0xcc43('0x95')]('userVoiceQueue:remove',{'UserId':_0x46b84d,'VoiceQueueId':_0x44115b['id']});});});});});});})[_0xcc43('0x28')](respondWithStatusCode(_0x1977b7,null))[_0xcc43('0x51')](handleError(_0x1977b7,null));};exports[_0xcc43('0x96')]=function(_0x35aad7,_0x5067c9,_0xd10646){var _0x1a8005,_0x95c876;return db['VoiceQueue'][_0xcc43('0x33')]({'where':{'id':_0x35aad7[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x5067c9,null))[_0xcc43('0x28')](function(_0xf562b0){if(_0xf562b0){_0x95c876=_0xf562b0;return _0xf562b0[_0xcc43('0x96')](_0x35aad7['body'][_0xcc43('0x85')],_[_0xcc43('0x60')](_0x35aad7['body'],['ids','id'])||{})[_0xcc43('0x97')](function(_0x15a59d){for(var _0x472d13=0x0;_0x472d13<_0x35aad7[_0xcc43('0x55')]['ids']['length'];_0x472d13+=0x1){socket[_0xcc43('0x95')](_0xcc43('0x84'),{'UserId':Number(_0x35aad7['body']['ids'][_0x472d13]),'VoiceQueueId':Number(_0x35aad7[_0xcc43('0x53')]['id'])});}return _0x15a59d;});}})['then'](function(_0x3e3768){_0x1a8005=_0x3e3768||[];if(_0x95c876){return db[_0xcc43('0x71')][_0xcc43('0x4f')]({'where':{'id':_0x35aad7['body']['ids']},'attributes':['id',_0xcc43('0x34'),_0xcc43('0x72'),_0xcc43('0x83'),_0xcc43('0x73')],'raw':!![]});}})[_0xcc43('0x28')](function(_0x5cfb88){if(!_[_0xcc43('0x93')](_0x5cfb88)){var _0x493836=[];for(var _0x3f5617=0x0;_0x3f5617<_0x5cfb88[_0xcc43('0x43')];_0x3f5617++){if(_0x5cfb88[_0x3f5617][_0xcc43('0x72')]){_0x493836[_0xcc43('0x8c')](db[_0xcc43('0x7f')]['upsert']({'membername':_0x5cfb88[_0x3f5617][_0xcc43('0x34')],'UserId':_0x5cfb88[_0x3f5617]['id'],'queue_name':_0x95c876[_0xcc43('0x34')],'VoiceQueueId':_0x95c876['id'],'interface':_[_0xcc43('0x80')](_0x5cfb88[_0x3f5617][_0xcc43('0x73')])?util[_0xcc43('0x81')](_0xcc43('0x82'),_0x5cfb88[_0x3f5617][_0xcc43('0x34')]):_0x5cfb88[_0x3f5617][_0xcc43('0x73')],'paused':_0x5cfb88[_0x3f5617][_0xcc43('0x83')]||![],'penalty':_0x35aad7[_0xcc43('0x55')]['penalty']||0x0}));}}return BPromise[_0xcc43('0x98')](_0x493836);}})[_0xcc43('0x28')](function(){return _0x1a8005;})[_0xcc43('0x28')](respondWithResult(_0x5067c9,null))[_0xcc43('0x51')](handleError(_0x5067c9,null));};exports[_0xcc43('0x94')]=function(_0x535464,_0x3051bf,_0x5c359f){return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x535464['params']['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x3051bf,null))[_0xcc43('0x28')](function(_0x23f524){if(_0x23f524){return _0x23f524[_0xcc43('0x94')](_0x535464[_0xcc43('0x3d')][_0xcc43('0x85')])[_0xcc43('0x28')](function(){if(_[_0xcc43('0x99')](_0x535464[_0xcc43('0x3d')][_0xcc43('0x85')])){for(var _0x196d51=0x0;_0x196d51<_0x535464[_0xcc43('0x3d')][_0xcc43('0x85')][_0xcc43('0x43')];_0x196d51+=0x1){socket[_0xcc43('0x95')]('userVoiceQueue:remove',{'UserId':Number(_0x535464[_0xcc43('0x3d')][_0xcc43('0x85')][_0x196d51]),'VoiceQueueId':Number(_0x535464['params']['id'])});}}else{socket[_0xcc43('0x95')](_0xcc43('0x9a'),{'UserId':Number(_0x535464[_0xcc43('0x3d')][_0xcc43('0x85')]),'VoiceQueueId':Number(_0x535464[_0xcc43('0x53')]['id'])});}});}})[_0xcc43('0x28')](function(_0x51dc40){return db[_0xcc43('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x535464[_0xcc43('0x53')]['id'],'UserId':_0x535464[_0xcc43('0x3d')]['ids']}})[_0xcc43('0x28')](function(){return _0x51dc40;});})[_0xcc43('0x28')](respondWithStatusCode(_0x3051bf,null))[_0xcc43('0x51')](handleError(_0x3051bf,null));};exports[_0xcc43('0x9b')]=function(_0x31ac5c,_0x13b446,_0xfc8618){var _0x5136ab={};var _0x11f629={};var _0x11b6ef;var _0x407db4;return db[_0xcc43('0x4c')][_0xcc43('0x64')]({'where':{'id':_0x31ac5c[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x13b446,null))[_0xcc43('0x28')](function(_0x4abe40){if(_0x4abe40){_0x11b6ef=_0x4abe40;_0x11f629[_0xcc43('0x3b')]=_[_0xcc43('0x3e')](db[_0xcc43('0x71')][_0xcc43('0x38')]);_0x11f629[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x31ac5c[_0xcc43('0x3d')]);_0x11f629[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0x11f629[_0xcc43('0x3b')],_0x11f629[_0xcc43('0x3d')]);_0x5136ab[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x11f629['model'],qs[_0xcc43('0x42')](_0x31ac5c['query'][_0xcc43('0x42')]));_0x5136ab['attributes']=_0x5136ab[_0xcc43('0x41')][_0xcc43('0x43')]?_0x5136ab['attributes']:_0x11f629[_0xcc43('0x3b')];_0x5136ab['order']=qs['sort'](_0x31ac5c[_0xcc43('0x3d')][_0xcc43('0x46')]);_0x5136ab[_0xcc43('0x48')]=qs['filters'](_[_0xcc43('0x47')](_0x31ac5c['query'],_0x11f629[_0xcc43('0x3f')]));if(_0x31ac5c[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x5136ab[_0xcc43('0x48')]=_['merge'](_0x5136ab[_0xcc43('0x48')],{'$or':_['map'](_0x5136ab[_0xcc43('0x41')],function(_0x5607c4){var _0x7e8693={};_0x7e8693[_0x5607c4]={'$like':'%'+_0x31ac5c[_0xcc43('0x3d')]['filter']+'%'};return _0x7e8693;})});}_0x5136ab=_[_0xcc43('0x49')]({},_0x5136ab,_0x31ac5c[_0xcc43('0x4b')]);return _0x11b6ef[_0xcc43('0x9b')](_0x5136ab);}})[_0xcc43('0x28')](function(_0x4413e7){if(_0x4413e7){_0x407db4=_0x4413e7['length'];if(!_0x31ac5c[_0xcc43('0x3d')][_0xcc43('0x44')]('nolimit')){_0x5136ab[_0xcc43('0x21')]=qs[_0xcc43('0x21')](_0x31ac5c['query'][_0xcc43('0x21')]);_0x5136ab['offset']=qs['offset'](_0x31ac5c['query'][_0xcc43('0x1f')]);}return _0x11b6ef[_0xcc43('0x9b')](_0x5136ab);}})[_0xcc43('0x28')](function(_0x1f7164){if(_0x1f7164){return _0x1f7164?{'count':_0x407db4,'rows':_0x1f7164}:null;}})['then'](respondWithResult(_0x13b446,null))[_0xcc43('0x51')](handleError(_0x13b446,null));};exports['getMembers']=function(_0x591736,_0x3ba1de,_0x4b68a3){var _0x405d0d={};var _0x2aa041={};var _0x53ea33;var _0x63a67b;return db[_0xcc43('0x4c')][_0xcc43('0x64')]({'where':{'id':_0x591736['params']['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x3ba1de,null))[_0xcc43('0x28')](function(_0x1f4d26){if(_0x1f4d26){_0x53ea33=_0x1f4d26;_0x2aa041[_0xcc43('0x3b')]=_[_0xcc43('0x3e')](db[_0xcc43('0x7f')][_0xcc43('0x38')]);_0x2aa041[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x591736[_0xcc43('0x3d')]);_0x2aa041[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0x2aa041[_0xcc43('0x3b')],_0x2aa041[_0xcc43('0x3d')]);_0x405d0d[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x2aa041[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x591736[_0xcc43('0x3d')]['fields']));_0x405d0d[_0xcc43('0x41')]=_0x405d0d[_0xcc43('0x41')]['length']?_0x405d0d[_0xcc43('0x41')]:_0x2aa041[_0xcc43('0x3b')];_0x405d0d[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x591736[_0xcc43('0x3d')]['sort']);_0x405d0d[_0xcc43('0x48')]=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x591736[_0xcc43('0x3d')],_0x2aa041[_0xcc43('0x3f')]));if(_0x591736[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x405d0d['where']=_[_0xcc43('0x49')](_0x405d0d[_0xcc43('0x48')],{'$or':_['map'](_0x405d0d[_0xcc43('0x41')],function(_0x40f1bb){var _0xa76c19={};_0xa76c19[_0x40f1bb]={'$like':'%'+_0x591736[_0xcc43('0x3d')][_0xcc43('0x2e')]+'%'};return _0xa76c19;})});}_0x405d0d=_['merge']({},_0x405d0d,_0x591736[_0xcc43('0x4b')]);return _0x53ea33['getMembers'](_0x405d0d);}})[_0xcc43('0x28')](function(_0x54828c){if(_0x54828c){_0x63a67b=_0x54828c[_0xcc43('0x43')];if(!_0x591736[_0xcc43('0x3d')][_0xcc43('0x44')](_0xcc43('0x66'))){_0x405d0d[_0xcc43('0x21')]=qs['limit'](_0x591736[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x405d0d[_0xcc43('0x1f')]=qs[_0xcc43('0x1f')](_0x591736[_0xcc43('0x3d')][_0xcc43('0x1f')]);}return _0x53ea33['getMembers'](_0x405d0d);}})[_0xcc43('0x28')](function(_0x39d054){return _0x39d054?{'count':_0x63a67b,'rows':_0x39d054}:null;})[_0xcc43('0x28')](respondWithResult(_0x3ba1de,null))[_0xcc43('0x51')](handleError(_0x3ba1de,null));};exports['getLists']=function(_0x448fe0,_0x503c9a,_0x1c4130){var _0x301e0c={};var _0x4bd744={};var _0x2a51a6;var _0x33aba5;return db[_0xcc43('0x4c')][_0xcc43('0x64')]({'where':{'id':_0x448fe0[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x503c9a,null))[_0xcc43('0x28')](function(_0x1bdc10){if(_0x1bdc10){_0x2a51a6=_0x1bdc10;_0x4bd744['model']=_[_0xcc43('0x3e')](db['CmList'][_0xcc43('0x38')]);_0x4bd744[_0xcc43('0x3d')]=_[_0xcc43('0x3e')](_0x448fe0['query']);_0x4bd744[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0x4bd744['model'],_0x4bd744[_0xcc43('0x3d')]);_0x301e0c[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0x4bd744[_0xcc43('0x3b')],qs[_0xcc43('0x42')](_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x42')]));_0x301e0c[_0xcc43('0x41')]=_0x301e0c['attributes']['length']?_0x301e0c[_0xcc43('0x41')]:_0x4bd744['model'];_0x301e0c[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x46')]);_0x301e0c['where']=qs[_0xcc43('0x3f')](_[_0xcc43('0x47')](_0x448fe0[_0xcc43('0x3d')],_0x4bd744['filters']));if(_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x301e0c[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0x301e0c[_0xcc43('0x48')],{'$or':_[_0xcc43('0x3c')](_0x301e0c[_0xcc43('0x41')],function(_0x1eff8b){var _0x65b71f={};_0x65b71f[_0x1eff8b]={'$like':'%'+_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x2e')]+'%'};return _0x65b71f;})});}_0x301e0c=_['merge']({},_0x301e0c,_0x448fe0[_0xcc43('0x4b')]);return _0x2a51a6['getLists'](_0x301e0c);}})['then'](function(_0x9a3a5e){if(_0x9a3a5e){_0x33aba5=_0x9a3a5e['length'];if(!_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x44')](_0xcc43('0x66'))){_0x301e0c[_0xcc43('0x21')]=qs[_0xcc43('0x21')](_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x301e0c['offset']=qs['offset'](_0x448fe0[_0xcc43('0x3d')][_0xcc43('0x1f')]);}return _0x2a51a6[_0xcc43('0x9c')](_0x301e0c);}})[_0xcc43('0x28')](function(_0x16980f){if(_0x16980f){return _0x16980f?{'count':_0x33aba5,'rows':_0x16980f}:null;}})['then'](respondWithResult(_0x503c9a,null))[_0xcc43('0x51')](handleError(_0x503c9a,null));};exports[_0xcc43('0x9d')]=function(_0x3a9f34,_0x2e5c63,_0x2cca80){var _0x9eb5e8=moment()[_0xcc43('0x81')](_0xcc43('0x9e'));var _0x1355eb,_0x211af3;return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x3a9f34[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x2e5c63,null))[_0xcc43('0x28')](function(_0xc9ce05){if(_0xc9ce05){_0x211af3=_0xc9ce05;return _0xc9ce05[_0xcc43('0x9d')](_0x3a9f34[_0xcc43('0x55')]['ids'],_[_0xcc43('0x60')](_0x3a9f34[_0xcc43('0x55')],['ids','id'])||{});}return null;})[_0xcc43('0x97')](function(_0x343ffd){var _0x14cd55;_0x1355eb=_0x343ffd||[];var _0x1714ea=[];if(_0x343ffd){for(var _0x516871=0x0;_0x516871<_0x343ffd[_0xcc43('0x43')];_0x516871+=0x1){var _0x1ceb49=_0x343ffd[_0x516871][_0xcc43('0x2a')]({'plain':!![]});_0x211af3[_0xcc43('0x9f')]=_0x3a9f34['body'][_0xcc43('0x9f')]?_0x3a9f34[_0xcc43('0x55')]['dialCheckDuplicateType']:_0x211af3[_0xcc43('0x9f')];switch(_0x211af3[_0xcc43('0x9f')]){case _0xcc43('0xa0'):_0x14cd55=squel[_0xcc43('0xa1')]()[_0xcc43('0xa2')](_0xcc43('0xa3'))['fromQuery']([_0xcc43('0xa4'),'scheduledAt',_0xcc43('0xa5'),_0xcc43('0xa6'),_0xcc43('0x67'),_0xcc43('0x61'),'updatedAt'],squel[_0xcc43('0xa7')]()[_0xcc43('0x86')](_0xcc43('0xa4'),'phone')['field']('\x27'+_0x9eb5e8+'\x27',_0xcc43('0xa8'))[_0xcc43('0x86')]('id',_0xcc43('0xa5'))[_0xcc43('0x86')](_0x1ceb49['CmListId']['toString'](),_0xcc43('0xa6'))[_0xcc43('0x86')](_0x3a9f34[_0xcc43('0x53')]['id'][_0xcc43('0x8d')](),'VoiceQueueId')[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x61'))[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x62'))['from'](_0xcc43('0xa9'))[_0xcc43('0x48')]('deletedAt\x20IS\x20NULL')[_0xcc43('0x48')]('ListId\x20=\x20?',_0x1ceb49[_0xcc43('0xaa')][_0xcc43('0x8d')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xcc43('0x48')](_0xcc43('0xab'),squel[_0xcc43('0xa7')]()[_0xcc43('0x86')](_0xcc43('0xac'))['from']('cm_hopper_final')[_0xcc43('0x48')](_0xcc43('0xad'),_0x3a9f34[_0xcc43('0x53')]['id'][_0xcc43('0x8d')]()))[_0xcc43('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcc43('0xa7')]()[_0xcc43('0x86')](_0xcc43('0xae'))[_0xcc43('0x88')](_0xcc43('0xa3'))['where'](_0xcc43('0xad'),_0x3a9f34['params']['id'][_0xcc43('0x8d')]())))['toString']();break;case'onlyIfOpen':_0x14cd55=squel['insert']()['into']('cm_hopper')['fromQuery'](['phone',_0xcc43('0xa8'),'ContactId',_0xcc43('0xa6'),_0xcc43('0x67'),'createdAt',_0xcc43('0x62')],squel[_0xcc43('0xa7')]()[_0xcc43('0x86')]('phone',_0xcc43('0xa4'))['field']('\x27'+_0x9eb5e8+'\x27',_0xcc43('0xa8'))[_0xcc43('0x86')]('id','ContactId')[_0xcc43('0x86')](_0x1ceb49['CmListId'][_0xcc43('0x8d')](),'ListId')[_0xcc43('0x86')](_0x3a9f34[_0xcc43('0x53')]['id'][_0xcc43('0x8d')](),_0xcc43('0x67'))[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x61'))[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x62'))[_0xcc43('0x88')]('cm_contacts')[_0xcc43('0x48')](_0xcc43('0xaf'))[_0xcc43('0x48')](_0xcc43('0xb0'),_0x1ceb49[_0xcc43('0xaa')][_0xcc43('0x8d')]())[_0xcc43('0x48')](_0xcc43('0xb1'))[_0xcc43('0x48')](_0xcc43('0xab'),squel[_0xcc43('0xa7')]()[_0xcc43('0x86')](_0xcc43('0xae'))[_0xcc43('0x88')]('cm_hopper')[_0xcc43('0x48')]('VoiceQueueId\x20=\x20?',_0x3a9f34[_0xcc43('0x53')]['id']['toString']())))[_0xcc43('0x8d')]();break;default:_0x14cd55=squel[_0xcc43('0xa1')]()[_0xcc43('0xa2')](_0xcc43('0xa3'))[_0xcc43('0xb2')](['phone',_0xcc43('0xa8'),'ContactId','ListId',_0xcc43('0x67'),_0xcc43('0x61'),_0xcc43('0x62')],squel['select']()['field']('phone','phone')[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0xa8'))[_0xcc43('0x86')]('id',_0xcc43('0xa5'))[_0xcc43('0x86')](_0x1ceb49[_0xcc43('0xaa')][_0xcc43('0x8d')](),_0xcc43('0xa6'))[_0xcc43('0x86')](_0x3a9f34[_0xcc43('0x53')]['id'][_0xcc43('0x8d')](),'VoiceQueueId')[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x61'))[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x62'))['from']('cm_contacts')['where'](_0xcc43('0xaf'))[_0xcc43('0x48')]('ListId\x20=\x20?',_0x1ceb49['CmListId']['toString']())[_0xcc43('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0xcc43('0x8d')]();}_0x1714ea[_0xcc43('0x8c')](db[_0xcc43('0x78')][_0xcc43('0x3d')](_0x14cd55));}return BPromise[_0xcc43('0x98')](_0x1714ea);}})['then'](function(){var _0x2fba7c=[];var _0x25931b=squel['insert']()['into'](_0xcc43('0xb3'))[_0xcc43('0xb2')]([_0xcc43('0xb4'),_0xcc43('0xa4'),_0xcc43('0xb5'),'createdAt',_0xcc43('0x62')],squel[_0xcc43('0xa7')]()[_0xcc43('0x86')](_0xcc43('0xb6'))[_0xcc43('0x86')]('ci.item')[_0xcc43('0x86')](_0xcc43('0xb7'))['field']('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x61'))[_0xcc43('0x86')]('\x27'+_0x9eb5e8+'\x27',_0xcc43('0x62'))[_0xcc43('0x88')](_0xcc43('0xb8'),'ci')[_0xcc43('0x89')]('cm_hopper','h',_0xcc43('0xb9'))['where'](_0xcc43('0xba'),_0x9eb5e8)['where'](_0xcc43('0xbb'),_0xcc43('0xbc')))[_0xcc43('0x8d')]();_0x2fba7c[_0xcc43('0x8c')](db[_0xcc43('0x78')]['query'](_0x25931b));return BPromise[_0xcc43('0x98')](_0x2fba7c);})['then'](function(){return _0x1355eb;})[_0xcc43('0x28')](respondWithResult(_0x2e5c63,null))[_0xcc43('0x51')](handleError(_0x2e5c63,null));};exports['removeLists']=function(_0x3451a8,_0x2f6140,_0x5c168d){return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x3451a8[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x2f6140,null))['then'](function(_0x30064c){if(_0x30064c){return _0x30064c[_0xcc43('0xbd')](_0x3451a8[_0xcc43('0x3d')][_0xcc43('0x85')]);}})[_0xcc43('0x28')](function(_0x647f4a){if(_0x647f4a){return db[_0xcc43('0x65')][_0xcc43('0x29')]({'where':{'ListId':_0x3451a8[_0xcc43('0x3d')][_0xcc43('0x85')],'VoiceQueueId':_0x3451a8[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](function(){return _0x647f4a;});}})[_0xcc43('0x28')](respondWithStatusCode(_0x2f6140,null))['catch'](handleError(_0x2f6140,null));};exports[_0xcc43('0xbe')]=function(_0x2faa63,_0x3e91eb,_0x5aa52a){var _0x5e89da={};var _0xeb0644={};var _0x167172;var _0x4fcc46;return db[_0xcc43('0x4c')][_0xcc43('0x64')]({'where':{'id':_0x2faa63[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x3e91eb,null))[_0xcc43('0x28')](function(_0x2bb9d4){if(_0x2bb9d4){_0x167172=_0x2bb9d4;_0xeb0644[_0xcc43('0x3b')]=_[_0xcc43('0x3e')](db[_0xcc43('0xbf')][_0xcc43('0x38')]);_0xeb0644['query']=_[_0xcc43('0x3e')](_0x2faa63[_0xcc43('0x3d')]);_0xeb0644[_0xcc43('0x3f')]=_[_0xcc43('0x40')](_0xeb0644[_0xcc43('0x3b')],_0xeb0644[_0xcc43('0x3d')]);_0x5e89da[_0xcc43('0x41')]=_[_0xcc43('0x40')](_0xeb0644['model'],qs['fields'](_0x2faa63['query'][_0xcc43('0x42')]));_0x5e89da[_0xcc43('0x41')]=_0x5e89da[_0xcc43('0x41')][_0xcc43('0x43')]?_0x5e89da[_0xcc43('0x41')]:_0xeb0644[_0xcc43('0x3b')];_0x5e89da[_0xcc43('0x45')]=qs[_0xcc43('0x46')](_0x2faa63[_0xcc43('0x3d')][_0xcc43('0x46')]);_0x5e89da[_0xcc43('0x48')]=qs['filters'](_[_0xcc43('0x47')](_0x2faa63['query'],_0xeb0644[_0xcc43('0x3f')]));if(_0x2faa63[_0xcc43('0x3d')][_0xcc43('0x2e')]){_0x5e89da[_0xcc43('0x48')]=_[_0xcc43('0x49')](_0x5e89da['where'],{'$or':_['map'](_0x5e89da[_0xcc43('0x41')],function(_0x3f19b5){var _0x541fd3={};_0x541fd3[_0x3f19b5]={'$like':'%'+_0x2faa63['query'][_0xcc43('0x2e')]+'%'};return _0x541fd3;})});}_0x5e89da=_['merge']({},_0x5e89da,_0x2faa63['options']);return _0x167172['getBlackLists'](_0x5e89da);}})[_0xcc43('0x28')](function(_0x583e3b){if(_0x583e3b){_0x4fcc46=_0x583e3b[_0xcc43('0x43')];if(!_0x2faa63[_0xcc43('0x3d')][_0xcc43('0x44')]('nolimit')){_0x5e89da[_0xcc43('0x21')]=qs[_0xcc43('0x21')](_0x2faa63[_0xcc43('0x3d')][_0xcc43('0x21')]);_0x5e89da[_0xcc43('0x1f')]=qs[_0xcc43('0x1f')](_0x2faa63[_0xcc43('0x3d')][_0xcc43('0x1f')]);}return _0x167172['getBlackLists'](_0x5e89da);}})['then'](function(_0x2a7302){if(_0x2a7302){return _0x2a7302?{'count':_0x4fcc46,'rows':_0x2a7302}:null;}})[_0xcc43('0x28')](respondWithResult(_0x3e91eb,null))[_0xcc43('0x51')](handleError(_0x3e91eb,null));};exports[_0xcc43('0xc0')]=function(_0x4fa0b2,_0x665528,_0x21a894){var _0x222f29,_0x53484d;return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x4fa0b2[_0xcc43('0x53')]['id']}})['then'](handleEntityNotFound(_0x665528,null))[_0xcc43('0x28')](function(_0x3b9ba1){if(_0x3b9ba1){_0x53484d=_0x3b9ba1;return _0x3b9ba1['addBlackLists'](_0x4fa0b2[_0xcc43('0x55')]['ids'],_['omit'](_0x4fa0b2[_0xcc43('0x55')],[_0xcc43('0x85'),'id'])||{});}return null;})[_0xcc43('0x97')](function(_0x29406e){var _0x1fec0d;_0x222f29=_0x29406e||[];var _0x19b867=[];if(_0x29406e){for(var _0xc87ec2=0x0;_0xc87ec2<_0x29406e['length'];_0xc87ec2+=0x1){var _0x4f9c55=_0x29406e[_0xc87ec2][_0xcc43('0x2a')]({'plain':!![]});_0x1fec0d=squel[_0xcc43('0xa1')]()[_0xcc43('0xa2')](_0xcc43('0xc1'))['fromQuery']([_0xcc43('0xa4'),_0xcc43('0xa5'),_0xcc43('0xa6'),_0xcc43('0x67'),'createdAt',_0xcc43('0x62')],squel['select']()['field'](_0xcc43('0xa4'),_0xcc43('0xa4'))['field']('id',_0xcc43('0xa5'))[_0xcc43('0x86')](_0x4f9c55[_0xcc43('0xaa')]['toString'](),'ListId')[_0xcc43('0x86')](_0x4fa0b2[_0xcc43('0x53')]['id'][_0xcc43('0x8d')](),'VoiceQueueId')[_0xcc43('0x86')](_0xcc43('0xc2'),_0xcc43('0x61'))['field']('NOW()','updatedAt')['from'](_0xcc43('0xa9'))[_0xcc43('0x48')]('deletedAt\x20IS\x20NULL')[_0xcc43('0x48')](_0xcc43('0xb0'),_0x4f9c55[_0xcc43('0xaa')][_0xcc43('0x8d')]())[_0xcc43('0x48')](_0xcc43('0xb1')))[_0xcc43('0x8d')]();_0x19b867[_0xcc43('0x8c')](db[_0xcc43('0x78')][_0xcc43('0x3d')](_0x1fec0d));}return BPromise['all'](_0x19b867);}})['then'](function(){return _0x222f29;})[_0xcc43('0x28')](respondWithResult(_0x665528,null))[_0xcc43('0x51')](handleError(_0x665528,null));};exports[_0xcc43('0xc3')]=function(_0x4775b2,_0x3891c5,_0x5a034d){return db[_0xcc43('0x4c')][_0xcc43('0x33')]({'where':{'id':_0x4775b2[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](handleEntityNotFound(_0x3891c5,null))[_0xcc43('0x28')](function(_0x3373bb){if(_0x3373bb){return _0x3373bb[_0xcc43('0xc3')](_0x4775b2['query'][_0xcc43('0x85')]);}})[_0xcc43('0x28')](function(_0x24a58a){if(_0x24a58a){return db[_0xcc43('0x6c')][_0xcc43('0x29')]({'where':{'ListId':_0x4775b2[_0xcc43('0x3d')][_0xcc43('0x85')],'VoiceQueueId':_0x4775b2[_0xcc43('0x53')]['id']}})[_0xcc43('0x28')](function(){return _0x24a58a;});}})['then'](respondWithStatusCode(_0x3891c5,null))['catch'](handleError(_0x3891c5,null));};
\ No newline at end of file
+var _0xf494=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty','userVoiceQueue:remove','addAgents','spread','online','format','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','VoiceQueues','inbound','filter','ignore','value','includes','find','type','UserProfileResource','destroy','end','error','stack','name','send','map','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','QueueCampaigns','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','userVoiceQueue:save','ids'];(function(_0x3d3817,_0x5d0b91){var _0x4f23ce=function(_0x174457){while(--_0x174457){_0x3d3817['push'](_0x3d3817['shift']());}};_0x4f23ce(++_0x5d0b91);}(_0xf494,0x1c6));var _0x4f49=function(_0x1f0da2,_0xd6fd36){_0x1f0da2=_0x1f0da2-0x0;var _0x1dab45=_0xf494[_0x1f0da2];return _0x1dab45;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];config[_0x4f49('0x19')]=_['defaults'](config[_0x4f49('0x19')],{'host':_0x4f49('0x1a'),'port':0x18eb});var socket=require(_0x4f49('0x1b'))(new Redis(config[_0x4f49('0x19')]));require(_0x4f49('0x1c'))[_0x4f49('0x1d')](socket);function respondWithStatusCode(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xcc;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1e')](_0x5c373e);}return _0xfdb477[_0x4f49('0x1f')](_0x5c373e)['end']();};}function respondWithResult(_0x5bdfaf,_0x2f0a0d){_0x2f0a0d=_0x2f0a0d||0xc8;return function(_0x2ecaaa){if(_0x2ecaaa){return _0x5bdfaf[_0x4f49('0x1f')](_0x2f0a0d)['json'](_0x2ecaaa);}};}function respondWithFilteredResult(_0x1dccfd,_0x399be7){return function(_0x4e85df){if(_0x4e85df){var _0x49cdaf=typeof _0x399be7['offset']==='undefined'&&typeof _0x399be7['limit']===_0x4f49('0x20');var _0x1834f4=_0x4e85df[_0x4f49('0x21')];var _0x407042=_0x49cdaf?0x0:_0x399be7['offset'];var _0x416893=_0x49cdaf?_0x4e85df[_0x4f49('0x21')]:_0x399be7[_0x4f49('0x22')]+_0x399be7[_0x4f49('0x23')];var _0xea82f8;if(_0x416893>=_0x1834f4){_0x416893=_0x1834f4;_0xea82f8=0xc8;}else{_0xea82f8=0xce;}_0x1dccfd['status'](_0xea82f8);return _0x1dccfd[_0x4f49('0x24')](_0x4f49('0x25'),_0x407042+'-'+_0x416893+'/'+_0x1834f4)[_0x4f49('0x26')](_0x4e85df);}return null;};}function patchUpdates(_0x53b57d){return function(_0x40755e){try{jsonpatch[_0x4f49('0x27')](_0x40755e,_0x53b57d,!![]);}catch(_0x32ca7b){return BPromise[_0x4f49('0x28')](_0x32ca7b);}return _0x40755e[_0x4f49('0x29')]();};}function saveUpdates(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x2a')](_0x36187b)[_0x4f49('0x2b')](function(_0x4fedbb){return _0x4fedbb;});}return null;};}function removeEntity(_0x408552,_0x2c1519){return function(_0x35f8e0){if(_0x35f8e0){return _0x35f8e0['destroy']()[_0x4f49('0x2b')](function(){var _0x2eed1c=_0x35f8e0[_0x4f49('0x2c')]({'plain':!![]});var _0x148153=[{'name':_0x4f49('0x2d'),'value':_0x4f49('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x239f44=_(_0x148153)[_0x4f49('0x2f')](_0x4f49('0x30'))['map'](_0x4f49('0x31'))[_0x4f49('0x31')]();if(_[_0x4f49('0x32')](_0x239f44,_0x2eed1c['type'])){return;}var _0x4dd55a=_[_0x4f49('0x33')](_0x148153,[_0x4f49('0x31'),_0x2eed1c[_0x4f49('0x34')]])['name'];return db[_0x4f49('0x35')][_0x4f49('0x36')]({'where':{'type':_0x4dd55a,'resourceId':_0x2eed1c['id']}})[_0x4f49('0x2b')](function(){return _0x35f8e0;});})[_0x4f49('0x2b')](function(){_0x408552[_0x4f49('0x1f')](0xcc)[_0x4f49('0x37')]();});}};}function handleEntityNotFound(_0x32c066,_0x45ae19){return function(_0x1f38d3){if(!_0x1f38d3){_0x32c066[_0x4f49('0x1e')](0x194);}return _0x1f38d3;};}function handleError(_0x2291d4,_0xf65ac6){_0xf65ac6=_0xf65ac6||0x1f4;return function(_0x29ff83){logger[_0x4f49('0x38')](_0x29ff83[_0x4f49('0x39')]);if(_0x29ff83[_0x4f49('0x3a')]){delete _0x29ff83[_0x4f49('0x3a')];}_0x2291d4[_0x4f49('0x1f')](_0xf65ac6)[_0x4f49('0x3b')](_0x29ff83);};}exports['index']=function(_0x45d0d2,_0x46b7ba){var _0x24f568={},_0x1cb3cc={},_0x1c3af8={'count':0x0,'rows':[]};var _0x15e82b=_[_0x4f49('0x3c')](db[_0x4f49('0x3d')][_0x4f49('0x3e')],function(_0x338db8){return{'name':_0x338db8[_0x4f49('0x3f')],'type':_0x338db8[_0x4f49('0x34')][_0x4f49('0x40')]};});_0x1cb3cc['model']=_[_0x4f49('0x3c')](_0x15e82b,_0x4f49('0x3a'));_0x1cb3cc[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x45d0d2[_0x4f49('0x41')]);_0x1cb3cc[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x1cb3cc[_0x4f49('0x45')],_0x1cb3cc[_0x4f49('0x41')]);_0x24f568[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x1cb3cc[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0x45d0d2[_0x4f49('0x41')]['fields']));_0x24f568[_0x4f49('0x46')]=_0x24f568[_0x4f49('0x46')]['length']?_0x24f568[_0x4f49('0x46')]:_0x1cb3cc[_0x4f49('0x45')];if(!_0x45d0d2['query'][_0x4f49('0x48')](_0x4f49('0x49'))){_0x24f568[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x45d0d2[_0x4f49('0x41')][_0x4f49('0x23')]);_0x24f568[_0x4f49('0x22')]=qs['offset'](_0x45d0d2['query']['offset']);}_0x24f568[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x45d0d2[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x24f568[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x45d0d2[_0x4f49('0x41')],_0x1cb3cc[_0x4f49('0x43')]),_0x15e82b);if(_0x45d0d2['query']['filter']){_0x24f568[_0x4f49('0x4c')]=_[_0x4f49('0x4e')](_0x24f568[_0x4f49('0x4c')],{'$or':_['map'](_0x15e82b,function(_0x2d6b56){if(_0x2d6b56['type']!=='VIRTUAL'){var _0x146d55={};_0x146d55[_0x2d6b56[_0x4f49('0x3a')]]={'$like':'%'+_0x45d0d2[_0x4f49('0x41')]['filter']+'%'};return _0x146d55;}})});}_0x24f568=_[_0x4f49('0x4e')]({},_0x24f568,_0x45d0d2[_0x4f49('0x4f')]);var _0x5e9f60={'where':_0x24f568[_0x4f49('0x4c')]};return db['VoiceQueue'][_0x4f49('0x21')](_0x5e9f60)[_0x4f49('0x2b')](function(_0x133f39){_0x1c3af8['count']=_0x133f39;if(_0x45d0d2[_0x4f49('0x41')][_0x4f49('0x50')]){_0x24f568[_0x4f49('0x51')]=[{'all':!![]}];}return db[_0x4f49('0x3d')][_0x4f49('0x52')](_0x24f568);})[_0x4f49('0x2b')](function(_0xe66867){_0x1c3af8[_0x4f49('0x53')]=_0xe66867;return _0x1c3af8;})[_0x4f49('0x2b')](respondWithFilteredResult(_0x46b7ba,_0x24f568))[_0x4f49('0x54')](handleError(_0x46b7ba,null));};exports['show']=function(_0x26c222,_0x44bf1d){var _0x59997c={'raw':![],'where':{'id':_0x26c222['params']['id']}},_0x1b4a8e={};_0x1b4a8e[_0x4f49('0x45')]=_[_0x4f49('0x42')](db[_0x4f49('0x3d')][_0x4f49('0x3e')]);_0x1b4a8e['query']=_[_0x4f49('0x42')](_0x26c222[_0x4f49('0x41')]);_0x1b4a8e[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x1b4a8e[_0x4f49('0x45')],_0x1b4a8e[_0x4f49('0x41')]);_0x59997c[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x1b4a8e[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0x26c222[_0x4f49('0x41')][_0x4f49('0x47')]));_0x59997c[_0x4f49('0x46')]=_0x59997c[_0x4f49('0x46')][_0x4f49('0x55')]?_0x59997c[_0x4f49('0x46')]:_0x1b4a8e['model'];if(_0x26c222['query'][_0x4f49('0x50')]){_0x59997c[_0x4f49('0x51')]=[{'all':!![]}];}_0x59997c=_[_0x4f49('0x4e')]({},_0x59997c,_0x26c222[_0x4f49('0x4f')]);return db[_0x4f49('0x3d')][_0x4f49('0x33')](_0x59997c)[_0x4f49('0x2b')](handleEntityNotFound(_0x44bf1d,null))['then'](respondWithResult(_0x44bf1d,null))[_0x4f49('0x54')](handleError(_0x44bf1d,null));};exports['create']=function(_0x468978,_0x55d849){return db[_0x4f49('0x3d')][_0x4f49('0x56')](_0x468978['body'],{})[_0x4f49('0x2b')](function(_0x5e75f5){var _0x52d18c=_0x468978[_0x4f49('0x57')][_0x4f49('0x2c')]({'plain':!![]});if(!_0x52d18c)throw new Error(_0x4f49('0x58'));if(_0x52d18c[_0x4f49('0x59')]==='user'){var _0x599c51=_0x5e75f5[_0x4f49('0x2c')]({'plain':!![]});var _0x291a45=[{'name':'VoiceQueues','value':_0x4f49('0x2e')},{'name':'QueueCampaigns','value':'outbound'}];var _0xf90696=_['find'](_0x291a45,[_0x4f49('0x31'),_0x599c51['type']])[_0x4f49('0x3a')];return db[_0x4f49('0x5a')][_0x4f49('0x33')]({'where':{'name':_0xf90696,'userProfileId':_0x52d18c[_0x4f49('0x5b')]},'raw':!![]})[_0x4f49('0x2b')](function(_0x66e23d){if(_0x66e23d&&_0x66e23d[_0x4f49('0x5c')]===0x0){return db[_0x4f49('0x35')]['create']({'name':_0x599c51[_0x4f49('0x3a')],'resourceId':_0x599c51['id'],'type':_0x66e23d['name'],'sectionId':_0x66e23d['id']},{})[_0x4f49('0x2b')](function(){return _0x5e75f5;});}else{return _0x5e75f5;}})[_0x4f49('0x54')](function(_0xc4fc6b){logger[_0x4f49('0x38')](_0x4f49('0x5d'),_0xc4fc6b);throw _0xc4fc6b;});}return _0x5e75f5;})[_0x4f49('0x2b')](respondWithResult(_0x55d849,0xc9))['catch'](handleError(_0x55d849,null));};exports[_0x4f49('0x5e')]=function(_0xd3689c,_0x5e3568){var _0x5d2b3c={'where':{'id':_0xd3689c[_0x4f49('0x5f')]['id']}},_0x121c04={};_0x121c04[_0x4f49('0x45')]=_[_0x4f49('0x42')](db[_0x4f49('0x3d')]['rawAttributes']);_0x5d2b3c[_0x4f49('0x46')]=_['intersection'](_0x121c04[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0xd3689c[_0x4f49('0x41')]['fields']));_0x5d2b3c[_0x4f49('0x46')]=_0x5d2b3c[_0x4f49('0x46')][_0x4f49('0x55')]?_0x5d2b3c[_0x4f49('0x46')]:_0x121c04['model'];if(_0xd3689c[_0x4f49('0x41')][_0x4f49('0x50')]){_0x5d2b3c['include']=[{'all':!![]}];}_0x5d2b3c=_[_0x4f49('0x4e')]({},_0x5d2b3c,_0xd3689c[_0x4f49('0x4f')]);return db[_0x4f49('0x3d')][_0x4f49('0x33')](_0x5d2b3c)[_0x4f49('0x2b')](handleEntityNotFound(_0x5e3568,null))[_0x4f49('0x2b')](function(_0x45ef98){if(_0x45ef98){var _0x30fc21=_0x45ef98['get']({'plain':!![]});_0x30fc21=qs[_0x4f49('0x60')](_0x30fc21,['id',_0x4f49('0x61'),_0x4f49('0x62')]);_0xd3689c[_0x4f49('0x63')]=_[_0x4f49('0x60')](_0xd3689c[_0x4f49('0x63')],['id',_0x4f49('0x61'),'updatedAt']);return db[_0x4f49('0x3d')]['create'](_[_0x4f49('0x4e')](_0x30fc21,_0xd3689c[_0x4f49('0x63')]),{'include':_0xd3689c[_0x4f49('0x41')][_0x4f49('0x50')]?[{'all':!![]}]:undefined})[_0x4f49('0x2b')](function(_0x3f2f3f){var _0x61a565=_0xd3689c[_0x4f49('0x57')][_0x4f49('0x2c')]({'plain':!![]});if(!_0x61a565)throw new Error(_0x4f49('0x58'));if(_0x61a565['role']===_0x4f49('0x57')){var _0x141554=_0x3f2f3f[_0x4f49('0x2c')]({'plain':!![]});var _0x2cdaa4=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x4f49('0x64'),'value':'outbound'}];var _0x30defd=_[_0x4f49('0x33')](_0x2cdaa4,[_0x4f49('0x31'),_0x141554[_0x4f49('0x34')]])[_0x4f49('0x3a')];return db[_0x4f49('0x5a')][_0x4f49('0x33')]({'where':{'name':_0x30defd,'userProfileId':_0x61a565[_0x4f49('0x5b')]},'raw':!![]})[_0x4f49('0x2b')](function(_0x3e9b47){if(_0x3e9b47&&_0x3e9b47[_0x4f49('0x5c')]===0x0){return db[_0x4f49('0x35')][_0x4f49('0x56')]({'name':_0x141554[_0x4f49('0x3a')],'resourceId':_0x141554['id'],'type':_0x3e9b47[_0x4f49('0x3a')],'sectionId':_0x3e9b47['id']},{})[_0x4f49('0x2b')](function(){return _0x3f2f3f;});}else{return _0x3f2f3f;}})[_0x4f49('0x54')](function(_0x753863){logger[_0x4f49('0x38')](_0x4f49('0x5d'),_0x753863);throw _0x753863;});}return _0x3f2f3f;});}})[_0x4f49('0x2b')](respondWithResult(_0x5e3568,0xc9))[_0x4f49('0x54')](handleError(_0x5e3568,null));};exports[_0x4f49('0x2a')]=function(_0x4683f8,_0x2d0990){if(_0x4683f8['body']['id']){delete _0x4683f8[_0x4f49('0x63')]['id'];}return db['VoiceQueue'][_0x4f49('0x33')]({'where':{'id':_0x4683f8[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x2d0990,null))[_0x4f49('0x2b')](saveUpdates(_0x4683f8[_0x4f49('0x63')],null))[_0x4f49('0x2b')](respondWithResult(_0x2d0990,null))[_0x4f49('0x54')](handleError(_0x2d0990,null));};exports[_0x4f49('0x36')]=function(_0x3ee01a,_0x541ac6){return db['VoiceQueue'][_0x4f49('0x33')]({'where':{'id':_0x3ee01a['params']['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x541ac6,null))[_0x4f49('0x2b')](removeEntity(_0x541ac6,null))[_0x4f49('0x54')](handleError(_0x541ac6,null));};exports[_0x4f49('0x65')]=function(_0x1fc88a,_0x5a8b1c,_0x4e0d42){var _0x285a1a={'raw':![],'where':{}};var _0x9931b3={};var _0x4bdd1b={'count':0x0,'rows':[]};return db[_0x4f49('0x3d')][_0x4f49('0x66')]({'where':{'id':_0x1fc88a['params']['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x5a8b1c,null))['then'](function(_0x121972){if(_0x121972){_0x9931b3[_0x4f49('0x45')]=_['keys'](db[_0x4f49('0x67')][_0x4f49('0x3e')]);_0x9931b3[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x1fc88a[_0x4f49('0x41')]);_0x9931b3[_0x4f49('0x43')]=_['intersection'](_0x9931b3[_0x4f49('0x45')],_0x9931b3['query']);_0x285a1a[_0x4f49('0x46')]=_['intersection'](_0x9931b3[_0x4f49('0x45')],qs['fields'](_0x1fc88a[_0x4f49('0x41')][_0x4f49('0x47')]));_0x285a1a[_0x4f49('0x46')]=_0x285a1a[_0x4f49('0x46')]['length']?_0x285a1a[_0x4f49('0x46')]:_0x9931b3['model'];if(!_0x1fc88a[_0x4f49('0x41')]['hasOwnProperty'](_0x4f49('0x49'))){_0x285a1a['limit']=qs['limit'](_0x1fc88a[_0x4f49('0x41')][_0x4f49('0x23')]);_0x285a1a[_0x4f49('0x22')]=qs['offset'](_0x1fc88a[_0x4f49('0x41')][_0x4f49('0x22')]);}_0x285a1a['order']=qs['sort'](_0x1fc88a['query'][_0x4f49('0x4b')]);_0x285a1a[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x1fc88a[_0x4f49('0x41')],_0x9931b3['filters']));_0x285a1a[_0x4f49('0x4c')][_0x4f49('0x68')]=_0x121972['id'];if(_0x1fc88a[_0x4f49('0x41')]['filter']){_0x285a1a[_0x4f49('0x4c')]=_[_0x4f49('0x4e')](_0x285a1a[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3c')](_0x285a1a['attributes'],function(_0x249799){var _0xd8f5e2={};_0xd8f5e2[_0x249799]={'$like':'%'+_0x1fc88a[_0x4f49('0x41')][_0x4f49('0x2f')]+'%'};return _0xd8f5e2;})});}_0x285a1a=_[_0x4f49('0x4e')]({},_0x285a1a,_0x1fc88a['options']);return db[_0x4f49('0x67')][_0x4f49('0x21')]({'where':_0x285a1a['where']})[_0x4f49('0x2b')](function(_0x52899d){_0x4bdd1b[_0x4f49('0x21')]=_0x52899d;if(_0x1fc88a['query'][_0x4f49('0x50')]){_0x285a1a[_0x4f49('0x51')]=[{'all':!![]}];}return db[_0x4f49('0x67')][_0x4f49('0x52')](_0x285a1a);})[_0x4f49('0x2b')](function(_0x538943){_0x4bdd1b[_0x4f49('0x53')]=_0x538943;return _0x4bdd1b;});}})[_0x4f49('0x2b')](respondWithFilteredResult(_0x5a8b1c,_0x285a1a))[_0x4f49('0x54')](handleError(_0x5a8b1c,null));};exports[_0x4f49('0x69')]=function(_0x4b7c61,_0xf37d6a,_0x499643){var _0x39d8d3={'raw':!![],'where':{}};var _0x59a5e9={};var _0x3066ee={'count':0x0,'rows':[]};return db[_0x4f49('0x3d')][_0x4f49('0x66')]({'where':{'id':_0x4b7c61[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0xf37d6a,null))[_0x4f49('0x2b')](function(_0x323a3a){if(_0x323a3a){_0x59a5e9[_0x4f49('0x45')]=_[_0x4f49('0x42')](db[_0x4f49('0x6a')]['rawAttributes']);_0x59a5e9[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x4b7c61[_0x4f49('0x41')]);_0x59a5e9[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x59a5e9[_0x4f49('0x45')],_0x59a5e9['query']);_0x39d8d3[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x59a5e9[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0x4b7c61['query'][_0x4f49('0x47')]));_0x39d8d3['attributes']=_0x39d8d3[_0x4f49('0x46')][_0x4f49('0x55')]?_0x39d8d3[_0x4f49('0x46')]:_0x59a5e9[_0x4f49('0x45')];if(!_0x4b7c61['query'][_0x4f49('0x48')](_0x4f49('0x49'))){_0x39d8d3[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x4b7c61[_0x4f49('0x41')][_0x4f49('0x23')]);_0x39d8d3[_0x4f49('0x22')]=qs[_0x4f49('0x22')](_0x4b7c61[_0x4f49('0x41')][_0x4f49('0x22')]);}_0x39d8d3[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x4b7c61[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x39d8d3[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x4b7c61[_0x4f49('0x41')],_0x59a5e9['filters']));_0x39d8d3[_0x4f49('0x4c')][_0x4f49('0x68')]=_0x323a3a['id'];if(_0x4b7c61[_0x4f49('0x41')][_0x4f49('0x2f')]){_0x39d8d3['where']=_[_0x4f49('0x4e')](_0x39d8d3[_0x4f49('0x4c')],{'$or':_['map'](_0x39d8d3[_0x4f49('0x46')],function(_0x57c86c){var _0xf6bc4c={};_0xf6bc4c[_0x57c86c]={'$like':'%'+_0x4b7c61[_0x4f49('0x41')][_0x4f49('0x2f')]+'%'};return _0xf6bc4c;})});}_0x39d8d3=_[_0x4f49('0x4e')]({},_0x39d8d3,_0x4b7c61[_0x4f49('0x4f')]);return db[_0x4f49('0x6a')][_0x4f49('0x21')]({'where':_0x39d8d3[_0x4f49('0x4c')]})[_0x4f49('0x2b')](function(_0x322284){_0x3066ee['count']=_0x322284;if(_0x4b7c61['query'][_0x4f49('0x50')]){_0x39d8d3['include']=[{'all':!![]}];}return db[_0x4f49('0x6a')][_0x4f49('0x52')](_0x39d8d3);})['then'](function(_0x49dc5d){_0x3066ee[_0x4f49('0x53')]=_0x49dc5d;return _0x3066ee;});}})['then'](respondWithFilteredResult(_0xf37d6a,_0x39d8d3))[_0x4f49('0x54')](handleError(_0xf37d6a,null));};exports[_0x4f49('0x6b')]=function(_0x194274,_0x502cd9,_0xcdae95){var _0x5e3cd2={'raw':!![],'where':{}};var _0x17140e={};var _0x392f27={'count':0x0,'rows':[]};return db[_0x4f49('0x3d')]['findOne']({'where':{'id':_0x194274[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x502cd9,null))[_0x4f49('0x2b')](function(_0x4a1ef3){if(_0x4a1ef3){_0x17140e['model']=_[_0x4f49('0x42')](db['CmHopperFinal'][_0x4f49('0x3e')]);_0x17140e[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x194274['query']);_0x17140e[_0x4f49('0x43')]=_['intersection'](_0x17140e[_0x4f49('0x45')],_0x17140e[_0x4f49('0x41')]);_0x5e3cd2[_0x4f49('0x46')]=_['intersection'](_0x17140e[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0x194274[_0x4f49('0x41')][_0x4f49('0x47')]));_0x5e3cd2[_0x4f49('0x46')]=_0x5e3cd2[_0x4f49('0x46')]['length']?_0x5e3cd2['attributes']:_0x17140e[_0x4f49('0x45')];if(!_0x194274[_0x4f49('0x41')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x5e3cd2[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x194274[_0x4f49('0x41')][_0x4f49('0x23')]);_0x5e3cd2[_0x4f49('0x22')]=qs['offset'](_0x194274[_0x4f49('0x41')][_0x4f49('0x22')]);}_0x5e3cd2[_0x4f49('0x4a')]=qs['sort'](_0x194274[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x5e3cd2[_0x4f49('0x4c')]=qs['filters'](_[_0x4f49('0x4d')](_0x194274[_0x4f49('0x41')],_0x17140e[_0x4f49('0x43')]));_0x5e3cd2['where'][_0x4f49('0x68')]=_0x4a1ef3['id'];if(_0x194274[_0x4f49('0x41')][_0x4f49('0x2f')]){_0x5e3cd2['where']=_[_0x4f49('0x4e')](_0x5e3cd2[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3c')](_0x5e3cd2[_0x4f49('0x46')],function(_0x2ad13b){var _0x1b8ffc={};_0x1b8ffc[_0x2ad13b]={'$like':'%'+_0x194274['query']['filter']+'%'};return _0x1b8ffc;})});}_0x5e3cd2=_['merge']({},_0x5e3cd2,_0x194274[_0x4f49('0x4f')]);return db[_0x4f49('0x6c')]['count']({'where':_0x5e3cd2[_0x4f49('0x4c')]})[_0x4f49('0x2b')](function(_0x3f0f41){_0x392f27['count']=_0x3f0f41;if(_0x194274['query'][_0x4f49('0x50')]){_0x5e3cd2['include']=[{'all':!![]}];}return db[_0x4f49('0x6c')][_0x4f49('0x52')](_0x5e3cd2);})[_0x4f49('0x2b')](function(_0x2e3645){_0x392f27[_0x4f49('0x53')]=_0x2e3645;return _0x392f27;});}})['then'](respondWithFilteredResult(_0x502cd9,_0x5e3cd2))[_0x4f49('0x54')](handleError(_0x502cd9,null));};exports[_0x4f49('0x6d')]=function(_0x45c938,_0x9b23f6,_0x4a4d75){var _0x93e85d={'raw':!![],'where':{}};var _0x406d53={};var _0x5821a3={'count':0x0,'rows':[]};return db[_0x4f49('0x3d')][_0x4f49('0x66')]({'where':{'id':_0x45c938[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x9b23f6,null))[_0x4f49('0x2b')](function(_0x40991b){if(_0x40991b){_0x406d53['model']=_['keys'](db[_0x4f49('0x6e')][_0x4f49('0x3e')]);_0x406d53[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x45c938[_0x4f49('0x41')]);_0x406d53['filters']=_[_0x4f49('0x44')](_0x406d53['model'],_0x406d53[_0x4f49('0x41')]);_0x93e85d['attributes']=_['intersection'](_0x406d53[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0x45c938[_0x4f49('0x41')][_0x4f49('0x47')]));_0x93e85d[_0x4f49('0x46')]=_0x93e85d[_0x4f49('0x46')][_0x4f49('0x55')]?_0x93e85d['attributes']:_0x406d53[_0x4f49('0x45')];if(!_0x45c938[_0x4f49('0x41')][_0x4f49('0x48')]('nolimit')){_0x93e85d[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x45c938[_0x4f49('0x41')]['limit']);_0x93e85d[_0x4f49('0x22')]=qs[_0x4f49('0x22')](_0x45c938[_0x4f49('0x41')][_0x4f49('0x22')]);}_0x93e85d[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x45c938['query'][_0x4f49('0x4b')]);_0x93e85d[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x45c938[_0x4f49('0x41')],_0x406d53[_0x4f49('0x43')]));_0x93e85d[_0x4f49('0x4c')][_0x4f49('0x68')]=_0x40991b['id'];if(_0x45c938['query']['filter']){_0x93e85d[_0x4f49('0x4c')]=_[_0x4f49('0x4e')](_0x93e85d[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3c')](_0x93e85d[_0x4f49('0x46')],function(_0x29dbab){var _0x5f459b={};_0x5f459b[_0x29dbab]={'$like':'%'+_0x45c938[_0x4f49('0x41')][_0x4f49('0x2f')]+'%'};return _0x5f459b;})});}_0x93e85d=_['merge']({},_0x93e85d,_0x45c938[_0x4f49('0x4f')]);return db[_0x4f49('0x6e')][_0x4f49('0x21')]({'where':_0x93e85d['where']})['then'](function(_0x1e2335){_0x5821a3[_0x4f49('0x21')]=_0x1e2335;if(_0x45c938[_0x4f49('0x41')]['includeAll']){_0x93e85d[_0x4f49('0x51')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4f49('0x52')](_0x93e85d);})['then'](function(_0x21eb75){_0x5821a3[_0x4f49('0x53')]=_0x21eb75;return _0x5821a3;});}})['then'](respondWithFilteredResult(_0x9b23f6,_0x93e85d))[_0x4f49('0x54')](handleError(_0x9b23f6,null));};exports[_0x4f49('0x6f')]=function(_0x513bc9,_0x937ce1,_0x47567c){var _0x5f1538={};var _0x2adeec={};var _0x3244a2;var _0x3de485;return db[_0x4f49('0x3d')][_0x4f49('0x66')]({'where':{'id':_0x513bc9[_0x4f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x937ce1,null))[_0x4f49('0x2b')](function(_0x165289){if(_0x165289){_0x3244a2=_0x165289;_0x2adeec[_0x4f49('0x45')]=_['keys'](db[_0x4f49('0x70')][_0x4f49('0x3e')]);_0x2adeec[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x513bc9[_0x4f49('0x41')]);_0x2adeec[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x2adeec['model'],_0x2adeec[_0x4f49('0x41')]);_0x5f1538['attributes']=_['intersection'](_0x2adeec[_0x4f49('0x45')],qs['fields'](_0x513bc9[_0x4f49('0x41')][_0x4f49('0x47')]));_0x5f1538[_0x4f49('0x46')]=_0x5f1538[_0x4f49('0x46')][_0x4f49('0x55')]?_0x5f1538[_0x4f49('0x46')]:_0x2adeec['model'];_0x5f1538[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x513bc9[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x5f1538[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x513bc9['query'],_0x2adeec[_0x4f49('0x43')]));if(_0x513bc9[_0x4f49('0x41')][_0x4f49('0x2f')]){_0x5f1538[_0x4f49('0x4c')]=_[_0x4f49('0x4e')](_0x5f1538[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3c')](_0x5f1538[_0x4f49('0x46')],function(_0x2c4a96){var _0x35c5f6={};_0x35c5f6[_0x2c4a96]={'$like':'%'+_0x513bc9[_0x4f49('0x41')][_0x4f49('0x2f')]+'%'};return _0x35c5f6;})});}_0x5f1538=_['merge']({},_0x5f1538,_0x513bc9[_0x4f49('0x4f')]);return _0x3244a2[_0x4f49('0x6f')](_0x5f1538);}})['then'](function(_0x141f9a){if(_0x141f9a){_0x3de485=_0x141f9a[_0x4f49('0x55')];if(!_0x513bc9[_0x4f49('0x41')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x5f1538[_0x4f49('0x23')]=qs['limit'](_0x513bc9['query']['limit']);_0x5f1538['offset']=qs[_0x4f49('0x22')](_0x513bc9['query'][_0x4f49('0x22')]);}return _0x3244a2[_0x4f49('0x6f')](_0x5f1538);}})[_0x4f49('0x2b')](function(_0x3215e3){if(_0x3215e3){return _0x3215e3?{'count':_0x3de485,'rows':_0x3215e3}:null;}})[_0x4f49('0x2b')](respondWithResult(_0x937ce1,null))[_0x4f49('0x54')](handleError(_0x937ce1,null));};exports['addTeams']=function(_0x29c17d,_0x528a0d,_0x21009f){var _0x10dc90=_0x29c17d['body']['teams'];var _0x576612=_['map'](_0x10dc90,'id');return db[_0x4f49('0x70')][_0x4f49('0x52')]({'where':{'id':_0x576612},'attributes':['id'],'include':[{'model':db[_0x4f49('0x71')],'as':_0x4f49('0x72'),'attributes':['id',_0x4f49('0x3a'),'online',_0x4f49('0x73'),_0x4f49('0x74')],'raw':!![]}]})[_0x4f49('0x2b')](function(_0x17d7f8){if(_0x17d7f8){var _0x35666e=_[_0x4f49('0x75')](_0x17d7f8,function(_0x2e7a84){var _0x8fcb7d=_0x2e7a84[_0x4f49('0x2c')]({'plain':!![]});_0x8fcb7d[_0x4f49('0x72')][_0x4f49('0x76')](function(_0x258900){_0x258900[_0x4f49('0x77')]=_[_0x4f49('0x33')](_0x10dc90,{'id':_0x8fcb7d['id']})[_0x4f49('0x77')];});return _0x8fcb7d[_0x4f49('0x72')];});return db['VoiceQueue'][_0x4f49('0x33')]({'where':{'id':_0x29c17d[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](function(_0x191422){return db[_0x4f49('0x78')][_0x4f49('0x79')](function(_0x3589ea){return _0x191422[_0x4f49('0x7a')](_0x576612,{'transaction':_0x3589ea})[_0x4f49('0x2b')](function(){return BPromise[_0x4f49('0x7b')](_0x10dc90,function(_0x266dfa){return db[_0x4f49('0x7c')][_0x4f49('0x7d')]({'TeamId':_0x266dfa['id'],'VoiceQueueId':_0x29c17d[_0x4f49('0x5f')]['id'],'penalty':_0x266dfa[_0x4f49('0x77')]},{'transaction':_0x3589ea});});})[_0x4f49('0x2b')](function(){return BPromise[_0x4f49('0x7b')](_0x35666e,function(_0x2d2566){return db[_0x4f49('0x7e')][_0x4f49('0x7f')]({'where':{'UserId':_0x2d2566['id'],'VoiceQueueId':_0x29c17d['params']['id']},'defaults':{'penalty':_0x2d2566[_0x4f49('0x77')]},'transaction':_0x3589ea});});})[_0x4f49('0x2b')](function(){return BPromise['each'](_[_0x4f49('0x2f')](_0x35666e,{'online':!![]}),function(_0x34719b){return db[_0x4f49('0x80')][_0x4f49('0x7d')]({'membername':_0x34719b[_0x4f49('0x3a')],'UserId':_0x34719b['id'],'queue_name':_0x191422[_0x4f49('0x3a')],'VoiceQueueId':_0x191422['id'],'interface':_[_0x4f49('0x81')](_0x34719b[_0x4f49('0x74')])?util['format'](_0x4f49('0x82'),_0x34719b['name']):_0x34719b[_0x4f49('0x74')],'paused':_0x34719b[_0x4f49('0x73')]||![],'penalty':_0x34719b['penalty']},{'transaction':_0x3589ea});});})['then'](function(){_0x35666e[_0x4f49('0x76')](function(_0x2c0dd5){socket[_0x4f49('0x83')](_0x4f49('0x84'),{'UserId':_0x2c0dd5['id'],'VoiceQueueId':_0x191422['id']});});});});});}})[_0x4f49('0x2b')](respondWithStatusCode(_0x528a0d,null))['catch'](handleError(_0x528a0d,null));};exports['removeTeams']=function(_0x455535,_0x28a6c3,_0x121a8e){return db[_0x4f49('0x70')][_0x4f49('0x52')]({'where':{'id':_0x455535[_0x4f49('0x41')][_0x4f49('0x85')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4f49('0x2b')](handleEntityNotFound(_0x28a6c3,null))[_0x4f49('0x2b')](function(_0x3d4846){var _0x1ac43b=_[_0x4f49('0x3c')](_0x3d4846,'id');var _0x5d6899=[];var _0x1e3e79=[];var _0x210637=squel[_0x4f49('0x86')]();_0x210637[_0x4f49('0x87')](_0x4f49('0x88'))[_0x4f49('0x89')](_0x4f49('0x8a'),'tq')[_0x4f49('0x8b')](_0x4f49('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4f49('0x4c')]('VoiceQueueId\x20=\x20?',_0x455535['params']['id']);for(var _0x4811ab=0x0;_0x4811ab<_0x3d4846['length'];_0x4811ab+=0x1){let _0x4e1bff=_0x3d4846[_0x4811ab];for(var _0x505f60=0x0;_0x505f60<_0x4e1bff[_0x4f49('0x72')][_0x4f49('0x55')];_0x505f60+=0x1){let _0x329d4b=_0x4e1bff['Agents'][_0x505f60];var _0x4d2e41=_0x210637[_0x4f49('0x5e')]();_0x4d2e41['where'](_0x4f49('0x8d'),_0x329d4b['id']);_0x1e3e79[_0x4f49('0x8e')](db[_0x4f49('0x78')]['query'](_0x4d2e41[_0x4f49('0x8f')](),{'type':db[_0x4f49('0x78')][_0x4f49('0x90')][_0x4f49('0x91')]})[_0x4f49('0x2b')](function(_0x339928){if(_0x339928[_0x4f49('0x55')]===0x1){return _0x329d4b['id'];}else{var _0x17eb43=_[_0x4f49('0x92')](_[_0x4f49('0x3c')](_0x339928,_0x4f49('0x93')),function(_0x20d696){return _['includes'](_0x1ac43b,_0x20d696);});if(_0x17eb43){return _0x329d4b['id'];}}}));}}return BPromise[_0x4f49('0x94')](_0x1e3e79)[_0x4f49('0x2b')](function(_0x5330fc){_0x5d6899=_(_0x5d6899)['union'](_0x5330fc)[_0x4f49('0x95')]()[_0x4f49('0x31')]();return db[_0x4f49('0x3d')][_0x4f49('0x33')]({'where':{'id':_0x455535[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](function(_0x41eb1f){return db[_0x4f49('0x78')][_0x4f49('0x79')](function(_0x53de39){return _0x41eb1f['removeTeams'](_0x455535[_0x4f49('0x41')][_0x4f49('0x85')],{'transaction':_0x53de39})[_0x4f49('0x2b')](function(){if(!_[_0x4f49('0x96')](_0x5d6899)){return _0x41eb1f['removeAgents'](_0x5d6899,{'transaction':_0x53de39})[_0x4f49('0x2b')](function(){return db['UserVoiceQueueRt'][_0x4f49('0x36')]({'where':{'VoiceQueueId':_0x455535['params']['id'],'UserId':_0x5d6899},'transaction':_0x53de39});});}})[_0x4f49('0x2b')](function(){_0x5d6899['forEach'](function(_0x29bdf3){socket[_0x4f49('0x83')](_0x4f49('0x97'),{'UserId':_0x29bdf3,'VoiceQueueId':_0x41eb1f['id']});});});});});});})[_0x4f49('0x2b')](respondWithStatusCode(_0x28a6c3,null))[_0x4f49('0x54')](handleError(_0x28a6c3,null));};exports['addAgents']=function(_0x24a109,_0x3c378b,_0x541ca5){var _0x50b15f,_0x1fb8cc;return db[_0x4f49('0x3d')][_0x4f49('0x33')]({'where':{'id':_0x24a109[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x3c378b,null))[_0x4f49('0x2b')](function(_0x1fc581){if(_0x1fc581){_0x1fb8cc=_0x1fc581;return _0x1fc581[_0x4f49('0x98')](_0x24a109['body'][_0x4f49('0x85')],_[_0x4f49('0x60')](_0x24a109['body'],['ids','id'])||{})[_0x4f49('0x99')](function(_0x4d42bc){for(var _0x57e532=0x0;_0x57e532<_0x24a109[_0x4f49('0x63')][_0x4f49('0x85')][_0x4f49('0x55')];_0x57e532+=0x1){socket[_0x4f49('0x83')](_0x4f49('0x84'),{'UserId':Number(_0x24a109[_0x4f49('0x63')][_0x4f49('0x85')][_0x57e532]),'VoiceQueueId':Number(_0x24a109[_0x4f49('0x5f')]['id'])});}return _0x4d42bc;});}})['then'](function(_0x3e9be3){_0x50b15f=_0x3e9be3||[];if(_0x1fb8cc){return db['User'][_0x4f49('0x52')]({'where':{'id':_0x24a109['body']['ids']},'attributes':['id','name',_0x4f49('0x9a'),'voicePause',_0x4f49('0x74')],'raw':!![]});}})['then'](function(_0x5273f8){if(!_['isEmpty'](_0x5273f8)){var _0x399133=[];for(var _0x5e7c68=0x0;_0x5e7c68<_0x5273f8[_0x4f49('0x55')];_0x5e7c68++){if(_0x5273f8[_0x5e7c68][_0x4f49('0x9a')]){_0x399133[_0x4f49('0x8e')](db['UserVoiceQueueRt'][_0x4f49('0x7d')]({'membername':_0x5273f8[_0x5e7c68]['name'],'UserId':_0x5273f8[_0x5e7c68]['id'],'queue_name':_0x1fb8cc[_0x4f49('0x3a')],'VoiceQueueId':_0x1fb8cc['id'],'interface':_['isNil'](_0x5273f8[_0x5e7c68][_0x4f49('0x74')])?util[_0x4f49('0x9b')](_0x4f49('0x82'),_0x5273f8[_0x5e7c68][_0x4f49('0x3a')]):_0x5273f8[_0x5e7c68][_0x4f49('0x74')],'paused':_0x5273f8[_0x5e7c68][_0x4f49('0x73')]||![],'penalty':_0x24a109[_0x4f49('0x63')][_0x4f49('0x77')]||0x0}));}}return BPromise[_0x4f49('0x94')](_0x399133);}})['then'](function(){return _0x50b15f;})[_0x4f49('0x2b')](respondWithResult(_0x3c378b,null))[_0x4f49('0x54')](handleError(_0x3c378b,null));};exports['removeAgents']=function(_0x4c788d,_0x2ec08b,_0x182851){return db[_0x4f49('0x3d')][_0x4f49('0x33')]({'where':{'id':_0x4c788d['params']['id']}})['then'](handleEntityNotFound(_0x2ec08b,null))['then'](function(_0x507c32){if(_0x507c32){return _0x507c32[_0x4f49('0x9c')](_0x4c788d[_0x4f49('0x41')]['ids'])[_0x4f49('0x2b')](function(){if(_[_0x4f49('0x9d')](_0x4c788d[_0x4f49('0x41')][_0x4f49('0x85')])){for(var _0x49b694=0x0;_0x49b694<_0x4c788d[_0x4f49('0x41')][_0x4f49('0x85')][_0x4f49('0x55')];_0x49b694+=0x1){socket['emit'](_0x4f49('0x97'),{'UserId':Number(_0x4c788d['query']['ids'][_0x49b694]),'VoiceQueueId':Number(_0x4c788d[_0x4f49('0x5f')]['id'])});}}else{socket[_0x4f49('0x83')](_0x4f49('0x97'),{'UserId':Number(_0x4c788d[_0x4f49('0x41')][_0x4f49('0x85')]),'VoiceQueueId':Number(_0x4c788d[_0x4f49('0x5f')]['id'])});}});}})[_0x4f49('0x2b')](function(_0xc77c28){return db['UserVoiceQueueRt'][_0x4f49('0x36')]({'where':{'VoiceQueueId':_0x4c788d[_0x4f49('0x5f')]['id'],'UserId':_0x4c788d[_0x4f49('0x41')][_0x4f49('0x85')]}})[_0x4f49('0x2b')](function(){return _0xc77c28;});})['then'](respondWithStatusCode(_0x2ec08b,null))[_0x4f49('0x54')](handleError(_0x2ec08b,null));};exports[_0x4f49('0x9e')]=function(_0x262e48,_0x2c72f7,_0x2a35e4){var _0xd8e45e={};var _0x9a949b={};var _0x9391db;var _0x55652e;return db[_0x4f49('0x3d')][_0x4f49('0x66')]({'where':{'id':_0x262e48[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x2c72f7,null))[_0x4f49('0x2b')](function(_0x202f13){if(_0x202f13){_0x9391db=_0x202f13;_0x9a949b[_0x4f49('0x45')]=_['keys'](db['User']['rawAttributes']);_0x9a949b[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x262e48['query']);_0x9a949b[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x9a949b[_0x4f49('0x45')],_0x9a949b['query']);_0xd8e45e['attributes']=_[_0x4f49('0x44')](_0x9a949b['model'],qs['fields'](_0x262e48[_0x4f49('0x41')][_0x4f49('0x47')]));_0xd8e45e['attributes']=_0xd8e45e[_0x4f49('0x46')][_0x4f49('0x55')]?_0xd8e45e[_0x4f49('0x46')]:_0x9a949b[_0x4f49('0x45')];_0xd8e45e['order']=qs[_0x4f49('0x4b')](_0x262e48[_0x4f49('0x41')]['sort']);_0xd8e45e[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_['pick'](_0x262e48[_0x4f49('0x41')],_0x9a949b[_0x4f49('0x43')]));if(_0x262e48[_0x4f49('0x41')][_0x4f49('0x2f')]){_0xd8e45e['where']=_[_0x4f49('0x4e')](_0xd8e45e['where'],{'$or':_[_0x4f49('0x3c')](_0xd8e45e[_0x4f49('0x46')],function(_0x59f33d){var _0x1b6d6e={};_0x1b6d6e[_0x59f33d]={'$like':'%'+_0x262e48[_0x4f49('0x41')][_0x4f49('0x2f')]+'%'};return _0x1b6d6e;})});}_0xd8e45e=_[_0x4f49('0x4e')]({},_0xd8e45e,_0x262e48[_0x4f49('0x4f')]);return _0x9391db[_0x4f49('0x9e')](_0xd8e45e);}})[_0x4f49('0x2b')](function(_0x5b0d96){if(_0x5b0d96){_0x55652e=_0x5b0d96[_0x4f49('0x55')];if(!_0x262e48[_0x4f49('0x41')][_0x4f49('0x48')](_0x4f49('0x49'))){_0xd8e45e[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x262e48[_0x4f49('0x41')]['limit']);_0xd8e45e[_0x4f49('0x22')]=qs[_0x4f49('0x22')](_0x262e48[_0x4f49('0x41')][_0x4f49('0x22')]);}return _0x9391db['getAgents'](_0xd8e45e);}})[_0x4f49('0x2b')](function(_0x34a410){if(_0x34a410){return _0x34a410?{'count':_0x55652e,'rows':_0x34a410}:null;}})['then'](respondWithResult(_0x2c72f7,null))[_0x4f49('0x54')](handleError(_0x2c72f7,null));};exports[_0x4f49('0x9f')]=function(_0x51b65d,_0x1fd454,_0x51bbc1){var _0x110d4f={};var _0x59321e={};var _0xa43b94;var _0x155d43;return db[_0x4f49('0x3d')]['findOne']({'where':{'id':_0x51b65d[_0x4f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1fd454,null))[_0x4f49('0x2b')](function(_0x53acc9){if(_0x53acc9){_0xa43b94=_0x53acc9;_0x59321e[_0x4f49('0x45')]=_[_0x4f49('0x42')](db['UserVoiceQueueRt'][_0x4f49('0x3e')]);_0x59321e[_0x4f49('0x41')]=_['keys'](_0x51b65d['query']);_0x59321e[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x59321e[_0x4f49('0x45')],_0x59321e[_0x4f49('0x41')]);_0x110d4f['attributes']=_[_0x4f49('0x44')](_0x59321e[_0x4f49('0x45')],qs['fields'](_0x51b65d[_0x4f49('0x41')][_0x4f49('0x47')]));_0x110d4f[_0x4f49('0x46')]=_0x110d4f[_0x4f49('0x46')][_0x4f49('0x55')]?_0x110d4f[_0x4f49('0x46')]:_0x59321e['model'];_0x110d4f[_0x4f49('0x4a')]=qs['sort'](_0x51b65d[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x110d4f[_0x4f49('0x4c')]=qs['filters'](_[_0x4f49('0x4d')](_0x51b65d[_0x4f49('0x41')],_0x59321e['filters']));if(_0x51b65d[_0x4f49('0x41')][_0x4f49('0x2f')]){_0x110d4f[_0x4f49('0x4c')]=_['merge'](_0x110d4f['where'],{'$or':_[_0x4f49('0x3c')](_0x110d4f[_0x4f49('0x46')],function(_0x5393fe){var _0x2f69c1={};_0x2f69c1[_0x5393fe]={'$like':'%'+_0x51b65d[_0x4f49('0x41')][_0x4f49('0x2f')]+'%'};return _0x2f69c1;})});}_0x110d4f=_[_0x4f49('0x4e')]({},_0x110d4f,_0x51b65d[_0x4f49('0x4f')]);return _0xa43b94[_0x4f49('0x9f')](_0x110d4f);}})['then'](function(_0x53085c){if(_0x53085c){_0x155d43=_0x53085c[_0x4f49('0x55')];if(!_0x51b65d['query'][_0x4f49('0x48')](_0x4f49('0x49'))){_0x110d4f['limit']=qs[_0x4f49('0x23')](_0x51b65d[_0x4f49('0x41')]['limit']);_0x110d4f[_0x4f49('0x22')]=qs[_0x4f49('0x22')](_0x51b65d[_0x4f49('0x41')][_0x4f49('0x22')]);}return _0xa43b94['getMembers'](_0x110d4f);}})['then'](function(_0x33b318){return _0x33b318?{'count':_0x155d43,'rows':_0x33b318}:null;})['then'](respondWithResult(_0x1fd454,null))[_0x4f49('0x54')](handleError(_0x1fd454,null));};exports[_0x4f49('0xa0')]=function(_0x5c0d18,_0x38bc04,_0xf9de4c){var _0x34cd2f={};var _0x2eb2e6={};var _0x129967;var _0x1c3f48;return db[_0x4f49('0x3d')]['findOne']({'where':{'id':_0x5c0d18['params']['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x38bc04,null))[_0x4f49('0x2b')](function(_0x294066){if(_0x294066){_0x129967=_0x294066;_0x2eb2e6[_0x4f49('0x45')]=_[_0x4f49('0x42')](db['CmList']['rawAttributes']);_0x2eb2e6[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x5c0d18[_0x4f49('0x41')]);_0x2eb2e6['filters']=_[_0x4f49('0x44')](_0x2eb2e6[_0x4f49('0x45')],_0x2eb2e6[_0x4f49('0x41')]);_0x34cd2f['attributes']=_[_0x4f49('0x44')](_0x2eb2e6[_0x4f49('0x45')],qs[_0x4f49('0x47')](_0x5c0d18[_0x4f49('0x41')][_0x4f49('0x47')]));_0x34cd2f[_0x4f49('0x46')]=_0x34cd2f['attributes'][_0x4f49('0x55')]?_0x34cd2f[_0x4f49('0x46')]:_0x2eb2e6[_0x4f49('0x45')];_0x34cd2f['order']=qs[_0x4f49('0x4b')](_0x5c0d18[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x34cd2f[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x5c0d18[_0x4f49('0x41')],_0x2eb2e6[_0x4f49('0x43')]));if(_0x5c0d18['query']['filter']){_0x34cd2f[_0x4f49('0x4c')]=_[_0x4f49('0x4e')](_0x34cd2f[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3c')](_0x34cd2f[_0x4f49('0x46')],function(_0x2a452b){var _0x1befc5={};_0x1befc5[_0x2a452b]={'$like':'%'+_0x5c0d18[_0x4f49('0x41')]['filter']+'%'};return _0x1befc5;})});}_0x34cd2f=_['merge']({},_0x34cd2f,_0x5c0d18[_0x4f49('0x4f')]);return _0x129967[_0x4f49('0xa0')](_0x34cd2f);}})['then'](function(_0x180155){if(_0x180155){_0x1c3f48=_0x180155[_0x4f49('0x55')];if(!_0x5c0d18[_0x4f49('0x41')][_0x4f49('0x48')]('nolimit')){_0x34cd2f[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x5c0d18['query']['limit']);_0x34cd2f[_0x4f49('0x22')]=qs[_0x4f49('0x22')](_0x5c0d18[_0x4f49('0x41')][_0x4f49('0x22')]);}return _0x129967[_0x4f49('0xa0')](_0x34cd2f);}})[_0x4f49('0x2b')](function(_0x5ba9e1){if(_0x5ba9e1){return _0x5ba9e1?{'count':_0x1c3f48,'rows':_0x5ba9e1}:null;}})[_0x4f49('0x2b')](respondWithResult(_0x38bc04,null))[_0x4f49('0x54')](handleError(_0x38bc04,null));};exports[_0x4f49('0xa1')]=function(_0x3cd4f4,_0x466c17,_0x13595f){var _0x355706=moment()[_0x4f49('0x9b')]('YYYY-MM-DD\x20HH:mm:ss');var _0xe83291,_0x5531ab;return db[_0x4f49('0x3d')]['find']({'where':{'id':_0x3cd4f4['params']['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x466c17,null))[_0x4f49('0x2b')](function(_0x2f9aac){if(_0x2f9aac){_0x5531ab=_0x2f9aac;return _0x2f9aac['addLists'](_0x3cd4f4[_0x4f49('0x63')][_0x4f49('0x85')],_['omit'](_0x3cd4f4['body'],[_0x4f49('0x85'),'id'])||{});}return null;})['spread'](function(_0x31806f){var _0x52ab86;_0xe83291=_0x31806f||[];var _0x301708=[];if(_0x31806f){for(var _0x2e5a53=0x0;_0x2e5a53<_0x31806f[_0x4f49('0x55')];_0x2e5a53+=0x1){var _0x1535b2=_0x31806f[_0x2e5a53]['get']({'plain':!![]});_0x5531ab['dialCheckDuplicateType']=_0x3cd4f4[_0x4f49('0x63')][_0x4f49('0xa2')]?_0x3cd4f4[_0x4f49('0x63')][_0x4f49('0xa2')]:_0x5531ab[_0x4f49('0xa2')];switch(_0x5531ab[_0x4f49('0xa2')]){case _0x4f49('0xa3'):_0x52ab86=squel[_0x4f49('0xa4')]()[_0x4f49('0xa5')](_0x4f49('0xa6'))[_0x4f49('0xa7')]([_0x4f49('0xa8'),'scheduledAt',_0x4f49('0xa9'),_0x4f49('0xaa'),_0x4f49('0x68'),_0x4f49('0x61'),'updatedAt'],squel[_0x4f49('0x86')]()[_0x4f49('0x87')](_0x4f49('0xa8'),_0x4f49('0xa8'))[_0x4f49('0x87')]('\x27'+_0x355706+'\x27',_0x4f49('0xab'))['field']('id',_0x4f49('0xa9'))[_0x4f49('0x87')](_0x1535b2[_0x4f49('0xac')]['toString'](),_0x4f49('0xaa'))['field'](_0x3cd4f4[_0x4f49('0x5f')]['id']['toString'](),_0x4f49('0x68'))['field']('\x27'+_0x355706+'\x27',_0x4f49('0x61'))[_0x4f49('0x87')]('\x27'+_0x355706+'\x27','updatedAt')[_0x4f49('0x89')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x4f49('0x4c')]('ListId\x20=\x20?',_0x1535b2[_0x4f49('0xac')][_0x4f49('0x8f')]())[_0x4f49('0x4c')](_0x4f49('0xad'))[_0x4f49('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4f49('0x86')]()[_0x4f49('0x87')]('COALESCE(calleridnum,\x27\x27)')[_0x4f49('0x89')](_0x4f49('0xae'))[_0x4f49('0x4c')](_0x4f49('0xaf'),_0x3cd4f4['params']['id'][_0x4f49('0x8f')]()))[_0x4f49('0x4c')](_0x4f49('0xb0'),squel['select']()[_0x4f49('0x87')](_0x4f49('0xb1'))[_0x4f49('0x89')](_0x4f49('0xa6'))[_0x4f49('0x4c')](_0x4f49('0xaf'),_0x3cd4f4[_0x4f49('0x5f')]['id']['toString']())))[_0x4f49('0x8f')]();break;case _0x4f49('0xb2'):_0x52ab86=squel['insert']()[_0x4f49('0xa5')](_0x4f49('0xa6'))[_0x4f49('0xa7')]([_0x4f49('0xa8'),_0x4f49('0xab'),_0x4f49('0xa9'),'ListId','VoiceQueueId',_0x4f49('0x61'),_0x4f49('0x62')],squel[_0x4f49('0x86')]()[_0x4f49('0x87')]('phone',_0x4f49('0xa8'))[_0x4f49('0x87')]('\x27'+_0x355706+'\x27','scheduledAt')[_0x4f49('0x87')]('id','ContactId')['field'](_0x1535b2['CmListId']['toString'](),'ListId')[_0x4f49('0x87')](_0x3cd4f4[_0x4f49('0x5f')]['id'][_0x4f49('0x8f')](),'VoiceQueueId')[_0x4f49('0x87')]('\x27'+_0x355706+'\x27',_0x4f49('0x61'))[_0x4f49('0x87')]('\x27'+_0x355706+'\x27',_0x4f49('0x62'))['from'](_0x4f49('0xb3'))['where'](_0x4f49('0xb4'))[_0x4f49('0x4c')](_0x4f49('0xb5'),_0x1535b2[_0x4f49('0xac')][_0x4f49('0x8f')]())[_0x4f49('0x4c')](_0x4f49('0xad'))[_0x4f49('0x4c')](_0x4f49('0xb0'),squel[_0x4f49('0x86')]()[_0x4f49('0x87')](_0x4f49('0xb1'))[_0x4f49('0x89')](_0x4f49('0xa6'))['where'](_0x4f49('0xaf'),_0x3cd4f4[_0x4f49('0x5f')]['id']['toString']())))['toString']();break;default:_0x52ab86=squel[_0x4f49('0xa4')]()[_0x4f49('0xa5')](_0x4f49('0xa6'))['fromQuery']([_0x4f49('0xa8'),_0x4f49('0xab'),_0x4f49('0xa9'),_0x4f49('0xaa'),_0x4f49('0x68'),_0x4f49('0x61'),_0x4f49('0x62')],squel['select']()[_0x4f49('0x87')](_0x4f49('0xa8'),_0x4f49('0xa8'))['field']('\x27'+_0x355706+'\x27',_0x4f49('0xab'))[_0x4f49('0x87')]('id',_0x4f49('0xa9'))[_0x4f49('0x87')](_0x1535b2['CmListId'][_0x4f49('0x8f')](),_0x4f49('0xaa'))[_0x4f49('0x87')](_0x3cd4f4[_0x4f49('0x5f')]['id']['toString'](),'VoiceQueueId')[_0x4f49('0x87')]('\x27'+_0x355706+'\x27',_0x4f49('0x61'))['field']('\x27'+_0x355706+'\x27',_0x4f49('0x62'))[_0x4f49('0x89')]('cm_contacts')[_0x4f49('0x4c')](_0x4f49('0xb4'))[_0x4f49('0x4c')](_0x4f49('0xb5'),_0x1535b2[_0x4f49('0xac')][_0x4f49('0x8f')]())[_0x4f49('0x4c')](_0x4f49('0xad')))[_0x4f49('0x8f')]();}_0x301708['push'](db[_0x4f49('0x78')][_0x4f49('0x41')](_0x52ab86));}return BPromise['all'](_0x301708);}})['then'](function(){var _0x50f9fb=[];var _0x58e59f=squel[_0x4f49('0xa4')]()['into'](_0x4f49('0xb6'))['fromQuery'](['CmHopperId','phone',_0x4f49('0xb7'),'createdAt',_0x4f49('0x62')],squel[_0x4f49('0x86')]()[_0x4f49('0x87')](_0x4f49('0xb8'))[_0x4f49('0x87')](_0x4f49('0xb9'))[_0x4f49('0x87')](_0x4f49('0xba'))[_0x4f49('0x87')]('\x27'+_0x355706+'\x27',_0x4f49('0x61'))['field']('\x27'+_0x355706+'\x27',_0x4f49('0x62'))[_0x4f49('0x89')](_0x4f49('0xbb'),'ci')[_0x4f49('0x8b')](_0x4f49('0xa6'),'h',_0x4f49('0xbc'))['where'](_0x4f49('0xbd'),_0x355706)[_0x4f49('0x4c')](_0x4f49('0xbe'),_0x4f49('0xbf')))[_0x4f49('0x8f')]();_0x50f9fb[_0x4f49('0x8e')](db['sequelize']['query'](_0x58e59f));return BPromise[_0x4f49('0x94')](_0x50f9fb);})['then'](function(){return _0xe83291;})[_0x4f49('0x2b')](respondWithResult(_0x466c17,null))[_0x4f49('0x54')](handleError(_0x466c17,null));};exports[_0x4f49('0xc0')]=function(_0x129a4e,_0x7662a8,_0xff744e){return db['VoiceQueue'][_0x4f49('0x33')]({'where':{'id':_0x129a4e[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x7662a8,null))[_0x4f49('0x2b')](function(_0x412fb7){if(_0x412fb7){return _0x412fb7[_0x4f49('0xc0')](_0x129a4e[_0x4f49('0x41')][_0x4f49('0x85')]);}})[_0x4f49('0x2b')](function(_0x1a958f){if(_0x1a958f){return db['CmHopper'][_0x4f49('0x36')]({'where':{'ListId':_0x129a4e[_0x4f49('0x41')][_0x4f49('0x85')],'VoiceQueueId':_0x129a4e[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](function(){return _0x1a958f;});}})[_0x4f49('0x2b')](respondWithStatusCode(_0x7662a8,null))[_0x4f49('0x54')](handleError(_0x7662a8,null));};exports[_0x4f49('0xc1')]=function(_0x506f63,_0x185d17,_0x45b047){var _0x5e9226={};var _0x4433dd={};var _0x326af9;var _0x23e8ed;return db[_0x4f49('0x3d')][_0x4f49('0x66')]({'where':{'id':_0x506f63[_0x4f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x185d17,null))[_0x4f49('0x2b')](function(_0x10938f){if(_0x10938f){_0x326af9=_0x10938f;_0x4433dd[_0x4f49('0x45')]=_[_0x4f49('0x42')](db['CmList'][_0x4f49('0x3e')]);_0x4433dd['query']=_[_0x4f49('0x42')](_0x506f63[_0x4f49('0x41')]);_0x4433dd[_0x4f49('0x43')]=_[_0x4f49('0x44')](_0x4433dd[_0x4f49('0x45')],_0x4433dd[_0x4f49('0x41')]);_0x5e9226[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x4433dd['model'],qs[_0x4f49('0x47')](_0x506f63[_0x4f49('0x41')][_0x4f49('0x47')]));_0x5e9226[_0x4f49('0x46')]=_0x5e9226['attributes']['length']?_0x5e9226[_0x4f49('0x46')]:_0x4433dd[_0x4f49('0x45')];_0x5e9226[_0x4f49('0x4a')]=qs['sort'](_0x506f63[_0x4f49('0x41')][_0x4f49('0x4b')]);_0x5e9226[_0x4f49('0x4c')]=qs[_0x4f49('0x43')](_[_0x4f49('0x4d')](_0x506f63[_0x4f49('0x41')],_0x4433dd[_0x4f49('0x43')]));if(_0x506f63[_0x4f49('0x41')][_0x4f49('0x2f')]){_0x5e9226['where']=_['merge'](_0x5e9226['where'],{'$or':_['map'](_0x5e9226[_0x4f49('0x46')],function(_0x211f9b){var _0x487c37={};_0x487c37[_0x211f9b]={'$like':'%'+_0x506f63['query']['filter']+'%'};return _0x487c37;})});}_0x5e9226=_[_0x4f49('0x4e')]({},_0x5e9226,_0x506f63[_0x4f49('0x4f')]);return _0x326af9[_0x4f49('0xc1')](_0x5e9226);}})[_0x4f49('0x2b')](function(_0x13eeaa){if(_0x13eeaa){_0x23e8ed=_0x13eeaa[_0x4f49('0x55')];if(!_0x506f63['query'][_0x4f49('0x48')](_0x4f49('0x49'))){_0x5e9226[_0x4f49('0x23')]=qs[_0x4f49('0x23')](_0x506f63['query'][_0x4f49('0x23')]);_0x5e9226['offset']=qs[_0x4f49('0x22')](_0x506f63[_0x4f49('0x41')]['offset']);}return _0x326af9['getBlackLists'](_0x5e9226);}})['then'](function(_0x4adab1){if(_0x4adab1){return _0x4adab1?{'count':_0x23e8ed,'rows':_0x4adab1}:null;}})[_0x4f49('0x2b')](respondWithResult(_0x185d17,null))[_0x4f49('0x54')](handleError(_0x185d17,null));};exports[_0x4f49('0xc2')]=function(_0x4f7254,_0x1f319d,_0x5a2a1c){var _0x49ab7e,_0x364c0e;return db[_0x4f49('0x3d')]['find']({'where':{'id':_0x4f7254['params']['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x1f319d,null))[_0x4f49('0x2b')](function(_0x166635){if(_0x166635){_0x364c0e=_0x166635;return _0x166635['addBlackLists'](_0x4f7254[_0x4f49('0x63')][_0x4f49('0x85')],_[_0x4f49('0x60')](_0x4f7254[_0x4f49('0x63')],[_0x4f49('0x85'),'id'])||{});}return null;})[_0x4f49('0x99')](function(_0x32a96e){var _0x2c52b2;_0x49ab7e=_0x32a96e||[];var _0x5f1417=[];if(_0x32a96e){for(var _0x5791b6=0x0;_0x5791b6<_0x32a96e[_0x4f49('0x55')];_0x5791b6+=0x1){var _0x3529d6=_0x32a96e[_0x5791b6][_0x4f49('0x2c')]({'plain':!![]});_0x2c52b2=squel[_0x4f49('0xa4')]()[_0x4f49('0xa5')]('cm_hopper_black')['fromQuery']([_0x4f49('0xa8'),_0x4f49('0xa9'),_0x4f49('0xaa'),_0x4f49('0x68'),'createdAt',_0x4f49('0x62')],squel[_0x4f49('0x86')]()[_0x4f49('0x87')](_0x4f49('0xa8'),'phone')[_0x4f49('0x87')]('id',_0x4f49('0xa9'))['field'](_0x3529d6['CmListId'][_0x4f49('0x8f')](),_0x4f49('0xaa'))[_0x4f49('0x87')](_0x4f7254['params']['id'][_0x4f49('0x8f')](),_0x4f49('0x68'))[_0x4f49('0x87')]('NOW()',_0x4f49('0x61'))[_0x4f49('0x87')]('NOW()','updatedAt')['from'](_0x4f49('0xb3'))['where'](_0x4f49('0xb4'))[_0x4f49('0x4c')]('ListId\x20=\x20?',_0x3529d6[_0x4f49('0xac')][_0x4f49('0x8f')]())[_0x4f49('0x4c')](_0x4f49('0xad')))[_0x4f49('0x8f')]();_0x5f1417[_0x4f49('0x8e')](db['sequelize'][_0x4f49('0x41')](_0x2c52b2));}return BPromise[_0x4f49('0x94')](_0x5f1417);}})['then'](function(){return _0x49ab7e;})[_0x4f49('0x2b')](respondWithResult(_0x1f319d,null))[_0x4f49('0x54')](handleError(_0x1f319d,null));};exports[_0x4f49('0xc3')]=function(_0xfd9181,_0x3efdf6,_0x55e09d){return db[_0x4f49('0x3d')][_0x4f49('0x33')]({'where':{'id':_0xfd9181[_0x4f49('0x5f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x3efdf6,null))['then'](function(_0x383521){if(_0x383521){return _0x383521[_0x4f49('0xc3')](_0xfd9181[_0x4f49('0x41')][_0x4f49('0x85')]);}})[_0x4f49('0x2b')](function(_0x17e055){if(_0x17e055){return db[_0x4f49('0x6e')]['destroy']({'where':{'ListId':_0xfd9181[_0x4f49('0x41')]['ids'],'VoiceQueueId':_0xfd9181[_0x4f49('0x5f')]['id']}})['then'](function(){return _0x17e055;});}})['then'](respondWithStatusCode(_0x3efdf6,null))[_0x4f49('0x54')](handleError(_0x3efdf6,null));};
\ No newline at end of file
index 278afd9..259c436 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86a2=['VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x86a2,0x16f));var _0x286a=function(_0x99c991,_0x439ce7){_0x99c991=_0x99c991-0x0;var _0x3e2061=_0x86a2[_0x99c991];return _0x3e2061;};'use strict';var EventEmitter=require(_0x286a('0x0'));var VoiceQueue=require(_0x286a('0x1'))['db'][_0x286a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x286a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x286a('0x4'),'afterDestroy':_0x286a('0x5')};function emitEvent(_0x290d2d){return function(_0x261847,_0x35adc7,_0x379161){VoiceQueueEvents[_0x286a('0x6')](_0x290d2d+':'+_0x261847['id'],_0x261847);VoiceQueueEvents['emit'](_0x290d2d,_0x261847);_0x379161(null);};}for(var e in events){if(events[_0x286a('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x286a('0x8')]=VoiceQueueEvents;
\ No newline at end of file
+var _0x7121=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','VoiceQueue'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7121,0x85));var _0x1712=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7121[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require(_0x1712('0x0'));var VoiceQueue=require(_0x1712('0x1'))['db'][_0x1712('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1712('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1712('0x4'),'afterDestroy':_0x1712('0x5')};function emitEvent(_0x1e54e9){return function(_0x3f2e3e,_0x3e84fd,_0x56ec5e){VoiceQueueEvents[_0x1712('0x6')](_0x1e54e9+':'+_0x3f2e3e['id'],_0x3f2e3e);VoiceQueueEvents[_0x1712('0x6')](_0x1e54e9,_0x3f2e3e);_0x56ec5e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x1712('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents;
\ No newline at end of file
index 212b322..e2b97ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3cf109,_0xca5ff4){var _0x595942=function(_0x19cfa0){while(--_0x19cfa0){_0x3cf109['push'](_0x3cf109['shift']());}};_0x595942(++_0xca5ff4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x55201c,_0x3308b7){var _0x34949b=function(_0x5ce877){while(--_0x5ce877){_0x55201c['push'](_0x55201c['shift']());}};_0x34949b(++_0x3308b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7e1780c..ef04966 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5675=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','where','lodash'];(function(_0x150b05,_0xb6daed){var _0x14cb1d=function(_0x5bd4d8){while(--_0x5bd4d8){_0x150b05['push'](_0x150b05['shift']());}};_0x14cb1d(++_0xb6daed);}(_0x5675,0xf5));var _0x5567=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5675[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x5567('0x0'));var util=require('util');var moment=require(_0x5567('0x1'));var BPromise=require(_0x5567('0x2'));var rs=require(_0x5567('0x3'));var fs=require('fs');var Redis=require(_0x5567('0x4'));var db=require(_0x5567('0x5'))['db'];var utils=require(_0x5567('0x6'));var logger=require(_0x5567('0x7'))(_0x5567('0x8'));var config=require(_0x5567('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5567('0xa')][_0x5567('0xb')]({'port':0x232a});config[_0x5567('0xc')]=_[_0x5567('0xd')](config[_0x5567('0xc')],{'host':_0x5567('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5567('0xc')]));require(_0x5567('0xf'))[_0x5567('0x10')](socket);function respondWithRpcPromise(_0x10d326,_0x2d699d,_0x2ba718){return new BPromise(function(_0x17d5da,_0x3af75f){return client[_0x5567('0x11')](_0x10d326,_0x2ba718)[_0x5567('0x12')](function(_0x57e629){logger[_0x5567('0x13')](_0x5567('0x14'),_0x2d699d,_0x5567('0x15'));logger[_0x5567('0x16')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2d699d,'request\x20sent',JSON[_0x5567('0x17')](_0x57e629));if(_0x57e629[_0x5567('0x18')]){if(_0x57e629[_0x5567('0x18')][_0x5567('0x19')]===0x1f4){logger[_0x5567('0x18')](_0x5567('0x14'),_0x2d699d,_0x57e629['error'][_0x5567('0x1a')]);return _0x3af75f(_0x57e629['error']['message']);}logger[_0x5567('0x18')](_0x5567('0x14'),_0x2d699d,_0x57e629[_0x5567('0x18')][_0x5567('0x1a')]);return _0x17d5da(_0x57e629[_0x5567('0x18')]['message']);}else{logger[_0x5567('0x13')](_0x5567('0x14'),_0x2d699d,_0x5567('0x15'));_0x17d5da(_0x57e629[_0x5567('0x1b')][_0x5567('0x1a')]);}})[_0x5567('0x1c')](function(_0x55074e){logger[_0x5567('0x18')](_0x5567('0x14'),_0x2d699d,_0x55074e);_0x3af75f(_0x55074e);});});}exports[_0x5567('0x1d')]=function(_0x45573e){var _0x4bb14e=this;return new Promise(function(_0x2027bc,_0x55cfc7){return db[_0x5567('0x1e')][_0x5567('0x1f')]({'raw':_0x45573e[_0x5567('0x20')]?_0x45573e[_0x5567('0x20')][_0x5567('0x21')]===undefined?!![]:![]:!![],'where':_0x45573e['options']?_0x45573e['options']['where']||null:null,'attributes':_0x45573e['options']?_0x45573e['options'][_0x5567('0x22')]||null:null,'limit':_0x45573e[_0x5567('0x20')]?_0x45573e[_0x5567('0x20')][_0x5567('0x23')]||null:null,'include':_0x45573e[_0x5567('0x20')]?_0x45573e[_0x5567('0x20')][_0x5567('0x24')]?_[_0x5567('0x25')](_0x45573e[_0x5567('0x20')][_0x5567('0x24')],function(_0x2a72a8){return{'model':db[_0x2a72a8[_0x5567('0x26')]],'as':_0x2a72a8['as'],'attributes':_0x2a72a8[_0x5567('0x22')],'include':_0x2a72a8[_0x5567('0x24')]?_[_0x5567('0x25')](_0x2a72a8[_0x5567('0x24')],function(_0x53aa9a){return{'model':db[_0x53aa9a['model']],'as':_0x53aa9a['as'],'attributes':_0x53aa9a[_0x5567('0x22')],'include':_0x53aa9a[_0x5567('0x24')]?_[_0x5567('0x25')](_0x53aa9a['include'],function(_0x3110aa){return{'model':db[_0x3110aa[_0x5567('0x26')]],'as':_0x3110aa['as'],'attributes':_0x3110aa[_0x5567('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50b94a){logger[_0x5567('0x13')](_0x5567('0x1d'),_0x45573e);logger[_0x5567('0x16')](_0x5567('0x1d'),_0x45573e,JSON['stringify'](_0x50b94a));_0x2027bc(_0x50b94a);})[_0x5567('0x1c')](function(_0x4bdc1a){logger['error']('GetVoiceQueue',_0x4bdc1a[_0x5567('0x1a')],_0x45573e);_0x55cfc7(_0x4bb14e['error'](0x1f4,_0x4bdc1a[_0x5567('0x1a')]));});});};exports[_0x5567('0x27')]=function(_0x4bf242){var _0x283346=this;return new Promise(function(_0x329078,_0x38a58e){return db[_0x5567('0x1e')]['find']({'raw':_0x4bf242[_0x5567('0x20')]?_0x4bf242['options'][_0x5567('0x21')]===undefined?!![]:![]:!![],'where':_0x4bf242[_0x5567('0x20')]?_0x4bf242['options'][_0x5567('0x28')]||null:null,'attributes':_0x4bf242['options']?_0x4bf242['options'][_0x5567('0x22')]||null:null,'include':_0x4bf242[_0x5567('0x20')]?_0x4bf242['options'][_0x5567('0x24')]?_[_0x5567('0x25')](_0x4bf242['options']['include'],function(_0x5a48c2){return{'model':db[_0x5a48c2[_0x5567('0x26')]],'as':_0x5a48c2['as'],'attributes':_0x5a48c2[_0x5567('0x22')],'include':_0x5a48c2[_0x5567('0x24')]?_[_0x5567('0x25')](_0x5a48c2[_0x5567('0x24')],function(_0x7ee4d0){return{'model':db[_0x7ee4d0[_0x5567('0x26')]],'as':_0x7ee4d0['as'],'attributes':_0x7ee4d0[_0x5567('0x22')],'include':_0x7ee4d0[_0x5567('0x24')]?_[_0x5567('0x25')](_0x7ee4d0[_0x5567('0x24')],function(_0x32bd44){return{'model':db[_0x32bd44[_0x5567('0x26')]],'as':_0x32bd44['as'],'attributes':_0x32bd44[_0x5567('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5567('0x12')](function(_0x37d38f){logger[_0x5567('0x13')](_0x5567('0x27'),_0x4bf242);logger[_0x5567('0x16')](_0x5567('0x27'),_0x4bf242,JSON['stringify'](_0x37d38f));_0x329078(_0x37d38f);})[_0x5567('0x1c')](function(_0x562299){logger[_0x5567('0x18')](_0x5567('0x27'),_0x562299[_0x5567('0x1a')],_0x4bf242);_0x38a58e(_0x283346[_0x5567('0x18')](0x1f4,_0x562299[_0x5567('0x1a')]));});});};
\ No newline at end of file
+var _0x63ae=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowVoiceQueue','find','lodash','util','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x63ae,0x18c));var _0xe63a=function(_0x1e71fb,_0x51b4a4){_0x1e71fb=_0x1e71fb-0x0;var _0x3b7a75=_0x63ae[_0x1e71fb];return _0x3b7a75;};'use strict';var _=require(_0xe63a('0x0'));var util=require(_0xe63a('0x1'));var moment=require(_0xe63a('0x2'));var BPromise=require(_0xe63a('0x3'));var rs=require(_0xe63a('0x4'));var fs=require('fs');var Redis=require(_0xe63a('0x5'));var db=require(_0xe63a('0x6'))['db'];var utils=require(_0xe63a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe63a('0x8'));var jayson=require(_0xe63a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xe63a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe63a('0xb'))(new Redis(config[_0xe63a('0xa')]));require(_0xe63a('0xc'))[_0xe63a('0xd')](socket);function respondWithRpcPromise(_0x2e28f8,_0x513cc6,_0x1a4681){return new BPromise(function(_0x5089e2,_0x4dd285){return client[_0xe63a('0xe')](_0x2e28f8,_0x1a4681)[_0xe63a('0xf')](function(_0x12368c){logger[_0xe63a('0x10')](_0xe63a('0x11'),_0x513cc6,_0xe63a('0x12'));logger[_0xe63a('0x13')](_0xe63a('0x14'),_0x513cc6,_0xe63a('0x12'),JSON['stringify'](_0x12368c));if(_0x12368c[_0xe63a('0x15')]){if(_0x12368c['error'][_0xe63a('0x16')]===0x1f4){logger[_0xe63a('0x15')](_0xe63a('0x11'),_0x513cc6,_0x12368c[_0xe63a('0x15')][_0xe63a('0x17')]);return _0x4dd285(_0x12368c[_0xe63a('0x15')][_0xe63a('0x17')]);}logger[_0xe63a('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x513cc6,_0x12368c[_0xe63a('0x15')][_0xe63a('0x17')]);return _0x5089e2(_0x12368c[_0xe63a('0x15')]['message']);}else{logger[_0xe63a('0x10')](_0xe63a('0x11'),_0x513cc6,_0xe63a('0x12'));_0x5089e2(_0x12368c[_0xe63a('0x18')][_0xe63a('0x17')]);}})['catch'](function(_0x4925b1){logger['error'](_0xe63a('0x11'),_0x513cc6,_0x4925b1);_0x4dd285(_0x4925b1);});});}exports[_0xe63a('0x19')]=function(_0x5b33a9){var _0x638eb7=this;return new Promise(function(_0x40117d,_0x871255){return db[_0xe63a('0x1a')][_0xe63a('0x1b')]({'raw':_0x5b33a9[_0xe63a('0x1c')]?_0x5b33a9[_0xe63a('0x1c')][_0xe63a('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b33a9['options']?_0x5b33a9['options'][_0xe63a('0x1e')]||null:null,'attributes':_0x5b33a9[_0xe63a('0x1c')]?_0x5b33a9[_0xe63a('0x1c')][_0xe63a('0x1f')]||null:null,'limit':_0x5b33a9[_0xe63a('0x1c')]?_0x5b33a9[_0xe63a('0x1c')][_0xe63a('0x20')]||null:null,'include':_0x5b33a9[_0xe63a('0x1c')]?_0x5b33a9[_0xe63a('0x1c')][_0xe63a('0x21')]?_[_0xe63a('0x22')](_0x5b33a9[_0xe63a('0x1c')][_0xe63a('0x21')],function(_0x4792b7){return{'model':db[_0x4792b7['model']],'as':_0x4792b7['as'],'attributes':_0x4792b7[_0xe63a('0x1f')],'include':_0x4792b7['include']?_[_0xe63a('0x22')](_0x4792b7['include'],function(_0x4f0469){return{'model':db[_0x4f0469[_0xe63a('0x23')]],'as':_0x4f0469['as'],'attributes':_0x4f0469[_0xe63a('0x1f')],'include':_0x4f0469['include']?_[_0xe63a('0x22')](_0x4f0469[_0xe63a('0x21')],function(_0x596dc1){return{'model':db[_0x596dc1[_0xe63a('0x23')]],'as':_0x596dc1['as'],'attributes':_0x596dc1[_0xe63a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe63a('0xf')](function(_0x9b2877){logger['info'](_0xe63a('0x19'),_0x5b33a9);logger[_0xe63a('0x13')](_0xe63a('0x19'),_0x5b33a9,JSON[_0xe63a('0x24')](_0x9b2877));_0x40117d(_0x9b2877);})[_0xe63a('0x25')](function(_0x115691){logger[_0xe63a('0x15')](_0xe63a('0x19'),_0x115691[_0xe63a('0x17')],_0x5b33a9);_0x871255(_0x638eb7[_0xe63a('0x15')](0x1f4,_0x115691[_0xe63a('0x17')]));});});};exports[_0xe63a('0x26')]=function(_0x1fae4c){var _0x107b1a=this;return new Promise(function(_0x753760,_0x5db472){return db[_0xe63a('0x1a')][_0xe63a('0x27')]({'raw':_0x1fae4c[_0xe63a('0x1c')]?_0x1fae4c[_0xe63a('0x1c')][_0xe63a('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fae4c[_0xe63a('0x1c')]?_0x1fae4c['options'][_0xe63a('0x1e')]||null:null,'attributes':_0x1fae4c[_0xe63a('0x1c')]?_0x1fae4c['options']['attributes']||null:null,'include':_0x1fae4c['options']?_0x1fae4c[_0xe63a('0x1c')][_0xe63a('0x21')]?_['map'](_0x1fae4c[_0xe63a('0x1c')][_0xe63a('0x21')],function(_0x3b4115){return{'model':db[_0x3b4115['model']],'as':_0x3b4115['as'],'attributes':_0x3b4115['attributes'],'include':_0x3b4115[_0xe63a('0x21')]?_[_0xe63a('0x22')](_0x3b4115[_0xe63a('0x21')],function(_0x1aaf55){return{'model':db[_0x1aaf55[_0xe63a('0x23')]],'as':_0x1aaf55['as'],'attributes':_0x1aaf55[_0xe63a('0x1f')],'include':_0x1aaf55['include']?_[_0xe63a('0x22')](_0x1aaf55[_0xe63a('0x21')],function(_0x30b497){return{'model':db[_0x30b497[_0xe63a('0x23')]],'as':_0x30b497['as'],'attributes':_0x30b497[_0xe63a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x447c9b){logger[_0xe63a('0x10')]('ShowVoiceQueue',_0x1fae4c);logger[_0xe63a('0x13')]('ShowVoiceQueue',_0x1fae4c,JSON['stringify'](_0x447c9b));_0x753760(_0x447c9b);})[_0xe63a('0x25')](function(_0x5b7a47){logger[_0xe63a('0x15')](_0xe63a('0x26'),_0x5b7a47['message'],_0x1fae4c);_0x5db472(_0x107b1a[_0xe63a('0x15')](0x1f4,_0x5b7a47[_0xe63a('0x17')]));});});};
\ No newline at end of file
index a5ac462..736d946 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe0a=['length','voiceQueue:','./voiceQueue.events','update','register'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xfe0a,0x19c));var _0xafe0=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0xfe0a[_0x584b9d];return _0x172053;};'use strict';var VoiceQueueEvents=require(_0xafe0('0x0'));var events=['save','remove',_0xafe0('0x1')];function createListener(_0x545f93,_0x284bd9){return function(_0x292b97){_0x284bd9['emit'](_0x545f93,_0x292b97);};}function removeListener(_0xfb3d7c,_0x24ef97){return function(){VoiceQueueEvents['removeListener'](_0xfb3d7c,_0x24ef97);};}exports[_0xafe0('0x2')]=function(_0x4ec629){for(var _0x31e6c1=0x0,_0x16fcd6=events[_0xafe0('0x3')];_0x31e6c1<_0x16fcd6;_0x31e6c1++){var _0xf08122=events[_0x31e6c1];var _0x592b9d=createListener(_0xafe0('0x4')+_0xf08122,_0x4ec629);VoiceQueueEvents['on'](_0xf08122,_0x592b9d);}};
\ No newline at end of file
+var _0x7c0b=['remove','emit','removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2bab20,_0x1d7472){var _0xda5eda=function(_0x37ba9){while(--_0x37ba9){_0x2bab20['push'](_0x2bab20['shift']());}};_0xda5eda(++_0x1d7472);}(_0x7c0b,0x19b));var _0xb7c0=function(_0x1ca1ad,_0x30cda1){_0x1ca1ad=_0x1ca1ad-0x0;var _0x329903=_0x7c0b[_0x1ca1ad];return _0x329903;};'use strict';var VoiceQueueEvents=require(_0xb7c0('0x0'));var events=[_0xb7c0('0x1'),_0xb7c0('0x2'),'update'];function createListener(_0x5c31e9,_0xf706b4){return function(_0x3b39de){_0xf706b4[_0xb7c0('0x3')](_0x5c31e9,_0x3b39de);};}function removeListener(_0xbc4cac,_0x3959d6){return function(){VoiceQueueEvents[_0xb7c0('0x4')](_0xbc4cac,_0x3959d6);};}exports['register']=function(_0xe076b6){for(var _0x127aa0=0x0,_0x3802ea=events[_0xb7c0('0x5')];_0x127aa0<_0x3802ea;_0x127aa0++){var _0x22f06e=events[_0x127aa0];var _0x5a683c=createListener(_0xb7c0('0x6')+_0x22f06e,_0xe076b6);VoiceQueueEvents['on'](_0x22f06e,_0x5a683c);}};
\ No newline at end of file
index 29c5e95..1861f73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c4b=['path','connect-timeout','express','Router','../../config/environment','./voiceQueueReport.controller','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','exports','util'];(function(_0x4aa56d,_0x58db0f){var _0x36ce6e=function(_0x526984){while(--_0x526984){_0x4aa56d['push'](_0x4aa56d['shift']());}};_0x36ce6e(++_0x58db0f);}(_0x1c4b,0x179));var _0xb1c4=function(_0xe12eb4,_0x3abf24){_0xe12eb4=_0xe12eb4-0x0;var _0xce090a=_0x1c4b[_0xe12eb4];return _0xce090a;};'use strict';var multer=require('multer');var util=require(_0xb1c4('0x0'));var path=require(_0xb1c4('0x1'));var timeout=require(_0xb1c4('0x2'));var express=require(_0xb1c4('0x3'));var router=express[_0xb1c4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb1c4('0x5'));var controller=require(_0xb1c4('0x6'));router[_0xb1c4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb1c4('0x7')](_0xb1c4('0x8'),auth[_0xb1c4('0x9')](),controller[_0xb1c4('0xa')]);router[_0xb1c4('0x7')](_0xb1c4('0xb'),auth['isAuthenticated'](),controller[_0xb1c4('0xc')]);router[_0xb1c4('0x7')](_0xb1c4('0xd'),auth[_0xb1c4('0x9')](),controller[_0xb1c4('0xe')]);router[_0xb1c4('0xf')]('/',auth[_0xb1c4('0x9')](),controller[_0xb1c4('0x10')]);router[_0xb1c4('0x11')]('/:id',auth[_0xb1c4('0x9')](),controller['update']);router[_0xb1c4('0x12')](_0xb1c4('0xd'),auth[_0xb1c4('0x9')](),controller[_0xb1c4('0x13')]);module[_0xb1c4('0x14')]=router;
\ No newline at end of file
+var _0x030d=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/index','/:id','post','put','update','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x030d,0x1c9));var _0xd030=function(_0x48b3fb,_0x4b07bf){_0x48b3fb=_0x48b3fb-0x0;var _0x458604=_0x030d[_0x48b3fb];return _0x458604;};'use strict';var multer=require(_0xd030('0x0'));var util=require(_0xd030('0x1'));var path=require(_0xd030('0x2'));var timeout=require(_0xd030('0x3'));var express=require('express');var router=express[_0xd030('0x4')]();var fs_extra=require(_0xd030('0x5'));var auth=require(_0xd030('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xd030('0x7')]('/',auth[_0xd030('0x8')](),controller[_0xd030('0x9')]);router[_0xd030('0x7')](_0xd030('0xa'),auth[_0xd030('0x8')](),controller[_0xd030('0xb')]);router[_0xd030('0x7')](_0xd030('0xc'),auth[_0xd030('0x8')](),controller['getVoiceQueuesReport']);router[_0xd030('0x7')](_0xd030('0xd'),auth[_0xd030('0x8')](),controller['show']);router[_0xd030('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd030('0xf')](_0xd030('0xd'),auth[_0xd030('0x8')](),controller[_0xd030('0x10')]);router[_0xd030('0x11')](_0xd030('0xd'),auth[_0xd030('0x8')](),controller[_0xd030('0x12')]);module['exports']=router;
\ No newline at end of file
index 4b4f352..ea8fbaf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9af=['STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3f9d91,_0x20c819){var _0x105894=function(_0x1fe09d){while(--_0x1fe09d){_0x3f9d91['push'](_0x3f9d91['shift']());}};_0x105894(++_0x20c819);}(_0xd9af,0x1a0));var _0xfd9a=function(_0x31b077,_0x567dc7){_0x31b077=_0x31b077-0x0;var _0x14b511=_0xd9af[_0x31b077];return _0x14b511;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfd9a('0x0')]},'calleridnum':{'type':Sequelize[_0xfd9a('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xfd9a('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0xfd9a('0x1')],'set':function(_0x2cee19){var _0x423d80=moment(_0x2cee19);var _0x9964c9=moment(this['getDataValue'](_0xfd9a('0x2')))[_0xfd9a('0x3')](_0xfd9a('0x4'));var _0x1255b8=_0x423d80[_0xfd9a('0x5')](_0x9964c9,_0xfd9a('0x6'));this['setDataValue'](_0xfd9a('0x7'),_0x2cee19);this[_0xfd9a('0x8')](_0xfd9a('0x9'),_0x1255b8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xfd9a('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xfd9a('0x1')]},'queuecallercomplete':{'type':Sequelize[_0xfd9a('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xfd9a('0x1')]},'queuecallerexit':{'type':Sequelize[_0xfd9a('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xfd9a('0x0')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xfd9a('0xb')]},'channel':{'type':Sequelize[_0xfd9a('0x0')]},'connectedlinenum':{'type':Sequelize[_0xfd9a('0x0')]},'connectedlinename':{'type':Sequelize[_0xfd9a('0x0')]},'accountcode':{'type':Sequelize[_0xfd9a('0x0')]},'context':{'type':Sequelize[_0xfd9a('0x0')]},'exten':{'type':Sequelize[_0xfd9a('0x0')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xfd9a('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xfd9a('0x0')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfd9a('0xc')},'transferexten':{'type':Sequelize[_0xfd9a('0x0')]},'transferuniqueid':{'type':Sequelize[_0xfd9a('0x0')]},'disposition':{'type':Sequelize[_0xfd9a('0x0')]},'secondDisposition':{'type':Sequelize[_0xfd9a('0x0')]},'thirdDisposition':{'type':Sequelize[_0xfd9a('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0xfd9a('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xf9a3=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x33615e,_0x3c97b0){var _0x5888dd=function(_0x40634a){while(--_0x40634a){_0x33615e['push'](_0x33615e['shift']());}};_0x5888dd(++_0x3c97b0);}(_0xf9a3,0xc4));var _0x3f9a=function(_0x55a7ca,_0x5049f4){_0x55a7ca=_0x55a7ca-0x0;var _0x5cde80=_0xf9a3[_0x55a7ca];return _0x5cde80;};'use strict';var Sequelize=require(_0x3f9a('0x0'));var moment=require(_0x3f9a('0x1'));module[_0x3f9a('0x2')]={'type':{'type':Sequelize[_0x3f9a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3f9a('0x3')]},'queue':{'type':Sequelize[_0x3f9a('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x3f9a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x3f9a('0x4')],'set':function(_0xe892e2){var _0x559612=moment(_0xe892e2);var _0x2dcf51=moment(this[_0x3f9a('0x5')](_0x3f9a('0x6')))[_0x3f9a('0x7')](_0x3f9a('0x8'));var _0x3a9aa9=_0x559612[_0x3f9a('0x9')](_0x2dcf51,_0x3f9a('0xa'));this[_0x3f9a('0xb')]('queuecallerleaveAt',_0xe892e2);this[_0x3f9a('0xb')](_0x3f9a('0xc'),_0x3a9aa9||null);}},'position':{'type':Sequelize[_0x3f9a('0xd')]},'count':{'type':Sequelize[_0x3f9a('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x3f9a('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3f9a('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3f9a('0x4')]},'queuecallerexit':{'type':Sequelize[_0x3f9a('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3f9a('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x3f9a('0x3')],'comment':_0x3f9a('0xf')},'originalposition':{'type':Sequelize[_0x3f9a('0xd')]},'channel':{'type':Sequelize[_0x3f9a('0x3')]},'connectedlinenum':{'type':Sequelize[_0x3f9a('0x3')]},'connectedlinename':{'type':Sequelize[_0x3f9a('0x3')]},'accountcode':{'type':Sequelize[_0x3f9a('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3f9a('0x3')]},'priority':{'type':Sequelize[_0x3f9a('0x3')]},'holdtime':{'type':Sequelize[_0x3f9a('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3f9a('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3f9a('0x3')],'comment':_0x3f9a('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3f9a('0x3')]},'secondDisposition':{'type':Sequelize[_0x3f9a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3f9a('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x3f9a('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x3f9a('0x3')]}};
\ No newline at end of file
index 35c0775..1e3a9d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a5d=['sendStatus','error','stack','name','map','VoiceQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','then','includeAll','include','findAll','rows','catch','params','options','create','body','find','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x2bdb37,_0x5cc638){var _0x190198=function(_0x1dbc2c){while(--_0x1dbc2c){_0x2bdb37['push'](_0x2bdb37['shift']());}};_0x190198(++_0x5cc638);}(_0x6a5d,0x122));var _0xd6a5=function(_0x160b20,_0x1d09e8){_0x160b20=_0x160b20-0x0;var _0x5f3654=_0x6a5d[_0x160b20];return _0x5f3654;};'use strict';var emlformat=require(_0xd6a5('0x0'));var rimraf=require(_0xd6a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6a5('0x2'));var moment=require(_0xd6a5('0x3'));var BPromise=require(_0xd6a5('0x4'));var Mustache=require(_0xd6a5('0x5'));var util=require(_0xd6a5('0x6'));var path=require(_0xd6a5('0x7'));var sox=require(_0xd6a5('0x8'));var csv=require('to-csv');var ejs=require(_0xd6a5('0x9'));var fs=require('fs');var fs_extra=require(_0xd6a5('0xa'));var _=require('lodash');var squel=require(_0xd6a5('0xb'));var crypto=require(_0xd6a5('0xc'));var jsforce=require(_0xd6a5('0xd'));var deskjs=require(_0xd6a5('0xe'));var toCsv=require(_0xd6a5('0xf'));var querystring=require(_0xd6a5('0x10'));var Papa=require(_0xd6a5('0x11'));var Redis=require('ioredis');var authService=require(_0xd6a5('0x12'));var qs=require(_0xd6a5('0x13'));var as=require(_0xd6a5('0x14'));var hardwareService=require(_0xd6a5('0x15'));var logger=require(_0xd6a5('0x16'))(_0xd6a5('0x17'));var utils=require(_0xd6a5('0x18'));var config=require(_0xd6a5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6a5('0x1a'))['db'];config[_0xd6a5('0x1b')]=_[_0xd6a5('0x1c')](config['redis'],{'host':_0xd6a5('0x1d'),'port':0x18eb});var socket=require(_0xd6a5('0x1e'))(new Redis(config[_0xd6a5('0x1b')]));require('./voiceQueueReport.socket')[_0xd6a5('0x1f')](socket);function respondWithStatusCode(_0x4d738d,_0x2745fd){_0x2745fd=_0x2745fd||0xcc;return function(_0x14ecf8){if(_0x14ecf8){return _0x4d738d['sendStatus'](_0x2745fd);}return _0x4d738d[_0xd6a5('0x20')](_0x2745fd)[_0xd6a5('0x21')]();};}function respondWithResult(_0x45fcad,_0x5a975c){_0x5a975c=_0x5a975c||0xc8;return function(_0x372042){if(_0x372042){return _0x45fcad[_0xd6a5('0x20')](_0x5a975c)[_0xd6a5('0x22')](_0x372042);}};}function respondWithFilteredResult(_0x4ff4f4,_0x1c5278){return function(_0x379347){if(_0x379347){var _0x17b6e6=typeof _0x1c5278['offset']===_0xd6a5('0x23')&&typeof _0x1c5278[_0xd6a5('0x24')]===_0xd6a5('0x23');var _0x360723=_0x379347[_0xd6a5('0x25')];var _0x416875=_0x17b6e6?0x0:_0x1c5278[_0xd6a5('0x26')];var _0x406274=_0x17b6e6?_0x379347[_0xd6a5('0x25')]:_0x1c5278['offset']+_0x1c5278[_0xd6a5('0x24')];var _0x2d5186;if(_0x406274>=_0x360723){_0x406274=_0x360723;_0x2d5186=0xc8;}else{_0x2d5186=0xce;}_0x4ff4f4[_0xd6a5('0x20')](_0x2d5186);return _0x4ff4f4[_0xd6a5('0x27')](_0xd6a5('0x28'),_0x416875+'-'+_0x406274+'/'+_0x360723)[_0xd6a5('0x22')](_0x379347);}return null;};}function patchUpdates(_0x1232f4){return function(_0x1741d3){try{jsonpatch[_0xd6a5('0x29')](_0x1741d3,_0x1232f4,!![]);}catch(_0x281f65){return BPromise[_0xd6a5('0x2a')](_0x281f65);}return _0x1741d3[_0xd6a5('0x2b')]();};}function saveUpdates(_0x2d3583,_0x9028d){return function(_0x1bc648){if(_0x1bc648){return _0x1bc648[_0xd6a5('0x2c')](_0x2d3583)['then'](function(_0x460904){return _0x460904;});}return null;};}function removeEntity(_0x1d95bd,_0x529ff4){return function(_0x4b2e0c){if(_0x4b2e0c){return _0x4b2e0c[_0xd6a5('0x2d')]()['then'](function(){_0x1d95bd['status'](0xcc)[_0xd6a5('0x21')]();});}};}function handleEntityNotFound(_0xe40ff9,_0x211b88){return function(_0x24cf90){if(!_0x24cf90){_0xe40ff9[_0xd6a5('0x2e')](0x194);}return _0x24cf90;};}function handleError(_0x2d1662,_0x57490f){_0x57490f=_0x57490f||0x1f4;return function(_0x568060){logger[_0xd6a5('0x2f')](_0x568060[_0xd6a5('0x30')]);if(_0x568060[_0xd6a5('0x31')]){delete _0x568060[_0xd6a5('0x31')];}_0x2d1662[_0xd6a5('0x20')](_0x57490f)['send'](_0x568060);};}exports['index']=function(_0x2e9ab8,_0x461d0f){var _0x3469fd={},_0x2810d3={},_0x263362={'count':0x0,'rows':[]};var _0x3398cc=_[_0xd6a5('0x32')](db[_0xd6a5('0x33')][_0xd6a5('0x34')],function(_0x5b7d11){return{'name':_0x5b7d11[_0xd6a5('0x35')],'type':_0x5b7d11['type']['key']};});_0x2810d3[_0xd6a5('0x36')]=_['map'](_0x3398cc,'name');_0x2810d3[_0xd6a5('0x37')]=_[_0xd6a5('0x38')](_0x2e9ab8[_0xd6a5('0x37')]);_0x2810d3[_0xd6a5('0x39')]=_[_0xd6a5('0x3a')](_0x2810d3[_0xd6a5('0x36')],_0x2810d3['query']);_0x3469fd[_0xd6a5('0x3b')]=_[_0xd6a5('0x3a')](_0x2810d3[_0xd6a5('0x36')],qs['fields'](_0x2e9ab8['query'][_0xd6a5('0x3c')]));_0x3469fd[_0xd6a5('0x3b')]=_0x3469fd[_0xd6a5('0x3b')][_0xd6a5('0x3d')]?_0x3469fd[_0xd6a5('0x3b')]:_0x2810d3[_0xd6a5('0x36')];if(!_0x2e9ab8[_0xd6a5('0x37')][_0xd6a5('0x3e')]('nolimit')){_0x3469fd[_0xd6a5('0x24')]=qs['limit'](_0x2e9ab8[_0xd6a5('0x37')][_0xd6a5('0x24')]);_0x3469fd['offset']=qs[_0xd6a5('0x26')](_0x2e9ab8[_0xd6a5('0x37')][_0xd6a5('0x26')]);}_0x3469fd[_0xd6a5('0x3f')]=qs[_0xd6a5('0x40')](_0x2e9ab8[_0xd6a5('0x37')][_0xd6a5('0x40')]);_0x3469fd[_0xd6a5('0x41')]=qs['filters'](_[_0xd6a5('0x42')](_0x2e9ab8['query'],_0x2810d3[_0xd6a5('0x39')]),_0x3398cc);if(_0x2e9ab8[_0xd6a5('0x37')]['filter']){_0x3469fd[_0xd6a5('0x41')]=_[_0xd6a5('0x43')](_0x3469fd[_0xd6a5('0x41')],{'$or':_[_0xd6a5('0x32')](_0x3398cc,function(_0x249b18){if(_0x249b18[_0xd6a5('0x44')]!=='VIRTUAL'){var _0x21aba6={};_0x21aba6[_0x249b18['name']]={'$like':'%'+_0x2e9ab8[_0xd6a5('0x37')][_0xd6a5('0x45')]+'%'};return _0x21aba6;}})});}_0x3469fd=_['merge']({},_0x3469fd,_0x2e9ab8['options']);var _0xf547ba={'where':_0x3469fd[_0xd6a5('0x41')]};return db['VoiceQueueReport']['count'](_0xf547ba)[_0xd6a5('0x46')](function(_0x3f5008){_0x263362[_0xd6a5('0x25')]=_0x3f5008;if(_0x2e9ab8[_0xd6a5('0x37')][_0xd6a5('0x47')]){_0x3469fd[_0xd6a5('0x48')]=[{'all':!![]}];}return db[_0xd6a5('0x33')][_0xd6a5('0x49')](_0x3469fd);})[_0xd6a5('0x46')](function(_0x12db50){_0x263362[_0xd6a5('0x4a')]=_0x12db50;return _0x263362;})[_0xd6a5('0x46')](respondWithFilteredResult(_0x461d0f,_0x3469fd))[_0xd6a5('0x4b')](handleError(_0x461d0f,null));};exports['show']=function(_0x2f66c8,_0x3c82df){var _0x358740={'raw':![],'where':{'id':_0x2f66c8[_0xd6a5('0x4c')]['id']}},_0x4603d8={};_0x4603d8[_0xd6a5('0x36')]=_[_0xd6a5('0x38')](db[_0xd6a5('0x33')][_0xd6a5('0x34')]);_0x4603d8['query']=_[_0xd6a5('0x38')](_0x2f66c8[_0xd6a5('0x37')]);_0x4603d8[_0xd6a5('0x39')]=_[_0xd6a5('0x3a')](_0x4603d8[_0xd6a5('0x36')],_0x4603d8['query']);_0x358740['attributes']=_['intersection'](_0x4603d8['model'],qs[_0xd6a5('0x3c')](_0x2f66c8[_0xd6a5('0x37')][_0xd6a5('0x3c')]));_0x358740[_0xd6a5('0x3b')]=_0x358740[_0xd6a5('0x3b')][_0xd6a5('0x3d')]?_0x358740['attributes']:_0x4603d8[_0xd6a5('0x36')];if(_0x2f66c8[_0xd6a5('0x37')][_0xd6a5('0x47')]){_0x358740['include']=[{'all':!![]}];}_0x358740=_[_0xd6a5('0x43')]({},_0x358740,_0x2f66c8[_0xd6a5('0x4d')]);return db[_0xd6a5('0x33')]['find'](_0x358740)[_0xd6a5('0x46')](handleEntityNotFound(_0x3c82df,null))[_0xd6a5('0x46')](respondWithResult(_0x3c82df,null))[_0xd6a5('0x4b')](handleError(_0x3c82df,null));};exports['create']=function(_0x5747dd,_0x2a34be){return db[_0xd6a5('0x33')][_0xd6a5('0x4e')](_0x5747dd[_0xd6a5('0x4f')],{})[_0xd6a5('0x46')](respondWithResult(_0x2a34be,0xc9))[_0xd6a5('0x4b')](handleError(_0x2a34be,null));};exports[_0xd6a5('0x2c')]=function(_0xf479d0,_0x4cebbc){if(_0xf479d0[_0xd6a5('0x4f')]['id']){delete _0xf479d0[_0xd6a5('0x4f')]['id'];}return db[_0xd6a5('0x33')]['find']({'where':{'id':_0xf479d0[_0xd6a5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cebbc,null))['then'](saveUpdates(_0xf479d0['body'],null))[_0xd6a5('0x46')](respondWithResult(_0x4cebbc,null))[_0xd6a5('0x4b')](handleError(_0x4cebbc,null));};exports[_0xd6a5('0x2d')]=function(_0x3b87fa,_0x52ad25){return db['VoiceQueueReport'][_0xd6a5('0x50')]({'where':{'id':_0x3b87fa[_0xd6a5('0x4c')]['id']}})[_0xd6a5('0x46')](handleEntityNotFound(_0x52ad25,null))[_0xd6a5('0x46')](removeEntity(_0x52ad25,null))[_0xd6a5('0x4b')](handleError(_0x52ad25,null));};exports[_0xd6a5('0x51')]=function(_0x454cd5,_0x5802db){return db[_0xd6a5('0x33')]['describe']()[_0xd6a5('0x46')](respondWithResult(_0x5802db,null))[_0xd6a5('0x4b')](handleError(_0x5802db,null));};exports[_0xd6a5('0x52')]=function(_0x2138eb,_0x366feb){var _0x4bedba={},_0x45a7c9={},_0x1efbd7={'count':0x0,'rows':[]};_0x45a7c9[_0xd6a5('0x36')]=_[_0xd6a5('0x38')](db['VoiceQueueReport'][_0xd6a5('0x34')]);_0x45a7c9[_0xd6a5('0x37')]=_[_0xd6a5('0x38')](_0x2138eb['query']);_0x45a7c9[_0xd6a5('0x39')]=_[_0xd6a5('0x3a')](_0x45a7c9[_0xd6a5('0x36')],_0x45a7c9[_0xd6a5('0x37')]);_0x4bedba[_0xd6a5('0x3b')]=_[_0xd6a5('0x3a')](_0x45a7c9[_0xd6a5('0x36')],qs['fields'](_0x2138eb[_0xd6a5('0x37')][_0xd6a5('0x3c')]));_0x4bedba[_0xd6a5('0x3b')]=_0x4bedba[_0xd6a5('0x3b')][_0xd6a5('0x3d')]?_0x4bedba[_0xd6a5('0x3b')]:_0x45a7c9['model'];if(!_0x2138eb[_0xd6a5('0x37')][_0xd6a5('0x3e')](_0xd6a5('0x53'))){_0x4bedba[_0xd6a5('0x24')]=qs[_0xd6a5('0x24')](_0x2138eb['query'][_0xd6a5('0x24')]);_0x4bedba['offset']=qs[_0xd6a5('0x26')](_0x2138eb[_0xd6a5('0x37')]['offset']);}_0x4bedba['order']=qs[_0xd6a5('0x40')](_0x2138eb[_0xd6a5('0x37')]['sort']);_0x4bedba[_0xd6a5('0x41')]=qs[_0xd6a5('0x39')](_[_0xd6a5('0x42')](_0x2138eb[_0xd6a5('0x37')],_0x45a7c9[_0xd6a5('0x39')]));if(_0x2138eb[_0xd6a5('0x37')][_0xd6a5('0x45')]){_0x4bedba[_0xd6a5('0x41')]=_[_0xd6a5('0x43')](_0x4bedba[_0xd6a5('0x41')],{'$or':_[_0xd6a5('0x32')](_0x4bedba[_0xd6a5('0x3b')],function(_0x3efb96){var _0x2e123a={};_0x2e123a[_0x3efb96]={'$like':'%'+_0x2138eb['query'][_0xd6a5('0x45')]+'%'};return _0x2e123a;})});}_0x4bedba=_['merge']({},_0x4bedba,_0x2138eb['options']);var _0x295483={'where':_0x4bedba[_0xd6a5('0x41')]};return db['VoiceQueueReport'][_0xd6a5('0x25')](_0x295483)[_0xd6a5('0x46')](function(_0x2422ed){_0x1efbd7[_0xd6a5('0x25')]=_0x2422ed;if(_0x2138eb['query'][_0xd6a5('0x47')]){_0x4bedba[_0xd6a5('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xd6a5('0x49')](_0x4bedba);})[_0xd6a5('0x46')](function(_0x2d569f){_0x1efbd7[_0xd6a5('0x4a')]=_0x2d569f;return _0x1efbd7;})[_0xd6a5('0x46')](respondWithFilteredResult(_0x366feb,_0x4bedba,_0xd6a5('0x52')))[_0xd6a5('0x4b')](handleError(_0x366feb,null,_0xd6a5('0x52')));};
\ No newline at end of file
+var _0x824a=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','stack','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','getVoiceQueuesReport','filter','findAll','eml-format','rimraf'];(function(_0x3d8203,_0x15511e){var _0x85940=function(_0x572ebf){while(--_0x572ebf){_0x3d8203['push'](_0x3d8203['shift']());}};_0x85940(++_0x15511e);}(_0x824a,0xaa));var _0xa824=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x824a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa824('0x0'));var rimraf=require(_0xa824('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa824('0x2'));var rp=require(_0xa824('0x3'));var moment=require(_0xa824('0x4'));var BPromise=require(_0xa824('0x5'));var Mustache=require(_0xa824('0x6'));var util=require('util');var path=require(_0xa824('0x7'));var sox=require(_0xa824('0x8'));var csv=require(_0xa824('0x9'));var ejs=require(_0xa824('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa824('0xb'));var squel=require(_0xa824('0xc'));var crypto=require(_0xa824('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa824('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa824('0xf'));var Papa=require(_0xa824('0x10'));var Redis=require(_0xa824('0x11'));var authService=require(_0xa824('0x12'));var qs=require(_0xa824('0x13'));var as=require(_0xa824('0x14'));var hardwareService=require(_0xa824('0x15'));var logger=require(_0xa824('0x16'))('api');var utils=require(_0xa824('0x17'));var config=require(_0xa824('0x18'));var licenseUtil=require(_0xa824('0x19'));var db=require(_0xa824('0x1a'))['db'];config['redis']=_['defaults'](config[_0xa824('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa824('0x1c'))(new Redis(config[_0xa824('0x1b')]));require(_0xa824('0x1d'))[_0xa824('0x1e')](socket);function respondWithStatusCode(_0x44fe84,_0x55c29e){_0x55c29e=_0x55c29e||0xcc;return function(_0x2348b5){if(_0x2348b5){return _0x44fe84[_0xa824('0x1f')](_0x55c29e);}return _0x44fe84['status'](_0x55c29e)[_0xa824('0x20')]();};}function respondWithResult(_0x4dd881,_0x387769){_0x387769=_0x387769||0xc8;return function(_0x1802fa){if(_0x1802fa){return _0x4dd881[_0xa824('0x21')](_0x387769)[_0xa824('0x22')](_0x1802fa);}};}function respondWithFilteredResult(_0x3b6b6c,_0x39ace4){return function(_0x3db3f0){if(_0x3db3f0){var _0x1d0659=typeof _0x39ace4[_0xa824('0x23')]===_0xa824('0x24')&&typeof _0x39ace4['limit']==='undefined';var _0x166394=_0x3db3f0[_0xa824('0x25')];var _0x48ade7=_0x1d0659?0x0:_0x39ace4[_0xa824('0x23')];var _0x3d807f=_0x1d0659?_0x3db3f0['count']:_0x39ace4[_0xa824('0x23')]+_0x39ace4[_0xa824('0x26')];var _0x1eaf3b;if(_0x3d807f>=_0x166394){_0x3d807f=_0x166394;_0x1eaf3b=0xc8;}else{_0x1eaf3b=0xce;}_0x3b6b6c[_0xa824('0x21')](_0x1eaf3b);return _0x3b6b6c['set'](_0xa824('0x27'),_0x48ade7+'-'+_0x3d807f+'/'+_0x166394)[_0xa824('0x22')](_0x3db3f0);}return null;};}function patchUpdates(_0x2919fb){return function(_0x1576cf){try{jsonpatch[_0xa824('0x28')](_0x1576cf,_0x2919fb,!![]);}catch(_0x22e093){return BPromise['reject'](_0x22e093);}return _0x1576cf[_0xa824('0x29')]();};}function saveUpdates(_0x3c6d94,_0x5683ef){return function(_0x197487){if(_0x197487){return _0x197487['update'](_0x3c6d94)[_0xa824('0x2a')](function(_0xcf0773){return _0xcf0773;});}return null;};}function removeEntity(_0x1c22ed,_0x2cac7e){return function(_0x15f1fb){if(_0x15f1fb){return _0x15f1fb[_0xa824('0x2b')]()[_0xa824('0x2a')](function(){_0x1c22ed[_0xa824('0x21')](0xcc)[_0xa824('0x20')]();});}};}function handleEntityNotFound(_0x3408d6,_0x4a610c){return function(_0x5b7ac6){if(!_0x5b7ac6){_0x3408d6['sendStatus'](0x194);}return _0x5b7ac6;};}function handleError(_0x230489,_0x842324){_0x842324=_0x842324||0x1f4;return function(_0x4b423c){logger[_0xa824('0x2c')](_0x4b423c[_0xa824('0x2d')]);if(_0x4b423c['name']){delete _0x4b423c['name'];}_0x230489[_0xa824('0x21')](_0x842324)[_0xa824('0x2e')](_0x4b423c);};}exports[_0xa824('0x2f')]=function(_0x26b876,_0x2d2875){var _0xda469a={},_0x5ccbbc={},_0x11b4ec={'count':0x0,'rows':[]};var _0x301426=_['map'](db[_0xa824('0x30')][_0xa824('0x31')],function(_0x5e818e){return{'name':_0x5e818e[_0xa824('0x32')],'type':_0x5e818e[_0xa824('0x33')][_0xa824('0x34')]};});_0x5ccbbc[_0xa824('0x35')]=_[_0xa824('0x36')](_0x301426,_0xa824('0x37'));_0x5ccbbc[_0xa824('0x38')]=_[_0xa824('0x39')](_0x26b876[_0xa824('0x38')]);_0x5ccbbc[_0xa824('0x3a')]=_[_0xa824('0x3b')](_0x5ccbbc[_0xa824('0x35')],_0x5ccbbc[_0xa824('0x38')]);_0xda469a[_0xa824('0x3c')]=_['intersection'](_0x5ccbbc['model'],qs[_0xa824('0x3d')](_0x26b876['query'][_0xa824('0x3d')]));_0xda469a[_0xa824('0x3c')]=_0xda469a['attributes'][_0xa824('0x3e')]?_0xda469a[_0xa824('0x3c')]:_0x5ccbbc['model'];if(!_0x26b876[_0xa824('0x38')][_0xa824('0x3f')](_0xa824('0x40'))){_0xda469a[_0xa824('0x26')]=qs['limit'](_0x26b876[_0xa824('0x38')][_0xa824('0x26')]);_0xda469a['offset']=qs[_0xa824('0x23')](_0x26b876[_0xa824('0x38')][_0xa824('0x23')]);}_0xda469a[_0xa824('0x41')]=qs[_0xa824('0x42')](_0x26b876[_0xa824('0x38')]['sort']);_0xda469a['where']=qs[_0xa824('0x3a')](_[_0xa824('0x43')](_0x26b876[_0xa824('0x38')],_0x5ccbbc[_0xa824('0x3a')]),_0x301426);if(_0x26b876[_0xa824('0x38')]['filter']){_0xda469a['where']=_['merge'](_0xda469a[_0xa824('0x44')],{'$or':_[_0xa824('0x36')](_0x301426,function(_0xe38f12){if(_0xe38f12['type']!==_0xa824('0x45')){var _0x9aadf5={};_0x9aadf5[_0xe38f12['name']]={'$like':'%'+_0x26b876['query']['filter']+'%'};return _0x9aadf5;}})});}_0xda469a=_[_0xa824('0x46')]({},_0xda469a,_0x26b876[_0xa824('0x47')]);var _0x369dcb={'where':_0xda469a['where']};return db[_0xa824('0x30')][_0xa824('0x25')](_0x369dcb)[_0xa824('0x2a')](function(_0x316da7){_0x11b4ec['count']=_0x316da7;if(_0x26b876[_0xa824('0x38')][_0xa824('0x48')]){_0xda469a[_0xa824('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0xda469a);})[_0xa824('0x2a')](function(_0xa70d10){_0x11b4ec[_0xa824('0x4a')]=_0xa70d10;return _0x11b4ec;})['then'](respondWithFilteredResult(_0x2d2875,_0xda469a))[_0xa824('0x4b')](handleError(_0x2d2875,null));};exports[_0xa824('0x4c')]=function(_0x2d167d,_0x176697){var _0x1bd0aa={'raw':![],'where':{'id':_0x2d167d[_0xa824('0x4d')]['id']}},_0x210920={};_0x210920[_0xa824('0x35')]=_[_0xa824('0x39')](db['VoiceQueueReport']['rawAttributes']);_0x210920['query']=_['keys'](_0x2d167d['query']);_0x210920[_0xa824('0x3a')]=_[_0xa824('0x3b')](_0x210920[_0xa824('0x35')],_0x210920[_0xa824('0x38')]);_0x1bd0aa[_0xa824('0x3c')]=_[_0xa824('0x3b')](_0x210920[_0xa824('0x35')],qs[_0xa824('0x3d')](_0x2d167d[_0xa824('0x38')][_0xa824('0x3d')]));_0x1bd0aa[_0xa824('0x3c')]=_0x1bd0aa[_0xa824('0x3c')]['length']?_0x1bd0aa[_0xa824('0x3c')]:_0x210920['model'];if(_0x2d167d[_0xa824('0x38')][_0xa824('0x48')]){_0x1bd0aa[_0xa824('0x49')]=[{'all':!![]}];}_0x1bd0aa=_[_0xa824('0x46')]({},_0x1bd0aa,_0x2d167d[_0xa824('0x47')]);return db[_0xa824('0x30')][_0xa824('0x4e')](_0x1bd0aa)[_0xa824('0x2a')](handleEntityNotFound(_0x176697,null))[_0xa824('0x2a')](respondWithResult(_0x176697,null))[_0xa824('0x4b')](handleError(_0x176697,null));};exports[_0xa824('0x4f')]=function(_0x47a40e,_0x535204){return db['VoiceQueueReport'][_0xa824('0x4f')](_0x47a40e[_0xa824('0x50')],{})['then'](respondWithResult(_0x535204,0xc9))[_0xa824('0x4b')](handleError(_0x535204,null));};exports[_0xa824('0x51')]=function(_0x3e4fa8,_0x2c3b54){if(_0x3e4fa8[_0xa824('0x50')]['id']){delete _0x3e4fa8[_0xa824('0x50')]['id'];}return db[_0xa824('0x30')][_0xa824('0x4e')]({'where':{'id':_0x3e4fa8['params']['id']}})[_0xa824('0x2a')](handleEntityNotFound(_0x2c3b54,null))[_0xa824('0x2a')](saveUpdates(_0x3e4fa8[_0xa824('0x50')],null))['then'](respondWithResult(_0x2c3b54,null))[_0xa824('0x4b')](handleError(_0x2c3b54,null));};exports[_0xa824('0x2b')]=function(_0x4f73fc,_0x361b4c){return db[_0xa824('0x30')][_0xa824('0x4e')]({'where':{'id':_0x4f73fc[_0xa824('0x4d')]['id']}})[_0xa824('0x2a')](handleEntityNotFound(_0x361b4c,null))['then'](removeEntity(_0x361b4c,null))[_0xa824('0x4b')](handleError(_0x361b4c,null));};exports['describe']=function(_0x23653f,_0x56fb21){return db[_0xa824('0x30')][_0xa824('0x52')]()[_0xa824('0x2a')](respondWithResult(_0x56fb21,null))[_0xa824('0x4b')](handleError(_0x56fb21,null));};exports[_0xa824('0x53')]=function(_0x4eced3,_0x2cff96){var _0x4eb950={},_0x204d69={},_0x35f8aa={'count':0x0,'rows':[]};_0x204d69[_0xa824('0x35')]=_[_0xa824('0x39')](db['VoiceQueueReport']['rawAttributes']);_0x204d69[_0xa824('0x38')]=_[_0xa824('0x39')](_0x4eced3['query']);_0x204d69[_0xa824('0x3a')]=_[_0xa824('0x3b')](_0x204d69[_0xa824('0x35')],_0x204d69[_0xa824('0x38')]);_0x4eb950['attributes']=_[_0xa824('0x3b')](_0x204d69[_0xa824('0x35')],qs[_0xa824('0x3d')](_0x4eced3[_0xa824('0x38')][_0xa824('0x3d')]));_0x4eb950[_0xa824('0x3c')]=_0x4eb950[_0xa824('0x3c')][_0xa824('0x3e')]?_0x4eb950[_0xa824('0x3c')]:_0x204d69[_0xa824('0x35')];if(!_0x4eced3[_0xa824('0x38')][_0xa824('0x3f')](_0xa824('0x40'))){_0x4eb950[_0xa824('0x26')]=qs[_0xa824('0x26')](_0x4eced3[_0xa824('0x38')][_0xa824('0x26')]);_0x4eb950[_0xa824('0x23')]=qs[_0xa824('0x23')](_0x4eced3['query'][_0xa824('0x23')]);}_0x4eb950[_0xa824('0x41')]=qs[_0xa824('0x42')](_0x4eced3['query'][_0xa824('0x42')]);_0x4eb950[_0xa824('0x44')]=qs[_0xa824('0x3a')](_['pick'](_0x4eced3[_0xa824('0x38')],_0x204d69[_0xa824('0x3a')]));if(_0x4eced3[_0xa824('0x38')][_0xa824('0x54')]){_0x4eb950[_0xa824('0x44')]=_['merge'](_0x4eb950[_0xa824('0x44')],{'$or':_['map'](_0x4eb950[_0xa824('0x3c')],function(_0x24b0e4){var _0xb6c7d3={};_0xb6c7d3[_0x24b0e4]={'$like':'%'+_0x4eced3[_0xa824('0x38')]['filter']+'%'};return _0xb6c7d3;})});}_0x4eb950=_['merge']({},_0x4eb950,_0x4eced3[_0xa824('0x47')]);var _0x174eee={'where':_0x4eb950[_0xa824('0x44')]};return db[_0xa824('0x30')]['count'](_0x174eee)[_0xa824('0x2a')](function(_0x4b5f86){_0x35f8aa['count']=_0x4b5f86;if(_0x4eced3[_0xa824('0x38')]['includeAll']){_0x4eb950[_0xa824('0x49')]=[{'all':!![]}];}return db[_0xa824('0x30')][_0xa824('0x55')](_0x4eb950);})[_0xa824('0x2a')](function(_0x49f979){_0x35f8aa[_0xa824('0x4a')]=_0x49f979;return _0x35f8aa;})[_0xa824('0x2a')](respondWithFilteredResult(_0x2cff96,_0x4eb950,_0xa824('0x53')))[_0xa824('0x4b')](handleError(_0x2cff96,null,_0xa824('0x53')));};
\ No newline at end of file
index 9e9845b..d7e37c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfa1=['events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x284f13,_0x4ed439){var _0x451152=function(_0x56a900){while(--_0x56a900){_0x284f13['push'](_0x284f13['shift']());}};_0x451152(++_0x4ed439);}(_0xbfa1,0xaa));var _0x1bfa=function(_0xea5a83,_0x2e8a4b){_0xea5a83=_0xea5a83-0x0;var _0x13817b=_0xbfa1[_0xea5a83];return _0x13817b;};'use strict';var EventEmitter=require(_0x1bfa('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1bfa('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1bfa('0x2')](0x0);var events={'afterCreate':_0x1bfa('0x3'),'afterUpdate':_0x1bfa('0x4'),'afterDestroy':_0x1bfa('0x5')};function emitEvent(_0x52b8bc){return function(_0x3bbbdf,_0x2c0585,_0x5e29a2){VoiceQueueReportEvents[_0x1bfa('0x6')](_0x52b8bc+':'+_0x3bbbdf['id'],_0x3bbbdf);VoiceQueueReportEvents[_0x1bfa('0x6')](_0x52b8bc,_0x3bbbdf);_0x5e29a2(null);};}for(var e in events){if(events[_0x1bfa('0x7')](e)){var event=events[e];VoiceQueueReport[_0x1bfa('0x8')](e,emitEvent(event));}}module[_0x1bfa('0x9')]=VoiceQueueReportEvents;
\ No newline at end of file
+var _0x286d=['events','../../mysqldb','VoiceQueueReport','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x286d,0xb4));var _0xd286=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x286d[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0xd286('0x0'));var VoiceQueueReport=require(_0xd286('0x1'))['db'][_0xd286('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd286('0x3'),'afterUpdate':'update','afterDestroy':_0xd286('0x4')};function emitEvent(_0x68d1f){return function(_0x2eb3cf,_0x16c064,_0x287f14){VoiceQueueReportEvents[_0xd286('0x5')](_0x68d1f+':'+_0x2eb3cf['id'],_0x2eb3cf);VoiceQueueReportEvents[_0xd286('0x5')](_0x68d1f,_0x2eb3cf);_0x287f14(null);};}for(var e in events){if(events[_0xd286('0x6')](e)){var event=events[e];VoiceQueueReport[_0xd286('0x7')](e,emitEvent(event));}}module[_0xd286('0x8')]=VoiceQueueReportEvents;
\ No newline at end of file
index e1be182..72945be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a92=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport','calleridnum'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9a92,0x196));var _0x29a9=function(_0x5ba42b,_0x3cd21c){_0x5ba42b=_0x5ba42b-0x0;var _0x29084e=_0x9a92[_0x5ba42b];return _0x29084e;};'use strict';var _=require(_0x29a9('0x0'));var util=require(_0x29a9('0x1'));var logger=require(_0x29a9('0x2'))(_0x29a9('0x3'));var moment=require(_0x29a9('0x4'));var BPromise=require(_0x29a9('0x5'));var rp=require(_0x29a9('0x6'));var fs=require('fs');var path=require(_0x29a9('0x7'));var rimraf=require(_0x29a9('0x8'));var config=require(_0x29a9('0x9'));var attributes=require('./voiceQueueReport.attributes');module[_0x29a9('0xa')]=function(_0x246d80,_0x4b12a8){return _0x246d80[_0x29a9('0xb')](_0x29a9('0xc'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x29a9('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x554d=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment'];(function(_0x1bc798,_0x2ab7c9){var _0x3308ca=function(_0x12f3da){while(--_0x12f3da){_0x1bc798['push'](_0x1bc798['shift']());}};_0x3308ca(++_0x2ab7c9);}(_0x554d,0xb3));var _0xd554=function(_0x584e52,_0x5443dc){_0x584e52=_0x584e52-0x0;var _0x5cf710=_0x554d[_0x584e52];return _0x5cf710;};'use strict';var _=require('lodash');var util=require(_0xd554('0x0'));var logger=require('../../config/logger')(_0xd554('0x1'));var moment=require(_0xd554('0x2'));var BPromise=require(_0xd554('0x3'));var rp=require(_0xd554('0x4'));var fs=require('fs');var path=require(_0xd554('0x5'));var rimraf=require(_0xd554('0x6'));var config=require(_0xd554('0x7'));var attributes=require(_0xd554('0x8'));module[_0xd554('0x9')]=function(_0x5979fb,_0x3f0810){return _0x5979fb['define'](_0xd554('0xa'),attributes,{'tableName':_0xd554('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd554('0xc')]},{'fields':[_0xd554('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index e6834dc..2009dc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x697c=['error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ae39d,_0x5c3787){var _0x1015a7=function(_0x261278){while(--_0x261278){_0x4ae39d['push'](_0x4ae39d['shift']());}};_0x1015a7(++_0x5c3787);}(_0x697c,0x17b));var _0xc697=function(_0x53d4c4,_0x3e9511){_0x53d4c4=_0x53d4c4-0x0;var _0x3dc1ce=_0x697c[_0x53d4c4];return _0x3dc1ce;};'use strict';var _=require(_0xc697('0x0'));var util=require(_0xc697('0x1'));var moment=require(_0xc697('0x2'));var BPromise=require(_0xc697('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc697('0x4'));var db=require(_0xc697('0x5'))['db'];var utils=require(_0xc697('0x6'));var logger=require(_0xc697('0x7'))(_0xc697('0x8'));var config=require(_0xc697('0x9'));var jayson=require(_0xc697('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xc697('0xb')]=_[_0xc697('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xc697('0xd')](socket);function respondWithRpcPromise(_0x26ca16,_0x3373c6,_0x135db7){return new BPromise(function(_0x67d51d,_0x2d5318){return client['request'](_0x26ca16,_0x135db7)[_0xc697('0xe')](function(_0x178896){logger[_0xc697('0xf')](_0xc697('0x10'),_0x3373c6,_0xc697('0x11'));logger[_0xc697('0x12')](_0xc697('0x13'),_0x3373c6,_0xc697('0x11'),JSON[_0xc697('0x14')](_0x178896));if(_0x178896['error']){if(_0x178896[_0xc697('0x15')][_0xc697('0x16')]===0x1f4){logger[_0xc697('0x15')](_0xc697('0x10'),_0x3373c6,_0x178896['error']['message']);return _0x2d5318(_0x178896[_0xc697('0x15')][_0xc697('0x17')]);}logger[_0xc697('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x3373c6,_0x178896['error'][_0xc697('0x17')]);return _0x67d51d(_0x178896[_0xc697('0x15')][_0xc697('0x17')]);}else{logger[_0xc697('0xf')](_0xc697('0x10'),_0x3373c6,_0xc697('0x11'));_0x67d51d(_0x178896[_0xc697('0x18')]['message']);}})[_0xc697('0x19')](function(_0x175586){logger[_0xc697('0x15')](_0xc697('0x10'),_0x3373c6,_0x175586);_0x2d5318(_0x175586);});});}exports[_0xc697('0x1a')]=function(_0x1b58e0){var _0x2129e3=this;return new Promise(function(_0x526a3a,_0x4b90ec){return db[_0xc697('0x1b')]['findAll']({'raw':_0x1b58e0['options']?_0x1b58e0[_0xc697('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1b58e0[_0xc697('0x1c')]?_0x1b58e0[_0xc697('0x1c')][_0xc697('0x1d')]||null:null,'attributes':_0x1b58e0['options']?_0x1b58e0['options'][_0xc697('0x1e')]||null:null,'limit':_0x1b58e0[_0xc697('0x1c')]?_0x1b58e0['options'][_0xc697('0x1f')]||null:null,'include':_0x1b58e0[_0xc697('0x1c')]?_0x1b58e0[_0xc697('0x1c')][_0xc697('0x20')]?_[_0xc697('0x21')](_0x1b58e0['options'][_0xc697('0x20')],function(_0x1baea5){return{'model':db[_0x1baea5[_0xc697('0x22')]],'as':_0x1baea5['as'],'attributes':_0x1baea5[_0xc697('0x1e')],'include':_0x1baea5[_0xc697('0x20')]?_[_0xc697('0x21')](_0x1baea5['include'],function(_0x2eb6b4){return{'model':db[_0x2eb6b4[_0xc697('0x22')]],'as':_0x2eb6b4['as'],'attributes':_0x2eb6b4[_0xc697('0x1e')],'include':_0x2eb6b4[_0xc697('0x20')]?_[_0xc697('0x21')](_0x2eb6b4[_0xc697('0x20')],function(_0x1881d9){return{'model':db[_0x1881d9[_0xc697('0x22')]],'as':_0x1881d9['as'],'attributes':_0x1881d9[_0xc697('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc697('0xe')](function(_0x53002b){logger['info'](_0xc697('0x1a'),_0x1b58e0);logger[_0xc697('0x12')]('GetVoiceQueueReport',_0x1b58e0,JSON['stringify'](_0x53002b));_0x526a3a(_0x53002b);})[_0xc697('0x19')](function(_0x260d2a){logger[_0xc697('0x15')]('GetVoiceQueueReport',_0x260d2a[_0xc697('0x17')],_0x1b58e0);_0x4b90ec(_0x2129e3[_0xc697('0x15')](0x1f4,_0x260d2a[_0xc697('0x17')]));});});};exports[_0xc697('0x23')]=function(_0x26fbc2){var _0x12fe50=this;return new Promise(function(_0x12e29d,_0x2254a0){return db['VoiceQueueReport']['create'](_0x26fbc2[_0xc697('0x24')],{'raw':_0x26fbc2['options']?_0x26fbc2[_0xc697('0x1c')][_0xc697('0x25')]===undefined?!![]:![]:!![]})[_0xc697('0xe')](function(_0x4ba908){logger['info'](_0xc697('0x23'),_0x26fbc2);logger[_0xc697('0x12')](_0xc697('0x23'),_0x26fbc2,JSON[_0xc697('0x14')](_0x4ba908));_0x12e29d(_0x4ba908);})[_0xc697('0x19')](function(_0x212904){logger[_0xc697('0x15')](_0xc697('0x23'),_0x212904[_0xc697('0x17')],_0x26fbc2);_0x2254a0(_0x12fe50[_0xc697('0x15')](0x1f4,_0x212904[_0xc697('0x17')]));});});};exports[_0xc697('0x26')]=function(_0x4fa918){var _0x236ac0=this;return new Promise(function(_0x1d066f,_0x5ce2e9){return db[_0xc697('0x1b')][_0xc697('0x27')](_0x4fa918[_0xc697('0x24')],{'raw':_0x4fa918[_0xc697('0x1c')]?_0x4fa918[_0xc697('0x1c')][_0xc697('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fa918[_0xc697('0x1c')]?_0x4fa918[_0xc697('0x1c')][_0xc697('0x1d')]||null:null,'attributes':_0x4fa918['options']?_0x4fa918['options'][_0xc697('0x1e')]||null:null,'limit':_0x4fa918['options']?_0x4fa918[_0xc697('0x1c')][_0xc697('0x1f')]||null:null})[_0xc697('0xe')](function(_0x573f90){logger[_0xc697('0xf')](_0xc697('0x26'),_0x4fa918);logger[_0xc697('0x12')](_0xc697('0x26'),_0x4fa918,JSON[_0xc697('0x14')](_0x573f90));_0x1d066f(_0x573f90);})[_0xc697('0x19')](function(_0x2bb261){logger[_0xc697('0x15')](_0xc697('0x26'),_0x2bb261[_0xc697('0x17')],_0x4fa918);_0x5ce2e9(_0x236ac0[_0xc697('0x15')](0x1f4,_0x2bb261[_0xc697('0x17')]));});});};
\ No newline at end of file
+var _0xd60d=['stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','catch','CreateVoiceQueueReport','create','update','body','UpdateVoiceQueueReport'];(function(_0x1b0f2c,_0x34c8c4){var _0x129367=function(_0x54a5b1){while(--_0x54a5b1){_0x1b0f2c['push'](_0x1b0f2c['shift']());}};_0x129367(++_0x34c8c4);}(_0xd60d,0xa9));var _0xdd60=function(_0x517745,_0x35a2d6){_0x517745=_0x517745-0x0;var _0x8bcdbf=_0xd60d[_0x517745];return _0x8bcdbf;};'use strict';var _=require(_0xdd60('0x0'));var util=require(_0xdd60('0x1'));var moment=require('moment');var BPromise=require(_0xdd60('0x2'));var rs=require(_0xdd60('0x3'));var fs=require('fs');var Redis=require(_0xdd60('0x4'));var db=require(_0xdd60('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd60('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xdd60('0x7')](config[_0xdd60('0x8')],{'host':_0xdd60('0x9'),'port':0x18eb});var socket=require(_0xdd60('0xa'))(new Redis(config[_0xdd60('0x8')]));require(_0xdd60('0xb'))[_0xdd60('0xc')](socket);function respondWithRpcPromise(_0x2d5ad0,_0x45196,_0x384287){return new BPromise(function(_0x34bb12,_0x2ada1e){return client[_0xdd60('0xd')](_0x2d5ad0,_0x384287)[_0xdd60('0xe')](function(_0x385ee4){logger[_0xdd60('0xf')](_0xdd60('0x10'),_0x45196,_0xdd60('0x11'));logger[_0xdd60('0x12')](_0xdd60('0x13'),_0x45196,_0xdd60('0x11'),JSON['stringify'](_0x385ee4));if(_0x385ee4[_0xdd60('0x14')]){if(_0x385ee4[_0xdd60('0x14')][_0xdd60('0x15')]===0x1f4){logger[_0xdd60('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x45196,_0x385ee4[_0xdd60('0x14')]['message']);return _0x2ada1e(_0x385ee4[_0xdd60('0x14')][_0xdd60('0x16')]);}logger[_0xdd60('0x14')](_0xdd60('0x10'),_0x45196,_0x385ee4[_0xdd60('0x14')][_0xdd60('0x16')]);return _0x34bb12(_0x385ee4[_0xdd60('0x14')][_0xdd60('0x16')]);}else{logger[_0xdd60('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x45196,'request\x20sent');_0x34bb12(_0x385ee4[_0xdd60('0x17')]['message']);}})['catch'](function(_0x3a73b3){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x45196,_0x3a73b3);_0x2ada1e(_0x3a73b3);});});}exports[_0xdd60('0x18')]=function(_0x42d00e){var _0x3d4062=this;return new Promise(function(_0x28f3cf,_0x381d4b){return db[_0xdd60('0x19')][_0xdd60('0x1a')]({'raw':_0x42d00e[_0xdd60('0x1b')]?_0x42d00e[_0xdd60('0x1b')][_0xdd60('0x1c')]===undefined?!![]:![]:!![],'where':_0x42d00e['options']?_0x42d00e[_0xdd60('0x1b')][_0xdd60('0x1d')]||null:null,'attributes':_0x42d00e['options']?_0x42d00e['options'][_0xdd60('0x1e')]||null:null,'limit':_0x42d00e[_0xdd60('0x1b')]?_0x42d00e[_0xdd60('0x1b')][_0xdd60('0x1f')]||null:null,'include':_0x42d00e[_0xdd60('0x1b')]?_0x42d00e[_0xdd60('0x1b')][_0xdd60('0x20')]?_['map'](_0x42d00e[_0xdd60('0x1b')][_0xdd60('0x20')],function(_0x26b585){return{'model':db[_0x26b585['model']],'as':_0x26b585['as'],'attributes':_0x26b585[_0xdd60('0x1e')],'include':_0x26b585[_0xdd60('0x20')]?_['map'](_0x26b585[_0xdd60('0x20')],function(_0x5691c8){return{'model':db[_0x5691c8[_0xdd60('0x21')]],'as':_0x5691c8['as'],'attributes':_0x5691c8['attributes'],'include':_0x5691c8[_0xdd60('0x20')]?_[_0xdd60('0x22')](_0x5691c8[_0xdd60('0x20')],function(_0x5ef94d){return{'model':db[_0x5ef94d['model']],'as':_0x5ef94d['as'],'attributes':_0x5ef94d[_0xdd60('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea352){logger[_0xdd60('0xf')](_0xdd60('0x18'),_0x42d00e);logger[_0xdd60('0x12')](_0xdd60('0x18'),_0x42d00e,JSON['stringify'](_0x3ea352));_0x28f3cf(_0x3ea352);})[_0xdd60('0x23')](function(_0x10f42a){logger['error'](_0xdd60('0x18'),_0x10f42a[_0xdd60('0x16')],_0x42d00e);_0x381d4b(_0x3d4062[_0xdd60('0x14')](0x1f4,_0x10f42a[_0xdd60('0x16')]));});});};exports[_0xdd60('0x24')]=function(_0x1546a9){var _0x177e4a=this;return new Promise(function(_0x566a95,_0x49bd83){return db[_0xdd60('0x19')][_0xdd60('0x25')](_0x1546a9['body'],{'raw':_0x1546a9[_0xdd60('0x1b')]?_0x1546a9['options']['raw']===undefined?!![]:![]:!![]})[_0xdd60('0xe')](function(_0x2ba9a5){logger[_0xdd60('0xf')](_0xdd60('0x24'),_0x1546a9);logger[_0xdd60('0x12')](_0xdd60('0x24'),_0x1546a9,JSON['stringify'](_0x2ba9a5));_0x566a95(_0x2ba9a5);})[_0xdd60('0x23')](function(_0x554180){logger[_0xdd60('0x14')](_0xdd60('0x24'),_0x554180['message'],_0x1546a9);_0x49bd83(_0x177e4a[_0xdd60('0x14')](0x1f4,_0x554180[_0xdd60('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x33e9d3){var _0x597222=this;return new Promise(function(_0x26668a,_0x2f0761){return db[_0xdd60('0x19')][_0xdd60('0x26')](_0x33e9d3[_0xdd60('0x27')],{'raw':_0x33e9d3[_0xdd60('0x1b')]?_0x33e9d3[_0xdd60('0x1b')][_0xdd60('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33e9d3['options']?_0x33e9d3[_0xdd60('0x1b')][_0xdd60('0x1d')]||null:null,'attributes':_0x33e9d3[_0xdd60('0x1b')]?_0x33e9d3[_0xdd60('0x1b')][_0xdd60('0x1e')]||null:null,'limit':_0x33e9d3[_0xdd60('0x1b')]?_0x33e9d3['options'][_0xdd60('0x1f')]||null:null})[_0xdd60('0xe')](function(_0x3394f2){logger[_0xdd60('0xf')]('UpdateVoiceQueueReport',_0x33e9d3);logger[_0xdd60('0x12')](_0xdd60('0x28'),_0x33e9d3,JSON[_0xdd60('0x29')](_0x3394f2));_0x26668a(_0x3394f2);})['catch'](function(_0x4410b2){logger[_0xdd60('0x14')]('UpdateVoiceQueueReport',_0x4410b2['message'],_0x33e9d3);_0x2f0761(_0x597222[_0xdd60('0x14')](0x1f4,_0x4410b2['message']));});});};
\ No newline at end of file
index 44b3c49..5383a95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbd0=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','voiceQueueReport:'];(function(_0x8cc7a6,_0x74ce1b){var _0xff3944=function(_0x22f8b0){while(--_0x22f8b0){_0x8cc7a6['push'](_0x8cc7a6['shift']());}};_0xff3944(++_0x74ce1b);}(_0xdbd0,0x88));var _0x0dbd=function(_0x1ce197,_0x166975){_0x1ce197=_0x1ce197-0x0;var _0x1328cf=_0xdbd0[_0x1ce197];return _0x1328cf;};'use strict';var VoiceQueueReportEvents=require(_0x0dbd('0x0'));var events=[_0x0dbd('0x1'),_0x0dbd('0x2'),_0x0dbd('0x3')];function createListener(_0x4392ca,_0x58ef9e){return function(_0x3ac5c2){_0x58ef9e[_0x0dbd('0x4')](_0x4392ca,_0x3ac5c2);};}function removeListener(_0x1aeffb,_0x5ec8d7){return function(){VoiceQueueReportEvents[_0x0dbd('0x5')](_0x1aeffb,_0x5ec8d7);};}exports[_0x0dbd('0x6')]=function(_0xcd515f){for(var _0x3bd770=0x0,_0x4b653b=events['length'];_0x3bd770<_0x4b653b;_0x3bd770++){var _0xcb72c2=events[_0x3bd770];var _0x3b3f21=createListener(_0x0dbd('0x7')+_0xcb72c2,_0xcd515f);VoiceQueueReportEvents['on'](_0xcb72c2,_0x3b3f21);}};
\ No newline at end of file
+var _0x4c7b=['register','length','./voiceQueueReport.events','remove','emit','removeListener'];(function(_0x266195,_0x410f94){var _0x4e73ed=function(_0x53210c){while(--_0x53210c){_0x266195['push'](_0x266195['shift']());}};_0x4e73ed(++_0x410f94);}(_0x4c7b,0x128));var _0xb4c7=function(_0x7a4a3e,_0x3a1b11){_0x7a4a3e=_0x7a4a3e-0x0;var _0x47e961=_0x4c7b[_0x7a4a3e];return _0x47e961;};'use strict';var VoiceQueueReportEvents=require(_0xb4c7('0x0'));var events=['save',_0xb4c7('0x1'),'update'];function createListener(_0x10a056,_0x1b4345){return function(_0x536f4d){_0x1b4345[_0xb4c7('0x2')](_0x10a056,_0x536f4d);};}function removeListener(_0x47912f,_0x319e4d){return function(){VoiceQueueReportEvents[_0xb4c7('0x3')](_0x47912f,_0x319e4d);};}exports[_0xb4c7('0x4')]=function(_0x898b7){for(var _0x26689a=0x0,_0x264d14=events[_0xb4c7('0x5')];_0x26689a<_0x264d14;_0x26689a++){var _0x562388=events[_0x26689a];var _0x5822a8=createListener('voiceQueueReport:'+_0x562388,_0x898b7);VoiceQueueReportEvents['on'](_0x562388,_0x5822a8);}};
\ No newline at end of file
index ac116b7..dd82bf4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed0b=['./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ba386,_0x3442ba){var _0x16933c=function(_0x1d1165){while(--_0x1d1165){_0x5ba386['push'](_0x5ba386['shift']());}};_0x16933c(++_0x3442ba);}(_0xed0b,0x1c8));var _0xbed0=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xed0b[_0x644ecd];return _0x1c66ce;};'use strict';var multer=require(_0xbed0('0x0'));var util=require('util');var path=require(_0xbed0('0x1'));var timeout=require('connect-timeout');var express=require(_0xbed0('0x2'));var router=express[_0xbed0('0x3')]();var fs_extra=require(_0xbed0('0x4'));var auth=require(_0xbed0('0x5'));var interaction=require(_0xbed0('0x6'));var config=require(_0xbed0('0x7'));var controller=require(_0xbed0('0x8'));router[_0xbed0('0x9')]('/',auth[_0xbed0('0xa')](),controller[_0xbed0('0xb')]);router[_0xbed0('0x9')](_0xbed0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbed0('0xd')]('/',auth[_0xbed0('0xa')](),controller['create']);router['put'](_0xbed0('0xc'),auth['isAuthenticated'](),controller[_0xbed0('0xe')]);router[_0xbed0('0xf')](_0xbed0('0xc'),auth[_0xbed0('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xcf66=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','create','put','update','destroy'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0xcf66,0x110));var _0x6cf6=function(_0x4e1d39,_0x4286bb){_0x4e1d39=_0x4e1d39-0x0;var _0x5920eb=_0xcf66[_0x4e1d39];return _0x5920eb;};'use strict';var multer=require(_0x6cf6('0x0'));var util=require('util');var path=require(_0x6cf6('0x1'));var timeout=require(_0x6cf6('0x2'));var express=require(_0x6cf6('0x3'));var router=express[_0x6cf6('0x4')]();var fs_extra=require(_0x6cf6('0x5'));var auth=require(_0x6cf6('0x6'));var interaction=require(_0x6cf6('0x7'));var config=require(_0x6cf6('0x8'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x6cf6('0x9')](),controller[_0x6cf6('0xa')]);router[_0x6cf6('0xb')](_0x6cf6('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6cf6('0xd')]);router[_0x6cf6('0xe')](_0x6cf6('0xc'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0xf')]);router['delete'](_0x6cf6('0xc'),auth['isAuthenticated'](),controller[_0x6cf6('0x10')]);module['exports']=router;
\ No newline at end of file
index d6e6a27..4a7c1bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e5a=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x5a79ce,_0x58c9cc){var _0x319707=function(_0x430984){while(--_0x430984){_0x5a79ce['push'](_0x5a79ce['shift']());}};_0x319707(++_0x58c9cc);}(_0x2e5a,0xec));var _0xa2e5=function(_0x1bf2a2,_0x2fb005){_0x1bf2a2=_0x1bf2a2-0x0;var _0x50ad5e=_0x2e5a[_0x1bf2a2];return _0x50ad5e;};'use strict';var Sequelize=require(_0xa2e5('0x0'));var moment=require(_0xa2e5('0x1'));module[_0xa2e5('0x2')]={'time':{'type':Sequelize[_0xa2e5('0x3')]},'callid':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa2e5('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa2e5('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xa2e5('0x5'))}};
\ No newline at end of file
+var _0x4327=['literal','STRING','DATE'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x4327,0x142));var _0x7432=function(_0x46cb21,_0x482f03){_0x46cb21=_0x46cb21-0x0;var _0x6dc6dc=_0x4327[_0x46cb21];return _0x6dc6dc;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x7432('0x0')]},'callid':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7432('0x0')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7432('0x1')],'allowNull':![],'defaultValue':Sequelize[_0x7432('0x2')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}};
\ No newline at end of file
index f0c9611..3ad1258 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e65=['destroy','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','rawAttributes','keys','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','reject','update','then'];(function(_0x28fbb1,_0x57f1ef){var _0x40100d=function(_0x4f66c5){while(--_0x4f66c5){_0x28fbb1['push'](_0x28fbb1['shift']());}};_0x40100d(++_0x57f1ef);}(_0x8e65,0xb6));var _0x58e6=function(_0x30bba0,_0x2f9580){_0x30bba0=_0x30bba0-0x0;var _0x507c27=_0x8e65[_0x30bba0];return _0x507c27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58e6('0x0'));var zipdir=require(_0x58e6('0x1'));var jsonpatch=require(_0x58e6('0x2'));var rp=require(_0x58e6('0x3'));var moment=require(_0x58e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x58e6('0x5'));var util=require(_0x58e6('0x6'));var path=require(_0x58e6('0x7'));var sox=require(_0x58e6('0x8'));var csv=require(_0x58e6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58e6('0xa'));var _=require(_0x58e6('0xb'));var squel=require('squel');var crypto=require(_0x58e6('0xc'));var jsforce=require(_0x58e6('0xd'));var deskjs=require(_0x58e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x58e6('0xf'));var Papa=require(_0x58e6('0x10'));var Redis=require(_0x58e6('0x11'));var authService=require(_0x58e6('0x12'));var qs=require(_0x58e6('0x13'));var as=require(_0x58e6('0x14'));var hardwareService=require(_0x58e6('0x15'));var logger=require(_0x58e6('0x16'))(_0x58e6('0x17'));var utils=require('../../config/utils');var config=require(_0x58e6('0x18'));var licenseUtil=require(_0x58e6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a71d,_0xd782d6){_0xd782d6=_0xd782d6||0xcc;return function(_0xf84b01){if(_0xf84b01){return _0x36a71d['sendStatus'](_0xd782d6);}return _0x36a71d[_0x58e6('0x1a')](_0xd782d6)[_0x58e6('0x1b')]();};}function respondWithResult(_0x3ee733,_0x1d07bd){_0x1d07bd=_0x1d07bd||0xc8;return function(_0x5e8e03){if(_0x5e8e03){return _0x3ee733[_0x58e6('0x1a')](_0x1d07bd)[_0x58e6('0x1c')](_0x5e8e03);}};}function respondWithFilteredResult(_0x107752,_0x3be10a){return function(_0x8e1bcf){if(_0x8e1bcf){var _0x486a21=typeof _0x3be10a[_0x58e6('0x1d')]===_0x58e6('0x1e')&&typeof _0x3be10a['limit']===_0x58e6('0x1e');var _0x101184=_0x8e1bcf[_0x58e6('0x1f')];var _0x76d1b8=_0x486a21?0x0:_0x3be10a[_0x58e6('0x1d')];var _0xd8fe78=_0x486a21?_0x8e1bcf[_0x58e6('0x1f')]:_0x3be10a[_0x58e6('0x1d')]+_0x3be10a[_0x58e6('0x20')];var _0x1184fe;if(_0xd8fe78>=_0x101184){_0xd8fe78=_0x101184;_0x1184fe=0xc8;}else{_0x1184fe=0xce;}_0x107752[_0x58e6('0x1a')](_0x1184fe);return _0x107752['set']('Content-Range',_0x76d1b8+'-'+_0xd8fe78+'/'+_0x101184)[_0x58e6('0x1c')](_0x8e1bcf);}return null;};}function patchUpdates(_0x51a517){return function(_0x11d8ac){try{jsonpatch[_0x58e6('0x21')](_0x11d8ac,_0x51a517,!![]);}catch(_0x668b03){return BPromise[_0x58e6('0x22')](_0x668b03);}return _0x11d8ac['save']();};}function saveUpdates(_0x478823,_0x2d833b){return function(_0x1f24d8){if(_0x1f24d8){return _0x1f24d8[_0x58e6('0x23')](_0x478823)[_0x58e6('0x24')](function(_0x1dc47e){return _0x1dc47e;});}return null;};}function removeEntity(_0x225464,_0xb92126){return function(_0x2b083e){if(_0x2b083e){return _0x2b083e[_0x58e6('0x25')]()['then'](function(){_0x225464['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x490dc3,_0x31d3f4){return function(_0x510ffe){if(!_0x510ffe){_0x490dc3[_0x58e6('0x26')](0x194);}return _0x510ffe;};}function handleError(_0x49b2aa,_0x347670){_0x347670=_0x347670||0x1f4;return function(_0x17d826){logger[_0x58e6('0x27')](_0x17d826[_0x58e6('0x28')]);if(_0x17d826[_0x58e6('0x29')]){delete _0x17d826[_0x58e6('0x29')];}_0x49b2aa[_0x58e6('0x1a')](_0x347670)[_0x58e6('0x2a')](_0x17d826);};}exports[_0x58e6('0x2b')]=function(_0x33ed68,_0x4561b1){var _0x18edb4={},_0x297f7b={},_0x2d563d={'count':0x0,'rows':[]};var _0xd37849=_[_0x58e6('0x2c')](db[_0x58e6('0x2d')]['rawAttributes'],function(_0x5621c4){return{'name':_0x5621c4['fieldName'],'type':_0x5621c4['type']['key']};});_0x297f7b[_0x58e6('0x2e')]=_['map'](_0xd37849,'name');_0x297f7b[_0x58e6('0x2f')]=_['keys'](_0x33ed68[_0x58e6('0x2f')]);_0x297f7b[_0x58e6('0x30')]=_[_0x58e6('0x31')](_0x297f7b[_0x58e6('0x2e')],_0x297f7b[_0x58e6('0x2f')]);_0x18edb4[_0x58e6('0x32')]=_[_0x58e6('0x31')](_0x297f7b[_0x58e6('0x2e')],qs['fields'](_0x33ed68[_0x58e6('0x2f')][_0x58e6('0x33')]));_0x18edb4[_0x58e6('0x32')]=_0x18edb4[_0x58e6('0x32')][_0x58e6('0x34')]?_0x18edb4[_0x58e6('0x32')]:_0x297f7b[_0x58e6('0x2e')];if(!_0x33ed68['query'][_0x58e6('0x35')]('nolimit')){_0x18edb4[_0x58e6('0x20')]=qs[_0x58e6('0x20')](_0x33ed68[_0x58e6('0x2f')]['limit']);_0x18edb4[_0x58e6('0x1d')]=qs[_0x58e6('0x1d')](_0x33ed68['query'][_0x58e6('0x1d')]);}_0x18edb4['order']=qs[_0x58e6('0x36')](_0x33ed68[_0x58e6('0x2f')][_0x58e6('0x36')]);_0x18edb4[_0x58e6('0x37')]=qs[_0x58e6('0x30')](_[_0x58e6('0x38')](_0x33ed68['query'],_0x297f7b[_0x58e6('0x30')]),_0xd37849);if(_0x33ed68[_0x58e6('0x2f')][_0x58e6('0x39')]){_0x18edb4[_0x58e6('0x37')]=_[_0x58e6('0x3a')](_0x18edb4['where'],{'$or':_[_0x58e6('0x2c')](_0xd37849,function(_0xc5bf84){if(_0xc5bf84[_0x58e6('0x3b')]!==_0x58e6('0x3c')){var _0x127ce7={};_0x127ce7[_0xc5bf84['name']]={'$like':'%'+_0x33ed68[_0x58e6('0x2f')][_0x58e6('0x39')]+'%'};return _0x127ce7;}})});}_0x18edb4=_[_0x58e6('0x3a')]({},_0x18edb4,_0x33ed68[_0x58e6('0x3d')]);var _0x367fd7={'where':_0x18edb4['where']};return db['VoiceQueuesLog'][_0x58e6('0x1f')](_0x367fd7)[_0x58e6('0x24')](function(_0x17b106){_0x2d563d[_0x58e6('0x1f')]=_0x17b106;if(_0x33ed68[_0x58e6('0x2f')]['includeAll']){_0x18edb4['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x58e6('0x3e')](_0x18edb4);})['then'](function(_0x22ab72){_0x2d563d['rows']=_0x22ab72;return _0x2d563d;})[_0x58e6('0x24')](respondWithFilteredResult(_0x4561b1,_0x18edb4))[_0x58e6('0x3f')](handleError(_0x4561b1,null));};exports[_0x58e6('0x40')]=function(_0x14f234,_0xcc2347){var _0x110bea={'raw':!![],'where':{'id':_0x14f234[_0x58e6('0x41')]['id']}},_0x5733cb={};_0x5733cb[_0x58e6('0x2e')]=_['keys'](db['VoiceQueuesLog'][_0x58e6('0x42')]);_0x5733cb[_0x58e6('0x2f')]=_[_0x58e6('0x43')](_0x14f234[_0x58e6('0x2f')]);_0x5733cb[_0x58e6('0x30')]=_['intersection'](_0x5733cb[_0x58e6('0x2e')],_0x5733cb[_0x58e6('0x2f')]);_0x110bea['attributes']=_[_0x58e6('0x31')](_0x5733cb['model'],qs['fields'](_0x14f234[_0x58e6('0x2f')][_0x58e6('0x33')]));_0x110bea[_0x58e6('0x32')]=_0x110bea[_0x58e6('0x32')]['length']?_0x110bea[_0x58e6('0x32')]:_0x5733cb[_0x58e6('0x2e')];if(_0x14f234[_0x58e6('0x2f')][_0x58e6('0x44')]){_0x110bea[_0x58e6('0x45')]=[{'all':!![]}];}_0x110bea=_[_0x58e6('0x3a')]({},_0x110bea,_0x14f234[_0x58e6('0x3d')]);return db[_0x58e6('0x2d')][_0x58e6('0x46')](_0x110bea)[_0x58e6('0x24')](handleEntityNotFound(_0xcc2347,null))[_0x58e6('0x24')](respondWithResult(_0xcc2347,null))[_0x58e6('0x3f')](handleError(_0xcc2347,null));};exports[_0x58e6('0x47')]=function(_0x57c9f6,_0x9b6fad){return db['VoiceQueuesLog'][_0x58e6('0x47')](_0x57c9f6[_0x58e6('0x48')],{})['then'](respondWithResult(_0x9b6fad,0xc9))[_0x58e6('0x3f')](handleError(_0x9b6fad,null));};exports['update']=function(_0x3f3d7d,_0x2089b2){if(_0x3f3d7d[_0x58e6('0x48')]['id']){delete _0x3f3d7d[_0x58e6('0x48')]['id'];}return db[_0x58e6('0x2d')][_0x58e6('0x46')]({'where':{'id':_0x3f3d7d[_0x58e6('0x41')]['id']}})[_0x58e6('0x24')](handleEntityNotFound(_0x2089b2,null))[_0x58e6('0x24')](saveUpdates(_0x3f3d7d[_0x58e6('0x48')],null))[_0x58e6('0x24')](respondWithResult(_0x2089b2,null))[_0x58e6('0x3f')](handleError(_0x2089b2,null));};exports['destroy']=function(_0x74bc89,_0x54ea5b){return db[_0x58e6('0x2d')][_0x58e6('0x46')]({'where':{'id':_0x74bc89[_0x58e6('0x41')]['id']}})[_0x58e6('0x24')](handleEntityNotFound(_0x54ea5b,null))[_0x58e6('0x24')](removeEntity(_0x54ea5b,null))['catch'](handleError(_0x54ea5b,null));};
\ No newline at end of file
+var _0xb55a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','then','error','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','includeAll','find','catch','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0xb55a,0x85));var _0xab55=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xb55a[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require(_0xab55('0x0'));var rimraf=require(_0xab55('0x1'));var zipdir=require(_0xab55('0x2'));var jsonpatch=require(_0xab55('0x3'));var rp=require(_0xab55('0x4'));var moment=require(_0xab55('0x5'));var BPromise=require(_0xab55('0x6'));var Mustache=require('mustache');var util=require(_0xab55('0x7'));var path=require(_0xab55('0x8'));var sox=require(_0xab55('0x9'));var csv=require(_0xab55('0xa'));var ejs=require(_0xab55('0xb'));var fs=require('fs');var fs_extra=require(_0xab55('0xc'));var _=require('lodash');var squel=require(_0xab55('0xd'));var crypto=require(_0xab55('0xe'));var jsforce=require(_0xab55('0xf'));var deskjs=require(_0xab55('0x10'));var toCsv=require(_0xab55('0xa'));var querystring=require(_0xab55('0x11'));var Papa=require(_0xab55('0x12'));var Redis=require(_0xab55('0x13'));var authService=require(_0xab55('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xab55('0x15'));var hardwareService=require(_0xab55('0x16'));var logger=require(_0xab55('0x17'))('api');var utils=require(_0xab55('0x18'));var config=require(_0xab55('0x19'));var licenseUtil=require(_0xab55('0x1a'));var db=require(_0xab55('0x1b'))['db'];function respondWithStatusCode(_0x27117c,_0x37a918){_0x37a918=_0x37a918||0xcc;return function(_0x304bc4){if(_0x304bc4){return _0x27117c[_0xab55('0x1c')](_0x37a918);}return _0x27117c[_0xab55('0x1d')](_0x37a918)[_0xab55('0x1e')]();};}function respondWithResult(_0x304c50,_0x3d7719){_0x3d7719=_0x3d7719||0xc8;return function(_0x5c11ed){if(_0x5c11ed){return _0x304c50[_0xab55('0x1d')](_0x3d7719)[_0xab55('0x1f')](_0x5c11ed);}};}function respondWithFilteredResult(_0x2d90cf,_0x3b2b7d){return function(_0x49f533){if(_0x49f533){var _0x4a7124=typeof _0x3b2b7d[_0xab55('0x20')]===_0xab55('0x21')&&typeof _0x3b2b7d[_0xab55('0x22')]===_0xab55('0x21');var _0x397a8a=_0x49f533['count'];var _0x53d59a=_0x4a7124?0x0:_0x3b2b7d[_0xab55('0x20')];var _0x3edb17=_0x4a7124?_0x49f533[_0xab55('0x23')]:_0x3b2b7d[_0xab55('0x20')]+_0x3b2b7d['limit'];var _0x4c7380;if(_0x3edb17>=_0x397a8a){_0x3edb17=_0x397a8a;_0x4c7380=0xc8;}else{_0x4c7380=0xce;}_0x2d90cf[_0xab55('0x1d')](_0x4c7380);return _0x2d90cf['set']('Content-Range',_0x53d59a+'-'+_0x3edb17+'/'+_0x397a8a)[_0xab55('0x1f')](_0x49f533);}return null;};}function patchUpdates(_0x278154){return function(_0x3020e8){try{jsonpatch['apply'](_0x3020e8,_0x278154,!![]);}catch(_0x5bb895){return BPromise[_0xab55('0x24')](_0x5bb895);}return _0x3020e8['save']();};}function saveUpdates(_0x2d075f,_0x1d472e){return function(_0xdf6c40){if(_0xdf6c40){return _0xdf6c40['update'](_0x2d075f)[_0xab55('0x25')](function(_0x524733){return _0x524733;});}return null;};}function removeEntity(_0x2c2d2e,_0x2b49df){return function(_0x508bd3){if(_0x508bd3){return _0x508bd3['destroy']()[_0xab55('0x25')](function(){_0x2c2d2e[_0xab55('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a92c1,_0x372289){return function(_0x55a788){if(!_0x55a788){_0x1a92c1[_0xab55('0x1c')](0x194);}return _0x55a788;};}function handleError(_0xa1cd56,_0x49abaa){_0x49abaa=_0x49abaa||0x1f4;return function(_0x2fd618){logger[_0xab55('0x26')](_0x2fd618['stack']);if(_0x2fd618[_0xab55('0x27')]){delete _0x2fd618[_0xab55('0x27')];}_0xa1cd56[_0xab55('0x1d')](_0x49abaa)[_0xab55('0x28')](_0x2fd618);};}exports['index']=function(_0x3dc059,_0x4b2dbb){var _0x5284b8={},_0xd16bb3={},_0x30ae17={'count':0x0,'rows':[]};var _0x11958a=_[_0xab55('0x29')](db[_0xab55('0x2a')][_0xab55('0x2b')],function(_0x4f1722){return{'name':_0x4f1722[_0xab55('0x2c')],'type':_0x4f1722['type'][_0xab55('0x2d')]};});_0xd16bb3['model']=_[_0xab55('0x29')](_0x11958a,_0xab55('0x27'));_0xd16bb3['query']=_[_0xab55('0x2e')](_0x3dc059[_0xab55('0x2f')]);_0xd16bb3[_0xab55('0x30')]=_[_0xab55('0x31')](_0xd16bb3[_0xab55('0x32')],_0xd16bb3[_0xab55('0x2f')]);_0x5284b8[_0xab55('0x33')]=_[_0xab55('0x31')](_0xd16bb3['model'],qs[_0xab55('0x34')](_0x3dc059[_0xab55('0x2f')][_0xab55('0x34')]));_0x5284b8[_0xab55('0x33')]=_0x5284b8['attributes'][_0xab55('0x35')]?_0x5284b8[_0xab55('0x33')]:_0xd16bb3['model'];if(!_0x3dc059[_0xab55('0x2f')][_0xab55('0x36')](_0xab55('0x37'))){_0x5284b8[_0xab55('0x22')]=qs[_0xab55('0x22')](_0x3dc059[_0xab55('0x2f')][_0xab55('0x22')]);_0x5284b8[_0xab55('0x20')]=qs[_0xab55('0x20')](_0x3dc059['query'][_0xab55('0x20')]);}_0x5284b8[_0xab55('0x38')]=qs[_0xab55('0x39')](_0x3dc059[_0xab55('0x2f')][_0xab55('0x39')]);_0x5284b8[_0xab55('0x3a')]=qs[_0xab55('0x30')](_['pick'](_0x3dc059['query'],_0xd16bb3['filters']),_0x11958a);if(_0x3dc059['query'][_0xab55('0x3b')]){_0x5284b8[_0xab55('0x3a')]=_[_0xab55('0x3c')](_0x5284b8[_0xab55('0x3a')],{'$or':_[_0xab55('0x29')](_0x11958a,function(_0x251a70){if(_0x251a70[_0xab55('0x3d')]!==_0xab55('0x3e')){var _0x535aa7={};_0x535aa7[_0x251a70['name']]={'$like':'%'+_0x3dc059[_0xab55('0x2f')][_0xab55('0x3b')]+'%'};return _0x535aa7;}})});}_0x5284b8=_['merge']({},_0x5284b8,_0x3dc059[_0xab55('0x3f')]);var _0x5749f7={'where':_0x5284b8[_0xab55('0x3a')]};return db['VoiceQueuesLog'][_0xab55('0x23')](_0x5749f7)[_0xab55('0x25')](function(_0x316ce3){_0x30ae17['count']=_0x316ce3;if(_0x3dc059[_0xab55('0x2f')]['includeAll']){_0x5284b8[_0xab55('0x40')]=[{'all':!![]}];}return db[_0xab55('0x2a')][_0xab55('0x41')](_0x5284b8);})['then'](function(_0x2982cc){_0x30ae17[_0xab55('0x42')]=_0x2982cc;return _0x30ae17;})[_0xab55('0x25')](respondWithFilteredResult(_0x4b2dbb,_0x5284b8))['catch'](handleError(_0x4b2dbb,null));};exports['show']=function(_0x5ea0b6,_0x37bb){var _0x2836cf={'raw':!![],'where':{'id':_0x5ea0b6['params']['id']}},_0x230214={};_0x230214[_0xab55('0x32')]=_[_0xab55('0x2e')](db[_0xab55('0x2a')]['rawAttributes']);_0x230214[_0xab55('0x2f')]=_['keys'](_0x5ea0b6[_0xab55('0x2f')]);_0x230214[_0xab55('0x30')]=_[_0xab55('0x31')](_0x230214['model'],_0x230214[_0xab55('0x2f')]);_0x2836cf[_0xab55('0x33')]=_[_0xab55('0x31')](_0x230214[_0xab55('0x32')],qs[_0xab55('0x34')](_0x5ea0b6[_0xab55('0x2f')][_0xab55('0x34')]));_0x2836cf[_0xab55('0x33')]=_0x2836cf[_0xab55('0x33')][_0xab55('0x35')]?_0x2836cf[_0xab55('0x33')]:_0x230214[_0xab55('0x32')];if(_0x5ea0b6[_0xab55('0x2f')][_0xab55('0x43')]){_0x2836cf[_0xab55('0x40')]=[{'all':!![]}];}_0x2836cf=_[_0xab55('0x3c')]({},_0x2836cf,_0x5ea0b6['options']);return db['VoiceQueuesLog'][_0xab55('0x44')](_0x2836cf)['then'](handleEntityNotFound(_0x37bb,null))[_0xab55('0x25')](respondWithResult(_0x37bb,null))[_0xab55('0x45')](handleError(_0x37bb,null));};exports[_0xab55('0x46')]=function(_0x596f1c,_0x47fe1d){return db[_0xab55('0x2a')][_0xab55('0x46')](_0x596f1c[_0xab55('0x47')],{})[_0xab55('0x25')](respondWithResult(_0x47fe1d,0xc9))[_0xab55('0x45')](handleError(_0x47fe1d,null));};exports['update']=function(_0x386201,_0x3ad9b6){if(_0x386201[_0xab55('0x47')]['id']){delete _0x386201[_0xab55('0x47')]['id'];}return db['VoiceQueuesLog'][_0xab55('0x44')]({'where':{'id':_0x386201['params']['id']}})['then'](handleEntityNotFound(_0x3ad9b6,null))[_0xab55('0x25')](saveUpdates(_0x386201[_0xab55('0x47')],null))[_0xab55('0x25')](respondWithResult(_0x3ad9b6,null))[_0xab55('0x45')](handleError(_0x3ad9b6,null));};exports[_0xab55('0x48')]=function(_0x13e182,_0x44f251){return db['VoiceQueuesLog'][_0xab55('0x44')]({'where':{'id':_0x13e182[_0xab55('0x49')]['id']}})[_0xab55('0x25')](handleEntityNotFound(_0x44f251,null))[_0xab55('0x25')](removeEntity(_0x44f251,null))['catch'](handleError(_0x44f251,null));};
\ No newline at end of file
index 6d8a3e1..bc267b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb95d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger'];(function(_0x4e4413,_0x37a767){var _0x433746=function(_0x1b61e1){while(--_0x1b61e1){_0x4e4413['push'](_0x4e4413['shift']());}};_0x433746(++_0x37a767);}(_0xb95d,0x1c5));var _0xdb95=function(_0x5c2cc6,_0x6a7e4a){_0x5c2cc6=_0x5c2cc6-0x0;var _0x575df7=_0xb95d[_0x5c2cc6];return _0x575df7;};'use strict';var _=require(_0xdb95('0x0'));var util=require('util');var logger=require(_0xdb95('0x1'))(_0xdb95('0x2'));var moment=require(_0xdb95('0x3'));var BPromise=require(_0xdb95('0x4'));var rp=require(_0xdb95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb95('0x6'));var config=require(_0xdb95('0x7'));var attributes=require(_0xdb95('0x8'));module['exports']=function(_0x23f12a,_0x58553c){return _0x23f12a['define']('VoiceQueuesLog',attributes,{'tableName':_0xdb95('0x9'),'paranoid':![],'indexes':[{'name':_0xdb95('0xa'),'fields':[_0xdb95('0xb'),_0xdb95('0xc')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x527c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x5b3087,_0x91c425){var _0x2aae2d=function(_0x4b6012){while(--_0x4b6012){_0x5b3087['push'](_0x5b3087['shift']());}};_0x2aae2d(++_0x91c425);}(_0x527c,0x194));var _0xc527=function(_0x3f3026,_0x35d62a){_0x3f3026=_0x3f3026-0x0;var _0x4e87bf=_0x527c[_0x3f3026];return _0x4e87bf;};'use strict';var _=require(_0xc527('0x0'));var util=require('util');var logger=require(_0xc527('0x1'))(_0xc527('0x2'));var moment=require(_0xc527('0x3'));var BPromise=require(_0xc527('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc527('0x5'));var rimraf=require(_0xc527('0x6'));var config=require(_0xc527('0x7'));var attributes=require(_0xc527('0x8'));module[_0xc527('0x9')]=function(_0x3becea,_0xbae80){return _0x3becea[_0xc527('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0xc527('0xb'),'paranoid':![],'indexes':[{'name':_0xc527('0xc'),'fields':[_0xc527('0xd'),_0xc527('0xe')]}],'timestamps':![]});};
\ No newline at end of file
index 602eeef..8cce0ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x688a=['stringify','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3a341c,_0x2c7b89){var _0x4eb8bd=function(_0x213a8b){while(--_0x213a8b){_0x3a341c['push'](_0x3a341c['shift']());}};_0x4eb8bd(++_0x2c7b89);}(_0x688a,0x124));var _0xa688=function(_0x2f5eb8,_0xe955f7){_0x2f5eb8=_0x2f5eb8-0x0;var _0x5efef4=_0x688a[_0x2f5eb8];return _0x5efef4;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var moment=require(_0xa688('0x2'));var BPromise=require('bluebird');var rs=require(_0xa688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa688('0x4'))['db'];var utils=require(_0xa688('0x5'));var logger=require('../../config/logger')(_0xa688('0x6'));var config=require(_0xa688('0x7'));var jayson=require(_0xa688('0x8'));var client=jayson[_0xa688('0x9')][_0xa688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a362a,_0x49e75d,_0x5aee29){return new BPromise(function(_0x45c969,_0x3f3d81){return client[_0xa688('0xb')](_0x2a362a,_0x5aee29)['then'](function(_0x4d3b92){logger[_0xa688('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x49e75d,'request\x20sent');logger[_0xa688('0xd')](_0xa688('0xe'),_0x49e75d,_0xa688('0xf'),JSON[_0xa688('0x10')](_0x4d3b92));if(_0x4d3b92[_0xa688('0x11')]){if(_0x4d3b92[_0xa688('0x11')]['code']===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x49e75d,_0x4d3b92[_0xa688('0x11')][_0xa688('0x12')]);return _0x3f3d81(_0x4d3b92['error'][_0xa688('0x12')]);}logger['error'](_0xa688('0x13'),_0x49e75d,_0x4d3b92[_0xa688('0x11')]['message']);return _0x45c969(_0x4d3b92['error'][_0xa688('0x12')]);}else{logger['info'](_0xa688('0x13'),_0x49e75d,'request\x20sent');_0x45c969(_0x4d3b92[_0xa688('0x14')][_0xa688('0x12')]);}})[_0xa688('0x15')](function(_0x25b453){logger[_0xa688('0x11')](_0xa688('0x13'),_0x49e75d,_0x25b453);_0x3f3d81(_0x25b453);});});}
\ No newline at end of file
+var _0x3098=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x43a3af,_0x390f28){var _0x7f7472=function(_0x3e99cf){while(--_0x3e99cf){_0x43a3af['push'](_0x43a3af['shift']());}};_0x7f7472(++_0x390f28);}(_0x3098,0x86));var _0x8309=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0x3098[_0x4ba380];return _0x4b111b;};'use strict';var _=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var moment=require(_0x8309('0x2'));var BPromise=require(_0x8309('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8309('0x4'));var db=require(_0x8309('0x5'))['db'];var utils=require(_0x8309('0x6'));var logger=require(_0x8309('0x7'))(_0x8309('0x8'));var config=require(_0x8309('0x9'));var jayson=require(_0x8309('0xa'));var client=jayson[_0x8309('0xb')][_0x8309('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e9ac6,_0x5142f1,_0x35ca92){return new BPromise(function(_0x5c2cd1,_0x421fa5){return client[_0x8309('0xd')](_0x1e9ac6,_0x35ca92)['then'](function(_0x554405){logger[_0x8309('0xe')](_0x8309('0xf'),_0x5142f1,_0x8309('0x10'));logger[_0x8309('0x11')](_0x8309('0x12'),_0x5142f1,'request\x20sent',JSON[_0x8309('0x13')](_0x554405));if(_0x554405[_0x8309('0x14')]){if(_0x554405[_0x8309('0x14')][_0x8309('0x15')]===0x1f4){logger[_0x8309('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5142f1,_0x554405[_0x8309('0x14')]['message']);return _0x421fa5(_0x554405[_0x8309('0x14')]['message']);}logger[_0x8309('0x14')](_0x8309('0xf'),_0x5142f1,_0x554405[_0x8309('0x14')][_0x8309('0x16')]);return _0x5c2cd1(_0x554405[_0x8309('0x14')][_0x8309('0x16')]);}else{logger[_0x8309('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5142f1,'request\x20sent');_0x5c2cd1(_0x554405[_0x8309('0x17')][_0x8309('0x16')]);}})[_0x8309('0x18')](function(_0x33742f){logger[_0x8309('0x14')](_0x8309('0xf'),_0x5142f1,_0x33742f);_0x421fa5(_0x33742f);});});}
\ No newline at end of file
index 4489c07..3c14bdc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bb8=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','destroy','exports'];(function(_0x19a501,_0x263b5e){var _0xc3a3d3=function(_0x11872b){while(--_0x11872b){_0x19a501['push'](_0x19a501['shift']());}};_0xc3a3d3(++_0x263b5e);}(_0x6bb8,0x64));var _0x86bb=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x6bb8[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0x86bb('0x0'));var util=require(_0x86bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x86bb('0x2'));var router=express[_0x86bb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x86bb('0x4'));var interaction=require(_0x86bb('0x5'));var config=require(_0x86bb('0x6'));var controller=require('./voiceRecording.controller');router[_0x86bb('0x7')]('/',auth[_0x86bb('0x8')](),controller['index']);router[_0x86bb('0x7')](_0x86bb('0x9'),auth[_0x86bb('0x8')](),controller[_0x86bb('0xa')]);router[_0x86bb('0x7')](_0x86bb('0xb'),auth['isAuthenticated'](),controller[_0x86bb('0xc')]);router[_0x86bb('0x7')](_0x86bb('0xd'),auth[_0x86bb('0x8')](),controller[_0x86bb('0xe')]);router['get'](_0x86bb('0xf'),controller[_0x86bb('0x10')]);router[_0x86bb('0x7')](_0x86bb('0x11'),auth[_0x86bb('0x8')](),controller[_0x86bb('0x12')]);router[_0x86bb('0x13')]('/',auth[_0x86bb('0x8')](),controller[_0x86bb('0x14')]);router[_0x86bb('0x13')]('/:id/transcribe',auth[_0x86bb('0x8')](),controller['runTranscribe']);router[_0x86bb('0x15')](_0x86bb('0xb'),auth[_0x86bb('0x8')](),controller[_0x86bb('0x16')]);router['delete']('/:id',auth[_0x86bb('0x8')](),controller[_0x86bb('0x17')]);module[_0x86bb('0x18')]=router;
\ No newline at end of file
+var _0x234b=['update','delete','/:id','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x234b,0x1cf));var _0xb234=function(_0x384410,_0x437176){_0x384410=_0x384410-0x0;var _0x5b6b73=_0x234b[_0x384410];return _0x5b6b73;};'use strict';var multer=require(_0xb234('0x0'));var util=require(_0xb234('0x1'));var path=require('path');var timeout=require(_0xb234('0x2'));var express=require(_0xb234('0x3'));var router=express['Router']();var fs_extra=require(_0xb234('0x4'));var auth=require(_0xb234('0x5'));var interaction=require(_0xb234('0x6'));var config=require(_0xb234('0x7'));var controller=require(_0xb234('0x8'));router[_0xb234('0x9')]('/',auth[_0xb234('0xa')](),controller[_0xb234('0xb')]);router[_0xb234('0x9')](_0xb234('0xc'),auth[_0xb234('0xa')](),controller[_0xb234('0xd')]);router[_0xb234('0x9')]('/:id',auth[_0xb234('0xa')](),controller[_0xb234('0xe')]);router['get'](_0xb234('0xf'),auth[_0xb234('0xa')](),controller['download']);router[_0xb234('0x9')](_0xb234('0x10'),controller[_0xb234('0x11')]);router[_0xb234('0x9')](_0xb234('0x12'),auth[_0xb234('0xa')](),controller['downloadTranscribe']);router[_0xb234('0x13')]('/',auth[_0xb234('0xa')](),controller[_0xb234('0x14')]);router[_0xb234('0x13')](_0xb234('0x12'),auth[_0xb234('0xa')](),controller[_0xb234('0x15')]);router[_0xb234('0x16')]('/:id',auth[_0xb234('0xa')](),controller[_0xb234('0x17')]);router[_0xb234('0x18')](_0xb234('0x19'),auth[_0xb234('0xa')](),controller['destroy']);module[_0xb234('0x1a')]=router;
\ No newline at end of file
index e8f401f..c381ff4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}};
\ No newline at end of file
+var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}};
\ No newline at end of file
index 2fad5f4..0f6e6f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa74c=['.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','upload','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xa74c,0x1d3));var _0xca74=function(_0x156c84,_0x452577){_0x156c84=_0x156c84-0x0;var _0x1bb69f=_0xa74c[_0x156c84];return _0x1bb69f;};'use strict';var emlformat=require(_0xca74('0x0'));var rimraf=require(_0xca74('0x1'));var zipdir=require(_0xca74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca74('0x3'));var moment=require(_0xca74('0x4'));var BPromise=require(_0xca74('0x5'));var Mustache=require(_0xca74('0x6'));var util=require(_0xca74('0x7'));var path=require(_0xca74('0x8'));var sox=require(_0xca74('0x9'));var csv=require('to-csv');var ejs=require(_0xca74('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca74('0xb'));var squel=require(_0xca74('0xc'));var crypto=require('crypto');var jsforce=require(_0xca74('0xd'));var deskjs=require(_0xca74('0xe'));var toCsv=require(_0xca74('0xf'));var querystring=require(_0xca74('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xca74('0x11'));var Redis=require(_0xca74('0x12'));var authService=require(_0xca74('0x13'));var qs=require(_0xca74('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca74('0x15'));var logger=require(_0xca74('0x16'))(_0xca74('0x17'));var utils=require(_0xca74('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xca74('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f16c9,_0x1da517){_0x1da517=_0x1da517||0xcc;return function(_0x47e5cd){if(_0x47e5cd){return _0x2f16c9[_0xca74('0x1a')](_0x1da517);}return _0x2f16c9[_0xca74('0x1b')](_0x1da517)[_0xca74('0x1c')]();};}function respondWithResult(_0xea1974,_0x504fb4){_0x504fb4=_0x504fb4||0xc8;return function(_0x2610df){if(_0x2610df){return _0xea1974['status'](_0x504fb4)[_0xca74('0x1d')](_0x2610df);}};}function respondWithFilteredResult(_0x51341e,_0x312446){return function(_0x14b921){if(_0x14b921){var _0x220557=typeof _0x312446[_0xca74('0x1e')]===_0xca74('0x1f')&&typeof _0x312446[_0xca74('0x20')]===_0xca74('0x1f');var _0x1879dd=_0x14b921[_0xca74('0x21')];var _0x2c311a=_0x220557?0x0:_0x312446[_0xca74('0x1e')];var _0xe1bee5=_0x220557?_0x14b921['count']:_0x312446[_0xca74('0x1e')]+_0x312446[_0xca74('0x20')];var _0x2d442f;if(_0xe1bee5>=_0x1879dd){_0xe1bee5=_0x1879dd;_0x2d442f=0xc8;}else{_0x2d442f=0xce;}_0x51341e[_0xca74('0x1b')](_0x2d442f);return _0x51341e[_0xca74('0x22')]('Content-Range',_0x2c311a+'-'+_0xe1bee5+'/'+_0x1879dd)[_0xca74('0x1d')](_0x14b921);}return null;};}function patchUpdates(_0x174761){return function(_0x4181c9){try{jsonpatch[_0xca74('0x23')](_0x4181c9,_0x174761,!![]);}catch(_0x420883){return BPromise['reject'](_0x420883);}return _0x4181c9[_0xca74('0x24')]();};}function saveUpdates(_0x23b3e3,_0x49d961){return function(_0x64a1c1){if(_0x64a1c1){return _0x64a1c1[_0xca74('0x25')](_0x23b3e3)[_0xca74('0x26')](function(_0x7e377b){return _0x7e377b;});}return null;};}function removeEntity(_0x3fff76,_0x45946e){return function(_0x11bee2){if(_0x11bee2){return _0x11bee2[_0xca74('0x27')]()[_0xca74('0x26')](function(){_0x3fff76[_0xca74('0x1b')](0xcc)[_0xca74('0x1c')]();});}};}function handleEntityNotFound(_0x3969d0,_0x48b7d4){return function(_0x6e8c8a){if(!_0x6e8c8a){_0x3969d0['sendStatus'](0x194);}return _0x6e8c8a;};}function handleError(_0x213720,_0x2ecb56){_0x2ecb56=_0x2ecb56||0x1f4;return function(_0x1f3ae5){logger['error'](_0x1f3ae5[_0xca74('0x28')]);if(_0x1f3ae5[_0xca74('0x29')]){delete _0x1f3ae5[_0xca74('0x29')];}_0x213720[_0xca74('0x1b')](_0x2ecb56)[_0xca74('0x2a')](_0x1f3ae5);};}exports[_0xca74('0x2b')]=function(_0x5f505a,_0x1a36e8){var _0x12fc24={},_0x1630a4={},_0x5d9e84={'count':0x0,'rows':[]};var _0x2f6b27=_[_0xca74('0x2c')](db[_0xca74('0x2d')]['rawAttributes'],function(_0x345218){return{'name':_0x345218[_0xca74('0x2e')],'type':_0x345218[_0xca74('0x2f')][_0xca74('0x30')]};});_0x1630a4[_0xca74('0x31')]=_[_0xca74('0x32')](_[_0xca74('0x2c')](_0x2f6b27,'name'),[_0xca74('0x33')]);_0x1630a4[_0xca74('0x34')]=_[_0xca74('0x35')](_0x5f505a['query']);_0x1630a4[_0xca74('0x36')]=_['intersection'](_0x1630a4[_0xca74('0x31')],_0x1630a4[_0xca74('0x34')]);_0x12fc24[_0xca74('0x37')]=_[_0xca74('0x38')](_0x1630a4[_0xca74('0x31')],qs['fields'](_0x5f505a[_0xca74('0x34')][_0xca74('0x39')]));_0x12fc24['attributes']=_0x12fc24[_0xca74('0x37')][_0xca74('0x3a')]?_0x12fc24['attributes']:_0x1630a4[_0xca74('0x31')];if(!_0x5f505a['query'][_0xca74('0x3b')](_0xca74('0x3c'))){_0x12fc24[_0xca74('0x20')]=qs[_0xca74('0x20')](_0x5f505a[_0xca74('0x34')]['limit']);_0x12fc24[_0xca74('0x1e')]=qs[_0xca74('0x1e')](_0x5f505a[_0xca74('0x34')][_0xca74('0x1e')]);}_0x12fc24[_0xca74('0x3d')]=qs[_0xca74('0x3e')](_0x5f505a[_0xca74('0x34')]['sort']);_0x12fc24[_0xca74('0x3f')]=qs[_0xca74('0x36')](_[_0xca74('0x40')](_0x5f505a['query'],_0x1630a4[_0xca74('0x36')]),_0x2f6b27);if(_0x5f505a['query'][_0xca74('0x41')]){_0x12fc24[_0xca74('0x3f')]=_[_0xca74('0x42')](_0x12fc24[_0xca74('0x3f')],{'$or':_[_0xca74('0x2c')](_0x2f6b27,function(_0xb2e23d){if(_0xb2e23d['type']!=='VIRTUAL'){var _0x20bbf4={};_0x20bbf4[_0xb2e23d[_0xca74('0x29')]]={'$like':'%'+_0x5f505a[_0xca74('0x34')][_0xca74('0x41')]+'%'};return _0x20bbf4;}})});}_0x12fc24=_[_0xca74('0x42')]({},_0x12fc24,_0x5f505a[_0xca74('0x43')]);var _0x475e47={'where':_0x12fc24[_0xca74('0x3f')]};return db[_0xca74('0x2d')][_0xca74('0x21')](_0x475e47)['then'](function(_0x2e8136){_0x5d9e84['count']=_0x2e8136;if(_0x5f505a['query'][_0xca74('0x44')]){_0x12fc24[_0xca74('0x45')]=[{'all':!![]}];}return db[_0xca74('0x2d')][_0xca74('0x46')](_0x12fc24);})[_0xca74('0x26')](function(_0x20bf47){_0x5d9e84[_0xca74('0x47')]=_0x20bf47;return _0x5d9e84;})['then'](respondWithFilteredResult(_0x1a36e8,_0x12fc24))[_0xca74('0x48')](handleError(_0x1a36e8,null));};exports[_0xca74('0x49')]=function(_0x4acdf0,_0x45e860){var _0x2aa6cd={'raw':![],'where':{'id':_0x4acdf0['params']['id']}},_0x22742e={};_0x22742e[_0xca74('0x31')]=_[_0xca74('0x35')](db[_0xca74('0x2d')]['rawAttributes']);_0x22742e[_0xca74('0x34')]=_['keys'](_0x4acdf0[_0xca74('0x34')]);_0x22742e['filters']=_[_0xca74('0x38')](_0x22742e[_0xca74('0x31')],_0x22742e[_0xca74('0x34')]);_0x2aa6cd['attributes']=_[_0xca74('0x38')](_0x22742e[_0xca74('0x31')],qs[_0xca74('0x39')](_0x4acdf0['query'][_0xca74('0x39')]));_0x2aa6cd[_0xca74('0x37')]=_0x2aa6cd['attributes']['length']?_0x2aa6cd[_0xca74('0x37')]:_0x22742e[_0xca74('0x31')];if(_0x4acdf0[_0xca74('0x34')][_0xca74('0x44')]){_0x2aa6cd[_0xca74('0x45')]=[{'all':!![]}];}_0x2aa6cd=_['merge']({},_0x2aa6cd,_0x4acdf0[_0xca74('0x43')]);return db[_0xca74('0x2d')][_0xca74('0x4a')](_0x2aa6cd)[_0xca74('0x26')](handleEntityNotFound(_0x45e860,null))[_0xca74('0x26')](respondWithResult(_0x45e860,null))[_0xca74('0x48')](handleError(_0x45e860,null));};exports[_0xca74('0x4b')]=function(_0xa36115,_0x5565f3){return db[_0xca74('0x2d')][_0xca74('0x4b')](_0xa36115[_0xca74('0x4c')],{})[_0xca74('0x26')](respondWithResult(_0x5565f3,0xc9))[_0xca74('0x48')](handleError(_0x5565f3,null));};exports['update']=function(_0x4ec6be,_0x2e1cd5){if(_0x4ec6be[_0xca74('0x4c')]['id']){delete _0x4ec6be[_0xca74('0x4c')]['id'];}return db[_0xca74('0x2d')]['find']({'where':{'id':_0x4ec6be[_0xca74('0x4d')]['id']}})[_0xca74('0x26')](handleEntityNotFound(_0x2e1cd5,null))[_0xca74('0x26')](saveUpdates(_0x4ec6be[_0xca74('0x4c')],null))[_0xca74('0x26')](respondWithResult(_0x2e1cd5,null))[_0xca74('0x48')](handleError(_0x2e1cd5,null));};exports['describe']=function(_0x56ee9c,_0x463dac){return db['VoiceRecording'][_0xca74('0x4e')]()['then'](respondWithResult(_0x463dac,null))[_0xca74('0x48')](handleError(_0x463dac,null));};exports[_0xca74('0x4f')]=function(_0x29e042,_0x217367,_0x3b9103){var _0x4e01f3=require(_0xca74('0x50'));var _0x3e48f7=![];var _0x3daab7={};if(_0x29e042[_0xca74('0x34')]['type']&&_0x29e042['query'][_0xca74('0x2f')]===_0xca74('0x51')){_0x3daab7[_0xca74('0x51')]=_0x29e042[_0xca74('0x4d')]['id'];}else{_0x3daab7['id']=_0x29e042['params']['id'];}return db[_0xca74('0x2d')]['find']({'where':_0x3daab7,'attributes':['id',_0xca74('0x52')],'raw':!![]})[_0xca74('0x26')](handleEntityNotFound(_0x217367,null))[_0xca74('0x26')](function(_0xd13f18){if(_0xd13f18){var _0x2ce82d=_0xd13f18[_0xca74('0x52')];var _0x2b414f=util[_0xca74('0x33')](_0xca74('0x53'),_0x2ce82d);if(fs[_0xca74('0x54')](_0x2b414f)){_0x3e48f7=!![];return _0x4e01f3[_0xca74('0x55')](_0x2b414f,_0x2ce82d,config[_0xca74('0x56')][_0xca74('0x57')])['then'](function(){return _0xd13f18;});}return _0xd13f18;}})[_0xca74('0x26')](function(_0x44ee59){if(_0x44ee59){var _0x527849=_0x44ee59[_0xca74('0x52')];if(!fs[_0xca74('0x54')](_0x527849)){throw new db[(_0xca74('0x58'))]['ValidationError'](_0xca74('0x59'));}if(_0x44ee59[_0xca74('0x5a')]){return _0x217367[_0xca74('0x4f')](_0x527849,_0x44ee59[_0xca74('0x5a')]+path[_0xca74('0x5b')](_0x527849),function(){if(_0x3e48f7){fs[_0xca74('0x5c')](_0x527849);}});}else{return _0x217367[_0xca74('0x4f')](_0x527849,function(_0x5f14d1){if(_0x3e48f7){fs[_0xca74('0x5c')](_0x527849);}});}}})['catch'](function(_0x1be1b4){if(_0x1be1b4['message']===_0xca74('0x59')){_0x217367['status'](0x194)[_0xca74('0x2a')](_0xca74('0x5d'));}else{return handleError(_0x217367,null);}});};exports[_0xca74('0x5e')]=function(_0x5037cf,_0x582040,_0x274cd9){var _0x2f7e10=require(_0xca74('0x50'));var _0x3af926=![];var _0x34b768={'$and':[db[_0xca74('0x5f')][_0xca74('0x3f')](db['sequelize']['fn'](_0xca74('0x60'),db[_0xca74('0x5f')][_0xca74('0x61')](_0xca74('0x51'))),_0x5037cf[_0xca74('0x34')][_0xca74('0x62')])]};if(_0x5037cf[_0xca74('0x34')]['type']&&_0x5037cf[_0xca74('0x34')]['type']===_0xca74('0x51')){_0x34b768[_0xca74('0x63')][_0xca74('0x64')]({'uniqueid':_0x5037cf[_0xca74('0x4d')]['id']});}else{_0x34b768['$and'][_0xca74('0x64')]({'id':_0x5037cf[_0xca74('0x4d')]['id']});}return db[_0xca74('0x2d')][_0xca74('0x4a')]({'where':_0x34b768,'attributes':['id','value'],'raw':!![]})[_0xca74('0x26')](handleEntityNotFound(_0x582040,null))[_0xca74('0x26')](function(_0x4d2f0a){if(_0x4d2f0a){var _0x155da1=util[_0xca74('0x33')](_0xca74('0x53'),_0x4d2f0a[_0xca74('0x52')]);if(fs[_0xca74('0x54')](_0x155da1)){_0x3af926=!![];return _0x2f7e10[_0xca74('0x55')](_0x155da1,_0x4d2f0a['value'],config[_0xca74('0x56')]['recording'])[_0xca74('0x26')](function(){return _0x4d2f0a;});}return _0x4d2f0a;}})[_0xca74('0x26')](function(_0x3a7534){if(_0x3a7534){if(!fs['existsSync'](_0x3a7534[_0xca74('0x52')])){throw new db[(_0xca74('0x58'))][(_0xca74('0x65'))](_0xca74('0x59'));}if(_0x3a7534['filename']){return _0x582040[_0xca74('0x4f')](_0x3a7534[_0xca74('0x52')],_0x3a7534[_0xca74('0x5a')]+path[_0xca74('0x5b')](_0x3a7534[_0xca74('0x52')]),function(){if(_0x3af926){fs[_0xca74('0x5c')](_0x3a7534[_0xca74('0x52')]);}});}else{return _0x582040[_0xca74('0x4f')](_0x3a7534[_0xca74('0x52')],function(_0x142202){if(_0x3af926){fs[_0xca74('0x5c')](_0x3a7534[_0xca74('0x52')]);}});}}})['catch'](handleError(_0x582040,null));};exports['destroy']=function(_0x516f3e,_0x219690){return db[_0xca74('0x2d')][_0xca74('0x4a')]({'where':{'id':_0x516f3e[_0xca74('0x4d')]['id']}})[_0xca74('0x26')](function(_0x21a8dc){if(_['isNil'](_0x21a8dc)){throw new ReferenceError(_0xca74('0x66'));}return _0x21a8dc;})[_0xca74('0x26')](function(_0x326613){var _0x1b34ce=_0x326613['value'];logger[_0xca74('0x67')](_0xca74('0x68'),_0x1b34ce);if(!_['isNil'](_0x326613[_0xca74('0x52')])&&fs[_0xca74('0x54')](_0x1b34ce)){logger['info'](_0xca74('0x69')+_0x1b34ce+_0xca74('0x6a'));fs[_0xca74('0x6b')](_0x1b34ce);}_0x1b34ce=_0x1b34ce+_0xca74('0x6c');if(!_[_0xca74('0x6d')](_0x326613[_0xca74('0x52')])&&fs[_0xca74('0x54')](_0x1b34ce)){logger[_0xca74('0x67')](_0xca74('0x69')+_0x1b34ce+_0xca74('0x6a'));fs['unlinkSync'](_0x1b34ce);}return _0x326613;})[_0xca74('0x26')](function(_0x2d8c6d){if(!_0x2d8c6d)throw new InternalError();return _0x2d8c6d['destroy']();})[_0xca74('0x26')](function(){_0x219690[_0xca74('0x1b')](0xcc)[_0xca74('0x1c')]();})[_0xca74('0x48')](handleError(_0x219690,null));};function getBucketslist(_0x5b48c5,_0x107ff2,_0x25604b){return new Promise(function(_0x25bac2,_0x3052b8){var _0x43a6a3=new AWS['S3']({'accessKeyId':_0x107ff2,'secretAccessKey':_0x5b48c5,'region':_0x25604b});_0x43a6a3['listBuckets']({},function(_0x2d5816,_0x924e21){if(_0x2d5816){return _0x3052b8(_0x2d5816);}else{return _0x25bac2(_0x924e21);}});});}function createBucket(_0x398568,_0x346919,_0x39783c,_0x3b1bb6){return new Promise(function(_0x2d44c3,_0x1f1ec3){var _0x5785ce=new AWS['S3']({'accessKeyId':_0x346919,'secretAccessKey':_0x398568,'region':_0x39783c});_0x5785ce['createBucket']({'Bucket':_0x3b1bb6},function(_0x59f3c6,_0x3b924c){if(_0x59f3c6){return _0x1f1ec3(_0x59f3c6);}else{return _0x2d44c3(_0x3b924c);}});});}function uploadFile(_0x7f250,_0x4a0924,_0x3ec77f,_0x3ec247,_0x2a65ec,_0x59baa1){return new Promise(function(_0x24ec34,_0x1f513c){var _0x4b01a9=new AWS['S3']({'accessKeyId':_0x4a0924,'secretAccessKey':_0x7f250,'region':_0x3ec77f});_0x4b01a9[_0xca74('0x6e')]({'Bucket':_0x3ec247,'Key':_0x2a65ec,'Body':_0x59baa1},function(_0x4485d5,_0x563bb9){if(_0x4485d5){return _0x1f513c(_0x4485d5);}else{return _0x24ec34(_0x563bb9);}});});}function startTranscribe(_0xbd029a,_0x442cce,_0x23d73e,_0x46b87f,_0x22ba25,_0x3a7da6){return new Promise(function(_0x1814e0,_0x1f6b31){var _0xfaf910=new AWS['TranscribeService']({'accessKeyId':_0x442cce,'secretAccessKey':_0xbd029a,'region':_0x23d73e});_0xfaf910['startTranscriptionJob']({'TranscriptionJobName':_0x46b87f,'LanguageCode':_0x22ba25,'Media':{'MediaFileUri':_0x3a7da6}},function(_0x585dce,_0x3b9dc4){if(_0x585dce){return _0x1f6b31(_0x585dce);}else{return _0x1814e0(_0x3b9dc4);}});});}function transcribe(_0x7d38b7,_0x1274c9,_0x3e60fd,_0x598077,_0x483ec1,_0x28b5f6,_0x40985a){return new Promise(function(_0x435e94,_0x1c46de){var _0xcdb2e0={};logger[_0xca74('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x7d38b7,_0x483ec1));return uploadFile(_0x1274c9,_0x3e60fd,_0x598077,_0x483ec1,path['basename'](_0x28b5f6),fs[_0xca74('0x6f')](_0x28b5f6))[_0xca74('0x26')](function(_0x2b0d41){logger[_0xca74('0x67')](util[_0xca74('0x33')](_0xca74('0x70'),_0x7d38b7,_0x483ec1,_0x2b0d41[_0xca74('0x71')]));_0xcdb2e0['bucket']=_0x2b0d41[_0xca74('0x72')];_0xcdb2e0[_0xca74('0x73')]=_0x2b0d41[_0xca74('0x71')];logger[_0xca74('0x67')](util['format'](_0xca74('0x74'),_0x7d38b7));return startTranscribe(_0x1274c9,_0x3e60fd,_0x598077,uuidv4(),_0x40985a,_0x2b0d41[_0xca74('0x71')]);})[_0xca74('0x26')](function(_0x458845){logger[_0xca74('0x67')](util[_0xca74('0x33')](_0xca74('0x75'),_0x7d38b7,_0x458845['TranscriptionJob'][_0xca74('0x76')]));_0xcdb2e0[_0xca74('0x77')]=_0x458845[_0xca74('0x78')][_0xca74('0x76')];_0xcdb2e0[_0xca74('0x79')]=_0x458845[_0xca74('0x78')][_0xca74('0x7a')];return _0x435e94(_0xcdb2e0);})['catch'](function(_0x179e0a){return _0x1c46de(_0x179e0a);});});}exports[_0xca74('0x7b')]=function(_0xb8e890,_0x443aac,_0x4c4b18){var _0x263365;var _0x309147;var _0x50936b;var _0x2a98cf=require(_0xca74('0x50'));return db[_0xca74('0x2d')][_0xca74('0x7c')]({'where':{'id':_0xb8e890[_0xca74('0x4d')]['id']}})['then'](function(_0x17547a){if(_0x17547a){var _0x29f778=util['format'](_0xca74('0x53'),_0x17547a['value']);if(fs['existsSync'](_0x29f778)){cypher=!![];return _0x2a98cf['decryptFile'](_0x29f778,_0x17547a[_0xca74('0x52')],config[_0xca74('0x56')][_0xca74('0x57')])[_0xca74('0x26')](function(){return _0x17547a;});}return _0x17547a;}})[_0xca74('0x26')](function(_0x2900e6){if(!_0x2900e6){throw new db['Sequelize'][(_0xca74('0x65'))](_0xca74('0x7d'));}_0x309147=_0x2900e6;return db[_0xca74('0x7e')][_0xca74('0x7c')]({'where':{'id':0x1}});})[_0xca74('0x26')](handleEntityNotFound(_0x443aac,null))['then'](function(_0x19b3d3){if(_0x19b3d3){_0x263365=_0x19b3d3;if(!_0x263365['transcribe']||!_0x263365[_0xca74('0x7f')]||!_0x263365[_0xca74('0x80')]||!_0x263365['language']||!_0x263365['bucket']){throw new db[(_0xca74('0x58'))][(_0xca74('0x65'))](_0xca74('0x81'));}if(_0xb8e890['body'][_0xca74('0x82')]&&(!_0x263365[_0xca74('0x83')]||!_0x263365[_0xca74('0x84')]||!_0x263365[_0xca74('0x85')]||!_0x263365[_0xca74('0x86')]||!_0x263365[_0xca74('0x87')])){throw new db['Sequelize'][(_0xca74('0x65'))](_0xca74('0x88'));}return db[_0xca74('0x89')][_0xca74('0x7c')]({'where':{'id':_0x263365[_0xca74('0x7f')]}});}})['then'](function(_0x3af7c1){if(!_0x3af7c1){throw new db[(_0xca74('0x58'))][(_0xca74('0x65'))](_0xca74('0x8a'));}if(!_0x3af7c1['data1']||!_0x3af7c1[_0xca74('0x8b')]){throw new db[(_0xca74('0x58'))][(_0xca74('0x65'))](_0xca74('0x8c'));}_0x50936b=_0x3af7c1;return getBucketslist(_0x50936b['data1'],_0x50936b[_0xca74('0x8b')],_0x263365['transcribeRegion']);})['then'](function(_0x63fbca){if(_0x63fbca&&_0x63fbca[_0xca74('0x8d')]){var _0x1a4d8f=_[_0xca74('0x4a')](_0x63fbca[_0xca74('0x8d')],function(_0x3cc105){return _0x3cc105[_0xca74('0x8e')]===_0x263365[_0xca74('0x87')];});if(!_0x1a4d8f){logger[_0xca74('0x67')](util[_0xca74('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0xb8e890['params']['id'],_0x263365[_0xca74('0x87')]));return createBucket(_0x50936b['data1'],_0x50936b[_0xca74('0x8b')],_0x263365['transcribeRegion'],_0x263365[_0xca74('0x87')]);}logger[_0xca74('0x67')](util[_0xca74('0x33')](_0xca74('0x8f'),_0xb8e890['params']['id'],_0x263365['bucket']));return;}})[_0xca74('0x26')](function(_0xc03689){if(_0x309147[_0xca74('0x79')]===_0xca74('0x90')){return transcribe(_0xb8e890['params']['id'],_0x50936b[_0xca74('0x91')],_0x50936b[_0xca74('0x8b')],_0x263365[_0xca74('0x80')],_0x263365[_0xca74('0x87')],_0x309147['value'],_0x263365[_0xca74('0x86')]);}else{logger[_0xca74('0x67')](util[_0xca74('0x33')](_0xca74('0x92'),_0xb8e890[_0xca74('0x4d')]['id']));return{'transcribeStatus':_0xca74('0x93')};}})[_0xca74('0x26')](function(_0xdba5ae){if(_0xdba5ae){_0xdba5ae[_0xca74('0x94')]=_0xb8e890[_0xca74('0x4c')][_0xca74('0x82')];return _0x309147['updateAttributes'](_0xdba5ae);}})[_0xca74('0x26')](respondWithResult(_0x443aac,null))[_0xca74('0x48')](handleError(_0x443aac,null));};function writeFile(_0xb228f1,_0x446357){return new Promise(function(_0x85b519,_0x2cbce7){fs[_0xca74('0x95')](_0x446357,_0xb228f1,function(_0x1f2c66,_0xd16300){if(_0x1f2c66){return _0x2cbce7(_0x1f2c66);}else{return _0x85b519(_0xd16300);}});});}exports['downloadTranscribe']=function(_0x39cbb9,_0x429b09,_0x83e6b2){return db['VoiceRecording'][_0xca74('0x7c')]({'where':{'id':_0x39cbb9[_0xca74('0x4d')]['id']}})[_0xca74('0x26')](handleEntityNotFound(_0x429b09))[_0xca74('0x26')](function(_0x105ef0){if(_0x105ef0&&_0x105ef0[_0xca74('0x96')]){var _0x21ee4f=_0x105ef0[_0xca74('0x96')];var _0xa360ca=config[_0xca74('0x97')]+_0xca74('0x98')+_0x105ef0['id']+_0xca74('0x99');if(fs[_0xca74('0x54')](_0xa360ca)){return _0xa360ca;}return writeFile(_0x21ee4f,_0xa360ca)['then'](function(){return _0xa360ca;});}else{throw new db[(_0xca74('0x58'))][(_0xca74('0x65'))](_0xca74('0x9a'));}})[_0xca74('0x26')](function(_0x2bb0f6){return _0x429b09[_0xca74('0x4f')](_0x2bb0f6);})['catch'](handleError(_0x429b09));};
\ No newline at end of file
+var _0xefc4=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','key','model','differenceBy','format','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','VoiceRecording','include','rows','catch','show','rawAttributes','intersection','includeAll','create','body','update','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','token','push','$and','params','recording','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra'];(function(_0x25e094,_0x48c02b){var _0x5ac306=function(_0x3cb7c3){while(--_0x3cb7c3){_0x25e094['push'](_0x25e094['shift']());}};_0x5ac306(++_0x48c02b);}(_0xefc4,0x1c3));var _0x4efc=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xefc4[_0x1d80be];return _0xf9a4f3;};'use strict';var emlformat=require(_0x4efc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4efc('0x1'));var rp=require(_0x4efc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4efc('0x3'));var util=require(_0x4efc('0x4'));var path=require(_0x4efc('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4efc('0x6'));var fs=require('fs');var fs_extra=require(_0x4efc('0x7'));var _=require(_0x4efc('0x8'));var squel=require(_0x4efc('0x9'));var crypto=require(_0x4efc('0xa'));var jsforce=require(_0x4efc('0xb'));var deskjs=require(_0x4efc('0xc'));var toCsv=require(_0x4efc('0xd'));var querystring=require(_0x4efc('0xe'));var Papa=require(_0x4efc('0xf'));var AWS=require(_0x4efc('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x4efc('0x11'));var authService=require(_0x4efc('0x12'));var qs=require(_0x4efc('0x13'));var as=require(_0x4efc('0x14'));var hardwareService=require(_0x4efc('0x15'));var logger=require(_0x4efc('0x16'))(_0x4efc('0x17'));var utils=require(_0x4efc('0x18'));var config=require(_0x4efc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4efc('0x1a'))['db'];function respondWithStatusCode(_0x4461e9,_0x4a3fb3){_0x4a3fb3=_0x4a3fb3||0xcc;return function(_0x583bb9){if(_0x583bb9){return _0x4461e9[_0x4efc('0x1b')](_0x4a3fb3);}return _0x4461e9['status'](_0x4a3fb3)[_0x4efc('0x1c')]();};}function respondWithResult(_0x56f502,_0x4c0bf4){_0x4c0bf4=_0x4c0bf4||0xc8;return function(_0xff7fff){if(_0xff7fff){return _0x56f502[_0x4efc('0x1d')](_0x4c0bf4)[_0x4efc('0x1e')](_0xff7fff);}};}function respondWithFilteredResult(_0xb215ae,_0x52a66a){return function(_0x2304a7){if(_0x2304a7){var _0x51391e=typeof _0x52a66a[_0x4efc('0x1f')]==='undefined'&&typeof _0x52a66a[_0x4efc('0x20')]===_0x4efc('0x21');var _0x68f886=_0x2304a7[_0x4efc('0x22')];var _0x137049=_0x51391e?0x0:_0x52a66a[_0x4efc('0x1f')];var _0x276e0e=_0x51391e?_0x2304a7[_0x4efc('0x22')]:_0x52a66a['offset']+_0x52a66a['limit'];var _0x400829;if(_0x276e0e>=_0x68f886){_0x276e0e=_0x68f886;_0x400829=0xc8;}else{_0x400829=0xce;}_0xb215ae[_0x4efc('0x1d')](_0x400829);return _0xb215ae[_0x4efc('0x23')](_0x4efc('0x24'),_0x137049+'-'+_0x276e0e+'/'+_0x68f886)[_0x4efc('0x1e')](_0x2304a7);}return null;};}function patchUpdates(_0xe73eb9){return function(_0x497436){try{jsonpatch['apply'](_0x497436,_0xe73eb9,!![]);}catch(_0x2d3c28){return BPromise[_0x4efc('0x25')](_0x2d3c28);}return _0x497436[_0x4efc('0x26')]();};}function saveUpdates(_0x12559a,_0x20bd9a){return function(_0x5ed390){if(_0x5ed390){return _0x5ed390['update'](_0x12559a)[_0x4efc('0x27')](function(_0x2fac24){return _0x2fac24;});}return null;};}function removeEntity(_0x3b1d70,_0x16b275){return function(_0x2bda48){if(_0x2bda48){return _0x2bda48[_0x4efc('0x28')]()['then'](function(){_0x3b1d70['status'](0xcc)[_0x4efc('0x1c')]();});}};}function handleEntityNotFound(_0x5659e7,_0x4c5576){return function(_0xd4cf2){if(!_0xd4cf2){_0x5659e7[_0x4efc('0x1b')](0x194);}return _0xd4cf2;};}function handleError(_0x2ae8ea,_0x9d5d78){_0x9d5d78=_0x9d5d78||0x1f4;return function(_0x29725e){logger[_0x4efc('0x29')](_0x29725e[_0x4efc('0x2a')]);if(_0x29725e[_0x4efc('0x2b')]){delete _0x29725e[_0x4efc('0x2b')];}_0x2ae8ea['status'](_0x9d5d78)[_0x4efc('0x2c')](_0x29725e);};}exports[_0x4efc('0x2d')]=function(_0x13f385,_0x1b2a53){var _0x1cf3d7={},_0xabb6ab={},_0x264312={'count':0x0,'rows':[]};var _0xe6207c=_[_0x4efc('0x2e')](db['VoiceRecording']['rawAttributes'],function(_0x35eb9a){return{'name':_0x35eb9a[_0x4efc('0x2f')],'type':_0x35eb9a['type'][_0x4efc('0x30')]};});_0xabb6ab[_0x4efc('0x31')]=_[_0x4efc('0x32')](_[_0x4efc('0x2e')](_0xe6207c,'name'),[_0x4efc('0x33')]);_0xabb6ab[_0x4efc('0x34')]=_[_0x4efc('0x35')](_0x13f385[_0x4efc('0x34')]);_0xabb6ab['filters']=_['intersection'](_0xabb6ab[_0x4efc('0x31')],_0xabb6ab[_0x4efc('0x34')]);_0x1cf3d7[_0x4efc('0x36')]=_['intersection'](_0xabb6ab[_0x4efc('0x31')],qs[_0x4efc('0x37')](_0x13f385['query'][_0x4efc('0x37')]));_0x1cf3d7['attributes']=_0x1cf3d7[_0x4efc('0x36')][_0x4efc('0x38')]?_0x1cf3d7[_0x4efc('0x36')]:_0xabb6ab[_0x4efc('0x31')];if(!_0x13f385[_0x4efc('0x34')]['hasOwnProperty'](_0x4efc('0x39'))){_0x1cf3d7['limit']=qs[_0x4efc('0x20')](_0x13f385[_0x4efc('0x34')][_0x4efc('0x20')]);_0x1cf3d7[_0x4efc('0x1f')]=qs[_0x4efc('0x1f')](_0x13f385[_0x4efc('0x34')][_0x4efc('0x1f')]);}_0x1cf3d7[_0x4efc('0x3a')]=qs[_0x4efc('0x3b')](_0x13f385[_0x4efc('0x34')]['sort']);_0x1cf3d7[_0x4efc('0x3c')]=qs[_0x4efc('0x3d')](_[_0x4efc('0x3e')](_0x13f385[_0x4efc('0x34')],_0xabb6ab[_0x4efc('0x3d')]),_0xe6207c);if(_0x13f385[_0x4efc('0x34')][_0x4efc('0x3f')]){_0x1cf3d7[_0x4efc('0x3c')]=_[_0x4efc('0x40')](_0x1cf3d7[_0x4efc('0x3c')],{'$or':_[_0x4efc('0x2e')](_0xe6207c,function(_0x22b876){if(_0x22b876[_0x4efc('0x41')]!==_0x4efc('0x42')){var _0xc15d93={};_0xc15d93[_0x22b876[_0x4efc('0x2b')]]={'$like':'%'+_0x13f385[_0x4efc('0x34')]['filter']+'%'};return _0xc15d93;}})});}_0x1cf3d7=_[_0x4efc('0x40')]({},_0x1cf3d7,_0x13f385[_0x4efc('0x43')]);var _0x1330eb={'where':_0x1cf3d7[_0x4efc('0x3c')]};return db[_0x4efc('0x44')][_0x4efc('0x22')](_0x1330eb)[_0x4efc('0x27')](function(_0x35a9cb){_0x264312[_0x4efc('0x22')]=_0x35a9cb;if(_0x13f385[_0x4efc('0x34')]['includeAll']){_0x1cf3d7[_0x4efc('0x45')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x1cf3d7);})[_0x4efc('0x27')](function(_0x386b6d){_0x264312[_0x4efc('0x46')]=_0x386b6d;return _0x264312;})[_0x4efc('0x27')](respondWithFilteredResult(_0x1b2a53,_0x1cf3d7))[_0x4efc('0x47')](handleError(_0x1b2a53,null));};exports[_0x4efc('0x48')]=function(_0xe3888a,_0x298b3){var _0x353a1d={'raw':![],'where':{'id':_0xe3888a['params']['id']}},_0x4e15f3={};_0x4e15f3[_0x4efc('0x31')]=_[_0x4efc('0x35')](db['VoiceRecording'][_0x4efc('0x49')]);_0x4e15f3['query']=_[_0x4efc('0x35')](_0xe3888a['query']);_0x4e15f3[_0x4efc('0x3d')]=_[_0x4efc('0x4a')](_0x4e15f3['model'],_0x4e15f3['query']);_0x353a1d[_0x4efc('0x36')]=_[_0x4efc('0x4a')](_0x4e15f3[_0x4efc('0x31')],qs['fields'](_0xe3888a[_0x4efc('0x34')][_0x4efc('0x37')]));_0x353a1d[_0x4efc('0x36')]=_0x353a1d[_0x4efc('0x36')][_0x4efc('0x38')]?_0x353a1d['attributes']:_0x4e15f3[_0x4efc('0x31')];if(_0xe3888a[_0x4efc('0x34')][_0x4efc('0x4b')]){_0x353a1d[_0x4efc('0x45')]=[{'all':!![]}];}_0x353a1d=_[_0x4efc('0x40')]({},_0x353a1d,_0xe3888a['options']);return db[_0x4efc('0x44')]['find'](_0x353a1d)[_0x4efc('0x27')](handleEntityNotFound(_0x298b3,null))[_0x4efc('0x27')](respondWithResult(_0x298b3,null))[_0x4efc('0x47')](handleError(_0x298b3,null));};exports[_0x4efc('0x4c')]=function(_0x32fd06,_0x53ed4a){return db[_0x4efc('0x44')][_0x4efc('0x4c')](_0x32fd06[_0x4efc('0x4d')],{})['then'](respondWithResult(_0x53ed4a,0xc9))['catch'](handleError(_0x53ed4a,null));};exports[_0x4efc('0x4e')]=function(_0x3a14d8,_0xa67997){if(_0x3a14d8[_0x4efc('0x4d')]['id']){delete _0x3a14d8[_0x4efc('0x4d')]['id'];}return db[_0x4efc('0x44')][_0x4efc('0x4f')]({'where':{'id':_0x3a14d8['params']['id']}})[_0x4efc('0x27')](handleEntityNotFound(_0xa67997,null))[_0x4efc('0x27')](saveUpdates(_0x3a14d8['body'],null))[_0x4efc('0x27')](respondWithResult(_0xa67997,null))['catch'](handleError(_0xa67997,null));};exports[_0x4efc('0x50')]=function(_0x39cfb6,_0x37a43f){return db[_0x4efc('0x44')][_0x4efc('0x50')]()[_0x4efc('0x27')](respondWithResult(_0x37a43f,null))[_0x4efc('0x47')](handleError(_0x37a43f,null));};exports[_0x4efc('0x51')]=function(_0x517c6d,_0x2f838f,_0x17efd9){var _0x28033d=require(_0x4efc('0x52'));var _0x41f6a4=![];var _0x3e12ec={};if(_0x517c6d[_0x4efc('0x34')][_0x4efc('0x41')]&&_0x517c6d[_0x4efc('0x34')][_0x4efc('0x41')]===_0x4efc('0x53')){_0x3e12ec[_0x4efc('0x53')]=_0x517c6d['params']['id'];}else{_0x3e12ec['id']=_0x517c6d['params']['id'];}return db[_0x4efc('0x44')][_0x4efc('0x4f')]({'where':_0x3e12ec,'attributes':['id','value'],'raw':!![]})[_0x4efc('0x27')](handleEntityNotFound(_0x2f838f,null))['then'](function(_0x42412b){if(_0x42412b){var _0x10208c=_0x42412b[_0x4efc('0x54')];var _0x3d5fb8=util[_0x4efc('0x33')](_0x4efc('0x55'),_0x10208c);if(fs['existsSync'](_0x3d5fb8)){_0x41f6a4=!![];return _0x28033d[_0x4efc('0x56')](_0x3d5fb8,_0x10208c,config['secrets']['recording'])[_0x4efc('0x27')](function(){return _0x42412b;});}return _0x42412b;}})[_0x4efc('0x27')](function(_0x3eeb7f){if(_0x3eeb7f){var _0x1ccb5e=_0x3eeb7f[_0x4efc('0x54')];if(!fs[_0x4efc('0x57')](_0x1ccb5e)){throw new db[(_0x4efc('0x58'))][(_0x4efc('0x59'))](_0x4efc('0x5a'));}if(_0x3eeb7f[_0x4efc('0x5b')]){return _0x2f838f[_0x4efc('0x51')](_0x1ccb5e,_0x3eeb7f[_0x4efc('0x5b')]+path[_0x4efc('0x5c')](_0x1ccb5e),function(){if(_0x41f6a4){fs[_0x4efc('0x5d')](_0x1ccb5e);}});}else{return _0x2f838f['download'](_0x1ccb5e,function(_0x2bfeb){if(_0x41f6a4){fs[_0x4efc('0x5d')](_0x1ccb5e);}});}}})[_0x4efc('0x47')](function(_0x406c3a){if(_0x406c3a['message']===_0x4efc('0x5a')){_0x2f838f['status'](0x194)['send'](_0x4efc('0x5e'));}else{return handleError(_0x2f838f,null);}});};exports[_0x4efc('0x5f')]=function(_0x1c8bc4,_0x2bf7d4,_0x264c88){var _0x5bf840=require(_0x4efc('0x52'));var _0xef54a9=![];var _0x3052cd={'$and':[db[_0x4efc('0x60')][_0x4efc('0x3c')](db[_0x4efc('0x60')]['fn']('MD5',db[_0x4efc('0x60')]['col']('uniqueid')),_0x1c8bc4[_0x4efc('0x34')][_0x4efc('0x61')])]};if(_0x1c8bc4[_0x4efc('0x34')][_0x4efc('0x41')]&&_0x1c8bc4[_0x4efc('0x34')][_0x4efc('0x41')]==='uniqueid'){_0x3052cd['$and'][_0x4efc('0x62')]({'uniqueid':_0x1c8bc4['params']['id']});}else{_0x3052cd[_0x4efc('0x63')][_0x4efc('0x62')]({'id':_0x1c8bc4[_0x4efc('0x64')]['id']});}return db['VoiceRecording'][_0x4efc('0x4f')]({'where':_0x3052cd,'attributes':['id',_0x4efc('0x54')],'raw':!![]})[_0x4efc('0x27')](handleEntityNotFound(_0x2bf7d4,null))[_0x4efc('0x27')](function(_0x5a28bf){if(_0x5a28bf){var _0x21caee=util[_0x4efc('0x33')](_0x4efc('0x55'),_0x5a28bf[_0x4efc('0x54')]);if(fs[_0x4efc('0x57')](_0x21caee)){_0xef54a9=!![];return _0x5bf840[_0x4efc('0x56')](_0x21caee,_0x5a28bf[_0x4efc('0x54')],config['secrets'][_0x4efc('0x65')])[_0x4efc('0x27')](function(){return _0x5a28bf;});}return _0x5a28bf;}})[_0x4efc('0x27')](function(_0x5cb7ae){if(_0x5cb7ae){if(!fs[_0x4efc('0x57')](_0x5cb7ae[_0x4efc('0x54')])){throw new db[(_0x4efc('0x58'))][(_0x4efc('0x59'))](_0x4efc('0x5a'));}if(_0x5cb7ae[_0x4efc('0x5b')]){return _0x2bf7d4['download'](_0x5cb7ae[_0x4efc('0x54')],_0x5cb7ae[_0x4efc('0x5b')]+path[_0x4efc('0x5c')](_0x5cb7ae[_0x4efc('0x54')]),function(){if(_0xef54a9){fs['unlink'](_0x5cb7ae[_0x4efc('0x54')]);}});}else{return _0x2bf7d4['download'](_0x5cb7ae[_0x4efc('0x54')],function(_0x2a63ac){if(_0xef54a9){fs[_0x4efc('0x5d')](_0x5cb7ae[_0x4efc('0x54')]);}});}}})[_0x4efc('0x47')](handleError(_0x2bf7d4,null));};exports['destroy']=function(_0x1edf0e,_0x5975a7){return db[_0x4efc('0x44')][_0x4efc('0x4f')]({'where':{'id':_0x1edf0e[_0x4efc('0x64')]['id']}})[_0x4efc('0x27')](function(_0x122252){if(_[_0x4efc('0x66')](_0x122252)){throw new ReferenceError(_0x4efc('0x67'));}return _0x122252;})[_0x4efc('0x27')](function(_0x14ce98){var _0x5849a7=_0x14ce98[_0x4efc('0x54')];logger['info'](_0x4efc('0x68'),_0x5849a7);if(!_[_0x4efc('0x66')](_0x14ce98[_0x4efc('0x54')])&&fs[_0x4efc('0x57')](_0x5849a7)){logger[_0x4efc('0x69')]('File:\x20\x22'+_0x5849a7+_0x4efc('0x6a'));fs[_0x4efc('0x6b')](_0x5849a7);}_0x5849a7=_0x5849a7+_0x4efc('0x6c');if(!_['isNil'](_0x14ce98[_0x4efc('0x54')])&&fs[_0x4efc('0x57')](_0x5849a7)){logger['info']('File:\x20\x22'+_0x5849a7+_0x4efc('0x6a'));fs[_0x4efc('0x6b')](_0x5849a7);}return _0x14ce98;})[_0x4efc('0x27')](function(_0x2aca7c){if(!_0x2aca7c)throw new InternalError();return _0x2aca7c[_0x4efc('0x28')]();})[_0x4efc('0x27')](function(){_0x5975a7[_0x4efc('0x1d')](0xcc)[_0x4efc('0x1c')]();})['catch'](handleError(_0x5975a7,null));};function getBucketslist(_0x3cb457,_0x64b57b,_0x3fcfba){return new Promise(function(_0x52e75a,_0x7d83bd){var _0xf07759=new AWS['S3']({'accessKeyId':_0x64b57b,'secretAccessKey':_0x3cb457,'region':_0x3fcfba});_0xf07759[_0x4efc('0x6d')]({},function(_0x2c8878,_0x916665){if(_0x2c8878){return _0x7d83bd(_0x2c8878);}else{return _0x52e75a(_0x916665);}});});}function createBucket(_0x48ea83,_0x24b760,_0x5769bb,_0xc6a5e7){return new Promise(function(_0x4baeff,_0x487e69){var _0x4e53c9=new AWS['S3']({'accessKeyId':_0x24b760,'secretAccessKey':_0x48ea83,'region':_0x5769bb});_0x4e53c9[_0x4efc('0x6e')]({'Bucket':_0xc6a5e7},function(_0x502acb,_0x327e34){if(_0x502acb){return _0x487e69(_0x502acb);}else{return _0x4baeff(_0x327e34);}});});}function uploadFile(_0x16bb44,_0x417783,_0x49cb10,_0x30f982,_0x4d9519,_0x3cfb3c){return new Promise(function(_0x38d855,_0x4509c9){var _0xe026f0=new AWS['S3']({'accessKeyId':_0x417783,'secretAccessKey':_0x16bb44,'region':_0x49cb10});_0xe026f0[_0x4efc('0x6f')]({'Bucket':_0x30f982,'Key':_0x4d9519,'Body':_0x3cfb3c},function(_0x15b200,_0x48edc4){if(_0x15b200){return _0x4509c9(_0x15b200);}else{return _0x38d855(_0x48edc4);}});});}function startTranscribe(_0x3aae19,_0x1b9664,_0x4a76a8,_0x331410,_0x2c8378,_0x48b12f){return new Promise(function(_0x6ef91e,_0x23d028){var _0x2d78a2=new AWS[(_0x4efc('0x70'))]({'accessKeyId':_0x1b9664,'secretAccessKey':_0x3aae19,'region':_0x4a76a8});_0x2d78a2[_0x4efc('0x71')]({'TranscriptionJobName':_0x331410,'LanguageCode':_0x2c8378,'Media':{'MediaFileUri':_0x48b12f}},function(_0x296baa,_0x6b039b){if(_0x296baa){return _0x23d028(_0x296baa);}else{return _0x6ef91e(_0x6b039b);}});});}function transcribe(_0x14019d,_0x5bd07f,_0x5a8fed,_0x450da3,_0x370bd7,_0x26dcba,_0x36cc8d){return new Promise(function(_0x45f293,_0x1f9993){var _0x208a94={};logger['info'](util[_0x4efc('0x33')](_0x4efc('0x72'),_0x14019d,_0x370bd7));return uploadFile(_0x5bd07f,_0x5a8fed,_0x450da3,_0x370bd7,path[_0x4efc('0x73')](_0x26dcba),fs['readFileSync'](_0x26dcba))['then'](function(_0x5879e3){logger[_0x4efc('0x69')](util[_0x4efc('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x14019d,_0x370bd7,_0x5879e3['Location']));_0x208a94[_0x4efc('0x74')]=_0x5879e3[_0x4efc('0x75')];_0x208a94[_0x4efc('0x76')]=_0x5879e3[_0x4efc('0x77')];logger[_0x4efc('0x69')](util[_0x4efc('0x33')](_0x4efc('0x78'),_0x14019d));return startTranscribe(_0x5bd07f,_0x5a8fed,_0x450da3,uuidv4(),_0x36cc8d,_0x5879e3[_0x4efc('0x77')]);})[_0x4efc('0x27')](function(_0x1ba4b5){logger['info'](util[_0x4efc('0x33')](_0x4efc('0x79'),_0x14019d,_0x1ba4b5[_0x4efc('0x7a')][_0x4efc('0x7b')]));_0x208a94['transcribeName']=_0x1ba4b5[_0x4efc('0x7a')][_0x4efc('0x7b')];_0x208a94[_0x4efc('0x7c')]=_0x1ba4b5['TranscriptionJob'][_0x4efc('0x7d')];return _0x45f293(_0x208a94);})['catch'](function(_0x48f380){return _0x1f9993(_0x48f380);});});}exports[_0x4efc('0x7e')]=function(_0x569777,_0x2061a3,_0x27a530){var _0x446fc1;var _0x3ca968;var _0x4c589a;var _0x5a8cf6=require(_0x4efc('0x52'));return db[_0x4efc('0x44')][_0x4efc('0x7f')]({'where':{'id':_0x569777[_0x4efc('0x64')]['id']}})[_0x4efc('0x27')](function(_0x1a04e9){if(_0x1a04e9){var _0x4b7bc8=util[_0x4efc('0x33')]('%s.cypher',_0x1a04e9[_0x4efc('0x54')]);if(fs[_0x4efc('0x57')](_0x4b7bc8)){cypher=!![];return _0x5a8cf6[_0x4efc('0x56')](_0x4b7bc8,_0x1a04e9[_0x4efc('0x54')],config['secrets'][_0x4efc('0x65')])[_0x4efc('0x27')](function(){return _0x1a04e9;});}return _0x1a04e9;}})[_0x4efc('0x27')](function(_0x18eb61){if(!_0x18eb61){throw new db[(_0x4efc('0x58'))][(_0x4efc('0x59'))](_0x4efc('0x80'));}_0x3ca968=_0x18eb61;return db[_0x4efc('0x81')][_0x4efc('0x7f')]({'where':{'id':0x1}});})[_0x4efc('0x27')](handleEntityNotFound(_0x2061a3,null))[_0x4efc('0x27')](function(_0x2e749d){if(_0x2e749d){_0x446fc1=_0x2e749d;if(!_0x446fc1[_0x4efc('0x82')]||!_0x446fc1['transcribeAccountId']||!_0x446fc1[_0x4efc('0x83')]||!_0x446fc1['language']||!_0x446fc1[_0x4efc('0x74')]){throw new db['Sequelize']['ValidationError'](_0x4efc('0x84'));}if(_0x569777[_0x4efc('0x4d')][_0x4efc('0x85')]&&(!_0x446fc1[_0x4efc('0x86')]||!_0x446fc1['sentimentAccountId']||!_0x446fc1['sentimentRegion']||!_0x446fc1[_0x4efc('0x87')]||!_0x446fc1[_0x4efc('0x74')])){throw new db['Sequelize'][(_0x4efc('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x4efc('0x88')][_0x4efc('0x7f')]({'where':{'id':_0x446fc1['transcribeAccountId']}});}})[_0x4efc('0x27')](function(_0x50ab25){if(!_0x50ab25){throw new db['Sequelize'][(_0x4efc('0x59'))](_0x4efc('0x89'));}if(!_0x50ab25['data1']||!_0x50ab25[_0x4efc('0x8a')]){throw new db[(_0x4efc('0x58'))][(_0x4efc('0x59'))](_0x4efc('0x8b'));}_0x4c589a=_0x50ab25;return getBucketslist(_0x4c589a[_0x4efc('0x8c')],_0x4c589a[_0x4efc('0x8a')],_0x446fc1[_0x4efc('0x83')]);})[_0x4efc('0x27')](function(_0x3c7ca0){if(_0x3c7ca0&&_0x3c7ca0['Buckets']){var _0x57a914=_[_0x4efc('0x4f')](_0x3c7ca0[_0x4efc('0x8d')],function(_0x30415f){return _0x30415f[_0x4efc('0x8e')]===_0x446fc1[_0x4efc('0x74')];});if(!_0x57a914){logger['info'](util['format'](_0x4efc('0x8f'),_0x569777[_0x4efc('0x64')]['id'],_0x446fc1[_0x4efc('0x74')]));return createBucket(_0x4c589a[_0x4efc('0x8c')],_0x4c589a['data2'],_0x446fc1[_0x4efc('0x83')],_0x446fc1[_0x4efc('0x74')]);}logger[_0x4efc('0x69')](util[_0x4efc('0x33')](_0x4efc('0x90'),_0x569777['params']['id'],_0x446fc1[_0x4efc('0x74')]));return;}})['then'](function(_0x45259b){if(_0x3ca968[_0x4efc('0x7c')]===_0x4efc('0x91')){return transcribe(_0x569777[_0x4efc('0x64')]['id'],_0x4c589a[_0x4efc('0x8c')],_0x4c589a[_0x4efc('0x8a')],_0x446fc1[_0x4efc('0x83')],_0x446fc1[_0x4efc('0x74')],_0x3ca968['value'],_0x446fc1[_0x4efc('0x87')]);}else{logger[_0x4efc('0x69')](util[_0x4efc('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x569777[_0x4efc('0x64')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x806f79){if(_0x806f79){_0x806f79['tempSentiment']=_0x569777['body'][_0x4efc('0x85')];return _0x3ca968[_0x4efc('0x92')](_0x806f79);}})[_0x4efc('0x27')](respondWithResult(_0x2061a3,null))[_0x4efc('0x47')](handleError(_0x2061a3,null));};function writeFile(_0x1dac26,_0x501f18){return new Promise(function(_0x3256ca,_0x3a8e6c){fs[_0x4efc('0x93')](_0x501f18,_0x1dac26,function(_0x1caf6b,_0x95bde3){if(_0x1caf6b){return _0x3a8e6c(_0x1caf6b);}else{return _0x3256ca(_0x95bde3);}});});}exports['downloadTranscribe']=function(_0x1a1112,_0x12b785,_0x4aeaac){return db['VoiceRecording'][_0x4efc('0x7f')]({'where':{'id':_0x1a1112['params']['id']}})[_0x4efc('0x27')](handleEntityNotFound(_0x12b785))[_0x4efc('0x27')](function(_0x4ddeb7){if(_0x4ddeb7&&_0x4ddeb7[_0x4efc('0x94')]){var _0x1bb1fc=_0x4ddeb7['fileText'];var _0x2d947f=config[_0x4efc('0x95')]+_0x4efc('0x96')+_0x4ddeb7['id']+_0x4efc('0x97');if(fs[_0x4efc('0x57')](_0x2d947f)){return _0x2d947f;}return writeFile(_0x1bb1fc,_0x2d947f)['then'](function(){return _0x2d947f;});}else{throw new db[(_0x4efc('0x58'))][(_0x4efc('0x59'))](_0x4efc('0x98'));}})['then'](function(_0x540e7c){return _0x12b785[_0x4efc('0x51')](_0x540e7c);})['catch'](handleError(_0x12b785));};
\ No newline at end of file
index c6ea16f..bd445d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb647=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb647,0xdb));var _0x7b64=function(_0x3b3400,_0x20cfb7){_0x3b3400=_0x3b3400-0x0;var _0x532265=_0xb647[_0x3b3400];return _0x532265;};'use strict';var attributes=require(_0x7b64('0x0'));module[_0x7b64('0x1')]=function(_0x3cf0d4,_0x248af6){return _0x3cf0d4[_0x7b64('0x2')](_0x7b64('0x3'),attributes,{'tableName':_0x7b64('0x4'),'paranoid':![],'indexes':[{'name':_0x7b64('0x5'),'fields':['uniqueid']},{'name':_0x7b64('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x84e1=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x189b6d,_0x2079ed){var _0xbd9db7=function(_0x5503f1){while(--_0x5503f1){_0x189b6d['push'](_0x189b6d['shift']());}};_0xbd9db7(++_0x2079ed);}(_0x84e1,0x1dc));var _0x184e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x84e1[_0x42cae2];return _0x5f256f;};'use strict';var attributes=require(_0x184e('0x0'));module[_0x184e('0x1')]=function(_0x1cb42b,_0x1e7e1f){return _0x1cb42b[_0x184e('0x2')](_0x184e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x184e('0x4'),'fields':[_0x184e('0x4')]},{'name':_0x184e('0x5'),'fields':[_0x184e('0x5')]}],'timestamps':!![]});};
\ No newline at end of file
index 22bd3ee..bd58d0b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0x0424,0x159));var _0x4042=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x0424[_0x1b6186];return _0x186121;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});};
\ No newline at end of file
+var _0x7096=['raw','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','findOne','create','existsSync','format','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options'];(function(_0x50f290,_0x4a5895){var _0x1743b3=function(_0x447b90){while(--_0x447b90){_0x50f290['push'](_0x50f290['shift']());}};_0x1743b3(++_0x4a5895);}(_0x7096,0x10c));var _0x6709=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7096[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['update'](_0x235a54[_0x6709('0x18')],{'raw':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235a54['options']?_0x235a54[_0x6709('0x19')][_0x6709('0x1b')]||null:null,'attributes':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1c')]||null:null,'limit':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1d')]||null:null})[_0x6709('0xb')](function(_0x1c5153){logger[_0x6709('0xc')](_0x6709('0x16'),_0x235a54);logger['debug'](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x1c5153));_0x9c1fd8(_0x1c5153);})[_0x6709('0x15')](function(_0x5c7982){logger[_0x6709('0x11')](_0x6709('0x16'),_0x5c7982[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e[_0x6709('0x11')](0x1f4,_0x5c7982['message']));});});};exports[_0x6709('0x1e')]=function(_0x3076fe){var _0x50f7d6=this;return new Promise(function(_0x585073,_0x39f6a9){var _0x5dbb87=require(_0x6709('0x1f'));var _0x2499a2;return db['Setting'][_0x6709('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6709('0xb')](function(_0x3cd555){_0x2499a2=_0x3cd555;return db['VoiceRecording'][_0x6709('0x21')](_0x3076fe['body']);})[_0x6709('0xb')](function(_0x388aee){if(_0x2499a2['callRecordingEncryption']&&fs[_0x6709('0x22')](_0x388aee['value'])){var _0x138318=util[_0x6709('0x23')]('%s.cypher',_0x388aee['value']);return _0x5dbb87[_0x6709('0x24')](_0x388aee[_0x6709('0x25')],_0x138318,config[_0x6709('0x26')][_0x6709('0x27')])[_0x6709('0xb')](function(){fs[_0x6709('0x28')](_0x388aee[_0x6709('0x25')]);logger[_0x6709('0xc')](_0x6709('0x29'));return _0x388aee;});}return _0x388aee;})['then'](function(_0x3d9501){logger[_0x6709('0xc')](_0x6709('0x1e'),_0x3076fe);logger[_0x6709('0xf')]('CreateVoiceRecording',_0x3076fe,JSON[_0x6709('0x10')](_0x3d9501));_0x585073(_0x3d9501);})[_0x6709('0x15')](function(_0x124e01){logger[_0x6709('0x11')]('CreateVoiceRecording',_0x124e01[_0x6709('0x13')],_0x3076fe);_0x39f6a9(_0x50f7d6[_0x6709('0x11')](0x1f4,_0x124e01['message']));});});};
\ No newline at end of file
index f9a1989..eb0e06b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7aa1=['Router','fs-extra','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy','exports','util','path','express'];(function(_0x5add96,_0x288a79){var _0x3e697e=function(_0x52e43a){while(--_0x52e43a){_0x5add96['push'](_0x5add96['shift']());}};_0x3e697e(++_0x288a79);}(_0x7aa1,0x7b));var _0x17aa=function(_0x180133,_0x589186){_0x180133=_0x180133-0x0;var _0x208b21=_0x7aa1[_0x180133];return _0x208b21;};'use strict';var multer=require('multer');var util=require(_0x17aa('0x0'));var path=require(_0x17aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x17aa('0x2'));var router=express[_0x17aa('0x3')]();var fs_extra=require(_0x17aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x17aa('0x5'));router[_0x17aa('0x6')]('/',auth[_0x17aa('0x7')](),controller['index']);router[_0x17aa('0x6')](_0x17aa('0x8'),auth[_0x17aa('0x7')](),controller[_0x17aa('0x9')]);router[_0x17aa('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x17aa('0xa')]);router[_0x17aa('0xb')]('/',auth[_0x17aa('0x7')](),controller[_0x17aa('0xc')]);router[_0x17aa('0xd')](_0x17aa('0xe'),auth[_0x17aa('0x7')](),controller[_0x17aa('0xf')]);router['delete'](_0x17aa('0xe'),auth[_0x17aa('0x7')](),controller[_0x17aa('0x10')]);module[_0x17aa('0x11')]=router;
\ No newline at end of file
+var _0xa71d=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40437d,_0x540920){var _0x4fa333=function(_0x1d6161){while(--_0x1d6161){_0x40437d['push'](_0x40437d['shift']());}};_0x4fa333(++_0x540920);}(_0xa71d,0x1f1));var _0xda71=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xa71d[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0xda71('0x0'));var util=require(_0xda71('0x1'));var path=require(_0xda71('0x2'));var timeout=require(_0xda71('0x3'));var express=require(_0xda71('0x4'));var router=express[_0xda71('0x5')]();var fs_extra=require(_0xda71('0x6'));var auth=require(_0xda71('0x7'));var interaction=require(_0xda71('0x8'));var config=require(_0xda71('0x9'));var controller=require(_0xda71('0xa'));router[_0xda71('0xb')]('/',auth[_0xda71('0xc')](),controller['index']);router[_0xda71('0xb')](_0xda71('0xd'),auth[_0xda71('0xc')](),controller[_0xda71('0xe')]);router[_0xda71('0xb')](_0xda71('0xf'),auth[_0xda71('0xc')](),controller[_0xda71('0x10')]);router[_0xda71('0x11')]('/',auth[_0xda71('0xc')](),controller[_0xda71('0x12')]);router[_0xda71('0x13')](_0xda71('0xf'),auth[_0xda71('0xc')](),controller[_0xda71('0x14')]);router[_0xda71('0x15')](_0xda71('0xf'),auth[_0xda71('0xc')](),controller['destroy']);module[_0xda71('0x16')]=router;
\ No newline at end of file
index 5bd2e40..49a4994 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2a8=['Yes','moment','exports','blind','STRING','ENUM'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xe2a8,0x13f));var _0x8e2a=function(_0x5c198d,_0x5cbcf6){_0x5c198d=_0x5c198d-0x0;var _0x1893a1=_0xe2a8[_0x5c198d];return _0x1893a1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8e2a('0x0'));module[_0x8e2a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8e2a('0x2'),'attended')},'result':{'type':Sequelize[_0x8e2a('0x3')]},'transfererchannel':{'type':Sequelize[_0x8e2a('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x8e2a('0x3')]},'transferercalleridname':{'type':Sequelize[_0x8e2a('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8e2a('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8e2a('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x8e2a('0x3')]},'transfereechannel':{'type':Sequelize[_0x8e2a('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x8e2a('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x8e2a('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8e2a('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x8e2a('0x3')]},'transfereecontext':{'type':Sequelize[_0x8e2a('0x3')]},'transfereeexten':{'type':Sequelize[_0x8e2a('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x8e2a('0x4')](_0x8e2a('0x5'),'No')},'context':{'type':Sequelize[_0x8e2a('0x3')]},'extension':{'type':Sequelize[_0x8e2a('0x3')]}};
\ No newline at end of file
+var _0xd7d0=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x5921e4,_0x1b7bd2){var _0x4100c5=function(_0xf966f7){while(--_0xf966f7){_0x5921e4['push'](_0x5921e4['shift']());}};_0x4100c5(++_0x1b7bd2);}(_0xd7d0,0x11e));var _0x0d7d=function(_0xb314a6,_0x3e9b41){_0xb314a6=_0xb314a6-0x0;var _0x1a5c11=_0xd7d0[_0xb314a6];return _0x1a5c11;};'use strict';var Sequelize=require(_0x0d7d('0x0'));var moment=require(_0x0d7d('0x1'));module[_0x0d7d('0x2')]={'type':{'type':Sequelize[_0x0d7d('0x3')](_0x0d7d('0x4'),_0x0d7d('0x5'))},'result':{'type':Sequelize[_0x0d7d('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x0d7d('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x0d7d('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x0d7d('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x0d7d('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x0d7d('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0d7d('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0d7d('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x0d7d('0x6')]},'transfereecontext':{'type':Sequelize[_0x0d7d('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x0d7d('0x3')](_0x0d7d('0x7'),'No')},'context':{'type':Sequelize[_0x0d7d('0x6')]},'extension':{'type':Sequelize[_0x0d7d('0x6')]}};
\ No newline at end of file
index 3e8ae89..f76f433 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x884b=['options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params'];(function(_0x34c085,_0x47624b){var _0x9f7dc2=function(_0x3fcbed){while(--_0x3fcbed){_0x34c085['push'](_0x34c085['shift']());}};_0x9f7dc2(++_0x47624b);}(_0x884b,0x1d3));var _0xb884=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x884b[_0x33c1b1];return _0x2c2037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb884('0x0'));var zipdir=require(_0xb884('0x1'));var jsonpatch=require(_0xb884('0x2'));var rp=require(_0xb884('0x3'));var moment=require('moment');var BPromise=require(_0xb884('0x4'));var Mustache=require(_0xb884('0x5'));var util=require(_0xb884('0x6'));var path=require(_0xb884('0x7'));var sox=require('sox');var csv=require(_0xb884('0x8'));var ejs=require(_0xb884('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb884('0xa'));var squel=require(_0xb884('0xb'));var crypto=require('crypto');var jsforce=require(_0xb884('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb884('0x8'));var querystring=require(_0xb884('0xd'));var Papa=require(_0xb884('0xe'));var Redis=require(_0xb884('0xf'));var authService=require(_0xb884('0x10'));var qs=require(_0xb884('0x11'));var as=require(_0xb884('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb884('0x13'))(_0xb884('0x14'));var utils=require(_0xb884('0x15'));var config=require(_0xb884('0x16'));var licenseUtil=require(_0xb884('0x17'));var db=require(_0xb884('0x18'))['db'];function respondWithStatusCode(_0x188439,_0x17178d){_0x17178d=_0x17178d||0xcc;return function(_0x5b190a){if(_0x5b190a){return _0x188439[_0xb884('0x19')](_0x17178d);}return _0x188439['status'](_0x17178d)['end']();};}function respondWithResult(_0x364c5b,_0x53ebd1){_0x53ebd1=_0x53ebd1||0xc8;return function(_0x245739){if(_0x245739){return _0x364c5b[_0xb884('0x1a')](_0x53ebd1)[_0xb884('0x1b')](_0x245739);}};}function respondWithFilteredResult(_0x28883d,_0xd3c905){return function(_0x385f84){if(_0x385f84){var _0x3dade7=typeof _0xd3c905[_0xb884('0x1c')]===_0xb884('0x1d')&&typeof _0xd3c905[_0xb884('0x1e')]===_0xb884('0x1d');var _0x487f89=_0x385f84['count'];var _0x46c0ed=_0x3dade7?0x0:_0xd3c905[_0xb884('0x1c')];var _0x3f41c0=_0x3dade7?_0x385f84[_0xb884('0x1f')]:_0xd3c905['offset']+_0xd3c905[_0xb884('0x1e')];var _0x39dc36;if(_0x3f41c0>=_0x487f89){_0x3f41c0=_0x487f89;_0x39dc36=0xc8;}else{_0x39dc36=0xce;}_0x28883d[_0xb884('0x1a')](_0x39dc36);return _0x28883d[_0xb884('0x20')](_0xb884('0x21'),_0x46c0ed+'-'+_0x3f41c0+'/'+_0x487f89)[_0xb884('0x1b')](_0x385f84);}return null;};}function patchUpdates(_0x5c6eab){return function(_0x3ef837){try{jsonpatch[_0xb884('0x22')](_0x3ef837,_0x5c6eab,!![]);}catch(_0x7e6e93){return BPromise[_0xb884('0x23')](_0x7e6e93);}return _0x3ef837['save']();};}function saveUpdates(_0x2f1ab4,_0xd5c043){return function(_0x2e09f6){if(_0x2e09f6){return _0x2e09f6[_0xb884('0x24')](_0x2f1ab4)['then'](function(_0x2cb361){return _0x2cb361;});}return null;};}function removeEntity(_0x149fe1,_0x678804){return function(_0x1e85fe){if(_0x1e85fe){return _0x1e85fe[_0xb884('0x25')]()[_0xb884('0x26')](function(){_0x149fe1[_0xb884('0x1a')](0xcc)[_0xb884('0x27')]();});}};}function handleEntityNotFound(_0x9954c2,_0x2a1771){return function(_0x1f4605){if(!_0x1f4605){_0x9954c2[_0xb884('0x19')](0x194);}return _0x1f4605;};}function handleError(_0x5d6dc0,_0x2c42d3){_0x2c42d3=_0x2c42d3||0x1f4;return function(_0x2e2cda){logger[_0xb884('0x28')](_0x2e2cda[_0xb884('0x29')]);if(_0x2e2cda[_0xb884('0x2a')]){delete _0x2e2cda['name'];}_0x5d6dc0[_0xb884('0x1a')](_0x2c42d3)[_0xb884('0x2b')](_0x2e2cda);};}exports[_0xb884('0x2c')]=function(_0x481846,_0x4a575e){var _0xc09152={},_0x56b9a0={},_0x176daa={'count':0x0,'rows':[]};var _0x2894d1=_[_0xb884('0x2d')](db[_0xb884('0x2e')][_0xb884('0x2f')],function(_0x1a8a61){return{'name':_0x1a8a61['fieldName'],'type':_0x1a8a61[_0xb884('0x30')][_0xb884('0x31')]};});_0x56b9a0[_0xb884('0x32')]=_[_0xb884('0x2d')](_0x2894d1,_0xb884('0x2a'));_0x56b9a0[_0xb884('0x33')]=_[_0xb884('0x34')](_0x481846[_0xb884('0x33')]);_0x56b9a0[_0xb884('0x35')]=_[_0xb884('0x36')](_0x56b9a0['model'],_0x56b9a0[_0xb884('0x33')]);_0xc09152['attributes']=_[_0xb884('0x36')](_0x56b9a0[_0xb884('0x32')],qs['fields'](_0x481846['query'][_0xb884('0x37')]));_0xc09152['attributes']=_0xc09152[_0xb884('0x38')][_0xb884('0x39')]?_0xc09152[_0xb884('0x38')]:_0x56b9a0[_0xb884('0x32')];if(!_0x481846[_0xb884('0x33')][_0xb884('0x3a')](_0xb884('0x3b'))){_0xc09152[_0xb884('0x1e')]=qs[_0xb884('0x1e')](_0x481846[_0xb884('0x33')][_0xb884('0x1e')]);_0xc09152[_0xb884('0x1c')]=qs[_0xb884('0x1c')](_0x481846[_0xb884('0x33')][_0xb884('0x1c')]);}_0xc09152[_0xb884('0x3c')]=qs[_0xb884('0x3d')](_0x481846['query'][_0xb884('0x3d')]);_0xc09152[_0xb884('0x3e')]=qs[_0xb884('0x35')](_['pick'](_0x481846[_0xb884('0x33')],_0x56b9a0[_0xb884('0x35')]),_0x2894d1);if(_0x481846[_0xb884('0x33')][_0xb884('0x3f')]){_0xc09152[_0xb884('0x3e')]=_[_0xb884('0x40')](_0xc09152[_0xb884('0x3e')],{'$or':_[_0xb884('0x2d')](_0x2894d1,function(_0x3e7705){if(_0x3e7705['type']!=='VIRTUAL'){var _0x2e2927={};_0x2e2927[_0x3e7705[_0xb884('0x2a')]]={'$like':'%'+_0x481846['query'][_0xb884('0x3f')]+'%'};return _0x2e2927;}})});}_0xc09152=_[_0xb884('0x40')]({},_0xc09152,_0x481846['options']);var _0x5d509c={'where':_0xc09152['where']};return db[_0xb884('0x2e')][_0xb884('0x1f')](_0x5d509c)[_0xb884('0x26')](function(_0x3a93ad){_0x176daa[_0xb884('0x1f')]=_0x3a93ad;if(_0x481846[_0xb884('0x33')][_0xb884('0x41')]){_0xc09152[_0xb884('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb884('0x43')](_0xc09152);})[_0xb884('0x26')](function(_0x2b81ff){_0x176daa[_0xb884('0x44')]=_0x2b81ff;return _0x176daa;})[_0xb884('0x26')](respondWithFilteredResult(_0x4a575e,_0xc09152))[_0xb884('0x45')](handleError(_0x4a575e,null));};exports[_0xb884('0x46')]=function(_0x5d1231,_0x48ce7e){var _0x1dece2={'raw':!![],'where':{'id':_0x5d1231[_0xb884('0x47')]['id']}},_0x17e276={};_0x17e276[_0xb884('0x32')]=_[_0xb884('0x34')](db['VoiceTransferReport'][_0xb884('0x2f')]);_0x17e276[_0xb884('0x33')]=_[_0xb884('0x34')](_0x5d1231[_0xb884('0x33')]);_0x17e276[_0xb884('0x35')]=_[_0xb884('0x36')](_0x17e276[_0xb884('0x32')],_0x17e276[_0xb884('0x33')]);_0x1dece2['attributes']=_['intersection'](_0x17e276['model'],qs['fields'](_0x5d1231[_0xb884('0x33')][_0xb884('0x37')]));_0x1dece2[_0xb884('0x38')]=_0x1dece2[_0xb884('0x38')]['length']?_0x1dece2[_0xb884('0x38')]:_0x17e276[_0xb884('0x32')];if(_0x5d1231[_0xb884('0x33')][_0xb884('0x41')]){_0x1dece2['include']=[{'all':!![]}];}_0x1dece2=_['merge']({},_0x1dece2,_0x5d1231[_0xb884('0x48')]);return db['VoiceTransferReport'][_0xb884('0x49')](_0x1dece2)[_0xb884('0x26')](handleEntityNotFound(_0x48ce7e,null))[_0xb884('0x26')](respondWithResult(_0x48ce7e,null))[_0xb884('0x45')](handleError(_0x48ce7e,null));};exports[_0xb884('0x4a')]=function(_0x4eb3dd,_0x561a70){return db[_0xb884('0x2e')][_0xb884('0x4a')](_0x4eb3dd[_0xb884('0x4b')],{})[_0xb884('0x26')](respondWithResult(_0x561a70,0xc9))[_0xb884('0x45')](handleError(_0x561a70,null));};exports[_0xb884('0x24')]=function(_0x1bdd5f,_0x53f547){if(_0x1bdd5f[_0xb884('0x4b')]['id']){delete _0x1bdd5f[_0xb884('0x4b')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x1bdd5f[_0xb884('0x47')]['id']}})[_0xb884('0x26')](handleEntityNotFound(_0x53f547,null))[_0xb884('0x26')](saveUpdates(_0x1bdd5f[_0xb884('0x4b')],null))[_0xb884('0x26')](respondWithResult(_0x53f547,null))[_0xb884('0x45')](handleError(_0x53f547,null));};exports[_0xb884('0x25')]=function(_0x27a470,_0x56b316){return db[_0xb884('0x2e')][_0xb884('0x49')]({'where':{'id':_0x27a470[_0xb884('0x47')]['id']}})[_0xb884('0x26')](handleEntityNotFound(_0x56b316,null))[_0xb884('0x26')](removeEntity(_0x56b316,null))[_0xb884('0x45')](handleError(_0x56b316,null));};exports[_0xb884('0x4c')]=function(_0x41fc5f,_0xbf2143){return db[_0xb884('0x2e')][_0xb884('0x4c')]()[_0xb884('0x26')](respondWithResult(_0xbf2143,null))[_0xb884('0x45')](handleError(_0xbf2143,null));};
\ No newline at end of file
+var _0xaad3=['end','status','json','offset','limit','undefined','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceTransferReport','count','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaad3,0x1b0));var _0x3aad=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0xaad3[_0x59befa];return _0x1dd63d;};'use strict';var emlformat=require(_0x3aad('0x0'));var rimraf=require(_0x3aad('0x1'));var zipdir=require(_0x3aad('0x2'));var jsonpatch=require(_0x3aad('0x3'));var rp=require(_0x3aad('0x4'));var moment=require(_0x3aad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3aad('0x6'));var path=require('path');var sox=require(_0x3aad('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3aad('0x8'));var _=require(_0x3aad('0x9'));var squel=require(_0x3aad('0xa'));var crypto=require(_0x3aad('0xb'));var jsforce=require(_0x3aad('0xc'));var deskjs=require(_0x3aad('0xd'));var toCsv=require(_0x3aad('0xe'));var querystring=require(_0x3aad('0xf'));var Papa=require(_0x3aad('0x10'));var Redis=require(_0x3aad('0x11'));var authService=require(_0x3aad('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3aad('0x13'));var logger=require(_0x3aad('0x14'))(_0x3aad('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3aad('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2a6bb,_0x58dfbe){_0x58dfbe=_0x58dfbe||0xcc;return function(_0x56f2fd){if(_0x56f2fd){return _0xe2a6bb[_0x3aad('0x17')](_0x58dfbe);}return _0xe2a6bb['status'](_0x58dfbe)[_0x3aad('0x18')]();};}function respondWithResult(_0x5ee6b0,_0x529e26){_0x529e26=_0x529e26||0xc8;return function(_0x55ae60){if(_0x55ae60){return _0x5ee6b0[_0x3aad('0x19')](_0x529e26)[_0x3aad('0x1a')](_0x55ae60);}};}function respondWithFilteredResult(_0x36c1ea,_0x4ffcc5){return function(_0x5db4c2){if(_0x5db4c2){var _0x3fc377=typeof _0x4ffcc5[_0x3aad('0x1b')]==='undefined'&&typeof _0x4ffcc5[_0x3aad('0x1c')]===_0x3aad('0x1d');var _0x58f5f9=_0x5db4c2['count'];var _0x12bbd3=_0x3fc377?0x0:_0x4ffcc5['offset'];var _0x46e7a8=_0x3fc377?_0x5db4c2['count']:_0x4ffcc5[_0x3aad('0x1b')]+_0x4ffcc5[_0x3aad('0x1c')];var _0x5247a3;if(_0x46e7a8>=_0x58f5f9){_0x46e7a8=_0x58f5f9;_0x5247a3=0xc8;}else{_0x5247a3=0xce;}_0x36c1ea[_0x3aad('0x19')](_0x5247a3);return _0x36c1ea['set'](_0x3aad('0x1e'),_0x12bbd3+'-'+_0x46e7a8+'/'+_0x58f5f9)[_0x3aad('0x1a')](_0x5db4c2);}return null;};}function patchUpdates(_0x389886){return function(_0xcb898c){try{jsonpatch[_0x3aad('0x1f')](_0xcb898c,_0x389886,!![]);}catch(_0x51600e){return BPromise[_0x3aad('0x20')](_0x51600e);}return _0xcb898c[_0x3aad('0x21')]();};}function saveUpdates(_0x13aaf1,_0x2f6e1d){return function(_0x44f987){if(_0x44f987){return _0x44f987[_0x3aad('0x22')](_0x13aaf1)['then'](function(_0x161a50){return _0x161a50;});}return null;};}function removeEntity(_0x206178,_0x5d81d5){return function(_0x34aae6){if(_0x34aae6){return _0x34aae6[_0x3aad('0x23')]()[_0x3aad('0x24')](function(){_0x206178[_0x3aad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb81fd9,_0x1c1839){return function(_0x277c37){if(!_0x277c37){_0xb81fd9['sendStatus'](0x194);}return _0x277c37;};}function handleError(_0x125a7b,_0x35127c){_0x35127c=_0x35127c||0x1f4;return function(_0x1743e8){logger[_0x3aad('0x25')](_0x1743e8[_0x3aad('0x26')]);if(_0x1743e8[_0x3aad('0x27')]){delete _0x1743e8[_0x3aad('0x27')];}_0x125a7b[_0x3aad('0x19')](_0x35127c)[_0x3aad('0x28')](_0x1743e8);};}exports['index']=function(_0x576f8a,_0x3dec66){var _0x29a04b={},_0x588bdd={},_0x187e2a={'count':0x0,'rows':[]};var _0xab0219=_['map'](db['VoiceTransferReport'][_0x3aad('0x29')],function(_0x4840f2){return{'name':_0x4840f2[_0x3aad('0x2a')],'type':_0x4840f2[_0x3aad('0x2b')][_0x3aad('0x2c')]};});_0x588bdd[_0x3aad('0x2d')]=_[_0x3aad('0x2e')](_0xab0219,'name');_0x588bdd['query']=_[_0x3aad('0x2f')](_0x576f8a[_0x3aad('0x30')]);_0x588bdd[_0x3aad('0x31')]=_[_0x3aad('0x32')](_0x588bdd[_0x3aad('0x2d')],_0x588bdd[_0x3aad('0x30')]);_0x29a04b[_0x3aad('0x33')]=_[_0x3aad('0x32')](_0x588bdd[_0x3aad('0x2d')],qs[_0x3aad('0x34')](_0x576f8a[_0x3aad('0x30')][_0x3aad('0x34')]));_0x29a04b[_0x3aad('0x33')]=_0x29a04b[_0x3aad('0x33')]['length']?_0x29a04b[_0x3aad('0x33')]:_0x588bdd['model'];if(!_0x576f8a[_0x3aad('0x30')][_0x3aad('0x35')](_0x3aad('0x36'))){_0x29a04b[_0x3aad('0x1c')]=qs['limit'](_0x576f8a[_0x3aad('0x30')]['limit']);_0x29a04b[_0x3aad('0x1b')]=qs[_0x3aad('0x1b')](_0x576f8a[_0x3aad('0x30')][_0x3aad('0x1b')]);}_0x29a04b[_0x3aad('0x37')]=qs[_0x3aad('0x38')](_0x576f8a[_0x3aad('0x30')][_0x3aad('0x38')]);_0x29a04b[_0x3aad('0x39')]=qs[_0x3aad('0x31')](_[_0x3aad('0x3a')](_0x576f8a[_0x3aad('0x30')],_0x588bdd[_0x3aad('0x31')]),_0xab0219);if(_0x576f8a[_0x3aad('0x30')][_0x3aad('0x3b')]){_0x29a04b[_0x3aad('0x39')]=_['merge'](_0x29a04b['where'],{'$or':_[_0x3aad('0x2e')](_0xab0219,function(_0x21a4e0){if(_0x21a4e0[_0x3aad('0x2b')]!==_0x3aad('0x3c')){var _0x59c9fa={};_0x59c9fa[_0x21a4e0['name']]={'$like':'%'+_0x576f8a[_0x3aad('0x30')][_0x3aad('0x3b')]+'%'};return _0x59c9fa;}})});}_0x29a04b=_[_0x3aad('0x3d')]({},_0x29a04b,_0x576f8a[_0x3aad('0x3e')]);var _0x4f929c={'where':_0x29a04b[_0x3aad('0x39')]};return db[_0x3aad('0x3f')][_0x3aad('0x40')](_0x4f929c)[_0x3aad('0x24')](function(_0x1e2c68){_0x187e2a[_0x3aad('0x40')]=_0x1e2c68;if(_0x576f8a['query'][_0x3aad('0x41')]){_0x29a04b[_0x3aad('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3aad('0x43')](_0x29a04b);})['then'](function(_0x133eed){_0x187e2a['rows']=_0x133eed;return _0x187e2a;})[_0x3aad('0x24')](respondWithFilteredResult(_0x3dec66,_0x29a04b))[_0x3aad('0x44')](handleError(_0x3dec66,null));};exports[_0x3aad('0x45')]=function(_0x43fb35,_0x57e4bf){var _0x465fa1={'raw':!![],'where':{'id':_0x43fb35[_0x3aad('0x46')]['id']}},_0x47bff9={};_0x47bff9['model']=_[_0x3aad('0x2f')](db[_0x3aad('0x3f')][_0x3aad('0x29')]);_0x47bff9[_0x3aad('0x30')]=_[_0x3aad('0x2f')](_0x43fb35[_0x3aad('0x30')]);_0x47bff9[_0x3aad('0x31')]=_[_0x3aad('0x32')](_0x47bff9[_0x3aad('0x2d')],_0x47bff9['query']);_0x465fa1[_0x3aad('0x33')]=_[_0x3aad('0x32')](_0x47bff9['model'],qs['fields'](_0x43fb35[_0x3aad('0x30')]['fields']));_0x465fa1[_0x3aad('0x33')]=_0x465fa1[_0x3aad('0x33')][_0x3aad('0x47')]?_0x465fa1['attributes']:_0x47bff9[_0x3aad('0x2d')];if(_0x43fb35[_0x3aad('0x30')]['includeAll']){_0x465fa1['include']=[{'all':!![]}];}_0x465fa1=_['merge']({},_0x465fa1,_0x43fb35[_0x3aad('0x3e')]);return db[_0x3aad('0x3f')][_0x3aad('0x48')](_0x465fa1)[_0x3aad('0x24')](handleEntityNotFound(_0x57e4bf,null))[_0x3aad('0x24')](respondWithResult(_0x57e4bf,null))[_0x3aad('0x44')](handleError(_0x57e4bf,null));};exports[_0x3aad('0x49')]=function(_0x578c65,_0x434b48){return db['VoiceTransferReport'][_0x3aad('0x49')](_0x578c65['body'],{})['then'](respondWithResult(_0x434b48,0xc9))[_0x3aad('0x44')](handleError(_0x434b48,null));};exports[_0x3aad('0x22')]=function(_0x2e2e23,_0x4ff843){if(_0x2e2e23[_0x3aad('0x4a')]['id']){delete _0x2e2e23[_0x3aad('0x4a')]['id'];}return db[_0x3aad('0x3f')][_0x3aad('0x48')]({'where':{'id':_0x2e2e23[_0x3aad('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ff843,null))[_0x3aad('0x24')](saveUpdates(_0x2e2e23[_0x3aad('0x4a')],null))['then'](respondWithResult(_0x4ff843,null))[_0x3aad('0x44')](handleError(_0x4ff843,null));};exports[_0x3aad('0x23')]=function(_0x301008,_0x4505a3){return db[_0x3aad('0x3f')][_0x3aad('0x48')]({'where':{'id':_0x301008[_0x3aad('0x46')]['id']}})['then'](handleEntityNotFound(_0x4505a3,null))[_0x3aad('0x24')](removeEntity(_0x4505a3,null))[_0x3aad('0x44')](handleError(_0x4505a3,null));};exports[_0x3aad('0x4b')]=function(_0x51e8a5,_0x6fa6e4){return db[_0x3aad('0x3f')]['describe']()[_0x3aad('0x24')](respondWithResult(_0x6fa6e4,null))[_0x3aad('0x44')](handleError(_0x6fa6e4,null));};
\ No newline at end of file
index e1edc01..a155ef3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3ca=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceTransferReport.attributes','define'];(function(_0xfc3c78,_0x26001e){var _0x2edcf8=function(_0x50a224){while(--_0x50a224){_0xfc3c78['push'](_0xfc3c78['shift']());}};_0x2edcf8(++_0x26001e);}(_0xc3ca,0x19a));var _0xac3c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc3ca[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xac3c('0x0'));var util=require(_0xac3c('0x1'));var logger=require(_0xac3c('0x2'))(_0xac3c('0x3'));var moment=require(_0xac3c('0x4'));var BPromise=require(_0xac3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac3c('0x6'));var config=require(_0xac3c('0x7'));var attributes=require(_0xac3c('0x8'));module['exports']=function(_0x3fe88c,_0x5093b5){return _0x3fe88c[_0xac3c('0x9')](_0xac3c('0xa'),attributes,{'tableName':_0xac3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0cab=['util','../../config/logger','api','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x0cab,0x16a));var _0xb0ca=function(_0x291d5c,_0x384244){_0x291d5c=_0x291d5c-0x0;var _0x9a75ff=_0x0cab[_0x291d5c];return _0x9a75ff;};'use strict';var _=require(_0xb0ca('0x0'));var util=require(_0xb0ca('0x1'));var logger=require(_0xb0ca('0x2'))(_0xb0ca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb0ca('0x4'));var fs=require('fs');var path=require(_0xb0ca('0x5'));var rimraf=require(_0xb0ca('0x6'));var config=require('../../config/environment');var attributes=require(_0xb0ca('0x7'));module[_0xb0ca('0x8')]=function(_0x4f94e2,_0x378497){return _0x4f94e2[_0xb0ca('0x9')](_0xb0ca('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 295c004..c5adb4e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7bb9=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info'];(function(_0x3d62a9,_0x156e72){var _0x318ee8=function(_0x93068f){while(--_0x93068f){_0x3d62a9['push'](_0x3d62a9['shift']());}};_0x318ee8(++_0x156e72);}(_0x7bb9,0x11c));var _0x97bb=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7bb9[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x97bb('0x0'));var util=require(_0x97bb('0x1'));var moment=require(_0x97bb('0x2'));var BPromise=require(_0x97bb('0x3'));var rs=require(_0x97bb('0x4'));var fs=require('fs');var Redis=require(_0x97bb('0x5'));var db=require(_0x97bb('0x6'))['db'];var utils=require(_0x97bb('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x97bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x97bb('0x9')][_0x97bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x309bac,_0xafa031,_0x380dc3){return new BPromise(function(_0x4e1f74,_0x23df00){return client['request'](_0x309bac,_0x380dc3)[_0x97bb('0xb')](function(_0x177542){logger[_0x97bb('0xc')](_0x97bb('0xd'),_0xafa031,_0x97bb('0xe'));logger[_0x97bb('0xf')](_0x97bb('0x10'),_0xafa031,_0x97bb('0xe'),JSON['stringify'](_0x177542));if(_0x177542[_0x97bb('0x11')]){if(_0x177542[_0x97bb('0x11')][_0x97bb('0x12')]===0x1f4){logger[_0x97bb('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0xafa031,_0x177542[_0x97bb('0x11')][_0x97bb('0x13')]);return _0x23df00(_0x177542[_0x97bb('0x11')][_0x97bb('0x13')]);}logger[_0x97bb('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0xafa031,_0x177542[_0x97bb('0x11')][_0x97bb('0x13')]);return _0x4e1f74(_0x177542['error'][_0x97bb('0x13')]);}else{logger[_0x97bb('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0xafa031,_0x97bb('0xe'));_0x4e1f74(_0x177542[_0x97bb('0x14')]['message']);}})[_0x97bb('0x15')](function(_0x40a210){logger[_0x97bb('0x11')](_0x97bb('0xd'),_0xafa031,_0x40a210);_0x23df00(_0x40a210);});});}exports['CreateVoiceTransferReport']=function(_0x3550d9){var _0x5a1aba=this;return new Promise(function(_0x35c280,_0x160ccb){return db['VoiceTransferReport'][_0x97bb('0x16')](_0x3550d9['body'],{'raw':_0x3550d9['options']?_0x3550d9[_0x97bb('0x17')][_0x97bb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4c0dab){logger[_0x97bb('0xc')](_0x97bb('0x19'),_0x3550d9);logger['debug'](_0x97bb('0x19'),_0x3550d9,JSON[_0x97bb('0x1a')](_0x4c0dab));_0x35c280(_0x4c0dab);})[_0x97bb('0x15')](function(_0x4fffbe){logger[_0x97bb('0x11')]('CreateVoiceTransferReport',_0x4fffbe[_0x97bb('0x13')],_0x3550d9);_0x160ccb(_0x5a1aba['error'](0x1f4,_0x4fffbe[_0x97bb('0x13')]));});});};
\ No newline at end of file
+var _0xf990=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','then'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0xf990,0x1a0));var _0x0f99=function(_0x5cdf74,_0xca9d5c){_0x5cdf74=_0x5cdf74-0x0;var _0x450cc2=_0xf990[_0x5cdf74];return _0x450cc2;};'use strict';var _=require(_0x0f99('0x0'));var util=require('util');var moment=require(_0x0f99('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f99('0x2'));var fs=require('fs');var Redis=require(_0x0f99('0x3'));var db=require(_0x0f99('0x4'))['db'];var utils=require(_0x0f99('0x5'));var logger=require(_0x0f99('0x6'))(_0x0f99('0x7'));var config=require(_0x0f99('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0f99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c92a5,_0x3551d2,_0x49d83c){return new BPromise(function(_0x31a4b8,_0x5a94fc){return client[_0x0f99('0xa')](_0x4c92a5,_0x49d83c)['then'](function(_0x4336ab){logger[_0x0f99('0xb')](_0x0f99('0xc'),_0x3551d2,_0x0f99('0xd'));logger[_0x0f99('0xe')](_0x0f99('0xf'),_0x3551d2,'request\x20sent',JSON[_0x0f99('0x10')](_0x4336ab));if(_0x4336ab[_0x0f99('0x11')]){if(_0x4336ab[_0x0f99('0x11')][_0x0f99('0x12')]===0x1f4){logger[_0x0f99('0x11')](_0x0f99('0xc'),_0x3551d2,_0x4336ab[_0x0f99('0x11')][_0x0f99('0x13')]);return _0x5a94fc(_0x4336ab['error'][_0x0f99('0x13')]);}logger['error'](_0x0f99('0xc'),_0x3551d2,_0x4336ab[_0x0f99('0x11')]['message']);return _0x31a4b8(_0x4336ab[_0x0f99('0x11')][_0x0f99('0x13')]);}else{logger[_0x0f99('0xb')](_0x0f99('0xc'),_0x3551d2,_0x0f99('0xd'));_0x31a4b8(_0x4336ab['result'][_0x0f99('0x13')]);}})[_0x0f99('0x14')](function(_0x329a34){logger[_0x0f99('0x11')](_0x0f99('0xc'),_0x3551d2,_0x329a34);_0x5a94fc(_0x329a34);});});}exports[_0x0f99('0x15')]=function(_0x43ba9b){var _0x98884e=this;return new Promise(function(_0x347357,_0x5e5682){return db[_0x0f99('0x16')]['create'](_0x43ba9b['body'],{'raw':_0x43ba9b[_0x0f99('0x17')]?_0x43ba9b[_0x0f99('0x17')][_0x0f99('0x18')]===undefined?!![]:![]:!![]})[_0x0f99('0x19')](function(_0x4d90da){logger[_0x0f99('0xb')](_0x0f99('0x15'),_0x43ba9b);logger['debug']('CreateVoiceTransferReport',_0x43ba9b,JSON['stringify'](_0x4d90da));_0x347357(_0x4d90da);})[_0x0f99('0x14')](function(_0x4b5a2a){logger[_0x0f99('0x11')]('CreateVoiceTransferReport',_0x4b5a2a['message'],_0x43ba9b);_0x5e5682(_0x98884e[_0x0f99('0x11')](0x1f4,_0x4b5a2a['message']));});});};
\ No newline at end of file
index 2a68388..6510ebc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['answer','hold','/unhold','unhold','calls','/transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','isWebrtcLicence','/hangup','/answer'];(function(_0x3509b9,_0x38bb75){var _0x11704f=function(_0x37a435){while(--_0x37a435){_0x3509b9['push'](_0x3509b9['shift']());}};_0x11704f(++_0x38bb75);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x00bb[_0x5bd426];return _0x23a7eb;};'use strict';var express=require(_0xb00b('0x0'));var router=express[_0xb00b('0x1')]();var auth=require(_0xb00b('0x2'));var controller=require('./webbar.controller');router[_0xb00b('0x3')]('/originate',auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['originate']);router[_0xb00b('0x3')](_0xb00b('0x6'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['hangup']);router[_0xb00b('0x3')](_0xb00b('0x7'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x8')]);router[_0xb00b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x9')]);router[_0xb00b('0x3')](_0xb00b('0xa'),auth[_0xb00b('0x4')](),auth['isWebrtcLicence'](),controller[_0xb00b('0xb')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x3')](_0xb00b('0xd'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['transfer']);module[_0xb00b('0xe')]=router;
\ No newline at end of file
+var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xf3cd[_0x25248b];return _0x509939;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router;
\ No newline at end of file
index e993522..af5c77a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd87e=['transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','emit','log','error','stack','name','status','send','then','code','message','result','catch','User','findOne','agent','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0xd87e,0x1bf));var _0xed87=function(_0x3e2cf1,_0x2294a7){_0x3e2cf1=_0x3e2cf1-0x0;var _0x3796d0=_0xd87e[_0x3e2cf1];return _0x3796d0;};'use strict';var path=require(_0xed87('0x0'));var fs=require('fs');var _=require(_0xed87('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xed87('0x2'));var util=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xed87('0x5')]['http']({'port':0x232a});var logger=require(_0xed87('0x6'))(_0xed87('0x7'));var Redis=require('ioredis');config[_0xed87('0x8')]=_['defaults'](config['redis'],{'host':_0xed87('0x9'),'port':0x18eb});var io=require(_0xed87('0xa'))(new Redis(config[_0xed87('0x8')]));var Schema=require(_0xed87('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xed87('0xc')]},'callNumber':{'type':_0xed87('0xd'),'required':[!![],_0xed87('0xe')]},'callerId':{'type':_0xed87('0xd')},'callbackUrl':{'type':_0xed87('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xed87('0xd'),'required':[!![],_0xed87('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':_0xed87('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xed87('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]}});function emit(_0xd34e0e,_0x173413,_0x2563e4){logger[_0xed87('0x11')](_0xd34e0e,_0x173413,JSON['stringify'](_0x2563e4));io['to'](_0xd34e0e)[_0xed87('0x12')](_0x173413,_0x2563e4);}function handleError(_0x18ab7d){return function(_0x2c386a){console[_0xed87('0x13')]('handleError:',_0x2c386a,_0x2c386a instanceof RangeError);logger[_0xed87('0x14')](_0x2c386a[_0xed87('0x15')]);if(_0x2c386a instanceof RangeError){if(_0x2c386a[_0xed87('0x16')]){delete _0x2c386a[_0xed87('0x16')];}_0x18ab7d[_0xed87('0x17')](0x194)[_0xed87('0x18')](_0x2c386a);}else{if(_0x2c386a[_0xed87('0x16')]){delete _0x2c386a[_0xed87('0x16')];}_0x18ab7d[_0xed87('0x17')](0x1f4)['send'](_0x2c386a);}};}function checkError(){return function(_0x5a7329){if(!_0x5a7329){throw new RangeError('NotFound');}return _0x5a7329;};}function respondWithRpcPromise(_0x47c121,_0x42609e){return new BPromise(function(_0x5d3ec8,_0x4191a7){var _0x2b0b98=amiClient;return _0x2b0b98['request'](_0x47c121,_0x42609e)[_0xed87('0x19')](function(_0x505733){if(_0x505733[_0xed87('0x14')]){if(_0x505733[_0xed87('0x14')][_0xed87('0x1a')]===0x1f4){return _0x4191a7(_0x505733[_0xed87('0x14')][_0xed87('0x1b')]);}return _0x5d3ec8(_0x505733['error'][_0xed87('0x1b')]);}else{_0x5d3ec8(_0x505733[_0xed87('0x1c')]);}})[_0xed87('0x1d')](function(_0x320bcc){_0x4191a7(_0x320bcc);});});}function getAgent(_0x31c600){return db[_0xed87('0x1e')][_0xed87('0x1f')]({'where':{'id':_0x31c600,'role':_0xed87('0x20')}})[_0xed87('0x19')](checkError());}function getAgentCheckSession(_0x38f5c,_0x469181){return new BPromise(function(_0x341a35,_0x16a541){var _0x2b86e2=respondWithRpcPromise('VoiceChannels');var _0xb32b1c=getAgent(_0x38f5c);Promise[_0xed87('0x21')]([_0x2b86e2,_0xb32b1c])['then'](function(_0x3dff74){var _0x33c367=_0x3dff74[0x0];var _0x21c93b=_0x3dff74[0x1];var _0x4b259e=_['filter'](_0x33c367[_0xed87('0x22')],function(_0x428b75){return _0x428b75[_0xed87('0x23')]==_0x21c93b['id']&&_0x428b75['sessionId']==_0x469181;});if(_0x4b259e[_0xed87('0x24')]==0x1){_0x341a35(_0x21c93b);}else{_0x16a541(new RangeError(_0xed87('0x25')+_0x469181+_0xed87('0x26')));}});});}exports[_0xed87('0x27')]=function(_0x114e60,_0x46b9f9){logger[_0xed87('0x11')](_0xed87('0x28'),_0x114e60[_0xed87('0x29')]);var _0x4c0bc0=originateValidation[_0xed87('0xb')](_0x114e60[_0xed87('0x29')]);if(_0x4c0bc0['length']>0x0){return _0x46b9f9[_0xed87('0x17')](0x190)['json'](_0x4c0bc0);}var _0x4430aa=_0x114e60[_0xed87('0x29')][_0xed87('0x2a')];var _0x46b41b=_0x114e60[_0xed87('0x29')][_0xed87('0x2b')];var _0xbd7b69=_0x114e60[_0xed87('0x29')][_0xed87('0x2c')];var _0x6f7b23=_0x114e60[_0xed87('0x29')]['callbackUrl'];return getAgent(_0x4430aa)[_0xed87('0x19')](function(_0x167de8){logger['info'](_0xed87('0x2d'),_0x167de8['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x167de8['name']),_0xed87('0x30'),{'callNumber':_0x46b41b,'callerId':_0xbd7b69,'callbackUrl':_0x6f7b23});return _0x46b9f9[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x32')});})[_0xed87('0x1d')](handleError(_0x46b9f9));};exports['hangup']=function(_0x1ca26d,_0x525a11){logger[_0xed87('0x11')]('hangup\x20fired:',_0x1ca26d[_0xed87('0x29')]);var _0xb6fe59=hangupValidation[_0xed87('0xb')](_0x1ca26d[_0xed87('0x29')]);if(_0xb6fe59[_0xed87('0x24')]>0x0){return _0x525a11[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0xb6fe59);}var _0x161491=_0x1ca26d[_0xed87('0x29')]['userId'];var _0x4b49f8=_0x1ca26d[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x161491)[_0xed87('0x19')](function(_0x325112){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x325112['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x325112[_0xed87('0x16')]),'webbar:hangup',{'sessionId':_0x4b49f8});return _0x525a11[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x34')});})[_0xed87('0x1d')](handleError(_0x525a11));};exports[_0xed87('0x35')]=function(_0x151179,_0x315e13){logger[_0xed87('0x11')](_0xed87('0x36'),_0x151179[_0xed87('0x29')]);var _0x5c6925=answerValidation[_0xed87('0xb')](_0x151179[_0xed87('0x29')]);if(_0x5c6925[_0xed87('0x24')]>0x0){return _0x315e13['status'](0x190)['json'](_0x5c6925);}var _0xa31eec=_0x151179[_0xed87('0x29')][_0xed87('0x2a')];var _0x41a658=_0x151179['body'][_0xed87('0x33')];return getAgent(_0xa31eec)[_0xed87('0x19')](function(_0x57fa19){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x57fa19[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x57fa19[_0xed87('0x16')]),_0xed87('0x37'),{'sessionId':_0x41a658});return _0x315e13[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x38')});})[_0xed87('0x1d')](handleError(_0x315e13));};exports['hold']=function(_0x168d7a,_0x122369){logger[_0xed87('0x11')](_0xed87('0x39'),_0x168d7a[_0xed87('0x29')]);var _0x1d3f37=holdValidation[_0xed87('0xb')](_0x168d7a[_0xed87('0x29')]);if(_0x1d3f37[_0xed87('0x24')]>0x0){return _0x122369[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x1d3f37);}var _0x26c8f4=_0x168d7a[_0xed87('0x29')][_0xed87('0x2a')];var _0x2ed9c3=_0x168d7a[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x26c8f4)['then'](function(_0x2c7bef){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x2c7bef['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x2c7bef['name']),_0xed87('0x3a'),{'sessionId':_0x2ed9c3});return _0x122369[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x3b')});})['catch'](handleError(_0x122369));};exports[_0xed87('0x3c')]=function(_0x436e15,_0x3ca34c){logger[_0xed87('0x11')](_0xed87('0x3d'),_0x436e15[_0xed87('0x29')]);var _0x242b57=unholdValidation[_0xed87('0xb')](_0x436e15[_0xed87('0x29')]);if(_0x242b57[_0xed87('0x24')]>0x0){return _0x3ca34c[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x242b57);}var _0x2e5a9f=_0x436e15['body'][_0xed87('0x2a')];var _0x4ea4e3=_0x436e15[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x2e5a9f)[_0xed87('0x19')](function(_0x27ad77){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x27ad77[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x27ad77[_0xed87('0x16')]),'webbar:unhold',{'sessionId':_0x4ea4e3});return _0x3ca34c[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x3e')});})[_0xed87('0x1d')](handleError(_0x3ca34c));};exports[_0xed87('0x3f')]=function(_0x44b176,_0x1dbadc){logger[_0xed87('0x11')](_0xed87('0x40'),_0x1dbadc[_0xed87('0x29')]);var _0x32db1f=callsValidation['validate'](_0x44b176['body']);if(_0x32db1f[_0xed87('0x24')]>0x0){return _0x1dbadc[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x32db1f);}var _0x2ef4a9=_0x44b176[_0xed87('0x29')]['userId'];var _0x7e6738=respondWithRpcPromise(_0xed87('0x41'));var _0x184e99=getAgent(_0x2ef4a9);return Promise[_0xed87('0x21')]([_0x7e6738,_0x184e99])[_0xed87('0x19')](function(_0x43034f){var _0x15e3bc=_0x43034f[0x0];var _0x1391a2=_0x43034f[0x1];var _0x2ffffa=_[_0xed87('0x42')](_0x15e3bc[_0xed87('0x22')],function(_0x227d19){return _0x227d19[_0xed87('0x23')]==_0x1391a2['id'];});return _0x1dbadc[_0xed87('0x17')](0xc8)['json']({'count':_0x2ffffa[_0xed87('0x24')],'rows':_0x2ffffa});})[_0xed87('0x1d')](handleError(_0x1dbadc));};exports[_0xed87('0x43')]=function(_0x423076,_0x1c6578){logger[_0xed87('0x11')](_0xed87('0x44'),_0x423076[_0xed87('0x29')]);var _0x4b1cc5=conferenceValidation[_0xed87('0xb')](_0x423076[_0xed87('0x29')]);if(_0x4b1cc5[_0xed87('0x24')]>0x0){return _0x1c6578[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x4b1cc5);}var _0x306d9a=_0x423076['body']['userId'];return getAgent(_0x306d9a)[_0xed87('0x19')](function(_0x176bc4){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x176bc4[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x176bc4[_0xed87('0x16')]),'webbar:conference');return _0x1c6578[_0xed87('0x17')](0xc8)['json']({'error':![],'message':_0xed87('0x45')});})[_0xed87('0x1d')](handleError(_0x1c6578));};exports['transfer']=function(_0x11b3a8,_0x30f9d0){logger['info'](_0xed87('0x46'),_0x11b3a8[_0xed87('0x29')]);var _0x2dd1e8=transferValidation[_0xed87('0xb')](_0x11b3a8[_0xed87('0x29')]);if(_0x2dd1e8['length']>0x0){return _0x30f9d0[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x2dd1e8);}var _0x263810=_0x11b3a8[_0xed87('0x29')]['userId'];var _0x58279a=_0x11b3a8[_0xed87('0x29')][_0xed87('0x33')];var _0x52b53f=_0x11b3a8[_0xed87('0x29')][_0xed87('0x47')];return getAgent(_0x263810)[_0xed87('0x19')](function(_0xa1c262){logger[_0xed87('0x11')](_0xed87('0x2d'),_0xa1c262[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0xa1c262[_0xed87('0x16')]),_0xed87('0x48'),{'sessionId':_0x58279a,'transferNumber':_0x52b53f});return _0x30f9d0[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x49')});})['catch'](handleError(_0x30f9d0));};
\ No newline at end of file
+var _0x55e0=['NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','userId','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send'];(function(_0x53c89d,_0x582b08){var _0x309480=function(_0x40bcfb){while(--_0x40bcfb){_0x53c89d['push'](_0x53c89d['shift']());}};_0x309480(++_0x582b08);}(_0x55e0,0xdc));var _0x055e=function(_0x4a869e,_0x84c67f){_0x4a869e=_0x4a869e-0x0;var _0xd2851f=_0x55e0[_0x4a869e];return _0xd2851f;};'use strict';var path=require(_0x055e('0x0'));var fs=require('fs');var _=require(_0x055e('0x1'));var db=require(_0x055e('0x2'))['db'];var config=require(_0x055e('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x055e('0x4'));var amiClient=jayson[_0x055e('0x5')][_0x055e('0x6')]({'port':0x232a});var logger=require(_0x055e('0x7'))(_0x055e('0x8'));var Redis=require(_0x055e('0x9'));config['redis']=_['defaults'](config[_0x055e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x055e('0xb'))(new Redis(config[_0x055e('0xa')]));var Schema=require(_0x055e('0xc'));var originateValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],_0x055e('0xe')]},'callNumber':{'type':'string','required':[!![],_0x055e('0xf')]},'callerId':{'type':_0x055e('0x10')},'callbackUrl':{'type':_0x055e('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],_0x055e('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x055e('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],_0x055e('0xe')]},'sessionId':{'type':_0x055e('0x10'),'required':[!![],_0x055e('0x11')]},'transferNumber':{'type':_0x055e('0x10'),'required':[!![],_0x055e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x055e('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],_0x055e('0xe')]},'sessionId':{'type':_0x055e('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x055e('0xd'),'required':[!![],_0x055e('0xe')]}});function emit(_0x111cdb,_0x599533,_0x3f2d0e){logger[_0x055e('0x13')](_0x111cdb,_0x599533,JSON[_0x055e('0x14')](_0x3f2d0e));io['to'](_0x111cdb)[_0x055e('0x15')](_0x599533,_0x3f2d0e);}function handleError(_0x2cc84e){return function(_0x4c85dd){console[_0x055e('0x16')](_0x055e('0x17'),_0x4c85dd,_0x4c85dd instanceof RangeError);logger[_0x055e('0x18')](_0x4c85dd[_0x055e('0x19')]);if(_0x4c85dd instanceof RangeError){if(_0x4c85dd['name']){delete _0x4c85dd[_0x055e('0x1a')];}_0x2cc84e[_0x055e('0x1b')](0x194)['send'](_0x4c85dd);}else{if(_0x4c85dd[_0x055e('0x1a')]){delete _0x4c85dd[_0x055e('0x1a')];}_0x2cc84e[_0x055e('0x1b')](0x1f4)[_0x055e('0x1c')](_0x4c85dd);}};}function checkError(){return function(_0x4280cf){if(!_0x4280cf){throw new RangeError(_0x055e('0x1d'));}return _0x4280cf;};}function respondWithRpcPromise(_0x53b766,_0x31c355){return new BPromise(function(_0x2f0346,_0x211594){var _0x5930ff=amiClient;return _0x5930ff[_0x055e('0x1e')](_0x53b766,_0x31c355)[_0x055e('0x1f')](function(_0x32c64e){if(_0x32c64e[_0x055e('0x18')]){if(_0x32c64e['error'][_0x055e('0x20')]===0x1f4){return _0x211594(_0x32c64e['error'][_0x055e('0x21')]);}return _0x2f0346(_0x32c64e[_0x055e('0x18')][_0x055e('0x21')]);}else{_0x2f0346(_0x32c64e[_0x055e('0x22')]);}})[_0x055e('0x23')](function(_0x4c653c){_0x211594(_0x4c653c);});});}function getAgent(_0x58caf9){return db[_0x055e('0x24')][_0x055e('0x25')]({'where':{'id':_0x58caf9,'role':_0x055e('0x26')}})['then'](checkError());}function getAgentCheckSession(_0x408e38,_0x29078a){return new BPromise(function(_0x42f2df,_0x2ef064){var _0x59539d=respondWithRpcPromise(_0x055e('0x27'));var _0x5958ef=getAgent(_0x408e38);Promise[_0x055e('0x28')]([_0x59539d,_0x5958ef])[_0x055e('0x1f')](function(_0x23a506){var _0x7822db=_0x23a506[0x0];var _0x1610f1=_0x23a506[0x1];var _0x5c0e76=_[_0x055e('0x29')](_0x7822db[_0x055e('0x2a')],function(_0x293062){return _0x293062[_0x055e('0x2b')]==_0x1610f1['id']&&_0x293062[_0x055e('0x2c')]==_0x29078a;});if(_0x5c0e76[_0x055e('0x2d')]==0x1){_0x42f2df(_0x1610f1);}else{_0x2ef064(new RangeError(_0x055e('0x2e')+_0x29078a+_0x055e('0x2f')));}});});}exports['originate']=function(_0x26d1c2,_0x43ec84){logger['info'](_0x055e('0x30'),_0x26d1c2[_0x055e('0x31')]);var _0x524344=originateValidation[_0x055e('0xc')](_0x26d1c2[_0x055e('0x31')]);if(_0x524344[_0x055e('0x2d')]>0x0){return _0x43ec84['status'](0x190)['json'](_0x524344);}var _0x25d19d=_0x26d1c2['body']['userId'];var _0x55a1ee=_0x26d1c2[_0x055e('0x31')][_0x055e('0x32')];var _0x35c6cf=_0x26d1c2[_0x055e('0x31')][_0x055e('0x33')];var _0x16a4fa=_0x26d1c2[_0x055e('0x31')][_0x055e('0x34')];return getAgent(_0x25d19d)[_0x055e('0x1f')](function(_0x2f60fa){logger[_0x055e('0x13')](_0x055e('0x35'),_0x2f60fa['name']);emit(util['format'](_0x055e('0x36'),_0x2f60fa[_0x055e('0x1a')]),_0x055e('0x37'),{'callNumber':_0x55a1ee,'callerId':_0x35c6cf,'callbackUrl':_0x16a4fa});return _0x43ec84[_0x055e('0x1b')](0xc8)[_0x055e('0x38')]({'error':![],'message':_0x055e('0x39')});})[_0x055e('0x23')](handleError(_0x43ec84));};exports['hangup']=function(_0x18b88e,_0x265fed){logger[_0x055e('0x13')](_0x055e('0x3a'),_0x18b88e[_0x055e('0x31')]);var _0x585b8a=hangupValidation[_0x055e('0xc')](_0x18b88e[_0x055e('0x31')]);if(_0x585b8a['length']>0x0){return _0x265fed[_0x055e('0x1b')](0x190)[_0x055e('0x38')](_0x585b8a);}var _0x4a97ab=_0x18b88e[_0x055e('0x31')][_0x055e('0x3b')];var _0x4e424b=_0x18b88e[_0x055e('0x31')][_0x055e('0x2c')];return getAgent(_0x4a97ab)['then'](function(_0x1012a4){logger[_0x055e('0x13')](_0x055e('0x35'),_0x1012a4['name']);emit(util[_0x055e('0x3c')](_0x055e('0x36'),_0x1012a4['name']),_0x055e('0x3d'),{'sessionId':_0x4e424b});return _0x265fed[_0x055e('0x1b')](0xc8)[_0x055e('0x38')]({'error':![],'message':'hangup\x20executed!'});})[_0x055e('0x23')](handleError(_0x265fed));};exports[_0x055e('0x3e')]=function(_0x176a2d,_0x4fa534){logger['info'](_0x055e('0x3f'),_0x176a2d[_0x055e('0x31')]);var _0x4ff19e=answerValidation[_0x055e('0xc')](_0x176a2d['body']);if(_0x4ff19e[_0x055e('0x2d')]>0x0){return _0x4fa534['status'](0x190)[_0x055e('0x38')](_0x4ff19e);}var _0x31c57a=_0x176a2d[_0x055e('0x31')]['userId'];var _0x57483c=_0x176a2d[_0x055e('0x31')][_0x055e('0x2c')];return getAgent(_0x31c57a)[_0x055e('0x1f')](function(_0x445d74){logger['info']('entityFound:',_0x445d74[_0x055e('0x1a')]);emit(util[_0x055e('0x3c')]('user:%s',_0x445d74[_0x055e('0x1a')]),_0x055e('0x40'),{'sessionId':_0x57483c});return _0x4fa534[_0x055e('0x1b')](0xc8)[_0x055e('0x38')]({'error':![],'message':_0x055e('0x41')});})[_0x055e('0x23')](handleError(_0x4fa534));};exports['hold']=function(_0x297edd,_0x118a0e){logger['info'](_0x055e('0x42'),_0x297edd[_0x055e('0x31')]);var _0x341c46=holdValidation[_0x055e('0xc')](_0x297edd[_0x055e('0x31')]);if(_0x341c46[_0x055e('0x2d')]>0x0){return _0x118a0e[_0x055e('0x1b')](0x190)['json'](_0x341c46);}var _0x35b2c6=_0x297edd['body'][_0x055e('0x3b')];var _0xed7611=_0x297edd[_0x055e('0x31')]['sessionId'];return getAgent(_0x35b2c6)['then'](function(_0x45845e){logger[_0x055e('0x13')](_0x055e('0x35'),_0x45845e[_0x055e('0x1a')]);emit(util[_0x055e('0x3c')](_0x055e('0x36'),_0x45845e[_0x055e('0x1a')]),_0x055e('0x43'),{'sessionId':_0xed7611});return _0x118a0e[_0x055e('0x1b')](0xc8)['json']({'error':![],'message':_0x055e('0x44')});})[_0x055e('0x23')](handleError(_0x118a0e));};exports[_0x055e('0x45')]=function(_0x17695b,_0x335415){logger['info'](_0x055e('0x46'),_0x17695b[_0x055e('0x31')]);var _0x3e7fa6=unholdValidation['validate'](_0x17695b[_0x055e('0x31')]);if(_0x3e7fa6['length']>0x0){return _0x335415[_0x055e('0x1b')](0x190)[_0x055e('0x38')](_0x3e7fa6);}var _0x49129a=_0x17695b[_0x055e('0x31')][_0x055e('0x3b')];var _0x3e6329=_0x17695b['body']['sessionId'];return getAgent(_0x49129a)[_0x055e('0x1f')](function(_0x413778){logger[_0x055e('0x13')](_0x055e('0x35'),_0x413778[_0x055e('0x1a')]);emit(util[_0x055e('0x3c')](_0x055e('0x36'),_0x413778[_0x055e('0x1a')]),_0x055e('0x47'),{'sessionId':_0x3e6329});return _0x335415[_0x055e('0x1b')](0xc8)['json']({'error':![],'message':_0x055e('0x48')});})[_0x055e('0x23')](handleError(_0x335415));};exports[_0x055e('0x49')]=function(_0x200b53,_0x57a9e4){logger[_0x055e('0x13')](_0x055e('0x4a'),_0x57a9e4[_0x055e('0x31')]);var _0x3eb1a1=callsValidation['validate'](_0x200b53['body']);if(_0x3eb1a1[_0x055e('0x2d')]>0x0){return _0x57a9e4[_0x055e('0x1b')](0x190)[_0x055e('0x38')](_0x3eb1a1);}var _0x2fbb1c=_0x200b53[_0x055e('0x31')][_0x055e('0x3b')];var _0x3876d0=respondWithRpcPromise(_0x055e('0x27'));var _0x56db9c=getAgent(_0x2fbb1c);return Promise['all']([_0x3876d0,_0x56db9c])[_0x055e('0x1f')](function(_0x33592d){var _0x5240d5=_0x33592d[0x0];var _0x143e8c=_0x33592d[0x1];var _0x16dd1e=_[_0x055e('0x29')](_0x5240d5[_0x055e('0x2a')],function(_0x50aa1f){return _0x50aa1f[_0x055e('0x2b')]==_0x143e8c['id'];});return _0x57a9e4[_0x055e('0x1b')](0xc8)[_0x055e('0x38')]({'count':_0x16dd1e[_0x055e('0x2d')],'rows':_0x16dd1e});})[_0x055e('0x23')](handleError(_0x57a9e4));};exports[_0x055e('0x4b')]=function(_0x2075db,_0x31935b){logger['info'](_0x055e('0x4c'),_0x2075db[_0x055e('0x31')]);var _0x5bd8f0=conferenceValidation[_0x055e('0xc')](_0x2075db[_0x055e('0x31')]);if(_0x5bd8f0[_0x055e('0x2d')]>0x0){return _0x31935b[_0x055e('0x1b')](0x190)['json'](_0x5bd8f0);}var _0x8b7e45=_0x2075db[_0x055e('0x31')][_0x055e('0x3b')];return getAgent(_0x8b7e45)['then'](function(_0x329d46){logger[_0x055e('0x13')](_0x055e('0x35'),_0x329d46[_0x055e('0x1a')]);emit(util[_0x055e('0x3c')]('user:%s',_0x329d46[_0x055e('0x1a')]),_0x055e('0x4d'));return _0x31935b[_0x055e('0x1b')](0xc8)[_0x055e('0x38')]({'error':![],'message':_0x055e('0x4e')});})['catch'](handleError(_0x31935b));};exports[_0x055e('0x4f')]=function(_0x34c805,_0x107b88){logger['info'](_0x055e('0x50'),_0x34c805[_0x055e('0x31')]);var _0x3ecc65=transferValidation[_0x055e('0xc')](_0x34c805[_0x055e('0x31')]);if(_0x3ecc65['length']>0x0){return _0x107b88[_0x055e('0x1b')](0x190)['json'](_0x3ecc65);}var _0x24ac0c=_0x34c805[_0x055e('0x31')]['userId'];var _0x3137bb=_0x34c805[_0x055e('0x31')][_0x055e('0x2c')];var _0x2bdf06=_0x34c805['body']['transferNumber'];return getAgent(_0x24ac0c)[_0x055e('0x1f')](function(_0x5e4f42){logger[_0x055e('0x13')](_0x055e('0x35'),_0x5e4f42[_0x055e('0x1a')]);emit(util[_0x055e('0x3c')](_0x055e('0x36'),_0x5e4f42[_0x055e('0x1a')]),_0x055e('0x51'),{'sessionId':_0x3137bb,'transferNumber':_0x2bdf06});return _0x107b88[_0x055e('0x1b')](0xc8)[_0x055e('0x38')]({'error':![],'message':_0x055e('0x52')});})['catch'](handleError(_0x107b88));};
\ No newline at end of file
index f2fc421..f3e6f3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x497b6d,_0x417ee8){var _0x29abf3=function(_0x346033){while(--_0x346033){_0x497b6d['push'](_0x497b6d['shift']());}};_0x29abf3(++_0x417ee8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./whatsappAccount.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x12')](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x14')]);router['post'](_0x65f6('0x15'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x65f6('0x12')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x16')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router['post']('/:id/notify',controller[_0x65f6('0x18')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x65f6('0x19')]);router[_0x65f6('0x1a')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x1c')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1d')]);router['delete'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65f6('0x1c')](_0x65f6('0x15'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1c')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller['removeAgents']);module[_0x65f6('0x1f')]=router;
\ No newline at end of file
+var _0x0295=['addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','/:id/applications','addApplications','/:id/notify','notify','put','/:id','update','delete','removeDispositions','removeAnswers','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','getDispositions','getAnswers','getAgents','post','create','/:id/dispositions'];(function(_0xebb999,_0x10a551){var _0x1882ea=function(_0x564642){while(--_0x564642){_0xebb999['push'](_0xebb999['shift']());}};_0x1882ea(++_0x10a551);}(_0x0295,0x1f0));var _0x5029=function(_0x32986,_0x4489c8){_0x32986=_0x32986-0x0;var _0x355ebb=_0x0295[_0x32986];return _0x355ebb;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0x7')]('/:id/dispositions',auth[_0x5029('0x8')](),controller[_0x5029('0xa')]);router[_0x5029('0x7')]('/:id/canned_answers',auth[_0x5029('0x8')](),controller[_0x5029('0xb')]);router[_0x5029('0x7')]('/:id/users',auth[_0x5029('0x8')](),controller[_0x5029('0xc')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x5029('0xd')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0xe')]);router[_0x5029('0xd')](_0x5029('0xf'),auth[_0x5029('0x8')](),controller[_0x5029('0x10')]);router[_0x5029('0xd')](_0x5029('0x11'),auth[_0x5029('0x8')](),controller[_0x5029('0x12')]);router[_0x5029('0xd')](_0x5029('0x13'),auth[_0x5029('0x8')](),controller[_0x5029('0x14')]);router['post'](_0x5029('0x15'),auth[_0x5029('0x8')](),controller[_0x5029('0x16')]);router[_0x5029('0xd')](_0x5029('0x17'),controller[_0x5029('0x18')]);router[_0x5029('0xd')]('/:id/send',auth[_0x5029('0x8')](),controller['send']);router[_0x5029('0x19')](_0x5029('0x1a'),auth[_0x5029('0x8')](),controller[_0x5029('0x1b')]);router['delete']('/:id',auth[_0x5029('0x8')](),controller['destroy']);router[_0x5029('0x1c')](_0x5029('0xf'),auth[_0x5029('0x8')](),controller[_0x5029('0x1d')]);router[_0x5029('0x1c')](_0x5029('0x11'),auth[_0x5029('0x8')](),controller[_0x5029('0x1e')]);router[_0x5029('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5029('0x1f')]=router;
\ No newline at end of file
index 19be36e..62691df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcccb=['randomstring','name','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x54c594,_0x4b66b0){var _0x57b45d=function(_0x2b017b){while(--_0x2b017b){_0x54c594['push'](_0x54c594['shift']());}};_0x57b45d(++_0x4b66b0);}(_0xcccb,0xff));var _0xbccc=function(_0xde040b,_0x25a90e){_0xde040b=_0xde040b-0x0;var _0x5251f9=_0xcccb[_0xde040b];return _0x5251f9;};'use strict';var Sequelize=require(_0xbccc('0x0'));var rs=require(_0xbccc('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbccc('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xbccc('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xbccc('0x3')],'defaultValue':function(){return rs[_0xbccc('0x4')]();}},'phone':{'type':Sequelize[_0xbccc('0x3')]},'type':{'type':Sequelize[_0xbccc('0x5')](_0xbccc('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0xbccc('0x3')]},'baseUrl':{'type':Sequelize[_0xbccc('0x3')]},'authToken':{'type':Sequelize[_0xbccc('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbccc('0x7')],'defaultValue':function(){return _0xbccc('0x8');}},'notificationSound':{'type':Sequelize[_0xbccc('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbccc('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbccc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbccc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbccc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbccc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbccc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbccc('0xa')],'comment':_0xbccc('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbccc('0xc'),'set':function(_0x20fb98){if(!_0x20fb98){this[_0xbccc('0xd')](_0xbccc('0xe'),null);}this[_0xbccc('0xd')](_0xbccc('0xf'),_0x20fb98);}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x8eed=['STRING','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name'];(function(_0x19705e,_0x459dfc){var _0x241dd7=function(_0x3b2333){while(--_0x3b2333){_0x19705e['push'](_0x19705e['shift']());}};_0x241dd7(++_0x459dfc);}(_0x8eed,0x10b));var _0xd8ee=function(_0xb7b39c,_0x41e5d7){_0xb7b39c=_0xb7b39c-0x0;var _0x31e8a5=_0x8eed[_0xb7b39c];return _0x31e8a5;};'use strict';var Sequelize=require(_0xd8ee('0x0'));var rs=require('randomstring');module[_0xd8ee('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8ee('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xd8ee('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xd8ee('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd8ee('0x4')]();}},'phone':{'type':Sequelize[_0xd8ee('0x3')]},'type':{'type':Sequelize[_0xd8ee('0x5')]('twilio',_0xd8ee('0x6'))},'accountSid':{'type':Sequelize[_0xd8ee('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xd8ee('0x7')],'defaultValue':function(){return _0xd8ee('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd8ee('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd8ee('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd8ee('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd8ee('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8ee('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8ee('0xa')],'comment':_0xd8ee('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1ba161){if(!_0x1ba161){this[_0xd8ee('0xc')](_0xd8ee('0xd'),null);}this['setDataValue'](_0xd8ee('0xe'),_0x1ba161);}},'description':{'type':Sequelize[_0xd8ee('0x3')]}};
\ No newline at end of file
index 92b7718..379c797 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c44=['then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','hasOwnProperty','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http'];(function(_0x5773f5,_0x5d8c42){var _0x437123=function(_0xc93762){while(--_0xc93762){_0x5773f5['push'](_0x5773f5['shift']());}};_0x437123(++_0x5d8c42);}(_0x8c44,0x167));var _0x48c4=function(_0x53a456,_0x1c3d73){_0x53a456=_0x53a456-0x0;var _0x19bf77=_0x8c44[_0x53a456];return _0x19bf77;};'use strict';var emlformat=require(_0x48c4('0x0'));var rimraf=require(_0x48c4('0x1'));var zipdir=require(_0x48c4('0x2'));var jsonpatch=require(_0x48c4('0x3'));var rp=require('request-promise');var moment=require(_0x48c4('0x4'));var BPromise=require(_0x48c4('0x5'));var Mustache=require(_0x48c4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x48c4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x48c4('0x8'));var jsforce=require(_0x48c4('0x9'));var deskjs=require(_0x48c4('0xa'));var toCsv=require(_0x48c4('0xb'));var querystring=require(_0x48c4('0xc'));var Papa=require(_0x48c4('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48c4('0xe'));var as=require(_0x48c4('0xf'));var hardwareService=require(_0x48c4('0x10'));var logger=require('../../config/logger')(_0x48c4('0x11'));var utils=require('../../config/utils');var config=require(_0x48c4('0x12'));var licenseUtil=require(_0x48c4('0x13'));var db=require(_0x48c4('0x14'))['db'];config[_0x48c4('0x15')]=_[_0x48c4('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x48c4('0x17')](socket);var jayson=require(_0x48c4('0x18'));var client=jayson[_0x48c4('0x19')][_0x48c4('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x48208e,_0x5686b6,_0x35dfa4,_0x5528eb){return new BPromise(function(_0x1a6fc4,_0x4de69a){var _0x3822c4=_0x5528eb||client;return _0x3822c4['request'](_0x48208e,_0x35dfa4)[_0x48c4('0x1b')](function(_0x18ce4c){logger[_0x48c4('0x1c')]('WhatsappAccount,\x20%s,\x20%s',_0x5686b6,'request\x20sent');logger[_0x48c4('0x1d')](_0x48c4('0x1e'),_0x5686b6,_0x48c4('0x1f'),JSON[_0x48c4('0x20')](_0x18ce4c));if(_0x18ce4c[_0x48c4('0x21')]){if(_0x18ce4c[_0x48c4('0x21')][_0x48c4('0x22')]===0x1f4){logger[_0x48c4('0x21')](_0x48c4('0x23'),_0x5686b6,_0x18ce4c[_0x48c4('0x21')][_0x48c4('0x24')]);return _0x4de69a(_0x18ce4c['error'][_0x48c4('0x24')]);}logger[_0x48c4('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x5686b6,_0x18ce4c['error'][_0x48c4('0x24')]);return _0x1a6fc4(_0x18ce4c['error'][_0x48c4('0x24')]);}else{logger[_0x48c4('0x1c')](_0x48c4('0x23'),_0x5686b6,_0x48c4('0x1f'));_0x1a6fc4(_0x18ce4c[_0x48c4('0x25')][_0x48c4('0x24')]);}})[_0x48c4('0x26')](function(_0x23d9f5){logger[_0x48c4('0x21')](_0x48c4('0x23'),_0x5686b6,_0x23d9f5);_0x4de69a(_0x23d9f5);});});}function respondWithStatusCode(_0x3177fd,_0x367b1e){_0x367b1e=_0x367b1e||0xcc;return function(_0x2e1934){if(_0x2e1934){return _0x3177fd[_0x48c4('0x27')](_0x367b1e);}return _0x3177fd[_0x48c4('0x28')](_0x367b1e)['end']();};}function respondWithResult(_0x1fb187,_0x34c2a5){_0x34c2a5=_0x34c2a5||0xc8;return function(_0x306b0b){if(_0x306b0b){return _0x1fb187[_0x48c4('0x28')](_0x34c2a5)['json'](_0x306b0b);}};}function respondWithFilteredResult(_0x5da01d,_0x3d10c2){return function(_0x394a5f){if(_0x394a5f){var _0x515d0a=typeof _0x3d10c2[_0x48c4('0x29')]===_0x48c4('0x2a')&&typeof _0x3d10c2[_0x48c4('0x2b')]===_0x48c4('0x2a');var _0x37ba2d=_0x394a5f[_0x48c4('0x2c')];var _0x2cfcb7=_0x515d0a?0x0:_0x3d10c2[_0x48c4('0x29')];var _0x533faa=_0x515d0a?_0x394a5f['count']:_0x3d10c2['offset']+_0x3d10c2['limit'];var _0x400b54;if(_0x533faa>=_0x37ba2d){_0x533faa=_0x37ba2d;_0x400b54=0xc8;}else{_0x400b54=0xce;}_0x5da01d[_0x48c4('0x28')](_0x400b54);return _0x5da01d[_0x48c4('0x2d')](_0x48c4('0x2e'),_0x2cfcb7+'-'+_0x533faa+'/'+_0x37ba2d)['json'](_0x394a5f);}return null;};}function patchUpdates(_0x4cda58){return function(_0x14e912){try{jsonpatch[_0x48c4('0x2f')](_0x14e912,_0x4cda58,!![]);}catch(_0x1a9cd4){return BPromise[_0x48c4('0x30')](_0x1a9cd4);}return _0x14e912[_0x48c4('0x31')]();};}function saveUpdates(_0x27c3d4,_0x538efb){return function(_0x3afcd0){if(_0x3afcd0){return _0x3afcd0[_0x48c4('0x32')](_0x27c3d4)[_0x48c4('0x1b')](function(_0xaf6490){return _0xaf6490;});}return null;};}function removeEntity(_0x110ae3,_0x1a5daa){return function(_0x41475b){if(_0x41475b){return _0x41475b['destroy']()['then'](function(){var _0x5e0beb=_0x41475b['get']({'plain':!![]});var _0x4b7dc0=_0x48c4('0x33');return db[_0x48c4('0x34')][_0x48c4('0x35')]({'where':{'type':_0x4b7dc0,'resourceId':_0x5e0beb['id']}})[_0x48c4('0x1b')](function(){return _0x41475b;});})[_0x48c4('0x1b')](function(){_0x110ae3['status'](0xcc)[_0x48c4('0x36')]();});}};}function handleEntityNotFound(_0x280a2e,_0x230966){return function(_0x1334cc){if(!_0x1334cc){_0x280a2e[_0x48c4('0x27')](0x194);}return _0x1334cc;};}function handleError(_0x280ba1,_0x4e7f1f){_0x4e7f1f=_0x4e7f1f||0x1f4;return function(_0x9182ae){logger['error'](_0x9182ae[_0x48c4('0x37')]);if(_0x9182ae[_0x48c4('0x38')]){delete _0x9182ae[_0x48c4('0x38')];}_0x280ba1[_0x48c4('0x28')](_0x4e7f1f)[_0x48c4('0x39')](_0x9182ae);};}exports[_0x48c4('0x3a')]=function(_0x3e2fd1,_0x310f9b){var _0x17b7a1={'include':[{'model':db[_0x48c4('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5846dc={},_0x478a8e={'count':0x0,'rows':[]};var _0x451936=_[_0x48c4('0x3c')](db[_0x48c4('0x3d')][_0x48c4('0x3e')],function(_0x511db0){return{'name':_0x511db0['fieldName'],'type':_0x511db0[_0x48c4('0x3f')][_0x48c4('0x40')]};});_0x5846dc[_0x48c4('0x41')]=_['map'](_0x451936,_0x48c4('0x38'));_0x5846dc['query']=_[_0x48c4('0x42')](_0x3e2fd1[_0x48c4('0x43')]);_0x5846dc[_0x48c4('0x44')]=_[_0x48c4('0x45')](_0x5846dc['model'],_0x5846dc['query']);_0x17b7a1[_0x48c4('0x46')]=_['intersection'](_0x5846dc[_0x48c4('0x41')],qs[_0x48c4('0x47')](_0x3e2fd1['query']['fields']));_0x17b7a1[_0x48c4('0x46')]=_0x17b7a1[_0x48c4('0x46')][_0x48c4('0x48')]?_0x17b7a1['attributes']:_0x5846dc[_0x48c4('0x41')];if(!_0x3e2fd1[_0x48c4('0x43')]['hasOwnProperty'](_0x48c4('0x49'))){_0x17b7a1[_0x48c4('0x2b')]=qs[_0x48c4('0x2b')](_0x3e2fd1[_0x48c4('0x43')]['limit']);_0x17b7a1['offset']=qs[_0x48c4('0x29')](_0x3e2fd1['query'][_0x48c4('0x29')]);}_0x17b7a1[_0x48c4('0x4a')]=qs[_0x48c4('0x4b')](_0x3e2fd1[_0x48c4('0x43')]['sort']);_0x17b7a1[_0x48c4('0x4c')]=qs[_0x48c4('0x44')](_[_0x48c4('0x4d')](_0x3e2fd1[_0x48c4('0x43')],_0x5846dc['filters']),_0x451936);if(_0x3e2fd1[_0x48c4('0x43')][_0x48c4('0x4e')]){_0x17b7a1[_0x48c4('0x4c')]=_[_0x48c4('0x4f')](_0x17b7a1[_0x48c4('0x4c')],{'$or':_[_0x48c4('0x3c')](_0x451936,function(_0x40fef9){if(_0x40fef9[_0x48c4('0x3f')]!==_0x48c4('0x50')){var _0x4e9665={};_0x4e9665[_0x40fef9[_0x48c4('0x38')]]={'$like':'%'+_0x3e2fd1['query'][_0x48c4('0x4e')]+'%'};return _0x4e9665;}})});}_0x17b7a1=_[_0x48c4('0x4f')]({},_0x17b7a1,_0x3e2fd1[_0x48c4('0x51')]);var _0x4c7b25={'where':_0x17b7a1[_0x48c4('0x4c')]};return db[_0x48c4('0x3d')]['count'](_0x4c7b25)[_0x48c4('0x1b')](function(_0x4fb348){_0x478a8e[_0x48c4('0x2c')]=_0x4fb348;if(_0x3e2fd1[_0x48c4('0x43')][_0x48c4('0x52')]){_0x17b7a1[_0x48c4('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x48c4('0x54')](_0x17b7a1);})[_0x48c4('0x1b')](function(_0x3cdbe9){_0x478a8e['rows']=_0x3cdbe9;return _0x478a8e;})[_0x48c4('0x1b')](respondWithFilteredResult(_0x310f9b,_0x17b7a1))[_0x48c4('0x26')](handleError(_0x310f9b,null));};exports[_0x48c4('0x55')]=function(_0x5f42c3,_0x3cf8ef){var _0xd8d428={'raw':![],'where':{'id':_0x5f42c3[_0x48c4('0x56')]['id']},'include':[{'model':db[_0x48c4('0x3b')],'as':_0x48c4('0x57')}]},_0x35c62c={};_0x35c62c['model']=_['keys'](db[_0x48c4('0x3d')][_0x48c4('0x3e')]);_0x35c62c[_0x48c4('0x43')]=_[_0x48c4('0x42')](_0x5f42c3[_0x48c4('0x43')]);_0x35c62c[_0x48c4('0x44')]=_[_0x48c4('0x45')](_0x35c62c[_0x48c4('0x41')],_0x35c62c[_0x48c4('0x43')]);_0xd8d428[_0x48c4('0x46')]=_[_0x48c4('0x45')](_0x35c62c[_0x48c4('0x41')],qs[_0x48c4('0x47')](_0x5f42c3['query'][_0x48c4('0x47')]));_0xd8d428[_0x48c4('0x46')]=_0xd8d428[_0x48c4('0x46')][_0x48c4('0x48')]?_0xd8d428[_0x48c4('0x46')]:_0x35c62c['model'];if(_0x5f42c3[_0x48c4('0x43')][_0x48c4('0x52')]){_0xd8d428['include']=[{'all':!![]}];}_0xd8d428=_['merge']({},_0xd8d428,_0x5f42c3[_0x48c4('0x51')]);return db[_0x48c4('0x3d')]['find'](_0xd8d428)['then'](handleEntityNotFound(_0x3cf8ef,null))[_0x48c4('0x1b')](respondWithResult(_0x3cf8ef,null))[_0x48c4('0x26')](handleError(_0x3cf8ef,null));};exports[_0x48c4('0x58')]=function(_0x42f225,_0x1f9b29){return db[_0x48c4('0x3d')][_0x48c4('0x58')](_0x42f225[_0x48c4('0x59')],{})['then'](function(_0x16e6eb){var _0x28f203=_0x42f225[_0x48c4('0x5a')][_0x48c4('0x5b')]({'plain':!![]});if(!_0x28f203)throw new Error(_0x48c4('0x5c'));if(_0x28f203['role']===_0x48c4('0x5a')){var _0x1e46d6=_0x16e6eb[_0x48c4('0x5b')]({'plain':!![]});var _0x5a6631=_0x48c4('0x33');return db['UserProfileSection'][_0x48c4('0x5d')]({'where':{'name':_0x5a6631,'userProfileId':_0x28f203[_0x48c4('0x5e')]},'raw':!![]})[_0x48c4('0x1b')](function(_0x53ddde){if(_0x53ddde&&_0x53ddde['autoAssociation']===0x0){return db[_0x48c4('0x34')]['create']({'name':_0x1e46d6[_0x48c4('0x38')],'resourceId':_0x1e46d6['id'],'type':_0x53ddde[_0x48c4('0x38')],'sectionId':_0x53ddde['id']},{})[_0x48c4('0x1b')](function(){return _0x16e6eb;});}else{return _0x16e6eb;}})[_0x48c4('0x26')](function(_0x512814){logger[_0x48c4('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x512814);throw _0x512814;});}return _0x16e6eb;})[_0x48c4('0x1b')](respondWithResult(_0x1f9b29,0xc9))[_0x48c4('0x26')](handleError(_0x1f9b29,null));};exports[_0x48c4('0x32')]=function(_0x1f8045,_0x5fde34){if(_0x1f8045[_0x48c4('0x59')]['id']){delete _0x1f8045['body']['id'];}return db[_0x48c4('0x3d')][_0x48c4('0x5d')]({'where':{'id':_0x1f8045['params']['id']},'include':[{'model':db[_0x48c4('0x3b')],'as':_0x48c4('0x57')}]})[_0x48c4('0x1b')](handleEntityNotFound(_0x5fde34,null))[_0x48c4('0x1b')](saveUpdates(_0x1f8045[_0x48c4('0x59')],null))[_0x48c4('0x1b')](respondWithResult(_0x5fde34,null))[_0x48c4('0x26')](handleError(_0x5fde34,null));};exports['destroy']=function(_0x52e050,_0x520ec4){return db['WhatsappAccount'][_0x48c4('0x5d')]({'where':{'id':_0x52e050['params']['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x520ec4,null))['then'](removeEntity(_0x520ec4,null))[_0x48c4('0x26')](handleError(_0x520ec4,null));};exports[_0x48c4('0x5f')]=function(_0x1dd620,_0x2e422b){return db[_0x48c4('0x3d')][_0x48c4('0x5f')]()[_0x48c4('0x1b')](respondWithResult(_0x2e422b,null))['catch'](handleError(_0x2e422b,null));};exports[_0x48c4('0x60')]=function(_0x2097fb,_0x3a7669,_0x4e6e4a){if(_0x2097fb[_0x48c4('0x59')]['id']){delete _0x2097fb[_0x48c4('0x59')]['id'];}return db[_0x48c4('0x3d')][_0x48c4('0x5d')]({'where':{'id':_0x2097fb[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x3a7669,null))['then'](function(_0x4dbdb4){if(_0x4dbdb4){_0x2097fb[_0x48c4('0x59')][_0x48c4('0x61')]=_0x4dbdb4['id'];return db[_0x48c4('0x62')][_0x48c4('0x58')](_0x2097fb[_0x48c4('0x59')]);}})[_0x48c4('0x1b')](respondWithResult(_0x3a7669,null))['catch'](handleError(_0x3a7669,null));};exports[_0x48c4('0x63')]=function(_0x16b2a9,_0x119c40,_0x1122b6){var _0x22b267={'raw':![],'where':{}};var _0x3938c0={};var _0xd27b2={'count':0x0,'rows':[]};return db[_0x48c4('0x3d')][_0x48c4('0x64')]({'where':{'id':_0x16b2a9[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x119c40,null))[_0x48c4('0x1b')](function(_0x4d490a){if(_0x4d490a){_0x3938c0[_0x48c4('0x41')]=_['keys'](db[_0x48c4('0x62')][_0x48c4('0x3e')]);_0x3938c0[_0x48c4('0x43')]=_[_0x48c4('0x42')](_0x16b2a9['query']);_0x3938c0[_0x48c4('0x44')]=_[_0x48c4('0x45')](_0x3938c0['model'],_0x3938c0[_0x48c4('0x43')]);_0x22b267[_0x48c4('0x46')]=_['intersection'](_0x3938c0['model'],qs['fields'](_0x16b2a9[_0x48c4('0x43')]['fields']));_0x22b267['attributes']=_0x22b267['attributes'][_0x48c4('0x48')]?_0x22b267[_0x48c4('0x46')]:_0x3938c0[_0x48c4('0x41')];if(!_0x16b2a9[_0x48c4('0x43')]['hasOwnProperty'](_0x48c4('0x49'))){_0x22b267[_0x48c4('0x2b')]=qs[_0x48c4('0x2b')](_0x16b2a9['query']['limit']);_0x22b267['offset']=qs[_0x48c4('0x29')](_0x16b2a9[_0x48c4('0x43')][_0x48c4('0x29')]);}_0x22b267[_0x48c4('0x4a')]=qs[_0x48c4('0x4b')](_0x16b2a9['query'][_0x48c4('0x4b')]);_0x22b267[_0x48c4('0x4c')]=qs[_0x48c4('0x44')](_[_0x48c4('0x4d')](_0x16b2a9['query'],_0x3938c0['filters']));_0x22b267['where']['WhatsappAccountId']=_0x4d490a['id'];if(_0x16b2a9[_0x48c4('0x43')][_0x48c4('0x4e')]){_0x22b267[_0x48c4('0x4c')]=_['merge'](_0x22b267[_0x48c4('0x4c')],{'$or':_[_0x48c4('0x3c')](_0x22b267[_0x48c4('0x46')],function(_0x2e3754){var _0x2ce992={};_0x2ce992[_0x2e3754]={'$like':'%'+_0x16b2a9[_0x48c4('0x43')][_0x48c4('0x4e')]+'%'};return _0x2ce992;})});}_0x22b267=_[_0x48c4('0x4f')]({},_0x22b267,_0x16b2a9[_0x48c4('0x51')]);return db['Disposition'][_0x48c4('0x2c')]({'where':_0x22b267['where']})[_0x48c4('0x1b')](function(_0x429557){_0xd27b2[_0x48c4('0x2c')]=_0x429557;if(_0x16b2a9['query'][_0x48c4('0x52')]){_0x22b267['include']=[{'all':!![]}];}return db[_0x48c4('0x62')][_0x48c4('0x54')](_0x22b267);})[_0x48c4('0x1b')](function(_0x4b54b){_0xd27b2['rows']=_0x4b54b;return _0xd27b2;});}})[_0x48c4('0x1b')](respondWithFilteredResult(_0x119c40,_0x22b267))[_0x48c4('0x26')](handleError(_0x119c40,null));};exports['removeDispositions']=function(_0x58037b,_0x4549cc,_0x11f5ad){return db[_0x48c4('0x3d')][_0x48c4('0x5d')]({'where':{'id':_0x58037b[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x4549cc,null))[_0x48c4('0x1b')](function(_0x4e44ed){if(_0x4e44ed){return _0x4e44ed[_0x48c4('0x65')](_0x58037b['query'][_0x48c4('0x66')]);}})[_0x48c4('0x1b')](respondWithStatusCode(_0x4549cc,null))['catch'](handleError(_0x4549cc,null));};exports[_0x48c4('0x67')]=function(_0xea5460,_0x1d3712,_0x4d6a19){if(_0xea5460[_0x48c4('0x59')]['id']){delete _0xea5460['body']['id'];}return db['WhatsappAccount'][_0x48c4('0x5d')]({'where':{'id':_0xea5460[_0x48c4('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d3712,null))[_0x48c4('0x1b')](function(_0x1d59f2){if(_0x1d59f2){_0xea5460[_0x48c4('0x59')][_0x48c4('0x61')]=_0x1d59f2['id'];return db['CannedAnswer']['create'](_0xea5460[_0x48c4('0x59')]);}})['then'](respondWithResult(_0x1d3712,null))[_0x48c4('0x26')](handleError(_0x1d3712,null));};exports['getAnswers']=function(_0x418551,_0x2092b6,_0x574383){var _0x19be4d={'raw':![],'where':{}};var _0x380562={};var _0x24ca6c={'count':0x0,'rows':[]};return db[_0x48c4('0x3d')][_0x48c4('0x64')]({'where':{'id':_0x418551[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x2092b6,null))[_0x48c4('0x1b')](function(_0x175171){if(_0x175171){_0x380562[_0x48c4('0x41')]=_[_0x48c4('0x42')](db[_0x48c4('0x68')]['rawAttributes']);_0x380562[_0x48c4('0x43')]=_[_0x48c4('0x42')](_0x418551['query']);_0x380562[_0x48c4('0x44')]=_[_0x48c4('0x45')](_0x380562[_0x48c4('0x41')],_0x380562[_0x48c4('0x43')]);_0x19be4d[_0x48c4('0x46')]=_[_0x48c4('0x45')](_0x380562['model'],qs[_0x48c4('0x47')](_0x418551[_0x48c4('0x43')][_0x48c4('0x47')]));_0x19be4d[_0x48c4('0x46')]=_0x19be4d['attributes'][_0x48c4('0x48')]?_0x19be4d[_0x48c4('0x46')]:_0x380562[_0x48c4('0x41')];if(!_0x418551[_0x48c4('0x43')]['hasOwnProperty'](_0x48c4('0x49'))){_0x19be4d[_0x48c4('0x2b')]=qs[_0x48c4('0x2b')](_0x418551[_0x48c4('0x43')][_0x48c4('0x2b')]);_0x19be4d[_0x48c4('0x29')]=qs[_0x48c4('0x29')](_0x418551[_0x48c4('0x43')][_0x48c4('0x29')]);}_0x19be4d[_0x48c4('0x4a')]=qs[_0x48c4('0x4b')](_0x418551[_0x48c4('0x43')][_0x48c4('0x4b')]);_0x19be4d[_0x48c4('0x4c')]=qs[_0x48c4('0x44')](_[_0x48c4('0x4d')](_0x418551[_0x48c4('0x43')],_0x380562[_0x48c4('0x44')]));_0x19be4d['where'][_0x48c4('0x61')]=_0x175171['id'];if(_0x418551[_0x48c4('0x43')][_0x48c4('0x4e')]){_0x19be4d[_0x48c4('0x4c')]=_[_0x48c4('0x4f')](_0x19be4d[_0x48c4('0x4c')],{'$or':_['map'](_0x19be4d[_0x48c4('0x46')],function(_0x465f92){var _0x4e976d={};_0x4e976d[_0x465f92]={'$like':'%'+_0x418551[_0x48c4('0x43')]['filter']+'%'};return _0x4e976d;})});}_0x19be4d=_['merge']({},_0x19be4d,_0x418551[_0x48c4('0x51')]);return db[_0x48c4('0x68')][_0x48c4('0x2c')]({'where':_0x19be4d['where']})[_0x48c4('0x1b')](function(_0x7bb5e8){_0x24ca6c[_0x48c4('0x2c')]=_0x7bb5e8;if(_0x418551[_0x48c4('0x43')][_0x48c4('0x52')]){_0x19be4d[_0x48c4('0x53')]=[{'all':!![]}];}return db[_0x48c4('0x68')]['findAll'](_0x19be4d);})[_0x48c4('0x1b')](function(_0x222f74){_0x24ca6c[_0x48c4('0x69')]=_0x222f74;return _0x24ca6c;});}})[_0x48c4('0x1b')](respondWithFilteredResult(_0x2092b6,_0x19be4d))['catch'](handleError(_0x2092b6,null));};exports[_0x48c4('0x6a')]=function(_0x3a9c29,_0x1f47b2,_0x38fb2a){return db['WhatsappAccount'][_0x48c4('0x5d')]({'where':{'id':_0x3a9c29[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x1f47b2,null))[_0x48c4('0x1b')](function(_0xdfe9ab){if(_0xdfe9ab){return _0xdfe9ab['removeAnswers'](_0x3a9c29[_0x48c4('0x43')][_0x48c4('0x66')]);}})[_0x48c4('0x1b')](respondWithStatusCode(_0x1f47b2,null))[_0x48c4('0x26')](handleError(_0x1f47b2,null));};exports[_0x48c4('0x6b')]=function(_0x355c19,_0x4b0bb9,_0x139205){return db['WhatsappAccount']['find']({'where':{'id':_0x355c19[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x4b0bb9,null))[_0x48c4('0x1b')](function(_0x285195){if(_0x285195){return _0x285195[_0x48c4('0x6b')](_0x355c19[_0x48c4('0x59')][_0x48c4('0x66')],_[_0x48c4('0x6c')](_0x355c19[_0x48c4('0x59')],[_0x48c4('0x66'),'id'])||{})[_0x48c4('0x6d')](function(_0xf4eb7e){for(var _0x2b4e1c=0x0;_0x2b4e1c<_0x355c19[_0x48c4('0x59')][_0x48c4('0x66')]['length'];_0x2b4e1c+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x355c19[_0x48c4('0x59')][_0x48c4('0x66')][_0x2b4e1c]),'WhatsappAccountId':Number(_0x355c19[_0x48c4('0x56')]['id'])});}return _0xf4eb7e;});}})[_0x48c4('0x1b')](respondWithResult(_0x4b0bb9,null))['catch'](handleError(_0x4b0bb9,null));};exports[_0x48c4('0x6e')]=function(_0x52ef89,_0x4ef147,_0x375030){return db[_0x48c4('0x3d')][_0x48c4('0x5d')]({'where':{'id':_0x52ef89['params']['id']}})['then'](handleEntityNotFound(_0x4ef147,null))['then'](function(_0x501d7f){if(_0x501d7f){return _0x501d7f[_0x48c4('0x6e')](_0x52ef89[_0x48c4('0x43')][_0x48c4('0x66')])['then'](function(){if(_['isArray'](_0x52ef89[_0x48c4('0x43')][_0x48c4('0x66')])){for(var _0x25626c=0x0;_0x25626c<_0x52ef89['query']['ids'][_0x48c4('0x48')];_0x25626c+=0x1){socket[_0x48c4('0x6f')](_0x48c4('0x70'),{'UserId':Number(_0x52ef89[_0x48c4('0x43')]['ids'][_0x25626c]),'WhatsappAccountId':Number(_0x52ef89[_0x48c4('0x56')]['id'])});}}else{socket[_0x48c4('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x52ef89[_0x48c4('0x43')][_0x48c4('0x66')]),'WhatsappAccountId':Number(_0x52ef89[_0x48c4('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ef147,null))[_0x48c4('0x26')](handleError(_0x4ef147,null));};exports['getAgents']=function(_0x1d27fe,_0x2b8d2b,_0x2ca2c9){var _0x453cc1={};var _0x2f37b4={};var _0x326756;var _0x355dfe;return db[_0x48c4('0x3d')]['findOne']({'where':{'id':_0x1d27fe[_0x48c4('0x56')]['id']}})['then'](handleEntityNotFound(_0x2b8d2b,null))[_0x48c4('0x1b')](function(_0x46d0c5){if(_0x46d0c5){_0x326756=_0x46d0c5;_0x2f37b4[_0x48c4('0x41')]=_[_0x48c4('0x42')](db[_0x48c4('0x71')][_0x48c4('0x3e')]);_0x2f37b4['query']=_['keys'](_0x1d27fe['query']);_0x2f37b4[_0x48c4('0x44')]=_['intersection'](_0x2f37b4['model'],_0x2f37b4['query']);_0x453cc1[_0x48c4('0x46')]=_[_0x48c4('0x45')](_0x2f37b4[_0x48c4('0x41')],qs['fields'](_0x1d27fe[_0x48c4('0x43')][_0x48c4('0x47')]));_0x453cc1['attributes']=_0x453cc1[_0x48c4('0x46')]['length']?_0x453cc1[_0x48c4('0x46')]:_0x2f37b4[_0x48c4('0x41')];_0x453cc1[_0x48c4('0x4a')]=qs[_0x48c4('0x4b')](_0x1d27fe['query'][_0x48c4('0x4b')]);_0x453cc1[_0x48c4('0x4c')]=qs[_0x48c4('0x44')](_['pick'](_0x1d27fe[_0x48c4('0x43')],_0x2f37b4[_0x48c4('0x44')]));if(_0x1d27fe['query'][_0x48c4('0x4e')]){_0x453cc1['where']=_['merge'](_0x453cc1[_0x48c4('0x4c')],{'$or':_[_0x48c4('0x3c')](_0x453cc1[_0x48c4('0x46')],function(_0x3ac112){var _0xdfac0a={};_0xdfac0a[_0x3ac112]={'$like':'%'+_0x1d27fe[_0x48c4('0x43')][_0x48c4('0x4e')]+'%'};return _0xdfac0a;})});}_0x453cc1=_['merge']({},_0x453cc1,_0x1d27fe['options']);return _0x326756[_0x48c4('0x72')](_0x453cc1);}})[_0x48c4('0x1b')](function(_0x293baa){if(_0x293baa){_0x355dfe=_0x293baa[_0x48c4('0x48')];if(!_0x1d27fe[_0x48c4('0x43')]['hasOwnProperty'](_0x48c4('0x49'))){_0x453cc1[_0x48c4('0x2b')]=qs[_0x48c4('0x2b')](_0x1d27fe[_0x48c4('0x43')]['limit']);_0x453cc1[_0x48c4('0x29')]=qs['offset'](_0x1d27fe[_0x48c4('0x43')][_0x48c4('0x29')]);}return _0x326756[_0x48c4('0x72')](_0x453cc1);}})['then'](function(_0x1bcd42){if(_0x1bcd42){return _0x1bcd42?{'count':_0x355dfe,'rows':_0x1bcd42}:null;}})[_0x48c4('0x1b')](respondWithResult(_0x2b8d2b,null))['catch'](handleError(_0x2b8d2b,null));};exports[_0x48c4('0x73')]=function(_0x3d2102,_0x4aff59){var _0x27cb60=_0x3d2102[_0x48c4('0x56')]['id'];var _0x36f5fe=_0x3d2102[_0x48c4('0x59')];var _0x1055d3=0xc8;var _0x3f0f30=null;return db['sequelize'][_0x48c4('0x74')]({'isolationLevel':db[_0x48c4('0x75')][_0x48c4('0x76')][_0x48c4('0x77')][_0x48c4('0x78')]},function(_0x4f8c6b){return db[_0x48c4('0x3d')][_0x48c4('0x64')]({'where':{'id':_0x27cb60},'transaction':_0x4f8c6b})['then'](function(_0x36c4f6){if(_0x36c4f6){return db[_0x48c4('0x79')][_0x48c4('0x35')]({'where':{'WhatsappAccountId':_0x27cb60},'transaction':_0x4f8c6b})[_0x48c4('0x1b')](function(){var _0x1a56d7=_['map'](_0x36f5fe,function(_0xbcda7e){_0xbcda7e[_0x48c4('0x61')]=_0x27cb60;return _0xbcda7e;});return db[_0x48c4('0x79')][_0x48c4('0x7a')](_0x1a56d7,{'transaction':_0x4f8c6b});});}else{_0x1055d3=0x194;_0x3f0f30=[];}});})[_0x48c4('0x1b')](function(){if(_0x1055d3!==0x194){return db[_0x48c4('0x79')][_0x48c4('0x7b')]({'where':{'WhatsappAccountId':_0x27cb60},'order':_0x48c4('0x7c')})['then'](function(_0x401f92){_0x3f0f30=_0x401f92;});}})[_0x48c4('0x26')](function(_0x407664){_0x1055d3=0x1f4;logger[_0x48c4('0x21')](_0x407664[_0x48c4('0x37')]);if(_0x407664[_0x48c4('0x38')]){delete _0x407664[_0x48c4('0x38')];}_0x3f0f30=_0x407664;})[_0x48c4('0x7d')](function(){if(_0x3f0f30===null){_0x4aff59[_0x48c4('0x27')](_0x1055d3);}else{if(_0x1055d3===0x1f4){_0x4aff59['status'](_0x1055d3)[_0x48c4('0x39')](_0x3f0f30);}else{_0x4aff59['status'](_0x1055d3)[_0x48c4('0x7e')](_0x3f0f30);}}});};exports[_0x48c4('0x7f')]=function(_0xc78c79,_0x40d484,_0x11625d){var _0x8cba={};var _0x30827b={};var _0x33a31d;var _0x72db22;return db[_0x48c4('0x3d')][_0x48c4('0x64')]({'where':{'id':_0xc78c79[_0x48c4('0x56')]['id']}})[_0x48c4('0x1b')](handleEntityNotFound(_0x40d484,null))['then'](function(_0x17eb0c){if(_0x17eb0c){_0x33a31d=_0x17eb0c;_0x30827b['model']=_[_0x48c4('0x42')](db[_0x48c4('0x79')][_0x48c4('0x3e')]);_0x30827b[_0x48c4('0x43')]=_['keys'](_0xc78c79[_0x48c4('0x43')]);_0x30827b['filters']=_[_0x48c4('0x45')](_0x30827b[_0x48c4('0x41')],_0x30827b[_0x48c4('0x43')]);_0x8cba[_0x48c4('0x46')]=_['intersection'](_0x30827b[_0x48c4('0x41')],qs[_0x48c4('0x47')](_0xc78c79[_0x48c4('0x43')][_0x48c4('0x47')]));_0x8cba['attributes']=_0x8cba[_0x48c4('0x46')][_0x48c4('0x48')]?_0x8cba[_0x48c4('0x46')]:_0x30827b[_0x48c4('0x41')];_0x8cba['order']=qs[_0x48c4('0x4b')](_0xc78c79[_0x48c4('0x43')]['sort']);_0x8cba['where']=qs[_0x48c4('0x44')](_[_0x48c4('0x4d')](_0xc78c79[_0x48c4('0x43')],_0x30827b[_0x48c4('0x44')]));if(_0xc78c79[_0x48c4('0x43')]['filter']){_0x8cba[_0x48c4('0x4c')]=_[_0x48c4('0x4f')](_0x8cba['where'],{'$or':_[_0x48c4('0x3c')](_0x8cba[_0x48c4('0x46')],function(_0x5eaa19){var _0x3bea8a={};_0x3bea8a[_0x5eaa19]={'$like':'%'+_0xc78c79[_0x48c4('0x43')][_0x48c4('0x4e')]+'%'};return _0x3bea8a;})});}_0x8cba=_[_0x48c4('0x4f')]({},_0x8cba,_0xc78c79[_0x48c4('0x51')]);return _0x33a31d[_0x48c4('0x7f')](_0x8cba);}})[_0x48c4('0x1b')](function(_0x1797af){if(_0x1797af){_0x72db22=_0x1797af['length'];if(!_0xc78c79[_0x48c4('0x43')][_0x48c4('0x80')](_0x48c4('0x49'))){_0x8cba[_0x48c4('0x2b')]=qs[_0x48c4('0x2b')](_0xc78c79['query']['limit']);_0x8cba[_0x48c4('0x29')]=qs[_0x48c4('0x29')](_0xc78c79[_0x48c4('0x43')]['offset']);}return _0x33a31d[_0x48c4('0x7f')](_0x8cba);}})[_0x48c4('0x1b')](function(_0x374866){if(_0x374866){return _0x374866?{'count':_0x72db22,'rows':_0x374866}:null;}})[_0x48c4('0x1b')](respondWithResult(_0x40d484,null))[_0x48c4('0x26')](handleError(_0x40d484,null));};exports['notify']=function(_0xd15238,_0x4bb327,_0x4c3784){var _0x479582={'channel':_0x48c4('0x81')};var _0x29ec84=[];var _0x189394=[];var _0x403678={};return db[_0x48c4('0x3d')]['find']({'where':{'id':_0xd15238[_0x48c4('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x48c4('0x82')}]})[_0x48c4('0x1b')](handleEntityNotFound(_0x4bb327,null))[_0x48c4('0x1b')](function(_0x5681f1){_0x479582[_0x48c4('0x83')]=_0x5681f1;if(_0x479582[_0x48c4('0x83')]&&_0x479582['account']['type']===_0x48c4('0x84')&&_0xd15238[_0x48c4('0x59')][_0x48c4('0x85')]){if(_0xd15238[_0x48c4('0x59')][_0x48c4('0x85')][_0x48c4('0x48')]===0x0)return;if(_0xd15238[_0x48c4('0x59')][_0x48c4('0x85')][0x0][_0x48c4('0x86')]!==_0x48c4('0x87'))return;return db[_0x48c4('0x88')][_0x48c4('0x32')]({'read':!![],'readAt':_0xd15238[_0x48c4('0x59')]['statuses'][0x0][_0x48c4('0x89')]},{'where':{'messageId':_0xd15238[_0x48c4('0x59')][_0x48c4('0x85')][0x0][_0x48c4('0x8a')]},'individualHooks':!![]})['then'](function(_0x5292b6){return _0x4bb327[_0x48c4('0x28')](0xc8)[_0x48c4('0x7e')](_0x5292b6);});}_0x479582[_0x48c4('0x8b')]=_[_0x48c4('0x8c')](_0x5681f1[_0x48c4('0x82')],[_0x48c4('0x7c')],[_0x48c4('0x8d')]);if(_0x479582[_0x48c4('0x83')][_0x48c4('0x82')]){delete _0x479582[_0x48c4('0x83')]['Applications'];}return db[_0x48c4('0x8e')][_0x48c4('0x5f')]()[_0x48c4('0x1b')](function(_0x5ba638){if(!_0x5ba638){throw new db[(_0x48c4('0x8f'))][(_0x48c4('0x90'))](_0x48c4('0x91'));}_0x29ec84=_[_0x48c4('0x92')](_['keys'](_0x5ba638),[_0x48c4('0x93'),_0x48c4('0x94')]);_0x189394=_[_0x48c4('0x92')](_[_0x48c4('0x42')](_0x5ba638),[_0x48c4('0x93'),_0x48c4('0x94'),_0x48c4('0x95'),_0x48c4('0x96')]);_0x479582[_0x48c4('0x59')]={'mapKey':_0x48c4('0x97')};if(_0x479582[_0x48c4('0x83')]&&_0x479582[_0x48c4('0x83')]['type']===_0x48c4('0x98')){_0x479582['body'][_0x48c4('0x99')]=_0xd15238[_0x48c4('0x59')][_0x48c4('0x9a')][_0x48c4('0x9b')]('whatsapp:','');_0x479582[_0x48c4('0x59')][_0x48c4('0x59')]=_0xd15238[_0x48c4('0x59')]['Body'];_0x479582['body'][_0x48c4('0x9c')]=_0xd15238[_0x48c4('0x59')][_0x48c4('0x9d')];}if(_0x479582['account']&&_0x479582[_0x48c4('0x83')][_0x48c4('0x3f')]===_0x48c4('0x84')){_0x479582['body'][_0x48c4('0x99')]=_0xd15238[_0x48c4('0x59')][_0x48c4('0x9e')][0x0][_0x48c4('0x99')];_0x479582[_0x48c4('0x59')][_0x48c4('0x59')]=_0xd15238[_0x48c4('0x59')][_0x48c4('0x9e')][0x0][_0x48c4('0x24')][_0x48c4('0x59')];_0x479582[_0x48c4('0x59')][_0x48c4('0x9c')]=_0xd15238[_0x48c4('0x59')][_0x48c4('0x9e')][0x0][_0x48c4('0x8a')];}if(_0x479582[_0x48c4('0x59')]['id']){delete _0x479582['body']['id'];}if(_[_0x48c4('0x9f')](_0x479582['body'][_0x48c4('0x99')])){throw new db[(_0x48c4('0x8f'))][(_0x48c4('0x90'))](_0x48c4('0xa0'));}if(_[_0x48c4('0x9f')](_0x479582[_0x48c4('0x59')][_0x48c4('0x59')])||_0x479582['body'][_0x48c4('0x59')]===''){throw new db[(_0x48c4('0x8f'))]['ValidationError'](_0x48c4('0xa1'));}if(_['isNil'](_0x479582[_0x48c4('0x59')][_0x48c4('0xa2')])){throw new db['Sequelize'][(_0x48c4('0x90'))](_0x48c4('0xa3')+_0x189394);}if(!_[_0x48c4('0xa4')](_0x189394,_0x479582[_0x48c4('0x59')]['mapKey'])){throw new db[(_0x48c4('0x8f'))][(_0x48c4('0x90'))](_0x48c4('0xa5')+_0x189394);}_0x403678[_0x479582[_0x48c4('0x59')][_0x48c4('0xa2')]]=_0x479582[_0x48c4('0x59')][_0x48c4('0x99')];return db[_0x48c4('0xa6')][_0x48c4('0x5d')]({'where':{'id':_0x479582[_0x48c4('0x83')]['ListId']},'include':[{'model':db[_0x48c4('0x8e')],'as':_0x48c4('0xa7'),'where':_0x403678,'limit':0x1,'order':[[_0x48c4('0x94'),_0x48c4('0xa8')]]}]});})['then'](handleEntityNotFound(_0x4bb327,null))[_0x48c4('0x1b')](function(_0x5488ed){if(_0x5488ed){_0x479582[_0x48c4('0xa9')]=_['omit'](_0x5488ed,[_0x48c4('0xa7')]);if(_0x5488ed[_0x48c4('0xa7')][_0x48c4('0x48')]){return _0x5488ed[_0x48c4('0xa7')][0x0];}var _0x5df183=_[_0x48c4('0x16')](_0x479582[_0x48c4('0x59')],{'firstName':_0x479582[_0x48c4('0x59')]['from'],'ListId':_0x5488ed['id']});_0x5df183[_0x479582[_0x48c4('0x59')][_0x48c4('0xa2')]]=_0x479582[_0x48c4('0x59')][_0x48c4('0x99')];return db[_0x48c4('0x8e')][_0x48c4('0x58')](_0x5df183,{'fields':_0x29ec84,'raw':!![]});}})[_0x48c4('0x1b')](handleEntityNotFound(_0x4bb327,null))[_0x48c4('0x1b')](function(_0x32420c){if(_0x32420c){_0x479582[_0x48c4('0xaa')]=_0x32420c;var _0x367524={'ContactId':_0x32420c['id'],'phone':_0x479582[_0x48c4('0x59')][_0x48c4('0x99')],'WhatsappAccountId':_0xd15238['params']['id']};var _0x5a40d6={'ContactId':_0x32420c['id'],'WhatsappAccountId':_0xd15238[_0x48c4('0x56')]['id'],'closed':![]};return db[_0x48c4('0xab')][_0x48c4('0x5d')]({'where':_0x5a40d6})[_0x48c4('0x1b')](function(_0x382d23){if(_0x382d23){return[_0x382d23,![]];}return db[_0x48c4('0xab')][_0x48c4('0x58')](_0x367524)[_0x48c4('0x1b')](function(_0x55cf34){return[_0x55cf34,!![]];});});}})[_0x48c4('0x6d')](function(_0x138ec9,_0x4e0bec){_0x479582['interaction']=_0x138ec9[_0x48c4('0x5b')]({'plain':!![]});_0x479582[_0x48c4('0xac')]['created']=![];if(_0x4e0bec){if(_0x479582[_0x48c4('0x83')][_0x48c4('0xad')]){_0x479582['applications']['push']({'id':0x0,'priority':_0x479582[_0x48c4('0x8b')][_0x48c4('0x48')]+0x1,'app':'close','appdata':_0x48c4('0xae'),'interval':_0x48c4('0xaf')});}_0x479582[_0x48c4('0xac')][_0x48c4('0xb0')]=!![];}return db[_0x48c4('0x88')]['create']({'phone':_0x479582[_0x48c4('0x59')][_0x48c4('0x99')],'messageId':_0x479582['body'][_0x48c4('0x9c')],'body':_0x479582[_0x48c4('0x59')][_0x48c4('0x59')],'WhatsappAccountId':_0xd15238[_0x48c4('0x56')]['id'],'WhatsappInteractionId':_0x138ec9['id'],'direction':'in','ContactId':_0x138ec9[_0x48c4('0xb1')],'AttachmentId':_0x479582[_0x48c4('0x59')][_0x48c4('0xb2')]});})[_0x48c4('0x1b')](function(_0x3d76cb){_0x479582[_0x48c4('0x24')]=_0x3d76cb;if(_0x479582['interaction'][_0x48c4('0xb3')]){return db[_0x48c4('0x71')][_0x48c4('0x5d')]({'attributes':['id','name'],'where':{'id':_0x479582[_0x48c4('0xac')][_0x48c4('0xb3')]}})[_0x48c4('0x1b')](function(_0x38e8bf){if(_0x38e8bf){_0x479582[_0x48c4('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x48c4('0xb4'),'appdata':_0x38e8bf[_0x48c4('0x38')]+','+(_0x479582['account'][_0x48c4('0xb5')]||0xa),'interval':_0x48c4('0xaf')});}return respondWithRpcPromise(_0x48c4('0xb6'),'startRouting',_0x479582);});}return respondWithRpcPromise('Start',_0x48c4('0xb7'),_0x479582);})['then'](function(_0x222fcd){if(_0x222fcd){var _0x349da5=0xc8;var _0x3f8d8c=_0x48c4('0xb8');logger[_0x48c4('0x1c')](_0x48c4('0x1e'),_0x3f8d8c,_0x349da5,_0x48c4('0xb9'));logger['debug'](_0x48c4('0xba'),_0x3f8d8c,_0x349da5,_0x48c4('0xb9'),JSON[_0x48c4('0x20')](_0x222fcd));if(_0x479582[_0x48c4('0x83')][_0x48c4('0x3f')]===_0x48c4('0x98')){return _0x4bb327[_0x48c4('0x28')](_0x349da5)[_0x48c4('0x2d')](_0x48c4('0xbb'),'text/xml')[_0x48c4('0x39')]('<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>');}else{return _0x4bb327[_0x48c4('0x28')](_0x349da5)[_0x48c4('0x7e')](_0x222fcd);}}});})['catch'](handleError(_0x4bb327,null));};exports['send']=function(_0x2d25d0,_0x21c728,_0xb4ba87){var _0x5af58b,_0x12640b,_0x58d4d2;if(_[_0x48c4('0x9f')](_0x2d25d0[_0x48c4('0x59')][_0x48c4('0x59')])||_0x2d25d0[_0x48c4('0x59')][_0x48c4('0x59')]===''){throw new db[(_0x48c4('0x8f'))][(_0x48c4('0x90'))](_0x48c4('0xa1'));}if(_['isNil'](_0x2d25d0[_0x48c4('0x59')]['to'])){throw new db['Sequelize'][(_0x48c4('0x90'))]('to\x20is\x20mandatory');}_0x5af58b=_0x2d25d0[_0x48c4('0x59')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x2d25d0[_0x48c4('0x56')]['id']},'include':[{'model':db[_0x48c4('0xa6')],'as':_0x48c4('0xbc'),'include':[{'model':db[_0x48c4('0x8e')],'as':_0x48c4('0xa7'),'where':{'mobile':_0x5af58b},'limit':0x1,'order':[[_0x48c4('0x94'),_0x48c4('0xa8')]]}]}]})[_0x48c4('0x1b')](handleEntityNotFound(_0x21c728,null))[_0x48c4('0x1b')](function(_0x1fc5cc){if(_0x1fc5cc&&_0x1fc5cc[_0x48c4('0xbc')]){_0x12640b=_0x1fc5cc[_0x48c4('0x5b')]({'plain':!![]});if(_0x12640b['List']&&_0x12640b[_0x48c4('0xbc')][_0x48c4('0xa7')][_0x48c4('0x48')]){return _0x12640b[_0x48c4('0xbc')][_0x48c4('0xa7')][0x0];}return db[_0x48c4('0x8e')][_0x48c4('0x58')](_[_0x48c4('0x16')](_0x2d25d0[_0x48c4('0x59')],{'firstName':_0x5af58b,'mobile':_0x5af58b,'phone':_0x5af58b,'ListId':_0x12640b[_0x48c4('0x96')]}));}})['then'](handleEntityNotFound(_0x21c728,null))['then'](function(_0x300bbe){if(_0x300bbe){_0x58d4d2=_0x300bbe;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x58d4d2['id'],'closed':![],'WhatsappAccountId':_0x12640b['id']}})[_0x48c4('0x1b')](function(_0x24e4ee){if(_0x24e4ee){return[_0x24e4ee,![]];}return db['WhatsappInteraction'][_0x48c4('0x58')]({'UserId':_0x2d25d0[_0x48c4('0x5a')]['id'],'ContactId':_0x58d4d2['id'],'WhatsappAccountId':_0x12640b['id'],'phone':_0x5af58b,'firstMsgDirection':_0x48c4('0xbd'),'Messages':[_[_0x48c4('0x4f')](_0x2d25d0[_0x48c4('0x59')],{'read':![],'body':_0x2d25d0[_0x48c4('0x59')][_0x48c4('0x59')],'phone':_0x5af58b,'WhatsappAccountId':_0x12640b['id'],'UserId':_0x2d25d0[_0x48c4('0x5a')]['id'],'ContactId':_0x58d4d2['id']})]},{'include':[{'model':db[_0x48c4('0x88')],'as':_0x48c4('0xbe')}]})[_0x48c4('0x1b')](function(_0x254001){return[_0x254001,!![]];});});}})[_0x48c4('0x6d')](function(_0x3fc7b2,_0x2954d0){if(_0x2954d0){return _0x3fc7b2;}return db[_0x48c4('0x88')]['create'](_[_0x48c4('0x4f')](_0x2d25d0[_0x48c4('0x59')],{'read':![],'body':_0x2d25d0[_0x48c4('0x59')]['body'],'phone':_0x5af58b,'WhatsappAccountId':_0x12640b['id'],'WhatsappInteractionId':_0x3fc7b2['id'],'UserId':_0x2d25d0[_0x48c4('0x5a')]['id'],'ContactId':_0x58d4d2['id']}))[_0x48c4('0x1b')](function(_0x23be2c){_0x3fc7b2[_0x48c4('0xbf')][_0x48c4('0xbe')]=[];_0x3fc7b2[_0x48c4('0xbf')][_0x48c4('0xbe')][_0x48c4('0xc0')](_0x23be2c[_0x48c4('0xbf')]);return _0x3fc7b2;});})['then'](respondWithResult(_0x21c728,null))[_0x48c4('0x26')](handleError(_0x21c728,null));};
\ No newline at end of file
+var _0xd628=['WhatsappAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','MessageSid','notifications','messageId','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','to\x20is\x20mandatory','DESC','List','Messages','dataValues','eml-format','rimraf','request-promise','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xd628,0x14a));var _0x8d62=function(_0xdc2833,_0x4b4055){_0xdc2833=_0xdc2833-0x0;var _0x409a30=_0xd628[_0xdc2833];return _0x409a30;};'use strict';var emlformat=require(_0x8d62('0x0'));var rimraf=require(_0x8d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8d62('0x3'));var util=require(_0x8d62('0x4'));var path=require(_0x8d62('0x5'));var sox=require('sox');var csv=require(_0x8d62('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d62('0x7'));var crypto=require('crypto');var jsforce=require(_0x8d62('0x8'));var deskjs=require(_0x8d62('0x9'));var toCsv=require(_0x8d62('0x6'));var querystring=require(_0x8d62('0xa'));var Papa=require(_0x8d62('0xb'));var Redis=require('ioredis');var authService=require(_0x8d62('0xc'));var qs=require(_0x8d62('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d62('0xe'));var logger=require('../../config/logger')(_0x8d62('0xf'));var utils=require(_0x8d62('0x10'));var config=require(_0x8d62('0x11'));var licenseUtil=require(_0x8d62('0x12'));var db=require(_0x8d62('0x13'))['db'];config['redis']=_[_0x8d62('0x14')](config[_0x8d62('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d62('0x16'))(new Redis(config[_0x8d62('0x15')]));require(_0x8d62('0x17'))['register'](socket);var jayson=require(_0x8d62('0x18'));var client=jayson[_0x8d62('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc9a5a9,_0x4efa44,_0x1535d7,_0x28a1e3){return new BPromise(function(_0x1826f8,_0x52b440){var _0x374a56=_0x28a1e3||client;return _0x374a56['request'](_0xc9a5a9,_0x1535d7)[_0x8d62('0x1a')](function(_0x464fa1){logger[_0x8d62('0x1b')]('WhatsappAccount,\x20%s,\x20%s',_0x4efa44,_0x8d62('0x1c'));logger[_0x8d62('0x1d')](_0x8d62('0x1e'),_0x4efa44,'request\x20sent',JSON['stringify'](_0x464fa1));if(_0x464fa1[_0x8d62('0x1f')]){if(_0x464fa1[_0x8d62('0x1f')][_0x8d62('0x20')]===0x1f4){logger[_0x8d62('0x1f')](_0x8d62('0x21'),_0x4efa44,_0x464fa1[_0x8d62('0x1f')][_0x8d62('0x22')]);return _0x52b440(_0x464fa1['error'][_0x8d62('0x22')]);}logger[_0x8d62('0x1f')](_0x8d62('0x21'),_0x4efa44,_0x464fa1[_0x8d62('0x1f')]['message']);return _0x1826f8(_0x464fa1[_0x8d62('0x1f')]['message']);}else{logger[_0x8d62('0x1b')](_0x8d62('0x21'),_0x4efa44,_0x8d62('0x1c'));_0x1826f8(_0x464fa1[_0x8d62('0x23')][_0x8d62('0x22')]);}})[_0x8d62('0x24')](function(_0x9d4539){logger['error'](_0x8d62('0x21'),_0x4efa44,_0x9d4539);_0x52b440(_0x9d4539);});});}function respondWithStatusCode(_0x227356,_0x2bed8b){_0x2bed8b=_0x2bed8b||0xcc;return function(_0x48475e){if(_0x48475e){return _0x227356[_0x8d62('0x25')](_0x2bed8b);}return _0x227356[_0x8d62('0x26')](_0x2bed8b)[_0x8d62('0x27')]();};}function respondWithResult(_0xbe140b,_0x46a3a2){_0x46a3a2=_0x46a3a2||0xc8;return function(_0x205b4b){if(_0x205b4b){return _0xbe140b[_0x8d62('0x26')](_0x46a3a2)[_0x8d62('0x28')](_0x205b4b);}};}function respondWithFilteredResult(_0x467c3a,_0x4ca7e3){return function(_0x2e1901){if(_0x2e1901){var _0x276609=typeof _0x4ca7e3[_0x8d62('0x29')]===_0x8d62('0x2a')&&typeof _0x4ca7e3[_0x8d62('0x2b')]===_0x8d62('0x2a');var _0x477071=_0x2e1901['count'];var _0x45509f=_0x276609?0x0:_0x4ca7e3[_0x8d62('0x29')];var _0x1cdbee=_0x276609?_0x2e1901[_0x8d62('0x2c')]:_0x4ca7e3[_0x8d62('0x29')]+_0x4ca7e3[_0x8d62('0x2b')];var _0x4ff229;if(_0x1cdbee>=_0x477071){_0x1cdbee=_0x477071;_0x4ff229=0xc8;}else{_0x4ff229=0xce;}_0x467c3a[_0x8d62('0x26')](_0x4ff229);return _0x467c3a['set'](_0x8d62('0x2d'),_0x45509f+'-'+_0x1cdbee+'/'+_0x477071)[_0x8d62('0x28')](_0x2e1901);}return null;};}function patchUpdates(_0x24017d){return function(_0x4e6008){try{jsonpatch[_0x8d62('0x2e')](_0x4e6008,_0x24017d,!![]);}catch(_0x29a8d2){return BPromise[_0x8d62('0x2f')](_0x29a8d2);}return _0x4e6008[_0x8d62('0x30')]();};}function saveUpdates(_0x2c17bd,_0x27540c){return function(_0x3abb07){if(_0x3abb07){return _0x3abb07[_0x8d62('0x31')](_0x2c17bd)[_0x8d62('0x1a')](function(_0x5b4711){return _0x5b4711;});}return null;};}function removeEntity(_0x13dbe1,_0x51a2b8){return function(_0x1017b2){if(_0x1017b2){return _0x1017b2[_0x8d62('0x32')]()['then'](function(){var _0x523e16=_0x1017b2[_0x8d62('0x33')]({'plain':!![]});var _0x537bba='WhatsappAccounts';return db[_0x8d62('0x34')][_0x8d62('0x32')]({'where':{'type':_0x537bba,'resourceId':_0x523e16['id']}})[_0x8d62('0x1a')](function(){return _0x1017b2;});})[_0x8d62('0x1a')](function(){_0x13dbe1[_0x8d62('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e290a,_0x52596c){return function(_0x1998ce){if(!_0x1998ce){_0x3e290a[_0x8d62('0x25')](0x194);}return _0x1998ce;};}function handleError(_0x3f3cd7,_0x331041){_0x331041=_0x331041||0x1f4;return function(_0x5c20ea){logger[_0x8d62('0x1f')](_0x5c20ea[_0x8d62('0x35')]);if(_0x5c20ea['name']){delete _0x5c20ea[_0x8d62('0x36')];}_0x3f3cd7[_0x8d62('0x26')](_0x331041)[_0x8d62('0x37')](_0x5c20ea);};}exports[_0x8d62('0x38')]=function(_0x4cbc05,_0x111d36){var _0xd4522={'include':[{'model':db[_0x8d62('0x39')],'as':_0x8d62('0x3a')}]},_0x39eee0={},_0x83eb0a={'count':0x0,'rows':[]};var _0x2f976d=_[_0x8d62('0x3b')](db[_0x8d62('0x3c')][_0x8d62('0x3d')],function(_0x190be9){return{'name':_0x190be9[_0x8d62('0x3e')],'type':_0x190be9[_0x8d62('0x3f')]['key']};});_0x39eee0[_0x8d62('0x40')]=_[_0x8d62('0x3b')](_0x2f976d,_0x8d62('0x36'));_0x39eee0['query']=_[_0x8d62('0x41')](_0x4cbc05['query']);_0x39eee0[_0x8d62('0x42')]=_[_0x8d62('0x43')](_0x39eee0[_0x8d62('0x40')],_0x39eee0['query']);_0xd4522[_0x8d62('0x44')]=_['intersection'](_0x39eee0['model'],qs[_0x8d62('0x45')](_0x4cbc05['query'][_0x8d62('0x45')]));_0xd4522[_0x8d62('0x44')]=_0xd4522[_0x8d62('0x44')][_0x8d62('0x46')]?_0xd4522[_0x8d62('0x44')]:_0x39eee0['model'];if(!_0x4cbc05[_0x8d62('0x47')][_0x8d62('0x48')](_0x8d62('0x49'))){_0xd4522[_0x8d62('0x2b')]=qs['limit'](_0x4cbc05[_0x8d62('0x47')][_0x8d62('0x2b')]);_0xd4522[_0x8d62('0x29')]=qs['offset'](_0x4cbc05['query'][_0x8d62('0x29')]);}_0xd4522['order']=qs['sort'](_0x4cbc05['query'][_0x8d62('0x4a')]);_0xd4522['where']=qs[_0x8d62('0x42')](_['pick'](_0x4cbc05[_0x8d62('0x47')],_0x39eee0[_0x8d62('0x42')]),_0x2f976d);if(_0x4cbc05[_0x8d62('0x47')][_0x8d62('0x4b')]){_0xd4522[_0x8d62('0x4c')]=_[_0x8d62('0x4d')](_0xd4522[_0x8d62('0x4c')],{'$or':_[_0x8d62('0x3b')](_0x2f976d,function(_0x453842){if(_0x453842[_0x8d62('0x3f')]!=='VIRTUAL'){var _0x53545e={};_0x53545e[_0x453842['name']]={'$like':'%'+_0x4cbc05[_0x8d62('0x47')][_0x8d62('0x4b')]+'%'};return _0x53545e;}})});}_0xd4522=_['merge']({},_0xd4522,_0x4cbc05[_0x8d62('0x4e')]);var _0x304fec={'where':_0xd4522[_0x8d62('0x4c')]};return db[_0x8d62('0x3c')][_0x8d62('0x2c')](_0x304fec)[_0x8d62('0x1a')](function(_0x1d6bca){_0x83eb0a['count']=_0x1d6bca;if(_0x4cbc05[_0x8d62('0x47')][_0x8d62('0x4f')]){_0xd4522[_0x8d62('0x50')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x8d62('0x51')](_0xd4522);})[_0x8d62('0x1a')](function(_0x12beb5){_0x83eb0a[_0x8d62('0x52')]=_0x12beb5;return _0x83eb0a;})[_0x8d62('0x1a')](respondWithFilteredResult(_0x111d36,_0xd4522))[_0x8d62('0x24')](handleError(_0x111d36,null));};exports[_0x8d62('0x53')]=function(_0x4a1cce,_0x403284){var _0x302aaa={'raw':![],'where':{'id':_0x4a1cce[_0x8d62('0x54')]['id']},'include':[{'model':db[_0x8d62('0x39')],'as':'mandatoryDispositionPause'}]},_0x2ee4e9={};_0x2ee4e9[_0x8d62('0x40')]=_[_0x8d62('0x41')](db[_0x8d62('0x3c')]['rawAttributes']);_0x2ee4e9['query']=_[_0x8d62('0x41')](_0x4a1cce[_0x8d62('0x47')]);_0x2ee4e9[_0x8d62('0x42')]=_[_0x8d62('0x43')](_0x2ee4e9[_0x8d62('0x40')],_0x2ee4e9[_0x8d62('0x47')]);_0x302aaa['attributes']=_[_0x8d62('0x43')](_0x2ee4e9[_0x8d62('0x40')],qs['fields'](_0x4a1cce[_0x8d62('0x47')][_0x8d62('0x45')]));_0x302aaa[_0x8d62('0x44')]=_0x302aaa[_0x8d62('0x44')][_0x8d62('0x46')]?_0x302aaa[_0x8d62('0x44')]:_0x2ee4e9[_0x8d62('0x40')];if(_0x4a1cce[_0x8d62('0x47')][_0x8d62('0x4f')]){_0x302aaa[_0x8d62('0x50')]=[{'all':!![]}];}_0x302aaa=_['merge']({},_0x302aaa,_0x4a1cce[_0x8d62('0x4e')]);return db[_0x8d62('0x3c')][_0x8d62('0x55')](_0x302aaa)['then'](handleEntityNotFound(_0x403284,null))[_0x8d62('0x1a')](respondWithResult(_0x403284,null))['catch'](handleError(_0x403284,null));};exports[_0x8d62('0x56')]=function(_0x496b41,_0x5aea4a){return db['WhatsappAccount'][_0x8d62('0x56')](_0x496b41[_0x8d62('0x57')],{})[_0x8d62('0x1a')](function(_0x100802){var _0x3446c5=_0x496b41[_0x8d62('0x58')][_0x8d62('0x33')]({'plain':!![]});if(!_0x3446c5)throw new Error(_0x8d62('0x59'));if(_0x3446c5[_0x8d62('0x5a')]==='user'){var _0x390adf=_0x100802[_0x8d62('0x33')]({'plain':!![]});var _0x102b4f=_0x8d62('0x5b');return db[_0x8d62('0x5c')][_0x8d62('0x55')]({'where':{'name':_0x102b4f,'userProfileId':_0x3446c5['userProfileId']},'raw':!![]})['then'](function(_0x1dddc3){if(_0x1dddc3&&_0x1dddc3[_0x8d62('0x5d')]===0x0){return db[_0x8d62('0x34')][_0x8d62('0x56')]({'name':_0x390adf[_0x8d62('0x36')],'resourceId':_0x390adf['id'],'type':_0x1dddc3[_0x8d62('0x36')],'sectionId':_0x1dddc3['id']},{})[_0x8d62('0x1a')](function(){return _0x100802;});}else{return _0x100802;}})[_0x8d62('0x24')](function(_0x1f780f){logger[_0x8d62('0x1f')](_0x8d62('0x5e'),_0x1f780f);throw _0x1f780f;});}return _0x100802;})['then'](respondWithResult(_0x5aea4a,0xc9))[_0x8d62('0x24')](handleError(_0x5aea4a,null));};exports[_0x8d62('0x31')]=function(_0x1c73a1,_0x4398e7){if(_0x1c73a1[_0x8d62('0x57')]['id']){delete _0x1c73a1[_0x8d62('0x57')]['id'];}return db['WhatsappAccount'][_0x8d62('0x55')]({'where':{'id':_0x1c73a1[_0x8d62('0x54')]['id']},'include':[{'model':db[_0x8d62('0x39')],'as':_0x8d62('0x3a')}]})[_0x8d62('0x1a')](handleEntityNotFound(_0x4398e7,null))[_0x8d62('0x1a')](saveUpdates(_0x1c73a1['body'],null))[_0x8d62('0x1a')](respondWithResult(_0x4398e7,null))[_0x8d62('0x24')](handleError(_0x4398e7,null));};exports[_0x8d62('0x32')]=function(_0x4b78b3,_0x231765){return db[_0x8d62('0x3c')][_0x8d62('0x55')]({'where':{'id':_0x4b78b3[_0x8d62('0x54')]['id']}})['then'](handleEntityNotFound(_0x231765,null))[_0x8d62('0x1a')](removeEntity(_0x231765,null))[_0x8d62('0x24')](handleError(_0x231765,null));};exports[_0x8d62('0x5f')]=function(_0x365393,_0x557246){return db[_0x8d62('0x3c')]['describe']()[_0x8d62('0x1a')](respondWithResult(_0x557246,null))[_0x8d62('0x24')](handleError(_0x557246,null));};exports[_0x8d62('0x60')]=function(_0x15c979,_0x4bc596,_0xd4d751){if(_0x15c979[_0x8d62('0x57')]['id']){delete _0x15c979[_0x8d62('0x57')]['id'];}return db['WhatsappAccount'][_0x8d62('0x55')]({'where':{'id':_0x15c979[_0x8d62('0x54')]['id']}})['then'](handleEntityNotFound(_0x4bc596,null))[_0x8d62('0x1a')](function(_0x12782b){if(_0x12782b){_0x15c979['body'][_0x8d62('0x61')]=_0x12782b['id'];return db['Disposition'][_0x8d62('0x56')](_0x15c979[_0x8d62('0x57')]);}})[_0x8d62('0x1a')](respondWithResult(_0x4bc596,null))['catch'](handleError(_0x4bc596,null));};exports[_0x8d62('0x62')]=function(_0x57854d,_0x4b1856,_0x100a91){var _0x359380={'raw':![],'where':{}};var _0xdd28d4={};var _0x3764bc={'count':0x0,'rows':[]};return db[_0x8d62('0x3c')][_0x8d62('0x63')]({'where':{'id':_0x57854d[_0x8d62('0x54')]['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x4b1856,null))[_0x8d62('0x1a')](function(_0x242b80){if(_0x242b80){_0xdd28d4[_0x8d62('0x40')]=_[_0x8d62('0x41')](db['Disposition'][_0x8d62('0x3d')]);_0xdd28d4['query']=_[_0x8d62('0x41')](_0x57854d['query']);_0xdd28d4[_0x8d62('0x42')]=_[_0x8d62('0x43')](_0xdd28d4[_0x8d62('0x40')],_0xdd28d4['query']);_0x359380[_0x8d62('0x44')]=_[_0x8d62('0x43')](_0xdd28d4[_0x8d62('0x40')],qs[_0x8d62('0x45')](_0x57854d[_0x8d62('0x47')]['fields']));_0x359380[_0x8d62('0x44')]=_0x359380[_0x8d62('0x44')][_0x8d62('0x46')]?_0x359380[_0x8d62('0x44')]:_0xdd28d4[_0x8d62('0x40')];if(!_0x57854d[_0x8d62('0x47')][_0x8d62('0x48')](_0x8d62('0x49'))){_0x359380[_0x8d62('0x2b')]=qs[_0x8d62('0x2b')](_0x57854d['query'][_0x8d62('0x2b')]);_0x359380[_0x8d62('0x29')]=qs[_0x8d62('0x29')](_0x57854d['query']['offset']);}_0x359380['order']=qs[_0x8d62('0x4a')](_0x57854d[_0x8d62('0x47')][_0x8d62('0x4a')]);_0x359380[_0x8d62('0x4c')]=qs['filters'](_[_0x8d62('0x64')](_0x57854d[_0x8d62('0x47')],_0xdd28d4[_0x8d62('0x42')]));_0x359380[_0x8d62('0x4c')][_0x8d62('0x61')]=_0x242b80['id'];if(_0x57854d[_0x8d62('0x47')][_0x8d62('0x4b')]){_0x359380[_0x8d62('0x4c')]=_[_0x8d62('0x4d')](_0x359380['where'],{'$or':_[_0x8d62('0x3b')](_0x359380[_0x8d62('0x44')],function(_0x34c518){var _0x59d728={};_0x59d728[_0x34c518]={'$like':'%'+_0x57854d[_0x8d62('0x47')][_0x8d62('0x4b')]+'%'};return _0x59d728;})});}_0x359380=_[_0x8d62('0x4d')]({},_0x359380,_0x57854d['options']);return db[_0x8d62('0x65')][_0x8d62('0x2c')]({'where':_0x359380[_0x8d62('0x4c')]})[_0x8d62('0x1a')](function(_0x5c62d9){_0x3764bc[_0x8d62('0x2c')]=_0x5c62d9;if(_0x57854d['query'][_0x8d62('0x4f')]){_0x359380['include']=[{'all':!![]}];}return db[_0x8d62('0x65')][_0x8d62('0x51')](_0x359380);})['then'](function(_0x20fa4e){_0x3764bc[_0x8d62('0x52')]=_0x20fa4e;return _0x3764bc;});}})[_0x8d62('0x1a')](respondWithFilteredResult(_0x4b1856,_0x359380))[_0x8d62('0x24')](handleError(_0x4b1856,null));};exports['removeDispositions']=function(_0x2f5a06,_0x7e9f6,_0x2b08c8){return db['WhatsappAccount'][_0x8d62('0x55')]({'where':{'id':_0x2f5a06['params']['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x7e9f6,null))[_0x8d62('0x1a')](function(_0x29b200){if(_0x29b200){return _0x29b200[_0x8d62('0x66')](_0x2f5a06[_0x8d62('0x47')][_0x8d62('0x67')]);}})[_0x8d62('0x1a')](respondWithStatusCode(_0x7e9f6,null))['catch'](handleError(_0x7e9f6,null));};exports[_0x8d62('0x68')]=function(_0x2d303a,_0x305f55,_0x33303a){if(_0x2d303a[_0x8d62('0x57')]['id']){delete _0x2d303a['body']['id'];}return db[_0x8d62('0x3c')][_0x8d62('0x55')]({'where':{'id':_0x2d303a[_0x8d62('0x54')]['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x305f55,null))[_0x8d62('0x1a')](function(_0x4d5e38){if(_0x4d5e38){_0x2d303a[_0x8d62('0x57')][_0x8d62('0x61')]=_0x4d5e38['id'];return db[_0x8d62('0x69')][_0x8d62('0x56')](_0x2d303a[_0x8d62('0x57')]);}})[_0x8d62('0x1a')](respondWithResult(_0x305f55,null))[_0x8d62('0x24')](handleError(_0x305f55,null));};exports[_0x8d62('0x6a')]=function(_0x35b3f0,_0x47a7b7,_0x43cc24){var _0x43cf2d={'raw':![],'where':{}};var _0xc20597={};var _0x44fee5={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x35b3f0['params']['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x47a7b7,null))['then'](function(_0x304f23){if(_0x304f23){_0xc20597['model']=_['keys'](db[_0x8d62('0x69')][_0x8d62('0x3d')]);_0xc20597[_0x8d62('0x47')]=_[_0x8d62('0x41')](_0x35b3f0[_0x8d62('0x47')]);_0xc20597[_0x8d62('0x42')]=_[_0x8d62('0x43')](_0xc20597[_0x8d62('0x40')],_0xc20597['query']);_0x43cf2d[_0x8d62('0x44')]=_[_0x8d62('0x43')](_0xc20597[_0x8d62('0x40')],qs[_0x8d62('0x45')](_0x35b3f0[_0x8d62('0x47')][_0x8d62('0x45')]));_0x43cf2d[_0x8d62('0x44')]=_0x43cf2d['attributes']['length']?_0x43cf2d[_0x8d62('0x44')]:_0xc20597[_0x8d62('0x40')];if(!_0x35b3f0[_0x8d62('0x47')][_0x8d62('0x48')](_0x8d62('0x49'))){_0x43cf2d[_0x8d62('0x2b')]=qs[_0x8d62('0x2b')](_0x35b3f0[_0x8d62('0x47')]['limit']);_0x43cf2d['offset']=qs[_0x8d62('0x29')](_0x35b3f0[_0x8d62('0x47')]['offset']);}_0x43cf2d[_0x8d62('0x6b')]=qs[_0x8d62('0x4a')](_0x35b3f0[_0x8d62('0x47')][_0x8d62('0x4a')]);_0x43cf2d['where']=qs['filters'](_[_0x8d62('0x64')](_0x35b3f0[_0x8d62('0x47')],_0xc20597['filters']));_0x43cf2d[_0x8d62('0x4c')][_0x8d62('0x61')]=_0x304f23['id'];if(_0x35b3f0[_0x8d62('0x47')][_0x8d62('0x4b')]){_0x43cf2d[_0x8d62('0x4c')]=_['merge'](_0x43cf2d[_0x8d62('0x4c')],{'$or':_[_0x8d62('0x3b')](_0x43cf2d[_0x8d62('0x44')],function(_0x3485ea){var _0x27d872={};_0x27d872[_0x3485ea]={'$like':'%'+_0x35b3f0[_0x8d62('0x47')][_0x8d62('0x4b')]+'%'};return _0x27d872;})});}_0x43cf2d=_[_0x8d62('0x4d')]({},_0x43cf2d,_0x35b3f0['options']);return db[_0x8d62('0x69')][_0x8d62('0x2c')]({'where':_0x43cf2d['where']})['then'](function(_0x558e52){_0x44fee5[_0x8d62('0x2c')]=_0x558e52;if(_0x35b3f0[_0x8d62('0x47')][_0x8d62('0x4f')]){_0x43cf2d[_0x8d62('0x50')]=[{'all':!![]}];}return db[_0x8d62('0x69')][_0x8d62('0x51')](_0x43cf2d);})['then'](function(_0x27bb96){_0x44fee5['rows']=_0x27bb96;return _0x44fee5;});}})[_0x8d62('0x1a')](respondWithFilteredResult(_0x47a7b7,_0x43cf2d))['catch'](handleError(_0x47a7b7,null));};exports['removeAnswers']=function(_0x590d8c,_0x53ec54,_0x1bba3e){return db[_0x8d62('0x3c')]['find']({'where':{'id':_0x590d8c[_0x8d62('0x54')]['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x53ec54,null))[_0x8d62('0x1a')](function(_0x190d28){if(_0x190d28){return _0x190d28[_0x8d62('0x6c')](_0x590d8c['query']['ids']);}})[_0x8d62('0x1a')](respondWithStatusCode(_0x53ec54,null))['catch'](handleError(_0x53ec54,null));};exports[_0x8d62('0x6d')]=function(_0x3d4fcd,_0x5b9d73,_0xb1c06f){return db[_0x8d62('0x3c')][_0x8d62('0x55')]({'where':{'id':_0x3d4fcd[_0x8d62('0x54')]['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x5b9d73,null))[_0x8d62('0x1a')](function(_0x163968){if(_0x163968){return _0x163968['addAgents'](_0x3d4fcd['body']['ids'],_['omit'](_0x3d4fcd['body'],['ids','id'])||{})[_0x8d62('0x6e')](function(_0x2ced8d){for(var _0x204d87=0x0;_0x204d87<_0x3d4fcd[_0x8d62('0x57')][_0x8d62('0x67')][_0x8d62('0x46')];_0x204d87+=0x1){socket[_0x8d62('0x6f')](_0x8d62('0x70'),{'UserId':Number(_0x3d4fcd[_0x8d62('0x57')][_0x8d62('0x67')][_0x204d87]),'WhatsappAccountId':Number(_0x3d4fcd['params']['id'])});}return _0x2ced8d;});}})[_0x8d62('0x1a')](respondWithResult(_0x5b9d73,null))[_0x8d62('0x24')](handleError(_0x5b9d73,null));};exports['removeAgents']=function(_0x26b268,_0x1e22bb,_0x247354){return db[_0x8d62('0x3c')][_0x8d62('0x55')]({'where':{'id':_0x26b268[_0x8d62('0x54')]['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x1e22bb,null))[_0x8d62('0x1a')](function(_0xddbfd9){if(_0xddbfd9){return _0xddbfd9[_0x8d62('0x71')](_0x26b268[_0x8d62('0x47')]['ids'])[_0x8d62('0x1a')](function(){if(_[_0x8d62('0x72')](_0x26b268[_0x8d62('0x47')][_0x8d62('0x67')])){for(var _0x4c8efa=0x0;_0x4c8efa<_0x26b268['query'][_0x8d62('0x67')]['length'];_0x4c8efa+=0x1){socket[_0x8d62('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x26b268[_0x8d62('0x47')]['ids'][_0x4c8efa]),'WhatsappAccountId':Number(_0x26b268[_0x8d62('0x54')]['id'])});}}else{socket[_0x8d62('0x6f')](_0x8d62('0x73'),{'UserId':Number(_0x26b268[_0x8d62('0x47')][_0x8d62('0x67')]),'WhatsappAccountId':Number(_0x26b268['params']['id'])});}});}})[_0x8d62('0x1a')](respondWithStatusCode(_0x1e22bb,null))[_0x8d62('0x24')](handleError(_0x1e22bb,null));};exports[_0x8d62('0x74')]=function(_0x159393,_0x30e401,_0x3cd3c1){var _0x3eba25={};var _0x1cdd9b={};var _0x390caa;var _0x20518e;return db[_0x8d62('0x3c')][_0x8d62('0x63')]({'where':{'id':_0x159393['params']['id']}})[_0x8d62('0x1a')](handleEntityNotFound(_0x30e401,null))[_0x8d62('0x1a')](function(_0x433887){if(_0x433887){_0x390caa=_0x433887;_0x1cdd9b[_0x8d62('0x40')]=_[_0x8d62('0x41')](db[_0x8d62('0x75')][_0x8d62('0x3d')]);_0x1cdd9b[_0x8d62('0x47')]=_[_0x8d62('0x41')](_0x159393[_0x8d62('0x47')]);_0x1cdd9b['filters']=_['intersection'](_0x1cdd9b[_0x8d62('0x40')],_0x1cdd9b[_0x8d62('0x47')]);_0x3eba25[_0x8d62('0x44')]=_[_0x8d62('0x43')](_0x1cdd9b[_0x8d62('0x40')],qs[_0x8d62('0x45')](_0x159393[_0x8d62('0x47')][_0x8d62('0x45')]));_0x3eba25[_0x8d62('0x44')]=_0x3eba25['attributes']['length']?_0x3eba25[_0x8d62('0x44')]:_0x1cdd9b['model'];_0x3eba25[_0x8d62('0x6b')]=qs[_0x8d62('0x4a')](_0x159393[_0x8d62('0x47')]['sort']);_0x3eba25[_0x8d62('0x4c')]=qs[_0x8d62('0x42')](_[_0x8d62('0x64')](_0x159393[_0x8d62('0x47')],_0x1cdd9b[_0x8d62('0x42')]));if(_0x159393[_0x8d62('0x47')][_0x8d62('0x4b')]){_0x3eba25[_0x8d62('0x4c')]=_[_0x8d62('0x4d')](_0x3eba25[_0x8d62('0x4c')],{'$or':_[_0x8d62('0x3b')](_0x3eba25['attributes'],function(_0x4c2c05){var _0x3e82c9={};_0x3e82c9[_0x4c2c05]={'$like':'%'+_0x159393[_0x8d62('0x47')][_0x8d62('0x4b')]+'%'};return _0x3e82c9;})});}_0x3eba25=_['merge']({},_0x3eba25,_0x159393['options']);return _0x390caa[_0x8d62('0x74')](_0x3eba25);}})['then'](function(_0x5456e7){if(_0x5456e7){_0x20518e=_0x5456e7[_0x8d62('0x46')];if(!_0x159393[_0x8d62('0x47')][_0x8d62('0x48')]('nolimit')){_0x3eba25[_0x8d62('0x2b')]=qs[_0x8d62('0x2b')](_0x159393[_0x8d62('0x47')]['limit']);_0x3eba25['offset']=qs[_0x8d62('0x29')](_0x159393[_0x8d62('0x47')][_0x8d62('0x29')]);}return _0x390caa['getAgents'](_0x3eba25);}})['then'](function(_0x1b2199){if(_0x1b2199){return _0x1b2199?{'count':_0x20518e,'rows':_0x1b2199}:null;}})['then'](respondWithResult(_0x30e401,null))[_0x8d62('0x24')](handleError(_0x30e401,null));};exports[_0x8d62('0x76')]=function(_0x2182b3,_0x571b55){var _0x5d165c=_0x2182b3[_0x8d62('0x54')]['id'];var _0x5760e4=_0x2182b3[_0x8d62('0x57')];var _0x1beabb=0xc8;var _0x50696d=null;return db[_0x8d62('0x77')]['transaction']({'isolationLevel':db[_0x8d62('0x77')][_0x8d62('0x78')][_0x8d62('0x79')][_0x8d62('0x7a')]},function(_0x2ca713){return db['WhatsappAccount']['findOne']({'where':{'id':_0x5d165c},'transaction':_0x2ca713})[_0x8d62('0x1a')](function(_0x4e25fc){if(_0x4e25fc){return db[_0x8d62('0x7b')][_0x8d62('0x32')]({'where':{'WhatsappAccountId':_0x5d165c},'transaction':_0x2ca713})[_0x8d62('0x1a')](function(){var _0x52acad=_[_0x8d62('0x3b')](_0x5760e4,function(_0xcecd18){_0xcecd18[_0x8d62('0x61')]=_0x5d165c;return _0xcecd18;});return db[_0x8d62('0x7b')][_0x8d62('0x7c')](_0x52acad,{'transaction':_0x2ca713});});}else{_0x1beabb=0x194;_0x50696d=[];}});})[_0x8d62('0x1a')](function(){if(_0x1beabb!==0x194){return db[_0x8d62('0x7b')][_0x8d62('0x7d')]({'where':{'WhatsappAccountId':_0x5d165c},'order':_0x8d62('0x7e')})['then'](function(_0x1ece47){_0x50696d=_0x1ece47;});}})['catch'](function(_0x5f1cbb){_0x1beabb=0x1f4;logger[_0x8d62('0x1f')](_0x5f1cbb[_0x8d62('0x35')]);if(_0x5f1cbb[_0x8d62('0x36')]){delete _0x5f1cbb[_0x8d62('0x36')];}_0x50696d=_0x5f1cbb;})['finally'](function(){if(_0x50696d===null){_0x571b55[_0x8d62('0x25')](_0x1beabb);}else{if(_0x1beabb===0x1f4){_0x571b55[_0x8d62('0x26')](_0x1beabb)[_0x8d62('0x37')](_0x50696d);}else{_0x571b55['status'](_0x1beabb)[_0x8d62('0x28')](_0x50696d);}}});};exports[_0x8d62('0x7f')]=function(_0x2ea85,_0x1b23c3,_0x5946fd){var _0x5c1ab0={};var _0x231a7c={};var _0x46082c;var _0x354fa0;return db[_0x8d62('0x3c')][_0x8d62('0x63')]({'where':{'id':_0x2ea85[_0x8d62('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b23c3,null))[_0x8d62('0x1a')](function(_0x26df36){if(_0x26df36){_0x46082c=_0x26df36;_0x231a7c[_0x8d62('0x40')]=_['keys'](db[_0x8d62('0x7b')][_0x8d62('0x3d')]);_0x231a7c['query']=_[_0x8d62('0x41')](_0x2ea85['query']);_0x231a7c[_0x8d62('0x42')]=_['intersection'](_0x231a7c[_0x8d62('0x40')],_0x231a7c[_0x8d62('0x47')]);_0x5c1ab0['attributes']=_[_0x8d62('0x43')](_0x231a7c[_0x8d62('0x40')],qs[_0x8d62('0x45')](_0x2ea85['query']['fields']));_0x5c1ab0['attributes']=_0x5c1ab0[_0x8d62('0x44')][_0x8d62('0x46')]?_0x5c1ab0[_0x8d62('0x44')]:_0x231a7c[_0x8d62('0x40')];_0x5c1ab0['order']=qs[_0x8d62('0x4a')](_0x2ea85['query'][_0x8d62('0x4a')]);_0x5c1ab0[_0x8d62('0x4c')]=qs['filters'](_[_0x8d62('0x64')](_0x2ea85[_0x8d62('0x47')],_0x231a7c[_0x8d62('0x42')]));if(_0x2ea85[_0x8d62('0x47')][_0x8d62('0x4b')]){_0x5c1ab0[_0x8d62('0x4c')]=_[_0x8d62('0x4d')](_0x5c1ab0[_0x8d62('0x4c')],{'$or':_[_0x8d62('0x3b')](_0x5c1ab0[_0x8d62('0x44')],function(_0x5a8d7d){var _0x3a6e04={};_0x3a6e04[_0x5a8d7d]={'$like':'%'+_0x2ea85[_0x8d62('0x47')][_0x8d62('0x4b')]+'%'};return _0x3a6e04;})});}_0x5c1ab0=_['merge']({},_0x5c1ab0,_0x2ea85[_0x8d62('0x4e')]);return _0x46082c[_0x8d62('0x7f')](_0x5c1ab0);}})[_0x8d62('0x1a')](function(_0x4aa29d){if(_0x4aa29d){_0x354fa0=_0x4aa29d[_0x8d62('0x46')];if(!_0x2ea85['query']['hasOwnProperty'](_0x8d62('0x49'))){_0x5c1ab0[_0x8d62('0x2b')]=qs['limit'](_0x2ea85[_0x8d62('0x47')][_0x8d62('0x2b')]);_0x5c1ab0[_0x8d62('0x29')]=qs[_0x8d62('0x29')](_0x2ea85[_0x8d62('0x47')][_0x8d62('0x29')]);}return _0x46082c[_0x8d62('0x7f')](_0x5c1ab0);}})[_0x8d62('0x1a')](function(_0x576c55){if(_0x576c55){return _0x576c55?{'count':_0x354fa0,'rows':_0x576c55}:null;}})[_0x8d62('0x1a')](respondWithResult(_0x1b23c3,null))[_0x8d62('0x24')](handleError(_0x1b23c3,null));};exports[_0x8d62('0x80')]=function(_0xb6432a,_0x3fc10c,_0x1cc05d){var _0x221ed8={'channel':'whatsapp'};var _0x3255d8=[];var _0x2708e2=[];var _0x13e499={};return db[_0x8d62('0x3c')][_0x8d62('0x55')]({'where':{'id':_0xb6432a[_0x8d62('0x54')]['id']},'include':[{'model':db[_0x8d62('0x7b')],'as':_0x8d62('0x81')}]})[_0x8d62('0x1a')](handleEntityNotFound(_0x3fc10c,null))[_0x8d62('0x1a')](function(_0x513251){_0x221ed8[_0x8d62('0x82')]=_0x513251;if(_0x221ed8[_0x8d62('0x82')]&&_0x221ed8[_0x8d62('0x82')]['type']===_0x8d62('0x83')&&_0xb6432a[_0x8d62('0x57')][_0x8d62('0x84')]){if(_0xb6432a[_0x8d62('0x57')][_0x8d62('0x84')][_0x8d62('0x46')]===0x0)return;if(_0xb6432a['body']['statuses'][0x0][_0x8d62('0x85')]!==_0x8d62('0x86'))return;return db[_0x8d62('0x87')][_0x8d62('0x31')]({'read':!![],'readAt':_0xb6432a[_0x8d62('0x57')][_0x8d62('0x84')][0x0]['timestamp']},{'where':{'messageId':_0xb6432a[_0x8d62('0x57')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x8d62('0x1a')](function(_0xfbfb0a){return _0x3fc10c[_0x8d62('0x26')](0xc8)[_0x8d62('0x28')](_0xfbfb0a);});}_0x221ed8[_0x8d62('0x88')]=_[_0x8d62('0x89')](_0x513251[_0x8d62('0x81')],['priority'],[_0x8d62('0x8a')]);if(_0x221ed8[_0x8d62('0x82')][_0x8d62('0x81')]){delete _0x221ed8[_0x8d62('0x82')][_0x8d62('0x81')];}return db[_0x8d62('0x8b')]['describe']()[_0x8d62('0x1a')](function(_0x36b468){if(!_0x36b468){throw new db[(_0x8d62('0x8c'))][(_0x8d62('0x8d'))](_0x8d62('0x8e'));}_0x3255d8=_['difference'](_[_0x8d62('0x41')](_0x36b468),[_0x8d62('0x8f'),'updatedAt']);_0x2708e2=_['difference'](_[_0x8d62('0x41')](_0x36b468),[_0x8d62('0x8f'),_0x8d62('0x90'),_0x8d62('0x91'),_0x8d62('0x92')]);_0x221ed8['body']={'mapKey':_0x8d62('0x93')};if(_0x221ed8['account']&&_0x221ed8['account'][_0x8d62('0x3f')]===_0x8d62('0x94')){_0x221ed8[_0x8d62('0x57')][_0x8d62('0x95')]=_0xb6432a[_0x8d62('0x57')][_0x8d62('0x96')][_0x8d62('0x97')]('whatsapp:','');_0x221ed8['body']['body']=_0xb6432a[_0x8d62('0x57')][_0x8d62('0x98')];_0x221ed8[_0x8d62('0x57')]['messageId']=_0xb6432a[_0x8d62('0x57')][_0x8d62('0x99')];}if(_0x221ed8[_0x8d62('0x82')]&&_0x221ed8[_0x8d62('0x82')][_0x8d62('0x3f')]==='sinch'){_0x221ed8['body'][_0x8d62('0x95')]=_0xb6432a[_0x8d62('0x57')][_0x8d62('0x9a')][0x0][_0x8d62('0x95')];_0x221ed8[_0x8d62('0x57')][_0x8d62('0x57')]=_0xb6432a[_0x8d62('0x57')][_0x8d62('0x9a')][0x0][_0x8d62('0x22')]['body'];_0x221ed8[_0x8d62('0x57')][_0x8d62('0x9b')]=_0xb6432a[_0x8d62('0x57')][_0x8d62('0x9a')][0x0][_0x8d62('0x9c')];}if(_0x221ed8['body']['id']){delete _0x221ed8[_0x8d62('0x57')]['id'];}if(_[_0x8d62('0x9d')](_0x221ed8[_0x8d62('0x57')]['from'])){throw new db[(_0x8d62('0x8c'))][(_0x8d62('0x8d'))](_0x8d62('0x9e'));}if(_[_0x8d62('0x9d')](_0x221ed8[_0x8d62('0x57')][_0x8d62('0x57')])||_0x221ed8[_0x8d62('0x57')][_0x8d62('0x57')]===''){throw new db[(_0x8d62('0x8c'))][(_0x8d62('0x8d'))](_0x8d62('0x9f'));}if(_[_0x8d62('0x9d')](_0x221ed8[_0x8d62('0x57')][_0x8d62('0xa0')])){throw new db[(_0x8d62('0x8c'))]['ValidationError'](_0x8d62('0xa1')+_0x2708e2);}if(!_[_0x8d62('0xa2')](_0x2708e2,_0x221ed8[_0x8d62('0x57')][_0x8d62('0xa0')])){throw new db[(_0x8d62('0x8c'))][(_0x8d62('0x8d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2708e2);}_0x13e499[_0x221ed8[_0x8d62('0x57')][_0x8d62('0xa0')]]=_0x221ed8[_0x8d62('0x57')][_0x8d62('0x95')];return db[_0x8d62('0xa3')]['find']({'where':{'id':_0x221ed8[_0x8d62('0x82')][_0x8d62('0x92')]},'include':[{'model':db[_0x8d62('0x8b')],'as':_0x8d62('0xa4'),'where':_0x13e499,'limit':0x1,'order':[[_0x8d62('0x90'),'DESC']]}]});})['then'](handleEntityNotFound(_0x3fc10c,null))[_0x8d62('0x1a')](function(_0x45f7bd){if(_0x45f7bd){_0x221ed8[_0x8d62('0xa5')]=_[_0x8d62('0xa6')](_0x45f7bd,[_0x8d62('0xa4')]);if(_0x45f7bd[_0x8d62('0xa4')]['length']){return _0x45f7bd[_0x8d62('0xa4')][0x0];}var _0x1fff35=_[_0x8d62('0x14')](_0x221ed8[_0x8d62('0x57')],{'firstName':_0x221ed8[_0x8d62('0x57')][_0x8d62('0x95')],'ListId':_0x45f7bd['id']});_0x1fff35[_0x221ed8[_0x8d62('0x57')][_0x8d62('0xa0')]]=_0x221ed8[_0x8d62('0x57')][_0x8d62('0x95')];return db[_0x8d62('0x8b')][_0x8d62('0x56')](_0x1fff35,{'fields':_0x3255d8,'raw':!![]});}})[_0x8d62('0x1a')](handleEntityNotFound(_0x3fc10c,null))['then'](function(_0x3b9145){if(_0x3b9145){_0x221ed8[_0x8d62('0xa7')]=_0x3b9145;var _0x3e34cf={'ContactId':_0x3b9145['id'],'phone':_0x221ed8[_0x8d62('0x57')][_0x8d62('0x95')],'WhatsappAccountId':_0xb6432a[_0x8d62('0x54')]['id']};var _0x18d077={'ContactId':_0x3b9145['id'],'WhatsappAccountId':_0xb6432a[_0x8d62('0x54')]['id'],'closed':![]};return db[_0x8d62('0xa8')]['find']({'where':_0x18d077})['then'](function(_0x2cbd99){if(_0x2cbd99){return[_0x2cbd99,![]];}return db['WhatsappInteraction'][_0x8d62('0x56')](_0x3e34cf)[_0x8d62('0x1a')](function(_0x25781c){return[_0x25781c,!![]];});});}})['spread'](function(_0x2f4c00,_0x3d8b0f){_0x221ed8[_0x8d62('0xa9')]=_0x2f4c00[_0x8d62('0x33')]({'plain':!![]});_0x221ed8[_0x8d62('0xa9')][_0x8d62('0xaa')]=![];if(_0x3d8b0f){if(_0x221ed8[_0x8d62('0x82')][_0x8d62('0xab')]){_0x221ed8[_0x8d62('0x88')][_0x8d62('0xac')]({'id':0x0,'priority':_0x221ed8[_0x8d62('0x88')][_0x8d62('0x46')]+0x1,'app':_0x8d62('0xad'),'appdata':_0x8d62('0xae'),'interval':'*,*,*,*'});}_0x221ed8[_0x8d62('0xa9')][_0x8d62('0xaa')]=!![];}return db['WhatsappMessage'][_0x8d62('0x56')]({'phone':_0x221ed8[_0x8d62('0x57')][_0x8d62('0x95')],'messageId':_0x221ed8[_0x8d62('0x57')][_0x8d62('0x9b')],'body':_0x221ed8[_0x8d62('0x57')][_0x8d62('0x57')],'WhatsappAccountId':_0xb6432a[_0x8d62('0x54')]['id'],'WhatsappInteractionId':_0x2f4c00['id'],'direction':'in','ContactId':_0x2f4c00[_0x8d62('0xaf')],'AttachmentId':_0x221ed8[_0x8d62('0x57')][_0x8d62('0xb0')]});})['then'](function(_0x554d01){_0x221ed8[_0x8d62('0x22')]=_0x554d01;if(_0x221ed8[_0x8d62('0xa9')][_0x8d62('0xb1')]){return db['User'][_0x8d62('0x55')]({'attributes':['id','name'],'where':{'id':_0x221ed8[_0x8d62('0xa9')][_0x8d62('0xb1')]}})[_0x8d62('0x1a')](function(_0x5f09f1){if(_0x5f09f1){_0x221ed8[_0x8d62('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f09f1[_0x8d62('0x36')]+','+(_0x221ed8[_0x8d62('0x82')][_0x8d62('0xb2')]||0xa),'interval':_0x8d62('0xb3')});}return respondWithRpcPromise(_0x8d62('0xb4'),_0x8d62('0xb5'),_0x221ed8);});}return respondWithRpcPromise('Start',_0x8d62('0xb5'),_0x221ed8);})[_0x8d62('0x1a')](function(_0xbcfb0a){if(_0xbcfb0a){var _0x5a1e18=0xc8;var _0x565877=_0x8d62('0xb6');logger[_0x8d62('0x1b')](_0x8d62('0x1e'),_0x565877,_0x5a1e18,_0x8d62('0xb7'));logger[_0x8d62('0x1d')](_0x8d62('0xb8'),_0x565877,_0x5a1e18,_0x8d62('0xb7'),JSON[_0x8d62('0xb9')](_0xbcfb0a));if(_0x221ed8[_0x8d62('0x82')][_0x8d62('0x3f')]===_0x8d62('0x94')){return _0x3fc10c[_0x8d62('0x26')](_0x5a1e18)[_0x8d62('0xba')](_0x8d62('0xbb'),_0x8d62('0xbc'))[_0x8d62('0x37')](_0x8d62('0xbd'));}else{return _0x3fc10c[_0x8d62('0x26')](_0x5a1e18)[_0x8d62('0x28')](_0xbcfb0a);}}});})['catch'](handleError(_0x3fc10c,null));};exports[_0x8d62('0x37')]=function(_0x4df240,_0x419b6c,_0x4bd2ce){var _0x4b2161,_0x146357,_0x1678f6;if(_[_0x8d62('0x9d')](_0x4df240['body'][_0x8d62('0x57')])||_0x4df240[_0x8d62('0x57')][_0x8d62('0x57')]===''){throw new db[(_0x8d62('0x8c'))]['ValidationError'](_0x8d62('0x9f'));}if(_[_0x8d62('0x9d')](_0x4df240['body']['to'])){throw new db[(_0x8d62('0x8c'))]['ValidationError'](_0x8d62('0xbe'));}_0x4b2161=_0x4df240[_0x8d62('0x57')]['to'];return db['WhatsappAccount'][_0x8d62('0x55')]({'where':{'id':_0x4df240['params']['id']},'include':[{'model':db[_0x8d62('0xa3')],'as':'List','include':[{'model':db[_0x8d62('0x8b')],'as':_0x8d62('0xa4'),'where':{'mobile':_0x4b2161},'limit':0x1,'order':[[_0x8d62('0x90'),_0x8d62('0xbf')]]}]}]})['then'](handleEntityNotFound(_0x419b6c,null))[_0x8d62('0x1a')](function(_0x24caaf){if(_0x24caaf&&_0x24caaf[_0x8d62('0xc0')]){_0x146357=_0x24caaf['get']({'plain':!![]});if(_0x146357['List']&&_0x146357['List'][_0x8d62('0xa4')]['length']){return _0x146357[_0x8d62('0xc0')][_0x8d62('0xa4')][0x0];}return db['CmContact'][_0x8d62('0x56')](_[_0x8d62('0x14')](_0x4df240[_0x8d62('0x57')],{'firstName':_0x4b2161,'mobile':_0x4b2161,'phone':_0x4b2161,'ListId':_0x146357[_0x8d62('0x92')]}));}})[_0x8d62('0x1a')](handleEntityNotFound(_0x419b6c,null))['then'](function(_0x5e9053){if(_0x5e9053){_0x1678f6=_0x5e9053;return db[_0x8d62('0xa8')][_0x8d62('0x55')]({'where':{'ContactId':_0x1678f6['id'],'closed':![],'WhatsappAccountId':_0x146357['id']}})['then'](function(_0x5299bf){if(_0x5299bf){return[_0x5299bf,![]];}return db[_0x8d62('0xa8')][_0x8d62('0x56')]({'UserId':_0x4df240[_0x8d62('0x58')]['id'],'ContactId':_0x1678f6['id'],'WhatsappAccountId':_0x146357['id'],'phone':_0x4b2161,'firstMsgDirection':'out','Messages':[_['merge'](_0x4df240[_0x8d62('0x57')],{'read':![],'body':_0x4df240[_0x8d62('0x57')][_0x8d62('0x57')],'phone':_0x4b2161,'WhatsappAccountId':_0x146357['id'],'UserId':_0x4df240[_0x8d62('0x58')]['id'],'ContactId':_0x1678f6['id']})]},{'include':[{'model':db[_0x8d62('0x87')],'as':_0x8d62('0xc1')}]})[_0x8d62('0x1a')](function(_0x5a1bef){return[_0x5a1bef,!![]];});});}})[_0x8d62('0x6e')](function(_0x545c79,_0x3dff44){if(_0x3dff44){return _0x545c79;}return db[_0x8d62('0x87')][_0x8d62('0x56')](_['merge'](_0x4df240[_0x8d62('0x57')],{'read':![],'body':_0x4df240['body'][_0x8d62('0x57')],'phone':_0x4b2161,'WhatsappAccountId':_0x146357['id'],'WhatsappInteractionId':_0x545c79['id'],'UserId':_0x4df240[_0x8d62('0x58')]['id'],'ContactId':_0x1678f6['id']}))[_0x8d62('0x1a')](function(_0x357f03){_0x545c79[_0x8d62('0xc2')]['Messages']=[];_0x545c79[_0x8d62('0xc2')][_0x8d62('0xc1')][_0x8d62('0xac')](_0x357f03['dataValues']);return _0x545c79;});})[_0x8d62('0x1a')](respondWithResult(_0x419b6c,null))['catch'](handleError(_0x419b6c,null));};
\ No newline at end of file
index 6f43491..17694fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6167=['WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x47023,_0x3a69cd){var _0xd254d5=function(_0xf95434){while(--_0xf95434){_0x47023['push'](_0x47023['shift']());}};_0xd254d5(++_0x3a69cd);}(_0x6167,0x187));var _0x7616=function(_0x546c96,_0x2c204e){_0x546c96=_0x546c96-0x0;var _0x8dff11=_0x6167[_0x546c96];return _0x8dff11;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x7616('0x0'))['db'][_0x7616('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7616('0x2')](0x0);var events={'afterCreate':_0x7616('0x3'),'afterUpdate':'update','afterDestroy':_0x7616('0x4')};function emitEvent(_0x44fed3){return function(_0x2b01ce,_0x4f9849,_0x577030){WhatsappAccountEvents[_0x7616('0x5')](_0x44fed3+':'+_0x2b01ce['id'],_0x2b01ce);WhatsappAccountEvents[_0x7616('0x5')](_0x44fed3,_0x2b01ce);_0x577030(null);};}for(var e in events){if(events[_0x7616('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x7616('0x7')]=WhatsappAccountEvents;
\ No newline at end of file
+var _0x7cbb=['emit','hook','save','remove'];(function(_0x27d8dc,_0x8398d){var _0x3c824c=function(_0x4ec008){while(--_0x4ec008){_0x27d8dc['push'](_0x27d8dc['shift']());}};_0x3c824c(++_0x8398d);}(_0x7cbb,0x7a));var _0xb7cb=function(_0x467e6c,_0x476048){_0x467e6c=_0x467e6c-0x0;var _0x4a6c03=_0x7cbb[_0x467e6c];return _0x4a6c03;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7cb('0x0'),'afterUpdate':'update','afterDestroy':_0xb7cb('0x1')};function emitEvent(_0x226b69){return function(_0x1bb0cd,_0x438043,_0x1301ef){WhatsappAccountEvents[_0xb7cb('0x2')](_0x226b69+':'+_0x1bb0cd['id'],_0x1bb0cd);WhatsappAccountEvents['emit'](_0x226b69,_0x1bb0cd);_0x1301ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xb7cb('0x3')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents;
\ No newline at end of file
index 7a5b886..df0cb3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9eb=['api','moment','request-promise','path','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','util'];(function(_0x3600e4,_0x3bdc26){var _0x227f80=function(_0x3ca8c9){while(--_0x3ca8c9){_0x3600e4['push'](_0x3600e4['shift']());}};_0x227f80(++_0x3bdc26);}(_0xa9eb,0xf8));var _0xba9e=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa9eb[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xba9e('0x0'));var util=require(_0xba9e('0x1'));var logger=require('../../config/logger')(_0xba9e('0x2'));var moment=require(_0xba9e('0x3'));var BPromise=require('bluebird');var rp=require(_0xba9e('0x4'));var fs=require('fs');var path=require(_0xba9e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba9e('0x6'));module[_0xba9e('0x7')]=function(_0x316abb,_0x3803ee){return _0x316abb[_0xba9e('0x8')](_0xba9e('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc575=['./whatsappAccount.attributes','define','WhatsappAccount','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2ce6d5,_0x446729){var _0x44aca8=function(_0x36233b){while(--_0x36233b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x44aca8(++_0x446729);}(_0xc575,0x1b0));var _0x5c57=function(_0x5566b7,_0x4e9e2c){_0x5566b7=_0x5566b7-0x0;var _0x1c7ea7=_0xc575[_0x5566b7];return _0x1c7ea7;};'use strict';var _=require(_0x5c57('0x0'));var util=require(_0x5c57('0x1'));var logger=require(_0x5c57('0x2'))(_0x5c57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5c57('0x4'));var fs=require('fs');var path=require(_0x5c57('0x5'));var rimraf=require(_0x5c57('0x6'));var config=require(_0x5c57('0x7'));var attributes=require(_0x5c57('0x8'));module['exports']=function(_0x2d3294,_0x25daca){return _0x2d3294[_0x5c57('0x9')](_0x5c57('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 691cd27..ec0ef57 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e1d=['stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x27f1f6,_0x166f19){var _0x188532=function(_0x8911d3){while(--_0x8911d3){_0x27f1f6['push'](_0x27f1f6['shift']());}};_0x188532(++_0x166f19);}(_0x6e1d,0xfa));var _0xd6e1=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x6e1d[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0xd6e1('0x0'));var util=require(_0xd6e1('0x1'));var moment=require(_0xd6e1('0x2'));var BPromise=require(_0xd6e1('0x3'));var rs=require(_0xd6e1('0x4'));var fs=require('fs');var Redis=require(_0xd6e1('0x5'));var db=require(_0xd6e1('0x6'))['db'];var utils=require(_0xd6e1('0x7'));var logger=require('../../config/logger')(_0xd6e1('0x8'));var config=require(_0xd6e1('0x9'));var jayson=require(_0xd6e1('0xa'));var client=jayson['client'][_0xd6e1('0xb')]({'port':0x232a});config['redis']=_[_0xd6e1('0xc')](config['redis'],{'host':_0xd6e1('0xd'),'port':0x18eb});var socket=require(_0xd6e1('0xe'))(new Redis(config['redis']));require(_0xd6e1('0xf'))[_0xd6e1('0x10')](socket);function respondWithRpcPromise(_0x5173c5,_0x228e6a,_0x18aab7){return new BPromise(function(_0x3802eb,_0x1e5112){return client[_0xd6e1('0x11')](_0x5173c5,_0x18aab7)[_0xd6e1('0x12')](function(_0x289ec6){logger[_0xd6e1('0x13')](_0xd6e1('0x14'),_0x228e6a,_0xd6e1('0x15'));logger[_0xd6e1('0x16')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x228e6a,_0xd6e1('0x15'),JSON[_0xd6e1('0x17')](_0x289ec6));if(_0x289ec6[_0xd6e1('0x18')]){if(_0x289ec6['error'][_0xd6e1('0x19')]===0x1f4){logger[_0xd6e1('0x18')](_0xd6e1('0x14'),_0x228e6a,_0x289ec6[_0xd6e1('0x18')][_0xd6e1('0x1a')]);return _0x1e5112(_0x289ec6[_0xd6e1('0x18')][_0xd6e1('0x1a')]);}logger[_0xd6e1('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x228e6a,_0x289ec6[_0xd6e1('0x18')][_0xd6e1('0x1a')]);return _0x3802eb(_0x289ec6[_0xd6e1('0x18')][_0xd6e1('0x1a')]);}else{logger['info'](_0xd6e1('0x14'),_0x228e6a,_0xd6e1('0x15'));_0x3802eb(_0x289ec6[_0xd6e1('0x1b')][_0xd6e1('0x1a')]);}})[_0xd6e1('0x1c')](function(_0x2bec1e){logger[_0xd6e1('0x18')](_0xd6e1('0x14'),_0x228e6a,_0x2bec1e);_0x1e5112(_0x2bec1e);});});}exports[_0xd6e1('0x1d')]=function(_0x8e8379){var _0x12e87d=this;return new Promise(function(_0x24d99d,_0x339323){return db[_0xd6e1('0x1e')][_0xd6e1('0x1f')]({'raw':_0x8e8379['options']?_0x8e8379['options'][_0xd6e1('0x20')]===undefined?!![]:![]:!![],'where':_0x8e8379[_0xd6e1('0x21')]?_0x8e8379[_0xd6e1('0x21')][_0xd6e1('0x22')]||null:null,'attributes':_0x8e8379[_0xd6e1('0x21')]?_0x8e8379[_0xd6e1('0x21')][_0xd6e1('0x23')]||null:null,'include':_0x8e8379['options']?_0x8e8379['options'][_0xd6e1('0x24')]?_[_0xd6e1('0x25')](_0x8e8379[_0xd6e1('0x21')][_0xd6e1('0x24')],function(_0x192738){return{'model':db[_0x192738[_0xd6e1('0x26')]],'as':_0x192738['as'],'attributes':_0x192738[_0xd6e1('0x23')],'include':_0x192738[_0xd6e1('0x24')]?_[_0xd6e1('0x25')](_0x192738['include'],function(_0x329b26){return{'model':db[_0x329b26[_0xd6e1('0x26')]],'as':_0x329b26['as'],'attributes':_0x329b26[_0xd6e1('0x23')],'include':_0x329b26['include']?_['map'](_0x329b26['include'],function(_0x48673a){return{'model':db[_0x48673a[_0xd6e1('0x26')]],'as':_0x48673a['as'],'attributes':_0x48673a[_0xd6e1('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd6e1('0x12')](function(_0x39c533){logger[_0xd6e1('0x13')](_0xd6e1('0x1d'),_0x8e8379);logger[_0xd6e1('0x16')]('ShowWhatsappAccount',_0x8e8379,JSON[_0xd6e1('0x17')](_0x39c533));_0x24d99d(_0x39c533);})[_0xd6e1('0x1c')](function(_0x204ef7){logger[_0xd6e1('0x18')](_0xd6e1('0x1d'),_0x204ef7['message'],_0x8e8379);_0x339323(_0x12e87d[_0xd6e1('0x18')](0x1f4,_0x204ef7[_0xd6e1('0x1a')]));});});};
\ No newline at end of file
+var _0x578f=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x275f4a,_0x2077d4){var _0x4b4a21=function(_0x391bab){while(--_0x391bab){_0x275f4a['push'](_0x275f4a['shift']());}};_0x4b4a21(++_0x2077d4);}(_0x578f,0x176));var _0xf578=function(_0xdc5df0,_0x234ae1){_0xdc5df0=_0xdc5df0-0x0;var _0x11edbb=_0x578f[_0xdc5df0];return _0x11edbb;};'use strict';var _=require(_0xf578('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf578('0x1'));var rs=require(_0xf578('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf578('0x3'))['db'];var utils=require(_0xf578('0x4'));var logger=require(_0xf578('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf578('0x6'));var client=jayson['client'][_0xf578('0x7')]({'port':0x232a});config[_0xf578('0x8')]=_['defaults'](config['redis'],{'host':_0xf578('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf578('0x8')]));require(_0xf578('0xa'))['register'](socket);function respondWithRpcPromise(_0x3e81d7,_0x370ce3,_0x2b7227){return new BPromise(function(_0x238038,_0x5d2201){return client[_0xf578('0xb')](_0x3e81d7,_0x2b7227)[_0xf578('0xc')](function(_0x5049b4){logger[_0xf578('0xd')](_0xf578('0xe'),_0x370ce3,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x370ce3,_0xf578('0xf'),JSON[_0xf578('0x10')](_0x5049b4));if(_0x5049b4[_0xf578('0x11')]){if(_0x5049b4[_0xf578('0x11')][_0xf578('0x12')]===0x1f4){logger[_0xf578('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x370ce3,_0x5049b4['error'][_0xf578('0x13')]);return _0x5d2201(_0x5049b4[_0xf578('0x11')][_0xf578('0x13')]);}logger[_0xf578('0x11')](_0xf578('0xe'),_0x370ce3,_0x5049b4[_0xf578('0x11')][_0xf578('0x13')]);return _0x238038(_0x5049b4[_0xf578('0x11')][_0xf578('0x13')]);}else{logger[_0xf578('0xd')]('WhatsappAccount,\x20%s,\x20%s',_0x370ce3,_0xf578('0xf'));_0x238038(_0x5049b4[_0xf578('0x14')][_0xf578('0x13')]);}})[_0xf578('0x15')](function(_0x1b3f14){logger[_0xf578('0x11')](_0xf578('0xe'),_0x370ce3,_0x1b3f14);_0x5d2201(_0x1b3f14);});});}exports[_0xf578('0x16')]=function(_0x4114b0){var _0x41d712=this;return new Promise(function(_0x14cc25,_0x101de9){return db[_0xf578('0x17')][_0xf578('0x18')]({'raw':_0x4114b0[_0xf578('0x19')]?_0x4114b0[_0xf578('0x19')][_0xf578('0x1a')]===undefined?!![]:![]:!![],'where':_0x4114b0[_0xf578('0x19')]?_0x4114b0[_0xf578('0x19')][_0xf578('0x1b')]||null:null,'attributes':_0x4114b0['options']?_0x4114b0[_0xf578('0x19')][_0xf578('0x1c')]||null:null,'include':_0x4114b0[_0xf578('0x19')]?_0x4114b0['options'][_0xf578('0x1d')]?_[_0xf578('0x1e')](_0x4114b0[_0xf578('0x19')][_0xf578('0x1d')],function(_0x5648d6){return{'model':db[_0x5648d6[_0xf578('0x1f')]],'as':_0x5648d6['as'],'attributes':_0x5648d6[_0xf578('0x1c')],'include':_0x5648d6[_0xf578('0x1d')]?_['map'](_0x5648d6[_0xf578('0x1d')],function(_0x5d11d2){return{'model':db[_0x5d11d2[_0xf578('0x1f')]],'as':_0x5d11d2['as'],'attributes':_0x5d11d2[_0xf578('0x1c')],'include':_0x5d11d2[_0xf578('0x1d')]?_['map'](_0x5d11d2[_0xf578('0x1d')],function(_0x4cf9a4){return{'model':db[_0x4cf9a4[_0xf578('0x1f')]],'as':_0x4cf9a4['as'],'attributes':_0x4cf9a4[_0xf578('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf578('0xc')](function(_0x253aee){logger[_0xf578('0xd')](_0xf578('0x16'),_0x4114b0);logger[_0xf578('0x20')](_0xf578('0x16'),_0x4114b0,JSON['stringify'](_0x253aee));_0x14cc25(_0x253aee);})[_0xf578('0x15')](function(_0x5235de){logger['error']('ShowWhatsappAccount',_0x5235de[_0xf578('0x13')],_0x4114b0);_0x101de9(_0x41d712[_0xf578('0x11')](0x1f4,_0x5235de['message']));});});};
\ No newline at end of file
index b9a738e..93fb572 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcafd=['update','emit','removeListener','register','./whatsappAccount.events','save'];(function(_0x32ead5,_0x565b7d){var _0x141ee4=function(_0x13bb7c){while(--_0x13bb7c){_0x32ead5['push'](_0x32ead5['shift']());}};_0x141ee4(++_0x565b7d);}(_0xcafd,0x64));var _0xdcaf=function(_0x3fa749,_0x43fabf){_0x3fa749=_0x3fa749-0x0;var _0x54d5c5=_0xcafd[_0x3fa749];return _0x54d5c5;};'use strict';var WhatsappAccountEvents=require(_0xdcaf('0x0'));var events=[_0xdcaf('0x1'),'remove',_0xdcaf('0x2')];function createListener(_0x5b9657,_0x4c3cd4){return function(_0x15a221){_0x4c3cd4[_0xdcaf('0x3')](_0x5b9657,_0x15a221);};}function removeListener(_0x25b43e,_0x3483ad){return function(){WhatsappAccountEvents[_0xdcaf('0x4')](_0x25b43e,_0x3483ad);};}exports[_0xdcaf('0x5')]=function(_0x1e567f){for(var _0x56f9b3=0x0,_0xc25656=events['length'];_0x56f9b3<_0xc25656;_0x56f9b3++){var _0x19302c=events[_0x56f9b3];var _0x5e0884=createListener('whatsappAccount:'+_0x19302c,_0x1e567f);WhatsappAccountEvents['on'](_0x19302c,_0x5e0884);}};
\ No newline at end of file
+var _0x20db=['length','whatsappAccount:','save','remove','update','emit','removeListener','register'];(function(_0xe48a5f,_0xe82edb){var _0x5ea658=function(_0x508efe){while(--_0x508efe){_0xe48a5f['push'](_0xe48a5f['shift']());}};_0x5ea658(++_0xe82edb);}(_0x20db,0x7a));var _0xb20d=function(_0x582598,_0x311dc5){_0x582598=_0x582598-0x0;var _0x1de137=_0x20db[_0x582598];return _0x1de137;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb20d('0x0'),_0xb20d('0x1'),_0xb20d('0x2')];function createListener(_0x30ffc2,_0x516bf6){return function(_0x52ff42){_0x516bf6[_0xb20d('0x3')](_0x30ffc2,_0x52ff42);};}function removeListener(_0x8863dc,_0x972201){return function(){WhatsappAccountEvents[_0xb20d('0x4')](_0x8863dc,_0x972201);};}exports[_0xb20d('0x5')]=function(_0x1e2c29){for(var _0x545954=0x0,_0x13af0b=events[_0xb20d('0x6')];_0x545954<_0x13af0b;_0x545954++){var _0x4fe5e1=events[_0x545954];var _0x2cb569=createListener(_0xb20d('0x7')+_0x4fe5e1,_0x1e2c29);WhatsappAccountEvents['on'](_0x4fe5e1,_0x2cb569);}};
\ No newline at end of file
index eac4b30..ae9cd66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4953=['../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','get','/:id','post','create','put','update','destroy','exports','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x4953,0x14b));var _0x3495=function(_0x2bec00,_0x5718c0){_0x2bec00=_0x2bec00-0x0;var _0x32cd5e=_0x4953[_0x2bec00];return _0x32cd5e;};'use strict';var multer=require('multer');var util=require(_0x3495('0x0'));var path=require(_0x3495('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3495('0x2')]();var fs_extra=require(_0x3495('0x3'));var auth=require(_0x3495('0x4'));var interaction=require(_0x3495('0x5'));var config=require('../../config/environment');var controller=require(_0x3495('0x6'));router['get']('/',auth[_0x3495('0x7')](),controller['index']);router[_0x3495('0x8')](_0x3495('0x9'),auth[_0x3495('0x7')](),controller['show']);router[_0x3495('0xa')]('/',auth[_0x3495('0x7')](),controller[_0x3495('0xb')]);router[_0x3495('0xc')](_0x3495('0x9'),auth[_0x3495('0x7')](),controller[_0x3495('0xd')]);router['delete'](_0x3495('0x9'),auth[_0x3495('0x7')](),controller[_0x3495('0xe')]);module[_0x3495('0xf')]=router;
\ No newline at end of file
+var _0x342c=['express','fs-extra','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','exports','multer','util'];(function(_0x472ad6,_0x5af854){var _0x49665b=function(_0x2efe96){while(--_0x2efe96){_0x472ad6['push'](_0x472ad6['shift']());}};_0x49665b(++_0x5af854);}(_0x342c,0x108));var _0xc342=function(_0x372df5,_0x5c18c6){_0x372df5=_0x372df5-0x0;var _0x3aafb1=_0x342c[_0x372df5];return _0x3aafb1;};'use strict';var multer=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc342('0x2'));var router=express['Router']();var fs_extra=require(_0xc342('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc342('0x4'));router[_0xc342('0x5')]('/',auth[_0xc342('0x6')](),controller[_0xc342('0x7')]);router[_0xc342('0x5')](_0xc342('0x8'),auth[_0xc342('0x6')](),controller['show']);router[_0xc342('0x9')]('/',auth[_0xc342('0x6')](),controller[_0xc342('0xa')]);router[_0xc342('0xb')](_0xc342('0x8'),auth[_0xc342('0x6')](),controller['update']);router['delete'](_0xc342('0x8'),auth[_0xc342('0x6')](),controller[_0xc342('0xc')]);module[_0xc342('0xd')]=router;
\ No newline at end of file
index 8998d0c..62c74a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5782=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x5782,0xc2));var _0x2578=function(_0x4f3039,_0x100a43){_0x4f3039=_0x4f3039-0x0;var _0x13218c=_0x5782[_0x4f3039];return _0x13218c;};'use strict';var Sequelize=require(_0x2578('0x0'));module[_0x2578('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2578('0x2')],'allowNull':![],'defaultValue':_0x2578('0x3')},'appdata':{'type':Sequelize[_0x2578('0x4')]()},'description':{'type':Sequelize[_0x2578('0x2')]},'interval':{'type':Sequelize[_0x2578('0x2')],'defaultValue':_0x2578('0x5')}};
\ No newline at end of file
+var _0xf637=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x26a396,_0x167fc0){var _0x5cb800=function(_0x502f1b){while(--_0x502f1b){_0x26a396['push'](_0x26a396['shift']());}};_0x5cb800(++_0x167fc0);}(_0xf637,0x179));var _0x7f63=function(_0x3340b6,_0x6e5537){_0x3340b6=_0x3340b6-0x0;var _0x23f973=_0xf637[_0x3340b6];return _0x23f973;};'use strict';var Sequelize=require(_0x7f63('0x0'));module[_0x7f63('0x1')]={'priority':{'type':Sequelize[_0x7f63('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7f63('0x3')],'allowNull':![],'defaultValue':_0x7f63('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7f63('0x3')]},'interval':{'type':Sequelize[_0x7f63('0x3')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index 8c70f07..036a948 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0d7=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','findAll','find','create','catch','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1a2c22,_0x15027){var _0x2fc87e=function(_0x587806){while(--_0x587806){_0x1a2c22['push'](_0x1a2c22['shift']());}};_0x2fc87e(++_0x15027);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x3af1f0,_0x1e6081){_0x3af1f0=_0x3af1f0-0x0;var _0x5f2b4a=_0xc0d7[_0x3af1f0];return _0x5f2b4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c0d('0x0'));var rp=require(_0x7c0d('0x1'));var moment=require(_0x7c0d('0x2'));var BPromise=require(_0x7c0d('0x3'));var Mustache=require(_0x7c0d('0x4'));var util=require(_0x7c0d('0x5'));var path=require(_0x7c0d('0x6'));var sox=require(_0x7c0d('0x7'));var csv=require(_0x7c0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c0d('0x9'));var _=require(_0x7c0d('0xa'));var squel=require(_0x7c0d('0xb'));var crypto=require(_0x7c0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7c0d('0xd'));var toCsv=require(_0x7c0d('0x8'));var querystring=require(_0x7c0d('0xe'));var Papa=require(_0x7c0d('0xf'));var Redis=require('ioredis');var authService=require(_0x7c0d('0x10'));var qs=require(_0x7c0d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c0d('0x12'))(_0x7c0d('0x13'));var utils=require('../../config/utils');var config=require(_0x7c0d('0x14'));var licenseUtil=require(_0x7c0d('0x15'));var db=require(_0x7c0d('0x16'))['db'];function respondWithStatusCode(_0x198dde,_0x41236d){_0x41236d=_0x41236d||0xcc;return function(_0x34dccf){if(_0x34dccf){return _0x198dde['sendStatus'](_0x41236d);}return _0x198dde[_0x7c0d('0x17')](_0x41236d)[_0x7c0d('0x18')]();};}function respondWithResult(_0x2ee593,_0x25c4a8){_0x25c4a8=_0x25c4a8||0xc8;return function(_0x33dd94){if(_0x33dd94){return _0x2ee593[_0x7c0d('0x17')](_0x25c4a8)[_0x7c0d('0x19')](_0x33dd94);}};}function respondWithFilteredResult(_0x13f301,_0x4a5fb4){return function(_0x340937){if(_0x340937){var _0x4e9850=typeof _0x4a5fb4[_0x7c0d('0x1a')]==='undefined'&&typeof _0x4a5fb4[_0x7c0d('0x1b')]===_0x7c0d('0x1c');var _0x478100=_0x340937[_0x7c0d('0x1d')];var _0x2841e1=_0x4e9850?0x0:_0x4a5fb4[_0x7c0d('0x1a')];var _0x1418ee=_0x4e9850?_0x340937[_0x7c0d('0x1d')]:_0x4a5fb4[_0x7c0d('0x1a')]+_0x4a5fb4[_0x7c0d('0x1b')];var _0x111dbe;if(_0x1418ee>=_0x478100){_0x1418ee=_0x478100;_0x111dbe=0xc8;}else{_0x111dbe=0xce;}_0x13f301[_0x7c0d('0x17')](_0x111dbe);return _0x13f301[_0x7c0d('0x1e')](_0x7c0d('0x1f'),_0x2841e1+'-'+_0x1418ee+'/'+_0x478100)[_0x7c0d('0x19')](_0x340937);}return null;};}function patchUpdates(_0x12e19a){return function(_0x2f0ac0){try{jsonpatch[_0x7c0d('0x20')](_0x2f0ac0,_0x12e19a,!![]);}catch(_0x1308c6){return BPromise['reject'](_0x1308c6);}return _0x2f0ac0['save']();};}function saveUpdates(_0x5dae80,_0x54b14f){return function(_0x5872fe){if(_0x5872fe){return _0x5872fe[_0x7c0d('0x21')](_0x5dae80)[_0x7c0d('0x22')](function(_0x1c7b84){return _0x1c7b84;});}return null;};}function removeEntity(_0x2f657e,_0x1ef191){return function(_0x2a92ce){if(_0x2a92ce){return _0x2a92ce[_0x7c0d('0x23')]()['then'](function(){_0x2f657e[_0x7c0d('0x17')](0xcc)[_0x7c0d('0x18')]();});}};}function handleEntityNotFound(_0x5aa006,_0x540abc){return function(_0x357cca){if(!_0x357cca){_0x5aa006['sendStatus'](0x194);}return _0x357cca;};}function handleError(_0x236973,_0x305a3a){_0x305a3a=_0x305a3a||0x1f4;return function(_0x43ba3b){logger[_0x7c0d('0x24')](_0x43ba3b[_0x7c0d('0x25')]);if(_0x43ba3b['name']){delete _0x43ba3b[_0x7c0d('0x26')];}_0x236973[_0x7c0d('0x17')](_0x305a3a)[_0x7c0d('0x27')](_0x43ba3b);};}exports[_0x7c0d('0x28')]=function(_0x2a8756,_0x4aea76){var _0x2b261={},_0x553627={},_0x3a8947={'count':0x0,'rows':[]};var _0x1d2020=_[_0x7c0d('0x29')](db[_0x7c0d('0x2a')][_0x7c0d('0x2b')],function(_0x35284b){return{'name':_0x35284b['fieldName'],'type':_0x35284b[_0x7c0d('0x2c')]['key']};});_0x553627[_0x7c0d('0x2d')]=_[_0x7c0d('0x29')](_0x1d2020,'name');_0x553627['query']=_[_0x7c0d('0x2e')](_0x2a8756['query']);_0x553627[_0x7c0d('0x2f')]=_[_0x7c0d('0x30')](_0x553627['model'],_0x553627['query']);_0x2b261['attributes']=_['intersection'](_0x553627[_0x7c0d('0x2d')],qs['fields'](_0x2a8756[_0x7c0d('0x31')][_0x7c0d('0x32')]));_0x2b261['attributes']=_0x2b261[_0x7c0d('0x33')][_0x7c0d('0x34')]?_0x2b261[_0x7c0d('0x33')]:_0x553627[_0x7c0d('0x2d')];if(!_0x2a8756['query'][_0x7c0d('0x35')](_0x7c0d('0x36'))){_0x2b261[_0x7c0d('0x1b')]=qs[_0x7c0d('0x1b')](_0x2a8756[_0x7c0d('0x31')][_0x7c0d('0x1b')]);_0x2b261[_0x7c0d('0x1a')]=qs[_0x7c0d('0x1a')](_0x2a8756[_0x7c0d('0x31')][_0x7c0d('0x1a')]);}_0x2b261['order']=qs[_0x7c0d('0x37')](_0x2a8756[_0x7c0d('0x31')]['sort']);_0x2b261[_0x7c0d('0x38')]=qs[_0x7c0d('0x2f')](_[_0x7c0d('0x39')](_0x2a8756[_0x7c0d('0x31')],_0x553627[_0x7c0d('0x2f')]),_0x1d2020);if(_0x2a8756[_0x7c0d('0x31')]['filter']){_0x2b261[_0x7c0d('0x38')]=_[_0x7c0d('0x3a')](_0x2b261[_0x7c0d('0x38')],{'$or':_[_0x7c0d('0x29')](_0x1d2020,function(_0xf5058e){if(_0xf5058e['type']!=='VIRTUAL'){var _0x653e1f={};_0x653e1f[_0xf5058e[_0x7c0d('0x26')]]={'$like':'%'+_0x2a8756['query'][_0x7c0d('0x3b')]+'%'};return _0x653e1f;}})});}_0x2b261=_['merge']({},_0x2b261,_0x2a8756[_0x7c0d('0x3c')]);var _0x544e9f={'where':_0x2b261['where']};return db[_0x7c0d('0x2a')]['count'](_0x544e9f)[_0x7c0d('0x22')](function(_0x1a0daa){_0x3a8947['count']=_0x1a0daa;if(_0x2a8756['query']['includeAll']){_0x2b261[_0x7c0d('0x3d')]=[{'all':!![]}];}return db[_0x7c0d('0x2a')][_0x7c0d('0x3e')](_0x2b261);})[_0x7c0d('0x22')](function(_0x5dc200){_0x3a8947['rows']=_0x5dc200;return _0x3a8947;})[_0x7c0d('0x22')](respondWithFilteredResult(_0x4aea76,_0x2b261))['catch'](handleError(_0x4aea76,null));};exports['show']=function(_0x420ecf,_0x5dd062){var _0x2ae43c={'raw':!![],'where':{'id':_0x420ecf['params']['id']}},_0x36aafb={};_0x36aafb[_0x7c0d('0x2d')]=_[_0x7c0d('0x2e')](db[_0x7c0d('0x2a')][_0x7c0d('0x2b')]);_0x36aafb[_0x7c0d('0x31')]=_['keys'](_0x420ecf[_0x7c0d('0x31')]);_0x36aafb[_0x7c0d('0x2f')]=_['intersection'](_0x36aafb[_0x7c0d('0x2d')],_0x36aafb[_0x7c0d('0x31')]);_0x2ae43c[_0x7c0d('0x33')]=_[_0x7c0d('0x30')](_0x36aafb['model'],qs[_0x7c0d('0x32')](_0x420ecf[_0x7c0d('0x31')][_0x7c0d('0x32')]));_0x2ae43c[_0x7c0d('0x33')]=_0x2ae43c[_0x7c0d('0x33')]['length']?_0x2ae43c[_0x7c0d('0x33')]:_0x36aafb['model'];if(_0x420ecf[_0x7c0d('0x31')]['includeAll']){_0x2ae43c[_0x7c0d('0x3d')]=[{'all':!![]}];}_0x2ae43c=_[_0x7c0d('0x3a')]({},_0x2ae43c,_0x420ecf[_0x7c0d('0x3c')]);return db[_0x7c0d('0x2a')][_0x7c0d('0x3f')](_0x2ae43c)['then'](handleEntityNotFound(_0x5dd062,null))[_0x7c0d('0x22')](respondWithResult(_0x5dd062,null))['catch'](handleError(_0x5dd062,null));};exports[_0x7c0d('0x40')]=function(_0x182029,_0x32bb12){return db['WhatsappApplication'][_0x7c0d('0x40')](_0x182029['body'],{})['then'](respondWithResult(_0x32bb12,0xc9))[_0x7c0d('0x41')](handleError(_0x32bb12,null));};exports[_0x7c0d('0x21')]=function(_0x24a5c4,_0x57038b){if(_0x24a5c4[_0x7c0d('0x42')]['id']){delete _0x24a5c4[_0x7c0d('0x42')]['id'];}return db[_0x7c0d('0x2a')]['find']({'where':{'id':_0x24a5c4[_0x7c0d('0x43')]['id']}})[_0x7c0d('0x22')](handleEntityNotFound(_0x57038b,null))[_0x7c0d('0x22')](saveUpdates(_0x24a5c4[_0x7c0d('0x42')],null))[_0x7c0d('0x22')](respondWithResult(_0x57038b,null))['catch'](handleError(_0x57038b,null));};exports['destroy']=function(_0x41c115,_0x333ebf){return db['WhatsappApplication']['find']({'where':{'id':_0x41c115[_0x7c0d('0x43')]['id']}})[_0x7c0d('0x22')](handleEntityNotFound(_0x333ebf,null))[_0x7c0d('0x22')](removeEntity(_0x333ebf,null))['catch'](handleError(_0x333ebf,null));};
\ No newline at end of file
+var _0x5360=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../config/logger','api'];(function(_0x40f658,_0x570a83){var _0x5ea1d7=function(_0x25cd06){while(--_0x25cd06){_0x40f658['push'](_0x40f658['shift']());}};_0x5ea1d7(++_0x570a83);}(_0x5360,0x157));var _0x0536=function(_0x372c5d,_0x6721ff){_0x372c5d=_0x372c5d-0x0;var _0x52994c=_0x5360[_0x372c5d];return _0x52994c;};'use strict';var emlformat=require(_0x0536('0x0'));var rimraf=require(_0x0536('0x1'));var zipdir=require(_0x0536('0x2'));var jsonpatch=require(_0x0536('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0536('0x4'));var Mustache=require('mustache');var util=require(_0x0536('0x5'));var path=require(_0x0536('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0536('0x7'));var _=require(_0x0536('0x8'));var squel=require(_0x0536('0x9'));var crypto=require(_0x0536('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0536('0xb'));var toCsv=require(_0x0536('0xc'));var querystring=require(_0x0536('0xd'));var Papa=require('papaparse');var Redis=require(_0x0536('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0536('0xf'))(_0x0536('0x10'));var utils=require(_0x0536('0x11'));var config=require(_0x0536('0x12'));var licenseUtil=require(_0x0536('0x13'));var db=require(_0x0536('0x14'))['db'];function respondWithStatusCode(_0x69f430,_0x3bacec){_0x3bacec=_0x3bacec||0xcc;return function(_0x46da69){if(_0x46da69){return _0x69f430[_0x0536('0x15')](_0x3bacec);}return _0x69f430[_0x0536('0x16')](_0x3bacec)[_0x0536('0x17')]();};}function respondWithResult(_0x355189,_0x543134){_0x543134=_0x543134||0xc8;return function(_0x29123b){if(_0x29123b){return _0x355189[_0x0536('0x16')](_0x543134)[_0x0536('0x18')](_0x29123b);}};}function respondWithFilteredResult(_0x4720c2,_0x4723a3){return function(_0x58dddc){if(_0x58dddc){var _0x3d6b68=typeof _0x4723a3[_0x0536('0x19')]===_0x0536('0x1a')&&typeof _0x4723a3[_0x0536('0x1b')]==='undefined';var _0x4e4076=_0x58dddc[_0x0536('0x1c')];var _0x25fb28=_0x3d6b68?0x0:_0x4723a3[_0x0536('0x19')];var _0x5c676c=_0x3d6b68?_0x58dddc['count']:_0x4723a3[_0x0536('0x19')]+_0x4723a3[_0x0536('0x1b')];var _0x506de2;if(_0x5c676c>=_0x4e4076){_0x5c676c=_0x4e4076;_0x506de2=0xc8;}else{_0x506de2=0xce;}_0x4720c2[_0x0536('0x16')](_0x506de2);return _0x4720c2[_0x0536('0x1d')](_0x0536('0x1e'),_0x25fb28+'-'+_0x5c676c+'/'+_0x4e4076)[_0x0536('0x18')](_0x58dddc);}return null;};}function patchUpdates(_0x3e1d66){return function(_0x52bcd8){try{jsonpatch[_0x0536('0x1f')](_0x52bcd8,_0x3e1d66,!![]);}catch(_0x51ba52){return BPromise['reject'](_0x51ba52);}return _0x52bcd8[_0x0536('0x20')]();};}function saveUpdates(_0x15e3f2,_0x21c094){return function(_0x2f5ebd){if(_0x2f5ebd){return _0x2f5ebd[_0x0536('0x21')](_0x15e3f2)[_0x0536('0x22')](function(_0x272008){return _0x272008;});}return null;};}function removeEntity(_0x4bfec1,_0x475b87){return function(_0x3e3542){if(_0x3e3542){return _0x3e3542['destroy']()[_0x0536('0x22')](function(){_0x4bfec1[_0x0536('0x16')](0xcc)[_0x0536('0x17')]();});}};}function handleEntityNotFound(_0x4e3287,_0x32a0d6){return function(_0x290701){if(!_0x290701){_0x4e3287[_0x0536('0x15')](0x194);}return _0x290701;};}function handleError(_0x597693,_0x122cc5){_0x122cc5=_0x122cc5||0x1f4;return function(_0x334b46){logger[_0x0536('0x23')](_0x334b46[_0x0536('0x24')]);if(_0x334b46[_0x0536('0x25')]){delete _0x334b46[_0x0536('0x25')];}_0x597693[_0x0536('0x16')](_0x122cc5)[_0x0536('0x26')](_0x334b46);};}exports[_0x0536('0x27')]=function(_0x2e3ab1,_0x5f4b92){var _0x2ab6dd={},_0x36d4d7={},_0x4d8c31={'count':0x0,'rows':[]};var _0x3be6c1=_[_0x0536('0x28')](db[_0x0536('0x29')][_0x0536('0x2a')],function(_0x52f8d9){return{'name':_0x52f8d9[_0x0536('0x2b')],'type':_0x52f8d9['type']['key']};});_0x36d4d7[_0x0536('0x2c')]=_[_0x0536('0x28')](_0x3be6c1,_0x0536('0x25'));_0x36d4d7[_0x0536('0x2d')]=_[_0x0536('0x2e')](_0x2e3ab1[_0x0536('0x2d')]);_0x36d4d7['filters']=_[_0x0536('0x2f')](_0x36d4d7[_0x0536('0x2c')],_0x36d4d7['query']);_0x2ab6dd[_0x0536('0x30')]=_['intersection'](_0x36d4d7[_0x0536('0x2c')],qs[_0x0536('0x31')](_0x2e3ab1[_0x0536('0x2d')][_0x0536('0x31')]));_0x2ab6dd[_0x0536('0x30')]=_0x2ab6dd[_0x0536('0x30')]['length']?_0x2ab6dd[_0x0536('0x30')]:_0x36d4d7['model'];if(!_0x2e3ab1['query'][_0x0536('0x32')](_0x0536('0x33'))){_0x2ab6dd[_0x0536('0x1b')]=qs['limit'](_0x2e3ab1[_0x0536('0x2d')][_0x0536('0x1b')]);_0x2ab6dd[_0x0536('0x19')]=qs[_0x0536('0x19')](_0x2e3ab1[_0x0536('0x2d')]['offset']);}_0x2ab6dd[_0x0536('0x34')]=qs[_0x0536('0x35')](_0x2e3ab1[_0x0536('0x2d')][_0x0536('0x35')]);_0x2ab6dd[_0x0536('0x36')]=qs['filters'](_[_0x0536('0x37')](_0x2e3ab1['query'],_0x36d4d7[_0x0536('0x38')]),_0x3be6c1);if(_0x2e3ab1[_0x0536('0x2d')][_0x0536('0x39')]){_0x2ab6dd['where']=_[_0x0536('0x3a')](_0x2ab6dd[_0x0536('0x36')],{'$or':_[_0x0536('0x28')](_0x3be6c1,function(_0x2e2aee){if(_0x2e2aee['type']!==_0x0536('0x3b')){var _0x2d6b27={};_0x2d6b27[_0x2e2aee['name']]={'$like':'%'+_0x2e3ab1[_0x0536('0x2d')]['filter']+'%'};return _0x2d6b27;}})});}_0x2ab6dd=_['merge']({},_0x2ab6dd,_0x2e3ab1[_0x0536('0x3c')]);var _0x17fad0={'where':_0x2ab6dd[_0x0536('0x36')]};return db['WhatsappApplication']['count'](_0x17fad0)['then'](function(_0x46a1b5){_0x4d8c31[_0x0536('0x1c')]=_0x46a1b5;if(_0x2e3ab1['query'][_0x0536('0x3d')]){_0x2ab6dd[_0x0536('0x3e')]=[{'all':!![]}];}return db[_0x0536('0x29')][_0x0536('0x3f')](_0x2ab6dd);})['then'](function(_0x23aae3){_0x4d8c31[_0x0536('0x40')]=_0x23aae3;return _0x4d8c31;})[_0x0536('0x22')](respondWithFilteredResult(_0x5f4b92,_0x2ab6dd))[_0x0536('0x41')](handleError(_0x5f4b92,null));};exports[_0x0536('0x42')]=function(_0x267e82,_0x413e20){var _0x2560c0={'raw':!![],'where':{'id':_0x267e82[_0x0536('0x43')]['id']}},_0x5e4580={};_0x5e4580[_0x0536('0x2c')]=_[_0x0536('0x2e')](db['WhatsappApplication'][_0x0536('0x2a')]);_0x5e4580[_0x0536('0x2d')]=_[_0x0536('0x2e')](_0x267e82[_0x0536('0x2d')]);_0x5e4580[_0x0536('0x38')]=_['intersection'](_0x5e4580[_0x0536('0x2c')],_0x5e4580[_0x0536('0x2d')]);_0x2560c0['attributes']=_[_0x0536('0x2f')](_0x5e4580[_0x0536('0x2c')],qs[_0x0536('0x31')](_0x267e82[_0x0536('0x2d')][_0x0536('0x31')]));_0x2560c0[_0x0536('0x30')]=_0x2560c0[_0x0536('0x30')]['length']?_0x2560c0['attributes']:_0x5e4580[_0x0536('0x2c')];if(_0x267e82[_0x0536('0x2d')][_0x0536('0x3d')]){_0x2560c0[_0x0536('0x3e')]=[{'all':!![]}];}_0x2560c0=_[_0x0536('0x3a')]({},_0x2560c0,_0x267e82[_0x0536('0x3c')]);return db[_0x0536('0x29')][_0x0536('0x44')](_0x2560c0)['then'](handleEntityNotFound(_0x413e20,null))[_0x0536('0x22')](respondWithResult(_0x413e20,null))[_0x0536('0x41')](handleError(_0x413e20,null));};exports['create']=function(_0x1c455d,_0x5674ed){return db[_0x0536('0x29')][_0x0536('0x45')](_0x1c455d['body'],{})['then'](respondWithResult(_0x5674ed,0xc9))[_0x0536('0x41')](handleError(_0x5674ed,null));};exports[_0x0536('0x21')]=function(_0xebf186,_0x3e25ef){if(_0xebf186[_0x0536('0x46')]['id']){delete _0xebf186[_0x0536('0x46')]['id'];}return db[_0x0536('0x29')][_0x0536('0x44')]({'where':{'id':_0xebf186[_0x0536('0x43')]['id']}})[_0x0536('0x22')](handleEntityNotFound(_0x3e25ef,null))[_0x0536('0x22')](saveUpdates(_0xebf186[_0x0536('0x46')],null))[_0x0536('0x22')](respondWithResult(_0x3e25ef,null))['catch'](handleError(_0x3e25ef,null));};exports[_0x0536('0x47')]=function(_0x16ece5,_0x21cd8d){return db['WhatsappApplication'][_0x0536('0x44')]({'where':{'id':_0x16ece5[_0x0536('0x43')]['id']}})[_0x0536('0x22')](handleEntityNotFound(_0x21cd8d,null))[_0x0536('0x22')](removeEntity(_0x21cd8d,null))[_0x0536('0x41')](handleError(_0x21cd8d,null));};
\ No newline at end of file
index c0f7c45..4c58399 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7aaf=['rimraf','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise'];(function(_0x4fac8d,_0x327051){var _0x204bdb=function(_0xe6939a){while(--_0xe6939a){_0x4fac8d['push'](_0x4fac8d['shift']());}};_0x204bdb(++_0x327051);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x4072e5,_0x2dd9f1){_0x4072e5=_0x4072e5-0x0;var _0x5c24e8=_0x7aaf[_0x4072e5];return _0x5c24e8;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var logger=require(_0xf7aa('0x1'))(_0xf7aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7aa('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7aa('0x5'));module[_0xf7aa('0x6')]=function(_0x1babcd,_0xf02ed5){return _0x1babcd['define'](_0xf7aa('0x7'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf7aa('0x8')});};
\ No newline at end of file
+var _0x6ff1=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x6ff1,0x10a));var _0x16ff=function(_0x2c59f7,_0x1cf83b){_0x2c59f7=_0x2c59f7-0x0;var _0x19e5be=_0x6ff1[_0x2c59f7];return _0x19e5be;};'use strict';var _=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var logger=require(_0x16ff('0x2'))(_0x16ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16ff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16ff('0x5'));var config=require(_0x16ff('0x6'));var attributes=require(_0x16ff('0x7'));module[_0x16ff('0x8')]=function(_0x5325dd,_0x4f3752){return _0x5325dd['define']('WhatsappApplication',attributes,{'tableName':_0x16ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x16ff('0xa'),'collate':_0x16ff('0xb')});};
\ No newline at end of file
index 111ef55..6a8b1f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xeec6[_0x5e9876];return _0x576c48;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});}
\ No newline at end of file
+var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3c54d3,_0x9719e3){var _0xd67c8f=function(_0x4be75d){while(--_0x4be75d){_0x3c54d3['push'](_0x3c54d3['shift']());}};_0xd67c8f(++_0x9719e3);}(_0x84ab,0x12f));var _0xb84a=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x84ab[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});}
\ No newline at end of file
index e4f6298..d396535 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a5a=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9a5a,0x194));var _0xa9a5=function(_0x46302f,_0x4ef2b1){_0x46302f=_0x46302f-0x0;var _0x11cd60=_0x9a5a[_0x46302f];return _0x11cd60;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0xa')](_0xa9a5('0x10'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x11')]);router[_0xa9a5('0xa')](_0xa9a5('0x12'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x13')]);router[_0xa9a5('0x14')](_0xa9a5('0x10'),auth[_0xa9a5('0xd')](),controller['addMessage']);router[_0xa9a5('0x14')](_0xa9a5('0x15'),auth[_0xa9a5('0xd')](),interaction[_0xa9a5('0x16')](_0xa9a5('0x17'),_0xa9a5('0x18')),controller['addTags']);router[_0xa9a5('0x19')](_0xa9a5('0x1a'),auth[_0xa9a5('0xd')](),interaction[_0xa9a5('0x16')]('whatsapp',_0xa9a5('0x1b')),controller[_0xa9a5('0x1c')]);router[_0xa9a5('0x1d')]('/:id',auth[_0xa9a5('0xd')](),interaction['tracked']('whatsapp',_0xa9a5('0x1e')),controller[_0xa9a5('0x1f')]);router['delete'](_0xa9a5('0x15'),auth['isAuthenticated'](),controller[_0xa9a5('0x20')]);module[_0xa9a5('0x21')]=router;
\ No newline at end of file
+var _0x6657=['/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x4627ef,_0x3a385f){var _0x16ca04=function(_0x29c71f){while(--_0x29c71f){_0x4627ef['push'](_0x4627ef['shift']());}};_0x16ca04(++_0x3a385f);}(_0x6657,0x17f));var _0x7665=function(_0x393f62,_0x4dfe05){_0x393f62=_0x393f62-0x0;var _0xdd72e0=_0x6657[_0x393f62];return _0xdd72e0;};'use strict';var multer=require(_0x7665('0x0'));var util=require('util');var path=require(_0x7665('0x1'));var timeout=require(_0x7665('0x2'));var express=require(_0x7665('0x3'));var router=express[_0x7665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7665('0x5'));var interaction=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var controller=require(_0x7665('0x8'));router[_0x7665('0x9')]('/',auth[_0x7665('0xa')](),controller[_0x7665('0xb')]);router[_0x7665('0x9')]('/describe',auth[_0x7665('0xa')](),controller[_0x7665('0xc')]);router[_0x7665('0x9')](_0x7665('0xd'),auth[_0x7665('0xa')](),controller[_0x7665('0xe')]);router[_0x7665('0x9')](_0x7665('0xf'),auth['isAuthenticated'](),controller[_0x7665('0x10')]);router[_0x7665('0x9')](_0x7665('0x11'),auth['isAuthenticated'](),controller[_0x7665('0x12')]);router['post']('/',auth[_0x7665('0xa')](),controller[_0x7665('0x13')]);router['post'](_0x7665('0xf'),auth[_0x7665('0xa')](),controller['addMessage']);router[_0x7665('0x14')](_0x7665('0x15'),auth['isAuthenticated'](),interaction[_0x7665('0x16')](_0x7665('0x17'),_0x7665('0x18')),controller[_0x7665('0x19')]);router[_0x7665('0x1a')](_0x7665('0xd'),auth[_0x7665('0xa')](),interaction[_0x7665('0x16')](_0x7665('0x17'),_0x7665('0x1b')),controller[_0x7665('0x1c')]);router[_0x7665('0x1d')](_0x7665('0xd'),auth[_0x7665('0xa')](),interaction[_0x7665('0x16')](_0x7665('0x17'),'whatsappinteraction:destroy'),controller[_0x7665('0x1e')]);router[_0x7665('0x1d')]('/:id/tags',auth[_0x7665('0xa')](),controller[_0x7665('0x1f')]);module[_0x7665('0x20')]=router;
\ No newline at end of file
index 1b5a04f..f48f3bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29b1=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x2345fc,_0x127208){var _0x5d1fa3=function(_0x1ffc49){while(--_0x1ffc49){_0x2345fc['push'](_0x2345fc['shift']());}};_0x5d1fa3(++_0x127208);}(_0x29b1,0x13b));var _0x129b=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x29b1[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x129b('0x0')]={'closed':{'type':Sequelize[_0x129b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x129b('0x2')]},'disposition':{'type':Sequelize[_0x129b('0x3')]},'secondDisposition':{'type':Sequelize[_0x129b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x129b('0x3')]},'note':{'type':Sequelize[_0x129b('0x3')]},'phone':{'type':Sequelize[_0x129b('0x3')]},'read1stAt':{'type':Sequelize[_0x129b('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x129b('0x4')]('in',_0x129b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x129b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x129b('0x1')],'defaultValue':![]}};
\ No newline at end of file
+var _0x2d17=['BOOLEAN','DATE','STRING','ENUM','sequelize','moment'];(function(_0xa47f3e,_0x574552){var _0x8fe6cb=function(_0x330888){while(--_0x330888){_0xa47f3e['push'](_0xa47f3e['shift']());}};_0x8fe6cb(++_0x574552);}(_0x2d17,0x17e));var _0x72d1=function(_0x2a689b,_0x13efe1){_0x2a689b=_0x2a689b-0x0;var _0x30e564=_0x2d17[_0x2a689b];return _0x30e564;};'use strict';var Sequelize=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));module['exports']={'closed':{'type':Sequelize[_0x72d1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72d1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x72d1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x72d1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x72d1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x72d1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72d1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72d1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x72d1('0x2')],'defaultValue':![]}};
\ No newline at end of file
index 1ee3c14..45a9dd0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x992b=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','push','Attachment','createdAt','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','N.A.','closed','toString','disposition','Messages','basename','createReadStream','direction','System','Contact','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','err','unlinkSync','rimraf','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','name','index','map','WhatsappInteraction','type','key','getOptions','findAll','whatsapp','query','catch','show','rawAttributes','keys','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x992b,0x127));var _0xb992=function(_0x5e58be,_0x1f098c){_0x5e58be=_0x5e58be-0x0;var _0x1220a7=_0x992b[_0x5e58be];return _0x1220a7;};'use strict';var rimraf=require(_0xb992('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb992('0x1'));var BPromise=require(_0xb992('0x2'));var util=require(_0xb992('0x3'));var path=require(_0xb992('0x4'));var ejs=require(_0xb992('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb992('0x6'));var interaction=require(_0xb992('0x7'));var qs=require(_0xb992('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xb992('0x9'))('api');var config=require('../../config/environment');var db=require(_0xb992('0xa'))['db'];config[_0xb992('0xb')]=_['defaults'](config[_0xb992('0xb')],{'host':_0xb992('0xc'),'port':0x18eb});var socket=require(_0xb992('0xd'))(new Redis(config[_0xb992('0xb')]));require(_0xb992('0xe'))[_0xb992('0xf')](socket);function respondWithStatusCode(_0x440f17,_0x48bb17){_0x48bb17=_0x48bb17||0xcc;return function(_0x28a77b){if(_0x28a77b){return _0x440f17[_0xb992('0x10')](_0x48bb17);}return _0x440f17[_0xb992('0x11')](_0x48bb17)[_0xb992('0x12')]();};}function respondWithResult(_0x4455d4,_0x3c80c5){_0x3c80c5=_0x3c80c5||0xc8;return function(_0x4f436b){if(_0x4f436b){return _0x4455d4['status'](_0x3c80c5)['json'](_0x4f436b);}};}function respondWithFilteredResult(_0x27400e,_0x34789d){return function(_0x34d0dd){if(_0x34d0dd){var _0x516cd2=typeof _0x34789d[_0xb992('0x13')]===_0xb992('0x14')&&typeof _0x34789d[_0xb992('0x15')]===_0xb992('0x14');var _0x41dc8f=_0x34d0dd[_0xb992('0x16')];var _0x39b8a7=_0x516cd2?0x0:_0x34789d[_0xb992('0x13')];var _0x6b16c7=_0x516cd2?_0x34d0dd[_0xb992('0x16')]:_0x34789d[_0xb992('0x13')]+_0x34789d[_0xb992('0x15')];var _0xa1c51e;if(_0x6b16c7>=_0x41dc8f){_0x6b16c7=_0x41dc8f;_0xa1c51e=0xc8;}else{_0xa1c51e=0xce;}_0x27400e['status'](_0xa1c51e);return _0x27400e[_0xb992('0x17')](_0xb992('0x18'),_0x39b8a7+'-'+_0x6b16c7+'/'+_0x41dc8f)[_0xb992('0x19')](_0x34d0dd);}return null;};}function saveUpdates(_0x498f61){return function(_0x480fa1){if(_0x480fa1){return _0x480fa1[_0xb992('0x1a')](_0x498f61)[_0xb992('0x1b')](function(_0x500975){return _0x500975;});}return null;};}function removeEntity(_0x2ea029){return function(_0x304392){if(_0x304392){return _0x304392[_0xb992('0x1c')]()[_0xb992('0x1b')](function(){_0x2ea029[_0xb992('0x11')](0xcc)[_0xb992('0x12')]();});}};}function handleEntityNotFound(_0x4fe861){return function(_0x3e9553){if(!_0x3e9553){_0x4fe861[_0xb992('0x10')](0x194);}return _0x3e9553;};}function handleError(_0x4d51a0,_0x45fb84){_0x45fb84=_0x45fb84||0x1f4;return function(_0x1785fc){logger[_0xb992('0x1d')](_0x1785fc['stack']);if(_0x1785fc[_0xb992('0x1e')]){delete _0x1785fc[_0xb992('0x1e')];}_0x4d51a0[_0xb992('0x11')](_0x45fb84)['send'](_0x1785fc);};}exports[_0xb992('0x1f')]=function(_0xea8a71,_0x3fd7c3){var _0x46f5dd={};var _0x35501a=_[_0xb992('0x20')](db[_0xb992('0x21')]['rawAttributes'],function(_0x514efc){return{'name':_0x514efc['fieldName'],'type':_0x514efc[_0xb992('0x22')][_0xb992('0x23')]};});_0x46f5dd=qs[_0xb992('0x24')](_0x35501a,_0xea8a71);return interaction[_0xb992('0x25')](_0xb992('0x26'),_0xea8a71[_0xb992('0x27')],_0xea8a71['user'],_0x46f5dd,_0x35501a)[_0xb992('0x1b')](respondWithFilteredResult(_0x3fd7c3,_0x46f5dd))[_0xb992('0x28')](handleError(_0x3fd7c3,null));};exports[_0xb992('0x29')]=function(_0xd39216,_0x43f32d){var _0xa14e7c={'raw':![],'where':{'id':_0xd39216['params']['id']}},_0x1d4cf6={};_0x1d4cf6['model']=_['keys'](db[_0xb992('0x21')][_0xb992('0x2a')]);_0x1d4cf6['query']=_[_0xb992('0x2b')](_0xd39216[_0xb992('0x27')]);_0x1d4cf6['filters']=_[_0xb992('0x2c')](_0x1d4cf6[_0xb992('0x2d')],_0x1d4cf6[_0xb992('0x27')]);_0xa14e7c[_0xb992('0x2e')]=_[_0xb992('0x2c')](_0x1d4cf6[_0xb992('0x2d')],qs[_0xb992('0x2f')](_0xd39216[_0xb992('0x27')]['fields']));_0xa14e7c[_0xb992('0x2e')]=_0xa14e7c[_0xb992('0x2e')][_0xb992('0x30')]?_0xa14e7c[_0xb992('0x2e')]:_0x1d4cf6[_0xb992('0x2d')];if(_0xd39216[_0xb992('0x27')][_0xb992('0x31')]){_0xa14e7c[_0xb992('0x32')]=[{'all':!![]}];}_0xa14e7c=_[_0xb992('0x33')]({},_0xa14e7c,_0xd39216[_0xb992('0x34')]);return db[_0xb992('0x21')][_0xb992('0x35')](_0xa14e7c)[_0xb992('0x1b')](handleEntityNotFound(_0x43f32d,null))[_0xb992('0x1b')](respondWithResult(_0x43f32d,null))[_0xb992('0x28')](handleError(_0x43f32d,null));};exports[_0xb992('0x36')]=function(_0x3a918a,_0x2e5644){return db[_0xb992('0x21')][_0xb992('0x36')](_0x3a918a[_0xb992('0x37')],{})['then'](respondWithResult(_0x2e5644,0xc9))['catch'](handleError(_0x2e5644,null));};exports['update']=function(_0x37ec66,_0x43b2af){if(_0x37ec66['body']['id']){delete _0x37ec66[_0xb992('0x37')]['id'];}return db[_0xb992('0x21')][_0xb992('0x35')]({'where':{'id':_0x37ec66[_0xb992('0x38')]['id']}})[_0xb992('0x1b')](handleEntityNotFound(_0x43b2af,null))[_0xb992('0x1b')](saveUpdates(_0x37ec66[_0xb992('0x37')],null))[_0xb992('0x1b')](respondWithResult(_0x43b2af,null))[_0xb992('0x28')](handleError(_0x43b2af,null));};exports[_0xb992('0x1c')]=function(_0x52b9d3,_0x411021){return db['WhatsappInteraction']['find']({'where':{'id':_0x52b9d3[_0xb992('0x38')]['id']}})['then'](handleEntityNotFound(_0x411021,null))[_0xb992('0x1b')](removeEntity(_0x411021,null))[_0xb992('0x28')](handleError(_0x411021,null));};exports[_0xb992('0x39')]=function(_0x1dcb61,_0x102d6c){return db[_0xb992('0x21')]['describe']()[_0xb992('0x1b')](respondWithResult(_0x102d6c,null))[_0xb992('0x28')](handleError(_0x102d6c,null));};exports[_0xb992('0x3a')]=function(_0x30dc9a,_0x4459ad){return db[_0xb992('0x3b')][_0xb992('0x35')]({'where':{'id':_0x30dc9a[_0xb992('0x38')]['id']}})[_0xb992('0x1b')](handleEntityNotFound(_0x4459ad,null))['then'](function(_0xbbcec1){if(_0xbbcec1){return _0xbbcec1[_0xb992('0x3a')](_0x30dc9a[_0xb992('0x37')][_0xb992('0x3c')],_[_0xb992('0x3d')](_0x30dc9a[_0xb992('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x4459ad,null))[_0xb992('0x28')](handleError(_0x4459ad,null));};exports['getMessages']=function(_0x9a975e,_0x3fa130){var _0x77e6d9={'raw':![],'where':{}};var _0xd70a93={};var _0x4abfdc={'count':0x0,'rows':[]};return db[_0xb992('0x21')][_0xb992('0x3e')]({'where':{'id':_0x9a975e['params']['id']}})[_0xb992('0x1b')](handleEntityNotFound(_0x3fa130,null))['then'](function(_0x8eb977){if(_0x8eb977){_0xd70a93[_0xb992('0x2d')]=_[_0xb992('0x2b')](db['WhatsappMessage'][_0xb992('0x2a')]);_0xd70a93[_0xb992('0x27')]=_[_0xb992('0x2b')](_0x9a975e[_0xb992('0x27')]);_0xd70a93[_0xb992('0x3f')]=_['intersection'](_0xd70a93[_0xb992('0x2d')],_0xd70a93['query']);_0x77e6d9[_0xb992('0x2e')]=_['intersection'](_0xd70a93[_0xb992('0x2d')],qs['fields'](_0x9a975e[_0xb992('0x27')][_0xb992('0x2f')]));_0x77e6d9[_0xb992('0x2e')]=_0x77e6d9[_0xb992('0x2e')]['length']?_0x77e6d9[_0xb992('0x2e')]:_0xd70a93[_0xb992('0x2d')];if(!_0x9a975e[_0xb992('0x27')][_0xb992('0x40')](_0xb992('0x41'))){_0x77e6d9[_0xb992('0x15')]=qs[_0xb992('0x15')](_0x9a975e[_0xb992('0x27')]['limit']);_0x77e6d9[_0xb992('0x13')]=qs[_0xb992('0x13')](_0x9a975e[_0xb992('0x27')]['offset']);}_0x77e6d9[_0xb992('0x42')]=qs[_0xb992('0x43')](_0x9a975e['query'][_0xb992('0x43')]);_0x77e6d9[_0xb992('0x44')]=qs[_0xb992('0x3f')](_[_0xb992('0x45')](_0x9a975e[_0xb992('0x27')],_0xd70a93[_0xb992('0x3f')]));_0x77e6d9[_0xb992('0x44')][_0xb992('0x46')]=_0x8eb977['id'];if(_0x9a975e[_0xb992('0x27')]['filter']){_0x77e6d9[_0xb992('0x44')]=_['merge'](_0x77e6d9[_0xb992('0x44')],{'$or':_[_0xb992('0x20')](_0x77e6d9[_0xb992('0x2e')],function(_0xdae933){var _0x521aee={};_0x521aee[_0xdae933]={'$like':'%'+_0x9a975e['query']['filter']+'%'};return _0x521aee;})});}if(_0x9a975e[_0xb992('0x27')][_0xb992('0x47')]){var _0x443059=_0x9a975e[_0xb992('0x27')][_0xb992('0x47')][_0xb992('0x48')](',');var _0x37ab08={};_0x37ab08[_0x443059[0x0]]={'$gte':moment(_0x443059[0x1])[_0xb992('0x49')](_0xb992('0x4a'))};_0x77e6d9['where']=_[_0xb992('0x33')](_0x77e6d9[_0xb992('0x44')],_0x37ab08);}_0x77e6d9=_[_0xb992('0x33')]({},_0x77e6d9,_0x9a975e[_0xb992('0x34')]);return db[_0xb992('0x3b')][_0xb992('0x16')]({'where':_0x77e6d9[_0xb992('0x44')]})[_0xb992('0x1b')](function(_0x244eed){_0x4abfdc[_0xb992('0x16')]=_0x244eed;if(_0x9a975e[_0xb992('0x27')][_0xb992('0x31')]){_0x77e6d9['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xb992('0x25')](_0x77e6d9);})[_0xb992('0x1b')](function(_0x39b7f6){_0x4abfdc[_0xb992('0x4b')]=_0x39b7f6;return _0x4abfdc;});}})[_0xb992('0x1b')](respondWithFilteredResult(_0x3fa130,_0x77e6d9))[_0xb992('0x28')](handleError(_0x3fa130,null));};exports['addTags']=function(_0x2b87ce,_0x382dc0){return db[_0xb992('0x21')][_0xb992('0x35')]({'where':{'id':_0x2b87ce[_0xb992('0x38')]['id']}})['then'](handleEntityNotFound(_0x382dc0,null))[_0xb992('0x1b')](function(_0x285700){if(_0x285700){return _0x285700[_0xb992('0x4c')](_0x2b87ce[_0xb992('0x37')][_0xb992('0x3c')],_[_0xb992('0x3d')](_0x2b87ce[_0xb992('0x37')],[_0xb992('0x3c'),'id'])||{})[_0xb992('0x4d')](function(){return db['Tag']['findAll']({'attributes':['id',_0xb992('0x1e'),_0xb992('0x4e')],'where':{'id':_0x2b87ce[_0xb992('0x37')][_0xb992('0x3c')]}});})[_0xb992('0x1b')](function(_0x475e95){socket[_0xb992('0x4f')]('whatsappInteractionTags:save',{'id':Number(_0x2b87ce[_0xb992('0x38')]['id']),'tags':_0x475e95||[]});return{'id':Number(_0x2b87ce[_0xb992('0x38')]['id']),'tags':_0x475e95||[]};});}})[_0xb992('0x1b')](respondWithResult(_0x382dc0,null))['catch'](handleError(_0x382dc0,null));};exports[_0xb992('0x50')]=function(_0x3325e2,_0x378aa4){return db['WhatsappInteraction'][_0xb992('0x35')]({'where':{'id':_0x3325e2[_0xb992('0x38')]['id']}})[_0xb992('0x1b')](handleEntityNotFound(_0x378aa4,null))['then'](function(_0x22a0c9){if(_0x22a0c9){return _0x22a0c9[_0xb992('0x50')](_0x3325e2[_0xb992('0x27')][_0xb992('0x3c')]);}})['then'](respondWithStatusCode(_0x378aa4,null))[_0xb992('0x28')](handleError(_0x378aa4,null));};exports[_0xb992('0x51')]=function(_0x1c3d00,_0xe6d87c){var _0x3dcc6f=moment()[_0xb992('0x52')]()['toString']();var _0x305cc6=path['join'](config[_0xb992('0x53')],_0xb992('0x54'),_0xb992('0x55'),_0xb992('0x56'));var _0x32075b=path[_0xb992('0x57')](config[_0xb992('0x53')],_0xb992('0x54'),_0xb992('0x55'),_0xb992('0x58'));var _0x3b2cc4=path[_0xb992('0x57')](_0x305cc6,_0x3dcc6f);var _0x57423e=util[_0xb992('0x49')](_0xb992('0x59'),_0x1c3d00[_0xb992('0x38')]['id'],_0x3dcc6f);var _0x3eed2a=path[_0xb992('0x57')](_0x305cc6,_0x57423e);var _0x449479=[];_0x449479['push']({'model':db[_0xb992('0x5a')],'as':_0xb992('0x5a'),'attributes':['id',_0xb992('0x5b')],'raw':!![]});_0x449479['push']({'model':db[_0xb992('0x5c')],'as':'Contact','attributes':['id',_0xb992('0x5d'),_0xb992('0x5e')],'raw':!![]});if(_0x1c3d00[_0xb992('0x27')][_0xb992('0x58')]){_0x449479[_0xb992('0x5f')]({'model':db[_0xb992('0x60')],'as':_0xb992('0x60'),'raw':!![]});}var _0x586a2f=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xb992('0x37'),_0xb992('0x61'),'direction','secret',_0xb992('0x62')],'include':_0x449479}];_0x586a2f[_0xb992('0x5f')]({'model':db[_0xb992('0x63')],'as':'Account','attributes':['id',_0xb992('0x1e')]});_0x586a2f[_0xb992('0x5f')]({'model':db[_0xb992('0x5a')],'as':_0xb992('0x64'),'attributes':['id',_0xb992('0x5b')]});return db['WhatsappInteraction'][_0xb992('0x35')]({'where':{'id':_0x1c3d00[_0xb992('0x38')]['id']},'include':_0x586a2f})['then'](handleEntityNotFound(_0xe6d87c,null))[_0xb992('0x1b')](function(_0x1046c2){if(_0x1046c2){var _0x556fee=_0x1046c2[_0xb992('0x65')]({'plain':!![]});fs[_0xb992('0x66')](_0x3b2cc4);var _0x5d4ab3={'channel':_0xb992('0x67'),'account':_0x556fee['Account'][_0xb992('0x1e')],'agent':_0x556fee['Owner']?_0x556fee[_0xb992('0x64')][_0xb992('0x5b')]:_0xb992('0x68'),'createdAt':moment(_0x556fee[_0xb992('0x61')])['format'](_0xb992('0x4a'))['toString'](),'closedAt':_0x556fee[_0xb992('0x69')]?moment(_0x556fee['closedAt'])[_0xb992('0x49')](_0xb992('0x4a'))[_0xb992('0x6a')]():'','disposition':_0x556fee[_0xb992('0x6b')],'messages':_(_0x556fee[_0xb992('0x6c')])['filter']({'secret':![]})[_0xb992('0x20')](function(_0x1a16cc){if(_0x1a16cc[_0xb992('0x60')]){var _0x1bb056=path[_0xb992('0x57')](_0x32075b,_0x1a16cc['Attachment'][_0xb992('0x6d')]);if(fs['existsSync'](_0x1bb056)){fs[_0xb992('0x6e')](_0x1bb056)['pipe'](fs['createWriteStream'](path[_0xb992('0x57')](_0x3b2cc4,_0x1a16cc[_0xb992('0x60')][_0xb992('0x6d')])));}}return{'date':moment(_0x1a16cc[_0xb992('0x61')])[_0xb992('0x49')](_0xb992('0x4a'))[_0xb992('0x6a')](),'sender':_0x1a16cc[_0xb992('0x6f')]==='out'?_0x1a16cc['User']?_0x1a16cc[_0xb992('0x5a')][_0xb992('0x5b')]:_0xb992('0x70'):_0x1a16cc[_0xb992('0x71')][_0xb992('0x5d')]+(_0x1a16cc[_0xb992('0x71')]['lastName']?'\x20'+_0x1a16cc[_0xb992('0x71')][_0xb992('0x5e')]:''),'body':_0x1a16cc['Attachment']?_0x1a16cc[_0xb992('0x60')][_0xb992('0x6d')]:_0x1a16cc[_0xb992('0x37')],'direction':_0x1a16cc[_0xb992('0x6f')]==='out'?'A':'C','secret':_0x1a16cc[_0xb992('0x72')],'read':_0x1a16cc['read'],'attachment':_0x1a16cc[_0xb992('0x60')]};})[_0xb992('0x73')]()};return ejs[_0xb992('0x74')](path[_0xb992('0x57')](config[_0xb992('0x53')],_0xb992('0x54'),_0xb992('0x75'),_0xb992('0x76')),{'interaction':_0x5d4ab3})[_0xb992('0x1b')](function(_0x2d4aea){var _0x4c5ae8=path[_0xb992('0x57')](_0x3b2cc4,'transcript-'+_0x556fee['id']+'-'+_0x3dcc6f+_0xb992('0x77'));var _0xb8dd8d={'path':_0x4c5ae8,'channel':_0xb992('0x67'),'interactionId':_0x556fee['id']};return pdf['createPdfFromHTML'](_0x2d4aea,_0xb8dd8d);})['then'](function(){return new BPromise(function(_0x305c08,_0x27454c){zipdir(_0x3b2cc4,{'saveTo':_0x3eed2a},function(_0x57c7e8,_0x223d9c){if(_0x57c7e8)return _0x27454c(_0x57c7e8);return _0x305c08(_0x223d9c);});})['then'](function(){return new BPromise(function(_0x343cc1,_0x299b51){rimraf(_0x3b2cc4,function(_0x78a9f7){if(_0x78a9f7)_0x299b51(_0x78a9f7);return _0x343cc1();});});})[_0xb992('0x1b')](function(){return _0xe6d87c[_0xb992('0x51')](_0x3eed2a,_0x57423e,function(_0x46eb46){if(_0x46eb46){console['log'](_0xb992('0x78'),_0x46eb46);}else{fs[_0xb992('0x79')](_0x3eed2a);}});});});}else{return _0xe6d87c[_0xb992('0x10')](0xc8);}})['catch'](handleError(_0xe6d87c,null));};
\ No newline at end of file
+var _0x5e6c=['redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','rawAttributes','type','getOptions','findAll','whatsapp','query','user','catch','show','keys','WhatsappInteraction','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','getMessages','model','nolimit','order','sort','where','WhatsappInteractionId','filter','map','$gte','format','includeAll','rows','addTags','setTags','omit','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','lastName','renderFile','views','transcript-','.pdf','err','zip-dir','moment','util','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment'];(function(_0x15a969,_0x5c4524){var _0x4a436b=function(_0x1df796){while(--_0x1df796){_0x15a969['push'](_0x15a969['shift']());}};_0x4a436b(++_0x5c4524);}(_0x5e6c,0x1dc));var _0xc5e6=function(_0x668304,_0x5d4db8){_0x668304=_0x668304-0x0;var _0x539dac=_0x5e6c[_0x668304];return _0x539dac;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc5e6('0x0'));var moment=require(_0xc5e6('0x1'));var BPromise=require('bluebird');var util=require(_0xc5e6('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xc5e6('0x3'));var interaction=require(_0xc5e6('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc5e6('0x5'));var logger=require('../../config/logger')(_0xc5e6('0x6'));var config=require(_0xc5e6('0x7'));var db=require('../../mysqldb')['db'];config[_0xc5e6('0x8')]=_[_0xc5e6('0x9')](config[_0xc5e6('0x8')],{'host':_0xc5e6('0xa'),'port':0x18eb});var socket=require(_0xc5e6('0xb'))(new Redis(config[_0xc5e6('0x8')]));require(_0xc5e6('0xc'))['register'](socket);function respondWithStatusCode(_0x5e601a,_0x3f25f7){_0x3f25f7=_0x3f25f7||0xcc;return function(_0x5477be){if(_0x5477be){return _0x5e601a[_0xc5e6('0xd')](_0x3f25f7);}return _0x5e601a['status'](_0x3f25f7)['end']();};}function respondWithResult(_0x1fb6db,_0x4092f4){_0x4092f4=_0x4092f4||0xc8;return function(_0x2c0ab3){if(_0x2c0ab3){return _0x1fb6db[_0xc5e6('0xe')](_0x4092f4)[_0xc5e6('0xf')](_0x2c0ab3);}};}function respondWithFilteredResult(_0x210477,_0x3dd59e){return function(_0xb79fdf){if(_0xb79fdf){var _0x460814=typeof _0x3dd59e[_0xc5e6('0x10')]===_0xc5e6('0x11')&&typeof _0x3dd59e[_0xc5e6('0x12')]===_0xc5e6('0x11');var _0x16322e=_0xb79fdf[_0xc5e6('0x13')];var _0x1b967e=_0x460814?0x0:_0x3dd59e['offset'];var _0x139dbd=_0x460814?_0xb79fdf['count']:_0x3dd59e[_0xc5e6('0x10')]+_0x3dd59e[_0xc5e6('0x12')];var _0x315ac6;if(_0x139dbd>=_0x16322e){_0x139dbd=_0x16322e;_0x315ac6=0xc8;}else{_0x315ac6=0xce;}_0x210477[_0xc5e6('0xe')](_0x315ac6);return _0x210477[_0xc5e6('0x14')](_0xc5e6('0x15'),_0x1b967e+'-'+_0x139dbd+'/'+_0x16322e)[_0xc5e6('0xf')](_0xb79fdf);}return null;};}function saveUpdates(_0x497fcb){return function(_0x449505){if(_0x449505){return _0x449505[_0xc5e6('0x16')](_0x497fcb)[_0xc5e6('0x17')](function(_0x4b989a){return _0x4b989a;});}return null;};}function removeEntity(_0x7c0491){return function(_0xeb472b){if(_0xeb472b){return _0xeb472b[_0xc5e6('0x18')]()['then'](function(){_0x7c0491['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1750fd){return function(_0xfa66df){if(!_0xfa66df){_0x1750fd['sendStatus'](0x194);}return _0xfa66df;};}function handleError(_0x5af25d,_0x2141ab){_0x2141ab=_0x2141ab||0x1f4;return function(_0x204900){logger[_0xc5e6('0x19')](_0x204900[_0xc5e6('0x1a')]);if(_0x204900['name']){delete _0x204900[_0xc5e6('0x1b')];}_0x5af25d[_0xc5e6('0xe')](_0x2141ab)[_0xc5e6('0x1c')](_0x204900);};}exports[_0xc5e6('0x1d')]=function(_0xf1d750,_0x66acda){var _0x4307a1={};var _0x441b40=_['map'](db['WhatsappInteraction'][_0xc5e6('0x1e')],function(_0x48e82e){return{'name':_0x48e82e['fieldName'],'type':_0x48e82e[_0xc5e6('0x1f')]['key']};});_0x4307a1=qs[_0xc5e6('0x20')](_0x441b40,_0xf1d750);return interaction[_0xc5e6('0x21')](_0xc5e6('0x22'),_0xf1d750[_0xc5e6('0x23')],_0xf1d750[_0xc5e6('0x24')],_0x4307a1,_0x441b40)[_0xc5e6('0x17')](respondWithFilteredResult(_0x66acda,_0x4307a1))[_0xc5e6('0x25')](handleError(_0x66acda,null));};exports[_0xc5e6('0x26')]=function(_0x936e6f,_0x3864a9){var _0x5e995d={'raw':![],'where':{'id':_0x936e6f['params']['id']}},_0x23e574={};_0x23e574['model']=_[_0xc5e6('0x27')](db[_0xc5e6('0x28')][_0xc5e6('0x1e')]);_0x23e574[_0xc5e6('0x23')]=_[_0xc5e6('0x27')](_0x936e6f[_0xc5e6('0x23')]);_0x23e574[_0xc5e6('0x29')]=_[_0xc5e6('0x2a')](_0x23e574['model'],_0x23e574[_0xc5e6('0x23')]);_0x5e995d[_0xc5e6('0x2b')]=_['intersection'](_0x23e574['model'],qs['fields'](_0x936e6f[_0xc5e6('0x23')][_0xc5e6('0x2c')]));_0x5e995d[_0xc5e6('0x2b')]=_0x5e995d['attributes'][_0xc5e6('0x2d')]?_0x5e995d[_0xc5e6('0x2b')]:_0x23e574['model'];if(_0x936e6f[_0xc5e6('0x23')]['includeAll']){_0x5e995d[_0xc5e6('0x2e')]=[{'all':!![]}];}_0x5e995d=_[_0xc5e6('0x2f')]({},_0x5e995d,_0x936e6f[_0xc5e6('0x30')]);return db[_0xc5e6('0x28')][_0xc5e6('0x31')](_0x5e995d)['then'](handleEntityNotFound(_0x3864a9,null))[_0xc5e6('0x17')](respondWithResult(_0x3864a9,null))[_0xc5e6('0x25')](handleError(_0x3864a9,null));};exports[_0xc5e6('0x32')]=function(_0x163753,_0x949a96){return db['WhatsappInteraction'][_0xc5e6('0x32')](_0x163753[_0xc5e6('0x33')],{})[_0xc5e6('0x17')](respondWithResult(_0x949a96,0xc9))[_0xc5e6('0x25')](handleError(_0x949a96,null));};exports[_0xc5e6('0x16')]=function(_0xa63a42,_0x2b6f90){if(_0xa63a42[_0xc5e6('0x33')]['id']){delete _0xa63a42[_0xc5e6('0x33')]['id'];}return db[_0xc5e6('0x28')][_0xc5e6('0x31')]({'where':{'id':_0xa63a42[_0xc5e6('0x34')]['id']}})[_0xc5e6('0x17')](handleEntityNotFound(_0x2b6f90,null))[_0xc5e6('0x17')](saveUpdates(_0xa63a42[_0xc5e6('0x33')],null))['then'](respondWithResult(_0x2b6f90,null))[_0xc5e6('0x25')](handleError(_0x2b6f90,null));};exports[_0xc5e6('0x18')]=function(_0x2021e3,_0xe01d58){return db['WhatsappInteraction']['find']({'where':{'id':_0x2021e3[_0xc5e6('0x34')]['id']}})[_0xc5e6('0x17')](handleEntityNotFound(_0xe01d58,null))[_0xc5e6('0x17')](removeEntity(_0xe01d58,null))['catch'](handleError(_0xe01d58,null));};exports[_0xc5e6('0x35')]=function(_0x3c6cf7,_0x515a47){return db['WhatsappInteraction']['describe']()[_0xc5e6('0x17')](respondWithResult(_0x515a47,null))['catch'](handleError(_0x515a47,null));};exports[_0xc5e6('0x36')]=function(_0x187839,_0x5b73d5){return db[_0xc5e6('0x37')][_0xc5e6('0x31')]({'where':{'id':_0x187839['params']['id']}})[_0xc5e6('0x17')](handleEntityNotFound(_0x5b73d5,null))[_0xc5e6('0x17')](function(_0x272401){if(_0x272401){return _0x272401[_0xc5e6('0x36')](_0x187839[_0xc5e6('0x33')][_0xc5e6('0x38')],_['omit'](_0x187839['body'],['ids','id'])||{});}})[_0xc5e6('0x17')](respondWithResult(_0x5b73d5,null))[_0xc5e6('0x25')](handleError(_0x5b73d5,null));};exports[_0xc5e6('0x39')]=function(_0x30ccb2,_0x4d91c9){var _0x30fe2e={'raw':![],'where':{}};var _0x3e94a6={};var _0x9c0973={'count':0x0,'rows':[]};return db[_0xc5e6('0x28')]['findOne']({'where':{'id':_0x30ccb2[_0xc5e6('0x34')]['id']}})['then'](handleEntityNotFound(_0x4d91c9,null))[_0xc5e6('0x17')](function(_0x49b65a){if(_0x49b65a){_0x3e94a6['model']=_[_0xc5e6('0x27')](db['WhatsappMessage'][_0xc5e6('0x1e')]);_0x3e94a6['query']=_[_0xc5e6('0x27')](_0x30ccb2[_0xc5e6('0x23')]);_0x3e94a6[_0xc5e6('0x29')]=_[_0xc5e6('0x2a')](_0x3e94a6['model'],_0x3e94a6[_0xc5e6('0x23')]);_0x30fe2e[_0xc5e6('0x2b')]=_['intersection'](_0x3e94a6[_0xc5e6('0x3a')],qs[_0xc5e6('0x2c')](_0x30ccb2[_0xc5e6('0x23')][_0xc5e6('0x2c')]));_0x30fe2e['attributes']=_0x30fe2e[_0xc5e6('0x2b')]['length']?_0x30fe2e['attributes']:_0x3e94a6[_0xc5e6('0x3a')];if(!_0x30ccb2[_0xc5e6('0x23')]['hasOwnProperty'](_0xc5e6('0x3b'))){_0x30fe2e[_0xc5e6('0x12')]=qs['limit'](_0x30ccb2['query'][_0xc5e6('0x12')]);_0x30fe2e[_0xc5e6('0x10')]=qs['offset'](_0x30ccb2['query'][_0xc5e6('0x10')]);}_0x30fe2e[_0xc5e6('0x3c')]=qs[_0xc5e6('0x3d')](_0x30ccb2[_0xc5e6('0x23')]['sort']);_0x30fe2e[_0xc5e6('0x3e')]=qs[_0xc5e6('0x29')](_['pick'](_0x30ccb2[_0xc5e6('0x23')],_0x3e94a6[_0xc5e6('0x29')]));_0x30fe2e[_0xc5e6('0x3e')][_0xc5e6('0x3f')]=_0x49b65a['id'];if(_0x30ccb2[_0xc5e6('0x23')][_0xc5e6('0x40')]){_0x30fe2e[_0xc5e6('0x3e')]=_[_0xc5e6('0x2f')](_0x30fe2e[_0xc5e6('0x3e')],{'$or':_[_0xc5e6('0x41')](_0x30fe2e[_0xc5e6('0x2b')],function(_0xdedc5c){var _0x17953e={};_0x17953e[_0xdedc5c]={'$like':'%'+_0x30ccb2['query'][_0xc5e6('0x40')]+'%'};return _0x17953e;})});}if(_0x30ccb2[_0xc5e6('0x23')][_0xc5e6('0x42')]){var _0x3f065d=_0x30ccb2[_0xc5e6('0x23')][_0xc5e6('0x42')]['split'](',');var _0x5bc79a={};_0x5bc79a[_0x3f065d[0x0]]={'$gte':moment(_0x3f065d[0x1])[_0xc5e6('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30fe2e[_0xc5e6('0x3e')]=_[_0xc5e6('0x2f')](_0x30fe2e[_0xc5e6('0x3e')],_0x5bc79a);}_0x30fe2e=_[_0xc5e6('0x2f')]({},_0x30fe2e,_0x30ccb2[_0xc5e6('0x30')]);return db['WhatsappMessage'][_0xc5e6('0x13')]({'where':_0x30fe2e[_0xc5e6('0x3e')]})[_0xc5e6('0x17')](function(_0x7b2c0e){_0x9c0973['count']=_0x7b2c0e;if(_0x30ccb2[_0xc5e6('0x23')][_0xc5e6('0x44')]){_0x30fe2e[_0xc5e6('0x2e')]=[{'all':!![]}];}return db[_0xc5e6('0x37')][_0xc5e6('0x21')](_0x30fe2e);})[_0xc5e6('0x17')](function(_0x27c40b){_0x9c0973[_0xc5e6('0x45')]=_0x27c40b;return _0x9c0973;});}})[_0xc5e6('0x17')](respondWithFilteredResult(_0x4d91c9,_0x30fe2e))['catch'](handleError(_0x4d91c9,null));};exports[_0xc5e6('0x46')]=function(_0x3dd530,_0x5be004){return db[_0xc5e6('0x28')][_0xc5e6('0x31')]({'where':{'id':_0x3dd530['params']['id']}})[_0xc5e6('0x17')](handleEntityNotFound(_0x5be004,null))[_0xc5e6('0x17')](function(_0x499fa4){if(_0x499fa4){return _0x499fa4[_0xc5e6('0x47')](_0x3dd530[_0xc5e6('0x33')][_0xc5e6('0x38')],_[_0xc5e6('0x48')](_0x3dd530[_0xc5e6('0x33')],[_0xc5e6('0x38'),'id'])||{})[_0xc5e6('0x49')](function(){return db[_0xc5e6('0x4a')][_0xc5e6('0x21')]({'attributes':['id','name','color'],'where':{'id':_0x3dd530[_0xc5e6('0x33')][_0xc5e6('0x38')]}});})['then'](function(_0x4743f3){socket['emit'](_0xc5e6('0x4b'),{'id':Number(_0x3dd530[_0xc5e6('0x34')]['id']),'tags':_0x4743f3||[]});return{'id':Number(_0x3dd530['params']['id']),'tags':_0x4743f3||[]};});}})[_0xc5e6('0x17')](respondWithResult(_0x5be004,null))[_0xc5e6('0x25')](handleError(_0x5be004,null));};exports[_0xc5e6('0x4c')]=function(_0xa31db2,_0x1796db){return db[_0xc5e6('0x28')][_0xc5e6('0x31')]({'where':{'id':_0xa31db2[_0xc5e6('0x34')]['id']}})[_0xc5e6('0x17')](handleEntityNotFound(_0x1796db,null))['then'](function(_0x1bfa54){if(_0x1bfa54){return _0x1bfa54['removeTags'](_0xa31db2[_0xc5e6('0x23')]['ids']);}})[_0xc5e6('0x17')](respondWithStatusCode(_0x1796db,null))[_0xc5e6('0x25')](handleError(_0x1796db,null));};exports[_0xc5e6('0x4d')]=function(_0x2195ef,_0x5bc081){var _0x4b239b=moment()[_0xc5e6('0x4e')]()[_0xc5e6('0x4f')]();var _0x4cb3b6=path['join'](config[_0xc5e6('0x50')],_0xc5e6('0x51'),_0xc5e6('0x52'),_0xc5e6('0x53'));var _0x4a8fac=path['join'](config[_0xc5e6('0x50')],_0xc5e6('0x51'),_0xc5e6('0x52'),'attachments');var _0x228e58=path[_0xc5e6('0x54')](_0x4cb3b6,_0x4b239b);var _0x3b1266=util['format'](_0xc5e6('0x55'),_0x2195ef[_0xc5e6('0x34')]['id'],_0x4b239b);var _0x453773=path[_0xc5e6('0x54')](_0x4cb3b6,_0x3b1266);var _0x549c96=[];_0x549c96[_0xc5e6('0x56')]({'model':db[_0xc5e6('0x57')],'as':'User','attributes':['id',_0xc5e6('0x58')],'raw':!![]});_0x549c96[_0xc5e6('0x56')]({'model':db[_0xc5e6('0x59')],'as':_0xc5e6('0x5a'),'attributes':['id',_0xc5e6('0x5b'),'lastName'],'raw':!![]});if(_0x2195ef[_0xc5e6('0x23')][_0xc5e6('0x5c')]){_0x549c96[_0xc5e6('0x56')]({'model':db['Attachment'],'as':_0xc5e6('0x5d'),'raw':!![]});}var _0x329722=[{'model':db[_0xc5e6('0x37')],'as':_0xc5e6('0x5e'),'attributes':['id',_0xc5e6('0x33'),_0xc5e6('0x5f'),_0xc5e6('0x60'),_0xc5e6('0x61'),_0xc5e6('0x62')],'include':_0x549c96}];_0x329722[_0xc5e6('0x56')]({'model':db['WhatsappAccount'],'as':_0xc5e6('0x63'),'attributes':['id','name']});_0x329722['push']({'model':db[_0xc5e6('0x57')],'as':_0xc5e6('0x64'),'attributes':['id',_0xc5e6('0x58')]});return db[_0xc5e6('0x28')]['find']({'where':{'id':_0x2195ef[_0xc5e6('0x34')]['id']},'include':_0x329722})['then'](handleEntityNotFound(_0x5bc081,null))[_0xc5e6('0x17')](function(_0x5e7bfb){if(_0x5e7bfb){var _0x1cf7e8=_0x5e7bfb[_0xc5e6('0x65')]({'plain':!![]});fs['mkdirSync'](_0x228e58);var _0x2ec020={'channel':_0xc5e6('0x66'),'account':_0x1cf7e8[_0xc5e6('0x63')][_0xc5e6('0x1b')],'agent':_0x1cf7e8[_0xc5e6('0x64')]?_0x1cf7e8[_0xc5e6('0x64')][_0xc5e6('0x58')]:_0xc5e6('0x67'),'createdAt':moment(_0x1cf7e8[_0xc5e6('0x5f')])[_0xc5e6('0x43')](_0xc5e6('0x68'))[_0xc5e6('0x4f')](),'closedAt':_0x1cf7e8[_0xc5e6('0x69')]?moment(_0x1cf7e8[_0xc5e6('0x6a')])[_0xc5e6('0x43')](_0xc5e6('0x68'))[_0xc5e6('0x4f')]():'','disposition':_0x1cf7e8[_0xc5e6('0x6b')],'messages':_(_0x1cf7e8[_0xc5e6('0x5e')])[_0xc5e6('0x40')]({'secret':![]})['map'](function(_0x1a052f){if(_0x1a052f[_0xc5e6('0x5d')]){var _0x4cef44=path[_0xc5e6('0x54')](_0x4a8fac,_0x1a052f['Attachment']['basename']);if(fs[_0xc5e6('0x6c')](_0x4cef44)){fs[_0xc5e6('0x6d')](_0x4cef44)[_0xc5e6('0x6e')](fs[_0xc5e6('0x6f')](path[_0xc5e6('0x54')](_0x228e58,_0x1a052f[_0xc5e6('0x5d')][_0xc5e6('0x70')])));}}return{'date':moment(_0x1a052f[_0xc5e6('0x5f')])['format'](_0xc5e6('0x68'))[_0xc5e6('0x4f')](),'sender':_0x1a052f[_0xc5e6('0x60')]===_0xc5e6('0x71')?_0x1a052f[_0xc5e6('0x57')]?_0x1a052f['User'][_0xc5e6('0x58')]:_0xc5e6('0x72'):_0x1a052f['Contact'][_0xc5e6('0x5b')]+(_0x1a052f[_0xc5e6('0x5a')][_0xc5e6('0x73')]?'\x20'+_0x1a052f[_0xc5e6('0x5a')][_0xc5e6('0x73')]:''),'body':_0x1a052f[_0xc5e6('0x5d')]?_0x1a052f['Attachment'][_0xc5e6('0x70')]:_0x1a052f[_0xc5e6('0x33')],'direction':_0x1a052f[_0xc5e6('0x60')]===_0xc5e6('0x71')?'A':'C','secret':_0x1a052f[_0xc5e6('0x61')],'read':_0x1a052f[_0xc5e6('0x62')],'attachment':_0x1a052f[_0xc5e6('0x5d')]};})['value']()};return ejs[_0xc5e6('0x74')](path['join'](config[_0xc5e6('0x50')],'server',_0xc5e6('0x75'),'downloadInteraction.ejs'),{'interaction':_0x2ec020})[_0xc5e6('0x17')](function(_0x532cac){var _0x497093=path['join'](_0x228e58,_0xc5e6('0x76')+_0x1cf7e8['id']+'-'+_0x4b239b+_0xc5e6('0x77'));var _0x349f17={'path':_0x497093,'channel':_0xc5e6('0x66'),'interactionId':_0x1cf7e8['id']};return pdf['createPdfFromHTML'](_0x532cac,_0x349f17);})['then'](function(){return new BPromise(function(_0x17712f,_0x406b8f){zipdir(_0x228e58,{'saveTo':_0x453773},function(_0x3f266b,_0xd6adcb){if(_0x3f266b)return _0x406b8f(_0x3f266b);return _0x17712f(_0xd6adcb);});})['then'](function(){return new BPromise(function(_0x2cb568,_0x5293fb){rimraf(_0x228e58,function(_0x5736b8){if(_0x5736b8)_0x5293fb(_0x5736b8);return _0x2cb568();});});})['then'](function(){return _0x5bc081[_0xc5e6('0x4d')](_0x453773,_0x3b1266,function(_0x260ce9){if(_0x260ce9){console['log'](_0xc5e6('0x78'),_0x260ce9);}else{fs['unlinkSync'](_0x453773);}});});});}else{return _0x5bc081[_0xc5e6('0xd')](0xc8);}})[_0xc5e6('0x25')](handleError(_0x5bc081,null));};
\ No newline at end of file
index 1d7a3fa..4e33657 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ea9=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x15da95,_0x2a6b25){var _0x5cfdc5=function(_0x3c899e){while(--_0x3c899e){_0x15da95['push'](_0x15da95['shift']());}};_0x5cfdc5(++_0x2a6b25);}(_0x6ea9,0x89));var _0x96ea=function(_0xb1c8d7,_0x32d0de){_0xb1c8d7=_0xb1c8d7-0x0;var _0xbed63f=_0x6ea9[_0xb1c8d7];return _0xbed63f;};'use strict';var EventEmitter=require(_0x96ea('0x0'));var WhatsappInteraction=require(_0x96ea('0x1'))['db'][_0x96ea('0x2')];var WhatsappMessage=require(_0x96ea('0x1'))['db'][_0x96ea('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x96ea('0x4'),'afterUpdate':_0x96ea('0x5'),'afterDestroy':_0x96ea('0x6')};function emitEvent(_0x4de4d5){return function(_0xd6de64,_0x58e57e,_0x32cf31){_0xd6de64['getUsers']({'attributes':['id'],'raw':!![]})[_0x96ea('0x7')](function(_0x5da08c){_0xd6de64[_0x96ea('0x8')](_0x96ea('0x9'),_0x5da08c[_0x96ea('0xa')](function(_0x35e378){return{'id':_0x35e378['id']};}));return WhatsappMessage[_0x96ea('0xb')]({'where':{'WhatsappInteractionId':_0xd6de64['id'],'direction':'in','read':![]},'raw':!![]});})[_0x96ea('0x7')](function(_0x542e92){_0xd6de64[_0x96ea('0x8')](_0x96ea('0xc'),_0x542e92[_0x96ea('0xd')]);WhatsappInteractionEvents[_0x96ea('0xe')](_0x4de4d5+':'+_0xd6de64['id'],_0xd6de64);WhatsappInteractionEvents[_0x96ea('0xe')](_0x4de4d5,_0xd6de64);_0x32cf31(null);})[_0x96ea('0xf')](_0x32cf31(null));};}for(var e in events){if(events[_0x96ea('0x10')](e)){var event=events[e];WhatsappInteraction[_0x96ea('0x11')](e,emitEvent(event));}}module[_0x96ea('0x12')]=WhatsappInteractionEvents;
\ No newline at end of file
+var _0xbc4a=['exports','events','../../mysqldb','WhatsappInteraction','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x1cb28f,_0x1b57e5){var _0x20f09d=function(_0x3337bb){while(--_0x3337bb){_0x1cb28f['push'](_0x1cb28f['shift']());}};_0x20f09d(++_0x1b57e5);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x11f94b,_0x3cd97c){_0x11f94b=_0x11f94b-0x0;var _0x510982=_0xbc4a[_0x11f94b];return _0x510982;};'use strict';var EventEmitter=require(_0xabc4('0x0'));var WhatsappInteraction=require(_0xabc4('0x1'))['db'][_0xabc4('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xabc4('0x3')};function emitEvent(_0x4e84f9){return function(_0x437731,_0x430fdd,_0x282a1e){_0x437731[_0xabc4('0x4')]({'attributes':['id'],'raw':!![]})[_0xabc4('0x5')](function(_0x1a33c4){_0x437731[_0xabc4('0x6')](_0xabc4('0x7'),_0x1a33c4[_0xabc4('0x8')](function(_0xfd0e7d){return{'id':_0xfd0e7d['id']};}));return WhatsappMessage[_0xabc4('0x9')]({'where':{'WhatsappInteractionId':_0x437731['id'],'direction':'in','read':![]},'raw':!![]});})[_0xabc4('0x5')](function(_0x4067e1){_0x437731[_0xabc4('0x6')](_0xabc4('0xa'),_0x4067e1[_0xabc4('0xb')]);WhatsappInteractionEvents[_0xabc4('0xc')](_0x4e84f9+':'+_0x437731['id'],_0x437731);WhatsappInteractionEvents[_0xabc4('0xc')](_0x4e84f9,_0x437731);_0x282a1e(null);})[_0xabc4('0xd')](_0x282a1e(null));};}for(var e in events){if(events[_0xabc4('0xe')](e)){var event=events[e];WhatsappInteraction[_0xabc4('0xf')](e,emitEvent(event));}}module[_0xabc4('0x10')]=WhatsappInteractionEvents;
\ No newline at end of file
index 4c3506a..ff6fd59 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02d9=['./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x02d9,0x1d7));var _0x902d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x02d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x902d('0x0'));var util=require(_0x902d('0x1'));var logger=require(_0x902d('0x2'))('api');var moment=require(_0x902d('0x3'));var BPromise=require(_0x902d('0x4'));var rp=require(_0x902d('0x5'));var fs=require('fs');var path=require(_0x902d('0x6'));var rimraf=require(_0x902d('0x7'));var config=require(_0x902d('0x8'));var attributes=require(_0x902d('0x9'));module['exports']=function(_0x401222,_0x4e13ad){return _0x401222[_0x902d('0xa')](_0x902d('0xb'),attributes,{'tableName':_0x902d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e459f,_0x33bf54,_0x10bab4){if(_0x4e459f['changed']('closed')){_0x4e459f[_0x902d('0xd')]=moment()[_0x902d('0xe')](_0x902d('0xf'));}_0x10bab4(null,_0x4e459f);}}});};
\ No newline at end of file
+var _0x7d7f=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x5e822f,_0x19b0c9){var _0x36a088=function(_0x669ec0){while(--_0x669ec0){_0x5e822f['push'](_0x5e822f['shift']());}};_0x36a088(++_0x19b0c9);}(_0x7d7f,0x1c3));var _0xf7d7=function(_0x57acd3,_0x1d3fc3){_0x57acd3=_0x57acd3-0x0;var _0x3ece77=_0x7d7f[_0x57acd3];return _0x3ece77;};'use strict';var _=require(_0xf7d7('0x0'));var util=require(_0xf7d7('0x1'));var logger=require(_0xf7d7('0x2'))('api');var moment=require(_0xf7d7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7d7('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7d7('0x6'));module[_0xf7d7('0x7')]=function(_0x54887e,_0x562184){return _0x54887e[_0xf7d7('0x8')](_0xf7d7('0x9'),attributes,{'tableName':_0xf7d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22d1b6,_0x284319,_0x5e4c42){if(_0x22d1b6['changed']('closed')){_0x22d1b6[_0xf7d7('0xb')]=moment()[_0xf7d7('0xc')](_0xf7d7('0xd'));}_0x5e4c42(null,_0x22d1b6);}}});};
\ No newline at end of file
index f5117ec..4ef71c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a15=['socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','body','where','options','attributes','limit','UpdateWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x29e3e8,_0x387854){var _0x4007bd=function(_0x48a2e8){while(--_0x48a2e8){_0x29e3e8['push'](_0x29e3e8['shift']());}};_0x4007bd(++_0x387854);}(_0x6a15,0x93));var _0x56a1=function(_0xf5fbed,_0x3ac172){_0xf5fbed=_0xf5fbed-0x0;var _0x1f35a8=_0x6a15[_0xf5fbed];return _0x1f35a8;};'use strict';var _=require(_0x56a1('0x0'));var util=require(_0x56a1('0x1'));var moment=require('moment');var BPromise=require(_0x56a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56a1('0x3'))['db'];var utils=require(_0x56a1('0x4'));var logger=require(_0x56a1('0x5'))(_0x56a1('0x6'));var config=require(_0x56a1('0x7'));var jayson=require(_0x56a1('0x8'));var client=jayson[_0x56a1('0x9')]['http']({'port':0x232a});config[_0x56a1('0xa')]=_[_0x56a1('0xb')](config[_0x56a1('0xa')],{'host':_0x56a1('0xc'),'port':0x18eb});var socket=require(_0x56a1('0xd'))(new Redis(config[_0x56a1('0xa')]));require(_0x56a1('0xe'))[_0x56a1('0xf')](socket);function respondWithRpcPromise(_0x26384a,_0x1ac780,_0x3d6d09){return new BPromise(function(_0x409c8c,_0x30512b){return client[_0x56a1('0x10')](_0x26384a,_0x3d6d09)[_0x56a1('0x11')](function(_0x4d6e8e){logger[_0x56a1('0x12')](_0x56a1('0x13'),_0x1ac780,'request\x20sent');logger[_0x56a1('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1ac780,_0x56a1('0x15'),JSON['stringify'](_0x4d6e8e));if(_0x4d6e8e[_0x56a1('0x16')]){if(_0x4d6e8e[_0x56a1('0x16')][_0x56a1('0x17')]===0x1f4){logger[_0x56a1('0x16')](_0x56a1('0x13'),_0x1ac780,_0x4d6e8e[_0x56a1('0x16')]['message']);return _0x30512b(_0x4d6e8e[_0x56a1('0x16')][_0x56a1('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x1ac780,_0x4d6e8e[_0x56a1('0x16')][_0x56a1('0x18')]);return _0x409c8c(_0x4d6e8e[_0x56a1('0x16')]['message']);}else{logger['info'](_0x56a1('0x13'),_0x1ac780,'request\x20sent');_0x409c8c(_0x4d6e8e[_0x56a1('0x19')][_0x56a1('0x18')]);}})[_0x56a1('0x1a')](function(_0x502c7b){logger[_0x56a1('0x16')](_0x56a1('0x13'),_0x1ac780,_0x502c7b);_0x30512b(_0x502c7b);});});}exports['UpdateWhatsappInteraction']=function(_0x26ef1f){var _0x1cfd23=this;return new Promise(function(_0x170e54,_0x2b3346){return db['WhatsappInteraction']['update'](_0x26ef1f[_0x56a1('0x1b')],{'raw':_0x26ef1f['options']?_0x26ef1f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26ef1f['options']?_0x26ef1f['options'][_0x56a1('0x1c')]||null:null,'attributes':_0x26ef1f[_0x56a1('0x1d')]?_0x26ef1f[_0x56a1('0x1d')][_0x56a1('0x1e')]||null:null,'limit':_0x26ef1f['options']?_0x26ef1f['options'][_0x56a1('0x1f')]||null:null})[_0x56a1('0x11')](function(_0x3f7cd5){logger[_0x56a1('0x12')](_0x56a1('0x20'),_0x26ef1f);logger['debug']('UpdateWhatsappInteraction',_0x26ef1f,JSON['stringify'](_0x3f7cd5));_0x170e54(_0x3f7cd5);})['catch'](function(_0x426941){logger[_0x56a1('0x16')](_0x56a1('0x20'),_0x426941[_0x56a1('0x18')],_0x26ef1f);_0x2b3346(_0x1cfd23[_0x56a1('0x16')](0x1f4,_0x426941[_0x56a1('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5e7482){return new Promise(function(_0x427cf5,_0x5a6979){return db[_0x56a1('0x21')][_0x56a1('0x22')]({'where':_0x5e7482['options']?_0x5e7482[_0x56a1('0x1d')][_0x56a1('0x1c')]||null:null})[_0x56a1('0x11')](function(_0x636bbb){if(_0x636bbb){return _0x636bbb[_0x56a1('0x23')](_0x5e7482[_0x56a1('0x1b')][_0x56a1('0x24')],_[_0x56a1('0x25')](_0x5e7482[_0x56a1('0x1b')],[_0x56a1('0x24'),'id'])||{});}})[_0x56a1('0x26')](function(_0x52cfb4){logger['info'](_0x56a1('0x27'),_0x5e7482);logger[_0x56a1('0x14')](_0x56a1('0x27'),_0x5e7482,JSON['stringify'](_0x52cfb4));_0x427cf5(_0x52cfb4);})[_0x56a1('0x1a')](function(_0x43acad){logger[_0x56a1('0x16')](_0x56a1('0x27'),_0x43acad[_0x56a1('0x18')],_0x5e7482);_0x5a6979(_this['error'](0x1f4,_0x43acad[_0x56a1('0x18')]));});});};
\ No newline at end of file
+var _0x60d0=['options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./whatsappInteraction.socket','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x60d0,0xfc));var _0x060d=function(_0x125c7f,_0x510486){_0x125c7f=_0x125c7f-0x0;var _0x3f9ce3=_0x60d0[_0x125c7f];return _0x3f9ce3;};'use strict';var _=require(_0x060d('0x0'));var util=require(_0x060d('0x1'));var moment=require('moment');var BPromise=require(_0x060d('0x2'));var rs=require(_0x060d('0x3'));var fs=require('fs');var Redis=require(_0x060d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x060d('0x5'));var logger=require(_0x060d('0x6'))(_0x060d('0x7'));var config=require('../../config/environment');var jayson=require(_0x060d('0x8'));var client=jayson[_0x060d('0x9')]['http']({'port':0x232a});config[_0x060d('0xa')]=_['defaults'](config[_0x060d('0xa')],{'host':_0x060d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x060d('0xa')]));require(_0x060d('0xc'))['register'](socket);function respondWithRpcPromise(_0x407cca,_0x144e50,_0x28c0d1){return new BPromise(function(_0x51488d,_0x5bfc1a){return client['request'](_0x407cca,_0x28c0d1)['then'](function(_0x140888){logger['info'](_0x060d('0xd'),_0x144e50,'request\x20sent');logger[_0x060d('0xe')](_0x060d('0xf'),_0x144e50,_0x060d('0x10'),JSON[_0x060d('0x11')](_0x140888));if(_0x140888['error']){if(_0x140888['error'][_0x060d('0x12')]===0x1f4){logger[_0x060d('0x13')](_0x060d('0xd'),_0x144e50,_0x140888['error'][_0x060d('0x14')]);return _0x5bfc1a(_0x140888['error']['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x144e50,_0x140888[_0x060d('0x13')][_0x060d('0x14')]);return _0x51488d(_0x140888[_0x060d('0x13')][_0x060d('0x14')]);}else{logger[_0x060d('0x15')](_0x060d('0xd'),_0x144e50,_0x060d('0x10'));_0x51488d(_0x140888[_0x060d('0x16')][_0x060d('0x14')]);}})[_0x060d('0x17')](function(_0x4ee81d){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x144e50,_0x4ee81d);_0x5bfc1a(_0x4ee81d);});});}exports[_0x060d('0x18')]=function(_0xcd1540){var _0xbb25ca=this;return new Promise(function(_0x523eac,_0x2c5d67){return db[_0x060d('0x19')][_0x060d('0x1a')](_0xcd1540[_0x060d('0x1b')],{'raw':_0xcd1540[_0x060d('0x1c')]?_0xcd1540['options'][_0x060d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd1540[_0x060d('0x1c')]?_0xcd1540[_0x060d('0x1c')][_0x060d('0x1e')]||null:null,'attributes':_0xcd1540[_0x060d('0x1c')]?_0xcd1540[_0x060d('0x1c')][_0x060d('0x1f')]||null:null,'limit':_0xcd1540[_0x060d('0x1c')]?_0xcd1540['options'][_0x060d('0x20')]||null:null})[_0x060d('0x21')](function(_0x55541b){logger[_0x060d('0x15')](_0x060d('0x18'),_0xcd1540);logger['debug'](_0x060d('0x18'),_0xcd1540,JSON[_0x060d('0x11')](_0x55541b));_0x523eac(_0x55541b);})['catch'](function(_0x12be91){logger[_0x060d('0x13')](_0x060d('0x18'),_0x12be91['message'],_0xcd1540);_0x2c5d67(_0xbb25ca['error'](0x1f4,_0x12be91[_0x060d('0x14')]));});});};exports[_0x060d('0x22')]=function(_0x2c6b26){return new Promise(function(_0x1ceda6,_0x1a689e){return db[_0x060d('0x19')]['find']({'where':_0x2c6b26[_0x060d('0x1c')]?_0x2c6b26[_0x060d('0x1c')][_0x060d('0x1e')]||null:null})['then'](function(_0x220366){if(_0x220366){return _0x220366[_0x060d('0x23')](_0x2c6b26[_0x060d('0x1b')][_0x060d('0x24')],_[_0x060d('0x25')](_0x2c6b26['body'],[_0x060d('0x24'),'id'])||{});}})[_0x060d('0x26')](function(_0x238e04){logger['info'](_0x060d('0x27'),_0x2c6b26);logger['debug'](_0x060d('0x27'),_0x2c6b26,JSON[_0x060d('0x11')](_0x238e04));_0x1ceda6(_0x238e04);})['catch'](function(_0x1a85f1){logger['error']('AddTags',_0x1a85f1[_0x060d('0x14')],_0x2c6b26);_0x1a689e(_this[_0x060d('0x13')](0x1f4,_0x1a85f1[_0x060d('0x14')]));});});};
\ No newline at end of file
index a8abc8e..c4cc53d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfaf=['register','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbfaf,0x158));var _0xfbfa=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0xbfaf[_0x4afac5];return _0x2404b3;};'use strict';var WhatsappInteractionEvents=require(_0xfbfa('0x0'));var events=[_0xfbfa('0x1'),_0xfbfa('0x2'),_0xfbfa('0x3')];function createListener(_0x54dbd4,_0x5e1809){return function(_0x5c4f37){_0x5e1809[_0xfbfa('0x4')](_0x54dbd4,_0x5c4f37);};}function removeListener(_0x5b1e99,_0x240608){return function(){WhatsappInteractionEvents[_0xfbfa('0x5')](_0x5b1e99,_0x240608);};}exports[_0xfbfa('0x6')]=function(_0x433b48){for(var _0x5b0db2=0x0,_0x2f6513=events['length'];_0x5b0db2<_0x2f6513;_0x5b0db2++){var _0x5dc9d7=events[_0x5b0db2];var _0x46d3b3=createListener('whatsappInteraction:'+_0x5dc9d7,_0x433b48);WhatsappInteractionEvents['on'](_0x5dc9d7,_0x46d3b3);}};
\ No newline at end of file
+var _0x1534=['./whatsappInteraction.events','save','update','emit','register','whatsappInteraction:'];(function(_0x41e49b,_0x519acd){var _0x510252=function(_0x2ccbbd){while(--_0x2ccbbd){_0x41e49b['push'](_0x41e49b['shift']());}};_0x510252(++_0x519acd);}(_0x1534,0xd2));var _0x4153=function(_0x23e63d,_0x51def3){_0x23e63d=_0x23e63d-0x0;var _0x1caa61=_0x1534[_0x23e63d];return _0x1caa61;};'use strict';var WhatsappInteractionEvents=require(_0x4153('0x0'));var events=[_0x4153('0x1'),'remove',_0x4153('0x2')];function createListener(_0x44c20b,_0x3715d2){return function(_0x344544){_0x3715d2[_0x4153('0x3')](_0x44c20b,_0x344544);};}function removeListener(_0x14a109,_0x3f7d99){return function(){WhatsappInteractionEvents['removeListener'](_0x14a109,_0x3f7d99);};}exports[_0x4153('0x4')]=function(_0x59f90c){for(var _0x1d0c2c=0x0,_0x446b36=events['length'];_0x1d0c2c<_0x446b36;_0x1d0c2c++){var _0x1383f2=events[_0x1d0c2c];var _0x5a1b03=createListener(_0x4153('0x5')+_0x1383f2,_0x59f90c);WhatsappInteractionEvents['on'](_0x1383f2,_0x5a1b03);}};
\ No newline at end of file
index a7c7ece..42b08d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb19f=['/:id','show','post','tracked','whatsappmessage:create','create','status','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x13ade2,_0x340806){var _0x737169=function(_0x2b5eee){while(--_0x2b5eee){_0x13ade2['push'](_0x13ade2['shift']());}};_0x737169(++_0x340806);}(_0xb19f,0xdd));var _0xfb19=function(_0x253804,_0x4101e2){_0x253804=_0x253804-0x0;var _0x26cb31=_0xb19f[_0x253804];return _0x26cb31;};'use strict';var multer=require(_0xfb19('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfb19('0x1'));var express=require(_0xfb19('0x2'));var router=express['Router']();var fs_extra=require(_0xfb19('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfb19('0x4'));var controller=require('./whatsappMessage.controller');router[_0xfb19('0x5')]('/',auth[_0xfb19('0x6')](),controller[_0xfb19('0x7')]);router[_0xfb19('0x5')](_0xfb19('0x8'),auth[_0xfb19('0x6')](),controller['describe']);router[_0xfb19('0x5')](_0xfb19('0x9'),auth[_0xfb19('0x6')](),controller[_0xfb19('0xa')]);router[_0xfb19('0xb')]('/',auth[_0xfb19('0x6')](),interaction[_0xfb19('0xc')]('whatsapp',_0xfb19('0xd')),controller[_0xfb19('0xe')]);router[_0xfb19('0xb')]('/:id/status',controller[_0xfb19('0xf')]);router[_0xfb19('0x10')](_0xfb19('0x9'),auth[_0xfb19('0x6')](),controller['update']);router['put'](_0xfb19('0x11'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfb19('0x12'),auth['isAuthenticated'](),controller[_0xfb19('0x13')]);router[_0xfb19('0x14')](_0xfb19('0x9'),auth[_0xfb19('0x6')](),controller[_0xfb19('0x15')]);module[_0xfb19('0x16')]=router;
\ No newline at end of file
+var _0x65ca=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsappmessage:create','create','status','put','accept','reject'];(function(_0x2ed92f,_0x54091f){var _0x26ff04=function(_0x5ed317){while(--_0x5ed317){_0x2ed92f['push'](_0x2ed92f['shift']());}};_0x26ff04(++_0x54091f);}(_0x65ca,0x199));var _0xa65c=function(_0x504f4c,_0x1aedf0){_0x504f4c=_0x504f4c-0x0;var _0x3e7570=_0x65ca[_0x504f4c];return _0x3e7570;};'use strict';var multer=require(_0xa65c('0x0'));var util=require(_0xa65c('0x1'));var path=require(_0xa65c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa65c('0x3'));var router=express[_0xa65c('0x4')]();var fs_extra=require(_0xa65c('0x5'));var auth=require(_0xa65c('0x6'));var interaction=require(_0xa65c('0x7'));var config=require('../../config/environment');var controller=require(_0xa65c('0x8'));router[_0xa65c('0x9')]('/',auth[_0xa65c('0xa')](),controller[_0xa65c('0xb')]);router[_0xa65c('0x9')](_0xa65c('0xc'),auth[_0xa65c('0xa')](),controller[_0xa65c('0xd')]);router[_0xa65c('0x9')](_0xa65c('0xe'),auth[_0xa65c('0xa')](),controller['show']);router[_0xa65c('0xf')]('/',auth[_0xa65c('0xa')](),interaction[_0xa65c('0x10')]('whatsapp',_0xa65c('0x11')),controller[_0xa65c('0x12')]);router['post']('/:id/status',controller[_0xa65c('0x13')]);router[_0xa65c('0x14')]('/:id',auth[_0xa65c('0xa')](),controller['update']);router[_0xa65c('0x14')]('/:id/accept',auth[_0xa65c('0xa')](),controller[_0xa65c('0x15')]);router[_0xa65c('0x14')]('/:id/reject',auth[_0xa65c('0xa')](),controller[_0xa65c('0x16')]);router['delete'](_0xa65c('0xe'),auth[_0xa65c('0xa')](),controller['destroy']);module[_0xa65c('0x17')]=router;
\ No newline at end of file
index ae5170b..53b9736 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cee=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x227745,_0x171942){var _0x4c4a55=function(_0x361c82){while(--_0x361c82){_0x227745['push'](_0x227745['shift']());}};_0x4c4a55(++_0x171942);}(_0x0cee,0x113));var _0xe0ce=function(_0x48ce65,_0x1957fe){_0x48ce65=_0x48ce65-0x0;var _0x3a0e1c=_0x0cee[_0x48ce65];return _0x3a0e1c;};'use strict';var Sequelize=require(_0xe0ce('0x0'));module[_0xe0ce('0x1')]={'body':{'type':Sequelize[_0xe0ce('0x2')](_0xe0ce('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe0ce('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe0ce('0x5')]('in',_0xe0ce('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe0ce('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe0ce('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe0ce('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe0ce('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0x7a2d=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x4a77d7,_0xa87f48){var _0x33450a=function(_0x15fa21){while(--_0x15fa21){_0x4a77d7['push'](_0x4a77d7['shift']());}};_0x33450a(++_0xa87f48);}(_0x7a2d,0x142));var _0xd7a2=function(_0x316b0b,_0x5063ce){_0x316b0b=_0x316b0b-0x0;var _0x3592d7=_0x7a2d[_0x316b0b];return _0x3592d7;};'use strict';var Sequelize=require(_0xd7a2('0x0'));module[_0xd7a2('0x1')]={'body':{'type':Sequelize[_0xd7a2('0x2')](_0xd7a2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd7a2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd7a2('0x5')]('in',_0xd7a2('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd7a2('0x7')]},'readAt':{'type':Sequelize[_0xd7a2('0x8')]},'secret':{'type':Sequelize[_0xd7a2('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd7a2('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index d994665..e8146db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7668=['rawAttributes','intersection','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','../../config/logger','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','code','error','message','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','WhatsappMessage','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7668,0x1e9));var _0x8766=function(_0x111d8b,_0x3f356f){_0x111d8b=_0x111d8b-0x0;var _0x56656c=_0x7668[_0x111d8b];return _0x56656c;};'use strict';var emlformat=require(_0x8766('0x0'));var rimraf=require(_0x8766('0x1'));var zipdir=require(_0x8766('0x2'));var jsonpatch=require(_0x8766('0x3'));var rp=require(_0x8766('0x4'));var moment=require(_0x8766('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8766('0x6'));var util=require(_0x8766('0x7'));var path=require(_0x8766('0x8'));var sox=require('sox');var csv=require(_0x8766('0x9'));var ejs=require(_0x8766('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8766('0xb'));var jsforce=require(_0x8766('0xc'));var deskjs=require(_0x8766('0xd'));var toCsv=require(_0x8766('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8766('0xe'));var authService=require(_0x8766('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8766('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x8766('0x11'));var config=require(_0x8766('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8766('0x13'))['db'];config['redis']=_[_0x8766('0x14')](config[_0x8766('0x15')],{'host':_0x8766('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8766('0x15')]));require(_0x8766('0x17'))[_0x8766('0x18')](socket);var jayson=require(_0x8766('0x19'));var client=jayson[_0x8766('0x1a')][_0x8766('0x1b')]({'port':0x232c});var client9002=jayson[_0x8766('0x1a')][_0x8766('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x133897,_0x1c4161,_0x447699,_0x635f4){return new BPromise(function(_0x4102f0,_0x4162d8){var _0x4d6f66=_0x635f4||client;return _0x4d6f66[_0x8766('0x1c')](_0x133897,_0x447699)[_0x8766('0x1d')](function(_0x4a607a){logger[_0x8766('0x1e')](_0x8766('0x1f'),_0x1c4161,_0x8766('0x20'));logger[_0x8766('0x21')](_0x8766('0x22'),_0x1c4161,_0x8766('0x20'),JSON['stringify'](_0x4a607a));if(_0x4a607a['error']){if(_0x4a607a['error'][_0x8766('0x23')]===0x1f4){logger[_0x8766('0x24')](_0x8766('0x1f'),_0x1c4161,_0x4a607a[_0x8766('0x24')][_0x8766('0x25')]);return _0x4162d8(_0x4a607a['error'][_0x8766('0x25')]);}logger['error'](_0x8766('0x1f'),_0x1c4161,_0x4a607a[_0x8766('0x24')][_0x8766('0x25')]);return _0x4102f0(_0x4a607a[_0x8766('0x24')]['message']);}else{logger[_0x8766('0x1e')](_0x8766('0x1f'),_0x1c4161,'request\x20sent');_0x4102f0(_0x4a607a['result'][_0x8766('0x25')]);}})['catch'](function(_0x1897c8){logger[_0x8766('0x24')](_0x8766('0x1f'),_0x1c4161,_0x1897c8);_0x4162d8(_0x1897c8);});});}function respondWithStatusCode(_0x357cc6,_0x7fd506){_0x7fd506=_0x7fd506||0xcc;return function(_0x45fe12){if(_0x45fe12){return _0x357cc6[_0x8766('0x26')](_0x7fd506);}return _0x357cc6[_0x8766('0x27')](_0x7fd506)[_0x8766('0x28')]();};}function respondWithResult(_0x16d686,_0xc2587e){_0xc2587e=_0xc2587e||0xc8;return function(_0x483db8){if(_0x483db8){return _0x16d686[_0x8766('0x27')](_0xc2587e)['json'](_0x483db8);}};}function respondWithFilteredResult(_0x502b94,_0x576551){return function(_0x507f62){if(_0x507f62){var _0x4d8720=typeof _0x576551[_0x8766('0x29')]===_0x8766('0x2a')&&typeof _0x576551[_0x8766('0x2b')]==='undefined';var _0x3487ab=_0x507f62[_0x8766('0x2c')];var _0xf1634b=_0x4d8720?0x0:_0x576551[_0x8766('0x29')];var _0xb85dca=_0x4d8720?_0x507f62[_0x8766('0x2c')]:_0x576551[_0x8766('0x29')]+_0x576551[_0x8766('0x2b')];var _0x11997a;if(_0xb85dca>=_0x3487ab){_0xb85dca=_0x3487ab;_0x11997a=0xc8;}else{_0x11997a=0xce;}_0x502b94[_0x8766('0x27')](_0x11997a);return _0x502b94[_0x8766('0x2d')](_0x8766('0x2e'),_0xf1634b+'-'+_0xb85dca+'/'+_0x3487ab)[_0x8766('0x2f')](_0x507f62);}return null;};}function patchUpdates(_0x299499){return function(_0xa0319d){try{jsonpatch[_0x8766('0x30')](_0xa0319d,_0x299499,!![]);}catch(_0x11f9ec){return BPromise[_0x8766('0x31')](_0x11f9ec);}return _0xa0319d[_0x8766('0x32')]();};}function saveUpdates(_0xc2eaed,_0x13ef88){return function(_0x34248d){if(_0x34248d){return _0x34248d['update'](_0xc2eaed)[_0x8766('0x1d')](function(_0x49addb){return _0x49addb;});}return null;};}function removeEntity(_0x21e738,_0x4c2314){return function(_0x4f8e08){if(_0x4f8e08){return _0x4f8e08[_0x8766('0x33')]()[_0x8766('0x1d')](function(){_0x21e738[_0x8766('0x27')](0xcc)[_0x8766('0x28')]();});}};}function handleEntityNotFound(_0x421e34,_0x38a6cc){return function(_0x3ae6ee){if(!_0x3ae6ee){_0x421e34['sendStatus'](0x194);}return _0x3ae6ee;};}function handleError(_0x397c64,_0x3a4157){_0x3a4157=_0x3a4157||0x1f4;return function(_0x6330b){logger['error'](_0x6330b[_0x8766('0x34')]);if(_0x6330b[_0x8766('0x35')]){delete _0x6330b['name'];}_0x397c64[_0x8766('0x27')](_0x3a4157)[_0x8766('0x36')](_0x6330b);};}exports[_0x8766('0x37')]=function(_0x37fe09,_0x16fc56){var _0x48b072={},_0x5019ed={},_0x51d329={'count':0x0,'rows':[]};var _0x200f2e=_['map'](db[_0x8766('0x38')]['rawAttributes'],function(_0x3bc94f){return{'name':_0x3bc94f['fieldName'],'type':_0x3bc94f[_0x8766('0x39')][_0x8766('0x3a')]};});_0x5019ed[_0x8766('0x3b')]=_[_0x8766('0x3c')](_0x200f2e,_0x8766('0x35'));_0x5019ed['query']=_[_0x8766('0x3d')](_0x37fe09[_0x8766('0x3e')]);_0x5019ed['filters']=_['intersection'](_0x5019ed[_0x8766('0x3b')],_0x5019ed[_0x8766('0x3e')]);_0x48b072[_0x8766('0x3f')]=_['intersection'](_0x5019ed[_0x8766('0x3b')],qs[_0x8766('0x40')](_0x37fe09['query'][_0x8766('0x40')]));_0x48b072[_0x8766('0x3f')]=_0x48b072[_0x8766('0x3f')][_0x8766('0x41')]?_0x48b072[_0x8766('0x3f')]:_0x5019ed[_0x8766('0x3b')];if(!_0x37fe09[_0x8766('0x3e')][_0x8766('0x42')](_0x8766('0x43'))){_0x48b072[_0x8766('0x2b')]=qs[_0x8766('0x2b')](_0x37fe09[_0x8766('0x3e')]['limit']);_0x48b072[_0x8766('0x29')]=qs[_0x8766('0x29')](_0x37fe09['query']['offset']);}_0x48b072[_0x8766('0x44')]=qs[_0x8766('0x45')](_0x37fe09['query']['sort']);_0x48b072[_0x8766('0x46')]=qs[_0x8766('0x47')](_[_0x8766('0x48')](_0x37fe09[_0x8766('0x3e')],_0x5019ed[_0x8766('0x47')]),_0x200f2e);if(_0x37fe09['query']['filter']){_0x48b072[_0x8766('0x46')]=_[_0x8766('0x49')](_0x48b072[_0x8766('0x46')],{'$or':_[_0x8766('0x3c')](_0x200f2e,function(_0x37a704){if(_0x37a704[_0x8766('0x39')]!==_0x8766('0x4a')){var _0x538d39={};_0x538d39[_0x37a704[_0x8766('0x35')]]={'$like':'%'+_0x37fe09['query'][_0x8766('0x4b')]+'%'};return _0x538d39;}})});}_0x48b072=_[_0x8766('0x49')]({},_0x48b072,_0x37fe09[_0x8766('0x4c')]);var _0x8ab4={'where':_0x48b072['where']};return db[_0x8766('0x38')][_0x8766('0x2c')](_0x8ab4)['then'](function(_0x14dc6d){_0x51d329[_0x8766('0x2c')]=_0x14dc6d;if(_0x37fe09[_0x8766('0x3e')][_0x8766('0x4d')]){_0x48b072[_0x8766('0x4e')]=[{'all':!![]}];}return db[_0x8766('0x38')][_0x8766('0x4f')](_0x48b072);})['then'](function(_0x418b29){_0x51d329[_0x8766('0x50')]=_0x418b29;return _0x51d329;})[_0x8766('0x1d')](respondWithFilteredResult(_0x16fc56,_0x48b072))[_0x8766('0x51')](handleError(_0x16fc56,null));};exports['show']=function(_0x521f2a,_0x35fcee){var _0x4bb1d7={'raw':!![],'where':{'id':_0x521f2a[_0x8766('0x52')]['id']}},_0x135c7d={};_0x135c7d[_0x8766('0x3b')]=_[_0x8766('0x3d')](db['WhatsappMessage'][_0x8766('0x53')]);_0x135c7d[_0x8766('0x3e')]=_[_0x8766('0x3d')](_0x521f2a[_0x8766('0x3e')]);_0x135c7d['filters']=_[_0x8766('0x54')](_0x135c7d[_0x8766('0x3b')],_0x135c7d[_0x8766('0x3e')]);_0x4bb1d7[_0x8766('0x3f')]=_['intersection'](_0x135c7d['model'],qs[_0x8766('0x40')](_0x521f2a[_0x8766('0x3e')][_0x8766('0x40')]));_0x4bb1d7[_0x8766('0x3f')]=_0x4bb1d7[_0x8766('0x3f')]['length']?_0x4bb1d7[_0x8766('0x3f')]:_0x135c7d[_0x8766('0x3b')];if(_0x521f2a[_0x8766('0x3e')]['includeAll']){_0x4bb1d7[_0x8766('0x4e')]=[{'all':!![]}];}_0x4bb1d7=_[_0x8766('0x49')]({},_0x4bb1d7,_0x521f2a[_0x8766('0x4c')]);return db[_0x8766('0x38')][_0x8766('0x55')](_0x4bb1d7)['then'](handleEntityNotFound(_0x35fcee,null))[_0x8766('0x1d')](respondWithResult(_0x35fcee,null))['catch'](handleError(_0x35fcee,null));};exports['create']=function(_0x22b09b,_0x3bcd25){return db[_0x8766('0x38')][_0x8766('0x56')](_0x22b09b[_0x8766('0x57')],{})[_0x8766('0x1d')](respondWithResult(_0x3bcd25,0xc9))['catch'](handleError(_0x3bcd25,null));};exports[_0x8766('0x58')]=function(_0x2bd111,_0x127442){if(_0x2bd111[_0x8766('0x57')]['id']){delete _0x2bd111[_0x8766('0x57')]['id'];}return db[_0x8766('0x38')][_0x8766('0x55')]({'where':{'id':_0x2bd111['params']['id']}})[_0x8766('0x1d')](handleEntityNotFound(_0x127442,null))[_0x8766('0x1d')](saveUpdates(_0x2bd111['body'],null))[_0x8766('0x1d')](respondWithResult(_0x127442,null))[_0x8766('0x51')](handleError(_0x127442,null));};exports[_0x8766('0x33')]=function(_0x2020fe,_0x47c749){return db[_0x8766('0x38')]['find']({'where':{'id':_0x2020fe[_0x8766('0x52')]['id']}})[_0x8766('0x1d')](handleEntityNotFound(_0x47c749,null))[_0x8766('0x1d')](removeEntity(_0x47c749,null))[_0x8766('0x51')](handleError(_0x47c749,null));};exports['describe']=function(_0xcc1765,_0x2f51da){return db[_0x8766('0x38')][_0x8766('0x59')]()[_0x8766('0x1d')](respondWithResult(_0x2f51da,null))[_0x8766('0x51')](handleError(_0x2f51da,null));};var interaction_log=require('../../config/logger')(_0x8766('0x5a'));exports[_0x8766('0x5b')]=function(_0x3d994e,_0x2d98ae,_0x13e46d){var _0x3a5740={'agent':{},'channel':_0x8766('0x5c')};if(_0x3d994e[_0x8766('0x57')]['id']){delete _0x3d994e[_0x8766('0x57')]['id'];}_0x3d994e['body'][_0x8766('0x5d')]=!![];_0x3d994e[_0x8766('0x57')][_0x8766('0x5e')]=moment()['format'](_0x8766('0x5f'));_0x3d994e[_0x8766('0x57')][_0x8766('0x60')]=_0x3d994e[_0x8766('0x57')][_0x8766('0x60')]||_0x3d994e[_0x8766('0x61')]['id'];_0x3a5740['agent']['id']=_0x3d994e[_0x8766('0x57')][_0x8766('0x60')];return db[_0x8766('0x38')][_0x8766('0x55')]({'where':{'id':_0x3d994e[_0x8766('0x52')]['id'],'UserId':null}})[_0x8766('0x1d')](handleEntityNotFound(_0x2d98ae,null))[_0x8766('0x1d')](saveUpdates(_0x3d994e['body'],null))[_0x8766('0x1d')](function(_0x323d5b){if(_0x323d5b){_0x3a5740[_0x8766('0x25')]=_0x323d5b[_0x8766('0x62')]({'plain':!![]});return db[_0x8766('0x63')][_0x8766('0x55')]({'where':{'id':_0x323d5b[_0x8766('0x64')]}});}return null;})[_0x8766('0x1d')](handleEntityNotFound(_0x2d98ae,null))[_0x8766('0x1d')](function(_0x5b044c){if(_0x5b044c){return _0x5b044c[_0x8766('0x58')]({'UserId':_0x3d994e['body'][_0x8766('0x60')],'read1stAt':_[_0x8766('0x65')](_0x5b044c[_0x8766('0x66')])?moment()[_0x8766('0x67')](_0x8766('0x5f')):undefined});}return null;})['then'](function(_0x59ad6f){if(_0x59ad6f){_0x3a5740[_0x8766('0x68')]=_0x59ad6f[_0x8766('0x62')]({'plain':!![]});interaction_log[_0x8766('0x1e')](_0x8766('0x69'),_0x3d994e['user']['id'],_0x3d994e[_0x8766('0x61')][_0x8766('0x35')],_0x3d994e[_0x8766('0x61')][_0x8766('0x6a')],_0x3a5740['interaction']['id'],_0x3d994e['body']?JSON[_0x8766('0x6b')](_0x3d994e[_0x8766('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8766('0x6c'),_0x3a5740);}return null;})[_0x8766('0x1d')](function(_0x35555c){var _0x50d721=_0x8766('0x6d')+_0x35555c[_0x8766('0x25')][_0x8766('0x6e')];return db[_0x8766('0x6f')]['query'](_0x50d721,{'type':db[_0x8766('0x70')][_0x8766('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x5b3f08){return _0x5b3f08;});})[_0x8766('0x1d')](function(_0x1b2316){if(_0x1b2316){_0x3a5740[_0x8766('0x25')][_0x8766('0x72')]=_0x1b2316[0x0];if(!_0x3d994e[_0x8766('0x57')]['UserId'])return;return db[_0x8766('0x73')][_0x8766('0x55')]({'where':{'id':_0x3d994e[_0x8766('0x57')][_0x8766('0x60')],'role':_0x8766('0x74')},'attributes':['id',_0x8766('0x35'),_0x8766('0x75'),_0x8766('0x76'),_0x8766('0x77')],'raw':!![]});}return null;})[_0x8766('0x1d')](function(_0x3f56b0){if(!_0x3f56b0)return null;_0x3a5740['message'][_0x8766('0x74')]=_0x3f56b0;return _0x3a5740;})['then'](function(_0x59ca05){if(_0x59ca05){if(_0x3d994e['body'][_0x8766('0x78')]){_0x3a5740[_0x8766('0x25')][_0x8766('0x79')]=util[_0x8766('0x67')](_0x8766('0x7a'),_0x3d994e[_0x8766('0x61')]['name']);_0x3a5740[_0x8766('0x25')][_0x8766('0x7b')]=_0x3a5740[_0x8766('0x7b')];_0x3a5740['message'][_0x8766('0x7c')]=_0x3a5740[_0x8766('0x7b')];_0x3a5740[_0x8766('0x25')][_0x8766('0x7d')]=_0x8766('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x3a5740[_0x8766('0x25')]},client9002)[_0x8766('0x1d')](function(){return _0x3a5740;});}return _0x3a5740;}return null;})['then'](respondWithResult(_0x2d98ae,null))[_0x8766('0x51')](handleError(_0x2d98ae,null));};var interaction_log=require(_0x8766('0x7e'))(_0x8766('0x5a'));exports[_0x8766('0x31')]=function(_0x3de788,_0x2eb7ed,_0x21853f){var _0xfb2e5={'agent':{},'channel':_0x8766('0x5c')};if(_0x3de788[_0x8766('0x57')]['id']){delete _0x3de788[_0x8766('0x57')]['id'];}_0x3de788['body']['UserId']=_0x3de788['body'][_0x8766('0x60')]||_0x3de788[_0x8766('0x61')]['id'];_0xfb2e5[_0x8766('0x74')]['id']=_0x3de788[_0x8766('0x57')][_0x8766('0x60')];return db[_0x8766('0x38')][_0x8766('0x55')]({'where':{'id':_0x3de788[_0x8766('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2eb7ed,null))[_0x8766('0x1d')](function(_0x223bcb){if(_0x223bcb){_0xfb2e5[_0x8766('0x25')]=_0x223bcb[_0x8766('0x62')]({'plain':!![]});return db[_0x8766('0x63')][_0x8766('0x55')]({'where':{'id':_0x223bcb[_0x8766('0x64')]}});}return null;})[_0x8766('0x1d')](handleEntityNotFound(_0x2eb7ed,null))['then'](function(_0x473258){if(_0x473258){_0xfb2e5[_0x8766('0x68')]=_0x473258[_0x8766('0x62')]({'plain':!![]});interaction_log[_0x8766('0x1e')](_0x8766('0x7f'),_0x3de788[_0x8766('0x61')]['id'],_0x3de788[_0x8766('0x61')][_0x8766('0x35')],_0x3de788[_0x8766('0x61')][_0x8766('0x6a')],_0xfb2e5['interaction']['id'],_0x3de788[_0x8766('0x57')]?JSON[_0x8766('0x6b')](_0x3de788['body']):_0x8766('0x80'));return respondWithRpcPromise(_0x8766('0x81'),_0x8766('0x82'),_0xfb2e5);}return null;})['then'](function(_0x1df4ed){var _0xe007a5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1df4ed['message'][_0x8766('0x6e')];return db[_0x8766('0x6f')][_0x8766('0x3e')](_0xe007a5,{'type':db[_0x8766('0x70')][_0x8766('0x71')][_0x8766('0x83')],'raw':!![]})[_0x8766('0x1d')](function(_0x193371){return _0x193371;});})[_0x8766('0x1d')](function(_0x362a00){if(_0x362a00){_0xfb2e5[_0x8766('0x25')]['contact']=_0x362a00[0x0];if(!_0x3de788[_0x8766('0x57')]['UserId'])return;return db[_0x8766('0x73')][_0x8766('0x55')]({'where':{'id':_0x3de788['body'][_0x8766('0x60')],'role':'agent'},'attributes':['id',_0x8766('0x35'),_0x8766('0x75'),_0x8766('0x76'),_0x8766('0x77')],'raw':!![]});}return null;})[_0x8766('0x1d')](function(_0xa437f6){if(!_0xa437f6)return null;_0xfb2e5[_0x8766('0x25')][_0x8766('0x74')]=_0xa437f6;return _0xfb2e5;})[_0x8766('0x1d')](function(_0x484c65){if(_0x484c65){_0x484c65[_0x8766('0x25')][_0x8766('0x79')]=util[_0x8766('0x67')](_0x8766('0x7a'),_0x3de788[_0x8766('0x61')][_0x8766('0x35')]);_0x484c65['message']['channel']=_0xfb2e5[_0x8766('0x7b')];_0x484c65[_0x8766('0x25')][_0x8766('0x7c')]=_0xfb2e5[_0x8766('0x7b')];_0x484c65[_0x8766('0x25')][_0x8766('0x7d')]='reject';respondWithRpcPromise(_0x8766('0x84'),_0x8766('0x84'),{'event':_0x8766('0x85'),'message':_0x484c65[_0x8766('0x25')]},client9002);return _0xfb2e5;}return null;})[_0x8766('0x1d')](respondWithResult(_0x2eb7ed,null))['catch'](handleError(_0x2eb7ed,null));};exports['status']=function(_0x358bb4,_0x14b757,_0x3dde09){if(_0x358bb4[_0x8766('0x57')]['id']){delete _0x358bb4['body']['id'];}var _0x4dfff7;return db[_0x8766('0x38')]['find']({'where':{'id':_0x358bb4[_0x8766('0x52')]['id']}})['then'](handleEntityNotFound(_0x14b757,null))[_0x8766('0x1d')](function(_0x1c1ec1){if(_0x1c1ec1){_0x4dfff7=_0x1c1ec1;return db[_0x8766('0x86')][_0x8766('0x55')]({'where':{'id':_0x1c1ec1['WhatsappAccountId']}});}})[_0x8766('0x1d')](handleEntityNotFound(_0x14b757,null))[_0x8766('0x1d')](function(_0x30ae6f){if(_0x30ae6f){logger['debug'](_0x8766('0x87'),'status',_0x8766('0x88'),_0x30ae6f[_0x8766('0x39')],util[_0x8766('0x89')](_0x358bb4[_0x8766('0x57')],{'showHidden':![],'depth':null}));switch(_0x30ae6f[_0x8766('0x39')]){case _0x8766('0x8a'):if(_0x358bb4[_0x8766('0x57')][_0x8766('0x8b')]&&_0x358bb4[_0x8766('0x57')][_0x8766('0x8b')]===_0x4dfff7[_0x8766('0x8c')]&&_0x358bb4[_0x8766('0x57')][_0x8766('0x8d')]&&_0x358bb4['body'][_0x8766('0x8d')]==='read'){return _0x4dfff7[_0x8766('0x58')]({'read':!![]});}else{logger[_0x8766('0x24')](_0x8766('0x8e'),_0x8766('0x27'),'twilio',util[_0x8766('0x89')](_0x358bb4[_0x8766('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4dfff7;}})['then'](respondWithResult(_0x14b757,null))[_0x8766('0x51')](handleError(_0x14b757,null));};
\ No newline at end of file
+var _0xc611=['status','offset','undefined','limit','count','json','apply','save','update','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','create','body','params','describe','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xc611,0xec));var _0x1c61=function(_0xe8c8f7,_0x20bb07){_0xe8c8f7=_0xe8c8f7-0x0;var _0x38023b=_0xc611[_0xe8c8f7];return _0x38023b;};'use strict';var emlformat=require(_0x1c61('0x0'));var rimraf=require(_0x1c61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c61('0x2'));var rp=require(_0x1c61('0x3'));var moment=require('moment');var BPromise=require(_0x1c61('0x4'));var Mustache=require(_0x1c61('0x5'));var util=require('util');var path=require(_0x1c61('0x6'));var sox=require(_0x1c61('0x7'));var csv=require('to-csv');var ejs=require(_0x1c61('0x8'));var fs=require('fs');var fs_extra=require(_0x1c61('0x9'));var _=require(_0x1c61('0xa'));var squel=require(_0x1c61('0xb'));var crypto=require('crypto');var jsforce=require(_0x1c61('0xc'));var deskjs=require(_0x1c61('0xd'));var toCsv=require(_0x1c61('0xe'));var querystring=require(_0x1c61('0xf'));var Papa=require(_0x1c61('0x10'));var Redis=require(_0x1c61('0x11'));var authService=require(_0x1c61('0x12'));var qs=require(_0x1c61('0x13'));var as=require(_0x1c61('0x14'));var hardwareService=require(_0x1c61('0x15'));var logger=require(_0x1c61('0x16'))(_0x1c61('0x17'));var utils=require(_0x1c61('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1c61('0x19'));var db=require('../../mysqldb')['db'];config[_0x1c61('0x1a')]=_[_0x1c61('0x1b')](config[_0x1c61('0x1a')],{'host':_0x1c61('0x1c'),'port':0x18eb});var socket=require(_0x1c61('0x1d'))(new Redis(config[_0x1c61('0x1a')]));require(_0x1c61('0x1e'))[_0x1c61('0x1f')](socket);var jayson=require(_0x1c61('0x20'));var client=jayson[_0x1c61('0x21')][_0x1c61('0x22')]({'port':0x232c});var client9002=jayson[_0x1c61('0x21')][_0x1c61('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4a30c0,_0x3777ac,_0x3c5e45,_0x1e1fea){return new BPromise(function(_0x1b42d7,_0x2da2b9){var _0x43586b=_0x1e1fea||client;return _0x43586b[_0x1c61('0x23')](_0x4a30c0,_0x3c5e45)[_0x1c61('0x24')](function(_0x2b9992){logger[_0x1c61('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x3777ac,_0x1c61('0x26'));logger['debug'](_0x1c61('0x27'),_0x3777ac,_0x1c61('0x26'),JSON[_0x1c61('0x28')](_0x2b9992));if(_0x2b9992[_0x1c61('0x29')]){if(_0x2b9992[_0x1c61('0x29')]['code']===0x1f4){logger[_0x1c61('0x29')](_0x1c61('0x2a'),_0x3777ac,_0x2b9992[_0x1c61('0x29')]['message']);return _0x2da2b9(_0x2b9992['error'][_0x1c61('0x2b')]);}logger[_0x1c61('0x29')](_0x1c61('0x2a'),_0x3777ac,_0x2b9992[_0x1c61('0x29')]['message']);return _0x1b42d7(_0x2b9992[_0x1c61('0x29')]['message']);}else{logger[_0x1c61('0x25')](_0x1c61('0x2a'),_0x3777ac,_0x1c61('0x26'));_0x1b42d7(_0x2b9992[_0x1c61('0x2c')]['message']);}})[_0x1c61('0x2d')](function(_0x311013){logger['error'](_0x1c61('0x2a'),_0x3777ac,_0x311013);_0x2da2b9(_0x311013);});});}function respondWithStatusCode(_0x2b64f9,_0x2e29ae){_0x2e29ae=_0x2e29ae||0xcc;return function(_0x7176e1){if(_0x7176e1){return _0x2b64f9[_0x1c61('0x2e')](_0x2e29ae);}return _0x2b64f9['status'](_0x2e29ae)[_0x1c61('0x2f')]();};}function respondWithResult(_0x3c7833,_0x4f5beb){_0x4f5beb=_0x4f5beb||0xc8;return function(_0x407260){if(_0x407260){return _0x3c7833[_0x1c61('0x30')](_0x4f5beb)['json'](_0x407260);}};}function respondWithFilteredResult(_0x1b1ac7,_0x2899d8){return function(_0x243e16){if(_0x243e16){var _0x37756d=typeof _0x2899d8[_0x1c61('0x31')]===_0x1c61('0x32')&&typeof _0x2899d8[_0x1c61('0x33')]===_0x1c61('0x32');var _0x5678e2=_0x243e16[_0x1c61('0x34')];var _0x2d3fcb=_0x37756d?0x0:_0x2899d8['offset'];var _0x3b2632=_0x37756d?_0x243e16[_0x1c61('0x34')]:_0x2899d8[_0x1c61('0x31')]+_0x2899d8[_0x1c61('0x33')];var _0x4a3b41;if(_0x3b2632>=_0x5678e2){_0x3b2632=_0x5678e2;_0x4a3b41=0xc8;}else{_0x4a3b41=0xce;}_0x1b1ac7[_0x1c61('0x30')](_0x4a3b41);return _0x1b1ac7['set']('Content-Range',_0x2d3fcb+'-'+_0x3b2632+'/'+_0x5678e2)[_0x1c61('0x35')](_0x243e16);}return null;};}function patchUpdates(_0x1bad33){return function(_0x1f70f6){try{jsonpatch[_0x1c61('0x36')](_0x1f70f6,_0x1bad33,!![]);}catch(_0x2486e6){return BPromise['reject'](_0x2486e6);}return _0x1f70f6[_0x1c61('0x37')]();};}function saveUpdates(_0x4c34f1,_0x3c3ce4){return function(_0x62c8b3){if(_0x62c8b3){return _0x62c8b3[_0x1c61('0x38')](_0x4c34f1)[_0x1c61('0x24')](function(_0x46ab6d){return _0x46ab6d;});}return null;};}function removeEntity(_0x474e83,_0x1944a8){return function(_0x49d6d9){if(_0x49d6d9){return _0x49d6d9[_0x1c61('0x39')]()[_0x1c61('0x24')](function(){_0x474e83[_0x1c61('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x189c7e,_0x417208){return function(_0x251364){if(!_0x251364){_0x189c7e[_0x1c61('0x2e')](0x194);}return _0x251364;};}function handleError(_0xfcf021,_0x162d06){_0x162d06=_0x162d06||0x1f4;return function(_0x57d7f1){logger[_0x1c61('0x29')](_0x57d7f1['stack']);if(_0x57d7f1[_0x1c61('0x3a')]){delete _0x57d7f1['name'];}_0xfcf021[_0x1c61('0x30')](_0x162d06)[_0x1c61('0x3b')](_0x57d7f1);};}exports[_0x1c61('0x3c')]=function(_0x3e6027,_0x4d841f){var _0x1cad29={},_0x3cff9a={},_0x3475c2={'count':0x0,'rows':[]};var _0xf96a07=_[_0x1c61('0x3d')](db[_0x1c61('0x3e')][_0x1c61('0x3f')],function(_0x42f38f){return{'name':_0x42f38f[_0x1c61('0x40')],'type':_0x42f38f[_0x1c61('0x41')][_0x1c61('0x42')]};});_0x3cff9a[_0x1c61('0x43')]=_[_0x1c61('0x3d')](_0xf96a07,_0x1c61('0x3a'));_0x3cff9a[_0x1c61('0x44')]=_[_0x1c61('0x45')](_0x3e6027['query']);_0x3cff9a[_0x1c61('0x46')]=_[_0x1c61('0x47')](_0x3cff9a['model'],_0x3cff9a[_0x1c61('0x44')]);_0x1cad29['attributes']=_[_0x1c61('0x47')](_0x3cff9a[_0x1c61('0x43')],qs['fields'](_0x3e6027[_0x1c61('0x44')][_0x1c61('0x48')]));_0x1cad29[_0x1c61('0x49')]=_0x1cad29[_0x1c61('0x49')][_0x1c61('0x4a')]?_0x1cad29[_0x1c61('0x49')]:_0x3cff9a['model'];if(!_0x3e6027['query'][_0x1c61('0x4b')](_0x1c61('0x4c'))){_0x1cad29[_0x1c61('0x33')]=qs[_0x1c61('0x33')](_0x3e6027['query'][_0x1c61('0x33')]);_0x1cad29['offset']=qs[_0x1c61('0x31')](_0x3e6027['query'][_0x1c61('0x31')]);}_0x1cad29[_0x1c61('0x4d')]=qs[_0x1c61('0x4e')](_0x3e6027[_0x1c61('0x44')][_0x1c61('0x4e')]);_0x1cad29['where']=qs[_0x1c61('0x46')](_[_0x1c61('0x4f')](_0x3e6027['query'],_0x3cff9a[_0x1c61('0x46')]),_0xf96a07);if(_0x3e6027[_0x1c61('0x44')][_0x1c61('0x50')]){_0x1cad29[_0x1c61('0x51')]=_['merge'](_0x1cad29['where'],{'$or':_['map'](_0xf96a07,function(_0x79e8f2){if(_0x79e8f2['type']!==_0x1c61('0x52')){var _0x4b743e={};_0x4b743e[_0x79e8f2[_0x1c61('0x3a')]]={'$like':'%'+_0x3e6027[_0x1c61('0x44')][_0x1c61('0x50')]+'%'};return _0x4b743e;}})});}_0x1cad29=_[_0x1c61('0x53')]({},_0x1cad29,_0x3e6027[_0x1c61('0x54')]);var _0x5a3499={'where':_0x1cad29[_0x1c61('0x51')]};return db['WhatsappMessage']['count'](_0x5a3499)[_0x1c61('0x24')](function(_0x200c97){_0x3475c2['count']=_0x200c97;if(_0x3e6027['query'][_0x1c61('0x55')]){_0x1cad29[_0x1c61('0x56')]=[{'all':!![]}];}return db[_0x1c61('0x3e')][_0x1c61('0x57')](_0x1cad29);})[_0x1c61('0x24')](function(_0x14f55a){_0x3475c2[_0x1c61('0x58')]=_0x14f55a;return _0x3475c2;})[_0x1c61('0x24')](respondWithFilteredResult(_0x4d841f,_0x1cad29))[_0x1c61('0x2d')](handleError(_0x4d841f,null));};exports[_0x1c61('0x59')]=function(_0x1db3a3,_0x16bfce){var _0x4742df={'raw':!![],'where':{'id':_0x1db3a3['params']['id']}},_0x1e83ea={};_0x1e83ea[_0x1c61('0x43')]=_['keys'](db[_0x1c61('0x3e')][_0x1c61('0x3f')]);_0x1e83ea[_0x1c61('0x44')]=_[_0x1c61('0x45')](_0x1db3a3[_0x1c61('0x44')]);_0x1e83ea[_0x1c61('0x46')]=_['intersection'](_0x1e83ea['model'],_0x1e83ea[_0x1c61('0x44')]);_0x4742df[_0x1c61('0x49')]=_[_0x1c61('0x47')](_0x1e83ea['model'],qs[_0x1c61('0x48')](_0x1db3a3[_0x1c61('0x44')]['fields']));_0x4742df['attributes']=_0x4742df[_0x1c61('0x49')][_0x1c61('0x4a')]?_0x4742df['attributes']:_0x1e83ea[_0x1c61('0x43')];if(_0x1db3a3[_0x1c61('0x44')][_0x1c61('0x55')]){_0x4742df[_0x1c61('0x56')]=[{'all':!![]}];}_0x4742df=_[_0x1c61('0x53')]({},_0x4742df,_0x1db3a3[_0x1c61('0x54')]);return db[_0x1c61('0x3e')][_0x1c61('0x5a')](_0x4742df)[_0x1c61('0x24')](handleEntityNotFound(_0x16bfce,null))[_0x1c61('0x24')](respondWithResult(_0x16bfce,null))[_0x1c61('0x2d')](handleError(_0x16bfce,null));};exports[_0x1c61('0x5b')]=function(_0x3cc6f0,_0xd07c1f){return db[_0x1c61('0x3e')][_0x1c61('0x5b')](_0x3cc6f0[_0x1c61('0x5c')],{})[_0x1c61('0x24')](respondWithResult(_0xd07c1f,0xc9))[_0x1c61('0x2d')](handleError(_0xd07c1f,null));};exports['update']=function(_0x4f9250,_0x45270e){if(_0x4f9250[_0x1c61('0x5c')]['id']){delete _0x4f9250[_0x1c61('0x5c')]['id'];}return db['WhatsappMessage'][_0x1c61('0x5a')]({'where':{'id':_0x4f9250[_0x1c61('0x5d')]['id']}})[_0x1c61('0x24')](handleEntityNotFound(_0x45270e,null))[_0x1c61('0x24')](saveUpdates(_0x4f9250[_0x1c61('0x5c')],null))['then'](respondWithResult(_0x45270e,null))[_0x1c61('0x2d')](handleError(_0x45270e,null));};exports[_0x1c61('0x39')]=function(_0xa14545,_0x5de85f){return db[_0x1c61('0x3e')][_0x1c61('0x5a')]({'where':{'id':_0xa14545[_0x1c61('0x5d')]['id']}})[_0x1c61('0x24')](handleEntityNotFound(_0x5de85f,null))[_0x1c61('0x24')](removeEntity(_0x5de85f,null))[_0x1c61('0x2d')](handleError(_0x5de85f,null));};exports[_0x1c61('0x5e')]=function(_0x3eb3ee,_0x27cb58){return db[_0x1c61('0x3e')]['describe']()[_0x1c61('0x24')](respondWithResult(_0x27cb58,null))[_0x1c61('0x2d')](handleError(_0x27cb58,null));};var interaction_log=require(_0x1c61('0x16'))('whatsapp-interactions');exports[_0x1c61('0x5f')]=function(_0x16c53e,_0xd90b0c,_0x20dedc){var _0xba1664={'agent':{},'channel':_0x1c61('0x60')};if(_0x16c53e[_0x1c61('0x5c')]['id']){delete _0x16c53e[_0x1c61('0x5c')]['id'];}_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x61')]=!![];_0x16c53e[_0x1c61('0x5c')]['readAt']=moment()[_0x1c61('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x63')]=_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x63')]||_0x16c53e[_0x1c61('0x64')]['id'];_0xba1664[_0x1c61('0x65')]['id']=_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x63')];return db['WhatsappMessage'][_0x1c61('0x5a')]({'where':{'id':_0x16c53e[_0x1c61('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd90b0c,null))[_0x1c61('0x24')](saveUpdates(_0x16c53e[_0x1c61('0x5c')],null))[_0x1c61('0x24')](function(_0x449883){if(_0x449883){_0xba1664[_0x1c61('0x2b')]=_0x449883[_0x1c61('0x66')]({'plain':!![]});return db[_0x1c61('0x67')][_0x1c61('0x5a')]({'where':{'id':_0x449883[_0x1c61('0x68')]}});}return null;})[_0x1c61('0x24')](handleEntityNotFound(_0xd90b0c,null))[_0x1c61('0x24')](function(_0x38fd41){if(_0x38fd41){return _0x38fd41[_0x1c61('0x38')]({'UserId':_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x63')],'read1stAt':_[_0x1c61('0x69')](_0x38fd41['read1stAt'])?moment()[_0x1c61('0x62')](_0x1c61('0x6a')):undefined});}return null;})[_0x1c61('0x24')](function(_0xeb09b9){if(_0xeb09b9){_0xba1664[_0x1c61('0x6b')]=_0xeb09b9[_0x1c61('0x66')]({'plain':!![]});interaction_log[_0x1c61('0x25')](_0x1c61('0x6c'),_0x16c53e['user']['id'],_0x16c53e[_0x1c61('0x64')]['name'],_0x16c53e[_0x1c61('0x64')]['role'],_0xba1664[_0x1c61('0x6b')]['id'],_0x16c53e['body']?JSON[_0x1c61('0x28')](_0x16c53e[_0x1c61('0x5c')]):_0x1c61('0x6d'));return respondWithRpcPromise(_0x1c61('0x6e'),_0x1c61('0x6f'),_0xba1664);}return null;})[_0x1c61('0x24')](function(_0x177bad){var _0x14e95a=_0x1c61('0x70')+_0x177bad[_0x1c61('0x2b')][_0x1c61('0x71')];return db[_0x1c61('0x72')][_0x1c61('0x44')](_0x14e95a,{'type':db['Sequelize'][_0x1c61('0x73')][_0x1c61('0x74')],'raw':!![]})[_0x1c61('0x24')](function(_0x49f731){return _0x49f731;});})['then'](function(_0x18dee8){if(_0x18dee8){_0xba1664[_0x1c61('0x2b')][_0x1c61('0x75')]=_0x18dee8[0x0];if(!_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x63')])return;return db[_0x1c61('0x76')]['find']({'where':{'id':_0x16c53e[_0x1c61('0x5c')][_0x1c61('0x63')],'role':_0x1c61('0x65')},'attributes':['id',_0x1c61('0x3a'),_0x1c61('0x77'),_0x1c61('0x78'),_0x1c61('0x79')],'raw':!![]});}return null;})['then'](function(_0x417e70){if(!_0x417e70)return null;_0xba1664[_0x1c61('0x2b')][_0x1c61('0x65')]=_0x417e70;return _0xba1664;})[_0x1c61('0x24')](function(_0x5b97db){if(_0x5b97db){if(_0x16c53e[_0x1c61('0x5c')]['manual']){_0xba1664[_0x1c61('0x2b')][_0x1c61('0x7a')]=util[_0x1c61('0x62')](_0x1c61('0x7b'),_0x16c53e['user']['name']);_0xba1664['message'][_0x1c61('0x7c')]=_0xba1664[_0x1c61('0x7c')];_0xba1664['message'][_0x1c61('0x7d')]=_0xba1664[_0x1c61('0x7c')];_0xba1664[_0x1c61('0x2b')][_0x1c61('0x7e')]=_0x1c61('0x5f');return respondWithRpcPromise(_0x1c61('0x7f'),_0x1c61('0x7f'),{'event':'acceptmessage','message':_0xba1664[_0x1c61('0x2b')]},client9002)[_0x1c61('0x24')](function(){return _0xba1664;});}return _0xba1664;}return null;})[_0x1c61('0x24')](respondWithResult(_0xd90b0c,null))[_0x1c61('0x2d')](handleError(_0xd90b0c,null));};var interaction_log=require(_0x1c61('0x16'))('whatsapp-interactions');exports[_0x1c61('0x80')]=function(_0x4eebf3,_0x783acf,_0x4dc3b3){var _0x34b348={'agent':{},'channel':'whatsapp'};if(_0x4eebf3['body']['id']){delete _0x4eebf3[_0x1c61('0x5c')]['id'];}_0x4eebf3[_0x1c61('0x5c')][_0x1c61('0x63')]=_0x4eebf3[_0x1c61('0x5c')][_0x1c61('0x63')]||_0x4eebf3[_0x1c61('0x64')]['id'];_0x34b348['agent']['id']=_0x4eebf3[_0x1c61('0x5c')][_0x1c61('0x63')];return db[_0x1c61('0x3e')][_0x1c61('0x5a')]({'where':{'id':_0x4eebf3['params']['id'],'UserId':null}})[_0x1c61('0x24')](handleEntityNotFound(_0x783acf,null))[_0x1c61('0x24')](function(_0x1e2515){if(_0x1e2515){_0x34b348[_0x1c61('0x2b')]=_0x1e2515[_0x1c61('0x66')]({'plain':!![]});return db[_0x1c61('0x67')]['find']({'where':{'id':_0x1e2515['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x783acf,null))[_0x1c61('0x24')](function(_0x46aa94){if(_0x46aa94){_0x34b348[_0x1c61('0x6b')]=_0x46aa94[_0x1c61('0x66')]({'plain':!![]});interaction_log['info'](_0x1c61('0x81'),_0x4eebf3[_0x1c61('0x64')]['id'],_0x4eebf3['user']['name'],_0x4eebf3[_0x1c61('0x64')]['role'],_0x34b348[_0x1c61('0x6b')]['id'],_0x4eebf3[_0x1c61('0x5c')]?JSON[_0x1c61('0x28')](_0x4eebf3[_0x1c61('0x5c')]):'null');return respondWithRpcPromise(_0x1c61('0x82'),_0x1c61('0x83'),_0x34b348);}return null;})['then'](function(_0x585e6e){var _0x357e26=_0x1c61('0x70')+_0x585e6e[_0x1c61('0x2b')][_0x1c61('0x71')];return db[_0x1c61('0x72')][_0x1c61('0x44')](_0x357e26,{'type':db[_0x1c61('0x84')][_0x1c61('0x73')]['SELECT'],'raw':!![]})[_0x1c61('0x24')](function(_0x57754a){return _0x57754a;});})['then'](function(_0x1f9c8c){if(_0x1f9c8c){_0x34b348['message'][_0x1c61('0x75')]=_0x1f9c8c[0x0];if(!_0x4eebf3[_0x1c61('0x5c')][_0x1c61('0x63')])return;return db['User'][_0x1c61('0x5a')]({'where':{'id':_0x4eebf3[_0x1c61('0x5c')][_0x1c61('0x63')],'role':_0x1c61('0x65')},'attributes':['id',_0x1c61('0x3a'),_0x1c61('0x77'),'email',_0x1c61('0x79')],'raw':!![]});}return null;})[_0x1c61('0x24')](function(_0x5cdca6){if(!_0x5cdca6)return null;_0x34b348[_0x1c61('0x2b')][_0x1c61('0x65')]=_0x5cdca6;return _0x34b348;})[_0x1c61('0x24')](function(_0x24f351){if(_0x24f351){_0x24f351['message'][_0x1c61('0x7a')]=util['format'](_0x1c61('0x7b'),_0x4eebf3[_0x1c61('0x64')][_0x1c61('0x3a')]);_0x24f351[_0x1c61('0x2b')][_0x1c61('0x7c')]=_0x34b348[_0x1c61('0x7c')];_0x24f351['message'][_0x1c61('0x7d')]=_0x34b348[_0x1c61('0x7c')];_0x24f351['message'][_0x1c61('0x7e')]=_0x1c61('0x80');respondWithRpcPromise('EventManager',_0x1c61('0x7f'),{'event':_0x1c61('0x85'),'message':_0x24f351[_0x1c61('0x2b')]},client9002);return _0x34b348;}return null;})[_0x1c61('0x24')](respondWithResult(_0x783acf,null))['catch'](handleError(_0x783acf,null));};exports[_0x1c61('0x30')]=function(_0x1759bc,_0x382e2e,_0x292d09){if(_0x1759bc[_0x1c61('0x5c')]['id']){delete _0x1759bc[_0x1c61('0x5c')]['id'];}var _0x51d689;return db[_0x1c61('0x3e')][_0x1c61('0x5a')]({'where':{'id':_0x1759bc[_0x1c61('0x5d')]['id']}})[_0x1c61('0x24')](handleEntityNotFound(_0x382e2e,null))['then'](function(_0x638f84){if(_0x638f84){_0x51d689=_0x638f84;return db[_0x1c61('0x86')][_0x1c61('0x5a')]({'where':{'id':_0x638f84[_0x1c61('0x87')]}});}})[_0x1c61('0x24')](handleEntityNotFound(_0x382e2e,null))[_0x1c61('0x24')](function(_0x530ebb){if(_0x530ebb){logger[_0x1c61('0x88')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x1c61('0x30'),_0x1c61('0x89'),_0x530ebb[_0x1c61('0x41')],util[_0x1c61('0x8a')](_0x1759bc['body'],{'showHidden':![],'depth':null}));switch(_0x530ebb[_0x1c61('0x41')]){case _0x1c61('0x8b'):if(_0x1759bc[_0x1c61('0x5c')][_0x1c61('0x8c')]&&_0x1759bc[_0x1c61('0x5c')][_0x1c61('0x8c')]===_0x51d689['messageId']&&_0x1759bc[_0x1c61('0x5c')][_0x1c61('0x8d')]&&_0x1759bc[_0x1c61('0x5c')]['MessageStatus']==='read'){return _0x51d689[_0x1c61('0x38')]({'read':!![]});}else{logger[_0x1c61('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1c61('0x30'),_0x1c61('0x8b'),util['inspect'](_0x1759bc[_0x1c61('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x51d689;}})['then'](respondWithResult(_0x382e2e,null))[_0x1c61('0x2d')](handleError(_0x382e2e,null));};
\ No newline at end of file
index fb61872..2a58bf8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x765e=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x518bc9,_0x418736){var _0x47ad85=function(_0x511b3d){while(--_0x511b3d){_0x518bc9['push'](_0x518bc9['shift']());}};_0x47ad85(++_0x418736);}(_0x765e,0x131));var _0xe765=function(_0x4e9e96,_0x27f741){_0x4e9e96=_0x4e9e96-0x0;var _0x2008d0=_0x765e[_0x4e9e96];return _0x2008d0;};'use strict';var EventEmitter=require(_0xe765('0x0'));var WhatsappMessage=require(_0xe765('0x1'))['db'][_0xe765('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe765('0x3')](0x0);var events={'afterCreate':_0xe765('0x4'),'afterUpdate':_0xe765('0x5'),'afterDestroy':_0xe765('0x6')};function emitEvent(_0x38d6d2){return function(_0x30703f,_0xd2e232,_0x9559d4){WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2+':'+_0x30703f['id'],_0x30703f);WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2,_0x30703f);_0x9559d4(null);};}for(var e in events){if(events[_0xe765('0x8')](e)){var event=events[e];WhatsappMessage[_0xe765('0x9')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents;
\ No newline at end of file
+var _0x1775=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x5177('0x2')](0x0);var events={'afterCreate':_0x5177('0x3'),'afterUpdate':_0x5177('0x4'),'afterDestroy':_0x5177('0x5')};function emitEvent(_0x420a5b){return function(_0x2027bf,_0x359401,_0x51275f){WhatsappMessageEvents[_0x5177('0x6')](_0x420a5b+':'+_0x2027bf['id'],_0x2027bf);WhatsappMessageEvents[_0x5177('0x6')](_0x420a5b,_0x2027bf);_0x51275f(null);};}for(var e in events){if(events[_0x5177('0x7')](e)){var event=events[e];WhatsappMessage[_0x5177('0x8')](e,emitEvent(event));}}module[_0x5177('0x9')]=WhatsappMessageEvents;
\ No newline at end of file
index abab696..a232500 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6da3=['afterCreate','inspect','sinch','authToken','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','findOne','then','update','createdAt','catch','WhatsappAccount','find','type','twilio','accountSid','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2271e5,_0x6ea709){var _0x5a054e=function(_0x4d1cd0){while(--_0x4d1cd0){_0x2271e5['push'](_0x2271e5['shift']());}};_0x5a054e(++_0x6ea709);}(_0x6da3,0xf9));var _0x36da=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6da3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x36da('0x0'));var util=require(_0x36da('0x1'));var logger=require(_0x36da('0x2'))('api');var moment=require(_0x36da('0x3'));var BPromise=require(_0x36da('0x4'));var rp=require(_0x36da('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x36da('0x6'));var config=require('../../config/environment');var attributes=require(_0x36da('0x7'));module[_0x36da('0x8')]=function(_0x3eb004,_0x5d078d){return _0x3eb004[_0x36da('0x9')](_0x36da('0xa'),attributes,{'tableName':_0x36da('0xb'),'paranoid':![],'indexes':[{'name':_0x36da('0xc'),'fields':[_0x36da('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x36da('0xd')],'type':_0x36da('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a9763,_0x1c5bd6,_0x3a96aa){var _0x274261=_0x3eb004[_0x36da('0xf')];var _0x13bd02=_0x1a9763[_0x36da('0x10')]({'plain':!![]});if(_0x13bd02[_0x36da('0x11')]['toLowerCase']()==='in'||_0x13bd02[_0x36da('0x11')][_0x36da('0x12')]()==='out'&&!_0x13bd02[_0x36da('0x13')]&&!_['isNil'](_0x13bd02[_0x36da('0x14')])){_0x274261['WhatsappInteraction'][_0x36da('0x15')]({'where':{'id':_0x13bd02['WhatsappInteractionId']}})[_0x36da('0x16')](function(_0x1b79c5){if(_0x1b79c5){_0x1b79c5[_0x36da('0x17')]({'lastMsgAt':_0x13bd02[_0x36da('0x18')],'lastMsgDirection':_0x13bd02[_0x36da('0x11')][_0x36da('0x12')]()});}})[_0x36da('0x19')](function(_0x4c43d6){console['error'](_0x4c43d6);});}if(_0x13bd02[_0x36da('0x11')]==='out'&&!_0x13bd02[_0x36da('0x13')]){var _0x57da8c;_0x274261[_0x36da('0x1a')][_0x36da('0x1b')]({'where':{'id':_0x13bd02['WhatsappAccountId']},'raw':!![]})[_0x36da('0x16')](function(_0x1975e6){_0x57da8c=_0x1975e6;if(_0x57da8c&&_0x57da8c[_0x36da('0x1c')]){switch(_0x57da8c['type']){case _0x36da('0x1d'):var _0x185fba=require(_0x36da('0x1d'));if(_0x57da8c[_0x36da('0x1e')]&&_0x57da8c['authToken']&&_0x57da8c[_0x36da('0x1f')]){var _0x15e980=new _0x185fba(_0x57da8c[_0x36da('0x1e')],_0x57da8c['authToken']);_0x15e980[_0x36da('0x20')][_0x36da('0x21')]({'body':_0x13bd02[_0x36da('0xd')],'to':_0x36da('0x22')+_0x13bd02[_0x36da('0x1f')],'from':_0x36da('0x22')+_0x57da8c[_0x36da('0x1f')],'statusCallback':_0x57da8c[_0x36da('0x23')]+_0x36da('0x24')+_0x13bd02['id']+'/status?token='+_0x57da8c[_0x36da('0x25')]})[_0x36da('0x16')](function(_0x59e47c){if(_0x59e47c['sid']){return _0x1a9763[_0x36da('0x17')]({'messageId':_0x59e47c[_0x36da('0x26')]});}})['catch'](function(_0x519d7d){logger[_0x36da('0x27')](_0x36da('0x28'),_0x36da('0x29'),'twilio',util[_0x36da('0x2a')](_0x519d7d,{'showHidden':![],'depth':null}));});}else{logger[_0x36da('0x27')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x36da('0x29'),_0x36da('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x36da('0x2b'):var _0x318399=_0x57da8c[_0x36da('0x1e')];var _0x28f45b=_0x57da8c[_0x36da('0x2c')];var _0x4a915c=_0x57da8c[_0x36da('0x2d')]+_0x36da('0x2e')+_0x318399+'/messages/';var _0x17f215={'to':[_0x13bd02[_0x36da('0x1f')]],'message':{'type':_0x36da('0x2f'),'text':_0x13bd02['body']}};var _0x4a4f40={'method':_0x36da('0x30'),'uri':_0x4a915c,'headers':{'Authorization':_0x36da('0x31')+_0x28f45b,'Content-Type':_0x36da('0x32')},'body':_0x17f215,'json':!![]};rp(_0x4a4f40)['then'](function(_0x3f69b3){if(_0x3f69b3[_0x36da('0x33')][0x0][_0x36da('0x34')]){return _0x1a9763[_0x36da('0x17')]({'messageId':_0x3f69b3[_0x36da('0x33')][0x0]['message_id']});}})[_0x36da('0x19')](function(_0x41fd52){logger[_0x36da('0x35')](_0x36da('0x36'),_0x41fd52);});break;}}})[_0x36da('0x37')](function(){_0x3a96aa();});}else{_0x3a96aa();}}},'charset':_0x36da('0x38'),'collate':_0x36da('0x39')});};
\ No newline at end of file
+var _0xe0e7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','body','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x10d123,_0x495566){var _0x38fb0a=function(_0x57dd3f){while(--_0x57dd3f){_0x10d123['push'](_0x10d123['shift']());}};_0x38fb0a(++_0x495566);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xe0e7[_0x39e84d];return _0x1991bc;};'use strict';var _=require('lodash');var util=require(_0x7e0e('0x0'));var logger=require(_0x7e0e('0x1'))(_0x7e0e('0x2'));var moment=require(_0x7e0e('0x3'));var BPromise=require(_0x7e0e('0x4'));var rp=require(_0x7e0e('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x7e0e('0x6'));var rimraf=require(_0x7e0e('0x7'));var config=require(_0x7e0e('0x8'));var attributes=require(_0x7e0e('0x9'));module['exports']=function(_0x380cb5,_0x7fafd2){return _0x380cb5[_0x7e0e('0xa')]('WhatsappMessage',attributes,{'tableName':_0x7e0e('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7e0e('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x7e0e('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e1bfb,_0x1fd45f,_0x9ae909){var _0x122135=_0x380cb5[_0x7e0e('0xe')];var _0x52c17b=_0x5e1bfb['get']({'plain':!![]});if(_0x52c17b[_0x7e0e('0xf')][_0x7e0e('0x10')]()==='in'||_0x52c17b[_0x7e0e('0xf')]['toLowerCase']()===_0x7e0e('0x11')&&!_0x52c17b[_0x7e0e('0x12')]&&!_['isNil'](_0x52c17b[_0x7e0e('0x13')])){_0x122135[_0x7e0e('0x14')][_0x7e0e('0x15')]({'where':{'id':_0x52c17b[_0x7e0e('0x16')]}})['then'](function(_0x3a0e20){if(_0x3a0e20){_0x3a0e20[_0x7e0e('0x17')]({'lastMsgAt':_0x52c17b[_0x7e0e('0x18')],'lastMsgDirection':_0x52c17b[_0x7e0e('0xf')]['toLowerCase']()});}})['catch'](function(_0x9a6ac8){console[_0x7e0e('0x19')](_0x9a6ac8);});}if(_0x52c17b[_0x7e0e('0xf')]==='out'&&!_0x52c17b['secret']){var _0x22692e;_0x122135[_0x7e0e('0x1a')][_0x7e0e('0x1b')]({'where':{'id':_0x52c17b[_0x7e0e('0x1c')]},'raw':!![]})[_0x7e0e('0x1d')](function(_0x4dfb40){_0x22692e=_0x4dfb40;if(_0x22692e&&_0x22692e[_0x7e0e('0x1e')]){switch(_0x22692e[_0x7e0e('0x1e')]){case _0x7e0e('0x1f'):var _0xdb173f=require(_0x7e0e('0x1f'));if(_0x22692e[_0x7e0e('0x20')]&&_0x22692e[_0x7e0e('0x21')]&&_0x22692e[_0x7e0e('0x22')]){var _0x176da5=new _0xdb173f(_0x22692e[_0x7e0e('0x20')],_0x22692e[_0x7e0e('0x21')]);_0x176da5[_0x7e0e('0x23')][_0x7e0e('0x24')]({'body':_0x52c17b[_0x7e0e('0xd')],'to':_0x7e0e('0x25')+_0x52c17b['phone'],'from':'whatsapp:'+_0x22692e[_0x7e0e('0x22')],'statusCallback':_0x22692e[_0x7e0e('0x26')]+'/api/whatsapp/messages/'+_0x52c17b['id']+_0x7e0e('0x27')+_0x22692e[_0x7e0e('0x28')]})[_0x7e0e('0x1d')](function(_0x4c1798){if(_0x4c1798[_0x7e0e('0x29')]){return _0x5e1bfb[_0x7e0e('0x17')]({'messageId':_0x4c1798['sid']});}})[_0x7e0e('0x2a')](function(_0x43e0ca){logger[_0x7e0e('0x19')](_0x7e0e('0x2b'),_0x7e0e('0x2c'),_0x7e0e('0x1f'),util[_0x7e0e('0x2d')](_0x43e0ca,{'showHidden':![],'depth':null}));});}else{logger[_0x7e0e('0x19')](_0x7e0e('0x2b'),_0x7e0e('0x2c'),_0x7e0e('0x1f'),_0x7e0e('0x2e'));}break;case _0x7e0e('0x2f'):var _0x76ad63=_0x22692e[_0x7e0e('0x20')];var _0x3c7505=_0x22692e[_0x7e0e('0x21')];var _0x8d5338=_0x22692e[_0x7e0e('0x30')]+_0x7e0e('0x31')+_0x76ad63+_0x7e0e('0x32');var _0x3304c2={'to':[_0x52c17b['phone']],'message':{'type':'text','text':_0x52c17b[_0x7e0e('0xd')]}};var _0x3daf0f={'method':_0x7e0e('0x33'),'uri':_0x8d5338,'headers':{'Authorization':_0x7e0e('0x34')+_0x3c7505,'Content-Type':_0x7e0e('0x35')},'body':_0x3304c2,'json':!![]};rp(_0x3daf0f)[_0x7e0e('0x1d')](function(_0x5b3a21){if(_0x5b3a21[_0x7e0e('0x36')][0x0]['message_id']){return _0x5e1bfb[_0x7e0e('0x17')]({'messageId':_0x5b3a21[_0x7e0e('0x36')][0x0][_0x7e0e('0x37')]});}})[_0x7e0e('0x2a')](function(_0x42f448){logger[_0x7e0e('0x38')](_0x7e0e('0x39'),_0x42f448);});break;}}})[_0x7e0e('0x3a')](function(){_0x9ae909();});}else{_0x9ae909();}}},'charset':'utf8mb4','collate':_0x7e0e('0x3b')});};
\ No newline at end of file
index 4d69735..69d4678 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09d9=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0xae0c01,_0x449c99){var _0x913e86=function(_0x421e87){while(--_0x421e87){_0xae0c01['push'](_0xae0c01['shift']());}};_0x913e86(++_0x449c99);}(_0x09d9,0x144));var _0x909d=function(_0x5641e3,_0x1437ae){_0x5641e3=_0x5641e3-0x0;var _0x4065e8=_0x09d9[_0x5641e3];return _0x4065e8;};'use strict';var _=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var moment=require(_0x909d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x909d('0x3'));var db=require(_0x909d('0x4'))['db'];var utils=require(_0x909d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x909d('0x6'));var jayson=require(_0x909d('0x7'));var client=jayson[_0x909d('0x8')]['http']({'port':0x232a});config[_0x909d('0x9')]=_['defaults'](config[_0x909d('0x9')],{'host':_0x909d('0xa'),'port':0x18eb});var socket=require(_0x909d('0xb'))(new Redis(config['redis']));require(_0x909d('0xc'))[_0x909d('0xd')](socket);function respondWithRpcPromise(_0x389579,_0x189bdd,_0x49b4a9){return new BPromise(function(_0x367a77,_0x51404c){return client['request'](_0x389579,_0x49b4a9)[_0x909d('0xe')](function(_0x1471ef){logger[_0x909d('0xf')](_0x909d('0x10'),_0x189bdd,_0x909d('0x11'));logger[_0x909d('0x12')](_0x909d('0x13'),_0x189bdd,_0x909d('0x11'),JSON[_0x909d('0x14')](_0x1471ef));if(_0x1471ef[_0x909d('0x15')]){if(_0x1471ef[_0x909d('0x15')][_0x909d('0x16')]===0x1f4){logger[_0x909d('0x15')](_0x909d('0x10'),_0x189bdd,_0x1471ef[_0x909d('0x15')][_0x909d('0x17')]);return _0x51404c(_0x1471ef['error'][_0x909d('0x17')]);}logger[_0x909d('0x15')](_0x909d('0x10'),_0x189bdd,_0x1471ef[_0x909d('0x15')][_0x909d('0x17')]);return _0x367a77(_0x1471ef[_0x909d('0x15')][_0x909d('0x17')]);}else{logger[_0x909d('0xf')](_0x909d('0x10'),_0x189bdd,_0x909d('0x11'));_0x367a77(_0x1471ef[_0x909d('0x18')][_0x909d('0x17')]);}})[_0x909d('0x19')](function(_0x5d068c){logger[_0x909d('0x15')](_0x909d('0x10'),_0x189bdd,_0x5d068c);_0x51404c(_0x5d068c);});});}exports[_0x909d('0x1a')]=function(_0xd42eb8){var _0x3ba9ca=this;return new Promise(function(_0x5328cf,_0x2d9a72){return db[_0x909d('0x1b')][_0x909d('0x1c')](_0xd42eb8['body'],{'raw':_0xd42eb8[_0x909d('0x1d')]?_0xd42eb8[_0x909d('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x909d('0xe')](function(_0x121194){logger[_0x909d('0xf')](_0x909d('0x1a'),_0xd42eb8);logger['debug'](_0x909d('0x1a'),_0xd42eb8,JSON[_0x909d('0x14')](_0x121194));_0x5328cf(_0x121194);})[_0x909d('0x19')](function(_0x1a58cc){logger[_0x909d('0x15')](_0x909d('0x1a'),_0x1a58cc['message'],_0xd42eb8);_0x2d9a72(_0x3ba9ca[_0x909d('0x15')](0x1f4,_0x1a58cc['message']));});});};
\ No newline at end of file
+var _0x1206=['register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappMessage','create','body','options','raw','then','lodash','util','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x49b167,_0x2dc3e0){var _0x48c139=function(_0x559bab){while(--_0x559bab){_0x49b167['push'](_0x49b167['shift']());}};_0x48c139(++_0x2dc3e0);}(_0x1206,0x16d));var _0x6120=function(_0x14e69a,_0x2eac7c){_0x14e69a=_0x14e69a-0x0;var _0x26adb8=_0x1206[_0x14e69a];return _0x26adb8;};'use strict';var _=require(_0x6120('0x0'));var util=require(_0x6120('0x1'));var moment=require(_0x6120('0x2'));var BPromise=require('bluebird');var rs=require(_0x6120('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6120('0x4'));var logger=require('../../config/logger')(_0x6120('0x5'));var config=require('../../config/environment');var jayson=require(_0x6120('0x6'));var client=jayson[_0x6120('0x7')][_0x6120('0x8')]({'port':0x232a});config[_0x6120('0x9')]=_[_0x6120('0xa')](config[_0x6120('0x9')],{'host':_0x6120('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6120('0x9')]));require('./whatsappMessage.socket')[_0x6120('0xc')](socket);function respondWithRpcPromise(_0x4c3627,_0x3b9a73,_0x409627){return new BPromise(function(_0xda87c0,_0x3a5ed4){return client['request'](_0x4c3627,_0x409627)['then'](function(_0x5c1d59){logger[_0x6120('0xd')](_0x6120('0xe'),_0x3b9a73,_0x6120('0xf'));logger[_0x6120('0x10')](_0x6120('0x11'),_0x3b9a73,_0x6120('0xf'),JSON[_0x6120('0x12')](_0x5c1d59));if(_0x5c1d59['error']){if(_0x5c1d59[_0x6120('0x13')][_0x6120('0x14')]===0x1f4){logger[_0x6120('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x3b9a73,_0x5c1d59[_0x6120('0x13')]['message']);return _0x3a5ed4(_0x5c1d59[_0x6120('0x13')][_0x6120('0x15')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3b9a73,_0x5c1d59[_0x6120('0x13')][_0x6120('0x15')]);return _0xda87c0(_0x5c1d59[_0x6120('0x13')][_0x6120('0x15')]);}else{logger[_0x6120('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x3b9a73,_0x6120('0xf'));_0xda87c0(_0x5c1d59[_0x6120('0x16')][_0x6120('0x15')]);}})['catch'](function(_0x5def8c){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3b9a73,_0x5def8c);_0x3a5ed4(_0x5def8c);});});}exports['CreateWhatsappMessage']=function(_0x587291){var _0x33a246=this;return new Promise(function(_0x15792b,_0x97272c){return db[_0x6120('0x17')][_0x6120('0x18')](_0x587291[_0x6120('0x19')],{'raw':_0x587291['options']?_0x587291[_0x6120('0x1a')][_0x6120('0x1b')]===undefined?!![]:![]:!![]})[_0x6120('0x1c')](function(_0x547b1a){logger['info']('CreateWhatsappMessage',_0x587291);logger[_0x6120('0x10')]('CreateWhatsappMessage',_0x587291,JSON[_0x6120('0x12')](_0x547b1a));_0x15792b(_0x547b1a);})['catch'](function(_0xbf0e13){logger[_0x6120('0x13')]('CreateWhatsappMessage',_0xbf0e13[_0x6120('0x15')],_0x587291);_0x97272c(_0x33a246[_0x6120('0x13')](0x1f4,_0xbf0e13['message']));});});};
\ No newline at end of file
index a57bc0a..015fd9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf9cd=['removeListener','length','whatsappMessage:','./whatsappMessage.events','remove'];(function(_0x431948,_0x472eed){var _0x5541aa=function(_0x27504f){while(--_0x27504f){_0x431948['push'](_0x431948['shift']());}};_0x5541aa(++_0x472eed);}(_0xf9cd,0x19d));var _0xdf9c=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xf9cd[_0x4c440b];return _0x2d48cf;};'use strict';var WhatsappMessageEvents=require(_0xdf9c('0x0'));var events=['save',_0xdf9c('0x1'),'update'];function createListener(_0x55ec71,_0x459cf9){return function(_0xc008d){_0x459cf9['emit'](_0x55ec71,_0xc008d);};}function removeListener(_0x373ae8,_0x4477b4){return function(){WhatsappMessageEvents[_0xdf9c('0x2')](_0x373ae8,_0x4477b4);};}exports['register']=function(_0x5ed8da){for(var _0x49f731=0x0,_0x347bc3=events[_0xdf9c('0x3')];_0x49f731<_0x347bc3;_0x49f731++){var _0x38a7f6=events[_0x49f731];var _0x22d348=createListener(_0xdf9c('0x4')+_0x38a7f6,_0x5ed8da);WhatsappMessageEvents['on'](_0x38a7f6,_0x22d348);}};
\ No newline at end of file
+var _0x5b04=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x58c9cf,_0x2e7798){var _0x1aae82=function(_0x15313a){while(--_0x15313a){_0x58c9cf['push'](_0x58c9cf['shift']());}};_0x1aae82(++_0x2e7798);}(_0x5b04,0x147));var _0x45b0=function(_0x3c3dc6,_0x112a65){_0x3c3dc6=_0x3c3dc6-0x0;var _0x2b5c0b=_0x5b04[_0x3c3dc6];return _0x2b5c0b;};'use strict';var WhatsappMessageEvents=require(_0x45b0('0x0'));var events=[_0x45b0('0x1'),'remove',_0x45b0('0x2')];function createListener(_0x58d004,_0x23f5ff){return function(_0x2ddd97){_0x23f5ff[_0x45b0('0x3')](_0x58d004,_0x2ddd97);};}function removeListener(_0x2c4e22,_0x362546){return function(){WhatsappMessageEvents['removeListener'](_0x2c4e22,_0x362546);};}exports[_0x45b0('0x4')]=function(_0x55cfb2){for(var _0xb0ca1a=0x0,_0x577062=events[_0x45b0('0x5')];_0xb0ca1a<_0x577062;_0xb0ca1a++){var _0x2da58d=events[_0xb0ca1a];var _0x40dc35=createListener(_0x45b0('0x6')+_0x2da58d,_0x55cfb2);WhatsappMessageEvents['on'](_0x2da58d,_0x40dc35);}};
\ No newline at end of file
index 45ab669..b7ea800 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5507=['/:id/members','/:id/teams','getTeams','/:id/users','create','post','addTeams','put','delete','destroy','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x5507,0xae));var _0x7550=function(_0xfec237,_0x40a262){_0xfec237=_0xfec237-0x0;var _0x2e8f1b=_0x5507[_0xfec237];return _0x2e8f1b;};'use strict';var multer=require('multer');var util=require(_0x7550('0x0'));var path=require(_0x7550('0x1'));var timeout=require('connect-timeout');var express=require(_0x7550('0x2'));var router=express[_0x7550('0x3')]();var fs_extra=require(_0x7550('0x4'));var auth=require(_0x7550('0x5'));var interaction=require(_0x7550('0x6'));var config=require(_0x7550('0x7'));var controller=require(_0x7550('0x8'));router[_0x7550('0x9')]('/',auth['isAuthenticated'](),controller[_0x7550('0xa')]);router[_0x7550('0x9')](_0x7550('0xb'),auth[_0x7550('0xc')](),controller['describe']);router['get'](_0x7550('0xd'),auth[_0x7550('0xc')](),controller[_0x7550('0xe')]);router['get'](_0x7550('0xf'),auth[_0x7550('0xc')](),controller['getMembers']);router[_0x7550('0x9')](_0x7550('0x10'),auth[_0x7550('0xc')](),controller[_0x7550('0x11')]);router['get'](_0x7550('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x7550('0xc')](),controller[_0x7550('0x13')]);router[_0x7550('0x14')](_0x7550('0x10'),auth[_0x7550('0xc')](),controller[_0x7550('0x15')]);router[_0x7550('0x14')](_0x7550('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7550('0x16')](_0x7550('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7550('0x17')]('/:id',auth[_0x7550('0xc')](),controller[_0x7550('0x18')]);router[_0x7550('0x17')](_0x7550('0x10'),auth[_0x7550('0xc')](),controller['removeTeams']);router[_0x7550('0x17')]('/:id/users',auth[_0x7550('0xc')](),controller[_0x7550('0x19')]);module[_0x7550('0x1a')]=router;
\ No newline at end of file
+var _0x1d3a=['index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated'];(function(_0x5b2544,_0x10be79){var _0x289d42=function(_0x2ea52b){while(--_0x2ea52b){_0x5b2544['push'](_0x5b2544['shift']());}};_0x289d42(++_0x10be79);}(_0x1d3a,0xe6));var _0xa1d3=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x1d3a[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0xa1d3('0x0'));var util=require('util');var path=require(_0xa1d3('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1d3('0x2'));var router=express[_0xa1d3('0x3')]();var fs_extra=require(_0xa1d3('0x4'));var auth=require(_0xa1d3('0x5'));var interaction=require(_0xa1d3('0x6'));var config=require(_0xa1d3('0x7'));var controller=require(_0xa1d3('0x8'));router['get']('/',auth[_0xa1d3('0x9')](),controller[_0xa1d3('0xa')]);router[_0xa1d3('0xb')](_0xa1d3('0xc'),auth[_0xa1d3('0x9')](),controller[_0xa1d3('0xd')]);router[_0xa1d3('0xb')](_0xa1d3('0xe'),auth[_0xa1d3('0x9')](),controller[_0xa1d3('0xf')]);router[_0xa1d3('0xb')](_0xa1d3('0x10'),auth[_0xa1d3('0x9')](),controller['getMembers']);router[_0xa1d3('0xb')](_0xa1d3('0x11'),auth[_0xa1d3('0x9')](),controller[_0xa1d3('0x12')]);router[_0xa1d3('0xb')]('/:id/users',auth[_0xa1d3('0x9')](),controller[_0xa1d3('0x13')]);router[_0xa1d3('0x14')]('/',auth[_0xa1d3('0x9')](),controller[_0xa1d3('0x15')]);router[_0xa1d3('0x14')](_0xa1d3('0x11'),auth[_0xa1d3('0x9')](),controller[_0xa1d3('0x16')]);router['post'](_0xa1d3('0x17'),auth[_0xa1d3('0x9')](),controller[_0xa1d3('0x18')]);router[_0xa1d3('0x19')](_0xa1d3('0xe'),auth['isAuthenticated'](),controller[_0xa1d3('0x1a')]);router[_0xa1d3('0x1b')]('/:id',auth[_0xa1d3('0x9')](),controller['destroy']);router['delete'](_0xa1d3('0x11'),auth[_0xa1d3('0x9')](),controller['removeTeams']);router[_0xa1d3('0x1b')](_0xa1d3('0x17'),auth['isAuthenticated'](),controller[_0xa1d3('0x1c')]);module[_0xa1d3('0x1d')]=router;
\ No newline at end of file
index eea755b..0d82be1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b19=['STRING','sequelize','exports','name','rrmemory','beepall','roundrobin'];(function(_0x57c5fc,_0x36eace){var _0x2a5d8a=function(_0x5beb7c){while(--_0x5beb7c){_0x57c5fc['push'](_0x57c5fc['shift']());}};_0x2a5d8a(++_0x36eace);}(_0x6b19,0xe8));var _0x96b1=function(_0x480d6e,_0x45d6d3){_0x480d6e=_0x480d6e-0x0;var _0x510431=_0x6b19[_0x480d6e];return _0x510431;};'use strict';var Sequelize=require(_0x96b1('0x0'));module[_0x96b1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x96b1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x96b1('0x3'),_0x96b1('0x4'),_0x96b1('0x5'))},'description':{'type':Sequelize[_0x96b1('0x6')]}};
\ No newline at end of file
+var _0xb469=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xb469,0x13b));var _0x9b46=function(_0x17eee3,_0x3410fa){_0x17eee3=_0x17eee3-0x0;var _0x3f1a1e=_0xb469[_0x17eee3];return _0x3f1a1e;};'use strict';var Sequelize=require(_0x9b46('0x0'));module[_0x9b46('0x1')]={'name':{'type':Sequelize[_0x9b46('0x2')],'unique':_0x9b46('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9b46('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b46('0x5')](_0x9b46('0x6'),'beepall',_0x9b46('0x7'))},'description':{'type':Sequelize[_0x9b46('0x2')]}};
\ No newline at end of file
index d3f7d79..4867db3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06e5=['sort','WhatsappQueueId','User','updatedAt','format','%s/%s','SIP','whatsappPause','createdAt','getTeams','findOne','Team','rawAttributes','online','interface','flatMap','sequelize','transaction','addTeams','userWhatsappQueue:save','removeTeams','ids','Agents','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','emit','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','get','WhatsappQueues','UserProfileResource','destroy','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','merge','where','options','WhatsappQueue','findAll','rows','show','includeAll','include','find','catch','create','body','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMembers','UserWhatsappQueue','nolimit','order'];(function(_0x36cb66,_0x1fc8cb){var _0xe402a6=function(_0xa11911){while(--_0xa11911){_0x36cb66['push'](_0x36cb66['shift']());}};_0xe402a6(++_0x1fc8cb);}(_0x06e5,0x14a));var _0x506e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x06e5[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require(_0x506e('0x0'));var rimraf=require(_0x506e('0x1'));var zipdir=require(_0x506e('0x2'));var jsonpatch=require(_0x506e('0x3'));var rp=require(_0x506e('0x4'));var moment=require(_0x506e('0x5'));var BPromise=require(_0x506e('0x6'));var Mustache=require(_0x506e('0x7'));var util=require(_0x506e('0x8'));var path=require(_0x506e('0x9'));var sox=require(_0x506e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x506e('0xb'));var _=require(_0x506e('0xc'));var squel=require(_0x506e('0xd'));var crypto=require('crypto');var jsforce=require(_0x506e('0xe'));var deskjs=require(_0x506e('0xf'));var toCsv=require(_0x506e('0x10'));var querystring=require(_0x506e('0x11'));var Papa=require('papaparse');var Redis=require(_0x506e('0x12'));var authService=require(_0x506e('0x13'));var qs=require(_0x506e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x506e('0x15'));var logger=require(_0x506e('0x16'))(_0x506e('0x17'));var utils=require(_0x506e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x506e('0x19'));var db=require(_0x506e('0x1a'))['db'];config[_0x506e('0x1b')]=_['defaults'](config[_0x506e('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x506e('0x1b')]));require(_0x506e('0x1c'))[_0x506e('0x1d')](socket);function respondWithStatusCode(_0x2e39b8,_0xe1217c){_0xe1217c=_0xe1217c||0xcc;return function(_0x2ee665){if(_0x2ee665){return _0x2e39b8[_0x506e('0x1e')](_0xe1217c);}return _0x2e39b8[_0x506e('0x1f')](_0xe1217c)[_0x506e('0x20')]();};}function respondWithResult(_0x31058d,_0xb56ae2){_0xb56ae2=_0xb56ae2||0xc8;return function(_0x3f3860){if(_0x3f3860){return _0x31058d[_0x506e('0x1f')](_0xb56ae2)[_0x506e('0x21')](_0x3f3860);}};}function respondWithFilteredResult(_0x2f9a0e,_0x52e237){return function(_0x3e0440){if(_0x3e0440){var _0x268b85=typeof _0x52e237[_0x506e('0x22')]==='undefined'&&typeof _0x52e237[_0x506e('0x23')]===_0x506e('0x24');var _0x219791=_0x3e0440[_0x506e('0x25')];var _0x26d663=_0x268b85?0x0:_0x52e237[_0x506e('0x22')];var _0x1706ca=_0x268b85?_0x3e0440[_0x506e('0x25')]:_0x52e237['offset']+_0x52e237['limit'];var _0x1ad034;if(_0x1706ca>=_0x219791){_0x1706ca=_0x219791;_0x1ad034=0xc8;}else{_0x1ad034=0xce;}_0x2f9a0e[_0x506e('0x1f')](_0x1ad034);return _0x2f9a0e[_0x506e('0x26')](_0x506e('0x27'),_0x26d663+'-'+_0x1706ca+'/'+_0x219791)[_0x506e('0x21')](_0x3e0440);}return null;};}function patchUpdates(_0x302371){return function(_0x4d8842){try{jsonpatch[_0x506e('0x28')](_0x4d8842,_0x302371,!![]);}catch(_0x5af54d){return BPromise[_0x506e('0x29')](_0x5af54d);}return _0x4d8842['save']();};}function saveUpdates(_0x7246dc,_0x3dc0ee){return function(_0x5ba7b9){if(_0x5ba7b9){return _0x5ba7b9['update'](_0x7246dc)[_0x506e('0x2a')](function(_0x102eb6){return _0x102eb6;});}return null;};}function removeEntity(_0x34af52,_0x20c85c){return function(_0x39c0df){if(_0x39c0df){return _0x39c0df['destroy']()[_0x506e('0x2a')](function(){var _0x34f7f4=_0x39c0df[_0x506e('0x2b')]({'plain':!![]});var _0xc8e8f5=_0x506e('0x2c');return db[_0x506e('0x2d')][_0x506e('0x2e')]({'where':{'type':_0xc8e8f5,'resourceId':_0x34f7f4['id']}})['then'](function(){return _0x39c0df;});})[_0x506e('0x2a')](function(){_0x34af52[_0x506e('0x1f')](0xcc)[_0x506e('0x20')]();});}};}function handleEntityNotFound(_0xe13378,_0x1c6a89){return function(_0x2d0af0){if(!_0x2d0af0){_0xe13378['sendStatus'](0x194);}return _0x2d0af0;};}function handleError(_0xfcb064,_0x332dd8){_0x332dd8=_0x332dd8||0x1f4;return function(_0x34d486){logger['error'](_0x34d486['stack']);if(_0x34d486[_0x506e('0x2f')]){delete _0x34d486[_0x506e('0x2f')];}_0xfcb064[_0x506e('0x1f')](_0x332dd8)[_0x506e('0x30')](_0x34d486);};}exports[_0x506e('0x31')]=function(_0x80b7fb,_0x33da2f){var _0x4e96c1={},_0x47f9d4={},_0x14c028={'count':0x0,'rows':[]};var _0x1e8f13=_[_0x506e('0x32')](db['WhatsappQueue']['rawAttributes'],function(_0x53630d){return{'name':_0x53630d[_0x506e('0x33')],'type':_0x53630d[_0x506e('0x34')][_0x506e('0x35')]};});_0x47f9d4[_0x506e('0x36')]=_[_0x506e('0x32')](_0x1e8f13,_0x506e('0x2f'));_0x47f9d4['query']=_[_0x506e('0x37')](_0x80b7fb[_0x506e('0x38')]);_0x47f9d4[_0x506e('0x39')]=_[_0x506e('0x3a')](_0x47f9d4[_0x506e('0x36')],_0x47f9d4[_0x506e('0x38')]);_0x4e96c1[_0x506e('0x3b')]=_['intersection'](_0x47f9d4['model'],qs[_0x506e('0x3c')](_0x80b7fb[_0x506e('0x38')][_0x506e('0x3c')]));_0x4e96c1[_0x506e('0x3b')]=_0x4e96c1['attributes'][_0x506e('0x3d')]?_0x4e96c1[_0x506e('0x3b')]:_0x47f9d4[_0x506e('0x36')];if(!_0x80b7fb[_0x506e('0x38')][_0x506e('0x3e')]('nolimit')){_0x4e96c1[_0x506e('0x23')]=qs['limit'](_0x80b7fb[_0x506e('0x38')][_0x506e('0x23')]);_0x4e96c1[_0x506e('0x22')]=qs['offset'](_0x80b7fb['query'][_0x506e('0x22')]);}_0x4e96c1['order']=qs['sort'](_0x80b7fb[_0x506e('0x38')]['sort']);_0x4e96c1['where']=qs[_0x506e('0x39')](_[_0x506e('0x3f')](_0x80b7fb[_0x506e('0x38')],_0x47f9d4[_0x506e('0x39')]),_0x1e8f13);if(_0x80b7fb[_0x506e('0x38')][_0x506e('0x40')]){_0x4e96c1['where']=_[_0x506e('0x41')](_0x4e96c1[_0x506e('0x42')],{'$or':_[_0x506e('0x32')](_0x1e8f13,function(_0x4d5825){if(_0x4d5825['type']!=='VIRTUAL'){var _0x243624={};_0x243624[_0x4d5825[_0x506e('0x2f')]]={'$like':'%'+_0x80b7fb[_0x506e('0x38')][_0x506e('0x40')]+'%'};return _0x243624;}})});}_0x4e96c1=_[_0x506e('0x41')]({},_0x4e96c1,_0x80b7fb[_0x506e('0x43')]);var _0x2b6312={'where':_0x4e96c1[_0x506e('0x42')]};return db[_0x506e('0x44')][_0x506e('0x25')](_0x2b6312)['then'](function(_0x48f0f4){_0x14c028['count']=_0x48f0f4;if(_0x80b7fb[_0x506e('0x38')]['includeAll']){_0x4e96c1['include']=[{'all':!![]}];}return db[_0x506e('0x44')][_0x506e('0x45')](_0x4e96c1);})['then'](function(_0x59f652){_0x14c028[_0x506e('0x46')]=_0x59f652;return _0x14c028;})['then'](respondWithFilteredResult(_0x33da2f,_0x4e96c1))['catch'](handleError(_0x33da2f,null));};exports[_0x506e('0x47')]=function(_0x21c5ac,_0x4a77aa){var _0x179758={'raw':!![],'where':{'id':_0x21c5ac['params']['id']}},_0x28f579={};_0x28f579[_0x506e('0x36')]=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x28f579[_0x506e('0x38')]=_[_0x506e('0x37')](_0x21c5ac[_0x506e('0x38')]);_0x28f579['filters']=_['intersection'](_0x28f579[_0x506e('0x36')],_0x28f579[_0x506e('0x38')]);_0x179758[_0x506e('0x3b')]=_[_0x506e('0x3a')](_0x28f579[_0x506e('0x36')],qs[_0x506e('0x3c')](_0x21c5ac[_0x506e('0x38')][_0x506e('0x3c')]));_0x179758['attributes']=_0x179758[_0x506e('0x3b')][_0x506e('0x3d')]?_0x179758[_0x506e('0x3b')]:_0x28f579[_0x506e('0x36')];if(_0x21c5ac[_0x506e('0x38')][_0x506e('0x48')]){_0x179758[_0x506e('0x49')]=[{'all':!![]}];}_0x179758=_['merge']({},_0x179758,_0x21c5ac[_0x506e('0x43')]);return db[_0x506e('0x44')][_0x506e('0x4a')](_0x179758)['then'](handleEntityNotFound(_0x4a77aa,null))['then'](respondWithResult(_0x4a77aa,null))[_0x506e('0x4b')](handleError(_0x4a77aa,null));};exports[_0x506e('0x4c')]=function(_0x45155f,_0x254bb1){return db[_0x506e('0x44')]['create'](_0x45155f[_0x506e('0x4d')],{})[_0x506e('0x2a')](function(_0x1a520f){var _0x4bd458=_0x45155f['user'][_0x506e('0x2b')]({'plain':!![]});if(!_0x4bd458)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bd458[_0x506e('0x4e')]===_0x506e('0x4f')){var _0x3b060a=_0x1a520f[_0x506e('0x2b')]({'plain':!![]});var _0x7c3638=_0x506e('0x2c');return db[_0x506e('0x50')][_0x506e('0x4a')]({'where':{'name':_0x7c3638,'userProfileId':_0x4bd458['userProfileId']},'raw':!![]})[_0x506e('0x2a')](function(_0x304b84){if(_0x304b84&&_0x304b84[_0x506e('0x51')]===0x0){return db[_0x506e('0x2d')]['create']({'name':_0x3b060a['name'],'resourceId':_0x3b060a['id'],'type':_0x304b84['name'],'sectionId':_0x304b84['id']},{})[_0x506e('0x2a')](function(){return _0x1a520f;});}else{return _0x1a520f;}})[_0x506e('0x4b')](function(_0x2c7333){logger[_0x506e('0x52')](_0x506e('0x53'),_0x2c7333);throw _0x2c7333;});}return _0x1a520f;})['then'](respondWithResult(_0x254bb1,0xc9))[_0x506e('0x4b')](handleError(_0x254bb1,null));};exports[_0x506e('0x54')]=function(_0x58d0fc,_0x31e96c){if(_0x58d0fc[_0x506e('0x4d')]['id']){delete _0x58d0fc[_0x506e('0x4d')]['id'];}return db[_0x506e('0x44')][_0x506e('0x4a')]({'where':{'id':_0x58d0fc[_0x506e('0x55')]['id']}})[_0x506e('0x2a')](handleEntityNotFound(_0x31e96c,null))[_0x506e('0x2a')](saveUpdates(_0x58d0fc[_0x506e('0x4d')],null))[_0x506e('0x2a')](respondWithResult(_0x31e96c,null))['catch'](handleError(_0x31e96c,null));};exports[_0x506e('0x2e')]=function(_0x116f2c,_0x1603cc){return db[_0x506e('0x44')][_0x506e('0x4a')]({'where':{'id':_0x116f2c[_0x506e('0x55')]['id']}})[_0x506e('0x2a')](handleEntityNotFound(_0x1603cc,null))[_0x506e('0x2a')](removeEntity(_0x1603cc,null))[_0x506e('0x4b')](handleError(_0x1603cc,null));};exports['describe']=function(_0x6a4708,_0x1a191a){return db[_0x506e('0x44')]['describe']()[_0x506e('0x2a')](respondWithResult(_0x1a191a,null))['catch'](handleError(_0x1a191a,null));};exports[_0x506e('0x56')]=function(_0x94d554,_0x5d7ec1,_0x3b116a){var _0x47925d={'raw':!![],'where':{}},_0x2b0052={},_0x266496;return db['WhatsappQueue']['findOne']({'where':{'id':_0x94d554[_0x506e('0x55')]['id']}})['then'](handleEntityNotFound(_0x5d7ec1,null))[_0x506e('0x2a')](function(_0x24a33c){if(_0x24a33c){_0x266496=_0x24a33c[_0x506e('0x2b')]({'plain':!![]});_0x2b0052['model']=_[_0x506e('0x37')](db[_0x506e('0x57')]['rawAttributes']);_0x2b0052[_0x506e('0x38')]=_[_0x506e('0x37')](_0x94d554[_0x506e('0x38')]);_0x2b0052[_0x506e('0x39')]=_[_0x506e('0x3a')](_0x2b0052[_0x506e('0x36')],_0x2b0052[_0x506e('0x38')]);_0x47925d['attributes']=_[_0x506e('0x3a')](_0x2b0052[_0x506e('0x36')],qs[_0x506e('0x3c')](_0x94d554[_0x506e('0x38')][_0x506e('0x3c')]));_0x47925d[_0x506e('0x3b')]=_0x47925d[_0x506e('0x3b')][_0x506e('0x3d')]?_0x47925d['attributes']:_0x2b0052[_0x506e('0x36')];if(!_0x94d554[_0x506e('0x38')][_0x506e('0x3e')](_0x506e('0x58'))){_0x47925d['limit']=qs[_0x506e('0x23')](_0x94d554['query'][_0x506e('0x23')]);_0x47925d[_0x506e('0x22')]=qs[_0x506e('0x22')](_0x94d554[_0x506e('0x38')][_0x506e('0x22')]);}_0x47925d[_0x506e('0x59')]=qs[_0x506e('0x5a')](_0x94d554[_0x506e('0x38')][_0x506e('0x5a')]);_0x47925d[_0x506e('0x42')]=qs[_0x506e('0x39')](_[_0x506e('0x3f')](_0x94d554[_0x506e('0x38')],_0x2b0052[_0x506e('0x39')]));_0x47925d[_0x506e('0x42')][_0x506e('0x5b')]=_0x24a33c['id'];if(_0x94d554[_0x506e('0x38')][_0x506e('0x40')]){_0x47925d[_0x506e('0x42')]=_[_0x506e('0x41')](_0x47925d[_0x506e('0x42')],{'$or':_[_0x506e('0x32')](_0x47925d[_0x506e('0x3b')],function(_0x48d1d1){var _0x3a00e={};_0x3a00e[_0x48d1d1]={'$like':'%'+_0x94d554[_0x506e('0x38')][_0x506e('0x40')]+'%'};return _0x3a00e;})});}_0x47925d=_['merge']({},_0x47925d,_0x94d554[_0x506e('0x43')]);return db[_0x506e('0x57')]['findAll'](_0x47925d);}})[_0x506e('0x2a')](function(_0xebc93){if(_0xebc93){return db[_0x506e('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0xebc93,'UserId'),'role':'agent'},'attributes':['id',_0x506e('0x2f'),'whatsappPause',_0x506e('0x5d'),'createdAt']});}})['then'](function(_0x69ec41){if(_0x69ec41){return{'count':_0x69ec41['count'],'rows':_[_0x506e('0x32')](_0x69ec41['rows'],function(_0x2a0329){return{'membername':_0x2a0329[_0x506e('0x2f')],'UserId':_0x2a0329['id'],'queue_name':_0x266496[_0x506e('0x2f')],'WhatsappQueueId':_0x266496['id'],'interface':util[_0x506e('0x5e')](_0x506e('0x5f'),_0x506e('0x60'),_0x2a0329[_0x506e('0x2f')]),'penalty':0x0,'paused':_0x2a0329[_0x506e('0x61')],'createdAt':_0x2a0329[_0x506e('0x62')],'updatedAt':_0x2a0329['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x506e('0x2a')](respondWithFilteredResult(_0x5d7ec1,_0x47925d))[_0x506e('0x4b')](handleError(_0x5d7ec1,null));};exports[_0x506e('0x63')]=function(_0x54674d,_0x119d78,_0x31dae1){var _0x5514ca={};var _0x3af224={};var _0x1cb9e6;var _0x5521a3;return db['WhatsappQueue'][_0x506e('0x64')]({'where':{'id':_0x54674d[_0x506e('0x55')]['id']}})[_0x506e('0x2a')](handleEntityNotFound(_0x119d78,null))[_0x506e('0x2a')](function(_0x3f455e){if(_0x3f455e){_0x1cb9e6=_0x3f455e;_0x3af224[_0x506e('0x36')]=_[_0x506e('0x37')](db[_0x506e('0x65')][_0x506e('0x66')]);_0x3af224[_0x506e('0x38')]=_[_0x506e('0x37')](_0x54674d['query']);_0x3af224['filters']=_['intersection'](_0x3af224[_0x506e('0x36')],_0x3af224['query']);_0x5514ca[_0x506e('0x3b')]=_[_0x506e('0x3a')](_0x3af224[_0x506e('0x36')],qs[_0x506e('0x3c')](_0x54674d['query']['fields']));_0x5514ca[_0x506e('0x3b')]=_0x5514ca[_0x506e('0x3b')][_0x506e('0x3d')]?_0x5514ca[_0x506e('0x3b')]:_0x3af224[_0x506e('0x36')];_0x5514ca[_0x506e('0x59')]=qs['sort'](_0x54674d[_0x506e('0x38')][_0x506e('0x5a')]);_0x5514ca[_0x506e('0x42')]=qs[_0x506e('0x39')](_['pick'](_0x54674d[_0x506e('0x38')],_0x3af224[_0x506e('0x39')]));if(_0x54674d[_0x506e('0x38')]['filter']){_0x5514ca[_0x506e('0x42')]=_[_0x506e('0x41')](_0x5514ca['where'],{'$or':_['map'](_0x5514ca[_0x506e('0x3b')],function(_0x3a8596){var _0x5e552a={};_0x5e552a[_0x3a8596]={'$like':'%'+_0x54674d['query'][_0x506e('0x40')]+'%'};return _0x5e552a;})});}_0x5514ca=_[_0x506e('0x41')]({},_0x5514ca,_0x54674d[_0x506e('0x43')]);return _0x1cb9e6[_0x506e('0x63')](_0x5514ca);}})[_0x506e('0x2a')](function(_0x284a84){if(_0x284a84){_0x5521a3=_0x284a84[_0x506e('0x3d')];if(!_0x54674d[_0x506e('0x38')][_0x506e('0x3e')]('nolimit')){_0x5514ca[_0x506e('0x23')]=qs[_0x506e('0x23')](_0x54674d[_0x506e('0x38')][_0x506e('0x23')]);_0x5514ca[_0x506e('0x22')]=qs[_0x506e('0x22')](_0x54674d['query']['offset']);}return _0x1cb9e6['getTeams'](_0x5514ca);}})['then'](function(_0x5dcef9){if(_0x5dcef9){return _0x5dcef9?{'count':_0x5521a3,'rows':_0x5dcef9}:null;}})[_0x506e('0x2a')](respondWithResult(_0x119d78,null))[_0x506e('0x4b')](handleError(_0x119d78,null));};exports['addTeams']=function(_0x2e59ef,_0x4f1538,_0x4bc27c){var _0x443e15=_0x2e59ef[_0x506e('0x4d')]['ids'];return db[_0x506e('0x65')][_0x506e('0x45')]({'where':{'id':_0x443e15},'attributes':['id'],'include':[{'model':db[_0x506e('0x5c')],'as':'Agents','attributes':['id',_0x506e('0x2f'),_0x506e('0x67'),'voicePause',_0x506e('0x68')],'raw':!![]}]})[_0x506e('0x2a')](function(_0x7b0e64){if(_0x7b0e64){var _0x50e10b=_[_0x506e('0x69')](_0x7b0e64,function(_0x5d07d8){var _0x3b08f2=_0x5d07d8[_0x506e('0x2b')]({'plain':!![]});return _0x3b08f2['Agents'];});return db[_0x506e('0x44')][_0x506e('0x4a')]({'where':{'id':_0x2e59ef[_0x506e('0x55')]['id']}})[_0x506e('0x2a')](function(_0x35ddce){return db[_0x506e('0x6a')][_0x506e('0x6b')](function(_0x4c7fb9){return _0x35ddce[_0x506e('0x6c')](_0x443e15,{'transaction':_0x4c7fb9})[_0x506e('0x2a')](function(){return BPromise['each'](_0x50e10b,function(_0x50ef91){return db[_0x506e('0x57')]['findOrCreate']({'where':{'UserId':_0x50ef91['id'],'WhatsappQueueId':_0x2e59ef['params']['id']},'transaction':_0x4c7fb9});});})[_0x506e('0x2a')](function(){_0x50e10b['forEach'](function(_0x2856ef){socket['emit'](_0x506e('0x6d'),{'UserId':_0x2856ef['id'],'WhatsappQueueId':_0x35ddce['id']});});});});});}})[_0x506e('0x2a')](respondWithStatusCode(_0x4f1538,null))['catch'](handleError(_0x4f1538,null));};exports[_0x506e('0x6e')]=function(_0x3a4d62,_0x3debee,_0x2810a1){return db[_0x506e('0x65')]['findAll']({'where':{'id':_0x3a4d62[_0x506e('0x38')][_0x506e('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x506e('0x5c')],'as':_0x506e('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3debee,null))['then'](function(_0x3e5dd7){var _0x551f8e=_[_0x506e('0x32')](_0x3e5dd7,'id');var _0x3a3056=[];var _0x2f7654=[];var _0x443932=squel['select']();_0x443932[_0x506e('0x71')]('tq.TeamId')[_0x506e('0x72')]('team_has_whatsapp_queues','tq')[_0x506e('0x73')](_0x506e('0x74'),'ut',_0x506e('0x75'))['where'](_0x506e('0x76'),_0x3a4d62[_0x506e('0x55')]['id']);for(var _0x3f42fa=0x0;_0x3f42fa<_0x3e5dd7[_0x506e('0x3d')];_0x3f42fa+=0x1){let _0x5b24ee=_0x3e5dd7[_0x3f42fa];for(var _0x2fe2b2=0x0;_0x2fe2b2<_0x5b24ee[_0x506e('0x70')][_0x506e('0x3d')];_0x2fe2b2+=0x1){let _0x13a9e0=_0x5b24ee[_0x506e('0x70')][_0x2fe2b2];var _0x646aca=_0x443932[_0x506e('0x77')]();_0x646aca[_0x506e('0x42')](_0x506e('0x78'),_0x13a9e0['id']);_0x2f7654[_0x506e('0x79')](db[_0x506e('0x6a')][_0x506e('0x38')](_0x646aca[_0x506e('0x7a')](),{'type':db[_0x506e('0x6a')][_0x506e('0x7b')][_0x506e('0x7c')]})[_0x506e('0x2a')](function(_0x336b91){if(_0x336b91[_0x506e('0x3d')]===0x1){return _0x13a9e0['id'];}else{var _0x4d6e81=_[_0x506e('0x7d')](_['map'](_0x336b91,_0x506e('0x7e')),function(_0x208e10){return _[_0x506e('0x7f')](_0x551f8e,_0x208e10);});if(_0x4d6e81){return _0x13a9e0['id'];}}}));}}return BPromise['all'](_0x2f7654)[_0x506e('0x2a')](function(_0x291a98){_0x3a3056=_(_0x3a3056)[_0x506e('0x80')](_0x291a98)[_0x506e('0x81')]()[_0x506e('0x82')]();return db[_0x506e('0x44')][_0x506e('0x4a')]({'where':{'id':_0x3a4d62[_0x506e('0x55')]['id']}})[_0x506e('0x2a')](function(_0x2737cd){return db[_0x506e('0x6a')][_0x506e('0x6b')](function(_0x505514){return _0x2737cd[_0x506e('0x6e')](_0x3a4d62[_0x506e('0x38')]['ids'],{'transaction':_0x505514})[_0x506e('0x2a')](function(){if(!_[_0x506e('0x83')](_0x3a3056)){return _0x2737cd[_0x506e('0x84')](_0x3a3056,{'transaction':_0x505514});}})['then'](function(){_0x3a3056[_0x506e('0x85')](function(_0x22be74){socket[_0x506e('0x86')]('userWhatsappQueue:remove',{'UserId':_0x22be74,'WhatsappQueueId':_0x2737cd['id']});});});});});});})[_0x506e('0x2a')](respondWithStatusCode(_0x3debee,null))[_0x506e('0x4b')](handleError(_0x3debee,null));};exports['addAgents']=function(_0x3af42d,_0x2b5c0c,_0x338ddf){return db[_0x506e('0x44')]['find']({'where':{'id':_0x3af42d[_0x506e('0x55')]['id']}})[_0x506e('0x2a')](handleEntityNotFound(_0x2b5c0c,null))[_0x506e('0x2a')](function(_0x5904f0){if(_0x5904f0){return _0x5904f0[_0x506e('0x87')](_0x3af42d[_0x506e('0x4d')][_0x506e('0x6f')],_['omit'](_0x3af42d[_0x506e('0x4d')],[_0x506e('0x6f'),'id'])||{})[_0x506e('0x88')](function(_0x3f22ae){for(var _0x3cce8b=0x0;_0x3cce8b<_0x3af42d['body']['ids'][_0x506e('0x3d')];_0x3cce8b+=0x1){socket[_0x506e('0x86')](_0x506e('0x6d'),{'UserId':Number(_0x3af42d[_0x506e('0x4d')]['ids'][_0x3cce8b]),'WhatsappQueueId':Number(_0x3af42d['params']['id'])});}return _0x3f22ae;});}})[_0x506e('0x2a')](respondWithResult(_0x2b5c0c,null))[_0x506e('0x4b')](handleError(_0x2b5c0c,null));};exports[_0x506e('0x84')]=function(_0x57d640,_0x4e7ae3,_0x599811){return db[_0x506e('0x44')][_0x506e('0x4a')]({'where':{'id':_0x57d640[_0x506e('0x55')]['id']}})['then'](handleEntityNotFound(_0x4e7ae3,null))['then'](function(_0x131a84){if(_0x131a84){return _0x131a84[_0x506e('0x84')](_0x57d640[_0x506e('0x38')][_0x506e('0x6f')])['then'](function(){if(_[_0x506e('0x89')](_0x57d640[_0x506e('0x38')][_0x506e('0x6f')])){for(var _0xebfe2e=0x0;_0xebfe2e<_0x57d640[_0x506e('0x38')][_0x506e('0x6f')][_0x506e('0x3d')];_0xebfe2e+=0x1){socket[_0x506e('0x86')](_0x506e('0x8a'),{'UserId':Number(_0x57d640[_0x506e('0x38')][_0x506e('0x6f')][_0xebfe2e]),'WhatsappQueueId':Number(_0x57d640[_0x506e('0x55')]['id'])});}}else{socket[_0x506e('0x86')]('userWhatsappQueue:remove',{'UserId':Number(_0x57d640[_0x506e('0x38')][_0x506e('0x6f')]),'WhatsappQueueId':Number(_0x57d640[_0x506e('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e7ae3,null))[_0x506e('0x4b')](handleError(_0x4e7ae3,null));};exports[_0x506e('0x8b')]=function(_0xc51756,_0x3f28a8,_0x365979){var _0x5b22ea={};var _0xed6dd3={};var _0x300d48;var _0x547029;return db[_0x506e('0x44')][_0x506e('0x64')]({'where':{'id':_0xc51756['params']['id']}})['then'](handleEntityNotFound(_0x3f28a8,null))[_0x506e('0x2a')](function(_0x48d895){if(_0x48d895){_0x300d48=_0x48d895;_0xed6dd3['model']=_[_0x506e('0x37')](db['User'][_0x506e('0x66')]);_0xed6dd3[_0x506e('0x38')]=_[_0x506e('0x37')](_0xc51756['query']);_0xed6dd3[_0x506e('0x39')]=_[_0x506e('0x3a')](_0xed6dd3[_0x506e('0x36')],_0xed6dd3[_0x506e('0x38')]);_0x5b22ea[_0x506e('0x3b')]=_[_0x506e('0x3a')](_0xed6dd3[_0x506e('0x36')],qs[_0x506e('0x3c')](_0xc51756[_0x506e('0x38')][_0x506e('0x3c')]));_0x5b22ea[_0x506e('0x3b')]=_0x5b22ea[_0x506e('0x3b')][_0x506e('0x3d')]?_0x5b22ea['attributes']:_0xed6dd3['model'];_0x5b22ea[_0x506e('0x59')]=qs[_0x506e('0x5a')](_0xc51756[_0x506e('0x38')][_0x506e('0x5a')]);_0x5b22ea['where']=qs[_0x506e('0x39')](_[_0x506e('0x3f')](_0xc51756[_0x506e('0x38')],_0xed6dd3['filters']));if(_0xc51756[_0x506e('0x38')][_0x506e('0x40')]){_0x5b22ea[_0x506e('0x42')]=_[_0x506e('0x41')](_0x5b22ea['where'],{'$or':_[_0x506e('0x32')](_0x5b22ea[_0x506e('0x3b')],function(_0xf02ac){var _0x3d447a={};_0x3d447a[_0xf02ac]={'$like':'%'+_0xc51756[_0x506e('0x38')][_0x506e('0x40')]+'%'};return _0x3d447a;})});}_0x5b22ea=_[_0x506e('0x41')]({},_0x5b22ea,_0xc51756[_0x506e('0x43')]);return _0x300d48['getAgents'](_0x5b22ea);}})[_0x506e('0x2a')](function(_0x1c24e6){if(_0x1c24e6){_0x547029=_0x1c24e6[_0x506e('0x3d')];if(!_0xc51756[_0x506e('0x38')][_0x506e('0x3e')](_0x506e('0x58'))){_0x5b22ea[_0x506e('0x23')]=qs[_0x506e('0x23')](_0xc51756['query'][_0x506e('0x23')]);_0x5b22ea['offset']=qs['offset'](_0xc51756[_0x506e('0x38')][_0x506e('0x22')]);}return _0x300d48[_0x506e('0x8b')](_0x5b22ea);}})[_0x506e('0x2a')](function(_0x112f88){if(_0x112f88){return _0x112f88?{'count':_0x547029,'rows':_0x112f88}:null;}})[_0x506e('0x2a')](respondWithResult(_0x3f28a8,null))[_0x506e('0x4b')](handleError(_0x3f28a8,null));};
\ No newline at end of file
+var _0xb410=['format','whatsappPause','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','select','tq.TeamId','from','join','clone','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','map','WhatsappQueue','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt'];(function(_0x13def3,_0x369c74){var _0x4a323f=function(_0x18b86f){while(--_0x18b86f){_0x13def3['push'](_0x13def3['shift']());}};_0x4a323f(++_0x369c74);}(_0xb410,0x1ca));var _0x0b41=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb410[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b41('0x0'));var zipdir=require(_0x0b41('0x1'));var jsonpatch=require(_0x0b41('0x2'));var rp=require(_0x0b41('0x3'));var moment=require(_0x0b41('0x4'));var BPromise=require(_0x0b41('0x5'));var Mustache=require(_0x0b41('0x6'));var util=require('util');var path=require(_0x0b41('0x7'));var sox=require(_0x0b41('0x8'));var csv=require(_0x0b41('0x9'));var ejs=require(_0x0b41('0xa'));var fs=require('fs');var fs_extra=require(_0x0b41('0xb'));var _=require(_0x0b41('0xc'));var squel=require(_0x0b41('0xd'));var crypto=require(_0x0b41('0xe'));var jsforce=require(_0x0b41('0xf'));var deskjs=require(_0x0b41('0x10'));var toCsv=require(_0x0b41('0x9'));var querystring=require(_0x0b41('0x11'));var Papa=require(_0x0b41('0x12'));var Redis=require(_0x0b41('0x13'));var authService=require(_0x0b41('0x14'));var qs=require(_0x0b41('0x15'));var as=require(_0x0b41('0x16'));var hardwareService=require(_0x0b41('0x17'));var logger=require(_0x0b41('0x18'))(_0x0b41('0x19'));var utils=require('../../config/utils');var config=require(_0x0b41('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b41('0x1b'))['db'];config[_0x0b41('0x1c')]=_[_0x0b41('0x1d')](config[_0x0b41('0x1c')],{'host':_0x0b41('0x1e'),'port':0x18eb});var socket=require(_0x0b41('0x1f'))(new Redis(config[_0x0b41('0x1c')]));require(_0x0b41('0x20'))['register'](socket);function respondWithStatusCode(_0x3c2c82,_0x408f1b){_0x408f1b=_0x408f1b||0xcc;return function(_0x2b3740){if(_0x2b3740){return _0x3c2c82[_0x0b41('0x21')](_0x408f1b);}return _0x3c2c82[_0x0b41('0x22')](_0x408f1b)[_0x0b41('0x23')]();};}function respondWithResult(_0x31dd2b,_0x497c64){_0x497c64=_0x497c64||0xc8;return function(_0x55682d){if(_0x55682d){return _0x31dd2b['status'](_0x497c64)[_0x0b41('0x24')](_0x55682d);}};}function respondWithFilteredResult(_0x1e60c8,_0xabbfbf){return function(_0x38d429){if(_0x38d429){var _0x1c6a8b=typeof _0xabbfbf[_0x0b41('0x25')]===_0x0b41('0x26')&&typeof _0xabbfbf['limit']===_0x0b41('0x26');var _0x120064=_0x38d429[_0x0b41('0x27')];var _0x573719=_0x1c6a8b?0x0:_0xabbfbf[_0x0b41('0x25')];var _0x5ed5be=_0x1c6a8b?_0x38d429['count']:_0xabbfbf[_0x0b41('0x25')]+_0xabbfbf[_0x0b41('0x28')];var _0xc1a622;if(_0x5ed5be>=_0x120064){_0x5ed5be=_0x120064;_0xc1a622=0xc8;}else{_0xc1a622=0xce;}_0x1e60c8[_0x0b41('0x22')](_0xc1a622);return _0x1e60c8[_0x0b41('0x29')]('Content-Range',_0x573719+'-'+_0x5ed5be+'/'+_0x120064)[_0x0b41('0x24')](_0x38d429);}return null;};}function patchUpdates(_0x541d75){return function(_0x1c6740){try{jsonpatch[_0x0b41('0x2a')](_0x1c6740,_0x541d75,!![]);}catch(_0x2006ed){return BPromise['reject'](_0x2006ed);}return _0x1c6740[_0x0b41('0x2b')]();};}function saveUpdates(_0x934a1,_0x414525){return function(_0x4fc48c){if(_0x4fc48c){return _0x4fc48c[_0x0b41('0x2c')](_0x934a1)[_0x0b41('0x2d')](function(_0x25dbdf){return _0x25dbdf;});}return null;};}function removeEntity(_0x5a7a7d,_0xe0055a){return function(_0xff8e03){if(_0xff8e03){return _0xff8e03[_0x0b41('0x2e')]()[_0x0b41('0x2d')](function(){var _0x4c39c8=_0xff8e03[_0x0b41('0x2f')]({'plain':!![]});var _0x8a217a=_0x0b41('0x30');return db[_0x0b41('0x31')][_0x0b41('0x2e')]({'where':{'type':_0x8a217a,'resourceId':_0x4c39c8['id']}})[_0x0b41('0x2d')](function(){return _0xff8e03;});})[_0x0b41('0x2d')](function(){_0x5a7a7d[_0x0b41('0x22')](0xcc)[_0x0b41('0x23')]();});}};}function handleEntityNotFound(_0xa8eb7,_0x1e020f){return function(_0x50ef5c){if(!_0x50ef5c){_0xa8eb7['sendStatus'](0x194);}return _0x50ef5c;};}function handleError(_0x1382d2,_0x5e36c7){_0x5e36c7=_0x5e36c7||0x1f4;return function(_0xa605a9){logger[_0x0b41('0x32')](_0xa605a9[_0x0b41('0x33')]);if(_0xa605a9[_0x0b41('0x34')]){delete _0xa605a9[_0x0b41('0x34')];}_0x1382d2[_0x0b41('0x22')](_0x5e36c7)['send'](_0xa605a9);};}exports['index']=function(_0x329065,_0x54fe5b){var _0x13cf89={},_0x486515={},_0x131217={'count':0x0,'rows':[]};var _0x5f3729=_[_0x0b41('0x35')](db[_0x0b41('0x36')]['rawAttributes'],function(_0x567640){return{'name':_0x567640[_0x0b41('0x37')],'type':_0x567640[_0x0b41('0x38')]['key']};});_0x486515['model']=_['map'](_0x5f3729,_0x0b41('0x34'));_0x486515[_0x0b41('0x39')]=_[_0x0b41('0x3a')](_0x329065['query']);_0x486515[_0x0b41('0x3b')]=_[_0x0b41('0x3c')](_0x486515[_0x0b41('0x3d')],_0x486515[_0x0b41('0x39')]);_0x13cf89['attributes']=_[_0x0b41('0x3c')](_0x486515[_0x0b41('0x3d')],qs['fields'](_0x329065[_0x0b41('0x39')]['fields']));_0x13cf89[_0x0b41('0x3e')]=_0x13cf89[_0x0b41('0x3e')][_0x0b41('0x3f')]?_0x13cf89[_0x0b41('0x3e')]:_0x486515['model'];if(!_0x329065[_0x0b41('0x39')][_0x0b41('0x40')]('nolimit')){_0x13cf89[_0x0b41('0x28')]=qs[_0x0b41('0x28')](_0x329065[_0x0b41('0x39')]['limit']);_0x13cf89[_0x0b41('0x25')]=qs[_0x0b41('0x25')](_0x329065[_0x0b41('0x39')][_0x0b41('0x25')]);}_0x13cf89[_0x0b41('0x41')]=qs[_0x0b41('0x42')](_0x329065[_0x0b41('0x39')][_0x0b41('0x42')]);_0x13cf89[_0x0b41('0x43')]=qs[_0x0b41('0x3b')](_[_0x0b41('0x44')](_0x329065[_0x0b41('0x39')],_0x486515[_0x0b41('0x3b')]),_0x5f3729);if(_0x329065[_0x0b41('0x39')][_0x0b41('0x45')]){_0x13cf89[_0x0b41('0x43')]=_['merge'](_0x13cf89['where'],{'$or':_[_0x0b41('0x35')](_0x5f3729,function(_0x114c89){if(_0x114c89[_0x0b41('0x38')]!==_0x0b41('0x46')){var _0x2225b4={};_0x2225b4[_0x114c89[_0x0b41('0x34')]]={'$like':'%'+_0x329065[_0x0b41('0x39')][_0x0b41('0x45')]+'%'};return _0x2225b4;}})});}_0x13cf89=_[_0x0b41('0x47')]({},_0x13cf89,_0x329065[_0x0b41('0x48')]);var _0x43caa6={'where':_0x13cf89['where']};return db[_0x0b41('0x36')][_0x0b41('0x27')](_0x43caa6)[_0x0b41('0x2d')](function(_0x34e4b3){_0x131217[_0x0b41('0x27')]=_0x34e4b3;if(_0x329065[_0x0b41('0x39')][_0x0b41('0x49')]){_0x13cf89['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0x0b41('0x4a')](_0x13cf89);})['then'](function(_0x3fc764){_0x131217[_0x0b41('0x4b')]=_0x3fc764;return _0x131217;})[_0x0b41('0x2d')](respondWithFilteredResult(_0x54fe5b,_0x13cf89))[_0x0b41('0x4c')](handleError(_0x54fe5b,null));};exports[_0x0b41('0x4d')]=function(_0x1517bf,_0x2c3e8b){var _0x178f28={'raw':!![],'where':{'id':_0x1517bf[_0x0b41('0x4e')]['id']}},_0x3b53ad={};_0x3b53ad[_0x0b41('0x3d')]=_['keys'](db[_0x0b41('0x36')][_0x0b41('0x4f')]);_0x3b53ad[_0x0b41('0x39')]=_[_0x0b41('0x3a')](_0x1517bf[_0x0b41('0x39')]);_0x3b53ad[_0x0b41('0x3b')]=_['intersection'](_0x3b53ad['model'],_0x3b53ad[_0x0b41('0x39')]);_0x178f28[_0x0b41('0x3e')]=_[_0x0b41('0x3c')](_0x3b53ad['model'],qs[_0x0b41('0x50')](_0x1517bf[_0x0b41('0x39')][_0x0b41('0x50')]));_0x178f28['attributes']=_0x178f28[_0x0b41('0x3e')][_0x0b41('0x3f')]?_0x178f28[_0x0b41('0x3e')]:_0x3b53ad['model'];if(_0x1517bf[_0x0b41('0x39')][_0x0b41('0x49')]){_0x178f28[_0x0b41('0x51')]=[{'all':!![]}];}_0x178f28=_['merge']({},_0x178f28,_0x1517bf['options']);return db[_0x0b41('0x36')][_0x0b41('0x52')](_0x178f28)[_0x0b41('0x2d')](handleEntityNotFound(_0x2c3e8b,null))[_0x0b41('0x2d')](respondWithResult(_0x2c3e8b,null))[_0x0b41('0x4c')](handleError(_0x2c3e8b,null));};exports[_0x0b41('0x53')]=function(_0x28e2dd,_0x3a52ca){return db['WhatsappQueue'][_0x0b41('0x53')](_0x28e2dd[_0x0b41('0x54')],{})[_0x0b41('0x2d')](function(_0x1fbac0){var _0x5eafdf=_0x28e2dd[_0x0b41('0x55')][_0x0b41('0x2f')]({'plain':!![]});if(!_0x5eafdf)throw new Error(_0x0b41('0x56'));if(_0x5eafdf[_0x0b41('0x57')]===_0x0b41('0x55')){var _0x58f5b6=_0x1fbac0[_0x0b41('0x2f')]({'plain':!![]});var _0x261927=_0x0b41('0x30');return db[_0x0b41('0x58')]['find']({'where':{'name':_0x261927,'userProfileId':_0x5eafdf['userProfileId']},'raw':!![]})[_0x0b41('0x2d')](function(_0x4f8fdc){if(_0x4f8fdc&&_0x4f8fdc[_0x0b41('0x59')]===0x0){return db[_0x0b41('0x31')][_0x0b41('0x53')]({'name':_0x58f5b6[_0x0b41('0x34')],'resourceId':_0x58f5b6['id'],'type':_0x4f8fdc[_0x0b41('0x34')],'sectionId':_0x4f8fdc['id']},{})[_0x0b41('0x2d')](function(){return _0x1fbac0;});}else{return _0x1fbac0;}})[_0x0b41('0x4c')](function(_0x4c4c80){logger[_0x0b41('0x32')](_0x0b41('0x5a'),_0x4c4c80);throw _0x4c4c80;});}return _0x1fbac0;})[_0x0b41('0x2d')](respondWithResult(_0x3a52ca,0xc9))[_0x0b41('0x4c')](handleError(_0x3a52ca,null));};exports['update']=function(_0x460346,_0x47ef60){if(_0x460346[_0x0b41('0x54')]['id']){delete _0x460346[_0x0b41('0x54')]['id'];}return db[_0x0b41('0x36')]['find']({'where':{'id':_0x460346['params']['id']}})[_0x0b41('0x2d')](handleEntityNotFound(_0x47ef60,null))[_0x0b41('0x2d')](saveUpdates(_0x460346[_0x0b41('0x54')],null))[_0x0b41('0x2d')](respondWithResult(_0x47ef60,null))[_0x0b41('0x4c')](handleError(_0x47ef60,null));};exports[_0x0b41('0x2e')]=function(_0x7fb8a8,_0x26b8f8){return db[_0x0b41('0x36')]['find']({'where':{'id':_0x7fb8a8[_0x0b41('0x4e')]['id']}})[_0x0b41('0x2d')](handleEntityNotFound(_0x26b8f8,null))[_0x0b41('0x2d')](removeEntity(_0x26b8f8,null))[_0x0b41('0x4c')](handleError(_0x26b8f8,null));};exports[_0x0b41('0x5b')]=function(_0x31cb9b,_0x6d6902){return db[_0x0b41('0x36')][_0x0b41('0x5b')]()[_0x0b41('0x2d')](respondWithResult(_0x6d6902,null))[_0x0b41('0x4c')](handleError(_0x6d6902,null));};exports[_0x0b41('0x5c')]=function(_0x4e5233,_0x22c2dd,_0xb9cf1f){var _0x5f4a47={'raw':!![],'where':{}},_0xb2e32d={},_0x396feb;return db[_0x0b41('0x36')][_0x0b41('0x5d')]({'where':{'id':_0x4e5233['params']['id']}})['then'](handleEntityNotFound(_0x22c2dd,null))['then'](function(_0x380350){if(_0x380350){_0x396feb=_0x380350['get']({'plain':!![]});_0xb2e32d[_0x0b41('0x3d')]=_[_0x0b41('0x3a')](db[_0x0b41('0x5e')]['rawAttributes']);_0xb2e32d[_0x0b41('0x39')]=_[_0x0b41('0x3a')](_0x4e5233[_0x0b41('0x39')]);_0xb2e32d[_0x0b41('0x3b')]=_['intersection'](_0xb2e32d[_0x0b41('0x3d')],_0xb2e32d[_0x0b41('0x39')]);_0x5f4a47[_0x0b41('0x3e')]=_[_0x0b41('0x3c')](_0xb2e32d[_0x0b41('0x3d')],qs[_0x0b41('0x50')](_0x4e5233[_0x0b41('0x39')][_0x0b41('0x50')]));_0x5f4a47[_0x0b41('0x3e')]=_0x5f4a47[_0x0b41('0x3e')]['length']?_0x5f4a47[_0x0b41('0x3e')]:_0xb2e32d[_0x0b41('0x3d')];if(!_0x4e5233[_0x0b41('0x39')][_0x0b41('0x40')](_0x0b41('0x5f'))){_0x5f4a47[_0x0b41('0x28')]=qs[_0x0b41('0x28')](_0x4e5233[_0x0b41('0x39')][_0x0b41('0x28')]);_0x5f4a47[_0x0b41('0x25')]=qs[_0x0b41('0x25')](_0x4e5233[_0x0b41('0x39')][_0x0b41('0x25')]);}_0x5f4a47[_0x0b41('0x41')]=qs[_0x0b41('0x42')](_0x4e5233[_0x0b41('0x39')]['sort']);_0x5f4a47[_0x0b41('0x43')]=qs[_0x0b41('0x3b')](_['pick'](_0x4e5233[_0x0b41('0x39')],_0xb2e32d[_0x0b41('0x3b')]));_0x5f4a47[_0x0b41('0x43')][_0x0b41('0x60')]=_0x380350['id'];if(_0x4e5233[_0x0b41('0x39')]['filter']){_0x5f4a47['where']=_[_0x0b41('0x47')](_0x5f4a47[_0x0b41('0x43')],{'$or':_['map'](_0x5f4a47[_0x0b41('0x3e')],function(_0x1bcfc5){var _0x26c663={};_0x26c663[_0x1bcfc5]={'$like':'%'+_0x4e5233['query'][_0x0b41('0x45')]+'%'};return _0x26c663;})});}_0x5f4a47=_['merge']({},_0x5f4a47,_0x4e5233[_0x0b41('0x48')]);return db[_0x0b41('0x5e')][_0x0b41('0x4a')](_0x5f4a47);}})['then'](function(_0x3b50ab){if(_0x3b50ab){return db[_0x0b41('0x61')][_0x0b41('0x62')]({'where':{'id':_[_0x0b41('0x35')](_0x3b50ab,_0x0b41('0x63')),'role':_0x0b41('0x64')},'attributes':['id','name','whatsappPause',_0x0b41('0x65'),'createdAt']});}})[_0x0b41('0x2d')](function(_0x4b7e28){if(_0x4b7e28){return{'count':_0x4b7e28[_0x0b41('0x27')],'rows':_['map'](_0x4b7e28[_0x0b41('0x4b')],function(_0x328e9e){return{'membername':_0x328e9e['name'],'UserId':_0x328e9e['id'],'queue_name':_0x396feb[_0x0b41('0x34')],'WhatsappQueueId':_0x396feb['id'],'interface':util[_0x0b41('0x66')]('%s/%s','SIP',_0x328e9e[_0x0b41('0x34')]),'penalty':0x0,'paused':_0x328e9e[_0x0b41('0x67')],'createdAt':_0x328e9e[_0x0b41('0x68')],'updatedAt':_0x328e9e[_0x0b41('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b41('0x2d')](respondWithFilteredResult(_0x22c2dd,_0x5f4a47))[_0x0b41('0x4c')](handleError(_0x22c2dd,null));};exports[_0x0b41('0x69')]=function(_0x5d99f2,_0xcb3707,_0xb86caf){var _0x5742b6={};var _0x20d108={};var _0x316f47;var _0x3e04cf;return db[_0x0b41('0x36')][_0x0b41('0x5d')]({'where':{'id':_0x5d99f2['params']['id']}})[_0x0b41('0x2d')](handleEntityNotFound(_0xcb3707,null))[_0x0b41('0x2d')](function(_0x37a7f5){if(_0x37a7f5){_0x316f47=_0x37a7f5;_0x20d108[_0x0b41('0x3d')]=_[_0x0b41('0x3a')](db[_0x0b41('0x6a')][_0x0b41('0x4f')]);_0x20d108['query']=_[_0x0b41('0x3a')](_0x5d99f2[_0x0b41('0x39')]);_0x20d108[_0x0b41('0x3b')]=_[_0x0b41('0x3c')](_0x20d108['model'],_0x20d108[_0x0b41('0x39')]);_0x5742b6[_0x0b41('0x3e')]=_[_0x0b41('0x3c')](_0x20d108[_0x0b41('0x3d')],qs['fields'](_0x5d99f2[_0x0b41('0x39')][_0x0b41('0x50')]));_0x5742b6['attributes']=_0x5742b6[_0x0b41('0x3e')][_0x0b41('0x3f')]?_0x5742b6[_0x0b41('0x3e')]:_0x20d108[_0x0b41('0x3d')];_0x5742b6[_0x0b41('0x41')]=qs[_0x0b41('0x42')](_0x5d99f2[_0x0b41('0x39')][_0x0b41('0x42')]);_0x5742b6['where']=qs['filters'](_[_0x0b41('0x44')](_0x5d99f2['query'],_0x20d108[_0x0b41('0x3b')]));if(_0x5d99f2['query'][_0x0b41('0x45')]){_0x5742b6['where']=_[_0x0b41('0x47')](_0x5742b6['where'],{'$or':_[_0x0b41('0x35')](_0x5742b6[_0x0b41('0x3e')],function(_0x4a0a42){var _0x2b889e={};_0x2b889e[_0x4a0a42]={'$like':'%'+_0x5d99f2[_0x0b41('0x39')][_0x0b41('0x45')]+'%'};return _0x2b889e;})});}_0x5742b6=_['merge']({},_0x5742b6,_0x5d99f2[_0x0b41('0x48')]);return _0x316f47[_0x0b41('0x69')](_0x5742b6);}})['then'](function(_0x276aae){if(_0x276aae){_0x3e04cf=_0x276aae[_0x0b41('0x3f')];if(!_0x5d99f2[_0x0b41('0x39')][_0x0b41('0x40')]('nolimit')){_0x5742b6['limit']=qs[_0x0b41('0x28')](_0x5d99f2[_0x0b41('0x39')][_0x0b41('0x28')]);_0x5742b6[_0x0b41('0x25')]=qs['offset'](_0x5d99f2[_0x0b41('0x39')][_0x0b41('0x25')]);}return _0x316f47['getTeams'](_0x5742b6);}})[_0x0b41('0x2d')](function(_0x560ce9){if(_0x560ce9){return _0x560ce9?{'count':_0x3e04cf,'rows':_0x560ce9}:null;}})['then'](respondWithResult(_0xcb3707,null))[_0x0b41('0x4c')](handleError(_0xcb3707,null));};exports[_0x0b41('0x6b')]=function(_0x23ff3a,_0x2e87a7,_0x18092d){var _0x54a17c=_0x23ff3a[_0x0b41('0x54')][_0x0b41('0x6c')];return db['Team'][_0x0b41('0x4a')]({'where':{'id':_0x54a17c},'attributes':['id'],'include':[{'model':db[_0x0b41('0x61')],'as':_0x0b41('0x6d'),'attributes':['id',_0x0b41('0x34'),_0x0b41('0x6e'),_0x0b41('0x6f'),_0x0b41('0x70')],'raw':!![]}]})[_0x0b41('0x2d')](function(_0x44273f){if(_0x44273f){var _0x560816=_['flatMap'](_0x44273f,function(_0x3b7f22){var _0x58dbfc=_0x3b7f22[_0x0b41('0x2f')]({'plain':!![]});return _0x58dbfc[_0x0b41('0x6d')];});return db['WhatsappQueue'][_0x0b41('0x52')]({'where':{'id':_0x23ff3a[_0x0b41('0x4e')]['id']}})[_0x0b41('0x2d')](function(_0x4d902c){return db[_0x0b41('0x71')][_0x0b41('0x72')](function(_0x3246ee){return _0x4d902c['addTeams'](_0x54a17c,{'transaction':_0x3246ee})[_0x0b41('0x2d')](function(){return BPromise[_0x0b41('0x73')](_0x560816,function(_0x23a6de){return db['UserWhatsappQueue'][_0x0b41('0x74')]({'where':{'UserId':_0x23a6de['id'],'WhatsappQueueId':_0x23ff3a[_0x0b41('0x4e')]['id']},'transaction':_0x3246ee});});})[_0x0b41('0x2d')](function(){_0x560816['forEach'](function(_0x915a20){socket['emit'](_0x0b41('0x75'),{'UserId':_0x915a20['id'],'WhatsappQueueId':_0x4d902c['id']});});});});});}})[_0x0b41('0x2d')](respondWithStatusCode(_0x2e87a7,null))[_0x0b41('0x4c')](handleError(_0x2e87a7,null));};exports['removeTeams']=function(_0x11d59b,_0x51cc6c,_0x48396d){return db['Team'][_0x0b41('0x4a')]({'where':{'id':_0x11d59b['query'][_0x0b41('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x0b41('0x61')],'as':_0x0b41('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51cc6c,null))[_0x0b41('0x2d')](function(_0x4e95cf){var _0x4f83f1=_[_0x0b41('0x35')](_0x4e95cf,'id');var _0x3a43a3=[];var _0x47ade4=[];var _0x362bdd=squel[_0x0b41('0x76')]();_0x362bdd['field'](_0x0b41('0x77'))[_0x0b41('0x78')]('team_has_whatsapp_queues','tq')[_0x0b41('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0b41('0x43')]('WhatsappQueueId\x20=\x20?',_0x11d59b['params']['id']);for(var _0x286c14=0x0;_0x286c14<_0x4e95cf[_0x0b41('0x3f')];_0x286c14+=0x1){let _0x543f44=_0x4e95cf[_0x286c14];for(var _0x53d233=0x0;_0x53d233<_0x543f44[_0x0b41('0x6d')][_0x0b41('0x3f')];_0x53d233+=0x1){let _0x123233=_0x543f44[_0x0b41('0x6d')][_0x53d233];var _0x15bd52=_0x362bdd[_0x0b41('0x7a')]();_0x15bd52[_0x0b41('0x43')]('ut.UserId\x20=\x20?',_0x123233['id']);_0x47ade4[_0x0b41('0x7b')](db[_0x0b41('0x71')]['query'](_0x15bd52[_0x0b41('0x7c')](),{'type':db[_0x0b41('0x71')][_0x0b41('0x7d')]['SELECT']})['then'](function(_0x37852a){if(_0x37852a['length']===0x1){return _0x123233['id'];}else{var _0x3e6426=_[_0x0b41('0x7e')](_[_0x0b41('0x35')](_0x37852a,'TeamId'),function(_0x141d95){return _[_0x0b41('0x7f')](_0x4f83f1,_0x141d95);});if(_0x3e6426){return _0x123233['id'];}}}));}}return BPromise[_0x0b41('0x80')](_0x47ade4)[_0x0b41('0x2d')](function(_0x5bbd29){_0x3a43a3=_(_0x3a43a3)[_0x0b41('0x81')](_0x5bbd29)[_0x0b41('0x82')]()['value']();return db[_0x0b41('0x36')][_0x0b41('0x52')]({'where':{'id':_0x11d59b[_0x0b41('0x4e')]['id']}})[_0x0b41('0x2d')](function(_0x47f599){return db[_0x0b41('0x71')][_0x0b41('0x72')](function(_0x3ce37e){return _0x47f599['removeTeams'](_0x11d59b[_0x0b41('0x39')][_0x0b41('0x6c')],{'transaction':_0x3ce37e})[_0x0b41('0x2d')](function(){if(!_[_0x0b41('0x83')](_0x3a43a3)){return _0x47f599[_0x0b41('0x84')](_0x3a43a3,{'transaction':_0x3ce37e});}})[_0x0b41('0x2d')](function(){_0x3a43a3[_0x0b41('0x85')](function(_0x2cdeb9){socket[_0x0b41('0x86')](_0x0b41('0x87'),{'UserId':_0x2cdeb9,'WhatsappQueueId':_0x47f599['id']});});});});});});})['then'](respondWithStatusCode(_0x51cc6c,null))[_0x0b41('0x4c')](handleError(_0x51cc6c,null));};exports[_0x0b41('0x88')]=function(_0x42ff69,_0x5e0a91,_0x57b660){return db[_0x0b41('0x36')][_0x0b41('0x52')]({'where':{'id':_0x42ff69[_0x0b41('0x4e')]['id']}})[_0x0b41('0x2d')](handleEntityNotFound(_0x5e0a91,null))['then'](function(_0x422dec){if(_0x422dec){return _0x422dec['addAgents'](_0x42ff69[_0x0b41('0x54')]['ids'],_[_0x0b41('0x89')](_0x42ff69['body'],[_0x0b41('0x6c'),'id'])||{})['spread'](function(_0x43a419){for(var _0x4ce2b3=0x0;_0x4ce2b3<_0x42ff69['body'][_0x0b41('0x6c')][_0x0b41('0x3f')];_0x4ce2b3+=0x1){socket[_0x0b41('0x86')]('userWhatsappQueue:save',{'UserId':Number(_0x42ff69['body'][_0x0b41('0x6c')][_0x4ce2b3]),'WhatsappQueueId':Number(_0x42ff69[_0x0b41('0x4e')]['id'])});}return _0x43a419;});}})[_0x0b41('0x2d')](respondWithResult(_0x5e0a91,null))['catch'](handleError(_0x5e0a91,null));};exports[_0x0b41('0x84')]=function(_0xa39fa9,_0x548885,_0x5509eb){return db[_0x0b41('0x36')][_0x0b41('0x52')]({'where':{'id':_0xa39fa9['params']['id']}})['then'](handleEntityNotFound(_0x548885,null))[_0x0b41('0x2d')](function(_0x4057f8){if(_0x4057f8){return _0x4057f8['removeAgents'](_0xa39fa9[_0x0b41('0x39')][_0x0b41('0x6c')])[_0x0b41('0x2d')](function(){if(_[_0x0b41('0x8a')](_0xa39fa9['query'][_0x0b41('0x6c')])){for(var _0x3c5a45=0x0;_0x3c5a45<_0xa39fa9[_0x0b41('0x39')][_0x0b41('0x6c')]['length'];_0x3c5a45+=0x1){socket[_0x0b41('0x86')](_0x0b41('0x87'),{'UserId':Number(_0xa39fa9[_0x0b41('0x39')]['ids'][_0x3c5a45]),'WhatsappQueueId':Number(_0xa39fa9[_0x0b41('0x4e')]['id'])});}}else{socket[_0x0b41('0x86')](_0x0b41('0x87'),{'UserId':Number(_0xa39fa9[_0x0b41('0x39')][_0x0b41('0x6c')]),'WhatsappQueueId':Number(_0xa39fa9[_0x0b41('0x4e')]['id'])});}});}})[_0x0b41('0x2d')](respondWithStatusCode(_0x548885,null))[_0x0b41('0x4c')](handleError(_0x548885,null));};exports[_0x0b41('0x8b')]=function(_0x1fc42d,_0x28aff0,_0x31d3b5){var _0x5b1e54={};var _0x3e30d9={};var _0x2bb351;var _0x1e2a22;return db['WhatsappQueue'][_0x0b41('0x5d')]({'where':{'id':_0x1fc42d[_0x0b41('0x4e')]['id']}})[_0x0b41('0x2d')](handleEntityNotFound(_0x28aff0,null))['then'](function(_0x100c27){if(_0x100c27){_0x2bb351=_0x100c27;_0x3e30d9[_0x0b41('0x3d')]=_[_0x0b41('0x3a')](db[_0x0b41('0x61')][_0x0b41('0x4f')]);_0x3e30d9[_0x0b41('0x39')]=_[_0x0b41('0x3a')](_0x1fc42d[_0x0b41('0x39')]);_0x3e30d9[_0x0b41('0x3b')]=_[_0x0b41('0x3c')](_0x3e30d9[_0x0b41('0x3d')],_0x3e30d9['query']);_0x5b1e54[_0x0b41('0x3e')]=_['intersection'](_0x3e30d9[_0x0b41('0x3d')],qs[_0x0b41('0x50')](_0x1fc42d[_0x0b41('0x39')]['fields']));_0x5b1e54['attributes']=_0x5b1e54[_0x0b41('0x3e')]['length']?_0x5b1e54['attributes']:_0x3e30d9[_0x0b41('0x3d')];_0x5b1e54[_0x0b41('0x41')]=qs[_0x0b41('0x42')](_0x1fc42d['query'][_0x0b41('0x42')]);_0x5b1e54[_0x0b41('0x43')]=qs[_0x0b41('0x3b')](_['pick'](_0x1fc42d[_0x0b41('0x39')],_0x3e30d9['filters']));if(_0x1fc42d['query']['filter']){_0x5b1e54[_0x0b41('0x43')]=_[_0x0b41('0x47')](_0x5b1e54[_0x0b41('0x43')],{'$or':_[_0x0b41('0x35')](_0x5b1e54[_0x0b41('0x3e')],function(_0x4e1cfd){var _0x33566e={};_0x33566e[_0x4e1cfd]={'$like':'%'+_0x1fc42d[_0x0b41('0x39')]['filter']+'%'};return _0x33566e;})});}_0x5b1e54=_[_0x0b41('0x47')]({},_0x5b1e54,_0x1fc42d['options']);return _0x2bb351[_0x0b41('0x8b')](_0x5b1e54);}})['then'](function(_0x20ffbb){if(_0x20ffbb){_0x1e2a22=_0x20ffbb[_0x0b41('0x3f')];if(!_0x1fc42d[_0x0b41('0x39')][_0x0b41('0x40')](_0x0b41('0x5f'))){_0x5b1e54[_0x0b41('0x28')]=qs[_0x0b41('0x28')](_0x1fc42d[_0x0b41('0x39')][_0x0b41('0x28')]);_0x5b1e54[_0x0b41('0x25')]=qs[_0x0b41('0x25')](_0x1fc42d[_0x0b41('0x39')][_0x0b41('0x25')]);}return _0x2bb351[_0x0b41('0x8b')](_0x5b1e54);}})['then'](function(_0x1ec938){if(_0x1ec938){return _0x1ec938?{'count':_0x1e2a22,'rows':_0x1ec938}:null;}})[_0x0b41('0x2d')](respondWithResult(_0x28aff0,null))[_0x0b41('0x4c')](handleError(_0x28aff0,null));};
\ No newline at end of file
index ea90806..b744a8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xced7=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xced7,0x70));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x7ced('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7ced('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ced('0x2'),'afterDestroy':_0x7ced('0x3')};function emitEvent(_0x5f29ac){return function(_0x7e5de3,_0x39ce23,_0x41aa9a){WhatsappQueueEvents[_0x7ced('0x4')](_0x5f29ac+':'+_0x7e5de3['id'],_0x7e5de3);WhatsappQueueEvents[_0x7ced('0x4')](_0x5f29ac,_0x7e5de3);_0x41aa9a(null);};}for(var e in events){if(events[_0x7ced('0x5')](e)){var event=events[e];WhatsappQueue[_0x7ced('0x6')](e,emitEvent(event));}}module[_0x7ced('0x7')]=WhatsappQueueEvents;
\ No newline at end of file
+var _0x5484=['exports','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x298261,_0x19ed9d){var _0x4737a2=function(_0x166c17){while(--_0x166c17){_0x298261['push'](_0x298261['shift']());}};_0x4737a2(++_0x19ed9d);}(_0x5484,0x199));var _0x4548=function(_0x38b734,_0x282bab){_0x38b734=_0x38b734-0x0;var _0x328117=_0x5484[_0x38b734];return _0x328117;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x4548('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4548('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4548('0x2'),'afterDestroy':_0x4548('0x3')};function emitEvent(_0x453970){return function(_0xa914b9,_0x379f80,_0x36d91b){WhatsappQueueEvents[_0x4548('0x4')](_0x453970+':'+_0xa914b9['id'],_0xa914b9);WhatsappQueueEvents['emit'](_0x453970,_0xa914b9);_0x36d91b(null);};}for(var e in events){if(events[_0x4548('0x5')](e)){var event=events[e];WhatsappQueue[_0x4548('0x6')](e,emitEvent(event));}}module[_0x4548('0x7')]=WhatsappQueueEvents;
\ No newline at end of file
index 0759d09..70c5031 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4203=['exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x490c45,_0x97b829){var _0x82738e=function(_0x215c17){while(--_0x215c17){_0x490c45['push'](_0x490c45['shift']());}};_0x82738e(++_0x97b829);}(_0x4203,0xd4));var _0x3420=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4203[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x3420('0x0'));var util=require(_0x3420('0x1'));var logger=require(_0x3420('0x2'))(_0x3420('0x3'));var moment=require(_0x3420('0x4'));var BPromise=require('bluebird');var rp=require(_0x3420('0x5'));var fs=require('fs');var path=require(_0x3420('0x6'));var rimraf=require('rimraf');var config=require(_0x3420('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x3420('0x8')]=function(_0x1d60b0,_0x20c706){return _0x1d60b0['define'](_0x3420('0x9'),attributes,{'tableName':_0x3420('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc069=['rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','util','api','bluebird','request-promise','path'];(function(_0xb605ce,_0x10574f){var _0x5059a5=function(_0x361db3){while(--_0x361db3){_0xb605ce['push'](_0xb605ce['shift']());}};_0x5059a5(++_0x10574f);}(_0xc069,0xd7));var _0x9c06=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc069[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9c06('0x0'));var logger=require('../../config/logger')(_0x9c06('0x1'));var moment=require('moment');var BPromise=require(_0x9c06('0x2'));var rp=require(_0x9c06('0x3'));var fs=require('fs');var path=require(_0x9c06('0x4'));var rimraf=require(_0x9c06('0x5'));var config=require(_0x9c06('0x6'));var attributes=require(_0x9c06('0x7'));module['exports']=function(_0x3b34d2,_0x3e26d5){return _0x3b34d2[_0x9c06('0x8')](_0x9c06('0x9'),attributes,{'tableName':_0x9c06('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9f74129..54b8759 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b00=['include','attributes','then','stringify','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','map','model'];(function(_0x2a1a31,_0x1b8b1a){var _0xe175e8=function(_0xa6f2c2){while(--_0xa6f2c2){_0x2a1a31['push'](_0x2a1a31['shift']());}};_0xe175e8(++_0x1b8b1a);}(_0x2b00,0x11d));var _0x02b0=function(_0x5912a0,_0x1f366f){_0x5912a0=_0x5912a0-0x0;var _0x1b69ea=_0x2b00[_0x5912a0];return _0x1b69ea;};'use strict';var _=require('lodash');var util=require(_0x02b0('0x0'));var moment=require(_0x02b0('0x1'));var BPromise=require(_0x02b0('0x2'));var rs=require(_0x02b0('0x3'));var fs=require('fs');var Redis=require(_0x02b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x02b0('0x5'));var logger=require(_0x02b0('0x6'))(_0x02b0('0x7'));var config=require('../../config/environment');var jayson=require(_0x02b0('0x8'));var client=jayson[_0x02b0('0x9')][_0x02b0('0xa')]({'port':0x232a});config[_0x02b0('0xb')]=_[_0x02b0('0xc')](config[_0x02b0('0xb')],{'host':_0x02b0('0xd'),'port':0x18eb});var socket=require(_0x02b0('0xe'))(new Redis(config[_0x02b0('0xb')]));require(_0x02b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x4f8dd0,_0x53fcca,_0xd31f70){return new BPromise(function(_0x5bf318,_0x311702){return client[_0x02b0('0x10')](_0x4f8dd0,_0xd31f70)['then'](function(_0x270732){logger[_0x02b0('0x11')](_0x02b0('0x12'),_0x53fcca,_0x02b0('0x13'));logger[_0x02b0('0x14')](_0x02b0('0x15'),_0x53fcca,_0x02b0('0x13'),JSON['stringify'](_0x270732));if(_0x270732[_0x02b0('0x16')]){if(_0x270732[_0x02b0('0x16')][_0x02b0('0x17')]===0x1f4){logger[_0x02b0('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x53fcca,_0x270732[_0x02b0('0x16')]['message']);return _0x311702(_0x270732[_0x02b0('0x16')][_0x02b0('0x18')]);}logger[_0x02b0('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x53fcca,_0x270732[_0x02b0('0x16')][_0x02b0('0x18')]);return _0x5bf318(_0x270732[_0x02b0('0x16')][_0x02b0('0x18')]);}else{logger[_0x02b0('0x11')](_0x02b0('0x12'),_0x53fcca,_0x02b0('0x13'));_0x5bf318(_0x270732['result'][_0x02b0('0x18')]);}})[_0x02b0('0x19')](function(_0x421cec){logger[_0x02b0('0x16')](_0x02b0('0x12'),_0x53fcca,_0x421cec);_0x311702(_0x421cec);});});}exports[_0x02b0('0x1a')]=function(_0x49f862){var _0x47ae8e=this;return new Promise(function(_0x6532bd,_0x4f51c0){return db[_0x02b0('0x1b')][_0x02b0('0x1c')]({'raw':_0x49f862[_0x02b0('0x1d')]?_0x49f862['options'][_0x02b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x49f862[_0x02b0('0x1d')]?_0x49f862[_0x02b0('0x1d')][_0x02b0('0x1f')]||null:null,'attributes':_0x49f862['options']?_0x49f862[_0x02b0('0x1d')]['attributes']||null:null,'limit':_0x49f862[_0x02b0('0x1d')]?_0x49f862['options'][_0x02b0('0x20')]||null:null,'include':_0x49f862[_0x02b0('0x1d')]?_0x49f862[_0x02b0('0x1d')]['include']?_[_0x02b0('0x21')](_0x49f862[_0x02b0('0x1d')]['include'],function(_0x3842f0){return{'model':db[_0x3842f0[_0x02b0('0x22')]],'as':_0x3842f0['as'],'attributes':_0x3842f0['attributes'],'include':_0x3842f0['include']?_['map'](_0x3842f0[_0x02b0('0x23')],function(_0x2d78ab){return{'model':db[_0x2d78ab['model']],'as':_0x2d78ab['as'],'attributes':_0x2d78ab[_0x02b0('0x24')],'include':_0x2d78ab[_0x02b0('0x23')]?_[_0x02b0('0x21')](_0x2d78ab[_0x02b0('0x23')],function(_0x369ec7){return{'model':db[_0x369ec7[_0x02b0('0x22')]],'as':_0x369ec7['as'],'attributes':_0x369ec7[_0x02b0('0x24')]};}):[]};}):[]};}):[]:[]})[_0x02b0('0x25')](function(_0x2c7e21){logger[_0x02b0('0x11')]('GetWhatsappQueue',_0x49f862);logger[_0x02b0('0x14')]('GetWhatsappQueue',_0x49f862,JSON[_0x02b0('0x26')](_0x2c7e21));_0x6532bd(_0x2c7e21);})[_0x02b0('0x19')](function(_0x2e6a14){logger[_0x02b0('0x16')](_0x02b0('0x1a'),_0x2e6a14['message'],_0x49f862);_0x4f51c0(_0x47ae8e[_0x02b0('0x16')](0x1f4,_0x2e6a14['message']));});});};exports['ShowWhatsappQueue']=function(_0x51954c){var _0x5bf1b9=this;return new Promise(function(_0x44acc4,_0x471ecd){return db[_0x02b0('0x1b')][_0x02b0('0x27')]({'raw':_0x51954c['options']?_0x51954c['options']['raw']===undefined?!![]:![]:!![],'where':_0x51954c[_0x02b0('0x1d')]?_0x51954c[_0x02b0('0x1d')][_0x02b0('0x1f')]||null:null,'attributes':_0x51954c[_0x02b0('0x1d')]?_0x51954c[_0x02b0('0x1d')][_0x02b0('0x24')]||null:null,'include':_0x51954c['options']?_0x51954c[_0x02b0('0x1d')]['include']?_[_0x02b0('0x21')](_0x51954c[_0x02b0('0x1d')]['include'],function(_0x1235a5){return{'model':db[_0x1235a5[_0x02b0('0x22')]],'as':_0x1235a5['as'],'attributes':_0x1235a5[_0x02b0('0x24')],'include':_0x1235a5[_0x02b0('0x23')]?_[_0x02b0('0x21')](_0x1235a5[_0x02b0('0x23')],function(_0x4cfa15){return{'model':db[_0x4cfa15['model']],'as':_0x4cfa15['as'],'attributes':_0x4cfa15[_0x02b0('0x24')],'include':_0x4cfa15[_0x02b0('0x23')]?_['map'](_0x4cfa15[_0x02b0('0x23')],function(_0x398cad){return{'model':db[_0x398cad[_0x02b0('0x22')]],'as':_0x398cad['as'],'attributes':_0x398cad[_0x02b0('0x24')]};}):[]};}):[]};}):[]:[]})[_0x02b0('0x25')](function(_0x4af7b5){logger[_0x02b0('0x11')]('ShowWhatsappQueue',_0x51954c);logger['debug']('ShowWhatsappQueue',_0x51954c,JSON['stringify'](_0x4af7b5));_0x44acc4(_0x4af7b5);})[_0x02b0('0x19')](function(_0x43a6f2){logger[_0x02b0('0x16')]('ShowWhatsappQueue',_0x43a6f2[_0x02b0('0x18')],_0x51954c);_0x471ecd(_0x5bf1b9[_0x02b0('0x16')](0x1f4,_0x43a6f2['message']));});});};
\ No newline at end of file
+var _0x4b20=['error','code','message','result','catch','GetWhatsappQueue','findAll','options','where','limit','include','model','attributes','map','info','stringify','WhatsappQueue','raw','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x4b20,0x10f));var _0x04b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b20[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x04b2('0x0'));var util=require(_0x04b2('0x1'));var moment=require(_0x04b2('0x2'));var BPromise=require(_0x04b2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04b2('0x4'));var db=require(_0x04b2('0x5'))['db'];var utils=require(_0x04b2('0x6'));var logger=require(_0x04b2('0x7'))(_0x04b2('0x8'));var config=require(_0x04b2('0x9'));var jayson=require(_0x04b2('0xa'));var client=jayson[_0x04b2('0xb')][_0x04b2('0xc')]({'port':0x232a});config[_0x04b2('0xd')]=_[_0x04b2('0xe')](config[_0x04b2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x04b2('0xf'))(new Redis(config[_0x04b2('0xd')]));require('./whatsappQueue.socket')[_0x04b2('0x10')](socket);function respondWithRpcPromise(_0x13adee,_0x2f1385,_0x1ff83a){return new BPromise(function(_0x424417,_0x28b40f){return client[_0x04b2('0x11')](_0x13adee,_0x1ff83a)[_0x04b2('0x12')](function(_0xa997b6){logger['info'](_0x04b2('0x13'),_0x2f1385,_0x04b2('0x14'));logger[_0x04b2('0x15')](_0x04b2('0x16'),_0x2f1385,_0x04b2('0x14'),JSON['stringify'](_0xa997b6));if(_0xa997b6[_0x04b2('0x17')]){if(_0xa997b6[_0x04b2('0x17')][_0x04b2('0x18')]===0x1f4){logger[_0x04b2('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x2f1385,_0xa997b6[_0x04b2('0x17')]['message']);return _0x28b40f(_0xa997b6[_0x04b2('0x17')][_0x04b2('0x19')]);}logger[_0x04b2('0x17')](_0x04b2('0x13'),_0x2f1385,_0xa997b6['error']['message']);return _0x424417(_0xa997b6[_0x04b2('0x17')][_0x04b2('0x19')]);}else{logger['info'](_0x04b2('0x13'),_0x2f1385,_0x04b2('0x14'));_0x424417(_0xa997b6[_0x04b2('0x1a')][_0x04b2('0x19')]);}})[_0x04b2('0x1b')](function(_0x193a99){logger[_0x04b2('0x17')](_0x04b2('0x13'),_0x2f1385,_0x193a99);_0x28b40f(_0x193a99);});});}exports[_0x04b2('0x1c')]=function(_0x422150){var _0x58ec28=this;return new Promise(function(_0x1acd9a,_0x366e13){return db['WhatsappQueue'][_0x04b2('0x1d')]({'raw':_0x422150[_0x04b2('0x1e')]?_0x422150[_0x04b2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x422150[_0x04b2('0x1e')]?_0x422150['options'][_0x04b2('0x1f')]||null:null,'attributes':_0x422150[_0x04b2('0x1e')]?_0x422150[_0x04b2('0x1e')]['attributes']||null:null,'limit':_0x422150[_0x04b2('0x1e')]?_0x422150['options'][_0x04b2('0x20')]||null:null,'include':_0x422150[_0x04b2('0x1e')]?_0x422150[_0x04b2('0x1e')][_0x04b2('0x21')]?_['map'](_0x422150[_0x04b2('0x1e')][_0x04b2('0x21')],function(_0x170a23){return{'model':db[_0x170a23[_0x04b2('0x22')]],'as':_0x170a23['as'],'attributes':_0x170a23[_0x04b2('0x23')],'include':_0x170a23[_0x04b2('0x21')]?_['map'](_0x170a23['include'],function(_0x11086e){return{'model':db[_0x11086e[_0x04b2('0x22')]],'as':_0x11086e['as'],'attributes':_0x11086e['attributes'],'include':_0x11086e['include']?_[_0x04b2('0x24')](_0x11086e[_0x04b2('0x21')],function(_0x14a538){return{'model':db[_0x14a538[_0x04b2('0x22')]],'as':_0x14a538['as'],'attributes':_0x14a538[_0x04b2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x04b2('0x12')](function(_0x4f7e46){logger[_0x04b2('0x25')](_0x04b2('0x1c'),_0x422150);logger['debug']('GetWhatsappQueue',_0x422150,JSON[_0x04b2('0x26')](_0x4f7e46));_0x1acd9a(_0x4f7e46);})['catch'](function(_0x1ef085){logger[_0x04b2('0x17')]('GetWhatsappQueue',_0x1ef085[_0x04b2('0x19')],_0x422150);_0x366e13(_0x58ec28[_0x04b2('0x17')](0x1f4,_0x1ef085[_0x04b2('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x3ef489){var _0x5980e7=this;return new Promise(function(_0x31dff0,_0xf97131){return db[_0x04b2('0x27')]['find']({'raw':_0x3ef489['options']?_0x3ef489[_0x04b2('0x1e')][_0x04b2('0x28')]===undefined?!![]:![]:!![],'where':_0x3ef489[_0x04b2('0x1e')]?_0x3ef489[_0x04b2('0x1e')][_0x04b2('0x1f')]||null:null,'attributes':_0x3ef489[_0x04b2('0x1e')]?_0x3ef489[_0x04b2('0x1e')]['attributes']||null:null,'include':_0x3ef489[_0x04b2('0x1e')]?_0x3ef489[_0x04b2('0x1e')][_0x04b2('0x21')]?_[_0x04b2('0x24')](_0x3ef489['options'][_0x04b2('0x21')],function(_0x51f6c4){return{'model':db[_0x51f6c4[_0x04b2('0x22')]],'as':_0x51f6c4['as'],'attributes':_0x51f6c4['attributes'],'include':_0x51f6c4[_0x04b2('0x21')]?_[_0x04b2('0x24')](_0x51f6c4[_0x04b2('0x21')],function(_0x37cf05){return{'model':db[_0x37cf05[_0x04b2('0x22')]],'as':_0x37cf05['as'],'attributes':_0x37cf05[_0x04b2('0x23')],'include':_0x37cf05[_0x04b2('0x21')]?_['map'](_0x37cf05[_0x04b2('0x21')],function(_0x1a25e1){return{'model':db[_0x1a25e1[_0x04b2('0x22')]],'as':_0x1a25e1['as'],'attributes':_0x1a25e1[_0x04b2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x04b2('0x12')](function(_0x4f4c0b){logger[_0x04b2('0x25')](_0x04b2('0x29'),_0x3ef489);logger['debug'](_0x04b2('0x29'),_0x3ef489,JSON[_0x04b2('0x26')](_0x4f4c0b));_0x31dff0(_0x4f4c0b);})['catch'](function(_0x17d263){logger[_0x04b2('0x17')](_0x04b2('0x29'),_0x17d263['message'],_0x3ef489);_0xf97131(_0x5980e7[_0x04b2('0x17')](0x1f4,_0x17d263[_0x04b2('0x19')]));});});};
\ No newline at end of file
index 21410c8..09dc9b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ab5=['remove','update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x9ab5,0x9e));var _0x59ab=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9ab5[_0x618414];return _0x21c19a;};'use strict';var WhatsappQueueEvents=require(_0x59ab('0x0'));var events=[_0x59ab('0x1'),_0x59ab('0x2'),_0x59ab('0x3')];function createListener(_0x5ad0a4,_0x31657b){return function(_0x1a0cfa){_0x31657b['emit'](_0x5ad0a4,_0x1a0cfa);};}function removeListener(_0x5bb30e,_0x476067){return function(){WhatsappQueueEvents[_0x59ab('0x4')](_0x5bb30e,_0x476067);};}exports[_0x59ab('0x5')]=function(_0x21651c){for(var _0x47bce4=0x0,_0x2cab1a=events[_0x59ab('0x6')];_0x47bce4<_0x2cab1a;_0x47bce4++){var _0x32b68f=events[_0x47bce4];var _0x346af2=createListener(_0x59ab('0x7')+_0x32b68f,_0x21651c);WhatsappQueueEvents['on'](_0x32b68f,_0x346af2);}};
\ No newline at end of file
+var _0x58c3=['./whatsappQueue.events','remove','update','emit','register','length','whatsappQueue:'];(function(_0x33cc5d,_0x2e92c2){var _0x50cc47=function(_0x43e261){while(--_0x43e261){_0x33cc5d['push'](_0x33cc5d['shift']());}};_0x50cc47(++_0x2e92c2);}(_0x58c3,0xd2));var _0x358c=function(_0x1c17e3,_0x5995b9){_0x1c17e3=_0x1c17e3-0x0;var _0x54a18b=_0x58c3[_0x1c17e3];return _0x54a18b;};'use strict';var WhatsappQueueEvents=require(_0x358c('0x0'));var events=['save',_0x358c('0x1'),_0x358c('0x2')];function createListener(_0x264339,_0x6fbb6d){return function(_0x777424){_0x6fbb6d[_0x358c('0x3')](_0x264339,_0x777424);};}function removeListener(_0x48bca6,_0x555af7){return function(){WhatsappQueueEvents['removeListener'](_0x48bca6,_0x555af7);};}exports[_0x358c('0x4')]=function(_0x15b860){for(var _0x10e346=0x0,_0x1c7d69=events[_0x358c('0x5')];_0x10e346<_0x1c7d69;_0x10e346++){var _0x349e40=events[_0x10e346];var _0x51a656=createListener(_0x358c('0x6')+_0x349e40,_0x15b860);WhatsappQueueEvents['on'](_0x349e40,_0x51a656);}};
\ No newline at end of file
index 3697b67..4e7dae5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5295=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create','put','/:id'];(function(_0xe6d40,_0x5509a5){var _0x2024e9=function(_0x8b3768){while(--_0x8b3768){_0xe6d40['push'](_0xe6d40['shift']());}};_0x2024e9(++_0x5509a5);}(_0x5295,0x14e));var _0x5529=function(_0xb61e6c,_0x181f81){_0xb61e6c=_0xb61e6c-0x0;var _0x2f88d5=_0x5295[_0xb61e6c];return _0x2f88d5;};'use strict';var multer=require('multer');var util=require(_0x5529('0x0'));var path=require(_0x5529('0x1'));var timeout=require('connect-timeout');var express=require(_0x5529('0x2'));var router=express[_0x5529('0x3')]();var fs_extra=require(_0x5529('0x4'));var auth=require(_0x5529('0x5'));var interaction=require(_0x5529('0x6'));var config=require('../../config/environment');var controller=require(_0x5529('0x7'));router['get']('/',auth[_0x5529('0x8')](),controller[_0x5529('0x9')]);router['get'](_0x5529('0xa'),auth[_0x5529('0x8')](),controller[_0x5529('0xb')]);router[_0x5529('0xc')]('/:id',auth[_0x5529('0x8')](),controller[_0x5529('0xd')]);router[_0x5529('0xe')]('/',auth[_0x5529('0x8')](),controller[_0x5529('0xf')]);router[_0x5529('0x10')](_0x5529('0x11'),auth[_0x5529('0x8')](),controller[_0x5529('0x12')]);router[_0x5529('0x13')](_0x5529('0x11'),auth[_0x5529('0x8')](),controller[_0x5529('0x14')]);module[_0x5529('0x15')]=router;
\ No newline at end of file
+var _0x8ea0=['multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x29cb9b,_0x247dd1){var _0x544ff3=function(_0x5919b2){while(--_0x5919b2){_0x29cb9b['push'](_0x29cb9b['shift']());}};_0x544ff3(++_0x247dd1);}(_0x8ea0,0x78));var _0x08ea=function(_0x5c3a24,_0x2fecb2){_0x5c3a24=_0x5c3a24-0x0;var _0x55112a=_0x8ea0[_0x5c3a24];return _0x55112a;};'use strict';var multer=require(_0x08ea('0x0'));var util=require(_0x08ea('0x1'));var path=require(_0x08ea('0x2'));var timeout=require(_0x08ea('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x08ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x08ea('0x5'));var config=require(_0x08ea('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x08ea('0x7')](),controller[_0x08ea('0x8')]);router['get'](_0x08ea('0x9'),auth[_0x08ea('0x7')](),controller[_0x08ea('0xa')]);router[_0x08ea('0xb')](_0x08ea('0xc'),auth[_0x08ea('0x7')](),controller[_0x08ea('0xd')]);router[_0x08ea('0xe')]('/',auth[_0x08ea('0x7')](),controller[_0x08ea('0xf')]);router[_0x08ea('0x10')](_0x08ea('0xc'),auth[_0x08ea('0x7')](),controller['update']);router[_0x08ea('0x11')](_0x08ea('0xc'),auth[_0x08ea('0x7')](),controller[_0x08ea('0x12')]);module[_0x08ea('0x13')]=router;
\ No newline at end of file
index d5b9cce..d61fbac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3a26e6,_0x1314ab){var _0x53ac6f=function(_0x56564e){while(--_0x56564e){_0x3a26e6['push'](_0x3a26e6['shift']());}};_0x53ac6f(++_0x1314ab);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}};
\ No newline at end of file
+var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xd6f0f3,_0x5bd224){var _0x30d544=function(_0x4c53c3){while(--_0x4c53c3){_0xd6f0f3['push'](_0xd6f0f3['shift']());}};_0x30d544(++_0x5bd224);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}};
\ No newline at end of file
index f49fea3..c215e1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0x4e1211,_0x1c0e26){var _0x4ae887=function(_0x6e55ff){while(--_0x6e55ff){_0x4e1211['push'](_0x4e1211['shift']());}};_0x4ae887(++_0x1c0e26);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x34657b,_0x31f4ec){_0x34657b=_0x34657b-0x0;var _0x3c43c1=_0xe1e3[_0x34657b];return _0x3c43c1;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));};
\ No newline at end of file
+var _0x9348=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject'];(function(_0xab431f,_0x5e1258){var _0x33c5b7=function(_0x16c058){while(--_0x16c058){_0xab431f['push'](_0xab431f['shift']());}};_0x33c5b7(++_0x5e1258);}(_0x9348,0x10d));var _0x8934=function(_0x4fa779,_0x5b2253){_0x4fa779=_0x4fa779-0x0;var _0x3bf024=_0x9348[_0x4fa779];return _0x3bf024;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['WhatsappQueueReport'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['WhatsappQueueReport'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));};exports['describe']=function(_0xce93cd,_0x2778f9){return db[_0x8934('0x40')][_0x8934('0x4b')]()[_0x8934('0x25')](respondWithResult(_0x2778f9,null))[_0x8934('0x48')](handleError(_0x2778f9,null));};
\ No newline at end of file
index bfd0d9f..c647c40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc375=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xc375,0x143));var _0x5c37=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xc375[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x5c37('0x0'));var util=require(_0x5c37('0x1'));var logger=require(_0x5c37('0x2'))('api');var moment=require(_0x5c37('0x3'));var BPromise=require(_0x5c37('0x4'));var rp=require(_0x5c37('0x5'));var fs=require('fs');var path=require(_0x5c37('0x6'));var rimraf=require(_0x5c37('0x7'));var config=require('../../config/environment');var attributes=require(_0x5c37('0x8'));module[_0x5c37('0x9')]=function(_0x49d1af,_0x4bac18){return _0x49d1af[_0x5c37('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x5c37('0xb'),'paranoid':![],'indexes':[{'name':_0x5c37('0xc'),'fields':[_0x5c37('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa859=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x555d05,_0xcd824d){var _0x1df2c6=function(_0x1670f5){while(--_0x1670f5){_0x555d05['push'](_0x555d05['shift']());}};_0x1df2c6(++_0xcd824d);}(_0xa859,0x1a8));var _0x9a85=function(_0x358c64,_0x4e4c9b){_0x358c64=_0x358c64-0x0;var _0x3512bb=_0xa859[_0x358c64];return _0x3512bb;};'use strict';var _=require(_0x9a85('0x0'));var util=require(_0x9a85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a85('0x2'));var BPromise=require(_0x9a85('0x3'));var rp=require(_0x9a85('0x4'));var fs=require('fs');var path=require(_0x9a85('0x5'));var rimraf=require(_0x9a85('0x6'));var config=require(_0x9a85('0x7'));var attributes=require(_0x9a85('0x8'));module[_0x9a85('0x9')]=function(_0x3686bb,_0x376068){return _0x3686bb[_0x9a85('0xa')](_0x9a85('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x9a85('0xc'),'fields':[_0x9a85('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index d93482b..66863f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x827f=['WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x827f,0x9b));var _0xf827=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x827f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xf827('0x0'));var util=require(_0xf827('0x1'));var moment=require(_0xf827('0x2'));var BPromise=require(_0xf827('0x3'));var rs=require(_0xf827('0x4'));var fs=require('fs');var Redis=require(_0xf827('0x5'));var db=require(_0xf827('0x6'))['db'];var utils=require(_0xf827('0x7'));var logger=require('../../config/logger')(_0xf827('0x8'));var config=require(_0xf827('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf827('0xa')][_0xf827('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x335524,_0x177938,_0x5046c3){return new BPromise(function(_0x4cdea4,_0x578d64){return client[_0xf827('0xc')](_0x335524,_0x5046c3)[_0xf827('0xd')](function(_0x2c3c5e){logger[_0xf827('0xe')](_0xf827('0xf'),_0x177938,'request\x20sent');logger['debug'](_0xf827('0x10'),_0x177938,_0xf827('0x11'),JSON['stringify'](_0x2c3c5e));if(_0x2c3c5e['error']){if(_0x2c3c5e[_0xf827('0x12')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x177938,_0x2c3c5e[_0xf827('0x12')][_0xf827('0x13')]);return _0x578d64(_0x2c3c5e[_0xf827('0x12')][_0xf827('0x13')]);}logger[_0xf827('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x177938,_0x2c3c5e[_0xf827('0x12')]['message']);return _0x4cdea4(_0x2c3c5e['error']['message']);}else{logger[_0xf827('0xe')](_0xf827('0xf'),_0x177938,_0xf827('0x11'));_0x4cdea4(_0x2c3c5e[_0xf827('0x14')][_0xf827('0x13')]);}})[_0xf827('0x15')](function(_0x28288a){logger[_0xf827('0x12')](_0xf827('0xf'),_0x177938,_0x28288a);_0x578d64(_0x28288a);});});}exports['CreateWhatsappQueueReport']=function(_0x2f5ff3){var _0x34dec3=this;return new Promise(function(_0x4b73ba,_0x4f9627){return db[_0xf827('0x16')][_0xf827('0x17')](_0x2f5ff3[_0xf827('0x18')],{'raw':_0x2f5ff3[_0xf827('0x19')]?_0x2f5ff3['options'][_0xf827('0x1a')]===undefined?!![]:![]:!![]})[_0xf827('0xd')](function(_0x198a09){logger[_0xf827('0xe')](_0xf827('0x1b'),_0x2f5ff3);logger[_0xf827('0x1c')]('CreateWhatsappQueueReport',_0x2f5ff3,JSON['stringify'](_0x198a09));_0x4b73ba(_0x198a09);})[_0xf827('0x15')](function(_0x31e309){logger[_0xf827('0x12')](_0xf827('0x1b'),_0x31e309['message'],_0x2f5ff3);_0x4f9627(_0x34dec3['error'](0x1f4,_0x31e309[_0xf827('0x13')]));});});};exports[_0xf827('0x1d')]=function(_0x16872b){var _0x5992c6=this;return new Promise(function(_0x304a7a,_0x52341f){return db[_0xf827('0x16')][_0xf827('0x1e')](_0x16872b[_0xf827('0x18')],{'raw':_0x16872b[_0xf827('0x19')]?_0x16872b[_0xf827('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16872b['options']?_0x16872b[_0xf827('0x19')][_0xf827('0x1f')]||null:null,'attributes':_0x16872b[_0xf827('0x19')]?_0x16872b[_0xf827('0x19')][_0xf827('0x20')]||null:null,'limit':_0x16872b[_0xf827('0x19')]?_0x16872b[_0xf827('0x19')][_0xf827('0x21')]||null:null})[_0xf827('0xd')](function(_0x49f31f){logger[_0xf827('0xe')](_0xf827('0x1d'),_0x16872b);logger[_0xf827('0x1c')](_0xf827('0x1d'),_0x16872b,JSON['stringify'](_0x49f31f));_0x304a7a(_0x49f31f);})[_0xf827('0x15')](function(_0x5405ea){logger['error'](_0xf827('0x1d'),_0x5405ea[_0xf827('0x13')],_0x16872b);_0x52341f(_0x5992c6[_0xf827('0x12')](0x1f4,_0x5405ea[_0xf827('0x13')]));});});};
\ No newline at end of file
+var _0xd835=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','update','where','attributes','limit','UpdateWhatsappQueueReport','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x12c141,_0x32b5e2){var _0x475ce4=function(_0x2f679f){while(--_0x2f679f){_0x12c141['push'](_0x12c141['shift']());}};_0x475ce4(++_0x32b5e2);}(_0xd835,0xfb));var _0x5d83=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xd835[_0x479160];return _0x47ac6d;};'use strict';var _=require(_0x5d83('0x0'));var util=require(_0x5d83('0x1'));var moment=require('moment');var BPromise=require(_0x5d83('0x2'));var rs=require(_0x5d83('0x3'));var fs=require('fs');var Redis=require(_0x5d83('0x4'));var db=require(_0x5d83('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d83('0x6'))(_0x5d83('0x7'));var config=require(_0x5d83('0x8'));var jayson=require(_0x5d83('0x9'));var client=jayson[_0x5d83('0xa')][_0x5d83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5da518,_0x17969c,_0x5de264){return new BPromise(function(_0x4baeb1,_0x5afe28){return client[_0x5d83('0xc')](_0x5da518,_0x5de264)[_0x5d83('0xd')](function(_0x1cc4d6){logger[_0x5d83('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x17969c,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x17969c,_0x5d83('0xf'),JSON[_0x5d83('0x10')](_0x1cc4d6));if(_0x1cc4d6[_0x5d83('0x11')]){if(_0x1cc4d6['error'][_0x5d83('0x12')]===0x1f4){logger[_0x5d83('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x17969c,_0x1cc4d6[_0x5d83('0x11')]['message']);return _0x5afe28(_0x1cc4d6[_0x5d83('0x11')][_0x5d83('0x13')]);}logger[_0x5d83('0x11')](_0x5d83('0x14'),_0x17969c,_0x1cc4d6[_0x5d83('0x11')][_0x5d83('0x13')]);return _0x4baeb1(_0x1cc4d6[_0x5d83('0x11')][_0x5d83('0x13')]);}else{logger['info'](_0x5d83('0x14'),_0x17969c,_0x5d83('0xf'));_0x4baeb1(_0x1cc4d6['result'][_0x5d83('0x13')]);}})['catch'](function(_0x5178b0){logger[_0x5d83('0x11')](_0x5d83('0x14'),_0x17969c,_0x5178b0);_0x5afe28(_0x5178b0);});});}exports[_0x5d83('0x15')]=function(_0x207fc0){var _0x53093e=this;return new Promise(function(_0x10ac63,_0x49a27a){return db[_0x5d83('0x16')][_0x5d83('0x17')](_0x207fc0[_0x5d83('0x18')],{'raw':_0x207fc0[_0x5d83('0x19')]?_0x207fc0[_0x5d83('0x19')][_0x5d83('0x1a')]===undefined?!![]:![]:!![]})[_0x5d83('0xd')](function(_0x57c98c){logger[_0x5d83('0xe')](_0x5d83('0x15'),_0x207fc0);logger['debug']('CreateWhatsappQueueReport',_0x207fc0,JSON['stringify'](_0x57c98c));_0x10ac63(_0x57c98c);})[_0x5d83('0x1b')](function(_0x41bf64){logger['error'](_0x5d83('0x15'),_0x41bf64[_0x5d83('0x13')],_0x207fc0);_0x49a27a(_0x53093e['error'](0x1f4,_0x41bf64[_0x5d83('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1963e3){var _0x4cb19e=this;return new Promise(function(_0x4dfa95,_0x255692){return db[_0x5d83('0x16')][_0x5d83('0x1c')](_0x1963e3[_0x5d83('0x18')],{'raw':_0x1963e3[_0x5d83('0x19')]?_0x1963e3[_0x5d83('0x19')][_0x5d83('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1963e3[_0x5d83('0x19')]?_0x1963e3[_0x5d83('0x19')][_0x5d83('0x1d')]||null:null,'attributes':_0x1963e3[_0x5d83('0x19')]?_0x1963e3[_0x5d83('0x19')][_0x5d83('0x1e')]||null:null,'limit':_0x1963e3['options']?_0x1963e3['options'][_0x5d83('0x1f')]||null:null})['then'](function(_0x26cf91){logger[_0x5d83('0xe')](_0x5d83('0x20'),_0x1963e3);logger[_0x5d83('0x21')](_0x5d83('0x20'),_0x1963e3,JSON['stringify'](_0x26cf91));_0x4dfa95(_0x26cf91);})[_0x5d83('0x1b')](function(_0x7d4d14){logger[_0x5d83('0x11')](_0x5d83('0x20'),_0x7d4d14[_0x5d83('0x13')],_0x1963e3);_0x255692(_0x4cb19e['error'](0x1f4,_0x7d4d14['message']));});});};
\ No newline at end of file
index f6359eb..b591dd3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e13=['/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e13,0x1aa));var _0x39e1=function(_0x457358,_0x3fd5cc){_0x457358=_0x457358-0x0;var _0x4e8463=_0x9e13[_0x457358];return _0x4e8463;};'use strict';var multer=require(_0x39e1('0x0'));var util=require(_0x39e1('0x1'));var path=require(_0x39e1('0x2'));var timeout=require(_0x39e1('0x3'));var express=require(_0x39e1('0x4'));var router=express[_0x39e1('0x5')]();var fs_extra=require(_0x39e1('0x6'));var auth=require(_0x39e1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x39e1('0x8'));var controller=require(_0x39e1('0x9'));router['get']('/',auth[_0x39e1('0xa')](),controller[_0x39e1('0xb')]);router[_0x39e1('0xc')](_0x39e1('0xd'),auth[_0x39e1('0xa')](),controller[_0x39e1('0xe')]);router['get'](_0x39e1('0xf'),auth[_0x39e1('0xa')](),controller[_0x39e1('0x10')]);router['post']('/',auth[_0x39e1('0xa')](),controller[_0x39e1('0x11')]);router['put']('/:id',auth[_0x39e1('0xa')](),controller['update']);router[_0x39e1('0x12')](_0x39e1('0xf'),auth['isAuthenticated'](),controller[_0x39e1('0x13')]);module[_0x39e1('0x14')]=router;
\ No newline at end of file
+var _0x7fc7=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7fc7,0xb6));var _0x77fc=function(_0x66a026,_0x58c19c){_0x66a026=_0x66a026-0x0;var _0x2c5e8d=_0x7fc7[_0x66a026];return _0x2c5e8d;};'use strict';var multer=require(_0x77fc('0x0'));var util=require('util');var path=require(_0x77fc('0x1'));var timeout=require(_0x77fc('0x2'));var express=require('express');var router=express[_0x77fc('0x3')]();var fs_extra=require(_0x77fc('0x4'));var auth=require(_0x77fc('0x5'));var interaction=require(_0x77fc('0x6'));var config=require(_0x77fc('0x7'));var controller=require(_0x77fc('0x8'));router[_0x77fc('0x9')]('/',auth[_0x77fc('0xa')](),controller[_0x77fc('0xb')]);router[_0x77fc('0x9')](_0x77fc('0xc'),auth['isAuthenticated'](),controller[_0x77fc('0xd')]);router[_0x77fc('0x9')](_0x77fc('0xe'),auth[_0x77fc('0xa')](),controller['show']);router[_0x77fc('0xf')]('/',auth[_0x77fc('0xa')](),controller[_0x77fc('0x10')]);router[_0x77fc('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x77fc('0x12')](_0x77fc('0xe'),auth[_0x77fc('0xa')](),controller[_0x77fc('0x13')]);module[_0x77fc('0x14')]=router;
\ No newline at end of file
index a087597..4066812 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x937d=['sequelize','account','agent','queue','DATE'];(function(_0x2f569e,_0x41de36){var _0x37376a=function(_0x35a05b){while(--_0x35a05b){_0x2f569e['push'](_0x2f569e['shift']());}};_0x37376a(++_0x41de36);}(_0x937d,0x1f4));var _0xd937=function(_0x252085,_0x9b7770){_0x252085=_0x252085-0x0;var _0x5bf7ef=_0x937d[_0x252085];return _0x5bf7ef;};'use strict';var Sequelize=require(_0xd937('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd937('0x1'),_0xd937('0x2'),_0xd937('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd937('0x4')]}};
\ No newline at end of file
+var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x394e1a,_0x9b904e){var _0x2f21c4=function(_0x2f148c){while(--_0x2f148c){_0x394e1a['push'](_0x394e1a['shift']());}};_0x2f21c4(++_0x9b904e);}(_0x2032,0xd9));var _0x2203=function(_0x13f2e1,_0x5b92d4){_0x13f2e1=_0x13f2e1-0x0;var _0x1d809f=_0x2032[_0x13f2e1];return _0x1d809f;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}};
\ No newline at end of file
index 67ade8a..04974b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f4b=['ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','destroy','params','describe','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0f4b,0x1a9));var _0xb0f4=function(_0x5d397a,_0x48cb91){_0x5d397a=_0x5d397a-0x0;var _0x108880=_0x0f4b[_0x5d397a];return _0x108880;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb0f4('0x0'));var jsonpatch=require(_0xb0f4('0x1'));var rp=require(_0xb0f4('0x2'));var moment=require(_0xb0f4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0f4('0x4'));var path=require(_0xb0f4('0x5'));var sox=require(_0xb0f4('0x6'));var csv=require('to-csv');var ejs=require(_0xb0f4('0x7'));var fs=require('fs');var fs_extra=require(_0xb0f4('0x8'));var _=require(_0xb0f4('0x9'));var squel=require(_0xb0f4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb0f4('0xb'));var toCsv=require(_0xb0f4('0xc'));var querystring=require(_0xb0f4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb0f4('0xe'));var as=require(_0xb0f4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0f4('0x10'))(_0xb0f4('0x11'));var utils=require(_0xb0f4('0x12'));var config=require(_0xb0f4('0x13'));var licenseUtil=require(_0xb0f4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34715b,_0x6b2e49){_0x6b2e49=_0x6b2e49||0xcc;return function(_0x4724c7){if(_0x4724c7){return _0x34715b['sendStatus'](_0x6b2e49);}return _0x34715b[_0xb0f4('0x15')](_0x6b2e49)[_0xb0f4('0x16')]();};}function respondWithResult(_0x328c92,_0x8673ca){_0x8673ca=_0x8673ca||0xc8;return function(_0x698f75){if(_0x698f75){return _0x328c92[_0xb0f4('0x15')](_0x8673ca)[_0xb0f4('0x17')](_0x698f75);}};}function respondWithFilteredResult(_0x2f54fc,_0x37fc0b){return function(_0x54e064){if(_0x54e064){var _0x2e8f70=typeof _0x37fc0b[_0xb0f4('0x18')]===_0xb0f4('0x19')&&typeof _0x37fc0b['limit']==='undefined';var _0x4b9148=_0x54e064[_0xb0f4('0x1a')];var _0x3d0b1f=_0x2e8f70?0x0:_0x37fc0b[_0xb0f4('0x18')];var _0x5855eb=_0x2e8f70?_0x54e064['count']:_0x37fc0b[_0xb0f4('0x18')]+_0x37fc0b['limit'];var _0x4e5d5a;if(_0x5855eb>=_0x4b9148){_0x5855eb=_0x4b9148;_0x4e5d5a=0xc8;}else{_0x4e5d5a=0xce;}_0x2f54fc['status'](_0x4e5d5a);return _0x2f54fc[_0xb0f4('0x1b')](_0xb0f4('0x1c'),_0x3d0b1f+'-'+_0x5855eb+'/'+_0x4b9148)[_0xb0f4('0x17')](_0x54e064);}return null;};}function patchUpdates(_0x1c8a80){return function(_0x4f624a){try{jsonpatch[_0xb0f4('0x1d')](_0x4f624a,_0x1c8a80,!![]);}catch(_0xaa66e){return BPromise[_0xb0f4('0x1e')](_0xaa66e);}return _0x4f624a[_0xb0f4('0x1f')]();};}function saveUpdates(_0x5b5a63,_0x104555){return function(_0x107f11){if(_0x107f11){return _0x107f11[_0xb0f4('0x20')](_0x5b5a63)['then'](function(_0x74ac11){return _0x74ac11;});}return null;};}function removeEntity(_0x1f445f,_0x4a7233){return function(_0x2aeb5f){if(_0x2aeb5f){return _0x2aeb5f['destroy']()[_0xb0f4('0x21')](function(){_0x1f445f[_0xb0f4('0x15')](0xcc)[_0xb0f4('0x16')]();});}};}function handleEntityNotFound(_0x69d5fa,_0x134e55){return function(_0x33015d){if(!_0x33015d){_0x69d5fa[_0xb0f4('0x22')](0x194);}return _0x33015d;};}function handleError(_0x120448,_0x164f9c){_0x164f9c=_0x164f9c||0x1f4;return function(_0x289d9){logger['error'](_0x289d9[_0xb0f4('0x23')]);if(_0x289d9[_0xb0f4('0x24')]){delete _0x289d9[_0xb0f4('0x24')];}_0x120448[_0xb0f4('0x15')](_0x164f9c)[_0xb0f4('0x25')](_0x289d9);};}exports[_0xb0f4('0x26')]=function(_0x50677e,_0x123e1e){var _0x2ccbf8={},_0x41c34d={},_0x499ea8={'count':0x0,'rows':[]};var _0x3eb3a8=_[_0xb0f4('0x27')](db[_0xb0f4('0x28')][_0xb0f4('0x29')],function(_0x3fa2a3){return{'name':_0x3fa2a3[_0xb0f4('0x2a')],'type':_0x3fa2a3[_0xb0f4('0x2b')][_0xb0f4('0x2c')]};});_0x41c34d[_0xb0f4('0x2d')]=_['map'](_0x3eb3a8,_0xb0f4('0x24'));_0x41c34d[_0xb0f4('0x2e')]=_[_0xb0f4('0x2f')](_0x50677e[_0xb0f4('0x2e')]);_0x41c34d['filters']=_['intersection'](_0x41c34d[_0xb0f4('0x2d')],_0x41c34d[_0xb0f4('0x2e')]);_0x2ccbf8['attributes']=_[_0xb0f4('0x30')](_0x41c34d['model'],qs[_0xb0f4('0x31')](_0x50677e[_0xb0f4('0x2e')][_0xb0f4('0x31')]));_0x2ccbf8[_0xb0f4('0x32')]=_0x2ccbf8['attributes'][_0xb0f4('0x33')]?_0x2ccbf8['attributes']:_0x41c34d[_0xb0f4('0x2d')];if(!_0x50677e[_0xb0f4('0x2e')][_0xb0f4('0x34')]('nolimit')){_0x2ccbf8[_0xb0f4('0x35')]=qs[_0xb0f4('0x35')](_0x50677e[_0xb0f4('0x2e')]['limit']);_0x2ccbf8[_0xb0f4('0x18')]=qs['offset'](_0x50677e[_0xb0f4('0x2e')]['offset']);}_0x2ccbf8['order']=qs[_0xb0f4('0x36')](_0x50677e[_0xb0f4('0x2e')][_0xb0f4('0x36')]);_0x2ccbf8[_0xb0f4('0x37')]=qs[_0xb0f4('0x38')](_[_0xb0f4('0x39')](_0x50677e['query'],_0x41c34d['filters']),_0x3eb3a8);if(_0x50677e[_0xb0f4('0x2e')][_0xb0f4('0x3a')]){_0x2ccbf8[_0xb0f4('0x37')]=_[_0xb0f4('0x3b')](_0x2ccbf8['where'],{'$or':_[_0xb0f4('0x27')](_0x3eb3a8,function(_0x1f5ff6){if(_0x1f5ff6[_0xb0f4('0x2b')]!=='VIRTUAL'){var _0x1e82c5={};_0x1e82c5[_0x1f5ff6[_0xb0f4('0x24')]]={'$like':'%'+_0x50677e[_0xb0f4('0x2e')]['filter']+'%'};return _0x1e82c5;}})});}_0x2ccbf8=_[_0xb0f4('0x3b')]({},_0x2ccbf8,_0x50677e[_0xb0f4('0x3c')]);var _0x160486={'where':_0x2ccbf8[_0xb0f4('0x37')]};return db[_0xb0f4('0x28')][_0xb0f4('0x1a')](_0x160486)[_0xb0f4('0x21')](function(_0x279bf5){_0x499ea8[_0xb0f4('0x1a')]=_0x279bf5;if(_0x50677e[_0xb0f4('0x2e')][_0xb0f4('0x3d')]){_0x2ccbf8[_0xb0f4('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x2ccbf8);})[_0xb0f4('0x21')](function(_0x4566e9){_0x499ea8[_0xb0f4('0x3f')]=_0x4566e9;return _0x499ea8;})['then'](respondWithFilteredResult(_0x123e1e,_0x2ccbf8))[_0xb0f4('0x40')](handleError(_0x123e1e,null));};exports[_0xb0f4('0x41')]=function(_0x34b3ae,_0x14dc57){var _0x5c9616={'raw':!![],'where':{'id':_0x34b3ae['params']['id']}},_0x1db482={};_0x1db482[_0xb0f4('0x2d')]=_['keys'](db[_0xb0f4('0x28')][_0xb0f4('0x29')]);_0x1db482[_0xb0f4('0x2e')]=_['keys'](_0x34b3ae[_0xb0f4('0x2e')]);_0x1db482['filters']=_[_0xb0f4('0x30')](_0x1db482[_0xb0f4('0x2d')],_0x1db482[_0xb0f4('0x2e')]);_0x5c9616['attributes']=_['intersection'](_0x1db482[_0xb0f4('0x2d')],qs[_0xb0f4('0x31')](_0x34b3ae['query'][_0xb0f4('0x31')]));_0x5c9616['attributes']=_0x5c9616[_0xb0f4('0x32')][_0xb0f4('0x33')]?_0x5c9616[_0xb0f4('0x32')]:_0x1db482[_0xb0f4('0x2d')];if(_0x34b3ae[_0xb0f4('0x2e')]['includeAll']){_0x5c9616[_0xb0f4('0x3e')]=[{'all':!![]}];}_0x5c9616=_[_0xb0f4('0x3b')]({},_0x5c9616,_0x34b3ae[_0xb0f4('0x3c')]);return db[_0xb0f4('0x28')][_0xb0f4('0x42')](_0x5c9616)['then'](handleEntityNotFound(_0x14dc57,null))[_0xb0f4('0x21')](respondWithResult(_0x14dc57,null))[_0xb0f4('0x40')](handleError(_0x14dc57,null));};exports[_0xb0f4('0x43')]=function(_0x21a065,_0x323cb1){return db[_0xb0f4('0x28')]['create'](_0x21a065[_0xb0f4('0x44')],{})['then'](respondWithResult(_0x323cb1,0xc9))[_0xb0f4('0x40')](handleError(_0x323cb1,null));};exports[_0xb0f4('0x20')]=function(_0x55704d,_0x5fe634){if(_0x55704d[_0xb0f4('0x44')]['id']){delete _0x55704d[_0xb0f4('0x44')]['id'];}return db['WhatsappTransferReport'][_0xb0f4('0x42')]({'where':{'id':_0x55704d['params']['id']}})[_0xb0f4('0x21')](handleEntityNotFound(_0x5fe634,null))[_0xb0f4('0x21')](saveUpdates(_0x55704d[_0xb0f4('0x44')],null))[_0xb0f4('0x21')](respondWithResult(_0x5fe634,null))[_0xb0f4('0x40')](handleError(_0x5fe634,null));};exports[_0xb0f4('0x45')]=function(_0x28d9d4,_0x4d1846){return db[_0xb0f4('0x28')]['find']({'where':{'id':_0x28d9d4[_0xb0f4('0x46')]['id']}})[_0xb0f4('0x21')](handleEntityNotFound(_0x4d1846,null))[_0xb0f4('0x21')](removeEntity(_0x4d1846,null))[_0xb0f4('0x40')](handleError(_0x4d1846,null));};exports[_0xb0f4('0x47')]=function(_0x4220b9,_0x30f9aa){return db[_0xb0f4('0x28')]['describe']()[_0xb0f4('0x21')](respondWithResult(_0x30f9aa,null))[_0xb0f4('0x40')](handleError(_0x30f9aa,null));};
\ No newline at end of file
+var _0x6c90=['index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','then','stack','name','send'];(function(_0x4fb216,_0x3113a2){var _0x4c43a9=function(_0x19a0a2){while(--_0x19a0a2){_0x4fb216['push'](_0x4fb216['shift']());}};_0x4c43a9(++_0x3113a2);}(_0x6c90,0x1de));var _0x06c9=function(_0x39287a,_0x4d1e0f){_0x39287a=_0x39287a-0x0;var _0xb00df7=_0x6c90[_0x39287a];return _0xb00df7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06c9('0x0'));var zipdir=require(_0x06c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06c9('0x2'));var moment=require(_0x06c9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x06c9('0x4'));var util=require(_0x06c9('0x5'));var path=require(_0x06c9('0x6'));var sox=require(_0x06c9('0x7'));var csv=require(_0x06c9('0x8'));var ejs=require(_0x06c9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06c9('0xa'));var squel=require(_0x06c9('0xb'));var crypto=require('crypto');var jsforce=require(_0x06c9('0xc'));var deskjs=require(_0x06c9('0xd'));var toCsv=require(_0x06c9('0x8'));var querystring=require(_0x06c9('0xe'));var Papa=require(_0x06c9('0xf'));var Redis=require(_0x06c9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x06c9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06c9('0x12'));var logger=require(_0x06c9('0x13'))(_0x06c9('0x14'));var utils=require(_0x06c9('0x15'));var config=require(_0x06c9('0x16'));var licenseUtil=require(_0x06c9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x402913,_0xaa87dc){_0xaa87dc=_0xaa87dc||0xcc;return function(_0x51be73){if(_0x51be73){return _0x402913[_0x06c9('0x18')](_0xaa87dc);}return _0x402913['status'](_0xaa87dc)[_0x06c9('0x19')]();};}function respondWithResult(_0x4886c1,_0x2fc63d){_0x2fc63d=_0x2fc63d||0xc8;return function(_0x5e30d7){if(_0x5e30d7){return _0x4886c1['status'](_0x2fc63d)['json'](_0x5e30d7);}};}function respondWithFilteredResult(_0x43ad74,_0x597457){return function(_0x1b4ab5){if(_0x1b4ab5){var _0x5d92b5=typeof _0x597457[_0x06c9('0x1a')]===_0x06c9('0x1b')&&typeof _0x597457[_0x06c9('0x1c')]===_0x06c9('0x1b');var _0x7a6cd5=_0x1b4ab5[_0x06c9('0x1d')];var _0x1e875a=_0x5d92b5?0x0:_0x597457[_0x06c9('0x1a')];var _0x5dc4b1=_0x5d92b5?_0x1b4ab5[_0x06c9('0x1d')]:_0x597457[_0x06c9('0x1a')]+_0x597457[_0x06c9('0x1c')];var _0x1a4777;if(_0x5dc4b1>=_0x7a6cd5){_0x5dc4b1=_0x7a6cd5;_0x1a4777=0xc8;}else{_0x1a4777=0xce;}_0x43ad74[_0x06c9('0x1e')](_0x1a4777);return _0x43ad74[_0x06c9('0x1f')](_0x06c9('0x20'),_0x1e875a+'-'+_0x5dc4b1+'/'+_0x7a6cd5)[_0x06c9('0x21')](_0x1b4ab5);}return null;};}function patchUpdates(_0x2661fe){return function(_0x14084c){try{jsonpatch['apply'](_0x14084c,_0x2661fe,!![]);}catch(_0x320d26){return BPromise[_0x06c9('0x22')](_0x320d26);}return _0x14084c[_0x06c9('0x23')]();};}function saveUpdates(_0x2f83dd,_0x106aea){return function(_0x39b653){if(_0x39b653){return _0x39b653['update'](_0x2f83dd)[_0x06c9('0x24')](function(_0x3edcec){return _0x3edcec;});}return null;};}function removeEntity(_0x166ded,_0x13a0d3){return function(_0x4ad0c1){if(_0x4ad0c1){return _0x4ad0c1['destroy']()[_0x06c9('0x24')](function(){_0x166ded['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aeb4a,_0x42b73e){return function(_0xdd85d2){if(!_0xdd85d2){_0x5aeb4a['sendStatus'](0x194);}return _0xdd85d2;};}function handleError(_0x5d6792,_0x3efa50){_0x3efa50=_0x3efa50||0x1f4;return function(_0x4d5279){logger['error'](_0x4d5279[_0x06c9('0x25')]);if(_0x4d5279['name']){delete _0x4d5279[_0x06c9('0x26')];}_0x5d6792['status'](_0x3efa50)[_0x06c9('0x27')](_0x4d5279);};}exports[_0x06c9('0x28')]=function(_0x210a6b,_0x20bfe5){var _0x375330={},_0x22aabc={},_0x827da6={'count':0x0,'rows':[]};var _0x203f87=_[_0x06c9('0x29')](db[_0x06c9('0x2a')][_0x06c9('0x2b')],function(_0x4de1a8){return{'name':_0x4de1a8[_0x06c9('0x2c')],'type':_0x4de1a8[_0x06c9('0x2d')][_0x06c9('0x2e')]};});_0x22aabc[_0x06c9('0x2f')]=_[_0x06c9('0x29')](_0x203f87,'name');_0x22aabc[_0x06c9('0x30')]=_['keys'](_0x210a6b[_0x06c9('0x30')]);_0x22aabc[_0x06c9('0x31')]=_[_0x06c9('0x32')](_0x22aabc[_0x06c9('0x2f')],_0x22aabc[_0x06c9('0x30')]);_0x375330[_0x06c9('0x33')]=_[_0x06c9('0x32')](_0x22aabc['model'],qs['fields'](_0x210a6b['query'][_0x06c9('0x34')]));_0x375330[_0x06c9('0x33')]=_0x375330['attributes'][_0x06c9('0x35')]?_0x375330[_0x06c9('0x33')]:_0x22aabc[_0x06c9('0x2f')];if(!_0x210a6b[_0x06c9('0x30')]['hasOwnProperty']('nolimit')){_0x375330[_0x06c9('0x1c')]=qs['limit'](_0x210a6b[_0x06c9('0x30')]['limit']);_0x375330[_0x06c9('0x1a')]=qs['offset'](_0x210a6b['query'][_0x06c9('0x1a')]);}_0x375330[_0x06c9('0x36')]=qs[_0x06c9('0x37')](_0x210a6b['query'][_0x06c9('0x37')]);_0x375330[_0x06c9('0x38')]=qs[_0x06c9('0x31')](_[_0x06c9('0x39')](_0x210a6b[_0x06c9('0x30')],_0x22aabc[_0x06c9('0x31')]),_0x203f87);if(_0x210a6b[_0x06c9('0x30')][_0x06c9('0x3a')]){_0x375330['where']=_['merge'](_0x375330[_0x06c9('0x38')],{'$or':_[_0x06c9('0x29')](_0x203f87,function(_0x59254a){if(_0x59254a[_0x06c9('0x2d')]!==_0x06c9('0x3b')){var _0x3dc4fb={};_0x3dc4fb[_0x59254a[_0x06c9('0x26')]]={'$like':'%'+_0x210a6b[_0x06c9('0x30')]['filter']+'%'};return _0x3dc4fb;}})});}_0x375330=_[_0x06c9('0x3c')]({},_0x375330,_0x210a6b[_0x06c9('0x3d')]);var _0x301816={'where':_0x375330[_0x06c9('0x38')]};return db['WhatsappTransferReport'][_0x06c9('0x1d')](_0x301816)[_0x06c9('0x24')](function(_0x21667e){_0x827da6[_0x06c9('0x1d')]=_0x21667e;if(_0x210a6b[_0x06c9('0x30')][_0x06c9('0x3e')]){_0x375330[_0x06c9('0x3f')]=[{'all':!![]}];}return db[_0x06c9('0x2a')][_0x06c9('0x40')](_0x375330);})['then'](function(_0x4c99ed){_0x827da6['rows']=_0x4c99ed;return _0x827da6;})[_0x06c9('0x24')](respondWithFilteredResult(_0x20bfe5,_0x375330))[_0x06c9('0x41')](handleError(_0x20bfe5,null));};exports[_0x06c9('0x42')]=function(_0x7aaf39,_0x105c8e){var _0x55702a={'raw':!![],'where':{'id':_0x7aaf39[_0x06c9('0x43')]['id']}},_0x401ac6={};_0x401ac6[_0x06c9('0x2f')]=_[_0x06c9('0x44')](db[_0x06c9('0x2a')][_0x06c9('0x2b')]);_0x401ac6[_0x06c9('0x30')]=_['keys'](_0x7aaf39[_0x06c9('0x30')]);_0x401ac6[_0x06c9('0x31')]=_[_0x06c9('0x32')](_0x401ac6['model'],_0x401ac6[_0x06c9('0x30')]);_0x55702a['attributes']=_[_0x06c9('0x32')](_0x401ac6[_0x06c9('0x2f')],qs['fields'](_0x7aaf39['query'][_0x06c9('0x34')]));_0x55702a['attributes']=_0x55702a[_0x06c9('0x33')][_0x06c9('0x35')]?_0x55702a[_0x06c9('0x33')]:_0x401ac6['model'];if(_0x7aaf39[_0x06c9('0x30')][_0x06c9('0x3e')]){_0x55702a[_0x06c9('0x3f')]=[{'all':!![]}];}_0x55702a=_['merge']({},_0x55702a,_0x7aaf39[_0x06c9('0x3d')]);return db[_0x06c9('0x2a')][_0x06c9('0x45')](_0x55702a)[_0x06c9('0x24')](handleEntityNotFound(_0x105c8e,null))[_0x06c9('0x24')](respondWithResult(_0x105c8e,null))[_0x06c9('0x41')](handleError(_0x105c8e,null));};exports[_0x06c9('0x46')]=function(_0x5a30ba,_0x296849){return db[_0x06c9('0x2a')][_0x06c9('0x46')](_0x5a30ba[_0x06c9('0x47')],{})[_0x06c9('0x24')](respondWithResult(_0x296849,0xc9))[_0x06c9('0x41')](handleError(_0x296849,null));};exports[_0x06c9('0x48')]=function(_0x370826,_0x242e9c){if(_0x370826[_0x06c9('0x47')]['id']){delete _0x370826[_0x06c9('0x47')]['id'];}return db[_0x06c9('0x2a')][_0x06c9('0x45')]({'where':{'id':_0x370826[_0x06c9('0x43')]['id']}})[_0x06c9('0x24')](handleEntityNotFound(_0x242e9c,null))[_0x06c9('0x24')](saveUpdates(_0x370826[_0x06c9('0x47')],null))['then'](respondWithResult(_0x242e9c,null))[_0x06c9('0x41')](handleError(_0x242e9c,null));};exports['destroy']=function(_0x1fcf27,_0x458751){return db['WhatsappTransferReport'][_0x06c9('0x45')]({'where':{'id':_0x1fcf27[_0x06c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x458751,null))['then'](removeEntity(_0x458751,null))[_0x06c9('0x41')](handleError(_0x458751,null));};exports[_0x06c9('0x49')]=function(_0x323e79,_0x312e9f){return db[_0x06c9('0x2a')][_0x06c9('0x49')]()['then'](respondWithResult(_0x312e9f,null))[_0x06c9('0x41')](handleError(_0x312e9f,null));};
\ No newline at end of file
index 1d7a46b..ef6fdbe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7a6=['../../config/environment','exports','WhatsappTransferReport','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xe7a6,0x1c5));var _0x6e7a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe7a6[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6e7a('0x0'));var util=require(_0x6e7a('0x1'));var logger=require(_0x6e7a('0x2'))(_0x6e7a('0x3'));var moment=require(_0x6e7a('0x4'));var BPromise=require(_0x6e7a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e7a('0x6'));var rimraf=require('rimraf');var config=require(_0x6e7a('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x6e7a('0x8')]=function(_0x53bdd7,_0x55ca89){return _0x53bdd7['define'](_0x6e7a('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0de2=['./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x13c395,_0x175922){var _0x447d5c=function(_0x13e396){while(--_0x13e396){_0x13c395['push'](_0x13c395['shift']());}};_0x447d5c(++_0x175922);}(_0x0de2,0xee));var _0x20de=function(_0x4c6dd5,_0x3e2003){_0x4c6dd5=_0x4c6dd5-0x0;var _0x17d4d5=_0x0de2[_0x4c6dd5];return _0x17d4d5;};'use strict';var _=require(_0x20de('0x0'));var util=require(_0x20de('0x1'));var logger=require(_0x20de('0x2'))(_0x20de('0x3'));var moment=require(_0x20de('0x4'));var BPromise=require(_0x20de('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20de('0x6'));var rimraf=require(_0x20de('0x7'));var config=require(_0x20de('0x8'));var attributes=require(_0x20de('0x9'));module[_0x20de('0xa')]=function(_0x325be8,_0x2357dd){return _0x325be8[_0x20de('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0x20de('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 1f7dd75..99d5d40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24a3=['jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x200292,_0x50149c){var _0x3656ac=function(_0xe70484){while(--_0xe70484){_0x200292['push'](_0x200292['shift']());}};_0x3656ac(++_0x50149c);}(_0x24a3,0x1f0));var _0x324a=function(_0x1c9be8,_0x460eef){_0x1c9be8=_0x1c9be8-0x0;var _0x5619e2=_0x24a3[_0x1c9be8];return _0x5619e2;};'use strict';var _=require(_0x324a('0x0'));var util=require('util');var moment=require(_0x324a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x324a('0x2'));var db=require(_0x324a('0x3'))['db'];var utils=require(_0x324a('0x4'));var logger=require(_0x324a('0x5'))(_0x324a('0x6'));var config=require(_0x324a('0x7'));var jayson=require(_0x324a('0x8'));var client=jayson[_0x324a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30d6c7,_0x5905a0,_0x4242b0){return new BPromise(function(_0x2ae6cc,_0x18957f){return client[_0x324a('0xa')](_0x30d6c7,_0x4242b0)[_0x324a('0xb')](function(_0x3e77be){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x5905a0,_0x324a('0xc'));logger[_0x324a('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x5905a0,_0x324a('0xc'),JSON[_0x324a('0xe')](_0x3e77be));if(_0x3e77be[_0x324a('0xf')]){if(_0x3e77be[_0x324a('0xf')][_0x324a('0x10')]===0x1f4){logger[_0x324a('0xf')](_0x324a('0x11'),_0x5905a0,_0x3e77be['error']['message']);return _0x18957f(_0x3e77be[_0x324a('0xf')][_0x324a('0x12')]);}logger[_0x324a('0xf')](_0x324a('0x11'),_0x5905a0,_0x3e77be['error'][_0x324a('0x12')]);return _0x2ae6cc(_0x3e77be[_0x324a('0xf')][_0x324a('0x12')]);}else{logger[_0x324a('0x13')](_0x324a('0x11'),_0x5905a0,_0x324a('0xc'));_0x2ae6cc(_0x3e77be['result'][_0x324a('0x12')]);}})[_0x324a('0x14')](function(_0x55972e){logger[_0x324a('0xf')](_0x324a('0x11'),_0x5905a0,_0x55972e);_0x18957f(_0x55972e);});});}
\ No newline at end of file
+var _0x9715=['result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x28eff8,_0x2c6caa){var _0x564f95=function(_0x1251bd){while(--_0x1251bd){_0x28eff8['push'](_0x28eff8['shift']());}};_0x564f95(++_0x2c6caa);}(_0x9715,0x1b9));var _0x5971=function(_0x37655c,_0x1422ed){_0x37655c=_0x37655c-0x0;var _0x817126=_0x9715[_0x37655c];return _0x817126;};'use strict';var _=require(_0x5971('0x0'));var util=require(_0x5971('0x1'));var moment=require(_0x5971('0x2'));var BPromise=require('bluebird');var rs=require(_0x5971('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5971('0x4'));var logger=require(_0x5971('0x5'))(_0x5971('0x6'));var config=require(_0x5971('0x7'));var jayson=require(_0x5971('0x8'));var client=jayson[_0x5971('0x9')][_0x5971('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec89,_0x255ce6,_0x5495e9){return new BPromise(function(_0x56963b,_0x495160){return client[_0x5971('0xb')](_0x2ec89,_0x5495e9)['then'](function(_0x4dcf42){logger[_0x5971('0xc')](_0x5971('0xd'),_0x255ce6,'request\x20sent');logger[_0x5971('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x255ce6,_0x5971('0xf'),JSON['stringify'](_0x4dcf42));if(_0x4dcf42['error']){if(_0x4dcf42[_0x5971('0x10')][_0x5971('0x11')]===0x1f4){logger[_0x5971('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x255ce6,_0x4dcf42[_0x5971('0x10')][_0x5971('0x12')]);return _0x495160(_0x4dcf42[_0x5971('0x10')][_0x5971('0x12')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x255ce6,_0x4dcf42['error'][_0x5971('0x12')]);return _0x56963b(_0x4dcf42[_0x5971('0x10')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x255ce6,_0x5971('0xf'));_0x56963b(_0x4dcf42[_0x5971('0x13')]['message']);}})['catch'](function(_0x5114bc){logger['error'](_0x5971('0xd'),_0x255ce6,_0x5114bc);_0x495160(_0x5114bc);});});}
\ No newline at end of file
index ab5beec..78c9663 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed1f=['sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','online','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize'];(function(_0xe3fb68,_0x357e5b){var _0x1ba0a3=function(_0x3c3c79){while(--_0x3c3c79){_0xe3fb68['push'](_0xe3fb68['shift']());}};_0x1ba0a3(++_0x357e5b);}(_0xed1f,0x170));var _0xfed1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xed1f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfed1('0x0'));var db=require(_0xfed1('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xfed1('0x2'));var config=require('./config/environment');var logger=require(_0xfed1('0x3'))('app');var pm2=require(_0xfed1('0x4'));var pm2Config=require(_0xfed1('0x5'));var schedule=require(_0xfed1('0x6'));var chat=require(_0xfed1('0x7'));var whatsapp=require(_0xfed1('0x8'));var transcribe=require(_0xfed1('0x9'));var provider=require(_0xfed1('0xa'));function main(){return db[_0xfed1('0xb')][_0xfed1('0xc')]()[_0xfed1('0xd')](function(){if(config['seedDB']){return seedDb[_0xfed1('0xe')]();}})[_0xfed1('0xd')](function(){return checkLicense[_0xfed1('0xe')]();})['then'](function(){return rpc[_0xfed1('0xf')]();})['then'](function(_0x5d94ce){logger[_0xfed1('0x10')](_0x5d94ce);return chat[_0xfed1('0x11')]();})['then'](function(){return whatsapp['start']();})[_0xfed1('0xd')](function(){return schedule[_0xfed1('0x11')]();})['then'](function(){return transcribe[_0xfed1('0x11')]();})['then'](function(){return provider[_0xfed1('0x11')]();})[_0xfed1('0xd')](function(_0x445d36){logger[_0xfed1('0x10')](_0x445d36);return pm2['start'](pm2Config);})[_0xfed1('0xd')](function(_0x3754c2){var _0x4a0f51=_0x3754c2['filter'](function(_0x176227){return typeof _0x176227[_0xfed1('0x12')]===_0xfed1('0x13')&&_0x176227['exitCode']>=0x0;});if(_0x4a0f51[_0xfed1('0x14')]>0x0){throw new Error(_0x4a0f51[_0xfed1('0x14')]+_0xfed1('0x15')+_[_0xfed1('0x16')](_0x4a0f51,function(_0x5ab809){return'\x22'+_0x5ab809[_0xfed1('0x17')]['name']+'\x22';}));}logger[_0xfed1('0x10')](_0xfed1('0x18'),_[_0xfed1('0x16')](_[_0xfed1('0x19')](_0x3754c2,{'status':_0xfed1('0x1a')}),_0xfed1('0x1b'))[_0xfed1('0x1c')]());logger[_0xfed1('0x10')](_0xfed1('0x1d'),_['map'](_[_0xfed1('0x19')](_0x3754c2,function(_0x491497){return _0x491497[_0xfed1('0x1e')]!==_0xfed1('0x1a');}),_0xfed1('0x1b'))[_0xfed1('0x1c')]()||_0xfed1('0x1f'));console[_0xfed1('0x20')](_0xfed1('0x21'));})[_0xfed1('0x22')](function(_0x484f8a){console['log'](_0xfed1('0x23'),_0x484f8a);logger['error'](_0xfed1('0x24'),_0x484f8a);process[_0xfed1('0x25')](0x1);});}main();
\ No newline at end of file
+var _0x2263=['app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','default','then','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger'];(function(_0x2a304a,_0x13f72f){var _0x1dcb8c=function(_0x543605){while(--_0x543605){_0x2a304a['push'](_0x2a304a['shift']());}};_0x1dcb8c(++_0x13f72f);}(_0x2263,0x6e));var _0x3226=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x2263[_0x485f53];return _0x480f1e;};'use strict';var _=require(_0x3226('0x0'));var db=require(_0x3226('0x1'))['db'];var seedDb=require(_0x3226('0x2'));var checkLicense=require(_0x3226('0x3'));var rpc=require(_0x3226('0x4'));var config=require(_0x3226('0x5'));var logger=require(_0x3226('0x6'))(_0x3226('0x7'));var pm2=require('./config/pm2');var pm2Config=require(_0x3226('0x8'));var schedule=require(_0x3226('0x9'));var chat=require(_0x3226('0xa'));var whatsapp=require(_0x3226('0xb'));var transcribe=require(_0x3226('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x3226('0xd')][_0x3226('0xe')]()['then'](function(){if(config['seedDB']){return seedDb[_0x3226('0xf')]();}})[_0x3226('0x10')](function(){return checkLicense['default']();})[_0x3226('0x10')](function(){return rpc[_0x3226('0x11')]();})[_0x3226('0x10')](function(_0x91eee3){logger[_0x3226('0x12')](_0x91eee3);return chat[_0x3226('0x13')]();})[_0x3226('0x10')](function(){return whatsapp['start']();})[_0x3226('0x10')](function(){return schedule[_0x3226('0x13')]();})[_0x3226('0x10')](function(){return transcribe[_0x3226('0x13')]();})['then'](function(){return provider['start']();})['then'](function(_0x48a499){logger['info'](_0x48a499);return pm2[_0x3226('0x13')](pm2Config);})[_0x3226('0x10')](function(_0x114f4b){var _0x1b8552=_0x114f4b['filter'](function(_0x5b5c77){return typeof _0x5b5c77[_0x3226('0x14')]===_0x3226('0x15')&&_0x5b5c77[_0x3226('0x14')]>=0x0;});if(_0x1b8552['length']>0x0){throw new Error(_0x1b8552[_0x3226('0x16')]+_0x3226('0x17')+_[_0x3226('0x18')](_0x1b8552,function(_0x31d4f0){return'\x22'+_0x31d4f0[_0x3226('0x19')][_0x3226('0x1a')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x3226('0x18')](_['filter'](_0x114f4b,{'status':_0x3226('0x1b')}),_0x3226('0x1a'))[_0x3226('0x1c')]());logger[_0x3226('0x12')](_0x3226('0x1d'),_[_0x3226('0x18')](_['filter'](_0x114f4b,function(_0x2b4d38){return _0x2b4d38[_0x3226('0x1e')]!=='online';}),_0x3226('0x1a'))[_0x3226('0x1c')]()||_0x3226('0x1f'));console['log'](_0x3226('0x20'));})[_0x3226('0x21')](function(_0x25f867){console[_0x3226('0x22')](_0x3226('0x23'),_0x25f867);logger[_0x3226('0x24')](_0x3226('0x25'),_0x25f867);process[_0x3226('0x26')](0x1);});}main();
\ No newline at end of file
index 57057c0..f05c6f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x2ffc1e,_0x2c3b27){var _0x3014d1=function(_0x50ca45){while(--_0x50ca45){_0x2ffc1e['push'](_0x2ffc1e['shift']());}};_0x3014d1(++_0x2c3b27);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});}
\ No newline at end of file
+var _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x008c,0x188));var _0xc008=function(_0x231f6f,_0xf231e0){_0x231f6f=_0x231f6f-0x0;var _0xc621c4=_0x008c[_0x231f6f];return _0xc621c4;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});}
\ No newline at end of file
index 7e1e561..7014053 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x17f02a,_0x550941){var _0x527154=function(_0x220bfd){while(--_0x220bfd){_0x17f02a['push'](_0x17f02a['shift']());}};_0x527154(++_0x550941);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});};
\ No newline at end of file
+var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x158909,_0x2581c7){var _0x39f4a4=function(_0x3466c1){while(--_0x3466c1){_0x158909['push'](_0x158909['shift']());}};_0x39f4a4(++_0x2581c7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});};
\ No newline at end of file
index 5a8eebc..56528f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d8b=['c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','left_join','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','fieldType','datetime','DATE','buildExpression','default','value','start','end','split','map','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','resolve','role','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','DESC','Tag','name','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','isEmpty','t.id\x20IN\x20?','COUNT(*)','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','autocomplete','true','select','from','where'];(function(_0x48a5cc,_0x4d4796){var _0xeef6e4=function(_0x3945a0){while(--_0x3945a0){_0x48a5cc['push'](_0x48a5cc['shift']());}};_0xeef6e4(++_0x4d4796);}(_0x8d8b,0xd0));var _0xb8d8=function(_0x9daf72,_0x1e581b){_0x9daf72=_0x9daf72-0x0;var _0x1a1081=_0x8d8b[_0x9daf72];return _0x1a1081;};'use strict';var _=require(_0xb8d8('0x0'));var squel=require(_0xb8d8('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xb8d8('0x2'));var utils=require(_0xb8d8('0x3'));var db=require(_0xb8d8('0x4'))['db'];function skipContactsQuery(_0x114c4c,_0x102118){var _0xbcd8b2=![];if(_0x114c4c['role']===_0xb8d8('0x5')&&!_0x102118['search']&&!_0x102118[_0xb8d8('0x6')]&&_0x102118[_0xb8d8('0x7')]!==_0xb8d8('0x8')){_0xbcd8b2=!![];}return _0xbcd8b2;}function getContactsSubquery(){return squel[_0xb8d8('0x9')]()[_0xb8d8('0xa')]('cm_contacts','c')[_0xb8d8('0xb')](_0xb8d8('0xc'));}function applyJoinClauses(_0x4fd6a1,_0x5d2f85){var _0x4d7363=_0x5d2f85?'c':_0xb8d8('0xd');_0x4fd6a1['left_join'](_0xb8d8('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x4d7363+'.id')[_0xb8d8('0xf')]('cm_contact_has_tags','ct',_0xb8d8('0x10')+_0x4d7363+'.id')['left_join']('tools_tags','t',_0xb8d8('0x11'));return _0x4fd6a1;}function addFieldsToQuery(_0x200bde,_0x3f275f,_0x5a6904,_0x57c327,_0x28631e){var _0x367707=_0x28631e?'c':_0xb8d8('0xd');if(!_0x3f275f){_0x3f275f=['id',_0xb8d8('0x12'),_0xb8d8('0x13'),_0xb8d8('0x14'),'mobile',_0xb8d8('0x15'),_0xb8d8('0x16'),'ListId',_0xb8d8('0x17'),'createdAt',_0xb8d8('0x18'),_0xb8d8('0x19'),_0xb8d8('0x1a')];}else if(!_0x3f275f[_0xb8d8('0x1b')]('id')){_0x3f275f['push']('id');}var _0x2e99cc=_0x5a6904&&_0x28631e||!_0x5a6904&&!_0x28631e;if(_0x57c327){_0x2e99cc=_0x57c327&&_0x28631e||!_0x57c327&&!_0x28631e;}_0x3f275f[_0xb8d8('0x1c')](function(_0x55b552){if(_0x55b552===_0xb8d8('0x1a')){if(_0x2e99cc){_0x200bde['field'](_0xb8d8('0x1d'),_0x55b552);}else if(_0x5a6904||_0x57c327){_0x200bde[_0xb8d8('0x1e')](_0x367707+'.'+_0x55b552);}}else{_0x200bde[_0xb8d8('0x1e')](_0x367707+'.'+_0x55b552);}});return _0x200bde;}function getSqlClauses(){var _0x7774f2={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xb8d8('0x1f')](),'tags':{'clause':squel[_0xb8d8('0x1f')](),'ids':null},'user':{'clause':squel[_0xb8d8('0x1f')](),'skip':![]}};return _0x7774f2;}function parseTagParameter(_0x71c6b2){var _0xde9577=squel['expr']();if(_0x71c6b2){var _0x195d5a=utils[_0xb8d8('0x20')](_0x71c6b2);_0x195d5a[_0xb8d8('0x1c')](function(_0x56e4c5){_0xde9577['or'](_0xb8d8('0x21'),'%,'+_0x56e4c5+',%');});}return _0xde9577;}function parseSearchFilter(_0x4bcae2){var _0x46005d=squel[_0xb8d8('0x1f')]();if(_0x4bcae2){var _0x5edc43=_0x4bcae2[_0xb8d8('0x22')]('\x5c','\x5c\x5c')[_0xb8d8('0x22')](/'/g,'\x27\x27');if(_0x5edc43['split']('\x20')['length']>0x1){_0x46005d['or'](_0xb8d8('0x23'),qs[_0xb8d8('0x24')](_0x5edc43),null);}else{if(qs[_0xb8d8('0x25')](_0x5edc43)){_0x46005d['or'](_0xb8d8('0x26'),_0x5edc43+'%');_0x46005d['or'](_0xb8d8('0x27'),_0x5edc43+'%');_0x46005d['or'](_0xb8d8('0x28'),_0x5edc43+'%');_0x46005d['or'](_0xb8d8('0x29'),_0x5edc43+'%');}else if(qs[_0xb8d8('0x2a')](_0x5edc43)){_0x46005d['or']('c.email\x20LIKE\x20?',_0x5edc43+'%');}else{_0x46005d['or'](_0xb8d8('0x2b'),'%'+_0x5edc43+'%');_0x46005d['or'](_0xb8d8('0x2c'),'%'+_0x5edc43+'%');_0x46005d['or'](_0xb8d8('0x2d'),'%'+_0x5edc43+'%');}}}return _0x46005d;}function parseAdvancedSearchFilter(_0x1fba06,_0x3931b4){var _0x32d0c0=getSqlClauses();var _0x717049=as[_0xb8d8('0x2e')](_0x1fba06);var _0x2d9b27=_0x717049[_0xb8d8('0x2f')];for(var _0x3c817a=0x0;_0x3c817a<_0x717049[_0xb8d8('0x30')][_0xb8d8('0x31')];_0x3c817a++){var _0x10e02f=_0x717049[_0xb8d8('0x30')][_0x3c817a];var _0x3b0e41='c';var _0x1996d6=_[_0xb8d8('0x32')](_0x3931b4,['name',_0x10e02f[_0xb8d8('0x1e')]]);if(_0x1996d6){if(_0x10e02f[_0xb8d8('0x1e')]==='dateOfBirth'||_0x1996d6[_0xb8d8('0x33')]===_0xb8d8('0x34')){_0x10e02f['castTo']=_0xb8d8('0x35');}var _0x195462=as[_0xb8d8('0x36')](_0x3b0e41,_0x1996d6['type'],_0x10e02f);_0x32d0c0[_0xb8d8('0x37')][_0x2d9b27](_0x195462['text'],_0x195462[_0xb8d8('0x38')][_0xb8d8('0x39')],_0x195462['value'][_0xb8d8('0x3a')]);}else{if(_0x10e02f['field']==='Tag'){var _0xf1d63a=_0x10e02f[_0xb8d8('0x38')][_0xb8d8('0x3b')](',')[_0xb8d8('0x3c')](function(_0x31e14a){return Number(_0x31e14a);});var _0x104ee7=parseTagParameter(_0xf1d63a);_0x32d0c0['tags'][_0xb8d8('0x3d')][_0xb8d8('0x3e')](_0x104ee7);_0x32d0c0[_0xb8d8('0x3f')][_0xb8d8('0x40')]=_0xf1d63a;}else if(_0x10e02f[_0xb8d8('0x1e')]===_0xb8d8('0x41')){_0x32d0c0[_0xb8d8('0x42')][_0xb8d8('0x3d')][_0xb8d8('0x3e')](_0xb8d8('0x43'),_0x10e02f[_0xb8d8('0x38')]);_0x32d0c0[_0xb8d8('0x42')]['skip']=!![];}}}return _0x32d0c0;}function parseModelFields(_0x47fd58,_0x2ad273){var _0x3ccc4e=squel[_0xb8d8('0x1f')]();var _0x1022e6=_(_0x47fd58)[_0xb8d8('0x44')]()[_0xb8d8('0x3c')](function(_0x2fc53f){return _[_0xb8d8('0x45')](_0x2ad273,['name',_0x2fc53f])?_0x2fc53f:undefined;})[_0xb8d8('0x46')]()[_0xb8d8('0x38')]();if(_0x47fd58[_0xb8d8('0x47')]){_0x1022e6[_0xb8d8('0x48')](_0xb8d8('0x47'));}if(_0x1022e6[_0xb8d8('0x31')]>0x0){_0x1022e6[_0xb8d8('0x1c')](function(_0x90b55){if(_0x90b55===_0xb8d8('0x6')){_0x3ccc4e[_0xb8d8('0x3e')](_0xb8d8('0x49'),[][_0xb8d8('0x4a')](_0x47fd58[_0x90b55]));}else if(_0x90b55===_0xb8d8('0x47')){var _0x1b820c='%'+_0x47fd58[_0x90b55]+'%';_0x3ccc4e['and'](_0xb8d8('0x4b'),_0x1b820c);}else{_0x3ccc4e['and']('c.'+_0x90b55+_0xb8d8('0x4c'),_0x47fd58[_0x90b55]);}});}return _0x3ccc4e;}function parseQueryParameters(_0x529513,_0x4bdfcc){var _0x475839=getSqlClauses();return Promise['resolve']()[_0xb8d8('0x4d')](function(){return parseModelFields(_0x529513,_0x4bdfcc);})['then'](function(_0x53ce6d){_0x475839[_0xb8d8('0x4e')]['and'](_0x53ce6d);return parseTagParameter(_0x529513[_0xb8d8('0x4f')]);})[_0xb8d8('0x4d')](function(_0x3aab32){_0x475839[_0xb8d8('0x3f')]['clause'][_0xb8d8('0x3e')](_0x3aab32);return parseSearchFilter(_0x529513['filter']);})[_0xb8d8('0x4d')](function(_0x407344){_0x475839[_0xb8d8('0x50')]=_0x407344;return _0x475839;});}function checkListsRestrictions(_0x159c99,_0x1c56b4,_0x173719){var _0x3042b4=squel[_0xb8d8('0x1f')]();return Promise[_0xb8d8('0x51')]()[_0xb8d8('0x4d')](function(){if(_0x1c56b4['search']&&_0x159c99[_0xb8d8('0x52')]==='agent'&&!_0x173719){return _0x159c99[_0xb8d8('0x53')]({'attributes':['id'],'raw':!![]});}})[_0xb8d8('0x4d')](function(_0x58407f){if(_0x58407f){if(_0x58407f[_0xb8d8('0x31')]===0x0){_0x3042b4[_0xb8d8('0x3e')](_0xb8d8('0x54'));}else{_0x3042b4[_0xb8d8('0x3e')](_0xb8d8('0x49'),_['map'](_0x58407f,'id'));}}})[_0xb8d8('0x4d')](function(){return _0x3042b4;});}function buildContactsQuery(_0x2e13a8,_0x10dc20,_0x1e3f24,_0x1ce2ec,_0x5d304b,_0x3a2a2a){if(_0x10dc20){_0x10dc20=_0x1e3f24[_0xb8d8('0x55')];}_0x2e13a8=addFieldsToQuery(_0x2e13a8,_0x10dc20,_0x1ce2ec,_0x3a2a2a,!![]);var _0x40b708=squel[_0xb8d8('0x9')]();_0x40b708=addFieldsToQuery(_0x40b708,_0x10dc20,_0x1ce2ec,_0x3a2a2a,![]);if(_0x1ce2ec||_0x3a2a2a){_0x2e13a8=applyJoinClauses(_0x2e13a8,!![]);_0x2e13a8[_0xb8d8('0x56')](_0xb8d8('0x57'));if(_0x1e3f24['limit']){_0x40b708[_0xb8d8('0x58')](_0x1e3f24[_0xb8d8('0x58')]);}if(_0x1e3f24[_0xb8d8('0x59')]){_0x40b708[_0xb8d8('0x59')](_0x1e3f24[_0xb8d8('0x59')]);}}else{_0x40b708=applyJoinClauses(_0x40b708,![]);_0x40b708['group'](_0xb8d8('0x5a'));if(_0x1e3f24[_0xb8d8('0x58')]){_0x2e13a8[_0xb8d8('0x58')](_0x1e3f24['limit']);}if(_0x1e3f24['offset']){_0x2e13a8[_0xb8d8('0x59')](_0x1e3f24[_0xb8d8('0x59')]);}}_0x40b708[_0xb8d8('0x5b')](_0x5d304b);if(_0x1e3f24[_0xb8d8('0x5c')]){_0x1e3f24['order'][_0xb8d8('0x1c')](function(_0x5481b0){_0x2e13a8[_0xb8d8('0x5c')]('c.'+_0x5481b0[0x0],_0x5481b0[0x1]==='DESC'?![]:!![]);_0x40b708[_0xb8d8('0x5c')](_0xb8d8('0x5d')+_0x5481b0[0x0],_0x5481b0[0x1]===_0xb8d8('0x5e')?![]:!![]);});}_0x40b708[_0xb8d8('0xa')](_0x2e13a8,_0xb8d8('0xd'));return _0x40b708;}function getFilteredContacts(_0x40cc34){var _0x9457f2=[];return db[_0xb8d8('0x5f')]['findAll']({'attributes':['id',_0xb8d8('0x60'),_0xb8d8('0x61')],'raw':!![]})[_0xb8d8('0x4d')](function(_0x5cffd5){_0x9457f2=_[_0xb8d8('0x62')](_0x5cffd5,'id');var _0x2b01b0={'type':db[_0xb8d8('0x63')][_0xb8d8('0x64')][_0xb8d8('0x65')],'model':db[_0xb8d8('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb8d8('0x67')][_0xb8d8('0x68')](_0x40cc34[_0xb8d8('0x69')](),_0x2b01b0);})[_0xb8d8('0x4d')](function(_0x102487){_0x102487[_0xb8d8('0x1c')](function(_0x59f510){if(_0x59f510[_0xb8d8('0x1a')]){_0x59f510[_0xb8d8('0x6a')]=[];_0x59f510[_0xb8d8('0x1a')][_0xb8d8('0x3b')](',')['forEach'](function(_0x3bbee2){_0x59f510[_0xb8d8('0x6a')][_0xb8d8('0x48')](_0x9457f2[_0x3bbee2]);});}delete _0x59f510['TagIds'];});return _0x102487;});}function countFilteredContacts(_0x109856,_0x54e00c){var _0x58ed9c=_0x109856['clone']();_0x58ed9c[_0xb8d8('0x1e')]('COUNT(*)');_0x58ed9c=applyJoinClauses(_0x58ed9c,!![]);_0x109856[_0xb8d8('0x56')]('c.id');var _0x1df515=utils[_0xb8d8('0x20')](_0x54e00c);if(!_[_0xb8d8('0x6b')](_0x1df515)){_0x58ed9c[_0xb8d8('0xb')](_0xb8d8('0x6c'),_0x1df515);}var _0x5557f8={'type':db['Sequelize']['QueryTypes'][_0xb8d8('0x65')],'raw':!![]};return db[_0xb8d8('0x67')]['query'](_0x58ed9c[_0xb8d8('0x69')](),_0x5557f8)[_0xb8d8('0x4d')](function(_0x37e496){return _0x37e496[0x0][_0xb8d8('0x6d')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery};
\ No newline at end of file
+var _0x3b23=['Sequelize','QueryTypes','SELECT','query','Tags','clone','isEmpty','sequelize','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','search','ListId','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','sqlOperator','name','dateOfBirth','castTo','DATE','buildExpression','default','text','value','start','Tag','map','tags','clause','user','and','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy'];(function(_0x167cd3,_0x3636be){var _0x3e6bf5=function(_0xe91723){while(--_0xe91723){_0x167cd3['push'](_0x167cd3['shift']());}};_0x3e6bf5(++_0x3636be);}(_0x3b23,0x1aa));var _0x33b2=function(_0x250efd,_0x22d8ea){_0x250efd=_0x250efd-0x0;var _0x2b5660=_0x3b23[_0x250efd];return _0x2b5660;};'use strict';var _=require(_0x33b2('0x0'));var squel=require(_0x33b2('0x1'));var as=require(_0x33b2('0x2'));var qs=require('../parsers/qs');var utils=require(_0x33b2('0x3'));var db=require(_0x33b2('0x4'))['db'];function skipContactsQuery(_0x5129dc,_0x338330){var _0x5b411b=![];if(_0x5129dc['role']==='agent'&&!_0x338330[_0x33b2('0x5')]&&!_0x338330[_0x33b2('0x6')]&&_0x338330['autocomplete']!==_0x33b2('0x7')){_0x5b411b=!![];}return _0x5b411b;}function getContactsSubquery(){return squel[_0x33b2('0x8')]()[_0x33b2('0x9')](_0x33b2('0xa'),'c')[_0x33b2('0xb')](_0x33b2('0xc'));}function applyJoinClauses(_0xd15dd6,_0x593461){var _0x43f2c2=_0x593461?'c':_0x33b2('0xd');_0xd15dd6[_0x33b2('0xe')](_0x33b2('0xf'),'uc','uc.CmContactId\x20=\x20'+_0x43f2c2+_0x33b2('0x10'))[_0x33b2('0xe')](_0x33b2('0x11'),'ct',_0x33b2('0x12')+_0x43f2c2+'.id')[_0x33b2('0xe')](_0x33b2('0x13'),'t',_0x33b2('0x14'));return _0xd15dd6;}function addFieldsToQuery(_0x4bd9d2,_0x41b766,_0x277b68,_0x11ca10,_0x355d46){var _0x4154fa=_0x355d46?'c':'subqry';if(!_0x41b766){_0x41b766=['id',_0x33b2('0x15'),_0x33b2('0x16'),_0x33b2('0x17'),_0x33b2('0x18'),_0x33b2('0x19'),_0x33b2('0x1a'),_0x33b2('0x6'),_0x33b2('0x1b'),'createdAt',_0x33b2('0x1c'),_0x33b2('0x1d'),_0x33b2('0x1e')];}else if(!_0x41b766[_0x33b2('0x1f')]('id')){_0x41b766[_0x33b2('0x20')]('id');}var _0x490ac4=_0x277b68&&_0x355d46||!_0x277b68&&!_0x355d46;if(_0x11ca10){_0x490ac4=_0x11ca10&&_0x355d46||!_0x11ca10&&!_0x355d46;}_0x41b766[_0x33b2('0x21')](function(_0xd26a45){if(_0xd26a45===_0x33b2('0x1e')){if(_0x490ac4){_0x4bd9d2[_0x33b2('0x22')](_0x33b2('0x23'),_0xd26a45);}else if(_0x277b68||_0x11ca10){_0x4bd9d2['field'](_0x4154fa+'.'+_0xd26a45);}}else{_0x4bd9d2[_0x33b2('0x22')](_0x4154fa+'.'+_0xd26a45);}});return _0x4bd9d2;}function getSqlClauses(){var _0xb04985={'default':squel[_0x33b2('0x24')](),'fields':squel['expr'](),'filter':squel[_0x33b2('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0xb04985;}function parseTagParameter(_0x369b60){var _0x58a49d=squel['expr']();if(_0x369b60){var _0x3a9648=utils['getSelectedTags'](_0x369b60);_0x3a9648[_0x33b2('0x21')](function(_0xa42a7d){_0x58a49d['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa42a7d+',%');});}return _0x58a49d;}function parseSearchFilter(_0x2825f9){var _0x11209c=squel[_0x33b2('0x24')]();if(_0x2825f9){var _0x402249=_0x2825f9[_0x33b2('0x25')]('\x5c','\x5c\x5c')[_0x33b2('0x25')](/'/g,'\x27\x27');if(_0x402249[_0x33b2('0x26')]('\x20')[_0x33b2('0x27')]>0x1){_0x11209c['or'](_0x33b2('0x28'),qs[_0x33b2('0x29')](_0x402249),null);}else{if(qs['isNumeric'](_0x402249)){_0x11209c['or'](_0x33b2('0x2a'),_0x402249+'%');_0x11209c['or'](_0x33b2('0x2b'),_0x402249+'%');_0x11209c['or'](_0x33b2('0x2c'),_0x402249+'%');_0x11209c['or'](_0x33b2('0x2d'),_0x402249+'%');}else if(qs[_0x33b2('0x2e')](_0x402249)){_0x11209c['or'](_0x33b2('0x2f'),_0x402249+'%');}else{_0x11209c['or']('c.firstName\x20LIKE\x20?','%'+_0x402249+'%');_0x11209c['or']('c.lastName\x20LIKE\x20?','%'+_0x402249+'%');_0x11209c['or']('c.email\x20LIKE\x20?','%'+_0x402249+'%');}}}return _0x11209c;}function parseAdvancedSearchFilter(_0x2a5098,_0x48e8f3){var _0x2fc802=getSqlClauses();var _0x25591e=as['parseSearch'](_0x2a5098);var _0x22e9bc=_0x25591e[_0x33b2('0x30')];for(var _0x5f008d=0x0;_0x5f008d<_0x25591e['conditions'][_0x33b2('0x27')];_0x5f008d++){var _0xe3e4ca=_0x25591e['conditions'][_0x5f008d];var _0x533cdb='c';var _0x358138=_['find'](_0x48e8f3,[_0x33b2('0x31'),_0xe3e4ca[_0x33b2('0x22')]]);if(_0x358138){if(_0xe3e4ca[_0x33b2('0x22')]===_0x33b2('0x32')||_0x358138['fieldType']==='datetime'){_0xe3e4ca[_0x33b2('0x33')]=_0x33b2('0x34');}var _0x5077ef=as[_0x33b2('0x35')](_0x533cdb,_0x358138['type'],_0xe3e4ca);_0x2fc802[_0x33b2('0x36')][_0x22e9bc](_0x5077ef[_0x33b2('0x37')],_0x5077ef[_0x33b2('0x38')][_0x33b2('0x39')],_0x5077ef[_0x33b2('0x38')]['end']);}else{if(_0xe3e4ca['field']===_0x33b2('0x3a')){var _0x467d18=_0xe3e4ca[_0x33b2('0x38')][_0x33b2('0x26')](',')[_0x33b2('0x3b')](function(_0x32c5f8){return Number(_0x32c5f8);});var _0x3d1998=parseTagParameter(_0x467d18);_0x2fc802[_0x33b2('0x3c')][_0x33b2('0x3d')]['and'](_0x3d1998);_0x2fc802[_0x33b2('0x3c')]['ids']=_0x467d18;}else if(_0xe3e4ca[_0x33b2('0x22')]==='User'){_0x2fc802[_0x33b2('0x3e')]['clause'][_0x33b2('0x3f')]('uc.UserId\x20=\x20?',_0xe3e4ca['value']);_0x2fc802[_0x33b2('0x3e')][_0x33b2('0x40')]=!![];}}}return _0x2fc802;}function parseModelFields(_0x53abc0,_0x6ce823){var _0x2d4200=squel[_0x33b2('0x24')]();var _0xac45ec=_(_0x53abc0)[_0x33b2('0x41')]()['map'](function(_0x4a3416){return _[_0x33b2('0x42')](_0x6ce823,[_0x33b2('0x31'),_0x4a3416])?_0x4a3416:undefined;})[_0x33b2('0x43')]()[_0x33b2('0x38')]();if(_0x53abc0['Contact']){_0xac45ec[_0x33b2('0x20')](_0x33b2('0x44'));}if(_0xac45ec[_0x33b2('0x27')]>0x0){_0xac45ec[_0x33b2('0x21')](function(_0x1e7149){if(_0x1e7149===_0x33b2('0x6')){_0x2d4200[_0x33b2('0x3f')](_0x33b2('0x45'),[]['concat'](_0x53abc0[_0x1e7149]));}else if(_0x1e7149===_0x33b2('0x44')){var _0x15c51c='%'+_0x53abc0[_0x1e7149]+'%';_0x2d4200['and'](_0x33b2('0x46'),_0x15c51c);}else{_0x2d4200[_0x33b2('0x3f')]('c.'+_0x1e7149+_0x33b2('0x47'),_0x53abc0[_0x1e7149]);}});}return _0x2d4200;}function parseQueryParameters(_0x2a4fa1,_0x483f49){var _0x549b0a=getSqlClauses();return Promise[_0x33b2('0x48')]()[_0x33b2('0x49')](function(){return parseModelFields(_0x2a4fa1,_0x483f49);})[_0x33b2('0x49')](function(_0x3aa6a0){_0x549b0a[_0x33b2('0x4a')][_0x33b2('0x3f')](_0x3aa6a0);return parseTagParameter(_0x2a4fa1[_0x33b2('0x4b')]);})['then'](function(_0x3ee4c9){_0x549b0a[_0x33b2('0x3c')]['clause'][_0x33b2('0x3f')](_0x3ee4c9);return parseSearchFilter(_0x2a4fa1[_0x33b2('0x4c')]);})['then'](function(_0x545207){_0x549b0a['filter']=_0x545207;return _0x549b0a;});}function checkListsRestrictions(_0x9d5ea0,_0x191d92,_0x1d0092){var _0x5a3f70=squel[_0x33b2('0x24')]();return Promise['resolve']()[_0x33b2('0x49')](function(){if(_0x191d92['search']&&_0x9d5ea0[_0x33b2('0x4d')]===_0x33b2('0x4e')&&!_0x1d0092){return _0x9d5ea0[_0x33b2('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3a9b97){if(_0x3a9b97){if(_0x3a9b97[_0x33b2('0x27')]===0x0){_0x5a3f70[_0x33b2('0x3f')](_0x33b2('0x50'));}else{_0x5a3f70['and']('c.ListId\x20IN\x20?',_['map'](_0x3a9b97,'id'));}}})[_0x33b2('0x49')](function(){return _0x5a3f70;});}function buildContactsQuery(_0x1659e8,_0x5a69c3,_0x36ef79,_0xaf7c24,_0x14c0ae,_0x5a70fa){if(_0x5a69c3){_0x5a69c3=_0x36ef79[_0x33b2('0x51')];}_0x1659e8=addFieldsToQuery(_0x1659e8,_0x5a69c3,_0xaf7c24,_0x5a70fa,!![]);var _0x2aa320=squel['select']();_0x2aa320=addFieldsToQuery(_0x2aa320,_0x5a69c3,_0xaf7c24,_0x5a70fa,![]);if(_0xaf7c24||_0x5a70fa){_0x1659e8=applyJoinClauses(_0x1659e8,!![]);_0x1659e8[_0x33b2('0x52')](_0x33b2('0x53'));if(_0x36ef79['limit']){_0x2aa320[_0x33b2('0x54')](_0x36ef79[_0x33b2('0x54')]);}if(_0x36ef79[_0x33b2('0x55')]){_0x2aa320[_0x33b2('0x55')](_0x36ef79['offset']);}}else{_0x2aa320=applyJoinClauses(_0x2aa320,![]);_0x2aa320[_0x33b2('0x52')](_0x33b2('0x56'));if(_0x36ef79[_0x33b2('0x54')]){_0x1659e8[_0x33b2('0x54')](_0x36ef79[_0x33b2('0x54')]);}if(_0x36ef79['offset']){_0x1659e8[_0x33b2('0x55')](_0x36ef79[_0x33b2('0x55')]);}}_0x2aa320[_0x33b2('0x57')](_0x14c0ae);if(_0x36ef79[_0x33b2('0x58')]){_0x36ef79[_0x33b2('0x58')][_0x33b2('0x21')](function(_0x578a1a){_0x1659e8[_0x33b2('0x58')]('c.'+_0x578a1a[0x0],_0x578a1a[0x1]===_0x33b2('0x59')?![]:!![]);_0x2aa320[_0x33b2('0x58')](_0x33b2('0x5a')+_0x578a1a[0x0],_0x578a1a[0x1]===_0x33b2('0x59')?![]:!![]);});}_0x2aa320[_0x33b2('0x9')](_0x1659e8,_0x33b2('0xd'));return _0x2aa320;}function getFilteredContacts(_0x383d8f){var _0x255e4e=[];return db[_0x33b2('0x3a')][_0x33b2('0x5b')]({'attributes':['id','name',_0x33b2('0x5c')],'raw':!![]})[_0x33b2('0x49')](function(_0x4e5678){_0x255e4e=_[_0x33b2('0x5d')](_0x4e5678,'id');var _0x2cfffe={'type':db[_0x33b2('0x5e')][_0x33b2('0x5f')][_0x33b2('0x60')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x33b2('0x61')](_0x383d8f['toString'](),_0x2cfffe);})['then'](function(_0x50e3bc){_0x50e3bc[_0x33b2('0x21')](function(_0x45a56b){if(_0x45a56b[_0x33b2('0x1e')]){_0x45a56b[_0x33b2('0x62')]=[];_0x45a56b[_0x33b2('0x1e')][_0x33b2('0x26')](',')['forEach'](function(_0x31677f){_0x45a56b[_0x33b2('0x62')][_0x33b2('0x20')](_0x255e4e[_0x31677f]);});}delete _0x45a56b[_0x33b2('0x1e')];});return _0x50e3bc;});}function countFilteredContacts(_0x5ca171,_0x13b808){var _0x3ad2cd=_0x5ca171[_0x33b2('0x63')]();_0x3ad2cd[_0x33b2('0x22')]('COUNT(*)');_0x3ad2cd=applyJoinClauses(_0x3ad2cd,!![]);_0x5ca171[_0x33b2('0x52')](_0x33b2('0x53'));var _0x131536=utils['getSelectedTags'](_0x13b808);if(!_[_0x33b2('0x64')](_0x131536)){_0x3ad2cd[_0x33b2('0xb')]('t.id\x20IN\x20?',_0x131536);}var _0x1a9367={'type':db[_0x33b2('0x5e')][_0x33b2('0x5f')]['SELECT'],'raw':!![]};return db[_0x33b2('0x65')][_0x33b2('0x61')](_0x3ad2cd['toString'](),_0x1a9367)[_0x33b2('0x49')](function(_0x3449a3){return _0x3449a3[0x0][_0x33b2('0x66')];});}module[_0x33b2('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery};
\ No newline at end of file
index 5657deb..aca8dbf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe136=['aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','end','final','write','decryptFile','createDecipher','close','unlink','encryptString','secret','createCipher','utf8','base64','bluebird','lodash','../../config/environment','../../config/logger','app','session'];(function(_0x2ad8f7,_0xccb550){var _0x51fa2c=function(_0x227b0b){while(--_0x227b0b){_0x2ad8f7['push'](_0x2ad8f7['shift']());}};_0x51fa2c(++_0xccb550);}(_0xe136,0x11a));var _0x6e13=function(_0x1b517e,_0x5a8934){_0x1b517e=_0x1b517e-0x0;var _0x248129=_0xe136[_0x1b517e];return _0x248129;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x6e13('0x0'));var _=require(_0x6e13('0x1'));var config=require(_0x6e13('0x2'));var logger=require(_0x6e13('0x3'))(_0x6e13('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x6e13('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x6e13('0x6')};if(config['encrypt']&&config[_0x6e13('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x6e13('0x7')][_0x6e13('0x8')]);if(isSupported){fileOptions[_0x6e13('0x8')]=config[_0x6e13('0x7')][_0x6e13('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x6e13('0x7')]['algorithm'],_0x6e13('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x5df090){return AES_SUPPORTED_RX[_0x6e13('0xa')](_0x5df090);}function getSupportedCiphers(){return crypto[_0x6e13('0xb')]()[_0x6e13('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x5b70d9){return getSupportedCiphers()[_0x6e13('0xd')](_0x5b70d9)>-0x1;}function combineOptions(_0x69a3ba){var _0x729152={};for(var _0x5506d5 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5506d5)){_0x729152[_0x5506d5]=fileOptions[_0x5506d5];}}if(_0x69a3ba){for(var _0x3883f9 in _0x69a3ba){if(_0x69a3ba[_0x6e13('0xe')](_0x3883f9)){_0x729152[_0x3883f9]=_0x69a3ba[_0x3883f9];}}}return _0x729152;}exports['encryptFile']=function(_0x1cb934,_0x3312f3,_0x3b1dd7,_0x57d714){return new BPromise(function(_0x4335bf,_0xcc4638){_0x57d714=combineOptions(_0x57d714);var _0xab5349=new Buffer(_0x3b1dd7);var _0x5a96f5=fs[_0x6e13('0xf')](_0x1cb934);var _0x512f7d=fs[_0x6e13('0x10')](_0x3312f3);var _0x8fd3b9=crypto['createCipher'](_0x57d714[_0x6e13('0x8')],_0xab5349);_0x5a96f5['on'](_0x6e13('0x11'),function(_0x46a859){var _0x236f09=new Buffer(_0x8fd3b9[_0x6e13('0x12')](_0x46a859),_0x6e13('0x13'));_0x512f7d['write'](_0x236f09);});_0x5a96f5['on'](_0x6e13('0x14'),function(){try{var _0x2e8b06=new Buffer(_0x8fd3b9[_0x6e13('0x15')](_0x6e13('0x13')),_0x6e13('0x13'));_0x512f7d[_0x6e13('0x16')](_0x2e8b06);_0x512f7d[_0x6e13('0x14')]();_0x512f7d['on']('close',function(){return _0x4335bf(_0x3312f3);});}catch(_0x31dd07){fs['unlink'](_0x3312f3);return _0xcc4638(_0x31dd07);}});});};exports[_0x6e13('0x17')]=function(_0x162ca7,_0x394507,_0x325123,_0x53ec65){return new BPromise(function(_0x3a0512,_0x46d2a6){_0x53ec65=combineOptions(_0x53ec65);var _0x1f4bdd=new Buffer(_0x325123);var _0x5b68a4=fs['createReadStream'](_0x162ca7);var _0x2c6a3b=fs['createWriteStream'](_0x394507);var _0x487164=crypto[_0x6e13('0x18')](_0x53ec65[_0x6e13('0x8')],_0x1f4bdd);_0x5b68a4['on'](_0x6e13('0x11'),function(_0x5d042d){var _0x215940=new Buffer(_0x487164[_0x6e13('0x12')](_0x5d042d),_0x6e13('0x13'));_0x2c6a3b[_0x6e13('0x16')](_0x215940);});_0x5b68a4['on'](_0x6e13('0x14'),function(){try{var _0x30a8a0=new Buffer(_0x487164[_0x6e13('0x15')](_0x6e13('0x13')),'binary');_0x2c6a3b[_0x6e13('0x16')](_0x30a8a0);_0x2c6a3b[_0x6e13('0x14')]();_0x2c6a3b['on'](_0x6e13('0x19'),function(){return _0x3a0512(_0x394507);});}catch(_0x2a4ba7){fs[_0x6e13('0x1a')](_0x394507);return _0x46d2a6(_0x2a4ba7);}});});};exports[_0x6e13('0x1b')]=function(_0x12c396,_0x1593e9,_0x57bfad){var _0x3cf96e=_0x57bfad||stringOptions[_0x6e13('0x8')];var _0x4a6e8d=_0x1593e9||stringOptions[_0x6e13('0x1c')];var _0x414d0e=crypto[_0x6e13('0x1d')](_0x3cf96e,_0x4a6e8d);var _0x2a3bb9=_0x414d0e[_0x6e13('0x12')](_0x12c396,_0x6e13('0x1e'),'base64');_0x2a3bb9+=_0x414d0e[_0x6e13('0x15')](_0x6e13('0x1f'));return _0x2a3bb9;};exports['decryptString']=function(_0xc2398b,_0xb2ec34,_0x24d433){var _0x126537=_0x24d433||stringOptions[_0x6e13('0x8')];var _0x66b2ff=_0xb2ec34||stringOptions[_0x6e13('0x1c')];var _0x12b10f=crypto['createDecipher'](_0x126537,_0x66b2ff);var _0x2c1bbc=_0x12b10f[_0x6e13('0x12')](_0xc2398b,_0x6e13('0x1f'),'utf8');_0x2c1bbc+=_0x12b10f[_0x6e13('0x15')]('utf8');return _0x2c1bbc;};
\ No newline at end of file
+var _0xf0ec=['secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','data','binary','write','end','close','unlink','decryptFile','createReadStream','createDecipher','update','secret','createCipher','utf8','base64','decryptString','final','crypto','bluebird','lodash','app'];(function(_0x221d95,_0x7c506e){var _0x35958d=function(_0x24fe60){while(--_0x24fe60){_0x221d95['push'](_0x221d95['shift']());}};_0x35958d(++_0x7c506e);}(_0xf0ec,0x11c));var _0xcf0e=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0xf0ec[_0x5465e6];return _0x10044e;};'use strict';var crypto=require(_0xcf0e('0x0'));var fs=require('fs');var BPromise=require(_0xcf0e('0x1'));var _=require(_0xcf0e('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xcf0e('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xcf0e('0x4')][_0xcf0e('0x5')],'algorithm':_0xcf0e('0x6')};const fileOptions={'algorithm':_0xcf0e('0x7')};if(config[_0xcf0e('0x8')]&&config[_0xcf0e('0x8')][_0xcf0e('0x9')]){var isSupported=isAlgorithmSupported(config[_0xcf0e('0x8')][_0xcf0e('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xcf0e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xcf0e('0xa')](',\x20');logger['error'](config[_0xcf0e('0x8')][_0xcf0e('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4ae6c5){return AES_SUPPORTED_RX['test'](_0x4ae6c5);}function getSupportedCiphers(){return crypto[_0xcf0e('0xb')]()[_0xcf0e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x19489e){return getSupportedCiphers()[_0xcf0e('0xd')](_0x19489e)>-0x1;}function combineOptions(_0x179470){var _0x2990aa={};for(var _0x278c7c in fileOptions){if(fileOptions[_0xcf0e('0xe')](_0x278c7c)){_0x2990aa[_0x278c7c]=fileOptions[_0x278c7c];}}if(_0x179470){for(var _0x76ff2c in _0x179470){if(_0x179470[_0xcf0e('0xe')](_0x76ff2c)){_0x2990aa[_0x76ff2c]=_0x179470[_0x76ff2c];}}}return _0x2990aa;}exports[_0xcf0e('0xf')]=function(_0x38a7ef,_0x351389,_0x1d1ba7,_0x522eb0){return new BPromise(function(_0x11cbc6,_0x54ed06){_0x522eb0=combineOptions(_0x522eb0);var _0x309165=new Buffer(_0x1d1ba7);var _0x15b418=fs['createReadStream'](_0x38a7ef);var _0x449281=fs['createWriteStream'](_0x351389);var _0x36f55f=crypto['createCipher'](_0x522eb0[_0xcf0e('0x9')],_0x309165);_0x15b418['on'](_0xcf0e('0x10'),function(_0x1654f1){var _0x4f2491=new Buffer(_0x36f55f['update'](_0x1654f1),_0xcf0e('0x11'));_0x449281[_0xcf0e('0x12')](_0x4f2491);});_0x15b418['on'](_0xcf0e('0x13'),function(){try{var _0x6c1224=new Buffer(_0x36f55f['final'](_0xcf0e('0x11')),_0xcf0e('0x11'));_0x449281['write'](_0x6c1224);_0x449281[_0xcf0e('0x13')]();_0x449281['on'](_0xcf0e('0x14'),function(){return _0x11cbc6(_0x351389);});}catch(_0x281b35){fs[_0xcf0e('0x15')](_0x351389);return _0x54ed06(_0x281b35);}});});};exports[_0xcf0e('0x16')]=function(_0x4c3ae7,_0x5bb400,_0x222ab6,_0x5d1472){return new BPromise(function(_0x175308,_0x5522c7){_0x5d1472=combineOptions(_0x5d1472);var _0x4fa4c1=new Buffer(_0x222ab6);var _0x32b557=fs[_0xcf0e('0x17')](_0x4c3ae7);var _0x3bcb77=fs['createWriteStream'](_0x5bb400);var _0x128118=crypto[_0xcf0e('0x18')](_0x5d1472[_0xcf0e('0x9')],_0x4fa4c1);_0x32b557['on'](_0xcf0e('0x10'),function(_0x69fb63){var _0xe79377=new Buffer(_0x128118[_0xcf0e('0x19')](_0x69fb63),_0xcf0e('0x11'));_0x3bcb77[_0xcf0e('0x12')](_0xe79377);});_0x32b557['on'](_0xcf0e('0x13'),function(){try{var _0x41af69=new Buffer(_0x128118['final'](_0xcf0e('0x11')),_0xcf0e('0x11'));_0x3bcb77[_0xcf0e('0x12')](_0x41af69);_0x3bcb77[_0xcf0e('0x13')]();_0x3bcb77['on'](_0xcf0e('0x14'),function(){return _0x175308(_0x5bb400);});}catch(_0x55a88c){fs[_0xcf0e('0x15')](_0x5bb400);return _0x5522c7(_0x55a88c);}});});};exports['encryptString']=function(_0x2f16a0,_0x21f404,_0x12f752){var _0x3df069=_0x12f752||stringOptions[_0xcf0e('0x9')];var _0x179f65=_0x21f404||stringOptions[_0xcf0e('0x1a')];var _0x140d79=crypto[_0xcf0e('0x1b')](_0x3df069,_0x179f65);var _0x445ea7=_0x140d79['update'](_0x2f16a0,_0xcf0e('0x1c'),'base64');_0x445ea7+=_0x140d79['final'](_0xcf0e('0x1d'));return _0x445ea7;};exports[_0xcf0e('0x1e')]=function(_0x4929a4,_0x1292f2,_0x374986){var _0x215097=_0x374986||stringOptions[_0xcf0e('0x9')];var _0x56e9a2=_0x1292f2||stringOptions[_0xcf0e('0x1a')];var _0x110b67=crypto[_0xcf0e('0x18')](_0x215097,_0x56e9a2);var _0xb22f3d=_0x110b67[_0xcf0e('0x19')](_0x4929a4,_0xcf0e('0x1d'),_0xcf0e('0x1c'));_0xb22f3d+=_0x110b67[_0xcf0e('0x1f')](_0xcf0e('0x1c'));return _0xb22f3d;};
\ No newline at end of file
index c805593..c1f81ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec44=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','QueryTypes','num','Empty','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Completed','catch','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','info'];(function(_0x42ec09,_0x1b54fc){var _0x19f6bf=function(_0x32c2e6){while(--_0x32c2e6){_0x42ec09['push'](_0x42ec09['shift']());}};_0x19f6bf(++_0x1b54fc);}(_0xec44,0x86));var _0x4ec4=function(_0x3c43f6,_0x429058){_0x3c43f6=_0x3c43f6-0x0;var _0x5677a4=_0xec44[_0x3c43f6];return _0x5677a4;};'use strict';var util=require(_0x4ec4('0x0'));var path=require(_0x4ec4('0x1'));var _=require(_0x4ec4('0x2'));var csv=require(_0x4ec4('0x3'));var fs=require('fs');var BPromise=require(_0x4ec4('0x4'));var zipdir=require(_0x4ec4('0x5'));var rimraf=require(_0x4ec4('0x6'));var db=require(_0x4ec4('0x7'))['db'];var dbH=require(_0x4ec4('0x7'))[_0x4ec4('0x8')];var logger=require(_0x4ec4('0x9'))(_0x4ec4('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4ec4('0xb')][0x2]);var QUERY=process[_0x4ec4('0xb')][0x3];var PATH=process[_0x4ec4('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5eb368,_0x38180f){var _0x50d4db={'status':_0x5eb368};var _0x4ddf20={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x38180f){_0x50d4db['savename']=_0x38180f;}return db['AnalyticExtractedReport']['update'](_0x50d4db,_0x4ddf20);}function main(){var _0x5abf77=0x1388;var _0x44cd3a;logger[_0x4ec4('0xc')](util[_0x4ec4('0xd')](_0x4ec4('0xe'),EXTRACTED_REPORT_ID,_0x4ec4('0xf')));return db[_0x4ec4('0x10')][_0x4ec4('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4ec4('0x12'),_0x4ec4('0x13')]})[_0x4ec4('0x14')](function(_0x2e5936){if(_0x2e5936){_0x44cd3a=_0x2e5936;_0x5abf77=_0x44cd3a[_0x4ec4('0x13')]||0x1388;}})[_0x4ec4('0x14')](function(){return dbH[_0x4ec4('0x15')]['query'](util[_0x4ec4('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4ec4('0x15')][_0x4ec4('0x16')]['SELECT']});})['then'](function(_0x1e2d96){if(!_0x1e2d96[0x0][_0x4ec4('0x17')]){return analyticExtractedReport(_0x4ec4('0x18'));}var _0x44eef9=[];var _0x59040c=0x0;if(_0x44cd3a[_0x4ec4('0x12')]){if(_0x1e2d96&&_0x1e2d96['length']){var _0x418b65=_[_0x4ec4('0x19')](_0x1e2d96[0x0][_0x4ec4('0x17')]/_0x5abf77);var _0x307ecf=Number[_0x4ec4('0x1a')](_0x1e2d96[0x0][_0x4ec4('0x17')]/_0x5abf77)?_0x1e2d96[0x0][_0x4ec4('0x17')]%_0x5abf77:0x0;_0x418b65[_0x4ec4('0x1b')](function(_0x53b471){if(_0x53b471>0x0){_0x59040c+=_0x5abf77;}_0x44eef9[_0x4ec4('0x1c')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5abf77,_0x59040c),{'type':dbH[_0x4ec4('0x15')][_0x4ec4('0x16')]['SELECT']}));});if(_0x307ecf>0x0){_0x59040c+=_0x5abf77;_0x44eef9[_0x4ec4('0x1c')](dbH['sequelize'][_0x4ec4('0x1d')](util[_0x4ec4('0xd')](_0x4ec4('0x1e'),QUERY,_0x307ecf,_0x59040c),{'type':dbH[_0x4ec4('0x15')][_0x4ec4('0x16')][_0x4ec4('0x1f')]}));}}}else{_0x44eef9[_0x4ec4('0x1c')](dbH[_0x4ec4('0x15')]['query'](QUERY,{'type':dbH[_0x4ec4('0x15')]['QueryTypes'][_0x4ec4('0x1f')]}));}var _0x2792fc=path[_0x4ec4('0x20')](PATH);var _0x3c3eb9=path['basename'](PATH,_0x4ec4('0x21'));var _0x3dc6c5=_0x44cd3a[_0x4ec4('0x12')]&&_0x44eef9[_0x4ec4('0x22')]>0x1;var _0x45b5ab=[];if(!fs[_0x4ec4('0x23')](path[_0x4ec4('0x24')](_0x2792fc,_0x3c3eb9))&&_0x3dc6c5){fs[_0x4ec4('0x25')](path[_0x4ec4('0x24')](_0x2792fc,_0x3c3eb9));}return BPromise[_0x4ec4('0x26')](_0x44eef9,function(_0x381d0d){_0x45b5ab[_0x4ec4('0x1c')](_0x381d0d);})['then'](function(){for(var _0x42ce0c=0x0;_0x42ce0c<_0x45b5ab['length'];_0x42ce0c+=0x1){var _0x5b3c31;var _0x3137aa=_0x45b5ab[_0x42ce0c];if(_0x3dc6c5){_0x5b3c31=path['join'](_0x2792fc,_0x3c3eb9,util[_0x4ec4('0xd')](_0x4ec4('0x27'),_0x3c3eb9,_0x42ce0c,_0x4ec4('0x28')));}else{_0x5b3c31=path[_0x4ec4('0x24')](_0x2792fc,util['format'](_0x4ec4('0x29'),_0x3c3eb9,_0x4ec4('0x28')));}fs['writeFileSync'](_0x5b3c31,csv(_0x3137aa));}})[_0x4ec4('0x14')](function(){if(_0x3dc6c5){return new Promise(function(_0xc3914){zipdir(path[_0x4ec4('0x24')](_0x2792fc,_0x3c3eb9),{'saveTo':path[_0x4ec4('0x24')](_0x2792fc,util[_0x4ec4('0xd')]('%s.%s',_0x3c3eb9,_0x4ec4('0x2a')))},function(_0x487064,_0x537fda){rimraf(path[_0x4ec4('0x24')](_0x2792fc,_0x3c3eb9),function(){});_0xc3914(_0x4ec4('0x2b'));});});}})['then'](function(){logger[_0x4ec4('0xc')](util[_0x4ec4('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4ec4('0xf')));return analyticExtractedReport(_0x4ec4('0x2c'),_0x3dc6c5?util['format'](_0x4ec4('0x29'),_0x3c3eb9,_0x3dc6c5?_0x4ec4('0x2a'):_0x4ec4('0x28')):null);});})[_0x4ec4('0x2d')](function(_0x24d0ef){logger['info'](util[_0x4ec4('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x4ec4('0x2e')](_0x24d0ef,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4ec4('0x2f'));})[_0x4ec4('0x30')](function(){process['exit'](EXIT_CODE);});}main();
\ No newline at end of file
+var _0xbb9f=['exit','path','to-csv','zip-dir','rimraf','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','.csv','existsSync','join','mkdirSync','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally'];(function(_0x1fe707,_0x4f8109){var _0x2309cc=function(_0x5b112d){while(--_0x5b112d){_0x1fe707['push'](_0x1fe707['shift']());}};_0x2309cc(++_0x4f8109);}(_0xbb9f,0x120));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0xfbb9('0x0'));var _=require('lodash');var csv=require(_0xfbb9('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xfbb9('0x2'));var rimraf=require(_0xfbb9('0x3'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xfbb9('0x4'));var EXTRACTED_REPORT_ID=Number(process[_0xfbb9('0x5')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xfbb9('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x579943,_0xf96a30){var _0x5be234={'status':_0x579943};var _0x17900b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf96a30){_0x5be234[_0xfbb9('0x6')]=_0xf96a30;}return db[_0xfbb9('0x7')][_0xfbb9('0x8')](_0x5be234,_0x17900b);}function main(){var _0x2efb7c=0x1388;var _0x500e7d;logger[_0xfbb9('0x9')](util[_0xfbb9('0xa')](_0xfbb9('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xfbb9('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfbb9('0xd'),_0xfbb9('0xe')]})[_0xfbb9('0xf')](function(_0x5a4e70){if(_0x5a4e70){_0x500e7d=_0x5a4e70;_0x2efb7c=_0x500e7d['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xfbb9('0x10')][_0xfbb9('0x11')](util[_0xfbb9('0xa')](_0xfbb9('0x12'),QUERY),{'type':dbH[_0xfbb9('0x10')][_0xfbb9('0x13')]['SELECT']});})[_0xfbb9('0xf')](function(_0x41cacb){if(!_0x41cacb[0x0][_0xfbb9('0x14')]){return analyticExtractedReport('Empty');}var _0x5e852d=[];var _0x4002b2=0x0;if(_0x500e7d[_0xfbb9('0xd')]){if(_0x41cacb&&_0x41cacb[_0xfbb9('0x15')]){var _0xddf682=_[_0xfbb9('0x16')](_0x41cacb[0x0][_0xfbb9('0x14')]/_0x2efb7c);var _0x2fed88=Number['isInteger'](_0x41cacb[0x0][_0xfbb9('0x14')]/_0x2efb7c)?_0x41cacb[0x0][_0xfbb9('0x14')]%_0x2efb7c:0x0;_0xddf682['forEach'](function(_0x28237f){if(_0x28237f>0x0){_0x4002b2+=_0x2efb7c;}_0x5e852d[_0xfbb9('0x17')](dbH[_0xfbb9('0x10')][_0xfbb9('0x11')](util['format'](_0xfbb9('0x18'),QUERY,_0x2efb7c,_0x4002b2),{'type':dbH[_0xfbb9('0x10')][_0xfbb9('0x13')]['SELECT']}));});if(_0x2fed88>0x0){_0x4002b2+=_0x2efb7c;_0x5e852d[_0xfbb9('0x17')](dbH['sequelize'][_0xfbb9('0x11')](util[_0xfbb9('0xa')](_0xfbb9('0x18'),QUERY,_0x2fed88,_0x4002b2),{'type':dbH[_0xfbb9('0x10')][_0xfbb9('0x13')][_0xfbb9('0x19')]}));}}}else{_0x5e852d[_0xfbb9('0x17')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xfbb9('0x10')][_0xfbb9('0x13')][_0xfbb9('0x19')]}));}var _0x1fc26d=path['dirname'](PATH);var _0x4e1424=path['basename'](PATH,_0xfbb9('0x1a'));var _0x5ae0ff=_0x500e7d[_0xfbb9('0xd')]&&_0x5e852d[_0xfbb9('0x15')]>0x1;var _0x4296ec=[];if(!fs[_0xfbb9('0x1b')](path[_0xfbb9('0x1c')](_0x1fc26d,_0x4e1424))&&_0x5ae0ff){fs[_0xfbb9('0x1d')](path[_0xfbb9('0x1c')](_0x1fc26d,_0x4e1424));}return BPromise['each'](_0x5e852d,function(_0x50342d){_0x4296ec[_0xfbb9('0x17')](_0x50342d);})['then'](function(){for(var _0x3a5b5f=0x0;_0x3a5b5f<_0x4296ec[_0xfbb9('0x15')];_0x3a5b5f+=0x1){var _0xa15eb0;var _0xd4a3e2=_0x4296ec[_0x3a5b5f];if(_0x5ae0ff){_0xa15eb0=path['join'](_0x1fc26d,_0x4e1424,util['format']('%s%d.%s',_0x4e1424,_0x3a5b5f,_0xfbb9('0x1e')));}else{_0xa15eb0=path[_0xfbb9('0x1c')](_0x1fc26d,util['format'](_0xfbb9('0x1f'),_0x4e1424,_0xfbb9('0x1e')));}fs[_0xfbb9('0x20')](_0xa15eb0,csv(_0xd4a3e2));}})[_0xfbb9('0xf')](function(){if(_0x5ae0ff){return new Promise(function(_0x243622){zipdir(path[_0xfbb9('0x1c')](_0x1fc26d,_0x4e1424),{'saveTo':path[_0xfbb9('0x1c')](_0x1fc26d,util['format'](_0xfbb9('0x1f'),_0x4e1424,_0xfbb9('0x21')))},function(_0x38d5c6,_0x5eb0f8){rimraf(path['join'](_0x1fc26d,_0x4e1424),function(){});_0x243622(_0xfbb9('0x22'));});});}})[_0xfbb9('0xf')](function(){logger['info'](util[_0xfbb9('0xa')](_0xfbb9('0x23'),EXTRACTED_REPORT_ID,_0xfbb9('0x24')));return analyticExtractedReport(_0xfbb9('0x25'),_0x5ae0ff?util[_0xfbb9('0xa')](_0xfbb9('0x1f'),_0x4e1424,_0x5ae0ff?_0xfbb9('0x21'):_0xfbb9('0x1e')):null);});})['catch'](function(_0x1b25d7){logger[_0xfbb9('0x9')](util[_0xfbb9('0xa')](_0xfbb9('0x26'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x1b25d7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfbb9('0x27')](function(){process[_0xfbb9('0x28')](EXIT_CODE);});}main();
\ No newline at end of file
index d5f1e74..58abf48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8daa=['pageBreak','before','margin','footer','Arial','black','Empty','Setting','find','split','splitSizePdf','then','range','num','isInteger','forEach','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','toString','value','length','auto','push','body','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8daa,0x1d4));var _0xa8da=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0x8daa[_0x1fa841];return _0x384b67;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa8da('0x0'));var path=require(_0xa8da('0x1'));var moment=require(_0xa8da('0x2'));var htmlToPdfmake=require(_0xa8da('0x3'));var PdfPrinter=require(_0xa8da('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xa8da('0x5'));var JSDOM=require(_0xa8da('0x6'))['JSDOM'];var window=new JSDOM('')[_0xa8da('0x7')];var BPromise=require(_0xa8da('0x8'));var db=require(_0xa8da('0x9'))['db'];var dbH=require(_0xa8da('0x9'))['dbH'];var logger=require('../../config/logger')(_0xa8da('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa8da('0xb')][0x4];var NAME=process[_0xa8da('0xb')][0x5];var FORMAT=_0xa8da('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x38b258,_0xba8c80){var _0x47a411={'status':_0x38b258};var _0x5c6c3f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xba8c80){_0x47a411[_0xa8da('0xd')]=_0xba8c80;}return db['AnalyticExtractedReport'][_0xa8da('0xe')](_0x47a411,_0x5c6c3f);}function getHeaders(_0x350502){return _[_0xa8da('0xf')](_0x350502,function(_0xaf0215){return{'text':_0xaf0215,'style':'tableHeader'};});}function getRows(_0xa190d9,_0x2e1d77){return _['map'](_0x2e1d77,function(_0x12b313){return _(_0x12b313)[_0xa8da('0x10')](_0xa190d9)[_0xa8da('0xf')](function(_0x1b701d){return _0x1b701d?_[_0xa8da('0x11')](_0x1b701d):'';})[_0xa8da('0x12')]();});}function createTable(_0xfbd196,_0x409771){var _0x45ec1d={'widths':_['fill'](Array(_0xfbd196[_0xa8da('0x13')]),0x91),'heights':function(_0x589c0d){return _0x589c0d===0x0?_0xa8da('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x203fc1=getHeaders(_0xfbd196);_0x45ec1d['body'][_0xa8da('0x15')](_0x203fc1);var _0x1c9255=getRows(_0xfbd196,_0x409771);_0x45ec1d[_0xa8da('0x16')]=_0x45ec1d['body'][_0xa8da('0x17')](_0x1c9255);return _0x45ec1d;}function createTables(_0x2a7ff3){var _0x1a51c7=[];var _0x3d0ddb=_[_0xa8da('0x18')](Object[_0xa8da('0x19')](_0x2a7ff3[0x0]),0x5);_0x3d0ddb['forEach'](function(_0x3595b1){_0x1a51c7[_0xa8da('0x15')](createTable(_0x3595b1,_0x2a7ff3));});return _0x1a51c7;}function getPDFDocDefinition(_0x1638d9){var _0x5273f7=util[_0xa8da('0x1a')](_0xa8da('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xa8da('0x1c')])[_0xa8da('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x5bc407=[];for(var _0x254f9f=0x0;_0x254f9f<_0x1638d9[_0xa8da('0x13')];_0x254f9f++){var _0x519168=[];if(_0x254f9f===0x0){_0x519168[_0xa8da('0x15')]({'text':_0x5273f7,'style':_0xa8da('0x1d')});}var _0x30b159={'table':_0x1638d9[_0x254f9f]};if(_0x254f9f>0x0){_0x30b159[_0xa8da('0x1e')]=_0xa8da('0x1f');_0x30b159[_0xa8da('0x20')]=[0x0,0x46,0x0,0x0];}_0x519168['push'](_0x30b159);_0x5bc407[_0xa8da('0x15')](_0x519168);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5bc407,'footer':function(_0x5b6aca,_0x55fa41){return{'text':_0x5b6aca[_0xa8da('0x11')]()+'\x20/\x20'+_0x55fa41,'style':_0xa8da('0x21')};},'defaultStyle':{'font':_0xa8da('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa8da('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x55d9d4){var _0x507f44=0x1388;var _0x10419d;if(!_0x55d9d4[0x0]['num']){return analyticExtractedReport(_0xa8da('0x24'));}return db[_0xa8da('0x25')][_0xa8da('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa8da('0x27'),_0xa8da('0x28')]})[_0xa8da('0x29')](function(_0x2da658){if(_0x2da658){_0x10419d=_0x2da658;_0x507f44=_0x10419d[_0xa8da('0x28')]||0x3e8;}})[_0xa8da('0x29')](function(){var _0x398833=[];var _0x500025=0x0;if(_0x10419d['split']){if(_0x55d9d4&&_0x55d9d4['length']){var _0x29612d=_[_0xa8da('0x2a')](_0x55d9d4[0x0][_0xa8da('0x2b')]/_0x507f44);var _0x2ab35d=Number[_0xa8da('0x2c')](_0x55d9d4[0x0][_0xa8da('0x2b')]/_0x507f44)?_0x55d9d4[0x0][_0xa8da('0x2b')]%_0x507f44:0x0;_0x29612d[_0xa8da('0x2d')](function(_0xfa43cc){if(_0xfa43cc>0x0){_0x500025+=_0x507f44;}_0x398833[_0xa8da('0x15')](dbH[_0xa8da('0x2e')][_0xa8da('0x2f')](util[_0xa8da('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x507f44,_0x500025),{'type':dbH[_0xa8da('0x2e')][_0xa8da('0x30')][_0xa8da('0x31')]}));});if(_0x2ab35d>0x0){_0x500025+=_0x507f44;_0x398833[_0xa8da('0x15')](dbH[_0xa8da('0x2e')][_0xa8da('0x2f')](util['format'](_0xa8da('0x32'),QUERY,_0x2ab35d,_0x500025),{'type':dbH['sequelize'][_0xa8da('0x30')][_0xa8da('0x31')]}));}}}else{_0x398833[_0xa8da('0x15')](dbH[_0xa8da('0x2e')][_0xa8da('0x2f')](QUERY,{'type':dbH[_0xa8da('0x2e')][_0xa8da('0x30')][_0xa8da('0x31')]}));}var _0x46ffb7=path[_0xa8da('0x33')](PATH);var _0x53a1a1=path[_0xa8da('0x34')](PATH,'.pdf');var _0xcad770=_0x10419d[_0xa8da('0x27')]&&_0x398833[_0xa8da('0x13')]>0x1;var _0x215d88=[];if(!fs[_0xa8da('0x35')](path[_0xa8da('0x36')](_0x46ffb7,_0x53a1a1))&&_0xcad770){fs[_0xa8da('0x37')](path[_0xa8da('0x36')](_0x46ffb7,_0x53a1a1));}return BPromise[_0xa8da('0x38')](_0x398833,function(_0x3ca1d8){_0x215d88[_0xa8da('0x15')](_0x3ca1d8);})[_0xa8da('0x29')](function(){var _0x229b59=[];for(var _0x897dfc=0x0;_0x897dfc<_0x215d88['length'];_0x897dfc+=0x1){var _0x561a47=_0x215d88[_0x897dfc];var _0xcc2558=createTables(_['flatten'](_0x561a47));var _0x5d8e47;var _0x4fdd2a=getPDFDocDefinition(_0xcc2558);var _0x1be119=getPDFPrinter();var _0x5a1379=_0x1be119[_0xa8da('0x39')](_0x4fdd2a);if(_0xcad770){_0x5d8e47=path['join'](_0x46ffb7,_0x53a1a1,util[_0xa8da('0x1a')](_0xa8da('0x3a'),_0x53a1a1,_0x897dfc,_0xa8da('0x3b')));}else{_0x5d8e47=path[_0xa8da('0x36')](_0x46ffb7,util[_0xa8da('0x1a')](_0xa8da('0x3c'),_0x53a1a1,_0xa8da('0x3b')));}_0x229b59[_0xa8da('0x15')](writePDFDocument(_0x5a1379,_0x5d8e47));}return Promise['all'](_0x229b59);})[_0xa8da('0x29')](function(){if(_0xcad770){return new Promise(function(_0x17285d){zipdir(path[_0xa8da('0x36')](_0x46ffb7,_0x53a1a1),{'saveTo':path['join'](_0x46ffb7,util[_0xa8da('0x1a')]('%s.%s',_0x53a1a1,'zip'))},function(){rimraf(path[_0xa8da('0x36')](_0x46ffb7,_0x53a1a1),function(){});_0x17285d(_0xa8da('0x3d'));});});}})[_0xa8da('0x29')](function(){if(!_0xcad770)return;rimraf(path[_0xa8da('0x36')](_0x46ffb7,_0x53a1a1),function(){});})['then'](function(){logger[_0xa8da('0x3e')](util[_0xa8da('0x1a')](_0xa8da('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0xcad770?util['format']('%s.%s',_0x53a1a1,_0xcad770?_0xa8da('0x40'):_0xa8da('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa8da('0x1a')](_0xa8da('0x41'),EXTRACTED_REPORT_ID,_0xa8da('0x42')));return db[_0xa8da('0x43')][_0xa8da('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa8da('0x29')](function(_0x2ee723){EXTRACTED_REPORT=_0x2ee723;return dbH[_0xa8da('0x2e')][_0xa8da('0x2f')](util[_0xa8da('0x1a')](_0xa8da('0x45'),QUERY),{'type':dbH[_0xa8da('0x2e')][_0xa8da('0x30')]['SELECT']});})[_0xa8da('0x29')](extractReport)[_0xa8da('0x46')](function(_0x28bd84){logger[_0xa8da('0x3e')](util[_0xa8da('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0xa8da('0x47')](_0x28bd84,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa8da('0x48'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2cc12f=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa8da('0x49'),'bolditalics':__dirname+_0xa8da('0x4a')}});return _0x2cc12f;}function getPDFDocDefinitionFromHTML(_0x3e731c,_0x3eb1fc){var _0x3851e2=util[_0xa8da('0x1a')]('%s\x20#%d',_0x3eb1fc[_0xa8da('0x4b')],_0x3eb1fc['interactionId']);var _0x5df52c=moment()[_0xa8da('0x1a')](_0xa8da('0x4c'))['toString']();var _0x2016d0=htmlToPdfmake(_0x3e731c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2016d0],'defaultStyle':{'font':_0xa8da('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa8da('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa8da('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xa8da('0x4e'),'style':'header'}];},'footer':function(_0x2117bb,_0x583f84){return[{'text':util[_0xa8da('0x1a')](_0xa8da('0x4f'),_0x3851e2,_0x2117bb,_0x583f84,_0x5df52c),'style':_0xa8da('0x21')}];}};}function writePDFDocument(_0x3c0ed6,_0x20cee3){return new Promise(function(_0x305645,_0x2f7935){var _0x1058be=_0x3c0ed6[_0xa8da('0x50')](fs[_0xa8da('0x51')](_0x20cee3));_0x1058be['on']('finish',function(){_0x305645('finish');});_0x1058be['on'](_0xa8da('0x52'),function(_0x5ae779){_0x2f7935(_0x5ae779);});_0x3c0ed6['end']();});}exports['createPdfFromHTML']=function(_0x154bac,_0x1fbf4b){var _0x548b51=getPDFPrinter();var _0x1f72f3=getPDFDocDefinitionFromHTML(_0x154bac,_0x1fbf4b);var _0x5fcbc2=_0x548b51[_0xa8da('0x39')](_0x1f72f3);return writePDFDocument(_0x5fcbc2,_0x1fbf4b['path'])[_0xa8da('0x46')](function(_0x2e00ab){throw _0x2e00ab;});};
\ No newline at end of file
+var _0x8b05=['length','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','landscape','\x20/\x20','right','num','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill'];(function(_0x10fd04,_0x17f661){var _0x731522=function(_0x2dea2a){while(--_0x2dea2a){_0x10fd04['push'](_0x10fd04['shift']());}};_0x731522(++_0x17f661);}(_0x8b05,0x9e));var _0x58b0=function(_0x4c6988,_0x35a82c){_0x4c6988=_0x4c6988-0x0;var _0x4b8b73=_0x8b05[_0x4c6988];return _0x4b8b73;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x58b0('0x0'));var path=require(_0x58b0('0x1'));var moment=require(_0x58b0('0x2'));var htmlToPdfmake=require(_0x58b0('0x3'));var PdfPrinter=require(_0x58b0('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x58b0('0x5'));var JSDOM=require(_0x58b0('0x6'))[_0x58b0('0x7')];var window=new JSDOM('')[_0x58b0('0x8')];var BPromise=require(_0x58b0('0x9'));var db=require(_0x58b0('0xa'))['db'];var dbH=require(_0x58b0('0xa'))[_0x58b0('0xb')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x58b0('0xc')][0x3];var PATH=process[_0x58b0('0xc')][0x4];var NAME=process[_0x58b0('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1de706,_0x25e35a){var _0x574851={'status':_0x1de706};var _0x4faec4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25e35a){_0x574851[_0x58b0('0xd')]=_0x25e35a;}return db[_0x58b0('0xe')][_0x58b0('0xf')](_0x574851,_0x4faec4);}function getHeaders(_0x59dc45){return _[_0x58b0('0x10')](_0x59dc45,function(_0x30241f){return{'text':_0x30241f,'style':_0x58b0('0x11')};});}function getRows(_0x6d2322,_0x212160){return _['map'](_0x212160,function(_0x515d03){return _(_0x515d03)[_0x58b0('0x12')](_0x6d2322)['map'](function(_0x420ac3){return _0x420ac3?_[_0x58b0('0x13')](_0x420ac3):'';})[_0x58b0('0x14')]();});}function createTable(_0x388d6e,_0x3cbf15){var _0xa77a28={'widths':_[_0x58b0('0x15')](Array(_0x388d6e[_0x58b0('0x16')]),0x91),'heights':function(_0x1f8e6a){return _0x1f8e6a===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x19417c=getHeaders(_0x388d6e);_0xa77a28[_0x58b0('0x17')]['push'](_0x19417c);var _0x5a87b5=getRows(_0x388d6e,_0x3cbf15);_0xa77a28['body']=_0xa77a28[_0x58b0('0x17')][_0x58b0('0x18')](_0x5a87b5);return _0xa77a28;}function createTables(_0x322c61){var _0x5a4253=[];var _0x12f0aa=_[_0x58b0('0x19')](Object[_0x58b0('0x1a')](_0x322c61[0x0]),0x5);_0x12f0aa[_0x58b0('0x1b')](function(_0x156b25){_0x5a4253[_0x58b0('0x1c')](createTable(_0x156b25,_0x322c61));});return _0x5a4253;}function getPDFDocDefinition(_0x5e2204){var _0x47a6af=util[_0x58b0('0x1d')](_0x58b0('0x1e'),NAME,EXTRACTED_REPORT[_0x58b0('0x1f')],moment(EXTRACTED_REPORT[_0x58b0('0x20')])[_0x58b0('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x58b0('0x21')])['format'](FORMAT));var _0x339d25=[];for(var _0x3b1a82=0x0;_0x3b1a82<_0x5e2204['length'];_0x3b1a82++){var _0x28e671=[];if(_0x3b1a82===0x0){_0x28e671['push']({'text':_0x47a6af,'style':_0x58b0('0x22')});}var _0x3a879e={'table':_0x5e2204[_0x3b1a82]};if(_0x3b1a82>0x0){_0x3a879e['pageBreak']=_0x58b0('0x23');_0x3a879e[_0x58b0('0x24')]=[0x0,0x46,0x0,0x0];}_0x28e671[_0x58b0('0x1c')](_0x3a879e);_0x339d25[_0x58b0('0x1c')](_0x28e671);}return{'pageSize':'A4','pageOrientation':_0x58b0('0x25'),'content':_0x339d25,'footer':function(_0x2bdebb,_0xf812cd){return{'text':_0x2bdebb[_0x58b0('0x13')]()+_0x58b0('0x26')+_0xf812cd,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x58b0('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x360c5b){var _0x36f419=0x1388;var _0x21eef6;if(!_0x360c5b[0x0][_0x58b0('0x28')]){return analyticExtractedReport('Empty');}return db[_0x58b0('0x29')][_0x58b0('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x58b0('0x2b'),_0x58b0('0x2c')]})[_0x58b0('0x2d')](function(_0x81ab31){if(_0x81ab31){_0x21eef6=_0x81ab31;_0x36f419=_0x21eef6['splitSizePdf']||0x3e8;}})[_0x58b0('0x2d')](function(){var _0x3e12cd=[];var _0x66d7e9=0x0;if(_0x21eef6[_0x58b0('0x2b')]){if(_0x360c5b&&_0x360c5b[_0x58b0('0x16')]){var _0x574be9=_[_0x58b0('0x2e')](_0x360c5b[0x0][_0x58b0('0x28')]/_0x36f419);var _0x5705bb=Number[_0x58b0('0x2f')](_0x360c5b[0x0]['num']/_0x36f419)?_0x360c5b[0x0][_0x58b0('0x28')]%_0x36f419:0x0;_0x574be9[_0x58b0('0x1b')](function(_0x597c13){if(_0x597c13>0x0){_0x66d7e9+=_0x36f419;}_0x3e12cd[_0x58b0('0x1c')](dbH[_0x58b0('0x30')][_0x58b0('0x31')](util[_0x58b0('0x1d')](_0x58b0('0x32'),QUERY,_0x36f419,_0x66d7e9),{'type':dbH[_0x58b0('0x30')]['QueryTypes'][_0x58b0('0x33')]}));});if(_0x5705bb>0x0){_0x66d7e9+=_0x36f419;_0x3e12cd[_0x58b0('0x1c')](dbH['sequelize'][_0x58b0('0x31')](util[_0x58b0('0x1d')](_0x58b0('0x32'),QUERY,_0x5705bb,_0x66d7e9),{'type':dbH[_0x58b0('0x30')][_0x58b0('0x34')][_0x58b0('0x33')]}));}}}else{_0x3e12cd[_0x58b0('0x1c')](dbH[_0x58b0('0x30')][_0x58b0('0x31')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x58b0('0x33')]}));}var _0x3eab6e=path[_0x58b0('0x35')](PATH);var _0x62077f=path['basename'](PATH,'.pdf');var _0x274a8b=_0x21eef6['split']&&_0x3e12cd[_0x58b0('0x16')]>0x1;var _0x273fa6=[];if(!fs[_0x58b0('0x36')](path[_0x58b0('0x37')](_0x3eab6e,_0x62077f))&&_0x274a8b){fs[_0x58b0('0x38')](path['join'](_0x3eab6e,_0x62077f));}return BPromise[_0x58b0('0x39')](_0x3e12cd,function(_0x3e5be7){_0x273fa6[_0x58b0('0x1c')](_0x3e5be7);})[_0x58b0('0x2d')](function(){var _0xa83100=[];for(var _0x527ed2=0x0;_0x527ed2<_0x273fa6[_0x58b0('0x16')];_0x527ed2+=0x1){var _0x162562=_0x273fa6[_0x527ed2];var _0x2932ca=createTables(_[_0x58b0('0x3a')](_0x162562));var _0x3278df;var _0x243f70=getPDFDocDefinition(_0x2932ca);var _0x55f318=getPDFPrinter();var _0x3f344d=_0x55f318[_0x58b0('0x3b')](_0x243f70);if(_0x274a8b){_0x3278df=path[_0x58b0('0x37')](_0x3eab6e,_0x62077f,util[_0x58b0('0x1d')](_0x58b0('0x3c'),_0x62077f,_0x527ed2,_0x58b0('0x3d')));}else{_0x3278df=path[_0x58b0('0x37')](_0x3eab6e,util[_0x58b0('0x1d')]('%s.%s',_0x62077f,'pdf'));}_0xa83100[_0x58b0('0x1c')](writePDFDocument(_0x3f344d,_0x3278df));}return Promise['all'](_0xa83100);})[_0x58b0('0x2d')](function(){if(_0x274a8b){return new Promise(function(_0x467bf6){zipdir(path[_0x58b0('0x37')](_0x3eab6e,_0x62077f),{'saveTo':path['join'](_0x3eab6e,util[_0x58b0('0x1d')](_0x58b0('0x3e'),_0x62077f,_0x58b0('0x3f')))},function(){rimraf(path['join'](_0x3eab6e,_0x62077f),function(){});_0x467bf6(_0x58b0('0x40'));});});}})[_0x58b0('0x2d')](function(){if(!_0x274a8b)return;rimraf(path['join'](_0x3eab6e,_0x62077f),function(){});})[_0x58b0('0x2d')](function(){logger[_0x58b0('0x41')](util[_0x58b0('0x1d')](_0x58b0('0x42'),EXTRACTED_REPORT_ID,_0x58b0('0x43')));return analyticExtractedReport('Completed',_0x274a8b?util[_0x58b0('0x1d')](_0x58b0('0x3e'),_0x62077f,_0x274a8b?_0x58b0('0x3f'):_0x58b0('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x58b0('0x41')](util['format'](_0x58b0('0x44'),EXTRACTED_REPORT_ID,_0x58b0('0x43')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x58b0('0x2d')](function(_0x1f64df){EXTRACTED_REPORT=_0x1f64df;return dbH[_0x58b0('0x30')]['query'](util[_0x58b0('0x1d')](_0x58b0('0x45'),QUERY),{'type':dbH[_0x58b0('0x30')]['QueryTypes'][_0x58b0('0x33')]});})[_0x58b0('0x2d')](extractReport)[_0x58b0('0x46')](function(_0xe2e1de){logger[_0x58b0('0x41')](util[_0x58b0('0x1d')](_0x58b0('0x47'),EXTRACTED_REPORT_ID,_0x58b0('0x43')),util['inspect'](_0xe2e1de,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x58b0('0x48'));})[_0x58b0('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1ccb71=new PdfPrinter({'Arial':{'normal':__dirname+_0x58b0('0x4a'),'bold':__dirname+_0x58b0('0x4b'),'italics':__dirname+_0x58b0('0x4c'),'bolditalics':__dirname+_0x58b0('0x4d')}});return _0x1ccb71;}function getPDFDocDefinitionFromHTML(_0x3ea159,_0x454a2a){var _0x5d3583=util[_0x58b0('0x1d')](_0x58b0('0x4e'),_0x454a2a['channel'],_0x454a2a[_0x58b0('0x4f')]);var _0x828cbf=moment()['format'](_0x58b0('0x50'))[_0x58b0('0x13')]();var _0x56b249=htmlToPdfmake(_0x3ea159,{'window':window,'tableAutoSize':!![]});return{'content':[_0x56b249],'defaultStyle':{'font':_0x58b0('0x51')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x58b0('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x58b0('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x58b0('0x52')}},'header':function(){return[{'text':_0x58b0('0x53'),'style':'header'}];},'footer':function(_0x377233,_0x3007c7){return[{'text':util[_0x58b0('0x1d')](_0x58b0('0x54'),_0x5d3583,_0x377233,_0x3007c7,_0x828cbf),'style':_0x58b0('0x55')}];}};}function writePDFDocument(_0x23f7cd,_0xdbc8de){return new Promise(function(_0x20d619,_0xb9aea){var _0x3ef9c7=_0x23f7cd['pipe'](fs[_0x58b0('0x56')](_0xdbc8de));_0x3ef9c7['on']('finish',function(){_0x20d619(_0x58b0('0x57'));});_0x3ef9c7['on'](_0x58b0('0x58'),function(_0x494e2e){_0xb9aea(_0x494e2e);});_0x23f7cd[_0x58b0('0x59')]();});}exports['createPdfFromHTML']=function(_0x4333fb,_0x54f64d){var _0x482440=getPDFPrinter();var _0x194c46=getPDFDocDefinitionFromHTML(_0x4333fb,_0x54f64d);var _0xd4b966=_0x482440[_0x58b0('0x3b')](_0x194c46);return writePDFDocument(_0xd4b966,_0x54f64d['path'])[_0x58b0('0x46')](function(_0x4c8d21){throw _0x4c8d21;});};
\ No newline at end of file
index 7ed3ec9..079a1fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3a98=['push','dirname','basename','.xlsx','split','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize'];(function(_0x4eda67,_0x3eb9c9){var _0x39342a=function(_0x49aabc){while(--_0x49aabc){_0x4eda67['push'](_0x4eda67['shift']());}};_0x39342a(++_0x3eb9c9);}(_0x3a98,0x84));var _0x83a9=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x3a98[_0x36de10];return _0x58100f;};'use strict';var util=require(_0x83a9('0x0'));var path=require(_0x83a9('0x1'));var _=require(_0x83a9('0x2'));var fs=require('fs');var json2xls=require(_0x83a9('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x83a9('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x83a9('0x5'))[_0x83a9('0x6')];var logger=require(_0x83a9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x83a9('0x8')][0x2]);var QUERY=process[_0x83a9('0x8')][0x3];var PATH=process[_0x83a9('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37268e,_0x1eeb84){var _0x814235={'status':_0x37268e};var _0x198987={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1eeb84){_0x814235[_0x83a9('0x9')]=_0x1eeb84;}return db[_0x83a9('0xa')]['update'](_0x814235,_0x198987);}function main(){var _0x2f7eaa=0x1388;var _0x118919;logger['info'](util[_0x83a9('0xb')](_0x83a9('0xc'),EXTRACTED_REPORT_ID,_0x83a9('0xd')));return db[_0x83a9('0xe')][_0x83a9('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x83a9('0x10')]})[_0x83a9('0x11')](function(_0x26ffa0){if(_0x26ffa0){_0x118919=_0x26ffa0;_0x2f7eaa=_0x118919[_0x83a9('0x10')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x83a9('0x12')](util[_0x83a9('0xb')](_0x83a9('0x13'),QUERY),{'type':dbH['sequelize'][_0x83a9('0x14')][_0x83a9('0x15')]});})[_0x83a9('0x11')](function(_0xf7870){if(!_0xf7870[0x0]['num']){return analyticExtractedReport(_0x83a9('0x16'));}var _0x1c9361=[];var _0x3a7ef6=0x0;if(_0x118919['split']){if(_0xf7870&&_0xf7870[_0x83a9('0x17')]){var _0x23ac30=_[_0x83a9('0x18')](_0xf7870[0x0]['num']/_0x2f7eaa);var _0x272180=Number[_0x83a9('0x19')](_0xf7870[0x0][_0x83a9('0x1a')]/_0x2f7eaa)?_0xf7870[0x0][_0x83a9('0x1a')]%_0x2f7eaa:0x0;_0x23ac30[_0x83a9('0x1b')](function(_0x44a4ee){if(_0x44a4ee>0x0){_0x3a7ef6+=_0x2f7eaa;}_0x1c9361['push'](dbH['sequelize'][_0x83a9('0x12')](util[_0x83a9('0xb')](_0x83a9('0x1c'),QUERY,_0x2f7eaa,_0x3a7ef6),{'type':dbH['sequelize'][_0x83a9('0x14')]['SELECT']}));});if(_0x272180>0x0){_0x3a7ef6+=_0x2f7eaa;_0x1c9361['push'](dbH[_0x83a9('0x1d')][_0x83a9('0x12')](util[_0x83a9('0xb')](_0x83a9('0x1c'),QUERY,_0x272180,_0x3a7ef6),{'type':dbH[_0x83a9('0x1d')][_0x83a9('0x14')][_0x83a9('0x15')]}));}}}else{_0x1c9361[_0x83a9('0x1e')](dbH[_0x83a9('0x1d')][_0x83a9('0x12')](QUERY,{'type':dbH['sequelize'][_0x83a9('0x14')][_0x83a9('0x15')]}));}var _0x16bde9=path[_0x83a9('0x1f')](PATH);var _0x1a680d=path[_0x83a9('0x20')](PATH,_0x83a9('0x21'));var _0x4cf2d3=_0x118919[_0x83a9('0x22')]&&_0x1c9361[_0x83a9('0x17')]>0x1;var _0x195c1d=[];if(!fs[_0x83a9('0x23')](path[_0x83a9('0x24')](_0x16bde9,_0x1a680d))&&_0x4cf2d3){fs[_0x83a9('0x25')](path[_0x83a9('0x24')](_0x16bde9,_0x1a680d));}return BPromise[_0x83a9('0x26')](_0x1c9361,function(_0x6a67ee){_0x195c1d[_0x83a9('0x1e')](_0x6a67ee);})['then'](function(){for(var _0x34e53b=0x0;_0x34e53b<_0x195c1d['length'];_0x34e53b+=0x1){var _0x11aa69;var _0x4b8da0=_0x195c1d[_0x34e53b];if(_0x4cf2d3){_0x11aa69=path[_0x83a9('0x24')](_0x16bde9,_0x1a680d,util[_0x83a9('0xb')](_0x83a9('0x27'),_0x1a680d,_0x34e53b,_0x83a9('0x28')));}else{_0x11aa69=path['join'](_0x16bde9,util[_0x83a9('0xb')](_0x83a9('0x29'),_0x1a680d,'xlsx'));}fs[_0x83a9('0x2a')](_0x11aa69,json2xls(_0x4b8da0),_0x83a9('0x2b'));}})[_0x83a9('0x11')](function(){if(_0x4cf2d3){return new Promise(function(_0x7c70a9){zipdir(path[_0x83a9('0x24')](_0x16bde9,_0x1a680d),{'saveTo':path[_0x83a9('0x24')](_0x16bde9,util[_0x83a9('0xb')](_0x83a9('0x29'),_0x1a680d,_0x83a9('0x2c')))},function(_0xcb219b,_0x542e1c){rimraf(path[_0x83a9('0x24')](_0x16bde9,_0x1a680d),function(){});_0x7c70a9(_0x83a9('0x2d'));});});}})['then'](function(){logger[_0x83a9('0x2e')](util[_0x83a9('0xb')](_0x83a9('0x2f'),EXTRACTED_REPORT_ID,_0x83a9('0xd')));return analyticExtractedReport(_0x83a9('0x30'),_0x4cf2d3?util[_0x83a9('0xb')](_0x83a9('0x29'),_0x1a680d,_0x4cf2d3?_0x83a9('0x2c'):'xlsx'):null);});})[_0x83a9('0x31')](function(_0x35f0b3){logger[_0x83a9('0x2e')](util['format'](_0x83a9('0x32'),EXTRACTED_REPORT_ID,_0x83a9('0xd')),util['inspect'](_0x35f0b3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x83a9('0x33'));})[_0x83a9('0x34')](function(){process[_0x83a9('0x35')](EXIT_CODE);});}main();
\ No newline at end of file
+var _0xf534=['existsSync','mkdirSync','xlsx','join','%s.%s','writeFileSync','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','XLSX','Setting','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx'];(function(_0x403235,_0x514e29){var _0x429cf8=function(_0xd5cc2){while(--_0xd5cc2){_0x403235['push'](_0x403235['shift']());}};_0x429cf8(++_0x514e29);}(_0xf534,0x9f));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x4f53('0x0'));var path=require(_0x4f53('0x1'));var _=require(_0x4f53('0x2'));var fs=require('fs');var json2xls=require(_0x4f53('0x3'));var BPromise=require(_0x4f53('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x4f53('0x5'));var db=require(_0x4f53('0x6'))['db'];var dbH=require('../../mysqldb')[_0x4f53('0x7')];var logger=require(_0x4f53('0x8'))(_0x4f53('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x4f53('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4f53('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f5daf,_0x34c008){var _0x22763e={'status':_0x4f5daf};var _0xfc7956={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34c008){_0x22763e[_0x4f53('0xb')]=_0x34c008;}return db['AnalyticExtractedReport'][_0x4f53('0xc')](_0x22763e,_0xfc7956);}function main(){var _0x562c47=0x1388;var _0x5f55ef;logger['info'](util[_0x4f53('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4f53('0xe')));return db[_0x4f53('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4f53('0x10')]})[_0x4f53('0x11')](function(_0x340c2a){if(_0x340c2a){_0x5f55ef=_0x340c2a;_0x562c47=_0x5f55ef[_0x4f53('0x10')]||0x1388;}})[_0x4f53('0x11')](function(){return dbH['sequelize'][_0x4f53('0x12')](util[_0x4f53('0xd')](_0x4f53('0x13'),QUERY),{'type':dbH[_0x4f53('0x14')][_0x4f53('0x15')][_0x4f53('0x16')]});})[_0x4f53('0x11')](function(_0x342db4){if(!_0x342db4[0x0][_0x4f53('0x17')]){return analyticExtractedReport(_0x4f53('0x18'));}var _0x471523=[];var _0x2bed41=0x0;if(_0x5f55ef[_0x4f53('0x19')]){if(_0x342db4&&_0x342db4[_0x4f53('0x1a')]){var _0x235edd=_[_0x4f53('0x1b')](_0x342db4[0x0][_0x4f53('0x17')]/_0x562c47);var _0x4ef926=Number[_0x4f53('0x1c')](_0x342db4[0x0][_0x4f53('0x17')]/_0x562c47)?_0x342db4[0x0][_0x4f53('0x17')]%_0x562c47:0x0;_0x235edd['forEach'](function(_0x263f89){if(_0x263f89>0x0){_0x2bed41+=_0x562c47;}_0x471523[_0x4f53('0x1d')](dbH['sequelize'][_0x4f53('0x12')](util[_0x4f53('0xd')](_0x4f53('0x1e'),QUERY,_0x562c47,_0x2bed41),{'type':dbH[_0x4f53('0x14')][_0x4f53('0x15')]['SELECT']}));});if(_0x4ef926>0x0){_0x2bed41+=_0x562c47;_0x471523[_0x4f53('0x1d')](dbH['sequelize']['query'](util[_0x4f53('0xd')](_0x4f53('0x1e'),QUERY,_0x4ef926,_0x2bed41),{'type':dbH[_0x4f53('0x14')][_0x4f53('0x15')][_0x4f53('0x16')]}));}}}else{_0x471523['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x4f53('0x14')][_0x4f53('0x15')][_0x4f53('0x16')]}));}var _0x295564=path[_0x4f53('0x1f')](PATH);var _0x4d4bd4=path['basename'](PATH,_0x4f53('0x20'));var _0x5e1fa5=_0x5f55ef[_0x4f53('0x19')]&&_0x471523[_0x4f53('0x1a')]>0x1;var _0x59c4fe=[];if(!fs[_0x4f53('0x21')](path['join'](_0x295564,_0x4d4bd4))&&_0x5e1fa5){fs[_0x4f53('0x22')](path['join'](_0x295564,_0x4d4bd4));}return BPromise['each'](_0x471523,function(_0x1ee96d){_0x59c4fe[_0x4f53('0x1d')](_0x1ee96d);})[_0x4f53('0x11')](function(){for(var _0x2c9420=0x0;_0x2c9420<_0x59c4fe['length'];_0x2c9420+=0x1){var _0x445abc;var _0x3ea756=_0x59c4fe[_0x2c9420];if(_0x5e1fa5){_0x445abc=path['join'](_0x295564,_0x4d4bd4,util['format']('%s%d.%s',_0x4d4bd4,_0x2c9420,_0x4f53('0x23')));}else{_0x445abc=path[_0x4f53('0x24')](_0x295564,util['format'](_0x4f53('0x25'),_0x4d4bd4,_0x4f53('0x23')));}fs[_0x4f53('0x26')](_0x445abc,json2xls(_0x3ea756),_0x4f53('0x27'));}})[_0x4f53('0x11')](function(){if(_0x5e1fa5){return new Promise(function(_0x5a571b){zipdir(path['join'](_0x295564,_0x4d4bd4),{'saveTo':path['join'](_0x295564,util[_0x4f53('0xd')](_0x4f53('0x25'),_0x4d4bd4,'zip'))},function(_0xefdc5e,_0x33cce4){rimraf(path['join'](_0x295564,_0x4d4bd4),function(){});_0x5a571b(_0x4f53('0x28'));});});}})[_0x4f53('0x11')](function(){logger[_0x4f53('0x29')](util[_0x4f53('0xd')](_0x4f53('0x2a'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x4f53('0x2b'),_0x5e1fa5?util['format']('%s.%s',_0x4d4bd4,_0x5e1fa5?_0x4f53('0x2c'):'xlsx'):null);});})['catch'](function(_0x3fbc1d){logger[_0x4f53('0x29')](util[_0x4f53('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4f53('0xe')),util[_0x4f53('0x2d')](_0x3fbc1d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4f53('0x2e'));})['finally'](function(){process[_0x4f53('0x2f')](EXIT_CODE);});}main();
\ No newline at end of file
index 12c0449..00ef03c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdec6=['Set','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','map','filter','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','CAST(priority\x20AS\x20UNSIGNED)','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push'];(function(_0x48df8b,_0x2226ef){var _0xffc233=function(_0x438fb5){while(--_0x438fb5){_0x48df8b['push'](_0x48df8b['shift']());}};_0xffc233(++_0x2226ef);}(_0xdec6,0x7a));var _0x6dec=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xdec6[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require(_0x6dec('0x0'));function rewrite(_0x2335af,_0x1ae1ec){var _0x59ac73=this;return _0x2335af[_0x6dec('0x1')][_0x6dec('0x2')][_0x6dec('0x3')]({'raw':!![]})[_0x6dec('0x4')](function(_0x31e273){_0x59ac73[_0x6dec('0x5')]=_0x31e273;return _0x2335af[_0x6dec('0x1')][_0x6dec('0x6')][_0x6dec('0x3')]({'where':{'IntervalId':_0x1ae1ec[_0x6dec('0x7')]},'raw':!![]});})[_0x6dec('0x4')](function(_0x1a5c85){return _0x2335af['models'][_0x6dec('0x6')][_0x6dec('0x3')]({'where':{'exten':{'$in':_[_0x6dec('0x8')](_['map'](_0x1a5c85,'exten'))}},'order':[{'raw':_0x6dec('0x9')}],'raw':!![]});})[_0x6dec('0x4')](function(_0xa008cd){var _0x2842d5=_['filter'](_0xa008cd,{'priority':'1'});var _0x1f606d=_['filter'](_0xa008cd,{'isApp':0x1});var _0x22defe=_[_0x6dec('0xa')](_0x1f606d,_0x6dec('0xb'));var _0x566caa=[_0x6dec('0xc'),_0x6dec('0xd')];var _0x30ed53=[];var _0x5ab4dd=[];for(var _0x1cd041 in _0x22defe){if(_0x22defe[_0x6dec('0xe')](_0x1cd041)){_0x59ac73[_0x6dec('0xf')]=0x2;_0x59ac73[_0x6dec('0x10')]=[];_0x59ac73[_0x6dec('0x11')]=_[_0x6dec('0x12')](_0x2842d5,{'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')]});_0x59ac73[_0x6dec('0x10')]['push']({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':'Set','appdata':util[_0x6dec('0x13')](_0x6dec('0x14'),_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')]),'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0]['exten'],'priority':_0x59ac73['priority']++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});if(_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')]===_0x6dec('0x18')){_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')],'app':_0x6dec('0x1a'),'appdata':_0x6dec('0x1b')+_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')],'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0]['exten'],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});}else if(_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')]===_0x6dec('0x1c')){if(_0x59ac73[_0x6dec('0x11')]){_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':_0x6dec('0x1a'),'appdata':_0x6dec('0x1d')+(_0x59ac73[_0x6dec('0x11')]['cutdigits']?_0x6dec('0x1e')+_0x59ac73[_0x6dec('0x11')]['cutdigits']+'}':_0x6dec('0x1f')),'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0]['exten'],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});}_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':_0x6dec('0x1a'),'appdata':_0x6dec('0x1b')+_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')],'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});var _0xb27dd2=_0x59ac73['priority']++;_0x59ac73[_0x6dec('0x10')]['push']({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':'ExecIf','appdata':_0x6dec('0x20')+(_0xb27dd2+0x2)+'):Goto('+(_0xb27dd2+0x1)+')','context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0xb27dd2,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});if(_0x59ac73['extension']){_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')],'app':_0x6dec('0x1a'),'appdata':_0x59ac73[_0x6dec('0x11')][_0x6dec('0x21')]?_0x6dec('0x22')+_0x59ac73[_0x6dec('0x11')]['cutdigits']+'}':_0x6dec('0x23'),'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0x59ac73['priority']++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});}_0x59ac73[_0x6dec('0x10')]['push']({'type':_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')],'app':_0x6dec('0x1a'),'appdata':_0x6dec('0x24')+_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')],'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});if(_0x59ac73['extension']&&_0x59ac73['extension']['hasOwnProperty'](_0x6dec('0x25'))&&_0x59ac73['extension'][_0x6dec('0x25')]!==_0x6dec('0x26')){_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')],'app':'Set','appdata':_0x6dec('0x27')+_0x59ac73[_0x6dec('0x11')][_0x6dec('0x25')]||_0x6dec('0x28'),'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0x59ac73['priority']++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});}}_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x22defe[_0x1cd041][0x0]['context'],'exten':_0x22defe[_0x1cd041][0x0]['exten'],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':_0x6dec('0x1a'),'appdata':_0x6dec('0x29'),'context':_0x22defe[_0x1cd041][0x0]['context'],'exten':_0x22defe[_0x1cd041][0x0]['exten'],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});_0x59ac73['extensions'][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0]['type'],'app':'Set','appdata':_0x6dec('0x2a'),'context':_0x22defe[_0x1cd041][0x0]['context'],'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'priority':_0x59ac73[_0x6dec('0xf')]++,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});for(var _0x260e0e=0x0,_0x5f2c9b=0x0;_0x260e0e<_0x22defe[_0x1cd041][_0x6dec('0x2b')];_0x260e0e+=0x1,_0x5f2c9b=0x0){var _0x3376c6=_0x22defe[_0x1cd041][_0x260e0e];if(_0x3376c6[_0x6dec('0x15')]){_0x3376c6['type']=_0x3376c6[_0x6dec('0x15')]['toLowerCase']();}var _0x22d140=[];var _0x1fbc3a=[];delete _0x3376c6['id'];delete _0x3376c6[_0x6dec('0x2c')];delete _0x3376c6['updatedAt'];var _0x557e88=_0x3376c6[_0x6dec('0x2d')]!=='*,*,*,*'?[_0x3376c6[_0x6dec('0x2d')]]:_0x3376c6['IntervalId']?_[_0x6dec('0x2e')](_[_0x6dec('0x2f')](_0x59ac73[_0x6dec('0x5')],{'IntervalId':_0x3376c6[_0x6dec('0x7')]}),_0x6dec('0x2d')):[];if(_0x3376c6[_0x6dec('0xe')](_0x6dec('0x30'))){if(_0x3376c6[_0x6dec('0x30')]&&_0x3376c6[_0x6dec('0x30')]!=='--'){_0x22d140[_0x6dec('0x19')]({'type':_0x3376c6[_0x6dec('0x15')],'app':'Set','appdata':_0x6dec('0x31')+_0x3376c6[_0x6dec('0x30')],'context':_0x3376c6[_0x6dec('0x16')],'exten':_0x3376c6['exten'],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73['priority']+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});}}if(_0x3376c6[_0x6dec('0x15')]===_0x6dec('0x1c')&&_0x3376c6[_0x6dec('0xe')](_0x6dec('0x32'))){if(_0x3376c6[_0x6dec('0x32')]){_0x22d140[_0x6dec('0x19')]({'type':_0x3376c6[_0x6dec('0x15')],'app':_0x6dec('0x33'),'appdata':_0x6dec('0x34')+_0x3376c6['callerID']+')','context':_0x3376c6[_0x6dec('0x16')],'exten':_0x3376c6['exten'],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73['priority']+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});}else{_0x22d140['push']({'type':_0x3376c6[_0x6dec('0x15')],'app':_0x6dec('0x33'),'appdata':_0x6dec('0x35'),'context':_0x3376c6[_0x6dec('0x16')],'exten':_0x3376c6['exten'],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73[_0x6dec('0xf')]+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});}}if(_0x3376c6[_0x6dec('0xe')](_0x6dec('0x36'))){if(_0x566caa[_0x6dec('0x37')](_0x3376c6[_0x6dec('0x38')][_0x6dec('0x39')]())>=0x0&&_0x3376c6[_0x6dec('0x3a')]!==_0x6dec('0x3b')){if(_0x3376c6['answer']){_0x22d140[_0x6dec('0x19')]({'type':_0x3376c6['type'],'app':_0x6dec('0x33'),'appdata':_0x6dec('0x3c'),'context':_0x3376c6['context'],'exten':_0x3376c6['exten'],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73['priority']+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});_0x22d140['push']({'type':_0x3376c6['type'],'app':'Set','appdata':_0x6dec('0x3d'),'context':_0x3376c6[_0x6dec('0x16')],'exten':_0x3376c6['exten'],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73[_0x6dec('0xf')]+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});}else{_0x22d140[_0x6dec('0x19')]({'type':_0x3376c6['type'],'app':'ExecIf','appdata':_0x6dec('0x3e'),'context':_0x3376c6[_0x6dec('0x16')],'exten':_0x3376c6[_0x6dec('0xb')],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73[_0x6dec('0xf')]+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});_0x22d140[_0x6dec('0x19')]({'type':_0x3376c6[_0x6dec('0x15')],'app':_0x6dec('0x1a'),'appdata':_0x6dec('0x3f'),'context':_0x3376c6[_0x6dec('0x16')],'exten':_0x3376c6['exten'],'priority':_0x557e88[_0x6dec('0x2b')]+_0x59ac73[_0x6dec('0xf')]+_0x5f2c9b++,'VoiceExtensionId':_0x3376c6[_0x6dec('0x17')]});}}}for(var _0x5742f9=0x0;_0x5742f9<_0x557e88[_0x6dec('0x2b')];_0x5742f9+=0x1){var _0x381d10=_0x59ac73[_0x6dec('0xf')]+_0x557e88['length'];var _0x8237fb=_0x5742f9===_0x557e88[_0x6dec('0x2b')]-0x1?_0x59ac73[_0x6dec('0xf')]+_0x22d140[_0x6dec('0x2b')]+_0x1fbc3a[_0x6dec('0x2b')]+0x2:_0x59ac73[_0x6dec('0xf')]+_0x5742f9+0x1;_0x22d140['splice'](_0x5742f9,0x0,{'type':_0x3376c6[_0x6dec('0x15')],'app':'GotoIfTime','appdata':_0x557e88[_0x5742f9]+'?'+_0x3376c6[_0x6dec('0x16')]+_0x6dec('0x40')+_0x381d10+':'+_0x3376c6[_0x6dec('0x16')]+',${EXTEN},'+_0x8237fb,'exten':_0x3376c6[_0x6dec('0xb')],'context':_0x3376c6[_0x6dec('0x16')],'priority':_0x59ac73[_0x6dec('0xf')]+_0x5742f9,'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});}_0x3376c6[_0x6dec('0xf')]=_0x22d140[_0x6dec('0x2b')]?_[_0x6dec('0x41')](_0x22d140)[_0x6dec('0xf')]+0x1:_0x59ac73[_0x6dec('0xf')];_0x59ac73[_0x6dec('0xf')]=(_0x1fbc3a['length']?_['last'](_0x1fbc3a)[_0x6dec('0xf')]:_0x3376c6[_0x6dec('0xf')])+0x1;_0x59ac73[_0x6dec('0x10')]=_[_0x6dec('0x42')](_0x59ac73[_0x6dec('0x10')],_0x22d140,[_0x3376c6],_0x1fbc3a);}_0x59ac73[_0x6dec('0x10')][_0x6dec('0x19')]({'type':_0x22defe[_0x1cd041][0x0][_0x6dec('0x15')],'app':_0x6dec('0x43'),'exten':_0x22defe[_0x1cd041][0x0][_0x6dec('0xb')],'context':_0x22defe[_0x1cd041][0x0][_0x6dec('0x16')],'priority':_0x59ac73[_0x6dec('0xf')],'VoiceExtensionId':_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]});_0x30ed53[_0x6dec('0x19')](_0x22defe[_0x1cd041][0x0][_0x6dec('0x17')]);_0x5ab4dd=_[_0x6dec('0x42')](_0x5ab4dd,_0x59ac73[_0x6dec('0x10')]);}}return _0x2335af[_0x6dec('0x44')](function(_0x124021){return _0x2335af[_0x6dec('0x1')][_0x6dec('0x6')][_0x6dec('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x30ed53}},'transaction':_0x124021})[_0x6dec('0x4')](function(_0xbf5003){return _0x2335af['models'][_0x6dec('0x6')][_0x6dec('0x46')](_[_0x6dec('0x47')](_0x5ab4dd,_0x6dec('0xf')),{'transaction':_0x124021});});});})[_0x6dec('0x48')](function(_0x4f09bc){console['error'](_0x4f09bc);});}exports[_0x6dec('0x49')]=rewrite;
\ No newline at end of file
+var _0xf0b7=['lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','catch','error','rewrite'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0xf0b7,0x8c));var _0x7f0b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf0b7[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7f0b('0x0'));var util=require(_0x7f0b('0x1'));function rewrite(_0x4211a2,_0x337321){var _0x1ba01c=this;return _0x4211a2[_0x7f0b('0x2')][_0x7f0b('0x3')][_0x7f0b('0x4')]({'raw':!![]})[_0x7f0b('0x5')](function(_0x17a0f6){_0x1ba01c[_0x7f0b('0x6')]=_0x17a0f6;return _0x4211a2[_0x7f0b('0x2')][_0x7f0b('0x7')][_0x7f0b('0x4')]({'where':{'IntervalId':_0x337321[_0x7f0b('0x8')]},'raw':!![]});})[_0x7f0b('0x5')](function(_0x30e2da){return _0x4211a2[_0x7f0b('0x2')][_0x7f0b('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x7f0b('0x9')](_[_0x7f0b('0xa')](_0x30e2da,_0x7f0b('0xb')))}},'order':[{'raw':_0x7f0b('0xc')}],'raw':!![]});})[_0x7f0b('0x5')](function(_0x5e060b){var _0xde6ff=_[_0x7f0b('0xd')](_0x5e060b,{'priority':'1'});var _0x3ea95b=_[_0x7f0b('0xd')](_0x5e060b,{'isApp':0x1});var _0x1cfa75=_['groupBy'](_0x3ea95b,_0x7f0b('0xb'));var _0x150256=['queue',_0x7f0b('0xe')];var _0x3d9dbb=[];var _0x59df88=[];for(var _0x256e48 in _0x1cfa75){if(_0x1cfa75[_0x7f0b('0xf')](_0x256e48)){_0x1ba01c[_0x7f0b('0x10')]=0x2;_0x1ba01c[_0x7f0b('0x11')]=[];_0x1ba01c['extension']=_[_0x7f0b('0x12')](_0xde6ff,{'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')]});_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':util[_0x7f0b('0x16')]('CDR(type)=%s',_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')]),'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});if(_0x1cfa75[_0x256e48][0x0]['type']===_0x7f0b('0x19')){_0x1ba01c[_0x7f0b('0x11')]['push']({'type':_0x1cfa75[_0x256e48][0x0]['type'],'app':'Set','appdata':_0x7f0b('0x1a')+_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')],'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});}else if(_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')]===_0x7f0b('0x1b')){if(_0x1ba01c[_0x7f0b('0x1c')]){_0x1ba01c['extensions'][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x1d')+(_0x1ba01c['extension'][_0x7f0b('0x1e')]?_0x7f0b('0x1f')+_0x1ba01c['extension'][_0x7f0b('0x1e')]+'}':_0x7f0b('0x20')),'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});}_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0]['type'],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x1a')+_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')],'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c['priority']++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});var _0x12aa0c=_0x1ba01c['priority']++;_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0]['type'],'app':'ExecIf','appdata':_0x7f0b('0x21')+(_0x12aa0c+0x2)+_0x7f0b('0x22')+(_0x12aa0c+0x1)+')','context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x12aa0c,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});if(_0x1ba01c['extension']){_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':'Set','appdata':_0x1ba01c['extension'][_0x7f0b('0x1e')]?_0x7f0b('0x23')+_0x1ba01c[_0x7f0b('0x1c')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});}_0x1ba01c['extensions'][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':'Set','appdata':_0x7f0b('0x24')+_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')],'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0]['exten'],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});if(_0x1ba01c[_0x7f0b('0x1c')]&&_0x1ba01c[_0x7f0b('0x1c')][_0x7f0b('0xf')](_0x7f0b('0x25'))&&_0x1ba01c[_0x7f0b('0x1c')][_0x7f0b('0x25')]!=='none'){_0x1ba01c['extensions'][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x26'),'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0]['exten'],'priority':_0x1ba01c['priority']++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});_0x1ba01c[_0x7f0b('0x11')]['push']({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x27')+_0x1ba01c[_0x7f0b('0x1c')][_0x7f0b('0x25')]||_0x7f0b('0x28'),'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c['priority']++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});}}_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0]['type'],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x29'),'context':_0x1cfa75[_0x256e48][0x0]['context'],'exten':_0x1cfa75[_0x256e48][0x0]['exten'],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0]['VoiceExtensionId']});_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c[_0x7f0b('0x10')]++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x2a'),'context':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x17')],'exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'priority':_0x1ba01c['priority']++,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});for(var _0x1a1d94=0x0,_0x2b6cd1=0x0;_0x1a1d94<_0x1cfa75[_0x256e48][_0x7f0b('0x2b')];_0x1a1d94+=0x1,_0x2b6cd1=0x0){var _0x5d9c84=_0x1cfa75[_0x256e48][_0x1a1d94];if(_0x5d9c84['type']){_0x5d9c84[_0x7f0b('0x14')]=_0x5d9c84['type']['toLowerCase']();}var _0x53821f=[];var _0x2d1c31=[];delete _0x5d9c84['id'];delete _0x5d9c84[_0x7f0b('0x2c')];delete _0x5d9c84[_0x7f0b('0x2d')];var _0x1ef3c1=_0x5d9c84['interval']!==_0x7f0b('0x2e')?[_0x5d9c84['interval']]:_0x5d9c84[_0x7f0b('0x8')]?_[_0x7f0b('0xa')](_[_0x7f0b('0xd')](_0x1ba01c[_0x7f0b('0x6')],{'IntervalId':_0x5d9c84[_0x7f0b('0x8')]}),_0x7f0b('0x2f')):[];if(_0x5d9c84[_0x7f0b('0xf')](_0x7f0b('0x30'))){if(_0x5d9c84[_0x7f0b('0x30')]&&_0x5d9c84[_0x7f0b('0x30')]!=='--'){_0x53821f[_0x7f0b('0x13')]({'type':_0x5d9c84['type'],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x31')+_0x5d9c84['tag'],'context':_0x5d9c84['context'],'exten':_0x5d9c84[_0x7f0b('0xb')],'priority':_0x1ef3c1['length']+_0x1ba01c[_0x7f0b('0x10')]+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});}}if(_0x5d9c84[_0x7f0b('0x14')]===_0x7f0b('0x1b')&&_0x5d9c84[_0x7f0b('0xf')]('callerID')){if(_0x5d9c84[_0x7f0b('0x32')]){_0x53821f[_0x7f0b('0x13')]({'type':_0x5d9c84['type'],'app':_0x7f0b('0x33'),'appdata':_0x7f0b('0x34')+_0x5d9c84[_0x7f0b('0x32')]+')','context':_0x5d9c84[_0x7f0b('0x17')],'exten':_0x5d9c84['exten'],'priority':_0x1ef3c1[_0x7f0b('0x2b')]+_0x1ba01c['priority']+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});}else{_0x53821f[_0x7f0b('0x13')]({'type':_0x5d9c84[_0x7f0b('0x14')],'app':'ExecIf','appdata':_0x7f0b('0x35'),'context':_0x5d9c84[_0x7f0b('0x17')],'exten':_0x5d9c84[_0x7f0b('0xb')],'priority':_0x1ef3c1[_0x7f0b('0x2b')]+_0x1ba01c['priority']+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});}}if(_0x5d9c84[_0x7f0b('0xf')](_0x7f0b('0x36'))){if(_0x150256[_0x7f0b('0x37')](_0x5d9c84[_0x7f0b('0x38')][_0x7f0b('0x39')]())>=0x0&&_0x5d9c84['appType']!=='custom'){if(_0x5d9c84[_0x7f0b('0x36')]){_0x53821f['push']({'type':_0x5d9c84['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5d9c84[_0x7f0b('0x17')],'exten':_0x5d9c84[_0x7f0b('0xb')],'priority':_0x1ef3c1[_0x7f0b('0x2b')]+_0x1ba01c[_0x7f0b('0x10')]+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});_0x53821f[_0x7f0b('0x13')]({'type':_0x5d9c84[_0x7f0b('0x14')],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x3a'),'context':_0x5d9c84[_0x7f0b('0x17')],'exten':_0x5d9c84[_0x7f0b('0xb')],'priority':_0x1ef3c1[_0x7f0b('0x2b')]+_0x1ba01c[_0x7f0b('0x10')]+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});}else{_0x53821f[_0x7f0b('0x13')]({'type':_0x5d9c84[_0x7f0b('0x14')],'app':_0x7f0b('0x33'),'appdata':_0x7f0b('0x3b'),'context':_0x5d9c84[_0x7f0b('0x17')],'exten':_0x5d9c84[_0x7f0b('0xb')],'priority':_0x1ef3c1['length']+_0x1ba01c[_0x7f0b('0x10')]+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});_0x53821f[_0x7f0b('0x13')]({'type':_0x5d9c84['type'],'app':_0x7f0b('0x15'),'appdata':_0x7f0b('0x3c'),'context':_0x5d9c84[_0x7f0b('0x17')],'exten':_0x5d9c84[_0x7f0b('0xb')],'priority':_0x1ef3c1[_0x7f0b('0x2b')]+_0x1ba01c['priority']+_0x2b6cd1++,'VoiceExtensionId':_0x5d9c84[_0x7f0b('0x18')]});}}}for(var _0x27b2e2=0x0;_0x27b2e2<_0x1ef3c1['length'];_0x27b2e2+=0x1){var _0x319fd0=_0x1ba01c[_0x7f0b('0x10')]+_0x1ef3c1[_0x7f0b('0x2b')];var _0x2cd120=_0x27b2e2===_0x1ef3c1['length']-0x1?_0x1ba01c[_0x7f0b('0x10')]+_0x53821f[_0x7f0b('0x2b')]+_0x2d1c31[_0x7f0b('0x2b')]+0x2:_0x1ba01c['priority']+_0x27b2e2+0x1;_0x53821f['splice'](_0x27b2e2,0x0,{'type':_0x5d9c84['type'],'app':_0x7f0b('0x3d'),'appdata':_0x1ef3c1[_0x27b2e2]+'?'+_0x5d9c84[_0x7f0b('0x17')]+',${EXTEN},'+_0x319fd0+':'+_0x5d9c84[_0x7f0b('0x17')]+_0x7f0b('0x3e')+_0x2cd120,'exten':_0x5d9c84[_0x7f0b('0xb')],'context':_0x5d9c84[_0x7f0b('0x17')],'priority':_0x1ba01c[_0x7f0b('0x10')]+_0x27b2e2,'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});}_0x5d9c84[_0x7f0b('0x10')]=_0x53821f[_0x7f0b('0x2b')]?_[_0x7f0b('0x3f')](_0x53821f)[_0x7f0b('0x10')]+0x1:_0x1ba01c[_0x7f0b('0x10')];_0x1ba01c[_0x7f0b('0x10')]=(_0x2d1c31[_0x7f0b('0x2b')]?_[_0x7f0b('0x3f')](_0x2d1c31)[_0x7f0b('0x10')]:_0x5d9c84[_0x7f0b('0x10')])+0x1;_0x1ba01c[_0x7f0b('0x11')]=_[_0x7f0b('0x40')](_0x1ba01c['extensions'],_0x53821f,[_0x5d9c84],_0x2d1c31);}_0x1ba01c[_0x7f0b('0x11')][_0x7f0b('0x13')]({'type':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x14')],'app':'Hangup','exten':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0xb')],'context':_0x1cfa75[_0x256e48][0x0]['context'],'priority':_0x1ba01c[_0x7f0b('0x10')],'VoiceExtensionId':_0x1cfa75[_0x256e48][0x0][_0x7f0b('0x18')]});_0x3d9dbb[_0x7f0b('0x13')](_0x1cfa75[_0x256e48][0x0]['VoiceExtensionId']);_0x59df88=_[_0x7f0b('0x40')](_0x59df88,_0x1ba01c['extensions']);}}return _0x4211a2['transaction'](function(_0x8f2274){return _0x4211a2['models'][_0x7f0b('0x7')][_0x7f0b('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x3d9dbb}},'transaction':_0x8f2274})['then'](function(_0x28363a){return _0x4211a2[_0x7f0b('0x2')][_0x7f0b('0x7')][_0x7f0b('0x42')](_['sortBy'](_0x59df88,_0x7f0b('0x10')),{'transaction':_0x8f2274});});});})[_0x7f0b('0x43')](function(_0x949c7d){console[_0x7f0b('0x44')](_0x949c7d);});}exports[_0x7f0b('0x45')]=rewrite;
\ No newline at end of file
index f77e3ff..0d378c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x063a=['cm_hopper_final','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','catch','onlyIfOpen','VoiceQueueId','all','Campaign','Lists','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','field','NOW()','scheduledAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','select','\x20=\x20?','ListId','phone\x20NOT\x20IN\x20(?)','calleridnum'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x063a,0x104));var _0xa063=function(_0x4d8510,_0xd6c36){_0x4d8510=_0x4d8510-0x0;var _0x2e3a2b=_0x063a[_0x4d8510];return _0x2e3a2b;};'use strict';var BPromise=require('bluebird');var util=require(_0xa063('0x0'));var _=require(_0xa063('0x1'));var fs=require('fs');var squel=require(_0xa063('0x2'));var Papa=require(_0xa063('0x3'));var Redis=require('ioredis');var db=require(_0xa063('0x4'))['db'];var config=require(_0xa063('0x5'));var logger=require('../../../config/logger')(_0xa063('0x6'));config[_0xa063('0x7')]=_[_0xa063('0x8')](config[_0xa063('0x7')],{'host':_0xa063('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0xa063('0xa')](socket);try{if(!process[_0xa063('0xb')][0x2]||process[_0xa063('0xb')][0x2]===_0xa063('0xc')||process['argv'][0x2]==='null'){throw new Error(_0xa063('0xd'));}var FILEPATH=process[_0xa063('0xb')][0x2];if(!process[_0xa063('0xb')][0x3]||process['argv'][0x3]===_0xa063('0xc')||process[_0xa063('0xb')][0x3]==='null'||!process[_0xa063('0xb')][0x4]||process[_0xa063('0xb')][0x4]==='undefined'||process[_0xa063('0xb')][0x4]===_0xa063('0xe')){throw new Error(_0xa063('0xf'));}var FIELDS=_['zipObject'](process[_0xa063('0xb')][0x3][_0xa063('0x10')](','),process[_0xa063('0xb')][0x4][_0xa063('0x10')](','));if(!process[_0xa063('0xb')][0x5]||process[_0xa063('0xb')][0x5]===_0xa063('0xc')||process['argv'][0x5]===_0xa063('0xe')){throw new Error(_0xa063('0x11'));}var LISTID=process[_0xa063('0xb')][0x5];var COMPANYID=process[_0xa063('0xb')][0x6]&&process[_0xa063('0xb')][0x6]!=='undefined'&&process[_0xa063('0xb')][0x6]!==_0xa063('0xe')?process[_0xa063('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xa063('0xb')][0x7]!==_0xa063('0xc')&&process['argv'][0x7]!==_0xa063('0xe')?process[_0xa063('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0xa063('0xb')][0x8]===_0xa063('0xc')||process[_0xa063('0xb')][0x8]===_0xa063('0xe')){throw new Error(_0xa063('0x12'));}var SOCKET_TIMESTAMP=process[_0xa063('0xb')][0x8];}catch(_0x4c0bfd){logger[_0xa063('0x13')](_0x4c0bfd);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x1c8175,_0x5bf215,_0x305067,_0x48a195){var _0x1dc372={'message':_0x5bf215};_0x1dc372[_0x1c8175]=!![];if(_0x305067){_0x1dc372['contact']=_0x305067;}if(_0x48a195){_0x1dc372[_0xa063('0x14')]=_0x48a195;}return _0x1dc372;}function isEmail(_0x327489){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xa063('0x15')](_0x327489);}function checkRow(_0x40f066,_0x5cd8d2,_0x388648){return new BPromise(function(_0x341b78,_0x295a0d){if(_[_0xa063('0x16')](_0x40f066)){return _0x295a0d(handleCheckRowError('error',_0xa063('0x17'),null,_0x388648));}if(_0x40f066[_0xa063('0x18')]&&_0x40f066[_0xa063('0x18')][_0xa063('0x19')]){var _0x5e7b00=_['map'](_0x40f066['errors'],_0xa063('0x1a'))[_0xa063('0x1b')](';');return _0x295a0d(handleCheckRowError(_0xa063('0x13'),_0x5e7b00,null,_0x388648));}var _0x350984={};for(var _0x3fbddc in FIELDS){if(FIELDS[_0xa063('0x1c')](_0x3fbddc)&&FIELDS[_0x3fbddc]){_0x350984[_0x3fbddc]=_0x40f066[_0xa063('0x1d')][0x0][FIELDS[_0x3fbddc]]||_0x40f066[_0xa063('0x1d')][0x0]['\ufeff'+FIELDS[_0x3fbddc]];}}if(!_0x350984['firstName']){return _0x295a0d(handleCheckRowError('error',_0xa063('0x1e'),null,_0x388648));}if(!_0x350984[_0xa063('0x1f')]){return _0x295a0d(handleCheckRowError(_0xa063('0x13'),_0xa063('0x20'),null,_0x388648));}if(_0x350984['birthDate']){var _0x343f9f=moment(_0x350984[_0xa063('0x21')],_0xa063('0x22'));if(!_0x343f9f['isValid']()){return _0x295a0d(handleCheckRowError(_0xa063('0x13'),_0xa063('0x23'),null,_0x388648));}}if(_0x350984[_0xa063('0x24')]){if(!isEmail(_0x350984[_0xa063('0x24')])){return _0x295a0d(handleCheckRowError(_0xa063('0x13'),_0xa063('0x25'),null,_0x388648));}}_0x350984['ListId']=LISTID;_0x350984['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa063('0x19')]&&_0x5cd8d2){var _0x4c9df8={};for(var _0x33744a=0x0,_0x41579f=DUPLICATES[_0xa063('0x19')];_0x33744a<_0x41579f;_0x33744a+=0x1){_0x4c9df8[DUPLICATES[_0x33744a]]=_0x350984[DUPLICATES[_0x33744a]];}var _0x2a8aa4=_[_0xa063('0x26')](_0x5cd8d2,_0x4c9df8);if(_0x2a8aa4){return _0x295a0d(handleCheckRowError(_0xa063('0x27'),_0xa063('0x28'),_0x2a8aa4,_0x388648));}}return db[_0xa063('0x29')][_0xa063('0x2a')](_0x350984,{'raw':!![],'hooks':![],'fields':_[_0xa063('0x2b')](_0x350984)})[_0xa063('0x2c')](function(_0x28e197){if(DUPLICATES&&DUPLICATES['length']&&_0x5cd8d2){_0x5cd8d2[_0xa063('0x2d')](_[_0xa063('0x2e')](_0x350984,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x28e197['id'];return _0x341b78();})['catch'](function(_0x4d6b8c){return _0x295a0d(handleCheckRowError(_0xa063('0x13'),_0xa063('0x2f')+(_0x4d6b8c['message']||JSON[_0xa063('0x30')](_0x4d6b8c)),null,_0x388648));});});}function checkHopper(){function _0xd1170f(){return function(_0x259e33){logger[_0xa063('0x13')](_0xa063('0x31'),'checkHopper',util[_0xa063('0x32')](_0x259e33,{'showHidden':![],'depth':null}));};}var _0x5d0e28=function(_0x238538,_0x1d035d){var _0x5aaa1c=squel[_0xa063('0x33')]()[_0xa063('0x34')](_0xa063('0x35'))[_0xa063('0x36')]([_0xa063('0x1f'),'scheduledAt',_0xa063('0x37'),'ListId',_0x1d035d,_0xa063('0x38'),_0xa063('0x39')],squel['select']()[_0xa063('0x3a')](_0xa063('0x1f'),_0xa063('0x1f'))[_0xa063('0x3a')](_0xa063('0x3b'),_0xa063('0x3c'))[_0xa063('0x3a')]('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0xa063('0x3a')](_0x238538['id']['toString'](),_0x1d035d)[_0xa063('0x3a')](_0xa063('0x3b'),_0xa063('0x38'))[_0xa063('0x3a')]('NOW()',_0xa063('0x39'))[_0xa063('0x3d')](_0xa063('0x3e'))[_0xa063('0x3f')](_0xa063('0x40'))[_0xa063('0x3f')](_0xa063('0x41'),LISTID[_0xa063('0x42')]())['where'](_0xa063('0x43'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa063('0x44')]()[_0xa063('0x3a')](_0xa063('0x1f'))[_0xa063('0x3d')](_0xa063('0x35'))[_0xa063('0x3f')](_0x1d035d+_0xa063('0x45'),_0x238538['id'][_0xa063('0x42')]())))[_0xa063('0x42')]();return _0x5aaa1c;};var _0x5b93fe=function(_0x5958b8,_0x1d49df){var _0x3c2301=squel[_0xa063('0x33')]()['into'](_0xa063('0x35'))[_0xa063('0x36')]([_0xa063('0x1f'),_0xa063('0x3c'),'ContactId',_0xa063('0x46'),_0x1d49df,_0xa063('0x38'),_0xa063('0x39')],squel[_0xa063('0x44')]()[_0xa063('0x3a')](_0xa063('0x1f'),_0xa063('0x1f'))['field']('NOW()',_0xa063('0x3c'))[_0xa063('0x3a')]('id',_0xa063('0x37'))[_0xa063('0x3a')](LISTID['toString'](),_0xa063('0x46'))[_0xa063('0x3a')](_0x5958b8['id'][_0xa063('0x42')](),_0x1d49df)[_0xa063('0x3a')](_0xa063('0x3b'),'createdAt')[_0xa063('0x3a')](_0xa063('0x3b'),_0xa063('0x39'))[_0xa063('0x3d')](_0xa063('0x3e'))[_0xa063('0x3f')](_0xa063('0x40'))[_0xa063('0x3f')](_0xa063('0x41'),LISTID[_0xa063('0x42')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0xa063('0x43'))[_0xa063('0x3f')](_0xa063('0x47'),squel[_0xa063('0x44')]()['field'](_0xa063('0x48'))[_0xa063('0x3d')](_0xa063('0x49'))['where'](_0x1d49df+_0xa063('0x45'),_0x5958b8['id']['toString']()))[_0xa063('0x3f')](_0xa063('0x47'),squel['select']()['field'](_0xa063('0x1f'))[_0xa063('0x3d')](_0xa063('0x35'))[_0xa063('0x3f')](_0x1d49df+_0xa063('0x45'),_0x5958b8['id'][_0xa063('0x42')]())))[_0xa063('0x42')]();return _0x3c2301;};function _0x50a64e(_0x559266,_0x2150ce){var _0x57b067=squel[_0xa063('0x33')]()[_0xa063('0x34')](_0xa063('0x35'))['fromQuery']([_0xa063('0x1f'),'scheduledAt',_0xa063('0x37'),_0xa063('0x46'),_0x2150ce,_0xa063('0x38'),_0xa063('0x39')],squel[_0xa063('0x44')]()[_0xa063('0x3a')](_0xa063('0x1f'),_0xa063('0x1f'))[_0xa063('0x3a')]('NOW()',_0xa063('0x3c'))[_0xa063('0x3a')]('id',_0xa063('0x37'))[_0xa063('0x3a')](LISTID[_0xa063('0x42')](),_0xa063('0x46'))['field'](_0x559266['id'][_0xa063('0x42')](),_0x2150ce)[_0xa063('0x3a')](_0xa063('0x3b'),'createdAt')['field'](_0xa063('0x3b'),_0xa063('0x39'))[_0xa063('0x3d')](_0xa063('0x3e'))['where'](_0xa063('0x40'))[_0xa063('0x3f')]('ListId\x20=\x20?',LISTID['toString']())[_0xa063('0x3f')](_0xa063('0x4a'),squel[_0xa063('0x4b')](hopperContacts))[_0xa063('0x3f')](_0xa063('0x43')))[_0xa063('0x42')]();return _0x57b067;}function _0x5e579e(_0x3cce55,_0x27dc3f){var _0x3c90d1=squel['insert']()[_0xa063('0x34')](_0xa063('0x4c'))[_0xa063('0x36')]([_0xa063('0x1f'),_0xa063('0x37'),_0xa063('0x46'),_0x27dc3f,_0xa063('0x38'),'updatedAt'],squel[_0xa063('0x44')]()[_0xa063('0x3a')](_0xa063('0x1f'),_0xa063('0x1f'))[_0xa063('0x3a')]('id',_0xa063('0x37'))[_0xa063('0x3a')](LISTID[_0xa063('0x42')](),_0xa063('0x46'))[_0xa063('0x3a')](_0x3cce55['id'][_0xa063('0x42')](),_0x27dc3f)[_0xa063('0x3a')](_0xa063('0x3b'),_0xa063('0x38'))[_0xa063('0x3a')](_0xa063('0x3b'),_0xa063('0x39'))[_0xa063('0x3d')](_0xa063('0x3e'))[_0xa063('0x3f')](_0xa063('0x40'))[_0xa063('0x3f')]('ListId\x20=\x20?',LISTID[_0xa063('0x42')]())[_0xa063('0x3f')](_0xa063('0x4a'),squel[_0xa063('0x4b')](hopperContacts))[_0xa063('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x3c90d1;}return db[_0xa063('0x4d')][_0xa063('0x4e')]({'where':{'type':_0xa063('0x4f')},'attributes':['id',_0xa063('0x50')],'include':[{'model':db[_0xa063('0x51')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0xd313a0){var _0x8d98f1=[];if(_0xd313a0){var _0x3dbe18;for(var _0x3793ba=0x0,_0x5ebc8e;_0x3793ba<_0xd313a0[_0xa063('0x19')];_0x3793ba+=0x1){_0x5ebc8e=_0xd313a0[_0x3793ba][_0xa063('0x52')]({'plain':!![]});switch(_0x5ebc8e[_0xa063('0x50')]){case _0xa063('0x53'):_0x8d98f1[_0xa063('0x2d')](db[_0xa063('0x54')][_0xa063('0x55')](_0x5b93fe(_0x5ebc8e,'VoiceQueueId'))[_0xa063('0x2c')](function(){})[_0xa063('0x56')](_0xd1170f()));break;case _0xa063('0x57'):_0x8d98f1[_0xa063('0x2d')](db[_0xa063('0x54')][_0xa063('0x55')](_0x5d0e28(_0x5ebc8e,_0xa063('0x58')))[_0xa063('0x2c')](function(){})[_0xa063('0x56')](_0xd1170f()));break;default:_0x8d98f1[_0xa063('0x2d')](db[_0xa063('0x54')][_0xa063('0x55')](_0x50a64e(_0x5ebc8e,'VoiceQueueId'))['then'](function(){})[_0xa063('0x56')](_0xd1170f()));}}}return _0x8d98f1;})[_0xa063('0x59')]()[_0xa063('0x2c')](function(){return db[_0xa063('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xa063('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa063('0x2c')](function(_0x5374d2){var _0x4a5d29=[];if(_0x5374d2){var _0xd271e4;for(var _0xb3e82d=0x0,_0x1c539b;_0xb3e82d<_0x5374d2[_0xa063('0x19')];_0xb3e82d+=0x1){_0x1c539b=_0x5374d2[_0xb3e82d][_0xa063('0x52')]({'plain':!![]});_0x4a5d29[_0xa063('0x2d')](db[_0xa063('0x54')][_0xa063('0x55')](_0x5e579e(_0x1c539b,'VoiceQueueId'))[_0xa063('0x2c')](function(){})[_0xa063('0x56')](_0xd1170f()));}}return _0x4a5d29;})['all']();})['then'](function(){return db[_0xa063('0x5a')][_0xa063('0x4e')]({'attributes':['id',_0xa063('0x50')],'include':[{'model':db[_0xa063('0x51')],'as':_0xa063('0x5b'),'where':{'id':LISTID}}]})[_0xa063('0x2c')](function(_0x132443){var _0x2acfff=[];if(_0x132443){for(var _0x1e1405=0x0,_0x1d72b9;_0x1e1405<_0x132443[_0xa063('0x19')];_0x1e1405+=0x1){_0x1d72b9=_0x132443[_0x1e1405]['get']({'plain':!![]});switch(_0x1d72b9['dialCheckDuplicateType']){case _0xa063('0x53'):_0x2acfff[_0xa063('0x2d')](db['sequelize'][_0xa063('0x55')](_0x5b93fe(_0x1d72b9,_0xa063('0x5c')))['then'](function(){})[_0xa063('0x56')](_0xd1170f()));break;case'onlyIfOpen':_0x2acfff[_0xa063('0x2d')](db['sequelize']['query'](_0x5d0e28(_0x1d72b9,_0xa063('0x5c')))['then'](function(){})[_0xa063('0x56')](_0xd1170f()));break;default:_0x2acfff['push'](db[_0xa063('0x54')][_0xa063('0x55')](_0x50a64e(_0x1d72b9,_0xa063('0x5c')))[_0xa063('0x2c')](function(){})[_0xa063('0x56')](_0xd1170f()));}}}return _0x2acfff;})[_0xa063('0x59')]();})[_0xa063('0x2c')](function(){return db['Campaign'][_0xa063('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xa063('0x51')],'as':_0xa063('0x5d'),'where':{'id':LISTID}}]})[_0xa063('0x2c')](function(_0x3c9760){var _0x167a61=[];if(_0x3c9760){for(var _0x25be64=0x0,_0x21de4c;_0x25be64<_0x3c9760['length'];_0x25be64+=0x1){_0x21de4c=_0x3c9760[_0x25be64][_0xa063('0x52')]({'plain':!![]});_0x167a61[_0xa063('0x2d')](db[_0xa063('0x54')][_0xa063('0x55')](_0x5e579e(_0x21de4c,'CampaignId'))[_0xa063('0x2c')](function(){})[_0xa063('0x56')](_0xd1170f()));}}return _0x167a61;})[_0xa063('0x59')]();})[_0xa063('0x56')](function(_0x322a74){logger[_0xa063('0x13')](_0xa063('0x5e'),_0xa063('0x5f'),_0x322a74['message']);});}var processPromises=function(_0x21d895){return BPromise[_0xa063('0x59')](promises)[_0xa063('0x2c')](function(_0x1fab90){})[_0xa063('0x56')](function(_0x373e58){logger[_0xa063('0x13')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x373e58));})[_0xa063('0x60')](function(){socket[_0xa063('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x21d895){return _0x21d895[_0xa063('0x62')]();}});};var endCsv=function(){return BPromise[_0xa063('0x63')]()[_0xa063('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xa063('0x2c')](function(){socket[_0xa063('0x61')](_0xa063('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa063('0x65')](FILEPATH);}catch(_0x3f2bb2){logger['error'](_0xa063('0x66'),JSON[_0xa063('0x30')](_0x3f2bb2));}finally{process[_0xa063('0x67')](0x0);}});};process['on'](_0xa063('0x68'),function(){logger[_0xa063('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xa063('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa063('0x10')](',');return db['CmContact'][_0xa063('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa063('0x2c')](function(_0x5698c3){var _0x2766f5=fs[_0xa063('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa063('0x6b')](_0x2766f5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ba75a,_0x2d1a81){total+=0x1;var _0x274283=total;promises[_0xa063('0x2d')](checkRow(_0x5ba75a,_0x5698c3,_0x274283)['then'](function(){success+=0x1;})[_0xa063('0x56')](function(_0x1070a3){if(_0x1070a3[_0xa063('0x13')]){errors+=0x1;delete _0x1070a3[_0xa063('0x13')];}else if(_0x1070a3[_0xa063('0x27')]){duplicates+=0x1;delete _0x1070a3[_0xa063('0x27')];}rows[_0xa063('0x2d')](_0x1070a3);}));if(total%0xc8===0x0){_0x2d1a81[_0xa063('0x6c')]();return processPromises(_0x2d1a81);}},'complete':function(){return processPromises()[_0xa063('0x2c')](function(){logger['info'](_0xa063('0x6d'));endCsv();});},'error':function(_0xc4f0a4,_0x39cbde){logger[_0xa063('0x69')]('CSV\x20parse\x20error',JSON['stringify'](_0xc4f0a4));endCsv();}});})[_0xa063('0x56')](function(_0x1a9a9f){logger[_0xa063('0x13')](_0xa063('0x6e'),JSON[_0xa063('0x30')](_0x1a9a9f));});}main();
\ No newline at end of file
+var _0x2fd3=['find','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','\x20=\x20?','into','scheduledAt','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','VoiceQueue','BlackLists','Campaign','CmList','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId'];(function(_0x4c39f6,_0xa985ca){var _0x1c0bbe=function(_0x3a2a1f){while(--_0x3a2a1f){_0x4c39f6['push'](_0x4c39f6['shift']());}};_0x1c0bbe(++_0xa985ca);}(_0x2fd3,0x1a0));var _0x32fd=function(_0x1c63d5,_0x2d6023){_0x1c63d5=_0x1c63d5-0x0;var _0x378704=_0x2fd3[_0x1c63d5];return _0x378704;};'use strict';var BPromise=require(_0x32fd('0x0'));var util=require(_0x32fd('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x32fd('0x2'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0x32fd('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x32fd('0x4'))(_0x32fd('0x5'));config[_0x32fd('0x6')]=_[_0x32fd('0x7')](config[_0x32fd('0x6')],{'host':_0x32fd('0x8'),'port':0x18eb});var socket=require(_0x32fd('0x9'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x32fd('0xa')](socket);try{if(!process[_0x32fd('0xb')][0x2]||process[_0x32fd('0xb')][0x2]===_0x32fd('0xc')||process['argv'][0x2]===_0x32fd('0xd')){throw new Error(_0x32fd('0xe'));}var FILEPATH=process[_0x32fd('0xb')][0x2];if(!process[_0x32fd('0xb')][0x3]||process[_0x32fd('0xb')][0x3]===_0x32fd('0xc')||process[_0x32fd('0xb')][0x3]==='null'||!process[_0x32fd('0xb')][0x4]||process[_0x32fd('0xb')][0x4]===_0x32fd('0xc')||process['argv'][0x4]===_0x32fd('0xd')){throw new Error(_0x32fd('0xf'));}var FIELDS=_[_0x32fd('0x10')](process[_0x32fd('0xb')][0x3]['split'](','),process[_0x32fd('0xb')][0x4][_0x32fd('0x11')](','));if(!process[_0x32fd('0xb')][0x5]||process[_0x32fd('0xb')][0x5]===_0x32fd('0xc')||process[_0x32fd('0xb')][0x5]===_0x32fd('0xd')){throw new Error(_0x32fd('0x12'));}var LISTID=process[_0x32fd('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x32fd('0xb')][0x6]!==_0x32fd('0xc')&&process['argv'][0x6]!=='null'?process[_0x32fd('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x32fd('0xc')&&process[_0x32fd('0xb')][0x7]!==_0x32fd('0xd')?process[_0x32fd('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x32fd('0xb')][0x8]==='undefined'||process[_0x32fd('0xb')][0x8]===_0x32fd('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x32fd('0xb')][0x8];}catch(_0x17f31b){logger['error'](_0x17f31b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x962a2,_0x5b19cc,_0x427670,_0x5bbcf4){var _0x285207={'message':_0x5b19cc};_0x285207[_0x962a2]=!![];if(_0x427670){_0x285207[_0x32fd('0x13')]=_0x427670;}if(_0x5bbcf4){_0x285207[_0x32fd('0x14')]=_0x5bbcf4;}return _0x285207;}function isEmail(_0x1fb67c){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x32fd('0x15')](_0x1fb67c);}function checkRow(_0x165c17,_0x34a07b,_0x396a2c){return new BPromise(function(_0x139701,_0x561788){if(_[_0x32fd('0x16')](_0x165c17)){return _0x561788(handleCheckRowError(_0x32fd('0x17'),_0x32fd('0x18'),null,_0x396a2c));}if(_0x165c17[_0x32fd('0x19')]&&_0x165c17[_0x32fd('0x19')][_0x32fd('0x1a')]){var _0x20bb28=_['map'](_0x165c17['errors'],'message')['join'](';');return _0x561788(handleCheckRowError(_0x32fd('0x17'),_0x20bb28,null,_0x396a2c));}var _0x26769e={};for(var _0x4ebe79 in FIELDS){if(FIELDS[_0x32fd('0x1b')](_0x4ebe79)&&FIELDS[_0x4ebe79]){_0x26769e[_0x4ebe79]=_0x165c17[_0x32fd('0x1c')][0x0][FIELDS[_0x4ebe79]]||_0x165c17['data'][0x0]['\ufeff'+FIELDS[_0x4ebe79]];}}if(!_0x26769e['firstName']){return _0x561788(handleCheckRowError(_0x32fd('0x17'),_0x32fd('0x1d'),null,_0x396a2c));}if(!_0x26769e[_0x32fd('0x1e')]){return _0x561788(handleCheckRowError(_0x32fd('0x17'),_0x32fd('0x1f'),null,_0x396a2c));}if(_0x26769e[_0x32fd('0x20')]){var _0x4fdea3=moment(_0x26769e['birthDate'],_0x32fd('0x21'));if(!_0x4fdea3[_0x32fd('0x22')]()){return _0x561788(handleCheckRowError('error',_0x32fd('0x23'),null,_0x396a2c));}}if(_0x26769e[_0x32fd('0x24')]){if(!isEmail(_0x26769e[_0x32fd('0x24')])){return _0x561788(handleCheckRowError(_0x32fd('0x17'),_0x32fd('0x25'),null,_0x396a2c));}}_0x26769e[_0x32fd('0x26')]=LISTID;_0x26769e[_0x32fd('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x32fd('0x1a')]&&_0x34a07b){var _0x3151ac={};for(var _0x42332b=0x0,_0x341905=DUPLICATES[_0x32fd('0x1a')];_0x42332b<_0x341905;_0x42332b+=0x1){_0x3151ac[DUPLICATES[_0x42332b]]=_0x26769e[DUPLICATES[_0x42332b]];}var _0x17ac4c=_[_0x32fd('0x28')](_0x34a07b,_0x3151ac);if(_0x17ac4c){return _0x561788(handleCheckRowError('duplicate',_0x32fd('0x29'),_0x17ac4c,_0x396a2c));}}return db[_0x32fd('0x2a')][_0x32fd('0x2b')](_0x26769e,{'raw':!![],'hooks':![],'fields':_[_0x32fd('0x2c')](_0x26769e)})[_0x32fd('0x2d')](function(_0xd1338a){if(DUPLICATES&&DUPLICATES[_0x32fd('0x1a')]&&_0x34a07b){_0x34a07b[_0x32fd('0x2e')](_[_0x32fd('0x2f')](_0x26769e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xd1338a['id'];return _0x139701();})[_0x32fd('0x30')](function(_0x16edbd){return _0x561788(handleCheckRowError(_0x32fd('0x17'),_0x32fd('0x31')+(_0x16edbd['message']||JSON[_0x32fd('0x32')](_0x16edbd)),null,_0x396a2c));});});}function checkHopper(){function _0x2d61cf(){return function(_0x41affe){logger[_0x32fd('0x17')](_0x32fd('0x33'),_0x32fd('0x34'),util[_0x32fd('0x35')](_0x41affe,{'showHidden':![],'depth':null}));};}var _0x5af040=function(_0x598e24,_0x585b0f){var _0x1e0925=squel[_0x32fd('0x36')]()['into'](_0x32fd('0x37'))[_0x32fd('0x38')]([_0x32fd('0x1e'),'scheduledAt',_0x32fd('0x39'),_0x32fd('0x26'),_0x585b0f,_0x32fd('0x3a'),_0x32fd('0x3b')],squel[_0x32fd('0x3c')]()['field'](_0x32fd('0x1e'),_0x32fd('0x1e'))[_0x32fd('0x3d')]('NOW()','scheduledAt')[_0x32fd('0x3d')]('id','ContactId')[_0x32fd('0x3d')](LISTID[_0x32fd('0x3e')](),_0x32fd('0x26'))['field'](_0x598e24['id'][_0x32fd('0x3e')](),_0x585b0f)[_0x32fd('0x3d')](_0x32fd('0x3f'),'createdAt')[_0x32fd('0x3d')]('NOW()',_0x32fd('0x3b'))[_0x32fd('0x40')]('cm_contacts')[_0x32fd('0x41')](_0x32fd('0x42'))['where'](_0x32fd('0x43'),LISTID[_0x32fd('0x3e')]())[_0x32fd('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x32fd('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x32fd('0x3c')]()[_0x32fd('0x3d')](_0x32fd('0x1e'))[_0x32fd('0x40')]('cm_hopper')[_0x32fd('0x41')](_0x585b0f+_0x32fd('0x44'),_0x598e24['id'][_0x32fd('0x3e')]())))[_0x32fd('0x3e')]();return _0x1e0925;};var _0x4f650b=function(_0x1cc190,_0x213b23){var _0x473ad1=squel[_0x32fd('0x36')]()[_0x32fd('0x45')](_0x32fd('0x37'))[_0x32fd('0x38')]([_0x32fd('0x1e'),_0x32fd('0x46'),_0x32fd('0x39'),'ListId',_0x213b23,_0x32fd('0x3a'),_0x32fd('0x3b')],squel[_0x32fd('0x3c')]()[_0x32fd('0x3d')](_0x32fd('0x1e'),_0x32fd('0x1e'))[_0x32fd('0x3d')]('NOW()',_0x32fd('0x46'))[_0x32fd('0x3d')]('id','ContactId')['field'](LISTID['toString'](),_0x32fd('0x26'))['field'](_0x1cc190['id'][_0x32fd('0x3e')](),_0x213b23)['field']('NOW()',_0x32fd('0x3a'))[_0x32fd('0x3d')](_0x32fd('0x3f'),_0x32fd('0x3b'))[_0x32fd('0x40')](_0x32fd('0x47'))[_0x32fd('0x41')](_0x32fd('0x42'))[_0x32fd('0x41')](_0x32fd('0x43'),LISTID[_0x32fd('0x3e')]())[_0x32fd('0x41')](_0x32fd('0x48'),squel[_0x32fd('0x49')](hopperContacts))[_0x32fd('0x41')](_0x32fd('0x4a'))[_0x32fd('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x32fd('0x3c')]()[_0x32fd('0x3d')](_0x32fd('0x4b'))['from']('cm_hopper_final')[_0x32fd('0x41')](_0x213b23+_0x32fd('0x44'),_0x1cc190['id']['toString']()))[_0x32fd('0x41')](_0x32fd('0x4c'),squel[_0x32fd('0x3c')]()[_0x32fd('0x3d')](_0x32fd('0x1e'))[_0x32fd('0x40')](_0x32fd('0x37'))['where'](_0x213b23+_0x32fd('0x44'),_0x1cc190['id']['toString']())))[_0x32fd('0x3e')]();return _0x473ad1;};function _0x4f69ee(_0x577406,_0x52fb05){var _0x407091=squel['insert']()['into']('cm_hopper')[_0x32fd('0x38')]([_0x32fd('0x1e'),'scheduledAt',_0x32fd('0x39'),_0x32fd('0x26'),_0x52fb05,_0x32fd('0x3a'),_0x32fd('0x3b')],squel[_0x32fd('0x3c')]()[_0x32fd('0x3d')]('phone',_0x32fd('0x1e'))[_0x32fd('0x3d')](_0x32fd('0x3f'),_0x32fd('0x46'))[_0x32fd('0x3d')]('id',_0x32fd('0x39'))['field'](LISTID['toString'](),'ListId')[_0x32fd('0x3d')](_0x577406['id']['toString'](),_0x52fb05)['field']('NOW()',_0x32fd('0x3a'))[_0x32fd('0x3d')](_0x32fd('0x3f'),_0x32fd('0x3b'))[_0x32fd('0x40')](_0x32fd('0x47'))[_0x32fd('0x41')](_0x32fd('0x42'))[_0x32fd('0x41')](_0x32fd('0x43'),LISTID[_0x32fd('0x3e')]())[_0x32fd('0x41')](_0x32fd('0x48'),squel[_0x32fd('0x49')](hopperContacts))[_0x32fd('0x41')](_0x32fd('0x4a')))[_0x32fd('0x3e')]();return _0x407091;}function _0x324e08(_0x5f5015,_0x1ea782){var _0x330b2e=squel[_0x32fd('0x36')]()[_0x32fd('0x45')](_0x32fd('0x4d'))['fromQuery']([_0x32fd('0x1e'),_0x32fd('0x39'),_0x32fd('0x26'),_0x1ea782,_0x32fd('0x3a'),_0x32fd('0x3b')],squel[_0x32fd('0x3c')]()[_0x32fd('0x3d')]('phone',_0x32fd('0x1e'))[_0x32fd('0x3d')]('id',_0x32fd('0x39'))[_0x32fd('0x3d')](LISTID[_0x32fd('0x3e')](),'ListId')[_0x32fd('0x3d')](_0x5f5015['id'][_0x32fd('0x3e')](),_0x1ea782)[_0x32fd('0x3d')](_0x32fd('0x3f'),_0x32fd('0x3a'))[_0x32fd('0x3d')]('NOW()',_0x32fd('0x3b'))[_0x32fd('0x40')]('cm_contacts')[_0x32fd('0x41')](_0x32fd('0x42'))[_0x32fd('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x32fd('0x48'),squel['str'](hopperContacts))[_0x32fd('0x41')](_0x32fd('0x4a')))[_0x32fd('0x3e')]();return _0x330b2e;}return db['VoiceQueue'][_0x32fd('0x4e')]({'where':{'type':_0x32fd('0x4f')},'attributes':['id',_0x32fd('0x50')],'include':[{'model':db['CmList'],'as':_0x32fd('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x205ba0){var _0x3063d3=[];if(_0x205ba0){var _0x407824;for(var _0x46720a=0x0,_0x32bebd;_0x46720a<_0x205ba0[_0x32fd('0x1a')];_0x46720a+=0x1){_0x32bebd=_0x205ba0[_0x46720a][_0x32fd('0x52')]({'plain':!![]});switch(_0x32bebd[_0x32fd('0x50')]){case _0x32fd('0x53'):_0x3063d3[_0x32fd('0x2e')](db[_0x32fd('0x54')][_0x32fd('0x55')](_0x4f650b(_0x32bebd,'VoiceQueueId'))[_0x32fd('0x2d')](function(){})[_0x32fd('0x30')](_0x2d61cf()));break;case _0x32fd('0x56'):_0x3063d3[_0x32fd('0x2e')](db[_0x32fd('0x54')][_0x32fd('0x55')](_0x5af040(_0x32bebd,_0x32fd('0x57')))[_0x32fd('0x2d')](function(){})['catch'](_0x2d61cf()));break;default:_0x3063d3[_0x32fd('0x2e')](db['sequelize'][_0x32fd('0x55')](_0x4f69ee(_0x32bebd,_0x32fd('0x57')))[_0x32fd('0x2d')](function(){})[_0x32fd('0x30')](_0x2d61cf()));}}}return _0x3063d3;})[_0x32fd('0x58')]()[_0x32fd('0x2d')](function(){return db[_0x32fd('0x59')][_0x32fd('0x4e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x32fd('0x5a'),'where':{'id':LISTID}}]})[_0x32fd('0x2d')](function(_0x2049cd){var _0x197646=[];if(_0x2049cd){var _0x3b5a11;for(var _0x189064=0x0,_0x39edf3;_0x189064<_0x2049cd[_0x32fd('0x1a')];_0x189064+=0x1){_0x39edf3=_0x2049cd[_0x189064][_0x32fd('0x52')]({'plain':!![]});_0x197646[_0x32fd('0x2e')](db['sequelize'][_0x32fd('0x55')](_0x324e08(_0x39edf3,_0x32fd('0x57')))[_0x32fd('0x2d')](function(){})['catch'](_0x2d61cf()));}}return _0x197646;})[_0x32fd('0x58')]();})[_0x32fd('0x2d')](function(){return db[_0x32fd('0x5b')][_0x32fd('0x4e')]({'attributes':['id',_0x32fd('0x50')],'include':[{'model':db[_0x32fd('0x5c')],'as':_0x32fd('0x51'),'where':{'id':LISTID}}]})[_0x32fd('0x2d')](function(_0x386030){var _0x524b18=[];if(_0x386030){for(var _0x4e0f1f=0x0,_0x4d687c;_0x4e0f1f<_0x386030[_0x32fd('0x1a')];_0x4e0f1f+=0x1){_0x4d687c=_0x386030[_0x4e0f1f][_0x32fd('0x52')]({'plain':!![]});switch(_0x4d687c['dialCheckDuplicateType']){case _0x32fd('0x53'):_0x524b18[_0x32fd('0x2e')](db[_0x32fd('0x54')]['query'](_0x4f650b(_0x4d687c,_0x32fd('0x5d')))[_0x32fd('0x2d')](function(){})[_0x32fd('0x30')](_0x2d61cf()));break;case _0x32fd('0x56'):_0x524b18[_0x32fd('0x2e')](db[_0x32fd('0x54')][_0x32fd('0x55')](_0x5af040(_0x4d687c,_0x32fd('0x5d')))[_0x32fd('0x2d')](function(){})[_0x32fd('0x30')](_0x2d61cf()));break;default:_0x524b18['push'](db[_0x32fd('0x54')][_0x32fd('0x55')](_0x4f69ee(_0x4d687c,_0x32fd('0x5d')))[_0x32fd('0x2d')](function(){})[_0x32fd('0x30')](_0x2d61cf()));}}}return _0x524b18;})['all']();})[_0x32fd('0x2d')](function(){return db[_0x32fd('0x5b')][_0x32fd('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x32fd('0x5c')],'as':_0x32fd('0x5a'),'where':{'id':LISTID}}]})[_0x32fd('0x2d')](function(_0x4f9569){var _0x44e1bf=[];if(_0x4f9569){for(var _0x5d743d=0x0,_0x249947;_0x5d743d<_0x4f9569[_0x32fd('0x1a')];_0x5d743d+=0x1){_0x249947=_0x4f9569[_0x5d743d][_0x32fd('0x52')]({'plain':!![]});_0x44e1bf[_0x32fd('0x2e')](db['sequelize'][_0x32fd('0x55')](_0x324e08(_0x249947,_0x32fd('0x5d')))[_0x32fd('0x2d')](function(){})[_0x32fd('0x30')](_0x2d61cf()));}}return _0x44e1bf;})['all']();})[_0x32fd('0x30')](function(_0x116569){logger[_0x32fd('0x17')](_0x32fd('0x5e'),_0x32fd('0x5f'),_0x116569[_0x32fd('0x60')]);});}var processPromises=function(_0x241292){return BPromise['all'](promises)[_0x32fd('0x2d')](function(_0x57710f){})[_0x32fd('0x30')](function(_0x4e9b20){logger[_0x32fd('0x17')](_0x32fd('0x61'),JSON[_0x32fd('0x32')](_0x4e9b20));})[_0x32fd('0x62')](function(){socket['emit'](_0x32fd('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x241292){return _0x241292[_0x32fd('0x64')]();}});};var endCsv=function(){return BPromise[_0x32fd('0x65')]()[_0x32fd('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x32fd('0x2d')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x32fd('0x66')](FILEPATH);}catch(_0x1f3f4d){logger['error'](_0x32fd('0x67'),JSON['stringify'](_0x1f3f4d));}finally{process[_0x32fd('0x68')](0x0);}});};process['on'](_0x32fd('0x69'),function(){logger[_0x32fd('0x6a')](_0x32fd('0x6b'));endCsv();});function main(){return BPromise[_0x32fd('0x65')]()[_0x32fd('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x32fd('0x11')](',');return db[_0x32fd('0x2a')][_0x32fd('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x32fd('0x2d')](function(_0x707ff0){var _0x2322eb=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x32fd('0x6c')](_0x2322eb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3922a4,_0x17a39a){total+=0x1;var _0x1c45f4=total;promises['push'](checkRow(_0x3922a4,_0x707ff0,_0x1c45f4)['then'](function(){success+=0x1;})[_0x32fd('0x30')](function(_0x206303){if(_0x206303[_0x32fd('0x17')]){errors+=0x1;delete _0x206303[_0x32fd('0x17')];}else if(_0x206303[_0x32fd('0x6d')]){duplicates+=0x1;delete _0x206303[_0x32fd('0x6d')];}rows[_0x32fd('0x2e')](_0x206303);}));if(total%0xc8===0x0){_0x17a39a[_0x32fd('0x6e')]();return processPromises(_0x17a39a);}},'complete':function(){return processPromises()[_0x32fd('0x2d')](function(){logger[_0x32fd('0x6a')](_0x32fd('0x6f'));endCsv();});},'error':function(_0x132606,_0x46419a){logger[_0x32fd('0x6a')](_0x32fd('0x70'),JSON[_0x32fd('0x32')](_0x132606));endCsv();}});})[_0x32fd('0x30')](function(_0x42248d){logger['error'](_0x32fd('0x71'),JSON[_0x32fd('0x32')](_0x42248d));});}main();
\ No newline at end of file
index 821b602..d2941e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68b3=['fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','createdAt','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','scheduledat','priority','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','code','sequelize','spread','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','catch','timezones','offset','dialTimezone','info','stringify','start','server/files/tmp','includes','header','name','_description','parse','rows','errors','data','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','itemTypeId','description','appendFileSync','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','root','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','push','all','length','then','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','ContactId','ListId','updatedAt','select'];(function(_0x148403,_0x419dac){var _0x2d3dfd=function(_0x47db43){while(--_0x47db43){_0x148403['push'](_0x148403['shift']());}};_0x2d3dfd(++_0x419dac);}(_0x68b3,0x1d8));var _0x368b=function(_0x28184b,_0x2031d0){_0x28184b=_0x28184b-0x0;var _0xf68df4=_0x68b3[_0x28184b];return _0xf68df4;};'use strict';var fs=require('fs');var path=require(_0x368b('0x0'));var _=require(_0x368b('0x1'));var Papa=require(_0x368b('0x2'));var util=require(_0x368b('0x3'));var BPromise=require(_0x368b('0x4'));var moment=require('moment');var squel=require(_0x368b('0x5'));var Redis=require(_0x368b('0x6'));var db=require(_0x368b('0x7'))['db'];var config=require(_0x368b('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x368b('0x9'))(_0x368b('0xa'));config[_0x368b('0xb')]=_[_0x368b('0xc')](config[_0x368b('0xb')],{'host':_0x368b('0xd'),'port':0x18eb});var socket=require(_0x368b('0xe'))(new Redis(config[_0x368b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x368b('0xf')](_0x368b('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x368b('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x160e12){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x368b('0x11')](_0x160e12);}function selectNotIn(_0x34a110,_0x51d513,_0x4463dc,_0x269cfc,_0x253e4b){return squel['select']()[_0x368b('0x12')](_0x368b('0x13'))['from'](_0x269cfc)[_0x368b('0x14')](_0x51d513,null,_0x51d513+_0x368b('0x15')+_0x269cfc+'.'+_0x4463dc)[_0x368b('0x16')](_0x269cfc+'.'+_0x4463dc+_0x368b('0x17')+_0x34a110+'.'+_0x4463dc)[_0x368b('0x16')](_0x51d513+'.dialCheckDuplicateType\x20IN\x20('+_0x253e4b[_0x368b('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x40faa0,_0x4ce41b){promisesAdditionalPhones=[];return db[_0x368b('0x18')][_0x368b('0x19')]({'raw':!![],'attributes':['id',_0x368b('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x220cd5){if(_0x220cd5!==null){var _0x392376=[];for(var _0x1f1029=0x0;_0x1f1029<_0x220cd5['length'];_0x1f1029++){var _0x102407=_0x220cd5[_0x1f1029];_0x392376[_0x368b('0x1b')](insertAdditionalPhones(_0x102407));}}Promise[_0x368b('0x1c')](_0x392376)['then'](function(){_0x40faa0({'val':0x1});});});});}function insertAdditionalPhones(_0x5d543e){return new Promise(function(_0x3e2e9f,_0x27d2a0){var _0x2c3cec=_0x5d543e[_0x368b('0x1a')];var _0x1a4f20=_0x2c3cec['split'](';');var _0x26447c=[];orderBy=0x0;for(var _0x44cfe6=0x0;_0x44cfe6<_0x1a4f20[_0x368b('0x1d')];_0x44cfe6++){_0x26447c[_0x368b('0x1b')](splitAdditionalPhone(_0x5d543e['id'],_0x1a4f20[_0x44cfe6]));}Promise[_0x368b('0x1c')](_0x26447c)[_0x368b('0x1e')](function(){_0x3e2e9f({'val':_0x1a4f20[_0x368b('0x1d')]});});});}function splitAdditionalPhone(_0x1d8066,_0x508e48){return new Promise(function(_0x13e750,_0x2f08d9){var _0x18869a=_0x508e48[_0x368b('0x1f')](':');var _0x286853=_0x18869a[0x0];var _0x4c2fca=_0x18869a[0x1];if(!_[_0x368b('0x20')](_0x4c2fca)){var _0x1ca429=_0x4c2fca[_0x368b('0x1f')]('|');var _0xafa856=[];for(var _0x77a269=0x0;_0x77a269<_0x1ca429[_0x368b('0x1d')];_0x77a269++){if(_0x1ca429[_0x77a269]!==''){var _0x430e16=_[_0x368b('0x21')](promisesAdditionalPhones,{'contactId':_0x1d8066,'phone':_0x1ca429[_0x77a269]});if(_0x430e16[_0x368b('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x368b('0x1b')]({'contactId':_0x1d8066,'contactTypeId':_0x286853,'phone':_0x1ca429[_0x77a269],'orderBy':orderBy});}}}_0x13e750({'ok':0x1});}else _0x13e750({'res':0x0});});}function createAdditionalPhone(_0x133c1b,_0x344d8a,_0xceec4b,_0x376e61){var _0x4636f4='';var _0x23a83a='';var _0x5dc5fa=_0xceec4b[_0x368b('0x1f')]('§');_0x4636f4=_0x5dc5fa[0x0];if(_0x5dc5fa[_0x368b('0x1d')]==0x2)_0x23a83a=_0x5dc5fa[0x1];return new Promise(function(_0x1e0e46,_0x2b036e){return db[_0x368b('0x22')][_0x368b('0x23')]({'where':{'CmContactId':_0x133c1b,'item':_0x4636f4}})[_0x368b('0x1e')](function(_0x5db0b4){if(_0x5db0b4){return db['CmContactHasItem'][_0x368b('0x24')]({'ItemTypeId':_0x344d8a,'description':_0x23a83a,'OrderBy':_0x376e61},{'where':{'CmContactId':_0x133c1b,'item':_0x4636f4}})[_0x368b('0x1e')](function(_0x3d1ceb){_0x1e0e46({'res':_0x368b('0x25')});});}else{return db['CmContactHasItem'][_0x368b('0x26')]({'CmContactId':_0x133c1b,'item':_0x4636f4,'description':_0x23a83a,'ItemTypeId':_0x344d8a,'OrderBy':_0x376e61,'ItemClass':_0x368b('0x27')})[_0x368b('0x1e')](function(_0x1c68ca){_0x1e0e46({'res':_0x368b('0x28')});});}});});}function insertCmHopper(_0x4d8410,_0x22ada9,_0x424fab,_0x239536,_0xd8187c){var _0x5d36d7=['cm_contacts.phone','cm_contacts.scheduledat',_0x368b('0x29'),_0x368b('0x2a'),_0x22ada9+'.'+_0x239536,_0x368b('0x2b'),_0x368b('0x2c'),_0x368b('0x2d'),'cm_contacts.UserId','\x22'+_0xd8187c+'\x22'];return squel[_0x368b('0x2e')]()[_0x368b('0x2f')]('cm_hopper')[_0x368b('0x30')]([_0x368b('0x13'),'scheduledat',_0x368b('0x31'),_0x368b('0x32'),_0x239536,'createdAt',_0x368b('0x33'),'priority','UserId','recallme'],squel[_0x368b('0x34')]()[_0x368b('0x35')](_0x5d36d7)[_0x368b('0x36')](_0x22ada9)[_0x368b('0x14')](_0x368b('0x37'),null,_0x368b('0x38')+_0x22ada9+_0x368b('0x39'))[_0x368b('0x14')](_0x424fab,null,_0x424fab+_0x368b('0x15')+_0x22ada9+'.'+_0x239536)[_0x368b('0x16')](_0x22ada9+'.CmListId\x20=\x20?',_0x4d8410)[_0x368b('0x16')](_0x368b('0x3a'),NOW)['where'](_0x368b('0x3b'),selectNotIn(_0x22ada9,_0x424fab,_0x239536,_0x368b('0x3c'),[_0x368b('0x3d'),_0x368b('0x3e')]))[_0x368b('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x22ada9,_0x424fab,_0x239536,_0x368b('0x3c'),[_0x368b('0x3d')])))[_0x368b('0x3f')]();}function insertCmHopperBlack(_0x3e0210,_0x4e44d0,_0x579cb3,_0x7ba60d){var _0x3d00f9=[_0x368b('0x40'),_0x368b('0x29'),_0x368b('0x2a'),_0x4e44d0+'.'+_0x7ba60d,_0x368b('0x2b'),_0x368b('0x2c')];return squel[_0x368b('0x2e')]()[_0x368b('0x2f')](_0x368b('0x41'))['fromQuery']([_0x368b('0x13'),_0x368b('0x31'),'ListId',_0x7ba60d,_0x368b('0x42'),_0x368b('0x33')],squel[_0x368b('0x34')]()[_0x368b('0x35')](_0x3d00f9)['from'](_0x4e44d0)[_0x368b('0x14')](_0x368b('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x4e44d0+_0x368b('0x39'))[_0x368b('0x14')](_0x579cb3,null,_0x579cb3+_0x368b('0x15')+_0x4e44d0+'.'+_0x7ba60d)['where'](_0x4e44d0+_0x368b('0x43'),_0x3e0210)[_0x368b('0x16')](_0x368b('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x368b('0x34')]()[_0x368b('0x12')]('phone')[_0x368b('0x36')](_0x368b('0x41'))[_0x368b('0x16')](_0x368b('0x44'),_0x3e0210)[_0x368b('0x16')](_0x7ba60d+_0x368b('0x17')+_0x4e44d0+'.'+_0x7ba60d)))[_0x368b('0x3f')]();}function insertTzCmHopper(_0x269cf5,_0x5db559,_0x33914c,_0x321a64,_0x432df9,_0xcaf3d0){var _0x540d7a=[_0x368b('0x40'),_0x368b('0x45')+_0xcaf3d0+_0x368b('0x46'),_0x368b('0x29'),_0x368b('0x2a'),_0x5db559+'.'+_0x321a64,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x368b('0x2d'),_0x368b('0x47'),'\x22'+_0x432df9+'\x22'];var _0x1c8755=squel['insert']()[_0x368b('0x2f')](_0x368b('0x3c'))[_0x368b('0x30')]([_0x368b('0x13'),_0x368b('0x48'),_0x368b('0x31'),_0x368b('0x32'),_0x321a64,_0x368b('0x42'),_0x368b('0x33'),_0x368b('0x49'),'UserId',_0x368b('0x4a')],squel['select']()[_0x368b('0x35')](_0x540d7a)['from'](_0x5db559)[_0x368b('0x14')]('cm_contacts',null,_0x368b('0x38')+_0x5db559+_0x368b('0x39'))[_0x368b('0x14')](_0x33914c,null,_0x33914c+_0x368b('0x15')+_0x5db559+'.'+_0x321a64)['join'](_0xcaf3d0,null,_0xcaf3d0+_0x368b('0x15')+_0x5db559+'.'+_0x321a64)[_0x368b('0x16')](_0x5db559+_0x368b('0x43'),_0x269cf5)[_0x368b('0x16')](_0x368b('0x3a'),NOW)[_0x368b('0x16')](_0x368b('0x3b'),selectNotIn(_0x5db559,_0x33914c,_0x321a64,_0x368b('0x3c'),[_0x368b('0x3d'),'\x22onlyIfOpen\x22']))[_0x368b('0x16')](_0x368b('0x3b'),selectNotIn(_0x5db559,_0x33914c,_0x321a64,_0x368b('0x3c'),[_0x368b('0x3d')])))[_0x368b('0x3f')]();return _0x1c8755;}function insertTzCmHopperBlack(_0x567301,_0x16492f,_0x1ddb6e,_0x8bee0d){var _0x3992f6=[_0x368b('0x40'),_0x368b('0x29'),_0x368b('0x2a'),_0x16492f+'.'+_0x8bee0d,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()['into'](_0x368b('0x41'))['fromQuery']([_0x368b('0x13'),_0x368b('0x31'),'ListId',_0x8bee0d,'createdAt',_0x368b('0x33')],squel['select']()[_0x368b('0x35')](_0x3992f6)[_0x368b('0x36')](_0x16492f)['join'](_0x368b('0x37'),null,_0x368b('0x38')+_0x16492f+'.CmListId')[_0x368b('0x14')](_0x1ddb6e,null,_0x1ddb6e+'.id\x20=\x20'+_0x16492f+'.'+_0x8bee0d)[_0x368b('0x16')](_0x16492f+_0x368b('0x43'),_0x567301)[_0x368b('0x16')](_0x368b('0x3a'),NOW)['where'](_0x368b('0x3b'),squel[_0x368b('0x34')]()[_0x368b('0x12')](_0x368b('0x13'))['from'](_0x368b('0x41'))['where'](_0x368b('0x44'),_0x567301)[_0x368b('0x16')](_0x8bee0d+'\x20=\x20'+_0x16492f+'.'+_0x8bee0d)))['toString']();}function insertCmHopperAdditionalPhones(_0x200420){var _0xeea586=[_0x368b('0x4b'),_0x368b('0x4c'),_0x368b('0x4d'),'cm_contact_has_items.createdAt',_0x368b('0x4e')];return squel[_0x368b('0x2e')]()['into'](_0x368b('0x4f'))[_0x368b('0x30')]([_0x368b('0x50'),_0x368b('0x13'),'OrderBy',_0x368b('0x42'),_0x368b('0x33')],squel[_0x368b('0x34')]()[_0x368b('0x35')](_0xeea586)['from']('cm_hopper')['join']('cm_contacts',null,_0x368b('0x51'))[_0x368b('0x14')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x200420)['where'](_0x368b('0x3a'),NOW))[_0x368b('0x3f')]();}function insertCmContact(_0xca4639,_0x5d5b4d,_0x1571ca,_0x4ecfa1){var _0x50296f=_[_0x368b('0x52')](_[_0x368b('0x53')](_0x4ecfa1),[_0x368b('0x32'),_0x368b('0x54'),'createdAt',_0x368b('0x33')]);return squel[_0x368b('0x2e')]()[_0x368b('0x2f')]('cm_contacts')[_0x368b('0x30')](_0x50296f,squel[_0x368b('0x34')]()['fields'](_0x50296f)[_0x368b('0x36')](_0x5d5b4d)[_0x368b('0x16')]('('+_0x1571ca['join'](',')+_0x368b('0x55'),squel['select']()[_0x368b('0x35')](_0x1571ca)[_0x368b('0x36')]('cm_contacts')[_0x368b('0x16')](_0x368b('0x44'),_0xca4639)[_0x368b('0x16')](_0x368b('0x56')))[_0x368b('0x16')]('id\x20IN\x20?',squel[_0x368b('0x34')]()[_0x368b('0x12')](_0x368b('0x57'),_0x368b('0x58'))[_0x368b('0x36')](_0x5d5b4d)[_0x368b('0x59')](_0x1571ca[_0x368b('0x14')](','))))[_0x368b('0x3f')]();}function handleStop(){logger['info'](_0x368b('0x5a'));stopped=!![];}function handleUncaughtException(_0x2e37a0){logger['error'](_0x2e37a0[_0x368b('0x5b')]);process[_0x368b('0x5c')](0x1);}function handleError(_0x2f94d3,_0x543ca3){stats['errors'][_0x368b('0x1b')]({'name':_0x543ca3[_0x368b('0x5d')],'message':_0x543ca3[_0x368b('0x5b')],'row':_0x2f94d3});}function handleQuery(_0xb7cef7){logger['info'](_0xb7cef7);return db[_0x368b('0x5e')]['query'](_0xb7cef7)[_0x368b('0x5f')](function(_0x2af914){results[_0x368b('0x1b')](_0x2af914);})['catch'](function(_0x23c349){logger[_0x368b('0x60')](_0x23c349[_0x368b('0x5b')]);});}function updateTzCampaigns(_0x4d6255){return new Promise(function(_0x51dffd,_0x594e85){var _0x7bca21=squel[_0x368b('0x34')]()[_0x368b('0x35')]([_0x368b('0x61'),_0x368b('0x62')])['from'](_0x368b('0x63'))[_0x368b('0x14')]('campaigns_has_cm_lists',null,_0x368b('0x64'))['where']('campaigns_has_cm_lists.CmListId='+_0x4d6255);db[_0x368b('0x5e')][_0x368b('0x65')](_0x7bca21[_0x368b('0x3f')]())[_0x368b('0x5f')](function(_0x2056ad){var _0x46703c=[];for(var _0x4921b0=0x0;_0x4921b0<_0x2056ad[_0x368b('0x1d')];_0x4921b0++){_0x46703c[_0x368b('0x1b')](getTimezoneData(_0x2056ad[_0x4921b0],tmp_campaigns));}BPromise[_0x368b('0x1c')](_0x46703c)['then'](function(){_0x51dffd({'val':0x1});});})['catch'](function(_0x5e8bf3){logger['error'](_0x5e8bf3[_0x368b('0x5b')]);_0x51dffd({'val':0x0});});});}function updateTzVoiceQueues(_0x51061c){return new Promise(function(_0x5ab241,_0x23a1d6){var _0xfd61c8=squel[_0x368b('0x34')]()[_0x368b('0x35')]([_0x368b('0x66'),_0x368b('0x67')])[_0x368b('0x36')](_0x368b('0x68'))['join'](_0x368b('0x69'),null,_0x368b('0x6a'))['where'](_0x368b('0x6b')+_0x51061c);db[_0x368b('0x5e')][_0x368b('0x65')](_0xfd61c8[_0x368b('0x3f')]())[_0x368b('0x5f')](function(_0xc0bd3f){var _0x1ac79c=[];for(var _0x41e848=0x0;_0x41e848<_0xc0bd3f[_0x368b('0x1d')];_0x41e848++){_0x1ac79c[_0x368b('0x1b')](getTimezoneData(_0xc0bd3f[_0x41e848],tmp_voice_queues));}BPromise[_0x368b('0x1c')](_0x1ac79c)[_0x368b('0x1e')](function(){_0x5ab241({'val':0x1});});})[_0x368b('0x6c')](function(_0x12a9a6){logger['error'](_0x12a9a6['message']);_0x5ab241({'val':0x0});});});}function getTimezoneData(_0x2a8eea,_0x2ba4d0){return new Promise(function(_0x31645e,_0x53be5c){var _0x208cbb=shared[_0x368b('0x6d')];var _0x2350b5=_0x208cbb[_0x2a8eea['dialTimezone']];if(_[_0x368b('0x20')](_0x2350b5)){_0x31645e({'ret':0x1});}else{var _0x308362=_0x2350b5['utcOffset'];var _0x235c63=squel[_0x368b('0x2e')]()[_0x368b('0x2f')](_0x2ba4d0)['set']('id',_0x2a8eea['id'])['set'](_0x368b('0x6e'),_0x308362)['set'](_0x368b('0x6f'),_0x2a8eea[_0x368b('0x6f')])[_0x368b('0x3f')]();return db[_0x368b('0x5e')]['query'](_0x235c63)[_0x368b('0x5f')](function(_0x1a35c9){_0x31645e({'ret':0x1});})[_0x368b('0x6c')](function(_0x54c95a){logger[_0x368b('0x60')](_0x54c95a[_0x368b('0x5b')]);_0x53be5c({'ret':0x1});});}});}function handleTZQuery(_0x109447){logger[_0x368b('0x70')](_0x109447);return db['sequelize'][_0x368b('0x65')](_0x109447)['spread'](function(_0x1740a6){})[_0x368b('0x6c')](function(_0x26164a){logger['error'](_0x26164a['message']);});}function main(_0x4bb209,_0x57435b,_0x221d92,_0x3146a9){logger['info']('main',_0x4bb209,JSON[_0x368b('0x71')](_0x57435b));process['send'](_0x368b('0x72'));var _0x1697e4=_0x57435b['binding'];var _0x11c5e2=_['clone'](_0x1697e4);var _0x1c214b=_0x57435b['socket_timestamp'];var _0x1dd4a7=path[_0x368b('0x14')](config['root'],_0x368b('0x73'),_0x1c214b+'.csv');hasTZ=_[_0x368b('0x53')](_0x1697e4)[_0x368b('0x74')]('dialTimezone');var _0x5be9f4=_[_0x368b('0x53')](_0x1697e4)['join']();logger['info'](_0x368b('0x75'),_0x5be9f4);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x37cef5){for(var _0x4a91da=0x0;_0x4a91da<_0x37cef5[_0x368b('0x1d')];_0x4a91da++){if(_0x37cef5[_0x4a91da][_0x368b('0x76')]in _0x1697e4){contactItemTypes['push'](_0x37cef5[_0x4a91da]);delete _0x11c5e2[_0x37cef5[_0x4a91da][_0x368b('0x76')]];hasAdditionalPhones=!![];}for(var _0x3f5e7b in _0x1697e4){if(_0x37cef5[_0x4a91da]['name']+_0x368b('0x77')===_0x3f5e7b){phoneDescriptions['push']({'itemTypeId':_0x37cef5[_0x4a91da]['id'],'description':_0x3f5e7b});delete _0x11c5e2[_0x3f5e7b];}}}if(hasAdditionalPhones)_0x11c5e2['AdditionalPhones']='';var _0x1f4043=_[_0x368b('0x53')](_0x11c5e2)['join']();logger[_0x368b('0x70')]('header',_0x1f4043);fs['writeFileSync'](_0x1dd4a7,_0x1f4043+'\x0a');Papa[_0x368b('0x78')](fs['createReadStream'](_0x4bb209),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb4049,_0x4944d3){try{for(var _0x483ea6=0x0,_0x43a5a6=[];_0x483ea6<_0xb4049['data'][_0x368b('0x1d')];_0x483ea6++){stats[_0x368b('0x79')]+=0x1;if(_0xb4049[_0x368b('0x7a')][_0x483ea6]){handleError(_0xb4049[_0x368b('0x7b')][_0x483ea6],_0xb4049[_0x368b('0x7a')][_0x483ea6]);}else{var _0x150a34=[];var _0x51b65f=[];var _0x54c18={};for(var _0x11ed4b in _0x1697e4){let _0x152108=contactItemTypes[_0x368b('0x7c')](_0x134e28=>_0x134e28['name']===_0x11ed4b);let _0x313462=contactItemTypes[_0x368b('0x7c')](_0x3672e6=>_0x3672e6[_0x368b('0x76')]+_0x368b('0x77')===_0x11ed4b);if(_[_0x368b('0x20')](_0x152108)&&_[_0x368b('0x20')](_0x313462)){if(_0x1697e4[_0x368b('0x7d')](_0x11ed4b)){if(_0xb4049[_0x368b('0x7b')][_0x483ea6][_0x1697e4[_0x11ed4b]]){var _0x381226=_[_0x368b('0x7e')](_0xb4049[_0x368b('0x7b')][_0x483ea6][_0x1697e4[_0x11ed4b]][_0x368b('0x7f')](/"/g,'\x27'));switch(_0x11ed4b){case'scheduledat':var _0x4136e6=moment(_0x381226,_0x368b('0x10'),!![]);if(_0x4136e6[_0x368b('0x80')]()){_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x381226+'\x22');}else{_0x150a34[_0x368b('0x1b')](_0x368b('0x81'));}break;case _0x368b('0x49'):var _0x1bbf12=parseInt(_0x381226);_0x381226=_[_0x368b('0x82')](_0x1bbf12)||_0x1bbf12<0x0||_0x1bbf12>0x4?_0x3146a9?0x3:0x2:_0x1bbf12;_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x381226+'\x22');break;case _0x368b('0x83'):var _0x13077c=parseInt(_0x381226);if(_[_0x368b('0x84')](_0x13077c)&&_['includes'](_0x221d92,_0x13077c)){_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x13077c+'\x22');}else{_0x150a34[_0x368b('0x1b')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x381226)){_0x43a5a6['push']('\x22'+_0x381226+'\x22');}else{_0x150a34[_0x368b('0x1b')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x177737=moment(_0x381226,_0x368b('0x85'),!![]);if(_0x177737[_0x368b('0x80')]()){_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x381226+'\x22');}else{_0x150a34['push'](_0x368b('0x86'));}break;case _0x368b('0x6f'):var _0x1c405c=shared[_0x368b('0x6d')];var _0x209cc9=_0x1c405c[_0x381226];if(!_[_0x368b('0x20')](_0x209cc9)){var _0x4c1a29=_0x209cc9[_0x368b('0x87')];_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x381226+'\x22');_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x4c1a29+'\x22');}break;default:_0x43a5a6[_0x368b('0x1b')]('\x22'+_0x381226+'\x22');}}else{switch(_0x11ed4b){case _0x368b('0x88'):case'phone':_0x150a34[_0x368b('0x1b')](_0x11ed4b+'\x20not\x20specified');break;default:_0x43a5a6[_0x368b('0x1b')]('\x22\x22');}}}}else{var _0x5e770f='';if(!_[_0x368b('0x20')](_0x152108)){if(!_0x54c18['hasOwnProperty'](_0x152108['id'])){if(!_[_0x368b('0x20')](_0xb4049['data'][_0x483ea6][_0x1697e4[_0x11ed4b]])){var _0x381226=_[_0x368b('0x7e')](_0xb4049['data'][_0x483ea6][_0x1697e4[_0x11ed4b]][_0x368b('0x7f')](/"/g,'\x27'));var _0x11a086=phoneDescriptions[_0x368b('0x7c')](_0x2d697e=>_0x2d697e[_0x368b('0x89')]===_0x152108['id']);if(!_[_0x368b('0x20')](_0x11a086)){var _0x31ad68=_[_0x368b('0x7e')](_0xb4049[_0x368b('0x7b')][_0x483ea6][_0x1697e4[_0x11a086[_0x368b('0x8a')]]][_0x368b('0x7f')](/"/g,'\x27'));if(!_[_0x368b('0x20')](_0x31ad68))_0x381226=_0x381226+'§'+_0x31ad68;}if(_0x5e770f=='')_0x5e770f=_0x381226;else _0x5e770f+='|'+_0x381226;}_0x51b65f[_0x368b('0x1b')](_0x152108['id']+':'+_0x5e770f);_0x54c18[_0x152108['id']]=0x1;}}}}if(hasAdditionalPhones){_0x43a5a6['push']('\x22'+_0x51b65f[_0x368b('0x14')](';')+'\x22');}if(_0x150a34['length']){handleError(_0xb4049[_0x368b('0x7b')][_0x483ea6],{'code':'SystemRow','message':_0x150a34[_0x368b('0x14')]()});}else{fs[_0x368b('0x8b')](_0x1dd4a7,_0x43a5a6[_0x368b('0x14')]()+'\x0a');}_0x43a5a6=[];}if(!(stats['rows']%0xc8)){socket[_0x368b('0x8c')](_0x368b('0x8d')+_0x1c214b,stats);stats[_0x368b('0x7a')]=[];}}if(stopped){logger[_0x368b('0x70')]('Abort\x20parser');_0x4944d3[_0x368b('0x8e')]();}}catch(_0x958f91){handleError(_0xb4049[_0x368b('0x7b')][_0x483ea6],{'code':_0x368b('0x8f'),'message':_0x958f91['message']});logger['error']('step',_0x958f91[_0x368b('0x5b')]);}},'complete':function(){try{var _0x3fde19=[];var _0x325d82=[];var _0xaf166a=_0x368b('0x37');if(_0x57435b[_0x368b('0x90')]&&_0x57435b[_0x368b('0x90')][_0x368b('0x1d')]){_0xaf166a=_0x368b('0x91')+_0x1c214b;_0x3fde19['push']('CREATE\x20TABLE\x20'+_0xaf166a+_0x368b('0x92'));}tmp_campaigns=_0x368b('0x93')+_0x1c214b;tmp_voice_queues=_0x368b('0x94')+_0x1c214b;_0x325d82[_0x368b('0x1b')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x325d82[_0x368b('0x1b')](_0x368b('0x95')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x368b('0x96')](_0x325d82,handleTZQuery)[_0x368b('0x1e')](function(_0xc93771){updateTzCampaigns(_0x57435b[_0x368b('0x32')])['then'](function(_0x33c54d){updateTzVoiceQueues(_0x57435b[_0x368b('0x32')])[_0x368b('0x1e')](function(_0x5243ac){if(hasTZ)_0x1f4043=_0x1f4043['replace'](_0x368b('0x6f'),'dialTimezone,utcOffset');var _0x24ad09=util[_0x368b('0xf')](_0x368b('0x97'),_0x1dd4a7,_0xaf166a,_0x1f4043,_0x57435b[_0x368b('0x32')],_0x57435b[_0x368b('0x54')]||null,NOW,NOW);if(_[_0x368b('0x20')](_0x1697e4[_0x368b('0x48')])){_0x24ad09+=_0x368b('0x98');}_0x3fde19[_0x368b('0x1b')](_0x24ad09);if(_0x57435b[_0x368b('0x90')]&&_0x57435b[_0x368b('0x90')]['length']){_0x3fde19[_0x368b('0x1b')](insertCmContact(_0x57435b[_0x368b('0x32')],_0xaf166a,_0x57435b[_0x368b('0x90')],_0x1697e4));_0x3fde19['push'](_0x368b('0x99')+_0xaf166a+';');}BPromise['each'](_0x3fde19,handleQuery)[_0x368b('0x1e')](function(_0xaf7e6b){BPromise['all']([handleAdditionalPhones()])[_0x368b('0x1e')](function(){_0x3fde19=[];for(var _0x44d285=0x0;_0x44d285<promisesAdditionalPhones[_0x368b('0x1d')];_0x44d285++){if(promisesAdditionalPhones[_0x44d285][_0x368b('0x13')]!='§'){_0x3fde19[_0x368b('0x1b')](createAdditionalPhone(promisesAdditionalPhones[_0x44d285][_0x368b('0x9a')],promisesAdditionalPhones[_0x44d285]['contactTypeId'],promisesAdditionalPhones[_0x44d285][_0x368b('0x13')],promisesAdditionalPhones[_0x44d285]['orderBy']));}}BPromise[_0x368b('0x1c')](_0x3fde19)[_0x368b('0x1e')](function(){_0x3fde19=[];if(hasTZ){_0x3fde19[_0x368b('0x1b')](insertTzCmHopper(_0x57435b['ListId'],_0x368b('0x69'),_0x368b('0x68'),_0x368b('0x9b'),_0x3146a9,tmp_voice_queues));_0x3fde19['push'](insertTzCmHopperBlack(_0x57435b[_0x368b('0x32')],_0x368b('0x9c'),_0x368b('0x68'),_0x368b('0x9b')));_0x3fde19[_0x368b('0x1b')](insertTzCmHopper(_0x57435b[_0x368b('0x32')],_0x368b('0x9d'),_0x368b('0x63'),_0x368b('0x9e'),_0x3146a9,tmp_campaigns));_0x3fde19[_0x368b('0x1b')](insertTzCmHopperBlack(_0x57435b[_0x368b('0x32')],'campaigns_has_cm_blacklists',_0x368b('0x63'),'CampaignId'));_0x3fde19[_0x368b('0x1b')](insertCmHopperAdditionalPhones(_0x57435b[_0x368b('0x32')]));}else{_0x3fde19[_0x368b('0x1b')](insertCmHopper(_0x57435b['ListId'],_0x368b('0x69'),'voice_queues',_0x368b('0x9b'),_0x3146a9));_0x3fde19[_0x368b('0x1b')](insertCmHopperBlack(_0x57435b[_0x368b('0x32')],_0x368b('0x9c'),_0x368b('0x68'),'VoiceQueueId'));_0x3fde19[_0x368b('0x1b')](insertCmHopper(_0x57435b[_0x368b('0x32')],_0x368b('0x9d'),_0x368b('0x63'),_0x368b('0x9e'),_0x3146a9));_0x3fde19[_0x368b('0x1b')](insertCmHopperBlack(_0x57435b['ListId'],'campaigns_has_cm_blacklists',_0x368b('0x63'),_0x368b('0x9e')));_0x3fde19[_0x368b('0x1b')](insertCmHopperAdditionalPhones(_0x57435b[_0x368b('0x32')]));}_0x3fde19[_0x368b('0x1b')](_0x368b('0x99')+tmp_campaigns+';');_0x3fde19['push']('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x368b('0x96')](_0x3fde19,handleQuery)[_0x368b('0x1e')](function(_0x554d27){stats[_0x368b('0x9f')]=!![];stats['affectedRows']=_0x57435b[_0x368b('0x90')]&&_0x57435b[_0x368b('0x90')][_0x368b('0x1d')]?results[0x2][_0x368b('0xa0')]:results[0x0][_0x368b('0xa0')];socket[_0x368b('0x8c')]('contact:import:'+_0x1c214b,stats);fs[_0x368b('0xa1')](_0x4bb209);fs['unlink'](_0x1dd4a7);process[_0x368b('0x5c')](0x0);})['catch'](function(_0x366162){logger['error'](_0x366162['message']);process[_0x368b('0x5c')](0x1);});});});})['catch'](function(_0x3cf66b){logger[_0x368b('0x60')](_0x3cf66b[_0x368b('0x5b')]);process[_0x368b('0x5c')](0x1);});});});});}catch(_0x2f2686){logger[_0x368b('0x60')](_0x368b('0xa2'),_0x2f2686[_0x368b('0x5b')]);process[_0x368b('0x5c')](0x1);}},'error':function(_0x1efe04,_0x3b84ec,_0xafb522,_0x21938a){throw new Error(_0x21938a);}});});}function validate(){if(process[_0x368b('0xa3')]&&process[_0x368b('0xa3')][_0x368b('0x1d')]<0x4){throw new Error(_0x368b('0xa4'));}var _0x185bb6=path['join'](config[_0x368b('0xa5')],'server/files/tmp',process[_0x368b('0xa3')][0x2]);if(!fs['existsSync'](_0x185bb6)){throw new Error(_0x368b('0xa6'));}var _0x19b677={};try{_0x19b677=JSON[_0x368b('0x78')](process['argv'][0x3]);if(!_0x19b677[_0x368b('0xa7')]){throw new Error(_0x368b('0xa8'));}if(!_0x19b677[_0x368b('0xa7')]['phone']){throw new Error(_0x368b('0xa9'));}if(!_0x19b677[_0x368b('0xa7')][_0x368b('0x88')]){throw new Error(_0x368b('0xaa'));}var _0x255666=0x0;if(_0x19b677['binding'][_0x368b('0x83')]){_0x255666=0x1;}if(!_0x19b677[_0x368b('0x32')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1eeb4e){throw new Error(_0x368b('0xab'));}var _0xccff5a=[];try{_0xccff5a=_[_0x368b('0xac')](JSON[_0x368b('0x78')](process[_0x368b('0xa3')][0x4]),'id');}catch(_0x1500a2){logger[_0x368b('0x70')](_0x368b('0xad'));}main(_0x185bb6,_0x19b677,_0xccff5a,_0x255666);}validate();process['on'](_0x368b('0xae'),handleStop);process['on']('uncaughtException',handleUncaughtException);
\ No newline at end of file
+var _0xfac3=['cm_hopper_black','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','.CmListId','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','main','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','name','_description','writeFileSync','parse','createReadStream','data','rows','errors','find','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','hasOwnProperty','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/logger','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','findAll','AdditionalPhones','then','length','all','split','push','isNil','CmContactHasItem','findOne','update','updated','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','.CmListId\x20=\x20?'];(function(_0x436625,_0x1a09d8){var _0x4cb48b=function(_0x4261e8){while(--_0x4261e8){_0x436625['push'](_0x436625['shift']());}};_0x4cb48b(++_0x1a09d8);}(_0xfac3,0x7b));var _0x3fac=function(_0x41377,_0xc313a7){_0x41377=_0x41377-0x0;var _0x2cf095=_0xfac3[_0x41377];return _0x2cf095;};'use strict';var fs=require('fs');var path=require(_0x3fac('0x0'));var _=require(_0x3fac('0x1'));var Papa=require('papaparse');var util=require(_0x3fac('0x2'));var BPromise=require(_0x3fac('0x3'));var moment=require(_0x3fac('0x4'));var squel=require(_0x3fac('0x5'));var Redis=require(_0x3fac('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x3fac('0x7'))('import');config[_0x3fac('0x8')]=_[_0x3fac('0x9')](config[_0x3fac('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fac('0xa'))(new Redis(config[_0x3fac('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x3fac('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x3fac('0xc')](_0x3fac('0xb'));function isEmail(_0x1f3df5){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x3fac('0xd')](_0x1f3df5);}function selectNotIn(_0x51f92a,_0x4af2dd,_0x2f99ab,_0x31f58d,_0x134f92){return squel[_0x3fac('0xe')]()[_0x3fac('0xf')](_0x3fac('0x10'))[_0x3fac('0x11')](_0x31f58d)['join'](_0x4af2dd,null,_0x4af2dd+_0x3fac('0x12')+_0x31f58d+'.'+_0x2f99ab)[_0x3fac('0x13')](_0x31f58d+'.'+_0x2f99ab+_0x3fac('0x14')+_0x51f92a+'.'+_0x2f99ab)['where'](_0x4af2dd+'.dialCheckDuplicateType\x20IN\x20('+_0x134f92[_0x3fac('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4f0420,_0x683d54){promisesAdditionalPhones=[];return db['CmContact'][_0x3fac('0x16')]({'raw':!![],'attributes':['id',_0x3fac('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x3fac('0x18')](function(_0x15f16a){if(_0x15f16a!==null){var _0x59a8ea=[];for(var _0x2c7db1=0x0;_0x2c7db1<_0x15f16a[_0x3fac('0x19')];_0x2c7db1++){var _0x1a5b1b=_0x15f16a[_0x2c7db1];_0x59a8ea['push'](insertAdditionalPhones(_0x1a5b1b));}}Promise[_0x3fac('0x1a')](_0x59a8ea)[_0x3fac('0x18')](function(){_0x4f0420({'val':0x1});});});});}function insertAdditionalPhones(_0x3266c1){return new Promise(function(_0xce6561,_0x19e538){var _0xa440ab=_0x3266c1[_0x3fac('0x17')];var _0x47571a=_0xa440ab[_0x3fac('0x1b')](';');var _0x33e07a=[];orderBy=0x0;for(var _0x2caed4=0x0;_0x2caed4<_0x47571a[_0x3fac('0x19')];_0x2caed4++){_0x33e07a[_0x3fac('0x1c')](splitAdditionalPhone(_0x3266c1['id'],_0x47571a[_0x2caed4]));}Promise[_0x3fac('0x1a')](_0x33e07a)['then'](function(){_0xce6561({'val':_0x47571a[_0x3fac('0x19')]});});});}function splitAdditionalPhone(_0x2dae58,_0x28d018){return new Promise(function(_0x4c9f19,_0x3d147b){var _0x2683ea=_0x28d018[_0x3fac('0x1b')](':');var _0x4ef561=_0x2683ea[0x0];var _0x4c9559=_0x2683ea[0x1];if(!_[_0x3fac('0x1d')](_0x4c9559)){var _0x4ca421=_0x4c9559['split']('|');var _0x55cf72=[];for(var _0x4905ec=0x0;_0x4905ec<_0x4ca421[_0x3fac('0x19')];_0x4905ec++){if(_0x4ca421[_0x4905ec]!==''){var _0x3bbce5=_['filter'](promisesAdditionalPhones,{'contactId':_0x2dae58,'phone':_0x4ca421[_0x4905ec]});if(_0x3bbce5[_0x3fac('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x3fac('0x1c')]({'contactId':_0x2dae58,'contactTypeId':_0x4ef561,'phone':_0x4ca421[_0x4905ec],'orderBy':orderBy});}}}_0x4c9f19({'ok':0x1});}else _0x4c9f19({'res':0x0});});}function createAdditionalPhone(_0x6dcf2e,_0x3e7dc7,_0x3fdcc0,_0x14a008){var _0x95047b='';var _0x5befeb='';var _0x1cf9de=_0x3fdcc0[_0x3fac('0x1b')]('§');_0x95047b=_0x1cf9de[0x0];if(_0x1cf9de[_0x3fac('0x19')]==0x2)_0x5befeb=_0x1cf9de[0x1];return new Promise(function(_0x2c1787,_0x30499d){return db[_0x3fac('0x1e')][_0x3fac('0x1f')]({'where':{'CmContactId':_0x6dcf2e,'item':_0x95047b}})[_0x3fac('0x18')](function(_0x40ce50){if(_0x40ce50){return db[_0x3fac('0x1e')][_0x3fac('0x20')]({'ItemTypeId':_0x3e7dc7,'description':_0x5befeb,'OrderBy':_0x14a008},{'where':{'CmContactId':_0x6dcf2e,'item':_0x95047b}})[_0x3fac('0x18')](function(_0x5be822){_0x2c1787({'res':_0x3fac('0x21')});});}else{return db[_0x3fac('0x1e')]['create']({'CmContactId':_0x6dcf2e,'item':_0x95047b,'description':_0x5befeb,'ItemTypeId':_0x3e7dc7,'OrderBy':_0x14a008,'ItemClass':_0x3fac('0x22')})[_0x3fac('0x18')](function(_0x174895){_0x2c1787({'res':'inserted'});});}});});}function insertCmHopper(_0x4f693e,_0x4ba1a7,_0x3887df,_0x9fbd21,_0x502a4e){var _0x2c5c28=[_0x3fac('0x23'),_0x3fac('0x24'),_0x3fac('0x25'),_0x3fac('0x26'),_0x4ba1a7+'.'+_0x9fbd21,'cm_contacts.createdAt',_0x3fac('0x27'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x502a4e+'\x22'];return squel[_0x3fac('0x28')]()[_0x3fac('0x29')](_0x3fac('0x2a'))[_0x3fac('0x2b')]([_0x3fac('0x10'),'scheduledat',_0x3fac('0x2c'),_0x3fac('0x2d'),_0x9fbd21,_0x3fac('0x2e'),_0x3fac('0x2f'),_0x3fac('0x30'),_0x3fac('0x31'),_0x3fac('0x32')],squel['select']()[_0x3fac('0x33')](_0x2c5c28)[_0x3fac('0x11')](_0x4ba1a7)[_0x3fac('0x15')](_0x3fac('0x34'),null,_0x3fac('0x35')+_0x4ba1a7+'.CmListId')[_0x3fac('0x15')](_0x3887df,null,_0x3887df+_0x3fac('0x12')+_0x4ba1a7+'.'+_0x9fbd21)[_0x3fac('0x13')](_0x4ba1a7+'.CmListId\x20=\x20?',_0x4f693e)[_0x3fac('0x13')](_0x3fac('0x36'),NOW)[_0x3fac('0x13')](_0x3fac('0x37'),selectNotIn(_0x4ba1a7,_0x3887df,_0x9fbd21,_0x3fac('0x2a'),[_0x3fac('0x38'),_0x3fac('0x39')]))[_0x3fac('0x13')](_0x3fac('0x37'),selectNotIn(_0x4ba1a7,_0x3887df,_0x9fbd21,_0x3fac('0x2a'),['\x22always\x22'])))[_0x3fac('0x3a')]();}function insertCmHopperBlack(_0x1f374c,_0x2285d2,_0x51422e,_0x4bd457){var _0x2e3e2b=[_0x3fac('0x23'),_0x3fac('0x25'),_0x3fac('0x26'),_0x2285d2+'.'+_0x4bd457,_0x3fac('0x3b'),_0x3fac('0x27')];return squel[_0x3fac('0x28')]()['into']('cm_hopper_black')[_0x3fac('0x2b')]([_0x3fac('0x10'),'ContactId',_0x3fac('0x2d'),_0x4bd457,_0x3fac('0x2e'),_0x3fac('0x2f')],squel[_0x3fac('0xe')]()['fields'](_0x2e3e2b)['from'](_0x2285d2)['join'](_0x3fac('0x34'),null,_0x3fac('0x35')+_0x2285d2+'.CmListId')[_0x3fac('0x15')](_0x51422e,null,_0x51422e+'.id\x20=\x20'+_0x2285d2+'.'+_0x4bd457)[_0x3fac('0x13')](_0x2285d2+_0x3fac('0x3c'),_0x1f374c)['where'](_0x3fac('0x36'),NOW)[_0x3fac('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x3fac('0xe')]()[_0x3fac('0xf')](_0x3fac('0x10'))['from'](_0x3fac('0x3d'))[_0x3fac('0x13')](_0x3fac('0x3e'),_0x1f374c)[_0x3fac('0x13')](_0x4bd457+_0x3fac('0x14')+_0x2285d2+'.'+_0x4bd457)))[_0x3fac('0x3a')]();}function insertTzCmHopper(_0x2bad3c,_0xcf6924,_0x226866,_0xf8d261,_0x27d682,_0x5a6834){var _0x48efb2=[_0x3fac('0x23'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x5a6834+_0x3fac('0x3f'),'cm_contacts.id',_0x3fac('0x26'),_0xcf6924+'.'+_0xf8d261,'cm_contacts.createdAt',_0x3fac('0x27'),'cm_contacts.priority',_0x3fac('0x40'),'\x22'+_0x27d682+'\x22'];var _0x59cd62=squel[_0x3fac('0x28')]()[_0x3fac('0x29')](_0x3fac('0x2a'))[_0x3fac('0x2b')](['phone','scheduledat',_0x3fac('0x2c'),_0x3fac('0x2d'),_0xf8d261,'createdAt',_0x3fac('0x2f'),_0x3fac('0x30'),_0x3fac('0x31'),_0x3fac('0x32')],squel['select']()[_0x3fac('0x33')](_0x48efb2)[_0x3fac('0x11')](_0xcf6924)[_0x3fac('0x15')](_0x3fac('0x34'),null,_0x3fac('0x35')+_0xcf6924+_0x3fac('0x41'))[_0x3fac('0x15')](_0x226866,null,_0x226866+_0x3fac('0x12')+_0xcf6924+'.'+_0xf8d261)['join'](_0x5a6834,null,_0x5a6834+_0x3fac('0x12')+_0xcf6924+'.'+_0xf8d261)['where'](_0xcf6924+_0x3fac('0x3c'),_0x2bad3c)[_0x3fac('0x13')](_0x3fac('0x36'),NOW)[_0x3fac('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcf6924,_0x226866,_0xf8d261,'cm_hopper',[_0x3fac('0x38'),_0x3fac('0x39')]))[_0x3fac('0x13')](_0x3fac('0x37'),selectNotIn(_0xcf6924,_0x226866,_0xf8d261,_0x3fac('0x2a'),[_0x3fac('0x38')])))[_0x3fac('0x3a')]();return _0x59cd62;}function insertTzCmHopperBlack(_0x2338a3,_0x44f0a7,_0x403049,_0x1230af){var _0x2675b3=[_0x3fac('0x23'),'cm_contacts.id','cm_contacts.ListId',_0x44f0a7+'.'+_0x1230af,_0x3fac('0x3b'),_0x3fac('0x27')];return squel[_0x3fac('0x28')]()[_0x3fac('0x29')]('cm_hopper_black')[_0x3fac('0x2b')](['phone',_0x3fac('0x2c'),'ListId',_0x1230af,'createdAt',_0x3fac('0x2f')],squel[_0x3fac('0xe')]()['fields'](_0x2675b3)['from'](_0x44f0a7)[_0x3fac('0x15')](_0x3fac('0x34'),null,_0x3fac('0x35')+_0x44f0a7+'.CmListId')[_0x3fac('0x15')](_0x403049,null,_0x403049+'.id\x20=\x20'+_0x44f0a7+'.'+_0x1230af)[_0x3fac('0x13')](_0x44f0a7+'.CmListId\x20=\x20?',_0x2338a3)[_0x3fac('0x13')](_0x3fac('0x36'),NOW)['where'](_0x3fac('0x37'),squel['select']()[_0x3fac('0xf')](_0x3fac('0x10'))[_0x3fac('0x11')](_0x3fac('0x3d'))[_0x3fac('0x13')](_0x3fac('0x3e'),_0x2338a3)[_0x3fac('0x13')](_0x1230af+'\x20=\x20'+_0x44f0a7+'.'+_0x1230af)))[_0x3fac('0x3a')]();}function insertCmHopperAdditionalPhones(_0x59e2fe){var _0x12f93f=[_0x3fac('0x42'),'cm_contact_has_items.item',_0x3fac('0x43'),'cm_contact_has_items.createdAt',_0x3fac('0x44')];return squel[_0x3fac('0x28')]()[_0x3fac('0x29')]('cm_hopper_additional_phones')[_0x3fac('0x2b')](['CmHopperId','phone',_0x3fac('0x45'),_0x3fac('0x2e'),_0x3fac('0x2f')],squel[_0x3fac('0xe')]()[_0x3fac('0x33')](_0x12f93f)[_0x3fac('0x11')](_0x3fac('0x2a'))[_0x3fac('0x15')](_0x3fac('0x34'),null,_0x3fac('0x46'))[_0x3fac('0x15')](_0x3fac('0x47'),null,_0x3fac('0x48'))[_0x3fac('0x13')](_0x3fac('0x49'),_0x59e2fe)[_0x3fac('0x13')](_0x3fac('0x36'),NOW))[_0x3fac('0x3a')]();}function insertCmContact(_0x1e31cc,_0x13774d,_0x4fd167,_0x4a5223){var _0x5c58e1=_[_0x3fac('0x4a')](_[_0x3fac('0x4b')](_0x4a5223),[_0x3fac('0x2d'),_0x3fac('0x4c'),'createdAt',_0x3fac('0x2f')]);return squel[_0x3fac('0x28')]()[_0x3fac('0x29')](_0x3fac('0x34'))[_0x3fac('0x2b')](_0x5c58e1,squel[_0x3fac('0xe')]()[_0x3fac('0x33')](_0x5c58e1)['from'](_0x13774d)[_0x3fac('0x13')]('('+_0x4fd167[_0x3fac('0x15')](',')+_0x3fac('0x4d'),squel['select']()[_0x3fac('0x33')](_0x4fd167)[_0x3fac('0x11')](_0x3fac('0x34'))[_0x3fac('0x13')](_0x3fac('0x3e'),_0x1e31cc)[_0x3fac('0x13')](_0x3fac('0x4e')))['where'](_0x3fac('0x4f'),squel['select']()[_0x3fac('0xf')](_0x3fac('0x50'),_0x3fac('0x51'))[_0x3fac('0x11')](_0x13774d)[_0x3fac('0x52')](_0x4fd167[_0x3fac('0x15')](','))))[_0x3fac('0x3a')]();}function handleStop(){logger[_0x3fac('0x53')](_0x3fac('0x54'));stopped=!![];}function handleUncaughtException(_0x4b8ffb){logger[_0x3fac('0x55')](_0x4b8ffb[_0x3fac('0x56')]);process[_0x3fac('0x57')](0x1);}function handleError(_0x2cc1cd,_0x74335d){stats['errors'][_0x3fac('0x1c')]({'name':_0x74335d[_0x3fac('0x58')],'message':_0x74335d[_0x3fac('0x56')],'row':_0x2cc1cd});}function handleQuery(_0x900d71){logger[_0x3fac('0x53')](_0x900d71);return db[_0x3fac('0x59')][_0x3fac('0x5a')](_0x900d71)[_0x3fac('0x5b')](function(_0x36a2cf){results[_0x3fac('0x1c')](_0x36a2cf);})[_0x3fac('0x5c')](function(_0x4ba27b){logger[_0x3fac('0x55')](_0x4ba27b['message']);});}function updateTzCampaigns(_0x269020){return new Promise(function(_0x3d246d,_0x5b20b0){var _0x39d08a=squel[_0x3fac('0xe')]()[_0x3fac('0x33')]([_0x3fac('0x5d'),_0x3fac('0x5e')])['from']('campaigns')[_0x3fac('0x15')](_0x3fac('0x5f'),null,_0x3fac('0x60'))[_0x3fac('0x13')](_0x3fac('0x61')+_0x269020);db[_0x3fac('0x59')]['query'](_0x39d08a['toString']())['spread'](function(_0x4ef415){var _0xb76145=[];for(var _0x201692=0x0;_0x201692<_0x4ef415['length'];_0x201692++){_0xb76145[_0x3fac('0x1c')](getTimezoneData(_0x4ef415[_0x201692],tmp_campaigns));}BPromise[_0x3fac('0x1a')](_0xb76145)[_0x3fac('0x18')](function(){_0x3d246d({'val':0x1});});})[_0x3fac('0x5c')](function(_0x5cc126){logger[_0x3fac('0x55')](_0x5cc126[_0x3fac('0x56')]);_0x3d246d({'val':0x0});});});}function updateTzVoiceQueues(_0x76bc){return new Promise(function(_0x10ef56,_0x5753c4){var _0x162b89=squel[_0x3fac('0xe')]()[_0x3fac('0x33')]([_0x3fac('0x62'),_0x3fac('0x63')])[_0x3fac('0x11')](_0x3fac('0x64'))[_0x3fac('0x15')](_0x3fac('0x65'),null,_0x3fac('0x66'))['where']('voice_queues_has_cm_lists.CmListId='+_0x76bc);db[_0x3fac('0x59')][_0x3fac('0x5a')](_0x162b89['toString']())[_0x3fac('0x5b')](function(_0x17eb36){var _0x2f13f4=[];for(var _0x251465=0x0;_0x251465<_0x17eb36[_0x3fac('0x19')];_0x251465++){_0x2f13f4[_0x3fac('0x1c')](getTimezoneData(_0x17eb36[_0x251465],tmp_voice_queues));}BPromise[_0x3fac('0x1a')](_0x2f13f4)[_0x3fac('0x18')](function(){_0x10ef56({'val':0x1});});})['catch'](function(_0x3b7a42){logger[_0x3fac('0x55')](_0x3b7a42['message']);_0x10ef56({'val':0x0});});});}function getTimezoneData(_0x1662c1,_0x434e32){return new Promise(function(_0x7979b5,_0x2a2002){var _0x1c60a1=shared[_0x3fac('0x67')];var _0x4fd308=_0x1c60a1[_0x1662c1[_0x3fac('0x68')]];if(_[_0x3fac('0x1d')](_0x4fd308)){_0x7979b5({'ret':0x1});}else{var _0x5a19da=_0x4fd308[_0x3fac('0x69')];var _0x7d5443=squel[_0x3fac('0x28')]()[_0x3fac('0x29')](_0x434e32)[_0x3fac('0x6a')]('id',_0x1662c1['id'])['set']('offset',_0x5a19da)[_0x3fac('0x6a')](_0x3fac('0x68'),_0x1662c1[_0x3fac('0x68')])[_0x3fac('0x3a')]();return db[_0x3fac('0x59')][_0x3fac('0x5a')](_0x7d5443)[_0x3fac('0x5b')](function(_0x20e0ba){_0x7979b5({'ret':0x1});})[_0x3fac('0x5c')](function(_0x455b14){logger[_0x3fac('0x55')](_0x455b14[_0x3fac('0x56')]);_0x2a2002({'ret':0x1});});}});}function handleTZQuery(_0x31b39d){logger['info'](_0x31b39d);return db['sequelize'][_0x3fac('0x5a')](_0x31b39d)[_0x3fac('0x5b')](function(_0x42d8bb){})[_0x3fac('0x5c')](function(_0x3f1ab5){logger['error'](_0x3f1ab5[_0x3fac('0x56')]);});}function main(_0x4708cf,_0x22bf77,_0x1885d8,_0x561aee){logger[_0x3fac('0x53')](_0x3fac('0x6b'),_0x4708cf,JSON['stringify'](_0x22bf77));process[_0x3fac('0x6c')](_0x3fac('0x6d'));var _0x5accfc=_0x22bf77[_0x3fac('0x6e')];var _0x5da857=_[_0x3fac('0x6f')](_0x5accfc);var _0xdff13d=_0x22bf77[_0x3fac('0x70')];var _0x47f9a9=path[_0x3fac('0x15')](config[_0x3fac('0x71')],_0x3fac('0x72'),_0xdff13d+_0x3fac('0x73'));hasTZ=_['keys'](_0x5accfc)[_0x3fac('0x74')]('dialTimezone');var _0x33557d=_['keys'](_0x5accfc)[_0x3fac('0x15')]();logger[_0x3fac('0x53')](_0x3fac('0x75'),_0x33557d);db['ContactItemType'][_0x3fac('0x16')]({'raw':!![],'attributes':['id',_0x3fac('0x76')]})['then'](function(_0x25f86c){for(var _0xdab322=0x0;_0xdab322<_0x25f86c['length'];_0xdab322++){if(_0x25f86c[_0xdab322][_0x3fac('0x76')]in _0x5accfc){contactItemTypes[_0x3fac('0x1c')](_0x25f86c[_0xdab322]);delete _0x5da857[_0x25f86c[_0xdab322]['name']];hasAdditionalPhones=!![];}for(var _0x5e11e1 in _0x5accfc){if(_0x25f86c[_0xdab322][_0x3fac('0x76')]+_0x3fac('0x77')===_0x5e11e1){phoneDescriptions[_0x3fac('0x1c')]({'itemTypeId':_0x25f86c[_0xdab322]['id'],'description':_0x5e11e1});delete _0x5da857[_0x5e11e1];}}}if(hasAdditionalPhones)_0x5da857[_0x3fac('0x17')]='';var _0x4b0096=_['keys'](_0x5da857)[_0x3fac('0x15')]();logger[_0x3fac('0x53')](_0x3fac('0x75'),_0x4b0096);fs[_0x3fac('0x78')](_0x47f9a9,_0x4b0096+'\x0a');Papa[_0x3fac('0x79')](fs[_0x3fac('0x7a')](_0x4708cf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x185db3,_0x5a16b1){try{for(var _0x22f5ac=0x0,_0x1250e6=[];_0x22f5ac<_0x185db3[_0x3fac('0x7b')][_0x3fac('0x19')];_0x22f5ac++){stats[_0x3fac('0x7c')]+=0x1;if(_0x185db3[_0x3fac('0x7d')][_0x22f5ac]){handleError(_0x185db3[_0x3fac('0x7b')][_0x22f5ac],_0x185db3[_0x3fac('0x7d')][_0x22f5ac]);}else{var _0x204a1d=[];var _0x52ee95=[];var _0x329f3={};for(var _0x58f384 in _0x5accfc){let _0x1309f0=contactItemTypes[_0x3fac('0x7e')](_0x317262=>_0x317262[_0x3fac('0x76')]===_0x58f384);let _0x3794ba=contactItemTypes[_0x3fac('0x7e')](_0x524356=>_0x524356[_0x3fac('0x76')]+_0x3fac('0x77')===_0x58f384);if(_[_0x3fac('0x1d')](_0x1309f0)&&_[_0x3fac('0x1d')](_0x3794ba)){if(_0x5accfc['hasOwnProperty'](_0x58f384)){if(_0x185db3[_0x3fac('0x7b')][_0x22f5ac][_0x5accfc[_0x58f384]]){var _0x194ebe=_['trim'](_0x185db3['data'][_0x22f5ac][_0x5accfc[_0x58f384]][_0x3fac('0x7f')](/"/g,'\x27'));switch(_0x58f384){case _0x3fac('0x80'):var _0x197ed7=moment(_0x194ebe,_0x3fac('0xb'),!![]);if(_0x197ed7['isValid']()){_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x194ebe+'\x22');}else{_0x204a1d[_0x3fac('0x1c')](_0x3fac('0x81'));}break;case _0x3fac('0x30'):var _0x2da53a=parseInt(_0x194ebe);_0x194ebe=_[_0x3fac('0x82')](_0x2da53a)||_0x2da53a<0x0||_0x2da53a>0x4?_0x561aee?0x3:0x2:_0x2da53a;_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x194ebe+'\x22');break;case _0x3fac('0x31'):var _0x29c95a=parseInt(_0x194ebe);if(_[_0x3fac('0x83')](_0x29c95a)&&_[_0x3fac('0x74')](_0x1885d8,_0x29c95a)){_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x29c95a+'\x22');}else{_0x204a1d[_0x3fac('0x1c')](_0x3fac('0x84'));}break;case _0x3fac('0x85'):if(isEmail(_0x194ebe)){_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x194ebe+'\x22');}else{_0x204a1d['push'](_0x3fac('0x86'));}break;case _0x3fac('0x87'):var _0x4d93ad=moment(_0x194ebe,_0x3fac('0x88'),!![]);if(_0x4d93ad['isValid']()){_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x194ebe+'\x22');}else{_0x204a1d[_0x3fac('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x2a6a3e=shared[_0x3fac('0x67')];var _0x1c7c55=_0x2a6a3e[_0x194ebe];if(!_[_0x3fac('0x1d')](_0x1c7c55)){var _0x11d9ae=_0x1c7c55[_0x3fac('0x69')];_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x194ebe+'\x22');_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x11d9ae+'\x22');}break;default:_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x194ebe+'\x22');}}else{switch(_0x58f384){case'firstName':case _0x3fac('0x10'):_0x204a1d[_0x3fac('0x1c')](_0x58f384+_0x3fac('0x89'));break;default:_0x1250e6['push']('\x22\x22');}}}}else{var _0x4ea229='';if(!_[_0x3fac('0x1d')](_0x1309f0)){if(!_0x329f3[_0x3fac('0x8a')](_0x1309f0['id'])){if(!_['isNil'](_0x185db3[_0x3fac('0x7b')][_0x22f5ac][_0x5accfc[_0x58f384]])){var _0x194ebe=_[_0x3fac('0x8b')](_0x185db3['data'][_0x22f5ac][_0x5accfc[_0x58f384]]['replace'](/"/g,'\x27'));var _0x4894c1=phoneDescriptions[_0x3fac('0x7e')](_0x5b5b83=>_0x5b5b83[_0x3fac('0x8c')]===_0x1309f0['id']);if(!_[_0x3fac('0x1d')](_0x4894c1)){var _0x39a912=_[_0x3fac('0x8b')](_0x185db3[_0x3fac('0x7b')][_0x22f5ac][_0x5accfc[_0x4894c1[_0x3fac('0x8d')]]][_0x3fac('0x7f')](/"/g,'\x27'));if(!_[_0x3fac('0x1d')](_0x39a912))_0x194ebe=_0x194ebe+'§'+_0x39a912;}if(_0x4ea229=='')_0x4ea229=_0x194ebe;else _0x4ea229+='|'+_0x194ebe;}_0x52ee95[_0x3fac('0x1c')](_0x1309f0['id']+':'+_0x4ea229);_0x329f3[_0x1309f0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1250e6[_0x3fac('0x1c')]('\x22'+_0x52ee95[_0x3fac('0x15')](';')+'\x22');}if(_0x204a1d[_0x3fac('0x19')]){handleError(_0x185db3[_0x3fac('0x7b')][_0x22f5ac],{'code':_0x3fac('0x8e'),'message':_0x204a1d['join']()});}else{fs[_0x3fac('0x8f')](_0x47f9a9,_0x1250e6[_0x3fac('0x15')]()+'\x0a');}_0x1250e6=[];}if(!(stats[_0x3fac('0x7c')]%0xc8)){socket[_0x3fac('0x90')](_0x3fac('0x91')+_0xdff13d,stats);stats['errors']=[];}}if(stopped){logger[_0x3fac('0x53')](_0x3fac('0x92'));_0x5a16b1[_0x3fac('0x93')]();}}catch(_0x152b0c){handleError(_0x185db3[_0x3fac('0x7b')][_0x22f5ac],{'code':_0x3fac('0x94'),'message':_0x152b0c['message']});logger[_0x3fac('0x55')]('step',_0x152b0c[_0x3fac('0x56')]);}},'complete':function(){try{var _0x342747=[];var _0x1522f0=[];var _0x54db0d='cm_contacts';if(_0x22bf77['duplicates']&&_0x22bf77['duplicates']['length']){_0x54db0d=_0x3fac('0x95')+_0xdff13d;_0x342747[_0x3fac('0x1c')](_0x3fac('0x96')+_0x54db0d+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x3fac('0x97')+_0xdff13d;tmp_voice_queues=_0x3fac('0x98')+_0xdff13d;_0x1522f0[_0x3fac('0x1c')](_0x3fac('0x96')+tmp_campaigns+_0x3fac('0x99'));_0x1522f0[_0x3fac('0x1c')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x3fac('0x99'));BPromise[_0x3fac('0x9a')](_0x1522f0,handleTZQuery)[_0x3fac('0x18')](function(_0x26c3ba){updateTzCampaigns(_0x22bf77[_0x3fac('0x2d')])[_0x3fac('0x18')](function(_0x282861){updateTzVoiceQueues(_0x22bf77[_0x3fac('0x2d')])[_0x3fac('0x18')](function(_0x4863ab){if(hasTZ)_0x4b0096=_0x4b0096['replace'](_0x3fac('0x68'),_0x3fac('0x9b'));var _0x5c1de6=util[_0x3fac('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x47f9a9,_0x54db0d,_0x4b0096,_0x22bf77[_0x3fac('0x2d')],_0x22bf77['CompanyId']||null,NOW,NOW);if(_[_0x3fac('0x1d')](_0x5accfc['scheduledat'])){_0x5c1de6+=_0x3fac('0x9c');}_0x342747[_0x3fac('0x1c')](_0x5c1de6);if(_0x22bf77[_0x3fac('0x9d')]&&_0x22bf77['duplicates'][_0x3fac('0x19')]){_0x342747[_0x3fac('0x1c')](insertCmContact(_0x22bf77[_0x3fac('0x2d')],_0x54db0d,_0x22bf77[_0x3fac('0x9d')],_0x5accfc));_0x342747[_0x3fac('0x1c')](_0x3fac('0x9e')+_0x54db0d+';');}BPromise[_0x3fac('0x9a')](_0x342747,handleQuery)['then'](function(_0x926a77){BPromise[_0x3fac('0x1a')]([handleAdditionalPhones()])[_0x3fac('0x18')](function(){_0x342747=[];for(var _0x2cbd5b=0x0;_0x2cbd5b<promisesAdditionalPhones[_0x3fac('0x19')];_0x2cbd5b++){if(promisesAdditionalPhones[_0x2cbd5b]['phone']!='§'){_0x342747[_0x3fac('0x1c')](createAdditionalPhone(promisesAdditionalPhones[_0x2cbd5b][_0x3fac('0x9f')],promisesAdditionalPhones[_0x2cbd5b][_0x3fac('0xa0')],promisesAdditionalPhones[_0x2cbd5b][_0x3fac('0x10')],promisesAdditionalPhones[_0x2cbd5b][_0x3fac('0xa1')]));}}BPromise[_0x3fac('0x1a')](_0x342747)['then'](function(){_0x342747=[];if(hasTZ){_0x342747[_0x3fac('0x1c')](insertTzCmHopper(_0x22bf77[_0x3fac('0x2d')],_0x3fac('0x65'),_0x3fac('0x64'),_0x3fac('0xa2'),_0x561aee,tmp_voice_queues));_0x342747['push'](insertTzCmHopperBlack(_0x22bf77[_0x3fac('0x2d')],'voice_queues_has_cm_blacklists',_0x3fac('0x64'),'VoiceQueueId'));_0x342747[_0x3fac('0x1c')](insertTzCmHopper(_0x22bf77['ListId'],_0x3fac('0x5f'),'campaigns',_0x3fac('0xa3'),_0x561aee,tmp_campaigns));_0x342747[_0x3fac('0x1c')](insertTzCmHopperBlack(_0x22bf77[_0x3fac('0x2d')],_0x3fac('0xa4'),'campaigns',_0x3fac('0xa3')));_0x342747[_0x3fac('0x1c')](insertCmHopperAdditionalPhones(_0x22bf77[_0x3fac('0x2d')]));}else{_0x342747[_0x3fac('0x1c')](insertCmHopper(_0x22bf77[_0x3fac('0x2d')],'voice_queues_has_cm_lists',_0x3fac('0x64'),'VoiceQueueId',_0x561aee));_0x342747[_0x3fac('0x1c')](insertCmHopperBlack(_0x22bf77['ListId'],_0x3fac('0xa5'),'voice_queues',_0x3fac('0xa2')));_0x342747[_0x3fac('0x1c')](insertCmHopper(_0x22bf77['ListId'],'campaigns_has_cm_lists','campaigns',_0x3fac('0xa3'),_0x561aee));_0x342747[_0x3fac('0x1c')](insertCmHopperBlack(_0x22bf77[_0x3fac('0x2d')],'campaigns_has_cm_blacklists',_0x3fac('0xa6'),_0x3fac('0xa3')));_0x342747['push'](insertCmHopperAdditionalPhones(_0x22bf77['ListId']));}_0x342747[_0x3fac('0x1c')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x342747[_0x3fac('0x1c')](_0x3fac('0x9e')+tmp_voice_queues+';');BPromise[_0x3fac('0x9a')](_0x342747,handleQuery)[_0x3fac('0x18')](function(_0x3c100f){stats[_0x3fac('0xa7')]=!![];stats['affectedRows']=_0x22bf77[_0x3fac('0x9d')]&&_0x22bf77[_0x3fac('0x9d')]['length']?results[0x2][_0x3fac('0xa8')]:results[0x0]['affectedRows'];socket[_0x3fac('0x90')](_0x3fac('0x91')+_0xdff13d,stats);fs['unlink'](_0x4708cf);fs[_0x3fac('0xa9')](_0x47f9a9);process['exit'](0x0);})[_0x3fac('0x5c')](function(_0x2a6bf3){logger['error'](_0x2a6bf3[_0x3fac('0x56')]);process[_0x3fac('0x57')](0x1);});});});})[_0x3fac('0x5c')](function(_0x24e01f){logger['error'](_0x24e01f[_0x3fac('0x56')]);process[_0x3fac('0x57')](0x1);});});});});}catch(_0xccfac9){logger[_0x3fac('0x55')](_0x3fac('0xaa'),_0xccfac9[_0x3fac('0x56')]);process[_0x3fac('0x57')](0x1);}},'error':function(_0x2b40f4,_0x1818c3,_0x29d2a0,_0x361ce5){throw new Error(_0x361ce5);}});});}function validate(){if(process[_0x3fac('0xab')]&&process[_0x3fac('0xab')][_0x3fac('0x19')]<0x4){throw new Error(_0x3fac('0xac'));}var _0x50d7ce=path['join'](config[_0x3fac('0x71')],_0x3fac('0x72'),process['argv'][0x2]);if(!fs[_0x3fac('0xad')](_0x50d7ce)){throw new Error(_0x3fac('0xae'));}var _0x464177={};try{_0x464177=JSON[_0x3fac('0x79')](process[_0x3fac('0xab')][0x3]);if(!_0x464177[_0x3fac('0x6e')]){throw new Error(_0x3fac('0xaf'));}if(!_0x464177['binding'][_0x3fac('0x10')]){throw new Error(_0x3fac('0xb0'));}if(!_0x464177[_0x3fac('0x6e')][_0x3fac('0xb1')]){throw new Error(_0x3fac('0xb2'));}var _0x1b6f8b=0x0;if(_0x464177[_0x3fac('0x6e')][_0x3fac('0x31')]){_0x1b6f8b=0x1;}if(!_0x464177[_0x3fac('0x2d')]){throw new Error(_0x3fac('0xb3'));}}catch(_0x27421b){throw new Error(_0x3fac('0xb4'));}var _0x27a04f=[];try{_0x27a04f=_[_0x3fac('0xb5')](JSON['parse'](process[_0x3fac('0xab')][0x4]),'id');}catch(_0x3e6deb){logger[_0x3fac('0x53')]('No\x20agent\x20available');}main(_0x50d7ce,_0x464177,_0x27a04f,_0x1b6f8b);}validate();process['on'](_0x3fac('0xb6'),handleStop);process['on'](_0x3fac('0xb7'),handleUncaughtException);
\ No newline at end of file
index 400d021..609b35f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd237=['description','SystemRow','appendFileSync','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','arguments\x20<filename>\x20<parameters>\x20<agents>','server/files/tmp','file\x20doesn\x27t\x20exists','argv','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','message','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.priority','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.id','cm_contacts.updatedAt','insert','into','.CmListId','.CmListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','toString','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','info','error','exit','errors','query','main','stringify','send','start','binding','socket_timestamp','root','.csv','body','findAll','name','_description','header','writeFileSync','parse','data','rows','find','hasOwnProperty','trim','replace','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd237,0x14f));var _0x7d23=function(_0x3f8e20,_0x1daf92){_0x3f8e20=_0x3f8e20-0x0;var _0x54b65e=_0xd237[_0x3f8e20];return _0x54b65e;};'use strict';var fs=require('fs');var path=require(_0x7d23('0x0'));var _=require(_0x7d23('0x1'));var Papa=require(_0x7d23('0x2'));var util=require(_0x7d23('0x3'));var BPromise=require('bluebird');var moment=require(_0x7d23('0x4'));var squel=require(_0x7d23('0x5'));var Redis=require(_0x7d23('0x6'));var db=require(_0x7d23('0x7'))['db'];var config=require(_0x7d23('0x8'));var logger=require(_0x7d23('0x9'))('import');config[_0x7d23('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7d23('0xb'))(new Redis(config[_0x7d23('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x7d23('0xc')](_0x7d23('0xd'));var tempTableName=_0x7d23('0xe')+moment()[_0x7d23('0xc')](_0x7d23('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2bcd72){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x2bcd72);}function selectNotIn(_0x25675b,_0x4aebf8,_0x288e84,_0x59cd06,_0x5bd275){return squel['select']()[_0x7d23('0x10')](_0x7d23('0x11'))[_0x7d23('0x12')](_0x59cd06)[_0x7d23('0x13')](_0x4aebf8,null,_0x4aebf8+_0x7d23('0x14')+_0x59cd06+'.'+_0x288e84)[_0x7d23('0x15')](_0x59cd06+'.'+_0x288e84+_0x7d23('0x16')+_0x25675b+'.'+_0x288e84)['where'](_0x4aebf8+'.dialCheckDuplicateType\x20IN\x20('+_0x5bd275[_0x7d23('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xf1db40,_0x270c75){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7d23('0x17')]['query'](_0x7d23('0x18')+tempTableName)['spread'](function(_0xf480b9){if(_0xf480b9!==null){var _0x518220=[];for(var _0x626d75=0x0;_0x626d75<_0xf480b9[_0x7d23('0x19')];_0x626d75++){var _0xc92e23=_0xf480b9[_0x626d75];if(!_[_0x7d23('0x1a')](_0xc92e23[_0x7d23('0x11')])){if(!_['isNil'](_0xc92e23[_0x7d23('0x1b')]))_0x518220[_0x7d23('0x1c')](insertAdditionalPhones(_0xc92e23));promisesContact['push']({'contact':_0xc92e23});}}}Promise[_0x7d23('0x1d')](_0x518220)[_0x7d23('0x1e')](function(){_0xf1db40({'val':0x1});});})[_0x7d23('0x1f')](function(_0x53d64b){logger['error'](_0x53d64b[_0x7d23('0x20')]);});});}function insertAdditionalPhones(_0x3b7005){return new Promise(function(_0x56b0ba,_0x427637){var _0x563e75=_0x3b7005[_0x7d23('0x1b')];if(_['isNil'](_0x563e75))_0x427637({'val':0x0});else{var _0x321849=_0x563e75[_0x7d23('0x21')](';');var _0x59522b=[];orderBy=0x0;for(var _0x296bad=0x0;_0x296bad<_0x321849[_0x7d23('0x19')];_0x296bad++){_0x59522b[_0x7d23('0x1c')](splitAdditionalPhone(_0x3b7005['id'],_0x321849[_0x296bad]));}Promise['all'](_0x59522b)[_0x7d23('0x1e')](function(){_0x56b0ba({'val':_0x321849['length']});});}});}function splitAdditionalPhone(_0x2e6d9f,_0x354b2a){return new Promise(function(_0x1c007a,_0x3a5d87){var _0x23bfae=_0x354b2a[_0x7d23('0x21')](':');var _0xdef075=_0x23bfae[0x0];var _0x4196c7=_0x23bfae[0x1];if(_0x4196c7!==''){var _0x1d79b2=_0x4196c7[_0x7d23('0x21')]('|');var _0x713db8=[];for(var _0x5a9295=0x0;_0x5a9295<_0x1d79b2[_0x7d23('0x19')];_0x5a9295++){if(_0x1d79b2[_0x5a9295]!==''){var _0x1ee7c2=_[_0x7d23('0x22')](promisesAdditionalPhones,{'contactId':_0x2e6d9f,'phone':_0x1d79b2[_0x5a9295]});if(_0x1ee7c2[_0x7d23('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x7d23('0x1c')]({'contactId':_0x2e6d9f,'contactTypeId':_0xdef075,'phone':_0x1d79b2[_0x5a9295],'orderBy':orderBy});}}}_0x1c007a({'ok':0x1});}else _0x1c007a({'res':0x0});});}function createAdditionalPhone(_0x289be5,_0x15e64d,_0xc61f31,_0x4808f2){var _0x395b33='';var _0x4783ad='';var _0x4a5136=_0xc61f31[_0x7d23('0x21')]('§');_0x395b33=_0x4a5136[0x0];if(_0x4a5136[_0x7d23('0x19')]==0x2)_0x4783ad=_0x4a5136[0x1];return new Promise(function(_0xa9f8a6,_0x4b1c92){return db[_0x7d23('0x23')][_0x7d23('0x24')]({'where':{'CmContactId':_0x289be5,'item':_0x395b33}})[_0x7d23('0x1e')](function(_0x2adb02){if(_0x2adb02){return db[_0x7d23('0x23')][_0x7d23('0x25')]({'ItemTypeId':_0x15e64d,'description':_0x4783ad,'OrderBy':_0x4808f2},{'where':{'CmContactId':_0x289be5,'item':_0x395b33}})['then'](function(_0x15379e){_0xa9f8a6({'res':_0x7d23('0x26')});});}else{return db[_0x7d23('0x23')][_0x7d23('0x27')]({'CmContactId':_0x289be5,'item':_0x395b33,'ItemTypeId':_0x15e64d,'description':_0x4783ad,'OrderBy':_0x4808f2,'ItemClass':_0x7d23('0x28')})['then'](function(_0x2f8011){_0xa9f8a6({'res':_0x7d23('0x29')});});}});});}function updateContact(_0x5d4545){return new Promise(function(_0x36fdf4,_0x39db30){var _0x31b87b=_0x5d4545['id'];delete _0x5d4545['id'];return db['CmContact'][_0x7d23('0x25')](_0x5d4545,{'where':{'id':_0x31b87b}})[_0x7d23('0x1e')](function(_0x53f032){updatedRows+=0x1;return db[_0x7d23('0x2a')][_0x7d23('0x25')]({'phone':_0x5d4545[_0x7d23('0x11')]},{'where':{'ContactId':_0x31b87b}})[_0x7d23('0x1e')](function(_0x19efd7){_0x36fdf4({'ret':'OK'});});});});}function insertCmHopper(_0x5eb76f,_0x55e7a0,_0x140840,_0x55431c,_0xea9477){var _0x419e1b=[_0x7d23('0x2b'),_0x7d23('0x2c'),'cm_contacts.id','cm_contacts.ListId',_0x55e7a0+'.'+_0x55431c,_0x7d23('0x2d'),'cm_contacts.updatedAt',_0x7d23('0x2e'),'cm_contacts.UserId','\x22'+_0xea9477+'\x22'];return squel['insert']()['into'](_0x7d23('0x2f'))[_0x7d23('0x30')]([_0x7d23('0x11'),_0x7d23('0x31'),_0x7d23('0x32'),_0x7d23('0x33'),_0x55431c,_0x7d23('0x34'),_0x7d23('0x35'),_0x7d23('0x36'),_0x7d23('0x37'),_0x7d23('0x38')],squel[_0x7d23('0x39')]()[_0x7d23('0x3a')](_0x419e1b)[_0x7d23('0x12')](_0x55e7a0)['join'](_0x7d23('0x3b'),null,_0x7d23('0x3c')+_0x55e7a0+'.CmListId')['join'](_0x140840,null,_0x140840+_0x7d23('0x14')+_0x55e7a0+'.'+_0x55431c)[_0x7d23('0x15')](_0x55e7a0+'.CmListId\x20=\x20?',_0x5eb76f)[_0x7d23('0x15')](_0x7d23('0x3d'),NOW)[_0x7d23('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x55e7a0,_0x140840,_0x55431c,_0x7d23('0x2f'),['\x22always\x22',_0x7d23('0x3e')]))[_0x7d23('0x15')](_0x7d23('0x3f'),selectNotIn(_0x55e7a0,_0x140840,_0x55431c,_0x7d23('0x2f'),[_0x7d23('0x40')])))['toString']();}function insertCmHopperBlack(_0x4efd8e,_0x4eacc9,_0x1d4137,_0x56cc74){var _0xb2062a=[_0x7d23('0x2b'),_0x7d23('0x41'),'cm_contacts.ListId',_0x4eacc9+'.'+_0x56cc74,_0x7d23('0x2d'),_0x7d23('0x42')];return squel[_0x7d23('0x43')]()[_0x7d23('0x44')]('cm_hopper_black')[_0x7d23('0x30')]([_0x7d23('0x11'),_0x7d23('0x32'),'ListId',_0x56cc74,_0x7d23('0x34'),_0x7d23('0x35')],squel['select']()[_0x7d23('0x3a')](_0xb2062a)[_0x7d23('0x12')](_0x4eacc9)[_0x7d23('0x13')](_0x7d23('0x3b'),null,_0x7d23('0x3c')+_0x4eacc9+_0x7d23('0x45'))[_0x7d23('0x13')](_0x1d4137,null,_0x1d4137+'.id\x20=\x20'+_0x4eacc9+'.'+_0x56cc74)[_0x7d23('0x15')](_0x4eacc9+_0x7d23('0x46'),_0x4efd8e)['where'](_0x7d23('0x3d'),NOW)[_0x7d23('0x15')](_0x7d23('0x3f'),squel[_0x7d23('0x39')]()[_0x7d23('0x10')]('phone')['from']('cm_hopper_black')[_0x7d23('0x15')]('ListId\x20=\x20?',_0x4efd8e)[_0x7d23('0x15')](_0x56cc74+_0x7d23('0x47'),_0x4eacc9+'.'+_0x56cc74)))['toString']();}function insertCmHopperAdditionalPhones(_0x2693d9){var _0x1ce901=['cm_hopper.id',_0x7d23('0x48'),_0x7d23('0x49'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x7d23('0x44')](_0x7d23('0x4a'))[_0x7d23('0x30')]([_0x7d23('0x4b'),_0x7d23('0x11'),_0x7d23('0x4c'),_0x7d23('0x34'),_0x7d23('0x35')],squel[_0x7d23('0x39')]()[_0x7d23('0x3a')](_0x1ce901)['from'](_0x7d23('0x2f'))[_0x7d23('0x13')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x7d23('0x4d'),null,_0x7d23('0x4e'))[_0x7d23('0x15')]('cm_hopper.ListId\x20=\x20?',_0x2693d9)[_0x7d23('0x15')](_0x7d23('0x3d'),NOW))[_0x7d23('0x4f')]();}function insertCmContact(_0x4fa3a3,_0x425807,_0x4fb1e9,_0x180b73){var _0x25bf25=_[_0x7d23('0x50')](_[_0x7d23('0x51')](_0x180b73),[_0x7d23('0x33'),_0x7d23('0x52'),_0x7d23('0x34'),'updatedAt']);return squel[_0x7d23('0x43')]()[_0x7d23('0x44')]('cm_contacts')['fromQuery'](_0x25bf25,squel[_0x7d23('0x39')]()[_0x7d23('0x3a')](_0x25bf25)['from'](_0x425807)[_0x7d23('0x15')]('('+_0x4fb1e9['join'](',')+_0x7d23('0x53'),squel['select']()[_0x7d23('0x3a')](_0x4fb1e9)['from'](_0x7d23('0x3b'))['where']('ListId\x20=\x20?',_0x4fa3a3))[_0x7d23('0x15')]('id\x20IN\x20?',squel['select']()['field'](_0x7d23('0x54'),_0x7d23('0x55'))['from'](_0x425807)['group'](_0x4fb1e9[_0x7d23('0x13')](','))))['toString']();}function handleStop(){logger[_0x7d23('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x548206){logger[_0x7d23('0x57')](_0x548206[_0x7d23('0x20')]);process[_0x7d23('0x58')](0x1);}function handleError(_0x322622,_0x25e826){stats[_0x7d23('0x59')][_0x7d23('0x1c')]({'name':_0x25e826['code'],'message':_0x25e826[_0x7d23('0x20')],'row':_0x322622});}function handleQuery(_0x2b6cd5){logger['info'](_0x2b6cd5);return db[_0x7d23('0x17')][_0x7d23('0x5a')](_0x2b6cd5)['spread'](function(_0x1a7307){results[_0x7d23('0x1c')](_0x1a7307);})[_0x7d23('0x1f')](function(_0x9fc45b){logger['error'](_0x9fc45b[_0x7d23('0x20')]);});}function main(_0x6f8b3,_0x5ad14d,_0xff37eb,_0x423732){logger['info'](_0x7d23('0x5b'),_0x6f8b3,JSON[_0x7d23('0x5c')](_0x5ad14d));process[_0x7d23('0x5d')](_0x7d23('0x5e'));var _0x2a015d=_0x5ad14d[_0x7d23('0x5f')];var _0x13c90a=_['clone'](_0x2a015d);var _0x246705=_0x5ad14d[_0x7d23('0x60')];var _0x30b999=path[_0x7d23('0x13')](config[_0x7d23('0x61')],'server/files/tmp',_0x246705+_0x7d23('0x62'));logger[_0x7d23('0x56')](_0x7d23('0x63'),_0x5ad14d);db['ContactItemType'][_0x7d23('0x64')]({'raw':!![],'attributes':['id','name']})[_0x7d23('0x1e')](function(_0x366158){for(var _0x116e16=0x0;_0x116e16<_0x366158[_0x7d23('0x19')];_0x116e16++){if(_0x366158[_0x116e16]['name']in _0x2a015d){contactItemTypes['push'](_0x366158[_0x116e16]);delete _0x13c90a[_0x366158[_0x116e16]['name']];hasAdditionalPhones=!![];}for(var _0x9b333b in _0x2a015d){if(_0x366158[_0x116e16][_0x7d23('0x65')]+_0x7d23('0x66')===_0x9b333b){phoneDescriptions[_0x7d23('0x1c')]({'itemTypeId':_0x366158[_0x116e16]['id'],'description':_0x9b333b});delete _0x13c90a[_0x9b333b];}}}if(hasAdditionalPhones)_0x13c90a[_0x7d23('0x1b')]='';var _0x5b4c4d=_[_0x7d23('0x51')](_0x13c90a)[_0x7d23('0x13')]();logger['info'](_0x7d23('0x67'),_0x5b4c4d);fs[_0x7d23('0x68')](_0x30b999,_0x5b4c4d+'\x0a');Papa[_0x7d23('0x69')](fs['createReadStream'](_0x6f8b3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x872b8f,_0x5aca33){try{for(var _0x42d31c=0x0,_0x22009c=[];_0x42d31c<_0x872b8f[_0x7d23('0x6a')]['length'];_0x42d31c++){stats[_0x7d23('0x6b')]+=0x1;if(_0x872b8f[_0x7d23('0x59')][_0x42d31c]){handleError(_0x872b8f['data'][_0x42d31c],_0x872b8f[_0x7d23('0x59')][_0x42d31c]);}else{var _0x54b754=[];var _0x3a5bc2=[];var _0x3e9487={};for(var _0x486dc3 in _0x2a015d){let _0x17609b=contactItemTypes[_0x7d23('0x6c')](_0x378ad5=>_0x378ad5[_0x7d23('0x65')]===_0x486dc3);let _0x5e03ef=contactItemTypes['find'](_0x45c2ef=>_0x45c2ef[_0x7d23('0x65')]+_0x7d23('0x66')===_0x486dc3);if(_['isNil'](_0x17609b)&&_[_0x7d23('0x1a')](_0x5e03ef)){if(_0x2a015d[_0x7d23('0x6d')](_0x486dc3)){if(_0x872b8f['data'][_0x42d31c][_0x2a015d[_0x486dc3]]){var _0x5cd4ab=_[_0x7d23('0x6e')](_0x872b8f[_0x7d23('0x6a')][_0x42d31c][_0x2a015d[_0x486dc3]][_0x7d23('0x6f')](/"/g,'\x27'));switch(_0x486dc3){case _0x7d23('0x31'):var _0x6054dc=moment(_0x5cd4ab,_0x7d23('0xd'),!![]);if(_0x6054dc['isValid']()){_0x22009c[_0x7d23('0x1c')]('\x22'+_0x5cd4ab+'\x22');}else{_0x54b754[_0x7d23('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0xc2898=parseInt(_0x5cd4ab);_0x5cd4ab=_[_0x7d23('0x70')](_0xc2898)||_0xc2898<0x0||_0xc2898>0x4?_0x423732?0x3:0x2:_0xc2898;_0x22009c['push']('\x22'+_0x5cd4ab+'\x22');break;case _0x7d23('0x37'):var _0x5db517=parseInt(_0x5cd4ab);if(_[_0x7d23('0x71')](_0x5db517)&&_['includes'](_0xff37eb,_0x5db517)){_0x22009c[_0x7d23('0x1c')]('\x22'+_0x5db517+'\x22');}else{_0x54b754[_0x7d23('0x1c')](_0x7d23('0x72'));}break;case _0x7d23('0x73'):if(isEmail(_0x5cd4ab)){_0x22009c[_0x7d23('0x1c')]('\x22'+_0x5cd4ab+'\x22');}else{_0x54b754[_0x7d23('0x1c')](_0x7d23('0x74'));}break;case _0x7d23('0x75'):var _0x54a7f9=moment(_0x5cd4ab,_0x7d23('0x76'),!![]);if(_0x54a7f9[_0x7d23('0x77')]()){_0x22009c[_0x7d23('0x1c')]('\x22'+_0x5cd4ab+'\x22');}else{_0x54b754[_0x7d23('0x1c')](_0x7d23('0x78'));}break;default:_0x22009c[_0x7d23('0x1c')]('\x22'+_0x5cd4ab+'\x22');}}else{switch(_0x486dc3){case _0x7d23('0x79'):case'phone':_0x54b754[_0x7d23('0x1c')](_0x486dc3+_0x7d23('0x7a'));break;default:_0x22009c[_0x7d23('0x1c')]('\x22\x22');}}}}else{var _0x2a506f='';if(!_[_0x7d23('0x1a')](_0x17609b)){if(!_0x3e9487[_0x7d23('0x6d')](_0x17609b['id'])){for(var _0x886b3a=0x0;_0x886b3a<_0x2a015d[_0x486dc3][_0x7d23('0x19')];_0x886b3a++){var _0x5cd4ab=_[_0x7d23('0x6e')](_0x872b8f[_0x7d23('0x6a')][_0x42d31c][_0x2a015d[_0x486dc3][_0x886b3a]][_0x7d23('0x6f')](/"/g,'\x27'));var _0x226464=phoneDescriptions['find'](_0x52fa4b=>_0x52fa4b[_0x7d23('0x7b')]===_0x17609b['id']);if(!_['isNil'](_0x226464)){var _0x5a9abd=_[_0x7d23('0x6e')](_0x872b8f[_0x7d23('0x6a')][_0x42d31c][_0x2a015d[_0x226464[_0x7d23('0x7c')]][0x0]][_0x7d23('0x6f')](/"/g,'\x27'));if(!_[_0x7d23('0x1a')](_0x5a9abd))_0x5cd4ab=_0x5cd4ab+'§'+_0x5a9abd;}if(_0x2a506f=='')_0x2a506f=_0x5cd4ab;else _0x2a506f+='|'+_0x5cd4ab;}_0x3a5bc2['push'](_0x17609b['id']+':'+_0x2a506f);_0x3e9487[_0x17609b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x22009c[_0x7d23('0x1c')]('\x22'+_0x3a5bc2[_0x7d23('0x13')](';')+'\x22');}if(_0x54b754[_0x7d23('0x19')]){handleError(_0x872b8f[_0x7d23('0x6a')][_0x42d31c],{'code':_0x7d23('0x7d'),'message':_0x54b754[_0x7d23('0x13')]()});}else{fs[_0x7d23('0x7e')](_0x30b999,_0x22009c[_0x7d23('0x13')]()+'\x0a');}_0x22009c=[];}if(!(stats[_0x7d23('0x6b')]%0xc8)){socket['emit']('contact:import:'+_0x246705,stats);stats[_0x7d23('0x59')]=[];}}if(stopped){logger[_0x7d23('0x56')](_0x7d23('0x7f'));_0x5aca33['abort']();}}catch(_0x4c6ab7){handleError(_0x872b8f[_0x7d23('0x6a')][_0x42d31c],{'code':_0x7d23('0x80'),'message':_0x4c6ab7[_0x7d23('0x20')]});logger[_0x7d23('0x57')](_0x7d23('0x81'),_0x4c6ab7[_0x7d23('0x20')]);}},'complete':function(){try{var _0x454423=[];var _0x47bcf1=tempTableName;_0x454423['push'](_0x7d23('0x82')+_0x47bcf1+'\x20LIKE\x20cm_contacts;');logger[_0x7d23('0x56')](_0x7d23('0x83'),contactItemTypes[_0x7d23('0x19')]);var _0x36815d=util[_0x7d23('0xc')](_0x7d23('0x84'),_0x30b999,_0x47bcf1,_0x5b4c4d,_0x5ad14d[_0x7d23('0x33')],_0x5ad14d[_0x7d23('0x52')]||null,NOW,NOW);if(_['isNil'](_0x2a015d[_0x7d23('0x31')])){_0x36815d+=',\x20scheduledAt\x20=\x20NOW()';}_0x454423[_0x7d23('0x1c')](_0x36815d);BPromise[_0x7d23('0x85')](_0x454423,handleQuery)[_0x7d23('0x1e')](function(_0x3387c0){BPromise[_0x7d23('0x1d')]([handleAdditionalPhones()])[_0x7d23('0x1e')](function(){_0x454423=[];for(var _0x544182=0x0;_0x544182<promisesContact['length'];_0x544182++){_0x454423[_0x7d23('0x1c')](updateContact(promisesContact[_0x544182][_0x7d23('0x86')]));}BPromise[_0x7d23('0x1d')](_0x454423)['then'](function(){_0x454423=[];for(var _0x2c7e7b=0x0;_0x2c7e7b<promisesAdditionalPhones[_0x7d23('0x19')];_0x2c7e7b++){_0x454423[_0x7d23('0x1c')](createAdditionalPhone(promisesAdditionalPhones[_0x2c7e7b][_0x7d23('0x87')],promisesAdditionalPhones[_0x2c7e7b]['contactTypeId'],promisesAdditionalPhones[_0x2c7e7b][_0x7d23('0x11')],promisesAdditionalPhones[_0x2c7e7b][_0x7d23('0x88')]));}BPromise[_0x7d23('0x1d')](_0x454423)['then'](function(){_0x454423=[];_0x454423[_0x7d23('0x1c')](insertCmHopperAdditionalPhones(_0x5ad14d[_0x7d23('0x33')]));_0x454423[_0x7d23('0x1c')](_0x7d23('0x89')+_0x47bcf1+';');BPromise[_0x7d23('0x85')](_0x454423,handleQuery)[_0x7d23('0x1e')](function(_0x2f0fa8){stats[_0x7d23('0x8a')]=!![];stats[_0x7d23('0x8b')]=updatedRows;socket[_0x7d23('0x8c')]('contact:import:'+_0x246705,stats);fs['unlink'](_0x6f8b3);fs[_0x7d23('0x8d')](_0x30b999);process[_0x7d23('0x58')](0x0);})['catch'](function(_0x71b6f5){logger[_0x7d23('0x57')](_0x71b6f5['message']);process[_0x7d23('0x58')](0x1);});});});});})[_0x7d23('0x1f')](function(_0x5356f7){logger['error'](_0x5356f7['message']);process[_0x7d23('0x58')](0x1);});}catch(_0x3fa435){logger[_0x7d23('0x57')](_0x7d23('0x8e'),_0x3fa435['message']);process[_0x7d23('0x58')](0x1);}},'error':function(_0x5685d8,_0x420199,_0x569024,_0x15f060){throw new Error(_0x15f060);}});});}function validate(){if(process['argv']&&process['argv'][_0x7d23('0x19')]<0x4){throw new Error(_0x7d23('0x8f'));}var _0x5b08a9=path['join'](config[_0x7d23('0x61')],_0x7d23('0x90'),process['argv'][0x2]);if(!fs['existsSync'](_0x5b08a9)){throw new Error(_0x7d23('0x91'));}var _0x4076b9={};try{_0x4076b9=JSON[_0x7d23('0x69')](process[_0x7d23('0x92')][0x3]);if(!_0x4076b9[_0x7d23('0x5f')]){throw new Error(_0x7d23('0x93'));}var _0x3ceb17=0x0;if(_0x4076b9[_0x7d23('0x5f')]['UserId']){_0x3ceb17=0x1;}if(!_0x4076b9['ListId']){throw new Error(_0x7d23('0x94'));}}catch(_0x3b5761){throw new Error(_0x7d23('0x95'));}var _0x2a1ce4=[];try{_0x2a1ce4=_[_0x7d23('0x96')](JSON[_0x7d23('0x69')](process[_0x7d23('0x92')][0x4]),'id');}catch(_0x2952bf){logger[_0x7d23('0x56')](_0x7d23('0x97'));}main(_0x5b08a9,_0x4076b9,_0x2a1ce4,_0x3ceb17);}validate();process['on'](_0x7d23('0x98'),handleStop);process['on']('uncaughtException',handleUncaughtException);
\ No newline at end of file
+var _0x6426=['description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','unlink','exit','catch','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','existsSync','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','split','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ListId','updatedAt','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','fromQuery','createdAt','from','cm_contacts','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','errors','code','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','name','AdditionalPhones','header','parse','createReadStream','data','rows','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId'];(function(_0x49ab19,_0x3daeb0){var _0x15c716=function(_0x1bd9da){while(--_0x1bd9da){_0x49ab19['push'](_0x49ab19['shift']());}};_0x15c716(++_0x3daeb0);}(_0x6426,0x15b));var _0x6642=function(_0x2eab4a,_0x26b9b2){_0x2eab4a=_0x2eab4a-0x0;var _0x479832=_0x6426[_0x2eab4a];return _0x479832;};'use strict';var fs=require('fs');var path=require(_0x6642('0x0'));var _=require(_0x6642('0x1'));var Papa=require(_0x6642('0x2'));var util=require(_0x6642('0x3'));var BPromise=require(_0x6642('0x4'));var moment=require('moment');var squel=require(_0x6642('0x5'));var Redis=require(_0x6642('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x6642('0x7'));var logger=require(_0x6642('0x8'))(_0x6642('0x9'));config[_0x6642('0xa')]=_[_0x6642('0xb')](config[_0x6642('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6642('0xc'))(new Redis(config[_0x6642('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6642('0xd')](_0x6642('0xe'));var tempTableName=_0x6642('0xf')+moment()[_0x6642('0xd')](_0x6642('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x451f34){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x6642('0x11')](_0x451f34);}function selectNotIn(_0x1c4e57,_0xcb2bda,_0x573a3e,_0x2a9032,_0x588474){return squel[_0x6642('0x12')]()[_0x6642('0x13')](_0x6642('0x14'))['from'](_0x2a9032)['join'](_0xcb2bda,null,_0xcb2bda+_0x6642('0x15')+_0x2a9032+'.'+_0x573a3e)[_0x6642('0x16')](_0x2a9032+'.'+_0x573a3e+_0x6642('0x17')+_0x1c4e57+'.'+_0x573a3e)[_0x6642('0x16')](_0xcb2bda+_0x6642('0x18')+_0x588474[_0x6642('0x19')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5cd4fb,_0x381e81){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6642('0x1a')][_0x6642('0x1b')](_0x6642('0x1c')+tempTableName)[_0x6642('0x1d')](function(_0x4679e1){if(_0x4679e1!==null){var _0x5c15f8=[];for(var _0x3146e5=0x0;_0x3146e5<_0x4679e1[_0x6642('0x1e')];_0x3146e5++){var _0xefdf8c=_0x4679e1[_0x3146e5];if(!_[_0x6642('0x1f')](_0xefdf8c['phone'])){if(!_[_0x6642('0x1f')](_0xefdf8c['AdditionalPhones']))_0x5c15f8[_0x6642('0x20')](insertAdditionalPhones(_0xefdf8c));promisesContact[_0x6642('0x20')]({'contact':_0xefdf8c});}}}Promise[_0x6642('0x21')](_0x5c15f8)[_0x6642('0x22')](function(){_0x5cd4fb({'val':0x1});});})['catch'](function(_0x3ef616){logger['error'](_0x3ef616['message']);});});}function insertAdditionalPhones(_0x29db40){return new Promise(function(_0x49198c,_0x5d3b71){var _0x491e8d=_0x29db40['AdditionalPhones'];if(_['isNil'](_0x491e8d))_0x5d3b71({'val':0x0});else{var _0x390e5e=_0x491e8d[_0x6642('0x23')](';');var _0x475587=[];orderBy=0x0;for(var _0x265455=0x0;_0x265455<_0x390e5e[_0x6642('0x1e')];_0x265455++){_0x475587[_0x6642('0x20')](splitAdditionalPhone(_0x29db40['id'],_0x390e5e[_0x265455]));}Promise[_0x6642('0x21')](_0x475587)[_0x6642('0x22')](function(){_0x49198c({'val':_0x390e5e[_0x6642('0x1e')]});});}});}function splitAdditionalPhone(_0x163fb1,_0x14e4c8){return new Promise(function(_0x1a21f6,_0x4187c9){var _0x85e89d=_0x14e4c8['split'](':');var _0x2fc6d5=_0x85e89d[0x0];var _0xd129fd=_0x85e89d[0x1];if(_0xd129fd!==''){var _0x354410=_0xd129fd[_0x6642('0x23')]('|');var _0x5f4366=[];for(var _0x3b6976=0x0;_0x3b6976<_0x354410['length'];_0x3b6976++){if(_0x354410[_0x3b6976]!==''){var _0x1ff1fd=_['filter'](promisesAdditionalPhones,{'contactId':_0x163fb1,'phone':_0x354410[_0x3b6976]});if(_0x1ff1fd[_0x6642('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x6642('0x20')]({'contactId':_0x163fb1,'contactTypeId':_0x2fc6d5,'phone':_0x354410[_0x3b6976],'orderBy':orderBy});}}}_0x1a21f6({'ok':0x1});}else _0x1a21f6({'res':0x0});});}function createAdditionalPhone(_0x5b8a22,_0x16c096,_0x54406c,_0x31b623){var _0x54e237='';var _0x21f773='';var _0x152674=_0x54406c[_0x6642('0x23')]('§');_0x54e237=_0x152674[0x0];if(_0x152674['length']==0x2)_0x21f773=_0x152674[0x1];return new Promise(function(_0x2aaa26,_0x5b3216){return db['CmContactHasItem'][_0x6642('0x24')]({'where':{'CmContactId':_0x5b8a22,'item':_0x54e237}})['then'](function(_0x1ba6d4){if(_0x1ba6d4){return db[_0x6642('0x25')][_0x6642('0x26')]({'ItemTypeId':_0x16c096,'description':_0x21f773,'OrderBy':_0x31b623},{'where':{'CmContactId':_0x5b8a22,'item':_0x54e237}})[_0x6642('0x22')](function(_0xf03075){_0x2aaa26({'res':_0x6642('0x27')});});}else{return db[_0x6642('0x25')][_0x6642('0x28')]({'CmContactId':_0x5b8a22,'item':_0x54e237,'ItemTypeId':_0x16c096,'description':_0x21f773,'OrderBy':_0x31b623,'ItemClass':_0x6642('0x29')})[_0x6642('0x22')](function(_0x4a8148){_0x2aaa26({'res':_0x6642('0x2a')});});}});});}function updateContact(_0x446b85){return new Promise(function(_0x27c8d2,_0x40f6bd){var _0xf285b8=_0x446b85['id'];delete _0x446b85['id'];return db[_0x6642('0x2b')][_0x6642('0x26')](_0x446b85,{'where':{'id':_0xf285b8}})[_0x6642('0x22')](function(_0x34351b){updatedRows+=0x1;return db[_0x6642('0x2c')][_0x6642('0x26')]({'phone':_0x446b85[_0x6642('0x14')]},{'where':{'ContactId':_0xf285b8}})[_0x6642('0x22')](function(_0x3e4c31){_0x27c8d2({'ret':'OK'});});});});}function insertCmHopper(_0x32fcff,_0x50f5af,_0x87c9bd,_0x1c425f,_0x3e8354){var _0x4ada8d=[_0x6642('0x2d'),_0x6642('0x2e'),'cm_contacts.id',_0x6642('0x2f'),_0x50f5af+'.'+_0x1c425f,_0x6642('0x30'),'cm_contacts.updatedAt',_0x6642('0x31'),_0x6642('0x32'),'\x22'+_0x3e8354+'\x22'];return squel[_0x6642('0x33')]()[_0x6642('0x34')](_0x6642('0x35'))['fromQuery'](['phone',_0x6642('0x36'),'ContactId',_0x6642('0x37'),_0x1c425f,'createdAt',_0x6642('0x38'),'priority',_0x6642('0x39'),'recallme'],squel['select']()[_0x6642('0x3a')](_0x4ada8d)['from'](_0x50f5af)[_0x6642('0x19')]('cm_contacts',null,_0x6642('0x3b')+_0x50f5af+_0x6642('0x3c'))[_0x6642('0x19')](_0x87c9bd,null,_0x87c9bd+_0x6642('0x15')+_0x50f5af+'.'+_0x1c425f)[_0x6642('0x16')](_0x50f5af+'.CmListId\x20=\x20?',_0x32fcff)[_0x6642('0x16')](_0x6642('0x3d'),NOW)[_0x6642('0x16')](_0x6642('0x3e'),selectNotIn(_0x50f5af,_0x87c9bd,_0x1c425f,_0x6642('0x35'),['\x22always\x22',_0x6642('0x3f')]))['where'](_0x6642('0x3e'),selectNotIn(_0x50f5af,_0x87c9bd,_0x1c425f,_0x6642('0x35'),[_0x6642('0x40')])))[_0x6642('0x41')]();}function insertCmHopperBlack(_0x566c96,_0x4c2a30,_0x2e8753,_0x278776){var _0x59c99f=[_0x6642('0x2d'),'cm_contacts.id',_0x6642('0x2f'),_0x4c2a30+'.'+_0x278776,_0x6642('0x30'),'cm_contacts.updatedAt'];return squel[_0x6642('0x33')]()[_0x6642('0x34')](_0x6642('0x42'))[_0x6642('0x43')]([_0x6642('0x14'),'ContactId',_0x6642('0x37'),_0x278776,_0x6642('0x44'),_0x6642('0x38')],squel[_0x6642('0x12')]()[_0x6642('0x3a')](_0x59c99f)[_0x6642('0x45')](_0x4c2a30)['join'](_0x6642('0x46'),null,_0x6642('0x3b')+_0x4c2a30+_0x6642('0x3c'))['join'](_0x2e8753,null,_0x2e8753+_0x6642('0x15')+_0x4c2a30+'.'+_0x278776)[_0x6642('0x16')](_0x4c2a30+_0x6642('0x47'),_0x566c96)[_0x6642('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6642('0x12')]()[_0x6642('0x13')](_0x6642('0x14'))['from']('cm_hopper_black')['where'](_0x6642('0x48'),_0x566c96)['where'](_0x278776+_0x6642('0x49'),_0x4c2a30+'.'+_0x278776)))['toString']();}function insertCmHopperAdditionalPhones(_0x5ace28){var _0xa94446=[_0x6642('0x4a'),_0x6642('0x4b'),_0x6642('0x4c'),_0x6642('0x4d'),_0x6642('0x4e')];return squel['insert']()[_0x6642('0x34')](_0x6642('0x4f'))[_0x6642('0x43')](['CmHopperId',_0x6642('0x14'),_0x6642('0x50'),_0x6642('0x44'),_0x6642('0x38')],squel[_0x6642('0x12')]()[_0x6642('0x3a')](_0xa94446)['from'](_0x6642('0x35'))[_0x6642('0x19')](_0x6642('0x46'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6642('0x19')](_0x6642('0x51'),null,_0x6642('0x52'))[_0x6642('0x16')](_0x6642('0x53'),_0x5ace28)[_0x6642('0x16')](_0x6642('0x3d'),NOW))[_0x6642('0x41')]();}function insertCmContact(_0x33bfec,_0x1c24df,_0x28926e,_0x2a5ff0){var _0x28ac65=_[_0x6642('0x54')](_[_0x6642('0x55')](_0x2a5ff0),[_0x6642('0x37'),_0x6642('0x56'),_0x6642('0x44'),_0x6642('0x38')]);return squel[_0x6642('0x33')]()[_0x6642('0x34')](_0x6642('0x46'))[_0x6642('0x43')](_0x28ac65,squel[_0x6642('0x12')]()['fields'](_0x28ac65)[_0x6642('0x45')](_0x1c24df)[_0x6642('0x16')]('('+_0x28926e[_0x6642('0x19')](',')+_0x6642('0x57'),squel[_0x6642('0x12')]()[_0x6642('0x3a')](_0x28926e)[_0x6642('0x45')](_0x6642('0x46'))['where']('ListId\x20=\x20?',_0x33bfec))['where']('id\x20IN\x20?',squel[_0x6642('0x12')]()[_0x6642('0x13')]('MIN(id)',_0x6642('0x58'))[_0x6642('0x45')](_0x1c24df)[_0x6642('0x59')](_0x28926e[_0x6642('0x19')](','))))[_0x6642('0x41')]();}function handleStop(){logger[_0x6642('0x5a')](_0x6642('0x5b'));stopped=!![];}function handleUncaughtException(_0x2e2a1a){logger[_0x6642('0x5c')](_0x2e2a1a[_0x6642('0x5d')]);process['exit'](0x1);}function handleError(_0x42339f,_0x1adf0e){stats[_0x6642('0x5e')][_0x6642('0x20')]({'name':_0x1adf0e[_0x6642('0x5f')],'message':_0x1adf0e['message'],'row':_0x42339f});}function handleQuery(_0x59ee04){logger[_0x6642('0x5a')](_0x59ee04);return db['sequelize'][_0x6642('0x1b')](_0x59ee04)[_0x6642('0x1d')](function(_0x21bfe2){results[_0x6642('0x20')](_0x21bfe2);})['catch'](function(_0x379a87){logger[_0x6642('0x5c')](_0x379a87['message']);});}function main(_0x11471f,_0x393cee,_0x138bed,_0x2f9d07){logger[_0x6642('0x5a')](_0x6642('0x60'),_0x11471f,JSON[_0x6642('0x61')](_0x393cee));process[_0x6642('0x62')](_0x6642('0x63'));var _0x2acc5f=_0x393cee[_0x6642('0x64')];var _0x39247f=_[_0x6642('0x65')](_0x2acc5f);var _0x395ef1=_0x393cee[_0x6642('0x66')];var _0x5b6d62=path[_0x6642('0x19')](config[_0x6642('0x67')],_0x6642('0x68'),_0x395ef1+'.csv');logger[_0x6642('0x5a')](_0x6642('0x69'),_0x393cee);db[_0x6642('0x6a')]['findAll']({'raw':!![],'attributes':['id',_0x6642('0x6b')]})['then'](function(_0x52d679){for(var _0x1226ca=0x0;_0x1226ca<_0x52d679[_0x6642('0x1e')];_0x1226ca++){if(_0x52d679[_0x1226ca][_0x6642('0x6b')]in _0x2acc5f){contactItemTypes[_0x6642('0x20')](_0x52d679[_0x1226ca]);delete _0x39247f[_0x52d679[_0x1226ca][_0x6642('0x6b')]];hasAdditionalPhones=!![];}for(var _0x410afd in _0x2acc5f){if(_0x52d679[_0x1226ca][_0x6642('0x6b')]+'_description'===_0x410afd){phoneDescriptions[_0x6642('0x20')]({'itemTypeId':_0x52d679[_0x1226ca]['id'],'description':_0x410afd});delete _0x39247f[_0x410afd];}}}if(hasAdditionalPhones)_0x39247f[_0x6642('0x6c')]='';var _0x8bbbb9=_[_0x6642('0x55')](_0x39247f)[_0x6642('0x19')]();logger[_0x6642('0x5a')](_0x6642('0x6d'),_0x8bbbb9);fs['writeFileSync'](_0x5b6d62,_0x8bbbb9+'\x0a');Papa[_0x6642('0x6e')](fs[_0x6642('0x6f')](_0x11471f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3df5e4,_0x3cc82d){try{for(var _0xd7be07=0x0,_0x25f181=[];_0xd7be07<_0x3df5e4[_0x6642('0x70')]['length'];_0xd7be07++){stats[_0x6642('0x71')]+=0x1;if(_0x3df5e4[_0x6642('0x5e')][_0xd7be07]){handleError(_0x3df5e4[_0x6642('0x70')][_0xd7be07],_0x3df5e4['errors'][_0xd7be07]);}else{var _0x2bd50a=[];var _0x25ed44=[];var _0x449d92={};for(var _0x4438c7 in _0x2acc5f){let _0x56212c=contactItemTypes[_0x6642('0x72')](_0x24f4fd=>_0x24f4fd[_0x6642('0x6b')]===_0x4438c7);let _0x257a73=contactItemTypes[_0x6642('0x72')](_0x54bed6=>_0x54bed6[_0x6642('0x6b')]+_0x6642('0x73')===_0x4438c7);if(_[_0x6642('0x1f')](_0x56212c)&&_[_0x6642('0x1f')](_0x257a73)){if(_0x2acc5f[_0x6642('0x74')](_0x4438c7)){if(_0x3df5e4[_0x6642('0x70')][_0xd7be07][_0x2acc5f[_0x4438c7]]){var _0x3bb545=_[_0x6642('0x75')](_0x3df5e4['data'][_0xd7be07][_0x2acc5f[_0x4438c7]][_0x6642('0x76')](/"/g,'\x27'));switch(_0x4438c7){case'scheduledat':var _0x100349=moment(_0x3bb545,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x100349[_0x6642('0x77')]()){_0x25f181['push']('\x22'+_0x3bb545+'\x22');}else{_0x2bd50a[_0x6642('0x20')](_0x6642('0x78'));}break;case _0x6642('0x79'):var _0x2cac61=parseInt(_0x3bb545);_0x3bb545=_[_0x6642('0x7a')](_0x2cac61)||_0x2cac61<0x0||_0x2cac61>0x4?_0x2f9d07?0x3:0x2:_0x2cac61;_0x25f181[_0x6642('0x20')]('\x22'+_0x3bb545+'\x22');break;case _0x6642('0x39'):var _0x22e7d8=parseInt(_0x3bb545);if(_[_0x6642('0x7b')](_0x22e7d8)&&_[_0x6642('0x7c')](_0x138bed,_0x22e7d8)){_0x25f181[_0x6642('0x20')]('\x22'+_0x22e7d8+'\x22');}else{_0x2bd50a[_0x6642('0x20')](_0x6642('0x7d'));}break;case _0x6642('0x7e'):if(isEmail(_0x3bb545)){_0x25f181[_0x6642('0x20')]('\x22'+_0x3bb545+'\x22');}else{_0x2bd50a[_0x6642('0x20')](_0x6642('0x7f'));}break;case _0x6642('0x80'):var _0x3d84fe=moment(_0x3bb545,_0x6642('0x81'),!![]);if(_0x3d84fe[_0x6642('0x77')]()){_0x25f181[_0x6642('0x20')]('\x22'+_0x3bb545+'\x22');}else{_0x2bd50a[_0x6642('0x20')](_0x6642('0x82'));}break;default:_0x25f181[_0x6642('0x20')]('\x22'+_0x3bb545+'\x22');}}else{switch(_0x4438c7){case'firstName':case'phone':_0x2bd50a[_0x6642('0x20')](_0x4438c7+_0x6642('0x83'));break;default:_0x25f181[_0x6642('0x20')]('\x22\x22');}}}}else{var _0x4690d4='';if(!_[_0x6642('0x1f')](_0x56212c)){if(!_0x449d92[_0x6642('0x74')](_0x56212c['id'])){for(var _0x27eee6=0x0;_0x27eee6<_0x2acc5f[_0x4438c7][_0x6642('0x1e')];_0x27eee6++){var _0x3bb545=_[_0x6642('0x75')](_0x3df5e4[_0x6642('0x70')][_0xd7be07][_0x2acc5f[_0x4438c7][_0x27eee6]][_0x6642('0x76')](/"/g,'\x27'));var _0x4835ac=phoneDescriptions[_0x6642('0x72')](_0x35418d=>_0x35418d[_0x6642('0x84')]===_0x56212c['id']);if(!_[_0x6642('0x1f')](_0x4835ac)){var _0x5c469a=_[_0x6642('0x75')](_0x3df5e4[_0x6642('0x70')][_0xd7be07][_0x2acc5f[_0x4835ac[_0x6642('0x85')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x6642('0x1f')](_0x5c469a))_0x3bb545=_0x3bb545+'§'+_0x5c469a;}if(_0x4690d4=='')_0x4690d4=_0x3bb545;else _0x4690d4+='|'+_0x3bb545;}_0x25ed44[_0x6642('0x20')](_0x56212c['id']+':'+_0x4690d4);_0x449d92[_0x56212c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x25f181[_0x6642('0x20')]('\x22'+_0x25ed44[_0x6642('0x19')](';')+'\x22');}if(_0x2bd50a[_0x6642('0x1e')]){handleError(_0x3df5e4['data'][_0xd7be07],{'code':_0x6642('0x86'),'message':_0x2bd50a[_0x6642('0x19')]()});}else{fs['appendFileSync'](_0x5b6d62,_0x25f181[_0x6642('0x19')]()+'\x0a');}_0x25f181=[];}if(!(stats['rows']%0xc8)){socket[_0x6642('0x87')](_0x6642('0x88')+_0x395ef1,stats);stats[_0x6642('0x5e')]=[];}}if(stopped){logger[_0x6642('0x5a')](_0x6642('0x89'));_0x3cc82d[_0x6642('0x8a')]();}}catch(_0x88b5a4){handleError(_0x3df5e4[_0x6642('0x70')][_0xd7be07],{'code':_0x6642('0x8b'),'message':_0x88b5a4['message']});logger[_0x6642('0x5c')]('step',_0x88b5a4[_0x6642('0x5d')]);}},'complete':function(){try{var _0x28e1b9=[];var _0x2c12f7=tempTableName;_0x28e1b9['push'](_0x6642('0x8c')+_0x2c12f7+_0x6642('0x8d'));logger[_0x6642('0x5a')](_0x6642('0x8e'),contactItemTypes[_0x6642('0x1e')]);var _0x40e2bf=util[_0x6642('0xd')](_0x6642('0x8f'),_0x5b6d62,_0x2c12f7,_0x8bbbb9,_0x393cee['ListId'],_0x393cee['CompanyId']||null,NOW,NOW);if(_[_0x6642('0x1f')](_0x2acc5f[_0x6642('0x36')])){_0x40e2bf+=_0x6642('0x90');}_0x28e1b9[_0x6642('0x20')](_0x40e2bf);BPromise[_0x6642('0x91')](_0x28e1b9,handleQuery)[_0x6642('0x22')](function(_0x3df5fa){BPromise[_0x6642('0x21')]([handleAdditionalPhones()])['then'](function(){_0x28e1b9=[];for(var _0xbc27f=0x0;_0xbc27f<promisesContact[_0x6642('0x1e')];_0xbc27f++){_0x28e1b9['push'](updateContact(promisesContact[_0xbc27f][_0x6642('0x92')]));}BPromise[_0x6642('0x21')](_0x28e1b9)[_0x6642('0x22')](function(){_0x28e1b9=[];for(var _0x2aabc8=0x0;_0x2aabc8<promisesAdditionalPhones[_0x6642('0x1e')];_0x2aabc8++){_0x28e1b9[_0x6642('0x20')](createAdditionalPhone(promisesAdditionalPhones[_0x2aabc8][_0x6642('0x93')],promisesAdditionalPhones[_0x2aabc8][_0x6642('0x94')],promisesAdditionalPhones[_0x2aabc8][_0x6642('0x14')],promisesAdditionalPhones[_0x2aabc8][_0x6642('0x95')]));}BPromise[_0x6642('0x21')](_0x28e1b9)['then'](function(){_0x28e1b9=[];_0x28e1b9[_0x6642('0x20')](insertCmHopperAdditionalPhones(_0x393cee['ListId']));_0x28e1b9[_0x6642('0x20')]('DROP\x20TABLE\x20'+_0x2c12f7+';');BPromise[_0x6642('0x91')](_0x28e1b9,handleQuery)['then'](function(_0x506a90){stats['finish']=!![];stats['affectedRows']=updatedRows;socket['emit'](_0x6642('0x88')+_0x395ef1,stats);fs[_0x6642('0x96')](_0x11471f);fs[_0x6642('0x96')](_0x5b6d62);process[_0x6642('0x97')](0x0);})[_0x6642('0x98')](function(_0x45cff7){logger[_0x6642('0x5c')](_0x45cff7['message']);process[_0x6642('0x97')](0x1);});});});});})[_0x6642('0x98')](function(_0x355378){logger[_0x6642('0x5c')](_0x355378['message']);process[_0x6642('0x97')](0x1);});}catch(_0xcabe69){logger['error']('complete',_0xcabe69['message']);process[_0x6642('0x97')](0x1);}},'error':function(_0xc617a6,_0x3d8ebc,_0x138647,_0x2eb27f){throw new Error(_0x2eb27f);}});});}function validate(){if(process[_0x6642('0x99')]&&process[_0x6642('0x99')][_0x6642('0x1e')]<0x4){throw new Error(_0x6642('0x9a'));}var _0x55b4ad=path[_0x6642('0x19')](config[_0x6642('0x67')],_0x6642('0x68'),process['argv'][0x2]);if(!fs[_0x6642('0x9b')](_0x55b4ad)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x4777aa={};try{_0x4777aa=JSON[_0x6642('0x6e')](process[_0x6642('0x99')][0x3]);if(!_0x4777aa[_0x6642('0x64')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x1cbf24=0x0;if(_0x4777aa[_0x6642('0x64')][_0x6642('0x39')]){_0x1cbf24=0x1;}if(!_0x4777aa[_0x6642('0x37')]){throw new Error(_0x6642('0x9c'));}}catch(_0x2b2071){throw new Error('body\x20id\x20mandatory');}var _0x4b7d33=[];try{_0x4b7d33=_[_0x6642('0x9d')](JSON[_0x6642('0x6e')](process[_0x6642('0x99')][0x4]),'id');}catch(_0x3b3631){logger[_0x6642('0x5a')]('No\x20agent\x20available');}main(_0x55b4ad,_0x4777aa,_0x4b7d33,_0x1cbf24);}validate();process['on'](_0x6642('0x9e'),handleStop);process['on'](_0x6642('0x9f'),handleUncaughtException);
\ No newline at end of file
index a1de5ad..064e221 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb9ac=['membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','voice','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','getDescriptions','keyValue','calleridnum','Caller\x20Name','calleridname','destexten','Queue','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Talk\x20Time','talktime','Called\x20Number','Member\x20Name'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0xb9ac,0x1d9));var _0xcb9a=function(_0x48e0af,_0x11caff){_0x48e0af=_0x48e0af-0x0;var _0x16a9fc=_0xb9ac[_0x48e0af];return _0x16a9fc;};'use strict';exports[_0xcb9a('0x0')]=function(_0x59b7d8,_0x763d07){var _0x558dd8=[{'type':_0xcb9a('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x59b7d8['toLowerCase']()){case _0xcb9a('0x2'):switch(_0x763d07[_0xcb9a('0x3')]()){case _0xcb9a('0x4'):_0x558dd8[_0xcb9a('0x5')]({'type':_0xcb9a('0x6'),'content':'','variableName':_0xcb9a('0x7')});_0x558dd8['push']({'type':_0xcb9a('0x6'),'content':'','variableName':'calleridnum'});break;case _0xcb9a('0x8'):_0x558dd8[_0xcb9a('0x5')]({'type':'string','content':_0xcb9a('0x9'),'variableName':null});_0x558dd8[_0xcb9a('0x5')]({'type':_0xcb9a('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x558dd8;};exports[_0xcb9a('0xa')]=function(_0x5322b6,_0x5a7819){var _0x48a2b4=[];switch(_0x5322b6['toLowerCase']()){case'voice':switch(_0x5a7819['toLowerCase']()){case'inbound':_0x48a2b4=[{'type':_0xcb9a('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xcb9a('0xb'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0xcb9a('0xc')},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0xd'),'keyType':'variable','variableName':_0xcb9a('0xe')},{'type':_0xcb9a('0xb'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0xcb9a('0xf')},{'type':'keyValue','content':'','key':_0xcb9a('0x10'),'keyType':_0xcb9a('0x6'),'variableName':_0xcb9a('0x7')},{'type':_0xcb9a('0xb'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0xcb9a('0x11')},{'type':_0xcb9a('0xb'),'content':'','key':'Date','keyType':_0xcb9a('0x6'),'variableName':_0xcb9a('0x12')},{'type':_0xcb9a('0x1'),'content':_0xcb9a('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x14'),'keyType':'variable','variableName':_0xcb9a('0x15')},{'type':_0xcb9a('0xb'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0xcb9a('0x16')},{'type':_0xcb9a('0x1'),'content':_0xcb9a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x18'),'keyType':_0xcb9a('0x6'),'variableName':'agentcalledAt'},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x19'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0xcb9a('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0xcb9a('0x6'),'variableName':_0xcb9a('0x1a')},{'type':_0xcb9a('0xb'),'content':'','key':'Hold\x20Time','keyType':_0xcb9a('0x6'),'variableName':'holdtime'},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x1b'),'keyType':'variable','variableName':_0xcb9a('0x1c')}];break;case _0xcb9a('0x8'):_0x48a2b4=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x1d'),'keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x16')},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xcb9a('0x1f')},{'type':_0xcb9a('0xb'),'content':'','key':'UniqueId','keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x11')},{'type':'keyValue','content':'','key':_0xcb9a('0x20'),'keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x21')},{'type':_0xcb9a('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x22'),'keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x23')},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x24'),'keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x25')},{'type':_0xcb9a('0xb'),'content':'','key':_0xcb9a('0x26'),'keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x27')},{'type':'keyValue','content':'','key':_0xcb9a('0x28'),'keyType':_0xcb9a('0x6'),'keyContent':'','variableName':_0xcb9a('0x29')}];break;}}return _0x48a2b4;};
\ No newline at end of file
+var _0xf7a8=['variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','UniqueId','uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','Date','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue'];(function(_0x1965a2,_0x5b4a4e){var _0x32aa72=function(_0x30c78f){while(--_0x30c78f){_0x1965a2['push'](_0x1965a2['shift']());}};_0x32aa72(++_0x5b4a4e);}(_0xf7a8,0xfb));var _0x8f7a=function(_0x43e68a,_0x19ca8a){_0x43e68a=_0x43e68a-0x0;var _0x4f5981=_0xf7a8[_0x43e68a];return _0x4f5981;};'use strict';exports[_0x8f7a('0x0')]=function(_0x14513a,_0xfc4bb9){var _0x12e3b8=[{'type':_0x8f7a('0x1'),'content':_0x8f7a('0x2'),'variableName':null}];switch(_0x14513a['toLowerCase']()){case'voice':switch(_0xfc4bb9[_0x8f7a('0x3')]()){case _0x8f7a('0x4'):_0x12e3b8[_0x8f7a('0x5')]({'type':'variable','content':'','variableName':_0x8f7a('0x6')});_0x12e3b8['push']({'type':_0x8f7a('0x7'),'content':'','variableName':_0x8f7a('0x8')});break;case _0x8f7a('0x9'):_0x12e3b8[_0x8f7a('0x5')]({'type':_0x8f7a('0x1'),'content':_0x8f7a('0xa'),'variableName':null});_0x12e3b8['push']({'type':'variable','content':'','variableName':_0x8f7a('0xb')});break;}}return _0x12e3b8;};exports[_0x8f7a('0xc')]=function(_0x2fff0b,_0x4f3680){var _0x4a3679=[];switch(_0x2fff0b['toLowerCase']()){case _0x8f7a('0xd'):switch(_0x4f3680[_0x8f7a('0x3')]()){case _0x8f7a('0x4'):_0x4a3679=[{'type':_0x8f7a('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0xf'),'keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x8')},{'type':'keyValue','content':'','key':_0x8f7a('0x10'),'keyType':_0x8f7a('0x7'),'variableName':'calleridname'},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x11'),'keyType':'variable','variableName':'destexten'},{'type':'keyValue','content':'','key':'Queue','keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x6')},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x12'),'keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x13')},{'type':_0x8f7a('0xe'),'content':'','key':'Date','keyType':'variable','variableName':_0x8f7a('0x14')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x15'),'keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x16')},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x17'),'keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0xb')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8f7a('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x14')},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x18'),'keyType':'variable','variableName':_0x8f7a('0x19')},{'type':_0x8f7a('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x1a')},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x1b'),'keyType':'variable','variableName':_0x8f7a('0x1c')},{'type':'keyValue','content':'','key':_0x8f7a('0x1d'),'keyType':_0x8f7a('0x7'),'variableName':_0x8f7a('0x1e')}];break;case _0x8f7a('0x9'):_0x4a3679=[{'type':'string','content':_0x8f7a('0x1f'),'variableName':null},{'type':'keyValue','content':'','key':_0x8f7a('0x20'),'keyType':_0x8f7a('0x7'),'keyContent':'','variableName':_0x8f7a('0xb')},{'type':_0x8f7a('0xe'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x8f7a('0x21')},{'type':_0x8f7a('0xe'),'content':'','key':'UniqueId','keyType':_0x8f7a('0x7'),'keyContent':'','variableName':_0x8f7a('0x13')},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x22'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x8f7a('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x23'),'keyType':_0x8f7a('0x7'),'keyContent':'','variableName':_0x8f7a('0x24')},{'type':'keyValue','content':'','key':_0x8f7a('0x25'),'keyType':_0x8f7a('0x7'),'keyContent':'','variableName':_0x8f7a('0x26')},{'type':_0x8f7a('0xe'),'content':'','key':_0x8f7a('0x27'),'keyType':_0x8f7a('0x7'),'keyContent':'','variableName':_0x8f7a('0x28')},{'type':'keyValue','content':'','key':_0x8f7a('0x29'),'keyType':_0x8f7a('0x7'),'keyContent':'','variableName':_0x8f7a('0x2a')}];break;}}return _0x4a3679;};
\ No newline at end of file
index ae46612..fb83bdc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x505e=['parseAdvancedSearchFilter','where','body','contact','default','filter','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','countFilteredInteractions','count','length','order','forEach','contactName','DESC','closed','rows','tracked','clone','omit','html','phone','updateUser','lodash','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search'];(function(_0x280cd3,_0x5501f0){var _0x5b5d32=function(_0x28febf){while(--_0x28febf){_0x280cd3['push'](_0x280cd3['shift']());}};_0x5b5d32(++_0x5501f0);}(_0x505e,0x1cd));var _0xe505=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x505e[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0xe505('0x0'));var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0xe505('0x1')]=function(_0x449357,_0x2d2d9f,_0x521753,_0x4e63e1,_0x39990f){var _0x59d80c={'count':0x0,'rows':[]};var _0x25eb2d=sqlUtils[_0xe505('0x2')](_0x449357,_0x521753,_0x2d2d9f);if(_0x25eb2d){return Promise[_0xe505('0x3')](_0x59d80c);}var _0x74e9da=sqlUtils[_0xe505('0x4')](_0x449357);var _0x290519={};return Promise[_0xe505('0x3')]()[_0xe505('0x5')](function(){if(_0x2d2d9f[_0xe505('0x6')]){return sqlUtils[_0xe505('0x7')](_0x2d2d9f[_0xe505('0x6')],_0x39990f);}else{return sqlUtils['parseQueryParameters'](_0x449357,_0x2d2d9f,_0x39990f);}})[_0xe505('0x5')](function(_0x30a803){_0x74e9da[_0xe505('0x8')](_0x30a803[_0xe505('0x9')]);_0x74e9da[_0xe505('0x8')](_0x30a803[_0xe505('0xa')]);_0x74e9da['where'](_0x30a803[_0xe505('0xb')]);_0x74e9da['where'](_0x30a803['fields']);_0x74e9da['where'](_0x30a803[_0xe505('0xc')]);_0x74e9da[_0xe505('0x8')](_0x30a803[_0xe505('0xd')]);_0x74e9da[_0xe505('0xe')](_0x30a803[_0xe505('0xf')]);_0x290519=_0x30a803[_0xe505('0x10')];return sqlUtils[_0xe505('0x11')](_0x449357,_0x521753,_0x2d2d9f);})[_0xe505('0x5')](function(_0x6870af){_0x74e9da[_0xe505('0x8')](_0x6870af);_0x74e9da[_0xe505('0x12')](_0xe505('0x13'));var _0x47ab2f=_0x2d2d9f[_0xe505('0x6')]?_0x290519[_0xe505('0x14')]:_0x2d2d9f['tag'];return sqlUtils[_0xe505('0x15')](_0x74e9da,_0x47ab2f);})['then'](function(_0x58a402){_0x59d80c[_0xe505('0x16')]=_0x58a402[_0xe505('0x17')];if(_0x59d80c[_0xe505('0x16')]===0x0){return[];}_0x74e9da[_0xe505('0xe')](_0x290519['clause']);if(_0x4e63e1[_0xe505('0x18')]){_0x4e63e1[_0xe505('0x18')][_0xe505('0x19')](function(_0x18e804){var _0x100d11=_0x18e804[0x0]===_0xe505('0x1a')?_0x18e804[0x0]:'i.'+_0x18e804[0x0];_0x74e9da[_0xe505('0x18')](_0x100d11,_0x18e804[0x1]===_0xe505('0x1b')?![]:!![]);if(_0x18e804[0x0]===_0xe505('0x1c')){var _0x26e12d=sqlUtils['getClosedOrderClause'](_0x449357,_0x2d2d9f);_0x74e9da['order'](_0x26e12d,_0x18e804[0x1]===_0xe505('0x1b')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x449357,_0x74e9da,_0x2d2d9f,_0x4e63e1);})[_0xe505('0x5')](function(_0x57b96b){_0x59d80c[_0xe505('0x1d')]=_0x57b96b;return _0x59d80c;})['catch'](function(_0x471909){throw _0x471909;});};exports[_0xe505('0x1e')]=function(_0x494689,_0x2479f4){return function(_0x4a586b,_0x5c5ef8,_0x548a5d){var _0x5e31a7=_0x4a586b[_0xe505('0xd')];var _0x2bceb1={};var _0x10072d=_0x4a586b['query'];if(_0x2bceb1){_0x2bceb1=_[_0xe505('0x1f')](_0x4a586b[_0xe505('0x9')]);_0x2bceb1=_[_0xe505('0x20')](_0x2bceb1,[_0xe505('0x9'),_0xe505('0x21'),_0xe505('0x22'),'fax','mobile']);}utils[_0xe505('0x23')](_0x5e31a7,_0x2bceb1,_0x10072d,_0x494689,_0x2479f4);_0x548a5d(null);};};
\ No newline at end of file
+var _0x7f88=['search','parseAdvancedSearchFilter','parseQueryParameters','where','body','default','filter','having','read','tags','group','i.id','ids','tag','countFilteredInteractions','length','count','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','user','query','omit','phone','fax','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','getInteractionsQuery','resolve','then'];(function(_0x29f4de,_0x429e32){var _0x21c048=function(_0x42c198){while(--_0x42c198){_0x29f4de['push'](_0x29f4de['shift']());}};_0x21c048(++_0x429e32);}(_0x7f88,0x188));var _0x87f8=function(_0x29547,_0x440487){_0x29547=_0x29547-0x0;var _0x4834cb=_0x7f88[_0x29547];return _0x4834cb;};'use strict';var _=require(_0x87f8('0x0'));var sqlUtils=require(_0x87f8('0x1'));var utils=require(_0x87f8('0x2'));exports[_0x87f8('0x3')]=function(_0xa38ed3,_0x53e784,_0x341556,_0x487757,_0xff05cf){var _0x29c5b4={'count':0x0,'rows':[]};var _0x90e28b=sqlUtils[_0x87f8('0x4')](_0xa38ed3,_0x341556,_0x53e784);if(_0x90e28b){return Promise['resolve'](_0x29c5b4);}var _0x3c932c=sqlUtils[_0x87f8('0x5')](_0xa38ed3);var _0xe57cc={};return Promise[_0x87f8('0x6')]()[_0x87f8('0x7')](function(){if(_0x53e784[_0x87f8('0x8')]){return sqlUtils[_0x87f8('0x9')](_0x53e784['search'],_0xff05cf);}else{return sqlUtils[_0x87f8('0xa')](_0xa38ed3,_0x53e784,_0xff05cf);}})[_0x87f8('0x7')](function(_0x42e5d0){_0x3c932c[_0x87f8('0xb')](_0x42e5d0[_0x87f8('0xc')]);_0x3c932c['where'](_0x42e5d0['contact']);_0x3c932c[_0x87f8('0xb')](_0x42e5d0[_0x87f8('0xd')]);_0x3c932c['where'](_0x42e5d0['fields']);_0x3c932c[_0x87f8('0xb')](_0x42e5d0[_0x87f8('0xe')]);_0x3c932c[_0x87f8('0xb')](_0x42e5d0['user']);_0x3c932c[_0x87f8('0xf')](_0x42e5d0[_0x87f8('0x10')]);_0xe57cc=_0x42e5d0[_0x87f8('0x11')];return sqlUtils['checkAccountsRestrictions'](_0xa38ed3,_0x341556,_0x53e784);})[_0x87f8('0x7')](function(_0xc9c1be){_0x3c932c['where'](_0xc9c1be);_0x3c932c[_0x87f8('0x12')](_0x87f8('0x13'));var _0x3f10b1=_0x53e784[_0x87f8('0x8')]?_0xe57cc[_0x87f8('0x14')]:_0x53e784[_0x87f8('0x15')];return sqlUtils[_0x87f8('0x16')](_0x3c932c,_0x3f10b1);})['then'](function(_0x44c8d4){_0x29c5b4['count']=_0x44c8d4[_0x87f8('0x17')];if(_0x29c5b4[_0x87f8('0x18')]===0x0){return[];}_0x3c932c['having'](_0xe57cc[_0x87f8('0x19')]);if(_0x487757[_0x87f8('0x1a')]){_0x487757[_0x87f8('0x1a')][_0x87f8('0x1b')](function(_0x4e941f){var _0x33730c=_0x4e941f[0x0]===_0x87f8('0x1c')?_0x4e941f[0x0]:'i.'+_0x4e941f[0x0];_0x3c932c[_0x87f8('0x1a')](_0x33730c,_0x4e941f[0x1]===_0x87f8('0x1d')?![]:!![]);if(_0x4e941f[0x0]===_0x87f8('0x1e')){var _0xfbda4a=sqlUtils[_0x87f8('0x1f')](_0xa38ed3,_0x53e784);_0x3c932c[_0x87f8('0x1a')](_0xfbda4a,_0x4e941f[0x1]===_0x87f8('0x1d')?![]:!![]);}});}return sqlUtils[_0x87f8('0x20')](_0xa38ed3,_0x3c932c,_0x53e784,_0x487757);})['then'](function(_0x3783c8){_0x29c5b4[_0x87f8('0x21')]=_0x3783c8;return _0x29c5b4;})[_0x87f8('0x22')](function(_0x4f7f0a){throw _0x4f7f0a;});};exports['tracked']=function(_0x1c5711,_0x3517e6){return function(_0x127de7,_0xe5bdfb,_0x292e52){var _0x43f42b=_0x127de7[_0x87f8('0x23')];var _0x16f4db={};var _0x1834dd=_0x127de7[_0x87f8('0x24')];if(_0x16f4db){_0x16f4db=_['clone'](_0x127de7[_0x87f8('0xc')]);_0x16f4db=_[_0x87f8('0x25')](_0x16f4db,['body','html',_0x87f8('0x26'),_0x87f8('0x27'),'mobile']);}utils['updateUser'](_0x43f42b,_0x16f4db,_0x1834dd,_0x1c5711,_0x3517e6);_0x292e52(null);};};
\ No newline at end of file
index ce147f3..8de53e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x80df=['Accounts','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','sqlOperator','conditions','find','type','default','text','start','end','unreadMessages','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','contact','Tag','tags','clause','and','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','tag','filter','get','capitalize'];(function(_0x29c5c5,_0x3eecaa){var _0x5cbf34=function(_0x2508b8){while(--_0x2508b8){_0x29c5c5['push'](_0x29c5c5['shift']());}};_0x5cbf34(++_0x3eecaa);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var squel=require(_0xf80d('0x1'));var as=require(_0xf80d('0x2'));var qs=require(_0xf80d('0x3'));var updateInteraction=require('./update-interaction')[_0xf80d('0x4')];var utils=require(_0xf80d('0x5'));var db=require(_0xf80d('0x6'))['db'];function skipInteractionsQuery(_0x21365c,_0x15d302,_0xa6b1bb){var _0x26fb05=![];var _0xeffeb7=utils[_0xf80d('0x7')](_0x21365c);if(_0x15d302[_0xf80d('0x8')]==='agent'&&!_0xa6b1bb[_0xf80d('0x9')]&&!_0xa6b1bb[_0xeffeb7]){_0x26fb05=!![];}return _0x26fb05;}function getTagsQuery(){return squel[_0xf80d('0xa')]()[_0xf80d('0xb')]('id')[_0xf80d('0xb')](_0xf80d('0xc'))[_0xf80d('0xb')](_0xf80d('0xd'))[_0xf80d('0xe')](_0xf80d('0xf'));}function getUsersQuery(_0x2ef5d1,_0x30df95){var _0x1987de=utils[_0xf80d('0x10')](_0x2ef5d1);var _0x29bd2c='user_has_'+_0x2ef5d1+'_interactions';var _0x2ad8a7=squel[_0xf80d('0xa')]()['field'](_0xf80d('0x11'))['field'](_0xf80d('0x12'))['field'](_0xf80d('0x13')+_0x1987de)['from'](_0x29bd2c,'ui')[_0xf80d('0x14')](_0xf80d('0x15'),'u',_0xf80d('0x16'));if(_0x30df95[_0xf80d('0x17')]>0x0){_0x2ad8a7[_0xf80d('0x18')](_0xf80d('0x13')+_0x1987de+_0xf80d('0x19'),_[_0xf80d('0x1a')](_0x30df95,'id'));}return _0x2ad8a7;}function getInteractionsQuery(_0x3db0e7){var _0x3b8a82=utils[_0xf80d('0x1b')](_0x3db0e7);var _0x27b2ea=utils[_0xf80d('0x7')](_0x3db0e7);var _0x1d104a=utils[_0xf80d('0x10')](_0x3db0e7);return squel[_0xf80d('0xa')]()[_0xf80d('0xe')](_0x3b8a82[_0xf80d('0x1c')],'i')[_0xf80d('0x14')]('cm_contacts','c',_0xf80d('0x1d'))[_0xf80d('0x14')]('users','o',_0xf80d('0x1e'))['left_join'](_0x3b8a82[_0xf80d('0x1f')],'a',_0xf80d('0x20')+_0x27b2ea)[_0xf80d('0x14')](_0x3b8a82[_0xf80d('0x21')],'me',_0xf80d('0x22')+_0x1d104a+_0xf80d('0x23'))[_0xf80d('0x14')](_0x3b8a82[_0xf80d('0x24')],'it',_0xf80d('0x25')+_0x1d104a+_0xf80d('0x23'))[_0xf80d('0x14')](_0xf80d('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x32ad42={'body':squel[_0xf80d('0x26')](),'contact':squel['expr'](),'default':squel[_0xf80d('0x26')](),'fields':squel[_0xf80d('0x26')](),'filter':squel[_0xf80d('0x26')](),'read':squel[_0xf80d('0x26')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xf80d('0x26')]()};return _0x32ad42;}function parseTagParameter(_0x14399e){var _0xf4c3af=squel[_0xf80d('0x26')]();if(_0x14399e){var _0x3edbec=utils[_0xf80d('0x27')](_0x14399e);_0x3edbec[_0xf80d('0x28')](function(_0x68f2c6){_0xf4c3af['or'](_0xf80d('0x29'),'%,'+_0x68f2c6+',%');});}return _0xf4c3af;}function parseReadParameter(_0x4d2579){var _0xe940d6='';if(_0x4d2579){_0xe940d6=_0xf80d('0x2a');if(_0x4d2579==='1'){_0xe940d6=_0xe940d6[_0xf80d('0x2b')](_0xf80d('0x2c'),'=');}else{_0xe940d6=_0xe940d6[_0xf80d('0x2b')](_0xf80d('0x2c'),'>');}}return _0xe940d6;}function parseSearchFilter(_0x401cfb,_0x5a6615){var _0x4e9219=squel[_0xf80d('0x26')]();if(_0x5a6615){var _0x214bff=_0x5a6615[_0xf80d('0x2b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x214bff)){_0x4e9219['or'](_0xf80d('0x2d'),_0x214bff+'%');if(['sms',_0xf80d('0x2e')][_0xf80d('0x2f')](_0x401cfb)){_0x4e9219['or'](_0xf80d('0x30'),_0x214bff+'%');}else if(_0x401cfb==='fax'){_0x4e9219['or'](_0xf80d('0x31'),_0x214bff+'%');}else if(_0x401cfb===_0xf80d('0x32')){_0x4e9219['or']('i.from\x20LIKE\x20?',_0x214bff+'%');}}else if(_0x401cfb===_0xf80d('0x33')&&qs[_0xf80d('0x34')](_0x214bff)){_0x4e9219['or'](_0xf80d('0x35'),_0x214bff+'%');}else{if(_0x401cfb==='mail'){_0x4e9219['or'](_0xf80d('0x36'),qs[_0xf80d('0x37')](_0x214bff))['or'](_0xf80d('0x38'),qs[_0xf80d('0x37')](_0x214bff));}else{if(_0x401cfb!==_0xf80d('0x39')){_0x4e9219['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf80d('0x37')](_0x214bff));}_0x4e9219['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x214bff+'%');}}}return _0x4e9219;}function parseAdvancedSearchFilter(_0x2004c5,_0x1b7596){var _0xd5ebb4=getSqlClauses();var _0x359698=as['parseSearch'](_0x2004c5);var _0x1cc91e=_0x359698[_0xf80d('0x3a')];for(var _0xbc0d77=0x0;_0xbc0d77<_0x359698[_0xf80d('0x3b')]['length'];_0xbc0d77++){var _0x1d4103=_0x359698[_0xf80d('0x3b')][_0xbc0d77];var _0x43916b='i';var _0x3460c7=_[_0xf80d('0x3c')](_0x1b7596,[_0xf80d('0xc'),_0x1d4103[_0xf80d('0xb')]]);if(_0x3460c7){var _0x45765a=as['buildExpression'](_0x43916b,_0x3460c7[_0xf80d('0x3d')],_0x1d4103);_0xd5ebb4[_0xf80d('0x3e')][_0x1cc91e](_0x45765a[_0xf80d('0x3f')],_0x45765a['value'][_0xf80d('0x40')],_0x45765a['value'][_0xf80d('0x41')]);}else{switch(_0x1d4103[_0xf80d('0xb')]){case _0xf80d('0x42'):var _0xed4cc5=parseReadParameter(_0x1d4103['value']);_0xd5ebb4['read']['and'](_0xed4cc5);break;case _0xf80d('0x43'):if(_0x1d4103[_0xf80d('0x44')]===_0xf80d('0x45')){if(_0x1d4103[_0xf80d('0x46')][_0xf80d('0x47')]('\x20')[_0xf80d('0x17')]>0x1){_0xd5ebb4['contact'][_0x1cc91e](_0xf80d('0x48'),qs[_0xf80d('0x37')](_0x1d4103[_0xf80d('0x46')]),null);}else{var _0x5b3d97='%'+_0x1d4103[_0xf80d('0x46')]+'%';_0xd5ebb4['contact'][_0x1cc91e](_0xf80d('0x49'),_0x5b3d97,_0x5b3d97,_0x5b3d97);}}else{_0x3460c7=_[_0xf80d('0x3c')](_0x1b7596,[_0xf80d('0xc'),_0xf80d('0x4a')]);_0x1d4103[_0xf80d('0xb')]=_0xf80d('0x4a');_0x45765a=as[_0xf80d('0x4b')](_0x43916b,_0x3460c7[_0xf80d('0x3d')],_0x1d4103);_0xd5ebb4[_0xf80d('0x4c')][_0x1cc91e](_0x45765a[_0xf80d('0x3f')],_0x45765a[_0xf80d('0x46')][_0xf80d('0x40')],_0x45765a[_0xf80d('0x46')][_0xf80d('0x41')]);}break;case _0xf80d('0x4d'):var _0x89a185=_0x1d4103[_0xf80d('0x46')][_0xf80d('0x47')](',')[_0xf80d('0x1a')](function(_0x24c1e4){return Number(_0x24c1e4);});var _0x6b0db=parseTagParameter(_0x89a185);_0xd5ebb4[_0xf80d('0x4e')][_0xf80d('0x4f')][_0xf80d('0x50')](_0x6b0db);_0xd5ebb4[_0xf80d('0x4e')]['ids']=_0x89a185;break;case _0xf80d('0x51'):if(_0x1d4103[_0xf80d('0x44')]===_0xf80d('0x45')){_0xd5ebb4[_0xf80d('0x52')][_0x1cc91e](_0xf80d('0x53'),'%'+_0x1d4103['value']+'%',null);}else{_0x3460c7=_[_0xf80d('0x3c')](_0x1b7596,[_0xf80d('0xc'),_0xf80d('0x54')]);_0x1d4103[_0xf80d('0xb')]=_0xf80d('0x54');_0x45765a=as[_0xf80d('0x4b')](_0x43916b,_0x3460c7[_0xf80d('0x3d')],_0x1d4103);_0xd5ebb4[_0xf80d('0x52')][_0x1cc91e](_0x45765a[_0xf80d('0x3f')],_0x45765a[_0xf80d('0x46')][_0xf80d('0x40')],_0x45765a[_0xf80d('0x46')][_0xf80d('0x41')]);}break;case _0xf80d('0x55'):case _0xf80d('0x56'):_0x45765a=as[_0xf80d('0x4b')]('me',null,_0x1d4103);_0xd5ebb4[_0xf80d('0x55')][_0x1cc91e](_0x45765a['text'],_0x45765a[_0xf80d('0x46')][_0xf80d('0x40')],_0x45765a[_0xf80d('0x46')]['end']);break;}}}return _0xd5ebb4;}function parseModelFields(_0x3e5cf6,_0x1088ca,_0x51e367){var _0x57673b=utils[_0xf80d('0x7')](_0x3e5cf6);var _0x5ec859=squel[_0xf80d('0x26')]();var _0x24c70e=_(_0x1088ca)[_0xf80d('0x57')]()[_0xf80d('0x1a')](function(_0x45f8cd){return _[_0xf80d('0x58')](_0x51e367,[_0xf80d('0xc'),_0x45f8cd])?_0x45f8cd:undefined;})[_0xf80d('0x59')]()[_0xf80d('0x46')]();if(_0x24c70e[_0xf80d('0x17')]>0x0){_0x24c70e[_0xf80d('0x28')](function(_0x27a78b){if(_0x27a78b===_0x57673b){_0x5ec859['and']('i.'+_0x57673b+_0xf80d('0x19'),[][_0xf80d('0x5a')](_0x1088ca[_0x27a78b]));}else if(_0x27a78b===_0xf80d('0x5b')){var _0x5c3c41=JSON[_0xf80d('0x5c')](_0x1088ca[_0x27a78b])[_0xf80d('0x5d')];var _0x563cf3=JSON[_0xf80d('0x5c')](_0x1088ca[_0x27a78b])[_0xf80d('0x5e')];_0x5ec859['and'](_0xf80d('0x5f'),_0x5c3c41,_0x563cf3);}else{if(_0x1088ca[_0x27a78b]===_0xf80d('0x60')){_0x5ec859[_0xf80d('0x50')]('i.'+_0x27a78b+_0xf80d('0x61'));}else{_0x5ec859['and']('i.'+_0x27a78b+_0xf80d('0x62'),_0x1088ca[_0x27a78b]);}}});}return _0x5ec859;}function parseQueryParameters(_0x374985,_0x1a4c08,_0x4f011c){var _0x44e040=getSqlClauses();return Promise[_0xf80d('0x63')]()[_0xf80d('0x64')](function(){return parseModelFields(_0x374985,_0x1a4c08,_0x4f011c);})[_0xf80d('0x64')](function(_0x181e5d){_0x44e040[_0xf80d('0x65')][_0xf80d('0x50')](_0x181e5d);return parseReadParameter(_0x1a4c08[_0xf80d('0x66')]);})[_0xf80d('0x64')](function(_0x22b2e9){_0x44e040['read'][_0xf80d('0x50')](_0x22b2e9);return parseTagParameter(_0x1a4c08[_0xf80d('0x67')]);})[_0xf80d('0x64')](function(_0x32c02e){_0x44e040['tags']['clause'][_0xf80d('0x50')](_0x32c02e);return parseSearchFilter(_0x374985,_0x1a4c08[_0xf80d('0x68')]);})['then'](function(_0x43e4b8){_0x44e040[_0xf80d('0x68')]=_0x43e4b8;return _0x44e040;});}function checkAccountsRestrictions(_0x444d3b,_0x15a051,_0x4d3e67){var _0x3ae779=utils['getAccountFK'](_0x444d3b);var _0x4339f8=_0xf80d('0x69')+_[_0xf80d('0x6a')](_0x444d3b)+(_0x444d3b==='chat'?'Websites':_0xf80d('0x6b'));var _0x27b9f3=squel['expr']();return Promise['resolve']()[_0xf80d('0x64')](function(){if(_0x4d3e67[_0xf80d('0x9')]&&_0x15a051[_0xf80d('0x8')]===_0xf80d('0x6c')){return _0x15a051[_0x4339f8]({'attributes':['id'],'raw':!![]});}})[_0xf80d('0x64')](function(_0x40582f){if(_0x40582f){if(_0x40582f[_0xf80d('0x17')]===0x0){_0x27b9f3[_0xf80d('0x50')]('i.'+_0x3ae779+'\x20IS\x20NULL');}else{_0x27b9f3[_0xf80d('0x50')]('i.'+_0x3ae779+_0xf80d('0x19'),_[_0xf80d('0x1a')](_0x40582f,'id'));}}else if(!_0x4d3e67[_0x3ae779]){_0x27b9f3['and']('i.'+_0x3ae779+_0xf80d('0x6d'));}})[_0xf80d('0x64')](function(){return _0x27b9f3;});}function getClosedOrderClause(_0x57ac3b,_0x360783){var _0x38d607='';var _0x34b2b6=['i.thirdDisposition',_0xf80d('0x6e'),_0xf80d('0x6f')];if(_0x57ac3b===_0xf80d('0x33')){_0x34b2b6['unshift']('i.substatus');}if(_0x360783[_0xf80d('0x70')]==='0'&&_0x57ac3b===_0xf80d('0x33')){_0x38d607='i.substatus';}else{if(_0x360783[_0xf80d('0x70')]==='1'){_0x34b2b6['shift']();}_0x38d607=_0xf80d('0x71')+_0x34b2b6[_0xf80d('0x72')](',\x20')+')';}return _0x38d607;}function getFilteredInteractions(_0x10bc20,_0x4d236f,_0x2b4fa6,_0x422daa){var _0x9985a1=utils[_0xf80d('0x10')](_0x10bc20);var _0x24c608=_[_0xf80d('0x6a')](_0x10bc20)+_0xf80d('0x73');var _0x13bd9d=[];var _0x1e87d6=getTagsQuery();var _0x3a810f={'type':db[_0xf80d('0x74')][_0xf80d('0x75')]['SELECT'],'raw':!![]};var _0x12f3a5=[];var _0x1eb3e2=[];return db[_0xf80d('0x76')]['query'](_0x1e87d6[_0xf80d('0x77')](),_0x3a810f)[_0xf80d('0x64')](function(_0x594293){_0x13bd9d=_['keyBy'](_0x594293,'id');_0x3a810f=_[_0xf80d('0x78')](_0x3a810f,{'model':db[_0x24c608],'mapToModel':!![],'nest':!![]});if(_0x2b4fa6[_0xf80d('0x65')]){_0x422daa['attributes'][_0xf80d('0x28')](function(_0xb5b702){_0x4d236f[_0xf80d('0xb')]('i.'+_0xb5b702);});}else{_0x4d236f['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf80d('0x42'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x79'),_0xf80d('0x7a'));_0x4d236f[_0xf80d('0xb')]('a.mandatoryDisposition',_0xf80d('0x7b'));if(_0x10bc20===_0xf80d('0x33')){_0x4d236f['field'](_0xf80d('0x7c'),_0xf80d('0x7d'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x7e'),'contactName');_0x4d236f[_0xf80d('0xb')](_0xf80d('0x7f'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x80'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x81'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x82'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x83'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x84'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x85'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x86'));_0x4d236f[_0xf80d('0xb')]('i.subject');_0x4d236f['field'](_0xf80d('0x6f'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x6e'));_0x4d236f[_0xf80d('0xb')]('i.thirdDisposition');_0x4d236f[_0xf80d('0xb')](_0xf80d('0x87'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x88'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x89'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x8a'));_0x4d236f['field'](_0xf80d('0x8b'));}else if(_0x10bc20==='openchannel'){_0x4d236f[_0xf80d('0xb')](_0xf80d('0x8c'),_0xf80d('0x8d'));}else{_0x4d236f[_0xf80d('0xb')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x10bc20!==_0xf80d('0x33')){_0x4d236f[_0xf80d('0xb')](_0xf80d('0x8e'));}_0x4d236f[_0xf80d('0xb')]('c.firstName',_0xf80d('0x8f'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x90'),_0xf80d('0x91'));_0x4d236f['field'](_0xf80d('0x92'),'Contact.email');_0x4d236f[_0xf80d('0xb')](_0xf80d('0x93'),_0xf80d('0x94'));_0x4d236f[_0xf80d('0xb')](_0xf80d('0x95'),_0xf80d('0x96'));_0x4d236f[_0xf80d('0xb')]('c.fax','Contact.fax');_0x4d236f[_0xf80d('0xb')](_0xf80d('0x97'),_0xf80d('0x98'));_0x4d236f[_0xf80d('0xb')]('o.internal','Owner.internal');_0x4d236f['field'](_0xf80d('0x99'),_0xf80d('0x9a'));}if(_0x422daa[_0xf80d('0x9b')]){_0x4d236f[_0xf80d('0x9b')](_0x422daa[_0xf80d('0x9b')]);}if(_0x422daa['offset']){_0x4d236f[_0xf80d('0x9c')](_0x422daa[_0xf80d('0x9c')]);}return db['sequelize'][_0xf80d('0x9d')](_0x4d236f[_0xf80d('0x77')](),_0x3a810f);})['then'](function(_0x2d24e3){_0x12f3a5=_0x2d24e3;var _0x5c20cf=getUsersQuery(_0x10bc20,_0x12f3a5);return db[_0xf80d('0x76')][_0xf80d('0x9d')](_0x5c20cf[_0xf80d('0x77')](),_0x3a810f);})['then'](function(_0x3ce54d){_0x1eb3e2=_['groupBy'](_0x3ce54d,_0x9985a1);if(_0x10bc20==='mail'){return db[_0xf80d('0x9e')][_0xf80d('0x9f')]({'attributes':[_0xf80d('0xa0')],'raw':!![]});}})[_0xf80d('0x64')](function(_0x2ba3db){var _0x38cfad=_0x2ba3db?_0x2ba3db['enableEmailPreview']:undefined;var _0x1c390d=_0x12f3a5[_0xf80d('0x1a')](function(_0x2a0620){return updateInteraction(_0x2a0620,_0x13bd9d,_0x1eb3e2,_0x38cfad);});return Promise['all'](_0x1c390d);});}function countFilteredInteractions(_0x18b0b0,_0x12103c){var _0x5182bf=_0x18b0b0['clone']();_0x5182bf[_0xf80d('0xb')](_0xf80d('0xa1'));_0x5182bf[_0xf80d('0xb')](_0xf80d('0xa2'),_0xf80d('0x42'));var _0x51b4bf=utils[_0xf80d('0x27')](_0x12103c);if(!_['isEmpty'](_0x51b4bf)){_0x5182bf['where']('t.id\x20IN\x20?',_0x51b4bf);}var _0x26a14f={'type':db['Sequelize'][_0xf80d('0x75')]['SELECT'],'raw':!![]};return db[_0xf80d('0x76')][_0xf80d('0x9d')](_0x5182bf[_0xf80d('0x77')](),_0x26a14f);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery};
\ No newline at end of file
+var _0x57d4=['i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','type','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','text','keys','compact','forEach','\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','Websites','resolve','role','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','query','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','sequelize','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','field','name','getInteractionFK','user_has_','_interactions','select','u.id','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x57d4,0x78));var _0x457d=function(_0x2362be,_0x43cef1){_0x2362be=_0x2362be-0x0;var _0x42f965=_0x57d4[_0x2362be];return _0x42f965;};'use strict';var _=require(_0x457d('0x0'));var squel=require(_0x457d('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x457d('0x2'));var updateInteraction=require(_0x457d('0x3'))[_0x457d('0x4')];var utils=require(_0x457d('0x5'));var db=require(_0x457d('0x6'))['db'];function skipInteractionsQuery(_0x3c89b2,_0x3e2239,_0x1f5b4e){var _0x4745ed=![];var _0x247ec7=utils[_0x457d('0x7')](_0x3c89b2);if(_0x3e2239['role']===_0x457d('0x8')&&!_0x1f5b4e[_0x457d('0x9')]&&!_0x1f5b4e[_0x247ec7]){_0x4745ed=!![];}return _0x4745ed;}function getTagsQuery(){return squel['select']()['field']('id')[_0x457d('0xa')](_0x457d('0xb'))[_0x457d('0xa')]('color')['from']('tools_tags');}function getUsersQuery(_0x2214e6,_0x38ec93){var _0x449f48=utils[_0x457d('0xc')](_0x2214e6);var _0x25ae31=_0x457d('0xd')+_0x2214e6+_0x457d('0xe');var _0x24cf65=squel[_0x457d('0xf')]()['field'](_0x457d('0x10'))[_0x457d('0xa')]('u.fullname')['field'](_0x457d('0x11')+_0x449f48)[_0x457d('0x12')](_0x25ae31,'ui')[_0x457d('0x13')](_0x457d('0x14'),'u',_0x457d('0x15'));if(_0x38ec93[_0x457d('0x16')]>0x0){_0x24cf65[_0x457d('0x17')](_0x457d('0x11')+_0x449f48+'\x20IN\x20?',_[_0x457d('0x18')](_0x38ec93,'id'));}return _0x24cf65;}function getInteractionsQuery(_0x1ebc33){var _0x2c05ca=utils['getInteractionsTables'](_0x1ebc33);var _0x4919da=utils[_0x457d('0x7')](_0x1ebc33);var _0x4d988f=utils[_0x457d('0xc')](_0x1ebc33);return squel[_0x457d('0xf')]()['from'](_0x2c05ca[_0x457d('0x19')],'i')['left_join']('cm_contacts','c',_0x457d('0x1a'))[_0x457d('0x13')](_0x457d('0x14'),'o',_0x457d('0x1b'))[_0x457d('0x13')](_0x2c05ca[_0x457d('0x1c')],'a',_0x457d('0x1d')+_0x4919da)[_0x457d('0x13')](_0x2c05ca[_0x457d('0x1e')],'me',_0x457d('0x1f')+_0x4d988f+'\x20=\x20i.id')['left_join'](_0x2c05ca['interactionsTags'],'it',_0x457d('0x20')+_0x4d988f+'\x20=\x20i.id')['left_join']('tools_tags','t',_0x457d('0x21'));}function getSqlClauses(){var _0x1eedc5={'body':squel['expr'](),'contact':squel[_0x457d('0x22')](),'default':squel[_0x457d('0x22')](),'fields':squel[_0x457d('0x22')](),'filter':squel[_0x457d('0x22')](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x457d('0x22')]()};return _0x1eedc5;}function parseTagParameter(_0x47feed){var _0x3d1ca7=squel[_0x457d('0x22')]();if(_0x47feed){var _0x2eb87e=utils[_0x457d('0x23')](_0x47feed);_0x2eb87e['forEach'](function(_0x298dd4){_0x3d1ca7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x298dd4+',%');});}return _0x3d1ca7;}function parseReadParameter(_0x4eb5ca){var _0x1945f5='';if(_0x4eb5ca){_0x1945f5=_0x457d('0x24');if(_0x4eb5ca==='1'){_0x1945f5=_0x1945f5['replace'](_0x457d('0x25'),'=');}else{_0x1945f5=_0x1945f5[_0x457d('0x26')]('{OPERATOR}','>');}}return _0x1945f5;}function parseSearchFilter(_0xec380b,_0x41f012){var _0x4660c3=squel[_0x457d('0x22')]();if(_0x41f012){var _0x381a9d=_0x41f012[_0x457d('0x26')]('\x5c','\x5c\x5c')[_0x457d('0x26')](/'/g,'\x27\x27');if(qs[_0x457d('0x27')](_0x381a9d)){_0x4660c3['or'](_0x457d('0x28'),_0x381a9d+'%');if([_0x457d('0x29'),_0x457d('0x2a')][_0x457d('0x2b')](_0xec380b)){_0x4660c3['or'](_0x457d('0x2c'),_0x381a9d+'%');}else if(_0xec380b===_0x457d('0x2d')){_0x4660c3['or'](_0x457d('0x2e'),_0x381a9d+'%');}else if(_0xec380b===_0x457d('0x2f')){_0x4660c3['or'](_0x457d('0x30'),_0x381a9d+'%');}}else if(_0xec380b===_0x457d('0x31')&&qs['isEmail'](_0x381a9d)){_0x4660c3['or'](_0x457d('0x32'),_0x381a9d+'%');}else{if(_0xec380b===_0x457d('0x31')){_0x4660c3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x381a9d))['or'](_0x457d('0x33'),qs[_0x457d('0x34')](_0x381a9d));}else{if(_0xec380b!=='fax'){_0x4660c3['or'](_0x457d('0x35'),qs[_0x457d('0x34')](_0x381a9d));}_0x4660c3['or'](_0x457d('0x36'),_0x381a9d+'%');}}}return _0x4660c3;}function parseAdvancedSearchFilter(_0x1076e6,_0x17eefd){var _0x36a90b=getSqlClauses();var _0x17f011=as[_0x457d('0x37')](_0x1076e6);var _0x37bc38=_0x17f011[_0x457d('0x38')];for(var _0x20bab0=0x0;_0x20bab0<_0x17f011[_0x457d('0x39')][_0x457d('0x16')];_0x20bab0++){var _0xc5a344=_0x17f011[_0x457d('0x39')][_0x20bab0];var _0x4b29a1='i';var _0x27811b=_['find'](_0x17eefd,['name',_0xc5a344['field']]);if(_0x27811b){var _0x1c2491=as['buildExpression'](_0x4b29a1,_0x27811b[_0x457d('0x3a')],_0xc5a344);_0x36a90b['default'][_0x37bc38](_0x1c2491['text'],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3c')],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3d')]);}else{switch(_0xc5a344[_0x457d('0xa')]){case _0x457d('0x3e'):var _0x23a9ee=parseReadParameter(_0xc5a344[_0x457d('0x3b')]);_0x36a90b[_0x457d('0x3f')][_0x457d('0x40')](_0x23a9ee);break;case _0x457d('0x41'):if(_0xc5a344[_0x457d('0x42')]===_0x457d('0x43')){if(_0xc5a344[_0x457d('0x3b')][_0x457d('0x44')]('\x20')[_0x457d('0x16')]>0x1){_0x36a90b[_0x457d('0x45')][_0x37bc38]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x457d('0x34')](_0xc5a344['value']),null);}else{var _0xaa8ded='%'+_0xc5a344[_0x457d('0x3b')]+'%';_0x36a90b[_0x457d('0x45')][_0x37bc38](_0x457d('0x46'),_0xaa8ded,_0xaa8ded,_0xaa8ded);}}else{_0x27811b=_[_0x457d('0x47')](_0x17eefd,['name','ContactId']);_0xc5a344[_0x457d('0xa')]='ContactId';_0x1c2491=as[_0x457d('0x48')](_0x4b29a1,_0x27811b[_0x457d('0x3a')],_0xc5a344);_0x36a90b[_0x457d('0x45')][_0x37bc38](_0x1c2491['text'],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3c')],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3d')]);}break;case _0x457d('0x49'):var _0xc61898=_0xc5a344[_0x457d('0x3b')][_0x457d('0x44')](',')[_0x457d('0x18')](function(_0x4a9896){return Number(_0x4a9896);});var _0x4b01f2=parseTagParameter(_0xc61898);_0x36a90b[_0x457d('0x4a')][_0x457d('0x4b')][_0x457d('0x40')](_0x4b01f2);_0x36a90b[_0x457d('0x4a')][_0x457d('0x4c')]=_0xc61898;break;case _0x457d('0x4d'):if(_0xc5a344['operator']===_0x457d('0x43')){_0x36a90b[_0x457d('0x4e')][_0x37bc38](_0x457d('0x4f'),'%'+_0xc5a344['value']+'%',null);}else{_0x27811b=_[_0x457d('0x47')](_0x17eefd,[_0x457d('0xb'),_0x457d('0x50')]);_0xc5a344['field']=_0x457d('0x50');_0x1c2491=as[_0x457d('0x48')](_0x4b29a1,_0x27811b[_0x457d('0x3a')],_0xc5a344);_0x36a90b[_0x457d('0x4e')][_0x37bc38](_0x1c2491['text'],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3c')],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3d')]);}break;case _0x457d('0x51'):case _0x457d('0x52'):_0x1c2491=as[_0x457d('0x48')]('me',null,_0xc5a344);_0x36a90b[_0x457d('0x51')][_0x37bc38](_0x1c2491[_0x457d('0x53')],_0x1c2491[_0x457d('0x3b')]['start'],_0x1c2491[_0x457d('0x3b')][_0x457d('0x3d')]);break;}}}return _0x36a90b;}function parseModelFields(_0x7abdf1,_0x545e67,_0x481a89){var _0x450ad7=utils[_0x457d('0x7')](_0x7abdf1);var _0x107ad7=squel[_0x457d('0x22')]();var _0x3f10a8=_(_0x545e67)[_0x457d('0x54')]()[_0x457d('0x18')](function(_0x7a1e61){return _['some'](_0x481a89,['name',_0x7a1e61])?_0x7a1e61:undefined;})[_0x457d('0x55')]()[_0x457d('0x3b')]();if(_0x3f10a8[_0x457d('0x16')]>0x0){_0x3f10a8[_0x457d('0x56')](function(_0x2ecac7){if(_0x2ecac7===_0x450ad7){_0x107ad7[_0x457d('0x40')]('i.'+_0x450ad7+_0x457d('0x57'),[][_0x457d('0x58')](_0x545e67[_0x2ecac7]));}else if(_0x2ecac7===_0x457d('0x59')){var _0x1faeaf=JSON[_0x457d('0x5a')](_0x545e67[_0x2ecac7])[_0x457d('0x5b')];var _0x19c05e=JSON[_0x457d('0x5a')](_0x545e67[_0x2ecac7])['$lte'];_0x107ad7[_0x457d('0x40')](_0x457d('0x5c'),_0x1faeaf,_0x19c05e);}else{if(_0x545e67[_0x2ecac7]===_0x457d('0x5d')){_0x107ad7[_0x457d('0x40')]('i.'+_0x2ecac7+'\x20IS\x20NULL');}else{_0x107ad7[_0x457d('0x40')]('i.'+_0x2ecac7+_0x457d('0x5e'),_0x545e67[_0x2ecac7]);}}});}return _0x107ad7;}function parseQueryParameters(_0x55b867,_0x61519d,_0x114886){var _0x3688b3=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x55b867,_0x61519d,_0x114886);})[_0x457d('0x5f')](function(_0x58642e){_0x3688b3[_0x457d('0x60')][_0x457d('0x40')](_0x58642e);return parseReadParameter(_0x61519d[_0x457d('0x3f')]);})[_0x457d('0x5f')](function(_0x2f79d8){_0x3688b3[_0x457d('0x3f')][_0x457d('0x40')](_0x2f79d8);return parseTagParameter(_0x61519d[_0x457d('0x61')]);})[_0x457d('0x5f')](function(_0xe1c287){_0x3688b3[_0x457d('0x4a')][_0x457d('0x4b')][_0x457d('0x40')](_0xe1c287);return parseSearchFilter(_0x55b867,_0x61519d[_0x457d('0x62')]);})['then'](function(_0x2969b4){_0x3688b3[_0x457d('0x62')]=_0x2969b4;return _0x3688b3;});}function checkAccountsRestrictions(_0x4e865a,_0x2af073,_0x48084f){var _0x125f6f=utils[_0x457d('0x7')](_0x4e865a);var _0x57a690=_0x457d('0x63')+_[_0x457d('0x64')](_0x4e865a)+(_0x4e865a===_0x457d('0x65')?_0x457d('0x66'):'Accounts');var _0x853fa6=squel['expr']();return Promise[_0x457d('0x67')]()['then'](function(){if(_0x48084f[_0x457d('0x9')]&&_0x2af073[_0x457d('0x68')]==='agent'){return _0x2af073[_0x57a690]({'attributes':['id'],'raw':!![]});}})[_0x457d('0x5f')](function(_0x5095d5){if(_0x5095d5){if(_0x5095d5['length']===0x0){_0x853fa6['and']('i.'+_0x125f6f+_0x457d('0x69'));}else{_0x853fa6[_0x457d('0x40')]('i.'+_0x125f6f+'\x20IN\x20?',_[_0x457d('0x18')](_0x5095d5,'id'));}}else if(!_0x48084f[_0x125f6f]){_0x853fa6[_0x457d('0x40')]('i.'+_0x125f6f+_0x457d('0x6a'));}})[_0x457d('0x5f')](function(){return _0x853fa6;});}function getClosedOrderClause(_0x1497f3,_0x463a88){var _0x3c9a87='';var _0x24a77d=[_0x457d('0x6b'),'i.secondDisposition','i.disposition'];if(_0x1497f3===_0x457d('0x31')){_0x24a77d[_0x457d('0x6c')](_0x457d('0x6d'));}if(_0x463a88[_0x457d('0x6e')]==='0'&&_0x1497f3===_0x457d('0x31')){_0x3c9a87=_0x457d('0x6d');}else{if(_0x463a88[_0x457d('0x6e')]==='1'){_0x24a77d[_0x457d('0x6f')]();}_0x3c9a87=_0x457d('0x70')+_0x24a77d[_0x457d('0x71')](',\x20')+')';}return _0x3c9a87;}function getFilteredInteractions(_0x56cfaf,_0x57316a,_0x4345f1,_0x4dc307){var _0xccaa9=utils['getInteractionFK'](_0x56cfaf);var _0x349217=_[_0x457d('0x64')](_0x56cfaf)+_0x457d('0x72');var _0x54a1e4=[];var _0x5b5385=getTagsQuery();var _0x2abe3a={'type':db[_0x457d('0x73')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1fd860=[];var _0x4526b7=[];return db['sequelize'][_0x457d('0x74')](_0x5b5385[_0x457d('0x75')](),_0x2abe3a)[_0x457d('0x5f')](function(_0x67f819){_0x54a1e4=_['keyBy'](_0x67f819,'id');_0x2abe3a=_[_0x457d('0x76')](_0x2abe3a,{'model':db[_0x349217],'mapToModel':!![],'nest':!![]});if(_0x4345f1[_0x457d('0x60')]){_0x4dc307[_0x457d('0x77')][_0x457d('0x56')](function(_0x377a5b){_0x57316a['field']('i.'+_0x377a5b);});}else{_0x57316a[_0x457d('0xa')](_0x457d('0x78'),'unreadMessages');_0x57316a['field'](_0x457d('0x79'),_0x457d('0x7a'));_0x57316a[_0x457d('0xa')](_0x457d('0x7b'),_0x457d('0x7c'));if(_0x56cfaf===_0x457d('0x31')){_0x57316a[_0x457d('0xa')](_0x457d('0x7d'),'Account.email');_0x57316a[_0x457d('0xa')](_0x457d('0x7e'),_0x457d('0x7f'));_0x57316a[_0x457d('0xa')](_0x457d('0x80'));_0x57316a['field']('i.createdAt');_0x57316a[_0x457d('0xa')]('i.updatedAt');_0x57316a['field'](_0x457d('0x81'));_0x57316a[_0x457d('0xa')](_0x457d('0x82'));_0x57316a[_0x457d('0xa')](_0x457d('0x83'));_0x57316a[_0x457d('0xa')](_0x457d('0x84'));_0x57316a[_0x457d('0xa')]('i.lastMsgDirection');_0x57316a['field'](_0x457d('0x85'));_0x57316a['field'](_0x457d('0x86'));_0x57316a[_0x457d('0xa')](_0x457d('0x87'));_0x57316a[_0x457d('0xa')]('i.thirdDisposition');_0x57316a[_0x457d('0xa')]('i.substatus');_0x57316a['field'](_0x457d('0x88'));_0x57316a['field'](_0x457d('0x89'));_0x57316a[_0x457d('0xa')](_0x457d('0x8a'));_0x57316a[_0x457d('0xa')](_0x457d('0x8b'));}else if(_0x56cfaf===_0x457d('0x2f')){_0x57316a[_0x457d('0xa')](_0x457d('0x8c'),'contactName');}else{_0x57316a[_0x457d('0xa')](_0x457d('0x8d'),_0x457d('0x7f'));}if(_0x56cfaf!==_0x457d('0x31')){_0x57316a['field']('i.*');}_0x57316a['field']('c.firstName',_0x457d('0x8e'));_0x57316a['field'](_0x457d('0x8f'),_0x457d('0x90'));_0x57316a[_0x457d('0xa')](_0x457d('0x91'),_0x457d('0x92'));_0x57316a[_0x457d('0xa')](_0x457d('0x93'),'Contact.phone');_0x57316a[_0x457d('0xa')](_0x457d('0x94'),'Contact.mobile');_0x57316a['field'](_0x457d('0x95'),_0x457d('0x96'));_0x57316a[_0x457d('0xa')]('o.fullname',_0x457d('0x97'));_0x57316a[_0x457d('0xa')](_0x457d('0x98'),_0x457d('0x99'));_0x57316a[_0x457d('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x457d('0x9a'));}if(_0x4dc307['limit']){_0x57316a[_0x457d('0x9b')](_0x4dc307[_0x457d('0x9b')]);}if(_0x4dc307[_0x457d('0x9c')]){_0x57316a['offset'](_0x4dc307[_0x457d('0x9c')]);}return db[_0x457d('0x9d')][_0x457d('0x74')](_0x57316a[_0x457d('0x75')](),_0x2abe3a);})['then'](function(_0x311507){_0x1fd860=_0x311507;var _0x38096c=getUsersQuery(_0x56cfaf,_0x1fd860);return db[_0x457d('0x9d')][_0x457d('0x74')](_0x38096c[_0x457d('0x75')](),_0x2abe3a);})[_0x457d('0x5f')](function(_0xbc99e8){_0x4526b7=_['groupBy'](_0xbc99e8,_0xccaa9);if(_0x56cfaf===_0x457d('0x31')){return db['Setting'][_0x457d('0x9e')]({'attributes':[_0x457d('0x9f')],'raw':!![]});}})[_0x457d('0x5f')](function(_0x400962){var _0x9c2df=_0x400962?_0x400962[_0x457d('0x9f')]:undefined;var _0x308916=_0x1fd860['map'](function(_0x3aac80){return updateInteraction(_0x3aac80,_0x54a1e4,_0x4526b7,_0x9c2df);});return Promise[_0x457d('0xa0')](_0x308916);});}function countFilteredInteractions(_0x30a4f3,_0x2ef71f){var _0x51da8c=_0x30a4f3['clone']();_0x51da8c[_0x457d('0xa')](_0x457d('0xa1'));_0x51da8c[_0x457d('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x445215=utils['getSelectedTags'](_0x2ef71f);if(!_[_0x457d('0xa2')](_0x445215)){_0x51da8c[_0x457d('0x17')](_0x457d('0xa3'),_0x445215);}var _0x5d55c0={'type':db[_0x457d('0x73')]['QueryTypes'][_0x457d('0xa4')],'raw':!![]};return db[_0x457d('0x9d')]['query'](_0x51da8c[_0x457d('0x75')](),_0x5d55c0);}module[_0x457d('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery};
\ No newline at end of file
index d94a3fb..d049d6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x82ed=['-id','then','trimStart','catch','updateInteraction','Users','TagIds','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody'];(function(_0x57d00d,_0x3bb282){var _0x2d2b37=function(_0x595b76){while(--_0x595b76){_0x57d00d['push'](_0x57d00d['shift']());}};_0x2d2b37(++_0x3bb282);}(_0x82ed,0x173));var _0xd82e=function(_0x392d71,_0x271154){_0x392d71=_0x392d71-0x0;var _0x1e0396=_0x82ed[_0x392d71];return _0x1e0396;};'use strict';var _=require('lodash');var db=require(_0xd82e('0x0'))['db'];function getInteractionUsers(_0xcd9106,_0x2f449e){return new Promise(function(_0xdc3783,_0x43acdb){try{var _0x5ee501=[];if(_0x2f449e[_0xcd9106]){_0x5ee501=_0x2f449e[_0xcd9106][_0xd82e('0x1')](function(_0x3a99d6){return{'id':_0x3a99d6['id'],'fullname':_0x3a99d6[_0xd82e('0x2')]};});}return _0xdc3783(_0x5ee501);}catch(_0x53528b){_0x43acdb(_0x53528b);}});}function getInteractionTags(_0x511042,_0x55b5bf){var _0x194c0c=[];if(_0x511042){_0x511042[_0xd82e('0x3')](',')[_0xd82e('0x4')](function(_0x55a8fb){_0x194c0c[_0xd82e('0x5')](_0x55b5bf[_0x55a8fb]);});}return _0x194c0c;}function updateWaitingCounter(_0x4177b9){if(_0x4177b9[_0xd82e('0x6')]){_0x4177b9['waiting']-=0x1;}}function updateInteractionCounters(_0xfd3d71){_0xfd3d71[_0xd82e('0x6')]=0x0;_0xfd3d71[_0xd82e('0x7')]=0x0;_0xfd3d71[_0xd82e('0x8')]=0x0;_0xfd3d71[_0xd82e('0x9')]=0x0;_0xfd3d71[_0xd82e('0xa')]=0x0;_0xfd3d71[_0xd82e('0xb')]=0x0;if(_0xfd3d71[_0xd82e('0xc')]){if(_0xfd3d71[_0xd82e('0xd')]===_0xd82e('0xa')){_0xfd3d71[_0xd82e('0xa')]+=0x1;updateWaitingCounter(_0xfd3d71);}if(_0xfd3d71[_0xd82e('0xe')]){_0xfd3d71[_0xd82e('0x8')]+=0x1;if(_0xfd3d71[_0xd82e('0x7')]){_0xfd3d71[_0xd82e('0x7')]-=0x1;}}else{if(_0xfd3d71[_0xd82e('0xd')]){_0xfd3d71[_0xd82e('0x9')]+=0x1;updateWaitingCounter(_0xfd3d71);}}}else{if(!_0xfd3d71[_0xd82e('0xe')]){_0xfd3d71['waiting']+=0x1;}if(_0xfd3d71[_0xd82e('0xe')]){_0xfd3d71[_0xd82e('0x7')]+=0x1;updateWaitingCounter(_0xfd3d71);}}_0xfd3d71[_0xd82e('0xb')]+=0x1;return _0xfd3d71;}function getLastMessageText(_0x2ab534){return db[_0xd82e('0xf')][_0xd82e('0x10')]({'where':{'$and':[{'MailInteractionId':_0x2ab534['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd82e('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd82e('0x12')],'order':_0xd82e('0x13'),'raw':!![]})[_0xd82e('0x14')](function(_0x374e0a){if(_0x374e0a&&_0x374e0a['plainBody']){_0x2ab534['lastMsgText']=_[_0xd82e('0x15')](_0x374e0a[_0xd82e('0x12')]);}return _0x2ab534;})[_0xd82e('0x16')](function(_0x3f9caf){throw _0x3f9caf;});}exports[_0xd82e('0x17')]=function(_0xd40e93,_0x1a63d7,_0x44ac9d,_0x47dce4){return new Promise(function(_0x2992e7,_0x1d5f72){return getInteractionUsers(_0xd40e93['id'],_0x44ac9d)[_0xd82e('0x14')](function(_0x4a7774){_0xd40e93[_0xd82e('0x18')]=_0x4a7774;return getInteractionTags(_0xd40e93[_0xd82e('0x19')],_0x1a63d7);})[_0xd82e('0x14')](function(_0x56616f){_0xd40e93['Tags']=_0x56616f;delete _0xd40e93[_0xd82e('0x19')];return updateInteractionCounters(_0xd40e93);})['then'](function(_0x1c27d0){if(_0x47dce4){return getLastMessageText(_0x1c27d0);}else{return _0x1c27d0;}})[_0xd82e('0x14')](function(_0x186501){_0x2992e7(_0x186501);})['catch'](function(_0x23d862){_0x1d5f72(_0x23d862);});});};
\ No newline at end of file
+var _0x59f3=['catch','updateInteraction','TagIds','Tags','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','total','closed','disposition','abandoned','unmanaged','UserId','MailMessage','findOne','plainBody','then','lastMsgText','trimStart'];(function(_0x5c113a,_0x2b2da1){var _0x143b8e=function(_0x16d275){while(--_0x16d275){_0x5c113a['push'](_0x5c113a['shift']());}};_0x143b8e(++_0x2b2da1);}(_0x59f3,0x19c));var _0x359f=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x59f3[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x359f('0x0'));var db=require(_0x359f('0x1'))['db'];function getInteractionUsers(_0xa3dd23,_0x57ddbe){return new Promise(function(_0xd5d1bc,_0x245f88){try{var _0x58ad1a=[];if(_0x57ddbe[_0xa3dd23]){_0x58ad1a=_0x57ddbe[_0xa3dd23][_0x359f('0x2')](function(_0x80f529){return{'id':_0x80f529['id'],'fullname':_0x80f529['fullname']};});}return _0xd5d1bc(_0x58ad1a);}catch(_0x25add7){_0x245f88(_0x25add7);}});}function getInteractionTags(_0x905a20,_0x294259){var _0xfb74b4=[];if(_0x905a20){_0x905a20[_0x359f('0x3')](',')[_0x359f('0x4')](function(_0x31f4bc){_0xfb74b4[_0x359f('0x5')](_0x294259[_0x31f4bc]);});}return _0xfb74b4;}function updateWaitingCounter(_0x45a90b){if(_0x45a90b[_0x359f('0x6')]){_0x45a90b[_0x359f('0x6')]-=0x1;}}function updateInteractionCounters(_0x33b636){_0x33b636[_0x359f('0x6')]=0x0;_0x33b636[_0x359f('0x7')]=0x0;_0x33b636['answered']=0x0;_0x33b636['unmanaged']=0x0;_0x33b636['abandoned']=0x0;_0x33b636[_0x359f('0x8')]=0x0;if(_0x33b636[_0x359f('0x9')]){if(_0x33b636[_0x359f('0xa')]===_0x359f('0xb')){_0x33b636[_0x359f('0xb')]+=0x1;updateWaitingCounter(_0x33b636);}if(_0x33b636['UserId']){_0x33b636['answered']+=0x1;if(_0x33b636['talking']){_0x33b636['talking']-=0x1;}}else{if(_0x33b636[_0x359f('0xa')]){_0x33b636[_0x359f('0xc')]+=0x1;updateWaitingCounter(_0x33b636);}}}else{if(!_0x33b636[_0x359f('0xd')]){_0x33b636[_0x359f('0x6')]+=0x1;}if(_0x33b636[_0x359f('0xd')]){_0x33b636[_0x359f('0x7')]+=0x1;updateWaitingCounter(_0x33b636);}}_0x33b636[_0x359f('0x8')]+=0x1;return _0x33b636;}function getLastMessageText(_0x427756){return db[_0x359f('0xe')][_0x359f('0xf')]({'where':{'$and':[{'MailInteractionId':_0x427756['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x359f('0x10')],'order':'-id','raw':!![]})[_0x359f('0x11')](function(_0x53a531){if(_0x53a531&&_0x53a531[_0x359f('0x10')]){_0x427756[_0x359f('0x12')]=_[_0x359f('0x13')](_0x53a531[_0x359f('0x10')]);}return _0x427756;})[_0x359f('0x14')](function(_0x562058){throw _0x562058;});}exports[_0x359f('0x15')]=function(_0xc93931,_0x9e5e3,_0x3f29a4,_0x437424){return new Promise(function(_0x69f966,_0x34ee8d){return getInteractionUsers(_0xc93931['id'],_0x3f29a4)[_0x359f('0x11')](function(_0x4fd2f9){_0xc93931['Users']=_0x4fd2f9;return getInteractionTags(_0xc93931[_0x359f('0x16')],_0x9e5e3);})[_0x359f('0x11')](function(_0x42da7e){_0xc93931[_0x359f('0x17')]=_0x42da7e;delete _0xc93931['TagIds'];return updateInteractionCounters(_0xc93931);})[_0x359f('0x11')](function(_0x24acb4){if(_0x437424){return getLastMessageText(_0x24acb4);}else{return _0x24acb4;}})[_0x359f('0x11')](function(_0x2b8fdc){_0x69f966(_0x2b8fdc);})[_0x359f('0x14')](function(_0x4c2cbb){_0x34ee8d(_0x4c2cbb);});});};
\ No newline at end of file
index cc5b87c..6e48625 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f6d=['whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update','info','error','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions'];(function(_0x1c5a9a,_0x561145){var _0x5179b5=function(_0x465e4d){while(--_0x465e4d){_0x1c5a9a['push'](_0x1c5a9a['shift']());}};_0x5179b5(++_0x561145);}(_0x9f6d,0xda));var _0xd9f6=function(_0x2806f9,_0x3e6211){_0x2806f9=_0x2806f9-0x0;var _0xfc5f6e=_0x9f6d[_0x2806f9];return _0xfc5f6e;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xd9f6('0x0'))(_0xd9f6('0x1')),'mail':require('../../config/logger')(_0xd9f6('0x2')),'fax':require(_0xd9f6('0x0'))(_0xd9f6('0x3')),'sms':require(_0xd9f6('0x0'))(_0xd9f6('0x4')),'chat':require(_0xd9f6('0x0'))(_0xd9f6('0x5')),'whatsapp':require(_0xd9f6('0x0'))(_0xd9f6('0x6'))};function getAccountFK(_0x3d2cad){return _[_0xd9f6('0x7')](_0x3d2cad)+(_0x3d2cad==='chat'?_0xd9f6('0x8'):_0xd9f6('0x9'))+'Id';}function getInteractionFK(_0x5cc6d5){return _[_0xd9f6('0x7')](_0x5cc6d5)+_0xd9f6('0xa');}function getInteractionId(_0x5f523c,_0x458bdc,_0x35ea24){if(_0x5f523c&&_0x5f523c[_[_0xd9f6('0xb')](_0x35ea24)+_0xd9f6('0xa')]){return _0x5f523c[_[_0xd9f6('0xb')](_0x35ea24)+'InteractionId'];}else if(_0x5f523c&&_0x5f523c['id']){return _0x5f523c['id'];}else if(_0x458bdc&&_0x458bdc['id']){return _0x458bdc['id'];}else{return _0xd9f6('0xc');}}function getInteractionsTables(_0x1fa61f){return{'accounts':_0x1fa61f+'_'+(_0x1fa61f===_0xd9f6('0xd')?_0xd9f6('0xe'):'accounts'),'interactions':_0x1fa61f+_0xd9f6('0xf'),'interactionsTags':_0x1fa61f+_0xd9f6('0x10'),'messages':_0x1fa61f+_0xd9f6('0x11'),'userInteractions':_0xd9f6('0x12')+_0x1fa61f+'_interactions'};}function getSelectedTags(_0x431ca0){var _0x409e12=[];if(_0x431ca0){_0x409e12=Array[_0xd9f6('0x13')](_0x431ca0)?_0x431ca0:[_0x431ca0];}return _0x409e12;}function log(_0xc16085,_0x5d77db,_0x322555,_0x3972ae,_0x9ce98f,_0x39d0c1){loggers[_0x9ce98f[_0xd9f6('0x14')]()][_0xc16085](_0xd9f6('0x15'),_0x39d0c1[_0xd9f6('0x16')](),_0x5d77db?_0x5d77db['id']:null,_0x5d77db?_0x5d77db[_0xd9f6('0x17')]:null,_0x5d77db?_0x5d77db[_0xd9f6('0x18')]:null,getInteractionId(_0x322555,_0x3972ae,_0x9ce98f),_0x322555?JSON[_0xd9f6('0x19')](_0x322555):_0xd9f6('0x1a'));}function updateUser(_0x4b4e36,_0xbce4fb,_0x4f8d7e,_0x37c59a,_0x25fce7){db[_[_0xd9f6('0xb')](_0x37c59a)+'Interaction'][_0xd9f6('0x1b')]({'where':{'id':getInteractionId(_0xbce4fb,_0x4f8d7e,_0x37c59a)}})[_0xd9f6('0x1c')](function(_0xc7f6c8){if(_0xc7f6c8){return _0xc7f6c8[_0xd9f6('0x1d')]({'UserId':_0x4b4e36?_0x4b4e36['id']:null});}})['then'](function(_0x26cc24){if(_0x26cc24){log(_0xd9f6('0x1e'),_0x4b4e36,_0xbce4fb,_0x4f8d7e,_0x37c59a,_0x25fce7);}})['catch'](function(){log(_0xd9f6('0x1f'),_0x4b4e36,_0xbce4fb,_0x4f8d7e,_0x37c59a,_0x25fce7);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file
+var _0x01a6=['update','info','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','then'];(function(_0x57be59,_0x2f1d25){var _0x23d1aa=function(_0x9abad9){while(--_0x9abad9){_0x57be59['push'](_0x57be59['shift']());}};_0x23d1aa(++_0x2f1d25);}(_0x01a6,0x178));var _0x601a=function(_0x268665,_0x33c578){_0x268665=_0x268665-0x0;var _0x52f0f6=_0x01a6[_0x268665];return _0x52f0f6;};'use strict';var _=require(_0x601a('0x0'));var db=require(_0x601a('0x1'))['db'];var loggers={'openchannel':require(_0x601a('0x2'))(_0x601a('0x3')),'mail':require(_0x601a('0x2'))('mail-interactions'),'fax':require(_0x601a('0x2'))(_0x601a('0x4')),'sms':require(_0x601a('0x2'))(_0x601a('0x5')),'chat':require(_0x601a('0x2'))('chat-interactions'),'whatsapp':require(_0x601a('0x2'))(_0x601a('0x6'))};function getAccountFK(_0x4b4e11){return _[_0x601a('0x7')](_0x4b4e11)+(_0x4b4e11===_0x601a('0x8')?_0x601a('0x9'):_0x601a('0xa'))+'Id';}function getInteractionFK(_0x4ea646){return _['capitalize'](_0x4ea646)+_0x601a('0xb');}function getInteractionId(_0x54484a,_0x589eb1,_0x5c2403){if(_0x54484a&&_0x54484a[_[_0x601a('0xc')](_0x5c2403)+_0x601a('0xb')]){return _0x54484a[_[_0x601a('0xc')](_0x5c2403)+'InteractionId'];}else if(_0x54484a&&_0x54484a['id']){return _0x54484a['id'];}else if(_0x589eb1&&_0x589eb1['id']){return _0x589eb1['id'];}else{return _0x601a('0xd');}}function getInteractionsTables(_0x209ed5){return{'accounts':_0x209ed5+'_'+(_0x209ed5===_0x601a('0x8')?'websites':_0x601a('0xe')),'interactions':_0x209ed5+_0x601a('0xf'),'interactionsTags':_0x209ed5+'_interaction_has_tags','messages':_0x209ed5+_0x601a('0x10'),'userInteractions':_0x601a('0x11')+_0x209ed5+'_interactions'};}function getSelectedTags(_0x2c4665){var _0xdc77c=[];if(_0x2c4665){_0xdc77c=Array[_0x601a('0x12')](_0x2c4665)?_0x2c4665:[_0x2c4665];}return _0xdc77c;}function log(_0x31f143,_0x5db250,_0x27dc56,_0x240111,_0x2acf97,_0x4d4762){loggers[_0x2acf97[_0x601a('0x13')]()][_0x31f143]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d4762[_0x601a('0x14')](),_0x5db250?_0x5db250['id']:null,_0x5db250?_0x5db250[_0x601a('0x15')]:null,_0x5db250?_0x5db250[_0x601a('0x16')]:null,getInteractionId(_0x27dc56,_0x240111,_0x2acf97),_0x27dc56?JSON[_0x601a('0x17')](_0x27dc56):_0x601a('0x18'));}function updateUser(_0x5e20aa,_0x35f7ce,_0x44a369,_0x5c4617,_0x14e105){db[_['upperFirst'](_0x5c4617)+_0x601a('0x19')]['findOne']({'where':{'id':getInteractionId(_0x35f7ce,_0x44a369,_0x5c4617)}})[_0x601a('0x1a')](function(_0x26f462){if(_0x26f462){return _0x26f462[_0x601a('0x1b')]({'UserId':_0x5e20aa?_0x5e20aa['id']:null});}})[_0x601a('0x1a')](function(_0x416488){if(_0x416488){log(_0x601a('0x1c'),_0x5e20aa,_0x35f7ce,_0x44a369,_0x5c4617,_0x14e105);}})['catch'](function(){log(_0x601a('0x1d'),_0x5e20aa,_0x35f7ce,_0x44a369,_0x5c4617,_0x14e105);});}module[_0x601a('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file
index 5a2235b..ec3bba8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x089a=['users','User','admin','user','isUserLimit','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x316d81,_0x6516bb){var _0x5e777e=function(_0x56640f){while(--_0x56640f){_0x316d81['push'](_0x316d81['shift']());}};_0x5e777e(++_0x6516bb);}(_0x089a,0x157));var _0xa089=function(_0x26283f,_0x1cd35b){_0x26283f=_0x26283f-0x0;var _0x2bb55b=_0x089a[_0x26283f];return _0x2bb55b;};'use strict';var crypto=require('crypto');var util=require(_0xa089('0x0'));var compose=require(_0xa089('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xa089('0x2'));function getValueFromLicense(_0x40d2c,_0x4f29d3){if(_0x40d2c&&_0x4f29d3){if(_0x4f29d3[_0xa089('0x3')]&&_0x4f29d3[_0xa089('0x4')]){var _0x13a0d8=_0x4f29d3[_0xa089('0x3')];var _0x54256b=_0x4f29d3[_0xa089('0x4')];var _0x1c3ae0=_0x13a0d8['split']('-')[0x4];var _0x507fdc=_0x13a0d8[_0xa089('0x5')]('-')[0x0];var _0x302001=crypto[_0xa089('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0x1c3ae0,_0x13a0d8,_0x507fdc));var _0x53ab94=_0x302001[_0xa089('0x7')](_0x54256b,_0xa089('0x8'),_0xa089('0x9'));_0x53ab94+=_0x302001[_0xa089('0xa')](_0xa089('0x9'));var _0x269819=JSON[_0xa089('0xb')](_0x53ab94);return _0x269819[_0xa089('0xc')](_0x40d2c)?_0x269819[_0x40d2c]:null;}}return null;}function isLimit(_0x11aad8,_0x40931e,_0x2ffc65,_0x5b96fd){var _0x15323c=_0x40931e;return compose()['use'](function(_0x3192c1,_0x5d95f0,_0xe21670){return db[_0xa089('0xd')][_0xa089('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xa089('0xf')](function(_0x48faba){var _0x3295b7=getValueFromLicense(_0x11aad8,_0x48faba);return _0x3295b7?_0x3295b7:_0x15323c;})['then'](function(_0x2e8478){_0x15323c=_0x2e8478;return _0x2ffc65[_0xa089('0x10')](_0x5b96fd);})[_0xa089('0xf')](function(_0x38eb6e){if(_0x38eb6e>=_0x15323c){return _0x5d95f0[_0xa089('0x11')](0x193)[_0xa089('0x12')]({'message':util['format'](_0xa089('0x13'),_0x11aad8)});}_0xe21670();})[_0xa089('0x14')](function(_0x2328b5){_0xe21670(_0x2328b5);});});}function isUserLimit(){return isLimit(_0xa089('0x15'),0x1,db[_0xa089('0x16')],{'where':{'$or':[{'role':_0xa089('0x17')},{'role':_0xa089('0x18')}]}});}exports[_0xa089('0x19')]=isUserLimit;
\ No newline at end of file
+var _0xc775=['split','format','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x1a4760,_0x5f4453){var _0x433f85=function(_0x4235ef){while(--_0x4235ef){_0x1a4760['push'](_0x1a4760['shift']());}};_0x433f85(++_0x5f4453);}(_0xc775,0xe3));var _0x5c77=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc775[_0x502c7d];return _0x30b7ed;};'use strict';var crypto=require(_0x5c77('0x0'));var util=require(_0x5c77('0x1'));var compose=require(_0x5c77('0x2'));var db=require(_0x5c77('0x3'))['db'];var config=require(_0x5c77('0x4'));function getValueFromLicense(_0x5d22c4,_0x55e1d2){if(_0x5d22c4&&_0x55e1d2){if(_0x55e1d2[_0x5c77('0x5')]&&_0x55e1d2[_0x5c77('0x6')]){var _0x320a2a=_0x55e1d2[_0x5c77('0x5')];var _0x335751=_0x55e1d2['license'];var _0x344e7f=_0x320a2a[_0x5c77('0x7')]('-')[0x4];var _0x11127a=_0x320a2a[_0x5c77('0x7')]('-')[0x0];var _0x4c6667=crypto['createDecipher']('aes-256-ctr',util[_0x5c77('0x8')]('%s:%s:%s',_0x344e7f,_0x320a2a,_0x11127a));var _0x37fe04=_0x4c6667[_0x5c77('0x9')](_0x335751,_0x5c77('0xa'),_0x5c77('0xb'));_0x37fe04+=_0x4c6667[_0x5c77('0xc')]('utf8');var _0xe89a69=JSON[_0x5c77('0xd')](_0x37fe04);return _0xe89a69[_0x5c77('0xe')](_0x5d22c4)?_0xe89a69[_0x5d22c4]:null;}}return null;}function isLimit(_0x3b4503,_0x1d6e7a,_0x3fc2f4,_0x5911a8){var _0x323579=_0x1d6e7a;return compose()['use'](function(_0x2e4642,_0x2948ed,_0x11c982){return db[_0x5c77('0xf')][_0x5c77('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x5c77('0x11')](function(_0x2c277d){var _0x144719=getValueFromLicense(_0x3b4503,_0x2c277d);return _0x144719?_0x144719:_0x323579;})['then'](function(_0x43f067){_0x323579=_0x43f067;return _0x3fc2f4[_0x5c77('0x12')](_0x5911a8);})[_0x5c77('0x11')](function(_0xa55767){if(_0xa55767>=_0x323579){return _0x2948ed['status'](0x193)[_0x5c77('0x13')]({'message':util['format'](_0x5c77('0x14'),_0x3b4503)});}_0x11c982();})[_0x5c77('0x15')](function(_0x3f7ce0){_0x11c982(_0x3f7ce0);});});}function isUserLimit(){return isLimit(_0x5c77('0x16'),0x1,db[_0x5c77('0x17')],{'where':{'$or':[{'role':_0x5c77('0x18')},{'role':'user'}]}});}exports[_0x5c77('0x19')]=isUserLimit;
\ No newline at end of file
index a4f33ab..bff350e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x48bd=['add','days','format','castTo','text','CAST(','field','\x20AS\x20','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','pop','utcOffset','minutes','moment','sqlOperator','startsWith','[$or]','[$and]','replace','split','length','slice','match','forEach','filter','map','conditions','buildExpression','DATE','operator','$eq','value','includes','$lte'];(function(_0x4c24e0,_0x23aca7){var _0x4aec0b=function(_0x44ef5c){while(--_0x44ef5c){_0x4c24e0['push'](_0x4c24e0['shift']());}};_0x4aec0b(++_0x23aca7);}(_0x48bd,0xc3));var _0xd48b=function(_0x42c10b,_0x10700d){_0x42c10b=_0x42c10b-0x0;var _0x25aff8=_0x48bd[_0x42c10b];return _0x25aff8;};'use strict';var _=require('lodash');var moment=require(_0xd48b('0x0'));exports['parseSearch']=function(_0x3a266b){var _0x5ea1c8={'conditions':[]};_0x5ea1c8[_0xd48b('0x1')]=_[_0xd48b('0x2')](_0x3a266b,_0xd48b('0x3'))?'or':'and';var _0x209515=_0x3a266b['replace'](_0xd48b('0x4'),'')[_0xd48b('0x5')]('[$or]','')[_0xd48b('0x6')]('||');for(var _0x48fc07=0x0;_0x48fc07<_0x209515[_0xd48b('0x7')];_0x48fc07++){var _0x582014=_0x209515[_0x48fc07][_0xd48b('0x6')](':=');var _0x492487=_0x582014[0x0];var _0x96ade=_0x582014[_0xd48b('0x8')](0x1);_0x96ade['forEach'](function(_0xadaf07){var _0x29557d=_0xadaf07[_0xd48b('0x6')]('[')['shift']();var _0x4ffc1d=_0xadaf07[_0xd48b('0x9')](/\[(.*?)\]/g);_0x4ffc1d[_0xd48b('0xa')](function(_0x31907f){var _0x19fbea=_0x31907f[_0xd48b('0x6')]('[')[_0xd48b('0xb')](function(_0x20b60b){return _0x20b60b['indexOf'](']')>-0x1;})[_0xd48b('0xc')](function(_0x3f46ef){return _0x3f46ef[_0xd48b('0x6')](']')[0x0];})[0x0];_0x5ea1c8[_0xd48b('0xd')]['push']({'field':_0x492487,'operator':_0x29557d,'value':_0x19fbea});});});}return _0x5ea1c8;};exports[_0xd48b('0xe')]=function(_0x1855de,_0x18c4e5,_0x4a6705){var _0x3a701a={};if(_0x18c4e5===_0xd48b('0xf')){if(_0x4a6705[_0xd48b('0x10')]===_0xd48b('0x11')){_0x4a6705[_0xd48b('0x10')]='$between';_0x4a6705['value']+=','+_0x4a6705[_0xd48b('0x12')];}else if(_[_0xd48b('0x13')](['$gt',_0xd48b('0x14')],_0x4a6705[_0xd48b('0x10')])){_0x4a6705[_0xd48b('0x12')]=moment(_0x4a6705[_0xd48b('0x12')])[_0xd48b('0x15')](0x1,_0xd48b('0x16'))[_0xd48b('0x17')]('YYYY-MM-DD');}}if(_0x4a6705[_0xd48b('0x18')]){_0x18c4e5=_0x4a6705[_0xd48b('0x18')];_0x3a701a[_0xd48b('0x19')]=_0xd48b('0x1a')+_0x1855de+'.'+_0x4a6705[_0xd48b('0x1b')]+_0xd48b('0x1c')+_0x4a6705[_0xd48b('0x18')]+')\x20'+parseOperator(_0x4a6705[_0xd48b('0x10')]);}else{_0x3a701a['text']=_0x1855de+'.'+_0x4a6705[_0xd48b('0x1b')]+'\x20'+parseOperator(_0x4a6705[_0xd48b('0x10')]);}if(_[_0xd48b('0x13')](['$ne','$notIn'],_0x4a6705[_0xd48b('0x10')]))_0x3a701a[_0xd48b('0x19')]='('+_0x3a701a[_0xd48b('0x19')]+_0xd48b('0x1d')+_0x1855de+'.'+_0x4a6705[_0xd48b('0x1b')]+_0xd48b('0x1e');_0x3a701a[_0xd48b('0x12')]=parseValue(_0x18c4e5,_0x4a6705['operator'],_0x4a6705[_0xd48b('0x12')]);return _0x3a701a;};function parseOperator(_0x509829){var _0x80d5b5;switch(_0x509829){case _0xd48b('0x1f'):_0x80d5b5=_0xd48b('0x20');break;case _0xd48b('0x21'):_0x80d5b5=_0xd48b('0x22');break;case _0xd48b('0x11'):_0x80d5b5=_0xd48b('0x23');break;case _0xd48b('0x24'):_0x80d5b5=_0xd48b('0x25');break;case'$substring':case _0xd48b('0x26'):case'$endsWith':_0x80d5b5=_0xd48b('0x27');break;case _0xd48b('0x28'):_0x80d5b5='<\x20?';break;case _0xd48b('0x29'):_0x80d5b5=_0xd48b('0x2a');break;case'$lte':_0x80d5b5=_0xd48b('0x2b');break;case _0xd48b('0x2c'):_0x80d5b5=_0xd48b('0x2d');break;case _0xd48b('0x2e'):_0x80d5b5=_0xd48b('0x2f');break;}return _0x80d5b5;}function parseValue(_0x5cf84b,_0x335745,_0x57c31b){var _0x3d5aad={'start':undefined,'end':undefined};switch(_0x335745){case _0xd48b('0x1f'):case'$notIn':_0x3d5aad[_0xd48b('0x30')]=_0x57c31b[_0xd48b('0x6')](',');break;case _0xd48b('0x31'):_0x3d5aad[_0xd48b('0x30')]='%'+_0x57c31b+'%';break;case _0xd48b('0x26'):_0x3d5aad['start']=_0x57c31b+'%';break;case _0xd48b('0x32'):_0x3d5aad['start']='%'+_0x57c31b;break;case _0xd48b('0x2e'):var _0x119674=_0x57c31b[_0xd48b('0x6')](',');var _0x57c31b=_0x119674['shift']();var _0x51c67e=_0x119674[_0xd48b('0x33')]();if(_0x5cf84b===_0xd48b('0xf')){_0x57c31b=moment(_0x57c31b)[_0xd48b('0x34')](0x0,!![])[_0xd48b('0x17')]();_0x51c67e=moment(_0x51c67e)[_0xd48b('0x34')](0x0,!![])[_0xd48b('0x15')](0x17,'hours')['add'](0x3b,_0xd48b('0x35'))[_0xd48b('0x15')](0x3b,'seconds')['format']();}_0x3d5aad={'start':_0x57c31b,'end':_0x51c67e};break;default:_0x3d5aad[_0xd48b('0x30')]=_0x57c31b;break;}return _0x3d5aad;}
\ No newline at end of file
+var _0xd6a0=['indexOf','map','conditions','push','DATE','operator','$eq','$between','includes','$lte','value','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','<\x20?','$gt','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','format','utcOffset','add','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0xd6a0,0x104));var _0x0d6a=function(_0x1facf8,_0x4ff50d){_0x1facf8=_0x1facf8-0x0;var _0x317d7e=_0xd6a0[_0x1facf8];return _0x317d7e;};'use strict';var _=require('lodash');var moment=require(_0x0d6a('0x0'));exports[_0x0d6a('0x1')]=function(_0x1af646){var _0x3ecf3e={'conditions':[]};_0x3ecf3e[_0x0d6a('0x2')]=_[_0x0d6a('0x3')](_0x1af646,_0x0d6a('0x4'))?'or':_0x0d6a('0x5');var _0x1654b2=_0x1af646[_0x0d6a('0x6')](_0x0d6a('0x7'),'')[_0x0d6a('0x6')](_0x0d6a('0x4'),'')[_0x0d6a('0x8')]('||');for(var _0xa5a757=0x0;_0xa5a757<_0x1654b2[_0x0d6a('0x9')];_0xa5a757++){var _0x4d855e=_0x1654b2[_0xa5a757][_0x0d6a('0x8')](':=');var _0x419494=_0x4d855e[0x0];var _0x454aed=_0x4d855e[_0x0d6a('0xa')](0x1);_0x454aed[_0x0d6a('0xb')](function(_0x13feb1){var _0x22a2cb=_0x13feb1[_0x0d6a('0x8')]('[')[_0x0d6a('0xc')]();var _0x3053a9=_0x13feb1[_0x0d6a('0xd')](/\[(.*?)\]/g);_0x3053a9['forEach'](function(_0x3103ca){var _0x133e9a=_0x3103ca[_0x0d6a('0x8')]('[')[_0x0d6a('0xe')](function(_0x4db2f2){return _0x4db2f2[_0x0d6a('0xf')](']')>-0x1;})[_0x0d6a('0x10')](function(_0x2e245b){return _0x2e245b[_0x0d6a('0x8')](']')[0x0];})[0x0];_0x3ecf3e[_0x0d6a('0x11')][_0x0d6a('0x12')]({'field':_0x419494,'operator':_0x22a2cb,'value':_0x133e9a});});});}return _0x3ecf3e;};exports['buildExpression']=function(_0x58e1be,_0x958b02,_0x5ec7f0){var _0x1d5034={};if(_0x958b02===_0x0d6a('0x13')){if(_0x5ec7f0[_0x0d6a('0x14')]===_0x0d6a('0x15')){_0x5ec7f0[_0x0d6a('0x14')]=_0x0d6a('0x16');_0x5ec7f0['value']+=','+_0x5ec7f0['value'];}else if(_[_0x0d6a('0x17')](['$gt',_0x0d6a('0x18')],_0x5ec7f0['operator'])){_0x5ec7f0[_0x0d6a('0x19')]=moment(_0x5ec7f0[_0x0d6a('0x19')])['add'](0x1,'days')['format'](_0x0d6a('0x1a'));}}if(_0x5ec7f0[_0x0d6a('0x1b')]){_0x958b02=_0x5ec7f0[_0x0d6a('0x1b')];_0x1d5034[_0x0d6a('0x1c')]=_0x0d6a('0x1d')+_0x58e1be+'.'+_0x5ec7f0['field']+_0x0d6a('0x1e')+_0x5ec7f0[_0x0d6a('0x1b')]+')\x20'+parseOperator(_0x5ec7f0['operator']);}else{_0x1d5034[_0x0d6a('0x1c')]=_0x58e1be+'.'+_0x5ec7f0[_0x0d6a('0x1f')]+'\x20'+parseOperator(_0x5ec7f0[_0x0d6a('0x14')]);}if(_[_0x0d6a('0x17')]([_0x0d6a('0x20'),_0x0d6a('0x21')],_0x5ec7f0[_0x0d6a('0x14')]))_0x1d5034[_0x0d6a('0x1c')]='('+_0x1d5034[_0x0d6a('0x1c')]+_0x0d6a('0x22')+_0x58e1be+'.'+_0x5ec7f0[_0x0d6a('0x1f')]+_0x0d6a('0x23');_0x1d5034[_0x0d6a('0x19')]=parseValue(_0x958b02,_0x5ec7f0[_0x0d6a('0x14')],_0x5ec7f0['value']);return _0x1d5034;};function parseOperator(_0x2b11be){var _0x473a1a;switch(_0x2b11be){case _0x0d6a('0x24'):_0x473a1a=_0x0d6a('0x25');break;case'$notIn':_0x473a1a=_0x0d6a('0x26');break;case _0x0d6a('0x15'):_0x473a1a='=\x20?';break;case _0x0d6a('0x20'):_0x473a1a=_0x0d6a('0x27');break;case _0x0d6a('0x28'):case _0x0d6a('0x29'):case _0x0d6a('0x2a'):_0x473a1a='LIKE\x20?';break;case'$lt':_0x473a1a=_0x0d6a('0x2b');break;case _0x0d6a('0x2c'):_0x473a1a=_0x0d6a('0x2d');break;case _0x0d6a('0x18'):_0x473a1a=_0x0d6a('0x2e');break;case _0x0d6a('0x2f'):_0x473a1a='>=\x20?';break;case _0x0d6a('0x16'):_0x473a1a=_0x0d6a('0x30');break;}return _0x473a1a;}function parseValue(_0x20984e,_0xd8bb15,_0xb5d9c9){var _0x1c2167={'start':undefined,'end':undefined};switch(_0xd8bb15){case _0x0d6a('0x24'):case'$notIn':_0x1c2167['start']=_0xb5d9c9[_0x0d6a('0x8')](',');break;case'$substring':_0x1c2167['start']='%'+_0xb5d9c9+'%';break;case _0x0d6a('0x29'):_0x1c2167['start']=_0xb5d9c9+'%';break;case _0x0d6a('0x2a'):_0x1c2167[_0x0d6a('0x31')]='%'+_0xb5d9c9;break;case _0x0d6a('0x16'):var _0x4fef7e=_0xb5d9c9[_0x0d6a('0x8')](',');var _0xb5d9c9=_0x4fef7e[_0x0d6a('0xc')]();var _0x2e7c0c=_0x4fef7e['pop']();if(_0x20984e===_0x0d6a('0x13')){_0xb5d9c9=moment(_0xb5d9c9)['utcOffset'](0x0,!![])[_0x0d6a('0x32')]();_0x2e7c0c=moment(_0x2e7c0c)[_0x0d6a('0x33')](0x0,!![])[_0x0d6a('0x34')](0x17,_0x0d6a('0x35'))['add'](0x3b,'minutes')[_0x0d6a('0x34')](0x3b,_0x0d6a('0x36'))[_0x0d6a('0x32')]();}_0x1c2167={'start':_0xb5d9c9,'end':_0x2e7c0c};break;default:_0x1c2167[_0x0d6a('0x31')]=_0xb5d9c9;break;}return _0x1c2167;}
\ No newline at end of file
index f7f0735..4b55b99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb138=['filters','intersection','attributes','limit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','col','priority','substr','DESC','cast','unsigned','ASC','length','omit','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model'];(function(_0xa82c60,_0x3f05bf){var _0x291fef=function(_0x31feda){while(--_0x31feda){_0xa82c60['push'](_0xa82c60['shift']());}};_0x291fef(++_0x3f05bf);}(_0xb138,0x1dd));var _0x8b13=function(_0x2b6a06,_0x43df66){_0x2b6a06=_0x2b6a06-0x0;var _0xcdac20=_0xb138[_0x2b6a06];return _0xcdac20;};'use strict';var _=require(_0x8b13('0x0'));var sequelize=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33f214){var _0xadad70=['ne'];try{var _0x185752=JSON[_0x8b13('0x3')](_0x33f214);var _0x5369d4=Object[_0x8b13('0x4')](_0x185752)[0x0];return _0xadad70[_0x8b13('0x5')](_0x5369d4);}catch(_0x3af81a){return![];}}function getOperatorValue(_0x5ae5b2){var _0xd19a0f=JSON[_0x8b13('0x3')](_0x5ae5b2);var _0x5d51b1=Object[_0x8b13('0x4')](_0xd19a0f)[0x0];var _0x33d1a7=_0xd19a0f[_0x5d51b1];return{['$'+_0x5d51b1]:_0x33d1a7};}exports[_0x8b13('0x6')]=function(_0x498832){var _0x8570b0=null;if(_0x498832){_0x8570b0=_0x498832[_0x8b13('0x7')](',');}return _0x8570b0;};exports['filters']=function(_0x53ae50,_0x1f2528){var _0x21fcd9={};if(!_[_0x8b13('0x8')](_0x53ae50)){_[_0x8b13('0x9')](_0x53ae50,function(_0x3e8eca,_0x51f070){try{if(_0x1f2528){var _0x11bc89=_[_0x8b13('0xa')](_0x1f2528,{'name':_0x51f070})||{};if(hasSequelizeOperator(_0x3e8eca)){_0x21fcd9[_0x51f070]=getOperatorValue(_0x3e8eca);}else if(_0x11bc89[_0x8b13('0xb')]===_0x8b13('0xc')&&_[_0x8b13('0xd')](_0x3e8eca)){var _0x1893b1=JSON['parse'](_0x3e8eca);var _0x50e7a4={'$gte':moment(moment(_0x1893b1[_0x8b13('0xe')])[_0x8b13('0xf')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x1893b1[_0x8b13('0x10')])[_0x8b13('0xf')](_0x8b13('0x11')))[_0x8b13('0x12')]()[_0x8b13('0x13')](0x1,'s')['format']()};_0x21fcd9[_0x51f070]=_0x50e7a4;}else if(_0x11bc89[_0x8b13('0x14')]===_0x8b13('0x15')){_0x21fcd9[_0x51f070]=_0x3e8eca;}else{_0x21fcd9[_0x51f070]=_[_0x8b13('0x16')](_0x3e8eca)?_0x3e8eca:JSON[_0x8b13('0x3')](_0x3e8eca);}}else{_0x21fcd9[_0x51f070]=_[_0x8b13('0x16')](_0x3e8eca)?_0x3e8eca:JSON[_0x8b13('0x3')](_0x3e8eca);}}catch(_0x10fbde){_0x21fcd9[_0x51f070]=_0x3e8eca[_0x8b13('0x7')](',');}});}return _0x21fcd9;};exports['limit']=function(_0x4dac71){_0x4dac71=parseInt(_0x4dac71,0xa);if(!_0x4dac71||_0x4dac71<0x0){_0x4dac71=LIMIT_VALUE;}return _0x4dac71;};exports[_0x8b13('0x17')]=function(_0x335709){_0x335709=parseInt(_0x335709,0xa);if(!_0x335709||_0x335709<0x0){_0x335709=0x0;}return _0x335709;};exports[_0x8b13('0x18')]=function(_0x9c03b4){var _0x1e0fe3,_0x3cc9a0=null;if(_0x9c03b4){_0x1e0fe3=_0x9c03b4['split'](',');_0x3cc9a0=_[_0x8b13('0x19')](_0x1e0fe3,function(_0x3c4d4f){if(_0x3c4d4f[_0x8b13('0x1a')]('-')===0x0){return[_0x3c4d4f==='priority'?sequelize['cast'](sequelize[_0x8b13('0x1b')](_0x8b13('0x1c')),'unsigned'):_0x3c4d4f[_0x8b13('0x1d')](0x1),_0x8b13('0x1e')];}else{return[_0x3c4d4f===_0x8b13('0x1c')?sequelize[_0x8b13('0x1f')](sequelize[_0x8b13('0x1b')]('priority'),_0x8b13('0x20')):_0x3c4d4f,_0x8b13('0x21')];}});}return _0x3cc9a0;};exports['omit']=function(_0x33422f,_0x4fdd1c){if(_[_0x8b13('0x8')](_0x33422f)){return _0x33422f;}if(_[_0x8b13('0x16')](_0x33422f)){for(var _0x54786a=0x0;_0x54786a<_0x33422f[_0x8b13('0x22')];_0x54786a+=0x1){_0x33422f[_0x54786a]=this[_0x8b13('0x23')](_0x33422f[_0x54786a],_0x4fdd1c);}return _0x33422f;}if(!_['isObject'](_0x33422f)){return _0x33422f;}if(_[_0x8b13('0x24')](_0x4fdd1c)){_0x4fdd1c=[_0x4fdd1c];}if(!_[_0x8b13('0x16')](_0x4fdd1c)){return _0x33422f;}for(var _0x410122=0x0;_0x410122<_0x4fdd1c[_0x8b13('0x22')];_0x410122+=0x1){_[_0x8b13('0x25')](_0x33422f,_0x4fdd1c[_0x410122]);}for(var _0x54cdfc in _0x33422f){if(_0x33422f[_0x8b13('0x26')](_0x54cdfc)){_0x33422f[_0x54cdfc]=this[_0x8b13('0x23')](_0x33422f[_0x54cdfc],_0x4fdd1c);}}return _0x33422f;};exports[_0x8b13('0x27')]=function(_0x1511bf){return _0x1511bf[_0x8b13('0x28')](RegExp(_0x8b13('0x29')))?!![]:![];};exports['isEmail']=function(_0x35fdca){return _0x35fdca[_0x8b13('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x8b13('0x2a')]=function(_0x9d2377){var _0x23fde7=[];_0x9d2377[_0x8b13('0x7')](/[ ,]+/)[_0x8b13('0x2b')](function(_0x44bce2){_0x44bce2=_0x44bce2[_0x8b13('0x2c')](/([^:]")"+/g,'$1');_0x44bce2='+'+_0x44bce2+'*';var _0x5751db=/[ `!@#$%^&*()_\-?~]/;if(_0x44bce2[_0x8b13('0x28')](_0x5751db))_0x44bce2='\x22'+_0x44bce2+'\x22';_0x23fde7[_0x8b13('0x2d')](_0x44bce2);});return _0x23fde7[_0x8b13('0x2e')]('\x20');};exports[_0x8b13('0x2f')]=function(_0x51a334,_0x4f7d91,_0xb7771d){var _0x5cedea={},_0x5663fa={};if(_0x4f7d91[_0x8b13('0x30')]['$id']){_0x4f7d91[_0x8b13('0x30')]['id']=_0x4f7d91[_0x8b13('0x30')][_0x8b13('0x31')];delete _0x4f7d91[_0x8b13('0x30')][_0x8b13('0x31')];}_0x5cedea[_0x8b13('0x32')]=_[_0x8b13('0x19')](_0x51a334,_0x8b13('0x14'));_0x5cedea[_0x8b13('0x30')]=_[_0x8b13('0x4')](_0x4f7d91['query']);_0x5cedea[_0x8b13('0x33')]=_[_0x8b13('0x34')](_0x5cedea[_0x8b13('0x32')],_0x5cedea[_0x8b13('0x30')]);_0x5663fa[_0x8b13('0x35')]=_[_0x8b13('0x34')](_0x5cedea[_0x8b13('0x32')],this[_0x8b13('0x6')](_0x4f7d91['query'][_0x8b13('0x6')]));_0x5663fa['attributes']=_0x5663fa[_0x8b13('0x35')][_0x8b13('0x22')]?_0x5663fa[_0x8b13('0x35')]:_0x5cedea[_0x8b13('0x32')];if(!_0x4f7d91[_0x8b13('0x30')][_0x8b13('0x26')]('nolimit')){_0x5663fa['limit']=this[_0x8b13('0x36')](_0x4f7d91['query'][_0x8b13('0x36')]);_0x5663fa['offset']=this[_0x8b13('0x17')](_0x4f7d91[_0x8b13('0x30')][_0x8b13('0x17')]);}_0x5663fa[_0x8b13('0x37')]=this[_0x8b13('0x18')](_0x4f7d91['query']['sort']);_0x5663fa[_0x8b13('0x38')]=this['filters'](_[_0x8b13('0x39')](_0x4f7d91[_0x8b13('0x30')],_0x5cedea['filters']),_0x51a334);if(_0x4f7d91[_0x8b13('0x30')][_0x8b13('0x3a')]){var _0x35c1d6=_0x51a334;var _0x81b931=_0x4f7d91[_0x8b13('0x30')][_0x8b13('0x3a')];if(typeof _0x81b931===_0x8b13('0x3b')){_0x35c1d6=_['filter'](_0x51a334,function(_0x5a3f5c){return _['includes'](_0x81b931[_0x8b13('0x3c')],_0x5a3f5c[_0x8b13('0x14')]);});_0x81b931=_0x81b931[_0x8b13('0x3d')];}_0x5663fa[_0x8b13('0x38')]=_[_0x8b13('0x3e')](_0x5663fa[_0x8b13('0x38')],{'$or':_['map'](_0x35c1d6,function(_0x4342db){if(_0x4342db['type']!==_0x8b13('0x3f')){if(_0xb7771d){return sequelize['where'](sequelize['fn'](_0x8b13('0x40'),sequelize[_0x8b13('0x1b')](_0x4342db[_0x8b13('0x14')])),{'$like':sequelize['fn'](_0x8b13('0x40'),'%'+_0x4f7d91[_0x8b13('0x30')][_0x8b13('0x3a')]+'%')});}else{var _0x2009a1={};_0x2009a1[_0x4342db['name']]={'$like':'%'+_0x4f7d91['query']['filter']+'%'};return _0x2009a1;}}})});}_0x5663fa=_[_0x8b13('0x3e')]({},_0x5663fa,_0x4f7d91[_0x8b13('0x41')]);return _0x5663fa;};
\ No newline at end of file
+var _0xef17=['ASC','omit','length','isObject','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','getFullTextValue','match','query','$id','model','attributes','intersection','nolimit','limit','order','where','pick','filter','object','includes','columns','value','merge','map','type','lower','options','lodash','sequelize','moment','parse','keys','fields','split','filters','isEmpty','forOwn','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','isArray','offset','sort','indexOf','priority','cast','col','unsigned','substr'];(function(_0x65bf20,_0xa669ce){var _0x43cfb1=function(_0x58e140){while(--_0x58e140){_0x65bf20['push'](_0x65bf20['shift']());}};_0x43cfb1(++_0xa669ce);}(_0xef17,0x136));var _0x7ef1=function(_0x577a6a,_0x1bd745){_0x577a6a=_0x577a6a-0x0;var _0x5c39b1=_0xef17[_0x577a6a];return _0x5c39b1;};'use strict';var _=require(_0x7ef1('0x0'));var sequelize=require(_0x7ef1('0x1'));var moment=require(_0x7ef1('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x11f6b7){var _0x601558=['ne'];try{var _0x2c0aac=JSON[_0x7ef1('0x3')](_0x11f6b7);var _0x19a10d=Object[_0x7ef1('0x4')](_0x2c0aac)[0x0];return _0x601558['includes'](_0x19a10d);}catch(_0x1d2f83){return![];}}function getOperatorValue(_0x514b70){var _0x138ed1=JSON['parse'](_0x514b70);var _0x34a040=Object['keys'](_0x138ed1)[0x0];var _0x5aec63=_0x138ed1[_0x34a040];return{['$'+_0x34a040]:_0x5aec63};}exports[_0x7ef1('0x5')]=function(_0x3398a6){var _0x56ab07=null;if(_0x3398a6){_0x56ab07=_0x3398a6[_0x7ef1('0x6')](',');}return _0x56ab07;};exports[_0x7ef1('0x7')]=function(_0x4534fc,_0x3d47e2){var _0x2cb9b0={};if(!_[_0x7ef1('0x8')](_0x4534fc)){_[_0x7ef1('0x9')](_0x4534fc,function(_0x4bedd1,_0x4da8e8){try{if(_0x3d47e2){var _0x1d4522=_['find'](_0x3d47e2,{'name':_0x4da8e8})||{};if(hasSequelizeOperator(_0x4bedd1)){_0x2cb9b0[_0x4da8e8]=getOperatorValue(_0x4bedd1);}else if(_0x1d4522['type']==='DATE'&&_[_0x7ef1('0xa')](_0x4bedd1)){var _0x51e226=JSON[_0x7ef1('0x3')](_0x4bedd1);var _0x29c920={'$gte':moment(moment(_0x51e226[_0x7ef1('0xb')])[_0x7ef1('0xc')](_0x7ef1('0xd')))[_0x7ef1('0xe')]()[_0x7ef1('0xc')](),'$lte':moment(moment(_0x51e226[_0x7ef1('0xf')])['format']('YYYY-MM-DD'))[_0x7ef1('0xe')]()['subtract'](0x1,'s')[_0x7ef1('0xc')]()};_0x2cb9b0[_0x4da8e8]=_0x29c920;}else if(_0x1d4522[_0x7ef1('0x10')]==='uniqueid'){_0x2cb9b0[_0x4da8e8]=_0x4bedd1;}else{_0x2cb9b0[_0x4da8e8]=_['isArray'](_0x4bedd1)?_0x4bedd1:JSON['parse'](_0x4bedd1);}}else{_0x2cb9b0[_0x4da8e8]=_[_0x7ef1('0x11')](_0x4bedd1)?_0x4bedd1:JSON['parse'](_0x4bedd1);}}catch(_0x3a5835){_0x2cb9b0[_0x4da8e8]=_0x4bedd1['split'](',');}});}return _0x2cb9b0;};exports['limit']=function(_0x5b7e36){_0x5b7e36=parseInt(_0x5b7e36,0xa);if(!_0x5b7e36||_0x5b7e36<0x0){_0x5b7e36=LIMIT_VALUE;}return _0x5b7e36;};exports[_0x7ef1('0x12')]=function(_0x575a75){_0x575a75=parseInt(_0x575a75,0xa);if(!_0x575a75||_0x575a75<0x0){_0x575a75=0x0;}return _0x575a75;};exports[_0x7ef1('0x13')]=function(_0x2a8fab){var _0x5291b0,_0x568d0a=null;if(_0x2a8fab){_0x5291b0=_0x2a8fab[_0x7ef1('0x6')](',');_0x568d0a=_['map'](_0x5291b0,function(_0x458459){if(_0x458459[_0x7ef1('0x14')]('-')===0x0){return[_0x458459===_0x7ef1('0x15')?sequelize[_0x7ef1('0x16')](sequelize[_0x7ef1('0x17')](_0x7ef1('0x15')),_0x7ef1('0x18')):_0x458459[_0x7ef1('0x19')](0x1),'DESC'];}else{return[_0x458459===_0x7ef1('0x15')?sequelize[_0x7ef1('0x16')](sequelize[_0x7ef1('0x17')](_0x7ef1('0x15')),_0x7ef1('0x18')):_0x458459,_0x7ef1('0x1a')];}});}return _0x568d0a;};exports[_0x7ef1('0x1b')]=function(_0x144e74,_0x508a5f){if(_['isEmpty'](_0x144e74)){return _0x144e74;}if(_[_0x7ef1('0x11')](_0x144e74)){for(var _0x12ef5a=0x0;_0x12ef5a<_0x144e74[_0x7ef1('0x1c')];_0x12ef5a+=0x1){_0x144e74[_0x12ef5a]=this[_0x7ef1('0x1b')](_0x144e74[_0x12ef5a],_0x508a5f);}return _0x144e74;}if(!_[_0x7ef1('0x1d')](_0x144e74)){return _0x144e74;}if(_['isString'](_0x508a5f)){_0x508a5f=[_0x508a5f];}if(!_[_0x7ef1('0x11')](_0x508a5f)){return _0x144e74;}for(var _0x9eca93=0x0;_0x9eca93<_0x508a5f[_0x7ef1('0x1c')];_0x9eca93+=0x1){_[_0x7ef1('0x1e')](_0x144e74,_0x508a5f[_0x9eca93]);}for(var _0x232f4e in _0x144e74){if(_0x144e74[_0x7ef1('0x1f')](_0x232f4e)){_0x144e74[_0x232f4e]=this[_0x7ef1('0x1b')](_0x144e74[_0x232f4e],_0x508a5f);}}return _0x144e74;};exports['isNumeric']=function(_0x2e8f1b){return _0x2e8f1b['match'](RegExp(_0x7ef1('0x20')))?!![]:![];};exports[_0x7ef1('0x21')]=function(_0x4b5fde){return _0x4b5fde['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7ef1('0x22')]=function(_0x1136dc){var _0x5ab3a5=[];_0x1136dc[_0x7ef1('0x6')](/[ ,]+/)['forEach'](function(_0x3aa113){_0x3aa113=_0x3aa113['replace'](/([^:]")"+/g,'$1');_0x3aa113='+'+_0x3aa113+'*';var _0x122999=/[ `!@#$%^&*()_\-?~]/;if(_0x3aa113[_0x7ef1('0x23')](_0x122999))_0x3aa113='\x22'+_0x3aa113+'\x22';_0x5ab3a5['push'](_0x3aa113);});return _0x5ab3a5['join']('\x20');};exports['getOptions']=function(_0x5f2976,_0x1b72a1,_0x36b83f){var _0x596abe={},_0x1110f5={};if(_0x1b72a1['query']['$id']){_0x1b72a1[_0x7ef1('0x24')]['id']=_0x1b72a1['query'][_0x7ef1('0x25')];delete _0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x25')];}_0x596abe[_0x7ef1('0x26')]=_['map'](_0x5f2976,_0x7ef1('0x10'));_0x596abe[_0x7ef1('0x24')]=_['keys'](_0x1b72a1['query']);_0x596abe['filters']=_['intersection'](_0x596abe[_0x7ef1('0x26')],_0x596abe['query']);_0x1110f5[_0x7ef1('0x27')]=_[_0x7ef1('0x28')](_0x596abe[_0x7ef1('0x26')],this[_0x7ef1('0x5')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x5')]));_0x1110f5[_0x7ef1('0x27')]=_0x1110f5[_0x7ef1('0x27')][_0x7ef1('0x1c')]?_0x1110f5[_0x7ef1('0x27')]:_0x596abe[_0x7ef1('0x26')];if(!_0x1b72a1['query'][_0x7ef1('0x1f')](_0x7ef1('0x29'))){_0x1110f5['limit']=this[_0x7ef1('0x2a')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2a')]);_0x1110f5[_0x7ef1('0x12')]=this[_0x7ef1('0x12')](_0x1b72a1['query'][_0x7ef1('0x12')]);}_0x1110f5[_0x7ef1('0x2b')]=this[_0x7ef1('0x13')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x13')]);_0x1110f5[_0x7ef1('0x2c')]=this[_0x7ef1('0x7')](_[_0x7ef1('0x2d')](_0x1b72a1[_0x7ef1('0x24')],_0x596abe[_0x7ef1('0x7')]),_0x5f2976);if(_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2e')]){var _0x2da912=_0x5f2976;var _0x39b280=_0x1b72a1[_0x7ef1('0x24')]['filter'];if(typeof _0x39b280===_0x7ef1('0x2f')){_0x2da912=_[_0x7ef1('0x2e')](_0x5f2976,function(_0x302212){return _[_0x7ef1('0x30')](_0x39b280[_0x7ef1('0x31')],_0x302212[_0x7ef1('0x10')]);});_0x39b280=_0x39b280[_0x7ef1('0x32')];}_0x1110f5[_0x7ef1('0x2c')]=_[_0x7ef1('0x33')](_0x1110f5[_0x7ef1('0x2c')],{'$or':_[_0x7ef1('0x34')](_0x2da912,function(_0x374bf5){if(_0x374bf5[_0x7ef1('0x35')]!=='VIRTUAL'){if(_0x36b83f){return sequelize[_0x7ef1('0x2c')](sequelize['fn'](_0x7ef1('0x36'),sequelize[_0x7ef1('0x17')](_0x374bf5[_0x7ef1('0x10')])),{'$like':sequelize['fn'](_0x7ef1('0x36'),'%'+_0x1b72a1[_0x7ef1('0x24')]['filter']+'%')});}else{var _0x4448ca={};_0x4448ca[_0x374bf5[_0x7ef1('0x10')]]={'$like':'%'+_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2e')]+'%'};return _0x4448ca;}}})});}_0x1110f5=_[_0x7ef1('0x33')]({},_0x1110f5,_0x1b72a1[_0x7ef1('0x37')]);return _0x1110f5;};
\ No newline at end of file
index e49105b..2632965 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fa8=['length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','smsPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','order','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','fullname','validateSortParameter','sort','toLowerCase','userpic','online','lastPauseAt','address','chatCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every'];(function(_0x116a48,_0x29c4f9){var _0x2b26ba=function(_0x284486){while(--_0x284486){_0x116a48['push'](_0x116a48['shift']());}};_0x2b26ba(++_0x29c4f9);}(_0x4fa8,0xb2));var _0x84fa=function(_0x5d677e,_0x132658){_0x5d677e=_0x5d677e-0x0;var _0x79d0a2=_0x4fa8[_0x5d677e];return _0x79d0a2;};'use strict';var _=require(_0x84fa('0x0'));var jayson=require(_0x84fa('0x1'));var db=require(_0x84fa('0x2'))['db'];var amiClient=jayson[_0x84fa('0x3')][_0x84fa('0x4')]({'port':0x232a});var routingClient=jayson[_0x84fa('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x732ca6,_0x566a8d){var _0x50ec5f=[_0x732ca6[_0x84fa('0x5')],_0x732ca6[_0x84fa('0x6')],_0x732ca6[_0x84fa('0x7')],_0x732ca6[_0x84fa('0x8')],_0x732ca6['smsPause'],_0x732ca6[_0x84fa('0x9')],_0x732ca6[_0x84fa('0xa')]];if(!_0x566a8d)return _[_0x84fa('0xb')](_0x50ec5f);var _0x4b963c=_['filter'](_0x50ec5f);return _0x4b963c[_0x84fa('0xc')]>0x0&&_0x4b963c[_0x84fa('0xc')]<_0x50ec5f[_0x84fa('0xc')]?!![]:![];}function isIdle(_0x58b09b){return _0x58b09b===_0x84fa('0xd')||_0x58b09b===_0x84fa('0xe')||_0x58b09b===_0x84fa('0xf')||_0x58b09b==='ringing'||_[_0x84fa('0x10')](_0x58b09b);}function isAgentIdle(_0x5edbce){if(_0x5edbce[_0x84fa('0x11')]!==_0x84fa('0xd')&&_0x5edbce['voicePause']){_0x5edbce[_0x84fa('0x11')]=_0x84fa('0x12');return![];}return _['every']([_0x5edbce[_0x84fa('0x13')],_0x5edbce[_0x84fa('0x14')],_0x5edbce[_0x84fa('0x15')],_0x5edbce[_0x84fa('0x16')],_0x5edbce[_0x84fa('0x17')],_0x5edbce[_0x84fa('0x11')],_0x5edbce[_0x84fa('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x84fa('0x19')](_0x84fa('0x1a'),{})[_0x84fa('0x1b')](function(_0x33cbd3){if(_0x33cbd3[_0x84fa('0x1c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x51d64d=_0x33cbd3[_0x84fa('0x1d')];return routingClient[_0x84fa('0x19')](_0x84fa('0x1a'),{})[_0x84fa('0x1b')](function(_0x35dd52){if(_0x35dd52[_0x84fa('0x1c')]){throw new Error(_0x84fa('0x1e'));}var _0x357207=_0x35dd52[_0x84fa('0x1d')];return _[_0x84fa('0x1f')]({},_0x51d64d,_0x357207);});})['catch'](function(_0x113c62){throw _0x113c62;});}exports[_0x84fa('0x20')]=getRealtimeAgents;function getAgentStatus(_0x175cfa){var _0x4d4a67='unknown';if(isAgentPaused(_0x175cfa))_0x4d4a67=_0x84fa('0x12');else if(isAgentPaused(_0x175cfa,!![]))_0x4d4a67=_0x84fa('0x21');else if(isAgentIdle(_0x175cfa))_0x4d4a67=_0x84fa('0xd');else _0x4d4a67=_0x84fa('0x22');return _0x4d4a67;}exports[_0x84fa('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x4304d3,_0x37e857){var _0x52a8b9=_[_0x84fa('0x24')](_0x4304d3)?_0x4304d3:[_0x4304d3];var _0x158ef8=_[_0x84fa('0x25')](_0x37e857)+_0x84fa('0x26');var _0x4ec80d=_[_0x84fa('0x27')](_0x52a8b9,function(_0x330019){return db[_0x158ef8][_0x84fa('0x28')]({'where':{'id':_0x330019}})['then'](function(_0x209fab){if(!_0x209fab)return[];return _0x209fab['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x84fa('0x29')](_0x4ec80d)[_0x84fa('0x1b')](function(_0x57ca67){var _0x2ffe95=_(_0x57ca67)[_0x84fa('0x2a')]()[_0x84fa('0x27')]('id')[_0x84fa('0x2b')]()[_0x84fa('0x2c')]();return _0x2ffe95;});}exports[_0x84fa('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x497c05,_0x3cebd8,_0x29b157){try{if(_0x3cebd8[_0x84fa('0xc')]>0x0){_0x497c05=_0x497c05[_0x84fa('0x2e')](function(_0x2da3d8){return _0x3cebd8[_0x84fa('0x2f')](_0x2da3d8['id']);});}var _0x30ee66=_0x497c05[_0x84fa('0x2e')](function(_0x188a18){var _0x306c7a=_0x84fa('0x22');if(isAgentIdle(_0x188a18)){_0x306c7a='idle';}return _0x306c7a===_0x29b157;});return _[_0x84fa('0x27')](_0x30ee66,'id');}catch(_0x6ee7b6){throw _0x6ee7b6;}}exports[_0x84fa('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f4c28,_0x541435,_0x19506){return Promise[_0x84fa('0x31')]()[_0x84fa('0x1b')](function(){if(_0x541435[_0x84fa('0xc')]>0x0){_0x2f4c28=_0x2f4c28[_0x84fa('0x2e')](function(_0x446f02){return _0x541435[_0x84fa('0x2f')](_0x446f02['id']);});}return _0x2f4c28;})[_0x84fa('0x1b')](function(){return db[_0x84fa('0x32')][_0x84fa('0x33')]({'attributes':['id',_0x84fa('0x34'),'fullname','chatPause',_0x84fa('0x6'),_0x84fa('0x7'),_0x84fa('0x8'),_0x84fa('0x35'),_0x84fa('0x9'),_0x84fa('0xa'),_0x84fa('0x36')],'where':{'id':{'$in':_['map'](_0x2f4c28,'id')}},'raw':!![]});})[_0x84fa('0x1b')](function(_0x2aeb68){return _0x2aeb68[_0x84fa('0x27')](function(_0xb88d62){var _0x12ebf2=_[_0x84fa('0x37')](_0x2f4c28,['id',_0xb88d62['id']]);var _0x22995f=filterAgentAttributes(_0x12ebf2);_[_0x84fa('0x1f')](_0xb88d62,_0x22995f);_0xb88d62[_0x84fa('0x38')]=getAgentStatus(_0xb88d62);return _0xb88d62;});})[_0x84fa('0x1b')](function(_0x2d9985){var _0x46cd2e=sortAgentsByStatus(_0x2d9985,_0x19506);return _['map'](_0x46cd2e,'id');})[_0x84fa('0x39')](function(_0x286e13){throw _0x286e13;});}exports[_0x84fa('0x3a')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x54da7a){var _0x5cac56={'fields':[],'order':null};var _0x4590b7=_0x54da7a[_0x84fa('0x3b')](',');_0x5cac56['fields']=_[_0x84fa('0x2e')](_0x4590b7,function(_0x1366d0){if(!_0x1366d0[_0x84fa('0x2f')](_0x84fa('0x38'))){return!![];}_0x5cac56[_0x84fa('0x3c')]=_['startsWith'](_0x1366d0,'-')?_0x84fa('0x3d'):_0x84fa('0x3e');return![];});return _0x5cac56;}exports[_0x84fa('0x3f')]=getUpdatedSortOptions;function validateSortParameter(_0x636b26){if(_0x636b26[_0x84fa('0x2f')]('fullname')&&!_0x636b26[_0x84fa('0x2f')](_0x84fa('0x40'))){var _0x39a038=_0x636b26[_0x84fa('0x41')](0x0,_0x636b26[_0x84fa('0x42')](_0x84fa('0x43')));_0x636b26+=','+_0x39a038+_0x84fa('0x40');}return _0x636b26;}exports[_0x84fa('0x44')]=validateSortParameter;function sortAgentsByStatus(_0x5b320a,_0x163d24){var _0x28cf1b=_0x5b320a[_0x84fa('0x45')](function(_0x5153f1,_0x4a2b7f){if(_0x5153f1['globalStatus']===_0x4a2b7f[_0x84fa('0x38')]){if(_0x5153f1[_0x84fa('0x38')]===_0x84fa('0x12')){if(_0x163d24==='DESC'){return(_0x5153f1[_0x84fa('0x36')]||'')<(_0x4a2b7f[_0x84fa('0x36')]||'')||_0x5153f1[_0x84fa('0x43')][_0x84fa('0x46')]()>_0x4a2b7f[_0x84fa('0x43')][_0x84fa('0x46')]()?0x1:-0x1;}else{return(_0x5153f1['pauseType']||'')<(_0x4a2b7f[_0x84fa('0x36')]||'')||_0x5153f1['fullname']['toLowerCase']()>_0x4a2b7f['fullname'][_0x84fa('0x46')]()?-0x1:0x1;}}else{if(_0x163d24===_0x84fa('0x3d')){return _0x5153f1[_0x84fa('0x43')][_0x84fa('0x46')]()<_0x4a2b7f[_0x84fa('0x43')][_0x84fa('0x46')]()?0x1:-0x1;}else{return _0x5153f1[_0x84fa('0x43')][_0x84fa('0x46')]()<_0x4a2b7f['fullname'][_0x84fa('0x46')]()?-0x1:0x1;}}}else{if(_0x163d24===_0x84fa('0x3d')){return _0x5153f1[_0x84fa('0x38')]<_0x4a2b7f[_0x84fa('0x38')]?0x1:-0x1;}else{return _0x5153f1['globalStatus']<_0x4a2b7f[_0x84fa('0x38')]?-0x1:0x1;}}});return _0x28cf1b;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x58c836){var _0x1918b3=[_0x84fa('0x47'),_0x84fa('0x48'),'lastLoginAt',_0x84fa('0x49'),_0x84fa('0x36'),'lastPauseAt',_0x84fa('0x40'),_0x84fa('0x4a'),_0x84fa('0x5'),_0x84fa('0x8'),_0x84fa('0x7'),_0x84fa('0x35'),_0x84fa('0xa'),_0x84fa('0x6'),_0x84fa('0x9'),_0x84fa('0x4b'),'openchannelCapacity','mailCapacity',_0x84fa('0x4c'),'whatsappCapacity',_0x84fa('0x4d'),_0x84fa('0x4e'),_0x84fa('0x4f'),_0x84fa('0x50'),_0x84fa('0x51'),_0x84fa('0x52'),'faxCurrentCapacity',_0x84fa('0x13'),'openchannelStatus',_0x84fa('0x15'),_0x84fa('0x17'),_0x84fa('0x18'),_0x84fa('0x14'),_0x84fa('0x11'),_0x84fa('0x53'),_0x84fa('0x54'),_0x84fa('0x55'),'smsStatusTime','whatsappStatusTime',_0x84fa('0x56'),_0x84fa('0x57'),_0x84fa('0x58'),_0x84fa('0x59'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x84fa('0x5a'),_0x84fa('0x5b')];var _0x4ed4bc=[_0x84fa('0x5'),'openchannelPause',_0x84fa('0x7'),_0x84fa('0x35'),_0x84fa('0xa'),_0x84fa('0x6'),_0x84fa('0x9'),_0x84fa('0x48')];var _0x49557b=_(_0x58c836)[_0x84fa('0x5c')](_0x4ed4bc)[_0x84fa('0x5d')](_0x1918b3)[_0x84fa('0x2c')]();return _0x49557b;}exports[_0x84fa('0x5e')]=filterAgentAttributes;
\ No newline at end of file
+var _0xa24c=['startCase','Queue','getAgents','all','flatten','uniq','value','includes','idle','getAgentIdsByStatus','resolve','findAll','name','voicePause','map','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','indexOf','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','unknown','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','busy','getAgentStatus'];(function(_0x1c91a6,_0x18e77f){var _0x1d8267=function(_0x2689a2){while(--_0x2689a2){_0x1c91a6['push'](_0x1c91a6['shift']());}};_0x1d8267(++_0x18e77f);}(_0xa24c,0x1b4));var _0xca24=function(_0x497ce2,_0x249d65){_0x497ce2=_0x497ce2-0x0;var _0x53d023=_0xa24c[_0x497ce2];return _0x53d023;};'use strict';var _=require(_0xca24('0x0'));var jayson=require(_0xca24('0x1'));var db=require(_0xca24('0x2'))['db'];var amiClient=jayson[_0xca24('0x3')][_0xca24('0x4')]({'port':0x232a});var routingClient=jayson[_0xca24('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x155fc2,_0x15231d){var _0x283f79=[_0x155fc2[_0xca24('0x5')],_0x155fc2[_0xca24('0x6')],_0x155fc2[_0xca24('0x7')],_0x155fc2[_0xca24('0x8')],_0x155fc2[_0xca24('0x9')],_0x155fc2['voicePause'],_0x155fc2[_0xca24('0xa')]];if(!_0x15231d)return _[_0xca24('0xb')](_0x283f79);var _0x40d7c4=_[_0xca24('0xc')](_0x283f79);return _0x40d7c4[_0xca24('0xd')]>0x0&&_0x40d7c4[_0xca24('0xd')]<_0x283f79[_0xca24('0xd')]?!![]:![];}function isIdle(_0x46cb37){return _0x46cb37==='idle'||_0x46cb37===_0xca24('0xe')||_0x46cb37==='unavailable'||_0x46cb37===_0xca24('0xf')||_[_0xca24('0x10')](_0x46cb37);}function isAgentIdle(_0x1c343e){if(_0x1c343e[_0xca24('0x11')]!=='idle'&&_0x1c343e['voicePause']){_0x1c343e[_0xca24('0x11')]=_0xca24('0x12');return![];}return _[_0xca24('0xb')]([_0x1c343e[_0xca24('0x13')],_0x1c343e[_0xca24('0x14')],_0x1c343e[_0xca24('0x15')],_0x1c343e['openchannelStatus'],_0x1c343e[_0xca24('0x16')],_0x1c343e[_0xca24('0x11')],_0x1c343e[_0xca24('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xca24('0x18')](_0xca24('0x19'),{})[_0xca24('0x1a')](function(_0x32f181){if(_0x32f181[_0xca24('0x1b')]){throw new Error(_0xca24('0x1c'));}var _0x7e724a=_0x32f181[_0xca24('0x1d')];return routingClient[_0xca24('0x18')](_0xca24('0x19'),{})[_0xca24('0x1a')](function(_0x5f312e){if(_0x5f312e[_0xca24('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2fce7a=_0x5f312e[_0xca24('0x1d')];return _[_0xca24('0x1e')]({},_0x7e724a,_0x2fce7a);});})[_0xca24('0x1f')](function(_0x1c9ade){throw _0x1c9ade;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x4f38a5){var _0xcd5626='unknown';if(isAgentPaused(_0x4f38a5))_0xcd5626=_0xca24('0x12');else if(isAgentPaused(_0x4f38a5,!![]))_0xcd5626='*pause';else if(isAgentIdle(_0x4f38a5))_0xcd5626='idle';else _0xcd5626=_0xca24('0x20');return _0xcd5626;}exports[_0xca24('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x15dbbf,_0x33933d){var _0x34b1c6=_['isArray'](_0x15dbbf)?_0x15dbbf:[_0x15dbbf];var _0xc90164=_[_0xca24('0x22')](_0x33933d)+_0xca24('0x23');var _0x53d94f=_['map'](_0x34b1c6,function(_0xeff1a5){return db[_0xc90164]['findOne']({'where':{'id':_0xeff1a5}})[_0xca24('0x1a')](function(_0x449415){if(!_0x449415)return[];return _0x449415[_0xca24('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xca24('0x25')](_0x53d94f)[_0xca24('0x1a')](function(_0x57d7dd){var _0x5897fd=_(_0x57d7dd)[_0xca24('0x26')]()['map']('id')[_0xca24('0x27')]()[_0xca24('0x28')]();return _0x5897fd;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x12cc8d,_0x596ad4,_0x1ddcde){try{if(_0x596ad4[_0xca24('0xd')]>0x0){_0x12cc8d=_0x12cc8d[_0xca24('0xc')](function(_0x48ef93){return _0x596ad4[_0xca24('0x29')](_0x48ef93['id']);});}var _0x247e4b=_0x12cc8d[_0xca24('0xc')](function(_0x11f900){var _0x2421b6=_0xca24('0x20');if(isAgentIdle(_0x11f900)){_0x2421b6=_0xca24('0x2a');}return _0x2421b6===_0x1ddcde;});return _['map'](_0x247e4b,'id');}catch(_0x46972a){throw _0x46972a;}}exports[_0xca24('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x473b09,_0x524eec,_0x571a94){return Promise[_0xca24('0x2c')]()[_0xca24('0x1a')](function(){if(_0x524eec[_0xca24('0xd')]>0x0){_0x473b09=_0x473b09[_0xca24('0xc')](function(_0x27af64){return _0x524eec[_0xca24('0x29')](_0x27af64['id']);});}return _0x473b09;})[_0xca24('0x1a')](function(){return db['User'][_0xca24('0x2d')]({'attributes':['id',_0xca24('0x2e'),'fullname','chatPause',_0xca24('0x6'),'mailPause','openchannelPause',_0xca24('0x9'),_0xca24('0x2f'),_0xca24('0xa'),'pauseType'],'where':{'id':{'$in':_[_0xca24('0x30')](_0x473b09,'id')}},'raw':!![]});})['then'](function(_0x510e0c){return _0x510e0c[_0xca24('0x30')](function(_0xceaba1){var _0x53a9b2=_[_0xca24('0x31')](_0x473b09,['id',_0xceaba1['id']]);var _0x5419ea=filterAgentAttributes(_0x53a9b2);_[_0xca24('0x1e')](_0xceaba1,_0x5419ea);_0xceaba1[_0xca24('0x32')]=getAgentStatus(_0xceaba1);return _0xceaba1;});})[_0xca24('0x1a')](function(_0x1a6a68){var _0x452621=sortAgentsByStatus(_0x1a6a68,_0x571a94);return _[_0xca24('0x30')](_0x452621,'id');})['catch'](function(_0x3d4581){throw _0x3d4581;});}exports[_0xca24('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x54e659){var _0x1b0e73={'fields':[],'order':null};var _0x26f40b=_0x54e659[_0xca24('0x34')](',');_0x1b0e73[_0xca24('0x35')]=_[_0xca24('0xc')](_0x26f40b,function(_0x313540){if(!_0x313540[_0xca24('0x29')]('globalStatus')){return!![];}_0x1b0e73[_0xca24('0x36')]=_[_0xca24('0x37')](_0x313540,'-')?_0xca24('0x38'):_0xca24('0x39');return![];});return _0x1b0e73;}exports[_0xca24('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x2fe1fa){if(_0x2fe1fa[_0xca24('0x29')](_0xca24('0x3b'))&&!_0x2fe1fa[_0xca24('0x29')](_0xca24('0x3c'))){var _0x995c38=_0x2fe1fa['substring'](0x0,_0x2fe1fa[_0xca24('0x3d')](_0xca24('0x3b')));_0x2fe1fa+=','+_0x995c38+'internal';}return _0x2fe1fa;}exports[_0xca24('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x4b288d,_0x2e5d97){var _0x42a281=_0x4b288d[_0xca24('0x3f')](function(_0x5e3c46,_0x58b26e){if(_0x5e3c46[_0xca24('0x32')]===_0x58b26e[_0xca24('0x32')]){if(_0x5e3c46[_0xca24('0x32')]==='pause'){if(_0x2e5d97==='DESC'){return(_0x5e3c46['pauseType']||'')<(_0x58b26e[_0xca24('0x40')]||'')||_0x5e3c46[_0xca24('0x3b')][_0xca24('0x41')]()>_0x58b26e[_0xca24('0x3b')]['toLowerCase']()?0x1:-0x1;}else{return(_0x5e3c46[_0xca24('0x40')]||'')<(_0x58b26e[_0xca24('0x40')]||'')||_0x5e3c46[_0xca24('0x3b')][_0xca24('0x41')]()>_0x58b26e['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x2e5d97==='DESC'){return _0x5e3c46[_0xca24('0x3b')][_0xca24('0x41')]()<_0x58b26e[_0xca24('0x3b')]['toLowerCase']()?0x1:-0x1;}else{return _0x5e3c46[_0xca24('0x3b')][_0xca24('0x41')]()<_0x58b26e['fullname'][_0xca24('0x41')]()?-0x1:0x1;}}}else{if(_0x2e5d97===_0xca24('0x38')){return _0x5e3c46[_0xca24('0x32')]<_0x58b26e[_0xca24('0x32')]?0x1:-0x1;}else{return _0x5e3c46[_0xca24('0x32')]<_0x58b26e[_0xca24('0x32')]?-0x1:0x1;}}});return _0x42a281;}exports[_0xca24('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x4f0d1a){var _0x5dc1fa=[_0xca24('0x43'),_0xca24('0x44'),'lastLoginAt','lastPauseAt',_0xca24('0x40'),_0xca24('0x45'),_0xca24('0x3c'),_0xca24('0x46'),_0xca24('0x5'),_0xca24('0x8'),_0xca24('0x7'),_0xca24('0x9'),'whatsappPause',_0xca24('0x6'),_0xca24('0x2f'),_0xca24('0x47'),_0xca24('0x48'),'mailCapacity',_0xca24('0x49'),_0xca24('0x4a'),_0xca24('0x4b'),_0xca24('0x4c'),'openchannelCurrentCapacity',_0xca24('0x4d'),_0xca24('0x4e'),'whatsappCurrentCapacity',_0xca24('0x4f'),_0xca24('0x13'),_0xca24('0x50'),'mailStatus','smsStatus',_0xca24('0x17'),'faxStatus',_0xca24('0x11'),_0xca24('0x51'),_0xca24('0x52'),_0xca24('0x53'),_0xca24('0x54'),_0xca24('0x55'),_0xca24('0x56'),_0xca24('0x57'),_0xca24('0x58'),'destconnectedlinenum','screenrecording',_0xca24('0x59'),_0xca24('0x5a'),_0xca24('0x5b')];var _0x2d435d=[_0xca24('0x5'),_0xca24('0x8'),_0xca24('0x7'),_0xca24('0x9'),_0xca24('0xa'),_0xca24('0x6'),_0xca24('0x2f'),_0xca24('0x44')];var _0x51c44a=_(_0x4f0d1a)['omit'](_0x2d435d)[_0xca24('0x5c')](_0x5dc1fa)[_0xca24('0x28')]();return _0x51c44a;}exports[_0xca24('0x5d')]=filterAgentAttributes;
\ No newline at end of file
index ba1cb60..5fc0926 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f8a=['paused','waiting','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','then','result','catch','inbound','concat','map','get','busy','outbound','pTalking','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn'];(function(_0x39531c,_0x4e4dfb){var _0x9dfc07=function(_0x419fb9){while(--_0x419fb9){_0x39531c['push'](_0x39531c['shift']());}};_0x9dfc07(++_0x4e4dfb);}(_0x4f8a,0x15e));var _0xa4f8=function(_0x123b39,_0x5bb782){_0x123b39=_0x123b39-0x0;var _0x27963f=_0x4f8a[_0x123b39];return _0x27963f;};'use strict';var _=require(_0xa4f8('0x0'));var jayson=require(_0xa4f8('0x1'));var util=require(_0xa4f8('0x2'));var amiClient=jayson[_0xa4f8('0x3')][_0xa4f8('0x4')]({'port':0x232a});var routingClient=jayson[_0xa4f8('0x3')][_0xa4f8('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa4f8('0x5'),_0xa4f8('0x6'),_0xa4f8('0x7'),_0xa4f8('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xa4f8('0x9'),_0xa4f8('0xa'),_0xa4f8('0xb'),_0xa4f8('0xc'),_0xa4f8('0xd'),_0xa4f8('0xe'),_0xa4f8('0xf'),_0xa4f8('0x10'),_0xa4f8('0x11'),_0xa4f8('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xa4f8('0x13'),_0xa4f8('0x14'),_0xa4f8('0x15'),_0xa4f8('0x16'),'dialMethod',_0xa4f8('0x17'),_0xa4f8('0x18'),_0xa4f8('0x19'),_0xa4f8('0x1a'),_0xa4f8('0x1b'),_0xa4f8('0x1c'),_0xa4f8('0x1d'),_0xa4f8('0x1e'),_0xa4f8('0x1f'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xa4f8('0x20'),_0xa4f8('0x21'),_0xa4f8('0x22'),'predictiveIntervalDroppedCallsCallersExit',_0xa4f8('0x23'),_0xa4f8('0x24')];function getRealtimeQueues(_0x551633,_0x1d6c3a){var _0x2691f9=_0x1d6c3a===_0xa4f8('0x25')?amiClient:routingClient;return _0x2691f9[_0xa4f8('0x26')](_['startCase'](_0x1d6c3a)+'Queues',_0x551633)[_0xa4f8('0x27')](function(_0x28766f){if(_0x28766f['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1d6c3a));return _0x28766f[_0xa4f8('0x28')];})[_0xa4f8('0x29')](function(_0x352ec0){throw _0x352ec0;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1195cc,_0x4adb45,_0x23a530,_0x18b4c7){var _0xadc4e4=DEFAULT_QUEUE_ATTRIBUTES;if(_0x23a530===_0xa4f8('0x25')){if(_0x18b4c7===_0xa4f8('0x2a')){_0xadc4e4=_0xadc4e4['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x18b4c7==='outbound'){_0xadc4e4=_0xadc4e4[_0xa4f8('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1195cc[_0xa4f8('0x2c')](function(_0xe06e94){var _0x256619=_0xe06e94[_0xa4f8('0x2d')]({'plain':!![]});_0x256619['paused']=0x0;_0x256619[_0xa4f8('0xb')]=0x0;_0x256619[_0xa4f8('0x6')]=0x0;_0x256619['available']=0x0;_0x256619[_0xa4f8('0x8')]=0x0;if(_0x23a530===_0xa4f8('0x25')){_0x256619['talking']=0x0;_0x256619[_0xa4f8('0x2e')]=0x0;if(_0x18b4c7===_0xa4f8('0x2f')){_0x256619[_0xa4f8('0x30')]=0x0;_0x256619[_0xa4f8('0x13')]=0x0;}}var _0x5c67d6=_['find'](_0x4adb45,['id',_0x256619['id']]);if(_0x5c67d6){_[_0xa4f8('0x31')](_0x256619,_['pick'](_0x5c67d6,_0xadc4e4));}return _0x256619;});}exports[_0xa4f8('0x32')]=initializeQueues;
\ No newline at end of file
+var _0x34e1=['loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','get','busy','originated','find','merge','pick','jayson/promise','util','client','http','available','loggedIn','paused','waiting','invalid'];(function(_0x4b6f8c,_0x4e0098){var _0x7ed67c=function(_0x164b10){while(--_0x164b10){_0x4b6f8c['push'](_0x4b6f8c['shift']());}};_0x7ed67c(++_0x4e0098);}(_0x34e1,0x171));var _0x134e=function(_0x4926f2,_0x266d43){_0x4926f2=_0x4926f2-0x0;var _0x16f736=_0x34e1[_0x4926f2];return _0x16f736;};'use strict';var _=require('lodash');var jayson=require(_0x134e('0x0'));var util=require(_0x134e('0x1'));var amiClient=jayson[_0x134e('0x2')][_0x134e('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x134e('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x134e('0x4'),_0x134e('0x5'),_0x134e('0x6'),_0x134e('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x134e('0x8'),_0x134e('0x9'),_0x134e('0xa'),_0x134e('0xb'),_0x134e('0xc'),_0x134e('0xd'),_0x134e('0xe'),_0x134e('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x134e('0x10'),'originated','message',_0x134e('0x11'),_0x134e('0x12'),_0x134e('0x13'),_0x134e('0x14'),_0x134e('0x15'),_0x134e('0x16'),_0x134e('0x17'),_0x134e('0x18'),'erlangAbandonmentRate',_0x134e('0x19'),_0x134e('0x1a'),_0x134e('0x1b'),_0x134e('0x1c'),_0x134e('0x1d'),_0x134e('0x1e'),_0x134e('0x1f'),_0x134e('0x20'),_0x134e('0x21'),_0x134e('0x22'),_0x134e('0x23')];function getRealtimeQueues(_0x5d62f3,_0x2aa0bb){var _0x145bd1=_0x2aa0bb===_0x134e('0x24')?amiClient:routingClient;return _0x145bd1['request'](_[_0x134e('0x25')](_0x2aa0bb)+'Queues',_0x5d62f3)[_0x134e('0x26')](function(_0x34def5){if(_0x34def5[_0x134e('0x27')])throw new Error(util[_0x134e('0x28')](_0x134e('0x29'),_0x2aa0bb));return _0x34def5[_0x134e('0x2a')];})['catch'](function(_0x4998d8){throw _0x4998d8;});}exports[_0x134e('0x2b')]=getRealtimeQueues;function initializeQueues(_0x1a9a62,_0x24b63e,_0x3d8ddc,_0x59cb05){var _0x407142=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3d8ddc===_0x134e('0x24')){if(_0x59cb05===_0x134e('0x2c')){_0x407142=_0x407142[_0x134e('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x59cb05===_0x134e('0x2e')){_0x407142=_0x407142[_0x134e('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1a9a62[_0x134e('0x2f')](function(_0x5697e4){var _0x54ba19=_0x5697e4[_0x134e('0x30')]({'plain':!![]});_0x54ba19[_0x134e('0x6')]=0x0;_0x54ba19['loggedInDb']=0x0;_0x54ba19[_0x134e('0x5')]=0x0;_0x54ba19['available']=0x0;_0x54ba19[_0x134e('0x7')]=0x0;if(_0x3d8ddc===_0x134e('0x24')){_0x54ba19[_0x134e('0xe')]=0x0;_0x54ba19[_0x134e('0x31')]=0x0;if(_0x59cb05===_0x134e('0x2e')){_0x54ba19[_0x134e('0x10')]=0x0;_0x54ba19[_0x134e('0x32')]=0x0;}}var _0x626bcd=_[_0x134e('0x33')](_0x24b63e,['id',_0x54ba19['id']]);if(_0x626bcd){_[_0x134e('0x34')](_0x54ba19,_[_0x134e('0x35')](_0x626bcd,_0x407142));}return _0x54ba19;});}exports['initializeQueues']=initializeQueues;
\ No newline at end of file
index f0fb90d..d451fc9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());};
\ No newline at end of file
+var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x18805f,_0x9973b){var _0x54edbb=function(_0x4686e8){while(--_0x4686e8){_0x18805f['push'](_0x18805f['shift']());}};_0x54edbb(++_0x9973b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());};
\ No newline at end of file
index d4d8eae..1985a71 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98f5=['crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','length','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring'];(function(_0x5b0708,_0x514b4a){var _0x240614=function(_0x1eaf6c){while(--_0x1eaf6c){_0x5b0708['push'](_0x5b0708['shift']());}};_0x240614(++_0x514b4a);}(_0x98f5,0xd2));var _0x598f=function(_0x39aa10,_0x4c980f){_0x39aa10=_0x39aa10-0x0;var _0x5bc78f=_0x98f5[_0x39aa10];return _0x5bc78f;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x598f('0x0'));var machine=require(_0x598f('0x1'));var exec=require('child_process')[_0x598f('0x2')];var config=require(_0x598f('0x3'));function getInterfaces(){var _0x12185d=[];var _0x46cdeb=os[_0x598f('0x4')]();var _0x1d0b1e=_[_0x598f('0x5')](_['keys'](_0x46cdeb));for(var _0x51335e=0x0;_0x51335e<_0x1d0b1e[_0x598f('0x6')];_0x51335e++){var _0x336e97=_0x46cdeb[_0x1d0b1e[_0x51335e]]['filter'](function(_0x3d21d8){return _0x3d21d8['family']===_0x598f('0x7')&&_0x3d21d8[_0x598f('0x8')]===![];});_0x12185d=_0x12185d[_0x598f('0x9')](_0x336e97);}return _0x12185d;}function getFirstInterface(){var _0x34b645=_[_0x598f('0xa')](getInterfaces());return{'macAddress':_0x34b645&&_0x34b645[_0x598f('0xb')]?_0x34b645[_0x598f('0xb')]:_0x598f('0xc'),'ipAddress':_0x34b645&&_0x34b645[_0x598f('0xd')]?_0x34b645[_0x598f('0xd')]:'127.0.0.1'};}exports[_0x598f('0xe')]=getFirstInterface;function getCPUhash(){var _0x190743=_[_0x598f('0x5')](os[_0x598f('0xf')]()[_0x598f('0x10')](function(_0x58ca8e){return _0x58ca8e[_0x598f('0x11')];}))[_0x598f('0x12')](':');return crypto[_0x598f('0x13')](_0x598f('0x14'))['update'](_0x190743)[_0x598f('0x15')](_0x598f('0x16'));}exports[_0x598f('0x17')]=function(){var _0x3a20b5=os['platform']();var _0x1e733c=/[0-9a-f-]{36}/;if(config[_0x598f('0x18')]&&_0x1e733c[_0x598f('0x19')](config['licenseToken'])){return config[_0x598f('0x18')];}else if(_0x3a20b5===_0x598f('0x1a')){return exec(_0x598f('0x1b'),{'encoding':_0x598f('0x1c')})[_0x598f('0x1d')]('\x0d\x0a','');}else{var _0x5c3837=getFirstInterface();var _0x34781e=getCPUhash();var _0x522576=_0x34781e+'|'+os[_0x598f('0x1e')]()+'|'+_0x5c3837[_0x598f('0x1f')]+'|'+_0x5c3837[_0x598f('0x20')];var _0xda0930=crypto[_0x598f('0x13')](_0x598f('0x14'))[_0x598f('0x21')](_0x522576)[_0x598f('0x15')]('hex');return _0xda0930[_0x598f('0x22')](0x0,0x8)+'-'+_0xda0930[_0x598f('0x22')](0x8,0xc)+'-'+_0xda0930[_0x598f('0x22')](0xc,0x10)+'-'+_0xda0930['substring'](0x10,0x14)+'-'+_0xda0930[_0x598f('0x22')](0x14);}};
\ No newline at end of file
+var _0xfbf9=['lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','keys','length','filter','family','IPv4','internal','head','mac','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','md5','digest','hex','test','licenseToken','win32','utf8','replace','hostname','ipAddress','createHash','update','substring'];(function(_0x39a732,_0x5ac4b4){var _0x3cf9ff=function(_0x3a031a){while(--_0x3a031a){_0x39a732['push'](_0x39a732['shift']());}};_0x3cf9ff(++_0x5ac4b4);}(_0xfbf9,0x84));var _0x9fbf=function(_0x1ef2e3,_0x380ec2){_0x1ef2e3=_0x1ef2e3-0x0;var _0x173e11=_0xfbf9[_0x1ef2e3];return _0x173e11;};'use strict';var _=require(_0x9fbf('0x0'));var os=require('os');var crypto=require(_0x9fbf('0x1'));var machine=require(_0x9fbf('0x2'));var exec=require(_0x9fbf('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x515ab5=[];var _0x1c86c9=os[_0x9fbf('0x4')]();var _0x5de36e=_['orderBy'](_[_0x9fbf('0x5')](_0x1c86c9));for(var _0xa027a5=0x0;_0xa027a5<_0x5de36e[_0x9fbf('0x6')];_0xa027a5++){var _0x3be52b=_0x1c86c9[_0x5de36e[_0xa027a5]][_0x9fbf('0x7')](function(_0x906405){return _0x906405[_0x9fbf('0x8')]===_0x9fbf('0x9')&&_0x906405[_0x9fbf('0xa')]===![];});_0x515ab5=_0x515ab5['concat'](_0x3be52b);}return _0x515ab5;}function getFirstInterface(){var _0x5f03db=_[_0x9fbf('0xb')](getInterfaces());return{'macAddress':_0x5f03db&&_0x5f03db[_0x9fbf('0xc')]?_0x5f03db[_0x9fbf('0xc')]:'00:00:00:00:00:00','ipAddress':_0x5f03db&&_0x5f03db['address']?_0x5f03db[_0x9fbf('0xd')]:_0x9fbf('0xe')};}exports[_0x9fbf('0xf')]=getFirstInterface;function getCPUhash(){var _0x11e68e=_[_0x9fbf('0x10')](os['cpus']()[_0x9fbf('0x11')](function(_0x1f8cd9){return _0x1f8cd9[_0x9fbf('0x12')];}))[_0x9fbf('0x13')](':');return crypto['createHash'](_0x9fbf('0x14'))['update'](_0x11e68e)[_0x9fbf('0x15')](_0x9fbf('0x16'));}exports['getUuid']=function(){var _0x13abc5=os['platform']();var _0x1d66f6=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1d66f6[_0x9fbf('0x17')](config[_0x9fbf('0x18')])){return config[_0x9fbf('0x18')];}else if(_0x13abc5===_0x9fbf('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x9fbf('0x1a')})[_0x9fbf('0x1b')]('\x0d\x0a','');}else{var _0x303461=getFirstInterface();var _0x16094e=getCPUhash();var _0x2b0a05=_0x16094e+'|'+os[_0x9fbf('0x1c')]()+'|'+_0x303461['macAddress']+'|'+_0x303461[_0x9fbf('0x1d')];var _0x55e192=crypto[_0x9fbf('0x1e')](_0x9fbf('0x14'))[_0x9fbf('0x1f')](_0x2b0a05)[_0x9fbf('0x15')](_0x9fbf('0x16'));return _0x55e192['substring'](0x0,0x8)+'-'+_0x55e192[_0x9fbf('0x20')](0x8,0xc)+'-'+_0x55e192['substring'](0xc,0x10)+'-'+_0x55e192[_0x9fbf('0x20')](0x10,0x14)+'-'+_0x55e192[_0x9fbf('0x20')](0x14);}};
\ No newline at end of file
index 146cd64..d3524f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xebd8=['getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','%s/api/servers/%s/check?version=%s','exports','format','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','catch','message','finally'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xebd8,0xa1));var _0x8ebd=function(_0x3c7254,_0x2c2891){_0x3c7254=_0x3c7254-0x0;var _0x171499=_0xebd8[_0x3c7254];return _0x171499;};'use strict';var util=require('util');var moment=require(_0x8ebd('0x0'));var rp=require(_0x8ebd('0x1'));var BPromise=require(_0x8ebd('0x2'));var pkginfo=require(_0x8ebd('0x3'))(module,_0x8ebd('0x4'));var db=require(_0x8ebd('0x5'))['db'];var encryptor=require(_0x8ebd('0x6'));var hardware=require(_0x8ebd('0x7'));var logger=require(_0x8ebd('0x8'))(_0x8ebd('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4ac44c){return new BPromise(function(_0x5d128d,_0x422f35){var _0x2eef19=util['format'](_0x8ebd('0xa'),HOST,_0x4ac44c,module[_0x8ebd('0xb')][_0x8ebd('0x4')]);if(oldToken){_0x2eef19=util[_0x8ebd('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4ac44c,module[_0x8ebd('0xb')]['version'],oldToken);}var _0x2e43d2={'uri':_0x2eef19,'method':_0x8ebd('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2e43d2)[_0x8ebd('0xe')](function(_0x12fd61){_0x5d128d(_0x12fd61);})['catch'](function(_0x1cb1e7){_0x422f35(_0x1cb1e7);});});}function manageLicense(_0x1d5da4,_0x3e8040){var _0x3ae44b=_0x3e8040[_0x8ebd('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3ae44b[_0x8ebd('0x10')]!==_0x1d5da4&&!_0x3ae44b[_0x8ebd('0x11')]){oldToken=_0x3ae44b[_0x8ebd('0x10')];}httpRequest(_0x1d5da4)[_0x8ebd('0xe')](function(_0x51f257){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x51f257[_0x8ebd('0x12')]){isOldTokenSent=![];if(!_0x3ae44b[_0x8ebd('0x9')]&&_0x3ae44b[_0x8ebd('0x9')]!=_0x51f257['license']||_0x3ae44b[_0x8ebd('0x9')]&&_0x3ae44b['data2']){logger[_0x8ebd('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3ae44b[_0x8ebd('0x9')]&&!_0x3ae44b[_0x8ebd('0x11')]&&_0x3ae44b[_0x8ebd('0x9')]!=_0x51f257[_0x8ebd('0x9')]){logger['info'](_0x8ebd('0x14'));}if(_0x3ae44b[_0x8ebd('0x9')]&&!_0x3ae44b['data2']&&_0x3ae44b['license']==_0x51f257[_0x8ebd('0x9')]){return _0x3e8040;}return _0x3e8040[_0x8ebd('0x15')]({'data1':_0x1d5da4,'data2':null,'license':_0x51f257[_0x8ebd('0x9')]});}else{if(_0x51f257[_0x8ebd('0x9')]||_0x3ae44b[_0x8ebd('0x9')]){if(!_0x3ae44b['data2']){if(_0x3ae44b['data1']==_0x1d5da4){GRAY_PERIOD_REASON=_0x8ebd('0x16');logger[_0x8ebd('0x13')](_0x8ebd('0x17'));}else{GRAY_PERIOD_REASON=_0x8ebd('0x18');logger['info'](_0x8ebd('0x19'),_0x3ae44b[_0x8ebd('0x10')],_0x1d5da4);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x8ebd('0x1a')](),moment()[_0x8ebd('0xc')](_0x8ebd('0x1b')));return _0x3e8040[_0x8ebd('0x15')]({'data2':encryptor[_0x8ebd('0x1c')](moment()[_0x8ebd('0xc')](_0x8ebd('0x1b')))});}else{if(moment()[_0x8ebd('0x1d')](encryptor['decryptString'](_0x3ae44b['data2']),_0x8ebd('0x1e'))>DAYS){logger[_0x8ebd('0x13')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x8ebd('0x1b')));isOldTokenSent=![];return _0x3e8040['update']({'data1':_0x1d5da4,'data2':null,'license':null});}}}else{if(_0x3ae44b[_0x8ebd('0x10')]!=_0x1d5da4){logger[_0x8ebd('0x13')](_0x8ebd('0x19'),_0x3ae44b[_0x8ebd('0x10')],_0x1d5da4);return _0x3e8040[_0x8ebd('0x15')]({'data1':_0x1d5da4,'data2':null,'license':null});}}}return _0x3e8040;})[_0x8ebd('0xe')](function(_0x45d918){_0x3e8040=_0x45d918;})[_0x8ebd('0x1f')](function(_0x40bc78){logger['error'](_0x40bc78[_0x8ebd('0x20')]);})[_0x8ebd('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x8ebd('0x22')](),_0x3e8040);},TIME);});}function defaultLicense(){var _0x1a98a1=hardware[_0x8ebd('0x22')]();if(_0x1a98a1){return db['License'][_0x8ebd('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x1a98a1}})[_0x8ebd('0x24')](function(_0x87ffbb,_0x56d068){logger['info'](_0x8ebd('0x25'),_0x1a98a1);manageLicense(_0x1a98a1,_0x87ffbb);})[_0x8ebd('0x1f')](function(_0x39598b){logger[_0x8ebd('0x26')](_0x39598b[_0x8ebd('0x20')]);});}}exports['default']=defaultLicense;
\ No newline at end of file
+var _0x4bcd=['DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','findOrCreate','spread','default','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','info','update','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','days'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0x4bcd,0x189));var _0xd4bc=function(_0x5800ba,_0x455167){_0x5800ba=_0x5800ba-0x0;var _0x58effb=_0x4bcd[_0x5800ba];return _0x58effb;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xd4bc('0x0'));var BPromise=require(_0xd4bc('0x1'));var pkginfo=require(_0xd4bc('0x2'))(module,_0xd4bc('0x3'));var db=require(_0xd4bc('0x4'))['db'];var encryptor=require(_0xd4bc('0x5'));var hardware=require(_0xd4bc('0x6'));var logger=require('../logger')(_0xd4bc('0x7'));var HOST=_0xd4bc('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3c563c){return new BPromise(function(_0x5528c8,_0x29b5e9){var _0x333061=util[_0xd4bc('0x9')](_0xd4bc('0xa'),HOST,_0x3c563c,module[_0xd4bc('0xb')][_0xd4bc('0x3')]);if(oldToken){_0x333061=util['format'](_0xd4bc('0xc'),HOST,_0x3c563c,module[_0xd4bc('0xb')][_0xd4bc('0x3')],oldToken);}var _0x2cd5fd={'uri':_0x333061,'method':_0xd4bc('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2cd5fd)[_0xd4bc('0xe')](function(_0x26c3d0){_0x5528c8(_0x26c3d0);})['catch'](function(_0x451a0a){_0x29b5e9(_0x451a0a);});});}function manageLicense(_0x4d699e,_0x4db138){var _0x3cbed3=_0x4db138[_0xd4bc('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3cbed3[_0xd4bc('0x10')]!==_0x4d699e&&!_0x3cbed3[_0xd4bc('0x11')]){oldToken=_0x3cbed3[_0xd4bc('0x10')];}httpRequest(_0x4d699e)[_0xd4bc('0xe')](function(_0x46877d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x46877d['active']){isOldTokenSent=![];if(!_0x3cbed3[_0xd4bc('0x7')]&&_0x3cbed3['license']!=_0x46877d[_0xd4bc('0x7')]||_0x3cbed3[_0xd4bc('0x7')]&&_0x3cbed3['data2']){logger[_0xd4bc('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3cbed3[_0xd4bc('0x7')]&&!_0x3cbed3[_0xd4bc('0x11')]&&_0x3cbed3[_0xd4bc('0x7')]!=_0x46877d[_0xd4bc('0x7')]){logger[_0xd4bc('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3cbed3[_0xd4bc('0x7')]&&!_0x3cbed3[_0xd4bc('0x11')]&&_0x3cbed3[_0xd4bc('0x7')]==_0x46877d[_0xd4bc('0x7')]){return _0x4db138;}return _0x4db138[_0xd4bc('0x13')]({'data1':_0x4d699e,'data2':null,'license':_0x46877d['license']});}else{if(_0x46877d[_0xd4bc('0x7')]||_0x3cbed3[_0xd4bc('0x7')]){if(!_0x3cbed3[_0xd4bc('0x11')]){if(_0x3cbed3[_0xd4bc('0x10')]==_0x4d699e){GRAY_PERIOD_REASON='Disabled';logger[_0xd4bc('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xd4bc('0x14');logger['info'](_0xd4bc('0x15'),_0x3cbed3[_0xd4bc('0x10')],_0x4d699e);}logger[_0xd4bc('0x12')](_0xd4bc('0x16'),GRAY_PERIOD_REASON[_0xd4bc('0x17')](),moment()[_0xd4bc('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x4db138[_0xd4bc('0x13')]({'data2':encryptor[_0xd4bc('0x18')](moment()['format'](_0xd4bc('0x19')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x3cbed3[_0xd4bc('0x11')]),_0xd4bc('0x1a'))>DAYS){logger[_0xd4bc('0x12')](_0xd4bc('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4db138[_0xd4bc('0x13')]({'data1':_0x4d699e,'data2':null,'license':null});}}}else{if(_0x3cbed3['data1']!=_0x4d699e){logger[_0xd4bc('0x12')](_0xd4bc('0x15'),_0x3cbed3[_0xd4bc('0x10')],_0x4d699e);return _0x4db138[_0xd4bc('0x13')]({'data1':_0x4d699e,'data2':null,'license':null});}}}return _0x4db138;})['then'](function(_0x521a81){_0x4db138=_0x521a81;})[_0xd4bc('0x1c')](function(_0x1afaf4){logger[_0xd4bc('0x1d')](_0x1afaf4['message']);})[_0xd4bc('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xd4bc('0x1f')](),_0x4db138);},TIME);});}function defaultLicense(){var _0x433bfc=hardware[_0xd4bc('0x1f')]();if(_0x433bfc){return db['License'][_0xd4bc('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x433bfc}})[_0xd4bc('0x21')](function(_0xca4926,_0x236daa){logger[_0xd4bc('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x433bfc);manageLicense(_0x433bfc,_0xca4926);})['catch'](function(_0x1ed2da){logger[_0xd4bc('0x1d')](_0x1ed2da['message']);});}}exports[_0xd4bc('0x22')]=defaultLicense;
\ No newline at end of file
index 03c21be..720f83b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32ff=['users','telephones','forEach','catch','pick','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','Breaking\x20license','License','defaults','then','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','getUuid','gray','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','user','telephone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32ff,0x15f));var _0xf32f=function(_0xe17cea,_0x3eac1e){_0xe17cea=_0xe17cea-0x0;var _0x48bb15=_0x32ff[_0xe17cea];return _0x48bb15;};'use strict';var util=require(_0xf32f('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xf32f('0x1'));var hardware=require(_0xf32f('0x2'));var encryptor=require(_0xf32f('0x3'));var db=require(_0xf32f('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf32f('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf32f('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3dcbbb){return new BPromise(function(_0x125856,_0x424ada){return db[_0xf32f('0x7')]['find'](_[_0xf32f('0x8')](_0x3dcbbb,{'raw':!![],'where':{'id':0x1}}))[_0xf32f('0x9')](function(_0x168811){return checkLicense(_0x168811,null);})[_0xf32f('0x9')](function(_0x7e7c0d){_0x125856(_0x7e7c0d);return;})['catch'](function(_0x55a8d0){_0x424ada(_0x55a8d0);});});}function checkLicense(_0x133618,_0x416bb2){if(!_0x133618){demoLicense['uuid']=_0x133618[_0xf32f('0xa')];return demoLicense;}try{var _0x5d0d6d=_0x416bb2||_0x133618['license'];if(_[_0xf32f('0xb')](_0x5d0d6d)){throw new Error(_0xf32f('0xc'));}var _0x171fb6=_0x133618[_0xf32f('0xa')];var _0x2eec6d=_0x133618['data2'];var _0x33ff9b=_0x171fb6[_0xf32f('0xd')]('-')[0x4];var _0x463a14=_0x171fb6[_0xf32f('0xd')]('-')[0x0];var _0x5cdc24=encryptor[_0xf32f('0xe')](_0x5d0d6d,util[_0xf32f('0xf')](_0xf32f('0x10'),_0x33ff9b,_0x171fb6,_0x463a14));var _0x45831f=JSON[_0xf32f('0x11')](_0x5cdc24);_0x45831f[_0xf32f('0x12')]=![];_0x45831f[_0xf32f('0x13')]=_0x171fb6;_0x45831f[_0xf32f('0x14')]=hardware[_0xf32f('0x15')]();if(_0x2eec6d){var _0x461c6e=encryptor[_0xf32f('0xe')](_0x2eec6d);_0x45831f[_0xf32f('0x16')]=_0x461c6e;_0x45831f['deadline']=moment(_0x461c6e)[_0xf32f('0x17')](0x7,_0xf32f('0x18'))['format']();_0x45831f['grayReason']=_0x45831f['uuid']!=_0x45831f['machineUuid']?_0xf32f('0x19'):_0xf32f('0x1a');}return _0x45831f;}catch(_0xe9b579){breakingLicense[_0xf32f('0x13')]=_0x133618['data1'];breakingLicense[_0xf32f('0x1b')]=_0xe9b579[_0xf32f('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a989c,_0x3e7a96){getLicense()[_0xf32f('0x9')](function(_0x41f214){return db[_0xf32f('0x1c')][_0xf32f('0x1d')]({'attributes':[_0xf32f('0x1e'),[db[_0xf32f('0x1f')]['fn'](_0xf32f('0x20'),db[_0xf32f('0x1f')]['col'](_0xf32f('0x1e'))),'count']],'group':_0xf32f('0x1e'),'where':{'role':{'$or':[_0xf32f('0x21'),_0xf32f('0x22'),_0xf32f('0x23')]}},'raw':!![]})[_0xf32f('0x9')](function(_0x578208){var _0x3cc9e3={'user':_0x41f214[_0xf32f('0x24')]||0x0,'telephone':_0x41f214[_0xf32f('0x25')]||0x0};_0x578208[_0xf32f('0x26')](function(_0x2ddcf5){var _0x286378=_0x2ddcf5[_0xf32f('0x1e')]===_0xf32f('0x21')?_0xf32f('0x22'):_0x2ddcf5['role'];_0x3cc9e3[_0x286378]-=_0x2ddcf5['count'];if(_0x3cc9e3[_0x286378]<0x0)_0x3cc9e3[_0x286378]=0x0;});_0x5a989c(_0x3cc9e3);return;});})[_0xf32f('0x27')](function(_0x2ecac4){_0x3e7a96(_0x2ecac4);});});}function checkUserLimits(_0x4594e0){return new BPromise(function(_0x3f0b1,_0x1f69be){getLimits()[_0xf32f('0x9')](function(_0x22928e){var _0x76bce4=_[_0xf32f('0x28')](_['countBy'](_0x4594e0,_0xf32f('0x1e')),[_0xf32f('0x21'),_0xf32f('0x22'),_0xf32f('0x23')]);var _0x433efb=(_0x76bce4[_0xf32f('0x21')]||0x0)+(_0x76bce4[_0xf32f('0x22')]||0x0);var _0x1a4332=_0x76bce4[_0xf32f('0x23')]||0x0;if(_0x433efb>_0x22928e['user'])return _0x1f69be('License\x20limit\x20reached\x20for\x20users');if(_0x1a4332>_0x22928e['telephone'])return _0x1f69be(_0xf32f('0x29'));return _0x3f0b1();})['catch'](function(_0x1e2ecd){_0x1f69be(_0x1e2ecd);});});}module[_0xf32f('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense};
\ No newline at end of file
+var _0x41c7=['sequelize','COUNT','col','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','lodash','bluebird','./hardware','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','defaults','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','machineUuid','add','days','changed','disabled','User','findAll','role'];(function(_0x3be290,_0x54e769){var _0x57f423=function(_0x17abe9){while(--_0x17abe9){_0x3be290['push'](_0x3be290['shift']());}};_0x57f423(++_0x54e769);}(_0x41c7,0xd1));var _0x741c=function(_0x66733b,_0x3d1b88){_0x66733b=_0x66733b-0x0;var _0x355d45=_0x41c7[_0x66733b];return _0x355d45;};'use strict';var util=require('util');var _=require(_0x741c('0x0'));var moment=require('moment');var BPromise=require(_0x741c('0x1'));var hardware=require(_0x741c('0x2'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x741c('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x741c('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x741c('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x741c('0x5'),'machineUuid':hardware[_0x741c('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x29ac1a){return new BPromise(function(_0xd2a7e6,_0x555e60){return db[_0x741c('0x6')]['find'](_[_0x741c('0x7')](_0x29ac1a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xebe379){return checkLicense(_0xebe379,null);})[_0x741c('0x8')](function(_0x1090d6){_0xd2a7e6(_0x1090d6);return;})['catch'](function(_0x4ad212){_0x555e60(_0x4ad212);});});}function checkLicense(_0x2c9d79,_0x2c2c2b){if(!_0x2c9d79){demoLicense[_0x741c('0x9')]=_0x2c9d79[_0x741c('0xa')];return demoLicense;}try{var _0x23f373=_0x2c2c2b||_0x2c9d79['license'];if(_[_0x741c('0xb')](_0x23f373)){throw new Error(_0x741c('0xc'));}var _0x2db2a6=_0x2c9d79[_0x741c('0xa')];var _0x551592=_0x2c9d79['data2'];var _0x30f0f5=_0x2db2a6[_0x741c('0xd')]('-')[0x4];var _0x175347=_0x2db2a6['split']('-')[0x0];var _0x5ae084=encryptor[_0x741c('0xe')](_0x23f373,util[_0x741c('0xf')]('%s:%s:%s',_0x30f0f5,_0x2db2a6,_0x175347));var _0xd83352=JSON[_0x741c('0x10')](_0x5ae084);_0xd83352['demo']=![];_0xd83352[_0x741c('0x9')]=_0x2db2a6;_0xd83352[_0x741c('0x11')]=hardware['getUuid']();if(_0x551592){var _0x5acbca=encryptor[_0x741c('0xe')](_0x551592);_0xd83352['gray']=_0x5acbca;_0xd83352['deadline']=moment(_0x5acbca)[_0x741c('0x12')](0x7,_0x741c('0x13'))[_0x741c('0xf')]();_0xd83352['grayReason']=_0xd83352['uuid']!=_0xd83352[_0x741c('0x11')]?_0x741c('0x14'):_0x741c('0x15');}return _0xd83352;}catch(_0x38537f){breakingLicense[_0x741c('0x9')]=_0x2c9d79[_0x741c('0xa')];breakingLicense['message']=_0x38537f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1a7d6e,_0x399c3b){getLicense()[_0x741c('0x8')](function(_0x4e1fdb){return db[_0x741c('0x16')][_0x741c('0x17')]({'attributes':[_0x741c('0x18'),[db[_0x741c('0x19')]['fn'](_0x741c('0x1a'),db['sequelize'][_0x741c('0x1b')]('role')),'count']],'group':_0x741c('0x18'),'where':{'role':{'$or':[_0x741c('0x1c'),_0x741c('0x1d'),_0x741c('0x1e')]}},'raw':!![]})[_0x741c('0x8')](function(_0x475ad0){var _0x5af4be={'user':_0x4e1fdb[_0x741c('0x1f')]||0x0,'telephone':_0x4e1fdb[_0x741c('0x20')]||0x0};_0x475ad0[_0x741c('0x21')](function(_0x540d1b){var _0x2dd81b=_0x540d1b[_0x741c('0x18')]===_0x741c('0x1c')?_0x741c('0x1d'):_0x540d1b[_0x741c('0x18')];_0x5af4be[_0x2dd81b]-=_0x540d1b['count'];if(_0x5af4be[_0x2dd81b]<0x0)_0x5af4be[_0x2dd81b]=0x0;});_0x1a7d6e(_0x5af4be);return;});})['catch'](function(_0x3f21c6){_0x399c3b(_0x3f21c6);});});}function checkUserLimits(_0x115b6e){return new BPromise(function(_0x10a255,_0x1d3999){getLimits()['then'](function(_0x4463b0){var _0x4619e0=_[_0x741c('0x22')](_[_0x741c('0x23')](_0x115b6e,_0x741c('0x18')),[_0x741c('0x1c'),_0x741c('0x1d'),_0x741c('0x1e')]);var _0xac4348=(_0x4619e0[_0x741c('0x1c')]||0x0)+(_0x4619e0['user']||0x0);var _0x4e0d60=_0x4619e0['telephone']||0x0;if(_0xac4348>_0x4463b0[_0x741c('0x1d')])return _0x1d3999(_0x741c('0x24'));if(_0x4e0d60>_0x4463b0[_0x741c('0x1e')])return _0x1d3999(_0x741c('0x25'));return _0x10a255();})[_0x741c('0x26')](function(_0x559908){_0x1d3999(_0x559908);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense};
\ No newline at end of file
index 18f2a31..ff95ad3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x958a=['exports','http://localhost:9000','app-id','secret'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x958a,0x128));var _0xa958=function(_0x36a117,_0x32cf83){_0x36a117=_0x36a117-0x0;var _0x32036f=_0x958a[_0x36a117];return _0x32036f;};'use strict';module[_0xa958('0x0')]={'DOMAIN':_0xa958('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa958('0x2'),'GOOGLE_SECRET':_0xa958('0x3'),'DEBUG':''};
\ No newline at end of file
+var _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x28f2,0x193));var _0x228f=function(_0xaa957,_0x48909e){_0xaa957=_0xaa957-0x0;var _0x38a586=_0x28f2[_0xaa957];return _0x38a586;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''};
\ No newline at end of file
index b89ece2..e824eab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa19d=['../utils/loggers','exports'];(function(_0x93200d,_0xbfa500){var _0x21676e=function(_0x3f5570){while(--_0x3f5570){_0x93200d['push'](_0x93200d['shift']());}};_0x21676e(++_0xbfa500);}(_0xa19d,0xca));var _0xda19=function(_0x51cc99,_0x5ea308){_0x51cc99=_0x51cc99-0x0;var _0x186820=_0xa19d[_0x51cc99];return _0x186820;};'use strict';var fileLogger=require(_0xda19('0x0'))['fileLogger'];module[_0xda19('0x1')]=fileLogger;
\ No newline at end of file
+var _0x43a0=['fileLogger','../utils/loggers'];(function(_0x4eeb3f,_0x2a67a5){var _0x40d2b9=function(_0x57bc0b){while(--_0x57bc0b){_0x4eeb3f['push'](_0x4eeb3f['shift']());}};_0x40d2b9(++_0x2a67a5);}(_0x43a0,0x1c3));var _0x043a=function(_0x3e2086,_0x4c31d8){_0x3e2086=_0x3e2086-0x0;var _0x38b7cc=_0x43a0[_0x3e2086];return _0x38b7cc;};'use strict';var fileLogger=require(_0x043a('0x0'))[_0x043a('0x1')];module['exports']=fileLogger;
\ No newline at end of file
index d5f383f..dec4996 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fcd=['../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express'];(function(_0x180d0e,_0x3a43d5){var _0x24e629=function(_0xffcb0b){while(--_0xffcb0b){_0x180d0e['push'](_0x180d0e['shift']());}};_0x24e629(++_0x3a43d5);}(_0x4fcd,0x191));var _0xd4fc=function(_0x527a1f,_0xa115f8){_0x527a1f=_0x527a1f-0x0;var _0x599e8c=_0x4fcd[_0x527a1f];return _0x599e8c;};'use strict';var path=require(_0xd4fc('0x0'));var cfg=require(_0xd4fc('0x1'));var env={'NODE_PATH':path[_0xd4fc('0x2')](path[_0xd4fc('0x3')](cfg[_0xd4fc('0x4')],_0xd4fc('0x5')))};var pm2config={'apps':[{'name':_0xd4fc('0x6'),'script':path[_0xd4fc('0x3')](__dirname,_0xd4fc('0x7')),'env':env},{'name':'ami','script':path[_0xd4fc('0x3')](__dirname,_0xd4fc('0x8')),'env':env},{'name':_0xd4fc('0x9'),'script':path[_0xd4fc('0x3')](__dirname,_0xd4fc('0xa')),'env':env},{'name':_0xd4fc('0xb'),'script':path['join'](__dirname,_0xd4fc('0xc')),'env':env},{'name':_0xd4fc('0xd'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xd4fc('0xe'),'script':path[_0xd4fc('0x3')](__dirname,_0xd4fc('0xf')),'env':env}]};module[_0xd4fc('0x10')]=pm2config;
\ No newline at end of file
+var _0x3942=['xdr','../../services/xdr/index.js','exports','../../config/environment','resolve','join','legacy-libs','../../services/express/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x1ff329,_0x33e086){var _0x28501d=function(_0x38b7c7){while(--_0x38b7c7){_0x1ff329['push'](_0x1ff329['shift']());}};_0x28501d(++_0x33e086);}(_0x3942,0x10b));var _0x2394=function(_0x4d1e8d,_0x59a100){_0x4d1e8d=_0x4d1e8d-0x0;var _0x23335c=_0x3942[_0x4d1e8d];return _0x23335c;};'use strict';var path=require('path');var cfg=require(_0x2394('0x0'));var env={'NODE_PATH':path[_0x2394('0x1')](path[_0x2394('0x2')](cfg['root'],_0x2394('0x3')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x2394('0x4')),'env':env},{'name':'ami','script':path[_0x2394('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x2394('0x2')](__dirname,_0x2394('0x5')),'env':env},{'name':_0x2394('0x6'),'script':path[_0x2394('0x2')](__dirname,_0x2394('0x7')),'env':env},{'name':_0x2394('0x8'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x2394('0x9'),'script':path[_0x2394('0x2')](__dirname,_0x2394('0xa')),'env':env}]};module[_0x2394('0xb')]=pm2config;
\ No newline at end of file
index 1569c0b..9363154 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x882a=['connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','./config'];(function(_0x343fb3,_0x1ff7fe){var _0x320496=function(_0xf680ff){while(--_0xf680ff){_0x343fb3['push'](_0x343fb3['shift']());}};_0x320496(++_0x1ff7fe);}(_0x882a,0x10f));var _0xa882=function(_0xd630f3,_0x2adf93){_0xd630f3=_0xd630f3-0x0;var _0x1c63b5=_0x882a[_0xd630f3];return _0x1c63b5;};'use strict';var pm2=require('pm2');var BPromise=require(_0xa882('0x0'));var config=require(_0xa882('0x1'));function connect(){return new BPromise(function(_0x4887ad,_0x4346b4){return pm2[_0xa882('0x2')](function(_0x55a412){if(_0x55a412){return _0x4346b4(_0x55a412);}return _0x4887ad('connected');});});};exports[_0xa882('0x3')]=function(_0xc309a0){return connect()[_0xa882('0x4')](function(){return new BPromise(function(_0x25d617,_0x39296d){return pm2[_0xa882('0x3')](_0xc309a0,function(_0x4d38f0,_0x2e2b75){if(_0x4d38f0){return _0x39296d(_0x4d38f0);}pm2[_0xa882('0x5')]();return _0x25d617(_0x2e2b75);});});});};exports[_0xa882('0x6')]=function(_0x343cef){return connect()[_0xa882('0x4')](function(){return new BPromise(function(_0x1b7370,_0x351145){return pm2[_0xa882('0x6')](_0x343cef,function(_0x56f11e,_0x2a87e3){if(_0x56f11e){return _0x351145(_0x56f11e);}pm2[_0xa882('0x5')]();return _0x1b7370(_0x2a87e3);});});});};exports[_0xa882('0x7')]=function(_0x53beb7){return connect()['then'](function(){return new BPromise(function(_0x50cb5e,_0x2a3383){return pm2[_0xa882('0x7')](_0x53beb7,function(_0x46a7c6,_0x3fbbc8){if(_0x46a7c6){return _0x2a3383(_0x46a7c6);}pm2['disconnect']();return _0x50cb5e(_0x3fbbc8);});});});};exports[_0xa882('0x8')]=function(){return connect()[_0xa882('0x4')](function(){return new BPromise(function(_0x5624dc,_0x537d5e){return pm2[_0xa882('0x8')](function(_0x222e31,_0xa949cc){if(_0x222e31){return _0x537d5e(_0x222e31);}pm2[_0xa882('0x5')]();return _0x5624dc(_0xa949cc);});});});};exports[_0xa882('0x9')]=function(_0x2c34a8){return connect()[_0xa882('0x4')](function(){return new BPromise(function(_0x595545,_0x669418){return pm2[_0xa882('0x9')](_0x2c34a8,function(_0x5d9c42,_0x550b14){if(_0x5d9c42){return _0x669418(_0x5d9c42);}pm2['disconnect']();return _0x595545(_0x550b14);});});});};exports['delete']=function(_0x38fe8d){return connect()['then'](function(){return new BPromise(function(_0x23f8dd,_0x24c513){return pm2[_0xa882('0xa')](_0x38fe8d,function(_0x4170b6,_0x347ad7){if(_0x4170b6){return _0x24c513(_0x4170b6);}pm2[_0xa882('0x5')]();return _0x23f8dd(_0x347ad7);});});});};exports[_0xa882('0xb')]=function(){return connect()[_0xa882('0x4')](function(){return new BPromise(function(_0x725d56,_0x5494a8){return pm2[_0xa882('0xb')](function(_0x1511c1){if(_0x1511c1){return _0x5494a8(_0x1511c1);}return _0x725d56(_0xa882('0xc'));});});});};
\ No newline at end of file
+var _0xa85f=['list','disconnect','describe','delete','dump','saved','./config','connect','connected','then','start','stop','restart'];(function(_0x3d0d71,_0x3c4811){var _0xc3c53f=function(_0x5c08ab){while(--_0x5c08ab){_0x3d0d71['push'](_0x3d0d71['shift']());}};_0xc3c53f(++_0x3c4811);}(_0xa85f,0x1da));var _0xfa85=function(_0x1f8aeb,_0x452257){_0x1f8aeb=_0x1f8aeb-0x0;var _0x2f268c=_0xa85f[_0x1f8aeb];return _0x2f268c;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0xfa85('0x0'));function connect(){return new BPromise(function(_0x2efae1,_0x279ebd){return pm2[_0xfa85('0x1')](function(_0x2837e3){if(_0x2837e3){return _0x279ebd(_0x2837e3);}return _0x2efae1(_0xfa85('0x2'));});});};exports['start']=function(_0x17fbf0){return connect()[_0xfa85('0x3')](function(){return new BPromise(function(_0x244308,_0x10b5fc){return pm2[_0xfa85('0x4')](_0x17fbf0,function(_0xe1a8c7,_0x533b0b){if(_0xe1a8c7){return _0x10b5fc(_0xe1a8c7);}pm2['disconnect']();return _0x244308(_0x533b0b);});});});};exports[_0xfa85('0x5')]=function(_0x5085f1){return connect()[_0xfa85('0x3')](function(){return new BPromise(function(_0x252780,_0x348ed2){return pm2[_0xfa85('0x5')](_0x5085f1,function(_0x34be33,_0x422455){if(_0x34be33){return _0x348ed2(_0x34be33);}pm2['disconnect']();return _0x252780(_0x422455);});});});};exports['restart']=function(_0x3f108e){return connect()[_0xfa85('0x3')](function(){return new BPromise(function(_0x318a57,_0x2340b7){return pm2[_0xfa85('0x6')](_0x3f108e,function(_0x36ba27,_0x416373){if(_0x36ba27){return _0x2340b7(_0x36ba27);}pm2['disconnect']();return _0x318a57(_0x416373);});});});};exports[_0xfa85('0x7')]=function(){return connect()[_0xfa85('0x3')](function(){return new BPromise(function(_0x8de68d,_0x291fa2){return pm2[_0xfa85('0x7')](function(_0x3d1728,_0x57a841){if(_0x3d1728){return _0x291fa2(_0x3d1728);}pm2[_0xfa85('0x8')]();return _0x8de68d(_0x57a841);});});});};exports[_0xfa85('0x9')]=function(_0x49d4a7){return connect()['then'](function(){return new BPromise(function(_0x16bb56,_0x422c7e){return pm2['describe'](_0x49d4a7,function(_0xf62ce1,_0x3179b4){if(_0xf62ce1){return _0x422c7e(_0xf62ce1);}pm2['disconnect']();return _0x16bb56(_0x3179b4);});});});};exports['delete']=function(_0x503a2b){return connect()[_0xfa85('0x3')](function(){return new BPromise(function(_0x16a172,_0xb29374){return pm2[_0xfa85('0xa')](_0x503a2b,function(_0x6ed021,_0x702138){if(_0x6ed021){return _0xb29374(_0x6ed021);}pm2[_0xfa85('0x8')]();return _0x16a172(_0x702138);});});});};exports[_0xfa85('0xb')]=function(){return connect()[_0xfa85('0x3')](function(){return new BPromise(function(_0x36f650,_0x18d369){return pm2[_0xfa85('0xb')](function(_0xa9a49f){if(_0xa9a49f){return _0x18d369(_0xa9a49f);}return _0x36f650(_0xfa85('0xc'));});});});};
\ No newline at end of file
index 08fb58d..fa77331 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c16=['system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','inspect','lodash','moment','util','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0c16,0xb1));var _0x60c1=function(_0x5532e1,_0x388cd1){_0x5532e1=_0x5532e1-0x0;var _0x276bb5=_0x0c16[_0x5532e1];return _0x276bb5;};'use strict';var _=require(_0x60c1('0x0'));var moment=require(_0x60c1('0x1'));var Redis=require('ioredis');var util=require(_0x60c1('0x2'));var config=require('../../config/environment');var db=require(_0x60c1('0x3'))['db'];var logger=require(_0x60c1('0x4'))(_0x60c1('0x5'));config['redis']=_[_0x60c1('0x6')](config['redis'],{'host':_0x60c1('0x7'),'port':0x18eb});var io=require(_0x60c1('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x1c1048=0x0;var _0x16030f=[];return db[_0x60c1('0x9')]['find']({'raw':!![],'attributes':['id',_0x60c1('0xa')],'where':{'id':0x1}})[_0x60c1('0xb')](function(_0x419642){_0x1c1048=_0x419642[_0x60c1('0xa')];if(_0x1c1048){return db[_0x60c1('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x60c1('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x419642[_0x60c1('0xa')],_0x60c1('0xe'))}}});}else{return[];}})[_0x60c1('0xb')](function(_0x379a0f){if(_0x379a0f&&_0x379a0f[_0x60c1('0xf')]){_0x16030f=_['map'](_0x379a0f||[],'id');logger['info'](_0x60c1('0x10'),_0x16030f[_0x60c1('0x11')]());return db[_0x60c1('0xc')][_0x60c1('0x12')]({'closeReason':_0x60c1('0x13'),'disposition':_0x60c1('0x14'),'closed':!![],'closedAt':moment()['format'](_0x60c1('0x15'))},{'where':{'id':_0x16030f}});}})['then'](function(){if(_0x16030f&&_0x16030f[_0x60c1('0xf')]){logger[_0x60c1('0x16')](_0x60c1('0x17'),_0x16030f[_0x60c1('0x11')]());for(var _0x29285d=0x0;_0x29285d<_0x16030f[_0x60c1('0xf')];_0x29285d++){io['emit'](_0x60c1('0x18'),{'id':_0x16030f[_0x29285d],'closed':!![]});}}})[_0x60c1('0x19')](function(_0x9ac925){logger[_0x60c1('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x9ac925?util[_0x60c1('0x1b')](_0x9ac925,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0xe345=['timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','minutes','length','info','join','update','system'];(function(_0x3df9e2,_0x4554ad){var _0x2eff28=function(_0x31295b){while(--_0x31295b){_0x3df9e2['push'](_0x3df9e2['shift']());}};_0x2eff28(++_0x4554ad);}(_0xe345,0x173));var _0x5e34=function(_0x23e5ce,_0x57584d){_0x23e5ce=_0x23e5ce-0x0;var _0x2ce19b=_0xe345[_0x23e5ce];return _0x2ce19b;};'use strict';var _=require(_0x5e34('0x0'));var moment=require(_0x5e34('0x1'));var Redis=require(_0x5e34('0x2'));var util=require('util');var config=require(_0x5e34('0x3'));var db=require(_0x5e34('0x4'))['db'];var logger=require(_0x5e34('0x5'))('schedule');config[_0x5e34('0x6')]=_[_0x5e34('0x7')](config['redis'],{'host':_0x5e34('0x8'),'port':0x18eb});var io=require(_0x5e34('0x9'))(new Redis(config[_0x5e34('0x6')]));function closeInteractions(){var _0x2658e0=0x0;var _0x39452f=[];return db[_0x5e34('0xa')][_0x5e34('0xb')]({'raw':!![],'attributes':['id',_0x5e34('0xc')],'where':{'id':0x1}})[_0x5e34('0xd')](function(_0x1cad4e){_0x2658e0=_0x1cad4e[_0x5e34('0xc')];if(_0x2658e0){return db[_0x5e34('0xe')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x1cad4e[_0x5e34('0xc')],_0x5e34('0xf'))}}});}else{return[];}})[_0x5e34('0xd')](function(_0x1597f5){if(_0x1597f5&&_0x1597f5[_0x5e34('0x10')]){_0x39452f=_['map'](_0x1597f5||[],'id');logger[_0x5e34('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x39452f[_0x5e34('0x12')]());return db[_0x5e34('0xe')][_0x5e34('0x13')]({'closeReason':_0x5e34('0x14'),'disposition':_0x5e34('0x15'),'closed':!![],'closedAt':moment()['format'](_0x5e34('0x16'))},{'where':{'id':_0x39452f}});}})[_0x5e34('0xd')](function(){if(_0x39452f&&_0x39452f[_0x5e34('0x10')]){logger[_0x5e34('0x11')](_0x5e34('0x17'),_0x39452f['join']());for(var _0x2cf866=0x0;_0x2cf866<_0x39452f['length'];_0x2cf866++){io[_0x5e34('0x18')](_0x5e34('0x19'),{'id':_0x39452f[_0x2cf866],'closed':!![]});}}})[_0x5e34('0x1a')](function(_0x189eda){logger['error'](_0x5e34('0x1b'),_0x189eda?util['inspect'](_0x189eda,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index 8915c09..3e1813d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedf9=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x48ae62,_0x3cfce7){var _0x2634a6=function(_0x17b9c7){while(--_0x17b9c7){_0x48ae62['push'](_0x48ae62['shift']());}};_0x2634a6(++_0x3cfce7);}(_0xedf9,0x1c1));var _0x9edf=function(_0x1ecd12,_0x5826dd){_0x1ecd12=_0x1ecd12-0x0;var _0x348b09=_0xedf9[_0x1ecd12];return _0x348b09;};'use strict';function start(){var _0x5c3d2b=require(_0x9edf('0x0'));return _0x5c3d2b[_0x9edf('0x1')]();}module[_0x9edf('0x2')]={'intervals':{},'start':start};
\ No newline at end of file
+var _0x57c4=['exports'];(function(_0x294ebc,_0x4b7d49){var _0x1f758c=function(_0x5d6499){while(--_0x5d6499){_0x294ebc['push'](_0x294ebc['shift']());}};_0x1f758c(++_0x4b7d49);}(_0x57c4,0xf5));var _0x457c=function(_0x10191d,_0x350923){_0x10191d=_0x10191d-0x0;var _0x4270c0=_0x57c4[_0x10191d];return _0x4270c0;};'use strict';function start(){var _0x43cc3d=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x43cc3d['startAllRefreshIntervals']();}module[_0x457c('0x0')]={'intervals':{},'start':start};
\ No newline at end of file
index 6df77db..457cabf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdec7=['exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','length','exists','stop','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','basename','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','stringify','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0xdec7,0xbb));var _0x7dec=function(_0x416b63,_0x23bb95){_0x416b63=_0x416b63-0x0;var _0x99aacf=_0xdec7[_0x416b63];return _0x99aacf;};'use strict';var fs=require('fs');var util=require(_0x7dec('0x0'));var path=require('path');var _=require(_0x7dec('0x1'));var moment=require(_0x7dec('0x2'));var CronJobManager=require(_0x7dec('0x3'));var jayson=require(_0x7dec('0x4'));var BPromise=require(_0x7dec('0x5'));var logger=require('../logger')(_0x7dec('0x6'));var db=require(_0x7dec('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x7dec('0x8'));var client=jayson[_0x7dec('0x9')][_0x7dec('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x160bf6,_0x51592b){return function(){logger[_0x7dec('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x160bf6[_0x7dec('0xc')]);var _0x30fcd7=!![];var _0x10ea0c=_0x160bf6['MailAccount']['getSmtpOptions']();var _0xc5011={'account':_0x10ea0c,'message':{'from':util[_0x7dec('0xd')](_0x7dec('0xe'),_0x160bf6[_0x7dec('0xf')][_0x7dec('0x10')],_0x160bf6[_0x7dec('0xf')]['email']||_0x160bf6[_0x7dec('0xf')][_0x7dec('0x11')][_0x7dec('0x12')]),'to':_0x160bf6[_0x7dec('0xc')],'cc':_0x160bf6['cc'],'bcc':_0x160bf6[_0x7dec('0x13')],'subject':util[_0x7dec('0xd')](_0x7dec('0x14'),_0x51592b['name'],_0x160bf6['subtractNumber'],_0x160bf6[_0x7dec('0x15')])}};var _0x46593f=path[_0x7dec('0x16')](__dirname,_0x7dec('0x17'));var _0x55b119=_0x51592b[_0x7dec('0x18')];var _0x47a9f3=util[_0x7dec('0xd')]('%s.%s',path[_0x7dec('0x19')](_0x51592b[_0x7dec('0x18')],path['extname'](_0x51592b[_0x7dec('0x18')])),'zip');var _0x2d7214=path[_0x7dec('0x16')](_0x46593f,_0x55b119);var _0x3968a1=path[_0x7dec('0x16')](_0x46593f,_0x47a9f3);if(fs[_0x7dec('0x1a')](_0x2d7214)){_0x51592b[_0x7dec('0x1b')]=_0x7dec('0x1c');_0xc5011[_0x7dec('0x1d')][_0x7dec('0x1e')]=[{'filename':_0x55b119,'path':_0x2d7214}];_0xc5011[_0x7dec('0x1d')][_0x7dec('0x1f')]=util[_0x7dec('0xd')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x51592b,null,0x2));}else if(fs['existsSync'](_0x3968a1)){_0x51592b[_0x7dec('0x1b')]=_0x7dec('0x1c');_0xc5011[_0x7dec('0x1d')]['attachments']=[{'filename':_0x47a9f3,'path':_0x3968a1}];}else{_0xc5011[_0x7dec('0x1d')][_0x7dec('0x1f')]=_0x7dec('0x20');if(!_0x160bf6[_0x7dec('0x21')]){_0x30fcd7=![];logger[_0x7dec('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x30fcd7){return client[_0x7dec('0x22')](_0x7dec('0x23'),_0xc5011)[_0x7dec('0x24')](function(_0x68d943){if(_0x68d943[_0x7dec('0x25')]){return logger[_0x7dec('0x25')](_0x7dec('0x26'),JSON[_0x7dec('0x27')](_0x68d943));}return logger['info']('email\x20sent');})[_0x7dec('0x28')](function(_0x227d29){return logger[_0x7dec('0x25')](_0x7dec('0x26'),JSON[_0x7dec('0x27')](_0x227d29));});}};}function handleError(){return function(_0x314907){return logger[_0x7dec('0x25')](JSON[_0x7dec('0x27')](_0x314907));};}function handleResult(_0x2aaf00){return function(_0x238bc6){logger['info'](_0x7dec('0x29'),JSON[_0x7dec('0x27')](_0x238bc6));if(_0x2aaf00[_0x7dec('0xf')]&&_0x2aaf00['MailAccount'][_0x7dec('0x11')]&&!_['isNil'](_0x2aaf00[_0x7dec('0xc')])){setTimeout(handleSendEmail(_0x2aaf00,_0x238bc6),0x3c*0x3e8);}};}function handleJob(_0x4bfb01){return function(){try{if(_[_0x7dec('0x2a')](_0x4bfb01['subtractNumber'])){return logger[_0x7dec('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x7dec('0x2a')](_0x4bfb01[_0x7dec('0x15')])){return logger['info'](_0x7dec('0x2b'));}var _0x366b4b={'startDate':moment()[_0x7dec('0x2c')](_0x4bfb01['subtractNumber'],_0x4bfb01[_0x7dec('0x15')])[_0x7dec('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x7dec('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x4bfb01[_0x7dec('0x2d')],'name':_0x4bfb01['name']};if(!_[_0x7dec('0x2a')](_0x4bfb01[_0x7dec('0x2e')])){logger[_0x7dec('0xb')](_0x7dec('0x2f'),_0x4bfb01[_0x7dec('0x2e')]);return analyticDefaultReportController[_0x7dec('0x30')]({'id':_0x4bfb01[_0x7dec('0x2e')]},_0x366b4b)[_0x7dec('0x24')](handleResult(_0x4bfb01))[_0x7dec('0x28')](handleError());}if(!_[_0x7dec('0x2a')](_0x4bfb01[_0x7dec('0x31')])){logger['info'](_0x7dec('0x32'),_0x4bfb01[_0x7dec('0x31')]);return analyticCustomReportController[_0x7dec('0x30')]({'id':_0x4bfb01['CustomReportId']},_0x366b4b)[_0x7dec('0x24')](handleResult(_0x4bfb01))[_0x7dec('0x28')](handleError());}}catch(_0xcf3e4f){logger['error'](JSON[_0x7dec('0x27')](_0xcf3e4f));}return logger['info'](_0x7dec('0x33'));};}function getJobs(_0x278608){var _0x36a076={};if(_0x278608){_0x36a076['id']=_0x278608;}return db[_0x7dec('0x34')][_0x7dec('0x35')]({'where':_0x36a076,'include':[{'model':db[_0x7dec('0xf')],'attributes':['id',_0x7dec('0x10'),_0x7dec('0xc')],'include':[{'model':db[_0x7dec('0x36')],'as':_0x7dec('0x11'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x7dec('0x24')](function(_0x2fe4ee){var _0x29c297=_[_0x7dec('0x37')](manager['jobs']);var _0x4c66b7=_[_0x7dec('0x38')](_0x2fe4ee,function(_0x233ef8){return _0x233ef8['id'][_0x7dec('0x39')]();});var _0x1710d0=_[_0x7dec('0x3a')](_0x2fe4ee,function(_0x56fb9e){return _0x56fb9e['id'][_0x7dec('0x39')]();});var _0x46d739=_0x278608?_0x4c66b7:_[_0x7dec('0x3b')](_0x4c66b7,_0x29c297);var _0x414769=_['intersection'](_0x4c66b7,_0x29c297);var _0x54bc9f=_[_0x7dec('0x3b')](_0x29c297,_0x4c66b7);var _0x5e8b6c;var _0x4b3cde;for(_0x5e8b6c=0x0;_0x5e8b6c<_0x54bc9f[_0x7dec('0x3c')]&&!_0x278608;_0x5e8b6c+=0x1){_0x4b3cde=_0x54bc9f[_0x5e8b6c][_0x7dec('0x39')]();if(manager[_0x7dec('0x3d')](_0x4b3cde)){manager[_0x7dec('0x3e')](_0x4b3cde);manager['deleteJob'](_0x4b3cde);logger[_0x7dec('0xb')]('delete\x20cron',_0x4b3cde);}}logger[_0x7dec('0xb')](_0x7dec('0x3f'),JSON[_0x7dec('0x27')](_0x46d739));for(_0x5e8b6c=0x0;_0x5e8b6c<_0x46d739[_0x7dec('0x3c')];_0x5e8b6c+=0x1){_0x4b3cde=_0x46d739[_0x5e8b6c][_0x7dec('0x39')]();logger[_0x7dec('0xb')](_0x7dec('0x40'),_0x4b3cde);if(_0x278608){logger[_0x7dec('0xb')]('my\x20id',_0x278608);logger[_0x7dec('0xb')](JSON[_0x7dec('0x27')](_0x1710d0[_0x4b3cde]));BPromise[_0x7dec('0x41')]()[_0x7dec('0x24')](handleJob(_0x1710d0[_0x4b3cde]));logger['info'](_0x7dec('0x42'),_0x1710d0[_0x4b3cde][_0x7dec('0x10')],_0x1710d0[_0x4b3cde][_0x7dec('0x43')]);}else if(_0x1710d0[_0x4b3cde]['cron']&&_0x1710d0[_0x4b3cde][_0x7dec('0x44')]&&moment()[_0x7dec('0x45')](_0x1710d0[_0x4b3cde][_0x7dec('0x46')],_0x1710d0[_0x4b3cde][_0x7dec('0x47')])){manager[_0x7dec('0x48')](_0x4b3cde,_0x1710d0[_0x4b3cde][_0x7dec('0x43')],handleJob(_0x1710d0[_0x4b3cde]));manager[_0x7dec('0x49')](_0x4b3cde);logger['info'](_0x7dec('0x4a'),_0x1710d0[_0x4b3cde][_0x7dec('0x10')],_0x1710d0[_0x4b3cde][_0x7dec('0x43')]);}else if(manager[_0x7dec('0x3d')](_0x4b3cde)){manager[_0x7dec('0x3e')](_0x4b3cde);manager[_0x7dec('0x4b')](_0x4b3cde);logger[_0x7dec('0xb')](_0x7dec('0x4c'),_0x1710d0[_0x4b3cde][_0x7dec('0x10')],_0x1710d0[_0x4b3cde][_0x7dec('0x43')]);}}for(_0x5e8b6c=0x0,_0x4b3cde;_0x5e8b6c<_0x414769[_0x7dec('0x3c')]&&!_0x278608;_0x5e8b6c+=0x1){_0x4b3cde=_0x414769[_0x5e8b6c][_0x7dec('0x39')]();if(manager[_0x7dec('0x3d')](_0x4b3cde)){if(_0x1710d0[_0x4b3cde][_0x7dec('0x43')]&&_0x1710d0[_0x4b3cde][_0x7dec('0x44')]&&moment()[_0x7dec('0x45')](_0x1710d0[_0x4b3cde][_0x7dec('0x46')],_0x1710d0[_0x4b3cde][_0x7dec('0x47')])){manager['update'](_0x4b3cde,_0x1710d0[_0x4b3cde][_0x7dec('0x43')],handleJob(_0x1710d0[_0x4b3cde]));logger['info'](_0x7dec('0x4d'),_0x1710d0[_0x4b3cde]['name'],_0x1710d0[_0x4b3cde]['cron']);}else{manager[_0x7dec('0x3e')](_0x4b3cde);manager['deleteJob'](_0x4b3cde);logger[_0x7dec('0xb')](_0x7dec('0x4c'),_0x1710d0[_0x4b3cde][_0x7dec('0x10')],_0x1710d0[_0x4b3cde]['cron']);}}}})[_0x7dec('0x28')](function(_0x58934c){logger['error'](JSON[_0x7dec('0x27')](_0x58934c));});}exports[_0x7dec('0x4e')]=function(_0x4e196c){return getJobs(_0x4e196c);};exports[_0x7dec('0x49')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
+var _0x0641=['Smtp','user','Report\x20%s\x20last\x20%s\x20%s','../../files/reports','%s.%s','basename','savename','extname','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','CloudProvider','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','start','add\x20cron','active','isBetween','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','name'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x0641,0x140));var _0x1064=function(_0x47de9a,_0x40cf23){_0x47de9a=_0x47de9a-0x0;var _0x4b9d6c=_0x0641[_0x47de9a];return _0x4b9d6c;};'use strict';var fs=require('fs');var util=require(_0x1064('0x0'));var path=require(_0x1064('0x1'));var _=require(_0x1064('0x2'));var moment=require(_0x1064('0x3'));var CronJobManager=require(_0x1064('0x4'));var jayson=require(_0x1064('0x5'));var BPromise=require(_0x1064('0x6'));var logger=require(_0x1064('0x7'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1064('0x8')][_0x1064('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3260da,_0x43f7b4){return function(){logger[_0x1064('0xa')](_0x1064('0xb'),_0x3260da[_0x1064('0xc')]);var _0x3155d1=!![];var _0x339a1f=_0x3260da[_0x1064('0xd')]['getSmtpOptions']();var _0x24a520={'account':_0x339a1f,'message':{'from':util[_0x1064('0xe')]('\x22%s\x22\x20<%s>',_0x3260da[_0x1064('0xd')][_0x1064('0xf')],_0x3260da['MailAccount'][_0x1064('0xc')]||_0x3260da[_0x1064('0xd')][_0x1064('0x10')][_0x1064('0x11')]),'to':_0x3260da[_0x1064('0xc')],'cc':_0x3260da['cc'],'bcc':_0x3260da['bcc'],'subject':util[_0x1064('0xe')](_0x1064('0x12'),_0x43f7b4[_0x1064('0xf')],_0x3260da['subtractNumber'],_0x3260da['subtractUnit'])}};var _0x593253=path['join'](__dirname,_0x1064('0x13'));var _0xb51af2=_0x43f7b4['savename'];var _0x5aa31d=util[_0x1064('0xe')](_0x1064('0x14'),path[_0x1064('0x15')](_0x43f7b4[_0x1064('0x16')],path[_0x1064('0x17')](_0x43f7b4[_0x1064('0x16')])),_0x1064('0x18'));var _0x52d9e8=path[_0x1064('0x19')](_0x593253,_0xb51af2);var _0x2cccca=path[_0x1064('0x19')](_0x593253,_0x5aa31d);if(fs[_0x1064('0x1a')](_0x52d9e8)){_0x43f7b4[_0x1064('0x1b')]=_0x1064('0x1c');_0x24a520[_0x1064('0x1d')][_0x1064('0x1e')]=[{'filename':_0xb51af2,'path':_0x52d9e8}];_0x24a520[_0x1064('0x1d')]['text']=util['format'](_0x1064('0x1f'),JSON[_0x1064('0x20')](_0x43f7b4,null,0x2));}else if(fs['existsSync'](_0x2cccca)){_0x43f7b4[_0x1064('0x1b')]=_0x1064('0x1c');_0x24a520[_0x1064('0x1d')][_0x1064('0x1e')]=[{'filename':_0x5aa31d,'path':_0x2cccca}];}else{_0x24a520[_0x1064('0x1d')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3260da[_0x1064('0x21')]){_0x3155d1=![];logger[_0x1064('0xa')](_0x1064('0x22'));}}if(_0x3155d1){return client[_0x1064('0x23')](_0x1064('0x24'),_0x24a520)[_0x1064('0x25')](function(_0x86d636){if(_0x86d636[_0x1064('0x26')]){return logger[_0x1064('0x26')](_0x1064('0x27'),JSON['stringify'](_0x86d636));}return logger[_0x1064('0xa')]('email\x20sent');})['catch'](function(_0x2b5d5c){return logger[_0x1064('0x26')](_0x1064('0x27'),JSON['stringify'](_0x2b5d5c));});}};}function handleError(){return function(_0x4f50ba){return logger[_0x1064('0x26')](JSON[_0x1064('0x20')](_0x4f50ba));};}function handleResult(_0x1168a9){return function(_0x37d359){logger[_0x1064('0xa')](_0x1064('0x28'),JSON[_0x1064('0x20')](_0x37d359));if(_0x1168a9[_0x1064('0xd')]&&_0x1168a9[_0x1064('0xd')][_0x1064('0x10')]&&!_['isNil'](_0x1168a9[_0x1064('0xc')])){setTimeout(handleSendEmail(_0x1168a9,_0x37d359),0x3c*0x3e8);}};}function handleJob(_0x31f561){return function(){try{if(_['isNil'](_0x31f561[_0x1064('0x29')])){return logger[_0x1064('0xa')](_0x1064('0x2a'));}if(_[_0x1064('0x2b')](_0x31f561['subtractUnit'])){return logger[_0x1064('0xa')](_0x1064('0x2c'));}var _0x147f1c={'startDate':moment()[_0x1064('0x2d')](_0x31f561[_0x1064('0x29')],_0x31f561[_0x1064('0x2e')])[_0x1064('0xe')](_0x1064('0x2f')),'endDate':moment()[_0x1064('0xe')](_0x1064('0x2f')),'type':_0x1064('0x30'),'output':_0x31f561[_0x1064('0x31')],'name':_0x31f561[_0x1064('0xf')]};if(!_[_0x1064('0x2b')](_0x31f561[_0x1064('0x32')])){logger[_0x1064('0xa')](_0x1064('0x33'),_0x31f561['DefaultReportId']);return analyticDefaultReportController[_0x1064('0x34')]({'id':_0x31f561['DefaultReportId']},_0x147f1c)['then'](handleResult(_0x31f561))[_0x1064('0x35')](handleError());}if(!_[_0x1064('0x2b')](_0x31f561[_0x1064('0x36')])){logger[_0x1064('0xa')](_0x1064('0x37'),_0x31f561[_0x1064('0x36')]);return analyticCustomReportController['runReport']({'id':_0x31f561[_0x1064('0x36')]},_0x147f1c)[_0x1064('0x25')](handleResult(_0x31f561))['catch'](handleError());}}catch(_0x3cfcfa){logger[_0x1064('0x26')](JSON[_0x1064('0x20')](_0x3cfcfa));}return logger[_0x1064('0xa')]('no\x20report\x20id');};}function getJobs(_0x55ee7a){var _0xc67731={};if(_0x55ee7a){_0xc67731['id']=_0x55ee7a;}return db[_0x1064('0x38')]['findAll']({'where':_0xc67731,'include':[{'model':db[_0x1064('0xd')],'attributes':['id','name',_0x1064('0xc')],'include':[{'model':db[_0x1064('0x39')],'as':_0x1064('0x10'),'include':[{'model':db[_0x1064('0x3a')],'as':_0x1064('0x3a')}]}]}]})['then'](function(_0x3889ff){var _0x17bb99=_['keys'](manager[_0x1064('0x3b')]);var _0x52a3b2=_['map'](_0x3889ff,function(_0x4a6557){return _0x4a6557['id'][_0x1064('0x3c')]();});var _0x10e13c=_[_0x1064('0x3d')](_0x3889ff,function(_0x41779f){return _0x41779f['id'][_0x1064('0x3c')]();});var _0x6c8ac2=_0x55ee7a?_0x52a3b2:_[_0x1064('0x3e')](_0x52a3b2,_0x17bb99);var _0x3e9d4e=_[_0x1064('0x3f')](_0x52a3b2,_0x17bb99);var _0x31fd36=_[_0x1064('0x3e')](_0x17bb99,_0x52a3b2);var _0x1a0ff1;var _0x1b41d4;for(_0x1a0ff1=0x0;_0x1a0ff1<_0x31fd36[_0x1064('0x40')]&&!_0x55ee7a;_0x1a0ff1+=0x1){_0x1b41d4=_0x31fd36[_0x1a0ff1][_0x1064('0x3c')]();if(manager[_0x1064('0x41')](_0x1b41d4)){manager[_0x1064('0x42')](_0x1b41d4);manager[_0x1064('0x43')](_0x1b41d4);logger[_0x1064('0xa')]('delete\x20cron',_0x1b41d4);}}logger['info'](_0x1064('0x44'),JSON['stringify'](_0x6c8ac2));for(_0x1a0ff1=0x0;_0x1a0ff1<_0x6c8ac2[_0x1064('0x40')];_0x1a0ff1+=0x1){_0x1b41d4=_0x6c8ac2[_0x1a0ff1]['toString']();logger[_0x1064('0xa')](_0x1064('0x45'),_0x1b41d4);if(_0x55ee7a){logger['info'](_0x1064('0x46'),_0x55ee7a);logger[_0x1064('0xa')](JSON['stringify'](_0x10e13c[_0x1b41d4]));BPromise[_0x1064('0x47')]()[_0x1064('0x25')](handleJob(_0x10e13c[_0x1b41d4]));logger['info'](_0x1064('0x48'),_0x10e13c[_0x1b41d4][_0x1064('0xf')],_0x10e13c[_0x1b41d4][_0x1064('0x49')]);}else if(_0x10e13c[_0x1b41d4]['cron']&&_0x10e13c[_0x1b41d4]['active']&&moment()['isBetween'](_0x10e13c[_0x1b41d4][_0x1064('0x4a')],_0x10e13c[_0x1b41d4][_0x1064('0x4b')])){manager['add'](_0x1b41d4,_0x10e13c[_0x1b41d4][_0x1064('0x49')],handleJob(_0x10e13c[_0x1b41d4]));manager[_0x1064('0x4c')](_0x1b41d4);logger[_0x1064('0xa')](_0x1064('0x4d'),_0x10e13c[_0x1b41d4][_0x1064('0xf')],_0x10e13c[_0x1b41d4][_0x1064('0x49')]);}else if(manager[_0x1064('0x41')](_0x1b41d4)){manager[_0x1064('0x42')](_0x1b41d4);manager[_0x1064('0x43')](_0x1b41d4);logger[_0x1064('0xa')]('stop\x20cron',_0x10e13c[_0x1b41d4][_0x1064('0xf')],_0x10e13c[_0x1b41d4][_0x1064('0x49')]);}}for(_0x1a0ff1=0x0,_0x1b41d4;_0x1a0ff1<_0x3e9d4e[_0x1064('0x40')]&&!_0x55ee7a;_0x1a0ff1+=0x1){_0x1b41d4=_0x3e9d4e[_0x1a0ff1][_0x1064('0x3c')]();if(manager[_0x1064('0x41')](_0x1b41d4)){if(_0x10e13c[_0x1b41d4][_0x1064('0x49')]&&_0x10e13c[_0x1b41d4][_0x1064('0x4e')]&&moment()[_0x1064('0x4f')](_0x10e13c[_0x1b41d4]['startAt'],_0x10e13c[_0x1b41d4]['endAt'])){manager[_0x1064('0x50')](_0x1b41d4,_0x10e13c[_0x1b41d4][_0x1064('0x49')],handleJob(_0x10e13c[_0x1b41d4]));logger[_0x1064('0xa')](_0x1064('0x51'),_0x10e13c[_0x1b41d4][_0x1064('0xf')],_0x10e13c[_0x1b41d4][_0x1064('0x49')]);}else{manager[_0x1064('0x42')](_0x1b41d4);manager[_0x1064('0x43')](_0x1b41d4);logger[_0x1064('0xa')](_0x1064('0x52'),_0x10e13c[_0x1b41d4][_0x1064('0xf')],_0x10e13c[_0x1b41d4][_0x1064('0x49')]);}}}})['catch'](function(_0x57dd3b){logger[_0x1064('0x26')](JSON[_0x1064('0x20')](_0x57dd3b));});}exports[_0x1064('0x53')]=function(_0xec28){return getJobs(_0xec28);};exports[_0x1064('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
index f54659e..63e5966 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x19c3=['Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','resolve','Cloud\x20Provider\x20not\x20configured','Neutral','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','SequelizeValidationError','start','lodash','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket'];(function(_0x5bab8e,_0x5a9ed6){var _0x3e14ea=function(_0x3d5948){while(--_0x3d5948){_0x5bab8e['push'](_0x5bab8e['shift']());}};_0x3e14ea(++_0x5a9ed6);}(_0x19c3,0xf9));var _0x319c=function(_0x295a86,_0x4f350a){_0x295a86=_0x295a86-0x0;var _0x49b3aa=_0x19c3[_0x295a86];return _0x49b3aa;};var _=require(_0x319c('0x0'));var AWS=require('aws-sdk');var rp=require(_0x319c('0x1'));var util=require(_0x319c('0x2'));var BPromise=require('bluebird');var db=require(_0x319c('0x3'))['db'];var logger=require(_0x319c('0x4'))(_0x319c('0x5'));function getTranscriptionJob(_0x350517,_0x3a96b1,_0x290261,_0x4c35fe){return new Promise(function(_0x20f77e,_0x53a1de){var _0x2e38c4=new AWS[(_0x319c('0x6'))]({'accessKeyId':_0x3a96b1,'secretAccessKey':_0x350517,'region':_0x290261});_0x2e38c4[_0x319c('0x7')]({'TranscriptionJobName':_0x4c35fe},function(_0x306a4b,_0x3662ed){if(_0x306a4b){return _0x53a1de(_0x306a4b);}else{return _0x20f77e(_0x3662ed);}});});}function sentiment(_0x57e6c8,_0x160d2a,_0x1b7ffd,_0x3491c3,_0x462c4c){return new Promise(function(_0x475438,_0x3cb3ff){var _0x4911e3=new AWS[(_0x319c('0x8'))]({'accessKeyId':_0x160d2a,'secretAccessKey':_0x57e6c8,'region':_0x1b7ffd});_0x4911e3['detectSentiment']({'Text':_0x3491c3,'LanguageCode':_0x462c4c[_0x319c('0x9')](0x0,0x2)},function(_0x151ab5,_0x3adb44){if(_0x151ab5){return _0x3cb3ff(_0x151ab5);}else{return _0x475438(_0x3adb44);}});});}function checkTranscribeJob(_0x3c995c,_0x362f44,_0x3be537){var _0x401fdb;return new BPromise(function(_0x4b67ba,_0x494ec0){logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3c995c['id'],_0x3c995c[_0x319c('0xc')]));return getTranscriptionJob(_0x3be537[_0x319c('0xd')],_0x3be537[_0x319c('0xe')],_0x362f44[_0x319c('0xf')],_0x3c995c[_0x319c('0xc')])[_0x319c('0x10')](function(_0x29b26c){logger['info'](util['format'](_0x319c('0x11'),_0x3c995c['id'],_0x3c995c[_0x319c('0xc')],_0x29b26c['TranscriptionJob'][_0x319c('0x12')]));if(!_0x3c995c['fileText']){switch(_0x29b26c[_0x319c('0x13')][_0x319c('0x12')]){case _0x319c('0x14'):var _0x347081={'transcribeStatus':_0x29b26c[_0x319c('0x13')][_0x319c('0x12')],'fileUri':_0x29b26c[_0x319c('0x13')]['Transcript'][_0x319c('0x15')]};logger[_0x319c('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x3c995c['id']));return rp({'uri':_0x29b26c[_0x319c('0x13')][_0x319c('0x16')][_0x319c('0x15')],'json':!![]})['then'](function(_0x3bc070){logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x17'),_0x3c995c['id']));if(_0x3bc070&&_0x3bc070[_0x319c('0x18')]&&_0x3bc070['results'][_0x319c('0x19')]&&_0x3bc070[_0x319c('0x18')][_0x319c('0x19')][_0x319c('0x1a')]){_0x347081[_0x319c('0x1b')]='';for(var _0x4a8ee8=0x0;_0x4a8ee8<_0x3bc070[_0x319c('0x18')]['transcripts'][_0x319c('0x1a')];_0x4a8ee8++){_0x347081[_0x319c('0x1b')]+=_0x3bc070['results'][_0x319c('0x19')][_0x4a8ee8]['transcript']+'';}}return _0x3c995c[_0x319c('0x1c')](_0x347081);})[_0x319c('0x10')](function(){logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x1d'),_0x3c995c['id']));if(!_0x3c995c[_0x319c('0x1e')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x21'));}if(!_0x362f44[_0x319c('0x22')]||!_0x362f44[_0x319c('0x23')]||!_0x362f44[_0x319c('0x24')]||!_0x362f44[_0x319c('0x25')]||!_0x362f44[_0x319c('0x26')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x27'));}if(!_0x347081[_0x319c('0x1b')]){throw new Error(_0x319c('0x28'));}if(_0x362f44['sentimentAccountId']===_0x3be537['id']){return _0x3be537;}else{return db[_0x319c('0x29')][_0x319c('0x2a')]({'where':{'id':_settings[_0x319c('0x23')]}});}})[_0x319c('0x10')](function(_0x570940){if(!_0x570940){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x2b'));}if(!_0x570940['data1']||!_0x570940[_0x319c('0xe')]){throw new db['Sequelize'][(_0x319c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x401fdb=_0x570940;logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x2c'),_0x3c995c['id']));return sentiment(_0x401fdb['data1'],_0x401fdb[_0x319c('0xe')],_0x362f44[_0x319c('0x24')],_0x347081['fileText'],_0x362f44[_0x319c('0x25')]);})[_0x319c('0x10')](function(_0x2ed8c1){logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3c995c['id']));return _0x3c995c[_0x319c('0x1c')]({'sentiment':_0x2ed8c1[_0x319c('0x2d')],'sPositive':_0x2ed8c1[_0x319c('0x2e')][_0x319c('0x2f')],'sNegative':_0x2ed8c1[_0x319c('0x2e')][_0x319c('0x30')],'sMixed':_0x2ed8c1[_0x319c('0x2e')][_0x319c('0x31')],'sNeutral':_0x2ed8c1[_0x319c('0x2e')]['Neutral']});})[_0x319c('0x10')](function(){logger[_0x319c('0xa')](util[_0x319c('0xb')](_0x319c('0x1d'),_0x3c995c['id']));_0x4b67ba();});case'FAILED':return _0x3c995c[_0x319c('0x1c')]({'transcribeStatus':_0x319c('0x32'),'failureReason':_0x29b26c[_0x319c('0x13')][_0x319c('0x33')]})[_0x319c('0x10')](function(){logger[_0x319c('0xa')](util['format'](_0x319c('0x1d'),_0x3c995c['id']));_0x4b67ba();});default:logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3c995c['id']));break;}}else{return BPromise[_0x319c('0x34')]()[_0x319c('0x10')](function(){if(!_0x3c995c[_0x319c('0x1e')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x21'));}if(!_0x362f44[_0x319c('0x22')]||!_0x362f44[_0x319c('0x23')]||!_0x362f44[_0x319c('0x24')]||!_0x362f44[_0x319c('0x25')]||!_0x362f44['bucket']){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x27'));}if(!_0x3c995c[_0x319c('0x1b')]){throw new Error(_0x319c('0x28'));}if(_0x362f44['sentimentAccountId']===_0x3be537['id']){return _0x3be537;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x319c('0x23')]}});}})[_0x319c('0x10')](function(_0x43c527){if(!_0x43c527){throw new db['Sequelize'][(_0x319c('0x20'))](_0x319c('0x2b'));}if(!_0x43c527[_0x319c('0xd')]||!_0x43c527[_0x319c('0xe')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x35'));}_0x401fdb=_0x43c527;logger[_0x319c('0xa')](util['format'](_0x319c('0x2c'),_0x3c995c['id']));return sentiment(_0x401fdb[_0x319c('0xd')],_0x401fdb['data2'],_0x362f44[_0x319c('0x24')],_0x3c995c[_0x319c('0x1b')],_0x362f44[_0x319c('0x25')]);})[_0x319c('0x10')](function(_0x2ae778){logger[_0x319c('0xa')](util[_0x319c('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3c995c['id']));return _0x3c995c[_0x319c('0x1c')]({'sentiment':_0x2ae778[_0x319c('0x2d')],'sPositive':_0x2ae778[_0x319c('0x2e')][_0x319c('0x2f')],'sNegative':_0x2ae778['SentimentScore'][_0x319c('0x30')],'sMixed':_0x2ae778[_0x319c('0x2e')][_0x319c('0x31')],'sNeutral':_0x2ae778['SentimentScore'][_0x319c('0x36')],'transcribeStatus':'COMPLETED'});})[_0x319c('0x10')](function(){logger['info'](util[_0x319c('0xb')](_0x319c('0x1d'),_0x3c995c['id']));_0x4b67ba();});}})[_0x319c('0x37')](function(_0x39a10){if(_0x39a10){if(!_0x39a10[_0x319c('0x38')]||_0x39a10[_0x319c('0x38')]!=='SequelizeValidationError'){logger[_0x319c('0x39')](util[_0x319c('0xb')](_0x319c('0x3a'),_0x3c995c['id']),util[_0x319c('0x3b')](_0x39a10,{'showHidden':![],'depth':null}));}}_0x4b67ba();});});}function checkTranscribe(){var _0x201906;var _0x1a3491;var _0x57308b;return db[_0x319c('0x3c')][_0x319c('0x3d')]({'where':{'transcribeStatus':_0x319c('0x3e')}})['then'](function(_0x3502e6){if(!_0x3502e6||!_0x3502e6[_0x319c('0x1a')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x3f'));}_0x201906=_0x3502e6;return db[_0x319c('0x40')][_0x319c('0x2a')]({'where':{'id':0x1}});})[_0x319c('0x10')](function(_0x14cbdc){if(!_0x14cbdc){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))](_0x319c('0x41'));}_0x1a3491=_0x14cbdc;if(!_0x1a3491[_0x319c('0x5')]||!_0x1a3491['transcribeAccountId']||!_0x1a3491[_0x319c('0xf')]||!_0x1a3491[_0x319c('0x25')]||!_0x1a3491[_0x319c('0x26')]){throw new db['Sequelize'][(_0x319c('0x20'))](_0x319c('0x42'));}return db[_0x319c('0x29')][_0x319c('0x2a')]({'where':{'id':_0x1a3491[_0x319c('0x43')]}});})['then'](function(_0x112b2f){if(!_0x112b2f){throw new db['Sequelize'][(_0x319c('0x20'))](_0x319c('0x2b'));}if(!_0x112b2f[_0x319c('0xd')]||!_0x112b2f[_0x319c('0xe')]){throw new db[(_0x319c('0x1f'))][(_0x319c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x57308b=_0x112b2f;var _0x1b1a78=[];_0x201906[_0x319c('0x44')](function(_0x46fce7){_0x1b1a78[_0x319c('0x45')](checkTranscribeJob(_0x46fce7,_0x1a3491,_0x57308b));});return BPromise['all'](_0x1b1a78);})[_0x319c('0x37')](function(_0xe063f9){if(_0xe063f9){if(!_0xe063f9[_0x319c('0x38')]||_0xe063f9[_0x319c('0x38')]!==_0x319c('0x46')){logger[_0x319c('0x39')](util['inspect'](_0xe063f9,{'showHidden':![],'depth':null}));}}});}exports[_0x319c('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x4f9b=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','Positive','SentimentScore','Mixed','Neutral','resolve','sentiment','Negative','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','push','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x37df67,_0x2522c1){_0x37df67=_0x37df67-0x0;var _0xde3ce6=_0x4f9b[_0x37df67];return _0xde3ce6;};var _=require(_0xb4f9('0x0'));var AWS=require(_0xb4f9('0x1'));var rp=require(_0xb4f9('0x2'));var util=require(_0xb4f9('0x3'));var BPromise=require(_0xb4f9('0x4'));var db=require(_0xb4f9('0x5'))['db'];var logger=require(_0xb4f9('0x6'))(_0xb4f9('0x7'));function getTranscriptionJob(_0x5276a3,_0x59803f,_0x572714,_0x25947a){return new Promise(function(_0x38c813,_0x2fa71b){var _0x4e8f3c=new AWS[(_0xb4f9('0x8'))]({'accessKeyId':_0x59803f,'secretAccessKey':_0x5276a3,'region':_0x572714});_0x4e8f3c[_0xb4f9('0x9')]({'TranscriptionJobName':_0x25947a},function(_0x5f21cf,_0x5ecbc5){if(_0x5f21cf){return _0x2fa71b(_0x5f21cf);}else{return _0x38c813(_0x5ecbc5);}});});}function sentiment(_0x439f66,_0x3240ea,_0x4a9df3,_0x146ecf,_0x544209){return new Promise(function(_0x2ee1b5,_0x398e64){var _0xa19014=new AWS[(_0xb4f9('0xa'))]({'accessKeyId':_0x3240ea,'secretAccessKey':_0x439f66,'region':_0x4a9df3});_0xa19014[_0xb4f9('0xb')]({'Text':_0x146ecf,'LanguageCode':_0x544209[_0xb4f9('0xc')](0x0,0x2)},function(_0x191882,_0x4a056c){if(_0x191882){return _0x398e64(_0x191882);}else{return _0x2ee1b5(_0x4a056c);}});});}function checkTranscribeJob(_0x1bb8b0,_0x4475e4,_0x239d84){var _0x4927d9;return new BPromise(function(_0x5819d5,_0x1aaff5){logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0xf'),_0x1bb8b0['id'],_0x1bb8b0[_0xb4f9('0x10')]));return getTranscriptionJob(_0x239d84[_0xb4f9('0x11')],_0x239d84[_0xb4f9('0x12')],_0x4475e4[_0xb4f9('0x13')],_0x1bb8b0[_0xb4f9('0x10')])[_0xb4f9('0x14')](function(_0xc6e4da){logger[_0xb4f9('0xd')](util['format'](_0xb4f9('0x15'),_0x1bb8b0['id'],_0x1bb8b0[_0xb4f9('0x10')],_0xc6e4da[_0xb4f9('0x16')][_0xb4f9('0x17')]));if(!_0x1bb8b0['fileText']){switch(_0xc6e4da['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x468203={'transcribeStatus':_0xc6e4da['TranscriptionJob'][_0xb4f9('0x17')],'fileUri':_0xc6e4da[_0xb4f9('0x16')]['Transcript'][_0xb4f9('0x18')]};logger['info'](util[_0xb4f9('0xe')](_0xb4f9('0x19'),_0x1bb8b0['id']));return rp({'uri':_0xc6e4da[_0xb4f9('0x16')][_0xb4f9('0x1a')][_0xb4f9('0x18')],'json':!![]})[_0xb4f9('0x14')](function(_0x4a0a9b){logger['info'](util['format'](_0xb4f9('0x1b'),_0x1bb8b0['id']));if(_0x4a0a9b&&_0x4a0a9b['results']&&_0x4a0a9b[_0xb4f9('0x1c')][_0xb4f9('0x1d')]&&_0x4a0a9b[_0xb4f9('0x1c')][_0xb4f9('0x1d')][_0xb4f9('0x1e')]){_0x468203[_0xb4f9('0x1f')]='';for(var _0x4d3b93=0x0;_0x4d3b93<_0x4a0a9b[_0xb4f9('0x1c')]['transcripts'][_0xb4f9('0x1e')];_0x4d3b93++){_0x468203[_0xb4f9('0x1f')]+=_0x4a0a9b['results']['transcripts'][_0x4d3b93][_0xb4f9('0x20')]+'';}}return _0x1bb8b0['update'](_0x468203);})[_0xb4f9('0x14')](function(){logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0x21'),_0x1bb8b0['id']));if(!_0x1bb8b0[_0xb4f9('0x22')]){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x25'));}if(!_0x4475e4['sentiment']||!_0x4475e4['sentimentAccountId']||!_0x4475e4['sentimentRegion']||!_0x4475e4[_0xb4f9('0x26')]||!_0x4475e4[_0xb4f9('0x27')]){throw new db[(_0xb4f9('0x23'))]['ValidationError'](_0xb4f9('0x28'));}if(!_0x468203[_0xb4f9('0x1f')]){throw new Error(_0xb4f9('0x29'));}if(_0x4475e4[_0xb4f9('0x2a')]===_0x239d84['id']){return _0x239d84;}else{return db[_0xb4f9('0x2b')][_0xb4f9('0x2c')]({'where':{'id':_settings[_0xb4f9('0x2a')]}});}})[_0xb4f9('0x14')](function(_0x4b2a58){if(!_0x4b2a58){throw new db[(_0xb4f9('0x23'))]['ValidationError'](_0xb4f9('0x2d'));}if(!_0x4b2a58['data1']||!_0x4b2a58['data2']){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x2e'));}_0x4927d9=_0x4b2a58;logger[_0xb4f9('0xd')](util['format'](_0xb4f9('0x2f'),_0x1bb8b0['id']));return sentiment(_0x4927d9[_0xb4f9('0x11')],_0x4927d9[_0xb4f9('0x12')],_0x4475e4[_0xb4f9('0x30')],_0x468203[_0xb4f9('0x1f')],_0x4475e4[_0xb4f9('0x26')]);})[_0xb4f9('0x14')](function(_0x453a7e){logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0x31'),_0x1bb8b0['id']));return _0x1bb8b0[_0xb4f9('0x32')]({'sentiment':_0x453a7e[_0xb4f9('0x33')],'sPositive':_0x453a7e['SentimentScore'][_0xb4f9('0x34')],'sNegative':_0x453a7e[_0xb4f9('0x35')]['Negative'],'sMixed':_0x453a7e[_0xb4f9('0x35')][_0xb4f9('0x36')],'sNeutral':_0x453a7e[_0xb4f9('0x35')][_0xb4f9('0x37')]});})['then'](function(){logger[_0xb4f9('0xd')](util['format'](_0xb4f9('0x21'),_0x1bb8b0['id']));_0x5819d5();});case'FAILED':return _0x1bb8b0[_0xb4f9('0x32')]({'transcribeStatus':'FAILED','failureReason':_0xc6e4da[_0xb4f9('0x16')]['FailureReason']})[_0xb4f9('0x14')](function(){logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0x21'),_0x1bb8b0['id']));_0x5819d5();});default:logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1bb8b0['id']));break;}}else{return BPromise[_0xb4f9('0x38')]()[_0xb4f9('0x14')](function(){if(!_0x1bb8b0['tempSentiment']){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x25'));}if(!_0x4475e4[_0xb4f9('0x39')]||!_0x4475e4[_0xb4f9('0x2a')]||!_0x4475e4[_0xb4f9('0x30')]||!_0x4475e4[_0xb4f9('0x26')]||!_0x4475e4[_0xb4f9('0x27')]){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x28'));}if(!_0x1bb8b0[_0xb4f9('0x1f')]){throw new Error(_0xb4f9('0x29'));}if(_0x4475e4[_0xb4f9('0x2a')]===_0x239d84['id']){return _0x239d84;}else{return db[_0xb4f9('0x2b')][_0xb4f9('0x2c')]({'where':{'id':_settings[_0xb4f9('0x2a')]}});}})[_0xb4f9('0x14')](function(_0x21b733){if(!_0x21b733){throw new db['Sequelize'][(_0xb4f9('0x24'))](_0xb4f9('0x2d'));}if(!_0x21b733[_0xb4f9('0x11')]||!_0x21b733['data2']){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x2e'));}_0x4927d9=_0x21b733;logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0x2f'),_0x1bb8b0['id']));return sentiment(_0x4927d9['data1'],_0x4927d9[_0xb4f9('0x12')],_0x4475e4['sentimentRegion'],_0x1bb8b0['fileText'],_0x4475e4[_0xb4f9('0x26')]);})[_0xb4f9('0x14')](function(_0x28cba4){logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0x31'),_0x1bb8b0['id']));return _0x1bb8b0[_0xb4f9('0x32')]({'sentiment':_0x28cba4['Sentiment'],'sPositive':_0x28cba4[_0xb4f9('0x35')][_0xb4f9('0x34')],'sNegative':_0x28cba4['SentimentScore'][_0xb4f9('0x3a')],'sMixed':_0x28cba4[_0xb4f9('0x35')][_0xb4f9('0x36')],'sNeutral':_0x28cba4[_0xb4f9('0x35')][_0xb4f9('0x37')],'transcribeStatus':_0xb4f9('0x3b')});})['then'](function(){logger[_0xb4f9('0xd')](util[_0xb4f9('0xe')](_0xb4f9('0x21'),_0x1bb8b0['id']));_0x5819d5();});}})['catch'](function(_0x42e65f){if(_0x42e65f){if(!_0x42e65f[_0xb4f9('0x3c')]||_0x42e65f['name']!==_0xb4f9('0x3d')){logger[_0xb4f9('0x3e')](util[_0xb4f9('0xe')](_0xb4f9('0x3f'),_0x1bb8b0['id']),util[_0xb4f9('0x40')](_0x42e65f,{'showHidden':![],'depth':null}));}}_0x5819d5();});});}function checkTranscribe(){var _0x526d4f;var _0x70b72f;var _0x3612b6;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0xb4f9('0x41')}})[_0xb4f9('0x14')](function(_0x3c7811){if(!_0x3c7811||!_0x3c7811['length']){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x42'));}_0x526d4f=_0x3c7811;return db['Setting'][_0xb4f9('0x2c')]({'where':{'id':0x1}});})[_0xb4f9('0x14')](function(_0x13054d){if(!_0x13054d){throw new db[(_0xb4f9('0x23'))]['ValidationError'](_0xb4f9('0x43'));}_0x70b72f=_0x13054d;if(!_0x70b72f[_0xb4f9('0x7')]||!_0x70b72f[_0xb4f9('0x44')]||!_0x70b72f['transcribeRegion']||!_0x70b72f[_0xb4f9('0x26')]||!_0x70b72f[_0xb4f9('0x27')]){throw new db['Sequelize'][(_0xb4f9('0x24'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xb4f9('0x2c')]({'where':{'id':_0x70b72f['transcribeAccountId']}});})[_0xb4f9('0x14')](function(_0x5bbbe7){if(!_0x5bbbe7){throw new db[(_0xb4f9('0x23'))][(_0xb4f9('0x24'))](_0xb4f9('0x2d'));}if(!_0x5bbbe7['data1']||!_0x5bbbe7[_0xb4f9('0x12')]){throw new db['Sequelize'][(_0xb4f9('0x24'))](_0xb4f9('0x2e'));}_0x3612b6=_0x5bbbe7;var _0x9a402f=[];_0x526d4f['forEach'](function(_0x3bfcc8){_0x9a402f[_0xb4f9('0x45')](checkTranscribeJob(_0x3bfcc8,_0x70b72f,_0x3612b6));});return BPromise['all'](_0x9a402f);})['catch'](function(_0x4b0f68){if(_0x4b0f68){if(!_0x4b0f68['name']||_0x4b0f68[_0xb4f9('0x3c')]!=='SequelizeValidationError'){logger[_0xb4f9('0x3e')](util[_0xb4f9('0x40')](_0x4b0f68,{'showHidden':![],'depth':null}));}}});}exports[_0xb4f9('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
index a05c653..7439159 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3584=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','../../config/environment','../logger','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x3584,0x79));var _0x4358=function(_0x3354c6,_0x1a237a){_0x3354c6=_0x3354c6-0x0;var _0x53d942=_0x3584[_0x3354c6];return _0x53d942;};'use strict';var _=require(_0x4358('0x0'));var moment=require(_0x4358('0x1'));var Redis=require(_0x4358('0x2'));var util=require('util');var config=require(_0x4358('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x4358('0x4'))(_0x4358('0x5'));config['redis']=_['defaults'](config[_0x4358('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4358('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x346b8e=[];return db[_0x4358('0x8')][_0x4358('0x9')]({'raw':!![],'attributes':['id',_0x4358('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4358('0xb')](0x18,_0x4358('0xc'))}}})[_0x4358('0xd')](function(_0xa5c45e){if(_0xa5c45e&&_0xa5c45e[_0x4358('0xe')]){_0x346b8e=_[_0x4358('0xf')](_0xa5c45e||[],'id');logger[_0x4358('0x10')](_0x4358('0x11'),_0x346b8e['join']());return db[_0x4358('0x8')][_0x4358('0x12')]({'closeReason':_0x4358('0x13'),'disposition':_0x4358('0x14'),'closed':!![],'closedAt':moment()['format'](_0x4358('0x15'))},{'where':{'id':_0x346b8e}});}})[_0x4358('0xd')](function(){if(_0x346b8e&&_0x346b8e[_0x4358('0xe')]){logger['info'](_0x4358('0x16'),_0x346b8e[_0x4358('0x17')]());for(var _0x389d7a=0x0;_0x389d7a<_0x346b8e[_0x4358('0xe')];_0x389d7a++){io['emit'](_0x4358('0x18'),{'id':_0x346b8e[_0x389d7a],'closed':!![]});}}})[_0x4358('0x19')](function(_0x1fb256){logger['error'](_0x4358('0x1a'),_0x1fb256?util['inspect'](_0x1fb256,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x5790=['whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5790,0xa1));var _0x0579=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5790[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0579('0x0'));var moment=require('moment');var Redis=require(_0x0579('0x1'));var util=require(_0x0579('0x2'));var config=require(_0x0579('0x3'));var db=require(_0x0579('0x4'))['db'];var logger=require(_0x0579('0x5'))(_0x0579('0x6'));config[_0x0579('0x7')]=_[_0x0579('0x8')](config[_0x0579('0x7')],{'host':_0x0579('0x9'),'port':0x18eb});var io=require(_0x0579('0xa'))(new Redis(config[_0x0579('0x7')]));function closeInteractions(){var _0x21f27f=[];return db[_0x0579('0xb')][_0x0579('0xc')]({'raw':!![],'attributes':['id',_0x0579('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0579('0xe')](0x18,_0x0579('0xf'))}}})[_0x0579('0x10')](function(_0x57a273){if(_0x57a273&&_0x57a273['length']){_0x21f27f=_[_0x0579('0x11')](_0x57a273||[],'id');logger[_0x0579('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x21f27f[_0x0579('0x13')]());return db[_0x0579('0xb')]['update']({'closeReason':'system','disposition':_0x0579('0x14'),'closed':!![],'closedAt':moment()[_0x0579('0x15')](_0x0579('0x16'))},{'where':{'id':_0x21f27f}});}})[_0x0579('0x10')](function(){if(_0x21f27f&&_0x21f27f[_0x0579('0x17')]){logger[_0x0579('0x12')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x21f27f[_0x0579('0x13')]());for(var _0xf3cdd9=0x0;_0xf3cdd9<_0x21f27f[_0x0579('0x17')];_0xf3cdd9++){io[_0x0579('0x18')](_0x0579('0x19'),{'id':_0x21f27f[_0xf3cdd9],'closed':!![]});}}})[_0x0579('0x1a')](function(_0x3f41ee){logger[_0x0579('0x1b')](_0x0579('0x1c'),_0x3f41ee?util[_0x0579('0x1d')](_0x3f41ee,{'showHidden':![],'depth':null}):'');});}exports[_0x0579('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index 6c7ee11..776b1bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x399a=['hopper1','log','contacts2','hopper2','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','finished\x20populating','CmHopper'];(function(_0x1d3ece,_0x3fb359){var _0x1ba5d2=function(_0xaa2729){while(--_0xaa2729){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x1ba5d2(++_0x3fb359);}(_0x399a,0xee));var _0xa399=function(_0x32b8a9,_0x59d62b){_0x32b8a9=_0x32b8a9-0x0;var _0x40105c=_0x399a[_0x32b8a9];return _0x40105c;};'use strict';var util=require(_0xa399('0x0'));var db=require(_0xa399('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xa399('0x2')+i,'lastName':_0xa399('0x3')+i,'phone':0xf879fb460+i,'email':_0xa399('0x4')+i+_0xa399('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa399('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xa399('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa399('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa399('0x6')]({'id':i,'firstName':_0xa399('0x2')+i,'lastName':_0xa399('0x3')+i,'phone':0xf879fb460+i,'email':_0xa399('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa399('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xa399('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa399('0x7')](),'updatedAt':Date[_0xa399('0x7')]()});}db[_0xa399('0x8')][_0xa399('0x9')]({'where':{}})[_0xa399('0xa')](function(){return db[_0xa399('0x8')][_0xa399('0xb')](contacts);})[_0xa399('0xa')](function(){console['log'](_0xa399('0xc'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})[_0xa399('0xa')](function(){return db[_0xa399('0xd')]['bulkCreate'](hopper);})[_0xa399('0xa')](function(){console['log'](_0xa399('0xc'),_0xa399('0xe'));return db[_0xa399('0x8')][_0xa399('0xb')](contacts2);})[_0xa399('0xa')](function(){console[_0xa399('0xf')]('finished\x20populating',_0xa399('0x10'));return db[_0xa399('0xd')][_0xa399('0xb')](hopper2);})[_0xa399('0xa')](function(){console[_0xa399('0xf')](_0xa399('0xc'),_0xa399('0x11'));})['catch'](function(_0x4aaa3c){console['log'](_0x4aaa3c);});
\ No newline at end of file
+var _0x5657=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','CmHopper','bulkCreate','hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','Biondo'];(function(_0x139ac2,_0x56cd0b){var _0x5d6871=function(_0x331f8c){while(--_0x331f8c){_0x139ac2['push'](_0x139ac2['shift']());}};_0x5d6871(++_0x56cd0b);}(_0x5657,0xc1));var _0x7565=function(_0x8edcdc,_0x4f9b5d){_0x8edcdc=_0x8edcdc-0x0;var _0x1c9dd7=_0x5657[_0x8edcdc];return _0x1c9dd7;};'use strict';var util=require(_0x7565('0x0'));var db=require(_0x7565('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7565('0x2')]({'id':i,'firstName':_0x7565('0x3')+i,'lastName':_0x7565('0x4')+i,'phone':0xf879fb460+i,'email':_0x7565('0x5')+i+_0x7565('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7565('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7565('0x7')](),'updatedAt':Date[_0x7565('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7565('0x2')]({'id':i,'firstName':_0x7565('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7565('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7565('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7565('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7565('0x7')](),'updatedAt':Date['now']()});}db[_0x7565('0x8')][_0x7565('0x9')]({'where':{}})[_0x7565('0xa')](function(){return db[_0x7565('0x8')]['bulkCreate'](contacts);})[_0x7565('0xa')](function(){console[_0x7565('0xb')](_0x7565('0xc'),'contacts1');return db['CmHopper'][_0x7565('0x9')]({'where':{}});})['then'](function(){return db[_0x7565('0xd')][_0x7565('0xe')](hopper);})['then'](function(){console['log'](_0x7565('0xc'),_0x7565('0xf'));return db[_0x7565('0x8')][_0x7565('0xe')](contacts2);})[_0x7565('0xa')](function(){console[_0x7565('0xb')]('finished\x20populating',_0x7565('0x10'));return db[_0x7565('0xd')][_0x7565('0xe')](hopper2);})[_0x7565('0xa')](function(){console['log'](_0x7565('0xc'),'hopper2');})[_0x7565('0x11')](function(_0xcf4ea1){console['log'](_0xcf4ea1);});
\ No newline at end of file
index 8ec65b8..c87ca76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x65ce=['add\x20user','catch','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','friend','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','log'];(function(_0xe5f72b,_0x4fa469){var _0x2e452a=function(_0x2c1169){while(--_0x2c1169){_0xe5f72b['push'](_0xe5f72b['shift']());}};_0x2e452a(++_0x4fa469);}(_0x65ce,0x145));var _0xe65c=function(_0x206023,_0x300c07){_0x206023=_0x206023-0x0;var _0x20f774=_0x65ce[_0x206023];return _0x20f774;};'use strict';var util=require('util');var db=require(_0xe65c('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe65c('0x1')]({'name':util[_0xe65c('0x2')]('%s%s',_0xe65c('0x3'),i),'fullname':util[_0xe65c('0x2')](_0xe65c('0x4'),'agent',i),'email':util[_0xe65c('0x2')](_0xe65c('0x5'),'agent',i),'role':_0xe65c('0x3'),'password':'password','internal':0xfa0+i,'type':_0xe65c('0x6'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0xe65c('0x7')],'defaultuser':util[_0xe65c('0x2')](_0xe65c('0x4'),_0xe65c('0x3'),i),'encryption':_0xe65c('0x8'),'avpf':'yes','force_avp':_0xe65c('0x8'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xe65c('0x9'),'dtlsprivatekey':_0xe65c('0xa'),'dtlssetup':'actpass','callerid':util['format'](_0xe65c('0xb'),util['format'](_0xe65c('0x4'),_0xe65c('0x3'),i),0xfa0+i)});}db[_0xe65c('0xc')][_0xe65c('0xd')](users)['then'](function(){console[_0xe65c('0xe')](_0xe65c('0xf'));})[_0xe65c('0x10')](function(_0x311179){console[_0xe65c('0xe')](_0x311179);});
\ No newline at end of file
+var _0xb98c=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','then','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss'];(function(_0x418e29,_0x33b574){var _0x291241=function(_0x11de0b){while(--_0x11de0b){_0x418e29['push'](_0x418e29['shift']());}};_0x291241(++_0x33b574);}(_0xb98c,0x100));var _0xcb98=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xb98c[_0x5ecadc];return _0x565037;};'use strict';var util=require(_0xcb98('0x0'));var db=require(_0xcb98('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcb98('0x2')]({'name':util[_0xcb98('0x3')](_0xcb98('0x4'),_0xcb98('0x5'),i),'fullname':util['format'](_0xcb98('0x4'),_0xcb98('0x5'),i),'email':util[_0xcb98('0x3')](_0xcb98('0x6'),_0xcb98('0x5'),i),'role':_0xcb98('0x5'),'password':'password','internal':0xfa0+i,'type':_0xcb98('0x7'),'transport':[_0xcb98('0x8'),'ws',_0xcb98('0x9')],'disallow':[_0xcb98('0xa')],'allow':[_0xcb98('0xb')],'defaultuser':util[_0xcb98('0x3')](_0xcb98('0x4'),'agent',i),'encryption':_0xcb98('0xc'),'avpf':_0xcb98('0xc'),'force_avp':_0xcb98('0xc'),'icesupport':_0xcb98('0xc'),'dtlsenable':_0xcb98('0xc'),'dtlsverify':'no','dtlscertfile':_0xcb98('0xd'),'dtlsprivatekey':_0xcb98('0xe'),'dtlssetup':_0xcb98('0xf'),'callerid':util[_0xcb98('0x3')]('\x22%s\x22\x20<%s>',util[_0xcb98('0x3')](_0xcb98('0x4'),_0xcb98('0x5'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xcb98('0x10')](function(){console[_0xcb98('0x11')]('add\x20user');})[_0xcb98('0x12')](function(_0x55fc38){console[_0xcb98('0x11')](_0x55fc38);});
\ No newline at end of file
index c54dc59..72ca842 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6a2=['setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','user','voice:inbound','voice:outbound','VoiceQueues','userProfileId','OpenchannelQueues','Trunks','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','all','length','chat','mail','whatsapp','telephone:%s','campaign:%s:%s','type','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log'];(function(_0x1d2c64,_0x3afab3){var _0x47edc8=function(_0x54fb40){while(--_0x54fb40){_0x1d2c64['push'](_0x1d2c64['shift']());}};_0x47edc8(++_0x3afab3);}(_0xc6a2,0x69));var _0x2c6a=function(_0x15a752,_0x5112d3){_0x15a752=_0x15a752-0x0;var _0x56c2eb=_0xc6a2[_0x15a752];return _0x56c2eb;};'use strict';var _=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var BPromise=require('bluebird');var db=require(_0x2c6a('0x2'))['db'];var config=require(_0x2c6a('0x3'));var queryQueues={'attributes':['id',_0x2c6a('0x4')],'include':[{'as':_0x2c6a('0x5'),'model':db[_0x2c6a('0x6')],'attributes':['id',_0x2c6a('0x4'),_0x2c6a('0x7')],'raw':!![],'where':{'role':_0x2c6a('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2c6a('0x4')],'where':{'role':_0x2c6a('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2c6a('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x2c6a('0x4')],'where':{'role':_0x2c6a('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2c6a('0x4'),'type'],'where':{'type':_0x2c6a('0xa')}};function getAssociatedResources(_0x3f4b72,_0x25ef48,_0x2290ed){return db[_0x2c6a('0xb')][_0x2c6a('0xc')]({'where':{'name':_0x3f4b72,'userProfileId':_0x25ef48},'raw':!![]})[_0x2c6a('0xd')](function(_0x2a7040){if(_0x2a7040){if(_0x2a7040['autoAssociation']){switch(_0x3f4b72){case'VoiceQueues':case _0x2c6a('0xe'):case _0x2c6a('0xf'):case _0x2c6a('0x10'):case _0x2c6a('0x11'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2290ed][_0x2c6a('0x12')](queryQueues);case _0x2c6a('0x13'):return db[_0x2290ed][_0x2c6a('0x12')](queryTelephones);case'Trunks':return db[_0x2290ed]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x2290ed][_0x2c6a('0x12')](queryCampaigns);}}else{return db[_0x2c6a('0x14')][_0x2c6a('0x12')]({'attributes':[_0x2c6a('0x15')],'where':{'sectionId':_0x2a7040['id']},'raw':!![]})[_0x2c6a('0xd')](function(_0x3bf95b){if(_0x3bf95b){var _0x2e684e={'where':{'id':_[_0x2c6a('0x16')](_0x3bf95b,_0x2c6a('0x15'))},'raw':!![]};switch(_0x2290ed){case'User':_0x2e684e[_0x2c6a('0x17')][_0x2c6a('0x7')]='telephone';break;case _0x2c6a('0x18'):_0x2e684e['where']['type']=_0x2c6a('0xa');break;}return db[_0x2290ed][_0x2c6a('0x12')](_0x2e684e);}else{return[];}});}}else{return[];}})[_0x2c6a('0xd')](function(_0xae2e1b){return _0xae2e1b;});}function joinOrLeaveQueues(_0x1b49d8,_0x40fc4e,_0x2f9dda,_0x54bc5d){_0x1b49d8[_0x40fc4e](util[_0x2c6a('0x19')](_0x2c6a('0x1a'),_0x2f9dda,_0x54bc5d[_0x2c6a('0x4')]));if(_0x54bc5d[_0x2c6a('0x5')]){for(var _0x10edaa=0x0;_0x10edaa<_0x54bc5d['Agents']['length'];_0x10edaa+=0x1){_0x1b49d8[_0x40fc4e](util[_0x2c6a('0x19')](_0x2c6a('0x1b'),_0x54bc5d[_0x2c6a('0x5')][_0x10edaa][_0x2c6a('0x4')]));}}}function joinOrLeave(_0x4e5994,_0x4c6d13,_0x542d24){var _0x395558;if(_0x4e5994[_0x2c6a('0x1c')][_0x2c6a('0x1d')]['id']){db[_0x2c6a('0x6')][_0x2c6a('0x1e')]({'attributes':['id',_0x2c6a('0x4'),_0x2c6a('0x7'),'userProfileId'],'where':{'id':_0x4e5994[_0x2c6a('0x1c')]['query']['id']},'include':[{'model':db[_0x2c6a('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2c6a('0x20')],'as':_0x2c6a('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x2c6a('0x22')],'as':_0x2c6a('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2c6a('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2c6a('0x25')],'as':_0x2c6a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x2c6a('0x27')],'as':_0x2c6a('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1d77a3){if(_0x1d77a3){_0x395558=_0x1d77a3;_0x4e5994[_0x4c6d13](util[_0x2c6a('0x19')](_0x2c6a('0x1b'),_0x1d77a3[_0x2c6a('0x4')]));var _0x47abcf=[];switch(_0x1d77a3[_0x2c6a('0x7')]){case'admin':_0x4e5994[_0x4c6d13]('voice:inbound');_0x4e5994[_0x4c6d13]('voice:outbound');if(queryQueues[_0x2c6a('0x29')](_0x2c6a('0x2a'))){delete queryQueues[_0x2c6a('0x2a')];}_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x2c')][_0x2c6a('0x12')](queryQueues));_0x47abcf['push'](db[_0x2c6a('0x2d')][_0x2c6a('0x12')](queryQueues));_0x47abcf[_0x2c6a('0x2b')](db['FaxQueue'][_0x2c6a('0x12')](queryQueues));_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x2e')][_0x2c6a('0x12')](queryQueues));_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x2f')][_0x2c6a('0x12')](queryQueues));_0x47abcf[_0x2c6a('0x2b')](db['OpenchannelQueue'][_0x2c6a('0x12')](queryQueues));_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x30')]['findAll'](queryQueues));_0x47abcf['push'](db[_0x2c6a('0x6')]['findAll'](queryTelephones));_0x47abcf[_0x2c6a('0x2b')](db['Trunk'][_0x2c6a('0x12')](queryTrunks));_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x18')]['findAll'](queryCampaigns));_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x6')]['findAll'](queryAgents));break;case _0x2c6a('0x31'):_0x4e5994[_0x4c6d13](_0x2c6a('0x32'));_0x4e5994[_0x4c6d13](_0x2c6a('0x33'));_0x47abcf[_0x2c6a('0x2b')](getAssociatedResources(_0x2c6a('0x34'),_0x1d77a3['userProfileId'],'VoiceQueue'));_0x47abcf['push'](getAssociatedResources(_0x2c6a('0xe'),_0x1d77a3[_0x2c6a('0x35')],_0x2c6a('0x2d')));_0x47abcf['push'](getAssociatedResources('FaxQueues',_0x1d77a3[_0x2c6a('0x35')],'FaxQueue'));_0x47abcf[_0x2c6a('0x2b')](getAssociatedResources('SmsQueues',_0x1d77a3[_0x2c6a('0x35')],_0x2c6a('0x2e')));_0x47abcf[_0x2c6a('0x2b')](getAssociatedResources(_0x2c6a('0x11'),_0x1d77a3['userProfileId'],'MailQueue'));_0x47abcf[_0x2c6a('0x2b')](getAssociatedResources(_0x2c6a('0x36'),_0x1d77a3['userProfileId'],'OpenchannelQueue'));_0x47abcf[_0x2c6a('0x2b')](getAssociatedResources('WhatsappQueues',_0x1d77a3[_0x2c6a('0x35')],_0x2c6a('0x30')));_0x47abcf['push'](getAssociatedResources(_0x2c6a('0x13'),_0x1d77a3[_0x2c6a('0x35')],'User'));_0x47abcf['push'](getAssociatedResources(_0x2c6a('0x37'),_0x1d77a3[_0x2c6a('0x35')],_0x2c6a('0x38')));_0x47abcf[_0x2c6a('0x2b')](getAssociatedResources('IvrCampaigns',_0x1d77a3['userProfileId'],_0x2c6a('0x18')));_0x47abcf[_0x2c6a('0x2b')](db[_0x2c6a('0x6')][_0x2c6a('0x12')](queryAgents));break;case'agent':_0x4e5994[_0x4c6d13](_0x2c6a('0x32'));_0x4e5994[_0x4c6d13](_0x2c6a('0x33'));_0x47abcf[_0x2c6a('0x2b')](_0x1d77a3[_0x2c6a('0x39')]({'attributes':['id',_0x2c6a('0x4')]}));_0x47abcf['push'](_0x1d77a3[_0x2c6a('0x3a')]({'attributes':['id','name']}));_0x47abcf[_0x2c6a('0x2b')](_0x1d77a3[_0x2c6a('0x3b')]({'attributes':['id',_0x2c6a('0x4')]}));_0x47abcf[_0x2c6a('0x2b')](_0x1d77a3['getSmsQueues']({'attributes':['id',_0x2c6a('0x4')]}));_0x47abcf[_0x2c6a('0x2b')](_0x1d77a3[_0x2c6a('0x3c')]({'attributes':['id',_0x2c6a('0x4')]}));_0x47abcf['push'](_0x1d77a3['getOpenchannelQueues']({'attributes':['id','name']}));_0x47abcf['push'](_0x1d77a3['getWhatsappQueues']({'attributes':['id',_0x2c6a('0x4')]}));break;}return BPromise[_0x2c6a('0x3d')](_0x47abcf);}})[_0x2c6a('0xd')](function(_0x38ce05){if(_0x38ce05&&_0x38ce05[_0x2c6a('0x3e')]){for(var _0x2badae=0x0;_0x2badae<_0x38ce05[_0x2c6a('0x3e')];_0x2badae+=0x1){for(var _0x8c3864=0x0;_0x8c3864<_0x38ce05[_0x2badae][_0x2c6a('0x3e')];_0x8c3864+=0x1){switch(_0x2badae){case 0x0:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,'voice',_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x1:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,_0x2c6a('0x3f'),_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x2:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,'fax',_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x3:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,'sms',_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x4:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,_0x2c6a('0x40'),_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x5:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,'openchannel',_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x6:joinOrLeaveQueues(_0x4e5994,_0x4c6d13,_0x2c6a('0x41'),_0x38ce05[_0x2badae][_0x8c3864]);break;case 0x7:if(_0x395558[_0x2c6a('0x7')]!==_0x2c6a('0x8'))_0x4e5994[_0x4c6d13](util['format'](_0x2c6a('0x42'),_0x38ce05[_0x2badae][_0x8c3864][_0x2c6a('0x4')]));break;case 0x8:if(_0x395558['role']!==_0x2c6a('0x8'))_0x4e5994[_0x4c6d13](util['format']('trunk:%s',_0x38ce05[_0x2badae][_0x8c3864]['name']));break;case 0x9:if(_0x395558[_0x2c6a('0x7')]!==_0x2c6a('0x8'))_0x4e5994[_0x4c6d13](util[_0x2c6a('0x19')](_0x2c6a('0x43'),_0x38ce05[_0x2badae][_0x8c3864][_0x2c6a('0x44')],_0x38ce05[_0x2badae][_0x8c3864][_0x2c6a('0x4')]));break;case 0xa:_0x4e5994[_0x4c6d13](util[_0x2c6a('0x19')](_0x2c6a('0x1b'),_0x38ce05[_0x2badae][_0x8c3864]['name']));break;}}}}})[_0x2c6a('0xd')](function(){if(_0x4c6d13===_0x2c6a('0x45')){var _0x13f9bd=_[_0x2c6a('0x16')](_0x395558[_0x2c6a('0x46')],'id');return _0x395558[_0x2c6a('0x47')](_0x13f9bd)[_0x2c6a('0xd')](function(){for(var _0x216c4c=0x0;_0x216c4c<_0x13f9bd['length'];_0x216c4c+=0x1){_0x542d24[_0x2c6a('0x48')](_0x2c6a('0x49'),{'ChatInteractionId':Number(_0x13f9bd[_0x216c4c]),'UserId':Number(_0x395558['id'])});}});}})[_0x2c6a('0xd')](function(){if(_0x4c6d13==='leave'){var _0x3a83dc=_['map'](_0x395558[_0x2c6a('0x21')],'id');return _0x395558[_0x2c6a('0x4a')](_0x3a83dc)[_0x2c6a('0xd')](function(){for(var _0x35835c=0x0;_0x35835c<_0x3a83dc['length'];_0x35835c+=0x1){_0x542d24['emit'](_0x2c6a('0x4b'),{'MailInteractionId':Number(_0x3a83dc[_0x35835c]),'UserId':Number(_0x395558['id'])});}});}})['then'](function(){if(_0x4c6d13===_0x2c6a('0x45')){var _0x4be9b0=_[_0x2c6a('0x16')](_0x395558['FaxInteractions'],'id');return _0x395558[_0x2c6a('0x4c')](_0x4be9b0)[_0x2c6a('0xd')](function(){for(var _0x32d196=0x0;_0x32d196<_0x4be9b0[_0x2c6a('0x3e')];_0x32d196+=0x1){_0x542d24[_0x2c6a('0x48')](_0x2c6a('0x4d'),{'FaxInteractionId':Number(_0x4be9b0[_0x32d196]),'UserId':Number(_0x395558['id'])});}});}})[_0x2c6a('0xd')](function(){if(_0x4c6d13===_0x2c6a('0x45')){var _0xa360f5=_[_0x2c6a('0x16')](_0x395558['SmsInteractions'],'id');return _0x395558[_0x2c6a('0x4e')](_0xa360f5)[_0x2c6a('0xd')](function(){for(var _0x1fc963=0x0;_0x1fc963<_0xa360f5[_0x2c6a('0x3e')];_0x1fc963+=0x1){_0x542d24['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xa360f5[_0x1fc963]),'UserId':Number(_0x395558['id'])});}});}})[_0x2c6a('0xd')](function(){if(_0x4c6d13==='leave'){var _0x370353=_[_0x2c6a('0x16')](_0x395558[_0x2c6a('0x26')],'id');return _0x395558['removeOpenchannelInteractions'](_0x370353)['then'](function(){for(var _0x2b6a6e=0x0;_0x2b6a6e<_0x370353[_0x2c6a('0x3e')];_0x2b6a6e+=0x1){_0x542d24[_0x2c6a('0x48')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x370353[_0x2b6a6e]),'UserId':Number(_0x395558['id'])});}});}})[_0x2c6a('0xd')](function(){if(_0x4c6d13===_0x2c6a('0x45')){var _0x1b27d0=_['map'](_0x395558['WhatsappInteractions'],'id');return _0x395558[_0x2c6a('0x4f')](_0x1b27d0)['then'](function(){for(var _0x29b0d1=0x0;_0x29b0d1<_0x1b27d0[_0x2c6a('0x3e')];_0x29b0d1+=0x1){_0x542d24[_0x2c6a('0x48')](_0x2c6a('0x50'),{'WhatsappInteractionId':Number(_0x1b27d0[_0x29b0d1]),'UserId':Number(_0x395558['id'])});}});}})[_0x2c6a('0x51')](function(_0x4f10e0){_0x4e5994[_0x2c6a('0x52')](_0x4f10e0);});}}function onDisconnect(_0x5a6c65,_0x14be18){joinOrLeave(_0x5a6c65,_0x2c6a('0x45'),_0x14be18);}function onConnect(_0x2e099c){joinOrLeave(_0x2e099c,'join');}exports['default']=function(_0x2fe8c8){_0x2fe8c8['on']('connection',function(_0x413c0f){_0x413c0f[_0x2c6a('0x53')](0x0);_0x413c0f[_0x2c6a('0x54')]=_0x413c0f[_0x2c6a('0x55')][_0x2c6a('0x56')][_0x2c6a('0x57')]+':'+_0x413c0f[_0x2c6a('0x55')][_0x2c6a('0x56')][_0x2c6a('0x58')];_0x413c0f[_0x2c6a('0x59')]=new Date();_0x413c0f[_0x2c6a('0x52')]=function(_0x182876){console['log']('SocketIO\x20'+_0x413c0f[_0x2c6a('0x5a')]['name']+'['+_0x413c0f['address']+']',_0x182876);};_0x413c0f['on'](_0x2c6a('0x5b'),function(){onDisconnect(_0x413c0f,_0x2fe8c8);_0x413c0f[_0x2c6a('0x52')](_0x2c6a('0x5c'));});onConnect(_0x413c0f);_0x413c0f[_0x2c6a('0x52')](_0x2c6a('0x5d'));});};
\ No newline at end of file
+var _0x4b20=['map','where','type','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','SmsQueue','WhatsappQueue','user','OpenchannelQueues','Trunk','IvrCampaigns','Campaign','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b20,0x116));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x04b2('0x0'));var util=require(_0x04b2('0x1'));var BPromise=require(_0x04b2('0x2'));var db=require(_0x04b2('0x3'))['db'];var config=require(_0x04b2('0x4'));var queryQueues={'attributes':['id',_0x04b2('0x5')],'include':[{'as':_0x04b2('0x6'),'model':db[_0x04b2('0x7')],'attributes':['id',_0x04b2('0x5'),_0x04b2('0x8')],'raw':!![],'where':{'role':_0x04b2('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x04b2('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x04b2('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x04b2('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x04b2('0x5'),'type'],'where':{'type':_0x04b2('0xb')}};function getAssociatedResources(_0x53212e,_0x291e02,_0x48387f){return db[_0x04b2('0xc')]['findOne']({'where':{'name':_0x53212e,'userProfileId':_0x291e02},'raw':!![]})[_0x04b2('0xd')](function(_0x28a212){if(_0x28a212){if(_0x28a212[_0x04b2('0xe')]){switch(_0x53212e){case _0x04b2('0xf'):case _0x04b2('0x10'):case'FaxQueues':case _0x04b2('0x11'):case _0x04b2('0x12'):case'OpenchannelQueues':case _0x04b2('0x13'):return db[_0x48387f]['findAll'](queryQueues);case _0x04b2('0x14'):return db[_0x48387f][_0x04b2('0x15')](queryTelephones);case _0x04b2('0x16'):return db[_0x48387f][_0x04b2('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x48387f][_0x04b2('0x15')](queryCampaigns);}}else{return db[_0x04b2('0x17')]['findAll']({'attributes':[_0x04b2('0x18')],'where':{'sectionId':_0x28a212['id']},'raw':!![]})[_0x04b2('0xd')](function(_0x181c2d){if(_0x181c2d){var _0x49c773={'where':{'id':_[_0x04b2('0x19')](_0x181c2d,_0x04b2('0x18'))},'raw':!![]};switch(_0x48387f){case _0x04b2('0x7'):_0x49c773[_0x04b2('0x1a')][_0x04b2('0x8')]=_0x04b2('0xa');break;case'Campaign':_0x49c773['where'][_0x04b2('0x1b')]=_0x04b2('0xb');break;}return db[_0x48387f][_0x04b2('0x15')](_0x49c773);}else{return[];}});}}else{return[];}})[_0x04b2('0xd')](function(_0x24e5ff){return _0x24e5ff;});}function joinOrLeaveQueues(_0x6dc675,_0x1f6d1c,_0x11210c,_0x311b94){_0x6dc675[_0x1f6d1c](util[_0x04b2('0x1c')](_0x04b2('0x1d'),_0x11210c,_0x311b94[_0x04b2('0x5')]));if(_0x311b94['Agents']){for(var _0x3cbdd8=0x0;_0x3cbdd8<_0x311b94[_0x04b2('0x6')][_0x04b2('0x1e')];_0x3cbdd8+=0x1){_0x6dc675[_0x1f6d1c](util[_0x04b2('0x1c')](_0x04b2('0x1f'),_0x311b94[_0x04b2('0x6')][_0x3cbdd8][_0x04b2('0x5')]));}}}function joinOrLeave(_0x5599ec,_0x17a70a,_0x4eb4e3){var _0x1432b8;if(_0x5599ec[_0x04b2('0x20')][_0x04b2('0x21')]['id']){db['User'][_0x04b2('0x22')]({'attributes':['id',_0x04b2('0x5'),'role',_0x04b2('0x23')],'where':{'id':_0x5599ec[_0x04b2('0x20')][_0x04b2('0x21')]['id']},'include':[{'model':db[_0x04b2('0x24')],'as':_0x04b2('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x27')],'as':_0x04b2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x2a')],'as':_0x04b2('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x2c')],'as':_0x04b2('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x04b2('0xd')](function(_0x1f07c4){if(_0x1f07c4){_0x1432b8=_0x1f07c4;_0x5599ec[_0x17a70a](util['format']('user:%s',_0x1f07c4['name']));var _0x5228bf=[];switch(_0x1f07c4[_0x04b2('0x8')]){case _0x04b2('0x2e'):_0x5599ec[_0x17a70a](_0x04b2('0x2f'));_0x5599ec[_0x17a70a](_0x04b2('0x30'));if(queryQueues[_0x04b2('0x31')]('include')){delete queryQueues[_0x04b2('0x32')];}_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x34')]['findAll'](queryQueues));_0x5228bf['push'](db['ChatQueue'][_0x04b2('0x15')](queryQueues));_0x5228bf[_0x04b2('0x33')](db['FaxQueue']['findAll'](queryQueues));_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x35')][_0x04b2('0x15')](queryQueues));_0x5228bf[_0x04b2('0x33')](db['MailQueue'][_0x04b2('0x15')](queryQueues));_0x5228bf['push'](db['OpenchannelQueue'][_0x04b2('0x15')](queryQueues));_0x5228bf['push'](db[_0x04b2('0x36')][_0x04b2('0x15')](queryQueues));_0x5228bf[_0x04b2('0x33')](db['User'][_0x04b2('0x15')](queryTelephones));_0x5228bf['push'](db['Trunk']['findAll'](queryTrunks));_0x5228bf[_0x04b2('0x33')](db['Campaign']['findAll'](queryCampaigns));_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x7')]['findAll'](queryAgents));break;case _0x04b2('0x37'):_0x5599ec[_0x17a70a](_0x04b2('0x2f'));_0x5599ec[_0x17a70a]('voice:outbound');_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0xf'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x34')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x10'),_0x1f07c4['userProfileId'],'ChatQueue'));_0x5228bf[_0x04b2('0x33')](getAssociatedResources('FaxQueues',_0x1f07c4[_0x04b2('0x23')],'FaxQueue'));_0x5228bf['push'](getAssociatedResources(_0x04b2('0x11'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x35')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x12'),_0x1f07c4[_0x04b2('0x23')],'MailQueue'));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x38'),_0x1f07c4[_0x04b2('0x23')],'OpenchannelQueue'));_0x5228bf[_0x04b2('0x33')](getAssociatedResources('WhatsappQueues',_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x36')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x14'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x7')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x16'),_0x1f07c4['userProfileId'],_0x04b2('0x39')));_0x5228bf['push'](getAssociatedResources(_0x04b2('0x3a'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x3b')));_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x7')][_0x04b2('0x15')](queryAgents));break;case'agent':_0x5599ec[_0x17a70a](_0x04b2('0x2f'));_0x5599ec[_0x17a70a](_0x04b2('0x30'));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3c')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3d')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4['getFaxQueues']({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3e')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3f')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x40')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x41')]({'attributes':['id',_0x04b2('0x5')]}));break;}return BPromise[_0x04b2('0x42')](_0x5228bf);}})[_0x04b2('0xd')](function(_0x9a90f6){if(_0x9a90f6&&_0x9a90f6[_0x04b2('0x1e')]){for(var _0x4016f5=0x0;_0x4016f5<_0x9a90f6[_0x04b2('0x1e')];_0x4016f5+=0x1){for(var _0x3b5d26=0x0;_0x3b5d26<_0x9a90f6[_0x4016f5]['length'];_0x3b5d26+=0x1){switch(_0x4016f5){case 0x0:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x43'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x1:joinOrLeaveQueues(_0x5599ec,_0x17a70a,'chat',_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x2:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x44'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x3:joinOrLeaveQueues(_0x5599ec,_0x17a70a,'sms',_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x4:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x45'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x5:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x46'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x6:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x47'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x7:if(_0x1432b8['role']!==_0x04b2('0x9'))_0x5599ec[_0x17a70a](util[_0x04b2('0x1c')](_0x04b2('0x48'),_0x9a90f6[_0x4016f5][_0x3b5d26]['name']));break;case 0x8:if(_0x1432b8[_0x04b2('0x8')]!=='agent')_0x5599ec[_0x17a70a](util['format']('trunk:%s',_0x9a90f6[_0x4016f5][_0x3b5d26][_0x04b2('0x5')]));break;case 0x9:if(_0x1432b8[_0x04b2('0x8')]!=='agent')_0x5599ec[_0x17a70a](util['format'](_0x04b2('0x49'),_0x9a90f6[_0x4016f5][_0x3b5d26][_0x04b2('0x1b')],_0x9a90f6[_0x4016f5][_0x3b5d26]['name']));break;case 0xa:_0x5599ec[_0x17a70a](util['format'](_0x04b2('0x1f'),_0x9a90f6[_0x4016f5][_0x3b5d26][_0x04b2('0x5')]));break;}}}}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0xe053a0=_[_0x04b2('0x19')](_0x1432b8[_0x04b2('0x25')],'id');return _0x1432b8[_0x04b2('0x4b')](_0xe053a0)['then'](function(){for(var _0x6a8903=0x0;_0x6a8903<_0xe053a0[_0x04b2('0x1e')];_0x6a8903+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x4d'),{'ChatInteractionId':Number(_0xe053a0[_0x6a8903]),'UserId':Number(_0x1432b8['id'])});}});}})['then'](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0x2412d5=_['map'](_0x1432b8['MailInteractions'],'id');return _0x1432b8['removeMailInteractions'](_0x2412d5)[_0x04b2('0xd')](function(){for(var _0x1e347b=0x0;_0x1e347b<_0x2412d5[_0x04b2('0x1e')];_0x1e347b+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x4e'),{'MailInteractionId':Number(_0x2412d5[_0x1e347b]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0x2655ad=_[_0x04b2('0x19')](_0x1432b8[_0x04b2('0x28')],'id');return _0x1432b8[_0x04b2('0x4f')](_0x2655ad)[_0x04b2('0xd')](function(){for(var _0x2b1bf1=0x0;_0x2b1bf1<_0x2655ad['length'];_0x2b1bf1+=0x1){_0x4eb4e3['emit'](_0x04b2('0x50'),{'FaxInteractionId':Number(_0x2655ad[_0x2b1bf1]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0xd55a40=_[_0x04b2('0x19')](_0x1432b8[_0x04b2('0x51')],'id');return _0x1432b8[_0x04b2('0x52')](_0xd55a40)[_0x04b2('0xd')](function(){for(var _0x22caf3=0x0;_0x22caf3<_0xd55a40['length'];_0x22caf3+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x53'),{'SmsInteractionId':Number(_0xd55a40[_0x22caf3]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a==='leave'){var _0x7eefb=_['map'](_0x1432b8['OpenchannelInteractions'],'id');return _0x1432b8[_0x04b2('0x54')](_0x7eefb)[_0x04b2('0xd')](function(){for(var _0x147c01=0x0;_0x147c01<_0x7eefb['length'];_0x147c01+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x55'),{'OpenchannelInteractionId':Number(_0x7eefb[_0x147c01]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0x4dd7cf=_['map'](_0x1432b8[_0x04b2('0x2d')],'id');return _0x1432b8[_0x04b2('0x56')](_0x4dd7cf)[_0x04b2('0xd')](function(){for(var _0x3d110d=0x0;_0x3d110d<_0x4dd7cf[_0x04b2('0x1e')];_0x3d110d+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x57'),{'WhatsappInteractionId':Number(_0x4dd7cf[_0x3d110d]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0x58')](function(_0x410a9d){_0x5599ec[_0x04b2('0x59')](_0x410a9d);});}}function onDisconnect(_0x16f422,_0x233fa1){joinOrLeave(_0x16f422,_0x04b2('0x4a'),_0x233fa1);}function onConnect(_0x455ad4){joinOrLeave(_0x455ad4,_0x04b2('0x5a'));}exports[_0x04b2('0x5b')]=function(_0x476065){_0x476065['on'](_0x04b2('0x5c'),function(_0x15f479){_0x15f479['setMaxListeners'](0x0);_0x15f479[_0x04b2('0x5d')]=_0x15f479[_0x04b2('0x5e')][_0x04b2('0x5c')][_0x04b2('0x5f')]+':'+_0x15f479[_0x04b2('0x5e')][_0x04b2('0x5c')][_0x04b2('0x60')];_0x15f479[_0x04b2('0x61')]=new Date();_0x15f479[_0x04b2('0x59')]=function(_0x11c53c){console[_0x04b2('0x59')](_0x04b2('0x62')+_0x15f479[_0x04b2('0x63')][_0x04b2('0x5')]+'['+_0x15f479[_0x04b2('0x5d')]+']',_0x11c53c);};_0x15f479['on'](_0x04b2('0x64'),function(){onDisconnect(_0x15f479,_0x476065);_0x15f479[_0x04b2('0x59')]('DISCONNECTED');});onConnect(_0x15f479);_0x15f479[_0x04b2('0x59')]('CONNECTED');});};
\ No newline at end of file
index 5f71245..bb23b13 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f72=['SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','error','code','Trigger,\x20%s','catch','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','channel','opened','sequelize','query','SIP/%s','closed','changed','substatus','AfterUpdate','find','email','internal','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction'];(function(_0x3c5a32,_0x59c8c3){var _0x53e098=function(_0x25d8d6){while(--_0x25d8d6){_0x3c5a32['push'](_0x3c5a32['shift']());}};_0x53e098(++_0x59c8c3);}(_0x2f72,0x85));var _0x22f7=function(_0x399e16,_0x450ff4){_0x399e16=_0x399e16-0x0;var _0x12cbc4=_0x2f72[_0x399e16];return _0x12cbc4;};'use strict';var util=require(_0x22f7('0x0'));var db=require(_0x22f7('0x1'))['db'];var jayson=require(_0x22f7('0x2'));var logger=require(_0x22f7('0x3'))(_0x22f7('0x4'));var client=jayson[_0x22f7('0x5')][_0x22f7('0x6')]({'port':0x232a});var triggers=[{'channel':_0x22f7('0x7'),'model':'ChatInteraction','event':_0x22f7('0x8'),'condition':_0x22f7('0x9'),'callback':afterCreate},{'channel':_0x22f7('0x7'),'model':_0x22f7('0xa'),'event':_0x22f7('0xb'),'condition':_0x22f7('0xc'),'callback':afterUpdate},{'channel':'Chat','model':_0x22f7('0xd'),'event':_0x22f7('0x8'),'condition':_0x22f7('0xe'),'callback':afterCreateMessage},{'channel':_0x22f7('0x7'),'model':'ChatOfflineMessage','event':_0x22f7('0x8'),'condition':_0x22f7('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0x22f7('0xf'),'model':_0x22f7('0x10'),'event':_0x22f7('0x8'),'condition':_0x22f7('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0x22f7('0x10'),'event':_0x22f7('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x22f7('0x11'),'event':_0x22f7('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x22f7('0x12'),'model':'WhatsappInteraction','event':_0x22f7('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x22f7('0x12'),'model':_0x22f7('0x13'),'event':_0x22f7('0xb'),'condition':_0x22f7('0xc'),'callback':afterUpdate},{'channel':_0x22f7('0x12'),'model':_0x22f7('0x14'),'event':'afterCreate','condition':_0x22f7('0xe'),'callback':afterCreateMessage},{'channel':_0x22f7('0x15'),'model':_0x22f7('0x16'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x22f7('0x15'),'model':_0x22f7('0x16'),'event':_0x22f7('0xb'),'condition':_0x22f7('0xc'),'callback':afterUpdate},{'channel':'Fax','model':_0x22f7('0x17'),'event':_0x22f7('0x8'),'condition':_0x22f7('0xe'),'callback':afterCreateMessage},{'channel':_0x22f7('0x18'),'model':_0x22f7('0x19'),'event':'afterCreate','condition':_0x22f7('0x9'),'callback':afterCreate},{'channel':_0x22f7('0x18'),'model':_0x22f7('0x19'),'event':'afterUpdate','condition':_0x22f7('0xc'),'callback':afterUpdate},{'channel':_0x22f7('0x18'),'model':_0x22f7('0x1a'),'event':_0x22f7('0x8'),'condition':_0x22f7('0xe'),'callback':afterCreateMessage},{'channel':_0x22f7('0x1b'),'model':_0x22f7('0x1c'),'event':'afterCreate','condition':_0x22f7('0x9'),'callback':afterCreate},{'channel':_0x22f7('0x1b'),'model':_0x22f7('0x1c'),'event':_0x22f7('0xb'),'condition':_0x22f7('0xc'),'callback':afterUpdate},{'channel':_0x22f7('0x1b'),'model':'OpenchannelMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x2c5843){return client[_0x22f7('0x1d')](_0x22f7('0x1e'),_0x2c5843)['then'](function(_0x4349da){logger['info']('Trigger,\x20%s','EventManager',_0x4349da);if(_0x4349da[_0x22f7('0x1f')]){if(_0x4349da['error'][_0x22f7('0x20')]===0x1f4){logger[_0x22f7('0x1f')](_0x22f7('0x21'),_0x22f7('0x1e'),_0x4349da[_0x22f7('0x1f')]);}}})[_0x22f7('0x22')](function(_0x1e9915){logger[_0x22f7('0x1f')](_0x22f7('0x21'),_0x22f7('0x1e'),_0x1e9915);});}function afterCreateMessage(_0x40e422){return function(_0xf20ab3){_0xf20ab3=_0xf20ab3['get']({'plain':!![]});_0xf20ab3['channel']=_0x40e422;_0xf20ab3[_0x22f7('0x23')]=_0x40e422;_0xf20ab3[_0x22f7('0x24')]=_0xf20ab3[_0x22f7('0x25')];Promise[_0x22f7('0x26')]()[_0x22f7('0x27')](function(){if(typeof _0xf20ab3[_0x22f7('0x28')]===_0x22f7('0x29'))return null;var _0x3a04fe=_0x22f7('0x2a')+_0xf20ab3[_0x22f7('0x28')];return db['sequelize']['query'](_0x3a04fe,{'type':db[_0x22f7('0x2b')][_0x22f7('0x2c')][_0x22f7('0x2d')],'raw':!![]});})['then'](function(_0xf80bda){if(_0xf80bda){_0xf20ab3[_0x22f7('0x2e')]=_0xf80bda[0x0];}if(typeof _0xf20ab3[_0x22f7('0x2f')]===_0x22f7('0x29'))return;return getAgent(_0xf20ab3[_0x22f7('0x2f')]);})[_0x22f7('0x27')](function(_0x289200){if(_0x289200){_0xf20ab3[_0x22f7('0x30')]=util[_0x22f7('0x31')]('SIP/%s',_0x289200[_0x22f7('0x32')]);_0xf20ab3[_0x22f7('0x33')]=_0x289200;_0xf20ab3['channel']=_0x40e422;return request({'event':_0x22f7('0x34'),'message':_0xf20ab3});}else{return request({'event':_0x22f7('0x35'),'message':_0xf20ab3});}})[_0x22f7('0x22')](function(_0x3cff2a){logger[_0x22f7('0x1f')]('Trigger,\x20%s',_0x22f7('0x36'),_0x3cff2a);});};}function afterCreateOfflineMessage(_0x300ce5){return function(_0x2195d2){_0x2195d2=_0x2195d2[_0x22f7('0x37')]({'plain':!![]});_0x2195d2[_0x22f7('0x38')]=_0x300ce5;_0x2195d2[_0x22f7('0x23')]=_0x300ce5;_0x2195d2['event']='offlineMessage';return request({'event':_0x2195d2['event'],'message':_0x2195d2});};}function afterCreate(_0x6b527b,_0x40bc1b){return function(_0x4fcbb9){_0x4fcbb9=_0x4fcbb9[_0x22f7('0x37')]({'plain':!![]});_0x4fcbb9[_0x22f7('0x38')]=_0x6b527b;_0x4fcbb9[_0x22f7('0x23')]=_0x6b527b;_0x4fcbb9['event']=_0x22f7('0x39');Promise[_0x22f7('0x26')]()[_0x22f7('0x27')](function(){var _0x1262df=_0x22f7('0x2a')+_0x4fcbb9[_0x22f7('0x28')];return db[_0x22f7('0x3a')][_0x22f7('0x3b')](_0x1262df,{'type':db[_0x22f7('0x2b')][_0x22f7('0x2c')]['SELECT'],'raw':!![]});})[_0x22f7('0x27')](function(_0xe0e55a){if(_0xe0e55a){_0x4fcbb9[_0x22f7('0x2e')]=_0xe0e55a[0x0];}if(typeof _0x4fcbb9[_0x22f7('0x2f')]===_0x22f7('0x29'))return;return getAgent(_0x4fcbb9[_0x22f7('0x2f')]);})[_0x22f7('0x27')](function(_0x5d7381){if(_0x5d7381){_0x4fcbb9[_0x22f7('0x30')]=util['format'](_0x22f7('0x3c'),_0x5d7381['name']);_0x4fcbb9[_0x22f7('0x33')]=_0x5d7381;}return request({'event':_0x40bc1b,'message':_0x4fcbb9});})[_0x22f7('0x22')](function(_0x25a573){logger[_0x22f7('0x1f')](_0x22f7('0x21'),'AfterCreate',_0x25a573);});};}function afterUpdate(_0x170a80){return function(_0x445d83){var _0x437ff9=_0x445d83['changed'](_0x22f7('0x3d'))&&_0x445d83['closed'];var _0x1d511c=_0x445d83[_0x22f7('0x3e')](_0x22f7('0x3f'));if(_0x437ff9||_0x1d511c){var _0x503a0b=_0x437ff9?_0x22f7('0xc'):_0x22f7('0x3f');var _0x459fcc=_0x445d83['get']({'plain':!![]});_0x459fcc['channel']=_0x170a80;_0x459fcc[_0x22f7('0x23')]=_0x170a80;_0x459fcc['event']=_0x437ff9?_0x22f7('0x3d'):'substatus';var _0x5c4699='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x459fcc[_0x22f7('0x28')];return db[_0x22f7('0x3a')]['query'](_0x5c4699,{'type':db[_0x22f7('0x2b')]['QueryTypes'][_0x22f7('0x2d')],'raw':!![]})['then'](function(_0x181b5d){if(_0x181b5d){_0x459fcc[_0x22f7('0x2e')]=_0x181b5d[0x0];}if(typeof _0x459fcc[_0x22f7('0x2f')]===_0x22f7('0x29'))return;return getAgent(_0x459fcc[_0x22f7('0x2f')]);})[_0x22f7('0x27')](function(_0x12b1d6){if(_0x12b1d6){_0x459fcc[_0x22f7('0x30')]=util[_0x22f7('0x31')](_0x22f7('0x3c'),_0x12b1d6[_0x22f7('0x32')]);_0x459fcc[_0x22f7('0x33')]=_0x12b1d6;}return request({'event':_0x503a0b,'message':_0x459fcc});})[_0x22f7('0x22')](function(_0x2ff012){logger[_0x22f7('0x1f')](_0x22f7('0x21'),_0x22f7('0x40'),_0x2ff012);});}};}function getAgent(_0x1d5206){return db['User'][_0x22f7('0x41')]({'where':{'id':_0x1d5206},'attributes':['id',_0x22f7('0x32'),'fullname',_0x22f7('0x42'),_0x22f7('0x43')],'raw':!![]})[_0x22f7('0x27')](function(_0x3080fa){return _0x3080fa;});}exports['default']=function(){for(var _0x3aba6a=0x0;_0x3aba6a<triggers[_0x22f7('0x44')];_0x3aba6a+=0x1){if(db[_0x22f7('0x45')](triggers[_0x3aba6a][_0x22f7('0x46')])){db[triggers[_0x3aba6a]['model']][_0x22f7('0x47')](triggers[_0x3aba6a]['event'],triggers[_0x3aba6a][_0x22f7('0x48')](triggers[_0x3aba6a][_0x22f7('0x38')][_0x22f7('0x49')](),triggers[_0x3aba6a][_0x22f7('0x4a')]));}}};
\ No newline at end of file
+var _0x4b6f=['fullname','email','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','motionChannel','event','direction','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','UserId','undefined','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','interface','changed','closed','substatus','query','Sequelize','AfterUpdate','User'];(function(_0x40971c,_0x163458){var _0x411c0b=function(_0x1c96e5){while(--_0x1c96e5){_0x40971c['push'](_0x40971c['shift']());}};_0x411c0b(++_0x163458);}(_0x4b6f,0x97));var _0xf4b6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4b6f[_0x209941];return _0x1e8729;};'use strict';var util=require(_0xf4b6('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf4b6('0x1'));var logger=require('../logger')(_0xf4b6('0x2'));var client=jayson[_0xf4b6('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0xf4b6('0x4'),'model':_0xf4b6('0x5'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0x7'),'callback':afterCreate},{'channel':_0xf4b6('0x4'),'model':_0xf4b6('0x5'),'event':'afterUpdate','condition':_0xf4b6('0x8'),'callback':afterUpdate},{'channel':_0xf4b6('0x4'),'model':_0xf4b6('0x9'),'event':'afterCreate','condition':_0xf4b6('0xa'),'callback':afterCreateMessage},{'channel':_0xf4b6('0x4'),'model':_0xf4b6('0xb'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0xf4b6('0xc'),'model':_0xf4b6('0xd'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0x7'),'callback':afterCreate},{'channel':_0xf4b6('0xc'),'model':_0xf4b6('0xd'),'event':_0xf4b6('0xe'),'condition':_0xf4b6('0x8'),'callback':afterUpdate},{'channel':_0xf4b6('0xc'),'model':_0xf4b6('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf4b6('0x10'),'model':'WhatsappInteraction','event':_0xf4b6('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf4b6('0x10'),'model':_0xf4b6('0x11'),'event':_0xf4b6('0xe'),'condition':_0xf4b6('0x8'),'callback':afterUpdate},{'channel':_0xf4b6('0x10'),'model':_0xf4b6('0x12'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0xa'),'callback':afterCreateMessage},{'channel':_0xf4b6('0x13'),'model':'FaxInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xf4b6('0x13'),'model':'FaxInteraction','event':_0xf4b6('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf4b6('0x13'),'model':'FaxMessage','event':_0xf4b6('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf4b6('0x14'),'model':_0xf4b6('0x15'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0x7'),'callback':afterCreate},{'channel':_0xf4b6('0x14'),'model':_0xf4b6('0x15'),'event':_0xf4b6('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf4b6('0x14'),'model':'MailMessage','event':_0xf4b6('0x6'),'condition':_0xf4b6('0xa'),'callback':afterCreateMessage},{'channel':_0xf4b6('0x16'),'model':_0xf4b6('0x17'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xf4b6('0xe'),'condition':_0xf4b6('0x8'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xf4b6('0x18'),'event':_0xf4b6('0x6'),'condition':_0xf4b6('0xa'),'callback':afterCreateMessage}];function request(_0x22669a){return client[_0xf4b6('0x19')](_0xf4b6('0x1a'),_0x22669a)[_0xf4b6('0x1b')](function(_0x4d6c45){logger['info'](_0xf4b6('0x1c'),_0xf4b6('0x1a'),_0x4d6c45);if(_0x4d6c45[_0xf4b6('0x1d')]){if(_0x4d6c45[_0xf4b6('0x1d')][_0xf4b6('0x1e')]===0x1f4){logger['error'](_0xf4b6('0x1c'),_0xf4b6('0x1a'),_0x4d6c45[_0xf4b6('0x1d')]);}}})[_0xf4b6('0x1f')](function(_0x2959ca){logger['error'](_0xf4b6('0x1c'),_0xf4b6('0x1a'),_0x2959ca);});}function afterCreateMessage(_0x101d4b){return function(_0x2d595b){_0x2d595b=_0x2d595b[_0xf4b6('0x20')]({'plain':!![]});_0x2d595b['channel']=_0x101d4b;_0x2d595b[_0xf4b6('0x21')]=_0x101d4b;_0x2d595b[_0xf4b6('0x22')]=_0x2d595b[_0xf4b6('0x23')];Promise[_0xf4b6('0x24')]()[_0xf4b6('0x1b')](function(){if(typeof _0x2d595b[_0xf4b6('0x25')]==='undefined')return null;var _0x5a06b9=_0xf4b6('0x26')+_0x2d595b[_0xf4b6('0x25')];return db[_0xf4b6('0x27')]['query'](_0x5a06b9,{'type':db['Sequelize'][_0xf4b6('0x28')][_0xf4b6('0x29')],'raw':!![]});})[_0xf4b6('0x1b')](function(_0x1ea66a){if(_0x1ea66a){_0x2d595b[_0xf4b6('0x2a')]=_0x1ea66a[0x0];}if(typeof _0x2d595b[_0xf4b6('0x2b')]===_0xf4b6('0x2c'))return;return getAgent(_0x2d595b['UserId']);})[_0xf4b6('0x1b')](function(_0x25fb46){if(_0x25fb46){_0x2d595b['interface']=util[_0xf4b6('0x2d')](_0xf4b6('0x2e'),_0x25fb46[_0xf4b6('0x2f')]);_0x2d595b[_0xf4b6('0x30')]=_0x25fb46;_0x2d595b[_0xf4b6('0x31')]=_0x101d4b;return request({'event':_0xf4b6('0x32'),'message':_0x2d595b});}else{return request({'event':_0xf4b6('0x33'),'message':_0x2d595b});}})[_0xf4b6('0x1f')](function(_0x5adc89){logger[_0xf4b6('0x1d')](_0xf4b6('0x1c'),_0xf4b6('0x34'),_0x5adc89);});};}function afterCreateOfflineMessage(_0x538b7f){return function(_0x20fa30){_0x20fa30=_0x20fa30[_0xf4b6('0x20')]({'plain':!![]});_0x20fa30[_0xf4b6('0x31')]=_0x538b7f;_0x20fa30[_0xf4b6('0x21')]=_0x538b7f;_0x20fa30[_0xf4b6('0x22')]=_0xf4b6('0x35');return request({'event':_0x20fa30[_0xf4b6('0x22')],'message':_0x20fa30});};}function afterCreate(_0x5e4f8e,_0x112fe4){return function(_0x3f434a){_0x3f434a=_0x3f434a['get']({'plain':!![]});_0x3f434a[_0xf4b6('0x31')]=_0x5e4f8e;_0x3f434a[_0xf4b6('0x21')]=_0x5e4f8e;_0x3f434a[_0xf4b6('0x22')]='opened';Promise[_0xf4b6('0x24')]()[_0xf4b6('0x1b')](function(){var _0x5a289f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f434a[_0xf4b6('0x25')];return db['sequelize']['query'](_0x5a289f,{'type':db['Sequelize']['QueryTypes'][_0xf4b6('0x29')],'raw':!![]});})[_0xf4b6('0x1b')](function(_0x3e0d4d){if(_0x3e0d4d){_0x3f434a[_0xf4b6('0x2a')]=_0x3e0d4d[0x0];}if(typeof _0x3f434a[_0xf4b6('0x2b')]===_0xf4b6('0x2c'))return;return getAgent(_0x3f434a['UserId']);})[_0xf4b6('0x1b')](function(_0x8c29b5){if(_0x8c29b5){_0x3f434a[_0xf4b6('0x36')]=util['format'](_0xf4b6('0x2e'),_0x8c29b5[_0xf4b6('0x2f')]);_0x3f434a[_0xf4b6('0x30')]=_0x8c29b5;}return request({'event':_0x112fe4,'message':_0x3f434a});})[_0xf4b6('0x1f')](function(_0x1fed05){logger['error'](_0xf4b6('0x1c'),'AfterCreate',_0x1fed05);});};}function afterUpdate(_0xb20217){return function(_0x1dcfc7){var _0x3bceae=_0x1dcfc7[_0xf4b6('0x37')](_0xf4b6('0x38'))&&_0x1dcfc7[_0xf4b6('0x38')];var _0x344a84=_0x1dcfc7[_0xf4b6('0x37')](_0xf4b6('0x39'));if(_0x3bceae||_0x344a84){var _0xd00fb6=_0x3bceae?_0xf4b6('0x8'):'substatus';var _0x34add9=_0x1dcfc7[_0xf4b6('0x20')]({'plain':!![]});_0x34add9['channel']=_0xb20217;_0x34add9[_0xf4b6('0x21')]=_0xb20217;_0x34add9[_0xf4b6('0x22')]=_0x3bceae?_0xf4b6('0x38'):_0xf4b6('0x39');var _0x4211b6=_0xf4b6('0x26')+_0x34add9[_0xf4b6('0x25')];return db[_0xf4b6('0x27')][_0xf4b6('0x3a')](_0x4211b6,{'type':db[_0xf4b6('0x3b')][_0xf4b6('0x28')][_0xf4b6('0x29')],'raw':!![]})[_0xf4b6('0x1b')](function(_0x3899fc){if(_0x3899fc){_0x34add9[_0xf4b6('0x2a')]=_0x3899fc[0x0];}if(typeof _0x34add9[_0xf4b6('0x2b')]==='undefined')return;return getAgent(_0x34add9[_0xf4b6('0x2b')]);})['then'](function(_0x3d060a){if(_0x3d060a){_0x34add9[_0xf4b6('0x36')]=util[_0xf4b6('0x2d')](_0xf4b6('0x2e'),_0x3d060a[_0xf4b6('0x2f')]);_0x34add9['agent']=_0x3d060a;}return request({'event':_0xd00fb6,'message':_0x34add9});})[_0xf4b6('0x1f')](function(_0x20d51d){logger[_0xf4b6('0x1d')](_0xf4b6('0x1c'),_0xf4b6('0x3c'),_0x20d51d);});}};}function getAgent(_0x295e5e){return db[_0xf4b6('0x3d')]['find']({'where':{'id':_0x295e5e},'attributes':['id',_0xf4b6('0x2f'),_0xf4b6('0x3e'),_0xf4b6('0x3f'),'internal'],'raw':!![]})['then'](function(_0x341c70){return _0x341c70;});}exports[_0xf4b6('0x40')]=function(){for(var _0x352706=0x0;_0x352706<triggers['length'];_0x352706+=0x1){if(db[_0xf4b6('0x41')](triggers[_0x352706]['model'])){db[triggers[_0x352706][_0xf4b6('0x42')]][_0xf4b6('0x43')](triggers[_0x352706][_0xf4b6('0x22')],triggers[_0x352706][_0xf4b6('0x44')](triggers[_0x352706][_0xf4b6('0x31')][_0xf4b6('0x45')](),triggers[_0x352706][_0xf4b6('0x46')]));}}};
\ No newline at end of file
index 601f5ec..0f3d6ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e51=['catch','bluebird','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x3bbed0,_0x19aec6){var _0x566e88=function(_0x3c5b33){while(--_0x3c5b33){_0x3bbed0['push'](_0x3bbed0['shift']());}};_0x566e88(++_0x19aec6);}(_0x5e51,0x181));var _0x15e5=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x5e51[_0x1bf8cc];return _0x322d20;};'use strict';var _=require('lodash');var BPromise=require(_0x15e5('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x15e5('0x1'));var channels=[_0x15e5('0x2'),_0x15e5('0x3'),_0x15e5('0x4'),_0x15e5('0x5'),_0x15e5('0x6'),_0x15e5('0x7'),_0x15e5('0x8')];exports[_0x15e5('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x2fbe52){_0x2fbe52=_0x2fbe52[_0x15e5('0xa')]();return _[_0x15e5('0xb')](channels,_0x2fbe52);};exports[_0x15e5('0xc')]=function(_0x19757f,_0x311a97,_0x1288de,_0x66cb3c){var _0xdbb7eb={'loginAttempts':_0x311a97,'blocked':_0x1288de};if(!_['isUndefined'](_0x66cb3c)){_0xdbb7eb[_0x15e5('0xd')]=_0x66cb3c;}return _0x19757f[_0x15e5('0xe')](_0xdbb7eb);};exports[_0x15e5('0xf')]=function(_0x2317ab){return new BPromise(function(_0x411731,_0x5def47){var _0x1f6eb2=0x0;if(_0x2317ab[_0x15e5('0x10')]!==_0x15e5('0x11')){_0x411731(_0x2317ab);}db[_0x15e5('0x12')][_0x15e5('0x13')]({'where':{'role':_0x15e5('0x11'),'online':!![],'id':{'$ne':_0x2317ab['id']}}})[_0x15e5('0x14')](function(_0x30d0e8){_0x1f6eb2=_0x30d0e8;return util[_0x15e5('0xf')]();})[_0x15e5('0x14')](function(_0x519188){if(_0x519188&&_0x519188['agents']&&_0x1f6eb2>=_0x519188[_0x15e5('0x15')]){throw Error(_0x15e5('0x16'));}_0x411731(_0x2317ab);})[_0x15e5('0x17')](function(_0x25d2c8){_0x5def47(_0x25d2c8);});});};
\ No newline at end of file
+var _0x542c=['agents','catch','lodash','bluebird','../mysqldb','voice','chat','fax','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then'];(function(_0x2eb410,_0x46e213){var _0x29fd40=function(_0xd00051){while(--_0xd00051){_0x2eb410['push'](_0x2eb410['shift']());}};_0x29fd40(++_0x46e213);}(_0x542c,0x86));var _0xc542=function(_0x5dd246,_0x4b6ebb){_0x5dd246=_0x5dd246-0x0;var _0x25efbd=_0x542c[_0x5dd246];return _0x25efbd;};'use strict';var _=require(_0xc542('0x0'));var BPromise=require(_0xc542('0x1'));var db=require(_0xc542('0x2'))['db'];var util=require('./license/util');var channels=[_0xc542('0x3'),'mail',_0xc542('0x4'),_0xc542('0x5'),_0xc542('0x6'),_0xc542('0x7'),_0xc542('0x8')];exports['getChannels']=function(){return channels;};exports[_0xc542('0x9')]=function(_0x26d811){_0x26d811=_0x26d811[_0xc542('0xa')]();return _[_0xc542('0xb')](channels,_0x26d811);};exports['clearBlockUser']=function(_0x28137a,_0xc9d9ec,_0x5c5e33,_0x5c903a){var _0x420406={'loginAttempts':_0xc9d9ec,'blocked':_0x5c5e33};if(!_[_0xc542('0xc')](_0x5c903a)){_0x420406[_0xc542('0xd')]=_0x5c903a;}return _0x28137a[_0xc542('0xe')](_0x420406);};exports[_0xc542('0xf')]=function(_0x52f247){return new BPromise(function(_0xbf9e5d,_0x5da116){var _0x18e158=0x0;if(_0x52f247['role']!==_0xc542('0x10')){_0xbf9e5d(_0x52f247);}db[_0xc542('0x11')][_0xc542('0x12')]({'where':{'role':_0xc542('0x10'),'online':!![],'id':{'$ne':_0x52f247['id']}}})['then'](function(_0x23a469){_0x18e158=_0x23a469;return util[_0xc542('0xf')]();})[_0xc542('0x13')](function(_0x57c740){if(_0x57c740&&_0x57c740[_0xc542('0x14')]&&_0x18e158>=_0x57c740[_0xc542('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0xbf9e5d(_0x52f247);})[_0xc542('0x15')](function(_0x143d56){_0x5da116(_0x143d56);});});};
\ No newline at end of file
index 257f182..2328d84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['Not\x20Found','Forbidden','OutOfInterval','error','stack','status','exports','api','message','Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','name','Entity\x20not\x20found'];(function(_0x515aa1,_0x444e1c){var _0x5723f0=function(_0x4d2eb0){while(--_0x4d2eb0){_0x515aa1['push'](_0x515aa1['shift']());}};_0x5723f0(++_0x444e1c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x3071('0x0'));var APIError=function(_0x2afa91,_0x27405a){this[_0x3071('0x1')]=_0x2afa91||_0x3071('0x2');this['name']=_0x27405a||_0x3071('0x3');util[_0x3071('0x4')](APIError,Error);};var APIBadRequestError=function(_0x33a70c){this[_0x3071('0x1')]=_0x33a70c||_0x3071('0x5');this[_0x3071('0x6')]=_0x3071('0x5');util[_0x3071('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xbd737f){this[_0x3071('0x1')]=_0xbd737f||_0x3071('0x7');this[_0x3071('0x6')]=_0x3071('0x8');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x3457cd){switch(_0x3457cd){case _0x3071('0x5'):return 0x190;case _0x3071('0x9'),_0x3071('0xa'):return 0x193;case _0x3071('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a470a){return function(_0x2ace21){logger[_0x3071('0xb')](_0x2ace21[_0x3071('0xc')]);var _0x3ed4a0=getStatusCode(_0x2ace21[_0x3071('0x6')]);if(_0x2ace21['name'])delete _0x2ace21['name'];return _0x4a470a[_0x3071('0xd')](_0x3ed4a0)['send'](_0x2ace21);};}module[_0x3071('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
+var _0x5b02=['inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','stack','name','status','send','exports','util','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x5b02,0xe9));var _0x25b0=function(_0x26054b,_0x422fbc){_0x26054b=_0x26054b-0x0;var _0x49aef6=_0x5b02[_0x26054b];return _0x49aef6;};'use strict';var util=require(_0x25b0('0x0'));var logger=require(_0x25b0('0x1'))(_0x25b0('0x2'));var APIError=function(_0x1c3295,_0x4ef71c){this['message']=_0x1c3295||_0x25b0('0x3');this['name']=_0x4ef71c||_0x25b0('0x4');util[_0x25b0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x38dc14){this[_0x25b0('0x6')]=_0x38dc14||_0x25b0('0x7');this['name']=_0x25b0('0x7');util[_0x25b0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x49ef3a){this[_0x25b0('0x6')]=_0x49ef3a||'Entity\x20not\x20found';this['name']=_0x25b0('0x8');util[_0x25b0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x358af0){switch(_0x358af0){case'Bad\x20Request':return 0x190;case _0x25b0('0x9'),_0x25b0('0xa'):return 0x193;case _0x25b0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x250d31){return function(_0x2c72f3){logger[_0x25b0('0xb')](_0x2c72f3[_0x25b0('0xc')]);var _0x10c3fb=getStatusCode(_0x2c72f3[_0x25b0('0xd')]);if(_0x2c72f3[_0x25b0('0xd')])delete _0x2c72f3[_0x25b0('0xd')];return _0x250d31[_0x25b0('0xe')](_0x10c3fb)[_0x25b0('0xf')](_0x2c72f3);};}module[_0x25b0('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
index 249e672..47cff64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a01=['render','json','exports','404','status'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x0a01,0x156));var _0x10a0=function(_0x453bf1,_0x3cca87){_0x453bf1=_0x453bf1-0x0;var _0x53b216=_0x0a01[_0x453bf1];return _0x53b216;};'use strict';module[_0x10a0('0x0')][0x194]=function pageNotFound(_0x377c8f,_0x133e83){var _0x2f1268=_0x10a0('0x1');var _0x4008a4=0x194;var _0xe817f4={'status':_0x4008a4};_0x133e83['status'](_0xe817f4[_0x10a0('0x2')]);_0x133e83[_0x10a0('0x3')](_0x2f1268,{},function(_0x3ccee5,_0x2a05d8){if(_0x3ccee5){return _0x133e83[_0x10a0('0x2')](_0xe817f4[_0x10a0('0x2')])[_0x10a0('0x4')](_0xe817f4);}_0x133e83['send'](_0x2a05d8);});};
\ No newline at end of file
+var _0x858f=['404','status','render','json','send'];(function(_0x34951f,_0x277327){var _0x487db1=function(_0x452a5f){while(--_0x452a5f){_0x34951f['push'](_0x34951f['shift']());}};_0x487db1(++_0x277327);}(_0x858f,0xeb));var _0xf858=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x858f[_0x207a02];return _0xd995c3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5b2688,_0x41837d){var _0x521dba=_0xf858('0x0');var _0x3998e4=0x194;var _0x3ded64={'status':_0x3998e4};_0x41837d[_0xf858('0x1')](_0x3ded64['status']);_0x41837d[_0xf858('0x2')](_0x521dba,{},function(_0x3463f0,_0x4f6d8c){if(_0x3463f0){return _0x41837d[_0xf858('0x1')](_0x3ded64['status'])[_0xf858('0x3')](_0x3ded64);}_0x41837d[_0xf858('0x4')](_0x4f6d8c);});};
\ No newline at end of file
index bc1f518..87bf151 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2931=['SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','Website','CompanyId','Phones','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticFieldReport','MetricId','Configurations','AccountId','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmField','Subjects','Descriptions','SubjectId','DeskAccount','DeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','TeamVoiceQueue','VoiceQueues','OpenchannelQueues','team_has_whatsapp_queues','TeamVoicePrefix','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','ChatOfflineMessageId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','name','database','username','password','options','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','import','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','MemberReport','Trunk','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','hasMany','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','OpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','Messages','mailbox','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailServerIn','CloudProviderId','Imap','Disposition','Dispositions','MailAccountId','Answers','Interactions','List','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','restrict','TagId','Dashboard','FaxAccountId','Applications','Exntensions','mandatoryDispositionPauseId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccount'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x2931,0x80));var _0x1293=function(_0x450201,_0x57d8bc){_0x450201=_0x450201-0x0;var _0x3c617d=_0x2931[_0x450201];return _0x3c617d;};'use strict';var config=require(_0x1293('0x0'));var Sequelize=require('sequelize');var _=require(_0x1293('0x1'));var jstz=require(_0x1293('0x2'));var timezone=jstz[_0x1293('0x3')]();config[_0x1293('0x4')]=_[_0x1293('0x5')](config[_0x1293('0x4')],{'database':_0x1293('0x6'),'username':_0x1293('0x7'),'password':'xC@LL1234','options':{'host':_0x1293('0x8'),'port':0xcea,'dialect':_0x1293('0x9'),'dialectOptions':{'charset':_0x1293('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x1293('0xb'),'collate':_0x1293('0xc')}}});config[_0x1293('0xd')]=_['defaultsDeep'](config[_0x1293('0xd')],{'database':_0x1293('0x6'),'username':_0x1293('0x7'),'password':_0x1293('0xe'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x1293('0x9'),'dialectOptions':{'charset':_0x1293('0xa')},'logging':![],'timezone':timezone[_0x1293('0xf')](),'define':{'charset':_0x1293('0xb'),'collate':_0x1293('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1293('0x4')][_0x1293('0x10')],config[_0x1293('0x4')][_0x1293('0x11')],config[_0x1293('0x4')]['password'],config[_0x1293('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1293('0xd')][_0x1293('0x10')],config[_0x1293('0xd')][_0x1293('0x11')],config[_0x1293('0xd')][_0x1293('0x12')],config['sequelizeHistory'][_0x1293('0x13')])};db['User']=db[_0x1293('0x4')]['import']('../api/user/user.model');db[_0x1293('0x14')]=db[_0x1293('0x4')]['import'](_0x1293('0x15'));db[_0x1293('0x16')]=db['sequelize']['import'](_0x1293('0x17'));db[_0x1293('0x18')]=db['sequelize']['import'](_0x1293('0x19'));db[_0x1293('0x1a')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x1c'));db[_0x1293('0x1d')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x1e'));db[_0x1293('0x1f')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x20'));db[_0x1293('0x21')]=db[_0x1293('0x4')]['import']('../api/screenRecording/screenRecording.model');db[_0x1293('0x22')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x23'));db[_0x1293('0x24')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x25'));db['VoiceCallReport']=db[_0x1293('0x4')]['import'](_0x1293('0x26'));db[_0x1293('0x27')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x28'));db['VoiceAgentReport']=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1293('0x29')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x1293('0x2a')]=db['sequelize'][_0x1293('0x1b')]('../api/memberReport/memberReport.model');db[_0x1293('0x2b')]=db[_0x1293('0x4')]['import']('../api/trunk/trunk.model');db[_0x1293('0x2c')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x1293('0x2d')]=db['sequelize'][_0x1293('0x1b')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x1293('0x2e')]=db[_0x1293('0x4')]['import'](_0x1293('0x2f'));db[_0x1293('0x30')]=db[_0x1293('0x4')]['import'](_0x1293('0x31'));db[_0x1293('0x32')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x33'));db[_0x1293('0x34')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x35'));db[_0x1293('0x36')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x37'));db[_0x1293('0x38')]=db[_0x1293('0x4')]['import'](_0x1293('0x39'));db[_0x1293('0x3a')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x3b'));db['MailServerIn']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x3c'));db[_0x1293('0x3d')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x3e'));db[_0x1293('0x3f')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x40'));db[_0x1293('0x41')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/mailQueue/mailQueue.model');db[_0x1293('0x42')]=db[_0x1293('0x4')]['import'](_0x1293('0x43'));db[_0x1293('0x44')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0x1293('0x45')]=db['sequelize']['import'](_0x1293('0x46'));db[_0x1293('0x47')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x48'));db[_0x1293('0x49')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x4a'));db['Dashboard']=db['sequelize']['import'](_0x1293('0x4b'));db[_0x1293('0x4c')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x4d'));db['FaxAccount']=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/faxAccount/faxAccount.model');db[_0x1293('0x4e')]=db[_0x1293('0x4')]['import'](_0x1293('0x4f'));db[_0x1293('0x50')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x51'));db[_0x1293('0x52')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x53'));db[_0x1293('0x54')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x55'));db[_0x1293('0x56')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db['sequelize'][_0x1293('0x1b')](_0x1293('0x57'));db[_0x1293('0x58')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x59'));db[_0x1293('0x5a')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/smsInteraction/smsInteraction.model');db[_0x1293('0x5b')]=db['sequelize'][_0x1293('0x1b')]('../api/smsMessage/smsMessage.model');db[_0x1293('0x5c')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x5d'));db[_0x1293('0x5e')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x5f'));db[_0x1293('0x60')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/openchannelApplication/openchannelApplication.model');db[_0x1293('0x61')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x1293('0x62')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x63'));db['OpenchannelQueue']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x64'));db[_0x1293('0x65')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x66'));db[_0x1293('0x67')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x68'));db[_0x1293('0x69')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x6a'));db[_0x1293('0x6b')]=db[_0x1293('0x4')]['import'](_0x1293('0x6c'));db[_0x1293('0x6d')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x6e'));db['ChatOfflineMessage']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x6f'));db[_0x1293('0x70')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x71'));db[_0x1293('0x72')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x73'));db['ChatProactiveAction']=db['sequelize'][_0x1293('0x1b')](_0x1293('0x74'));db['CmCompany']=db['sequelize'][_0x1293('0x1b')]('../api/cmCompany/cmCompany.model');db[_0x1293('0x75')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x76'));db[_0x1293('0x77')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x78'));db[_0x1293('0x79')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x7a'));db[_0x1293('0x7b')]=db['sequelize']['import'](_0x1293('0x7c'));db[_0x1293('0x7d')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x7e'));db[_0x1293('0x7f')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x80'));db[_0x1293('0x81')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x82'));db[_0x1293('0x83')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x84'));db['Automation']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x85'));db[_0x1293('0x86')]=db['sequelize'][_0x1293('0x1b')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x1293('0x1b')](_0x1293('0x87'));db[_0x1293('0x88')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x89'));db[_0x1293('0x8a')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x8b'));db[_0x1293('0x8c')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x8d'));db[_0x1293('0x8e')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/cdr/cdr.model');db[_0x1293('0x8f')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x1293('0x90')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x91'));db['Sound']=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/sound/sound.model');db[_0x1293('0x92')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x93'));db[_0x1293('0x94')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x95'));db[_0x1293('0x96')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x97'));db[_0x1293('0x98')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x99'));db[_0x1293('0x9a')]=db[_0x1293('0x4')]['import'](_0x1293('0x9b'));db['Trigger']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x9c'));db[_0x1293('0x9d')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x9e'));db[_0x1293('0x9f')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/integration/integration.model');db[_0x1293('0xa0')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/integrationReport/integrationReport.model');db[_0x1293('0xa1')]=db[_0x1293('0x4')]['import'](_0x1293('0xa2'));db[_0x1293('0xa3')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xa4'));db[_0x1293('0xa5')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xa6'));db[_0x1293('0xa7')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xa8'));db['AnalyticFieldReport']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xa9'));db[_0x1293('0xaa')]=db[_0x1293('0x4')]['import'](_0x1293('0xab'));db[_0x1293('0xac')]=db[_0x1293('0x4')]['import'](_0x1293('0xad'));db[_0x1293('0xae')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x1293('0xaf')]=db['sequelize'][_0x1293('0x1b')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1293('0xb0')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xb1'));db[_0x1293('0xb2')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xb3'));db['SugarcrmField']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xb4'));db['DeskAccount']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xb5'));db['DeskConfiguration']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xb6'));db[_0x1293('0xb7')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xb8'));db['ZohoAccount']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xb9'));db[_0x1293('0xba')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xbb'));db[_0x1293('0xbc')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/intZohoField/intZohoField.model');db[_0x1293('0xbd')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xbe'));db[_0x1293('0xbf')]=db['sequelize'][_0x1293('0x1b')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x1293('0xc0')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/intZendeskField/intZendeskField.model');db[_0x1293('0xc1')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xc2'));db[_0x1293('0xc3')]=db[_0x1293('0x4')]['import'](_0x1293('0xc4'));db[_0x1293('0xc5')]=db['sequelize'][_0x1293('0x1b')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x1293('0xc6')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xc7'));db['VtigerConfiguration']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xc8'));db[_0x1293('0xc9')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xca'));db[_0x1293('0xcb')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x1293('0xcc')]=db['sequelize'][_0x1293('0x1b')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x1293('0xcd')]=db[_0x1293('0x4')]['import'](_0x1293('0xce'));db[_0x1293('0xcf')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xd0'));db[_0x1293('0xd1')]=db[_0x1293('0x4')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x1293('0xd2')]=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0x1293('0xd3')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x1293('0xd4')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xd5'));db[_0x1293('0xd6')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xd7'));db[_0x1293('0x9f')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xd8'));db[_0x1293('0xd9')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xda'));db['ChatQueueReport']=db[_0x1293('0x4')]['import'](_0x1293('0xdb'));db[_0x1293('0xdc')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x1293('0xdd')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x1293('0xde')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xdf'));db[_0x1293('0xe0')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xe1'));db['SmsQueueReport']=db['sequelize'][_0x1293('0x1b')](_0x1293('0xe2'));db[_0x1293('0xe3')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xe4'));db[_0x1293('0xe5')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xe6'));db['JscriptyProject']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xe7'));db['Setting']=db[_0x1293('0x4')]['import']('../api/setting/setting.model');db[_0x1293('0xe8')]=db[_0x1293('0x4')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x1293('0xe9')]=db['sequelize']['import'](_0x1293('0xea'));db[_0x1293('0xeb')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xec'));db[_0x1293('0xed')]=db[_0x1293('0x4')]['import'](_0x1293('0xee'));db[_0x1293('0xef')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xf0'));db[_0x1293('0xf1')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xf2'));db[_0x1293('0xf3')]=db[_0x1293('0x4')]['import'](_0x1293('0xf4'));db[_0x1293('0xf5')]=db[_0x1293('0x4')]['import']('../api/migration/migration.model');db['Attachment']=db['sequelize'][_0x1293('0x1b')]('../api/attachment/attachment.model');db[_0x1293('0xf6')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xf7'));db[_0x1293('0xf8')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xf9'));db[_0x1293('0xfa')]=db[_0x1293('0x4')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x1293('0xfb')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0xfc'));db[_0x1293('0xfd')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x1293('0xfe')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0xff'));db[_0x1293('0x100')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/cmList/cmList.model');db[_0x1293('0x101')]=db[_0x1293('0x4')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x1293('0x102')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x103'));db[_0x1293('0x104')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x105'));db['UserProfileResource']=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db['sequelize'][_0x1293('0x1b')](_0x1293('0x106'));db[_0x1293('0x107')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x108'));db[_0x1293('0x109')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x10a'));db[_0x1293('0x10b')]=db[_0x1293('0x4')]['import'](_0x1293('0x10c'));db['WhatsappMessage']=db['sequelize'][_0x1293('0x1b')](_0x1293('0x10d'));db['WhatsappQueueReport']=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x1293('0x10e')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x10f'));db[_0x1293('0x110')]=db[_0x1293('0x4')]['import'](_0x1293('0x111'));db[_0x1293('0x112')]=db[_0x1293('0x4')][_0x1293('0x1b')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x1293('0x4')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x113'));db[_0x1293('0x114')]=db[_0x1293('0x4')][_0x1293('0x1b')](_0x1293('0x115'));db[_0x1293('0x116')]=db['sequelize'][_0x1293('0x1b')](_0x1293('0x117'));db[_0x1293('0x118')][_0x1293('0x119')](db[_0x1293('0x22')],{'as':_0x1293('0x22'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')][_0x1293('0x119')](db[_0x1293('0x116')],{'as':_0x1293('0x11c'),'onDelete':'cascade','foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')]['hasMany'](db[_0x1293('0x1f')],{'as':'Recordings','foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')]['hasMany'](db[_0x1293('0x2d')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x1293('0x118')][_0x1293('0x11d')](db[_0x1293('0x18')],{'as':_0x1293('0x11e'),'onDelete':'cascade','hooks':!![]});db[_0x1293('0x118')]['hasMany'](db[_0x1293('0x7b')],{'as':_0x1293('0x11f'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')]['hasMany'](db[_0x1293('0x7d')],{'as':'HopperHistory','foreignKey':'UserId'});db['User'][_0x1293('0x11d')](db[_0x1293('0x7f')],{'as':_0x1293('0x7f'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')][_0x1293('0x11d')](db[_0x1293('0x61')],{'as':_0x1293('0x120'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')][_0x1293('0x11d')](db['ChatInteraction'],{'as':_0x1293('0x121'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')][_0x1293('0x11d')](db[_0x1293('0x5a')],{'as':_0x1293('0x122'),'foreignKey':'UserId'});db['User'][_0x1293('0x11d')](db['FaxInteraction'],{'as':_0x1293('0x123'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')]['hasMany'](db[_0x1293('0x44')],{'as':'MailInteractions','foreignKey':_0x1293('0x11b')});db['User'][_0x1293('0x11d')](db[_0x1293('0x10b')],{'as':_0x1293('0x124'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x118')]['hasMany'](db['UserNotification'],{'as':_0x1293('0x125'),'foreignKey':_0x1293('0x126')});db['User'][_0x1293('0x127')](db[_0x1293('0x102')],{'as':'UserProfile','foreignKey':_0x1293('0x128')});db[_0x1293('0x118')]['belongsToMany'](db[_0x1293('0x72')],{'as':_0x1293('0x129'),'through':_0x1293('0x12a')});db[_0x1293('0x118')][_0x1293('0x12b')](db['CmContact'],{'as':_0x1293('0x12c'),'through':_0x1293('0x12d')});db[_0x1293('0x118')]['belongsToMany'](db[_0x1293('0x100')],{'as':_0x1293('0x12e'),'through':_0x1293('0x12f')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0xef')],{'through':_0x1293('0x130')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x44')],{'as':'MailInteractions','through':_0x1293('0x131')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x6b')],{'as':'ChatInteractions','through':_0x1293('0x132')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x50')],{'as':_0x1293('0x123'),'through':'user_has_fax_interactions'});db['User'][_0x1293('0x12b')](db[_0x1293('0x5a')],{'as':_0x1293('0x122'),'through':_0x1293('0x133')});db[_0x1293('0x118')][_0x1293('0x12b')](db['OpenchannelInteraction'],{'as':_0x1293('0x120'),'through':_0x1293('0x134')});db['User'][_0x1293('0x12b')](db[_0x1293('0x10b')],{'as':'WhatsappInteractions','through':_0x1293('0x135')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x1d')],{'as':'VoiceQueues','through':_0x1293('0x2e'),'required':![]});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x101')],{'as':_0x1293('0x136'),'through':'UserVoicePrefix','required':![]});db[_0x1293('0x118')]['belongsToMany'](db['MailQueue'],{'as':_0x1293('0x137'),'through':_0x1293('0x32'),'required':![]});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x70')],{'as':_0x1293('0x138'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x54')],{'as':_0x1293('0x139'),'through':_0x1293('0x34'),'required':![]});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x5c')],{'as':'SmsQueues','through':_0x1293('0x36'),'required':![]});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x13a')],{'as':'OpenchannelQueues','through':_0x1293('0x38'),'required':![]});db[_0x1293('0x118')][_0x1293('0x12b')](db['WhatsappQueue'],{'as':_0x1293('0x13b'),'through':_0x1293('0x3a'),'required':![]});db[_0x1293('0x118')][_0x1293('0x12b')](db['CmList'],{'through':_0x1293('0x12f')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x65')],{'as':_0x1293('0x13c'),'through':_0x1293('0x13d')});db['User'][_0x1293('0x12b')](db[_0x1293('0x13e')],{'as':_0x1293('0x13f'),'through':_0x1293('0x140')});db[_0x1293('0x118')][_0x1293('0x12b')](db['MailAccount'],{'as':_0x1293('0x141'),'through':_0x1293('0x142')});db[_0x1293('0x118')]['belongsToMany'](db[_0x1293('0x5e')],{'as':_0x1293('0x143'),'through':_0x1293('0x144')});db['User'][_0x1293('0x12b')](db['SmsAccount'],{'as':_0x1293('0x145'),'through':_0x1293('0x146')});db[_0x1293('0x118')][_0x1293('0x12b')](db[_0x1293('0x107')],{'as':_0x1293('0x147'),'through':_0x1293('0x148')});db[_0x1293('0x14')][_0x1293('0x11d')](db[_0x1293('0x18')],{'as':_0x1293('0x149'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x14a')});db[_0x1293('0x16')][_0x1293('0x11d')](db[_0x1293('0x18')],{'onDelete':_0x1293('0x11a')});db[_0x1293('0x18')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':'cascade'});db[_0x1293('0x1a')]['belongsToMany'](db[_0x1293('0x14b')],{'as':_0x1293('0x14c'),'through':_0x1293('0x14d')});db[_0x1293('0x1d')][_0x1293('0x11d')](db[_0x1293('0x2d')],{'as':'Members','foreignKey':_0x1293('0x14e')});db[_0x1293('0x1d')][_0x1293('0x11d')](db[_0x1293('0x77')],{'as':_0x1293('0x14f'),'foreignKey':_0x1293('0x14e')});db[_0x1293('0x1d')][_0x1293('0x11d')](db[_0x1293('0x7b')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x1293('0x1d')][_0x1293('0x11d')](db[_0x1293('0x7d')],{'as':_0x1293('0x150'),'foreignKey':_0x1293('0x14e')});db[_0x1293('0x1d')][_0x1293('0x11d')](db[_0x1293('0x7f')],{'as':_0x1293('0x7f'),'foreignKey':_0x1293('0x14e')});db[_0x1293('0x1d')][_0x1293('0x11d')](db['CmHopperBlack'],{'as':_0x1293('0x151'),'foreignKey':_0x1293('0x14e')});db[_0x1293('0x1d')]['hasMany'](db[_0x1293('0xe0')],{'as':_0x1293('0x152'),'foreignKey':_0x1293('0x14e')});db[_0x1293('0x1d')][_0x1293('0x127')](db[_0x1293('0x2b')],{'as':'Trunk','foreignKey':_0x1293('0x153')});db[_0x1293('0x1d')][_0x1293('0x127')](db[_0x1293('0x2b')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x1293('0x1d')][_0x1293('0x127')](db['Interval'],{'as':'Interval','foreignKey':_0x1293('0x154')});db[_0x1293('0x1d')][_0x1293('0x127')](db['Pause'],{'as':_0x1293('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1293('0x1d')]['belongsToMany'](db[_0x1293('0x100')],{'as':'Lists','through':_0x1293('0x156')});db['VoiceQueue']['belongsToMany'](db[_0x1293('0x118')],{'as':'Agents','through':_0x1293('0x2e')});db['VoiceQueue'][_0x1293('0x12b')](db[_0x1293('0xef')],{'as':_0x1293('0x157'),'through':'TeamVoiceQueue'});db[_0x1293('0x1d')]['belongsToMany'](db[_0x1293('0x100')],{'as':_0x1293('0x158'),'through':'voice_queues_has_cm_blacklists'});db[_0x1293('0x1f')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':'User','foreignKey':_0x1293('0x11b')});db[_0x1293('0x21')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x118'),'foreignKey':_0x1293('0x11b')});db['VoiceMail'][_0x1293('0x11d')](db[_0x1293('0x24')],{'as':_0x1293('0x159'),'onDelete':_0x1293('0x11a'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x1293('0x24')]['belongsTo'](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x1293('0x15a')});db[_0x1293('0x15b')][_0x1293('0x11d')](db[_0x1293('0x29')],{'as':_0x1293('0x15c'),'foreignKey':_0x1293('0x15d'),'constraints':![]});db[_0x1293('0x15b')][_0x1293('0x11d')](db[_0x1293('0x15e')],{'as':_0x1293('0x15f'),'foreignKey':'uniqueid','constraints':![]});db[_0x1293('0x15b')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':'User','foreignKey':'UserId'});db[_0x1293('0x15b')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db['MailServerIn'][_0x1293('0x127')](db['MailAccount'],{'as':_0x1293('0x3f'),'foreignKey':'MailAccountId'});db[_0x1293('0x162')][_0x1293('0x127')](db[_0x1293('0x112')],{'as':_0x1293('0x112'),'foreignKey':_0x1293('0x163'),'onDelete':'restrict'});db[_0x1293('0x3d')][_0x1293('0x127')](db[_0x1293('0x3f')],{'as':_0x1293('0x3f'),'foreignKey':'MailAccountId'});db[_0x1293('0x3d')][_0x1293('0x127')](db['CloudProvider'],{'as':_0x1293('0x112'),'foreignKey':_0x1293('0x163'),'onDelete':'restrict'});db['MailAccount'][_0x1293('0x119')](db['MailServerIn'],{'as':_0x1293('0x164'),'onDelete':'cascade'});db['MailAccount'][_0x1293('0x119')](db[_0x1293('0x3d')],{'as':'Smtp','onDelete':_0x1293('0x11a')});db[_0x1293('0x3f')][_0x1293('0x11d')](db[_0x1293('0x165')],{'as':_0x1293('0x166'),'foreignKey':_0x1293('0x167'),'onDelete':_0x1293('0x11a')});db['MailAccount'][_0x1293('0x11d')](db[_0x1293('0x86')],{'as':_0x1293('0x168'),'foreignKey':_0x1293('0x167')});db[_0x1293('0x3f')][_0x1293('0x11d')](db['MailMessage'],{'as':_0x1293('0x159'),'foreignKey':_0x1293('0x167')});db[_0x1293('0x3f')][_0x1293('0x11d')](db['MailInteraction'],{'as':_0x1293('0x169')});db['MailAccount'][_0x1293('0x11d')](db[_0x1293('0x47')],{'as':'Applications'});db[_0x1293('0x3f')][_0x1293('0x127')](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x3f')][_0x1293('0x127')](db[_0x1293('0x9a')],{'as':_0x1293('0x9a'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db[_0x1293('0x8c')],{'as':_0x1293('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x142')});db[_0x1293('0x41')]['belongsToMany'](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x32')});db[_0x1293('0x41')][_0x1293('0x12b')](db[_0x1293('0xef')],{'through':_0x1293('0x16d'),'as':_0x1293('0x157')});db[_0x1293('0x44')]['hasMany'](db['MailMessage'],{'as':_0x1293('0x159'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x16e')});db[_0x1293('0x44')][_0x1293('0x127')](db['MailAccount'],{'as':_0x1293('0x16f'),'foreignKey':'MailAccountId'});db[_0x1293('0x44')][_0x1293('0x127')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x1293('0x44')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x170'),'foreignKey':'UserId'});db[_0x1293('0x44')][_0x1293('0x12b')](db[_0x1293('0x92')],{'through':_0x1293('0x171'),'as':_0x1293('0x172')});db[_0x1293('0x44')]['belongsToMany'](db['Tag'],{'through':_0x1293('0x171'),'as':'ThroughTags'});db[_0x1293('0x44')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x173'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage'][_0x1293('0x11d')](db[_0x1293('0x174')],{'as':_0x1293('0x175'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x45')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':'User'});db[_0x1293('0x45')][_0x1293('0x127')](db[_0x1293('0x75')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x160')});db[_0x1293('0x45')]['belongsTo'](db[_0x1293('0x44')],{'as':_0x1293('0x176'),'foreignKey':_0x1293('0x16e')});db[_0x1293('0x45')][_0x1293('0x127')](db[_0x1293('0x3f')],{'as':'Account','foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x1293('0x65'),'foreignKey':_0x1293('0x177')});db['MailMessage'][_0x1293('0x127')](db['ChatOfflineMessage'],{'as':_0x1293('0x178'),'foreignKey':'ChatOfflineMessageId'});db[_0x1293('0x47')][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':_0x1293('0x179')});db[_0x1293('0x47')][_0x1293('0x127')](db[_0x1293('0x41')],{'onDelete':_0x1293('0x179')});db['MailApplication'][_0x1293('0x127')](db['MailAccount'],{'onDelete':_0x1293('0x179')});db[_0x1293('0x47')][_0x1293('0x127')](db[_0x1293('0x8a')],{'onDelete':_0x1293('0x179'),'foreignKey':'IntervalId'});db['MailApplication'][_0x1293('0x127')](db[_0x1293('0x92')],{'onDelete':_0x1293('0x179'),'foreignKey':_0x1293('0x17a')});db[_0x1293('0x49')][_0x1293('0x127')](db[_0x1293('0x3f')],{});db[_0x1293('0x49')][_0x1293('0x127')](db[_0x1293('0x100')],{'as':'List','foreignKey':_0x1293('0x16b')});db['MailQueueReport'][_0x1293('0x127')](db['CmContact'],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db['MailQueueReport'][_0x1293('0x127')](db[_0x1293('0x44')],{});db['MailQueueReport'][_0x1293('0x127')](db[_0x1293('0x45')],{});db[_0x1293('0x49')][_0x1293('0x127')](db['User'],{});db[_0x1293('0x49')]['belongsTo'](db[_0x1293('0x41')],{});db[_0x1293('0x17b')][_0x1293('0x11d')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0x1293('0x13e')][_0x1293('0x11d')](db['Disposition'],{'as':_0x1293('0x166'),'foreignKey':_0x1293('0x17c'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x13e')][_0x1293('0x11d')](db[_0x1293('0x86')],{'as':_0x1293('0x168'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x1293('0x11d')](db[_0x1293('0x50')],{'as':'Interactions'});db['FaxAccount'][_0x1293('0x11d')](db[_0x1293('0x4e')],{'as':_0x1293('0x17d')});db[_0x1293('0x13e')]['hasMany'](db[_0x1293('0x18')],{'as':_0x1293('0x17e'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x13e')]['hasMany'](db[_0x1293('0x52')],{'as':_0x1293('0x159')});db['FaxAccount'][_0x1293('0x127')](db[_0x1293('0x2b')],{'as':_0x1293('0x2b')});db[_0x1293('0x13e')][_0x1293('0x127')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x1293('0x13e')]['belongsTo'](db[_0x1293('0x8c')],{'as':_0x1293('0x155'),'foreignKey':_0x1293('0x17f')});db['FaxAccount']['belongsToMany'](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x140')});db['FaxApplication'][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':'restrict'});db[_0x1293('0x4e')][_0x1293('0x127')](db[_0x1293('0x54')],{'onDelete':'restrict'});db[_0x1293('0x4e')]['belongsTo'](db[_0x1293('0x13e')],{'onDelete':_0x1293('0x179')});db[_0x1293('0x4e')]['belongsTo'](db['Tag'],{'onDelete':_0x1293('0x179'),'foreignKey':'TagId'});db['FaxInteraction'][_0x1293('0x11d')](db[_0x1293('0x52')],{'as':'Messages','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x180')});db[_0x1293('0x50')][_0x1293('0x127')](db[_0x1293('0x13e')],{'as':_0x1293('0x16f'),'foreignKey':'FaxAccountId'});db[_0x1293('0x50')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db['FaxInteraction'][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x170'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x50')]['belongsToMany'](db['Tag'],{'through':_0x1293('0x181'),'as':'Tags'});db[_0x1293('0x50')]['belongsToMany'](db['Tag'],{'through':_0x1293('0x181'),'as':'ThroughTags'});db[_0x1293('0x50')][_0x1293('0x12b')](db['User'],{'as':_0x1293('0x173'),'through':'user_has_fax_interactions','foreignKey':_0x1293('0x180')});db[_0x1293('0x52')][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x118')});db[_0x1293('0x52')][_0x1293('0x127')](db[_0x1293('0x50')],{'as':_0x1293('0x176'),'foreignKey':_0x1293('0x180')});db[_0x1293('0x52')][_0x1293('0x127')](db[_0x1293('0x75')],{'onDelete':'cascade','as':_0x1293('0x160')});db[_0x1293('0x52')]['belongsTo'](db[_0x1293('0x174')],{'as':_0x1293('0x174'),'foreignKey':_0x1293('0x182')});db['FaxMessage'][_0x1293('0x127')](db[_0x1293('0x13e')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x34')});db['FaxQueue']['belongsToMany'](db[_0x1293('0xef')],{'through':_0x1293('0x183'),'as':_0x1293('0x157')});db[_0x1293('0x56')][_0x1293('0x127')](db[_0x1293('0x13e')],{});db[_0x1293('0x56')]['belongsTo'](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x56')][_0x1293('0x127')](db[_0x1293('0x50')],{});db['FaxQueueReport'][_0x1293('0x127')](db[_0x1293('0x52')],{});db[_0x1293('0x56')][_0x1293('0x127')](db[_0x1293('0x118')],{});db[_0x1293('0x56')]['belongsTo'](db[_0x1293('0x54')],{});db[_0x1293('0x184')][_0x1293('0x11d')](db[_0x1293('0x165')],{'as':_0x1293('0x166'),'foreignKey':_0x1293('0x185'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x184')][_0x1293('0x11d')](db[_0x1293('0x86')],{'as':_0x1293('0x168'),'foreignKey':_0x1293('0x185')});db[_0x1293('0x184')][_0x1293('0x11d')](db[_0x1293('0x5b')],{'as':_0x1293('0x159'),'foreignKey':_0x1293('0x185')});db[_0x1293('0x184')][_0x1293('0x11d')](db[_0x1293('0x5a')],{'as':_0x1293('0x169')});db['SmsAccount'][_0x1293('0x11d')](db[_0x1293('0x58')],{'as':'Applications'});db[_0x1293('0x184')][_0x1293('0x127')](db[_0x1293('0x100')],{'as':'List','foreignKey':_0x1293('0x16b')});db['SmsAccount'][_0x1293('0x127')](db[_0x1293('0x8c')],{'as':_0x1293('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount']['belongsToMany'](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x146')});db['SmsApplication'][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db['SmsQueue'],{'onDelete':_0x1293('0x179')});db[_0x1293('0x58')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x1293('0x179')});db['SmsApplication'][_0x1293('0x127')](db[_0x1293('0x8a')],{'onDelete':_0x1293('0x179'),'foreignKey':_0x1293('0x154')});db['SmsApplication']['belongsTo'](db[_0x1293('0x92')],{'onDelete':_0x1293('0x179'),'foreignKey':'TagId'});db[_0x1293('0x5a')][_0x1293('0x11d')](db[_0x1293('0x5b')],{'as':'Messages','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x186')});db[_0x1293('0x5a')][_0x1293('0x127')](db[_0x1293('0x184')],{'as':_0x1293('0x16f'),'foreignKey':_0x1293('0x185')});db[_0x1293('0x5a')]['belongsTo'](db[_0x1293('0x75')],{'as':'Contact','foreignKey':_0x1293('0x161')});db[_0x1293('0x5a')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x170'),'foreignKey':'UserId'});db['SmsInteraction'][_0x1293('0x12b')](db[_0x1293('0x92')],{'through':_0x1293('0x187'),'as':_0x1293('0x172')});db[_0x1293('0x5a')]['belongsToMany'](db[_0x1293('0x92')],{'through':'sms_interaction_has_tags','as':_0x1293('0x188')});db[_0x1293('0x5a')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x173'),'through':_0x1293('0x133'),'foreignKey':'SmsInteractionId'});db[_0x1293('0x5b')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':'User'});db[_0x1293('0x5b')][_0x1293('0x127')](db[_0x1293('0x75')],{'onDelete':_0x1293('0x11a'),'as':'Contact'});db['SmsMessage']['belongsTo'](db[_0x1293('0x5a')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x176'),'foreignKey':'SmsInteractionId'});db[_0x1293('0x5b')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x1293('0x185')});db[_0x1293('0x5c')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':'UserSmsQueue','foreignKey':_0x1293('0x189')});db[_0x1293('0x5c')][_0x1293('0x12b')](db['Team'],{'through':_0x1293('0x18a'),'as':_0x1293('0x157')});db[_0x1293('0x5e')][_0x1293('0x11d')](db[_0x1293('0x165')],{'as':_0x1293('0x166'),'foreignKey':_0x1293('0x18b'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x5e')][_0x1293('0x11d')](db[_0x1293('0x86')],{'as':_0x1293('0x168'),'foreignKey':_0x1293('0x18b')});db[_0x1293('0x5e')][_0x1293('0x11d')](db[_0x1293('0x61')],{'as':_0x1293('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x1293('0x5e')]['hasMany'](db['OpenchannelMessage'],{'as':_0x1293('0x159'),'foreignKey':_0x1293('0x18b')});db['OpenchannelAccount'][_0x1293('0x11d')](db['OpenchannelApplication'],{'as':_0x1293('0x17d'),'foreignKey':_0x1293('0x18b')});db[_0x1293('0x5e')][_0x1293('0x127')](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x5e')][_0x1293('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x1293('0x17f')});db[_0x1293('0x5e')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':'user_has_openchannel_accounts'});db[_0x1293('0x60')][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':_0x1293('0x179')});db[_0x1293('0x60')][_0x1293('0x127')](db[_0x1293('0x13a')],{'onDelete':_0x1293('0x179'),'foreignKey':_0x1293('0x18c')});db['OpenchannelApplication'][_0x1293('0x127')](db[_0x1293('0x5e')],{'onDelete':_0x1293('0x179'),'foreignKey':_0x1293('0x18b')});db[_0x1293('0x60')][_0x1293('0x127')](db[_0x1293('0x8a')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x1293('0x60')][_0x1293('0x127')](db[_0x1293('0x92')],{'onDelete':_0x1293('0x179'),'foreignKey':_0x1293('0x17a')});db[_0x1293('0x61')][_0x1293('0x11d')](db[_0x1293('0x62')],{'as':_0x1293('0x159'),'onDelete':'cascade','foreignKey':_0x1293('0x18d')});db['OpenchannelInteraction'][_0x1293('0x127')](db[_0x1293('0x5e')],{'as':_0x1293('0x16f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x61')]['belongsTo'](db['User'],{'as':_0x1293('0x170'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x61')][_0x1293('0x12b')](db[_0x1293('0x92')],{'through':_0x1293('0x18e'),'as':_0x1293('0x172')});db[_0x1293('0x61')][_0x1293('0x12b')](db[_0x1293('0x92')],{'through':_0x1293('0x18e'),'as':_0x1293('0x188')});db[_0x1293('0x61')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x173'),'through':_0x1293('0x134'),'foreignKey':'OpenchannelInteractionId'});db[_0x1293('0x62')][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':'cascade','as':_0x1293('0x118')});db[_0x1293('0x62')][_0x1293('0x127')](db[_0x1293('0x75')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x160')});db[_0x1293('0x62')][_0x1293('0x127')](db[_0x1293('0x61')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x176'),'foreignKey':_0x1293('0x18d')});db[_0x1293('0x62')]['belongsTo'](db[_0x1293('0x174')],{'as':'Attachment','foreignKey':_0x1293('0x182')});db[_0x1293('0x62')]['belongsTo'](db[_0x1293('0x5e')],{'as':_0x1293('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0x1293('0x13a')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x38'),'foreignKey':_0x1293('0x18c')});db[_0x1293('0x13a')][_0x1293('0x12b')](db[_0x1293('0xef')],{'through':_0x1293('0x18f'),'as':_0x1293('0x157')});db[_0x1293('0x65')][_0x1293('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db['ChatWebsite']['hasMany'](db[_0x1293('0x86')],{'as':'Answers','foreignKey':_0x1293('0x177')});db[_0x1293('0x65')][_0x1293('0x11d')](db[_0x1293('0x190')],{'as':_0x1293('0x191')});db['ChatWebsite'][_0x1293('0x11d')](db[_0x1293('0x6b')],{'as':'Interactions'});db['ChatWebsite']['hasMany'](db['ChatApplication'],{'as':'Applications'});db[_0x1293('0x65')][_0x1293('0x11d')](db[_0x1293('0x6d')],{'as':_0x1293('0x159')});db[_0x1293('0x65')]['belongsTo'](db['CmList'],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x65')][_0x1293('0x127')](db[_0x1293('0x8a')],{'as':_0x1293('0x8a'),'foreignKey':'IntervalId'});db[_0x1293('0x65')][_0x1293('0x127')](db[_0x1293('0x3f')],{'as':_0x1293('0x3f'),'foreignKey':_0x1293('0x167')});db[_0x1293('0x65')][_0x1293('0x127')](db[_0x1293('0x8c')],{'as':_0x1293('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x1293('0x67')][_0x1293('0x127')](db[_0x1293('0x5e')],{});db[_0x1293('0x67')]['belongsTo'](db[_0x1293('0x100')],{'as':'List','foreignKey':_0x1293('0x16b')});db['OpenchannelQueueReport'][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':'ContactId'});db[_0x1293('0x67')][_0x1293('0x127')](db['OpenchannelInteraction'],{});db[_0x1293('0x67')][_0x1293('0x127')](db[_0x1293('0x62')],{});db[_0x1293('0x67')][_0x1293('0x127')](db[_0x1293('0x118')],{});db[_0x1293('0x67')][_0x1293('0x127')](db[_0x1293('0x13a')],{});db['ChatApplication']['belongsTo'](db[_0x1293('0x118')],{'as':_0x1293('0x192'),'foreignKey':'UserId','onDelete':_0x1293('0x179')});db['ChatApplication'][_0x1293('0x127')](db[_0x1293('0x70')],{'as':_0x1293('0x193'),'foreignKey':'ChatQueueId','onDelete':_0x1293('0x179')});db[_0x1293('0x69')]['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x1293('0x177'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x1293('0x92')],{'onDelete':_0x1293('0x179'),'foreignKey':_0x1293('0x17a')});db[_0x1293('0x6b')]['hasMany'](db[_0x1293('0x6d')],{'as':_0x1293('0x159'),'onDelete':_0x1293('0x11a'),'foreignKey':'ChatInteractionId'});db[_0x1293('0x6b')][_0x1293('0x127')](db[_0x1293('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x1293('0x6b')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':'ContactId'});db[_0x1293('0x6b')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x170'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x6b')][_0x1293('0x12b')](db['Tag'],{'through':_0x1293('0x194'),'as':_0x1293('0x172')});db[_0x1293('0x6b')][_0x1293('0x12b')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x1293('0x188')});db[_0x1293('0x6b')][_0x1293('0x12b')](db['User'],{'as':_0x1293('0x173'),'through':_0x1293('0x132'),'foreignKey':_0x1293('0x195')});db['ChatMessage']['belongsTo'](db[_0x1293('0x118')],{'onDelete':_0x1293('0x11a'),'as':'User'});db[_0x1293('0x6d')]['belongsTo'](db[_0x1293('0x75')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x160'),'foreignKey':'ContactId'});db[_0x1293('0x6d')]['belongsTo'](db[_0x1293('0x6b')],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x176'),'foreignKey':_0x1293('0x195')});db[_0x1293('0x6d')][_0x1293('0x127')](db[_0x1293('0x174')],{'as':_0x1293('0x174'),'foreignKey':'AttachmentId'});db[_0x1293('0x6d')][_0x1293('0x127')](db[_0x1293('0x65')],{'as':_0x1293('0x16f'),'foreignKey':_0x1293('0x177')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0x1293('0x175'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x1293('0x11a'),'hooks':!![]});db[_0x1293('0x178')][_0x1293('0x127')](db['CmContact'],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x160'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x1293('0x127')](db[_0x1293('0x65')],{'as':'Account','foreignKey':_0x1293('0x177')});db['ChatQueue'][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':'Agents','through':_0x1293('0x30'),'hooks':!![]});db[_0x1293('0x70')][_0x1293('0x12b')](db[_0x1293('0xef')],{'through':_0x1293('0x196'),'as':'Teams'});db['ChatGroup'][_0x1293('0x11d')](db[_0x1293('0xdc')],{'as':_0x1293('0x159'),'foreignKey':_0x1293('0x197'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x72')]['belongsToMany'](db[_0x1293('0x118')],{'as':_0x1293('0x198'),'through':_0x1293('0x12a')});db[_0x1293('0x190')][_0x1293('0x127')](db[_0x1293('0x65')],{'as':_0x1293('0x199'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x1293('0x11d')](db[_0x1293('0x75')],{'as':_0x1293('0x12c'),'foreignKey':_0x1293('0x19a')});db[_0x1293('0x75')][_0x1293('0x11d')](db['CmContactHasItem'],{'as':_0x1293('0x19b'),'foreignKey':'CmContactId'});db[_0x1293('0x75')][_0x1293('0x11d')](db[_0x1293('0x77')],{'as':_0x1293('0x14f'),'foreignKey':_0x1293('0x161')});db['CmContact'][_0x1293('0x11d')](db['CmHopperFinal'],{'as':_0x1293('0x11f'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x75')]['hasMany'](db[_0x1293('0x7d')],{'as':_0x1293('0x150'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x75')]['hasMany'](db[_0x1293('0x7f')],{'as':_0x1293('0x7f'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x75')][_0x1293('0x11d')](db[_0x1293('0xe0')],{'as':_0x1293('0x152'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x75')][_0x1293('0x11d')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x1293('0x75')][_0x1293('0x11d')](db[_0x1293('0x6b')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x1293('0x11d')](db['SmsInteraction'],{'as':_0x1293('0x122'),'foreignKey':'ContactId','onDelete':_0x1293('0x179')});db[_0x1293('0x75')]['hasMany'](db[_0x1293('0x50')],{'as':_0x1293('0x123'),'foreignKey':_0x1293('0x161'),'onDelete':_0x1293('0x179')});db[_0x1293('0x75')][_0x1293('0x11d')](db[_0x1293('0x44')],{'as':'MailInteractions','foreignKey':_0x1293('0x161'),'onDelete':_0x1293('0x179')});db[_0x1293('0x75')][_0x1293('0x127')](db[_0x1293('0x19c')],{'as':_0x1293('0x19d'),'foreignKey':_0x1293('0x19a')});db[_0x1293('0x75')][_0x1293('0x127')](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x75')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':'Users','through':_0x1293('0x12d')});db['CmContact'][_0x1293('0x12b')](db[_0x1293('0x92')],{'as':_0x1293('0x172'),'through':'cm_contact_has_tags'});db[_0x1293('0x75')]['belongsToMany'](db[_0x1293('0x92')],{'through':_0x1293('0x19e'),'as':_0x1293('0x188')});db[_0x1293('0x77')][_0x1293('0x11d')](db['CmHopperAdditionalPhone'],{'as':_0x1293('0x19f'),'foreignKey':'CmHopperId'});db[_0x1293('0x77')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0x1293('0x127')](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b'),'onDelete':'cascade'});db[_0x1293('0x77')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x192'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x77')][_0x1293('0x127')](db[_0x1293('0x1d')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x1293('0x77')][_0x1293('0x127')](db['Campaign'],{'as':_0x1293('0xf3'),'foreignKey':_0x1293('0x1a0'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x77')]['belongsTo'](db[_0x1293('0x118')],{'as':_0x1293('0x170'),'foreignKey':_0x1293('0x1a1')});db[_0x1293('0x79')][_0x1293('0x127')](db['CmContact'],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x79')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x1293('0x16b'),'onDelete':_0x1293('0x11a')});db['CmHopperBlack'][_0x1293('0x127')](db[_0x1293('0x1d')],{'as':_0x1293('0x193'),'foreignKey':'VoiceQueueId','onDelete':_0x1293('0x11a')});db[_0x1293('0x79')][_0x1293('0x127')](db['Campaign'],{'as':'Campaign','foreignKey':_0x1293('0x1a0'),'onDelete':'cascade'});db[_0x1293('0x1a2')][_0x1293('0x11d')](db[_0x1293('0x88')],{'as':{'plural':_0x1293('0x1a3'),'singular':_0x1293('0x1a4')},'foreignKey':_0x1293('0x1a5'),'onDelete':_0x1293('0x11a'),'hooks':!![]});db[_0x1293('0x1a2')]['hasMany'](db[_0x1293('0x88')],{'as':{'plural':'Any','singular':_0x1293('0x1a6')},'foreignKey':_0x1293('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x1293('0x1a2')][_0x1293('0x11d')](db[_0x1293('0x83')],{'as':'Actions','foreignKey':_0x1293('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x1293('0x165')][_0x1293('0x11d')](db[_0x1293('0x165')],{'as':_0x1293('0x166'),'foreignKey':_0x1293('0x1a9'),'onDelete':'cascade'});db['Interval'][_0x1293('0x11d')](db['Interval'],{'as':'Intervals','foreignKey':_0x1293('0x154'),'onDelete':_0x1293('0x11a'),'hooks':!![],'required':![]});db['Interval'][_0x1293('0x11d')](db[_0x1293('0x18')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x1293('0x179')});db[_0x1293('0x8a')][_0x1293('0x11d')](db['MailApplication'],{'as':_0x1293('0x1aa'),'foreignKey':_0x1293('0x154')});db[_0x1293('0x8a')][_0x1293('0x11d')](db[_0x1293('0x69')],{'as':_0x1293('0x1ab'),'foreignKey':_0x1293('0x154')});db[_0x1293('0x8a')][_0x1293('0x11d')](db['FaxApplication'],{'as':_0x1293('0x1ac'),'foreignKey':_0x1293('0x154')});db['Interval'][_0x1293('0x11d')](db[_0x1293('0x58')],{'as':_0x1293('0x1ad'),'foreignKey':'IntervalId'});db[_0x1293('0x90')][_0x1293('0x127')](db['MailAccount'],{});db[_0x1293('0x90')][_0x1293('0x127')](db[_0x1293('0xa3')],{'foreignKey':_0x1293('0x1ae')});db[_0x1293('0x90')][_0x1293('0x127')](db['AnalyticCustomReport'],{'foreignKey':_0x1293('0x1af')});db[_0x1293('0x14b')]['belongsToMany'](db[_0x1293('0x1a')],{'as':_0x1293('0x1b0'),'through':_0x1293('0x14d'),'onDelete':_0x1293('0x179')});db[_0x1293('0x92')][_0x1293('0x12b')](db['CmContact'],{'through':'cm_contact_has_tags'});db['Tag'][_0x1293('0x12b')](db[_0x1293('0x6b')],{'through':_0x1293('0x194')});db[_0x1293('0x92')][_0x1293('0x12b')](db['MailInteraction'],{'through':_0x1293('0x171')});db['Tag'][_0x1293('0x12b')](db[_0x1293('0x5a')],{'through':_0x1293('0x187')});db[_0x1293('0x92')][_0x1293('0x12b')](db[_0x1293('0x50')],{'through':'fax_interaction_has_tags'});db[_0x1293('0x92')]['belongsToMany'](db[_0x1293('0x61')],{'through':'openchannel_interaction_has_tags'});db[_0x1293('0x92')][_0x1293('0x12b')](db[_0x1293('0x10b')],{'through':_0x1293('0x1b1')});db[_0x1293('0x96')][_0x1293('0x127')](db['ContactItemType'],{'as':_0x1293('0x1b2'),'foreignKey':_0x1293('0x1b3')});db[_0x1293('0x98')]['belongsTo'](db[_0x1293('0x77')],{'as':_0x1293('0x1b4'),'foreignKey':_0x1293('0x1b5')});db[_0x1293('0x96')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':'CmContactId'});db[_0x1293('0x1b6')][_0x1293('0x11d')](db[_0x1293('0x88')],{'as':{'plural':_0x1293('0x1b7'),'singular':_0x1293('0x1b8')},'foreignKey':_0x1293('0x1b9'),'onDelete':_0x1293('0x11a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x1293('0x88')],{'as':{'plural':_0x1293('0x1ba'),'singular':_0x1293('0x1bb')},'foreignKey':_0x1293('0x1bc'),'onDelete':_0x1293('0x11a'),'hooks':!![]});db['Trigger'][_0x1293('0x11d')](db['Action'],{'as':_0x1293('0x1bd'),'foreignKey':_0x1293('0x1be'),'onDelete':'cascade','hooks':!![]});db[_0x1293('0xa1')][_0x1293('0x11d')](db['AnalyticFieldReport'],{'as':_0x1293('0x1bf'),'onDelete':'cascade','foreignKey':_0x1293('0x1af'),'hooks':!![]});db['AnalyticDefaultReport'][_0x1293('0x11d')](db[_0x1293('0x1c0')],{'as':'Fields','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1ae')});db[_0x1293('0xa7')][_0x1293('0x11d')](db[_0x1293('0x1c0')],{'as':_0x1293('0x1bf'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c1')});db['AnalyticFieldReport'][_0x1293('0x127')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x1293('0xac')][_0x1293('0x11d')](db[_0x1293('0xae')],{'as':_0x1293('0x1c2'),'onDelete':'cascade','foreignKey':_0x1293('0x1c3')});db['SalesforceConfiguration']['hasMany'](db[_0x1293('0xaf')],{'as':'Subjects','onDelete':_0x1293('0x11a'),'foreignKey':'SubjectId'});db[_0x1293('0xae')]['hasMany'](db[_0x1293('0xaf')],{'as':'Descriptions','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c4')});db[_0x1293('0xae')][_0x1293('0x11d')](db[_0x1293('0xaf')],{'as':_0x1293('0x1bf'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xae')][_0x1293('0x127')](db[_0x1293('0xac')],{'as':_0x1293('0x16f'),'foreignKey':'AccountId'});db[_0x1293('0xaf')][_0x1293('0x11d')](db['SalesforceField'],{'as':_0x1293('0x1c6'),'foreignKey':'SubjectId'});db[_0x1293('0xaf')]['hasMany'](db[_0x1293('0xaf')],{'as':_0x1293('0x1c7'),'foreignKey':'DescriptionId'});db[_0x1293('0xaf')][_0x1293('0x11d')](db[_0x1293('0xaf')],{'as':_0x1293('0x1c8'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xaf')][_0x1293('0x127')](db['Variable'],{'as':'Variable','foreignKey':_0x1293('0x1c9')});db['SugarcrmAccount'][_0x1293('0x11d')](db[_0x1293('0xb2')],{'as':_0x1293('0x1c2'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xb2')][_0x1293('0x11d')](db[_0x1293('0x1ca')],{'as':_0x1293('0x1cb'),'onDelete':_0x1293('0x11a'),'foreignKey':'SubjectId'});db[_0x1293('0xb2')][_0x1293('0x11d')](db['SugarcrmField'],{'as':_0x1293('0x1cc'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c4')});db['SugarcrmConfiguration']['hasMany'](db[_0x1293('0x1ca')],{'as':_0x1293('0x1bf'),'onDelete':'cascade','foreignKey':_0x1293('0x1c5')});db['SugarcrmConfiguration'][_0x1293('0x127')](db[_0x1293('0xb0')],{'as':'Account','foreignKey':_0x1293('0x1c3')});db[_0x1293('0x1ca')][_0x1293('0x11d')](db['SugarcrmField'],{'as':_0x1293('0x1c6'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0x1ca')][_0x1293('0x11d')](db['SugarcrmField'],{'as':_0x1293('0x1c7'),'foreignKey':_0x1293('0x1c4')});db[_0x1293('0x1ca')][_0x1293('0x11d')](db[_0x1293('0x1ca')],{'as':'Field','foreignKey':_0x1293('0x1c5')});db[_0x1293('0x1ca')]['belongsTo'](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':'VariableId'});db[_0x1293('0x1ce')][_0x1293('0x11d')](db[_0x1293('0x1cf')],{'as':_0x1293('0x1c2'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0x1cf')][_0x1293('0x11d')](db[_0x1293('0xb7')],{'as':'Subjects','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0x1cf')][_0x1293('0x11d')](db[_0x1293('0xb7')],{'as':_0x1293('0x1cc'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c4')});db['DeskConfiguration'][_0x1293('0x11d')](db['DeskField'],{'as':_0x1293('0x1bf'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x1293('0x1cf')]['belongsTo'](db[_0x1293('0x1ce')],{'as':_0x1293('0x16f'),'foreignKey':'AccountId'});db[_0x1293('0x1cf')][_0x1293('0x12b')](db[_0x1293('0x92')],{'through':'int_desk_configuration_has_tags'});db[_0x1293('0xb7')]['hasMany'](db[_0x1293('0xb7')],{'as':'Subject','foreignKey':_0x1293('0x1cd')});db[_0x1293('0xb7')][_0x1293('0x11d')](db['DeskField'],{'as':_0x1293('0x1c7'),'foreignKey':'DescriptionId'});db[_0x1293('0xb7')][_0x1293('0x11d')](db[_0x1293('0xb7')],{'as':'Field','foreignKey':_0x1293('0x1c5')});db[_0x1293('0xb7')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x1293('0x1c9')});db['ZohoAccount'][_0x1293('0x11d')](db[_0x1293('0xba')],{'as':'Configurations','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xba')][_0x1293('0x11d')](db[_0x1293('0xbc')],{'as':_0x1293('0x1cb'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xba')]['hasMany'](db[_0x1293('0xbc')],{'as':_0x1293('0x1cc'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c4')});db['ZohoConfiguration'][_0x1293('0x11d')](db[_0x1293('0xbc')],{'as':_0x1293('0x1bf'),'onDelete':_0x1293('0x11a'),'foreignKey':'FieldId'});db[_0x1293('0xba')][_0x1293('0x127')](db['ZohoAccount'],{'as':_0x1293('0x16f'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xbc')][_0x1293('0x11d')](db[_0x1293('0xbc')],{'as':'Subject','foreignKey':_0x1293('0x1cd')});db[_0x1293('0xbc')][_0x1293('0x11d')](db[_0x1293('0xbc')],{'as':_0x1293('0x1c7'),'foreignKey':_0x1293('0x1c4')});db[_0x1293('0xbc')][_0x1293('0x11d')](db['ZohoField'],{'as':_0x1293('0x1c8'),'foreignKey':'FieldId'});db[_0x1293('0xbc')][_0x1293('0x127')](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':_0x1293('0x1c9')});db[_0x1293('0xbd')][_0x1293('0x11d')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xbf')][_0x1293('0x11d')](db[_0x1293('0xc0')],{'as':_0x1293('0x1cb'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xbf')][_0x1293('0x11d')](db['ZendeskField'],{'as':_0x1293('0x1cc'),'foreignKey':_0x1293('0x1c4')});db[_0x1293('0xbf')][_0x1293('0x11d')](db[_0x1293('0xc0')],{'as':_0x1293('0x1bf'),'foreignKey':'FieldId'});db[_0x1293('0xbf')][_0x1293('0x127')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x1293('0x1c3')});db[_0x1293('0xbf')]['belongsToMany'](db[_0x1293('0x92')],{'through':_0x1293('0x1d0')});db['ZendeskField'][_0x1293('0x11d')](db[_0x1293('0xc0')],{'as':'Subject','foreignKey':_0x1293('0x1cd')});db[_0x1293('0xc0')][_0x1293('0x11d')](db['ZendeskField'],{'as':'Description','foreignKey':_0x1293('0x1c4')});db[_0x1293('0xc0')]['hasMany'](db[_0x1293('0xc0')],{'as':_0x1293('0x1c8'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xc0')][_0x1293('0x127')](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':_0x1293('0x1c9')});db[_0x1293('0xc1')]['hasMany'](db[_0x1293('0xc3')],{'as':_0x1293('0x1c2'),'onDelete':'cascade','foreignKey':_0x1293('0x1c3')});db[_0x1293('0xc3')]['hasMany'](db[_0x1293('0xc5')],{'as':_0x1293('0x1cb'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xc3')][_0x1293('0x11d')](db['FreshdeskField'],{'as':_0x1293('0x1cc'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c4')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x1293('0x1bf'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xc3')][_0x1293('0x127')](db['FreshdeskAccount'],{'as':_0x1293('0x16f'),'foreignKey':'AccountId'});db[_0x1293('0xc3')]['belongsToMany'](db[_0x1293('0x92')],{'through':_0x1293('0x1d1')});db[_0x1293('0xc5')][_0x1293('0x11d')](db[_0x1293('0xc5')],{'as':'Subject','foreignKey':_0x1293('0x1cd')});db[_0x1293('0xc5')][_0x1293('0x11d')](db[_0x1293('0xc5')],{'as':_0x1293('0x1c7'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x1293('0x1c5')});db[_0x1293('0xc5')][_0x1293('0x127')](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':_0x1293('0x1c9')});db[_0x1293('0xc6')][_0x1293('0x11d')](db[_0x1293('0x1d2')],{'as':_0x1293('0x1c2'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0x1d2')][_0x1293('0x11d')](db[_0x1293('0xc9')],{'as':_0x1293('0x1cb'),'foreignKey':_0x1293('0x1cd')});db['VtigerConfiguration'][_0x1293('0x11d')](db[_0x1293('0xc9')],{'as':_0x1293('0x1cc'),'foreignKey':_0x1293('0x1c4')});db[_0x1293('0x1d2')][_0x1293('0x11d')](db['VtigerField'],{'as':_0x1293('0x1bf'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0x1d2')][_0x1293('0x127')](db[_0x1293('0xc6')],{'as':_0x1293('0x16f'),'foreignKey':'AccountId'});db[_0x1293('0xc9')]['hasMany'](db[_0x1293('0xc9')],{'as':_0x1293('0x1c6'),'foreignKey':'SubjectId'});db[_0x1293('0xc9')]['hasMany'](db[_0x1293('0xc9')],{'as':_0x1293('0x1c7'),'foreignKey':_0x1293('0x1c4')});db['VtigerField'][_0x1293('0x11d')](db[_0x1293('0xc9')],{'as':_0x1293('0x1c8'),'foreignKey':'FieldId'});db[_0x1293('0xc9')][_0x1293('0x127')](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':_0x1293('0x1c9')});db[_0x1293('0xcb')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x1293('0x1c2'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xcc')][_0x1293('0x11d')](db[_0x1293('0xcd')],{'as':'Subjects','foreignKey':_0x1293('0x1cd')});db['ServicenowConfiguration'][_0x1293('0x11d')](db[_0x1293('0xcd')],{'as':_0x1293('0x1cc'),'foreignKey':'DescriptionId'});db[_0x1293('0xcc')][_0x1293('0x11d')](db[_0x1293('0xcd')],{'as':_0x1293('0x1bf'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xcc')][_0x1293('0x127')](db[_0x1293('0xcb')],{'as':_0x1293('0x16f'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xcd')]['hasMany'](db['ServicenowField'],{'as':_0x1293('0x1c6'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xcd')][_0x1293('0x11d')](db[_0x1293('0xcd')],{'as':_0x1293('0x1c7'),'foreignKey':_0x1293('0x1c4')});db['ServicenowField'][_0x1293('0x11d')](db[_0x1293('0xcd')],{'as':'Field','foreignKey':_0x1293('0x1c5')});db[_0x1293('0xcd')][_0x1293('0x127')](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':_0x1293('0x1c9')});db[_0x1293('0xcf')][_0x1293('0x11d')](db[_0x1293('0xd1')],{'as':_0x1293('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1293('0xcf')][_0x1293('0x127')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x1293('0x163')});db['Dynamics365Configuration'][_0x1293('0x11d')](db['Dynamics365Field'],{'as':_0x1293('0x1cb'),'onDelete':'cascade','foreignKey':_0x1293('0x1cd')});db[_0x1293('0xd1')][_0x1293('0x11d')](db[_0x1293('0xd2')],{'as':_0x1293('0x1cc'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x1293('0x1bf'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xd1')][_0x1293('0x127')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x1293('0x1c3')});db[_0x1293('0xd2')]['hasMany'](db[_0x1293('0xd2')],{'as':_0x1293('0x1c6'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xd2')][_0x1293('0x11d')](db[_0x1293('0xd2')],{'as':_0x1293('0x1c7'),'foreignKey':_0x1293('0x1c4')});db[_0x1293('0xd2')]['hasMany'](db[_0x1293('0xd2')],{'as':_0x1293('0x1c8'),'foreignKey':'FieldId'});db[_0x1293('0xd2')]['belongsTo'](db[_0x1293('0x9d')],{'as':_0x1293('0x9d'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0x1293('0x11d')](db[_0x1293('0xd4')],{'as':_0x1293('0x1c2'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1c3')});db[_0x1293('0xd4')]['hasMany'](db[_0x1293('0xd6')],{'as':_0x1293('0x1cb'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xd4')][_0x1293('0x11d')](db[_0x1293('0xd6')],{'as':_0x1293('0x1cc'),'foreignKey':_0x1293('0x1c4')});db['FreshsalesConfiguration'][_0x1293('0x11d')](db[_0x1293('0xd6')],{'as':_0x1293('0x1bf'),'foreignKey':'FieldId'});db[_0x1293('0xd4')][_0x1293('0x127')](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db['FreshsalesField'][_0x1293('0x11d')](db[_0x1293('0xd6')],{'as':_0x1293('0x1c6'),'foreignKey':_0x1293('0x1cd')});db[_0x1293('0xd6')][_0x1293('0x11d')](db['FreshsalesField'],{'as':_0x1293('0x1c7'),'foreignKey':'DescriptionId'});db[_0x1293('0xd6')]['hasMany'](db['FreshsalesField'],{'as':_0x1293('0x1c8'),'foreignKey':_0x1293('0x1c5')});db[_0x1293('0xd6')]['belongsTo'](db['Variable'],{'as':_0x1293('0x9d'),'foreignKey':'VariableId'});db[_0x1293('0x1d3')][_0x1293('0x127')](db[_0x1293('0x65')],{});db[_0x1293('0x1d3')][_0x1293('0x127')](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x1d3')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1293('0x1d3')][_0x1293('0x127')](db[_0x1293('0x6b')],{});db[_0x1293('0x1d3')][_0x1293('0x127')](db[_0x1293('0x6d')],{});db[_0x1293('0x1d3')][_0x1293('0x127')](db['User'],{});db['ChatQueueReport'][_0x1293('0x127')](db[_0x1293('0x70')],{});db[_0x1293('0xdc')]['belongsTo'](db[_0x1293('0x118')],{'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1d4')});db[_0x1293('0xdc')][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1d5')});db['JscriptySessionReport']['hasMany'](db[_0x1293('0xde')],{'foreignKey':_0x1293('0x1d6'),'onDelete':_0x1293('0x11a')});db[_0x1293('0xe0')][_0x1293('0x11d')](db[_0x1293('0xdd')],{'foreignKey':_0x1293('0x1d6'),'onDelete':'cascade'});db['SmsQueueReport'][_0x1293('0x127')](db[_0x1293('0x184')],{});db['SmsQueueReport'][_0x1293('0x127')](db['CmList'],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x1d7')]['belongsTo'](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0x1293('0x127')](db[_0x1293('0x5a')],{});db[_0x1293('0x1d7')][_0x1293('0x127')](db[_0x1293('0x5b')],{});db['SmsQueueReport']['belongsTo'](db[_0x1293('0x118')],{});db[_0x1293('0x1d7')][_0x1293('0x127')](db[_0x1293('0x5c')],{});db[_0x1293('0x1d8')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x1293('0x1d9')});db[_0x1293('0x1d8')][_0x1293('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0x1293('0x1d9')});db[_0x1293('0x1d8')][_0x1293('0x11d')](db['JscriptyAnswerReport'],{'foreignKey':_0x1293('0x1d9')});db[_0x1293('0xef')]['belongsToMany'](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x130')});db[_0x1293('0xef')][_0x1293('0x12b')](db[_0x1293('0x1d')],{'through':_0x1293('0x1da'),'as':_0x1293('0x1db')});db['Team'][_0x1293('0x12b')](db[_0x1293('0x41')],{'through':'team_has_mail_queues','as':_0x1293('0x137')});db[_0x1293('0xef')][_0x1293('0x12b')](db['ChatQueue'],{'through':_0x1293('0x196'),'as':_0x1293('0x138')});db[_0x1293('0xef')][_0x1293('0x12b')](db[_0x1293('0x54')],{'through':_0x1293('0x183'),'as':_0x1293('0x139')});db['Team'][_0x1293('0x12b')](db[_0x1293('0x5c')],{'through':_0x1293('0x18a'),'as':'SmsQueues'});db[_0x1293('0xef')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x1293('0x18f'),'as':_0x1293('0x1dc')});db[_0x1293('0xef')][_0x1293('0x12b')](db[_0x1293('0x110')],{'through':_0x1293('0x1dd'),'as':_0x1293('0x13b')});db[_0x1293('0xef')][_0x1293('0x12b')](db[_0x1293('0x101')],{'through':_0x1293('0x1de'),'as':'VoicePrefixes'});db['Campaign'][_0x1293('0x11d')](db[_0x1293('0x77')],{'as':_0x1293('0x14f'),'foreignKey':'CampaignId'});db[_0x1293('0xf3')]['hasMany'](db[_0x1293('0x7b')],{'as':_0x1293('0x11f'),'foreignKey':_0x1293('0x1a0')});db[_0x1293('0xf3')][_0x1293('0x11d')](db[_0x1293('0x7d')],{'as':_0x1293('0x150'),'foreignKey':'CampaignId'});db[_0x1293('0xf3')][_0x1293('0x11d')](db[_0x1293('0x79')],{'as':_0x1293('0x151'),'foreignKey':_0x1293('0x1a0')});db[_0x1293('0xf3')][_0x1293('0x127')](db[_0x1293('0x2b')],{'as':_0x1293('0x2b'),'foreignKey':_0x1293('0x153')});db[_0x1293('0xf3')][_0x1293('0x127')](db[_0x1293('0x2b')],{'as':_0x1293('0x1df'),'foreignKey':_0x1293('0x1e0')});db[_0x1293('0xf3')][_0x1293('0x127')](db['Interval'],{'as':'Interval','foreignKey':_0x1293('0x154')});db['Campaign']['belongsTo'](db[_0x1293('0xe9')],{'as':'SquareProject','foreignKey':_0x1293('0x1e1')});db[_0x1293('0xf3')][_0x1293('0x12b')](db[_0x1293('0x100')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x1293('0xf3')][_0x1293('0x12b')](db[_0x1293('0x100')],{'as':_0x1293('0x158'),'through':_0x1293('0x1e2')});db['Attachment'][_0x1293('0x127')](db[_0x1293('0x178')],{'as':_0x1293('0x178'),'foreignKey':_0x1293('0x1e3')});db[_0x1293('0xf8')]['belongsTo'](db[_0x1293('0x45')],{});db[_0x1293('0xf8')]['belongsTo'](db[_0x1293('0x44')],{});db[_0x1293('0xf8')][_0x1293('0x127')](db['MailAccount'],{'foreignKey':_0x1293('0x1e4'),'as':_0x1293('0x1e5')});db['MailTransferReport'][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e6'),'as':_0x1293('0x1e7')});db['MailTransferReport']['belongsTo'](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e8'),'as':_0x1293('0x1e9')});db[_0x1293('0xf8')][_0x1293('0x127')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x1293('0x1ea')});db[_0x1293('0xf8')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x1293('0x1eb'),'as':_0x1293('0x1ec')});db[_0x1293('0xfa')][_0x1293('0x127')](db['ChatMessage'],{});db['ChatTransferReport'][_0x1293('0x127')](db[_0x1293('0x6b')],{});db[_0x1293('0xfa')][_0x1293('0x127')](db[_0x1293('0x65')],{'foreignKey':_0x1293('0x1ed'),'as':_0x1293('0x1e5')});db[_0x1293('0xfa')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e6'),'as':_0x1293('0x1e7')});db[_0x1293('0xfa')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e8'),'as':'ToAgent'});db['ChatTransferReport'][_0x1293('0x127')](db[_0x1293('0x70')],{'foreignKey':_0x1293('0x1ee'),'as':_0x1293('0x1ea')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x1293('0x1ef'),'as':_0x1293('0x1ec')});db[_0x1293('0xfb')][_0x1293('0x127')](db[_0x1293('0x52')],{});db[_0x1293('0xfb')][_0x1293('0x127')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x1293('0x127')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x1293('0x1e5')});db[_0x1293('0xfb')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e6'),'as':_0x1293('0x1e7')});db[_0x1293('0xfb')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':'ToUserId','as':_0x1293('0x1e9')});db[_0x1293('0xfb')][_0x1293('0x127')](db[_0x1293('0x54')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x1293('0xfb')][_0x1293('0x127')](db[_0x1293('0x13e')],{'foreignKey':_0x1293('0x1f0'),'as':_0x1293('0x1ec')});db[_0x1293('0xfd')][_0x1293('0x127')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x1293('0xfd')][_0x1293('0x127')](db['OpenchannelAccount'],{'foreignKey':_0x1293('0x1f1'),'as':'FromAccount'});db[_0x1293('0xfd')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x1293('0xfd')][_0x1293('0x127')](db['User'],{'foreignKey':_0x1293('0x1e8'),'as':'ToAgent'});db[_0x1293('0xfd')][_0x1293('0x127')](db[_0x1293('0x13a')],{'foreignKey':_0x1293('0x1f2'),'as':_0x1293('0x1ea')});db[_0x1293('0xfd')][_0x1293('0x127')](db[_0x1293('0x5e')],{'foreignKey':'ToOpenchannelAccountId','as':_0x1293('0x1ec')});db[_0x1293('0xfe')][_0x1293('0x127')](db[_0x1293('0x5b')],{});db[_0x1293('0xfe')][_0x1293('0x127')](db[_0x1293('0x5a')],{});db[_0x1293('0xfe')][_0x1293('0x127')](db[_0x1293('0x184')],{'foreignKey':_0x1293('0x1f3'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x1293('0x1e6'),'as':_0x1293('0x1e7')});db[_0x1293('0xfe')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e8'),'as':_0x1293('0x1e9')});db['SmsTransferReport'][_0x1293('0x127')](db['SmsQueue'],{'foreignKey':_0x1293('0x1f4'),'as':'ToQueue'});db['SmsTransferReport'][_0x1293('0x127')](db[_0x1293('0x184')],{'foreignKey':'ToSmsAccountId','as':_0x1293('0x1ec')});db[_0x1293('0x100')][_0x1293('0x11d')](db[_0x1293('0x165')],{'as':'Dispositions','foreignKey':_0x1293('0x16b'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x100')][_0x1293('0x11d')](db[_0x1293('0x81')],{'as':_0x1293('0x1f5'),'foreignKey':_0x1293('0x16b')});db['CmList'][_0x1293('0x11d')](db[_0x1293('0x75')],{'as':_0x1293('0x12c'),'onDelete':'cascade','foreignKey':_0x1293('0x16b')});db[_0x1293('0x100')][_0x1293('0x11d')](db[_0x1293('0x7b')],{'as':_0x1293('0x11f'),'foreignKey':'ListId'});db['CmList'][_0x1293('0x11d')](db[_0x1293('0x7d')],{'as':_0x1293('0x1f6'),'foreignKey':'ListId'});db[_0x1293('0x100')][_0x1293('0x11d')](db[_0x1293('0x7f')],{'as':_0x1293('0x7f'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x100')][_0x1293('0x12b')](db[_0x1293('0x1d')],{'as':_0x1293('0x1f7'),'through':_0x1293('0x156')});db[_0x1293('0x100')][_0x1293('0x12b')](db['User'],{'as':'Agents','through':_0x1293('0x12f')});db[_0x1293('0x101')][_0x1293('0x11d')](db[_0x1293('0x18')],{'as':_0x1293('0x11e'),'onDelete':_0x1293('0x11a')});db[_0x1293('0x101')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':'Agents','through':_0x1293('0x114')});db[_0x1293('0x101')]['belongsToMany'](db[_0x1293('0xef')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x1293('0x102')]['hasMany'](db[_0x1293('0x118')],{'as':'Users','foreignKey':'userProfileId'});db[_0x1293('0x102')]['hasMany'](db[_0x1293('0x104')],{'as':_0x1293('0x1f8'),'foreignKey':'userProfileId','onDelete':_0x1293('0x11a')});db['UserProfileSection'][_0x1293('0x11d')](db[_0x1293('0x1f9')],{'as':_0x1293('0x1fa'),'foreignKey':_0x1293('0x1fb'),'onDelete':_0x1293('0x11a')});db['WhatsappAccount']['hasMany'](db[_0x1293('0x165')],{'as':_0x1293('0x166'),'foreignKey':'WhatsappAccountId','onDelete':_0x1293('0x11a')});db[_0x1293('0x107')][_0x1293('0x11d')](db[_0x1293('0x86')],{'as':_0x1293('0x168'),'foreignKey':_0x1293('0x1fc')});db[_0x1293('0x107')][_0x1293('0x11d')](db[_0x1293('0x1fd')],{'as':_0x1293('0x159'),'foreignKey':_0x1293('0x1fc')});db['WhatsappAccount']['hasMany'](db['WhatsappInteraction'],{'as':_0x1293('0x169')});db[_0x1293('0x107')][_0x1293('0x11d')](db[_0x1293('0x109')],{'as':_0x1293('0x17d')});db['WhatsappAccount'][_0x1293('0x127')](db['CmList'],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x107')][_0x1293('0x127')](db['Pause'],{'as':_0x1293('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1293('0x107')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x1293('0x127')](db[_0x1293('0x118')],{'onDelete':_0x1293('0x179')});db[_0x1293('0x109')][_0x1293('0x127')](db[_0x1293('0x110')],{'onDelete':_0x1293('0x179')});db[_0x1293('0x109')][_0x1293('0x127')](db[_0x1293('0x107')],{'onDelete':'restrict'});db[_0x1293('0x109')][_0x1293('0x127')](db[_0x1293('0x8a')],{'onDelete':_0x1293('0x179'),'foreignKey':'IntervalId'});db['WhatsappApplication'][_0x1293('0x127')](db[_0x1293('0x92')],{'onDelete':'restrict','foreignKey':_0x1293('0x17a')});db[_0x1293('0x10b')][_0x1293('0x11d')](db['WhatsappMessage'],{'as':_0x1293('0x159'),'onDelete':_0x1293('0x11a'),'foreignKey':_0x1293('0x1fe')});db[_0x1293('0x10b')][_0x1293('0x127')](db[_0x1293('0x107')],{'as':_0x1293('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0x1293('0x10b')]['belongsTo'](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x10b')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x170'),'foreignKey':_0x1293('0x11b')});db[_0x1293('0x10b')][_0x1293('0x12b')](db[_0x1293('0x92')],{'through':'whatsapp_interaction_has_tags','as':_0x1293('0x172')});db[_0x1293('0x10b')][_0x1293('0x12b')](db['Tag'],{'through':_0x1293('0x1b1'),'as':_0x1293('0x188')});db['WhatsappInteraction'][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x1293('0x1fe')});db[_0x1293('0x1fd')][_0x1293('0x127')](db[_0x1293('0x118')],{'as':_0x1293('0x118')});db[_0x1293('0x1fd')][_0x1293('0x127')](db['CmContact'],{'onDelete':'cascade','as':_0x1293('0x160')});db[_0x1293('0x1fd')][_0x1293('0x127')](db['WhatsappInteraction'],{'onDelete':_0x1293('0x11a'),'as':_0x1293('0x176'),'foreignKey':'WhatsappInteractionId'});db[_0x1293('0x1fd')]['belongsTo'](db[_0x1293('0x107')],{'as':_0x1293('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0x1293('0x1ff')][_0x1293('0x127')](db['WhatsappAccount'],{});db[_0x1293('0x1ff')]['belongsTo'](db[_0x1293('0x100')],{'as':_0x1293('0x16a'),'foreignKey':_0x1293('0x16b')});db[_0x1293('0x1ff')][_0x1293('0x127')](db[_0x1293('0x75')],{'as':_0x1293('0x160'),'foreignKey':_0x1293('0x161')});db[_0x1293('0x1ff')][_0x1293('0x127')](db[_0x1293('0x10b')],{});db[_0x1293('0x1ff')][_0x1293('0x127')](db[_0x1293('0x110')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x1293('0x1fd')],{});db[_0x1293('0x1ff')][_0x1293('0x127')](db['User'],{});db[_0x1293('0x10e')]['belongsTo'](db['WhatsappMessage'],{});db[_0x1293('0x10e')][_0x1293('0x127')](db[_0x1293('0x10b')],{});db[_0x1293('0x10e')][_0x1293('0x127')](db[_0x1293('0x107')],{'foreignKey':_0x1293('0x200'),'as':'FromAccount'});db[_0x1293('0x10e')]['belongsTo'](db[_0x1293('0x107')],{'foreignKey':_0x1293('0x201'),'as':_0x1293('0x1ec')});db[_0x1293('0x10e')][_0x1293('0x127')](db[_0x1293('0x110')],{'foreignKey':_0x1293('0x202'),'as':_0x1293('0x1ea')});db[_0x1293('0x10e')][_0x1293('0x127')](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e6'),'as':_0x1293('0x1e7')});db['WhatsappTransferReport']['belongsTo'](db[_0x1293('0x118')],{'foreignKey':_0x1293('0x1e8'),'as':'ToAgent'});db[_0x1293('0x110')][_0x1293('0x12b')](db[_0x1293('0x118')],{'as':_0x1293('0x16c'),'through':_0x1293('0x3a'),'foreignKey':_0x1293('0x203')});db[_0x1293('0x110')][_0x1293('0x12b')](db[_0x1293('0xef')],{'through':_0x1293('0x1dd'),'as':'Teams'});db[_0x1293('0x116')][_0x1293('0x127')](db['User'],{'as':_0x1293('0x204'),'foreignKey':_0x1293('0x11b'),'onDelete':_0x1293('0x11a'),'hooks':!![]});db[_0x1293('0x112')][_0x1293('0x119')](db['Dynamics365Account'],{'as':_0x1293('0xcf'),'onDelete':'restrict'});db[_0x1293('0x112')][_0x1293('0x119')](db['MailServerIn'],{'as':_0x1293('0x164'),'onDelete':_0x1293('0x179')});db[_0x1293('0x112')][_0x1293('0x119')](db[_0x1293('0x3d')],{'as':'Smtp','onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH};
\ No newline at end of file
+var _0xcab1=['../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','Cdr','Schedule','../api/schedule/schedule.model','Tag','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','Team','../api/license/license.model','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','cascade','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','VoiceMusicOnHold','Sound','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperFinals','HopperBlacks','Trunk','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','Account','TagId','MailQueueReport','FaxApplication','Applications','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','SmsAccountId','SmsMessage','SmsApplication','mandatoryDispositionPauseId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Contacts','Phones','HopperHistories','JscriptySessions','Company','CompanyId','cm_contact_has_tags','CmHopperId','Campaign','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','AutomationAnyId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','CmHopperAdditionalPhone','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','AccountId','SugarcrmField','int_desk_configuration_has_tags','ZendeskConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','team_has_fax_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProject','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CmCustomField','CustomFields','Queues','userProfileId','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','options','password','User','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model'];(function(_0x256da0,_0x2d1a68){var _0x34d171=function(_0x104f60){while(--_0x104f60){_0x256da0['push'](_0x256da0['shift']());}};_0x34d171(++_0x2d1a68);}(_0xcab1,0x1d2));var _0x1cab=function(_0x4484d9,_0xd84f88){_0x4484d9=_0x4484d9-0x0;var _0x57f5cf=_0xcab1[_0x4484d9];return _0x57f5cf;};'use strict';var config=require(_0x1cab('0x0'));var Sequelize=require('sequelize');var _=require(_0x1cab('0x1'));var jstz=require(_0x1cab('0x2'));var timezone=jstz[_0x1cab('0x3')]();config['sequelize']=_[_0x1cab('0x4')](config[_0x1cab('0x5')],{'database':_0x1cab('0x6'),'username':_0x1cab('0x7'),'password':_0x1cab('0x8'),'options':{'host':_0x1cab('0x9'),'port':0xcea,'dialect':_0x1cab('0xa'),'dialectOptions':{'charset':_0x1cab('0xb')},'logging':![],'timezone':timezone[_0x1cab('0xc')](),'define':{'charset':_0x1cab('0xd'),'collate':_0x1cab('0xe')}}});config[_0x1cab('0xf')]=_[_0x1cab('0x4')](config['sequelizeHistory'],{'database':_0x1cab('0x6'),'username':_0x1cab('0x7'),'password':_0x1cab('0x8'),'options':{'host':_0x1cab('0x9'),'port':0xcea,'dialect':_0x1cab('0xa'),'dialectOptions':{'charset':_0x1cab('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x1cab('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x1cab('0x10')],config['sequelize'][_0x1cab('0x11')],config['sequelize']['password'],config[_0x1cab('0x5')][_0x1cab('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1cab('0xf')][_0x1cab('0x10')],config[_0x1cab('0xf')]['username'],config[_0x1cab('0xf')][_0x1cab('0x13')],config[_0x1cab('0xf')][_0x1cab('0x12')])};db[_0x1cab('0x14')]=db['sequelize']['import'](_0x1cab('0x15'));db['VoiceChanSpy']=db[_0x1cab('0x5')]['import'](_0x1cab('0x16'));db[_0x1cab('0x17')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/voiceContext/voiceContext.model');db[_0x1cab('0x19')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x1a'));db['VoiceMusicOnHold']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x1cab('0x1b')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x1c'));db[_0x1cab('0x1d')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x1e'));db['ScreenRecording']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/screenRecording/screenRecording.model');db[_0x1cab('0x1f')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/voiceMail/voiceMail.model');db[_0x1cab('0x20')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x21'));db[_0x1cab('0x22')]=db['sequelize'][_0x1cab('0x18')]('../api/voiceCallReport/voiceCallReport.model');db[_0x1cab('0x23')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x24'));db[_0x1cab('0x25')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x26'));db[_0x1cab('0x27')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x28'));db[_0x1cab('0x29')]=db['sequelize']['import'](_0x1cab('0x2a'));db['Trunk']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x2b'));db[_0x1cab('0x2c')]=db[_0x1cab('0x5')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x1cab('0x5')]['import'](_0x1cab('0x2d'));db[_0x1cab('0x2e')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x2f'));db[_0x1cab('0x30')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x31'));db[_0x1cab('0x32')]=db[_0x1cab('0x5')]['import'](_0x1cab('0x33'));db[_0x1cab('0x34')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x35'));db[_0x1cab('0x36')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x37'));db[_0x1cab('0x38')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x39'));db['UserWhatsappQueue']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x3a'));db[_0x1cab('0x3b')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x3c'));db['MailServerOut']=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x3d'));db[_0x1cab('0x3e')]=db[_0x1cab('0x5')]['import']('../api/mailAccount/mailAccount.model');db[_0x1cab('0x3f')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x40'));db[_0x1cab('0x41')]=db[_0x1cab('0x5')]['import'](_0x1cab('0x42'));db[_0x1cab('0x43')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/mailInteraction/mailInteraction.model');db[_0x1cab('0x44')]=db[_0x1cab('0x5')]['import']('../api/mailMessage/mailMessage.model');db[_0x1cab('0x45')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x46'));db['MailQueueReport']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/mailQueueReport/mailQueueReport.model');db[_0x1cab('0x47')]=db[_0x1cab('0x5')]['import']('../api/dashboard/dashboard.model');db[_0x1cab('0x48')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x49'));db[_0x1cab('0x4a')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x4b'));db['FaxApplication']=db[_0x1cab('0x5')]['import'](_0x1cab('0x4c'));db[_0x1cab('0x4d')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x4e'));db['FaxMessage']=db[_0x1cab('0x5')]['import'](_0x1cab('0x4f'));db['FaxQueue']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x50'));db[_0x1cab('0x51')]=db['sequelize'][_0x1cab('0x18')]('../api/faxQueueReport/faxQueueReport.model');db[_0x1cab('0x52')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x53'));db[_0x1cab('0x54')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x55'));db['SmsMessage']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x56'));db[_0x1cab('0x57')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x58'));db['OpenchannelAccount']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x59'));db[_0x1cab('0x5a')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x5b'));db['OpenchannelInteraction']=db[_0x1cab('0x5')]['import'](_0x1cab('0x5c'));db['OpenchannelMessage']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x5d'));db[_0x1cab('0x5e')]=db['sequelize']['import'](_0x1cab('0x5f'));db[_0x1cab('0x60')]=db['sequelize']['import'](_0x1cab('0x61'));db[_0x1cab('0x62')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x63'));db[_0x1cab('0x64')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x65'));db['ChatInteraction']=db['sequelize'][_0x1cab('0x18')]('../api/chatInteraction/chatInteraction.model');db[_0x1cab('0x66')]=db[_0x1cab('0x5')]['import']('../api/chatMessage/chatMessage.model');db[_0x1cab('0x67')]=db[_0x1cab('0x5')]['import'](_0x1cab('0x68'));db[_0x1cab('0x69')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x6a'));db['ChatGroup']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x6b'));db[_0x1cab('0x6c')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x6d'));db[_0x1cab('0x6e')]=db[_0x1cab('0x5')]['import'](_0x1cab('0x6f'));db['CmContact']=db[_0x1cab('0x5')]['import'](_0x1cab('0x70'));db[_0x1cab('0x71')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x72'));db[_0x1cab('0x73')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x74'));db[_0x1cab('0x75')]=db['sequelize'][_0x1cab('0x18')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x1cab('0x76')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x77'));db[_0x1cab('0x78')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x79'));db[_0x1cab('0x7a')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/action/action.model');db[_0x1cab('0x7b')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x7c'));db[_0x1cab('0x7d')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x7e'));db[_0x1cab('0x7f')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x80'));db['Condition']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/condition/condition.model');db[_0x1cab('0x81')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x82'));db[_0x1cab('0x83')]=db['sequelize'][_0x1cab('0x18')]('../api/pause/pause.model');db[_0x1cab('0x84')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x1cab('0x85')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x86'));db['Sound']=db['sequelize'][_0x1cab('0x18')]('../api/sound/sound.model');db[_0x1cab('0x87')]=db[_0x1cab('0x5')]['import']('../api/tag/tag.model');db['ContactItemType']=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x88'));db[_0x1cab('0x89')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x8a'));db['Template']=db[_0x1cab('0x5')]['import'](_0x1cab('0x8b'));db[_0x1cab('0x8c')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x8d'));db[_0x1cab('0x8e')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x8f'));db[_0x1cab('0x90')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x91'));db[_0x1cab('0x92')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x93'));db['AnalyticCustomReport']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x94'));db[_0x1cab('0x95')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x1cab('0x96')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x97'));db[_0x1cab('0x98')]=db[_0x1cab('0x5')]['import'](_0x1cab('0x99'));db['AnalyticFieldReport']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x1cab('0x5')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x1cab('0x9a')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x9b'));db[_0x1cab('0x9c')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x9d'));db[_0x1cab('0x9e')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x9f'));db[_0x1cab('0xa0')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xa1'));db[_0x1cab('0xa2')]=db[_0x1cab('0x5')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xa3'));db[_0x1cab('0xa4')]=db['sequelize']['import'](_0x1cab('0xa5'));db[_0x1cab('0xa6')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xa7'));db[_0x1cab('0xa8')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intDeskField/intDeskField.model');db[_0x1cab('0xa9')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1cab('0xaa')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x1cab('0xab')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xac'));db['ZendeskAccount']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xad'));db['ZendeskConfiguration']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xae'));db[_0x1cab('0xaf')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xb0'));db[_0x1cab('0xb1')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x1cab('0xb2')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xb3'));db[_0x1cab('0xb4')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xb5'));db[_0x1cab('0xb6')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xb7'));db[_0x1cab('0xb8')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x1cab('0xb9')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xba'));db[_0x1cab('0xbb')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xbc'));db[_0x1cab('0xbd')]=db[_0x1cab('0x5')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x1cab('0xbe')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xbf'));db[_0x1cab('0xc0')]=db[_0x1cab('0x5')]['import'](_0x1cab('0xc1'));db[_0x1cab('0xc2')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xc3'));db[_0x1cab('0xc4')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xc5'));db[_0x1cab('0xc6')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x1cab('0xc7')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x1cab('0xc8')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xc9'));db[_0x1cab('0x90')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/integration/integration.model');db[_0x1cab('0xca')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xcb'));db[_0x1cab('0xcc')]=db['sequelize']['import'](_0x1cab('0xcd'));db[_0x1cab('0xce')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xcf'));db[_0x1cab('0xd0')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xd1'));db['JscriptyQuestionReport']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x1cab('0xd2')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xd3'));db[_0x1cab('0xd4')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xd5'));db[_0x1cab('0xd6')]=db['sequelize']['import']('../api/squareReport/squareReport.model');db[_0x1cab('0xd7')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/squareReportDetail/squareReportDetail.model');db[_0x1cab('0xd8')]=db[_0x1cab('0x5')]['import']('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xd9'));db['SquareOdbc']=db[_0x1cab('0x5')]['import'](_0x1cab('0xda'));db['SquareProject']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xdb'));db[_0x1cab('0xdc')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/squareMessage/squareMessage.model');db[_0x1cab('0xdd')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/team/team.model');db['License']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xde'));db['Campaign']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/campaign/campaign.model');db['Migration']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xdf'));db['Attachment']=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x1cab('0xe0')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xe1'));db[_0x1cab('0xe2')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xe3'));db[_0x1cab('0xe4')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/chatTransferReport/chatTransferReport.model');db[_0x1cab('0xe5')]=db[_0x1cab('0x5')]['import'](_0x1cab('0xe6'));db['OpenchannelTransferReport']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xe7'));db[_0x1cab('0xe8')]=db[_0x1cab('0x5')]['import'](_0x1cab('0xe9'));db[_0x1cab('0xea')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/cmList/cmList.model');db[_0x1cab('0xeb')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xec'));db[_0x1cab('0xed')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xee'));db['UserProfileSection']=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/userProfileSection/userProfileSection.model');db[_0x1cab('0xef')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xf0'));db['UserNotification']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xf1'));db['WhatsappAccount']=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xf2'));db[_0x1cab('0xf3')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xf4'));db[_0x1cab('0xf5')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0xf6'));db[_0x1cab('0xf7')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xf8'));db[_0x1cab('0xf9')]=db[_0x1cab('0x5')]['import'](_0x1cab('0xfa'));db[_0x1cab('0xfb')]=db[_0x1cab('0x5')]['import'](_0x1cab('0xfc'));db[_0x1cab('0xfd')]=db[_0x1cab('0x5')][_0x1cab('0x18')]('../api/whatsappQueue/whatsappQueue.model');db[_0x1cab('0xfe')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0xff'));db['TeamVoiceQueue']=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x100'));db[_0x1cab('0x101')]=db['sequelize'][_0x1cab('0x18')](_0x1cab('0x102'));db[_0x1cab('0x103')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x104'));db[_0x1cab('0x105')]=db[_0x1cab('0x5')][_0x1cab('0x18')](_0x1cab('0x106'));db[_0x1cab('0x14')][_0x1cab('0x107')](db['VoiceMail'],{'as':_0x1cab('0x1f'),'onDelete':'cascade','foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x107')](db[_0x1cab('0x105')],{'as':_0x1cab('0x109'),'onDelete':_0x1cab('0x10a'),'foreignKey':'UserId'});db[_0x1cab('0x14')]['hasMany'](db[_0x1cab('0x1d')],{'as':'Recordings','foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db[_0x1cab('0x10c')],{'as':_0x1cab('0x10d'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db[_0x1cab('0x19')],{'as':_0x1cab('0x10e'),'onDelete':_0x1cab('0x10a'),'hooks':!![]});db[_0x1cab('0x14')][_0x1cab('0x10b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db[_0x1cab('0x76')],{'as':_0x1cab('0x10f'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db[_0x1cab('0x78')],{'as':_0x1cab('0x78'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db['OpenchannelInteraction'],{'as':_0x1cab('0x110'),'foreignKey':_0x1cab('0x108')});db['User'][_0x1cab('0x10b')](db[_0x1cab('0x111')],{'as':_0x1cab('0x112'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')]['hasMany'](db['SmsInteraction'],{'as':_0x1cab('0x113'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db[_0x1cab('0x4d')],{'as':_0x1cab('0x114'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db['MailInteraction'],{'as':_0x1cab('0x115'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')][_0x1cab('0x10b')](db[_0x1cab('0xf5')],{'as':_0x1cab('0x116'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14')]['hasMany'](db[_0x1cab('0x117')],{'as':_0x1cab('0x118'),'foreignKey':_0x1cab('0x119')});db[_0x1cab('0x14')][_0x1cab('0x11a')](db['UserProfile'],{'as':_0x1cab('0xed'),'foreignKey':'userProfileId'});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x11c')],{'as':_0x1cab('0x11d'),'through':_0x1cab('0x11e')});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x11f')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x1cab('0x14')][_0x1cab('0x11b')](db['CmList'],{'as':'Lists','through':_0x1cab('0x120')});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0xdd')],{'through':_0x1cab('0x121')});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x43')],{'as':_0x1cab('0x115'),'through':_0x1cab('0x122')});db[_0x1cab('0x14')]['belongsToMany'](db[_0x1cab('0x111')],{'as':_0x1cab('0x112'),'through':'user_has_chat_interactions'});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x4d')],{'as':_0x1cab('0x114'),'through':'user_has_fax_interactions'});db[_0x1cab('0x14')][_0x1cab('0x11b')](db['SmsInteraction'],{'as':_0x1cab('0x113'),'through':_0x1cab('0x123')});db['User'][_0x1cab('0x11b')](db[_0x1cab('0x124')],{'as':_0x1cab('0x110'),'through':_0x1cab('0x125')});db[_0x1cab('0x14')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x1cab('0x116'),'through':_0x1cab('0x126')});db['User'][_0x1cab('0x11b')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x1cab('0x2e'),'required':![]});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0xeb')],{'as':_0x1cab('0x127'),'through':_0x1cab('0x103'),'required':![]});db[_0x1cab('0x14')]['belongsToMany'](db['MailQueue'],{'as':_0x1cab('0x128'),'through':_0x1cab('0x32'),'required':![]});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x69')],{'as':_0x1cab('0x129'),'through':_0x1cab('0x30'),'required':![],'hooks':!![]});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x12a')],{'as':_0x1cab('0x12b'),'through':'UserFaxQueue','required':![]});db[_0x1cab('0x14')][_0x1cab('0x11b')](db['SmsQueue'],{'as':_0x1cab('0x12c'),'through':_0x1cab('0x36'),'required':![]});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x5e')],{'as':_0x1cab('0x12d'),'through':'UserOpenchannelQueue','required':![]});db[_0x1cab('0x14')][_0x1cab('0x11b')](db['WhatsappQueue'],{'as':_0x1cab('0x12e'),'through':_0x1cab('0x12f'),'required':![]});db[_0x1cab('0x14')]['belongsToMany'](db[_0x1cab('0xea')],{'through':_0x1cab('0x120')});db[_0x1cab('0x14')]['belongsToMany'](db[_0x1cab('0x60')],{'as':_0x1cab('0x130'),'through':'user_has_chat_websites'});db[_0x1cab('0x14')]['belongsToMany'](db[_0x1cab('0x4a')],{'as':_0x1cab('0x131'),'through':_0x1cab('0x132')});db['User'][_0x1cab('0x11b')](db[_0x1cab('0x3e')],{'as':_0x1cab('0x133'),'through':_0x1cab('0x134')});db['User'][_0x1cab('0x11b')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x1cab('0x135')});db['User'][_0x1cab('0x11b')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x1cab('0x136')});db[_0x1cab('0x14')][_0x1cab('0x11b')](db[_0x1cab('0x137')],{'as':'WhatsappAccounts','through':_0x1cab('0x138')});db['VoiceChanSpy'][_0x1cab('0x10b')](db[_0x1cab('0x19')],{'as':_0x1cab('0x139'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x13a')});db[_0x1cab('0x17')][_0x1cab('0x10b')](db[_0x1cab('0x19')],{'onDelete':_0x1cab('0x10a')});db[_0x1cab('0x19')][_0x1cab('0x10b')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x13b')][_0x1cab('0x11b')](db[_0x1cab('0x13c')],{'as':'Sounds','through':_0x1cab('0x13d')});db[_0x1cab('0x1b')]['hasMany'](db[_0x1cab('0x10c')],{'as':_0x1cab('0x13e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x1cab('0x10b')](db['CmHopper'],{'as':_0x1cab('0x13f'),'foreignKey':_0x1cab('0x140')});db['VoiceQueue'][_0x1cab('0x10b')](db[_0x1cab('0x75')],{'as':_0x1cab('0x141'),'foreignKey':_0x1cab('0x140')});db[_0x1cab('0x1b')][_0x1cab('0x10b')](db[_0x1cab('0x76')],{'as':'HopperHistories','foreignKey':_0x1cab('0x140')});db[_0x1cab('0x1b')][_0x1cab('0x10b')](db[_0x1cab('0x78')],{'as':'ReportAgentPreview','foreignKey':_0x1cab('0x140')});db[_0x1cab('0x1b')][_0x1cab('0x10b')](db[_0x1cab('0x73')],{'as':_0x1cab('0x142'),'foreignKey':_0x1cab('0x140')});db[_0x1cab('0x1b')][_0x1cab('0x10b')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x1cab('0x140')});db['VoiceQueue']['belongsTo'](db[_0x1cab('0x143')],{'as':'Trunk','foreignKey':_0x1cab('0x144')});db[_0x1cab('0x1b')][_0x1cab('0x11a')](db[_0x1cab('0x143')],{'as':_0x1cab('0x145'),'foreignKey':'TrunkBackupId'});db[_0x1cab('0x1b')][_0x1cab('0x11a')](db['Interval'],{'as':'Interval','foreignKey':_0x1cab('0x146')});db[_0x1cab('0x1b')][_0x1cab('0x11a')](db[_0x1cab('0x83')],{'as':_0x1cab('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1cab('0x1b')][_0x1cab('0x11b')](db[_0x1cab('0xea')],{'as':'Lists','through':_0x1cab('0x148')});db[_0x1cab('0x1b')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':'UserVoiceQueue'});db[_0x1cab('0x1b')]['belongsToMany'](db[_0x1cab('0xdd')],{'as':'Teams','through':_0x1cab('0x14a')});db['VoiceQueue'][_0x1cab('0x11b')](db[_0x1cab('0xea')],{'as':_0x1cab('0x14b'),'through':_0x1cab('0x14c')});db['VoiceRecording']['belongsTo'](db[_0x1cab('0x14')],{'as':_0x1cab('0x14'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x14d')]['belongsTo'](db[_0x1cab('0x14')],{'as':_0x1cab('0x14'),'foreignKey':_0x1cab('0x108')});db['VoiceMail'][_0x1cab('0x10b')](db[_0x1cab('0x20')],{'as':_0x1cab('0x14e'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x14f'),'sourceKey':_0x1cab('0x150')});db[_0x1cab('0x20')][_0x1cab('0x11a')](db[_0x1cab('0x1f')],{'foreignKey':_0x1cab('0x14f'),'targetKey':_0x1cab('0x150')});db[_0x1cab('0x22')]['hasMany'](db[_0x1cab('0x27')],{'as':_0x1cab('0x151'),'foreignKey':_0x1cab('0x152'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x1cab('0x25')],{'as':_0x1cab('0x153'),'foreignKey':_0x1cab('0x152'),'constraints':![]});db[_0x1cab('0x22')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x14'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x22')]['belongsTo'](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x3b')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'as':'MailAccount','foreignKey':_0x1cab('0x156')});db[_0x1cab('0x3b')][_0x1cab('0x11a')](db[_0x1cab('0xfe')],{'as':_0x1cab('0xfe'),'foreignKey':_0x1cab('0x157'),'onDelete':'restrict'});db[_0x1cab('0x158')]['belongsTo'](db[_0x1cab('0x3e')],{'as':_0x1cab('0x3e'),'foreignKey':_0x1cab('0x156')});db[_0x1cab('0x158')][_0x1cab('0x11a')](db['CloudProvider'],{'as':_0x1cab('0xfe'),'foreignKey':_0x1cab('0x157'),'onDelete':_0x1cab('0x159')});db['MailAccount']['hasOne'](db[_0x1cab('0x3b')],{'as':_0x1cab('0x15a'),'onDelete':_0x1cab('0x10a')});db['MailAccount'][_0x1cab('0x107')](db[_0x1cab('0x158')],{'as':_0x1cab('0x15b'),'onDelete':_0x1cab('0x10a')});db['MailAccount'][_0x1cab('0x10b')](db[_0x1cab('0x7f')],{'as':_0x1cab('0x15c'),'foreignKey':'MailAccountId','onDelete':_0x1cab('0x10a')});db['MailAccount'][_0x1cab('0x10b')](db['CannedAnswer'],{'as':_0x1cab('0x15d'),'foreignKey':_0x1cab('0x156')});db[_0x1cab('0x3e')][_0x1cab('0x10b')](db[_0x1cab('0x44')],{'as':_0x1cab('0x14e'),'foreignKey':_0x1cab('0x156')});db[_0x1cab('0x3e')]['hasMany'](db[_0x1cab('0x43')],{'as':_0x1cab('0x15e')});db['MailAccount'][_0x1cab('0x10b')](db[_0x1cab('0x45')],{'as':'Applications'});db[_0x1cab('0x3e')][_0x1cab('0x11a')](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0x3e')][_0x1cab('0x11a')](db[_0x1cab('0x161')],{'as':_0x1cab('0x161'),'foreignKey':_0x1cab('0x162')});db[_0x1cab('0x3e')][_0x1cab('0x11a')](db[_0x1cab('0x83')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db['User'],{'as':_0x1cab('0x149'),'through':_0x1cab('0x134')});db[_0x1cab('0x3f')][_0x1cab('0x11b')](db['User'],{'as':_0x1cab('0x149'),'through':_0x1cab('0x32')});db['MailQueue']['belongsToMany'](db[_0x1cab('0xdd')],{'through':_0x1cab('0x163'),'as':_0x1cab('0x164')});db[_0x1cab('0x43')][_0x1cab('0x10b')](db[_0x1cab('0x44')],{'as':_0x1cab('0x14e'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x165')});db['MailInteraction'][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'as':'Account','foreignKey':_0x1cab('0x156')});db[_0x1cab('0x43')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x43')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x166'),'foreignKey':_0x1cab('0x108')});db['MailInteraction'][_0x1cab('0x11b')](db['Tag'],{'through':_0x1cab('0x167'),'as':_0x1cab('0x168')});db[_0x1cab('0x43')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':'mail_interaction_has_tags','as':_0x1cab('0x169')});db[_0x1cab('0x43')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x16a'),'through':_0x1cab('0x122'),'foreignKey':'MailInteractionId'});db[_0x1cab('0x44')]['hasMany'](db[_0x1cab('0x16b')],{'as':_0x1cab('0x16c'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db['User'],{'as':_0x1cab('0x14')});db['MailMessage'][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x154')});db[_0x1cab('0x44')][_0x1cab('0x11a')](db[_0x1cab('0x43')],{'as':_0x1cab('0x16d'),'foreignKey':_0x1cab('0x165')});db[_0x1cab('0x44')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'as':_0x1cab('0x16e'),'foreignKey':'MailAccountId'});db[_0x1cab('0x44')]['belongsTo'](db[_0x1cab('0x60')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x1cab('0x44')][_0x1cab('0x11a')](db[_0x1cab('0x67')],{'as':_0x1cab('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0x1cab('0x45')]['belongsTo'](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x45')][_0x1cab('0x11a')](db[_0x1cab('0x3f')],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x45')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x45')][_0x1cab('0x11a')](db[_0x1cab('0x81')],{'onDelete':'restrict','foreignKey':_0x1cab('0x146')});db[_0x1cab('0x45')][_0x1cab('0x11a')](db[_0x1cab('0x87')],{'onDelete':'restrict','foreignKey':_0x1cab('0x16f')});db[_0x1cab('0x170')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{});db['MailQueueReport'][_0x1cab('0x11a')](db['CmList'],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0x170')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x1cab('0x11a')](db[_0x1cab('0x43')],{});db[_0x1cab('0x170')][_0x1cab('0x11a')](db['MailMessage'],{});db[_0x1cab('0x170')][_0x1cab('0x11a')](db['User'],{});db[_0x1cab('0x170')][_0x1cab('0x11a')](db[_0x1cab('0x3f')],{});db[_0x1cab('0x47')][_0x1cab('0x10b')](db[_0x1cab('0x48')],{'as':'Items','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x4a')][_0x1cab('0x10b')](db[_0x1cab('0x7f')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x4a')]['hasMany'](db[_0x1cab('0x7d')],{'as':_0x1cab('0x15d'),'foreignKey':'FaxAccountId'});db[_0x1cab('0x4a')][_0x1cab('0x10b')](db[_0x1cab('0x4d')],{'as':'Interactions'});db['FaxAccount'][_0x1cab('0x10b')](db[_0x1cab('0x171')],{'as':_0x1cab('0x172')});db['FaxAccount'][_0x1cab('0x10b')](db['VoiceExtension'],{'as':_0x1cab('0x173'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0x1cab('0x174')],{'as':'Messages'});db['FaxAccount']['belongsTo'](db[_0x1cab('0x143')],{'as':_0x1cab('0x143')});db[_0x1cab('0x4a')][_0x1cab('0x11a')](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0x4a')]['belongsTo'](db[_0x1cab('0x83')],{'as':_0x1cab('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1cab('0x4a')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x171')][_0x1cab('0x11a')](db[_0x1cab('0x12a')],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x171')][_0x1cab('0x11a')](db[_0x1cab('0x4a')],{'onDelete':_0x1cab('0x159')});db['FaxApplication'][_0x1cab('0x11a')](db['Tag'],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x16f')});db['FaxInteraction'][_0x1cab('0x10b')](db[_0x1cab('0x174')],{'as':_0x1cab('0x14e'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x175')});db['FaxInteraction']['belongsTo'](db[_0x1cab('0x4a')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x1cab('0x4d')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':'ContactId'});db[_0x1cab('0x4d')]['belongsTo'](db[_0x1cab('0x14')],{'as':'Owner','foreignKey':_0x1cab('0x108')});db[_0x1cab('0x4d')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':'fax_interaction_has_tags','as':_0x1cab('0x168')});db[_0x1cab('0x4d')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x176'),'as':_0x1cab('0x169')});db[_0x1cab('0x4d')][_0x1cab('0x11b')](db['User'],{'as':'Users','through':_0x1cab('0x177'),'foreignKey':_0x1cab('0x175')});db['FaxMessage'][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x14')});db[_0x1cab('0x174')][_0x1cab('0x11a')](db[_0x1cab('0x4d')],{'as':_0x1cab('0x16d'),'foreignKey':_0x1cab('0x175')});db[_0x1cab('0x174')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x154')});db[_0x1cab('0x174')]['belongsTo'](db[_0x1cab('0x16b')],{'as':_0x1cab('0x16b'),'foreignKey':'AttachmentId'});db[_0x1cab('0x174')][_0x1cab('0x11a')](db[_0x1cab('0x4a')],{'as':_0x1cab('0x16e'),'foreignKey':'FaxAccountId'});db[_0x1cab('0x12a')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':'Agents','through':_0x1cab('0x34')});db['FaxQueue'][_0x1cab('0x11b')](db[_0x1cab('0xdd')],{'through':'team_has_fax_queues','as':_0x1cab('0x164')});db[_0x1cab('0x51')]['belongsTo'](db[_0x1cab('0x4a')],{});db[_0x1cab('0x51')][_0x1cab('0x11a')](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':'ListId'});db[_0x1cab('0x51')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':'ContactId'});db[_0x1cab('0x51')][_0x1cab('0x11a')](db['FaxInteraction'],{});db[_0x1cab('0x51')][_0x1cab('0x11a')](db['FaxMessage'],{});db['FaxQueueReport'][_0x1cab('0x11a')](db[_0x1cab('0x14')],{});db[_0x1cab('0x51')][_0x1cab('0x11a')](db['FaxQueue'],{});db[_0x1cab('0x52')]['hasMany'](db[_0x1cab('0x7f')],{'as':'Dispositions','foreignKey':_0x1cab('0x178'),'onDelete':_0x1cab('0x10a')});db[_0x1cab('0x52')]['hasMany'](db['CannedAnswer'],{'as':_0x1cab('0x15d'),'foreignKey':_0x1cab('0x178')});db[_0x1cab('0x52')][_0x1cab('0x10b')](db[_0x1cab('0x179')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x1cab('0x52')]['hasMany'](db[_0x1cab('0x54')],{'as':_0x1cab('0x15e')});db[_0x1cab('0x52')]['hasMany'](db[_0x1cab('0x17a')],{'as':_0x1cab('0x172')});db['SmsAccount'][_0x1cab('0x11a')](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0x52')][_0x1cab('0x11a')](db[_0x1cab('0x83')],{'as':_0x1cab('0x147'),'foreignKey':_0x1cab('0x17b')});db[_0x1cab('0x52')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':'user_has_sms_accounts'});db[_0x1cab('0x17a')]['belongsTo'](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x159')});db['SmsApplication'][_0x1cab('0x11a')](db[_0x1cab('0x57')],{'onDelete':_0x1cab('0x159')});db['SmsApplication'][_0x1cab('0x11a')](db['SmsAccount'],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x17a')][_0x1cab('0x11a')](db[_0x1cab('0x81')],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x146')});db[_0x1cab('0x17a')][_0x1cab('0x11a')](db[_0x1cab('0x87')],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x16f')});db[_0x1cab('0x54')]['hasMany'](db['SmsMessage'],{'as':_0x1cab('0x14e'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x17c')});db[_0x1cab('0x54')][_0x1cab('0x11a')](db['SmsAccount'],{'as':'Account','foreignKey':_0x1cab('0x178')});db[_0x1cab('0x54')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x54')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x166'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x54')]['belongsToMany'](db[_0x1cab('0x87')],{'through':_0x1cab('0x17d'),'as':_0x1cab('0x168')});db[_0x1cab('0x54')][_0x1cab('0x11b')](db['Tag'],{'through':_0x1cab('0x17d'),'as':_0x1cab('0x169')});db[_0x1cab('0x54')]['belongsToMany'](db[_0x1cab('0x14')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x1cab('0x179')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':'User'});db[_0x1cab('0x179')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x154')});db[_0x1cab('0x179')]['belongsTo'](db[_0x1cab('0x54')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x1cab('0x17c')});db[_0x1cab('0x179')][_0x1cab('0x11a')](db[_0x1cab('0x52')],{'as':_0x1cab('0x16e'),'foreignKey':'SmsAccountId'});db[_0x1cab('0x57')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':_0x1cab('0x36'),'foreignKey':_0x1cab('0x17e')});db[_0x1cab('0x57')][_0x1cab('0x11b')](db['Team'],{'through':_0x1cab('0x17f'),'as':_0x1cab('0x164')});db[_0x1cab('0x180')]['hasMany'](db['Disposition'],{'as':_0x1cab('0x15c'),'foreignKey':_0x1cab('0x181'),'onDelete':_0x1cab('0x10a')});db[_0x1cab('0x180')][_0x1cab('0x10b')](db[_0x1cab('0x7d')],{'as':_0x1cab('0x15d'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x1cab('0x10b')](db[_0x1cab('0x124')],{'as':_0x1cab('0x15e'),'foreignKey':_0x1cab('0x181')});db[_0x1cab('0x180')]['hasMany'](db[_0x1cab('0x182')],{'as':_0x1cab('0x14e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x1cab('0x5a')],{'as':_0x1cab('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0x1cab('0x180')]['belongsTo'](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':'ListId'});db[_0x1cab('0x180')][_0x1cab('0x11a')](db[_0x1cab('0x83')],{'as':_0x1cab('0x147'),'foreignKey':_0x1cab('0x17b')});db[_0x1cab('0x180')]['belongsToMany'](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0x5a')][_0x1cab('0x11a')](db['OpenchannelQueue'],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x183')});db['OpenchannelApplication'][_0x1cab('0x11a')](db[_0x1cab('0x180')],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x181')});db[_0x1cab('0x5a')][_0x1cab('0x11a')](db[_0x1cab('0x81')],{'onDelete':'restrict','foreignKey':_0x1cab('0x146')});db[_0x1cab('0x5a')]['belongsTo'](db[_0x1cab('0x87')],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x16f')});db[_0x1cab('0x124')][_0x1cab('0x10b')](db[_0x1cab('0x182')],{'as':_0x1cab('0x14e'),'onDelete':'cascade','foreignKey':_0x1cab('0x184')});db[_0x1cab('0x124')][_0x1cab('0x11a')](db[_0x1cab('0x180')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x181')});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0x1cab('0x154'),'foreignKey':'ContactId'});db[_0x1cab('0x124')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x166'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x124')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x185'),'as':_0x1cab('0x168')});db['OpenchannelInteraction']['belongsToMany'](db[_0x1cab('0x87')],{'through':_0x1cab('0x185'),'as':_0x1cab('0x169')});db[_0x1cab('0x124')]['belongsToMany'](db[_0x1cab('0x14')],{'as':_0x1cab('0x16a'),'through':_0x1cab('0x125'),'foreignKey':_0x1cab('0x184')});db[_0x1cab('0x182')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x14')});db['OpenchannelMessage'][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'onDelete':'cascade','as':'Contact'});db['OpenchannelMessage']['belongsTo'](db[_0x1cab('0x124')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x16d'),'foreignKey':_0x1cab('0x184')});db['OpenchannelMessage'][_0x1cab('0x11a')](db[_0x1cab('0x16b')],{'as':_0x1cab('0x16b'),'foreignKey':_0x1cab('0x186')});db['OpenchannelMessage'][_0x1cab('0x11a')](db[_0x1cab('0x180')],{'as':_0x1cab('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x1cab('0x5e')][_0x1cab('0x11b')](db['User'],{'as':_0x1cab('0x149'),'through':'UserOpenchannelQueue','foreignKey':_0x1cab('0x183')});db['OpenchannelQueue'][_0x1cab('0x11b')](db['Team'],{'through':_0x1cab('0x187'),'as':'Teams'});db[_0x1cab('0x60')][_0x1cab('0x10b')](db['Disposition'],{'as':_0x1cab('0x15c'),'foreignKey':_0x1cab('0x188'),'onDelete':'cascade'});db[_0x1cab('0x60')][_0x1cab('0x10b')](db[_0x1cab('0x7d')],{'as':_0x1cab('0x15d'),'foreignKey':_0x1cab('0x188')});db[_0x1cab('0x60')][_0x1cab('0x10b')](db['ChatProactiveAction'],{'as':_0x1cab('0x189')});db[_0x1cab('0x60')][_0x1cab('0x10b')](db[_0x1cab('0x111')],{'as':'Interactions'});db[_0x1cab('0x60')][_0x1cab('0x10b')](db[_0x1cab('0x64')],{'as':'Applications'});db['ChatWebsite'][_0x1cab('0x10b')](db[_0x1cab('0x66')],{'as':_0x1cab('0x14e')});db['ChatWebsite']['belongsTo'](db[_0x1cab('0xea')],{'as':'List','foreignKey':'ListId'});db[_0x1cab('0x60')][_0x1cab('0x11a')](db[_0x1cab('0x81')],{'as':_0x1cab('0x81'),'foreignKey':'IntervalId'});db[_0x1cab('0x60')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'as':_0x1cab('0x3e'),'foreignKey':_0x1cab('0x156')});db[_0x1cab('0x60')]['belongsTo'](db[_0x1cab('0x83')],{'as':_0x1cab('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1cab('0x60')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':_0x1cab('0x18a')});db[_0x1cab('0x62')][_0x1cab('0x11a')](db[_0x1cab('0x180')],{});db[_0x1cab('0x62')][_0x1cab('0x11a')](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0x62')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':'Contact','foreignKey':_0x1cab('0x155')});db[_0x1cab('0x62')][_0x1cab('0x11a')](db['OpenchannelInteraction'],{});db[_0x1cab('0x62')][_0x1cab('0x11a')](db[_0x1cab('0x182')],{});db[_0x1cab('0x62')][_0x1cab('0x11a')](db['User'],{});db[_0x1cab('0x62')][_0x1cab('0x11a')](db[_0x1cab('0x5e')],{});db['ChatApplication']['belongsTo'](db[_0x1cab('0x14')],{'as':_0x1cab('0x18b'),'foreignKey':_0x1cab('0x108'),'onDelete':'restrict'});db['ChatApplication'][_0x1cab('0x11a')](db[_0x1cab('0x69')],{'as':_0x1cab('0x18c'),'foreignKey':_0x1cab('0x18d'),'onDelete':_0x1cab('0x159')});db[_0x1cab('0x64')][_0x1cab('0x11a')](db[_0x1cab('0x60')],{'as':_0x1cab('0x18e'),'foreignKey':_0x1cab('0x188'),'onDelete':_0x1cab('0x159')});db[_0x1cab('0x64')][_0x1cab('0x11a')](db['Tag'],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x16f')});db['ChatInteraction'][_0x1cab('0x10b')](db[_0x1cab('0x66')],{'as':_0x1cab('0x14e'),'onDelete':_0x1cab('0x10a'),'foreignKey':'ChatInteractionId'});db[_0x1cab('0x111')][_0x1cab('0x11a')](db[_0x1cab('0x60')],{'as':_0x1cab('0x16e'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x111')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x166'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x111')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x18f'),'as':_0x1cab('0x168')});db[_0x1cab('0x111')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':'chat_interaction_has_tags','as':_0x1cab('0x169')});db[_0x1cab('0x111')][_0x1cab('0x11b')](db['User'],{'as':'Users','through':_0x1cab('0x190'),'foreignKey':_0x1cab('0x191')});db[_0x1cab('0x66')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x10a'),'as':_0x1cab('0x14')});db[_0x1cab('0x66')]['belongsTo'](db[_0x1cab('0x11f')],{'onDelete':'cascade','as':_0x1cab('0x154'),'foreignKey':'ContactId'});db[_0x1cab('0x66')]['belongsTo'](db[_0x1cab('0x111')],{'onDelete':_0x1cab('0x10a'),'as':'Interaction','foreignKey':_0x1cab('0x191')});db['ChatMessage']['belongsTo'](db[_0x1cab('0x16b')],{'as':_0x1cab('0x16b'),'foreignKey':_0x1cab('0x186')});db[_0x1cab('0x66')][_0x1cab('0x11a')](db[_0x1cab('0x60')],{'as':_0x1cab('0x16e'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x1cab('0x10b')](db[_0x1cab('0x16b')],{'as':_0x1cab('0x16c'),'foreignKey':_0x1cab('0x192'),'onDelete':'cascade','hooks':!![]});db[_0x1cab('0x67')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'onDelete':'cascade','as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x67')][_0x1cab('0x11a')](db[_0x1cab('0x60')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x188')});db[_0x1cab('0x69')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':'UserChatQueue','hooks':!![]});db[_0x1cab('0x69')][_0x1cab('0x11b')](db[_0x1cab('0xdd')],{'through':_0x1cab('0x193'),'as':_0x1cab('0x164')});db[_0x1cab('0x11c')][_0x1cab('0x10b')](db['ChatInternalMessage'],{'as':_0x1cab('0x14e'),'foreignKey':_0x1cab('0x194'),'onDelete':'cascade'});db[_0x1cab('0x11c')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x13e'),'through':'chat_group_has_users'});db[_0x1cab('0x6c')]['belongsTo'](db[_0x1cab('0x60')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x1cab('0x6e')][_0x1cab('0x10b')](db['CmContact'],{'as':_0x1cab('0x195'),'foreignKey':'CompanyId'});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db[_0x1cab('0x89')],{'as':_0x1cab('0x196'),'foreignKey':'CmContactId'});db['CmContact'][_0x1cab('0x10b')](db[_0x1cab('0x71')],{'as':'Hoppers','foreignKey':_0x1cab('0x155')});db[_0x1cab('0x11f')]['hasMany'](db[_0x1cab('0x75')],{'as':'HopperFinals','foreignKey':_0x1cab('0x155')});db[_0x1cab('0x11f')]['hasMany'](db[_0x1cab('0x76')],{'as':_0x1cab('0x197'),'foreignKey':'ContactId'});db['CmContact'][_0x1cab('0x10b')](db[_0x1cab('0x78')],{'as':_0x1cab('0x78'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db[_0x1cab('0xd2')],{'as':_0x1cab('0x198'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db[_0x1cab('0x124')],{'as':'OpenchannelInteractions','foreignKey':_0x1cab('0x155'),'onDelete':_0x1cab('0x159')});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db['ChatInteraction'],{'as':_0x1cab('0x112'),'foreignKey':'ContactId','onDelete':_0x1cab('0x159')});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db[_0x1cab('0x54')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x1cab('0x159')});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db[_0x1cab('0x4d')],{'as':'FaxInteractions','foreignKey':_0x1cab('0x155'),'onDelete':_0x1cab('0x159')});db[_0x1cab('0x11f')][_0x1cab('0x10b')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x1cab('0x155'),'onDelete':_0x1cab('0x159')});db[_0x1cab('0x11f')]['belongsTo'](db[_0x1cab('0x6e')],{'as':_0x1cab('0x199'),'foreignKey':_0x1cab('0x19a')});db[_0x1cab('0x11f')]['belongsTo'](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160'),'onDelete':'cascade'});db['CmContact'][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x16a'),'through':'cm_user_has_contacts'});db[_0x1cab('0x11f')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'as':_0x1cab('0x168'),'through':_0x1cab('0x19b')});db[_0x1cab('0x11f')]['belongsToMany'](db[_0x1cab('0x87')],{'through':'cm_contact_has_tags','as':_0x1cab('0x169')});db[_0x1cab('0x71')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x1cab('0x19c')});db[_0x1cab('0x71')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':'ContactId','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x71')][_0x1cab('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x1cab('0x160'),'onDelete':_0x1cab('0x10a')});db[_0x1cab('0x71')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x18b'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0x71')]['belongsTo'](db[_0x1cab('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x71')][_0x1cab('0x11a')](db[_0x1cab('0x19d')],{'as':_0x1cab('0x19d'),'foreignKey':_0x1cab('0x19e'),'onDelete':_0x1cab('0x10a')});db[_0x1cab('0x71')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':'Owner','foreignKey':_0x1cab('0x19f')});db[_0x1cab('0x73')]['belongsTo'](db[_0x1cab('0x11f')],{'as':'Contact','foreignKey':_0x1cab('0x155'),'onDelete':_0x1cab('0x10a')});db['CmHopperBlack']['belongsTo'](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160'),'onDelete':'cascade'});db[_0x1cab('0x73')][_0x1cab('0x11a')](db['VoiceQueue'],{'as':_0x1cab('0x18c'),'foreignKey':_0x1cab('0x140'),'onDelete':'cascade'});db['CmHopperBlack'][_0x1cab('0x11a')](db[_0x1cab('0x19d')],{'as':_0x1cab('0x19d'),'foreignKey':_0x1cab('0x19e'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x1cab('0x1a0')],{'as':{'plural':_0x1cab('0x1a1'),'singular':_0x1cab('0x1a2')},'foreignKey':_0x1cab('0x1a3'),'onDelete':_0x1cab('0x10a'),'hooks':!![]});db[_0x1cab('0x7b')]['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x1cab('0x1a4'),'onDelete':_0x1cab('0x10a'),'hooks':!![]});db[_0x1cab('0x7b')][_0x1cab('0x10b')](db[_0x1cab('0x7a')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x1cab('0x10a'),'hooks':!![]});db['Disposition'][_0x1cab('0x10b')](db[_0x1cab('0x7f')],{'as':_0x1cab('0x15c'),'foreignKey':'ParentId','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x81')][_0x1cab('0x10b')](db[_0x1cab('0x81')],{'as':_0x1cab('0x1a5'),'foreignKey':_0x1cab('0x146'),'onDelete':_0x1cab('0x10a'),'hooks':!![],'required':![]});db[_0x1cab('0x81')][_0x1cab('0x10b')](db[_0x1cab('0x19')],{'as':_0x1cab('0x10e'),'foreignKey':_0x1cab('0x146'),'onDelete':'restrict'});db['Interval']['hasMany'](db[_0x1cab('0x45')],{'as':_0x1cab('0x1a6'),'foreignKey':_0x1cab('0x146')});db[_0x1cab('0x81')][_0x1cab('0x10b')](db['ChatApplication'],{'as':_0x1cab('0x1a7'),'foreignKey':_0x1cab('0x146')});db[_0x1cab('0x81')][_0x1cab('0x10b')](db[_0x1cab('0x171')],{'as':_0x1cab('0x1a8'),'foreignKey':_0x1cab('0x146')});db[_0x1cab('0x81')][_0x1cab('0x10b')](db[_0x1cab('0x17a')],{'as':_0x1cab('0x1a9'),'foreignKey':_0x1cab('0x146')});db['Schedule'][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{});db[_0x1cab('0x85')][_0x1cab('0x11a')](db[_0x1cab('0x95')],{'foreignKey':_0x1cab('0x1aa')});db[_0x1cab('0x85')][_0x1cab('0x11a')](db[_0x1cab('0x1ab')],{'foreignKey':'CustomReportId'});db[_0x1cab('0x13c')][_0x1cab('0x11b')](db[_0x1cab('0x13b')],{'as':_0x1cab('0x1ac'),'through':_0x1cab('0x13d'),'onDelete':_0x1cab('0x159')});db['Tag'][_0x1cab('0x11b')](db['CmContact'],{'through':_0x1cab('0x19b')});db[_0x1cab('0x87')]['belongsToMany'](db[_0x1cab('0x111')],{'through':_0x1cab('0x18f')});db[_0x1cab('0x87')]['belongsToMany'](db[_0x1cab('0x43')],{'through':_0x1cab('0x167')});db[_0x1cab('0x87')][_0x1cab('0x11b')](db[_0x1cab('0x54')],{'through':_0x1cab('0x17d')});db[_0x1cab('0x87')]['belongsToMany'](db['FaxInteraction'],{'through':_0x1cab('0x176')});db['Tag']['belongsToMany'](db[_0x1cab('0x124')],{'through':'openchannel_interaction_has_tags'});db[_0x1cab('0x87')][_0x1cab('0x11b')](db[_0x1cab('0xf5')],{'through':_0x1cab('0x1ad')});db[_0x1cab('0x89')][_0x1cab('0x11a')](db[_0x1cab('0x1ae')],{'as':_0x1cab('0x1af'),'foreignKey':_0x1cab('0x1b0')});db[_0x1cab('0x1b1')][_0x1cab('0x11a')](db[_0x1cab('0x71')],{'as':'Hopper','foreignKey':_0x1cab('0x19c')});db[_0x1cab('0x89')]['belongsTo'](db['CmContact'],{'as':_0x1cab('0x154'),'foreignKey':'CmContactId'});db[_0x1cab('0x8c')][_0x1cab('0x10b')](db[_0x1cab('0x1a0')],{'as':{'plural':'AllConditions','singular':_0x1cab('0x1b2')},'foreignKey':'TriggerAllId','onDelete':_0x1cab('0x10a'),'hooks':!![]});db['Trigger'][_0x1cab('0x10b')](db[_0x1cab('0x1a0')],{'as':{'plural':_0x1cab('0x1b3'),'singular':_0x1cab('0x1b4')},'foreignKey':_0x1cab('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0x1cab('0x8c')][_0x1cab('0x10b')](db['Action'],{'as':_0x1cab('0x1b6'),'foreignKey':_0x1cab('0x1b7'),'onDelete':_0x1cab('0x10a'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x1cab('0x1b8')],{'as':'Fields','onDelete':_0x1cab('0x10a'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x1cab('0x95')][_0x1cab('0x10b')](db[_0x1cab('0x1b8')],{'as':'Fields','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1aa')});db[_0x1cab('0x98')][_0x1cab('0x10b')](db[_0x1cab('0x1b8')],{'as':_0x1cab('0x1b9'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1ba')});db[_0x1cab('0x1b8')]['belongsTo'](db[_0x1cab('0x98')],{'foreignKey':'MetricId'});db[_0x1cab('0x9a')][_0x1cab('0x10b')](db['SalesforceConfiguration'],{'as':_0x1cab('0x1bb'),'onDelete':_0x1cab('0x10a'),'foreignKey':'AccountId'});db[_0x1cab('0x9c')]['hasMany'](db[_0x1cab('0x9e')],{'as':_0x1cab('0x1bc'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0x9c')][_0x1cab('0x10b')](db[_0x1cab('0x9e')],{'as':_0x1cab('0x1be'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bf')});db['SalesforceConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0x9e')],{'as':'Fields','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0x9c')]['belongsTo'](db[_0x1cab('0x9a')],{'as':_0x1cab('0x16e'),'foreignKey':'AccountId'});db[_0x1cab('0x9e')]['hasMany'](db[_0x1cab('0x9e')],{'as':_0x1cab('0x1c1'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0x9e')][_0x1cab('0x10b')](db[_0x1cab('0x9e')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0x9e')]['hasMany'](db[_0x1cab('0x9e')],{'as':_0x1cab('0x1c3'),'foreignKey':_0x1cab('0x1c0')});db['SalesforceField'][_0x1cab('0x11a')](db['Variable'],{'as':_0x1cab('0x8e'),'foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xa0')][_0x1cab('0x10b')](db[_0x1cab('0xa2')],{'as':_0x1cab('0x1bb'),'onDelete':'cascade','foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xa2')]['hasMany'](db[_0x1cab('0x1c6')],{'as':_0x1cab('0x1bc'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xa2')]['hasMany'](db[_0x1cab('0x1c6')],{'as':_0x1cab('0x1be'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bf')});db['SugarcrmConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0x1c6')],{'as':_0x1cab('0x1b9'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xa2')][_0x1cab('0x11a')](db['SugarcrmAccount'],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0x1c6')][_0x1cab('0x10b')](db[_0x1cab('0x1c6')],{'as':'Subject','foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0x1c6')][_0x1cab('0x10b')](db[_0x1cab('0x1c6')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0x1c6')][_0x1cab('0x10b')](db[_0x1cab('0x1c6')],{'as':_0x1cab('0x1c3'),'foreignKey':'FieldId'});db[_0x1cab('0x1c6')][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':_0x1cab('0x8e'),'foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xa4')][_0x1cab('0x10b')](db[_0x1cab('0xa6')],{'as':_0x1cab('0x1bb'),'onDelete':_0x1cab('0x10a'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0xa8')],{'as':_0x1cab('0x1bc'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bd')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0x1cab('0x10a'),'foreignKey':'DescriptionId'});db[_0x1cab('0xa6')][_0x1cab('0x10b')](db[_0x1cab('0xa8')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x1cab('0xa6')][_0x1cab('0x11a')](db[_0x1cab('0xa4')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xa6')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x1c7')});db[_0x1cab('0xa8')][_0x1cab('0x10b')](db[_0x1cab('0xa8')],{'as':_0x1cab('0x1c1'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xa8')][_0x1cab('0x10b')](db[_0x1cab('0xa8')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db['DeskField'][_0x1cab('0x10b')](db[_0x1cab('0xa8')],{'as':_0x1cab('0x1c3'),'foreignKey':'FieldId'});db['DeskField'][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':'Variable','foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xa9')][_0x1cab('0x10b')](db[_0x1cab('0xaa')],{'as':_0x1cab('0x1bb'),'onDelete':_0x1cab('0x10a'),'foreignKey':'AccountId'});db[_0x1cab('0xaa')]['hasMany'](db['ZohoField'],{'as':_0x1cab('0x1bc'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bd')});db['ZohoConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0xab')],{'as':_0x1cab('0x1be'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xaa')][_0x1cab('0x10b')](db[_0x1cab('0xab')],{'as':_0x1cab('0x1b9'),'onDelete':_0x1cab('0x10a'),'foreignKey':'FieldId'});db[_0x1cab('0xaa')][_0x1cab('0x11a')](db[_0x1cab('0xa9')],{'as':'Account','foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xab')]['hasMany'](db[_0x1cab('0xab')],{'as':_0x1cab('0x1c1'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xab')]['hasMany'](db[_0x1cab('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1cab('0xab')]['hasMany'](db[_0x1cab('0xab')],{'as':_0x1cab('0x1c3'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xab')][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':_0x1cab('0x8e'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x1cab('0x1c8')],{'as':_0x1cab('0x1bb'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0x1c8')]['hasMany'](db['ZendeskField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0xaf')],{'as':_0x1cab('0x1be'),'foreignKey':'DescriptionId'});db[_0x1cab('0x1c8')][_0x1cab('0x10b')](db['ZendeskField'],{'as':_0x1cab('0x1b9'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0x1c8')]['belongsTo'](db[_0x1cab('0x1c9')],{'as':'Account','foreignKey':'AccountId'});db[_0x1cab('0x1c8')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x1ca')});db['ZendeskField'][_0x1cab('0x10b')](db['ZendeskField'],{'as':_0x1cab('0x1c1'),'foreignKey':'SubjectId'});db[_0x1cab('0xaf')][_0x1cab('0x10b')](db[_0x1cab('0xaf')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xaf')][_0x1cab('0x10b')](db['ZendeskField'],{'as':_0x1cab('0x1c3'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xaf')][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':_0x1cab('0x8e'),'foreignKey':_0x1cab('0x1c4')});db['FreshdeskAccount']['hasMany'](db[_0x1cab('0xb2')],{'as':'Configurations','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c5')});db['FreshdeskConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0xb4')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xb2')][_0x1cab('0x10b')](db[_0x1cab('0xb4')],{'as':'Descriptions','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xb2')][_0x1cab('0x10b')](db['FreshdeskField'],{'as':_0x1cab('0x1b9'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xb2')][_0x1cab('0x11a')](db['FreshdeskAccount'],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xb2')][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x1cb')});db[_0x1cab('0xb4')]['hasMany'](db[_0x1cab('0xb4')],{'as':_0x1cab('0x1c1'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xb4')][_0x1cab('0x10b')](db[_0x1cab('0xb4')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xb4')]['hasMany'](db[_0x1cab('0xb4')],{'as':'Field','foreignKey':_0x1cab('0x1c0')});db['FreshdeskField'][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':'Variable','foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xb6')][_0x1cab('0x10b')](db[_0x1cab('0xb8')],{'as':_0x1cab('0x1bb'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c5')});db['VtigerConfiguration'][_0x1cab('0x10b')](db[_0x1cab('0xb9')],{'as':'Subjects','foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xb8')][_0x1cab('0x10b')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xb8')]['hasMany'](db[_0x1cab('0xb9')],{'as':_0x1cab('0x1b9'),'foreignKey':_0x1cab('0x1c0')});db['VtigerConfiguration'][_0x1cab('0x11a')](db[_0x1cab('0xb6')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db['VtigerField']['hasMany'](db[_0x1cab('0xb9')],{'as':'Subject','foreignKey':'SubjectId'});db['VtigerField'][_0x1cab('0x10b')](db[_0x1cab('0xb9')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xb9')][_0x1cab('0x10b')](db['VtigerField'],{'as':_0x1cab('0x1c3'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xb9')][_0x1cab('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xbb')][_0x1cab('0x10b')](db[_0x1cab('0xbd')],{'as':'Configurations','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xbd')]['hasMany'](db['ServicenowField'],{'as':_0x1cab('0x1bc'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xbd')][_0x1cab('0x10b')](db[_0x1cab('0xbe')],{'as':_0x1cab('0x1be'),'foreignKey':'DescriptionId'});db[_0x1cab('0xbd')][_0x1cab('0x10b')](db['ServicenowField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x1cab('0xbd')][_0x1cab('0x11a')](db[_0x1cab('0xbb')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xbe')][_0x1cab('0x10b')](db[_0x1cab('0xbe')],{'as':_0x1cab('0x1c1'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xbe')][_0x1cab('0x10b')](db[_0x1cab('0xbe')],{'as':'Description','foreignKey':_0x1cab('0x1bf')});db['ServicenowField'][_0x1cab('0x10b')](db['ServicenowField'],{'as':_0x1cab('0x1c3'),'foreignKey':_0x1cab('0x1c0')});db['ServicenowField'][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':_0x1cab('0x8e'),'foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xc0')][_0x1cab('0x10b')](db[_0x1cab('0xc2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xc0')]['belongsTo'](db[_0x1cab('0xfe')],{'as':_0x1cab('0xfe'),'foreignKey':_0x1cab('0x157')});db['Dynamics365Configuration'][_0x1cab('0x10b')](db[_0x1cab('0xc4')],{'as':_0x1cab('0x1bc'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x1cab('0xc2')][_0x1cab('0x10b')](db[_0x1cab('0xc4')],{'as':_0x1cab('0x1be'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xc2')][_0x1cab('0x10b')](db[_0x1cab('0xc4')],{'as':_0x1cab('0x1b9'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xc2')][_0x1cab('0x11a')](db[_0x1cab('0xc0')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xc4')][_0x1cab('0x10b')](db[_0x1cab('0xc4')],{'as':_0x1cab('0x1c1'),'foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xc4')]['hasMany'](db[_0x1cab('0xc4')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xc4')][_0x1cab('0x10b')](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field'][_0x1cab('0x11a')](db[_0x1cab('0x8e')],{'as':'Variable','foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xc6')][_0x1cab('0x10b')](db[_0x1cab('0xc7')],{'as':'Configurations','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1c5')});db['FreshsalesConfiguration']['hasMany'](db[_0x1cab('0xc8')],{'as':'Subjects','foreignKey':_0x1cab('0x1bd')});db[_0x1cab('0xc7')]['hasMany'](db['FreshsalesField'],{'as':_0x1cab('0x1be'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xc7')][_0x1cab('0x10b')](db[_0x1cab('0xc8')],{'as':_0x1cab('0x1b9'),'foreignKey':'FieldId'});db[_0x1cab('0xc7')]['belongsTo'](db[_0x1cab('0xc6')],{'as':_0x1cab('0x16e'),'foreignKey':_0x1cab('0x1c5')});db[_0x1cab('0xc8')]['hasMany'](db[_0x1cab('0xc8')],{'as':_0x1cab('0x1c1'),'foreignKey':'SubjectId'});db[_0x1cab('0xc8')][_0x1cab('0x10b')](db[_0x1cab('0xc8')],{'as':_0x1cab('0x1c2'),'foreignKey':_0x1cab('0x1bf')});db[_0x1cab('0xc8')][_0x1cab('0x10b')](db[_0x1cab('0xc8')],{'as':_0x1cab('0x1c3'),'foreignKey':_0x1cab('0x1c0')});db[_0x1cab('0xc8')][_0x1cab('0x11a')](db['Variable'],{'as':_0x1cab('0x8e'),'foreignKey':_0x1cab('0x1c4')});db[_0x1cab('0xcc')][_0x1cab('0x11a')](db['ChatWebsite'],{});db[_0x1cab('0xcc')][_0x1cab('0x11a')](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xcc')]['belongsTo'](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0xcc')][_0x1cab('0x11a')](db[_0x1cab('0x111')],{});db[_0x1cab('0xcc')][_0x1cab('0x11a')](db['ChatMessage'],{});db[_0x1cab('0xcc')]['belongsTo'](db['User'],{});db[_0x1cab('0xcc')][_0x1cab('0x11a')](db[_0x1cab('0x69')],{});db[_0x1cab('0xce')]['belongsTo'](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1cc')});db['ChatInternalMessage'][_0x1cab('0x11a')](db['User'],{'onDelete':'cascade','foreignKey':_0x1cab('0x1cd')});db[_0x1cab('0xd2')][_0x1cab('0x10b')](db[_0x1cab('0x1ce')],{'foreignKey':_0x1cab('0x1cf'),'onDelete':'cascade'});db['JscriptySessionReport']['hasMany'](db[_0x1cab('0xd0')],{'foreignKey':_0x1cab('0x1cf'),'onDelete':_0x1cab('0x10a')});db['SmsQueueReport']['belongsTo'](db[_0x1cab('0x52')],{});db[_0x1cab('0xd4')]['belongsTo'](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xd4')][_0x1cab('0x11a')](db['CmContact'],{'as':_0x1cab('0x154'),'foreignKey':'ContactId'});db[_0x1cab('0xd4')][_0x1cab('0x11a')](db[_0x1cab('0x54')],{});db[_0x1cab('0xd4')][_0x1cab('0x11a')](db['SmsMessage'],{});db[_0x1cab('0xd4')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{});db['SmsQueueReport']['belongsTo'](db[_0x1cab('0x57')],{});db[_0x1cab('0xd8')][_0x1cab('0x10b')](db[_0x1cab('0xd2')],{'foreignKey':_0x1cab('0x1d0')});db['JscriptyProject']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x1cab('0xd8')][_0x1cab('0x10b')](db[_0x1cab('0xd0')],{'foreignKey':_0x1cab('0x1d0')});db[_0x1cab('0xdd')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':_0x1cab('0x121')});db[_0x1cab('0xdd')]['belongsToMany'](db[_0x1cab('0x1b')],{'through':'TeamVoiceQueue','as':_0x1cab('0x1d1')});db['Team'][_0x1cab('0x11b')](db[_0x1cab('0x3f')],{'through':_0x1cab('0x163'),'as':_0x1cab('0x128')});db[_0x1cab('0xdd')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x1cab('0x129')});db[_0x1cab('0xdd')]['belongsToMany'](db[_0x1cab('0x12a')],{'through':_0x1cab('0x1d2'),'as':'FaxQueues'});db[_0x1cab('0xdd')][_0x1cab('0x11b')](db[_0x1cab('0x57')],{'through':_0x1cab('0x17f'),'as':_0x1cab('0x12c')});db['Team'][_0x1cab('0x11b')](db[_0x1cab('0x5e')],{'through':_0x1cab('0x187'),'as':_0x1cab('0x12d')});db[_0x1cab('0xdd')][_0x1cab('0x11b')](db[_0x1cab('0xfd')],{'through':_0x1cab('0x1d3'),'as':'WhatsappQueues'});db[_0x1cab('0xdd')][_0x1cab('0x11b')](db['VoicePrefix'],{'through':_0x1cab('0x101'),'as':_0x1cab('0x127')});db[_0x1cab('0x19d')][_0x1cab('0x10b')](db[_0x1cab('0x71')],{'as':_0x1cab('0x13f'),'foreignKey':'CampaignId'});db[_0x1cab('0x19d')][_0x1cab('0x10b')](db[_0x1cab('0x75')],{'as':_0x1cab('0x141'),'foreignKey':_0x1cab('0x19e')});db[_0x1cab('0x19d')][_0x1cab('0x10b')](db[_0x1cab('0x76')],{'as':_0x1cab('0x197'),'foreignKey':_0x1cab('0x19e')});db[_0x1cab('0x19d')][_0x1cab('0x10b')](db[_0x1cab('0x73')],{'as':_0x1cab('0x142'),'foreignKey':_0x1cab('0x19e')});db[_0x1cab('0x19d')][_0x1cab('0x11a')](db[_0x1cab('0x143')],{'as':_0x1cab('0x143'),'foreignKey':_0x1cab('0x144')});db[_0x1cab('0x19d')][_0x1cab('0x11a')](db[_0x1cab('0x143')],{'as':_0x1cab('0x145'),'foreignKey':_0x1cab('0x1d4')});db[_0x1cab('0x19d')][_0x1cab('0x11a')](db[_0x1cab('0x81')],{'as':_0x1cab('0x81'),'foreignKey':_0x1cab('0x146')});db[_0x1cab('0x19d')][_0x1cab('0x11a')](db[_0x1cab('0x1d5')],{'as':_0x1cab('0x1d5'),'foreignKey':'SquareProjectId'});db[_0x1cab('0x19d')][_0x1cab('0x11b')](db[_0x1cab('0xea')],{'as':_0x1cab('0x1d6'),'through':_0x1cab('0x1d7')});db[_0x1cab('0x19d')][_0x1cab('0x11b')](db[_0x1cab('0xea')],{'as':_0x1cab('0x14b'),'through':_0x1cab('0x1d8')});db[_0x1cab('0x16b')]['belongsTo'](db[_0x1cab('0x67')],{'as':_0x1cab('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0x1cab('0xe2')][_0x1cab('0x11a')](db[_0x1cab('0x44')],{});db['MailTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x43')],{});db[_0x1cab('0xe2')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'foreignKey':_0x1cab('0x1d9'),'as':_0x1cab('0x1da')});db[_0x1cab('0xe2')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1db'),'as':_0x1cab('0x1dc')});db[_0x1cab('0xe2')]['belongsTo'](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1dd'),'as':'ToAgent'});db[_0x1cab('0xe2')][_0x1cab('0x11a')](db[_0x1cab('0x3f')],{'foreignKey':_0x1cab('0x1de'),'as':_0x1cab('0x1df')});db[_0x1cab('0xe2')][_0x1cab('0x11a')](db[_0x1cab('0x3e')],{'foreignKey':_0x1cab('0x1e0'),'as':_0x1cab('0x1e1')});db[_0x1cab('0xe4')][_0x1cab('0x11a')](db[_0x1cab('0x66')],{});db['ChatTransferReport']['belongsTo'](db[_0x1cab('0x111')],{});db[_0x1cab('0xe4')][_0x1cab('0x11a')](db['ChatWebsite'],{'foreignKey':_0x1cab('0x1e2'),'as':'FromAccount'});db['ChatTransferReport'][_0x1cab('0x11a')](db['User'],{'foreignKey':_0x1cab('0x1db'),'as':_0x1cab('0x1dc')});db['ChatTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':'ToUserId','as':_0x1cab('0x1e3')});db[_0x1cab('0xe4')]['belongsTo'](db[_0x1cab('0x69')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x1cab('0xe4')]['belongsTo'](db[_0x1cab('0x60')],{'foreignKey':_0x1cab('0x1e4'),'as':_0x1cab('0x1e1')});db['FaxTransferReport']['belongsTo'](db[_0x1cab('0x174')],{});db['FaxTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x4d')],{});db[_0x1cab('0xe5')][_0x1cab('0x11a')](db['FaxAccount'],{'foreignKey':_0x1cab('0x1e5'),'as':_0x1cab('0x1da')});db[_0x1cab('0xe5')][_0x1cab('0x11a')](db['User'],{'foreignKey':_0x1cab('0x1db'),'as':_0x1cab('0x1dc')});db[_0x1cab('0xe5')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1dd'),'as':_0x1cab('0x1e3')});db[_0x1cab('0xe5')][_0x1cab('0x11a')](db[_0x1cab('0x12a')],{'foreignKey':_0x1cab('0x1e6'),'as':_0x1cab('0x1df')});db[_0x1cab('0xe5')][_0x1cab('0x11a')](db[_0x1cab('0x4a')],{'foreignKey':_0x1cab('0x1e7'),'as':_0x1cab('0x1e1')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x124')],{});db['OpenchannelTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x180')],{'foreignKey':_0x1cab('0x1e8'),'as':_0x1cab('0x1da')});db[_0x1cab('0x1e9')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1db'),'as':_0x1cab('0x1dc')});db[_0x1cab('0x1e9')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':'ToUserId','as':_0x1cab('0x1e3')});db['OpenchannelTransferReport']['belongsTo'](db[_0x1cab('0x5e')],{'foreignKey':_0x1cab('0x1ea'),'as':_0x1cab('0x1df')});db['OpenchannelTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x180')],{'foreignKey':_0x1cab('0x1eb'),'as':_0x1cab('0x1e1')});db[_0x1cab('0xe8')][_0x1cab('0x11a')](db[_0x1cab('0x179')],{});db[_0x1cab('0xe8')]['belongsTo'](db[_0x1cab('0x54')],{});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0x1cab('0x1ec'),'as':_0x1cab('0x1da')});db[_0x1cab('0xe8')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1db'),'as':_0x1cab('0x1dc')});db[_0x1cab('0xe8')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1dd'),'as':_0x1cab('0x1e3')});db['SmsTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x57')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0x52')],{'foreignKey':_0x1cab('0x1ed'),'as':'ToAccount'});db['CmList'][_0x1cab('0x10b')](db['Disposition'],{'as':_0x1cab('0x15c'),'foreignKey':_0x1cab('0x160'),'onDelete':_0x1cab('0x10a')});db[_0x1cab('0xea')][_0x1cab('0x10b')](db[_0x1cab('0x1ee')],{'as':_0x1cab('0x1ef'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xea')][_0x1cab('0x10b')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x195'),'onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xea')]['hasMany'](db[_0x1cab('0x75')],{'as':_0x1cab('0x141'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xea')][_0x1cab('0x10b')](db[_0x1cab('0x76')],{'as':_0x1cab('0x10f'),'foreignKey':_0x1cab('0x160')});db['CmList'][_0x1cab('0x10b')](db[_0x1cab('0x78')],{'as':_0x1cab('0x78'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xea')][_0x1cab('0x11b')](db[_0x1cab('0x1b')],{'as':_0x1cab('0x1f0'),'through':_0x1cab('0x148')});db[_0x1cab('0xea')]['belongsToMany'](db['User'],{'as':_0x1cab('0x149'),'through':_0x1cab('0x120')});db[_0x1cab('0xeb')][_0x1cab('0x10b')](db[_0x1cab('0x19')],{'as':_0x1cab('0x10e'),'onDelete':_0x1cab('0x10a')});db[_0x1cab('0xeb')]['belongsToMany'](db['User'],{'as':_0x1cab('0x149'),'through':'UserVoicePrefix'});db['VoicePrefix']['belongsToMany'](db[_0x1cab('0xdd')],{'through':'TeamVoicePrefix','as':_0x1cab('0x164')});db[_0x1cab('0xed')][_0x1cab('0x10b')](db['User'],{'as':'Users','foreignKey':_0x1cab('0x1f1')});db[_0x1cab('0xed')]['hasMany'](db[_0x1cab('0x1f2')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x1cab('0x10a')});db[_0x1cab('0x1f2')][_0x1cab('0x10b')](db[_0x1cab('0xef')],{'as':_0x1cab('0x1f3'),'foreignKey':_0x1cab('0x1f4'),'onDelete':_0x1cab('0x10a')});db['WhatsappAccount'][_0x1cab('0x10b')](db[_0x1cab('0x7f')],{'as':_0x1cab('0x15c'),'foreignKey':_0x1cab('0x1f5'),'onDelete':'cascade'});db[_0x1cab('0x137')][_0x1cab('0x10b')](db[_0x1cab('0x7d')],{'as':_0x1cab('0x15d'),'foreignKey':_0x1cab('0x1f5')});db[_0x1cab('0x137')][_0x1cab('0x10b')](db[_0x1cab('0xf7')],{'as':_0x1cab('0x14e'),'foreignKey':_0x1cab('0x1f5')});db[_0x1cab('0x137')][_0x1cab('0x10b')](db[_0x1cab('0xf5')],{'as':_0x1cab('0x15e')});db['WhatsappAccount']['hasMany'](db[_0x1cab('0xf3')],{'as':_0x1cab('0x172')});db[_0x1cab('0x137')]['belongsTo'](db[_0x1cab('0xea')],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0x137')][_0x1cab('0x11a')](db[_0x1cab('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x1cab('0x17b')});db[_0x1cab('0x137')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':_0x1cab('0x138')});db[_0x1cab('0xf3')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'onDelete':_0x1cab('0x159')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0xf3')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x1cab('0x159')});db[_0x1cab('0xf3')][_0x1cab('0x11a')](db[_0x1cab('0x81')],{'onDelete':_0x1cab('0x159'),'foreignKey':'IntervalId'});db[_0x1cab('0xf3')][_0x1cab('0x11a')](db['Tag'],{'onDelete':_0x1cab('0x159'),'foreignKey':_0x1cab('0x16f')});db[_0x1cab('0xf5')][_0x1cab('0x10b')](db[_0x1cab('0xf7')],{'as':'Messages','onDelete':_0x1cab('0x10a'),'foreignKey':_0x1cab('0x1f6')});db[_0x1cab('0xf5')][_0x1cab('0x11a')](db[_0x1cab('0x137')],{'as':'Account','foreignKey':_0x1cab('0x1f5')});db[_0x1cab('0xf5')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':'ContactId'});db[_0x1cab('0xf5')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x166'),'foreignKey':_0x1cab('0x108')});db[_0x1cab('0xf5')]['belongsToMany'](db['Tag'],{'through':_0x1cab('0x1ad'),'as':_0x1cab('0x168')});db['WhatsappInteraction'][_0x1cab('0x11b')](db[_0x1cab('0x87')],{'through':_0x1cab('0x1ad'),'as':_0x1cab('0x169')});db[_0x1cab('0xf5')][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x16a'),'through':_0x1cab('0x126'),'foreignKey':_0x1cab('0x1f6')});db[_0x1cab('0xf7')][_0x1cab('0x11a')](db['User'],{'as':_0x1cab('0x14')});db['WhatsappMessage'][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'onDelete':'cascade','as':_0x1cab('0x154')});db[_0x1cab('0xf7')][_0x1cab('0x11a')](db['WhatsappInteraction'],{'onDelete':_0x1cab('0x10a'),'as':'Interaction','foreignKey':_0x1cab('0x1f6')});db[_0x1cab('0xf7')][_0x1cab('0x11a')](db[_0x1cab('0x137')],{'as':_0x1cab('0x16e'),'foreignKey':'WhatsappAccountId'});db[_0x1cab('0xf9')][_0x1cab('0x11a')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x1cab('0x11a')](db['CmList'],{'as':_0x1cab('0x15f'),'foreignKey':_0x1cab('0x160')});db[_0x1cab('0xf9')][_0x1cab('0x11a')](db[_0x1cab('0x11f')],{'as':_0x1cab('0x154'),'foreignKey':_0x1cab('0x155')});db[_0x1cab('0xf9')][_0x1cab('0x11a')](db['WhatsappInteraction'],{});db[_0x1cab('0xf9')][_0x1cab('0x11a')](db[_0x1cab('0xfd')],{});db[_0x1cab('0xf9')]['belongsTo'](db[_0x1cab('0xf7')],{});db[_0x1cab('0xf9')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{});db[_0x1cab('0xfb')][_0x1cab('0x11a')](db[_0x1cab('0xf7')],{});db[_0x1cab('0xfb')][_0x1cab('0x11a')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x1cab('0x11a')](db['WhatsappAccount'],{'foreignKey':_0x1cab('0x1f7'),'as':'FromAccount'});db[_0x1cab('0xfb')][_0x1cab('0x11a')](db[_0x1cab('0x137')],{'foreignKey':_0x1cab('0x1f8'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x1cab('0x11a')](db[_0x1cab('0xfd')],{'foreignKey':_0x1cab('0x1f9'),'as':_0x1cab('0x1df')});db[_0x1cab('0xfb')]['belongsTo'](db[_0x1cab('0x14')],{'foreignKey':'FromUserId','as':_0x1cab('0x1dc')});db[_0x1cab('0xfb')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'foreignKey':_0x1cab('0x1dd'),'as':_0x1cab('0x1e3')});db['WhatsappQueue'][_0x1cab('0x11b')](db[_0x1cab('0x14')],{'as':_0x1cab('0x149'),'through':_0x1cab('0x12f'),'foreignKey':_0x1cab('0x1fa')});db[_0x1cab('0xfd')][_0x1cab('0x11b')](db[_0x1cab('0xdd')],{'through':_0x1cab('0x1d3'),'as':'Teams'});db[_0x1cab('0x105')][_0x1cab('0x11a')](db[_0x1cab('0x14')],{'as':_0x1cab('0x1fb'),'foreignKey':'UserId','onDelete':_0x1cab('0x10a'),'hooks':!![]});db[_0x1cab('0xfe')][_0x1cab('0x107')](db[_0x1cab('0xc0')],{'as':_0x1cab('0xc0'),'onDelete':_0x1cab('0x159')});db[_0x1cab('0xfe')][_0x1cab('0x107')](db[_0x1cab('0x3b')],{'as':_0x1cab('0x15a'),'onDelete':_0x1cab('0x159')});db['CloudProvider'][_0x1cab('0x107')](db[_0x1cab('0x158')],{'as':_0x1cab('0x15b'),'onDelete':_0x1cab('0x159')});module[_0x1cab('0x1fc')]={'db':db,'dbH':dbH};
\ No newline at end of file
index 24628e0..d55bf12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed66=['./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/campaign','/api/migrations','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/schedules','./api/schedule','/api/sounds'];(function(_0x24574b,_0x43a78e){var _0x107420=function(_0x4534c3){while(--_0x4534c3){_0x24574b['push'](_0x24574b['shift']());}};_0x107420(++_0x43a78e);}(_0xed66,0x1c6));var _0x6ed6=function(_0x1432a6,_0x5846c5){_0x1432a6=_0x1432a6-0x0;var _0x3eab00=_0xed66[_0x1432a6];return _0x3eab00;};'use strict';var path=require(_0x6ed6('0x0'));var express=require('express');var errors=require(_0x6ed6('0x1'));var config=require(_0x6ed6('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x6ed6('0x3')];var clientSideLogs=require(_0x6ed6('0x4'));exports[_0x6ed6('0x5')]=function(_0x571428){return setupLoggers(_0x571428)[_0x6ed6('0x6')](function(){_0x571428[_0x6ed6('0x7')](_0x6ed6('0x8'),require(_0x6ed6('0x9')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xa'),require(_0x6ed6('0xb')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xc'),require(_0x6ed6('0xd')));_0x571428[_0x6ed6('0x7')]('/api/voice/extensions',require(_0x6ed6('0xe')));_0x571428['use'](_0x6ed6('0xf'),require(_0x6ed6('0x10')));_0x571428['use']('/api/voice/queues',require(_0x6ed6('0x11')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x12'),require(_0x6ed6('0x13')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x14'),require(_0x6ed6('0x15')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x16'),require('./api/voiceMail'));_0x571428[_0x6ed6('0x7')]('/api/voice/mails/messages',require(_0x6ed6('0x17')));_0x571428['use'](_0x6ed6('0x18'),require(_0x6ed6('0x19')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x1a'),require(_0x6ed6('0x1b')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x1c'),require(_0x6ed6('0x1d')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x1e'),require(_0x6ed6('0x1f')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x20'),require(_0x6ed6('0x21')));_0x571428['use']('/api/trunks',require(_0x6ed6('0x22')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x23'),require(_0x6ed6('0x24')));_0x571428[_0x6ed6('0x7')]('/api/mail/out_servers',require(_0x6ed6('0x25')));_0x571428['use']('/api/mail/accounts',require(_0x6ed6('0x26')));_0x571428[_0x6ed6('0x7')]('/api/mail/queues',require('./api/mailQueue'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x27'),require(_0x6ed6('0x28')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x29'),require(_0x6ed6('0x2a')));_0x571428['use']('/api/mail/messages',require(_0x6ed6('0x2b')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x2c'),require('./api/mailApplication'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x2d'),require('./api/mailQueueReport'));_0x571428[_0x6ed6('0x7')]('/api/dashboards',require(_0x6ed6('0x2e')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x2f'),require(_0x6ed6('0x30')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x31'),require(_0x6ed6('0x32')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x33'),require(_0x6ed6('0x34')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x35'),require(_0x6ed6('0x36')));_0x571428['use'](_0x6ed6('0x37'),require(_0x6ed6('0x38')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x39'),require(_0x6ed6('0x3a')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x3b'),require(_0x6ed6('0x3c')));_0x571428[_0x6ed6('0x7')]('/api/sms/accounts',require(_0x6ed6('0x3d')));_0x571428[_0x6ed6('0x7')]('/api/sms/applications',require(_0x6ed6('0x3e')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x3f'),require(_0x6ed6('0x40')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x41'),require('./api/smsMessage'));_0x571428[_0x6ed6('0x7')]('/api/sms/queues',require(_0x6ed6('0x42')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x43'),require(_0x6ed6('0x44')));_0x571428['use'](_0x6ed6('0x45'),require('./api/openchannelApplication'));_0x571428[_0x6ed6('0x7')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x46'),require(_0x6ed6('0x47')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x48'),require('./api/openchannelQueue'));_0x571428[_0x6ed6('0x7')]('/api/chat/websites',require(_0x6ed6('0x49')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x4a'),require('./api/openchannelQueueReport'));_0x571428['use']('/api/chat/applications',require(_0x6ed6('0x4b')));_0x571428[_0x6ed6('0x7')]('/api/chat/interactions',require(_0x6ed6('0x4c')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x4d'),require(_0x6ed6('0x4e')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x4f'),require(_0x6ed6('0x50')));_0x571428['use']('/api/chat/queues',require(_0x6ed6('0x51')));_0x571428['use'](_0x6ed6('0x52'),require('./api/chatGroup'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x53'),require('./api/chatProactiveAction'));_0x571428[_0x6ed6('0x7')]('/api/cm/companies',require(_0x6ed6('0x54')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x55'),require(_0x6ed6('0x56')));_0x571428[_0x6ed6('0x7')]('/api/cm/hopper',require(_0x6ed6('0x57')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x58'),require(_0x6ed6('0x59')));_0x571428['use'](_0x6ed6('0x5a'),require(_0x6ed6('0x5b')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x5c'),require('./api/cmHopperHistory'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x5d'),require(_0x6ed6('0x5e')));_0x571428[_0x6ed6('0x7')]('/api/actions',require(_0x6ed6('0x5f')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x60'),require('./api/automation'));_0x571428[_0x6ed6('0x7')]('/api/canned_answers',require('./api/cannedAnswer'));_0x571428['use']('/api/dispositions',require('./api/disposition'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x61'),require(_0x6ed6('0x62')));_0x571428[_0x6ed6('0x7')]('/api/intervals',require(_0x6ed6('0x63')));_0x571428[_0x6ed6('0x7')]('/api/pauses',require(_0x6ed6('0x64')));_0x571428['use'](_0x6ed6('0x65'),require(_0x6ed6('0x66')));_0x571428['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x67'),require(_0x6ed6('0x68')));_0x571428['use'](_0x6ed6('0x69'),require(_0x6ed6('0x6a')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x6b'),require(_0x6ed6('0x6c')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x6d'),require(_0x6ed6('0x6e')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x6f'),require('./api/cmContactHasItem'));_0x571428['use'](_0x6ed6('0x70'),require('./api/cmHopperAdditionalPhone'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x71'),require('./api/template'));_0x571428['use'](_0x6ed6('0x72'),require(_0x6ed6('0x73')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x74'),require(_0x6ed6('0x75')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x76'),require(_0x6ed6('0x77')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x78'),require(_0x6ed6('0x79')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x7a'),require(_0x6ed6('0x7b')));_0x571428['use'](_0x6ed6('0x7c'),require(_0x6ed6('0x7d')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x7e'),require(_0x6ed6('0x7f')));_0x571428['use'](_0x6ed6('0x80'),require(_0x6ed6('0x81')));_0x571428['use'](_0x6ed6('0x82'),require(_0x6ed6('0x83')));_0x571428['use'](_0x6ed6('0x84'),require(_0x6ed6('0x85')));_0x571428['use'](_0x6ed6('0x86'),require(_0x6ed6('0x87')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x88'),require(_0x6ed6('0x89')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x8a'),require(_0x6ed6('0x8b')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x8c'),require('./api/intSugarcrmAccount'));_0x571428['use'](_0x6ed6('0x8d'),require(_0x6ed6('0x8e')));_0x571428[_0x6ed6('0x7')]('/api/integrations/sugarcrm/fields',require(_0x6ed6('0x8f')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x90'),require(_0x6ed6('0x91')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x92'),require(_0x6ed6('0x93')));_0x571428['use'](_0x6ed6('0x94'),require(_0x6ed6('0x95')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x96'),require(_0x6ed6('0x97')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x98'),require(_0x6ed6('0x99')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x9a'),require(_0x6ed6('0x9b')));_0x571428['use'](_0x6ed6('0x9c'),require(_0x6ed6('0x9d')));_0x571428[_0x6ed6('0x7')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x9e'),require(_0x6ed6('0x9f')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xa0'),require(_0x6ed6('0xa1')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xa2'),require(_0x6ed6('0xa3')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xa4'),require(_0x6ed6('0xa5')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xa6'),require(_0x6ed6('0xa7')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xa8'),require('./api/intVtigerConfiguration'));_0x571428['use']('/api/integrations/vtiger/fields',require(_0x6ed6('0xa9')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xaa'),require(_0x6ed6('0xab')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xac'),require(_0x6ed6('0xad')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xae'),require('./api/intServicenowField'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xaf'),require(_0x6ed6('0xb0')));_0x571428['use'](_0x6ed6('0xb1'),require(_0x6ed6('0xb2')));_0x571428[_0x6ed6('0x7')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xb3'),require(_0x6ed6('0xb4')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xb5'),require(_0x6ed6('0xb6')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xb7'),require(_0x6ed6('0xb8')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xb9'),require('./api/network'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xba'),require(_0x6ed6('0xbb')));_0x571428['use'](_0x6ed6('0xbc'),require(_0x6ed6('0xbd')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xbe'),require('./api/jscriptyAnswerReport'));_0x571428['use'](_0x6ed6('0xbf'),require(_0x6ed6('0xc0')));_0x571428['use'](_0x6ed6('0xc1'),require(_0x6ed6('0xc2')));_0x571428[_0x6ed6('0x7')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x571428['use'](_0x6ed6('0xc3'),require(_0x6ed6('0xc4')));_0x571428['use'](_0x6ed6('0xc5'),require(_0x6ed6('0xc6')));_0x571428['use'](_0x6ed6('0xc7'),require(_0x6ed6('0xc8')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xc9'),require(_0x6ed6('0xca')));_0x571428['use'](_0x6ed6('0xcb'),require('./api/squareOdbc'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xcc'),require(_0x6ed6('0xcd')));_0x571428['use'](_0x6ed6('0xce'),require(_0x6ed6('0xcf')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xd0'),require(_0x6ed6('0xd1')));_0x571428['use']('/api/teams',require(_0x6ed6('0xd2')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xd3'),require('./api/license'));_0x571428[_0x6ed6('0x7')]('/api/campaigns',require(_0x6ed6('0xd4')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xd5'),require('./api/migration'));_0x571428[_0x6ed6('0x7')]('/api/attachments',require(_0x6ed6('0xd6')));_0x571428['use']('/api/plugins',require(_0x6ed6('0xd7')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xd8'),require('./api/mailTransferReport'));_0x571428['use'](_0x6ed6('0xd9'),require('./api/chatTransferReport'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xda'),require('./api/faxTransferReport'));_0x571428['use'](_0x6ed6('0xdb'),require(_0x6ed6('0xdc')));_0x571428['use'](_0x6ed6('0xdd'),require(_0x6ed6('0xde')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xdf'),require('./api/cmList'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xe0'),require('./api/voicePrefix'));_0x571428[_0x6ed6('0x7')]('/api/userProfiles',require(_0x6ed6('0xe1')));_0x571428['use']('/api/userProfile/sections',require(_0x6ed6('0xe2')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xe3'),require(_0x6ed6('0xe4')));_0x571428['use'](_0x6ed6('0xe5'),require(_0x6ed6('0xe6')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xe7'),require(_0x6ed6('0xe8')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xe9'),require(_0x6ed6('0xea')));_0x571428[_0x6ed6('0x7')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xeb'),require('./api/whatsappMessage'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xec'),require(_0x6ed6('0xed')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xee'),require(_0x6ed6('0xef')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xf0'),require(_0x6ed6('0xf1')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xf2'),require(_0x6ed6('0xf3')));_0x571428['use'](_0x6ed6('0xf4'),require(_0x6ed6('0xf5')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xf6'),require(_0x6ed6('0xf7')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xf8'),require(_0x6ed6('0xf9')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xfa'),require(_0x6ed6('0xfb')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xfc'),require(_0x6ed6('0xfd')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0xfe'),require(_0x6ed6('0xff')));_0x571428[_0x6ed6('0x7')]('/api/rpc',require(_0x6ed6('0x100')));_0x571428[_0x6ed6('0x7')]('/api/version',require(_0x6ed6('0x101')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x102'),require(_0x6ed6('0x103')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x104'),require('./api/pm2'));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x105'),require(_0x6ed6('0x106')));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x107'),clientSideLogs);_0x571428['use']('/apidoc',express[_0x6ed6('0x108')](path[_0x6ed6('0x109')](config['root'],_0x6ed6('0x10a'))));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x10b'),express[_0x6ed6('0x108')](path['join'](config[_0x6ed6('0x10c')],_0x6ed6('0x10b'))));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x10d'),express[_0x6ed6('0x108')](path[_0x6ed6('0x109')](config[_0x6ed6('0x10c')],_0x6ed6('0x10d'))));_0x571428['use']('/snippet',express[_0x6ed6('0x108')](path[_0x6ed6('0x109')](config['root'],'snippet',_0x6ed6('0x10e'))));_0x571428[_0x6ed6('0x7')](_0x6ed6('0x10f'),express['static'](path[_0x6ed6('0x109')](config['root'],_0x6ed6('0x110'))));_0x571428[_0x6ed6('0x111')](_0x6ed6('0x112'))[_0x6ed6('0x113')](errors[0x194]);_0x571428[_0x6ed6('0x111')]('/*')[_0x6ed6('0x113')](function(_0x21f1ce,_0x54b358){_0x54b358[_0x6ed6('0x114')](path[_0x6ed6('0x115')](_0x571428['get'](_0x6ed6('0x116'))+_0x6ed6('0x117')));});return _0x571428;});};
\ No newline at end of file
+var _0x7efe=['./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.1.0','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts'];(function(_0x13557b,_0x1a1138){var _0xd193e7=function(_0x150e08){while(--_0x150e08){_0x13557b['push'](_0x13557b['shift']());}};_0xd193e7(++_0x1a1138);}(_0x7efe,0x8c));var _0xe7ef=function(_0x3cb338,_0xa94edc){_0x3cb338=_0x3cb338-0x0;var _0x5b23d6=_0x7efe[_0x3cb338];return _0x5b23d6;};'use strict';var path=require(_0xe7ef('0x0'));var express=require(_0xe7ef('0x1'));var errors=require(_0xe7ef('0x2'));var config=require(_0xe7ef('0x3'));var setupLoggers=require(_0xe7ef('0x4'))['setupLoggers'];var clientSideLogs=require(_0xe7ef('0x5'));exports[_0xe7ef('0x6')]=function(_0x24e414){return setupLoggers(_0x24e414)['then'](function(){_0x24e414[_0xe7ef('0x7')]('/api/users',require(_0xe7ef('0x8')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x9'),require(_0xe7ef('0xa')));_0x24e414[_0xe7ef('0x7')]('/api/voice/contexts',require(_0xe7ef('0xb')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc'),require(_0xe7ef('0xd')));_0x24e414[_0xe7ef('0x7')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x24e414['use'](_0xe7ef('0xe'),require('./api/voiceQueue'));_0x24e414[_0xe7ef('0x7')]('/api/voice/recordings',require(_0xe7ef('0xf')));_0x24e414['use'](_0xe7ef('0x10'),require(_0xe7ef('0x11')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x12'),require(_0xe7ef('0x13')));_0x24e414[_0xe7ef('0x7')]('/api/voice/mails/messages',require(_0xe7ef('0x14')));_0x24e414['use']('/api/voice/calls/reports',require(_0xe7ef('0x15')));_0x24e414['use'](_0xe7ef('0x16'),require(_0xe7ef('0x17')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x18'),require(_0xe7ef('0x19')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x1a'),require('./api/voiceQueueReport'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x1b'),require(_0xe7ef('0x1c')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x1d'),require(_0xe7ef('0x1e')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x1f'),require(_0xe7ef('0x20')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x21'),require('./api/mailServerOut'));_0x24e414[_0xe7ef('0x7')]('/api/mail/accounts',require(_0xe7ef('0x22')));_0x24e414['use'](_0xe7ef('0x23'),require(_0xe7ef('0x24')));_0x24e414['use'](_0xe7ef('0x25'),require('./api/mailSubstatus'));_0x24e414[_0xe7ef('0x7')]('/api/mail/interactions',require(_0xe7ef('0x26')));_0x24e414[_0xe7ef('0x7')]('/api/mail/messages',require(_0xe7ef('0x27')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x28'),require('./api/mailApplication'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x29'),require(_0xe7ef('0x2a')));_0x24e414['use'](_0xe7ef('0x2b'),require(_0xe7ef('0x2c')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x2d'),require(_0xe7ef('0x2e')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x2f'),require(_0xe7ef('0x30')));_0x24e414['use'](_0xe7ef('0x31'),require(_0xe7ef('0x32')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x33'),require('./api/faxInteraction'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x34'),require(_0xe7ef('0x35')));_0x24e414[_0xe7ef('0x7')]('/api/fax/queues',require(_0xe7ef('0x36')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x37'),require(_0xe7ef('0x38')));_0x24e414['use'](_0xe7ef('0x39'),require('./api/smsAccount'));_0x24e414[_0xe7ef('0x7')]('/api/sms/applications',require('./api/smsApplication'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x3a'),require(_0xe7ef('0x3b')));_0x24e414['use'](_0xe7ef('0x3c'),require(_0xe7ef('0x3d')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x3e'),require(_0xe7ef('0x3f')));_0x24e414[_0xe7ef('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x24e414['use'](_0xe7ef('0x40'),require(_0xe7ef('0x41')));_0x24e414['use']('/api/openchannel/interactions',require(_0xe7ef('0x42')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x43'),require(_0xe7ef('0x44')));_0x24e414[_0xe7ef('0x7')]('/api/openchannel/queues',require(_0xe7ef('0x45')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x46'),require(_0xe7ef('0x47')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x48'),require(_0xe7ef('0x49')));_0x24e414[_0xe7ef('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x4a'),require(_0xe7ef('0x4b')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x4c'),require(_0xe7ef('0x4d')));_0x24e414[_0xe7ef('0x7')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x4e'),require(_0xe7ef('0x4f')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x50'),require(_0xe7ef('0x51')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x52'),require(_0xe7ef('0x53')));_0x24e414[_0xe7ef('0x7')]('/api/cm/companies',require(_0xe7ef('0x54')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x55'),require('./api/cmContact'));_0x24e414['use'](_0xe7ef('0x56'),require(_0xe7ef('0x57')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x58'),require(_0xe7ef('0x59')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x5a'),require(_0xe7ef('0x5b')));_0x24e414['use']('/api/cm/hopper_history',require(_0xe7ef('0x5c')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x5d'),require('./api/cmCustomField'));_0x24e414[_0xe7ef('0x7')]('/api/actions',require(_0xe7ef('0x5e')));_0x24e414['use'](_0xe7ef('0x5f'),require(_0xe7ef('0x60')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x61'),require('./api/cannedAnswer'));_0x24e414[_0xe7ef('0x7')]('/api/dispositions',require(_0xe7ef('0x62')));_0x24e414[_0xe7ef('0x7')]('/api/conditions',require('./api/condition'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x63'),require(_0xe7ef('0x64')));_0x24e414[_0xe7ef('0x7')]('/api/pauses',require(_0xe7ef('0x65')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x66'),require(_0xe7ef('0x67')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x68'),require(_0xe7ef('0x69')));_0x24e414[_0xe7ef('0x7')]('/api/schedules',require(_0xe7ef('0x6a')));_0x24e414['use'](_0xe7ef('0x6b'),require('./api/sound'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x6c'),require(_0xe7ef('0x6d')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x6e'),require('./api/contactItemType'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x6f'),require(_0xe7ef('0x70')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x71'),require('./api/cmHopperAdditionalPhone'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x72'),require(_0xe7ef('0x73')));_0x24e414['use'](_0xe7ef('0x74'),require('./api/trigger'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x75'),require(_0xe7ef('0x76')));_0x24e414['use'](_0xe7ef('0x77'),require(_0xe7ef('0x78')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x79'),require(_0xe7ef('0x7a')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x7b'),require('./api/analyticCustomReport'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x7c'),require(_0xe7ef('0x7d')));_0x24e414['use'](_0xe7ef('0x7e'),require(_0xe7ef('0x7f')));_0x24e414['use'](_0xe7ef('0x80'),require(_0xe7ef('0x81')));_0x24e414['use'](_0xe7ef('0x82'),require('./api/analyticFieldReport'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x83'),require(_0xe7ef('0x84')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x85'),require(_0xe7ef('0x86')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x87'),require('./api/intSalesforceConfiguration'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x88'),require(_0xe7ef('0x89')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x8a'),require(_0xe7ef('0x8b')));_0x24e414[_0xe7ef('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xe7ef('0x8c')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x8d'),require(_0xe7ef('0x8e')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x8f'),require(_0xe7ef('0x90')));_0x24e414['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x24e414['use']('/api/integrations/desk/fields',require(_0xe7ef('0x91')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x92'),require(_0xe7ef('0x93')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x94'),require(_0xe7ef('0x95')));_0x24e414['use']('/api/integrations/zoho/fields',require(_0xe7ef('0x96')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x97'),require(_0xe7ef('0x98')));_0x24e414['use'](_0xe7ef('0x99'),require(_0xe7ef('0x9a')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x9b'),require(_0xe7ef('0x9c')));_0x24e414['use'](_0xe7ef('0x9d'),require(_0xe7ef('0x9e')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x9f'),require('./api/intFreshdeskConfiguration'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xa0'),require(_0xe7ef('0xa1')));_0x24e414[_0xe7ef('0x7')]('/api/integrations/vtiger/accounts',require(_0xe7ef('0xa2')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xa3'),require(_0xe7ef('0xa4')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xa5'),require(_0xe7ef('0xa6')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xa7'),require('./api/intServicenowAccount'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xa8'),require(_0xe7ef('0xa9')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xaa'),require(_0xe7ef('0xab')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xac'),require(_0xe7ef('0xad')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xae'),require(_0xe7ef('0xaf')));_0x24e414[_0xe7ef('0x7')]('/api/integrations/dynamics365/fields',require(_0xe7ef('0xb0')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xb1'),require(_0xe7ef('0xb2')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xb3'),require('./api/intFreshsalesConfiguration'));_0x24e414['use'](_0xe7ef('0xb4'),require('./api/intFreshsalesField'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xb5'),require(_0xe7ef('0xb6')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xb7'),require(_0xe7ef('0xb8')));_0x24e414[_0xe7ef('0x7')]('/api/chat/internal/messages',require(_0xe7ef('0xb9')));_0x24e414[_0xe7ef('0x7')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x24e414['use']('/api/jscripty/questions/reports',require(_0xe7ef('0xba')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xbb'),require('./api/jscriptySessionReport'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xbc'),require(_0xe7ef('0xbd')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xbe'),require(_0xe7ef('0xbf')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc0'),require(_0xe7ef('0xc1')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc2'),require(_0xe7ef('0xc3')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc4'),require(_0xe7ef('0xc5')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc6'),require('./api/squareOdbc'));_0x24e414['use']('/api/square/projects',require(_0xe7ef('0xc7')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc8'),require('./api/squareRecording'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xc9'),require(_0xe7ef('0xca')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xcb'),require('./api/team'));_0x24e414['use'](_0xe7ef('0xcc'),require(_0xe7ef('0xcd')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xce'),require(_0xe7ef('0xcf')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xd0'),require(_0xe7ef('0xd1')));_0x24e414[_0xe7ef('0x7')]('/api/attachments',require(_0xe7ef('0xd2')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xd3'),require(_0xe7ef('0xd4')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xd5'),require(_0xe7ef('0xd6')));_0x24e414['use']('/api/chat/reports/transfer',require(_0xe7ef('0xd7')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xd8'),require(_0xe7ef('0xd9')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xda'),require(_0xe7ef('0xdb')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xdc'),require('./api/smsTransferReport'));_0x24e414[_0xe7ef('0x7')]('/api/cm/lists',require(_0xe7ef('0xdd')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xde'),require(_0xe7ef('0xdf')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xe0'),require(_0xe7ef('0xe1')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xe2'),require(_0xe7ef('0xe3')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xe4'),require(_0xe7ef('0xe5')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xe6'),require(_0xe7ef('0xe7')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xe8'),require('./api/whatsappAccount'));_0x24e414['use']('/api/whatsapp/applications',require(_0xe7ef('0xe9')));_0x24e414['use'](_0xe7ef('0xea'),require(_0xe7ef('0xeb')));_0x24e414['use'](_0xe7ef('0xec'),require(_0xe7ef('0xed')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xee'),require(_0xe7ef('0xef')));_0x24e414[_0xe7ef('0x7')]('/api/whatsapp/reports/transfer',require(_0xe7ef('0xf0')));_0x24e414[_0xe7ef('0x7')]('/api/whatsapp/queues',require(_0xe7ef('0xf1')));_0x24e414['use'](_0xe7ef('0xf2'),require(_0xe7ef('0xf3')));_0x24e414[_0xe7ef('0x7')]('/api/realtime',require(_0xe7ef('0xf4')));_0x24e414['use'](_0xe7ef('0xf5'),require(_0xe7ef('0xf6')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xf7'),require(_0xe7ef('0xf8')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xf9'),require(_0xe7ef('0xfa')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xfb'),require(_0xe7ef('0xfc')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0xfd'),require(_0xe7ef('0xfe')));_0x24e414['use'](_0xe7ef('0xff'),require(_0xe7ef('0x100')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x101'),require(_0xe7ef('0x102')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x103'),require('./api/system'));_0x24e414['use']('/api/pm2',require(_0xe7ef('0x104')));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x105'),require('./api/webbar'));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x106'),clientSideLogs);_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x107'),express[_0xe7ef('0x108')](path['join'](config[_0xe7ef('0x109')],_0xe7ef('0x107'))));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x10a'),express['static'](path[_0xe7ef('0x10b')](config[_0xe7ef('0x109')],_0xe7ef('0x10a'))));_0x24e414['use']('/demo',express[_0xe7ef('0x108')](path[_0xe7ef('0x10b')](config['root'],_0xe7ef('0x10c'))));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x10d'),express['static'](path['join'](config['root'],_0xe7ef('0x10e'),_0xe7ef('0x10f'))));_0x24e414[_0xe7ef('0x7')](_0xe7ef('0x110'),express[_0xe7ef('0x108')](path[_0xe7ef('0x10b')](config[_0xe7ef('0x109')],'/server/files/plugins')));_0x24e414['route'](_0xe7ef('0x111'))[_0xe7ef('0x112')](errors[0x194]);_0x24e414[_0xe7ef('0x113')]('/*')[_0xe7ef('0x112')](function(_0x2fbef0,_0x394ccf){_0x394ccf[_0xe7ef('0x114')](path[_0xe7ef('0x115')](_0x24e414[_0xe7ef('0x112')]('appPath')+_0xe7ef('0x116')));});return _0x24e414;});};
\ No newline at end of file
index a21be0e..31a6f37 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf163=['../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen'];(function(_0x2d898d,_0x28a101){var _0x342607=function(_0x35da88){while(--_0x35da88){_0x2d898d['push'](_0x2d898d['shift']());}};_0x342607(++_0x28a101);}(_0xf163,0x129));var _0x3f16=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xf163[_0x256d6a];return _0x460058;};'use strict';var jayson=require(_0x3f16('0x0'));var _=require('lodash');var config=require(_0x3f16('0x1'));exports[_0x3f16('0x2')]=function(){return new Promise(function(_0x3ccaa4,_0x335c2b){var _0x3b5045={};_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x3')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/voiceExtension/voiceExtension.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x5')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x6')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x7')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x8')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x9')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0xa')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0xb')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0xc')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0xd')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0xe')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0xf')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x10')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x11')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x12')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x13')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x14')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x15')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x16')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x17')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x18')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x19')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x1a')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x1b')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/smsMessage/smsMessage.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/smsQueue/smsQueue.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x1c')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x1d')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x1e')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x1f')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x20')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x21')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x22')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/chatQueue/chatQueue.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/cmContact/cmContact.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x23')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x24')));_0x3b5045=_['merge'](_0x3b5045,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x25')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x26')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x27')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/pause/pause.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x28')));_0x3b5045=_['merge'](_0x3b5045,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x29')));_0x3b5045=_['merge'](_0x3b5045,require('../api/trigger/trigger.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x2a')));_0x3b5045=_['merge'](_0x3b5045,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x2b')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x2c')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x2d')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x2e')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x2f')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x30')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x31')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x32')));_0x3b5045=_['merge'](_0x3b5045,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x33')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x34')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x35')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x36')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/setting/setting.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x37')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x38')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x39')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x3a')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x3b')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x3c')));_0x3b5045=_['merge'](_0x3b5045,require(_0x3f16('0x3d')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x3e')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x3f')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x40')));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3b5045=_[_0x3f16('0x4')](_0x3b5045,require(_0x3f16('0x41')));var _0x2dc2a8=jayson[_0x3f16('0x42')](_0x3b5045)[_0x3f16('0x43')]();var _0x54bc47=config[_0x3f16('0x44')][_0x3f16('0x45')]||config[_0x3f16('0x45')]+0x1;var _0x1240a6=config['rpc']['ip']||_0x3f16('0x46');_0x2dc2a8['on'](_0x3f16('0x47'),function(_0x3aa6a5){return _0x335c2b(_0x3aa6a5);});_0x2dc2a8[_0x3f16('0x2')](_0x54bc47,_0x1240a6,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1240a6,_0x54bc47);require(_0x3f16('0x48'))[_0x3f16('0x49')]();return _0x3ccaa4(_0x3f16('0x4a')+_0x1240a6+':'+_0x54bc47);});});};
\ No newline at end of file
+var _0xe714=['../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc'];(function(_0x1b6417,_0x409dde){var _0x3b323=function(_0x103c8e){while(--_0x103c8e){_0x1b6417['push'](_0x1b6417['shift']());}};_0x3b323(++_0x409dde);}(_0xe714,0xe2));var _0x4e71=function(_0x247a05,_0x32da68){_0x247a05=_0x247a05-0x0;var _0x16a181=_0xe714[_0x247a05];return _0x16a181;};'use strict';var jayson=require(_0x4e71('0x0'));var _=require('lodash');var config=require(_0x4e71('0x1'));exports[_0x4e71('0x2')]=function(){return new Promise(function(_0xe0504f,_0x28abe0){var _0x5c5974={};_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/user/user.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x4')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x5')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x6')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x7')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x8')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x9')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0xa')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0xb')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0xc')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0xd')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0xe')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0xf')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/mailQueue/mailQueue.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x10')));_0x5c5974=_['merge'](_0x5c5974,require('../api/mailMessage/mailMessage.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/mailApplication/mailApplication.rpc'));_0x5c5974=_['merge'](_0x5c5974,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x11')));_0x5c5974=_['merge'](_0x5c5974,require('../api/faxApplication/faxApplication.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x12')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x13')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x14')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x15')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/smsAccount/smsAccount.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x16')));_0x5c5974=_['merge'](_0x5c5974,require('../api/smsMessage/smsMessage.rpc'));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x17')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x18')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x19')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x1a')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x1b')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x1c')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/chatInteraction/chatInteraction.rpc'));_0x5c5974=_['merge'](_0x5c5974,require('../api/chatMessage/chatMessage.rpc'));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x1d')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x1e')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x1f')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x20')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x21')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x22')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x23')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x24')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/sound/sound.rpc'));_0x5c5974=_['merge'](_0x5c5974,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x25')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x26')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x27')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x28')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x29')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x2a')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x2b')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x2c')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x2d')));_0x5c5974=_['merge'](_0x5c5974,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x2e')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x2f')));_0x5c5974=_['merge'](_0x5c5974,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x30')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x31')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x32')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/squareOdbc/squareOdbc.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x33')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x34')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/squareMessage/squareMessage.rpc'));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x35')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x36')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require('../api/plugin/plugin.rpc'));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x37')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x38')));_0x5c5974=_[_0x4e71('0x3')](_0x5c5974,require(_0x4e71('0x39')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x3a')));_0x5c5974=_['merge'](_0x5c5974,require(_0x4e71('0x3b')));var _0x4edcf0=jayson[_0x4e71('0x3c')](_0x5c5974)[_0x4e71('0x3d')]();var _0x52f144=config[_0x4e71('0x3e')][_0x4e71('0x3f')]||config[_0x4e71('0x3f')]+0x1;var _0x698e5c=config[_0x4e71('0x3e')]['ip']||_0x4e71('0x40');_0x4edcf0['on'](_0x4e71('0x41'),function(_0x2bae8a){return _0x28abe0(_0x2bae8a);});_0x4edcf0[_0x4e71('0x2')](_0x52f144,_0x698e5c,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x698e5c,_0x52f144);require(_0x4e71('0x42'))[_0x4e71('0x43')]();return _0xe0504f(_0x4e71('0x44')+_0x698e5c+':'+_0x52f144);});});};
\ No newline at end of file
index 631ae26..12ca392 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf71=['sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xcf71,0xba));var _0x1cf7=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0xcf71[_0x4ac48d];return _0x7537af;};'use strict';var util=require(_0x1cf7('0x0'));var _=require(_0x1cf7('0x1'));var EventEmitter=require(_0x1cf7('0x2'))[_0x1cf7('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x1cf7('0x4'));function AGIChannel(_0x409e6f){var _0xcc31bf=this,_0x21307d=new AGIReply(),_0x11e462=![],_0x14d074={};EventEmitter[_0x1cf7('0x5')](_0xcc31bf);_0x409e6f[_0x1cf7('0x6')](_0x1cf7('0x7'));_0x409e6f[_0x1cf7('0x8')](0x8*0x3c*0x3c*0x3e8);_0x21307d[_0x1cf7('0x6')](_0x1cf7('0x7'));_0x21307d['on']('headers',function(_0x52c8c8){for(var _0xb4e19f in _0x52c8c8){_0xcc31bf[_0xb4e19f]=_0x52c8c8[_0xb4e19f];}_0xcc31bf[_0x1cf7('0x9')](_0x1cf7('0xa'));});_0x21307d['on']('line',function(_0x318b81){if(_0x318b81['toLowerCase']()=='hangup'){_0xcc31bf[_0x1cf7('0x9')](_0x1cf7('0xb'));return;}if(_0x318b81[_0x1cf7('0xc')](0x0,0xb)==_0x1cf7('0xd')){_0x11e462=!![];}if(_0x11e462){_0x14d074['rx']+=_0x318b81+'\x0a';if(_0x318b81[_0x1cf7('0xe')](_0x1cf7('0xf'))!=-0x1){_0x11e462=![];}}else{_0x14d074['rx']=_0x318b81;}if(_0x11e462){return;}if(typeof _0x14d074['cb']=='function'){var _0x18dc3b=_0x14d074['rx']['substring'](0x0,0x3),_0x58c99f=null,_0x1ad008=null;_0x18dc3b=parseInt(_0x18dc3b);if(isNaN(_0x18dc3b)){_0x14d074['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cf7('0x10')});return;}if(_0x18dc3b!=0xc8){_0x14d074['cb'](null,{'code':_0x18dc3b,'result':-0x1,'extra':'KO'});return;}_0x58c99f=_0x14d074['rx'][_0x1cf7('0xc')](0x4)['replace'](_0x1cf7('0x11'),'');if(_0x58c99f[_0x1cf7('0x12')]('\x20')!=-0x1){_0x58c99f=_0x58c99f[_0x1cf7('0x13')](0x0,_0x58c99f[_0x1cf7('0x12')]('\x20'));}if(_[_0x1cf7('0x14')](_0x58c99f,'-1')){_0x58c99f=parseInt(_0x58c99f);}_0x1ad008=_0x14d074['rx'][_0x1cf7('0x15')]('\x20');if(_0x1ad008[_0x1cf7('0x16')]==0x3){_0x1ad008=_0x1ad008[0x2][_0x1cf7('0xc')](0x1,_0x1ad008[0x2][_0x1cf7('0x16')]-0x1);}else if(_0x1ad008[_0x1cf7('0x16')]>0x3){var _0x2a3671=/\((.+)\)/;var _0x148f07=_0x14d074['rx'][_0x1cf7('0x17')](_0x2a3671);if(_0x148f07){_0x1ad008=_0x148f07[0x1];}else{_0x1ad008=null;}}else{_0x1ad008=null;}_0x14d074['cb'](null,{'code':_0x18dc3b,'result':_0x58c99f,'extra':_0x1ad008});}});_0x409e6f['on']('error',function(_0x391553){_0xcc31bf[_0x1cf7('0x9')](_0x1cf7('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x391553[_0x1cf7('0x19')]));});_0x409e6f['on'](_0x1cf7('0x1a'),function(){_0xcc31bf[_0x1cf7('0x9')]('close',new AGIError(_0x1cf7('0x1b')));});_0x409e6f['on'](_0x1cf7('0x1c'),function(){_0xcc31bf[_0x1cf7('0x9')](_0x1cf7('0x1c'),new AGIError(_0x1cf7('0x1d')));_0x409e6f[_0x1cf7('0x1e')]();});_0x409e6f[_0x1cf7('0x1f')](_0x21307d);this[_0x1cf7('0x20')]=function(_0xa12f8a,_0x256151){var _0xa12f8a=_0xa12f8a||'',_0x256151=typeof _0x256151==_0x1cf7('0x21')?_0x256151:new Function();_0x14d074={'tx':_0xa12f8a,'rx':'','cb':_0x256151};_0x409e6f[_0x1cf7('0x22')](_0xa12f8a+'\x0a');},this[_0x1cf7('0x1a')]=function(){_0x409e6f[_0x1cf7('0x1e')]();};}util[_0x1cf7('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x25')]=function(_0x5174d4){return this['command']['sync'](this,_0x5174d4);};AGIChannel[_0x1cf7('0x24')]['answer']=function(){return this[_0x1cf7('0x25')](_0x1cf7('0x26'));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x27')]=function(_0x4dcf35,_0x5077f6,_0xecdbbb){_0x4dcf35=_0x4dcf35===undefined?_0x1cf7('0x28'):_0x4dcf35;_0x5077f6=_0x5077f6===undefined?'5':_0x5077f6;_0xecdbbb=_0xecdbbb===undefined?'1':_0xecdbbb;return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x2a'),_0x4dcf35,_0x5077f6*0x3e8,_0xecdbbb));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x2b')]=function(_0x5e2047){_0x5e2047=_0x5e2047||_0x1cf7('0x2c');return this['sendRequest'](util[_0x1cf7('0x29')](_0x1cf7('0x2d'),_0x5e2047));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x2e')]=function(_0x3c56a1,_0x3efa9c){if(_[_0x1cf7('0x2f')](_0x3efa9c)){return this[_0x1cf7('0x25')](util['format']('EXEC\x20%s\x20%s',_0x3c56a1,_0x3efa9c[_0x1cf7('0x30')](',')));}return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x31'),_0x3c56a1,_0x3efa9c));};AGIChannel[_0x1cf7('0x24')]['setContext']=function(_0x3519e0){return this['sendRequest'](util[_0x1cf7('0x29')](_0x1cf7('0x32'),_0x3519e0));};AGIChannel['prototype'][_0x1cf7('0x33')]=function(_0x3527c6){return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x34'),_0x3527c6));};AGIChannel[_0x1cf7('0x24')]['setPriority']=function(_0xa8a129){return this['sendRequest'](util['format'](_0x1cf7('0x35'),_0xa8a129));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0xb')]=function(){return this[_0x1cf7('0x25')](_0x1cf7('0x36'));};AGIChannel[_0x1cf7('0x24')]['setVariable']=function(_0x4d7f15,_0x434024){var _0x90bdce=_[_0x1cf7('0x37')](_0x434024)||_[_0x1cf7('0x38')](_0x434024)?_0x434024[_0x1cf7('0x39')]():_0x434024;return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x3a'),_0x4d7f15,_0x90bdce?_0x90bdce[_0x1cf7('0x39')]()[_0x1cf7('0x3b')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x1cf7('0x3c')]=function(_0x4eb6cd,_0x2ca673){return this[_0x1cf7('0x25')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x4eb6cd,_0x2ca673));};AGIChannel['prototype']['sayDigits']=function(_0x233a3c,_0x197497){return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x3d'),_0x233a3c,_0x197497));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x3e')]=function(_0x7cfd70,_0x4cce10){return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x3f'),_0x7cfd70,_0x4cce10));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x40')]=function(_0x24100d,_0x3c8dba,_0x29924b){_0x3c8dba=_0x3c8dba||this[_0x1cf7('0x41')];_0x29924b=_0x29924b||0x1;this[_0x1cf7('0x42')](_0x24100d);this[_0x1cf7('0x33')](_0x3c8dba);this[_0x1cf7('0x43')](_0x29924b);return this[_0x1cf7('0x2b')](util['format'](_0x1cf7('0x44'),_0x24100d,_0x3c8dba,_0x29924b));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x45')]=function(_0xb9d92f){return this['sendRequest'](util[_0x1cf7('0x29')]('GET\x20VARIABLE\x20\x22%s\x22',_0xb9d92f));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x46')]=function(_0x457fee,_0x2c879b,_0x2f1345,_0x132e5c,_0x4096ee,_0x3a6560){_0x2c879b=_0x2c879b||'wav';_0x2f1345=_0x2f1345||'';_0x132e5c=_0x132e5c===undefined?-0x1:_0x132e5c==='-1'?-0x1:_0x132e5c*0x3e8;_0x4096ee=_0x4096ee===undefined?'':'s='+_0x4096ee;_0x3a6560=_0x3a6560?_0x1cf7('0x47'):'';return this[_0x1cf7('0x25')](util[_0x1cf7('0x29')](_0x1cf7('0x48'),_0x457fee,_0x2c879b,_0x2f1345,_0x132e5c,_0x3a6560,_0x4096ee));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x49')]=function(_0x2f79e8,_0x1948c4){_0x1948c4=_0x1948c4||'';return this[_0x1cf7('0x25')](util['format'](_0x1cf7('0x4a'),_0x2f79e8,_0x1948c4));};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x4b')]=function(_0x5d7d6c){return this[_0x1cf7('0x2e')](_0x1cf7('0x4c'),_0x5d7d6c);};AGIChannel[_0x1cf7('0x24')][_0x1cf7('0x4d')]=function(_0x1488e7){return this[_0x1cf7('0x2e')](_0x1cf7('0x4e'),_0x1488e7);};AGIChannel[_0x1cf7('0x24')]['error']=function(_0x296e94,_0x218b58){this[_0x1cf7('0x2b')](util[_0x1cf7('0x29')](_0x1cf7('0x4f'),_0x296e94['id'],_0x296e94[_0x1cf7('0x50')],_0x218b58));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1cf7('0x51')]=AGIChannel;
\ No newline at end of file
+var _0x07fa=['write','inherits','prototype','sendRequest','answer','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','exec','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','indexOf','substr','startsWith','length','match','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command'];(function(_0x3cff41,_0x6d45b6){var _0x16ab1f=function(_0x3c30cc){while(--_0x3c30cc){_0x3cff41['push'](_0x3cff41['shift']());}};_0x16ab1f(++_0x6d45b6);}(_0x07fa,0x177));var _0xa07f=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x07fa[_0x56916d];return _0x2b7f1f;};'use strict';var util=require('util');var _=require(_0xa07f('0x0'));var EventEmitter=require(_0xa07f('0x1'))[_0xa07f('0x2')];var AGIReply=require(_0xa07f('0x3'));var AGIError=require(_0xa07f('0x4'));function AGIChannel(_0x56c63d){var _0x4517a5=this,_0x22ed59=new AGIReply(),_0x573aa3=![],_0x4ceab6={};EventEmitter['call'](_0x4517a5);_0x56c63d[_0xa07f('0x5')](_0xa07f('0x6'));_0x56c63d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x22ed59[_0xa07f('0x5')]('utf8');_0x22ed59['on']('headers',function(_0x5d82e9){for(var _0x5cac85 in _0x5d82e9){_0x4517a5[_0x5cac85]=_0x5d82e9[_0x5cac85];}_0x4517a5[_0xa07f('0x7')](_0xa07f('0x8'));});_0x22ed59['on']('line',function(_0xd3bdbf){if(_0xd3bdbf[_0xa07f('0x9')]()==_0xa07f('0xa')){_0x4517a5[_0xa07f('0x7')](_0xa07f('0xa'));return;}if(_0xd3bdbf[_0xa07f('0xb')](0x0,0xb)==_0xa07f('0xc')){_0x573aa3=!![];}if(_0x573aa3){_0x4ceab6['rx']+=_0xd3bdbf+'\x0a';if(_0xd3bdbf[_0xa07f('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x573aa3=![];}}else{_0x4ceab6['rx']=_0xd3bdbf;}if(_0x573aa3){return;}if(typeof _0x4ceab6['cb']==_0xa07f('0xe')){var _0x31b5c1=_0x4ceab6['rx'][_0xa07f('0xb')](0x0,0x3),_0x5500a6=null,_0x2baafc=null;_0x31b5c1=parseInt(_0x31b5c1);if(isNaN(_0x31b5c1)){_0x4ceab6['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa07f('0xf')});return;}if(_0x31b5c1!=0xc8){_0x4ceab6['cb'](null,{'code':_0x31b5c1,'result':-0x1,'extra':'KO'});return;}_0x5500a6=_0x4ceab6['rx']['substring'](0x4)[_0xa07f('0x10')]('result=','');if(_0x5500a6[_0xa07f('0x11')]('\x20')!=-0x1){_0x5500a6=_0x5500a6[_0xa07f('0x12')](0x0,_0x5500a6[_0xa07f('0x11')]('\x20'));}if(_[_0xa07f('0x13')](_0x5500a6,'-1')){_0x5500a6=parseInt(_0x5500a6);}_0x2baafc=_0x4ceab6['rx']['split']('\x20');if(_0x2baafc[_0xa07f('0x14')]==0x3){_0x2baafc=_0x2baafc[0x2][_0xa07f('0xb')](0x1,_0x2baafc[0x2][_0xa07f('0x14')]-0x1);}else if(_0x2baafc[_0xa07f('0x14')]>0x3){var _0x4090a1=/\((.+)\)/;var _0x5da71c=_0x4ceab6['rx'][_0xa07f('0x15')](_0x4090a1);if(_0x5da71c){_0x2baafc=_0x5da71c[0x1];}else{_0x2baafc=null;}}else{_0x2baafc=null;}_0x4ceab6['cb'](null,{'code':_0x31b5c1,'result':_0x5500a6,'extra':_0x2baafc});}});_0x56c63d['on']('error',function(_0x5450a9){_0x4517a5['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x5450a9['code']));});_0x56c63d['on'](_0xa07f('0x16'),function(){_0x4517a5[_0xa07f('0x7')](_0xa07f('0x16'),new AGIError(_0xa07f('0x17')));});_0x56c63d['on'](_0xa07f('0x18'),function(){_0x4517a5[_0xa07f('0x7')](_0xa07f('0x18'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x56c63d[_0xa07f('0x19')]();});_0x56c63d['pipe'](_0x22ed59);this[_0xa07f('0x1a')]=function(_0x55a481,_0x587d58){var _0x55a481=_0x55a481||'',_0x587d58=typeof _0x587d58==_0xa07f('0xe')?_0x587d58:new Function();_0x4ceab6={'tx':_0x55a481,'rx':'','cb':_0x587d58};_0x56c63d[_0xa07f('0x1b')](_0x55a481+'\x0a');},this['close']=function(){_0x56c63d[_0xa07f('0x19')]();};}util[_0xa07f('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0xa07f('0x1d')][_0xa07f('0x1e')]=function(_0x24c1e2){return this[_0xa07f('0x1a')]['sync'](this,_0x24c1e2);};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x1f')]=function(){return this[_0xa07f('0x1e')](_0xa07f('0x20'));};AGIChannel[_0xa07f('0x1d')]['getData']=function(_0x48f809,_0x280380,_0x2cdd67){_0x48f809=_0x48f809===undefined?'beep':_0x48f809;_0x280380=_0x280380===undefined?'5':_0x280380;_0x2cdd67=_0x2cdd67===undefined?'1':_0x2cdd67;return this[_0xa07f('0x1e')](util[_0xa07f('0x21')](_0xa07f('0x22'),_0x48f809,_0x280380*0x3e8,_0x2cdd67));};AGIChannel['prototype'][_0xa07f('0x23')]=function(_0x1c0099){_0x1c0099=_0x1c0099||'NO\x20MESSAGE';return this['sendRequest'](util[_0xa07f('0x21')](_0xa07f('0x24'),_0x1c0099));};AGIChannel[_0xa07f('0x1d')]['exec']=function(_0x438569,_0x2d1431){if(_['isArray'](_0x2d1431)){return this['sendRequest'](util[_0xa07f('0x21')]('EXEC\x20%s\x20%s',_0x438569,_0x2d1431[_0xa07f('0x25')](',')));}return this[_0xa07f('0x1e')](util['format'](_0xa07f('0x26'),_0x438569,_0x2d1431));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x27')]=function(_0x4cc602){return this[_0xa07f('0x1e')](util[_0xa07f('0x21')](_0xa07f('0x28'),_0x4cc602));};AGIChannel[_0xa07f('0x1d')]['setExtension']=function(_0x1fe2f8){return this['sendRequest'](util['format'](_0xa07f('0x29'),_0x1fe2f8));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x2a')]=function(_0x592399){return this['sendRequest'](util[_0xa07f('0x21')](_0xa07f('0x2b'),_0x592399));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0xa')]=function(){return this[_0xa07f('0x1e')](_0xa07f('0x2c'));};AGIChannel[_0xa07f('0x1d')]['setVariable']=function(_0x42815a,_0x10d7d7){var _0x215ae8=_[_0xa07f('0x2d')](_0x10d7d7)||_['isNumber'](_0x10d7d7)?_0x10d7d7['toString']():_0x10d7d7;return this[_0xa07f('0x1e')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x42815a,_0x215ae8?_0x215ae8[_0xa07f('0x2e')]()[_0xa07f('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa07f('0x2f')]=function(_0x4eae63,_0x2788a7){return this[_0xa07f('0x1e')](util[_0xa07f('0x21')](_0xa07f('0x30'),_0x4eae63,_0x2788a7));};AGIChannel[_0xa07f('0x1d')]['sayDigits']=function(_0x58adde,_0x42d7d6){return this[_0xa07f('0x1e')](util[_0xa07f('0x21')](_0xa07f('0x31'),_0x58adde,_0x42d7d6));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x32')]=function(_0x304404,_0x4c5bc6){return this[_0xa07f('0x1e')](util[_0xa07f('0x21')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x304404,_0x4c5bc6));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x33')]=function(_0x55f7b8,_0xfa9caf,_0x1e2b56){_0xfa9caf=_0xfa9caf||this['extension'];_0x1e2b56=_0x1e2b56||0x1;this[_0xa07f('0x27')](_0x55f7b8);this['setExtension'](_0xfa9caf);this[_0xa07f('0x2a')](_0x1e2b56);return this[_0xa07f('0x23')](util[_0xa07f('0x21')](_0xa07f('0x34'),_0x55f7b8,_0xfa9caf,_0x1e2b56));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x35')]=function(_0x52513f){return this['sendRequest'](util[_0xa07f('0x21')]('GET\x20VARIABLE\x20\x22%s\x22',_0x52513f));};AGIChannel[_0xa07f('0x1d')]['recordFile']=function(_0x59add3,_0x28e268,_0x53bf27,_0x22f482,_0x244071,_0xb0bb7a){_0x28e268=_0x28e268||_0xa07f('0x36');_0x53bf27=_0x53bf27||'';_0x22f482=_0x22f482===undefined?-0x1:_0x22f482==='-1'?-0x1:_0x22f482*0x3e8;_0x244071=_0x244071===undefined?'':'s='+_0x244071;_0xb0bb7a=_0xb0bb7a?'BEEP':'';return this[_0xa07f('0x1e')](util[_0xa07f('0x21')](_0xa07f('0x37'),_0x59add3,_0x28e268,_0x53bf27,_0x22f482,_0xb0bb7a,_0x244071));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x38')]=function(_0x4f8e3c,_0x5a1915){_0x5a1915=_0x5a1915||'';return this[_0xa07f('0x1e')](util[_0xa07f('0x21')](_0xa07f('0x39'),_0x4f8e3c,_0x5a1915));};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x3a')]=function(_0x1d29a4){return this['exec'](_0xa07f('0x3b'),_0x1d29a4);};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x3c')]=function(_0x5a4ce8){return this[_0xa07f('0x3d')](_0xa07f('0x3e'),_0x5a4ce8);};AGIChannel[_0xa07f('0x1d')][_0xa07f('0x3f')]=function(_0xf6008a,_0x5f5733){this['noop'](util[_0xa07f('0x21')](_0xa07f('0x40'),_0xf6008a['id'],_0xf6008a[_0xa07f('0x41')],_0x5f5733));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa07f('0x42')]=AGIChannel;
\ No newline at end of file
index b05d217..d20b064 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6beb=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','name','exports','util','Undefined\x20error.'];(function(_0x5ba129,_0x193fac){var _0x579d9b=function(_0x12e720){while(--_0x12e720){_0x5ba129['push'](_0x5ba129['shift']());}};_0x579d9b(++_0x193fac);}(_0x6beb,0x12a));var _0xb6be=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6beb[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xb6be('0x0'));var error={'E_AGI_UNDEFINED':_0xb6be('0x1'),'E_AGI_ARGUMENT_PORT':_0xb6be('0x2'),'E_AGI_SERVER_ERROR':_0xb6be('0x3'),'E_AGI_SERVER_CLOSE':_0xb6be('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xb6be('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xb6be('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xb6be('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5274f0){var _0x5274f0=_0x5274f0||null,_0x5a27e1=_0x5a27e1||[],_0x3131f3=0x1,_0x3d123b='';if(!error[_0x5274f0]){_0x5274f0='E_AGI_UNDEFINED';}_0x5a27e1['push'](error[_0x5274f0]);while(arguments[_0x3131f3]){_0x5a27e1['push'](arguments[_0x3131f3]);_0x3131f3++;}_0x3d123b=util['format']['apply'](util,_0x5a27e1);this['message']=_0x3d123b;this[_0xb6be('0x8')]=_0x5274f0;}module[_0xb6be('0x9')]=AGIError;
\ No newline at end of file
+var _0xffb2=['message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x492cc9,_0x3b8720){var _0x25b7e2=function(_0x2e8a99){while(--_0x2e8a99){_0x492cc9['push'](_0x492cc9['shift']());}};_0x25b7e2(++_0x3b8720);}(_0xffb2,0x16b));var _0x2ffb=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xffb2[_0x5cb97e];return _0x1714b4;};'use strict';var util=require(_0x2ffb('0x0'));var error={'E_AGI_UNDEFINED':_0x2ffb('0x1'),'E_AGI_ARGUMENT_PORT':_0x2ffb('0x2'),'E_AGI_SERVER_ERROR':_0x2ffb('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x2ffb('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x2ffb('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x2ffb('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2ffb('0x7'),'E_AGI_IVR_ENTRY':_0x2ffb('0x8')};function AGIError(_0x5f460e){var _0x5f460e=_0x5f460e||null,_0x40e3f5=_0x40e3f5||[],_0xda3874=0x1,_0x5cbd64='';if(!error[_0x5f460e]){_0x5f460e=_0x2ffb('0x9');}_0x40e3f5['push'](error[_0x5f460e]);while(arguments[_0xda3874]){_0x40e3f5[_0x2ffb('0xa')](arguments[_0xda3874]);_0xda3874++;}_0x5cbd64=util[_0x2ffb('0xb')]['apply'](util,_0x40e3f5);this[_0x2ffb('0xc')]=_0x5cbd64;this[_0x2ffb('0xd')]=_0x5f460e;}module[_0x2ffb('0xe')]=AGIError;
\ No newline at end of file
index 8e4f098..bd1e20b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28f6=['ioredis','./error','redis','defaults','localhost','subscribe','emit','error','message','agi','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events'];(function(_0x5d30cb,_0x42d8df){var _0x3d7e23=function(_0xbcca32){while(--_0xbcca32){_0x5d30cb['push'](_0x5d30cb['shift']());}};_0x3d7e23(++_0x42d8df);}(_0x28f6,0x14e));var _0x628f=function(_0x49946c,_0x17b333){_0x49946c=_0x49946c-0x0;var _0x14291f=_0x28f6[_0x49946c];return _0x14291f;};'use strict';var _=require(_0x628f('0x0'));var EventEmitter=require(_0x628f('0x1'))['EventEmitter'];var Redis=require(_0x628f('0x2'));var AGIError=require(_0x628f('0x3'));var config=require('../../config/environment');config[_0x628f('0x4')]=_[_0x628f('0x5')](config[_0x628f('0x4')],{'host':_0x628f('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x628f('0x4')]);sub[_0x628f('0x7')]('agi',function(_0x33eaf2){if(_0x33eaf2)return eventEmitter[_0x628f('0x8')](_0x628f('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x33eaf2));});sub['on'](_0x628f('0xa'),function(_0x235388,_0x16fc59){if(_0x235388!==_0x628f('0xb'))return;try{var _0x245020=JSON[_0x628f('0xc')](_0x16fc59);eventEmitter['emit'](_0x628f('0xd'),_0x245020);}catch(_0x2a53ca){eventEmitter[_0x628f('0x8')](_0x628f('0x9'),new AGIError(_0x628f('0xe'),_0x2a53ca));}});module[_0x628f('0xf')]={'EventEmitter':eventEmitter};
\ No newline at end of file
+var _0xfe53=['exports','lodash','EventEmitter','./error','redis','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate'];(function(_0x397bfa,_0x3484a4){var _0x40132e=function(_0x5d10eb){while(--_0x5d10eb){_0x397bfa['push'](_0x397bfa['shift']());}};_0x40132e(++_0x3484a4);}(_0xfe53,0x12d));var _0x3fe5=function(_0x56fb73,_0x491492){_0x56fb73=_0x56fb73-0x0;var _0xa9dd3=_0xfe53[_0x56fb73];return _0xa9dd3;};'use strict';var _=require(_0x3fe5('0x0'));var EventEmitter=require('events')[_0x3fe5('0x1')];var Redis=require('ioredis');var AGIError=require(_0x3fe5('0x2'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x3fe5('0x3')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x3fe5('0x3')]);sub['subscribe'](_0x3fe5('0x4'),function(_0x310f8d){if(_0x310f8d)return eventEmitter[_0x3fe5('0x5')](_0x3fe5('0x6'),new AGIError(_0x3fe5('0x7'),_0x310f8d));});sub['on'](_0x3fe5('0x8'),function(_0x471818,_0x1a3e73){if(_0x471818!==_0x3fe5('0x4'))return;try{var _0x11ee8f=JSON[_0x3fe5('0x9')](_0x1a3e73);eventEmitter[_0x3fe5('0x5')](_0x3fe5('0xa'),_0x11ee8f);}catch(_0x491662){eventEmitter[_0x3fe5('0x5')]('error',new AGIError(_0x3fe5('0x7'),_0x491662));}});module[_0x3fe5('0xb')]={'EventEmitter':eventEmitter};
\ No newline at end of file
index a23d09d..71f3c65 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6854=['stop\x20traverse','length','condition','vswitch','default','menu','target','agicommand','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found'];(function(_0xff396,_0x55101f){var _0x8a2883=function(_0x5711a6){while(--_0x5711a6){_0xff396['push'](_0xff396['shift']());}};_0x8a2883(++_0x55101f);}(_0x6854,0x14f));var _0x4685=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x6854[_0x14a862];return _0x245eb5;};'use strict';var _=require(_0x4685('0x0'));var logger=require(_0x4685('0x1'))(_0x4685('0x2'));var verticesWithRetry=['menu',_0x4685('0x3'),_0x4685('0x4')];var Graph=function(){this[_0x4685('0x5')]={};this[_0x4685('0x6')]={};this[_0x4685('0x7')]=0x0;};Graph[_0x4685('0x8')]['addVertex']=function(_0x38e23e){this['vertices'][_0x38e23e['id']]=_0x38e23e;this[_0x4685('0x6')][_0x38e23e['id']]=[];};Graph[_0x4685('0x8')]['addEdge']=function(_0x4178c3,_0x189bb6,_0x266c77){this[_0x4685('0x6')][_0x4178c3][_0x4685('0x9')]({'target':_0x189bb6,'condition':_0x266c77});this[_0x4685('0x7')]+=0x1;};Graph[_0x4685('0x8')]['size']=function(){return _[_0x4685('0xa')](this[_0x4685('0x5')]);};Graph[_0x4685('0x8')][_0x4685('0xb')]=function(){return this[_0x4685('0x7')];};Graph[_0x4685('0x8')][_0x4685('0xc')]=function(_0x45035c){return this['vertices'][_0x45035c];};Graph[_0x4685('0x8')][_0x4685('0xd')]=function(_0x2c7c01,_0x5e2c09){if(!this[_0x4685('0x5')][_0x2c7c01]){return logger[_0x4685('0xe')](_0x4685('0xf'));}var _0x3b913c=_0x5e2c09(this[_0x4685('0x5')][_0x2c7c01]);if(!_0x3b913c){return logger[_0x4685('0xe')](_0x4685('0x10'));}if(this[_0x4685('0x6')][_0x2c7c01][_0x4685('0x11')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x2aa5fd=0x0,_0x3bdcd8=[],_0xb7e993=![];_0x2aa5fd<this['edges'][_0x2c7c01]['length'];_0x2aa5fd+=0x1){if(this['edges'][_0x2c7c01][_0x2aa5fd][_0x4685('0x12')]){_0x3bdcd8=this[_0x4685('0x6')][_0x2c7c01][_0x2aa5fd][_0x4685('0x12')]['split'](',');for(var _0x444097=0x0;_0x444097<_0x3bdcd8[_0x4685('0x11')];_0x444097+=0x1){if(this[_0x4685('0x5')][_0x2c7c01]['agicommand']===_0x4685('0x13')&&_0x3bdcd8[_0x444097]==='-'){_0xb7e993=this[_0x4685('0x6')][_0x2c7c01][_0x2aa5fd]['target'];logger['info'](_0x4685('0x14'),_0x3bdcd8[_0x444097],this[_0x4685('0x6')][_0x2c7c01][_0x2aa5fd]['target']);}else if(this[_0x4685('0x5')][_0x2c7c01]['agicommand']===_0x4685('0x15')&&_0x3bdcd8[_0x444097]==='i'){_0xb7e993=this['edges'][_0x2c7c01][_0x2aa5fd]['target'];logger['info']('invalid',_0x3bdcd8[_0x444097],this[_0x4685('0x6')][_0x2c7c01][_0x2aa5fd][_0x4685('0x16')]);}if(_0x3bdcd8[_0x444097]===_0x3b913c){return this['traverseBFS'](this[_0x4685('0x6')][_0x2c7c01][_0x2aa5fd][_0x4685('0x16')],_0x5e2c09);}}}else{return this[_0x4685('0xd')](this[_0x4685('0x6')][_0x2c7c01][_0x2aa5fd][_0x4685('0x16')],_0x5e2c09);}}if(_0x3bdcd8[_0x4685('0x11')]){if(this['vertices'][_0x2c7c01][_0x4685('0x17')]===_0x4685('0x13')){if(_0xb7e993){return this[_0x4685('0xd')](_0xb7e993,_0x5e2c09);}return logger[_0x4685('0xe')]('default\x20on\x20switch\x20not\x20found');}else if(_[_0x4685('0x18')](verticesWithRetry,this[_0x4685('0x5')][_0x2c7c01]['agicommand'])){if(_0x3b913c==='-'){return logger['info']('max\x20retry\x20reach');}if(_0xb7e993&&_0x3b913c!=='t'){return this['traverseBFS'](_0xb7e993,_0x5e2c09);}return this[_0x4685('0xd')](_0x2c7c01,_0x5e2c09);}return logger[_0x4685('0xe')](_0x4685('0x19'));}};module[_0x4685('0x1a')]=Graph;
\ No newline at end of file
+var _0x1fc7=['menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','target','agicommand','invalid','vswitch','includes','condition\x20not\x20found','lodash','../../../config/logger','agi'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x1fc7,0x8e));var _0x71fc=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x1fc7[_0x166742];return _0xb7814a;};'use strict';var _=require(_0x71fc('0x0'));var logger=require(_0x71fc('0x1'))(_0x71fc('0x2'));var verticesWithRetry=[_0x71fc('0x3'),_0x71fc('0x4'),_0x71fc('0x5')];var Graph=function(){this[_0x71fc('0x6')]={};this[_0x71fc('0x7')]={};this[_0x71fc('0x8')]=0x0;};Graph['prototype'][_0x71fc('0x9')]=function(_0x2e15f4){this[_0x71fc('0x6')][_0x2e15f4['id']]=_0x2e15f4;this[_0x71fc('0x7')][_0x2e15f4['id']]=[];};Graph[_0x71fc('0xa')][_0x71fc('0xb')]=function(_0x4912fe,_0x4ceb94,_0x42d628){this[_0x71fc('0x7')][_0x4912fe][_0x71fc('0xc')]({'target':_0x4ceb94,'condition':_0x42d628});this[_0x71fc('0x8')]+=0x1;};Graph[_0x71fc('0xa')][_0x71fc('0xd')]=function(){return _[_0x71fc('0xd')](this[_0x71fc('0x6')]);};Graph['prototype'][_0x71fc('0xe')]=function(){return this['numberOfEdges'];};Graph[_0x71fc('0xa')][_0x71fc('0xf')]=function(_0x5ac914){return this['vertices'][_0x5ac914];};Graph[_0x71fc('0xa')][_0x71fc('0x10')]=function(_0x30918b,_0x1e7560){if(!this[_0x71fc('0x6')][_0x30918b]){return logger[_0x71fc('0x11')]('no\x20vertex\x20found');}var _0x3c640c=_0x1e7560(this[_0x71fc('0x6')][_0x30918b]);if(!_0x3c640c){return logger[_0x71fc('0x11')](_0x71fc('0x12'));}if(this[_0x71fc('0x7')][_0x30918b][_0x71fc('0x13')]===0x0){return logger[_0x71fc('0x11')](_0x71fc('0x14'));}for(var _0x265173=0x0,_0x2da117=[],_0x5a7a73=![];_0x265173<this[_0x71fc('0x7')][_0x30918b][_0x71fc('0x13')];_0x265173+=0x1){if(this[_0x71fc('0x7')][_0x30918b][_0x265173][_0x71fc('0x15')]){_0x2da117=this['edges'][_0x30918b][_0x265173]['condition'][_0x71fc('0x16')](',');for(var _0x24401e=0x0;_0x24401e<_0x2da117['length'];_0x24401e+=0x1){if(this[_0x71fc('0x6')][_0x30918b]['agicommand']==='vswitch'&&_0x2da117[_0x24401e]==='-'){_0x5a7a73=this[_0x71fc('0x7')][_0x30918b][_0x265173][_0x71fc('0x17')];logger[_0x71fc('0x11')]('default',_0x2da117[_0x24401e],this['edges'][_0x30918b][_0x265173][_0x71fc('0x17')]);}else if(this[_0x71fc('0x6')][_0x30918b][_0x71fc('0x18')]===_0x71fc('0x3')&&_0x2da117[_0x24401e]==='i'){_0x5a7a73=this[_0x71fc('0x7')][_0x30918b][_0x265173][_0x71fc('0x17')];logger[_0x71fc('0x11')](_0x71fc('0x19'),_0x2da117[_0x24401e],this[_0x71fc('0x7')][_0x30918b][_0x265173]['target']);}if(_0x2da117[_0x24401e]===_0x3c640c){return this['traverseBFS'](this['edges'][_0x30918b][_0x265173][_0x71fc('0x17')],_0x1e7560);}}}else{return this[_0x71fc('0x10')](this['edges'][_0x30918b][_0x265173]['target'],_0x1e7560);}}if(_0x2da117['length']){if(this['vertices'][_0x30918b]['agicommand']===_0x71fc('0x1a')){if(_0x5a7a73){return this[_0x71fc('0x10')](_0x5a7a73,_0x1e7560);}return logger[_0x71fc('0x11')]('default\x20on\x20switch\x20not\x20found');}else if(_[_0x71fc('0x1b')](verticesWithRetry,this[_0x71fc('0x6')][_0x30918b][_0x71fc('0x18')])){if(_0x3c640c==='-'){return logger[_0x71fc('0x11')]('max\x20retry\x20reach');}if(_0x5a7a73&&_0x3c640c!=='t'){return this[_0x71fc('0x10')](_0x5a7a73,_0x1e7560);}return this[_0x71fc('0x10')](_0x30918b,_0x1e7560);}return logger['info'](_0x71fc('0x1c'));}};module['exports']=Graph;
\ No newline at end of file
index fcdec67..d65ae36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x065f=['127.0.0.1','stack','deleted','push','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','port','name','[%s]\x20%s','message','[ERROR]\x20%s','info','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','find','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter'];(function(_0x851d1d,_0x381180){var _0x821273=function(_0x507762){while(--_0x507762){_0x851d1d['push'](_0x851d1d['shift']());}};_0x821273(++_0x381180);}(_0x065f,0x1e6));var _0xf065=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x065f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xf065('0x0'));var syncho=require(_0xf065('0x1'));var util=require(_0xf065('0x2'));var config=require('../../config/environment');var logger=require(_0xf065('0x3'))(_0xf065('0x4'));var utilLicense=require(_0xf065('0x5'));var rpc=require(_0xf065('0x6'));var Project=require(_0xf065('0x7'));var AGIEmitter=require('./events')[_0xf065('0x8')];var projects=[];config[_0xf065('0x4')]=_['defaults'](config['agi'],{'ip':_0xf065('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x1a7870){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1a7870);agiHandler(_0x1a7870);}catch(_0x757caa){logger['error'](_0x757caa[_0xf065('0xa')]);}});});}function projectUpdateHandler(_0x903ddb){try{var _0x3dbd1b=_['findIndex'](projects,['id',_0x903ddb['id']]);if(_0x3dbd1b>-0x1){if(_0x903ddb[_0xf065('0xb')]===!![]){projects['splice'](_0x3dbd1b,0x1);}else{projects[_0x3dbd1b]=_0x903ddb;}}else{projects[_0xf065('0xc')](_0x903ddb);}}catch(_0x26a158){logger[_0xf065('0xd')](_0x26a158['stack']);}}function listeningHandler(){console[_0xf065('0xe')](_0xf065('0xf'),config[_0xf065('0x4')]['port']);logger['info'](util[_0xf065('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xf065('0x4')]['ip'],config['agi'][_0xf065('0x11')]));}function errorHandler(_0x9ab7ca){if(_0x9ab7ca&&_0x9ab7ca[_0xf065('0x12')]&&_0x9ab7ca['message']){logger[_0xf065('0xd')](util[_0xf065('0x10')](_0xf065('0x13'),_0x9ab7ca[_0xf065('0x12')],_0x9ab7ca[_0xf065('0x14')]));}else{logger[_0xf065('0xd')](util['format'](_0xf065('0x15'),_0x9ab7ca[_0xf065('0xa')]));}}function closeHandler(){logger[_0xf065('0x16')](util[_0xf065('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf065('0x17')],this[_0xf065('0x18')],this[_0xf065('0x19')],this[_0xf065('0x1a')],this[_0xf065('0x1b')]));try{createSquareReport(this);}catch(_0x1b2b06){logger[_0xf065('0xd')](_0x1b2b06[_0xf065('0xa')]);}}function timeoutHandler(){logger[_0xf065('0x16')](util[_0xf065('0x10')](_0xf065('0x1c'),this[_0xf065('0x17')],this[_0xf065('0x18')],this['callerid'],this[_0xf065('0x1a')],this['uniqueid']));}function hangupHandler(){logger[_0xf065('0x16')](util[_0xf065('0x10')](_0xf065('0x1d'),this[_0xf065('0x17')],this['calleridname'],this['callerid'],this[_0xf065('0x1a')],this[_0xf065('0x1b')]));this[_0xf065('0x1e')]=!![];}function createSquareReport(_0x65fba4,_0xa26ee1){rpc[_0xf065('0x1f')](_0x65fba4)[_0xf065('0x20')](function(_0x1681db){if(_0xa26ee1){_0xa26ee1(null,_0x1681db);}})['catch'](function(_0x29663d){if(_0xa26ee1){_0xa26ee1(null,_0x29663d);}});}function setChannelVariables(_0x3a5f30){for(var _0x213e98 in _0x3a5f30){if(_0x3a5f30[_0xf065('0x21')](_0x213e98)){if(_0x213e98[_0xf065('0x22')](_0xf065('0x23'))===0x0){_0x3a5f30[_0x213e98['substring'](0x4)]=_0x3a5f30[_0x213e98];delete _0x3a5f30[_0x213e98];}}}}function agiHandler(_0x539c6b){logger[_0xf065('0x24')]('variables',JSON[_0xf065('0x25')](_0x539c6b,null,0x2));logger[_0xf065('0x16')](util[_0xf065('0x10')](_0xf065('0x26'),_0x539c6b[_0xf065('0x17')],_0x539c6b[_0xf065('0x18')],_0x539c6b[_0xf065('0x19')],_0x539c6b[_0xf065('0x1a')],_0x539c6b[_0xf065('0x1b')]));_0x539c6b['on'](_0xf065('0xd'),errorHandler);_0x539c6b['on']('close',closeHandler);_0x539c6b['on']('timeout',timeoutHandler);_0x539c6b['evtHangup']=![];_0x539c6b['on'](_0xf065('0x27'),hangupHandler);var _0x6fe83=_[_0xf065('0x28')](projects,['name',_0x539c6b[_0xf065('0x17')]]);if(!_0x6fe83)return Project[_0xf065('0x29')](_0x539c6b);if(!_0x6fe83[_0xf065('0x2a')])return Project[_0xf065('0x2b')](_0x539c6b);return Project['initialize'](_0x6fe83,_0x539c6b);}function main(){var _0x3ed36b;return utilLicense[_0xf065('0x2c')]()[_0xf065('0x20')](function(_0x1784ff){if(!_0x1784ff)return;if(_0x1784ff[_0xf065('0x2d')]){if(_0x1784ff[_0xf065('0x2e')]&&_0x1784ff['callysquare']>0x0){logger['info'](util['format'](_0xf065('0x2f'),_0x1784ff['callysquare']));_0x3ed36b=_0x1784ff[_0xf065('0x2e')];}else{logger[_0xf065('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xf065('0x16')](_0xf065('0x30'));_0x3ed36b=-0x1;}})[_0xf065('0x20')](function(){return Project[_0xf065('0x31')]();})[_0xf065('0x20')](function(_0x153eed){projects=_0x153eed;return;})['catch'](function(_0x4ea621){logger['error'](_0xf065('0x32'),_0x4ea621['stack']);})[_0xf065('0x33')](function(){var _0x323b3a=require(_0xf065('0x34'))(config[_0xf065('0x4')][_0xf065('0x11')],config[_0xf065('0x4')]['ip'],_0x3ed36b);_0x323b3a['on'](_0xf065('0xd'),errorHandler);_0x323b3a['on'](_0xf065('0x35'),listeningHandler);_0x323b3a['on'](_0xf065('0x36'),connectionHandler);_0x323b3a['on']('close',closeHandler);});}main();
\ No newline at end of file
+var _0xa8fb=['[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','initialize','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','listening','connection','lodash','util','../../config/logger','agi','./rpc','./project','EventEmitter','127.0.0.1','error','stack','findIndex','deleted','splice','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','arg_1','calleridname','dnid','uniqueid'];(function(_0x138036,_0x33d0f5){var _0x432a83=function(_0xddb71c){while(--_0xddb71c){_0x138036['push'](_0x138036['shift']());}};_0x432a83(++_0x33d0f5);}(_0xa8fb,0x1d5));var _0xba8f=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xa8fb[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xba8f('0x0'));var syncho=require('syncho');var util=require(_0xba8f('0x1'));var config=require('../../config/environment');var logger=require(_0xba8f('0x2'))(_0xba8f('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0xba8f('0x4'));var Project=require(_0xba8f('0x5'));var AGIEmitter=require('./events')[_0xba8f('0x6')];var projects=[];config[_0xba8f('0x3')]=_['defaults'](config[_0xba8f('0x3')],{'ip':_0xba8f('0x7'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4edcd6){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4edcd6);agiHandler(_0x4edcd6);}catch(_0x300507){logger[_0xba8f('0x8')](_0x300507[_0xba8f('0x9')]);}});});}function projectUpdateHandler(_0x4648e9){try{var _0x278cb0=_[_0xba8f('0xa')](projects,['id',_0x4648e9['id']]);if(_0x278cb0>-0x1){if(_0x4648e9[_0xba8f('0xb')]===!![]){projects[_0xba8f('0xc')](_0x278cb0,0x1);}else{projects[_0x278cb0]=_0x4648e9;}}else{projects['push'](_0x4648e9);}}catch(_0x4ff134){logger['error'](_0x4ff134[_0xba8f('0x9')]);}}function listeningHandler(){console['log'](_0xba8f('0xd'),config[_0xba8f('0x3')][_0xba8f('0xe')]);logger[_0xba8f('0xf')](util[_0xba8f('0x10')](_0xba8f('0x11'),config['agi']['ip'],config[_0xba8f('0x3')][_0xba8f('0xe')]));}function errorHandler(_0x13dfd0){if(_0x13dfd0&&_0x13dfd0[_0xba8f('0x12')]&&_0x13dfd0['message']){logger['error'](util['format'](_0xba8f('0x13'),_0x13dfd0[_0xba8f('0x12')],_0x13dfd0[_0xba8f('0x14')]));}else{logger['error'](util['format'](_0xba8f('0x15'),_0x13dfd0['stack']));}}function closeHandler(){logger[_0xba8f('0xf')](util[_0xba8f('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xba8f('0x16')],this[_0xba8f('0x17')],this['callerid'],this[_0xba8f('0x18')],this[_0xba8f('0x19')]));try{createSquareReport(this);}catch(_0x38ddaa){logger[_0xba8f('0x8')](_0x38ddaa[_0xba8f('0x9')]);}}function timeoutHandler(){logger['info'](util[_0xba8f('0x10')](_0xba8f('0x1a'),this['arg_1'],this[_0xba8f('0x17')],this[_0xba8f('0x1b')],this[_0xba8f('0x18')],this[_0xba8f('0x19')]));}function hangupHandler(){logger[_0xba8f('0xf')](util[_0xba8f('0x10')](_0xba8f('0x1c'),this['arg_1'],this[_0xba8f('0x17')],this[_0xba8f('0x1b')],this['dnid'],this[_0xba8f('0x19')]));this[_0xba8f('0x1d')]=!![];}function createSquareReport(_0xe1ec59,_0x2fd6a5){rpc[_0xba8f('0x1e')](_0xe1ec59)['then'](function(_0x4098c3){if(_0x2fd6a5){_0x2fd6a5(null,_0x4098c3);}})[_0xba8f('0x1f')](function(_0x1b981e){if(_0x2fd6a5){_0x2fd6a5(null,_0x1b981e);}});}function setChannelVariables(_0x3ea59f){for(var _0x4dda74 in _0x3ea59f){if(_0x3ea59f[_0xba8f('0x20')](_0x4dda74)){if(_0x4dda74['indexOf'](_0xba8f('0x21'))===0x0){_0x3ea59f[_0x4dda74[_0xba8f('0x22')](0x4)]=_0x3ea59f[_0x4dda74];delete _0x3ea59f[_0x4dda74];}}}}function agiHandler(_0xb7e72){logger[_0xba8f('0x23')]('variables',JSON[_0xba8f('0x24')](_0xb7e72,null,0x2));logger[_0xba8f('0xf')](util['format'](_0xba8f('0x25'),_0xb7e72[_0xba8f('0x16')],_0xb7e72[_0xba8f('0x17')],_0xb7e72[_0xba8f('0x1b')],_0xb7e72['dnid'],_0xb7e72['uniqueid']));_0xb7e72['on']('error',errorHandler);_0xb7e72['on'](_0xba8f('0x26'),closeHandler);_0xb7e72['on'](_0xba8f('0x27'),timeoutHandler);_0xb7e72['evtHangup']=![];_0xb7e72['on'](_0xba8f('0x28'),hangupHandler);var _0x31ff2e=_[_0xba8f('0x29')](projects,['name',_0xb7e72[_0xba8f('0x16')]]);if(!_0x31ff2e)return Project[_0xba8f('0x2a')](_0xb7e72);if(!_0x31ff2e[_0xba8f('0x2b')])return Project['handleUnpublished'](_0xb7e72);return Project[_0xba8f('0x2c')](_0x31ff2e,_0xb7e72);}function main(){var _0x290311;return utilLicense[_0xba8f('0x2d')]()[_0xba8f('0x2e')](function(_0x3225ed){if(!_0x3225ed)return;if(_0x3225ed['voice']){if(_0x3225ed[_0xba8f('0x2f')]&&_0x3225ed[_0xba8f('0x2f')]>0x0){logger[_0xba8f('0xf')](util[_0xba8f('0x10')](_0xba8f('0x30'),_0x3225ed[_0xba8f('0x2f')]));_0x290311=_0x3225ed['callysquare'];}else{logger['info'](_0xba8f('0x31'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x290311=-0x1;}})[_0xba8f('0x2e')](function(){return Project[_0xba8f('0x32')]();})['then'](function(_0x494aaa){projects=_0x494aaa;return;})[_0xba8f('0x1f')](function(_0x331d86){logger[_0xba8f('0x8')](_0xba8f('0x33'),_0x331d86[_0xba8f('0x9')]);})[_0xba8f('0x34')](function(){var _0x67a04d=require('./server')(config['agi'][_0xba8f('0xe')],config[_0xba8f('0x3')]['ip'],_0x290311);_0x67a04d['on'](_0xba8f('0x8'),errorHandler);_0x67a04d['on'](_0xba8f('0x35'),listeningHandler);_0x67a04d['on'](_0xba8f('0x36'),connectionHandler);_0x67a04d['on'](_0xba8f('0x26'),closeHandler);});}main();
\ No newline at end of file
index b8f4a5f..8b98112 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e0f=['request','then','error','message','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0xd13171,_0xc54453){var _0x452bd0=function(_0x3c0628){while(--_0x3c0628){_0xd13171['push'](_0xd13171['shift']());}};_0x452bd0(++_0xc54453);}(_0x2e0f,0x1bf));var _0xf2e0=function(_0x2c911f,_0x4757a1){_0x2c911f=_0x2c911f-0x0;var _0x417dc4=_0x2e0f[_0x2c911f];return _0x417dc4;};'use strict';var BPromise=require(_0xf2e0('0x0'));var jayson=require(_0xf2e0('0x1'));var client=jayson['client'][_0xf2e0('0x2')]({'port':0x232b});function request(_0x5d21b2,_0x4ca91f){return new BPromise(function(_0x461766,_0x55525e){return client[_0xf2e0('0x3')](_0x5d21b2,_0x4ca91f)[_0xf2e0('0x4')](function(_0x60c457){if(_0x60c457[_0xf2e0('0x5')]){return _0x55525e(_0x60c457[_0xf2e0('0x5')][_0xf2e0('0x6')]);}else{return _0x461766(_0x60c457['result']);}})['catch'](function(_0x70a27e){return _0x55525e(_0x70a27e);});});}exports[_0xf2e0('0x7')]=function(_0x5bc03c,_0x36412f){return request(_0xf2e0('0x8'),{'account':_0x5bc03c,'message':_0x36412f});};
\ No newline at end of file
+var _0xa9e8=['result','catch','SendMail','bluebird','jayson/promise','http','then','error','message'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xa9e8,0x111));var _0x8a9e=function(_0x44922b,_0x1cc2a9){_0x44922b=_0x44922b-0x0;var _0x244e49=_0xa9e8[_0x44922b];return _0x244e49;};'use strict';var BPromise=require(_0x8a9e('0x0'));var jayson=require(_0x8a9e('0x1'));var client=jayson['client'][_0x8a9e('0x2')]({'port':0x232b});function request(_0x44103a,_0x5cda39){return new BPromise(function(_0x543c36,_0x29c3d4){return client['request'](_0x44103a,_0x5cda39)[_0x8a9e('0x3')](function(_0x52de97){if(_0x52de97[_0x8a9e('0x4')]){return _0x29c3d4(_0x52de97[_0x8a9e('0x4')][_0x8a9e('0x5')]);}else{return _0x543c36(_0x52de97[_0x8a9e('0x6')]);}})[_0x8a9e('0x7')](function(_0x476088){return _0x29c3d4(_0x476088);});});}exports['sendMailMessage']=function(_0x13cf79,_0x429972){return request(_0x8a9e('0x8'),{'account':_0x13cf79,'message':_0x429972});};
\ No newline at end of file
index b0534e8..9fb9b15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaef6=['start','debug','joinAt','format','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','stringify','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','agicommand\x20not\x20found','finally','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','maxRetry','omit','mxCell','hasOwnProperty','length','source','target','addEdge','toJson','mxGraphModel','root','inspect','production'];(function(_0x3e931d,_0x3c8900){var _0x4aa832=function(_0x55cc1b){while(--_0x55cc1b){_0x3e931d['push'](_0x3e931d['shift']());}};_0x4aa832(++_0x3c8900);}(_0xaef6,0x99));var _0x6aef=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xaef6[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var moment=require(_0x6aef('0x0'));var parser=require(_0x6aef('0x1'));var util=require(_0x6aef('0x2'));var logger=require(_0x6aef('0x3'))(_0x6aef('0x4'));var rpc=require(_0x6aef('0x5'));var mailRpc=require(_0x6aef('0x6'));var Graph=require('./graph');var Vertices=require(_0x6aef('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6aef('0x8')]()[_0x6aef('0x9')](function(_0x273a1f){logger[_0x6aef('0xa')](_0x6aef('0xb'),_0x273a1f[_0x6aef('0xc')]);return[];});}function addVertex(_0x3a514a,_0x50f551,_0x5e82ef){_0x50f551['agicommand']=_0x5e82ef;if(_0x50f551['hasOwnProperty'](_0x6aef('0xd'))){_0x50f551[_0x6aef('0xe')]=parseInt(_0x50f551['retry'],0xa);}_0x3a514a['addVertex'](_[_0x6aef('0xf')](_0x50f551,_0x6aef('0x10')));}function initGraph(_0x33cb6a,_0x495765){var _0x5ee0c2=new Graph();for(var _0x1033c9 in _0x33cb6a){if(_0x33cb6a[_0x6aef('0x11')](_0x1033c9)){if(_['isArray'](_0x33cb6a[_0x1033c9])){for(var _0x1b256e=0x0;_0x1b256e<_0x33cb6a[_0x1033c9][_0x6aef('0x12')];_0x1b256e+=0x1){addVertex(_0x5ee0c2,_0x33cb6a[_0x1033c9][_0x1b256e],_0x1033c9);}}else{addVertex(_0x5ee0c2,_0x33cb6a[_0x1033c9],_0x1033c9);}}}for(var _0x993e23=0x0;_0x993e23<_0x495765[_0x6aef('0x12')];_0x993e23+=0x1){if(_0x495765[_0x993e23][_0x6aef('0x13')]&&_0x495765[_0x993e23][_0x6aef('0x14')]){_0x5ee0c2[_0x6aef('0x15')](_0x495765[_0x993e23][_0x6aef('0x13')],_0x495765[_0x993e23][_0x6aef('0x14')],_0x495765[_0x993e23]['value']);}}return _0x5ee0c2;}function getRoot(_0x4bf20c){return parser[_0x6aef('0x16')](_0x4bf20c,{'object':!![]})[_0x6aef('0x17')][_0x6aef('0x18')];}function inspect(_0x599ba5){return util[_0x6aef('0x19')](_0x599ba5,{'showHidden':![],'depth':null});}function initialize(_0x54e61d,_0x4f3c95){var _0x5de6d3=getRoot(_0x54e61d[_0x6aef('0x1a')]);if(!_0x5de6d3||!_0x5de6d3[_0x6aef('0x1b')])return;var _0x2a7101,_0x2d4a0d,_0x14e6de;logger[_0x6aef('0x1c')](_0x6aef('0x18'),JSON['stringify'](_0x5de6d3,null,0x2));_0x4f3c95[_0x6aef('0x1d')]=moment()[_0x6aef('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a7101=initGraph(_['omit'](_0x5de6d3,_0x6aef('0x10')),_0x5de6d3[_0x6aef('0x10')]);_0x2d4a0d=new Vertices(_0x4f3c95,rpc,mailRpc);logger[_0x6aef('0x1f')](util[_0x6aef('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4f3c95[_0x6aef('0x20')],_0x4f3c95[_0x6aef('0x21')],_0x4f3c95[_0x6aef('0x22')],_0x4f3c95[_0x6aef('0x23')],_0x4f3c95[_0x6aef('0x24')]));_0x2a7101[_0x6aef('0x25')](_0x5de6d3['start']['id'],function(_0xc885fc){try{_0xc885fc=_0x2d4a0d[_0x6aef('0x26')](_0xc885fc);logger[_0x6aef('0x1c')](_0x6aef('0x27'),JSON[_0x6aef('0x28')](_0xc885fc,null,0x2));if(_0xc885fc[_0x6aef('0x29')]===_0x6aef('0x2a')){logger[_0x6aef('0x1f')](_0x6aef('0x2b'));_0x4f3c95[_0x6aef('0x2c')]=_0xc885fc[_0x6aef('0x2c')]||_0x4f3c95[_0x6aef('0x2c')];_0x4f3c95[_0x6aef('0x2d')]=_0xc885fc[_0x6aef('0x2d')];_0x4f3c95[_0x6aef('0x2e')]=_0xc885fc['priority']?_0xc885fc['priority']-0x1:0x1;return null;}else if(_0xc885fc&&_0x2d4a0d[_0xc885fc[_0x6aef('0x29')]]){_0x14e6de=_0x2d4a0d[_0xc885fc[_0x6aef('0x29')]](_0xc885fc);logger[_0x6aef('0x1f')](_0x6aef('0x2f'),JSON[_0x6aef('0x28')](_0x14e6de,null,0x2));if(_0x14e6de&&_0x14e6de[_0x6aef('0x30')]===AGI_CODE_SUCCESS&&_0x14e6de[_0x6aef('0x31')]!==AGI_RESULT_ERROR&&!_0x4f3c95[_0x6aef('0x32')]){logger[_0x6aef('0x1c')]('response',inspect(_0x14e6de));return _['isUndefined'](_0x14e6de[_0x6aef('0x31')])?null:_0x14e6de[_0x6aef('0x31')]['toString']();}else{logger['error'](_0x6aef('0x2f'),inspect(_0x14e6de));return null;}}else{logger[_0x6aef('0xa')](_0x6aef('0x33'));return null;}}catch(_0x812b6d){logger[_0x6aef('0xa')](_0x812b6d[_0x6aef('0xc')]);return null;}});if(_0x5de6d3[_0x6aef('0x34')]){logger[_0x6aef('0x1f')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4f3c95['arg_1'],_0x4f3c95[_0x6aef('0x21')],_0x4f3c95[_0x6aef('0x22')],_0x4f3c95[_0x6aef('0x23')],_0x4f3c95[_0x6aef('0x24')]));_0x2a7101[_0x6aef('0x25')](_0x5de6d3[_0x6aef('0x34')]['id'],function(_0x7ca8f5){try{_0x7ca8f5=_0x2d4a0d[_0x6aef('0x26')](_0x7ca8f5);logger['debug']('vertex',JSON[_0x6aef('0x28')](_0x7ca8f5,null,0x2));if(_0x7ca8f5&&_0x2d4a0d[_0x7ca8f5['agicommand']]){_0x14e6de=_0x2d4a0d[_0x7ca8f5[_0x6aef('0x29')]](_0x7ca8f5);if(_0x14e6de){logger['debug'](_0x6aef('0x2f'),inspect(_0x14e6de));return _[_0x6aef('0x35')](_0x14e6de[_0x6aef('0x31')])?null:_0x14e6de['result']['toString']();}else{logger['error'](_0x6aef('0x2f'),inspect(_0x14e6de));return null;}}else{logger['error'](_0x6aef('0x33'));return null;}}catch(_0x5a696a){logger[_0x6aef('0xa')](_0x5a696a[_0x6aef('0xc')]);return null;}});}logger[_0x6aef('0x1f')](util[_0x6aef('0x1e')](_0x6aef('0x36'),_0x4f3c95[_0x6aef('0x20')],_0x4f3c95[_0x6aef('0x21')],_0x4f3c95[_0x6aef('0x22')],_0x4f3c95[_0x6aef('0x23')],_0x4f3c95[_0x6aef('0x24')]));logger[_0x6aef('0x1f')](util[_0x6aef('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4f3c95[_0x6aef('0x2c')],_0x4f3c95[_0x6aef('0x2d')],parseInt(_0x4f3c95['priority'],0xa)+0x1));_0x4f3c95[_0x6aef('0x37')](_0x4f3c95[_0x6aef('0x2c')],_0x4f3c95[_0x6aef('0x2d')],parseInt(_0x4f3c95[_0x6aef('0x2e')],0xa)+0x1);_0x4f3c95[_0x6aef('0x38')]();}function handleNotFound(_0x5c0db2){logger[_0x6aef('0xa')](util[_0x6aef('0x1e')](_0x6aef('0x39'),_0x5c0db2['arg_1']));_0x5c0db2[_0x6aef('0x37')](_0x5c0db2['context'],_0x5c0db2[_0x6aef('0x2d')],parseInt(_0x5c0db2[_0x6aef('0x2e')],0xa)+0x1);_0x5c0db2[_0x6aef('0x38')]();}function handleUnpublished(_0x58bd87){logger[_0x6aef('0xa')](util[_0x6aef('0x1e')](_0x6aef('0x3a'),_0x58bd87['arg_1']));_0x58bd87[_0x6aef('0x37')](_0x58bd87[_0x6aef('0x2c')],_0x58bd87[_0x6aef('0x2d')],parseInt(_0x58bd87[_0x6aef('0x2e')],0xa)+0x1);_0x58bd87[_0x6aef('0x38')]();}module[_0x6aef('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0xb8a7=['uniqueid','traverseBFS','clear','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','agi','./mailRpc','./vertices','getSquareProjects','stack','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','mxGraphModel','root','inspect','start','debug','stringify','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid'];(function(_0x21d66c,_0x5d69c3){var _0x4f0eba=function(_0x472730){while(--_0x472730){_0x21d66c['push'](_0x21d66c['shift']());}};_0x4f0eba(++_0x5d69c3);}(_0xb8a7,0x1da));var _0x7b8a=function(_0x2776fd,_0x229ab3){_0x2776fd=_0x2776fd-0x0;var _0x14189a=_0xb8a7[_0x2776fd];return _0x14189a;};'use strict';var _=require(_0x7b8a('0x0'));var moment=require('moment');var parser=require(_0x7b8a('0x1'));var util=require(_0x7b8a('0x2'));var logger=require('../../config/logger')(_0x7b8a('0x3'));var rpc=require('./rpc');var mailRpc=require(_0x7b8a('0x4'));var Graph=require('./graph');var Vertices=require(_0x7b8a('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7b8a('0x6')]()['catch'](function(_0x44950f){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x44950f[_0x7b8a('0x7')]);return[];});}function addVertex(_0x104727,_0x357817,_0x4c663d){_0x357817['agicommand']=_0x4c663d;if(_0x357817['hasOwnProperty'](_0x7b8a('0x8'))){_0x357817[_0x7b8a('0x9')]=parseInt(_0x357817[_0x7b8a('0x8')],0xa);}_0x104727[_0x7b8a('0xa')](_[_0x7b8a('0xb')](_0x357817,_0x7b8a('0xc')));}function initGraph(_0x401962,_0x671752){var _0x13edc8=new Graph();for(var _0x421886 in _0x401962){if(_0x401962['hasOwnProperty'](_0x421886)){if(_[_0x7b8a('0xd')](_0x401962[_0x421886])){for(var _0x41ff42=0x0;_0x41ff42<_0x401962[_0x421886][_0x7b8a('0xe')];_0x41ff42+=0x1){addVertex(_0x13edc8,_0x401962[_0x421886][_0x41ff42],_0x421886);}}else{addVertex(_0x13edc8,_0x401962[_0x421886],_0x421886);}}}for(var _0x2354c1=0x0;_0x2354c1<_0x671752[_0x7b8a('0xe')];_0x2354c1+=0x1){if(_0x671752[_0x2354c1][_0x7b8a('0xf')]&&_0x671752[_0x2354c1]['target']){_0x13edc8[_0x7b8a('0x10')](_0x671752[_0x2354c1][_0x7b8a('0xf')],_0x671752[_0x2354c1]['target'],_0x671752[_0x2354c1]['value']);}}return _0x13edc8;}function getRoot(_0x3aae5d){return parser['toJson'](_0x3aae5d,{'object':!![]})[_0x7b8a('0x11')][_0x7b8a('0x12')];}function inspect(_0x118ba5){return util[_0x7b8a('0x13')](_0x118ba5,{'showHidden':![],'depth':null});}function initialize(_0x2abf29,_0x1b49f5){var _0x3b42bf=getRoot(_0x2abf29['production']);if(!_0x3b42bf||!_0x3b42bf[_0x7b8a('0x14')])return;var _0x180ac2,_0x28bf16,_0x387f14;logger[_0x7b8a('0x15')](_0x7b8a('0x12'),JSON[_0x7b8a('0x16')](_0x3b42bf,null,0x2));_0x1b49f5['joinAt']=moment()[_0x7b8a('0x17')]('YYYY-MM-DD\x20HH:mm:ss');_0x180ac2=initGraph(_[_0x7b8a('0xb')](_0x3b42bf,'mxCell'),_0x3b42bf['mxCell']);_0x28bf16=new Vertices(_0x1b49f5,rpc,mailRpc);logger[_0x7b8a('0x18')](util[_0x7b8a('0x17')](_0x7b8a('0x19'),_0x1b49f5[_0x7b8a('0x1a')],_0x1b49f5[_0x7b8a('0x1b')],_0x1b49f5[_0x7b8a('0x1c')],_0x1b49f5[_0x7b8a('0x1d')],_0x1b49f5[_0x7b8a('0x1e')]));_0x180ac2[_0x7b8a('0x1f')](_0x3b42bf[_0x7b8a('0x14')]['id'],function(_0x3f7f88){try{_0x3f7f88=_0x28bf16[_0x7b8a('0x20')](_0x3f7f88);logger[_0x7b8a('0x15')]('vertex',JSON[_0x7b8a('0x16')](_0x3f7f88,null,0x2));if(_0x3f7f88[_0x7b8a('0x21')]===_0x7b8a('0x22')){logger['info'](_0x7b8a('0x23'));_0x1b49f5[_0x7b8a('0x24')]=_0x3f7f88[_0x7b8a('0x24')]||_0x1b49f5[_0x7b8a('0x24')];_0x1b49f5['extension']=_0x3f7f88[_0x7b8a('0x25')];_0x1b49f5[_0x7b8a('0x26')]=_0x3f7f88['priority']?_0x3f7f88[_0x7b8a('0x26')]-0x1:0x1;return null;}else if(_0x3f7f88&&_0x28bf16[_0x3f7f88[_0x7b8a('0x21')]]){_0x387f14=_0x28bf16[_0x3f7f88['agicommand']](_0x3f7f88);logger['info'](_0x7b8a('0x27'),JSON[_0x7b8a('0x16')](_0x387f14,null,0x2));if(_0x387f14&&_0x387f14[_0x7b8a('0x28')]===AGI_CODE_SUCCESS&&_0x387f14[_0x7b8a('0x29')]!==AGI_RESULT_ERROR&&!_0x1b49f5[_0x7b8a('0x2a')]){logger[_0x7b8a('0x15')](_0x7b8a('0x27'),inspect(_0x387f14));return _[_0x7b8a('0x2b')](_0x387f14[_0x7b8a('0x29')])?null:_0x387f14['result'][_0x7b8a('0x2c')]();}else{logger[_0x7b8a('0x2d')]('response',inspect(_0x387f14));return null;}}else{logger[_0x7b8a('0x2d')](_0x7b8a('0x2e'));return null;}}catch(_0x2c982f){logger[_0x7b8a('0x2d')](_0x2c982f[_0x7b8a('0x7')]);return null;}});if(_0x3b42bf['finally']){logger[_0x7b8a('0x18')](util[_0x7b8a('0x17')](_0x7b8a('0x2f'),_0x1b49f5[_0x7b8a('0x1a')],_0x1b49f5[_0x7b8a('0x1b')],_0x1b49f5[_0x7b8a('0x1c')],_0x1b49f5['dnid'],_0x1b49f5[_0x7b8a('0x1e')]));_0x180ac2[_0x7b8a('0x1f')](_0x3b42bf[_0x7b8a('0x30')]['id'],function(_0x43cab8){try{_0x43cab8=_0x28bf16['clear'](_0x43cab8);logger[_0x7b8a('0x15')](_0x7b8a('0x31'),JSON[_0x7b8a('0x16')](_0x43cab8,null,0x2));if(_0x43cab8&&_0x28bf16[_0x43cab8[_0x7b8a('0x21')]]){_0x387f14=_0x28bf16[_0x43cab8[_0x7b8a('0x21')]](_0x43cab8);if(_0x387f14){logger['debug'](_0x7b8a('0x27'),inspect(_0x387f14));return _[_0x7b8a('0x2b')](_0x387f14[_0x7b8a('0x29')])?null:_0x387f14[_0x7b8a('0x29')][_0x7b8a('0x2c')]();}else{logger[_0x7b8a('0x2d')](_0x7b8a('0x27'),inspect(_0x387f14));return null;}}else{logger[_0x7b8a('0x2d')]('agicommand\x20not\x20found');return null;}}catch(_0x3f5ad3){logger[_0x7b8a('0x2d')](_0x3f5ad3[_0x7b8a('0x7')]);return null;}});}logger[_0x7b8a('0x18')](util[_0x7b8a('0x17')](_0x7b8a('0x32'),_0x1b49f5['arg_1'],_0x1b49f5[_0x7b8a('0x1b')],_0x1b49f5[_0x7b8a('0x1c')],_0x1b49f5[_0x7b8a('0x1d')],_0x1b49f5[_0x7b8a('0x1e')]));logger[_0x7b8a('0x18')](util[_0x7b8a('0x17')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1b49f5['context'],_0x1b49f5[_0x7b8a('0x25')],parseInt(_0x1b49f5['priority'],0xa)+0x1));_0x1b49f5[_0x7b8a('0x33')](_0x1b49f5[_0x7b8a('0x24')],_0x1b49f5[_0x7b8a('0x25')],parseInt(_0x1b49f5['priority'],0xa)+0x1);_0x1b49f5[_0x7b8a('0x34')]();}function handleNotFound(_0x12c2b0){logger[_0x7b8a('0x2d')](util[_0x7b8a('0x17')](_0x7b8a('0x35'),_0x12c2b0[_0x7b8a('0x1a')]));_0x12c2b0[_0x7b8a('0x33')](_0x12c2b0[_0x7b8a('0x24')],_0x12c2b0[_0x7b8a('0x25')],parseInt(_0x12c2b0['priority'],0xa)+0x1);_0x12c2b0[_0x7b8a('0x34')]();}function handleUnpublished(_0x3694c0){logger['error'](util[_0x7b8a('0x17')](_0x7b8a('0x36'),_0x3694c0['arg_1']));_0x3694c0['continueAt'](_0x3694c0[_0x7b8a('0x24')],_0x3694c0[_0x7b8a('0x25')],parseInt(_0x3694c0[_0x7b8a('0x26')],0xa)+0x1);_0x3694c0[_0x7b8a('0x34')]();}module[_0x7b8a('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
index 37769ac..70af9d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x407f=['split','indexOf','slice','trim','emit','line','exports','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length'];(function(_0x1b6587,_0x2efdc6){var _0x1fdf1c=function(_0x56afdc){while(--_0x56afdc){_0x1b6587['push'](_0x1b6587['shift']());}};_0x1fdf1c(++_0x2efdc6);}(_0x407f,0xc2));var _0xf407=function(_0x2b5c82,_0x5dadd7){_0x2b5c82=_0x2b5c82-0x0;var _0x29d9f1=_0x407f[_0x2b5c82];return _0x29d9f1;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0x34f89a){Transform[_0xf407('0x0')](this,_0x34f89a);this[_0xf407('0x1')]='';this[_0xf407('0x2')]=![];}util[_0xf407('0x3')](AGIReply,Transform);AGIReply[_0xf407('0x4')][_0xf407('0x5')]=function(_0x2bb1e4,_0x14df0c,_0x160f5c){var _0x438076='\x0a',_0x2bce9d=['\x0a\x0a',_0xf407('0x6')],_0x2d4ec6=-0x1,_0x3ac774=-0x1,_0x38ee37='',_0x3ab539=0x0,_0x5dc169='',_0x2291a7='';this[_0xf407('0x1')]+=_0x2bb1e4[_0xf407('0x7')]();_0x5dc169=this['_localBuffer'];if(!this['_inBody']){_0x3ab539=0x0;while(_0x2bce9d[_0x3ab539]){while((_0x3ac774=_0x5dc169['indexOf'](_0x2bce9d[_0x3ab539]))!=-0x1){_0x38ee37=_0x2bce9d[_0x3ab539];_0x2291a7=_0x5dc169[_0xf407('0x8')](0x0,_0x3ac774);_0x5dc169=_0x5dc169[_0xf407('0x8')](_0x3ac774+_0x38ee37[_0xf407('0x9')]);var _0x8f126=_0x2291a7[_0xf407('0xa')](_0x438076),_0x261ac2=0x0,_0x5637a5={},_0x2ee485='',_0x3f4ca0='',_0x3b26ae=-0x1;while(_0x8f126[_0x261ac2]){_0x3b26ae=_0x8f126[_0x261ac2][_0xf407('0xb')](':');if(_0x3b26ae!=-0x1){_0x2ee485=_0x8f126[_0x261ac2][_0xf407('0xc')](0x0,_0x3b26ae)[_0xf407('0xd')]();_0x3f4ca0=_0x8f126[_0x261ac2][_0xf407('0xc')](_0x3b26ae+0x1)['trim']();if(_0x2ee485['length']>0x0){_0x5637a5[_0x2ee485]=_0x3f4ca0;}}else{}_0x261ac2++;}this[_0xf407('0xe')]('headers',_0x5637a5);this[_0xf407('0x2')]=!![];}_0x3ab539++;}this['_localBuffer']=_0x5dc169;}else{while((_0x2d4ec6=_0x5dc169['indexOf'](_0x438076))!=-0x1){_0x2291a7=_0x5dc169[_0xf407('0x8')](0x0,_0x2d4ec6);this[_0xf407('0xe')](_0xf407('0xf'),_0x2291a7);_0x5dc169=_0x5dc169[_0xf407('0x8')](_0x2d4ec6+_0x438076[_0xf407('0x9')]);}this[_0xf407('0x1')]=_0x5dc169;}_0x160f5c();};module[_0xf407('0x10')]=AGIReply;
\ No newline at end of file
+var _0x422f=['inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_inBody','indexOf','substring','length','split','slice','trim','emit','line','util','Transform','call','_localBuffer'];(function(_0x4d7fe4,_0x219869){var _0x265025=function(_0x1f2e5f){while(--_0x1f2e5f){_0x4d7fe4['push'](_0x4d7fe4['shift']());}};_0x265025(++_0x219869);}(_0x422f,0xd9));var _0xf422=function(_0x1b72c7,_0x2dac06){_0x1b72c7=_0x1b72c7-0x0;var _0x1c1f20=_0x422f[_0x1b72c7];return _0x1c1f20;};'use strict';var util=require(_0xf422('0x0'));var Transform=require('stream')[_0xf422('0x1')];function AGIReply(_0x77eab){Transform[_0xf422('0x2')](this,_0x77eab);this[_0xf422('0x3')]='';this['_inBody']=![];}util[_0xf422('0x4')](AGIReply,Transform);AGIReply[_0xf422('0x5')][_0xf422('0x6')]=function(_0x457b77,_0x4a98d6,_0x3e1912){var _0xf773d7='\x0a',_0x3df250=['\x0a\x0a',_0xf422('0x7')],_0x3b667b=-0x1,_0x44e391=-0x1,_0x3f6f26='',_0x4b88de=0x0,_0x416bae='',_0x11b036='';this[_0xf422('0x3')]+=_0x457b77['toString']();_0x416bae=this[_0xf422('0x3')];if(!this[_0xf422('0x8')]){_0x4b88de=0x0;while(_0x3df250[_0x4b88de]){while((_0x44e391=_0x416bae[_0xf422('0x9')](_0x3df250[_0x4b88de]))!=-0x1){_0x3f6f26=_0x3df250[_0x4b88de];_0x11b036=_0x416bae[_0xf422('0xa')](0x0,_0x44e391);_0x416bae=_0x416bae[_0xf422('0xa')](_0x44e391+_0x3f6f26[_0xf422('0xb')]);var _0x205f11=_0x11b036[_0xf422('0xc')](_0xf773d7),_0x297962=0x0,_0x1bbd79={},_0x25e76b='',_0x13a632='',_0x58fb19=-0x1;while(_0x205f11[_0x297962]){_0x58fb19=_0x205f11[_0x297962][_0xf422('0x9')](':');if(_0x58fb19!=-0x1){_0x25e76b=_0x205f11[_0x297962][_0xf422('0xd')](0x0,_0x58fb19)[_0xf422('0xe')]();_0x13a632=_0x205f11[_0x297962][_0xf422('0xd')](_0x58fb19+0x1)[_0xf422('0xe')]();if(_0x25e76b[_0xf422('0xb')]>0x0){_0x1bbd79[_0x25e76b]=_0x13a632;}}else{}_0x297962++;}this[_0xf422('0xf')]('headers',_0x1bbd79);this[_0xf422('0x8')]=!![];}_0x4b88de++;}this[_0xf422('0x3')]=_0x416bae;}else{while((_0x3b667b=_0x416bae[_0xf422('0x9')](_0xf773d7))!=-0x1){_0x11b036=_0x416bae[_0xf422('0xa')](0x0,_0x3b667b);this[_0xf422('0xf')](_0xf422('0x10'),_0x11b036);_0x416bae=_0x416bae[_0xf422('0xa')](_0x3b667b+_0xf773d7[_0xf422('0xb')]);}this[_0xf422('0x3')]=_0x416bae;}_0x3e1912();};module['exports']=AGIReply;
\ No newline at end of file
index f6fcf69..9bacbf8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61a5=['request','error','message','result','catch','GetSquareProjects','production','getSquareProject','ShowSquareProject','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','then','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http'];(function(_0x506b51,_0x2d2b6d){var _0xca5779=function(_0x5f0fcb){while(--_0x5f0fcb){_0x506b51['push'](_0x506b51['shift']());}};_0xca5779(++_0x2d2b6d);}(_0x61a5,0xf0));var _0x561a=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0x61a5[_0x48e86c];return _0x54fa11;};'use strict';var _=require(_0x561a('0x0'));var moment=require('moment');var jayson=require(_0x561a('0x1'));var client=jayson[_0x561a('0x2')][_0x561a('0x3')]({'port':0x2329});function request(_0x862a0e,_0x29ccea){return new Promise(function(_0x58f636,_0xe92b4d){return client[_0x561a('0x4')](_0x862a0e,_0x29ccea)['then'](function(_0x18902a){if(_0x18902a[_0x561a('0x5')]){return _0xe92b4d(_0x18902a[_0x561a('0x5')][_0x561a('0x6')]);}else{return _0x58f636(_0x18902a[_0x561a('0x7')]);}})[_0x561a('0x8')](function(_0x1d5814){return _0xe92b4d(_0x1d5814);});});}exports['getSquareProjects']=function(){return request(_0x561a('0x9'),{'options':{'raw':![],'attributes':['id','name',_0x561a('0xa')]}});};exports[_0x561a('0xb')]=function(_0x5b3510){return request(_0x561a('0xc'),{'options':{'raw':![],'where':{'name':_0x5b3510},'attributes':[_0x561a('0xa')]}});};exports['getMailAccountById']=function(_0x3a1eee){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3a1eee},'include':[{'model':_0x561a('0xd'),'as':_0x561a('0xe'),'include':[{'model':_0x561a('0xf'),'as':_0x561a('0xf')}]}],'attributes':['id',_0x561a('0x10'),_0x561a('0x11')],'smtp':!![]}});};exports[_0x561a('0x12')]=function(_0x22c89d){return request(_0x561a('0xc'),{'options':{'where':{'id':_0x22c89d},'attributes':[_0x561a('0x10')]}});};exports[_0x561a('0x13')]=function(_0x28638b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x28638b},'attributes':[_0x561a('0x10')]}});};exports[_0x561a('0x14')]=function(_0x1ab5ae){return request(_0x561a('0x15'),{'options':{'where':{'id':_0x1ab5ae},'attributes':[_0x561a('0x10')]}});};exports[_0x561a('0x16')]=function(_0x3d91be){return request(_0x561a('0x17'),{'options':{'where':{'id':_0x3d91be},'attributes':[_0x561a('0x18')]}});};exports[_0x561a('0x19')]=function(_0x19870a){return request('ShowUser',{'options':{'where':{'id':_0x19870a},'attributes':[_0x561a('0x10')]}});};exports[_0x561a('0x1a')]=function(_0x533d95){return request(_0x561a('0x1b'),{'options':{'where':{'phone':_0x533d95[_0x561a('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x22c72a){return request('ShowTrunk',{'options':{'where':{'id':_0x22c72a},'attributes':['name']}});};exports[_0x561a('0x1d')]=function(_0xb023e6){return request('ShowSound',{'options':{'where':{'id':_0xb023e6},'attributes':[_0x561a('0x1e')]}});};exports[_0x561a('0x1f')]=function(_0x1367e2){return request(_0x561a('0x20'),{'options':{'raw':![],'where':{'id':_0x1367e2},'include':[{'model':_0x561a('0x21'),'as':_0x561a('0x22')}]}});};exports['getSmsAccountById']=function(_0x3e5509){return request(_0x561a('0x23'),{'options':{'where':{'id':_0x3e5509},'attributes':['id',_0x561a('0x10')]}});};exports['createSmsMessage']=function(_0x58c32f){return request(_0x561a('0x24'),{'body':_0x58c32f});};exports[_0x561a('0x25')]=function(_0x27afb3){return request(_0x561a('0x26'),{'body':_0x27afb3});};exports[_0x561a('0x27')]=function(_0x23ec64){return request(_0x561a('0x28'),{'body':_[_0x561a('0x29')](_0x23ec64,{'project_name':_0x23ec64['arg_1'],'prev_project_name':_0x23ec64['arg_2']||'','is_subproject':_0x23ec64[_0x561a('0x2a')]?!![]:![],'leaveAt':moment()[_0x561a('0x2b')](_0x561a('0x2c'))})});};exports[_0x561a('0x2d')]=function(_0x5a0acd){return request(_0x561a('0x2e'),{'body':_0x5a0acd});};exports[_0x561a('0x2f')]=function(_0x44c851){return request(_0x561a('0x30'),{'body':_0x44c851});};exports[_0x561a('0x31')]=function(_0x47f93a){return request(_0x561a('0x32'),{'options':{'raw':![],'where':{'phone':_0x47f93a[_0x561a('0x1c')],'ListId':_0x47f93a['ListId']}}})[_0x561a('0x33')](function(_0x276ae7){if(_0x276ae7){return _0x276ae7;}return request('CreateCmContact',{'body':_0x47f93a});});};exports[_0x561a('0x34')]=function(_0x591737){return request('ShowPause',{'options':{'where':{'id':_0x591737},'attributes':[_0x561a('0x10')]}});};exports[_0x561a('0x35')]=function(_0x4e0042,_0x10c24b){return request(_0x561a('0x36'),{'body':{'interface':_0x10c24b},'options':{'where':_0x4e0042}});};exports[_0x561a('0x37')]=function(_0x278c7e,_0x169243,_0xbb2ae8){return request(_0x561a('0x38'),{'body':{'type':_0x169243,'uniqueid':_0xbb2ae8},'options':{'where':_0x278c7e}});};exports[_0x561a('0x39')]=function(_0x506c2e){return request(_0x561a('0x3a'),{'body':{},'options':{'where':_0x506c2e}});};exports[_0x561a('0x3b')]=function(_0x2ab150){return request(_0x561a('0x3c'),{'body':{},'options':{'where':_0x2ab150}});};
\ No newline at end of file
+var _0x3613=['createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','LoginUser','agentUnpause','agentLogout','lodash','moment','jayson/promise','client','http','then','error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSquareDetailsReport'];(function(_0xd89fde,_0x4d2417){var _0xe67f58=function(_0x4b21f9){while(--_0x4b21f9){_0xd89fde['push'](_0xd89fde['shift']());}};_0xe67f58(++_0x4d2417);}(_0x3613,0x198));var _0x3361=function(_0x39e36a,_0xbfb0cf){_0x39e36a=_0x39e36a-0x0;var _0x18dcff=_0x3613[_0x39e36a];return _0x18dcff;};'use strict';var _=require(_0x3361('0x0'));var moment=require(_0x3361('0x1'));var jayson=require(_0x3361('0x2'));var client=jayson[_0x3361('0x3')][_0x3361('0x4')]({'port':0x2329});function request(_0x3ccef0,_0x259413){return new Promise(function(_0x56bafb,_0xe6f993){return client['request'](_0x3ccef0,_0x259413)[_0x3361('0x5')](function(_0x3221e2){if(_0x3221e2[_0x3361('0x6')]){return _0xe6f993(_0x3221e2[_0x3361('0x6')][_0x3361('0x7')]);}else{return _0x56bafb(_0x3221e2['result']);}})[_0x3361('0x8')](function(_0x501219){return _0xe6f993(_0x501219);});});}exports[_0x3361('0x9')]=function(){return request(_0x3361('0xa'),{'options':{'raw':![],'attributes':['id',_0x3361('0xb'),_0x3361('0xc')]}});};exports[_0x3361('0xd')]=function(_0x4955c0){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4955c0},'attributes':['production']}});};exports['getMailAccountById']=function(_0x574498){return request(_0x3361('0xe'),{'options':{'raw':![],'where':{'id':_0x574498},'include':[{'model':_0x3361('0xf'),'as':_0x3361('0x10'),'include':[{'model':_0x3361('0x11'),'as':_0x3361('0x11')}]}],'attributes':['id','name',_0x3361('0x12')],'smtp':!![]}});};exports[_0x3361('0x13')]=function(_0x208693){return request('ShowSquareProject',{'options':{'where':{'id':_0x208693},'attributes':[_0x3361('0xb')]}});};exports[_0x3361('0x14')]=function(_0x4669ee){return request(_0x3361('0x15'),{'options':{'where':{'id':_0x4669ee},'attributes':[_0x3361('0xb')]}});};exports[_0x3361('0x16')]=function(_0x53f08c){return request(_0x3361('0x17'),{'options':{'where':{'id':_0x53f08c},'attributes':[_0x3361('0xb')]}});};exports[_0x3361('0x18')]=function(_0x12e969){return request(_0x3361('0x19'),{'options':{'where':{'id':_0x12e969},'attributes':[_0x3361('0x1a')]}});};exports[_0x3361('0x1b')]=function(_0x2bd93f){return request(_0x3361('0x1c'),{'options':{'where':{'id':_0x2bd93f},'attributes':[_0x3361('0xb')]}});};exports[_0x3361('0x1d')]=function(_0x26ab60){return request(_0x3361('0x1e'),{'options':{'where':{'phone':_0x26ab60[_0x3361('0x1f')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x516262){return request(_0x3361('0x20'),{'options':{'where':{'id':_0x516262},'attributes':[_0x3361('0xb')]}});};exports[_0x3361('0x21')]=function(_0x414955){return request('ShowSound',{'options':{'where':{'id':_0x414955},'attributes':[_0x3361('0x22')]}});};exports['getIntervalById']=function(_0x1044f3){return request(_0x3361('0x23'),{'options':{'raw':![],'where':{'id':_0x1044f3},'include':[{'model':_0x3361('0x24'),'as':'Intervals'}]}});};exports[_0x3361('0x25')]=function(_0x455842){return request('ShowSmsAccount',{'options':{'where':{'id':_0x455842},'attributes':['id','name']}});};exports[_0x3361('0x26')]=function(_0x49ed84){return request('CreateSmsMessage',{'body':_0x49ed84});};exports['createSquareDetailsReport']=function(_0x223313){return request(_0x3361('0x27'),{'body':_0x223313});};exports[_0x3361('0x28')]=function(_0x3baf20){return request(_0x3361('0x29'),{'body':_[_0x3361('0x2a')](_0x3baf20,{'project_name':_0x3baf20[_0x3361('0x2b')],'prev_project_name':_0x3baf20[_0x3361('0x2c')]||'','is_subproject':_0x3baf20[_0x3361('0x2c')]?!![]:![],'leaveAt':moment()[_0x3361('0x2d')](_0x3361('0x2e'))})});};exports['createSquareRecording']=function(_0x5383b4){return request('CreateSquareRecording',{'body':_0x5383b4});};exports[_0x3361('0x2f')]=function(_0x2e11d3){return request(_0x3361('0x30'),{'body':_0x2e11d3});};exports[_0x3361('0x31')]=function(_0x3a3525){return request(_0x3361('0x32'),{'options':{'raw':![],'where':{'phone':_0x3a3525[_0x3361('0x1f')],'ListId':_0x3a3525[_0x3361('0x33')]}}})[_0x3361('0x5')](function(_0xe4b546){if(_0xe4b546){return _0xe4b546;}return request(_0x3361('0x34'),{'body':_0x3a3525});});};exports['getPauseById']=function(_0x51b82){return request('ShowPause',{'options':{'where':{'id':_0x51b82},'attributes':[_0x3361('0xb')]}});};exports['agentLogin']=function(_0x572450,_0x12c588){return request(_0x3361('0x35'),{'body':{'interface':_0x12c588},'options':{'where':_0x572450}});};exports['agentPause']=function(_0x40f9f6,_0x25a047,_0x36f34e){return request('PauseUser',{'body':{'type':_0x25a047,'uniqueid':_0x36f34e},'options':{'where':_0x40f9f6}});};exports[_0x3361('0x36')]=function(_0xa2e73f){return request('UnpauseUser',{'body':{},'options':{'where':_0xa2e73f}});};exports[_0x3361('0x37')]=function(_0x530a39){return request('LogoutUser',{'body':{},'options':{'where':_0x530a39}});};
\ No newline at end of file
index 3504292..82baee2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14f5=['./lex'];(function(_0x1861b2,_0x196a4f){var _0x1d6f21=function(_0x5f5c5d){while(--_0x5f5c5d){_0x1861b2['push'](_0x1861b2['shift']());}};_0x1d6f21(++_0x196a4f);}(_0x14f5,0xae));var _0x514f=function(_0xe7f99f,_0x49aeb4){_0xe7f99f=_0xe7f99f-0x0;var _0x5c9b54=_0x14f5[_0xe7f99f];return _0x5c9b54;};var polly=require('./polly');var lex=require(_0x514f('0x0'));module['exports']={'polly':polly,'lex':lex};
\ No newline at end of file
+var _0x1c23=['exports','./polly','./lex'];(function(_0x10783e,_0x11ac71){var _0x59c114=function(_0x2c689d){while(--_0x2c689d){_0x10783e['push'](_0x10783e['shift']());}};_0x59c114(++_0x11ac71);}(_0x1c23,0x1d5));var _0x31c2=function(_0x4c3008,_0x9cf103){_0x4c3008=_0x4c3008-0x0;var _0x1c21e5=_0x1c23[_0x4c3008];return _0x1c21e5;};var polly=require(_0x31c2('0x0'));var lex=require(_0x31c2('0x1'));module[_0x31c2('0x2')]={'polly':polly,'lex':lex};
\ No newline at end of file
index 7499bfe..1de88a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb58b=['exports'];(function(_0x9c1bdf,_0x1c8547){var _0x1ac49d=function(_0x4fc441){while(--_0x4fc441){_0x9c1bdf['push'](_0x9c1bdf['shift']());}};_0x1ac49d(++_0x1c8547);}(_0xb58b,0x1f1));var _0xbb58=function(_0xe44204,_0x3922a7){_0xe44204=_0xe44204-0x0;var _0x4c2e54=_0xb58b[_0xe44204];return _0x4c2e54;};'use strict';var lex=require('./lib/api');module[_0xbb58('0x0')]=function(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5){return lex(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5);};
\ No newline at end of file
+var _0x6324=['./lib/api','exports'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6324,0x142));var _0x4632=function(_0x13fe35,_0x537cee){_0x13fe35=_0x13fe35-0x0;var _0x4875a8=_0x6324[_0x13fe35];return _0x4875a8;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);};
\ No newline at end of file
index 2d93912..f971375 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xb6a1c5,_0x10ec94){var _0x2d789f=function(_0x4083e9){while(--_0x4083e9){_0xb6a1c5['push'](_0xb6a1c5['shift']());}};_0x2d789f(++_0x10ec94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);};
\ No newline at end of file
+var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x4ac6a8,_0xffc36e){var _0x298874=function(_0x27d30c){while(--_0x27d30c){_0x4ac6a8['push'](_0x4ac6a8['shift']());}};_0x298874(++_0xffc36e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);};
\ No newline at end of file
index d611441..7a6b6bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0084=['./lib/api','exports'];(function(_0x5caea9,_0x49509a){var _0x4a1e6b=function(_0x4a2670){while(--_0x4a2670){_0x5caea9['push'](_0x5caea9['shift']());}};_0x4a1e6b(++_0x49509a);}(_0x0084,0x196));var _0x4008=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0x0084[_0x456b77];return _0x118bb6;};'use strict';var polly=require(_0x4008('0x0'));module[_0x4008('0x1')]=function(_0x14ac87,_0x2434d0,_0x35eca9,_0x4bcd19,_0x42fe06,_0x3494fa,_0xb806b3){return polly(_0x14ac87,_0x2434d0,_0x35eca9,_0x4bcd19,_0x42fe06,_0x3494fa,_0xb806b3);};
\ No newline at end of file
+var _0x0969=['exports'];(function(_0x17d613,_0x335c58){var _0xae9fbb=function(_0x4aa394){while(--_0x4aa394){_0x17d613['push'](_0x17d613['shift']());}};_0xae9fbb(++_0x335c58);}(_0x0969,0xe4));var _0x9096=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x0969[_0x4fc9e6];return _0x551d28;};'use strict';var polly=require('./lib/api');module[_0x9096('0x0')]=function(_0x210b98,_0x5dfea8,_0x2bd8d7,_0x4c3171,_0x5a7e3e,_0x2c3f8d,_0x3b8c06){return polly(_0x210b98,_0x5dfea8,_0x2bd8d7,_0x4c3171,_0x5a7e3e,_0x2c3f8d,_0x3b8c06);};
\ No newline at end of file
index 676fc63..1277a52 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d71=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x1a5d40,_0x5b6197){var _0x3eb499=function(_0x3985ab){while(--_0x3985ab){_0x1a5d40['push'](_0x1a5d40['shift']());}};_0x3eb499(++_0x5b6197);}(_0x8d71,0x127));var _0x18d7=function(_0x17f664,_0x28be59){_0x17f664=_0x17f664-0x0;var _0x2b4a18=_0x8d71[_0x17f664];return _0x2b4a18;};'use strict';var fs=require('fs');var path=require(_0x18d7('0x0'));var BPromise=require(_0x18d7('0x1'));var rs=require(_0x18d7('0x2'));var AWS=require(_0x18d7('0x3'));function pollyResult(_0x4481a1,_0x23b94e,_0x2760b6){return new BPromise(function(_0x43f871,_0x8968c7){_0x4481a1[_0x18d7('0x4')](_0x23b94e,function(_0x398aec,_0x588335){if(_0x398aec){_0x8968c7(_0x398aec);}else if(_0x588335){if(_0x588335[_0x18d7('0x5')]instanceof Buffer){fs['writeFile'](_0x2760b6,_0x588335[_0x18d7('0x5')],function(_0x54b2c0){if(_0x54b2c0){_0x8968c7(_0x54b2c0);}else{_0x43f871();}});}else{_0x8968c7(new Error(_0x18d7('0x6')));}}else{_0x8968c7(new Error(_0x18d7('0x7')));}});});}module['exports']=function(_0x44c2a1,_0x410360,_0x209548,_0x34566b,_0x3ec826,_0x5b621e,_0x399252){var _0x46b9b7=new AWS[(_0x18d7('0x8'))]({'accessKeyId':_0x44c2a1,'secretAccessKey':_0x410360,'region':_0x209548});var _0x16e1b5={'Text':_0x3ec826,'TextType':_0x5b621e||'text','OutputFormat':_0x18d7('0x9'),'VoiceId':_0x34566b};return pollyResult(_0x46b9b7,_0x16e1b5,_0x399252);};
\ No newline at end of file
+var _0x28d0=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','randomstring','aws-sdk','AudioStream','writeFile'];(function(_0x23cf27,_0x53ee14){var _0x5cae52=function(_0x2454a0){while(--_0x2454a0){_0x23cf27['push'](_0x23cf27['shift']());}};_0x5cae52(++_0x53ee14);}(_0x28d0,0x1ea));var _0x028d=function(_0x5034b3,_0x20a25a){_0x5034b3=_0x5034b3-0x0;var _0x2aec85=_0x28d0[_0x5034b3];return _0x2aec85;};'use strict';var fs=require('fs');var path=require(_0x028d('0x0'));var BPromise=require('bluebird');var rs=require(_0x028d('0x1'));var AWS=require(_0x028d('0x2'));function pollyResult(_0x473d81,_0x18e77b,_0x2045d7){return new BPromise(function(_0x2daea9,_0x2b78f9){_0x473d81['synthesizeSpeech'](_0x18e77b,function(_0x5a0c3f,_0x3a140c){if(_0x5a0c3f){_0x2b78f9(_0x5a0c3f);}else if(_0x3a140c){if(_0x3a140c[_0x028d('0x3')]instanceof Buffer){fs[_0x028d('0x4')](_0x2045d7,_0x3a140c[_0x028d('0x3')],function(_0x24823b){if(_0x24823b){_0x2b78f9(_0x24823b);}else{_0x2daea9();}});}else{_0x2b78f9(new Error(_0x028d('0x5')));}}else{_0x2b78f9(new Error(_0x028d('0x6')));}});});}module['exports']=function(_0x458d42,_0x582cde,_0x4df61a,_0x12c77c,_0xbbfd27,_0x4b5954,_0xcc2bf4){var _0x29909a=new AWS[(_0x028d('0x7'))]({'accessKeyId':_0x458d42,'secretAccessKey':_0x582cde,'region':_0x4df61a});var _0x253cea={'Text':_0xbbfd27,'TextType':_0x4b5954||_0x028d('0x8'),'OutputFormat':'mp3','VoiceId':_0x12c77c};return pollyResult(_0x29909a,_0x253cea,_0xcc2bf4);};
\ No newline at end of file
index a4096c3..66297e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x222e=['./lib/api','exports'];(function(_0x57b8f,_0x46bd03){var _0x500dc9=function(_0x48e451){while(--_0x48e451){_0x57b8f['push'](_0x57b8f['shift']());}};_0x500dc9(++_0x46bd03);}(_0x222e,0x148));var _0xe222=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x222e[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xe222('0x0'));module[_0xe222('0x1')]=function(_0xd8e9e6,_0x11effc,_0x1c4386,_0x2034e0){return asr(_0xd8e9e6,_0x11effc,_0x1c4386);};
\ No newline at end of file
+var _0x9dd3=['./lib/api','exports'];(function(_0x9c3c46,_0xe82aac){var _0x239f30=function(_0x472082){while(--_0x472082){_0x9c3c46['push'](_0x9c3c46['shift']());}};_0x239f30(++_0xe82aac);}(_0x9dd3,0xe0));var _0x39dd=function(_0x134b99,_0x242666){_0x134b99=_0x134b99-0x0;var _0x524e1b=_0x9dd3[_0x134b99];return _0x524e1b;};'use strict';var asr=require(_0x39dd('0x0'));module[_0x39dd('0x1')]=function(_0x2f0448,_0x45e941,_0x46407e,_0x351a87){return asr(_0x2f0448,_0x45e941,_0x46407e);};
\ No newline at end of file
index 4c25680..0b09908 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x136c=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64'];(function(_0x5235a7,_0x3a065b){var _0x463bbf=function(_0x5934bc){while(--_0x5934bc){_0x5235a7['push'](_0x5235a7['shift']());}};_0x463bbf(++_0x3a065b);}(_0x136c,0x1d2));var _0xc136=function(_0xf77fc1,_0x1b5f46){_0xf77fc1=_0xf77fc1-0x0;var _0xf8faa7=_0x136c[_0xf77fc1];return _0xf8faa7;};'use strict';var url=require(_0xc136('0x0'));var BPromise=require(_0xc136('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xc136('0x2')]=function(_0x3b4cbd,_0x34c789,_0x15181c){return new BPromise(function(_0x1935fe,_0x9e2e9d){var _0x19565a;if(typeof _0x3b4cbd!==_0xc136('0x3')||_0x3b4cbd[_0xc136('0x4')]===0x0){return _0x9e2e9d('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x34c789!==_0xc136('0x3')||_0x34c789['length']===0x0){return _0x9e2e9d(_0xc136('0x5'));}if(typeof _0x15181c!==_0xc136('0x6')&&(typeof _0x15181c!==_0xc136('0x3')||_0x15181c['length']===0x0)){return _0x9e2e9d(_0xc136('0x7'));}try{_0x19565a=fs['readFileSync'](_0x3b4cbd)[_0xc136('0x8')](_0xc136('0x9'));}catch(_0x181f1d){return _0x9e2e9d(_0x181f1d);}return _0x1935fe({'method':_0xc136('0xa'),'uri':host+_0xc136('0xb')+_0x34c789,'body':{'config':{'encoding':_0xc136('0xc'),'sampleRateHertz':_0xc136('0xd'),'languageCode':_0x15181c},'audio':{'content':_0x19565a}},'json':!![]});});};
\ No newline at end of file
+var _0xb4e6=['length','filepath\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','https://speech.googleapis.com','exports','string'];(function(_0x24398c,_0x3dc9ec){var _0x113a9f=function(_0x149e29){while(--_0x149e29){_0x24398c['push'](_0x24398c['shift']());}};_0x113a9f(++_0x3dc9ec);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0xb4e6[_0x21205e];return _0x136ebb;};'use strict';var url=require(_0x6b4e('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x6b4e('0x1');module[_0x6b4e('0x2')]=function(_0x365912,_0x25ffcb,_0x44e781){return new BPromise(function(_0x31e8ad,_0x1929b8){var _0x52313b;if(typeof _0x365912!==_0x6b4e('0x3')||_0x365912[_0x6b4e('0x4')]===0x0){return _0x1929b8(_0x6b4e('0x5'));}if(typeof _0x25ffcb!=='string'||_0x25ffcb[_0x6b4e('0x4')]===0x0){return _0x1929b8('key\x20should\x20be\x20a\x20string');}if(typeof _0x44e781!=='undefined'&&(typeof _0x44e781!==_0x6b4e('0x3')||_0x44e781['length']===0x0)){return _0x1929b8('lang\x20should\x20be\x20a\x20string');}try{_0x52313b=fs[_0x6b4e('0x6')](_0x365912)[_0x6b4e('0x7')](_0x6b4e('0x8'));}catch(_0x39ed74){return _0x1929b8(_0x39ed74);}return _0x31e8ad({'method':_0x6b4e('0x9'),'uri':host+_0x6b4e('0xa')+_0x25ffcb,'body':{'config':{'encoding':_0x6b4e('0xb'),'sampleRateHertz':'8000','languageCode':_0x44e781},'audio':{'content':_0x52313b}},'json':!![]});});};
\ No newline at end of file
index 9c997f8..10cb4be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea08=['exports'];(function(_0x5f0f7c,_0x307917){var _0x8944ad=function(_0x4f908d){while(--_0x4f908d){_0x5f0f7c['push'](_0x5f0f7c['shift']());}};_0x8944ad(++_0x307917);}(_0xea08,0x11b));var _0x8ea0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xea08[_0x40a045];return _0x1a687c;};var asr=require('./asr');module[_0x8ea0('0x0')]={'asr':asr};
\ No newline at end of file
+var asr=require('./asr');module['exports']={'asr':asr};
\ No newline at end of file
index 1722f72..cf69b7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa231=['transcode','wav','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','resolve','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','goggleTTS\x20path','uri','results','map','transcript','join','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','result','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','intent','displayName','isFallback','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20confidence','polly','ispeechTTS','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','path','querystring','randomstring','sox','url','parse','util','./aws','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','request\x20to\x20','data'];(function(_0x1c6089,_0x3816e2){var _0x4d97c1=function(_0x3e631b){while(--_0x3e631b){_0x1c6089['push'](_0x1c6089['shift']());}};_0x4d97c1(++_0x3816e2);}(_0xa231,0x163));var _0x1a23=function(_0x4ad37c,_0x2e7490){_0x4ad37c=_0x4ad37c-0x0;var _0x288919=_0xa231[_0x4ad37c];return _0x288919;};'use strict';var apiai=require(_0x1a23('0x0'));var BPromise=require(_0x1a23('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0x1a23('0x2'));var querystring=require(_0x1a23('0x3'));var rp=require('request-promise');var rs=require(_0x1a23('0x4'));var sox=require(_0x1a23('0x5'));var tts=require('google-tts-api');var urlParse=require(_0x1a23('0x6'))[_0x1a23('0x7')];var util=require(_0x1a23('0x8'));var aws=require(_0x1a23('0x9'));var google=require('./google');var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x1a23('0xa'))(_0x1a23('0xb'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x125196,_0x579037){return new BPromise(function(_0x55e979,_0x6bc005){var _0x40a2d3=urlParse(_0x125196);var _0x4ba1b0=_0x40a2d3[_0x1a23('0xc')]===_0x1a23('0xd')?https:http;var _0x36c841={'host':_0x40a2d3[_0x1a23('0xe')],'path':_0x40a2d3[_0x1a23('0x2')],'headers':{'user-agent':_0x1a23('0xf')}};_0x4ba1b0[_0x1a23('0x10')](_0x36c841,function(_0x206b2d){if(_0x206b2d['statusCode']!==0xc8){logger['error']('request\x20to\x20'+_0x125196+_0x1a23('0x11')+_0x206b2d[_0x1a23('0x12')]+'\x20('+_0x206b2d[_0x1a23('0x13')]+')');_0x6bc005(new Error('request\x20to\x20'+_0x125196+'\x20failed,\x20status\x20code\x20=\x20'+_0x206b2d[_0x1a23('0x12')]+'\x20('+_0x206b2d[_0x1a23('0x13')]+')'));return;}var _0x44d03=fs[_0x1a23('0x14')](_0x579037);_0x44d03['on'](_0x1a23('0x15'),function(){logger[_0x1a23('0x16')](_0x1a23('0x17'));_0x44d03[_0x1a23('0x18')](_0x55e979);});_0x44d03['on'](_0x1a23('0x19'),function(_0x22b278){fs[_0x1a23('0x1a')](_0x579037);logger[_0x1a23('0x19')](_0x1a23('0x1b'),_0x22b278);_0x6bc005(_0x22b278);});_0x206b2d[_0x1a23('0x1c')](_0x44d03);})['on']('error',function(_0x2db41d){logger['error'](_0x2db41d);_0x6bc005(_0x2db41d);})[_0x1a23('0x1d')]();});}function uploadFile(_0x170c34){return new BPromise(function(_0x18bdcb,_0x2a0169){var _0x2a7c6c=urlParse(_0x170c34);var _0x311f1a=_0x2a7c6c['protocol']==='https:'?https:http;var _0x550966={'host':_0x2a7c6c[_0x1a23('0xe')],'path':_0x2a7c6c[_0x1a23('0x2')],'headers':{'user-agent':'WHAT_EVER'}};_0x311f1a['get'](_0x550966,function(_0x7d311){if(_0x7d311[_0x1a23('0x12')]!==0xc8){_0x2a0169(new Error(_0x1a23('0x1e')+_0x170c34+_0x1a23('0x11')+_0x7d311['statusCode']+'\x20('+_0x7d311[_0x1a23('0x13')]+')'));return;}var _0x2ae43e='';_0x7d311['on'](_0x1a23('0x1f'),function(_0x4152ef){_0x2ae43e+=_0x4152ef;});_0x7d311['on'](_0x1a23('0x1d'),function(){_0x18bdcb(_0x2ae43e);});})['on']('error',function(_0x4890b1){_0x2a0169(_0x4890b1);})[_0x1a23('0x1d')]();});}function convertFile(_0x21557f,_0x53205b){return new BPromise(function(_0x44bc31,_0x575524){var _0x20f8e6=sox[_0x1a23('0x20')](_0x21557f,_0x53205b,{'sampleRate':0x1f40,'format':_0x1a23('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x20f8e6['on']('error',function(_0x4190a9){logger[_0x1a23('0x19')](_0x1a23('0x22'),_0x4190a9);_0x575524(_0x4190a9);});_0x20f8e6['on'](_0x1a23('0x1d'),function(){logger['info']('finish\x20to\x20convert');_0x44bc31();});_0x20f8e6[_0x1a23('0x23')]();});}function base64Decode(_0x5b032a,_0xa5aa2b){var _0x3343a5=path['resolve'](__dirname,_0x1a23('0x24'),rs[_0x1a23('0x25')](0x4)+_0x1a23('0x26'));fs[_0x1a23('0x27')](_0x3343a5,_0x5b032a,_0x1a23('0x28'));return convertFile(_0x3343a5,_0xa5aa2b)[_0x1a23('0x29')](function(){try{fs[_0x1a23('0x1a')](_0x3343a5);fs[_0x1a23('0x2a')](_0xa5aa2b,_0x1a23('0x2b'));}catch(_0x283069){logger[_0x1a23('0x19')](_0x283069);}return _0xa5aa2b[_0x1a23('0x2c')]('.')[0x0];});}function base64Encode(_0x497a3a){var _0x29025e=fs[_0x1a23('0x2d')](_0x497a3a);return new Buffer(_0x29025e)['toString'](_0x1a23('0x28'));}exports[_0x1a23('0x2e')]=function(_0x1dea71,_0x22226c,_0x22131c,_0x1cf4b7,_0x812269,_0x44596c){var _0x1813c4,_0x4e71de;var _0x2af878=_0x1a23('0x2f');var _0x22a951=_0x1a23('0x30')+_0x1dea71;var _0x18fea7={};if(_0x22226c===_0x1a23('0x31')){_0x18fea7[_0x1a23('0x32')]={'ssml':_0x22131c};}else{_0x18fea7[_0x1a23('0x32')]={'text':_0x22131c};};_0x18fea7[_0x1a23('0x33')]={'languageCode':_0x1cf4b7,'ssmlGender':_0x812269};_0x18fea7[_0x1a23('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1491ba={'url':_0x2af878+_0x1a23('0x35')+_0x22a951,'method':_0x1a23('0x36'),'json':!![],'body':_0x18fea7};return rp(_0x1491ba)['then'](function(_0x1fd0f0){return new BPromise(function(_0x54b41f,_0x5596d7){_0x1813c4=path[_0x1a23('0x37')](__dirname,_0x1a23('0x24'),rs[_0x1a23('0x25')](0x4)+'.mp3');var _0x1e7466=Buffer[_0x1a23('0x38')](_0x1fd0f0[_0x1a23('0x39')],'base64');return fs[_0x1a23('0x3a')](_0x1813c4,_0x1e7466,function(_0x398ae6){_0x5596d7(_0x398ae6);},function(_0x46ac6e){fs[_0x1a23('0x2a')](_0x1813c4,'777');_0x54b41f(_0x46ac6e);});});})['then'](function(_0x53e3a5){_0x4e71de=path[_0x1a23('0x37')](__dirname,_0x1a23('0x24'),rs[_0x1a23('0x25')](0x4)+_0x1a23('0x26'));return convertFile(_0x1813c4,_0x4e71de);})[_0x1a23('0x29')](function(){try{fs[_0x1a23('0x1a')](_0x1813c4);fs['chmodSync'](_0x4e71de,'777');}catch(_0x490064){logger['error'](_0x490064);}logger['info'](_0x1a23('0x3b'),_0x4e71de[_0x1a23('0x2c')]('.')[0x0]);return _0x4e71de['split']('.')[0x0];});};exports[_0x1a23('0x3c')]=function(_0x42c581,_0x454a53){var _0x41242f='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x13798a,_0xaade53;var _0x11dfdb;var _0x3bb405={'encoding':_0x1a23('0x3d'),'method':_0x1a23('0x36'),'timeout':0x2710,'url':_0x41242f,'headers':{'Content-Type':_0x1a23('0x3e')},'body':_0x1a23('0x3f')+encodeURIComponent(JSON[_0x1a23('0x40')]([[[_0x1a23('0x41'),JSON[_0x1a23('0x40')]([_0x42c581,_0x454a53||'en',![],'null']),null,_0x1a23('0x42')]]]))};return rp(_0x3bb405)[_0x1a23('0x29')](function(_0x6dac16){try{_0x11dfdb=eval(_0x6dac16[_0x1a23('0x43')](0x5))[0x0][0x2];}catch(_0x4eba3f){throw new Error(_0x1a23('0x44')+_0x6dac16[_0x1a23('0x1f')]);}if(!_0x11dfdb){if(_0x42c581[_0x1a23('0x45')]>0xc8){throw new Error(_0x1a23('0x46'));}else{throw new Error(_0x1a23('0x47')+_0x454a53+'\x22\x20might\x20not\x20exist');}}try{_0x11dfdb=eval(_0x11dfdb)[0x0];}catch(_0x400fa4){throw new Error(_0x1a23('0x44')+res[_0x1a23('0x1f')]);}const _0x28bcfc=_0x11dfdb;_0x13798a=path['resolve'](__dirname,_0x1a23('0x24'),rs['generate'](0x4)+_0x1a23('0x48'));fs['writeFileSync'](_0x13798a,_0x11dfdb,{'encoding':_0x1a23('0x28')});_0xaade53=path[_0x1a23('0x37')](__dirname,'tmp',rs[_0x1a23('0x25')](0x4)+_0x1a23('0x26'));return convertFile(_0x13798a,_0xaade53);})[_0x1a23('0x29')](function(){try{fs[_0x1a23('0x1a')](_0x13798a);fs[_0x1a23('0x2a')](_0xaade53,_0x1a23('0x2b'));}catch(_0x4e8612){logger['error'](_0x4e8612);}logger[_0x1a23('0x16')](_0x1a23('0x49'),_0xaade53[_0x1a23('0x2c')]('.')[0x0]);return _0xaade53[_0x1a23('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x486161,_0x3c193d,_0x3a1b27){return google['asr'](_0x486161,_0x3c193d,_0x3a1b27)[_0x1a23('0x29')](function(_0x57b018){logger[_0x1a23('0x16')](_0x57b018[_0x1a23('0x4a')]);return rp(_0x57b018);})[_0x1a23('0x29')](function(_0x4d5a70){var _0xe6d248='';var _0x72ad9e=0x0;try{fs[_0x1a23('0x1a')](_0x486161);}catch(_0x4f7bc3){logger['error'](_0x4f7bc3);}if(_0x4d5a70&&_0x4d5a70[_0x1a23('0x4b')]){_0xe6d248=_0x4d5a70[_0x1a23('0x4b')][_0x1a23('0x4c')](function(_0x3e1cda){return _0x3e1cda&&_0x3e1cda['alternatives'][0x0]&&_0x3e1cda['alternatives'][0x0][_0x1a23('0x4d')]?_0x3e1cda['alternatives'][0x0][_0x1a23('0x4d')]:'';})[_0x1a23('0x4e')]('\x0a');_0x72ad9e=_0x4d5a70[_0x1a23('0x4b')][_0x1a23('0x4c')](function(_0xffed69){return _0xffed69&&_0xffed69[_0x1a23('0x4f')][0x0]&&_0xffed69['alternatives'][0x0][_0x1a23('0x50')]?_0xffed69[_0x1a23('0x4f')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x1a23('0x16')](_0x1a23('0x51'),_0xe6d248);logger[_0x1a23('0x16')](_0x1a23('0x52'),_0x72ad9e);return{'transcript':_0xe6d248,'confidence':_0x72ad9e};})[_0x1a23('0x53')](function(_0x544c06){logger[_0x1a23('0x19')](_0x1a23('0x54'),_0x544c06[_0x1a23('0x12')],_0x544c06[_0x1a23('0x55')],_0x544c06['message']);});};exports[_0x1a23('0x56')]=function(_0x59f816,_0x5d7f9f,_0x5d53ea,_0xd18341){var _0x55eb39=apiai(_0x5d7f9f,{'language':_0xd18341||'en'});return _0x55eb39['textRequest'](_0x5d53ea,{'sessionId':md5(_0x59f816)})[_0x1a23('0x29')](function(_0x6ce831){logger[_0x1a23('0x16')](JSON['stringify'](_0x6ce831));return{'source':_0x6ce831['result']['source'],'resolvedQuery':_0x6ce831[_0x1a23('0x57')][_0x1a23('0x58')],'action':_0x6ce831['result'][_0x1a23('0x59')],'actionIncomplete':_0x6ce831[_0x1a23('0x57')][_0x1a23('0x5a')],'speech':_0x6ce831[_0x1a23('0x57')][_0x1a23('0x5b')]['speech'],'score':_0x6ce831[_0x1a23('0x57')][_0x1a23('0x5c')],'statusCode':_0x6ce831[_0x1a23('0x5d')][_0x1a23('0x5e')],'endConversation':_0x6ce831[_0x1a23('0x57')]['metadata'][_0x1a23('0x5f')]||![],'isFallbackIntent':_0x6ce831[_0x1a23('0x57')][_0x1a23('0x60')][_0x1a23('0x61')]};});};exports['googleDialogflowV2']=function(_0x580975,_0xb23b87,_0x8ac5ef,_0x22ff68,_0x31bd8c,_0x2bd6bc){var _0xc11e1c=_0x22ff68[_0x1a23('0x62')](/\\n/g,'\x0a');var _0x30103e={'credentials':{'private_key':_0xc11e1c,'client_email':_0x8ac5ef}};var _0x59013c=new dialogflow[(_0x1a23('0x63'))](_0x30103e);var _0x9965bd=_0x59013c[_0x1a23('0x64')](_0xb23b87,md5(_0x580975));var _0x322ed7={'session':_0x9965bd,'queryInput':{'text':{'text':_0x31bd8c,'languageCode':_0x2bd6bc}}};return _0x59013c[_0x1a23('0x65')](_0x322ed7)[_0x1a23('0x29')](function(_0x42888d){if(_0x42888d&&_0x42888d[_0x1a23('0x45')]){logger[_0x1a23('0x16')](_0x1a23('0x66'),JSON[_0x1a23('0x40')](_0x42888d));var _0x12c71c=_0x42888d[0x0];if(_0x12c71c){var _0x33e7fd={'action':_0x12c71c[_0x1a23('0x67')][_0x1a23('0x59')],'allRequiredParamsPresent':_0x12c71c[_0x1a23('0x67')]['allRequiredParamsPresent'],'endConversation':_0x12c71c['queryResult'][_0x1a23('0x68')]&&_0x12c71c[_0x1a23('0x67')][_0x1a23('0x68')][_0x1a23('0x69')]?_0x12c71c['queryResult'][_0x1a23('0x68')]['fields']['end_conversation'][_0x1a23('0x6a')]:![],'fulfillmentText':_0x12c71c['queryResult']['fulfillmentText'],'intentName':_0x12c71c[_0x1a23('0x67')][_0x1a23('0x6b')]['name'],'intentDisplayName':_0x12c71c[_0x1a23('0x67')][_0x1a23('0x6b')][_0x1a23('0x6c')],'isFallbackIntent':_0x12c71c[_0x1a23('0x67')][_0x1a23('0x6b')][_0x1a23('0x6d')],'languageCode':_0x12c71c['queryResult']['languageCode'],'queryText':_0x12c71c['queryResult'][_0x1a23('0x6e')],'responseId':_0x12c71c['responseId'],'score':_0x12c71c[_0x1a23('0x67')][_0x1a23('0x6f')],'speech':_0x12c71c[_0x1a23('0x67')][_0x1a23('0x70')],'providerResponse':JSON[_0x1a23('0x40')](_0x42888d)};return _0x33e7fd;}}});};exports[_0x1a23('0x71')]=function(_0x4cc5f9,_0x595853,_0x2cd558,_0x1a495b){return tilde[_0x1a23('0x72')](_0x4cc5f9,_0x595853,_0x2cd558,_0x1a495b)['then'](function(_0xb635dc){try{fs[_0x1a23('0x1a')](_0x4cc5f9);}catch(_0x1b311e){logger[_0x1a23('0x19')](_0x1b311e);}logger[_0x1a23('0x16')]('Tilde\x20ASR\x20transcription',_0xb635dc[_0x1a23('0x4d')]);logger[_0x1a23('0x16')](_0x1a23('0x73'),_0xb635dc[_0x1a23('0x50')]);return _0xb635dc;});};exports['awsPolly']=function(_0x11ab6d,_0x5765bd,_0x16a055,_0xbaeab4,_0x2c7508,_0x5eb141){var _0x3ecfa6=path['resolve'](__dirname,_0x1a23('0x24'),rs['generate'](0x4)+'.mp3');var _0x960e0a;return aws[_0x1a23('0x74')](_0x11ab6d,_0x5765bd,_0x16a055,_0xbaeab4,_0x2c7508,_0x5eb141,_0x3ecfa6)[_0x1a23('0x29')](function(){_0x960e0a=path[_0x1a23('0x37')](__dirname,_0x1a23('0x24'),rs[_0x1a23('0x25')](0x4)+_0x1a23('0x26'));return convertFile(_0x3ecfa6,_0x960e0a);})[_0x1a23('0x29')](function(){try{fs[_0x1a23('0x1a')](_0x3ecfa6);fs[_0x1a23('0x2a')](_0x960e0a,'777');}catch(_0x5ddd01){logger[_0x1a23('0x19')](_0x5ddd01);}return _0x960e0a['split']('.')[0x0];});};exports['awsLex']=function(_0x251e6d,_0xa850fa,_0x533fb0,_0x1b6583,_0x4740e2,_0xf83207){return aws['lex'](_0x251e6d,_0xa850fa,_0x533fb0,_0x1b6583,_0x4740e2,_0xf83207)[_0x1a23('0x29')](function(_0x1af7ee){logger[_0x1a23('0x16')](JSON[_0x1a23('0x40')](_0x1af7ee));return _0x1af7ee;});};exports[_0x1a23('0x75')]=function(_0x1117e9,_0x551392,_0x53beb4,_0xd26903){var _0x668d51=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1117e9,encodeURIComponent(_0x551392),_0x53beb4,_0xd26903);var _0x1356a1=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1a23('0x48'));var _0x140089;return downloadFile(_0x668d51,_0x1356a1)['then'](function(){_0x140089=path['resolve'](__dirname,_0x1a23('0x24'),rs['generate'](0x4)+_0x1a23('0x26'));return convertFile(_0x1356a1,_0x140089);})[_0x1a23('0x29')](function(){try{fs['unlink'](_0x1356a1);fs[_0x1a23('0x2a')](_0x140089,_0x1a23('0x2b'));}catch(_0x5c8beb){logger[_0x1a23('0x19')](_0x5c8beb);}return _0x140089[_0x1a23('0x2c')]('.')[0x0];});};exports[_0x1a23('0x76')]=function(_0x185b76,_0x3bd439,_0x2a43f7,_0x469b46){var _0x4568d6=util[_0x1a23('0x77')](_0x1a23('0x78'),ISPEECH_API,_0x3bd439,_0x2a43f7,base64Encode(_0x185b76),_0x469b46?util[_0x1a23('0x77')](_0x1a23('0x79'),encodeURIComponent(_0x469b46)):'freeform=3');return uploadFile(_0x4568d6)[_0x1a23('0x29')](function(_0x25f1d7){return querystring[_0x1a23('0x7')](_0x25f1d7);});};exports[_0x1a23('0x7a')]=function(_0x11065b,_0x109ef5){return sestek[_0x1a23('0x7b')](_0x11065b,_0x109ef5)[_0x1a23('0x29')](function(_0xe16e63){logger[_0x1a23('0x16')](JSON['stringify'](_0xe16e63));var _0x367fc3={'speech':_0xe16e63['text'],'action':_0xe16e63['channelData']?_0xe16e63[_0x1a23('0x7c')]['CustomAction']:undefined,'actiondata':_0xe16e63[_0x1a23('0x7c')]?_0xe16e63[_0x1a23('0x7c')][_0x1a23('0x7d')]:undefined};if(_0xe16e63[_0x1a23('0x7c')]&&_0xe16e63['channelData'][_0x1a23('0x7e')]){return base64Decode(_0xe16e63[_0x1a23('0x7c')]['AudioFromTts']['Data'],path[_0x1a23('0x37')](__dirname,_0x1a23('0x24'),rs[_0x1a23('0x25')](0x4)+_0x1a23('0x26')))[_0x1a23('0x29')](function(_0x5f2f3f){_0x367fc3[_0x1a23('0x7f')]=_0x5f2f3f;return _0x367fc3;});}return _0x367fc3;});};exports[_0x1a23('0x80')]=function(){return __dirname;};
\ No newline at end of file
+var _0xf764=['AudioFromTts','Data','dirName','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','get','data','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','input','voice','audioConfig','text:synthesize','POST','generate','writeFile','tmp','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','CustomAction','channelData','CustomActionData'];(function(_0x5c90ee,_0x5d77d7){var _0x249ffb=function(_0xa5dea2){while(--_0xa5dea2){_0x5c90ee['push'](_0x5c90ee['shift']());}};_0x249ffb(++_0x5d77d7);}(_0xf764,0x10d));var _0x4f76=function(_0x81425d,_0x404e62){_0x81425d=_0x81425d-0x0;var _0x404dc1=_0xf764[_0x81425d];return _0x404dc1;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x4f76('0x0'));var dialogflow=require(_0x4f76('0x1'));var fs=require('fs');var http=require(_0x4f76('0x2'));var https=require('https');var md5=require(_0x4f76('0x3'));var path=require(_0x4f76('0x4'));var querystring=require(_0x4f76('0x5'));var rp=require(_0x4f76('0x6'));var rs=require(_0x4f76('0x7'));var sox=require('sox');var tts=require(_0x4f76('0x8'));var urlParse=require(_0x4f76('0x9'))[_0x4f76('0xa')];var util=require(_0x4f76('0xb'));var aws=require(_0x4f76('0xc'));var google=require('./google');var sestek=require(_0x4f76('0xd'));var tilde=require(_0x4f76('0xe'));var logger=require(_0x4f76('0xf'))(_0x4f76('0x10'));var ISPEECH_API=_0x4f76('0x11');function downloadFile(_0x29f6f8,_0x10df6d){return new BPromise(function(_0x4d54b1,_0x25c4d5){var _0x241936=urlParse(_0x29f6f8);var _0x29cd6f=_0x241936[_0x4f76('0x12')]===_0x4f76('0x13')?https:http;var _0xe97b90={'host':_0x241936[_0x4f76('0x14')],'path':_0x241936[_0x4f76('0x4')],'headers':{'user-agent':_0x4f76('0x15')}};_0x29cd6f['get'](_0xe97b90,function(_0x46a8bf){if(_0x46a8bf[_0x4f76('0x16')]!==0xc8){logger[_0x4f76('0x17')](_0x4f76('0x18')+_0x29f6f8+_0x4f76('0x19')+_0x46a8bf[_0x4f76('0x16')]+'\x20('+_0x46a8bf[_0x4f76('0x1a')]+')');_0x25c4d5(new Error(_0x4f76('0x18')+_0x29f6f8+_0x4f76('0x19')+_0x46a8bf[_0x4f76('0x16')]+'\x20('+_0x46a8bf[_0x4f76('0x1a')]+')'));return;}var _0x11b4ce=fs['createWriteStream'](_0x10df6d);_0x11b4ce['on'](_0x4f76('0x1b'),function(){logger[_0x4f76('0x1c')](_0x4f76('0x1d'));_0x11b4ce[_0x4f76('0x1e')](_0x4d54b1);});_0x11b4ce['on'](_0x4f76('0x17'),function(_0x576249){fs[_0x4f76('0x1f')](_0x10df6d);logger[_0x4f76('0x17')](_0x4f76('0x20'),_0x576249);_0x25c4d5(_0x576249);});_0x46a8bf[_0x4f76('0x21')](_0x11b4ce);})['on'](_0x4f76('0x17'),function(_0x20bae5){logger['error'](_0x20bae5);_0x25c4d5(_0x20bae5);})[_0x4f76('0x22')]();});}function uploadFile(_0x4d2d2a){return new BPromise(function(_0x418812,_0x35c30c){var _0x392142=urlParse(_0x4d2d2a);var _0x28abe1=_0x392142[_0x4f76('0x12')]===_0x4f76('0x13')?https:http;var _0x1a6879={'host':_0x392142[_0x4f76('0x14')],'path':_0x392142[_0x4f76('0x4')],'headers':{'user-agent':_0x4f76('0x15')}};_0x28abe1[_0x4f76('0x23')](_0x1a6879,function(_0x3287d3){if(_0x3287d3[_0x4f76('0x16')]!==0xc8){_0x35c30c(new Error('request\x20to\x20'+_0x4d2d2a+_0x4f76('0x19')+_0x3287d3['statusCode']+'\x20('+_0x3287d3[_0x4f76('0x1a')]+')'));return;}var _0x4aac3a='';_0x3287d3['on'](_0x4f76('0x24'),function(_0x14b5e8){_0x4aac3a+=_0x14b5e8;});_0x3287d3['on'](_0x4f76('0x22'),function(){_0x418812(_0x4aac3a);});})['on'](_0x4f76('0x17'),function(_0x13229d){_0x35c30c(_0x13229d);})[_0x4f76('0x22')]();});}function convertFile(_0x4ef10c,_0x376c41){return new BPromise(function(_0x30dda2,_0x4c38e7){var _0x598ce5=sox['transcode'](_0x4ef10c,_0x376c41,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x598ce5['on'](_0x4f76('0x17'),function(_0x444e30){logger[_0x4f76('0x17')](_0x4f76('0x25'),_0x444e30);_0x4c38e7(_0x444e30);});_0x598ce5['on']('end',function(){logger[_0x4f76('0x1c')](_0x4f76('0x26'));_0x30dda2();});_0x598ce5[_0x4f76('0x27')]();});}function base64Decode(_0x45b0f4,_0xfa0b2d){var _0x15bd3a=path[_0x4f76('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x4f76('0x29'));fs[_0x4f76('0x2a')](_0x15bd3a,_0x45b0f4,_0x4f76('0x2b'));return convertFile(_0x15bd3a,_0xfa0b2d)[_0x4f76('0x2c')](function(){try{fs[_0x4f76('0x1f')](_0x15bd3a);fs[_0x4f76('0x2d')](_0xfa0b2d,_0x4f76('0x2e'));}catch(_0x3fba19){logger[_0x4f76('0x17')](_0x3fba19);}return _0xfa0b2d[_0x4f76('0x2f')]('.')[0x0];});}function base64Encode(_0xada0eb){var _0x1bd211=fs[_0x4f76('0x30')](_0xada0eb);return new Buffer(_0x1bd211)[_0x4f76('0x31')]('base64');}exports[_0x4f76('0x32')]=function(_0x49c64e,_0x1505eb,_0x500221,_0x20f69b,_0x5b00ab,_0x16197a){var _0x559ea2,_0x533ded;var _0x2f78ea='https://texttospeech.googleapis.com/v1/';var _0x45e0f3=_0x4f76('0x33')+_0x49c64e;var _0x40678b={};if(_0x1505eb==='ssml'){_0x40678b['input']={'ssml':_0x500221};}else{_0x40678b[_0x4f76('0x34')]={'text':_0x500221};};_0x40678b[_0x4f76('0x35')]={'languageCode':_0x20f69b,'ssmlGender':_0x5b00ab};_0x40678b[_0x4f76('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x214a74={'url':_0x2f78ea+_0x4f76('0x37')+_0x45e0f3,'method':_0x4f76('0x38'),'json':!![],'body':_0x40678b};return rp(_0x214a74)[_0x4f76('0x2c')](function(_0x339523){return new BPromise(function(_0x4e7abe,_0x28b110){_0x559ea2=path['resolve'](__dirname,'tmp',rs[_0x4f76('0x39')](0x4)+'.mp3');var _0x34592d=Buffer['from'](_0x339523['audioContent'],'base64');return fs[_0x4f76('0x3a')](_0x559ea2,_0x34592d,function(_0x4c5d96){_0x28b110(_0x4c5d96);},function(_0x523368){fs[_0x4f76('0x2d')](_0x559ea2,'777');_0x4e7abe(_0x523368);});});})[_0x4f76('0x2c')](function(_0x2f2c18){_0x533ded=path['resolve'](__dirname,_0x4f76('0x3b'),rs[_0x4f76('0x39')](0x4)+_0x4f76('0x29'));return convertFile(_0x559ea2,_0x533ded);})[_0x4f76('0x2c')](function(){try{fs[_0x4f76('0x1f')](_0x559ea2);fs[_0x4f76('0x2d')](_0x533ded,'777');}catch(_0x899988){logger[_0x4f76('0x17')](_0x899988);}logger[_0x4f76('0x1c')]('googleCloudTTS\x20path',_0x533ded[_0x4f76('0x2f')]('.')[0x0]);return _0x533ded[_0x4f76('0x2f')]('.')[0x0];});};exports[_0x4f76('0x3c')]=function(_0x41a733,_0x4ce9c8){var _0x5a58c9=_0x4f76('0x3d');var _0x597933,_0x3d0a3a;var _0x3b9a2;var _0xbada56={'encoding':_0x4f76('0x3e'),'method':'POST','timeout':0x2710,'url':_0x5a58c9,'headers':{'Content-Type':_0x4f76('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0x4f76('0x40')]([[['jQ1olc',JSON['stringify']([_0x41a733,_0x4ce9c8||'en',![],_0x4f76('0x41')]),null,'generic']]]))};return rp(_0xbada56)['then'](function(_0x13fc82){try{_0x3b9a2=eval(_0x13fc82['slice'](0x5))[0x0][0x2];}catch(_0x45dce3){throw new Error(_0x4f76('0x42')+_0x13fc82[_0x4f76('0x24')]);}if(!_0x3b9a2){if(_0x41a733['length']>0xc8){throw new Error(_0x4f76('0x43'));}else{throw new Error(_0x4f76('0x44')+_0x4ce9c8+'\x22\x20might\x20not\x20exist');}}try{_0x3b9a2=eval(_0x3b9a2)[0x0];}catch(_0x20ca24){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4f76('0x24')]);}const _0x1bae8=_0x3b9a2;_0x597933=path[_0x4f76('0x28')](__dirname,'tmp',rs[_0x4f76('0x39')](0x4)+_0x4f76('0x45'));fs[_0x4f76('0x2a')](_0x597933,_0x3b9a2,{'encoding':'base64'});_0x3d0a3a=path[_0x4f76('0x28')](__dirname,_0x4f76('0x3b'),rs[_0x4f76('0x39')](0x4)+'.wav');return convertFile(_0x597933,_0x3d0a3a);})['then'](function(){try{fs['unlink'](_0x597933);fs[_0x4f76('0x2d')](_0x3d0a3a,_0x4f76('0x2e'));}catch(_0x152ae7){logger['error'](_0x152ae7);}logger[_0x4f76('0x1c')](_0x4f76('0x46'),_0x3d0a3a[_0x4f76('0x2f')]('.')[0x0]);return _0x3d0a3a[_0x4f76('0x2f')]('.')[0x0];});};exports[_0x4f76('0x47')]=function(_0x47dca7,_0x405efb,_0x34f76c){return google[_0x4f76('0x48')](_0x47dca7,_0x405efb,_0x34f76c)[_0x4f76('0x2c')](function(_0x280cb0){logger[_0x4f76('0x1c')](_0x280cb0[_0x4f76('0x49')]);return rp(_0x280cb0);})[_0x4f76('0x2c')](function(_0xafe53c){var _0x4ca234='';var _0x18afd3=0x0;try{fs['unlink'](_0x47dca7);}catch(_0x4ee652){logger[_0x4f76('0x17')](_0x4ee652);}if(_0xafe53c&&_0xafe53c[_0x4f76('0x4a')]){_0x4ca234=_0xafe53c[_0x4f76('0x4a')][_0x4f76('0x4b')](function(_0x5593f6){return _0x5593f6&&_0x5593f6[_0x4f76('0x4c')][0x0]&&_0x5593f6[_0x4f76('0x4c')][0x0]['transcript']?_0x5593f6[_0x4f76('0x4c')][0x0][_0x4f76('0x4d')]:'';})[_0x4f76('0x4e')]('\x0a');_0x18afd3=_0xafe53c[_0x4f76('0x4a')][_0x4f76('0x4b')](function(_0x4d47a3){return _0x4d47a3&&_0x4d47a3['alternatives'][0x0]&&_0x4d47a3[_0x4f76('0x4c')][0x0][_0x4f76('0x4f')]?_0x4d47a3[_0x4f76('0x4c')][0x0][_0x4f76('0x4f')]:0x0;})['join']('\x0a');}logger[_0x4f76('0x1c')](_0x4f76('0x50'),_0x4ca234);logger[_0x4f76('0x1c')](_0x4f76('0x51'),_0x18afd3);return{'transcript':_0x4ca234,'confidence':_0x18afd3};})[_0x4f76('0x52')](function(_0x33c32d){logger[_0x4f76('0x17')]('[%s]\x20%s:%s',_0x33c32d[_0x4f76('0x16')],_0x33c32d[_0x4f76('0x53')],_0x33c32d[_0x4f76('0x54')]);});};exports['googleDialogflow']=function(_0x9cbbee,_0x436a8b,_0x2e25bf,_0x956b93){var _0x2690f8=apiai(_0x436a8b,{'language':_0x956b93||'en'});return _0x2690f8['textRequest'](_0x2e25bf,{'sessionId':md5(_0x9cbbee)})['then'](function(_0x10a916){logger[_0x4f76('0x1c')](JSON[_0x4f76('0x40')](_0x10a916));return{'source':_0x10a916[_0x4f76('0x55')][_0x4f76('0x56')],'resolvedQuery':_0x10a916[_0x4f76('0x55')][_0x4f76('0x57')],'action':_0x10a916[_0x4f76('0x55')][_0x4f76('0x58')],'actionIncomplete':_0x10a916[_0x4f76('0x55')][_0x4f76('0x59')],'speech':_0x10a916['result'][_0x4f76('0x5a')][_0x4f76('0x5b')],'score':_0x10a916['result'][_0x4f76('0x5c')],'statusCode':_0x10a916[_0x4f76('0x5d')][_0x4f76('0x5e')],'endConversation':_0x10a916[_0x4f76('0x55')][_0x4f76('0x5f')][_0x4f76('0x60')]||![],'isFallbackIntent':_0x10a916[_0x4f76('0x55')]['metadata'][_0x4f76('0x61')]};});};exports[_0x4f76('0x62')]=function(_0x35040b,_0x52cf3d,_0x49bf8e,_0x2e8d7a,_0x15eb89,_0x112ad8){var _0x5871c6=_0x2e8d7a[_0x4f76('0x63')](/\\n/g,'\x0a');var _0x129e06={'credentials':{'private_key':_0x5871c6,'client_email':_0x49bf8e}};var _0x27390f=new dialogflow[(_0x4f76('0x64'))](_0x129e06);var _0x463fb0=_0x27390f[_0x4f76('0x65')](_0x52cf3d,md5(_0x35040b));var _0x4f17ac={'session':_0x463fb0,'queryInput':{'text':{'text':_0x15eb89,'languageCode':_0x112ad8}}};return _0x27390f[_0x4f76('0x66')](_0x4f17ac)[_0x4f76('0x2c')](function(_0x49d07f){if(_0x49d07f&&_0x49d07f['length']){logger[_0x4f76('0x1c')](_0x4f76('0x67'),JSON[_0x4f76('0x40')](_0x49d07f));var _0x30017a=_0x49d07f[0x0];if(_0x30017a){var _0x35c54b={'action':_0x30017a[_0x4f76('0x68')][_0x4f76('0x58')],'allRequiredParamsPresent':_0x30017a[_0x4f76('0x68')]['allRequiredParamsPresent'],'endConversation':_0x30017a[_0x4f76('0x68')][_0x4f76('0x69')]&&_0x30017a[_0x4f76('0x68')][_0x4f76('0x69')][_0x4f76('0x6a')]?_0x30017a['queryResult'][_0x4f76('0x69')][_0x4f76('0x6a')][_0x4f76('0x6b')][_0x4f76('0x6c')]:![],'fulfillmentText':_0x30017a[_0x4f76('0x68')][_0x4f76('0x6d')],'intentName':_0x30017a[_0x4f76('0x68')][_0x4f76('0x6e')][_0x4f76('0x53')],'intentDisplayName':_0x30017a['queryResult'][_0x4f76('0x6e')][_0x4f76('0x6f')],'isFallbackIntent':_0x30017a['queryResult'][_0x4f76('0x6e')][_0x4f76('0x70')],'languageCode':_0x30017a[_0x4f76('0x68')][_0x4f76('0x71')],'queryText':_0x30017a[_0x4f76('0x68')][_0x4f76('0x72')],'responseId':_0x30017a[_0x4f76('0x73')],'score':_0x30017a['queryResult']['intentDetectionConfidence'],'speech':_0x30017a['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x4f76('0x40')](_0x49d07f)};return _0x35c54b;}}});};exports['tildeASR']=function(_0x13f29e,_0x2db3fb,_0x4ed28f,_0x51e95b){return tilde['asr'](_0x13f29e,_0x2db3fb,_0x4ed28f,_0x51e95b)[_0x4f76('0x2c')](function(_0x2a3450){try{fs[_0x4f76('0x1f')](_0x13f29e);}catch(_0x49e84a){logger[_0x4f76('0x17')](_0x49e84a);}logger[_0x4f76('0x1c')]('Tilde\x20ASR\x20transcription',_0x2a3450[_0x4f76('0x4d')]);logger[_0x4f76('0x1c')](_0x4f76('0x74'),_0x2a3450[_0x4f76('0x4f')]);return _0x2a3450;});};exports[_0x4f76('0x75')]=function(_0x331daf,_0xa109b1,_0x5a9c4c,_0x57af0f,_0x3522b,_0x46182e){var _0x2ab927=path[_0x4f76('0x28')](__dirname,_0x4f76('0x3b'),rs['generate'](0x4)+_0x4f76('0x45'));var _0x192251;return aws[_0x4f76('0x76')](_0x331daf,_0xa109b1,_0x5a9c4c,_0x57af0f,_0x3522b,_0x46182e,_0x2ab927)[_0x4f76('0x2c')](function(){_0x192251=path[_0x4f76('0x28')](__dirname,'tmp',rs[_0x4f76('0x39')](0x4)+_0x4f76('0x29'));return convertFile(_0x2ab927,_0x192251);})[_0x4f76('0x2c')](function(){try{fs[_0x4f76('0x1f')](_0x2ab927);fs[_0x4f76('0x2d')](_0x192251,'777');}catch(_0x32e7da){logger[_0x4f76('0x17')](_0x32e7da);}return _0x192251[_0x4f76('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x2df97b,_0xd35878,_0x54a91a,_0x5178ad,_0xb29439,_0x1b9889){return aws[_0x4f76('0x77')](_0x2df97b,_0xd35878,_0x54a91a,_0x5178ad,_0xb29439,_0x1b9889)['then'](function(_0x2dac43){logger[_0x4f76('0x1c')](JSON[_0x4f76('0x40')](_0x2dac43));return _0x2dac43;});};exports['ispeechTTS']=function(_0x229a94,_0x597a00,_0x3fad45,_0x5e7c0b){var _0x29f4be=util['format'](_0x4f76('0x78'),ISPEECH_API,_0x229a94,encodeURIComponent(_0x597a00),_0x3fad45,_0x5e7c0b);var _0x54b5be=path[_0x4f76('0x28')](__dirname,_0x4f76('0x3b'),rs[_0x4f76('0x39')](0x4)+_0x4f76('0x45'));var _0x528394;return downloadFile(_0x29f4be,_0x54b5be)['then'](function(){_0x528394=path[_0x4f76('0x28')](__dirname,_0x4f76('0x3b'),rs[_0x4f76('0x39')](0x4)+_0x4f76('0x29'));return convertFile(_0x54b5be,_0x528394);})[_0x4f76('0x2c')](function(){try{fs['unlink'](_0x54b5be);fs[_0x4f76('0x2d')](_0x528394,_0x4f76('0x2e'));}catch(_0x56bc6e){logger[_0x4f76('0x17')](_0x56bc6e);}return _0x528394['split']('.')[0x0];});};exports['ispeechASR']=function(_0x42aa84,_0x29beb5,_0x551eea,_0x479217){var _0x632df4=util[_0x4f76('0x79')](_0x4f76('0x7a'),ISPEECH_API,_0x29beb5,_0x551eea,base64Encode(_0x42aa84),_0x479217?util[_0x4f76('0x79')](_0x4f76('0x7b'),encodeURIComponent(_0x479217)):_0x4f76('0x7c'));return uploadFile(_0x632df4)[_0x4f76('0x2c')](function(_0x31b0be){return querystring[_0x4f76('0xa')](_0x31b0be);});};exports[_0x4f76('0x7d')]=function(_0x39191c,_0x4768e0){return sestek[_0x4f76('0x7e')](_0x39191c,_0x4768e0)[_0x4f76('0x2c')](function(_0x12e75b){logger[_0x4f76('0x1c')](JSON[_0x4f76('0x40')](_0x12e75b));var _0x4135c4={'speech':_0x12e75b['text'],'action':_0x12e75b['channelData']?_0x12e75b['channelData'][_0x4f76('0x7f')]:undefined,'actiondata':_0x12e75b[_0x4f76('0x80')]?_0x12e75b[_0x4f76('0x80')][_0x4f76('0x81')]:undefined};if(_0x12e75b[_0x4f76('0x80')]&&_0x12e75b[_0x4f76('0x80')][_0x4f76('0x82')]){return base64Decode(_0x12e75b[_0x4f76('0x80')][_0x4f76('0x82')][_0x4f76('0x83')],path['resolve'](__dirname,_0x4f76('0x3b'),rs[_0x4f76('0x39')](0x4)+'.wav'))[_0x4f76('0x2c')](function(_0x200bf8){_0x4135c4['audiofile']=_0x200bf8;return _0x4135c4;});}return _0x4135c4;});};exports[_0x4f76('0x84')]=function(){return __dirname;};
\ No newline at end of file
index 1b01526..27ac691 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x325e=['./nda'];(function(_0x2364d3,_0x4bae1e){var _0x651884=function(_0x18c13c){while(--_0x18c13c){_0x2364d3['push'](_0x2364d3['shift']());}};_0x651884(++_0x4bae1e);}(_0x325e,0xa8));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};var nda=require(_0xe325('0x0'));module['exports']={'nda':nda};
\ No newline at end of file
+var _0xaeb4=['exports','./nda'];(function(_0x26b2a2,_0x3aafe1){var _0x23990f=function(_0xf6b5a7){while(--_0xf6b5a7){_0x26b2a2['push'](_0x26b2a2['shift']());}};_0x23990f(++_0x3aafe1);}(_0xaeb4,0x11d));var _0x4aeb=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xaeb4[_0x2aecb2];return _0x3ebb80;};var nda=require(_0x4aeb('0x0'));module[_0x4aeb('0x1')]={'nda':nda};
\ No newline at end of file
index c43ef05..eb7a393 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5eb1=['channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','custom_action_data','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','body'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x5eb1,0x7c));var _0x15eb=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5eb1[_0x5f0089];return _0x193892;};'use strict';var rp=require('request-promise');var url=require(_0x15eb('0x0'));var logger=require(_0x15eb('0x1'))(_0x15eb('0x2'));module[_0x15eb('0x3')]=function(_0x2b9937,_0x1c2f32){var _0x5e1142={'method':_0x15eb('0x4'),'uri':url[_0x15eb('0x5')](_0x1c2f32[_0x15eb('0x6')],_0x15eb('0x7')),'form':{'grant_type':'password','username':_0x1c2f32[_0x15eb('0x8')],'password':_0x1c2f32[_0x15eb('0x9')]},'json':!![]};return rp(_0x5e1142)['then'](function(_0xe4d8ce){var _0x160879={'method':_0x15eb('0x4'),'uri':url[_0x15eb('0x5')](_0x1c2f32[_0x15eb('0xa')],_0x15eb('0xb')),'body':{'type':_0x1c2f32[_0x15eb('0xc')]||_0x15eb('0xd'),'channelId':_0x15eb('0xe'),'conversation':{'id':_0x2b9937[_0x15eb('0xf')]},'from':{'id':_0x2b9937[_0x15eb('0x10')],'name':_0x2b9937[_0x15eb('0x11')]},'recipient':{'id':_0x2b9937[_0x15eb('0x12')],'name':_0x2b9937['extension']},'text':_0x1c2f32[_0x15eb('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xe4d8ce['access_token']},'json':!![]};if(_0x1c2f32['project']){_0x160879[_0x15eb('0x14')][_0x15eb('0x15')][_0x15eb('0x16')]=_0x1c2f32[_0x15eb('0x17')];}if(_0x1c2f32['ndagenerate_audio']=='1'){_0x160879[_0x15eb('0x14')][_0x15eb('0x15')][_0x15eb('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x15eb('0x19')};}if(_0x1c2f32['custom_action']){_0x160879['body']['channelData']['CustomAction']=_0x1c2f32[_0x15eb('0x1a')];if(_0x1c2f32['custom_action_data']){_0x160879['body'][_0x15eb('0x15')]['CustomActionData']=_0x1c2f32[_0x15eb('0x1b')];}}logger['info'](JSON[_0x15eb('0x1c')](_0x160879));return rp(_0x160879);});};
\ No newline at end of file
+var _0xcd31=['dnid','extension','text','Bearer\x20','project','channelData','ProjectName','AudioOutputSettings','audio/wav','body','CustomAction','custom_action','stringify','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x40f563,_0x4a7141){var _0x3ad8c9=function(_0x27cdac){while(--_0x27cdac){_0x40f563['push'](_0x40f563['shift']());}};_0x3ad8c9(++_0x4a7141);}(_0xcd31,0x15d));var _0x1cd3=function(_0x1e035c,_0xf906b){_0x1e035c=_0x1e035c-0x0;var _0x3a63f0=_0xcd31[_0x1e035c];return _0x3a63f0;};'use strict';var rp=require('request-promise');var url=require(_0x1cd3('0x0'));var logger=require(_0x1cd3('0x1'))(_0x1cd3('0x2'));module['exports']=function(_0x3da1e3,_0x19dd0c){var _0x2526ea={'method':_0x1cd3('0x3'),'uri':url[_0x1cd3('0x4')](_0x19dd0c[_0x1cd3('0x5')],'/token'),'form':{'grant_type':_0x1cd3('0x6'),'username':_0x19dd0c[_0x1cd3('0x7')],'password':_0x19dd0c[_0x1cd3('0x6')]},'json':!![]};return rp(_0x2526ea)['then'](function(_0x45cc24){var _0x11b139={'method':_0x1cd3('0x3'),'uri':url['resolve'](_0x19dd0c[_0x1cd3('0x8')],_0x1cd3('0x9')),'body':{'type':_0x19dd0c[_0x1cd3('0xa')]||_0x1cd3('0xb'),'channelId':_0x1cd3('0xc'),'conversation':{'id':_0x3da1e3[_0x1cd3('0xd')]},'from':{'id':_0x3da1e3[_0x1cd3('0xe')],'name':_0x3da1e3['calleridname']},'recipient':{'id':_0x3da1e3[_0x1cd3('0xf')],'name':_0x3da1e3[_0x1cd3('0x10')]},'text':_0x19dd0c[_0x1cd3('0x11')],'channelData':{}},'headers':{'Authorization':_0x1cd3('0x12')+_0x45cc24['access_token']},'json':!![]};if(_0x19dd0c[_0x1cd3('0x13')]){_0x11b139['body'][_0x1cd3('0x14')][_0x1cd3('0x15')]=_0x19dd0c[_0x1cd3('0x13')];}if(_0x19dd0c['ndagenerate_audio']=='1'){_0x11b139['body'][_0x1cd3('0x14')][_0x1cd3('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1cd3('0x17')};}if(_0x19dd0c['custom_action']){_0x11b139[_0x1cd3('0x18')][_0x1cd3('0x14')][_0x1cd3('0x19')]=_0x19dd0c[_0x1cd3('0x1a')];if(_0x19dd0c['custom_action_data']){_0x11b139['body']['channelData']['CustomActionData']=_0x19dd0c['custom_action_data'];}}logger['info'](JSON[_0x1cd3('0x1b')](_0x11b139));return rp(_0x11b139);});};
\ No newline at end of file
index 677ae86..1b3204c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6fa2=['./lib/api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6fa2,0x1b7));var _0x26fa=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6fa2[_0x465a0c];return _0x1e202e;};'use strict';var asr=require(_0x26fa('0x0'));module['exports']=function(_0x39ca19,_0x49a4b3,_0x2e9234,_0x51f85d){return asr(_0x39ca19,_0x49a4b3,_0x2e9234,_0x51f85d);};
\ No newline at end of file
+'use strict';var asr=require('./lib/api');module['exports']=function(_0x420c57,_0x4b7cf4,_0x51cb5c,_0x29a902){return asr(_0x420c57,_0x4b7cf4,_0x51cb5c,_0x29a902);};
\ No newline at end of file
index 49b9c16..7c4494f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22da=['transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','lodash','moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0x3b2b55,_0x31c65d){var _0x172194=function(_0xce8119){while(--_0xce8119){_0x3b2b55['push'](_0x3b2b55['shift']());}};_0x172194(++_0x31c65d);}(_0x22da,0x1a1));var _0xa22d=function(_0x5636a0,_0x4d0be2){_0x5636a0=_0x5636a0-0x0;var _0x55b36f=_0x22da[_0x5636a0];return _0x55b36f;};'use strict';var BPromise=require('bluebird');var _=require(_0xa22d('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa22d('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xa22d('0x2'));module[_0xa22d('0x3')]=function(_0xe6554e,_0x109d74,_0x4b959a,_0xdcfb7d){return new BPromise(function(_0xbb510,_0xd062ac){logger[_0xa22d('0x4')](_0xa22d('0x5'),_0xdcfb7d||_0xa22d('0x6'));var _0x29dcc0=new WebSocket(_0xdcfb7d||_0xa22d('0x6'),{'perMessageDeflate':![]});var _0xe6a27f='';var _0x41f0a5='0';var _0x48c5dd='1';var _0x49bf08=_0xa22d('0x7');function _0x279468(_0x5a3312){var _0x13c11a=crypto['createHash'](_0xa22d('0x8'));_0x13c11a[_0xa22d('0x9')](_0x5a3312);return _0x13c11a[_0xa22d('0xa')](_0xa22d('0xb'));}function _0x5714a7(){try{logger[_0xa22d('0x4')](_0xa22d('0xc'));var _0x363259=moment()[_0xa22d('0xd')]();var _0x40cba5=_0x279468(_0x363259+_0x109d74+_0x4b959a);_0x29dcc0['send'](JSON[_0xa22d('0xe')]({'appID':_0x109d74,'timestamp':_0x363259,'appKey':_0x40cba5}));var _0x49259e=fs[_0xa22d('0xf')](_0xe6554e);_0x49259e['on'](_0xa22d('0x10'),function(_0x1be3c3){_0x29dcc0[_0xa22d('0x11')](_0x1be3c3);});_0x49259e['on'](_0xa22d('0x12'),function(){_0x29dcc0['send'](_0xa22d('0x13'));});}catch(_0x45ef0f){logger[_0xa22d('0x14')](_0xa22d('0x15'),JSON[_0xa22d('0xe')](_0x45ef0f));_0x29dcc0[_0xa22d('0x16')]();}}function _0x3a1e55(_0xcaaabb){try{if(_0xcaaabb){var _0x2f9135=JSON['parse'](_0xcaaabb);switch(_0x2f9135[_0xa22d('0x17')]){case 0x0:if(_0x2f9135['result']){if(_0x2f9135[_0xa22d('0x18')]['final']){logger[_0xa22d('0x4')](_0xa22d('0x19'),JSON[_0xa22d('0xe')](_0x2f9135['result']['hypotheses']));_0xe6a27f=_0x2f9135[_0xa22d('0x18')][_0xa22d('0x1a')][0x0][_0xa22d('0x1b')];_0x41f0a5=_0x2f9135[_0xa22d('0x18')][_0xa22d('0x1a')][0x0][_0xa22d('0x1c')];_0x48c5dd='0';_0x49bf08=_0xa22d('0x1d');_0x29dcc0[_0xa22d('0x16')]();}}break;case 0x1:logger[_0xa22d('0x4')](_0xa22d('0x7'));_0x48c5dd='1';_0x49bf08='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xa22d('0x4')](_0xa22d('0x1e'));_0x48c5dd='2';_0x49bf08='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xa22d('0x4')](_0xa22d('0x1f'));_0x48c5dd='9';_0x49bf08='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xa22d('0x4')](_0xa22d('0x20'));_0x48c5dd='10';_0x49bf08=_0xa22d('0x20');break;case 0xb:logger[_0xa22d('0x4')](_0xa22d('0x21'));_0x48c5dd='11';_0x49bf08='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0xd564d3){logger[_0xa22d('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0xd564d3));_0x29dcc0[_0xa22d('0x16')]();}}function _0x3dfe3f(){logger[_0xa22d('0x4')](_0xa22d('0x22'));_0xbb510({'transcript':_0xe6a27f,'confidence':_0x41f0a5,'status':_0x48c5dd,'status_message':_0x49bf08});}function _0x3f09bd(_0x22078b){logger['error'](_0xa22d('0x23'));if(!_[_0xa22d('0x24')](_0x22078b)){logger[_0xa22d('0x14')](_['isObject'](_0x22078b)?JSON['stringify'](_0x22078b):_0x22078b);}}_0x29dcc0['on']('open',_0x5714a7);_0x29dcc0['on']('message',_0x3a1e55);_0x29dcc0['on'](_0xa22d('0x12'),_0x3dfe3f);_0x29dcc0['on'](_0xa22d('0x14'),_0x3f09bd);});};
\ No newline at end of file
+var _0x292a=['result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','crypto','../../../../../../config/logger','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status'];(function(_0x27a773,_0x4d6eb2){var _0x31655e=function(_0x5f4744){while(--_0x5f4744){_0x27a773['push'](_0x27a773['shift']());}};_0x31655e(++_0x4d6eb2);}(_0x292a,0x7b));var _0xa292=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x292a[_0x5ac0f0];return _0x4aceec;};'use strict';var BPromise=require('bluebird');var _=require(_0xa292('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xa292('0x1'));var logger=require(_0xa292('0x2'))('agi');module[_0xa292('0x3')]=function(_0x1536f6,_0x2671aa,_0x454340,_0x30b0f5){return new BPromise(function(_0x3d8d23,_0x308979){logger['info']('Tilde\x20URI',_0x30b0f5||_0xa292('0x4'));var _0x245455=new WebSocket(_0x30b0f5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x27b757='';var _0x5d6ebf='0';var _0x38307d='1';var _0xb0980f=_0xa292('0x5');function _0x43861a(_0x35c050){var _0x598ea4=crypto['createHash'](_0xa292('0x6'));_0x598ea4[_0xa292('0x7')](_0x35c050);return _0x598ea4[_0xa292('0x8')](_0xa292('0x9'));}function _0x38ad92(){try{logger[_0xa292('0xa')](_0xa292('0xb'));var _0x5a92a1=moment()[_0xa292('0xc')]();var _0x2e06a8=_0x43861a(_0x5a92a1+_0x2671aa+_0x454340);_0x245455[_0xa292('0xd')](JSON['stringify']({'appID':_0x2671aa,'timestamp':_0x5a92a1,'appKey':_0x2e06a8}));var _0x48db0f=fs['createReadStream'](_0x1536f6);_0x48db0f['on']('data',function(_0x58b630){_0x245455[_0xa292('0xd')](_0x58b630);});_0x48db0f['on'](_0xa292('0xe'),function(){_0x245455[_0xa292('0xd')](_0xa292('0xf'));});}catch(_0x27b5ad){logger[_0xa292('0x10')](_0xa292('0x11'),JSON[_0xa292('0x12')](_0x27b5ad));_0x245455[_0xa292('0x13')]();}}function _0x471070(_0x2065d1){try{if(_0x2065d1){var _0x194295=JSON['parse'](_0x2065d1);switch(_0x194295[_0xa292('0x14')]){case 0x0:if(_0x194295[_0xa292('0x15')]){if(_0x194295['result'][_0xa292('0x16')]){logger['info'](_0xa292('0x17'),JSON['stringify'](_0x194295['result']['hypotheses']));_0x27b757=_0x194295[_0xa292('0x15')][_0xa292('0x18')][0x0][_0xa292('0x19')];_0x5d6ebf=_0x194295['result']['hypotheses'][0x0][_0xa292('0x1a')];_0x38307d='0';_0xb0980f='Success.';_0x245455['terminate']();}}break;case 0x1:logger[_0xa292('0xa')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x38307d='1';_0xb0980f=_0xa292('0x5');break;case 0x2:logger[_0xa292('0xa')](_0xa292('0x1b'));_0x38307d='2';_0xb0980f=_0xa292('0x1b');break;case 0x9:logger[_0xa292('0xa')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x38307d='9';_0xb0980f=_0xa292('0x1c');break;case 0xa:logger[_0xa292('0xa')](_0xa292('0x1d'));_0x38307d='10';_0xb0980f=_0xa292('0x1d');break;case 0xb:logger[_0xa292('0xa')](_0xa292('0x1e'));_0x38307d='11';_0xb0980f=_0xa292('0x1e');}}}catch(_0x176485){logger[_0xa292('0x10')](_0xa292('0x1f'),JSON[_0xa292('0x12')](_0x176485));_0x245455['terminate']();}}function _0x51253f(){logger[_0xa292('0xa')]('Close\x20Tilde\x20ASR\x20socket');_0x3d8d23({'transcript':_0x27b757,'confidence':_0x5d6ebf,'status':_0x38307d,'status_message':_0xb0980f});}function _0x571f10(_0x486df9){logger[_0xa292('0x10')](_0xa292('0x20'));if(!_['isNil'](_0x486df9)){logger[_0xa292('0x10')](_[_0xa292('0x21')](_0x486df9)?JSON['stringify'](_0x486df9):_0x486df9);}}_0x245455['on'](_0xa292('0x22'),_0x38ad92);_0x245455['on'](_0xa292('0x23'),_0x471070);_0x245455['on'](_0xa292('0xe'),_0x51253f);_0x245455['on'](_0xa292('0x10'),_0x571f10);});};
\ No newline at end of file
index 0501e8f..10cb4be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x154d=['exports','./asr'];(function(_0x88ffd4,_0x25f7e6){var _0x528f9c=function(_0x166382){while(--_0x166382){_0x88ffd4['push'](_0x88ffd4['shift']());}};_0x528f9c(++_0x25f7e6);}(_0x154d,0xd3));var _0xd154=function(_0x141896,_0x274a81){_0x141896=_0x141896-0x0;var _0x2cec16=_0x154d[_0x141896];return _0x2cec16;};var asr=require(_0xd154('0x0'));module[_0xd154('0x1')]={'asr':asr};
\ No newline at end of file
+var asr=require('./asr');module['exports']={'asr':asr};
\ No newline at end of file
index 7a2d99c..de5a5f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);};
\ No newline at end of file
+var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x46c9cc,_0xd27dca){var _0x21b46e=function(_0x33b2f5){while(--_0x33b2f5){_0x46c9cc['push'](_0x46c9cc['shift']());}};_0x21b46e(++_0xd27dca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);};
\ No newline at end of file
index 849e36a..5bcbd97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbecf=['body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','exec','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','file_id','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','recordFile','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','login','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','template_id','sendMail\x20message','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','prototype','getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','mailRpc','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','callerid','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','replace','googleCloudTTS','apiKey','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','url','headers'];(function(_0x3e9332,_0x42c2ac){var _0x59fe47=function(_0x15136c){while(--_0x15136c){_0x3e9332['push'](_0x3e9332['shift']());}};_0x59fe47(++_0x42c2ac);}(_0xbecf,0x15c));var _0xfbec=function(_0x3bcc6f,_0x3a4e55){_0x3bcc6f=_0x3bcc6f-0x0;var _0x296d2c=_0xbecf[_0x3bcc6f];return _0x296d2c;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0xfbec('0x0'));var odbc=require(_0xfbec('0x1'))();var rs=require(_0xfbec('0x2'));var moment=require(_0xfbec('0x3'));var Mustache=require('mustache');var rp=require(_0xfbec('0x4'));var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require(_0xfbec('0x7'));var shared=require(_0xfbec('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xfbec('0x9');var recursiveMapAttributes=[_0xfbec('0xa'),_0xfbec('0xb')];var verticesWithRetry=[_0xfbec('0xc'),_0xfbec('0xd'),_0xfbec('0xe')];var AGIVertices=function(_0x1b87c5,_0x168ec5,_0x21863f){this['channel']=_0x1b87c5;this['rpc']=_0x168ec5;this['mailRpc']=_0x21863f;};AGIVertices[_0xfbec('0xf')][_0xfbec('0x10')]=function(_0x12d057,_0x2d0e02){this[_0xfbec('0x11')]['getVariableById'](_0x12d057)[_0xfbec('0x12')](function(_0x2b7d99){_0x2d0e02(null,_0x2b7d99?_0x2b7d99[_0xfbec('0x13')]:![]);})[_0xfbec('0x14')](function(_0x4859ea){_0x2d0e02(_0x4859ea);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x15')]=function(_0x3f06d4,_0x1af87d){this['rpc'][_0xfbec('0x16')](_0x3f06d4)['then'](function(_0x8b2f89){_0x1af87d(null,_0x8b2f89?_0x8b2f89['name']:![]);})[_0xfbec('0x14')](function(_0x923681){_0x1af87d(_0x923681);});};AGIVertices[_0xfbec('0xf')]['getSquareProject']=function(_0xe91fb8,_0x2a3329){this[_0xfbec('0x11')]['getSquareProjectById'](_0xe91fb8)[_0xfbec('0x12')](function(_0x267a4b){_0x2a3329(null,_0x267a4b?_0x267a4b[_0xfbec('0x13')]:![]);})[_0xfbec('0x14')](function(_0x42a6cf){_0x2a3329(_0x42a6cf);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x17')]=function(_0x4f2431,_0x5e90c3){this['rpc'][_0xfbec('0x18')](_0x4f2431)[_0xfbec('0x12')](function(_0x2c2007){_0x5e90c3(null,_0x2c2007?_0x2c2007['dsn']:![]);})[_0xfbec('0x14')](function(_0x383405){_0x5e90c3(_0x383405);});};AGIVertices['prototype'][_0xfbec('0x19')]=function(_0x226685,_0x54a20f){this[_0xfbec('0x11')][_0xfbec('0x1a')](_0x226685)[_0xfbec('0x12')](function(_0x43e395){_0x54a20f(null,_0x43e395?_0x43e395[_0xfbec('0x13')]:![]);})['catch'](function(_0x2e172e){_0x54a20f(_0x2e172e);});};AGIVertices['prototype'][_0xfbec('0x1b')]=function(_0x1c9a07,_0x5bbb79){this['rpc']['getTrunkById'](_0x1c9a07)[_0xfbec('0x12')](function(_0x421535){_0x5bbb79(null,_0x421535?_0x421535['name']:![]);})[_0xfbec('0x14')](function(_0xa56be8){_0x5bbb79(_0xa56be8);});};AGIVertices[_0xfbec('0xf')]['getSound']=function(_0x29126f,_0x2d9acb){var _0x437b7e=this;this[_0xfbec('0x11')][_0xfbec('0x1c')](_0x29126f)[_0xfbec('0x12')](function(_0x4aff99){_0x2d9acb(null,_0x4aff99?_0x437b7e[_0xfbec('0x1d')](_0x4aff99[_0xfbec('0x1e')]):![]);})[_0xfbec('0x14')](function(_0x30d356){_0x2d9acb(_0x30d356);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x1f')]=function(_0x41b4cf,_0x5cb9d7){this[_0xfbec('0x11')]['getMailAccountById'](_0x41b4cf)['then'](function(_0x5a3829){_0x5cb9d7(null,_0x5a3829?_0x5a3829:![]);})[_0xfbec('0x14')](function(_0x49cc9a){_0x5cb9d7(_0x49cc9a);});};AGIVertices['prototype']['sendMailMessage']=function(_0x3da9c6,_0xab9f46,_0x242a4b){this[_0xfbec('0x20')][_0xfbec('0x21')](_0x3da9c6,_0xab9f46)['then'](function(){_0x242a4b(null);})[_0xfbec('0x14')](function(_0x2376ce){_0x242a4b(_0x2376ce);});};AGIVertices['prototype'][_0xfbec('0x22')]=function(_0x4e83c0,_0x58960e){this[_0xfbec('0x11')][_0xfbec('0x23')](_0x4e83c0)[_0xfbec('0x12')](function(_0x143463){if(_0x143463){if(_0x143463['IntervalId']){_0x58960e(null,[_0x143463[_0xfbec('0x24')]]);}else{_0x58960e(null,_[_0xfbec('0x25')](_0x143463[_0xfbec('0x26')],'interval'));}}else{_0x58960e(null,![]);}})['catch'](function(_0x3d35b5){_0x58960e(_0x3d35b5);});};AGIVertices['prototype'][_0xfbec('0x1d')]=function(_0x41e891){return util[_0xfbec('0x27')](_0xfbec('0x28'),FILES_PATH,_0x41e891);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x29')]=function(_0x5c58fd,_0x4bf313,_0x387e55){odbc[_0xfbec('0x2a')](_0x5c58fd,function(_0x173064){if(_0x173064){logger[_0xfbec('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x173064);_0x387e55(_0x173064);}else{logger[_0xfbec('0x2c')]('ODBC\x20connection\x20successfully');odbc['query'](_0x4bf313,function(_0x256e74,_0x39bc67){if(_0x256e74){logger[_0xfbec('0x2c')](_0xfbec('0x2d'),_0x4bf313);_0x387e55(_0x256e74);}else{logger[_0xfbec('0x2c')](_0xfbec('0x2e'),_0x4bf313);odbc[_0xfbec('0x2f')](function(_0xcd753c){if(_0xcd753c){logger[_0xfbec('0x2b')](_0xfbec('0x30'),_0xcd753c);}_0x387e55(null,_0x39bc67);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3b2b41,_0x2d6d9c){this[_0xfbec('0x11')][_0xfbec('0x31')](_0x3b2b41)['then'](function(_0xc5d2e9){_0x2d6d9c(null,_0xc5d2e9?_0xc5d2e9:![]);})[_0xfbec('0x14')](function(_0x1044d9){_0x2d6d9c(_0x1044d9);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x32')]=function(_0x44b2bf,_0x7b46a6){this['rpc'][_0xfbec('0x32')](_0x44b2bf)[_0xfbec('0x12')](function(_0x4e3f57){_0x7b46a6(null,_0x4e3f57);})[_0xfbec('0x14')](function(_0x3c0c5f){_0x7b46a6(_0x3c0c5f);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x33')]=function(_0x206a55,_0x10e23e,_0x154de6){this['rpc'][_0xfbec('0x33')]({'uniqueid':this[_0xfbec('0x34')]['uniqueid'],'node':_0x206a55[_0xfbec('0x35')],'application':_0x206a55['agicommand'],'data':_0x10e23e||null,'project_name':this[_0xfbec('0x34')]['arg_1'],'callerid':this[_0xfbec('0x34')][_0xfbec('0x36')]})[_0xfbec('0x12')](function(_0x1ce70b){if(_0x154de6){_0x154de6(null,_0x1ce70b);}})[_0xfbec('0x14')](function(_0x401a11){if(_0x154de6){_0x154de6(_0x401a11);}});};AGIVertices[_0xfbec('0xf')]['createSquareRecording']=function(_0x40cb7f,_0x64cf4d,_0x448dc3,_0x4772e8){this['rpc'][_0xfbec('0x37')]({'uniqueid':this[_0xfbec('0x34')][_0xfbec('0x38')],'callerid':this[_0xfbec('0x34')][_0xfbec('0x36')],'calleridname':this[_0xfbec('0x34')][_0xfbec('0x39')],'context':this['channel'][_0xfbec('0x3a')],'extension':this[_0xfbec('0x34')]['extension'],'priority':this[_0xfbec('0x34')][_0xfbec('0x3b')],'accountcode':this[_0xfbec('0x34')][_0xfbec('0x3c')],'dnid':this[_0xfbec('0x34')]['dnid'],'projectName':this[_0xfbec('0x34')][_0xfbec('0x3d')],'saveName':_0x64cf4d,'filename':_0x40cb7f[_0xfbec('0x3e')]||_0x64cf4d,'savePath':_0x448dc3})[_0xfbec('0x12')](function(_0x2bed4c){_0x4772e8(null,_0x2bed4c);})['catch'](function(_0x3b17ba){_0x4772e8(_0x3b17ba);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x3f')]=function(_0x286bf1,_0x458ee4,_0x4e79ff,_0x238394,_0x2cc356){this[_0xfbec('0x11')][_0xfbec('0x3f')]({'uniqueid':this[_0xfbec('0x34')]['uniqueid'],'body':_0x286bf1,'direction':_0x458ee4,'providerName':_0x4e79ff,'providerResponse':_0x238394})[_0xfbec('0x12')](function(_0x30fe9b){if(_0x2cc356){_0x2cc356(null,_0x30fe9b);}})[_0xfbec('0x14')](function(_0x2c5a9a){if(_0x2cc356){_0x2cc356(_0x2c5a9a);}});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x40')]=function(_0x354d49,_0x3cb620){this[_0xfbec('0x11')][_0xfbec('0x40')]({'firstName':_[_0xfbec('0x41')](_0x354d49[_0xfbec('0x13')])||_[_0xfbec('0x42')](_0x354d49['name'])?_0xfbec('0x43')+Math[_0xfbec('0x44')]():_0x354d49[_0xfbec('0x13')],'lastName':_[_0xfbec('0x41')](_0x354d49[_0xfbec('0x45')])||_[_0xfbec('0x42')](_0x354d49[_0xfbec('0x45')])?null:_0x354d49['lastName'],'phone':_0x354d49['phone'],'ListId':_0x354d49[_0xfbec('0x46')],'scheduledat':_0x354d49[_0xfbec('0x47')],'callbackUniqueid':this[_0xfbec('0x34')][_0xfbec('0x38')],'tags':_0xfbec('0x48'),'description':_0xfbec('0x49')+_0x354d49['scheduledAt'][_0xfbec('0x4a')](),'priority':_0x354d49[_0xfbec('0x4b')]})[_0xfbec('0x12')](function(_0x3b9439){_0x3cb620(null,_0x3b9439);})[_0xfbec('0x14')](function(_0x2296c4){_0x3cb620(_0x2296c4);});};AGIVertices[_0xfbec('0xf')]['getPause']=function(_0x2ec139,_0x2ad395){this['rpc'][_0xfbec('0x4c')](_0x2ec139)[_0xfbec('0x12')](function(_0x19cc60){_0x2ad395(null,_0x19cc60?_0x19cc60[_0xfbec('0x13')]:![]);})[_0xfbec('0x14')](function(_0x4fbf88){_0x2ad395(_0x4fbf88);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x4d')]=function(_0x1063fd,_0x30289e,_0x2b8f02){var _0x1d9469={'role':'agent'};_0x1d9469[_0x1063fd]=this['channel'][_0xfbec('0x36')];this[_0xfbec('0x11')][_0xfbec('0x4d')](_0x1d9469,_0x30289e,this[_0xfbec('0x34')][_0xfbec('0x38')])[_0xfbec('0x12')](function(_0x3c2b99){_0x2b8f02(null,_[_0xfbec('0x42')](_0x3c2b99)?![]:!![]);})['catch'](function(_0x38ead0){logger[_0xfbec('0x2b')](_0x38ead0);_0x2b8f02(null,![]);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x4e')]=function(_0x4e77e4,_0x3d3fc1){var _0x4792e6={'role':_0xfbec('0x4f')};_0x4792e6[_0x4e77e4]=this['channel'][_0xfbec('0x36')];this['rpc'][_0xfbec('0x4e')](_0x4792e6)[_0xfbec('0x12')](function(_0x5585a3){_0x3d3fc1(null,_[_0xfbec('0x42')](_0x5585a3)?![]:!![]);})[_0xfbec('0x14')](function(_0x5d70b5){logger[_0xfbec('0x2b')](_0x5d70b5);_0x3d3fc1(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x90ee34,_0x407587){var _0x1d25fe={'role':'agent'};_0x1d25fe[_0x90ee34]=this[_0xfbec('0x34')][_0xfbec('0x36')];this[_0xfbec('0x11')][_0xfbec('0x50')](_0x1d25fe)[_0xfbec('0x12')](function(_0x34cc03){_0x407587(null,_['isNil'](_0x34cc03)?![]:!![]);})[_0xfbec('0x14')](function(_0xc0356a){logger[_0xfbec('0x2b')](_0xc0356a);_0x407587(null,![]);});};AGIVertices[_0xfbec('0xf')]['agentLogin']=function(_0x53ca19,_0x185734){var _0x2751fa={'role':_0xfbec('0x4f')};_0x2751fa[_0x53ca19]=this[_0xfbec('0x34')][_0xfbec('0x36')];var _0x555120=_0x53ca19!=_0xfbec('0x51')?util[_0xfbec('0x27')](_0xfbec('0x52'),_0xfbec('0x53'),this[_0xfbec('0x34')]['callerid']):undefined;this['rpc'][_0xfbec('0x54')](_0x2751fa,_0x555120)['then'](function(_0x37bd34){_0x185734(null,_[_0xfbec('0x42')](_0x37bd34)?![]:!![]);})[_0xfbec('0x14')](function(_0x1fcdc8){logger['error'](_0x1fcdc8);_0x185734(null,![]);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x55')]=function(_0x3fc2b3,_0x5539d8){sh['exec'](_['trim'](_0x3fc2b3),function(_0x2e3295,_0x3df279){var _0x561b90=_0x3df279[_0xfbec('0x56')](/(\r\n|\n|\r)/gm,'');_0x5539d8(null,_0x561b90);});};AGIVertices[_0xfbec('0xf')]['googleCloudTTS']=function(_0x3c2f44,_0x4d08fa){scripts[_0xfbec('0x57')](_0x3c2f44[_0xfbec('0x58')],_0x3c2f44['google_cloud_tts_text_type']||_0xfbec('0x59'),_0x3c2f44[_0xfbec('0x59')],_0x3c2f44['languageCode']||'en-US',_0x3c2f44[_0xfbec('0x5a')]||_0xfbec('0x5b'),_0x3c2f44[_0xfbec('0x5c')]||_0xfbec('0x5d'))[_0xfbec('0x12')](function(_0x971b3e){_0x4d08fa(null,_0x971b3e);})[_0xfbec('0x14')](function(_0x53475a){_0x4d08fa(_0x53475a);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x5e')]=function(_0x16e27d,_0x2e8ece){scripts['googleTTS'](_0x16e27d[_0xfbec('0x59')],_0x16e27d[_0xfbec('0x5f')]||'en',0x1)[_0xfbec('0x12')](function(_0x3dc274){_0x2e8ece(null,_0x3dc274);})[_0xfbec('0x14')](function(_0x9766bc){_0x2e8ece(_0x9766bc);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x60')]=function(_0x4c5c0d,_0x805878){var _0x3a4fee={'uri':_0x4c5c0d['url'],'method':_0x4c5c0d[_0xfbec('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c5c0d[_0xfbec('0x62')])===_0xfbec('0x63')&&parseInt(_0x4c5c0d[_0xfbec('0x62')])>=0x1?parseInt(_0x4c5c0d[_0xfbec('0x62')])*0x3e8:0x5*0x3e8};if(_[_0xfbec('0x64')](['POST','PUT'],_0x3a4fee[_0xfbec('0x61')]['toUpperCase']())){try{_0x3a4fee['body']=_0x4c5c0d['rawBody']?JSON[_0xfbec('0x65')](_0x4c5c0d['rawBody']):{};}catch(_0x16fabb){logger['error'](_0xfbec('0x66'),_0x16fabb);}}try{_0x3a4fee['headers']=_0x4c5c0d[_0xfbec('0xa')]?JSON[_0xfbec('0x65')](_0x4c5c0d[_0xfbec('0xa')]):{};}catch(_0x24c1dd){logger[_0xfbec('0x2b')](_0xfbec('0x67'),_0x24c1dd);}if(_0x4c5c0d[_0xfbec('0x68')]){try{var _0x534fad=require(_0x4c5c0d[_0xfbec('0x68')])[_0xfbec('0x69')](this,_0x3a4fee);_0x3a4fee[_0xfbec('0x6a')]=Mustache['render'](_0x4c5c0d[_0xfbec('0x6b')],_0x534fad,{},['$$','$$']);if(_0x3a4fee['headers']){_0x3a4fee[_0xfbec('0x6c')]=JSON[_0xfbec('0x65')](Mustache['render'](JSON['stringify'](_0x3a4fee[_0xfbec('0x6c')]),_0x534fad,{},['$$','$$']));}if(_0x3a4fee[_0xfbec('0x6d')]){_0x3a4fee[_0xfbec('0x6d')]=JSON[_0xfbec('0x65')](Mustache['render'](JSON[_0xfbec('0x6e')](_0x3a4fee[_0xfbec('0x6d')]),_0x534fad,{},['$$','$$']));}}catch(_0x1cac63){logger[_0xfbec('0x2b')](_0xfbec('0x6f'),_0x1cac63);}}rp(_0x3a4fee)['then'](function(_0x38f091){var _0x2a83f2={'statusCode':_0x38f091[_0xfbec('0x70')]||0xc8,'statusMessage':_0x38f091[_0xfbec('0x71')]||'OK','headers':_0x38f091['headers']||{},'body':_0x38f091['body']||{}};_0x805878(null,_0x2a83f2);})[_0xfbec('0x14')](function(_0x366c47){var _0x5c360b={'statusCode':_0x366c47['statusCode']||0x1f4,'statusMessage':_0x366c47[_0xfbec('0x72')]||_0xfbec('0x73'),'headers':_0x366c47['options'][_0xfbec('0x6c')]||{},'body':_0x366c47[_0xfbec('0x74')]['body']||{}};_0x805878(null,_0x5c360b);});};AGIVertices['prototype'][_0xfbec('0x75')]=function(_0x52d71f,_0x495a5d){scripts['googleDialogflow'](this[_0xfbec('0x34')][_0xfbec('0x38')],_0x52d71f[_0xfbec('0x76')],_0x52d71f[_0xfbec('0x59')],_0x52d71f[_0xfbec('0x77')]||'en')[_0xfbec('0x12')](function(_0x49da06){_0x495a5d(null,_0x49da06);})[_0xfbec('0x14')](function(_0x307cec){_0x495a5d(_0x307cec);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x78')]=function(_0x56f05,_0x57424d){scripts[_0xfbec('0x78')](this['channel'][_0xfbec('0x38')],_0x56f05[_0xfbec('0x79')],_0x56f05[_0xfbec('0x7a')],_0x56f05[_0xfbec('0x7b')],_0x56f05[_0xfbec('0x59')],_0x56f05['dialogflowV2_language']||'en')['then'](function(_0x79e2f4){_0x57424d(null,_0x79e2f4);})[_0xfbec('0x14')](function(_0x29f9f8){_0x57424d(_0x29f9f8);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x7c')]=function(_0x1e6a4e,_0x380924){scripts['sestekNDA'](this['channel'],_0x1e6a4e)[_0xfbec('0x12')](function(_0x4481a0){_0x380924(null,_0x4481a0);})[_0xfbec('0x14')](function(_0x56f0ee){_0x380924(_0x56f0ee);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x7d')]=function(_0x1d5a5b,_0x27fb9a){scripts[_0xfbec('0x7d')](_0x1d5a5b[_0xfbec('0x76')],_0x1d5a5b[_0xfbec('0x59')],_0x1d5a5b[_0xfbec('0x7e')]||_0xfbec('0x7f'),_0x1d5a5b[_0xfbec('0x80')])['then'](function(_0x4b1f56){_0x27fb9a(null,_0x4b1f56);})['catch'](function(_0x398d03){_0x27fb9a(_0x398d03);});};AGIVertices['prototype'][_0xfbec('0x81')]=function(_0x8156e7,_0x50e461,_0x297483){scripts['ispeechASR'](_0x50e461,_0x8156e7['key'],_0x8156e7[_0xfbec('0x82')]||_0xfbec('0x7f'),this[_0xfbec('0x83')](_0x8156e7['model'])?_0x8156e7[_0xfbec('0x84')]:undefined)[_0xfbec('0x12')](function(_0x40bae6){_0x297483(null,_0x40bae6);})[_0xfbec('0x14')](function(_0x5bd81b){_0x297483(_0x5bd81b);});};AGIVertices[_0xfbec('0xf')]['awsPolly']=function(_0x220c10,_0x57d27c){scripts[_0xfbec('0x85')](_0x220c10[_0xfbec('0x86')],_0x220c10[_0xfbec('0x87')],_0x220c10['aws_polly_region'],_0x220c10[_0xfbec('0x88')]||_0xfbec('0x89'),_0x220c10[_0xfbec('0x59')],_0x220c10[_0xfbec('0x8a')]||'text')[_0xfbec('0x12')](function(_0x299f94){_0x57d27c(null,_0x299f94);})['catch'](function(_0x101fc6){_0x57d27c(_0x101fc6);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x8b')]=function(_0x13980f,_0xf266da){scripts[_0xfbec('0x8b')](this['channel'][_0xfbec('0x38')],_0x13980f['aws_access_key_id'],_0x13980f[_0xfbec('0x87')],_0x13980f[_0xfbec('0x8c')],_0x13980f[_0xfbec('0x59')],_0x13980f['aws_bot_name'])[_0xfbec('0x12')](function(_0x20d858){_0xf266da(null,_0x20d858);})[_0xfbec('0x14')](function(_0x440995){_0xf266da(_0x440995);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x8d')]=function(_0x4e5934,_0x4cd100,_0x303fc4){scripts['googleASR'](_0x4cd100,_0x4e5934[_0xfbec('0x76')],_0x4e5934['google_asr_language']||'en-US')[_0xfbec('0x12')](function(_0x1d8836){_0x303fc4(null,_0x1d8836);})[_0xfbec('0x14')](function(_0x9119a4){_0x303fc4(_0x9119a4);});};AGIVertices[_0xfbec('0xf')][_0xfbec('0x8e')]=function(_0x505edf,_0x2d8e0f,_0xcda550){scripts['tildeASR'](_0x2d8e0f,_0x505edf['appid'],_0x505edf['appsecret'],_0x505edf[_0xfbec('0x6a')])[_0xfbec('0x12')](function(_0x2042e1){_0xcda550(null,_0x2042e1);})[_0xfbec('0x14')](function(_0x4fc796){_0xcda550(_0x4fc796);});};AGIVertices['prototype']['clear']=function(_0x54890d){var _0x34f5ab=_['includes'](verticesWithRetry,_0x54890d[_0xfbec('0x8f')])?_0x54890d:_[_0xfbec('0x90')](_0x54890d);for(var _0x58de8a in _0x34f5ab){if(_0x34f5ab[_0xfbec('0x91')](_0x58de8a)){if(_0x34f5ab[_0x58de8a]&&_[_0xfbec('0x92')](_0x34f5ab[_0x58de8a])){if(_[_0xfbec('0x64')](recursiveMapAttributes,_0x58de8a)){_0x34f5ab[_0x58de8a]=this['replaceObjectAllVariables'](_0x34f5ab[_0x58de8a]);}else{_0x34f5ab[_0x58de8a]=this[_0xfbec('0x93')](_0x34f5ab[_0x58de8a]);}}}}return _0x34f5ab;};AGIVertices[_0xfbec('0xf')][_0xfbec('0x94')]=function(_0x75d152){for(var _0xf45f62 in _0x75d152){if(_0x75d152[_0xfbec('0x91')](_0xf45f62)){if(_[_0xfbec('0x95')](_0x75d152[_0xf45f62])){this[_0xfbec('0x94')](_0x75d152[_0xf45f62]);}else if(_[_0xfbec('0x96')](_0x75d152[_0xf45f62])){for(var _0x48aa4a=0x0;_0x48aa4a<_0x75d152[_0xf45f62][_0xfbec('0x97')];_0x48aa4a++){this[_0xfbec('0x94')](_0x75d152[_0xf45f62][_0x48aa4a]);}}else if(_[_0xfbec('0x92')](_0x75d152[_0xf45f62])){_0x75d152[_0xf45f62]=this['replaceAllVariables'](_0x75d152[_0xf45f62]);}}}};AGIVertices[_0xfbec('0xf')][_0xfbec('0x98')]=function(_0x329887,_0x57f234){for(var _0xed4037 in _0x329887){if(_0x329887[_0xfbec('0x91')](_0xed4037)){if(_['isPlainObject'](_0x329887[_0xed4037])){if(!_[_0xfbec('0x41')](_0x329887[_0xed4037])){this[_0xfbec('0x98')](_0x329887[_0xed4037],util[_0xfbec('0x27')](_0xfbec('0x99'),_0x57f234,_0xed4037));}}else if(_[_0xfbec('0x96')](_0x329887[_0xed4037])){for(var _0x4655e5=0x0;_0x4655e5<_0x329887[_0xed4037]['length'];_0x4655e5++){this[_0xfbec('0x98')](_0x329887[_0xed4037][_0x4655e5],util[_0xfbec('0x27')](_0xfbec('0x99'),_0x57f234,_0xed4037+'['+_0x4655e5+']'));}}else{if(!_[_0xfbec('0x42')](_0x329887[_0xed4037])){this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0x99'),_0x57f234,_0xed4037),_0x329887[_0xed4037]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x311d71){try{var _0x3e2788=JSON[_0xfbec('0x65')](_0x311d71);this[_0xfbec('0x94')](_0x3e2788);return JSON[_0xfbec('0x6e')](_0x3e2788);}catch(_0xf75ced){return this[_0xfbec('0x93')](_0x311d71);}};AGIVertices[_0xfbec('0xf')][_0xfbec('0x93')]=function(_0x3e4c53){var _0x29a6a1=_0x3e4c53[_0xfbec('0x9b')]('{');for(var _0x24750e=0x1;_0x24750e<_0x29a6a1[_0xfbec('0x97')];_0x24750e+=0x1){var _0x557748=_0x29a6a1[_0x24750e][_0xfbec('0x9b')]('}');if(_0x557748['length']>0x1){_0x3e4c53=_0x3e4c53['replaceAll']('{'+_0x557748[0x0]+'}',this[_0xfbec('0x34')][_0xfbec('0x10')](_0x557748[0x0])['extra']||_0x557748[0x0]);}}if(_0x29a6a1[_0xfbec('0x97')]===0x1){return _0x3e4c53[_0xfbec('0x4a')]();}return this[_0xfbec('0x93')](_0x3e4c53);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x9c')]=function(_0x4f5021,_0x55a665){var _0x121ddf=this[_0xfbec('0x34')][_0xfbec('0x10')](_0x4f5021);if(_0x121ddf[_0xfbec('0x9d')]===-0x1){return _0x121ddf;}logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x9e'),_0x55a665,_0x121ddf[_0xfbec('0x9f')]));return this['channel'][_0xfbec('0x9a')](_0x55a665,_0x121ddf[_0xfbec('0x9f')]);};AGIVertices[_0xfbec('0xf')]['isConfigured']=function(_0x14fc6f){return _0x14fc6f&&_0x14fc6f!=='0'&&_0x14fc6f!=='-1'&&_0x14fc6f!=='';};AGIVertices[_0xfbec('0xf')]['maxRetry']=function(_0x3fc965){this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x3fc965,'-');_0x3fc965['retry']=_0x3fc965[_0xfbec('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfbec('0xf')][_0xfbec('0xa1')]=function(_0x49b2a2){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0xa2'),_0x49b2a2['label']));if(!this[_0xfbec('0x83')](_0x49b2a2['text'])){return this['channel']['noop']('no\x20text\x20configured');}var _0x294d92='\x22'+_0x49b2a2[_0xfbec('0x59')]+'\x22';if(this[_0xfbec('0x83')](_0x49b2a2[_0xfbec('0x74')])){_0x294d92+=','+_0x49b2a2[_0xfbec('0x74')];}var _0x155d9b=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0xfbec('0xa4'),_0x294d92);if(_0x155d9b[_0xfbec('0x9d')]===-0x1){return _0x155d9b;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xa6'),_0x294d92));};AGIVertices['prototype']['mrcprecog']=function(_0x2b79db){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0xa7'),_0x2b79db[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x2b79db[_0xfbec('0xa8')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20grammar\x20configured');}var _0x41ef7a=_0x2b79db[_0xfbec('0xa8')];if(this[_0xfbec('0x83')](_0x2b79db['options'])){_0x41ef7a+=','+_0x2b79db['options'];}var _0x25cf73=this[_0xfbec('0x34')]['exec'](_0xfbec('0xa9'),_0x41ef7a);if(_0x25cf73[_0xfbec('0x9d')]===-0x1){return _0x25cf73;}var _0x36b69b=this[_0xfbec('0x9c')]('RECOG_CONFIDENCE()',_0xfbec('0xaa'));if(_0x36b69b[_0xfbec('0x9d')]===-0x1){return _0x36b69b;}var _0x4efefb=this['getAndSetVariable']('RECOG_INPUT()',_0xfbec('0xab'));if(_0x4efefb[_0xfbec('0x9d')]===-0x1){return _0x4efefb;}var _0x498c92=this[_0xfbec('0x9c')](_0xfbec('0xac'),'MRCP_RECOG_INSTANCE');if(_0x498c92[_0xfbec('0x9d')]===-0x1){return _0x498c92;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xad'),_0x41ef7a));};AGIVertices[_0xfbec('0xf')]['agi']=function(_0x4b70d0){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0xae'),_0x4b70d0[_0xfbec('0x35')]));return this[_0xfbec('0x34')][_0xfbec('0x6')]([_0x4b70d0['command'],_0x4b70d0[_0xfbec('0xaf')]]);};AGIVertices[_0xfbec('0xf')]['answer']=function(_0x5ae370){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0xb0'),_0x5ae370['label']));if(this[_0xfbec('0x83')](_0x5ae370[_0xfbec('0x62')])){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0xb1'),_0x5ae370['timeout']));var _0x29553d=this['channel'][_0xfbec('0xb2')](_0x5ae370[_0xfbec('0x62')]);if(_0x29553d[_0xfbec('0x9d')]===-0x1){return _0x29553d;}}return this[_0xfbec('0x34')][_0xfbec('0xb3')]();};AGIVertices[_0xfbec('0xf')]['callback']=function(_0x36c116){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0xb4'),_0x36c116[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x36c116[_0xfbec('0x46')])){return this[_0xfbec('0x34')]['error'](_0x36c116,_0xfbec('0xb5'));}_0x36c116[_0xfbec('0x47')]=moment();if(this[_0xfbec('0x83')](_0x36c116[_0xfbec('0xb6')])){_0x36c116[_0xfbec('0x47')]=moment()[_0xfbec('0xb7')](_0x36c116['delay'],'minutes');}if(!this['isConfigured'](_0x36c116[_0xfbec('0x4b')])){_0x36c116[_0xfbec('0x4b')]=0x2;}this[_0xfbec('0x40')][_0xfbec('0x69')](this,_0x36c116);return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xb8'),_0x36c116['phone'],_0x36c116[_0xfbec('0x46')],_0x36c116[_0xfbec('0x47')]));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xb9')]=function(_0x412239){logger['info'](util[_0xfbec('0x27')](_0xfbec('0xba'),_0x412239[_0xfbec('0x35')]));var _0x70f5f1=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0x412239[_0xfbec('0xbb')],_0x412239['options']);if(_0x70f5f1['result']===-0x1){return _0x70f5f1;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format']('Executed\x20command\x20%s\x20%s',_0x412239[_0xfbec('0xbb')],_0x412239[_0xfbec('0x74')]));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xbc')]=function(_0x3fdcc4){logger['info'](util['format'](_0xfbec('0xbd'),_0x3fdcc4['label']));if(!this[_0xfbec('0x83')](_0x3fdcc4[_0xfbec('0x59')])){return this['channel'][_0xfbec('0xa5')](_0xfbec('0xbe'));}var _0x2931fc='\x22'+_0x3fdcc4[_0xfbec('0x59')]+'\x22';if(this[_0xfbec('0x83')](_0x3fdcc4[_0xfbec('0x74')])){_0x2931fc+=','+_0x3fdcc4[_0xfbec('0x74')];}var _0xf2ffe2=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0xfbec('0xa4'),_0x2931fc);if(_0xf2ffe2[_0xfbec('0x9d')]===-0x1){return _0xf2ffe2;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format'](_0xfbec('0xa6'),_0x2931fc));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xbf')]=function(_0xaedd6b){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0xc0'),_0xaedd6b[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0xaedd6b['text'])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xbe'));}var _0x4ef5c8='\x22'+_0xaedd6b[_0xfbec('0x59')]+'\x22';if(this[_0xfbec('0x83')](_0xaedd6b[_0xfbec('0x74')])){_0x4ef5c8+=','+_0xaedd6b[_0xfbec('0x74')];}var _0x42b220=this[_0xfbec('0x34')][_0xfbec('0xa3')]('MRCPSynth',_0x4ef5c8);if(_0x42b220[_0xfbec('0x9d')]===-0x1){return _0x42b220;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format'](_0xfbec('0xa6'),_0x4ef5c8));};AGIVertices['prototype'][_0xfbec('0xc1')]=function(_0x11c222){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x11c222[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x11c222[_0xfbec('0xa8')])){return this['channel']['noop'](_0xfbec('0xc2'));}var _0x1f7566=_0x11c222['grammar'];if(this['isConfigured'](_0x11c222[_0xfbec('0x74')])){_0x1f7566+=','+_0x11c222['options'];}var _0x48ae48=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0xfbec('0xa9'),_0x1f7566);if(_0x48ae48[_0xfbec('0x9d')]===-0x1){return _0x48ae48;}var _0x2c9971=this[_0xfbec('0x9c')](_0xfbec('0xc3'),_0xfbec('0xc4'));if(_0x2c9971[_0xfbec('0x9d')]===-0x1){return _0x2c9971;}var _0x114905=this[_0xfbec('0x9c')](_0xfbec('0xc5'),_0xfbec('0xc6'));if(_0x114905['result']===-0x1){return _0x114905;}var _0x223b0f=this[_0xfbec('0x9c')]('RECOG_INSTANCE()',_0xfbec('0xc7'));if(_0x223b0f['result']===-0x1){return _0x223b0f;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1f7566));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xc8')]=function(_0x2eba26){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0xc9'),_0x2eba26[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x2eba26[_0xfbec('0xa8')])){return this['channel'][_0xfbec('0xa5')](_0xfbec('0xc2'));}var _0x5a866c=_0x2eba26[_0xfbec('0xa8')];if(this['isConfigured'](_0x2eba26[_0xfbec('0x74')])){_0x5a866c+=','+_0x2eba26[_0xfbec('0x74')];}var _0x57bd46=this[_0xfbec('0x34')][_0xfbec('0xa3')]('MRCPRecog',_0x5a866c);if(_0x57bd46[_0xfbec('0x9d')]===-0x1){return _0x57bd46;}var _0x2e4a29=this['getAndSetVariable'](_0xfbec('0xc3'),'SESTEK_ASR_CONFIDENCE');if(_0x2e4a29[_0xfbec('0x9d')]===-0x1){return _0x2e4a29;}var _0x5e75c7=this[_0xfbec('0x9c')]('RECOG_INPUT()',_0xfbec('0xca'));if(_0x5e75c7[_0xfbec('0x9d')]===-0x1){return _0x5e75c7;}var _0x37a465=this[_0xfbec('0x9c')](_0xfbec('0xac'),_0xfbec('0xcb'));if(_0x37a465[_0xfbec('0x9d')]===-0x1){return _0x37a465;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xad'),_0x5a866c));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xcc')]=function(_0x2dc9d2){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0xcd'),_0x2dc9d2[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x2dc9d2[_0xfbec('0xce')])){return this['channel']['error'](_0x2dc9d2,_0xfbec('0xcf'));}var _0x2048b4=this[_0xfbec('0x17')][_0xfbec('0x69')](this,_0x2dc9d2[_0xfbec('0xce')]);if(!_0x2048b4){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x2dc9d2,_0xfbec('0xd0'));}if(!this[_0xfbec('0x83')](_0x2dc9d2['query'])){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x2dc9d2,'no\x20query\x20configured');}var _0x144ae5=_0x2dc9d2[_0xfbec('0xd1')][_0xfbec('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xd2'),_0x144ae5));var _0x598f9a=this['getQueryOdbc'][_0xfbec('0x69')](this,_0x2048b4,_0x144ae5);this['createSquareDetailsReport'][_0xfbec('0x69')](this,_0x2dc9d2,_0x144ae5);if(!this[_0xfbec('0x83')](_0x2dc9d2[_0xfbec('0xd3')])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xd4'));}var _0x4e7e6e=this[_0xfbec('0x10')][_0xfbec('0x69')](this,_0x2dc9d2[_0xfbec('0xd3')]);if(!_0x4e7e6e){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x2dc9d2,_0xfbec('0xd5'));}var _0x50a535=this;_0x598f9a[_0xfbec('0xd6')](function(_0x4ba450,_0x35ccdc){Object[_0xfbec('0xd7')](_0x4ba450)[_0xfbec('0xd6')](function(_0x528844){_0x50a535[_0xfbec('0x34')][_0xfbec('0x9a')](util['format'](_0xfbec('0xd8'),_0x4e7e6e,_0x35ccdc,_0x528844),_0x4ba450[_0x528844]);});});this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0xd9'),_0x4e7e6e),_0x598f9a[_0xfbec('0x97')]);return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xda'),_0x4e7e6e));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xdb')]=function(_0x1faaaf){logger[_0xfbec('0xdc')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1faaaf[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x1faaaf[_0xfbec('0xdd')])){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x1faaaf,_0xfbec('0xde'));}var _0x1a9e10=this['getUser'][_0xfbec('0x69')](this,_0x1faaaf[_0xfbec('0xdd')]);if(!_0x1a9e10){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x1faaaf,'no\x20user\x20found');}var _0x2c7bf1=this['channel'][_0xfbec('0xa3')](_0xfbec('0xdf'),[util[_0xfbec('0x27')]('SIP/%s',_0x1a9e10),_0x1faaaf['timeout'],_0x1faaaf['opts'],_0x1faaaf[_0xfbec('0x6b')]]);if(_0x2c7bf1[_0xfbec('0x9d')]===-0x1){return _0x2c7bf1;}return this[_0xfbec('0x34')]['noop'](util['format'](_0xfbec('0xe0'),'DIAL'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xe1')]=function(_0x34d0d2){logger['info'](util[_0xfbec('0x27')](_0xfbec('0xe2'),_0x34d0d2[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x34d0d2[_0xfbec('0x76')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xe3'));}if(!this[_0xfbec('0x83')](_0x34d0d2[_0xfbec('0x59')])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xbe'));}this[_0xfbec('0x34')][_0xfbec('0xe4')]=!![];this[_0xfbec('0x33')](_0x34d0d2);this[_0xfbec('0x3f')](_0x34d0d2[_0xfbec('0x59')],'in','','');this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xe5'),_0x34d0d2['text']));var _0x4db5f2=this['googleDialogflow'][_0xfbec('0x69')](this,_0x34d0d2);if(_0x4db5f2){for(var _0x282db2 in _0x4db5f2){if(_0x4db5f2['hasOwnProperty'](_0x282db2)){this[_0xfbec('0x34')][_0xfbec('0x9a')](util['format'](_0xfbec('0xe6'),_0x282db2[_0xfbec('0xe7')]()),_0x4db5f2[_0x282db2]);}}this[_0xfbec('0x3f')](_0x4db5f2['speech'],_0xfbec('0xe8'),_0xfbec('0xe1'),'');return this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xe9'),_0x4db5f2[_0xfbec('0xea')]));}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x34d0d2,_0xfbec('0xeb'));};AGIVertices['prototype'][_0xfbec('0xec')]=function(_0xc86f57){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0xed'),_0xc86f57[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0xc86f57['dialogflowV2_project_id'])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0xc86f57['client_email'])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xee'));}if(!this[_0xfbec('0x83')](_0xc86f57['private_key'])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xef'));}if(!this[_0xfbec('0x83')](_0xc86f57[_0xfbec('0xf0')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xf1'));}if(!this[_0xfbec('0x83')](_0xc86f57[_0xfbec('0x59')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xbe'));}this[_0xfbec('0x34')][_0xfbec('0xe4')]=!![];this[_0xfbec('0x33')](_0xc86f57);this[_0xfbec('0x3f')](_0xc86f57[_0xfbec('0x59')],'in','','');this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')]('Trying\x20DialogflowV2:\x20%s',_0xc86f57['text']));var _0x13eabc=this[_0xfbec('0x78')][_0xfbec('0x69')](this,_0xc86f57);if(_0x13eabc){for(var _0x3cd9a2 in _0x13eabc){if(_0x13eabc[_0xfbec('0x91')](_0x3cd9a2)){if(_0x3cd9a2!==_0xfbec('0xf2')){this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')]('DIALOGFLOW_%s',_0x3cd9a2['toUpperCase']()),_0x13eabc[_0x3cd9a2]);}}}this[_0xfbec('0x3f')](_0x13eabc[_0xfbec('0xea')],_0xfbec('0xe8'),'dialogflowV2',_0x13eabc['providerResponse']);return this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format']('DialogflowV2\x20Result\x20%s',_0x13eabc[_0xfbec('0xea')]));}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0xc86f57,_0xfbec('0xf3'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xf4')]=function(_0x1a0d03){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1a0d03[_0xfbec('0x35')]));if(!this['isConfigured'](_0x1a0d03[_0xfbec('0xf5')])){return this['channel'][_0xfbec('0xa5')](_0xfbec('0xf6'));}if(!this[_0xfbec('0x83')](_0x1a0d03['username'])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20username\x20configured');}if(!this[_0xfbec('0x83')](_0x1a0d03[_0xfbec('0xf7')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xf8'));}if(!this[_0xfbec('0x83')](_0x1a0d03[_0xfbec('0xf9')])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xbe'));}this[_0xfbec('0x34')][_0xfbec('0xe4')]=!![];this[_0xfbec('0x33')](_0x1a0d03);this[_0xfbec('0x3f')](_0x1a0d03[_0xfbec('0x59')],'in','','');this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xfa'),_0x1a0d03[_0xfbec('0x59')]));var _0x54a012=this[_0xfbec('0x7c')][_0xfbec('0x69')](this,_0x1a0d03);if(_0x54a012){for(var _0x1381c0 in _0x54a012){if(_0x54a012['hasOwnProperty'](_0x1381c0)){this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')]('SESTEK_NDA_%s',_0x1381c0[_0xfbec('0xe7')]()),_0x54a012[_0x1381c0]);}}this[_0xfbec('0x3f')](_0x54a012['speech'],_0xfbec('0xe8'),_0xfbec('0xf4'),'');if(_0x54a012[_0xfbec('0xfb')]){this[_0xfbec('0x34')]['noop'](util['format'](_0xfbec('0xfc'),_0x54a012[_0xfbec('0xfb')]));var _0x353307=this[_0xfbec('0x34')][_0xfbec('0xfd')](_0x54a012['audiofile']);try{fs[_0xfbec('0xfe')](_0x54a012[_0xfbec('0xfb')]+'.wav');}catch(_0x514299){logger[_0xfbec('0x2b')](_0x514299);}return _0x353307;}else{return this['channel']['noop'](util[_0xfbec('0x27')](_0xfbec('0xff'),_0x54a012[_0xfbec('0xea')]));}}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x1a0d03,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xfbec('0xf')]['end']=function(_0xc7613e){logger['info'](util[_0xfbec('0x27')](_0xfbec('0x100'),_0xc7613e[_0xfbec('0x35')]));return this[_0xfbec('0x34')]['noop'](_0xfbec('0x101'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x102')]=function(_0x48b4f8){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x103'),_0x48b4f8[_0xfbec('0x35')]));var _0x408c1d='';if(_0x48b4f8[_0xfbec('0x104')]){if(!this[_0xfbec('0x83')](_0x48b4f8[_0xfbec('0x104')])){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x48b4f8,_0xfbec('0x105'));}else{var _0x37c42f=parseInt(_0x48b4f8[_0xfbec('0x104')],0xa);if(isNaN(_0x37c42f)){_0x408c1d=_0x48b4f8[_0xfbec('0x104')];}else{_0x408c1d=this[_0xfbec('0x1b')][_0xfbec('0x69')](this,_0x48b4f8[_0xfbec('0x104')]);if(!_0x408c1d){return this[_0xfbec('0x34')]['error'](_0x48b4f8,_0xfbec('0x106'));}}}}else if(_0x48b4f8['trunk_name']){_0x408c1d=_0x48b4f8[_0xfbec('0x107')];}else{return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x48b4f8,_0xfbec('0x105'));}var _0x1801ed=this[_0xfbec('0x34')]['exec'](_0xfbec('0xdf'),[util[_0xfbec('0x27')](_0xfbec('0x108'),_0x408c1d,_0x48b4f8[_0xfbec('0x109')]),_0x48b4f8[_0xfbec('0x62')],_0x48b4f8['opts'],_0x48b4f8[_0xfbec('0x6b')]]);if(_0x1801ed['result']===-0x1){return _0x1801ed;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0xe0'),'DIAL'));};AGIVertices['prototype'][_0xfbec('0x10a')]=function(_0x21c8db){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x10b'),_0x21c8db[_0xfbec('0x35')]));return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x10a'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0xd')]=function(_0x1d8ecd){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1d8ecd[_0xfbec('0x35')]));if(_0x1d8ecd[_0xfbec('0x10c')]===0x0){return this['maxRetry'](_0x1d8ecd);}_0x1d8ecd[_0xfbec('0x10c')]-=0x1;if(!this[_0xfbec('0x83')](_0x1d8ecd[_0xfbec('0x10d')])){return this['channel'][_0xfbec('0x2b')](_0x1d8ecd,'no\x20file\x20audio\x20selected');}var _0xbba849=this[_0xfbec('0x10e')][_0xfbec('0x69')](this,_0x1d8ecd[_0xfbec('0x10d')]);if(!_0xbba849){return this[_0xfbec('0x34')]['error'](_0x1d8ecd,_0xfbec('0x10f'));}if(!this['isConfigured'](_0x1d8ecd[_0xfbec('0xd3')])){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0xfbec('0xd4'));}var _0x1abfb3=this['channel'][_0xfbec('0x110')](_0xbba849,_0x1d8ecd[_0xfbec('0x111')],_0x1d8ecd[_0xfbec('0x112')]);var _0x260b27=_0x1abfb3[_0xfbec('0x9d')]?_0x1abfb3['result']['toString']():'';logger[_0xfbec('0x2c')](_0xfbec('0x113'),JSON[_0xfbec('0x6e')](_0x1abfb3));if(_0x1abfb3[_0xfbec('0x9d')]===-0x1){this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x1d8ecd,_0x260b27);return _0x1abfb3;}else if(_0x1abfb3[_0xfbec('0x9f')]===_0xfbec('0x62')){_0x1abfb3[_0xfbec('0x9d')]=_0x260b27[_0xfbec('0x97')]>=parseInt(_0x1d8ecd[_0xfbec('0x114')])?'x':'i';}else{_0x1abfb3[_0xfbec('0x9d')]=_0x260b27['length']>=parseInt(_0x1d8ecd['mindigit'])&&_0x260b27[_0xfbec('0x97')]<=parseInt(_0x1d8ecd[_0xfbec('0x112')])?'x':'i';}var _0x115367=this['getVariable'][_0xfbec('0x69')](this,_0x1d8ecd['variable_id']);if(!_0x115367){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x1d8ecd,'no\x20variable\x20found');}this['channel'][_0xfbec('0x9a')](_0x115367,_0x260b27);if(this[_0xfbec('0x83')](_0x1d8ecd[_0xfbec('0x115')])){var _0x36d6cb=parseInt(_0x1d8ecd['hiddendigitsnum'],0xa);var _0x46f843=rs[_0xfbec('0x116')]({'charset':'*','length':_0x36d6cb});var _0x5033c2=_0x260b27[_0xfbec('0x97')];if(_0x5033c2>0x0){if(_0x5033c2>_0x36d6cb){this[_0xfbec('0x33')]['sync'](this,_0x1d8ecd,_0x1d8ecd[_0xfbec('0x117')]===_0xfbec('0x118')?_0x46f843+_0x260b27[_0xfbec('0x119')](_0x36d6cb):_0x260b27[_0xfbec('0x119')](0x0,_0x5033c2-_0x36d6cb)+_0x46f843);}else{this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x1d8ecd,rs['generate']({'charset':'*','length':_0x5033c2}));}}else{this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x1d8ecd,'');}}else{this[_0xfbec('0x33')]['sync'](this,_0x1d8ecd,_0x260b27);}return _0x1abfb3;};AGIVertices[_0xfbec('0xf')][_0xfbec('0xe')]=function(_0x4a649e){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x11a'),_0x4a649e[_0xfbec('0x35')]));return this[_0xfbec('0xd')](_0x4a649e);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x11b')]=function(_0x36d655){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x36d655[_0xfbec('0x35')]));this[_0xfbec('0x33')]['sync'](this,_0x36d655,_0x36d655['goalname']);return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x11c'),_0x36d655['goalname']));};AGIVertices[_0xfbec('0xf')]['awspolly']=function(_0x5dc1d3){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x11d'),_0x5dc1d3[_0xfbec('0x35')]));if(!this['isConfigured'](_0x5dc1d3[_0xfbec('0x86')])||!this['isConfigured'](_0x5dc1d3[_0xfbec('0x87')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5dc1d3[_0xfbec('0x59')])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xbe'));}this['channel']['noop'](util[_0xfbec('0x27')](_0xfbec('0x11e'),_0x5dc1d3[_0xfbec('0x59')]));var _0x1db5a3=this[_0xfbec('0x85')][_0xfbec('0x69')](this,_0x5dc1d3);if(_0x1db5a3){this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x1db5a3));var _0x220af9=this['channel'][_0xfbec('0xfd')](_0x1db5a3);try{fs['unlink'](_0x1db5a3+'.wav');}catch(_0x192bf0){logger[_0xfbec('0x2b')](_0x192bf0);}return _0x220af9;}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x5dc1d3,_0xfbec('0x11f'));};AGIVertices['prototype'][_0xfbec('0x120')]=function(_0xeef111){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x121'),_0xeef111[_0xfbec('0x35')]));if(!this['isConfigured'](_0xeef111[_0xfbec('0x86')])||!this[_0xfbec('0x83')](_0xeef111[_0xfbec('0x87')])){return this['channel'][_0xfbec('0xa5')](_0xfbec('0x122'));}if(!this[_0xfbec('0x83')](_0xeef111[_0xfbec('0x123')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20bot\x20name\x20configured');}if(!this[_0xfbec('0x83')](_0xeef111[_0xfbec('0x59')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20text\x20configured');}this[_0xfbec('0x34')]['bot']=!![];this[_0xfbec('0x33')](_0xeef111);this[_0xfbec('0x3f')](_0xeef111[_0xfbec('0x59')],'in','','');this[_0xfbec('0x34')]['noop'](util[_0xfbec('0x27')](_0xfbec('0x124'),_0xeef111[_0xfbec('0x59')]));var _0x4b85e4=this[_0xfbec('0x8b')][_0xfbec('0x69')](this,_0xeef111);if(_0x4b85e4){for(var _0x4ab630 in _0x4b85e4){if(_0x4b85e4[_0xfbec('0x91')](_0x4ab630)&&_[_0xfbec('0x92')](_0x4b85e4[_0x4ab630])){this['channel']['setVariable'](util[_0xfbec('0x27')](_0xfbec('0x125'),_0x4ab630[_0xfbec('0xe7')]()),_0x4b85e4[_0x4ab630]);}}if(_[_0xfbec('0x42')](_0x4b85e4[_0xfbec('0x72')])){return this['channel'][_0xfbec('0xa5')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xfbec('0x3f')](_0x4b85e4['message'],_0xfbec('0xe8'),_0xfbec('0x126'),'');return this['channel'][_0xfbec('0xa5')](util['format'](_0xfbec('0x127'),_0x4b85e4['message']));}}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0xeef111,_0xfbec('0x128'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x129')]=function(_0x55465c){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x12a'),_0x55465c['label'],_0x55465c[_0xfbec('0x62')]));if(!this['isConfigured'](_0x55465c['key'])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20key\x20configured');}var _0x24933d=_0xfbec('0x12b');var _0xb8404e=util[_0xfbec('0x27')](_0xfbec('0x12c'),FILES_PATH,rs[_0xfbec('0x116')](0x4));var _0x4a67b0=util[_0xfbec('0x27')](_0xfbec('0x99'),_0xb8404e,_0x24933d);var _0x273111=!![];if(_0x55465c[_0xfbec('0x12d')]===_0xfbec('0x12e')){_0x273111=![];}var _0x156992=this[_0xfbec('0x34')]['recordFile'](_0xb8404e,_0x24933d,_0x55465c[_0xfbec('0x12f')],_0x55465c[_0xfbec('0x62')],undefined,_0x273111);if(_0x156992['result']!==-0x1){this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format'](_0xfbec('0x130'),_0x4a67b0));var _0x496b66=this[_0xfbec('0x8d')][_0xfbec('0x69')](this,_0x55465c,_0x4a67b0);if(_0x496b66){for(var _0x2efa4d in _0x496b66){if(_0x496b66[_0xfbec('0x91')](_0x2efa4d)){this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0x131'),_0x2efa4d[_0xfbec('0xe7')]()),_0x496b66[_0x2efa4d]);}}return this[_0xfbec('0x34')]['noop'](util['format'](_0xfbec('0x132'),JSON[_0xfbec('0x6e')](_0x496b66)));}}return _0x156992;};AGIVertices[_0xfbec('0xf')][_0xfbec('0x133')]=function(_0x4ee7c7){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x134'),_0x4ee7c7[_0xfbec('0x35')]));if(!this['isConfigured'](_0x4ee7c7[_0xfbec('0x135')])){return this['channel']['noop'](_0xfbec('0x136'));}if(!this[_0xfbec('0x83')](_0x4ee7c7[_0xfbec('0x137')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20appsecret\x20configured');}var _0x4f890f='wav';var _0x2d2098=util[_0xfbec('0x27')](_0xfbec('0x12c'),FILES_PATH,rs['generate'](0x4));var _0xaa83e2=util[_0xfbec('0x27')](_0xfbec('0x99'),_0x2d2098,_0x4f890f);var _0x43e0ed=!![];if(_0x4ee7c7[_0xfbec('0x12d')]===_0xfbec('0x12e')){_0x43e0ed=![];}var _0x3837e1=this[_0xfbec('0x34')]['recordFile'](_0x2d2098,_0x4f890f,_0x4ee7c7[_0xfbec('0x12f')],_0x4ee7c7[_0xfbec('0x62')],undefined,_0x43e0ed);if(_0x3837e1[_0xfbec('0x9d')]!==-0x1){this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x138'),_0xaa83e2));var _0x502b0d=this[_0xfbec('0x8e')][_0xfbec('0x69')](this,_0x4ee7c7,_0xaa83e2);if(_0x502b0d){for(var _0x5f3092 in _0x502b0d){if(_0x502b0d[_0xfbec('0x91')](_0x5f3092)){this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0x139'),_0x5f3092[_0xfbec('0xe7')]()),_0x502b0d[_0x5f3092]);}}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format'](_0xfbec('0x13a'),JSON[_0xfbec('0x6e')](_0x502b0d)));}}return _0x3837e1;};AGIVertices[_0xfbec('0xf')][_0xfbec('0x13b')]=function(_0x5b05b2){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x13c'),_0x5b05b2[_0xfbec('0x35')]));return this[_0xfbec('0x34')]['continueAt'](_0x5b05b2['context'],_0x5b05b2[_0xfbec('0x13d')],_0x5b05b2['priority']);};AGIVertices[_0xfbec('0xf')]['gotoif']=function(_0x290f2c){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0x13e'),_0x290f2c['label']));if(!this[_0xfbec('0x83')](_0x290f2c[_0xfbec('0x13f')])){return this[_0xfbec('0x34')]['error'](_0x290f2c,_0xfbec('0x140'));}try{var _0x10cceb=eval(_0x290f2c['condition'])?_0xfbec('0x141'):_0xfbec('0x142');this[_0xfbec('0x34')]['noop'](util[_0xfbec('0x27')](_0xfbec('0x143'),_0x290f2c['condition'],_0x10cceb));return{'code':0xc8,'result':_0x10cceb};}catch(_0x591d52){return{'code':0xc8,'result':_0xfbec('0x142')};}};AGIVertices['prototype'][_0xfbec('0x144')]=function(_0x40045f){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x145'),_0x40045f['label']));if(!this[_0xfbec('0x83')](_0x40045f[_0xfbec('0x146')])){return this['channel'][_0xfbec('0x2b')](_0x40045f,'no\x20interval\x20configured');}var _0x264fae=this[_0xfbec('0x22')]['sync'](this,_0x40045f[_0xfbec('0x146')]);if(!_0x264fae){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x40045f,'no\x20intervals\x20found');}for(var _0x45a087=0x0;_0x45a087<_0x264fae[_0xfbec('0x97')];_0x45a087+=0x1){var _0xd22947=this[_0xfbec('0x34')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x264fae[_0x45a087]));if(_0xd22947['result']===-0x1){return _0xd22947;}logger[_0xfbec('0x2c')](util['format'](_0xfbec('0x147'),_0x264fae[_0x45a087],_0xd22947[_0xfbec('0x9f')]));if(_0xd22947[_0xfbec('0x9f')]==='true'){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x147'),_0x264fae[_0x45a087],_0xfbec('0x141')));this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')]('IFTIME\x20%s\x20%s',_0x264fae[_0x45a087],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xfbec('0x2c')](util['format'](_0xfbec('0x147'),_0x264fae[_0x45a087],_0xfbec('0x142')));this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x147'),_0x264fae[_0x45a087],_0xfbec('0x142')));}}return{'code':0xc8,'result':_0xfbec('0x142')};};AGIVertices[_0xfbec('0xf')][_0xfbec('0x148')]=function(_0x587f83){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x149'),_0x587f83[_0xfbec('0x35')]));return this[_0xfbec('0x34')]['hangup']();};AGIVertices[_0xfbec('0xf')][_0xfbec('0x14a')]=function(_0x42fee9){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x42fee9['label']));if(!this[_0xfbec('0x83')](_0x42fee9[_0xfbec('0x76')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xe3'));}var _0x17ce2b='wav';var _0x38403b=util[_0xfbec('0x27')](_0xfbec('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x2630ba=util[_0xfbec('0x27')](_0xfbec('0x99'),_0x38403b,_0x17ce2b);var _0x89a6b7=!![];if(_0x42fee9[_0xfbec('0x12d')]===_0xfbec('0x12e')){_0x89a6b7=![];}var _0x16727b=this['channel'][_0xfbec('0x14b')](_0x38403b,_0x17ce2b,_0x42fee9[_0xfbec('0x12f')],_0x42fee9['timeout'],undefined,_0x89a6b7);if(_0x16727b[_0xfbec('0x9d')]!==-0x1){this[_0xfbec('0x34')]['noop'](util['format'](_0xfbec('0x14c'),_0x2630ba));var _0x5b8e97=this[_0xfbec('0x81')][_0xfbec('0x69')](this,_0x42fee9,_0x2630ba);if(_0x5b8e97){for(var _0xee5c93 in _0x5b8e97){if(_0x5b8e97[_0xfbec('0x91')](_0xee5c93)){this[_0xfbec('0x34')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0xee5c93[_0xfbec('0xe7')]()),_0x5b8e97[_0xee5c93]);}}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x14d'),JSON[_0xfbec('0x6e')](_0x5b8e97)));}}return _0x16727b;};AGIVertices[_0xfbec('0xf')]['ispeechtts']=function(_0x5a2372){logger['info'](util['format'](_0xfbec('0x14e'),_0x5a2372[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x5a2372[_0xfbec('0x76')])){return this['channel'][_0xfbec('0xa5')](_0xfbec('0xe3'));}if(!this[_0xfbec('0x83')](_0x5a2372[_0xfbec('0x59')])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xbe'));}this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x14f'),_0x5a2372[_0xfbec('0x59')]));var _0xd9d6ae=this[_0xfbec('0x7d')][_0xfbec('0x69')](this,_0x5a2372);if(_0xd9d6ae){this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x14c'),_0xd9d6ae));var _0x583afe=this['channel'][_0xfbec('0xfd')](_0xd9d6ae,_0x5a2372['intKey']);try{fs[_0xfbec('0xfe')](_0xd9d6ae+_0xfbec('0x150'));}catch(_0x57f096){logger[_0xfbec('0x2b')](_0x57f096);}return _0x583afe;}return this[_0xfbec('0x34')]['error'](_0x5a2372,_0xfbec('0x151'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x152')]=function(_0x42b0c2){logger[_0xfbec('0x2c')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x42b0c2[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x42b0c2['findBy'])){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x42b0c2,'no\x20find\x20by\x20configured');}logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x153'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x42b0c2[_0xfbec('0x154')]));var _0x26e5c4=this['agentLogin'][_0xfbec('0x69')](this,_0x42b0c2[_0xfbec('0x154')]);if(_0x26e5c4){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x155'),this['channel'][_0xfbec('0x36')],_0x42b0c2[_0xfbec('0x154')]));this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x155'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x42b0c2[_0xfbec('0x154')]));return{'code':0xc8,'result':_0xfbec('0x156')};}else{logger['info'](util[_0xfbec('0x27')](_0xfbec('0x157'),this['channel'][_0xfbec('0x36')],_0x42b0c2[_0xfbec('0x154')]));this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfbec('0x34')]['callerid'],_0x42b0c2[_0xfbec('0x154')]));return{'code':0xc8,'result':_0xfbec('0x158')};}};AGIVertices[_0xfbec('0xf')][_0xfbec('0x159')]=function(_0x43451d){logger['info'](util[_0xfbec('0x27')](_0xfbec('0x15a'),_0x43451d[_0xfbec('0x35')]));if(!this['isConfigured'](_0x43451d['findBy'])){return this['channel'][_0xfbec('0x2b')](_0x43451d,_0xfbec('0x15b'));}logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x153'),this[_0xfbec('0x34')]['callerid'],_0x43451d['findBy']));var _0x4aec75=this[_0xfbec('0x50')][_0xfbec('0x69')](this,_0x43451d['findBy']);if(_0x4aec75){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfbec('0x34')][_0xfbec('0x36')],_0x43451d[_0xfbec('0x154')]));this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x155'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x43451d['findBy']));return{'code':0xc8,'result':_0xfbec('0x156')};}else{logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x157'),this['channel'][_0xfbec('0x36')],_0x43451d['findBy']));this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x157'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x43451d[_0xfbec('0x154')]));return{'code':0xc8,'result':_0xfbec('0x158')};}};AGIVertices[_0xfbec('0xf')][_0xfbec('0x15c')]=function(_0x44b3f5){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x44b3f5['label']));if(!this['isConfigured'](_0x44b3f5['operation'])){return this['channel'][_0xfbec('0x2b')](_0x44b3f5,_0xfbec('0x15d'));}this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x15e'),_0x44b3f5['operation']));var _0x56e923=eval(_0x44b3f5[_0xfbec('0x15f')]);if(!this['isConfigured'](_0x44b3f5[_0xfbec('0xd3')])){return this[_0xfbec('0x34')]['noop'](_0xfbec('0xd4'));}var _0x2acf61=this['getVariable'][_0xfbec('0x69')](this,_0x44b3f5[_0xfbec('0xd3')]);if(!_0x2acf61){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x44b3f5,'no\x20variable\x20found');}if(_[_0xfbec('0x96')](_0x56e923)){var _0x34f60e=this;_0x56e923['forEach'](function(_0x1b1f8e,_0x300612){_0x34f60e[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0x160'),_0x2acf61,_0x300612),_0x1b1f8e);});return this[_0xfbec('0x34')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x2acf61));}else{return this[_0xfbec('0x34')]['setVariable'](_0x2acf61,_0x56e923);}};AGIVertices['prototype'][_0xfbec('0xc')]=function(_0x2e26a5){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2e26a5[_0xfbec('0x35')]));if(_0x2e26a5[_0xfbec('0x10c')]===0x0){return this['maxRetry'](_0x2e26a5);}_0x2e26a5['retry']-=0x1;if(!this[_0xfbec('0x83')](_0x2e26a5[_0xfbec('0x10d')])){return this['channel']['error'](_0x2e26a5,_0xfbec('0x161'));}var _0x4ec8d5=this[_0xfbec('0x10e')][_0xfbec('0x69')](this,_0x2e26a5['file_id']);if(!_0x4ec8d5){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x2e26a5,'no\x20file\x20audio\x20found');}var _0x4adad4=this['channel'][_0xfbec('0x110')](_0x4ec8d5,_0x2e26a5[_0xfbec('0x111')],_0x2e26a5[_0xfbec('0x162')]);var _0xae3e58=_0x4adad4[_0xfbec('0x9d')];if(_0x4adad4[_0xfbec('0x9d')]===-0x1){this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x2e26a5,'-1');return _0x4adad4;}else if(_0x4adad4['extra']==='timeout'){_0x4adad4[_0xfbec('0x9d')]=_0x4adad4[_0xfbec('0x9d')][_0xfbec('0x97')]>0x0?_0x4adad4[_0xfbec('0x9d')]:'t';}else if(_[_0xfbec('0x41')](_0x4adad4[_0xfbec('0x9d')])){_0x4adad4[_0xfbec('0x9d')]='#';_0xae3e58='#';}if(!this[_0xfbec('0x83')](_0x2e26a5[_0xfbec('0xd3')])){this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0xd4'));}else{var _0x31b8e0=this[_0xfbec('0x10')][_0xfbec('0x69')](this,_0x2e26a5[_0xfbec('0xd3')]);if(!_0x31b8e0){return this['channel'][_0xfbec('0x2b')](_0x2e26a5,_0xfbec('0xd5'));}this[_0xfbec('0x34')][_0xfbec('0x9a')](_0x31b8e0,_0xae3e58);}this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x2e26a5,_0xae3e58);return _0x4adad4;};AGIVertices['prototype'][_0xfbec('0xa5')]=function(_0x34f07d){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0x163'),_0x34f07d[_0xfbec('0x35')]));return this['channel'][_0xfbec('0xa5')](_0x34f07d[_0xfbec('0x164')]||_0x34f07d[_0xfbec('0x35')]);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x165')]=function(_0x59113f){logger['info'](util['format'](_0xfbec('0x166'),_0x59113f[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x59113f[_0xfbec('0x154')])){return this['channel'][_0xfbec('0x2b')](_0x59113f,'no\x20find\x20by\x20configured');}logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x153'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x59113f[_0xfbec('0x154')]));var _0x500856=this[_0xfbec('0x167')]['sync'](this,_0x59113f[_0xfbec('0x168')]);var _0x211894=this[_0xfbec('0x4d')][_0xfbec('0x69')](this,_0x59113f[_0xfbec('0x154')],_0x500856);if(_0x211894){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x155'),this[_0xfbec('0x34')]['callerid'],_0x59113f[_0xfbec('0x154')]));this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xfbec('0x34')]['callerid'],_0x59113f['findBy']));return{'code':0xc8,'result':_0xfbec('0x156')};}else{logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfbec('0x34')]['callerid'],_0x59113f[_0xfbec('0x154')]));this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xfbec('0x36')],_0x59113f['findBy']));return{'code':0xc8,'result':_0xfbec('0x158')};}};AGIVertices['prototype']['playback']=function(_0x28cce8){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x169'),_0x28cce8['label']));if(!this[_0xfbec('0x83')](_0x28cce8[_0xfbec('0x10d')])){return this[_0xfbec('0x34')]['error'](_0x28cce8,'no\x20file\x20audio\x20selected');}var _0x10b436=this['getSound'][_0xfbec('0x69')](this,_0x28cce8[_0xfbec('0x10d')]);if(!_0x10b436){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x28cce8,_0xfbec('0x10f'));}var _0x1867ec=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0xfbec('0x16a'),[_0x10b436,_0x28cce8[_0xfbec('0x16b')]]);if(_0x1867ec[_0xfbec('0x9d')]===-0x1){return _0x1867ec;}return this[_0xfbec('0x34')]['noop'](util[_0xfbec('0x27')](_0xfbec('0x16c'),'PLAYBACK',_0x10b436));};AGIVertices['prototype'][_0xfbec('0x16d')]=function(_0x7ecc45){logger[_0xfbec('0x2c')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x7ecc45[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x7ecc45[_0xfbec('0x16e')])){return this[_0xfbec('0x34')]['error'](_0x7ecc45,_0xfbec('0x16f'));}var _0x26d997='';var _0x3d857f=parseInt(_0x7ecc45[_0xfbec('0x16e')],0xa);if(isNaN(_0x3d857f)){_0x26d997=_0x7ecc45[_0xfbec('0x16e')];}else{_0x26d997=this[_0xfbec('0x15')][_0xfbec('0x69')](this,_0x7ecc45[_0xfbec('0x16e')]);if(!_0x26d997){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x7ecc45,_0xfbec('0x170'));}}var _0x4d0bdc='';if(this[_0xfbec('0x83')](_0x7ecc45[_0xfbec('0x10d')])){var _0x4fb182=this[_0xfbec('0x10e')]['sync'](this,_0x7ecc45['file_id']);if(_0x4fb182){_0x4d0bdc=_0x4fb182;}}this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x7ecc45,_0x26d997);if(_0x7ecc45[_0xfbec('0x16b')][_0xfbec('0x171')]('x')<0x0){_0x7ecc45[_0xfbec('0x16b')]+='x';}if(_0x7ecc45[_0xfbec('0x16b')][_0xfbec('0x171')]('X')<0x0){_0x7ecc45['opts']+='X';}this[_0xfbec('0x34')][_0xfbec('0x9a')](_0xfbec('0x172'),_0x26d997?_0x26d997[_0xfbec('0x173')]():'');var _0x4c7dc4=this['channel']['exec'](_0xfbec('0x174'),[_0x26d997,_0x7ecc45['opts'],_0x7ecc45['url'],_0x4d0bdc,_0x7ecc45['timeout'],_0x7ecc45['agi'],_0x7ecc45[_0xfbec('0x175')],_0x7ecc45[_0xfbec('0x176')],'',_0x7ecc45[_0xfbec('0x177')]]);if(_0x4c7dc4['result']===-0x1){return _0x4c7dc4;}return this[_0xfbec('0x34')]['noop'](util[_0xfbec('0x27')](_0xfbec('0x16c'),_0xfbec('0x174'),_0x26d997));};AGIVertices[_0xfbec('0xf')]['record']=function(_0x2fba25){logger['info'](util[_0xfbec('0x27')](_0xfbec('0x178'),_0x2fba25[_0xfbec('0x35')]));var _0x1a0dc5=_0x2fba25[_0xfbec('0x179')]||_0xfbec('0x12b');var _0x477143=util['format'](_0xfbec('0x17a'),this[_0xfbec('0x34')][_0xfbec('0x38')],rs[_0xfbec('0x116')](0x5));var _0x317021=util[_0xfbec('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0x477143,_0x1a0dc5);var _0x361d85=util['format'](_0xfbec('0x12c'),FILES_PATH,_0x477143);this['createSquareRecording'][_0xfbec('0x69')](this,_0x2fba25,_0x477143,_0x317021);this['channel'][_0xfbec('0x9a')](_0xfbec('0x17b'),_0x477143);logger[_0xfbec('0x2c')](_0xfbec('0x17c'),_0x361d85,_0x1a0dc5,_0x2fba25[_0xfbec('0x17d')],_0x2fba25[_0xfbec('0x62')]);return this[_0xfbec('0x34')][_0xfbec('0x14b')](_0x361d85,_0x1a0dc5,_0x2fba25[_0xfbec('0x17d')],_0x2fba25[_0xfbec('0x62')],undefined,!![]);};AGIVertices[_0xfbec('0xf')]['restapi']=function(_0x86c268){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x17e'),_0x86c268['label']));if(!this[_0xfbec('0x83')](_0x86c268[_0xfbec('0x6b')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')]('no\x20url\x20configured');}var _0xbdd1a1=this[_0xfbec('0x60')][_0xfbec('0x69')](this,_0x86c268);logger[_0xfbec('0x2c')](util['format'](_0xfbec('0x17f'),util['inspect'](_0xbdd1a1,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x86c268['variable_id'])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x180'));}var _0x229a57=this['getVariable'][_0xfbec('0x69')](this,_0x86c268['variable_id']);if(!_0x229a57){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x86c268,_0xfbec('0xd5'));}this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0x181'),_0x229a57),_0xbdd1a1[_0xfbec('0x70')]?_0xbdd1a1[_0xfbec('0x70')]:_0xfbec('0x182'));this[_0xfbec('0x34')][_0xfbec('0x9a')](util[_0xfbec('0x27')](_0xfbec('0x183'),_0x229a57),_0xbdd1a1[_0xfbec('0x71')]?_0xbdd1a1[_0xfbec('0x71')]:'OK');if(_0xbdd1a1[_0xfbec('0x6d')]){try{this[_0xfbec('0x98')](_0xbdd1a1[_0xfbec('0x6d')],_0x229a57);}catch(_0x5af146){logger['error'](util[_0xfbec('0x27')](_0xfbec('0x184'),_0x229a57));}}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format']('variable\x20%s\x20set',_0x229a57));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x185')]=function(_0x5543f9){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5543f9[_0xfbec('0x35')]));return this[_0xfbec('0x34')][_0xfbec('0x186')](_0x5543f9[_0xfbec('0x187')][_0xfbec('0x56')](/\s+/g,''),_0x5543f9[_0xfbec('0x17d')]);};AGIVertices[_0xfbec('0xf')]['saynumber']=function(_0x5bbe68){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x188'),_0x5bbe68['label']));return this['channel'][_0xfbec('0x189')](_0x5bbe68[_0xfbec('0x63')][_0xfbec('0x56')](/\s+/g,''),_0x5bbe68['escape_digits']);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x18a')]=function(_0x288bbe){logger['info'](util[_0xfbec('0x27')](_0xfbec('0x18b'),_0x288bbe[_0xfbec('0x35')]));return this['channel']['sayPhonetic'](_0x288bbe[_0xfbec('0x59')],_0x288bbe['escape_digits']);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x18c')]=function(_0x2a90a9){logger['info'](util[_0xfbec('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2a90a9[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x2a90a9[_0xfbec('0x18d')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x18e'));}var _0x4002a6=this[_0xfbec('0x1f')][_0xfbec('0x69')](this,_0x2a90a9[_0xfbec('0x18d')]);if(!_0x4002a6||!_0x4002a6[_0xfbec('0x18f')]){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x2a90a9,_0xfbec('0x190'));}var _0xde48ad={'from':util[_0xfbec('0x27')]('\x22%s\x22\x20<%s>',_0x4002a6[_0xfbec('0x13')],_0x4002a6[_0xfbec('0x191')]||_0x4002a6['Smtp'][_0xfbec('0x192')]),'to':_0x2a90a9['to']||'','cc':_0x2a90a9['cc']||'','bcc':_0x2a90a9[_0xfbec('0x193')]||'','subject':_0x2a90a9[_0xfbec('0x194')],'html':_0x2a90a9[_0xfbec('0x59')],'text':_0x2a90a9['text']};if(this['isConfigured'](_0x2a90a9[_0xfbec('0x195')])){}logger[_0xfbec('0xdc')](_0xfbec('0x196'),JSON[_0xfbec('0x6e')](_0xde48ad));this[_0xfbec('0x33')]['sync'](this,_0x2a90a9,_0x2a90a9['account_id']);this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x4002a6[_0xfbec('0x13')]));this[_0xfbec('0x21')]['sync'](this,_0x4002a6[_0xfbec('0x197')],_0xde48ad);return this['channel'][_0xfbec('0xa5')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xfbec('0x198')]=function(_0xbb91c2){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x199'),_0xbb91c2[_0xfbec('0x35')]));return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x19a'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x19b')]=function(_0x811bac){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x19c'),_0x811bac[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x811bac[_0xfbec('0x19d')])){return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x19e'));}var _0x26a4ad=this['getSmsAccount'][_0xfbec('0x69')](this,_0x811bac[_0xfbec('0x19d')]);if(!_0x26a4ad){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x811bac,_0xfbec('0x19f'));}var _0x1f9146={'body':_0x811bac[_0xfbec('0x1a0')],'phone':_0x811bac['to']||'','SmsAccountId':_0x26a4ad['id']};logger[_0xfbec('0xdc')](_0xfbec('0x1a1'),JSON[_0xfbec('0x6e')](_0x1f9146));this['createSquareDetailsReport'][_0xfbec('0x69')](this,_0x811bac,_0x811bac[_0xfbec('0x19d')]);this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x26a4ad[_0xfbec('0x13')]));this[_0xfbec('0x32')]['sync'](this,_0x1f9146);return this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x1a2'));};AGIVertices['prototype'][_0xfbec('0x1a3')]=function(_0x14ebdb){logger['info'](util['format'](_0xfbec('0x1a4'),_0x14ebdb[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x14ebdb[_0xfbec('0xd3')])){return this['channel']['error'](_0x14ebdb,'no\x20variable\x20selected');}var _0x4d9316=this[_0xfbec('0x10')][_0xfbec('0x69')](this,_0x14ebdb[_0xfbec('0xd3')]);if(!_0x4d9316){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x14ebdb,_0xfbec('0xd5'));}return this[_0xfbec('0x34')]['setVariable'](_0x4d9316,_0x14ebdb[_0xfbec('0x1a5')]);};AGIVertices[_0xfbec('0xf')][_0xfbec('0x1a6')]=function(_0x416e17){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x1a7'),_0x416e17[_0xfbec('0x35')]));this[_0xfbec('0x34')][_0xfbec('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x416e17[_0xfbec('0xb3')]==='yes'){this[_0xfbec('0x34')][_0xfbec('0xa5')](_0xfbec('0x1a8'));return this[_0xfbec('0x34')]['answer']();}return this['channel'][_0xfbec('0xa5')](_0xfbec('0x1a9'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x1aa')]=function(_0x405d2a){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x1ab'),_0x405d2a['label']));if(!this[_0xfbec('0x83')](_0x405d2a[_0xfbec('0x1ac')])){return this[_0xfbec('0x34')]['error'](_0x405d2a,_0xfbec('0x1ad'));}var _0x33d05b=this['getSquareProject'][_0xfbec('0x69')](this,_0x405d2a[_0xfbec('0x1ac')]);if(!this[_0xfbec('0x83')](_0x33d05b)){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x405d2a,util[_0xfbec('0x27')](_0xfbec('0x1ae'),_0x405d2a[_0xfbec('0x1ac')]));}if(_0x33d05b===this['channel']['arg_1']){return this['channel'][_0xfbec('0x2b')](_0x405d2a,_0xfbec('0x1af'));}this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x405d2a,_0x33d05b);var _0x769fd4=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0xfbec('0x1b0'),util[_0xfbec('0x27')](_0xfbec('0x1b1'),config[_0xfbec('0x6')][_0xfbec('0x1b2')]||_0xfbec('0x1b3'),_0x33d05b,this[_0xfbec('0x34')][_0xfbec('0x3d')]));if(_0x769fd4[_0xfbec('0x9d')]===-0x1){return _0x769fd4;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x16c'),_0xfbec('0x1b0'),_0x33d05b));};AGIVertices[_0xfbec('0xf')]['system']=function(_0x3e4de2){logger['info'](util[_0xfbec('0x27')](_0xfbec('0x1b4'),_0x3e4de2[_0xfbec('0x35')]));var _0x12fcf6=this[_0xfbec('0x55')][_0xfbec('0x69')](this,_0x3e4de2[_0xfbec('0x1b5')]);this[_0xfbec('0x33')][_0xfbec('0x69')](this,_0x3e4de2,_0x3e4de2[_0xfbec('0x1b5')]);if(this[_0xfbec('0x83')](_0x3e4de2[_0xfbec('0xd3')])){var _0x471bbb=this['getVariable'][_0xfbec('0x69')](this,_0x3e4de2['variable_id']);if(_0x471bbb){this['channel'][_0xfbec('0x9a')](_0x471bbb,_0x12fcf6);return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x1b6'),_0x3e4de2[_0xfbec('0x1b5')],_0x471bbb));}}return this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x1b7'),_0x3e4de2['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x3a5a7a){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x1b8'),_0x3a5a7a[_0xfbec('0x35')]));_0x3a5a7a[_0xfbec('0x59')]=_0x3a5a7a['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3a5a7a[_0xfbec('0x58')])){return this['channel'][_0xfbec('0xa5')]('no\x20apiKey\x20configured');}if(!this[_0xfbec('0x83')](_0x3a5a7a['text'])){return this['channel'][_0xfbec('0xa5')](_0xfbec('0xbe'));}this[_0xfbec('0x34')]['noop'](util[_0xfbec('0x27')](_0xfbec('0x1b9'),_0x3a5a7a[_0xfbec('0x59')]));var _0x1d0d42=this['googleCloudTTS'][_0xfbec('0x69')](this,_0x3a5a7a);if(_0x1d0d42){this['channel']['noop'](util[_0xfbec('0x27')](_0xfbec('0x1ba'),_0x1d0d42));var _0x3afe7f=this[_0xfbec('0x34')][_0xfbec('0xfd')](_0x1d0d42);try{fs['unlink'](_0x1d0d42+_0xfbec('0x150'));}catch(_0x5a495b){logger['error'](_0x5a495b);}return _0x3afe7f;}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x3a5a7a,_0xfbec('0x1bb'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x1bc')]=function(_0x5e4d67){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5e4d67[_0xfbec('0x35')]));_0x5e4d67[_0xfbec('0x59')]=_0x5e4d67[_0xfbec('0x59')][_0xfbec('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfbec('0x83')](_0x5e4d67[_0xfbec('0x59')])){return this['channel']['noop'](_0xfbec('0xbe'));}this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')]('Trying\x20Google\x20TTS\x20%s',_0x5e4d67[_0xfbec('0x59')]));var _0x56cf88=this[_0xfbec('0x5e')][_0xfbec('0x69')](this,_0x5e4d67);if(_0x56cf88){this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x1bd'),_0x56cf88));var _0x32c30a=this[_0xfbec('0x34')][_0xfbec('0xfd')](_0x56cf88);try{fs['unlink'](_0x56cf88+_0xfbec('0x150'));}catch(_0x592243){logger[_0xfbec('0x2b')](_0x592243);}return _0x32c30a;}return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x5e4d67,_0xfbec('0x1be'));};AGIVertices[_0xfbec('0xf')][_0xfbec('0x1bf')]=function(_0x487b39){logger['info'](util[_0xfbec('0x27')](_0xfbec('0x1c0'),_0x487b39[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x487b39[_0xfbec('0x154')])){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x487b39,_0xfbec('0x15b'));}logger['info'](util[_0xfbec('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xfbec('0x36')],_0x487b39['findBy']));var _0x288e42=this[_0xfbec('0x4e')][_0xfbec('0x69')](this,_0x487b39[_0xfbec('0x154')]);if(_0x288e42){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x155'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x487b39[_0xfbec('0x154')]));this['channel'][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x155'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x487b39[_0xfbec('0x154')]));return{'code':0xc8,'result':_0xfbec('0x156')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfbec('0x34')][_0xfbec('0x36')],_0x487b39[_0xfbec('0x154')]));this[_0xfbec('0x34')][_0xfbec('0xa5')](util['format'](_0xfbec('0x157'),this[_0xfbec('0x34')][_0xfbec('0x36')],_0x487b39[_0xfbec('0x154')]));return{'code':0xc8,'result':_0xfbec('0x158')};}};AGIVertices['prototype']['voicemail']=function(_0x421eb3){logger[_0xfbec('0x2c')](util[_0xfbec('0x27')](_0xfbec('0x1c1'),_0x421eb3[_0xfbec('0x35')]));var _0x3a68b9=this[_0xfbec('0x34')][_0xfbec('0xa3')](_0xfbec('0x1c2'),[_0x421eb3['mailbox'],_0x421eb3[_0xfbec('0x74')]]);if(_0x3a68b9[_0xfbec('0x9d')]===-0x1){return _0x3a68b9;}return this[_0xfbec('0x34')][_0xfbec('0xa5')](util[_0xfbec('0x27')](_0xfbec('0x16c'),'VOICEMAIL',_0x421eb3[_0xfbec('0x1c3')]));};AGIVertices[_0xfbec('0xf')]['vswitch']=function(_0x15b799){logger[_0xfbec('0x2c')](util['format'](_0xfbec('0x1c4'),_0x15b799[_0xfbec('0x35')]));if(!this[_0xfbec('0x83')](_0x15b799['variable_id'])){return this['channel'][_0xfbec('0x2b')](_0x15b799,_0xfbec('0x1c5'));}var _0x3343cb=this[_0xfbec('0x10')][_0xfbec('0x69')](this,_0x15b799[_0xfbec('0xd3')]);if(!_0x3343cb){return this[_0xfbec('0x34')][_0xfbec('0x2b')](_0x15b799,_0xfbec('0xd5'));}var _0xcdcbde=this[_0xfbec('0x34')]['getVariable'](_0x3343cb);return{'code':0xc8,'result':_0xcdcbde[_0xfbec('0x9f')]?_0xcdcbde[_0xfbec('0x9f')]:'-'};};String[_0xfbec('0xf')][_0xfbec('0x1c6')]=function(_0x42b793,_0x57a5ad){return this[_0xfbec('0x9b')](_0x42b793)[_0xfbec('0x1c7')](_0x57a5ad);};module[_0xfbec('0x1c8')]=AGIVertices;
\ No newline at end of file
+var _0x9c5e=['no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','FIND\x20AGENT\x20%s\x20BY\x20%s','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Response:','%s_STATUS_CODE','200','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','lodash','shelljs','odbc','randomstring','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','POST','method','body','rawBody','parse','computedVariables','sync','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','length','isPlainObject','%s.%s','saveRestApiResult','setVariable','replaceAllVariables','split','replaceAll','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','result','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s'];(function(_0x3cce4c,_0x2ebb5b){var _0x387d76=function(_0x588d1f){while(--_0x588d1f){_0x3cce4c['push'](_0x3cce4c['shift']());}};_0x387d76(++_0x2ebb5b);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x1f2dc0,_0x58ddca){_0x1f2dc0=_0x1f2dc0-0x0;var _0x23098b=_0x9c5e[_0x1f2dc0];return _0x23098b;};'use strict';var fs=require('fs');var util=require(_0xe9c5('0x0'));var _=require(_0xe9c5('0x1'));var sh=require(_0xe9c5('0x2'));var odbc=require(_0xe9c5('0x3'))();var rs=require(_0xe9c5('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xe9c5('0x5'))(_0xe9c5('0x6'));var config=require('../../config/environment');var shared=require(_0xe9c5('0x7'));var scripts=require(_0xe9c5('0x8'));var FILES_PATH=_0xe9c5('0x9');var recursiveMapAttributes=[_0xe9c5('0xa'),'rawBody'];var verticesWithRetry=[_0xe9c5('0xb'),_0xe9c5('0xc'),_0xe9c5('0xd')];var AGIVertices=function(_0x38218c,_0x4a2b0b,_0x596f4c){this[_0xe9c5('0xe')]=_0x38218c;this[_0xe9c5('0xf')]=_0x4a2b0b;this[_0xe9c5('0x10')]=_0x596f4c;};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x12')]=function(_0x39c057,_0x2bf224){this[_0xe9c5('0xf')][_0xe9c5('0x13')](_0x39c057)[_0xe9c5('0x14')](function(_0x46dc68){_0x2bf224(null,_0x46dc68?_0x46dc68[_0xe9c5('0x15')]:![]);})[_0xe9c5('0x16')](function(_0x25ff11){_0x2bf224(_0x25ff11);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x17')]=function(_0x509978,_0x3cce36){this[_0xe9c5('0xf')][_0xe9c5('0x18')](_0x509978)[_0xe9c5('0x14')](function(_0x211eec){_0x3cce36(null,_0x211eec?_0x211eec[_0xe9c5('0x15')]:![]);})['catch'](function(_0x163253){_0x3cce36(_0x163253);});};AGIVertices[_0xe9c5('0x11')]['getSquareProject']=function(_0x3aa80b,_0x45d18d){this[_0xe9c5('0xf')][_0xe9c5('0x19')](_0x3aa80b)[_0xe9c5('0x14')](function(_0x4d9c7d){_0x45d18d(null,_0x4d9c7d?_0x4d9c7d[_0xe9c5('0x15')]:![]);})[_0xe9c5('0x16')](function(_0x2f050b){_0x45d18d(_0x2f050b);});};AGIVertices[_0xe9c5('0x11')]['getSquareOdbc']=function(_0x26492a,_0x9d93d){this[_0xe9c5('0xf')][_0xe9c5('0x1a')](_0x26492a)[_0xe9c5('0x14')](function(_0x58fbad){_0x9d93d(null,_0x58fbad?_0x58fbad['dsn']:![]);})[_0xe9c5('0x16')](function(_0x57818d){_0x9d93d(_0x57818d);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1b')]=function(_0x21b02a,_0x4d16bc){this['rpc'][_0xe9c5('0x1c')](_0x21b02a)[_0xe9c5('0x14')](function(_0x37fb90){_0x4d16bc(null,_0x37fb90?_0x37fb90[_0xe9c5('0x15')]:![]);})[_0xe9c5('0x16')](function(_0x245161){_0x4d16bc(_0x245161);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1d')]=function(_0x1cd9c4,_0x402f59){this['rpc']['getTrunkById'](_0x1cd9c4)[_0xe9c5('0x14')](function(_0x3dd39d){_0x402f59(null,_0x3dd39d?_0x3dd39d[_0xe9c5('0x15')]:![]);})[_0xe9c5('0x16')](function(_0x33fe71){_0x402f59(_0x33fe71);});};AGIVertices[_0xe9c5('0x11')]['getSound']=function(_0x2c3fcb,_0x480187){var _0x3fa00b=this;this['rpc'][_0xe9c5('0x1e')](_0x2c3fcb)[_0xe9c5('0x14')](function(_0x52d008){_0x480187(null,_0x52d008?_0x3fa00b[_0xe9c5('0x1f')](_0x52d008[_0xe9c5('0x20')]):![]);})[_0xe9c5('0x16')](function(_0x37cfa5){_0x480187(_0x37cfa5);});};AGIVertices[_0xe9c5('0x11')]['getMailAccount']=function(_0xe3464c,_0x4fcabd){this[_0xe9c5('0xf')]['getMailAccountById'](_0xe3464c)[_0xe9c5('0x14')](function(_0x32e267){_0x4fcabd(null,_0x32e267?_0x32e267:![]);})[_0xe9c5('0x16')](function(_0x288d67){_0x4fcabd(_0x288d67);});};AGIVertices[_0xe9c5('0x11')]['sendMailMessage']=function(_0x23dc05,_0x12f47c,_0x140adf){this[_0xe9c5('0x10')][_0xe9c5('0x21')](_0x23dc05,_0x12f47c)['then'](function(){_0x140adf(null);})['catch'](function(_0x35b318){_0x140adf(_0x35b318);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x22')]=function(_0x22ce7c,_0x44a369){this[_0xe9c5('0xf')][_0xe9c5('0x23')](_0x22ce7c)[_0xe9c5('0x14')](function(_0x4feba2){if(_0x4feba2){if(_0x4feba2[_0xe9c5('0x24')]){_0x44a369(null,[_0x4feba2[_0xe9c5('0x25')]]);}else{_0x44a369(null,_['map'](_0x4feba2[_0xe9c5('0x26')],'interval'));}}else{_0x44a369(null,![]);}})[_0xe9c5('0x16')](function(_0x2642cc){_0x44a369(_0x2642cc);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1f')]=function(_0x258528){return util[_0xe9c5('0x27')](_0xe9c5('0x28'),FILES_PATH,_0x258528);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x29')]=function(_0x46f76d,_0x2a1056,_0x133c2a){odbc[_0xe9c5('0x2a')](_0x46f76d,function(_0x3aae58){if(_0x3aae58){logger[_0xe9c5('0x2b')](_0xe9c5('0x2c'),_0x3aae58);_0x133c2a(_0x3aae58);}else{logger[_0xe9c5('0x2d')](_0xe9c5('0x2e'));odbc[_0xe9c5('0x2f')](_0x2a1056,function(_0x55cd00,_0x2a1a28){if(_0x55cd00){logger[_0xe9c5('0x2d')](_0xe9c5('0x30'),_0x2a1056);_0x133c2a(_0x55cd00);}else{logger[_0xe9c5('0x2d')](_0xe9c5('0x31'),_0x2a1056);odbc[_0xe9c5('0x32')](function(_0x579e38){if(_0x579e38){logger[_0xe9c5('0x2b')](_0xe9c5('0x33'),_0x579e38);}_0x133c2a(null,_0x2a1a28);});}});}});};AGIVertices[_0xe9c5('0x11')]['getSmsAccount']=function(_0x34eb01,_0x1bf7c5){this[_0xe9c5('0xf')][_0xe9c5('0x34')](_0x34eb01)[_0xe9c5('0x14')](function(_0x3ad23f){_0x1bf7c5(null,_0x3ad23f?_0x3ad23f:![]);})[_0xe9c5('0x16')](function(_0x1fdf92){_0x1bf7c5(_0x1fdf92);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x35')]=function(_0xbe4c98,_0x479346){this['rpc'][_0xe9c5('0x35')](_0xbe4c98)[_0xe9c5('0x14')](function(_0x21bc80){_0x479346(null,_0x21bc80);})[_0xe9c5('0x16')](function(_0x4ca4b0){_0x479346(_0x4ca4b0);});};AGIVertices['prototype'][_0xe9c5('0x36')]=function(_0x144e85,_0x539bae,_0x5ae013){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0xe9c5('0x37')],'node':_0x144e85[_0xe9c5('0x38')],'application':_0x144e85[_0xe9c5('0x39')],'data':_0x539bae||null,'project_name':this[_0xe9c5('0xe')]['arg_1'],'callerid':this[_0xe9c5('0xe')][_0xe9c5('0x3a')]})[_0xe9c5('0x14')](function(_0x2e8867){if(_0x5ae013){_0x5ae013(null,_0x2e8867);}})[_0xe9c5('0x16')](function(_0xecc0c){if(_0x5ae013){_0x5ae013(_0xecc0c);}});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x3b')]=function(_0x5445c0,_0x2a4a29,_0x427e00,_0xd25a37){this[_0xe9c5('0xf')][_0xe9c5('0x3b')]({'uniqueid':this[_0xe9c5('0xe')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0xe9c5('0x3c')],'context':this[_0xe9c5('0xe')][_0xe9c5('0x3d')],'extension':this['channel'][_0xe9c5('0x3e')],'priority':this[_0xe9c5('0xe')][_0xe9c5('0x3f')],'accountcode':this[_0xe9c5('0xe')][_0xe9c5('0x40')],'dnid':this[_0xe9c5('0xe')]['dnid'],'projectName':this[_0xe9c5('0xe')][_0xe9c5('0x41')],'saveName':_0x2a4a29,'filename':_0x5445c0[_0xe9c5('0x42')]||_0x2a4a29,'savePath':_0x427e00})[_0xe9c5('0x14')](function(_0x4f0caa){_0xd25a37(null,_0x4f0caa);})[_0xe9c5('0x16')](function(_0x2c8bd3){_0xd25a37(_0x2c8bd3);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x43')]=function(_0x38396f,_0x298347,_0x53311d,_0x38af95,_0xe6a73f){this[_0xe9c5('0xf')][_0xe9c5('0x43')]({'uniqueid':this['channel'][_0xe9c5('0x37')],'body':_0x38396f,'direction':_0x298347,'providerName':_0x53311d,'providerResponse':_0x38af95})[_0xe9c5('0x14')](function(_0xeb662e){if(_0xe6a73f){_0xe6a73f(null,_0xeb662e);}})[_0xe9c5('0x16')](function(_0x254f41){if(_0xe6a73f){_0xe6a73f(_0x254f41);}});};AGIVertices[_0xe9c5('0x11')]['createCmContact']=function(_0x4b59fd,_0x1235c3){this[_0xe9c5('0xf')][_0xe9c5('0x44')]({'firstName':_[_0xe9c5('0x45')](_0x4b59fd[_0xe9c5('0x15')])||_[_0xe9c5('0x46')](_0x4b59fd[_0xe9c5('0x15')])?_0xe9c5('0x47')+Math[_0xe9c5('0x48')]():_0x4b59fd[_0xe9c5('0x15')],'lastName':_[_0xe9c5('0x45')](_0x4b59fd[_0xe9c5('0x49')])||_[_0xe9c5('0x46')](_0x4b59fd[_0xe9c5('0x49')])?null:_0x4b59fd[_0xe9c5('0x49')],'phone':_0x4b59fd[_0xe9c5('0x4a')],'ListId':_0x4b59fd['list_id'],'scheduledat':_0x4b59fd['scheduledAt'],'callbackUniqueid':this['channel'][_0xe9c5('0x37')],'tags':_0xe9c5('0x4b'),'description':_0xe9c5('0x4c')+_0x4b59fd['scheduledAt'][_0xe9c5('0x4d')](),'priority':_0x4b59fd['callback_priority']})[_0xe9c5('0x14')](function(_0xbac8ef){_0x1235c3(null,_0xbac8ef);})[_0xe9c5('0x16')](function(_0x1260cc){_0x1235c3(_0x1260cc);});};AGIVertices[_0xe9c5('0x11')]['getPause']=function(_0x2d1d5e,_0x1b4515){this['rpc'][_0xe9c5('0x4e')](_0x2d1d5e)[_0xe9c5('0x14')](function(_0x25f717){_0x1b4515(null,_0x25f717?_0x25f717[_0xe9c5('0x15')]:![]);})['catch'](function(_0x37ac57){_0x1b4515(_0x37ac57);});};AGIVertices['prototype'][_0xe9c5('0x4f')]=function(_0x40c555,_0x277323,_0x212a98){var _0x5ab663={'role':_0xe9c5('0x50')};_0x5ab663[_0x40c555]=this[_0xe9c5('0xe')][_0xe9c5('0x3a')];this[_0xe9c5('0xf')][_0xe9c5('0x4f')](_0x5ab663,_0x277323,this[_0xe9c5('0xe')]['uniqueid'])[_0xe9c5('0x14')](function(_0x181a9c){_0x212a98(null,_['isNil'](_0x181a9c)?![]:!![]);})[_0xe9c5('0x16')](function(_0x591bc5){logger[_0xe9c5('0x2b')](_0x591bc5);_0x212a98(null,![]);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x51')]=function(_0xede6fe,_0x2c0cfe){var _0x121859={'role':_0xe9c5('0x50')};_0x121859[_0xede6fe]=this['channel'][_0xe9c5('0x3a')];this[_0xe9c5('0xf')][_0xe9c5('0x51')](_0x121859)['then'](function(_0x377a0d){_0x2c0cfe(null,_['isNil'](_0x377a0d)?![]:!![]);})['catch'](function(_0xc1fc42){logger[_0xe9c5('0x2b')](_0xc1fc42);_0x2c0cfe(null,![]);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x52')]=function(_0x4712d1,_0x1bd2f5){var _0x3c4280={'role':_0xe9c5('0x50')};_0x3c4280[_0x4712d1]=this[_0xe9c5('0xe')][_0xe9c5('0x3a')];this['rpc'][_0xe9c5('0x52')](_0x3c4280)[_0xe9c5('0x14')](function(_0x257a96){_0x1bd2f5(null,_[_0xe9c5('0x46')](_0x257a96)?![]:!![]);})[_0xe9c5('0x16')](function(_0x1551c8){logger[_0xe9c5('0x2b')](_0x1551c8);_0x1bd2f5(null,![]);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x53')]=function(_0x5dbc73,_0x3f9758){var _0x1caca3={'role':_0xe9c5('0x50')};_0x1caca3[_0x5dbc73]=this[_0xe9c5('0xe')][_0xe9c5('0x3a')];var _0xd29c74=_0x5dbc73!=_0xe9c5('0x54')?util['format'](_0xe9c5('0x55'),_0xe9c5('0x56'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')]):undefined;this[_0xe9c5('0xf')]['agentLogin'](_0x1caca3,_0xd29c74)[_0xe9c5('0x14')](function(_0x5c15b8){_0x3f9758(null,_['isNil'](_0x5c15b8)?![]:!![]);})[_0xe9c5('0x16')](function(_0x2f07fc){logger['error'](_0x2f07fc);_0x3f9758(null,![]);});};AGIVertices['prototype'][_0xe9c5('0x57')]=function(_0x583369,_0x476fee){sh[_0xe9c5('0x58')](_['trim'](_0x583369),function(_0x3a984e,_0x207665){var _0x394aa4=_0x207665[_0xe9c5('0x59')](/(\r\n|\n|\r)/gm,'');_0x476fee(null,_0x394aa4);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x5a')]=function(_0x58b9b2,_0x2bf347){scripts[_0xe9c5('0x5a')](_0x58b9b2[_0xe9c5('0x5b')],_0x58b9b2[_0xe9c5('0x5c')]||_0xe9c5('0x5d'),_0x58b9b2[_0xe9c5('0x5d')],_0x58b9b2['languageCode']||_0xe9c5('0x5e'),_0x58b9b2[_0xe9c5('0x5f')]||'MALE',_0x58b9b2[_0xe9c5('0x60')]||_0xe9c5('0x61'))[_0xe9c5('0x14')](function(_0x107647){_0x2bf347(null,_0x107647);})[_0xe9c5('0x16')](function(_0x9115c8){_0x2bf347(_0x9115c8);});};AGIVertices['prototype'][_0xe9c5('0x62')]=function(_0x5b1fc4,_0x55fa7c){scripts['googleTTS'](_0x5b1fc4[_0xe9c5('0x5d')],_0x5b1fc4[_0xe9c5('0x63')]||'en',0x1)[_0xe9c5('0x14')](function(_0x1616dc){_0x55fa7c(null,_0x1616dc);})[_0xe9c5('0x16')](function(_0x6a4e21){_0x55fa7c(_0x6a4e21);});};AGIVertices['prototype'][_0xe9c5('0x64')]=function(_0x44baeb,_0x344e61){var _0x355b46={'uri':_0x44baeb[_0xe9c5('0x65')],'method':_0x44baeb['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x44baeb['timeout'])===_0xe9c5('0x66')&&parseInt(_0x44baeb[_0xe9c5('0x67')])>=0x1?parseInt(_0x44baeb[_0xe9c5('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xe9c5('0x68')]([_0xe9c5('0x69'),'PUT'],_0x355b46[_0xe9c5('0x6a')]['toUpperCase']())){try{_0x355b46[_0xe9c5('0x6b')]=_0x44baeb[_0xe9c5('0x6c')]?JSON[_0xe9c5('0x6d')](_0x44baeb['rawBody']):{};}catch(_0x516087){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x516087);}}try{_0x355b46['headers']=_0x44baeb[_0xe9c5('0xa')]?JSON[_0xe9c5('0x6d')](_0x44baeb[_0xe9c5('0xa')]):{};}catch(_0x413729){logger[_0xe9c5('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x413729);}if(_0x44baeb[_0xe9c5('0x6e')]){try{var _0x492fff=require(_0x44baeb['computedVariables'])[_0xe9c5('0x6f')](this,_0x355b46);_0x355b46['uri']=Mustache['render'](_0x44baeb['url'],_0x492fff,{},['$$','$$']);if(_0x355b46[_0xe9c5('0x70')]){_0x355b46['headers']=JSON[_0xe9c5('0x6d')](Mustache['render'](JSON[_0xe9c5('0x71')](_0x355b46[_0xe9c5('0x70')]),_0x492fff,{},['$$','$$']));}if(_0x355b46[_0xe9c5('0x6b')]){_0x355b46[_0xe9c5('0x6b')]=JSON['parse'](Mustache['render'](JSON[_0xe9c5('0x71')](_0x355b46[_0xe9c5('0x6b')]),_0x492fff,{},['$$','$$']));}}catch(_0x1e7709){logger['error'](_0xe9c5('0x72'),_0x1e7709);}}rp(_0x355b46)['then'](function(_0x56b451){var _0x3a7d01={'statusCode':_0x56b451[_0xe9c5('0x73')]||0xc8,'statusMessage':_0x56b451[_0xe9c5('0x74')]||'OK','headers':_0x56b451['headers']||{},'body':_0x56b451[_0xe9c5('0x6b')]||{}};_0x344e61(null,_0x3a7d01);})[_0xe9c5('0x16')](function(_0x21eaca){var _0x478709={'statusCode':_0x21eaca['statusCode']||0x1f4,'statusMessage':_0x21eaca['message']||_0xe9c5('0x75'),'headers':_0x21eaca[_0xe9c5('0x76')]['headers']||{},'body':_0x21eaca[_0xe9c5('0x76')][_0xe9c5('0x6b')]||{}};_0x344e61(null,_0x478709);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x77')]=function(_0x4d0e82,_0x163a8b){scripts[_0xe9c5('0x77')](this['channel'][_0xe9c5('0x37')],_0x4d0e82[_0xe9c5('0x78')],_0x4d0e82[_0xe9c5('0x5d')],_0x4d0e82['dialogflow_language']||'en')[_0xe9c5('0x14')](function(_0x48e943){_0x163a8b(null,_0x48e943);})[_0xe9c5('0x16')](function(_0x4ecaff){_0x163a8b(_0x4ecaff);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x79')]=function(_0x3242f3,_0x409d05){scripts[_0xe9c5('0x79')](this[_0xe9c5('0xe')][_0xe9c5('0x37')],_0x3242f3[_0xe9c5('0x7a')],_0x3242f3['client_email'],_0x3242f3[_0xe9c5('0x7b')],_0x3242f3[_0xe9c5('0x5d')],_0x3242f3[_0xe9c5('0x7c')]||'en')[_0xe9c5('0x14')](function(_0x237404){_0x409d05(null,_0x237404);})[_0xe9c5('0x16')](function(_0x315543){_0x409d05(_0x315543);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x7d')]=function(_0x36e66e,_0x2f0380){scripts['sestekNDA'](this[_0xe9c5('0xe')],_0x36e66e)[_0xe9c5('0x14')](function(_0x2f77b3){_0x2f0380(null,_0x2f77b3);})['catch'](function(_0x5579ee){_0x2f0380(_0x5579ee);});};AGIVertices[_0xe9c5('0x11')]['ispeechTTS']=function(_0x136ad9,_0x14d0f5){scripts['ispeechTTS'](_0x136ad9['key'],_0x136ad9[_0xe9c5('0x5d')],_0x136ad9[_0xe9c5('0x7e')]||_0xe9c5('0x5e'),_0x136ad9[_0xe9c5('0x7f')])[_0xe9c5('0x14')](function(_0x354ac6){_0x14d0f5(null,_0x354ac6);})[_0xe9c5('0x16')](function(_0x239e7d){_0x14d0f5(_0x239e7d);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x80')]=function(_0x51810c,_0x5626a7,_0x32b0fd){scripts[_0xe9c5('0x80')](_0x5626a7,_0x51810c[_0xe9c5('0x78')],_0x51810c['ispeech_asr_language']||'en-US',this['isConfigured'](_0x51810c[_0xe9c5('0x81')])?_0x51810c[_0xe9c5('0x81')]:undefined)[_0xe9c5('0x14')](function(_0x14d234){_0x32b0fd(null,_0x14d234);})[_0xe9c5('0x16')](function(_0x239e09){_0x32b0fd(_0x239e09);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x82')]=function(_0x50da7e,_0x56a94e){scripts[_0xe9c5('0x82')](_0x50da7e[_0xe9c5('0x83')],_0x50da7e[_0xe9c5('0x84')],_0x50da7e[_0xe9c5('0x85')],_0x50da7e[_0xe9c5('0x86')]||'Amy',_0x50da7e['text'],_0x50da7e[_0xe9c5('0x87')]||_0xe9c5('0x5d'))[_0xe9c5('0x14')](function(_0x3c89be){_0x56a94e(null,_0x3c89be);})['catch'](function(_0x26bdc1){_0x56a94e(_0x26bdc1);});};AGIVertices['prototype'][_0xe9c5('0x88')]=function(_0x2f3991,_0x5b4fa3){scripts[_0xe9c5('0x88')](this[_0xe9c5('0xe')][_0xe9c5('0x37')],_0x2f3991[_0xe9c5('0x83')],_0x2f3991[_0xe9c5('0x84')],_0x2f3991[_0xe9c5('0x89')],_0x2f3991[_0xe9c5('0x5d')],_0x2f3991[_0xe9c5('0x8a')])['then'](function(_0x2833fd){_0x5b4fa3(null,_0x2833fd);})[_0xe9c5('0x16')](function(_0x468e01){_0x5b4fa3(_0x468e01);});};AGIVertices['prototype'][_0xe9c5('0x8b')]=function(_0x50fa8b,_0x3067b5,_0x56f39e){scripts[_0xe9c5('0x8b')](_0x3067b5,_0x50fa8b[_0xe9c5('0x78')],_0x50fa8b[_0xe9c5('0x8c')]||_0xe9c5('0x5e'))[_0xe9c5('0x14')](function(_0x27c59e){_0x56f39e(null,_0x27c59e);})[_0xe9c5('0x16')](function(_0x28d8bb){_0x56f39e(_0x28d8bb);});};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x8d')]=function(_0x3201f3,_0x360388,_0x42284b){scripts[_0xe9c5('0x8d')](_0x360388,_0x3201f3[_0xe9c5('0x8e')],_0x3201f3[_0xe9c5('0x8f')],_0x3201f3[_0xe9c5('0x90')])['then'](function(_0x1d89a9){_0x42284b(null,_0x1d89a9);})[_0xe9c5('0x16')](function(_0x4224ee){_0x42284b(_0x4224ee);});};AGIVertices['prototype'][_0xe9c5('0x91')]=function(_0x262bea){var _0x59adcc=_[_0xe9c5('0x68')](verticesWithRetry,_0x262bea[_0xe9c5('0x39')])?_0x262bea:_[_0xe9c5('0x92')](_0x262bea);for(var _0x1e64ad in _0x59adcc){if(_0x59adcc[_0xe9c5('0x93')](_0x1e64ad)){if(_0x59adcc[_0x1e64ad]&&_[_0xe9c5('0x94')](_0x59adcc[_0x1e64ad])){if(_[_0xe9c5('0x68')](recursiveMapAttributes,_0x1e64ad)){_0x59adcc[_0x1e64ad]=this[_0xe9c5('0x95')](_0x59adcc[_0x1e64ad]);}else{_0x59adcc[_0x1e64ad]=this['replaceAllVariables'](_0x59adcc[_0x1e64ad]);}}}}return _0x59adcc;};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x96')]=function(_0x29b76b){for(var _0x5ed916 in _0x29b76b){if(_0x29b76b[_0xe9c5('0x93')](_0x5ed916)){if(_['isPlainObject'](_0x29b76b[_0x5ed916])){this[_0xe9c5('0x96')](_0x29b76b[_0x5ed916]);}else if(_['isArray'](_0x29b76b[_0x5ed916])){for(var _0x1fa1f8=0x0;_0x1fa1f8<_0x29b76b[_0x5ed916][_0xe9c5('0x97')];_0x1fa1f8++){this['recursiveNodeIndex'](_0x29b76b[_0x5ed916][_0x1fa1f8]);}}else if(_[_0xe9c5('0x94')](_0x29b76b[_0x5ed916])){_0x29b76b[_0x5ed916]=this['replaceAllVariables'](_0x29b76b[_0x5ed916]);}}}};AGIVertices[_0xe9c5('0x11')]['saveRestApiResult']=function(_0x5c9587,_0x709fae){for(var _0x2a1e14 in _0x5c9587){if(_0x5c9587[_0xe9c5('0x93')](_0x2a1e14)){if(_[_0xe9c5('0x98')](_0x5c9587[_0x2a1e14])){if(!_[_0xe9c5('0x45')](_0x5c9587[_0x2a1e14])){this['saveRestApiResult'](_0x5c9587[_0x2a1e14],util[_0xe9c5('0x27')](_0xe9c5('0x99'),_0x709fae,_0x2a1e14));}}else if(_['isArray'](_0x5c9587[_0x2a1e14])){for(var _0x3fec13=0x0;_0x3fec13<_0x5c9587[_0x2a1e14]['length'];_0x3fec13++){this[_0xe9c5('0x9a')](_0x5c9587[_0x2a1e14][_0x3fec13],util[_0xe9c5('0x27')]('%s.%s',_0x709fae,_0x2a1e14+'['+_0x3fec13+']'));}}else{if(!_['isNil'](_0x5c9587[_0x2a1e14])){this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0x99'),_0x709fae,_0x2a1e14),_0x5c9587[_0x2a1e14]);}}}}};AGIVertices[_0xe9c5('0x11')]['replaceObjectAllVariables']=function(_0x24f472){try{var _0x49a38f=JSON[_0xe9c5('0x6d')](_0x24f472);this[_0xe9c5('0x96')](_0x49a38f);return JSON[_0xe9c5('0x71')](_0x49a38f);}catch(_0x17dcb1){return this[_0xe9c5('0x9c')](_0x24f472);}};AGIVertices['prototype'][_0xe9c5('0x9c')]=function(_0x345d24){var _0x53a7f4=_0x345d24[_0xe9c5('0x9d')]('{');for(var _0x5cd08a=0x1;_0x5cd08a<_0x53a7f4[_0xe9c5('0x97')];_0x5cd08a+=0x1){var _0x3e5238=_0x53a7f4[_0x5cd08a][_0xe9c5('0x9d')]('}');if(_0x3e5238['length']>0x1){_0x345d24=_0x345d24[_0xe9c5('0x9e')]('{'+_0x3e5238[0x0]+'}',this[_0xe9c5('0xe')][_0xe9c5('0x12')](_0x3e5238[0x0])[_0xe9c5('0x9f')]||_0x3e5238[0x0]);}}if(_0x53a7f4['length']===0x1){return _0x345d24['toString']();}return this[_0xe9c5('0x9c')](_0x345d24);};AGIVertices[_0xe9c5('0x11')]['getAndSetVariable']=function(_0x192033,_0x324ee1){var _0x590f8b=this[_0xe9c5('0xe')][_0xe9c5('0x12')](_0x192033);if(_0x590f8b['result']===-0x1){return _0x590f8b;}logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0xa0'),_0x324ee1,_0x590f8b[_0xe9c5('0x9f')]));return this[_0xe9c5('0xe')][_0xe9c5('0x9b')](_0x324ee1,_0x590f8b[_0xe9c5('0x9f')]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xa1')]=function(_0x3054a5){return _0x3054a5&&_0x3054a5!=='0'&&_0x3054a5!=='-1'&&_0x3054a5!=='';};AGIVertices['prototype']['maxRetry']=function(_0x4b93dd){this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x4b93dd,'-');_0x4b93dd['retry']=_0x4b93dd[_0xe9c5('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xa3')]=function(_0x28c50f){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x28c50f[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x28c50f['text'])){return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}var _0x2be88a='\x22'+_0x28c50f[_0xe9c5('0x5d')]+'\x22';if(this[_0xe9c5('0xa1')](_0x28c50f[_0xe9c5('0x76')])){_0x2be88a+=','+_0x28c50f[_0xe9c5('0x76')];}var _0x149207=this[_0xe9c5('0xe')][_0xe9c5('0x58')](_0xe9c5('0xa6'),_0x2be88a);if(_0x149207['result']===-0x1){return _0x149207;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2be88a));};AGIVertices[_0xe9c5('0x11')]['mrcprecog']=function(_0x288e96){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0xa7'),_0x288e96[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x288e96['grammar'])){return this[_0xe9c5('0xe')]['noop'](_0xe9c5('0xa8'));}var _0x111d57=_0x288e96['grammar'];if(this[_0xe9c5('0xa1')](_0x288e96[_0xe9c5('0x76')])){_0x111d57+=','+_0x288e96[_0xe9c5('0x76')];}var _0x54c0bc=this['channel'][_0xe9c5('0x58')]('MRCPRecog',_0x111d57);if(_0x54c0bc[_0xe9c5('0xa9')]===-0x1){return _0x54c0bc;}var _0x310835=this[_0xe9c5('0xaa')](_0xe9c5('0xab'),_0xe9c5('0xac'));if(_0x310835[_0xe9c5('0xa9')]===-0x1){return _0x310835;}var _0x3bb0ee=this[_0xe9c5('0xaa')](_0xe9c5('0xad'),_0xe9c5('0xae'));if(_0x3bb0ee[_0xe9c5('0xa9')]===-0x1){return _0x3bb0ee;}var _0x3fda23=this[_0xe9c5('0xaa')](_0xe9c5('0xaf'),'MRCP_RECOG_INSTANCE');if(_0x3fda23['result']===-0x1){return _0x3fda23;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xb0'),_0x111d57));};AGIVertices['prototype'][_0xe9c5('0x6')]=function(_0x25d3d2){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0xb1'),_0x25d3d2[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0x6')]([_0x25d3d2[_0xe9c5('0xb2')],_0x25d3d2[_0xe9c5('0xb3')]]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xb4')]=function(_0xba7ae){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0xb5'),_0xba7ae[_0xe9c5('0x38')]));if(this[_0xe9c5('0xa1')](_0xba7ae[_0xe9c5('0x67')])){logger['info'](util['format'](_0xe9c5('0xb6'),_0xba7ae['timeout']));var _0x2a7acf=this[_0xe9c5('0xe')][_0xe9c5('0xb7')](_0xba7ae[_0xe9c5('0x67')]);if(_0x2a7acf[_0xe9c5('0xa9')]===-0x1){return _0x2a7acf;}}return this['channel'][_0xe9c5('0xb4')]();};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x4b')]=function(_0x2a4f00){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0xb8'),_0x2a4f00['label']));if(!this['isConfigured'](_0x2a4f00['list_id'])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x2a4f00,_0xe9c5('0xb9'));}_0x2a4f00[_0xe9c5('0xba')]=moment();if(this['isConfigured'](_0x2a4f00[_0xe9c5('0xbb')])){_0x2a4f00['scheduledAt']=moment()['add'](_0x2a4f00[_0xe9c5('0xbb')],'minutes');}if(!this[_0xe9c5('0xa1')](_0x2a4f00[_0xe9c5('0xbc')])){_0x2a4f00[_0xe9c5('0xbc')]=0x2;}this[_0xe9c5('0x44')]['sync'](this,_0x2a4f00);return this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xbd'),_0x2a4f00[_0xe9c5('0x4a')],_0x2a4f00['list_id'],_0x2a4f00['scheduledAt']));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xbe')]=function(_0x23a0dd){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0xbf'),_0x23a0dd[_0xe9c5('0x38')]));var _0x45d1ce=this[_0xe9c5('0xe')][_0xe9c5('0x58')](_0x23a0dd[_0xe9c5('0xc0')],_0x23a0dd[_0xe9c5('0x76')]);if(_0x45d1ce['result']===-0x1){return _0x45d1ce;}return this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xc1'),_0x23a0dd[_0xe9c5('0xc0')],_0x23a0dd[_0xe9c5('0x76')]));};AGIVertices[_0xe9c5('0x11')]['lumenvoxtts']=function(_0x4833b4){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0xc2'),_0x4833b4['label']));if(!this['isConfigured'](_0x4833b4[_0xe9c5('0x5d')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}var _0x4b00c9='\x22'+_0x4833b4[_0xe9c5('0x5d')]+'\x22';if(this[_0xe9c5('0xa1')](_0x4833b4['options'])){_0x4b00c9+=','+_0x4833b4['options'];}var _0x3d8131=this[_0xe9c5('0xe')][_0xe9c5('0x58')](_0xe9c5('0xa6'),_0x4b00c9);if(_0x3d8131[_0xe9c5('0xa9')]===-0x1){return _0x3d8131;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4b00c9));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xc3')]=function(_0x5b9ed6){logger['info'](util[_0xe9c5('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5b9ed6[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x5b9ed6['text'])){return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}var _0xbf442b='\x22'+_0x5b9ed6[_0xe9c5('0x5d')]+'\x22';if(this[_0xe9c5('0xa1')](_0x5b9ed6['options'])){_0xbf442b+=','+_0x5b9ed6[_0xe9c5('0x76')];}var _0xeb7ad3=this['channel']['exec'](_0xe9c5('0xa6'),_0xbf442b);if(_0xeb7ad3[_0xe9c5('0xa9')]===-0x1){return _0xeb7ad3;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format'](_0xe9c5('0xc4'),_0xbf442b));};AGIVertices[_0xe9c5('0x11')]['lumenvoxasr']=function(_0x1b1c4c){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0xc5'),_0x1b1c4c['label']));if(!this[_0xe9c5('0xa1')](_0x1b1c4c['grammar'])){return this['channel'][_0xe9c5('0xa4')]('no\x20grammar\x20configured');}var _0xf6be01=_0x1b1c4c[_0xe9c5('0xc6')];if(this[_0xe9c5('0xa1')](_0x1b1c4c['options'])){_0xf6be01+=','+_0x1b1c4c['options'];}var _0x223828=this['channel']['exec']('MRCPRecog',_0xf6be01);if(_0x223828['result']===-0x1){return _0x223828;}var _0x1e8ced=this[_0xe9c5('0xaa')](_0xe9c5('0xab'),_0xe9c5('0xc7'));if(_0x1e8ced[_0xe9c5('0xa9')]===-0x1){return _0x1e8ced;}var _0x5a0ee5=this[_0xe9c5('0xaa')](_0xe9c5('0xad'),_0xe9c5('0xc8'));if(_0x5a0ee5[_0xe9c5('0xa9')]===-0x1){return _0x5a0ee5;}var _0x3f1e52=this[_0xe9c5('0xaa')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x3f1e52['result']===-0x1){return _0x3f1e52;}return this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xb0'),_0xf6be01));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xc9')]=function(_0x3107d6){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0xca'),_0x3107d6[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x3107d6[_0xe9c5('0xc6')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xa8'));}var _0x10e1c6=_0x3107d6[_0xe9c5('0xc6')];if(this[_0xe9c5('0xa1')](_0x3107d6[_0xe9c5('0x76')])){_0x10e1c6+=','+_0x3107d6[_0xe9c5('0x76')];}var _0x1865dd=this[_0xe9c5('0xe')]['exec'](_0xe9c5('0xcb'),_0x10e1c6);if(_0x1865dd[_0xe9c5('0xa9')]===-0x1){return _0x1865dd;}var _0x325b82=this[_0xe9c5('0xaa')]('RECOG_CONFIDENCE()',_0xe9c5('0xcc'));if(_0x325b82[_0xe9c5('0xa9')]===-0x1){return _0x325b82;}var _0x27e9f6=this[_0xe9c5('0xaa')](_0xe9c5('0xad'),'SESTEK_ASR_TRANSCRIPT');if(_0x27e9f6[_0xe9c5('0xa9')]===-0x1){return _0x27e9f6;}var _0x443276=this[_0xe9c5('0xaa')](_0xe9c5('0xaf'),_0xe9c5('0xcd'));if(_0x443276[_0xe9c5('0xa9')]===-0x1){return _0x443276;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xb0'),_0x10e1c6));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xce')]=function(_0x150899){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0xcf'),_0x150899[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x150899['odbc_id'])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x150899,_0xe9c5('0xd0'));}var _0xe04461=this[_0xe9c5('0xd1')][_0xe9c5('0x6f')](this,_0x150899['odbc_id']);if(!_0xe04461){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x150899,_0xe9c5('0xd2'));}if(!this[_0xe9c5('0xa1')](_0x150899[_0xe9c5('0x2f')])){return this[_0xe9c5('0xe')]['error'](_0x150899,'no\x20query\x20configured');}var _0x349e6a=_0x150899[_0xe9c5('0x2f')][_0xe9c5('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xd3'),_0x349e6a));var _0x574c5a=this[_0xe9c5('0x29')]['sync'](this,_0xe04461,_0x349e6a);this['createSquareDetailsReport'][_0xe9c5('0x6f')](this,_0x150899,_0x349e6a);if(!this[_0xe9c5('0xa1')](_0x150899[_0xe9c5('0xd4')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xd5'));}var _0x1e36ab=this[_0xe9c5('0x12')][_0xe9c5('0x6f')](this,_0x150899['variable_id']);if(!_0x1e36ab){return this[_0xe9c5('0xe')]['error'](_0x150899,_0xe9c5('0xd6'));}var _0x3b2027=this;_0x574c5a['forEach'](function(_0x42e446,_0x48af31){Object[_0xe9c5('0xd7')](_0x42e446)['forEach'](function(_0xeec3ef){_0x3b2027[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0xd8'),_0x1e36ab,_0x48af31,_0xeec3ef),_0x42e446[_0xeec3ef]);});});this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0xd9'),_0x1e36ab),_0x574c5a[_0xe9c5('0x97')]);return this[_0xe9c5('0xe')]['noop'](util['format'](_0xe9c5('0xda'),_0x1e36ab));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xdb')]=function(_0x156c32){logger[_0xe9c5('0xdc')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x156c32[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x156c32[_0xe9c5('0xdd')])){return this[_0xe9c5('0xe')]['error'](_0x156c32,_0xe9c5('0xde'));}var _0x589704=this[_0xe9c5('0x1b')][_0xe9c5('0x6f')](this,_0x156c32[_0xe9c5('0xdd')]);if(!_0x589704){return this['channel'][_0xe9c5('0x2b')](_0x156c32,'no\x20user\x20found');}var _0x220968=this['channel'][_0xe9c5('0x58')](_0xe9c5('0xdf'),[util[_0xe9c5('0x27')](_0xe9c5('0xe0'),_0x589704),_0x156c32[_0xe9c5('0x67')],_0x156c32[_0xe9c5('0xe1')],_0x156c32[_0xe9c5('0x65')]]);if(_0x220968['result']===-0x1){return _0x220968;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xe2'),_0xe9c5('0xdf')));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xe3')]=function(_0x7faad2){logger[_0xe9c5('0x2d')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x7faad2[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x7faad2['key'])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('no\x20key\x20configured');}if(!this[_0xe9c5('0xa1')](_0x7faad2[_0xe9c5('0x5d')])){return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}this[_0xe9c5('0xe')][_0xe9c5('0xe4')]=!![];this[_0xe9c5('0x36')](_0x7faad2);this[_0xe9c5('0x43')](_0x7faad2[_0xe9c5('0x5d')],'in','','');this['channel']['noop'](util[_0xe9c5('0x27')](_0xe9c5('0xe5'),_0x7faad2[_0xe9c5('0x5d')]));var _0x5bf52a=this['googleDialogflow'][_0xe9c5('0x6f')](this,_0x7faad2);if(_0x5bf52a){for(var _0x3f35bf in _0x5bf52a){if(_0x5bf52a[_0xe9c5('0x93')](_0x3f35bf)){this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0xe6'),_0x3f35bf['toUpperCase']()),_0x5bf52a[_0x3f35bf]);}}this['createSquareMessage'](_0x5bf52a[_0xe9c5('0xe7')],_0xe9c5('0xe8'),_0xe9c5('0xe3'),'');return this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0xe9'),_0x5bf52a[_0xe9c5('0xe7')]));}return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x7faad2,_0xe9c5('0xea'));};AGIVertices['prototype'][_0xe9c5('0xeb')]=function(_0x305b56){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0xec'),_0x305b56[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x305b56[_0xe9c5('0x7a')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xed'));}if(!this[_0xe9c5('0xa1')](_0x305b56[_0xe9c5('0xee')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xef'));}if(!this[_0xe9c5('0xa1')](_0x305b56['private_key'])){return this['channel']['noop'](_0xe9c5('0xf0'));}if(!this[_0xe9c5('0xa1')](_0x305b56[_0xe9c5('0x7c')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('no\x20anguage\x20configured');}if(!this[_0xe9c5('0xa1')](_0x305b56[_0xe9c5('0x5d')])){return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}this[_0xe9c5('0xe')][_0xe9c5('0xe4')]=!![];this[_0xe9c5('0x36')](_0x305b56);this[_0xe9c5('0x43')](_0x305b56[_0xe9c5('0x5d')],'in','','');this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xf1'),_0x305b56[_0xe9c5('0x5d')]));var _0x457e55=this[_0xe9c5('0x79')][_0xe9c5('0x6f')](this,_0x305b56);if(_0x457e55){for(var _0xf48dc3 in _0x457e55){if(_0x457e55[_0xe9c5('0x93')](_0xf48dc3)){if(_0xf48dc3!==_0xe9c5('0xf2')){this[_0xe9c5('0xe')]['setVariable'](util[_0xe9c5('0x27')]('DIALOGFLOW_%s',_0xf48dc3[_0xe9c5('0xf3')]()),_0x457e55[_0xf48dc3]);}}}this[_0xe9c5('0x43')](_0x457e55['speech'],_0xe9c5('0xe8'),_0xe9c5('0xeb'),_0x457e55[_0xe9c5('0xf2')]);return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format'](_0xe9c5('0xf4'),_0x457e55[_0xe9c5('0xe7')]));}return this['channel'][_0xe9c5('0x2b')](_0x305b56,_0xe9c5('0xf5'));};AGIVertices['prototype'][_0xe9c5('0xf6')]=function(_0x4d8983){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0xf7'),_0x4d8983[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x4d8983['ndauth_url'])){return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0xf8'));}if(!this[_0xe9c5('0xa1')](_0x4d8983['username'])){return this['channel']['noop'](_0xe9c5('0xf9'));}if(!this[_0xe9c5('0xa1')](_0x4d8983[_0xe9c5('0xfa')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xfb'));}if(!this[_0xe9c5('0xa1')](_0x4d8983[_0xe9c5('0xfc')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}this['channel'][_0xe9c5('0xe4')]=!![];this['createSquareDetailsReport'](_0x4d8983);this['createSquareMessage'](_0x4d8983[_0xe9c5('0x5d')],'in','','');this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format'](_0xe9c5('0xfd'),_0x4d8983[_0xe9c5('0x5d')]));var _0x109d82=this[_0xe9c5('0x7d')][_0xe9c5('0x6f')](this,_0x4d8983);if(_0x109d82){for(var _0x2d83fe in _0x109d82){if(_0x109d82['hasOwnProperty'](_0x2d83fe)){this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0xfe'),_0x2d83fe[_0xe9c5('0xf3')]()),_0x109d82[_0x2d83fe]);}}this[_0xe9c5('0x43')](_0x109d82['speech'],_0xe9c5('0xe8'),_0xe9c5('0xf6'),'');if(_0x109d82[_0xe9c5('0xff')]){this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x100'),_0x109d82[_0xe9c5('0xff')]));var _0x37f9fc=this[_0xe9c5('0xe')][_0xe9c5('0x101')](_0x109d82[_0xe9c5('0xff')]);try{fs[_0xe9c5('0x102')](_0x109d82[_0xe9c5('0xff')]+_0xe9c5('0x103'));}catch(_0x44922f){logger[_0xe9c5('0x2b')](_0x44922f);}return _0x37f9fc;}else{return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x104'),_0x109d82['speech']));}}return this['channel']['error'](_0x4d8983,_0xe9c5('0x105'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x106')]=function(_0x1d75aa){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1d75aa[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x425069){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x107'),_0x425069[_0xe9c5('0x38')]));var _0x8b55bf='';if(_0x425069['trunk_id']){if(!this[_0xe9c5('0xa1')](_0x425069[_0xe9c5('0x108')])){return this['channel'][_0xe9c5('0x2b')](_0x425069,'no\x20trunk\x20selected');}else{var _0x22ade4=parseInt(_0x425069[_0xe9c5('0x108')],0xa);if(isNaN(_0x22ade4)){_0x8b55bf=_0x425069[_0xe9c5('0x108')];}else{_0x8b55bf=this[_0xe9c5('0x1d')][_0xe9c5('0x6f')](this,_0x425069['trunk_id']);if(!_0x8b55bf){return this[_0xe9c5('0xe')]['error'](_0x425069,_0xe9c5('0x109'));}}}}else if(_0x425069['trunk_name']){_0x8b55bf=_0x425069[_0xe9c5('0x10a')];}else{return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x425069,'no\x20trunk\x20selected');}var _0x11c717=this[_0xe9c5('0xe')][_0xe9c5('0x58')](_0xe9c5('0xdf'),[util['format']('SIP/%s/%s',_0x8b55bf,_0x425069[_0xe9c5('0x4a')]),_0x425069[_0xe9c5('0x67')],_0x425069[_0xe9c5('0xe1')],_0x425069[_0xe9c5('0x65')]]);if(_0x11c717['result']===-0x1){return _0x11c717;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xe2'),_0xe9c5('0xdf')));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x10b')]=function(_0x3ed6ab){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x10c'),_0x3ed6ab[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('finally');};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xc')]=function(_0x11fc27){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x10d'),_0x11fc27[_0xe9c5('0x38')]));if(_0x11fc27[_0xe9c5('0x10e')]===0x0){return this[_0xe9c5('0xa2')](_0x11fc27);}_0x11fc27[_0xe9c5('0x10e')]-=0x1;if(!this[_0xe9c5('0xa1')](_0x11fc27['file_id'])){return this[_0xe9c5('0xe')]['error'](_0x11fc27,_0xe9c5('0x10f'));}var _0x3eb98b=this[_0xe9c5('0x110')][_0xe9c5('0x6f')](this,_0x11fc27[_0xe9c5('0x111')]);if(!_0x3eb98b){return this[_0xe9c5('0xe')]['error'](_0x11fc27,_0xe9c5('0x112'));}if(!this[_0xe9c5('0xa1')](_0x11fc27[_0xe9c5('0xd4')])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0xe9c5('0xd5'));}var _0x5f4d23=this[_0xe9c5('0xe')][_0xe9c5('0x113')](_0x3eb98b,_0x11fc27['response'],_0x11fc27['maxdigit']);var _0x549a16=_0x5f4d23[_0xe9c5('0xa9')]?_0x5f4d23[_0xe9c5('0xa9')][_0xe9c5('0x4d')]():'';logger['info']('test',JSON[_0xe9c5('0x71')](_0x5f4d23));if(_0x5f4d23[_0xe9c5('0xa9')]===-0x1){this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x11fc27,_0x549a16);return _0x5f4d23;}else if(_0x5f4d23[_0xe9c5('0x9f')]==='timeout'){_0x5f4d23[_0xe9c5('0xa9')]=_0x549a16[_0xe9c5('0x97')]>=parseInt(_0x11fc27[_0xe9c5('0x114')])?'x':'i';}else{_0x5f4d23['result']=_0x549a16['length']>=parseInt(_0x11fc27[_0xe9c5('0x114')])&&_0x549a16['length']<=parseInt(_0x11fc27[_0xe9c5('0x115')])?'x':'i';}var _0x5426f7=this[_0xe9c5('0x12')][_0xe9c5('0x6f')](this,_0x11fc27['variable_id']);if(!_0x5426f7){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x11fc27,_0xe9c5('0xd6'));}this[_0xe9c5('0xe')]['setVariable'](_0x5426f7,_0x549a16);if(this['isConfigured'](_0x11fc27[_0xe9c5('0x116')])){var _0x19c719=parseInt(_0x11fc27[_0xe9c5('0x116')],0xa);var _0x5d3eec=rs[_0xe9c5('0x117')]({'charset':'*','length':_0x19c719});var _0x1165a3=_0x549a16[_0xe9c5('0x97')];if(_0x1165a3>0x0){if(_0x1165a3>_0x19c719){this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x11fc27,_0x11fc27[_0xe9c5('0x118')]===_0xe9c5('0x119')?_0x5d3eec+_0x549a16[_0xe9c5('0x11a')](_0x19c719):_0x549a16[_0xe9c5('0x11a')](0x0,_0x1165a3-_0x19c719)+_0x5d3eec);}else{this['createSquareDetailsReport'][_0xe9c5('0x6f')](this,_0x11fc27,rs[_0xe9c5('0x117')]({'charset':'*','length':_0x1165a3}));}}else{this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x11fc27,'');}}else{this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x11fc27,_0x549a16);}return _0x5f4d23;};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0xd')]=function(_0x3a5a62){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x11b'),_0x3a5a62['label']));return this[_0xe9c5('0xc')](_0x3a5a62);};AGIVertices[_0xe9c5('0x11')]['goal']=function(_0x78adcd){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x11c'),_0x78adcd[_0xe9c5('0x38')]));this[_0xe9c5('0x36')]['sync'](this,_0x78adcd,_0x78adcd['goalname']);return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x11d'),_0x78adcd[_0xe9c5('0x11e')]));};AGIVertices['prototype'][_0xe9c5('0x11f')]=function(_0x1df46b){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x1df46b[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x1df46b[_0xe9c5('0x83')])||!this[_0xe9c5('0xa1')](_0x1df46b[_0xe9c5('0x84')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0x120'));}if(!this[_0xe9c5('0xa1')](_0x1df46b[_0xe9c5('0x5d')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x121'),_0x1df46b['text']));var _0x1e20d3=this[_0xe9c5('0x82')]['sync'](this,_0x1df46b);if(_0x1e20d3){this['channel']['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x122'),_0x1e20d3));var _0x14aa4e=this[_0xe9c5('0xe')][_0xe9c5('0x101')](_0x1e20d3);try{fs[_0xe9c5('0x102')](_0x1e20d3+_0xe9c5('0x103'));}catch(_0x49078b){logger[_0xe9c5('0x2b')](_0x49078b);}return _0x14aa4e;}return this[_0xe9c5('0xe')]['error'](_0x1df46b,_0xe9c5('0x123'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x124')]=function(_0x59917b){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x125'),_0x59917b['label']));if(!this[_0xe9c5('0xa1')](_0x59917b[_0xe9c5('0x83')])||!this[_0xe9c5('0xa1')](_0x59917b['aws_secret_access_key'])){return this['channel']['noop'](_0xe9c5('0x120'));}if(!this['isConfigured'](_0x59917b['aws_bot_name'])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0x126'));}if(!this[_0xe9c5('0xa1')](_0x59917b['text'])){return this[_0xe9c5('0xe')]['noop'](_0xe9c5('0xa5'));}this['channel'][_0xe9c5('0xe4')]=!![];this[_0xe9c5('0x36')](_0x59917b);this[_0xe9c5('0x43')](_0x59917b['text'],'in','','');this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x127'),_0x59917b[_0xe9c5('0x5d')]));var _0x20765a=this[_0xe9c5('0x88')][_0xe9c5('0x6f')](this,_0x59917b);if(_0x20765a){for(var _0x3b3924 in _0x20765a){if(_0x20765a[_0xe9c5('0x93')](_0x3b3924)&&_[_0xe9c5('0x94')](_0x20765a[_0x3b3924])){this['channel'][_0xe9c5('0x9b')](util['format'](_0xe9c5('0x128'),_0x3b3924[_0xe9c5('0xf3')]()),_0x20765a[_0x3b3924]);}}if(_[_0xe9c5('0x46')](_0x20765a[_0xe9c5('0x129')])){return this[_0xe9c5('0xe')]['noop'](_0xe9c5('0x12a'));}else{this[_0xe9c5('0x43')](_0x20765a[_0xe9c5('0x129')],'out',_0xe9c5('0x12b'),'');return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x20765a[_0xe9c5('0x129')]));}}return this['channel'][_0xe9c5('0x2b')](_0x59917b,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype']['googleasr']=function(_0x2a248c){logger['info'](util['format'](_0xe9c5('0x12c'),_0x2a248c[_0xe9c5('0x38')],_0x2a248c['timeout']));if(!this[_0xe9c5('0xa1')](_0x2a248c[_0xe9c5('0x78')])){return this[_0xe9c5('0xe')]['noop'](_0xe9c5('0x12d'));}var _0x549999=_0xe9c5('0x12e');var _0x261ca6=util[_0xe9c5('0x27')](_0xe9c5('0x12f'),FILES_PATH,rs[_0xe9c5('0x117')](0x4));var _0x23d233=util['format'](_0xe9c5('0x99'),_0x261ca6,_0x549999);var _0x1ddbcc=!![];if(_0x2a248c[_0xe9c5('0x130')]===_0xe9c5('0x131')){_0x1ddbcc=![];}var _0x2c862a=this[_0xe9c5('0xe')][_0xe9c5('0x132')](_0x261ca6,_0x549999,_0x2a248c[_0xe9c5('0x133')],_0x2a248c['timeout'],undefined,_0x1ddbcc);if(_0x2c862a[_0xe9c5('0xa9')]!==-0x1){this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x134'),_0x23d233));var _0x38e3ce=this[_0xe9c5('0x8b')][_0xe9c5('0x6f')](this,_0x2a248c,_0x23d233);if(_0x38e3ce){for(var _0x1f0dfd in _0x38e3ce){if(_0x38e3ce['hasOwnProperty'](_0x1f0dfd)){this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util['format'](_0xe9c5('0x135'),_0x1f0dfd[_0xe9c5('0xf3')]()),_0x38e3ce[_0x1f0dfd]);}}return this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x136'),JSON[_0xe9c5('0x71')](_0x38e3ce)));}}return _0x2c862a;};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x137')]=function(_0x3e6551){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3e6551['label']));if(!this['isConfigured'](_0x3e6551[_0xe9c5('0x8e')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x3e6551[_0xe9c5('0x8f')])){return this[_0xe9c5('0xe')]['noop'](_0xe9c5('0x138'));}var _0x4e466d='wav';var _0x5e760c=util[_0xe9c5('0x27')](_0xe9c5('0x12f'),FILES_PATH,rs[_0xe9c5('0x117')](0x4));var _0xb1bec9=util[_0xe9c5('0x27')](_0xe9c5('0x99'),_0x5e760c,_0x4e466d);var _0x12d219=!![];if(_0x3e6551[_0xe9c5('0x130')]==='NOBEEP'){_0x12d219=![];}var _0x35fd54=this['channel'][_0xe9c5('0x132')](_0x5e760c,_0x4e466d,_0x3e6551['intKey'],_0x3e6551[_0xe9c5('0x67')],undefined,_0x12d219);if(_0x35fd54[_0xe9c5('0xa9')]!==-0x1){this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')]('tilde\x20%s\x20file\x20created',_0xb1bec9));var _0x3786a7=this['tildeASR']['sync'](this,_0x3e6551,_0xb1bec9);if(_0x3786a7){for(var _0x5c1eab in _0x3786a7){if(_0x3786a7[_0xe9c5('0x93')](_0x5c1eab)){this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util['format'](_0xe9c5('0x139'),_0x5c1eab[_0xe9c5('0xf3')]()),_0x3786a7[_0x5c1eab]);}}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format'](_0xe9c5('0x13a'),JSON[_0xe9c5('0x71')](_0x3786a7)));}}return _0x35fd54;};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x13b')]=function(_0x5492d7){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5492d7[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0x13c')](_0x5492d7[_0xe9c5('0x3d')],_0x5492d7['extension'],_0x5492d7[_0xe9c5('0x3f')]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x13d')]=function(_0x1f4809){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x13e'),_0x1f4809[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x1f4809[_0xe9c5('0x13f')])){return this[_0xe9c5('0xe')]['error'](_0x1f4809,'no\x20condition\x20configured');}try{var _0x5e763e=eval(_0x1f4809['condition'])?_0xe9c5('0x140'):'false';this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x141'),_0x1f4809[_0xe9c5('0x13f')],_0x5e763e));return{'code':0xc8,'result':_0x5e763e};}catch(_0x3fdfae){return{'code':0xc8,'result':_0xe9c5('0x142')};}};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x143')]=function(_0x445a14){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x144'),_0x445a14[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x445a14[_0xe9c5('0x145')])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x445a14,_0xe9c5('0x146'));}var _0x5522e4=this['getIntervals'][_0xe9c5('0x6f')](this,_0x445a14[_0xe9c5('0x145')]);if(!_0x5522e4){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x445a14,'no\x20intervals\x20found');}for(var _0x3b9e08=0x0;_0x3b9e08<_0x5522e4[_0xe9c5('0x97')];_0x3b9e08+=0x1){var _0x3e60d0=this['channel'][_0xe9c5('0x12')](util[_0xe9c5('0x27')](_0xe9c5('0x147'),_0x5522e4[_0x3b9e08]));if(_0x3e60d0[_0xe9c5('0xa9')]===-0x1){return _0x3e60d0;}logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x148'),_0x5522e4[_0x3b9e08],_0x3e60d0['extra']));if(_0x3e60d0[_0xe9c5('0x9f')]===_0xe9c5('0x140')){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x148'),_0x5522e4[_0x3b9e08],'true'));this['channel'][_0xe9c5('0xa4')](util['format'](_0xe9c5('0x148'),_0x5522e4[_0x3b9e08],_0xe9c5('0x140')));return{'code':0xc8,'result':_0xe9c5('0x140')};}else{logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x148'),_0x5522e4[_0x3b9e08],_0xe9c5('0x142')));this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format'](_0xe9c5('0x148'),_0x5522e4[_0x3b9e08],_0xe9c5('0x142')));}}return{'code':0xc8,'result':_0xe9c5('0x142')};};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x149')]=function(_0x6e63e8){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x14a'),_0x6e63e8[_0xe9c5('0x38')]));return this['channel'][_0xe9c5('0x149')]();};AGIVertices['prototype'][_0xe9c5('0x14b')]=function(_0x4608f5){logger[_0xe9c5('0x2d')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4608f5[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x4608f5[_0xe9c5('0x78')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('no\x20key\x20configured');}var _0x330fe9='wav';var _0xd7ee54=util[_0xe9c5('0x27')](_0xe9c5('0x12f'),FILES_PATH,rs[_0xe9c5('0x117')](0x4));var _0x15ca09=util[_0xe9c5('0x27')]('%s.%s',_0xd7ee54,_0x330fe9);var _0x1508da=!![];if(_0x4608f5[_0xe9c5('0x130')]==='NOBEEP'){_0x1508da=![];}var _0x89463a=this[_0xe9c5('0xe')][_0xe9c5('0x132')](_0xd7ee54,_0x330fe9,_0x4608f5['intKey'],_0x4608f5[_0xe9c5('0x67')],undefined,_0x1508da);if(_0x89463a['result']!==-0x1){this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')]('ispeech\x20%s\x20file\x20created',_0x15ca09));var _0x4e9105=this['ispeechASR'][_0xe9c5('0x6f')](this,_0x4608f5,_0x15ca09);if(_0x4e9105){for(var _0x81aa6a in _0x4e9105){if(_0x4e9105['hasOwnProperty'](_0x81aa6a)){this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0x14c'),_0x81aa6a[_0xe9c5('0xf3')]()),_0x4e9105[_0x81aa6a]);}}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x14d'),JSON['stringify'](_0x4e9105)));}}return _0x89463a;};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x14e')]=function(_0x1cebf5){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x14f'),_0x1cebf5[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x1cebf5[_0xe9c5('0x78')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0x12d'));}if(!this[_0xe9c5('0xa1')](_0x1cebf5[_0xe9c5('0x5d')])){return this['channel'][_0xe9c5('0xa4')]('no\x20text\x20configured');}this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x150'),_0x1cebf5[_0xe9c5('0x5d')]));var _0x42e51f=this[_0xe9c5('0x151')]['sync'](this,_0x1cebf5);if(_0x42e51f){this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')]('ispeech\x20%s\x20file\x20created',_0x42e51f));var _0x56feb1=this[_0xe9c5('0xe')]['streamFile'](_0x42e51f,_0x1cebf5[_0xe9c5('0x133')]);try{fs[_0xe9c5('0x102')](_0x42e51f+'.wav');}catch(_0x4d9d23){logger[_0xe9c5('0x2b')](_0x4d9d23);}return _0x56feb1;}return this['channel']['error'](_0x1cebf5,_0xe9c5('0x152'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x153')]=function(_0x16dfab){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x154'),_0x16dfab['label']));if(!this[_0xe9c5('0xa1')](_0x16dfab[_0xe9c5('0x155')])){return this['channel'][_0xe9c5('0x2b')](_0x16dfab,_0xe9c5('0x156'));}logger['info'](util[_0xe9c5('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xe9c5('0x3a')],_0x16dfab[_0xe9c5('0x155')]));var _0xedfbef=this[_0xe9c5('0x53')][_0xe9c5('0x6f')](this,_0x16dfab[_0xe9c5('0x155')]);if(_0xedfbef){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x16dfab['findBy']));this[_0xe9c5('0xe')]['noop'](util['format'](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x16dfab[_0xe9c5('0x155')]));return{'code':0xc8,'result':_0xe9c5('0x158')};}else{logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x159'),this['channel'][_0xe9c5('0x3a')],_0x16dfab[_0xe9c5('0x155')]));this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe9c5('0xe')]['callerid'],_0x16dfab[_0xe9c5('0x155')]));return{'code':0xc8,'result':_0xe9c5('0x15a')};}};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x15b')]=function(_0x533f84){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x15c'),_0x533f84[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x533f84[_0xe9c5('0x155')])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x533f84,_0xe9c5('0x156'));}logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x533f84[_0xe9c5('0x155')]));var _0x287286=this['agentLogout'][_0xe9c5('0x6f')](this,_0x533f84[_0xe9c5('0x155')]);if(_0x287286){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x533f84[_0xe9c5('0x155')]));this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x533f84['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x533f84[_0xe9c5('0x155')]));this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x159'),this['channel']['callerid'],_0x533f84[_0xe9c5('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe9c5('0x11')]['math']=function(_0x426396){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x15d'),_0x426396[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x426396[_0xe9c5('0x15e')])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x426396,'no\x20operation\x20configured');}this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x15f'),_0x426396[_0xe9c5('0x15e')]));var _0x2b93d8=eval(_0x426396[_0xe9c5('0x15e')]);if(!this['isConfigured'](_0x426396[_0xe9c5('0xd4')])){return this['channel'][_0xe9c5('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x39b16e=this[_0xe9c5('0x12')][_0xe9c5('0x6f')](this,_0x426396[_0xe9c5('0xd4')]);if(!_0x39b16e){return this[_0xe9c5('0xe')]['error'](_0x426396,'no\x20variable\x20found');}if(_['isArray'](_0x2b93d8)){var _0x563841=this;_0x2b93d8[_0xe9c5('0x160')](function(_0x4861b0,_0x3de18d){_0x563841['channel'][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0x161'),_0x39b16e,_0x3de18d),_0x4861b0);});return this['channel']['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x162'),_0x39b16e));}else{return this[_0xe9c5('0xe')]['setVariable'](_0x39b16e,_0x2b93d8);}};AGIVertices['prototype'][_0xe9c5('0xb')]=function(_0x21cd3d){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x21cd3d[_0xe9c5('0x38')]));if(_0x21cd3d['retry']===0x0){return this['maxRetry'](_0x21cd3d);}_0x21cd3d[_0xe9c5('0x10e')]-=0x1;if(!this[_0xe9c5('0xa1')](_0x21cd3d[_0xe9c5('0x111')])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x21cd3d,_0xe9c5('0x10f'));}var _0x29dc04=this[_0xe9c5('0x110')]['sync'](this,_0x21cd3d[_0xe9c5('0x111')]);if(!_0x29dc04){return this[_0xe9c5('0xe')]['error'](_0x21cd3d,_0xe9c5('0x112'));}var _0x2f4fc8=this[_0xe9c5('0xe')][_0xe9c5('0x113')](_0x29dc04,_0x21cd3d[_0xe9c5('0x163')],_0x21cd3d[_0xe9c5('0x164')]);var _0x3273b5=_0x2f4fc8[_0xe9c5('0xa9')];if(_0x2f4fc8[_0xe9c5('0xa9')]===-0x1){this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x21cd3d,'-1');return _0x2f4fc8;}else if(_0x2f4fc8[_0xe9c5('0x9f')]===_0xe9c5('0x67')){_0x2f4fc8[_0xe9c5('0xa9')]=_0x2f4fc8['result'][_0xe9c5('0x97')]>0x0?_0x2f4fc8[_0xe9c5('0xa9')]:'t';}else if(_[_0xe9c5('0x45')](_0x2f4fc8[_0xe9c5('0xa9')])){_0x2f4fc8[_0xe9c5('0xa9')]='#';_0x3273b5='#';}if(!this[_0xe9c5('0xa1')](_0x21cd3d['variable_id'])){this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xd5'));}else{var _0x253b9b=this[_0xe9c5('0x12')]['sync'](this,_0x21cd3d[_0xe9c5('0xd4')]);if(!_0x253b9b){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x21cd3d,_0xe9c5('0xd6'));}this[_0xe9c5('0xe')]['setVariable'](_0x253b9b,_0x3273b5);}this[_0xe9c5('0x36')]['sync'](this,_0x21cd3d,_0x3273b5);return _0x2f4fc8;};AGIVertices['prototype'][_0xe9c5('0xa4')]=function(_0x577934){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x165'),_0x577934['label']));return this[_0xe9c5('0xe')]['noop'](_0x577934[_0xe9c5('0x166')]||_0x577934[_0xe9c5('0x38')]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x167')]=function(_0x3b90d6){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3b90d6[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x3b90d6[_0xe9c5('0x155')])){return this['channel'][_0xe9c5('0x2b')](_0x3b90d6,_0xe9c5('0x156'));}logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x168'),this[_0xe9c5('0xe')]['callerid'],_0x3b90d6[_0xe9c5('0x155')]));var _0x48121d=this[_0xe9c5('0x169')][_0xe9c5('0x6f')](this,_0x3b90d6[_0xe9c5('0x16a')]);var _0x26bdc4=this[_0xe9c5('0x4f')][_0xe9c5('0x6f')](this,_0x3b90d6[_0xe9c5('0x155')],_0x48121d);if(_0x26bdc4){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x3b90d6[_0xe9c5('0x155')]));this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x3b90d6[_0xe9c5('0x155')]));return{'code':0xc8,'result':_0xe9c5('0x158')};}else{logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x159'),this['channel']['callerid'],_0x3b90d6[_0xe9c5('0x155')]));this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x3b90d6['findBy']));return{'code':0xc8,'result':_0xe9c5('0x15a')};}};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x16b')]=function(_0x3e7f7c){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x16c'),_0x3e7f7c[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x3e7f7c[_0xe9c5('0x111')])){return this['channel'][_0xe9c5('0x2b')](_0x3e7f7c,_0xe9c5('0x10f'));}var _0x15a102=this[_0xe9c5('0x110')][_0xe9c5('0x6f')](this,_0x3e7f7c[_0xe9c5('0x111')]);if(!_0x15a102){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x3e7f7c,_0xe9c5('0x112'));}var _0x405ee0=this[_0xe9c5('0xe')][_0xe9c5('0x58')]('PLAYBACK',[_0x15a102,_0x3e7f7c[_0xe9c5('0xe1')]]);if(_0x405ee0['result']===-0x1){return _0x405ee0;}return this['channel']['noop'](util[_0xe9c5('0x27')](_0xe9c5('0xc1'),'PLAYBACK',_0x15a102));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x16d')]=function(_0x5386ce){logger['info'](util['format'](_0xe9c5('0x16e'),_0x5386ce[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x5386ce['queue_id'])){return this['channel'][_0xe9c5('0x2b')](_0x5386ce,_0xe9c5('0x16f'));}var _0x5d4952='';var _0x438483=parseInt(_0x5386ce['queue_id'],0xa);if(isNaN(_0x438483)){_0x5d4952=_0x5386ce[_0xe9c5('0x170')];}else{_0x5d4952=this[_0xe9c5('0x17')]['sync'](this,_0x5386ce['queue_id']);if(!_0x5d4952){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x5386ce,'no\x20queue\x20found');}}var _0x398efc='';if(this['isConfigured'](_0x5386ce[_0xe9c5('0x111')])){var _0xa4522=this['getSound']['sync'](this,_0x5386ce[_0xe9c5('0x111')]);if(_0xa4522){_0x398efc=_0xa4522;}}this['createSquareDetailsReport'][_0xe9c5('0x6f')](this,_0x5386ce,_0x5d4952);if(_0x5386ce[_0xe9c5('0xe1')][_0xe9c5('0x171')]('x')<0x0){_0x5386ce[_0xe9c5('0xe1')]+='x';}if(_0x5386ce[_0xe9c5('0xe1')][_0xe9c5('0x171')]('X')<0x0){_0x5386ce[_0xe9c5('0xe1')]+='X';}this[_0xe9c5('0xe')][_0xe9c5('0x9b')](_0xe9c5('0x172'),_0x5d4952?_0x5d4952[_0xe9c5('0x173')]():'');var _0x4e1e91=this[_0xe9c5('0xe')][_0xe9c5('0x58')](_0xe9c5('0x174'),[_0x5d4952,_0x5386ce[_0xe9c5('0xe1')],_0x5386ce[_0xe9c5('0x65')],_0x398efc,_0x5386ce[_0xe9c5('0x67')],_0x5386ce['agi'],_0x5386ce[_0xe9c5('0x175')],_0x5386ce['gosub'],'',_0x5386ce[_0xe9c5('0x176')]]);if(_0x4e1e91['result']===-0x1){return _0x4e1e91;}return this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xc1'),'QUEUE',_0x5d4952));};AGIVertices['prototype'][_0xe9c5('0x177')]=function(_0x7e278){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x7e278['label']));var _0x1c1b4e=_0x7e278[_0xe9c5('0x178')]||_0xe9c5('0x12e');var _0x537ff2=util[_0xe9c5('0x27')](_0xe9c5('0x179'),this[_0xe9c5('0xe')][_0xe9c5('0x37')],rs[_0xe9c5('0x117')](0x5));var _0x22d095=util[_0xe9c5('0x27')](_0xe9c5('0x17a'),FILES_PATH,_0x537ff2,_0x1c1b4e);var _0x5283cb=util[_0xe9c5('0x27')](_0xe9c5('0x12f'),FILES_PATH,_0x537ff2);this[_0xe9c5('0x3b')][_0xe9c5('0x6f')](this,_0x7e278,_0x537ff2,_0x22d095);this['channel'][_0xe9c5('0x9b')](_0xe9c5('0x17b'),_0x537ff2);logger[_0xe9c5('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5283cb,_0x1c1b4e,_0x7e278[_0xe9c5('0x17c')],_0x7e278['timeout']);return this[_0xe9c5('0xe')][_0xe9c5('0x132')](_0x5283cb,_0x1c1b4e,_0x7e278[_0xe9c5('0x17c')],_0x7e278[_0xe9c5('0x67')],undefined,!![]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x17d')]=function(_0x532985){logger[_0xe9c5('0x2d')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x532985['label']));if(!this[_0xe9c5('0xa1')](_0x532985[_0xe9c5('0x65')])){return this['channel'][_0xe9c5('0xa4')]('no\x20url\x20configured');}var _0x4dc48c=this[_0xe9c5('0x64')]['sync'](this,_0x532985);logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x17e'),util['inspect'](_0x4dc48c,{'showHidden':![],'depth':null})));if(!this[_0xe9c5('0xa1')](_0x532985[_0xe9c5('0xd4')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1849d5=this['getVariable']['sync'](this,_0x532985[_0xe9c5('0xd4')]);if(!_0x1849d5){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x532985,_0xe9c5('0xd6'));}this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util[_0xe9c5('0x27')](_0xe9c5('0x17f'),_0x1849d5),_0x4dc48c['statusCode']?_0x4dc48c[_0xe9c5('0x73')]:_0xe9c5('0x180'));this[_0xe9c5('0xe')][_0xe9c5('0x9b')](util['format']('%s_STATUS_MESSAGE',_0x1849d5),_0x4dc48c[_0xe9c5('0x74')]?_0x4dc48c['statusMessage']:'OK');if(_0x4dc48c['body']){try{this[_0xe9c5('0x9a')](_0x4dc48c[_0xe9c5('0x6b')],_0x1849d5);}catch(_0x1f3288){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1849d5));}}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')]('variable\x20%s\x20set',_0x1849d5));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x181')]=function(_0x4ab6b2){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x182'),_0x4ab6b2[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0x183')](_0x4ab6b2[_0xe9c5('0x184')]['replace'](/\s+/g,''),_0x4ab6b2['escape_digits']);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x185')]=function(_0x24aa08){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x186'),_0x24aa08[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0x187')](_0x24aa08['number'][_0xe9c5('0x59')](/\s+/g,''),_0x24aa08['escape_digits']);};AGIVertices[_0xe9c5('0x11')]['sayphonetic']=function(_0x1a0957){logger['info'](util[_0xe9c5('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1a0957[_0xe9c5('0x38')]));return this[_0xe9c5('0xe')][_0xe9c5('0x188')](_0x1a0957[_0xe9c5('0x5d')],_0x1a0957[_0xe9c5('0x17c')]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x189')]=function(_0x12b72a){logger['info'](util[_0xe9c5('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x12b72a[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x12b72a[_0xe9c5('0x18a')])){return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0x18b'));}var _0x3cdfc8=this['getMailAccount'][_0xe9c5('0x6f')](this,_0x12b72a[_0xe9c5('0x18a')]);if(!_0x3cdfc8||!_0x3cdfc8['Smtp']){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x12b72a,_0xe9c5('0x18c'));}var _0x5016f1={'from':util[_0xe9c5('0x27')](_0xe9c5('0x18d'),_0x3cdfc8['name'],_0x3cdfc8[_0xe9c5('0x18e')]||_0x3cdfc8[_0xe9c5('0x18f')][_0xe9c5('0x190')]),'to':_0x12b72a['to']||'','cc':_0x12b72a['cc']||'','bcc':_0x12b72a[_0xe9c5('0x191')]||'','subject':_0x12b72a[_0xe9c5('0x192')],'html':_0x12b72a[_0xe9c5('0x5d')],'text':_0x12b72a[_0xe9c5('0x5d')]};if(this[_0xe9c5('0xa1')](_0x12b72a[_0xe9c5('0x193')])){}logger[_0xe9c5('0xdc')](_0xe9c5('0x194'),JSON[_0xe9c5('0x71')](_0x5016f1));this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x12b72a,_0x12b72a[_0xe9c5('0x18a')]);this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x195'),_0x3cdfc8[_0xe9c5('0x15')]));this[_0xe9c5('0x21')][_0xe9c5('0x6f')](this,_0x3cdfc8[_0xe9c5('0x196')],_0x5016f1);return this['channel'][_0xe9c5('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xe9c5('0x197')]=function(_0x2b57cb){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x198'),_0x2b57cb['label']));return this['channel']['noop'](_0xe9c5('0x199'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x19a')]=function(_0x38d400){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x38d400[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x38d400[_0xe9c5('0x19b')])){return this['channel'][_0xe9c5('0xa4')]('no\x20sms\x20account\x20configured');}var _0x1f8271=this[_0xe9c5('0x19c')][_0xe9c5('0x6f')](this,_0x38d400['sms_account_id']);if(!_0x1f8271){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x38d400,_0xe9c5('0x19d'));}var _0x278e99={'body':_0x38d400[_0xe9c5('0x19e')],'phone':_0x38d400['to']||'','SmsAccountId':_0x1f8271['id']};logger[_0xe9c5('0xdc')](_0xe9c5('0x19f'),JSON['stringify'](_0x278e99));this['createSquareDetailsReport'][_0xe9c5('0x6f')](this,_0x38d400,_0x38d400[_0xe9c5('0x19b')]);this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x1a0'),_0x1f8271['name']));this[_0xe9c5('0x35')][_0xe9c5('0x6f')](this,_0x278e99);return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0x1a1'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1a2')]=function(_0x2511ee){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x1a3'),_0x2511ee[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x2511ee['variable_id'])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x2511ee,'no\x20variable\x20selected');}var _0x5a710c=this[_0xe9c5('0x12')]['sync'](this,_0x2511ee[_0xe9c5('0xd4')]);if(!_0x5a710c){return this['channel'][_0xe9c5('0x2b')](_0x2511ee,_0xe9c5('0xd6'));}return this[_0xe9c5('0xe')][_0xe9c5('0x9b')](_0x5a710c,_0x2511ee[_0xe9c5('0x1a4')]);};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1a5')]=function(_0x45efdf){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x1a6'),_0x45efdf[_0xe9c5('0x38')]));this['channel'][_0xe9c5('0xa4')](_0xe9c5('0x1a7'));if(_0x45efdf['answer']==='yes'){this['channel'][_0xe9c5('0xa4')](_0xe9c5('0x1a8'));return this[_0xe9c5('0xe')][_0xe9c5('0xb4')]();}return this['channel'][_0xe9c5('0xa4')](_0xe9c5('0x1a9'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1aa')]=function(_0x5c6a96){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x1ab'),_0x5c6a96['label']));if(!this[_0xe9c5('0xa1')](_0x5c6a96['project_id'])){return this['channel'][_0xe9c5('0x2b')](_0x5c6a96,_0xe9c5('0x1ac'));}var _0x646f=this[_0xe9c5('0x1ad')][_0xe9c5('0x6f')](this,_0x5c6a96[_0xe9c5('0x1ae')]);if(!this['isConfigured'](_0x646f)){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x5c6a96,util[_0xe9c5('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5c6a96[_0xe9c5('0x1ae')]));}if(_0x646f===this['channel']['arg_1']){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x5c6a96,_0xe9c5('0x1af'));}this[_0xe9c5('0x36')][_0xe9c5('0x6f')](this,_0x5c6a96,_0x646f);var _0x2b573b=this['channel'][_0xe9c5('0x58')]('AGI',util[_0xe9c5('0x27')](_0xe9c5('0x1b0'),config[_0xe9c5('0x6')][_0xe9c5('0x1b1')]||_0xe9c5('0x1b2'),_0x646f,this[_0xe9c5('0xe')][_0xe9c5('0x41')]));if(_0x2b573b['result']===-0x1){return _0x2b573b;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0xc1'),_0xe9c5('0x1b3'),_0x646f));};AGIVertices['prototype'][_0xe9c5('0x1b4')]=function(_0x12ba24){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x1b5'),_0x12ba24[_0xe9c5('0x38')]));var _0x396fa2=this[_0xe9c5('0x57')][_0xe9c5('0x6f')](this,_0x12ba24[_0xe9c5('0xb2')]);this['createSquareDetailsReport'][_0xe9c5('0x6f')](this,_0x12ba24,_0x12ba24[_0xe9c5('0xb2')]);if(this[_0xe9c5('0xa1')](_0x12ba24['variable_id'])){var _0x50edf3=this[_0xe9c5('0x12')]['sync'](this,_0x12ba24[_0xe9c5('0xd4')]);if(_0x50edf3){this[_0xe9c5('0xe')]['setVariable'](_0x50edf3,_0x396fa2);return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format'](_0xe9c5('0x1b6'),_0x12ba24['command'],_0x50edf3));}}return this['channel'][_0xe9c5('0xa4')](util['format'](_0xe9c5('0x1b7'),_0x12ba24[_0xe9c5('0xb2')]));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1b8')]=function(_0xba8bb1){logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x1b9'),_0xba8bb1[_0xe9c5('0x38')]));_0xba8bb1[_0xe9c5('0x5d')]=_0xba8bb1[_0xe9c5('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe9c5('0xa1')](_0xba8bb1['apiKey'])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0xe9c5('0xa1')](_0xba8bb1[_0xe9c5('0x5d')])){return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](_0xe9c5('0xa5'));}this[_0xe9c5('0xe')]['noop'](util[_0xe9c5('0x27')](_0xe9c5('0x1ba'),_0xba8bb1['text']));var _0x4ee31a=this['googleCloudTTS']['sync'](this,_0xba8bb1);if(_0x4ee31a){this['channel'][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x1bb'),_0x4ee31a));var _0x365345=this['channel'][_0xe9c5('0x101')](_0x4ee31a);try{fs['unlink'](_0x4ee31a+_0xe9c5('0x103'));}catch(_0x26dd9d){logger[_0xe9c5('0x2b')](_0x26dd9d);}return _0x365345;}return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0xba8bb1,_0xe9c5('0x1bc'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1bd')]=function(_0x56cd29){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x1be'),_0x56cd29['label']));_0x56cd29[_0xe9c5('0x5d')]=_0x56cd29[_0xe9c5('0x5d')][_0xe9c5('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe9c5('0xa1')](_0x56cd29[_0xe9c5('0x5d')])){return this[_0xe9c5('0xe')]['noop']('no\x20text\x20configured');}this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x1bf'),_0x56cd29[_0xe9c5('0x5d')]));var _0x2a4167=this[_0xe9c5('0x62')][_0xe9c5('0x6f')](this,_0x56cd29);if(_0x2a4167){this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x2a4167));var _0x35c5b6=this['channel'][_0xe9c5('0x101')](_0x2a4167);try{fs[_0xe9c5('0x102')](_0x2a4167+_0xe9c5('0x103'));}catch(_0x418400){logger[_0xe9c5('0x2b')](_0x418400);}return _0x35c5b6;}return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x56cd29,_0xe9c5('0x1c0'));};AGIVertices[_0xe9c5('0x11')][_0xe9c5('0x1c1')]=function(_0x586c62){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x586c62[_0xe9c5('0x38')]));if(!this[_0xe9c5('0xa1')](_0x586c62[_0xe9c5('0x155')])){return this[_0xe9c5('0xe')]['error'](_0x586c62,_0xe9c5('0x156'));}logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x168'),this['channel'][_0xe9c5('0x3a')],_0x586c62['findBy']));var _0x581a66=this[_0xe9c5('0x51')]['sync'](this,_0x586c62[_0xe9c5('0x155')]);if(_0x581a66){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x157'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x586c62[_0xe9c5('0x155')]));this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x157'),this['channel'][_0xe9c5('0x3a')],_0x586c62[_0xe9c5('0x155')]));return{'code':0xc8,'result':_0xe9c5('0x158')};}else{logger['info'](util[_0xe9c5('0x27')](_0xe9c5('0x159'),this[_0xe9c5('0xe')][_0xe9c5('0x3a')],_0x586c62[_0xe9c5('0x155')]));this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util[_0xe9c5('0x27')](_0xe9c5('0x159'),this[_0xe9c5('0xe')]['callerid'],_0x586c62[_0xe9c5('0x155')]));return{'code':0xc8,'result':_0xe9c5('0x15a')};}};AGIVertices[_0xe9c5('0x11')]['voicemail']=function(_0x22c942){logger[_0xe9c5('0x2d')](util['format'](_0xe9c5('0x1c2'),_0x22c942[_0xe9c5('0x38')]));var _0x1ee8e5=this[_0xe9c5('0xe')][_0xe9c5('0x58')](_0xe9c5('0x1c3'),[_0x22c942['mailbox'],_0x22c942[_0xe9c5('0x76')]]);if(_0x1ee8e5[_0xe9c5('0xa9')]===-0x1){return _0x1ee8e5;}return this[_0xe9c5('0xe')][_0xe9c5('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0xe9c5('0x1c3'),_0x22c942[_0xe9c5('0x1c4')]));};AGIVertices['prototype'][_0xe9c5('0x1c5')]=function(_0x2ad635){logger[_0xe9c5('0x2d')](util[_0xe9c5('0x27')](_0xe9c5('0x1c6'),_0x2ad635[_0xe9c5('0x38')]));if(!this['isConfigured'](_0x2ad635[_0xe9c5('0xd4')])){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x2ad635,_0xe9c5('0x1c7'));}var _0xebfa51=this[_0xe9c5('0x12')][_0xe9c5('0x6f')](this,_0x2ad635[_0xe9c5('0xd4')]);if(!_0xebfa51){return this[_0xe9c5('0xe')][_0xe9c5('0x2b')](_0x2ad635,_0xe9c5('0xd6'));}var _0x443441=this[_0xe9c5('0xe')][_0xe9c5('0x12')](_0xebfa51);return{'code':0xc8,'result':_0x443441[_0xe9c5('0x9f')]?_0x443441[_0xe9c5('0x9f')]:'-'};};String[_0xe9c5('0x11')]['replaceAll']=function(_0x33485b,_0x12d315){return this[_0xe9c5('0x9d')](_0x33485b)[_0xe9c5('0x1c8')](_0x12d315);};module['exports']=AGIVertices;
\ No newline at end of file
index d5b5a5c..c5150bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7692=['name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','saveUnpause','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','acw','message','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x7692,0x19a));var _0x2769=function(_0x2db315,_0x58d720){_0x2db315=_0x2db315-0x0;var _0x12f9a2=_0x7692[_0x2db315];return _0x12f9a2;};'use strict';var _=require(_0x2769('0x0'));var moment=require('moment');var ami=require(_0x2769('0x1'));var logger=require(_0x2769('0x2'))('acw');var RpcUser=require(_0x2769('0x3'));var RpcVoiceAgentReport=require(_0x2769('0x4'));function Acw(_0x293d04){this[_0x2769('0x5')]=_0x293d04[_0x2769('0x5')];this[_0x2769('0x6')]=_0x293d04['agents'];this[_0x2769('0x7')]=_0x293d04[_0x2769('0x7')];this[_0x2769('0x8')]={};ami['on'](_0x2769('0x9'),this[_0x2769('0xa')][_0x2769('0xb')](this));ami['on'](_0x2769('0xc'),this[_0x2769('0xd')][_0x2769('0xb')](this));ami['on'](_0x2769('0xe'),this['syncHangup'][_0x2769('0xb')](this));ami['on'](_0x2769('0xf'),this[_0x2769('0x10')][_0x2769('0xb')](this));ami['on'](_0x2769('0x11'),this['syncAttendedTransfer'][_0x2769('0xb')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x2769('0xb')](this));ami['on'](_0x2769('0x12'),this[_0x2769('0x13')]['bind'](this));}function getDiff(_0xd0e282){var _0x4c8943=moment()[_0x2769('0x14')](0x0);var _0x616419=moment(_0xd0e282)['milliseconds'](0x0);return _0x4c8943[_0x2769('0x15')](_0x616419,_0x2769('0x16'));}Acw[_0x2769('0x17')][_0x2769('0x18')]=function(_0x3ce6ae){try{var _0x506c0b=this;var _0x498fb1=this[_0x2769('0x8')][_0x3ce6ae][_0x2769('0x19')];var _0x7d9119=this['channels'][_0x3ce6ae][_0x2769('0x1a')];var _0x2af2a9=this[_0x2769('0x5')][_0x7d9119];var _0x27e778=![];var _0x2f6fb4=_0x2769('0x1b');if(_0x2af2a9[_0x2769('0x1c')]){if(_0x2af2a9[_0x2769('0x1d')][_0x2769('0x1e')]){_0x27e778=!![];_0x2f6fb4=_0x2af2a9[_0x2769('0x1d')][_0x2769('0x1e')];}}return ami[_0x2769('0x1f')]({'action':_0x2769('0x20'),'interface':_0x498fb1,'paused':!![],'reason':_0x2f6fb4})['then'](function(){if(_0x506c0b['agents'][_0x498fb1]){return RpcUser['getAgent'](_0x506c0b[_0x2769('0x6')][_0x498fb1]['id'])[_0x2769('0x21')](function(_0x35046d){if(_0x35046d&&!_0x35046d[_0x2769('0x22')]){logger[_0x2769('0x23')](_0x2769('0x24'),_0x3ce6ae,_0x498fb1,_0x7d9119);var _0x23ba80=_0x506c0b[_0x2769('0x8')][_0x3ce6ae][_0x2769('0x25')]&&_0x506c0b[_0x2769('0x8')][_0x3ce6ae]['destlinkedid']?_0x506c0b[_0x2769('0x8')][_0x3ce6ae][_0x2769('0x26')]:_0x3ce6ae;return RpcUser[_0x2769('0x27')](_0x506c0b[_0x2769('0x6')][_0x498fb1],_0x2f6fb4,_0x23ba80)['then'](function(){if(!_0x27e778){_0x506c0b[_0x2769('0x7')][_0x498fb1]={};logger[_0x2769('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3ce6ae,_0x506c0b[_0x2769('0x5')][_0x7d9119][_0x2769('0x28')],_0x498fb1,_0x7d9119);_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x29')]=setTimeout(_0x506c0b[_0x2769('0x2a')][_0x2769('0xb')](_0x506c0b,_0x498fb1),_0x506c0b[_0x2769('0x5')][_0x7d9119][_0x2769('0x28')]*0x3e8);_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x2b')]=moment()[_0x2769('0x2c')](_0x2769('0x2d'));_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x2e')]=_0x3ce6ae;_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x1a')]=_0x7d9119;_0x506c0b['timers'][_0x498fb1][_0x2769('0x2f')]=function(){var _0x8a43b1=getDiff(_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x2b')]);clearTimeout(_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x29')]);_0x506c0b[_0x2769('0x7')][_0x498fb1][_0x2769('0x29')]=![];RpcVoiceAgentReport[_0x2769('0x30')]({'acwtime':_0x8a43b1},_0x506c0b['timers'][_0x498fb1]['uniqueid'],_0x498fb1)['then'](function(_0x3f3223){logger[_0x2769('0x23')](_0x2769('0x31'),_0x3ce6ae,_0x8a43b1,_0x3f3223);})[_0x2769('0x32')](function(_0x168a81){logger[_0x2769('0x33')](_0x2769('0x34'),_0x3ce6ae,_0x168a81);});delete _0x506c0b[_0x2769('0x7')][_0x498fb1];};}});}else{logger[_0x2769('0x23')](_0x2769('0x35'),_0x3ce6ae,_0x498fb1,_0x7d9119);}});}})['catch'](function(){logger[_0x2769('0x33')](_0x2769('0x36'),_0x3ce6ae,_0x506c0b['voiceQueues'][_0x7d9119][_0x2769('0x28')],_0x498fb1,_0x7d9119);})['finally'](function(){delete _0x506c0b[_0x2769('0x8')][_0x3ce6ae];});}catch(_0x48978a){logger[_0x2769('0x33')](_0x2769('0x37'),_0x48978a['message']);}};Acw[_0x2769('0x17')]['stopAcw']=function(_0x5d3155){try{var _0x559af9=this;if(_0x559af9[_0x2769('0x7')][_0x5d3155]){_0x559af9[_0x2769('0x7')][_0x5d3155][_0x2769('0x29')]=![];var _0x54a240=_0x559af9[_0x2769('0x7')][_0x5d3155]['uniqueid'];var _0x29433d=_0x559af9[_0x2769('0x7')][_0x5d3155][_0x2769('0x1a')];var _0x3a3788=_0x559af9[_0x2769('0x5')][_0x29433d][_0x2769('0x28')];logger[_0x2769('0x23')]('[%s][TIMER][STOP][AGENT:%s]',_0x54a240,_0x5d3155);RpcUser[_0x2769('0x38')](this[_0x2769('0x6')][_0x5d3155]);RpcVoiceAgentReport[_0x2769('0x30')]({'acwtime':_0x3a3788,'agentacw':!![]},_0x54a240,_0x5d3155)[_0x2769('0x21')](function(_0x1642c3){logger['info'](_0x2769('0x31'),_0x54a240,_0x3a3788,_0x1642c3);})[_0x2769('0x32')](function(_0x3d066b){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x54a240,_0x3d066b);});}else{logger[_0x2769('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5d3155);if(_0x559af9['timers']){logger['info'](_0x2769('0x39'),JSON['stringify'](_0x559af9['timers']));}}}catch(_0x436eb9){logger[_0x2769('0x33')]('[ACW][STOP]\x20%s',_0x436eb9['message']);}};Acw[_0x2769('0x17')]['syncAgentConnect']=function(_0x3d85db){try{if(this[_0x2769('0x5')][_0x3d85db[_0x2769('0x1a')]]&&(this[_0x2769('0x5')][_0x3d85db[_0x2769('0x1a')]]['acw']||this[_0x2769('0x5')][_0x3d85db[_0x2769('0x1a')]][_0x2769('0x1c')])){if(this[_0x2769('0x6')][_0x3d85db[_0x2769('0x19')]]){this[_0x2769('0x8')][_0x3d85db[_0x2769('0x2e')]]={'queue':_0x3d85db[_0x2769('0x1a')],'interface':_0x3d85db[_0x2769('0x19')],'destlinkedid':_0x3d85db[_0x2769('0x26')]};}}}catch(_0x1770f6){logger[_0x2769('0x33')](_0x2769('0x3a'),_0x1770f6['message']);}};Acw[_0x2769('0x17')][_0x2769('0x13')]=function(_0x1fed69){try{if(this[_0x2769('0x5')][_0x1fed69[_0x2769('0x1a')]]&&(this[_0x2769('0x5')][_0x1fed69[_0x2769('0x1a')]][_0x2769('0x3b')]||this[_0x2769('0x5')][_0x1fed69[_0x2769('0x1a')]][_0x2769('0x1c')])){if(this[_0x2769('0x6')][_0x1fed69[_0x2769('0x19')]]){this[_0x2769('0x8')][_0x1fed69[_0x2769('0x2e')]]={'queue':_0x1fed69[_0x2769('0x1a')],'interface':_0x1fed69[_0x2769('0x19')]};}}}catch(_0x4a7530){logger[_0x2769('0x33')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4a7530[_0x2769('0x3c')]);}};Acw[_0x2769('0x17')][_0x2769('0xd')]=function(_0x39db9d){try{if(this[_0x2769('0x8')][_0x39db9d[_0x2769('0x2e')]]&&_['isUndefined'](this[_0x2769('0x8')][_0x39db9d[_0x2769('0x2e')]][_0x2769('0x25')])){logger['info'](_0x2769('0x3d'),_0x39db9d[_0x2769('0x2e')]);this[_0x2769('0x18')](_0x39db9d['uniqueid']);}else if(this['channels'][_0x39db9d['linkedid']]&&_[_0x2769('0x3e')](this[_0x2769('0x8')][_0x39db9d[_0x2769('0x3f')]][_0x2769('0x25')])){logger['info'](_0x2769('0x40'),_0x39db9d[_0x2769('0x3f')]);this[_0x2769('0x18')](_0x39db9d[_0x2769('0x3f')]);}}catch(_0x43e589){logger['error'](_0x2769('0x41'),_0x43e589[_0x2769('0x3c')]);}};Acw['prototype']['syncHangup']=function(_0x30a99f){try{if(this['channels'][_0x30a99f['uniqueid']]&&this[_0x2769('0x8')][_0x30a99f[_0x2769('0x2e')]][_0x2769('0x25')]){logger['info'](_0x2769('0x42'),_0x30a99f[_0x2769('0x2e')]);this['startAcw'](_0x30a99f[_0x2769('0x2e')]);}else if(this[_0x2769('0x8')][_0x30a99f['linkedid']]&&this[_0x2769('0x8')][_0x30a99f[_0x2769('0x3f')]]['attended']){logger[_0x2769('0x23')](_0x2769('0x43'),_0x30a99f['linkedid']);this[_0x2769('0x18')](_0x30a99f[_0x2769('0x3f')]);}}catch(_0x373d2f){logger['error'](_0x2769('0x44'),_0x373d2f[_0x2769('0x3c')]);}};Acw[_0x2769('0x17')][_0x2769('0x45')]=function(_0x2c1c90){try{if(!_['isNil'](this[_0x2769('0x8')][_0x2c1c90[_0x2769('0x46')]])){this[_0x2769('0x18')](_0x2c1c90[_0x2769('0x46')]);if(this[_0x2769('0x8')][_0x2c1c90['secondtransfereruniqueid']]){this['channels'][_0x2c1c90[_0x2769('0x47')]]['attended']=!![];this[_0x2769('0x8')][_0x2c1c90['transfertargetuniqueid']]=this[_0x2769('0x8')][_0x2c1c90[_0x2769('0x47')]];delete this['channels'][_0x2c1c90['secondtransfereruniqueid']];}}else if(!_[_0x2769('0x48')](this[_0x2769('0x8')][_0x2c1c90[_0x2769('0x49')]])){this[_0x2769('0x18')](_0x2c1c90['transfertargetuniqueid']);if(this[_0x2769('0x8')][_0x2c1c90['origtransfereruniqueid']]){this[_0x2769('0x8')][_0x2c1c90[_0x2769('0x4a')]]['attended']=!![];this[_0x2769('0x8')][_0x2c1c90['transfereeuniqueid']]=this[_0x2769('0x8')][_0x2c1c90[_0x2769('0x4a')]];delete this[_0x2769('0x8')][_0x2c1c90[_0x2769('0x4a')]];}}}catch(_0x473aac){logger[_0x2769('0x33')](_0x2769('0x4b'),_0x473aac['message']);}};Acw[_0x2769('0x17')]['syncBlindTransfer']=function(_0x37f9c8){try{if(this[_0x2769('0x8')][_0x37f9c8[_0x2769('0x4c')]]){logger[_0x2769('0x23')](_0x2769('0x4d'),JSON['stringify'](_0x37f9c8[_0x2769('0x4c')]));this[_0x2769('0x18')](_0x37f9c8[_0x2769('0x4c')]);}else if(this[_0x2769('0x8')][_0x37f9c8['transfererlinkedid']]){logger['info'](_0x2769('0x4e'),JSON[_0x2769('0x4f')](_0x37f9c8[_0x2769('0x50')]));this[_0x2769('0x18')](_0x37f9c8[_0x2769('0x50')]);}}catch(_0x4439aa){logger[_0x2769('0x33')](_0x2769('0x51'),_0x4439aa[_0x2769('0x3c')]);}};Acw[_0x2769('0x17')]['syncAgentRingNoAnswer']=function(_0x514d94){try{if(this['voiceQueues'][_0x514d94[_0x2769('0x1a')]]&&this['voiceQueues'][_0x514d94[_0x2769('0x1a')]][_0x2769('0x52')]===_0x2769('0x53')){if(this['agents'][_0x514d94['interface']]){logger[_0x2769('0x23')](_0x2769('0x54'),_0x514d94[_0x2769('0x2e')],_0x514d94[_0x2769('0x19')],_0x514d94[_0x2769('0x1a')]);return RpcUser[_0x2769('0x27')](this[_0x2769('0x6')][_0x514d94[_0x2769('0x19')]],_0x2769('0x55'),_0x514d94['uniqueid']);}}}catch(_0x3cb952){logger['error'](_0x2769('0x56'),_0x3cb952[_0x2769('0x3c')]);}};module[_0x2769('0x57')]=Acw;
\ No newline at end of file
+var _0x9d7c=['update','catch','[ACW][TIMERS]','stringify','message','syncAgentConnect','mandatoryDisposition','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause'];(function(_0x32cefc,_0xdae63f){var _0x5e1823=function(_0x216025){while(--_0x216025){_0x32cefc['push'](_0x32cefc['shift']());}};_0x5e1823(++_0xdae63f);}(_0x9d7c,0x6c));var _0xc9d7=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0x9d7c[_0x3a723e];return _0x3e9c03;};'use strict';var _=require('lodash');var moment=require(_0xc9d7('0x0'));var ami=require(_0xc9d7('0x1'));var logger=require(_0xc9d7('0x2'))(_0xc9d7('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xc9d7('0x4'));function Acw(_0x1562b3){this[_0xc9d7('0x5')]=_0x1562b3['voiceQueues'];this[_0xc9d7('0x6')]=_0x1562b3['agents'];this[_0xc9d7('0x7')]=_0x1562b3['timers'];this[_0xc9d7('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xc9d7('0x9')](this));ami['on'](_0xc9d7('0xa'),this[_0xc9d7('0xb')][_0xc9d7('0x9')](this));ami['on'](_0xc9d7('0xc'),this[_0xc9d7('0xd')][_0xc9d7('0x9')](this));ami['on'](_0xc9d7('0xe'),this[_0xc9d7('0xf')][_0xc9d7('0x9')](this));ami['on']('attendedtransfer',this[_0xc9d7('0x10')][_0xc9d7('0x9')](this));ami['on'](_0xc9d7('0x11'),this[_0xc9d7('0x12')]['bind'](this));ami['on'](_0xc9d7('0x13'),this[_0xc9d7('0x14')][_0xc9d7('0x9')](this));}function getDiff(_0x3c011c){var _0x11db6e=moment()['milliseconds'](0x0);var _0x487421=moment(_0x3c011c)[_0xc9d7('0x15')](0x0);return _0x11db6e['diff'](_0x487421,_0xc9d7('0x16'));}Acw[_0xc9d7('0x17')]['startAcw']=function(_0x2a427a){try{var _0x5f2c3a=this;var _0x59d4ea=this[_0xc9d7('0x8')][_0x2a427a][_0xc9d7('0x18')];var _0x48f296=this['channels'][_0x2a427a][_0xc9d7('0x19')];var _0x476a29=this['voiceQueues'][_0x48f296];var _0x190902=![];var _0x46b727='ACW';if(_0x476a29['mandatoryDisposition']){if(_0x476a29[_0xc9d7('0x1a')][_0xc9d7('0x1b')]){_0x190902=!![];_0x46b727=_0x476a29[_0xc9d7('0x1a')][_0xc9d7('0x1b')];}}return ami[_0xc9d7('0x1c')]({'action':_0xc9d7('0x1d'),'interface':_0x59d4ea,'paused':!![],'reason':_0x46b727})[_0xc9d7('0x1e')](function(){if(_0x5f2c3a[_0xc9d7('0x6')][_0x59d4ea]){return RpcUser[_0xc9d7('0x1f')](_0x5f2c3a[_0xc9d7('0x6')][_0x59d4ea]['id'])[_0xc9d7('0x1e')](function(_0xaf2d9e){if(_0xaf2d9e&&!_0xaf2d9e[_0xc9d7('0x20')]){logger[_0xc9d7('0x21')](_0xc9d7('0x22'),_0x2a427a,_0x59d4ea,_0x48f296);var _0x15b885=_0x5f2c3a['channels'][_0x2a427a][_0xc9d7('0x23')]&&_0x5f2c3a[_0xc9d7('0x8')][_0x2a427a][_0xc9d7('0x24')]?_0x5f2c3a[_0xc9d7('0x8')][_0x2a427a][_0xc9d7('0x24')]:_0x2a427a;return RpcUser[_0xc9d7('0x25')](_0x5f2c3a['agents'][_0x59d4ea],_0x46b727,_0x15b885)[_0xc9d7('0x1e')](function(){if(!_0x190902){_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea]={};logger[_0xc9d7('0x21')](_0xc9d7('0x26'),_0x2a427a,_0x5f2c3a[_0xc9d7('0x5')][_0x48f296][_0xc9d7('0x27')],_0x59d4ea,_0x48f296);_0x5f2c3a['timers'][_0x59d4ea][_0xc9d7('0x28')]=setTimeout(_0x5f2c3a['stopAcw']['bind'](_0x5f2c3a,_0x59d4ea),_0x5f2c3a[_0xc9d7('0x5')][_0x48f296][_0xc9d7('0x27')]*0x3e8);_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea][_0xc9d7('0x29')]=moment()[_0xc9d7('0x2a')](_0xc9d7('0x2b'));_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea][_0xc9d7('0x2c')]=_0x2a427a;_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea]['queue']=_0x48f296;_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea][_0xc9d7('0x2d')]=function(){var _0x592952=getDiff(_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea][_0xc9d7('0x29')]);clearTimeout(_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea][_0xc9d7('0x28')]);_0x5f2c3a['timers'][_0x59d4ea]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x592952},_0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea]['uniqueid'],_0x59d4ea)[_0xc9d7('0x1e')](function(_0xeb506e){logger[_0xc9d7('0x21')](_0xc9d7('0x2e'),_0x2a427a,_0x592952,_0xeb506e);})['catch'](function(_0xa952cf){logger[_0xc9d7('0x2f')](_0xc9d7('0x30'),_0x2a427a,_0xa952cf);});delete _0x5f2c3a[_0xc9d7('0x7')][_0x59d4ea];};}});}else{logger[_0xc9d7('0x21')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2a427a,_0x59d4ea,_0x48f296);}});}})['catch'](function(){logger[_0xc9d7('0x2f')](_0xc9d7('0x26'),_0x2a427a,_0x5f2c3a['voiceQueues'][_0x48f296]['acwTimeout'],_0x59d4ea,_0x48f296);})['finally'](function(){delete _0x5f2c3a['channels'][_0x2a427a];});}catch(_0x28bafd){logger[_0xc9d7('0x2f')]('[ACW][START]\x20%s',_0x28bafd['message']);}};Acw[_0xc9d7('0x17')][_0xc9d7('0x31')]=function(_0xa45b54){try{var _0x58fdb3=this;if(_0x58fdb3['timers'][_0xa45b54]){_0x58fdb3[_0xc9d7('0x7')][_0xa45b54][_0xc9d7('0x28')]=![];var _0x5be7b1=_0x58fdb3[_0xc9d7('0x7')][_0xa45b54][_0xc9d7('0x2c')];var _0x5f3353=_0x58fdb3[_0xc9d7('0x7')][_0xa45b54][_0xc9d7('0x19')];var _0x4d3c51=_0x58fdb3[_0xc9d7('0x5')][_0x5f3353][_0xc9d7('0x27')];logger[_0xc9d7('0x21')](_0xc9d7('0x32'),_0x5be7b1,_0xa45b54);RpcUser[_0xc9d7('0x33')](this[_0xc9d7('0x6')][_0xa45b54]);RpcVoiceAgentReport[_0xc9d7('0x34')]({'acwtime':_0x4d3c51,'agentacw':!![]},_0x5be7b1,_0xa45b54)[_0xc9d7('0x1e')](function(_0x2a50ea){logger[_0xc9d7('0x21')](_0xc9d7('0x2e'),_0x5be7b1,_0x4d3c51,_0x2a50ea);})[_0xc9d7('0x35')](function(_0xc7e04e){logger[_0xc9d7('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x5be7b1,_0xc7e04e);});}else{logger[_0xc9d7('0x2f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0xa45b54);if(_0x58fdb3['timers']){logger['info'](_0xc9d7('0x36'),JSON[_0xc9d7('0x37')](_0x58fdb3['timers']));}}}catch(_0x7b95b4){logger[_0xc9d7('0x2f')]('[ACW][STOP]\x20%s',_0x7b95b4[_0xc9d7('0x38')]);}};Acw[_0xc9d7('0x17')][_0xc9d7('0x39')]=function(_0x416164){try{if(this['voiceQueues'][_0x416164[_0xc9d7('0x19')]]&&(this[_0xc9d7('0x5')][_0x416164[_0xc9d7('0x19')]][_0xc9d7('0x3')]||this[_0xc9d7('0x5')][_0x416164[_0xc9d7('0x19')]][_0xc9d7('0x3a')])){if(this[_0xc9d7('0x6')][_0x416164['interface']]){this[_0xc9d7('0x8')][_0x416164[_0xc9d7('0x2c')]]={'queue':_0x416164[_0xc9d7('0x19')],'interface':_0x416164[_0xc9d7('0x18')],'destlinkedid':_0x416164[_0xc9d7('0x24')]};}}}catch(_0x1d8df4){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x1d8df4[_0xc9d7('0x38')]);}};Acw[_0xc9d7('0x17')][_0xc9d7('0x14')]=function(_0x278a76){try{if(this[_0xc9d7('0x5')][_0x278a76[_0xc9d7('0x19')]]&&(this['voiceQueues'][_0x278a76[_0xc9d7('0x19')]][_0xc9d7('0x3')]||this['voiceQueues'][_0x278a76[_0xc9d7('0x19')]][_0xc9d7('0x3a')])){if(this[_0xc9d7('0x6')][_0x278a76[_0xc9d7('0x18')]]){this['channels'][_0x278a76[_0xc9d7('0x2c')]]={'queue':_0x278a76[_0xc9d7('0x19')],'interface':_0x278a76[_0xc9d7('0x18')]};}}}catch(_0x52ce92){logger[_0xc9d7('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x52ce92['message']);}};Acw['prototype'][_0xc9d7('0xb')]=function(_0x1b62ad){try{if(this[_0xc9d7('0x8')][_0x1b62ad[_0xc9d7('0x2c')]]&&_[_0xc9d7('0x3b')](this[_0xc9d7('0x8')][_0x1b62ad[_0xc9d7('0x2c')]][_0xc9d7('0x23')])){logger[_0xc9d7('0x21')](_0xc9d7('0x3c'),_0x1b62ad['uniqueid']);this[_0xc9d7('0x3d')](_0x1b62ad['uniqueid']);}else if(this['channels'][_0x1b62ad[_0xc9d7('0x3e')]]&&_[_0xc9d7('0x3b')](this['channels'][_0x1b62ad['linkedid']][_0xc9d7('0x23')])){logger['info'](_0xc9d7('0x3f'),_0x1b62ad[_0xc9d7('0x3e')]);this[_0xc9d7('0x3d')](_0x1b62ad[_0xc9d7('0x3e')]);}}catch(_0x5ead11){logger['error'](_0xc9d7('0x40'),_0x5ead11[_0xc9d7('0x38')]);}};Acw['prototype']['syncHangup']=function(_0x559267){try{if(this[_0xc9d7('0x8')][_0x559267[_0xc9d7('0x2c')]]&&this[_0xc9d7('0x8')][_0x559267[_0xc9d7('0x2c')]][_0xc9d7('0x23')]){logger['info'](_0xc9d7('0x41'),_0x559267['uniqueid']);this['startAcw'](_0x559267[_0xc9d7('0x2c')]);}else if(this[_0xc9d7('0x8')][_0x559267[_0xc9d7('0x3e')]]&&this[_0xc9d7('0x8')][_0x559267[_0xc9d7('0x3e')]][_0xc9d7('0x23')]){logger[_0xc9d7('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x559267[_0xc9d7('0x3e')]);this[_0xc9d7('0x3d')](_0x559267[_0xc9d7('0x3e')]);}}catch(_0x437d2f){logger['error']('[ACW][syncHangup]\x20%s',_0x437d2f[_0xc9d7('0x38')]);}};Acw[_0xc9d7('0x17')]['syncAttendedTransfer']=function(_0x3679bf){try{if(!_[_0xc9d7('0x42')](this[_0xc9d7('0x8')][_0x3679bf['transfereeuniqueid']])){this[_0xc9d7('0x3d')](_0x3679bf[_0xc9d7('0x43')]);if(this['channels'][_0x3679bf['secondtransfereruniqueid']]){this['channels'][_0x3679bf[_0xc9d7('0x44')]][_0xc9d7('0x23')]=!![];this[_0xc9d7('0x8')][_0x3679bf['transfertargetuniqueid']]=this[_0xc9d7('0x8')][_0x3679bf[_0xc9d7('0x44')]];delete this['channels'][_0x3679bf[_0xc9d7('0x44')]];}}else if(!_[_0xc9d7('0x42')](this['channels'][_0x3679bf[_0xc9d7('0x45')]])){this[_0xc9d7('0x3d')](_0x3679bf['transfertargetuniqueid']);if(this[_0xc9d7('0x8')][_0x3679bf['origtransfereruniqueid']]){this[_0xc9d7('0x8')][_0x3679bf[_0xc9d7('0x46')]][_0xc9d7('0x23')]=!![];this['channels'][_0x3679bf['transfereeuniqueid']]=this[_0xc9d7('0x8')][_0x3679bf[_0xc9d7('0x46')]];delete this[_0xc9d7('0x8')][_0x3679bf['origtransfereruniqueid']];}}}catch(_0x2ce60d){logger[_0xc9d7('0x2f')](_0xc9d7('0x47'),_0x2ce60d[_0xc9d7('0x38')]);}};Acw[_0xc9d7('0x17')][_0xc9d7('0x12')]=function(_0x27a4b7){try{if(this[_0xc9d7('0x8')][_0x27a4b7['transfereruniqueid']]){logger[_0xc9d7('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x27a4b7[_0xc9d7('0x48')]));this[_0xc9d7('0x3d')](_0x27a4b7[_0xc9d7('0x48')]);}else if(this['channels'][_0x27a4b7[_0xc9d7('0x49')]]){logger[_0xc9d7('0x21')](_0xc9d7('0x4a'),JSON[_0xc9d7('0x37')](_0x27a4b7['transfererlinkedid']));this[_0xc9d7('0x3d')](_0x27a4b7[_0xc9d7('0x49')]);}}catch(_0x327060){logger[_0xc9d7('0x2f')](_0xc9d7('0x4b'),_0x327060[_0xc9d7('0x38')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x135ba8){try{if(this[_0xc9d7('0x5')][_0x135ba8[_0xc9d7('0x19')]]&&this[_0xc9d7('0x5')][_0x135ba8[_0xc9d7('0x19')]]['autopause']===_0xc9d7('0x4c')){if(this[_0xc9d7('0x6')][_0x135ba8[_0xc9d7('0x18')]]){logger[_0xc9d7('0x21')](_0xc9d7('0x4d'),_0x135ba8[_0xc9d7('0x2c')],_0x135ba8[_0xc9d7('0x18')],_0x135ba8[_0xc9d7('0x19')]);return RpcUser[_0xc9d7('0x25')](this['agents'][_0x135ba8[_0xc9d7('0x18')]],_0xc9d7('0x4e'),_0x135ba8['uniqueid']);}}}catch(_0x1ffd46){logger[_0xc9d7('0x2f')](_0xc9d7('0x4f'),_0x1ffd46[_0xc9d7('0x38')]);}};module['exports']=Acw;
\ No newline at end of file
index 3d20748..e70750f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf88e=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','once','close','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry','sipshowregistry'];(function(_0x513a79,_0xe1b650){var _0x255ae7=function(_0x44d0f0){while(--_0x44d0f0){_0x513a79['push'](_0x513a79['shift']());}};_0x255ae7(++_0xe1b650);}(_0xf88e,0xef));var _0xef88=function(_0x413f1f,_0x2fc742){_0x413f1f=_0x413f1f-0x0;var _0x29372a=_0xf88e[_0x413f1f];return _0x29372a;};'use strict';var Manager=require(_0xef88('0x0'));var BPromise=require(_0xef88('0x1'));var util=require('util');var logger=require(_0xef88('0x2'))(_0xef88('0x3'));var config=require(_0xef88('0x4'));var ami=new Manager(config[_0xef88('0x5')]['port'],config[_0xef88('0x5')]['ip'],config[_0xef88('0x5')][_0xef88('0x6')],config['asterisk'][_0xef88('0x7')],!![]);ami[_0xef88('0x8')]();ami[_0xef88('0x9')]=BPromise[_0xef88('0xa')](ami[_0xef88('0xb')]);function error(_0x1c2e59){logger[_0xef88('0xc')](util[_0xef88('0xd')](_0xef88('0xe'),config[_0xef88('0x5')][_0xef88('0x6')],config['asterisk']['ip'],config[_0xef88('0x5')]['port'],util[_0xef88('0xf')](_0x1c2e59,![],null)));}function close(){logger['error'](util[_0xef88('0xd')](_0xef88('0x10'),config[_0xef88('0x5')][_0xef88('0x6')],config[_0xef88('0x5')]['ip'],config[_0xef88('0x5')][_0xef88('0x11')]));}ami[_0xef88('0x12')]=function(){return function(){return ami[_0xef88('0x9')]({'action':_0xef88('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xef88('0x9')]({'action':_0xef88('0x14')});};};ami[_0xef88('0x15')]=function(){return function(){return ami['Action']({'action':_0xef88('0x16')});};};ami[_0xef88('0x17')]=function(){return function(){return ami[_0xef88('0x9')]({'action':_0xef88('0x18')});};};ami[_0xef88('0x19')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(){logger[_0xef88('0x1a')](util[_0xef88('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xef88('0x5')][_0xef88('0x6')],config[_0xef88('0x5')]['ip'],config[_0xef88('0x5')][_0xef88('0x11')]));ami['once']('error',error);ami['once']('close',close);}ami['on'](_0xef88('0x1b'),connect);ami['on'](_0xef88('0x1c'),function(_0x20a8ff){logger[_0xef88('0x1a')](util[_0xef88('0xd')](_0xef88('0x1d'),config[_0xef88('0x5')][_0xef88('0x6')],config['asterisk']['ip'],config[_0xef88('0x5')][_0xef88('0x11')],util[_0xef88('0xf')](_0x20a8ff,![],null)));});ami['on'](_0xef88('0x1e'),function(){logger[_0xef88('0x1a')](util[_0xef88('0xd')](_0xef88('0x1f'),config[_0xef88('0x5')][_0xef88('0x6')],config[_0xef88('0x5')]['ip'],config[_0xef88('0x5')][_0xef88('0x11')]));return Promise['resolve']()['then'](ami[_0xef88('0x12')]())[_0xef88('0x20')](ami[_0xef88('0x21')]())['then'](ami[_0xef88('0x15')]())[_0xef88('0x20')](ami[_0xef88('0x17')]())[_0xef88('0x20')](ami['actionCoreShowChannels']())['catch'](function(_0xe74cc){logger['error']('[ami.js][fullybooted]',util['inspect'](_0xe74cc,{'showHidden':![],'depth':null}));});});ami[_0xef88('0x22')](_0xef88('0xc'),error);ami[_0xef88('0x22')](_0xef88('0x23'),close);module[_0xef88('0x24')]=ami;
\ No newline at end of file
+var _0x31b1=['promisify','action','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info','format','once','close','connect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','bluebird','util','../../config/logger','ami','asterisk','port','username','password','keepConnected'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31b1,0xa1));var _0x131b=function(_0x522409,_0x3b13b9){_0x522409=_0x522409-0x0;var _0xfa3182=_0x31b1[_0x522409];return _0xfa3182;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x131b('0x0'));var util=require(_0x131b('0x1'));var logger=require(_0x131b('0x2'))(_0x131b('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x131b('0x4')][_0x131b('0x5')],config[_0x131b('0x4')]['ip'],config['asterisk'][_0x131b('0x6')],config[_0x131b('0x4')][_0x131b('0x7')],!![]);ami[_0x131b('0x8')]();ami['Action']=BPromise[_0x131b('0x9')](ami[_0x131b('0xa')]);function error(_0x16e77b){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x131b('0x4')][_0x131b('0x6')],config[_0x131b('0x4')]['ip'],config['asterisk'][_0x131b('0x5')],util[_0x131b('0xb')](_0x16e77b,![],null)));}function close(){logger[_0x131b('0xc')](util['format'](_0x131b('0xd'),config[_0x131b('0x4')][_0x131b('0x6')],config[_0x131b('0x4')]['ip'],config[_0x131b('0x4')][_0x131b('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x131b('0xe')]({'action':_0x131b('0xf')});};};ami[_0x131b('0x10')]=function(){return function(){return ami[_0x131b('0xe')]({'action':_0x131b('0x11')});};};ami[_0x131b('0x12')]=function(){return function(){return ami[_0x131b('0xe')]({'action':_0x131b('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x131b('0xe')]({'action':_0x131b('0x14')});};};ami[_0x131b('0x15')]=function(){return function(){return ami[_0x131b('0xe')]({'action':'coreshowchannels'});};};function connect(){logger[_0x131b('0x16')](util[_0x131b('0x17')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x131b('0x6')],config['asterisk']['ip'],config['asterisk']['port']));ami[_0x131b('0x18')](_0x131b('0xc'),error);ami[_0x131b('0x18')](_0x131b('0x19'),close);}ami['on'](_0x131b('0x1a'),connect);ami['on']('shutdown',function(_0x387bec){logger[_0x131b('0x16')](util[_0x131b('0x17')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x131b('0x6')],config[_0x131b('0x4')]['ip'],config[_0x131b('0x4')][_0x131b('0x5')],util['inspect'](_0x387bec,![],null)));});ami['on'](_0x131b('0x1b'),function(){logger[_0x131b('0x16')](util[_0x131b('0x17')](_0x131b('0x1c'),config[_0x131b('0x4')]['username'],config[_0x131b('0x4')]['ip'],config['asterisk'][_0x131b('0x5')]));return Promise[_0x131b('0x1d')]()[_0x131b('0x1e')](ami[_0x131b('0x1f')]())[_0x131b('0x1e')](ami[_0x131b('0x10')]())[_0x131b('0x1e')](ami[_0x131b('0x12')]())['then'](ami['actionQueueSummary']())[_0x131b('0x1e')](ami[_0x131b('0x15')]())[_0x131b('0x20')](function(_0x53db89){logger[_0x131b('0xc')](_0x131b('0x21'),util[_0x131b('0xb')](_0x53db89,{'showHidden':![],'depth':null}));});});ami[_0x131b('0x18')](_0x131b('0xc'),error);ami[_0x131b('0x18')](_0x131b('0x19'),close);module['exports']=ami;
\ No newline at end of file
index e8a3cfc..7e6d412 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client;
\ No newline at end of file
+var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x4e291f,_0x202c9){var _0x3b2d52=function(_0x2004a8){while(--_0x2004a8){_0x4e291f['push'](_0x4e291f['shift']());}};_0x3b2d52(++_0x202c9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x505578,_0x46a4f0){_0x505578=_0x505578-0x0;var _0x333fc8=_0xf4eb[_0x505578];return _0x333fc8;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client;
\ No newline at end of file
index 4717fe2..4b6f420 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb244=['voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','isUndefined','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','queueStatusComplete','CAMPAIGN_STATUS','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','isIVRCampaignActive','\x20NOT\x20Active','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','is\x20disactive','isTrunkReachable','active','reachable','status','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','Action','command','iftime\x20%s,%s','interval','catch','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','checkIfTime','dialGlobalInterval','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','ivr','updateOriginated','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','getSeconds','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','verifyAdditionalPhones','voiceQueue','countabandonedretry','add','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','paused','stateinterface','locked','rrmemory','merge','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','variable','dialAMDActive','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','value','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countnoanswerretry','reason19\x20machine....','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','INACTIVE','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','user:%s','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','Agent','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','%s%s','toUpper','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedRetryFrequency','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','RUNNING','ivrTotalCallsDays','loggerHandler','[actionOriginateIvr]\x20','not_inuse','getContactDialer','countReScheduled','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb244,0x1f4));var _0x4b24=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb244[_0x2d7f0e];return _0x110b07;};'use strict';var util=require(_0x4b24('0x0'));var _=require('lodash');var uuid=require(_0x4b24('0x1'));var moment=require(_0x4b24('0x2'));var rr=require('rr');var Redis=require(_0x4b24('0x3'));var utils=require(_0x4b24('0x4'));var hopperUtils=require(_0x4b24('0x5'));var ut=require(_0x4b24('0x6'));var config=require(_0x4b24('0x7'));var logger=require(_0x4b24('0x8'))('dialer');var loggerBooked=require(_0x4b24('0x8'))('booked');var loggerPredictive=require(_0x4b24('0x8'))(_0x4b24('0x9'));var loggerPredictiveCalls=require(_0x4b24('0x8'))(_0x4b24('0xa'));var loggerSyncQueueSummary=require(_0x4b24('0x8'))(_0x4b24('0xb'));var ami=require(_0x4b24('0xc'));config[_0x4b24('0xd')]=_[_0x4b24('0xe')](config[_0x4b24('0xd')],{'host':_0x4b24('0xf'),'port':0x18eb});var io=require(_0x4b24('0x10'))(new Redis(config[_0x4b24('0xd')]));var cmHopper=require(_0x4b24('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0x4b24('0x12'));var Action=require(_0x4b24('0x13'));var History=require(_0x4b24('0x14'));var Final=require(_0x4b24('0x15'));var AgentComplete=require(_0x4b24('0x16'));var QueueCallerAbandon=require(_0x4b24('0x17'));var Hangup=require(_0x4b24('0x18'));var ipAgi=process['env'][_0x4b24('0x19')]||_0x4b24('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4b24('0x1b')][_0x4b24('0x1c')]=function(_0x295fd3){this['tail']=this[_0x4b24('0x1d')]?this[_0x4b24('0x1d')][_0x4b24('0x1e')](_0x295fd3):_0x295fd3();};function Dialer(_0x4481dc,_0x3f48fe){this[_0x4b24('0x1f')]=new Sequence();this[_0x4b24('0x20')]=_0x3f48fe;this[_0x4b24('0x21')]=_0x4481dc[_0x4b24('0x21')];this[_0x4b24('0x22')]=_0x4481dc['campaigns'];this[_0x4b24('0x23')]=_0x4481dc[_0x4b24('0x23')];this[_0x4b24('0x24')]=_0x4481dc[_0x4b24('0x24')];this[_0x4b24('0x25')]=config['maxNumberOriginate']||0x2;this[_0x4b24('0x26')]={};this[_0x4b24('0x27')]={};this[_0x4b24('0x28')]={};this[_0x4b24('0x29')]={};this[_0x4b24('0x2a')]={};this[_0x4b24('0x2b')]={};this[_0x4b24('0x2c')]={};this['ivrOriginated']={};this[_0x4b24('0x2d')]={};this[_0x4b24('0x2e')]={};this[_0x4b24('0x2f')]={};ami['on'](_0x4b24('0x30'),this[_0x4b24('0x31')][_0x4b24('0x32')](this));ami['on'](_0x4b24('0x33'),this['syncQueueCallerAbandon'][_0x4b24('0x32')](this));ami['on']('originateresponse',this[_0x4b24('0x34')][_0x4b24('0x32')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x4b24('0x32')](this));ami['on'](_0x4b24('0x35'),this[_0x4b24('0xb')]['bind'](this));ami['on'](_0x4b24('0x36'),this[_0x4b24('0x37')][_0x4b24('0x32')](this));ami['on'](_0x4b24('0x38'),this[_0x4b24('0x39')]['bind'](this));ami['on'](_0x4b24('0x3a'),this[_0x4b24('0x3b')][_0x4b24('0x32')](this));ami['on'](_0x4b24('0x3c'),this[_0x4b24('0x3d')][_0x4b24('0x32')](this));ami['on']('queuemember',this[_0x4b24('0x3e')][_0x4b24('0x32')](this));ami['on'](_0x4b24('0x3f'),this[_0x4b24('0x40')][_0x4b24('0x32')](this));this[_0x4b24('0x41')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x4b24('0x42')](function(_0x11f579){previewRecallmeReminderInterval=_0x11f579['previewRecallmeReminderInterval'];});}function isNotNull(_0x293760){return _0x293760!==null&&!_[_0x4b24('0x43')](_0x293760);}function msgResponse(_0x4df770,_0x3336fe,_0x139129){return{'action':_0x4df770,'response':_0x3336fe,'message':_0x139129,'stack':_0x139129};}function emit(_0xd34944,_0x3e168b,_0x5c299f){io['to'](_0xd34944)['emit'](_0x3e168b,_0x5c299f);}function emitOutboundVoiceQueueSummary(_0x360721){if(_0x360721[_0x4b24('0x44')]==='outbound'){logger[_0x4b24('0x45')](_0x4b24('0x46'),util[_0x4b24('0x47')](_0x360721,{'showHidden':![],'depth':null}));emit(util[_0x4b24('0x48')](_0x4b24('0x49'),_0x360721[_0x4b24('0x4a')]),'voice_queue:save',_0x360721);}}function checkGetDataPredictive(_0x232a5f){if(isNotNull(_0x232a5f)&&!_['isEmpty'](_0x232a5f)){loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x4c'));loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x4d'),_0x232a5f[_0x4b24('0x4e')]);loggerPredictive[_0x4b24('0x4b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x232a5f[_0x4b24('0x4f')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x232a5f[_0x4b24('0x50')]);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x51'),_0x232a5f[_0x4b24('0x52')]);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x53'),_0x232a5f[_0x4b24('0x54')]);loggerPredictive['info'](_0x4b24('0x55'),_0x232a5f[_0x4b24('0x56')]);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x57'));if(_0x232a5f[_0x4b24('0x4e')]>0x0){if(!_['isUndefined'](_0x232a5f[_0x4b24('0x56')])&&_0x232a5f[_0x4b24('0x56')]>0x0){return!![];}loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x58'));if(!_[_0x4b24('0x43')](_0x232a5f[_0x4b24('0x54')])&&_0x232a5f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x59'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x5a'));}return![];}function mergeDataErlangB(_0x187554){return function(_0x53c7a1){loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x5b'));loggerPredictive['info'](_0x4b24('0x5c'),_0x53c7a1[_0x4b24('0x5d')]);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x5e'),_0x53c7a1[_0x4b24('0x5f')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53c7a1[_0x4b24('0x60')]);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x61'),_0x53c7a1[_0x4b24('0x62')]);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x63'),_0x53c7a1[_0x4b24('0x60')]);loggerPredictive['info'](_0x4b24('0x57'));_['merge'](_0x187554,_0x53c7a1);};}function ifInterval(_0x56a615,_0x4fb03a){if(_[_0x4b24('0x43')](_0x4fb03a)){return![];}return utils['getSeconds'](undefined,_0x4fb03a)<_0x56a615*0x3c;}function clearPredictiveAttributes(_0x11d0a2){if(_0x11d0a2['startProgressive']){_0x11d0a2[_0x4b24('0x2c')]=undefined;loggerPredictive[_0x4b24('0x45')](_0x11d0a2[_0x4b24('0x4a')],_0x4b24('0x64'));}if(_0x11d0a2[_0x4b24('0x2b')]){_0x11d0a2['startPredictive']=undefined;loggerPredictive[_0x4b24('0x45')](_0x11d0a2[_0x4b24('0x4a')],_0x4b24('0x65'));}if(_0x11d0a2[_0x4b24('0x66')]){clearInterval(_0x11d0a2[_0x4b24('0x66')]);_0x11d0a2[_0x4b24('0x66')]=undefined;loggerPredictive[_0x4b24('0x45')](_0x11d0a2[_0x4b24('0x4a')],_0x4b24('0x67'));}}function loggerCatchPredictive(_0x3c19f1,_0x5110f4){return function(_0x16c9c8){loggerPredictive[_0x4b24('0x68')](_0x5110f4[_0x4b24('0x4a')],_0x3c19f1);loggerPredictive[_0x4b24('0x68')](_0x16c9c8['stack']);clearPredictiveAttributes(_0x5110f4);};}function loggerCatch(_0x21f49a){return function(_0x11b4d7){logger[_0x4b24('0x68')](_0x21f49a,util[_0x4b24('0x47')](_0x11b4d7,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xa15ae0,_0x4d8a04,_0x1931c3){return function(_0x35e3c7){utils[_0x4b24('0x69')](_0x4d8a04,_0x1931c3,0x0);logger[_0x4b24('0x68')](_0xa15ae0,util['inspect'](_0x35e3c7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x438fc2){return function(_0x6348f2){if(isNotNull(_0x6348f2)&&isNotNull(_0x6348f2[0x0])){if(_0x6348f2[0x0][_0x4b24('0x6a')]>0x0){_0x438fc2[_0x4b24('0x6b')]=utils['CAMPAIGN_STATUS'][_0x4b24('0x6c')];logger[_0x4b24('0x4b')](_0x4b24('0x6d')+_0x438fc2[_0x4b24('0x4a')],_0x6348f2[0x0][_0x4b24('0x6a')],_0x4b24('0x6e'));}else{_0x438fc2[_0x4b24('0x6b')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x4b24('0x4b')](_0x4b24('0x6f')+_0x438fc2[_0x4b24('0x4a')]);}}};}function createObjHistory(_0x442196,_0x2e27c8,_0x2c2acd,_0x589f35,_0x23774a){_0x442196['message']=_0x2c2acd;var _0x24e177=new Action(_0x442196,_0x2e27c8);var _0x259eab=new History(_0x24e177);_0x259eab[_0x4b24('0x70')]=_0x589f35;_0x259eab[_0x4b24('0x71')]=_0x23774a;_0x259eab[_0x4b24('0x72')]=_0x24e177[_0x4b24('0x73')];return _0x259eab;}function unlockQueueStatus(_0xb5bc4d,_0x899899){setTimeout(function(){if(_[_0x4b24('0x43')](_0xb5bc4d['queueStatusComplete'])){loggerBooked[_0x4b24('0x68')](_0x4b24('0x74'),_0x899899);}_0xb5bc4d['queueStatusComplete']=!![];loggerBooked[_0x4b24('0x4b')](_0x4b24('0x75'),_0x899899,JSON[_0x4b24('0x76')](_[_0x4b24('0x77')](_0xb5bc4d,[_0x4b24('0x4a'),_0x4b24('0x78')])));},0x1f3);}function checkInterval(_0xd0b946){return function(){if(!isNotNull(_0xd0b946['Interval'])){_0xd0b946[_0x4b24('0x6b')]=utils[_0x4b24('0x79')][_0x4b24('0x7a')];throw _0xd0b946[_0x4b24('0x4a')]+_0x4b24('0x7b');}if(!isNotNull(_0xd0b946[_0x4b24('0x7c')][_0x4b24('0x7d')])){_0xd0b946[_0x4b24('0x6b')]=utils[_0x4b24('0x79')]['NULL_INTERVAL'];throw _0xd0b946[_0x4b24('0x4a')]+_0x4b24('0x7b');}if(!isNotNull(_[_0x4b24('0x7e')](_0xd0b946['Interval'][_0x4b24('0x7d')]))){_0xd0b946[_0x4b24('0x6b')]=utils[_0x4b24('0x79')][_0x4b24('0x7a')];throw _0xd0b946[_0x4b24('0x4a')]+_0x4b24('0x7b');}};}function checkIsIVRCampaignActive(_0x57914e){return function(){if(!utils[_0x4b24('0x7f')](_0x57914e)){_0x57914e[_0x4b24('0x6b')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x57914e[_0x4b24('0x4a')]+_0x4b24('0x80');}};}function emitCampaignSummary(_0x494551){if(utils['isIVRCampaign'](_0x494551)){emit(util[_0x4b24('0x48')]('campaign:ivr:%s',_0x494551[_0x4b24('0x4a')]),'campaign:save',_0x494551);}}function loggerCatchQueueSummary(_0x5b6a9d,_0x37ca33){return function(_0x301938){clearPredictiveAttributes(_0x37ca33);emitCampaignSummary(_0x37ca33);loggerSyncQueueSummary[_0x4b24('0x45')](_0x5b6a9d,util['inspect'](_0x301938,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xd3a947){if(_0xd3a947[_0x4b24('0x81')]){if(_0xd3a947[_0x4b24('0x82')]===0x0){_0xd3a947['sendMessageOneNotActive']=![];_0xd3a947[_0x4b24('0x6b')]=utils[_0x4b24('0x79')]['INACTIVE'];loggerSyncQueueSummary[_0x4b24('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xd3a947[_0x4b24('0x4a')],_0x4b24('0x83'));}else{_0xd3a947[_0x4b24('0x6b')]=utils[_0x4b24('0x79')][_0x4b24('0x84')];loggerSyncQueueSummary[_0x4b24('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xd3a947[_0x4b24('0x4a')],_0x4b24('0x85'));}emitCampaignSummary(_0xd3a947);}}function myreject(_0xf0d3ca){return function(_0x7a0d77){return _0xf0d3ca(msgResponse('[ifTime][Action]','Error',JSON[_0x4b24('0x76')](_0x7a0d77)));};}Dialer[_0x4b24('0x1b')][_0x4b24('0x86')]=function(_0x312817){return!_[_0x4b24('0x43')](_0x312817)&&_0x312817&&!_['isUndefined'](_0x312817[_0x4b24('0x4a')])&&!_[_0x4b24('0x43')](_0x312817[_0x4b24('0x87')])&&_0x312817[_0x4b24('0x87')]&&(this[_0x4b24('0x24')][util[_0x4b24('0x48')]('SIP/%s',_0x312817['name'])]['status']===_0x4b24('0x88')||this[_0x4b24('0x24')][util[_0x4b24('0x48')]('SIP/%s',_0x312817[_0x4b24('0x4a')])][_0x4b24('0x89')]==='unmonitored');};Dialer[_0x4b24('0x1b')][_0x4b24('0x8a')]=function(_0x33c8de){var _0x539961=this;return function(){if(!_0x539961[_0x4b24('0x86')](_0x33c8de[_0x4b24('0x8b')])){if(!_0x539961[_0x4b24('0x86')](_0x33c8de[_0x4b24('0x8c')])){_0x33c8de[_0x4b24('0x6b')]=utils[_0x4b24('0x79')]['TRUNK_NOT_REACHABLE'];throw _0x33c8de[_0x4b24('0x4a')]+_0x4b24('0x8d');}}};};Dialer[_0x4b24('0x1b')]['checkIfTime']=function(_0x15e4fe,_0x3bb67b,_0x4e1513,_0xd6a2ba){var _0x348a92=this;return function(){var _0x140622=!![];return _0x348a92['ifTimeIvr'](_0x15e4fe,_0x3bb67b,_0x4e1513,_0xd6a2ba,_0x140622);};};Dialer[_0x4b24('0x1b')][_0x4b24('0x8e')]=function(_0x7fb578,_0xa10f9b,_0x39d7cb,_0x4dc1a9){var _0x1fba7e=this;return function(){var _0xf4976a=![];return _0x1fba7e['ifTimeIvr'](_0x7fb578[_0x4b24('0x7d')],_0xa10f9b,_0x39d7cb,_0x4dc1a9,_0xf4976a);};};Dialer['prototype'][_0x4b24('0x8f')]=function(_0x8086e0,_0x50eeee,_0x54ae25,_0x903b07,_0xb59bee){var _0x10f855=[];return new Promise(function(_0x91f0d0,_0x3632bf){if(!isNotNull(_0x8086e0)){_0x903b07[_0x4b24('0x6b')]=utils[_0x4b24('0x79')]['NULL_INTERVAL'];return _0x3632bf(msgResponse(_0x4b24('0x90'),_0x4b24('0x91'),_0x54ae25+_0x4b24('0x92')));}if(_['isEmpty'](_0x8086e0)){_0x903b07[_0x4b24('0x6b')]=utils[_0x4b24('0x79')][_0x4b24('0x93')];return _0x3632bf(msgResponse(_0x4b24('0x90'),_0x4b24('0x91'),_0x54ae25+'\x20Intervals\x20is\x20empty\x20'));}if(_0x50eeee&&_[_0x4b24('0x43')](config[_0x4b24('0x94')][_0x50eeee])){_0x903b07['message']=utils[_0x4b24('0x79')][_0x4b24('0x95')];return _0x3632bf(msgResponse(_0x4b24('0x90'),_0x4b24('0x91'),_0x54ae25+_0x4b24('0x96')+_0x50eeee));}if(_['isArray'](_0x8086e0)){for(var _0x4e5dbc=0x0;_0x4e5dbc<_0x8086e0[_0x4b24('0x97')];_0x4e5dbc+=0x1){_0x10f855[_0x4b24('0x98')](ami[_0x4b24('0x99')]({'action':_0x4b24('0x9a'),'command':util[_0x4b24('0x48')](_0x4b24('0x9b'),_0x8086e0[_0x4e5dbc][_0x4b24('0x9c')],!_[_0x4b24('0x43')](config[_0x4b24('0x94')][_0x50eeee])?_0x50eeee:'')})['then'](function(_0x17157b){return _0x17157b['content']['indexOf']('true')>=0x0;})[_0x4b24('0x9d')](myreject(_0x3632bf)));}}else{_0x10f855[_0x4b24('0x98')](ami[_0x4b24('0x99')]({'action':_0x4b24('0x9a'),'command':util[_0x4b24('0x48')](_0x4b24('0x9b'),_0x8086e0,!_[_0x4b24('0x43')](config[_0x4b24('0x94')][_0x50eeee])?_0x50eeee:'')})[_0x4b24('0x42')](function(_0x5cc5f3){return _0x5cc5f3['content'][_0x4b24('0x9e')](_0x4b24('0x9f'))>=0x0;})[_0x4b24('0x9d')](myreject(_0x3632bf)));}Promise[_0x4b24('0xa0')](_0x10f855)[_0x4b24('0x42')](function(_0x29c574){var _0x355149=_[_0x4b24('0xa1')](_0x29c574);if(_0x355149){return _0x91f0d0(_0x355149);}else{_0x903b07['message']=_0xb59bee?utils['CAMPAIGN_STATUS'][_0x4b24('0xa2')]:utils[_0x4b24('0x79')][_0x4b24('0xa3')];return _0x3632bf(msgResponse(_0x4b24('0xa4'),'Failure',_0x4b24('0xa5')+_0xb59bee+'\x20'+_0x54ae25+_0x4b24('0xa6')+util[_0x4b24('0x47')](_0x8086e0,{'showHidden':![],'depth':null})+_0x4b24('0xa7')+_0x50eeee));}})[_0x4b24('0x9d')](function(_0x371a54){return _0x3632bf(msgResponse(_0x4b24('0x90'),_0x4b24('0x91'),JSON[_0x4b24('0x76')](_0x371a54)));});});};Dialer['prototype'][_0x4b24('0x41')]=function(){var _0x162e27=this;return cmHopper[_0x4b24('0xa8')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x162e27['syncCampaigns']();},0x3e8);});};Dialer[_0x4b24('0x1b')][_0x4b24('0xa9')]=function(){var _0x119b67=this;var _0x396e61;for(var _0x54217e in this['campaigns']){if(typeof this[_0x4b24('0x22')][_0x54217e]!==_0x4b24('0xaa')){_0x396e61=this[_0x4b24('0x22')][_0x54217e];if(utils[_0x4b24('0xab')](_0x396e61)&&utils[_0x4b24('0x7f')](_0x396e61)){_0x396e61[_0x4b24('0x81')]=!![];Promise[_0x4b24('0xac')]()[_0x4b24('0x42')](checkIsIVRCampaignActive(_0x396e61))[_0x4b24('0x42')](checkInterval(_0x396e61))[_0x4b24('0x42')](_0x119b67[_0x4b24('0x8a')](_0x396e61))[_0x4b24('0x42')](_0x119b67[_0x4b24('0xad')](_0x396e61[_0x4b24('0xae')],_0x396e61['dialTimezone'],_0x396e61['name'],_0x396e61))[_0x4b24('0x42')](_0x119b67[_0x4b24('0x8e')](_0x396e61[_0x4b24('0x7c')],_0x396e61['dialTimezone'],_0x396e61['name'],_0x396e61))['then'](_0x119b67[_0x4b24('0xaf')](_0x396e61))[_0x4b24('0x9d')](loggerCatchQueueSummary('[syncCampaigns]',_0x396e61));}else{notSendMessagesCampaign(_0x396e61);}}}};Dialer[_0x4b24('0x1b')][_0x4b24('0xb0')]=function(_0x216ccd){if(_0x216ccd['dialMethod']!==_0x4b24('0x9')){clearPredictiveAttributes(_0x216ccd);}switch(_0x216ccd[_0x4b24('0xb1')]){case _0x4b24('0xb2'):this['handlePower'](_0x216ccd,0x1);break;case _0x4b24('0xb3'):this[_0x4b24('0xb4')](_0x216ccd,_0x216ccd[_0x4b24('0xb5')]);break;case _0x4b24('0x9'):this[_0x4b24('0x9')](_0x216ccd);break;case _0x4b24('0xb6'):this[_0x4b24('0xb4')](_0x216ccd,0x1);break;default:logger['error'](_0x4b24('0xb7'),_0x216ccd[_0x4b24('0x4a')],_0x4b24('0xb8'));}};Dialer[_0x4b24('0x1b')]['ifTime']=function(_0x2073c4,_0xe6a195){var _0x35f190=_0x2073c4['dialTimezone'];var _0x565bf6=_0xe6a195?_0x2073c4['dialGlobalInterval']:_0x2073c4[_0x4b24('0x7c')][_0x4b24('0x7d')];logger[_0x4b24('0xb9')]('Dialer::ifTime()',_0x565bf6,_0x35f190,_0x2073c4['name'],util['format'](_0x4b24('0xba'),_0x2073c4['name'],_0x2073c4['id']));var _0x493b6d=null;return Interval['intervalIftime'](_0x565bf6,_0x35f190)[_0x4b24('0x42')](function(_0x3216c1){if(_0x3216c1===!![]){return _0x3216c1;}else{_0x2073c4[_0x4b24('0x6b')]=_0xe6a195?utils[_0x4b24('0x79')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x4b24('0x79')][_0x4b24('0xa3')];_0x493b6d=msgResponse(_0x4b24('0xa4'),_0x4b24('0x91'),_0x4b24('0xa5')+_0xe6a195+'\x20'+_0x2073c4[_0x4b24('0x4a')]+_0x4b24('0xa6')+util[_0x4b24('0x47')](_0x565bf6,{'showHidden':![],'depth':null})+_0x4b24('0xa7')+_0x35f190);}if(_0x493b6d!==null){logger[_0x4b24('0xb9')](_0x4b24('0xbb'),_0x493b6d);_0x493b6d[_0x4b24('0xbc')]=_0xe6a195;throw _0x493b6d;}})[_0x4b24('0x9d')](function(_0x40fd0a){logger['error'](_0x4b24('0xbd'),_0x40fd0a);throw msgResponse('[ifTime][Action]',_0x4b24('0xbe'),util[_0x4b24('0x47')](_0x40fd0a,{'showHidden':![],'depth':null}));});};Dialer[_0x4b24('0x1b')][_0x4b24('0x31')]=function(_0x2b4a8f){if(this[_0x4b24('0x21')][_0x2b4a8f[_0x4b24('0xbf')]]){if(this['uniqueId'][_0x2b4a8f[_0x4b24('0xc0')]]&&this[_0x4b24('0x29')][_0x2b4a8f[_0x4b24('0xc0')]]['type']!==_0x4b24('0xc1')){this[_0x4b24('0xc2')](this[_0x4b24('0x21')][_0x2b4a8f[_0x4b24('0xbf')]]);this[_0x4b24('0x29')][_0x2b4a8f['uniqueid']]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x4b24('0x1b')][_0x4b24('0xc3')]=function(_0x341d19){var _0x5adf0b=this[_0x4b24('0x29')][_0x341d19[_0x4b24('0xc0')]];if(this[_0x4b24('0x21')][_0x341d19[_0x4b24('0xbf')]]){if(_0x5adf0b&&_0x5adf0b['type']!==_0x4b24('0xc1')){delete this[_0x4b24('0x29')][_0x341d19[_0x4b24('0xc0')]];this[_0x4b24('0x21')][_0x341d19['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3804c3=new AgentComplete(_0x5adf0b,_0x341d19);if(_0x341d19[_0x4b24('0xc4')]===_0x4b24('0xc5')){_0x3804c3[_0x4b24('0xc6')]=this[_0x4b24('0x21')][_0x341d19[_0x4b24('0xbf')]][_0x4b24('0xc7')]&&this[_0x4b24('0x21')][_0x341d19[_0x4b24('0xbf')]][_0x4b24('0xc8')]?moment()[_0x4b24('0x48')](_0x4b24('0xc9')):undefined;}hopperUtils[_0x4b24('0xca')](_0x3804c3)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xcb')));hopperUtils[_0x4b24('0xcc')](_0x3804c3)[_0x4b24('0x9d')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x4b24('0x1b')]['syncQueueCallerAbandon']=function(_0x1f299c){var _0x730ad4=this[_0x4b24('0x29')][_0x1f299c[_0x4b24('0xc0')]];var _0x69d604=this;var _0x3eeee9=![];var _0x2904ae;var _0x363be6;if(this[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]]){if(_0x730ad4&&_0x730ad4[_0x4b24('0x44')]!==_0x4b24('0xc1')){delete this[_0x4b24('0x29')][_0x1f299c[_0x4b24('0xc0')]];this[_0x4b24('0xc2')](this[_0x4b24('0x21')][_0x1f299c['queue']]);_0x730ad4[_0x4b24('0xcd')]=moment()[_0x4b24('0x48')](_0x4b24('0xc9'));var _0x118d04=new QueueCallerAbandon(_0x730ad4,_0x1f299c);if(utils[_0x4b24('0xce')](_0x730ad4[_0x4b24('0xcd')],_0x730ad4['responsetime'])>=_0x730ad4['dialQueueTimeout']){this[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]][_0x4b24('0xcf')]+=0x1;this['voiceQueues'][_0x1f299c['queue']][_0x4b24('0xd0')]+=0x1;_0x118d04[_0x4b24('0x70')]=0xa;_0x118d04[_0x4b24('0x71')]=_0x4b24('0xd1');_0x118d04[_0x4b24('0xd2')]=_0x4b24('0xd3');_0x118d04[_0x4b24('0xc6')]=this[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]]['dialQueueProject2']?moment()[_0x4b24('0x48')](_0x4b24('0xc9')):undefined;_0x118d04[_0x4b24('0xd4')]+=0x1;_0x118d04[_0x4b24('0xd5')]+=0x1;_0x2904ae=this['voiceQueues'][_0x1f299c[_0x4b24('0xbf')]][_0x4b24('0xd6')];_0x363be6=this[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]][_0x4b24('0xd7')];hopperUtils['verifyAdditionalPhones'](_0x118d04,_0x118d04[_0x4b24('0x70')],_0x730ad4['voiceQueue'])['then'](function(_0x41d78e){_0x3eeee9=_0x41d78e[_0x4b24('0xd8')]==0x1;if(_0x118d04[_0x4b24('0xd4')]>=_0x69d604[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]][_0x4b24('0xd9')]){_0x69d604[_0x4b24('0xda')](_0x118d04,_0x41d78e[_0x4b24('0xd8')]);}else{hopperUtils[_0x4b24('0xdb')]({'active':![],'countdropretry':_0x118d04[_0x4b24('0xd4')],'scheduledat':moment()['add'](_0x69d604['voiceQueues'][_0x1f299c[_0x4b24('0xbf')]][_0x4b24('0xd6')],_0x4b24('0xdc'))[_0x4b24('0x48')](_0x4b24('0xc9')),'ContactId':_0x730ad4[_0x4b24('0xdd')],'ListId':_0x730ad4[_0x4b24('0xde')],'VoiceQueueId':_0x730ad4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x730ad4[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xe1')));var _0x2eafa4=new History(_0x118d04);_0x2eafa4[_0x4b24('0x70')]=0xa;_0x2eafa4['statedesc']=_0x4b24('0xd1');_0x2eafa4[_0x4b24('0x73')]=moment()[_0x4b24('0x48')](_0x4b24('0xc9'));_0x2eafa4[_0x4b24('0x72')]=_0x2eafa4[_0x4b24('0x73')];_0x2eafa4[_0x4b24('0xe2')]=_0x118d04[_0x4b24('0xe2')];_0x2eafa4[_0x4b24('0xe3')]=_0x118d04[_0x4b24('0xe3')];hopperUtils[_0x4b24('0xca')](_0x2eafa4)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xe4')));}})[_0x4b24('0x42')](function(){if(_0x3eeee9)hopperUtils[_0x4b24('0xe5')](_0x118d04,_0x2904ae,_0x363be6)[_0x4b24('0x42')](function(){return 0x1;});});}else{this[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]][_0x4b24('0x52')]+=0x1;this[_0x4b24('0x21')][_0x1f299c['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x118d04[_0x4b24('0x70')]=0xb;_0x118d04['statedesc']=_0x4b24('0xe6');_0x118d04[_0x4b24('0xd2')]=_0x4b24('0xe7');_0x118d04['countabandonedretry']+=0x1;_0x118d04[_0x4b24('0xd5')]+=0x1;_0x2904ae=this['voiceQueues'][_0x1f299c['queue']]['dialAbandonedRetryFrequency'];_0x363be6=this[_0x4b24('0x21')][_0x1f299c['queue']][_0x4b24('0xd7')];hopperUtils[_0x4b24('0xe8')](_0x118d04,_0x118d04['state'],_0x730ad4[_0x4b24('0xe9')])[_0x4b24('0x42')](function(_0x776aa0){if(_0x118d04[_0x4b24('0xea')]>=_0x69d604[_0x4b24('0x21')][_0x1f299c['queue']]['dialAbandonedMaxRetry']){_0x69d604[_0x4b24('0xda')](_0x118d04,_0x776aa0[_0x4b24('0xd8')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x118d04[_0x4b24('0xea')],'scheduledat':moment()[_0x4b24('0xeb')](_0x69d604[_0x4b24('0x21')][_0x1f299c[_0x4b24('0xbf')]]['dialAbandonedRetryFrequency'],_0x4b24('0xdc'))[_0x4b24('0x48')](_0x4b24('0xc9')),'ContactId':_0x730ad4['ContactId'],'ListId':_0x730ad4['ListId'],'VoiceQueueId':_0x730ad4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x730ad4[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xec')));var _0x1bf59d=new History(_0x118d04);_0x1bf59d[_0x4b24('0x70')]=0xb;_0x1bf59d[_0x4b24('0x71')]=_0x4b24('0xe6');_0x1bf59d[_0x4b24('0x73')]=moment()['format'](_0x4b24('0xc9'));_0x1bf59d['endtime']=_0x1bf59d[_0x4b24('0x73')];_0x1bf59d[_0x4b24('0xe2')]=_0x118d04[_0x4b24('0xe2')];_0x1bf59d['calleridnum']=_0x118d04[_0x4b24('0xe3')];hopperUtils[_0x4b24('0xca')](_0x1bf59d)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xed')));}})[_0x4b24('0x42')](function(){if(_0x3eeee9)hopperUtils[_0x4b24('0xe5')](_0x118d04,_0x2904ae,_0x363be6)[_0x4b24('0x42')](function(){return 0x1;});});}}}};Dialer[_0x4b24('0x1b')][_0x4b24('0x3b')]=function(_0x1f29aa){if(this[_0x4b24('0x27')][_0x1f29aa[_0x4b24('0xc0')]]){this[_0x4b24('0x27')][_0x1f29aa[_0x4b24('0xc0')]][_0x4b24('0xee')]=_0x1f29aa['channel'];}if(this[_0x4b24('0x29')][_0x1f29aa['uniqueid']]){this['uniqueId'][_0x1f29aa[_0x4b24('0xc0')]][_0x4b24('0xee')]=_0x1f29aa[_0x4b24('0xee')];}};Dialer[_0x4b24('0x1b')]['syncQueueMember']=function(_0x5e24dc){if(!this[_0x4b24('0x27')][_0x5e24dc['actionid']]){return;}var _0x351b02=this[_0x4b24('0x21')][this[_0x4b24('0x27')][_0x5e24dc[_0x4b24('0xef')]]['queue']][_0x4b24('0xf0')]||'rrmemory';if(_0x351b02===_0x4b24('0xf1')){if(this[_0x4b24('0x27')][_0x5e24dc['actionid']]&&_[_0x4b24('0xf2')](this[_0x4b24('0x27')][_0x5e24dc[_0x4b24('0xef')]]['locked'])&&_0x5e24dc['status']==='1'&&_0x5e24dc[_0x4b24('0xf3')]==='0'){if(this[_0x4b24('0x23')][_0x5e24dc[_0x4b24('0xf4')]]){if(!this[_0x4b24('0x23')][_0x5e24dc[_0x4b24('0xf4')]]['locked']){this[_0x4b24('0x23')][_0x5e24dc[_0x4b24('0xf4')]][_0x4b24('0xf5')]=!![];this[_0x4b24('0x27')][_0x5e24dc[_0x4b24('0xef')]][_0x4b24('0xf5')]=!![];this[_0x4b24('0x27')][_0x5e24dc['actionid']][_0x4b24('0xf4')]=_0x5e24dc['stateinterface'];}}}}else if(_0x351b02===_0x4b24('0xf6')){if(this[_0x4b24('0x27')][_0x5e24dc['actionid']]){if(this[_0x4b24('0x23')][_0x5e24dc['stateinterface']]){this[_0x4b24('0x27')][_0x5e24dc['actionid']][_0x4b24('0xf4')]=_0x5e24dc['stateinterface'];if(_[_0x4b24('0xf2')](this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5e24dc[_0x4b24('0xef')]][_0x4b24('0xbf')]])){this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5e24dc[_0x4b24('0xef')]]['queue']]=[];}this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5e24dc[_0x4b24('0xef')]]['queue']][_0x4b24('0x98')](_[_0x4b24('0xf7')](_[_0x4b24('0x77')](this['actions'][_0x5e24dc['actionid']],[_0x4b24('0xf8'),'stateinterface']),{'status':_0x5e24dc['status'],'paused':_0x5e24dc[_0x4b24('0xf3')]}));}}}};Dialer[_0x4b24('0x1b')][_0x4b24('0x40')]=function(_0x5f1527){if(!this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]){return;}var _0x3ac25f=this;var _0x3a011d=this[_0x4b24('0x21')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]];var _0x169850=_0x3a011d[_0x4b24('0xf0')]||_0x4b24('0xf6');if(_0x169850===_0x4b24('0xf1')){if(this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]&&this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xf4')]){this[_0x4b24('0x20')][_0x4b24('0xf9')](this[_0x4b24('0x27')][_0x5f1527['actionid']]['idHopper'],this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xf4')])['catch'](function(_0x3900db){logger[_0x4b24('0x68')](_0x4b24('0xfa'),util[_0x4b24('0x47')](_0x3900db,{'showHidden':![],'depth':null}));})[_0x4b24('0x1e')](function(){_0x3ac25f[_0x4b24('0xc2')](_0x3ac25f[_0x4b24('0x21')][_0x3ac25f[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xbf')]]);_0x3ac25f[_0x4b24('0x23')][_0x3ac25f['actions'][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xf4')]][_0x4b24('0xf5')]=![];delete _0x3ac25f['actions'][_0x5f1527[_0x4b24('0xef')]];unlockQueueStatus(_0x3a011d);});}else{this[_0x4b24('0xc2')](this['voiceQueues'][this[_0x4b24('0x27')][_0x5f1527['actionid']]['queue']]);hopperUtils[_0x4b24('0xdb')]({'active':![],'ContactId':this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xdd')],'ListId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xde')],'VoiceQueueId':this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xdf')]||undefined,'CampaignId':this['actions'][_0x5f1527[_0x4b24('0xef')]]['CampaignId']||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xfb')));delete this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]];unlockQueueStatus(_0x3a011d);}}else if(_0x169850===_0x4b24('0xf6')){var _0x920bc0;if(this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]&&!_[_0x4b24('0x7e')](this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]['queue']])){if(this[_0x4b24('0x2e')][_0x3ac25f[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]['queue']]){this['queueBookedRR'][_0x3ac25f[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xbf')]]=this[_0x4b24('0x2e')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]?this[_0x4b24('0x2e')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]['queue']]:this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]?this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]][_0x4b24('0xfc')]||0x0:0x0;}this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xbf')]][_0x4b24('0xfc')]=this[_0x4b24('0x2e')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]];for(var _0x12f1af=0x0;_0x12f1af<this['queueBooked'][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]['queue']][_0x4b24('0x97')];_0x12f1af+=0x1){_0x920bc0=rr(this[_0x4b24('0x2d')][this[_0x4b24('0x27')][_0x5f1527['actionid']]['queue']]);this[_0x4b24('0x2e')][_0x3ac25f[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]['queue']]=this[_0x4b24('0x2d')][this['actions'][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]['_rr'];if(_0x920bc0['status']==='1'&&_0x920bc0['paused']==='0'){break;}}if(!_[_0x4b24('0xf2')](_0x920bc0)){this[_0x4b24('0x23')][_0x920bc0['stateinterface']][_0x4b24('0xfd')]=_[_0x4b24('0x43')](this[_0x4b24('0x23')][_0x920bc0[_0x4b24('0xf4')]][_0x4b24('0xfd')])?!![]:this['agents'][_0x920bc0[_0x4b24('0xf4')]][_0x4b24('0xfd')];}loggerBooked[_0x4b24('0x4b')](_0x4b24('0xfe'),_0x5f1527['actionid'],'Agent:\x20',JSON[_0x4b24('0x76')](_[_0x4b24('0x77')](this[_0x4b24('0x23')][_0x920bc0['stateinterface']],[_0x4b24('0x4a'),_0x4b24('0xfd')])),_0x4b24('0xff'),JSON[_0x4b24('0x76')](_0x920bc0[_0x4b24('0xf8')]));if(!_['isNil'](_0x920bc0)&&_0x920bc0[_0x4b24('0x89')]==='1'&&_0x920bc0[_0x4b24('0xf3')]==='0'&&this[_0x4b24('0x23')][_0x920bc0[_0x4b24('0xf4')]][_0x4b24('0xfd')]){this[_0x4b24('0x23')][_0x920bc0[_0x4b24('0xf4')]]['unlockRR']=![];this[_0x4b24('0x2d')][_0x3ac25f[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]=[];this[_0x4b24('0x20')][_0x4b24('0xf9')](_0x920bc0[_0x4b24('0xf8')],_0x920bc0[_0x4b24('0xf4')])[_0x4b24('0x9d')](function(_0x2bb535){logger[_0x4b24('0x68')](_0x4b24('0xfa'),util[_0x4b24('0x47')](_0x2bb535,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3ac25f['updateOriginated'](_0x3ac25f['voiceQueues'][_0x3ac25f['actions'][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]);setTimeout(function(){_0x3ac25f[_0x4b24('0x23')][_0x920bc0[_0x4b24('0xf4')]][_0x4b24('0xfd')]=!![];loggerBooked[_0x4b24('0x4b')](_0x4b24('0x100'),_0x5f1527[_0x4b24('0xef')],_0x4b24('0x101'),JSON['stringify'](_['pick'](_0x3ac25f['agents'][_0x920bc0[_0x4b24('0xf4')]],[_0x4b24('0x4a'),_0x4b24('0xfd')])),_0x4b24('0xff'),JSON[_0x4b24('0x76')](_0x920bc0[_0x4b24('0xf8')]));},0xc7);delete _0x3ac25f[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]];unlockQueueStatus(_0x3a011d,_0x5f1527[_0x4b24('0xef')]);});}else{loggerBooked[_0x4b24('0x4b')](_0x4b24('0x102'));this[_0x4b24('0xc2')](this[_0x4b24('0x21')][this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]);hopperUtils[_0x4b24('0xdb')]({'active':![],'ContactId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xdd')],'ListId':this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xde')],'VoiceQueueId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xdf')]||undefined,'CampaignId':this['actions'][_0x5f1527['actionid']][_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xfb')));delete this[_0x4b24('0x27')][_0x5f1527['actionid']];unlockQueueStatus(_0x3a011d);}}else{loggerBooked[_0x4b24('0x4b')](_0x4b24('0x103'));this[_0x4b24('0xc2')](this['voiceQueues'][this['actions'][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xbf')]]);hopperUtils[_0x4b24('0xdb')]({'active':![],'ContactId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]]['ContactId'],'ListId':this['actions'][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xde')],'VoiceQueueId':this['actions'][_0x5f1527['actionid']][_0x4b24('0xdf')]||undefined,'CampaignId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xe0')]||undefined})['catch'](loggerCatch(_0x4b24('0x104')));delete this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]];unlockQueueStatus(_0x3a011d);}}else{loggerBooked[_0x4b24('0x4b')](_0x4b24('0x105'));this[_0x4b24('0xc2')](this[_0x4b24('0x21')][this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xbf')]]);hopperUtils[_0x4b24('0xdb')]({'active':![],'ContactId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xdd')],'ListId':this['actions'][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xde')],'VoiceQueueId':this[_0x4b24('0x27')][_0x5f1527['actionid']][_0x4b24('0xdf')]||undefined,'CampaignId':this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]][_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x106')));delete this[_0x4b24('0x27')][_0x5f1527[_0x4b24('0xef')]];unlockQueueStatus(_0x3a011d);}};Dialer[_0x4b24('0x1b')][_0x4b24('0x34')]=function(_0x9b8df4){var _0x5a32b3=this[_0x4b24('0x27')][_0x9b8df4[_0x4b24('0xef')]];if(_0x5a32b3){delete this[_0x4b24('0x27')][_0x9b8df4[_0x4b24('0xef')]];_0x5a32b3[_0x4b24('0x107')]=moment()[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss');var _0x26bab9=_0x5a32b3['type']==='ivr'?this[_0x4b24('0x22')][_0x5a32b3[_0x4b24('0xbf')]]:this[_0x4b24('0x21')][_0x5a32b3[_0x4b24('0x108')]()];if(_0x9b8df4[_0x4b24('0x109')]!==_0x4b24('0x10a')){this[_0x4b24('0xc2')](_0x26bab9);return this[_0x4b24('0x10b')](_0x5a32b3,_0x26bab9,_0x9b8df4)[_0x4b24('0x9d')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x4b24('0x29')][_0x9b8df4['uniqueid']]=_0x5a32b3;}};Dialer[_0x4b24('0x1b')][_0x4b24('0x3d')]=function(_0x40d6f2){var _0x24b562=this;var _0x2b3264=this[_0x4b24('0x29')][_0x40d6f2[_0x4b24('0xc0')]];var _0x336ad;if(!_[_0x4b24('0xf2')](_0x40d6f2)&&!_[_0x4b24('0xf2')](_0x40d6f2[_0x4b24('0x10c')])&&!_[_0x4b24('0xf2')](_0x40d6f2[_0x4b24('0x10c')]['amdstatus'])&&_0x40d6f2['exten']==='xcally-motion-dialer'&&_0x2b3264){if(_0x2b3264[_0x4b24('0x44')]!==_0x4b24('0xc1')&&this[_0x4b24('0x21')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x10d')]&&_0x40d6f2['value']===_0x4b24('0x10e')){delete this[_0x4b24('0x29')][_0x40d6f2['uniqueid']];this[_0x4b24('0xc2')](this['voiceQueues'][_0x2b3264[_0x4b24('0xbf')]]);this['voiceQueues'][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x10f')]+=0x1;this[_0x4b24('0x21')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x110')]+=0x1;_0x336ad=new Hangup(_0x2b3264,_0x40d6f2);_0x336ad[_0x4b24('0x70')]=0x12;_0x336ad[_0x4b24('0x71')]=_0x4b24('0x111');_0x336ad[_0x4b24('0x112')]=_0x4b24('0x113');ami[_0x4b24('0x114')](_0x4b24('0x115'),ut[_0x4b24('0x116')](_0x336ad,_0x4b24('0x117')));this[_0x4b24('0x118')](_0x336ad,'[syncHangupInAMD][createHistory]',_0x4b24('0x119'));}if(_0x2b3264[_0x4b24('0x44')]!==_0x4b24('0xc1')&&this[_0x4b24('0x21')][_0x2b3264['queue']][_0x4b24('0x10d')]&&_0x40d6f2[_0x4b24('0x11a')]==='MACHINE'){return new Promise(function(_0xfd76f5,_0x11c713){delete _0x24b562['uniqueId'][_0x40d6f2['uniqueid']];_0x24b562['updateOriginated'](_0x24b562[_0x4b24('0x21')][_0x2b3264[_0x4b24('0xbf')]]);_0x24b562[_0x4b24('0x21')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x10f')]+=0x1;_0x24b562[_0x4b24('0x21')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x110')]+=0x1;var _0x5aa8a6=_0x24b562[_0x4b24('0x21')][_0x2b3264[_0x4b24('0xbf')]];var _0x1875d3=new Hangup(_0x2b3264,_0x40d6f2);_0x1875d3['state']=0x13;_0x1875d3['statedesc']=_0x4b24('0x11b');_0x1875d3[_0x4b24('0x112')]=_0x4b24('0x113');_0x1875d3['countmachineretry']+=0x1;_0x1875d3[_0x4b24('0xd5')]+=0x1;_0x1875d3[_0x4b24('0x117')]=!![];ami[_0x4b24('0x114')](_0x4b24('0x115'),ut[_0x4b24('0x116')](_0x1875d3,_0x4b24('0x117')));hopperUtils['createHistory'](_0x1875d3)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x11c')));if(_0x1875d3[_0x4b24('0x11d')]+_0x1875d3[_0x4b24('0x11e')]+_0x1875d3['countnoanswerretry']+_0x1875d3[_0x4b24('0x11f')]+_0x1875d3['countdropretry']+_0x1875d3[_0x4b24('0xea')]+_0x1875d3[_0x4b24('0x120')]+_0x1875d3[_0x4b24('0x121')]>=_0x5aa8a6[_0x4b24('0x122')]){_0x24b562[_0x4b24('0x123')](_0x1875d3,_0xfd76f5,_0x11c713,'reason19\x20machine....');}else{if(_0x1875d3[_0x4b24('0x120')]>=_0x5aa8a6[_0x4b24('0x124')]){_0x24b562['createStateFinal'](_0x1875d3,_0xfd76f5,_0x11c713,_0x4b24('0x125'));}else{hopperUtils[_0x4b24('0xdb')]({'active':![],'countmachineretry':_0x1875d3[_0x4b24('0x120')],'scheduledat':moment()[_0x4b24('0xeb')](_0x5aa8a6[_0x4b24('0x126')],_0x4b24('0xdc'))[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1875d3[_0x4b24('0xdd')],'ListId':_0x1875d3[_0x4b24('0xde')],'VoiceQueueId':_0x1875d3[_0x4b24('0xdf')]||undefined,'CampaignId':_0x1875d3[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x127')));_0xfd76f5({'reschedule':0x1});}}});}if(_0x2b3264[_0x4b24('0x44')]===_0x4b24('0xc1')&&this[_0x4b24('0x22')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x10d')]&&_0x40d6f2[_0x4b24('0x11a')]===_0x4b24('0x10e')){delete this[_0x4b24('0x29')][_0x40d6f2[_0x4b24('0xc0')]];this[_0x4b24('0xc2')](this['campaigns'][_0x2b3264[_0x4b24('0xbf')]]);_0x336ad=new Hangup(_0x2b3264,_0x40d6f2);_0x336ad[_0x4b24('0x70')]=0x12;_0x336ad[_0x4b24('0x71')]='HangupInAMD';_0x336ad[_0x4b24('0x112')]=_0x4b24('0x113');ami[_0x4b24('0x114')](_0x4b24('0x115'),ut[_0x4b24('0x116')](_0x336ad,'amd'));this['saveInDb'](_0x336ad,_0x4b24('0x128'),_0x4b24('0x129'));}if(_0x2b3264['type']===_0x4b24('0xc1')&&this['campaigns'][_0x2b3264['queue']][_0x4b24('0x10d')]&&_0x40d6f2[_0x4b24('0x11a')]===_0x4b24('0x12a')){return new Promise(function(_0x5224ef,_0x179ce9){delete _0x24b562['uniqueId'][_0x40d6f2[_0x4b24('0xc0')]];_0x24b562[_0x4b24('0xc2')](_0x24b562[_0x4b24('0x22')][_0x2b3264[_0x4b24('0xbf')]]);_0x24b562[_0x4b24('0x22')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x10f')]+=0x1;_0x24b562[_0x4b24('0x22')][_0x2b3264[_0x4b24('0xbf')]][_0x4b24('0x110')]+=0x1;var _0x3e134f=_0x24b562[_0x4b24('0x22')][_0x2b3264[_0x4b24('0xbf')]];var _0x5ae98d=new Hangup(_0x2b3264,_0x40d6f2);_0x5ae98d[_0x4b24('0x70')]=0x13;_0x5ae98d[_0x4b24('0x71')]='Machine';_0x5ae98d[_0x4b24('0x112')]=_0x4b24('0x113');_0x5ae98d[_0x4b24('0x120')]+=0x1;_0x5ae98d['countglobal']+=0x1;_0x5ae98d[_0x4b24('0x117')]=!![];ami['emit'](_0x4b24('0x115'),ut[_0x4b24('0x116')](_0x5ae98d,_0x4b24('0x117')));hopperUtils['createHistory'](_0x5ae98d)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x11c')));if(_0x5ae98d['countbusyretry']+_0x5ae98d[_0x4b24('0x11e')]+_0x5ae98d[_0x4b24('0x12b')]+_0x5ae98d[_0x4b24('0x11f')]+_0x5ae98d['countdropretry']+_0x5ae98d[_0x4b24('0xea')]+_0x5ae98d['countmachineretry']+_0x5ae98d[_0x4b24('0x121')]>=_0x3e134f[_0x4b24('0x122')]){_0x24b562[_0x4b24('0x123')](_0x5ae98d,_0x5224ef,_0x179ce9,_0x4b24('0x12c'));}else{if(_0x5ae98d['countmachineretry']>=_0x3e134f[_0x4b24('0x124')]){_0x24b562[_0x4b24('0x12d')](_0x5ae98d,_0x5224ef,_0x179ce9,_0x4b24('0x125'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5ae98d[_0x4b24('0x120')],'scheduledat':moment()[_0x4b24('0xeb')](_0x3e134f['dialMachineRetryFrequency'],_0x4b24('0xdc'))[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ae98d[_0x4b24('0xdd')],'ListId':_0x5ae98d[_0x4b24('0xde')],'VoiceQueueId':_0x5ae98d[_0x4b24('0xdf')]||undefined,'CampaignId':_0x5ae98d[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x127')));_0x5224ef({'reschedule':0x1});}}});}}};Dialer[_0x4b24('0x1b')][_0x4b24('0x39')]=function(_0x4c11c7){var _0x43d106=this[_0x4b24('0x29')][_0x4c11c7[_0x4b24('0xc0')]];var _0x5c2f73;if(_0x43d106&&_0x43d106[_0x4b24('0x44')]==='ivr'){delete this[_0x4b24('0x29')][_0x4c11c7[_0x4b24('0xc0')]];this[_0x4b24('0xc2')](this['campaigns'][_0x43d106[_0x4b24('0xbf')]]);this['campaigns'][_0x43d106[_0x4b24('0xbf')]][_0x4b24('0x12e')]+=0x1;_0x5c2f73=new Hangup(_0x43d106,_0x4c11c7);hopperUtils[_0x4b24('0xca')](_0x5c2f73)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x12f')));hopperUtils[_0x4b24('0xcc')](_0x5c2f73)[_0x4b24('0x9d')](loggerCatch('[syncHangupIvr]'));}if(_0x43d106&&_0x43d106[_0x4b24('0x44')]!=='ivr'&&isNotNull(this[_0x4b24('0x21')][_0x43d106['queue']]['dialQueueProject'])){delete this[_0x4b24('0x29')][_0x4c11c7['uniqueid']];this['updateOriginated'](this[_0x4b24('0x21')][_0x43d106[_0x4b24('0xbf')]]);this[_0x4b24('0x21')][_0x43d106[_0x4b24('0xbf')]]['outboundAnswerCallsDay']+=0x1;this[_0x4b24('0x21')][_0x43d106[_0x4b24('0xbf')]][_0x4b24('0x110')]+=0x1;_0x5c2f73=new Hangup(_0x43d106,_0x4c11c7);_0x5c2f73[_0x4b24('0x70')]=0x10;_0x5c2f73['statedesc']=_0x4b24('0x130');_0x5c2f73[_0x4b24('0x112')]='AGI';hopperUtils[_0x4b24('0xca')](_0x5c2f73)['catch'](loggerCatch(_0x4b24('0x12f')));hopperUtils['moveContactManagedDialer'](_0x5c2f73)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x131')));}if(_0x43d106&&_0x43d106[_0x4b24('0x44')]!=='ivr'&&!isNotNull(this[_0x4b24('0x21')][_0x43d106[_0x4b24('0xbf')]]['dialQueueProject'])){delete this[_0x4b24('0x29')][_0x4c11c7[_0x4b24('0xc0')]];this[_0x4b24('0xc2')](this[_0x4b24('0x21')][_0x43d106[_0x4b24('0xbf')]]);this[_0x4b24('0x21')][_0x43d106[_0x4b24('0xbf')]][_0x4b24('0x132')]+=0x1;_0x5c2f73=new Hangup(_0x43d106,_0x4c11c7);_0x5c2f73[_0x4b24('0x70')]=0xc;_0x5c2f73[_0x4b24('0x71')]=_0x4c11c7['cause-txt'];_0x5c2f73[_0x4b24('0x112')]=_0x4b24('0x133');hopperUtils[_0x4b24('0xca')](_0x5c2f73)[_0x4b24('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x5c2f73)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x131')));}};Dialer['prototype'][_0x4b24('0xb')]=function(_0x4e02fe){var _0x84c4be=this;if(!_0x84c4be[_0x4b24('0x2f')][_0x4e02fe[_0x4b24('0x4a')]]){_0x84c4be[_0x4b24('0x2f')][_0x4e02fe['name']]={'running':![]};}else if(_0x84c4be[_0x4b24('0x2f')][_0x4e02fe['name']][_0x4b24('0x134')]===!![]){return;}else if(_0x84c4be[_0x4b24('0x2f')][_0x4e02fe[_0x4b24('0x4a')]][_0x4b24('0x134')]===![]){_0x84c4be[_0x4b24('0x2f')][_0x4e02fe[_0x4b24('0x4a')]][_0x4b24('0x134')]=!![];}var _0x2a8be5=_0x84c4be[_0x4b24('0x21')][_0x4e02fe[_0x4b24('0x4a')]];var _0x217a55=_0x2a8be5['message']!==utils[_0x4b24('0x79')]['INACTIVE'];var _0x1526a1=utils[_0x4b24('0x135')](_0x2a8be5);_0x2a8be5[_0x4b24('0x136')]=utils['getQueueCampaignStatusMessage'](_0x2a8be5,_0x84c4be[_0x4b24('0x24')]);Promise[_0x4b24('0xac')]()['then'](function(){if(_0x2a8be5[_0x4b24('0x136')]===utils[_0x4b24('0x79')][_0x4b24('0x137')]){if(_0x217a55){clearPredictiveAttributes(_0x2a8be5);_0x4e02fe[_0x4b24('0x2b')]=undefined;_0x4e02fe[_0x4b24('0x2c')]=undefined;}if(_0x2a8be5[_0x4b24('0x136')]===utils[_0x4b24('0x79')]['INACTIVE']){_0x4e02fe[_0x4b24('0x138')]=0x0;_0x4e02fe[_0x4b24('0xf3')]=0x0;_0x4e02fe[_0x4b24('0x139')]=0x0;_0x4e02fe[_0x4b24('0x13a')]=0x0;_0x4e02fe[_0x4b24('0x13b')]=0x0;}}else if(_0x2a8be5[_0x4b24('0x136')]===utils[_0x4b24('0x79')][_0x4b24('0x13c')]&&!_0x1526a1){return _0x84c4be[_0x4b24('0x90')](_0x2a8be5,!![])[_0x4b24('0x42')](function(){return _0x84c4be[_0x4b24('0x90')](_0x2a8be5,![]);})[_0x4b24('0x42')](function(){return _0x84c4be[_0x4b24('0xb0')](_0x2a8be5);})[_0x4b24('0x9d')](function(_0x542f85){loggerSyncQueueSummary['debug'](_0x4b24('0x13d'),util['inspect'](_0x542f85,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2a8be5);});}else{clearPredictiveAttributes(_0x2a8be5);}})[_0x4b24('0x42')](function(){var _0x36f1f6=_0x4e02fe['compareToOutboundQueue'](_0x2a8be5);if(_0x36f1f6||_0x2a8be5[_0x4b24('0x13e')]){_0x2a8be5['queueSummaryCountersUpdated']=![];_0x4e02fe[_0x4b24('0x13f')](_0x2a8be5);Object[_0x4b24('0x140')](_0x2a8be5,_0x4e02fe);emitOutboundVoiceQueueSummary(_0x4e02fe);}_0x84c4be['queuesSummary'][_0x2a8be5['name']]['running']=![];})['catch'](function(_0x5d9f4f){logger['error'](_0x4b24('0x13d'),util[_0x4b24('0x47')](_0x5d9f4f,{'showHidden':![],'depth':null}));_0x84c4be['queuesSummary'][_0x2a8be5[_0x4b24('0x4a')]]['running']=![];});};Dialer[_0x4b24('0x1b')][_0x4b24('0x37')]=_[_0x4b24('0x141')](function(){var _0x137858=_[_0x4b24('0x142')](this['voiceQueues'],function(_0x34542d){return _0x34542d['dialPreviewRecallmeReminder'];});var _0x5e3f5e=_[_0x4b24('0x142')](this[_0x4b24('0x23')],function(_0x50d004){return _0x50d004[_0x4b24('0x143')]&&_0x50d004[_0x4b24('0x89')]===_0x4b24('0x88');});if(_0x137858['length']>0x0&&_0x5e3f5e[_0x4b24('0x97')]>0x0){return Promise[_0x4b24('0xac')]()[_0x4b24('0x42')](cmHopper[_0x4b24('0x144')](_['map'](_0x137858,'id'),previewRecallmeReminderInterval,_[_0x4b24('0x145')](_0x5e3f5e,'id')))[_0x4b24('0x42')](function(_0x1c871b){for(var _0x2679b2=0x0;_0x2679b2<_0x1c871b[_0x4b24('0x97')];_0x2679b2++){var _0x1787fa=_0x1c871b[_0x2679b2]['Agent'][_0x4b24('0x4a')];if(_0x1787fa)io['to'](util['format'](_0x4b24('0x146'),_0x1787fa))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x1c871b[_0x2679b2]});}})[_0x4b24('0x9d')](function(_0xe1a164){logger[_0x4b24('0x68')](_0x4b24('0x147'),_0xe1a164);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x4b24('0x148')]=function(){var _0xb57a6b=this;setInterval(function(){_0xb57a6b[_0x4b24('0x149')](_0xb57a6b['uniqueId'],_0x4b24('0x14a'));_0xb57a6b[_0x4b24('0x149')](_0xb57a6b[_0x4b24('0x27')],'[actions]');},0x32c8);};Dialer[_0x4b24('0x1b')]['clearZombieChannels']=function(_0x42e549,_0x11b0da){var _0x12ecfa=this;for(var _0xa23f43 in _0x42e549){if(typeof _0x42e549[_0xa23f43]!==_0x4b24('0xaa')){this[_0x4b24('0x1f')][_0x4b24('0x1c')](function(){if(!_[_0x4b24('0xf2')](_0x42e549[_0xa23f43])){return ami['Action']({'action':'status','channel':_0x42e549[_0xa23f43]['channel']})[_0x4b24('0x9d')](function(_0x488b68){if(_0x488b68['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x42e549[_0xa23f43]&&_0x42e549[_0xa23f43][_0x4b24('0x44')]!==_0x4b24('0xc1')){_0x12ecfa[_0x4b24('0xc2')](_0x12ecfa[_0x4b24('0x21')][_0x42e549[_0xa23f43][_0x4b24('0xbf')]]);logger[_0x4b24('0x68')](_0x4b24('0x14b'),_0x11b0da,_0xa23f43,_0x42e549[_0xa23f43][_0x4b24('0xbf')]);delete _0x42e549[_0xa23f43];}if(_0x42e549[_0xa23f43]&&_0x42e549[_0xa23f43][_0x4b24('0x44')]===_0x4b24('0xc1')){_0x12ecfa[_0x4b24('0xc2')](_0x12ecfa['campaigns'][_0x42e549[_0xa23f43][_0x4b24('0xbf')]]);logger[_0x4b24('0x68')]('[Dialer][checkChannel][ivr]',_0x11b0da,_0xa23f43,_0x42e549[_0xa23f43]['queue']);delete _0x42e549[_0xa23f43];}},0x2328);}});}});}}};Dialer[_0x4b24('0x1b')][_0x4b24('0x14c')]=function(_0x486a5c){return Promise[_0x4b24('0xac')]()[_0x4b24('0x42')](voiceQueueRt[_0x4b24('0x14c')](_0x486a5c))['catch'](loggerCatch(_0x4b24('0x14d')));};Dialer[_0x4b24('0x1b')][_0x4b24('0xc2')]=function(_0x29e6fa){if(!_[_0x4b24('0x43')](_0x29e6fa)&&_0x29e6fa!==null){if(typeof _0x29e6fa[_0x4b24('0x82')]!==_0x4b24('0xaa')){if(_0x29e6fa['originated']>0x0){_0x29e6fa[_0x4b24('0x82')]-=0x1;}else{logger['error'](_0x4b24('0x14e'));}}}else{logger[_0x4b24('0x68')](_0x4b24('0x14f'));}};Dialer[_0x4b24('0x1b')]['loggerHandler']=function(_0x4f6589,_0x1d839b){var _0x5bafb9=this;return function(_0x37fd67){_0x5bafb9[_0x4b24('0xc2')](_0x1d839b);logger[_0x4b24('0x68')](_0x4f6589,util[_0x4b24('0x47')](_0x37fd67,{'showHidden':![],'depth':null}));};};Dialer[_0x4b24('0x1b')][_0x4b24('0x150')]=function(_0x1599cf,_0x39e08a,_0x5ddd12){var _0x3b273d={'state':0x19,'statedesc':_0x4b24('0x151')};this[_0x4b24('0xc2')](_0x39e08a);this[_0x4b24('0x118')](_[_0x4b24('0xf7')](_0x3b273d,_[_0x4b24('0x77')](_0x5ddd12,[_0x4b24('0xdd'),'ListId','UserId',_0x4b24('0xdf'),_0x4b24('0xe0')])),_0x4b24('0x152'),_0x4b24('0x153'));logger[_0x4b24('0x68')](_0x1599cf);};Dialer['prototype']['saveInDb']=function(_0x39c7db,_0x3e4183,_0x1c6cab){hopperUtils[_0x4b24('0xca')](_0x39c7db)[_0x4b24('0x9d')](loggerCatch(_0x3e4183));hopperUtils[_0x4b24('0xcc')](_0x39c7db)[_0x4b24('0x9d')](loggerCatch(_0x1c6cab));};Dialer[_0x4b24('0x1b')][_0x4b24('0xda')]=function(_0x40c611,_0x6e1c4){hopperUtils['createHistory'](_0x40c611)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xcb')));if(_0x6e1c4==0x0){hopperUtils[_0x4b24('0xcc')](_0x40c611)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x4b24('0x147')]=function(_0x3174d8){return Promise[_0x4b24('0xac')]()[_0x4b24('0x42')](cmHopper[_0x4b24('0x144')](_0x3174d8['id'],previewRecallmeReminderInterval))[_0x4b24('0x42')](function(_0x3fdfa1){for(var _0x40ae5e=0x0;_0x40ae5e<_0x3fdfa1['length'];_0x40ae5e++){var _0x5c96b6=_0x3fdfa1[_0x40ae5e][_0x4b24('0x154')][_0x4b24('0x4a')];if(_0x5c96b6)io['to'](util[_0x4b24('0x48')](_0x4b24('0x146'),_0x5c96b6))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x3fdfa1[_0x40ae5e]});}})[_0x4b24('0x9d')](function(){});};Dialer[_0x4b24('0x1b')][_0x4b24('0xaf')]=function(_0x3f7437){var _0x25dfbb=this;return function(){_0x25dfbb[_0x4b24('0x155')](_0x3f7437);};};Dialer['prototype'][_0x4b24('0x156')]=function(_0x1ebb86,_0x1614bf){var _0x5cae8f=this;var _0xe47b51=uuid['v4']();this['actions'][_0xe47b51]=new Action(_0x1ebb86,_0x1614bf,_0xe47b51);return new Promise(function(_0x2c7382,_0x2ab1bb){if(_[_0x4b24('0x43')](_0x1ebb86)&&typeof _0x1ebb86!==_0x4b24('0x157')){return _0x2ab1bb(msgResponse('originate',_0x4b24('0x91'),_0x4b24('0x158')));}if(_[_0x4b24('0x43')](_0x1614bf['phone'])||_0x1614bf['phone']===null){return _0x2ab1bb(msgResponse(_0x4b24('0x159'),_0x4b24('0x91'),_0x4b24('0x15a')));}var _0x9c6e7a={'XMD-CALLERID':_0x5cae8f[_0x4b24('0x27')][_0xe47b51][_0x4b24('0x15b')](),'XMD-AGI':_0x1ebb86['dialQueueProject']?util[_0x4b24('0x48')](_0x4b24('0x15c'),ipAgi,_0x1ebb86[_0x4b24('0x15d')]):_0x4b24('0x15e'),'XMD-AGIAFTER':_0x1ebb86[_0x4b24('0xc7')]?util[_0x4b24('0x48')](_0x4b24('0x15c'),ipAgi,_0x1ebb86[_0x4b24('0xc7')]):_0x4b24('0x15e'),'XMD-QUEUE':utils[_0x4b24('0x15f')](_0x1ebb86)?util['format'](_0x4b24('0x160'),_0x1ebb86[_0x4b24('0x4a')],_0x1ebb86[_0x4b24('0x161')]||'',_0x1ebb86[_0x4b24('0xc8')]?'c':'',_0x1ebb86[_0x4b24('0x162')]||0x3):_0x4b24('0x15e'),'XMD-CONTACTID':_0x1614bf[_0x4b24('0xdd')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5cae8f[_0x4b24('0x27')][_0xe47b51][_0x4b24('0x15b')](),'XMD-AMD':_0x1ebb86[_0x4b24('0x10d')]?_0x4b24('0x13c'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1ebb86[_0x4b24('0x10d')]){_0x9c6e7a[_0x4b24('0x163')]=_0x1ebb86[_0x4b24('0x164')]||0x9c4;_0x9c6e7a['XMD-AMDGREETING']=_0x1ebb86['dialAMDGreeting']||0x5dc;_0x9c6e7a[_0x4b24('0x165')]=_0x1ebb86[_0x4b24('0x166')]||0x320;_0x9c6e7a['XMD-AMDTOTALANALYSISTIME']=_0x1ebb86[_0x4b24('0x167')]||0x1388;_0x9c6e7a[_0x4b24('0x168')]=_0x1ebb86[_0x4b24('0x169')]||0x64;_0x9c6e7a[_0x4b24('0x16a')]=_0x1ebb86[_0x4b24('0x16b')]||0x32;_0x9c6e7a[_0x4b24('0x16c')]=_0x1ebb86[_0x4b24('0x16d')]||0x3;_0x9c6e7a[_0x4b24('0x16e')]=_0x1ebb86[_0x4b24('0x16f')]||0x100;_0x9c6e7a['XMD-AMDMAXIMUMWORDLENGTH']=_0x1ebb86[_0x4b24('0x170')]||0x1388;}if(utils[_0x4b24('0x15f')](_0x1ebb86)){_0x9c6e7a['XMD-VOICEQUEUEID']=_0x1614bf[_0x4b24('0xdf')];}else{_0x9c6e7a[_0x4b24('0x171')]=_0x1614bf[_0x4b24('0xe0')];}for(var _0x21c7fb in _0x1614bf[_0x4b24('0x172')]){if(typeof _0x1614bf['Contact'][_0x21c7fb]!==_0x4b24('0xaa')){if(isNotNull(_0x1614bf[_0x4b24('0x172')][_0x21c7fb])&&_0x21c7fb!=='id'&&_0x21c7fb!==_0x4b24('0x173')&&_0x21c7fb!=='createdAt'&&_0x21c7fb!=='updatedAt'){_0x9c6e7a[util['format'](_0x4b24('0x174'),'XMD-',_[_0x4b24('0x175')](_0x21c7fb))]=_0x1614bf[_0x4b24('0x172')][_0x21c7fb];}}}var _0x58c03b=_0x5cae8f['isTrunkReachable'](_0x1ebb86['Trunk'])?utils['getCallerId'](_0x1ebb86[_0x4b24('0x8b')][_0x4b24('0x176')],_0x1ebb86['dialOriginateCallerIdName'],_0x1ebb86[_0x4b24('0x177')]>0x0?utils[_0x4b24('0x178')](_0x1ebb86[_0x4b24('0x179')],_0x1ebb86['dialRandomLastDigitCallerIdNumber']):_0x1ebb86[_0x4b24('0x179')]):utils['getCallerId'](_[_0x4b24('0xf2')](_0x1ebb86[_0x4b24('0x8c')])?_0x1ebb86['Trunk'][_0x4b24('0x176')]:_0x1ebb86['TrunkBackup'][_0x4b24('0x176')],_0x1ebb86['dialOriginateCallerIdName'],_0x1ebb86[_0x4b24('0x177')]>0x0?utils[_0x4b24('0x178')](_0x1ebb86[_0x4b24('0x179')],_0x1ebb86['dialRandomLastDigitCallerIdNumber']):_0x1ebb86['dialOriginateCallerIdNumber']);if(_0x58c03b){_0x9c6e7a[_0x4b24('0x17a')]=_0x5cae8f[_0x4b24('0x27')][_0xe47b51][_0x4b24('0x17b')]=utils[_0x4b24('0x17c')](_0x58c03b);_0x9c6e7a[_0x4b24('0x17d')]=_0x1614bf['phone'];}_0x1ebb86[_0x4b24('0x17e')]=_0x9c6e7a;return ami['Action']({'actionid':_0xe47b51,'action':_0x4b24('0x159'),'channel':_0x5cae8f['isTrunkReachable'](_0x1ebb86[_0x4b24('0x8b')])?util[_0x4b24('0x48')](_0x4b24('0x17f'),_0x1ebb86['Trunk'][_0x4b24('0x4a')],isNotNull(_0x1ebb86['dialPrefix'])?_0x1ebb86[_0x4b24('0x180')][_0x4b24('0x181')]()||'':'',_0x1ebb86[_0x4b24('0x182')]>0x0?_0x1614bf[_0x4b24('0x183')]['substring'](_0x1ebb86['dialCutDigit']):_0x1614bf[_0x4b24('0x183')]):util[_0x4b24('0x48')](_0x4b24('0x17f'),_[_0x4b24('0xf2')](_0x1ebb86[_0x4b24('0x8c')])?_0x1ebb86['Trunk']['name']:_0x1ebb86[_0x4b24('0x8c')]['name'],isNotNull(_0x1ebb86[_0x4b24('0x180')])?_0x1ebb86[_0x4b24('0x180')]['trim']()||'':'',_0x1ebb86['dialCutDigit']>0x0?_0x1614bf['phone'][_0x4b24('0x184')](_0x1ebb86[_0x4b24('0x182')]):_0x1614bf[_0x4b24('0x183')]),'callerid':_0x58c03b,'Exten':'xcally-motion-dialer','Context':_0x4b24('0x185'),'Priority':'1','variable':_0x9c6e7a,'timeout':(_0x1ebb86[_0x4b24('0x186')]||0x1e)*0x3e8,'async':!![],'channelid':_0xe47b51})['then'](function(_0xe7f014){return _0x2c7382(_0xe7f014);})[_0x4b24('0x9d')](function(_0x1e796c){_0x1ebb86[_0x4b24('0x187')]+=0x1;var _0x52133c=new History(_0x5cae8f[_0x4b24('0x27')][_0xe47b51]);logger[_0x4b24('0x68')](util['format'](_0x4b24('0x188'),JSON[_0x4b24('0x76')](_0x1e796c)));_0x52133c[_0x4b24('0x70')]=0xe;_0x52133c[_0x4b24('0x71')]=_0x4b24('0x189');_0x52133c[_0x4b24('0x73')]=moment()[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x52133c['endtime']=_0x52133c[_0x4b24('0x73')];hopperUtils[_0x4b24('0xca')](_0x52133c)[_0x4b24('0x9d')](loggerCatch('[originate][error]'));_0x5cae8f['moveContactManagedDialer'](_0x52133c)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x18a')))[_0x4b24('0x1e')](function(){delete _0x5cae8f[_0x4b24('0x27')][_0xe47b51];return _0x2ab1bb(msgResponse('originate',_0x4b24('0xbe'),_0x4b24('0x18b')));});});});};Dialer[_0x4b24('0x1b')][_0x4b24('0x18c')]=function(_0x3e4370,_0xfb6008,_0x433d92){var _0x1171f4=new History(_0xfb6008);if(_0x1171f4[_0x4b24('0x11d')]+_0x1171f4['countcongestionretry']+_0x1171f4[_0x4b24('0x12b')]+_0x1171f4[_0x4b24('0x11f')]+_0x1171f4[_0x4b24('0xd4')]+_0x1171f4[_0x4b24('0xea')]+_0x1171f4[_0x4b24('0x120')]+_0x1171f4[_0x4b24('0x121')]>=_0x433d92[_0x4b24('0x122')]-0x1){return!![];}switch(_0x3e4370){case 0x3:if(_0x1171f4[_0x4b24('0x12b')]>=_0x433d92['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x4b24('0xdb')]({'active':![],'countnoanswerretry':_0x1171f4[_0x4b24('0x12b')]+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92[_0x4b24('0x18d')],_0x4b24('0xdc'))[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4[_0x4b24('0xde')],'VoiceQueueId':_0x1171f4['VoiceQueueId']||undefined,'CampaignId':_0x1171f4[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x18e')));break;case 0x5:if(_0x1171f4[_0x4b24('0x11d')]>=_0x433d92[_0x4b24('0x18f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1171f4[_0x4b24('0x11d')]+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92[_0x4b24('0x190')],_0x4b24('0xdc'))[_0x4b24('0x48')](_0x4b24('0xc9')),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4[_0x4b24('0xde')],'VoiceQueueId':_0x1171f4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x1171f4['CampaignId']||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x191')));break;case 0x8:if(_0x1171f4[_0x4b24('0x11e')]>=_0x433d92[_0x4b24('0x192')]-0x1){return!![];}hopperUtils[_0x4b24('0xdb')]({'active':![],'countcongestionretry':_0x1171f4[_0x4b24('0x11e')]+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92['dialCongestionRetryFrequency'],'minutes')[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4['ListId'],'VoiceQueueId':_0x1171f4['VoiceQueueId']||undefined,'CampaignId':_0x1171f4[_0x4b24('0xe0')]||undefined})['catch'](loggerCatch(_0x4b24('0x193')));break;case 0x0:if(_0x1171f4['countnosuchnumberretry']>=_0x433d92[_0x4b24('0x194')]-0x1){return!![];}else{hopperUtils[_0x4b24('0xdb')]({'active':![],'countnosuchnumberretry':_0x1171f4['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92[_0x4b24('0x195')],_0x4b24('0xdc'))[_0x4b24('0x48')](_0x4b24('0xc9')),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4[_0x4b24('0xde')],'VoiceQueueId':_0x1171f4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x1171f4[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x196')));}break;case 0xa:if(_0x1171f4['countdropretry']>=_0x433d92['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x4b24('0xdb')]({'active':![],'countdropretry':_0x1171f4[_0x4b24('0xd4')]+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92[_0x4b24('0xd6')],_0x4b24('0xdc'))[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4[_0x4b24('0xde')],'VoiceQueueId':_0x1171f4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x1171f4['CampaignId']||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xe1')));break;case 0xb:if(_0x1171f4[_0x4b24('0xea')]>=_0x433d92[_0x4b24('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1171f4[_0x4b24('0xea')]+=0x1,'scheduledat':moment()['add'](_0x433d92['dialAbandonedRetryFrequency'],'minutes')[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4[_0x4b24('0xde')],'VoiceQueueId':_0x1171f4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x1171f4[_0x4b24('0xe0')]||undefined})['catch'](loggerCatch(_0x4b24('0xec')));break;case 0x13:if(_0x1171f4['countmachineretry']>=_0x433d92[_0x4b24('0x124')]-0x1){return!![];}hopperUtils[_0x4b24('0xdb')]({'active':![],'countmachineretry':_0x1171f4[_0x4b24('0x120')]+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92['dialMachineRetryFrequency'],_0x4b24('0xdc'))[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4['ListId'],'VoiceQueueId':_0x1171f4['VoiceQueueId']||undefined,'CampaignId':_0x1171f4[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x127')));break;case 0x14:if(_0x1171f4[_0x4b24('0x121')]>=_0x433d92['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x4b24('0xdb')]({'active':![],'countagentrejectretry':_0x1171f4[_0x4b24('0x121')]+=0x1,'scheduledat':moment()[_0x4b24('0xeb')](_0x433d92[_0x4b24('0x198')],_0x4b24('0xdc'))[_0x4b24('0x48')](_0x4b24('0xc9')),'ContactId':_0x1171f4[_0x4b24('0xdd')],'ListId':_0x1171f4[_0x4b24('0xde')],'VoiceQueueId':_0x1171f4[_0x4b24('0xdf')]||undefined,'CampaignId':_0x1171f4[_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x199')));break;default:return!![];}};Dialer['prototype'][_0x4b24('0x10b')]=function(_0x3cd8fa,_0x5d72ee,_0x212a81){var _0x3f1fc3=this;var _0x225487=new History(_0x3cd8fa);var _0x46322a=![];var _0x217d86;var _0x424e4a;return new Promise(function(_0x1de0a4,_0x14171a){if(_[_0x4b24('0x43')](_0x5d72ee)&&typeof _0x5d72ee!==_0x4b24('0x157')){return _0x14171a(msgResponse('[callProgressDetecting]',_0x4b24('0x91'),'entity\x20is\x20undefine'));}if(_[_0x4b24('0x43')](_0x212a81)&&typeof _0x212a81!==_0x4b24('0x157')){return _0x14171a(msgResponse(_0x4b24('0x19a'),_0x4b24('0x91'),'evt\x20is\x20undefine'));}hopperUtils[_0x4b24('0xe8')](_0x225487,_0x212a81['reason'],_0x5d72ee)['then'](function(_0x37ac05){if(_0x37ac05[_0x4b24('0xd8')]==0x1)_0x46322a=!![];switch(_0x212a81['reason']){case'0':_0x5d72ee[_0x4b24('0x19b')]+=0x1;_0x225487[_0x4b24('0x70')]=0x0;_0x225487['statedesc']='NoSuchNumber';_0x225487[_0x4b24('0x11f')]+=0x1;_0x225487[_0x4b24('0xd5')]+=0x1;ami[_0x4b24('0x114')](_0x4b24('0x19c'),ut[_0x4b24('0x116')](_0x3cd8fa,_0x4b24('0x19d')));_0x217d86=_0x5d72ee[_0x4b24('0x195')];_0x424e4a=_0x5d72ee[_0x4b24('0xd7')];hopperUtils[_0x4b24('0xca')](_0x225487)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x11c')));if(_0x3f1fc3[_0x4b24('0x18c')](0x0,_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487[_0x4b24('0x11f')]>=_0x5d72ee[_0x4b24('0x194')]){_0x3f1fc3['createStateFinal'](_0x225487,_0x1de0a4,_0x14171a,'reason\x200\x20no\x20such\x20number....');}else{_0x3f1fc3['stateGlobal'](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x19e'));}}break;case'3':_0x5d72ee[_0x4b24('0x19f')]+=0x1;_0x225487[_0x4b24('0x70')]=0x3;_0x225487[_0x4b24('0x71')]=_0x4b24('0x1a0');_0x225487['countnoanswerretry']+=0x1;_0x225487[_0x4b24('0xd5')]+=0x1;var _0xdd5f30=ut['buildNoAnswerEventPayload'](_0x3cd8fa,_0x5d72ee);ami[_0x4b24('0x114')](_0x4b24('0x1a1'),_0xdd5f30);_0x217d86=_0x5d72ee[_0x4b24('0x18d')];_0x424e4a=_0x5d72ee[_0x4b24('0xd7')];hopperUtils[_0x4b24('0xca')](_0x225487)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x1a2')));if(_0x3f1fc3[_0x4b24('0x18c')](0x3,_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487['countnoanswerretry']>=_0x5d72ee['dialNoAnswerMaxRetry']){_0x3f1fc3[_0x4b24('0x12d')](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1a3'));}else{_0x3f1fc3[_0x4b24('0x123')](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1a3'));}}break;case'5':_0x5d72ee[_0x4b24('0x1a4')]+=0x1;_0x225487['state']=0x5;_0x225487['statedesc']='Busy';_0x225487[_0x4b24('0x11d')]+=0x1;_0x225487['countglobal']+=0x1;ami[_0x4b24('0x114')](_0x4b24('0x1a5'),ut[_0x4b24('0x116')](_0x3cd8fa,_0x4b24('0x1a6')));_0x217d86=_0x5d72ee[_0x4b24('0x190')];_0x424e4a=_0x5d72ee[_0x4b24('0xd7')];hopperUtils[_0x4b24('0xca')](_0x225487)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3f1fc3['checkRetriveMax'](0x5,_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487[_0x4b24('0x11d')]>=_0x5d72ee[_0x4b24('0x18f')]){_0x3f1fc3['createStateFinal'](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1a7'));}else{_0x3f1fc3[_0x4b24('0x123')](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1a7'));}}break;case'8':_0x5d72ee['outboundCongestionCallsDay']+=0x1;_0x225487[_0x4b24('0x70')]=0x8;_0x225487[_0x4b24('0x71')]=_0x4b24('0x1a8');_0x225487[_0x4b24('0x11e')]+=0x1;_0x225487[_0x4b24('0xd5')]+=0x1;_0x217d86=_0x5d72ee[_0x4b24('0x1a9')];_0x424e4a=_0x5d72ee[_0x4b24('0xd7')];ami['emit'](_0x4b24('0x1aa'),ut[_0x4b24('0x116')](_0x3cd8fa,_0x4b24('0x1ab')));hopperUtils[_0x4b24('0xca')](_0x225487)['catch'](loggerCatch(_0x4b24('0x1ac')));if(_0x3f1fc3[_0x4b24('0x18c')](0x8,_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487[_0x4b24('0x11e')]>=_0x5d72ee['dialCongestionMaxRetry']){_0x3f1fc3['createStateFinal'](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1ad'));}else{_0x3f1fc3[_0x4b24('0x123')](_0x225487,_0x1de0a4,_0x14171a,'reason\x208\x20congestion');}}break;case'11':_0x5d72ee[_0x4b24('0x1ae')]+=0x1;_0x225487[_0x4b24('0x70')]=0xb;_0x225487[_0x4b24('0x71')]=_0x4b24('0xe6');_0x225487[_0x4b24('0xea')]+=0x1;_0x225487[_0x4b24('0xd5')]+=0x1;_0x217d86=_0x5d72ee[_0x4b24('0x1af')];_0x424e4a=_0x5d72ee['callAdditionalPhoneAfterMin'];hopperUtils[_0x4b24('0xca')](_0x225487)[_0x4b24('0x9d')](loggerCatch(_0x4b24('0xed')));if(_0x3f1fc3['checkRetriveMax'](0xb,_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487['countabandonedretry']>=_0x5d72ee[_0x4b24('0x197')]){_0x3f1fc3[_0x4b24('0x12d')](_0x225487,_0x1de0a4,_0x14171a,'reason\x2011\x20abandoned');}else{_0x3f1fc3[_0x4b24('0x123')](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1b0'));}}break;case'20':_0x5d72ee[_0x4b24('0x1b1')]+=0x1;_0x225487[_0x4b24('0x70')]=0x14;_0x225487[_0x4b24('0x71')]=_0x4b24('0x1b2');_0x225487[_0x4b24('0x121')]+=0x1;_0x225487[_0x4b24('0xd5')]+=0x1;_0x217d86=_0x5d72ee[_0x4b24('0x198')];_0x424e4a=_0x5d72ee['callAdditionalPhoneAfterMin'];ami[_0x4b24('0x114')]('custom:agentreject',ut[_0x4b24('0x116')](_0x3cd8fa,'agentreject'));hopperUtils['createHistory'](_0x225487)['catch'](loggerCatch(_0x4b24('0x1b3')));if(_0x3f1fc3[_0x4b24('0x18c')](0x14,_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487[_0x4b24('0x121')]>=_0x5d72ee['dialAgentRejectMaxRetry']){_0x3f1fc3[_0x4b24('0x12d')](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1b4'));}else{_0x3f1fc3[_0x4b24('0x123')](_0x225487,_0x1de0a4,_0x14171a,_0x4b24('0x1b4'));}}break;default:_0x5d72ee['outboundUnknownCallsDay']+=0x1;_0x225487[_0x4b24('0x70')]=0xc;_0x225487[_0x4b24('0x71')]=_0x212a81['reason'];_0x217d86=_0x5d72ee['dialAgentRejectRetryFrequency'];_0x424e4a=_0x5d72ee[_0x4b24('0xd7')];hopperUtils['createHistory'](_0x225487)['catch'](loggerCatch(_0x4b24('0x1b5')));if(_0x3f1fc3['checkRetriveMax'](_0x212a81['reason'],_0x3cd8fa,_0x5d72ee)&&!_0x46322a){if(_0x225487['countbusyretry']+_0x225487[_0x4b24('0x11e')]+_0x225487[_0x4b24('0x12b')]+_0x225487[_0x4b24('0x11f')]+_0x225487[_0x4b24('0xd4')]+_0x225487[_0x4b24('0xea')]+_0x225487[_0x4b24('0x120')]+_0x225487[_0x4b24('0x121')]>=_0x5d72ee[_0x4b24('0x122')]){_0x3f1fc3[_0x4b24('0x123')](_0x225487,_0x1de0a4,_0x14171a,_0x212a81[_0x4b24('0xc4')]);}else{_0x3f1fc3['createStateFinal'](_0x225487,_0x1de0a4,_0x14171a,_0x212a81['reason']);}}}})['then'](function(){if(_0x46322a){hopperUtils[_0x4b24('0xe5')](_0x225487,_0x217d86,_0x424e4a)['then'](function(){return _0x1de0a4(0x1);});}});});};Dialer[_0x4b24('0x1b')][_0x4b24('0x123')]=function(_0x368b69,_0x31a6db,_0x6ac760,_0x2e017a){var _0x1ac920=new Final(_0x368b69);_0x1ac920[_0x4b24('0x70')]=0xf;_0x1ac920[_0x4b24('0x71')]=_0x4b24('0x1b6');this[_0x4b24('0x12d')](_0x1ac920,_0x31a6db,_0x6ac760,_0x2e017a);};Dialer[_0x4b24('0x1b')][_0x4b24('0x12d')]=function(_0x2acbf3,_0x1eb790,_0x5accab,_0x1b7880){hopperUtils[_0x4b24('0xcc')](_0x2acbf3)[_0x4b24('0x42')](function(){return _0x1eb790(msgResponse(_0x4b24('0x19a'),_0x4b24('0x10a'),_0x1b7880));})[_0x4b24('0x9d')](function(){return _0x5accab(msgResponse('[moveContactManagedDialer][0]','Failure','contact\x20not\x20moved'));});};Dialer[_0x4b24('0x1b')][_0x4b24('0x9')]=function(_0x593a82){var _0x192bd3=_0x593a82[_0x4b24('0x1b7')]/0x64;var _0x176f13=_0x593a82['outboundDropCallsDayTimeout']/(_0x593a82[_0x4b24('0xcf')]+_0x593a82['outboundAnswerCallsDay']);var _0x1b1a31=Math[_0x4b24('0x1b8')](_0x593a82['predictiveIntervalAvailable']*(_0x593a82[_0x4b24('0x1b9')]/0x64));var _0x4a9c07=Math['round'](_0x593a82[_0x4b24('0x1ba')]*(_0x593a82[_0x4b24('0x1bb')]/0x64));var _0x23e51f=_0x593a82[_0x4b24('0x138')]+_0x593a82[_0x4b24('0x13a')];var _0x41e551=Math[_0x4b24('0x1bc')](_0x593a82[_0x4b24('0x5d')]*_0x593a82[_0x4b24('0x60')]*_0x593a82[_0x4b24('0x1bd')]*_0x593a82['predictiveIntervalMultiplicativeFactor']);if(_[_0x4b24('0x43')](_0x593a82[_0x4b24('0x2c')])){if(!_[_0x4b24('0x43')](_0x593a82[_0x4b24('0x2b')])){_0x593a82['startPredictive']=undefined;loggerPredictive[_0x4b24('0x68')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x4b24('0x43')](_0x593a82[_0x4b24('0x66')])){loggerPredictive[_0x4b24('0x68')](_0x4b24('0x1be'),_0x4b24('0x1bf'));clearInterval(_0x593a82[_0x4b24('0x66')]);_0x593a82[_0x4b24('0x66')]=undefined;}_0x593a82[_0x4b24('0x2c')]=moment()['format'](_0x4b24('0xc9'));loggerPredictive['info'](_0x593a82['name'],'collection\x20data\x20in\x20progressive\x20at',_0x593a82[_0x4b24('0x2c')]);this['handlePower'](_0x593a82,0x1);}else if(ifInterval(_0x593a82[_0x4b24('0x1c0')],_0x593a82[_0x4b24('0x2c')])){this[_0x4b24('0xb4')](_0x593a82,0x1);loggerPredictiveCalls[_0x4b24('0x4b')](_0x4b24('0x1c1'),_0x593a82[_0x4b24('0x2c')],_0x593a82[_0x4b24('0x4a')]);_0x593a82[_0x4b24('0x5d')]=0x0;_0x593a82[_0x4b24('0xd0')]=0x0;}else if(_0x192bd3<_0x176f13&&_0x593a82[_0x4b24('0x1c2')]===_0x4b24('0x1c3')){clearPredictiveAttributes(_0x593a82);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x4b24('0x1c4'),_0x176f13,'startProgressive',_0x593a82[_0x4b24('0x4a')]);}else if(_0x41e551<_0x593a82[_0x4b24('0xd0')]&&_0x593a82[_0x4b24('0x1c2')]===_0x4b24('0x1c3')){clearPredictiveAttributes(_0x593a82);loggerPredictive[_0x4b24('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x4b24('0x1c5'),_0x41e551,_0x4b24('0x1c6'),_0x593a82[_0x4b24('0xd0')],'startProgressive',_0x593a82[_0x4b24('0x4a')]);}else if(!ifInterval(_0x593a82['dialPredictiveInterval'],_0x593a82[_0x4b24('0x2c')])&&_[_0x4b24('0x43')](_0x593a82[_0x4b24('0x2b')])&&!_['isUndefined'](_0x593a82[_0x4b24('0x2c')])){_0x593a82['startPredictive']=moment()['format'](_0x4b24('0xc9'));loggerPredictive[_0x4b24('0x4b')](_0x593a82['name'],_0x4b24('0x1c7'),_0x593a82['startPredictive']);hopperUtils[_0x4b24('0x1c8')](_0x593a82['dialPredictiveInterval'])['then'](this[_0x4b24('0x1c9')](_0x593a82))[_0x4b24('0x42')](mergeDataErlangB(_0x593a82))[_0x4b24('0x42')](this[_0x4b24('0x1ca')](_0x593a82))[_0x4b24('0x9d')](loggerCatchPredictive(_0x4b24('0x1cb'),_0x593a82));}else if(!ifInterval(_0x593a82[_0x4b24('0x1c0')],_0x593a82[_0x4b24('0x2b')])){_0x593a82[_0x4b24('0xd0')]=0x0;_0x593a82['startPredictive']=moment()[_0x4b24('0x48')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4b24('0x4b')](_0x593a82[_0x4b24('0x4a')],_0x4b24('0x1cc'),_0x593a82['startPredictive']);clearInterval(_0x593a82[_0x4b24('0x66')]);_0x593a82[_0x4b24('0x66')]=undefined;hopperUtils[_0x4b24('0x1c8')](_0x593a82[_0x4b24('0x1c0')])[_0x4b24('0x42')](this[_0x4b24('0x1c9')](_0x593a82))[_0x4b24('0x42')](mergeDataErlangB(_0x593a82))[_0x4b24('0x42')](this[_0x4b24('0x1ca')](_0x593a82))[_0x4b24('0x9d')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x593a82));}else if(_0x593a82[_0x4b24('0x1ba')]&&_0x23e51f<_0x593a82['predictiveIntervalAvailable']-_0x4a9c07){clearPredictiveAttributes(_0x593a82);loggerPredictive[_0x4b24('0x4b')](_0x593a82[_0x4b24('0x4a')],_0x4b24('0x1cd'),_0x23e51f,_0x4b24('0x1ce'),_0x593a82[_0x4b24('0x1ba')],'-',_0x4a9c07,'=',_0x593a82['predictiveIntervalAvailable']-_0x4a9c07,')');}else if(_0x593a82[_0x4b24('0x1ba')]&&_0x23e51f>_0x593a82[_0x4b24('0x1ba')]+_0x1b1a31){clearPredictiveAttributes(_0x593a82);loggerPredictive[_0x4b24('0x4b')](_0x593a82['name'],_0x4b24('0x1cd'),_0x23e51f,')\x20are\x20more\x20than\x20threshold\x20(',_0x593a82[_0x4b24('0x1ba')],'+',_0x1b1a31,'=',_0x593a82[_0x4b24('0x1ba')]+_0x1b1a31,')');}};Dialer[_0x4b24('0x1b')][_0x4b24('0x1c9')]=function(_0x3b3ecb){var _0x1e4187=this;return function(_0x573409){return new Promise(function(_0xf7feb2,_0x32577b){_[_0x4b24('0xf7')](_0x3b3ecb,_0x573409[0x0]);if(checkGetDataPredictive(_0x573409[0x0])){var _0x518b07=_0x3b3ecb[_0x4b24('0x1ba')]=_0x3b3ecb[_0x4b24('0x13a')]+_0x3b3ecb['available'];var _0x5c66e2=_0x3b3ecb[_0x4b24('0x1c0')]*0x3c;var _0x2d7797=_0x573409[0x0][_0x4b24('0x56')]+_0x573409[0x0][_0x4b24('0x54')];var _0x29f1e2=(_0x573409[0x0][_0x4b24('0x4f')]+_0x573409[0x0][_0x4b24('0x50')]+_0x573409[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x573409[0x0][_0x4b24('0x4e')];_0x3b3ecb['predictiveIntervalHitRate']=_0x29f1e2>0x0?_0x29f1e2:0x1;switch(_0x3b3ecb[_0x4b24('0x1c2')]){case _0x4b24('0x1c3'):var _0x3a24bd=_0x3b3ecb[_0x4b24('0x1b7')]/0x64;return _0x1e4187[_0x4b24('0x1cf')](_0x518b07,_0x5c66e2,_0x2d7797,_0x29f1e2,_0x3a24bd)['then'](function(_0x39f71b){return _0xf7feb2(_0x39f71b);});case _0x4b24('0x1d0'):var _0x396733=_0x3b3ecb['dialPredictiveOptimizationPercentage']/0x64;return _0x1e4187[_0x4b24('0x1d1')](_0x518b07,_0x5c66e2,_0x2d7797,_0x29f1e2,_0x396733)[_0x4b24('0x42')](function(_0x53d045){return _0xf7feb2(_0x53d045);});default:return _0x32577b(msgResponse(_0x4b24('0x1d2'),_0x4b24('0x91'),_0x4b24('0x1d3')));}}else{return _0x32577b(msgResponse(_0x4b24('0x1d2'),'Failure',_0x4b24('0x1d4')));}});};};Dialer[_0x4b24('0x1b')][_0x4b24('0x1d5')]=function(_0x36e5f8){var _0x69e4be=this;return function(_0x2d32e7){return new Promise(function(_0x1595e6,_0x2e8834){_['merge'](_0x36e5f8,_0x2d32e7[0x0]);if(checkGetDataPredictive(_0x2d32e7[0x0])){loggerPredictive[_0x4b24('0x4b')](JSON['stringify'](_0x2d32e7[0x0]));if(_0x36e5f8['dialPredictiveOptimization']===_0x4b24('0x1c3')){return _0x69e4be[_0x4b24('0x14c')](_0x36e5f8['id'])[_0x4b24('0x42')](function(_0x2df853){var _0x1a55bd=_0x36e5f8['loggedIn']-_0x2df853[0x0]['outboundQueuePauses'];var _0x2b247e=_0x36e5f8[_0x4b24('0x1c0')]*0x3c;var _0x2a10b0=_0x2d32e7[0x0]['predictiveIntervalAvgTalktime']+_0x2d32e7[0x0][_0x4b24('0x54')];var _0x53d54e=(_0x2d32e7[0x0][_0x4b24('0x4f')]+_0x2d32e7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d32e7[0x0][_0x4b24('0x52')])/_0x2d32e7[0x0][_0x4b24('0x4e')];var _0x37247e=_0x36e5f8['dialPredictiveOptimizationPercentage']/0x64;_0x36e5f8['predictiveIntervalPauses']=_0x2df853[0x0]['outboundQueuePauses']||0x0;_0x36e5f8[_0x4b24('0x1bd')]=_0x53d54e>0x0?_0x53d54e:0x1;return _0x69e4be['abandonmentRate'](_0x1a55bd,_0x2b247e,_0x2a10b0,_0x53d54e,_0x37247e);})[_0x4b24('0x42')](function(_0x4e4fef){return _0x1595e6(_0x4e4fef);})[_0x4b24('0x9d')](function(_0x79091d){return _0x2e8834(msgResponse('[CatchErlangB]','Failure',JSON[_0x4b24('0x76')](_0x79091d)));});}if(_0x36e5f8[_0x4b24('0x1c2')]===_0x4b24('0x1d0')){return _0x69e4be[_0x4b24('0x14c')](_0x36e5f8['id'])['then'](function(_0x30883c){var _0x677cb9=_0x36e5f8[_0x4b24('0x1d6')]-_0x30883c[0x0][_0x4b24('0x1d7')];var _0x47e802=_0x36e5f8[_0x4b24('0x1c0')]*0x3c;var _0x1625c0=_0x2d32e7[0x0][_0x4b24('0x56')]+_0x2d32e7[0x0]['predictiveIntervalAvgHoldtime'];var _0x19be9b=(_0x2d32e7[0x0][_0x4b24('0x4f')]+_0x2d32e7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d32e7[0x0][_0x4b24('0x52')])/_0x2d32e7[0x0][_0x4b24('0x4e')];var _0x527746=_0x36e5f8[_0x4b24('0x1b7')]/0x64;_0x36e5f8[_0x4b24('0x1d8')]=_0x30883c[0x0][_0x4b24('0x1d7')]||0x0;_0x36e5f8[_0x4b24('0x1bd')]=_0x19be9b>0x0?_0x19be9b:0x1;return _0x69e4be['busyFactor'](_0x677cb9,_0x47e802,_0x1625c0,_0x19be9b,_0x527746);})[_0x4b24('0x42')](function(_0x11fabe){return _0x1595e6(_0x11fabe);})[_0x4b24('0x9d')](function(_0x50909f){return _0x2e8834(msgResponse(_0x4b24('0x1d9'),_0x4b24('0x91'),JSON[_0x4b24('0x76')](_0x50909f)));});}}else{return _0x2e8834(msgResponse(_0x4b24('0x1d2'),_0x4b24('0x91'),_0x4b24('0x1d4')));}});};};Dialer[_0x4b24('0x1b')][_0x4b24('0x1ca')]=function(_0x28c778){var _0x2603f9=this;return function(){var _0x1addbc=0x0;var _0x542a33=Math[_0x4b24('0x1bc')](_0x28c778[_0x4b24('0x5f')]*0x3e8);if(_0x542a33>0x0){_0x542a33=_0x542a33<0x64?0x64:_0x542a33;loggerPredictive[_0x4b24('0x4b')](_0x28c778[_0x4b24('0x4a')],_0x4b24('0x1da'),_0x542a33,'milliseconds');_0x28c778[_0x4b24('0x66')]=setInterval(function(){_0x2603f9[_0x4b24('0x66')](_0x28c778);loggerPredictiveCalls[_0x4b24('0x4b')](_0x4b24('0x1db'),_0x1addbc+=0x1);},_0x542a33);}else{loggerPredictive['info'](_0x28c778[_0x4b24('0x4a')],_0x4b24('0x1dc'));}};};Dialer[_0x4b24('0x1b')][_0x4b24('0x1dd')]=function(_0x4c79f7,_0xd1c157){var _0x440a26=this;return function(_0x205312){if(_[_0x4b24('0x7e')](_0x205312)){if(_['isNil'](_0xd1c157[_0x4b24('0x1de')])||!_0xd1c157[_0x4b24('0x1df')]){if(_0x4c79f7[_0x4b24('0xb1')]===_0x4b24('0xb6')){_0x4c79f7['queueStatusComplete']=_[_0x4b24('0x43')](_0x4c79f7[_0x4b24('0x78')])?!![]:_0x4c79f7[_0x4b24('0x78')];var _0x2f3115=uuid['v4']();_0x440a26['actions'][_0x2f3115]=new Action(_0x4c79f7,_0xd1c157,_0x2f3115);loggerBooked[_0x4b24('0x4b')](_0x4b24('0x1e0'),_0x2f3115,'queueStatusComplete:\x20',JSON['stringify'](_0x4c79f7[_0x4b24('0x78')]),_0x4b24('0x1e1'),_0x4c79f7[_0x4b24('0x4a')]);if(_0x4c79f7[_0x4b24('0x78')]){_0x4c79f7[_0x4b24('0x78')]=![];_0x440a26[_0x4b24('0x2d')][_0x440a26['actions'][_0x2f3115]['queue']]=[];ami[_0x4b24('0x99')]({'actionid':_0x2f3115,'action':_0x4b24('0x1e2'),'queue':_0x4c79f7[_0x4b24('0x4a')]})['catch'](function(){_0x440a26[_0x4b24('0xc2')](_0x4c79f7);hopperUtils[_0x4b24('0xdb')]({'active':![],'ContactId':_0x440a26['actions'][_0x2f3115]['ContactId'],'ListId':_0x440a26[_0x4b24('0x27')][_0x2f3115]['ListId'],'VoiceQueueId':_0x440a26[_0x4b24('0x27')][_0x2f3115][_0x4b24('0xdf')]||undefined,'CampaignId':_0x440a26[_0x4b24('0x27')][_0x2f3115]['CampaignId']||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x1e3')));delete _0x440a26[_0x4b24('0x27')][_0x2f3115];});}else{loggerBooked[_0x4b24('0x4b')](_0x4b24('0x1e4'),JSON['stringify'](_0x4c79f7[_0x4b24('0x78')]),_0x4b24('0x1e1'),_0x4c79f7[_0x4b24('0x4a')]);_0x440a26[_0x4b24('0xc2')](_0x4c79f7);hopperUtils[_0x4b24('0xdb')]({'active':![],'ContactId':_0x440a26[_0x4b24('0x27')][_0x2f3115][_0x4b24('0xdd')],'ListId':_0x440a26['actions'][_0x2f3115][_0x4b24('0xde')],'VoiceQueueId':_0x440a26['actions'][_0x2f3115][_0x4b24('0xdf')]||undefined,'CampaignId':_0x440a26[_0x4b24('0x27')][_0x2f3115][_0x4b24('0xe0')]||undefined})[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x1e3')));delete _0x440a26[_0x4b24('0x27')][_0x2f3115];}}else{return _0x440a26[_0x4b24('0x156')](_0x4c79f7,_0xd1c157);}}else{if(utils[_0x4b24('0xce')](undefined,_0xd1c157[_0x4b24('0x1e5')])<_0x4c79f7[_0x4b24('0x1e6')]*0x3c){if(_0xd1c157[_0x4b24('0x154')]&&!_0xd1c157[_0x4b24('0x154')][_0x4b24('0x1e7')]){_0x440a26[_0x4b24('0x20')]['run'](_0xd1c157['id'])[_0x4b24('0x1e')](function(){_0x440a26[_0x4b24('0xc2')](_0x4c79f7);});}else{hopperUtils[_0x4b24('0x1e8')]({'active':![]},_0xd1c157['id'],0x1)['finally'](function(){_0x440a26[_0x4b24('0xc2')](_0x4c79f7);});}}else{_0x4c79f7[_0x4b24('0x1e9')]+=0x1;_0x440a26[_0x4b24('0xc2')](_0x4c79f7);if(_0x4c79f7[_0x4b24('0x1ea')]){hopperUtils[_0x4b24('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xd1c157[_0x4b24('0xdd')],'ListId':_0xd1c157[_0x4b24('0xde')],'VoiceQueueId':_0xd1c157['VoiceQueueId']||undefined,'CampaignId':_0xd1c157[_0x4b24('0xe0')]||undefined})['catch'](loggerCatch(_0x4b24('0x1eb')));hopperUtils[_0x4b24('0xca')](createObjHistory(_0x4c79f7,_0xd1c157,utils[_0x4b24('0x79')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x1ec')));}else{_0x440a26[_0x4b24('0x118')](createObjHistory(_0x4c79f7,_0xd1c157,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x4b24('0x1ed')),_0x4b24('0x1ee'),_0x4b24('0x1ef'));}}}}else{_0x4c79f7['outboundBlacklistCallsDay']+=0x1;_0x440a26[_0x4b24('0x118')](createObjHistory(_0x4c79f7,_0xd1c157,utils[_0x4b24('0x79')][_0x4b24('0x1f0')],0xd,_0x4b24('0x1f1')),_0x4b24('0x1f2'),_0x4b24('0x1f3'));throw _0x4b24('0x1f4');}};};Dialer[_0x4b24('0x1b')][_0x4b24('0x155')]=function(_0x1ad8bc){var _0x3dba08=this;var _0x51973f=_0x1ad8bc[_0x4b24('0x1f5')]-_0x1ad8bc[_0x4b24('0x82')]-_0x1ad8bc[_0x4b24('0x1f6')];emitCampaignSummary(_0x1ad8bc);if(_0x51973f>0x0){if(_0x51973f>this[_0x4b24('0x25')]){_0x51973f=this['maxNumberOriginate'];}_0x1ad8bc['temp']+=_0x51973f;hopperUtils['getContactDialerIvr'](_0x1ad8bc['id'],_0x51973f,_0x1ad8bc['dialOrderByScheduledAt'],_0x1ad8bc)[_0x4b24('0x42')](function(_0x2e8002){_0x1ad8bc[_0x4b24('0x1f6')]-=_0x51973f;_0x1ad8bc['temp']=_0x1ad8bc[_0x4b24('0x1f6')]>0x0?_0x1ad8bc[_0x4b24('0x1f6')]:0x0;if(!utils[_0x4b24('0x1f7')](_0x2e8002)){_0x1ad8bc['message']=utils[_0x4b24('0x79')][_0x4b24('0x1f8')];logger[_0x4b24('0x4b')]('[getContactCampaign2][Empty]'+_0x1ad8bc['name']);}else{_0x1ad8bc[_0x4b24('0x82')]+=_0x2e8002[_0x4b24('0x97')];_0x1ad8bc[_0x4b24('0x6b')]=utils[_0x4b24('0x79')][_0x4b24('0x1f9')];for(var _0x548aff=0x0;_0x548aff<_0x2e8002[_0x4b24('0x97')];_0x548aff+=0x1){_0x1ad8bc[_0x4b24('0x1fa')]+=0x1;if(_[_0x4b24('0xf2')](_0x2e8002[_0x548aff])||_[_0x4b24('0xf2')](_0x2e8002[_0x548aff]['Contact'])||_[_0x4b24('0xf2')](_0x2e8002[_0x548aff][_0x4b24('0x183')])){_0x3dba08['emptyContact']('[actionOriginate]\x20',_0x1ad8bc,_0x2e8002[_0x548aff]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x4b24('0x77')](_0x2e8002[_0x548aff],[_0x4b24('0xe0'),_0x4b24('0x183')]))[_0x4b24('0x42')](_0x3dba08[_0x4b24('0x1dd')](_0x1ad8bc,_0x2e8002[_0x548aff]))[_0x4b24('0x9d')](_0x3dba08[_0x4b24('0x1fb')](_0x4b24('0x1fc'),_0x1ad8bc));}}}})[_0x4b24('0x9d')](loggerGetContactDialer('[getContactCampaign2]',_0x1ad8bc,_0x51973f));}};Dialer['prototype'][_0x4b24('0xb4')]=function(_0x44bed0,_0xf62b7d){var _0x5bb592=this;var _0x23b420=[];if(_0xf62b7d<0x1||_0x44bed0[_0x4b24('0xb1')]===_0x4b24('0xb6')){_0xf62b7d=0x1;}var _0x2fff7a=Math[_0x4b24('0x1bc')](_0x44bed0[_0x4b24('0x138')]*_0xf62b7d)-_0x44bed0[_0x4b24('0x82')]-_0x44bed0[_0x4b24('0x1f6')];if(_0x44bed0['dialLimitQueue']>0x0){var _0x27cc41=_0x44bed0['dialLimitQueue']-_0x44bed0['originated']-_0x44bed0[_0x4b24('0x13a')]-_0x44bed0[_0x4b24('0x1f6')]-_0x44bed0[_0x4b24('0x13b')];if(_0x2fff7a>_0x27cc41){_0x2fff7a=_0x27cc41;}}if(_0x2fff7a>0x0){if(_0x44bed0[_0x4b24('0xb1')]==='booked'){_0x2fff7a=0x1;}if(_0x2fff7a>this['maxNumberOriginate']){_0x2fff7a=this[_0x4b24('0x25')];}_0x44bed0[_0x4b24('0x1f6')]+=_0x2fff7a;for(var _0x3f9a0f in this['agents']){if(typeof this['agents'][_0x3f9a0f]!==_0x4b24('0xaa')){if(this[_0x4b24('0x23')][_0x3f9a0f][_0x4b24('0x70')]===_0x4b24('0x1fd')&&this[_0x4b24('0x23')][_0x3f9a0f][_0x4b24('0x89')]===_0x4b24('0x88')){_0x23b420[_0x4b24('0x98')](this[_0x4b24('0x23')][_0x3f9a0f]['id']);}}}hopperUtils[_0x4b24('0x1fe')](_0x44bed0,_0x23b420,_0x2fff7a)[_0x4b24('0x42')](function(_0x328a1c){_0x44bed0[_0x4b24('0x1f6')]-=_0x2fff7a;_0x44bed0['temp']=_0x44bed0[_0x4b24('0x1f6')]>0x0?_0x44bed0['temp']:0x0;if(!utils[_0x4b24('0x1f7')](_0x328a1c)){hopperUtils[_0x4b24('0x1ff')](_0x44bed0)[_0x4b24('0x42')](sendMessageReschedule(_0x44bed0))[_0x4b24('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x44bed0[_0x4b24('0x82')]+=_0x328a1c['length'];_0x44bed0[_0x4b24('0x6b')]=_0x44bed0[_0x4b24('0xb1')]===_0x4b24('0xb6')?utils[_0x4b24('0x79')][_0x4b24('0x13c')]:utils[_0x4b24('0x79')][_0x4b24('0x1f9')];for(var _0xa2bd49=0x0;_0xa2bd49<_0x328a1c['length'];_0xa2bd49+=0x1){if(_[_0x4b24('0xf2')](_0x328a1c[_0xa2bd49])||_[_0x4b24('0xf2')](_0x328a1c[_0xa2bd49][_0x4b24('0x172')])||_[_0x4b24('0xf2')](_0x328a1c[_0xa2bd49][_0x4b24('0x183')])){_0x5bb592[_0x4b24('0x150')](_0x4b24('0x200'),_0x44bed0,_0x328a1c[_0xa2bd49]);}else{hopperUtils[_0x4b24('0x201')](_[_0x4b24('0x77')](_0x328a1c[_0xa2bd49],['VoiceQueueId',_0x4b24('0x183')]))['then'](_0x5bb592[_0x4b24('0x1dd')](_0x44bed0,_0x328a1c[_0xa2bd49]))['catch'](_0x5bb592[_0x4b24('0x1fb')]('[actionOriginate]\x20',_0x44bed0));}}}})[_0x4b24('0x9d')](loggerGetContactDialer(_0x4b24('0x202'),_0x44bed0,_0x2fff7a));}};Dialer[_0x4b24('0x1b')][_0x4b24('0x66')]=function(_0x155115){if(_0x155115['dialLimitQueue']>0x0){var _0x555327=_0x155115['dialLimitQueue']-_0x155115['originated']-_0x155115[_0x4b24('0x13a')];if(_0x555327>0x0){this[_0x4b24('0x203')](_0x155115);}else{loggerPredictiveCalls[_0x4b24('0x4b')](_0x4b24('0x204'));}}else{this[_0x4b24('0x203')](_0x155115);}};Dialer[_0x4b24('0x1b')]['tryOriginatePredictive']=function(_0x3803e4){var _0x359919=this;var _0x35b9dc=[];_0x3803e4[_0x4b24('0x82')]+=0x1;for(var _0xc777aa in this['agents']){if(typeof this[_0x4b24('0x23')][_0xc777aa]!==_0x4b24('0xaa')){if(this['agents'][_0xc777aa][_0x4b24('0x70')]===_0x4b24('0x1fd')&&this[_0x4b24('0x23')][_0xc777aa]['status']==='reachable'){_0x35b9dc[_0x4b24('0x98')](this[_0x4b24('0x23')][_0xc777aa]['id']);}}}return this[_0x4b24('0x1fe')](_0x3803e4['id'],_0x35b9dc,0x1,_0x3803e4['dialOrderByScheduledAt'],_0x3803e4)[_0x4b24('0x42')](function(_0x59d1d3){if(!utils[_0x4b24('0x1f7')](_0x59d1d3)){utils[_0x4b24('0x69')](_0x3803e4,0x1,0x0);return hopperUtils[_0x4b24('0x1ff')](_0x3803e4)[_0x4b24('0x42')](sendMessageReschedule(_0x3803e4))[_0x4b24('0x9d')](loggerCatch(_0x4b24('0x205')));}else{_0x3803e4[_0x4b24('0x6b')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_['isNil'](_0x59d1d3[0x0])||_['isNil'](_0x59d1d3[0x0][_0x4b24('0x172')])||_[_0x4b24('0xf2')](_0x59d1d3[0x0]['phone'])){_0x359919['emptyContact'](_0x4b24('0x200'),_0x3803e4,_0x59d1d3[0x0]);}else{return hopperUtils[_0x4b24('0x201')](_[_0x4b24('0x77')](_0x59d1d3[0x0],[_0x4b24('0xdf'),'phone']))['then'](_0x359919[_0x4b24('0x1dd')](_0x3803e4,_0x59d1d3[0x0]))[_0x4b24('0x9d')](_0x359919['loggerHandler'](_0x4b24('0x206'),_0x3803e4));}}})[_0x4b24('0x9d')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3803e4,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x2f67f1,_0x4bee19,_0x3be3da,_0x2cd181,_0x2462a6,_0x3b6071){loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x207'));loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x208'),_0x2f67f1);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x209'),_0x4bee19);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x20a'),_0x3be3da);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x20b'),_0x2cd181);loggerPredictive[_0x4b24('0x4b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2462a6);loggerPredictive[_0x4b24('0x4b')]('---------------------------');return new Promise(function(_0x566a76,_0x5b8d1c){if(_0x2f67f1<=0x0||isNaN(_0x2f67f1)){return _0x5b8d1c(msgResponse('[abandonmentRate]',_0x4b24('0xbe'),_0x4b24('0x20c')+_0x2f67f1));}if(_0x3be3da<=0x0||isNaN(_0x3be3da)){return _0x5b8d1c(msgResponse(_0x4b24('0x20d'),'Error',_0x4b24('0x20e')+_0x3be3da));}if(_0x2cd181<=0x0||isNaN(_0x2cd181)){return _0x5b8d1c(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x2cd181));}if(_0x4bee19<=0x0||isNaN(_0x4bee19)){return _0x5b8d1c(msgResponse(_0x4b24('0x20d'),_0x4b24('0xbe'),'interval\x20=\x20'+_0x4bee19));}if(_0x2462a6<=0x0||isNaN(_0x2462a6)){return _0x5b8d1c(msgResponse('[abandonmentRate]',_0x4b24('0xbe'),_0x4b24('0x20f')+_0x2462a6));}_0x3b6071=_0x3b6071||0x0;var _0x292beb=0x1/_0x3be3da;var _0x12e48f=0x0;var _0xbaf9e4=0x0;var _0x3e1b84=0x0;var _0x3a2985=0x0;for(var _0x3e3855=0x0;_0x3e1b84<_0x2462a6;_0x3e3855+=0x1){_0xbaf9e4=_0x3e3855/_0x4bee19;_0x12e48f=(_0x2cd181*_0xbaf9e4+_0x3b6071)/_0x292beb;_0x3e1b84=utils[_0x4b24('0x210')](_0x12e48f,_0x2f67f1);_0x3a2985=_0x12e48f/_0x2f67f1*(0x1-utils['erlangb'](_0x12e48f,_0x2f67f1));}return _0x566a76({'erlangCalls':_0x3e3855,'erlangCallToSecond':_0x4bee19/_0x3e3855,'erlangAbandonmentRate':_0x3e1b84,'erlangBusyFactor':_0x3a2985});});};Dialer[_0x4b24('0x1b')][_0x4b24('0x1d1')]=function(_0x36c19a,_0x5afb06,_0x38456b,_0x21070b,_0x36a602,_0x19ef01){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x208'),_0x36c19a);loggerPredictive['info'](_0x4b24('0x209'),_0x5afb06);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x20a'),_0x38456b);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x20b'),_0x21070b);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x211'),_0x36a602);loggerPredictive[_0x4b24('0x4b')](_0x4b24('0x57'));return new Promise(function(_0x285349,_0x322505){if(_0x36c19a<=0x0||isNaN(_0x36c19a)){return _0x322505(msgResponse(_0x4b24('0x212'),'Error',_0x4b24('0x20c')+_0x36c19a));}if(_0x38456b<=0x0||isNaN(_0x38456b)){return _0x322505(msgResponse(_0x4b24('0x212'),_0x4b24('0xbe'),_0x4b24('0x20e')+_0x38456b));}if(_0x21070b<=0x0||isNaN(_0x21070b)){return _0x322505(msgResponse(_0x4b24('0x212'),_0x4b24('0xbe'),_0x4b24('0x213')+_0x21070b));}if(_0x5afb06<=0x0||isNaN(_0x5afb06)){return _0x322505(msgResponse(_0x4b24('0x212'),_0x4b24('0xbe'),'interval\x20=\x20'+_0x5afb06));}if(_0x36a602<=0x0||isNaN(_0x36a602)){return _0x322505(msgResponse(_0x4b24('0x212'),_0x4b24('0xbe'),'Umin\x20=\x20'+_0x36a602));}_0x19ef01=_0x19ef01||0x0;var _0x30733a=0x1/_0x38456b;var _0x5e1db0=0x0;var _0x3ea365=0x0;var _0x4addaa=0x0;var _0x51f2cc=0x0;for(var _0x461b84=0x0;_0x51f2cc<_0x36a602;_0x461b84+=0x1){_0x3ea365=_0x461b84/_0x5afb06;_0x5e1db0=(_0x21070b*_0x3ea365+_0x19ef01)/_0x30733a;_0x4addaa=utils[_0x4b24('0x210')](_0x5e1db0,_0x36c19a);_0x51f2cc=_0x5e1db0/_0x36c19a*(0x1-utils[_0x4b24('0x210')](_0x5e1db0,_0x36c19a));}return _0x285349({'erlangCalls':_0x461b84,'erlangCallToSecond':_0x5afb06/_0x461b84,'erlangAbandonmentRate':_0x4addaa,'erlangBusyFactor':_0x51f2cc});});};module[_0x4b24('0x214')]=Dialer;
\ No newline at end of file
+var _0x352b=['dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnosuchnumberretry','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','dialCongestionRetryFrequency','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','floor','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','temp','checkContactEmpty','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[busyFactor]','Umin\x20=\x20','exports','lodash','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/voiceQueueRt','../rpc/interval','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','debug','startPredictive\x20value\x20cleared','handlePredictive','stack','error','checkContactLowerLimitOriginate','contactsRescheduled','contacts','message','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Intervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','push','command','timezones','content','indexOf','true','catch','Action','iftime\x20%s,%s','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','countabandonedretry','CampaignId','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','syncQueueMember','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','roundrobin','idHopper','isEmpty','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','resolve','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','syncQueueSummaryComplete','throttle','dialPreviewRecallmeReminder','filter','reachable','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','clearZombieChannels','sequence','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','UserId','[emptyContact][createHistory]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim'];(function(_0x59bb62,_0x244086){var _0x4157d3=function(_0x5d106b){while(--_0x5d106b){_0x59bb62['push'](_0x59bb62['shift']());}};_0x4157d3(++_0x244086);}(_0x352b,0x96));var _0xb352=function(_0x4a63af,_0x526bdb){_0x4a63af=_0x4a63af-0x0;var _0x5caa78=_0x352b[_0x4a63af];return _0x5caa78;};'use strict';var util=require('util');var _=require(_0xb352('0x0'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0xb352('0x1'));var utils=require(_0xb352('0x2'));var hopperUtils=require(_0xb352('0x3'));var ut=require(_0xb352('0x4'));var config=require(_0xb352('0x5'));var logger=require(_0xb352('0x6'))(_0xb352('0x7'));var loggerBooked=require(_0xb352('0x6'))('booked');var loggerPredictive=require(_0xb352('0x6'))(_0xb352('0x8'));var loggerPredictiveCalls=require(_0xb352('0x6'))(_0xb352('0x9'));var loggerSyncQueueSummary=require(_0xb352('0x6'))(_0xb352('0xa'));var ami=require(_0xb352('0xb'));config[_0xb352('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb352('0xd'))(new Redis(config[_0xb352('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xb352('0xe'));var RpcSetting=require('../rpc/setting');var Interval=require(_0xb352('0xf'));var Action=require('./models/action');var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xb352('0x10'));var Hangup=require('./models/hangup');var ipAgi=process[_0xb352('0x11')][_0xb352('0x12')]||_0xb352('0x13');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb352('0x14')][_0xb352('0x15')]=function(_0xd637d5){this[_0xb352('0x16')]=this['tail']?this[_0xb352('0x16')][_0xb352('0x17')](_0xd637d5):_0xd637d5();};function Dialer(_0x27f964,_0x251fb4){this['sequence']=new Sequence();this[_0xb352('0x18')]=_0x251fb4;this[_0xb352('0x19')]=_0x27f964[_0xb352('0x19')];this[_0xb352('0x1a')]=_0x27f964[_0xb352('0x1a')];this[_0xb352('0x1b')]=_0x27f964[_0xb352('0x1b')];this[_0xb352('0x1c')]=_0x27f964[_0xb352('0x1c')];this['maxNumberOriginate']=config[_0xb352('0x1d')]||0x2;this[_0xb352('0x1e')]={};this['actions']={};this[_0xb352('0x1f')]={};this[_0xb352('0x20')]={};this[_0xb352('0x21')]={};this[_0xb352('0x22')]={};this[_0xb352('0x23')]={};this[_0xb352('0x24')]={};this[_0xb352('0x25')]={};this[_0xb352('0x26')]={};this[_0xb352('0x27')]={};ami['on'](_0xb352('0x28'),this[_0xb352('0x29')][_0xb352('0x2a')](this));ami['on']('queuecallerabandon',this[_0xb352('0x2b')][_0xb352('0x2a')](this));ami['on']('originateresponse',this[_0xb352('0x2c')][_0xb352('0x2a')](this));ami['on'](_0xb352('0x2d'),this[_0xb352('0x2e')][_0xb352('0x2a')](this));ami['on'](_0xb352('0x2f'),this[_0xb352('0xa')]['bind'](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0xb352('0x2a')](this));ami['on'](_0xb352('0x30'),this[_0xb352('0x31')][_0xb352('0x2a')](this));ami['on'](_0xb352('0x32'),this['syncNewExten'][_0xb352('0x2a')](this));ami['on']('varset',this[_0xb352('0x33')]['bind'](this));ami['on'](_0xb352('0x34'),this['syncQueueMember'][_0xb352('0x2a')](this));ami['on'](_0xb352('0x35'),this[_0xb352('0x36')]['bind'](this));this[_0xb352('0x37')]();this[_0xb352('0x38')]();RpcSetting['getSettings']()[_0xb352('0x39')](function(_0x3e1863){previewRecallmeReminderInterval=_0x3e1863['previewRecallmeReminderInterval'];});}function isNotNull(_0x5061ba){return _0x5061ba!==null&&!_['isUndefined'](_0x5061ba);}function msgResponse(_0x343c8d,_0x52ccfa,_0x4defe8){return{'action':_0x343c8d,'response':_0x52ccfa,'message':_0x4defe8,'stack':_0x4defe8};}function emit(_0x15a6de,_0x19ab62,_0x1719e4){io['to'](_0x15a6de)[_0xb352('0x3a')](_0x19ab62,_0x1719e4);}function emitOutboundVoiceQueueSummary(_0xb2a9a2){if(_0xb2a9a2[_0xb352('0x3b')]===_0xb352('0x3c')){logger['debug'](_0xb352('0x3d'),util[_0xb352('0x3e')](_0xb2a9a2,{'showHidden':![],'depth':null}));emit(util[_0xb352('0x3f')](_0xb352('0x40'),_0xb2a9a2[_0xb352('0x41')]),_0xb352('0x42'),_0xb2a9a2);}}function checkGetDataPredictive(_0x45a3bf){if(isNotNull(_0x45a3bf)&&!_['isEmpty'](_0x45a3bf)){loggerPredictive[_0xb352('0x43')](_0xb352('0x44'));loggerPredictive[_0xb352('0x43')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45a3bf['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0xb352('0x45'),_0x45a3bf[_0xb352('0x46')]);loggerPredictive[_0xb352('0x43')](_0xb352('0x47'),_0x45a3bf[_0xb352('0x48')]);loggerPredictive[_0xb352('0x43')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45a3bf[_0xb352('0x49')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45a3bf[_0xb352('0x4a')]);loggerPredictive[_0xb352('0x43')](_0xb352('0x4b'),_0x45a3bf['predictiveIntervalAvgTalktime']);loggerPredictive[_0xb352('0x43')]('---------------------------');if(_0x45a3bf[_0xb352('0x4c')]>0x0){if(!_[_0xb352('0x4d')](_0x45a3bf[_0xb352('0x4e')])&&_0x45a3bf[_0xb352('0x4e')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xb352('0x4d')](_0x45a3bf[_0xb352('0x4a')])&&_0x45a3bf[_0xb352('0x4a')]>0x0){return!![];}loggerPredictive[_0xb352('0x43')](_0xb352('0x4f'));}else{loggerPredictive[_0xb352('0x43')](_0xb352('0x50'));}}else{loggerPredictive[_0xb352('0x43')](_0xb352('0x51'));}return![];}function mergeDataErlangB(_0x4622bd){return function(_0x50010e){loggerPredictive[_0xb352('0x43')](_0xb352('0x52'));loggerPredictive[_0xb352('0x43')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50010e[_0xb352('0x53')]);loggerPredictive[_0xb352('0x43')](_0xb352('0x54'),_0x50010e['erlangCallToSecond']);loggerPredictive[_0xb352('0x43')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50010e[_0xb352('0x55')]);loggerPredictive[_0xb352('0x43')](_0xb352('0x56'),_0x50010e[_0xb352('0x57')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50010e[_0xb352('0x55')]);loggerPredictive[_0xb352('0x43')]('---------------------------');_[_0xb352('0x58')](_0x4622bd,_0x50010e);};}function ifInterval(_0x2070f0,_0x181991){if(_[_0xb352('0x4d')](_0x181991)){return![];}return utils[_0xb352('0x59')](undefined,_0x181991)<_0x2070f0*0x3c;}function clearPredictiveAttributes(_0x14caed){if(_0x14caed[_0xb352('0x23')]){_0x14caed[_0xb352('0x23')]=undefined;loggerPredictive['debug'](_0x14caed[_0xb352('0x41')],_0xb352('0x5a'));}if(_0x14caed[_0xb352('0x22')]){_0x14caed[_0xb352('0x22')]=undefined;loggerPredictive[_0xb352('0x5b')](_0x14caed[_0xb352('0x41')],_0xb352('0x5c'));}if(_0x14caed[_0xb352('0x5d')]){clearInterval(_0x14caed[_0xb352('0x5d')]);_0x14caed[_0xb352('0x5d')]=undefined;loggerPredictive['debug'](_0x14caed[_0xb352('0x41')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1fa490,_0xc7ad35){return function(_0x1e8a4e){loggerPredictive['error'](_0xc7ad35[_0xb352('0x41')],_0x1fa490);loggerPredictive['error'](_0x1e8a4e[_0xb352('0x5e')]);clearPredictiveAttributes(_0xc7ad35);};}function loggerCatch(_0x4493ca){return function(_0x4f9533){logger[_0xb352('0x5f')](_0x4493ca,util['inspect'](_0x4f9533,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2331a4,_0x57524d,_0x304414){return function(_0x1ed802){utils[_0xb352('0x60')](_0x57524d,_0x304414,0x0);logger[_0xb352('0x5f')](_0x2331a4,util[_0xb352('0x3e')](_0x1ed802,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2816d3){return function(_0x5f527d){if(isNotNull(_0x5f527d)&&isNotNull(_0x5f527d[0x0])){if(_0x5f527d[0x0][_0xb352('0x61')]>0x0){_0x2816d3['message']=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0xb352('0x43')]('[getContactDialer2][ReScheduled]'+_0x2816d3[_0xb352('0x41')],_0x5f527d[0x0][_0xb352('0x61')],_0xb352('0x62'));}else{_0x2816d3[_0xb352('0x63')]=utils[_0xb352('0x64')][_0xb352('0x65')];logger['info']('[getContactDialer2][Empty]'+_0x2816d3['name']);}}};}function createObjHistory(_0x14784e,_0x3fbb12,_0x4035a6,_0x47d16b,_0x1e7fad){_0x14784e[_0xb352('0x63')]=_0x4035a6;var _0x2a214d=new Action(_0x14784e,_0x3fbb12);var _0x51fe3f=new History(_0x2a214d);_0x51fe3f[_0xb352('0x66')]=_0x47d16b;_0x51fe3f[_0xb352('0x67')]=_0x1e7fad;_0x51fe3f[_0xb352('0x68')]=_0x2a214d[_0xb352('0x69')];return _0x51fe3f;}function unlockQueueStatus(_0x4c6526,_0x546365){setTimeout(function(){if(_['isUndefined'](_0x4c6526['queueStatusComplete'])){loggerBooked[_0xb352('0x5f')](_0xb352('0x6a'),_0x546365);}_0x4c6526[_0xb352('0x6b')]=!![];loggerBooked[_0xb352('0x43')](_0xb352('0x6c'),_0x546365,JSON[_0xb352('0x6d')](_[_0xb352('0x6e')](_0x4c6526,['name',_0xb352('0x6b')])));},0x1f3);}function checkInterval(_0x300f78){return function(){if(!isNotNull(_0x300f78[_0xb352('0x6f')])){_0x300f78['message']=utils[_0xb352('0x64')]['NULL_INTERVAL'];throw _0x300f78['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x300f78['Interval']['Intervals'])){_0x300f78['message']=utils[_0xb352('0x64')][_0xb352('0x70')];throw _0x300f78[_0xb352('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x300f78[_0xb352('0x6f')]['Intervals']))){_0x300f78[_0xb352('0x63')]=utils[_0xb352('0x64')]['NULL_INTERVAL'];throw _0x300f78[_0xb352('0x41')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x8bc20b){return function(){if(!utils[_0xb352('0x71')](_0x8bc20b)){_0x8bc20b['message']=utils[_0xb352('0x64')][_0xb352('0x72')];throw _0x8bc20b[_0xb352('0x41')]+_0xb352('0x73');}};}function emitCampaignSummary(_0x5a008e){if(utils[_0xb352('0x74')](_0x5a008e)){emit(util[_0xb352('0x3f')](_0xb352('0x75'),_0x5a008e['name']),_0xb352('0x76'),_0x5a008e);}}function loggerCatchQueueSummary(_0x50b204,_0x179a28){return function(_0x3f1ede){clearPredictiveAttributes(_0x179a28);emitCampaignSummary(_0x179a28);loggerSyncQueueSummary[_0xb352('0x5b')](_0x50b204,util[_0xb352('0x3e')](_0x3f1ede,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x22b525){if(_0x22b525[_0xb352('0x77')]){if(_0x22b525[_0xb352('0x78')]===0x0){_0x22b525['sendMessageOneNotActive']=![];_0x22b525[_0xb352('0x63')]=utils['CAMPAIGN_STATUS'][_0xb352('0x72')];loggerSyncQueueSummary[_0xb352('0x5b')](_0xb352('0x79'),_0x22b525[_0xb352('0x41')],_0xb352('0x7a'));}else{_0x22b525[_0xb352('0x63')]=utils[_0xb352('0x64')][_0xb352('0x7b')];loggerSyncQueueSummary[_0xb352('0x5b')](_0xb352('0x79'),_0x22b525['name'],_0xb352('0x7c'));}emitCampaignSummary(_0x22b525);}}function myreject(_0x4aacf9){return function(_0x5a78ae){return _0x4aacf9(msgResponse(_0xb352('0x7d'),_0xb352('0x7e'),JSON[_0xb352('0x6d')](_0x5a78ae)));};}Dialer['prototype'][_0xb352('0x7f')]=function(_0x1653ad){return!_[_0xb352('0x4d')](_0x1653ad)&&_0x1653ad&&!_['isUndefined'](_0x1653ad['name'])&&!_[_0xb352('0x4d')](_0x1653ad['active'])&&_0x1653ad['active']&&(this[_0xb352('0x1c')][util['format'](_0xb352('0x80'),_0x1653ad[_0xb352('0x41')])][_0xb352('0x81')]==='reachable'||this[_0xb352('0x1c')][util[_0xb352('0x3f')](_0xb352('0x80'),_0x1653ad[_0xb352('0x41')])][_0xb352('0x81')]===_0xb352('0x82'));};Dialer[_0xb352('0x14')][_0xb352('0x83')]=function(_0x4029da){var _0xcfbfca=this;return function(){if(!_0xcfbfca[_0xb352('0x7f')](_0x4029da[_0xb352('0x84')])){if(!_0xcfbfca[_0xb352('0x7f')](_0x4029da[_0xb352('0x85')])){_0x4029da[_0xb352('0x63')]=utils['CAMPAIGN_STATUS'][_0xb352('0x86')];throw _0x4029da[_0xb352('0x41')]+_0xb352('0x87');}}};};Dialer['prototype'][_0xb352('0x88')]=function(_0x1cb060,_0x3c7433,_0x37800b,_0x5cac1b){var _0x13b6f9=this;return function(){var _0x336b02=!![];return _0x13b6f9[_0xb352('0x89')](_0x1cb060,_0x3c7433,_0x37800b,_0x5cac1b,_0x336b02);};};Dialer[_0xb352('0x14')]['checkIfTimeIntervals']=function(_0x397764,_0xda8cde,_0x407ecb,_0x33f486){var _0x5cdacb=this;return function(){var _0x2f8d5c=![];return _0x5cdacb['ifTimeIvr'](_0x397764[_0xb352('0x8a')],_0xda8cde,_0x407ecb,_0x33f486,_0x2f8d5c);};};Dialer[_0xb352('0x14')]['ifTimeIvr']=function(_0x434f38,_0x4be30f,_0x43e299,_0x15d55b,_0x4cad36){var _0x52951b=[];return new Promise(function(_0x483011,_0x5c5769){if(!isNotNull(_0x434f38)){_0x15d55b[_0xb352('0x63')]=utils[_0xb352('0x64')][_0xb352('0x70')];return _0x5c5769(msgResponse(_0xb352('0x8b'),_0xb352('0x8c'),_0x43e299+_0xb352('0x8d')));}if(_['isEmpty'](_0x434f38)){_0x15d55b[_0xb352('0x63')]=utils[_0xb352('0x64')][_0xb352('0x8e')];return _0x5c5769(msgResponse(_0xb352('0x8b'),_0xb352('0x8c'),_0x43e299+_0xb352('0x8f')));}if(_0x4be30f&&_[_0xb352('0x4d')](config['timezones'][_0x4be30f])){_0x15d55b['message']=utils[_0xb352('0x64')][_0xb352('0x90')];return _0x5c5769(msgResponse('ifTime',_0xb352('0x8c'),_0x43e299+'\x20Timezone\x20unknow\x20'+_0x4be30f));}if(_[_0xb352('0x91')](_0x434f38)){for(var _0x4814e0=0x0;_0x4814e0<_0x434f38[_0xb352('0x92')];_0x4814e0+=0x1){_0x52951b[_0xb352('0x93')](ami['Action']({'action':_0xb352('0x94'),'command':util[_0xb352('0x3f')]('iftime\x20%s,%s',_0x434f38[_0x4814e0]['interval'],!_[_0xb352('0x4d')](config[_0xb352('0x95')][_0x4be30f])?_0x4be30f:'')})[_0xb352('0x39')](function(_0x2ba214){return _0x2ba214[_0xb352('0x96')][_0xb352('0x97')](_0xb352('0x98'))>=0x0;})[_0xb352('0x99')](myreject(_0x5c5769)));}}else{_0x52951b[_0xb352('0x93')](ami[_0xb352('0x9a')]({'action':_0xb352('0x94'),'command':util[_0xb352('0x3f')](_0xb352('0x9b'),_0x434f38,!_[_0xb352('0x4d')](config[_0xb352('0x95')][_0x4be30f])?_0x4be30f:'')})[_0xb352('0x39')](function(_0x4b6ff1){return _0x4b6ff1[_0xb352('0x96')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x5c5769)));}Promise[_0xb352('0x9c')](_0x52951b)[_0xb352('0x39')](function(_0x4f697d){var _0x117287=_[_0xb352('0x9d')](_0x4f697d);if(_0x117287){return _0x483011(_0x117287);}else{_0x15d55b['message']=_0x4cad36?utils['CAMPAIGN_STATUS'][_0xb352('0x9e')]:utils[_0xb352('0x64')][_0xb352('0x9f')];return _0x5c5769(msgResponse(_0xb352('0xa0'),'Failure',_0xb352('0xa1')+_0x4cad36+'\x20'+_0x43e299+_0xb352('0xa2')+util[_0xb352('0x3e')](_0x434f38,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4be30f));}})['catch'](function(_0x84d064){return _0x5c5769(msgResponse(_0xb352('0x8b'),_0xb352('0x8c'),JSON[_0xb352('0x6d')](_0x84d064)));});});};Dialer[_0xb352('0x14')]['loopCampaigns']=function(){var _0x5a6cec=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xb352('0x39')](function(){setInterval(function(){_0x5a6cec[_0xb352('0xa3')]();},0x3e8);});};Dialer['prototype'][_0xb352('0xa3')]=function(){var _0x1fbd1c=this;var _0x20bb0e;for(var _0x236ff4 in this[_0xb352('0x1a')]){if(typeof this[_0xb352('0x1a')][_0x236ff4]!==_0xb352('0xa4')){_0x20bb0e=this[_0xb352('0x1a')][_0x236ff4];if(utils['isIVRCampaign'](_0x20bb0e)&&utils[_0xb352('0x71')](_0x20bb0e)){_0x20bb0e[_0xb352('0x77')]=!![];Promise['resolve']()[_0xb352('0x39')](checkIsIVRCampaignActive(_0x20bb0e))[_0xb352('0x39')](checkInterval(_0x20bb0e))[_0xb352('0x39')](_0x1fbd1c[_0xb352('0x83')](_0x20bb0e))[_0xb352('0x39')](_0x1fbd1c[_0xb352('0x88')](_0x20bb0e[_0xb352('0xa5')],_0x20bb0e[_0xb352('0xa6')],_0x20bb0e[_0xb352('0x41')],_0x20bb0e))[_0xb352('0x39')](_0x1fbd1c['checkIfTimeIntervals'](_0x20bb0e[_0xb352('0x6f')],_0x20bb0e[_0xb352('0xa6')],_0x20bb0e[_0xb352('0x41')],_0x20bb0e))[_0xb352('0x39')](_0x1fbd1c[_0xb352('0xa7')](_0x20bb0e))[_0xb352('0x99')](loggerCatchQueueSummary(_0xb352('0xa8'),_0x20bb0e));}else{notSendMessagesCampaign(_0x20bb0e);}}}};Dialer['prototype']['checkDialMethod']=function(_0x2852e8){if(_0x2852e8[_0xb352('0xa9')]!==_0xb352('0x8')){clearPredictiveAttributes(_0x2852e8);}switch(_0x2852e8[_0xb352('0xa9')]){case _0xb352('0xaa'):this[_0xb352('0xab')](_0x2852e8,0x1);break;case _0xb352('0xac'):this[_0xb352('0xab')](_0x2852e8,_0x2852e8[_0xb352('0xad')]);break;case _0xb352('0x8'):this[_0xb352('0x8')](_0x2852e8);break;case _0xb352('0xae'):this['handlePower'](_0x2852e8,0x1);break;default:logger[_0xb352('0x5f')](_0xb352('0xaf'),_0x2852e8[_0xb352('0x41')],_0xb352('0xb0'));}};Dialer[_0xb352('0x14')][_0xb352('0x8b')]=function(_0x5d8b11,_0x57a073){var _0x5a7176=_0x5d8b11[_0xb352('0xa6')];var _0x36fc98=_0x57a073?_0x5d8b11[_0xb352('0xa5')]:_0x5d8b11[_0xb352('0x6f')][_0xb352('0x8a')];logger[_0xb352('0xb1')](_0xb352('0xb2'),_0x36fc98,_0x5a7176,_0x5d8b11['name'],util[_0xb352('0x3f')](_0xb352('0xb3'),_0x5d8b11[_0xb352('0x41')],_0x5d8b11['id']));var _0x715b1e=null;return Interval[_0xb352('0xb4')](_0x36fc98,_0x5a7176)[_0xb352('0x39')](function(_0x5f2702){if(_0x5f2702===!![]){return _0x5f2702;}else{_0x5d8b11[_0xb352('0x63')]=_0x57a073?utils[_0xb352('0x64')][_0xb352('0x9e')]:utils[_0xb352('0x64')][_0xb352('0x9f')];_0x715b1e=msgResponse(_0xb352('0xa0'),'Failure',_0xb352('0xa1')+_0x57a073+'\x20'+_0x5d8b11[_0xb352('0x41')]+_0xb352('0xa2')+util[_0xb352('0x3e')](_0x36fc98,{'showHidden':![],'depth':null})+_0xb352('0xb5')+_0x5a7176);}if(_0x715b1e!==null){logger[_0xb352('0xb1')](_0xb352('0xb6'),_0x715b1e);_0x715b1e[_0xb352('0xb7')]=_0x57a073;throw _0x715b1e;}})[_0xb352('0x99')](function(_0x753a3c){logger[_0xb352('0x5f')](_0xb352('0xb8'),_0x753a3c);throw msgResponse(_0xb352('0x7d'),_0xb352('0x7e'),util[_0xb352('0x3e')](_0x753a3c,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xb352('0x29')]=function(_0x368d8f){if(this[_0xb352('0x19')][_0x368d8f['queue']]){if(this[_0xb352('0x20')][_0x368d8f['uniqueid']]&&this['uniqueId'][_0x368d8f['uniqueid']][_0xb352('0x3b')]!=='ivr'){this['updateOriginated'](this[_0xb352('0x19')][_0x368d8f[_0xb352('0xb9')]]);this[_0xb352('0x20')][_0x368d8f[_0xb352('0xba')]][_0xb352('0xbb')]=moment()[_0xb352('0x3f')](_0xb352('0xbc'));}}};Dialer['prototype'][_0xb352('0x2e')]=function(_0x3be902){var _0x54bbf3=this[_0xb352('0x20')][_0x3be902[_0xb352('0xba')]];if(this['voiceQueues'][_0x3be902['queue']]){if(_0x54bbf3&&_0x54bbf3[_0xb352('0x3b')]!==_0xb352('0xbd')){delete this[_0xb352('0x20')][_0x3be902[_0xb352('0xba')]];this['voiceQueues'][_0x3be902['queue']][_0xb352('0xbe')]+=0x1;var _0x24cc1e=new AgentComplete(_0x54bbf3,_0x3be902);if(_0x3be902[_0xb352('0xbf')]===_0xb352('0xc0')){_0x24cc1e[_0xb352('0xc1')]=this[_0xb352('0x19')][_0x3be902[_0xb352('0xb9')]]['dialQueueProject2']&&this['voiceQueues'][_0x3be902[_0xb352('0xb9')]]['dialAgiAfterHangupAgent']?moment()[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xb352('0xc2')](_0x24cc1e)[_0xb352('0x99')](loggerCatch(_0xb352('0xc3')));hopperUtils[_0xb352('0xc4')](_0x24cc1e)[_0xb352('0x99')](loggerCatch(_0xb352('0xc5')));}}};Dialer[_0xb352('0x14')][_0xb352('0x2b')]=function(_0x4c7460){var _0x4e83f3=this[_0xb352('0x20')][_0x4c7460[_0xb352('0xba')]];var _0x1a01b9=this;var _0x4b0214=![];var _0x5c5519;var _0x2faccb;if(this['voiceQueues'][_0x4c7460[_0xb352('0xb9')]]){if(_0x4e83f3&&_0x4e83f3[_0xb352('0x3b')]!==_0xb352('0xbd')){delete this[_0xb352('0x20')][_0x4c7460[_0xb352('0xba')]];this[_0xb352('0xc6')](this[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]]);_0x4e83f3['droptime']=moment()[_0xb352('0x3f')](_0xb352('0xbc'));var _0x1bfb2a=new QueueCallerAbandon(_0x4e83f3,_0x4c7460);if(utils[_0xb352('0x59')](_0x4e83f3['droptime'],_0x4e83f3[_0xb352('0xc7')])>=_0x4e83f3[_0xb352('0xc8')]){this[_0xb352('0x19')][_0x4c7460['queue']][_0xb352('0x48')]+=0x1;this['voiceQueues'][_0x4c7460['queue']][_0xb352('0xc9')]+=0x1;this[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]][_0xb352('0xca')]+=0x1;_0x1bfb2a['state']=0xa;_0x1bfb2a[_0xb352('0x67')]=_0xb352('0xcb');_0x1bfb2a[_0xb352('0xcc')]=_0xb352('0xcd');_0x1bfb2a[_0xb352('0xc1')]=this[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]]['dialQueueProject2']?moment()['format'](_0xb352('0xbc')):undefined;_0x1bfb2a[_0xb352('0xce')]+=0x1;_0x1bfb2a[_0xb352('0xcf')]+=0x1;_0x5c5519=this[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]][_0xb352('0xd0')];_0x2faccb=this[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]][_0xb352('0xd1')];hopperUtils[_0xb352('0xd2')](_0x1bfb2a,_0x1bfb2a[_0xb352('0x66')],_0x4e83f3[_0xb352('0xd3')])[_0xb352('0x39')](function(_0xa02d64){_0x4b0214=_0xa02d64['additional']==0x1;if(_0x1bfb2a['countdropretry']>=_0x1a01b9['voiceQueues'][_0x4c7460['queue']][_0xb352('0xd4')]){_0x1a01b9[_0xb352('0xd5')](_0x1bfb2a,_0xa02d64[_0xb352('0xd6')]);}else{hopperUtils[_0xb352('0xd7')]({'active':![],'countdropretry':_0x1bfb2a[_0xb352('0xce')],'scheduledat':moment()[_0xb352('0xd8')](_0x1a01b9[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]][_0xb352('0xd0')],_0xb352('0xd9'))[_0xb352('0x3f')](_0xb352('0xbc')),'ContactId':_0x4e83f3[_0xb352('0xda')],'ListId':_0x4e83f3[_0xb352('0xdb')],'VoiceQueueId':_0x4e83f3[_0xb352('0xdc')]||undefined,'CampaignId':_0x4e83f3['CampaignId']||undefined})['catch'](loggerCatch(_0xb352('0xdd')));var _0x403f53=new History(_0x1bfb2a);_0x403f53[_0xb352('0x66')]=0xa;_0x403f53['statedesc']='Drop';_0x403f53[_0xb352('0x69')]=moment()[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x403f53[_0xb352('0x68')]=_0x403f53['starttime'];_0x403f53[_0xb352('0xde')]=_0x1bfb2a[_0xb352('0xde')];_0x403f53[_0xb352('0xdf')]=_0x1bfb2a[_0xb352('0xdf')];hopperUtils[_0xb352('0xc2')](_0x403f53)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xb352('0x39')](function(){if(_0x4b0214)hopperUtils[_0xb352('0xe0')](_0x1bfb2a,_0x5c5519,_0x2faccb)[_0xb352('0x39')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4c7460['queue']][_0xb352('0x49')]+=0x1;this['voiceQueues'][_0x4c7460[_0xb352('0xb9')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1bfb2a[_0xb352('0x66')]=0xb;_0x1bfb2a[_0xb352('0x67')]='Abandoned';_0x1bfb2a[_0xb352('0xcc')]=_0xb352('0xe1');_0x1bfb2a['countabandonedretry']+=0x1;_0x1bfb2a[_0xb352('0xcf')]+=0x1;_0x5c5519=this['voiceQueues'][_0x4c7460[_0xb352('0xb9')]][_0xb352('0xe2')];_0x2faccb=this[_0xb352('0x19')][_0x4c7460['queue']][_0xb352('0xd1')];hopperUtils[_0xb352('0xd2')](_0x1bfb2a,_0x1bfb2a[_0xb352('0x66')],_0x4e83f3['voiceQueue'])[_0xb352('0x39')](function(_0x528494){if(_0x1bfb2a['countabandonedretry']>=_0x1a01b9[_0xb352('0x19')][_0x4c7460[_0xb352('0xb9')]][_0xb352('0xe3')]){_0x1a01b9[_0xb352('0xd5')](_0x1bfb2a,_0x528494[_0xb352('0xd6')]);}else{hopperUtils[_0xb352('0xd7')]({'active':![],'countabandonedretry':_0x1bfb2a[_0xb352('0xe4')],'scheduledat':moment()[_0xb352('0xd8')](_0x1a01b9['voiceQueues'][_0x4c7460['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e83f3['ContactId'],'ListId':_0x4e83f3['ListId'],'VoiceQueueId':_0x4e83f3['VoiceQueueId']||undefined,'CampaignId':_0x4e83f3[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x35a3bd=new History(_0x1bfb2a);_0x35a3bd['state']=0xb;_0x35a3bd[_0xb352('0x67')]=_0xb352('0xe6');_0x35a3bd[_0xb352('0x69')]=moment()['format'](_0xb352('0xbc'));_0x35a3bd['endtime']=_0x35a3bd[_0xb352('0x69')];_0x35a3bd[_0xb352('0xde')]=_0x1bfb2a['calleridname'];_0x35a3bd[_0xb352('0xdf')]=_0x1bfb2a[_0xb352('0xdf')];hopperUtils[_0xb352('0xc2')](_0x35a3bd)['catch'](loggerCatch(_0xb352('0xe7')));}})[_0xb352('0x39')](function(){if(_0x4b0214)hopperUtils[_0xb352('0xe0')](_0x1bfb2a,_0x5c5519,_0x2faccb)['then'](function(){return 0x1;});});}}}};Dialer[_0xb352('0x14')][_0xb352('0xe8')]=function(_0x151a8f){if(this[_0xb352('0xe9')][_0x151a8f[_0xb352('0xba')]]){this['actions'][_0x151a8f[_0xb352('0xba')]]['channel']=_0x151a8f[_0xb352('0xea')];}if(this[_0xb352('0x20')][_0x151a8f[_0xb352('0xba')]]){this[_0xb352('0x20')][_0x151a8f[_0xb352('0xba')]][_0xb352('0xea')]=_0x151a8f[_0xb352('0xea')];}};Dialer[_0xb352('0x14')][_0xb352('0xeb')]=function(_0x38e7a0){if(!this[_0xb352('0xe9')][_0x38e7a0[_0xb352('0xec')]]){return;}var _0xd89aa8=this['voiceQueues'][this[_0xb352('0xe9')][_0x38e7a0['actionid']][_0xb352('0xb9')]][_0xb352('0xed')]||_0xb352('0xee');if(_0xd89aa8==='roundrobin'){if(this[_0xb352('0xe9')][_0x38e7a0['actionid']]&&_[_0xb352('0xef')](this[_0xb352('0xe9')][_0x38e7a0[_0xb352('0xec')]][_0xb352('0xf0')])&&_0x38e7a0[_0xb352('0x81')]==='1'&&_0x38e7a0[_0xb352('0xf1')]==='0'){if(this[_0xb352('0x1b')][_0x38e7a0[_0xb352('0xf2')]]){if(!this[_0xb352('0x1b')][_0x38e7a0[_0xb352('0xf2')]]['locked']){this[_0xb352('0x1b')][_0x38e7a0[_0xb352('0xf2')]][_0xb352('0xf0')]=!![];this[_0xb352('0xe9')][_0x38e7a0['actionid']][_0xb352('0xf0')]=!![];this['actions'][_0x38e7a0[_0xb352('0xec')]][_0xb352('0xf2')]=_0x38e7a0[_0xb352('0xf2')];}}}}else if(_0xd89aa8==='rrmemory'){if(this[_0xb352('0xe9')][_0x38e7a0['actionid']]){if(this[_0xb352('0x1b')][_0x38e7a0[_0xb352('0xf2')]]){this[_0xb352('0xe9')][_0x38e7a0['actionid']][_0xb352('0xf2')]=_0x38e7a0[_0xb352('0xf2')];if(_[_0xb352('0xef')](this['queueBooked'][this['actions'][_0x38e7a0[_0xb352('0xec')]][_0xb352('0xb9')]])){this['queueBooked'][this['actions'][_0x38e7a0[_0xb352('0xec')]]['queue']]=[];}this['queueBooked'][this[_0xb352('0xe9')][_0x38e7a0[_0xb352('0xec')]][_0xb352('0xb9')]][_0xb352('0x93')](_[_0xb352('0x58')](_['pick'](this[_0xb352('0xe9')][_0x38e7a0[_0xb352('0xec')]],['idHopper',_0xb352('0xf2')]),{'status':_0x38e7a0['status'],'paused':_0x38e7a0['paused']}));}}}};Dialer[_0xb352('0x14')][_0xb352('0x36')]=function(_0xeb338f){if(!this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]){return;}var _0x365f93=this;var _0x43db50=this[_0xb352('0x19')][this[_0xb352('0xe9')][_0xeb338f['actionid']][_0xb352('0xb9')]];var _0x29b609=_0x43db50[_0xb352('0xed')]||_0xb352('0xee');if(_0x29b609===_0xb352('0xf3')){if(this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]&&this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xf2')]){this['preview']['run'](this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xf4')],this[_0xb352('0xe9')][_0xeb338f['actionid']][_0xb352('0xf2')])['catch'](function(_0x33943a){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0xb352('0x3e')](_0x33943a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x365f93[_0xb352('0xc6')](_0x365f93[_0xb352('0x19')][_0x365f93['actions'][_0xeb338f[_0xb352('0xec')]]['queue']]);_0x365f93[_0xb352('0x1b')][_0x365f93[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xf2')]][_0xb352('0xf0')]=![];delete _0x365f93[_0xb352('0xe9')][_0xeb338f['actionid']];unlockQueueStatus(_0x43db50);});}else{this['updateOriginated'](this[_0xb352('0x19')][this['actions'][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0xeb338f['actionid']]['ContactId'],'ListId':this['actions'][_0xeb338f['actionid']]['ListId'],'VoiceQueueId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xdc')]||undefined,'CampaignId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]];unlockQueueStatus(_0x43db50);}}else if(_0x29b609===_0xb352('0xee')){var _0x3ad264;if(this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]&&!_[_0xb352('0xf5')](this[_0xb352('0x25')][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['queue']])){if(this[_0xb352('0x26')][_0x365f93[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]){this[_0xb352('0x26')][_0x365f93[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['queue']]=this[_0xb352('0x26')][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]?this[_0xb352('0x26')][this[_0xb352('0xe9')][_0xeb338f['actionid']][_0xb352('0xb9')]]:this['queueBooked'][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]?this['queueBooked'][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]][_0xb352('0xf6')]||0x0:0x0;}this['queueBooked'][this['actions'][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]['_rr']=this['queueBookedRR'][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]];for(var _0x4dcf14=0x0;_0x4dcf14<this['queueBooked'][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]][_0xb352('0x92')];_0x4dcf14+=0x1){_0x3ad264=rr(this[_0xb352('0x25')][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]);this[_0xb352('0x26')][_0x365f93[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]=this[_0xb352('0x25')][this['actions'][_0xeb338f[_0xb352('0xec')]]['queue']][_0xb352('0xf6')];if(_0x3ad264[_0xb352('0x81')]==='1'&&_0x3ad264[_0xb352('0xf1')]==='0'){break;}}if(!_['isNil'](_0x3ad264)){this[_0xb352('0x1b')][_0x3ad264[_0xb352('0xf2')]][_0xb352('0xf7')]=_['isUndefined'](this[_0xb352('0x1b')][_0x3ad264[_0xb352('0xf2')]][_0xb352('0xf7')])?!![]:this['agents'][_0x3ad264[_0xb352('0xf2')]][_0xb352('0xf7')];}loggerBooked[_0xb352('0x43')](_0xb352('0xf8'),_0xeb338f[_0xb352('0xec')],_0xb352('0xf9'),JSON['stringify'](_[_0xb352('0x6e')](this[_0xb352('0x1b')][_0x3ad264[_0xb352('0xf2')]],[_0xb352('0x41'),_0xb352('0xf7')])),_0xb352('0xfa'),JSON[_0xb352('0x6d')](_0x3ad264[_0xb352('0xf4')]));if(!_[_0xb352('0xef')](_0x3ad264)&&_0x3ad264['status']==='1'&&_0x3ad264[_0xb352('0xf1')]==='0'&&this[_0xb352('0x1b')][_0x3ad264['stateinterface']][_0xb352('0xf7')]){this[_0xb352('0x1b')][_0x3ad264[_0xb352('0xf2')]][_0xb352('0xf7')]=![];this['queueBooked'][_0x365f93[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['queue']]=[];this['preview'][_0xb352('0xfb')](_0x3ad264[_0xb352('0xf4')],_0x3ad264['stateinterface'])[_0xb352('0x99')](function(_0x381545){logger['error'](_0xb352('0xfc'),util['inspect'](_0x381545,{'showHidden':![],'depth':null}));})[_0xb352('0x17')](function(){_0x365f93[_0xb352('0xc6')](_0x365f93['voiceQueues'][_0x365f93[_0xb352('0xe9')][_0xeb338f['actionid']]['queue']]);setTimeout(function(){_0x365f93[_0xb352('0x1b')][_0x3ad264[_0xb352('0xf2')]]['unlockRR']=!![];loggerBooked['info']('[booked][RR][finaly]',_0xeb338f[_0xb352('0xec')],_0xb352('0xf9'),JSON[_0xb352('0x6d')](_['pick'](_0x365f93[_0xb352('0x1b')][_0x3ad264[_0xb352('0xf2')]],['name',_0xb352('0xf7')])),_0xb352('0xfa'),JSON[_0xb352('0x6d')](_0x3ad264[_0xb352('0xf4')]));},0xc7);delete _0x365f93[_0xb352('0xe9')][_0xeb338f['actionid']];unlockQueueStatus(_0x43db50,_0xeb338f[_0xb352('0xec')]);});}else{loggerBooked[_0xb352('0x43')](_0xb352('0xfd'));this[_0xb352('0xc6')](this[_0xb352('0x19')][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['queue']]);hopperUtils[_0xb352('0xd7')]({'active':![],'ContactId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xda')],'ListId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xdb')],'VoiceQueueId':this[_0xb352('0xe9')][_0xeb338f['actionid']][_0xb352('0xdc')]||undefined,'CampaignId':this[_0xb352('0xe9')][_0xeb338f['actionid']][_0xb352('0xe5')]||undefined})['catch'](loggerCatch(_0xb352('0xfe')));delete this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]];unlockQueueStatus(_0x43db50);}}else{loggerBooked[_0xb352('0x43')](_0xb352('0xff'));this['updateOriginated'](this[_0xb352('0x19')][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['queue']]);hopperUtils[_0xb352('0xd7')]({'active':![],'ContactId':this[_0xb352('0xe9')][_0xeb338f['actionid']][_0xb352('0xda')],'ListId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]]['ListId'],'VoiceQueueId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xdc')]||undefined,'CampaignId':this['actions'][_0xeb338f[_0xb352('0xec')]][_0xb352('0xe5')]||undefined})['catch'](loggerCatch(_0xb352('0x100')));delete this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]];unlockQueueStatus(_0x43db50);}}else{loggerBooked[_0xb352('0x43')](_0xb352('0x101'));this[_0xb352('0xc6')](this[_0xb352('0x19')][this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xb9')]]);hopperUtils[_0xb352('0xd7')]({'active':![],'ContactId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xda')],'ListId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xdb')],'VoiceQueueId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xdc')]||undefined,'CampaignId':this[_0xb352('0xe9')][_0xeb338f[_0xb352('0xec')]][_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x102')));delete this['actions'][_0xeb338f[_0xb352('0xec')]];unlockQueueStatus(_0x43db50);}};Dialer[_0xb352('0x14')][_0xb352('0x2c')]=function(_0x11fab0){var _0x48755d=this['actions'][_0x11fab0[_0xb352('0xec')]];if(_0x48755d){delete this[_0xb352('0xe9')][_0x11fab0[_0xb352('0xec')]];_0x48755d[_0xb352('0xc7')]=moment()[_0xb352('0x3f')](_0xb352('0xbc'));var _0x2b8bff=_0x48755d[_0xb352('0x3b')]===_0xb352('0xbd')?this[_0xb352('0x1a')][_0x48755d[_0xb352('0xb9')]]:this[_0xb352('0x19')][_0x48755d[_0xb352('0x103')]()];if(_0x11fab0[_0xb352('0x104')]!==_0xb352('0x105')){this[_0xb352('0xc6')](_0x2b8bff);return this['callProgressDetecting'](_0x48755d,_0x2b8bff,_0x11fab0)['catch'](loggerCatch(_0xb352('0x106')));}this[_0xb352('0x20')][_0x11fab0[_0xb352('0xba')]]=_0x48755d;}};Dialer[_0xb352('0x14')][_0xb352('0x33')]=function(_0x560b8f){var _0x2d09a9=this;var _0x3a9df7=this[_0xb352('0x20')][_0x560b8f['uniqueid']];var _0x28ee8d;if(!_[_0xb352('0xef')](_0x560b8f)&&!_['isNil'](_0x560b8f[_0xb352('0x107')])&&!_[_0xb352('0xef')](_0x560b8f[_0xb352('0x107')][_0xb352('0x108')])&&_0x560b8f[_0xb352('0x109')]===_0xb352('0x10a')&&_0x3a9df7){if(_0x3a9df7['type']!=='ivr'&&this[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0x10b')]&&_0x560b8f[_0xb352('0x10c')]===_0xb352('0x10d')){delete this['uniqueId'][_0x560b8f[_0xb352('0xba')]];this['updateOriginated'](this[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]]);this[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0xbe')]+=0x1;this[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0x10e')]+=0x1;_0x28ee8d=new Hangup(_0x3a9df7,_0x560b8f);_0x28ee8d['state']=0x12;_0x28ee8d[_0xb352('0x67')]=_0xb352('0x10f');_0x28ee8d['membername']=_0xb352('0x110');ami[_0xb352('0x3a')](_0xb352('0x111'),ut[_0xb352('0x112')](_0x28ee8d,_0xb352('0x113')));this[_0xb352('0x114')](_0x28ee8d,'[syncHangupInAMD][createHistory]',_0xb352('0x115'));}if(_0x3a9df7[_0xb352('0x3b')]!==_0xb352('0xbd')&&this['voiceQueues'][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0x10b')]&&_0x560b8f[_0xb352('0x10c')]===_0xb352('0x116')){return new Promise(function(_0x1ba5cd,_0x35d1db){delete _0x2d09a9[_0xb352('0x20')][_0x560b8f[_0xb352('0xba')]];_0x2d09a9[_0xb352('0xc6')](_0x2d09a9[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]]);_0x2d09a9[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0xbe')]+=0x1;_0x2d09a9['voiceQueues'][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0x10e')]+=0x1;var _0x152426=_0x2d09a9[_0xb352('0x19')][_0x3a9df7[_0xb352('0xb9')]];var _0xe158b=new Hangup(_0x3a9df7,_0x560b8f);_0xe158b[_0xb352('0x66')]=0x13;_0xe158b['statedesc']=_0xb352('0x117');_0xe158b[_0xb352('0x118')]=_0xb352('0x110');_0xe158b[_0xb352('0x119')]+=0x1;_0xe158b[_0xb352('0xcf')]+=0x1;_0xe158b[_0xb352('0x113')]=!![];ami[_0xb352('0x3a')]('custom:amd',ut[_0xb352('0x112')](_0xe158b,_0xb352('0x113')));hopperUtils[_0xb352('0xc2')](_0xe158b)[_0xb352('0x99')](loggerCatch(_0xb352('0x11a')));if(_0xe158b[_0xb352('0x11b')]+_0xe158b[_0xb352('0x11c')]+_0xe158b[_0xb352('0x11d')]+_0xe158b['countnosuchnumberretry']+_0xe158b[_0xb352('0xce')]+_0xe158b[_0xb352('0xe4')]+_0xe158b['countmachineretry']+_0xe158b['countagentrejectretry']>=_0x152426[_0xb352('0x11e')]){_0x2d09a9[_0xb352('0x11f')](_0xe158b,_0x1ba5cd,_0x35d1db,_0xb352('0x120'));}else{if(_0xe158b[_0xb352('0x119')]>=_0x152426[_0xb352('0x121')]){_0x2d09a9[_0xb352('0x122')](_0xe158b,_0x1ba5cd,_0x35d1db,_0xb352('0x123'));}else{hopperUtils[_0xb352('0xd7')]({'active':![],'countmachineretry':_0xe158b[_0xb352('0x119')],'scheduledat':moment()[_0xb352('0xd8')](_0x152426[_0xb352('0x124')],'minutes')['format'](_0xb352('0xbc')),'ContactId':_0xe158b[_0xb352('0xda')],'ListId':_0xe158b[_0xb352('0xdb')],'VoiceQueueId':_0xe158b['VoiceQueueId']||undefined,'CampaignId':_0xe158b[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch('[rescheduleContact][Machine]'));_0x1ba5cd({'reschedule':0x1});}}});}if(_0x3a9df7[_0xb352('0x3b')]===_0xb352('0xbd')&&this[_0xb352('0x1a')][_0x3a9df7[_0xb352('0xb9')]]['dialAMDActive']&&_0x560b8f[_0xb352('0x10c')]==='HANGUP'){delete this[_0xb352('0x20')][_0x560b8f[_0xb352('0xba')]];this[_0xb352('0xc6')](this['campaigns'][_0x3a9df7['queue']]);_0x28ee8d=new Hangup(_0x3a9df7,_0x560b8f);_0x28ee8d[_0xb352('0x66')]=0x12;_0x28ee8d[_0xb352('0x67')]=_0xb352('0x10f');_0x28ee8d[_0xb352('0x118')]='AMD';ami[_0xb352('0x3a')](_0xb352('0x111'),ut['buildObj'](_0x28ee8d,'amd'));this['saveInDb'](_0x28ee8d,_0xb352('0x125'),_0xb352('0x126'));}if(_0x3a9df7[_0xb352('0x3b')]===_0xb352('0xbd')&&this[_0xb352('0x1a')][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0x10b')]&&_0x560b8f[_0xb352('0x10c')]===_0xb352('0x116')){return new Promise(function(_0x4bca91,_0x490e37){delete _0x2d09a9[_0xb352('0x20')][_0x560b8f[_0xb352('0xba')]];_0x2d09a9[_0xb352('0xc6')](_0x2d09a9[_0xb352('0x1a')][_0x3a9df7[_0xb352('0xb9')]]);_0x2d09a9[_0xb352('0x1a')][_0x3a9df7['queue']]['outboundAnswerCallsDay']+=0x1;_0x2d09a9['campaigns'][_0x3a9df7[_0xb352('0xb9')]][_0xb352('0x10e')]+=0x1;var _0x5222f3=_0x2d09a9[_0xb352('0x1a')][_0x3a9df7['queue']];var _0x160fdf=new Hangup(_0x3a9df7,_0x560b8f);_0x160fdf[_0xb352('0x66')]=0x13;_0x160fdf[_0xb352('0x67')]='Machine';_0x160fdf['membername']=_0xb352('0x110');_0x160fdf[_0xb352('0x119')]+=0x1;_0x160fdf[_0xb352('0xcf')]+=0x1;_0x160fdf[_0xb352('0x113')]=!![];ami[_0xb352('0x3a')](_0xb352('0x111'),ut[_0xb352('0x112')](_0x160fdf,'amd'));hopperUtils[_0xb352('0xc2')](_0x160fdf)[_0xb352('0x99')](loggerCatch(_0xb352('0x11a')));if(_0x160fdf[_0xb352('0x11b')]+_0x160fdf['countcongestionretry']+_0x160fdf[_0xb352('0x11d')]+_0x160fdf['countnosuchnumberretry']+_0x160fdf[_0xb352('0xce')]+_0x160fdf[_0xb352('0xe4')]+_0x160fdf[_0xb352('0x119')]+_0x160fdf['countagentrejectretry']>=_0x5222f3['dialGlobalMaxRetry']){_0x2d09a9[_0xb352('0x11f')](_0x160fdf,_0x4bca91,_0x490e37,'reason19\x20machine....');}else{if(_0x160fdf['countmachineretry']>=_0x5222f3[_0xb352('0x121')]){_0x2d09a9['createStateFinal'](_0x160fdf,_0x4bca91,_0x490e37,'reason\x2019\x20machine....');}else{hopperUtils[_0xb352('0xd7')]({'active':![],'countmachineretry':_0x160fdf['countmachineretry'],'scheduledat':moment()[_0xb352('0xd8')](_0x5222f3['dialMachineRetryFrequency'],'minutes')[_0xb352('0x3f')](_0xb352('0xbc')),'ContactId':_0x160fdf[_0xb352('0xda')],'ListId':_0x160fdf[_0xb352('0xdb')],'VoiceQueueId':_0x160fdf['VoiceQueueId']||undefined,'CampaignId':_0x160fdf[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x127')));_0x4bca91({'reschedule':0x1});}}});}}};Dialer[_0xb352('0x14')][_0xb352('0x31')]=function(_0x24e9e4){var _0x17d148=this[_0xb352('0x20')][_0x24e9e4['uniqueid']];var _0x2620d5;if(_0x17d148&&_0x17d148[_0xb352('0x3b')]===_0xb352('0xbd')){delete this['uniqueId'][_0x24e9e4['uniqueid']];this['updateOriginated'](this[_0xb352('0x1a')][_0x17d148[_0xb352('0xb9')]]);this['campaigns'][_0x17d148['queue']][_0xb352('0x128')]+=0x1;_0x2620d5=new Hangup(_0x17d148,_0x24e9e4);hopperUtils[_0xb352('0xc2')](_0x2620d5)[_0xb352('0x99')](loggerCatch(_0xb352('0x129')));hopperUtils[_0xb352('0xc4')](_0x2620d5)[_0xb352('0x99')](loggerCatch(_0xb352('0x12a')));}if(_0x17d148&&_0x17d148['type']!==_0xb352('0xbd')&&isNotNull(this[_0xb352('0x19')][_0x17d148[_0xb352('0xb9')]]['dialQueueProject'])){delete this[_0xb352('0x20')][_0x24e9e4[_0xb352('0xba')]];this[_0xb352('0xc6')](this[_0xb352('0x19')][_0x17d148['queue']]);this['voiceQueues'][_0x17d148['queue']][_0xb352('0xbe')]+=0x1;this[_0xb352('0x19')][_0x17d148[_0xb352('0xb9')]][_0xb352('0x10e')]+=0x1;_0x2620d5=new Hangup(_0x17d148,_0x24e9e4);_0x2620d5[_0xb352('0x66')]=0x10;_0x2620d5['statedesc']=_0xb352('0x12b');_0x2620d5[_0xb352('0x118')]=_0xb352('0x12c');hopperUtils[_0xb352('0xc2')](_0x2620d5)[_0xb352('0x99')](loggerCatch(_0xb352('0x129')));hopperUtils[_0xb352('0xc4')](_0x2620d5)['catch'](loggerCatch(_0xb352('0x12a')));}if(_0x17d148&&_0x17d148['type']!=='ivr'&&!isNotNull(this[_0xb352('0x19')][_0x17d148['queue']][_0xb352('0x12d')])){delete this[_0xb352('0x20')][_0x24e9e4[_0xb352('0xba')]];this[_0xb352('0xc6')](this[_0xb352('0x19')][_0x17d148[_0xb352('0xb9')]]);this[_0xb352('0x19')][_0x17d148[_0xb352('0xb9')]][_0xb352('0x12e')]+=0x1;_0x2620d5=new Hangup(_0x17d148,_0x24e9e4);_0x2620d5[_0xb352('0x66')]=0xc;_0x2620d5[_0xb352('0x67')]=_0x24e9e4[_0xb352('0x12f')];_0x2620d5[_0xb352('0x118')]=_0xb352('0x130');hopperUtils['createHistory'](_0x2620d5)[_0xb352('0x99')](loggerCatch(_0xb352('0x129')));hopperUtils['moveContactManagedDialer'](_0x2620d5)[_0xb352('0x99')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xb352('0x14')][_0xb352('0xa')]=function(_0x27b165){var _0xa2d02a=this;if(!_0xa2d02a[_0xb352('0x27')][_0x27b165['name']]){_0xa2d02a['queuesSummary'][_0x27b165[_0xb352('0x41')]]={'running':![]};}else if(_0xa2d02a[_0xb352('0x27')][_0x27b165[_0xb352('0x41')]]['running']===!![]){return;}else if(_0xa2d02a[_0xb352('0x27')][_0x27b165[_0xb352('0x41')]][_0xb352('0x131')]===![]){_0xa2d02a[_0xb352('0x27')][_0x27b165['name']][_0xb352('0x131')]=!![];}var _0x515f53=_0xa2d02a[_0xb352('0x19')][_0x27b165[_0xb352('0x41')]];var _0x1bd5a5=_0x515f53[_0xb352('0x63')]!==utils[_0xb352('0x64')][_0xb352('0x72')];var _0x3a0500=utils['isPreviewCampaign'](_0x515f53);_0x515f53[_0xb352('0x132')]=utils['getQueueCampaignStatusMessage'](_0x515f53,_0xa2d02a[_0xb352('0x1c')]);Promise[_0xb352('0x133')]()[_0xb352('0x39')](function(){if(_0x515f53['statusMessage']===utils[_0xb352('0x64')][_0xb352('0x72')]){if(_0x1bd5a5){clearPredictiveAttributes(_0x515f53);_0x27b165['startPredictive']=undefined;_0x27b165['startProgressive']=undefined;}if(_0x515f53[_0xb352('0x132')]===utils[_0xb352('0x64')]['INACTIVE']){_0x27b165[_0xb352('0x134')]=0x0;_0x27b165['paused']=0x0;_0x27b165['inUse']=0x0;_0x27b165[_0xb352('0x135')]=0x0;_0x27b165[_0xb352('0x136')]=0x0;}}else if(_0x515f53[_0xb352('0x132')]===utils[_0xb352('0x64')][_0xb352('0x137')]&&!_0x3a0500){return _0xa2d02a[_0xb352('0x8b')](_0x515f53,!![])[_0xb352('0x39')](function(){return _0xa2d02a[_0xb352('0x8b')](_0x515f53,![]);})[_0xb352('0x39')](function(){return _0xa2d02a['checkDialMethod'](_0x515f53);})['catch'](function(_0x2cea29){loggerSyncQueueSummary[_0xb352('0x5b')](_0xb352('0x138'),util[_0xb352('0x3e')](_0x2cea29,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x515f53);});}else{clearPredictiveAttributes(_0x515f53);}})[_0xb352('0x39')](function(){var _0x4490d5=_0x27b165[_0xb352('0x139')](_0x515f53);if(_0x4490d5||_0x515f53[_0xb352('0x13a')]){_0x515f53[_0xb352('0x13a')]=![];_0x27b165[_0xb352('0x13b')](_0x515f53);Object['assign'](_0x515f53,_0x27b165);emitOutboundVoiceQueueSummary(_0x27b165);}_0xa2d02a[_0xb352('0x27')][_0x515f53[_0xb352('0x41')]][_0xb352('0x131')]=![];})[_0xb352('0x99')](function(_0x1eebde){logger[_0xb352('0x5f')](_0xb352('0x138'),util['inspect'](_0x1eebde,{'showHidden':![],'depth':null}));_0xa2d02a[_0xb352('0x27')][_0x515f53[_0xb352('0x41')]][_0xb352('0x131')]=![];});};Dialer['prototype'][_0xb352('0x13c')]=_[_0xb352('0x13d')](function(){var _0x4c2382=_['filter'](this['voiceQueues'],function(_0x1e82ea){return _0x1e82ea[_0xb352('0x13e')];});var _0x44b36b=_[_0xb352('0x13f')](this[_0xb352('0x1b')],function(_0x361d6e){return _0x361d6e['online']&&_0x361d6e['status']===_0xb352('0x140');});if(_0x4c2382[_0xb352('0x92')]>0x0&&_0x44b36b['length']>0x0){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0xb352('0x141')](_0x4c2382,'id'),previewRecallmeReminderInterval,_['map'](_0x44b36b,'id')))['then'](function(_0x5512b2){for(var _0x221ea4=0x0;_0x221ea4<_0x5512b2['length'];_0x221ea4++){var _0x14c5df=_0x5512b2[_0x221ea4]['Agent'][_0xb352('0x41')];if(_0x14c5df)io['to'](util['format'](_0xb352('0x142'),_0x14c5df))['emit'](_0xb352('0x143'),{'hopper':_0x5512b2[_0x221ea4]});}})[_0xb352('0x99')](function(_0x3286ed){logger[_0xb352('0x5f')](_0xb352('0x144'),_0x3286ed);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb352('0x14')]['loopClearZombieChannels']=function(){var _0x3522a9=this;setInterval(function(){_0x3522a9['clearZombieChannels'](_0x3522a9[_0xb352('0x20')],_0xb352('0x145'));_0x3522a9['clearZombieChannels'](_0x3522a9['actions'],_0xb352('0x146'));},0x32c8);};Dialer[_0xb352('0x14')][_0xb352('0x147')]=function(_0x4444bc,_0x1cb30d){var _0x264888=this;for(var _0x1af103 in _0x4444bc){if(typeof _0x4444bc[_0x1af103]!==_0xb352('0xa4')){this[_0xb352('0x148')]['enqueue'](function(){if(!_[_0xb352('0xef')](_0x4444bc[_0x1af103])){return ami['Action']({'action':'status','channel':_0x4444bc[_0x1af103][_0xb352('0xea')]})['catch'](function(_0x41fe6d){if(_0x41fe6d[_0xb352('0x63')]===_0xb352('0x149')){setTimeout(function(){if(_0x4444bc[_0x1af103]&&_0x4444bc[_0x1af103][_0xb352('0x3b')]!==_0xb352('0xbd')){_0x264888[_0xb352('0xc6')](_0x264888[_0xb352('0x19')][_0x4444bc[_0x1af103][_0xb352('0xb9')]]);logger[_0xb352('0x5f')]('[Dialer][checkChannel]',_0x1cb30d,_0x1af103,_0x4444bc[_0x1af103][_0xb352('0xb9')]);delete _0x4444bc[_0x1af103];}if(_0x4444bc[_0x1af103]&&_0x4444bc[_0x1af103]['type']===_0xb352('0xbd')){_0x264888['updateOriginated'](_0x264888[_0xb352('0x1a')][_0x4444bc[_0x1af103][_0xb352('0xb9')]]);logger[_0xb352('0x5f')](_0xb352('0x14a'),_0x1cb30d,_0x1af103,_0x4444bc[_0x1af103]['queue']);delete _0x4444bc[_0x1af103];}},0x2328);}});}});}}};Dialer[_0xb352('0x14')][_0xb352('0x14b')]=function(_0x40d128){return Promise['resolve']()[_0xb352('0x39')](voiceQueueRt[_0xb352('0x14b')](_0x40d128))[_0xb352('0x99')](loggerCatch(_0xb352('0x14c')));};Dialer[_0xb352('0x14')]['updateOriginated']=function(_0x4b036a){if(!_['isUndefined'](_0x4b036a)&&_0x4b036a!==null){if(typeof _0x4b036a[_0xb352('0x78')]!==_0xb352('0xa4')){if(_0x4b036a[_0xb352('0x78')]>0x0){_0x4b036a['originated']-=0x1;}else{logger[_0xb352('0x5f')](_0xb352('0x14d'));}}}else{logger['error'](_0xb352('0x14e'));}};Dialer[_0xb352('0x14')]['loggerHandler']=function(_0x5d51cd,_0xe340e){var _0x12af5f=this;return function(_0x1d8a61){_0x12af5f[_0xb352('0xc6')](_0xe340e);logger[_0xb352('0x5f')](_0x5d51cd,util['inspect'](_0x1d8a61,{'showHidden':![],'depth':null}));};};Dialer[_0xb352('0x14')]['emptyContact']=function(_0x59e6b1,_0xec3e12,_0x2a1dd7){var _0xb27899={'state':0x19,'statedesc':_0xb352('0x14f')};this[_0xb352('0xc6')](_0xec3e12);this['saveInDb'](_[_0xb352('0x58')](_0xb27899,_[_0xb352('0x6e')](_0x2a1dd7,[_0xb352('0xda'),_0xb352('0xdb'),_0xb352('0x150'),_0xb352('0xdc'),_0xb352('0xe5')])),_0xb352('0x151'),'[emptyContact]');logger[_0xb352('0x5f')](_0x59e6b1);};Dialer['prototype'][_0xb352('0x114')]=function(_0x39c81b,_0x369184,_0x4fbea7){hopperUtils[_0xb352('0xc2')](_0x39c81b)[_0xb352('0x99')](loggerCatch(_0x369184));hopperUtils[_0xb352('0xc4')](_0x39c81b)[_0xb352('0x99')](loggerCatch(_0x4fbea7));};Dialer[_0xb352('0x14')][_0xb352('0xd5')]=function(_0x2ddeb9,_0x456c93){hopperUtils['createHistory'](_0x2ddeb9)[_0xb352('0x99')](loggerCatch(_0xb352('0xc3')));if(_0x456c93==0x0){hopperUtils[_0xb352('0xc4')](_0x2ddeb9)[_0xb352('0x99')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xb352('0x14')][_0xb352('0x144')]=function(_0x401284){return Promise['resolve']()[_0xb352('0x39')](cmHopper['handlePreviewRecallNotifications'](_0x401284['id'],previewRecallmeReminderInterval))[_0xb352('0x39')](function(_0x239a11){for(var _0x36282c=0x0;_0x36282c<_0x239a11[_0xb352('0x92')];_0x36282c++){var _0x21322c=_0x239a11[_0x36282c]['Agent'][_0xb352('0x41')];if(_0x21322c)io['to'](util[_0xb352('0x3f')](_0xb352('0x142'),_0x21322c))[_0xb352('0x3a')]('user:dialPreviewRecallReminder',{'hopper':_0x239a11[_0x36282c]});}})[_0xb352('0x99')](function(){});};Dialer[_0xb352('0x14')]['launchHandleIvr']=function(_0xff51de){var _0x5ae43e=this;return function(){_0x5ae43e[_0xb352('0x152')](_0xff51de);};};Dialer[_0xb352('0x14')][_0xb352('0x153')]=function(_0xbbeb5c,_0x4d2ae1){var _0x2d4b47=this;var _0x30d7d1=uuid['v4']();this[_0xb352('0xe9')][_0x30d7d1]=new Action(_0xbbeb5c,_0x4d2ae1,_0x30d7d1);return new Promise(function(_0x3fe841,_0x4171af){if(_['isUndefined'](_0xbbeb5c)&&typeof _0xbbeb5c!==_0xb352('0x154')){return _0x4171af(msgResponse(_0xb352('0x155'),'Failure',_0xb352('0x156')));}if(_['isUndefined'](_0x4d2ae1[_0xb352('0x157')])||_0x4d2ae1[_0xb352('0x157')]===null){return _0x4171af(msgResponse('originate',_0xb352('0x8c'),_0xb352('0x158')));}var _0x2051c5={'XMD-CALLERID':_0x2d4b47[_0xb352('0xe9')][_0x30d7d1][_0xb352('0x159')](),'XMD-AGI':_0xbbeb5c[_0xb352('0x12d')]?util[_0xb352('0x3f')](_0xb352('0x15a'),ipAgi,_0xbbeb5c[_0xb352('0x12d')]):'NONE','XMD-AGIAFTER':_0xbbeb5c[_0xb352('0x15b')]?util['format'](_0xb352('0x15a'),ipAgi,_0xbbeb5c[_0xb352('0x15b')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0xbbeb5c)?util[_0xb352('0x3f')](_0xb352('0x15c'),_0xbbeb5c['name'],_0xbbeb5c[_0xb352('0x15d')]||'',_0xbbeb5c['dialAgiAfterHangupAgent']?'c':'',_0xbbeb5c[_0xb352('0xc8')]||0x3):'NONE','XMD-CONTACTID':_0x4d2ae1['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2d4b47['actions'][_0x30d7d1]['getCaller'](),'XMD-AMD':_0xbbeb5c[_0xb352('0x10b')]?'ACTIVE':_0xb352('0x15e'),'XMD-DESTINATION':_0xb352('0x10a')};if(_0xbbeb5c[_0xb352('0x10b')]){_0x2051c5[_0xb352('0x15f')]=_0xbbeb5c[_0xb352('0x160')]||0x9c4;_0x2051c5[_0xb352('0x161')]=_0xbbeb5c['dialAMDGreeting']||0x5dc;_0x2051c5['XMD-AMDAFTERGREETINGSILENCE']=_0xbbeb5c[_0xb352('0x162')]||0x320;_0x2051c5[_0xb352('0x163')]=_0xbbeb5c[_0xb352('0x164')]||0x1388;_0x2051c5[_0xb352('0x165')]=_0xbbeb5c[_0xb352('0x166')]||0x64;_0x2051c5['XMD-AMDBETWEENWORDSSILENCE']=_0xbbeb5c[_0xb352('0x167')]||0x32;_0x2051c5[_0xb352('0x168')]=_0xbbeb5c['dialAMDMaximumNumberOfWords']||0x3;_0x2051c5[_0xb352('0x169')]=_0xbbeb5c['dialAMDSilenceThreshold']||0x100;_0x2051c5[_0xb352('0x16a')]=_0xbbeb5c[_0xb352('0x16b')]||0x1388;}if(utils['isOutboundQueue'](_0xbbeb5c)){_0x2051c5[_0xb352('0x16c')]=_0x4d2ae1['VoiceQueueId'];}else{_0x2051c5['XMD-CAMPAIGNID']=_0x4d2ae1[_0xb352('0xe5')];}for(var _0x31ea86 in _0x4d2ae1[_0xb352('0x16d')]){if(typeof _0x4d2ae1[_0xb352('0x16d')][_0x31ea86]!==_0xb352('0xa4')){if(isNotNull(_0x4d2ae1[_0xb352('0x16d')][_0x31ea86])&&_0x31ea86!=='id'&&_0x31ea86!==_0xb352('0x16e')&&_0x31ea86!=='createdAt'&&_0x31ea86!==_0xb352('0x16f')){_0x2051c5[util[_0xb352('0x3f')](_0xb352('0x170'),_0xb352('0x171'),_['toUpper'](_0x31ea86))]=_0x4d2ae1['Contact'][_0x31ea86];}}}var _0x392193=_0x2d4b47[_0xb352('0x7f')](_0xbbeb5c['Trunk'])?utils['getCallerId'](_0xbbeb5c[_0xb352('0x84')]['callerid'],_0xbbeb5c[_0xb352('0x172')],_0xbbeb5c[_0xb352('0x173')]>0x0?utils[_0xb352('0x174')](_0xbbeb5c[_0xb352('0x175')],_0xbbeb5c[_0xb352('0x173')]):_0xbbeb5c[_0xb352('0x175')]):utils[_0xb352('0x176')](_[_0xb352('0xef')](_0xbbeb5c[_0xb352('0x85')])?_0xbbeb5c[_0xb352('0x84')][_0xb352('0x177')]:_0xbbeb5c[_0xb352('0x85')][_0xb352('0x177')],_0xbbeb5c[_0xb352('0x172')],_0xbbeb5c[_0xb352('0x173')]>0x0?utils[_0xb352('0x174')](_0xbbeb5c[_0xb352('0x175')],_0xbbeb5c[_0xb352('0x173')]):_0xbbeb5c['dialOriginateCallerIdNumber']);if(_0x392193){_0x2051c5['XMD-ORIGINATECALLERIDNAME']=_0x2d4b47[_0xb352('0xe9')][_0x30d7d1][_0xb352('0x178')]=utils[_0xb352('0x179')](_0x392193);_0x2051c5[_0xb352('0x17a')]=_0x4d2ae1[_0xb352('0x157')];}_0xbbeb5c[_0xb352('0x17b')]=_0x2051c5;return ami[_0xb352('0x9a')]({'actionid':_0x30d7d1,'action':'originate','channel':_0x2d4b47[_0xb352('0x7f')](_0xbbeb5c[_0xb352('0x84')])?util[_0xb352('0x3f')](_0xb352('0x17c'),_0xbbeb5c[_0xb352('0x84')][_0xb352('0x41')],isNotNull(_0xbbeb5c[_0xb352('0x17d')])?_0xbbeb5c[_0xb352('0x17d')][_0xb352('0x17e')]()||'':'',_0xbbeb5c[_0xb352('0x17f')]>0x0?_0x4d2ae1['phone'][_0xb352('0x180')](_0xbbeb5c[_0xb352('0x17f')]):_0x4d2ae1['phone']):util['format'](_0xb352('0x17c'),_['isNil'](_0xbbeb5c['TrunkBackup'])?_0xbbeb5c[_0xb352('0x84')]['name']:_0xbbeb5c['TrunkBackup'][_0xb352('0x41')],isNotNull(_0xbbeb5c['dialPrefix'])?_0xbbeb5c[_0xb352('0x17d')][_0xb352('0x17e')]()||'':'',_0xbbeb5c['dialCutDigit']>0x0?_0x4d2ae1[_0xb352('0x157')]['substring'](_0xbbeb5c[_0xb352('0x17f')]):_0x4d2ae1[_0xb352('0x157')]),'callerid':_0x392193,'Exten':_0xb352('0x10a'),'Context':_0xb352('0x181'),'Priority':'1','variable':_0x2051c5,'timeout':(_0xbbeb5c[_0xb352('0x182')]||0x1e)*0x3e8,'async':!![],'channelid':_0x30d7d1})[_0xb352('0x39')](function(_0x51d2a6){return _0x3fe841(_0x51d2a6);})[_0xb352('0x99')](function(_0x157146){_0xbbeb5c[_0xb352('0x183')]+=0x1;var _0x80950e=new History(_0x2d4b47[_0xb352('0xe9')][_0x30d7d1]);logger['error'](util[_0xb352('0x3f')](_0xb352('0x184'),JSON['stringify'](_0x157146)));_0x80950e[_0xb352('0x66')]=0xe;_0x80950e['statedesc']='OriginateError';_0x80950e['starttime']=moment()[_0xb352('0x3f')](_0xb352('0xbc'));_0x80950e[_0xb352('0x68')]=_0x80950e['starttime'];hopperUtils[_0xb352('0xc2')](_0x80950e)['catch'](loggerCatch(_0xb352('0x185')));_0x2d4b47[_0xb352('0xc4')](_0x80950e)['catch'](loggerCatch(_0xb352('0x185')))['finally'](function(){delete _0x2d4b47[_0xb352('0xe9')][_0x30d7d1];return _0x4171af(msgResponse(_0xb352('0x155'),_0xb352('0x7e'),_0xb352('0x186')));});});});};Dialer[_0xb352('0x14')][_0xb352('0x187')]=function(_0x1fd15a,_0x19637e,_0x276e19){var _0x588eae=new History(_0x19637e);if(_0x588eae['countbusyretry']+_0x588eae[_0xb352('0x11c')]+_0x588eae[_0xb352('0x11d')]+_0x588eae[_0xb352('0x188')]+_0x588eae[_0xb352('0xce')]+_0x588eae[_0xb352('0xe4')]+_0x588eae['countmachineretry']+_0x588eae[_0xb352('0x189')]>=_0x276e19['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1fd15a){case 0x3:if(_0x588eae[_0xb352('0x11d')]>=_0x276e19[_0xb352('0x18a')]-0x1){return!![];}hopperUtils[_0xb352('0xd7')]({'active':![],'countnoanswerretry':_0x588eae[_0xb352('0x11d')]+=0x1,'scheduledat':moment()[_0xb352('0xd8')](_0x276e19[_0xb352('0x18b')],'minutes')[_0xb352('0x3f')](_0xb352('0xbc')),'ContactId':_0x588eae['ContactId'],'ListId':_0x588eae['ListId'],'VoiceQueueId':_0x588eae['VoiceQueueId']||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x18c')));break;case 0x5:if(_0x588eae[_0xb352('0x11b')]>=_0x276e19['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xb352('0xd7')]({'active':![],'countbusyretry':_0x588eae[_0xb352('0x11b')]+=0x1,'scheduledat':moment()[_0xb352('0xd8')](_0x276e19['dialBusyRetryFrequency'],_0xb352('0xd9'))['format'](_0xb352('0xbc')),'ContactId':_0x588eae['ContactId'],'ListId':_0x588eae[_0xb352('0xdb')],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x18d')));break;case 0x8:if(_0x588eae[_0xb352('0x11c')]>=_0x276e19[_0xb352('0x18e')]-0x1){return!![];}hopperUtils[_0xb352('0xd7')]({'active':![],'countcongestionretry':_0x588eae[_0xb352('0x11c')]+=0x1,'scheduledat':moment()[_0xb352('0xd8')](_0x276e19['dialCongestionRetryFrequency'],_0xb352('0xd9'))['format'](_0xb352('0xbc')),'ContactId':_0x588eae['ContactId'],'ListId':_0x588eae[_0xb352('0xdb')],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x588eae['countnosuchnumberretry']>=_0x276e19[_0xb352('0x18f')]-0x1){return!![];}else{hopperUtils[_0xb352('0xd7')]({'active':![],'countnosuchnumberretry':_0x588eae[_0xb352('0x188')]+=0x1,'scheduledat':moment()['add'](_0x276e19[_0xb352('0x190')],_0xb352('0xd9'))[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588eae[_0xb352('0xda')],'ListId':_0x588eae[_0xb352('0xdb')],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})['catch'](loggerCatch(_0xb352('0x191')));}break;case 0xa:if(_0x588eae[_0xb352('0xce')]>=_0x276e19[_0xb352('0xd4')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x588eae[_0xb352('0xce')]+=0x1,'scheduledat':moment()['add'](_0x276e19[_0xb352('0xd0')],_0xb352('0xd9'))[_0xb352('0x3f')](_0xb352('0xbc')),'ContactId':_0x588eae[_0xb352('0xda')],'ListId':_0x588eae['ListId'],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x588eae[_0xb352('0xe4')]>=_0x276e19[_0xb352('0xe3')]-0x1){return!![];}hopperUtils[_0xb352('0xd7')]({'active':![],'countabandonedretry':_0x588eae['countabandonedretry']+=0x1,'scheduledat':moment()[_0xb352('0xd8')](_0x276e19[_0xb352('0xe2')],_0xb352('0xd9'))[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588eae[_0xb352('0xda')],'ListId':_0x588eae[_0xb352('0xdb')],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae['CampaignId']||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x192')));break;case 0x13:if(_0x588eae[_0xb352('0x119')]>=_0x276e19[_0xb352('0x121')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x588eae['countmachineretry']+=0x1,'scheduledat':moment()[_0xb352('0xd8')](_0x276e19[_0xb352('0x124')],'minutes')[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588eae[_0xb352('0xda')],'ListId':_0x588eae['ListId'],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x127')));break;case 0x14:if(_0x588eae[_0xb352('0x189')]>=_0x276e19['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xb352('0xd7')]({'active':![],'countagentrejectretry':_0x588eae[_0xb352('0x189')]+=0x1,'scheduledat':moment()[_0xb352('0xd8')](_0x276e19[_0xb352('0x193')],_0xb352('0xd9'))[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588eae['ContactId'],'ListId':_0x588eae[_0xb352('0xdb')],'VoiceQueueId':_0x588eae[_0xb352('0xdc')]||undefined,'CampaignId':_0x588eae[_0xb352('0xe5')]||undefined})[_0xb352('0x99')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xb352('0x194')]=function(_0x2f760d,_0x51420d,_0x1f58e4){var _0x157474=this;var _0x3e8ef3=new History(_0x2f760d);var _0x58d883=![];var _0x244b66;var _0x21b68c;return new Promise(function(_0x5b542e,_0x3494f3){if(_[_0xb352('0x4d')](_0x51420d)&&typeof _0x51420d!==_0xb352('0x154')){return _0x3494f3(msgResponse(_0xb352('0x195'),'Failure','entity\x20is\x20undefine'));}if(_[_0xb352('0x4d')](_0x1f58e4)&&typeof _0x1f58e4!==_0xb352('0x154')){return _0x3494f3(msgResponse(_0xb352('0x195'),_0xb352('0x8c'),_0xb352('0x196')));}hopperUtils[_0xb352('0xd2')](_0x3e8ef3,_0x1f58e4['reason'],_0x51420d)[_0xb352('0x39')](function(_0x48ff71){if(_0x48ff71[_0xb352('0xd6')]==0x1)_0x58d883=!![];switch(_0x1f58e4[_0xb352('0xbf')]){case'0':_0x51420d[_0xb352('0x197')]+=0x1;_0x3e8ef3[_0xb352('0x66')]=0x0;_0x3e8ef3[_0xb352('0x67')]=_0xb352('0x198');_0x3e8ef3['countnosuchnumberretry']+=0x1;_0x3e8ef3[_0xb352('0xcf')]+=0x1;ami[_0xb352('0x3a')](_0xb352('0x199'),ut['buildObj'](_0x2f760d,_0xb352('0x19a')));_0x244b66=_0x51420d['dialNoSuchNumberRetryFrequency'];_0x21b68c=_0x51420d[_0xb352('0xd1')];hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch(_0xb352('0x11a')));if(_0x157474[_0xb352('0x187')](0x0,_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3['countnosuchnumberretry']>=_0x51420d['dialNoSuchNumberMaxRetry']){_0x157474['createStateFinal'](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x19b'));}else{_0x157474[_0xb352('0x11f')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x19b'));}}break;case'3':_0x51420d[_0xb352('0x19c')]+=0x1;_0x3e8ef3[_0xb352('0x66')]=0x3;_0x3e8ef3[_0xb352('0x67')]=_0xb352('0x19d');_0x3e8ef3[_0xb352('0x11d')]+=0x1;_0x3e8ef3[_0xb352('0xcf')]+=0x1;var _0x524100=ut[_0xb352('0x19e')](_0x2f760d,_0x51420d);ami[_0xb352('0x3a')](_0xb352('0x19f'),_0x524100);_0x244b66=_0x51420d[_0xb352('0x18b')];_0x21b68c=_0x51420d[_0xb352('0xd1')];hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x157474['checkRetriveMax'](0x3,_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3[_0xb352('0x11d')]>=_0x51420d[_0xb352('0x18a')]){_0x157474[_0xb352('0x122')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1a0'));}else{_0x157474['stateGlobal'](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1a0'));}}break;case'5':_0x51420d[_0xb352('0x1a1')]+=0x1;_0x3e8ef3[_0xb352('0x66')]=0x5;_0x3e8ef3[_0xb352('0x67')]=_0xb352('0x1a2');_0x3e8ef3[_0xb352('0x11b')]+=0x1;_0x3e8ef3[_0xb352('0xcf')]+=0x1;ami[_0xb352('0x3a')](_0xb352('0x1a3'),ut[_0xb352('0x112')](_0x2f760d,_0xb352('0x1a4')));_0x244b66=_0x51420d[_0xb352('0x1a5')];_0x21b68c=_0x51420d[_0xb352('0xd1')];hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch(_0xb352('0x1a6')));if(_0x157474[_0xb352('0x187')](0x5,_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3[_0xb352('0x11b')]>=_0x51420d[_0xb352('0x1a7')]){_0x157474[_0xb352('0x122')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1a8'));}else{_0x157474[_0xb352('0x11f')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1a8'));}}break;case'8':_0x51420d[_0xb352('0x1a9')]+=0x1;_0x3e8ef3[_0xb352('0x66')]=0x8;_0x3e8ef3[_0xb352('0x67')]='Congestion';_0x3e8ef3['countcongestionretry']+=0x1;_0x3e8ef3[_0xb352('0xcf')]+=0x1;_0x244b66=_0x51420d[_0xb352('0x1aa')];_0x21b68c=_0x51420d[_0xb352('0xd1')];ami['emit']('custom:agentcongestion',ut[_0xb352('0x112')](_0x2f760d,_0xb352('0x1ab')));hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch(_0xb352('0x1ac')));if(_0x157474['checkRetriveMax'](0x8,_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3[_0xb352('0x11c')]>=_0x51420d[_0xb352('0x18e')]){_0x157474['createStateFinal'](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1ad'));}else{_0x157474['stateGlobal'](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1ad'));}}break;case'11':_0x51420d[_0xb352('0x1ae')]+=0x1;_0x3e8ef3['state']=0xb;_0x3e8ef3[_0xb352('0x67')]=_0xb352('0xe6');_0x3e8ef3[_0xb352('0xe4')]+=0x1;_0x3e8ef3['countglobal']+=0x1;_0x244b66=_0x51420d[_0xb352('0xe2')];_0x21b68c=_0x51420d[_0xb352('0xd1')];hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x157474['checkRetriveMax'](0xb,_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3[_0xb352('0xe4')]>=_0x51420d[_0xb352('0xe3')]){_0x157474[_0xb352('0x122')](_0x3e8ef3,_0x5b542e,_0x3494f3,'reason\x2011\x20abandoned');}else{_0x157474[_0xb352('0x11f')](_0x3e8ef3,_0x5b542e,_0x3494f3,'reason\x2011\x20abandoned');}}break;case'20':_0x51420d['outboundRejectCallsDay']+=0x1;_0x3e8ef3[_0xb352('0x66')]=0x14;_0x3e8ef3['statedesc']='AgentReject';_0x3e8ef3[_0xb352('0x189')]+=0x1;_0x3e8ef3[_0xb352('0xcf')]+=0x1;_0x244b66=_0x51420d[_0xb352('0x193')];_0x21b68c=_0x51420d[_0xb352('0xd1')];ami[_0xb352('0x3a')](_0xb352('0x1af'),ut[_0xb352('0x112')](_0x2f760d,'agentreject'));hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch(_0xb352('0x1b0')));if(_0x157474[_0xb352('0x187')](0x14,_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3[_0xb352('0x189')]>=_0x51420d[_0xb352('0x1b1')]){_0x157474['createStateFinal'](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1b2'));}else{_0x157474[_0xb352('0x11f')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0xb352('0x1b2'));}}break;default:_0x51420d[_0xb352('0x12e')]+=0x1;_0x3e8ef3['state']=0xc;_0x3e8ef3['statedesc']=_0x1f58e4[_0xb352('0xbf')];_0x244b66=_0x51420d['dialAgentRejectRetryFrequency'];_0x21b68c=_0x51420d[_0xb352('0xd1')];hopperUtils[_0xb352('0xc2')](_0x3e8ef3)[_0xb352('0x99')](loggerCatch(_0xb352('0x1b3')));if(_0x157474[_0xb352('0x187')](_0x1f58e4[_0xb352('0xbf')],_0x2f760d,_0x51420d)&&!_0x58d883){if(_0x3e8ef3[_0xb352('0x11b')]+_0x3e8ef3[_0xb352('0x11c')]+_0x3e8ef3[_0xb352('0x11d')]+_0x3e8ef3[_0xb352('0x188')]+_0x3e8ef3['countdropretry']+_0x3e8ef3['countabandonedretry']+_0x3e8ef3['countmachineretry']+_0x3e8ef3[_0xb352('0x189')]>=_0x51420d[_0xb352('0x11e')]){_0x157474[_0xb352('0x11f')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0x1f58e4[_0xb352('0xbf')]);}else{_0x157474[_0xb352('0x122')](_0x3e8ef3,_0x5b542e,_0x3494f3,_0x1f58e4[_0xb352('0xbf')]);}}}})[_0xb352('0x39')](function(){if(_0x58d883){hopperUtils[_0xb352('0xe0')](_0x3e8ef3,_0x244b66,_0x21b68c)[_0xb352('0x39')](function(){return _0x5b542e(0x1);});}});});};Dialer[_0xb352('0x14')][_0xb352('0x11f')]=function(_0x3f0d0e,_0x22d982,_0x282537,_0x19d350){var _0x54ef36=new Final(_0x3f0d0e);_0x54ef36[_0xb352('0x66')]=0xf;_0x54ef36[_0xb352('0x67')]=_0xb352('0x1b4');this[_0xb352('0x122')](_0x54ef36,_0x22d982,_0x282537,_0x19d350);};Dialer[_0xb352('0x14')][_0xb352('0x122')]=function(_0x4a8639,_0x38d57f,_0x836a2f,_0x5ed810){hopperUtils[_0xb352('0xc4')](_0x4a8639)[_0xb352('0x39')](function(){return _0x38d57f(msgResponse(_0xb352('0x195'),'Success',_0x5ed810));})[_0xb352('0x99')](function(){return _0x836a2f(msgResponse(_0xb352('0x1b5'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0xb352('0x8')]=function(_0x59a798){var _0x200127=_0x59a798[_0xb352('0x1b6')]/0x64;var _0x3a9491=_0x59a798[_0xb352('0xc9')]/(_0x59a798['outboundDropCallsDayTimeout']+_0x59a798[_0xb352('0xbe')]);var _0x5b6e01=Math[_0xb352('0x1b7')](_0x59a798[_0xb352('0x1b8')]*(_0x59a798[_0xb352('0x1b9')]/0x64));var _0x201e12=Math[_0xb352('0x1b7')](_0x59a798[_0xb352('0x1b8')]*(_0x59a798['predictiveIntervalMinThreshold']/0x64));var _0x1b3879=_0x59a798[_0xb352('0x134')]+_0x59a798['talking'];var _0x11012=Math['floor'](_0x59a798[_0xb352('0x53')]*_0x59a798['erlangAbandonmentRate']*_0x59a798['predictiveIntervalHitRate']*_0x59a798[_0xb352('0x1ba')]);if(_['isUndefined'](_0x59a798[_0xb352('0x23')])){if(!_[_0xb352('0x4d')](_0x59a798[_0xb352('0x22')])){_0x59a798[_0xb352('0x22')]=undefined;loggerPredictive[_0xb352('0x5f')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xb352('0x4d')](_0x59a798['handlePredictive'])){loggerPredictive[_0xb352('0x5f')](_0xb352('0x1bb'),_0xb352('0x1bc'));clearInterval(_0x59a798['handlePredictive']);_0x59a798['handlePredictive']=undefined;}_0x59a798[_0xb352('0x23')]=moment()['format'](_0xb352('0xbc'));loggerPredictive[_0xb352('0x43')](_0x59a798[_0xb352('0x41')],'collection\x20data\x20in\x20progressive\x20at',_0x59a798[_0xb352('0x23')]);this['handlePower'](_0x59a798,0x1);}else if(ifInterval(_0x59a798[_0xb352('0x1bd')],_0x59a798[_0xb352('0x23')])){this[_0xb352('0xab')](_0x59a798,0x1);loggerPredictiveCalls[_0xb352('0x43')](_0xb352('0x1be'),_0x59a798[_0xb352('0x23')],_0x59a798[_0xb352('0x41')]);_0x59a798[_0xb352('0x53')]=0x0;_0x59a798['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x200127<_0x3a9491&&_0x59a798[_0xb352('0x1bf')]==='dropRate'){clearPredictiveAttributes(_0x59a798);loggerPredictive[_0xb352('0x43')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x3a9491,_0xb352('0x23'),_0x59a798['name']);}else if(_0x11012<_0x59a798[_0xb352('0xca')]&&_0x59a798['dialPredictiveOptimization']===_0xb352('0x1c0')){clearPredictiveAttributes(_0x59a798);loggerPredictive[_0xb352('0x43')](_0xb352('0x1c1'),'Max\x20Drop\x20',_0x11012,_0xb352('0x1c2'),_0x59a798['predictiveIntervalErlangCallsDroppedCalls'],_0xb352('0x23'),_0x59a798[_0xb352('0x41')]);}else if(!ifInterval(_0x59a798[_0xb352('0x1bd')],_0x59a798[_0xb352('0x23')])&&_[_0xb352('0x4d')](_0x59a798[_0xb352('0x22')])&&!_[_0xb352('0x4d')](_0x59a798[_0xb352('0x23')])){_0x59a798['startPredictive']=moment()[_0xb352('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xb352('0x43')](_0x59a798[_0xb352('0x41')],_0xb352('0x1c3'),_0x59a798['startPredictive']);hopperUtils['avgHandleTime'](_0x59a798['dialPredictiveInterval'])[_0xb352('0x39')](this[_0xb352('0x1c4')](_0x59a798))[_0xb352('0x39')](mergeDataErlangB(_0x59a798))['then'](this[_0xb352('0x1c5')](_0x59a798))[_0xb352('0x99')](loggerCatchPredictive(_0xb352('0x1c6'),_0x59a798));}else if(!ifInterval(_0x59a798[_0xb352('0x1bd')],_0x59a798[_0xb352('0x22')])){_0x59a798['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x59a798[_0xb352('0x22')]=moment()[_0xb352('0x3f')](_0xb352('0xbc'));loggerPredictive[_0xb352('0x43')](_0x59a798[_0xb352('0x41')],_0xb352('0x1c7'),_0x59a798[_0xb352('0x22')]);clearInterval(_0x59a798[_0xb352('0x5d')]);_0x59a798[_0xb352('0x5d')]=undefined;hopperUtils[_0xb352('0x1c8')](_0x59a798[_0xb352('0x1bd')])[_0xb352('0x39')](this[_0xb352('0x1c4')](_0x59a798))[_0xb352('0x39')](mergeDataErlangB(_0x59a798))[_0xb352('0x39')](this[_0xb352('0x1c5')](_0x59a798))[_0xb352('0x99')](loggerCatchPredictive(_0xb352('0x1c9'),_0x59a798));}else if(_0x59a798[_0xb352('0x1b8')]&&_0x1b3879<_0x59a798[_0xb352('0x1b8')]-_0x201e12){clearPredictiveAttributes(_0x59a798);loggerPredictive['info'](_0x59a798['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1b3879,_0xb352('0x1ca'),_0x59a798[_0xb352('0x1b8')],'-',_0x201e12,'=',_0x59a798[_0xb352('0x1b8')]-_0x201e12,')');}else if(_0x59a798[_0xb352('0x1b8')]&&_0x1b3879>_0x59a798[_0xb352('0x1b8')]+_0x5b6e01){clearPredictiveAttributes(_0x59a798);loggerPredictive[_0xb352('0x43')](_0x59a798[_0xb352('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1b3879,')\x20are\x20more\x20than\x20threshold\x20(',_0x59a798[_0xb352('0x1b8')],'+',_0x5b6e01,'=',_0x59a798[_0xb352('0x1b8')]+_0x5b6e01,')');}};Dialer[_0xb352('0x14')]['getDataPredictive']=function(_0x384ffd){var _0xf4450f=this;return function(_0x56056f){return new Promise(function(_0x34ab73,_0x1739de){_[_0xb352('0x58')](_0x384ffd,_0x56056f[0x0]);if(checkGetDataPredictive(_0x56056f[0x0])){var _0x166ec2=_0x384ffd[_0xb352('0x1b8')]=_0x384ffd[_0xb352('0x135')]+_0x384ffd[_0xb352('0x134')];var _0x1b8308=_0x384ffd[_0xb352('0x1bd')]*0x3c;var _0x4da624=_0x56056f[0x0][_0xb352('0x4e')]+_0x56056f[0x0][_0xb352('0x4a')];var _0x3a6065=(_0x56056f[0x0]['predictiveIntervalAnsweredCalls']+_0x56056f[0x0][_0xb352('0x48')]+_0x56056f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x56056f[0x0][_0xb352('0x4c')];_0x384ffd[_0xb352('0x1cb')]=_0x3a6065>0x0?_0x3a6065:0x1;switch(_0x384ffd[_0xb352('0x1bf')]){case _0xb352('0x1c0'):var _0x2f6889=_0x384ffd['dialPredictiveOptimizationPercentage']/0x64;return _0xf4450f[_0xb352('0x1cc')](_0x166ec2,_0x1b8308,_0x4da624,_0x3a6065,_0x2f6889)['then'](function(_0x55939d){return _0x34ab73(_0x55939d);});case'agentBusyFactor':var _0x1e6955=_0x384ffd['dialPredictiveOptimizationPercentage']/0x64;return _0xf4450f[_0xb352('0x1cd')](_0x166ec2,_0x1b8308,_0x4da624,_0x3a6065,_0x1e6955)['then'](function(_0x2b06cd){return _0x34ab73(_0x2b06cd);});default:return _0x1739de(msgResponse(_0xb352('0x1ce'),_0xb352('0x8c'),_0xb352('0x1cf')));}}else{return _0x1739de(msgResponse(_0xb352('0x1ce'),'Failure',_0xb352('0x1d0')));}});};};Dialer[_0xb352('0x14')][_0xb352('0x1d1')]=function(_0x1bdc7a){var _0x47481e=this;return function(_0x3c0444){return new Promise(function(_0x32cb56,_0x57567e){_['merge'](_0x1bdc7a,_0x3c0444[0x0]);if(checkGetDataPredictive(_0x3c0444[0x0])){loggerPredictive[_0xb352('0x43')](JSON['stringify'](_0x3c0444[0x0]));if(_0x1bdc7a[_0xb352('0x1bf')]==='dropRate'){return _0x47481e[_0xb352('0x14b')](_0x1bdc7a['id'])[_0xb352('0x39')](function(_0x5a2c9c){var _0x235bbd=_0x1bdc7a[_0xb352('0x1d2')]-_0x5a2c9c[0x0][_0xb352('0x1d3')];var _0x1885f6=_0x1bdc7a['dialPredictiveInterval']*0x3c;var _0x1aaddb=_0x3c0444[0x0]['predictiveIntervalAvgTalktime']+_0x3c0444[0x0][_0xb352('0x4a')];var _0x5d14d5=(_0x3c0444[0x0][_0xb352('0x46')]+_0x3c0444[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3c0444[0x0][_0xb352('0x49')])/_0x3c0444[0x0][_0xb352('0x4c')];var _0x5e9427=_0x1bdc7a[_0xb352('0x1b6')]/0x64;_0x1bdc7a[_0xb352('0x1d4')]=_0x5a2c9c[0x0]['outboundQueuePauses']||0x0;_0x1bdc7a[_0xb352('0x1cb')]=_0x5d14d5>0x0?_0x5d14d5:0x1;return _0x47481e[_0xb352('0x1cc')](_0x235bbd,_0x1885f6,_0x1aaddb,_0x5d14d5,_0x5e9427);})[_0xb352('0x39')](function(_0x1a4a11){return _0x32cb56(_0x1a4a11);})[_0xb352('0x99')](function(_0x41666c){return _0x57567e(msgResponse(_0xb352('0x1d5'),_0xb352('0x8c'),JSON['stringify'](_0x41666c)));});}if(_0x1bdc7a[_0xb352('0x1bf')]===_0xb352('0x1d6')){return _0x47481e['getVoiceQueueRtPauses'](_0x1bdc7a['id'])['then'](function(_0x4eed39){var _0x95afcf=_0x1bdc7a[_0xb352('0x1d2')]-_0x4eed39[0x0][_0xb352('0x1d3')];var _0x1d8753=_0x1bdc7a['dialPredictiveInterval']*0x3c;var _0x21cf83=_0x3c0444[0x0]['predictiveIntervalAvgTalktime']+_0x3c0444[0x0][_0xb352('0x4a')];var _0x284919=(_0x3c0444[0x0][_0xb352('0x46')]+_0x3c0444[0x0][_0xb352('0x48')]+_0x3c0444[0x0][_0xb352('0x49')])/_0x3c0444[0x0][_0xb352('0x4c')];var _0x2da352=_0x1bdc7a['dialPredictiveOptimizationPercentage']/0x64;_0x1bdc7a[_0xb352('0x1d4')]=_0x4eed39[0x0][_0xb352('0x1d3')]||0x0;_0x1bdc7a[_0xb352('0x1cb')]=_0x284919>0x0?_0x284919:0x1;return _0x47481e[_0xb352('0x1cd')](_0x95afcf,_0x1d8753,_0x21cf83,_0x284919,_0x2da352);})[_0xb352('0x39')](function(_0x5f57ef){return _0x32cb56(_0x5f57ef);})[_0xb352('0x99')](function(_0x3ef52b){return _0x57567e(msgResponse('[CatchErlangB]',_0xb352('0x8c'),JSON[_0xb352('0x6d')](_0x3ef52b)));});}}else{return _0x57567e(msgResponse(_0xb352('0x1ce'),'Failure',_0xb352('0x1d0')));}});};};Dialer[_0xb352('0x14')][_0xb352('0x1c5')]=function(_0x112e5b){var _0x1e49b5=this;return function(){var _0x2cca82=0x0;var _0x2aa0b8=Math[_0xb352('0x1d7')](_0x112e5b[_0xb352('0x1d8')]*0x3e8);if(_0x2aa0b8>0x0){_0x2aa0b8=_0x2aa0b8<0x64?0x64:_0x2aa0b8;loggerPredictive[_0xb352('0x43')](_0x112e5b[_0xb352('0x41')],_0xb352('0x1d9'),_0x2aa0b8,_0xb352('0x1da'));_0x112e5b[_0xb352('0x5d')]=setInterval(function(){_0x1e49b5[_0xb352('0x5d')](_0x112e5b);loggerPredictiveCalls[_0xb352('0x43')](_0xb352('0x1db'),_0x2cca82+=0x1);},_0x2aa0b8);}else{loggerPredictive[_0xb352('0x43')](_0x112e5b['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0xb352('0x1dc')]=function(_0x33aaaa,_0x305ab6){var _0x509fd4=this;return function(_0x14e62c){if(_['isEmpty'](_0x14e62c)){if(_[_0xb352('0xef')](_0x305ab6[_0xb352('0x150')])||!_0x305ab6[_0xb352('0x1dd')]){if(_0x33aaaa[_0xb352('0xa9')]===_0xb352('0xae')){_0x33aaaa[_0xb352('0x6b')]=_[_0xb352('0x4d')](_0x33aaaa['queueStatusComplete'])?!![]:_0x33aaaa[_0xb352('0x6b')];var _0x163b9e=uuid['v4']();_0x509fd4[_0xb352('0xe9')][_0x163b9e]=new Action(_0x33aaaa,_0x305ab6,_0x163b9e);loggerBooked['info']('[booked][checkContactBlack]',_0x163b9e,_0xb352('0x1de'),JSON['stringify'](_0x33aaaa['queueStatusComplete']),_0xb352('0x1df'),_0x33aaaa['name']);if(_0x33aaaa['queueStatusComplete']){_0x33aaaa[_0xb352('0x6b')]=![];_0x509fd4[_0xb352('0x25')][_0x509fd4['actions'][_0x163b9e][_0xb352('0xb9')]]=[];ami['Action']({'actionid':_0x163b9e,'action':_0xb352('0x1e0'),'queue':_0x33aaaa['name']})['catch'](function(){_0x509fd4['updateOriginated'](_0x33aaaa);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x509fd4[_0xb352('0xe9')][_0x163b9e][_0xb352('0xda')],'ListId':_0x509fd4[_0xb352('0xe9')][_0x163b9e][_0xb352('0xdb')],'VoiceQueueId':_0x509fd4[_0xb352('0xe9')][_0x163b9e][_0xb352('0xdc')]||undefined,'CampaignId':_0x509fd4['actions'][_0x163b9e]['CampaignId']||undefined})[_0xb352('0x99')](loggerCatch(_0xb352('0x1e1')));delete _0x509fd4[_0xb352('0xe9')][_0x163b9e];});}else{loggerBooked['info'](_0xb352('0x1e2'),JSON[_0xb352('0x6d')](_0x33aaaa[_0xb352('0x6b')]),_0xb352('0x1df'),_0x33aaaa[_0xb352('0x41')]);_0x509fd4[_0xb352('0xc6')](_0x33aaaa);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x509fd4[_0xb352('0xe9')][_0x163b9e][_0xb352('0xda')],'ListId':_0x509fd4[_0xb352('0xe9')][_0x163b9e][_0xb352('0xdb')],'VoiceQueueId':_0x509fd4[_0xb352('0xe9')][_0x163b9e][_0xb352('0xdc')]||undefined,'CampaignId':_0x509fd4[_0xb352('0xe9')][_0x163b9e]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x509fd4['actions'][_0x163b9e];}}else{return _0x509fd4[_0xb352('0x153')](_0x33aaaa,_0x305ab6);}}else{if(utils['getSeconds'](undefined,_0x305ab6[_0xb352('0x1e3')])<_0x33aaaa[_0xb352('0x1e4')]*0x3c){if(_0x305ab6[_0xb352('0x1e5')]&&!_0x305ab6['Agent'][_0xb352('0x1e6')]){_0x509fd4['preview'][_0xb352('0xfb')](_0x305ab6['id'])[_0xb352('0x17')](function(){_0x509fd4[_0xb352('0xc6')](_0x33aaaa);});}else{hopperUtils[_0xb352('0x1e7')]({'active':![]},_0x305ab6['id'],0x1)[_0xb352('0x17')](function(){_0x509fd4[_0xb352('0xc6')](_0x33aaaa);});}}else{_0x33aaaa[_0xb352('0x1e8')]+=0x1;_0x509fd4[_0xb352('0xc6')](_0x33aaaa);if(_0x33aaaa['dialRecallInQueue']){hopperUtils[_0xb352('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x305ab6['ContactId'],'ListId':_0x305ab6['ListId'],'VoiceQueueId':_0x305ab6[_0xb352('0xdc')]||undefined,'CampaignId':_0x305ab6[_0xb352('0xe5')]||undefined})['catch'](loggerCatch(_0xb352('0x1e9')));hopperUtils[_0xb352('0xc2')](createObjHistory(_0x33aaaa,_0x305ab6,utils[_0xb352('0x64')][_0xb352('0x1ea')],0x17,_0xb352('0x1eb')))[_0xb352('0x99')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x509fd4[_0xb352('0x114')](createObjHistory(_0x33aaaa,_0x305ab6,utils[_0xb352('0x64')][_0xb352('0x1ec')],0x16,'RecallFailedTimeout'),_0xb352('0x1ed'),_0xb352('0x1ee'));}}}}else{_0x33aaaa['outboundBlacklistCallsDay']+=0x1;_0x509fd4[_0xb352('0x114')](createObjHistory(_0x33aaaa,_0x305ab6,utils[_0xb352('0x64')][_0xb352('0x1ef')],0xd,'Blacklist'),_0xb352('0x1f0'),'[Originate][MoveBlacklist]');throw _0xb352('0x1f1');}};};Dialer[_0xb352('0x14')][_0xb352('0x152')]=function(_0x40afe3){var _0x9f1bf5=this;var _0x454056=_0x40afe3['limitCalls']-_0x40afe3['originated']-_0x40afe3[_0xb352('0x1f2')];emitCampaignSummary(_0x40afe3);if(_0x454056>0x0){if(_0x454056>this[_0xb352('0x1d')]){_0x454056=this[_0xb352('0x1d')];}_0x40afe3[_0xb352('0x1f2')]+=_0x454056;hopperUtils['getContactDialerIvr'](_0x40afe3['id'],_0x454056,_0x40afe3['dialOrderByScheduledAt'],_0x40afe3)[_0xb352('0x39')](function(_0x1ed4c7){_0x40afe3[_0xb352('0x1f2')]-=_0x454056;_0x40afe3[_0xb352('0x1f2')]=_0x40afe3[_0xb352('0x1f2')]>0x0?_0x40afe3[_0xb352('0x1f2')]:0x0;if(!utils[_0xb352('0x1f3')](_0x1ed4c7)){_0x40afe3['message']=utils[_0xb352('0x64')][_0xb352('0x65')];logger[_0xb352('0x43')]('[getContactCampaign2][Empty]'+_0x40afe3[_0xb352('0x41')]);}else{_0x40afe3[_0xb352('0x78')]+=_0x1ed4c7['length'];_0x40afe3[_0xb352('0x63')]=utils[_0xb352('0x64')][_0xb352('0x1f4')];for(var _0x3406e2=0x0;_0x3406e2<_0x1ed4c7['length'];_0x3406e2+=0x1){_0x40afe3[_0xb352('0x1f5')]+=0x1;if(_[_0xb352('0xef')](_0x1ed4c7[_0x3406e2])||_[_0xb352('0xef')](_0x1ed4c7[_0x3406e2][_0xb352('0x16d')])||_['isNil'](_0x1ed4c7[_0x3406e2][_0xb352('0x157')])){_0x9f1bf5[_0xb352('0x1f6')](_0xb352('0x1f7'),_0x40afe3,_0x1ed4c7[_0x3406e2]);}else{hopperUtils[_0xb352('0x1f8')](_['pick'](_0x1ed4c7[_0x3406e2],[_0xb352('0xe5'),'phone']))['then'](_0x9f1bf5['checkContactBlack'](_0x40afe3,_0x1ed4c7[_0x3406e2]))[_0xb352('0x99')](_0x9f1bf5[_0xb352('0x1f9')]('[actionOriginateIvr]\x20',_0x40afe3));}}}})[_0xb352('0x99')](loggerGetContactDialer(_0xb352('0x1fa'),_0x40afe3,_0x454056));}};Dialer['prototype']['handlePower']=function(_0x3dff4a,_0x7f809a){var _0x5d1a9b=this;var _0x53dc81=[];if(_0x7f809a<0x1||_0x3dff4a[_0xb352('0xa9')]===_0xb352('0xae')){_0x7f809a=0x1;}var _0x1cc7c3=Math[_0xb352('0x1d7')](_0x3dff4a[_0xb352('0x134')]*_0x7f809a)-_0x3dff4a[_0xb352('0x78')]-_0x3dff4a[_0xb352('0x1f2')];if(_0x3dff4a['dialLimitQueue']>0x0){var _0x5de324=_0x3dff4a[_0xb352('0x1fb')]-_0x3dff4a[_0xb352('0x78')]-_0x3dff4a[_0xb352('0x135')]-_0x3dff4a[_0xb352('0x1f2')]-_0x3dff4a[_0xb352('0x136')];if(_0x1cc7c3>_0x5de324){_0x1cc7c3=_0x5de324;}}if(_0x1cc7c3>0x0){if(_0x3dff4a['dialMethod']===_0xb352('0xae')){_0x1cc7c3=0x1;}if(_0x1cc7c3>this[_0xb352('0x1d')]){_0x1cc7c3=this[_0xb352('0x1d')];}_0x3dff4a['temp']+=_0x1cc7c3;for(var _0x9ea6ca in this['agents']){if(typeof this[_0xb352('0x1b')][_0x9ea6ca]!=='undefined'){if(this[_0xb352('0x1b')][_0x9ea6ca]['state']===_0xb352('0x1fc')&&this[_0xb352('0x1b')][_0x9ea6ca][_0xb352('0x81')]===_0xb352('0x140')){_0x53dc81[_0xb352('0x93')](this['agents'][_0x9ea6ca]['id']);}}}hopperUtils[_0xb352('0x1fd')](_0x3dff4a,_0x53dc81,_0x1cc7c3)[_0xb352('0x39')](function(_0x54b13e){_0x3dff4a[_0xb352('0x1f2')]-=_0x1cc7c3;_0x3dff4a[_0xb352('0x1f2')]=_0x3dff4a[_0xb352('0x1f2')]>0x0?_0x3dff4a[_0xb352('0x1f2')]:0x0;if(!utils[_0xb352('0x1f3')](_0x54b13e)){hopperUtils['countReScheduled'](_0x3dff4a)[_0xb352('0x39')](sendMessageReschedule(_0x3dff4a))[_0xb352('0x99')](loggerCatch('[countReScheduled]\x20'));}else{_0x3dff4a[_0xb352('0x78')]+=_0x54b13e[_0xb352('0x92')];_0x3dff4a[_0xb352('0x63')]=_0x3dff4a[_0xb352('0xa9')]==='booked'?utils[_0xb352('0x64')]['ACTIVE']:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x37d696=0x0;_0x37d696<_0x54b13e['length'];_0x37d696+=0x1){if(_['isNil'](_0x54b13e[_0x37d696])||_['isNil'](_0x54b13e[_0x37d696]['Contact'])||_[_0xb352('0xef')](_0x54b13e[_0x37d696][_0xb352('0x157')])){_0x5d1a9b[_0xb352('0x1f6')](_0xb352('0x1f7'),_0x3dff4a,_0x54b13e[_0x37d696]);}else{hopperUtils['checkIsBlackList'](_[_0xb352('0x6e')](_0x54b13e[_0x37d696],['VoiceQueueId','phone']))[_0xb352('0x39')](_0x5d1a9b[_0xb352('0x1dc')](_0x3dff4a,_0x54b13e[_0x37d696]))[_0xb352('0x99')](_0x5d1a9b[_0xb352('0x1f9')](_0xb352('0x1f7'),_0x3dff4a));}}}})[_0xb352('0x99')](loggerGetContactDialer(_0xb352('0x1fe'),_0x3dff4a,_0x1cc7c3));}};Dialer[_0xb352('0x14')]['handlePredictive']=function(_0x5868fa){if(_0x5868fa[_0xb352('0x1fb')]>0x0){var _0x118402=_0x5868fa[_0xb352('0x1fb')]-_0x5868fa[_0xb352('0x78')]-_0x5868fa[_0xb352('0x135')];if(_0x118402>0x0){this[_0xb352('0x1ff')](_0x5868fa);}else{loggerPredictiveCalls[_0xb352('0x43')](_0xb352('0x200'));}}else{this[_0xb352('0x1ff')](_0x5868fa);}};Dialer[_0xb352('0x14')][_0xb352('0x1ff')]=function(_0x188316){var _0x4fcf29=this;var _0x46284f=[];_0x188316[_0xb352('0x78')]+=0x1;for(var _0x1a5a34 in this['agents']){if(typeof this['agents'][_0x1a5a34]!==_0xb352('0xa4')){if(this[_0xb352('0x1b')][_0x1a5a34]['state']===_0xb352('0x1fc')&&this[_0xb352('0x1b')][_0x1a5a34][_0xb352('0x81')]===_0xb352('0x140')){_0x46284f[_0xb352('0x93')](this[_0xb352('0x1b')][_0x1a5a34]['id']);}}}return this[_0xb352('0x1fd')](_0x188316['id'],_0x46284f,0x1,_0x188316[_0xb352('0x201')],_0x188316)[_0xb352('0x39')](function(_0x2fa496){if(!utils['checkContactEmpty'](_0x2fa496)){utils[_0xb352('0x60')](_0x188316,0x1,0x0);return hopperUtils['countReScheduled'](_0x188316)[_0xb352('0x39')](sendMessageReschedule(_0x188316))['catch'](loggerCatch(_0xb352('0x202')));}else{_0x188316['message']=utils['CAMPAIGN_STATUS'][_0xb352('0x1f4')];if(_[_0xb352('0xef')](_0x2fa496[0x0])||_[_0xb352('0xef')](_0x2fa496[0x0]['Contact'])||_[_0xb352('0xef')](_0x2fa496[0x0]['phone'])){_0x4fcf29[_0xb352('0x1f6')](_0xb352('0x1f7'),_0x188316,_0x2fa496[0x0]);}else{return hopperUtils[_0xb352('0x203')](_[_0xb352('0x6e')](_0x2fa496[0x0],[_0xb352('0xdc'),_0xb352('0x157')]))[_0xb352('0x39')](_0x4fcf29[_0xb352('0x1dc')](_0x188316,_0x2fa496[0x0]))[_0xb352('0x99')](_0x4fcf29[_0xb352('0x1f9')]('[actionOriginatePredictive]\x20',_0x188316));}}})[_0xb352('0x99')](loggerGetContactDialer('[getContactDialerPredictive]',_0x188316,0x1));};Dialer[_0xb352('0x14')][_0xb352('0x1cc')]=function(_0x4e3c10,_0x5e90b6,_0x3de690,_0x57d208,_0x37501e,_0x1f1558){loggerPredictive[_0xb352('0x43')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xb352('0x43')](_0xb352('0x204'),_0x4e3c10);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e90b6);loggerPredictive[_0xb352('0x43')](_0xb352('0x205'),_0x3de690);loggerPredictive[_0xb352('0x43')](_0xb352('0x206'),_0x57d208);loggerPredictive['info'](_0xb352('0x207'),_0x37501e);loggerPredictive[_0xb352('0x43')]('---------------------------');return new Promise(function(_0x47c2e0,_0x4efb9f){if(_0x4e3c10<=0x0||isNaN(_0x4e3c10)){return _0x4efb9f(msgResponse(_0xb352('0x208'),_0xb352('0x7e'),_0xb352('0x209')+_0x4e3c10));}if(_0x3de690<=0x0||isNaN(_0x3de690)){return _0x4efb9f(msgResponse(_0xb352('0x208'),_0xb352('0x7e'),'Ts\x20=\x20'+_0x3de690));}if(_0x57d208<=0x0||isNaN(_0x57d208)){return _0x4efb9f(msgResponse('[abandonmentRate]','Error',_0xb352('0x20a')+_0x57d208));}if(_0x5e90b6<=0x0||isNaN(_0x5e90b6)){return _0x4efb9f(msgResponse(_0xb352('0x208'),_0xb352('0x7e'),_0xb352('0x20b')+_0x5e90b6));}if(_0x37501e<=0x0||isNaN(_0x37501e)){return _0x4efb9f(msgResponse('[abandonmentRate]','Error',_0xb352('0x20c')+_0x37501e));}_0x1f1558=_0x1f1558||0x0;var _0x53ce32=0x1/_0x3de690;var _0x21140f=0x0;var _0x4e4124=0x0;var _0x9ef58=0x0;var _0x43cf24=0x0;for(var _0x493ff0=0x0;_0x9ef58<_0x37501e;_0x493ff0+=0x1){_0x4e4124=_0x493ff0/_0x5e90b6;_0x21140f=(_0x57d208*_0x4e4124+_0x1f1558)/_0x53ce32;_0x9ef58=utils[_0xb352('0x20d')](_0x21140f,_0x4e3c10);_0x43cf24=_0x21140f/_0x4e3c10*(0x1-utils[_0xb352('0x20d')](_0x21140f,_0x4e3c10));}return _0x47c2e0({'erlangCalls':_0x493ff0,'erlangCallToSecond':_0x5e90b6/_0x493ff0,'erlangAbandonmentRate':_0x9ef58,'erlangBusyFactor':_0x43cf24});});};Dialer[_0xb352('0x14')][_0xb352('0x1cd')]=function(_0x2c5d1f,_0x21e609,_0x51c627,_0x486af3,_0x461eb9,_0xc5d888){loggerPredictive['info'](_0xb352('0x20e'));loggerPredictive[_0xb352('0x43')](_0xb352('0x204'),_0x2c5d1f);loggerPredictive[_0xb352('0x43')](_0xb352('0x20f'),_0x21e609);loggerPredictive[_0xb352('0x43')](_0xb352('0x205'),_0x51c627);loggerPredictive[_0xb352('0x43')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x486af3);loggerPredictive[_0xb352('0x43')](_0xb352('0x210'),_0x461eb9);loggerPredictive['info'](_0xb352('0x211'));return new Promise(function(_0x2e0272,_0x5756d4){if(_0x2c5d1f<=0x0||isNaN(_0x2c5d1f)){return _0x5756d4(msgResponse('[busyFactor]',_0xb352('0x7e'),_0xb352('0x209')+_0x2c5d1f));}if(_0x51c627<=0x0||isNaN(_0x51c627)){return _0x5756d4(msgResponse(_0xb352('0x212'),'Error','Ts\x20=\x20'+_0x51c627));}if(_0x486af3<=0x0||isNaN(_0x486af3)){return _0x5756d4(msgResponse(_0xb352('0x212'),_0xb352('0x7e'),_0xb352('0x20a')+_0x486af3));}if(_0x21e609<=0x0||isNaN(_0x21e609)){return _0x5756d4(msgResponse(_0xb352('0x212'),_0xb352('0x7e'),_0xb352('0x20b')+_0x21e609));}if(_0x461eb9<=0x0||isNaN(_0x461eb9)){return _0x5756d4(msgResponse('[busyFactor]',_0xb352('0x7e'),_0xb352('0x213')+_0x461eb9));}_0xc5d888=_0xc5d888||0x0;var _0x2524b0=0x1/_0x51c627;var _0x48ab9a=0x0;var _0x5830c9=0x0;var _0x3fe78e=0x0;var _0x7907ee=0x0;for(var _0x58159b=0x0;_0x7907ee<_0x461eb9;_0x58159b+=0x1){_0x5830c9=_0x58159b/_0x21e609;_0x48ab9a=(_0x486af3*_0x5830c9+_0xc5d888)/_0x2524b0;_0x3fe78e=utils[_0xb352('0x20d')](_0x48ab9a,_0x2c5d1f);_0x7907ee=_0x48ab9a/_0x2c5d1f*(0x1-utils[_0xb352('0x20d')](_0x48ab9a,_0x2c5d1f));}return _0x2e0272({'erlangCalls':_0x58159b,'erlangCallToSecond':_0x21e609/_0x58159b,'erlangAbandonmentRate':_0x3fe78e,'erlangBusyFactor':_0x7907ee});});};module[_0xb352('0x214')]=Dialer;
\ No newline at end of file
index 1937630..efae7ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e8e=['lodash','string','isNil','voiceQueue','uniqueid','Contact','phone','firstName','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','substring','getQueue','util'];(function(_0x2fcc11,_0xd71b4e){var _0x1d9ece=function(_0x2cc05b){while(--_0x2cc05b){_0x2fcc11['push'](_0x2fcc11['shift']());}};_0x1d9ece(++_0xd71b4e);}(_0x2e8e,0x1df));var _0xe2e8=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x2e8e[_0x1e9d62];return _0x56c490;};'use strict';var util=require(_0xe2e8('0x0'));var _=require(_0xe2e8('0x1'));var moment=require('moment');function checkNameSurname(_0x2536ec,_0x407680,_0x2e7947){var _0x4512fb='';if(!_['isNil'](_0x407680)&&_0xe2e8('0x2')===typeof _0x407680){_0x4512fb+=_0x407680;}if(!_[_0xe2e8('0x3')](_0x2e7947)&&'string'===typeof _0x2e7947){_0x4512fb+='\x20'+_0x2e7947;}if(_0x4512fb!==''){return _0x4512fb;}return _0x2536ec;}function Action(_0x37ec89,_0x18e5b6,_0x29688f){this[_0xe2e8('0x4')]=_0x37ec89;this[_0xe2e8('0x5')]=_0x29688f||undefined;this['name']=checkNameSurname(_0x18e5b6[_0xe2e8('0x6')][_0xe2e8('0x7')],_0x18e5b6[_0xe2e8('0x6')][_0xe2e8('0x8')],_0x18e5b6['Contact'][_0xe2e8('0x9')]);this['number']=_0x18e5b6[_0xe2e8('0x7')];this[_0xe2e8('0xa')]=_0x37ec89[_0xe2e8('0xb')];this['active']=_0x18e5b6[_0xe2e8('0xc')]||![];this[_0xe2e8('0xd')]=_0x37ec89[_0xe2e8('0xd')];this['dialQueueTimeout']=_0x37ec89[_0xe2e8('0xe')]||0x3;this[_0xe2e8('0xf')]=_0x18e5b6[_0xe2e8('0xf')];this['countbusyretry']=_0x18e5b6['countbusyretry'];this[_0xe2e8('0x10')]=_0x18e5b6[_0xe2e8('0x10')];this['countnoanswerretry']=_0x18e5b6[_0xe2e8('0x11')];this[_0xe2e8('0x12')]=_0x18e5b6[_0xe2e8('0x12')];this['countdropretry']=_0x18e5b6[_0xe2e8('0x13')];this[_0xe2e8('0x14')]=_0x18e5b6[_0xe2e8('0x14')];this['countmachineretry']=_0x18e5b6[_0xe2e8('0x15')];this[_0xe2e8('0x16')]=_0x18e5b6['countagentrejectretry'];this[_0xe2e8('0x17')]=_0x18e5b6[_0xe2e8('0x17')];this[_0xe2e8('0x18')]=_0x18e5b6[_0xe2e8('0x18')];this[_0xe2e8('0x19')]=_0x18e5b6['UserId'];this[_0xe2e8('0x1a')]=_0x18e5b6['VoiceQueueId'];this[_0xe2e8('0x1b')]=_0x18e5b6[_0xe2e8('0x1b')];this[_0xe2e8('0x1c')]=_0x18e5b6['id'];this['ContactFirstName']=_0x18e5b6[_0xe2e8('0x6')]['firstName']||'';this['starttime']=moment()[_0xe2e8('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x18e5b6[_0xe2e8('0x1e')];this['callbackuniqueid']=_0x18e5b6['callbackuniqueid'];this[_0xe2e8('0x1f')]=_0x18e5b6[_0xe2e8('0x1f')];this[_0xe2e8('0x20')]=_0x18e5b6[_0xe2e8('0x20')];this[_0xe2e8('0x21')]='';this[_0xe2e8('0x22')]='';}Action[_0xe2e8('0x23')]['getCaller']=function(){return util[_0xe2e8('0x1d')](_0xe2e8('0x24'),this[_0xe2e8('0xb')],this[_0xe2e8('0x4')]['dialCutDigit']>0x0?this[_0xe2e8('0x25')][_0xe2e8('0x26')](this[_0xe2e8('0x4')]['dialCutDigit']):this[_0xe2e8('0x25')]);};Action[_0xe2e8('0x23')][_0xe2e8('0x27')]=function(){return this[_0xe2e8('0xa')];};module['exports']=Action;
\ No newline at end of file
+var _0x7d3e=['callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','phone','firstName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','Contact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x1e3bb9,_0x2ee873){var _0x59e08d=function(_0x17cecd){while(--_0x17cecd){_0x1e3bb9['push'](_0x1e3bb9['shift']());}};_0x59e08d(++_0x2ee873);}(_0x7d3e,0x174));var _0xe7d3=function(_0x5b9512,_0x5bec1a){_0x5b9512=_0x5b9512-0x0;var _0x37802f=_0x7d3e[_0x5b9512];return _0x37802f;};'use strict';var util=require(_0xe7d3('0x0'));var _=require(_0xe7d3('0x1'));var moment=require('moment');function checkNameSurname(_0x22c1b8,_0x12adcb,_0x429bbe){var _0x3a65dc='';if(!_[_0xe7d3('0x2')](_0x12adcb)&&_0xe7d3('0x3')===typeof _0x12adcb){_0x3a65dc+=_0x12adcb;}if(!_['isNil'](_0x429bbe)&&_0xe7d3('0x3')===typeof _0x429bbe){_0x3a65dc+='\x20'+_0x429bbe;}if(_0x3a65dc!==''){return _0x3a65dc;}return _0x22c1b8;}function Action(_0x347d5c,_0x41487b,_0x19d0a9){this[_0xe7d3('0x4')]=_0x347d5c;this[_0xe7d3('0x5')]=_0x19d0a9||undefined;this[_0xe7d3('0x6')]=checkNameSurname(_0x41487b['Contact'][_0xe7d3('0x7')],_0x41487b['Contact'][_0xe7d3('0x8')],_0x41487b['Contact']['lastName']);this['number']=_0x41487b[_0xe7d3('0x7')];this[_0xe7d3('0x9')]=_0x347d5c[_0xe7d3('0x6')];this['active']=_0x41487b[_0xe7d3('0xa')]||![];this[_0xe7d3('0xb')]=_0x347d5c[_0xe7d3('0xb')];this[_0xe7d3('0xc')]=_0x347d5c[_0xe7d3('0xc')]||0x3;this[_0xe7d3('0xd')]=_0x41487b[_0xe7d3('0xd')];this[_0xe7d3('0xe')]=_0x41487b[_0xe7d3('0xe')];this[_0xe7d3('0xf')]=_0x41487b[_0xe7d3('0xf')];this['countnoanswerretry']=_0x41487b[_0xe7d3('0x10')];this[_0xe7d3('0x11')]=_0x41487b[_0xe7d3('0x11')];this['countdropretry']=_0x41487b[_0xe7d3('0x12')];this[_0xe7d3('0x13')]=_0x41487b['countabandonedretry'];this[_0xe7d3('0x14')]=_0x41487b[_0xe7d3('0x14')];this['countagentrejectretry']=_0x41487b[_0xe7d3('0x15')];this[_0xe7d3('0x16')]=_0x41487b['ContactId'];this[_0xe7d3('0x17')]=_0x41487b[_0xe7d3('0x17')];this[_0xe7d3('0x18')]=_0x41487b[_0xe7d3('0x18')];this[_0xe7d3('0x19')]=_0x41487b['VoiceQueueId'];this[_0xe7d3('0x1a')]=_0x41487b[_0xe7d3('0x1a')];this['idHopper']=_0x41487b['id'];this[_0xe7d3('0x1b')]=_0x41487b[_0xe7d3('0x1c')][_0xe7d3('0x8')]||'';this[_0xe7d3('0x1d')]=moment()[_0xe7d3('0x1e')](_0xe7d3('0x1f'));this[_0xe7d3('0x20')]=_0x41487b[_0xe7d3('0x20')];this[_0xe7d3('0x21')]=_0x41487b['callbackuniqueid'];this[_0xe7d3('0x22')]=_0x41487b[_0xe7d3('0x22')];this[_0xe7d3('0x23')]=_0x41487b['recallme'];this[_0xe7d3('0x24')]='';this[_0xe7d3('0x25')]='';}Action[_0xe7d3('0x26')][_0xe7d3('0x27')]=function(){return util[_0xe7d3('0x1e')](_0xe7d3('0x28'),this[_0xe7d3('0x6')],this['voiceQueue'][_0xe7d3('0x29')]>0x0?this['number'][_0xe7d3('0x2a')](this[_0xe7d3('0x4')][_0xe7d3('0x29')]):this['number']);};Action[_0xe7d3('0x26')][_0xe7d3('0x2b')]=function(){return this[_0xe7d3('0x9')];};module[_0xe7d3('0x2c')]=Action;
\ No newline at end of file
index a09324d..95a7bf3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14ef=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','exports','moment','../utils','statedesc','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime'];(function(_0x4ca2b5,_0x228b0f){var _0x3ecd00=function(_0x517783){while(--_0x517783){_0x4ca2b5['push'](_0x4ca2b5['shift']());}};_0x3ecd00(++_0x228b0f);}(_0x14ef,0x68));var _0xf14e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x14ef[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xf14e('0x0'));var utils=require(_0xf14e('0x1'));function AgentComplete(_0x505dcf,_0xf76099){this['state']=0x4;this[_0xf14e('0x2')]='Answer';this[_0xf14e('0x3')]=_0x505dcf[_0xf14e('0x3')];this[_0xf14e('0x4')]=_0x505dcf[_0xf14e('0x4')];this['campaigntype']=_0x505dcf['type']==='outbound'?'queue':_0x505dcf[_0xf14e('0x4')];this['countbusyretry']=_0x505dcf[_0xf14e('0x5')];this[_0xf14e('0x6')]=_0x505dcf[_0xf14e('0x6')];this[_0xf14e('0x7')]=_0x505dcf['countnoanswerretry'];this['countglobal']=_0x505dcf['countbusyretry']+_0x505dcf[_0xf14e('0x6')]+_0x505dcf[_0xf14e('0x7')]+_0x505dcf[_0xf14e('0x8')]+_0x505dcf[_0xf14e('0x9')]+_0x505dcf[_0xf14e('0xa')]+_0x505dcf[_0xf14e('0xb')]+_0x505dcf[_0xf14e('0xc')];this[_0xf14e('0x8')]=_0x505dcf['countnosuchnumberretry'];this[_0xf14e('0x9')]=_0x505dcf['countdropretry'];this[_0xf14e('0xa')]=_0x505dcf[_0xf14e('0xa')];this[_0xf14e('0xb')]=_0x505dcf[_0xf14e('0xb')];this[_0xf14e('0xc')]=_0x505dcf[_0xf14e('0xc')];this[_0xf14e('0xd')]=_0xf76099[_0xf14e('0xd')];this['calleridname']=_0x505dcf[_0xf14e('0xe')];this[_0xf14e('0xf')]=_0x505dcf[_0xf14e('0x10')];this['starttime']=_0x505dcf[_0xf14e('0x11')];this[_0xf14e('0x12')]=_0x505dcf[_0xf14e('0x12')];this['answertime']=_0x505dcf[_0xf14e('0x13')];this[_0xf14e('0x14')]=moment()[_0xf14e('0x15')](_0xf14e('0x16'));this[_0xf14e('0x17')]=utils[_0xf14e('0x18')](_0x505dcf[_0xf14e('0x12')],_0x505dcf[_0xf14e('0x11')]);this['holdtime']=utils['getSeconds'](_0x505dcf[_0xf14e('0x13')],_0x505dcf[_0xf14e('0x12')]);this[_0xf14e('0x19')]=utils['getSeconds'](this[_0xf14e('0x14')],_0x505dcf[_0xf14e('0x13')]);this[_0xf14e('0x1a')]=_0xf76099[_0xf14e('0x1a')];this[_0xf14e('0x1b')]=_0xf76099[_0xf14e('0x1b')];this[_0xf14e('0x1c')]=_0xf76099['reason'];this[_0xf14e('0x1d')]=_0x505dcf[_0xf14e('0x1d')];this[_0xf14e('0x1e')]=_0x505dcf['callbackuniqueid'];this[_0xf14e('0x1f')]=_0x505dcf['callbackat'];this[_0xf14e('0x20')]=_0x505dcf['recallme'];this[_0xf14e('0x21')]=_0x505dcf[_0xf14e('0x21')];this[_0xf14e('0x22')]=_0x505dcf['ListId'];this[_0xf14e('0x23')]=_0x505dcf['UserId'];this[_0xf14e('0x24')]=_0x505dcf['VoiceQueueId'];this['CampaignId']=_0x505dcf[_0xf14e('0x25')];this[_0xf14e('0x26')]=_0x505dcf[_0xf14e('0x26')]||'';this['originatecalleridname']=_0x505dcf['originatecalleridname']||'';this[_0xf14e('0x27')]=_0x505dcf['agiafterat'];}module[_0xf14e('0x28')]=AgentComplete;
\ No newline at end of file
+var _0x264d=['agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','answertime','format','ringtime','holdtime','getSeconds','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x4c2f67,_0x4f700a){var _0x2e091e=function(_0x401414){while(--_0x401414){_0x4c2f67['push'](_0x4c2f67['shift']());}};_0x2e091e(++_0x4f700a);}(_0x264d,0x116));var _0xd264=function(_0xe2ae2b,_0x48d240){_0xe2ae2b=_0xe2ae2b-0x0;var _0xa5cac5=_0x264d[_0xe2ae2b];return _0xa5cac5;};'use strict';var moment=require(_0xd264('0x0'));var utils=require(_0xd264('0x1'));function AgentComplete(_0x3d0c48,_0x3af781){this[_0xd264('0x2')]=0x4;this[_0xd264('0x3')]=_0xd264('0x4');this['scheduledat']=_0x3d0c48[_0xd264('0x5')];this[_0xd264('0x6')]=_0x3d0c48[_0xd264('0x6')];this[_0xd264('0x7')]=_0x3d0c48[_0xd264('0x6')]===_0xd264('0x8')?_0xd264('0x9'):_0x3d0c48['type'];this['countbusyretry']=_0x3d0c48[_0xd264('0xa')];this[_0xd264('0xb')]=_0x3d0c48['countcongestionretry'];this['countnoanswerretry']=_0x3d0c48[_0xd264('0xc')];this[_0xd264('0xd')]=_0x3d0c48[_0xd264('0xa')]+_0x3d0c48[_0xd264('0xb')]+_0x3d0c48[_0xd264('0xc')]+_0x3d0c48[_0xd264('0xe')]+_0x3d0c48['countdropretry']+_0x3d0c48[_0xd264('0xf')]+_0x3d0c48['countmachineretry']+_0x3d0c48[_0xd264('0x10')];this[_0xd264('0xe')]=_0x3d0c48[_0xd264('0xe')];this[_0xd264('0x11')]=_0x3d0c48[_0xd264('0x11')];this['countabandonedretry']=_0x3d0c48[_0xd264('0xf')];this['countmachineretry']=_0x3d0c48[_0xd264('0x12')];this['countagentrejectretry']=_0x3d0c48[_0xd264('0x10')];this[_0xd264('0x13')]=_0x3af781[_0xd264('0x13')];this[_0xd264('0x14')]=_0x3d0c48[_0xd264('0x15')];this['calleridnum']=_0x3d0c48['number'];this[_0xd264('0x16')]=_0x3d0c48[_0xd264('0x16')];this[_0xd264('0x17')]=_0x3d0c48[_0xd264('0x17')];this[_0xd264('0x18')]=_0x3d0c48[_0xd264('0x18')];this['endtime']=moment()[_0xd264('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd264('0x1a')]=utils['getSeconds'](_0x3d0c48['responsetime'],_0x3d0c48[_0xd264('0x16')]);this[_0xd264('0x1b')]=utils[_0xd264('0x1c')](_0x3d0c48[_0xd264('0x18')],_0x3d0c48[_0xd264('0x17')]);this[_0xd264('0x1d')]=utils[_0xd264('0x1c')](this[_0xd264('0x1e')],_0x3d0c48['answertime']);this[_0xd264('0x9')]=_0x3af781[_0xd264('0x9')];this['membername']=_0x3af781[_0xd264('0x1f')];this[_0xd264('0x20')]=_0x3af781[_0xd264('0x20')];this[_0xd264('0x21')]=_0x3d0c48[_0xd264('0x21')];this[_0xd264('0x22')]=_0x3d0c48[_0xd264('0x22')];this[_0xd264('0x23')]=_0x3d0c48[_0xd264('0x23')];this['recallme']=_0x3d0c48[_0xd264('0x24')];this['ContactId']=_0x3d0c48[_0xd264('0x25')];this[_0xd264('0x26')]=_0x3d0c48[_0xd264('0x26')];this[_0xd264('0x27')]=_0x3d0c48[_0xd264('0x27')];this[_0xd264('0x28')]=_0x3d0c48[_0xd264('0x28')];this[_0xd264('0x29')]=_0x3d0c48['CampaignId'];this['originatecalleridnum']=_0x3d0c48[_0xd264('0x2a')]||'';this[_0xd264('0x2b')]=_0x3d0c48[_0xd264('0x2b')]||'';this[_0xd264('0x2c')]=_0x3d0c48['agiafterat'];}module[_0xd264('0x2d')]=AgentComplete;
\ No newline at end of file
index 46b15cf..d164294 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d49=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x302624,_0x57d945){var _0x395093=function(_0x40e94d){while(--_0x40e94d){_0x302624['push'](_0x302624['shift']());}};_0x395093(++_0x57d945);}(_0x7d49,0x128));var _0x97d4=function(_0x35907b,_0x202eed){_0x35907b=_0x35907b-0x0;var _0x1fa4f4=_0x7d49[_0x35907b];return _0x1fa4f4;};'use strict';function Final(_0x2347dc){this[_0x97d4('0x0')]=_0x2347dc[_0x97d4('0x0')];this[_0x97d4('0x1')]=_0x2347dc[_0x97d4('0x1')];this[_0x97d4('0x2')]=_0x2347dc[_0x97d4('0x2')];this[_0x97d4('0x3')]=_0x2347dc[_0x97d4('0x2')]===_0x97d4('0x4')?_0x97d4('0x5'):_0x2347dc[_0x97d4('0x2')];this['countbusyretry']=_0x2347dc[_0x97d4('0x6')];this[_0x97d4('0x7')]=_0x2347dc[_0x97d4('0x7')];this['countnoanswerretry']=_0x2347dc[_0x97d4('0x8')];this[_0x97d4('0x9')]=_0x2347dc[_0x97d4('0x6')]+_0x2347dc['countcongestionretry']+_0x2347dc[_0x97d4('0x8')]+_0x2347dc[_0x97d4('0xa')]+_0x2347dc['countdropretry']+_0x2347dc['countabandonedretry']+_0x2347dc[_0x97d4('0xb')]+_0x2347dc[_0x97d4('0xc')];this[_0x97d4('0xa')]=_0x2347dc[_0x97d4('0xa')];this[_0x97d4('0xd')]=_0x2347dc['countdropretry'];this[_0x97d4('0xe')]=_0x2347dc[_0x97d4('0xe')];this[_0x97d4('0xb')]=_0x2347dc[_0x97d4('0xb')];this[_0x97d4('0xc')]=_0x2347dc[_0x97d4('0xc')];this['queue']=_0x2347dc[_0x97d4('0x5')];this['calleridname']=_0x2347dc[_0x97d4('0xf')];this['calleridnum']=_0x2347dc[_0x97d4('0x10')];this[_0x97d4('0x11')]=_0x2347dc[_0x97d4('0x11')];this[_0x97d4('0x12')]=_0x2347dc[_0x97d4('0x12')];this[_0x97d4('0x13')]=_0x2347dc['responsetime'];this[_0x97d4('0x14')]=_0x2347dc[_0x97d4('0x14')]||0x0;this[_0x97d4('0x15')]=_0x2347dc[_0x97d4('0x15')]||0x0;this[_0x97d4('0x16')]=_0x2347dc[_0x97d4('0x16')]||0x0;this[_0x97d4('0x17')]=_0x2347dc['callback'];this['callbackuniqueid']=_0x2347dc[_0x97d4('0x18')];this[_0x97d4('0x19')]=_0x2347dc[_0x97d4('0x19')];this[_0x97d4('0x1a')]=_0x2347dc[_0x97d4('0x1a')];this[_0x97d4('0x1b')]=_0x2347dc[_0x97d4('0x1b')];this[_0x97d4('0x1c')]=_0x2347dc[_0x97d4('0x1c')];this[_0x97d4('0x1d')]=_0x2347dc[_0x97d4('0x1d')];this['VoiceQueueId']=_0x2347dc[_0x97d4('0x1e')];this['CampaignId']=_0x2347dc['CampaignId'];this[_0x97d4('0x1f')]=_0x2347dc[_0x97d4('0x1f')]||'';this[_0x97d4('0x20')]=_0x2347dc['originatecalleridname']||'';this[_0x97d4('0x21')]=_0x2347dc[_0x97d4('0x21')];this[_0x97d4('0x22')]=_0x2347dc[_0x97d4('0x22')];}module[_0x97d4('0x23')]=Final;
\ No newline at end of file
+var _0x875d=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId'];(function(_0x1f7110,_0x3faac0){var _0x1343d1=function(_0x118bc2){while(--_0x118bc2){_0x1f7110['push'](_0x1f7110['shift']());}};_0x1343d1(++_0x3faac0);}(_0x875d,0xbc));var _0xd875=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x875d[_0x543084];return _0x306a57;};'use strict';function Final(_0x46a12d){this[_0xd875('0x0')]=_0x46a12d[_0xd875('0x0')];this['scheduledat']=_0x46a12d[_0xd875('0x1')];this[_0xd875('0x2')]=_0x46a12d[_0xd875('0x2')];this[_0xd875('0x3')]=_0x46a12d[_0xd875('0x2')]===_0xd875('0x4')?'queue':_0x46a12d[_0xd875('0x2')];this[_0xd875('0x5')]=_0x46a12d['countbusyretry'];this[_0xd875('0x6')]=_0x46a12d[_0xd875('0x6')];this[_0xd875('0x7')]=_0x46a12d[_0xd875('0x7')];this[_0xd875('0x8')]=_0x46a12d[_0xd875('0x5')]+_0x46a12d['countcongestionretry']+_0x46a12d[_0xd875('0x7')]+_0x46a12d[_0xd875('0x9')]+_0x46a12d['countdropretry']+_0x46a12d[_0xd875('0xa')]+_0x46a12d[_0xd875('0xb')]+_0x46a12d[_0xd875('0xc')];this[_0xd875('0x9')]=_0x46a12d['countnosuchnumberretry'];this[_0xd875('0xd')]=_0x46a12d[_0xd875('0xd')];this['countabandonedretry']=_0x46a12d[_0xd875('0xa')];this[_0xd875('0xb')]=_0x46a12d[_0xd875('0xb')];this[_0xd875('0xc')]=_0x46a12d[_0xd875('0xc')];this[_0xd875('0xe')]=_0x46a12d['queue'];this[_0xd875('0xf')]=_0x46a12d['calleridname'];this[_0xd875('0x10')]=_0x46a12d[_0xd875('0x10')];this[_0xd875('0x11')]=_0x46a12d[_0xd875('0x11')];this[_0xd875('0x12')]=_0x46a12d[_0xd875('0x12')];this[_0xd875('0x13')]=_0x46a12d[_0xd875('0x12')];this['ringtime']=_0x46a12d[_0xd875('0x14')]||0x0;this[_0xd875('0x15')]=_0x46a12d[_0xd875('0x15')]||0x0;this[_0xd875('0x16')]=_0x46a12d['talktime']||0x0;this[_0xd875('0x17')]=_0x46a12d[_0xd875('0x17')];this['callbackuniqueid']=_0x46a12d[_0xd875('0x18')];this['callbackat']=_0x46a12d['callbackat'];this['recallme']=_0x46a12d[_0xd875('0x19')];this[_0xd875('0x1a')]=_0x46a12d[_0xd875('0x1a')];this[_0xd875('0x1b')]=_0x46a12d[_0xd875('0x1b')];this[_0xd875('0x1c')]=_0x46a12d[_0xd875('0x1c')];this['VoiceQueueId']=_0x46a12d[_0xd875('0x1d')];this[_0xd875('0x1e')]=_0x46a12d['CampaignId'];this[_0xd875('0x1f')]=_0x46a12d[_0xd875('0x1f')]||'';this['originatecalleridname']=_0x46a12d[_0xd875('0x20')]||'';this[_0xd875('0x21')]=_0x46a12d['state'];this[_0xd875('0x22')]=_0x46a12d[_0xd875('0x22')];}module[_0xd875('0x23')]=Final;
\ No newline at end of file
index baa2bae..69ccf51 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd150=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry'];(function(_0x4b78ea,_0x30b3a1){var _0x40cf06=function(_0x53d77e){while(--_0x53d77e){_0x4b78ea['push'](_0x4b78ea['shift']());}};_0x40cf06(++_0x30b3a1);}(_0xd150,0x152));var _0x0d15=function(_0x26a527,_0xefb799){_0x26a527=_0x26a527-0x0;var _0x40ea9b=_0xd150[_0x26a527];return _0x40ea9b;};'use strict';var moment=require(_0x0d15('0x0'));var utils=require(_0x0d15('0x1'));function Hangup(_0x1c5003,_0x311810){this[_0x0d15('0x2')]=0x4;this['statedesc']='Answer';this[_0x0d15('0x3')]=_0x1c5003[_0x0d15('0x3')];this['type']=_0x1c5003[_0x0d15('0x4')];this[_0x0d15('0x5')]=_0x1c5003[_0x0d15('0x4')]===_0x0d15('0x6')?_0x0d15('0x7'):_0x1c5003[_0x0d15('0x4')];this[_0x0d15('0x8')]=_0x1c5003[_0x0d15('0x8')]||![];this[_0x0d15('0x9')]=_0x1c5003[_0x0d15('0x9')];this[_0x0d15('0xa')]=_0x1c5003[_0x0d15('0xa')];this['countnoanswerretry']=_0x1c5003['countnoanswerretry'];this[_0x0d15('0xb')]=_0x1c5003[_0x0d15('0x9')]+_0x1c5003[_0x0d15('0xa')]+_0x1c5003[_0x0d15('0xc')]+_0x1c5003[_0x0d15('0xd')]+_0x1c5003[_0x0d15('0xe')]+_0x1c5003[_0x0d15('0xf')]+_0x1c5003['countmachineretry']+_0x1c5003[_0x0d15('0x10')];this[_0x0d15('0xd')]=_0x1c5003['countnosuchnumberretry'];this[_0x0d15('0xe')]=_0x1c5003[_0x0d15('0xe')];this[_0x0d15('0xf')]=_0x1c5003[_0x0d15('0xf')];this['countmachineretry']=_0x1c5003[_0x0d15('0x11')];this['countagentrejectretry']=_0x1c5003[_0x0d15('0x10')];this[_0x0d15('0x12')]=_0x311810['uniqueid'];this[_0x0d15('0x13')]=_0x1c5003['name'];this[_0x0d15('0x14')]=_0x1c5003[_0x0d15('0x15')];this[_0x0d15('0x16')]=_0x1c5003[_0x0d15('0x16')];this[_0x0d15('0x17')]=_0x1c5003[_0x0d15('0x17')];this[_0x0d15('0x18')]=moment()[_0x0d15('0x19')](_0x0d15('0x1a'));this['ringtime']=utils['getSeconds'](_0x1c5003[_0x0d15('0x17')],_0x1c5003[_0x0d15('0x16')]);this[_0x0d15('0x1b')]=0x0;this[_0x0d15('0x1c')]=utils[_0x0d15('0x1d')](this[_0x0d15('0x18')],_0x1c5003['responsetime']);this['queue']=_0x1c5003[_0x0d15('0x7')];this[_0x0d15('0x1e')]=_0x0d15('0x1f');this[_0x0d15('0x20')]=_0x311810[_0x0d15('0x21')];this[_0x0d15('0x22')]=_0x1c5003[_0x0d15('0x22')];this['callbackuniqueid']=_0x1c5003[_0x0d15('0x23')];this['callbackat']=_0x1c5003[_0x0d15('0x24')];this[_0x0d15('0x25')]=_0x1c5003[_0x0d15('0x25')];this[_0x0d15('0x26')]=_0x1c5003['ContactId'];this[_0x0d15('0x27')]=_0x1c5003[_0x0d15('0x27')];this['UserId']=_0x1c5003[_0x0d15('0x28')];this[_0x0d15('0x29')]=_0x1c5003[_0x0d15('0x29')];this[_0x0d15('0x2a')]=_0x1c5003['CampaignId'];}module[_0x0d15('0x2b')]=Hangup;
\ No newline at end of file
+var _0xaf8a=['VoiceQueueId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x56410f,_0x68b85c){var _0x3dc3af=function(_0x209769){while(--_0x209769){_0x56410f['push'](_0x56410f['shift']());}};_0x3dc3af(++_0x68b85c);}(_0xaf8a,0xcf));var _0xaaf8=function(_0x2a8e4f,_0x28ca0c){_0x2a8e4f=_0x2a8e4f-0x0;var _0x2950c5=_0xaf8a[_0x2a8e4f];return _0x2950c5;};'use strict';var moment=require(_0xaaf8('0x0'));var utils=require(_0xaaf8('0x1'));function Hangup(_0x1348c1,_0x35e570){this[_0xaaf8('0x2')]=0x4;this[_0xaaf8('0x3')]=_0xaaf8('0x4');this[_0xaaf8('0x5')]=_0x1348c1[_0xaaf8('0x5')];this[_0xaaf8('0x6')]=_0x1348c1['type'];this['campaigntype']=_0x1348c1[_0xaaf8('0x6')]===_0xaaf8('0x7')?_0xaaf8('0x8'):_0x1348c1[_0xaaf8('0x6')];this[_0xaaf8('0x9')]=_0x1348c1[_0xaaf8('0x9')]||![];this[_0xaaf8('0xa')]=_0x1348c1[_0xaaf8('0xa')];this['countcongestionretry']=_0x1348c1[_0xaaf8('0xb')];this[_0xaaf8('0xc')]=_0x1348c1[_0xaaf8('0xc')];this[_0xaaf8('0xd')]=_0x1348c1[_0xaaf8('0xa')]+_0x1348c1[_0xaaf8('0xb')]+_0x1348c1['countnoanswerretry']+_0x1348c1[_0xaaf8('0xe')]+_0x1348c1[_0xaaf8('0xf')]+_0x1348c1[_0xaaf8('0x10')]+_0x1348c1['countmachineretry']+_0x1348c1[_0xaaf8('0x11')];this['countnosuchnumberretry']=_0x1348c1[_0xaaf8('0xe')];this['countdropretry']=_0x1348c1[_0xaaf8('0xf')];this[_0xaaf8('0x10')]=_0x1348c1[_0xaaf8('0x10')];this['countmachineretry']=_0x1348c1[_0xaaf8('0x12')];this[_0xaaf8('0x11')]=_0x1348c1[_0xaaf8('0x11')];this['uniqueid']=_0x35e570['uniqueid'];this['calleridname']=_0x1348c1[_0xaaf8('0x13')];this[_0xaaf8('0x14')]=_0x1348c1[_0xaaf8('0x15')];this[_0xaaf8('0x16')]=_0x1348c1[_0xaaf8('0x16')];this[_0xaaf8('0x17')]=_0x1348c1[_0xaaf8('0x17')];this[_0xaaf8('0x18')]=moment()[_0xaaf8('0x19')](_0xaaf8('0x1a'));this[_0xaaf8('0x1b')]=utils[_0xaaf8('0x1c')](_0x1348c1[_0xaaf8('0x17')],_0x1348c1[_0xaaf8('0x16')]);this[_0xaaf8('0x1d')]=0x0;this[_0xaaf8('0x1e')]=utils['getSeconds'](this[_0xaaf8('0x18')],_0x1348c1[_0xaaf8('0x17')]);this['queue']=_0x1348c1['queue'];this['membername']=_0xaaf8('0x1f');this['reason']=_0x35e570[_0xaaf8('0x20')];this[_0xaaf8('0x21')]=_0x1348c1[_0xaaf8('0x21')];this['callbackuniqueid']=_0x1348c1[_0xaaf8('0x22')];this['callbackat']=_0x1348c1[_0xaaf8('0x23')];this[_0xaaf8('0x24')]=_0x1348c1[_0xaaf8('0x24')];this[_0xaaf8('0x25')]=_0x1348c1[_0xaaf8('0x25')];this['ListId']=_0x1348c1[_0xaaf8('0x26')];this['UserId']=_0x1348c1['UserId'];this[_0xaaf8('0x27')]=_0x1348c1[_0xaaf8('0x27')];this[_0xaaf8('0x28')]=_0x1348c1['CampaignId'];}module['exports']=Hangup;
\ No newline at end of file
index cfbfa8c..2eafbd0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa30d=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xa30d,0x115));var _0xda30=function(_0x35c897,_0x4d719e){_0x35c897=_0x35c897-0x0;var _0x1e6ac0=_0xa30d[_0x35c897];return _0x1e6ac0;};'use strict';var utils=require('../utils');function History(_0x46d7a9){this[_0xda30('0x0')]=_0x46d7a9[_0xda30('0x0')];this[_0xda30('0x1')]=_0x46d7a9[_0xda30('0x1')]||undefined;this['type']=_0x46d7a9[_0xda30('0x2')];this[_0xda30('0x3')]=_0x46d7a9[_0xda30('0x2')]===_0xda30('0x4')?'queue':_0x46d7a9['type'];this[_0xda30('0x5')]=_0x46d7a9[_0xda30('0x5')];this['countcongestionretry']=_0x46d7a9[_0xda30('0x6')];this['countnoanswerretry']=_0x46d7a9[_0xda30('0x7')];this[_0xda30('0x8')]=_0x46d7a9[_0xda30('0x5')]+_0x46d7a9['countcongestionretry']+_0x46d7a9['countnoanswerretry']+_0x46d7a9[_0xda30('0x9')]+_0x46d7a9['countdropretry']+_0x46d7a9[_0xda30('0xa')]+_0x46d7a9[_0xda30('0xb')]+_0x46d7a9[_0xda30('0xc')];this['countnosuchnumberretry']=_0x46d7a9[_0xda30('0x9')];this[_0xda30('0xd')]=_0x46d7a9[_0xda30('0xd')];this['countabandonedretry']=_0x46d7a9[_0xda30('0xa')];this[_0xda30('0xb')]=_0x46d7a9['countmachineretry'];this[_0xda30('0xc')]=_0x46d7a9['countagentrejectretry'];this['queue']=_0x46d7a9[_0xda30('0xe')];this['calleridname']=_0x46d7a9[_0xda30('0xf')];this[_0xda30('0x10')]=_0x46d7a9['number'];this[_0xda30('0x11')]=_0x46d7a9[_0xda30('0x11')];this['responsetime']=_0x46d7a9[_0xda30('0x12')];this[_0xda30('0x13')]=_0x46d7a9[_0xda30('0x12')];this[_0xda30('0x14')]=utils[_0xda30('0x15')](_0x46d7a9[_0xda30('0x12')],_0x46d7a9[_0xda30('0x11')]);this[_0xda30('0x16')]=0x0;this[_0xda30('0x17')]=0x0;this[_0xda30('0x18')]=_0x46d7a9['callback'];this[_0xda30('0x19')]=_0x46d7a9['callbackuniqueid'];this[_0xda30('0x1a')]=_0x46d7a9[_0xda30('0x1a')];this['recallme']=_0x46d7a9[_0xda30('0x1b')];this[_0xda30('0x1c')]=_0x46d7a9[_0xda30('0x1c')];this[_0xda30('0x1d')]=_0x46d7a9[_0xda30('0x1d')];this[_0xda30('0x1e')]=_0x46d7a9['UserId'];this[_0xda30('0x1f')]=_0x46d7a9['VoiceQueueId'];this[_0xda30('0x20')]=_0x46d7a9[_0xda30('0x20')];this[_0xda30('0x21')]=_0x46d7a9[_0xda30('0x21')]||'';this[_0xda30('0x22')]=_0x46d7a9[_0xda30('0x22')]||'';this[_0xda30('0x23')]=_0x46d7a9[_0xda30('0x23')];this[_0xda30('0x24')]=_0x46d7a9[_0xda30('0x24')];}module[_0xda30('0x25')]=History;
\ No newline at end of file
+var _0x3ca6=['scheduledat','type','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','../utils','uniqueid'];(function(_0x347d49,_0x518b3b){var _0x4d2df2=function(_0x213231){while(--_0x213231){_0x347d49['push'](_0x347d49['shift']());}};_0x4d2df2(++_0x518b3b);}(_0x3ca6,0x101));var _0x63ca=function(_0x918967,_0x1161f8){_0x918967=_0x918967-0x0;var _0x36d11a=_0x3ca6[_0x918967];return _0x36d11a;};'use strict';var utils=require(_0x63ca('0x0'));function History(_0x4f7036){this[_0x63ca('0x1')]=_0x4f7036[_0x63ca('0x1')];this[_0x63ca('0x2')]=_0x4f7036[_0x63ca('0x2')]||undefined;this[_0x63ca('0x3')]=_0x4f7036['type'];this['campaigntype']=_0x4f7036[_0x63ca('0x3')]===_0x63ca('0x4')?'queue':_0x4f7036[_0x63ca('0x3')];this[_0x63ca('0x5')]=_0x4f7036[_0x63ca('0x5')];this['countcongestionretry']=_0x4f7036[_0x63ca('0x6')];this['countnoanswerretry']=_0x4f7036['countnoanswerretry'];this[_0x63ca('0x7')]=_0x4f7036[_0x63ca('0x5')]+_0x4f7036['countcongestionretry']+_0x4f7036[_0x63ca('0x8')]+_0x4f7036[_0x63ca('0x9')]+_0x4f7036[_0x63ca('0xa')]+_0x4f7036[_0x63ca('0xb')]+_0x4f7036[_0x63ca('0xc')]+_0x4f7036[_0x63ca('0xd')];this[_0x63ca('0x9')]=_0x4f7036['countnosuchnumberretry'];this[_0x63ca('0xa')]=_0x4f7036[_0x63ca('0xa')];this[_0x63ca('0xb')]=_0x4f7036[_0x63ca('0xb')];this[_0x63ca('0xc')]=_0x4f7036[_0x63ca('0xc')];this[_0x63ca('0xd')]=_0x4f7036[_0x63ca('0xd')];this['queue']=_0x4f7036[_0x63ca('0xe')];this[_0x63ca('0xf')]=_0x4f7036[_0x63ca('0x10')];this[_0x63ca('0x11')]=_0x4f7036['number'];this[_0x63ca('0x12')]=_0x4f7036['starttime'];this[_0x63ca('0x13')]=_0x4f7036[_0x63ca('0x13')];this[_0x63ca('0x14')]=_0x4f7036[_0x63ca('0x13')];this[_0x63ca('0x15')]=utils[_0x63ca('0x16')](_0x4f7036[_0x63ca('0x13')],_0x4f7036[_0x63ca('0x12')]);this['holdtime']=0x0;this[_0x63ca('0x17')]=0x0;this[_0x63ca('0x18')]=_0x4f7036['callback'];this[_0x63ca('0x19')]=_0x4f7036[_0x63ca('0x19')];this[_0x63ca('0x1a')]=_0x4f7036[_0x63ca('0x1a')];this[_0x63ca('0x1b')]=_0x4f7036[_0x63ca('0x1b')];this[_0x63ca('0x1c')]=_0x4f7036[_0x63ca('0x1c')];this[_0x63ca('0x1d')]=_0x4f7036[_0x63ca('0x1d')];this[_0x63ca('0x1e')]=_0x4f7036['UserId'];this[_0x63ca('0x1f')]=_0x4f7036[_0x63ca('0x1f')];this[_0x63ca('0x20')]=_0x4f7036[_0x63ca('0x20')];this['originatecalleridnum']=_0x4f7036['originatecalleridnum']||'';this[_0x63ca('0x21')]=_0x4f7036['originatecalleridname']||'';this[_0x63ca('0x22')]=_0x4f7036[_0x63ca('0x22')];this['statedesc']=_0x4f7036[_0x63ca('0x23')];}module[_0x63ca('0x24')]=History;
\ No newline at end of file
index 3c9d028..c3f3a55 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc13a=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xc13a,0xb8));var _0xac13=function(_0x1cdbc5,_0x219ca6){_0x1cdbc5=_0x1cdbc5-0x0;var _0x213288=_0xc13a[_0x1cdbc5];return _0x213288;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x407206,_0xd9d6da){this[_0xac13('0x0')]=_0x407206['scheduledat'];this[_0xac13('0x1')]=_0x407206['type'];this['campaigntype']=_0x407206[_0xac13('0x1')]==='outbound'?_0xac13('0x2'):_0x407206[_0xac13('0x1')];this[_0xac13('0x3')]=_0x407206[_0xac13('0x3')];this['countcongestionretry']=_0x407206[_0xac13('0x4')];this['countnoanswerretry']=_0x407206[_0xac13('0x5')];this[_0xac13('0x6')]=_0x407206[_0xac13('0x3')]+_0x407206[_0xac13('0x4')]+_0x407206[_0xac13('0x5')]+_0x407206[_0xac13('0x7')]+_0x407206[_0xac13('0x8')]+_0x407206[_0xac13('0x9')]+_0x407206[_0xac13('0xa')]+_0x407206[_0xac13('0xb')];this['countnosuchnumberretry']=_0x407206['countnosuchnumberretry'];this[_0xac13('0x8')]=_0x407206[_0xac13('0x8')];this[_0xac13('0x9')]=_0x407206['countabandonedretry'];this[_0xac13('0xa')]=_0x407206[_0xac13('0xa')];this[_0xac13('0xb')]=_0x407206['countagentrejectretry'];this[_0xac13('0xc')]=_0xd9d6da[_0xac13('0xc')];this[_0xac13('0xd')]=_0x407206[_0xac13('0xe')];this[_0xac13('0xf')]=_0x407206[_0xac13('0x10')];this['starttime']=_0x407206[_0xac13('0x11')];this[_0xac13('0x12')]=_0x407206[_0xac13('0x12')];this['droptime']=_0x407206[_0xac13('0x13')];this[_0xac13('0x14')]=_0x407206[_0xac13('0x14')];this['endtime']=this['droptime'];this[_0xac13('0x15')]=utils[_0xac13('0x16')](_0x407206['responsetime'],_0x407206[_0xac13('0x11')]);this[_0xac13('0x17')]=utils['getSeconds'](this[_0xac13('0x13')],_0x407206[_0xac13('0x12')]);this['talktime']=0x0;this[_0xac13('0x2')]=_0xd9d6da[_0xac13('0x2')];this[_0xac13('0x18')]=_0xd9d6da[_0xac13('0x19')];this['reason']=_0xd9d6da['reason'];this[_0xac13('0x1a')]=_0x407206[_0xac13('0x1a')];this[_0xac13('0x1b')]=_0x407206['callbackuniqueid'];this[_0xac13('0x1c')]=_0x407206['callbackat'];this['recallme']=_0x407206[_0xac13('0x1d')];this['ContactId']=_0x407206['ContactId'];this['ListId']=_0x407206[_0xac13('0x1e')];this['UserId']=_0x407206[_0xac13('0x1f')];this['VoiceQueueId']=_0x407206[_0xac13('0x20')];this['CampaignId']=_0x407206[_0xac13('0x21')];this[_0xac13('0x22')]=_0x407206[_0xac13('0x22')]||'';this['originatecalleridname']=_0x407206[_0xac13('0x23')]||'';this['agiafterat']=_0x407206[_0xac13('0x24')];this[_0xac13('0x25')]=_0x407206[_0xac13('0x25')];this[_0xac13('0x26')]=_0x407206[_0xac13('0x26')];}module['exports']=QueueCallerAbandon;
\ No newline at end of file
+var _0xedf1=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','responsetime','dropreason','endtime','droptime','getSeconds','starttime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x4f42c2,_0x50f054){var _0x2d978b=function(_0x357ea9){while(--_0x357ea9){_0x4f42c2['push'](_0x4f42c2['shift']());}};_0x2d978b(++_0x50f054);}(_0xedf1,0x1cf));var _0x1edf=function(_0x47247b,_0x155701){_0x47247b=_0x47247b-0x0;var _0x52c97e=_0xedf1[_0x47247b];return _0x52c97e;};'use strict';var utils=require(_0x1edf('0x0'));function QueueCallerAbandon(_0x510463,_0x50ceec){this[_0x1edf('0x1')]=_0x510463[_0x1edf('0x1')];this[_0x1edf('0x2')]=_0x510463[_0x1edf('0x2')];this[_0x1edf('0x3')]=_0x510463[_0x1edf('0x2')]===_0x1edf('0x4')?_0x1edf('0x5'):_0x510463[_0x1edf('0x2')];this[_0x1edf('0x6')]=_0x510463['countbusyretry'];this[_0x1edf('0x7')]=_0x510463[_0x1edf('0x7')];this[_0x1edf('0x8')]=_0x510463[_0x1edf('0x8')];this[_0x1edf('0x9')]=_0x510463['countbusyretry']+_0x510463[_0x1edf('0x7')]+_0x510463[_0x1edf('0x8')]+_0x510463[_0x1edf('0xa')]+_0x510463[_0x1edf('0xb')]+_0x510463['countabandonedretry']+_0x510463[_0x1edf('0xc')]+_0x510463[_0x1edf('0xd')];this[_0x1edf('0xa')]=_0x510463[_0x1edf('0xa')];this[_0x1edf('0xb')]=_0x510463[_0x1edf('0xb')];this[_0x1edf('0xe')]=_0x510463['countabandonedretry'];this[_0x1edf('0xc')]=_0x510463[_0x1edf('0xc')];this[_0x1edf('0xd')]=_0x510463[_0x1edf('0xd')];this[_0x1edf('0xf')]=_0x50ceec[_0x1edf('0xf')];this[_0x1edf('0x10')]=_0x510463['name'];this[_0x1edf('0x11')]=_0x510463[_0x1edf('0x12')];this['starttime']=_0x510463['starttime'];this['responsetime']=_0x510463[_0x1edf('0x13')];this['droptime']=_0x510463['droptime'];this['dropreason']=_0x510463[_0x1edf('0x14')];this[_0x1edf('0x15')]=this[_0x1edf('0x16')];this['ringtime']=utils[_0x1edf('0x17')](_0x510463['responsetime'],_0x510463[_0x1edf('0x18')]);this[_0x1edf('0x19')]=utils['getSeconds'](this['droptime'],_0x510463['responsetime']);this['talktime']=0x0;this['queue']=_0x50ceec[_0x1edf('0x5')];this[_0x1edf('0x1a')]=_0x50ceec[_0x1edf('0x1b')];this[_0x1edf('0x1c')]=_0x50ceec[_0x1edf('0x1c')];this[_0x1edf('0x1d')]=_0x510463[_0x1edf('0x1d')];this[_0x1edf('0x1e')]=_0x510463[_0x1edf('0x1e')];this[_0x1edf('0x1f')]=_0x510463['callbackat'];this[_0x1edf('0x20')]=_0x510463[_0x1edf('0x20')];this[_0x1edf('0x21')]=_0x510463[_0x1edf('0x21')];this[_0x1edf('0x22')]=_0x510463[_0x1edf('0x22')];this[_0x1edf('0x23')]=_0x510463['UserId'];this[_0x1edf('0x24')]=_0x510463[_0x1edf('0x24')];this[_0x1edf('0x25')]=_0x510463['CampaignId'];this['originatecalleridnum']=_0x510463[_0x1edf('0x26')]||'';this[_0x1edf('0x27')]=_0x510463[_0x1edf('0x27')]||'';this[_0x1edf('0x28')]=_0x510463[_0x1edf('0x28')];this['state']=_0x510463['state'];this['statedesc']=_0x510463[_0x1edf('0x29')];}module[_0x1edf('0x2a')]=QueueCallerAbandon;
\ No newline at end of file
index d6aa691..bb512a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x5b4987,_0x143366){var _0x27a93e=function(_0x193c89){while(--_0x193c89){_0x5b4987['push'](_0x5b4987['shift']());}};_0x27a93e(++_0x143366);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a544a,_0x73a217){_0x3a544a=_0x3a544a-0x0;var _0x342f1e=_0xb10b[_0x3a544a];return _0x342f1e;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory;
\ No newline at end of file
+var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x1e593f,_0xded5fd){var _0x57963c=function(_0xc1e0ea){while(--_0xc1e0ea){_0x1e593f['push'](_0x1e593f['shift']());}};_0x57963c(++_0xded5fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory;
\ No newline at end of file
index 78fb425..1342610 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d4e=['IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','dialMethod','dialActive','available','loggedIn','loggedInDb','talking','pTalking','waiting','originated','name','Trunk','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','error','decrementOriginate','length','checkContactEmpty','erlangb','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS'];(function(_0x4cd2a8,_0x120543){var _0x4894c4=function(_0x3bed37){while(--_0x3bed37){_0x4cd2a8['push'](_0x4cd2a8['shift']());}};_0x4894c4(++_0x120543);}(_0x5d4e,0xe8));var _0xe5d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5d4e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var moment=require(_0xe5d4('0x0'));var util=require(_0xe5d4('0x1'));var logger=require(_0xe5d4('0x2'))(_0xe5d4('0x3'));var timezones=require(_0xe5d4('0x4'))[_0xe5d4('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xe5d4('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xe5d4('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xe5d4('0x8'),'EMPTY_INTERVAL':_0xe5d4('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xe5d4('0xa'),'NO_AVAILABLE_CONTACTS':_0xe5d4('0xb'),'NULL_INTERVAL':_0xe5d4('0xc'),'OVERTIME_INTERVAL':_0xe5d4('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xe5d4('0xe'),'QUEUE_RECALL':_0xe5d4('0xf'),'RECALL_TIMEOUT':_0xe5d4('0x10'),'RUNNING':_0xe5d4('0x11'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xe5d4('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x167733){return _0x167733['dialMethod']===_0xe5d4('0x13');}exports[_0xe5d4('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x2c9803){return _0x2c9803[_0xe5d4('0x15')]===_0xe5d4('0x16');}exports[_0xe5d4('0x17')]=isIVRCampaign;function isOutboundQueue(_0x1701af){return _0x1701af[_0xe5d4('0x15')]===_0xe5d4('0x18');}exports[_0xe5d4('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x235905){return _0x235905['dialActive'];}exports[_0xe5d4('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x460123){return _0x460123[_0xe5d4('0x1b')];}exports[_0xe5d4('0x1c')]=isIVRCampaignActive;function getSeconds(_0x11bd1b,_0x2f52d2){var _0x1b2968=moment(_0x11bd1b)['milliseconds'](0x0);var _0x2d5ebf=moment(_0x2f52d2)[_0xe5d4('0x1d')](0x0);return _0x1b2968['diff'](_0x2d5ebf,_0xe5d4('0x1e'));}exports[_0xe5d4('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x11b73d,_0x1d2ac3){var _0x225695=![];var _0x9e4211=_0x11b73d[_0xe5d4('0x20')]!==_0x1d2ac3[_0xe5d4('0x20')]||_0x11b73d[_0xe5d4('0x21')]!==_0x1d2ac3[_0xe5d4('0x21')]||_0x11b73d['message']!==_0x1d2ac3['message'];var _0x5853d9=_0x11b73d['available']!==_0x1d2ac3[_0xe5d4('0x22')]||_0x11b73d['loggedIn']!==_0x1d2ac3[_0xe5d4('0x23')]||_0x11b73d['loggedInDb']!==_0x1d2ac3[_0xe5d4('0x24')]||_0x11b73d['paused']!==_0x1d2ac3['paused']||_0x11b73d[_0xe5d4('0x25')]!==_0x1d2ac3[_0xe5d4('0x25')]||_0x11b73d[_0xe5d4('0x26')]!==_0x1d2ac3[_0xe5d4('0x26')]||_0x11b73d[_0xe5d4('0x27')]!==_0x1d2ac3[_0xe5d4('0x27')]||_0x11b73d['inUse']!==_0x1d2ac3['inUse']||_0x11b73d[_0xe5d4('0x28')]!==_0x1d2ac3[_0xe5d4('0x28')];if(_0x11b73d['Trunk']&&_0x1d2ac3['Trunk']){_0x225695=_0x11b73d['Trunk'][_0xe5d4('0x29')]!==_0x1d2ac3[_0xe5d4('0x2a')][_0xe5d4('0x29')]||_0x11b73d[_0xe5d4('0x2a')][_0xe5d4('0x1b')]!==_0x1d2ac3[_0xe5d4('0x2a')][_0xe5d4('0x1b')];}return _0x9e4211||_0x5853d9||_0x225695;}exports[_0xe5d4('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x311b52){var _0x5bf577=null;var _0x55b53f=_0x311b52[_0xe5d4('0x2c')];if(_['isNil'](_0x311b52[_0xe5d4('0x2d')])||_[_0xe5d4('0x2e')](_0x311b52[_0xe5d4('0x2f')])||_[_0xe5d4('0x2e')](_0x311b52[_0xe5d4('0x2f')][_0xe5d4('0x30')])){_0x5bf577=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xe5d4('0x31')](_0x311b52[_0xe5d4('0x2d')])||_['isEmpty'](_0x311b52['Interval']['Intervals'])){_0x5bf577=CAMPAIGN_STATUS[_0xe5d4('0x32')];}else if(_0x55b53f&&!timezones[_0x55b53f]){_0x5bf577=CAMPAIGN_STATUS[_0xe5d4('0x33')];}return _0x5bf577;}function checkAnyValidTrunk(_0x34e465,_0x146736){var _0x53fa17=null;var _0x4d3455='SIP/';var _0x1940c8=[_0xe5d4('0x34'),_0xe5d4('0x35')];var _0x1b9493=!![];if(_0x34e465[_0xe5d4('0x2a')]&&_0x34e465[_0xe5d4('0x2a')][_0xe5d4('0x1b')]){_0x4d3455+=_0x34e465[_0xe5d4('0x2a')][_0xe5d4('0x29')];_0x53fa17=_0x146736[_0x4d3455];_0x1b9493=_0x1940c8['includes'](_0x53fa17[_0xe5d4('0x36')]);}else if(_0x34e465['TrunkBackup']&&_0x34e465[_0xe5d4('0x37')][_0xe5d4('0x1b')]){_0x4d3455+=_0x34e465[_0xe5d4('0x37')][_0xe5d4('0x29')];_0x53fa17=_0x146736[_0x4d3455];_0x1b9493=_0x1940c8[_0xe5d4('0x38')](_0x53fa17[_0xe5d4('0x36')]);}return _0x1b9493;}function getQueueCampaignStatusMessage(_0x50f972,_0x2e32b8){var _0xd9d09a=CAMPAIGN_STATUS[_0xe5d4('0x6')];var _0x37cc3e=isPreviewCampaign(_0x50f972);if(!isQueueCampaignActive(_0x50f972)){if(_0x37cc3e){_0xd9d09a=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x50f972[_0xe5d4('0x28')]===0x0&&_0x50f972[_0xe5d4('0x25')]===0x0&&_0x50f972[_0xe5d4('0x27')]===0x0&&(_0x50f972[_0xe5d4('0x26')]||0x0)===0x0){_0xd9d09a=CAMPAIGN_STATUS[_0xe5d4('0x39')];}else{_0xd9d09a=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x50f972['loggedIn']===0x0){_0xd9d09a=CAMPAIGN_STATUS[_0xe5d4('0x3a')];}else if(!checkAnyValidTrunk(_0x50f972,_0x2e32b8)){_0xd9d09a=CAMPAIGN_STATUS[_0xe5d4('0x3b')];}else if(!isPreviewCampaign(_0x50f972)){var _0x3f11c1=checkAnyValidQueueCampaignInterval(_0x50f972);if(_0x3f11c1){_0xd9d09a=_0x3f11c1;}}return _0xd9d09a;}exports[_0xe5d4('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x16c65e){var _0x812937=CAMPAIGN_STATUS[_0xe5d4('0x3d')];if(_0x16c65e[_0xe5d4('0x28')]===0x0&&_0x16c65e[_0xe5d4('0x25')]===0x0&&_0x16c65e['waiting']===0x0&&(_0x16c65e[_0xe5d4('0x26')]||0x0)===0x0){_0x812937=CAMPAIGN_STATUS['INACTIVE'];}return _0x812937;}exports[_0xe5d4('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x53c89e){var _0x28a4c0=_0x53c89e[_0xe5d4('0x3f')](/"(.*?)"/);return _0x28a4c0?_0x28a4c0[0x1]:_0x53c89e;}exports[_0xe5d4('0x40')]=extractCalleridName;function getCallerId(_0x24ba32,_0x167bdb,_0x196e72){if(!_[_0xe5d4('0x41')](_0x196e72)&&typeof _0x196e72===_0xe5d4('0x42')&&!_['isEmpty'](_0x196e72)){if(!_[_0xe5d4('0x41')](_0x167bdb)&&typeof _0x167bdb===_0xe5d4('0x42')&&!_[_0xe5d4('0x31')](_0x167bdb)){return util[_0xe5d4('0x43')](_0xe5d4('0x44'),_0x167bdb,_0x196e72);}return util['format']('\x22%s\x22\x20<%s>',_0x196e72,_0x196e72);}if(!_['isUndefined'](_0x24ba32)&&typeof _0x24ba32===_0xe5d4('0x42')&&!_[_0xe5d4('0x31')](_0x24ba32)){return _0x24ba32;}return _0xe5d4('0x45');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0xfc89de,_0x467e16){var _0x56a29b;var _0x705620;var _0x251f50;if(_0x467e16<=0x0){_0x467e16=0x1;}_0x56a29b=new RegExp(_0xe5d4('0x46')+_0x467e16+'}$');_0x705620=Math[_0xe5d4('0x47')](0xa,_0x467e16-0x1);_0x251f50=Math['pow'](0xa,_0x467e16)-0x1;return util[_0xe5d4('0x43')]('%s',_[_0xe5d4('0x48')](_0xfc89de,_0x56a29b,_[_0xe5d4('0x49')](_0x705620,_0x251f50)[_0xe5d4('0x4a')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x1b4d07){if(_0x1b4d07['originated']&&_0x1b4d07[_0xe5d4('0x28')]>0x0){_0x1b4d07[_0xe5d4('0x28')]-=0x1;}else{logger[_0xe5d4('0x4b')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xe5d4('0x4c')]=decrementOriginate;function checkContactEmpty(_0x6332c8){return _0x6332c8&&_0x6332c8[_0xe5d4('0x4d')]>0x0;}exports[_0xe5d4('0x4e')]=checkContactEmpty;function erlangb(_0x25a8c1,_0x2b9a33){if(_0x2b9a33===0x0){return 0x0;}var _0x7ea3a7=0x1;for(var _0x41cfcf=0x1;_0x41cfcf<=_0x2b9a33;_0x41cfcf+=0x1){_0x7ea3a7=0x1+_0x7ea3a7*_0x41cfcf/_0x25a8c1;}return 0x1/_0x7ea3a7;}exports[_0xe5d4('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0xca572d,_0x2af85a,_0x224038){if(_0x2af85a>_0x224038){for(var _0x349c52=0x0;_0x349c52<_0x2af85a-_0x224038;_0x349c52+=0x1){decrementOriginate(_0xca572d);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;
\ No newline at end of file
+var _0xf705=['originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','status','TrunkBackup','includes','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','isIVRCampaign','outbound','active','milliseconds','seconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf705,0x17c));var _0x5f70=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf705[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var moment=require(_0x5f70('0x0'));var util=require(_0x5f70('0x1'));var logger=require(_0x5f70('0x2'))(_0x5f70('0x3'));var timezones=require(_0x5f70('0x4'))[_0x5f70('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x5f70('0x6'),'CONTACTS_RESCHEDULED':_0x5f70('0x7'),'DEACTIVATED':_0x5f70('0x8'),'DISACTIVED':_0x5f70('0x9'),'EMPTY_INTERVAL':_0x5f70('0xa'),'INACTIVE':_0x5f70('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x5f70('0xc'),'NULL_INTERVAL':_0x5f70('0xd'),'OVERTIME_INTERVAL':_0x5f70('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x5f70('0xf'),'QUEUE_RECALL':_0x5f70('0x10'),'RECALL_TIMEOUT':_0x5f70('0x11'),'RUNNING':_0x5f70('0x12'),'UNKNOWN_TIMEZONE':_0x5f70('0x13'),'UNREACHABLE_TRUNK':_0x5f70('0x14')};exports[_0x5f70('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x212d53){return _0x212d53[_0x5f70('0x16')]==='preview';}exports[_0x5f70('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x5380b2){return _0x5380b2[_0x5f70('0x18')]==='ivr';}exports[_0x5f70('0x19')]=isIVRCampaign;function isOutboundQueue(_0x3a87fd){return _0x3a87fd[_0x5f70('0x18')]===_0x5f70('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x27d173){return _0x27d173['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x456b93){return _0x456b93[_0x5f70('0x1b')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x5a9c5b,_0x36e82f){var _0x1fb216=moment(_0x5a9c5b)[_0x5f70('0x1c')](0x0);var _0x5cef1e=moment(_0x36e82f)['milliseconds'](0x0);return _0x1fb216['diff'](_0x5cef1e,_0x5f70('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x444a86,_0xd90a5a){var _0x9ad34f=![];var _0x3afee3=_0x444a86['dialMethod']!==_0xd90a5a[_0x5f70('0x16')]||_0x444a86[_0x5f70('0x1e')]!==_0xd90a5a[_0x5f70('0x1e')]||_0x444a86[_0x5f70('0x1f')]!==_0xd90a5a[_0x5f70('0x1f')];var _0x1c4c77=_0x444a86['available']!==_0xd90a5a[_0x5f70('0x20')]||_0x444a86[_0x5f70('0x21')]!==_0xd90a5a['loggedIn']||_0x444a86['loggedInDb']!==_0xd90a5a[_0x5f70('0x22')]||_0x444a86[_0x5f70('0x23')]!==_0xd90a5a['paused']||_0x444a86[_0x5f70('0x24')]!==_0xd90a5a['talking']||_0x444a86[_0x5f70('0x25')]!==_0xd90a5a[_0x5f70('0x25')]||_0x444a86[_0x5f70('0x26')]!==_0xd90a5a[_0x5f70('0x26')]||_0x444a86['inUse']!==_0xd90a5a[_0x5f70('0x27')]||_0x444a86[_0x5f70('0x28')]!==_0xd90a5a[_0x5f70('0x28')];if(_0x444a86[_0x5f70('0x29')]&&_0xd90a5a[_0x5f70('0x29')]){_0x9ad34f=_0x444a86['Trunk'][_0x5f70('0x2a')]!==_0xd90a5a[_0x5f70('0x29')][_0x5f70('0x2a')]||_0x444a86[_0x5f70('0x29')]['active']!==_0xd90a5a[_0x5f70('0x29')][_0x5f70('0x1b')];}return _0x3afee3||_0x1c4c77||_0x9ad34f;}exports[_0x5f70('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x52f206){var _0xcce38c=null;var _0x3ee8aa=_0x52f206[_0x5f70('0x2c')];if(_[_0x5f70('0x2d')](_0x52f206[_0x5f70('0x2e')])||_[_0x5f70('0x2d')](_0x52f206[_0x5f70('0x2f')])||_[_0x5f70('0x2d')](_0x52f206['Interval']['Intervals'])){_0xcce38c=CAMPAIGN_STATUS[_0x5f70('0x30')];}else if(_[_0x5f70('0x31')](_0x52f206[_0x5f70('0x2e')])||_[_0x5f70('0x31')](_0x52f206[_0x5f70('0x2f')][_0x5f70('0x32')])){_0xcce38c=CAMPAIGN_STATUS[_0x5f70('0x33')];}else if(_0x3ee8aa&&!timezones[_0x3ee8aa]){_0xcce38c=CAMPAIGN_STATUS[_0x5f70('0x34')];}return _0xcce38c;}function checkAnyValidTrunk(_0x40e41b,_0x3c3cbd){var _0x2bd516=null;var _0x4d441c=_0x5f70('0x35');var _0x2d3b50=['reachable',_0x5f70('0x36')];var _0x331b0d=!![];if(_0x40e41b[_0x5f70('0x29')]&&_0x40e41b[_0x5f70('0x29')][_0x5f70('0x1b')]){_0x4d441c+=_0x40e41b[_0x5f70('0x29')][_0x5f70('0x2a')];_0x2bd516=_0x3c3cbd[_0x4d441c];_0x331b0d=_0x2d3b50['includes'](_0x2bd516[_0x5f70('0x37')]);}else if(_0x40e41b['TrunkBackup']&&_0x40e41b[_0x5f70('0x38')]['active']){_0x4d441c+=_0x40e41b[_0x5f70('0x38')][_0x5f70('0x2a')];_0x2bd516=_0x3c3cbd[_0x4d441c];_0x331b0d=_0x2d3b50[_0x5f70('0x39')](_0x2bd516[_0x5f70('0x37')]);}return _0x331b0d;}function getQueueCampaignStatusMessage(_0x1a0141,_0x304db7){var _0x25d627=CAMPAIGN_STATUS[_0x5f70('0x3a')];var _0x403d5c=isPreviewCampaign(_0x1a0141);if(!isQueueCampaignActive(_0x1a0141)){if(_0x403d5c){_0x25d627=CAMPAIGN_STATUS[_0x5f70('0x3b')];}else{if(_0x1a0141[_0x5f70('0x28')]===0x0&&_0x1a0141[_0x5f70('0x24')]===0x0&&_0x1a0141[_0x5f70('0x26')]===0x0&&(_0x1a0141[_0x5f70('0x25')]||0x0)===0x0){_0x25d627=CAMPAIGN_STATUS[_0x5f70('0x3b')];}else{_0x25d627=CAMPAIGN_STATUS[_0x5f70('0x3c')];}}}else if(_0x1a0141[_0x5f70('0x21')]===0x0){_0x25d627=CAMPAIGN_STATUS[_0x5f70('0x3d')];}else if(!checkAnyValidTrunk(_0x1a0141,_0x304db7)){_0x25d627=CAMPAIGN_STATUS[_0x5f70('0x3e')];}else if(!isPreviewCampaign(_0x1a0141)){var _0x3c39a5=checkAnyValidQueueCampaignInterval(_0x1a0141);if(_0x3c39a5){_0x25d627=_0x3c39a5;}}return _0x25d627;}exports[_0x5f70('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x47fca4){var _0x457d79=CAMPAIGN_STATUS[_0x5f70('0x3c')];if(_0x47fca4[_0x5f70('0x28')]===0x0&&_0x47fca4[_0x5f70('0x24')]===0x0&&_0x47fca4[_0x5f70('0x26')]===0x0&&(_0x47fca4[_0x5f70('0x25')]||0x0)===0x0){_0x457d79=CAMPAIGN_STATUS[_0x5f70('0x3b')];}return _0x457d79;}exports[_0x5f70('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x406145){var _0x12fe4a=_0x406145[_0x5f70('0x41')](/"(.*?)"/);return _0x12fe4a?_0x12fe4a[0x1]:_0x406145;}exports[_0x5f70('0x42')]=extractCalleridName;function getCallerId(_0x51b1da,_0x2f6964,_0x2cc41a){if(!_[_0x5f70('0x43')](_0x2cc41a)&&typeof _0x2cc41a==='string'&&!_[_0x5f70('0x31')](_0x2cc41a)){if(!_[_0x5f70('0x43')](_0x2f6964)&&typeof _0x2f6964===_0x5f70('0x44')&&!_[_0x5f70('0x31')](_0x2f6964)){return util[_0x5f70('0x45')](_0x5f70('0x46'),_0x2f6964,_0x2cc41a);}return util['format'](_0x5f70('0x46'),_0x2cc41a,_0x2cc41a);}if(!_['isUndefined'](_0x51b1da)&&typeof _0x51b1da===_0x5f70('0x44')&&!_[_0x5f70('0x31')](_0x51b1da)){return _0x51b1da;}return _0x5f70('0x47');}exports[_0x5f70('0x48')]=getCallerId;function getCallerIdRandom(_0x396628,_0x1ad3bb){var _0x3b8060;var _0x50f489;var _0x4087fa;if(_0x1ad3bb<=0x0){_0x1ad3bb=0x1;}_0x3b8060=new RegExp(_0x5f70('0x49')+_0x1ad3bb+'}$');_0x50f489=Math['pow'](0xa,_0x1ad3bb-0x1);_0x4087fa=Math[_0x5f70('0x4a')](0xa,_0x1ad3bb)-0x1;return util[_0x5f70('0x45')]('%s',_[_0x5f70('0x4b')](_0x396628,_0x3b8060,_[_0x5f70('0x4c')](_0x50f489,_0x4087fa)[_0x5f70('0x4d')]()));}exports[_0x5f70('0x4e')]=getCallerIdRandom;function decrementOriginate(_0xc4f784){if(_0xc4f784[_0x5f70('0x28')]&&_0xc4f784[_0x5f70('0x28')]>0x0){_0xc4f784['originated']-=0x1;}else{logger[_0x5f70('0x4f')](_0x5f70('0x50'));}}exports[_0x5f70('0x51')]=decrementOriginate;function checkContactEmpty(_0x43958e){return _0x43958e&&_0x43958e[_0x5f70('0x52')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x461f04,_0x22d4c0){if(_0x22d4c0===0x0){return 0x0;}var _0x4029d0=0x1;for(var _0x56a9ce=0x1;_0x56a9ce<=_0x22d4c0;_0x56a9ce+=0x1){_0x4029d0=0x1+_0x4029d0*_0x56a9ce/_0x461f04;}return 0x1/_0x4029d0;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x399219,_0x1cbea7,_0x1383f4){if(_0x1cbea7>_0x1383f4){for(var _0x2bb50e=0x0;_0x2bb50e<_0x1cbea7-_0x1383f4;_0x2bb50e+=0x1){decrementOriginate(_0x399219);}}}exports[_0x5f70('0x53')]=checkContactLowerLimitOriginate;
\ No newline at end of file
index 939ae86..87956aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x767c36,_0x489986){var _0x35d44e=function(_0x1c92a1){while(--_0x1c92a1){_0x767c36['push'](_0x767c36['shift']());}};_0x35d44e(++_0x489986);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action;
\ No newline at end of file
+var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x151aa8,_0x569144){var _0x4242e3=function(_0x4e37d2){while(--_0x4e37d2){_0x151aa8['push'](_0x151aa8['shift']());}};_0x4242e3(++_0x569144);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action;
\ No newline at end of file
index c431ea0..c393d3d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe17e=['name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','fax','catch','error','\x20notify\x20','\x20receiveFax\x20','merge','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel'];(function(_0x242363,_0x18befe){var _0x7c321d=function(_0x3c428d){while(--_0x3c428d){_0x242363['push'](_0x242363['shift']());}};_0x7c321d(++_0x18befe);}(_0xe17e,0xc9));var _0xee17=function(_0x45fc39,_0x5117c6){_0x45fc39=_0x45fc39-0x0;var _0x3fc39d=_0xe17e[_0x45fc39];return _0x3fc39d;};'use strict';var util=require(_0xee17('0x0'));var _=require(_0xee17('0x1'));var BPromise=require(_0xee17('0x2'));var uuid=require('uuid');var moment=require(_0xee17('0x3'));var path=require(_0xee17('0x4'));var tiff2pdf=require(_0xee17('0x5'));var gs=require(_0xee17('0x6'));var logger=require(_0xee17('0x7'))('fax');var ami=require(_0xee17('0x8'));var rpcDb=require(_0xee17('0x9'));var Channel=require(_0xee17('0xa'));var ut=require(_0xee17('0xb'));var Action=require(_0xee17('0xc'));var faxAccount=require(_0xee17('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x1aaefd){this[_0xee17('0xe')]={};this[_0xee17('0xf')]=_0x1aaefd[_0xee17('0xf')];this[_0xee17('0x10')]=_0x1aaefd[_0xee17('0x10')];this[_0xee17('0x11')]={};ami['on']('newchannel',this[_0xee17('0x12')]['bind'](this));ami['on'](_0xee17('0x13'),this[_0xee17('0x14')][_0xee17('0x15')](this));ami['on'](_0xee17('0x16'),this[_0xee17('0x17')]['bind'](this));ami['on']('newexten',this[_0xee17('0x18')][_0xee17('0x15')](this));ami['on']('faxstatus',this[_0xee17('0x19')]['bind'](this));ami['on'](_0xee17('0x1a'),this[_0xee17('0x1b')][_0xee17('0x15')](this));ami['on'](_0xee17('0x1c'),this[_0xee17('0x1d')][_0xee17('0x15')](this));ami['on'](_0xee17('0x1e'),this[_0xee17('0x1f')][_0xee17('0x15')](this));}Fax['prototype'][_0xee17('0x12')]=function(_0x53ee8d){if(_0x53ee8d[_0xee17('0x20')]===_0xee17('0x21')){for(var _0x2b78ea in this[_0xee17('0xf')]){if(this['faxAccounts'][_0xee17('0x22')](_0x2b78ea)){if(_0x53ee8d[_0xee17('0x23')]===this['faxAccounts'][_0x2b78ea][_0xee17('0x24')]){this[_0xee17('0xe')][_0x53ee8d[_0xee17('0x25')]]={};this[_0xee17('0xe')][_0x53ee8d['uniqueid']][_0xee17('0x26')]=_0x53ee8d[_0xee17('0x26')];this[_0xee17('0xe')][_0x53ee8d[_0xee17('0x25')]]['id']=this['faxAccounts'][_0x2b78ea]['id'];this[_0xee17('0xe')][_0x53ee8d['uniqueid']]['name']=this['faxAccounts'][_0x2b78ea][_0xee17('0x27')];logger[_0xee17('0x28')](_0x53ee8d[_0xee17('0x25')],_0xee17('0x29'));}}}}if(this[_0xee17('0x11')][_0x53ee8d[_0xee17('0x25')]]){this[_0xee17('0xe')][_0x53ee8d[_0xee17('0x25')]]={};this['channels'][_0x53ee8d['uniqueid']]['channel']=_0x53ee8d[_0xee17('0x26')];logger['info'](_0x53ee8d[_0xee17('0x25')],_0xee17('0x29'));}};Fax[_0xee17('0x2a')][_0xee17('0x14')]=function(_0x4ac538){if(this[_0xee17('0xe')][_0x4ac538[_0xee17('0x25')]]){for(var _0x2b9892 in _0x4ac538[_0xee17('0x2b')]){if(_0x4ac538[_0xee17('0x2b')]['hasOwnProperty'](_0x2b9892)){this[_0xee17('0xe')][_0x4ac538[_0xee17('0x25')]][_0x2b9892]=_0x4ac538['value'];}}}};Fax[_0xee17('0x2a')][_0xee17('0x17')]=function(_0x310975){if(this['channels'][_0x310975[_0xee17('0x25')]]){this['channels'][_0x310975[_0xee17('0x25')]]['channelstate']=_0x310975[_0xee17('0x2c')];this[_0xee17('0xe')][_0x310975[_0xee17('0x25')]][_0xee17('0x2d')]=_0x310975['channelstatedesc'];}};Fax[_0xee17('0x2a')][_0xee17('0x18')]=function(_0x5be0a0){if(this[_0xee17('0xe')][_0x5be0a0[_0xee17('0x25')]]){for(var _0x154ccc in _0x5be0a0[_0xee17('0x2b')]){if(_0x5be0a0['variable'][_0xee17('0x22')](_0x154ccc)){this['channels'][_0x5be0a0[_0xee17('0x25')]][_0x154ccc]=_0x5be0a0[_0xee17('0x2e')];}}}};Fax[_0xee17('0x2a')]['syncFaxStatus']=function(_0x1c5e35){if(this[_0xee17('0xe')][_0x1c5e35[_0xee17('0x25')]]){this[_0xee17('0xe')][_0x1c5e35[_0xee17('0x25')]][_0xee17('0x2f')]=_0x1c5e35[_0xee17('0x2f')];this['channels'][_0x1c5e35['uniqueid']][_0xee17('0x30')]=_0x1c5e35[_0xee17('0x30')];this[_0xee17('0xe')][_0x1c5e35[_0xee17('0x25')]][_0xee17('0x24')]=_0x1c5e35[_0xee17('0x24')];this[_0xee17('0xe')][_0x1c5e35['uniqueid']][_0xee17('0x31')]=_0x1c5e35[_0xee17('0x31')];logger[_0xee17('0x28')](_0x1c5e35[_0xee17('0x25')],_0xee17('0x32'));}};Fax['prototype'][_0xee17('0x1b')]=function(_0x453303){var _0x22a790=this;if(this[_0xee17('0xe')][_0x453303['uniqueid']]){var _0x4f60c8=this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]]['id'];this[_0xee17('0xe')][_0x453303['uniqueid']][_0xee17('0x33')]=_0x453303[_0xee17('0x33')];this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]][_0xee17('0x34')]=_0x453303[_0xee17('0x34')];this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]]['localstationid']=_0x453303[_0xee17('0x24')];this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]][_0xee17('0x35')]=_0x453303['resolution'];this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]][_0xee17('0x36')]=_0x453303[_0xee17('0x36')];this['channels'][_0x453303[_0xee17('0x25')]][_0xee17('0x31')]=_0x453303[_0xee17('0x31')];this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]]['calleridnum']=_0x453303[_0xee17('0x37')];if(this[_0xee17('0xe')][_0x453303[_0xee17('0x25')]][_0xee17('0x34')]>0x0){tiff2pdf(_0x453303[_0xee17('0x31')],_0xee17('0x38'),function(_0x4d4bd0){logger[_0xee17('0x28')](_0x453303[_0xee17('0x25')],_0xee17('0x39'),_0x4d4bd0[_0xee17('0x3a')]);attachment['create']({'name':path[_0xee17('0x3b')](_0x453303[_0xee17('0x31')])[_0xee17('0x27')],'basename':path['parse'](_0x453303['filename'])[_0xee17('0x27')]+_0xee17('0x3c'),'type':_0xee17('0x3d')})[_0xee17('0x3e')](function(_0x42a947){faxAccount['notify'](_0x4f60c8,{'from':_0x453303['calleridnum'],'mapKey':_0xee17('0x3f'),'body':path['parse'](_0x453303['filename'])[_0xee17('0x27')]+_0xee17('0x3c'),'AttachmentId':_0x42a947['id']})[_0xee17('0x40')](function(_0x442de8){logger[_0xee17('0x41')](_0x453303[_0xee17('0x25')],_0xee17('0x42'),JSON['stringify'](_0x442de8));});})[_0xee17('0x40')](function(_0x56e89c){logger[_0xee17('0x41')](_0x453303[_0xee17('0x25')],_0xee17('0x43'),JSON['stringify'](_0x56e89c));});});}logger[_0xee17('0x28')](_0x453303[_0xee17('0x25')],'\x20receiveFax\x20');}};Fax[_0xee17('0x2a')]['syncOriginateResponse']=function(_0x1a5158){if(this[_0xee17('0x11')][_0x1a5158[_0xee17('0x25')]]){_[_0xee17('0x44')](this[_0xee17('0xe')][_0x1a5158[_0xee17('0x25')]],_['pick'](_0x1a5158,[_0xee17('0x45'),_0xee17('0x46')]));}};function updateStatus(_0x5aad41){if(_0x5aad41['AttachmentId']){faxMessage['update'](_0x5aad41[_0xee17('0x47')],{'failMessage':_0xee17('0x48')})[_0xee17('0x3e')](function(_0x4406ce){ut['logger'](_0xee17('0x49'),_0x4406ce);})[_0xee17('0x40')](function(_0xbd1861){ut[_0xee17('0x4a')](_0xee17('0x4b'),_0xbd1861);});}else{ut[_0xee17('0x4a')](_0xee17('0x4c'));}}Fax[_0xee17('0x2a')]['updateStatus']=function(_0x34b150,_0x283f81,_0xb6661c){var _0x250b0b=this;var _0x525baa={};if(_0x283f81){_0x525baa={'read':_0x283f81};}else{_0x525baa={'failMessage':_0xb6661c};}if(this[_0xee17('0x11')][_0x34b150][_0xee17('0x47')]){faxMessage[_0xee17('0x4d')](this[_0xee17('0x11')][_0x34b150][_0xee17('0x47')],_0x525baa)[_0xee17('0x3e')](function(_0x141f34){ut[_0xee17('0x4a')]('[Fax][Message][Updated]',_0x141f34);})['catch'](function(_0x3a7ad2){ut[_0xee17('0x4a')]('[Fax][Message][NoUpdate1]',_0x3a7ad2);})[_0xee17('0x4e')](function(){delete _0x250b0b[_0xee17('0xe')][_0x34b150];delete _0x250b0b['actions'][_0x34b150];});}else{ut[_0xee17('0x4a')](_0xee17('0x4f'));delete this[_0xee17('0xe')][_0x34b150];delete this['actions'][_0x34b150];}};Fax['prototype'][_0xee17('0x1d')]=function(_0x584e22){var _0x211121=this;if(this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]]){if(this[_0xee17('0x11')][_0x584e22[_0xee17('0x25')]]){this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]]['id']=this[_0xee17('0x11')][_0x584e22['uniqueid']]['id'];this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]]['name']=this[_0xee17('0x11')][_0x584e22[_0xee17('0x25')]][_0xee17('0x27')];}logger[_0xee17('0x28')](_0x584e22[_0xee17('0x25')],this[_0xee17('0x11')][_0x584e22[_0xee17('0x25')]]?_0xee17('0x50'):_0xee17('0x51'),JSON[_0xee17('0x52')](this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]]));if(this[_0xee17('0x11')][_0x584e22[_0xee17('0x25')]]){if(this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]]['faxpages']>0x0&&this[_0xee17('0xe')][_0x584e22['uniqueid']][_0xee17('0x53')]===_0xee17('0x54')){this['updateStatus'](_0x584e22[_0xee17('0x25')],!![]);}else{this[_0xee17('0x55')](_0x584e22['uniqueid'],![],this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]][_0xee17('0x56')]?_0xee17('0x57')+this[_0xee17('0xe')][_0x584e22[_0xee17('0x25')]][_0xee17('0x56')]:_0xee17('0x58'));}}}};Fax['prototype'][_0xee17('0x59')]=function(_0x1687a5){var _0x32b2da=this;return new BPromise(function(_0x1ff126,_0x36d8a5){_0x32b2da['execOriginate'](_0x1687a5,_0x32b2da[_0xee17('0xf')][_0x1687a5[_0xee17('0x5a')]])[_0xee17('0x3e')](function(_0x4f2cd4){ut[_0xee17('0x4a')](_0xee17('0x5b'),_0x4f2cd4);_0x1ff126(ut[_0xee17('0x3a')](_0xee17('0x5c')));})[_0xee17('0x40')](function(_0x103a99){ut['logger'](_0xee17('0x5d'),_0x103a99);updateStatus(_0x1687a5);_0x36d8a5(ut['message'](_0xee17('0x5e')));});});};Fax[_0xee17('0x2a')]['checkAfterSend']=function(_0x437ca0){var _0x42d200=this;return new BPromise(function(_0x3fe211,_0x1a3f1f){var _0x2f8d37=_0x42d200[_0xee17('0x5f')](_0x42d200[_0xee17('0xf')][_0x437ca0[_0xee17('0x5a')]][_0xee17('0x60')],_0x437ca0);if(_0x2f8d37[_0xee17('0x61')]){_0x3fe211(ut[_0xee17('0x3a')](_0xee17('0x62')));}else{_0x1a3f1f(ut[_0xee17('0x3a')](_0x2f8d37[_0xee17('0x3a')]));}});};function originate(_0x5eef6f,_0x4b12a6,_0x38eac2){return new BPromise(function(_0x5d4f16,_0x5304e5){if(_0x38eac2){var _0x157b41=util[_0xee17('0x63')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xee17('0x3b')](_0x5eef6f[_0xee17('0x4')])['name'],_0x5eef6f[_0xee17('0x4')]);gs['execute'](_0x157b41)[_0xee17('0x3e')](function(){_0x5eef6f['path']=util[_0xee17('0x63')](_0xee17('0x64'),path['parse'](_0x5eef6f[_0xee17('0x4')])[_0xee17('0x65')],path[_0xee17('0x3b')](_0x5eef6f[_0xee17('0x4')])[_0xee17('0x27')]);_0x4b12a6[_0xee17('0x66')]=_0x5eef6f[_0xee17('0x4')];ut['logger'](_0xee17('0x67'),'');ami[_0xee17('0x68')](ut[_0xee17('0x69')](_0x5eef6f,_0x4b12a6))[_0xee17('0x3e')](function(_0x58c363){_0x5d4f16(_0x58c363);})['catch'](function(_0x106eaf){_0x5304e5(_0x106eaf);});})[_0xee17('0x40')](function(_0x3b9311){_0x5304e5(_0x3b9311);});}else{ami['Action'](ut[_0xee17('0x69')](_0x5eef6f,_0x4b12a6))['then'](function(_0xcc78b){_0x5d4f16(_0xcc78b);})[_0xee17('0x40')](function(_0x20355e){_0x5304e5(_0x20355e);});}});}Fax[_0xee17('0x2a')][_0xee17('0x6a')]=function(_0x209168,_0x3c3fd6){var _0x2b6d9d=this;return new BPromise(function(_0x215759,_0x2720ec){var _0x4ba476=uuid['v4']();var _0x2dc4a2=ut[_0xee17('0x6b')](_0x209168,_0x3c3fd6);_0x2b6d9d[_0xee17('0x11')][_0x4ba476]=new Action(_0x4ba476,_0x3c3fd6,_0x209168);var _0x3092e8=_0x2b6d9d[_0xee17('0x11')][_0x4ba476];if(path['parse'](_0x209168[_0xee17('0x4')])['ext']==='.pdf'){originate(_0x3092e8,_0x2dc4a2,!![])['then'](function(_0x4ee607){_0x215759(_0x4ee607);})[_0xee17('0x40')](function(_0x13e9f3){_0x2720ec(_0x13e9f3);});}else{originate(_0x3092e8,_0x2dc4a2,![])[_0xee17('0x3e')](function(_0x4ef779){_0x215759(_0x4ef779);})[_0xee17('0x40')](function(_0x3e964a){_0x2720ec(_0x3e964a);});}});};Fax[_0xee17('0x2a')][_0xee17('0x6c')]=function(_0x2a5d76){return!_[_0xee17('0x6d')](_0x2a5d76)&&!_[_0xee17('0x6d')](_0x2a5d76['name'])&&!_[_0xee17('0x6d')](_0x2a5d76[_0xee17('0x6e')])&&_0x2a5d76['active']&&!_[_0xee17('0x6d')](this[_0xee17('0x10')][util[_0xee17('0x63')](_0xee17('0x6f'),_0x2a5d76[_0xee17('0x27')])])&&!_[_0xee17('0x6d')](this[_0xee17('0x10')][util[_0xee17('0x63')]('SIP/%s',_0x2a5d76[_0xee17('0x27')])][_0xee17('0x30')])&&(this['trunks'][util[_0xee17('0x63')](_0xee17('0x6f'),_0x2a5d76[_0xee17('0x27')])]['status']===_0xee17('0x70')||this[_0xee17('0x10')][util[_0xee17('0x63')](_0xee17('0x6f'),_0x2a5d76[_0xee17('0x27')])][_0xee17('0x30')]===_0xee17('0x71'));};Fax[_0xee17('0x2a')]['checkTrunk']=function(_0x5c5e6a,_0x2a5d02){if(!this['isTrunkReachable'](_0x5c5e6a)){ut[_0xee17('0x4a')](_0xee17('0x72'),_[_0xee17('0x6d')](_0x5c5e6a)?'':_0x5c5e6a[_0xee17('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xee17('0x73')};}if(_[_0xee17('0x6d')](_0x2a5d02[_0xee17('0x3f')])){ut[_0xee17('0x4a')](_0xee17('0x74'),JSON[_0xee17('0x52')](_0x2a5d02));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xee17('0x6d')](_0x2a5d02[_0xee17('0x4')])){ut[_0xee17('0x4a')](_0xee17('0x75'),JSON[_0xee17('0x52')](_0x2a5d02));return{'isValid':![],'message':_0xee17('0x76')};}return{'isValid':!![],'message':_0xee17('0x77')};};module['exports']=Fax;
\ No newline at end of file
+var _0xaed9=['AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','catch','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','newstate','bind','syncNewExten','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason'];(function(_0x10c20b,_0x4a2f1d){var _0x1d9f2c=function(_0x2ea225){while(--_0x2ea225){_0x10c20b['push'](_0x10c20b['shift']());}};_0x1d9f2c(++_0x4a2f1d);}(_0xaed9,0x11e));var _0x9aed=function(_0x42c381,_0x276f0d){_0x42c381=_0x42c381-0x0;var _0x2f52ee=_0xaed9[_0x42c381];return _0x2f52ee;};'use strict';var util=require(_0x9aed('0x0'));var _=require(_0x9aed('0x1'));var BPromise=require(_0x9aed('0x2'));var uuid=require(_0x9aed('0x3'));var moment=require(_0x9aed('0x4'));var path=require(_0x9aed('0x5'));var tiff2pdf=require(_0x9aed('0x6'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x9aed('0x7'));var ami=require(_0x9aed('0x8'));var rpcDb=require(_0x9aed('0x9'));var Channel=require(_0x9aed('0xa'));var ut=require(_0x9aed('0xb'));var Action=require(_0x9aed('0xc'));var faxAccount=require(_0x9aed('0xd'));var attachment=require(_0x9aed('0xe'));var faxMessage=require(_0x9aed('0xf'));function Fax(_0x1b01d0){this[_0x9aed('0x10')]={};this[_0x9aed('0x11')]=_0x1b01d0[_0x9aed('0x11')];this[_0x9aed('0x12')]=_0x1b01d0[_0x9aed('0x12')];this[_0x9aed('0x13')]={};ami['on'](_0x9aed('0x14'),this[_0x9aed('0x15')]['bind'](this));ami['on']('varset',this[_0x9aed('0x16')]['bind'](this));ami['on'](_0x9aed('0x17'),this['syncNewState'][_0x9aed('0x18')](this));ami['on']('newexten',this[_0x9aed('0x19')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x9aed('0x18')](this));ami['on'](_0x9aed('0x1a'),this['syncReceiveFax']['bind'](this));ami['on'](_0x9aed('0x1b'),this[_0x9aed('0x1c')][_0x9aed('0x18')](this));ami['on'](_0x9aed('0x1d'),this[_0x9aed('0x1e')][_0x9aed('0x18')](this));}Fax[_0x9aed('0x1f')]['syncNewchannel']=function(_0x4a59eb){if(_0x4a59eb[_0x9aed('0x20')]===_0x9aed('0x21')){for(var _0x49c391 in this['faxAccounts']){if(this[_0x9aed('0x11')]['hasOwnProperty'](_0x49c391)){if(_0x4a59eb['exten']===this['faxAccounts'][_0x49c391][_0x9aed('0x22')]){this[_0x9aed('0x10')][_0x4a59eb[_0x9aed('0x23')]]={};this[_0x9aed('0x10')][_0x4a59eb[_0x9aed('0x23')]][_0x9aed('0x24')]=_0x4a59eb[_0x9aed('0x24')];this[_0x9aed('0x10')][_0x4a59eb[_0x9aed('0x23')]]['id']=this[_0x9aed('0x11')][_0x49c391]['id'];this['channels'][_0x4a59eb['uniqueid']]['name']=this[_0x9aed('0x11')][_0x49c391][_0x9aed('0x25')];logger[_0x9aed('0x26')](_0x4a59eb['uniqueid'],_0x9aed('0x27'));}}}}if(this['actions'][_0x4a59eb[_0x9aed('0x23')]]){this[_0x9aed('0x10')][_0x4a59eb[_0x9aed('0x23')]]={};this[_0x9aed('0x10')][_0x4a59eb['uniqueid']]['channel']=_0x4a59eb[_0x9aed('0x24')];logger['info'](_0x4a59eb['uniqueid'],_0x9aed('0x27'));}};Fax[_0x9aed('0x1f')][_0x9aed('0x16')]=function(_0x55a406){if(this[_0x9aed('0x10')][_0x55a406['uniqueid']]){for(var _0x4aeb25 in _0x55a406[_0x9aed('0x28')]){if(_0x55a406[_0x9aed('0x28')][_0x9aed('0x29')](_0x4aeb25)){this[_0x9aed('0x10')][_0x55a406['uniqueid']][_0x4aeb25]=_0x55a406['value'];}}}};Fax[_0x9aed('0x1f')]['syncNewState']=function(_0x14ef78){if(this[_0x9aed('0x10')][_0x14ef78[_0x9aed('0x23')]]){this['channels'][_0x14ef78[_0x9aed('0x23')]][_0x9aed('0x2a')]=_0x14ef78[_0x9aed('0x2a')];this[_0x9aed('0x10')][_0x14ef78[_0x9aed('0x23')]][_0x9aed('0x2b')]=_0x14ef78[_0x9aed('0x2b')];}};Fax[_0x9aed('0x1f')][_0x9aed('0x19')]=function(_0x5d3293){if(this[_0x9aed('0x10')][_0x5d3293[_0x9aed('0x23')]]){for(var _0x1301d6 in _0x5d3293[_0x9aed('0x28')]){if(_0x5d3293[_0x9aed('0x28')][_0x9aed('0x29')](_0x1301d6)){this['channels'][_0x5d3293[_0x9aed('0x23')]][_0x1301d6]=_0x5d3293[_0x9aed('0x2c')];}}}};Fax[_0x9aed('0x1f')][_0x9aed('0x2d')]=function(_0x5058cc){if(this[_0x9aed('0x10')][_0x5058cc['uniqueid']]){this['channels'][_0x5058cc[_0x9aed('0x23')]][_0x9aed('0x2e')]=_0x5058cc['operation'];this[_0x9aed('0x10')][_0x5058cc[_0x9aed('0x23')]]['status']=_0x5058cc[_0x9aed('0x2f')];this[_0x9aed('0x10')][_0x5058cc[_0x9aed('0x23')]][_0x9aed('0x22')]=_0x5058cc['localstationid'];this[_0x9aed('0x10')][_0x5058cc['uniqueid']][_0x9aed('0x30')]=_0x5058cc[_0x9aed('0x30')];logger['info'](_0x5058cc[_0x9aed('0x23')],_0x9aed('0x31'));}};Fax[_0x9aed('0x1f')][_0x9aed('0x32')]=function(_0x2ac2f6){var _0x535b8e=this;if(this[_0x9aed('0x10')][_0x2ac2f6['uniqueid']]){var _0x39afcd=this[_0x9aed('0x10')][_0x2ac2f6[_0x9aed('0x23')]]['id'];this[_0x9aed('0x10')][_0x2ac2f6[_0x9aed('0x23')]][_0x9aed('0x33')]=_0x2ac2f6[_0x9aed('0x33')];this[_0x9aed('0x10')][_0x2ac2f6['uniqueid']][_0x9aed('0x34')]=_0x2ac2f6['pagestransferred'];this[_0x9aed('0x10')][_0x2ac2f6[_0x9aed('0x23')]][_0x9aed('0x22')]=_0x2ac2f6['localstationid'];this['channels'][_0x2ac2f6[_0x9aed('0x23')]]['resolution']=_0x2ac2f6[_0x9aed('0x35')];this['channels'][_0x2ac2f6[_0x9aed('0x23')]][_0x9aed('0x36')]=_0x2ac2f6['transferrate'];this[_0x9aed('0x10')][_0x2ac2f6['uniqueid']][_0x9aed('0x30')]=_0x2ac2f6[_0x9aed('0x30')];this[_0x9aed('0x10')][_0x2ac2f6[_0x9aed('0x23')]][_0x9aed('0x37')]=_0x2ac2f6[_0x9aed('0x37')];if(this['channels'][_0x2ac2f6['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x2ac2f6[_0x9aed('0x30')],_0x9aed('0x38'),function(_0x4f2a0f){logger[_0x9aed('0x26')](_0x2ac2f6[_0x9aed('0x23')],_0x9aed('0x39'),_0x4f2a0f['message']);attachment[_0x9aed('0x3a')]({'name':path[_0x9aed('0x3b')](_0x2ac2f6['filename'])['name'],'basename':path['parse'](_0x2ac2f6[_0x9aed('0x30')])[_0x9aed('0x25')]+_0x9aed('0x3c'),'type':_0x9aed('0x3d')})[_0x9aed('0x3e')](function(_0x50cd13){faxAccount[_0x9aed('0x3f')](_0x39afcd,{'from':_0x2ac2f6[_0x9aed('0x37')],'mapKey':_0x9aed('0x7'),'body':path['parse'](_0x2ac2f6[_0x9aed('0x30')])[_0x9aed('0x25')]+_0x9aed('0x3c'),'AttachmentId':_0x50cd13['id']})['catch'](function(_0x31a659){logger[_0x9aed('0x40')](_0x2ac2f6[_0x9aed('0x23')],_0x9aed('0x41'),JSON[_0x9aed('0x42')](_0x31a659));});})['catch'](function(_0x1c49ed){logger[_0x9aed('0x40')](_0x2ac2f6[_0x9aed('0x23')],_0x9aed('0x43'),JSON['stringify'](_0x1c49ed));});});}logger['info'](_0x2ac2f6[_0x9aed('0x23')],'\x20receiveFax\x20');}};Fax['prototype'][_0x9aed('0x1e')]=function(_0x9ae781){if(this[_0x9aed('0x13')][_0x9ae781[_0x9aed('0x23')]]){_[_0x9aed('0x44')](this['channels'][_0x9ae781[_0x9aed('0x23')]],_['pick'](_0x9ae781,[_0x9aed('0x45'),_0x9aed('0x46')]));}};function updateStatus(_0x5613ba){if(_0x5613ba[_0x9aed('0x47')]){faxMessage[_0x9aed('0x48')](_0x5613ba['AttachmentId'],{'failMessage':_0x9aed('0x49')})[_0x9aed('0x3e')](function(_0x555fad){ut['logger'](_0x9aed('0x4a'),_0x555fad);})[_0x9aed('0x4b')](function(_0x341c34){ut[_0x9aed('0x4c')](_0x9aed('0x4d'),_0x341c34);});}else{ut[_0x9aed('0x4c')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x9aed('0x1f')][_0x9aed('0x4e')]=function(_0xe8be8e,_0x2b242d,_0x46c3ed){var _0x5843b5=this;var _0x24fc41={};if(_0x2b242d){_0x24fc41={'read':_0x2b242d};}else{_0x24fc41={'failMessage':_0x46c3ed};}if(this[_0x9aed('0x13')][_0xe8be8e]['AttachmentId']){faxMessage[_0x9aed('0x48')](this[_0x9aed('0x13')][_0xe8be8e][_0x9aed('0x47')],_0x24fc41)[_0x9aed('0x3e')](function(_0x366c6d){ut['logger'](_0x9aed('0x4f'),_0x366c6d);})[_0x9aed('0x4b')](function(_0x5e20be){ut[_0x9aed('0x4c')](_0x9aed('0x50'),_0x5e20be);})[_0x9aed('0x51')](function(){delete _0x5843b5[_0x9aed('0x10')][_0xe8be8e];delete _0x5843b5[_0x9aed('0x13')][_0xe8be8e];});}else{ut['logger'](_0x9aed('0x52'));delete this[_0x9aed('0x10')][_0xe8be8e];delete this[_0x9aed('0x13')][_0xe8be8e];}};Fax[_0x9aed('0x1f')][_0x9aed('0x1c')]=function(_0x2391b4){var _0x354474=this;if(this[_0x9aed('0x10')][_0x2391b4[_0x9aed('0x23')]]){if(this[_0x9aed('0x13')][_0x2391b4[_0x9aed('0x23')]]){this['channels'][_0x2391b4[_0x9aed('0x23')]]['id']=this['actions'][_0x2391b4[_0x9aed('0x23')]]['id'];this[_0x9aed('0x10')][_0x2391b4[_0x9aed('0x23')]][_0x9aed('0x25')]=this[_0x9aed('0x13')][_0x2391b4[_0x9aed('0x23')]][_0x9aed('0x25')];}logger[_0x9aed('0x26')](_0x2391b4[_0x9aed('0x23')],this[_0x9aed('0x13')][_0x2391b4[_0x9aed('0x23')]]?_0x9aed('0x53'):_0x9aed('0x54'),JSON['stringify'](this['channels'][_0x2391b4['uniqueid']]));if(this[_0x9aed('0x13')][_0x2391b4['uniqueid']]){if(this[_0x9aed('0x10')][_0x2391b4[_0x9aed('0x23')]][_0x9aed('0x55')]>0x0&&this[_0x9aed('0x10')][_0x2391b4['uniqueid']][_0x9aed('0x56')]===_0x9aed('0x57')){this[_0x9aed('0x4e')](_0x2391b4['uniqueid'],!![]);}else{this[_0x9aed('0x4e')](_0x2391b4['uniqueid'],![],this['channels'][_0x2391b4[_0x9aed('0x23')]][_0x9aed('0x58')]?_0x9aed('0x59')+this[_0x9aed('0x10')][_0x2391b4[_0x9aed('0x23')]][_0x9aed('0x58')]:_0x9aed('0x5a'));}}}};Fax[_0x9aed('0x1f')][_0x9aed('0x5b')]=function(_0x322881){var _0x33064f=this;return new BPromise(function(_0x4d5a4,_0x504918){_0x33064f['execOriginate'](_0x322881,_0x33064f[_0x9aed('0x11')][_0x322881[_0x9aed('0x5c')]])[_0x9aed('0x3e')](function(_0x347af4){ut[_0x9aed('0x4c')](_0x9aed('0x5d'),_0x347af4);_0x4d5a4(ut[_0x9aed('0x5e')](_0x9aed('0x5f')));})['catch'](function(_0x3fa3c0){ut[_0x9aed('0x4c')]('[Fax][execOriginate][failure]',_0x3fa3c0);updateStatus(_0x322881);_0x504918(ut[_0x9aed('0x5e')](_0x9aed('0x60')));});});};Fax[_0x9aed('0x1f')]['checkAfterSend']=function(_0x16e2e0){var _0x18e061=this;return new BPromise(function(_0x275a9e,_0x1695d3){var _0x570a0c=_0x18e061[_0x9aed('0x61')](_0x18e061['faxAccounts'][_0x16e2e0[_0x9aed('0x5c')]]['Trunk'],_0x16e2e0);if(_0x570a0c[_0x9aed('0x62')]){_0x275a9e(ut[_0x9aed('0x5e')](_0x9aed('0x63')));}else{_0x1695d3(ut[_0x9aed('0x5e')](_0x570a0c[_0x9aed('0x5e')]));}});};function originate(_0x2d96db,_0x415836,_0x43bf41){return new BPromise(function(_0x320202,_0x405aef){if(_0x43bf41){var _0x49815a=util[_0x9aed('0x64')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x2d96db[_0x9aed('0x5')])[_0x9aed('0x25')],_0x2d96db[_0x9aed('0x5')]);gs['execute'](_0x49815a)[_0x9aed('0x3e')](function(){_0x2d96db[_0x9aed('0x5')]=util[_0x9aed('0x64')]('%s/%s.tif',path['parse'](_0x2d96db[_0x9aed('0x5')])[_0x9aed('0x65')],path[_0x9aed('0x3b')](_0x2d96db[_0x9aed('0x5')])[_0x9aed('0x25')]);_0x415836[_0x9aed('0x66')]=_0x2d96db[_0x9aed('0x5')];ut[_0x9aed('0x4c')](_0x9aed('0x67'),'');ami[_0x9aed('0x68')](ut[_0x9aed('0x69')](_0x2d96db,_0x415836))['then'](function(_0x147388){_0x320202(_0x147388);})[_0x9aed('0x4b')](function(_0x2cb80c){_0x405aef(_0x2cb80c);});})[_0x9aed('0x4b')](function(_0x5a5b73){_0x405aef(_0x5a5b73);});}else{ami['Action'](ut[_0x9aed('0x69')](_0x2d96db,_0x415836))[_0x9aed('0x3e')](function(_0x182243){_0x320202(_0x182243);})[_0x9aed('0x4b')](function(_0x18676c){_0x405aef(_0x18676c);});}});}Fax[_0x9aed('0x1f')][_0x9aed('0x6a')]=function(_0x5b9459,_0x589656){var _0xd7f39a=this;return new BPromise(function(_0x1a5e04,_0x56643e){var _0x355637=uuid['v4']();var _0x1e578c=ut[_0x9aed('0x6b')](_0x5b9459,_0x589656);_0xd7f39a['actions'][_0x355637]=new Action(_0x355637,_0x589656,_0x5b9459);var _0x169f40=_0xd7f39a[_0x9aed('0x13')][_0x355637];if(path['parse'](_0x5b9459[_0x9aed('0x5')])['ext']==='.pdf'){originate(_0x169f40,_0x1e578c,!![])[_0x9aed('0x3e')](function(_0x23343d){_0x1a5e04(_0x23343d);})['catch'](function(_0x44c782){_0x56643e(_0x44c782);});}else{originate(_0x169f40,_0x1e578c,![])[_0x9aed('0x3e')](function(_0x27555f){_0x1a5e04(_0x27555f);})[_0x9aed('0x4b')](function(_0x32dec3){_0x56643e(_0x32dec3);});}});};Fax[_0x9aed('0x1f')][_0x9aed('0x6c')]=function(_0x2c3534){return!_[_0x9aed('0x6d')](_0x2c3534)&&!_['isNil'](_0x2c3534[_0x9aed('0x25')])&&!_[_0x9aed('0x6d')](_0x2c3534['active'])&&_0x2c3534[_0x9aed('0x6e')]&&!_['isNil'](this[_0x9aed('0x12')][util[_0x9aed('0x64')]('SIP/%s',_0x2c3534[_0x9aed('0x25')])])&&!_[_0x9aed('0x6d')](this['trunks'][util[_0x9aed('0x64')](_0x9aed('0x6f'),_0x2c3534['name'])][_0x9aed('0x2f')])&&(this['trunks'][util[_0x9aed('0x64')](_0x9aed('0x6f'),_0x2c3534[_0x9aed('0x25')])][_0x9aed('0x2f')]==='reachable'||this[_0x9aed('0x12')][util[_0x9aed('0x64')]('SIP/%s',_0x2c3534[_0x9aed('0x25')])][_0x9aed('0x2f')]===_0x9aed('0x70'));};Fax[_0x9aed('0x1f')][_0x9aed('0x61')]=function(_0x32c4d6,_0x2b0300){if(!this[_0x9aed('0x6c')](_0x32c4d6)){ut[_0x9aed('0x4c')](_0x9aed('0x71'),_[_0x9aed('0x6d')](_0x32c4d6)?'':_0x32c4d6[_0x9aed('0x25')]+_0x9aed('0x72'));return{'isValid':![],'message':_0x9aed('0x73')};}if(_[_0x9aed('0x6d')](_0x2b0300[_0x9aed('0x7')])){ut[_0x9aed('0x4c')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x2b0300));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2b0300[_0x9aed('0x5')])){ut[_0x9aed('0x4c')](_0x9aed('0x74'),JSON[_0x9aed('0x42')](_0x2b0300));return{'isValid':![],'message':_0x9aed('0x75')};}return{'isValid':!![],'message':_0x9aed('0x76')};};module['exports']=Fax;
\ No newline at end of file
index a6703f5..2b12298 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0840=['[Notify]\x20','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','resolve','catch'];(function(_0x18d5f3,_0x4cd1dd){var _0x17b803=function(_0x20f1f1){while(--_0x20f1f1){_0x18d5f3['push'](_0x18d5f3['shift']());}};_0x17b803(++_0x4cd1dd);}(_0x0840,0xb5));var _0x0084=function(_0x546f45,_0x3a0b48){_0x546f45=_0x546f45-0x0;var _0x3058cc=_0x0840[_0x546f45];return _0x3058cc;};'use strict';var util=require('util');var BPromise=require(_0x0084('0x0'));var logger=require(_0x0084('0x1'))(_0x0084('0x2'));var _=require('lodash');var faxAccount=require(_0x0084('0x3'));function loggerCatch(_0x151976){return function(_0x44e700){logger[_0x0084('0x4')](_0x151976,util[_0x0084('0x5')](_0x44e700,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2e9599,_0xf31071){return BPromise[_0x0084('0x6')]()['then'](faxAccount['notify'](_0x2e9599,_0xf31071))[_0x0084('0x7')](loggerCatch(_0x0084('0x8')));};
\ No newline at end of file
+var _0xfaf9=['then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','inspect','resolve'];(function(_0x552ea8,_0x2d9fda){var _0x4353ac=function(_0x2611e){while(--_0x2611e){_0x552ea8['push'](_0x552ea8['shift']());}};_0x4353ac(++_0x2d9fda);}(_0xfaf9,0x143));var _0x9faf=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xfaf9[_0x53cf8e];return _0x459197;};'use strict';var util=require(_0x9faf('0x0'));var BPromise=require(_0x9faf('0x1'));var logger=require(_0x9faf('0x2'))(_0x9faf('0x3'));var _=require(_0x9faf('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4025d5){return function(_0x3b00ed){logger['error'](_0x4025d5,util[_0x9faf('0x5')](_0x3b00ed,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x433579,_0x48430c){return BPromise[_0x9faf('0x6')]()[_0x9faf('0x7')](faxAccount[_0x9faf('0x8')](_0x433579,_0x48430c))[_0x9faf('0x9')](loggerCatch(_0x9faf('0xa')));};
\ No newline at end of file
index b62bedf..77d21f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a3a=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x43dc7a,_0xdaee2f){var _0x4f8eeb=function(_0x5a2c21){while(--_0x5a2c21){_0x43dc7a['push'](_0x43dc7a['shift']());}};_0x4f8eeb(++_0xdaee2f);}(_0x6a3a,0x77));var _0xa6a3=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x6a3a[_0x11005e];return _0x29338f;};'use strict';var util=require(_0xa6a3('0x0'));var logger=require(_0xa6a3('0x1'))(_0xa6a3('0x2'));var BPromise=require(_0xa6a3('0x3'));var exec=require(_0xa6a3('0x4'))[_0xa6a3('0x5')];exports[_0xa6a3('0x6')]=function(_0x55b8e7){return new BPromise(function(_0x1bee72,_0x2cb239){exec(_0x55b8e7,function(_0x47d35e,_0x3cbe8c,_0x1ddd1c){logger[_0xa6a3('0x7')](_0xa6a3('0x8'),_0x3cbe8c);if(_0x47d35e){logger['info']('Exec\x20gs',_0xa6a3('0x9'),util[_0xa6a3('0xa')](_0x47d35e,{'showHidden':![],'depth':null}),_0x3cbe8c,_0x1ddd1c);_0x2cb239(_0x47d35e);}_0x1bee72(_0x3cbe8c);});});};
\ No newline at end of file
+var _0xae58=['fax','bluebird','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util'];(function(_0x5eedbb,_0x5d4226){var _0x5c1188=function(_0x142101){while(--_0x142101){_0x5eedbb['push'](_0x5eedbb['shift']());}};_0x5c1188(++_0x5d4226);}(_0xae58,0xe9));var _0x8ae5=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0xae58[_0x20d54d];return _0x516e8b;};'use strict';var util=require(_0x8ae5('0x0'));var logger=require('../../../../config/logger')(_0x8ae5('0x1'));var BPromise=require(_0x8ae5('0x2'));var exec=require('child_process')[_0x8ae5('0x3')];exports[_0x8ae5('0x4')]=function(_0x2a1a0){return new BPromise(function(_0x278e16,_0x25bb3c){exec(_0x2a1a0,function(_0x36cb33,_0x4a55d3,_0x4e2730){logger['info'](_0x8ae5('0x5'),_0x4a55d3);if(_0x36cb33){logger[_0x8ae5('0x6')](_0x8ae5('0x5'),_0x8ae5('0x7'),util[_0x8ae5('0x8')](_0x36cb33,{'showHidden':![],'depth':null}),_0x4a55d3,_0x4e2730);_0x25bb3c(_0x36cb33);}_0x278e16(_0x4a55d3);});});};
\ No newline at end of file
index e949598..09f998e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x118f=['variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','../../../../config/logger','message','info','inspect','addVariables','headerinfo','format','\x22%s\x22','modem','gateway','t38timeout','path'];(function(_0x101f10,_0x577e96){var _0x19959f=function(_0x497276){while(--_0x497276){_0x101f10['push'](_0x101f10['shift']());}};_0x19959f(++_0x577e96);}(_0x118f,0x193));var _0xf118=function(_0x3ddff2,_0x1a62ea){_0x3ddff2=_0x3ddff2-0x0;var _0x31bfd7=_0x118f[_0x3ddff2];return _0x31bfd7;};'use strict';var util=require(_0xf118('0x0'));var _=require(_0xf118('0x1'));var moment=require(_0xf118('0x2'));var logger=require(_0xf118('0x3'))('fax');exports[_0xf118('0x4')]=function(_0x296d09){return{'message':_0x296d09};};exports['logger']=function(_0x301d38,_0x3b5c71){logger[_0xf118('0x5')](_0x301d38,util[_0xf118('0x6')](_0x3b5c71,{'showHidden':![],'depth':null}));};exports[_0xf118('0x7')]=function(_0x186412,_0x572e5a){var _0x4d19a1={'XMF-ECM':_0x572e5a['ecm'],'XMF-HEADERINFO':_0x572e5a[_0xf118('0x8')],'XMF-MINRATE':_0x572e5a['minrate'],'XMF-MAXRATE':_0x572e5a['maxrate'],'XMF-MODEM':util[_0xf118('0x9')](_0xf118('0xa'),_0x572e5a[_0xf118('0xb')]),'XMF-GATEWAY':_0x572e5a[_0xf118('0xc')],'XMF-FAXDETECT':_0x572e5a['faxdetect'],'XMF-T38TIMEOUT':_0x572e5a[_0xf118('0xd')],'XMF-LOCALSTATIONID':_0x572e5a['localstationid'],'XMF-PATH':_0x186412[_0xf118('0xe')]};return _0x4d19a1;};exports[_0xf118('0xf')]=function(_0x4aa50f,_0x1f8519){return{'actionid':_0x4aa50f[_0xf118('0x10')],'action':_0xf118('0x11'),'channel':_0x4aa50f[_0xf118('0x12')],'Exten':'xcally-motion-fax','Context':_0xf118('0x13'),'Priority':'1','callerid':util[_0xf118('0x9')](_0xf118('0x14'),_0x4aa50f[_0xf118('0x8')]?_0x4aa50f['headerinfo']:'',_0x4aa50f[_0xf118('0x15')]),'variable':_0x1f8519,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4aa50f[_0xf118('0x10')]};};
\ No newline at end of file
+var _0xec26=['variablesAction','uniqueid','originate','xcally-motion-fax','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xec26,0x1df));var _0x6ec2=function(_0x356a68,_0x168ebe){_0x356a68=_0x356a68-0x0;var _0x3542a6=_0xec26[_0x356a68];return _0x3542a6;};'use strict';var util=require(_0x6ec2('0x0'));var _=require(_0x6ec2('0x1'));var moment=require(_0x6ec2('0x2'));var logger=require(_0x6ec2('0x3'))('fax');exports[_0x6ec2('0x4')]=function(_0x33587a){return{'message':_0x33587a};};exports[_0x6ec2('0x5')]=function(_0x528beb,_0x2d81cc){logger[_0x6ec2('0x6')](_0x528beb,util[_0x6ec2('0x7')](_0x2d81cc,{'showHidden':![],'depth':null}));};exports[_0x6ec2('0x8')]=function(_0x4e08e7,_0x378d2e){var _0x251b63={'XMF-ECM':_0x378d2e[_0x6ec2('0x9')],'XMF-HEADERINFO':_0x378d2e[_0x6ec2('0xa')],'XMF-MINRATE':_0x378d2e[_0x6ec2('0xb')],'XMF-MAXRATE':_0x378d2e[_0x6ec2('0xc')],'XMF-MODEM':util[_0x6ec2('0xd')](_0x6ec2('0xe'),_0x378d2e[_0x6ec2('0xf')]),'XMF-GATEWAY':_0x378d2e[_0x6ec2('0x10')],'XMF-FAXDETECT':_0x378d2e[_0x6ec2('0x11')],'XMF-T38TIMEOUT':_0x378d2e[_0x6ec2('0x12')],'XMF-LOCALSTATIONID':_0x378d2e[_0x6ec2('0x13')],'XMF-PATH':_0x4e08e7[_0x6ec2('0x14')]};return _0x251b63;};exports[_0x6ec2('0x15')]=function(_0x1a8b00,_0x10dfd5){return{'actionid':_0x1a8b00[_0x6ec2('0x16')],'action':_0x6ec2('0x17'),'channel':_0x1a8b00['channel'],'Exten':_0x6ec2('0x18'),'Context':'from-sip','Priority':'1','callerid':util[_0x6ec2('0xd')]('\x22%s\x22\x20<%s>',_0x1a8b00[_0x6ec2('0xa')]?_0x1a8b00[_0x6ec2('0xa')]:'',_0x1a8b00[_0x6ec2('0x13')]),'variable':_0x10dfd5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a8b00[_0x6ec2('0x16')]};};
\ No newline at end of file
index 25f2549..92cb036 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xada1=['./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','listen','sync','catch','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user'];(function(_0x4202b3,_0x19b9c6){var _0x5c3f3b=function(_0x1374c8){while(--_0x1374c8){_0x4202b3['push'](_0x4202b3['shift']());}};_0x5c3f3b(++_0x19b9c6);}(_0xada1,0x1a0));var _0x1ada=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xada1[_0x344a3f];return _0x264712;};'use strict';var util=require(_0x1ada('0x0'));var moment=require(_0x1ada('0x1'));var server=require(_0x1ada('0x2'));var Realtime=require(_0x1ada('0x3'));var Report=require(_0x1ada('0x4'));var Acw=require(_0x1ada('0x5'));var Trigger=require(_0x1ada('0x6'));var Dialer=require('./dialer');var Preview=require(_0x1ada('0x7'));var Fax=require(_0x1ada('0x8'));var user=require(_0x1ada('0x9'));var voiceQueue=require(_0x1ada('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x1ada('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x1ada('0xc'));var cmHopperHistory=require(_0x1ada('0xd'));var campaign=require(_0x1ada('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x1ada('0xf'));var zendesk=require(_0x1ada('0x10'));var salesforce=require(_0x1ada('0x11'));var sugarcrm=require(_0x1ada('0x12'));var freshdesk=require(_0x1ada('0x13'));var desk=require(_0x1ada('0x14'));var zoho=require(_0x1ada('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x1ada('0x16'));var servicenow=require(_0x1ada('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x1ada('0x18'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1ada('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1ada('0x19')](_0x1ada('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x1ada('0x1b')](user[_0x1ada('0x1c')]())['then'](realtime[_0x1ada('0x1d')]())[_0x1ada('0x1b')](user[_0x1ada('0x1e')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x1f')]())[_0x1ada('0x1b')](trunk[_0x1ada('0x20')]())['then'](realtime[_0x1ada('0x21')]())[_0x1ada('0x1b')](voiceQueue['getVoiceQueues']())[_0x1ada('0x1b')](realtime[_0x1ada('0x22')]())[_0x1ada('0x1b')](trigger[_0x1ada('0x23')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x24')]())['then'](template[_0x1ada('0x25')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x26')]())[_0x1ada('0x1b')](zendesk[_0x1ada('0x27')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x28')]())[_0x1ada('0x1b')](salesforce[_0x1ada('0x29')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x2a')]())['then'](sugarcrm[_0x1ada('0x2b')]())['then'](realtime['initSugarcrmAccounts']())[_0x1ada('0x1b')](freshdesk[_0x1ada('0x2c')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x2d')]())[_0x1ada('0x1b')](desk[_0x1ada('0x2e')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x2f')]())[_0x1ada('0x1b')](zoho[_0x1ada('0x30')]())[_0x1ada('0x1b')](realtime['initZohoAccounts']())[_0x1ada('0x1b')](vtiger[_0x1ada('0x31')]())['then'](realtime[_0x1ada('0x32')]())[_0x1ada('0x1b')](freshsales[_0x1ada('0x33')]())[_0x1ada('0x1b')](realtime['initFreshsalesAccounts']())[_0x1ada('0x1b')](servicenow[_0x1ada('0x34')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x35')]())[_0x1ada('0x1b')](dynamics365['getDynamics365Accounts']())[_0x1ada('0x1b')](realtime[_0x1ada('0x36')]())[_0x1ada('0x1b')](campaign['getCampaigns']())[_0x1ada('0x1b')](realtime[_0x1ada('0x37')]())[_0x1ada('0x1b')](voiceExtension[_0x1ada('0x38')]())[_0x1ada('0x1b')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x1ada('0x39')]())['then'](realtime['initFaxAccounts']())[_0x1ada('0x1b')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x1ada('0x1b')](voiceQueueReport[_0x1ada('0x3a')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x3b')]())[_0x1ada('0x1b')](cmHopperHistory[_0x1ada('0x3c')]())['then'](realtime[_0x1ada('0x3d')]())[_0x1ada('0x1b')](cmHopperHistory[_0x1ada('0x3e')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x3f')]())['then'](voiceCallReport[_0x1ada('0x40')]())[_0x1ada('0x1b')](realtime[_0x1ada('0x41')]())['catch'](function(_0x261327){logger[_0x1ada('0x42')]('[index.js][initParams]',util[_0x1ada('0x43')](_0x261327,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1ada('0x44')](realtime,preview,fax)[_0x1ada('0x1b')](function(){return initRealtime();})[_0x1ada('0x1b')](function(){return initParams();})[_0x1ada('0x1b')](function(){report[_0x1ada('0x45')]();setInterval(initRealtime,0x1388);})[_0x1ada('0x46')](function(_0x476b39){logger[_0x1ada('0x42')]('[index.js][main]',util[_0x1ada('0x43')](_0x476b39,{'showHidden':![],'depth':null}));});}main();
\ No newline at end of file
+var _0x188d=['getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers'];(function(_0x58c923,_0x2267cb){var _0x50c70e=function(_0xb9edfb){while(--_0xb9edfb){_0x58c923['push'](_0x58c923['shift']());}};_0x50c70e(++_0x2267cb);}(_0x188d,0x146));var _0xd188=function(_0x2a275e,_0x5aa79b){_0x2a275e=_0x2a275e-0x0;var _0x2287fe=_0x188d[_0x2a275e];return _0x2287fe;};'use strict';var util=require(_0xd188('0x0'));var moment=require(_0xd188('0x1'));var server=require(_0xd188('0x2'));var Realtime=require(_0xd188('0x3'));var Report=require(_0xd188('0x4'));var Acw=require(_0xd188('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xd188('0x6'));var Preview=require('./preview');var Fax=require(_0xd188('0x7'));var user=require(_0xd188('0x8'));var voiceQueue=require(_0xd188('0x9'));var voiceQueueReport=require(_0xd188('0xa'));var voiceCallReport=require(_0xd188('0xb'));var trunk=require(_0xd188('0xc'));var trigger=require(_0xd188('0xd'));var template=require(_0xd188('0xe'));var cmHopperHistory=require(_0xd188('0xf'));var campaign=require(_0xd188('0x10'));var voiceExtension=require(_0xd188('0x11'));var faxAccount=require(_0xd188('0x12'));var zendesk=require(_0xd188('0x13'));var salesforce=require(_0xd188('0x14'));var sugarcrm=require(_0xd188('0x15'));var freshdesk=require(_0xd188('0x16'));var desk=require(_0xd188('0x17'));var zoho=require(_0xd188('0x18'));var vtiger=require(_0xd188('0x19'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xd188('0x1a'))(_0xd188('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd188('0x1c')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd188('0x1c')](_0xd188('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xd188('0x1e')](user[_0xd188('0x1f')]())['then'](realtime[_0xd188('0x20')]())['then'](user['getTelephones']())[_0xd188('0x1e')](realtime['initTelephones']())['then'](trunk[_0xd188('0x21')]())[_0xd188('0x1e')](realtime[_0xd188('0x22')]())[_0xd188('0x1e')](voiceQueue[_0xd188('0x23')]())[_0xd188('0x1e')](realtime[_0xd188('0x24')]())[_0xd188('0x1e')](trigger[_0xd188('0x25')]())[_0xd188('0x1e')](realtime[_0xd188('0x26')]())[_0xd188('0x1e')](template[_0xd188('0x27')]())[_0xd188('0x1e')](realtime[_0xd188('0x28')]())['then'](zendesk['getZendeskAccounts']())[_0xd188('0x1e')](realtime[_0xd188('0x29')]())['then'](salesforce[_0xd188('0x2a')]())[_0xd188('0x1e')](realtime[_0xd188('0x2b')]())[_0xd188('0x1e')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xd188('0x2c')]())['then'](freshdesk[_0xd188('0x2d')]())[_0xd188('0x1e')](realtime[_0xd188('0x2e')]())[_0xd188('0x1e')](desk[_0xd188('0x2f')]())['then'](realtime[_0xd188('0x30')]())['then'](zoho[_0xd188('0x31')]())['then'](realtime['initZohoAccounts']())[_0xd188('0x1e')](vtiger[_0xd188('0x32')]())['then'](realtime['initVtigerAccounts']())[_0xd188('0x1e')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xd188('0x33')]())['then'](servicenow[_0xd188('0x34')]())[_0xd188('0x1e')](realtime[_0xd188('0x35')]())['then'](dynamics365[_0xd188('0x36')]())[_0xd188('0x1e')](realtime[_0xd188('0x37')]())[_0xd188('0x1e')](campaign[_0xd188('0x38')]())['then'](realtime[_0xd188('0x39')]())[_0xd188('0x1e')](voiceExtension[_0xd188('0x3a')]())[_0xd188('0x1e')](realtime['initVoiceExtensions']())[_0xd188('0x1e')](faxAccount[_0xd188('0x3b')]())[_0xd188('0x1e')](realtime[_0xd188('0x3c')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xd188('0x1e')](voiceQueueReport[_0xd188('0x3d')]())[_0xd188('0x1e')](realtime[_0xd188('0x3e')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xd188('0x1e')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xd188('0x3f')]())['then'](realtime[_0xd188('0x40')]())[_0xd188('0x1e')](voiceCallReport[_0xd188('0x41')]())['then'](realtime[_0xd188('0x42')]())[_0xd188('0x43')](function(_0x2fc9ff){logger[_0xd188('0x44')](_0xd188('0x45'),util[_0xd188('0x46')](_0x2fc9ff,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xd188('0x1e')](function(){return initRealtime();})[_0xd188('0x1e')](function(){return initParams();})[_0xd188('0x1e')](function(){report[_0xd188('0x47')]();setInterval(initRealtime,0x1388);})[_0xd188('0x43')](function(_0xb98f96){logger[_0xd188('0x44')](_0xd188('0x48'),util['inspect'](_0xb98f96,{'showHidden':![],'depth':null}));});}main();
\ No newline at end of file
index 6939172..b136514 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa57e=['local','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','stringify','user:%s','emit','user:save','user:presence','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold'];(function(_0x4e8725,_0x3b4580){var _0x13b030=function(_0x4477a6){while(--_0x4477a6){_0x4e8725['push'](_0x4e8725['shift']());}};_0x13b030(++_0x3b4580);}(_0xa57e,0x67));var _0xea57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa57e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea57('0x0'));var util=require(_0xea57('0x1'));var moment=require(_0xea57('0x2'));var md5=require(_0xea57('0x3'));var Redis=require(_0xea57('0x4'));var config=require(_0xea57('0x5'));config[_0xea57('0x6')]=_[_0xea57('0x7')](config[_0xea57('0x6')],{'host':_0xea57('0x8'),'port':0x18eb});var io=require(_0xea57('0x9'))(new Redis(config[_0xea57('0x6')]));function Agent(_0x3352a0){this['id']=_0x3352a0['id']||0x0;this['name']=_0x3352a0[_0xea57('0xa')]||'';this[_0xea57('0xb')]=_0x3352a0[_0xea57('0xb')]||'';this['accountcode']=_0x3352a0[_0xea57('0xc')]||'';this[_0xea57('0xd')]=_0x3352a0[_0xea57('0xd')]||'';this['state']=_0xea57('0xe');this[_0xea57('0xf')]=0x0;this[_0xea57('0x10')]=_0xea57('0xe');this[_0xea57('0x11')]='';this[_0xea57('0x12')]='';this[_0xea57('0x13')]='';this[_0xea57('0x14')]='';this[_0xea57('0x15')]=_0x3352a0[_0xea57('0x15')]||![];this['voiceStatus']=_0xea57('0xe');this[_0xea57('0x16')]=0x0;this[_0xea57('0x17')]='';this[_0xea57('0x18')]='';this[_0xea57('0x19')]=![];this[_0xea57('0x1a')]=![];this[_0xea57('0x3')]='';}Agent['prototype'][_0xea57('0x1b')]=function(_0x5eeb7c){var _0x4a8731;if(_0x5eeb7c&&_0x5eeb7c[_0xea57('0x1c')]){_0x4a8731=_0x5eeb7c[_0xea57('0x1c')][_0xea57('0x1d')]();switch(_0x4a8731){case _0xea57('0x1e'):_0x4a8731=_0xea57('0x1f');break;case _0xea57('0x20'):_0x4a8731=_0xea57('0x21');break;}}if(_0x4a8731&&this[_0xea57('0x22')]!==_0x4a8731||_0x5eeb7c[_0xea57('0x23')]){this[_0xea57('0x16')]=_[_0xea57('0x24')](moment()[_0xea57('0x25')]('x'));}if(_0x4a8731){this[_0xea57('0x22')]=_0x4a8731;}var _0x5bd1c5={'id':this['id'],'name':this[_0xea57('0xa')],'email':this[_0xea57('0xb')],'accountcode':this[_0xea57('0xc')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0xea57('0xf')],'status':this[_0xea57('0x10')],'address':this[_0xea57('0x11')],'online':this[_0xea57('0x15')],'voiceStatus':this[_0xea57('0x22')],'voiceStatusTime':this[_0xea57('0x16')],'voiceStatusCallerIdNumber':this[_0xea57('0x17')],'voiceStatusQueue':this[_0xea57('0x18')],'interface':this['interface'],'onhold':this[_0xea57('0x19')]};var _0x1bcbf2=md5(JSON[_0xea57('0x26')](_0x5bd1c5));if(this[_0xea57('0x3')]!==_0x1bcbf2){this[_0xea57('0x3')]=_0x1bcbf2;io['to'](util['format'](_0xea57('0x27'),_0x5bd1c5['name']))[_0xea57('0x28')](_0xea57('0x29'),_0x5bd1c5);io[_0xea57('0x28')](_0xea57('0x2a'),_0x5bd1c5);}};module['exports']=Agent;
\ No newline at end of file
+var _0xa322=['voiceStatusTime','voiceStatusCallerIdNumber','stringify','emit','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa322,0x15c));var _0x2a32=function(_0x4eb582,_0x330781){_0x4eb582=_0x4eb582-0x0;var _0x32d5de=_0xa322[_0x4eb582];return _0x32d5de;};'use strict';var _=require(_0x2a32('0x0'));var util=require(_0x2a32('0x1'));var moment=require(_0x2a32('0x2'));var md5=require(_0x2a32('0x3'));var Redis=require('ioredis');var config=require(_0x2a32('0x4'));config[_0x2a32('0x5')]=_[_0x2a32('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a32('0x5')]));function Agent(_0x4bf3a8){this['id']=_0x4bf3a8['id']||0x0;this[_0x2a32('0x7')]=_0x4bf3a8['name']||'';this['email']=_0x4bf3a8[_0x2a32('0x8')]||'';this[_0x2a32('0x9')]=_0x4bf3a8[_0x2a32('0x9')]||'';this['fullname']=_0x4bf3a8[_0x2a32('0xa')]||'';this[_0x2a32('0xb')]='unknown';this[_0x2a32('0xc')]=0x0;this[_0x2a32('0xd')]=_0x2a32('0xe');this[_0x2a32('0xf')]='';this[_0x2a32('0x10')]='';this[_0x2a32('0x11')]='';this[_0x2a32('0x12')]='';this[_0x2a32('0x13')]=_0x4bf3a8[_0x2a32('0x13')]||![];this[_0x2a32('0x14')]=_0x2a32('0xe');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x2a32('0x15')]='';this[_0x2a32('0x16')]=![];this[_0x2a32('0x17')]=![];this[_0x2a32('0x3')]='';}Agent[_0x2a32('0x18')][_0x2a32('0x19')]=function(_0xf0195){var _0x1b9305;if(_0xf0195&&_0xf0195['state']){_0x1b9305=_0xf0195[_0x2a32('0xb')][_0x2a32('0x1a')]();switch(_0x1b9305){case _0x2a32('0x1b'):_0x1b9305=_0x2a32('0x1c');break;case _0x2a32('0x1d'):_0x1b9305=_0x2a32('0x1e');break;}}if(_0x1b9305&&this[_0x2a32('0x14')]!==_0x1b9305||_0xf0195[_0x2a32('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x1b9305){this[_0x2a32('0x14')]=_0x1b9305;}var _0x47fc19={'id':this['id'],'name':this['name'],'email':this[_0x2a32('0x8')],'accountcode':this[_0x2a32('0x9')],'fullname':this['fullname'],'state':this[_0x2a32('0xb')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x2a32('0xf')],'online':this['online'],'voiceStatus':this[_0x2a32('0x14')],'voiceStatusTime':this[_0x2a32('0x20')],'voiceStatusCallerIdNumber':this[_0x2a32('0x21')],'voiceStatusQueue':this[_0x2a32('0x15')],'interface':this[_0x2a32('0x12')],'onhold':this[_0x2a32('0x16')]};var _0x41fc2d=md5(JSON[_0x2a32('0x22')](_0x47fc19));if(this[_0x2a32('0x3')]!==_0x41fc2d){this[_0x2a32('0x3')]=_0x41fc2d;io['to'](util['format']('user:%s',_0x47fc19[_0x2a32('0x7')]))[_0x2a32('0x23')]('user:save',_0x47fc19);io[_0x2a32('0x23')](_0x2a32('0x24'),_0x47fc19);}};module[_0x2a32('0x25')]=Agent;
\ No newline at end of file
index 2cdf0f7..282e585 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x019f=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x019f,0x1ba));var _0xf019=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0x019f[_0x193a6e];return _0x599a9b;};'use strict';function Campaign(_0x50e123){this['id']=_0x50e123['id']||0x0;this['name']=_0x50e123[_0xf019('0x0')]||'';this['type']=_0x50e123[_0xf019('0x1')]||_0xf019('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xf019('0x3')]=0x0;this[_0xf019('0x4')]=0x0;this[_0xf019('0x5')]='';this[_0xf019('0x6')]=!![];this[_0xf019('0x7')]=_0x50e123['active'];this[_0xf019('0x8')]=_0x50e123[_0xf019('0x8')];this[_0xf019('0x9')]=_0x50e123[_0xf019('0x9')]||null;this[_0xf019('0xa')]=_0x50e123[_0xf019('0xa')]?_0x50e123['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x50e123[_0xf019('0xb')];this['dialOriginateCallerIdNumber']=_0x50e123['dialOriginateCallerIdNumber'];this[_0xf019('0xc')]=_0x50e123[_0xf019('0xc')]||0x1e;this[_0xf019('0xd')]=_0x50e123[_0xf019('0xd')];this['dialCongestionRetryFrequency']=_0x50e123[_0xf019('0xe')];this[_0xf019('0xf')]=_0x50e123[_0xf019('0xf')];this[_0xf019('0x10')]=_0x50e123[_0xf019('0x10')];this[_0xf019('0x11')]=_0x50e123[_0xf019('0x11')];this['dialNoAnswerRetryFrequency']=_0x50e123['dialNoAnswerRetryFrequency'];this[_0xf019('0x12')]=_0x50e123['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x50e123[_0xf019('0x13')]||0x3;this[_0xf019('0x14')]=_0x50e123[_0xf019('0x14')]||0x96;this[_0xf019('0x15')]=_0x50e123[_0xf019('0x15')]||0x3;this[_0xf019('0x16')]=_0x50e123[_0xf019('0x16')]||0x96;this[_0xf019('0x17')]=_0x50e123[_0xf019('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x50e123[_0xf019('0x18')]||0x96;this[_0xf019('0x19')]=_0x50e123[_0xf019('0x19')]||0x3;this[_0xf019('0x1a')]=_0x50e123[_0xf019('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x50e123[_0xf019('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x50e123['dialAgentRejectRetryFrequency']||0x96;this[_0xf019('0x1c')]=_0x50e123[_0xf019('0x1c')]||_0xf019('0x1d');this[_0xf019('0x1e')]=_0x50e123[_0xf019('0x1e')]||undefined;this[_0xf019('0x1f')]=_0x50e123[_0xf019('0x1f')]||undefined;this[_0xf019('0x20')]=_0x50e123['dialCutDigit']||undefined;this[_0xf019('0x21')]=_0x50e123[_0xf019('0x21')]?_0x50e123[_0xf019('0x21')]:undefined;this[_0xf019('0x22')]=_0x50e123[_0xf019('0x22')]?_0x50e123['Trunk']:undefined;this[_0xf019('0x23')]=_0x50e123['Interval']?_0x50e123[_0xf019('0x23')]:undefined;this['SquareProject']=_0x50e123[_0xf019('0x24')]?_0x50e123[_0xf019('0x24')]:undefined;this[_0xf019('0x25')]=_0x50e123[_0xf019('0x24')]?_0x50e123[_0xf019('0x24')]['name']:undefined;this[_0xf019('0x26')]=_0x50e123[_0xf019('0x26')]||![];this[_0xf019('0x27')]=_0x50e123['dialAMDInitialSilence'];this[_0xf019('0x28')]=_0x50e123[_0xf019('0x28')];this[_0xf019('0x29')]=_0x50e123[_0xf019('0x29')];this[_0xf019('0x2a')]=_0x50e123[_0xf019('0x2a')];this[_0xf019('0x2b')]=_0x50e123['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x50e123['dialAMDBetweenWordsSilence'];this[_0xf019('0x2c')]=_0x50e123[_0xf019('0x2c')];this[_0xf019('0x2d')]=_0x50e123['dialAMDSilenceThreshold'];this[_0xf019('0x2e')]=_0x50e123['dialAMDMaximumWordLength'];}module[_0xf019('0x2f')]=Campaign;
\ No newline at end of file
+var _0x248d=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x1daeaa,_0x102077){var _0x21e49e=function(_0x17628c){while(--_0x17628c){_0x1daeaa['push'](_0x1daeaa['shift']());}};_0x21e49e(++_0x102077);}(_0x248d,0x14a));var _0xd248=function(_0x38b71d,_0x142312){_0x38b71d=_0x38b71d-0x0;var _0xf5d097=_0x248d[_0x38b71d];return _0xf5d097;};'use strict';function Campaign(_0x39d531){this['id']=_0x39d531['id']||0x0;this[_0xd248('0x0')]=_0x39d531[_0xd248('0x0')]||'';this['type']=_0x39d531[_0xd248('0x1')]||'campaign';this[_0xd248('0x2')]=0x0;this[_0xd248('0x3')]=0x0;this[_0xd248('0x4')]=0x0;this[_0xd248('0x5')]=0x0;this['message']='';this[_0xd248('0x6')]=!![];this[_0xd248('0x7')]=_0x39d531[_0xd248('0x7')];this[_0xd248('0x8')]=_0x39d531['limitCalls'];this['dialTimezone']=_0x39d531[_0xd248('0x9')]||null;this[_0xd248('0xa')]=_0x39d531['dialGlobalInterval']?_0x39d531[_0xd248('0xa')]:null;this['dialOriginateCallerIdName']=_0x39d531[_0xd248('0xb')];this[_0xd248('0xc')]=_0x39d531[_0xd248('0xc')];this[_0xd248('0xd')]=_0x39d531[_0xd248('0xd')]||0x1e;this[_0xd248('0xe')]=_0x39d531[_0xd248('0xe')];this[_0xd248('0xf')]=_0x39d531[_0xd248('0xf')];this[_0xd248('0x10')]=_0x39d531['dialBusyMaxRetry'];this[_0xd248('0x11')]=_0x39d531[_0xd248('0x11')];this['dialNoAnswerMaxRetry']=_0x39d531[_0xd248('0x12')];this[_0xd248('0x13')]=_0x39d531[_0xd248('0x13')];this[_0xd248('0x14')]=_0x39d531[_0xd248('0x14')];this['dialNoSuchNumberMaxRetry']=_0x39d531[_0xd248('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x39d531['dialNoSuchNumberRetryFrequency']||0x96;this[_0xd248('0x16')]=_0x39d531['dialDropMaxRetry']||0x3;this[_0xd248('0x17')]=_0x39d531[_0xd248('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x39d531[_0xd248('0x18')]||0x3;this[_0xd248('0x19')]=_0x39d531[_0xd248('0x19')]||0x96;this[_0xd248('0x1a')]=_0x39d531[_0xd248('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x39d531[_0xd248('0x1b')]||0x96;this[_0xd248('0x1c')]=_0x39d531[_0xd248('0x1c')]||0x3;this[_0xd248('0x1d')]=_0x39d531[_0xd248('0x1d')]||0x96;this[_0xd248('0x1e')]=_0x39d531[_0xd248('0x1e')]||_0xd248('0x1f');this[_0xd248('0x20')]=_0x39d531[_0xd248('0x20')]||undefined;this[_0xd248('0x21')]=_0x39d531[_0xd248('0x21')]||undefined;this[_0xd248('0x22')]=_0x39d531['dialCutDigit']||undefined;this['TrunkBackup']=_0x39d531[_0xd248('0x23')]?_0x39d531['TrunkBackup']:undefined;this[_0xd248('0x24')]=_0x39d531[_0xd248('0x24')]?_0x39d531[_0xd248('0x24')]:undefined;this[_0xd248('0x25')]=_0x39d531[_0xd248('0x25')]?_0x39d531[_0xd248('0x25')]:undefined;this['SquareProject']=_0x39d531[_0xd248('0x26')]?_0x39d531[_0xd248('0x26')]:undefined;this[_0xd248('0x27')]=_0x39d531[_0xd248('0x26')]?_0x39d531['SquareProject'][_0xd248('0x0')]:undefined;this['dialAMDActive']=_0x39d531[_0xd248('0x28')]||![];this[_0xd248('0x29')]=_0x39d531[_0xd248('0x29')];this[_0xd248('0x2a')]=_0x39d531[_0xd248('0x2a')];this[_0xd248('0x2b')]=_0x39d531[_0xd248('0x2b')];this['dialAMDTotalAnalysisTime']=_0x39d531[_0xd248('0x2c')];this[_0xd248('0x2d')]=_0x39d531[_0xd248('0x2d')];this['dialAMDBetweenWordsSilence']=_0x39d531['dialAMDBetweenWordsSilence'];this[_0xd248('0x2e')]=_0x39d531['dialAMDMaximumNumberOfWords'];this[_0xd248('0x2f')]=_0x39d531[_0xd248('0x2f')];this['dialAMDMaximumWordLength']=_0x39d531[_0xd248('0x30')];}module[_0xd248('0x31')]=Campaign;
\ No newline at end of file
index 4df098f..d4cc521 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f2e=['exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','answered','answertime','lastapplication','lastdata','duration','billableseconds','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime'];(function(_0x8d7f4d,_0x3c6f1c){var _0x42b135=function(_0x1ebb7e){while(--_0x1ebb7e){_0x8d7f4d['push'](_0x8d7f4d['shift']());}};_0x42b135(++_0x3c6f1c);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x26a10d,_0xe5c001){_0x26a10d=_0x26a10d-0x0;var _0xf90201=_0x3f2e[_0x26a10d];return _0xf90201;};'use strict';function Channel(){this[_0xe3f2('0x0')]=null;this['channel']='';this[_0xe3f2('0x1')]='';this[_0xe3f2('0x2')]=0x0;this[_0xe3f2('0x3')]='';this[_0xe3f2('0x4')]=undefined;this[_0xe3f2('0x5')]=undefined;this[_0xe3f2('0x6')]=0x0;this[_0xe3f2('0x7')]='';this['uniqueid']=0x0;this[_0xe3f2('0x8')]=0x0;this['exten']=0x0;this[_0xe3f2('0x9')]=![];this[_0xe3f2('0xa')]=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0xe3f2('0xb')]='';this[_0xe3f2('0xc')]='';this[_0xe3f2('0xd')]=0x0;this[_0xe3f2('0xe')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xe3f2('0xf')]=null;this[_0xe3f2('0x10')]=null;this[_0xe3f2('0x11')]=![];this[_0xe3f2('0x12')]=null;this[_0xe3f2('0x13')]=null;this[_0xe3f2('0x14')]=[];this[_0xe3f2('0x15')]=undefined;this[_0xe3f2('0x16')]=undefined;this[_0xe3f2('0x17')]=undefined;this[_0xe3f2('0x18')]=0x0;}module[_0xe3f2('0x19')]=Channel;
\ No newline at end of file
+var _0xdfb1=['transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','monitorFilename','queue','monitors'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x2b5e09,_0x5e15d8){_0x2b5e09=_0x2b5e09-0x0;var _0x5ae0cc=_0xdfb1[_0x2b5e09];return _0x5ae0cc;};'use strict';function Channel(){this[_0x1dfb('0x0')]=null;this[_0x1dfb('0x1')]='';this[_0x1dfb('0x2')]='';this[_0x1dfb('0x3')]=0x0;this['calleridname']='';this[_0x1dfb('0x4')]=undefined;this[_0x1dfb('0x5')]=undefined;this[_0x1dfb('0x6')]=0x0;this[_0x1dfb('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x1dfb('0x8')]=![];this[_0x1dfb('0x9')]=null;this[_0x1dfb('0xa')]=null;this['unmanaged']=![];this[_0x1dfb('0xb')]=![];this[_0x1dfb('0xc')]='';this[_0x1dfb('0xd')]='';this[_0x1dfb('0xe')]=0x0;this['billableseconds']=0x0;this[_0x1dfb('0xf')]=0x0;this[_0x1dfb('0x10')]=null;this[_0x1dfb('0x11')]=null;this['disposition']=null;this[_0x1dfb('0x12')]=![];this[_0x1dfb('0x13')]=null;this[_0x1dfb('0x14')]=null;this[_0x1dfb('0x15')]=[];this[_0x1dfb('0x16')]=undefined;this[_0x1dfb('0x17')]=undefined;this[_0x1dfb('0x18')]=undefined;this[_0x1dfb('0x19')]=0x0;}module[_0x1dfb('0x1a')]=Channel;
\ No newline at end of file
index 70822d6..7ddd46a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14f2=['tokenSecret','type','serverUrl','Configurations','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x2fb24e,_0x85ab8b){var _0x5864cc=function(_0x2edb62){while(--_0x2edb62){_0x2fb24e['push'](_0x2fb24e['shift']());}};_0x5864cc(++_0x85ab8b);}(_0x14f2,0x1c7));var _0x214f=function(_0x14d7fa,_0x2e782c){_0x14d7fa=_0x14d7fa-0x0;var _0x50862e=_0x14f2[_0x14d7fa];return _0x50862e;};'use strict';function DeskAccount(_0x1558e3){this['id']=_0x1558e3['id']||0x0;this['name']=_0x1558e3['name']||'';this['username']=_0x1558e3[_0x214f('0x0')]||'';this[_0x214f('0x1')]=_0x1558e3[_0x214f('0x1')]||'';this[_0x214f('0x2')]=_0x1558e3['authType']||'';this[_0x214f('0x3')]=_0x1558e3['password']||'';this[_0x214f('0x4')]=_0x1558e3['consumerKey']||'';this[_0x214f('0x5')]=_0x1558e3[_0x214f('0x5')]||'';this[_0x214f('0x6')]=_0x1558e3[_0x214f('0x6')]||'';this[_0x214f('0x7')]=_0x1558e3[_0x214f('0x7')]||'';this['type']=_0x1558e3[_0x214f('0x8')]||'';this['serverUrl']=_0x1558e3[_0x214f('0x9')]||'';this[_0x214f('0xa')]=_0x1558e3[_0x214f('0xa')]||{};}module['exports']=DeskAccount;
\ No newline at end of file
+var _0x035e=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x566da6,_0x1db6a1){var _0x35dd63=function(_0x4670a8){while(--_0x4670a8){_0x566da6['push'](_0x566da6['shift']());}};_0x35dd63(++_0x1db6a1);}(_0x035e,0x1ac));var _0xe035=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x035e[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x37e7bf){this['id']=_0x37e7bf['id']||0x0;this[_0xe035('0x0')]=_0x37e7bf[_0xe035('0x0')]||'';this[_0xe035('0x1')]=_0x37e7bf['username']||'';this['remoteUri']=_0x37e7bf[_0xe035('0x2')]||'';this[_0xe035('0x3')]=_0x37e7bf[_0xe035('0x3')]||'';this['password']=_0x37e7bf[_0xe035('0x4')]||'';this[_0xe035('0x5')]=_0x37e7bf['consumerKey']||'';this[_0xe035('0x6')]=_0x37e7bf[_0xe035('0x6')]||'';this[_0xe035('0x7')]=_0x37e7bf[_0xe035('0x7')]||'';this[_0xe035('0x8')]=_0x37e7bf[_0xe035('0x8')]||'';this[_0xe035('0x9')]=_0x37e7bf[_0xe035('0x9')]||'';this[_0xe035('0xa')]=_0x37e7bf[_0xe035('0xa')]||'';this[_0xe035('0xb')]=_0x37e7bf[_0xe035('0xb')]||{};}module[_0xe035('0xc')]=DeskAccount;
\ No newline at end of file
index 6f025d9..aa4fdc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf19=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','username','password','remoteUri','tenantId','clientId'];(function(_0x2e36a6,_0x4eced2){var _0x8e6a87=function(_0x393876){while(--_0x393876){_0x2e36a6['push'](_0x2e36a6['shift']());}};_0x8e6a87(++_0x4eced2);}(_0xdf19,0xa0));var _0x9df1=function(_0x310043,_0x435e95){_0x310043=_0x310043-0x0;var _0x43283d=_0xdf19[_0x310043];return _0x43283d;};'use strict';function Dynamics365Account(_0x42d2b0){this['id']=_0x42d2b0['id']||0x0;this['name']=_0x42d2b0['name']||'';this[_0x9df1('0x0')]=_0x42d2b0['username']||'';this['password']=_0x42d2b0[_0x9df1('0x1')]||'';this[_0x9df1('0x2')]=_0x42d2b0[_0x9df1('0x2')]||'';this[_0x9df1('0x3')]=_0x42d2b0['tenantId']||'';this[_0x9df1('0x4')]=_0x42d2b0['clientId']||'';this[_0x9df1('0x5')]=_0x42d2b0[_0x9df1('0x5')]||{};this['serverUrl']=_0x42d2b0[_0x9df1('0x6')]||'';this['modernAuthentication']=_0x42d2b0[_0x9df1('0x7')]||![];this[_0x9df1('0x8')]=_0x42d2b0['Configurations']||{};this[_0x9df1('0x9')]=_0x42d2b0['CloudProvider']||{};}module[_0x9df1('0xa')]=Dynamics365Account;
\ No newline at end of file
+var _0x8c4d=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x46fe9d,_0x393461){var _0x3387cf=function(_0x2deee9){while(--_0x2deee9){_0x46fe9d['push'](_0x46fe9d['shift']());}};_0x3387cf(++_0x393461);}(_0x8c4d,0x180));var _0xd8c4=function(_0x40b48b,_0x5c29e7){_0x40b48b=_0x40b48b-0x0;var _0x5cbd32=_0x8c4d[_0x40b48b];return _0x5cbd32;};'use strict';function Dynamics365Account(_0x54d66c){this['id']=_0x54d66c['id']||0x0;this[_0xd8c4('0x0')]=_0x54d66c['name']||'';this[_0xd8c4('0x1')]=_0x54d66c[_0xd8c4('0x1')]||'';this['password']=_0x54d66c[_0xd8c4('0x2')]||'';this['remoteUri']=_0x54d66c[_0xd8c4('0x3')]||'';this[_0xd8c4('0x4')]=_0x54d66c['tenantId']||'';this[_0xd8c4('0x5')]=_0x54d66c[_0xd8c4('0x5')]||'';this[_0xd8c4('0x6')]=_0x54d66c[_0xd8c4('0x6')]||{};this[_0xd8c4('0x7')]=_0x54d66c[_0xd8c4('0x7')]||'';this[_0xd8c4('0x8')]=_0x54d66c[_0xd8c4('0x8')]||![];this[_0xd8c4('0x9')]=_0x54d66c[_0xd8c4('0x9')]||{};this[_0xd8c4('0xa')]=_0x54d66c[_0xd8c4('0xa')]||{};}module['exports']=Dynamics365Account;
\ No newline at end of file
index d55b078..852b917 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33a3=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP'];(function(_0x496a63,_0x2d6307){var _0x12581f=function(_0x362230){while(--_0x362230){_0x496a63['push'](_0x496a63['shift']());}};_0x12581f(++_0x2d6307);}(_0x33a3,0xbf));var _0x333a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33a3[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x1801c5){this['id']=_0x1801c5['id']||0x0;this['name']=_0x1801c5[_0x333a('0x0')]||'';this['description']=_0x1801c5[_0x333a('0x1')];this[_0x333a('0x2')]=_0x1801c5[_0x333a('0x2')];this[_0x333a('0x3')]=_0x1801c5[_0x333a('0x3')];this['localstationid']=_0x1801c5[_0x333a('0x4')];this[_0x333a('0x5')]=_0x1801c5[_0x333a('0x5')]||0x960;this[_0x333a('0x6')]=_0x1801c5[_0x333a('0x6')]||0x3840;this[_0x333a('0x7')]=_0x1801c5[_0x333a('0x7')]||_0x333a('0x8');this['gateway']=_0x1801c5['gateway']||'no';this['faxdetect']=_0x1801c5[_0x333a('0x9')]||'no';this['t38timeout']=_0x1801c5[_0x333a('0xa')]||0x1388;this[_0x333a('0xb')]=_0x1801c5[_0x333a('0xb')]||_0x333a('0xc');this[_0x333a('0xd')]=_0x1801c5[_0x333a('0xd')]?_0x1801c5['Trunk']:undefined;this[_0x333a('0xe')]=_0x1801c5[_0x333a('0xe')];this[_0x333a('0xf')]=_0x1801c5[_0x333a('0xf')];}module[_0x333a('0x10')]=FaxAccount;
\ No newline at end of file
+var _0x4c18=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4c18,0x11a));var _0x84c1=function(_0x10b357,_0x43b0f4){_0x10b357=_0x10b357-0x0;var _0x250421=_0x4c18[_0x10b357];return _0x250421;};'use strict';function FaxAccount(_0x59660a){this['id']=_0x59660a['id']||0x0;this[_0x84c1('0x0')]=_0x59660a['name']||'';this[_0x84c1('0x1')]=_0x59660a[_0x84c1('0x1')];this[_0x84c1('0x2')]=_0x59660a[_0x84c1('0x2')];this[_0x84c1('0x3')]=_0x59660a[_0x84c1('0x3')];this[_0x84c1('0x4')]=_0x59660a[_0x84c1('0x4')];this[_0x84c1('0x5')]=_0x59660a[_0x84c1('0x5')]||0x960;this['maxrate']=_0x59660a['maxrate']||0x3840;this[_0x84c1('0x6')]=_0x59660a[_0x84c1('0x6')]||_0x84c1('0x7');this[_0x84c1('0x8')]=_0x59660a['gateway']||'no';this[_0x84c1('0x9')]=_0x59660a[_0x84c1('0x9')]||'no';this[_0x84c1('0xa')]=_0x59660a[_0x84c1('0xa')]||0x1388;this[_0x84c1('0xb')]=_0x59660a[_0x84c1('0xb')]||'SIP';this[_0x84c1('0xc')]=_0x59660a[_0x84c1('0xc')]?_0x59660a[_0x84c1('0xc')]:undefined;this[_0x84c1('0xd')]=_0x59660a[_0x84c1('0xd')];this[_0x84c1('0xe')]=_0x59660a[_0x84c1('0xe')];}module[_0x84c1('0xf')]=FaxAccount;
\ No newline at end of file
index 80c884f..b5a0ba2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x89af=['serverUrl','Configurations','exports','name','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89af,0x1e9));var _0xf89a=function(_0x440e3b,_0x2cc516){_0x440e3b=_0x440e3b-0x0;var _0x4cc139=_0x89af[_0x440e3b];return _0x4cc139;};'use strict';function FreshdeskAccount(_0x2ee5d3){this['id']=_0x2ee5d3['id']||0x0;this['name']=_0x2ee5d3[_0xf89a('0x0')]||'';this['username']=_0x2ee5d3['username']||'';this['apiKey']=_0x2ee5d3[_0xf89a('0x1')]||'';this[_0xf89a('0x2')]=_0x2ee5d3['remoteUri']||'';this[_0xf89a('0x3')]=_0x2ee5d3['serverUrl']||'';this[_0xf89a('0x4')]=_0x2ee5d3['Configurations']||{};}module[_0xf89a('0x5')]=FreshdeskAccount;
\ No newline at end of file
+var _0x5821=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5b74e6,_0x45fb0c){var _0x18c866=function(_0x133831){while(--_0x133831){_0x5b74e6['push'](_0x5b74e6['shift']());}};_0x18c866(++_0x45fb0c);}(_0x5821,0x1cc));var _0x1582=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5821[_0x5b644e];return _0x49c6bf;};'use strict';function FreshdeskAccount(_0x204037){this['id']=_0x204037['id']||0x0;this[_0x1582('0x0')]=_0x204037[_0x1582('0x0')]||'';this[_0x1582('0x1')]=_0x204037[_0x1582('0x1')]||'';this[_0x1582('0x2')]=_0x204037['token']||'';this['remoteUri']=_0x204037[_0x1582('0x3')]||'';this['serverUrl']=_0x204037[_0x1582('0x4')]||'';this[_0x1582('0x5')]=_0x204037[_0x1582('0x5')]||{};}module[_0x1582('0x6')]=FreshdeskAccount;
\ No newline at end of file
index 9b41ee8..84423f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcddb=['serverUrl','Configurations','name','apiKey','remoteUri'];(function(_0x50bd8e,_0x3a98c2){var _0x2d3058=function(_0x531e43){while(--_0x531e43){_0x50bd8e['push'](_0x50bd8e['shift']());}};_0x2d3058(++_0x3a98c2);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x5b745a,_0x3db07d){_0x5b745a=_0x5b745a-0x0;var _0x21e667=_0xcddb[_0x5b745a];return _0x21e667;};'use strict';function FreshsalesAccount(_0x82d2ab){this['id']=_0x82d2ab['id']||0x0;this[_0xbcdd('0x0')]=_0x82d2ab[_0xbcdd('0x0')]||'';this['username']=_0x82d2ab['username']||'';this[_0xbcdd('0x1')]=_0x82d2ab['token']||'';this[_0xbcdd('0x2')]=_0x82d2ab[_0xbcdd('0x2')]||'';this[_0xbcdd('0x3')]=_0x82d2ab[_0xbcdd('0x3')]||'';this['Configurations']=_0x82d2ab[_0xbcdd('0x4')]||{};}module['exports']=FreshsalesAccount;
\ No newline at end of file
+var _0x7722=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x7722,0x14e));var _0x2772=function(_0x300d0e,_0x4fcd1b){_0x300d0e=_0x300d0e-0x0;var _0x1903cb=_0x7722[_0x300d0e];return _0x1903cb;};'use strict';function FreshsalesAccount(_0xb85768){this['id']=_0xb85768['id']||0x0;this[_0x2772('0x0')]=_0xb85768[_0x2772('0x0')]||'';this[_0x2772('0x1')]=_0xb85768[_0x2772('0x1')]||'';this[_0x2772('0x2')]=_0xb85768[_0x2772('0x3')]||'';this[_0x2772('0x4')]=_0xb85768[_0x2772('0x4')]||'';this['serverUrl']=_0xb85768[_0x2772('0x5')]||'';this['Configurations']=_0xb85768[_0x2772('0x6')]||{};}module[_0x2772('0x7')]=FreshsalesAccount;
\ No newline at end of file
index 7113d46..c7b1866 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9261=['voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','exten','lastAssignedTo','motionChannel'];(function(_0x322ffa,_0x2488f4){var _0x4ffd51=function(_0x2737b4){while(--_0x2737b4){_0x322ffa['push'](_0x322ffa['shift']());}};_0x4ffd51(++_0x2488f4);}(_0x9261,0x12a));var _0x1926=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x9261[_0x318dda];return _0x3f97ca;};'use strict';function QueueReport(){this[_0x1926('0x0')]=_0x1926('0x1');this['uniqueid']='';this[_0x1926('0x2')]='';this[_0x1926('0x3')]='';this['queue']='';this[_0x1926('0x4')]=null;this[_0x1926('0x5')]=null;this[_0x1926('0x6')]=0x1;this['count']=0x1;this[_0x1926('0x7')]=![];this[_0x1926('0x8')]=null;this[_0x1926('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x1926('0xa')]=![];this[_0x1926('0xb')]=null;this[_0x1926('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x1926('0xd')]='';this['accountcode']='';this['context']='';this[_0x1926('0xe')]='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0x1926('0xf')]='';this[_0x1926('0x10')]=_0x1926('0x11');this['routealias']=null;this[_0x1926('0x12')]=0x0;this[_0x1926('0x13')]={};}module[_0x1926('0x14')]=QueueReport;
\ No newline at end of file
+var _0x4cff=['queuecallercomplete','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt'];(function(_0x1a4982,_0x34e5b8){var _0x419e9e=function(_0x543ee8){while(--_0x543ee8){_0x1a4982['push'](_0x1a4982['shift']());}};_0x419e9e(++_0x34e5b8);}(_0x4cff,0x1d2));var _0xf4cf=function(_0x46fb38,_0x19c297){_0x46fb38=_0x46fb38-0x0;var _0x9c345e=_0x4cff[_0x46fb38];return _0x9c345e;};'use strict';function QueueReport(){this[_0xf4cf('0x0')]=_0xf4cf('0x1');this['uniqueid']='';this[_0xf4cf('0x2')]='';this[_0xf4cf('0x3')]='';this[_0xf4cf('0x4')]='';this[_0xf4cf('0x5')]=null;this[_0xf4cf('0x6')]=null;this['position']=0x1;this[_0xf4cf('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xf4cf('0x8')]=null;this[_0xf4cf('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xf4cf('0xa')]=null;this[_0xf4cf('0xb')]=0x1;this['channel']='';this[_0xf4cf('0xc')]='';this[_0xf4cf('0xd')]='';this[_0xf4cf('0xe')]='';this[_0xf4cf('0xf')]='';this['exten']='';this[_0xf4cf('0x10')]='';this[_0xf4cf('0x11')]=0x0;this[_0xf4cf('0x12')]=![];this['lastAssignedTo']='';this[_0xf4cf('0x13')]=_0xf4cf('0x14');this[_0xf4cf('0x15')]=null;this[_0xf4cf('0x16')]=0x0;this[_0xf4cf('0x17')]={};}module[_0xf4cf('0x18')]=QueueReport;
\ No newline at end of file
index 7972a75..7a93584 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac60=['Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xac60,0x188));var _0x0ac6=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xac60[_0x3a6efd];return _0x487b9a;};'use strict';function SalesforceAccount(_0x2588e3){this['id']=_0x2588e3['id']||0x0;this[_0x0ac6('0x0')]=_0x2588e3['name']||'';this[_0x0ac6('0x1')]=_0x2588e3[_0x0ac6('0x1')]||'';this['remoteUri']=_0x2588e3['remoteUri']||'';this[_0x0ac6('0x2')]=_0x2588e3[_0x0ac6('0x2')]||'';this[_0x0ac6('0x3')]=_0x2588e3[_0x0ac6('0x3')]||'';this[_0x0ac6('0x4')]=_0x2588e3[_0x0ac6('0x4')]||'';this[_0x0ac6('0x5')]=_0x2588e3[_0x0ac6('0x5')]||'';this[_0x0ac6('0x6')]=_0x2588e3[_0x0ac6('0x6')]||'integrationTab';this[_0x0ac6('0x7')]=_0x2588e3[_0x0ac6('0x7')]||'';this[_0x0ac6('0x8')]=_0x2588e3[_0x0ac6('0x8')]||{};}module[_0x0ac6('0x9')]=SalesforceAccount;
\ No newline at end of file
+var _0x7355=['clientId','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x32fde0,_0x13318b){var _0x4e6f8e=function(_0xc3d4b8){while(--_0xc3d4b8){_0x32fde0['push'](_0x32fde0['shift']());}};_0x4e6f8e(++_0x13318b);}(_0x7355,0x7e));var _0x5735=function(_0x23f42d,_0x3e1072){_0x23f42d=_0x23f42d-0x0;var _0x22aea4=_0x7355[_0x23f42d];return _0x22aea4;};'use strict';function SalesforceAccount(_0x584e7f){this['id']=_0x584e7f['id']||0x0;this[_0x5735('0x0')]=_0x584e7f[_0x5735('0x0')]||'';this['username']=_0x584e7f[_0x5735('0x1')]||'';this[_0x5735('0x2')]=_0x584e7f[_0x5735('0x2')]||'';this['password']=_0x584e7f[_0x5735('0x3')]||'';this[_0x5735('0x4')]=_0x584e7f[_0x5735('0x4')]||'';this['clientSecret']=_0x584e7f['clientSecret']||'';this[_0x5735('0x5')]=_0x584e7f[_0x5735('0x5')]||'';this[_0x5735('0x6')]=_0x584e7f[_0x5735('0x6')]||'integrationTab';this['serverUrl']=_0x584e7f[_0x5735('0x7')]||'';this[_0x5735('0x8')]=_0x584e7f[_0x5735('0x8')]||{};}module[_0x5735('0x9')]=SalesforceAccount;
\ No newline at end of file
index 828de8e..1ba3fa0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x95c2=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x58807a,_0x294a3a){var _0x48fab6=function(_0x1b534c){while(--_0x1b534c){_0x58807a['push'](_0x58807a['shift']());}};_0x48fab6(++_0x294a3a);}(_0x95c2,0xd5));var _0x295c=function(_0x5ab786,_0xd96140){_0x5ab786=_0x5ab786-0x0;var _0x3a2001=_0x95c2[_0x5ab786];return _0x3a2001;};'use strict';function ServicenowAccount(_0xf9d163){this['id']=_0xf9d163['id']||0x0;this[_0x295c('0x0')]=_0xf9d163[_0x295c('0x0')]||'';this['username']=_0xf9d163[_0x295c('0x1')]||'';this[_0x295c('0x2')]=_0xf9d163['password']||'';this['remoteUri']=_0xf9d163[_0x295c('0x3')]||'';this[_0x295c('0x4')]=_0xf9d163[_0x295c('0x4')]||'';this[_0x295c('0x5')]=_0xf9d163[_0x295c('0x5')]||{};}module['exports']=ServicenowAccount;
\ No newline at end of file
+var _0x446d=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x11a314,_0x1a6157){var _0x454609=function(_0x287720){while(--_0x287720){_0x11a314['push'](_0x11a314['shift']());}};_0x454609(++_0x1a6157);}(_0x446d,0x135));var _0xd446=function(_0x4450ae,_0x520665){_0x4450ae=_0x4450ae-0x0;var _0x3f34d0=_0x446d[_0x4450ae];return _0x3f34d0;};'use strict';function ServicenowAccount(_0x105928){this['id']=_0x105928['id']||0x0;this[_0xd446('0x0')]=_0x105928[_0xd446('0x0')]||'';this[_0xd446('0x1')]=_0x105928[_0xd446('0x1')]||'';this['password']=_0x105928[_0xd446('0x2')]||'';this[_0xd446('0x3')]=_0x105928[_0xd446('0x3')]||'';this[_0xd446('0x4')]=_0x105928[_0xd446('0x4')]||'';this[_0xd446('0x5')]=_0x105928[_0xd446('0x5')]||{};}module[_0xd446('0x6')]=ServicenowAccount;
\ No newline at end of file
index 11820da..19f79ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0e0=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x1c4831,_0x3ff74a){var _0x1e6a6d=function(_0x434896){while(--_0x434896){_0x1c4831['push'](_0x1c4831['shift']());}};_0x1e6a6d(++_0x3ff74a);}(_0xd0e0,0xe9));var _0x0d0e=function(_0x5da5e1,_0x3aea4d){_0x5da5e1=_0x5da5e1-0x0;var _0x211c08=_0xd0e0[_0x5da5e1];return _0x211c08;};'use strict';function SugarcrmAccount(_0x1a45ee){this['id']=_0x1a45ee['id']||0x0;this[_0x0d0e('0x0')]=_0x1a45ee[_0x0d0e('0x0')]||'';this[_0x0d0e('0x1')]=_0x1a45ee[_0x0d0e('0x1')]||'';this[_0x0d0e('0x2')]=_0x1a45ee['password']||'';this[_0x0d0e('0x3')]=_0x1a45ee[_0x0d0e('0x3')]||'';this[_0x0d0e('0x4')]=_0x1a45ee[_0x0d0e('0x4')]||'';this['Configurations']=_0x1a45ee[_0x0d0e('0x5')]||{};}module['exports']=SugarcrmAccount;
\ No newline at end of file
+var _0x0207=['name','username','password','remoteUri','serverUrl','exports'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x0207,0x162));var _0x7020=function(_0x2c3d82,_0x24cb41){_0x2c3d82=_0x2c3d82-0x0;var _0x17b428=_0x0207[_0x2c3d82];return _0x17b428;};'use strict';function SugarcrmAccount(_0x289598){this['id']=_0x289598['id']||0x0;this[_0x7020('0x0')]=_0x289598['name']||'';this['username']=_0x289598[_0x7020('0x1')]||'';this[_0x7020('0x2')]=_0x289598[_0x7020('0x2')]||'';this[_0x7020('0x3')]=_0x289598[_0x7020('0x3')]||'';this[_0x7020('0x4')]=_0x289598[_0x7020('0x4')]||'';this['Configurations']=_0x289598['Configurations']||{};}module[_0x7020('0x5')]=SugarcrmAccount;
\ No newline at end of file
index 99d1dff..40c339f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xefdd=['unknown','stateTime','exports','name','accountcode','state'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xefdd,0x75));var _0xdefd=function(_0x6b204f,_0x3376a8){_0x6b204f=_0x6b204f-0x0;var _0x3e07cc=_0xefdd[_0x6b204f];return _0x3e07cc;};'use strict';function Telephone(_0x2aeca1){this['id']=_0x2aeca1['id']||0x0;this[_0xdefd('0x0')]=_0x2aeca1['name']||'';this[_0xdefd('0x1')]=_0x2aeca1[_0xdefd('0x1')]||'';this[_0xdefd('0x2')]=_0xdefd('0x3');this[_0xdefd('0x4')]=0x0;this['status']='unknown';this['address']='';}module[_0xdefd('0x5')]=Telephone;
\ No newline at end of file
+var _0x8127=['unknown','status','address','name','accountcode','state'];(function(_0xae1a6c,_0x36effd){var _0x1c168e=function(_0x55c7a1){while(--_0x55c7a1){_0xae1a6c['push'](_0xae1a6c['shift']());}};_0x1c168e(++_0x36effd);}(_0x8127,0x1d1));var _0x7812=function(_0x36ccac,_0x11dd0c){_0x36ccac=_0x36ccac-0x0;var _0x2942d2=_0x8127[_0x36ccac];return _0x2942d2;};'use strict';function Telephone(_0x138483){this['id']=_0x138483['id']||0x0;this[_0x7812('0x0')]=_0x138483[_0x7812('0x0')]||'';this[_0x7812('0x1')]=_0x138483[_0x7812('0x1')]||'';this[_0x7812('0x2')]=_0x7812('0x3');this['stateTime']=0x0;this[_0x7812('0x4')]=_0x7812('0x3');this[_0x7812('0x5')]='';}module['exports']=Telephone;
\ No newline at end of file
index c72206b..201f9c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['exports','name'];(function(_0x4488b2,_0x37105f){var _0x201a7d=function(_0xf2a02e){while(--_0xf2a02e){_0x4488b2['push'](_0x4488b2['shift']());}};_0x201a7d(++_0x37105f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template;
\ No newline at end of file
+var _0xb10b=['name','html'];(function(_0x351b7f,_0x385f57){var _0x26d4ae=function(_0x57d95f){while(--_0x57d95f){_0x351b7f['push'](_0x351b7f['shift']());}};_0x26d4ae(++_0x385f57);}(_0xb10b,0x12a));var _0xbb10=function(_0x51f012,_0x629f0d){_0x51f012=_0x51f012-0x0;var _0x1e3e8f=_0xb10b[_0x51f012];return _0x1e3e8f;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template;
\ No newline at end of file
index da2b287..c91399b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x591217,_0x285c40){var _0x160832=function(_0x47a215){while(--_0x47a215){_0x591217['push'](_0x591217['shift']());}};_0x160832(++_0x285c40);}(_0x14a0,0x8e));var _0x014a=function(_0x36342d,_0x5d9c76){_0x36342d=_0x36342d-0x0;var _0x4d2176=_0x14a0[_0x36342d];return _0x4d2176;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger;
\ No newline at end of file
+var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18a4f7,_0x3f915c){_0x18a4f7=_0x18a4f7-0x0;var _0x368cf3=_0x0b0e[_0x18a4f7];return _0x368cf3;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger;
\ No newline at end of file
index 756e366..837dc94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcaaa=['indexOf','host','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','registry'];(function(_0x599547,_0x21e3b7){var _0x411e0b=function(_0x2caf31){while(--_0x2caf31){_0x599547['push'](_0x599547['shift']());}};_0x411e0b(++_0x21e3b7);}(_0xcaaa,0x8a));var _0xacaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaaa[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x3f8641){this['id']=_0x3f8641['id']||0x0;this[_0xacaa('0x0')]=_0x3f8641[_0xacaa('0x0')]||![];this[_0xacaa('0x1')]=_0x3f8641[_0xacaa('0x1')]||'';this[_0xacaa('0x2')]=_0xacaa('0x3');this[_0xacaa('0x4')]=0x0;this['status']=_0xacaa('0x3');this[_0xacaa('0x5')]=_0x3f8641[_0xacaa('0x5')]&&_0x3f8641[_0xacaa('0x5')][_0xacaa('0x6')](':')?_0x3f8641[_0xacaa('0x5')]['split'](':')[0x0]:'';this[_0xacaa('0x7')]='';this['port']='';this[_0xacaa('0x8')]='';this[_0xacaa('0x9')]='';this[_0xacaa('0xa')]='';this[_0xacaa('0xb')]=_0xacaa('0x3');this[_0xacaa('0xc')]='';this[_0xacaa('0xd')]='';this[_0xacaa('0xe')]=_0x3f8641[_0xacaa('0xe')]||'';}module[_0xacaa('0xf')]=Trunk;
\ No newline at end of file
+var _0xedf2=['registry','indexOf','port','domain','refresh','stateRegistry','address','defaultuser','exports','active','name','unknown','status'];(function(_0x93de0b,_0x1fddb1){var _0x43719c=function(_0x4cc896){while(--_0x4cc896){_0x93de0b['push'](_0x93de0b['shift']());}};_0x43719c(++_0x1fddb1);}(_0xedf2,0x98));var _0x2edf=function(_0x12dca9,_0x28434a){_0x12dca9=_0x12dca9-0x0;var _0x786644=_0xedf2[_0x12dca9];return _0x786644;};'use strict';function Trunk(_0x483488){this['id']=_0x483488['id']||0x0;this[_0x2edf('0x0')]=_0x483488[_0x2edf('0x0')]||![];this[_0x2edf('0x1')]=_0x483488['name']||'';this['state']=_0x2edf('0x2');this['stateTime']=0x0;this[_0x2edf('0x3')]=_0x2edf('0x2');this[_0x2edf('0x4')]=_0x483488[_0x2edf('0x4')]&&_0x483488[_0x2edf('0x4')][_0x2edf('0x5')](':')?_0x483488[_0x2edf('0x4')]['split'](':')[0x0]:'';this['host']='';this[_0x2edf('0x6')]='';this[_0x2edf('0x7')]='';this['domainport']='';this[_0x2edf('0x8')]='';this[_0x2edf('0x9')]=_0x2edf('0x2');this['registrationtime']='';this[_0x2edf('0xa')]='';this[_0x2edf('0xb')]=_0x483488[_0x2edf('0xb')]||'';}module[_0x2edf('0xc')]=Trunk;
\ No newline at end of file
index c9b291b..db0769b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1bd9=['exports','recordingFormat','none','mandatoryDisposition'];(function(_0x7b00da,_0x42f27d){var _0x3745ed=function(_0x1f514a){while(--_0x1f514a){_0x7b00da['push'](_0x7b00da['shift']());}};_0x3745ed(++_0x42f27d);}(_0x1bd9,0x15d));var _0x91bd=function(_0x4f85e2,_0x53bc59){_0x4f85e2=_0x4f85e2-0x0;var _0x2c11c7=_0x1bd9[_0x4f85e2];return _0x2c11c7;};'use strict';function voiceExtension(_0x590f95){this['id']=_0x590f95['id']||0x0;this['exten']=_0x590f95['exten']||'';this[_0x91bd('0x0')]=_0x590f95['recordingFormat']||_0x91bd('0x1');this[_0x91bd('0x2')]=_0x590f95[_0x91bd('0x2')]||![];}module[_0x91bd('0x3')]=voiceExtension;
\ No newline at end of file
+var _0x5022=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5022,0x189));var _0x2502=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x5022[_0x17928f];return _0x500b63;};'use strict';function voiceExtension(_0xef535b){this['id']=_0xef535b['id']||0x0;this[_0x2502('0x0')]=_0xef535b[_0x2502('0x0')]||'';this[_0x2502('0x1')]=_0xef535b[_0x2502('0x1')]||_0x2502('0x2');this[_0x2502('0x3')]=_0xef535b['mandatoryDisposition']||![];}module[_0x2502('0x4')]=voiceExtension;
\ No newline at end of file
index 6156009..3bac91e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa8a6=['predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','ringall','rrmemory','name','monitor_format','type','inbound','total','sumDuration','sumHoldTime','available','inUse','notInUse','unavailable','unknown','acw','acwTimeout','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses'];(function(_0x33a8fb,_0x5256b3){var _0x2b6875=function(_0x14e3c3){while(--_0x14e3c3){_0x33a8fb['push'](_0x33a8fb['shift']());}};_0x2b6875(++_0x5256b3);}(_0xa8a6,0x86));var _0x6a8a=function(_0x1a2871,_0x4ebc1d){_0x1a2871=_0x1a2871-0x0;var _0x5c4719=_0xa8a6[_0x1a2871];return _0x5c4719;};'use strict';var monitorFormat={'wav':_0x6a8a('0x0'),'wav49':_0x6a8a('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x6a8a('0x2'),'leastrecent':_0x6a8a('0x3'),'linear':_0x6a8a('0x4'),'random':'random','ringall':_0x6a8a('0x5'),'rr':'roundrobin','rrmemory':_0x6a8a('0x6'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x37ac55){this['id']=_0x37ac55['id']||0x0;this[_0x6a8a('0x7')]=_0x37ac55[_0x6a8a('0x7')]||'';this[_0x6a8a('0x8')]=_0x37ac55[_0x6a8a('0x8')]||'';this[_0x6a8a('0x9')]=_0x37ac55[_0x6a8a('0x9')]||_0x6a8a('0xa');this['waiting']=0x0;this[_0x6a8a('0xb')]=0x0;this['answered']=0x0;this[_0x6a8a('0xc')]=0x0;this[_0x6a8a('0xd')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x6a8a('0xe')]=0x0;this['busy']=0x0;this[_0x6a8a('0xf')]=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x6a8a('0x10')]=0x0;this['onHold']=0x0;this['paused']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0x6a8a('0x11')]=0x0;this[_0x6a8a('0x12')]=0x0;this[_0x6a8a('0x13')]=_0x37ac55[_0x6a8a('0x13')]||![];this[_0x6a8a('0x14')]=_0x37ac55[_0x6a8a('0x14')]||0xa;this['autopause']=_0x37ac55['autopause']||'no';this[_0x6a8a('0x15')]=!![];this[_0x6a8a('0x16')]='';this[_0x6a8a('0x17')]='';this[_0x6a8a('0x18')]=0x0;this[_0x6a8a('0x19')]=0x0;this[_0x6a8a('0x1a')]=_0x37ac55[_0x6a8a('0x1a')]||null;this[_0x6a8a('0x1b')]=_0x37ac55[_0x6a8a('0x1b')]?_0x37ac55['dialGlobalInterval']:null;this['dialActive']=_0x37ac55['dialActive'];this['dialMethod']=_0x37ac55[_0x6a8a('0x1c')]||_0x6a8a('0x1d');this[_0x6a8a('0x1e')]=_0x37ac55[_0x6a8a('0x1e')]||0x0;this['dialLimitQueue']=_0x37ac55[_0x6a8a('0x1f')]||0x0;this[_0x6a8a('0x20')]=_0x37ac55[_0x6a8a('0x20')]||0x1;this['dialPredictiveOptimization']=_0x37ac55['dialPredictiveOptimization']||_0x6a8a('0x21');this['dialPredictiveOptimizationPercentage']=_0x37ac55[_0x6a8a('0x22')]||0.03;this[_0x6a8a('0x23')]=_0x37ac55[_0x6a8a('0x23')]||0x258;this[_0x6a8a('0x24')]=_0x37ac55[_0x6a8a('0x24')]||_0x6a8a('0x25');this[_0x6a8a('0x26')]=_0x37ac55[_0x6a8a('0x26')]||_0x6a8a('0x25');this['dialOriginateTimeout']=_0x37ac55[_0x6a8a('0x27')]||0x1e;this[_0x6a8a('0x28')]=_0x37ac55['dialQueueOptions']||_0x6a8a('0x29');this[_0x6a8a('0x2a')]=_0x37ac55[_0x6a8a('0x2a')]||0x3;this[_0x6a8a('0x2b')]=_0x37ac55[_0x6a8a('0x2b')]||undefined;this[_0x6a8a('0x2c')]=_0x37ac55[_0x6a8a('0x2c')]||0x3;this[_0x6a8a('0x2d')]=_0x37ac55[_0x6a8a('0x2d')]||0x96;this['dialBusyMaxRetry']=_0x37ac55[_0x6a8a('0x2e')]||0x3;this[_0x6a8a('0x2f')]=_0x37ac55[_0x6a8a('0x2f')]||0x96;this['dialNoAnswerMaxRetry']=_0x37ac55['dialNoAnswerMaxRetry']||0x3;this[_0x6a8a('0x30')]=_0x37ac55[_0x6a8a('0x30')]||0x96;this[_0x6a8a('0x31')]=_0x37ac55[_0x6a8a('0x31')]||0x3;this[_0x6a8a('0x32')]=_0x37ac55[_0x6a8a('0x32')]||0x96;this[_0x6a8a('0x33')]=_0x37ac55[_0x6a8a('0x33')]||0x3;this[_0x6a8a('0x34')]=_0x37ac55['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x37ac55[_0x6a8a('0x35')]||0x3;this[_0x6a8a('0x36')]=_0x37ac55[_0x6a8a('0x36')]||0x96;this['dialMachineMaxRetry']=_0x37ac55['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x37ac55[_0x6a8a('0x37')]||0x96;this[_0x6a8a('0x38')]=_0x37ac55['dialAgentRejectMaxRetry']||0x3;this[_0x6a8a('0x39')]=_0x37ac55['dialAgentRejectRetryFrequency']||0x96;this[_0x6a8a('0x3a')]=_0x37ac55[_0x6a8a('0x3a')]||0x3;this[_0x6a8a('0x3b')]=_0x37ac55['dialGlobalMaxRetry']||0x4;this[_0x6a8a('0x3c')]=_0x37ac55[_0x6a8a('0x3c')]?_0x37ac55[_0x6a8a('0x3c')]:undefined;this[_0x6a8a('0x3d')]=_0x37ac55[_0x6a8a('0x3d')]?_0x37ac55[_0x6a8a('0x3d')]:undefined;this[_0x6a8a('0x3e')]=_0x37ac55[_0x6a8a('0x3e')]||undefined;this['Interval']=_0x37ac55['Interval']?_0x37ac55[_0x6a8a('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x37ac55['dialOrderByScheduledAt']||_0x6a8a('0x40');this[_0x6a8a('0x41')]=_0x37ac55['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6a8a('0x42')]=_0x37ac55['dialCutDigit']||undefined;this[_0x6a8a('0x43')]=strategy[_0x37ac55['strategy']];this[_0x6a8a('0x44')]=!![];this[_0x6a8a('0x45')]=_0x37ac55[_0x6a8a('0x45')]||![];this[_0x6a8a('0x46')]=_0x37ac55[_0x6a8a('0x46')];this['dialAMDGreeting']=_0x37ac55[_0x6a8a('0x47')];this[_0x6a8a('0x48')]=_0x37ac55[_0x6a8a('0x48')];this['dialAMDTotalAnalysisTime']=_0x37ac55['dialAMDTotalAnalysisTime'];this[_0x6a8a('0x49')]=_0x37ac55[_0x6a8a('0x49')];this[_0x6a8a('0x4a')]=_0x37ac55['dialAMDBetweenWordsSilence'];this[_0x6a8a('0x4b')]=_0x37ac55[_0x6a8a('0x4b')];this['dialAMDSilenceThreshold']=_0x37ac55[_0x6a8a('0x4c')];this[_0x6a8a('0x4d')]=_0x37ac55[_0x6a8a('0x4d')];this[_0x6a8a('0x4e')]=0x0;this[_0x6a8a('0x4f')]=0x0;this[_0x6a8a('0x50')]=_0x37ac55[_0x6a8a('0x50')];this[_0x6a8a('0x51')]=0x0;this[_0x6a8a('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6a8a('0x53')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x6a8a('0x54')]=0x0;this[_0x6a8a('0x55')]=0x0;this[_0x6a8a('0x56')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x6a8a('0x57')]=0x0;this[_0x6a8a('0x58')]=0x0;this[_0x6a8a('0x59')]=0x0;this[_0x6a8a('0x5a')]=0x0;this[_0x6a8a('0x5b')]=undefined;this['startPredictive']=undefined;this[_0x6a8a('0x5c')]=undefined;this[_0x6a8a('0x5d')]=1.05;this[_0x6a8a('0x5e')]=0x0;this[_0x6a8a('0x5f')]=0x0;this[_0x6a8a('0x60')]=0x0;this[_0x6a8a('0x61')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x6a8a('0x62')]=0x0;this[_0x6a8a('0x63')]=0x0;this[_0x6a8a('0x64')]=0x0;this[_0x6a8a('0x65')]=_0x37ac55['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x6a8a('0x66')]=_0x37ac55[_0x6a8a('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x6a8a('0x68')]=0x1;this[_0x6a8a('0x69')]=0x0;this[_0x6a8a('0x6a')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6a8a('0x6b')]=0x0;this[_0x6a8a('0x6c')]=_0x37ac55[_0x6a8a('0x6c')]||0x1e;this[_0x6a8a('0x6d')]=_0x37ac55['dialRecallInQueue']||![];this[_0x6a8a('0x6e')]=!!_0x37ac55[_0x6a8a('0x6e')]||![];this['dialPreviewRecallmeReminder']=!!_0x37ac55['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x37ac55[_0x6a8a('0x6f')]||undefined;this['dialAgiAfterHangupClient']=_0x37ac55['dialAgiAfterHangupClient']||![];this[_0x6a8a('0x70')]=_0x37ac55[_0x6a8a('0x70')]||![];this[_0x6a8a('0x8')]=monitorFormat[_0x37ac55[_0x6a8a('0x8')]]?monitorFormat[_0x37ac55[_0x6a8a('0x8')]]:undefined;this['mandatoryDisposition']=_0x37ac55[_0x6a8a('0x71')]||![];this[_0x6a8a('0x72')]=_0x37ac55[_0x6a8a('0x72')]?_0x37ac55['mandatoryDispositionPause']:undefined;this[_0x6a8a('0x73')]=![];}module[_0x6a8a('0x74')]=VoiceQueue;
\ No newline at end of file
+var _0x6d7d=['unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x6d7d,0x178));var _0xd6d7=function(_0x41d2b3,_0x2c2a1d){_0x41d2b3=_0x41d2b3-0x0;var _0x9e595a=_0x6d7d[_0x41d2b3];return _0x9e595a;};'use strict';var monitorFormat={'wav':_0xd6d7('0x0'),'wav49':'wav49','gsm':_0xd6d7('0x1')};var strategy={'fewestcalls':_0xd6d7('0x2'),'leastrecent':'leastrecent','linear':_0xd6d7('0x3'),'random':_0xd6d7('0x4'),'ringall':_0xd6d7('0x5'),'rr':_0xd6d7('0x6'),'rrmemory':_0xd6d7('0x7'),'rrordered':_0xd6d7('0x8'),'wrandom':_0xd6d7('0x9')};function VoiceQueue(_0x33ea00){this['id']=_0x33ea00['id']||0x0;this['name']=_0x33ea00[_0xd6d7('0xa')]||'';this['monitor_format']=_0x33ea00[_0xd6d7('0xb')]||'';this[_0xd6d7('0xc')]=_0x33ea00['type']||_0xd6d7('0xd');this[_0xd6d7('0xe')]=0x0;this['total']=0x0;this[_0xd6d7('0xf')]=0x0;this[_0xd6d7('0x10')]=0x0;this[_0xd6d7('0x11')]=0x0;this[_0xd6d7('0x12')]=0x0;this[_0xd6d7('0x13')]=0x0;this[_0xd6d7('0x14')]=0x0;this[_0xd6d7('0x15')]=0x0;this[_0xd6d7('0x16')]=0x0;this[_0xd6d7('0x17')]=0x0;this[_0xd6d7('0x18')]=0x0;this[_0xd6d7('0x19')]=0x0;this[_0xd6d7('0x1a')]=0x0;this['onHold']=0x0;this[_0xd6d7('0x1b')]=0x0;this[_0xd6d7('0x1c')]=0x0;this[_0xd6d7('0x1d')]=0x0;this[_0xd6d7('0x1e')]=0x0;this[_0xd6d7('0x1f')]=0x0;this[_0xd6d7('0x20')]=0x0;this['acw']=_0x33ea00[_0xd6d7('0x21')]||![];this[_0xd6d7('0x22')]=_0x33ea00['acwTimeout']||0xa;this[_0xd6d7('0x23')]=_0x33ea00['autopause']||'no';this[_0xd6d7('0x24')]=!![];this[_0xd6d7('0x25')]='';this[_0xd6d7('0x26')]='';this['originated']=0x0;this[_0xd6d7('0x27')]=0x0;this['dialTimezone']=_0x33ea00['dialTimezone']||null;this[_0xd6d7('0x28')]=_0x33ea00[_0xd6d7('0x28')]?_0x33ea00[_0xd6d7('0x28')]:null;this['dialActive']=_0x33ea00[_0xd6d7('0x29')];this[_0xd6d7('0x2a')]=_0x33ea00[_0xd6d7('0x2a')]||_0xd6d7('0x2b');this['dialLimitChannel']=_0x33ea00[_0xd6d7('0x2c')]||0x0;this[_0xd6d7('0x2d')]=_0x33ea00[_0xd6d7('0x2d')]||0x0;this[_0xd6d7('0x2e')]=_0x33ea00['dialPowerLevel']||0x1;this[_0xd6d7('0x2f')]=_0x33ea00['dialPredictiveOptimization']||_0xd6d7('0x30');this[_0xd6d7('0x31')]=_0x33ea00[_0xd6d7('0x31')]||0.03;this[_0xd6d7('0x32')]=_0x33ea00[_0xd6d7('0x32')]||0x258;this[_0xd6d7('0x33')]=_0x33ea00[_0xd6d7('0x33')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x33ea00[_0xd6d7('0x34')]||_0xd6d7('0x35');this['dialOriginateTimeout']=_0x33ea00['dialOriginateTimeout']||0x1e;this[_0xd6d7('0x36')]=_0x33ea00[_0xd6d7('0x36')]||_0xd6d7('0x37');this['dialQueueTimeout']=_0x33ea00[_0xd6d7('0x38')]||0x3;this[_0xd6d7('0x39')]=_0x33ea00[_0xd6d7('0x39')]||undefined;this[_0xd6d7('0x3a')]=_0x33ea00['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x33ea00[_0xd6d7('0x3b')]||0x96;this[_0xd6d7('0x3c')]=_0x33ea00[_0xd6d7('0x3c')]||0x3;this['dialBusyRetryFrequency']=_0x33ea00[_0xd6d7('0x3d')]||0x96;this[_0xd6d7('0x3e')]=_0x33ea00[_0xd6d7('0x3e')]||0x3;this[_0xd6d7('0x3f')]=_0x33ea00['dialNoAnswerRetryFrequency']||0x96;this[_0xd6d7('0x40')]=_0x33ea00[_0xd6d7('0x40')]||0x3;this[_0xd6d7('0x41')]=_0x33ea00[_0xd6d7('0x41')]||0x96;this['dialDropMaxRetry']=_0x33ea00[_0xd6d7('0x42')]||0x3;this[_0xd6d7('0x43')]=_0x33ea00[_0xd6d7('0x43')]||0x96;this[_0xd6d7('0x44')]=_0x33ea00[_0xd6d7('0x44')]||0x3;this[_0xd6d7('0x45')]=_0x33ea00['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x33ea00[_0xd6d7('0x46')]||0x3;this['dialMachineRetryFrequency']=_0x33ea00[_0xd6d7('0x47')]||0x96;this[_0xd6d7('0x48')]=_0x33ea00[_0xd6d7('0x48')]||0x3;this[_0xd6d7('0x49')]=_0x33ea00['dialAgentRejectRetryFrequency']||0x96;this[_0xd6d7('0x4a')]=_0x33ea00[_0xd6d7('0x4a')]||0x3;this['dialGlobalMaxRetry']=_0x33ea00['dialGlobalMaxRetry']||0x4;this[_0xd6d7('0x4b')]=_0x33ea00[_0xd6d7('0x4b')]?_0x33ea00[_0xd6d7('0x4b')]:undefined;this['TrunkBackup']=_0x33ea00[_0xd6d7('0x4c')]?_0x33ea00['TrunkBackup']:undefined;this[_0xd6d7('0x4d')]=_0x33ea00[_0xd6d7('0x4d')]||undefined;this['Interval']=_0x33ea00[_0xd6d7('0x4e')]?_0x33ea00[_0xd6d7('0x4e')]:undefined;this['dialOrderByScheduledAt']=_0x33ea00['dialOrderByScheduledAt']||_0xd6d7('0x4f');this['dialRandomLastDigitCallerIdNumber']=_0x33ea00[_0xd6d7('0x50')]||undefined;this['dialCutDigit']=_0x33ea00[_0xd6d7('0x51')]||undefined;this[_0xd6d7('0x52')]=strategy[_0x33ea00['strategy']];this[_0xd6d7('0x53')]=!![];this[_0xd6d7('0x54')]=_0x33ea00[_0xd6d7('0x54')]||![];this['dialAMDInitialSilence']=_0x33ea00[_0xd6d7('0x55')];this['dialAMDGreeting']=_0x33ea00[_0xd6d7('0x56')];this[_0xd6d7('0x57')]=_0x33ea00[_0xd6d7('0x57')];this['dialAMDTotalAnalysisTime']=_0x33ea00['dialAMDTotalAnalysisTime'];this[_0xd6d7('0x58')]=_0x33ea00[_0xd6d7('0x58')];this[_0xd6d7('0x59')]=_0x33ea00[_0xd6d7('0x59')];this[_0xd6d7('0x5a')]=_0x33ea00[_0xd6d7('0x5a')];this[_0xd6d7('0x5b')]=_0x33ea00['dialAMDSilenceThreshold'];this[_0xd6d7('0x5c')]=_0x33ea00[_0xd6d7('0x5c')];this[_0xd6d7('0x5d')]=0x0;this[_0xd6d7('0x5e')]=0x0;this['timeout']=_0x33ea00[_0xd6d7('0x5f')];this['outboundAnswerCallsDay']=0x0;this[_0xd6d7('0x60')]=0x0;this[_0xd6d7('0x61')]=0x0;this[_0xd6d7('0x62')]=0x0;this[_0xd6d7('0x63')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xd6d7('0x64')]=0x0;this[_0xd6d7('0x65')]=0x0;this[_0xd6d7('0x66')]=0x0;this[_0xd6d7('0x67')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xd6d7('0x68')]=0x0;this[_0xd6d7('0x69')]=0x0;this[_0xd6d7('0x6a')]=0x0;this['startProgressive']=undefined;this[_0xd6d7('0x6b')]=undefined;this[_0xd6d7('0x6c')]=undefined;this[_0xd6d7('0x6d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xd6d7('0x6e')]=0x0;this[_0xd6d7('0x6f')]=0x0;this[_0xd6d7('0x70')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xd6d7('0x71')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xd6d7('0x72')]=0x0;this[_0xd6d7('0x73')]=_0x33ea00['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xd6d7('0x74')]=_0x33ea00[_0xd6d7('0x75')]||0xa;this[_0xd6d7('0x76')]=0x0;this[_0xd6d7('0x77')]=0x0;this[_0xd6d7('0x78')]=0x1;this[_0xd6d7('0x79')]=0x0;this[_0xd6d7('0x7a')]=0x0;this[_0xd6d7('0x7b')]=0x0;this[_0xd6d7('0x7c')]=0x0;this['dialRecallMeTimeout']=_0x33ea00[_0xd6d7('0x7d')]||0x1e;this[_0xd6d7('0x7e')]=_0x33ea00[_0xd6d7('0x7e')]||![];this['dialPreviewAutoRecallMe']=!!_0x33ea00[_0xd6d7('0x7f')]||![];this[_0xd6d7('0x80')]=!!_0x33ea00[_0xd6d7('0x80')]||![];this[_0xd6d7('0x81')]=_0x33ea00[_0xd6d7('0x81')]||undefined;this[_0xd6d7('0x82')]=_0x33ea00[_0xd6d7('0x82')]||![];this[_0xd6d7('0x83')]=_0x33ea00[_0xd6d7('0x83')]||![];this[_0xd6d7('0xb')]=monitorFormat[_0x33ea00[_0xd6d7('0xb')]]?monitorFormat[_0x33ea00[_0xd6d7('0xb')]]:undefined;this[_0xd6d7('0x84')]=_0x33ea00[_0xd6d7('0x84')]||![];this[_0xd6d7('0x85')]=_0x33ea00[_0xd6d7('0x85')]?_0x33ea00[_0xd6d7('0x85')]:undefined;this[_0xd6d7('0x86')]=![];}module[_0xd6d7('0x87')]=VoiceQueue;
\ No newline at end of file
index c9a5555..3e75ba9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9973=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','unavailable','unknown','unmanaged','type','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','incall','status','booked','keys','length','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','ringing','talking','waiting','available','answered','inUse','outboundAbandonedCallsDay'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x9973,0x157));var _0x3997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9973[_0x40a045];return _0x1a687c;};'use strict';var INBOUND_COUNTERS=['available',_0x3997('0x0'),_0x3997('0x1'),'paused',_0x3997('0x2'),_0x3997('0x3'),_0x3997('0x4')];var OUTBOUND_COUNTERS=[_0x3997('0x5'),_0x3997('0x6'),_0x3997('0x7'),_0x3997('0x0'),'loggedInDb','originated',_0x3997('0x8'),_0x3997('0x9'),_0x3997('0xa'),'outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x3997('0xb'),_0x3997('0xc'),_0x3997('0xd'),_0x3997('0xe'),_0x3997('0xf'),_0x3997('0x10'),_0x3997('0x3'),_0x3997('0x11'),_0x3997('0x12'),_0x3997('0x13'),_0x3997('0x4')];function VoiceQueueSummary(_0xaed665){this['id']=_0xaed665['id'];this[_0x3997('0x14')]=_0xaed665[_0x3997('0x14')];this[_0x3997('0x15')]=_0xaed665[_0x3997('0x15')];this[_0x3997('0x16')]=_0xaed665[_0x3997('0x16')]||0x0;this[_0x3997('0x6')]=_0xaed665[_0x3997('0x6')]||0x0;this[_0x3997('0x5')]=_0xaed665[_0x3997('0x5')]||0x0;this[_0x3997('0x17')]=_0xaed665['busy']||0x0;this[_0x3997('0x7')]=_0xaed665[_0x3997('0x7')]||0x0;this[_0x3997('0x18')]=_0xaed665[_0x3997('0x18')]||0x0;this['loggedIn']=_0xaed665[_0x3997('0x0')]||0x0;this[_0x3997('0x1')]=_0xaed665['loggedInDb']||0x0;this['onHold']=_0xaed665[_0x3997('0x19')]||0x0;this[_0x3997('0x1a')]=_0xaed665['notInUse']||0x0;this[_0x3997('0xf')]=_0xaed665[_0x3997('0xf')]||0x0;this[_0x3997('0x2')]=_0xaed665[_0x3997('0x2')]||0x0;this[_0x3997('0x1b')]=_0xaed665['ringInUse'];this[_0x3997('0x11')]=_0xaed665[_0x3997('0x11')];this[_0x3997('0x12')]=_0xaed665['sumDuration'];this[_0x3997('0x1c')]=_0xaed665[_0x3997('0x1c')]||0x0;this['talking']=_0xaed665[_0x3997('0x3')]||0x0;this[_0x3997('0x13')]=_0xaed665[_0x3997('0x13')]||0x0;this['type']=_0xaed665['type'];this[_0x3997('0x1d')]=_0xaed665[_0x3997('0x1d')]||0x0;this[_0x3997('0x1e')]=_0xaed665[_0x3997('0x1e')]||0x0;this['unmanaged']=_0xaed665[_0x3997('0x1f')]||0x0;this['waiting']=_0xaed665['waiting']||0x0;if(_0xaed665[_0x3997('0x20')]===_0x3997('0x21')){this['pTalking']=_0xaed665['pTalking']||0x0;this[_0x3997('0x22')]=_0xaed665[_0x3997('0x22')];this[_0x3997('0x23')]=_0xaed665['dialMethod'];this['dialOriginateCallerIdName']=_0xaed665['dialOriginateCallerIdName'];this[_0x3997('0x24')]=_0xaed665[_0x3997('0x24')];this[_0x3997('0x25')]=_0xaed665[_0x3997('0x25')];this[_0x3997('0x26')]=_0xaed665[_0x3997('0x26')];this['temp']=_0xaed665['temp'];this[_0x3997('0x27')]=_0xaed665[_0x3997('0x27')];this['outboundAnswerCallsDay']=_0xaed665[_0x3997('0x9')];this[_0x3997('0xa')]=_0xaed665[_0x3997('0xa')];this[_0x3997('0x28')]=_0xaed665[_0x3997('0x28')];this[_0x3997('0x29')]=_0xaed665['outboundCongestionCallsDay'];this[_0x3997('0x2a')]=_0xaed665[_0x3997('0x2a')];this[_0x3997('0x2b')]=_0xaed665[_0x3997('0x2b')];this[_0x3997('0x2c')]=_0xaed665['outboundDropCallsDayTimeout'];this[_0x3997('0x2d')]=_0xaed665[_0x3997('0x2d')];this[_0x3997('0xb')]=_0xaed665[_0x3997('0xb')];this[_0x3997('0x2e')]=_0xaed665[_0x3997('0x2e')];this['outboundReCallsDay']=_0xaed665[_0x3997('0xc')];this[_0x3997('0xd')]=_0xaed665[_0x3997('0xd')];this[_0x3997('0xe')]=_0xaed665[_0x3997('0xe')];this[_0x3997('0x2f')]=_0xaed665[_0x3997('0x2f')];this[_0x3997('0x30')]=_0xaed665[_0x3997('0x30')];this[_0x3997('0x31')]=_0xaed665[_0x3997('0x31')];this[_0x3997('0x32')]=_0xaed665[_0x3997('0x32')];this[_0x3997('0x33')]=_0xaed665[_0x3997('0x33')];this['predictiveIntervalErlangCalls']=_0xaed665[_0x3997('0x34')];this[_0x3997('0x35')]=_0xaed665[_0x3997('0x35')];this[_0x3997('0x36')]=_0xaed665['predictiveIntervalHitRate'];this[_0x3997('0x37')]=_0xaed665[_0x3997('0x37')];this[_0x3997('0x38')]=_0xaed665['predictiveIntervalPauses'];this[_0x3997('0x39')]=_0xaed665[_0x3997('0x39')];this[_0x3997('0x3a')]=_0xaed665[_0x3997('0x3a')];this[_0x3997('0x3b')]=_0xaed665[_0x3997('0x3b')];this[_0x3997('0x3c')]=_0xaed665[_0x3997('0x3c')];this['erlangCallToSecond']=_0xaed665[_0x3997('0x3d')];this['erlangAbandonmentRate']=_0xaed665[_0x3997('0x3e')];this[_0x3997('0x3f')]=_0xaed665[_0x3997('0x3f')];this[_0x3997('0x40')]=_0xaed665['startPredictive'];this[_0x3997('0x41')]=_0xaed665[_0x3997('0x41')];this[_0x3997('0x42')]=_0xaed665[_0x3997('0x42')];this['statusMessage']=_0xaed665[_0x3997('0x43')];}if(_0xaed665['Trunk']){this[_0x3997('0x44')]={'id':_0xaed665[_0x3997('0x44')]['id'],'name':_0xaed665[_0x3997('0x44')][_0x3997('0x14')],'active':_0xaed665[_0x3997('0x44')][_0x3997('0x45')],'callerid':_0xaed665[_0x3997('0x44')]['callerid']};}}VoiceQueueSummary[_0x3997('0x46')][_0x3997('0x47')]=function(_0x92bcf1,_0x3fd51a,_0x536fd7,_0x5ebe60){this[_0x3997('0x1')]=0x0;this['talking']=0x0;this[_0x3997('0xf')]=0x0;this[_0x3997('0x1e')]=0x0;this[_0x3997('0x1a')]=0x0;this[_0x3997('0x7')]=0x0;this['busy']=0x0;this[_0x3997('0x18')]=0x0;this[_0x3997('0x1d')]=0x0;this['ringing']=0x0;this[_0x3997('0x1b')]=0x0;this[_0x3997('0x19')]=0x0;if(_0x536fd7){if(_0x536fd7[_0x3997('0x5')]){this[_0x3997('0x5')]=Number(_0x536fd7[_0x3997('0x5')]);}if(_0x536fd7[_0x3997('0x48')]){this['loggedIn']=Number(_0x536fd7['loggedin']);}if(_0x536fd7['callers']){this[_0x3997('0x4')]=Number(_0x536fd7[_0x3997('0x49')]);}}for(var _0x2a3bfb=0x0;_0x2a3bfb<_0x92bcf1['length'];_0x2a3bfb++){var _0x33a084=_0x3fd51a['SIP/'+_0x92bcf1[_0x2a3bfb]['name']];if(_0x33a084&&_0x33a084['online']){this[_0x3997('0x1')]+=0x1;}if(_0x92bcf1[_0x2a3bfb][_0x3997('0x4a')]==='1'){this[_0x3997('0x3')]+=0x1;}if(_0x92bcf1[_0x2a3bfb][_0x3997('0xf')]==='1'&&!['2','7','8']['includes'](_0x92bcf1[_0x2a3bfb][_0x3997('0x4b')])){this['paused']+=0x1;}switch(_0x92bcf1[_0x2a3bfb][_0x3997('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x3997('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x3997('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x3997('0x1d')]+=0x1;break;case'6':this[_0x3997('0x2')]+=0x1;break;case'7':this[_0x3997('0x1b')]+=0x1;break;case'8':this[_0x3997('0x19')]+=0x1;break;}}if(this[_0x3997('0x23')]===_0x3997('0x4c')){var _0x52e5c8=Object[_0x3997('0x4d')](_0x5ebe60);for(var _0x260170=0x0;_0x260170<_0x52e5c8[_0x3997('0x4e')];_0x260170++){var _0x271a41=_0x52e5c8[_0x260170];var _0x236b33=_0x5ebe60[_0x271a41];if(_0x236b33[_0x3997('0x4f')]===this['name']&&_0x236b33['type']===_0x3997('0x50')&&_0x236b33['exten']===_0x3997('0x51')){this['talking']+=0x1;}}if(this[_0x3997('0x3')]>this[_0x3997('0x7')]){this[_0x3997('0x3')]=this[_0x3997('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x3997('0x52')]=function(_0x4da5a0){var _0x30234e=![];if(_0x4da5a0){_0x30234e=INBOUND_COUNTERS[_0x3997('0x53')](function(_0x14962a){return this[_0x14962a]!==_0x4da5a0[_0x14962a];},this);}return _0x30234e;};VoiceQueueSummary[_0x3997('0x46')][_0x3997('0x54')]=function(_0x1f6d39){var _0x2af697=![];var _0x5fad18=![];var _0x55dee3=![];if(_0x1f6d39){_0x2af697=this[_0x3997('0x23')]!==_0x1f6d39[_0x3997('0x23')]||this[_0x3997('0x22')]!==_0x1f6d39[_0x3997('0x22')]||this[_0x3997('0x42')]!==_0x1f6d39[_0x3997('0x42')]||this[_0x3997('0x43')]!==_0x1f6d39[_0x3997('0x43')];_0x5fad18=OUTBOUND_COUNTERS['some'](function(_0x6c0c35){return this[_0x6c0c35]!==_0x1f6d39[_0x6c0c35];},this);if(this[_0x3997('0x44')]&&_0x1f6d39[_0x3997('0x44')]){_0x55dee3=this['Trunk'][_0x3997('0x14')]!==_0x1f6d39[_0x3997('0x44')][_0x3997('0x14')]||this[_0x3997('0x44')][_0x3997('0x45')]!==_0x1f6d39[_0x3997('0x44')][_0x3997('0x45')];}}return _0x2af697||_0x5fad18||_0x55dee3;};VoiceQueueSummary[_0x3997('0x46')][_0x3997('0x55')]=function(_0x186463){this[_0x3997('0x6')]=_0x186463['answered'];this[_0x3997('0x42')]=_0x186463[_0x3997('0x42')];this[_0x3997('0x43')]=_0x186463[_0x3997('0x43')];this[_0x3997('0x3b')]=_0x186463[_0x3997('0x3b')];this[_0x3997('0x8')]=_0x186463['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x186463[_0x3997('0x9')];this[_0x3997('0xa')]=_0x186463[_0x3997('0xa')];this[_0x3997('0x28')]=_0x186463['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x186463[_0x3997('0x29')];this[_0x3997('0x2d')]=_0x186463[_0x3997('0x2d')];this[_0x3997('0xb')]=_0x186463[_0x3997('0xb')];this[_0x3997('0xc')]=_0x186463['outboundReCallsDay'];this[_0x3997('0xd')]=_0x186463[_0x3997('0xd')];this['outboundUnknownCallsDay']=_0x186463[_0x3997('0xe')];this[_0x3997('0x11')]=_0x186463[_0x3997('0x11')];this['sumDuration']=_0x186463[_0x3997('0x12')];this[_0x3997('0x13')]=_0x186463[_0x3997('0x13')];if(this['dialMethod']===_0x3997('0x56')){this[_0x3997('0x10')]=_0x186463[_0x3997('0x10')];}};module[_0x3997('0x57')]=VoiceQueueSummary;
\ No newline at end of file
+var _0xd13e=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','unknown','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','statusMessage','updateReportFromOutboundQueue','outboundAbandonedCallsDay','exports','available','loggedIn','loggedInDb','paused','talking','inUse','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unmanaged','waiting','outbound','dialActive','dialMethod'];(function(_0x138d02,_0xf96da2){var _0x104f43=function(_0x22513d){while(--_0x22513d){_0x138d02['push'](_0x138d02['shift']());}};_0x104f43(++_0xf96da2);}(_0xd13e,0x193));var _0xed13=function(_0x510a9c,_0x8ad8b5){_0x510a9c=_0x510a9c-0x0;var _0x290590=_0xd13e[_0x510a9c];return _0x290590;};'use strict';var INBOUND_COUNTERS=[_0xed13('0x0'),_0xed13('0x1'),_0xed13('0x2'),_0xed13('0x3'),'ringing',_0xed13('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0xed13('0x0'),'answered',_0xed13('0x5'),_0xed13('0x1'),'loggedInDb','originated','outboundAbandonedCallsDay',_0xed13('0x6'),_0xed13('0x7'),_0xed13('0x8'),_0xed13('0x9'),_0xed13('0xa'),_0xed13('0xb'),_0xed13('0xc'),_0xed13('0xd'),_0xed13('0xe'),'paused',_0xed13('0xf'),_0xed13('0x4'),_0xed13('0x10'),_0xed13('0x11'),_0xed13('0x12'),'waiting'];function VoiceQueueSummary(_0x2731d1){this['id']=_0x2731d1['id'];this[_0xed13('0x13')]=_0x2731d1[_0xed13('0x13')];this[_0xed13('0x14')]=_0x2731d1[_0xed13('0x14')];this[_0xed13('0x15')]=_0x2731d1['abandoned']||0x0;this[_0xed13('0x16')]=_0x2731d1['answered']||0x0;this[_0xed13('0x0')]=_0x2731d1['available']||0x0;this[_0xed13('0x17')]=_0x2731d1['busy']||0x0;this[_0xed13('0x5')]=_0x2731d1['inUse']||0x0;this[_0xed13('0x18')]=_0x2731d1[_0xed13('0x18')]||0x0;this[_0xed13('0x1')]=_0x2731d1[_0xed13('0x1')]||0x0;this[_0xed13('0x2')]=_0x2731d1[_0xed13('0x2')]||0x0;this[_0xed13('0x19')]=_0x2731d1[_0xed13('0x19')]||0x0;this[_0xed13('0x1a')]=_0x2731d1[_0xed13('0x1a')]||0x0;this[_0xed13('0x3')]=_0x2731d1[_0xed13('0x3')]||0x0;this[_0xed13('0x1b')]=_0x2731d1[_0xed13('0x1b')]||0x0;this[_0xed13('0x1c')]=_0x2731d1[_0xed13('0x1c')];this['sumBillable']=_0x2731d1['sumBillable'];this[_0xed13('0x11')]=_0x2731d1[_0xed13('0x11')];this['sumHoldTime']=_0x2731d1[_0xed13('0x1d')]||0x0;this['talking']=_0x2731d1['talking']||0x0;this[_0xed13('0x12')]=_0x2731d1[_0xed13('0x12')]||0x0;this[_0xed13('0x1e')]=_0x2731d1[_0xed13('0x1e')];this[_0xed13('0x1f')]=_0x2731d1[_0xed13('0x1f')]||0x0;this['unknown']=_0x2731d1['unknown']||0x0;this['unmanaged']=_0x2731d1[_0xed13('0x20')]||0x0;this[_0xed13('0x21')]=_0x2731d1[_0xed13('0x21')]||0x0;if(_0x2731d1[_0xed13('0x1e')]===_0xed13('0x22')){this[_0xed13('0xf')]=_0x2731d1[_0xed13('0xf')]||0x0;this[_0xed13('0x23')]=_0x2731d1[_0xed13('0x23')];this[_0xed13('0x24')]=_0x2731d1[_0xed13('0x24')];this[_0xed13('0x25')]=_0x2731d1[_0xed13('0x25')];this[_0xed13('0x26')]=_0x2731d1['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x2731d1[_0xed13('0x27')];this[_0xed13('0x28')]=_0x2731d1['dialPrefix'];this[_0xed13('0x29')]=_0x2731d1[_0xed13('0x29')];this['outboundAnswerAgiCallsDay']=_0x2731d1[_0xed13('0x2a')];this[_0xed13('0x6')]=_0x2731d1[_0xed13('0x6')];this['outboundBlacklistCallsDay']=_0x2731d1[_0xed13('0x7')];this[_0xed13('0x8')]=_0x2731d1['outboundBusyCallsDay'];this[_0xed13('0x9')]=_0x2731d1[_0xed13('0x9')];this['outboundDropCallsDayACS']=_0x2731d1[_0xed13('0x2b')];this[_0xed13('0x2c')]=_0x2731d1[_0xed13('0x2c')];this[_0xed13('0x2d')]=_0x2731d1[_0xed13('0x2d')];this[_0xed13('0xa')]=_0x2731d1[_0xed13('0xa')];this['outboundNoSuchCallsDay']=_0x2731d1[_0xed13('0xb')];this['outboundOriginateFailureCallsDay']=_0x2731d1['outboundOriginateFailureCallsDay'];this[_0xed13('0xc')]=_0x2731d1[_0xed13('0xc')];this[_0xed13('0xd')]=_0x2731d1['outboundRejectCallsDay'];this[_0xed13('0xe')]=_0x2731d1[_0xed13('0xe')];this[_0xed13('0x2e')]=_0x2731d1['predictiveIntervalAnsweredCalls'];this[_0xed13('0x2f')]=_0x2731d1[_0xed13('0x2f')];this[_0xed13('0x30')]=_0x2731d1[_0xed13('0x30')];this['predictiveIntervalDroppedCallsCallersExit']=_0x2731d1[_0xed13('0x31')];this[_0xed13('0x32')]=_0x2731d1[_0xed13('0x32')];this[_0xed13('0x33')]=_0x2731d1[_0xed13('0x33')];this[_0xed13('0x34')]=_0x2731d1[_0xed13('0x34')];this[_0xed13('0x35')]=_0x2731d1[_0xed13('0x35')];this[_0xed13('0x36')]=_0x2731d1['predictiveIntervalMultiplicativeFactor'];this[_0xed13('0x37')]=_0x2731d1[_0xed13('0x37')];this['predictiveIntervalAvailable']=_0x2731d1['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x2731d1[_0xed13('0x38')];this[_0xed13('0x39')]=_0x2731d1['originated'];this['erlangCalls']=_0x2731d1[_0xed13('0x3a')];this[_0xed13('0x3b')]=_0x2731d1[_0xed13('0x3b')];this[_0xed13('0x3c')]=_0x2731d1[_0xed13('0x3c')];this['erlangBusyFactor']=_0x2731d1['erlangBusyFactor'];this[_0xed13('0x3d')]=_0x2731d1['startPredictive'];this[_0xed13('0x3e')]=_0x2731d1['startProgressive'];this[_0xed13('0x3f')]=_0x2731d1['message'];this['statusMessage']=_0x2731d1['statusMessage'];}if(_0x2731d1[_0xed13('0x40')]){this[_0xed13('0x40')]={'id':_0x2731d1[_0xed13('0x40')]['id'],'name':_0x2731d1[_0xed13('0x40')][_0xed13('0x13')],'active':_0x2731d1['Trunk'][_0xed13('0x41')],'callerid':_0x2731d1[_0xed13('0x40')][_0xed13('0x42')]};}}VoiceQueueSummary[_0xed13('0x43')][_0xed13('0x44')]=function(_0x5a8cfb,_0x1623c7,_0x34df0d,_0x24f4ba){this[_0xed13('0x2')]=0x0;this[_0xed13('0x4')]=0x0;this[_0xed13('0x3')]=0x0;this['unknown']=0x0;this[_0xed13('0x1a')]=0x0;this[_0xed13('0x5')]=0x0;this[_0xed13('0x17')]=0x0;this[_0xed13('0x18')]=0x0;this[_0xed13('0x1f')]=0x0;this[_0xed13('0x1b')]=0x0;this[_0xed13('0x1c')]=0x0;this[_0xed13('0x19')]=0x0;if(_0x34df0d){if(_0x34df0d[_0xed13('0x0')]){this[_0xed13('0x0')]=Number(_0x34df0d[_0xed13('0x0')]);}if(_0x34df0d[_0xed13('0x45')]){this[_0xed13('0x1')]=Number(_0x34df0d[_0xed13('0x45')]);}if(_0x34df0d['callers']){this[_0xed13('0x21')]=Number(_0x34df0d[_0xed13('0x46')]);}}for(var _0x51e5ba=0x0;_0x51e5ba<_0x5a8cfb[_0xed13('0x47')];_0x51e5ba++){var _0xbcaba0=_0x1623c7[_0xed13('0x48')+_0x5a8cfb[_0x51e5ba]['name']];if(_0xbcaba0&&_0xbcaba0[_0xed13('0x49')]){this[_0xed13('0x2')]+=0x1;}if(_0x5a8cfb[_0x51e5ba][_0xed13('0x4a')]==='1'){this['talking']+=0x1;}if(_0x5a8cfb[_0x51e5ba]['paused']==='1'&&!['2','7','8'][_0xed13('0x4b')](_0x5a8cfb[_0x51e5ba][_0xed13('0x4c')])){this['paused']+=0x1;}switch(_0x5a8cfb[_0x51e5ba][_0xed13('0x4c')]){case'0':this[_0xed13('0x4d')]+=0x1;break;case'1':this[_0xed13('0x1a')]+=0x1;break;case'2':this[_0xed13('0x5')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xed13('0x18')]+=0x1;break;case'5':this[_0xed13('0x1f')]+=0x1;break;case'6':this[_0xed13('0x1b')]+=0x1;break;case'7':this[_0xed13('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xed13('0x24')]==='booked'){var _0x46dcef=Object['keys'](_0x24f4ba);for(var _0x5a0828=0x0;_0x5a0828<_0x46dcef[_0xed13('0x47')];_0x5a0828++){var _0x3c13ee=_0x46dcef[_0x5a0828];var _0x54a979=_0x24f4ba[_0x3c13ee];if(_0x54a979[_0xed13('0x4e')]===this[_0xed13('0x13')]&&_0x54a979[_0xed13('0x1e')]===_0xed13('0x4f')&&_0x54a979['exten']===_0xed13('0x50')){this['talking']+=0x1;}}if(this[_0xed13('0x4')]>this[_0xed13('0x5')]){this[_0xed13('0x4')]=this[_0xed13('0x5')];}this[_0xed13('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xed13('0x43')][_0xed13('0x51')]=function(_0x35c934){var _0x504080=![];if(_0x35c934){_0x504080=INBOUND_COUNTERS[_0xed13('0x52')](function(_0x38f66d){return this[_0x38f66d]!==_0x35c934[_0x38f66d];},this);}return _0x504080;};VoiceQueueSummary[_0xed13('0x43')][_0xed13('0x53')]=function(_0x54d6bc){var _0x283844=![];var _0x4d4926=![];var _0xc2d85=![];if(_0x54d6bc){_0x283844=this['dialMethod']!==_0x54d6bc['dialMethod']||this['dialActive']!==_0x54d6bc[_0xed13('0x23')]||this[_0xed13('0x3f')]!==_0x54d6bc[_0xed13('0x3f')]||this['statusMessage']!==_0x54d6bc[_0xed13('0x54')];_0x4d4926=OUTBOUND_COUNTERS[_0xed13('0x52')](function(_0x20dafb){return this[_0x20dafb]!==_0x54d6bc[_0x20dafb];},this);if(this[_0xed13('0x40')]&&_0x54d6bc[_0xed13('0x40')]){_0xc2d85=this['Trunk'][_0xed13('0x13')]!==_0x54d6bc[_0xed13('0x40')][_0xed13('0x13')]||this[_0xed13('0x40')]['active']!==_0x54d6bc[_0xed13('0x40')][_0xed13('0x41')];}}return _0x283844||_0x4d4926||_0xc2d85;};VoiceQueueSummary[_0xed13('0x43')][_0xed13('0x55')]=function(_0x170752){this[_0xed13('0x16')]=_0x170752[_0xed13('0x16')];this['message']=_0x170752[_0xed13('0x3f')];this['statusMessage']=_0x170752[_0xed13('0x54')];this['originated']=_0x170752[_0xed13('0x39')];this[_0xed13('0x56')]=_0x170752[_0xed13('0x56')];this[_0xed13('0x6')]=_0x170752[_0xed13('0x6')];this['outboundBlacklistCallsDay']=_0x170752['outboundBlacklistCallsDay'];this[_0xed13('0x8')]=_0x170752[_0xed13('0x8')];this[_0xed13('0x9')]=_0x170752[_0xed13('0x9')];this[_0xed13('0xa')]=_0x170752[_0xed13('0xa')];this[_0xed13('0xb')]=_0x170752[_0xed13('0xb')];this[_0xed13('0xc')]=_0x170752['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x170752['outboundRejectCallsDay'];this[_0xed13('0xe')]=_0x170752[_0xed13('0xe')];this[_0xed13('0x10')]=_0x170752['sumBillable'];this['sumDuration']=_0x170752[_0xed13('0x11')];this[_0xed13('0x12')]=_0x170752[_0xed13('0x12')];if(this['dialMethod']==='preview'){this['pTalking']=_0x170752['pTalking'];}};module[_0xed13('0x57')]=VoiceQueueSummary;
\ No newline at end of file
index c04e420..c05ee66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fa6=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x402070,_0x4f1dd5){var _0x4bfc14=function(_0x376a90){while(--_0x376a90){_0x402070['push'](_0x402070['shift']());}};_0x4bfc14(++_0x4f1dd5);}(_0x7fa6,0x10c));var _0x67fa=function(_0x49a3b7,_0x5d2586){_0x49a3b7=_0x49a3b7-0x0;var _0x569e43=_0x7fa6[_0x49a3b7];return _0x569e43;};'use strict';function VtigerAccount(_0x477adc){this['id']=_0x477adc['id']||0x0;this[_0x67fa('0x0')]=_0x477adc[_0x67fa('0x0')]||'';this[_0x67fa('0x1')]=_0x477adc['username']||'';this['accessKey']=_0x477adc[_0x67fa('0x2')]||'';this[_0x67fa('0x3')]=_0x477adc['remoteUri']||'';this[_0x67fa('0x4')]=_0x477adc['serverUrl']||'';this[_0x67fa('0x5')]=_0x477adc['Configurations']||{};}module[_0x67fa('0x6')]=VtigerAccount;
\ No newline at end of file
+var _0xc102=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x1407e4,_0x549875){var _0xa5b40b=function(_0x429941){while(--_0x429941){_0x1407e4['push'](_0x1407e4['shift']());}};_0xa5b40b(++_0x549875);}(_0xc102,0x9d));var _0x2c10=function(_0x1f313c,_0x2bede1){_0x1f313c=_0x1f313c-0x0;var _0x25af9b=_0xc102[_0x1f313c];return _0x25af9b;};'use strict';function VtigerAccount(_0x2b9912){this['id']=_0x2b9912['id']||0x0;this[_0x2c10('0x0')]=_0x2b9912['name']||'';this[_0x2c10('0x1')]=_0x2b9912[_0x2c10('0x1')]||'';this[_0x2c10('0x2')]=_0x2b9912['accessKey']||'';this[_0x2c10('0x3')]=_0x2b9912[_0x2c10('0x3')]||'';this[_0x2c10('0x4')]=_0x2b9912[_0x2c10('0x4')]||'';this[_0x2c10('0x5')]=_0x2b9912[_0x2c10('0x5')]||{};}module[_0x2c10('0x6')]=VtigerAccount;
\ No newline at end of file
index c4bfb91..bdaba20 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbde2=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbde2,0x159));var _0x2bde=function(_0x585ccf,_0x5ced1b){_0x585ccf=_0x585ccf-0x0;var _0x22ff0c=_0xbde2[_0x585ccf];return _0x22ff0c;};'use strict';function ZendeskAccount(_0x5b7379){this['id']=_0x5b7379['id']||0x0;this[_0x2bde('0x0')]=_0x5b7379[_0x2bde('0x0')]||'';this[_0x2bde('0x1')]=_0x5b7379['username']||'';this[_0x2bde('0x2')]=_0x5b7379['password']||'';this[_0x2bde('0x3')]=_0x5b7379[_0x2bde('0x3')]||'';this[_0x2bde('0x4')]=_0x5b7379[_0x2bde('0x4')]||'';this[_0x2bde('0x5')]=_0x5b7379['authType']||'';this[_0x2bde('0x6')]=_0x5b7379[_0x2bde('0x6')]||_0x2bde('0x7');this[_0x2bde('0x8')]=_0x5b7379[_0x2bde('0x8')]||'';this['Configurations']=_0x5b7379[_0x2bde('0x9')]||{};}module[_0x2bde('0xa')]=ZendeskAccount;
\ No newline at end of file
+var _0x2f4e=['exports','name','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0xbed8cc,_0x502449){var _0x144e56=function(_0x45e603){while(--_0x45e603){_0xbed8cc['push'](_0xbed8cc['shift']());}};_0x144e56(++_0x502449);}(_0x2f4e,0x187));var _0xe2f4=function(_0x4dc25b,_0xfe20cd){_0x4dc25b=_0x4dc25b-0x0;var _0x4eb444=_0x2f4e[_0x4dc25b];return _0x4eb444;};'use strict';function ZendeskAccount(_0x36a474){this['id']=_0x36a474['id']||0x0;this[_0xe2f4('0x0')]=_0x36a474[_0xe2f4('0x0')]||'';this['username']=_0x36a474['username']||'';this[_0xe2f4('0x1')]=_0x36a474[_0xe2f4('0x1')]||'';this[_0xe2f4('0x2')]=_0x36a474[_0xe2f4('0x2')]||'';this[_0xe2f4('0x3')]=_0x36a474[_0xe2f4('0x3')]||'';this['authType']=_0x36a474[_0xe2f4('0x4')]||'';this['type']=_0x36a474[_0xe2f4('0x5')]||_0xe2f4('0x6');this[_0xe2f4('0x7')]=_0x36a474[_0xe2f4('0x7')]||'';this['Configurations']=_0x36a474[_0xe2f4('0x8')]||{};}module[_0xe2f4('0x9')]=ZendeskAccount;
\ No newline at end of file
index 7840567..4204fcf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1aca=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x3883a9,_0x50a35f){var _0x5c8cce=function(_0x4cdec3){while(--_0x4cdec3){_0x3883a9['push'](_0x3883a9['shift']());}};_0x5c8cce(++_0x50a35f);}(_0x1aca,0x1d8));var _0xa1ac=function(_0x2e3ebb,_0x5afc59){_0x2e3ebb=_0x2e3ebb-0x0;var _0x8f027f=_0x1aca[_0x2e3ebb];return _0x8f027f;};'use strict';function ZohoAccount(_0x2af686){this['id']=_0x2af686['id']||0x0;this[_0xa1ac('0x0')]=_0x2af686[_0xa1ac('0x0')]||'';this['description']=_0x2af686[_0xa1ac('0x1')]||'';this[_0xa1ac('0x2')]=_0x2af686[_0xa1ac('0x2')]||'';this[_0xa1ac('0x3')]=_0x2af686[_0xa1ac('0x3')]||'';this[_0xa1ac('0x4')]=_0x2af686[_0xa1ac('0x4')]||'';this[_0xa1ac('0x5')]=_0x2af686[_0xa1ac('0x5')]||'';this[_0xa1ac('0x6')]=_0x2af686['serverUrl']||'';this[_0xa1ac('0x7')]=_0x2af686[_0xa1ac('0x7')]||'';this['refreshToken']=_0x2af686['refreshToken']||'';this[_0xa1ac('0x8')]=_0x2af686['Configurations']||{};}module[_0xa1ac('0x9')]=ZohoAccount;
\ No newline at end of file
+var _0x3395=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x47aaa8,_0x22ba7a){var _0x21199c=function(_0x5eec66){while(--_0x5eec66){_0x47aaa8['push'](_0x47aaa8['shift']());}};_0x21199c(++_0x22ba7a);}(_0x3395,0x9e));var _0x5339=function(_0x5a8477,_0x3d5391){_0x5a8477=_0x5a8477-0x0;var _0x5ac831=_0x3395[_0x5a8477];return _0x5ac831;};'use strict';function ZohoAccount(_0x254643){this['id']=_0x254643['id']||0x0;this[_0x5339('0x0')]=_0x254643[_0x5339('0x0')]||'';this['description']=_0x254643[_0x5339('0x1')]||'';this[_0x5339('0x2')]=_0x254643[_0x5339('0x2')]||'';this[_0x5339('0x3')]=_0x254643[_0x5339('0x3')]||'';this['clientId']=_0x254643[_0x5339('0x4')]||'';this['clientSecret']=_0x254643[_0x5339('0x5')]||'';this[_0x5339('0x6')]=_0x254643[_0x5339('0x6')]||'';this[_0x5339('0x7')]=_0x254643[_0x5339('0x7')]||'';this[_0x5339('0x8')]=_0x254643[_0x5339('0x8')]||'';this[_0x5339('0x9')]=_0x254643[_0x5339('0x9')]||{};}module['exports']=ZohoAccount;
\ No newline at end of file
index 4fed024..2b48db6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b17=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback'];(function(_0x3c50cd,_0x157d12){var _0x3bec1c=function(_0xe3aee){while(--_0xe3aee){_0x3c50cd['push'](_0x3c50cd['shift']());}};_0x3bec1c(++_0x157d12);}(_0x4b17,0x10f));var _0x74b1=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x4b17[_0x3a07c1];return _0x2bbe15;};'use strict';var util=require(_0x74b1('0x0'));var _=require('lodash');var moment=require(_0x74b1('0x1'));function checkNameSurname(_0x5483a2,_0xd14270,_0x356a31){var _0x547636='';if(!_[_0x74b1('0x2')](_0xd14270)&&'string'===typeof _0xd14270){_0x547636+=_0xd14270;}if(!_['isNil'](_0x356a31)&&_0x74b1('0x3')===typeof _0x356a31){_0x547636+='\x20'+_0x356a31;}if(_0x547636!==''){return _0x547636;}return _0x5483a2;}function Action(_0x30d910,_0x379dcc,_0x3873a6,_0x371c3b,_0x191d2b){this[_0x74b1('0x4')]=_0x3873a6||undefined;this['idContact']=_0x30d910['id'];this[_0x74b1('0x5')]=_0x379dcc[_0x74b1('0x6')];this[_0x74b1('0x7')]=_0x379dcc[_0x74b1('0x7')];this[_0x74b1('0x8')]='queue';this[_0x74b1('0x9')]=![];this[_0x74b1('0xa')]=_['isNil'](_0x30d910[_0x74b1('0xb')])?undefined:_0x30d910[_0x74b1('0xb')][_0x74b1('0x6')];this[_0x74b1('0xc')]=this['membername']?util[_0x74b1('0xd')]('SIP/%s',this['membername']):_0x371c3b||undefined;this[_0x74b1('0xe')]=checkNameSurname(_0x30d910[_0x74b1('0xf')]['phone'],_0x30d910['Contact']['firstName'],_0x30d910[_0x74b1('0xf')]['lastName']);this['active']=_0x30d910[_0x74b1('0x10')]||![];this[_0x74b1('0x11')]=_0x30d910[_0x74b1('0x12')];this[_0x74b1('0x13')]=_0x30d910[_0x74b1('0x13')];this[_0x74b1('0x14')]=_0x30d910['countbusyretry']||0x0;this[_0x74b1('0x15')]=_0x30d910[_0x74b1('0x15')]||0x0;this[_0x74b1('0x16')]=_0x30d910[_0x74b1('0x16')]||0x0;this[_0x74b1('0x17')]=(_0x30d910[_0x74b1('0x14')]||0x0)+(_0x30d910[_0x74b1('0x15')]||0x0)+(_0x30d910['countnoanswerretry']||0x0)+(_0x30d910[_0x74b1('0x18')]||0x0)+(_0x30d910[_0x74b1('0x19')]||0x0)+(_0x30d910['countabandonedretry']||0x0)+(_0x30d910[_0x74b1('0x1a')]||0x0)+(_0x30d910[_0x74b1('0x1b')]||0x0);this[_0x74b1('0x18')]=_0x30d910[_0x74b1('0x18')]||0x0;this[_0x74b1('0x19')]=_0x30d910[_0x74b1('0x19')]||0x0;this[_0x74b1('0x1c')]=_0x30d910[_0x74b1('0x1c')]||0x0;this['countmachineretry']=_0x30d910[_0x74b1('0x1a')]||0x0;this['countagentrejectretry']=_0x30d910['countagentrejectretry']||0x0;this['callback']=_0x30d910[_0x74b1('0x1d')];this[_0x74b1('0x1e')]=_0x30d910[_0x74b1('0x1e')];this[_0x74b1('0x1f')]=_0x30d910[_0x74b1('0x1f')];this['recallme']=_0x30d910[_0x74b1('0x20')];this['ContactId']=_0x30d910[_0x74b1('0x21')];this[_0x74b1('0x22')]=_0x30d910[_0x74b1('0x22')];this[_0x74b1('0x23')]=_[_0x74b1('0x2')](_0x30d910[_0x74b1('0xb')])?_0x30d910[_0x74b1('0x23')]:_0x30d910[_0x74b1('0xb')]['id'];this['VoiceQueueId']=_0x30d910[_0x74b1('0x24')];this[_0x74b1('0x25')]='';this[_0x74b1('0x26')]='';}Action['prototype'][_0x74b1('0x27')]=function(){return util[_0x74b1('0xd')](_0x74b1('0x28'),this[_0x74b1('0xe')],this[_0x74b1('0x29')]);};module[_0x74b1('0x2a')]=Action;
\ No newline at end of file
+var _0x1399=['type','queue','dialAnswer','Agent','name','channelAgent','membername','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','idContact'];(function(_0x21aaec,_0x7783ad){var _0x408cdf=function(_0x25f2c2){while(--_0x25f2c2){_0x21aaec['push'](_0x21aaec['shift']());}};_0x408cdf(++_0x7783ad);}(_0x1399,0x16c));var _0x9139=function(_0x509e05,_0x23c205){_0x509e05=_0x509e05-0x0;var _0x2adacf=_0x1399[_0x509e05];return _0x2adacf;};'use strict';var util=require(_0x9139('0x0'));var _=require(_0x9139('0x1'));var moment=require('moment');function checkNameSurname(_0x474911,_0x4f01ae,_0x10c98f){var _0x8bba08='';if(!_[_0x9139('0x2')](_0x4f01ae)&&_0x9139('0x3')===typeof _0x4f01ae){_0x8bba08+=_0x4f01ae;}if(!_[_0x9139('0x2')](_0x10c98f)&&_0x9139('0x3')===typeof _0x10c98f){_0x8bba08+='\x20'+_0x10c98f;}if(_0x8bba08!==''){return _0x8bba08;}return _0x474911;}function Action(_0x5ac80b,_0x54af2d,_0x8f086b,_0x11d2ed,_0x4d5d1e){this['uniqueid']=_0x8f086b||undefined;this[_0x9139('0x4')]=_0x5ac80b['id'];this['queue']=_0x54af2d['name'];this[_0x9139('0x5')]=_0x54af2d[_0x9139('0x5')];this['campaigntype']=_0x9139('0x6');this[_0x9139('0x7')]=![];this['membername']=_['isNil'](_0x5ac80b[_0x9139('0x8')])?undefined:_0x5ac80b[_0x9139('0x8')][_0x9139('0x9')];this[_0x9139('0xa')]=this[_0x9139('0xb')]?util['format']('SIP/%s',this['membername']):_0x11d2ed||undefined;this[_0x9139('0xc')]=checkNameSurname(_0x5ac80b['Contact'][_0x9139('0xd')],_0x5ac80b[_0x9139('0xe')][_0x9139('0xf')],_0x5ac80b[_0x9139('0xe')]['lastName']);this[_0x9139('0x10')]=_0x5ac80b['active']||![];this['calleridnum']=_0x5ac80b['phone'];this[_0x9139('0x11')]=_0x5ac80b[_0x9139('0x11')];this[_0x9139('0x12')]=_0x5ac80b[_0x9139('0x12')]||0x0;this[_0x9139('0x13')]=_0x5ac80b[_0x9139('0x13')]||0x0;this['countnoanswerretry']=_0x5ac80b['countnoanswerretry']||0x0;this[_0x9139('0x14')]=(_0x5ac80b[_0x9139('0x12')]||0x0)+(_0x5ac80b['countcongestionretry']||0x0)+(_0x5ac80b['countnoanswerretry']||0x0)+(_0x5ac80b[_0x9139('0x15')]||0x0)+(_0x5ac80b[_0x9139('0x16')]||0x0)+(_0x5ac80b['countabandonedretry']||0x0)+(_0x5ac80b[_0x9139('0x17')]||0x0)+(_0x5ac80b[_0x9139('0x18')]||0x0);this[_0x9139('0x15')]=_0x5ac80b[_0x9139('0x15')]||0x0;this[_0x9139('0x16')]=_0x5ac80b[_0x9139('0x16')]||0x0;this[_0x9139('0x19')]=_0x5ac80b[_0x9139('0x19')]||0x0;this[_0x9139('0x17')]=_0x5ac80b[_0x9139('0x17')]||0x0;this[_0x9139('0x18')]=_0x5ac80b[_0x9139('0x18')]||0x0;this[_0x9139('0x1a')]=_0x5ac80b[_0x9139('0x1a')];this[_0x9139('0x1b')]=_0x5ac80b[_0x9139('0x1b')];this[_0x9139('0x1c')]=_0x5ac80b[_0x9139('0x1c')];this[_0x9139('0x1d')]=_0x5ac80b['recallme'];this[_0x9139('0x1e')]=_0x5ac80b[_0x9139('0x1e')];this['ListId']=_0x5ac80b[_0x9139('0x1f')];this[_0x9139('0x20')]=_[_0x9139('0x2')](_0x5ac80b['Agent'])?_0x5ac80b[_0x9139('0x20')]:_0x5ac80b[_0x9139('0x8')]['id'];this['VoiceQueueId']=_0x5ac80b[_0x9139('0x21')];this[_0x9139('0x22')]='';this[_0x9139('0x23')]='';}Action['prototype'][_0x9139('0x24')]=function(){return util[_0x9139('0x25')](_0x9139('0x26'),this[_0x9139('0xc')],this[_0x9139('0x27')]);};module[_0x9139('0x28')]=Action;
\ No newline at end of file
index dbc404f..ac0cfa1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa41a=['logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','checkInBlack','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','pick','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','dialActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','starttime','variablesAction','Action','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','pTalking:\x20','pTalking','dialAnswer','contactId','UserId','VoiceQueueId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','countbusyretry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','isUndefined','object','reason'];(function(_0x2739e1,_0x239397){var _0x368f81=function(_0x2fb59a){while(--_0x2fb59a){_0x2739e1['push'](_0x2739e1['shift']());}};_0x368f81(++_0x239397);}(_0xa41a,0x6b));var _0xaa41=function(_0x4859a8,_0x4950ec){_0x4859a8=_0x4859a8-0x0;var _0x539c1c=_0xa41a[_0x4859a8];return _0x539c1c;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var uuid=require('uuid');var moment=require(_0xaa41('0x2'));var Redis=require(_0xaa41('0x3'));var config=require(_0xaa41('0x4'));var logger=require(_0xaa41('0x5'))(_0xaa41('0x6'));var loggerAction=require(_0xaa41('0x5'))(_0xaa41('0x7'));var ami=require(_0xaa41('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xaa41('0x9'));var Action=require(_0xaa41('0xa'));var ut=require('./util/util');var utils=require('../dialer/utils');config[_0xaa41('0xb')]=_[_0xaa41('0xc')](config['redis'],{'host':_0xaa41('0xd'),'port':0x18eb});var io=require(_0xaa41('0xe'))(new Redis(config[_0xaa41('0xb')]));var Sequence=function(){};Sequence[_0xaa41('0xf')][_0xaa41('0x10')]=function(_0x38d930){this[_0xaa41('0x11')]=this[_0xaa41('0x11')]?this[_0xaa41('0x11')]['finally'](_0x38d930):_0x38d930();};function Preview(_0x1d3aac){this[_0xaa41('0x12')]=new Sequence();this['campaignsPreview']=_0x1d3aac['voiceQueues'];this[_0xaa41('0x13')]=_0x1d3aac['trunks'];this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]=_0x1d3aac[_0xaa41('0x15')];this[_0xaa41('0x16')]=0x0;ami['on'](_0xaa41('0x17'),this['syncOriginateResponse'][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x19'),this[_0xaa41('0x1a')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1b'),this[_0xaa41('0x1c')][_0xaa41('0x18')](this));ami['on']('dialend',this[_0xaa41('0x1d')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1e'),this[_0xaa41('0x1f')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x20'),this[_0xaa41('0x21')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xaa41('0x23'),this[_0xaa41('0x24')][_0xaa41('0x18')](this));this['loopCampaigns'](this[_0xaa41('0x25')]);}function emit(_0x1f692b,_0x4e768e,_0x513c61){io['to'](_0x1f692b)[_0xaa41('0x26')](_0x4e768e,_0x513c61);}function emitVoiceQueueChannelRemove(_0x5d4374){logger[_0xaa41('0x27')](_0xaa41('0x28'),JSON[_0xaa41('0x29')](_0x5d4374));emit(util[_0xaa41('0x2a')](_0xaa41('0x2b'),_0x5d4374['name']),_0xaa41('0x2c'),_0x5d4374);io[_0xaa41('0x26')](_0xaa41('0x2d'),_0x5d4374);}function notSendMessagesQueue(_0x21f596){if(_0x21f596[_0xaa41('0x2e')]){if(_0x21f596[_0xaa41('0x2f')]===0x0&&_0x21f596['pTalking']===0x0){_0x21f596['sendMessageOneNotActive']=![];_0x21f596[_0xaa41('0x30')]=0x0;_0x21f596['paused']=0x0;_0x21f596['message']=utils[_0xaa41('0x31')]['INACTIVE'];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x34'));}else{_0x21f596[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x36')];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x37'));}}}Preview[_0xaa41('0xf')][_0xaa41('0x38')]=function(){var _0x4466a3=this;setInterval(function(){_0x4466a3[_0xaa41('0x39')]();},0x7cf);};Preview[_0xaa41('0xf')]['syncCampaigns']=function(){var _0x377add=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x714537 in _0x377add){if(_0x377add[_0xaa41('0x3a')](_0x714537)&&(_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')||_0x377add[_0x714537][_0xaa41('0x3b')]==='booked')&&_0x377add[_0x714537]['type']==='outbound'){if(this[_0xaa41('0x16')]>0x7){this[_0xaa41('0x16')]=0x0;this[_0xaa41('0x3c')]();}}if(_0x377add[_0xaa41('0x3a')](_0x714537)&&_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')&&_0x377add[_0x714537][_0xaa41('0x3d')]===_0xaa41('0x3e')){if(_0x377add[_0x714537]['dialActive']){this[_0xaa41('0x3f')](_0x377add[_0x714537]);if(_0x377add[_0x714537][_0xaa41('0x40')])this[_0xaa41('0x41')](_0x377add[_0x714537]);}else{notSendMessagesQueue(_0x377add[_0x714537]);}}}};Preview['prototype'][_0xaa41('0x42')]=function(_0x374117){var _0x57fe1d=this;this[_0xaa41('0x12')][_0xaa41('0x10')](function(){if(!_[_0xaa41('0x43')](_0x57fe1d['actions'][_0x374117])){loggerAction[_0xaa41('0x27')]('[clearZombieChannels][talking]',_0x374117,_0xaa41('0x44'),_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')],'originated:\x20',JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x2f')]),_0xaa41('0x46'),JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x47')]),JSON[_0xaa41('0x29')](_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x48')]),JSON[_0xaa41('0x29')](_['pick'](_0x57fe1d[_0xaa41('0x14')][_0x374117],[_0xaa41('0x49'),_0xaa41('0x4a'),_0xaa41('0x4b'),'ListId'])));return ami['Action']({'action':_0xaa41('0x4c'),'channel':_0x57fe1d[_0xaa41('0x14')][_0x374117]['channel']})[_0xaa41('0x4d')](function(_0x563687){if(_0x563687[_0xaa41('0x35')]===_0xaa41('0x4e')){setTimeout(function(){if(_0x57fe1d[_0xaa41('0x14')][_0x374117]){ut[_0xaa41('0x4f')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));if(_0x57fe1d['actions'][_0x374117][_0xaa41('0x48')]===!![]){ut[_0xaa41('0x51')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117]['queue']);}ut[_0xaa41('0x52')](_0xaa41('0x53')+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]);delete _0x57fe1d[_0xaa41('0x14')][_0x374117];}},0x2328);}});}});};Preview[_0xaa41('0xf')][_0xaa41('0x3c')]=function(){var _0x5ee74c=this;loggerAction[_0xaa41('0x27')]('[action]',_['size'](this[_0xaa41('0x14')]));for(var _0x5ee127 in this['actions']){if(_0x5ee74c['actions'][_0xaa41('0x3a')](_0x5ee127)){_0x5ee74c['clearZombieChannel'](_0x5ee127);}}};Preview[_0xaa41('0xf')][_0xaa41('0x41')]=function(_0x4a6882){var _0x576f81=this;rpcDb[_0xaa41('0x54')](_0x4a6882['id'],ut[_0xaa41('0x55')](this[_0xaa41('0x15')]))[_0xaa41('0x56')](function(_0x3fe1a9){if(!_[_0xaa41('0x43')](_0x3fe1a9)){for(var _0x258096=0x0;_0x258096<_0x3fe1a9[_0xaa41('0x57')];_0x258096+=0x1){if(ut[_0xaa41('0x58')](_0x3fe1a9[_0x258096]['scheduledat'])<_0x4a6882[_0xaa41('0x59')]*0x3c){if(_0x3fe1a9[_0x258096][_0xaa41('0x5a')]&&!_0x3fe1a9[_0x258096][_0xaa41('0x5a')][_0xaa41('0x5b')]){_0x576f81[_0xaa41('0x5c')](_0x3fe1a9[_0x258096]['id'])[_0xaa41('0x56')](ut['logger2'](_0xaa41('0x5d')))[_0xaa41('0x4d')](ut[_0xaa41('0x5e')](_0xaa41('0x5d')));}else{rpcDb['disableContact'](_0x3fe1a9[_0x258096]['id']);}}else{var _0x23bc61=new Action(_0x3fe1a9[_0x258096],_0x4a6882);_0x23bc61['starttime']=moment()['format'](_0xaa41('0x5f'));_0x4a6882[_0xaa41('0x60')]+=0x1;ut[_0xaa41('0x61')](_0x23bc61,0x17,'RecallInQueue');if(_0x4a6882[_0xaa41('0x62')]){rpcDb[_0xaa41('0x63')](ut[_0xaa41('0x64')](_0x3fe1a9[_0x258096]));rpcDb['createCustomerHistory'](_0x23bc61,_0xaa41('0x65'));}else{ut[_0xaa41('0x61')](_0x23bc61,0x16,_0xaa41('0x66'));rpcDb[_0xaa41('0x67')](_0x23bc61,_0xaa41('0x68'));rpcDb[_0xaa41('0x69')](_0x23bc61,_0xaa41('0x68'));}}}}})[_0xaa41('0x4d')](ut['logger2'](_0xaa41('0x6a')));};Preview['prototype']['setMessage']=function(_0x1bdcd6){_0x1bdcd6[_0xaa41('0x2e')]=!![];if(ut[_0xaa41('0x6b')](_0x1bdcd6[_0xaa41('0x6c')])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6d')];}else if(!ut[_0xaa41('0x6e')](_0x1bdcd6['dialActive'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6f')];}else if(!this['isTrunkReachable'](_0x1bdcd6[_0xaa41('0x70')])){if(!this[_0xaa41('0x71')](_0x1bdcd6['TrunkBackup'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x72')];}else{_0x1bdcd6['message']=utils[_0xaa41('0x31')][_0xaa41('0x73')];}}else{_0x1bdcd6['message']=utils['CAMPAIGN_STATUS'][_0xaa41('0x73')];}};Preview[_0xaa41('0xf')][_0xaa41('0x74')]=function(_0x4d20c6,_0x5a76b9,_0x137f3f){var _0x1746b4=this;var _0x32f2b4=this[_0xaa41('0x14')][_0x5a76b9];var _0x5ccdc5=this[_0xaa41('0x25')][_0x32f2b4['queue']];var _0x555186;var _0x3ba305=![];var _0x52ae7f=0x2;var _0x3621c0=0x3;if(_0x5ccdc5){switch(_0x137f3f){case'1':_0x5ccdc5[_0xaa41('0x75')]+=0x1;_0x32f2b4[_0xaa41('0x76')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x0,_0xaa41('0x78'));ami[_0xaa41('0x26')](_0xaa41('0x79'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0x7b')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0x7c'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'0',_0x5ccdc5)[_0xaa41('0x56')](function(_0x40cdfc){_0x3ba305=_0x40cdfc[_0xaa41('0x7d')]==0x1;_0x52ae7f=_0x5ccdc5['dialNoSuchNumberRetryFrequency'];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0x82'));}else{if(_0x32f2b4['countnosuchnumberretry']>=_0x5ccdc5['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x32f2b4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x32f2b4,_0xaa41('0x76'),_0x5ccdc5['dialNoSuchNumberRetryFrequency']),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x32f2b4[_0xaa41('0x76')]++;logger['info'](_0xaa41('0x85'),_0x32f2b4[_0xaa41('0x76')]);logger[_0xaa41('0x27')]('id',_0x32f2b4[_0xaa41('0x86')]);_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnosuchnumberretry':_0x32f2b4[_0xaa41('0x76')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});break;case _0xaa41('0x89'):var _0x2d2af8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32f2b4['responsetime']=_0x2d2af8;_0x32f2b4[_0xaa41('0x8a')]=_0x2d2af8;_0x32f2b4['dialAnswer']=!![];_0x5ccdc5[_0xaa41('0x47')]+=0x1;logger['info'](_0xaa41('0x8b'),_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);ami[_0xaa41('0x26')]('custom:agentconnect',ut['buildObj'](_0x32f2b4,_0xaa41('0x8d'),this[_0xaa41('0x25')][_0x32f2b4['queue']]));if(_0x5ccdc5['acw']){ami[_0xaa41('0x26')](_0xaa41('0x8e'),ut[_0xaa41('0x8f')](_0x32f2b4));}break;case'16':ami[_0xaa41('0x26')](_0xaa41('0x90'),ut['buildObj'](_0x32f2b4,_0xaa41('0x91'),this['campaignsPreview'][_0x32f2b4['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x32f2b4,_0xaa41('0x91')));_0x5ccdc5[_0xaa41('0x92')]+=0x1;_0x5ccdc5[_0xaa41('0x93')]+=0x1;_0x5ccdc5['answered']+=0x1;ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0x94'));_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x4,_0xaa41('0x96'));rpcDb[_0xaa41('0x67')](_0x32f2b4,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0x97'));rpcDb[_0xaa41('0x98')](_0x32f2b4);_0x5ccdc5[_0xaa41('0x99')]+=_0x32f2b4['talktime'];_0x5ccdc5[_0xaa41('0x9a')]+=_0x32f2b4['talktime'];logger[_0xaa41('0x27')](_0xaa41('0x9b'),_0x32f2b4[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x5ccdc5['name'],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];break;case'BUSY':_0x5ccdc5[_0xaa41('0x9d')]+=0x1;_0x32f2b4['countbusyretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x5,_0xaa41('0x9e'));_0x52ae7f=_0x5ccdc5[_0xaa41('0x9f')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xa0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xa1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xa2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'5',_0x5ccdc5)[_0xaa41('0x56')](function(_0x59a30b){_0x3ba305=_0x59a30b[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xa4'));}else{if(_0x32f2b4['countbusyretry']>=_0x5ccdc5[_0xaa41('0xa5')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xa8'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4[_0xaa41('0xa8')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countbusyretry':_0x32f2b4['countbusyretry']}})[_0xaa41('0x56')](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xaa'):_0x5ccdc5[_0xaa41('0xab')]+=0x1;_0x32f2b4['countnoanswerretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x3,'NoAnswer');_0x52ae7f=_0x5ccdc5[_0xaa41('0xac')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];var _0x5bd574=ut[_0xaa41('0xad')](_0x32f2b4,_0x5ccdc5);ami['emit']('custom:agentnoanswer',_0x5bd574);rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xae'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'3',_0x5ccdc5)['then'](function(_0x241e1a){_0x3ba305=_0x241e1a[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xaf'));}else{if(_0x32f2b4['countnoanswerretry']>=_0x5ccdc5[_0xaa41('0xb0')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xae'));}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xa7')](_0x32f2b4,'countnoanswerretry',_0x5ccdc5['dialNoAnswerRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})['then'](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xb2'):_0x5ccdc5[_0xaa41('0xb3')]+=0x1;_0x32f2b4[_0xaa41('0xb4')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x8,_0xaa41('0xb5'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xb6')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xb7'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xb8')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xb9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'8',_0x5ccdc5)[_0xaa41('0x56')](function(_0x58ad21){_0x3ba305=_0x58ad21[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xba'));}else{if(_0x32f2b4[_0xaa41('0xb4')]>=_0x5ccdc5[_0xaa41('0xbb')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xb9'));}else{rpcDb[_0xaa41('0xa6')](ut['scheduledAt'](_0x32f2b4,_0xaa41('0xb4'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countcongestionretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countcongestionretry':_0x32f2b4[_0xaa41('0xb4')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xbc'):_0x5ccdc5['outboundRejectCallsDay']+=0x1;_0x32f2b4[_0xaa41('0xbd')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x14,_0xaa41('0xbe'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xc0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xc1')));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x78265){_0x3ba305=_0x78265[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut['cloneAction'](_0x32f2b4,0x14,'AgentReject');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc3'));}else{if(_0x32f2b4['countagentrejectretry']>=_0x5ccdc5[_0xaa41('0xc4')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xbd'),_0x5ccdc5[_0xaa41('0xbf')]),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xc5'):_0x5ccdc5[_0xaa41('0xc6')]+=0x1;_0x32f2b4[_0xaa41('0xc7')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0xb,_0xaa41('0xc8'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'11',_0x5ccdc5)[_0xaa41('0x56')](function(_0x408d95){_0x3ba305=_0x408d95[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc9'));}else{if(_0x32f2b4['countabandonedetry']>=_0x5ccdc5[_0xaa41('0xca')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xc9'));}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,'countabandonedretry',_0x5ccdc5['dialAbandonedRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})['then'](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case'18':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0xcc')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x12,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,'amd'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xd0'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)['then'](function(_0x30e8cb){_0x3ba305=_0x30e8cb['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0x12,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd0'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd0'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4['incrementPreviewCounters']({'id':_0x32f2b4['idContact'],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;case'19':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4['countglobal']=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x13,_0x4d20c6['cause-txt']||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xd1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)[_0xaa41('0x56')](function(_0x573889){_0x3ba305=_0x573889['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd2'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd2'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;default:if(_0x32f2b4['dialAnswer']){ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0xd3'));ut[_0xaa41('0x52')](_0xaa41('0xd4')+_0x5ccdc5[_0xaa41('0x33')],_0x4d20c6);}_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0xc,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd5'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x1b5933){_0x3ba305=_0x1b5933[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut['totalGlobal'](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd6'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd6'));}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});}});}if(!(_0x32f2b4['dialAnswer']&&_0x137f3f==='16')){ut['updateOriginated'](_0x5ccdc5,_0xaa41('0xd7'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingCustomer]',_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0xd8'),_0x5ccdc5['originated']);}if(_0x137f3f!=='ANSWER'){delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];delete this[_0xaa41('0x14')][_0x4d20c6['destlinkedid']];}_0x5ccdc5['queueSummaryCountersUpdated']=!![];}};Preview[_0xaa41('0xf')]['callProgressDetectingAgent']=function(_0x94423a,_0x59d6cf,_0x37dc6f){if(_[_0xaa41('0xd9')](_0x59d6cf)&&_0xaa41('0xda')!==typeof _0x59d6cf){return;}if(_[_0xaa41('0xd9')](_0x37dc6f)&&_0xaa41('0xda')!==typeof _0x37dc6f){return;}switch(_0x37dc6f[_0xaa41('0xdb')]){case'0':ut[_0xaa41('0xdc')](_0x94423a,0x0,'NoSuchNumber');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xde'));break;case'3':ut['logAgent'](_0x94423a,0x3,_0xaa41('0xdf'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe0'));break;case'5':ut[_0xaa41('0xdc')](_0x94423a,0x5,'Busy');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe1'));break;case'8':ut[_0xaa41('0xdc')](_0x94423a,0x8,_0xaa41('0xb5'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));break;case'22':ut[_0xaa41('0xdc')](_0x94423a,0x16,_0xaa41('0xe3'));rpcDb[_0xaa41('0xdd')](_0x94423a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x94423a,0xc,_0x37dc6f[_0xaa41('0xdb')]);rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));}ut[_0xaa41('0x4f')](_0x59d6cf,_0xaa41('0xe4'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x94423a[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x59d6cf[_0xaa41('0x33')],_0xaa41('0xd8'),_0x59d6cf[_0xaa41('0x2f')]);delete this[_0xaa41('0x14')][_0x94423a['uniqueid']];};Preview[_0xaa41('0xf')][_0xaa41('0xa3')]=function(_0x13ddbe,_0x4cf0c5,_0x1ddfe5){return cmHopperAdditionalPhone[_0xaa41('0xa3')](_0x13ddbe,_0x4cf0c5,_0x1ddfe5)[_0xaa41('0x4d')](logger[_0xaa41('0x27')](_0xaa41('0xe5')));};Preview[_0xaa41('0xf')][_0xaa41('0x88')]=function(_0x943973,_0xe17579,_0x1a6de8){return cmHopperAdditionalPhone[_0xaa41('0x88')](_0x943973,_0xe17579,_0x1a6de8)[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xaa41('0x87')]=function(_0xb9d685){return Promise[_0xaa41('0xe6')]()[_0xaa41('0x56')](cmHopperAdditionalPhone[_0xaa41('0x87')](_0xb9d685))[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[incrementPreviewCounters]\x20'));};Preview[_0xaa41('0xf')][_0xaa41('0xe7')]=function(_0xa3687e,_0x7e0e69,_0x361819,_0x377e17,_0x1e879d){var _0x1a7527=this;return new Promise(function(_0x1aac0c,_0x1a5a7a){if(_[_0xaa41('0x43')](_0x7e0e69)||_[_0xaa41('0x43')](_0x7e0e69['Contact'])||_[_0xaa41('0x43')](_0x7e0e69[_0xaa41('0xe8')])||_['isNil'](_0x7e0e69[_0xaa41('0x4b')])){_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xe9'),_0x377e17,_0x1e879d));return;}var _0x400fb7=uuid['v4']();var _0x5c0c5c=_0x1a7527[_0xaa41('0x25')][_0x7e0e69[_0xaa41('0x44')][_0xaa41('0x33')]];var _0x3a223c=_0x361819?_0x1a7527[_0xaa41('0x15')][_0x361819]['id']:undefined;_0x1a7527['actions'][_0x400fb7]=new Action(_0x7e0e69,_0x5c0c5c,_0x400fb7,_0x361819,_0x3a223c);var _0xc59a12=_0x1a7527['actions'][_0x400fb7];_0xc59a12['unlockAgent']=_0x377e17;_0xc59a12[_0xaa41('0x83')]=_0x1e879d;_0xc59a12['lookAgent']=_0x361819;if(_['isEmpty'](_0xa3687e)){_0x1a7527[_0xaa41('0xea')](_0xc59a12,_0x5c0c5c,_0x7e0e69,_0x361819)[_0xaa41('0x56')](function(_0x5b241e){logger['info'](_0xaa41('0xeb'),_0xaa41('0xec')+_0xc59a12[_0xaa41('0x45')]+_0xaa41('0xed')+_0xc59a12[_0xaa41('0x86')],JSON[_0xaa41('0x29')](_0x5b241e));ami[_0xaa41('0x26')](_0xaa41('0xee'),ut['buildObj'](_0xc59a12,_0xaa41('0xef'),_0x1a7527[_0xaa41('0x25')][_0xc59a12[_0xaa41('0x45')]]));_0x1aac0c(ut[_0xaa41('0x35')](_0xaa41('0xf0')));})['catch'](function(_0x519843){ut[_0xaa41('0xf1')](_0xaa41('0xf2'),_0x519843);_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xf3'),_0x377e17,_0x1e879d));});}else{_0x5c0c5c[_0xaa41('0xf4')]+=0x1;ut[_0xaa41('0xf5')](_0xc59a12);rpcDb['createHistory'](_0xc59a12,_0xaa41('0xf6'));delete _0x1a7527[_0xaa41('0x14')][_0x400fb7];_0x1a5a7a(ut['message'](_0xaa41('0xf7'),_0x377e17,_0x1e879d));}});};Preview[_0xaa41('0xf')][_0xaa41('0x71')]=function(_0x27149e){return!_[_0xaa41('0x43')](_0x27149e)&&!_[_0xaa41('0x43')](_0x27149e[_0xaa41('0x33')])&&!_['isNil'](_0x27149e[_0xaa41('0xf8')])&&_0x27149e[_0xaa41('0xf8')]&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])])&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')])&&(this['trunks'][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e['name'])]['status']===_0xaa41('0xfa')||this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')]==='unmonitored');};Preview['prototype'][_0xaa41('0x5c')]=function(_0x2ff3fb,_0x566832){return this['execRun'](_0x2ff3fb,_0x566832)[_0xaa41('0x56')](function(_0x44dea3){return _[_0xaa41('0xfb')](_0x44dea3,['message']);})['catch'](function(_0x1d609e){if(_0x1d609e[_0xaa41('0xfc')]){rpcDb[_0xaa41('0xfd')](_0x2ff3fb);}if(_0x1d609e['active']){rpcDb[_0xaa41('0xfe')](_0x2ff3fb);}throw _[_0xaa41('0xfb')](_0x1d609e,['message']);});};Preview['prototype'][_0xaa41('0xff')]=function(_0x561447,_0x4679e5){var _0x3fb6f0=this;var _0xdf9297,_0x10252a;return rpcDb[_0xaa41('0x100')](_0x561447)[_0xaa41('0x56')](function(_0x2b083a){if(!_['isNil'](_0x2b083a[0x0])){_0x10252a=_0x2b083a[0x0][_0xaa41('0x101')]?![]:!![];_0xdf9297=_0x2b083a[0x0][_0xaa41('0x101')]?!![]:![];_0xdf9297=_0x4679e5?!![]:_0xdf9297;}var _0x5534ef=_0x3fb6f0[_0xaa41('0x102')](_0x2b083a);if(_0x5534ef[_0xaa41('0x103')]){rpcDb[_0xaa41('0x104')](_[_0xaa41('0xfb')](_0x2b083a[0x0],[_0xaa41('0x4b'),_0xaa41('0xe8')]))['then'](function(_0xa2d55d){_0x3fb6f0[_0xaa41('0xe7')](_0xa2d55d,_0x2b083a[0x0],_0x4679e5,_0x10252a,_0xdf9297)[_0xaa41('0x56')](function(_0x2fa831){return _0x2fa831;})[_0xaa41('0x4d')](function(_0xf8f3e1){throw _0xf8f3e1;});})[_0xaa41('0x4d')](function(_0x5083ff){ut[_0xaa41('0xf1')](_0xaa41('0x105'),_0x5083ff);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',_0x10252a,_0xdf9297);});}else{throw ut['message'](_0x5534ef['message'],_0x10252a,_0xdf9297);}})[_0xaa41('0x4d')](function(_0x1331f8){ut[_0xaa41('0xf1')](_0xaa41('0x106'),_0x1331f8);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xaa41('0xf')][_0xaa41('0x102')]=function(_0x1fe1e3){if(_[_0xaa41('0x43')](_0x1fe1e3)||_[_0xaa41('0x107')](_0x1fe1e3)||!_[_0xaa41('0x43')](_0x1fe1e3[0x0][_0xaa41('0x5a')])&&_['isNil'](_0x1fe1e3[0x0][_0xaa41('0x5a')][_0xaa41('0x33')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Empty\x20Contact]',_0x1fe1e3);return{'isValid':![],'message':_0xaa41('0x108')};}var _0x53a519=this['campaignsPreview'][_0x1fe1e3[0x0][_0xaa41('0x44')]['name']];_0x53a519[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x73')];if(_[_0xaa41('0x43')](_0x53a519)){ut[_0xaa41('0xf1')](_0xaa41('0x109'),_0x53a519);return{'isValid':![],'message':_0xaa41('0x10a')};}if(!this['isTrunkReachable'](_0x53a519[_0xaa41('0x70')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0xaa41('0x10c')+_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10d'));if(!this[_0xaa41('0x71')](_0x53a519[_0xaa41('0x10e')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10f'));return{'isValid':![],'message':_0xaa41('0x110')};}}if(!ut[_0xaa41('0x6e')](_0x53a519[_0xaa41('0x111')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Campaign\x20Active]',_0x53a519[_0xaa41('0x33')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53a519['name']+_0xaa41('0x112')};}return{'isValid':!![],'message':_0xaa41('0x113')};};Preview['prototype'][_0xaa41('0xea')]=function(_0x356256,_0x1e86cc,_0x15bb60,_0x232732){var _0x34d857=this;return new Promise(function(_0x239f1b,_0x445925){var _0x1e8591=_0x356256[_0xaa41('0x8c')];var _0x347d0c=_0x34d857[_0xaa41('0x71')](_0x1e86cc[_0xaa41('0x70')])?util[_0xaa41('0x2a')](_0xaa41('0x114'),_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')],_['isNil'](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc[_0xaa41('0x115')][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60['phone'][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60['phone']):util[_0xaa41('0x2a')](_0xaa41('0x114'),_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x33')],_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc['dialPrefix'][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60[_0xaa41('0xe8')][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60[_0xaa41('0xe8')]);var _0x53dea3=_0x34d857[_0xaa41('0x71')](_0x1e86cc['Trunk'])?ut[_0xaa41('0x119')](_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut['getCallerIdRandom'](_0x1e86cc[_0xaa41('0x11d')],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc['dialOriginateCallerIdNumber']):ut[_0xaa41('0x119')](_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut[_0xaa41('0x11e')](_0x1e86cc['dialOriginateCallerIdNumber'],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc[_0xaa41('0x11d')]);if(_0x53dea3){_0x356256[_0xaa41('0x11f')]=ut['extractCalleridName'](_0x53dea3);_0x356256['originatecalleridnum']=ut[_0xaa41('0x120')](_0x53dea3);}var _0x5aee9b=ut['addVariables'](_0x1e86cc,_0x15bb60,_0x347d0c,_0x53dea3,_0x1e8591,_0x356256);_[_0xaa41('0x121')](_0x356256,ut[_0xaa41('0x122')](_0x5aee9b));_0x356256[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e86cc['variables']=_0x5aee9b;var _0xa63e60=ut[_0xaa41('0x124')](_0x356256,_0x1e86cc,_0x5aee9b,_0x356256[_0xaa41('0x83')],_0x232732);return ami[_0xaa41('0x125')](_0xa63e60)[_0xaa41('0x56')](function(_0x5e3bb2){_0x1e86cc[_0xaa41('0x2f')]+=0x1;logger[_0xaa41('0x27')]('[originated][increment]',_0x1e8591,_0xaa41('0x9c'),_0x1e86cc[_0xaa41('0x33')],'originated:\x20',_0x1e86cc[_0xaa41('0x2f')]);_0x239f1b(_0x5e3bb2);})[_0xaa41('0x4d')](function(_0x58a5e5){ut[_0xaa41('0xdc')](_0x356256,0xe,_0xaa41('0x126'));rpcDb['createAgentHistory'](_0x356256,_0xaa41('0x127'));_0x445925(_0x58a5e5);});});};Preview['prototype']['syncNewExten']=function(_0x1ffee2){if(this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]){this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]['channel']=_0x1ffee2[_0xaa41('0x128')];}};Preview['prototype']['syncOriginateResponse']=function(_0x25548d){var _0x28685a=this;var _0x2f62f6=this[_0xaa41('0x14')][_0x25548d[_0xaa41('0x129')]];if(_0x2f62f6){if(_0x2f62f6[_0xaa41('0x12a')]&&this[_0xaa41('0x15')][_0x2f62f6['lookAgent']]){ut[_0xaa41('0x12b')](_0x2f62f6,this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]][_0xaa41('0x33')],this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]]['id']);}var _0x3aafe6=_[_0xaa41('0x12c')](_0x2f62f6);_0x3aafe6[_0xaa41('0x12d')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));var _0x2e8c8f=_0x28685a['campaignsPreview'][_0x2f62f6['queue']];if(ut[_0xaa41('0x12e')](_0x25548d[_0xaa41('0x12f')])){if(_0x2f62f6[_0xaa41('0xa9')]){rpcDb['unlockContact'](_0x2f62f6[_0xaa41('0x86')]);}if(_0x2f62f6[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0x2f62f6[_0xaa41('0x86')]);}ami[_0xaa41('0x26')](_0xaa41('0x130'),ut[_0xaa41('0x7a')](_0x2f62f6,_0xaa41('0x131'),this[_0xaa41('0x25')][_0x2f62f6[_0xaa41('0x45')]]));this[_0xaa41('0x132')](_0x3aafe6,_0x2e8c8f,_0x25548d);}else{_0x2f62f6[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));ut[_0xaa41('0xdc')](_0x3aafe6,0x4,'Answer');rpcDb[_0xaa41('0xdd')](_0x3aafe6,_0xaa41('0x133'));}}};Preview[_0xaa41('0xf')]['syncHangup']=function(_0x125efb){var _0xfc1e24=this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]];var _0x21c0c6;if(_0xfc1e24){_0x21c0c6=this[_0xaa41('0x25')][_0xfc1e24[_0xaa41('0x45')]];logger[_0xaa41('0x27')]('[syncHangup][talking]',_0x125efb[_0xaa41('0x84')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);}if(this['actions'][_0x125efb[_0xaa41('0x84')]]&&_0x125efb['linkedid']!==_0x125efb[_0xaa41('0x8c')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')]);}}else if(_0xfc1e24&&_['isNil'](_0xfc1e24[_0xaa41('0x135')])&&_0x21c0c6[_0xaa41('0x136')]&&_0x125efb[_0xaa41('0x84')]===_0x125efb[_0xaa41('0x8c')]&&_[_0xaa41('0x43')](_0x125efb[_0xaa41('0xdb')])&&_0x125efb['cause']==='16'&&_0x125efb['channelstate']==='6'&&_[_0xaa41('0xd9')](_0xfc1e24['transfer'])){if(_0xfc1e24[_0xaa41('0xa9')]){rpcDb[_0xaa41('0xfd')](_0xfc1e24[_0xaa41('0x86')]);}if(_0xfc1e24[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0xfc1e24[_0xaa41('0x86')]);}_0x125efb[_0xaa41('0xdb')]='22';this[_0xaa41('0x132')](_0xfc1e24,_0x21c0c6,_0x125efb);}else if(_0xfc1e24&&_0xfc1e24[_0xaa41('0x137')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][transfer]',_0x125efb[_0xaa41('0x84')],_0x125efb['cause'],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]]['dialAnswer']){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this['callProgressDetectingCustomer'](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}}};Preview[_0xaa41('0xf')]['syncDialEnd']=function(_0x3ecde6){if(this['actions'][_0x3ecde6[_0xaa41('0x138')]]&&_0x3ecde6[_0xaa41('0x138')]!==_0x3ecde6[_0xaa41('0x139')]){this[_0xaa41('0x74')](_0x3ecde6,_0x3ecde6['destlinkedid'],_0x3ecde6[_0xaa41('0xce')]);}};Preview[_0xaa41('0xf')][_0xaa41('0x1c')]=function(_0x49e4a5){if(this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]]&&_0x49e4a5[_0xaa41('0x84')]!==_0x49e4a5[_0xaa41('0x8c')]&&!this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]][_0xaa41('0x48')]){if(_0x49e4a5[_0xaa41('0x134')]==='1'){this['callProgressDetectingCustomer'](_0x49e4a5,_0x49e4a5[_0xaa41('0x84')],_0x49e4a5['cause']);}}};Preview[_0xaa41('0xf')][_0xaa41('0x13a')]=function(_0x1fa855,_0x272f3f,_0x36cdd2){if(this[_0xaa41('0x14')][_0x1fa855]){if(_[_0xaa41('0x43')](this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')])){this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')]={};}this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')][_0x272f3f]=_0x36cdd2;}};Preview['prototype'][_0xaa41('0x21')]=function(_0x366b1c){try{if(!_[_0xaa41('0x43')](_0x366b1c)){if(ut[_0xaa41('0x13c')](_[_0xaa41('0x13d')](_0x366b1c[_0xaa41('0x13e')])[0x0])){this[_0xaa41('0x13a')](_0x366b1c[_0xaa41('0x8c')],_[_0xaa41('0x13d')](_0x366b1c['variable'])[0x0],_0x366b1c[_0xaa41('0x13f')]);}}}catch(_0x30a438){logger[_0xaa41('0x140')](_0xaa41('0x141'),util[_0xaa41('0x142')](_0x30a438,{'showHidden':![],'depth':null}));}};Preview[_0xaa41('0xf')][_0xaa41('0x143')]=function(_0x3f1b1a){if(_0x3f1b1a){if(this[_0xaa41('0x14')][_0x3f1b1a[_0xaa41('0x144')]]){this['actions'][_0x3f1b1a['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xaa41('0xf')][_0xaa41('0x24')]=function(_0x5ccba6){if(_0x5ccba6){if(this[_0xaa41('0x14')][_0x5ccba6[_0xaa41('0x145')]]){this['actions'][_0x5ccba6[_0xaa41('0x145')]]['transfer']=!![];}}};module[_0xaa41('0x146')]=Preview;
\ No newline at end of file
+var _0x008c=['called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlock','recallme','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','lookAgent','logLookAgent','isFailure','response','unlockContact','custom:agentringnoanswer','Answer','[syncHangup][talking]','cause','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','syncVarSet','variable','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','dialend','syncDialEnd','newexten','attendedtransfer','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','emit','sendMessageOneNotActive','originated','pTalking','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','message','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','agents','then','isNil','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','buildAcw','custom:agentcomplete','complete','total','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','swapAdditionalPhones','outboundCongestionCallsDay','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled'];(function(_0x461d52,_0x43604b){var _0x25d252=function(_0x3bdc91){while(--_0x3bdc91){_0x461d52['push'](_0x461d52['shift']());}};_0x25d252(++_0x43604b);}(_0x008c,0x188));var _0xc008=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x008c[_0x1c8c28];return _0x1f59b4;};'use strict';var util=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var uuid=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Redis=require(_0xc008('0x4'));var config=require('../../../config/environment');var logger=require(_0xc008('0x5'))(_0xc008('0x6'));var loggerAction=require(_0xc008('0x5'))(_0xc008('0x7'));var ami=require(_0xc008('0x8'));var rpcDb=require(_0xc008('0x9'));var cmHopperAdditionalPhone=require(_0xc008('0xa'));var Action=require(_0xc008('0xb'));var ut=require(_0xc008('0xc'));var utils=require('../dialer/utils');config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc008('0xd')]));var Sequence=function(){};Sequence[_0xc008('0xe')]['enqueue']=function(_0x51ba7d){this['tail']=this[_0xc008('0xf')]?this[_0xc008('0xf')]['finally'](_0x51ba7d):_0x51ba7d();};function Preview(_0xae2dab){this[_0xc008('0x10')]=new Sequence();this[_0xc008('0x11')]=_0xae2dab[_0xc008('0x12')];this[_0xc008('0x13')]=_0xae2dab[_0xc008('0x13')];this[_0xc008('0x14')]={};this['agents']=_0xae2dab['agents'];this[_0xc008('0x15')]=0x0;ami['on']('originateresponse',this[_0xc008('0x16')][_0xc008('0x17')](this));ami['on'](_0xc008('0x18'),this[_0xc008('0x19')][_0xc008('0x17')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xc008('0x1a'),this[_0xc008('0x1b')][_0xc008('0x17')](this));ami['on'](_0xc008('0x1c'),this['syncNewExten']['bind'](this));ami['on']('varset',this['syncVarSet'][_0xc008('0x17')](this));ami['on'](_0xc008('0x1d'),this['syncAttendedTransfer'][_0xc008('0x17')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0xc008('0x11')]);}function emit(_0x4b9726,_0x5560b1,_0x590a71){io['to'](_0x4b9726)['emit'](_0x5560b1,_0x590a71);}function emitVoiceQueueChannelRemove(_0x5a58bd){logger[_0xc008('0x1e')](_0xc008('0x1f'),JSON[_0xc008('0x20')](_0x5a58bd));emit(util[_0xc008('0x21')](_0xc008('0x22'),_0x5a58bd[_0xc008('0x23')]),'voice_queue_channel:remove',_0x5a58bd);io[_0xc008('0x24')]('voice_queue_presence:remove',_0x5a58bd);}function notSendMessagesQueue(_0x58a6ea){if(_0x58a6ea[_0xc008('0x25')]){if(_0x58a6ea[_0xc008('0x26')]===0x0&&_0x58a6ea[_0xc008('0x27')]===0x0){_0x58a6ea[_0xc008('0x25')]=![];_0x58a6ea['available']=0x0;_0x58a6ea['paused']=0x0;_0x58a6ea['message']=utils[_0xc008('0x28')][_0xc008('0x29')];ut[_0xc008('0x2a')](_0xc008('0x2b'),_0x58a6ea['name']+'\x20is\x20not\x20active');}else{_0x58a6ea['message']=utils['CAMPAIGN_STATUS']['DEACTIVATED'];ut[_0xc008('0x2a')](_0xc008('0x2b'),_0x58a6ea[_0xc008('0x23')]+'\x20is\x20deactivated');}}}Preview[_0xc008('0xe')][_0xc008('0x2c')]=function(){var _0x209591=this;setInterval(function(){_0x209591[_0xc008('0x2d')]();},0x7cf);};Preview['prototype'][_0xc008('0x2d')]=function(){var _0x2e0b4e=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x539766 in _0x2e0b4e){if(_0x2e0b4e[_0xc008('0x2e')](_0x539766)&&(_0x2e0b4e[_0x539766][_0xc008('0x2f')]===_0xc008('0x6')||_0x2e0b4e[_0x539766][_0xc008('0x2f')]===_0xc008('0x30'))&&_0x2e0b4e[_0x539766][_0xc008('0x31')]===_0xc008('0x32')){if(this[_0xc008('0x15')]>0x7){this[_0xc008('0x15')]=0x0;this[_0xc008('0x33')]();}}if(_0x2e0b4e[_0xc008('0x2e')](_0x539766)&&_0x2e0b4e[_0x539766][_0xc008('0x2f')]==='preview'&&_0x2e0b4e[_0x539766][_0xc008('0x31')]===_0xc008('0x32')){if(_0x2e0b4e[_0x539766]['dialActive']){this[_0xc008('0x34')](_0x2e0b4e[_0x539766]);if(_0x2e0b4e[_0x539766][_0xc008('0x35')])this[_0xc008('0x36')](_0x2e0b4e[_0x539766]);}else{notSendMessagesQueue(_0x2e0b4e[_0x539766]);}}}};Preview[_0xc008('0xe')][_0xc008('0x37')]=function(_0x3cd878){var _0x7cfbc5=this;this[_0xc008('0x10')][_0xc008('0x38')](function(){if(!_['isNil'](_0x7cfbc5[_0xc008('0x14')][_0x3cd878])){loggerAction[_0xc008('0x1e')](_0xc008('0x39'),_0x3cd878,_0xc008('0x3a'),_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x3b')],_0xc008('0x3c'),JSON['stringify'](_0x7cfbc5[_0xc008('0x11')][_0x7cfbc5[_0xc008('0x14')][_0x3cd878]['queue']][_0xc008('0x26')]),_0xc008('0x3d'),JSON['stringify'](_0x7cfbc5[_0xc008('0x11')][_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x3b')]]['pTalking']),JSON['stringify'](_0x7cfbc5['actions'][_0x3cd878][_0xc008('0x3e')]),JSON['stringify'](_[_0xc008('0x3f')](_0x7cfbc5[_0xc008('0x14')][_0x3cd878],[_0xc008('0x40'),_0xc008('0x41'),_0xc008('0x42'),_0xc008('0x43')])));return ami[_0xc008('0x44')]({'action':_0xc008('0x45'),'channel':_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x46')]})[_0xc008('0x47')](function(_0xdfca2e){if(_0xdfca2e[_0xc008('0x48')]===_0xc008('0x49')){setTimeout(function(){if(_0x7cfbc5['actions'][_0x3cd878]){ut[_0xc008('0x4a')](_0x7cfbc5[_0xc008('0x11')][_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x3b')]],'[clearZombieChannel]');if(_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x3e')]===!![]){ut[_0xc008('0x4b')](_0x7cfbc5[_0xc008('0x11')][_0x7cfbc5[_0xc008('0x14')][_0x3cd878]['queue']],_0xc008('0x4c'));ut[_0xc008('0x4d')](_0xc008('0x4e')+_0x3cd878,_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x3b')]);}ut['loggerError'](_0xc008('0x4f')+_0x3cd878,_0x7cfbc5[_0xc008('0x14')][_0x3cd878][_0xc008('0x3b')]);delete _0x7cfbc5[_0xc008('0x14')][_0x3cd878];}},0x2328);}});}});};Preview['prototype'][_0xc008('0x33')]=function(){var _0xe37446=this;loggerAction[_0xc008('0x1e')]('[action]',_[_0xc008('0x50')](this['actions']));for(var _0x3dd097 in this['actions']){if(_0xe37446[_0xc008('0x14')][_0xc008('0x2e')](_0x3dd097)){_0xe37446['clearZombieChannel'](_0x3dd097);}}};Preview[_0xc008('0xe')][_0xc008('0x36')]=function(_0x6d6d4c){var _0x5caaa2=this;rpcDb[_0xc008('0x51')](_0x6d6d4c['id'],ut[_0xc008('0x52')](this[_0xc008('0x53')]))[_0xc008('0x54')](function(_0x347629){if(!_[_0xc008('0x55')](_0x347629)){for(var _0x59ca2b=0x0;_0x59ca2b<_0x347629['length'];_0x59ca2b+=0x1){if(ut['getDiff'](_0x347629[_0x59ca2b][_0xc008('0x56')])<_0x6d6d4c[_0xc008('0x57')]*0x3c){if(_0x347629[_0x59ca2b][_0xc008('0x58')]&&!_0x347629[_0x59ca2b][_0xc008('0x58')][_0xc008('0x59')]){_0x5caaa2[_0xc008('0x5a')](_0x347629[_0x59ca2b]['id'])[_0xc008('0x54')](ut[_0xc008('0x5b')]('[RecallMe]'))['catch'](ut['logger2'](_0xc008('0x5c')));}else{rpcDb[_0xc008('0x5d')](_0x347629[_0x59ca2b]['id']);}}else{var _0x158eae=new Action(_0x347629[_0x59ca2b],_0x6d6d4c);_0x158eae['starttime']=moment()[_0xc008('0x21')](_0xc008('0x5e'));_0x6d6d4c[_0xc008('0x5f')]+=0x1;ut[_0xc008('0x60')](_0x158eae,0x17,_0xc008('0x61'));if(_0x6d6d4c[_0xc008('0x62')]){rpcDb[_0xc008('0x63')](ut[_0xc008('0x64')](_0x347629[_0x59ca2b]));rpcDb[_0xc008('0x65')](_0x158eae,_0xc008('0x66'));}else{ut['logCustomer'](_0x158eae,0x16,'RecallFailedTimeout');rpcDb[_0xc008('0x65')](_0x158eae,'[HistoryRecallClose]');rpcDb[_0xc008('0x67')](_0x158eae,_0xc008('0x68'));}}}}})[_0xc008('0x47')](ut['logger2'](_0xc008('0x69')));};Preview[_0xc008('0xe')][_0xc008('0x34')]=function(_0x8b9775){_0x8b9775[_0xc008('0x25')]=!![];if(ut['IsNotLoggedIn'](_0x8b9775[_0xc008('0x6a')])){_0x8b9775[_0xc008('0x48')]=utils['CAMPAIGN_STATUS'][_0xc008('0x6b')];}else if(!ut[_0xc008('0x6c')](_0x8b9775['dialActive'])){_0x8b9775['message']=utils[_0xc008('0x28')][_0xc008('0x29')];}else if(!this[_0xc008('0x6d')](_0x8b9775[_0xc008('0x6e')])){if(!this[_0xc008('0x6d')](_0x8b9775['TrunkBackup'])){_0x8b9775['message']=utils[_0xc008('0x28')]['UNREACHABLE_TRUNK'];}else{_0x8b9775[_0xc008('0x48')]=utils[_0xc008('0x28')][_0xc008('0x6f')];}}else{_0x8b9775[_0xc008('0x48')]=utils[_0xc008('0x28')][_0xc008('0x6f')];}};Preview['prototype'][_0xc008('0x70')]=function(_0xbd7422,_0x9a7abc,_0x2b350c){var _0x4424f5=this;var _0x5aa385=this[_0xc008('0x14')][_0x9a7abc];var _0x4fdab4=this['campaignsPreview'][_0x5aa385['queue']];var _0x89bb20;var _0x1bcbb1=![];var _0x5dfb69=0x2;var _0x5f58d7=0x3;if(_0x4fdab4){switch(_0x2b350c){case'1':_0x4fdab4[_0xc008('0x71')]+=0x1;_0x5aa385[_0xc008('0x72')]+=0x1;_0x5aa385[_0xc008('0x73')]=ut['totalGlobal'](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x0,_0xc008('0x74'));ami[_0xc008('0x24')](_0xc008('0x75'),ut['buildObj'](_0x5aa385,_0xc008('0x76')));rpcDb['createCustomerHistory'](_0x5aa385,_0xc008('0x77'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'0',_0x4fdab4)[_0xc008('0x54')](function(_0x943c91){_0x1bcbb1=_0x943c91[_0xc008('0x79')]==0x1;_0x5dfb69=_0x4fdab4[_0xc008('0x7a')];_0x5f58d7=_0x4fdab4['callAdditionalPhoneAfterMin'];if(!_0x1bcbb1){if(ut[_0xc008('0x7b')](_0x5aa385)>=_0x4fdab4['dialGlobalMaxRetry']){_0x89bb20=ut['cloneAction'](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb[_0xc008('0x67')](_0x89bb20,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5aa385[_0xc008('0x72')]>=_0x4fdab4[_0xc008('0x7d')]){rpcDb[_0xc008('0x67')](_0x5aa385,_0xc008('0x7e'));}else{rpcDb[_0xc008('0x7f')](ut[_0xc008('0x80')](_0x5aa385,_0xc008('0x72'),_0x4fdab4['dialNoSuchNumberRetryFrequency']),_0x5aa385[_0xc008('0x81')],_0x5aa385[_0xc008('0x82')]);}}delete this[_0xc008('0x14')][_0xbd7422[_0xc008('0x83')]];}else{_0x5aa385[_0xc008('0x72')]++;logger[_0xc008('0x1e')](_0xc008('0x84'),_0x5aa385[_0xc008('0x72')]);logger[_0xc008('0x1e')]('id',_0x5aa385[_0xc008('0x85')]);_0x4424f5[_0xc008('0x86')]({'id':_0x5aa385[_0xc008('0x85')],'field':{'countnosuchnumberretry':_0x5aa385[_0xc008('0x72')]}})[_0xc008('0x54')](function(){_0x4424f5['swapAdditionalPhones'](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});});}});break;case _0xc008('0x87'):var _0x3d3a7e=moment()['format'](_0xc008('0x5e'));_0x5aa385[_0xc008('0x88')]=_0x3d3a7e;_0x5aa385['answertime']=_0x3d3a7e;_0x5aa385['dialAnswer']=!![];_0x4fdab4[_0xc008('0x27')]+=0x1;logger[_0xc008('0x1e')](_0xc008('0x89'),_0x5aa385[_0xc008('0x8a')],_0xc008('0x8b'),_0x4fdab4[_0xc008('0x23')],_0xc008('0x3d'),_0x4fdab4[_0xc008('0x27')]);ami[_0xc008('0x24')](_0xc008('0x8c'),ut[_0xc008('0x8d')](_0x5aa385,'connect',this[_0xc008('0x11')][_0x5aa385[_0xc008('0x3b')]]));if(_0x4fdab4[_0xc008('0x8e')]){ami[_0xc008('0x24')]('custom:agentConnectPreview',ut[_0xc008('0x8f')](_0x5aa385));}break;case'16':ami['emit'](_0xc008('0x90'),ut[_0xc008('0x8d')](_0x5aa385,_0xc008('0x91'),this['campaignsPreview'][_0x5aa385[_0xc008('0x3b')]]));emitVoiceQueueChannelRemove(ut[_0xc008('0x8d')](_0x5aa385,_0xc008('0x91')));_0x4fdab4['outboundAnswerCallsDay']+=0x1;_0x4fdab4[_0xc008('0x92')]+=0x1;_0x4fdab4['answered']+=0x1;ut[_0xc008('0x4b')](_0x4fdab4,_0xc008('0x93'));_0x5aa385[_0xc008('0x73')]=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x4,'Answer');rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0x94'));rpcDb['createCustomerFinal'](_0x5aa385,_0xc008('0x95'));rpcDb['crateCustomerReportQueue'](_0x5aa385);_0x4fdab4[_0xc008('0x96')]+=_0x5aa385['talktime'];_0x4fdab4[_0xc008('0x97')]+=_0x5aa385['talktime'];logger[_0xc008('0x1e')](_0xc008('0x98'),_0x5aa385[_0xc008('0x8a')],_0xc008('0x8b'),_0x4fdab4['name'],_0xc008('0x3d'),_0x4fdab4[_0xc008('0x27')]);delete this[_0xc008('0x14')][_0xbd7422[_0xc008('0x83')]];break;case _0xc008('0x99'):_0x4fdab4[_0xc008('0x9a')]+=0x1;_0x5aa385[_0xc008('0x9b')]+=0x1;_0x5aa385[_0xc008('0x73')]=ut['totalGlobal'](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x5,'Busy');_0x5dfb69=_0x4fdab4['dialBusyRetryFrequency'];_0x5f58d7=_0x4fdab4['callAdditionalPhoneAfterMin'];ami[_0xc008('0x24')](_0xc008('0x9c'),ut[_0xc008('0x8d')](_0x5aa385,_0xc008('0x9d')));rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0x9e'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'5',_0x4fdab4)[_0xc008('0x54')](function(_0x127bdf){_0x1bcbb1=_0x127bdf['additional']==0x1;if(!_0x1bcbb1){if(ut[_0xc008('0x7b')](_0x5aa385)>=_0x4fdab4[_0xc008('0x9f')]){_0x89bb20=ut[_0xc008('0xa0')](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb[_0xc008('0x67')](_0x89bb20,_0xc008('0xa1'));}else{if(_0x5aa385[_0xc008('0x9b')]>=_0x4fdab4[_0xc008('0xa2')]){rpcDb[_0xc008('0x67')](_0x5aa385,_0xc008('0x9e'));}else{rpcDb[_0xc008('0x7f')](ut[_0xc008('0x80')](_0x5aa385,'countbusyretry',_0x4fdab4['dialBusyRetryFrequency']),_0x5aa385[_0xc008('0x81')],_0x5aa385[_0xc008('0x82')]);}}}else{_0x5aa385[_0xc008('0x9b')]++;_0x4424f5['incrementPreviewCounters']({'id':_0x5aa385[_0xc008('0x85')],'field':{'countbusyretry':_0x5aa385[_0xc008('0x9b')]}})['then'](function(){_0x4424f5['swapAdditionalPhones'](_0x5aa385,_0x5dfb69,_0x5f58d7)['then'](function(){});});}});break;case _0xc008('0xa3'):_0x4fdab4[_0xc008('0xa4')]+=0x1;_0x5aa385[_0xc008('0xa5')]+=0x1;_0x5aa385[_0xc008('0x73')]=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x3,_0xc008('0xa6'));_0x5dfb69=_0x4fdab4[_0xc008('0xa7')];_0x5f58d7=_0x4fdab4[_0xc008('0xa8')];var _0x1e7a11=ut['buildNoAnswerEventPayload'](_0x5aa385,_0x4fdab4);ami['emit'](_0xc008('0xa9'),_0x1e7a11);rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0xaa'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'3',_0x4fdab4)[_0xc008('0x54')](function(_0x37fc2c){_0x1bcbb1=_0x37fc2c['additional']==0x1;if(!_0x1bcbb1){if(ut['totalGlobal'](_0x5aa385)>=_0x4fdab4[_0xc008('0x9f')]){_0x89bb20=ut[_0xc008('0xa0')](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb['createCustomerFinal'](_0x89bb20,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5aa385['countnoanswerretry']>=_0x4fdab4['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5aa385,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xc008('0x7f')](ut['scheduledAt'](_0x5aa385,_0xc008('0xa5'),_0x4fdab4['dialNoAnswerRetryFrequency']),_0x5aa385[_0xc008('0x81')],_0x5aa385[_0xc008('0x82')]);}}}else{_0x5aa385[_0xc008('0xa5')]++;_0x4424f5['incrementPreviewCounters']({'id':_0x5aa385['idContact'],'field':{'countnoanswerretry':_0x5aa385[_0xc008('0xa5')]}})['then'](function(){_0x4424f5[_0xc008('0xab')](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});});}});break;case'CONGESTION':_0x4fdab4[_0xc008('0xac')]+=0x1;_0x5aa385['countcongestionretry']+=0x1;_0x5aa385['countglobal']=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x8,'Congestion');_0x5dfb69=_0x4fdab4[_0xc008('0xad')];_0x5f58d7=_0x4fdab4[_0xc008('0xa8')];ami[_0xc008('0x24')]('custom:agentcongestion',ut[_0xc008('0x8d')](_0x5aa385,_0xc008('0xae')));rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0xaf'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'8',_0x4fdab4)[_0xc008('0x54')](function(_0x5db7bc){_0x1bcbb1=_0x5db7bc[_0xc008('0x79')]==0x1;if(!_0x1bcbb1){if(ut[_0xc008('0x7b')](_0x5aa385)>=_0x4fdab4[_0xc008('0x9f')]){_0x89bb20=ut['cloneAction'](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb[_0xc008('0x67')](_0x89bb20,_0xc008('0xb0'));}else{if(_0x5aa385['countcongestionretry']>=_0x4fdab4['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x5aa385,_0xc008('0xaf'));}else{rpcDb[_0xc008('0x7f')](ut[_0xc008('0x80')](_0x5aa385,_0xc008('0xb1'),_0x4fdab4[_0xc008('0xb2')]),_0x5aa385[_0xc008('0x81')],_0x5aa385[_0xc008('0x82')]);}}}else{_0x5aa385[_0xc008('0xb1')]++;_0x4424f5['incrementPreviewCounters']({'id':_0x5aa385[_0xc008('0x85')],'field':{'countcongestionretry':_0x5aa385[_0xc008('0xb1')]}})['then'](function(){_0x4424f5['swapAdditionalPhones'](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});});}});break;case _0xc008('0xb3'):_0x4fdab4[_0xc008('0xb4')]+=0x1;_0x5aa385[_0xc008('0xb5')]+=0x1;_0x5aa385[_0xc008('0x73')]=ut['totalGlobal'](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x14,_0xc008('0xb6'));_0x5dfb69=_0x4fdab4['dialAgentRejectRetryFrequency'];_0x5f58d7=_0x4fdab4[_0xc008('0xa8')];ami[_0xc008('0x24')](_0xc008('0xb7'),ut[_0xc008('0x8d')](_0x5aa385,'agentreject'));rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0xb8'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'20',_0x4fdab4)[_0xc008('0x54')](function(_0x59b3bb){_0x1bcbb1=_0x59b3bb[_0xc008('0x79')]==0x1;if(!_0x1bcbb1){if(ut[_0xc008('0x7b')](_0x5aa385)>=_0x4fdab4['dialGlobalMaxRetry']){_0x89bb20=ut['cloneAction'](_0x5aa385,0x14,_0xc008('0xb6'));rpcDb['createCustomerFinal'](_0x89bb20,_0xc008('0xb9'));}else{if(_0x5aa385[_0xc008('0xb5')]>=_0x4fdab4['dialAgentRejectMaxRetry']){rpcDb[_0xc008('0x67')](_0x5aa385,_0xc008('0xb9'));}else{rpcDb[_0xc008('0x7f')](ut[_0xc008('0x80')](_0x5aa385,_0xc008('0xb5'),_0x4fdab4[_0xc008('0xba')]),_0x5aa385[_0xc008('0x81')],_0x5aa385[_0xc008('0x82')]);}}}else{_0x5aa385[_0xc008('0xa5')]++;_0x4424f5[_0xc008('0x86')]({'id':_0x5aa385['idContact'],'field':{'countnoanswerretry':_0x5aa385['countnoanswerretry']}})[_0xc008('0x54')](function(){_0x4424f5[_0xc008('0xab')](_0x5aa385,_0x5dfb69,_0x5f58d7)['then'](function(){});});}});break;case _0xc008('0xbb'):_0x4fdab4[_0xc008('0xbc')]+=0x1;_0x5aa385[_0xc008('0xbd')]+=0x1;_0x5aa385['countglobal']=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0xb,_0xc008('0xbe'));rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0xbf'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'11',_0x4fdab4)[_0xc008('0x54')](function(_0x5bd010){_0x1bcbb1=_0x5bd010[_0xc008('0x79')]==0x1;if(!_0x1bcbb1){if(ut['totalGlobal'](_0x5aa385)>=_0x4fdab4[_0xc008('0x9f')]){_0x89bb20=ut[_0xc008('0xa0')](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb['createCustomerFinal'](_0x89bb20,_0xc008('0xbf'));}else{if(_0x5aa385[_0xc008('0xc0')]>=_0x4fdab4[_0xc008('0xc1')]){rpcDb[_0xc008('0x67')](_0x5aa385,_0xc008('0xbf'));}else{rpcDb[_0xc008('0x7f')](ut[_0xc008('0x80')](_0x5aa385,_0xc008('0xbd'),_0x4fdab4[_0xc008('0xc2')]),_0x5aa385[_0xc008('0x81')],_0x5aa385['activeContact']);}}}else{_0x5aa385[_0xc008('0xa5')]++;_0x4424f5[_0xc008('0x86')]({'id':_0x5aa385[_0xc008('0x85')],'field':{'countnoanswerretry':_0x5aa385[_0xc008('0xa5')]}})[_0xc008('0x54')](function(){_0x4424f5['swapAdditionalPhones'](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});});}});break;case'18':_0x4fdab4[_0xc008('0xc3')]+=0x1;_0x5aa385[_0xc008('0xc4')]+=0x1;_0x5aa385[_0xc008('0x73')]=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x12,_0xbd7422[_0xc008('0xc5')]||_0xbd7422[_0xc008('0xc6')]);ami[_0xc008('0x24')](_0xc008('0xc7'),ut[_0xc008('0x8d')](_0x5aa385,_0xc008('0xc8')));rpcDb[_0xc008('0x65')](_0x5aa385,_0xc008('0xc9'));_0x4424f5[_0xc008('0x78')](_0x5aa385,'18',_0x4fdab4)['then'](function(_0x5e2610){_0x1bcbb1=_0x5e2610[_0xc008('0x79')]==0x1;if(!_0x1bcbb1){if(ut[_0xc008('0x7b')](_0x5aa385)>=_0x4fdab4[_0xc008('0x9f')]){_0x89bb20=ut[_0xc008('0xa0')](_0x5aa385,0x12,_0xc008('0x7c'));rpcDb[_0xc008('0x67')](_0x89bb20,_0xc008('0xc9'));}else{rpcDb[_0xc008('0x67')](_0x5aa385,_0xc008('0xc9'));}}else{_0x5aa385['countnoanswerretry']++;_0x4424f5[_0xc008('0x86')]({'id':_0x5aa385[_0xc008('0x85')],'field':{'countnoanswerretry':_0x5aa385['countnoanswerretry']}})[_0xc008('0x54')](function(){_0x4424f5[_0xc008('0xab')](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});});}});delete this[_0xc008('0x14')][_0xbd7422[_0xc008('0x83')]];break;case'19':_0x4fdab4[_0xc008('0xc3')]+=0x1;_0x5aa385['countglobal']=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0x13,_0xbd7422[_0xc008('0xc5')]||_0xbd7422[_0xc008('0xc6')]);ami['emit'](_0xc008('0xc7'),ut['buildObj'](_0x5aa385,_0xc008('0xc8')));rpcDb[_0xc008('0x65')](_0x5aa385,'[callProgressDetectingCustomer][machine]');_0x4424f5[_0xc008('0x78')](_0x5aa385,'18',_0x4fdab4)['then'](function(_0xc35f69){_0x1bcbb1=_0xc35f69['additional']==0x1;if(!_0x1bcbb1){if(ut['totalGlobal'](_0x5aa385)>=_0x4fdab4['dialGlobalMaxRetry']){_0x89bb20=ut[_0xc008('0xa0')](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb['createCustomerFinal'](_0x89bb20,_0xc008('0xca'));}else{rpcDb[_0xc008('0x67')](_0x5aa385,'[callProgressDetectingCustomer][machine]');}}else{_0x5aa385[_0xc008('0xa5')]++;_0x4424f5[_0xc008('0x86')]({'id':_0x5aa385[_0xc008('0x85')],'field':{'countnoanswerretry':_0x5aa385['countnoanswerretry']}})[_0xc008('0x54')](function(){_0x4424f5[_0xc008('0xab')](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});});}});delete this[_0xc008('0x14')][_0xbd7422[_0xc008('0x83')]];break;default:if(_0x5aa385[_0xc008('0x3e')]){ut[_0xc008('0x4b')](_0x4fdab4,_0xc008('0xcb'));ut[_0xc008('0x4d')](_0xc008('0xcc')+_0x4fdab4[_0xc008('0x23')],_0xbd7422);}_0x4fdab4['outboundUnknownCallsDay']+=0x1;_0x5aa385[_0xc008('0x73')]=ut[_0xc008('0x7b')](_0x5aa385);ut[_0xc008('0x60')](_0x5aa385,0xc,_0xbd7422['cause-txt']||_0xbd7422[_0xc008('0xc6')]);_0x5dfb69=_0x4fdab4[_0xc008('0xba')];_0x5f58d7=_0x4fdab4[_0xc008('0xa8')];rpcDb['createCustomerHistory'](_0x5aa385,_0xc008('0xcd'));_0x4424f5['verifyAdditionalPhones'](_0x5aa385,'20',_0x4fdab4)[_0xc008('0x54')](function(_0x8bdd89){_0x1bcbb1=_0x8bdd89[_0xc008('0x79')]==0x1;if(!_0x1bcbb1){if(ut['totalGlobal'](_0x5aa385)>=_0x4fdab4[_0xc008('0x9f')]){_0x89bb20=ut[_0xc008('0xa0')](_0x5aa385,0xf,_0xc008('0x7c'));rpcDb[_0xc008('0x67')](_0x89bb20,_0xc008('0xce'));}else{rpcDb[_0xc008('0x67')](_0x5aa385,_0xc008('0xce'));}delete this['actions'][_0xbd7422[_0xc008('0x83')]];}else{_0x4424f5[_0xc008('0xab')](_0x5aa385,_0x5dfb69,_0x5f58d7)[_0xc008('0x54')](function(){});}});}if(!(_0x5aa385[_0xc008('0x3e')]&&_0x2b350c==='16')){ut['updateOriginated'](_0x4fdab4,_0xc008('0xcf'));logger['info'](_0xc008('0xd0'),_0x5aa385[_0xc008('0x8a')],_0xc008('0x8b'),_0x4fdab4[_0xc008('0x23')],_0xc008('0x3c'),_0x4fdab4[_0xc008('0x26')]);}if(_0x2b350c!==_0xc008('0x87')){delete this['actions'][_0xbd7422[_0xc008('0x83')]];delete this[_0xc008('0x14')][_0xbd7422[_0xc008('0xd1')]];}_0x4fdab4[_0xc008('0xd2')]=!![];}};Preview['prototype'][_0xc008('0xd3')]=function(_0x493e24,_0x2ea298,_0x3b2e99){if(_[_0xc008('0xd4')](_0x2ea298)&&'object'!==typeof _0x2ea298){return;}if(_['isUndefined'](_0x3b2e99)&&_0xc008('0xd5')!==typeof _0x3b2e99){return;}switch(_0x3b2e99['reason']){case'0':ut[_0xc008('0xd6')](_0x493e24,0x0,_0xc008('0x74'));rpcDb[_0xc008('0xd7')](_0x493e24,_0xc008('0xd8'));break;case'3':ut['logAgent'](_0x493e24,0x3,_0xc008('0xa6'));rpcDb[_0xc008('0xd7')](_0x493e24,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x493e24,0x5,_0xc008('0xd9'));rpcDb[_0xc008('0xd7')](_0x493e24,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xc008('0xd6')](_0x493e24,0x8,_0xc008('0xda'));rpcDb[_0xc008('0xd7')](_0x493e24,_0xc008('0xdb'));break;case'22':ut['logAgent'](_0x493e24,0x16,_0xc008('0xdc'));rpcDb[_0xc008('0xd7')](_0x493e24,_0xc008('0xdd'));break;default:ut[_0xc008('0xd6')](_0x493e24,0xc,_0x3b2e99[_0xc008('0xde')]);rpcDb[_0xc008('0xd7')](_0x493e24,_0xc008('0xdb'));}ut[_0xc008('0x4a')](_0x2ea298,_0xc008('0xdf'));logger[_0xc008('0x1e')](_0xc008('0xe0'),_0x493e24[_0xc008('0x8a')],_0xc008('0x8b'),_0x2ea298['name'],'originated:\x20',_0x2ea298[_0xc008('0x26')]);delete this[_0xc008('0x14')][_0x493e24[_0xc008('0x8a')]];};Preview[_0xc008('0xe')][_0xc008('0x78')]=function(_0x201674,_0xe5d226,_0x4b18d0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x201674,_0xe5d226,_0x4b18d0)[_0xc008('0x47')](logger[_0xc008('0x1e')](_0xc008('0xe1')));};Preview['prototype'][_0xc008('0xab')]=function(_0x136124,_0x1190b3,_0x40a737){return cmHopperAdditionalPhone[_0xc008('0xab')](_0x136124,_0x1190b3,_0x40a737)[_0xc008('0x47')](logger[_0xc008('0x1e')](_0xc008('0xe2')));};Preview[_0xc008('0xe')][_0xc008('0x86')]=function(_0x3e4a01){return Promise[_0xc008('0xe3')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x3e4a01))[_0xc008('0x47')](logger[_0xc008('0x1e')]('[incrementPreviewCounters]\x20'));};Preview[_0xc008('0xe')][_0xc008('0xe4')]=function(_0x20e0b0,_0x15b272,_0x1cea87,_0x7a5ef9,_0x44bc80){var _0x2e7505=this;return new Promise(function(_0x3f916b,_0x48d2d7){if(_['isNil'](_0x15b272)||_['isNil'](_0x15b272[_0xc008('0xe5')])||_['isNil'](_0x15b272[_0xc008('0xe6')])||_[_0xc008('0x55')](_0x15b272[_0xc008('0x42')])){_0x48d2d7(ut[_0xc008('0x48')](_0xc008('0xe7'),_0x7a5ef9,_0x44bc80));return;}var _0x2073be=uuid['v4']();var _0x293fc5=_0x2e7505[_0xc008('0x11')][_0x15b272[_0xc008('0x3a')][_0xc008('0x23')]];var _0x2b819f=_0x1cea87?_0x2e7505[_0xc008('0x53')][_0x1cea87]['id']:undefined;_0x2e7505[_0xc008('0x14')][_0x2073be]=new Action(_0x15b272,_0x293fc5,_0x2073be,_0x1cea87,_0x2b819f);var _0x304083=_0x2e7505[_0xc008('0x14')][_0x2073be];_0x304083[_0xc008('0x81')]=_0x7a5ef9;_0x304083[_0xc008('0x82')]=_0x44bc80;_0x304083['lookAgent']=_0x1cea87;if(_[_0xc008('0xe8')](_0x20e0b0)){_0x2e7505['execCall'](_0x304083,_0x293fc5,_0x15b272,_0x1cea87)[_0xc008('0x54')](function(_0x176dc8){logger[_0xc008('0x1e')]('[Preview][execCall][success]',_0xc008('0xe9')+_0x304083[_0xc008('0x3b')]+_0xc008('0xea')+_0x304083[_0xc008('0x85')],JSON[_0xc008('0x20')](_0x176dc8));ami[_0xc008('0x24')](_0xc008('0xeb'),ut['buildObj'](_0x304083,_0xc008('0xec'),_0x2e7505[_0xc008('0x11')][_0x304083[_0xc008('0x3b')]]));_0x3f916b(ut[_0xc008('0x48')]('Calling'));})['catch'](function(_0x4f971d){ut['logger'](_0xc008('0xed'),_0x4f971d);_0x48d2d7(ut[_0xc008('0x48')](_0xc008('0xee'),_0x7a5ef9,_0x44bc80));});}else{_0x293fc5[_0xc008('0xef')]+=0x1;ut['logBlacklist'](_0x304083);rpcDb[_0xc008('0xf0')](_0x304083,_0xc008('0xf1'));delete _0x2e7505[_0xc008('0x14')][_0x2073be];_0x48d2d7(ut['message'](_0xc008('0xf2'),_0x7a5ef9,_0x44bc80));}});};Preview['prototype'][_0xc008('0x6d')]=function(_0x48862b){return!_[_0xc008('0x55')](_0x48862b)&&!_[_0xc008('0x55')](_0x48862b[_0xc008('0x23')])&&!_[_0xc008('0x55')](_0x48862b['active'])&&_0x48862b[_0xc008('0xf3')]&&!_[_0xc008('0x55')](this[_0xc008('0x13')][util[_0xc008('0x21')](_0xc008('0xf4'),_0x48862b[_0xc008('0x23')])])&&!_[_0xc008('0x55')](this['trunks'][util[_0xc008('0x21')](_0xc008('0xf4'),_0x48862b[_0xc008('0x23')])]['status'])&&(this['trunks'][util[_0xc008('0x21')](_0xc008('0xf4'),_0x48862b[_0xc008('0x23')])][_0xc008('0x45')]==='reachable'||this[_0xc008('0x13')][util[_0xc008('0x21')]('SIP/%s',_0x48862b['name'])]['status']===_0xc008('0xf5'));};Preview['prototype'][_0xc008('0x5a')]=function(_0x4a5ff4,_0x1e1d9f){return this[_0xc008('0xf6')](_0x4a5ff4,_0x1e1d9f)[_0xc008('0x54')](function(_0x120890){return _['pick'](_0x120890,['message']);})[_0xc008('0x47')](function(_0x274739){if(_0x274739[_0xc008('0xf7')]){rpcDb['unlockContact'](_0x4a5ff4);}if(_0x274739[_0xc008('0xf3')]){rpcDb[_0xc008('0x5d')](_0x4a5ff4);}throw _[_0xc008('0x3f')](_0x274739,[_0xc008('0x48')]);});};Preview[_0xc008('0xe')][_0xc008('0xf6')]=function(_0x3a2943,_0x2087b3){var _0x3994ea=this;var _0x19305c,_0xc7cb80;return rpcDb['getContactPreview'](_0x3a2943)['then'](function(_0x2f8ef9){if(!_['isNil'](_0x2f8ef9[0x0])){_0xc7cb80=_0x2f8ef9[0x0][_0xc008('0xf8')]?![]:!![];_0x19305c=_0x2f8ef9[0x0][_0xc008('0xf8')]?!![]:![];_0x19305c=_0x2087b3?!![]:_0x19305c;}var _0x4a7268=_0x3994ea['validateContact'](_0x2f8ef9);if(_0x4a7268[_0xc008('0xf9')]){rpcDb[_0xc008('0xfa')](_[_0xc008('0x3f')](_0x2f8ef9[0x0],[_0xc008('0x42'),_0xc008('0xe6')]))[_0xc008('0x54')](function(_0x536a81){_0x3994ea[_0xc008('0xe4')](_0x536a81,_0x2f8ef9[0x0],_0x2087b3,_0xc7cb80,_0x19305c)[_0xc008('0x54')](function(_0x62e889){return _0x62e889;})['catch'](function(_0x21a898){throw _0x21a898;});})[_0xc008('0x47')](function(_0xcef0e4){ut[_0xc008('0x2a')]('[Preview][checkIsBlackList]',_0xcef0e4);throw ut['message'](_0xc008('0xfb'),_0xc7cb80,_0x19305c);});}else{throw ut['message'](_0x4a7268[_0xc008('0x48')],_0xc7cb80,_0x19305c);}})[_0xc008('0x47')](function(_0x222a5d){ut[_0xc008('0x2a')](_0xc008('0xfc'),_0x222a5d);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xc008('0xe')][_0xc008('0xfd')]=function(_0xa51fe7){if(_[_0xc008('0x55')](_0xa51fe7)||_[_0xc008('0xe8')](_0xa51fe7)||!_[_0xc008('0x55')](_0xa51fe7[0x0][_0xc008('0x58')])&&_['isNil'](_0xa51fe7[0x0][_0xc008('0x58')][_0xc008('0x23')])){ut[_0xc008('0x2a')](_0xc008('0xfe'),_0xa51fe7);return{'isValid':![],'message':_0xc008('0xff')};}var _0x1c2263=this[_0xc008('0x11')][_0xa51fe7[0x0][_0xc008('0x3a')][_0xc008('0x23')]];_0x1c2263[_0xc008('0x48')]=utils[_0xc008('0x28')][_0xc008('0x6f')];if(_['isNil'](_0x1c2263)){ut[_0xc008('0x2a')](_0xc008('0x100'),_0x1c2263);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xc008('0x6d')](_0x1c2263[_0xc008('0x6e')])){ut[_0xc008('0x2a')](_0xc008('0x101'),_0xc008('0x102')+_0x1c2263[_0xc008('0x23')]+_0xc008('0x103'));if(!this[_0xc008('0x6d')](_0x1c2263[_0xc008('0x104')])){ut[_0xc008('0x2a')](_0xc008('0x101'),_0x1c2263['name']+_0xc008('0x105'));return{'isValid':![],'message':_0xc008('0x106')};}}if(!ut[_0xc008('0x6c')](_0x1c2263[_0xc008('0x107')])){ut[_0xc008('0x2a')](_0xc008('0x108'),_0x1c2263[_0xc008('0x23')]+_0xc008('0x109'));return{'isValid':![],'message':_0xc008('0x102')+_0x1c2263[_0xc008('0x23')]+_0xc008('0x109')};}return{'isValid':!![],'message':_0xc008('0x10a')};};Preview[_0xc008('0xe')][_0xc008('0x10b')]=function(_0x26b5c8,_0x194e6a,_0x5c358b,_0x49688b){var _0x51fd86=this;return new Promise(function(_0x10778f,_0x237ffb){var _0x3f80f4=_0x26b5c8[_0xc008('0x8a')];var _0x1a0565=_0x51fd86[_0xc008('0x6d')](_0x194e6a[_0xc008('0x6e')])?util['format'](_0xc008('0x10c'),_0x194e6a['Trunk']['name'],_[_0xc008('0x55')](_0x194e6a[_0xc008('0x10d')])?'':_0x194e6a['dialPrefix'][_0xc008('0x10e')]()||'',_0x194e6a[_0xc008('0x10f')]>0x0?_0x5c358b[_0xc008('0xe6')]['substring'](_0x194e6a[_0xc008('0x10f')]):_0x5c358b[_0xc008('0xe6')]):util[_0xc008('0x21')]('SIP/%s/%s%s',_[_0xc008('0x55')](_0x194e6a[_0xc008('0x104')])?_0x194e6a[_0xc008('0x6e')][_0xc008('0x23')]:_0x194e6a[_0xc008('0x104')][_0xc008('0x23')],_[_0xc008('0x55')](_0x194e6a[_0xc008('0x10d')])?'':_0x194e6a['dialPrefix'][_0xc008('0x10e')]()||'',_0x194e6a[_0xc008('0x10f')]>0x0?_0x5c358b[_0xc008('0xe6')][_0xc008('0x110')](_0x194e6a[_0xc008('0x10f')]):_0x5c358b['phone']);var _0xb04a1c=_0x51fd86[_0xc008('0x6d')](_0x194e6a[_0xc008('0x6e')])?ut[_0xc008('0x111')](_0x194e6a[_0xc008('0x6e')][_0xc008('0x112')],_0x194e6a[_0xc008('0x113')],_0x194e6a[_0xc008('0x114')]>0x0?ut['getCallerIdRandom'](_0x194e6a[_0xc008('0x115')],_0x194e6a[_0xc008('0x114')]):_0x194e6a[_0xc008('0x115')]):ut[_0xc008('0x111')](_['isNil'](_0x194e6a['TrunkBackup'])?_0x194e6a[_0xc008('0x6e')][_0xc008('0x112')]:_0x194e6a['TrunkBackup'][_0xc008('0x112')],_0x194e6a[_0xc008('0x113')],_0x194e6a[_0xc008('0x114')]>0x0?ut[_0xc008('0x116')](_0x194e6a[_0xc008('0x115')],_0x194e6a[_0xc008('0x114')]):_0x194e6a[_0xc008('0x115')]);if(_0xb04a1c){_0x26b5c8['originatecalleridname']=ut['extractCalleridName'](_0xb04a1c);_0x26b5c8[_0xc008('0x117')]=ut['extractCalleridNumber'](_0xb04a1c);}var _0x1e981e=ut[_0xc008('0x118')](_0x194e6a,_0x5c358b,_0x1a0565,_0xb04a1c,_0x3f80f4,_0x26b5c8);_[_0xc008('0x119')](_0x26b5c8,ut[_0xc008('0x11a')](_0x1e981e));_0x26b5c8[_0xc008('0x11b')]=moment()[_0xc008('0x21')](_0xc008('0x5e'));_0x194e6a[_0xc008('0x11c')]=_0x1e981e;var _0x367873=ut[_0xc008('0x11d')](_0x26b5c8,_0x194e6a,_0x1e981e,_0x26b5c8[_0xc008('0x82')],_0x49688b);return ami['Action'](_0x367873)[_0xc008('0x54')](function(_0x39fd43){_0x194e6a[_0xc008('0x26')]+=0x1;logger[_0xc008('0x1e')](_0xc008('0x11e'),_0x3f80f4,_0xc008('0x8b'),_0x194e6a[_0xc008('0x23')],'originated:\x20',_0x194e6a[_0xc008('0x26')]);_0x10778f(_0x39fd43);})[_0xc008('0x47')](function(_0x3c537b){ut['logAgent'](_0x26b5c8,0xe,_0xc008('0x11f'));rpcDb[_0xc008('0xd7')](_0x26b5c8,_0xc008('0x120'));_0x237ffb(_0x3c537b);});});};Preview[_0xc008('0xe')][_0xc008('0x121')]=function(_0x122b28){if(this['actions'][_0x122b28['linkedid']]){this[_0xc008('0x14')][_0x122b28[_0xc008('0x83')]][_0xc008('0x46')]=_0x122b28[_0xc008('0x46')];}};Preview[_0xc008('0xe')]['syncOriginateResponse']=function(_0x7c1bf8){var _0x569ac1=this;var _0x15cdd1=this[_0xc008('0x14')][_0x7c1bf8['actionid']];if(_0x15cdd1){if(_0x15cdd1[_0xc008('0x122')]&&this[_0xc008('0x53')][_0x15cdd1[_0xc008('0x122')]]){ut[_0xc008('0x123')](_0x15cdd1,this['agents'][_0x15cdd1[_0xc008('0x122')]][_0xc008('0x23')],this[_0xc008('0x53')][_0x15cdd1[_0xc008('0x122')]]['id']);}var _0x157b26=_['clone'](_0x15cdd1);_0x157b26[_0xc008('0x88')]=moment()[_0xc008('0x21')](_0xc008('0x5e'));var _0x4ca3fa=_0x569ac1[_0xc008('0x11')][_0x15cdd1[_0xc008('0x3b')]];if(ut[_0xc008('0x124')](_0x7c1bf8[_0xc008('0x125')])){if(_0x15cdd1['unlockAgent']){rpcDb[_0xc008('0x126')](_0x15cdd1[_0xc008('0x85')]);}if(_0x15cdd1[_0xc008('0x82')]){rpcDb[_0xc008('0x5d')](_0x15cdd1[_0xc008('0x85')]);}ami['emit'](_0xc008('0x127'),ut['buildObj'](_0x15cdd1,'rejected',this[_0xc008('0x11')][_0x15cdd1['queue']]));this[_0xc008('0xd3')](_0x157b26,_0x4ca3fa,_0x7c1bf8);}else{_0x15cdd1[_0xc008('0x11b')]=moment()[_0xc008('0x21')](_0xc008('0x5e'));ut[_0xc008('0xd6')](_0x157b26,0x4,_0xc008('0x128'));rpcDb[_0xc008('0xd7')](_0x157b26,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xc008('0xe')][_0xc008('0x19')]=function(_0x267756){var _0x45fe90=this[_0xc008('0x14')][_0x267756[_0xc008('0x83')]];var _0x59b5b9;if(_0x45fe90){_0x59b5b9=this[_0xc008('0x11')][_0x45fe90[_0xc008('0x3b')]];logger[_0xc008('0x1e')](_0xc008('0x129'),_0x267756[_0xc008('0x83')],_0xc008('0x8b'),_0x59b5b9[_0xc008('0x23')],_0xc008('0x3d'),_0x59b5b9['pTalking']);}if(this['actions'][_0x267756[_0xc008('0x83')]]&&_0x267756[_0xc008('0x83')]!==_0x267756['uniqueid']){if(_0x267756[_0xc008('0x12a')]==='16'&&this['actions'][_0x267756[_0xc008('0x83')]][_0xc008('0x3e')]){this[_0xc008('0x70')](_0x267756,_0x267756[_0xc008('0x83')],_0x267756[_0xc008('0x12a')]);}else if(this[_0xc008('0x14')][_0x267756[_0xc008('0x83')]]['dialAnswer']){logger[_0xc008('0x1e')]('[syncHangup][talking][cause]',_0x267756[_0xc008('0x83')],_0x267756[_0xc008('0x12a')],_0xc008('0x8b'),_0x59b5b9[_0xc008('0x23')],_0xc008('0x3d'),_0x59b5b9[_0xc008('0x27')]);this[_0xc008('0x70')](_0x267756,_0x267756['linkedid'],_0x267756[_0xc008('0x12a')]);}}else if(_0x45fe90&&_[_0xc008('0x55')](_0x45fe90['statedesc'])&&_0x59b5b9[_0xc008('0x12b')]&&_0x267756[_0xc008('0x83')]===_0x267756[_0xc008('0x8a')]&&_[_0xc008('0x55')](_0x267756[_0xc008('0xde')])&&_0x267756[_0xc008('0x12a')]==='16'&&_0x267756['channelstate']==='6'&&_[_0xc008('0xd4')](_0x45fe90[_0xc008('0x12c')])){if(_0x45fe90[_0xc008('0x81')]){rpcDb[_0xc008('0x126')](_0x45fe90['idContact']);}if(_0x45fe90['activeContact']){rpcDb['disableContact'](_0x45fe90[_0xc008('0x85')]);}_0x267756[_0xc008('0xde')]='22';this['callProgressDetectingAgent'](_0x45fe90,_0x59b5b9,_0x267756);}else if(_0x45fe90&&_0x45fe90['transfer']){if(_0x267756['cause']==='16'&&this['actions'][_0x267756[_0xc008('0x83')]][_0xc008('0x3e')]){logger['info'](_0xc008('0x12d'),_0x267756[_0xc008('0x83')],_0x267756[_0xc008('0x12a')],_0xc008('0x8b'),_0x59b5b9[_0xc008('0x23')],'pTalking:\x20',_0x59b5b9['pTalking']);this[_0xc008('0x70')](_0x267756,_0x267756[_0xc008('0x83')],_0x267756[_0xc008('0x12a')]);}else if(this[_0xc008('0x14')][_0x267756[_0xc008('0x83')]][_0xc008('0x3e')]){logger[_0xc008('0x1e')]('[syncHangup][talking][cause]',_0x267756[_0xc008('0x83')],_0x267756[_0xc008('0x12a')],_0xc008('0x8b'),_0x59b5b9[_0xc008('0x23')],_0xc008('0x3d'),_0x59b5b9[_0xc008('0x27')]);this[_0xc008('0x70')](_0x267756,_0x267756['linkedid'],_0x267756['cause']);}}};Preview[_0xc008('0xe')][_0xc008('0x1b')]=function(_0x11bcba){if(this[_0xc008('0x14')][_0x11bcba[_0xc008('0xd1')]]&&_0x11bcba[_0xc008('0xd1')]!==_0x11bcba[_0xc008('0x12e')]){this[_0xc008('0x70')](_0x11bcba,_0x11bcba[_0xc008('0xd1')],_0x11bcba[_0xc008('0xc6')]);}};Preview[_0xc008('0xe')][_0xc008('0x12f')]=function(_0x37e1f2){if(this['actions'][_0x37e1f2['linkedid']]&&_0x37e1f2[_0xc008('0x83')]!==_0x37e1f2[_0xc008('0x8a')]&&!this[_0xc008('0x14')][_0x37e1f2[_0xc008('0x83')]][_0xc008('0x3e')]){if(_0x37e1f2[_0xc008('0x12a')]==='1'){this[_0xc008('0x70')](_0x37e1f2,_0x37e1f2['linkedid'],_0x37e1f2['cause']);}}};Preview['prototype'][_0xc008('0x130')]=function(_0x4b7132,_0x4dd095,_0x4b37c6){if(this[_0xc008('0x14')][_0x4b7132]){if(_[_0xc008('0x55')](this[_0xc008('0x14')][_0x4b7132][_0xc008('0x11c')])){this[_0xc008('0x14')][_0x4b7132][_0xc008('0x11c')]={};}this[_0xc008('0x14')][_0x4b7132][_0xc008('0x11c')][_0x4dd095]=_0x4b37c6;}};Preview[_0xc008('0xe')][_0xc008('0x131')]=function(_0x355b1d){try{if(!_[_0xc008('0x55')](_0x355b1d)){if(ut['filterKey'](_['keys'](_0x355b1d[_0xc008('0x132')])[0x0])){this[_0xc008('0x130')](_0x355b1d[_0xc008('0x8a')],_[_0xc008('0x133')](_0x355b1d[_0xc008('0x132')])[0x0],_0x355b1d[_0xc008('0x134')]);}}}catch(_0xcdba52){logger[_0xc008('0x135')]('[syncVarSet][Preview]',util[_0xc008('0x136')](_0xcdba52,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x5c7afe){if(_0x5c7afe){if(this['actions'][_0x5c7afe[_0xc008('0x137')]]){this['actions'][_0x5c7afe[_0xc008('0x137')]][_0xc008('0x12c')]=!![];}}};Preview[_0xc008('0xe')]['syncBlindTransfer']=function(_0x4e33e3){if(_0x4e33e3){if(this[_0xc008('0x14')][_0x4e33e3[_0xc008('0x138')]]){this['actions'][_0x4e33e3[_0xc008('0x138')]][_0xc008('0x12c')]=!![];}}};module[_0xc008('0x139')]=Preview;
\ No newline at end of file
index 0b175c2..5dc5bf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb791=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','catch','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type'];(function(_0x691235,_0x72d709){var _0x5cbaf8=function(_0x43e9dd){while(--_0x43e9dd){_0x691235['push'](_0x691235['shift']());}};_0x5cbaf8(++_0x72d709);}(_0xb791,0x129));var _0x1b79=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb791[_0x1a36a5];return _0x746243;};'use strict';var util=require(_0x1b79('0x0'));var BPromise=require(_0x1b79('0x1'));var logger=require(_0x1b79('0x2'))(_0x1b79('0x3'));var cmHopper=require(_0x1b79('0x4'));var cmHopperHistory=require(_0x1b79('0x5'));var cmHopperBlack=require(_0x1b79('0x6'));var agentReportPreview=require(_0x1b79('0x7'));var voiceQueueReport=require(_0x1b79('0x8'));function loggerCatch(_0x2bebdb){return function(_0x137f9f){logger[_0x1b79('0x9')](_0x2bebdb,util['inspect'](_0x137f9f,{'showHidden':![],'depth':null}));};}function create(_0x59380d){return cmHopperHistory['createHistory'](_0x59380d)[_0x1b79('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x27163b){return BPromise[_0x1b79('0xb')]()[_0x1b79('0xc')](agentReportPreview[_0x1b79('0xd')](_0x27163b))[_0x1b79('0xa')](loggerCatch(_0x1b79('0xe')));}function moveContact(_0x3a8618){return cmHopper[_0x1b79('0xf')](_0x3a8618,!![])[_0x1b79('0xa')](loggerCatch(_0x1b79('0x10')));}exports[_0x1b79('0x11')]=function(_0x186acd){return cmHopperBlack[_0x1b79('0x11')](_0x186acd)[_0x1b79('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x1b79('0x12')]=function(_0x33e74a){return BPromise[_0x1b79('0xb')]()[_0x1b79('0xc')](cmHopper[_0x1b79('0x12')](_0x33e74a))[_0x1b79('0xa')](loggerCatch(_0x1b79('0x13')));};exports['createHistory']=function(_0x4621ec,_0x418c26){create(_0x4621ec)[_0x1b79('0xa')](loggerCatch(_0x418c26));moveContact(_0x4621ec)[_0x1b79('0xa')](loggerCatch(_0x418c26));};exports['createAgentHistory']=function(_0x5d139b,_0x3370ea){createAgent(_0x5d139b)[_0x1b79('0xa')](loggerCatch(_0x3370ea));};exports[_0x1b79('0x14')]=function(_0x30ec13,_0x25526b){create(_0x30ec13)[_0x1b79('0xa')](loggerCatch(_0x25526b));};exports[_0x1b79('0x15')]=function(_0x1303f9,_0x2d65d2){moveContact(_0x1303f9)[_0x1b79('0xa')](loggerCatch(_0x2d65d2));};exports['rescheduleContact']=function(_0x46607c,_0x1a31f3,_0xf2d849){if(_0x1a31f3){_0x46607c[_0x1b79('0x16')]=null;}if(_0xf2d849){_0x46607c[_0x1b79('0x17')]=![];}return cmHopper[_0x1b79('0x18')](_0x46607c)[_0x1b79('0xa')](loggerCatch(_0x1b79('0x19')));};exports[_0x1b79('0x1a')]=function(_0x568743){return cmHopper[_0x1b79('0x1a')](_0x568743)['catch'](loggerCatch(_0x1b79('0x1b')));};exports['unlockContact']=function(_0x2c133f){return cmHopper[_0x1b79('0x1c')]({'UserId':null},_0x2c133f,0x1)['catch'](loggerCatch(_0x1b79('0x1d')));};exports[_0x1b79('0x1e')]=function(_0x5782c9){return cmHopper[_0x1b79('0x1c')]({'active':![]},_0x5782c9,0x1)[_0x1b79('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0x1b79('0x1f')]=function(_0x3f01ee){var _0x4ff4fa={};_0x4ff4fa[_0x1b79('0x20')]=_0x3f01ee[_0x1b79('0x20')];_0x4ff4fa[_0x1b79('0x21')]=_0x3f01ee['uniqueid'];_0x4ff4fa[_0x1b79('0x22')]=_0x3f01ee[_0x1b79('0x22')];_0x4ff4fa[_0x1b79('0x23')]=_0x3f01ee[_0x1b79('0x23')];_0x4ff4fa[_0x1b79('0x24')]=_0x3f01ee[_0x1b79('0x24')];_0x4ff4fa[_0x1b79('0x25')]=_0x3f01ee['answertime'];_0x4ff4fa[_0x1b79('0x26')]=_0x3f01ee[_0x1b79('0x27')];_0x4ff4fa[_0x1b79('0x28')]=0x1;_0x4ff4fa[_0x1b79('0x29')]=_0x3f01ee[_0x1b79('0x2a')];_0x4ff4fa[_0x1b79('0x2b')]=_0x3f01ee[_0x1b79('0x2c')];_0x4ff4fa[_0x1b79('0x2d')]=_0x1b79('0x2e');_0x4ff4fa[_0x1b79('0x2f')]='xcally-motion-preview';_0x4ff4fa[_0x1b79('0x30')]=0x0;_0x4ff4fa[_0x1b79('0x31')]=0x1;_0x4ff4fa[_0x1b79('0x32')]=_0x3f01ee[_0x1b79('0x2c')];_0x4ff4fa['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()[_0x1b79('0xc')](voiceQueueReport[_0x1b79('0x33')](_0x4ff4fa))[_0x1b79('0xa')](loggerCatch(_0x1b79('0x34')));};exports[_0x1b79('0x35')]=function(_0x41cccf,_0x41e377){return BPromise[_0x1b79('0xb')]()[_0x1b79('0xc')](cmHopper[_0x1b79('0x35')](_0x41cccf,_0x41e377))[_0x1b79('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x30ea5c){return cmHopper[_0x1b79('0x18')](_0x30ea5c,!![],!![])[_0x1b79('0xa')](loggerCatch(_0x1b79('0x36')));};
\ No newline at end of file
+var _0x3411=['type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3411,0xaf));var _0x1341=function(_0x2d5e56,_0x339bdd){_0x2d5e56=_0x2d5e56-0x0;var _0x3f3baf=_0x3411[_0x2d5e56];return _0x3f3baf;};'use strict';var util=require('util');var BPromise=require(_0x1341('0x0'));var logger=require(_0x1341('0x1'))(_0x1341('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x1341('0x3'));var cmHopperBlack=require(_0x1341('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x1341('0x5'));function loggerCatch(_0x2693ed){return function(_0x4ddd3c){logger[_0x1341('0x6')](_0x2693ed,util['inspect'](_0x4ddd3c,{'showHidden':![],'depth':null}));};}function create(_0x3122c7){return cmHopperHistory[_0x1341('0x7')](_0x3122c7)[_0x1341('0x8')](loggerCatch(_0x1341('0x9')));}function createAgent(_0x48657d){return BPromise[_0x1341('0xa')]()[_0x1341('0xb')](agentReportPreview[_0x1341('0x7')](_0x48657d))['catch'](loggerCatch(_0x1341('0x9')));}function moveContact(_0x3a7270){return cmHopper[_0x1341('0xc')](_0x3a7270,!![])[_0x1341('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x5dc7d6){return cmHopperBlack[_0x1341('0xd')](_0x5dc7d6)['catch'](loggerCatch(_0x1341('0xe')));};exports[_0x1341('0xf')]=function(_0x5b1f68){return BPromise[_0x1341('0xa')]()['then'](cmHopper[_0x1341('0xf')](_0x5b1f68))['catch'](loggerCatch(_0x1341('0x10')));};exports[_0x1341('0x7')]=function(_0x279cd5,_0x4ab050){create(_0x279cd5)['catch'](loggerCatch(_0x4ab050));moveContact(_0x279cd5)['catch'](loggerCatch(_0x4ab050));};exports[_0x1341('0x11')]=function(_0x28349b,_0x2a3510){createAgent(_0x28349b)['catch'](loggerCatch(_0x2a3510));};exports[_0x1341('0x12')]=function(_0x3f1748,_0x541ce0){create(_0x3f1748)['catch'](loggerCatch(_0x541ce0));};exports[_0x1341('0x13')]=function(_0x53bbfd,_0x406faa){moveContact(_0x53bbfd)['catch'](loggerCatch(_0x406faa));};exports[_0x1341('0x14')]=function(_0x5159d2,_0x180f5a,_0x20b5a1){if(_0x180f5a){_0x5159d2[_0x1341('0x15')]=null;}if(_0x20b5a1){_0x5159d2['active']=![];}return cmHopper[_0x1341('0x14')](_0x5159d2)[_0x1341('0x8')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1341('0x16')]=function(_0x374480){return cmHopper[_0x1341('0x16')](_0x374480)['catch'](loggerCatch(_0x1341('0x17')));};exports[_0x1341('0x18')]=function(_0x3cd085){return cmHopper[_0x1341('0x18')]({'UserId':null},_0x3cd085,0x1)[_0x1341('0x8')](loggerCatch(_0x1341('0x19')));};exports[_0x1341('0x1a')]=function(_0x43af87){return cmHopper[_0x1341('0x18')]({'active':![]},_0x43af87,0x1)[_0x1341('0x8')](loggerCatch(_0x1341('0x1b')));};exports[_0x1341('0x1c')]=function(_0x315781){var _0x1d8fe0={};_0x1d8fe0[_0x1341('0x1d')]=_0x315781[_0x1341('0x1d')];_0x1d8fe0[_0x1341('0x1e')]=_0x315781[_0x1341('0x1e')];_0x1d8fe0['calleridnum']=_0x315781[_0x1341('0x1f')];_0x1d8fe0['calleridname']=_0x315781[_0x1341('0x20')];_0x1d8fe0[_0x1341('0x21')]=_0x315781[_0x1341('0x21')];_0x1d8fe0['queuecallerjoinAt']=_0x315781['answertime'];_0x1d8fe0[_0x1341('0x22')]=_0x315781[_0x1341('0x23')];_0x1d8fe0[_0x1341('0x24')]=0x1;_0x1d8fe0['queuecallercompleteAt']=_0x315781['endtime'];_0x1d8fe0[_0x1341('0x25')]=_0x315781[_0x1341('0x26')];_0x1d8fe0[_0x1341('0x27')]=_0x1341('0x28');_0x1d8fe0[_0x1341('0x29')]=_0x1341('0x2a');_0x1d8fe0[_0x1341('0x2b')]=0x0;_0x1d8fe0['assigned']=0x1;_0x1d8fe0[_0x1341('0x2c')]=_0x315781[_0x1341('0x26')];_0x1d8fe0['queuecallerexitreason']='COMPLETED';return BPromise[_0x1341('0xa')]()[_0x1341('0xb')](voiceQueueReport[_0x1341('0x2d')](_0x1d8fe0))[_0x1341('0x8')](loggerCatch(_0x1341('0x2e')));};exports['getContactRecallMe']=function(_0x2734f2,_0x49302b){return BPromise[_0x1341('0xa')]()[_0x1341('0xb')](cmHopper[_0x1341('0x2f')](_0x2734f2,_0x49302b))['catch'](loggerCatch(_0x1341('0x30')));};exports[_0x1341('0x31')]=function(_0x2d0bd2){return cmHopper[_0x1341('0x14')](_0x2d0bd2,!![],!![])[_0x1341('0x8')](loggerCatch(_0x1341('0x32')));};
\ No newline at end of file
index 92f6684..b31b872 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc57a=['state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','getSeconds','logLookAgent','UserId','ringtime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','channelAgent','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','calleridnum','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridNumber','match','keys','variables','forEach','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','error','inspect','logger','info','loggerError','message','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x11ac99,_0x4141bb){var _0x101761=function(_0x61c474){while(--_0x61c474){_0x11ac99['push'](_0x11ac99['shift']());}};_0x101761(++_0x4141bb);}(_0xc57a,0xf6));var _0xac57=function(_0x563a7e,_0x4d543a){_0x563a7e=_0x563a7e-0x0;var _0x4f7bd4=_0xc57a[_0x563a7e];return _0x4f7bd4;};'use strict';var util=require(_0xac57('0x0'));var _=require(_0xac57('0x1'));var moment=require('moment');var logger=require(_0xac57('0x2'))('preview');var ipAgi=process[_0xac57('0x3')][_0xac57('0x4')]||'127.0.0.1';var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0xb0fb76){return function(_0x3c3a0e){logger[_0xac57('0x5')](_0xb0fb76,util[_0xac57('0x6')](_0x3c3a0e,{'showHidden':![],'depth':null}));};};exports[_0xac57('0x7')]=function(_0x3c9eec,_0x313f29){logger[_0xac57('0x8')](_0x3c9eec,util[_0xac57('0x6')](_0x313f29,{'showHidden':![],'depth':null}));};exports[_0xac57('0x9')]=function(_0x38e1a4,_0x418c20){logger[_0xac57('0x5')](_0x38e1a4,util[_0xac57('0x6')](_0x418c20,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x5763dd){return function(_0x26b5f4){logger[_0xac57('0x8')](_0x5763dd,util[_0xac57('0x6')](_0x26b5f4,{'showHidden':![],'depth':null}));};};exports[_0xac57('0xa')]=function(_0x292cf6,_0x403c42,_0x151e16){return{'message':_0x292cf6,'unlock':_0x403c42,'active':_0x151e16};};exports['getCallerId']=function(_0x3994be,_0x3aac8d,_0x39b5b2){if(!_['isUndefined'](_0x39b5b2)&&_0xac57('0xb')===typeof _0x39b5b2&&!_['isEmpty'](_0x39b5b2)){if(!_[_0xac57('0xc')](_0x3aac8d)&&'string'===typeof _0x3aac8d&&!_[_0xac57('0xd')](_0x3aac8d)){return util[_0xac57('0xe')](_0xac57('0xf'),_0x3aac8d,_0x39b5b2);}return util[_0xac57('0xe')](_0xac57('0xf'),_0x39b5b2,_0x39b5b2);}if(!_['isUndefined'](_0x3994be)&&'string'===typeof _0x3994be&&!_['isEmpty'](_0x3994be)){return _0x3994be;}return _0xac57('0x10');};exports[_0xac57('0x11')]=function(_0x3830c0){if(_[_0xac57('0x12')](_0x3830c0)){return![];}return _0x3830c0;};exports[_0xac57('0x13')]=function(_0x1712a4,_0x1a8a8a,_0x26bcf8,_0x18988a,_0x3494a9,_0x47284a){var _0x471129={'XMD-QUEUE':_0x1a8a8a['Queue']?_0x1a8a8a[_0xac57('0x14')]['name']:'','XMD-CALLERID':_0x18988a,'XMD-CALLERID-PREVIEW':_0x47284a?util['format'](_0xac57('0xf'),_0x47284a[_0xac57('0x15')],_0x47284a['calleridnum']):_0x18988a,'XMD-DIALID':_0x3494a9,'XMD-CONTACTID':_0x1a8a8a[_0xac57('0x16')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x18988a,'XMD-VOICEQUEUEID':_0x1a8a8a[_0xac57('0x17')],'XMD-DIALCHANNEL':_0x26bcf8,'XMD-DIALTIMEOUT':_0x1712a4[_0xac57('0x18')]||0x1e,'XMD-DIALOPTIONS':util[_0xac57('0xe')]('\x22rtTxX%s%s\x22',_0x1712a4[_0xac57('0x19')]?'g':'',_['isEmpty'](_0x1712a4[_0xac57('0x1a')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1712a4[_0xac57('0x1b')]||'','XMD-AGI':_0x1712a4[_0xac57('0x1c')]?util['format'](_0xac57('0x1d'),ipAgi,_0x1712a4[_0xac57('0x1c')]):_0xac57('0x1e'),'XMD-AGIAFTER':_0x1712a4[_0xac57('0x19')]?util[_0xac57('0xe')](_0xac57('0x1d'),ipAgi,_0x1712a4[_0xac57('0x19')]):_0xac57('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x47284a?_0x47284a[_0xac57('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x47284a?_0x47284a['originatecalleridname']:'','XMD-DESTINATION':_0xac57('0x20'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xac57('0xd')](_0x1712a4[_0xac57('0x1a')])){_0x471129[util[_0xac57('0xe')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1712a4['monitor_format'];_0x471129[util['format']('%s',_0xac57('0x21'))]=_0x3494a9;}if(_0x1a8a8a&&_0x1a8a8a['Contact']){for(var _0x35f828 in _0x1a8a8a[_0xac57('0x22')]){if(_0x1a8a8a[_0xac57('0x22')][_0xac57('0x23')](_0x35f828)){if(!_[_0xac57('0x12')](_0x1a8a8a[_0xac57('0x22')][_0x35f828])&&_0x35f828!=='id'&&_0x35f828!=='tags'&&_0x35f828!=='createdAt'&&_0x35f828!==_0xac57('0x24')){_0x471129[util['format'](_0xac57('0x25'),_0xac57('0x26'),_[_0xac57('0x27')](_0x35f828))]=_0x1a8a8a[_0xac57('0x22')][_0x35f828];}}}}return _0x471129;};exports[_0xac57('0x28')]=function(_0x21da2a){var _0x13e806={};for(var _0x257ae1 in _0x21da2a){if(_0x21da2a[_0xac57('0x23')](_0x257ae1)){_0x13e806[util[_0xac57('0xe')]('%s',_[_0xac57('0x29')](_0x257ae1))]=_0x21da2a[_0x257ae1];}}return{'variables':_0x13e806};};exports[_0xac57('0x2a')]=function(_0x995d81,_0x48f9aa){if(!_['isNil'](_0x995d81)){if(_0x995d81[_0xac57('0x23')]('originated')){if(_0x995d81['originated']>0x0){_0x995d81[_0xac57('0x2b')]-=0x1;}else{logger[_0xac57('0x5')](_0xac57('0x2c'),_0x48f9aa);}}}else{logger[_0xac57('0x5')](_0xac57('0x2d'),_0x48f9aa);}};exports[_0xac57('0x2e')]=function(_0x5a6f50){var _0x31451b=moment()[_0xac57('0xe')](_0xac57('0x2f'));_0x5a6f50[_0xac57('0x30')]=0xd;_0x5a6f50['statedesc']=_0xac57('0x31');_0x5a6f50[_0xac57('0x32')]=_0x31451b;_0x5a6f50[_0xac57('0x33')]=_0x31451b;_0x5a6f50[_0xac57('0x34')]=_0x31451b;};exports[_0xac57('0x35')]=function(_0x1844d9,_0x41bbfe,_0x171067){var _0x115da2=moment()['format'](_0xac57('0x2f'));_0x1844d9[_0xac57('0x30')]=_0x41bbfe;_0x1844d9[_0xac57('0x36')]=_0x171067;_0x1844d9[_0xac57('0x33')]=_0x115da2;_0x1844d9['ringtime']=utils[_0xac57('0x37')](_0x1844d9[_0xac57('0x33')],_0x1844d9[_0xac57('0x32')]);};exports[_0xac57('0x38')]=function(_0x481ca0,_0x411527,_0x4288a5){_0x481ca0['membername']=_0x411527;_0x481ca0[_0xac57('0x39')]=_0x4288a5;};exports['logCustomer']=function(_0x42ab46,_0x19e307,_0x275df7){var _0x562853=moment()[_0xac57('0xe')](_0xac57('0x2f'));_0x42ab46['state']=_0x19e307;_0x42ab46[_0xac57('0x36')]=_0x275df7;_0x42ab46['responsetime']=_0x42ab46['responsetime']?_0x42ab46[_0xac57('0x33')]:_0x562853;_0x42ab46[_0xac57('0x34')]=_0x42ab46[_0xac57('0x34')]?_0x42ab46[_0xac57('0x34')]:_0x562853;_0x42ab46[_0xac57('0x3a')]=utils[_0xac57('0x37')](_0x42ab46[_0xac57('0x33')]||0x0,_0x42ab46[_0xac57('0x32')]||0x0);_0x42ab46['talktime']=_0x42ab46[_0xac57('0x3b')]?utils[_0xac57('0x37')](_0x42ab46[_0xac57('0x34')],_0x42ab46[_0xac57('0x3b')]):0x0;};exports[_0xac57('0x3c')]=function(_0x5e6638){return _0x5e6638===_0xac57('0x3d');};exports[_0xac57('0x3e')]=function(_0x37371a,_0x523cca,_0x365c24,_0x3e8abd,_0x3b9f1c){var _0x17c722=_0x3e8abd?_0xac57('0x3f'):_0x37371a[_0xac57('0x15')];_0x17c722=_0x3b9f1c?_0xac57('0x40'):_0x17c722;return{'actionid':_0x37371a[_0xac57('0x41')],'action':'originate','channel':_0x37371a['channelAgent'],'callerid':util[_0xac57('0xe')](_0xac57('0xf'),_0x17c722,_0x37371a['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xac57('0x42'),'Priority':'1','variable':_0x365c24,'timeout':(_0x523cca[_0xac57('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x37371a[_0xac57('0x41')]};};exports[_0xac57('0x44')]=function(_0x505cfe){return _0x505cfe['countbusyretry']+_0x505cfe[_0xac57('0x45')]+_0x505cfe[_0xac57('0x46')]+_0x505cfe[_0xac57('0x47')]+_0x505cfe[_0xac57('0x48')];};exports[_0xac57('0x49')]=function(_0x21846a){var _0x5a5de2=_[_0xac57('0x4a')](_0x21846a);_0x5a5de2['state']=0xf;_0x5a5de2[_0xac57('0x36')]=_0xac57('0x4b');return _0x5a5de2;};exports['scheduledAt']=function(_0x1b3a5b,_0x52d39c,_0x463042){var _0x16a4d9={};_0x16a4d9[_0x52d39c]=_0x1b3a5b[_0x52d39c];_0x16a4d9['active']=![];_0x16a4d9[_0xac57('0x4c')]=moment()[_0xac57('0x4d')](_0x463042,'minutes')[_0xac57('0xe')](_0xac57('0x2f'));_0x16a4d9[_0xac57('0x16')]=_0x1b3a5b[_0xac57('0x16')];_0x16a4d9['ListId']=_0x1b3a5b[_0xac57('0x4e')];_0x16a4d9[_0xac57('0x17')]=_0x1b3a5b[_0xac57('0x17')]||undefined;return _0x16a4d9;};exports[_0xac57('0x4f')]=function(_0x4c8bfe,_0x2b77a4){if(!_[_0xac57('0x12')](_0x4c8bfe)){if(_0x4c8bfe['pTalking']>0x0){_0x4c8bfe[_0xac57('0x50')]-=0x1;}else{logger[_0xac57('0x5')](_0x2b77a4,_0xac57('0x51'));}}else{logger['error'](_0x2b77a4,_0xac57('0x52'));}};exports[_0xac57('0x53')]=function(_0x947b7a){if(_0x947b7a<=0x0){return!![];}return![];};function buildObj(_0x4717e3,_0x143ce2,_0x71151e){_0x4717e3[_0xac57('0x54')]=_0x143ce2;_0x4717e3[_0xac57('0x55')]=_0x4717e3[_0xac57('0x56')];_0x4717e3[_0xac57('0x57')]=_0x4717e3[_0xac57('0x58')];_0x4717e3['motionChannel']=_0xac57('0x59');if(_0x71151e){_0x4717e3[_0xac57('0x5a')]=_0x71151e[_0xac57('0x5a')];}return _0x4717e3;}exports['buildObj']=buildObj;exports[_0xac57('0x5b')]=function(_0x52e559){var _0x2834e1={};_0x2834e1[_0xac57('0x56')]=_0x52e559[_0xac57('0x56')];_0x2834e1[_0xac57('0x57')]=_0x52e559['channelAgent'];_0x2834e1[_0xac57('0x41')]=_0x52e559[_0xac57('0x41')];return _0x2834e1;};exports[_0xac57('0x5c')]=function(_0xd2e249){var _0x3f2c11=[];for(var _0x395054 in _0xd2e249){if(_0xd2e249[_0xac57('0x23')](_0x395054)){if(!_[_0xac57('0x12')](_0xd2e249[_0x395054])&&_0xd2e249[_0x395054][_0xac57('0x30')]===_0xac57('0x5d')&&_0xd2e249[_0x395054][_0xac57('0x5e')]===_0xac57('0x5f')){_0x3f2c11[_0xac57('0x60')](_0xd2e249[_0x395054]['id']);}}}return _0x3f2c11;};exports[_0xac57('0x61')]=function(_0x1db6cb){var _0x1014ce=moment()[_0xac57('0x62')](0x0);var _0x26d6cb=moment(_0x1db6cb)[_0xac57('0x62')](0x0);return _0x1014ce[_0xac57('0x63')](_0x26d6cb,'seconds');};exports[_0xac57('0x64')]=function(_0x2c1e37){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c1e37[_0xac57('0x16')],'ListId':_0x2c1e37['ListId'],'VoiceQueueId':_0x2c1e37['VoiceQueueId']||undefined,'CampaignId':_0x2c1e37['CampaignId']||undefined};};exports[_0xac57('0x65')]=function(_0x384e82){if(_0x384e82===_0xac57('0x41')||_0x384e82===_0xac57('0x66')||_0x384e82===_0xac57('0x56')||_0x384e82===_0xac57('0x67')||_0x384e82===_0xac57('0x68')||_0x384e82===_0xac57('0x69')||_0x384e82===_0xac57('0x6a')||_0x384e82==='channelAgent'||_0x384e82===_0xac57('0x15')||_0x384e82===_0xac57('0x6b')||_0x384e82===_0xac57('0x6c')||_0x384e82===_0xac57('0x4c')||_0x384e82===_0xac57('0x6d')||_0x384e82===_0xac57('0x45')||_0x384e82===_0xac57('0x46')||_0x384e82===_0xac57('0x6e')||_0x384e82===_0xac57('0x6f')||_0x384e82===_0xac57('0x70')||_0x384e82===_0xac57('0x71')||_0x384e82===_0xac57('0x72')||_0x384e82===_0xac57('0x16')||_0x384e82===_0xac57('0x4e')||_0x384e82==='UserId'||_0x384e82===_0xac57('0x17')||_0x384e82===_0xac57('0x73')||_0x384e82===_0xac57('0x74')||_0x384e82===_0xac57('0x75')||_0x384e82===_0xac57('0x76')||_0x384e82===_0xac57('0x77')||_0x384e82===_0xac57('0x78')||_0x384e82==='xmd-dialtimeout'||_0x384e82==='xmd-dialoptions'||_0x384e82===_0xac57('0x79')||_0x384e82===_0xac57('0x7a')||_0x384e82===_0xac57('0x7b')||_0x384e82===_0xac57('0x7c')||_0x384e82===_0xac57('0x7d')||_0x384e82==='xmd-agiafter'||_0x384e82===_0xac57('0x7e')||_0x384e82===_0xac57('0x7f')||_0x384e82===_0xac57('0x80')||_0x384e82==='rtpaudioqosjitter'||_0x384e82===_0xac57('0x81')||_0x384e82===_0xac57('0x82')||_0x384e82===_0xac57('0x83')||_0x384e82===_0xac57('0x84')||_0x384e82===_0xac57('0x85')||_0x384e82==='rtpaudioqos'||_0x384e82===_0xac57('0x80')||_0x384e82===_0xac57('0x86')||_0x384e82===_0xac57('0x81')||_0x384e82===_0xac57('0x82')||_0x384e82===_0xac57('0x83')||_0x384e82===_0xac57('0x84')||_0x384e82===_0xac57('0x85')||_0x384e82===_0xac57('0x87')||_0x384e82===_0xac57('0x88')||_0x384e82===_0xac57('0x30')||_0x384e82===_0xac57('0x36')){return![];}return!![];};exports[_0xac57('0x89')]=function(_0x4006fa,_0x1b8042){var _0x4e1e19,_0x48fd82,_0x1a1c06;if(_0x1b8042<=0x0){_0x1b8042=0x1;}_0x4e1e19=new RegExp(_0xac57('0x8a')+_0x1b8042+'}$');_0x48fd82=Math[_0xac57('0x8b')](0xa,_0x1b8042-0x1);_0x1a1c06=Math[_0xac57('0x8b')](0xa,_0x1b8042)-0x1;return util[_0xac57('0xe')]('%s',_['replace'](_0x4006fa,_0x4e1e19,_[_0xac57('0x8c')](_0x48fd82,_0x1a1c06)));};exports['extractCalleridName']=function(_0x9519f6){var _0x554fa6=_0x9519f6['match'](/"(.*?)"/);return _0x554fa6?_0x554fa6[0x1]:_0x9519f6;};exports[_0xac57('0x8d')]=function(_0xde45bd){var _0x3ffb91=_0xde45bd[_0xac57('0x8e')](/<(.*?)>/);return _0x3ffb91?_0x3ffb91[0x1]:_0xde45bd;};function buildNoAnswerEventPayload(_0x50e783,_0x106355){var _0x44c7b6=buildObj(_0x50e783,'noanswer');if(!_[_0xac57('0xd')](_0x106355['variables'])){Object[_0xac57('0x8f')](_0x106355[_0xac57('0x90')])[_0xac57('0x91')](function(_0x1de610){_0x44c7b6[_0x1de610['toLowerCase']()]=_0x106355[_0xac57('0x90')][_0x1de610];});}return _0x44c7b6;}exports[_0xac57('0x92')]=buildNoAnswerEventPayload;
\ No newline at end of file
+var _0x9402=['format','string','\x22\x22\x20<>','isNil','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','membername','logCustomer','talktime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','channelAgent','agentReadyId','not_inuse','status','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','type','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','keys','variables','forEach','buildNoAnswerEventPayload','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','loggerError','error','logger2','info','message','isUndefined','isEmpty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9402,0x120));var _0x2940=function(_0x12201c,_0x51d333){_0x12201c=_0x12201c-0x0;var _0x285ca2=_0x9402[_0x12201c];return _0x285ca2;};'use strict';var util=require(_0x2940('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x2940('0x1'))(_0x2940('0x2'));var ipAgi=process['env'][_0x2940('0x3')]||_0x2940('0x4');var utils=require('../../dialer/utils');exports[_0x2940('0x5')]=function(_0x5fd491){return function(_0x52248f){logger['error'](_0x5fd491,util[_0x2940('0x6')](_0x52248f,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5cdb39,_0x36dd5d){logger['info'](_0x5cdb39,util[_0x2940('0x6')](_0x36dd5d,{'showHidden':![],'depth':null}));};exports[_0x2940('0x7')]=function(_0x4f27b4,_0x3c09a5){logger[_0x2940('0x8')](_0x4f27b4,util['inspect'](_0x3c09a5,{'showHidden':![],'depth':null}));};exports[_0x2940('0x9')]=function(_0x137e5e){return function(_0x4e4d12){logger[_0x2940('0xa')](_0x137e5e,util[_0x2940('0x6')](_0x4e4d12,{'showHidden':![],'depth':null}));};};exports[_0x2940('0xb')]=function(_0x3c2c94,_0x35983e,_0x541631){return{'message':_0x3c2c94,'unlock':_0x35983e,'active':_0x541631};};exports['getCallerId']=function(_0x1c2920,_0x1486ac,_0x3615e4){if(!_[_0x2940('0xc')](_0x3615e4)&&'string'===typeof _0x3615e4&&!_['isEmpty'](_0x3615e4)){if(!_[_0x2940('0xc')](_0x1486ac)&&'string'===typeof _0x1486ac&&!_[_0x2940('0xd')](_0x1486ac)){return util[_0x2940('0xe')]('\x22%s\x22\x20<%s>',_0x1486ac,_0x3615e4);}return util[_0x2940('0xe')]('\x22%s\x22\x20<%s>',_0x3615e4,_0x3615e4);}if(!_[_0x2940('0xc')](_0x1c2920)&&_0x2940('0xf')===typeof _0x1c2920&&!_[_0x2940('0xd')](_0x1c2920)){return _0x1c2920;}return _0x2940('0x10');};exports['isActive']=function(_0x2098a9){if(_[_0x2940('0x11')](_0x2098a9)){return![];}return _0x2098a9;};exports['addVariables']=function(_0x20100e,_0x3f9b18,_0x42fbd5,_0x4db420,_0xd25fc,_0x58d0bd){var _0x4d7d6b={'XMD-QUEUE':_0x3f9b18['Queue']?_0x3f9b18['Queue'][_0x2940('0x12')]:'','XMD-CALLERID':_0x4db420,'XMD-CALLERID-PREVIEW':_0x58d0bd?util[_0x2940('0xe')](_0x2940('0x13'),_0x58d0bd[_0x2940('0x14')],_0x58d0bd[_0x2940('0x15')]):_0x4db420,'XMD-DIALID':_0xd25fc,'XMD-CONTACTID':_0x3f9b18[_0x2940('0x16')],'XMD-CDRTYPE':_0x2940('0x17'),'CALLERID(all)':_0x4db420,'XMD-VOICEQUEUEID':_0x3f9b18[_0x2940('0x18')],'XMD-DIALCHANNEL':_0x42fbd5,'XMD-DIALTIMEOUT':_0x20100e[_0x2940('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x2940('0xe')](_0x2940('0x1a'),_0x20100e[_0x2940('0x1b')]?'g':'',_[_0x2940('0xd')](_0x20100e[_0x2940('0x1c')])?'':_0x2940('0x1d')),'XMD-DIALURL':_0x20100e[_0x2940('0x1e')]||'','XMD-AGI':_0x20100e['dialQueueProject']?util[_0x2940('0xe')]('\x22agi://%s/square,%s\x22',ipAgi,_0x20100e['dialQueueProject']):_0x2940('0x1f'),'XMD-AGIAFTER':_0x20100e['dialQueueProject2']?util[_0x2940('0xe')](_0x2940('0x20'),ipAgi,_0x20100e[_0x2940('0x1b')]):_0x2940('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x58d0bd?_0x58d0bd[_0x2940('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x58d0bd?_0x58d0bd[_0x2940('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x2940('0x23')};if(!_['isEmpty'](_0x20100e[_0x2940('0x1c')])){_0x4d7d6b[util[_0x2940('0xe')]('%s',_0x2940('0x24'))]=_0x20100e[_0x2940('0x1c')];_0x4d7d6b[util[_0x2940('0xe')]('%s',_0x2940('0x25'))]=_0xd25fc;}if(_0x3f9b18&&_0x3f9b18['Contact']){for(var _0x20c888 in _0x3f9b18[_0x2940('0x26')]){if(_0x3f9b18['Contact'][_0x2940('0x27')](_0x20c888)){if(!_[_0x2940('0x11')](_0x3f9b18[_0x2940('0x26')][_0x20c888])&&_0x20c888!=='id'&&_0x20c888!==_0x2940('0x28')&&_0x20c888!==_0x2940('0x29')&&_0x20c888!==_0x2940('0x2a')){_0x4d7d6b[util['format'](_0x2940('0x2b'),_0x2940('0x2c'),_['toUpper'](_0x20c888))]=_0x3f9b18[_0x2940('0x26')][_0x20c888];}}}}return _0x4d7d6b;};exports[_0x2940('0x2d')]=function(_0x8de41f){var _0x5bdd94={};for(var _0x41f97a in _0x8de41f){if(_0x8de41f[_0x2940('0x27')](_0x41f97a)){_0x5bdd94[util[_0x2940('0xe')]('%s',_[_0x2940('0x2e')](_0x41f97a))]=_0x8de41f[_0x41f97a];}}return{'variables':_0x5bdd94};};exports[_0x2940('0x2f')]=function(_0x1b20f7,_0x477b7b){if(!_[_0x2940('0x11')](_0x1b20f7)){if(_0x1b20f7[_0x2940('0x27')]('originated')){if(_0x1b20f7['originated']>0x0){_0x1b20f7[_0x2940('0x30')]-=0x1;}else{logger['error'](_0x2940('0x31'),_0x477b7b);}}}else{logger[_0x2940('0x8')](_0x2940('0x32'),_0x477b7b);}};exports[_0x2940('0x33')]=function(_0x40dab0){var _0xbb6595=moment()[_0x2940('0xe')](_0x2940('0x34'));_0x40dab0[_0x2940('0x35')]=0xd;_0x40dab0['statedesc']=_0x2940('0x36');_0x40dab0[_0x2940('0x37')]=_0xbb6595;_0x40dab0[_0x2940('0x38')]=_0xbb6595;_0x40dab0[_0x2940('0x39')]=_0xbb6595;};exports[_0x2940('0x3a')]=function(_0x2404d3,_0x2e9782,_0x2e1d68){var _0x4cc554=moment()[_0x2940('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x2404d3[_0x2940('0x35')]=_0x2e9782;_0x2404d3[_0x2940('0x3b')]=_0x2e1d68;_0x2404d3[_0x2940('0x38')]=_0x4cc554;_0x2404d3[_0x2940('0x3c')]=utils[_0x2940('0x3d')](_0x2404d3[_0x2940('0x38')],_0x2404d3[_0x2940('0x37')]);};exports[_0x2940('0x3e')]=function(_0x2fc05a,_0x2bd788,_0x3bea69){_0x2fc05a[_0x2940('0x3f')]=_0x2bd788;_0x2fc05a['UserId']=_0x3bea69;};exports[_0x2940('0x40')]=function(_0x3a46a6,_0x1eb343,_0x55260a){var _0x725c30=moment()[_0x2940('0xe')](_0x2940('0x34'));_0x3a46a6['state']=_0x1eb343;_0x3a46a6[_0x2940('0x3b')]=_0x55260a;_0x3a46a6[_0x2940('0x38')]=_0x3a46a6[_0x2940('0x38')]?_0x3a46a6[_0x2940('0x38')]:_0x725c30;_0x3a46a6[_0x2940('0x39')]=_0x3a46a6[_0x2940('0x39')]?_0x3a46a6[_0x2940('0x39')]:_0x725c30;_0x3a46a6[_0x2940('0x3c')]=utils[_0x2940('0x3d')](_0x3a46a6[_0x2940('0x38')]||0x0,_0x3a46a6['starttime']||0x0);_0x3a46a6[_0x2940('0x41')]=_0x3a46a6['answertime']?utils[_0x2940('0x3d')](_0x3a46a6[_0x2940('0x39')],_0x3a46a6['answertime']):0x0;};exports['isFailure']=function(_0x52d977){return _0x52d977===_0x2940('0x42');};exports[_0x2940('0x43')]=function(_0x18e11e,_0x5475a6,_0x3b8105,_0x1f825f,_0x359897){var _0xdd6ee3=_0x1f825f?_0x2940('0x44'):_0x18e11e[_0x2940('0x14')];_0xdd6ee3=_0x359897?_0x2940('0x45'):_0xdd6ee3;return{'actionid':_0x18e11e[_0x2940('0x46')],'action':_0x2940('0x47'),'channel':_0x18e11e['channelAgent'],'callerid':util[_0x2940('0xe')](_0x2940('0x13'),_0xdd6ee3,_0x18e11e[_0x2940('0x15')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x3b8105,'timeout':(_0x5475a6[_0x2940('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x18e11e[_0x2940('0x46')]};};exports[_0x2940('0x49')]=function(_0x32abe1){return _0x32abe1[_0x2940('0x4a')]+_0x32abe1[_0x2940('0x4b')]+_0x32abe1[_0x2940('0x4c')]+_0x32abe1[_0x2940('0x4d')]+_0x32abe1['countnosuchnumberretry'];};exports[_0x2940('0x4e')]=function(_0x2cc53c){var _0x2857ef=_[_0x2940('0x4f')](_0x2cc53c);_0x2857ef[_0x2940('0x35')]=0xf;_0x2857ef[_0x2940('0x3b')]=_0x2940('0x50');return _0x2857ef;};exports[_0x2940('0x51')]=function(_0xf6dde1,_0x4b9da3,_0x535ab8){var _0x57b82c={};_0x57b82c[_0x4b9da3]=_0xf6dde1[_0x4b9da3];_0x57b82c['active']=![];_0x57b82c[_0x2940('0x52')]=moment()[_0x2940('0x53')](_0x535ab8,_0x2940('0x54'))[_0x2940('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x57b82c[_0x2940('0x16')]=_0xf6dde1[_0x2940('0x16')];_0x57b82c[_0x2940('0x55')]=_0xf6dde1[_0x2940('0x55')];_0x57b82c[_0x2940('0x18')]=_0xf6dde1[_0x2940('0x18')]||undefined;return _0x57b82c;};exports[_0x2940('0x56')]=function(_0x2303b2,_0x6fa194){if(!_['isNil'](_0x2303b2)){if(_0x2303b2[_0x2940('0x57')]>0x0){_0x2303b2[_0x2940('0x57')]-=0x1;}else{logger[_0x2940('0x8')](_0x6fa194,_0x2940('0x58'));}}else{logger[_0x2940('0x8')](_0x6fa194,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x2940('0x59')]=function(_0xe0564d){if(_0xe0564d<=0x0){return!![];}return![];};function buildObj(_0x38cea6,_0x30a13a,_0x57a713){_0x38cea6[_0x2940('0x5a')]=_0x30a13a;_0x38cea6[_0x2940('0x12')]=_0x38cea6[_0x2940('0x5b')];_0x38cea6['interface']=_0x38cea6['channelAgent'];_0x38cea6[_0x2940('0x5c')]=_0x2940('0x5d');if(_0x57a713){_0x38cea6['mandatoryDisposition']=_0x57a713[_0x2940('0x5e')];}return _0x38cea6;}exports[_0x2940('0x5f')]=buildObj;exports[_0x2940('0x60')]=function(_0x4404a3){var _0x47d8f1={};_0x47d8f1[_0x2940('0x5b')]=_0x4404a3['queue'];_0x47d8f1[_0x2940('0x61')]=_0x4404a3[_0x2940('0x62')];_0x47d8f1[_0x2940('0x46')]=_0x4404a3['uniqueid'];return _0x47d8f1;};exports[_0x2940('0x63')]=function(_0x117fa1){var _0x489bd1=[];for(var _0x10e222 in _0x117fa1){if(_0x117fa1[_0x2940('0x27')](_0x10e222)){if(!_['isNil'](_0x117fa1[_0x10e222])&&_0x117fa1[_0x10e222][_0x2940('0x35')]===_0x2940('0x64')&&_0x117fa1[_0x10e222][_0x2940('0x65')]==='reachable'){_0x489bd1[_0x2940('0x66')](_0x117fa1[_0x10e222]['id']);}}}return _0x489bd1;};exports[_0x2940('0x67')]=function(_0xeba8a8){var _0x3e1391=moment()[_0x2940('0x68')](0x0);var _0x9d848=moment(_0xeba8a8)['milliseconds'](0x0);return _0x3e1391[_0x2940('0x69')](_0x9d848,_0x2940('0x6a'));};exports['createBody']=function(_0x404a5f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x404a5f[_0x2940('0x16')],'ListId':_0x404a5f[_0x2940('0x55')],'VoiceQueueId':_0x404a5f['VoiceQueueId']||undefined,'CampaignId':_0x404a5f[_0x2940('0x6b')]||undefined};};exports[_0x2940('0x6c')]=function(_0x815811){if(_0x815811===_0x2940('0x46')||_0x815811===_0x2940('0x6d')||_0x815811==='queue'||_0x815811===_0x2940('0x6e')||_0x815811==='campaigntype'||_0x815811===_0x2940('0x6f')||_0x815811==='membername'||_0x815811===_0x2940('0x62')||_0x815811===_0x2940('0x14')||_0x815811===_0x2940('0x70')||_0x815811===_0x2940('0x15')||_0x815811===_0x2940('0x52')||_0x815811===_0x2940('0x4a')||_0x815811===_0x2940('0x4b')||_0x815811===_0x2940('0x4c')||_0x815811===_0x2940('0x71')||_0x815811===_0x2940('0x72')||_0x815811===_0x2940('0x73')||_0x815811===_0x2940('0x74')||_0x815811===_0x2940('0x75')||_0x815811==='ContactId'||_0x815811===_0x2940('0x55')||_0x815811===_0x2940('0x76')||_0x815811==='VoiceQueueId'||_0x815811===_0x2940('0x77')||_0x815811==='xmd-voicequeueid'||_0x815811===_0x2940('0x78')||_0x815811===_0x2940('0x79')||_0x815811==='xmd-listid'||_0x815811===_0x2940('0x7a')||_0x815811===_0x2940('0x7b')||_0x815811===_0x2940('0x7c')||_0x815811===_0x2940('0x7d')||_0x815811==='xmd-dialchannel'||_0x815811===_0x2940('0x7e')||_0x815811===_0x2940('0x7f')||_0x815811===_0x2940('0x80')||_0x815811===_0x2940('0x81')||_0x815811===_0x2940('0x82')||_0x815811===_0x2940('0x83')||_0x815811===_0x2940('0x84')||_0x815811===_0x2940('0x85')||_0x815811===_0x2940('0x86')||_0x815811===_0x2940('0x87')||_0x815811===_0x2940('0x88')||_0x815811===_0x2940('0x89')||_0x815811==='rtpaudioqosrttbridged'||_0x815811===_0x2940('0x83')||_0x815811==='rtpaudioqosbridged'||_0x815811===_0x2940('0x85')||_0x815811===_0x2940('0x86')||_0x815811==='rtpaudioqosloss'||_0x815811===_0x2940('0x88')||_0x815811===_0x2940('0x89')||_0x815811==='rtpaudioqosrttbridged'||_0x815811===_0x2940('0x8a')||_0x815811===_0x2940('0x8b')||_0x815811===_0x2940('0x35')||_0x815811===_0x2940('0x3b')){return![];}return!![];};exports[_0x2940('0x8c')]=function(_0x5ae921,_0x7e212e){var _0x1bc726,_0x3a5127,_0x2e4fd3;if(_0x7e212e<=0x0){_0x7e212e=0x1;}_0x1bc726=new RegExp('\x5cw{0,'+_0x7e212e+'}$');_0x3a5127=Math[_0x2940('0x8d')](0xa,_0x7e212e-0x1);_0x2e4fd3=Math[_0x2940('0x8d')](0xa,_0x7e212e)-0x1;return util['format']('%s',_[_0x2940('0x8e')](_0x5ae921,_0x1bc726,_[_0x2940('0x8f')](_0x3a5127,_0x2e4fd3)));};exports[_0x2940('0x90')]=function(_0x24c679){var _0x2459cb=_0x24c679['match'](/"(.*?)"/);return _0x2459cb?_0x2459cb[0x1]:_0x24c679;};exports[_0x2940('0x91')]=function(_0x1ca650){var _0x2986a1=_0x1ca650[_0x2940('0x92')](/<(.*?)>/);return _0x2986a1?_0x2986a1[0x1]:_0x1ca650;};function buildNoAnswerEventPayload(_0x24d0f4,_0x1b69f5){var _0x428be2=buildObj(_0x24d0f4,'noanswer');if(!_[_0x2940('0xd')](_0x1b69f5['variables'])){Object[_0x2940('0x93')](_0x1b69f5[_0x2940('0x94')])[_0x2940('0x95')](function(_0x15be88){_0x428be2[_0x15be88['toLowerCase']()]=_0x1b69f5['variables'][_0x15be88];});}return _0x428be2;}exports[_0x2940('0x96')]=buildNoAnswerEventPayload;
\ No newline at end of file
index 1e4b369..cf3111a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4d0=['number','boolean','queueremove','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x305466,_0xe1ea9d){var _0x552150=function(_0x4638b1){while(--_0x4638b1){_0x305466['push'](_0x305466['shift']());}};_0x552150(++_0xe1ea9d);}(_0xa4d0,0xa6));var _0x0a4d=function(_0x5c1fbc,_0xb5d064){_0x5c1fbc=_0x5c1fbc-0x0;var _0x4c1b12=_0xa4d0[_0x5c1fbc];return _0x4c1b12;};'use strict';exports[_0x0a4d('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0a4d('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x0a4d('0x2'),'required':![]},'paused':{'type':_0x0a4d('0x3'),'required':![]}};exports[_0x0a4d('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0a4d('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x0a4d('0x1'),'required':!![]},'paused':{'type':_0x0a4d('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x0a4d('0x1'),'required':![]}};exports[_0x0a4d('0x5')]={'uniqueid':{'type':_0x0a4d('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x0a4d('0x1'),'required':!![]},'filename':{'type':_0x0a4d('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0a4d('0x1')}};exports[_0x0a4d('0x6')]={'uniqueid':{'type':_0x0a4d('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x0a4d('0x1'),'required':!![]},'context':{'type':_0x0a4d('0x1')}};
\ No newline at end of file
+var _0x3a86=['string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x1e2e4f,_0x52a6bf){var _0x559774=function(_0x24a4a6){while(--_0x24a4a6){_0x1e2e4f['push'](_0x1e2e4f['shift']());}};_0x559774(++_0x52a6bf);}(_0x3a86,0x1ad));var _0x63a8=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x3a86[_0x30cd7e];return _0x462a02;};'use strict';exports[_0x63a8('0x0')]={'queue':{'type':_0x63a8('0x1'),'required':!![]},'interface':{'type':_0x63a8('0x1'),'required':!![]},'membername':{'type':_0x63a8('0x1'),'required':!![]},'penalty':{'type':_0x63a8('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x63a8('0x3')]={'queue':{'type':_0x63a8('0x1'),'required':!![]},'interface':{'type':_0x63a8('0x1'),'required':!![]}};exports[_0x63a8('0x4')]={'interface':{'type':_0x63a8('0x1'),'required':!![]},'paused':{'type':_0x63a8('0x5')},'reason':{'type':'string','required':![]}};exports[_0x63a8('0x6')]={'module':{'type':'string','required':![]}};exports[_0x63a8('0x7')]={'uniqueid':{'type':_0x63a8('0x1'),'required':!![]}};exports[_0x63a8('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x63a8('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x63a8('0x9')]={'uniqueid':{'type':_0x63a8('0x1'),'required':!![]},'exten':{'type':_0x63a8('0x1'),'required':!![]},'context':{'type':_0x63a8('0x1')}};
\ No newline at end of file
index 497d6ba..e627a33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x4ccd8d,_0xac4ea6){var _0x59f9ea=function(_0x4d050c){while(--_0x4d050c){_0x4ccd8d['push'](_0x4ccd8d['shift']());}};_0x59f9ea(++_0xac4ea6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime;
\ No newline at end of file
+var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x2f36c6,_0x47f0b1){var _0x2e5255=function(_0x115fb9){while(--_0x115fb9){_0x2f36c6['push'](_0x2f36c6['shift']());}};_0x2e5255(++_0x47f0b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b5b42,_0x17696f){_0x1b5b42=_0x1b5b42-0x0;var _0x3cca24=_0x5f2f[_0x1b5b42];return _0x3cca24;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime;
\ No newline at end of file
index f9b444d..93c5017 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe89=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x577c88,_0x324e0d){var _0x4391fd=function(_0x4e2219){while(--_0x4e2219){_0x577c88['push'](_0x577c88['shift']());}};_0x4391fd(++_0x324e0d);}(_0xfe89,0x1db));var _0x9fe8=function(_0x42aa0f,_0x1917a1){_0x42aa0f=_0x42aa0f-0x0;var _0x3dcff2=_0xfe89[_0x42aa0f];return _0x3dcff2;};'use strict';function mergeDBDataToRealtime(_0x30ddc6,_0x112b13){var _0x20cc91=Object[_0x9fe8('0x0')]({},_0x30ddc6);for(var _0x35276a in _0x112b13){if(_0x20cc91[_0x9fe8('0x1')](_0x35276a)){_0x20cc91[_0x35276a]=_0x112b13[_0x35276a];}}return _0x20cc91;}exports[_0x9fe8('0x2')]=mergeDBDataToRealtime;
\ No newline at end of file
+var _0x9c95=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x20de6f,_0x16f903){var _0x496976=function(_0x2fd061){while(--_0x2fd061){_0x20de6f['push'](_0x20de6f['shift']());}};_0x496976(++_0x16f903);}(_0x9c95,0x10e));var _0x59c9=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x9c95[_0x172747];return _0x509692;};'use strict';function mergeDBDataToRealtime(_0x23998e,_0x140f26){var _0x492cfd=Object['assign']({},_0x23998e);for(var _0x3192ee in _0x140f26){if(_0x492cfd[_0x59c9('0x0')](_0x3192ee)){_0x492cfd[_0x3192ee]=_0x140f26[_0x3192ee];}}return _0x492cfd;}exports[_0x59c9('0x1')]=mergeDBDataToRealtime;
\ No newline at end of file
index d6cc488..b5ec764 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d66=['isNil','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','split','calleridnum','outbound','destination','exten','type','dialer','queue','from-voip-provider','callerid','context','from-sip','calleridpreview','originatecalleridnum','channel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','getCallType','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','prototype','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','find','accountcode','name'];(function(_0x1dd56c,_0x511e8a){var _0x211d4f=function(_0x1531a9){while(--_0x1531a9){_0x1dd56c['push'](_0x1dd56c['shift']());}};_0x211d4f(++_0x511e8a);}(_0x9d66,0x1cc));var _0x69d6=function(_0x46d6fb,_0x77c688){_0x46d6fb=_0x46d6fb-0x0;var _0xdc62d9=_0x9d66[_0x46d6fb];return _0xdc62d9;};'use strict';var _=require(_0x69d6('0x0'));var moment=require('moment');var util=require(_0x69d6('0x1'));var config=require('../../../config/environment');var ami=require(_0x69d6('0x2'));var RpcVoiceAgentReport=require(_0x69d6('0x3'));var RpcVoiceCallReport=require(_0x69d6('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x69d6('0x5'));var RpcVoiceQueueReport=require(_0x69d6('0x6'));var RpcVoiceRecording=require(_0x69d6('0x7'));var RpcVoiceTransferReport=require(_0x69d6('0x8'));var VoiceQueueReport=require(_0x69d6('0x9'));var VoiceCallReport=require(_0x69d6('0xa'));var VoiceAgentReport=require(_0x69d6('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x69d6('0xc'));function Report(_0xea9bf5){this['realtime']=_0xea9bf5;this[_0x69d6('0xd')]=_0xea9bf5[_0x69d6('0xd')];this[_0x69d6('0xe')]=_0xea9bf5[_0x69d6('0xe')];}Report[_0x69d6('0xf')]['sync']=function(_0x41d26a){var _0x211c3d=new VoiceQueueReport(this[_0x69d6('0x10')]);var _0x5d7dc8=new VoiceAgentReport(this[_0x69d6('0x10')]);var _0x42a87a=new VoiceDialReport(this[_0x69d6('0x10')]);var _0x2c5c6c=new VoiceCallReport(this[_0x69d6('0x10')]);var _0x26bf57=new UserReport(this[_0x69d6('0x10')]);if(config[_0x69d6('0x11')]&&config['xdr']['disabled']){ami['on'](_0x69d6('0x12'),this[_0x69d6('0x13')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x69d6('0x14')][_0x69d6('0x15')](this));ami['on'](_0x69d6('0x16'),this[_0x69d6('0x17')][_0x69d6('0x15')](this));ami['on'](_0x69d6('0x18'),this[_0x69d6('0x19')]['bind'](this));ami['on'](_0x69d6('0x1a'),this[_0x69d6('0x1b')][_0x69d6('0x15')](this));ami['on']('attendedtransfer',this[_0x69d6('0x1c')]['bind'](this));}};Report[_0x69d6('0xf')]['findAgent']=function(_0x397970){var _0x4821c5;_0x4821c5=_[_0x69d6('0x1d')](this[_0x69d6('0xd')],function(_0x2d0e80){return _0x2d0e80[_0x69d6('0x1e')]==_0x397970||_0x2d0e80[_0x69d6('0x1f')]==_0x397970;});if(_[_0x69d6('0x20')](_0x4821c5)){var _0x447de5=_['find'](this['telephones'],function(_0x844000){return _0x844000[_0x69d6('0x1e')]==_0x397970||_0x844000[_0x69d6('0x1f')]==_0x397970;});if(_0x447de5){_0x4821c5=_[_0x69d6('0x1d')](this[_0x69d6('0xd')],function(_0x30ea25){return _0x30ea25[_0x69d6('0x21')]==util[_0x69d6('0x22')]('SIP/%s',_0x447de5[_0x69d6('0x1f')]);});}}return _0x4821c5;};Report['prototype'][_0x69d6('0x13')]=function(_0x4d6acd){for(var _0x388f2f=0x0;_0x388f2f<_0x4d6acd[_0x69d6('0x23')];_0x388f2f+=0x1){var _0x14c38b=this[_0x69d6('0x24')](_0x4d6acd[_0x388f2f][_0x69d6('0x25')]);if(_0x14c38b){_0x4d6acd[_0x388f2f][_0x69d6('0x1e')]=_0x14c38b['accountcode'];_0x4d6acd[_0x388f2f][_0x69d6('0x26')]=!![];_0x4d6acd[_0x388f2f][_0x69d6('0x27')]=_0x14c38b[_0x69d6('0x1f')];_0x4d6acd[_0x388f2f]['interface']=_[_0x69d6('0x20')](_0x14c38b[_0x69d6('0x21')])?util[_0x69d6('0x22')](_0x69d6('0x28'),_0x14c38b[_0x69d6('0x1f')]):_0x14c38b[_0x69d6('0x21')];if(_0x4d6acd[_0x388f2f]['queuecallercomplete']){_0x4d6acd[_0x388f2f]['queuecallercompleteAt']=moment()['format'](_0x69d6('0x29'));}if(_0x4d6acd[_0x388f2f]['queuecallerexit']){_0x4d6acd[_0x388f2f][_0x69d6('0x2a')]=moment()[_0x69d6('0x22')](_0x69d6('0x29'));}RpcMemberReport[_0x69d6('0x13')](_0x4d6acd[_0x388f2f]);}RpcVoiceQueueReport[_0x69d6('0x2b')](_0x4d6acd[_0x388f2f]);}};function extractCalleridNumber(_0x484bfd){var _0x539a78=_0x484bfd[_0x69d6('0x2c')](/<(.*?)>/);return _0x539a78?_0x539a78[0x1]:_0x484bfd;}Report['prototype'][_0x69d6('0x2d')]=function(_0x3ccd3c){for(var _0x38ffae=0x0;_0x38ffae<Object[_0x69d6('0x2e')](this[_0x69d6('0xd')])[_0x69d6('0x23')];_0x38ffae++){var _0x465def=Object['keys'](this[_0x69d6('0xd')])[_0x38ffae];var _0x312c87=this['agents'][_0x465def];if(_0x312c87['accountcode']===Number(_0x3ccd3c))return _0x312c87;}return null;};Report[_0x69d6('0xf')]['getCallType']=function(_0x16f466){var _0x1c7c9d=_0x16f466['channel'][_0x69d6('0x2f')]('-')[0x0];var _0x4b96ce=this[_0x69d6('0xd')][_0x1c7c9d];if(!_0x4b96ce)_0x4b96ce=this[_0x69d6('0x2d')](_0x16f466[_0x69d6('0x30')]);return!_0x4b96ce?_0x69d6('0x31'):'internal';};Report[_0x69d6('0xf')][_0x69d6('0x14')]=function(_0x31514b){_0x31514b['destination']=_0x31514b[_0x69d6('0x32')]||_0x31514b[_0x69d6('0x33')];if(_0x31514b[_0x69d6('0x34')]==_0x69d6('0x35')){_0x31514b['lastapplication']=_0x69d6('0x36');_0x31514b['lastdata']=_0x31514b[_0x69d6('0x36')];if(_0x31514b['context']==_0x69d6('0x37')){_0x31514b['accountcode']='';_0x31514b['destination']=extractCalleridNumber(_0x31514b[_0x69d6('0x38')]);}else if(_0x31514b[_0x69d6('0x39')]==_0x69d6('0x3a')){if(_0x31514b[_0x69d6('0x32')]=='xcally-motion-preview'){_0x31514b[_0x69d6('0x32')]=extractCalleridNumber(_0x31514b[_0x69d6('0x3b')]);_0x31514b[_0x69d6('0x30')]=_0x31514b[_0x69d6('0x3c')];_0x31514b['destinationchannel']=[_0x31514b['channel'],_0x31514b[_0x69d6('0x3d')]=_0x31514b['destinationchannel']][0x0];_0x31514b['callerid']=_0x31514b[_0x69d6('0x3b')];}else{_0x31514b[_0x69d6('0x32')]=_0x31514b['calleridnum'];_0x31514b[_0x69d6('0x30')]=_0x31514b[_0x69d6('0x3c')];if(_0x31514b['disposition']==_0x69d6('0x3e')){_0x31514b[_0x69d6('0x1e')]=_0x31514b[_0x69d6('0x25')];}else{_0x31514b[_0x69d6('0x1e')]='';}}}}else{_0x31514b['callerid']=util[_0x69d6('0x22')](_0x69d6('0x3f'),_0x31514b[_0x69d6('0x40')],_0x31514b[_0x69d6('0x30')]);}if(RpcVoiceTransferReport['transfers'][_0x31514b[_0x69d6('0x41')]]){var _0x2fa30b=RpcVoiceTransferReport[_0x69d6('0x42')][_0x31514b[_0x69d6('0x41')]];_0x2fa30b[_0x69d6('0x43')]=_0x31514b['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x2fa30b);delete RpcVoiceTransferReport[_0x69d6('0x42')][_0x31514b[_0x69d6('0x41')]];}if(_[_0x69d6('0x20')](_0x31514b[_0x69d6('0x34')])){_0x31514b[_0x69d6('0x34')]=this[_0x69d6('0x44')](_0x31514b);}if(_['isNil'](_0x31514b[_0x69d6('0x45')])){var _0x2e8515=_0x31514b['channel'][_0x69d6('0x2f')]('-')[0x0];var _0x520714=this[_0x69d6('0xd')][_0x2e8515];if(!_0x520714)_0x520714=this[_0x69d6('0x2d')](_0x31514b['accountcode']);if(_0x520714){_0x31514b[_0x69d6('0x45')]=_0x520714['id'];_0x31514b[_0x69d6('0x46')]=_0x520714['name'];}}RpcVoiceCallReport['create'](_0x31514b);if(_0x31514b['monitor']){for(var _0x23dd05=0x0;_0x23dd05<_0x31514b[_0x69d6('0x47')][_0x69d6('0x23')];_0x23dd05+=0x1){_0x31514b[_0x69d6('0x48')]=_0x31514b[_0x69d6('0x47')][_0x23dd05][_0x69d6('0x49')];_0x31514b[_0x69d6('0x4a')]=_0x31514b[_0x69d6('0x47')][_0x23dd05][_0x69d6('0x4a')];if(_0x31514b[_0x69d6('0x33')]=='xcally-motion-preview'){_0x31514b[_0x69d6('0x30')]=_0x31514b['connectedlinenum'];_0x31514b[_0x69d6('0x40')]=_0x31514b[_0x69d6('0x4b')];_0x31514b['connectedlinenum']=_0x31514b[_0x69d6('0x1e')];_0x31514b[_0x69d6('0x4b')]=_0x31514b['membername'];_0x31514b[_0x69d6('0x33')]=_0x31514b['originatecalleridnum'];}else if(_0x31514b[_0x69d6('0x33')]=='xcally-motion-dialer'){_0x31514b['calleridnum']=_0x31514b[_0x69d6('0x32')];_0x31514b[_0x69d6('0x33')]=_0x31514b[_0x69d6('0x3c')];}RpcVoiceRecording[_0x69d6('0x2b')](_0x31514b);}}};Report[_0x69d6('0xf')]['voiceAgentReport']=function(_0x2e4033){if(_[_0x69d6('0x4c')](_0x2e4033)){_0x2e4033['forEach'](function(_0x4e7a01){RpcVoiceAgentReport[_0x69d6('0x2b')](_0x4e7a01);});}else{RpcVoiceAgentReport[_0x69d6('0x2b')](_0x2e4033);}};Report[_0x69d6('0xf')]['voiceDialReport']=function(_0xec8959){RpcVoiceDialReport['create'](_0xec8959);var _0xe562a2;var _0x35eaff;var _0x3d726e=_0xec8959[_0x69d6('0x3d')];if(_['startsWith'](_0x3d726e,'Local')){_0x35eaff=_0x3d726e[_0x69d6('0x4d')](_0x3d726e[_0x69d6('0x4e')]('/')+0x1,_0x3d726e[_0x69d6('0x4e')]('@'));_0xe562a2=_[_0x69d6('0x1d')](this[_0x69d6('0xd')],function(_0x4831fe){return _0x4831fe[_0x69d6('0x4f')]==_0x35eaff||_0x4831fe['phone']==_0x35eaff||_0x4831fe['accountcode']==_0x35eaff;});}else{_0x35eaff=_0x3d726e[_0x69d6('0x4d')](_0x3d726e[_0x69d6('0x4e')]('/')+0x1,_0x3d726e[_0x69d6('0x50')]('-'));_0xe562a2=this[_0x69d6('0x24')](_0x35eaff);}if(_0xe562a2){_0xec8959[_0x69d6('0x21')]=_[_0x69d6('0x20')](_0xe562a2[_0x69d6('0x21')])?util[_0x69d6('0x22')](_0x69d6('0x28'),_0xe562a2['name']):_0xe562a2[_0x69d6('0x21')];_0xec8959['membername']=_0xe562a2['name'];_0xec8959[_0x69d6('0x1e')]=_0xe562a2[_0x69d6('0x1e')];RpcMemberReport[_0x69d6('0x19')](_0xec8959);}};Report['prototype']['blindTransfer']=function(_0x2e9892){RpcVoiceTransferReport[_0x69d6('0x42')][_0x2e9892[_0x69d6('0x51')]]=_0x2e9892;};Report['prototype'][_0x69d6('0x1c')]=function(_0x356e0c){RpcVoiceTransferReport[_0x69d6('0x1c')](_0x356e0c);};module['exports']=Report;
\ No newline at end of file
+var _0xf67f=['interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','destination','type','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfers','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil'];(function(_0x1a5927,_0x1faaf0){var _0x115ea6=function(_0xe8db03){while(--_0xe8db03){_0x1a5927['push'](_0x1a5927['shift']());}};_0x115ea6(++_0x1faaf0);}(_0xf67f,0xeb));var _0xff67=function(_0x32da04,_0x255b7b){_0x32da04=_0x32da04-0x0;var _0x468bac=_0xf67f[_0x32da04];return _0x468bac;};'use strict';var _=require(_0xff67('0x0'));var moment=require(_0xff67('0x1'));var util=require(_0xff67('0x2'));var config=require(_0xff67('0x3'));var ami=require(_0xff67('0x4'));var RpcVoiceAgentReport=require(_0xff67('0x5'));var RpcVoiceCallReport=require(_0xff67('0x6'));var RpcVoiceDialReport=require(_0xff67('0x7'));var RpcMemberReport=require(_0xff67('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xff67('0x9'));var RpcVoiceTransferReport=require(_0xff67('0xa'));var VoiceQueueReport=require(_0xff67('0xb'));var VoiceCallReport=require(_0xff67('0xc'));var VoiceAgentReport=require(_0xff67('0xd'));var VoiceDialReport=require(_0xff67('0xe'));var UserReport=require(_0xff67('0xf'));function Report(_0x581490){this['realtime']=_0x581490;this[_0xff67('0x10')]=_0x581490[_0xff67('0x10')];this['telephones']=_0x581490[_0xff67('0x11')];}Report[_0xff67('0x12')][_0xff67('0x13')]=function(_0xedb5fd){var _0xda8545=new VoiceQueueReport(this[_0xff67('0x14')]);var _0x2a2e13=new VoiceAgentReport(this['realtime']);var _0x1cd222=new VoiceDialReport(this['realtime']);var _0x2f6e5b=new VoiceCallReport(this['realtime']);var _0x3b853a=new UserReport(this['realtime']);if(config[_0xff67('0x15')]&&config[_0xff67('0x15')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xff67('0x16')][_0xff67('0x17')](this));ami['on'](_0xff67('0x18'),this[_0xff67('0x19')]['bind'](this));ami['on'](_0xff67('0x1a'),this[_0xff67('0x1b')][_0xff67('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xff67('0x1c')][_0xff67('0x17')](this));ami['on'](_0xff67('0x1d'),this[_0xff67('0x1e')]['bind'](this));ami['on'](_0xff67('0x1f'),this[_0xff67('0x20')]['bind'](this));}};Report['prototype'][_0xff67('0x21')]=function(_0x33d556){var _0x476f49;_0x476f49=_[_0xff67('0x22')](this[_0xff67('0x10')],function(_0x2828ba){return _0x2828ba[_0xff67('0x23')]==_0x33d556||_0x2828ba[_0xff67('0x24')]==_0x33d556;});if(_[_0xff67('0x25')](_0x476f49)){var _0x27a9a5=_[_0xff67('0x22')](this[_0xff67('0x11')],function(_0x3cb8e7){return _0x3cb8e7['accountcode']==_0x33d556||_0x3cb8e7[_0xff67('0x24')]==_0x33d556;});if(_0x27a9a5){_0x476f49=_[_0xff67('0x22')](this[_0xff67('0x10')],function(_0x2a510e){return _0x2a510e[_0xff67('0x26')]==util[_0xff67('0x27')](_0xff67('0x28'),_0x27a9a5['name']);});}}return _0x476f49;};Report[_0xff67('0x12')][_0xff67('0x16')]=function(_0x5f0403){for(var _0x301527=0x0;_0x301527<_0x5f0403[_0xff67('0x29')];_0x301527+=0x1){var _0x48e6e7=this[_0xff67('0x21')](_0x5f0403[_0x301527][_0xff67('0x2a')]);if(_0x48e6e7){_0x5f0403[_0x301527][_0xff67('0x23')]=_0x48e6e7[_0xff67('0x23')];_0x5f0403[_0x301527][_0xff67('0x2b')]=!![];_0x5f0403[_0x301527][_0xff67('0x2c')]=_0x48e6e7['name'];_0x5f0403[_0x301527][_0xff67('0x26')]=_['isNil'](_0x48e6e7[_0xff67('0x26')])?util[_0xff67('0x27')]('SIP/%s',_0x48e6e7[_0xff67('0x24')]):_0x48e6e7[_0xff67('0x26')];if(_0x5f0403[_0x301527]['queuecallercomplete']){_0x5f0403[_0x301527][_0xff67('0x2d')]=moment()[_0xff67('0x27')](_0xff67('0x2e'));}if(_0x5f0403[_0x301527]['queuecallerexit']){_0x5f0403[_0x301527][_0xff67('0x2f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x5f0403[_0x301527]);}RpcVoiceQueueReport[_0xff67('0x30')](_0x5f0403[_0x301527]);}};function extractCalleridNumber(_0x4290e6){var _0x452b73=_0x4290e6[_0xff67('0x31')](/<(.*?)>/);return _0x452b73?_0x452b73[0x1]:_0x4290e6;}Report[_0xff67('0x12')][_0xff67('0x32')]=function(_0x48ccf0){for(var _0x186083=0x0;_0x186083<Object[_0xff67('0x33')](this[_0xff67('0x10')])[_0xff67('0x29')];_0x186083++){var _0x58e207=Object[_0xff67('0x33')](this['agents'])[_0x186083];var _0x26ba08=this['agents'][_0x58e207];if(_0x26ba08['accountcode']===Number(_0x48ccf0))return _0x26ba08;}return null;};Report[_0xff67('0x12')]['getCallType']=function(_0x1d7eaf){var _0x43bf7d=_0x1d7eaf[_0xff67('0x34')][_0xff67('0x35')]('-')[0x0];var _0xd0e0d5=this['agents'][_0x43bf7d];if(!_0xd0e0d5)_0xd0e0d5=this[_0xff67('0x32')](_0x1d7eaf[_0xff67('0x36')]);return!_0xd0e0d5?_0xff67('0x37'):_0xff67('0x38');};Report[_0xff67('0x12')][_0xff67('0x19')]=function(_0x5c7919){_0x5c7919[_0xff67('0x39')]=_0x5c7919[_0xff67('0x39')]||_0x5c7919['exten'];if(_0x5c7919[_0xff67('0x3a')]=='dialer'){_0x5c7919[_0xff67('0x3b')]=_0xff67('0x3c');_0x5c7919[_0xff67('0x3d')]=_0x5c7919[_0xff67('0x3c')];if(_0x5c7919[_0xff67('0x3e')]=='from-voip-provider'){_0x5c7919['accountcode']='';_0x5c7919[_0xff67('0x39')]=extractCalleridNumber(_0x5c7919[_0xff67('0x3f')]);}else if(_0x5c7919[_0xff67('0x3e')]==_0xff67('0x40')){if(_0x5c7919[_0xff67('0x39')]==_0xff67('0x41')){_0x5c7919[_0xff67('0x39')]=extractCalleridNumber(_0x5c7919[_0xff67('0x42')]);_0x5c7919[_0xff67('0x36')]=_0x5c7919['originatecalleridnum'];_0x5c7919['destinationchannel']=[_0x5c7919[_0xff67('0x34')],_0x5c7919[_0xff67('0x34')]=_0x5c7919['destinationchannel']][0x0];_0x5c7919[_0xff67('0x3f')]=_0x5c7919[_0xff67('0x42')];}else{_0x5c7919[_0xff67('0x39')]=_0x5c7919['calleridnum'];_0x5c7919[_0xff67('0x36')]=_0x5c7919[_0xff67('0x43')];if(_0x5c7919['disposition']==_0xff67('0x44')){_0x5c7919[_0xff67('0x23')]=_0x5c7919[_0xff67('0x2a')];}else{_0x5c7919[_0xff67('0x23')]='';}}}}else{_0x5c7919[_0xff67('0x3f')]=util['format'](_0xff67('0x45'),_0x5c7919['calleridname'],_0x5c7919[_0xff67('0x36')]);}if(RpcVoiceTransferReport['transfers'][_0x5c7919[_0xff67('0x46')]]){var _0xf14443=RpcVoiceTransferReport[_0xff67('0x47')][_0x5c7919[_0xff67('0x46')]];_0xf14443[_0xff67('0x48')]=_0x5c7919[_0xff67('0x49')];RpcVoiceTransferReport[_0xff67('0x1e')](_0xf14443);delete RpcVoiceTransferReport[_0xff67('0x47')][_0x5c7919[_0xff67('0x46')]];}if(_['isNil'](_0x5c7919[_0xff67('0x3a')])){_0x5c7919['type']=this[_0xff67('0x4a')](_0x5c7919);}if(_['isNil'](_0x5c7919[_0xff67('0x4b')])){var _0x37b910=_0x5c7919[_0xff67('0x34')][_0xff67('0x35')]('-')[0x0];var _0xcb2d3e=this[_0xff67('0x10')][_0x37b910];if(!_0xcb2d3e)_0xcb2d3e=this[_0xff67('0x32')](_0x5c7919['accountcode']);if(_0xcb2d3e){_0x5c7919['UserId']=_0xcb2d3e['id'];_0x5c7919[_0xff67('0x4c')]=_0xcb2d3e['name'];}}RpcVoiceCallReport['create'](_0x5c7919);if(_0x5c7919['monitor']){for(var _0x2d6456=0x0;_0x2d6456<_0x5c7919[_0xff67('0x4d')][_0xff67('0x29')];_0x2d6456+=0x1){_0x5c7919[_0xff67('0x4e')]=_0x5c7919[_0xff67('0x4d')][_0x2d6456][_0xff67('0x4f')];_0x5c7919['createdAt']=_0x5c7919[_0xff67('0x4d')][_0x2d6456][_0xff67('0x50')];if(_0x5c7919[_0xff67('0x51')]==_0xff67('0x41')){_0x5c7919[_0xff67('0x36')]=_0x5c7919[_0xff67('0x2a')];_0x5c7919['calleridname']=_0x5c7919[_0xff67('0x52')];_0x5c7919[_0xff67('0x2a')]=_0x5c7919[_0xff67('0x23')];_0x5c7919['connectedlinename']=_0x5c7919[_0xff67('0x4c')];_0x5c7919[_0xff67('0x51')]=_0x5c7919[_0xff67('0x43')];}else if(_0x5c7919[_0xff67('0x51')]==_0xff67('0x53')){_0x5c7919[_0xff67('0x36')]=_0x5c7919[_0xff67('0x39')];_0x5c7919['exten']=_0x5c7919['originatecalleridnum'];}RpcVoiceRecording[_0xff67('0x30')](_0x5c7919);}}};Report[_0xff67('0x12')]['voiceAgentReport']=function(_0x4fbea0){if(_[_0xff67('0x54')](_0x4fbea0)){_0x4fbea0[_0xff67('0x55')](function(_0x320a78){RpcVoiceAgentReport[_0xff67('0x30')](_0x320a78);});}else{RpcVoiceAgentReport[_0xff67('0x30')](_0x4fbea0);}};Report[_0xff67('0x12')][_0xff67('0x1c')]=function(_0x4671b6){RpcVoiceDialReport['create'](_0x4671b6);var _0x2eacd1;var _0x4f1c0e;var _0x515c3b=_0x4671b6[_0xff67('0x34')];if(_[_0xff67('0x56')](_0x515c3b,'Local')){_0x4f1c0e=_0x515c3b[_0xff67('0x57')](_0x515c3b['indexOf']('/')+0x1,_0x515c3b[_0xff67('0x58')]('@'));_0x2eacd1=_[_0xff67('0x22')](this['agents'],function(_0x206535){return _0x206535['mobile']==_0x4f1c0e||_0x206535['phone']==_0x4f1c0e||_0x206535[_0xff67('0x23')]==_0x4f1c0e;});}else{_0x4f1c0e=_0x515c3b[_0xff67('0x57')](_0x515c3b[_0xff67('0x58')]('/')+0x1,_0x515c3b[_0xff67('0x59')]('-'));_0x2eacd1=this[_0xff67('0x21')](_0x4f1c0e);}if(_0x2eacd1){_0x4671b6[_0xff67('0x26')]=_['isNil'](_0x2eacd1['interface'])?util[_0xff67('0x27')]('SIP/%s',_0x2eacd1['name']):_0x2eacd1['interface'];_0x4671b6[_0xff67('0x4c')]=_0x2eacd1['name'];_0x4671b6[_0xff67('0x23')]=_0x2eacd1['accountcode'];RpcMemberReport[_0xff67('0x1c')](_0x4671b6);}};Report[_0xff67('0x12')][_0xff67('0x1e')]=function(_0x58e1d5){RpcVoiceTransferReport[_0xff67('0x47')][_0x58e1d5[_0xff67('0x5a')]]=_0x58e1d5;};Report[_0xff67('0x12')][_0xff67('0x20')]=function(_0x19264a){RpcVoiceTransferReport['attendedTransfer'](_0x19264a);};module['exports']=Report;
\ No newline at end of file
index 9a61743..0183479 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27e2=['telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','indexOf','mobile','phone','updateStatusRealtime','[userReport][devicestatechange]','syncPeerStatus','info','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','ioredis','bluebird','../../../config/logger','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','prototype','isNotNull','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','stateTime','toLowerCase','toNumber','format'];(function(_0x364502,_0x5e578d){var _0x599246=function(_0x4cd510){while(--_0x4cd510){_0x364502['push'](_0x364502['shift']());}};_0x599246(++_0x5e578d);}(_0x27e2,0xe5));var _0x227e=function(_0x3e58a0,_0x574a07){_0x3e58a0=_0x3e58a0-0x0;var _0x342adc=_0x27e2[_0x3e58a0];return _0x342adc;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0x227e('0x0'));var BPromise=require(_0x227e('0x1'));var config=require('../../../config/environment');var logger=require(_0x227e('0x2'))('ami');var ami=require('../ami');config[_0x227e('0x3')]=_[_0x227e('0x4')](config['redis'],{'host':_0x227e('0x5'),'port':0x18eb});var io=require(_0x227e('0x6'))(new Redis(config['redis']));function UserReport(_0x3c5ad0){this[_0x227e('0x7')]=_0x3c5ad0['trunks'];this['agents']=_0x3c5ad0[_0x227e('0x8')];this[_0x227e('0x9')]=_0x3c5ad0['telephones'];ami['on'](_0x227e('0xa'),this[_0x227e('0xb')][_0x227e('0xc')](this));ami['on'](_0x227e('0xd'),this[_0x227e('0xb')][_0x227e('0xc')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x227e('0xc')](this));ami['on'](_0x227e('0xe'),this['syncPeerStatus'][_0x227e('0xc')](this));return this[_0x227e('0xf')]();}function showSipRegistrations(){Promise[_0x227e('0x10')]()[_0x227e('0x11')](ami[_0x227e('0x12')]())[_0x227e('0x13')](function(_0x447c4f){logger[_0x227e('0x14')]('[userReport][sipshowregistry]',util[_0x227e('0x15')](_0x447c4f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x227e('0x10')]()[_0x227e('0x11')](ami[_0x227e('0x16')]())[_0x227e('0x13')](function(_0x45cfe0){logger['error'](_0x227e('0x17'),util[_0x227e('0x15')](_0x45cfe0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x227e('0x10')]()[_0x227e('0x11')](ami['actionSipPeerStatus']())[_0x227e('0x13')](function(_0x26b101){logger[_0x227e('0x14')]('[userReport][sippeerstatus]',util['inspect'](_0x26b101,{'showHidden':![],'depth':null}));});}UserReport[_0x227e('0x18')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x227e('0x10')]()[_0x227e('0x11')](showSipRegistrations())[_0x227e('0x11')](listDeviceStates())[_0x227e('0x11')](showPeersStatus());},0x32c8);};UserReport[_0x227e('0x18')][_0x227e('0x19')]=function(_0x260cb1){return _0x260cb1!==null&&!_['isUndefined'](_0x260cb1);};UserReport[_0x227e('0x18')]['emit']=function(_0x28d52e,_0x36c23a,_0x16395a){io['to'](_0x28d52e)[_0x227e('0x1a')](_0x36c23a,_0x16395a);};UserReport[_0x227e('0x18')][_0x227e('0xb')]=function(_0x112ea1){try{if(this[_0x227e('0x19')](_0x112ea1)){logger['info'](_0x227e('0x1b'),_0x112ea1[_0x227e('0x1c')],_0x112ea1[_0x227e('0x1d')]);logger[_0x227e('0x1e')]('[userReport][registry]',util['inspect'](_0x112ea1,{'showHidden':![],'depth':null}));var _0x6c41ac=_[_0x227e('0x1f')](this['trunks'],{'defaultuser':_0x112ea1[_0x227e('0x1c')]});if(_0x6c41ac){_0x112ea1[_0x227e('0x20')]=_0x112ea1[_0x227e('0x1d')];_[_0x227e('0x21')](_0x6c41ac,_['omit'](_0x112ea1,['event',_0x227e('0x22'),'username',_0x227e('0x1d')]));logger[_0x227e('0x1e')](_0x227e('0x23'),util[_0x227e('0x15')](_0x6c41ac,{'showHidden':![],'depth':null}));this[_0x227e('0x1a')](util['format']('trunk:%s',_0x6c41ac[_0x227e('0x24')]),_0x227e('0x25'),_0x6c41ac);}}}catch(_0x470a30){logger[_0x227e('0x14')](_0x227e('0x26'),util[_0x227e('0x15')](_0x470a30,{'showHidden':![],'depth':null}));}};UserReport[_0x227e('0x18')]['syncDeviceState']=function(_0x28432b){try{if(this[_0x227e('0x19')](_0x28432b)){logger['info'](_0x227e('0x27'),_0x28432b[_0x227e('0x28')],_0x28432b[_0x227e('0x1d')]);logger[_0x227e('0x1e')]('[userReport][devicestatechange]',util[_0x227e('0x15')](_0x28432b,{'showHidden':![],'depth':null}));if(this[_0x227e('0x8')][_0x28432b[_0x227e('0x28')]]){if(!this[_0x227e('0x8')][_0x28432b[_0x227e('0x28')]][_0x227e('0x29')]||_0x28432b[_0x227e('0x1d')]['toLowerCase']()==_0x227e('0x2a')){this[_0x227e('0x8')][_0x28432b[_0x227e('0x28')]][_0x227e('0x29')]=![];if(this['agents'][_0x28432b[_0x227e('0x28')]][_0x227e('0x1d')]!==_0x28432b['state']['toLowerCase']()){this['agents'][_0x28432b[_0x227e('0x28')]][_0x227e('0x2b')]=_['toNumber'](moment()['format']('x'));}this[_0x227e('0x8')][_0x28432b['device']]['state']=_0x28432b[_0x227e('0x1d')][_0x227e('0x2c')]();this[_0x227e('0x8')][_0x28432b[_0x227e('0x28')]]['updateStatusRealtime'](_0x28432b);}}else if(this['telephones'][_0x28432b[_0x227e('0x28')]]){if(this[_0x227e('0x9')][_0x28432b[_0x227e('0x28')]][_0x227e('0x1d')]!==_0x28432b['state'][_0x227e('0x2c')]()){this[_0x227e('0x9')][_0x28432b[_0x227e('0x28')]]['stateTime']=_[_0x227e('0x2d')](moment()[_0x227e('0x2e')]('x'));}this['telephones'][_0x28432b[_0x227e('0x28')]]['state']=_0x28432b[_0x227e('0x1d')][_0x227e('0x2c')]();logger[_0x227e('0x1e')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x28432b[_0x227e('0x28')]],{'showHidden':![],'depth':null}));this[_0x227e('0x1a')](util[_0x227e('0x2e')](_0x227e('0x2f'),this['telephones'][_0x28432b[_0x227e('0x28')]]['name']),'telephone:save',this[_0x227e('0x9')][_0x28432b[_0x227e('0x28')]]);}else if(this['trunks'][_0x28432b['device']]){if(this[_0x227e('0x7')][_0x28432b[_0x227e('0x28')]][_0x227e('0x1d')]!==_0x28432b['state'][_0x227e('0x2c')]()){this[_0x227e('0x7')][_0x28432b[_0x227e('0x28')]][_0x227e('0x2b')]=_['toNumber'](moment()[_0x227e('0x2e')]('x'));}this[_0x227e('0x7')][_0x28432b['device']][_0x227e('0x1d')]=_0x28432b[_0x227e('0x1d')]['toLowerCase']();logger['debug'](_0x227e('0x30'),util['inspect'](this[_0x227e('0x7')][_0x28432b[_0x227e('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x227e('0x2e')](_0x227e('0x31'),this[_0x227e('0x7')][_0x28432b['device']][_0x227e('0x24')]),_0x227e('0x25'),this[_0x227e('0x7')][_0x28432b[_0x227e('0x28')]]);}else if(_[_0x227e('0x32')](_0x28432b[_0x227e('0x28')],_0x227e('0x33'))){var _0x12f7b9=_0x28432b[_0x227e('0x28')];var _0x1513be=_0x12f7b9['substring'](_0x12f7b9[_0x227e('0x34')]('/')+0x1,_0x12f7b9[_0x227e('0x34')]('@'));var _0x46d558=_[_0x227e('0x1f')](this['agents'],function(_0x30b585){return _0x30b585[_0x227e('0x35')]==_0x1513be||_0x30b585[_0x227e('0x36')]==_0x1513be||_0x30b585['accountcode']==_0x1513be;});if(_0x46d558){if(_0x46d558[_0x227e('0x1d')]!==_0x28432b[_0x227e('0x1d')]['toLowerCase']()){_0x46d558[_0x227e('0x2b')]=_[_0x227e('0x2d')](moment()[_0x227e('0x2e')]('x'));}_0x46d558[_0x227e('0x1d')]=_0x28432b['state'][_0x227e('0x2c')]();_0x46d558[_0x227e('0x29')]=!![];_0x46d558[_0x227e('0x37')](_0x28432b);}}}}catch(_0x26af45){logger[_0x227e('0x14')](_0x227e('0x38'),util[_0x227e('0x15')](_0x26af45,{'showHidden':![],'depth':null}));}};UserReport[_0x227e('0x18')][_0x227e('0x39')]=function(_0x2f72ce){try{if(this[_0x227e('0x19')](_0x2f72ce)&&this[_0x227e('0x19')](_0x2f72ce['peerstatus'])){logger[_0x227e('0x3a')](_0x227e('0x3b'),_0x2f72ce[_0x227e('0x3c')],_0x2f72ce['address'],_0x2f72ce[_0x227e('0xe')]);logger[_0x227e('0x1e')](_0x227e('0x3d'),util['inspect'](_0x2f72ce,{'showHidden':![],'depth':null}));if(this['agents'][_0x2f72ce[_0x227e('0x3c')]]){if(!this[_0x227e('0x8')][_0x2f72ce[_0x227e('0x3c')]]['local']||_0x2f72ce[_0x227e('0xe')]['toLowerCase']()==_0x227e('0x3e')){this[_0x227e('0x8')][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x29')]=![];this['agents'][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x3f')]=_0x2f72ce[_0x227e('0xe')]['toLowerCase']();this[_0x227e('0x8')][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x40')]=_0x2f72ce[_0x227e('0x40')];this[_0x227e('0x8')][_0x2f72ce['peer']][_0x227e('0x37')](_0x2f72ce);}}else if(this['telephones'][_0x2f72ce['peer']]){this[_0x227e('0x9')][_0x2f72ce['peer']]['status']=_0x2f72ce[_0x227e('0xe')]['toLowerCase']();this['telephones'][_0x2f72ce[_0x227e('0x3c')]]['address']=_0x2f72ce['address'];logger['debug'](_0x227e('0x41'),util[_0x227e('0x15')](this[_0x227e('0x9')][_0x2f72ce[_0x227e('0x3c')]],{'showHidden':![],'depth':null}));this[_0x227e('0x1a')](util[_0x227e('0x2e')]('telephone:%s',this[_0x227e('0x9')][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x24')]),_0x227e('0x42'),this[_0x227e('0x9')][_0x2f72ce[_0x227e('0x3c')]]);}else if(this['trunks'][_0x2f72ce[_0x227e('0x3c')]]){this[_0x227e('0x7')][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x3f')]=_0x2f72ce['peerstatus'][_0x227e('0x2c')]();this[_0x227e('0x7')][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x40')]=_0x2f72ce['address'];logger[_0x227e('0x1e')](_0x227e('0x43'),util['inspect'](this[_0x227e('0x7')][_0x2f72ce['peer']],{'showHidden':![],'depth':null}));this[_0x227e('0x1a')](util[_0x227e('0x2e')](_0x227e('0x31'),this[_0x227e('0x7')][_0x2f72ce[_0x227e('0x3c')]][_0x227e('0x24')]),'trunk:save',this[_0x227e('0x7')][_0x2f72ce[_0x227e('0x3c')]]);}}}catch(_0x4c5978){logger[_0x227e('0x14')](_0x227e('0x3d'),util[_0x227e('0x15')](_0x4c5978,{'showHidden':![],'depth':null}));}};module[_0x227e('0x44')]=UserReport;
\ No newline at end of file
+var _0x32bb=['state','debug','[userReport][registry]','find','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','bluebird','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','then','actionSipShowRegistry','catch','error','inspect','resolve','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username'];(function(_0x2480dd,_0x4551cf){var _0x303bc6=function(_0x223e79){while(--_0x223e79){_0x2480dd['push'](_0x2480dd['shift']());}};_0x303bc6(++_0x4551cf);}(_0x32bb,0xfe));var _0xb32b=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x32bb[_0x5a8aa3];return _0x5d0458;};'use strict';var _=require(_0xb32b('0x0'));var moment=require(_0xb32b('0x1'));var util=require(_0xb32b('0x2'));var Redis=require('ioredis');var BPromise=require(_0xb32b('0x3'));var config=require('../../../config/environment');var logger=require(_0xb32b('0x4'))('ami');var ami=require(_0xb32b('0x5'));config[_0xb32b('0x6')]=_[_0xb32b('0x7')](config[_0xb32b('0x6')],{'host':_0xb32b('0x8'),'port':0x18eb});var io=require(_0xb32b('0x9'))(new Redis(config[_0xb32b('0x6')]));function UserReport(_0xd1012f){this[_0xb32b('0xa')]=_0xd1012f['trunks'];this[_0xb32b('0xb')]=_0xd1012f[_0xb32b('0xb')];this['telephones']=_0xd1012f[_0xb32b('0xc')];ami['on'](_0xb32b('0xd'),this[_0xb32b('0xe')][_0xb32b('0xf')](this));ami['on']('registry',this[_0xb32b('0xe')][_0xb32b('0xf')](this));ami['on'](_0xb32b('0x10'),this['syncDeviceState'][_0xb32b('0xf')](this));ami['on'](_0xb32b('0x11'),this[_0xb32b('0x12')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0xb32b('0x13')](ami[_0xb32b('0x14')]())[_0xb32b('0x15')](function(_0x218304){logger[_0xb32b('0x16')]('[userReport][sipshowregistry]',util[_0xb32b('0x17')](_0x218304,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xb32b('0x18')]()[_0xb32b('0x13')](ami['actionDeviceStateList']())[_0xb32b('0x15')](function(_0x59fcd2){logger['error'](_0xb32b('0x19'),util['inspect'](_0x59fcd2,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb32b('0x18')]()[_0xb32b('0x13')](ami['actionSipPeerStatus']())[_0xb32b('0x15')](function(_0x4a48e7){logger['error'](_0xb32b('0x1a'),util[_0xb32b('0x17')](_0x4a48e7,{'showHidden':![],'depth':null}));});}UserReport[_0xb32b('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xb32b('0x18')]()[_0xb32b('0x13')](showSipRegistrations())['then'](listDeviceStates())[_0xb32b('0x13')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x3d73bc){return _0x3d73bc!==null&&!_[_0xb32b('0x1c')](_0x3d73bc);};UserReport['prototype'][_0xb32b('0x1d')]=function(_0x5478c8,_0x98ad9c,_0xfb1cad){io['to'](_0x5478c8)[_0xb32b('0x1d')](_0x98ad9c,_0xfb1cad);};UserReport[_0xb32b('0x1b')][_0xb32b('0xe')]=function(_0x27f1b0){try{if(this[_0xb32b('0x1e')](_0x27f1b0)){logger[_0xb32b('0x1f')](_0xb32b('0x20'),_0x27f1b0[_0xb32b('0x21')],_0x27f1b0[_0xb32b('0x22')]);logger[_0xb32b('0x23')](_0xb32b('0x24'),util[_0xb32b('0x17')](_0x27f1b0,{'showHidden':![],'depth':null}));var _0x5708ec=_[_0xb32b('0x25')](this[_0xb32b('0xa')],{'defaultuser':_0x27f1b0[_0xb32b('0x21')]});if(_0x5708ec){_0x27f1b0['stateRegistry']=_0x27f1b0[_0xb32b('0x22')];_['merge'](_0x5708ec,_[_0xb32b('0x26')](_0x27f1b0,[_0xb32b('0x27'),_0xb32b('0x28'),'username',_0xb32b('0x22')]));logger[_0xb32b('0x23')](_0xb32b('0x29'),util[_0xb32b('0x17')](_0x5708ec,{'showHidden':![],'depth':null}));this[_0xb32b('0x1d')](util[_0xb32b('0x2a')](_0xb32b('0x2b'),_0x5708ec[_0xb32b('0x2c')]),_0xb32b('0x2d'),_0x5708ec);}}}catch(_0x24e716){logger[_0xb32b('0x16')](_0xb32b('0x24'),util[_0xb32b('0x17')](_0x24e716,{'showHidden':![],'depth':null}));}};UserReport[_0xb32b('0x1b')]['syncDeviceState']=function(_0x173f86){try{if(this['isNotNull'](_0x173f86)){logger[_0xb32b('0x1f')](_0xb32b('0x2e'),_0x173f86[_0xb32b('0x2f')],_0x173f86[_0xb32b('0x22')]);logger[_0xb32b('0x23')]('[userReport][devicestatechange]',util[_0xb32b('0x17')](_0x173f86,{'showHidden':![],'depth':null}));if(this[_0xb32b('0xb')][_0x173f86['device']]){if(!this['agents'][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x30')]||_0x173f86[_0xb32b('0x22')][_0xb32b('0x31')]()==_0xb32b('0x32')){this['agents'][_0x173f86['device']]['local']=![];if(this[_0xb32b('0xb')][_0x173f86['device']][_0xb32b('0x22')]!==_0x173f86['state'][_0xb32b('0x31')]()){this[_0xb32b('0xb')][_0x173f86['device']][_0xb32b('0x33')]=_[_0xb32b('0x34')](moment()[_0xb32b('0x2a')]('x'));}this[_0xb32b('0xb')][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x22')]=_0x173f86[_0xb32b('0x22')][_0xb32b('0x31')]();this[_0xb32b('0xb')][_0x173f86['device']]['updateStatusRealtime'](_0x173f86);}}else if(this['telephones'][_0x173f86[_0xb32b('0x2f')]]){if(this[_0xb32b('0xc')][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x22')]!==_0x173f86['state'][_0xb32b('0x31')]()){this[_0xb32b('0xc')][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x33')]=_[_0xb32b('0x34')](moment()['format']('x'));}this[_0xb32b('0xc')][_0x173f86['device']]['state']=_0x173f86['state'][_0xb32b('0x31')]();logger['debug'](_0xb32b('0x35'),util[_0xb32b('0x17')](this[_0xb32b('0xc')][_0x173f86['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xb32b('0x36'),this[_0xb32b('0xc')][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x2c')]),_0xb32b('0x37'),this[_0xb32b('0xc')][_0x173f86[_0xb32b('0x2f')]]);}else if(this['trunks'][_0x173f86[_0xb32b('0x2f')]]){if(this['trunks'][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x22')]!==_0x173f86[_0xb32b('0x22')]['toLowerCase']()){this['trunks'][_0x173f86[_0xb32b('0x2f')]]['stateTime']=_['toNumber'](moment()[_0xb32b('0x2a')]('x'));}this[_0xb32b('0xa')][_0x173f86['device']][_0xb32b('0x22')]=_0x173f86[_0xb32b('0x22')][_0xb32b('0x31')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xb32b('0xa')][_0x173f86['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xb32b('0x2a')](_0xb32b('0x2b'),this[_0xb32b('0xa')][_0x173f86[_0xb32b('0x2f')]][_0xb32b('0x2c')]),_0xb32b('0x2d'),this[_0xb32b('0xa')][_0x173f86[_0xb32b('0x2f')]]);}else if(_[_0xb32b('0x38')](_0x173f86['device'],_0xb32b('0x39'))){var _0x1b4a23=_0x173f86['device'];var _0xa53db6=_0x1b4a23[_0xb32b('0x3a')](_0x1b4a23['indexOf']('/')+0x1,_0x1b4a23[_0xb32b('0x3b')]('@'));var _0x8e8464=_[_0xb32b('0x25')](this['agents'],function(_0x588a4a){return _0x588a4a[_0xb32b('0x3c')]==_0xa53db6||_0x588a4a[_0xb32b('0x3d')]==_0xa53db6||_0x588a4a[_0xb32b('0x3e')]==_0xa53db6;});if(_0x8e8464){if(_0x8e8464[_0xb32b('0x22')]!==_0x173f86[_0xb32b('0x22')][_0xb32b('0x31')]()){_0x8e8464[_0xb32b('0x33')]=_[_0xb32b('0x34')](moment()[_0xb32b('0x2a')]('x'));}_0x8e8464[_0xb32b('0x22')]=_0x173f86[_0xb32b('0x22')]['toLowerCase']();_0x8e8464['local']=!![];_0x8e8464['updateStatusRealtime'](_0x173f86);}}}}catch(_0x3b6e79){logger['error'](_0xb32b('0x3f'),util[_0xb32b('0x17')](_0x3b6e79,{'showHidden':![],'depth':null}));}};UserReport[_0xb32b('0x1b')]['syncPeerStatus']=function(_0x40002b){try{if(this[_0xb32b('0x1e')](_0x40002b)&&this[_0xb32b('0x1e')](_0x40002b['peerstatus'])){logger[_0xb32b('0x1f')](_0xb32b('0x40'),_0x40002b[_0xb32b('0x41')],_0x40002b[_0xb32b('0x42')],_0x40002b[_0xb32b('0x11')]);logger['debug'](_0xb32b('0x43'),util[_0xb32b('0x17')](_0x40002b,{'showHidden':![],'depth':null}));if(this['agents'][_0x40002b[_0xb32b('0x41')]]){if(!this[_0xb32b('0xb')][_0x40002b['peer']][_0xb32b('0x30')]||_0x40002b[_0xb32b('0x11')][_0xb32b('0x31')]()==_0xb32b('0x44')){this[_0xb32b('0xb')][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x30')]=![];this['agents'][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x45')]=_0x40002b[_0xb32b('0x11')]['toLowerCase']();this[_0xb32b('0xb')][_0x40002b[_0xb32b('0x41')]]['address']=_0x40002b[_0xb32b('0x42')];this['agents'][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x46')](_0x40002b);}}else if(this[_0xb32b('0xc')][_0x40002b[_0xb32b('0x41')]]){this['telephones'][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x45')]=_0x40002b[_0xb32b('0x11')]['toLowerCase']();this[_0xb32b('0xc')][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x42')]=_0x40002b[_0xb32b('0x42')];logger[_0xb32b('0x23')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x40002b['peer']],{'showHidden':![],'depth':null}));this[_0xb32b('0x1d')](util['format'](_0xb32b('0x36'),this['telephones'][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x2c')]),_0xb32b('0x37'),this['telephones'][_0x40002b['peer']]);}else if(this['trunks'][_0x40002b['peer']]){this[_0xb32b('0xa')][_0x40002b[_0xb32b('0x41')]]['status']=_0x40002b[_0xb32b('0x11')][_0xb32b('0x31')]();this[_0xb32b('0xa')][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x42')]=_0x40002b['address'];logger[_0xb32b('0x23')](_0xb32b('0x47'),util[_0xb32b('0x17')](this['trunks'][_0x40002b['peer']],{'showHidden':![],'depth':null}));this[_0xb32b('0x1d')](util[_0xb32b('0x2a')](_0xb32b('0x2b'),this['trunks'][_0x40002b[_0xb32b('0x41')]][_0xb32b('0x2c')]),'trunk:save',this['trunks'][_0x40002b[_0xb32b('0x41')]]);}}}catch(_0x538b77){logger['error'](_0xb32b('0x43'),util[_0xb32b('0x17')](_0x538b77,{'showHidden':![],'depth':null}));}};module['exports']=UserReport;
\ No newline at end of file
index 02c1ce3..5cb0b87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06e3=['syncHangup','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','merge','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','destconnectedlinenum','channel','split','name','accountcode','exten','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','interface','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x06e3,0x138));var _0x306e=function(_0x566cf2,_0x485cf1){_0x566cf2=_0x566cf2-0x0;var _0x13257b=_0x06e3[_0x566cf2];return _0x13257b;};'use strict';var _=require(_0x306e('0x0'));var moment=require(_0x306e('0x1'));var util=require(_0x306e('0x2'));var Redis=require(_0x306e('0x3'));var config=require(_0x306e('0x4'));var logger=require(_0x306e('0x5'))(_0x306e('0x6'));var ami=require(_0x306e('0x7'));config[_0x306e('0x8')]=_[_0x306e('0x9')](config[_0x306e('0x8')],{'host':_0x306e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x306e('0x8')]));function VoiceAgentReport(_0x21ce6d){this['channels']={};this[_0x306e('0xb')]=_0x21ce6d[_0x306e('0xc')];this[_0x306e('0xd')]=_0x21ce6d['voiceQueues'];this['agents']=_0x21ce6d[_0x306e('0xe')];this[_0x306e('0xf')]={};ami['on'](_0x306e('0x10'),this['syncAgentCalled'][_0x306e('0x11')](this));ami['on'](_0x306e('0x12'),this[_0x306e('0x13')]['bind'](this));ami['on']('agentringnoanswer',this[_0x306e('0x14')]['bind'](this));ami['on'](_0x306e('0x15'),this['syncQueueCallerAbandon'][_0x306e('0x11')](this));ami['on'](_0x306e('0x16'),this['syncAgentComplete'][_0x306e('0x11')](this));ami['on'](_0x306e('0x17'),this[_0x306e('0x18')][_0x306e('0x11')](this));ami['on'](_0x306e('0x19'),this[_0x306e('0x1a')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x306e('0x1b'),this[_0x306e('0x1c')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x306e('0x11')](this));ami['on'](_0x306e('0x1d'),this[_0x306e('0x1e')][_0x306e('0x11')](this));}VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x20')]=function(_0x3dab63,_0x397828,_0x203e35){io['to'](_0x3dab63)['emit'](_0x397828,_0x203e35);};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x21')]=function(_0x897028){return _0x897028!==null&&!_[_0x306e('0x22')](_0x897028);};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x23')]=function(_0x44424f){try{if(this[_0x306e('0x21')](_0x44424f)){logger['info'](_0x306e('0x24'),_0x44424f[_0x306e('0x25')],_0x44424f[_0x306e('0x26')],_0x44424f[_0x306e('0x27')]);logger[_0x306e('0x28')](_0x306e('0x29'),_0x44424f[_0x306e('0x25')],util[_0x306e('0x2a')](_0x44424f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x306e('0xc')][_0x44424f[_0x306e('0x25')]])){this[_0x306e('0xc')][_0x44424f[_0x306e('0x25')]]={};}var _0x4b4cb4=this[_0x306e('0xe')][_0x44424f['interface']];var _0x41ed10=this['channels'][_0x44424f[_0x306e('0x25')]][_0x44424f[_0x306e('0x27')]];var _0x37bc90=this[_0x306e('0xd')][_0x44424f['queue']];var _0x1aaef4=this[_0x306e('0xf')][_0x44424f[_0x306e('0x25')]];if(_[_0x306e('0x22')](_0x41ed10)){_0x41ed10={'agentcalledAt':moment()[_0x306e('0x2b')](_0x306e('0x2c')),'lastevent':_0x306e('0x2d'),'mandatoryDisposition':_0x37bc90&&_0x37bc90[_0x306e('0x2e')]?_0x37bc90[_0x306e('0x2e')]:![],'type':_0x37bc90&&_0x37bc90[_0x306e('0x2f')]?_0x37bc90[_0x306e('0x2f')]:_0x306e('0x30'),'variables':_0x1aaef4,'motionChannel':_0x306e('0x31')};}_[_0x306e('0x32')](_0x41ed10,_['omit'](_0x44424f,[_0x306e('0x33'),_0x306e('0x34')]));logger[_0x306e('0x28')](_0x306e('0x35'),_0x44424f[_0x306e('0x25')],util[_0x306e('0x2a')](_0x41ed10,{'showHidden':![],'depth':null}));ami[_0x306e('0x20')](_0x306e('0x36'),_0x41ed10);var _0x13cd57={'id':_0x4b4cb4['id'],'calleridnum':_0x41ed10[_0x306e('0x37')],'queue':_0x41ed10[_0x306e('0x38')],'variables':_0x41ed10[_0x306e('0xf')],'uniqueid':_0x44424f['uniqueid']};logger[_0x306e('0x28')](_0x306e('0x39'),_0x44424f[_0x306e('0x25')],util[_0x306e('0x2a')](_0x13cd57,{'showHidden':![],'depth':null}));this['emit'](util[_0x306e('0x2b')](_0x306e('0x3a'),_0x44424f[_0x306e('0x26')]),_0x306e('0x3b'),_0x13cd57);}}catch(_0x410a1f){logger[_0x306e('0x3c')](_0x306e('0x3d'),_0x44424f[_0x306e('0x25')],util[_0x306e('0x2a')](_0x410a1f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x13')]=function(_0x382e43){try{if(this[_0x306e('0x21')](_0x382e43)){if(this['channels'][_0x382e43[_0x306e('0x25')]]){logger[_0x306e('0x28')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x382e43['uniqueid'],util[_0x306e('0x2a')](_0x382e43,{'showHidden':![],'depth':null}));for(var _0x3a1924 in this['channels'][_0x382e43[_0x306e('0x25')]]){if(this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]]['hasOwnProperty'](_0x3a1924)){if(_0x382e43[_0x306e('0x27')]===_0x3a1924){logger[_0x306e('0x3e')](_0x306e('0x3f'),_0x382e43['uniqueid'],_0x382e43[_0x306e('0x26')],_0x382e43['destuniqueid']);this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x40')]=moment()['format'](_0x306e('0x2c'));this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x41')]=_0x382e43[_0x306e('0x41')];this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924]['connectedlinenum']=_0x382e43[_0x306e('0x42')];this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x43')]=_0x382e43[_0x306e('0x43')];this['channels'][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x44')]=_0x382e43[_0x306e('0x44')];this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x45')]=_0x382e43[_0x306e('0x45')];this['channels'][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x46')]=_0x306e('0x47');if(this['voiceChannels'][this[_0x306e('0xc')][_0x382e43['uniqueid']][_0x3a1924][_0x306e('0x25')]]){var _0x452760=this['voiceChannels'][this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x25')]][_0x306e('0x48')];this['channels'][_0x382e43['uniqueid']][_0x3a1924][_0x306e('0x48')]=_0x452760;_0x382e43['routealias']=_0x452760;}_[_0x306e('0x32')](this[_0x306e('0xe')][_0x382e43['interface']],_['pick'](_0x382e43,[_0x306e('0x38'),_0x306e('0x49'),_0x306e('0x48')]));var _0x18b742=this[_0x306e('0xe')][_0x382e43[_0x306e('0x4a')][_0x306e('0x4b')]('-')[0x0]];var _0x2821ca={'id':_0x18b742['id'],'name':_0x18b742[_0x306e('0x4c')],'agentconnected':!![],'destaccountcode':_0x18b742[_0x306e('0x4d')],'destconnectedlinenum':this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x382e43[_0x306e('0x27')]][_0x306e('0x4e')],'queue':this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x382e43[_0x306e('0x27')]][_0x306e('0x38')],'routealias':this[_0x306e('0xc')][_0x382e43['uniqueid']][_0x382e43['destuniqueid']][_0x306e('0x48')],'uniqueid':this[_0x306e('0xc')][_0x382e43['uniqueid']][_0x382e43['destuniqueid']]['uniqueid']};logger[_0x306e('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x382e43['uniqueid'],util[_0x306e('0x2a')](_0x2821ca,{'showHidden':![],'depth':null}));ami[_0x306e('0x20')](_0x306e('0x4f'),_0x2821ca);logger[_0x306e('0x28')](_0x306e('0x50'),_0x382e43[_0x306e('0x25')],util[_0x306e('0x2a')](_0x2821ca,{'showHidden':![],'depth':null}));this['emit'](util[_0x306e('0x2b')]('user:%s',_0x382e43['membername']),'user:agentconnect',_0x2821ca);}else if(!this['channels'][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x51')]&&!this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x16')]){logger[_0x306e('0x3e')](_0x306e('0x52'),_0x382e43[_0x306e('0x25')],this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x26')],_0x3a1924);this[_0x306e('0xc')][_0x382e43['uniqueid']][_0x3a1924][_0x306e('0x51')]=!![];this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924]['agentringnoanswerAt']=moment()[_0x306e('0x2b')](_0x306e('0x2c'));this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x53')]=_0x382e43[_0x306e('0x27')];this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x54')]=_0x382e43[_0x306e('0x26')];this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x46')]='answered_elsewhere';this[_0x306e('0xc')][_0x382e43[_0x306e('0x25')]][_0x3a1924][_0x306e('0x55')]=_0x306e('0x56');logger[_0x306e('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x382e43[_0x306e('0x25')],util[_0x306e('0x2a')](this[_0x306e('0xc')][_0x382e43['uniqueid']][_0x3a1924],{'showHidden':![],'depth':null}));ami[_0x306e('0x20')](_0x306e('0x57'),this[_0x306e('0xc')][_0x382e43['uniqueid']][_0x3a1924]);}}}}}}catch(_0x29c395){logger['error'](_0x306e('0x58'),_0x382e43[_0x306e('0x25')],util[_0x306e('0x2a')](_0x29c395,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x14')]=function(_0x571908){try{if(this[_0x306e('0x21')](_0x571908)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x571908[_0x306e('0x25')],util[_0x306e('0x2a')](_0x571908,{'showHidden':![],'depth':null}));if(this[_0x306e('0xc')][_0x571908[_0x306e('0x25')]]&&this[_0x306e('0xc')][_0x571908[_0x306e('0x25')]][_0x571908['destuniqueid']]){logger['info'](_0x306e('0x59'),_0x571908[_0x306e('0x25')],_0x571908[_0x306e('0x26')],_0x571908[_0x306e('0x27')]);var _0x1f4b14=this[_0x306e('0xe')][_0x571908[_0x306e('0x5a')]];var _0x32892a=this[_0x306e('0xc')][_0x571908[_0x306e('0x25')]][_0x571908[_0x306e('0x27')]];_0x32892a[_0x306e('0x51')]=!![];_0x32892a[_0x306e('0x5b')]=moment()[_0x306e('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x32892a['lastevent']=_0x306e('0x5c');_0x32892a[_0x306e('0x55')]='rejected';var _0x33a568={'id':_0x1f4b14['id'],'name':_0x1f4b14['name'],'queue':_0x32892a[_0x306e('0x38')],'uniqueid':_0x32892a['uniqueid']};logger['debug'](_0x306e('0x5d'),_0x571908[_0x306e('0x25')],util[_0x306e('0x2a')](_0x33a568,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x1f4b14['name']),_0x306e('0x5e'),_0x33a568);ami[_0x306e('0x20')]('custom:agentringnoanswer',_0x32892a);}}}catch(_0x580c13){logger[_0x306e('0x3c')](_0x306e('0x5f'),_0x571908[_0x306e('0x25')],util['inspect'](_0x580c13,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x60')]=function(_0x573ab3){try{if(this[_0x306e('0x21')](_0x573ab3)){logger[_0x306e('0x28')](_0x306e('0x61'),_0x573ab3[_0x306e('0x25')],util[_0x306e('0x2a')](_0x573ab3,{'showHidden':![],'depth':null}));if(this[_0x306e('0xc')][_0x573ab3[_0x306e('0x25')]]){for(var _0x4090a2 in this['channels'][_0x573ab3[_0x306e('0x25')]]){if(this['channels'][_0x573ab3[_0x306e('0x25')]][_0x306e('0x62')](_0x4090a2)&&!this[_0x306e('0xc')][_0x573ab3['uniqueid']][_0x4090a2]['agentringnoanswer']&&!this['channels'][_0x573ab3[_0x306e('0x25')]][_0x4090a2][_0x306e('0x16')]){logger[_0x306e('0x3e')](_0x306e('0x63'),_0x573ab3[_0x306e('0x25')],this[_0x306e('0xc')][_0x573ab3[_0x306e('0x25')]][_0x4090a2][_0x306e('0x26')],_0x4090a2);this[_0x306e('0xc')][_0x573ab3[_0x306e('0x25')]][_0x4090a2][_0x306e('0x51')]=!![];this['channels'][_0x573ab3[_0x306e('0x25')]][_0x4090a2]['agentringnoanswerAt']=moment()[_0x306e('0x2b')](_0x306e('0x2c'));this[_0x306e('0xc')][_0x573ab3['uniqueid']][_0x4090a2][_0x306e('0x46')]=_0x306e('0x64');this[_0x306e('0xc')][_0x573ab3[_0x306e('0x25')]][_0x4090a2][_0x306e('0x55')]=_0x306e('0x64');logger[_0x306e('0x28')](_0x306e('0x65'),_0x573ab3[_0x306e('0x25')],util['inspect'](this[_0x306e('0xc')][_0x573ab3[_0x306e('0x25')]][_0x4090a2],{'showHidden':![],'depth':null}));ami['emit'](_0x306e('0x66'),this[_0x306e('0xc')][_0x573ab3[_0x306e('0x25')]][_0x4090a2]);}}}}}catch(_0x212c14){logger[_0x306e('0x3c')](_0x306e('0x67'),_0x573ab3[_0x306e('0x25')],util[_0x306e('0x2a')](_0x212c14,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x306e('0x68')]=function(_0xa25727){try{if(this[_0x306e('0x21')](_0xa25727)){logger[_0x306e('0x28')](_0x306e('0x69'),_0xa25727[_0x306e('0x25')],util['inspect'](_0xa25727,{'showHidden':![],'depth':null}));if(this[_0x306e('0xc')][_0xa25727['uniqueid']]){for(var _0x4a8fcb in this['channels'][_0xa25727[_0x306e('0x25')]]){if(this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x306e('0x62')](_0x4a8fcb)){if(this[_0x306e('0xc')][_0xa25727['uniqueid']][_0x4a8fcb][_0x306e('0x40')]&&!this[_0x306e('0xc')][_0xa25727['uniqueid']][_0x4a8fcb][_0x306e('0x16')]){logger['info'](_0x306e('0x6a'),_0xa25727[_0x306e('0x25')],this['channels'][_0xa25727['uniqueid']][_0x4a8fcb]['membername'],_0x4a8fcb);this[_0x306e('0xc')][_0xa25727['uniqueid']][_0x4a8fcb]['agentcomplete']=!![];this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x4a8fcb][_0x306e('0x6b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x4a8fcb][_0x306e('0x46')]=_0x306e('0x6c');this['channels'][_0xa25727['uniqueid']][_0x4a8fcb]['reason']=_0xa25727['reason']==_0x306e('0x6d')?_0x306e('0x6e'):_0xa25727[_0x306e('0x55')];this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x4a8fcb][_0x306e('0x6f')]=_0xa25727[_0x306e('0x6f')];if(this[_0x306e('0xd')][_0xa25727[_0x306e('0x38')]]&&this[_0x306e('0xd')][_0xa25727['queue']][_0x306e('0x70')]){this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x4a8fcb][_0x306e('0x71')]=this['voiceQueues'][_0xa25727['queue']]['acwTimeout'];this['channels'][_0xa25727[_0x306e('0x25')]][_0x4a8fcb][_0x306e('0x72')]=!![];}this[_0x306e('0xe')][_0xa25727['interface']]=_[_0x306e('0x73')](this[_0x306e('0xe')][_0xa25727[_0x306e('0x5a')]],['queue',_0x306e('0x49')]);logger[_0x306e('0x28')](_0x306e('0x74'),_0xa25727['uniqueid'],util[_0x306e('0x2a')](this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x4a8fcb],{'showHidden':![],'depth':null}));ami['emit'](_0x306e('0x75'),this[_0x306e('0xc')][_0xa25727[_0x306e('0x25')]][_0x4a8fcb]);logger[_0x306e('0x28')](_0x306e('0x76'),_0xa25727[_0x306e('0x25')],util['inspect']({'id':this[_0x306e('0xe')][_0xa25727['interface']]['id'],'destaccountcode':_0xa25727[_0x306e('0x77')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x306e('0x2b')](_0x306e('0x3a'),_0xa25727['membername']),_0x306e('0x78'),{'id':this[_0x306e('0xe')][_0xa25727[_0x306e('0x5a')]]['id'],'destaccountcode':Number(_0xa25727[_0x306e('0x77')])});}}}}}}catch(_0x408e4f){logger[_0x306e('0x3c')](_0x306e('0x79'),_0xa25727['uniqueid'],util[_0x306e('0x2a')](_0x408e4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x18')]=function(_0x551a43){try{if(this[_0x306e('0x21')](_0x551a43)){logger[_0x306e('0x28')](_0x306e('0x7a'),_0x551a43[_0x306e('0x25')],util[_0x306e('0x2a')](_0x551a43,{'showHidden':![],'depth':null}));this[_0x306e('0x7b')](_0x551a43['uniqueid'],_[_0x306e('0x7c')](_0x551a43[_0x306e('0x7d')])[0x0],_0x551a43[_0x306e('0x7e')]);if(this[_0x306e('0xc')][_0x551a43[_0x306e('0x25')]]){for(var _0x48ca24 in this['channels'][_0x551a43[_0x306e('0x25')]]){if(this[_0x306e('0xc')][_0x551a43[_0x306e('0x25')]][_0x306e('0x62')](_0x48ca24)){logger[_0x306e('0x3e')](_0x306e('0x7f'),_0x551a43[_0x306e('0x25')],_0x48ca24,_[_0x306e('0x7c')](_0x551a43['variable'])[0x0],_0x551a43['value']);if(_[_0x306e('0x22')](this['channels'][_0x551a43['uniqueid']][_0x48ca24][_0x306e('0xf')])){this[_0x306e('0xc')][_0x551a43['uniqueid']][_0x48ca24][_0x306e('0xf')]={};}this['channels'][_0x551a43[_0x306e('0x25')]][_0x48ca24][_0x306e('0xf')]=this[_0x306e('0xf')][_0x551a43[_0x306e('0x25')]];}}}}}catch(_0x498f44){logger[_0x306e('0x3c')]('[%s][voiceAgentReport][varset]',_0x551a43[_0x306e('0x25')],util['inspect'](_0x498f44,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x26154d,_0x47ca39,_0x2a2d81){var _0x4bd806=['rtpaudioqos','rtpaudioqosbridged',_0x306e('0x80'),_0x306e('0x81'),_0x306e('0x82'),_0x306e('0x83'),_0x306e('0x84'),_0x306e('0x85'),_0x306e('0x86'),_0x306e('0x87'),_0x306e('0x88'),_0x306e('0x89'),_0x306e('0x8a'),_0x306e('0x8b'),_0x306e('0x8c'),'memberlastcall',_0x306e('0x26'),_0x306e('0x8d'),_0x306e('0x8e')];if(!_[_0x306e('0x8f')](_0x47ca39)&&!_[_0x306e('0x90')](_0x4bd806,_0x47ca39)){if(_[_0x306e('0x22')](this[_0x306e('0xf')][_0x26154d])){this[_0x306e('0xf')][_0x26154d]={};}this[_0x306e('0xf')][_0x26154d][_0x47ca39]=_0x2a2d81;}};VoiceAgentReport['prototype'][_0x306e('0x1a')]=function(_0x5f47c3){try{if(this[_0x306e('0x21')](_0x5f47c3)){logger['debug'](_0x306e('0x91'),_0x5f47c3['uniqueid'],util[_0x306e('0x2a')](_0x5f47c3,{'showHidden':![],'depth':null}));if(this[_0x306e('0xc')][_0x5f47c3[_0x306e('0x25')]]){for(var _0x36e9ab in this[_0x306e('0xc')][_0x5f47c3['uniqueid']]){if(this[_0x306e('0xc')][_0x5f47c3[_0x306e('0x25')]][_0x306e('0x62')](_0x36e9ab)){if(this[_0x306e('0xc')][_0x5f47c3[_0x306e('0x25')]][_0x36e9ab][_0x306e('0x55')]==_0x306e('0x6d')&&this[_0x306e('0xc')][_0x5f47c3[_0x306e('0x25')]][_0x36e9ab][_0x306e('0x16')]){logger[_0x306e('0x3e')](_0x306e('0x92'),_0x5f47c3['uniqueid'],_0x36e9ab);this[_0x306e('0xc')][_0x5f47c3[_0x306e('0x25')]][_0x36e9ab][_0x306e('0x6b')]=moment()[_0x306e('0x2b')](_0x306e('0x2c'));}}}logger[_0x306e('0x28')](_0x306e('0x93'),_0x5f47c3['uniqueid'],util['inspect'](_['values'](this[_0x306e('0xc')][_0x5f47c3['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x306e('0x20')](_0x306e('0x94'),_[_0x306e('0x95')](this[_0x306e('0xc')][_0x5f47c3[_0x306e('0x25')]]));delete this['channels'][_0x5f47c3[_0x306e('0x25')]];}if(this[_0x306e('0xf')][_0x5f47c3[_0x306e('0x25')]]){delete this[_0x306e('0xf')][_0x5f47c3[_0x306e('0x25')]];}}}catch(_0x26cfe8){logger['error']('[%s][voiceAgentReport][hangup]',_0x5f47c3[_0x306e('0x25')],util[_0x306e('0x2a')](_0x26cfe8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x217f2c){try{if(this[_0x306e('0x21')](_0x217f2c)){logger[_0x306e('0x28')](_0x306e('0x96'),_0x217f2c[_0x306e('0x25')],util['inspect'](_0x217f2c,{'showHidden':![],'depth':null}));if(this['channels'][_0x217f2c[_0x306e('0x97')]]){for(var _0x2e49e8 in this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]]){if(this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]][_0x306e('0x62')](_0x2e49e8)){if(_0x217f2c['origtransfereruniqueid']===_0x2e49e8){logger[_0x306e('0x3e')](_0x306e('0x98'),_0x217f2c['uniqueid'],this[_0x306e('0xc')][_0x217f2c['transfereeuniqueid']][_0x2e49e8][_0x306e('0x26')],_0x2e49e8);var _0x26986f=moment();this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]][_0x2e49e8][_0x306e('0x16')]=!![];this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]][_0x2e49e8][_0x306e('0x6b')]=moment()[_0x306e('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x217f2c['transfereeuniqueid']][_0x2e49e8][_0x306e('0x46')]=_0x306e('0x6c');this[_0x306e('0xc')][_0x217f2c['transfereeuniqueid']][_0x2e49e8][_0x306e('0x55')]='transfer';this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]][_0x2e49e8][_0x306e('0x6f')]=_0x26986f[_0x306e('0x99')](this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]][_0x2e49e8][_0x306e('0x40')],'seconds');}}}}if(this[_0x306e('0xc')][_0x217f2c[_0x306e('0x9a')]]){var _0x14f8bf=this[_0x306e('0xc')][_0x217f2c['secondtransfereruniqueid']];this[_0x306e('0xc')][_0x217f2c['secondtransfereruniqueid']]=this['channels'][_0x217f2c[_0x306e('0x97')]];this[_0x306e('0xc')][_0x217f2c[_0x306e('0x97')]]=_0x14f8bf;}}}catch(_0x361085){logger['error'](_0x306e('0x9b'),_0x217f2c[_0x306e('0x25')],util['inspect'](_0x361085,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x306e('0x1e')]=function(_0x444655){try{if(this[_0x306e('0x21')](_0x444655)){logger[_0x306e('0x28')](_0x306e('0x9c'),_0x444655['uniqueid'],util[_0x306e('0x2a')](_0x444655,{'showHidden':![],'depth':null}));if(this[_0x306e('0xc')][_0x444655[_0x306e('0x97')]]){for(var _0x33748 in this[_0x306e('0xc')][_0x444655['transfereeuniqueid']]){if(this['channels'][_0x444655[_0x306e('0x97')]]['hasOwnProperty'](_0x33748)){if(_0x444655[_0x306e('0x9d')]===_0x33748){logger[_0x306e('0x3e')](_0x306e('0x9e'),_0x444655['uniqueid'],this['channels'][_0x444655[_0x306e('0x97')]][_0x33748][_0x306e('0x26')],_0x33748);var _0xb3095b=moment();this['channels'][_0x444655[_0x306e('0x97')]][_0x33748][_0x306e('0x16')]=!![];this[_0x306e('0xc')][_0x444655['transfereeuniqueid']][_0x33748][_0x306e('0x6b')]=_0xb3095b;this[_0x306e('0xc')][_0x444655[_0x306e('0x97')]][_0x33748][_0x306e('0x46')]='complete';this[_0x306e('0xc')][_0x444655[_0x306e('0x97')]][_0x33748]['reason']=_0x306e('0x6d');this[_0x306e('0xc')][_0x444655[_0x306e('0x97')]][_0x33748][_0x306e('0x6f')]=_0xb3095b['diff'](this[_0x306e('0xc')][_0x444655[_0x306e('0x97')]][_0x33748][_0x306e('0x40')],_0x306e('0x9f'));}}}}}}catch(_0xf6dc33){logger[_0x306e('0x3c')](_0x306e('0xa0'),_0x444655[_0x306e('0x25')],util[_0x306e('0x2a')](_0xf6dc33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0xa1')]=function(_0x49edc9){var _0x658bcd='';try{if(this[_0x306e('0x21')](_0x49edc9)){logger[_0x306e('0x28')](_0x306e('0xa2'),_0x49edc9[_0x306e('0x25')],util[_0x306e('0x2a')](_0x49edc9,{'showHidden':![],'depth':null}));if(_0x49edc9[_0x306e('0x4a')]){_0x658bcd=_0x49edc9['channel'][_0x306e('0xa3')](0x0,_0x49edc9[_0x306e('0x4a')][_0x306e('0xa4')]('-'));if(this[_0x306e('0xe')][_0x658bcd]){logger[_0x306e('0x3e')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x49edc9[_0x306e('0x25')],_0x658bcd);this[_0x306e('0xe')][_0x658bcd]['onhold']=!![];}}}}catch(_0x385ddd){logger[_0x306e('0x3c')]('[%s][voiceAgentReport][musiconholdstart]',_0x49edc9['uniqueid'],util[_0x306e('0x2a')](_0x385ddd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x306e('0x1f')][_0x306e('0x1c')]=function(_0x5f10ea){var _0x45756d='';try{if(this['isNotNull'](_0x5f10ea)){logger[_0x306e('0x28')](_0x306e('0xa5'),_0x5f10ea[_0x306e('0x25')],util[_0x306e('0x2a')](_0x5f10ea,{'showHidden':![],'depth':null}));if(_0x5f10ea['channel']){_0x45756d=_0x5f10ea['channel'][_0x306e('0xa3')](0x0,_0x5f10ea[_0x306e('0x4a')][_0x306e('0xa4')]('-'));if(this[_0x306e('0xe')][_0x45756d]){logger['info'](_0x306e('0xa6'),_0x5f10ea[_0x306e('0x25')],_0x45756d);this[_0x306e('0xe')][_0x45756d][_0x306e('0xa7')]=![];}}}}catch(_0x5cd9a0){logger[_0x306e('0x3c')](_0x306e('0xa8'),_0x5f10ea[_0x306e('0x25')],util[_0x306e('0x2a')](_0x5cd9a0,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport;
\ No newline at end of file
+var _0x5c65=['bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','uniqueid','interface','destuniqueid','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','merge','omit','event','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','destconnectedlinenum','channel','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','emit','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','custom:agentringnoanswer','error','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','reason','transfer','agent','talktime','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','defaults','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect'];(function(_0x3fe803,_0x132cc6){var _0x331b57=function(_0x265ee7){while(--_0x265ee7){_0x3fe803['push'](_0x3fe803['shift']());}};_0x331b57(++_0x132cc6);}(_0x5c65,0x1c3));var _0x55c6=function(_0xcd8fab,_0x1d0f1c){_0xcd8fab=_0xcd8fab-0x0;var _0x32cffa=_0x5c65[_0xcd8fab];return _0x32cffa;};'use strict';var _=require(_0x55c6('0x0'));var moment=require(_0x55c6('0x1'));var util=require(_0x55c6('0x2'));var Redis=require(_0x55c6('0x3'));var config=require(_0x55c6('0x4'));var logger=require('../../../config/logger')(_0x55c6('0x5'));var ami=require('../ami');config['redis']=_[_0x55c6('0x6')](config[_0x55c6('0x7')],{'host':_0x55c6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x4b64be){this[_0x55c6('0x9')]={};this[_0x55c6('0xa')]=_0x4b64be[_0x55c6('0x9')];this[_0x55c6('0xb')]=_0x4b64be['voiceQueues'];this[_0x55c6('0xc')]=_0x4b64be[_0x55c6('0xc')];this[_0x55c6('0xd')]={};ami['on']('agentcalled',this[_0x55c6('0xe')]['bind'](this));ami['on'](_0x55c6('0xf'),this[_0x55c6('0x10')][_0x55c6('0x11')](this));ami['on'](_0x55c6('0x12'),this[_0x55c6('0x13')][_0x55c6('0x11')](this));ami['on'](_0x55c6('0x14'),this[_0x55c6('0x15')][_0x55c6('0x11')](this));ami['on'](_0x55c6('0x16'),this[_0x55c6('0x17')][_0x55c6('0x11')](this));ami['on'](_0x55c6('0x18'),this[_0x55c6('0x19')][_0x55c6('0x11')](this));ami['on'](_0x55c6('0x1a'),this[_0x55c6('0x1b')][_0x55c6('0x11')](this));ami['on']('musiconholdstart',this[_0x55c6('0x1c')]['bind'](this));ami['on'](_0x55c6('0x1d'),this[_0x55c6('0x1e')][_0x55c6('0x11')](this));ami['on'](_0x55c6('0x1f'),this[_0x55c6('0x20')]['bind'](this));ami['on']('blindtransfer',this[_0x55c6('0x21')]['bind'](this));}VoiceAgentReport[_0x55c6('0x22')]['emit']=function(_0x21dbcb,_0x38cb35,_0x35a34f){io['to'](_0x21dbcb)['emit'](_0x38cb35,_0x35a34f);};VoiceAgentReport[_0x55c6('0x22')]['isNotNull']=function(_0x4a6134){return _0x4a6134!==null&&!_['isUndefined'](_0x4a6134);};VoiceAgentReport[_0x55c6('0x22')][_0x55c6('0xe')]=function(_0x442e91){try{if(this[_0x55c6('0x23')](_0x442e91)){logger[_0x55c6('0x24')](_0x55c6('0x25'),_0x442e91['uniqueid'],_0x442e91[_0x55c6('0x26')],_0x442e91['destuniqueid']);logger[_0x55c6('0x27')](_0x55c6('0x28'),_0x442e91['uniqueid'],util[_0x55c6('0x29')](_0x442e91,{'showHidden':![],'depth':null}));if(_[_0x55c6('0x2a')](this[_0x55c6('0x9')][_0x442e91[_0x55c6('0x2b')]])){this[_0x55c6('0x9')][_0x442e91[_0x55c6('0x2b')]]={};}var _0x3d081a=this[_0x55c6('0xc')][_0x442e91[_0x55c6('0x2c')]];var _0x455a36=this[_0x55c6('0x9')][_0x442e91[_0x55c6('0x2b')]][_0x442e91[_0x55c6('0x2d')]];var _0x29e881=this[_0x55c6('0xb')][_0x442e91[_0x55c6('0x2e')]];var _0x473425=this[_0x55c6('0xd')][_0x442e91[_0x55c6('0x2b')]];if(_['isUndefined'](_0x455a36)){_0x455a36={'agentcalledAt':moment()['format'](_0x55c6('0x2f')),'lastevent':'called','mandatoryDisposition':_0x29e881&&_0x29e881['mandatoryDisposition']?_0x29e881[_0x55c6('0x30')]:![],'type':_0x29e881&&_0x29e881[_0x55c6('0x31')]?_0x29e881[_0x55c6('0x31')]:_0x55c6('0x32'),'variables':_0x473425,'motionChannel':_0x55c6('0x33')};}_[_0x55c6('0x34')](_0x455a36,_[_0x55c6('0x35')](_0x442e91,[_0x55c6('0x36'),'privilege']));logger[_0x55c6('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x442e91[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x455a36,{'showHidden':![],'depth':null}));ami['emit'](_0x55c6('0x37'),_0x455a36);var _0x32890c={'id':_0x3d081a['id'],'calleridnum':_0x455a36['calleridnum'],'queue':_0x455a36[_0x55c6('0x2e')],'variables':_0x455a36[_0x55c6('0xd')],'uniqueid':_0x442e91[_0x55c6('0x2b')]};logger['debug'](_0x55c6('0x38'),_0x442e91['uniqueid'],util[_0x55c6('0x29')](_0x32890c,{'showHidden':![],'depth':null}));this['emit'](util[_0x55c6('0x39')]('user:%s',_0x442e91[_0x55c6('0x26')]),_0x55c6('0x3a'),_0x32890c);}}catch(_0x58bd7d){logger['error'](_0x55c6('0x3b'),_0x442e91[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x58bd7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')]['syncAgentConnect']=function(_0x49c488){try{if(this[_0x55c6('0x23')](_0x49c488)){if(this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]]){logger[_0x55c6('0x27')](_0x55c6('0x3c'),_0x49c488[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x49c488,{'showHidden':![],'depth':null}));for(var _0x5f3f0f in this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]]){if(this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x55c6('0x3d')](_0x5f3f0f)){if(_0x49c488[_0x55c6('0x2d')]===_0x5f3f0f){logger[_0x55c6('0x24')](_0x55c6('0x3e'),_0x49c488[_0x55c6('0x2b')],_0x49c488['membername'],_0x49c488['destuniqueid']);this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x3f')]=moment()[_0x55c6('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x55c6('0x9')][_0x49c488['uniqueid']][_0x5f3f0f]['connectedlinename']=_0x49c488[_0x55c6('0x40')];this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x41')]=_0x49c488[_0x55c6('0x41')];this[_0x55c6('0x9')][_0x49c488['uniqueid']][_0x5f3f0f][_0x55c6('0x42')]=_0x49c488[_0x55c6('0x42')];this['channels'][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x43')]=_0x49c488['destchannelstatedesc'];this[_0x55c6('0x9')][_0x49c488['uniqueid']][_0x5f3f0f][_0x55c6('0x44')]=_0x49c488[_0x55c6('0x44')];this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x45')]='connect';if(this[_0x55c6('0xa')][this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x2b')]]){var _0x8ce640=this[_0x55c6('0xa')][this['channels'][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x2b')]]['routealias'];this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f]['routealias']=_0x8ce640;_0x49c488[_0x55c6('0x46')]=_0x8ce640;}_[_0x55c6('0x34')](this[_0x55c6('0xc')][_0x49c488['interface']],_['pick'](_0x49c488,[_0x55c6('0x2e'),_0x55c6('0x47'),_0x55c6('0x46')]));var _0x52be05=this[_0x55c6('0xc')][_0x49c488[_0x55c6('0x48')]['split']('-')[0x0]];var _0x50f97f={'id':_0x52be05['id'],'name':_0x52be05['name'],'agentconnected':!![],'destaccountcode':_0x52be05[_0x55c6('0x49')],'destconnectedlinenum':this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x49c488[_0x55c6('0x2d')]][_0x55c6('0x4a')],'queue':this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x49c488[_0x55c6('0x2d')]][_0x55c6('0x2e')],'routealias':this['channels'][_0x49c488[_0x55c6('0x2b')]][_0x49c488[_0x55c6('0x2d')]][_0x55c6('0x46')],'uniqueid':this[_0x55c6('0x9')][_0x49c488['uniqueid']][_0x49c488[_0x55c6('0x2d')]][_0x55c6('0x2b')]};logger[_0x55c6('0x27')](_0x55c6('0x4b'),_0x49c488[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x50f97f,{'showHidden':![],'depth':null}));ami[_0x55c6('0x4c')]('custom:agentconnect',_0x50f97f);logger['debug'](_0x55c6('0x4d'),_0x49c488[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x50f97f,{'showHidden':![],'depth':null}));this[_0x55c6('0x4c')](util[_0x55c6('0x39')](_0x55c6('0x4e'),_0x49c488['membername']),_0x55c6('0x4f'),_0x50f97f);}else if(!this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x12')]&&!this['channels'][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x16')]){logger[_0x55c6('0x24')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x49c488[_0x55c6('0x2b')],this[_0x55c6('0x9')][_0x49c488['uniqueid']][_0x5f3f0f][_0x55c6('0x26')],_0x5f3f0f);this['channels'][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x12')]=!![];this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x50')]=moment()[_0x55c6('0x39')](_0x55c6('0x2f'));this[_0x55c6('0x9')][_0x49c488['uniqueid']][_0x5f3f0f]['answeredelsewheredestinationuniqueid']=_0x49c488[_0x55c6('0x2d')];this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x51')]=_0x49c488[_0x55c6('0x26')];this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f][_0x55c6('0x45')]=_0x55c6('0x52');this['channels'][_0x49c488['uniqueid']][_0x5f3f0f]['reason']='answered_elsewhere';logger[_0x55c6('0x27')](_0x55c6('0x53'),_0x49c488[_0x55c6('0x2b')],util['inspect'](this[_0x55c6('0x9')][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f],{'showHidden':![],'depth':null}));ami[_0x55c6('0x4c')](_0x55c6('0x54'),this['channels'][_0x49c488[_0x55c6('0x2b')]][_0x5f3f0f]);}}}}}}catch(_0x53196f){logger['error'](_0x55c6('0x55'),_0x49c488['uniqueid'],util[_0x55c6('0x29')](_0x53196f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')]['syncAgentRingNoAnswer']=function(_0x371a36){try{if(this[_0x55c6('0x23')](_0x371a36)){logger['debug'](_0x55c6('0x56'),_0x371a36[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x371a36,{'showHidden':![],'depth':null}));if(this[_0x55c6('0x9')][_0x371a36['uniqueid']]&&this[_0x55c6('0x9')][_0x371a36[_0x55c6('0x2b')]][_0x371a36[_0x55c6('0x2d')]]){logger[_0x55c6('0x24')](_0x55c6('0x57'),_0x371a36[_0x55c6('0x2b')],_0x371a36['membername'],_0x371a36['destuniqueid']);var _0x2186b6=this['agents'][_0x371a36[_0x55c6('0x2c')]];var _0x1e9238=this[_0x55c6('0x9')][_0x371a36[_0x55c6('0x2b')]][_0x371a36[_0x55c6('0x2d')]];_0x1e9238[_0x55c6('0x12')]=!![];_0x1e9238[_0x55c6('0x50')]=moment()[_0x55c6('0x39')](_0x55c6('0x2f'));_0x1e9238[_0x55c6('0x45')]=_0x55c6('0x58');_0x1e9238['reason']='rejected';var _0x474874={'id':_0x2186b6['id'],'name':_0x2186b6['name'],'queue':_0x1e9238[_0x55c6('0x2e')],'uniqueid':_0x1e9238[_0x55c6('0x2b')]};logger[_0x55c6('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x371a36[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x474874,{'showHidden':![],'depth':null}));this[_0x55c6('0x4c')](util[_0x55c6('0x39')](_0x55c6('0x4e'),_0x2186b6[_0x55c6('0x59')]),'user:agentringnoanswer',_0x474874);ami[_0x55c6('0x4c')](_0x55c6('0x5a'),_0x1e9238);}}}catch(_0x2b1b37){logger[_0x55c6('0x5b')]('[%s][voiceAgentReport][agentringnoanswer]',_0x371a36[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x2b1b37,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')][_0x55c6('0x15')]=function(_0x252f1c){try{if(this[_0x55c6('0x23')](_0x252f1c)){logger['debug'](_0x55c6('0x5c'),_0x252f1c[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x252f1c,{'showHidden':![],'depth':null}));if(this['channels'][_0x252f1c[_0x55c6('0x2b')]]){for(var _0x45b40f in this['channels'][_0x252f1c['uniqueid']]){if(this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x55c6('0x3d')](_0x45b40f)&&!this['channels'][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f][_0x55c6('0x12')]&&!this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f]['agentcomplete']){logger[_0x55c6('0x24')](_0x55c6('0x5d'),_0x252f1c['uniqueid'],this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f][_0x55c6('0x26')],_0x45b40f);this[_0x55c6('0x9')][_0x252f1c['uniqueid']][_0x45b40f][_0x55c6('0x12')]=!![];this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f]['agentringnoanswerAt']=moment()[_0x55c6('0x39')](_0x55c6('0x2f'));this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f]['lastevent']='abandoned';this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f]['reason']=_0x55c6('0x5e');logger[_0x55c6('0x27')](_0x55c6('0x5f'),_0x252f1c['uniqueid'],util[_0x55c6('0x29')](this[_0x55c6('0x9')][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f],{'showHidden':![],'depth':null}));ami[_0x55c6('0x4c')](_0x55c6('0x60'),this['channels'][_0x252f1c[_0x55c6('0x2b')]][_0x45b40f]);}}}}}catch(_0x46cf6b){logger[_0x55c6('0x5b')]('[%s][voiceAgentReport][queuecallerabandon]',_0x252f1c['uniqueid'],util[_0x55c6('0x29')](_0x46cf6b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')][_0x55c6('0x17')]=function(_0x5da5de){try{if(this['isNotNull'](_0x5da5de)){logger[_0x55c6('0x27')](_0x55c6('0x61'),_0x5da5de[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x5da5de,{'showHidden':![],'depth':null}));if(this['channels'][_0x5da5de[_0x55c6('0x2b')]]){for(var _0x3ef29d in this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]]){if(this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x55c6('0x3d')](_0x3ef29d)){if(this[_0x55c6('0x9')][_0x5da5de['uniqueid']][_0x3ef29d][_0x55c6('0x3f')]&&!this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x3ef29d][_0x55c6('0x16')]){logger['info'](_0x55c6('0x62'),_0x5da5de['uniqueid'],this['channels'][_0x5da5de['uniqueid']][_0x3ef29d]['membername'],_0x3ef29d);this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x3ef29d][_0x55c6('0x16')]=!![];this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x3ef29d][_0x55c6('0x63')]=moment()['format'](_0x55c6('0x2f'));this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x3ef29d][_0x55c6('0x45')]='complete';this[_0x55c6('0x9')][_0x5da5de['uniqueid']][_0x3ef29d][_0x55c6('0x64')]=_0x5da5de['reason']==_0x55c6('0x65')?_0x55c6('0x66'):_0x5da5de[_0x55c6('0x64')];this[_0x55c6('0x9')][_0x5da5de['uniqueid']][_0x3ef29d][_0x55c6('0x67')]=_0x5da5de[_0x55c6('0x67')];if(this['voiceQueues'][_0x5da5de[_0x55c6('0x2e')]]&&this[_0x55c6('0xb')][_0x5da5de['queue']]['acw']){this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x3ef29d]['acwtime']=this[_0x55c6('0xb')][_0x5da5de[_0x55c6('0x2e')]][_0x55c6('0x68')];this[_0x55c6('0x9')][_0x5da5de[_0x55c6('0x2b')]][_0x3ef29d][_0x55c6('0x69')]=!![];}this[_0x55c6('0xc')][_0x5da5de[_0x55c6('0x2c')]]=_[_0x55c6('0x35')](this[_0x55c6('0xc')][_0x5da5de[_0x55c6('0x2c')]],[_0x55c6('0x2e'),'destconnectedlinenum']);logger[_0x55c6('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x5da5de[_0x55c6('0x2b')],util['inspect'](this[_0x55c6('0x9')][_0x5da5de['uniqueid']][_0x3ef29d],{'showHidden':![],'depth':null}));ami['emit'](_0x55c6('0x6a'),this['channels'][_0x5da5de['uniqueid']][_0x3ef29d]);logger['debug'](_0x55c6('0x6b'),_0x5da5de[_0x55c6('0x2b')],util[_0x55c6('0x29')]({'id':this[_0x55c6('0xc')][_0x5da5de[_0x55c6('0x2c')]]['id'],'destaccountcode':_0x5da5de[_0x55c6('0x6c')]},{'showHidden':![],'depth':null}));this[_0x55c6('0x4c')](util['format'](_0x55c6('0x4e'),_0x5da5de[_0x55c6('0x26')]),_0x55c6('0x6d'),{'id':this[_0x55c6('0xc')][_0x5da5de[_0x55c6('0x2c')]]['id'],'destaccountcode':Number(_0x5da5de['destaccountcode'])});}}}}}}catch(_0x3084b5){logger[_0x55c6('0x5b')](_0x55c6('0x6e'),_0x5da5de[_0x55c6('0x2b')],util['inspect'](_0x3084b5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')][_0x55c6('0x19')]=function(_0x27b844){try{if(this['isNotNull'](_0x27b844)){logger['debug'](_0x55c6('0x6f'),_0x27b844[_0x55c6('0x2b')],util['inspect'](_0x27b844,{'showHidden':![],'depth':null}));this['addVariable'](_0x27b844[_0x55c6('0x2b')],_[_0x55c6('0x70')](_0x27b844['variable'])[0x0],_0x27b844[_0x55c6('0x71')]);if(this['channels'][_0x27b844[_0x55c6('0x2b')]]){for(var _0x15fbce in this[_0x55c6('0x9')][_0x27b844[_0x55c6('0x2b')]]){if(this['channels'][_0x27b844[_0x55c6('0x2b')]]['hasOwnProperty'](_0x15fbce)){logger[_0x55c6('0x24')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x27b844[_0x55c6('0x2b')],_0x15fbce,_['keys'](_0x27b844[_0x55c6('0x72')])[0x0],_0x27b844[_0x55c6('0x71')]);if(_[_0x55c6('0x2a')](this['channels'][_0x27b844[_0x55c6('0x2b')]][_0x15fbce][_0x55c6('0xd')])){this[_0x55c6('0x9')][_0x27b844[_0x55c6('0x2b')]][_0x15fbce][_0x55c6('0xd')]={};}this['channels'][_0x27b844[_0x55c6('0x2b')]][_0x15fbce]['variables']=this[_0x55c6('0xd')][_0x27b844[_0x55c6('0x2b')]];}}}}}catch(_0x3c74ad){logger[_0x55c6('0x5b')](_0x55c6('0x73'),_0x27b844[_0x55c6('0x2b')],util['inspect'](_0x3c74ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')]['addVariable']=function(_0x285b7c,_0x262962,_0x38b636){var _0x41614b=['rtpaudioqos',_0x55c6('0x74'),_0x55c6('0x75'),_0x55c6('0x76'),_0x55c6('0x77'),_0x55c6('0x78'),_0x55c6('0x79'),_0x55c6('0x7a'),_0x55c6('0x7b'),_0x55c6('0x7c'),_0x55c6('0x7d'),_0x55c6('0x7e'),_0x55c6('0x7f'),_0x55c6('0x80'),_0x55c6('0x81'),_0x55c6('0x82'),'membername',_0x55c6('0x83'),_0x55c6('0x84')];if(!_[_0x55c6('0x85')](_0x262962)&&!_[_0x55c6('0x86')](_0x41614b,_0x262962)){if(_[_0x55c6('0x2a')](this['variables'][_0x285b7c])){this[_0x55c6('0xd')][_0x285b7c]={};}this[_0x55c6('0xd')][_0x285b7c][_0x262962]=_0x38b636;}};VoiceAgentReport[_0x55c6('0x22')]['syncHangup']=function(_0x2afa76){try{if(this[_0x55c6('0x23')](_0x2afa76)){logger[_0x55c6('0x27')](_0x55c6('0x87'),_0x2afa76['uniqueid'],util[_0x55c6('0x29')](_0x2afa76,{'showHidden':![],'depth':null}));if(this[_0x55c6('0x9')][_0x2afa76[_0x55c6('0x2b')]]){for(var _0x508f4f in this['channels'][_0x2afa76['uniqueid']]){if(this['channels'][_0x2afa76[_0x55c6('0x2b')]]['hasOwnProperty'](_0x508f4f)){if(this[_0x55c6('0x9')][_0x2afa76['uniqueid']][_0x508f4f][_0x55c6('0x64')]==_0x55c6('0x65')&&this[_0x55c6('0x9')][_0x2afa76[_0x55c6('0x2b')]][_0x508f4f]['agentcomplete']){logger[_0x55c6('0x24')](_0x55c6('0x88'),_0x2afa76[_0x55c6('0x2b')],_0x508f4f);this[_0x55c6('0x9')][_0x2afa76[_0x55c6('0x2b')]][_0x508f4f][_0x55c6('0x63')]=moment()[_0x55c6('0x39')](_0x55c6('0x2f'));}}}logger['debug'](_0x55c6('0x89'),_0x2afa76[_0x55c6('0x2b')],util[_0x55c6('0x29')](_[_0x55c6('0x8a')](this[_0x55c6('0x9')][_0x2afa76[_0x55c6('0x2b')]]),{'showHidden':![],'depth':null}));ami[_0x55c6('0x4c')](_0x55c6('0x8b'),_['values'](this[_0x55c6('0x9')][_0x2afa76[_0x55c6('0x2b')]]));delete this[_0x55c6('0x9')][_0x2afa76[_0x55c6('0x2b')]];}if(this[_0x55c6('0xd')][_0x2afa76['uniqueid']]){delete this[_0x55c6('0xd')][_0x2afa76['uniqueid']];}}}catch(_0x1c9733){logger[_0x55c6('0x5b')](_0x55c6('0x8c'),_0x2afa76[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x1c9733,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')][_0x55c6('0x20')]=function(_0x467a82){try{if(this[_0x55c6('0x23')](_0x467a82)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x467a82[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x467a82,{'showHidden':![],'depth':null}));if(this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]]){for(var _0x2893ac in this['channels'][_0x467a82[_0x55c6('0x8d')]]){if(this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]][_0x55c6('0x3d')](_0x2893ac)){if(_0x467a82[_0x55c6('0x8e')]===_0x2893ac){logger[_0x55c6('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x467a82[_0x55c6('0x2b')],this['channels'][_0x467a82[_0x55c6('0x8d')]][_0x2893ac][_0x55c6('0x26')],_0x2893ac);var _0x575a3f=moment();this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]][_0x2893ac][_0x55c6('0x16')]=!![];this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]][_0x2893ac][_0x55c6('0x63')]=moment()[_0x55c6('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x467a82['transfereeuniqueid']][_0x2893ac][_0x55c6('0x45')]='complete';this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]][_0x2893ac][_0x55c6('0x64')]=_0x55c6('0x65');this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]][_0x2893ac][_0x55c6('0x67')]=_0x575a3f[_0x55c6('0x8f')](this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]][_0x2893ac][_0x55c6('0x3f')],_0x55c6('0x90'));}}}}if(this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x91')]]){var _0x56b9d5=this['channels'][_0x467a82[_0x55c6('0x91')]];this[_0x55c6('0x9')][_0x467a82['secondtransfereruniqueid']]=this[_0x55c6('0x9')][_0x467a82[_0x55c6('0x8d')]];this[_0x55c6('0x9')][_0x467a82['transfereeuniqueid']]=_0x56b9d5;}}}catch(_0x1c6307){logger[_0x55c6('0x5b')]('[%s][voiceAgentReport][attendedtransfer]',_0x467a82['uniqueid'],util[_0x55c6('0x29')](_0x1c6307,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')]['syncBlindTransfer']=function(_0xd0cd59){try{if(this[_0x55c6('0x23')](_0xd0cd59)){logger[_0x55c6('0x27')](_0x55c6('0x92'),_0xd0cd59[_0x55c6('0x2b')],util['inspect'](_0xd0cd59,{'showHidden':![],'depth':null}));if(this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]]){for(var _0x26eb31 in this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]]){if(this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]][_0x55c6('0x3d')](_0x26eb31)){if(_0xd0cd59['transfereruniqueid']===_0x26eb31){logger[_0x55c6('0x24')](_0x55c6('0x93'),_0xd0cd59[_0x55c6('0x2b')],this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]][_0x26eb31][_0x55c6('0x26')],_0x26eb31);var _0x398d61=moment();this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]][_0x26eb31][_0x55c6('0x16')]=!![];this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]][_0x26eb31][_0x55c6('0x63')]=_0x398d61;this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]][_0x26eb31][_0x55c6('0x45')]='complete';this[_0x55c6('0x9')][_0xd0cd59['transfereeuniqueid']][_0x26eb31][_0x55c6('0x64')]=_0x55c6('0x65');this['channels'][_0xd0cd59['transfereeuniqueid']][_0x26eb31]['talktime']=_0x398d61['diff'](this[_0x55c6('0x9')][_0xd0cd59[_0x55c6('0x8d')]][_0x26eb31][_0x55c6('0x3f')],_0x55c6('0x90'));}}}}}}catch(_0x494901){logger[_0x55c6('0x5b')]('[%s][voiceAgentReport][blindtransfer]',_0xd0cd59[_0x55c6('0x2b')],util['inspect'](_0x494901,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x55c6('0x22')][_0x55c6('0x1c')]=function(_0x2cba48){var _0x248dd7='';try{if(this[_0x55c6('0x23')](_0x2cba48)){logger[_0x55c6('0x27')](_0x55c6('0x94'),_0x2cba48['uniqueid'],util[_0x55c6('0x29')](_0x2cba48,{'showHidden':![],'depth':null}));if(_0x2cba48['channel']){_0x248dd7=_0x2cba48[_0x55c6('0x48')][_0x55c6('0x95')](0x0,_0x2cba48[_0x55c6('0x48')][_0x55c6('0x96')]('-'));if(this['agents'][_0x248dd7]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x2cba48[_0x55c6('0x2b')],_0x248dd7);this[_0x55c6('0xc')][_0x248dd7][_0x55c6('0x97')]=!![];}}}}catch(_0x1e5e63){logger[_0x55c6('0x5b')](_0x55c6('0x98'),_0x2cba48[_0x55c6('0x2b')],util['inspect'](_0x1e5e63,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x55c6('0x1e')]=function(_0x2c6aca){var _0x89a6d9='';try{if(this['isNotNull'](_0x2c6aca)){logger[_0x55c6('0x27')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x2c6aca['uniqueid'],util['inspect'](_0x2c6aca,{'showHidden':![],'depth':null}));if(_0x2c6aca[_0x55c6('0x48')]){_0x89a6d9=_0x2c6aca[_0x55c6('0x48')][_0x55c6('0x95')](0x0,_0x2c6aca[_0x55c6('0x48')][_0x55c6('0x96')]('-'));if(this[_0x55c6('0xc')][_0x89a6d9]){logger[_0x55c6('0x24')](_0x55c6('0x99'),_0x2c6aca[_0x55c6('0x2b')],_0x89a6d9);this[_0x55c6('0xc')][_0x89a6d9]['onhold']=![];}}}}catch(_0x14bec9){logger[_0x55c6('0x5b')](_0x55c6('0x9a'),_0x2c6aca[_0x55c6('0x2b')],util[_0x55c6('0x29')](_0x14bec9,{'showHidden':![],'depth':null}));}};module[_0x55c6('0x9b')]=VoiceAgentReport;
\ No newline at end of file
index ada7833..3a4662e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd70f=['accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','merge','keys','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','duration','subtract','seconds','includes','lastapplication','lastdata','set','cdr(','type','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','connectedlinenum','connectedlinename','destinationchannel','disposition','UserId','membername','diff','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','answertime','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','outbound','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','ioredis','../../../config/environment','ami','../ami','../rpc/setting','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','syncNewExten','bind','newexten','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','context','from-sip','channel','exten','xcally-motion-preview','split','destconnectedlinenum','format','user:%s','user:agentconnect'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xd70f,0x86));var _0xfd70=function(_0x1f9db3,_0x332843){_0x1f9db3=_0x1f9db3-0x0;var _0x26ae3f=_0xd70f[_0x1f9db3];return _0x26ae3f;};'use strict';var _=require('lodash');var moment=require(_0xfd70('0x0'));var util=require(_0xfd70('0x1'));var path=require(_0xfd70('0x2'));var Redis=require(_0xfd70('0x3'));var config=require(_0xfd70('0x4'));var logger=require('../../../config/logger')(_0xfd70('0x5'));var ami=require(_0xfd70('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0xfd70('0x7'));var applications=['set',_0xfd70('0x8'),_0xfd70('0x9'),_0xfd70('0xa'),_0xfd70('0xb'),_0xfd70('0xc')];var dispositions=[_0xfd70('0xd'),_0xfd70('0xe'),_0xfd70('0xe'),_0xfd70('0xd'),'NO\x20ANSWER',_0xfd70('0xd'),'ANSWERED',_0xfd70('0xf'),'FAILED',_0xfd70('0xe'),_0xfd70('0xe')];config[_0xfd70('0x10')]=_[_0xfd70('0x11')](config['redis'],{'host':_0xfd70('0x12'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfd70('0x10')]));function VoiceCallReport(_0x2cda67){this[_0xfd70('0x13')]=_0x2cda67[_0xfd70('0x13')];this[_0xfd70('0x14')]=_0x2cda67[_0xfd70('0x14')];this[_0xfd70('0x15')]={};ami['on']('coreshowchannel',this[_0xfd70('0x16')][_0xfd70('0x17')](this));ami['on'](_0xfd70('0x18'),this[_0xfd70('0x16')][_0xfd70('0x17')](this));ami['on']('newchannel',this[_0xfd70('0x19')]['bind'](this));ami['on'](_0xfd70('0x1a'),this['syncNewState'][_0xfd70('0x17')](this));ami['on']('varset',this[_0xfd70('0x1b')][_0xfd70('0x17')](this));ami['on'](_0xfd70('0x1c'),this[_0xfd70('0x1d')]['bind'](this));ami['on'](_0xfd70('0x1e'),this[_0xfd70('0x1f')][_0xfd70('0x17')](this));ami['on'](_0xfd70('0x20'),this[_0xfd70('0x21')][_0xfd70('0x17')](this));ami['on'](_0xfd70('0x22'),this['syncBlindTransfer'][_0xfd70('0x17')](this));ami['on'](_0xfd70('0x23'),this[_0xfd70('0x24')][_0xfd70('0x17')](this));ami['on'](_0xfd70('0x25'),this[_0xfd70('0x26')][_0xfd70('0x17')](this));try{logger[_0xfd70('0x27')](_0xfd70('0x28'));ami[_0xfd70('0x29')]();}catch(_0x3ce6c9){logger[_0xfd70('0x2a')](_0xfd70('0x2b'),util[_0xfd70('0x2c')](_0x3ce6c9,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x2e')]=function(_0x3c0fb2){return _0x3c0fb2!==null&&!_[_0xfd70('0x2f')](_0x3c0fb2);};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x30')]=function(_0x1dfa9d,_0x482b51,_0xcd6141){io['to'](_0x1dfa9d)[_0xfd70('0x30')](_0x482b51,_0xcd6141);};VoiceCallReport['prototype'][_0xfd70('0x1f')]=function(_0x4456ff){try{if(this['isNotNull'](_0x4456ff)){logger['info'](_0xfd70('0x31'),_0x4456ff[_0xfd70('0x32')],_0x4456ff[_0xfd70('0x33')],_0x4456ff[_0xfd70('0x34')]);logger[_0xfd70('0x35')](_0xfd70('0x36'),_0x4456ff[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x4456ff,{'showHidden':![],'depth':null}));if(_0x4456ff['uniqueid']===_0x4456ff[_0xfd70('0x37')]){if(!_[_0xfd70('0x2f')](this[_0xfd70('0x13')][_0x4456ff['uniqueid']])){_['merge'](this[_0xfd70('0x13')][_0x4456ff[_0xfd70('0x32')]],_[_0xfd70('0x38')](_0x4456ff,_['keys'](this[_0xfd70('0x13')][_0x4456ff['uniqueid']])));}}if(_0x4456ff[_0xfd70('0x39')]===_0xfd70('0x3a')){if(this['agents'][_0x4456ff[_0xfd70('0x3b')]['split']('-')[0x0]]){if(_0x4456ff[_0xfd70('0x3c')]==_0xfd70('0x3d')){this[_0xfd70('0x14')][_0x4456ff['channel'][_0xfd70('0x3e')]('-')[0x0]][_0xfd70('0x3f')]=_0x4456ff['connectedlinenum'];this['emit'](util[_0xfd70('0x40')](_0xfd70('0x41'),this[_0xfd70('0x14')][_0x4456ff[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]]['name']),_0xfd70('0x42'),{'destaccountcode':this[_0xfd70('0x14')][_0x4456ff[_0xfd70('0x3b')]['split']('-')[0x0]][_0xfd70('0x43')],'destconnectedlinenum':_0x4456ff['connectedlinenum']});}}}}}catch(_0x471fcc){logger[_0xfd70('0x2a')]('[%s][voiceCallReport][newcallerid]',_0x4456ff[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x471fcc,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfd70('0x19')]=function(_0x5326d1){try{if(this[_0xfd70('0x2e')](_0x5326d1)){logger[_0xfd70('0x35')](_0xfd70('0x44'),_0x5326d1['uniqueid'],util[_0xfd70('0x2c')](_0x5326d1,{'showHidden':![],'depth':null}));if(this[_0xfd70('0x13')][_0x5326d1[_0xfd70('0x32')]]){return;}if(_0x5326d1[_0xfd70('0x3b')]===_0xfd70('0x45')){return;}if(_0x5326d1[_0xfd70('0x32')]!==_0x5326d1[_0xfd70('0x37')]&&!this[_0xfd70('0x15')][_0x5326d1['linkedid']]){return;}logger[_0xfd70('0x27')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x5326d1[_0xfd70('0x32')],_0x5326d1[_0xfd70('0x39')],_0x5326d1[_0xfd70('0x3c')]);this[_0xfd70('0x13')][_0x5326d1[_0xfd70('0x32')]]=new Channel();this[_0xfd70('0x13')][_0x5326d1[_0xfd70('0x32')]][_0xfd70('0x46')]=moment()[_0xfd70('0x40')](_0xfd70('0x47'));this[_0xfd70('0x13')][_0x5326d1['uniqueid']]['disposition']=dispositions[_[_0xfd70('0x48')](_0x5326d1[_0xfd70('0x49')])];_[_0xfd70('0x4a')](this['channels'][_0x5326d1[_0xfd70('0x32')]],_[_0xfd70('0x38')](_0x5326d1,_[_0xfd70('0x4b')](this[_0xfd70('0x13')][_0x5326d1[_0xfd70('0x32')]])));if(_0x5326d1[_0xfd70('0x39')]===_0xfd70('0x3a')){var _0x2aca8b=this[_0xfd70('0x14')][_0x5326d1[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]];if(_0x2aca8b&&typeof _0x2aca8b[_0xfd70('0x3f')]===_0xfd70('0x4c')){_0x2aca8b[_0xfd70('0x3f')]=_0x5326d1[_0xfd70('0x3c')];logger[_0xfd70('0x35')](_0xfd70('0x4d'),_0x5326d1[_0xfd70('0x32')],util[_0xfd70('0x2c')]({'id':_0x2aca8b['id'],'destaccountcode':_0x2aca8b[_0xfd70('0x43')],'destconnectedlinenum':_0x5326d1[_0xfd70('0x3c')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x2aca8b[_0xfd70('0x4e')]),_0xfd70('0x42'),{'id':_0x2aca8b['id'],'destaccountcode':_0x2aca8b[_0xfd70('0x43')],'destconnectedlinenum':_0x5326d1[_0xfd70('0x3c')]});}}}}catch(_0x14f32e){logger[_0xfd70('0x2a')]('[%s][voiceCallReport][newchannel]',_0x5326d1[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x14f32e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')]['syncNewExten']=function(_0x21ce5c){try{if(this[_0xfd70('0x2e')](_0x21ce5c)){logger[_0xfd70('0x35')](_0xfd70('0x4f'),_0x21ce5c['uniqueid'],util['inspect'](_0x21ce5c,{'showHidden':![],'depth':null}));if(_0x21ce5c['channel']===_0xfd70('0x45')||_0x21ce5c[_0xfd70('0x3c')]==='h')return;if(_0x21ce5c[_0xfd70('0x32')]===_0x21ce5c[_0xfd70('0x37')]||this[_0xfd70('0x15')][_0x21ce5c[_0xfd70('0x37')]]){_0x21ce5c[_0xfd70('0x50')]=_0x21ce5c[_0xfd70('0x50')]?_0x21ce5c[_0xfd70('0x50')]['toLowerCase']():undefined;_0x21ce5c[_0xfd70('0x51')]=_0x21ce5c[_0xfd70('0x52')]||_0x21ce5c[_0xfd70('0x51')];if(_0x21ce5c[_0xfd70('0x52')]&&!_0x21ce5c[_0xfd70('0x52')][_0xfd70('0x53')](_0xfd70('0x54'))&&_0x21ce5c[_0xfd70('0x50')]!==_0xfd70('0x8')){_0x21ce5c[_0xfd70('0x51')]=_0x21ce5c[_0xfd70('0x51')][_0xfd70('0x55')]();}logger[_0xfd70('0x27')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x21ce5c[_0xfd70('0x32')],_0x21ce5c[_0xfd70('0x50')],_0x21ce5c[_0xfd70('0x51')]);if(_[_0xfd70('0x2f')](this[_0xfd70('0x13')][_0x21ce5c[_0xfd70('0x32')]])){this[_0xfd70('0x13')][_0x21ce5c['uniqueid']]=new Channel();this[_0xfd70('0x13')][_0x21ce5c[_0xfd70('0x32')]][_0xfd70('0x46')]=_0x21ce5c[_0xfd70('0x56')]?moment()[_0xfd70('0x57')](moment[_0xfd70('0x56')](_0x21ce5c[_0xfd70('0x56')])[_0xfd70('0x58')](),_0xfd70('0x58'))['format'](_0xfd70('0x47')):moment()[_0xfd70('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd70('0x13')][_0x21ce5c['uniqueid']]['disposition']=_0xfd70('0xd');}_[_0xfd70('0x4a')](this[_0xfd70('0x13')][_0x21ce5c[_0xfd70('0x32')]],_[_0xfd70('0x38')](_0x21ce5c,_[_0xfd70('0x4b')](this[_0xfd70('0x13')][_0x21ce5c['uniqueid']])));if(_[_0xfd70('0x59')](applications,_0x21ce5c['application'])){this[_0xfd70('0x13')][_0x21ce5c[_0xfd70('0x32')]][_0xfd70('0x5a')]=_0x21ce5c[_0xfd70('0x50')];this[_0xfd70('0x13')][_0x21ce5c[_0xfd70('0x32')]][_0xfd70('0x5b')]=_0x21ce5c[_0xfd70('0x51')];if(_0x21ce5c[_0xfd70('0x50')]===_0xfd70('0x5c')&&_[_0xfd70('0x53')](_0x21ce5c[_0xfd70('0x51')]['toLowerCase'](),_0xfd70('0x5d'))){var _0x12a083=_0x21ce5c['applicationdata'][_0xfd70('0x3e')]('=');var _0x8a5398=_0x12a083[0x0][_0xfd70('0x55')]()['match'](/cdr\((.*)\)/);if(_0x8a5398){if(_0x8a5398[0x1]===_0xfd70('0x5e')&&!_['isNil'](this['channels'][_0x21ce5c['uniqueid']][_0x8a5398[0x1]]))return;this['channels'][_0x21ce5c['uniqueid']][_0x8a5398[0x1]]=_0x12a083[0x1];}}else if(_0x21ce5c['application']===_0xfd70('0x8')){this['channels'][_0x21ce5c['uniqueid']][_0xfd70('0x8')]=_0x21ce5c['applicationdata'][_0xfd70('0x3e')](',')[0x0];}}}}}catch(_0x1e44f7){logger[_0xfd70('0x2a')](_0xfd70('0x5f'),_0x21ce5c[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x1e44f7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x60')]=function(_0x4a3ba4){try{if(this[_0xfd70('0x2e')](_0x4a3ba4)){logger[_0xfd70('0x27')](_0xfd70('0x61'),_0x4a3ba4[_0xfd70('0x32')],_0x4a3ba4[_0xfd70('0x37')],_0x4a3ba4[_0xfd70('0x33')],_0x4a3ba4['calleridnum']);logger['debug'](_0xfd70('0x62'),_0x4a3ba4[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x4a3ba4,{'showHidden':![],'depth':null}));if(_0x4a3ba4[_0xfd70('0x49')]!=='6')return;var _0x3a44c0=this[_0xfd70('0x14')][_0x4a3ba4[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]];if(_0x4a3ba4[_0xfd70('0x32')]!==_0x4a3ba4[_0xfd70('0x37')]){var _0x559b84=moment();if(this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]]){if(!this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x63')]){this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x63')]=!![];this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]]['answertime']=_0x559b84[_0xfd70('0x40')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xfd70('0x13')][_0x4a3ba4['linkedid']][_0xfd70('0x46')]){this['channels'][_0x4a3ba4['linkedid']][_0xfd70('0x64')]=_0x559b84['diff'](this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x46')],_0xfd70('0x58'));}}this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]]['linkedid']=_0x4a3ba4[_0xfd70('0x32')];if(_0x4a3ba4[_0xfd70('0x34')]!==_0xfd70('0x3d')){this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x65')]=_0x4a3ba4['calleridnum'];}this[_0xfd70('0x13')][_0x4a3ba4['linkedid']][_0xfd70('0x66')]=_0x4a3ba4[_0xfd70('0x33')];this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x67')]=_0x4a3ba4[_0xfd70('0x3b')];this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x68')]=dispositions[_[_0xfd70('0x48')](_0x4a3ba4['channelstate'])];if(_0x3a44c0){this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x69')]=_0x3a44c0['id'];this['channels'][_0x4a3ba4['linkedid']][_0xfd70('0x6a')]=_0x3a44c0[_0xfd70('0x4e')];}}if(this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]]){if(!this[_0xfd70('0x13')][_0x4a3ba4['uniqueid']][_0xfd70('0x63')]){this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x63')]=!![];this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]]['answertime']=_0x559b84[_0xfd70('0x40')](_0xfd70('0x47'));if(this['channels'][_0x4a3ba4['uniqueid']]['starttime']){this['channels'][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x64')]=_0x559b84[_0xfd70('0x6b')](this[_0xfd70('0x13')][_0x4a3ba4['uniqueid']][_0xfd70('0x46')],_0xfd70('0x58'));}}if(_0x4a3ba4[_0xfd70('0x34')]!==_0xfd70('0x3d')){this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x65')]=_0x4a3ba4[_0xfd70('0x34')];}this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x66')]=_0x4a3ba4[_0xfd70('0x33')];this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x67')]=_0x4a3ba4[_0xfd70('0x3b')];this['channels'][_0x4a3ba4['uniqueid']][_0xfd70('0x68')]=dispositions[_[_0xfd70('0x48')](_0x4a3ba4[_0xfd70('0x49')])];}}else{if(this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]]){if(_0x3a44c0){this[_0xfd70('0x13')][_0x4a3ba4['uniqueid']][_0xfd70('0x69')]=_0x3a44c0['id'];this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x6a')]=_0x3a44c0[_0xfd70('0x4e')];}}}if(_0x4a3ba4[_0xfd70('0x39')]===_0xfd70('0x3a')){if(_0x3a44c0){_0x3a44c0[_0xfd70('0x3f')]=_0x4a3ba4['exten'];var _0x56fa5a,_0x3d54f6;if(this[_0xfd70('0x13')][_0x4a3ba4['uniqueid']]){_0x56fa5a=this[_0xfd70('0x13')][_0x4a3ba4['uniqueid']]['routealias'];_0x3d54f6=this['channels'][_0x4a3ba4[_0xfd70('0x32')]][_0xfd70('0x8')];}else if(this[_0xfd70('0x13')][_0x4a3ba4['linkedid']]){_0x56fa5a=this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x6c')];_0x3d54f6=this[_0xfd70('0x13')][_0x4a3ba4[_0xfd70('0x37')]][_0xfd70('0x8')];}_0x3a44c0[_0xfd70('0x8')]=_0x3d54f6;_0x3a44c0[_0xfd70('0x6c')]=_0x56fa5a;var _0x15517e={'id':_0x3a44c0['id'],'name':_0x3a44c0[_0xfd70('0x4e')],'agentconnected':!![],'destaccountcode':_0x3a44c0[_0xfd70('0x43')],'destconnectedlinenum':_0x4a3ba4['exten'],'queue':_0x3d54f6||undefined,'routealias':_0x56fa5a,'uniqueid':_0x4a3ba4['linkedid']};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4a3ba4['uniqueid'],util['inspect'](_0x15517e,{'showHidden':![],'depth':null}));this[_0xfd70('0x30')](util['format']('user:%s',_0x3a44c0[_0xfd70('0x4e')]),_0xfd70('0x42'),_0x15517e);}}}}catch(_0x39c29f){logger[_0xfd70('0x2a')](_0xfd70('0x6d'),_0x4a3ba4[_0xfd70('0x32')],util['inspect'](_0x39c29f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x6e')]=function(_0xb3bdd4,_0x474e98){try{if(this['channels'][_0xb3bdd4]){logger['info'](_0xfd70('0x6f'),_0xb3bdd4,_0x474e98);this['channels'][_0xb3bdd4][_0xfd70('0x70')]=!![];if(_[_0xfd70('0x71')](_0x474e98,_0xfd70('0x72'))){_0x474e98=_0x474e98[_0xfd70('0x73')]('.wav49','.WAV');}this[_0xfd70('0x13')][_0xb3bdd4][_0xfd70('0x74')]=_0x474e98;var _0x23d652=_[_0xfd70('0x75')](this['channels'][_0xb3bdd4][_0xfd70('0x76')],{'filename':_0x474e98});if(_[_0xfd70('0x77')](_0x23d652)){this[_0xfd70('0x13')][_0xb3bdd4][_0xfd70('0x76')][_0xfd70('0x78')]({'filename':_0x474e98,'createdAt':moment()[_0xfd70('0x40')](_0xfd70('0x47')),'mixmonitorid':'','status':'rec'});}}}catch(_0x3655a4){logger[_0xfd70('0x2a')](_0xfd70('0x79'),_0xb3bdd4,util[_0xfd70('0x2c')](_0x3655a4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x1b')]=function(_0x5e666b){try{if(this[_0xfd70('0x2e')](_0x5e666b)){logger['debug'](_0xfd70('0x7a'),_0x5e666b[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x5e666b,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e666b[_0xfd70('0x32')]]&&_0x5e666b['channel']!='OutgoingSpoolFailed'){if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')])){if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x7c')])){logger[_0xfd70('0x27')](_0xfd70('0x7d'),_0x5e666b['uniqueid'],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x6e')](_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);}else if(this[_0xfd70('0x2e')](_0x5e666b['variable']['xmd-phone'])){logger['info'](_0xfd70('0x7f'),_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x13')][_0x5e666b['uniqueid']][_0xfd70('0x34')]=_0x5e666b[_0xfd70('0x7e')];}else if(this['isNotNull'](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x80')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);this['channels'][_0x5e666b[_0xfd70('0x32')]][_0xfd70('0x81')]=_0x5e666b[_0xfd70('0x7e')];}else if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x82')])){logger[_0xfd70('0x27')](_0xfd70('0x83'),_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);this['channels'][_0x5e666b['uniqueid']][_0xfd70('0x5e')]=_0x5e666b['value'];}else if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')]['xmd-queue'])){logger[_0xfd70('0x27')](_0xfd70('0x84'),_0x5e666b[_0xfd70('0x32')],_0x5e666b['value']['split'](',')[0x0]);this[_0xfd70('0x13')][_0x5e666b[_0xfd70('0x32')]][_0xfd70('0x8')]=_0x5e666b['value'][_0xfd70('0x3e')](',')[0x0];}else if(this[_0xfd70('0x2e')](_0x5e666b['variable'][_0xfd70('0x85')])){logger['info'](_0xfd70('0x86'),_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x13')][_0x5e666b['uniqueid']][_0xfd70('0x87')]=_0x5e666b[_0xfd70('0x7e')];}else if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x88')])){logger['info'](_0xfd70('0x89'),_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x13')][_0x5e666b[_0xfd70('0x32')]]['destination']=_0x5e666b[_0xfd70('0x7e')];}else if(this['isNotNull'](_0x5e666b['variable'][_0xfd70('0x8a')])){logger[_0xfd70('0x27')](_0xfd70('0x8b'),_0x5e666b['uniqueid'],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x13')][_0x5e666b[_0xfd70('0x32')]][_0xfd70('0x8c')]=_0x5e666b[_0xfd70('0x7e')];}else if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x8d')])){logger[_0xfd70('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5e666b[_0xfd70('0x32')],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x13')][_0x5e666b['uniqueid']][_0xfd70('0x8')]=_0x5e666b[_0xfd70('0x7e')];}else if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x8e')])){logger['info'](_0xfd70('0x8f'),_0x5e666b[_0xfd70('0x32')],_0x5e666b['value']);this[_0xfd70('0x13')][_0x5e666b['uniqueid']][_0xfd70('0x90')]=_0x5e666b[_0xfd70('0x7e')];}}}else if(this[_0xfd70('0x2e')](_0x5e666b[_0xfd70('0x7b')]['mixmonitor_filename'])){if(_0x5e666b[_0xfd70('0x7e')]){var _0x29cf09=path[_0xfd70('0x91')](_0x5e666b[_0xfd70('0x7e')])['name'];logger[_0xfd70('0x27')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x29cf09,_0x5e666b[_0xfd70('0x7e')]);this['syncMixMonitorFilename'](_0x29cf09,_0x5e666b[_0xfd70('0x7e')]);}}else if(this[_0xfd70('0x13')][_0x5e666b[_0xfd70('0x37')]]){if(this[_0xfd70('0x2e')](_0x5e666b['variable'])){if(this['isNotNull'](_0x5e666b[_0xfd70('0x7b')][_0xfd70('0x8e')])){logger['info'](_0xfd70('0x8f'),_0x5e666b[_0xfd70('0x37')],_0x5e666b[_0xfd70('0x7e')]);this[_0xfd70('0x13')][_0x5e666b[_0xfd70('0x37')]][_0xfd70('0x92')]=_0x5e666b[_0xfd70('0x7e')];}}}}}catch(_0x34e78c){logger[_0xfd70('0x2a')](_0xfd70('0x93'),_0x5e666b[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x34e78c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x1d')]=function(_0x509520){try{if(this[_0xfd70('0x2e')](_0x509520)){logger[_0xfd70('0x35')]('[%s][voiceCallReport][hangup]\x20event:',_0x509520[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x509520,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x509520[_0xfd70('0x37')]]){if(this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]]){this['channels'][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]][_0xfd70('0x32')]=_0x509520[_0xfd70('0x32')];this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]][_0xfd70('0x63')]=this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x63')];this[_0xfd70('0x13')][this['blindTransfers'][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]]['answertime']=this[_0xfd70('0x13')][_0x509520['uniqueid']]['answertime'];this[_0xfd70('0x13')][this['blindTransfers'][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]][_0xfd70('0x67')]=this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]][_0xfd70('0x3b')];this[_0xfd70('0x13')][this['blindTransfers'][_0x509520[_0xfd70('0x37')]][_0xfd70('0x37')]][_0xfd70('0x68')]=this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x68')];this['channels'][_0x509520[_0xfd70('0x32')]]=this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520['linkedid']][_0xfd70('0x37')]];delete this['channels'][this['blindTransfers'][_0x509520['linkedid']][_0xfd70('0x37')]];}else if(this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520['linkedid']][_0xfd70('0x32')]]){this[_0xfd70('0x13')][this['blindTransfers'][_0x509520['linkedid']][_0xfd70('0x32')]][_0xfd70('0x32')]=[this['channels'][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x32')]]['linkedid'],this['channels'][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x32')]][_0xfd70('0x37')]=this[_0xfd70('0x13')][this['blindTransfers'][_0x509520['linkedid']][_0xfd70('0x32')]][_0xfd70('0x32')]][0x0];this['channels'][this['blindTransfers'][_0x509520[_0xfd70('0x37')]][_0xfd70('0x32')]][_0xfd70('0x63')]=this['channels'][_0x509520[_0xfd70('0x32')]][_0xfd70('0x63')];this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520['linkedid']]['uniqueid']]['answertime']=this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x94')];this['channels'][this['blindTransfers'][_0x509520[_0xfd70('0x37')]][_0xfd70('0x32')]][_0xfd70('0x67')]=this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x32')]]['channel'];this[_0xfd70('0x13')][this['blindTransfers'][_0x509520['linkedid']]['uniqueid']][_0xfd70('0x68')]=this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x68')];this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]]=this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520['linkedid']][_0xfd70('0x32')]];delete this[_0xfd70('0x13')][this[_0xfd70('0x15')][_0x509520[_0xfd70('0x37')]][_0xfd70('0x32')]];}}if(this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]]){logger['info'](_0xfd70('0x95'),_0x509520[_0xfd70('0x32')],_0x509520[_0xfd70('0x96')]);var _0xe2fbe=moment();this[_0xfd70('0x13')][_0x509520['uniqueid']][_0xfd70('0x97')]=_0xe2fbe['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]]['duration']=_0xe2fbe[_0xfd70('0x6b')](this['channels'][_0x509520[_0xfd70('0x32')]][_0xfd70('0x46')],_0xfd70('0x58'));if(this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x63')]){this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x98')]=_0xe2fbe[_0xfd70('0x6b')](this['channels'][_0x509520['uniqueid']][_0xfd70('0x94')],'seconds');this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x64')]=this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x56')]-this['channels'][_0x509520[_0xfd70('0x32')]][_0xfd70('0x98')];}if(_0x509520['context']==='from-sip'){if(this[_0xfd70('0x14')][_0x509520[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]]){this[_0xfd70('0x14')][_0x509520[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]]=_['omit'](this[_0xfd70('0x14')][_0x509520[_0xfd70('0x3b')]['split']('-')[0x0]],[_0xfd70('0x3f')]);logger[_0xfd70('0x35')](_0xfd70('0x99'),_0x509520['uniqueid'],util[_0xfd70('0x2c')]({'id':this[_0xfd70('0x14')][_0x509520[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x509520[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]][_0xfd70('0x43')]},{'showHidden':![],'depth':null}));this[_0xfd70('0x30')](util[_0xfd70('0x40')](_0xfd70('0x41'),this[_0xfd70('0x14')][_0x509520[_0xfd70('0x3b')][_0xfd70('0x3e')]('-')[0x0]][_0xfd70('0x4e')]),_0xfd70('0x9a'),{'id':this[_0xfd70('0x14')][_0x509520[_0xfd70('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x509520[_0xfd70('0x3b')]['split']('-')[0x0]][_0xfd70('0x43')]});for(var _0x4876e7=0x0;_0x4876e7<Object['keys'](this[_0xfd70('0x14')])['length'];_0x4876e7++){var _0x200915=Object[_0xfd70('0x4b')](this[_0xfd70('0x14')])[_0x4876e7];var _0xf7af4e=this[_0xfd70('0x14')][_0x200915];if(_0xf7af4e[_0xfd70('0x43')]===Number(this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x65')])){this[_0xfd70('0x30')](util[_0xfd70('0x40')]('user:%s',_0xf7af4e[_0xfd70('0x4e')]),_0xfd70('0x9a'),{'id':_0xf7af4e['id'],'destaccountcode':_0xf7af4e[_0xfd70('0x43')],'transfer':this[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]]['transferType']});break;}}}}var _0x3fa192=this;Promise[_0xfd70('0x9b')]()[_0xfd70('0x9c')](function(){var _0x2e2fb3=_0x3fa192[_0xfd70('0x13')][_0x509520['uniqueid']];if(typeof _0x2e2fb3[_0xfd70('0x9d')]===_0xfd70('0x4c'))return;if(_['isEmpty'](_0x2e2fb3[_0xfd70('0x76')]))return;return RpcSetting[_0xfd70('0x9e')]()[_0xfd70('0x9c')](function(_0x2b196b){if(!_0x2b196b[_0xfd70('0x9f')])return;return Promise[_0xfd70('0x9b')]()[_0xfd70('0x9c')](function(){return ami[_0xfd70('0xa0')]({'action':_0xfd70('0xa1'),'channel':_0x2e2fb3[_0xfd70('0x3b')]})[_0xfd70('0xa2')](function(){});})[_0xfd70('0x9c')](function(){return ami['Action']({'action':_0xfd70('0xa1'),'channel':_0x2e2fb3[_0xfd70('0x67')]})[_0xfd70('0xa2')](function(){})[_0xfd70('0xa3')](function(){var _0x1b25ce=_0x3fa192[_0xfd70('0x14')][_0x2e2fb3[_0xfd70('0x67')][_0xfd70('0x3e')]('-')[0x0]];if(!_0x1b25ce)return;io[_0xfd70('0x30')](_0xfd70('0xa4'),{'agentId':_0x1b25ce['id'],'uniqueid':_0x2e2fb3['uniqueid']});});});});})[_0xfd70('0x9c')](function(){if(_0x509520[_0xfd70('0xa5')]===_0xfd70('0xa6')){_0x3fa192['blindTransfers'][_0x509520[_0xfd70('0x32')]]=_0x509520;}else{if(_0x3fa192['channels'][_0x509520[_0xfd70('0x32')]][_0xfd70('0x5e')]==='outbound'&&_0x3fa192[_0xfd70('0x15')][_0x509520['uniqueid']]){_0x3fa192['channels'][_0x509520[_0xfd70('0x32')]][_0xfd70('0x32')]=[_0x3fa192[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]][_0xfd70('0x37')],_0x3fa192['channels'][_0x509520[_0xfd70('0x32')]]['linkedid']=_0x3fa192['channels'][_0x509520[_0xfd70('0x32')]][_0xfd70('0x32')]][0x0];delete _0x3fa192['blindTransfers'][_0x509520['uniqueid']];}}logger[_0xfd70('0x35')](_0xfd70('0xa7'),_0x509520[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x3fa192[_0xfd70('0x13')][_0x509520[_0xfd70('0x32')]],{'showHidden':![],'depth':null}));ami[_0xfd70('0x30')](_0xfd70('0xa8'),_0x3fa192['channels'][_0x509520[_0xfd70('0x32')]]);delete _0x3fa192['channels'][_0x509520[_0xfd70('0x32')]];});}}}catch(_0x38f09d){logger[_0xfd70('0x2a')](_0xfd70('0xa9'),_0x509520['uniqueid'],util[_0xfd70('0x2c')](_0x38f09d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')]['syncAttendedTransfer']=function(_0x58fca0){try{if(this[_0xfd70('0x2e')](_0x58fca0)){logger[_0xfd70('0x27')](_0xfd70('0xaa'),_0x58fca0[_0xfd70('0x32')],_0x58fca0['origtransferercalleridnum'],_0x58fca0[_0xfd70('0xab')]);logger[_0xfd70('0x35')](_0xfd70('0xac'),_0x58fca0[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x58fca0,{'showHidden':![],'depth':null}));var _0x1aff23;if(this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xad')]]){this['channels'][_0x58fca0[_0xfd70('0xad')]][_0xfd70('0xae')]=_0x58fca0[_0xfd70('0xaf')];this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xad')]][_0xfd70('0xb0')]=_0x58fca0[_0xfd70('0xab')];if(this['channels'][_0x58fca0[_0xfd70('0xb1')]]){_0x1aff23=this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb1')]];this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb1')]]=this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xad')]];this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xad')]]=_0x1aff23;}this['channels'][_0x58fca0['secondtransfereruniqueid']][_0xfd70('0x9d')]=_0xfd70('0xb2');}else if(this['channels'][_0x58fca0[_0xfd70('0xb3')]]){this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb3')]]['transfercalleridnum']=_0x58fca0[_0xfd70('0xaf')];this['channels'][_0x58fca0[_0xfd70('0xb3')]][_0xfd70('0xb0')]=_0x58fca0[_0xfd70('0xab')];if(this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb4')]]){_0x1aff23=this['channels'][_0x58fca0['origtransfereruniqueid']];this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb4')]]=this[_0xfd70('0x13')][_0x58fca0['transfertargetuniqueid']];this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb3')]]=_0x1aff23;}this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb3')]]['transferType']=_0xfd70('0xb2');}if((this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb4')]]||this[_0xfd70('0x13')][_0x58fca0['origtransfererlinkedid']])&&this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb1')]]){var _0x101648=_['some']([this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb4')]],this['channels'][_0x58fca0['origtransfererlinkedid']],this[_0xfd70('0x13')][_0x58fca0['secondtransfereruniqueid']]],function(_0x50949c){return _0x50949c&&_0x50949c[_0xfd70('0x5e')]===_0xfd70('0xb5')&&_0x50949c['routeid'];});if(_0x101648){if(this['channels'][_0x58fca0[_0xfd70('0xb4')]])this[_0xfd70('0x13')][_0x58fca0['origtransfereruniqueid']]['transferType']='ATTENDED';if(this[_0xfd70('0x13')][_0x58fca0[_0xfd70('0xb6')]])this['channels'][_0x58fca0['origtransfererlinkedid']][_0xfd70('0x9d')]='ATTENDED';this[_0xfd70('0x13')][_0x58fca0['secondtransfereruniqueid']][_0xfd70('0x9d')]=_0xfd70('0xb2');}}}}catch(_0x1596b5){logger[_0xfd70('0x2a')](_0xfd70('0xb7'),_0x58fca0[_0xfd70('0x32')],util['inspect'](_0x1596b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0xb8')]=function(_0x2b51ba){try{if(this[_0xfd70('0x2e')](_0x2b51ba)){logger[_0xfd70('0x27')](_0xfd70('0xb9'),_0x2b51ba['uniqueid'],_0x2b51ba['transfereecalleridnum'],_0x2b51ba[_0xfd70('0xba')]);logger[_0xfd70('0x35')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x2b51ba[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x2b51ba,{'showHidden':![],'depth':null}));if(this[_0xfd70('0x13')][_0x2b51ba[_0xfd70('0xad')]]){this[_0xfd70('0x13')][_0x2b51ba[_0xfd70('0xad')]]['transfercalleridnum']=_0x2b51ba[_0xfd70('0xbb')];this[_0xfd70('0x13')][_0x2b51ba[_0xfd70('0xad')]][_0xfd70('0xb0')]=_0x2b51ba['extension'];this['channels'][_0x2b51ba[_0xfd70('0xad')]]['transferType']=_0xfd70('0xbc');this[_0xfd70('0x1d')]({'event':_0xfd70('0xa6'),'uniqueid':_0x2b51ba[_0xfd70('0xad')],'linkedid':_0x2b51ba[_0xfd70('0xbd')],'context':_0x2b51ba['context'],'channel':_0x2b51ba[_0xfd70('0xbe')]});}else{this[_0xfd70('0x13')][_0x2b51ba['transfereruniqueid']][_0xfd70('0x9d')]='BLIND';this['syncHangup']({'event':_0xfd70('0xa6'),'uniqueid':_0x2b51ba[_0xfd70('0xbd')],'linkedid':_0x2b51ba[_0xfd70('0xad')],'context':_0x2b51ba[_0xfd70('0x39')],'channel':_0x2b51ba[_0xfd70('0xbe')]});}}}catch(_0x1d80ca){logger['error'](_0xfd70('0xbf'),_0x2b51ba[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x1d80ca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x24')]=function(_0x2461c2){try{if(this[_0xfd70('0x2e')](_0x2461c2)){logger[_0xfd70('0x35')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x2461c2[_0xfd70('0x32')],util['inspect'](_0x2461c2,{'showHidden':![],'depth':null}));if(this[_0xfd70('0x13')][_0x2461c2[_0xfd70('0x32')]]){if(!_[_0xfd70('0x77')](this[_0xfd70('0x13')][_0x2461c2['uniqueid']][_0xfd70('0x94')])){this[_0xfd70('0x13')][_0x2461c2['uniqueid']][_0xfd70('0xc0')]=moment()['format'](_0xfd70('0x47'));logger[_0xfd70('0x27')](_0xfd70('0xc1'),_0x2461c2[_0xfd70('0x32')],this[_0xfd70('0x13')][_0x2461c2['uniqueid']][_0xfd70('0xc0')]);}}}}catch(_0x35712d){logger['error'](_0xfd70('0xc2'),_0x2461c2[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x35712d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd70('0x2d')][_0xfd70('0x26')]=function(_0x33516b){try{if(this[_0xfd70('0x2e')](_0x33516b)){logger[_0xfd70('0x35')](_0xfd70('0xc3'),_0x33516b[_0xfd70('0x32')],util[_0xfd70('0x2c')](_0x33516b,{'showHidden':![],'depth':null}));if(this[_0xfd70('0x13')][_0x33516b[_0xfd70('0x32')]]){if(!_['isNil'](this[_0xfd70('0x13')][_0x33516b['uniqueid']][_0xfd70('0xc0')])){this[_0xfd70('0x13')][_0x33516b[_0xfd70('0x32')]][_0xfd70('0xc4')]+=moment()[_0xfd70('0xc5')](0x0)[_0xfd70('0x6b')](this[_0xfd70('0x13')][_0x33516b[_0xfd70('0x32')]][_0xfd70('0xc0')],_0xfd70('0x58'));logger[_0xfd70('0x27')](_0xfd70('0xc6'),_0x33516b[_0xfd70('0x32')],this[_0xfd70('0x13')][_0x33516b[_0xfd70('0x32')]][_0xfd70('0xc4')]);delete this[_0xfd70('0x13')][_0x33516b[_0xfd70('0x32')]][_0xfd70('0xc0')];}}}}catch(_0x24f7ac){logger[_0xfd70('0x2a')](_0xfd70('0xc7'),_0x33516b['uniqueid'],util[_0xfd70('0x2c')](_0x24f7ac,{'showHidden':![],'depth':null}));}};module[_0xfd70('0xc8')]=VoiceCallReport;
\ No newline at end of file
+var _0xee0c=['subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answertime','holdtime','diff','connectedlinename','channelstate','UserId','membername','answered','destinationchannel','routealias','queue','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','isEmpty','stopRecordingOnTransfer','StopMixMonitor','catch','event','BlindTransfer','syncAttendedTransfer','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','redis','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','disposition','toNumber','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s'];(function(_0x45cbcf,_0xfbdbc2){var _0x52ece8=function(_0x498579){while(--_0x498579){_0x45cbcf['push'](_0x45cbcf['shift']());}};_0x52ece8(++_0xfbdbc2);}(_0xee0c,0x12c));var _0xcee0=function(_0x527ab2,_0x35e6a3){_0x527ab2=_0x527ab2-0x0;var _0x59a39e=_0xee0c[_0x527ab2];return _0x59a39e;};'use strict';var _=require(_0xcee0('0x0'));var moment=require(_0xcee0('0x1'));var util=require(_0xcee0('0x2'));var path=require(_0xcee0('0x3'));var Redis=require(_0xcee0('0x4'));var config=require(_0xcee0('0x5'));var logger=require(_0xcee0('0x6'))(_0xcee0('0x7'));var ami=require(_0xcee0('0x8'));var Channel=require('../model/channel');var RpcSetting=require(_0xcee0('0x9'));var applications=[_0xcee0('0xa'),'queue',_0xcee0('0xb'),_0xcee0('0xc'),'playback','voicemail'];var dispositions=['NO\x20ANSWER',_0xcee0('0xd'),_0xcee0('0xd'),_0xcee0('0xe'),_0xcee0('0xe'),_0xcee0('0xe'),_0xcee0('0xf'),_0xcee0('0x10'),_0xcee0('0xd'),_0xcee0('0xd'),_0xcee0('0xd')];config['redis']=_[_0xcee0('0x11')](config[_0xcee0('0x12')],{'host':'localhost','port':0x18eb});var io=require(_0xcee0('0x13'))(new Redis(config[_0xcee0('0x12')]));function VoiceCallReport(_0x45f7a3){this[_0xcee0('0x14')]=_0x45f7a3[_0xcee0('0x14')];this['agents']=_0x45f7a3[_0xcee0('0x15')];this[_0xcee0('0x16')]={};ami['on'](_0xcee0('0x17'),this['syncNewExten'][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x19'),this[_0xcee0('0x1a')][_0xcee0('0x18')](this));ami['on']('newchannel',this[_0xcee0('0x1b')]['bind'](this));ami['on'](_0xcee0('0x1c'),this[_0xcee0('0x1d')][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x1e'),this[_0xcee0('0x1f')][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x20'),this[_0xcee0('0x21')][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x22'),this[_0xcee0('0x23')][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x24'),this['syncAttendedTransfer'][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x25'),this[_0xcee0('0x26')][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x27'),this[_0xcee0('0x28')][_0xcee0('0x18')](this));ami['on'](_0xcee0('0x29'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0xcee0('0x2a')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xcee0('0x2b')]();}catch(_0x4ad5c7){logger[_0xcee0('0x2c')]('[voiceCallReport][coreshowchannels]',util[_0xcee0('0x2d')](_0x4ad5c7,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x2f')]=function(_0x2cbcb9){return _0x2cbcb9!==null&&!_[_0xcee0('0x30')](_0x2cbcb9);};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x31')]=function(_0x1b77e9,_0x37db53,_0x40e54d){io['to'](_0x1b77e9)[_0xcee0('0x31')](_0x37db53,_0x40e54d);};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x23')]=function(_0x3a1b6d){try{if(this[_0xcee0('0x2f')](_0x3a1b6d)){logger['info'](_0xcee0('0x32'),_0x3a1b6d[_0xcee0('0x33')],_0x3a1b6d[_0xcee0('0x34')],_0x3a1b6d[_0xcee0('0x35')]);logger[_0xcee0('0x36')](_0xcee0('0x37'),_0x3a1b6d[_0xcee0('0x33')],util['inspect'](_0x3a1b6d,{'showHidden':![],'depth':null}));if(_0x3a1b6d[_0xcee0('0x33')]===_0x3a1b6d[_0xcee0('0x38')]){if(!_['isUndefined'](this[_0xcee0('0x14')][_0x3a1b6d[_0xcee0('0x33')]])){_[_0xcee0('0x39')](this[_0xcee0('0x14')][_0x3a1b6d[_0xcee0('0x33')]],_[_0xcee0('0x3a')](_0x3a1b6d,_[_0xcee0('0x3b')](this[_0xcee0('0x14')][_0x3a1b6d[_0xcee0('0x33')]])));}}if(_0x3a1b6d[_0xcee0('0x3c')]===_0xcee0('0x3d')){if(this['agents'][_0x3a1b6d[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]]){if(_0x3a1b6d[_0xcee0('0x40')]==_0xcee0('0x41')){this['agents'][_0x3a1b6d[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]][_0xcee0('0x42')]=_0x3a1b6d[_0xcee0('0x43')];this[_0xcee0('0x31')](util[_0xcee0('0x44')](_0xcee0('0x45'),this[_0xcee0('0x15')][_0x3a1b6d[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]][_0xcee0('0x46')]),'user:agentconnect',{'destaccountcode':this[_0xcee0('0x15')][_0x3a1b6d[_0xcee0('0x3e')]['split']('-')[0x0]][_0xcee0('0x47')],'destconnectedlinenum':_0x3a1b6d[_0xcee0('0x43')]});}}}}}catch(_0x2f00ce){logger[_0xcee0('0x2c')](_0xcee0('0x48'),_0x3a1b6d[_0xcee0('0x33')],util['inspect'](_0x2f00ce,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcee0('0x1b')]=function(_0x5a3635){try{if(this['isNotNull'](_0x5a3635)){logger[_0xcee0('0x36')](_0xcee0('0x49'),_0x5a3635['uniqueid'],util[_0xcee0('0x2d')](_0x5a3635,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a3635[_0xcee0('0x33')]]){return;}if(_0x5a3635[_0xcee0('0x3e')]===_0xcee0('0x4a')){return;}if(_0x5a3635[_0xcee0('0x33')]!==_0x5a3635['linkedid']&&!this[_0xcee0('0x16')][_0x5a3635[_0xcee0('0x38')]]){return;}logger[_0xcee0('0x2a')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x5a3635[_0xcee0('0x33')],_0x5a3635[_0xcee0('0x3c')],_0x5a3635['exten']);this[_0xcee0('0x14')][_0x5a3635[_0xcee0('0x33')]]=new Channel();this[_0xcee0('0x14')][_0x5a3635[_0xcee0('0x33')]][_0xcee0('0x4b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5a3635['uniqueid']][_0xcee0('0x4c')]=dispositions[_[_0xcee0('0x4d')](_0x5a3635['channelstate'])];_[_0xcee0('0x39')](this[_0xcee0('0x14')][_0x5a3635[_0xcee0('0x33')]],_[_0xcee0('0x3a')](_0x5a3635,_[_0xcee0('0x3b')](this[_0xcee0('0x14')][_0x5a3635['uniqueid']])));if(_0x5a3635['context']===_0xcee0('0x3d')){var _0x4e800=this['agents'][_0x5a3635['channel']['split']('-')[0x0]];if(_0x4e800&&typeof _0x4e800[_0xcee0('0x42')]===_0xcee0('0x4e')){_0x4e800[_0xcee0('0x42')]=_0x5a3635[_0xcee0('0x40')];logger[_0xcee0('0x36')](_0xcee0('0x4f'),_0x5a3635[_0xcee0('0x33')],util[_0xcee0('0x2d')]({'id':_0x4e800['id'],'destaccountcode':_0x4e800['accountcode'],'destconnectedlinenum':_0x5a3635[_0xcee0('0x40')]},{'showHidden':![],'depth':null}));this[_0xcee0('0x31')](util['format'](_0xcee0('0x45'),_0x4e800[_0xcee0('0x46')]),_0xcee0('0x50'),{'id':_0x4e800['id'],'destaccountcode':_0x4e800[_0xcee0('0x47')],'destconnectedlinenum':_0x5a3635[_0xcee0('0x40')]});}}}}catch(_0x3e6b5c){logger['error'](_0xcee0('0x51'),_0x5a3635[_0xcee0('0x33')],util['inspect'](_0x3e6b5c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x1a')]=function(_0x56620f){try{if(this[_0xcee0('0x2f')](_0x56620f)){logger['debug'](_0xcee0('0x52'),_0x56620f[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x56620f,{'showHidden':![],'depth':null}));if(_0x56620f[_0xcee0('0x3e')]==='OutgoingSpoolFailed'||_0x56620f[_0xcee0('0x40')]==='h')return;if(_0x56620f[_0xcee0('0x33')]===_0x56620f[_0xcee0('0x38')]||this[_0xcee0('0x16')][_0x56620f[_0xcee0('0x38')]]){_0x56620f[_0xcee0('0x53')]=_0x56620f[_0xcee0('0x53')]?_0x56620f[_0xcee0('0x53')]['toLowerCase']():undefined;_0x56620f[_0xcee0('0x54')]=_0x56620f[_0xcee0('0x55')]||_0x56620f[_0xcee0('0x54')];if(_0x56620f[_0xcee0('0x55')]&&!_0x56620f['appdata'][_0xcee0('0x56')](_0xcee0('0x57'))&&_0x56620f[_0xcee0('0x53')]!=='queue'){_0x56620f['applicationdata']=_0x56620f[_0xcee0('0x54')][_0xcee0('0x58')]();}logger[_0xcee0('0x2a')](_0xcee0('0x59'),_0x56620f['uniqueid'],_0x56620f[_0xcee0('0x53')],_0x56620f[_0xcee0('0x54')]);if(_[_0xcee0('0x30')](this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]])){this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]]=new Channel();this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]][_0xcee0('0x4b')]=_0x56620f['duration']?moment()[_0xcee0('0x5a')](moment[_0xcee0('0x5b')](_0x56620f[_0xcee0('0x5b')])[_0xcee0('0x5c')](),_0xcee0('0x5c'))[_0xcee0('0x44')](_0xcee0('0x5d')):moment()[_0xcee0('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]][_0xcee0('0x4c')]=_0xcee0('0xe');}_[_0xcee0('0x39')](this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]],_[_0xcee0('0x3a')](_0x56620f,_[_0xcee0('0x3b')](this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]])));if(_[_0xcee0('0x5e')](applications,_0x56620f[_0xcee0('0x53')])){this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]][_0xcee0('0x5f')]=_0x56620f['application'];this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]][_0xcee0('0x60')]=_0x56620f[_0xcee0('0x54')];if(_0x56620f[_0xcee0('0x53')]===_0xcee0('0xa')&&_['startsWith'](_0x56620f['applicationdata']['toLowerCase'](),_0xcee0('0x61'))){var _0x5bce67=_0x56620f['applicationdata']['split']('=');var _0x1071db=_0x5bce67[0x0][_0xcee0('0x58')]()['match'](/cdr\((.*)\)/);if(_0x1071db){if(_0x1071db[0x1]===_0xcee0('0x62')&&!_[_0xcee0('0x63')](this['channels'][_0x56620f[_0xcee0('0x33')]][_0x1071db[0x1]]))return;this[_0xcee0('0x14')][_0x56620f[_0xcee0('0x33')]][_0x1071db[0x1]]=_0x5bce67[0x1];}}else if(_0x56620f[_0xcee0('0x53')]==='queue'){this[_0xcee0('0x14')][_0x56620f['uniqueid']]['queue']=_0x56620f[_0xcee0('0x54')][_0xcee0('0x3f')](',')[0x0];}}}}}catch(_0x49aa8c){logger[_0xcee0('0x2c')](_0xcee0('0x64'),_0x56620f[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x49aa8c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x1d')]=function(_0x2b0938){try{if(this[_0xcee0('0x2f')](_0x2b0938)){logger[_0xcee0('0x2a')](_0xcee0('0x65'),_0x2b0938[_0xcee0('0x33')],_0x2b0938[_0xcee0('0x38')],_0x2b0938[_0xcee0('0x34')],_0x2b0938[_0xcee0('0x35')]);logger[_0xcee0('0x36')](_0xcee0('0x66'),_0x2b0938[_0xcee0('0x33')],util['inspect'](_0x2b0938,{'showHidden':![],'depth':null}));if(_0x2b0938['channelstate']!=='6')return;var _0x1af0d6=this['agents'][_0x2b0938[_0xcee0('0x3e')]['split']('-')[0x0]];if(_0x2b0938[_0xcee0('0x33')]!==_0x2b0938['linkedid']){var _0xc883db=moment();if(this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]]){if(!this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]]['answered']){this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]]['answered']=!![];this[_0xcee0('0x14')][_0x2b0938['linkedid']][_0xcee0('0x67')]=_0xc883db[_0xcee0('0x44')](_0xcee0('0x5d'));if(this['channels'][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x4b')]){this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x68')]=_0xc883db[_0xcee0('0x69')](this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x4b')],_0xcee0('0x5c'));}}this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]]['linkedid']=_0x2b0938[_0xcee0('0x33')];if(_0x2b0938[_0xcee0('0x35')]!==_0xcee0('0x41')){this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x43')]=_0x2b0938[_0xcee0('0x35')];}this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x6a')]=_0x2b0938['calleridname'];this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]]['destinationchannel']=_0x2b0938[_0xcee0('0x3e')];this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x4c')]=dispositions[_[_0xcee0('0x4d')](_0x2b0938[_0xcee0('0x6b')])];if(_0x1af0d6){this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x6c')]=_0x1af0d6['id'];this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x6d')]=_0x1af0d6[_0xcee0('0x46')];}}if(this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]]){if(!this['channels'][_0x2b0938['uniqueid']][_0xcee0('0x6e')]){this[_0xcee0('0x14')][_0x2b0938['uniqueid']][_0xcee0('0x6e')]=!![];this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x67')]=_0xc883db[_0xcee0('0x44')](_0xcee0('0x5d'));if(this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x4b')]){this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x68')]=_0xc883db[_0xcee0('0x69')](this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x4b')],_0xcee0('0x5c'));}}if(_0x2b0938[_0xcee0('0x35')]!==_0xcee0('0x41')){this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x43')]=_0x2b0938['calleridnum'];}this['channels'][_0x2b0938['uniqueid']]['connectedlinename']=_0x2b0938[_0xcee0('0x34')];this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x6f')]=_0x2b0938[_0xcee0('0x3e')];this[_0xcee0('0x14')][_0x2b0938['uniqueid']]['disposition']=dispositions[_[_0xcee0('0x4d')](_0x2b0938[_0xcee0('0x6b')])];}}else{if(this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]]){if(_0x1af0d6){this['channels'][_0x2b0938[_0xcee0('0x33')]]['UserId']=_0x1af0d6['id'];this['channels'][_0x2b0938[_0xcee0('0x33')]]['membername']=_0x1af0d6[_0xcee0('0x46')];}}}if(_0x2b0938[_0xcee0('0x3c')]==='from-sip'){if(_0x1af0d6){_0x1af0d6[_0xcee0('0x42')]=_0x2b0938[_0xcee0('0x40')];var _0x5aa17f,_0x5083dd;if(this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x33')]]){_0x5aa17f=this['channels'][_0x2b0938[_0xcee0('0x33')]][_0xcee0('0x70')];_0x5083dd=this['channels'][_0x2b0938[_0xcee0('0x33')]]['queue'];}else if(this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]]){_0x5aa17f=this[_0xcee0('0x14')][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x70')];_0x5083dd=this['channels'][_0x2b0938[_0xcee0('0x38')]][_0xcee0('0x71')];}_0x1af0d6[_0xcee0('0x71')]=_0x5083dd;_0x1af0d6[_0xcee0('0x70')]=_0x5aa17f;var _0x1899a4={'id':_0x1af0d6['id'],'name':_0x1af0d6['name'],'agentconnected':!![],'destaccountcode':_0x1af0d6[_0xcee0('0x47')],'destconnectedlinenum':_0x2b0938[_0xcee0('0x40')],'queue':_0x5083dd||undefined,'routealias':_0x5aa17f,'uniqueid':_0x2b0938[_0xcee0('0x38')]};logger[_0xcee0('0x36')](_0xcee0('0x72'),_0x2b0938[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x1899a4,{'showHidden':![],'depth':null}));this[_0xcee0('0x31')](util[_0xcee0('0x44')](_0xcee0('0x45'),_0x1af0d6[_0xcee0('0x46')]),_0xcee0('0x50'),_0x1899a4);}}}}catch(_0x276bc9){logger[_0xcee0('0x2c')]('[%s][voiceCallReport][newstate]',_0x2b0938[_0xcee0('0x33')],util['inspect'](_0x276bc9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x73')]=function(_0x2950de,_0x2a69af){try{if(this[_0xcee0('0x14')][_0x2950de]){logger['info'](_0xcee0('0x74'),_0x2950de,_0x2a69af);this[_0xcee0('0x14')][_0x2950de][_0xcee0('0x75')]=!![];if(_[_0xcee0('0x76')](_0x2a69af,_0xcee0('0x77'))){_0x2a69af=_0x2a69af[_0xcee0('0x78')](_0xcee0('0x77'),'.WAV');}this[_0xcee0('0x14')][_0x2950de][_0xcee0('0x79')]=_0x2a69af;var _0x417c1=_[_0xcee0('0x7a')](this[_0xcee0('0x14')][_0x2950de][_0xcee0('0x7b')],{'filename':_0x2a69af});if(_['isNil'](_0x417c1)){this[_0xcee0('0x14')][_0x2950de][_0xcee0('0x7b')]['push']({'filename':_0x2a69af,'createdAt':moment()[_0xcee0('0x44')](_0xcee0('0x5d')),'mixmonitorid':'','status':_0xcee0('0x7c')});}}}catch(_0x2e76f0){logger[_0xcee0('0x2c')](_0xcee0('0x7d'),_0x2950de,util['inspect'](_0x2e76f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x1f')]=function(_0x1cc9e0){try{if(this['isNotNull'](_0x1cc9e0)){logger['debug'](_0xcee0('0x7e'),_0x1cc9e0[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x1cc9e0,{'showHidden':![],'depth':null}));if(this['channels'][_0x1cc9e0['uniqueid']]&&_0x1cc9e0[_0xcee0('0x3e')]!='OutgoingSpoolFailed'){if(this[_0xcee0('0x2f')](_0x1cc9e0[_0xcee0('0x7f')])){if(this['isNotNull'](_0x1cc9e0[_0xcee0('0x7f')][_0xcee0('0x80')])){logger[_0xcee0('0x2a')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x1cc9e0['uniqueid'],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x73')](_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0[_0xcee0('0x81')]);}else if(this[_0xcee0('0x2f')](_0x1cc9e0['variable'][_0xcee0('0x82')])){logger[_0xcee0('0x2a')](_0xcee0('0x83'),_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x14')][_0x1cc9e0[_0xcee0('0x33')]][_0xcee0('0x35')]=_0x1cc9e0[_0xcee0('0x81')];}else if(this[_0xcee0('0x2f')](_0x1cc9e0['variable'][_0xcee0('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0['value']);this[_0xcee0('0x14')][_0x1cc9e0['uniqueid']][_0xcee0('0x85')]=_0x1cc9e0['value'];}else if(this['isNotNull'](_0x1cc9e0[_0xcee0('0x7f')][_0xcee0('0x86')])){logger[_0xcee0('0x2a')](_0xcee0('0x87'),_0x1cc9e0['uniqueid'],_0x1cc9e0[_0xcee0('0x81')]);this['channels'][_0x1cc9e0['uniqueid']][_0xcee0('0x62')]=_0x1cc9e0[_0xcee0('0x81')];}else if(this[_0xcee0('0x2f')](_0x1cc9e0[_0xcee0('0x7f')][_0xcee0('0x88')])){logger[_0xcee0('0x2a')](_0xcee0('0x89'),_0x1cc9e0['uniqueid'],_0x1cc9e0[_0xcee0('0x81')][_0xcee0('0x3f')](',')[0x0]);this[_0xcee0('0x14')][_0x1cc9e0[_0xcee0('0x33')]][_0xcee0('0x71')]=_0x1cc9e0[_0xcee0('0x81')]['split'](',')[0x0];}else if(this['isNotNull'](_0x1cc9e0['variable'][_0xcee0('0x8a')])){logger[_0xcee0('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x14')][_0x1cc9e0[_0xcee0('0x33')]][_0xcee0('0x8b')]=_0x1cc9e0[_0xcee0('0x81')];}else if(this['isNotNull'](_0x1cc9e0['variable'][_0xcee0('0x8c')])){logger[_0xcee0('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x14')][_0x1cc9e0[_0xcee0('0x33')]][_0xcee0('0x8d')]=_0x1cc9e0['value'];}else if(this['isNotNull'](_0x1cc9e0[_0xcee0('0x7f')][_0xcee0('0x8e')])){logger[_0xcee0('0x2a')](_0xcee0('0x8f'),_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x14')][_0x1cc9e0['uniqueid']]['calleridpreview']=_0x1cc9e0[_0xcee0('0x81')];}else if(this[_0xcee0('0x2f')](_0x1cc9e0[_0xcee0('0x7f')][_0xcee0('0x90')])){logger[_0xcee0('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x1cc9e0['uniqueid'],_0x1cc9e0[_0xcee0('0x81')]);this['channels'][_0x1cc9e0['uniqueid']][_0xcee0('0x71')]=_0x1cc9e0[_0xcee0('0x81')];}else if(this[_0xcee0('0x2f')](_0x1cc9e0[_0xcee0('0x7f')]['sipcallid'])){logger[_0xcee0('0x2a')](_0xcee0('0x91'),_0x1cc9e0[_0xcee0('0x33')],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x14')][_0x1cc9e0[_0xcee0('0x33')]][_0xcee0('0x92')]=_0x1cc9e0['value'];}}}else if(this[_0xcee0('0x2f')](_0x1cc9e0[_0xcee0('0x7f')][_0xcee0('0x80')])){if(_0x1cc9e0['value']){var _0x525413=path['parse'](_0x1cc9e0[_0xcee0('0x81')])[_0xcee0('0x46')];logger[_0xcee0('0x2a')](_0xcee0('0x93'),_0x525413,_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x73')](_0x525413,_0x1cc9e0[_0xcee0('0x81')]);}}else if(this['channels'][_0x1cc9e0[_0xcee0('0x38')]]){if(this[_0xcee0('0x2f')](_0x1cc9e0['variable'])){if(this[_0xcee0('0x2f')](_0x1cc9e0['variable'][_0xcee0('0x94')])){logger[_0xcee0('0x2a')](_0xcee0('0x91'),_0x1cc9e0[_0xcee0('0x38')],_0x1cc9e0[_0xcee0('0x81')]);this[_0xcee0('0x14')][_0x1cc9e0['linkedid']]['sipcalllinkedid']=_0x1cc9e0[_0xcee0('0x81')];}}}}}catch(_0x26618b){logger[_0xcee0('0x2c')](_0xcee0('0x95'),_0x1cc9e0['uniqueid'],util[_0xcee0('0x2d')](_0x26618b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x21')]=function(_0x5415b0){try{if(this[_0xcee0('0x2f')](_0x5415b0)){logger[_0xcee0('0x36')](_0xcee0('0x96'),_0x5415b0[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x5415b0,{'showHidden':![],'depth':null}));if(this[_0xcee0('0x16')][_0x5415b0['linkedid']]){if(this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x38')]]){this['channels'][this[_0xcee0('0x16')][_0x5415b0['linkedid']]['linkedid']][_0xcee0('0x33')]=_0x5415b0[_0xcee0('0x33')];this[_0xcee0('0x14')][this['blindTransfers'][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x38')]][_0xcee0('0x6e')]=this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x6e')];this[_0xcee0('0x14')][this['blindTransfers'][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x38')]][_0xcee0('0x67')]=this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x67')];this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x38')]][_0xcee0('0x6f')]=this[_0xcee0('0x14')][this['blindTransfers'][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x38')]][_0xcee0('0x3e')];this[_0xcee0('0x14')][this['blindTransfers'][_0x5415b0[_0xcee0('0x38')]]['linkedid']][_0xcee0('0x4c')]=this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]]['disposition'];this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]]=this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x38')]];delete this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0['linkedid']][_0xcee0('0x38')]];}else if(this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0['linkedid']][_0xcee0('0x33')]]){this['channels'][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x33')]][_0xcee0('0x33')]=[this['channels'][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x33')]][_0xcee0('0x38')],this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x33')]]['linkedid']=this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0['linkedid']][_0xcee0('0x33')]]['uniqueid']][0x0];this[_0xcee0('0x14')][this['blindTransfers'][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x33')]]['answered']=this['channels'][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x6e')];this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x33')]][_0xcee0('0x67')]=this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x67')];this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0['linkedid']][_0xcee0('0x33')]][_0xcee0('0x6f')]=this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]][_0xcee0('0x33')]][_0xcee0('0x3e')];this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]]['uniqueid']][_0xcee0('0x4c')]=this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x4c')];this['channels'][_0x5415b0['uniqueid']]=this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]]['uniqueid']];delete this[_0xcee0('0x14')][this[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x38')]]['uniqueid']];}}if(this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]]){logger[_0xcee0('0x2a')](_0xcee0('0x97'),_0x5415b0['uniqueid'],_0x5415b0[_0xcee0('0x98')]);var _0xa4fed4=moment();this[_0xcee0('0x14')][_0x5415b0['uniqueid']][_0xcee0('0x99')]=_0xa4fed4[_0xcee0('0x44')](_0xcee0('0x5d'));this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x5b')]=_0xa4fed4[_0xcee0('0x69')](this['channels'][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x4b')],_0xcee0('0x5c'));if(this[_0xcee0('0x14')][_0x5415b0['uniqueid']][_0xcee0('0x6e')]){this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x9a')]=_0xa4fed4['diff'](this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x67')],'seconds');this[_0xcee0('0x14')][_0x5415b0['uniqueid']][_0xcee0('0x68')]=this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]]['duration']-this[_0xcee0('0x14')][_0x5415b0['uniqueid']][_0xcee0('0x9a')];}if(_0x5415b0['context']===_0xcee0('0x3d')){if(this[_0xcee0('0x15')][_0x5415b0[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]]){this[_0xcee0('0x15')][_0x5415b0['channel'][_0xcee0('0x3f')]('-')[0x0]]=_[_0xcee0('0x9b')](this[_0xcee0('0x15')][_0x5415b0[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]],[_0xcee0('0x42')]);logger[_0xcee0('0x36')](_0xcee0('0x9c'),_0x5415b0['uniqueid'],util[_0xcee0('0x2d')]({'id':this[_0xcee0('0x15')][_0x5415b0['channel'][_0xcee0('0x3f')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x5415b0[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xcee0('0x31')](util[_0xcee0('0x44')](_0xcee0('0x45'),this['agents'][_0x5415b0[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]]['name']),_0xcee0('0x9d'),{'id':this[_0xcee0('0x15')][_0x5415b0[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0xcee0('0x15')][_0x5415b0[_0xcee0('0x3e')][_0xcee0('0x3f')]('-')[0x0]][_0xcee0('0x47')]});for(var _0x33139f=0x0;_0x33139f<Object[_0xcee0('0x3b')](this[_0xcee0('0x15')])['length'];_0x33139f++){var _0x39256a=Object[_0xcee0('0x3b')](this[_0xcee0('0x15')])[_0x33139f];var _0x12cff7=this[_0xcee0('0x15')][_0x39256a];if(_0x12cff7['accountcode']===Number(this['channels'][_0x5415b0[_0xcee0('0x33')]]['connectedlinenum'])){this[_0xcee0('0x31')](util['format'](_0xcee0('0x45'),_0x12cff7[_0xcee0('0x46')]),_0xcee0('0x9d'),{'id':_0x12cff7['id'],'destaccountcode':_0x12cff7[_0xcee0('0x47')],'transfer':this[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]]['transferType']});break;}}}}var _0x215b3f=this;Promise['resolve']()[_0xcee0('0x9e')](function(){var _0x48ccd2=_0x215b3f[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]];if(typeof _0x48ccd2[_0xcee0('0x9f')]===_0xcee0('0x4e'))return;if(_[_0xcee0('0xa0')](_0x48ccd2[_0xcee0('0x7b')]))return;return RpcSetting['getSettings']()[_0xcee0('0x9e')](function(_0x5d7e11){if(!_0x5d7e11[_0xcee0('0xa1')])return;return Promise['resolve']()['then'](function(){return ami['Action']({'action':_0xcee0('0xa2'),'channel':_0x48ccd2[_0xcee0('0x3e')]})['catch'](function(){});})[_0xcee0('0x9e')](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x48ccd2[_0xcee0('0x6f')]})[_0xcee0('0xa3')](function(){})['finally'](function(){var _0x31a81d=_0x215b3f[_0xcee0('0x15')][_0x48ccd2[_0xcee0('0x6f')][_0xcee0('0x3f')]('-')[0x0]];if(!_0x31a81d)return;io[_0xcee0('0x31')]('webbar:stopmonitors',{'agentId':_0x31a81d['id'],'uniqueid':_0x48ccd2['uniqueid']});});});});})[_0xcee0('0x9e')](function(){if(_0x5415b0[_0xcee0('0xa4')]===_0xcee0('0xa5')){_0x215b3f['blindTransfers'][_0x5415b0[_0xcee0('0x33')]]=_0x5415b0;}else{if(_0x215b3f[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x62')]==='outbound'&&_0x215b3f[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x33')]]){_0x215b3f[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x33')]=[_0x215b3f[_0xcee0('0x14')][_0x5415b0['uniqueid']][_0xcee0('0x38')],_0x215b3f[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]][_0xcee0('0x38')]=_0x215b3f[_0xcee0('0x14')][_0x5415b0['uniqueid']]['uniqueid']][0x0];delete _0x215b3f[_0xcee0('0x16')][_0x5415b0[_0xcee0('0x33')]];}}logger[_0xcee0('0x36')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x5415b0[_0xcee0('0x33')],util['inspect'](_0x215b3f[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]],{'showHidden':![],'depth':null}));ami[_0xcee0('0x31')]('custom:voiceCallReport',_0x215b3f[_0xcee0('0x14')][_0x5415b0['uniqueid']]);delete _0x215b3f[_0xcee0('0x14')][_0x5415b0[_0xcee0('0x33')]];});}}}catch(_0x36aa6c){logger[_0xcee0('0x2c')]('[%s][voiceCallReport][hangup]',_0x5415b0[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x36aa6c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0xa6')]=function(_0x48c8e4){try{if(this[_0xcee0('0x2f')](_0x48c8e4)){logger[_0xcee0('0x2a')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x48c8e4[_0xcee0('0x33')],_0x48c8e4['origtransferercalleridnum'],_0x48c8e4[_0xcee0('0xa7')]);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x48c8e4[_0xcee0('0x33')],util['inspect'](_0x48c8e4,{'showHidden':![],'depth':null}));var _0x505b07;if(this['channels'][_0x48c8e4[_0xcee0('0xa8')]]){this['channels'][_0x48c8e4[_0xcee0('0xa8')]][_0xcee0('0xa9')]=_0x48c8e4[_0xcee0('0xaa')];this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xa8')]][_0xcee0('0xab')]=_0x48c8e4[_0xcee0('0xa7')];if(this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xac')]]){_0x505b07=this[_0xcee0('0x14')][_0x48c8e4['secondtransfereruniqueid']];this['channels'][_0x48c8e4['secondtransfereruniqueid']]=this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xa8')]];this[_0xcee0('0x14')][_0x48c8e4['transfereeuniqueid']]=_0x505b07;}this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xac')]][_0xcee0('0x9f')]=_0xcee0('0xad');}else if(this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xae')]]){this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xae')]][_0xcee0('0xa9')]=_0x48c8e4[_0xcee0('0xaa')];this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xae')]][_0xcee0('0xab')]=_0x48c8e4[_0xcee0('0xa7')];if(this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xaf')]]){_0x505b07=this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xaf')]];this['channels'][_0x48c8e4['origtransfereruniqueid']]=this[_0xcee0('0x14')][_0x48c8e4['transfertargetuniqueid']];this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xae')]]=_0x505b07;}this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xae')]][_0xcee0('0x9f')]=_0xcee0('0xad');}if((this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xaf')]]||this['channels'][_0x48c8e4[_0xcee0('0xb0')]])&&this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xac')]]){var _0x2db3c5=_['some']([this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xaf')]],this[_0xcee0('0x14')][_0x48c8e4['origtransfererlinkedid']],this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xac')]]],function(_0x49078e){return _0x49078e&&_0x49078e[_0xcee0('0x62')]===_0xcee0('0xb1')&&_0x49078e[_0xcee0('0xb2')];});if(_0x2db3c5){if(this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xaf')]])this[_0xcee0('0x14')][_0x48c8e4['origtransfereruniqueid']]['transferType']=_0xcee0('0xad');if(this[_0xcee0('0x14')][_0x48c8e4['origtransfererlinkedid']])this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xb0')]]['transferType']=_0xcee0('0xad');this[_0xcee0('0x14')][_0x48c8e4[_0xcee0('0xac')]][_0xcee0('0x9f')]=_0xcee0('0xad');}}}}catch(_0x291f3e){logger['error'](_0xcee0('0xb3'),_0x48c8e4[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x291f3e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x26')]=function(_0x1a350f){try{if(this[_0xcee0('0x2f')](_0x1a350f)){logger[_0xcee0('0x2a')](_0xcee0('0xb4'),_0x1a350f[_0xcee0('0x33')],_0x1a350f[_0xcee0('0xb5')],_0x1a350f[_0xcee0('0xb6')]);logger[_0xcee0('0x36')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1a350f[_0xcee0('0x33')],util['inspect'](_0x1a350f,{'showHidden':![],'depth':null}));if(this[_0xcee0('0x14')][_0x1a350f['transfereeuniqueid']]){this[_0xcee0('0x14')][_0x1a350f[_0xcee0('0xa8')]][_0xcee0('0xa9')]=_0x1a350f[_0xcee0('0xb5')];this['channels'][_0x1a350f[_0xcee0('0xa8')]]['transferconnectedlinenum']=_0x1a350f[_0xcee0('0xb6')];this[_0xcee0('0x14')][_0x1a350f[_0xcee0('0xa8')]][_0xcee0('0x9f')]=_0xcee0('0xb7');this['syncHangup']({'event':_0xcee0('0xa5'),'uniqueid':_0x1a350f['transfereeuniqueid'],'linkedid':_0x1a350f[_0xcee0('0xb8')],'context':_0x1a350f[_0xcee0('0x3c')],'channel':_0x1a350f[_0xcee0('0xb9')]});}else{this['channels'][_0x1a350f[_0xcee0('0xb8')]][_0xcee0('0x9f')]=_0xcee0('0xb7');this['syncHangup']({'event':_0xcee0('0xa5'),'uniqueid':_0x1a350f[_0xcee0('0xb8')],'linkedid':_0x1a350f[_0xcee0('0xa8')],'context':_0x1a350f[_0xcee0('0x3c')],'channel':_0x1a350f['transfererchannel']});}}}catch(_0x4f8716){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x1a350f[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x4f8716,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')][_0xcee0('0x28')]=function(_0x2e8900){try{if(this[_0xcee0('0x2f')](_0x2e8900)){logger[_0xcee0('0x36')](_0xcee0('0xba'),_0x2e8900['uniqueid'],util['inspect'](_0x2e8900,{'showHidden':![],'depth':null}));if(this['channels'][_0x2e8900[_0xcee0('0x33')]]){if(!_[_0xcee0('0x63')](this[_0xcee0('0x14')][_0x2e8900[_0xcee0('0x33')]]['answertime'])){this[_0xcee0('0x14')][_0x2e8900[_0xcee0('0x33')]]['mohstarttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xcee0('0x2a')](_0xcee0('0xbb'),_0x2e8900['uniqueid'],this['channels'][_0x2e8900['uniqueid']][_0xcee0('0xbc')]);}}}}catch(_0xa3e0a7){logger[_0xcee0('0x2c')]('[%s][voiceCallReport][musiconholdstart]',_0x2e8900[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0xa3e0a7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcee0('0x2e')]['syncMusicOnHoldStop']=function(_0x2882f2){try{if(this[_0xcee0('0x2f')](_0x2882f2)){logger[_0xcee0('0x36')](_0xcee0('0xbd'),_0x2882f2[_0xcee0('0x33')],util['inspect'](_0x2882f2,{'showHidden':![],'depth':null}));if(this[_0xcee0('0x14')][_0x2882f2[_0xcee0('0x33')]]){if(!_[_0xcee0('0x63')](this['channels'][_0x2882f2[_0xcee0('0x33')]]['mohstarttime'])){this[_0xcee0('0x14')][_0x2882f2[_0xcee0('0x33')]][_0xcee0('0xbe')]+=moment()[_0xcee0('0xbf')](0x0)['diff'](this['channels'][_0x2882f2[_0xcee0('0x33')]]['mohstarttime'],'seconds');logger[_0xcee0('0x2a')](_0xcee0('0xc0'),_0x2882f2[_0xcee0('0x33')],this[_0xcee0('0x14')][_0x2882f2[_0xcee0('0x33')]][_0xcee0('0xbe')]);delete this[_0xcee0('0x14')][_0x2882f2['uniqueid']][_0xcee0('0xbc')];}}}}catch(_0x3b9a5f){logger[_0xcee0('0x2c')](_0xcee0('0xc1'),_0x2882f2[_0xcee0('0x33')],util[_0xcee0('0x2d')](_0x3b9a5f,{'showHidden':![],'depth':null}));}};module[_0xcee0('0xc2')]=VoiceCallReport;
\ No newline at end of file
index 22bbaf9..ba81f17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae24=['[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','variables','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','sumHoldTime','holdtime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','applicationdata','appdata','toLowerCase','startsWith','split','[%s][voiceDialReport][newexten]','exports','lodash','util','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','channels','outbound','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','substring','channel','lastIndexOf','omit','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:'];(function(_0x17266e,_0x5d273d){var _0x8eeaf4=function(_0xda6721){while(--_0xda6721){_0x17266e['push'](_0x17266e['shift']());}};_0x8eeaf4(++_0x5d273d);}(_0xae24,0x182));var _0x4ae2=function(_0x10cf72,_0x151bf1){_0x10cf72=_0x10cf72-0x0;var _0x4c615d=_0xae24[_0x10cf72];return _0x4c615d;};'use strict';var _=require(_0x4ae2('0x0'));var moment=require('moment');var util=require(_0x4ae2('0x1'));var Redis=require('ioredis');var config=require(_0x4ae2('0x2'));var logger=require(_0x4ae2('0x3'))('ami');var ami=require('../ami');config[_0x4ae2('0x4')]=_['defaults'](config[_0x4ae2('0x4')],{'host':_0x4ae2('0x5'),'port':0x18eb});var io=require(_0x4ae2('0x6'))(new Redis(config[_0x4ae2('0x4')]));function VoiceDialReport(_0x428054){this[_0x4ae2('0x7')]=_0x428054['outboundChannels'];this['outbound']=_0x428054[_0x4ae2('0x8')];this['applications']={};this['variables']={};ami['on'](_0x4ae2('0x9'),this[_0x4ae2('0xa')]['bind'](this));ami['on'](_0x4ae2('0xb'),this[_0x4ae2('0xc')][_0x4ae2('0xd')](this));ami['on'](_0x4ae2('0xe'),this['syncVarSet'][_0x4ae2('0xd')](this));ami['on'](_0x4ae2('0xf'),this[_0x4ae2('0x10')]['bind'](this));}VoiceDialReport[_0x4ae2('0x11')][_0x4ae2('0x12')]=function(_0x30d6c4){return _0x30d6c4!==null&&!_[_0x4ae2('0x13')](_0x30d6c4);};VoiceDialReport[_0x4ae2('0x11')][_0x4ae2('0x14')]=function(_0x145287,_0x3cabc9,_0xd527a0){io['to'](_0x145287)['emit'](_0x3cabc9,_0xd527a0);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x2f3936){try{if(this[_0x4ae2('0x12')](_0x2f3936)){logger['debug'](_0x4ae2('0x15'),_0x2f3936[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x2f3936,{'showHidden':![],'depth':null}));if(this[_0x4ae2('0x7')][_0x2f3936[_0x4ae2('0x16')]]){_[_0x4ae2('0x18')](this[_0x4ae2('0x7')][_0x2f3936[_0x4ae2('0x16')]],{'starttime':moment()[_0x4ae2('0x19')](_0x4ae2('0x1a')),'lastevent':'called','interface':_0x2f3936['channel'][_0x4ae2('0x1b')](0x0,_0x2f3936[_0x4ae2('0x1c')]['lastIndexOf']('-')),'membername':_0x2f3936[_0x4ae2('0x1c')][_0x4ae2('0x1b')](_0x2f3936[_0x4ae2('0x1c')][_0x4ae2('0x1d')]('/')+0x1,_0x2f3936[_0x4ae2('0x1c')]['lastIndexOf']('-'))},_[_0x4ae2('0x1e')](_0x2f3936,['event','privilege']));logger[_0x4ae2('0x1f')](_0x4ae2('0x20'),_0x2f3936[_0x4ae2('0x16')],this[_0x4ae2('0x7')][_0x2f3936[_0x4ae2('0x16')]]['membername'],this[_0x4ae2('0x7')][_0x2f3936['uniqueid']][_0x4ae2('0x21')]);logger[_0x4ae2('0x22')](_0x4ae2('0x23'),_0x2f3936['uniqueid'],util[_0x4ae2('0x17')](this[_0x4ae2('0x7')][_0x2f3936[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));if(this[_0x4ae2('0x24')][_0x2f3936[_0x4ae2('0x16')]])_[_0x4ae2('0x18')](this['channels'][_0x2f3936['uniqueid']],this[_0x4ae2('0x24')][_0x2f3936[_0x4ae2('0x16')]]);this[_0x4ae2('0x14')](_0x4ae2('0x25'),_0x4ae2('0x26'),this[_0x4ae2('0x7')][_0x2f3936['uniqueid']]);logger['debug'](_0x4ae2('0x27'),_0x2f3936['uniqueid'],util['inspect'](this['channels'][_0x2f3936[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));ami[_0x4ae2('0x14')]('custom:dialbegin',this[_0x4ae2('0x7')][_0x2f3936[_0x4ae2('0x16')]]);}}}catch(_0x3d56ea){logger[_0x4ae2('0x28')](_0x4ae2('0x29'),_0x2f3936[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x3d56ea,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4ae2('0x11')][_0x4ae2('0xc')]=function(_0x3542df){try{if(this[_0x4ae2('0x12')](_0x3542df)){logger[_0x4ae2('0x22')](_0x4ae2('0x2a'),_0x3542df[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x3542df,{'showHidden':![],'depth':null}));if(this[_0x4ae2('0x7')][_0x3542df[_0x4ae2('0x16')]]){this['channels'][_0x3542df[_0x4ae2('0x16')]]['dialstatus']=_0x3542df[_0x4ae2('0x2b')];if(_0x3542df[_0x4ae2('0x2b')]==='ANSWER'){this[_0x4ae2('0x7')][_0x3542df[_0x4ae2('0x16')]][_0x4ae2('0x2c')]=_0x3542df[_0x4ae2('0x2c')];this['channels'][_0x3542df[_0x4ae2('0x16')]][_0x4ae2('0x2d')]=_0x3542df[_0x4ae2('0x2d')];this[_0x4ae2('0x7')][_0x3542df[_0x4ae2('0x16')]][_0x4ae2('0x2e')]=moment()[_0x4ae2('0x19')](_0x4ae2('0x1a'));this[_0x4ae2('0x7')][_0x3542df['uniqueid']][_0x4ae2('0x2f')]='connect';logger[_0x4ae2('0x1f')](_0x4ae2('0x30'),_0x3542df[_0x4ae2('0x16')],_0x3542df[_0x4ae2('0x1c')][_0x4ae2('0x1b')](_0x3542df[_0x4ae2('0x1c')]['lastIndexOf']('/')+0x1,_0x3542df[_0x4ae2('0x1c')][_0x4ae2('0x1d')]('-')));logger[_0x4ae2('0x22')](_0x4ae2('0x31'),_0x3542df['uniqueid'],util[_0x4ae2('0x17')](this[_0x4ae2('0x7')][_0x3542df[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));ami[_0x4ae2('0x14')](_0x4ae2('0x32'),this[_0x4ae2('0x7')][_0x3542df[_0x4ae2('0x16')]]);}logger[_0x4ae2('0x22')](_0x4ae2('0x33'),_0x3542df[_0x4ae2('0x16')],util[_0x4ae2('0x17')](this['channels'][_0x3542df[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));this[_0x4ae2('0x14')](_0x4ae2('0x25'),_0x4ae2('0x26'),this['channels'][_0x3542df['uniqueid']]);}}}catch(_0xd46eed){logger[_0x4ae2('0x28')](_0x4ae2('0x34'),_0x3542df[_0x4ae2('0x16')],util['inspect'](_0xd46eed,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4ae2('0x11')][_0x4ae2('0x35')]=function(_0x5ca188){try{if(this[_0x4ae2('0x12')](_0x5ca188)){logger[_0x4ae2('0x22')](_0x4ae2('0x36'),_0x5ca188['uniqueid'],util[_0x4ae2('0x17')](_0x5ca188,{'showHidden':![],'depth':null}));this[_0x4ae2('0x37')](_0x5ca188[_0x4ae2('0x16')],_[_0x4ae2('0x38')](_0x5ca188[_0x4ae2('0x39')])[0x0],_0x5ca188[_0x4ae2('0x3a')]);if(this[_0x4ae2('0x12')](_0x5ca188[_0x4ae2('0x39')])&&this['isNotNull'](_0x5ca188[_0x4ae2('0x39')][_0x4ae2('0x3b')])){if(_['isUndefined'](this[_0x4ae2('0x7')][_0x5ca188[_0x4ae2('0x16')]])){this['channels'][_0x5ca188[_0x4ae2('0x16')]]={'routeId':_0x5ca188[_0x4ae2('0x3a')],'variables':this['variables'][_0x5ca188[_0x4ae2('0x16')]],'motionChannel':_0x4ae2('0x3c')};logger[_0x4ae2('0x1f')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x5ca188['uniqueid'],_0x5ca188[_0x4ae2('0x39')][_0x4ae2('0x3b')],_[_0x4ae2('0x38')](_0x5ca188[_0x4ae2('0x39')])[0x0],_0x5ca188['value']);logger[_0x4ae2('0x22')](_0x4ae2('0x3d'),_0x5ca188[_0x4ae2('0x16')],util['inspect'](this[_0x4ae2('0x7')][_0x5ca188[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));this[_0x4ae2('0x14')]('voice:outbound',_0x4ae2('0x26'),this[_0x4ae2('0x7')][_0x5ca188[_0x4ae2('0x16')]]);}}}}catch(_0x39d365){logger[_0x4ae2('0x28')](_0x4ae2('0x3e'),_0x5ca188[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x39d365,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4ae2('0x11')][_0x4ae2('0x37')]=function(_0x48afbb,_0x3db48e,_0x4a70c6){var _0x10db30=[_0x4ae2('0x3f'),_0x4ae2('0x40'),_0x4ae2('0x41'),_0x4ae2('0x42'),_0x4ae2('0x43'),'rtpaudioqoslossbridged',_0x4ae2('0x44'),_0x4ae2('0x45'),'sipcallid',_0x4ae2('0x46'),_0x4ae2('0x47'),'bridgepvtcallid',_0x4ae2('0x48'),'memberdynamic',_0x4ae2('0x49'),'memberlastcall',_0x4ae2('0x4a'),_0x4ae2('0x4b'),_0x4ae2('0x4c')];if(!_[_0x4ae2('0x4d')](_0x3db48e)&&!_[_0x4ae2('0x4e')](_0x10db30,_0x3db48e)){if(_[_0x4ae2('0x13')](this[_0x4ae2('0x4f')][_0x48afbb])){this[_0x4ae2('0x4f')][_0x48afbb]={};}this[_0x4ae2('0x4f')][_0x48afbb][_0x3db48e]=_0x4a70c6;}};VoiceDialReport['prototype'][_0x4ae2('0x10')]=function(_0x4284b4){try{if(this[_0x4ae2('0x12')](_0x4284b4)){logger[_0x4ae2('0x22')]('[%s][voiceDialReport][hangup]\x20event:',_0x4284b4[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x4284b4,{'showHidden':![],'depth':null}));if(this[_0x4ae2('0x7')][_0x4284b4['uniqueid']]){logger['info'](_0x4ae2('0x50'),_0x4284b4[_0x4ae2('0x16')],_0x4284b4[_0x4ae2('0x51')]);this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]][_0x4ae2('0x52')]=moment()[_0x4ae2('0x19')](_0x4ae2('0x1a'));this[_0x4ae2('0x7')][_0x4284b4['uniqueid']][_0x4ae2('0x53')]=moment(this['channels'][_0x4284b4[_0x4ae2('0x16')]][_0x4ae2('0x52')])[_0x4ae2('0x54')](this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]][_0x4ae2('0x55')],_0x4ae2('0x56'));this[_0x4ae2('0x7')][_0x4284b4['uniqueid']]['lastevent']=_0x4ae2('0x57');this[_0x4ae2('0x8')][_0x4ae2('0x58')]+=0x1;if(this['channels'][_0x4284b4['uniqueid']][_0x4ae2('0x2e')]){this[_0x4ae2('0x8')][_0x4ae2('0x59')]+=0x1;this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]]['holdtime']=moment(this['channels'][_0x4284b4['uniqueid']][_0x4ae2('0x2e')])['diff'](this['channels'][_0x4284b4[_0x4ae2('0x16')]]['starttime'],_0x4ae2('0x56'));this['channels'][_0x4284b4[_0x4ae2('0x16')]]['billableseconds']=moment(this[_0x4ae2('0x7')][_0x4284b4['uniqueid']][_0x4ae2('0x52')])[_0x4ae2('0x54')](this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]][_0x4ae2('0x2e')],'seconds');this['outbound'][_0x4ae2('0x5a')]+=this[_0x4ae2('0x7')][_0x4284b4['uniqueid']][_0x4ae2('0x5b')]||0x0;this[_0x4ae2('0x8')]['sumBillable']+=this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]]['billableseconds'];}this['outbound'][_0x4ae2('0x5c')]+=this[_0x4ae2('0x7')][_0x4284b4['uniqueid']][_0x4ae2('0x53')];logger[_0x4ae2('0x22')](_0x4ae2('0x5d'),_0x4284b4[_0x4ae2('0x16')],util['inspect'](this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4ae2('0x5e'),this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4284b4[_0x4ae2('0x16')],util['inspect'](this[_0x4ae2('0x7')][_0x4284b4['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4ae2('0x14')]('custom:dialend',this[_0x4ae2('0x7')][_0x4284b4['uniqueid']]);logger[_0x4ae2('0x22')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x4284b4['uniqueid'],util[_0x4ae2('0x17')](this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]],{'showHidden':![],'depth':null}));this[_0x4ae2('0x14')](_0x4ae2('0x25'),_0x4ae2('0x5f'),this[_0x4ae2('0x8')]);logger[_0x4ae2('0x1f')](_0x4ae2('0x60'),JSON[_0x4ae2('0x61')](this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]]));logger['debug'](_0x4ae2('0x62'),_0x4284b4[_0x4ae2('0x16')],util[_0x4ae2('0x17')](this[_0x4ae2('0x7')][_0x4284b4['uniqueid']],{'showHidden':![],'depth':null}));this[_0x4ae2('0x14')]('voice:outbound',_0x4ae2('0x63'),this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]]);delete this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x16')]];}else if(this[_0x4ae2('0x7')][_0x4284b4['linkedid']]){this[_0x4ae2('0x7')][_0x4284b4[_0x4ae2('0x64')]][_0x4ae2('0x16')]=this['channels'][_0x4284b4[_0x4ae2('0x64')]][_0x4ae2('0x65')];}if(this[_0x4ae2('0x4f')][_0x4284b4['uniqueid']]){delete this[_0x4ae2('0x4f')][_0x4284b4[_0x4ae2('0x16')]];}}}catch(_0x209f6c){logger['error'](_0x4ae2('0x66'),_0x4284b4[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x209f6c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4ae2('0x11')]['syncNewExten']=function(_0x390c71){try{if(this[_0x4ae2('0x12')](_0x390c71)){logger[_0x4ae2('0x22')](_0x4ae2('0x67'),_0x390c71[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x390c71,{'showHidden':![],'depth':null}));if(_0x390c71[_0x4ae2('0x68')]['toLowerCase']()==='set'){_0x390c71[_0x4ae2('0x69')]=(_0x390c71[_0x4ae2('0x6a')]||_0x390c71[_0x4ae2('0x69')])[_0x4ae2('0x6b')]();if(_[_0x4ae2('0x6c')](_0x390c71[_0x4ae2('0x69')],'cdr(')){if(_[_0x4ae2('0x13')](this[_0x4ae2('0x24')][_0x390c71[_0x4ae2('0x16')]]))this[_0x4ae2('0x24')][_0x390c71[_0x4ae2('0x16')]]={};logger[_0x4ae2('0x1f')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x390c71[_0x4ae2('0x16')],_0x390c71[_0x4ae2('0x68')],_0x390c71[_0x4ae2('0x69')]);var _0x3a84d7=_0x390c71[_0x4ae2('0x69')][_0x4ae2('0x6d')]('=');var _0x5efbe9=_0x3a84d7[0x0]['match'](/cdr\((.*)\)/);if(_0x5efbe9)this[_0x4ae2('0x24')][_0x390c71[_0x4ae2('0x16')]][_0x5efbe9[0x1]]=_0x3a84d7[0x1];}}}}catch(_0x517ecb){logger[_0x4ae2('0x28')](_0x4ae2('0x6e'),_0x390c71[_0x4ae2('0x16')],util[_0x4ae2('0x17')](_0x517ecb,{'showHidden':![],'depth':null}));}};module[_0x4ae2('0x6f')]=VoiceDialReport;
\ No newline at end of file
+var _0x7dfd=['ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','debug','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','addVariable','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','starttime','complete','total','answertime','answered','holdtime','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','appdata','applicationdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger'];(function(_0x31574c,_0x2de46b){var _0xb2b17=function(_0x3988d7){while(--_0x3988d7){_0x31574c['push'](_0x31574c['shift']());}};_0xb2b17(++_0x2de46b);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var util=require(_0xd7df('0x2'));var Redis=require(_0xd7df('0x3'));var config=require(_0xd7df('0x4'));var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var ami=require(_0xd7df('0x7'));config[_0xd7df('0x8')]=_[_0xd7df('0x9')](config[_0xd7df('0x8')],{'host':_0xd7df('0xa'),'port':0x18eb});var io=require(_0xd7df('0xb'))(new Redis(config[_0xd7df('0x8')]));function VoiceDialReport(_0x354ea7){this[_0xd7df('0xc')]=_0x354ea7[_0xd7df('0xd')];this['outbound']=_0x354ea7[_0xd7df('0xe')];this[_0xd7df('0xf')]={};this[_0xd7df('0x10')]={};ami['on'](_0xd7df('0x11'),this['syncDialBegin'][_0xd7df('0x12')](this));ami['on']('dialend',this[_0xd7df('0x13')]['bind'](this));ami['on'](_0xd7df('0x14'),this[_0xd7df('0x15')][_0xd7df('0x12')](this));ami['on'](_0xd7df('0x16'),this[_0xd7df('0x17')][_0xd7df('0x12')](this));}VoiceDialReport[_0xd7df('0x18')][_0xd7df('0x19')]=function(_0x7ba3c){return _0x7ba3c!==null&&!_[_0xd7df('0x1a')](_0x7ba3c);};VoiceDialReport[_0xd7df('0x18')][_0xd7df('0x1b')]=function(_0xe1595f,_0x196632,_0x3b2559){io['to'](_0xe1595f)[_0xd7df('0x1b')](_0x196632,_0x3b2559);};VoiceDialReport[_0xd7df('0x18')]['syncDialBegin']=function(_0x4c5cf){try{if(this[_0xd7df('0x19')](_0x4c5cf)){logger['debug'](_0xd7df('0x1c'),_0x4c5cf[_0xd7df('0x1d')],util['inspect'](_0x4c5cf,{'showHidden':![],'depth':null}));if(this[_0xd7df('0xc')][_0x4c5cf[_0xd7df('0x1d')]]){_[_0xd7df('0x1e')](this['channels'][_0x4c5cf[_0xd7df('0x1d')]],{'starttime':moment()[_0xd7df('0x1f')](_0xd7df('0x20')),'lastevent':'called','interface':_0x4c5cf[_0xd7df('0x21')][_0xd7df('0x22')](0x0,_0x4c5cf[_0xd7df('0x21')]['lastIndexOf']('-')),'membername':_0x4c5cf[_0xd7df('0x21')]['substring'](_0x4c5cf[_0xd7df('0x21')]['lastIndexOf']('/')+0x1,_0x4c5cf[_0xd7df('0x21')][_0xd7df('0x23')]('-'))},_[_0xd7df('0x24')](_0x4c5cf,['event',_0xd7df('0x25')]));logger['info'](_0xd7df('0x26'),_0x4c5cf[_0xd7df('0x1d')],this[_0xd7df('0xc')][_0x4c5cf[_0xd7df('0x1d')]][_0xd7df('0x27')],this[_0xd7df('0xc')][_0x4c5cf[_0xd7df('0x1d')]]['interface']);logger['debug'](_0xd7df('0x28'),_0x4c5cf[_0xd7df('0x1d')],util[_0xd7df('0x29')](this[_0xd7df('0xc')][_0x4c5cf[_0xd7df('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0xd7df('0xf')][_0x4c5cf[_0xd7df('0x1d')]])_[_0xd7df('0x1e')](this[_0xd7df('0xc')][_0x4c5cf['uniqueid']],this[_0xd7df('0xf')][_0x4c5cf[_0xd7df('0x1d')]]);this[_0xd7df('0x1b')](_0xd7df('0x2a'),_0xd7df('0x2b'),this[_0xd7df('0xc')][_0x4c5cf[_0xd7df('0x1d')]]);logger[_0xd7df('0x2c')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4c5cf['uniqueid'],util['inspect'](this['channels'][_0x4c5cf['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd7df('0x1b')]('custom:dialbegin',this[_0xd7df('0xc')][_0x4c5cf[_0xd7df('0x1d')]]);}}}catch(_0x503a90){logger[_0xd7df('0x2d')](_0xd7df('0x2e'),_0x4c5cf['uniqueid'],util[_0xd7df('0x29')](_0x503a90,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd7df('0x18')][_0xd7df('0x13')]=function(_0x3cf290){try{if(this[_0xd7df('0x19')](_0x3cf290)){logger[_0xd7df('0x2c')]('[%s][voiceDialReport][dialend]\x20event:',_0x3cf290[_0xd7df('0x1d')],util[_0xd7df('0x29')](_0x3cf290,{'showHidden':![],'depth':null}));if(this[_0xd7df('0xc')][_0x3cf290[_0xd7df('0x1d')]]){this[_0xd7df('0xc')][_0x3cf290[_0xd7df('0x1d')]][_0xd7df('0x2f')]=_0x3cf290[_0xd7df('0x2f')];if(_0x3cf290[_0xd7df('0x2f')]===_0xd7df('0x30')){this[_0xd7df('0xc')][_0x3cf290['uniqueid']]['connectedlinenum']=_0x3cf290[_0xd7df('0x31')];this['channels'][_0x3cf290[_0xd7df('0x1d')]][_0xd7df('0x32')]=_0x3cf290[_0xd7df('0x32')];this[_0xd7df('0xc')][_0x3cf290['uniqueid']]['answertime']=moment()['format'](_0xd7df('0x20'));this[_0xd7df('0xc')][_0x3cf290['uniqueid']][_0xd7df('0x33')]=_0xd7df('0x34');logger[_0xd7df('0x35')](_0xd7df('0x36'),_0x3cf290['uniqueid'],_0x3cf290[_0xd7df('0x21')][_0xd7df('0x22')](_0x3cf290['channel'][_0xd7df('0x23')]('/')+0x1,_0x3cf290['channel'][_0xd7df('0x23')]('-')));logger[_0xd7df('0x2c')](_0xd7df('0x37'),_0x3cf290['uniqueid'],util[_0xd7df('0x29')](this[_0xd7df('0xc')][_0x3cf290[_0xd7df('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xd7df('0x1b')]('custom:dialconnect',this[_0xd7df('0xc')][_0x3cf290[_0xd7df('0x1d')]]);}logger[_0xd7df('0x2c')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3cf290[_0xd7df('0x1d')],util[_0xd7df('0x29')](this[_0xd7df('0xc')][_0x3cf290['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd7df('0x1b')](_0xd7df('0x2a'),'voice_outbound_channel:save',this['channels'][_0x3cf290[_0xd7df('0x1d')]]);}}}catch(_0x211feb){logger[_0xd7df('0x2d')]('[%s][voiceDialReport][dialend]',_0x3cf290['uniqueid'],util[_0xd7df('0x29')](_0x211feb,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd7df('0x15')]=function(_0x561c12){try{if(this['isNotNull'](_0x561c12)){logger[_0xd7df('0x2c')]('[%s][voiceDialReport][varset]\x20event:',_0x561c12[_0xd7df('0x1d')],util[_0xd7df('0x29')](_0x561c12,{'showHidden':![],'depth':null}));this[_0xd7df('0x38')](_0x561c12[_0xd7df('0x1d')],_[_0xd7df('0x39')](_0x561c12[_0xd7df('0x3a')])[0x0],_0x561c12[_0xd7df('0x3b')]);if(this[_0xd7df('0x19')](_0x561c12[_0xd7df('0x3a')])&&this['isNotNull'](_0x561c12[_0xd7df('0x3a')]['outboundrouteid'])){if(_[_0xd7df('0x1a')](this[_0xd7df('0xc')][_0x561c12[_0xd7df('0x1d')]])){this[_0xd7df('0xc')][_0x561c12[_0xd7df('0x1d')]]={'routeId':_0x561c12[_0xd7df('0x3b')],'variables':this[_0xd7df('0x10')][_0x561c12[_0xd7df('0x1d')]],'motionChannel':_0xd7df('0x3c')};logger['info'](_0xd7df('0x3d'),_0x561c12[_0xd7df('0x1d')],_0x561c12['variable']['outboundrouteid'],_[_0xd7df('0x39')](_0x561c12[_0xd7df('0x3a')])[0x0],_0x561c12[_0xd7df('0x3b')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x561c12[_0xd7df('0x1d')],util['inspect'](this[_0xd7df('0xc')][_0x561c12[_0xd7df('0x1d')]],{'showHidden':![],'depth':null}));this[_0xd7df('0x1b')](_0xd7df('0x2a'),_0xd7df('0x2b'),this[_0xd7df('0xc')][_0x561c12[_0xd7df('0x1d')]]);}}}}catch(_0x384007){logger[_0xd7df('0x2d')](_0xd7df('0x3e'),_0x561c12[_0xd7df('0x1d')],util[_0xd7df('0x29')](_0x384007,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd7df('0x38')]=function(_0x43de77,_0x177d66,_0x3b2cb0){var _0x215251=['rtpaudioqos',_0xd7df('0x3f'),_0xd7df('0x40'),_0xd7df('0x41'),'rtpaudioqosloss',_0xd7df('0x42'),'rtpaudioqosrtt',_0xd7df('0x43'),_0xd7df('0x44'),_0xd7df('0x45'),_0xd7df('0x46'),_0xd7df('0x47'),'membercalls','memberdynamic','memberinterface',_0xd7df('0x48'),'membername',_0xd7df('0x49'),_0xd7df('0x4a')];if(!_[_0xd7df('0x4b')](_0x177d66)&&!_[_0xd7df('0x4c')](_0x215251,_0x177d66)){if(_[_0xd7df('0x1a')](this[_0xd7df('0x10')][_0x43de77])){this[_0xd7df('0x10')][_0x43de77]={};}this[_0xd7df('0x10')][_0x43de77][_0x177d66]=_0x3b2cb0;}};VoiceDialReport[_0xd7df('0x18')][_0xd7df('0x17')]=function(_0x382d11){try{if(this[_0xd7df('0x19')](_0x382d11)){logger[_0xd7df('0x2c')](_0xd7df('0x4d'),_0x382d11[_0xd7df('0x1d')],util[_0xd7df('0x29')](_0x382d11,{'showHidden':![],'depth':null}));if(this['channels'][_0x382d11[_0xd7df('0x1d')]]){logger[_0xd7df('0x35')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x382d11['uniqueid'],_0x382d11[_0xd7df('0x4e')]);this['channels'][_0x382d11[_0xd7df('0x1d')]]['endtime']=moment()[_0xd7df('0x1f')](_0xd7df('0x20'));this[_0xd7df('0xc')][_0x382d11['uniqueid']]['duration']=moment(this['channels'][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x4f')])[_0xd7df('0x50')](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x51')],'seconds');this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x33')]=_0xd7df('0x52');this[_0xd7df('0xe')][_0xd7df('0x53')]+=0x1;if(this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x54')]){this[_0xd7df('0xe')][_0xd7df('0x55')]+=0x1;this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x56')]=moment(this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x54')])[_0xd7df('0x50')](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x51')],_0xd7df('0x57'));this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x58')]=moment(this[_0xd7df('0xc')][_0x382d11['uniqueid']]['endtime'])[_0xd7df('0x50')](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]]['answertime'],_0xd7df('0x57'));this[_0xd7df('0xe')][_0xd7df('0x59')]+=this[_0xd7df('0xc')][_0x382d11['uniqueid']][_0xd7df('0x56')]||0x0;this[_0xd7df('0xe')][_0xd7df('0x5a')]+=this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x58')];}this[_0xd7df('0xe')][_0xd7df('0x5b')]+=this['channels'][_0x382d11[_0xd7df('0x1d')]][_0xd7df('0x5c')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x382d11['uniqueid'],util[_0xd7df('0x29')](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xd7df('0x1b')]('custom:voiceDialReport',this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]]);logger[_0xd7df('0x2c')](_0xd7df('0x5d'),_0x382d11[_0xd7df('0x1d')],util[_0xd7df('0x29')](this[_0xd7df('0xc')][_0x382d11['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xd7df('0x5e'),this['channels'][_0x382d11[_0xd7df('0x1d')]]);logger[_0xd7df('0x2c')](_0xd7df('0x5f'),_0x382d11['uniqueid'],util['inspect'](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]],{'showHidden':![],'depth':null}));this['emit'](_0xd7df('0x2a'),_0xd7df('0x60'),this['outbound']);logger[_0xd7df('0x35')](_0xd7df('0x61'),JSON['stringify'](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]]));logger[_0xd7df('0x2c')](_0xd7df('0x62'),_0x382d11[_0xd7df('0x1d')],util[_0xd7df('0x29')](this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]],{'showHidden':![],'depth':null}));this[_0xd7df('0x1b')]('voice:outbound','voice_outbound_channel:remove',this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]]);delete this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x1d')]];}else if(this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x63')]]){this[_0xd7df('0xc')][_0x382d11[_0xd7df('0x63')]][_0xd7df('0x1d')]=this['channels'][_0x382d11[_0xd7df('0x63')]][_0xd7df('0x64')];}if(this['variables'][_0x382d11[_0xd7df('0x1d')]]){delete this[_0xd7df('0x10')][_0x382d11[_0xd7df('0x1d')]];}}}catch(_0x45c73b){logger['error']('[%s][voiceDialReport][hangup]',_0x382d11['uniqueid'],util[_0xd7df('0x29')](_0x45c73b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd7df('0x65')]=function(_0x2b1b30){try{if(this[_0xd7df('0x19')](_0x2b1b30)){logger[_0xd7df('0x2c')](_0xd7df('0x66'),_0x2b1b30[_0xd7df('0x1d')],util['inspect'](_0x2b1b30,{'showHidden':![],'depth':null}));if(_0x2b1b30[_0xd7df('0x67')][_0xd7df('0x68')]()===_0xd7df('0x69')){_0x2b1b30['applicationdata']=(_0x2b1b30[_0xd7df('0x6a')]||_0x2b1b30[_0xd7df('0x6b')])['toLowerCase']();if(_[_0xd7df('0x6c')](_0x2b1b30[_0xd7df('0x6b')],_0xd7df('0x6d'))){if(_[_0xd7df('0x1a')](this[_0xd7df('0xf')][_0x2b1b30[_0xd7df('0x1d')]]))this[_0xd7df('0xf')][_0x2b1b30['uniqueid']]={};logger[_0xd7df('0x35')](_0xd7df('0x6e'),_0x2b1b30[_0xd7df('0x1d')],_0x2b1b30[_0xd7df('0x67')],_0x2b1b30['applicationdata']);var _0x531a07=_0x2b1b30[_0xd7df('0x6b')][_0xd7df('0x6f')]('=');var _0x33d4c6=_0x531a07[0x0][_0xd7df('0x70')](/cdr\((.*)\)/);if(_0x33d4c6)this[_0xd7df('0xf')][_0x2b1b30['uniqueid']][_0x33d4c6[0x1]]=_0x531a07[0x1];}}}}catch(_0x2329ce){logger['error']('[%s][voiceDialReport][newexten]',_0x2b1b30[_0xd7df('0x1d')],util[_0xd7df('0x29')](_0x2329ce,{'showHidden':![],'depth':null}));}};module[_0xd7df('0x71')]=VoiceDialReport;
\ No newline at end of file
index b166f53..a1ae987 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d4e=['variables','queuesummary','syncQueueSummary','bind','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','hasOwnProperty','isEmpty','originated','pTalking','unlockRR','switch','isNil','Action','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_presence:remove','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','voice_queue:save','isNotNull','loopQueueShow','clearZombieChannels','[voiceQueueReport][queues]','loopQueueSummary','isRunning','then','actionid','queuestatus','createQueueSummaryReport','queues','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','name','emitInboundVoiceQueueSummary','queue','outbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','syncQueueMember','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','push','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','queuecallerexit','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','transfertype','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','CONTINUE','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberlastcall','memberpenalty','memberrealtime','includes','length','abandoned','sumHoldTime','diff','sumDuration','milliseconds','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','COMPLETEDBYAGENT','hangup','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','cause','transferid','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncHangup','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','appdata','startsWith','CDR(routeAlias)','applicationdata','cdr(','application','split','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/voiceQueueSummary','redis','localhost','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','summary'];(function(_0x12dfa1,_0x36ff32){var _0x5db581=function(_0x3f1237){while(--_0x3f1237){_0x12dfa1['push'](_0x12dfa1['shift']());}};_0x5db581(++_0x36ff32);}(_0x5d4e,0xda));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe5d4('0x0'));var moment=require(_0xe5d4('0x1'));var util=require(_0xe5d4('0x2'));var Redis=require(_0xe5d4('0x3'));var config=require(_0xe5d4('0x4'));var logger=require(_0xe5d4('0x5'))(_0xe5d4('0x6'));var ami=require('../ami');var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0xe5d4('0x7'));config[_0xe5d4('0x8')]=_['defaults'](config[_0xe5d4('0x8')],{'host':_0xe5d4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe5d4('0xa')][_0xe5d4('0xb')]=function(_0x2a98c7){this[_0xe5d4('0xc')]=this[_0xe5d4('0xc')]?this['tail'][_0xe5d4('0xd')](_0x2a98c7):_0x2a98c7();};function VoiceQueueReport(_0x3aafe9){this['sequence']=new Sequence();this[_0xe5d4('0xe')]={};this['realtime']=_0x3aafe9;this[_0xe5d4('0xf')]=_0x3aafe9[_0xe5d4('0xf')];this[_0xe5d4('0x10')]=_0x3aafe9[_0xe5d4('0x11')];this[_0xe5d4('0x12')]=_0x3aafe9[_0xe5d4('0x12')];this[_0xe5d4('0x13')]=_0x3aafe9[_0xe5d4('0x13')];this[_0xe5d4('0x14')]=initializeSummary();this[_0xe5d4('0x15')]={};ami['on'](_0xe5d4('0x16'),this[_0xe5d4('0x17')][_0xe5d4('0x18')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xe5d4('0x18')](this));ami['on']('queuemember',this['syncQueueMember'][_0xe5d4('0x18')](this));ami['on'](_0xe5d4('0x19'),this[_0xe5d4('0x1a')][_0xe5d4('0x18')](this));ami['on'](_0xe5d4('0x1b'),this[_0xe5d4('0x1c')]['bind'](this));ami['on'](_0xe5d4('0x1d'),this['syncQueueCallerAbandon'][_0xe5d4('0x18')](this));ami['on']('queuecallerleave',this[_0xe5d4('0x1e')]['bind'](this));ami['on'](_0xe5d4('0x1f'),this[_0xe5d4('0x20')][_0xe5d4('0x18')](this));ami['on']('agentconnect',this[_0xe5d4('0x21')][_0xe5d4('0x18')](this));ami['on'](_0xe5d4('0x22'),this[_0xe5d4('0x23')][_0xe5d4('0x18')](this));ami['on']('hangup',this['syncHangup'][_0xe5d4('0x18')](this));ami['on']('fullybooted',this[_0xe5d4('0x24')][_0xe5d4('0x18')](this));ami['on'](_0xe5d4('0x25'),this[_0xe5d4('0x26')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xe5d4('0x18')](this));ami['on'](_0xe5d4('0x27'),this[_0xe5d4('0x28')]['bind'](this));ami['on'](_0xe5d4('0x29'),this[_0xe5d4('0x2a')][_0xe5d4('0x18')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0xb442b1){if(!_['isEmpty'](_0xb442b1)){for(var _0x3f0c65 in _0xb442b1){if(_0xb442b1[_0xe5d4('0x2b')](_0x3f0c65)){delete _0xb442b1[_0x3f0c65];}}}}function clearCampaigns(_0x5a561f){if(!_[_0xe5d4('0x2c')](_0x5a561f)){for(var _0x316383 in _0x5a561f){if(_0x5a561f[_0xe5d4('0x2b')](_0x316383)){_0x5a561f[_0x316383][_0xe5d4('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x58d152){if(!_['isEmpty'](_0x58d152)){for(var _0x197f0c in _0x58d152){if(_0x58d152['hasOwnProperty'](_0x197f0c)){_0x58d152[_0x197f0c]['originated']=0x0;_0x58d152[_0x197f0c]['talking']=0x0;_0x58d152[_0x197f0c][_0xe5d4('0x2e')]=0x0;_0x58d152[_0x197f0c]['waiting']=0x0;_0x58d152[_0x197f0c]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x2a5b88){if(!_[_0xe5d4('0x2c')](_0x2a5b88)){for(var _0x538055 in _0x2a5b88){if(_0x2a5b88['hasOwnProperty'](_0x538055)){_0x2a5b88[_0x538055][_0xe5d4('0x2f')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}VoiceQueueReport[_0xe5d4('0xa')]['clearZombieChannels']=function(){var _0x2c15d6=this;for(var _0x201ca8 in this['channels']){if(this[_0xe5d4('0x10')]['hasOwnProperty'](_0x201ca8)&&!this[_0xe5d4('0x10')][_0x201ca8][_0xe5d4('0x30')]){this['sequence'][_0xe5d4('0xb')](function(){if(!_[_0xe5d4('0x31')](_0x2c15d6['channels'][_0x201ca8])){return ami[_0xe5d4('0x32')]({'action':'status','channel':_0x2c15d6[_0xe5d4('0x10')][_0x201ca8]['channel']})[_0xe5d4('0x33')](function(_0x3ed9e0){if(_0x3ed9e0[_0xe5d4('0x34')]===_0xe5d4('0x35')){setTimeout(function(){if(_0x2c15d6['channels'][_0x201ca8]){delete _0x2c15d6[_0xe5d4('0x10')][_0x201ca8];logger[_0xe5d4('0x36')](_0xe5d4('0x37'),_0x201ca8,util['inspect'](_0x3ed9e0,{'showHidden':![],'depth':null}));}if(_0x2c15d6['queueReports'][_0x201ca8]){delete _0x2c15d6[_0xe5d4('0xe')][_0x201ca8];logger[_0xe5d4('0x36')](_0xe5d4('0x38'),_0x201ca8,util[_0xe5d4('0x39')](_0x3ed9e0,{'showHidden':![],'depth':null}));}if(_0x2c15d6[_0xe5d4('0x15')][_0x201ca8]){delete _0x2c15d6[_0xe5d4('0x15')][_0x201ca8];logger[_0xe5d4('0x36')](_0xe5d4('0x3a'),_0x201ca8,util[_0xe5d4('0x39')](_0x3ed9e0,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x24')]=function(){logger[_0xe5d4('0x36')](_0xe5d4('0x3b'));clearChannels(this[_0xe5d4('0x10')]);this['clearQueueReport'](this[_0xe5d4('0xe')]);clearAgentBooked(this[_0xe5d4('0xf')]);clearVoiceQueues(this[_0xe5d4('0x12')]);clearCampaigns(this[_0xe5d4('0x13')]);this[_0xe5d4('0x14')]=initializeSummary();};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x3c')]=function(_0x3800ac){var _0xee5107=this;if(!_[_0xe5d4('0x2c')](_0x3800ac)){for(var _0x16bae2 in _0x3800ac){if(_0x3800ac['hasOwnProperty'](_0x16bae2)){_0xee5107[_0xe5d4('0x3d')](_0x3800ac[_0x16bae2],_0xe5d4('0x3e'));delete _0x3800ac[_0x16bae2];}}}};VoiceQueueReport['prototype'][_0xe5d4('0x3f')]=function(_0x29cedf,_0x1c971a,_0x14e086){io['to'](_0x29cedf)[_0xe5d4('0x3f')](_0x1c971a,_0x14e086);};VoiceQueueReport['prototype'][_0xe5d4('0x40')]=function(_0xbfc891,_0x40d987){logger['debug'](_0xe5d4('0x41')+_0x40d987+_0xe5d4('0x42'),_0xbfc891['uniqueid'],util[_0xe5d4('0x39')](_0xbfc891,{'showHidden':![],'depth':null}));this['emit'](util[_0xe5d4('0x43')]('voice:queue:%s',_0xbfc891['queue']),_0xe5d4('0x44'),_0xbfc891);io[_0xe5d4('0x3f')](_0xe5d4('0x45'),_0xbfc891);};VoiceQueueReport[_0xe5d4('0xa')]['emitVoiceQueueChannelRemove']=function(_0x3d74a3,_0x47ca31){logger[_0xe5d4('0x46')](_0xe5d4('0x41')+_0x47ca31+_0xe5d4('0x47'),_0x3d74a3[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x3d74a3,{'showHidden':![],'depth':null}));if(_0x3d74a3[_0xe5d4('0x49')]===_0xe5d4('0x4a')){return;}this[_0xe5d4('0x3f')](util['format']('voice:queue:%s',_0x3d74a3['queue']),'voice_queue_channel:remove',_0x3d74a3);io['emit'](_0xe5d4('0x4b'),_0x3d74a3);};VoiceQueueReport[_0xe5d4('0xa')]['emitInboundVoiceQueueSummary']=function(_0x5845ae){if(_0x5845ae[_0xe5d4('0x4c')]===_0xe5d4('0x4d')){logger[_0xe5d4('0x46')](_0xe5d4('0x4e'),util[_0xe5d4('0x39')](_0x5845ae,{'showHidden':![],'depth':null}));this[_0xe5d4('0x3f')](util[_0xe5d4('0x43')](_0xe5d4('0x4f'),_0x5845ae['name']),_0xe5d4('0x50'),_0x5845ae);}};VoiceQueueReport['prototype'][_0xe5d4('0x51')]=function(_0xf9d2cf){return _0xf9d2cf!==null&&!_['isUndefined'](_0xf9d2cf);};VoiceQueueReport['prototype'][_0xe5d4('0x52')]=function(){var _0x1d3969=this;setInterval(function(){_0x1d3969[_0xe5d4('0x53')]();ami[_0xe5d4('0x32')]({'action':'queues'})['catch'](function(_0x2bda7d){logger[_0xe5d4('0x36')](_0xe5d4('0x54'),util[_0xe5d4('0x39')](_0x2bda7d,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x55')]=function(){var _0x36436d=this;setInterval(function(){if(!_0x36436d[_0xe5d4('0x14')][_0xe5d4('0x56')]){return ami['Action']({'action':'queuesummary'})[_0xe5d4('0x57')](function(_0x4efdbe){_0x36436d['summary']['id']=_0x4efdbe[_0xe5d4('0x58')];_0x36436d['summary'][_0xe5d4('0x56')]=!![];_0x36436d['summary'][_0xe5d4('0x59')][_0x4efdbe['actionid']]={};})['catch'](function(_0x351963){logger[_0xe5d4('0x36')]('[voiceQueueReport][queuesummary]',util[_0xe5d4('0x39')](_0x351963,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xe5d4('0x5a')]=function(_0x2b81c8,_0x320fb3){var _0x8a597a=this['summary'][_0xe5d4('0x5b')][_0x2b81c8['name']][_0xe5d4('0x5c')];var _0x167b50=new VoiceQueueSummary(_0x2b81c8);return _0x167b50[_0xe5d4('0x5d')](_0x320fb3[_0xe5d4('0xf')],this[_0xe5d4('0xf')],_0x8a597a,this[_0xe5d4('0x5e')][_0xe5d4('0x10')]);};VoiceQueueReport['prototype'][_0xe5d4('0x5f')]=function(_0x38090f,_0x1e2c95){var _0xd51bd1=this['createQueueSummaryReport'](_0x38090f,_0x1e2c95);var _0x1da068=![];_0x1da068=_0xd51bd1[_0xe5d4('0x60')](_0x38090f);if(_0x1da068){Object['assign'](_0x38090f,_0xd51bd1);this[_0xe5d4('0x5e')][_0xe5d4('0x12')][_0x38090f[_0xe5d4('0x61')]]=_0x38090f;this[_0xe5d4('0x62')](_0xd51bd1);}};VoiceQueueReport['prototype'][_0xe5d4('0x1a')]=function(_0x54cc90){var _0x27a8e3=null;var _0x4a390e=this['summary']['id'];if(this[_0xe5d4('0x14')][_0xe5d4('0x59')][_0x4a390e]){_0x27a8e3=this[_0xe5d4('0x14')]['queuestatus'][_0x4a390e][_0x54cc90[_0xe5d4('0x58')]];}if(!_0x27a8e3){this[_0xe5d4('0x14')]=initializeSummary();return;}var _0x3b00b0=this[_0xe5d4('0x12')][_0x27a8e3[_0xe5d4('0x63')]];if(_0x3b00b0[_0xe5d4('0x4c')]===_0xe5d4('0x4d')){this[_0xe5d4('0x5f')](_0x3b00b0,_0x27a8e3);}else if(_0x3b00b0[_0xe5d4('0x4c')]===_0xe5d4('0x64')){var _0x9c89c4=this['createQueueSummaryReport'](_0x3b00b0,_0x27a8e3);ami[_0xe5d4('0x3f')](_0xe5d4('0x65'),_0x9c89c4);}this[_0xe5d4('0x14')][_0xe5d4('0x66')]-=0x1;var _0xb9d3c7=this[_0xe5d4('0x14')][_0xe5d4('0x66')]>0x0?!![]:![];if(!_0xb9d3c7){return this[_0xe5d4('0x67')](this['summary'][_0xe5d4('0x68')]);}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x69')]=function(_0x2e3cc9){var _0x2a1b12=this[_0xe5d4('0x14')]['id'];if(this[_0xe5d4('0x14')]['queuestatus'][_0x2a1b12]&&this[_0xe5d4('0x14')][_0xe5d4('0x59')][_0x2a1b12][_0x2e3cc9[_0xe5d4('0x58')]]){this[_0xe5d4('0x14')]['queuestatus'][_0x2a1b12][_0x2e3cc9['actionid']][_0xe5d4('0xf')]['push'](_0x2e3cc9);}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x17')]=function(_0x5d8128){var _0x115670=this;try{if(this[_0xe5d4('0x51')](_0x5d8128)&&this[_0xe5d4('0x51')](_0x5d8128[_0xe5d4('0x63')])){logger[_0xe5d4('0x46')](_0xe5d4('0x6a'),util[_0xe5d4('0x39')](_0x5d8128,{'showHidden':![],'depth':null}));var _0x403231=this['voiceQueues'][_0x5d8128['queue']];if(_0x403231){logger['info'](_0xe5d4('0x6b'),_0x403231[_0xe5d4('0x61')]);this[_0xe5d4('0x14')]['queues'][_0x403231[_0xe5d4('0x61')]]={'summaryEvent':_0x5d8128};this['summary'][_0xe5d4('0x66')]+=0x1;return ami[_0xe5d4('0x32')]({'action':'queuestatus','queue':_0x403231[_0xe5d4('0x61')]})['then'](function(_0x28d78a){if(!_0x115670[_0xe5d4('0x14')][_0xe5d4('0x59')][_0x5d8128[_0xe5d4('0x58')]]){_0x115670['summary']['queuestatus'][_0x5d8128[_0xe5d4('0x58')]]={};}_0x115670[_0xe5d4('0x14')][_0xe5d4('0x59')][_0x5d8128[_0xe5d4('0x58')]][_0x28d78a[_0xe5d4('0x58')]]={'queue':_0x403231[_0xe5d4('0x61')],'agents':[]};})[_0xe5d4('0x33')](function(_0x2a2d86){throw _0x2a2d86;});}}}catch(_0x261557){logger[_0xe5d4('0x36')](_0xe5d4('0x6c'),util['inspect'](_0x261557,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x67')]=function(_0x424077){if(this[_0xe5d4('0x14')][_0xe5d4('0x66')]>0x0){this[_0xe5d4('0x14')][_0xe5d4('0x68')]=_0x424077;return;}logger[_0xe5d4('0x46')](_0xe5d4('0x6d'),util[_0xe5d4('0x39')](_0x424077,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xe5d4('0x3f')](_0xe5d4('0x6e'),{});};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x1c')]=function(_0x2b6107){try{if(this['isNotNull'](_0x2b6107)){logger[_0xe5d4('0x46')](_0xe5d4('0x6f'),_0x2b6107[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x2b6107,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xe5d4('0xe')][_0x2b6107[_0xe5d4('0x48')]])){this['queueReports'][_0x2b6107['uniqueid']]=[];}if(_[_0xe5d4('0x70')](this[_0xe5d4('0x10')][_0x2b6107[_0xe5d4('0x48')]])){this[_0xe5d4('0x10')][_0x2b6107[_0xe5d4('0x48')]]={};}var _0x314749=new QueueReport();_0x314749[_0xe5d4('0x63')]=_0x2b6107[_0xe5d4('0x63')];_0x314749[_0xe5d4('0x4c')]=this['voiceQueues'][_0x314749['queue']]&&this[_0xe5d4('0x12')][_0x314749[_0xe5d4('0x63')]][_0xe5d4('0x4c')]?this[_0xe5d4('0x12')][_0x314749[_0xe5d4('0x63')]][_0xe5d4('0x4c')]||'inbound':'inbound';_0x314749[_0xe5d4('0x71')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));_0x314749[_0xe5d4('0x73')]=_0x2b6107[_0xe5d4('0x73')];_0x314749[_0xe5d4('0x74')]=_0x2b6107[_0xe5d4('0x74')];_0x314749[_0xe5d4('0x48')]=_0x2b6107['uniqueid'];_0x314749[_0xe5d4('0x75')]=this[_0xe5d4('0x10')][_0x2b6107[_0xe5d4('0x48')]][_0xe5d4('0x75')];logger[_0xe5d4('0x76')](_0xe5d4('0x77'),_0x314749[_0xe5d4('0x63')],_0x314749['type']);_[_0xe5d4('0x78')](_0x314749,_['pick'](_0x2b6107,_['keys'](_0x314749)));this[_0xe5d4('0xe')][_0x2b6107['uniqueid']][_0xe5d4('0x79')](_0x314749);this[_0xe5d4('0x10')][_0x2b6107[_0xe5d4('0x48')]]=_0x314749;this[_0xe5d4('0x40')](_0x314749,_0xe5d4('0x1b'));}}catch(_0x262019){logger[_0xe5d4('0x36')](_0xe5d4('0x6f'),_0x2b6107[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x262019,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x7a')]=function(_0xc0f186){try{if(this[_0xe5d4('0x51')](_0xc0f186)){logger[_0xe5d4('0x46')](_0xe5d4('0x7b'),_0xc0f186[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0xc0f186,{'showHidden':![],'depth':null}));if(this[_0xe5d4('0xe')][_0xc0f186[_0xe5d4('0x48')]]){var _0x13c254=_[_0xe5d4('0x7c')](this['queueReports'][_0xc0f186[_0xe5d4('0x48')]]);_0x13c254[_0xe5d4('0x7d')]=![];_0x13c254[_0xe5d4('0x7e')]=null;_0x13c254[_0xe5d4('0x7f')]=_0xc0f186['holdtime'];_0x13c254[_0xe5d4('0x80')]=_0xc0f186[_0xe5d4('0x80')];_0x13c254[_0xe5d4('0x1d')]=!![];_0x13c254[_0xe5d4('0x81')]=moment()[_0xe5d4('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x13c254['queuecallerexitreason']=_0xe5d4('0x82');_0x13c254[_0xe5d4('0x83')]=null;logger['info'](_0xe5d4('0x84'),_0x13c254[_0xe5d4('0x63')],_0x13c254['type']);this['channels'][_0xc0f186['uniqueid']]=_0x13c254;this['emitVoiceQueueChannelRemove'](_0x13c254,_0xe5d4('0x1d'));}}}catch(_0x4b5321){logger['error'](_0xe5d4('0x7b'),_0xc0f186['uniqueid'],util[_0xe5d4('0x39')](_0x4b5321,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x1e')]=function(_0x3696bc){try{if(this['isNotNull'](_0x3696bc)){logger[_0xe5d4('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0x3696bc[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x3696bc,{'showHidden':![],'depth':null}));if(this[_0xe5d4('0xe')][_0x3696bc['uniqueid']]){var _0xd9e7b1=_[_0xe5d4('0x7c')](this['queueReports'][_0x3696bc['uniqueid']]);_0xd9e7b1['queuecallerleaveAt']=moment()[_0xe5d4('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0xd9e7b1[_0xe5d4('0x85')]=_0x3696bc[_0xe5d4('0x85')];_0xd9e7b1['connectedlinename']=_0x3696bc[_0xe5d4('0x86')];logger[_0xe5d4('0x76')](_0xe5d4('0x87'),_0xd9e7b1[_0xe5d4('0x63')],_0xd9e7b1[_0xe5d4('0x4c')],_0x3696bc[_0xe5d4('0x85')],_0x3696bc[_0xe5d4('0x86')]);this['channels'][_0x3696bc[_0xe5d4('0x48')]]=_0xd9e7b1;this[_0xe5d4('0x40')](_0xd9e7b1,_0xe5d4('0x88'));}}}catch(_0x50ad04){logger[_0xe5d4('0x36')](_0xe5d4('0x89'),_0x3696bc[_0xe5d4('0x48')],util['inspect'](_0x50ad04,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe5d4('0x21')]=function(_0x294d62){try{if(this[_0xe5d4('0x51')](_0x294d62)){logger[_0xe5d4('0x46')](_0xe5d4('0x8a'),_0x294d62[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x294d62,{'showHidden':![],'depth':null}));if(this[_0xe5d4('0xe')][_0x294d62[_0xe5d4('0x48')]]){var _0xf39efe=_['last'](this[_0xe5d4('0xe')][_0x294d62[_0xe5d4('0x48')]]);_0xf39efe[_0xe5d4('0x7d')]=!![];_0xf39efe['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xe5d4('0x76')](_0xe5d4('0x8b'),_0xf39efe[_0xe5d4('0x63')],_0xf39efe[_0xe5d4('0x4c')]);}}}catch(_0x23739c){logger[_0xe5d4('0x36')](_0xe5d4('0x8a'),_0x294d62['uniqueid'],util[_0xe5d4('0x39')](_0x23739c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe5d4('0x20')]=function(_0x4c1403){try{if(this['isNotNull'](_0x4c1403)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x4c1403[_0xe5d4('0x48')],util['inspect'](_0x4c1403,{'showHidden':![],'depth':null}));if(this[_0xe5d4('0xe')][_0x4c1403[_0xe5d4('0x48')]]){var _0x3656b2=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x4c1403[_0xe5d4('0x48')]]);_0x3656b2['queuecallerabandon']=![];_0x3656b2['queuecallerabandonAt']=null;_0x3656b2[_0xe5d4('0x8c')]=!![];_0x3656b2[_0xe5d4('0x83')]=_0x4c1403[_0xe5d4('0x8d')];_0x3656b2[_0xe5d4('0x7f')]=_0x4c1403[_0xe5d4('0x7f')];_0x3656b2[_0xe5d4('0x7d')]=!![];_0x3656b2[_0xe5d4('0x8e')]=![];_0x3656b2['queuecallerexitAt']=null;if(!_0x3656b2[_0xe5d4('0x8f')]){if(_0x4c1403['reason']=='transfer'){_0x3656b2[_0xe5d4('0x49')]='COMPLETED';logger[_0xe5d4('0x76')](_0xe5d4('0x90'),_0x3656b2[_0xe5d4('0x63')],_0x3656b2[_0xe5d4('0x4c')]);}else{if(_['startsWith'](_0x4c1403['channel'][_0xe5d4('0x91')](),_0xe5d4('0x92'))){if(this[_0xe5d4('0xe')][_0x4c1403[_0xe5d4('0x93')]]){var _0x5110a1=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x4c1403['linkedid']]);_0x5110a1[_0xe5d4('0x7d')]=![];_0x5110a1[_0xe5d4('0x8e')]=!![];_0x5110a1[_0xe5d4('0x94')]=moment(_0x3656b2['queuecallerjoinAt'])[_0xe5d4('0x95')](_0x4c1403[_0xe5d4('0x7f')],_0xe5d4('0x96'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5110a1[_0xe5d4('0x49')]='FORWARDTRANSFER';_0x5110a1['transfer']=!![];_0x5110a1[_0xe5d4('0x97')]='FORWARD';_0x5110a1['transferexten']=_0x4c1403[_0xe5d4('0x98')];_0x5110a1[_0xe5d4('0x99')]=_0x4c1403[_0xe5d4('0x48')];logger['info'](_0xe5d4('0x9a'),_0x5110a1[_0xe5d4('0x63')],_0x5110a1['type']);var _0x33eab1=this['queueReports'][_0x4c1403['linkedid']];this['queueReports'][_0x4c1403['linkedid']]=this[_0xe5d4('0xe')][_0x4c1403[_0xe5d4('0x48')]];this[_0xe5d4('0xe')][_0x4c1403[_0xe5d4('0x48')]]=_0x33eab1;}}else{_0x3656b2[_0xe5d4('0x49')]=_0xe5d4('0x9b')+_0x4c1403['reason']['toUpperCase']();logger[_0xe5d4('0x76')](_0xe5d4('0x9c'),_0x3656b2[_0xe5d4('0x63')],_0x3656b2[_0xe5d4('0x4c')],_0x3656b2[_0xe5d4('0x49')]);}}}this[_0xe5d4('0x10')][_0x4c1403[_0xe5d4('0x48')]]=_0x3656b2;this[_0xe5d4('0x3d')](_0x3656b2,_0xe5d4('0x1f'));}}}catch(_0x418698){logger[_0xe5d4('0x36')]('[%s][voiceQueueReport][agentcomplete]',_0x4c1403[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x418698,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe5d4('0x23')]=function(_0x3fc035){try{if(this['isNotNull'](_0x3fc035)){logger[_0xe5d4('0x46')](_0xe5d4('0x9d'),_0x3fc035[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x3fc035,{'showHidden':![],'depth':null}));this[_0xe5d4('0x9e')](_0x3fc035[_0xe5d4('0x48')],_[_0xe5d4('0x9f')](_0x3fc035[_0xe5d4('0xa0')])[0x0],_0x3fc035[_0xe5d4('0xa1')]);if(this[_0xe5d4('0xe')][_0x3fc035['uniqueid']]){var _0x3d2e1e=_['last'](this[_0xe5d4('0xe')][_0x3fc035[_0xe5d4('0x48')]]);if(_0x3d2e1e){if(this['isNotNull'](_0x3fc035[_0xe5d4('0xa0')])&&this[_0xe5d4('0x51')](_0x3fc035[_0xe5d4('0xa0')][_0xe5d4('0x59')])){switch(_0x3fc035[_0xe5d4('0xa1')]){case _0xe5d4('0xa2'):_0x3d2e1e[_0xe5d4('0x8e')]=![];_0x3d2e1e[_0xe5d4('0x94')]=null;break;case'TIMEOUT':_0x3d2e1e[_0xe5d4('0xa3')]=_0xe5d4('0xa4');_0x3d2e1e[_0xe5d4('0x8e')]=!![];_0x3d2e1e[_0xe5d4('0x94')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));_0x3d2e1e[_0xe5d4('0xa5')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));logger[_0xe5d4('0x46')](_0xe5d4('0xa6'),_0x3fc035[_0xe5d4('0x48')],util['inspect'](_0x3d2e1e,{'showHidden':![],'depth':null}));ami[_0xe5d4('0x3f')](_0xe5d4('0xa7'),_0x3d2e1e);break;default:_0x3d2e1e[_0xe5d4('0x8e')]=!![];_0x3d2e1e[_0xe5d4('0x94')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));_0x3d2e1e[_0xe5d4('0xa5')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));}_0x3d2e1e[_0xe5d4('0x1d')]=![];_0x3d2e1e['queuecallerabandonAt']=null;_0x3d2e1e[_0xe5d4('0x49')]=_0x3fc035[_0xe5d4('0xa1')];this[_0xe5d4('0x10')][_0x3fc035['uniqueid']]=_0x3d2e1e;this[_0xe5d4('0x3d')](_0x3d2e1e,_0xe5d4('0x22'));}else if(this[_0xe5d4('0x51')](_0x3fc035[_0xe5d4('0xa0')])&&this[_0xe5d4('0x51')](_0x3fc035[_0xe5d4('0xa0')]['queueposition'])){if(!_0x3d2e1e['queuecallerabandon']){_0x3d2e1e['queuecallerexit']=!![];_0x3d2e1e['queuecallerexitAt']=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));_0x3d2e1e['queuecallerexitreason']=_0xe5d4('0xa8');_0x3d2e1e[_0xe5d4('0xa5')]=moment()[_0xe5d4('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe5d4('0x10')][_0x3fc035[_0xe5d4('0x48')]]=_0x3d2e1e;}}logger[_0xe5d4('0x76')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3fc035[_0xe5d4('0x48')],_0x3d2e1e[_0xe5d4('0x63')],_0x3d2e1e[_0xe5d4('0x4c')],_[_0xe5d4('0x9f')](_0x3fc035[_0xe5d4('0xa0')])[0x0],_0x3fc035['value']);_0x3d2e1e['variables']=this[_0xe5d4('0x15')][_0x3fc035['uniqueid']];}}}}catch(_0x1875db){logger[_0xe5d4('0x36')](_0xe5d4('0x9d'),_0x3fc035['uniqueid'],util[_0xe5d4('0x39')](_0x1875db,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x9e')]=function(_0x237764,_0x2f6d8e,_0x18e1ed){var _0x499512=[_0xe5d4('0xa9'),'rtpaudioqosbridged',_0xe5d4('0xaa'),_0xe5d4('0xab'),'rtpaudioqosloss',_0xe5d4('0xac'),_0xe5d4('0xad'),_0xe5d4('0xae'),_0xe5d4('0xaf'),_0xe5d4('0xb0'),_0xe5d4('0xb1'),'bridgepvtcallid',_0xe5d4('0xb2'),'memberdynamic','memberinterface',_0xe5d4('0xb3'),'membername',_0xe5d4('0xb4'),_0xe5d4('0xb5')];if(!_[_0xe5d4('0x31')](_0x2f6d8e)&&!_[_0xe5d4('0xb6')](_0x499512,_0x2f6d8e)){if(_['isUndefined'](this['variables'][_0x237764])){this['variables'][_0x237764]={};}this[_0xe5d4('0x15')][_0x237764][_0x2f6d8e]=_0x18e1ed;}};VoiceQueueReport[_0xe5d4('0xa')]['handleHangup']=function(_0x21dc3f,_0x3a2a23,_0x3090b9){var _0x569357={};for(var _0x2ae1b5=0x0;_0x2ae1b5<this[_0xe5d4('0xe')][_0x21dc3f][_0xe5d4('0xb7')];_0x2ae1b5+=0x1){_0x569357=this[_0xe5d4('0xe')][_0x21dc3f][_0x2ae1b5];if(this['voiceQueues'][_0x569357[_0xe5d4('0x63')]]){if(_0x569357[_0xe5d4('0x8e')]&&_0x569357['transfer']!=!![]){this['voiceQueues'][_0x569357['queue']]['unmanaged']+=0x1;}if(_0x569357[_0xe5d4('0x1d')]){this[_0xe5d4('0x12')][_0x569357[_0xe5d4('0x63')]][_0xe5d4('0xb8')]+=0x1;}this[_0xe5d4('0x12')][_0x569357[_0xe5d4('0x63')]][_0xe5d4('0xb9')]+=moment(_0x569357[_0xe5d4('0xa5')])[_0xe5d4('0xba')](_0x569357['queuecallerjoinAt'],_0xe5d4('0x96'))||0x0;if(_0x2ae1b5===this[_0xe5d4('0xe')][_0x21dc3f]['length']-0x1){this[_0xe5d4('0x12')][_0x569357['queue']][_0xe5d4('0xbb')]+=moment()[_0xe5d4('0xbc')](0x0)[_0xe5d4('0xba')](_0x569357[_0xe5d4('0x71')],_0xe5d4('0x96'));this[_0xe5d4('0x12')][_0x569357['queue']]['total']+=0x1;if(_0x569357[_0xe5d4('0x7d')]){this['voiceQueues'][_0x569357['queue']][_0xe5d4('0xbd')]+=0x1;this[_0xe5d4('0x12')][_0x569357[_0xe5d4('0x63')]][_0xe5d4('0xbe')]+=moment()['milliseconds'](0x0)['diff'](_0x569357[_0xe5d4('0xa5')],_0xe5d4('0x96'));_0x569357[_0xe5d4('0x7e')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));_0x569357[_0xe5d4('0x8e')]=![];_0x569357[_0xe5d4('0x94')]=null;}if(_0x569357[_0xe5d4('0x8e')]&&_0x569357[_0xe5d4('0x8f')]!=!![]){_0x569357[_0xe5d4('0xa3')]=_0xe5d4('0xbf');logger['debug'](_0xe5d4('0xc0'),_0x21dc3f,util[_0xe5d4('0x39')](_0x569357,{'showHidden':![],'depth':null}));ami[_0xe5d4('0x3f')]('custom:queuecallerunmanaged',_0x569357);}if(_0x569357[_0xe5d4('0x1d')]){_0x569357[_0xe5d4('0xa3')]=_0xe5d4('0xb8');logger[_0xe5d4('0x46')](_0xe5d4('0xc1'),_0x21dc3f,util[_0xe5d4('0x39')](_0x569357,{'showHidden':![],'depth':null}));ami['emit']('custom:queuecallerabandon',_0x569357);}}else{this['voiceQueues'][_0x569357[_0xe5d4('0x63')]][_0xe5d4('0xbb')]+=this[_0xe5d4('0x12')][_0x569357[_0xe5d4('0x63')]][_0xe5d4('0xb9')];}logger[_0xe5d4('0x76')](_0xe5d4('0xc2'),_0x21dc3f,_0x569357[_0xe5d4('0x63')],_0x569357[_0xe5d4('0x4c')],_0x3a2a23);if(_0x3090b9&&_0x569357['queuecallerexitreason']===_0xe5d4('0x4a')){_0x569357[_0xe5d4('0x49')]=_0xe5d4('0xc3');}this['channels'][_0x21dc3f]=_0x569357;this[_0xe5d4('0x3d')](_0x569357,_0xe5d4('0xc4'));}}logger[_0xe5d4('0x46')]('[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:',_0x21dc3f,util[_0xe5d4('0x39')](this[_0xe5d4('0xe')][_0x21dc3f],{'showHidden':![],'depth':null}));ami[_0xe5d4('0x3f')](_0xe5d4('0xc5'),this[_0xe5d4('0xe')][_0x21dc3f]);if(_0x569357[_0xe5d4('0x49')]===_0xe5d4('0x4a')){return;}if(_0x569357[_0xe5d4('0x8e')]||_0x569357[_0xe5d4('0x1d')]||_0x569357[_0xe5d4('0x7d')]){delete this[_0xe5d4('0xe')][_0x21dc3f];delete this[_0xe5d4('0x10')][_0x21dc3f];if(this[_0xe5d4('0x15')][_0x21dc3f]){delete this['variables'][_0x21dc3f];}}};VoiceQueueReport[_0xe5d4('0xa')]['syncHangup']=function(_0x20c7ec){try{if(this[_0xe5d4('0x51')](_0x20c7ec)){logger[_0xe5d4('0x46')](_0xe5d4('0xc6'),_0x20c7ec[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x20c7ec,{'showHidden':![],'depth':null}));if(this[_0xe5d4('0xe')][_0x20c7ec[_0xe5d4('0x48')]]){return this[_0xe5d4('0xc7')](_0x20c7ec[_0xe5d4('0x48')],_0x20c7ec[_0xe5d4('0xc8')],![]);}if(this[_0xe5d4('0xe')][_0x20c7ec[_0xe5d4('0x93')]]){if(_0x20c7ec[_0xe5d4('0xc9')]==='21'){return;}return this[_0xe5d4('0xc7')](_0x20c7ec[_0xe5d4('0x93')],_0x20c7ec[_0xe5d4('0xc8')],!![]);}var _0x3f4b1d=Object[_0xe5d4('0x9f')](this['queueReports']);for(var _0x1c36be=0x0;_0x1c36be<_0x3f4b1d[_0xe5d4('0xb7')];_0x1c36be++){var _0x3880e2=_['last'](this[_0xe5d4('0xe')][_0x3f4b1d[_0x1c36be]]);if(_0x3880e2&&_0x3880e2[_0xe5d4('0xca')]===_0x20c7ec[_0xe5d4('0x48')]){return this[_0xe5d4('0xc7')](_0x3880e2[_0xe5d4('0x48')],_0x20c7ec[_0xe5d4('0xc8')],!![]);}}}}catch(_0x113ebd){logger[_0xe5d4('0x36')]('[%s][voiceQueueReport][hangup]',_0x20c7ec[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x113ebd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')]['syncAttendedTransfer']=function(_0x113cef){try{if(this[_0xe5d4('0x51')](_0x113cef)){logger['debug'](_0xe5d4('0xcb'),_0x113cef[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x113cef,{'showHidden':![],'depth':null}));var _0x50ac56;var _0x44017a;var _0xac3aec;if(this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xcc')]]){_0x50ac56=_[_0xe5d4('0x7c')](this['queueReports'][_0x113cef[_0xe5d4('0xcc')]]);_0x50ac56[_0xe5d4('0xcd')]=_0x113cef[_0xe5d4('0xce')];_0x50ac56[_0xe5d4('0x99')]=_0x113cef['secondtransfereruniqueid'];_0x50ac56[_0xe5d4('0x49')]=_0xe5d4('0x4a');_0x50ac56[_0xe5d4('0x8f')]=!![];_0x50ac56['transfertype']=_0xe5d4('0xcf');if(this[_0xe5d4('0xe')][_0x113cef['secondtransfereruniqueid']]){_0xac3aec=this['queueReports'][_0x113cef[_0xe5d4('0xd0')]];this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd0')]]=this['queueReports'][_0x113cef[_0xe5d4('0xcc')]];this[_0xe5d4('0xe')][_0x113cef['transfereeuniqueid']]=_0xac3aec;_0x44017a=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x113cef['transfereeuniqueid']]);_0x44017a[_0xe5d4('0x30')]=!![];}logger[_0xe5d4('0x76')](_0xe5d4('0xd1'),_0x113cef['uniqueid'],_0x50ac56[_0xe5d4('0x63')],_0x50ac56[_0xe5d4('0x4c')],_0x50ac56[_0xe5d4('0xcd')],_0x50ac56[_0xe5d4('0x99')]);}else if(this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd2')]]){_0x50ac56=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd2')]]);_0x50ac56[_0xe5d4('0xcd')]=_0x113cef['origtransfererexten'];_0x50ac56['transferuniqueid']=_0x113cef[_0xe5d4('0xd3')];_0x50ac56['queuecallerexitreason']=_0xe5d4('0x4a');_0x50ac56[_0xe5d4('0x8f')]=!![];_0x50ac56['transfertype']=_0xe5d4('0xcf');if(this['queueReports'][_0x113cef[_0xe5d4('0xd3')]]){_0xac3aec=this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd3')]];this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd3')]]=this['queueReports'][_0x113cef['transfertargetuniqueid']];this[_0xe5d4('0xe')][_0x113cef['transfertargetuniqueid']]=_0xac3aec;_0x44017a=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd2')]]);_0x44017a[_0xe5d4('0x30')]=!![];}logger[_0xe5d4('0x76')]('[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x113cef['uniqueid'],_0x50ac56[_0xe5d4('0x63')],_0x50ac56['type'],_0x50ac56[_0xe5d4('0xcd')],_0x50ac56['transferuniqueid']);}else if(this['queueReports'][_0x113cef[_0xe5d4('0xd3')]]){_0x50ac56=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x113cef['origtransfereruniqueid']]);_0x50ac56['transferexten']=_0x113cef[_0xe5d4('0xd4')];_0x50ac56['transferuniqueid']=_0x113cef[_0xe5d4('0xd3')];_0x50ac56[_0xe5d4('0x49')]=_0xe5d4('0x4a');_0x50ac56[_0xe5d4('0x8f')]=!![];_0x50ac56[_0xe5d4('0x97')]=_0xe5d4('0xcf');_0x50ac56[_0xe5d4('0x30')]=!![];_0x50ac56[_0xe5d4('0xca')]=_0x113cef['transfereeuniqueid'];}else if(this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd0')]]){_0x50ac56=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x113cef[_0xe5d4('0xd0')]]);_0x50ac56[_0xe5d4('0xcd')]=_0x113cef[_0xe5d4('0xce')];_0x50ac56['transferuniqueid']=_0x113cef['secondtransfereruniqueid'];_0x50ac56[_0xe5d4('0x49')]='ATTENDEDTRANSFER';_0x50ac56[_0xe5d4('0x8f')]=!![];_0x50ac56[_0xe5d4('0x97')]=_0xe5d4('0xcf');_0x50ac56[_0xe5d4('0x30')]=!![];_0x50ac56[_0xe5d4('0xca')]=_0x113cef[_0xe5d4('0xd2')];}}}catch(_0x34858c){logger['error'](_0xe5d4('0xcb'),_0x113cef[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x34858c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x2a')]=function(_0x106ac5){try{if(this[_0xe5d4('0x51')](_0x106ac5)){logger[_0xe5d4('0x46')](_0xe5d4('0xd5'),_0x106ac5[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x106ac5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x106ac5['transfereeuniqueid']]){var _0x21cab7=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x106ac5[_0xe5d4('0xcc')]]);_0x21cab7[_0xe5d4('0x49')]='BLINDTRANSFER';_0x21cab7[_0xe5d4('0x8f')]=!![];_0x21cab7[_0xe5d4('0x97')]=_0xe5d4('0xd6');_0x21cab7['transferexten']=_0x106ac5[_0xe5d4('0xd7')];_0x21cab7[_0xe5d4('0x99')]=_0x106ac5[_0xe5d4('0xcc')];logger[_0xe5d4('0x76')](_0xe5d4('0xd8'),_0x106ac5['uniqueid'],_0x21cab7[_0xe5d4('0x63')],_0x21cab7[_0xe5d4('0x4c')],_0x21cab7[_0xe5d4('0xcd')],_0x21cab7[_0xe5d4('0x99')]);this[_0xe5d4('0xd9')]({'event':_0xe5d4('0xda'),'uniqueid':_0x106ac5[_0xe5d4('0xcc')],'context':_0x106ac5[_0xe5d4('0xdb')],'channel':_0x106ac5[_0xe5d4('0xdc')]});}}}catch(_0x112437){logger[_0xe5d4('0x36')](_0xe5d4('0xd5'),_0x106ac5[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x112437,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0x26')]=function(_0x3a9070){try{if(this['isNotNull'](_0x3a9070)){logger['debug'](_0xe5d4('0xdd'),_0x3a9070[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x3a9070,{'showHidden':![],'depth':null}));if(this[_0xe5d4('0xe')][_0x3a9070[_0xe5d4('0x48')]]){var _0x3cb5bf=_[_0xe5d4('0x7c')](this[_0xe5d4('0xe')][_0x3a9070[_0xe5d4('0x48')]]);if(!_[_0xe5d4('0x31')](_0x3cb5bf[_0xe5d4('0xa5')])){_0x3cb5bf[_0xe5d4('0xde')]=moment()[_0xe5d4('0x43')](_0xe5d4('0x72'));logger[_0xe5d4('0x76')](_0xe5d4('0xdf'),_0x3a9070[_0xe5d4('0x48')],_0x3cb5bf[_0xe5d4('0xde')]);}}}}catch(_0x160058){logger[_0xe5d4('0x36')](_0xe5d4('0xdd'),_0x3a9070[_0xe5d4('0x48')],util['inspect'](_0x160058,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe5d4('0xe0')]=function(_0x4b6e65){try{if(this[_0xe5d4('0x51')](_0x4b6e65)){logger['debug'](_0xe5d4('0xe1'),_0x4b6e65[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x4b6e65,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4b6e65[_0xe5d4('0x48')]]){var _0x9a1a31=_[_0xe5d4('0x7c')](this['queueReports'][_0x4b6e65[_0xe5d4('0x48')]]);if(!_[_0xe5d4('0x31')](_0x9a1a31[_0xe5d4('0xde')])){_0x9a1a31[_0xe5d4('0xe2')]+=moment()[_0xe5d4('0xbc')](0x0)[_0xe5d4('0xba')](_0x9a1a31['mohstarttime'],_0xe5d4('0x96'));logger[_0xe5d4('0x76')](_0xe5d4('0xe3'),_0x4b6e65[_0xe5d4('0x48')],_0x9a1a31[_0xe5d4('0xe2')]);delete _0x9a1a31[_0xe5d4('0xde')];}}}}catch(_0x39b070){logger[_0xe5d4('0x36')](_0xe5d4('0xe1'),_0x4b6e65[_0xe5d4('0x48')],util[_0xe5d4('0x39')](_0x39b070,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5d4('0xa')][_0xe5d4('0xe4')]=function(_0x5c9e5e){try{if(this[_0xe5d4('0x51')](_0x5c9e5e)){logger['debug'](_0xe5d4('0xe5'),_0x5c9e5e['uniqueid'],util[_0xe5d4('0x39')](_0x5c9e5e,{'showHidden':![],'depth':null}));if(_0x5c9e5e['application'][_0xe5d4('0x91')]()===_0xe5d4('0xe6')){_0x5c9e5e['applicationdata']=_0x5c9e5e[_0xe5d4('0xe7')]&&_0x5c9e5e[_0xe5d4('0xe7')][_0xe5d4('0xe8')](_0xe5d4('0xe9'))?_0x5c9e5e[_0xe5d4('0xe7')]:(_0x5c9e5e['appdata']||_0x5c9e5e[_0xe5d4('0xea')])[_0xe5d4('0x91')]();if(_[_0xe5d4('0xe8')](_0x5c9e5e['applicationdata']['toLowerCase'](),_0xe5d4('0xeb'))){logger[_0xe5d4('0x76')]('[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s',_0x5c9e5e['uniqueid'],_0x5c9e5e[_0xe5d4('0xec')],_0x5c9e5e[_0xe5d4('0xea')]);if(_['isUndefined'](this[_0xe5d4('0x10')][_0x5c9e5e['uniqueid']]))this[_0xe5d4('0x10')][_0x5c9e5e[_0xe5d4('0x48')]]={};var _0x3aca98=_0x5c9e5e[_0xe5d4('0xea')][_0xe5d4('0xed')]('=');var _0x3e896e=_0x3aca98[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x3e896e)this[_0xe5d4('0x10')][_0x5c9e5e[_0xe5d4('0x48')]][_0x3e896e[0x1]]=_0x3aca98[0x1];}}}}catch(_0xd78938){logger[_0xe5d4('0x36')]('[%s][voiceQueueReport][newexten]',_0x5c9e5e['uniqueid'],util[_0xe5d4('0x39')](_0xd78938,{'showHidden':![],'depth':null}));}};module[_0xe5d4('0xee')]=VoiceQueueReport;
\ No newline at end of file
+var _0x3102=['custom:queuesummary','statusRequests','completeEvent','info','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','push','last','queuecallercompleteAt','holdtime','originalposition','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','queuecallercomplete','queuecallerabandonAt','membername','queuecallerexit','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','keys','value','variable','CONTINUE','lastevent','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','handleHangup','unmanaged','abandoned','sumHoldTime','diff','length','sumDuration','milliseconds','total','answered','sumBillable','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','COMPLETEDBYAGENT','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','cause-txt','transferid','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','seconds','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','CDR(routeAlias)','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','match','[%s][voiceQueueReport][newexten]','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','enqueue','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','emit','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','queuestatus','outbound'];(function(_0x58e141,_0x1fa6b6){var _0x162b33=function(_0x256308){while(--_0x256308){_0x58e141['push'](_0x58e141['shift']());}};_0x162b33(++_0x1fa6b6);}(_0x3102,0x83));var _0x2310=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x3102[_0x368fb9];return _0x4892fb;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x2310('0x0'));var Redis=require(_0x2310('0x1'));var config=require('../../../config/environment');var logger=require(_0x2310('0x2'))(_0x2310('0x3'));var ami=require(_0x2310('0x4'));var QueueReport=require(_0x2310('0x5'));var VoiceQueueSummary=require(_0x2310('0x6'));config[_0x2310('0x7')]=_[_0x2310('0x8')](config[_0x2310('0x7')],{'host':_0x2310('0x9'),'port':0x18eb});var io=require(_0x2310('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x2310('0xb')]['enqueue']=function(_0x4b04ab){this['tail']=this[_0x2310('0xc')]?this[_0x2310('0xc')][_0x2310('0xd')](_0x4b04ab):_0x4b04ab();};function VoiceQueueReport(_0x4ce503){this[_0x2310('0xe')]=new Sequence();this[_0x2310('0xf')]={};this[_0x2310('0x10')]=_0x4ce503;this[_0x2310('0x11')]=_0x4ce503[_0x2310('0x11')];this[_0x2310('0x12')]=_0x4ce503[_0x2310('0x13')];this['voiceQueues']=_0x4ce503[_0x2310('0x14')];this[_0x2310('0x15')]=_0x4ce503['campaigns'];this[_0x2310('0x16')]=initializeSummary();this[_0x2310('0x17')]={};ami['on']('queuesummary',this[_0x2310('0x18')][_0x2310('0x19')](this));ami['on'](_0x2310('0x1a'),this[_0x2310('0x1b')][_0x2310('0x19')](this));ami['on'](_0x2310('0x1c'),this[_0x2310('0x1d')]['bind'](this));ami['on'](_0x2310('0x1e'),this[_0x2310('0x1f')][_0x2310('0x19')](this));ami['on'](_0x2310('0x20'),this[_0x2310('0x21')][_0x2310('0x19')](this));ami['on'](_0x2310('0x22'),this[_0x2310('0x23')]['bind'](this));ami['on'](_0x2310('0x24'),this[_0x2310('0x25')][_0x2310('0x19')](this));ami['on'](_0x2310('0x26'),this[_0x2310('0x27')][_0x2310('0x19')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x2310('0x19')](this));ami['on'](_0x2310('0x28'),this[_0x2310('0x29')][_0x2310('0x19')](this));ami['on'](_0x2310('0x2a'),this[_0x2310('0x2b')][_0x2310('0x19')](this));ami['on'](_0x2310('0x2c'),this[_0x2310('0x2d')][_0x2310('0x19')](this));ami['on'](_0x2310('0x2e'),this[_0x2310('0x2f')][_0x2310('0x19')](this));ami['on'](_0x2310('0x30'),this[_0x2310('0x31')]['bind'](this));ami['on'](_0x2310('0x32'),this[_0x2310('0x33')][_0x2310('0x19')](this));ami['on'](_0x2310('0x34'),this[_0x2310('0x35')][_0x2310('0x19')](this));this[_0x2310('0x36')]();this[_0x2310('0x37')]();}function clearChannels(_0x162278){if(!_[_0x2310('0x38')](_0x162278)){for(var _0x5f4998 in _0x162278){if(_0x162278['hasOwnProperty'](_0x5f4998)){delete _0x162278[_0x5f4998];}}}}function clearCampaigns(_0x18b83c){if(!_[_0x2310('0x38')](_0x18b83c)){for(var _0x255f88 in _0x18b83c){if(_0x18b83c[_0x2310('0x39')](_0x255f88)){_0x18b83c[_0x255f88][_0x2310('0x3a')]=0x0;}}}}function clearVoiceQueues(_0x26111a){if(!_[_0x2310('0x38')](_0x26111a)){for(var _0x216d03 in _0x26111a){if(_0x26111a[_0x2310('0x39')](_0x216d03)){_0x26111a[_0x216d03][_0x2310('0x3a')]=0x0;_0x26111a[_0x216d03][_0x2310('0x3b')]=0x0;_0x26111a[_0x216d03][_0x2310('0x3c')]=0x0;_0x26111a[_0x216d03][_0x2310('0x3d')]=0x0;_0x26111a[_0x216d03][_0x2310('0x3e')]=!![];}}}}function clearAgentBooked(_0x407c62){if(!_[_0x2310('0x38')](_0x407c62)){for(var _0xb4083a in _0x407c62){if(_0x407c62['hasOwnProperty'](_0xb4083a)){_0x407c62[_0xb4083a][_0x2310('0x3f')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}VoiceQueueReport[_0x2310('0xb')][_0x2310('0x40')]=function(){var _0x37decb=this;for(var _0x1484ee in this['channels']){if(this[_0x2310('0x12')][_0x2310('0x39')](_0x1484ee)&&!this[_0x2310('0x12')][_0x1484ee][_0x2310('0x41')]){this[_0x2310('0xe')][_0x2310('0x42')](function(){if(!_[_0x2310('0x43')](_0x37decb[_0x2310('0x12')][_0x1484ee])){return ami[_0x2310('0x44')]({'action':_0x2310('0x45'),'channel':_0x37decb[_0x2310('0x12')][_0x1484ee][_0x2310('0x46')]})[_0x2310('0x47')](function(_0xdb4380){if(_0xdb4380[_0x2310('0x48')]===_0x2310('0x49')){setTimeout(function(){if(_0x37decb[_0x2310('0x12')][_0x1484ee]){delete _0x37decb[_0x2310('0x12')][_0x1484ee];logger[_0x2310('0x4a')]('[%s][voiceQueueReport][checkChannel]',_0x1484ee,util[_0x2310('0x4b')](_0xdb4380,{'showHidden':![],'depth':null}));}if(_0x37decb['queueReports'][_0x1484ee]){delete _0x37decb[_0x2310('0xf')][_0x1484ee];logger[_0x2310('0x4a')](_0x2310('0x4c'),_0x1484ee,util['inspect'](_0xdb4380,{'showHidden':![],'depth':null}));}if(_0x37decb[_0x2310('0x17')][_0x1484ee]){delete _0x37decb['variables'][_0x1484ee];logger[_0x2310('0x4a')](_0x2310('0x4d'),_0x1484ee,util[_0x2310('0x4b')](_0xdb4380,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x2310('0x2d')]=function(){logger[_0x2310('0x4a')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x2310('0x12')]);this[_0x2310('0x4e')](this[_0x2310('0xf')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x2310('0x14')]);clearCampaigns(this[_0x2310('0x15')]);this[_0x2310('0x16')]=initializeSummary();};VoiceQueueReport['prototype'][_0x2310('0x4e')]=function(_0x4f3778){var _0x79d17=this;if(!_[_0x2310('0x38')](_0x4f3778)){for(var _0x259941 in _0x4f3778){if(_0x4f3778[_0x2310('0x39')](_0x259941)){_0x79d17[_0x2310('0x4f')](_0x4f3778[_0x259941],'clearqueuereport');delete _0x4f3778[_0x259941];}}}};VoiceQueueReport[_0x2310('0xb')]['emit']=function(_0x497c9c,_0x259ccd,_0x5368e0){io['to'](_0x497c9c)['emit'](_0x259ccd,_0x5368e0);};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x50')]=function(_0x27b575,_0x34d318){logger['debug']('[%s][voiceQueueReport]['+_0x34d318+_0x2310('0x51'),_0x27b575['uniqueid'],util[_0x2310('0x4b')](_0x27b575,{'showHidden':![],'depth':null}));this[_0x2310('0x52')](util['format'](_0x2310('0x53'),_0x27b575[_0x2310('0x54')]),_0x2310('0x55'),_0x27b575);io['emit'](_0x2310('0x56'),_0x27b575);};VoiceQueueReport[_0x2310('0xb')]['emitVoiceQueueChannelRemove']=function(_0x17d4e6,_0x5499a8){logger['debug'](_0x2310('0x57')+_0x5499a8+_0x2310('0x58'),_0x17d4e6[_0x2310('0x59')],util['inspect'](_0x17d4e6,{'showHidden':![],'depth':null}));if(_0x17d4e6[_0x2310('0x5a')]===_0x2310('0x5b')){return;}this[_0x2310('0x52')](util[_0x2310('0x5c')](_0x2310('0x53'),_0x17d4e6[_0x2310('0x54')]),_0x2310('0x5d'),_0x17d4e6);io[_0x2310('0x52')](_0x2310('0x5e'),_0x17d4e6);};VoiceQueueReport['prototype'][_0x2310('0x5f')]=function(_0x307116){if(_0x307116[_0x2310('0x60')]===_0x2310('0x61')){logger[_0x2310('0x62')](_0x2310('0x63'),util['inspect'](_0x307116,{'showHidden':![],'depth':null}));this[_0x2310('0x52')](util[_0x2310('0x5c')]('voice:queue:%s',_0x307116[_0x2310('0x64')]),_0x2310('0x65'),_0x307116);}};VoiceQueueReport['prototype'][_0x2310('0x66')]=function(_0x2eaabe){return _0x2eaabe!==null&&!_[_0x2310('0x67')](_0x2eaabe);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x3ed597=this;setInterval(function(){_0x3ed597[_0x2310('0x40')]();ami['Action']({'action':_0x2310('0x68')})[_0x2310('0x47')](function(_0x38f8a9){logger[_0x2310('0x4a')](_0x2310('0x69'),util[_0x2310('0x4b')](_0x38f8a9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x2310('0xb')]['loopQueueSummary']=function(){var _0x49d2d2=this;setInterval(function(){if(!_0x49d2d2[_0x2310('0x16')][_0x2310('0x6a')]){return ami[_0x2310('0x44')]({'action':_0x2310('0x6b')})[_0x2310('0x6c')](function(_0x59771d){_0x49d2d2[_0x2310('0x16')]['id']=_0x59771d[_0x2310('0x6d')];_0x49d2d2[_0x2310('0x16')][_0x2310('0x6a')]=!![];_0x49d2d2[_0x2310('0x16')]['queuestatus'][_0x59771d[_0x2310('0x6d')]]={};})[_0x2310('0x47')](function(_0x4c081f){logger[_0x2310('0x4a')](_0x2310('0x6e'),util[_0x2310('0x4b')](_0x4c081f,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x2310('0x6f')]=function(_0x14ec54,_0x51ac0f){var _0x115178=this[_0x2310('0x16')][_0x2310('0x68')][_0x14ec54['name']][_0x2310('0x70')];var _0x80d6d=new VoiceQueueSummary(_0x14ec54);return _0x80d6d[_0x2310('0x71')](_0x51ac0f[_0x2310('0x11')],this['agents'],_0x115178,this[_0x2310('0x10')][_0x2310('0x12')]);};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x72')]=function(_0x3255c6,_0x159bc3){var _0x4eb40f=this[_0x2310('0x6f')](_0x3255c6,_0x159bc3);var _0x199604=![];_0x199604=_0x4eb40f[_0x2310('0x73')](_0x3255c6);if(_0x199604){Object[_0x2310('0x74')](_0x3255c6,_0x4eb40f);this['realtime'][_0x2310('0x14')][_0x3255c6['name']]=_0x3255c6;this[_0x2310('0x5f')](_0x4eb40f);}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x1f')]=function(_0x50f2c8){var _0x580789=null;var _0x36569d=this['summary']['id'];if(this[_0x2310('0x16')][_0x2310('0x75')][_0x36569d]){_0x580789=this[_0x2310('0x16')]['queuestatus'][_0x36569d][_0x50f2c8[_0x2310('0x6d')]];}if(!_0x580789){this[_0x2310('0x16')]=initializeSummary();return;}var _0x58bc3e=this[_0x2310('0x14')][_0x580789[_0x2310('0x54')]];if(_0x58bc3e[_0x2310('0x60')]===_0x2310('0x61')){this[_0x2310('0x72')](_0x58bc3e,_0x580789);}else if(_0x58bc3e[_0x2310('0x60')]===_0x2310('0x76')){var _0x407dce=this[_0x2310('0x6f')](_0x58bc3e,_0x580789);ami[_0x2310('0x52')](_0x2310('0x77'),_0x407dce);}this[_0x2310('0x16')][_0x2310('0x78')]-=0x1;var _0x3c9be8=this[_0x2310('0x16')][_0x2310('0x78')]>0x0?!![]:![];if(!_0x3c9be8){return this['syncQueueSummaryComplete'](this[_0x2310('0x16')][_0x2310('0x79')]);}};VoiceQueueReport['prototype'][_0x2310('0x1d')]=function(_0x49829f){var _0x1b0162=this['summary']['id'];if(this[_0x2310('0x16')]['queuestatus'][_0x1b0162]&&this[_0x2310('0x16')][_0x2310('0x75')][_0x1b0162][_0x49829f[_0x2310('0x6d')]]){this[_0x2310('0x16')][_0x2310('0x75')][_0x1b0162][_0x49829f[_0x2310('0x6d')]]['agents']['push'](_0x49829f);}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x18')]=function(_0x1aa1f9){var _0x1cc180=this;try{if(this[_0x2310('0x66')](_0x1aa1f9)&&this[_0x2310('0x66')](_0x1aa1f9['queue'])){logger[_0x2310('0x62')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x2310('0x4b')](_0x1aa1f9,{'showHidden':![],'depth':null}));var _0x7da5fa=this['voiceQueues'][_0x1aa1f9[_0x2310('0x54')]];if(_0x7da5fa){logger[_0x2310('0x7a')](_0x2310('0x7b'),_0x7da5fa[_0x2310('0x64')]);this[_0x2310('0x16')]['queues'][_0x7da5fa[_0x2310('0x64')]]={'summaryEvent':_0x1aa1f9};this[_0x2310('0x16')]['statusRequests']+=0x1;return ami[_0x2310('0x44')]({'action':'queuestatus','queue':_0x7da5fa[_0x2310('0x64')]})['then'](function(_0x14ee7a){if(!_0x1cc180[_0x2310('0x16')][_0x2310('0x75')][_0x1aa1f9['actionid']]){_0x1cc180[_0x2310('0x16')][_0x2310('0x75')][_0x1aa1f9['actionid']]={};}_0x1cc180[_0x2310('0x16')]['queuestatus'][_0x1aa1f9[_0x2310('0x6d')]][_0x14ee7a['actionid']]={'queue':_0x7da5fa[_0x2310('0x64')],'agents':[]};})['catch'](function(_0x45998a){throw _0x45998a;});}}}catch(_0x20161c){logger[_0x2310('0x4a')](_0x2310('0x6e'),util[_0x2310('0x4b')](_0x20161c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0xdab0ff){if(this[_0x2310('0x16')][_0x2310('0x78')]>0x0){this[_0x2310('0x16')][_0x2310('0x79')]=_0xdab0ff;return;}logger[_0x2310('0x62')](_0x2310('0x7c'),util['inspect'](_0xdab0ff,{'showHidden':![],'depth':null}));this[_0x2310('0x16')]=initializeSummary();ami[_0x2310('0x52')](_0x2310('0x7d'),{});};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x21')]=function(_0x562955){try{if(this[_0x2310('0x66')](_0x562955)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x562955[_0x2310('0x59')],util[_0x2310('0x4b')](_0x562955,{'showHidden':![],'depth':null}));if(_[_0x2310('0x67')](this['queueReports'][_0x562955[_0x2310('0x59')]])){this['queueReports'][_0x562955[_0x2310('0x59')]]=[];}if(_['isUndefined'](this['channels'][_0x562955[_0x2310('0x59')]])){this[_0x2310('0x12')][_0x562955[_0x2310('0x59')]]={};}var _0x2d6304=new QueueReport();_0x2d6304['queue']=_0x562955['queue'];_0x2d6304[_0x2310('0x60')]=this[_0x2310('0x14')][_0x2d6304[_0x2310('0x54')]]&&this[_0x2310('0x14')][_0x2d6304[_0x2310('0x54')]]['type']?this[_0x2310('0x14')][_0x2d6304[_0x2310('0x54')]][_0x2310('0x60')]||_0x2310('0x61'):_0x2310('0x61');_0x2d6304[_0x2310('0x7e')]=moment()['format'](_0x2310('0x7f'));_0x2d6304[_0x2310('0x80')]=_0x562955[_0x2310('0x80')];_0x2d6304['count']=_0x562955[_0x2310('0x81')];_0x2d6304[_0x2310('0x59')]=_0x562955[_0x2310('0x59')];_0x2d6304[_0x2310('0x82')]=this[_0x2310('0x12')][_0x562955['uniqueid']][_0x2310('0x82')];logger[_0x2310('0x7a')](_0x2310('0x83'),_0x2d6304[_0x2310('0x54')],_0x2d6304[_0x2310('0x60')]);_[_0x2310('0x84')](_0x2d6304,_[_0x2310('0x85')](_0x562955,_['keys'](_0x2d6304)));this[_0x2310('0xf')][_0x562955['uniqueid']][_0x2310('0x86')](_0x2d6304);this[_0x2310('0x12')][_0x562955[_0x2310('0x59')]]=_0x2d6304;this[_0x2310('0x50')](_0x2d6304,_0x2310('0x20'));}}catch(_0x16bb6b){logger[_0x2310('0x4a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x562955[_0x2310('0x59')],util[_0x2310('0x4b')](_0x16bb6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x23')]=function(_0x237df7){try{if(this[_0x2310('0x66')](_0x237df7)){logger[_0x2310('0x62')]('[%s][voiceQueueReport][queuecallerabandon]',_0x237df7[_0x2310('0x59')],util[_0x2310('0x4b')](_0x237df7,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x237df7[_0x2310('0x59')]]){var _0xdf3ae7=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x237df7[_0x2310('0x59')]]);_0xdf3ae7['queuecallercomplete']=![];_0xdf3ae7[_0x2310('0x88')]=null;_0xdf3ae7[_0x2310('0x89')]=_0x237df7['holdtime'];_0xdf3ae7[_0x2310('0x8a')]=_0x237df7[_0x2310('0x8a')];_0xdf3ae7[_0x2310('0x22')]=!![];_0xdf3ae7['queuecallerabandonAt']=moment()[_0x2310('0x5c')](_0x2310('0x7f'));_0xdf3ae7[_0x2310('0x5a')]=_0x2310('0x8b');_0xdf3ae7['lastAssignedTo']=null;logger['info'](_0x2310('0x8c'),_0xdf3ae7['queue'],_0xdf3ae7[_0x2310('0x60')]);this[_0x2310('0x12')][_0x237df7[_0x2310('0x59')]]=_0xdf3ae7;this[_0x2310('0x4f')](_0xdf3ae7,_0x2310('0x22'));}}}catch(_0x3f6640){logger[_0x2310('0x4a')](_0x2310('0x8d'),_0x237df7['uniqueid'],util[_0x2310('0x4b')](_0x3f6640,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')]['syncQueueCallerLeave']=function(_0x3c8d82){try{if(this[_0x2310('0x66')](_0x3c8d82)){logger[_0x2310('0x62')](_0x2310('0x8e'),_0x3c8d82['uniqueid'],util[_0x2310('0x4b')](_0x3c8d82,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x3c8d82[_0x2310('0x59')]]){var _0x38ecfc=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x3c8d82['uniqueid']]);_0x38ecfc['queuecallerleaveAt']=moment()['format'](_0x2310('0x7f'));_0x38ecfc['connectedlinenum']=_0x3c8d82[_0x2310('0x8f')];_0x38ecfc[_0x2310('0x90')]=_0x3c8d82[_0x2310('0x90')];logger[_0x2310('0x7a')](_0x2310('0x91'),_0x38ecfc[_0x2310('0x54')],_0x38ecfc['type'],_0x3c8d82[_0x2310('0x8f')],_0x3c8d82['connectedlinename']);this[_0x2310('0x12')][_0x3c8d82[_0x2310('0x59')]]=_0x38ecfc;this[_0x2310('0x50')](_0x38ecfc,_0x2310('0x24'));}}}catch(_0x5f41f8){logger['error'](_0x2310('0x8e'),_0x3c8d82[_0x2310('0x59')],util[_0x2310('0x4b')](_0x5f41f8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x92')]=function(_0x486507){try{if(this[_0x2310('0x66')](_0x486507)){logger[_0x2310('0x62')]('[%s][voiceQueueReport][agentconnect]',_0x486507[_0x2310('0x59')],util[_0x2310('0x4b')](_0x486507,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x486507[_0x2310('0x59')]]){var _0x5773d0=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x486507[_0x2310('0x59')]]);_0x5773d0[_0x2310('0x93')]=!![];_0x5773d0[_0x2310('0x5a')]='COMPLETEDBYAGENT';logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5773d0[_0x2310('0x54')],_0x5773d0[_0x2310('0x60')]);}}}catch(_0x1873b1){logger[_0x2310('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x486507['uniqueid'],util['inspect'](_0x1873b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2310('0x27')]=function(_0x292a89){try{if(this[_0x2310('0x66')](_0x292a89)){logger[_0x2310('0x62')]('[%s][voiceQueueReport][agentcomplete]',_0x292a89['uniqueid'],util[_0x2310('0x4b')](_0x292a89,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x292a89[_0x2310('0x59')]]){var _0x3d32f9=_['last'](this[_0x2310('0xf')][_0x292a89[_0x2310('0x59')]]);_0x3d32f9['queuecallerabandon']=![];_0x3d32f9[_0x2310('0x94')]=null;_0x3d32f9['assigned']=!![];_0x3d32f9['lastAssignedTo']=_0x292a89[_0x2310('0x95')];_0x3d32f9[_0x2310('0x89')]=_0x292a89[_0x2310('0x89')];_0x3d32f9[_0x2310('0x93')]=!![];_0x3d32f9[_0x2310('0x96')]=![];_0x3d32f9[_0x2310('0x97')]=null;if(!_0x3d32f9[_0x2310('0x98')]){if(_0x292a89[_0x2310('0x99')]==_0x2310('0x98')){_0x3d32f9['queuecallerexitreason']='COMPLETED';logger[_0x2310('0x7a')](_0x2310('0x9a'),_0x3d32f9['queue'],_0x3d32f9['type']);}else{if(_[_0x2310('0x9b')](_0x292a89[_0x2310('0x46')]['toLowerCase'](),_0x2310('0x9c'))){if(this[_0x2310('0xf')][_0x292a89[_0x2310('0x9d')]]){var _0x4d918c=_['last'](this['queueReports'][_0x292a89[_0x2310('0x9d')]]);_0x4d918c[_0x2310('0x93')]=![];_0x4d918c[_0x2310('0x96')]=!![];_0x4d918c[_0x2310('0x97')]=moment(_0x3d32f9[_0x2310('0x7e')])[_0x2310('0x9e')](_0x292a89[_0x2310('0x89')],'seconds')['format'](_0x2310('0x7f'));_0x4d918c[_0x2310('0x5a')]=_0x2310('0x9f');_0x4d918c[_0x2310('0x98')]=!![];_0x4d918c[_0x2310('0xa0')]=_0x2310('0xa1');_0x4d918c[_0x2310('0xa2')]=_0x292a89[_0x2310('0xa3')];_0x4d918c[_0x2310('0xa4')]=_0x292a89[_0x2310('0x59')];logger[_0x2310('0x7a')](_0x2310('0xa5'),_0x4d918c[_0x2310('0x54')],_0x4d918c[_0x2310('0x60')]);var _0x2ffae6=this[_0x2310('0xf')][_0x292a89[_0x2310('0x9d')]];this[_0x2310('0xf')][_0x292a89[_0x2310('0x9d')]]=this[_0x2310('0xf')][_0x292a89[_0x2310('0x59')]];this[_0x2310('0xf')][_0x292a89['uniqueid']]=_0x2ffae6;}}else{_0x3d32f9[_0x2310('0x5a')]=_0x2310('0xa6')+_0x292a89[_0x2310('0x99')][_0x2310('0xa7')]();logger[_0x2310('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3d32f9[_0x2310('0x54')],_0x3d32f9[_0x2310('0x60')],_0x3d32f9[_0x2310('0x5a')]);}}}this[_0x2310('0x12')][_0x292a89[_0x2310('0x59')]]=_0x3d32f9;this['emitVoiceQueueChannelRemove'](_0x3d32f9,'agentcomplete');}}}catch(_0x388fee){logger[_0x2310('0x4a')](_0x2310('0xa8'),_0x292a89[_0x2310('0x59')],util['inspect'](_0x388fee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x29')]=function(_0x9c57b1){try{if(this[_0x2310('0x66')](_0x9c57b1)){logger[_0x2310('0x62')](_0x2310('0xa9'),_0x9c57b1['uniqueid'],util['inspect'](_0x9c57b1,{'showHidden':![],'depth':null}));this[_0x2310('0xaa')](_0x9c57b1['uniqueid'],_[_0x2310('0xab')](_0x9c57b1['variable'])[0x0],_0x9c57b1[_0x2310('0xac')]);if(this[_0x2310('0xf')][_0x9c57b1[_0x2310('0x59')]]){var _0x2d26dc=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x9c57b1[_0x2310('0x59')]]);if(_0x2d26dc){if(this[_0x2310('0x66')](_0x9c57b1[_0x2310('0xad')])&&this[_0x2310('0x66')](_0x9c57b1[_0x2310('0xad')][_0x2310('0x75')])){switch(_0x9c57b1['value']){case _0x2310('0xae'):_0x2d26dc[_0x2310('0x96')]=![];_0x2d26dc[_0x2310('0x97')]=null;break;case'TIMEOUT':_0x2d26dc[_0x2310('0xaf')]='timeout';_0x2d26dc['queuecallerexit']=!![];_0x2d26dc[_0x2310('0x97')]=moment()[_0x2310('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d26dc[_0x2310('0xb0')]=moment()[_0x2310('0x5c')](_0x2310('0x7f'));logger[_0x2310('0x62')](_0x2310('0xb1'),_0x9c57b1['uniqueid'],util['inspect'](_0x2d26dc,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x2d26dc);break;default:_0x2d26dc['queuecallerexit']=!![];_0x2d26dc['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d26dc[_0x2310('0xb0')]=moment()[_0x2310('0x5c')](_0x2310('0x7f'));}_0x2d26dc[_0x2310('0x22')]=![];_0x2d26dc[_0x2310('0x94')]=null;_0x2d26dc[_0x2310('0x5a')]=_0x9c57b1[_0x2310('0xac')];this[_0x2310('0x12')][_0x9c57b1[_0x2310('0x59')]]=_0x2d26dc;this[_0x2310('0x4f')](_0x2d26dc,'varset');}else if(this[_0x2310('0x66')](_0x9c57b1[_0x2310('0xad')])&&this[_0x2310('0x66')](_0x9c57b1[_0x2310('0xad')][_0x2310('0xb2')])){if(!_0x2d26dc[_0x2310('0x22')]){_0x2d26dc[_0x2310('0x96')]=!![];_0x2d26dc['queuecallerexitAt']=moment()[_0x2310('0x5c')](_0x2310('0x7f'));_0x2d26dc[_0x2310('0x5a')]='EXITWITHKEY';_0x2d26dc[_0x2310('0xb0')]=moment()[_0x2310('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2310('0x12')][_0x9c57b1[_0x2310('0x59')]]=_0x2d26dc;}}logger[_0x2310('0x7a')](_0x2310('0xb3'),_0x9c57b1[_0x2310('0x59')],_0x2d26dc[_0x2310('0x54')],_0x2d26dc[_0x2310('0x60')],_[_0x2310('0xab')](_0x9c57b1['variable'])[0x0],_0x9c57b1['value']);_0x2d26dc['variables']=this[_0x2310('0x17')][_0x9c57b1[_0x2310('0x59')]];}}}}catch(_0x4c7498){logger[_0x2310('0x4a')]('[%s][voiceQueueReport][varset]',_0x9c57b1[_0x2310('0x59')],util[_0x2310('0x4b')](_0x4c7498,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0xaa')]=function(_0x2b28bb,_0x241b0f,_0x1a276c){var _0x16028c=[_0x2310('0xb4'),_0x2310('0xb5'),_0x2310('0xb6'),_0x2310('0xb7'),'rtpaudioqosloss',_0x2310('0xb8'),_0x2310('0xb9'),'rtpaudioqosrttbridged',_0x2310('0xba'),_0x2310('0xbb'),_0x2310('0xbc'),'bridgepvtcallid',_0x2310('0xbd'),_0x2310('0xbe'),_0x2310('0xbf'),'memberlastcall','membername',_0x2310('0xc0'),_0x2310('0xc1')];if(!_[_0x2310('0x43')](_0x241b0f)&&!_[_0x2310('0xc2')](_0x16028c,_0x241b0f)){if(_[_0x2310('0x67')](this[_0x2310('0x17')][_0x2b28bb])){this[_0x2310('0x17')][_0x2b28bb]={};}this[_0x2310('0x17')][_0x2b28bb][_0x241b0f]=_0x1a276c;}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0xc3')]=function(_0x2e905f,_0x22d643,_0x1ee5f8){var _0x2480f9={};for(var _0x38267d=0x0;_0x38267d<this['queueReports'][_0x2e905f]['length'];_0x38267d+=0x1){_0x2480f9=this[_0x2310('0xf')][_0x2e905f][_0x38267d];if(this[_0x2310('0x14')][_0x2480f9['queue']]){if(_0x2480f9[_0x2310('0x96')]&&_0x2480f9[_0x2310('0x98')]!=!![]){this['voiceQueues'][_0x2480f9[_0x2310('0x54')]][_0x2310('0xc4')]+=0x1;}if(_0x2480f9[_0x2310('0x22')]){this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xc5')]+=0x1;}this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xc6')]+=moment(_0x2480f9['queuecallerleaveAt'])[_0x2310('0xc7')](_0x2480f9[_0x2310('0x7e')],'seconds')||0x0;if(_0x38267d===this[_0x2310('0xf')][_0x2e905f][_0x2310('0xc8')]-0x1){this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xc9')]+=moment()[_0x2310('0xca')](0x0)[_0x2310('0xc7')](_0x2480f9[_0x2310('0x7e')],'seconds');this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xcb')]+=0x1;if(_0x2480f9[_0x2310('0x93')]){this[_0x2310('0x14')][_0x2480f9['queue']][_0x2310('0xcc')]+=0x1;this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xcd')]+=moment()[_0x2310('0xca')](0x0)[_0x2310('0xc7')](_0x2480f9[_0x2310('0xb0')],'seconds');_0x2480f9[_0x2310('0x88')]=moment()[_0x2310('0x5c')](_0x2310('0x7f'));_0x2480f9[_0x2310('0x96')]=![];_0x2480f9[_0x2310('0x97')]=null;}if(_0x2480f9[_0x2310('0x96')]&&_0x2480f9[_0x2310('0x98')]!=!![]){_0x2480f9[_0x2310('0xaf')]='unmanaged';logger[_0x2310('0x62')](_0x2310('0xce'),_0x2e905f,util[_0x2310('0x4b')](_0x2480f9,{'showHidden':![],'depth':null}));ami[_0x2310('0x52')](_0x2310('0xcf'),_0x2480f9);}if(_0x2480f9['queuecallerabandon']){_0x2480f9[_0x2310('0xaf')]='abandoned';logger[_0x2310('0x62')](_0x2310('0xd0'),_0x2e905f,util['inspect'](_0x2480f9,{'showHidden':![],'depth':null}));ami[_0x2310('0x52')](_0x2310('0xd1'),_0x2480f9);}}else{this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xc9')]+=this[_0x2310('0x14')][_0x2480f9[_0x2310('0x54')]][_0x2310('0xc6')];}logger['info'](_0x2310('0xd2'),_0x2e905f,_0x2480f9['queue'],_0x2480f9['type'],_0x22d643);if(_0x1ee5f8&&_0x2480f9[_0x2310('0x5a')]===_0x2310('0x5b')){_0x2480f9[_0x2310('0x5a')]=_0x2310('0xd3');}this['channels'][_0x2e905f]=_0x2480f9;this['emitVoiceQueueChannelRemove'](_0x2480f9,_0x2310('0x2a'));}}logger['debug'](_0x2310('0xd4'),_0x2e905f,util[_0x2310('0x4b')](this['queueReports'][_0x2e905f],{'showHidden':![],'depth':null}));ami[_0x2310('0x52')](_0x2310('0xd5'),this['queueReports'][_0x2e905f]);if(_0x2480f9[_0x2310('0x5a')]==='ATTENDEDTRANSFER'){return;}if(_0x2480f9[_0x2310('0x96')]||_0x2480f9[_0x2310('0x22')]||_0x2480f9[_0x2310('0x93')]){delete this[_0x2310('0xf')][_0x2e905f];delete this[_0x2310('0x12')][_0x2e905f];if(this['variables'][_0x2e905f]){delete this[_0x2310('0x17')][_0x2e905f];}}};VoiceQueueReport['prototype'][_0x2310('0x2b')]=function(_0x5132c7){try{if(this[_0x2310('0x66')](_0x5132c7)){logger[_0x2310('0x62')]('[%s][voiceQueueReport][hangup]',_0x5132c7[_0x2310('0x59')],util[_0x2310('0x4b')](_0x5132c7,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x5132c7[_0x2310('0x59')]]){return this[_0x2310('0xc3')](_0x5132c7[_0x2310('0x59')],_0x5132c7[_0x2310('0xd6')],![]);}if(this[_0x2310('0xf')][_0x5132c7[_0x2310('0x9d')]]){if(_0x5132c7['cause']==='21'){return;}return this[_0x2310('0xc3')](_0x5132c7[_0x2310('0x9d')],_0x5132c7[_0x2310('0xd6')],!![]);}var _0x2d784b=Object['keys'](this['queueReports']);for(var _0x517941=0x0;_0x517941<_0x2d784b[_0x2310('0xc8')];_0x517941++){var _0x3b4ab5=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x2d784b[_0x517941]]);if(_0x3b4ab5&&_0x3b4ab5[_0x2310('0xd7')]===_0x5132c7[_0x2310('0x59')]){return this[_0x2310('0xc3')](_0x3b4ab5['uniqueid'],_0x5132c7[_0x2310('0xd6')],!![]);}}}}catch(_0xfb898d){logger[_0x2310('0x4a')](_0x2310('0xd8'),_0x5132c7['uniqueid'],util['inspect'](_0xfb898d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0x33')]=function(_0x5726a4){try{if(this[_0x2310('0x66')](_0x5726a4)){logger[_0x2310('0x62')](_0x2310('0xd9'),_0x5726a4['uniqueid'],util[_0x2310('0x4b')](_0x5726a4,{'showHidden':![],'depth':null}));var _0x1f979a;var _0x18c9db;var _0x566df8;if(this[_0x2310('0xf')][_0x5726a4['transfereeuniqueid']]){_0x1f979a=_['last'](this[_0x2310('0xf')][_0x5726a4[_0x2310('0xda')]]);_0x1f979a['transferexten']=_0x5726a4['secondtransfererexten'];_0x1f979a[_0x2310('0xa4')]=_0x5726a4[_0x2310('0xdb')];_0x1f979a[_0x2310('0x5a')]=_0x2310('0x5b');_0x1f979a[_0x2310('0x98')]=!![];_0x1f979a[_0x2310('0xa0')]='ATTENDED';if(this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdb')]]){_0x566df8=this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdb')]];this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdb')]]=this['queueReports'][_0x5726a4[_0x2310('0xda')]];this[_0x2310('0xf')][_0x5726a4[_0x2310('0xda')]]=_0x566df8;_0x18c9db=_['last'](this[_0x2310('0xf')][_0x5726a4[_0x2310('0xda')]]);_0x18c9db[_0x2310('0x41')]=!![];}logger[_0x2310('0x7a')](_0x2310('0xdc'),_0x5726a4[_0x2310('0x59')],_0x1f979a['queue'],_0x1f979a[_0x2310('0x60')],_0x1f979a['transferexten'],_0x1f979a[_0x2310('0xa4')]);}else if(this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdd')]]){_0x1f979a=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdd')]]);_0x1f979a['transferexten']=_0x5726a4[_0x2310('0xde')];_0x1f979a[_0x2310('0xa4')]=_0x5726a4[_0x2310('0xdf')];_0x1f979a['queuecallerexitreason']=_0x2310('0x5b');_0x1f979a[_0x2310('0x98')]=!![];_0x1f979a[_0x2310('0xa0')]=_0x2310('0xe0');if(this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdf')]]){_0x566df8=this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdf')]];this[_0x2310('0xf')][_0x5726a4['origtransfereruniqueid']]=this[_0x2310('0xf')][_0x5726a4['transfertargetuniqueid']];this['queueReports'][_0x5726a4[_0x2310('0xdd')]]=_0x566df8;_0x18c9db=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x5726a4['transfertargetuniqueid']]);_0x18c9db['switch']=!![];}logger[_0x2310('0x7a')](_0x2310('0xdc'),_0x5726a4['uniqueid'],_0x1f979a[_0x2310('0x54')],_0x1f979a[_0x2310('0x60')],_0x1f979a[_0x2310('0xa2')],_0x1f979a[_0x2310('0xa4')]);}else if(this[_0x2310('0xf')][_0x5726a4['origtransfereruniqueid']]){_0x1f979a=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x5726a4['origtransfereruniqueid']]);_0x1f979a[_0x2310('0xa2')]=_0x5726a4[_0x2310('0xde')];_0x1f979a['transferuniqueid']=_0x5726a4[_0x2310('0xdf')];_0x1f979a[_0x2310('0x5a')]=_0x2310('0x5b');_0x1f979a[_0x2310('0x98')]=!![];_0x1f979a[_0x2310('0xa0')]=_0x2310('0xe0');_0x1f979a['switch']=!![];_0x1f979a[_0x2310('0xd7')]=_0x5726a4[_0x2310('0xda')];}else if(this[_0x2310('0xf')][_0x5726a4['secondtransfereruniqueid']]){_0x1f979a=_['last'](this[_0x2310('0xf')][_0x5726a4[_0x2310('0xdb')]]);_0x1f979a[_0x2310('0xa2')]=_0x5726a4['secondtransfererexten'];_0x1f979a[_0x2310('0xa4')]=_0x5726a4[_0x2310('0xdb')];_0x1f979a['queuecallerexitreason']=_0x2310('0x5b');_0x1f979a[_0x2310('0x98')]=!![];_0x1f979a[_0x2310('0xa0')]='ATTENDED';_0x1f979a[_0x2310('0x41')]=!![];_0x1f979a[_0x2310('0xd7')]=_0x5726a4[_0x2310('0xdd')];}}}catch(_0x15117a){logger['error'](_0x2310('0xd9'),_0x5726a4[_0x2310('0x59')],util[_0x2310('0x4b')](_0x15117a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')]['syncBlindTransfer']=function(_0xcd9deb){try{if(this[_0x2310('0x66')](_0xcd9deb)){logger[_0x2310('0x62')](_0x2310('0xe1'),_0xcd9deb[_0x2310('0x59')],util[_0x2310('0x4b')](_0xcd9deb,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0xcd9deb[_0x2310('0xda')]]){var _0x33d656=_[_0x2310('0x87')](this['queueReports'][_0xcd9deb[_0x2310('0xda')]]);_0x33d656['queuecallerexitreason']=_0x2310('0xe2');_0x33d656[_0x2310('0x98')]=!![];_0x33d656['transfertype']=_0x2310('0xe3');_0x33d656[_0x2310('0xa2')]=_0xcd9deb[_0x2310('0xe4')];_0x33d656['transferuniqueid']=_0xcd9deb[_0x2310('0xda')];logger['info'](_0x2310('0xe5'),_0xcd9deb[_0x2310('0x59')],_0x33d656[_0x2310('0x54')],_0x33d656['type'],_0x33d656['transferexten'],_0x33d656[_0x2310('0xa4')]);this[_0x2310('0x2b')]({'event':_0x2310('0xe6'),'uniqueid':_0xcd9deb['transfereeuniqueid'],'context':_0xcd9deb['context'],'channel':_0xcd9deb[_0x2310('0xe7')]});}}}catch(_0x29526a){logger[_0x2310('0x4a')]('[%s][voiceQueueReport][blindtransfer]',_0xcd9deb['uniqueid'],util['inspect'](_0x29526a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncMusicOnHoldStart']=function(_0x5e76a7){try{if(this[_0x2310('0x66')](_0x5e76a7)){logger[_0x2310('0x62')](_0x2310('0xe8'),_0x5e76a7['uniqueid'],util[_0x2310('0x4b')](_0x5e76a7,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x5e76a7[_0x2310('0x59')]]){var _0x28b565=_[_0x2310('0x87')](this[_0x2310('0xf')][_0x5e76a7[_0x2310('0x59')]]);if(!_[_0x2310('0x43')](_0x28b565[_0x2310('0xb0')])){_0x28b565[_0x2310('0xe9')]=moment()[_0x2310('0x5c')](_0x2310('0x7f'));logger[_0x2310('0x7a')](_0x2310('0xea'),_0x5e76a7[_0x2310('0x59')],_0x28b565['mohstarttime']);}}}}catch(_0xe184f6){logger[_0x2310('0x4a')](_0x2310('0xe8'),_0x5e76a7[_0x2310('0x59')],util[_0x2310('0x4b')](_0xe184f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2310('0x31')]=function(_0x1ac411){try{if(this[_0x2310('0x66')](_0x1ac411)){logger['debug'](_0x2310('0xeb'),_0x1ac411['uniqueid'],util[_0x2310('0x4b')](_0x1ac411,{'showHidden':![],'depth':null}));if(this[_0x2310('0xf')][_0x1ac411[_0x2310('0x59')]]){var _0x109b1d=_[_0x2310('0x87')](this['queueReports'][_0x1ac411[_0x2310('0x59')]]);if(!_['isNil'](_0x109b1d[_0x2310('0xe9')])){_0x109b1d[_0x2310('0xec')]+=moment()[_0x2310('0xca')](0x0)[_0x2310('0xc7')](_0x109b1d[_0x2310('0xe9')],_0x2310('0xed'));logger[_0x2310('0x7a')](_0x2310('0xee'),_0x1ac411['uniqueid'],_0x109b1d['mohtime']);delete _0x109b1d['mohstarttime'];}}}}catch(_0x3bca66){logger['error'](_0x2310('0xeb'),_0x1ac411['uniqueid'],util[_0x2310('0x4b')](_0x3bca66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2310('0xb')][_0x2310('0xef')]=function(_0x1ddd9c){try{if(this['isNotNull'](_0x1ddd9c)){logger[_0x2310('0x62')](_0x2310('0xf0'),_0x1ddd9c['uniqueid'],util[_0x2310('0x4b')](_0x1ddd9c,{'showHidden':![],'depth':null}));if(_0x1ddd9c['application'][_0x2310('0xf1')]()===_0x2310('0xf2')){_0x1ddd9c[_0x2310('0xf3')]=_0x1ddd9c[_0x2310('0xf4')]&&_0x1ddd9c[_0x2310('0xf4')]['startsWith'](_0x2310('0xf5'))?_0x1ddd9c['appdata']:(_0x1ddd9c[_0x2310('0xf4')]||_0x1ddd9c[_0x2310('0xf3')])[_0x2310('0xf1')]();if(_['startsWith'](_0x1ddd9c[_0x2310('0xf3')]['toLowerCase'](),'cdr(')){logger[_0x2310('0x7a')](_0x2310('0xf6'),_0x1ddd9c[_0x2310('0x59')],_0x1ddd9c[_0x2310('0xf7')],_0x1ddd9c[_0x2310('0xf3')]);if(_[_0x2310('0x67')](this[_0x2310('0x12')][_0x1ddd9c[_0x2310('0x59')]]))this['channels'][_0x1ddd9c[_0x2310('0x59')]]={};var _0x5adbc9=_0x1ddd9c[_0x2310('0xf3')]['split']('=');var _0x27e143=_0x5adbc9[0x0][_0x2310('0xf1')]()[_0x2310('0xf8')](/cdr\((.*)\)/);if(_0x27e143)this['channels'][_0x1ddd9c[_0x2310('0x59')]][_0x27e143[0x1]]=_0x5adbc9[0x1];}}}}catch(_0x24849b){logger[_0x2310('0x4a')](_0x2310('0xf9'),_0x1ddd9c['uniqueid'],util[_0x2310('0x4b')](_0x24849b,{'showHidden':![],'depth':null}));}};module['exports']=VoiceQueueReport;
\ No newline at end of file
index d608bf4..67d36b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5980=['campaign','queue','Request','CreateReportAgentPreview','../client','createHistory'];(function(_0x3111e5,_0x42f028){var _0x7df4d8=function(_0x365792){while(--_0x365792){_0x3111e5['push'](_0x3111e5['shift']());}};_0x7df4d8(++_0x42f028);}(_0x5980,0xbe));var _0x0598=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x5980[_0x671369];return _0x33f2b4;};'use strict';var client=require(_0x0598('0x0'));exports[_0x0598('0x1')]=function(_0x3de927){return function(){_0x3de927[_0x0598('0x2')]=_0x3de927[_0x0598('0x3')];return client[_0x0598('0x4')](_0x0598('0x5'),{'body':_0x3de927,'log':'CreateReportAgentPreview'});};};
\ No newline at end of file
+var _0x4a2e=['campaign','queue','CreateReportAgentPreview','../client','createHistory'];(function(_0x26d2f7,_0x543191){var _0x15de1f=function(_0x829c8d){while(--_0x829c8d){_0x26d2f7['push'](_0x26d2f7['shift']());}};_0x15de1f(++_0x543191);}(_0x4a2e,0x120));var _0xe4a2=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x4a2e[_0x387777];return _0x3f84c0;};'use strict';var client=require(_0xe4a2('0x0'));exports[_0xe4a2('0x1')]=function(_0xfb1815){return function(){_0xfb1815[_0xe4a2('0x2')]=_0xfb1815[_0xe4a2('0x3')];return client['Request'](_0xe4a2('0x4'),{'body':_0xfb1815,'log':_0xe4a2('0x4')});};};
\ No newline at end of file
index f17ea68..9b57cc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5418=['create','Request','CreateAttachment','../client'];(function(_0x59b874,_0x574c32){var _0x2e6579=function(_0x2ae54f){while(--_0x2ae54f){_0x59b874['push'](_0x59b874['shift']());}};_0x2e6579(++_0x574c32);}(_0x5418,0xc7));var _0x8541=function(_0x343f69,_0x2c3fb8){_0x343f69=_0x343f69-0x0;var _0x22c575=_0x5418[_0x343f69];return _0x22c575;};'use strict';var client=require(_0x8541('0x0'));exports[_0x8541('0x1')]=function(_0x3c7034){return client[_0x8541('0x2')](_0x8541('0x3'),{'body':_0x3c7034,'log':'CreateAttachment'});};
\ No newline at end of file
+var _0xb3f6=['../client','create','Request','CreateAttachment'];(function(_0x29e07b,_0x5c30d4){var _0x4e1721=function(_0x55fa75){while(--_0x55fa75){_0x29e07b['push'](_0x29e07b['shift']());}};_0x4e1721(++_0x5c30d4);}(_0xb3f6,0x198));var _0x6b3f=function(_0x3a3f69,_0x3c5f8a){_0x3a3f69=_0x3a3f69-0x0;var _0x41c6a3=_0xb3f6[_0x3a3f69];return _0x41c6a3;};'use strict';var client=require(_0x6b3f('0x0'));exports[_0x6b3f('0x1')]=function(_0x46d88c){return client[_0x6b3f('0x2')](_0x6b3f('0x3'),{'body':_0x46d88c,'log':_0x6b3f('0x3')});};
\ No newline at end of file
index bc882ce..8f1147d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x2ef3,0xba));var _0x32ef=function(_0x69d270,_0x91ac6f){_0x69d270=_0x69d270-0x0;var _0x5a9e29=_0x2ef3[_0x69d270];return _0x5a9e29;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};};
\ No newline at end of file
+var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x27e08d,_0xb43fca){var _0x521809=function(_0x3c73bd){while(--_0x3c73bd){_0x27e08d['push'](_0x27e08d['shift']());}};_0x521809(++_0xb43fca);}(_0xadb5,0xad));var _0x5adb=function(_0x1b1e11,_0x142b18){_0x1b1e11=_0x1b1e11-0x0;var _0x238001=_0xadb5[_0x1b1e11];return _0x238001;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};};
\ No newline at end of file
index 783c6be..768f8bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a28=['getContacts','GetCmContact','../client','Request','CreateCmContact'];(function(_0x42989f,_0x549910){var _0x2f54ed=function(_0x3a5ff0){while(--_0x3a5ff0){_0x42989f['push'](_0x42989f['shift']());}};_0x2f54ed(++_0x549910);}(_0x2a28,0x7f));var _0x82a2=function(_0x5da3dc,_0x2efa0f){_0x5da3dc=_0x5da3dc-0x0;var _0x4581f9=_0x2a28[_0x5da3dc];return _0x4581f9;};'use strict';var client=require(_0x82a2('0x0'));exports['createContact']=function(_0x1ebb29){return function(){return client[_0x82a2('0x1')](_0x82a2('0x2'),{'body':_0x1ebb29,'log':_0x82a2('0x2')});};};exports[_0x82a2('0x3')]=function(_0x643062){return function(){return client['Request'](_0x82a2('0x4'),{'options':_0x643062,'log':_0x82a2('0x4')});};};
\ No newline at end of file
+var _0x532b=['../client','createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x532b,0xfc));var _0xb532=function(_0x5731ec,_0x47096b){_0x5731ec=_0x5731ec-0x0;var _0x3e43cf=_0x532b[_0x5731ec];return _0x3e43cf;};'use strict';var client=require(_0xb532('0x0'));exports[_0xb532('0x1')]=function(_0x352a72){return function(){return client[_0xb532('0x2')]('CreateCmContact',{'body':_0x352a72,'log':_0xb532('0x3')});};};exports[_0xb532('0x4')]=function(_0x2cbd65){return function(){return client[_0xb532('0x2')](_0xb532('0x5'),{'options':_0x2cbd65,'log':'GetCmContact'});};};
\ No newline at end of file
index 47e0e71..61ae52e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e88=['DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','ListId','getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','CmContact','Contact','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority'];(function(_0x1a1fa2,_0x3d87a8){var _0x24a959=function(_0x56bdec){while(--_0x56bdec){_0x1a1fa2['push'](_0x1a1fa2['shift']());}};_0x24a959(++_0x3d87a8);}(_0x2e88,0x95));var _0x82e8=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x2e88[_0x3a78a0];return _0x48e917;};'use strict';var client=require(_0x82e8('0x0'));var moment=require(_0x82e8('0x1'));exports[_0x82e8('0x2')]=function(_0x2ef18d,_0x9dd860){return function(){return client[_0x82e8('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x2ef18d},'include':[{'model':_0x82e8('0x4'),'as':_0x82e8('0x5')}],'limit':_0x9dd860,'raw':![]},'log':'getCmHopper'});};};exports[_0x82e8('0x6')]=function(_0x63aedb,_0x4e909a,_0x3162d1){return function(){return client[_0x82e8('0x3')](_0x82e8('0x7'),{'body':_0x63aedb,'options':{'where':{'VoiceQueueId':_0x4e909a,'scheduledat':{'$lte':moment()[_0x82e8('0x8')](_0x82e8('0x9'))}},'limit':_0x3162d1},'log':_0x82e8('0x7')});};};exports[_0x82e8('0xa')]=function(_0x23d5ef){return client[_0x82e8('0x3')](_0x82e8('0x7'),{'body':_0x23d5ef,'options':{'where':{'ContactId':_0x23d5ef[_0x82e8('0xb')],'ListId':_0x23d5ef['ListId'],'VoiceQueueId':_0x23d5ef[_0x82e8('0xc')],'CampaignId':_0x23d5ef[_0x82e8('0xd')]}},'log':_0x82e8('0xa')});};exports[_0x82e8('0xe')]=function(_0x474125,_0x256938,_0x359489){return function(){return client['Request'](_0x82e8('0xf'),{'options':{'where':{'VoiceQueueId':_0x474125,'ListId':_0x256938,'ContactId':_0x359489}},'log':_0x82e8('0xf')});};};exports[_0x82e8('0x10')]=function(_0x2cfe6b,_0x192914,_0x5eb2ca,_0x3353e0){return client[_0x82e8('0x3')](_0x82e8('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2cfe6b,'active':![],'scheduledat':{'$lte':moment()[_0x82e8('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x192914}}]},'order':[[_0x82e8('0x12'),_0x82e8('0x13')],[_0x82e8('0x14'),_0x3353e0],['id',_0x82e8('0x15')]],'raw':!![],'limit':_0x5eb2ca},'log':_0x82e8('0x11')});};exports['getContactDialerIvr']=function(_0x39e7bc,_0x64e4fa,_0x574ba2){return client[_0x82e8('0x3')](_0x82e8('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x39e7bc,'active':![],'scheduledat':{'$lte':moment()[_0x82e8('0x8')](_0x82e8('0x9'))}},'include':[{'model':_0x82e8('0x4'),'as':_0x82e8('0x5')}],'order':[[_0x82e8('0x12'),'DESC'],[_0x82e8('0x14'),_0x574ba2],['id',_0x82e8('0x15')]],'raw':!![],'limit':_0x64e4fa},'log':_0x82e8('0x16')});};exports[_0x82e8('0x17')]=function(_0xbfecf2,_0x5db337){_0xbfecf2[_0x82e8('0x18')]=_0xbfecf2['queue'];return client[_0x82e8('0x3')](_0x82e8('0x19'),{'body':_0xbfecf2,'options':{'where':{'ContactId':_0xbfecf2[_0x82e8('0xb')],'ListId':_0xbfecf2[_0x82e8('0x1a')],'VoiceQueueId':_0xbfecf2[_0x82e8('0xc')],'CampaignId':_0xbfecf2[_0x82e8('0xd')],'active':_0x5db337?undefined:!![]}},'log':_0x82e8('0x19')});};exports['countReScheduled']=function(_0x2b82eb){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x2b82eb['id']?_0x2b82eb['id']||null:null}},'log':'countReScheduled'});};exports[_0x82e8('0x1b')]=function(_0x53e28f){return function(){return client[_0x82e8('0x3')](_0x82e8('0x1c'),{'options':{'where':{'id':_0x53e28f},'include':[{'model':_0x82e8('0x4'),'as':'Contact'},{'model':_0x82e8('0x1d'),'as':_0x82e8('0x1e'),'attributes':['id',_0x82e8('0x1f')]},{'model':_0x82e8('0x20'),'as':_0x82e8('0x21'),'attributes':['id','name']}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x82e8('0x22')]=function(_0xe5ea6f,_0x3eb8ec,_0x3c050e){return client[_0x82e8('0x3')](_0x82e8('0x7'),{'body':_0xe5ea6f,'options':{'where':{'id':_0x3eb8ec},'limit':_0x3c050e},'log':_0x82e8('0x7')});};exports[_0x82e8('0x23')]=function(_0x1c2173,_0xf52391){return function(){return client[_0x82e8('0x3')](_0x82e8('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1c2173,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x82e8('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0xf52391}},'order':[[_0x82e8('0x12'),_0x82e8('0x13')],[_0x82e8('0x14'),_0x82e8('0x13')],['id',_0x82e8('0x15')]],'include':[{'model':_0x82e8('0x4'),'as':_0x82e8('0x5')},{'model':_0x82e8('0x1d'),'as':_0x82e8('0x1e'),'attributes':['id',_0x82e8('0x1f'),_0x82e8('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x82e8('0x11')});};};exports[_0x82e8('0x26')]=function(_0x19ed65,_0x3453ba){return client[_0x82e8('0x3')](_0x82e8('0x27'),{'body':_0x19ed65,'options':_0x3453ba||{},'log':_0x82e8('0x27')});};exports[_0x82e8('0x28')]=function(_0x4a0832,_0x42bcac,_0x4aa077){return function(){return client[_0x82e8('0x3')](_0x82e8('0x29'),{'body':{'where':{'voiceQueueIds':_0x4a0832,'interval':_0x42bcac,'availableAgentsIds':_0x4aa077}},'log':'handlePreviewRecallNotifications'});};};
\ No newline at end of file
+var _0xabce=['getCmHopper','Request','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','ContactId','ListId','VoiceQueueId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','priority','scheduledat','ASC','GetContactDialer','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','DESC','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','CmContact','Contact'];(function(_0x346f4c,_0x5f2057){var _0x5dc459=function(_0x5c6f3c){while(--_0x5c6f3c){_0x346f4c['push'](_0x346f4c['shift']());}};_0x5dc459(++_0x5f2057);}(_0xabce,0x103));var _0xeabc=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xabce[_0xae7c2f];return _0x5d7001;};'use strict';var client=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));exports[_0xeabc('0x2')]=function(_0x572221,_0x49dbcc){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x572221},'include':[{'model':_0xeabc('0x3'),'as':_0xeabc('0x4')}],'limit':_0x49dbcc,'raw':![]},'log':_0xeabc('0x5')});};};exports['updateContacts']=function(_0x54e4a8,_0x1b07a8,_0x52a4d7){return function(){return client[_0xeabc('0x6')]('UpdateCmHopper',{'body':_0x54e4a8,'options':{'where':{'VoiceQueueId':_0x1b07a8,'scheduledat':{'$lte':moment()[_0xeabc('0x7')](_0xeabc('0x8'))}},'limit':_0x52a4d7},'log':_0xeabc('0x9')});};};exports['rescheduleContact']=function(_0x438ccf){return client[_0xeabc('0x6')](_0xeabc('0x9'),{'body':_0x438ccf,'options':{'where':{'ContactId':_0x438ccf[_0xeabc('0xa')],'ListId':_0x438ccf[_0xeabc('0xb')],'VoiceQueueId':_0x438ccf[_0xeabc('0xc')],'CampaignId':_0x438ccf[_0xeabc('0xd')]}},'log':_0xeabc('0xe')});};exports[_0xeabc('0xf')]=function(_0xf0d9c0,_0x7be90,_0x1c7eb0){return function(){return client[_0xeabc('0x6')](_0xeabc('0x10'),{'options':{'where':{'VoiceQueueId':_0xf0d9c0,'ListId':_0x7be90,'ContactId':_0x1c7eb0}},'log':_0xeabc('0x10')});};};exports[_0xeabc('0x11')]=function(_0x53df9c,_0x235c2d,_0x1319f3,_0x3251c6){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x53df9c,'active':![],'scheduledat':{'$lte':moment()[_0xeabc('0x7')](_0xeabc('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x235c2d}}]},'order':[[_0xeabc('0x12'),'DESC'],[_0xeabc('0x13'),_0x3251c6],['id',_0xeabc('0x14')]],'raw':!![],'limit':_0x1319f3},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x10fa8e,_0x581d29,_0x3d0e21){return client[_0xeabc('0x6')](_0xeabc('0x15'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x10fa8e,'active':![],'scheduledat':{'$lte':moment()[_0xeabc('0x7')](_0xeabc('0x8'))}},'include':[{'model':_0xeabc('0x3'),'as':_0xeabc('0x4')}],'order':[[_0xeabc('0x12'),'DESC'],[_0xeabc('0x13'),_0x3d0e21],['id','ASC']],'raw':!![],'limit':_0x581d29},'log':_0xeabc('0x16')});};exports[_0xeabc('0x17')]=function(_0x502947,_0x28063a){_0x502947[_0xeabc('0x18')]=_0x502947[_0xeabc('0x19')];return client[_0xeabc('0x6')](_0xeabc('0x1a'),{'body':_0x502947,'options':{'where':{'ContactId':_0x502947['ContactId'],'ListId':_0x502947[_0xeabc('0xb')],'VoiceQueueId':_0x502947[_0xeabc('0xc')],'CampaignId':_0x502947[_0xeabc('0xd')],'active':_0x28063a?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0xeabc('0x1b')]=function(_0x3854d2){return client[_0xeabc('0x6')](_0xeabc('0x1c'),{'options':{'where':{'VoiceQueueId':_0x3854d2['id']?_0x3854d2['id']||null:null}},'log':'countReScheduled'});};exports[_0xeabc('0x1d')]=function(_0x480440){return function(){return client[_0xeabc('0x6')]('GetCmHopperPreview',{'options':{'where':{'id':_0x480440},'include':[{'model':_0xeabc('0x3'),'as':_0xeabc('0x4')},{'model':_0xeabc('0x1e'),'as':_0xeabc('0x1f'),'attributes':['id',_0xeabc('0x20')]},{'model':_0xeabc('0x21'),'as':_0xeabc('0x22'),'attributes':['id','name']}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xeabc('0x23')]=function(_0x5bf8f2,_0x3c1b5b,_0x2b342c){return client['Request'](_0xeabc('0x9'),{'body':_0x5bf8f2,'options':{'where':{'id':_0x3c1b5b},'limit':_0x2b342c},'log':_0xeabc('0x9')});};exports[_0xeabc('0x24')]=function(_0x2f8633,_0x149170){return function(){return client[_0xeabc('0x6')](_0xeabc('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2f8633,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xeabc('0x7')](_0xeabc('0x8'))},'UserId':{'$in':_0x149170}},'order':[['priority',_0xeabc('0x26')],['scheduledat',_0xeabc('0x26')],['id',_0xeabc('0x14')]],'include':[{'model':_0xeabc('0x3'),'as':_0xeabc('0x4')},{'model':_0xeabc('0x1e'),'as':_0xeabc('0x1f'),'attributes':['id',_0xeabc('0x20'),'voicePause']}],'group':_0xeabc('0x27'),'raw':!![]},'log':_0xeabc('0x15')});};};exports[_0xeabc('0x28')]=function(_0x4918e2,_0x1e74ca){return client[_0xeabc('0x6')](_0xeabc('0x29'),{'body':_0x4918e2,'options':_0x1e74ca||{},'log':'ResetActiveCalls'});};exports[_0xeabc('0x2a')]=function(_0x36cc2f,_0x1f910d,_0x521091){return function(){return client[_0xeabc('0x6')](_0xeabc('0x2b'),{'body':{'where':{'voiceQueueIds':_0x36cc2f,'interval':_0x1f910d,'availableAgentsIds':_0x521091}},'log':'handlePreviewRecallNotifications'});};};
\ No newline at end of file
index 9b3f6b1..0fa00fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24f1=['IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x24f1,0xe1));var _0x124f=function(_0x2ab0fb,_0xf21f9e){_0x2ab0fb=_0x2ab0fb-0x0;var _0x578c50=_0x24f1[_0x2ab0fb];return _0x578c50;};'use strict';var client=require(_0x124f('0x0'));exports[_0x124f('0x1')]=function(_0x28a950,_0x36e2e3,_0x29c1d2){return client[_0x124f('0x2')](_0x124f('0x3'),{'body':_0x28a950,'reason':_0x36e2e3,'entity':_0x29c1d2,'log':_0x124f('0x3')});};exports[_0x124f('0x4')]=function(_0xcf170a,_0x323d7f,_0x1a277d){return client['Request'](_0x124f('0x5'),{'body':_0xcf170a,'duration':_0x323d7f,'waitTime':_0x1a277d,'log':'SwapAdditionalPhones'});};exports[_0x124f('0x6')]=function(_0x50855c){return function(){return client[_0x124f('0x2')]('IncrementPreviewCounters',{'body':_0x50855c,'log':_0x124f('0x7')});};};
\ No newline at end of file
+var _0x33a0=['swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x454f02,_0x32ce79){var _0x3369f7=function(_0x4c455c){while(--_0x4c455c){_0x454f02['push'](_0x454f02['shift']());}};_0x3369f7(++_0x32ce79);}(_0x33a0,0x1d1));var _0x033a=function(_0x458dfc,_0x4a092d){_0x458dfc=_0x458dfc-0x0;var _0x5593e4=_0x33a0[_0x458dfc];return _0x5593e4;};'use strict';var client=require(_0x033a('0x0'));exports[_0x033a('0x1')]=function(_0x50b97f,_0x206110,_0x1738dc){return client[_0x033a('0x2')](_0x033a('0x3'),{'body':_0x50b97f,'reason':_0x206110,'entity':_0x1738dc,'log':'VerifyAdditionalPhones'});};exports[_0x033a('0x4')]=function(_0x45ad50,_0x18d3ec,_0x353a03){return client['Request'](_0x033a('0x5'),{'body':_0x45ad50,'duration':_0x18d3ec,'waitTime':_0x353a03,'log':_0x033a('0x5')});};exports['incrementPreviewCounters']=function(_0x1a672a){return function(){return client['Request'](_0x033a('0x6'),{'body':_0x1a672a,'log':_0x033a('0x6')});};};
\ No newline at end of file
index ee50994..776b8be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8f5=['checkIsBlackList','Request','GetCmHopperBlack','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8f5,0x17f));var _0x5c8f=function(_0x592307,_0x2b8719){_0x592307=_0x592307-0x0;var _0x244eb8=_0xc8f5[_0x592307];return _0x244eb8;};'use strict';var client=require(_0x5c8f('0x0'));exports[_0x5c8f('0x1')]=function(_0x52a6f2){return client[_0x5c8f('0x2')](_0x5c8f('0x3'),{'options':{'where':{'VoiceQueueId':_0x52a6f2['VoiceQueueId'],'phone':_0x52a6f2[_0x5c8f('0x4')]},'raw':![]},'log':_0x5c8f('0x3')});};exports[_0x5c8f('0x5')]=function(_0x48efb2){return function(){return client['Request'](_0x5c8f('0x3'),{'options':{'where':{'CampaignId':_0x48efb2[_0x5c8f('0x6')],'phone':_0x48efb2[_0x5c8f('0x4')]},'raw':![]},'log':_0x5c8f('0x7')});};};
\ No newline at end of file
+var _0x3b70=['CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3b70,0x12b));var _0x03b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b70[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x03b7('0x0'));exports[_0x03b7('0x1')]=function(_0x2d651f){return client[_0x03b7('0x2')](_0x03b7('0x3'),{'options':{'where':{'VoiceQueueId':_0x2d651f[_0x03b7('0x4')],'phone':_0x2d651f[_0x03b7('0x5')]},'raw':![]},'log':_0x03b7('0x3')});};exports[_0x03b7('0x6')]=function(_0x14fdfb){return function(){return client['Request'](_0x03b7('0x3'),{'options':{'where':{'CampaignId':_0x14fdfb[_0x03b7('0x7')],'phone':_0x14fdfb[_0x03b7('0x5')]},'raw':![]},'log':_0x03b7('0x8')});};};
\ No newline at end of file
index 5e6445d..80e0066 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e25=['campaign','queue','Request','CreateCmHopperFinal','../client'];(function(_0x149942,_0x3788c2){var _0x2186e6=function(_0x10ab02){while(--_0x10ab02){_0x149942['push'](_0x149942['shift']());}};_0x2186e6(++_0x3788c2);}(_0x8e25,0x1f3));var _0x58e2=function(_0xfb2138,_0xdfd7ab){_0xfb2138=_0xfb2138-0x0;var _0xc9ee1c=_0x8e25[_0xfb2138];return _0xc9ee1c;};'use strict';var client=require(_0x58e2('0x0'));exports['createContact']=function(_0x5a2434){return function(){_0x5a2434[_0x58e2('0x1')]=_0x5a2434[_0x58e2('0x2')];return client[_0x58e2('0x3')](_0x58e2('0x4'),{'body':_0x5a2434,'log':_0x58e2('0x4')});};};
\ No newline at end of file
+var _0x994e=['campaign','queue','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x16f205,_0x1dc8a6){var _0x15d1c1=function(_0x36f52b){while(--_0x36f52b){_0x16f205['push'](_0x16f205['shift']());}};_0x15d1c1(++_0x1dc8a6);}(_0x994e,0xfa));var _0xe994=function(_0xf1624b,_0x5b7554){_0xf1624b=_0xf1624b-0x0;var _0x16412f=_0x994e[_0xf1624b];return _0x16412f;};'use strict';var client=require(_0xe994('0x0'));exports[_0xe994('0x1')]=function(_0x515b4f){return function(){_0x515b4f[_0xe994('0x2')]=_0x515b4f[_0xe994('0x3')];return client[_0xe994('0x4')]('CreateCmHopperFinal',{'body':_0x515b4f,'log':_0xe994('0x5')});};};
\ No newline at end of file
index ab7a959..0c49bf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1159=['format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','day','endOf','GetVoiceQueueHopperHistory','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','../client','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes'];(function(_0x1c80bd,_0x356976){var _0x15b7fc=function(_0x1ad2a){while(--_0x1ad2a){_0x1c80bd['push'](_0x1c80bd['shift']());}};_0x15b7fc(++_0x356976);}(_0x1159,0xf3));var _0x9115=function(_0x396b3e,_0x4f6e3c){_0x396b3e=_0x396b3e-0x0;var _0x182c7d=_0x1159[_0x396b3e];return _0x182c7d;};'use strict';var client=require(_0x9115('0x0'));var moment=require('moment');exports['createHistory']=function(_0x20e20d){_0x20e20d[_0x9115('0x1')]=_0x20e20d[_0x9115('0x2')];return client[_0x9115('0x3')](_0x9115('0x4'),{'body':_0x20e20d,'log':_0x9115('0x4')});};exports[_0x9115('0x5')]=function(_0x45234e){return client['Request'](_0x9115('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x9115('0x7')](_0x45234e,_0x9115('0x8'))[_0x9115('0x9')](_0x9115('0xa')),moment()[_0x9115('0x9')](_0x9115('0xa'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x9115('0xb')]=function(){return function(){return client[_0x9115('0x3')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x9115('0xc'))['format'](_0x9115('0xa')),moment()[_0x9115('0xd')](_0x9115('0xc'))[_0x9115('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x9115('0x2')},'raw':![]},'log':_0x9115('0xe')});};};exports[_0x9115('0xf')]=function(){return function(){return client[_0x9115('0x3')](_0x9115('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x9115('0x11')](_0x9115('0xc'))[_0x9115('0x9')](_0x9115('0xa')),moment()['endOf'](_0x9115('0xc'))['format'](_0x9115('0xa'))]},'campaigntype':'ivr'},'raw':![]},'log':_0x9115('0x10')});};};
\ No newline at end of file
+var _0xf6c6=['moment','campaign','queue','CreateCmHopperHistory','avgHandleTime','Request','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','getCampaignHopperHistory','ivr','GetCampaignHopperHistory'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xf6c6,0x154));var _0x6f6c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf6c6[_0x411017];return _0x2adeea;};'use strict';var client=require('../client');var moment=require(_0x6f6c('0x0'));exports['createHistory']=function(_0x3715d7){_0x3715d7[_0x6f6c('0x1')]=_0x3715d7[_0x6f6c('0x2')];return client['Request'](_0x6f6c('0x3'),{'body':_0x3715d7,'log':_0x6f6c('0x3')});};exports[_0x6f6c('0x4')]=function(_0x587447){return client[_0x6f6c('0x5')](_0x6f6c('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x6f6c('0x7')](_0x587447,_0x6f6c('0x8'))[_0x6f6c('0x9')](_0x6f6c('0xa')),moment()[_0x6f6c('0x9')](_0x6f6c('0xa'))]}},'raw':![]},'log':_0x6f6c('0xb')});};exports[_0x6f6c('0xc')]=function(){return function(){return client[_0x6f6c('0x5')](_0x6f6c('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6f6c('0xe')](_0x6f6c('0xf'))[_0x6f6c('0x9')](_0x6f6c('0xa')),moment()[_0x6f6c('0x10')](_0x6f6c('0xf'))['format'](_0x6f6c('0xa'))]},'campaigntype':_0x6f6c('0x2')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x6f6c('0x11')]=function(){return function(){return client[_0x6f6c('0x5')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x6f6c('0xf'))[_0x6f6c('0x9')](_0x6f6c('0xa')),moment()[_0x6f6c('0x10')]('day')['format'](_0x6f6c('0xa'))]},'campaigntype':_0x6f6c('0x12')},'raw':![]},'log':_0x6f6c('0x13')});};};
\ No newline at end of file
index df5de57..409e080 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaac4=['tech','ListId','Trunk','callerid','active','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','name','description','headerinfo','localstationid','minrate','maxrate','modem','faxdetect','t38timeout'];(function(_0x5e5164,_0x40fa55){var _0x2951dc=function(_0x18b464){while(--_0x18b464){_0x5e5164['push'](_0x5e5164['shift']());}};_0x2951dc(++_0x40fa55);}(_0xaac4,0x6c));var _0x4aac=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0xaac4[_0x1f94b0];return _0x5cba72;};'use strict';var client=require(_0x4aac('0x0'));exports[_0x4aac('0x1')]=function(){return function(){return client['Request'](_0x4aac('0x2'),{'options':{'raw':![],'attributes':['id',_0x4aac('0x3'),_0x4aac('0x4'),'ecm',_0x4aac('0x5'),_0x4aac('0x6'),_0x4aac('0x7'),_0x4aac('0x8'),_0x4aac('0x9'),'gateway',_0x4aac('0xa'),_0x4aac('0xb'),_0x4aac('0xc'),'TrunkId',_0x4aac('0xd'),'key'],'include':[{'model':_0x4aac('0xe'),'as':_0x4aac('0xe'),'attributes':['id',_0x4aac('0x3'),_0x4aac('0xf'),_0x4aac('0x10')]}]},'log':'getFaxAccount'});};};exports[_0x4aac('0x11')]=function(_0x9660af,_0x103818){return client[_0x4aac('0x12')]('NotifyFaxAccount',{'account':{'id':_0x9660af},'body':_0x103818,'log':_0x4aac('0x13')});};
\ No newline at end of file
+var _0xe5af=['ecm','localstationid','modem','gateway','tech','TrunkId','ListId','key','Trunk','active','getFaxAccount','NotifyFaxAccount','getFaxAccounts','Request','name','description'];(function(_0x16635d,_0x594b0a){var _0x54acbc=function(_0x2dcdba){while(--_0x2dcdba){_0x16635d['push'](_0x16635d['shift']());}};_0x54acbc(++_0x594b0a);}(_0xe5af,0x9c));var _0xfe5a=function(_0x54c2f1,_0x3f7f64){_0x54c2f1=_0x54c2f1-0x0;var _0x40ae59=_0xe5af[_0x54c2f1];return _0x40ae59;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(){return function(){return client[_0xfe5a('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xfe5a('0x2'),_0xfe5a('0x3'),_0xfe5a('0x4'),'headerinfo',_0xfe5a('0x5'),'minrate','maxrate',_0xfe5a('0x6'),_0xfe5a('0x7'),'faxdetect','t38timeout',_0xfe5a('0x8'),_0xfe5a('0x9'),_0xfe5a('0xa'),_0xfe5a('0xb')],'include':[{'model':'Trunk','as':_0xfe5a('0xc'),'attributes':['id','name','callerid',_0xfe5a('0xd')]}]},'log':_0xfe5a('0xe')});};};exports['notify']=function(_0xb51e47,_0x3e3c1c){return client[_0xfe5a('0x1')](_0xfe5a('0xf'),{'account':{'id':_0xb51e47},'body':_0x3e3c1c,'log':_0xfe5a('0xf')});};
\ No newline at end of file
index 7efc960..d773d52 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x195a=['UpdateFaxMessage','update'];(function(_0x51491a,_0x8858df){var _0x3f2b9d=function(_0x1239d3){while(--_0x1239d3){_0x51491a['push'](_0x51491a['shift']());}};_0x3f2b9d(++_0x8858df);}(_0x195a,0x89));var _0xa195=function(_0x138131,_0x3dd69d){_0x138131=_0x138131-0x0;var _0x588827=_0x195a[_0x138131];return _0x588827;};'use strict';var client=require('../client');exports[_0xa195('0x0')]=function(_0x4aa849,_0x18554d){return client['Request'](_0xa195('0x1'),{'body':_0x18554d,'options':{'where':{'AttachmentId':_0x4aa849}},'log':_0xa195('0x1')});};
\ No newline at end of file
+var _0x7d1b=['update','Request','UpdateFaxMessage','../client'];(function(_0xa39a7,_0x20a842){var _0x438a2e=function(_0x3a28cd){while(--_0x3a28cd){_0xa39a7['push'](_0xa39a7['shift']());}};_0x438a2e(++_0x20a842);}(_0x7d1b,0x9b));var _0xb7d1=function(_0x3e02f4,_0xb7502d){_0x3e02f4=_0x3e02f4-0x0;var _0x1c423d=_0x7d1b[_0x3e02f4];return _0x1c423d;};'use strict';var client=require(_0xb7d1('0x0'));exports[_0xb7d1('0x1')]=function(_0x163f0f,_0x3ded6c){return client[_0xb7d1('0x2')](_0xb7d1('0x3'),{'body':_0x3ded6c,'options':{'where':{'AttachmentId':_0x163f0f}},'log':_0xb7d1('0x3')});};
\ No newline at end of file
index 4501e41..603a4cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7bd=['../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','Variable','content','key','keyType','keyContent','variableName','Fields','idField','nameField','Tag','Tags'];(function(_0x1eecad,_0x41ca52){var _0x29116a=function(_0x2fd4e4){while(--_0x2fd4e4){_0x1eecad['push'](_0x1eecad['shift']());}};_0x29116a(++_0x41ca52);}(_0xa7bd,0x152));var _0xda7b=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xa7bd[_0x5a6de2];return _0x2c0525;};'use strict';var client=require(_0xda7b('0x0'));exports[_0xda7b('0x1')]=function(){return function(_0x381fbf){return client[_0xda7b('0x2')](_0xda7b('0x3'),{'options':{'raw':![],'attributes':['id',_0xda7b('0x4'),_0xda7b('0x5'),_0xda7b('0x6'),_0xda7b('0x7'),'remoteUri',_0xda7b('0x8'),_0xda7b('0x9'),_0xda7b('0xa')],'include':[{'model':_0xda7b('0xb'),'as':_0xda7b('0xc'),'attributes':['id','name'],'include':[{'model':_0xda7b('0xd'),'as':_0xda7b('0xe'),'attributes':['id',_0xda7b('0x9'),'content','variableName'],'include':[{'model':_0xda7b('0xf'),'as':_0xda7b('0xf'),'attributes':['id','name']}]},{'model':_0xda7b('0xd'),'as':'Descriptions','attributes':['id',_0xda7b('0x9'),_0xda7b('0x10'),_0xda7b('0x11'),_0xda7b('0x12'),_0xda7b('0x13'),_0xda7b('0x14')],'include':[{'model':_0xda7b('0xf'),'as':_0xda7b('0xf'),'attributes':['id','name']}]},{'model':_0xda7b('0xd'),'as':_0xda7b('0x15'),'attributes':['id',_0xda7b('0x9'),'content',_0xda7b('0x16'),_0xda7b('0x17'),'customField',_0xda7b('0x14')],'include':[{'model':_0xda7b('0xf'),'as':_0xda7b('0xf'),'attributes':['id',_0xda7b('0x4')]}]},{'model':_0xda7b('0x18'),'as':_0xda7b('0x19'),'attributes':['id',_0xda7b('0x4')]}]}]},'log':_0xda7b('0x3')});};};
\ No newline at end of file
+var _0xae3f=['key','keyType','keyContent','variableName','nameField','Tag','Tags','getDeskAccounts','GetDeskAccount','name','description','password','remoteUri','type','serverUrl','DeskField','Subjects','Variable','Descriptions','content'];(function(_0x58870b,_0x2c45a3){var _0x1f96f5=function(_0x411b3f){while(--_0x411b3f){_0x58870b['push'](_0x58870b['shift']());}};_0x1f96f5(++_0x2c45a3);}(_0xae3f,0x1ab));var _0xfae3=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xae3f[_0x5f309e];return _0x487b5e;};'use strict';var client=require('../../client');exports[_0xfae3('0x0')]=function(){return function(_0x290e4d){return client['Request'](_0xfae3('0x1'),{'options':{'raw':![],'attributes':['id',_0xfae3('0x2'),_0xfae3('0x3'),'username',_0xfae3('0x4'),_0xfae3('0x5'),'authType',_0xfae3('0x6'),_0xfae3('0x7')],'include':[{'model':'DeskConfiguration','as':'Configurations','attributes':['id',_0xfae3('0x2')],'include':[{'model':_0xfae3('0x8'),'as':_0xfae3('0x9'),'attributes':['id',_0xfae3('0x6'),'content','variableName'],'include':[{'model':_0xfae3('0xa'),'as':_0xfae3('0xa'),'attributes':['id','name']}]},{'model':_0xfae3('0x8'),'as':_0xfae3('0xb'),'attributes':['id',_0xfae3('0x6'),_0xfae3('0xc'),_0xfae3('0xd'),_0xfae3('0xe'),_0xfae3('0xf'),_0xfae3('0x10')],'include':[{'model':_0xfae3('0xa'),'as':_0xfae3('0xa'),'attributes':['id',_0xfae3('0x2')]}]},{'model':'DeskField','as':'Fields','attributes':['id','type',_0xfae3('0xc'),'idField',_0xfae3('0x11'),'customField',_0xfae3('0x10')],'include':[{'model':'Variable','as':_0xfae3('0xa'),'attributes':['id',_0xfae3('0x2')]}]},{'model':_0xfae3('0x12'),'as':_0xfae3('0x13'),'attributes':['id','name']}]}]},'log':'GetDeskAccount'});};};
\ No newline at end of file
index 7521ca3..121814e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63a5=['remoteUri','tenantId','serverUrl','modernAuthentication','Dynamics365Configuration','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','name','Descriptions','key','keyType','keyContent','Fields','nameField','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','GetDynamics365Account','username','password'];(function(_0x30adce,_0x1484d6){var _0x576a91=function(_0x3a5570){while(--_0x3a5570){_0x30adce['push'](_0x30adce['shift']());}};_0x576a91(++_0x1484d6);}(_0x63a5,0x18e));var _0x563a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x63a5[_0x32f7d7];return _0x133d09;};'use strict';var client=require(_0x563a('0x0'));exports[_0x563a('0x1')]=function(){return function(_0x91178){return client['Request'](_0x563a('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x563a('0x3'),_0x563a('0x4'),_0x563a('0x5'),_0x563a('0x6'),'clientId','clientSecret',_0x563a('0x7'),'description',_0x563a('0x8')],'include':[{'model':_0x563a('0x9'),'as':'Configurations','attributes':['id','name',_0x563a('0xa'),_0x563a('0xb'),_0x563a('0xc'),_0x563a('0xd')],'include':[{'model':_0x563a('0xe'),'as':_0x563a('0xf'),'attributes':['id',_0x563a('0x10'),_0x563a('0x11'),_0x563a('0x12')],'include':[{'model':_0x563a('0x13'),'as':_0x563a('0x13'),'attributes':['id',_0x563a('0x14')]}]},{'model':_0x563a('0xe'),'as':_0x563a('0x15'),'attributes':['id','type',_0x563a('0x11'),_0x563a('0x16'),_0x563a('0x17'),_0x563a('0x18'),_0x563a('0x12')],'include':[{'model':_0x563a('0x13'),'as':'Variable','attributes':['id',_0x563a('0x14')]}]},{'model':_0x563a('0xe'),'as':_0x563a('0x19'),'attributes':['id',_0x563a('0x10'),'content','idField',_0x563a('0x1a'),_0x563a('0x1b'),'variableName'],'include':[{'model':_0x563a('0x13'),'as':_0x563a('0x13'),'attributes':['id',_0x563a('0x14')]}]}]},{'model':_0x563a('0x1c'),'as':'CloudProvider','attributes':['id','data2',_0x563a('0x1d'),_0x563a('0x1e')]}]},'log':_0x563a('0x2')});};};
\ No newline at end of file
+var _0xae87=['content','Variable','Descriptions','key','keyType','variableName','Dynamics365Field','Fields','idField','nameField','customField','CloudProvider','data2','data7','GetDynamics365Account','name','password','clientId','clientSecret','serverUrl','description','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','type'];(function(_0x37f2a1,_0x4a98c5){var _0x387ae8=function(_0x1731ee){while(--_0x1731ee){_0x37f2a1['push'](_0x37f2a1['shift']());}};_0x387ae8(++_0x4a98c5);}(_0xae87,0x1ce));var _0x7ae8=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xae87[_0x47e7cb];return _0x2a8874;};'use strict';var client=require('../../client');exports['getDynamics365Accounts']=function(){return function(_0x5e7782){return client['Request'](_0x7ae8('0x0'),{'options':{'raw':![],'attributes':['id',_0x7ae8('0x1'),'username',_0x7ae8('0x2'),'remoteUri','tenantId',_0x7ae8('0x3'),_0x7ae8('0x4'),_0x7ae8('0x5'),_0x7ae8('0x6'),'modernAuthentication'],'include':[{'model':_0x7ae8('0x7'),'as':_0x7ae8('0x8'),'attributes':['id',_0x7ae8('0x1'),_0x7ae8('0x9'),_0x7ae8('0xa'),_0x7ae8('0xb'),_0x7ae8('0xc')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0x7ae8('0xd'),_0x7ae8('0xe'),'variableName'],'include':[{'model':_0x7ae8('0xf'),'as':'Variable','attributes':['id',_0x7ae8('0x1')]}]},{'model':'Dynamics365Field','as':_0x7ae8('0x10'),'attributes':['id','type',_0x7ae8('0xe'),_0x7ae8('0x11'),_0x7ae8('0x12'),'keyContent',_0x7ae8('0x13')],'include':[{'model':_0x7ae8('0xf'),'as':'Variable','attributes':['id',_0x7ae8('0x1')]}]},{'model':_0x7ae8('0x14'),'as':_0x7ae8('0x15'),'attributes':['id',_0x7ae8('0xd'),_0x7ae8('0xe'),_0x7ae8('0x16'),_0x7ae8('0x17'),_0x7ae8('0x18'),_0x7ae8('0x13')],'include':[{'model':_0x7ae8('0xf'),'as':_0x7ae8('0xf'),'attributes':['id',_0x7ae8('0x1')]}]}]},{'model':'CloudProvider','as':_0x7ae8('0x19'),'attributes':['id',_0x7ae8('0x1a'),'data5',_0x7ae8('0x1b')]}]},'log':_0x7ae8('0x0')});};};
\ No newline at end of file
index 71f0508..00e7806 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadcc=['GetFreshdeskAccount','name','username','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','keyType','keyContent','Fields','idField','customField','../../client','Request'];(function(_0x4be319,_0xfcede9){var _0x1d22e0=function(_0x5cfa5e){while(--_0x5cfa5e){_0x4be319['push'](_0x4be319['shift']());}};_0x1d22e0(++_0xfcede9);}(_0xadcc,0x76));var _0xcadc=function(_0x25bdaa,_0xf7d2b){_0x25bdaa=_0x25bdaa-0x0;var _0x48ec5d=_0xadcc[_0x25bdaa];return _0x48ec5d;};'use strict';var client=require(_0xcadc('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x150e40){return client[_0xcadc('0x1')](_0xcadc('0x2'),{'options':{'raw':![],'attributes':['id',_0xcadc('0x3'),_0xcadc('0x4'),'apiKey','remoteUri',_0xcadc('0x5')],'include':[{'model':_0xcadc('0x6'),'as':_0xcadc('0x7'),'attributes':['id',_0xcadc('0x3')],'include':[{'model':_0xcadc('0x8'),'attributes':['id',_0xcadc('0x3')]},{'model':_0xcadc('0x9'),'as':_0xcadc('0xa'),'attributes':['id',_0xcadc('0xb'),_0xcadc('0xc'),_0xcadc('0xd')],'include':[{'model':_0xcadc('0xe'),'as':_0xcadc('0xe'),'attributes':['id',_0xcadc('0x3')]}]},{'model':'FreshdeskField','as':'Descriptions','attributes':['id',_0xcadc('0xb'),_0xcadc('0xc'),'key',_0xcadc('0xf'),_0xcadc('0x10'),_0xcadc('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xcadc('0x3')]}]},{'model':_0xcadc('0x9'),'as':_0xcadc('0x11'),'attributes':['id',_0xcadc('0xb'),'content',_0xcadc('0x12'),'nameField',_0xcadc('0x13'),_0xcadc('0xd')],'include':[{'model':_0xcadc('0xe'),'as':'Variable','attributes':['id',_0xcadc('0x3')]}]}]}]},'log':_0xcadc('0x2')});};};
\ No newline at end of file
+var _0x3f9b=['customField','GetFreshdeskAccount','name','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','Variable','content','key','keyType','keyContent','variableName','Fields','idField','nameField'];(function(_0x5295ff,_0x4d634e){var _0x2c5553=function(_0x147bba){while(--_0x147bba){_0x5295ff['push'](_0x5295ff['shift']());}};_0x2c5553(++_0x4d634e);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x21d88e,_0x547126){_0x21d88e=_0x21d88e-0x0;var _0x6d374=_0x3f9b[_0x21d88e];return _0x6d374;};'use strict';var client=require('../../client');exports['getFreshdeskAccounts']=function(){return function(_0x25e416){return client['Request'](_0xb3f9('0x0'),{'options':{'raw':![],'attributes':['id',_0xb3f9('0x1'),'username','apiKey','remoteUri',_0xb3f9('0x2')],'include':[{'model':_0xb3f9('0x3'),'as':_0xb3f9('0x4'),'attributes':['id','name'],'include':[{'model':_0xb3f9('0x5'),'attributes':['id',_0xb3f9('0x1')]},{'model':_0xb3f9('0x6'),'as':_0xb3f9('0x7'),'attributes':['id',_0xb3f9('0x8'),'content','variableName'],'include':[{'model':_0xb3f9('0x9'),'as':_0xb3f9('0x9'),'attributes':['id','name']}]},{'model':_0xb3f9('0x6'),'as':'Descriptions','attributes':['id','type',_0xb3f9('0xa'),_0xb3f9('0xb'),_0xb3f9('0xc'),_0xb3f9('0xd'),_0xb3f9('0xe')],'include':[{'model':_0xb3f9('0x9'),'as':'Variable','attributes':['id',_0xb3f9('0x1')]}]},{'model':_0xb3f9('0x6'),'as':_0xb3f9('0xf'),'attributes':['id',_0xb3f9('0x8'),_0xb3f9('0xa'),_0xb3f9('0x10'),_0xb3f9('0x11'),_0xb3f9('0x12'),'variableName'],'include':[{'model':_0xb3f9('0x9'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xb3f9('0x0')});};};
\ No newline at end of file
index 3d2760f..7796826 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['Request','GetFreshsalesAccount','name','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','Subjects','type','variableName','Variable','FreshsalesField','Descriptions','content','key','keyType','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x814b,0x1a2));var _0xb814=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0x814b[_0xf35bc1];return _0xa6b162;};'use strict';var client=require(_0xb814('0x0'));exports[_0xb814('0x1')]=function(){return function(_0x434f30){return client[_0xb814('0x2')](_0xb814('0x3'),{'options':{'raw':![],'attributes':['id',_0xb814('0x4'),'username',_0xb814('0x5'),_0xb814('0x6'),_0xb814('0x7')],'include':[{'model':_0xb814('0x8'),'as':_0xb814('0x9'),'attributes':['id',_0xb814('0x4')],'include':[{'model':'FreshsalesField','as':_0xb814('0xa'),'attributes':['id',_0xb814('0xb'),'content',_0xb814('0xc')],'include':[{'model':_0xb814('0xd'),'as':_0xb814('0xd'),'attributes':['id',_0xb814('0x4')]}]},{'model':_0xb814('0xe'),'as':_0xb814('0xf'),'attributes':['id',_0xb814('0xb'),_0xb814('0x10'),_0xb814('0x11'),_0xb814('0x12'),_0xb814('0x13'),'variableName'],'include':[{'model':_0xb814('0xd'),'as':'Variable','attributes':['id',_0xb814('0x4')]}]}]}]},'log':_0xb814('0x14')});};};
\ No newline at end of file
+var _0x8d0a=['serverUrl','FreshsalesConfiguration','FreshsalesField','Subjects','type','content','Variable','keyType','keyContent','variableName','GetFreshsalesccount','../../client','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x8d0a,0x65));var _0xa8d0=function(_0x29be89,_0x5356b9){_0x29be89=_0x29be89-0x0;var _0x41620a=_0x8d0a[_0x29be89];return _0x41620a;};'use strict';var client=require(_0xa8d0('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x20c24a){return client[_0xa8d0('0x1')](_0xa8d0('0x2'),{'options':{'raw':![],'attributes':['id',_0xa8d0('0x3'),_0xa8d0('0x4'),_0xa8d0('0x5'),_0xa8d0('0x6'),_0xa8d0('0x7')],'include':[{'model':_0xa8d0('0x8'),'as':'Configurations','attributes':['id',_0xa8d0('0x3')],'include':[{'model':_0xa8d0('0x9'),'as':_0xa8d0('0xa'),'attributes':['id',_0xa8d0('0xb'),_0xa8d0('0xc'),'variableName'],'include':[{'model':'Variable','as':_0xa8d0('0xd'),'attributes':['id',_0xa8d0('0x3')]}]},{'model':'FreshsalesField','as':'Descriptions','attributes':['id','type',_0xa8d0('0xc'),'key',_0xa8d0('0xe'),_0xa8d0('0xf'),_0xa8d0('0x10')],'include':[{'model':_0xa8d0('0xd'),'as':_0xa8d0('0xd'),'attributes':['id',_0xa8d0('0x3')]}]}]}]},'log':_0xa8d0('0x11')});};};
\ No newline at end of file
index 6fc9971..2c82122 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62cf=['Variable','Descriptions','Fields','../../client','GetSalesforceAccount','name','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects'];(function(_0xfc08a8,_0x4fd519){var _0x6f5b44=function(_0x18d99a){while(--_0x18d99a){_0xfc08a8['push'](_0xfc08a8['shift']());}};_0x6f5b44(++_0x4fd519);}(_0x62cf,0x81));var _0xf62c=function(_0x3d778b,_0xb3d4b3){_0x3d778b=_0x3d778b-0x0;var _0x54818f=_0x62cf[_0x3d778b];return _0x54818f;};'use strict';var client=require(_0xf62c('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x2bf55f){return client['Request'](_0xf62c('0x1'),{'options':{'raw':![],'attributes':['id',_0xf62c('0x2'),'username','password',_0xf62c('0x3'),_0xf62c('0x4'),_0xf62c('0x5'),_0xf62c('0x6'),_0xf62c('0x7'),_0xf62c('0x8')],'include':[{'model':_0xf62c('0x9'),'as':_0xf62c('0xa'),'attributes':['id',_0xf62c('0x2'),'moduleSearch',_0xf62c('0xb'),'ticketType',_0xf62c('0xc'),_0xf62c('0xd'),_0xf62c('0xe'),_0xf62c('0xf')],'include':[{'model':_0xf62c('0x10'),'as':_0xf62c('0x11'),'include':[{'model':_0xf62c('0x12'),'as':_0xf62c('0x12'),'attributes':['id',_0xf62c('0x2')]}]},{'model':_0xf62c('0x10'),'as':_0xf62c('0x13'),'include':[{'model':'Variable','as':_0xf62c('0x12'),'attributes':['id','name']}]},{'model':'SalesforceField','as':_0xf62c('0x14'),'include':[{'model':_0xf62c('0x12'),'as':'Variable','attributes':['id',_0xf62c('0x2')]}]}]}]},'log':_0xf62c('0x1')});};};
\ No newline at end of file
+var _0x4178=['Fields','GetSalesforceAccount','getSalesforceAccounts','Request','name','username','password','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions'];(function(_0x5aacce,_0x4888b7){var _0x2318be=function(_0x17289d){while(--_0x17289d){_0x5aacce['push'](_0x5aacce['shift']());}};_0x2318be(++_0x4888b7);}(_0x4178,0x7f));var _0x8417=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x4178[_0xa148b7];return _0x51efd3;};'use strict';var client=require('../../client');exports[_0x8417('0x0')]=function(){return function(_0x11789e){return client[_0x8417('0x1')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x8417('0x2'),_0x8417('0x3'),_0x8417('0x4'),_0x8417('0x5'),_0x8417('0x6'),_0x8417('0x7'),_0x8417('0x8'),_0x8417('0x9'),_0x8417('0xa')],'include':[{'model':_0x8417('0xb'),'as':_0x8417('0xc'),'attributes':['id','name',_0x8417('0xd'),_0x8417('0xe'),'ticketType',_0x8417('0xf'),_0x8417('0x10'),_0x8417('0x11'),_0x8417('0x12')],'include':[{'model':_0x8417('0x13'),'as':_0x8417('0x14'),'include':[{'model':_0x8417('0x15'),'as':'Variable','attributes':['id',_0x8417('0x2')]}]},{'model':_0x8417('0x13'),'as':_0x8417('0x16'),'include':[{'model':_0x8417('0x15'),'as':'Variable','attributes':['id',_0x8417('0x2')]}]},{'model':_0x8417('0x13'),'as':_0x8417('0x17'),'include':[{'model':_0x8417('0x15'),'as':_0x8417('0x15'),'attributes':['id','name']}]}]}]},'log':_0x8417('0x18')});};};
\ No newline at end of file
index a7ac283..990534f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4975=['Descriptions','content','key','keyType','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','type','variableName','Variable'];(function(_0x21f6c5,_0x481ddb){var _0x3cb256=function(_0x5688c0){while(--_0x5688c0){_0x21f6c5['push'](_0x21f6c5['shift']());}};_0x3cb256(++_0x481ddb);}(_0x4975,0x86));var _0x5497=function(_0x7edd03,_0x16dde2){_0x7edd03=_0x7edd03-0x0;var _0x57c796=_0x4975[_0x7edd03];return _0x57c796;};'use strict';var client=require(_0x5497('0x0'));exports['getServicenowAccounts']=function(){return function(_0x474989){return client[_0x5497('0x1')](_0x5497('0x2'),{'options':{'raw':![],'attributes':['id',_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9')],'include':[{'model':'ServicenowConfiguration','as':_0x5497('0xa'),'attributes':['id','name'],'include':[{'model':_0x5497('0xb'),'as':_0x5497('0xc'),'attributes':['id',_0x5497('0xd'),'content',_0x5497('0xe')],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id',_0x5497('0x3')]}]},{'model':_0x5497('0xb'),'as':_0x5497('0x10'),'attributes':['id',_0x5497('0xd'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id',_0x5497('0x3')]}]},{'model':_0x5497('0xb'),'as':_0x5497('0x14'),'attributes':['id',_0x5497('0xd'),_0x5497('0x11'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),_0x5497('0xe')],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id','name']}]}]}]},'log':_0x5497('0x18')});};};
\ No newline at end of file
+var _0x687b=['Variable','Descriptions','key','keyType','variableName','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','name','ServicenowField','type','content'];(function(_0x37f9a7,_0x4e0ee1){var _0x14f662=function(_0x3578b4){while(--_0x3578b4){_0x37f9a7['push'](_0x37f9a7['shift']());}};_0x14f662(++_0x4e0ee1);}(_0x687b,0x14a));var _0xb687=function(_0x7c0646,_0x45d16b){_0x7c0646=_0x7c0646-0x0;var _0x32416d=_0x687b[_0x7c0646];return _0x32416d;};'use strict';var client=require(_0xb687('0x0'));exports[_0xb687('0x1')]=function(){return function(_0xd000be){return client[_0xb687('0x2')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id','name',_0xb687('0x3'),_0xb687('0x4'),_0xb687('0x5'),_0xb687('0x6'),_0xb687('0x7'),_0xb687('0x8')],'include':[{'model':_0xb687('0x9'),'as':_0xb687('0xa'),'attributes':['id',_0xb687('0xb')],'include':[{'model':_0xb687('0xc'),'as':'Subjects','attributes':['id',_0xb687('0xd'),_0xb687('0xe'),'variableName'],'include':[{'model':_0xb687('0xf'),'as':_0xb687('0xf'),'attributes':['id',_0xb687('0xb')]}]},{'model':_0xb687('0xc'),'as':_0xb687('0x10'),'attributes':['id',_0xb687('0xd'),_0xb687('0xe'),_0xb687('0x11'),_0xb687('0x12'),'keyContent',_0xb687('0x13')],'include':[{'model':_0xb687('0xf'),'as':_0xb687('0xf'),'attributes':['id',_0xb687('0xb')]}]},{'model':'ServicenowField','as':'Fields','attributes':['id',_0xb687('0xd'),_0xb687('0xe'),'idField',_0xb687('0x14'),_0xb687('0x15'),_0xb687('0x13')],'include':[{'model':_0xb687('0xf'),'as':_0xb687('0xf'),'attributes':['id',_0xb687('0xb')]}]}]}]},'log':_0xb687('0x16')});};};
\ No newline at end of file
index 61ab69e..6824405 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['nameField','customField','../../client','getSugarcrmAccounts','GetSugarcrmAccount','name','password','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','variableName','Fields','idField'];(function(_0x3228aa,_0x1590d2){var _0x15ac95=function(_0x433fa8){while(--_0x433fa8){_0x3228aa['push'](_0x3228aa['shift']());}};_0x15ac95(++_0x1590d2);}(_0x7a54,0x106));var _0x47a5=function(_0x506d0b,_0x59f459){_0x506d0b=_0x506d0b-0x0;var _0x41909a=_0x7a54[_0x506d0b];return _0x41909a;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'username',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6')],'include':[{'model':_0x47a5('0x7'),'as':_0x47a5('0x8'),'attributes':['id','name'],'include':[{'model':_0x47a5('0x9'),'as':'Subjects','attributes':['id',_0x47a5('0xa'),_0x47a5('0xb'),'variableName'],'include':[{'model':_0x47a5('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':'SugarcrmField','as':_0x47a5('0xd'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0xe'),'keyType','keyContent',_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0x9'),'as':_0x47a5('0x10'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]}]}]},'log':_0x47a5('0x2')});};};
\ No newline at end of file
+var _0xadb5=['idField','nameField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','serverUrl','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','Fields'];(function(_0x21bfc8,_0x2a67d2){var _0x2029c0=function(_0x637d60){while(--_0x637d60){_0x21bfc8['push'](_0x21bfc8['shift']());}};_0x2029c0(++_0x2a67d2);}(_0xadb5,0xad));var _0x5adb=function(_0x5dd652,_0x112fdc){_0x5dd652=_0x5dd652-0x0;var _0x552cc4=_0xadb5[_0x5dd652];return _0x552cc4;};'use strict';var client=require('../../client');exports[_0x5adb('0x0')]=function(){return function(_0x49fc17){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x3'),'username',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x5adb('0x7'),'attributes':['id',_0x5adb('0x3')],'include':[{'model':_0x5adb('0x8'),'as':_0x5adb('0x9'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id',_0x5adb('0x3')]}]},{'model':_0x5adb('0x8'),'as':_0x5adb('0xe'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),'key','keyType',_0x5adb('0xf'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':'Variable','attributes':['id',_0x5adb('0x3')]}]},{'model':'SugarcrmField','as':_0x5adb('0x10'),'attributes':['id','type',_0x5adb('0xb'),_0x5adb('0x11'),_0x5adb('0x12'),'customField',_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id','name']}]}]}]},'log':_0x5adb('0x2')});};};
\ No newline at end of file
index fa71a37..993122e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c11=['VtigerField','Subjects','type','variableName','Variable','content','key','keyType','keyContent','Fields','idField','nameField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','username','accessKey','remoteUri','serverUrl','VtigerConfiguration'];(function(_0x562fb6,_0x386906){var _0x5046e1=function(_0x2349ae){while(--_0x2349ae){_0x562fb6['push'](_0x562fb6['shift']());}};_0x5046e1(++_0x386906);}(_0x7c11,0x1c5));var _0x17c1=function(_0x417073,_0x162950){_0x417073=_0x417073-0x0;var _0x21834f=_0x7c11[_0x417073];return _0x21834f;};'use strict';var client=require('../../client');exports[_0x17c1('0x0')]=function(){return function(_0x559e1d){return client[_0x17c1('0x1')](_0x17c1('0x2'),{'options':{'raw':![],'attributes':['id',_0x17c1('0x3'),'description',_0x17c1('0x4'),_0x17c1('0x5'),_0x17c1('0x6'),_0x17c1('0x7')],'include':[{'model':_0x17c1('0x8'),'as':'Configurations','attributes':['id',_0x17c1('0x3')],'include':[{'model':_0x17c1('0x9'),'as':_0x17c1('0xa'),'attributes':['id',_0x17c1('0xb'),'content',_0x17c1('0xc')],'include':[{'model':_0x17c1('0xd'),'as':_0x17c1('0xd'),'attributes':['id',_0x17c1('0x3')]}]},{'model':_0x17c1('0x9'),'as':'Descriptions','attributes':['id','type',_0x17c1('0xe'),_0x17c1('0xf'),_0x17c1('0x10'),_0x17c1('0x11'),_0x17c1('0xc')],'include':[{'model':_0x17c1('0xd'),'as':_0x17c1('0xd'),'attributes':['id',_0x17c1('0x3')]}]},{'model':'VtigerField','as':_0x17c1('0x12'),'attributes':['id',_0x17c1('0xb'),'content',_0x17c1('0x13'),_0x17c1('0x14'),_0x17c1('0x15'),_0x17c1('0xc')],'include':[{'model':_0x17c1('0xd'),'as':_0x17c1('0xd'),'attributes':['id','name']}]}]}]},'log':_0x17c1('0x2')});};};
\ No newline at end of file
+var _0x5454=['content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','description','accessKey','serverUrl','VtigerConfiguration','Configurations','name','VtigerField','type'];(function(_0xf492f3,_0x52ef86){var _0xc7a378=function(_0x19c2ca){while(--_0x19c2ca){_0xf492f3['push'](_0xf492f3['shift']());}};_0xc7a378(++_0x52ef86);}(_0x5454,0x12f));var _0x4545=function(_0x5e8811,_0x580b2f){_0x5e8811=_0x5e8811-0x0;var _0x23aed5=_0x5454[_0x5e8811];return _0x23aed5;};'use strict';var client=require(_0x4545('0x0'));exports[_0x4545('0x1')]=function(){return function(_0x42f176){return client[_0x4545('0x2')](_0x4545('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4545('0x4'),'username',_0x4545('0x5'),'remoteUri',_0x4545('0x6')],'include':[{'model':_0x4545('0x7'),'as':_0x4545('0x8'),'attributes':['id',_0x4545('0x9')],'include':[{'model':_0x4545('0xa'),'as':'Subjects','attributes':['id',_0x4545('0xb'),_0x4545('0xc'),_0x4545('0xd')],'include':[{'model':_0x4545('0xe'),'as':_0x4545('0xe'),'attributes':['id',_0x4545('0x9')]}]},{'model':_0x4545('0xa'),'as':_0x4545('0xf'),'attributes':['id',_0x4545('0xb'),'content',_0x4545('0x10'),_0x4545('0x11'),_0x4545('0x12'),_0x4545('0xd')],'include':[{'model':_0x4545('0xe'),'as':_0x4545('0xe'),'attributes':['id',_0x4545('0x9')]}]},{'model':'VtigerField','as':_0x4545('0x13'),'attributes':['id','type',_0x4545('0xc'),'idField','nameField',_0x4545('0x14'),_0x4545('0xd')],'include':[{'model':_0x4545('0xe'),'as':_0x4545('0xe'),'attributes':['id',_0x4545('0x9')]}]}]}]},'log':_0x4545('0x3')});};};
\ No newline at end of file
index 201c1a9..cb24eb5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f7f=['Configurations','Tag','ZendeskField','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','remoteUri','authType','serverUrl','type','ZendeskConfiguration'];(function(_0x3e3527,_0x4f9564){var _0x1465cb=function(_0x16031d){while(--_0x16031d){_0x3e3527['push'](_0x3e3527['shift']());}};_0x1465cb(++_0x4f9564);}(_0x1f7f,0x152));var _0xf1f7=function(_0x3f2146,_0x4e86a4){_0x3f2146=_0x3f2146-0x0;var _0xc33e7d=_0x1f7f[_0x3f2146];return _0xc33e7d;};'use strict';var client=require(_0xf1f7('0x0'));exports[_0xf1f7('0x1')]=function(){return function(_0x48c4b6){return client[_0xf1f7('0x2')](_0xf1f7('0x3'),{'options':{'raw':![],'attributes':['id',_0xf1f7('0x4'),_0xf1f7('0x5'),_0xf1f7('0x6'),'token',_0xf1f7('0x7'),_0xf1f7('0x8'),_0xf1f7('0x9'),_0xf1f7('0xa')],'include':[{'model':_0xf1f7('0xb'),'as':_0xf1f7('0xc'),'attributes':['id',_0xf1f7('0x4')],'include':[{'model':_0xf1f7('0xd'),'attributes':['id',_0xf1f7('0x4')]},{'model':_0xf1f7('0xe'),'as':'Subjects','attributes':['id',_0xf1f7('0xa'),_0xf1f7('0xf'),_0xf1f7('0x10')],'include':[{'model':_0xf1f7('0x11'),'as':_0xf1f7('0x11'),'attributes':['id','name']}]},{'model':_0xf1f7('0xe'),'as':_0xf1f7('0x12'),'attributes':['id',_0xf1f7('0xa'),_0xf1f7('0xf'),_0xf1f7('0x13'),_0xf1f7('0x14'),_0xf1f7('0x15'),_0xf1f7('0x10')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xf1f7('0x4')]}]},{'model':_0xf1f7('0xe'),'as':_0xf1f7('0x16'),'attributes':['id',_0xf1f7('0xa'),'content',_0xf1f7('0x17'),'nameField',_0xf1f7('0x18'),'variableName'],'include':[{'model':_0xf1f7('0x11'),'as':'Variable','attributes':['id',_0xf1f7('0x4')]}]}]}]},'log':_0xf1f7('0x3')});};};
\ No newline at end of file
+var _0x7796=['Tag','variableName','Variable','ZendeskField','content','keyType','keyContent','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations'];(function(_0x143bef,_0x2ad880){var _0x23775c=function(_0x2a93cd){while(--_0x2a93cd){_0x143bef['push'](_0x143bef['shift']());}};_0x23775c(++_0x2ad880);}(_0x7796,0x1ed));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6779('0x0'));exports[_0x6779('0x1')]=function(){return function(_0x59d98a){return client[_0x6779('0x2')](_0x6779('0x3'),{'options':{'raw':![],'attributes':['id',_0x6779('0x4'),_0x6779('0x5'),'password',_0x6779('0x6'),_0x6779('0x7'),_0x6779('0x8'),_0x6779('0x9'),_0x6779('0xa')],'include':[{'model':_0x6779('0xb'),'as':_0x6779('0xc'),'attributes':['id','name'],'include':[{'model':_0x6779('0xd'),'attributes':['id',_0x6779('0x4')]},{'model':'ZendeskField','as':'Subjects','attributes':['id',_0x6779('0xa'),'content',_0x6779('0xe')],'include':[{'model':_0x6779('0xf'),'as':_0x6779('0xf'),'attributes':['id','name']}]},{'model':_0x6779('0x10'),'as':'Descriptions','attributes':['id',_0x6779('0xa'),_0x6779('0x11'),'key',_0x6779('0x12'),_0x6779('0x13'),_0x6779('0xe')],'include':[{'model':_0x6779('0xf'),'as':'Variable','attributes':['id',_0x6779('0x4')]}]},{'model':_0x6779('0x10'),'as':'Fields','attributes':['id',_0x6779('0xa'),'content',_0x6779('0x14'),_0x6779('0x15'),_0x6779('0x16'),'variableName'],'include':[{'model':'Variable','as':_0x6779('0xf'),'attributes':['id','name']}]}]}]},'log':_0x6779('0x3')});};};
\ No newline at end of file
index 1270e93..2bf8267 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x71fd=['clientId','clientSecret','code','refreshToken','ZohoConfiguration','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','Request','GetZohoAccount','name','description','host','zone'];(function(_0x36a4cd,_0x4a03cd){var _0xadb110=function(_0x4cdc10){while(--_0x4cdc10){_0x36a4cd['push'](_0x36a4cd['shift']());}};_0xadb110(++_0x4a03cd);}(_0x71fd,0x14c));var _0xd71f=function(_0x2c9905,_0x3c017b){_0x2c9905=_0x2c9905-0x0;var _0x3ece98=_0x71fd[_0x2c9905];return _0x3ece98;};'use strict';var client=require('../../client');exports['getZohoAccounts']=function(){return function(_0x1a66f2){return client[_0xd71f('0x0')](_0xd71f('0x1'),{'options':{'raw':![],'attributes':['id',_0xd71f('0x2'),_0xd71f('0x3'),_0xd71f('0x4'),_0xd71f('0x5'),_0xd71f('0x6'),_0xd71f('0x7'),'serverUrl',_0xd71f('0x8'),_0xd71f('0x9')],'include':[{'model':_0xd71f('0xa'),'as':'Configurations','attributes':['id',_0xd71f('0x2'),'moduleCreate',_0xd71f('0xb'),_0xd71f('0x3')],'include':[{'model':_0xd71f('0xc'),'as':_0xd71f('0xd'),'attributes':['id',_0xd71f('0xe'),_0xd71f('0xf'),_0xd71f('0x10')],'include':[{'model':'Variable','as':_0xd71f('0x11'),'attributes':['id',_0xd71f('0x2')]}]},{'model':_0xd71f('0xc'),'as':_0xd71f('0x12'),'attributes':['id',_0xd71f('0xe'),_0xd71f('0xf'),_0xd71f('0x13'),_0xd71f('0x14'),_0xd71f('0x15'),'variableName'],'include':[{'model':_0xd71f('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xd71f('0xc'),'as':_0xd71f('0x16'),'attributes':['id',_0xd71f('0xe'),_0xd71f('0xf'),_0xd71f('0x17'),_0xd71f('0x18'),_0xd71f('0x19'),_0xd71f('0x10')],'include':[{'model':_0xd71f('0x11'),'as':_0xd71f('0x11'),'attributes':['id',_0xd71f('0x2')]}]}]}]},'log':_0xd71f('0x1')});};};
\ No newline at end of file
+var _0x29aa=['refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','type','content','variableName','Variable','ZohoField','Descriptions','keyType','keyContent','Fields','idField','nameField','GetZohoAccount','../../client','getZohoAccounts','name','description','host','zone','clientId','serverUrl'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x29aa,0xb8));var _0xa29a=function(_0x59e6bb,_0x2ac140){_0x59e6bb=_0x59e6bb-0x0;var _0x500e20=_0x29aa[_0x59e6bb];return _0x500e20;};'use strict';var client=require(_0xa29a('0x0'));exports[_0xa29a('0x1')]=function(){return function(_0x413cb9){return client['Request']('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xa29a('0x2'),_0xa29a('0x3'),_0xa29a('0x4'),_0xa29a('0x5'),_0xa29a('0x6'),'clientSecret',_0xa29a('0x7'),'code',_0xa29a('0x8')],'include':[{'model':_0xa29a('0x9'),'as':'Configurations','attributes':['id',_0xa29a('0x2'),_0xa29a('0xa'),_0xa29a('0xb'),_0xa29a('0x3')],'include':[{'model':'ZohoField','as':'Subjects','attributes':['id',_0xa29a('0xc'),_0xa29a('0xd'),_0xa29a('0xe')],'include':[{'model':_0xa29a('0xf'),'as':_0xa29a('0xf'),'attributes':['id',_0xa29a('0x2')]}]},{'model':_0xa29a('0x10'),'as':_0xa29a('0x11'),'attributes':['id',_0xa29a('0xc'),'content','key',_0xa29a('0x12'),_0xa29a('0x13'),_0xa29a('0xe')],'include':[{'model':_0xa29a('0xf'),'as':_0xa29a('0xf'),'attributes':['id',_0xa29a('0x2')]}]},{'model':_0xa29a('0x10'),'as':_0xa29a('0x14'),'attributes':['id',_0xa29a('0xc'),'content',_0xa29a('0x15'),_0xa29a('0x16'),'customField',_0xa29a('0xe')],'include':[{'model':_0xa29a('0xf'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xa29a('0x17')});};};
\ No newline at end of file
index 947b52a..b521481 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb962=['interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','replace','trim','silly','isArray','length','resolve','every','number','string','map'];(function(_0x1d2d68,_0x4b9088){var _0x34477f=function(_0x586a85){while(--_0x586a85){_0x1d2d68['push'](_0x1d2d68['shift']());}};_0x34477f(++_0x4b9088);}(_0xb962,0x77));var _0x2b96=function(_0x28dbc6,_0x26a6d7){_0x28dbc6=_0x28dbc6-0x0;var _0x5c2304=_0xb962[_0x28dbc6];return _0x5c2304;};var logger=require(_0x2b96('0x0'))(_0x2b96('0x1'));var client=require(_0x2b96('0x2'));function intervalIftime(_0x2f8914,_0x2b8561){const _0x27538e=new Error()[_0x2b96('0x3')][_0x2b96('0x4')](/^Error/,'')[_0x2b96('0x5')]();logger[_0x2b96('0x6')]('intervalIftime\x20called\x20with',_0x2f8914,_0x2b8561,_0x27538e);const _0x404dd3=Array[_0x2b96('0x7')](_0x2f8914);if(!_0x2f8914||_0x404dd3&&_0x2f8914[_0x2b96('0x8')]===0x0){return Promise[_0x2b96('0x9')](![]);}else{var _0x1c3ee=[];var _0x4c1042=[];var _0x1dbc3e=_0x404dd3?_0x2f8914:[_0x2f8914];var _0x3e3d98=_0x1dbc3e[_0x2b96('0xa')](function(_0x403100){return typeof _0x403100===_0x2b96('0xb');});var _0x2b7aab=_0x1dbc3e['every'](function(_0x3d68f5){return typeof _0x3d68f5===_0x2b96('0xc');});if(!_0x3e3d98&&!_0x2b7aab){_0x1c3ee=_0x1dbc3e['map'](function(_0x18ff05){return _0x18ff05['id'];});if(_0x1c3ee[_0x2b96('0x8')]===0x0){_0x4c1042=_0x1dbc3e[_0x2b96('0xd')](function(_0x537626){return _0x537626[_0x2b96('0xe')];});}}else{if(_0x3e3d98){_0x1c3ee=_0x1c3ee[_0x2b96('0xf')](_0x1dbc3e);}if(_0x2b7aab){_0x4c1042=_0x4c1042[_0x2b96('0xf')](_0x1dbc3e);}}return client[_0x2b96('0x10')](_0x2b96('0x11'),{'intervalIds':_0x1c3ee,'intervals':_0x4c1042,'timezone':_0x2b8561,'log':'IntervalIftime'});}}exports[_0x2b96('0x12')]=intervalIftime;
\ No newline at end of file
+var _0x617d=['number','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','stack','replace','trim','isArray','resolve','every'];(function(_0x4a2ff1,_0x13de3b){var _0x106aa7=function(_0x433dca){while(--_0x433dca){_0x4a2ff1['push'](_0x4a2ff1['shift']());}};_0x106aa7(++_0x13de3b);}(_0x617d,0xc8));var _0xd617=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x617d[_0x19e35c];return _0x3e1fe8;};var logger=require(_0xd617('0x0'))(_0xd617('0x1'));var client=require('../client');function intervalIftime(_0x45b7be,_0x40b054){const _0x3d7f85=new Error()[_0xd617('0x2')][_0xd617('0x3')](/^Error/,'')[_0xd617('0x4')]();logger['silly']('intervalIftime\x20called\x20with',_0x45b7be,_0x40b054,_0x3d7f85);const _0x3342aa=Array[_0xd617('0x5')](_0x45b7be);if(!_0x45b7be||_0x3342aa&&_0x45b7be['length']===0x0){return Promise[_0xd617('0x6')](![]);}else{var _0x5f3c66=[];var _0x21be1e=[];var _0x213a8c=_0x3342aa?_0x45b7be:[_0x45b7be];var _0x309b07=_0x213a8c[_0xd617('0x7')](function(_0x4b0045){return typeof _0x4b0045===_0xd617('0x8');});var _0x9ab01e=_0x213a8c['every'](function(_0x15e9cd){return typeof _0x15e9cd===_0xd617('0x9');});if(!_0x309b07&&!_0x9ab01e){_0x5f3c66=_0x213a8c[_0xd617('0xa')](function(_0x5dae04){return _0x5dae04['id'];});if(_0x5f3c66['length']===0x0){_0x21be1e=_0x213a8c[_0xd617('0xa')](function(_0x34170c){return _0x34170c[_0xd617('0xb')];});}}else{if(_0x309b07){_0x5f3c66=_0x5f3c66[_0xd617('0xc')](_0x213a8c);}if(_0x9ab01e){_0x21be1e=_0x21be1e[_0xd617('0xc')](_0x213a8c);}}return client[_0xd617('0xd')]('IntervalIftime',{'intervalIds':_0x5f3c66,'intervals':_0x21be1e,'timezone':_0x40b054,'log':_0xd617('0xe')});}}exports[_0xd617('0xf')]=intervalIftime;
\ No newline at end of file
index d4ea324..8b22138 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e34=['CreateMemberReport','membername','starttime','endtime','diff','accountcode','dialstring','agent','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','seconds','inbound','calleridnum','exten','queue','toNumber','uniqueid','voiceDialReport'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0x9e34,0x152));var _0x49e3=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x9e34[_0x26462c];return _0x509a42;};'use strict';var moment=require(_0x49e3('0x0'));var _=require(_0x49e3('0x1'));var util=require(_0x49e3('0x2'));var client=require(_0x49e3('0x3'));exports[_0x49e3('0x4')]=function(_0x2cb84b){var _0x1a7831=_0x2cb84b['queuecallercompleteAt']||_0x2cb84b[_0x49e3('0x5')];return client[_0x49e3('0x6')]('CreateMemberReport',{'body':{'channel':_0x49e3('0x7'),'membername':_0x2cb84b[_0x49e3('0x8')],'interface':_[_0x49e3('0x9')](_0x2cb84b[_0x49e3('0xa')])?util[_0x49e3('0xb')](_0x49e3('0xc'),_0x2cb84b['lastAssignedTo']):_0x2cb84b['interface'],'type':_0x49e3('0xd'),'enterAt':_0x2cb84b['queuecallerleaveAt'],'exitAt':_0x1a7831,'duration':moment(_0x1a7831)['diff'](_0x2cb84b['queuecallerleaveAt'],_0x49e3('0xe')),'data1':_0x49e3('0xf'),'data2':_0x2cb84b[_0x49e3('0x10')],'data3':_0x2cb84b[_0x49e3('0x11')],'data4':null,'data5':_0x2cb84b[_0x49e3('0x12')],'role':'agent','internal':_0x2cb84b['accountcode']?_[_0x49e3('0x13')](_0x2cb84b['accountcode']):undefined,'uniqueid':_0x2cb84b[_0x49e3('0x14')]},'log':'CreateMemberReport'});};exports[_0x49e3('0x15')]=function(_0x4ec699){return client[_0x49e3('0x6')](_0x49e3('0x16'),{'body':{'channel':_0x49e3('0x7'),'membername':_0x4ec699[_0x49e3('0x17')],'interface':_0x4ec699[_0x49e3('0xa')],'type':_0x49e3('0xd'),'enterAt':_0x4ec699[_0x49e3('0x18')],'exitAt':_0x4ec699[_0x49e3('0x19')],'duration':moment(_0x4ec699[_0x49e3('0x19')])[_0x49e3('0x1a')](_0x4ec699[_0x49e3('0x18')],'seconds')>=0x0?moment(_0x4ec699['endtime'])[_0x49e3('0x1a')](_0x4ec699[_0x49e3('0x18')],_0x49e3('0xe')):null,'data1':'outbound','data2':_0x4ec699[_0x49e3('0x1b')],'data3':_0x4ec699['exten'],'data4':_0x4ec699[_0x49e3('0x1c')]||null,'role':_0x49e3('0x1d'),'internal':_0x4ec699[_0x49e3('0x1b')]?_[_0x49e3('0x13')](_0x4ec699[_0x49e3('0x1b')]):undefined,'uniqueid':_0x4ec699[_0x49e3('0x14')]},'log':_0x49e3('0x16')});};
\ No newline at end of file
+var _0x3d8c=['voiceDialReport','membername','TALKING','starttime','endtime','seconds','outbound','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','queuecallerleaveAt','diff','inbound','exten','queue','agent','accountcode','toNumber','uniqueid'];(function(_0x4d9e88,_0x70a2ad){var _0x3a1694=function(_0x2910be){while(--_0x2910be){_0x4d9e88['push'](_0x4d9e88['shift']());}};_0x3a1694(++_0x70a2ad);}(_0x3d8c,0x13f));var _0xc3d8=function(_0x7b68cc,_0x3f522e){_0x7b68cc=_0x7b68cc-0x0;var _0x36470e=_0x3d8c[_0x7b68cc];return _0x36470e;};'use strict';var moment=require(_0xc3d8('0x0'));var _=require(_0xc3d8('0x1'));var util=require('util');var client=require(_0xc3d8('0x2'));exports[_0xc3d8('0x3')]=function(_0x483cb4){var _0x489dba=_0x483cb4['queuecallercompleteAt']||_0x483cb4[_0xc3d8('0x4')];return client[_0xc3d8('0x5')](_0xc3d8('0x6'),{'body':{'channel':_0xc3d8('0x7'),'membername':_0x483cb4[_0xc3d8('0x8')],'interface':_['isNil'](_0x483cb4[_0xc3d8('0x9')])?util['format']('SIP/%s',_0x483cb4['lastAssignedTo']):_0x483cb4[_0xc3d8('0x9')],'type':'TALKING','enterAt':_0x483cb4[_0xc3d8('0xa')],'exitAt':_0x489dba,'duration':moment(_0x489dba)[_0xc3d8('0xb')](_0x483cb4[_0xc3d8('0xa')],'seconds'),'data1':_0xc3d8('0xc'),'data2':_0x483cb4['calleridnum'],'data3':_0x483cb4[_0xc3d8('0xd')],'data4':null,'data5':_0x483cb4[_0xc3d8('0xe')],'role':_0xc3d8('0xf'),'internal':_0x483cb4[_0xc3d8('0x10')]?_[_0xc3d8('0x11')](_0x483cb4[_0xc3d8('0x10')]):undefined,'uniqueid':_0x483cb4[_0xc3d8('0x12')]},'log':_0xc3d8('0x6')});};exports[_0xc3d8('0x13')]=function(_0x43971c){return client[_0xc3d8('0x5')](_0xc3d8('0x6'),{'body':{'channel':_0xc3d8('0x7'),'membername':_0x43971c[_0xc3d8('0x14')],'interface':_0x43971c[_0xc3d8('0x9')],'type':_0xc3d8('0x15'),'enterAt':_0x43971c[_0xc3d8('0x16')],'exitAt':_0x43971c[_0xc3d8('0x17')],'duration':moment(_0x43971c[_0xc3d8('0x17')])[_0xc3d8('0xb')](_0x43971c['starttime'],_0xc3d8('0x18'))>=0x0?moment(_0x43971c[_0xc3d8('0x17')])[_0xc3d8('0xb')](_0x43971c[_0xc3d8('0x16')],'seconds'):null,'data1':_0xc3d8('0x19'),'data2':_0x43971c['accountcode'],'data3':_0x43971c['exten'],'data4':_0x43971c['dialstring']||null,'role':_0xc3d8('0xf'),'internal':_0x43971c['accountcode']?_[_0xc3d8('0x11')](_0x43971c['accountcode']):undefined,'uniqueid':_0x43971c[_0xc3d8('0x12')]},'log':_0xc3d8('0x6')});};
\ No newline at end of file
index 7ecf2c3..83ff7bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a6e=['getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0x6a6e[_0x20e7e3];return _0x14b9de;};'use strict';var client=require(_0xe6a6('0x0'));exports[_0xe6a6('0x1')]=function(){return client['Request'](_0xe6a6('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe6a6('0x3'),_0xe6a6('0x4')]},'log':_0xe6a6('0x5')});};
\ No newline at end of file
+var _0x3940=['GetSettings','../client','getSettings','ShowSetting','previewRecallmeReminderInterval'];(function(_0x42a78a,_0x448e89){var _0x398d4e=function(_0x6138){while(--_0x6138){_0x42a78a['push'](_0x42a78a['shift']());}};_0x398d4e(++_0x448e89);}(_0x3940,0xa6));var _0x0394=function(_0x1a13b8,_0x351661){_0x1a13b8=_0x1a13b8-0x0;var _0x4f8aed=_0x3940[_0x1a13b8];return _0x4f8aed;};'use strict';var client=require(_0x0394('0x0'));exports[_0x0394('0x1')]=function(){return client['Request'](_0x0394('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x0394('0x3')]},'log':_0x0394('0x4')});};
\ No newline at end of file
index abdfe69..20be600 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa22=['html','Request','GetTemplate','name'];(function(_0x45e56c,_0x4235d0){var _0x4826ef=function(_0x18ae28){while(--_0x18ae28){_0x45e56c['push'](_0x45e56c['shift']());}};_0x4826ef(++_0x4235d0);}(_0xaa22,0x1dd));var _0x2aa2=function(_0xd9f14e,_0x17a647){_0xd9f14e=_0xd9f14e-0x0;var _0x252791=_0xaa22[_0xd9f14e];return _0x252791;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4532ae){return function(_0x54c0bb){return client[_0x2aa2('0x0')](_0x2aa2('0x1'),{'options':{'raw':!![],'attributes':['id',_0x2aa2('0x2'),_0x2aa2('0x3')]},'log':_0x2aa2('0x1')});};};
\ No newline at end of file
+var _0xc462=['../client','Request','GetTemplate','name','html'];(function(_0x50d8da,_0xe56e5b){var _0x1b55bb=function(_0x5c15eb){while(--_0x5c15eb){_0x50d8da['push'](_0x50d8da['shift']());}};_0x1b55bb(++_0xe56e5b);}(_0xc462,0x1d6));var _0x2c46=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc462[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0x2c46('0x0'));exports['getTemplates']=function(_0x216110){return function(_0x4d1f26){return client[_0x2c46('0x1')](_0x2c46('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2c46('0x3'),_0x2c46('0x4')]},'log':'GetTemplate'});};};
\ No newline at end of file
index 103c88a..e7f80ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac7d=['Actions','action','data1','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','AllConditions','Condition','AnyConditions','operator','value','Action'];(function(_0x411490,_0x52a6c2){var _0x4ea60a=function(_0x43fe8d){while(--_0x43fe8d){_0x411490['push'](_0x411490['shift']());}};_0x4ea60a(++_0x52a6c2);}(_0xac7d,0x158));var _0xdac7=function(_0x3359ce,_0x348b97){_0x3359ce=_0x3359ce-0x0;var _0x5ee2cc=_0xac7d[_0x3359ce];return _0x5ee2cc;};'use strict';var client=require(_0xdac7('0x0'));exports[_0xdac7('0x1')]=function(_0xde832){return function(_0x28b692){return client[_0xdac7('0x2')](_0xdac7('0x3'),{'options':{'raw':![],'attributes':['id',_0xdac7('0x4'),_0xdac7('0x5'),_0xdac7('0x6')],'include':[{'model':'Condition','as':_0xdac7('0x7'),'attributes':['id','field','operator','value']},{'model':_0xdac7('0x8'),'as':_0xdac7('0x9'),'attributes':['id','field',_0xdac7('0xa'),_0xdac7('0xb')]},{'model':_0xdac7('0xc'),'as':_0xdac7('0xd'),'attributes':['id',_0xdac7('0xe'),_0xdac7('0xf'),_0xdac7('0x10'),'data3',_0xdac7('0x11'),_0xdac7('0x12'),_0xdac7('0x13'),_0xdac7('0x14')]}]},'log':'GetTrigger'});};};
\ No newline at end of file
+var _0xcb9c=['action','data1','data2','data3','data4','data5','data6','../client','Request','GetTrigger','name','status','Condition','field','operator','value','AnyConditions','Action','Actions'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcb9c,0x9f));var _0xccb9=function(_0x430a4b,_0x40e7fe){_0x430a4b=_0x430a4b-0x0;var _0x3f7e9a=_0xcb9c[_0x430a4b];return _0x3f7e9a;};'use strict';var client=require(_0xccb9('0x0'));exports['getTriggers']=function(_0x19a666){return function(_0x126103){return client[_0xccb9('0x1')](_0xccb9('0x2'),{'options':{'raw':![],'attributes':['id',_0xccb9('0x3'),'channel',_0xccb9('0x4')],'include':[{'model':_0xccb9('0x5'),'as':'AllConditions','attributes':['id',_0xccb9('0x6'),_0xccb9('0x7'),_0xccb9('0x8')]},{'model':_0xccb9('0x5'),'as':_0xccb9('0x9'),'attributes':['id','field',_0xccb9('0x7'),'value']},{'model':_0xccb9('0xa'),'as':_0xccb9('0xb'),'attributes':['id',_0xccb9('0xc'),_0xccb9('0xd'),_0xccb9('0xe'),_0xccb9('0xf'),_0xccb9('0x10'),_0xccb9('0x11'),_0xccb9('0x12'),'data7']}]},'log':_0xccb9('0x2')});};};
\ No newline at end of file
index 95751df..c39e0ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2544=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x2cbb64,_0xe2f568){var _0x3b812b=function(_0x4db0b9){while(--_0x4db0b9){_0x2cbb64['push'](_0x2cbb64['shift']());}};_0x3b812b(++_0xe2f568);}(_0x2544,0x8b));var _0x4254=function(_0x44fc7c,_0x54a2cf){_0x44fc7c=_0x44fc7c-0x0;var _0x152f52=_0x2544[_0x44fc7c];return _0x152f52;};'use strict';var client=require(_0x4254('0x0'));exports['getTrunks']=function(_0x4b1454){return function(_0xd93755){return client[_0x4254('0x1')](_0x4254('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4254('0x3'),_0x4254('0x4'),_0x4254('0x5')]},'log':'GetTrunk'});};};
\ No newline at end of file
+var _0xdcdc=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x41ce19,_0x3f26d2){var _0x1a6eeb=function(_0x283d74){while(--_0x283d74){_0x41ce19['push'](_0x41ce19['shift']());}};_0x1a6eeb(++_0x3f26d2);}(_0xdcdc,0x8c));var _0xcdcd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcdc[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xcdcd('0x0'));exports[_0xcdcd('0x1')]=function(_0x33f233){return function(_0x2a3eef){return client[_0xcdcd('0x2')](_0xcdcd('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcdcd('0x4'),_0xcdcd('0x5'),_0xcdcd('0x6')]},'log':'GetTrunk'});};};
\ No newline at end of file
index cdf3212..6537760 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe706,0xa3));var _0x6e70=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xe706[_0x5caf7e];return _0x5c3435;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});};
\ No newline at end of file
+var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x342d00,_0x458344){var _0xc4bd64=function(_0x5ee7bf){while(--_0x5ee7bf){_0x342d00['push'](_0x342d00['shift']());}};_0xc4bd64(++_0x458344);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f5f4f,_0x550228){_0x3f5f4f=_0x3f5f4f-0x0;var _0x4690ba=_0xedd9[_0x3f5f4f];return _0x4690ba;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});};
\ No newline at end of file
index 0744503..4533fe1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x139d=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x4bce41,_0x2ca87c){var _0x56d241=function(_0x40a21f){while(--_0x40a21f){_0x4bce41['push'](_0x4bce41['shift']());}};_0x56d241(++_0x2ca87c);}(_0x139d,0x100));var _0xd139=function(_0x5204f9,_0x3f782c){_0x5204f9=_0x5204f9-0x0;var _0x4677c5=_0x139d[_0x5204f9];return _0x4677c5;};'use strict';var client=require(_0xd139('0x0'));exports[_0xd139('0x1')]=function(_0x2a3062){return client[_0xd139('0x2')](_0xd139('0x3'),{'body':_0x2a3062,'log':_0xd139('0x3')});};exports[_0xd139('0x4')]=function(_0x4fa92c,_0x443364,_0x2fc0fa){return client[_0xd139('0x2')](_0xd139('0x5'),{'body':_0x4fa92c,'options':{'where':{'uniqueid':_0x443364,'interface':_0x2fc0fa,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});};
\ No newline at end of file
+var _0xea70=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x2d3149,_0x417841){var _0x108b8b=function(_0x14c1a8){while(--_0x14c1a8){_0x2d3149['push'](_0x2d3149['shift']());}};_0x108b8b(++_0x417841);}(_0xea70,0x117));var _0x0ea7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xea70[_0x4565bf];return _0x5610ba;};'use strict';var client=require('../client');exports[_0x0ea7('0x0')]=function(_0x3066f8){return client[_0x0ea7('0x1')]('CreateVoiceAgentReport',{'body':_0x3066f8,'log':_0x0ea7('0x2')});};exports[_0x0ea7('0x3')]=function(_0x5a420e,_0x5de33d,_0x3fd8c9){return client['Request']('UpdateVoiceAgentReport',{'body':_0x5a420e,'options':{'where':{'uniqueid':_0x5de33d,'interface':_0x3fd8c9,'agentcomplete':!![]}},'log':_0x0ea7('0x4')});};
\ No newline at end of file
index 6f148f4..2137f03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4957=['calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','moment','lodash','../client','Request','CreateVoiceCallReport','merge'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x4957,0x14e));var _0x7495=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x4957[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x7495('0x0'));var util=require('util');var _=require(_0x7495('0x1'));var client=require(_0x7495('0x2'));exports['create']=function(_0x5b8033){return client[_0x7495('0x3')](_0x7495('0x4'),{'body':_[_0x7495('0x5')](_0x5b8033,{'source':_0x5b8033[_0x7495('0x6')],'destinationcontext':_0x5b8033['context'],'callerid':_0x5b8033['callerid'],'amaflags':_0x7495('0x7')}),'log':_0x7495('0x4')});};exports[_0x7495('0x8')]=function(){return function(){return client[_0x7495('0x3')](_0x7495('0x9'),{'options':{'where':{'type':[_0x7495('0xa')],'createdAt':{'$between':[moment()[_0x7495('0xb')]('day')[_0x7495('0xc')](_0x7495('0xd')),moment()['endOf'](_0x7495('0xe'))[_0x7495('0xc')](_0x7495('0xd'))]}},'attributes':[_0x7495('0xf'),_0x7495('0x10'),'duration','billableseconds']},'log':'GetVoiceCallReports'});};};
\ No newline at end of file
+var _0x2af5=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x1693f4,_0x1d20d8){var _0x147e20=function(_0x24ff2e){while(--_0x24ff2e){_0x1693f4['push'](_0x1693f4['shift']());}};_0x147e20(++_0x1d20d8);}(_0x2af5,0x7d));var _0x52af=function(_0x412b6e,_0x4245c8){_0x412b6e=_0x412b6e-0x0;var _0xd9b9d5=_0x2af5[_0x412b6e];return _0xd9b9d5;};'use strict';var moment=require(_0x52af('0x0'));var util=require('util');var _=require(_0x52af('0x1'));var client=require(_0x52af('0x2'));exports[_0x52af('0x3')]=function(_0x544cfc){return client[_0x52af('0x4')](_0x52af('0x5'),{'body':_[_0x52af('0x6')](_0x544cfc,{'source':_0x544cfc[_0x52af('0x7')],'destinationcontext':_0x544cfc[_0x52af('0x8')],'callerid':_0x544cfc[_0x52af('0x9')],'amaflags':_0x52af('0xa')}),'log':_0x52af('0x5')});};exports[_0x52af('0xb')]=function(){return function(){return client[_0x52af('0x4')](_0x52af('0xc'),{'options':{'where':{'type':[_0x52af('0xd')],'createdAt':{'$between':[moment()[_0x52af('0xe')](_0x52af('0xf'))[_0x52af('0x10')](_0x52af('0x11')),moment()['endOf'](_0x52af('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x52af('0x12'),_0x52af('0x13'),_0x52af('0x14'),_0x52af('0x15')]},'log':'GetVoiceCallReports'});};};
\ No newline at end of file
index 7e27ce4..b97f3c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x47e0=['create','Request','CreateVoiceDialReport','../client'];(function(_0x4a9d73,_0x404b5f){var _0x2544c1=function(_0x45c894){while(--_0x45c894){_0x4a9d73['push'](_0x4a9d73['shift']());}};_0x2544c1(++_0x404b5f);}(_0x47e0,0x19b));var _0x047e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x47e0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x047e('0x0'));exports[_0x047e('0x1')]=function(_0x7e9de6){return client[_0x047e('0x2')](_0x047e('0x3'),{'body':_0x7e9de6,'log':_0x047e('0x3')});};
\ No newline at end of file
+var _0x4c3e=['../client','create','Request','CreateVoiceDialReport'];(function(_0xb46fb6,_0x33dfb5){var _0x1fc563=function(_0x4d2d92){while(--_0x4d2d92){_0xb46fb6['push'](_0xb46fb6['shift']());}};_0x1fc563(++_0x33dfb5);}(_0x4c3e,0xd8));var _0xe4c3=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x4c3e[_0x29b609];return _0x54c952;};'use strict';var client=require(_0xe4c3('0x0'));exports[_0xe4c3('0x1')]=function(_0x2a7f6a){return client[_0xe4c3('0x2')](_0xe4c3('0x3'),{'body':_0x2a7f6a,'log':'CreateVoiceDialReport'});};
\ No newline at end of file
index 414b2ce..f3aac8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf4c=['recordingFormat','getVoiceExtensions','Request','exten'];(function(_0x37b0b7,_0x3f9649){var _0x14d884=function(_0x1e9e8e){while(--_0x1e9e8e){_0x37b0b7['push'](_0x37b0b7['shift']());}};_0x14d884(++_0x3f9649);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x343a7f,_0x3a535b){_0x343a7f=_0x343a7f-0x0;var _0x15d65d=_0xaf4c[_0x343a7f];return _0x15d65d;};'use strict';var client=require('../client');exports[_0xcaf4('0x0')]=function(){return function(){return client[_0xcaf4('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xcaf4('0x2'),_0xcaf4('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xcaf4('0x0')});};};
\ No newline at end of file
+var _0x9c44=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x27092f,_0x90f7d9){var _0x47b478=function(_0x2184d8){while(--_0x2184d8){_0x27092f['push'](_0x27092f['shift']());}};_0x47b478(++_0x90f7d9);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x49c4('0x4')});};};
\ No newline at end of file
index c281da3..e65b26d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08dc=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','interval','../client','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence'];(function(_0x506161,_0x4437fc){var _0x1ba970=function(_0x36b1f4){while(--_0x36b1f4){_0x506161['push'](_0x506161['shift']());}};_0x1ba970(++_0x4437fc);}(_0x08dc,0x1e8));var _0xc08d=function(_0x23cd03,_0x55adec){_0x23cd03=_0x23cd03-0x0;var _0xcb6763=_0x08dc[_0x23cd03];return _0xcb6763;};'use strict';var client=require(_0xc08d('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc08d('0x1')](_0xc08d('0x2'),{'options':{'raw':![],'attributes':['id',_0xc08d('0x3'),'acw',_0xc08d('0x4'),'autopause',_0xc08d('0x5'),_0xc08d('0x6'),_0xc08d('0x7'),_0xc08d('0x8'),'dialLimitChannel',_0xc08d('0x9'),_0xc08d('0xa'),'dialPredictiveOptimization',_0xc08d('0xb'),'dialPredictiveInterval',_0xc08d('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xc08d('0xd'),'dialQueueTimeout',_0xc08d('0xe'),_0xc08d('0xf'),_0xc08d('0x10'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xc08d('0x11'),_0xc08d('0x12'),_0xc08d('0x13'),'dialTimezone',_0xc08d('0x14'),_0xc08d('0x15'),_0xc08d('0x16'),_0xc08d('0x17'),_0xc08d('0x18'),_0xc08d('0x19'),_0xc08d('0x1a'),'dialAMDTotalAnalysisTime',_0xc08d('0x1b'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xc08d('0x1c'),'dialAMDMaximumWordLength',_0xc08d('0x1d'),_0xc08d('0x1e'),_0xc08d('0x1f'),_0xc08d('0x20'),_0xc08d('0x21'),'dialAgiAfterHangupClient',_0xc08d('0x22'),_0xc08d('0x5'),'strategy',_0xc08d('0x23'),_0xc08d('0x24'),_0xc08d('0x25'),_0xc08d('0x26'),_0xc08d('0x27'),_0xc08d('0x28'),_0xc08d('0x29'),_0xc08d('0x2a'),'dialMachineMaxRetry',_0xc08d('0x2b'),'dialAgentRejectMaxRetry',_0xc08d('0x2c'),_0xc08d('0x2d'),_0xc08d('0x2e'),_0xc08d('0x2f'),_0xc08d('0x30'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xc08d('0x31'),'as':_0xc08d('0x31'),'attributes':['id',_0xc08d('0x3'),'callerid',_0xc08d('0x32')]},{'model':_0xc08d('0x33'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xc08d('0x31'),'as':_0xc08d('0x34'),'attributes':['id',_0xc08d('0x3'),_0xc08d('0x35'),_0xc08d('0x32')]},{'model':_0xc08d('0x36'),'as':'Interval','attributes':['id',_0xc08d('0x3')],'include':[{'model':'Interval','as':_0xc08d('0x37'),'attributes':['id',_0xc08d('0x3'),_0xc08d('0x38')]}]}]},'log':'getVoiceQueues'});};};
\ No newline at end of file
+var _0x5d0b=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialAMDActive','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName'];(function(_0xd69266,_0x219cab){var _0x28bc95=function(_0x5f5959){while(--_0x5f5959){_0xd69266['push'](_0xd69266['shift']());}};_0x28bc95(++_0x219cab);}(_0x5d0b,0x16b));var _0xb5d0=function(_0xe34ce5,_0x1a08c7){_0xe34ce5=_0xe34ce5-0x0;var _0x3067ec=_0x5d0b[_0xe34ce5];return _0x3067ec;};'use strict';var client=require(_0xb5d0('0x0'));exports[_0xb5d0('0x1')]=function(){return function(){return client[_0xb5d0('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xb5d0('0x3'),'acw',_0xb5d0('0x4'),_0xb5d0('0x5'),_0xb5d0('0x6'),_0xb5d0('0x7'),_0xb5d0('0x8'),_0xb5d0('0x9'),_0xb5d0('0xa'),'dialLimitQueue','dialPowerLevel',_0xb5d0('0xb'),_0xb5d0('0xc'),_0xb5d0('0xd'),_0xb5d0('0xe'),_0xb5d0('0xf'),_0xb5d0('0x10'),_0xb5d0('0x11'),_0xb5d0('0x12'),_0xb5d0('0x13'),_0xb5d0('0x14'),_0xb5d0('0x15'),'dialBusyMaxRetry',_0xb5d0('0x16'),'dialNoAnswerMaxRetry',_0xb5d0('0x17'),_0xb5d0('0x18'),'dialTimezone','dialGlobalInterval',_0xb5d0('0x19'),'dialCheckDuplicateType',_0xb5d0('0x1a'),'dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence',_0xb5d0('0x1b'),_0xb5d0('0x1c'),_0xb5d0('0x1d'),_0xb5d0('0x1e'),_0xb5d0('0x1f'),_0xb5d0('0x20'),'timeout',_0xb5d0('0x21'),'dialRecallInQueue',_0xb5d0('0x22'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xb5d0('0x23'),_0xb5d0('0x6'),_0xb5d0('0x24'),'dialRandomLastDigitCallerIdNumber',_0xb5d0('0x25'),_0xb5d0('0x26'),'dialNoSuchNumberRetryFrequency',_0xb5d0('0x27'),_0xb5d0('0x28'),_0xb5d0('0x29'),'dialAbandonedRetryFrequency',_0xb5d0('0x2a'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xb5d0('0x2b'),_0xb5d0('0x2c'),_0xb5d0('0x2d'),_0xb5d0('0x2e'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0xb5d0('0x2f'),'as':'Trunk','attributes':['id',_0xb5d0('0x3'),'callerid',_0xb5d0('0x30')]},{'model':_0xb5d0('0x31'),'as':'mandatoryDispositionPause','attributes':['id',_0xb5d0('0x3')]},{'model':_0xb5d0('0x2f'),'as':_0xb5d0('0x32'),'attributes':['id','name',_0xb5d0('0x33'),_0xb5d0('0x30')]},{'model':_0xb5d0('0x34'),'as':_0xb5d0('0x34'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xb5d0('0x35'),'attributes':['id',_0xb5d0('0x3'),'interval']}]}]},'log':_0xb5d0('0x1')});};};
\ No newline at end of file
index 7d83ea2..d8293e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0xc7536,_0x607ae){var _0x483ede=function(_0x47941c){while(--_0x47941c){_0xc7536['push'](_0xc7536['shift']());}};_0x483ede(++_0x607ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};};
\ No newline at end of file
+var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x166bde,_0x1a36e8){var _0x1b0334=function(_0x31762c){while(--_0x31762c){_0x166bde['push'](_0x166bde['shift']());}};_0x1b0334(++_0x1a36e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};};
\ No newline at end of file
index bbf519a..5488b84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x40cd=['Request','../client','getVoiceQueueRtPauses'];(function(_0x279a84,_0x5941bc){var _0x430c76=function(_0xce1f24){while(--_0xce1f24){_0x279a84['push'](_0x279a84['shift']());}};_0x430c76(++_0x5941bc);}(_0x40cd,0x8e));var _0xd40c=function(_0x5ca480,_0x1ddf7b){_0x5ca480=_0x5ca480-0x0;var _0x168ef3=_0x40cd[_0x5ca480];return _0x168ef3;};'use strict';var client=require(_0xd40c('0x0'));exports[_0xd40c('0x1')]=function(_0x2a2a8f){return function(){return client[_0xd40c('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2a2a8f,'paused':!![]},'raw':!![]},'log':_0xd40c('0x1')});};};
\ No newline at end of file
+var _0x63bc=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0xab632,_0x100609){var _0x45aa86=function(_0x50d358){while(--_0x50d358){_0xab632['push'](_0xab632['shift']());}};_0x45aa86(++_0x100609);}(_0x63bc,0x10f));var _0xc63b=function(_0x2d07b6,_0xfcc3c0){_0x2d07b6=_0x2d07b6-0x0;var _0x453af2=_0x63bc[_0x2d07b6];return _0x453af2;};'use strict';var client=require('../client');exports[_0xc63b('0x0')]=function(_0x5f247d){return function(){return client[_0xc63b('0x1')](_0xc63b('0x2'),{'options':{'where':{'VoiceQueueId':_0x5f247d,'paused':!![]},'raw':!![]},'log':_0xc63b('0x0')});};};
\ No newline at end of file
index 4f22de1..ca8d00b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xd70470,_0x591256){var _0x2c4bc3=function(_0x2b480e){while(--_0x2b480e){_0xd70470['push'](_0xd70470['shift']());}};_0x2c4bc3(++_0x591256);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});};
\ No newline at end of file
+var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x199206,_0xa788bd){var _0x2c868a=function(_0x2266e6){while(--_0x2266e6){_0x199206['push'](_0x199206['shift']());}};_0x2c868a(++_0xa788bd);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});};
\ No newline at end of file
index 245f4e4..2589598 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4274=['transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten'];(function(_0x595151,_0x1f1f72){var _0x5776df=function(_0x4930fa){while(--_0x4930fa){_0x595151['push'](_0x595151['shift']());}};_0x5776df(++_0x1f1f72);}(_0x4274,0xea));var _0x4427=function(_0xe20cbe,_0x1e55f1){_0xe20cbe=_0xe20cbe-0x0;var _0x35f01d=_0x4274[_0xe20cbe];return _0x35f01d;};'use strict';var client=require('../client');exports[_0x4427('0x0')]={};exports[_0x4427('0x1')]=function(_0x24ea9b){return client[_0x4427('0x2')](_0x4427('0x3'),{'body':{'result':_0x24ea9b[_0x4427('0x4')],'transfererchannel':_0x24ea9b['transfererchannel'],'transferercalleridnum':_0x24ea9b[_0x4427('0x5')],'transferercalleridname':_0x24ea9b[_0x4427('0x6')],'transfererconnectedlinenum':_0x24ea9b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x24ea9b[_0x4427('0x7')],'transfereraccountcode':_0x24ea9b[_0x4427('0x8')],'transferercontext':_0x24ea9b[_0x4427('0x9')],'transfererexten':_0x24ea9b['transfererexten'],'transfererlinkedid':_0x24ea9b[_0x4427('0xa')],'transfereechannel':_0x24ea9b[_0x4427('0xb')],'transfereecalleridnum':_0x24ea9b['transfereecalleridnum'],'transfereecalleridname':_0x24ea9b['transfereecalleridname'],'transfereeconnectedlinenum':_0x24ea9b[_0x4427('0xc')],'transfereeconnectedlinename':_0x24ea9b['transfereeconnectedlinename'],'transfereeaccountcode':_0x24ea9b[_0x4427('0xd')],'transfereecontext':_0x24ea9b[_0x4427('0xe')],'transfereeexten':_0x24ea9b[_0x4427('0xf')],'transfereelinkedid':_0x24ea9b[_0x4427('0x10')],'isexternal':_0x24ea9b[_0x4427('0x11')],'context':_0x24ea9b['context'],'extension':_0x24ea9b[_0x4427('0x12')],'type':_0x4427('0x13')},'log':_0x4427('0x3')});};exports[_0x4427('0x14')]=function(_0xcd564d){return client[_0x4427('0x2')](_0x4427('0x3'),{'body':{'result':_0xcd564d[_0x4427('0x4')],'transfererchannel':_0xcd564d[_0x4427('0x15')],'transferercalleridnum':_0xcd564d[_0x4427('0x16')],'transferercalleridname':_0xcd564d[_0x4427('0x17')],'transfererconnectedlinenum':_0xcd564d['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xcd564d[_0x4427('0x18')],'transfereraccountcode':_0xcd564d[_0x4427('0x19')],'transferercontext':_0xcd564d[_0x4427('0x1a')],'transfererexten':_0xcd564d[_0x4427('0x1b')],'transfererlinkedid':_0xcd564d[_0x4427('0x1c')],'transfereechannel':_0xcd564d[_0x4427('0x1d')],'transfereecalleridnum':_0xcd564d[_0x4427('0x1e')],'transfereecalleridname':_0xcd564d[_0x4427('0x1f')],'transfereeconnectedlinenum':_0xcd564d[_0x4427('0x20')],'transfereeconnectedlinename':_0xcd564d[_0x4427('0x21')],'transfereeaccountcode':_0xcd564d[_0x4427('0x22')],'transfereecontext':_0xcd564d[_0x4427('0x23')],'transfereeexten':_0xcd564d[_0x4427('0x24')],'transfereelinkedid':_0xcd564d[_0x4427('0x25')],'isexternal':_0xcd564d['isexternal'],'context':_0xcd564d['origtransferercontext'],'extension':_0xcd564d[_0x4427('0x26')],'type':'attended'},'log':_0x4427('0x3')});};
\ No newline at end of file
+var _0x4647=['result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport'];(function(_0x2b3a97,_0x31164d){var _0xbdd2c5=function(_0x487dec){while(--_0x487dec){_0x2b3a97['push'](_0x2b3a97['shift']());}};_0xbdd2c5(++_0x31164d);}(_0x4647,0x149));var _0x7464=function(_0x3eff16,_0x260fd5){_0x3eff16=_0x3eff16-0x0;var _0x1bed6f=_0x4647[_0x3eff16];return _0x1bed6f;};'use strict';var client=require(_0x7464('0x0'));exports[_0x7464('0x1')]={};exports[_0x7464('0x2')]=function(_0x4d67db){return client['Request'](_0x7464('0x3'),{'body':{'result':_0x4d67db[_0x7464('0x4')],'transfererchannel':_0x4d67db[_0x7464('0x5')],'transferercalleridnum':_0x4d67db['transferercalleridnum'],'transferercalleridname':_0x4d67db[_0x7464('0x6')],'transfererconnectedlinenum':_0x4d67db[_0x7464('0x7')],'transfererconnectedlinename':_0x4d67db[_0x7464('0x8')],'transfereraccountcode':_0x4d67db[_0x7464('0x9')],'transferercontext':_0x4d67db[_0x7464('0xa')],'transfererexten':_0x4d67db['transfererexten'],'transfererlinkedid':_0x4d67db[_0x7464('0xb')],'transfereechannel':_0x4d67db[_0x7464('0xc')],'transfereecalleridnum':_0x4d67db[_0x7464('0xd')],'transfereecalleridname':_0x4d67db[_0x7464('0xe')],'transfereeconnectedlinenum':_0x4d67db[_0x7464('0xf')],'transfereeconnectedlinename':_0x4d67db[_0x7464('0x10')],'transfereeaccountcode':_0x4d67db[_0x7464('0x11')],'transfereecontext':_0x4d67db[_0x7464('0x12')],'transfereeexten':_0x4d67db['transfereeexten'],'transfereelinkedid':_0x4d67db[_0x7464('0x13')],'isexternal':_0x4d67db[_0x7464('0x14')],'context':_0x4d67db[_0x7464('0x15')],'extension':_0x4d67db[_0x7464('0x16')],'type':_0x7464('0x17')},'log':_0x7464('0x3')});};exports[_0x7464('0x18')]=function(_0x433169){return client[_0x7464('0x19')](_0x7464('0x3'),{'body':{'result':_0x433169[_0x7464('0x4')],'transfererchannel':_0x433169['origtransfererchannel'],'transferercalleridnum':_0x433169[_0x7464('0x1a')],'transferercalleridname':_0x433169['origtransferercalleridname'],'transfererconnectedlinenum':_0x433169[_0x7464('0x1b')],'transfererconnectedlinename':_0x433169['secondtransfererconnectedlinename'],'transfereraccountcode':_0x433169['origtransfereraccountcode'],'transferercontext':_0x433169[_0x7464('0x1c')],'transfererexten':_0x433169['secondtransfererexten'],'transfererlinkedid':_0x433169[_0x7464('0x1d')],'transfereechannel':_0x433169[_0x7464('0x1e')],'transfereecalleridnum':_0x433169[_0x7464('0x1f')],'transfereecalleridname':_0x433169['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x433169[_0x7464('0x20')],'transfereeconnectedlinename':_0x433169['transfertargetconnectedlinename'],'transfereeaccountcode':_0x433169['transfertargetaccountcode'],'transfereecontext':_0x433169['transfertargetcontext'],'transfereeexten':_0x433169['transfertargetexten'],'transfereelinkedid':_0x433169[_0x7464('0x21')],'isexternal':_0x433169['isexternal'],'context':_0x433169[_0x7464('0x22')],'extension':_0x433169[_0x7464('0x23')],'type':_0x7464('0x24')},'log':_0x7464('0x3')});};
\ No newline at end of file
index 86740ed..291f761 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd59=['length','voicechannel','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','then','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','/var/spool/asterisk/monitor/','StopMixMonitor\x20Success','queueChannels','inbound','outbound','includes','type','count','rows','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','trunks','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','QueuePause','isConnected','asterisk','username','keys','reload','action','Reload','Action','message','catch','error','ami\x20disconnected','join','pick','command','Command','content','voiceQueues','hasOwnProperty','push','find','undefined','values','channels'];(function(_0x56d383,_0x2f2b09){var _0x458ce0=function(_0x44a149){while(--_0x44a149){_0x56d383['push'](_0x56d383['shift']());}};_0x458ce0(++_0x2f2b09);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4bfa30,_0x5aa996){_0x4bfa30=_0x4bfa30-0x0;var _0x23e8d0=_0xcd59[_0x4bfa30];return _0x23e8d0;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var jayson=require(_0x9cd5('0x2'));var schema=require(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var config=require(_0x9cd5('0x5'));var properties=require('../properties');var ami=require(_0x9cd5('0x6'));var VoiceQueueSummary=require(_0x9cd5('0x7'));exports[_0x9cd5('0x8')]=function(_0x717731,_0x6acbef,_0x2db192){return new Promise(function(_0x46277c,_0x2cd19a){var _0x214256={'QueuePause':function(_0x3f888f){return new Promise(function(_0x545407){var _0x10162d=util[_0x9cd5('0x9')](_0x9cd5('0xa'),_0x9cd5('0xb'),_0x3f888f[_0x9cd5('0xc')]);if(_0x717731[_0x9cd5('0xd')]&&_0x717731[_0x9cd5('0xd')][_0x10162d]&&_0x717731[_0x9cd5('0xd')][_0x10162d]['timer']){_0x717731[_0x9cd5('0xd')][_0x10162d][_0x9cd5('0xe')]();}if(_0x717731[_0x9cd5('0xf')][_0x10162d]){_0x717731[_0x9cd5('0xf')][_0x10162d]['updateStatusRealtime']({'statePause':_0x3f888f['pause']?!![]:![]});}_0x545407({'code':0xc8,'message':_0x9cd5('0x10')});});},'Reload':function(_0x172e29){var _0x44518d=this;return new Promise(function(_0x407079,_0x2ccc05){if(ami[_0x9cd5('0x11')]()==![]){return _0x2ccc05(_0x44518d['error'](0x1f4,[config[_0x9cd5('0x12')]['ip'],config[_0x9cd5('0x12')][_0x9cd5('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x172e29=_['pick'](_0x172e29,_[_0x9cd5('0x14')](properties[_0x9cd5('0x15')]['module']));_0x172e29[_0x9cd5('0x16')]=_0x9cd5('0x17');return ami[_0x9cd5('0x18')](_0x172e29)['then'](function(_0x1e921c){_0x407079({'code':0xc8,'message':_0x1e921c[_0x9cd5('0x19')]});})[_0x9cd5('0x1a')](function(_0x3a6f01){_0x2ccc05(_0x44518d[_0x9cd5('0x1b')](0x1f5,_0x3a6f01[_0x9cd5('0x19')]));});});},'Command':function(_0x5c1622){var _0x37ea13=this;return new Promise(function(_0x18346f,_0x3661b0){if(ami[_0x9cd5('0x11')]()==![]){return _0x3661b0(_0x37ea13[_0x9cd5('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x9cd5('0x12')][_0x9cd5('0x13')],_0x9cd5('0x1c')][_0x9cd5('0x1d')]('\x20')));}_0x5c1622=_[_0x9cd5('0x1e')](_0x5c1622,_0x9cd5('0x1f'));_0x5c1622[_0x9cd5('0x16')]=_0x9cd5('0x20');return ami[_0x9cd5('0x18')](_0x5c1622)['then'](function(_0x297f0e){_0x18346f({'code':0xc8,'message':_0x297f0e[_0x9cd5('0x21')]});})[_0x9cd5('0x1a')](function(_0x43f47d){_0x3661b0(_0x37ea13['error'](0x1f5,_0x43f47d[_0x9cd5('0x19')]));});});},'VoiceQueues':function(){return new Promise(function(_0x990c25){var _0x211576=[];for(var _0xe36f86 in _0x717731[_0x9cd5('0x22')]){if(_0x717731[_0x9cd5('0x22')][_0x9cd5('0x23')](_0xe36f86)){var _0x4a245f=_0x717731[_0x9cd5('0x22')][_0xe36f86];var _0x64a1c4=new VoiceQueueSummary(_0x4a245f);_0x211576[_0x9cd5('0x24')](_0x64a1c4);}}_0x990c25({'count':_0x211576['length'],'rows':_0x211576});});},'UpdateVoiceQueue':function(_0x5c33e9){return new Promise(function(_0x2e45a3,_0x502257){var _0x52ef5d=_[_0x9cd5('0x25')](_0x717731[_0x9cd5('0x22')],{'id':parseInt(_0x5c33e9['id'])});var _0x13e0d3=_['omit'](_0x5c33e9,['id']);if(_0x52ef5d){for(var _0x40461a in _0x13e0d3){if(typeof _0x13e0d3[_0x40461a]!==_0x9cd5('0x26')&&typeof _0x52ef5d[_0x40461a]!==_0x9cd5('0x26')){_0x52ef5d[_0x40461a]=_0x13e0d3[_0x40461a];}}_0x2e45a3(_0x52ef5d);}else{_0x502257();}});},'VoiceChannels':function(){return new Promise(function(_0x2689c7){var _0x8e3826=_[_0x9cd5('0x27')](_0x717731[_0x9cd5('0x28')]);_0x2689c7({'count':_0x8e3826[_0x9cd5('0x29')],'rows':_0x8e3826});});},'VoiceChannelMixMonitor':function(_0x36b0ad){var _0x1c81fd=this;return new Promise(function(_0x3dc2c0,_0x4287bd){if(ami[_0x9cd5('0x11')]()==![]){return _0x4287bd(_0x1c81fd[_0x9cd5('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x9cd5('0x12')][_0x9cd5('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x101d99=schema(properties[_0x9cd5('0x2a')])['validate'](_0x36b0ad);if(_0x101d99[_0x9cd5('0x29')]>0x0){return _0x4287bd(_0x1c81fd['error'](0x1f4,_['map'](_0x101d99,_0x9cd5('0x19'))[_0x9cd5('0x1d')](',\x20')));}var _0x3a071d=_[_0x9cd5('0x25')](_0x717731['channels'],{'uniqueid':_0x36b0ad[_0x9cd5('0x2b')]});if(_0x3a071d&&_0x3a071d[_0x9cd5('0x2c')]){var _0x403779=util['format'](_0x9cd5('0x2d'),_0x36b0ad[_0x9cd5('0x2e')]||_0x36b0ad[_0x9cd5('0x2b')],_0x36b0ad[_0x9cd5('0x9')]||_0x9cd5('0x2f'));return ami[_0x9cd5('0x18')]({'action':_0x9cd5('0x30'),'channel':_0x3a071d[_0x9cd5('0x2c')],'file':_0x403779,'options':_0x9cd5('0x31')})[_0x9cd5('0x32')](function(_0x3cbdba){var _0x5cb5b3=_[_0x9cd5('0x25')](_0x3a071d['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x403779[_0x9cd5('0x33')]()});if(_[_0x9cd5('0x34')](_0x5cb5b3)){_0x3a071d[_0x9cd5('0x35')][_0x9cd5('0x24')]({'filename':'/var/spool/asterisk/monitor/'+_0x403779[_0x9cd5('0x33')](),'createdAt':moment()[_0x9cd5('0x9')](_0x9cd5('0x36')),'mixmonitorid':_0x3cbdba[_0x9cd5('0x37')],'status':'rec'});}else{_0x5cb5b3[_0x9cd5('0x37')]=_0x3cbdba[_0x9cd5('0x37')];_0x5cb5b3[_0x9cd5('0x38')]=_0x9cd5('0x39');}_0x3dc2c0({'code':0xc8,'message':[_0x36b0ad[_0x9cd5('0x2b')],_0x9cd5('0x3a'),_0x3cbdba['mixmonitorid']][_0x9cd5('0x1d')]('\x20'),'mixmonitorid':_0x3cbdba[_0x9cd5('0x37')]});})[_0x9cd5('0x1a')](function(_0x4153b2){_0x4287bd(_0x1c81fd[_0x9cd5('0x1b')](0x1f5,[_0x36b0ad[_0x9cd5('0x2b')],_0x4153b2[_0x9cd5('0x19')][_0x9cd5('0x33')]()][_0x9cd5('0x1d')]('\x20')));});}else{return _0x4287bd(_0x1c81fd[_0x9cd5('0x1b')](0x1f5,_0x9cd5('0x3b')));}});},'VoiceChannelStopMixMonitor':function(_0x3ed405){var _0x7ad8ec=this;return new Promise(function(_0xa12319,_0x3b316b){if(ami[_0x9cd5('0x11')]()==![]){return _0x3b316b(_0x7ad8ec[_0x9cd5('0x1b')](0x1f4,[config[_0x9cd5('0x12')]['ip'],config['asterisk'][_0x9cd5('0x13')],'ami\x20disconnected'][_0x9cd5('0x1d')]('\x20')));}var _0x2af5a5=schema(properties[_0x9cd5('0x2a')])[_0x9cd5('0x3')](_0x3ed405);if(_0x2af5a5[_0x9cd5('0x29')]>0x0){return _0x3b316b(_0x7ad8ec['error'](0x1f4,_[_0x9cd5('0x3c')](_0x2af5a5,_0x9cd5('0x19'))[_0x9cd5('0x1d')](',\x20')));}var _0x54ffdf=_[_0x9cd5('0x25')](_0x717731[_0x9cd5('0x28')],{'uniqueid':_0x3ed405[_0x9cd5('0x2b')]});if(_0x54ffdf){return Promise[_0x9cd5('0x3d')]()['then'](function(){if(_0x54ffdf[_0x9cd5('0x2c')]){return ami[_0x9cd5('0x18')]({'action':_0x9cd5('0x3e'),'channel':_0x54ffdf[_0x9cd5('0x2c')],'mixmonitorid':_0x3ed405[_0x9cd5('0x37')]})[_0x9cd5('0x1a')](function(){});}})[_0x9cd5('0x32')](function(){if(_0x54ffdf[_0x9cd5('0x3f')]){return ami[_0x9cd5('0x18')]({'action':_0x9cd5('0x3e'),'channel':_0x54ffdf[_0x9cd5('0x3f')],'mixmonitorid':_0x3ed405[_0x9cd5('0x37')]})[_0x9cd5('0x1a')](function(){});}})[_0x9cd5('0x32')](function(){var _0x245f9e=_[_0x9cd5('0x25')](_0x54ffdf[_0x9cd5('0x35')],{'mixmonitorid':_0x3ed405[_0x9cd5('0x37')]});if(_0x245f9e){_0x245f9e['status']=_0x9cd5('0x40');}})[_0x9cd5('0x32')](function(){var _0x3fead7=util[_0x9cd5('0x9')]('%s.%s',_0x3ed405[_0x9cd5('0x2e')]||_0x3ed405[_0x9cd5('0x2b')],_0x3ed405['format']||_0x9cd5('0x2f'));var _0x155652=_[_0x9cd5('0x25')](_0x54ffdf[_0x9cd5('0x35')],{'filename':_0x9cd5('0x41')+_0x3fead7[_0x9cd5('0x33')]()});if(_0x155652){_0x155652[_0x9cd5('0x38')]=_0x9cd5('0x40');}})['then'](function(){_0xa12319({'code':0xc8,'message':[_0x3ed405['uniqueid'],_0x9cd5('0x42')][_0x9cd5('0x1d')]('\x20')});})[_0x9cd5('0x1a')](function(_0x22d74c){_0x3b316b(_0x7ad8ec['error'](0x1f5,[_0x3ed405[_0x9cd5('0x2b')],_0x22d74c['message']['toLowerCase']()][_0x9cd5('0x1d')]('\x20')));});}else{return _0x3b316b(_0x7ad8ec[_0x9cd5('0x1b')](0x1f5,_0x9cd5('0x3b')));}});},'VoiceQueuesChannels':function(_0x5842cf){var _0x4453ab=this;return new Promise(function(_0x30c80f){var _0x310e4a=_[_0x9cd5('0x27')](_0x717731[_0x9cd5('0x43')]);var _0x191099={'count':_0x310e4a['length'],'rows':_0x310e4a};if(_0x5842cf&&_0x5842cf['type']){if(![_0x9cd5('0x44'),_0x9cd5('0x45')][_0x9cd5('0x46')](_0x5842cf[_0x9cd5('0x47')])){return _0x2cd19a(_0x4453ab[_0x9cd5('0x1b')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x557076=_['filter'](_0x310e4a,function(_0x4cb835){return _0x4cb835[_0x9cd5('0x47')]===_0x5842cf[_0x9cd5('0x47')];});_0x191099[_0x9cd5('0x48')]=_0x557076[_0x9cd5('0x29')];_0x191099[_0x9cd5('0x49')]=_0x557076;}_0x30c80f(_0x191099);});},'VoiceQueuesChannel':function(_0x3d712f){var _0x27e27c=this;return new Promise(function(_0x32b294,_0x1249a7){var _0x426016=schema(properties[_0x9cd5('0x4a')])[_0x9cd5('0x3')](_0x3d712f);if(_0x426016[_0x9cd5('0x29')]>0x0){return _0x1249a7(_0x27e27c[_0x9cd5('0x1b')](0x1f4,_['map'](_0x426016,_0x9cd5('0x19'))[_0x9cd5('0x1d')](',\x20')));}var _0x5cc62f=_[_0x9cd5('0x25')](_0x717731[_0x9cd5('0x43')],{'uniqueid':_0x3d712f[_0x9cd5('0x2b')]});if(_0x5cc62f){_0x32b294(_0x5cc62f);}else{return _0x1249a7(_0x27e27c[_0x9cd5('0x1b')](0x1f5,_0x9cd5('0x3b')));}});},'VoiceQueuesChannelHangup':function(_0x2355e2){var _0x453edb=this;return new Promise(function(_0x54339d,_0x538ffa){if(ami[_0x9cd5('0x11')]()==![]){return _0x538ffa(_0x453edb[_0x9cd5('0x1b')](0x1f4,[config[_0x9cd5('0x12')]['ip'],config[_0x9cd5('0x12')][_0x9cd5('0x13')],_0x9cd5('0x1c')][_0x9cd5('0x1d')]('\x20')));}var _0x30ac80=schema(properties[_0x9cd5('0x4b')])[_0x9cd5('0x3')](_0x2355e2);if(_0x30ac80[_0x9cd5('0x29')]>0x0){return _0x538ffa(_0x453edb[_0x9cd5('0x1b')](0x1f4,_[_0x9cd5('0x3c')](_0x30ac80,_0x9cd5('0x19'))['join'](',\x20')));}var _0x5de02d=_[_0x9cd5('0x25')](_0x717731[_0x9cd5('0x43')],{'uniqueid':_0x2355e2[_0x9cd5('0x2b')]});if(_0x5de02d&&_0x5de02d['channel']){return ami[_0x9cd5('0x18')]({'action':'Hangup','channel':_0x5de02d[_0x9cd5('0x2c')]})[_0x9cd5('0x32')](function(_0x1c58be){_0x54339d({'code':0xc8,'message':[_0x2355e2['uniqueid'],_0x1c58be[_0x9cd5('0x19')][_0x9cd5('0x33')]()][_0x9cd5('0x1d')]('\x20')});})[_0x9cd5('0x1a')](function(_0x42cbc6){_0x538ffa(_0x453edb['error'](0x1f5,[_0x2355e2[_0x9cd5('0x2b')],_0x42cbc6['message'][_0x9cd5('0x33')]()]['join']('\x20')));});}else{return _0x538ffa(_0x453edb[_0x9cd5('0x1b')](0x1f5,_0x9cd5('0x3b')));}});},'VoiceQueuesChannelRedirect':function(_0x263dbc){var _0x286ed4=this;return new Promise(function(_0x50c6fb,_0x19ea60){if(ami[_0x9cd5('0x11')]()==![]){return _0x19ea60(_0x286ed4[_0x9cd5('0x1b')](0x1f4,[config[_0x9cd5('0x12')]['ip'],config['asterisk'][_0x9cd5('0x13')],_0x9cd5('0x1c')]['join']('\x20')));}var _0x2feaf2=schema(properties[_0x9cd5('0x4c')])[_0x9cd5('0x3')](_0x263dbc);if(_0x2feaf2[_0x9cd5('0x29')]>0x0){return _0x19ea60(_0x286ed4[_0x9cd5('0x1b')](0x1f4,_['map'](_0x2feaf2,_0x9cd5('0x19'))[_0x9cd5('0x1d')](',\x20')));}var _0x3c7580=_[_0x9cd5('0x25')](_0x717731[_0x9cd5('0x43')],{'uniqueid':_0x263dbc[_0x9cd5('0x2b')]});if(_0x3c7580&&_0x3c7580[_0x9cd5('0x2c')]){return ami[_0x9cd5('0x18')]({'action':_0x9cd5('0x4d'),'channel':_0x3c7580['channel'],'exten':_0x263dbc[_0x9cd5('0x4e')],'context':_0x263dbc[_0x9cd5('0x4f')]||_0x3c7580['context'],'priority':0x1})['then'](function(_0xfb7889){_0x50c6fb({'code':0xc8,'message':[_0x263dbc[_0x9cd5('0x2b')],_0xfb7889['message']['toLowerCase']()][_0x9cd5('0x1d')]('\x20')});})[_0x9cd5('0x1a')](function(_0x71471c){_0x19ea60(_0x286ed4[_0x9cd5('0x1b')](0x1f5,[_0x263dbc['uniqueid'],_0x71471c['message'][_0x9cd5('0x33')]()][_0x9cd5('0x1d')]('\x20')));});}else{return _0x19ea60(_0x286ed4[_0x9cd5('0x1b')](0x1f5,_0x9cd5('0x3b')));}});},'Agents':function(_0x2a6f7f){return new Promise(function(_0xc67fc4){var _0x3a6ce6=_[_0x9cd5('0x27')](_0x717731[_0x9cd5('0xf')]);if(_0x2a6f7f&&_0x2a6f7f['id']){var _0x4deea5=_[_0x9cd5('0x25')](_0x3a6ce6,function(_0x4cff45){return _0x4cff45['id']===_0x2a6f7f['id'];});_0xc67fc4(_0x4deea5);}else{_0xc67fc4({'count':_0x3a6ce6[_0x9cd5('0x29')],'rows':_0x3a6ce6});}});},'Telephones':function(){return new Promise(function(_0x16c448){var _0x3dff12=_[_0x9cd5('0x27')](_0x717731['telephones']);_0x16c448({'count':_0x3dff12[_0x9cd5('0x29')],'rows':_0x3dff12});});},'Trunks':function(){return new Promise(function(_0x529cce){var _0x17b0ba=_[_0x9cd5('0x27')](_0x717731[_0x9cd5('0x50')]);_0x529cce({'count':_0x17b0ba[_0x9cd5('0x29')],'rows':_0x17b0ba});});},'OutboundChannels':function(){return new Promise(function(_0x5ece56){var _0x3c7cc4=_[_0x9cd5('0x27')](_0x717731['outboundChannels']);_0x5ece56({'count':_0x3c7cc4[_0x9cd5('0x29')],'rows':_0x3c7cc4});});},'Outbound':function(){return new Promise(function(_0x59b3bd){_0x59b3bd(_0x717731[_0x9cd5('0x45')]);});},'Campaigns':function(){return new Promise(function(_0x4ae570){var _0x4c4b07=_[_0x9cd5('0x27')](_0x717731[_0x9cd5('0x51')]);_0x4ae570({'count':_0x4c4b07[_0x9cd5('0x29')],'rows':_0x4c4b07});});},'VoiceQueuesPreview':function(_0x1a9cf3){var _0x2c7758=this;return new Promise(function(_0x35299b,_0x48362b){_0x6acbef[_0x9cd5('0x52')](_0x1a9cf3['id'])[_0x9cd5('0x32')](function(_0x441ceb){_0x35299b({'code':0xc8,'message':_0x441ceb['message']});})['catch'](function(_0x30023c){_0x48362b(_0x2c7758[_0x9cd5('0x1b')](0x1f4,_0x30023c[_0x9cd5('0x19')]));});});},'EventManager':function(_0x323ff3){var _0x806e1c=this;return new Promise(function(_0x42b6d0,_0x179b0c){if(!_0x323ff3[_0x9cd5('0x53')]){return _0x179b0c(_0x806e1c[_0x9cd5('0x1b')](0x1f4,_0x9cd5('0x54')));}ami['emit'](_0x9cd5('0x55')+_0x323ff3['event'],_0x323ff3[_0x9cd5('0x19')]);_0x42b6d0({'code':0xc8,'message':_0x323ff3});});},'FaxAccounts':function(){return new Promise(function(_0x19e545){var _0x3999ce=_['values'](_0x717731[_0x9cd5('0x56')]);_0x19e545({'count':_0x3999ce['length'],'rows':_0x3999ce});});},'SendFax':function(_0x4cb8d4){var _0x23ca99=this;return new Promise(function(_0xad48b,_0x1b38fa){_0x2db192[_0x9cd5('0x57')](_0x4cb8d4)[_0x9cd5('0x32')](function(_0x1c8e81){_0xad48b({'code':0xc8,'message':_0x1c8e81['message']});})[_0x9cd5('0x1a')](function(_0x2bf104){_0x1b38fa(_0x23ca99[_0x9cd5('0x1b')](0x1f4,_0x2bf104[_0x9cd5('0x19')]));});});},'CheckAfterSend':function(_0x48bfca){var _0x439640=this;return new Promise(function(_0x1f5dc4,_0x26aa91){_0x2db192[_0x9cd5('0x58')](_0x48bfca)[_0x9cd5('0x32')](function(_0x5a370c){_0x1f5dc4({'code':0xc8,'message':_0x5a370c[_0x9cd5('0x19')]});})[_0x9cd5('0x1a')](function(_0x23c68b){_0x26aa91(_0x439640[_0x9cd5('0x1b')](0x1f4,_0x23c68b['message']));});});}};var _0x12fb5b=jayson[_0x9cd5('0x59')](_0x214256)[_0x9cd5('0x5a')]();_0x12fb5b['on'](_0x9cd5('0x1b'),function(_0x367c7c){return _0x2cd19a(_0x367c7c);});_0x12fb5b[_0x9cd5('0x8')](0x232a,'127.0.0.1',function(){console[_0x9cd5('0x5b')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x46277c(_0x9cd5('0x5c')+0x232a);});});};
\ No newline at end of file
+var _0xca9e=['voicechannel','map','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','isNil','mixmonitorid','status','rec','MixMonitor\x20Success','toLowerCase','resolve','StopMixMonitor','destinationchannel','monitors','stop','Channel\x20doesn\x27t\x20exist','type','inbound','includes','filter','rows','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','exten','context','values','telephones','trunks','campaigns','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Action','then','message','command','Command','content','catch','voiceQueues','hasOwnProperty','push','length','find','omit','channels'];(function(_0x57c783,_0x5c39ec){var _0x423b1d=function(_0x5ae549){while(--_0x5ae549){_0x57c783['push'](_0x57c783['shift']());}};_0x423b1d(++_0x5c39ec);}(_0xca9e,0x136));var _0xeca9=function(_0xf44586,_0x4dee16){_0xf44586=_0xf44586-0x0;var _0x5bf2ec=_0xca9e[_0xf44586];return _0x5bf2ec;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var jayson=require(_0xeca9('0x2'));var schema=require(_0xeca9('0x3'));var moment=require(_0xeca9('0x4'));var config=require(_0xeca9('0x5'));var properties=require(_0xeca9('0x6'));var ami=require(_0xeca9('0x7'));var VoiceQueueSummary=require(_0xeca9('0x8'));exports[_0xeca9('0x9')]=function(_0x3aba81,_0x1c4ce6,_0x186a47){return new Promise(function(_0x305dc5,_0x483e41){var _0x369f5e={'QueuePause':function(_0x1774f3){return new Promise(function(_0x4d57ee){var _0x4eaf49=util[_0xeca9('0xa')](_0xeca9('0xb'),_0xeca9('0xc'),_0x1774f3['name']);if(_0x3aba81[_0xeca9('0xd')]&&_0x3aba81[_0xeca9('0xd')][_0x4eaf49]&&_0x3aba81[_0xeca9('0xd')][_0x4eaf49][_0xeca9('0xe')]){_0x3aba81[_0xeca9('0xd')][_0x4eaf49][_0xeca9('0xf')]();}if(_0x3aba81['agents'][_0x4eaf49]){_0x3aba81[_0xeca9('0x10')][_0x4eaf49][_0xeca9('0x11')]({'statePause':_0x1774f3['pause']?!![]:![]});}_0x4d57ee({'code':0xc8,'message':_0xeca9('0x12')});});},'Reload':function(_0x4b2ae1){var _0x3c6cc7=this;return new Promise(function(_0x5e7e73,_0x543958){if(ami[_0xeca9('0x13')]()==![]){return _0x543958(_0x3c6cc7[_0xeca9('0x14')](0x1f4,[config[_0xeca9('0x15')]['ip'],config['asterisk'][_0xeca9('0x16')],_0xeca9('0x17')][_0xeca9('0x18')]('\x20')));}_0x4b2ae1=_[_0xeca9('0x19')](_0x4b2ae1,_['keys'](properties['reload'][_0xeca9('0x1a')]));_0x4b2ae1[_0xeca9('0x1b')]='Reload';return ami[_0xeca9('0x1c')](_0x4b2ae1)[_0xeca9('0x1d')](function(_0x4fbe8a){_0x5e7e73({'code':0xc8,'message':_0x4fbe8a['message']});})['catch'](function(_0x132008){_0x543958(_0x3c6cc7[_0xeca9('0x14')](0x1f5,_0x132008[_0xeca9('0x1e')]));});});},'Command':function(_0x5dde5f){var _0xf1ef9f=this;return new Promise(function(_0x5a5c52,_0x5bbdce){if(ami[_0xeca9('0x13')]()==![]){return _0x5bbdce(_0xf1ef9f['error'](0x1f4,[config[_0xeca9('0x15')]['ip'],config[_0xeca9('0x15')]['username'],_0xeca9('0x17')][_0xeca9('0x18')]('\x20')));}_0x5dde5f=_['pick'](_0x5dde5f,_0xeca9('0x1f'));_0x5dde5f['action']=_0xeca9('0x20');return ami[_0xeca9('0x1c')](_0x5dde5f)[_0xeca9('0x1d')](function(_0x5c3495){_0x5a5c52({'code':0xc8,'message':_0x5c3495[_0xeca9('0x21')]});})[_0xeca9('0x22')](function(_0x515e63){_0x5bbdce(_0xf1ef9f[_0xeca9('0x14')](0x1f5,_0x515e63[_0xeca9('0x1e')]));});});},'VoiceQueues':function(){return new Promise(function(_0x2b2c70){var _0x26bb0c=[];for(var _0x498f4a in _0x3aba81[_0xeca9('0x23')]){if(_0x3aba81['voiceQueues'][_0xeca9('0x24')](_0x498f4a)){var _0x251ce4=_0x3aba81[_0xeca9('0x23')][_0x498f4a];var _0x3e41df=new VoiceQueueSummary(_0x251ce4);_0x26bb0c[_0xeca9('0x25')](_0x3e41df);}}_0x2b2c70({'count':_0x26bb0c[_0xeca9('0x26')],'rows':_0x26bb0c});});},'UpdateVoiceQueue':function(_0x85cbd4){return new Promise(function(_0x7fcf4b,_0x467979){var _0x271720=_[_0xeca9('0x27')](_0x3aba81[_0xeca9('0x23')],{'id':parseInt(_0x85cbd4['id'])});var _0x424f7b=_[_0xeca9('0x28')](_0x85cbd4,['id']);if(_0x271720){for(var _0x8d9a8d in _0x424f7b){if(typeof _0x424f7b[_0x8d9a8d]!=='undefined'&&typeof _0x271720[_0x8d9a8d]!=='undefined'){_0x271720[_0x8d9a8d]=_0x424f7b[_0x8d9a8d];}}_0x7fcf4b(_0x271720);}else{_0x467979();}});},'VoiceChannels':function(){return new Promise(function(_0x4c9b32){var _0x6607bd=_['values'](_0x3aba81[_0xeca9('0x29')]);_0x4c9b32({'count':_0x6607bd[_0xeca9('0x26')],'rows':_0x6607bd});});},'VoiceChannelMixMonitor':function(_0x2898dc){var _0x36e75e=this;return new Promise(function(_0x24e96e,_0x2d263a){if(ami['isConnected']()==![]){return _0x2d263a(_0x36e75e[_0xeca9('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xeca9('0x15')][_0xeca9('0x16')],_0xeca9('0x17')]['join']('\x20')));}var _0x21357d=schema(properties[_0xeca9('0x2a')])[_0xeca9('0x3')](_0x2898dc);if(_0x21357d[_0xeca9('0x26')]>0x0){return _0x2d263a(_0x36e75e['error'](0x1f4,_[_0xeca9('0x2b')](_0x21357d,'message')[_0xeca9('0x18')](',\x20')));}var _0x42983f=_[_0xeca9('0x27')](_0x3aba81[_0xeca9('0x29')],{'uniqueid':_0x2898dc[_0xeca9('0x2c')]});if(_0x42983f&&_0x42983f[_0xeca9('0x2d')]){var _0x565912=util[_0xeca9('0xa')](_0xeca9('0x2e'),_0x2898dc[_0xeca9('0x2f')]||_0x2898dc[_0xeca9('0x2c')],_0x2898dc[_0xeca9('0xa')]||_0xeca9('0x30'));return ami[_0xeca9('0x1c')]({'action':'MixMonitor','channel':_0x42983f[_0xeca9('0x2d')],'file':_0x565912,'options':_0xeca9('0x31')})[_0xeca9('0x1d')](function(_0x178bd4){var _0x3995fd=_[_0xeca9('0x27')](_0x42983f['monitors'],{'filename':_0xeca9('0x32')+_0x565912['toLowerCase']()});if(_[_0xeca9('0x33')](_0x3995fd)){_0x42983f['monitors'][_0xeca9('0x25')]({'filename':_0xeca9('0x32')+_0x565912['toLowerCase'](),'createdAt':moment()[_0xeca9('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x178bd4[_0xeca9('0x34')],'status':'rec'});}else{_0x3995fd[_0xeca9('0x34')]=_0x178bd4['mixmonitorid'];_0x3995fd[_0xeca9('0x35')]=_0xeca9('0x36');}_0x24e96e({'code':0xc8,'message':[_0x2898dc['uniqueid'],_0xeca9('0x37'),_0x178bd4[_0xeca9('0x34')]]['join']('\x20'),'mixmonitorid':_0x178bd4[_0xeca9('0x34')]});})[_0xeca9('0x22')](function(_0x3fd0d2){_0x2d263a(_0x36e75e[_0xeca9('0x14')](0x1f5,[_0x2898dc[_0xeca9('0x2c')],_0x3fd0d2[_0xeca9('0x1e')][_0xeca9('0x38')]()][_0xeca9('0x18')]('\x20')));});}else{return _0x2d263a(_0x36e75e[_0xeca9('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x380aa2){var _0x37197b=this;return new Promise(function(_0x15ef4e,_0x35ac2f){if(ami[_0xeca9('0x13')]()==![]){return _0x35ac2f(_0x37197b[_0xeca9('0x14')](0x1f4,[config[_0xeca9('0x15')]['ip'],config['asterisk'][_0xeca9('0x16')],_0xeca9('0x17')][_0xeca9('0x18')]('\x20')));}var _0x1d40a7=schema(properties[_0xeca9('0x2a')])['validate'](_0x380aa2);if(_0x1d40a7[_0xeca9('0x26')]>0x0){return _0x35ac2f(_0x37197b[_0xeca9('0x14')](0x1f4,_[_0xeca9('0x2b')](_0x1d40a7,_0xeca9('0x1e'))['join'](',\x20')));}var _0x427a5c=_[_0xeca9('0x27')](_0x3aba81['channels'],{'uniqueid':_0x380aa2[_0xeca9('0x2c')]});if(_0x427a5c){return Promise[_0xeca9('0x39')]()[_0xeca9('0x1d')](function(){if(_0x427a5c[_0xeca9('0x2d')]){return ami[_0xeca9('0x1c')]({'action':_0xeca9('0x3a'),'channel':_0x427a5c[_0xeca9('0x2d')],'mixmonitorid':_0x380aa2[_0xeca9('0x34')]})[_0xeca9('0x22')](function(){});}})[_0xeca9('0x1d')](function(){if(_0x427a5c[_0xeca9('0x3b')]){return ami[_0xeca9('0x1c')]({'action':_0xeca9('0x3a'),'channel':_0x427a5c[_0xeca9('0x3b')],'mixmonitorid':_0x380aa2[_0xeca9('0x34')]})['catch'](function(){});}})[_0xeca9('0x1d')](function(){var _0x2467be=_[_0xeca9('0x27')](_0x427a5c[_0xeca9('0x3c')],{'mixmonitorid':_0x380aa2['mixmonitorid']});if(_0x2467be){_0x2467be[_0xeca9('0x35')]=_0xeca9('0x3d');}})['then'](function(){var _0x5e6dc2=util[_0xeca9('0xa')](_0xeca9('0x2e'),_0x380aa2[_0xeca9('0x2f')]||_0x380aa2[_0xeca9('0x2c')],_0x380aa2['format']||_0xeca9('0x30'));var _0xa4faf9=_[_0xeca9('0x27')](_0x427a5c[_0xeca9('0x3c')],{'filename':_0xeca9('0x32')+_0x5e6dc2[_0xeca9('0x38')]()});if(_0xa4faf9){_0xa4faf9[_0xeca9('0x35')]=_0xeca9('0x3d');}})[_0xeca9('0x1d')](function(){_0x15ef4e({'code':0xc8,'message':[_0x380aa2['uniqueid'],'StopMixMonitor\x20Success'][_0xeca9('0x18')]('\x20')});})[_0xeca9('0x22')](function(_0x5c4dcf){_0x35ac2f(_0x37197b[_0xeca9('0x14')](0x1f5,[_0x380aa2[_0xeca9('0x2c')],_0x5c4dcf[_0xeca9('0x1e')][_0xeca9('0x38')]()][_0xeca9('0x18')]('\x20')));});}else{return _0x35ac2f(_0x37197b[_0xeca9('0x14')](0x1f5,_0xeca9('0x3e')));}});},'VoiceQueuesChannels':function(_0x3150b2){var _0x3db16a=this;return new Promise(function(_0x56a212){var _0x5cd84d=_['values'](_0x3aba81['queueChannels']);var _0x3bbb64={'count':_0x5cd84d['length'],'rows':_0x5cd84d};if(_0x3150b2&&_0x3150b2[_0xeca9('0x3f')]){if(![_0xeca9('0x40'),'outbound'][_0xeca9('0x41')](_0x3150b2[_0xeca9('0x3f')])){return _0x483e41(_0x3db16a[_0xeca9('0x14')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x5e4423=_[_0xeca9('0x42')](_0x5cd84d,function(_0xe98d30){return _0xe98d30[_0xeca9('0x3f')]===_0x3150b2[_0xeca9('0x3f')];});_0x3bbb64['count']=_0x5e4423[_0xeca9('0x26')];_0x3bbb64[_0xeca9('0x43')]=_0x5e4423;}_0x56a212(_0x3bbb64);});},'VoiceQueuesChannel':function(_0x746485){var _0x1a046d=this;return new Promise(function(_0xc1ffaf,_0x2ffbb9){var _0x187c92=schema(properties[_0xeca9('0x44')])[_0xeca9('0x3')](_0x746485);if(_0x187c92[_0xeca9('0x26')]>0x0){return _0x2ffbb9(_0x1a046d[_0xeca9('0x14')](0x1f4,_[_0xeca9('0x2b')](_0x187c92,_0xeca9('0x1e'))[_0xeca9('0x18')](',\x20')));}var _0x45bc51=_[_0xeca9('0x27')](_0x3aba81['queueChannels'],{'uniqueid':_0x746485[_0xeca9('0x2c')]});if(_0x45bc51){_0xc1ffaf(_0x45bc51);}else{return _0x2ffbb9(_0x1a046d[_0xeca9('0x14')](0x1f5,_0xeca9('0x3e')));}});},'VoiceQueuesChannelHangup':function(_0x3afc92){var _0x5bece2=this;return new Promise(function(_0x27cd12,_0x3035b2){if(ami['isConnected']()==![]){return _0x3035b2(_0x5bece2[_0xeca9('0x14')](0x1f4,[config[_0xeca9('0x15')]['ip'],config[_0xeca9('0x15')][_0xeca9('0x16')],_0xeca9('0x17')]['join']('\x20')));}var _0x20161f=schema(properties[_0xeca9('0x45')])['validate'](_0x3afc92);if(_0x20161f[_0xeca9('0x26')]>0x0){return _0x3035b2(_0x5bece2[_0xeca9('0x14')](0x1f4,_[_0xeca9('0x2b')](_0x20161f,_0xeca9('0x1e'))[_0xeca9('0x18')](',\x20')));}var _0x3dacc3=_[_0xeca9('0x27')](_0x3aba81[_0xeca9('0x46')],{'uniqueid':_0x3afc92['uniqueid']});if(_0x3dacc3&&_0x3dacc3['channel']){return ami['Action']({'action':_0xeca9('0x47'),'channel':_0x3dacc3[_0xeca9('0x2d')]})[_0xeca9('0x1d')](function(_0x47a454){_0x27cd12({'code':0xc8,'message':[_0x3afc92[_0xeca9('0x2c')],_0x47a454[_0xeca9('0x1e')][_0xeca9('0x38')]()][_0xeca9('0x18')]('\x20')});})[_0xeca9('0x22')](function(_0x23618f){_0x3035b2(_0x5bece2[_0xeca9('0x14')](0x1f5,[_0x3afc92['uniqueid'],_0x23618f['message']['toLowerCase']()][_0xeca9('0x18')]('\x20')));});}else{return _0x3035b2(_0x5bece2[_0xeca9('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x13efa9){var _0x5c5438=this;return new Promise(function(_0x33760f,_0x28bbf7){if(ami[_0xeca9('0x13')]()==![]){return _0x28bbf7(_0x5c5438[_0xeca9('0x14')](0x1f4,[config[_0xeca9('0x15')]['ip'],config['asterisk'][_0xeca9('0x16')],_0xeca9('0x17')][_0xeca9('0x18')]('\x20')));}var _0x1cd614=schema(properties[_0xeca9('0x48')])[_0xeca9('0x3')](_0x13efa9);if(_0x1cd614[_0xeca9('0x26')]>0x0){return _0x28bbf7(_0x5c5438[_0xeca9('0x14')](0x1f4,_['map'](_0x1cd614,_0xeca9('0x1e'))['join'](',\x20')));}var _0x232e34=_[_0xeca9('0x27')](_0x3aba81[_0xeca9('0x46')],{'uniqueid':_0x13efa9[_0xeca9('0x2c')]});if(_0x232e34&&_0x232e34[_0xeca9('0x2d')]){return ami[_0xeca9('0x1c')]({'action':'Redirect','channel':_0x232e34[_0xeca9('0x2d')],'exten':_0x13efa9[_0xeca9('0x49')],'context':_0x13efa9[_0xeca9('0x4a')]||_0x232e34['context'],'priority':0x1})[_0xeca9('0x1d')](function(_0x17bd7e){_0x33760f({'code':0xc8,'message':[_0x13efa9[_0xeca9('0x2c')],_0x17bd7e[_0xeca9('0x1e')][_0xeca9('0x38')]()][_0xeca9('0x18')]('\x20')});})[_0xeca9('0x22')](function(_0xd6bfd3){_0x28bbf7(_0x5c5438['error'](0x1f5,[_0x13efa9[_0xeca9('0x2c')],_0xd6bfd3[_0xeca9('0x1e')][_0xeca9('0x38')]()][_0xeca9('0x18')]('\x20')));});}else{return _0x28bbf7(_0x5c5438[_0xeca9('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x5226dd){return new Promise(function(_0x19a04b){var _0x9f078b=_[_0xeca9('0x4b')](_0x3aba81[_0xeca9('0x10')]);if(_0x5226dd&&_0x5226dd['id']){var _0x5b0b1a=_[_0xeca9('0x27')](_0x9f078b,function(_0x1c7cca){return _0x1c7cca['id']===_0x5226dd['id'];});_0x19a04b(_0x5b0b1a);}else{_0x19a04b({'count':_0x9f078b[_0xeca9('0x26')],'rows':_0x9f078b});}});},'Telephones':function(){return new Promise(function(_0x46c3a3){var _0x5fb274=_[_0xeca9('0x4b')](_0x3aba81[_0xeca9('0x4c')]);_0x46c3a3({'count':_0x5fb274[_0xeca9('0x26')],'rows':_0x5fb274});});},'Trunks':function(){return new Promise(function(_0x448695){var _0x2c8d49=_['values'](_0x3aba81[_0xeca9('0x4d')]);_0x448695({'count':_0x2c8d49[_0xeca9('0x26')],'rows':_0x2c8d49});});},'OutboundChannels':function(){return new Promise(function(_0x9b5506){var _0x4a2f6f=_['values'](_0x3aba81['outboundChannels']);_0x9b5506({'count':_0x4a2f6f[_0xeca9('0x26')],'rows':_0x4a2f6f});});},'Outbound':function(){return new Promise(function(_0x360a9a){_0x360a9a(_0x3aba81['outbound']);});},'Campaigns':function(){return new Promise(function(_0x109f28){var _0x3d85cc=_[_0xeca9('0x4b')](_0x3aba81[_0xeca9('0x4e')]);_0x109f28({'count':_0x3d85cc['length'],'rows':_0x3d85cc});});},'VoiceQueuesPreview':function(_0x17e50d){var _0xfb9250=this;return new Promise(function(_0x48a310,_0x494bfb){_0x1c4ce6['run'](_0x17e50d['id'])[_0xeca9('0x1d')](function(_0x4455d7){_0x48a310({'code':0xc8,'message':_0x4455d7[_0xeca9('0x1e')]});})['catch'](function(_0x46a493){_0x494bfb(_0xfb9250['error'](0x1f4,_0x46a493[_0xeca9('0x1e')]));});});},'EventManager':function(_0xbc11b7){var _0x3bd3d9=this;return new Promise(function(_0x3a2666,_0xab7042){if(!_0xbc11b7['event']){return _0xab7042(_0x3bd3d9[_0xeca9('0x14')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xeca9('0x4f')]('custom:'+_0xbc11b7['event'],_0xbc11b7['message']);_0x3a2666({'code':0xc8,'message':_0xbc11b7});});},'FaxAccounts':function(){return new Promise(function(_0x4ecec4){var _0x4e248b=_[_0xeca9('0x4b')](_0x3aba81[_0xeca9('0x50')]);_0x4ecec4({'count':_0x4e248b[_0xeca9('0x26')],'rows':_0x4e248b});});},'SendFax':function(_0x30e115){var _0x31de1f=this;return new Promise(function(_0x3efee3,_0x5aac23){_0x186a47[_0xeca9('0x51')](_0x30e115)[_0xeca9('0x1d')](function(_0x19dabb){_0x3efee3({'code':0xc8,'message':_0x19dabb[_0xeca9('0x1e')]});})[_0xeca9('0x22')](function(_0x12966c){_0x5aac23(_0x31de1f[_0xeca9('0x14')](0x1f4,_0x12966c[_0xeca9('0x1e')]));});});},'CheckAfterSend':function(_0x5f14df){var _0x3bc532=this;return new Promise(function(_0x2647cc,_0x314fcf){_0x186a47[_0xeca9('0x52')](_0x5f14df)[_0xeca9('0x1d')](function(_0x53d8a5){_0x2647cc({'code':0xc8,'message':_0x53d8a5[_0xeca9('0x1e')]});})[_0xeca9('0x22')](function(_0x1ad010){_0x314fcf(_0x3bc532[_0xeca9('0x14')](0x1f4,_0x1ad010[_0xeca9('0x1e')]));});});}};var _0x5573b7=jayson[_0xeca9('0x53')](_0x369f5e)[_0xeca9('0x54')]();_0x5573b7['on'](_0xeca9('0x14'),function(_0x4554ab){return _0x483e41(_0x4554ab);});_0x5573b7[_0xeca9('0x9')](0x232a,_0xeca9('0x55'),function(){console[_0xeca9('0x56')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x305dc5(_0xeca9('0x57')+0x232a);});});};
\ No newline at end of file
index 88c59dd..17009bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85c5=['lodash','bluebird','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','info','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','calleridnum','routeId','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','<unknown>','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','merge'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x85c5,0xe0));var _0x585c=function(_0x46cae9,_0x3a726b){_0x46cae9=_0x46cae9-0x0;var _0x1a6d56=_0x85c5[_0x46cae9];return _0x1a6d56;};'use strict';var _=require(_0x585c('0x0'));var BPromise=require(_0x585c('0x1'));var Redis=require(_0x585c('0x2'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x585c('0x3'))(_0x585c('0x4'));var cmContactRpc=require(_0x585c('0x5'));config[_0x585c('0x6')]=_[_0x585c('0x7')](config[_0x585c('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x585c('0x6')]));function emit(_0x5d7beb,_0x12228d,_0x4596a4,_0x454152,_0x516bb6){logger[_0x585c('0x8')](_0x585c('0x9'),_0x5d7beb,_0x12228d['id'],_0x4596a4,_0x454152,JSON['stringify'](_0x516bb6));io['to'](_0x4596a4)['emit'](_0x454152,_0x516bb6);}exports[_0x585c('0xa')]=function(_0x607f52,_0x2ed98c,_0x115b32,_0x651f2c){var _0x1ccf35,_0x37b87;var _0x1d0dac={};var _0x215897;var _0x35de03=Number(_0x115b32[_0x585c('0xb')]);var _0x5dd714=_0x115b32[_0x585c('0xc')]?Boolean(Number(_0x115b32['data2'])):![];var _0x257d4f;var _0x3ec7f6=![];if(!_[_0x585c('0xd')](_0x115b32[_0x585c('0xe')])){if(_0x115b32[_0x585c('0xe')]=='1')_0x3ec7f6=!![];}if(!_0x3ec7f6){if(_0x651f2c['xmd-contactid']){_0x1d0dac['id']=_0x651f2c[_0x585c('0xf')];}}if(!_0x1d0dac['id']){_0x1d0dac[_0x585c('0x10')]=_0x35de03;_0x257d4f=_0x115b32['data3']&&_0x115b32[_0x585c('0x11')]!=='0'?_0x115b32[_0x585c('0x11')][_0x585c('0x12')](','):[_0x585c('0x13')];_0x1d0dac[_0x585c('0x14')]=_[_0x585c('0x15')](_0x257d4f,function(_0x4dd1e9){var _0x41c8fc={};_0x41c8fc[_0x4dd1e9]=_0x651f2c['routeId']?_0x651f2c['destcalleridnum']:_0x651f2c[_0x585c('0x16')];return _0x41c8fc;});_0x215897=_0x651f2c[_0x585c('0x17')]?_0x651f2c['destcalleridnum']:_0x651f2c[_0x585c('0x16')];}var _0x3112c2=['id',_0x585c('0x18'),_0x585c('0x19'),_0x585c('0x13'),_0x585c('0x1a'),_0x585c('0x1b'),_0x585c('0x10'),'createdAt',_0x585c('0x1c'),_0x585c('0x1d')];var _0x42b99b=_[_0x585c('0x1e')](_0x3112c2,_0x257d4f);BPromise['resolve']()[_0x585c('0x1f')](cmContactRpc[_0x585c('0x20')]({'attributes':_0x42b99b,'where':_0x1d0dac,'phone':_0x215897}))[_0x585c('0x1f')](function(_0x324eac){_0x37b87=_0x324eac;if(!_[_0x585c('0x21')](_0x37b87)){if(_0x37b87[_0x585c('0x22')]===0x1){_0x1ccf35=_0x37b87[0x0];logger[_0x585c('0x8')](_0x585c('0x23'),_0x651f2c['uniqueid'],_0x2ed98c['id'],_0x1ccf35['id']);}else{logger[_0x585c('0x8')](_0x585c('0x24'),_0x651f2c[_0x585c('0x25')],_0x2ed98c['id'],_[_0x585c('0x15')](_0x37b87,'id')[_0x585c('0x26')](','));}return;}else{logger['info'](_0x585c('0x27'),_0x651f2c[_0x585c('0x25')],_0x2ed98c['id']);var _0x2145ee={'ListId':_0x35de03};var _0x16c5b5=_0x115b32[_0x585c('0x28')]&&_0x115b32['data4']!=='0'?_0x115b32[_0x585c('0x28')]:_0x585c('0x13');if(_0x5dd714){logger[_0x585c('0x8')](_0x585c('0x29'),_0x651f2c[_0x585c('0x25')],_0x2ed98c['id']);_0x2145ee[_0x16c5b5]=_['isNil'](_0x651f2c[_0x585c('0x17')])?_0x651f2c[_0x585c('0x16')]:_0x651f2c[_0x585c('0x2a')];if(_[_0x585c('0xd')](_0x651f2c[_0x585c('0x17')])){_0x2145ee[_0x585c('0x18')]=_0x651f2c['calleridname']&&_0x651f2c[_0x585c('0x2b')]!==_0x585c('0x2c')?_0x651f2c[_0x585c('0x2b')]:_0x585c('0x2d');}else{_0x2145ee[_0x585c('0x18')]=_0x651f2c[_0x585c('0x2e')]&&_0x651f2c[_0x585c('0x2e')]!==_0x585c('0x2c')?_0x651f2c[_0x585c('0x2e')]:_0x585c('0x2d');}return BPromise[_0x585c('0x2f')]()['then'](cmContactRpc[_0x585c('0x30')](_0x2145ee))['then'](function(_0x4a4a37){_0x1ccf35=_0x4a4a37;_0x37b87[_0x585c('0x31')](_0x4a4a37);if(_0x1ccf35){logger[_0x585c('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x651f2c[_0x585c('0x25')],_0x2ed98c['id'],_0x1ccf35['id']);}return;});}else{logger[_0x585c('0x8')](_0x585c('0x32'),_0x651f2c[_0x585c('0x25')],_0x2ed98c['id']);_0x2145ee[_0x16c5b5]=_['isNil'](_0x651f2c['routeId'])?_0x651f2c['calleridnum']:_0x651f2c['destcalleridnum'];if(_[_0x585c('0xd')](_0x651f2c[_0x585c('0x17')])){_0x2145ee['firstName']=_0x651f2c[_0x585c('0x2b')]&&_0x651f2c['calleridname']!=='<unknown>'?_0x651f2c['calleridname']:'Unknown';}else{_0x2145ee[_0x585c('0x18')]=_0x651f2c[_0x585c('0x2e')]&&_0x651f2c[_0x585c('0x2e')]!==_0x585c('0x2c')?_0x651f2c[_0x585c('0x2e')]:_0x585c('0x2d');}_0x1ccf35=_0x2145ee;_0x37b87[_0x585c('0x31')](_0x2145ee);return;}}})['then'](function(){if(_0x607f52){emit(_0x651f2c[_0x585c('0x25')],_0x2ed98c,util[_0x585c('0x33')](_0x585c('0x34'),_0x607f52[_0x585c('0x35')]),util['format']('trigger:%s',_0x115b32[_0x585c('0x36')]['toLowerCase']()),{'evt':_[_0x585c('0x37')](_0x651f2c,{'autoCreate':_0x5dd714}),'contact':_0x1ccf35===undefined?{}:_0x1ccf35,'contacts':_0x37b87['length']===0x0?undefined:_0x37b87});}});};
\ No newline at end of file
+var _0x9eac=['../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','emit','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','<unknown>','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','merge','lodash','ioredis','util'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x9eac,0x6b));var _0xc9ea=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x9eac[_0x1abeb2];return _0x48da20;};'use strict';var _=require(_0xc9ea('0x0'));var BPromise=require('bluebird');var Redis=require(_0xc9ea('0x1'));var util=require(_0xc9ea('0x2'));var config=require(_0xc9ea('0x3'));var logger=require('../../../../config/logger')(_0xc9ea('0x4'));var cmContactRpc=require(_0xc9ea('0x5'));config[_0xc9ea('0x6')]=_[_0xc9ea('0x7')](config[_0xc9ea('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc9ea('0x8'))(new Redis(config[_0xc9ea('0x6')]));function emit(_0x4d6c6e,_0x43fb56,_0x1f677c,_0x8e3996,_0x38ca43){logger[_0xc9ea('0x9')]('[CM][%s][%s]',_0x4d6c6e,_0x43fb56['id'],_0x1f677c,_0x8e3996,JSON[_0xc9ea('0xa')](_0x38ca43));io['to'](_0x1f677c)[_0xc9ea('0xb')](_0x8e3996,_0x38ca43);}exports['exec']=function(_0x2ca139,_0xad8235,_0x127325,_0x363b94){var _0x5c51d6,_0x1d3b72;var _0x2a0179={};var _0x3c88b6;var _0xd84e95=Number(_0x127325['data1']);var _0x17572a=_0x127325[_0xc9ea('0xc')]?Boolean(Number(_0x127325[_0xc9ea('0xc')])):![];var _0x481cdb;var _0x5964ef=![];if(!_[_0xc9ea('0xd')](_0x127325[_0xc9ea('0xe')])){if(_0x127325[_0xc9ea('0xe')]=='1')_0x5964ef=!![];}if(!_0x5964ef){if(_0x363b94[_0xc9ea('0xf')]){_0x2a0179['id']=_0x363b94[_0xc9ea('0xf')];}}if(!_0x2a0179['id']){_0x2a0179[_0xc9ea('0x10')]=_0xd84e95;_0x481cdb=_0x127325['data3']&&_0x127325['data3']!=='0'?_0x127325[_0xc9ea('0x11')]['split'](','):[_0xc9ea('0x12')];_0x2a0179[_0xc9ea('0x13')]=_[_0xc9ea('0x14')](_0x481cdb,function(_0xd5f435){var _0x214181={};_0x214181[_0xd5f435]=_0x363b94['routeId']?_0x363b94[_0xc9ea('0x15')]:_0x363b94[_0xc9ea('0x16')];return _0x214181;});_0x3c88b6=_0x363b94['routeId']?_0x363b94[_0xc9ea('0x15')]:_0x363b94[_0xc9ea('0x16')];}var _0x2b0f0f=['id',_0xc9ea('0x17'),_0xc9ea('0x18'),_0xc9ea('0x12'),_0xc9ea('0x19'),_0xc9ea('0x1a'),_0xc9ea('0x10'),_0xc9ea('0x1b'),_0xc9ea('0x1c'),_0xc9ea('0x1d')];var _0x385377=_[_0xc9ea('0x1e')](_0x2b0f0f,_0x481cdb);BPromise[_0xc9ea('0x1f')]()[_0xc9ea('0x20')](cmContactRpc[_0xc9ea('0x21')]({'attributes':_0x385377,'where':_0x2a0179,'phone':_0x3c88b6}))[_0xc9ea('0x20')](function(_0xbf65f){_0x1d3b72=_0xbf65f;if(!_[_0xc9ea('0x22')](_0x1d3b72)){if(_0x1d3b72[_0xc9ea('0x23')]===0x1){_0x5c51d6=_0x1d3b72[0x0];logger[_0xc9ea('0x9')](_0xc9ea('0x24'),_0x363b94['uniqueid'],_0xad8235['id'],_0x5c51d6['id']);}else{logger[_0xc9ea('0x9')](_0xc9ea('0x25'),_0x363b94['uniqueid'],_0xad8235['id'],_[_0xc9ea('0x14')](_0x1d3b72,'id')[_0xc9ea('0x26')](','));}return;}else{logger[_0xc9ea('0x9')](_0xc9ea('0x27'),_0x363b94[_0xc9ea('0x28')],_0xad8235['id']);var _0x3d588e={'ListId':_0xd84e95};var _0x8d938d=_0x127325[_0xc9ea('0x29')]&&_0x127325['data4']!=='0'?_0x127325[_0xc9ea('0x29')]:_0xc9ea('0x12');if(_0x17572a){logger[_0xc9ea('0x9')](_0xc9ea('0x2a'),_0x363b94[_0xc9ea('0x28')],_0xad8235['id']);_0x3d588e[_0x8d938d]=_['isNil'](_0x363b94['routeId'])?_0x363b94['calleridnum']:_0x363b94[_0xc9ea('0x15')];if(_['isNil'](_0x363b94[_0xc9ea('0x2b')])){_0x3d588e[_0xc9ea('0x17')]=_0x363b94[_0xc9ea('0x2c')]&&_0x363b94[_0xc9ea('0x2c')]!==_0xc9ea('0x2d')?_0x363b94['calleridname']:_0xc9ea('0x2e');}else{_0x3d588e[_0xc9ea('0x17')]=_0x363b94['destcalleridname']&&_0x363b94['destcalleridname']!==_0xc9ea('0x2d')?_0x363b94[_0xc9ea('0x2f')]:_0xc9ea('0x2e');}return BPromise[_0xc9ea('0x1f')]()[_0xc9ea('0x20')](cmContactRpc[_0xc9ea('0x30')](_0x3d588e))[_0xc9ea('0x20')](function(_0x434ab3){_0x5c51d6=_0x434ab3;_0x1d3b72[_0xc9ea('0x31')](_0x434ab3);if(_0x5c51d6){logger[_0xc9ea('0x9')](_0xc9ea('0x32'),_0x363b94['uniqueid'],_0xad8235['id'],_0x5c51d6['id']);}return;});}else{logger[_0xc9ea('0x9')](_0xc9ea('0x33'),_0x363b94['uniqueid'],_0xad8235['id']);_0x3d588e[_0x8d938d]=_['isNil'](_0x363b94[_0xc9ea('0x2b')])?_0x363b94[_0xc9ea('0x16')]:_0x363b94['destcalleridnum'];if(_[_0xc9ea('0xd')](_0x363b94[_0xc9ea('0x2b')])){_0x3d588e['firstName']=_0x363b94[_0xc9ea('0x2c')]&&_0x363b94[_0xc9ea('0x2c')]!=='<unknown>'?_0x363b94['calleridname']:_0xc9ea('0x2e');}else{_0x3d588e['firstName']=_0x363b94['destcalleridname']&&_0x363b94[_0xc9ea('0x2f')]!==_0xc9ea('0x2d')?_0x363b94[_0xc9ea('0x2f')]:_0xc9ea('0x2e');}_0x5c51d6=_0x3d588e;_0x1d3b72['push'](_0x3d588e);return;}}})[_0xc9ea('0x20')](function(){if(_0x2ca139){emit(_0x363b94['uniqueid'],_0xad8235,util[_0xc9ea('0x34')](_0xc9ea('0x35'),_0x2ca139['name']),util[_0xc9ea('0x34')]('trigger:%s',_0x127325['action']['toLowerCase']()),{'evt':_[_0xc9ea('0x36')](_0x363b94,{'autoCreate':_0x17572a}),'contact':_0x5c51d6===undefined?{}:_0x5c51d6,'contacts':_0x1d3b72[_0xc9ea('0x23')]===0x0?undefined:_0x1d3b72});}});};
\ No newline at end of file
index 5f3acd1..e89b9b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7669=['servicenowAccounts','freshsalesAccounts','accounts','dynamics365Accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','interface','checkTriggers','status','checkTrigger','variables','Actions','length','action','toLowerCase','motionbar','browser','data1','popup','TemplateId','data2','html','uri','buildUri','isNil','data4','location','uriLocation','windowWidth','data5','800','data6','600','winapp','winApplication','render','winArguments','data3','user:%s','name','format','trigger:%s:%s','trigger:%s','merge','contactmanager','exec','queue','urlforward','parse','search','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','exports','util','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x116415,_0x28c819){var _0x10f8ef=function(_0x46d1b3){while(--_0x46d1b3){_0x116415['push'](_0x116415['shift']());}};_0x10f8ef(++_0x28c819);}(_0x7669,0xe5));var _0x9766=function(_0x1427cd,_0x1924a1){_0x1427cd=_0x1427cd-0x0;var _0x201375=_0x7669[_0x1427cd];return _0x201375;};'use strict';var util=require(_0x9766('0x0'));var _=require(_0x9766('0x1'));var url=require(_0x9766('0x2'));var Mustache=require('mustache');var Redis=require(_0x9766('0x3'));var urlforward=require(_0x9766('0x4'));var integration=require(_0x9766('0x5'));var cmContact=require(_0x9766('0x6'));var script=require(_0x9766('0x7'));var config=require(_0x9766('0x8'));var logger=require('../../../config/logger')(_0x9766('0x9'));var ami=require(_0x9766('0xa'));config[_0x9766('0xb')]=_[_0x9766('0xc')](config['redis'],{'host':_0x9766('0xd'),'port':0x18eb});var io=require(_0x9766('0xe'))(new Redis(config[_0x9766('0xb')]));var operators={'equals':function(_0x24cdc0,_0x1832a1){return _0x24cdc0==_0x1832a1;},'not_equals':function(_0x5cb787,_0x11fda4){return _0x5cb787!=_0x11fda4;}};var barAndWebActions=['popup',_0x9766('0x2'),'winapp'];function Trigger(_0x3f66a4){this['triggers']=_0x3f66a4[_0x9766('0xf')];this['agents']=_0x3f66a4[_0x9766('0x10')];this[_0x9766('0x11')]=_0x3f66a4['voiceQueues'];this['templates']=_0x3f66a4[_0x9766('0x12')];this['voiceExtensions']=_0x3f66a4[_0x9766('0x13')];this['zendeskAccounts']=_0x3f66a4[_0x9766('0x14')];this[_0x9766('0x15')]=_0x3f66a4['freshdeskAccounts'];this[_0x9766('0x16')]=_0x3f66a4['salesforceAccounts'];this[_0x9766('0x17')]=_0x3f66a4[_0x9766('0x17')];this[_0x9766('0x18')]=_0x3f66a4[_0x9766('0x18')];this[_0x9766('0x19')]=_0x3f66a4[_0x9766('0x19')];this['vtigerAccounts']=_0x3f66a4[_0x9766('0x1a')];this[_0x9766('0x1b')]=_0x3f66a4[_0x9766('0x1b')];this['dynamics365Accounts']=_0x3f66a4['dynamics365Accounts'];this['freshsalesAccounts']=_0x3f66a4[_0x9766('0x1c')];this[_0x9766('0x1d')]={'zendesk':this[_0x9766('0x14')],'salesforce':this[_0x9766('0x16')],'freshdesk':this[_0x9766('0x15')],'sugarcrm':this[_0x9766('0x17')],'zoho':this[_0x9766('0x18')],'desk':this[_0x9766('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x9766('0x1e')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x9766('0x1f'),this['syncCustomEvent'][_0x9766('0x20')](this));ami['on'](_0x9766('0x21'),this[_0x9766('0x22')][_0x9766('0x20')](this));ami['on'](_0x9766('0x23'),this[_0x9766('0x22')]['bind'](this));ami['on'](_0x9766('0x24'),this['syncCustomEvent'][_0x9766('0x20')](this));ami['on'](_0x9766('0x25'),this[_0x9766('0x22')][_0x9766('0x20')](this));ami['on'](_0x9766('0x26'),this['syncCustomEvent'][_0x9766('0x20')](this));ami['on']('custom:agentbusy',this[_0x9766('0x22')][_0x9766('0x20')](this));ami['on']('custom:agentcongestion',this[_0x9766('0x22')]['bind'](this));ami['on'](_0x9766('0x27'),this[_0x9766('0x22')]['bind'](this));ami['on'](_0x9766('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0x9766('0x29'),this[_0x9766('0x22')][_0x9766('0x20')](this));ami['on'](_0x9766('0x2a'),this['syncCustomEvent'][_0x9766('0x20')](this));ami['on'](_0x9766('0x2b'),this['syncAgentDial'][_0x9766('0x20')](this));ami['on']('custom:dialconnect',this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0x9766('0x2c')]['bind'](this));ami['on'](_0x9766('0x2d'),this[_0x9766('0x22')]['bind'](this));ami['on'](_0x9766('0x2e'),this[_0x9766('0x22')]['bind'](this));ami['on']('custom:substatus',this[_0x9766('0x22')][_0x9766('0x20')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x9766('0x20')](this));ami['on'](_0x9766('0x2f'),this[_0x9766('0x22')]['bind'](this));ami['on'](_0x9766('0x30'),this['syncCustomEvent'][_0x9766('0x20')](this));ami['on']('custom:rejectmessage',this[_0x9766('0x22')][_0x9766('0x20')](this));ami['on'](_0x9766('0x31'),this[_0x9766('0x22')][_0x9766('0x20')](this));}Trigger[_0x9766('0x32')][_0x9766('0x33')]=function(_0x1ec70e,_0x2eebb2,_0x5c6819){logger[_0x9766('0x34')](_0x1ec70e,_0x2eebb2,JSON[_0x9766('0x35')](_0x5c6819));io['to'](_0x1ec70e)[_0x9766('0x33')](_0x2eebb2,_0x5c6819);};Trigger[_0x9766('0x32')][_0x9766('0x22')]=function(_0x419036){var _0xec2088=_[_0x9766('0x36')](_0x419036);if(typeof _0xec2088[_0x9766('0x37')]===_0x9766('0x38')){_0xec2088[_0x9766('0x37')]=_0x9766('0x39');}this['checkTriggers'](_0xec2088);};Trigger['prototype'][_0x9766('0x2c')]=function(_0x587987){if(this['agents'][_0x587987[_0x9766('0x3a')]]){this[_0x9766('0x22')](_0x587987);}};Trigger['prototype'][_0x9766('0x3b')]=function(_0x36b23b){var _0x581690;for(var _0x2c8749 in this[_0x9766('0xf')]){if(this[_0x9766('0xf')]['hasOwnProperty'](_0x2c8749)){if(this['triggers'][_0x2c8749][_0x9766('0x3c')]){_0x581690=this[_0x9766('0x3d')](this[_0x9766('0xf')][_0x2c8749],_0x36b23b);if(_0x581690){_['merge'](_0x36b23b,_0x36b23b[_0x9766('0x3e')]);for(var _0x13f078=0x0,_0x10c85b,_0x1cbe91,_0x204ce5;_0x13f078<this['triggers'][_0x2c8749][_0x9766('0x3f')][_0x9766('0x40')];_0x13f078+=0x1){_0x10c85b=this['triggers'][_0x2c8749]['Actions'][_0x13f078];if(this[_0x9766('0x10')][_0x36b23b[_0x9766('0x3a')]]){switch(_0x10c85b[_0x9766('0x41')][_0x9766('0x42')]()){case'contactmanager':break;case _0x9766('0x43'):case _0x9766('0x44'):var _0x45fb40={};switch(barAndWebActions[_0x10c85b[_0x9766('0x45')]]){case _0x9766('0x46'):_0x45fb40[_0x9766('0x47')]=_0x10c85b[_0x9766('0x48')];_0x45fb40[_0x9766('0x49')]=this[_0x9766('0x12')][_0x10c85b[_0x9766('0x48')]]?Mustache['render'](this[_0x9766('0x12')][_0x10c85b['data2']][_0x9766('0x49')],_0x36b23b):'template\x20not\x20found';break;case _0x9766('0x2'):_0x45fb40[_0x9766('0x4a')]=this[_0x9766('0x4b')](_0x10c85b[_0x9766('0x48')],_0x36b23b,_['isNil'](_0x10c85b['data3'])?!![]:parseInt(_0x10c85b['data3'],0xa));if(_[_0x9766('0x4c')](_0x10c85b[_0x9766('0x4d')])){_0x45fb40[_0x9766('0x4e')]='0';}else{_0x45fb40[_0x9766('0x4f')]=_0x10c85b[_0x9766('0x4d')];_0x45fb40[_0x9766('0x50')]=_[_0x9766('0x4c')](_0x10c85b[_0x9766('0x51')])?_0x9766('0x52'):_0x10c85b[_0x9766('0x51')];_0x45fb40['windowHeight']=_['isNil'](_0x10c85b[_0x9766('0x53')])?_0x9766('0x54'):_0x10c85b[_0x9766('0x53')];}break;case _0x9766('0x55'):_0x45fb40[_0x9766('0x56')]=_0x10c85b[_0x9766('0x48')]?Mustache[_0x9766('0x57')](_0x10c85b[_0x9766('0x48')],_0x36b23b):'';_0x45fb40[_0x9766('0x58')]=_0x10c85b[_0x9766('0x59')]?Mustache[_0x9766('0x57')](_0x10c85b[_0x9766('0x59')],_0x36b23b):'';break;}this[_0x9766('0x33')](util['format'](_0x9766('0x5a'),this['agents'][_0x36b23b[_0x9766('0x3a')]][_0x9766('0x5b')]),util[_0x9766('0x5c')](_0x9766('0x5d'),_0x10c85b[_0x9766('0x41')][_0x9766('0x42')](),barAndWebActions[_0x10c85b['data1']]),_['merge'](_0x45fb40,_0x36b23b));break;case'jscripty':this[_0x9766('0x33')](util[_0x9766('0x5c')]('user:%s',this[_0x9766('0x10')][_0x36b23b['interface']][_0x9766('0x5b')]),util[_0x9766('0x5c')](_0x9766('0x5e'),_0x10c85b['action'][_0x9766('0x42')]()),_[_0x9766('0x5f')]({'ProjectId':parseInt(_0x10c85b[_0x9766('0x45')],0xa)},_0x36b23b));break;default:this['emit'](util[_0x9766('0x5c')](_0x9766('0x5a'),this[_0x9766('0x10')][_0x36b23b[_0x9766('0x3a')]][_0x9766('0x5b')]),util['format'](_0x9766('0x5e'),_0x10c85b[_0x9766('0x41')][_0x9766('0x42')]()),_[_0x9766('0x5f')]({},_0x10c85b,_0x36b23b));}}switch(_0x10c85b[_0x9766('0x41')]['toLowerCase']()){case _0x9766('0x60'):cmContact[_0x9766('0x61')](this[_0x9766('0x10')][_0x36b23b[_0x9766('0x3a')]],this[_0x9766('0xf')][_0x2c8749],_0x10c85b,_0x36b23b);break;case'integration':integration['exec'](_0x10c85b,_0x36b23b,this[_0x9766('0x1d')],this['agents'][_0x36b23b[_0x9766('0x3a')]],this[_0x9766('0x11')][_0x36b23b[_0x9766('0x62')]],this['voiceExtensions'][_0x36b23b['routeId']]);break;case _0x9766('0x63'):urlforward['exec'](_0x10c85b,_0x36b23b);break;case'script':script['exec'](_0x10c85b,_0x36b23b);break;}}}}}}};Trigger[_0x9766('0x32')][_0x9766('0x4b')]=function(_0x5361b4,_0x381f21,_0x5e5cd8){var _0x441791=url[_0x9766('0x64')](Mustache[_0x9766('0x57')](_0x5361b4,_0x381f21),!![]);if(_0x5e5cd8){_[_0x9766('0x5f')](_0x441791['query'],_0x381f21);}delete _0x441791[_0x9766('0x65')];var _0x4087ef=url[_0x9766('0x5c')](_0x441791);_0x4087ef=_0x4087ef['replace'](/\/\?/g,'?');return _0x4087ef;};Trigger[_0x9766('0x32')]['checkTrigger']=function(_0x12414d,_0x30679d){var _0x35aa50=!![];var _0x1456c2=!![];var _0x16769c=![];if(_0x12414d[_0x9766('0x66')]===_0x30679d[_0x9766('0x37')]){_0x16769c=!![];}if(_0x12414d[_0x9766('0x67')]['length']){_0x35aa50=_[_0x9766('0x68')](_0x12414d[_0x9766('0x67')],this[_0x9766('0x69')](_0x30679d,_0x12414d[_0x9766('0x66')]));}if(_0x12414d[_0x9766('0x6a')][_0x9766('0x40')]){_0x1456c2=_[_0x9766('0x6b')](_0x12414d[_0x9766('0x6a')],this[_0x9766('0x69')](_0x30679d,_0x12414d[_0x9766('0x66')]));}return _0x16769c&&_0x35aa50&&_0x1456c2;};Trigger[_0x9766('0x32')][_0x9766('0x69')]=function(_0x16c499,_0x9ab152){return function(_0x211e91){switch(_0x211e91[_0x9766('0x6c')]){case _0x9766('0x6d'):if(_0x16c499[_0x9766('0x66')]===_0x9ab152){if(_0x9ab152==='chat'){return _0x16c499[_0x9766('0x6e')]?operators[_0x211e91[_0x9766('0x6f')]](Number(_0x211e91[_0x9766('0x70')]),_0x16c499[_0x9766('0x6e')]):![];}else{return _0x16c499[_['upperFirst'](_0x9ab152)+_0x9766('0x71')]?operators[_0x211e91['operator']](Number(_0x211e91['value']),_0x16c499[_[_0x9766('0x72')](_0x9ab152)+_0x9766('0x71')]):![];}}break;case _0x9766('0x73'):case _0x9766('0x74'):if(_0x16c499[_0x9766('0x66')]===_0x9ab152){return _0x16c499[_0x9766('0x75')]?operators[_0x211e91[_0x9766('0x6f')]](_0x211e91[_0x9766('0x70')],_0x16c499[_0x9766('0x75')]):![];}break;case'queue':return _0x16c499[_0x9766('0x62')]?operators[_0x211e91[_0x9766('0x6f')]](_0x211e91[_0x9766('0x70')],_0x16c499[_0x9766('0x62')]):![];case _0x9766('0x76'):return _0x16c499[_0x9766('0x77')]?operators[_0x211e91['operator']](_0x211e91[_0x9766('0x70')],_0x16c499[_0x9766('0x77')]):![];case _0x9766('0x78'):return _0x16c499[_0x9766('0x78')]?operators[_0x211e91[_0x9766('0x6f')]](_0x211e91[_0x9766('0x70')],_0x16c499['lastevent']):![];case _0x9766('0x79'):return _0x16c499[_0x9766('0x79')]?operators[_0x211e91[_0x9766('0x6f')]](_0x211e91[_0x9766('0x70')],_0x16c499[_0x9766('0x79')]):![];case _0x9766('0x7a'):if(_0x211e91[_0x9766('0x70')]===_0x9766('0x7b'))_0x211e91[_0x9766('0x70')]=null;return typeof _0x16c499[_0x9766('0x7c')]!==_0x9766('0x38')?operators[_0x211e91[_0x9766('0x6f')]](_0x211e91[_0x9766('0x70')],_0x16c499['substatus']):![];case _0x9766('0x7d'):if(_0x16c499[_0x9766('0x66')]===_0x9ab152){return _0x211e91[_0x9766('0x70')]===_0x9766('0x7e')&&_0x211e91['operator']==='equals'?!![]:![];}break;}return![];};};module[_0x9766('0x7f')]=Trigger;
\ No newline at end of file
+var _0x2015=['ChatWebsiteId','operator','AccountId','value','upperFirst','interaction','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','info','stringify','emit','prototype','clone','undefined','motionChannel','voice','interface','checkTriggers','status','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data4','location','uriLocation','windowWidth','data5','data6','600','winArguments','data3','format','user:%s','trigger:%s:%s','jscripty','name','trigger:%s','integration','exec','queue','routeId','urlforward','parse','query','replace','channel','every','checkConditions','AnyConditions','some','field','account'];(function(_0x327e3e,_0x327f25){var _0x542de0=function(_0x406af6){while(--_0x406af6){_0x327e3e['push'](_0x327e3e['shift']());}};_0x542de0(++_0x327f25);}(_0x2015,0x193));var _0x5201=function(_0x5650e2,_0x1ff53b){_0x5650e2=_0x5650e2-0x0;var _0x596dae=_0x2015[_0x5650e2];return _0x596dae;};'use strict';var util=require(_0x5201('0x0'));var _=require(_0x5201('0x1'));var url=require(_0x5201('0x2'));var Mustache=require(_0x5201('0x3'));var Redis=require(_0x5201('0x4'));var urlforward=require(_0x5201('0x5'));var integration=require(_0x5201('0x6'));var cmContact=require(_0x5201('0x7'));var script=require('./script');var config=require(_0x5201('0x8'));var logger=require(_0x5201('0x9'))(_0x5201('0xa'));var ami=require(_0x5201('0xb'));config[_0x5201('0xc')]=_[_0x5201('0xd')](config[_0x5201('0xc')],{'host':_0x5201('0xe'),'port':0x18eb});var io=require(_0x5201('0xf'))(new Redis(config[_0x5201('0xc')]));var operators={'equals':function(_0x516b4e,_0x4100e9){return _0x516b4e==_0x4100e9;},'not_equals':function(_0x17d8f3,_0x48b93d){return _0x17d8f3!=_0x48b93d;}};var barAndWebActions=[_0x5201('0x10'),_0x5201('0x2'),_0x5201('0x11')];function Trigger(_0x47aa66){this[_0x5201('0x12')]=_0x47aa66[_0x5201('0x12')];this[_0x5201('0x13')]=_0x47aa66[_0x5201('0x13')];this[_0x5201('0x14')]=_0x47aa66[_0x5201('0x14')];this[_0x5201('0x15')]=_0x47aa66[_0x5201('0x15')];this[_0x5201('0x16')]=_0x47aa66[_0x5201('0x16')];this[_0x5201('0x17')]=_0x47aa66[_0x5201('0x17')];this['freshdeskAccounts']=_0x47aa66[_0x5201('0x18')];this[_0x5201('0x19')]=_0x47aa66['salesforceAccounts'];this['sugarcrmAccounts']=_0x47aa66[_0x5201('0x1a')];this[_0x5201('0x1b')]=_0x47aa66[_0x5201('0x1b')];this['deskAccounts']=_0x47aa66['deskAccounts'];this[_0x5201('0x1c')]=_0x47aa66['vtigerAccounts'];this[_0x5201('0x1d')]=_0x47aa66['servicenowAccounts'];this[_0x5201('0x1e')]=_0x47aa66['dynamics365Accounts'];this[_0x5201('0x1f')]=_0x47aa66[_0x5201('0x1f')];this[_0x5201('0x20')]={'zendesk':this[_0x5201('0x17')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x5201('0x1a')],'zoho':this[_0x5201('0x1b')],'desk':this[_0x5201('0x21')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x5201('0x1e')],'freshsales':this[_0x5201('0x1f')],'servicenow':this[_0x5201('0x1d')]};ami['on'](_0x5201('0x22'),this[_0x5201('0x23')]['bind'](this));ami['on'](_0x5201('0x24'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x26'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x27'),this['syncCustomEvent'][_0x5201('0x25')](this));ami['on'](_0x5201('0x28'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x29'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x2a'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on']('custom:agentcongestion',this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on']('custom:agentreject',this[_0x5201('0x23')]['bind'](this));ami['on']('custom:amd',this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x2b'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5201('0x2c'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x2d'),this['syncAgentDial'][_0x5201('0x25')](this));ami['on'](_0x5201('0x2e'),this[_0x5201('0x2f')][_0x5201('0x25')](this));ami['on'](_0x5201('0x30'),this['syncAgentDial']['bind'](this));ami['on'](_0x5201('0x31'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x32'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x33'),this['syncCustomEvent'][_0x5201('0x25')](this));ami['on'](_0x5201('0x34'),this[_0x5201('0x23')]['bind'](this));ami['on'](_0x5201('0x35'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x36'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x37'),this[_0x5201('0x23')][_0x5201('0x25')](this));ami['on'](_0x5201('0x38'),this[_0x5201('0x23')][_0x5201('0x25')](this));}Trigger['prototype']['emit']=function(_0xe0a16e,_0xdc5ac4,_0x23d939){logger[_0x5201('0x39')](_0xe0a16e,_0xdc5ac4,JSON[_0x5201('0x3a')](_0x23d939));io['to'](_0xe0a16e)[_0x5201('0x3b')](_0xdc5ac4,_0x23d939);};Trigger[_0x5201('0x3c')]['syncCustomEvent']=function(_0x4311fa){var _0x111501=_[_0x5201('0x3d')](_0x4311fa);if(typeof _0x111501['motionChannel']===_0x5201('0x3e')){_0x111501[_0x5201('0x3f')]=_0x5201('0x40');}this['checkTriggers'](_0x111501);};Trigger[_0x5201('0x3c')][_0x5201('0x2f')]=function(_0x56049f){if(this['agents'][_0x56049f[_0x5201('0x41')]]){this[_0x5201('0x23')](_0x56049f);}};Trigger[_0x5201('0x3c')][_0x5201('0x42')]=function(_0x235841){var _0x3db6db;for(var _0x4db6a3 in this[_0x5201('0x12')]){if(this['triggers']['hasOwnProperty'](_0x4db6a3)){if(this[_0x5201('0x12')][_0x4db6a3][_0x5201('0x43')]){_0x3db6db=this[_0x5201('0x44')](this[_0x5201('0x12')][_0x4db6a3],_0x235841);if(_0x3db6db){_[_0x5201('0x45')](_0x235841,_0x235841['variables']);for(var _0x21d83a=0x0,_0x4a34b8,_0x161769,_0x2cdf39;_0x21d83a<this[_0x5201('0x12')][_0x4db6a3][_0x5201('0x46')][_0x5201('0x47')];_0x21d83a+=0x1){_0x4a34b8=this['triggers'][_0x4db6a3]['Actions'][_0x21d83a];if(this[_0x5201('0x13')][_0x235841[_0x5201('0x41')]]){switch(_0x4a34b8[_0x5201('0x48')][_0x5201('0x49')]()){case _0x5201('0x4a'):break;case'motionbar':case'browser':var _0x1f8aba={};switch(barAndWebActions[_0x4a34b8[_0x5201('0x4b')]]){case _0x5201('0x10'):_0x1f8aba[_0x5201('0x4c')]=_0x4a34b8[_0x5201('0x4d')];_0x1f8aba[_0x5201('0x4e')]=this[_0x5201('0x15')][_0x4a34b8[_0x5201('0x4d')]]?Mustache[_0x5201('0x4f')](this[_0x5201('0x15')][_0x4a34b8[_0x5201('0x4d')]]['html'],_0x235841):'template\x20not\x20found';break;case _0x5201('0x2'):_0x1f8aba[_0x5201('0x50')]=this[_0x5201('0x51')](_0x4a34b8[_0x5201('0x4d')],_0x235841,_[_0x5201('0x52')](_0x4a34b8['data3'])?!![]:parseInt(_0x4a34b8['data3'],0xa));if(_[_0x5201('0x52')](_0x4a34b8[_0x5201('0x53')])){_0x1f8aba[_0x5201('0x54')]='0';}else{_0x1f8aba[_0x5201('0x55')]=_0x4a34b8[_0x5201('0x53')];_0x1f8aba[_0x5201('0x56')]=_['isNil'](_0x4a34b8['data5'])?'800':_0x4a34b8[_0x5201('0x57')];_0x1f8aba['windowHeight']=_[_0x5201('0x52')](_0x4a34b8[_0x5201('0x58')])?_0x5201('0x59'):_0x4a34b8[_0x5201('0x58')];}break;case _0x5201('0x11'):_0x1f8aba['winApplication']=_0x4a34b8[_0x5201('0x4d')]?Mustache[_0x5201('0x4f')](_0x4a34b8[_0x5201('0x4d')],_0x235841):'';_0x1f8aba[_0x5201('0x5a')]=_0x4a34b8[_0x5201('0x5b')]?Mustache[_0x5201('0x4f')](_0x4a34b8[_0x5201('0x5b')],_0x235841):'';break;}this[_0x5201('0x3b')](util[_0x5201('0x5c')](_0x5201('0x5d'),this['agents'][_0x235841[_0x5201('0x41')]]['name']),util[_0x5201('0x5c')](_0x5201('0x5e'),_0x4a34b8['action'][_0x5201('0x49')](),barAndWebActions[_0x4a34b8[_0x5201('0x4b')]]),_['merge'](_0x1f8aba,_0x235841));break;case _0x5201('0x5f'):this['emit'](util[_0x5201('0x5c')](_0x5201('0x5d'),this[_0x5201('0x13')][_0x235841[_0x5201('0x41')]][_0x5201('0x60')]),util['format'](_0x5201('0x61'),_0x4a34b8[_0x5201('0x48')][_0x5201('0x49')]()),_[_0x5201('0x45')]({'ProjectId':parseInt(_0x4a34b8[_0x5201('0x4b')],0xa)},_0x235841));break;default:this[_0x5201('0x3b')](util[_0x5201('0x5c')](_0x5201('0x5d'),this[_0x5201('0x13')][_0x235841[_0x5201('0x41')]][_0x5201('0x60')]),util[_0x5201('0x5c')]('trigger:%s',_0x4a34b8[_0x5201('0x48')][_0x5201('0x49')]()),_[_0x5201('0x45')]({},_0x4a34b8,_0x235841));}}switch(_0x4a34b8[_0x5201('0x48')][_0x5201('0x49')]()){case _0x5201('0x4a'):cmContact['exec'](this[_0x5201('0x13')][_0x235841[_0x5201('0x41')]],this[_0x5201('0x12')][_0x4db6a3],_0x4a34b8,_0x235841);break;case _0x5201('0x62'):integration[_0x5201('0x63')](_0x4a34b8,_0x235841,this[_0x5201('0x20')],this[_0x5201('0x13')][_0x235841['interface']],this['voiceQueues'][_0x235841[_0x5201('0x64')]],this[_0x5201('0x16')][_0x235841[_0x5201('0x65')]]);break;case _0x5201('0x66'):urlforward[_0x5201('0x63')](_0x4a34b8,_0x235841);break;case'script':script[_0x5201('0x63')](_0x4a34b8,_0x235841);break;}}}}}}};Trigger[_0x5201('0x3c')][_0x5201('0x51')]=function(_0x577f6d,_0x16a21c,_0x26d801){var _0x19edc4=url[_0x5201('0x67')](Mustache[_0x5201('0x4f')](_0x577f6d,_0x16a21c),!![]);if(_0x26d801){_['merge'](_0x19edc4[_0x5201('0x68')],_0x16a21c);}delete _0x19edc4['search'];var _0x82ba62=url[_0x5201('0x5c')](_0x19edc4);_0x82ba62=_0x82ba62[_0x5201('0x69')](/\/\?/g,'?');return _0x82ba62;};Trigger[_0x5201('0x3c')][_0x5201('0x44')]=function(_0x5a10bc,_0x3d8671){var _0x52a057=!![];var _0x791e5=!![];var _0x1c3b1e=![];if(_0x5a10bc[_0x5201('0x6a')]===_0x3d8671[_0x5201('0x3f')]){_0x1c3b1e=!![];}if(_0x5a10bc['AllConditions'][_0x5201('0x47')]){_0x52a057=_[_0x5201('0x6b')](_0x5a10bc['AllConditions'],this[_0x5201('0x6c')](_0x3d8671,_0x5a10bc[_0x5201('0x6a')]));}if(_0x5a10bc[_0x5201('0x6d')][_0x5201('0x47')]){_0x791e5=_[_0x5201('0x6e')](_0x5a10bc['AnyConditions'],this[_0x5201('0x6c')](_0x3d8671,_0x5a10bc[_0x5201('0x6a')]));}return _0x1c3b1e&&_0x52a057&&_0x791e5;};Trigger['prototype'][_0x5201('0x6c')]=function(_0x722739,_0x5eca99){return function(_0x46e6e0){switch(_0x46e6e0[_0x5201('0x6f')]){case _0x5201('0x70'):if(_0x722739['channel']===_0x5eca99){if(_0x5eca99==='chat'){return _0x722739[_0x5201('0x71')]?operators[_0x46e6e0[_0x5201('0x72')]](Number(_0x46e6e0['value']),_0x722739['ChatWebsiteId']):![];}else{return _0x722739[_['upperFirst'](_0x5eca99)+_0x5201('0x73')]?operators[_0x46e6e0['operator']](Number(_0x46e6e0[_0x5201('0x74')]),_0x722739[_[_0x5201('0x75')](_0x5eca99)+_0x5201('0x73')]):![];}}break;case _0x5201('0x76'):case'message':if(_0x722739[_0x5201('0x6a')]===_0x5eca99){return _0x722739[_0x5201('0x77')]?operators[_0x46e6e0[_0x5201('0x72')]](_0x46e6e0[_0x5201('0x74')],_0x722739[_0x5201('0x77')]):![];}break;case _0x5201('0x64'):return _0x722739[_0x5201('0x64')]?operators[_0x46e6e0[_0x5201('0x72')]](_0x46e6e0['value'],_0x722739[_0x5201('0x64')]):![];case _0x5201('0x78'):return _0x722739['membername']?operators[_0x46e6e0[_0x5201('0x72')]](_0x46e6e0['value'],_0x722739[_0x5201('0x79')]):![];case'lastevent':return _0x722739[_0x5201('0x7a')]?operators[_0x46e6e0['operator']](_0x46e6e0['value'],_0x722739['lastevent']):![];case _0x5201('0x65'):return _0x722739['routeId']?operators[_0x46e6e0[_0x5201('0x72')]](_0x46e6e0[_0x5201('0x74')],_0x722739['routeId']):![];case _0x5201('0x7b'):if(_0x46e6e0[_0x5201('0x74')]===_0x5201('0x7c'))_0x46e6e0['value']=null;return typeof _0x722739[_0x5201('0x7d')]!=='undefined'?operators[_0x46e6e0[_0x5201('0x72')]](_0x46e6e0[_0x5201('0x74')],_0x722739[_0x5201('0x7d')]):![];case _0x5201('0x7e'):if(_0x722739[_0x5201('0x6a')]===_0x5eca99){return _0x46e6e0['value']==='created'&&_0x46e6e0['operator']===_0x5201('0x7f')?!![]:![];}break;}return![];};};module[_0x5201('0x80')]=Trigger;
\ No newline at end of file
index 35763fe..2775e06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x4dfa26,_0x560170){_0x4dfa26=_0x4dfa26-0x0;var _0x8419ee=_0xe14b[_0x4dfa26];return _0x8419ee;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});};
\ No newline at end of file
+var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x326f,0xd1));var _0xf326=function(_0x16a85c,_0x4e6048){_0x16a85c=_0x16a85c-0x0;var _0x349203=_0x326f[_0x16a85c];return _0x349203;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});};
\ No newline at end of file
index 4421b65..609295a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x336d=[']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','username','password','clientSecret','then','access_token','catch',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','POST','contacts','/systemusers(','userId','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','forEach','string','type','customField','indexOf','ticketType','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','monitor_format','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x336d,0xd5));var _0xd336=function(_0x3a8c83,_0x6d30){_0x3a8c83=_0x3a8c83-0x0;var _0x3b0288=_0x336d[_0x3a8c83];return _0x3b0288;};'use strict';var _=require(_0xd336('0x0'));var rp=require(_0xd336('0x1'));var util=require(_0xd336('0x2'));var intUtil=require(_0xd336('0x3'));var md5=require(_0xd336('0x4'));var Redis=require(_0xd336('0x5'));var logger=require(_0xd336('0x6'))('dynamics365');var config=require(_0xd336('0x7'));config[_0xd336('0x8')]=_['defaults'](config[_0xd336('0x8')],{'host':_0xd336('0x9'),'port':0x18eb});var io=require(_0xd336('0xa'))(new Redis(config[_0xd336('0x8')]));function getAuthToken(_0x4dca12,_0x42f175,_0x5203e3){if(_0x4dca12['modernAuthentication']){_0x4dca12[_0xd336('0xb')]=_0x4dca12[_0xd336('0xc')][_0xd336('0xd')];_0x4dca12[_0xd336('0xe')]=_0x4dca12['CloudProvider'][_0xd336('0xf')];return Promise[_0xd336('0x10')](_0x4dca12[_0xd336('0xc')][_0xd336('0x11')]);}var _0x3a1cc3={'method':'POST','uri':_0x42f175,'form':{'client_id':_0x4dca12['clientId'],'resource':_0x4dca12[_0xd336('0xb')],'username':_0x4dca12[_0xd336('0x12')],'password':_0x4dca12[_0xd336('0x13')],'grant_type':_0xd336('0x13'),'client_secret':_0x4dca12[_0xd336('0x14')]},'json':!![]};return rp(_0x3a1cc3)[_0xd336('0x15')](function(_0x34b57d){return _0x34b57d[_0xd336('0x16')];})[_0xd336('0x17')](function(_0x314994){logger['error']('['+[_0x5203e3['toUpperCase']()]+_0xd336('0x18'));return _0x314994[_0xd336('0x19')];});}function getUser(_0x50f1f8,_0x4ed72b,_0x3ee726,_0x4b403d,_0x19af2a,_0xec2df8){return new Promise(function(_0xd7702a,_0x486eda){return getAuthToken(_0x4ed72b,_0x4b403d,_0xec2df8)[_0xd336('0x15')](function(_0x5161ff){var _0x421d90={'method':_0xd336('0x1a'),'uri':_0x19af2a+_0xd336('0x1b'),'headers':{'Authorization':_0xd336('0x1c')+_0x5161ff,'OData-Version':_0xd336('0x1d')},'json':!![]};return rp(_0x421d90);})['then'](function(_0x145209){var _0x2693fa=_0x145209[_0xd336('0x1e')];var _0x3e7eef=![];var _0x10e05a=null;if(!_['isNil'](_0x3ee726)){if(intUtil[_0xd336('0x1f')](_0x3ee726['email'])){_0x50f1f8[_0xd336('0x20')]=_0x3ee726[_0xd336('0x21')];for(_0x10e05a=0x0;_0x10e05a<_0x2693fa[_0xd336('0x22')];_0x10e05a++){if(_0x2693fa[_0x10e05a][_0xd336('0x23')]===_0x3ee726[_0xd336('0x21')]&&!_0x2693fa[_0x10e05a][_0xd336('0x24')]){_0x3e7eef=!![];logger[_0xd336('0x25')]('['+[_0xec2df8[_0xd336('0x26')]()]+']\x20Agent\x20found\x20'+_0x2693fa[_0x10e05a][_0xd336('0x27')]+'!');_0x50f1f8['userId']=_0x2693fa[_0x10e05a][_0xd336('0x27')];}}}}if(!_0x3e7eef){logger[_0xd336('0x25')]('['+[_0xec2df8[_0xd336('0x26')]()]+_0xd336('0x28'));_0x50f1f8[_0xd336('0x20')]=_0x4ed72b[_0xd336('0x12')];for(_0x10e05a=0x0;_0x10e05a<_0x2693fa[_0xd336('0x22')];_0x10e05a++){if(_0x2693fa[_0x10e05a][_0xd336('0x23')]===_0x4ed72b[_0xd336('0x12')]){_0x50f1f8['userId']=_0x2693fa[_0x10e05a][_0xd336('0x27')];}}}_0xd7702a(_0x50f1f8);})[_0xd336('0x17')](function(_0x1be863){_0x486eda(_0x1be863[_0xd336('0x19')]);});});}function createEndUser(_0x4638aa,_0x5af26a,_0x3b1fa9,_0x510fd2,_0x2354ec,_0x4ff150,_0x15bb01){return new Promise(function(_0x4960f8,_0x3737ff){return getAuthToken(_0x5af26a,_0x3b1fa9,_0x4ff150)[_0xd336('0x15')](function(_0x39e5d9){var _0x2466f5=_0x4ff150[_0xd336('0x29')]()==='outbound'?_0x2354ec[_0xd336('0x2a')]:_0x2354ec[_0xd336('0x2b')];var _0x26c55a={'method':_0xd336('0x2c'),'uri':_0x510fd2+_0xd336('0x2d'),'body':{'fullname':_0x2466f5,'firstname':_0x2466f5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd336('0x2e')+_0x4638aa[_0xd336('0x2f')]+')'},'headers':{'Authorization':_0xd336('0x1c')+_0x39e5d9,'OData-Version':_0xd336('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x26c55a[_0xd336('0x30')][_0x15bb01]=_0x2466f5;return rp(_0x26c55a);})[_0xd336('0x15')](function(_0x555d60){var _0x2088f4=_0x555d60[_0xd336('0x31')][_0xd336('0x32')];var _0x17690c=_0x2088f4[_0xd336('0x33')](_0x2088f4[_0xd336('0x34')]('(')+0x1,_0x2088f4['lastIndexOf'](')'));_0x4638aa[_0xd336('0x35')]=_0x17690c;_0x4960f8(_0x4638aa);})[_0xd336('0x17')](function(_0x387b2a){_0x3737ff(_0x387b2a['message']);});});}function getEndUser(_0x32f9d6,_0x59c62c,_0x485fa,_0x2d928a,_0x46bb9d,_0x4e2d63,_0x3c88a5,_0x53ce25){var _0x1d2bbd=_0x4e2d63[_0xd336('0x29')]()===_0xd336('0x36')?_0x46bb9d[_0xd336('0x2a')]:_0x46bb9d[_0xd336('0x2b')];return getAuthToken(_0x59c62c,_0x485fa,_0x4e2d63)['then'](function(_0x511b56){_0x53ce25=_0x53ce25?_0x53ce25:_0xd336('0x37');var _0x1c6518={'method':'GET','uri':_0x2d928a+_0xd336('0x38')+_0x53ce25+_0xd336('0x39')+_0x53ce25+_0xd336('0x3a')+_0x1d2bbd[_0xd336('0x3b')]('+',_0xd336('0x3c'))+'\x27','headers':{'Authorization':_0xd336('0x1c')+_0x511b56,'If-None-Match':null,'OData-Version':_0xd336('0x1d')},'json':!![]};return rp(_0x1c6518);})['then'](function(_0x34b117){var _0x512a6e=![];if(!_0x34b117)return _0x512a6e;var _0x5af08d=_0x34b117[_0xd336('0x1e')];for(var _0x37814e=0x0;_0x37814e<_0x5af08d[_0xd336('0x22')];_0x37814e++){if(_0x5af08d[_0x37814e][_0x53ce25]===_0x1d2bbd){_0x512a6e=!![];_0x32f9d6[_0xd336('0x35')]=_0x5af08d[_0x37814e]['contactid'];}}return _0x512a6e;})[_0xd336('0x15')](function(_0x49ca23){if(_0x49ca23)return _0x32f9d6;if(_0x3c88a5==='nothing'){logger['info']('['+[_0x4e2d63['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x32f9d6;}return createEndUser(_0x32f9d6,_0x59c62c,_0x485fa,_0x2d928a,_0x46bb9d,_0x4e2d63,_0x53ce25)[_0xd336('0x15')](function(_0x13df05){logger['info']('['+[_0x4e2d63[_0xd336('0x26')]()]+']\x20Enduser\x20created!',_0x13df05[_0xd336('0x35')]);return _0x13df05;});});}function getCustomFields(_0x11d3ce,_0x4f7b63,_0x29a199){var _0x337fac={};if(_0x11d3ce[_0xd336('0x22')]>0x0){_[_0xd336('0x3d')](_0x11d3ce,function(_0x5d60b9){if(_['includes']([_0xd336('0x3e'),'picklist'],_0x5d60b9[_0xd336('0x3f')])&&_0x5d60b9['nameField']&&!_0x5d60b9[_0xd336('0x40')]){var _0xc27449=_0x5d60b9['idField'][_0xd336('0x29')]();var _0x2711f3=_0xc27449[_0xd336('0x33')](0x0,_0xc27449[_0xd336('0x41')]('_'));var _0x16c155=_0xc27449['substring'](_0xc27449[_0xd336('0x41')]('_')+0x1);if(_0x2711f3===_0x29a199){_0x337fac[_0x16c155]=_0x5d60b9['content'];}}});}return _0x337fac;}function getTicket(_0x254449,_0x2efa04,_0x4cfa46,_0x8fda64,_0x11be85,_0x1bc4f0,_0x544248){return new Promise(function(_0x18cdc6,_0x51330e){var _0x2762df;return getAuthToken(_0x2efa04,_0x4cfa46,_0x544248)[_0xd336('0x15')](function(_0x5b015e){if(_0x1bc4f0[_0xd336('0x42')]==='incident'){_0x2762df={'method':_0xd336('0x2c'),'uri':_0x8fda64+_0xd336('0x43'),'body':Object[_0xd336('0x44')]({},{'title':intUtil[_0xd336('0x45')](_0x1bc4f0['Subjects'],_0x11be85,'\x20'),'description':intUtil[_0xd336('0x45')](_0x1bc4f0[_0xd336('0x46')],_0x11be85,'\x0a'),'customerid_contact@odata.bind':_0x254449['enduserId']?_0xd336('0x47')+_0x254449[_0xd336('0x35')]+')':undefined,'ownerid@odata.bind':_0xd336('0x2e')+_0x254449['userId']+')','caseorigincode':'1'},getCustomFields(_0x1bc4f0[_0xd336('0x48')],_0x11be85,_0x1bc4f0[_0xd336('0x42')])),'headers':{'Authorization':_0xd336('0x1c')+_0x5b015e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1bc4f0['ticketType']===_0xd336('0x49')){var _0x58fc33=_0x254449[_0xd336('0x35')]?[{'partyid_systemuser@odata.bind':_0xd336('0x2e')+_0x254449['userId']+')','participationtypemask':_0x254449[_0xd336('0x4a')]===_0xd336('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xd336('0x47')+_0x254449['enduserId']+')','participationtypemask':_0x254449[_0xd336('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd336('0x2e')+_0x254449[_0xd336('0x2f')]+')','participationtypemask':_0x254449['callDirection']===_0xd336('0x4b')?0x2:0x1}];_0x2762df={'method':_0xd336('0x2c'),'uri':_0x8fda64+_0xd336('0x4c'),'body':Object[_0xd336('0x44')]({},{'subject':intUtil[_0xd336('0x45')](_0x1bc4f0[_0xd336('0x4d')],_0x11be85,'\x20'),'phonenumber':String(_0x11be85[_0xd336('0x2b')]),'description':intUtil['getString'](_0x1bc4f0[_0xd336('0x46')],_0x11be85,'\x0a'),'regardingobjectid_contact@odata.bind':_0x254449[_0xd336('0x35')]?_0xd336('0x47')+_0x254449['enduserId']+')':undefined,'ownerid@odata.bind':_0xd336('0x2e')+_0x254449['userId']+')','directioncode':_0x254449['callDirection']===_0xd336('0x4b')?![]:!![],'phonecall_activity_parties':_0x58fc33},getCustomFields(_0x1bc4f0['Fields'],_0x11be85,_0x1bc4f0[_0xd336('0x42')])),'headers':{'Authorization':_0xd336('0x1c')+_0x5b015e,'OData-Version':_0xd336('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2762df);})[_0xd336('0x15')](function(_0xea82db){var _0xb4fc92=_0xea82db[_0xd336('0x31')][_0xd336('0x32')];var _0x2e35f9=_0xb4fc92[_0xd336('0x33')](_0xb4fc92['lastIndexOf']('(')+0x1,_0xb4fc92[_0xd336('0x34')](')'));_0x254449['ticketId']=_0x2e35f9;_0x18cdc6(_0x254449);})[_0xd336('0x17')](function(_0xf7aa99){_0x51330e(_0xf7aa99[_0xd336('0x19')]);});});}function emit(_0x1fe6d3,_0x217da2,_0x25f792,_0x4947ca){var _0x1138f8={'uri':util[_0xd336('0x4e')](_0xd336('0x4f'),_0x1fe6d3,_0x25f792,_0x4947ca)};io['to'](util[_0xd336('0x4e')](_0xd336('0x50'),_0x217da2))['emit'](_0xd336('0x51'),_0x1138f8);}exports['cs']=function(_0x4b9a6a,_0x257cf3,_0x294a81,_0x53781,_0x5e9f2e,_0x2ababf,_0x28bb92,_0x35f9ea){var _0x34e278={};_0x2ababf['remoteUri']=_0x2ababf[_0xd336('0x52')]?intUtil[_0xd336('0x53')](_0x2ababf[_0xd336('0xc')][_0xd336('0xd')]):intUtil[_0xd336('0x53')](_0x2ababf[_0xd336('0xb')]);_0x2ababf[_0xd336('0x54')]=intUtil[_0xd336('0x53')](_0x2ababf['serverUrl']);_0x34e278[_0xd336('0x4a')]=_0x35f9ea==='queue'||_0x35f9ea===_0xd336('0x55')?_0xd336('0x4b'):_0xd336('0x36');var _0x3070c1=_0x2ababf[_0xd336('0x52')]?util['format'](_0xd336('0x56'),_0x2ababf[_0xd336('0xc')][_0xd336('0xd')]):util[_0xd336('0x4e')](_0xd336('0x56'),_0x2ababf['remoteUri']);var _0x3fab07=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x2ababf[_0xd336('0xe')]);var _0x1f666e=util[_0xd336('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ababf['serverUrl'],_0x257cf3['uniqueid'],md5(_0x257cf3['uniqueid']));if(_0x5e9f2e&&_0x5e9f2e[_0xd336('0x57')]){logger[_0xd336('0x25')]('[QUEUE]',_0xd336('0x58'));_0x257cf3['recordingURL']=_0x1f666e;}else if(_0x28bb92&&_0x28bb92['recordingFormat']&&_0x28bb92['recordingFormat']!==_0xd336('0x59')){logger[_0xd336('0x25')](_0xd336('0x5a'),'Recording\x20is\x20enabled!');_0x257cf3['recordingURL']=_0x1f666e;}else{_0x257cf3[_0xd336('0x5b')]='';}return getUser(_0x34e278,_0x2ababf,_0x53781,_0x3fab07,_0x3070c1,_0x35f9ea)[_0xd336('0x15')](function(_0xcef631){logger[_0xd336('0x25')]('['+_0x35f9ea[_0xd336('0x26')]()+_0xd336('0x5c'),_0xcef631[_0xd336('0x2f')]);logger[_0xd336('0x25')]('['+_0x35f9ea[_0xd336('0x26')]()+_0xd336('0x5d'),_0xcef631[_0xd336('0x20')]);return getEndUser(_0xcef631,_0x2ababf,_0x3fab07,_0x3070c1,_0x257cf3,_0x35f9ea,_0x294a81[_0xd336('0x5e')],_0x294a81[_0xd336('0x5f')]);})[_0xd336('0x15')](function(_0x49d112){logger['info']('['+_0x35f9ea[_0xd336('0x26')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x49d112[_0xd336('0x35')]);logger[_0xd336('0x25')]('['+_0x35f9ea[_0xd336('0x26')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x257cf3[_0xd336('0x2b')]);return getTicket(_0x49d112,_0x2ababf,_0x3fab07,_0x3070c1,_0x257cf3,_0x294a81,_0x35f9ea);})[_0xd336('0x15')](function(_0x1fe345){logger[_0xd336('0x25')](util[_0xd336('0x4e')]('['+_0x35f9ea[_0xd336('0x26')]()+_0xd336('0x60'),_0x294a81[_0xd336('0x42')],_0x1fe345['ticketId']));logger[_0xd336('0x25')](util[_0xd336('0x4e')]('['+_0x35f9ea['toUpperCase']()+_0xd336('0x61'),_0x35f9ea));if(_0x35f9ea!==_0xd336('0x55')&&_0x294a81[_0xd336('0x62')]){logger[_0xd336('0x25')]('['+_0x35f9ea[_0xd336('0x26')]()+']',_0xd336('0x63'));emit(_0x2ababf[_0xd336('0xb')],_0x53781['name'],_0x294a81[_0xd336('0x42')],_0x1fe345['ticketId']);}})[_0xd336('0x17')](function(_0x24f024){logger[_0xd336('0x64')]('['+_0x35f9ea[_0xd336('0x26')]()+_0xd336('0x65'),_0x24f024[_0xd336('0x19')]);console[_0xd336('0x64')]('Error\x20running\x20Dynamics365\x20integration',_0x24f024);});};
\ No newline at end of file
+var _0xacd3=['callDirection','queue','phonecalls','Subjects','Descriptions','ticketType','headers','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','destcalleridnum','calleridnum','odata-entityid','substring','lastIndexOf','enduserId','outbound','contacts?$select=','replace','%2b','contactid','nothing','includes','string','picklist','type','nameField','customField','indexOf','content','incident','incidents','assign','getString','/contacts(','phonecall','/systemusers('];(function(_0x14474e,_0x575e9c){var _0x16f5f8=function(_0x6f211a){while(--_0x6f211a){_0x14474e['push'](_0x14474e['shift']());}};_0x16f5f8(++_0x575e9c);}(_0xacd3,0x1c0));var _0x3acd=function(_0x289996,_0x1e0940){_0x289996=_0x289996-0x0;var _0x2ac9dc=_0xacd3[_0x289996];return _0x2ac9dc;};'use strict';var _=require(_0x3acd('0x0'));var rp=require('request-promise');var util=require(_0x3acd('0x1'));var intUtil=require('./util');var md5=require(_0x3acd('0x2'));var Redis=require(_0x3acd('0x3'));var logger=require(_0x3acd('0x4'))(_0x3acd('0x5'));var config=require(_0x3acd('0x6'));config[_0x3acd('0x7')]=_[_0x3acd('0x8')](config[_0x3acd('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3acd('0x9'))(new Redis(config['redis']));function getAuthToken(_0x1aedba,_0x4532ee,_0x2561c7){if(_0x1aedba[_0x3acd('0xa')]){_0x1aedba[_0x3acd('0xb')]=_0x1aedba[_0x3acd('0xc')][_0x3acd('0xd')];_0x1aedba[_0x3acd('0xe')]=_0x1aedba[_0x3acd('0xc')][_0x3acd('0xf')];return Promise[_0x3acd('0x10')](_0x1aedba[_0x3acd('0xc')]['data5']);}var _0x307ab6={'method':_0x3acd('0x11'),'uri':_0x4532ee,'form':{'client_id':_0x1aedba[_0x3acd('0x12')],'resource':_0x1aedba[_0x3acd('0xb')],'username':_0x1aedba[_0x3acd('0x13')],'password':_0x1aedba[_0x3acd('0x14')],'grant_type':_0x3acd('0x14'),'client_secret':_0x1aedba[_0x3acd('0x15')]},'json':!![]};return rp(_0x307ab6)[_0x3acd('0x16')](function(_0x4577dd){return _0x4577dd[_0x3acd('0x17')];})[_0x3acd('0x18')](function(_0x645f39){logger[_0x3acd('0x19')]('['+[_0x2561c7[_0x3acd('0x1a')]()]+_0x3acd('0x1b'));return _0x645f39[_0x3acd('0x1c')];});}function getUser(_0x8d092e,_0x594929,_0x1850eb,_0x6cc946,_0x51bc12,_0x59c158){return new Promise(function(_0x24c4f3,_0x432b1b){return getAuthToken(_0x594929,_0x6cc946,_0x59c158)[_0x3acd('0x16')](function(_0xcb2885){var _0x373f65={'method':_0x3acd('0x1d'),'uri':_0x51bc12+_0x3acd('0x1e'),'headers':{'Authorization':_0x3acd('0x1f')+_0xcb2885,'OData-Version':_0x3acd('0x20')},'json':!![]};return rp(_0x373f65);})[_0x3acd('0x16')](function(_0x3c16d1){var _0x37a9cc=_0x3c16d1[_0x3acd('0x21')];var _0x2e8ad6=![];var _0x1417f7=null;if(!_['isNil'](_0x1850eb)){if(intUtil[_0x3acd('0x22')](_0x1850eb[_0x3acd('0x23')])){_0x8d092e[_0x3acd('0x24')]=_0x1850eb[_0x3acd('0x23')];for(_0x1417f7=0x0;_0x1417f7<_0x37a9cc[_0x3acd('0x25')];_0x1417f7++){if(_0x37a9cc[_0x1417f7][_0x3acd('0x26')]===_0x1850eb[_0x3acd('0x23')]&&!_0x37a9cc[_0x1417f7]['isdisabled']){_0x2e8ad6=!![];logger[_0x3acd('0x27')]('['+[_0x59c158[_0x3acd('0x1a')]()]+_0x3acd('0x28')+_0x37a9cc[_0x1417f7][_0x3acd('0x29')]+'!');_0x8d092e['userId']=_0x37a9cc[_0x1417f7]['systemuserid'];}}}}if(!_0x2e8ad6){logger[_0x3acd('0x27')]('['+[_0x59c158[_0x3acd('0x1a')]()]+_0x3acd('0x2a'));_0x8d092e[_0x3acd('0x24')]=_0x594929[_0x3acd('0x13')];for(_0x1417f7=0x0;_0x1417f7<_0x37a9cc[_0x3acd('0x25')];_0x1417f7++){if(_0x37a9cc[_0x1417f7][_0x3acd('0x26')]===_0x594929['username']){_0x8d092e[_0x3acd('0x2b')]=_0x37a9cc[_0x1417f7][_0x3acd('0x29')];}}}_0x24c4f3(_0x8d092e);})[_0x3acd('0x18')](function(_0x5ce20b){_0x432b1b(_0x5ce20b[_0x3acd('0x1c')]);});});}function createEndUser(_0x4f5a7f,_0x375b6b,_0x414278,_0x5ec892,_0x1fd70a,_0x58f56e,_0x590a5c){return new Promise(function(_0xfad6cf,_0x1bfb93){return getAuthToken(_0x375b6b,_0x414278,_0x58f56e)['then'](function(_0x44e9e7){var _0xf32346=_0x58f56e[_0x3acd('0x2c')]()==='outbound'?_0x1fd70a[_0x3acd('0x2d')]:_0x1fd70a[_0x3acd('0x2e')];var _0x27dd24={'method':_0x3acd('0x11'),'uri':_0x5ec892+'contacts','body':{'fullname':_0xf32346,'firstname':_0xf32346,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4f5a7f[_0x3acd('0x2b')]+')'},'headers':{'Authorization':_0x3acd('0x1f')+_0x44e9e7,'OData-Version':_0x3acd('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x27dd24['body'][_0x590a5c]=_0xf32346;return rp(_0x27dd24);})[_0x3acd('0x16')](function(_0x4c47d6){var _0x29b634=_0x4c47d6['headers'][_0x3acd('0x2f')];var _0xa95af5=_0x29b634[_0x3acd('0x30')](_0x29b634[_0x3acd('0x31')]('(')+0x1,_0x29b634[_0x3acd('0x31')](')'));_0x4f5a7f[_0x3acd('0x32')]=_0xa95af5;_0xfad6cf(_0x4f5a7f);})['catch'](function(_0x186d3b){_0x1bfb93(_0x186d3b[_0x3acd('0x1c')]);});});}function getEndUser(_0x10e26f,_0xbbe01,_0x5c1126,_0x27fd07,_0x16dc88,_0x2a0249,_0x89ed1,_0x4ec44e){var _0x56449d=_0x2a0249[_0x3acd('0x2c')]()===_0x3acd('0x33')?_0x16dc88[_0x3acd('0x2d')]:_0x16dc88[_0x3acd('0x2e')];return getAuthToken(_0xbbe01,_0x5c1126,_0x2a0249)[_0x3acd('0x16')](function(_0x3dad2c){_0x4ec44e=_0x4ec44e?_0x4ec44e:'telephone1';var _0x341578={'method':'GET','uri':_0x27fd07+_0x3acd('0x34')+_0x4ec44e+'&$filter='+_0x4ec44e+'\x20eq\x20\x27'+_0x56449d[_0x3acd('0x35')]('+',_0x3acd('0x36'))+'\x27','headers':{'Authorization':_0x3acd('0x1f')+_0x3dad2c,'If-None-Match':null,'OData-Version':_0x3acd('0x20')},'json':!![]};return rp(_0x341578);})[_0x3acd('0x16')](function(_0x8cce67){var _0x147304=![];if(!_0x8cce67)return _0x147304;var _0x23b1ae=_0x8cce67[_0x3acd('0x21')];for(var _0x23f6df=0x0;_0x23f6df<_0x23b1ae[_0x3acd('0x25')];_0x23f6df++){if(_0x23b1ae[_0x23f6df][_0x4ec44e]===_0x56449d){_0x147304=!![];_0x10e26f[_0x3acd('0x32')]=_0x23b1ae[_0x23f6df][_0x3acd('0x37')];}}return _0x147304;})['then'](function(_0x1548d5){if(_0x1548d5)return _0x10e26f;if(_0x89ed1===_0x3acd('0x38')){logger['info']('['+[_0x2a0249['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x10e26f;}return createEndUser(_0x10e26f,_0xbbe01,_0x5c1126,_0x27fd07,_0x16dc88,_0x2a0249,_0x4ec44e)[_0x3acd('0x16')](function(_0x4c3a1e){logger[_0x3acd('0x27')]('['+[_0x2a0249['toUpperCase']()]+']\x20Enduser\x20created!',_0x4c3a1e['enduserId']);return _0x4c3a1e;});});}function getCustomFields(_0x72fe60,_0x323e44,_0x4a5527){var _0x13c466={};if(_0x72fe60[_0x3acd('0x25')]>0x0){_['forEach'](_0x72fe60,function(_0x4b539c){if(_[_0x3acd('0x39')]([_0x3acd('0x3a'),_0x3acd('0x3b')],_0x4b539c[_0x3acd('0x3c')])&&_0x4b539c[_0x3acd('0x3d')]&&!_0x4b539c[_0x3acd('0x3e')]){var _0x4defc4=_0x4b539c['idField']['toLowerCase']();var _0x548614=_0x4defc4['substring'](0x0,_0x4defc4[_0x3acd('0x3f')]('_'));var _0x4039ec=_0x4defc4[_0x3acd('0x30')](_0x4defc4['indexOf']('_')+0x1);if(_0x548614===_0x4a5527){_0x13c466[_0x4039ec]=_0x4b539c[_0x3acd('0x40')];}}});}return _0x13c466;}function getTicket(_0x20f6c3,_0x20b0ed,_0x1e4378,_0x9d74b8,_0x1974df,_0xf55f55,_0x42d7f5){return new Promise(function(_0x99c235,_0x54ee4f){var _0x3a75a6;return getAuthToken(_0x20b0ed,_0x1e4378,_0x42d7f5)['then'](function(_0x5c3440){if(_0xf55f55['ticketType']===_0x3acd('0x41')){_0x3a75a6={'method':'POST','uri':_0x9d74b8+_0x3acd('0x42'),'body':Object[_0x3acd('0x43')]({},{'title':intUtil['getString'](_0xf55f55['Subjects'],_0x1974df,'\x20'),'description':intUtil[_0x3acd('0x44')](_0xf55f55['Descriptions'],_0x1974df,'\x0a'),'customerid_contact@odata.bind':_0x20f6c3[_0x3acd('0x32')]?_0x3acd('0x45')+_0x20f6c3['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x20f6c3[_0x3acd('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0xf55f55['Fields'],_0x1974df,_0xf55f55['ticketType'])),'headers':{'Authorization':_0x3acd('0x1f')+_0x5c3440,'OData-Version':_0x3acd('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xf55f55['ticketType']===_0x3acd('0x46')){var _0x188c5b=_0x20f6c3[_0x3acd('0x32')]?[{'partyid_systemuser@odata.bind':_0x3acd('0x47')+_0x20f6c3['userId']+')','participationtypemask':_0x20f6c3[_0x3acd('0x48')]===_0x3acd('0x49')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x20f6c3['enduserId']+')','participationtypemask':_0x20f6c3[_0x3acd('0x48')]===_0x3acd('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3acd('0x47')+_0x20f6c3[_0x3acd('0x2b')]+')','participationtypemask':_0x20f6c3[_0x3acd('0x48')]===_0x3acd('0x49')?0x2:0x1}];_0x3a75a6={'method':_0x3acd('0x11'),'uri':_0x9d74b8+_0x3acd('0x4a'),'body':Object['assign']({},{'subject':intUtil['getString'](_0xf55f55[_0x3acd('0x4b')],_0x1974df,'\x20'),'phonenumber':String(_0x1974df['calleridnum']),'description':intUtil[_0x3acd('0x44')](_0xf55f55[_0x3acd('0x4c')],_0x1974df,'\x0a'),'regardingobjectid_contact@odata.bind':_0x20f6c3[_0x3acd('0x32')]?_0x3acd('0x45')+_0x20f6c3['enduserId']+')':undefined,'ownerid@odata.bind':_0x3acd('0x47')+_0x20f6c3['userId']+')','directioncode':_0x20f6c3[_0x3acd('0x48')]===_0x3acd('0x49')?![]:!![],'phonecall_activity_parties':_0x188c5b},getCustomFields(_0xf55f55['Fields'],_0x1974df,_0xf55f55[_0x3acd('0x4d')])),'headers':{'Authorization':'Bearer\x20'+_0x5c3440,'OData-Version':_0x3acd('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3a75a6);})[_0x3acd('0x16')](function(_0x32603b){var _0x2e5e27=_0x32603b[_0x3acd('0x4e')][_0x3acd('0x2f')];var _0x3e11e5=_0x2e5e27[_0x3acd('0x30')](_0x2e5e27['lastIndexOf']('(')+0x1,_0x2e5e27[_0x3acd('0x31')](')'));_0x20f6c3[_0x3acd('0x4f')]=_0x3e11e5;_0x99c235(_0x20f6c3);})[_0x3acd('0x18')](function(_0x2864bb){_0x54ee4f(_0x2864bb['message']);});});}function emit(_0x74a098,_0x4cac5a,_0x12241f,_0x236f9e){var _0x1a2172={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x74a098,_0x12241f,_0x236f9e)};io['to'](util[_0x3acd('0x50')](_0x3acd('0x51'),_0x4cac5a))[_0x3acd('0x52')](_0x3acd('0x53'),_0x1a2172);}exports['cs']=function(_0x13ef7a,_0x2b8a39,_0x2cdc43,_0x512aab,_0x2815de,_0x2e39ca,_0x30e2b9,_0x23c36e){var _0x54b37a={};_0x2e39ca[_0x3acd('0xb')]=_0x2e39ca[_0x3acd('0xa')]?intUtil[_0x3acd('0x54')](_0x2e39ca[_0x3acd('0xc')][_0x3acd('0xd')]):intUtil[_0x3acd('0x54')](_0x2e39ca[_0x3acd('0xb')]);_0x2e39ca[_0x3acd('0x55')]=intUtil[_0x3acd('0x54')](_0x2e39ca[_0x3acd('0x55')]);_0x54b37a[_0x3acd('0x48')]=_0x23c36e===_0x3acd('0x49')||_0x23c36e===_0x3acd('0x56')?'queue':_0x3acd('0x33');var _0x27d793=_0x2e39ca[_0x3acd('0xa')]?util[_0x3acd('0x50')](_0x3acd('0x57'),_0x2e39ca[_0x3acd('0xc')][_0x3acd('0xd')]):util[_0x3acd('0x50')](_0x3acd('0x57'),_0x2e39ca['remoteUri']);var _0x46df5c=util[_0x3acd('0x50')](_0x3acd('0x58'),_0x2e39ca[_0x3acd('0xe')]);var _0x31e8bd=util[_0x3acd('0x50')](_0x3acd('0x59'),_0x2e39ca[_0x3acd('0x55')],_0x2b8a39[_0x3acd('0x5a')],md5(_0x2b8a39[_0x3acd('0x5a')]));if(_0x2815de&&_0x2815de['monitor_format']){logger['info'](_0x3acd('0x5b'),_0x3acd('0x5c'));_0x2b8a39['recordingURL']=_0x31e8bd;}else if(_0x30e2b9&&_0x30e2b9[_0x3acd('0x5d')]&&_0x30e2b9['recordingFormat']!==_0x3acd('0x5e')){logger[_0x3acd('0x27')](_0x3acd('0x5f'),'Recording\x20is\x20enabled!');_0x2b8a39[_0x3acd('0x60')]=_0x31e8bd;}else{_0x2b8a39['recordingURL']='';}return getUser(_0x54b37a,_0x2e39ca,_0x512aab,_0x46df5c,_0x27d793,_0x23c36e)[_0x3acd('0x16')](function(_0x3551b){logger[_0x3acd('0x27')]('['+_0x23c36e[_0x3acd('0x1a')]()+']\x20The\x20User\x20ID\x20is:',_0x3551b[_0x3acd('0x2b')]);logger[_0x3acd('0x27')]('['+_0x23c36e[_0x3acd('0x1a')]()+']\x20The\x20User\x20email\x20is:',_0x3551b[_0x3acd('0x24')]);return getEndUser(_0x3551b,_0x2e39ca,_0x46df5c,_0x27d793,_0x2b8a39,_0x23c36e,_0x2cdc43[_0x3acd('0x61')],_0x2cdc43[_0x3acd('0x62')]);})['then'](function(_0x5ec18b){logger[_0x3acd('0x27')]('['+_0x23c36e['toUpperCase']()+_0x3acd('0x63'),_0x5ec18b['enduserId']);logger[_0x3acd('0x27')]('['+_0x23c36e[_0x3acd('0x1a')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2b8a39[_0x3acd('0x2e')]);return getTicket(_0x5ec18b,_0x2e39ca,_0x46df5c,_0x27d793,_0x2b8a39,_0x2cdc43,_0x23c36e);})[_0x3acd('0x16')](function(_0x50ef6c){logger[_0x3acd('0x27')](util[_0x3acd('0x50')]('['+_0x23c36e[_0x3acd('0x1a')]()+_0x3acd('0x64'),_0x2cdc43[_0x3acd('0x4d')],_0x50ef6c['ticketId']));logger[_0x3acd('0x27')](util[_0x3acd('0x50')]('['+_0x23c36e['toUpperCase']()+_0x3acd('0x65'),_0x23c36e));if(_0x23c36e!=='unmanaged'&&_0x2cdc43['openNewTab']){logger[_0x3acd('0x27')]('['+_0x23c36e[_0x3acd('0x1a')]()+']',_0x3acd('0x66'));emit(_0x2e39ca['remoteUri'],_0x512aab['name'],_0x2cdc43[_0x3acd('0x4d')],_0x50ef6c[_0x3acd('0x4f')]);}})[_0x3acd('0x18')](function(_0x596a79){logger[_0x3acd('0x19')]('['+_0x23c36e[_0x3acd('0x1a')]()+_0x3acd('0x67'),_0x596a79[_0x3acd('0x1c')]);console[_0x3acd('0x19')]('Error\x20running\x20Dynamics365\x20integration',_0x596a79);});};
\ No newline at end of file
index 4891e30..ed833d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7d6=['Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','remoteUri','POST','info','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','[HTTP]','stringify','GET','forEach','includes','picklist','type','nameField','toLowerCase','content','string','idField','customField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xa7d6,0xcc));var _0x6a7d=function(_0x2b6082,_0x5a8dde){_0x2b6082=_0x2b6082-0x0;var _0x2a746b=_0xa7d6[_0x2b6082];return _0x2a746b;};'use strict';var _=require(_0x6a7d('0x0'));var rp=require('request-promise');var md5=require(_0x6a7d('0x1'));var util=require(_0x6a7d('0x2'));var Redis=require(_0x6a7d('0x3'));var intUtil=require(_0x6a7d('0x4'));var config=require(_0x6a7d('0x5'));var logger=require(_0x6a7d('0x6'))(_0x6a7d('0x7'));config[_0x6a7d('0x8')]=_[_0x6a7d('0x9')](config[_0x6a7d('0x8')],{'host':_0x6a7d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a7d('0x8')]));var headers={'Content-Type':_0x6a7d('0xb'),'Accept':_0x6a7d('0xb')};function emit(_0x22790d,_0x3a6735,_0x379640){io['to'](_0x22790d)[_0x6a7d('0xc')](_0x3a6735,_0x379640);}function getTicket(_0x1e31f4,_0x273869,_0x5ae24c,_0x237eb,_0x193b88){logger['info'](_0x6a7d('0xd'));var _0x5e8031=_[_0x6a7d('0xe')]({'responder_id':_0x273869['id'],'requester_id':_0x5ae24c['id'],'name':util[_0x6a7d('0xf')](_0x6a7d('0x10'),_0x193b88['calleridname']),'phone':_0x193b88[_0x6a7d('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x237eb['Subjects'],_0x193b88,'\x20'),'description':intUtil[_0x6a7d('0x12')](_0x237eb[_0x6a7d('0x13')],_0x193b88,'<br>'),'tags':getTags(_0x237eb['Tags'],_0x6a7d('0x14'))},getCustomFields(_0x237eb[_0x6a7d('0x15')],_0x193b88));_0x5e8031[_0x6a7d('0x16')]=_['mapValues'](_[_0x6a7d('0x17')](_0x5e8031['custom_fields'],'id'),'value');return request({'uri':util[_0x6a7d('0xf')](_0x6a7d('0x18'),_0x1e31f4[_0x6a7d('0x19')]),'method':_0x6a7d('0x1a'),'body':_0x5e8031})['then'](function(_0x373c6e){logger[_0x6a7d('0x1b')]('Ticket\x20created!');return _0x373c6e;});}function getUser(_0x2d94ca,_0x5d41f3){if(intUtil[_0x6a7d('0x1c')](_0x5d41f3)){return request({'uri':util['format'](_0x6a7d('0x1d'),_0x2d94ca['remoteUri']),'qs':{'email':_0x5d41f3}})[_0x6a7d('0x1e')](function(_0x547c26){if(_0x547c26[_0x6a7d('0x1f')]){logger[_0x6a7d('0x1b')](_0x6a7d('0x20'));return _['find'](_0x547c26,function(_0x4696bb){return _0x4696bb[_0x6a7d('0x21')][_0x6a7d('0x22')]===_0x5d41f3;});}else{logger[_0x6a7d('0x1b')](_0x6a7d('0x23'));return request({'uri':util[_0x6a7d('0xf')](_0x6a7d('0x24'),_0x2d94ca['remoteUri'])})[_0x6a7d('0x1e')](function(_0x4de30d){logger[_0x6a7d('0x1b')](_0x6a7d('0x25'));return _0x4de30d;});}});}else{logger[_0x6a7d('0x1b')](_0x6a7d('0x26'));return request({'uri':util[_0x6a7d('0xf')](_0x6a7d('0x24'),_0x2d94ca[_0x6a7d('0x19')])})[_0x6a7d('0x1e')](function(_0xacf0d6){logger[_0x6a7d('0x1b')](_0x6a7d('0x25'));return _0xacf0d6;});}}function getEndUser(_0x22d5fc,_0x2f0ae6,_0x3dc8aa){logger['info'](_0x6a7d('0x27'),_0x3dc8aa);return request({'uri':util[_0x6a7d('0xf')]('%s/api/v2/contacts',_0x22d5fc[_0x6a7d('0x19')]),'qs':{'phone':_0x3dc8aa}})[_0x6a7d('0x1e')](function(_0x394e59){if(_0x394e59['length']){logger[_0x6a7d('0x1b')](_0x6a7d('0x28'));return _['find'](_0x394e59,{'phone':_0x3dc8aa});}else{logger[_0x6a7d('0x1b')](_0x6a7d('0x29'));return request({'uri':util[_0x6a7d('0xf')](_0x6a7d('0x2a'),_0x22d5fc['remoteUri']),'method':'POST','body':{'name':_0x2f0ae6,'phone':_0x3dc8aa}})['then'](function(_0x51217d){logger['info'](_0x6a7d('0x2b'));return _0x51217d;});}});}function getAuth(_0x3794c1){return util['format']('Basic\x20%s',new Buffer(_0x3794c1[_0x6a7d('0x2c')]+':X')[_0x6a7d('0x2d')]('base64'));}function request(_0x5786db){logger['debug'](_0x6a7d('0x2e'),JSON[_0x6a7d('0x2f')](_0x5786db));return rp(_[_0x6a7d('0x9')](_0x5786db,{'method':_0x6a7d('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x59fec7,_0x21e2f3){var _0x1ab0e1=[];if(_0x59fec7&&_0x59fec7['length']>0x0){_0x1ab0e1=_['map'](_0x59fec7,_0x21e2f3);}return _0x1ab0e1;}function getCustomFields(_0x2fad8a,_0x1a9800){var _0x3f0abb=[];var _0x292b35={'custom_fields':[]};if(_0x2fad8a['length']>0x0){_[_0x6a7d('0x31')](_0x2fad8a,function(_0x190331){if(_[_0x6a7d('0x32')](['string',_0x6a7d('0x33')],_0x190331[_0x6a7d('0x34')])&&_0x190331[_0x6a7d('0x35')]&&!_0x190331['customField']){_0x292b35[_0x190331[_0x6a7d('0x35')][_0x6a7d('0x36')]()]=_0x190331[_0x6a7d('0x37')]['toString']();}else if(_['includes']([_0x6a7d('0x38'),_0x6a7d('0x33')],_0x190331[_0x6a7d('0x34')])&&_0x190331[_0x6a7d('0x39')]&&_0x190331[_0x6a7d('0x3a')]){_0x292b35[_0x6a7d('0x16')][_0x6a7d('0x3b')]({'id':_0x190331[_0x6a7d('0x39')],'value':_0x190331[_0x6a7d('0x37')]['toString']()});}else if(_0x190331[_0x6a7d('0x34')]===_0x6a7d('0x3c')&&_0x190331['variableName']&&_0x190331['idField']&&_0x190331['customField']){_0x1a9800[_0x190331[_0x6a7d('0x3d')]]&&_0x292b35[_0x6a7d('0x16')][_0x6a7d('0x3b')]({'id':_0x190331[_0x6a7d('0x39')],'value':_0x1a9800[_0x190331[_0x6a7d('0x3d')]][_0x6a7d('0x2d')]()});}else if(_0x190331['type']===_0x6a7d('0x3e')&&_0x190331[_0x6a7d('0x3f')]&&_0x190331['Variable'][_0x6a7d('0x14')]&&_0x190331[_0x6a7d('0x39')]&&_0x190331['customField']){_0x1a9800[_0x190331[_0x6a7d('0x3f')][_0x6a7d('0x14')]['toLowerCase']()]&&_0x292b35['custom_fields'][_0x6a7d('0x3b')]({'id':_0x190331['idField'],'value':_0x1a9800[_0x190331[_0x6a7d('0x3f')]['name'][_0x6a7d('0x36')]()][_0x6a7d('0x2d')]()});}});}return _0x292b35;}exports[_0x6a7d('0x40')]=function(_0x2ed614,_0x18f619,_0x1bb2c8,_0x553147,_0x3351ba,_0x3028bd){var _0x4dac20,_0x3879e0;_0x3028bd[_0x6a7d('0x19')]=intUtil[_0x6a7d('0x41')](_0x3028bd[_0x6a7d('0x19')]);_0x3028bd[_0x6a7d('0x42')]=intUtil[_0x6a7d('0x41')](_0x3028bd[_0x6a7d('0x42')]);if(_0x3351ba&&_0x3351ba[_0x6a7d('0x43')]){logger[_0x6a7d('0x1b')](_0x6a7d('0x44'),_0x6a7d('0x45'));_0x18f619[_0x6a7d('0x46')]=util[_0x6a7d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3028bd[_0x6a7d('0x42')],_0x18f619[_0x6a7d('0x47')],md5(_0x18f619[_0x6a7d('0x47')]));}else{_0x18f619[_0x6a7d('0x46')]='';}headers[_0x6a7d('0x48')]=getAuth(_0x3028bd);return getUser(_0x3028bd,_0x553147[_0x6a7d('0x22')])['then'](function(_0x42ff23){_0x4dac20=_0x42ff23;logger[_0x6a7d('0x1b')](_0x6a7d('0x49'),_0x4dac20['id']);return getEndUser(_0x3028bd,_0x18f619[_0x6a7d('0x4a')],_0x18f619[_0x6a7d('0x11')]);})[_0x6a7d('0x1e')](function(_0x3dd3c4){_0x3879e0=_0x3dd3c4;logger[_0x6a7d('0x1b')](_0x6a7d('0x4b'),_0x3879e0['id']);return getTicket(_0x3028bd,_0x4dac20,_0x3879e0,_0x1bb2c8,_0x18f619);})[_0x6a7d('0x1e')](function(_0x466eb9){if(_0x466eb9&&_0x466eb9['id']){logger[_0x6a7d('0x1b')]('Ticket\x20created!');logger[_0x6a7d('0x1b')](_0x6a7d('0x4c'),_0x466eb9['id']);logger[_0x6a7d('0x1b')](_0x6a7d('0x44'),_0x6a7d('0x4d'));emit(util['format'](_0x6a7d('0x4e'),_0x553147['name']),_0x6a7d('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3028bd[_0x6a7d('0x19')],_0x466eb9['id'])});}})[_0x6a7d('0x50')](function(_0x39f013){logger[_0x6a7d('0x51')](_0x6a7d('0x44'),JSON[_0x6a7d('0x2f')](_0x39f013));});};exports[_0x6a7d('0x52')]=function(_0x2bc44e,_0x26e593,_0x5cba71,_0x13a216,_0x126323,_0x2b2e8a,_0x1eb488){var _0x9e80e9,_0x268b64;_0x2b2e8a['remoteUri']=intUtil[_0x6a7d('0x41')](_0x2b2e8a[_0x6a7d('0x19')]);_0x2b2e8a['serverUrl']=intUtil[_0x6a7d('0x41')](_0x2b2e8a[_0x6a7d('0x42')]);if(_0x1eb488&&_0x1eb488[_0x6a7d('0x53')]&&_0x1eb488[_0x6a7d('0x53')]!==_0x6a7d('0x54')){logger['info'](_0x6a7d('0x55'),_0x6a7d('0x45'));_0x26e593['recordingURL']=util[_0x6a7d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b2e8a[_0x6a7d('0x42')],_0x26e593[_0x6a7d('0x47')],md5(_0x26e593[_0x6a7d('0x47')]));}headers[_0x6a7d('0x48')]=getAuth(_0x2b2e8a);return getUser(_0x2b2e8a,_0x13a216[_0x6a7d('0x22')])[_0x6a7d('0x1e')](function(_0x350946){_0x9e80e9=_0x350946;logger[_0x6a7d('0x1b')](_0x6a7d('0x49'),_0x9e80e9['id']);return getEndUser(_0x2b2e8a,_0x26e593[_0x6a7d('0x56')],_0x26e593[_0x6a7d('0x57')]);})[_0x6a7d('0x1e')](function(_0x5f546c){_0x268b64=_0x5f546c;logger[_0x6a7d('0x1b')](_0x6a7d('0x4b'),_0x268b64['id']);return getTicket(_0x2b2e8a,_0x9e80e9,_0x268b64,_0x5cba71,_0x26e593);})['then'](function(_0x2f3e5d){if(_0x2f3e5d&&_0x2f3e5d['id']){logger[_0x6a7d('0x1b')]('Ticket\x20created!');logger[_0x6a7d('0x1b')](_0x6a7d('0x4c'),_0x2f3e5d['id']);logger['info'](_0x6a7d('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6a7d('0xf')](_0x6a7d('0x4e'),_0x13a216[_0x6a7d('0x14')]),_0x6a7d('0x4f'),{'uri':util[_0x6a7d('0xf')](_0x6a7d('0x58'),_0x2b2e8a[_0x6a7d('0x19')],_0x2f3e5d['id'])});}})[_0x6a7d('0x50')](function(_0x40452e){logger[_0x6a7d('0x51')]('[OUTBOUND]',JSON[_0x6a7d('0x2f')](_0x40452e));});};exports['unmanaged']=function(_0x19a511,_0x5aa538,_0x19d81c,_0x419be6,_0x445ae8,_0x37652b){var _0x572549,_0x40360f;_0x37652b[_0x6a7d('0x19')]=intUtil[_0x6a7d('0x41')](_0x37652b['remoteUri']);_0x37652b[_0x6a7d('0x42')]=intUtil['stripTrailingSlash'](_0x37652b['serverUrl']);if(_0x445ae8&&_0x445ae8[_0x6a7d('0x43')]){logger['info']('['+_0x5aa538[_0x6a7d('0x59')][_0x6a7d('0x5a')]()+']',_0x6a7d('0x45'));_0x5aa538[_0x6a7d('0x46')]=util['format'](_0x6a7d('0x5b'),_0x37652b[_0x6a7d('0x42')],_0x5aa538[_0x6a7d('0x47')],md5(_0x5aa538['uniqueid']));}else{_0x5aa538[_0x6a7d('0x46')]='';}headers[_0x6a7d('0x48')]=getAuth(_0x37652b);return getUser(_0x37652b,'')[_0x6a7d('0x1e')](function(_0x55cf82){_0x572549=_0x55cf82;logger['info'](_0x6a7d('0x49'),_0x572549['id']);return getEndUser(_0x37652b,_0x5aa538[_0x6a7d('0x4a')],_0x5aa538['calleridnum']);})[_0x6a7d('0x1e')](function(_0x67897a){_0x40360f=_0x67897a;logger[_0x6a7d('0x1b')](_0x6a7d('0x4b'),_0x40360f['id']);return getTicket(_0x37652b,_0x572549,_0x40360f,_0x19d81c,_0x5aa538);})[_0x6a7d('0x1e')](function(_0x5f3d8a){if(_0x5f3d8a){logger[_0x6a7d('0x1b')]('Ticket\x20created!');logger[_0x6a7d('0x1b')](_0x6a7d('0x4c'),_0x5f3d8a['id']);}})[_0x6a7d('0x50')](function(_0x1d75ee){logger[_0x6a7d('0x51')]('['+_0x5aa538[_0x6a7d('0x59')][_0x6a7d('0x5a')]()+']',JSON['stringify'](_0x1d75ee));});};
\ No newline at end of file
+var _0xd176=['find','contact','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','toString','string','idField','content','variable','variableName','customVariable','push','Variable','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','uniqueid','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridname','destcalleridnum','error','monitor_format','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!'];(function(_0x1baa84,_0x3c938e){var _0x18523b=function(_0x120137){while(--_0x120137){_0x1baa84['push'](_0x1baa84['shift']());}};_0x18523b(++_0x3c938e);}(_0xd176,0xe8));var _0x6d17=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xd176[_0x257a28];return _0x13bccc;};'use strict';var _=require('lodash');var rp=require(_0x6d17('0x0'));var md5=require(_0x6d17('0x1'));var util=require(_0x6d17('0x2'));var Redis=require(_0x6d17('0x3'));var intUtil=require(_0x6d17('0x4'));var config=require('../../../../config/environment');var logger=require(_0x6d17('0x5'))(_0x6d17('0x6'));config[_0x6d17('0x7')]=_['defaults'](config[_0x6d17('0x7')],{'host':_0x6d17('0x8'),'port':0x18eb});var io=require(_0x6d17('0x9'))(new Redis(config[_0x6d17('0x7')]));var headers={'Content-Type':_0x6d17('0xa'),'Accept':_0x6d17('0xa')};function emit(_0x38e3de,_0x4352bf,_0x28a979){io['to'](_0x38e3de)[_0x6d17('0xb')](_0x4352bf,_0x28a979);}function getTicket(_0x496987,_0x210c2d,_0x32ab7c,_0x29b66e,_0x2cfc0d){logger[_0x6d17('0xc')]('Creating\x20new\x20ticket...');var _0x50bef6=_['merge']({'responder_id':_0x210c2d['id'],'requester_id':_0x32ab7c['id'],'name':util[_0x6d17('0xd')]('Caller\x20-\x20%s',_0x2cfc0d[_0x6d17('0xe')]),'phone':_0x2cfc0d[_0x6d17('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6d17('0x10')](_0x29b66e[_0x6d17('0x11')],_0x2cfc0d,'\x20'),'description':intUtil['getString'](_0x29b66e[_0x6d17('0x12')],_0x2cfc0d,'<br>'),'tags':getTags(_0x29b66e[_0x6d17('0x13')],_0x6d17('0x14'))},getCustomFields(_0x29b66e[_0x6d17('0x15')],_0x2cfc0d));_0x50bef6[_0x6d17('0x16')]=_['mapValues'](_[_0x6d17('0x17')](_0x50bef6[_0x6d17('0x16')],'id'),'value');return request({'uri':util[_0x6d17('0xd')](_0x6d17('0x18'),_0x496987[_0x6d17('0x19')]),'method':_0x6d17('0x1a'),'body':_0x50bef6})['then'](function(_0x573d4b){logger[_0x6d17('0xc')](_0x6d17('0x1b'));return _0x573d4b;});}function getUser(_0x5eac6e,_0x2f2551){if(intUtil[_0x6d17('0x1c')](_0x2f2551)){return request({'uri':util[_0x6d17('0xd')]('%s/api/v2/agents',_0x5eac6e[_0x6d17('0x19')]),'qs':{'email':_0x2f2551}})[_0x6d17('0x1d')](function(_0x5e8665){if(_0x5e8665[_0x6d17('0x1e')]){logger[_0x6d17('0xc')](_0x6d17('0x1f'));return _[_0x6d17('0x20')](_0x5e8665,function(_0x35073b){return _0x35073b[_0x6d17('0x21')]['email']===_0x2f2551;});}else{logger[_0x6d17('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6d17('0xd')](_0x6d17('0x22'),_0x5eac6e[_0x6d17('0x19')])})[_0x6d17('0x1d')](function(_0x93595a){logger[_0x6d17('0xc')]('Admin\x20account\x20selected.');return _0x93595a;});}});}else{logger['info'](_0x6d17('0x23'));return request({'uri':util[_0x6d17('0xd')](_0x6d17('0x22'),_0x5eac6e[_0x6d17('0x19')])})[_0x6d17('0x1d')](function(_0xba69ab){logger[_0x6d17('0xc')]('Admin\x20account\x20selected.');return _0xba69ab;});}}function getEndUser(_0x1ea6dd,_0x22519f,_0x2036d0){logger[_0x6d17('0xc')]('Searching\x20enduser\x20with\x20phone',_0x2036d0);return request({'uri':util['format'](_0x6d17('0x24'),_0x1ea6dd['remoteUri']),'qs':{'phone':_0x2036d0}})[_0x6d17('0x1d')](function(_0x5bffc3){if(_0x5bffc3['length']){logger[_0x6d17('0xc')](_0x6d17('0x25'));return _['find'](_0x5bffc3,{'phone':_0x2036d0});}else{logger[_0x6d17('0xc')](_0x6d17('0x26'));return request({'uri':util[_0x6d17('0xd')]('%s/api/v2/contacts',_0x1ea6dd[_0x6d17('0x19')]),'method':'POST','body':{'name':_0x22519f,'phone':_0x2036d0}})[_0x6d17('0x1d')](function(_0x40a2db){logger[_0x6d17('0xc')]('Enduser\x20created.');return _0x40a2db;});}});}function getAuth(_0x4c057a){return util[_0x6d17('0xd')]('Basic\x20%s',new Buffer(_0x4c057a[_0x6d17('0x27')]+':X')['toString'](_0x6d17('0x28')));}function request(_0x2bbd4f){logger[_0x6d17('0x29')](_0x6d17('0x2a'),JSON[_0x6d17('0x2b')](_0x2bbd4f));return rp(_[_0x6d17('0x2c')](_0x2bbd4f,{'method':_0x6d17('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x4c0d68,_0x3f50d0){var _0x404922=[];if(_0x4c0d68&&_0x4c0d68['length']>0x0){_0x404922=_[_0x6d17('0x2e')](_0x4c0d68,_0x3f50d0);}return _0x404922;}function getCustomFields(_0x5e86cd,_0x4f0dcb){var _0x127a38=[];var _0x2b3ccf={'custom_fields':[]};if(_0x5e86cd[_0x6d17('0x1e')]>0x0){_[_0x6d17('0x2f')](_0x5e86cd,function(_0x57d094){if(_[_0x6d17('0x30')](['string',_0x6d17('0x31')],_0x57d094[_0x6d17('0x32')])&&_0x57d094[_0x6d17('0x33')]&&!_0x57d094[_0x6d17('0x34')]){_0x2b3ccf[_0x57d094[_0x6d17('0x33')][_0x6d17('0x35')]()]=_0x57d094['content'][_0x6d17('0x36')]();}else if(_['includes']([_0x6d17('0x37'),_0x6d17('0x31')],_0x57d094[_0x6d17('0x32')])&&_0x57d094[_0x6d17('0x38')]&&_0x57d094[_0x6d17('0x34')]){_0x2b3ccf['custom_fields']['push']({'id':_0x57d094[_0x6d17('0x38')],'value':_0x57d094[_0x6d17('0x39')][_0x6d17('0x36')]()});}else if(_0x57d094[_0x6d17('0x32')]===_0x6d17('0x3a')&&_0x57d094[_0x6d17('0x3b')]&&_0x57d094[_0x6d17('0x38')]&&_0x57d094[_0x6d17('0x34')]){_0x4f0dcb[_0x57d094[_0x6d17('0x3b')]]&&_0x2b3ccf[_0x6d17('0x16')]['push']({'id':_0x57d094['idField'],'value':_0x4f0dcb[_0x57d094['variableName']][_0x6d17('0x36')]()});}else if(_0x57d094[_0x6d17('0x32')]===_0x6d17('0x3c')&&_0x57d094['Variable']&&_0x57d094['Variable'][_0x6d17('0x14')]&&_0x57d094[_0x6d17('0x38')]&&_0x57d094[_0x6d17('0x34')]){_0x4f0dcb[_0x57d094['Variable']['name'][_0x6d17('0x35')]()]&&_0x2b3ccf[_0x6d17('0x16')][_0x6d17('0x3d')]({'id':_0x57d094[_0x6d17('0x38')],'value':_0x4f0dcb[_0x57d094[_0x6d17('0x3e')][_0x6d17('0x14')][_0x6d17('0x35')]()]['toString']()});}});}return _0x2b3ccf;}exports['queue']=function(_0x5d028e,_0x4b0a2b,_0x4ed182,_0x270eb3,_0x2b83e9,_0x126fd0){var _0x389e2b,_0x120129;_0x126fd0[_0x6d17('0x19')]=intUtil['stripTrailingSlash'](_0x126fd0[_0x6d17('0x19')]);_0x126fd0['serverUrl']=intUtil[_0x6d17('0x3f')](_0x126fd0[_0x6d17('0x40')]);if(_0x2b83e9&&_0x2b83e9['monitor_format']){logger['info'](_0x6d17('0x41'),'Recording\x20is\x20enabled!');_0x4b0a2b[_0x6d17('0x42')]=util[_0x6d17('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x126fd0[_0x6d17('0x40')],_0x4b0a2b['uniqueid'],md5(_0x4b0a2b[_0x6d17('0x43')]));}else{_0x4b0a2b[_0x6d17('0x42')]='';}headers['Authorization']=getAuth(_0x126fd0);return getUser(_0x126fd0,_0x270eb3[_0x6d17('0x44')])[_0x6d17('0x1d')](function(_0x2ae603){_0x389e2b=_0x2ae603;logger[_0x6d17('0xc')]('The\x20User\x20ID\x20is:',_0x389e2b['id']);return getEndUser(_0x126fd0,_0x4b0a2b[_0x6d17('0xe')],_0x4b0a2b[_0x6d17('0xf')]);})['then'](function(_0xa5e416){_0x120129=_0xa5e416;logger['info'](_0x6d17('0x45'),_0x120129['id']);return getTicket(_0x126fd0,_0x389e2b,_0x120129,_0x4ed182,_0x4b0a2b);})['then'](function(_0x18a1ce){if(_0x18a1ce&&_0x18a1ce['id']){logger[_0x6d17('0xc')](_0x6d17('0x1b'));logger[_0x6d17('0xc')](_0x6d17('0x46'),_0x18a1ce['id']);logger[_0x6d17('0xc')](_0x6d17('0x41'),_0x6d17('0x47'));emit(util['format'](_0x6d17('0x48'),_0x270eb3[_0x6d17('0x14')]),_0x6d17('0x49'),{'uri':util['format'](_0x6d17('0x4a'),_0x126fd0[_0x6d17('0x19')],_0x18a1ce['id'])});}})[_0x6d17('0x4b')](function(_0x481acc){logger['error']('[QUEUE]',JSON[_0x6d17('0x2b')](_0x481acc));});};exports['outbound']=function(_0x2d38ef,_0x1c0de2,_0x1b9bd1,_0x511be6,_0x43b85e,_0x242ac2,_0x471a7d){var _0xa4b5f1,_0x10202c;_0x242ac2[_0x6d17('0x19')]=intUtil[_0x6d17('0x3f')](_0x242ac2[_0x6d17('0x19')]);_0x242ac2[_0x6d17('0x40')]=intUtil['stripTrailingSlash'](_0x242ac2[_0x6d17('0x40')]);if(_0x471a7d&&_0x471a7d[_0x6d17('0x4c')]&&_0x471a7d[_0x6d17('0x4c')]!==_0x6d17('0x4d')){logger[_0x6d17('0xc')](_0x6d17('0x4e'),_0x6d17('0x4f'));_0x1c0de2[_0x6d17('0x42')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x242ac2[_0x6d17('0x40')],_0x1c0de2['uniqueid'],md5(_0x1c0de2[_0x6d17('0x43')]));}headers[_0x6d17('0x50')]=getAuth(_0x242ac2);return getUser(_0x242ac2,_0x511be6['email'])[_0x6d17('0x1d')](function(_0x4d96a1){_0xa4b5f1=_0x4d96a1;logger[_0x6d17('0xc')]('The\x20User\x20ID\x20is:',_0xa4b5f1['id']);return getEndUser(_0x242ac2,_0x1c0de2[_0x6d17('0x51')],_0x1c0de2[_0x6d17('0x52')]);})[_0x6d17('0x1d')](function(_0x30cbab){_0x10202c=_0x30cbab;logger[_0x6d17('0xc')](_0x6d17('0x45'),_0x10202c['id']);return getTicket(_0x242ac2,_0xa4b5f1,_0x10202c,_0x1b9bd1,_0x1c0de2);})[_0x6d17('0x1d')](function(_0x5de812){if(_0x5de812&&_0x5de812['id']){logger['info'](_0x6d17('0x1b'));logger[_0x6d17('0xc')](_0x6d17('0x46'),_0x5de812['id']);logger[_0x6d17('0xc')](_0x6d17('0x4e'),_0x6d17('0x47'));emit(util[_0x6d17('0xd')]('user:%s',_0x511be6[_0x6d17('0x14')]),_0x6d17('0x49'),{'uri':util[_0x6d17('0xd')](_0x6d17('0x4a'),_0x242ac2['remoteUri'],_0x5de812['id'])});}})[_0x6d17('0x4b')](function(_0x5dc70f){logger[_0x6d17('0x53')](_0x6d17('0x4e'),JSON[_0x6d17('0x2b')](_0x5dc70f));});};exports['unmanaged']=function(_0x19e998,_0x380d55,_0x122659,_0x28030b,_0x431867,_0x5d5dba){var _0x2d2e35,_0x35a1e9;_0x5d5dba[_0x6d17('0x19')]=intUtil[_0x6d17('0x3f')](_0x5d5dba['remoteUri']);_0x5d5dba[_0x6d17('0x40')]=intUtil['stripTrailingSlash'](_0x5d5dba['serverUrl']);if(_0x431867&&_0x431867[_0x6d17('0x54')]){logger[_0x6d17('0xc')]('['+_0x380d55['lastevent'][_0x6d17('0x55')]()+']',_0x6d17('0x4f'));_0x380d55[_0x6d17('0x42')]=util[_0x6d17('0xd')](_0x6d17('0x56'),_0x5d5dba['serverUrl'],_0x380d55['uniqueid'],md5(_0x380d55[_0x6d17('0x43')]));}else{_0x380d55[_0x6d17('0x42')]='';}headers[_0x6d17('0x50')]=getAuth(_0x5d5dba);return getUser(_0x5d5dba,'')[_0x6d17('0x1d')](function(_0x45d961){_0x2d2e35=_0x45d961;logger[_0x6d17('0xc')]('The\x20User\x20ID\x20is:',_0x2d2e35['id']);return getEndUser(_0x5d5dba,_0x380d55[_0x6d17('0xe')],_0x380d55[_0x6d17('0xf')]);})[_0x6d17('0x1d')](function(_0x2249f8){_0x35a1e9=_0x2249f8;logger['info'](_0x6d17('0x45'),_0x35a1e9['id']);return getTicket(_0x5d5dba,_0x2d2e35,_0x35a1e9,_0x122659,_0x380d55);})[_0x6d17('0x1d')](function(_0x20cd02){if(_0x20cd02){logger[_0x6d17('0xc')](_0x6d17('0x1b'));logger['info'](_0x6d17('0x46'),_0x20cd02['id']);}})[_0x6d17('0x4b')](function(_0x2ed086){logger['error']('['+_0x380d55[_0x6d17('0x57')][_0x6d17('0x55')]()+']',JSON['stringify'](_0x2ed086));});};
\ No newline at end of file
index 1392264..93775af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e56=['uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','users','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','message','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0xab7152,_0x528b66){var _0x2fdaff=function(_0x493479){while(--_0x493479){_0xab7152['push'](_0xab7152['shift']());}};_0x2fdaff(++_0x528b66);}(_0x5e56,0x65));var _0x65e5=function(_0x4c4f88,_0x713c4a){_0x4c4f88=_0x4c4f88-0x0;var _0x17dc56=_0x5e56[_0x4c4f88];return _0x17dc56;};'use strict';var _=require(_0x65e5('0x0'));var rp=require(_0x65e5('0x1'));var md5=require(_0x65e5('0x2'));var util=require(_0x65e5('0x3'));var moment=require(_0x65e5('0x4'));var Promise=require(_0x65e5('0x5'));var Redis=require(_0x65e5('0x6'));var intUtil=require('./util');var config=require(_0x65e5('0x7'));var logger=require(_0x65e5('0x8'))('freshsales');config[_0x65e5('0x9')]=_[_0x65e5('0xa')](config['redis'],{'host':_0x65e5('0xb'),'port':0x18eb});var io=require(_0x65e5('0xc'))(new Redis(config[_0x65e5('0x9')]));function getAdminId(_0x36d57d,_0x41ecbc,_0x29cff4,_0x260464){return new Promise(function(_0xe37e30,_0x115393){var _0x14995a=![];var _0x19ecb1={'method':_0x65e5('0xd'),'uri':_0x260464+_0x65e5('0xe'),'json':!![]};_0x19ecb1[_0x65e5('0xf')]=_0x29cff4;logger['info'](_0x65e5('0x10'));return rp(_0x19ecb1)[_0x65e5('0x11')](function(_0xa34bf){if(_0xa34bf){var _0x1e91c9=_0xa34bf['users'];var _0x32e2f0=null;for(_0x32e2f0=0x0;_0x32e2f0<_0x1e91c9[_0x65e5('0x12')];_0x32e2f0++){if(_0x1e91c9[_0x32e2f0][_0x65e5('0x13')]===_0x36d57d[_0x65e5('0x14')]){_0x36d57d['adminId']=_0x1e91c9[_0x32e2f0]['id'];_0x14995a=!![];}}if(_0x14995a){logger[_0x65e5('0x15')](_0x65e5('0x16'),_0x36d57d[_0x65e5('0x17')]);_0xe37e30(_0x36d57d);}else{_0x115393({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x115393({'statusCode':0x194,'message':_0x65e5('0x18')});}})[_0x65e5('0x19')](function(_0x390b4b){logger[_0x65e5('0x1a')]('['+[_0x41ecbc[_0x65e5('0x1b')]()]+']',_0x390b4b['message']);_0x115393(_0x390b4b);});});}function getUser(_0x57502e,_0x20912b,_0x3761a3){return function(_0x4b03f5){return new Promise(function(_0x5e786d,_0xc894ef){var _0x11e2ec={'method':_0x65e5('0xd'),'uri':_0x3761a3+_0x65e5('0xe'),'json':!![]};_0x11e2ec[_0x65e5('0xf')]=_0x20912b;logger['info']('Getting\x20user\x20list');return rp(_0x11e2ec)[_0x65e5('0x11')](function(_0x5a9645){if(_0x5a9645){var _0x1bb778=_0x5a9645[_0x65e5('0x1c')];var _0x28963d=![];var _0x1afd6c=null;if(_0x4b03f5['agentEmail']!==null){logger[_0x65e5('0x15')](_0x65e5('0x1d'),_0x4b03f5[_0x65e5('0x1e')]);_0x4b03f5[_0x65e5('0x1f')]=_0x4b03f5[_0x65e5('0x1e')];for(_0x1afd6c=0x0;_0x1afd6c<_0x1bb778['length'];_0x1afd6c++){if(_0x1bb778[_0x1afd6c]['email']===_0x4b03f5['agentEmail']){_0x28963d=!![];_0x4b03f5[_0x65e5('0x20')]=_0x1bb778[_0x1afd6c]['id'];logger[_0x65e5('0x15')](_0x65e5('0x21'),_0x4b03f5['userId']);}}}if(!_0x28963d){logger[_0x65e5('0x15')](_0x65e5('0x22'));_0x4b03f5[_0x65e5('0x1f')]=_0x4b03f5['adminEmail'];_0x4b03f5[_0x65e5('0x20')]=_0x4b03f5[_0x65e5('0x17')];_0x28963d=!![];}if(_0x28963d){_0x5e786d(_0x4b03f5);}else{_0xc894ef({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xc894ef({'statusCode':0x194,'message':_0x65e5('0x18')});}})[_0x65e5('0x19')](function(_0x303a89){logger[_0x65e5('0x1a')]('['+[_0x57502e[_0x65e5('0x1b')]()]+']',_0x303a89[_0x65e5('0x23')]);_0xc894ef(_0x303a89);});});};}function searchContact(_0x439965,_0x35a117,_0x4cd00e,_0x548407){return new Promise(function(_0x3866d2,_0xf5782a){var _0x4bff76={'method':'GET','headers':_0x35a117,'uri':_0x439965+'/api/lookup?q='+_0x548407+_0x65e5('0x24')+_0x4cd00e+'&entities=contact','json':!![]};rp(_0x4bff76)['then'](function(_0x398e62){var _0x4f37bd=_[_0x65e5('0x25')](_0x398e62[_0x65e5('0x26')][_0x65e5('0x26')],[_0x4cd00e,_0x548407]);_0x3866d2(_0x4f37bd);})[_0x65e5('0x19')](function(_0x5503aa){_0xf5782a(_0x5503aa);});});}function getEndUser(_0x26980c,_0x19a55d,_0x224e4d){return function(_0x3b1fb0){return new Promise(function(_0x1b467a,_0x3a0c17){logger['info'](util[_0x65e5('0x27')](_0x65e5('0x28'),_0x3b1fb0[_0x65e5('0x29')]));searchContact(_0x224e4d,_0x19a55d,_0x65e5('0x2a'),_0x3b1fb0[_0x65e5('0x29')])['then'](function(_0x3f062c){if(_0x3f062c){_0x3b1fb0[_0x65e5('0x2b')]=_0x3f062c['id'];logger[_0x65e5('0x15')](_0x65e5('0x2c'),_0x3b1fb0[_0x65e5('0x2b')]);return _0x1b467a(_0x3b1fb0);}searchContact(_0x224e4d,_0x19a55d,_0x65e5('0x2d'),_0x3b1fb0[_0x65e5('0x29')])['then'](function(_0x44a060){if(_0x44a060){_0x3b1fb0[_0x65e5('0x2b')]=_0x44a060['id'];logger[_0x65e5('0x15')](_0x65e5('0x2e'),_0x3b1fb0[_0x65e5('0x2b')]);return _0x1b467a(_0x3b1fb0);}createEndUser(_0x3b1fb0,_0x26980c,_0x19a55d,_0x224e4d)[_0x65e5('0x11')](function(_0x2a653d){logger['info'](_0x65e5('0x2f'),_0x2a653d['endUserId']);return _0x1b467a(_0x2a653d);});});})[_0x65e5('0x19')](function(_0x5a7884){_0x3a0c17(_0x5a7884);});});};}function createEndUser(_0x526b08,_0x3e2796,_0x206adc,_0x1fd12a){return new Promise(function(_0x3c8093,_0x3f683d){var _0x45bf03=moment();var _0x1328a6={'method':'POST','uri':_0x1fd12a+_0x65e5('0x30'),'body':{'contact':{'last_name':_0x526b08[_0x65e5('0x29')],'work_number':_0x526b08['contactNumber'],'mobile_number':_0x526b08[_0x65e5('0x29')],'owner_id':_0x526b08[_0x65e5('0x20')],'created_at':_0x45bf03[_0x65e5('0x27')](_0x65e5('0x31'))}},'json':!![]};_0x1328a6[_0x65e5('0xf')]=_0x206adc;logger['info'](_0x65e5('0x32'));return rp(_0x1328a6)['then'](function(_0x4b946b){_0x526b08[_0x65e5('0x2b')]=_0x4b946b['contact']['id'];_0x3c8093(_0x526b08);})[_0x65e5('0x19')](function(_0x53874c){logger[_0x65e5('0x1a')]('['+[_0x3e2796[_0x65e5('0x1b')]()]+']',_0x53874c[_0x65e5('0x23')]);_0x3f683d(_0x53874c[_0x65e5('0x23')]);});});}function getTicket(_0x592a5f,_0x40cf98,_0x33c2f1,_0x1d7b2e,_0x431a9e){return function(_0x846508){logger['info'](_0x65e5('0x33'));return new Promise(function(_0x58bf6c,_0x24bbdf){var _0x17c215=moment();var _0x1692f1={'method':_0x65e5('0x34'),'uri':_0x33c2f1+_0x65e5('0x35'),'body':{'title':intUtil[_0x65e5('0x36')](_0x1d7b2e[_0x65e5('0x37')],_0x431a9e,'\x20'),'description':intUtil[_0x65e5('0x36')](_0x1d7b2e[_0x65e5('0x38')],_0x431a9e,'\x0a'),'owner_id':_0x846508[_0x65e5('0x20')],'creater_id':_0x846508[_0x65e5('0x17')],'targetable_id':_0x846508['endUserId'],'targetable_type':_0x65e5('0x39'),'created_at':_0x17c215[_0x65e5('0x27')](_0x65e5('0x31')),'due_date':_0x17c215[_0x65e5('0x3a')](0x1e,'m')['format'](_0x65e5('0x31'))},'json':!![]};_0x1692f1[_0x65e5('0xf')]=_0x40cf98;return rp(_0x1692f1)['then'](function(_0x410cd2){_0x846508[_0x65e5('0x3b')]=_0x410cd2[_0x65e5('0x3c')]['id'];logger[_0x65e5('0x15')](_0x65e5('0x3d'),_0x846508['ticketId']);_0x58bf6c(_0x846508);})[_0x65e5('0x19')](function(_0x5e268a){logger[_0x65e5('0x1a')]('['+[_0x592a5f['toUpperCase']()]+']',_0x5e268a[_0x65e5('0x23')]);_0x24bbdf(_0x5e268a[_0x65e5('0x23')]);});});};}function emit(_0x478a3d,_0x292970,_0x1249f8){var _0x3586a5={'uri':_0x478a3d+_0x65e5('0x3e')+_0x1249f8};io['to'](util['format'](_0x65e5('0x3f'),_0x292970))[_0x65e5('0x40')](_0x65e5('0x41'),_0x3586a5);}exports['cs']=function(_0x3f71ec,_0x1eb44f,_0x237bd7,_0x2dd5f3,_0x4cd38a,_0x472517,_0x3cd117,_0x440b84){var _0x656fb1={};var _0x59bb65={'Authorization':_0x65e5('0x42')+_0x472517[_0x65e5('0x43')]};_0x472517[_0x65e5('0x44')]=intUtil['stripTrailingSlash'](_0x472517['remoteUri']);_0x472517[_0x65e5('0x45')]=intUtil[_0x65e5('0x46')](_0x472517[_0x65e5('0x45')]);var _0x4e7818=_0x472517[_0x65e5('0x44')];_0x656fb1[_0x65e5('0x14')]=_0x472517['username'];_0x656fb1[_0x65e5('0x29')]=_0x440b84[_0x65e5('0x47')]()===_0x65e5('0x48')?_0x1eb44f[_0x65e5('0x49')]:_0x1eb44f[_0x65e5('0x4a')];_0x656fb1[_0x65e5('0x4b')]=_0x440b84==='queue'||_0x440b84===_0x65e5('0x4c')?_0x65e5('0x4d'):_0x65e5('0x48');if(_0x2dd5f3){_0x656fb1['agentEmail']=_0x2dd5f3['email'];}var _0x74023c=util[_0x65e5('0x27')](_0x65e5('0x4e'),_0x472517[_0x65e5('0x45')],_0x1eb44f['uniqueid'],md5(_0x1eb44f[_0x65e5('0x4f')]));if(_0x4cd38a&&_0x4cd38a[_0x65e5('0x50')]){logger['info'](_0x65e5('0x51'),_0x65e5('0x52'));_0x1eb44f['recordingURL']=_0x74023c;}else if(_0x3cd117&&_0x3cd117[_0x65e5('0x53')]&&_0x3cd117['recordingFormat']!==_0x65e5('0x54')){logger[_0x65e5('0x15')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1eb44f[_0x65e5('0x55')]=_0x74023c;}else{_0x1eb44f[_0x65e5('0x55')]='';}return getAdminId(_0x656fb1,_0x440b84,_0x59bb65,_0x4e7818)[_0x65e5('0x11')](getUser(_0x440b84,_0x59bb65,_0x4e7818))[_0x65e5('0x11')](getEndUser(_0x440b84,_0x59bb65,_0x4e7818))['then'](getTicket(_0x440b84,_0x59bb65,_0x4e7818,_0x237bd7,_0x1eb44f))[_0x65e5('0x11')](function(_0x2a3852){logger[_0x65e5('0x15')](util[_0x65e5('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2a3852[_0x65e5('0x3b')]));if(_0x440b84!==_0x65e5('0x4c')){logger[_0x65e5('0x15')]('['+[_0x440b84[_0x65e5('0x1b')]()]+']',_0x65e5('0x56'));emit(_0x4e7818,_0x2dd5f3[_0x65e5('0x57')],_0x2a3852['endUserId']);}})[_0x65e5('0x19')](function(_0x20b098){logger[_0x65e5('0x1a')]('['+[_0x440b84[_0x65e5('0x1b')]()]+_0x65e5('0x58'),util[_0x65e5('0x59')](_0x20b098,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0xfb75=['YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','ticketId','Task\x20created:','/contacts/','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','destcalleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','socket.io-emitter','redis','GET','headers','info','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','then','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts'];(function(_0x45dc76,_0x376bb3){var _0x439965=function(_0x5108df){while(--_0x5108df){_0x45dc76['push'](_0x45dc76['shift']());}};_0x439965(++_0x376bb3);}(_0xfb75,0x1a4));var _0x5fb7=function(_0x461380,_0x3c51d1){_0x461380=_0x461380-0x0;var _0x3b9036=_0xfb75[_0x461380];return _0x3b9036;};'use strict';var _=require(_0x5fb7('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x5fb7('0x1'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x5fb7('0x2'));var intUtil=require(_0x5fb7('0x3'));var config=require(_0x5fb7('0x4'));var logger=require(_0x5fb7('0x5'))(_0x5fb7('0x6'));config['redis']=_[_0x5fb7('0x7')](config['redis'],{'host':_0x5fb7('0x8'),'port':0x18eb});var io=require(_0x5fb7('0x9'))(new Redis(config[_0x5fb7('0xa')]));function getAdminId(_0x5231ee,_0x3965a7,_0x4deef5,_0x210212){return new Promise(function(_0x401ca4,_0x16327a){var _0xf73a93=![];var _0x275d06={'method':_0x5fb7('0xb'),'uri':_0x210212+'/api/selector/owners','json':!![]};_0x275d06[_0x5fb7('0xc')]=_0x4deef5;logger[_0x5fb7('0xd')]('Getting\x20admin\x20information');return rp(_0x275d06)['then'](function(_0x4144bc){if(_0x4144bc){var _0x147640=_0x4144bc[_0x5fb7('0xe')];var _0x113499=null;for(_0x113499=0x0;_0x113499<_0x147640[_0x5fb7('0xf')];_0x113499++){if(_0x147640[_0x113499]['email']===_0x5231ee[_0x5fb7('0x10')]){_0x5231ee[_0x5fb7('0x11')]=_0x147640[_0x113499]['id'];_0xf73a93=!![];}}if(_0xf73a93){logger[_0x5fb7('0xd')]('Admin\x20found:',_0x5231ee[_0x5fb7('0x11')]);_0x401ca4(_0x5231ee);}else{_0x16327a({'statusCode':0x194,'message':_0x5fb7('0x12')});}}else{_0x16327a({'statusCode':0x194,'message':_0x5fb7('0x12')});}})[_0x5fb7('0x13')](function(_0x313734){logger[_0x5fb7('0x14')]('['+[_0x3965a7[_0x5fb7('0x15')]()]+']',_0x313734['message']);_0x16327a(_0x313734);});});}function getUser(_0x50585f,_0x2da270,_0x362d25){return function(_0x29760d){return new Promise(function(_0x294a4f,_0x38f8b7){var _0x24b54a={'method':_0x5fb7('0xb'),'uri':_0x362d25+_0x5fb7('0x16'),'json':!![]};_0x24b54a[_0x5fb7('0xc')]=_0x2da270;logger[_0x5fb7('0xd')]('Getting\x20user\x20list');return rp(_0x24b54a)[_0x5fb7('0x17')](function(_0x1cad59){if(_0x1cad59){var _0xdcfb59=_0x1cad59[_0x5fb7('0xe')];var _0x616e03=![];var _0x57e22d=null;if(_0x29760d[_0x5fb7('0x18')]!==null){logger[_0x5fb7('0xd')]('Getting\x20user\x20with\x20email',_0x29760d[_0x5fb7('0x18')]);_0x29760d['userEmail']=_0x29760d[_0x5fb7('0x18')];for(_0x57e22d=0x0;_0x57e22d<_0xdcfb59[_0x5fb7('0xf')];_0x57e22d++){if(_0xdcfb59[_0x57e22d][_0x5fb7('0x19')]===_0x29760d[_0x5fb7('0x18')]){_0x616e03=!![];_0x29760d[_0x5fb7('0x1a')]=_0xdcfb59[_0x57e22d]['id'];logger[_0x5fb7('0xd')](_0x5fb7('0x1b'),_0x29760d[_0x5fb7('0x1a')]);}}}if(!_0x616e03){logger[_0x5fb7('0xd')](_0x5fb7('0x1c'));_0x29760d[_0x5fb7('0x1d')]=_0x29760d[_0x5fb7('0x10')];_0x29760d[_0x5fb7('0x1a')]=_0x29760d[_0x5fb7('0x11')];_0x616e03=!![];}if(_0x616e03){_0x294a4f(_0x29760d);}else{_0x38f8b7({'statusCode':0x194,'message':_0x5fb7('0x12')});}}else{_0x38f8b7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0xefb260){logger[_0x5fb7('0x14')]('['+[_0x50585f[_0x5fb7('0x15')]()]+']',_0xefb260['message']);_0x38f8b7(_0xefb260);});});};}function searchContact(_0x15f248,_0xa60ce8,_0x5b22b1,_0x3ef567){return new Promise(function(_0x4e3dd3,_0x2eaf5d){var _0x46921f={'method':_0x5fb7('0xb'),'headers':_0xa60ce8,'uri':_0x15f248+'/api/lookup?q='+_0x3ef567+_0x5fb7('0x1e')+_0x5b22b1+_0x5fb7('0x1f'),'json':!![]};rp(_0x46921f)[_0x5fb7('0x17')](function(_0x35bf25){var _0x1f265f=_['find'](_0x35bf25['contacts'][_0x5fb7('0x20')],[_0x5b22b1,_0x3ef567]);_0x4e3dd3(_0x1f265f);})[_0x5fb7('0x13')](function(_0x4bd66a){_0x2eaf5d(_0x4bd66a);});});}function getEndUser(_0x2c2f57,_0x109414,_0x34dee2){return function(_0x27d569){return new Promise(function(_0x12d8b8,_0x296476){logger[_0x5fb7('0xd')](util[_0x5fb7('0x21')](_0x5fb7('0x22'),_0x27d569['contactNumber']));searchContact(_0x34dee2,_0x109414,'mobile_number',_0x27d569[_0x5fb7('0x23')])[_0x5fb7('0x17')](function(_0x4ac289){if(_0x4ac289){_0x27d569[_0x5fb7('0x24')]=_0x4ac289['id'];logger[_0x5fb7('0xd')](_0x5fb7('0x25'),_0x27d569[_0x5fb7('0x24')]);return _0x12d8b8(_0x27d569);}searchContact(_0x34dee2,_0x109414,_0x5fb7('0x26'),_0x27d569[_0x5fb7('0x23')])[_0x5fb7('0x17')](function(_0x576969){if(_0x576969){_0x27d569[_0x5fb7('0x24')]=_0x576969['id'];logger[_0x5fb7('0xd')](_0x5fb7('0x27'),_0x27d569[_0x5fb7('0x24')]);return _0x12d8b8(_0x27d569);}createEndUser(_0x27d569,_0x2c2f57,_0x109414,_0x34dee2)['then'](function(_0x1c98b6){logger[_0x5fb7('0xd')]('Contact\x20created:',_0x1c98b6[_0x5fb7('0x24')]);return _0x12d8b8(_0x1c98b6);});});})[_0x5fb7('0x13')](function(_0x367514){_0x296476(_0x367514);});});};}function createEndUser(_0x146228,_0x2f1e5c,_0x217fae,_0x528a33){return new Promise(function(_0x2d062c,_0x31307e){var _0x3acc57=moment();var _0x3a6893={'method':_0x5fb7('0x28'),'uri':_0x528a33+_0x5fb7('0x29'),'body':{'contact':{'last_name':_0x146228[_0x5fb7('0x23')],'work_number':_0x146228[_0x5fb7('0x23')],'mobile_number':_0x146228[_0x5fb7('0x23')],'owner_id':_0x146228[_0x5fb7('0x1a')],'created_at':_0x3acc57[_0x5fb7('0x21')](_0x5fb7('0x2a'))}},'json':!![]};_0x3a6893[_0x5fb7('0xc')]=_0x217fae;logger[_0x5fb7('0xd')](_0x5fb7('0x2b'));return rp(_0x3a6893)[_0x5fb7('0x17')](function(_0x1f7112){_0x146228['endUserId']=_0x1f7112[_0x5fb7('0x2c')]['id'];_0x2d062c(_0x146228);})[_0x5fb7('0x13')](function(_0x375016){logger['error']('['+[_0x2f1e5c[_0x5fb7('0x15')]()]+']',_0x375016[_0x5fb7('0x2d')]);_0x31307e(_0x375016['message']);});});}function getTicket(_0x135331,_0x4bd4e0,_0x51a2f7,_0x26e788,_0x550fcd){return function(_0x37cda3){logger[_0x5fb7('0xd')](_0x5fb7('0x2e'));return new Promise(function(_0x266518,_0x135b30){var _0x1e5dd8=moment();var _0x54f7c3={'method':_0x5fb7('0x28'),'uri':_0x51a2f7+_0x5fb7('0x2f'),'body':{'title':intUtil[_0x5fb7('0x30')](_0x26e788[_0x5fb7('0x31')],_0x550fcd,'\x20'),'description':intUtil[_0x5fb7('0x30')](_0x26e788['Descriptions'],_0x550fcd,'\x0a'),'owner_id':_0x37cda3[_0x5fb7('0x1a')],'creater_id':_0x37cda3[_0x5fb7('0x11')],'targetable_id':_0x37cda3[_0x5fb7('0x24')],'targetable_type':_0x5fb7('0x32'),'created_at':_0x1e5dd8[_0x5fb7('0x21')](_0x5fb7('0x2a')),'due_date':_0x1e5dd8['add'](0x1e,'m')[_0x5fb7('0x21')](_0x5fb7('0x2a'))},'json':!![]};_0x54f7c3[_0x5fb7('0xc')]=_0x4bd4e0;return rp(_0x54f7c3)[_0x5fb7('0x17')](function(_0x3de7da){_0x37cda3[_0x5fb7('0x33')]=_0x3de7da['task']['id'];logger[_0x5fb7('0xd')](_0x5fb7('0x34'),_0x37cda3[_0x5fb7('0x33')]);_0x266518(_0x37cda3);})[_0x5fb7('0x13')](function(_0x184d1a){logger[_0x5fb7('0x14')]('['+[_0x135331[_0x5fb7('0x15')]()]+']',_0x184d1a[_0x5fb7('0x2d')]);_0x135b30(_0x184d1a[_0x5fb7('0x2d')]);});});};}function emit(_0x70dab6,_0x2bdebb,_0x5462bd){var _0xa01b26={'uri':_0x70dab6+_0x5fb7('0x35')+_0x5462bd};io['to'](util[_0x5fb7('0x21')]('user:%s',_0x2bdebb))['emit']('trigger:browser:url',_0xa01b26);}exports['cs']=function(_0x48afe9,_0x10af5a,_0x55756,_0x5647b7,_0x4a3cca,_0x33d035,_0x4703ff,_0x38f970){var _0x26e4a5={};var _0x454db3={'Authorization':_0x5fb7('0x36')+_0x33d035[_0x5fb7('0x37')]};_0x33d035['remoteUri']=intUtil[_0x5fb7('0x38')](_0x33d035[_0x5fb7('0x39')]);_0x33d035[_0x5fb7('0x3a')]=intUtil[_0x5fb7('0x38')](_0x33d035['serverUrl']);var _0xb81951=_0x33d035['remoteUri'];_0x26e4a5[_0x5fb7('0x10')]=_0x33d035['username'];_0x26e4a5['contactNumber']=_0x38f970['toLowerCase']()==='outbound'?_0x10af5a[_0x5fb7('0x3b')]:_0x10af5a['calleridnum'];_0x26e4a5[_0x5fb7('0x3c')]=_0x38f970===_0x5fb7('0x3d')||_0x38f970==='unmanaged'?_0x5fb7('0x3d'):_0x5fb7('0x3e');if(_0x5647b7){_0x26e4a5[_0x5fb7('0x18')]=_0x5647b7['email'];}var _0x5a193e=util['format'](_0x5fb7('0x3f'),_0x33d035[_0x5fb7('0x3a')],_0x10af5a[_0x5fb7('0x40')],md5(_0x10af5a[_0x5fb7('0x40')]));if(_0x4a3cca&&_0x4a3cca[_0x5fb7('0x41')]){logger['info'](_0x5fb7('0x42'),_0x5fb7('0x43'));_0x10af5a[_0x5fb7('0x44')]=_0x5a193e;}else if(_0x4703ff&&_0x4703ff[_0x5fb7('0x45')]&&_0x4703ff[_0x5fb7('0x45')]!==_0x5fb7('0x46')){logger[_0x5fb7('0xd')](_0x5fb7('0x47'),_0x5fb7('0x43'));_0x10af5a[_0x5fb7('0x44')]=_0x5a193e;}else{_0x10af5a[_0x5fb7('0x44')]='';}return getAdminId(_0x26e4a5,_0x38f970,_0x454db3,_0xb81951)['then'](getUser(_0x38f970,_0x454db3,_0xb81951))[_0x5fb7('0x17')](getEndUser(_0x38f970,_0x454db3,_0xb81951))[_0x5fb7('0x17')](getTicket(_0x38f970,_0x454db3,_0xb81951,_0x55756,_0x10af5a))['then'](function(_0x75307b){logger[_0x5fb7('0xd')](util[_0x5fb7('0x21')](_0x5fb7('0x48'),_0x75307b[_0x5fb7('0x33')]));if(_0x38f970!==_0x5fb7('0x49')){logger[_0x5fb7('0xd')]('['+[_0x38f970[_0x5fb7('0x15')]()]+']',_0x5fb7('0x4a'));emit(_0xb81951,_0x5647b7[_0x5fb7('0x4b')],_0x75307b[_0x5fb7('0x24')]);}})[_0x5fb7('0x13')](function(_0x228583){logger['error']('['+[_0x38f970[_0x5fb7('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x5fb7('0x4c')](_0x228583,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 9d216a7..d2b62c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63c0=['freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger'];(function(_0x208961,_0x5e6cf6){var _0x4236f5=function(_0x28856f){while(--_0x28856f){_0x208961['push'](_0x208961['shift']());}};_0x4236f5(++_0x5e6cf6);}(_0x63c0,0x193));var _0x063c=function(_0x1977f1,_0x19ef5c){_0x1977f1=_0x1977f1-0x0;var _0x5185ce=_0x63c0[_0x1977f1];return _0x5185ce;};'use strict';var _=require('lodash');var util=require(_0x063c('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x063c('0x1'));var sugarcrm=require(_0x063c('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x063c('0x3'));var desk=require(_0x063c('0x4'));var vtiger=require(_0x063c('0x5'));var servicenow=require(_0x063c('0x6'));var dynamics365=require(_0x063c('0x7'));var freshsales=require(_0x063c('0x8'));var integrations=['zendesk',_0x063c('0x9'),_0x063c('0xa'),_0x063c('0xb'),_0x063c('0xc'),_0x063c('0xd'),_0x063c('0xe'),'dynamics365',_0x063c('0xf'),_0x063c('0x10')];exports[_0x063c('0x11')]=function(_0x14d541,_0x1dd479,_0x54175f,_0x3dc531,_0x1aa1e5,_0x32ae0a){if(_0x54175f){if(_[_0x063c('0x12')](integrations,_0x14d541[_0x063c('0x13')][_0x063c('0x14')]())){try{var _0x3e5d69=null;var _0x24eaa9='';var _0x281b20=_0x54175f[_0x14d541[_0x063c('0x13')][_0x063c('0x14')]()];if(_0x281b20){var _0x341f54=_0x281b20[_0x14d541['data2']];if(_0x341f54){var _0x475952=_['find'](_0x341f54[_0x063c('0x15')],{'id':parseInt(_0x14d541[_0x063c('0x16')],0xa)});if(_0x475952){if(_0x3dc531){if(_0x1aa1e5&&_0x1dd479['queue']){_0x24eaa9=_0x063c('0x17');}else if(_0x1dd479[_0x063c('0x18')]){_0x24eaa9=_0x063c('0x19');}else{console[_0x063c('0x1a')](_0x063c('0x1b'),_0x1dd479);}}else{_0x24eaa9=_0x063c('0x1c');}switch(_0x14d541[_0x063c('0x13')][_0x063c('0x14')]()){case _0x063c('0x1d'):zendesk[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case _0x063c('0x9'):salesforce[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case _0x063c('0xa'):sugarcrm[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case _0x063c('0xb'):freshdesk[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case _0x063c('0xc'):zoho[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case _0x063c('0xd'):desk[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case'vtiger':vtiger[_0x24eaa9](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a);break;case _0x063c('0xf'):freshsales['cs'](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a,_0x24eaa9);break;case _0x063c('0x10'):servicenow['cs'](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a,_0x24eaa9);break;case _0x063c('0x1e'):dynamics365['cs'](_0x14d541,_0x1dd479,_0x475952,_0x3dc531,_0x1aa1e5,_0x341f54,_0x32ae0a,_0x24eaa9);break;default:console[_0x063c('0x1a')](_0x063c('0x1f'));}}else{_0x3e5d69=require(_0x063c('0x20'))(_0x14d541[_0x063c('0x13')][_0x063c('0x14')]());_0x3e5d69[_0x063c('0x21')](_0x063c('0x22'),util['format'](_0x063c('0x23'),_0x14d541[_0x063c('0x13')]['toLowerCase'](),_0x14d541[_0x063c('0x16')]));}}else{_0x3e5d69=require(_0x063c('0x20'))(_0x14d541[_0x063c('0x13')]['toLowerCase']());_0x3e5d69['error'](_0x063c('0x22'),util[_0x063c('0x24')](_0x063c('0x25'),_0x14d541['data1']['toLowerCase'](),_0x14d541['data2']));}}else{}}catch(_0x2f303c){console[_0x063c('0x21')](_0x2f303c);}}}};
\ No newline at end of file
+var _0xe25f=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','toLowerCase','data1','find','Configurations','data3','queue','routeId','outbound','unmanaged','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./vtiger','./servicenow'];(function(_0x26b5a0,_0x3e4fc2){var _0x11c7dc=function(_0x15b25a){while(--_0x15b25a){_0x26b5a0['push'](_0x26b5a0['shift']());}};_0x11c7dc(++_0x3e4fc2);}(_0xe25f,0x64));var _0xfe25=function(_0x59459b,_0x200eab){_0x59459b=_0x59459b-0x0;var _0x41fa22=_0xe25f[_0x59459b];return _0x41fa22;};'use strict';var _=require(_0xfe25('0x0'));var util=require(_0xfe25('0x1'));var zendesk=require(_0xfe25('0x2'));var salesforce=require(_0xfe25('0x3'));var sugarcrm=require(_0xfe25('0x4'));var freshdesk=require(_0xfe25('0x5'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xfe25('0x6'));var servicenow=require(_0xfe25('0x7'));var dynamics365=require(_0xfe25('0x8'));var freshsales=require(_0xfe25('0x9'));var integrations=[_0xfe25('0xa'),_0xfe25('0xb'),_0xfe25('0xc'),_0xfe25('0xd'),_0xfe25('0xe'),_0xfe25('0xf'),_0xfe25('0x10'),'dynamics365','freshsales',_0xfe25('0x11')];exports[_0xfe25('0x12')]=function(_0x3501cc,_0x14829d,_0x59ae0c,_0x311b5c,_0x210baa,_0x215a0b){if(_0x59ae0c){if(_[_0xfe25('0x13')](integrations,_0x3501cc['data1'][_0xfe25('0x14')]())){try{var _0x30da87=null;var _0xf83a27='';var _0x2de7e9=_0x59ae0c[_0x3501cc[_0xfe25('0x15')][_0xfe25('0x14')]()];if(_0x2de7e9){var _0x3b2f01=_0x2de7e9[_0x3501cc['data2']];if(_0x3b2f01){var _0x247746=_[_0xfe25('0x16')](_0x3b2f01[_0xfe25('0x17')],{'id':parseInt(_0x3501cc[_0xfe25('0x18')],0xa)});if(_0x247746){if(_0x311b5c){if(_0x210baa&&_0x14829d[_0xfe25('0x19')]){_0xf83a27=_0xfe25('0x19');}else if(_0x14829d[_0xfe25('0x1a')]){_0xf83a27=_0xfe25('0x1b');}else{console['log']('EVENT\x20UNKNOWN',_0x14829d);}}else{_0xf83a27=_0xfe25('0x1c');}switch(_0x3501cc['data1']['toLowerCase']()){case _0xfe25('0xa'):zendesk[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case'salesforce':salesforce[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case'sugarcrm':sugarcrm[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case _0xfe25('0xd'):freshdesk[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case _0xfe25('0xe'):zoho[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case _0xfe25('0xf'):desk[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case _0xfe25('0x10'):vtiger[_0xf83a27](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b);break;case'freshsales':freshsales['cs'](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b,_0xf83a27);break;case _0xfe25('0x11'):servicenow['cs'](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b,_0xf83a27);break;case'dynamics365':dynamics365['cs'](_0x3501cc,_0x14829d,_0x247746,_0x311b5c,_0x210baa,_0x3b2f01,_0x215a0b,_0xf83a27);break;default:console['log']('unknown\x20integration');}}else{_0x30da87=require(_0xfe25('0x1d'))(_0x3501cc[_0xfe25('0x15')]['toLowerCase']());_0x30da87[_0xfe25('0x1e')](_0xfe25('0x1f'),util[_0xfe25('0x20')](_0xfe25('0x21'),_0x3501cc[_0xfe25('0x15')][_0xfe25('0x14')](),_0x3501cc[_0xfe25('0x18')]));}}else{_0x30da87=require(_0xfe25('0x1d'))(_0x3501cc[_0xfe25('0x15')]['toLowerCase']());_0x30da87['error'](_0xfe25('0x1f'),util['format'](_0xfe25('0x22'),_0x3501cc[_0xfe25('0x15')]['toLowerCase'](),_0x3501cc[_0xfe25('0x23')]));}}else{}}catch(_0x5768d3){console['error'](_0x5768d3);}}}};
\ No newline at end of file
index 79a290d..410e462 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13f4=['calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','request-promise','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Subjects','utc','IsReminderSet','endUserType','contact','WhoId','account','ticketType','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','find','execute','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchLead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','<unknown>','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname'];(function(_0x21f0bc,_0x536f34){var _0x306467=function(_0x5ef285){while(--_0x5ef285){_0x21f0bc['push'](_0x21f0bc['shift']());}};_0x306467(++_0x536f34);}(_0x13f4,0x18d));var _0x413f=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0x13f4[_0x471273];return _0x56c63e;};'use strict';var _=require('lodash');var rp=require(_0x413f('0x0'));var moment=require(_0x413f('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x413f('0x2'));var intUtil=require(_0x413f('0x3'));var config=require(_0x413f('0x4'));var logger=require(_0x413f('0x5'))(_0x413f('0x6'));config[_0x413f('0x7')]=_[_0x413f('0x8')](config[_0x413f('0x7')],{'host':_0x413f('0x9'),'port':0x18eb});var io=require(_0x413f('0xa'))(new Redis(config[_0x413f('0x7')]));function emit(_0x30a264,_0x5bc571,_0xeae1e8){io['to'](_0x30a264)[_0x413f('0xb')](_0x5bc571,_0xeae1e8);}function getTicket(_0x64ed37,_0x473f55,_0x5c5f87,_0xdb75db,_0x302b69,_0x41b970,_0x67da92,_0x5f3c87){var _0x488640=Object['assign']({},{'OwnerId':_0x473f55['id'],'Subject':intUtil['getString'](_0xdb75db[_0x413f('0xc')],_0x302b69,'\x20'),'Description':intUtil['getString'](_0xdb75db['Descriptions'],_0x302b69,'\x0a')},getCustomFields(_0x41b970,_0x302b69));if(_0x5c5f87){if(_0xdb75db['ticketType']==='Task'){_0x488640['ActivityDate']=moment[_0x413f('0xd')]();_0x488640[_0x413f('0xe')]=![];_0x488640['IsRecurrence']=![];if(_0x5c5f87[_0x413f('0xf')]===_0x413f('0x10')||_0x5c5f87[_0x413f('0xf')]==='lead'){_0x488640[_0x413f('0x11')]=_0x5c5f87['id'];}else if(_0x5c5f87[_0x413f('0xf')]===_0x413f('0x12')){_0x488640['WhatId']=_0x5c5f87['id'];}}else if(_0xdb75db[_0x413f('0x13')]===_0x413f('0x14')){if(_0x5c5f87['endUserType']===_0x413f('0x10')){_0x488640[_0x413f('0x15')]=_0x5c5f87['id'];}else if(_0x5c5f87[_0x413f('0xf')]===_0x413f('0x12')){_0x488640[_0x413f('0x16')]=_0x5c5f87['id'];}else if(_0x5c5f87[_0x413f('0xf')]===_0x413f('0x17')&&_0xdb75db['leadId']){_0x488640[_0xdb75db[_0x413f('0x18')]]=_0x5c5f87['id'];}else{logger[_0x413f('0x19')](_0x413f('0x1a'));}}}return _0x67da92[_0x413f('0x1b')](_0xdb75db[_0x413f('0x13')])[_0x413f('0x1c')](_0x488640);}function getUser(_0x3108e8,_0x3804d2,_0x2bcf56){if(!_[_0x413f('0x1d')](_0x3804d2)&&intUtil[_0x413f('0x1e')](_0x3804d2)){var _0xd96e86={'Email':_0x3804d2};var _0x26ce19={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2bcf56['sobject'](_0x413f('0x1f'))['find'](_0xd96e86,_0x26ce19)['execute']()[_0x413f('0x20')](function(_0x50cb48){if(_0x50cb48[_0x413f('0x21')]){var _0x4a016e=_['find'](_0x50cb48,function(_0x2b2695){return _0x2b2695[_0x413f('0x22')]===_0x3804d2;});if(_0x4a016e){logger['info']('Agent\x20%s\x20found.',_0x3804d2);return BPromise[_0x413f('0x23')]({'id':_0x4a016e['Id'],'name':_0x4a016e[_0x413f('0x24')]});}}else{logger[_0x413f('0x19')](_0x413f('0x25'),_0x3804d2);return _0x2bcf56[_0x413f('0x26')]()[_0x413f('0x20')](function(_0x4b323d){return BPromise[_0x413f('0x23')]({'id':_0x4b323d[_0x413f('0x27')],'name':_0x4b323d[_0x413f('0x28')]});});}});}else{logger[_0x413f('0x19')](_0x413f('0x25'),_0x3804d2);return _0x2bcf56[_0x413f('0x26')]()['then'](function(_0x1c49aa){return BPromise[_0x413f('0x23')]({'id':_0x1c49aa[_0x413f('0x27')],'name':_0x1c49aa[_0x413f('0x28')]});});}}function getEndUser(_0x25404f,_0x5575d1,_0x139bdb,_0x527914,_0x56c765){var _0x143d3a={'$or':{'Phone':_0x527914}};var _0x5031ae={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x413f('0x23')]()[_0x413f('0x20')](function(){logger[_0x413f('0x19')](_0x413f('0x29'),_0x527914,_0x5575d1[_0x413f('0x2a')]);switch(_0x5575d1['moduleSearch']){case _0x413f('0x2b'):var _0x51f0a0=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1[_0x413f('0x2d')]){var _0x53b81f={};_0x53b81f[_0x5575d1[_0x413f('0x2d')]]=_0x527914;_[_0x413f('0x2e')](_0x51f0a0[_0x413f('0x2f')],_0x53b81f);}return _0x56c765[_0x413f('0x1b')](_0x413f('0x30'))[_0x413f('0x31')](_0x51f0a0,_0x5031ae)[_0x413f('0x32')]()[_0x413f('0x20')](function(_0x2a3506){if(_0x2a3506&&_0x2a3506['length']){return _0x2a3506;}else{var _0xa4c64a=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1['additionalSearchLead']){var _0x549c9e={};_0x549c9e[_0x5575d1['additionalSearchLead']]=_0x527914;_['merge'](_0xa4c64a[_0x413f('0x2f')],_0x549c9e);}return _0x56c765['sobject'](_0x413f('0x33'))[_0x413f('0x31')](_0xa4c64a,_0x5031ae);}});case _0x413f('0x34'):var _0x41e43d=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1['additionalSearchAccount']){var _0x53b81f={};_0x53b81f[_0x5575d1[_0x413f('0x35')]]=_0x527914;_[_0x413f('0x2e')](_0x41e43d[_0x413f('0x2f')],_0x53b81f);}return _0x56c765[_0x413f('0x1b')](_0x413f('0x36'))[_0x413f('0x31')](_0x41e43d,_0x5031ae)[_0x413f('0x32')]()[_0x413f('0x20')](function(_0x4995c4){if(_0x4995c4&&_0x4995c4['length']){return _0x4995c4;}else{var _0x462201=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1[_0x413f('0x2d')]){var _0x3615f7={};_0x3615f7[_0x5575d1[_0x413f('0x2d')]]=_0x527914;_[_0x413f('0x2e')](_0x462201['$or'],_0x3615f7);}return _0x56c765[_0x413f('0x1b')](_0x413f('0x30'))['find'](_0x462201,_0x5031ae)[_0x413f('0x20')](function(_0x220800){if(_0x220800&&_0x220800['length']){return _0x220800;}else{var _0x435b89=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1[_0x413f('0x37')]){var _0x488f2f={};_0x488f2f[_0x5575d1[_0x413f('0x37')]]=_0x527914;_[_0x413f('0x2e')](_0x435b89[_0x413f('0x2f')],_0x488f2f);}return _0x56c765[_0x413f('0x1b')](_0x413f('0x33'))[_0x413f('0x31')](_0x435b89,_0x5031ae);}});}});case _0x413f('0x10'):var _0x51f0a0=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1['additionalSearchContact']){var _0x53b81f={};_0x53b81f[_0x5575d1[_0x413f('0x2d')]]=_0x527914;_[_0x413f('0x2e')](_0x51f0a0['$or'],_0x53b81f);}return _0x56c765[_0x413f('0x1b')](_0x413f('0x30'))[_0x413f('0x31')](_0x51f0a0,_0x5031ae)[_0x413f('0x32')]();case _0x413f('0x17'):var _0x263269=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1[_0x413f('0x37')]){var _0x53b81f={};_0x53b81f[_0x5575d1[_0x413f('0x37')]]=_0x527914;_[_0x413f('0x2e')](_0x263269['$or'],_0x53b81f);}return _0x56c765[_0x413f('0x1b')](_0x413f('0x33'))['find'](_0x263269,_0x5031ae);case _0x413f('0x12'):var _0x41e43d=_[_0x413f('0x2c')](_0x143d3a);if(_0x5575d1[_0x413f('0x35')]){var _0x53b81f={};_0x53b81f[_0x5575d1[_0x413f('0x35')]]=_0x527914;_[_0x413f('0x2e')](_0x41e43d['$or'],_0x53b81f);}return _0x56c765['sobject'](_0x413f('0x36'))['find'](_0x41e43d,_0x5031ae);default:return null;}})[_0x413f('0x20')](function(_0x46251a){if(_0x46251a&&_0x46251a[_0x413f('0x21')]){var _0x3c5c74=_[_0x413f('0x38')](_0x46251a);if(_0x3c5c74){return BPromise[_0x413f('0x23')]({'id':_0x3c5c74['Id'],'name':_0x3c5c74[_0x413f('0x24')],'phone':_0x3c5c74[_0x413f('0x39')],'endUserType':_0x3c5c74[_0x413f('0x3a')][_0x413f('0x3b')][_0x413f('0x3c')]()});}}})['then'](function(_0x23f978){if(_0x23f978){logger['info'](_0x413f('0x3d'),_0x23f978[_0x413f('0xf')],_0x527914);return BPromise[_0x413f('0x23')](_0x23f978);}else{logger[_0x413f('0x19')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x527914);var _0x3c1ab8={'Phone':_0x527914};if(_0x5575d1[_0x413f('0x3e')]){if(_0x5575d1['moduleCreate']===_0x413f('0x10')){logger[_0x413f('0x19')](_0x413f('0x3f'),_0x527914,_0x5575d1[_0x413f('0x3e')]);_0x3c1ab8[_0x413f('0x40')]=_0x139bdb!==_0x413f('0x41')?_0x139bdb:util[_0x413f('0x42')](_0x413f('0x43'),_0x527914);}else if(_0x5575d1['moduleCreate']==='lead'){logger[_0x413f('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x527914,_0x5575d1[_0x413f('0x3e')]);_0x3c1ab8[_0x413f('0x40')]=_0x139bdb!==_0x413f('0x41')?_0x139bdb:util[_0x413f('0x42')](_0x413f('0x43'),_0x527914);_0x3c1ab8[_0x413f('0x44')]=_0x413f('0x45');}else if(_0x5575d1['moduleCreate']===_0x413f('0x12')){logger[_0x413f('0x19')](_0x413f('0x3f'),_0x527914,_0x5575d1['moduleCreate']);_0x3c1ab8[_0x413f('0x24')]=_0x139bdb!=='<unknown>'?_0x139bdb:util[_0x413f('0x42')](_0x413f('0x43'),_0x527914);}else{return null;}}return _0x56c765[_0x413f('0x1b')](_['upperFirst'](_0x5575d1[_0x413f('0x3e')]))[_0x413f('0x1c')](_0x3c1ab8)[_0x413f('0x20')](function(_0x1a6a3f){return BPromise['resolve']({'id':_0x1a6a3f['id'],'endUserType':_0x5575d1['moduleCreate']});});}});}function getCustomFields(_0x697e59,_0x43b2bc){var _0x4901fe={};if(_0x697e59[_0x413f('0x21')]>0x0){_[_0x413f('0x46')](_0x697e59,function(_0x375378){if(_['includes']([_0x413f('0x47'),_0x413f('0x48')],_0x375378[_0x413f('0x3b')])&&_0x375378[_0x413f('0x49')]){_0x4901fe[_0x375378[_0x413f('0x49')]]=_0x375378[_0x413f('0x4a')][_0x413f('0x4b')]();}else if(_0x375378[_0x413f('0x3b')]===_0x413f('0x4c')&&_0x375378[_0x413f('0x4d')]&&_0x375378[_0x413f('0x49')]){_0x43b2bc[_0x375378['variableName']]&&(_0x4901fe[_0x375378[_0x413f('0x49')]]=_0x43b2bc[_0x375378[_0x413f('0x4d')]][_0x413f('0x4b')]());}else if(_0x375378['type']===_0x413f('0x4e')&&_0x375378[_0x413f('0x4f')]&&_0x375378[_0x413f('0x4f')][_0x413f('0x50')]&&_0x375378['idField']){_0x43b2bc[_0x375378[_0x413f('0x4f')]['name'][_0x413f('0x3c')]()]&&(_0x4901fe[_0x375378[_0x413f('0x49')]]=_0x43b2bc[_0x375378['Variable'][_0x413f('0x50')]['toLowerCase']()][_0x413f('0x4b')]());}});}return _0x4901fe;}function getConnection(_0xd8eefa){var _0x30590a=_0xd8eefa[_0x413f('0x51')]['concat'](_0xd8eefa[_0x413f('0x52')]);var _0x5a29f9=new jsforce[(_0x413f('0x53'))]({'oauth2':{'loginUrl':_0xd8eefa[_0x413f('0x54')]||_0x413f('0x55'),'clientId':_0xd8eefa[_0x413f('0x56')],'clientSecret':_0xd8eefa[_0x413f('0x57')]}});return _0x5a29f9[_0x413f('0x58')](_0xd8eefa['username'],_0x30590a)[_0x413f('0x20')](function(){logger[_0x413f('0x19')](_0x413f('0x59'));return _0x5a29f9;});}exports[_0x413f('0x5a')]=function(_0x1c74fd,_0x416514,_0x2c0f79,_0x2051c7,_0x1d21c1,_0x27d9cb){var _0x3fd9a7,_0x1c4dcd,_0xaf7d3d,_0x28186d;_0x27d9cb[_0x413f('0x5b')]=intUtil[_0x413f('0x5c')](_0x27d9cb[_0x413f('0x5b')]);_0x27d9cb[_0x413f('0x54')]=intUtil[_0x413f('0x5c')](_0x27d9cb['remoteUri']);if(_0x1d21c1&&_0x1d21c1['monitor_format']){logger[_0x413f('0x19')]('[QUEUE]',_0x413f('0x5d'));_0x416514[_0x413f('0x5e')]=util['format'](_0x413f('0x5f'),_0x27d9cb[_0x413f('0x5b')],_0x416514[_0x413f('0x60')],md5(_0x416514[_0x413f('0x60')]));}else{_0x416514[_0x413f('0x5e')]='';}return getConnection(_0x27d9cb)[_0x413f('0x20')](function(_0x1bc73f){_0x28186d=_0x1bc73f;return getUser(_0x27d9cb,_0x2051c7[_0x413f('0x61')],_0x28186d);})[_0x413f('0x20')](function(_0x163ba9){_0x3fd9a7=_0x163ba9;return getEndUser(_0x27d9cb,_0x2c0f79,_0x416514[_0x413f('0x62')],_0x416514[_0x413f('0x63')],_0x28186d);})[_0x413f('0x20')](function(_0x31cf49){_0x1c4dcd=_0x31cf49;return getTicket(_0x27d9cb,_0x3fd9a7,_0x1c4dcd,_0x2c0f79,_0x416514,_0x2c0f79[_0x413f('0x64')],_0x28186d,'queue');})['then'](function(_0x165f4d){_0xaf7d3d=_0x165f4d;logger[_0x413f('0x19')](_0x413f('0x65'),_0xaf7d3d['id']);logger[_0x413f('0x19')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xaf7d3d['id'],_0x2051c7[_0x413f('0x50')],_0x27d9cb[_0x413f('0x3b')]);switch(_0x27d9cb[_0x413f('0x3b')]){case'integrationTab':emit(util[_0x413f('0x42')](_0x413f('0x66'),_0x2051c7[_0x413f('0x50')]),_0x413f('0x67'),{'recordId':_0xaf7d3d['id']});break;case _0x413f('0x68'):emit(util[_0x413f('0x42')](_0x413f('0x66'),_0x2051c7[_0x413f('0x50')]),_0x413f('0x69'),{'uri':util['format'](_0x413f('0x6a'),_0x28186d[_0x413f('0x6b')],_0xaf7d3d['id'])});break;default:logger['error'](_0x413f('0x6c'));}})['catch'](function(_0x14e8bd){logger[_0x413f('0x6d')](_0x413f('0x6e'),_0x14e8bd);});};exports[_0x413f('0x6f')]=function(_0x2d0778,_0x155430,_0x519878,_0x153b0c,_0xf7b076,_0x37cb3f,_0x2bb5dd){var _0x5b93ba,_0x9fbe60,_0x4fd164,_0x7c349a;_0x37cb3f[_0x413f('0x5b')]=intUtil['stripTrailingSlash'](_0x37cb3f['serverUrl']);_0x37cb3f['remoteUri']=intUtil['stripTrailingSlash'](_0x37cb3f[_0x413f('0x54')]);if(_0x2bb5dd&&_0x2bb5dd[_0x413f('0x70')]&&_0x2bb5dd[_0x413f('0x70')]!==_0x413f('0x71')){logger[_0x413f('0x19')](_0x413f('0x72'),_0x413f('0x5d'));_0x155430[_0x413f('0x5e')]=util[_0x413f('0x42')](_0x413f('0x5f'),_0x37cb3f[_0x413f('0x5b')],_0x155430[_0x413f('0x60')],md5(_0x155430[_0x413f('0x60')]));}return getConnection(_0x37cb3f)[_0x413f('0x20')](function(_0x42ee4f){_0x7c349a=_0x42ee4f;return getUser(_0x37cb3f,_0x153b0c[_0x413f('0x61')],_0x7c349a);})[_0x413f('0x20')](function(_0x5ed2c5){_0x5b93ba=_0x5ed2c5;return getEndUser(_0x37cb3f,_0x519878,_0x155430['destcalleridname'],_0x155430[_0x413f('0x73')],_0x7c349a);})[_0x413f('0x20')](function(_0x31b42c){_0x9fbe60=_0x31b42c;return getTicket(_0x37cb3f,_0x5b93ba,_0x9fbe60,_0x519878,_0x155430,_0x519878[_0x413f('0x64')],_0x7c349a,_0x413f('0x6f'));})['then'](function(_0x215177){_0x4fd164=_0x215177;logger[_0x413f('0x19')](_0x413f('0x74'),_0x4fd164['id']);logger[_0x413f('0x19')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4fd164['id'],_0x153b0c[_0x413f('0x50')],_0x37cb3f[_0x413f('0x3b')]);switch(_0x37cb3f[_0x413f('0x3b')]){case _0x413f('0x75'):emit(util[_0x413f('0x42')](_0x413f('0x66'),_0x153b0c[_0x413f('0x50')]),_0x413f('0x67'),{'recordId':_0x4fd164['id']});break;case _0x413f('0x68'):emit(util[_0x413f('0x42')]('user:%s',_0x153b0c['name']),'trigger:browser:url',{'uri':util[_0x413f('0x42')](_0x413f('0x6a'),_0x7c349a['instanceUrl'],_0x4fd164['id'])});break;default:logger[_0x413f('0x6d')](_0x413f('0x72'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x1869c3){logger[_0x413f('0x6d')](_0x413f('0x72'),_0x1869c3);});};exports[_0x413f('0x76')]=function(_0x2d11b1,_0x1f33fa,_0x465912,_0x2a81e9,_0x3a5417,_0x5d0ea4){var _0x3e0e52,_0x516242,_0xf8f17a,_0x36e999;_0x5d0ea4[_0x413f('0x5b')]=intUtil['stripTrailingSlash'](_0x5d0ea4['serverUrl']);_0x5d0ea4[_0x413f('0x54')]=intUtil[_0x413f('0x5c')](_0x5d0ea4[_0x413f('0x54')]);if(_0x3a5417&&_0x3a5417['monitor_format']){logger[_0x413f('0x19')]('['+_0x1f33fa[_0x413f('0x77')][_0x413f('0x78')]()+']',_0x413f('0x5d'));_0x1f33fa[_0x413f('0x5e')]=util[_0x413f('0x42')](_0x413f('0x5f'),_0x5d0ea4[_0x413f('0x5b')],_0x1f33fa[_0x413f('0x60')],md5(_0x1f33fa[_0x413f('0x60')]));}else{_0x1f33fa[_0x413f('0x5e')]='';}return getConnection(_0x5d0ea4)[_0x413f('0x20')](function(_0xe3c0e9){_0x36e999=_0xe3c0e9;if(!_[_0x413f('0x1d')](_0x2a81e9)){return getUser(_0x5d0ea4,_0x2a81e9[_0x413f('0x50')],_0x36e999);}else{return getUser(_0x5d0ea4,null,_0x36e999);}})[_0x413f('0x20')](function(_0x597ae7){_0x3e0e52=_0x597ae7;return getEndUser(_0x5d0ea4,_0x465912,_0x1f33fa['calleridname'],_0x1f33fa[_0x413f('0x63')],_0x36e999);})[_0x413f('0x20')](function(_0x4ed129){_0x516242=_0x4ed129;return getTicket(_0x5d0ea4,_0x3e0e52,_0x516242,_0x465912,_0x1f33fa,_0x465912[_0x413f('0x64')],_0x36e999);})[_0x413f('0x20')](function(_0x2fa536){_0xf8f17a=_0x2fa536;logger[_0x413f('0x19')]('['+_0x1f33fa['lastevent']['toUpperCase']()+_0x413f('0x79'),_0xf8f17a['id']);logger[_0x413f('0x19')]('['+_0x1f33fa[_0x413f('0x77')]['toUpperCase']()+_0x413f('0x7a'),_0x5d0ea4['type']);})[_0x413f('0x7b')](function(_0x4dedd1){logger[_0x413f('0x6d')]('['+_0x1f33fa[_0x413f('0x77')][_0x413f('0x78')]()+']',_0x4dedd1);});};
\ No newline at end of file
+var _0x80aa=['user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Contact','contact','first','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','<unknown>','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','string','picklist','idField','toString','variable','variableName','Variable','name','toLowerCase','Connection','remoteUri','https://login.salesforce.com','clientId','username','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','lead','endUserType','WhatId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve'];(function(_0x1ec9d1,_0x35ecaf){var _0x4b6bc2=function(_0x2695c6){while(--_0x2695c6){_0x1ec9d1['push'](_0x1ec9d1['shift']());}};_0x4b6bc2(++_0x35ecaf);}(_0x80aa,0x1cc));var _0xa80a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa80a('0x0'));var rp=require(_0xa80a('0x1'));var moment=require('moment');var BPromise=require(_0xa80a('0x2'));var md5=require(_0xa80a('0x3'));var jsforce=require(_0xa80a('0x4'));var util=require(_0xa80a('0x5'));var Redis=require(_0xa80a('0x6'));var intUtil=require(_0xa80a('0x7'));var config=require(_0xa80a('0x8'));var logger=require(_0xa80a('0x9'))(_0xa80a('0xa'));config[_0xa80a('0xb')]=_['defaults'](config[_0xa80a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xa80a('0xc'))(new Redis(config[_0xa80a('0xb')]));function emit(_0x402ee4,_0xad511d,_0x6e49af){io['to'](_0x402ee4)[_0xa80a('0xd')](_0xad511d,_0x6e49af);}function getTicket(_0x5c9636,_0x1301d1,_0x490f0f,_0x53661c,_0xd9991c,_0x464c5e,_0x4357af,_0x2da8b9){var _0xc67cb4=Object[_0xa80a('0xe')]({},{'OwnerId':_0x1301d1['id'],'Subject':intUtil['getString'](_0x53661c[_0xa80a('0xf')],_0xd9991c,'\x20'),'Description':intUtil[_0xa80a('0x10')](_0x53661c[_0xa80a('0x11')],_0xd9991c,'\x0a')},getCustomFields(_0x464c5e,_0xd9991c));if(_0x490f0f){if(_0x53661c[_0xa80a('0x12')]===_0xa80a('0x13')){_0xc67cb4['ActivityDate']=moment[_0xa80a('0x14')]();_0xc67cb4[_0xa80a('0x15')]=![];_0xc67cb4[_0xa80a('0x16')]=![];if(_0x490f0f['endUserType']==='contact'||_0x490f0f['endUserType']===_0xa80a('0x17')){_0xc67cb4['WhoId']=_0x490f0f['id'];}else if(_0x490f0f[_0xa80a('0x18')]==='account'){_0xc67cb4[_0xa80a('0x19')]=_0x490f0f['id'];}}else if(_0x53661c[_0xa80a('0x12')]===_0xa80a('0x1a')){if(_0x490f0f[_0xa80a('0x18')]==='contact'){_0xc67cb4[_0xa80a('0x1b')]=_0x490f0f['id'];}else if(_0x490f0f['endUserType']===_0xa80a('0x1c')){_0xc67cb4[_0xa80a('0x1d')]=_0x490f0f['id'];}else if(_0x490f0f['endUserType']==='lead'&&_0x53661c[_0xa80a('0x1e')]){_0xc67cb4[_0x53661c[_0xa80a('0x1e')]]=_0x490f0f['id'];}else{logger[_0xa80a('0x1f')](_0xa80a('0x20'));}}}return _0x4357af[_0xa80a('0x21')](_0x53661c['ticketType'])[_0xa80a('0x22')](_0xc67cb4);}function getUser(_0x504ab8,_0x591037,_0xac59fc){if(!_[_0xa80a('0x23')](_0x591037)&&intUtil[_0xa80a('0x24')](_0x591037)){var _0xb7bc23={'Email':_0x591037};var _0x2413c7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xac59fc[_0xa80a('0x21')](_0xa80a('0x25'))[_0xa80a('0x26')](_0xb7bc23,_0x2413c7)[_0xa80a('0x27')]()[_0xa80a('0x28')](function(_0x3d6030){if(_0x3d6030[_0xa80a('0x29')]){var _0x1d69b5=_['find'](_0x3d6030,function(_0x31a72b){return _0x31a72b[_0xa80a('0x2a')]===_0x591037;});if(_0x1d69b5){logger[_0xa80a('0x1f')](_0xa80a('0x2b'),_0x591037);return BPromise['resolve']({'id':_0x1d69b5['Id'],'name':_0x1d69b5[_0xa80a('0x2c')]});}}else{logger[_0xa80a('0x1f')](_0xa80a('0x2d'),_0x591037);return _0xac59fc[_0xa80a('0x2e')]()[_0xa80a('0x28')](function(_0x2b8eec){return BPromise[_0xa80a('0x2f')]({'id':_0x2b8eec[_0xa80a('0x30')],'name':_0x2b8eec['display_name']});});}});}else{logger[_0xa80a('0x1f')](_0xa80a('0x2d'),_0x591037);return _0xac59fc[_0xa80a('0x2e')]()[_0xa80a('0x28')](function(_0x2348a5){return BPromise['resolve']({'id':_0x2348a5[_0xa80a('0x30')],'name':_0x2348a5[_0xa80a('0x31')]});});}}function getEndUser(_0x172a21,_0x1c077b,_0x25fc85,_0x3e38f2,_0x58e16c){var _0x394d1f={'$or':{'Phone':_0x3e38f2}};var _0x5ef7a6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0xa80a('0x1f')](_0xa80a('0x32'),_0x3e38f2,_0x1c077b[_0xa80a('0x33')]);switch(_0x1c077b['moduleSearch']){case _0xa80a('0x34'):var _0x4ab6dc=_[_0xa80a('0x35')](_0x394d1f);if(_0x1c077b['additionalSearchContact']){var _0xb22443={};_0xb22443[_0x1c077b[_0xa80a('0x36')]]=_0x3e38f2;_[_0xa80a('0x37')](_0x4ab6dc[_0xa80a('0x38')],_0xb22443);}return _0x58e16c[_0xa80a('0x21')]('Contact')[_0xa80a('0x26')](_0x4ab6dc,_0x5ef7a6)['execute']()[_0xa80a('0x28')](function(_0x1a529e){if(_0x1a529e&&_0x1a529e[_0xa80a('0x29')]){return _0x1a529e;}else{var _0x57cada=_[_0xa80a('0x35')](_0x394d1f);if(_0x1c077b[_0xa80a('0x39')]){var _0x4502ce={};_0x4502ce[_0x1c077b[_0xa80a('0x39')]]=_0x3e38f2;_[_0xa80a('0x37')](_0x57cada['$or'],_0x4502ce);}return _0x58e16c[_0xa80a('0x21')]('Lead')['find'](_0x57cada,_0x5ef7a6);}});case _0xa80a('0x3a'):var _0x57360a=_['cloneDeep'](_0x394d1f);if(_0x1c077b['additionalSearchAccount']){var _0xb22443={};_0xb22443[_0x1c077b[_0xa80a('0x3b')]]=_0x3e38f2;_[_0xa80a('0x37')](_0x57360a['$or'],_0xb22443);}return _0x58e16c[_0xa80a('0x21')](_0xa80a('0x3c'))[_0xa80a('0x26')](_0x57360a,_0x5ef7a6)['execute']()[_0xa80a('0x28')](function(_0x2f9622){if(_0x2f9622&&_0x2f9622[_0xa80a('0x29')]){return _0x2f9622;}else{var _0xc58649=_[_0xa80a('0x35')](_0x394d1f);if(_0x1c077b[_0xa80a('0x36')]){var _0xcb8ebf={};_0xcb8ebf[_0x1c077b[_0xa80a('0x36')]]=_0x3e38f2;_[_0xa80a('0x37')](_0xc58649[_0xa80a('0x38')],_0xcb8ebf);}return _0x58e16c['sobject'](_0xa80a('0x3d'))[_0xa80a('0x26')](_0xc58649,_0x5ef7a6)[_0xa80a('0x28')](function(_0xa891ee){if(_0xa891ee&&_0xa891ee['length']){return _0xa891ee;}else{var _0x4436d7=_[_0xa80a('0x35')](_0x394d1f);if(_0x1c077b[_0xa80a('0x39')]){var _0x392cc9={};_0x392cc9[_0x1c077b[_0xa80a('0x39')]]=_0x3e38f2;_[_0xa80a('0x37')](_0x4436d7[_0xa80a('0x38')],_0x392cc9);}return _0x58e16c['sobject']('Lead')[_0xa80a('0x26')](_0x4436d7,_0x5ef7a6);}});}});case _0xa80a('0x3e'):var _0x4ab6dc=_['cloneDeep'](_0x394d1f);if(_0x1c077b['additionalSearchContact']){var _0xb22443={};_0xb22443[_0x1c077b[_0xa80a('0x36')]]=_0x3e38f2;_[_0xa80a('0x37')](_0x4ab6dc[_0xa80a('0x38')],_0xb22443);}return _0x58e16c['sobject'](_0xa80a('0x3d'))[_0xa80a('0x26')](_0x4ab6dc,_0x5ef7a6)[_0xa80a('0x27')]();case _0xa80a('0x17'):var _0xb88ab4=_['cloneDeep'](_0x394d1f);if(_0x1c077b[_0xa80a('0x39')]){var _0xb22443={};_0xb22443[_0x1c077b[_0xa80a('0x39')]]=_0x3e38f2;_[_0xa80a('0x37')](_0xb88ab4['$or'],_0xb22443);}return _0x58e16c[_0xa80a('0x21')]('Lead')[_0xa80a('0x26')](_0xb88ab4,_0x5ef7a6);case _0xa80a('0x1c'):var _0x57360a=_[_0xa80a('0x35')](_0x394d1f);if(_0x1c077b[_0xa80a('0x3b')]){var _0xb22443={};_0xb22443[_0x1c077b[_0xa80a('0x3b')]]=_0x3e38f2;_['merge'](_0x57360a[_0xa80a('0x38')],_0xb22443);}return _0x58e16c[_0xa80a('0x21')](_0xa80a('0x3c'))['find'](_0x57360a,_0x5ef7a6);default:return null;}})['then'](function(_0x148207){if(_0x148207&&_0x148207['length']){var _0x58b3bf=_[_0xa80a('0x3f')](_0x148207);if(_0x58b3bf){return BPromise[_0xa80a('0x2f')]({'id':_0x58b3bf['Id'],'name':_0x58b3bf[_0xa80a('0x2c')],'phone':_0x58b3bf['Phone'],'endUserType':_0x58b3bf['attributes'][_0xa80a('0x40')]['toLowerCase']()});}}})[_0xa80a('0x28')](function(_0x40e72b){if(_0x40e72b){logger['info'](_0xa80a('0x41'),_0x40e72b[_0xa80a('0x18')],_0x3e38f2);return BPromise[_0xa80a('0x2f')](_0x40e72b);}else{logger['info'](_0xa80a('0x42'),_0x3e38f2);var _0x24ea8c={'Phone':_0x3e38f2};if(_0x1c077b['moduleCreate']){if(_0x1c077b[_0xa80a('0x43')]===_0xa80a('0x3e')){logger[_0xa80a('0x1f')](_0xa80a('0x44'),_0x3e38f2,_0x1c077b[_0xa80a('0x43')]);_0x24ea8c['LastName']=_0x25fc85!==_0xa80a('0x45')?_0x25fc85:util[_0xa80a('0x46')]('Caller\x20-\x20%s',_0x3e38f2);}else if(_0x1c077b[_0xa80a('0x43')]===_0xa80a('0x17')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3e38f2,_0x1c077b[_0xa80a('0x43')]);_0x24ea8c[_0xa80a('0x47')]=_0x25fc85!==_0xa80a('0x45')?_0x25fc85:util[_0xa80a('0x46')](_0xa80a('0x48'),_0x3e38f2);_0x24ea8c[_0xa80a('0x49')]=_0xa80a('0x4a');}else if(_0x1c077b[_0xa80a('0x43')]===_0xa80a('0x1c')){logger[_0xa80a('0x1f')](_0xa80a('0x44'),_0x3e38f2,_0x1c077b[_0xa80a('0x43')]);_0x24ea8c[_0xa80a('0x2c')]=_0x25fc85!=='<unknown>'?_0x25fc85:util[_0xa80a('0x46')](_0xa80a('0x48'),_0x3e38f2);}else{return null;}}return _0x58e16c[_0xa80a('0x21')](_['upperFirst'](_0x1c077b[_0xa80a('0x43')]))['create'](_0x24ea8c)['then'](function(_0xbae55){return BPromise[_0xa80a('0x2f')]({'id':_0xbae55['id'],'endUserType':_0x1c077b['moduleCreate']});});}});}function getCustomFields(_0x5be3a0,_0x2590a6){var _0x4f3c01={};if(_0x5be3a0[_0xa80a('0x29')]>0x0){_[_0xa80a('0x4b')](_0x5be3a0,function(_0x3d5f6b){if(_[_0xa80a('0x4c')]([_0xa80a('0x4d'),_0xa80a('0x4e')],_0x3d5f6b[_0xa80a('0x40')])&&_0x3d5f6b['idField']){_0x4f3c01[_0x3d5f6b[_0xa80a('0x4f')]]=_0x3d5f6b['content'][_0xa80a('0x50')]();}else if(_0x3d5f6b['type']===_0xa80a('0x51')&&_0x3d5f6b[_0xa80a('0x52')]&&_0x3d5f6b['idField']){_0x2590a6[_0x3d5f6b['variableName']]&&(_0x4f3c01[_0x3d5f6b['idField']]=_0x2590a6[_0x3d5f6b[_0xa80a('0x52')]][_0xa80a('0x50')]());}else if(_0x3d5f6b[_0xa80a('0x40')]==='customVariable'&&_0x3d5f6b[_0xa80a('0x53')]&&_0x3d5f6b[_0xa80a('0x53')][_0xa80a('0x54')]&&_0x3d5f6b[_0xa80a('0x4f')]){_0x2590a6[_0x3d5f6b[_0xa80a('0x53')]['name'][_0xa80a('0x55')]()]&&(_0x4f3c01[_0x3d5f6b[_0xa80a('0x4f')]]=_0x2590a6[_0x3d5f6b[_0xa80a('0x53')][_0xa80a('0x54')][_0xa80a('0x55')]()][_0xa80a('0x50')]());}});}return _0x4f3c01;}function getConnection(_0x1a43b5){var _0x3871a0=_0x1a43b5['password']['concat'](_0x1a43b5['securityToken']);var _0x5391cd=new jsforce[(_0xa80a('0x56'))]({'oauth2':{'loginUrl':_0x1a43b5[_0xa80a('0x57')]||_0xa80a('0x58'),'clientId':_0x1a43b5[_0xa80a('0x59')],'clientSecret':_0x1a43b5['clientSecret']}});return _0x5391cd['login'](_0x1a43b5[_0xa80a('0x5a')],_0x3871a0)[_0xa80a('0x28')](function(){logger[_0xa80a('0x1f')]('Connection\x20established.');return _0x5391cd;});}exports[_0xa80a('0x5b')]=function(_0x361cb3,_0x226ed7,_0x4f61a7,_0x46bb15,_0x49ad94,_0xbd435e){var _0x25526b,_0x2d4f8c,_0x2d2b6e,_0x3a79d7;_0xbd435e[_0xa80a('0x5c')]=intUtil[_0xa80a('0x5d')](_0xbd435e[_0xa80a('0x5c')]);_0xbd435e['remoteUri']=intUtil[_0xa80a('0x5d')](_0xbd435e[_0xa80a('0x57')]);if(_0x49ad94&&_0x49ad94['monitor_format']){logger[_0xa80a('0x1f')](_0xa80a('0x5e'),_0xa80a('0x5f'));_0x226ed7[_0xa80a('0x60')]=util['format'](_0xa80a('0x61'),_0xbd435e[_0xa80a('0x5c')],_0x226ed7[_0xa80a('0x62')],md5(_0x226ed7[_0xa80a('0x62')]));}else{_0x226ed7['recordingURL']='';}return getConnection(_0xbd435e)[_0xa80a('0x28')](function(_0x18b533){_0x3a79d7=_0x18b533;return getUser(_0xbd435e,_0x46bb15['email'],_0x3a79d7);})[_0xa80a('0x28')](function(_0x50fda3){_0x25526b=_0x50fda3;return getEndUser(_0xbd435e,_0x4f61a7,_0x226ed7[_0xa80a('0x63')],_0x226ed7[_0xa80a('0x64')],_0x3a79d7);})[_0xa80a('0x28')](function(_0x3de30d){_0x2d4f8c=_0x3de30d;return getTicket(_0xbd435e,_0x25526b,_0x2d4f8c,_0x4f61a7,_0x226ed7,_0x4f61a7['Fields'],_0x3a79d7,_0xa80a('0x5b'));})[_0xa80a('0x28')](function(_0x1212eb){_0x2d2b6e=_0x1212eb;logger[_0xa80a('0x1f')](_0xa80a('0x65'),_0x2d2b6e['id']);logger[_0xa80a('0x1f')](_0xa80a('0x66'),_0x2d2b6e['id'],_0x46bb15['name'],_0xbd435e['type']);switch(_0xbd435e[_0xa80a('0x40')]){case _0xa80a('0x67'):emit(util[_0xa80a('0x46')](_0xa80a('0x68'),_0x46bb15[_0xa80a('0x54')]),_0xa80a('0x69'),{'recordId':_0x2d2b6e['id']});break;case _0xa80a('0x6a'):emit(util[_0xa80a('0x46')](_0xa80a('0x68'),_0x46bb15[_0xa80a('0x54')]),_0xa80a('0x6b'),{'uri':util[_0xa80a('0x46')](_0xa80a('0x6c'),_0x3a79d7[_0xa80a('0x6d')],_0x2d2b6e['id'])});break;default:logger['error'](_0xa80a('0x6e'));}})[_0xa80a('0x6f')](function(_0x2a1095){logger['error'](_0xa80a('0x5e'),_0x2a1095);});};exports[_0xa80a('0x70')]=function(_0x112d7f,_0x12b911,_0x5f263c,_0x1dcf8e,_0xfb3025,_0x3f0227,_0x22d655){var _0x3b1081,_0x2b4f7d,_0x13f489,_0x1d08ba;_0x3f0227[_0xa80a('0x5c')]=intUtil[_0xa80a('0x5d')](_0x3f0227['serverUrl']);_0x3f0227[_0xa80a('0x57')]=intUtil[_0xa80a('0x5d')](_0x3f0227[_0xa80a('0x57')]);if(_0x22d655&&_0x22d655[_0xa80a('0x71')]&&_0x22d655[_0xa80a('0x71')]!==_0xa80a('0x72')){logger['info']('[OUTBOUND]',_0xa80a('0x5f'));_0x12b911[_0xa80a('0x60')]=util[_0xa80a('0x46')](_0xa80a('0x61'),_0x3f0227[_0xa80a('0x5c')],_0x12b911[_0xa80a('0x62')],md5(_0x12b911[_0xa80a('0x62')]));}return getConnection(_0x3f0227)[_0xa80a('0x28')](function(_0x425ef4){_0x1d08ba=_0x425ef4;return getUser(_0x3f0227,_0x1dcf8e[_0xa80a('0x73')],_0x1d08ba);})[_0xa80a('0x28')](function(_0xa9bdf3){_0x3b1081=_0xa9bdf3;return getEndUser(_0x3f0227,_0x5f263c,_0x12b911[_0xa80a('0x74')],_0x12b911[_0xa80a('0x75')],_0x1d08ba);})['then'](function(_0x2d5d66){_0x2b4f7d=_0x2d5d66;return getTicket(_0x3f0227,_0x3b1081,_0x2b4f7d,_0x5f263c,_0x12b911,_0x5f263c[_0xa80a('0x76')],_0x1d08ba,_0xa80a('0x70'));})[_0xa80a('0x28')](function(_0x4205c9){_0x13f489=_0x4205c9;logger['info'](_0xa80a('0x77'),_0x13f489['id']);logger[_0xa80a('0x1f')](_0xa80a('0x78'),_0x13f489['id'],_0x1dcf8e[_0xa80a('0x54')],_0x3f0227['type']);switch(_0x3f0227['type']){case'integrationTab':emit(util[_0xa80a('0x46')](_0xa80a('0x68'),_0x1dcf8e[_0xa80a('0x54')]),_0xa80a('0x69'),{'recordId':_0x13f489['id']});break;case _0xa80a('0x6a'):emit(util[_0xa80a('0x46')](_0xa80a('0x68'),_0x1dcf8e[_0xa80a('0x54')]),_0xa80a('0x6b'),{'uri':util[_0xa80a('0x46')](_0xa80a('0x6c'),_0x1d08ba[_0xa80a('0x6d')],_0x13f489['id'])});break;default:logger[_0xa80a('0x79')](_0xa80a('0x7a'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x4b7246){logger['error'](_0xa80a('0x7a'),_0x4b7246);});};exports[_0xa80a('0x7b')]=function(_0x46e6b7,_0x1dab07,_0x41d4b7,_0x17e647,_0x1c9e41,_0x1eeaef){var _0x558ed6,_0x2da9e8,_0x42095b,_0x1bc298;_0x1eeaef[_0xa80a('0x5c')]=intUtil['stripTrailingSlash'](_0x1eeaef[_0xa80a('0x5c')]);_0x1eeaef[_0xa80a('0x57')]=intUtil[_0xa80a('0x5d')](_0x1eeaef['remoteUri']);if(_0x1c9e41&&_0x1c9e41['monitor_format']){logger['info']('['+_0x1dab07[_0xa80a('0x7c')][_0xa80a('0x7d')]()+']',_0xa80a('0x5f'));_0x1dab07[_0xa80a('0x60')]=util[_0xa80a('0x46')](_0xa80a('0x61'),_0x1eeaef[_0xa80a('0x5c')],_0x1dab07['uniqueid'],md5(_0x1dab07[_0xa80a('0x62')]));}else{_0x1dab07[_0xa80a('0x60')]='';}return getConnection(_0x1eeaef)['then'](function(_0x1393e0){_0x1bc298=_0x1393e0;if(!_[_0xa80a('0x23')](_0x17e647)){return getUser(_0x1eeaef,_0x17e647[_0xa80a('0x54')],_0x1bc298);}else{return getUser(_0x1eeaef,null,_0x1bc298);}})[_0xa80a('0x28')](function(_0x18ea56){_0x558ed6=_0x18ea56;return getEndUser(_0x1eeaef,_0x41d4b7,_0x1dab07[_0xa80a('0x63')],_0x1dab07[_0xa80a('0x64')],_0x1bc298);})[_0xa80a('0x28')](function(_0x21bcc0){_0x2da9e8=_0x21bcc0;return getTicket(_0x1eeaef,_0x558ed6,_0x2da9e8,_0x41d4b7,_0x1dab07,_0x41d4b7[_0xa80a('0x76')],_0x1bc298);})['then'](function(_0x5770af){_0x42095b=_0x5770af;logger['info']('['+_0x1dab07[_0xa80a('0x7c')][_0xa80a('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x42095b['id']);logger['info']('['+_0x1dab07[_0xa80a('0x7c')][_0xa80a('0x7d')]()+_0xa80a('0x7e'),_0x1eeaef['type']);})['catch'](function(_0x4e2dff){logger['error']('['+_0x1dab07[_0xa80a('0x7c')][_0xa80a('0x7d')]()+']',_0x4e2dff);});};
\ No newline at end of file
index efee3a3..4646ef6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x35cc=['includes','picklist','type','nameField','customField','content','string','idField','toLowerCase','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','Incident','ticketId','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','sys_id','info','toUpperCase','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','catch','forEach'];(function(_0x4e387a,_0x241c2f){var _0x6df7e4=function(_0x3b7d4c){while(--_0x3b7d4c){_0x4e387a['push'](_0x4e387a['shift']());}};_0x6df7e4(++_0x241c2f);}(_0x35cc,0x1e6));var _0xc35c=function(_0x406e00,_0x13278f){_0x406e00=_0x406e00-0x0;var _0x263fc7=_0x35cc[_0x406e00];return _0x263fc7;};'use strict';var _=require(_0xc35c('0x0'));var Promise=require(_0xc35c('0x1'));var rp=require(_0xc35c('0x2'));var util=require(_0xc35c('0x3'));var md5=require('md5');var Redis=require(_0xc35c('0x4'));var intUtil=require(_0xc35c('0x5'));var config=require(_0xc35c('0x6'));var logger=require(_0xc35c('0x7'))(_0xc35c('0x8'));config['redis']=_[_0xc35c('0x9')](config['redis'],{'host':_0xc35c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc35c('0xb')]));function getAdminUser(_0x55ceaa,_0x3af666,_0x1bf169,_0x200dfb,_0xe82bcb,_0x20adc0){return new Promise(function(_0xea0404,_0x5653ba){var _0x50747b={'method':_0xc35c('0xc'),'uri':_0x200dfb+_0xc35c('0xd')+'&'+_0xe82bcb+'&'+_0x20adc0,'auth':_0x3af666,'json':!![]};return rp(_0x50747b)[_0xc35c('0xe')](function(_0x52fc40){if(_0x52fc40['result'][_0xc35c('0xf')]>0x0){_0x1bf169[_0xc35c('0x10')]=_0x52fc40['result'][0x0][_0xc35c('0x11')];}logger[_0xc35c('0x12')]('['+[_0x55ceaa[_0xc35c('0x13')]()]+'],\x20getAdminUser\x20crm',_0x1bf169);_0xea0404(_0x1bf169);})['catch'](function(_0x4df874){logger[_0xc35c('0x14')]('['+[_0x55ceaa['toUpperCase']()]+']',_0x4df874['message']);_0x5653ba(_0x4df874[_0xc35c('0x15')]);});});}function getUser(_0x16eed9,_0x5998ae,_0x211c57,_0xbc71fd,_0x441508){return function(_0x325fad){logger[_0xc35c('0x12')]('['+[_0x16eed9['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x325fad);return new Promise(function(_0x59201f,_0x29a80c){if(intUtil['validateEmail'](_0x325fad[_0xc35c('0x16')])){var _0x5ea045={'method':_0xc35c('0xc'),'uri':_0x211c57+_0xc35c('0x17')+_0x325fad[_0xc35c('0x16')]+'&'+_0xbc71fd+'&'+_0x441508,'auth':_0x5998ae,'json':!![]};logger[_0xc35c('0x12')]('['+[_0x16eed9[_0xc35c('0x13')]()]+_0xc35c('0x18'),_0x5ea045);return rp(_0x5ea045)[_0xc35c('0xe')](function(_0x47d77a){logger['info']('['+[_0x16eed9[_0xc35c('0x13')]()]+_0xc35c('0x19'),_0x47d77a);if(_0x47d77a[_0xc35c('0x1a')]['length']>0x0&&String(_0x47d77a[_0xc35c('0x1a')][0x0][_0xc35c('0x1b')])===_0xc35c('0x1c')){_0x325fad[_0xc35c('0x1d')]=_0x47d77a[_0xc35c('0x1a')][0x0][_0xc35c('0x11')];}else{_0x325fad[_0xc35c('0x1d')]=_0x325fad[_0xc35c('0x10')];_0x325fad[_0xc35c('0x16')]=_0x325fad[_0xc35c('0x1e')];}logger[_0xc35c('0x12')]('['+[_0x16eed9[_0xc35c('0x13')]()]+'],\x20getUser\x20crm',_0x325fad);_0x59201f(_0x325fad);})['catch'](function(_0x345cd1){logger[_0xc35c('0x14')]('['+[_0x16eed9[_0xc35c('0x13')]()]+']',_0x345cd1[_0xc35c('0x15')]);_0x29a80c(_0x345cd1[_0xc35c('0x15')]);});}else{logger[_0xc35c('0x12')]('['+[_0x16eed9['toUpperCase']()]+_0xc35c('0x1f'));_0x325fad['userId']=_0x325fad[_0xc35c('0x10')];_0x325fad['userEmail']=_0x325fad[_0xc35c('0x1e')];_0x59201f(_0x325fad);}});};}function createEndUser(_0xb2a439,_0xe32fe6,_0x49c3fb,_0x220390,_0x3a5164){logger[_0xc35c('0x12')]('['+[_0xb2a439[_0xc35c('0x13')]()]+_0xc35c('0x20'),_0x49c3fb);return new Promise(function(_0x51d5a2,_0x15cd95){var _0x125e1b={'method':_0xc35c('0x21'),'uri':_0x220390+_0xc35c('0x22')+_0x3a5164,'body':{'user_name':_0x49c3fb['endUserNumber'],'roles':_0xc35c('0x23'),'first_name':_0x49c3fb[_0xc35c('0x24')],'active':_0xc35c('0x1c'),'date_format':_0xc35c('0x25'),'phone':_0x49c3fb[_0xc35c('0x24')]},'auth':_0xe32fe6,'json':!![]};return rp(_0x125e1b)[_0xc35c('0xe')](function(_0x3e29a3){logger['info']('['+[_0xb2a439[_0xc35c('0x13')]()]+_0xc35c('0x26'),_0x3e29a3[_0xc35c('0x1a')]);_0x49c3fb[_0xc35c('0x27')]=_0x3e29a3[_0xc35c('0x1a')][_0xc35c('0x11')];_0x51d5a2(_0x49c3fb);})['catch'](function(_0x3895b0){logger[_0xc35c('0x14')]('['+[_0xb2a439[_0xc35c('0x13')]()]+']',_0x3895b0['message']);_0x15cd95(_0x3895b0[_0xc35c('0x15')]);});});}function getEndUser(_0x579fcb,_0x176511,_0x1a5539,_0x4acda6,_0x2c9ab8){return function(_0x635e7){logger[_0xc35c('0x12')]('['+[_0x579fcb[_0xc35c('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x635e7);return new Promise(function(_0x2e73db,_0xcb2201){var _0x5e205f={'method':_0xc35c('0xc'),'uri':_0x1a5539+_0xc35c('0x28')+_0x635e7[_0xc35c('0x24')]+'&'+_0x4acda6+'&'+_0x2c9ab8,'auth':_0x176511,'json':!![]};return rp(_0x5e205f)[_0xc35c('0xe')](function(_0x3fceb9){if(_0x3fceb9[_0xc35c('0x1a')]['length']>0x0){_0x635e7[_0xc35c('0x27')]=_0x3fceb9['result'][0x0][_0xc35c('0x11')];logger[_0xc35c('0x12')]('['+[_0x579fcb[_0xc35c('0x13')]()]+'],\x20getEndUser\x20crm',_0x635e7);_0x2e73db(_0x635e7);}else{return createEndUser(_0x579fcb,_0x176511,_0x635e7,_0x1a5539,_0x4acda6)[_0xc35c('0xe')](function(_0x46a2a9){logger[_0xc35c('0x12')]('['+[_0x579fcb[_0xc35c('0x13')]()]+_0xc35c('0x29'),_0x46a2a9);_0x2e73db(_0x46a2a9);});}})[_0xc35c('0x2a')](function(_0x115b0e){logger[_0xc35c('0x14')]('['+[_0x579fcb['toUpperCase']()]+']',_0x115b0e[_0xc35c('0x15')]);_0xcb2201(_0x115b0e['message']);});});};}function getCustomFields(_0x3abd63,_0x4f7cc1){var _0x73dd4f={};if(_0x3abd63['length']>0x0){_[_0xc35c('0x2b')](_0x3abd63,function(_0x43dcc7){if(_[_0xc35c('0x2c')](['string',_0xc35c('0x2d')],_0x43dcc7[_0xc35c('0x2e')])&&_0x43dcc7[_0xc35c('0x2f')]&&!_0x43dcc7[_0xc35c('0x30')]){_0x73dd4f[_0x43dcc7[_0xc35c('0x2f')]['toLowerCase']()]=_0x43dcc7[_0xc35c('0x31')]['toString']();}else if(_[_0xc35c('0x2c')]([_0xc35c('0x32'),_0xc35c('0x2d')],_0x43dcc7['type'])&&_0x43dcc7[_0xc35c('0x33')]&&_0x43dcc7['customField']){_0x73dd4f[_0x43dcc7[_0xc35c('0x33')][_0xc35c('0x34')]()]=_0x43dcc7[_0xc35c('0x31')][_0xc35c('0x35')]();}else if(_0x43dcc7[_0xc35c('0x2e')]==='variable'&&_0x43dcc7[_0xc35c('0x36')]&&_0x43dcc7[_0xc35c('0x33')]&&_0x43dcc7[_0xc35c('0x30')]){_0x73dd4f[_0x43dcc7[_0xc35c('0x33')][_0xc35c('0x34')]()]=_0x4f7cc1[_0x43dcc7[_0xc35c('0x36')]][_0xc35c('0x35')]();}else if(_0x43dcc7[_0xc35c('0x2e')]===_0xc35c('0x37')&&_0x43dcc7[_0xc35c('0x38')]&&_0x43dcc7[_0xc35c('0x38')]['name']&&_0x43dcc7[_0xc35c('0x33')]&&_0x43dcc7[_0xc35c('0x30')]){_0x73dd4f[_0x43dcc7[_0xc35c('0x33')][_0xc35c('0x34')]()]=_0x4f7cc1[_0x43dcc7['Variable'][_0xc35c('0x39')]['toLowerCase']()]['toString']();}});}return _0x73dd4f;}function getTicket(_0x342ae9,_0x3486dc,_0x1a7ebd,_0x1ea6a4,_0x202182,_0xec4473){return function(_0x4f3d3c){logger[_0xc35c('0x12')]('['+[_0x342ae9[_0xc35c('0x13')]()]+_0xc35c('0x3a'),_0x4f3d3c);return new Promise(function(_0x37cc93,_0x4eda95){var _0xad5ef3=_0x342ae9[_0xc35c('0x34')]()===_0xc35c('0x3b')?_0x4f3d3c[_0xc35c('0x1d')]:_0x4f3d3c[_0xc35c('0x27')];var _0x336b01={'method':_0xc35c('0x21'),'uri':_0x1a7ebd+_0xc35c('0x3c')+'?'+_0xec4473,'body':Object[_0xc35c('0x3d')]({},{'active':_0xc35c('0x1c'),'caller_id':_0xad5ef3,'assigned_to':_0x4f3d3c['userId'],'short_description':intUtil[_0xc35c('0x3e')](_0x1ea6a4[_0xc35c('0x3f')],_0x202182,'\x20'),'description':intUtil[_0xc35c('0x3e')](_0x1ea6a4[_0xc35c('0x40')],_0x202182,'\x0a')},getCustomFields(_0x1ea6a4[_0xc35c('0x41')],_0x202182)),'auth':_0x3486dc,'json':!![]};return rp(_0x336b01)[_0xc35c('0xe')](function(_0x5cfaea){logger[_0xc35c('0x12')]('['+[_0x342ae9[_0xc35c('0x13')]()]+_0xc35c('0x42'),_0x5cfaea['result']);_0x4f3d3c['ticketId']=_0x5cfaea[_0xc35c('0x1a')][_0xc35c('0x11')];_0x4f3d3c[_0xc35c('0x43')]=_0x5cfaea[_0xc35c('0x1a')][_0xc35c('0x44')];logger['info']('['+[_0x342ae9[_0xc35c('0x13')]()]+_0xc35c('0x45'),_0x4f3d3c);_0x37cc93(_0x4f3d3c);})[_0xc35c('0x2a')](function(_0x59e819){logger[_0xc35c('0x14')]('['+[_0x342ae9[_0xc35c('0x13')]()]+']',_0x59e819[_0xc35c('0x15')]);_0x4eda95(_0x59e819['message']);});});};}function createRemoteTag(_0x3bff59,_0x81fff8,_0x550fc7,_0x937b39){return new Promise(function(_0x44a6f2,_0x1b8605){var _0x516c53={'method':_0xc35c('0x21'),'uri':_0x550fc7+_0xc35c('0x46')+'?'+_0x937b39,'body':{'short_description':_0x3bff59,'global':!![],'active':!![],'name':_0x3bff59},'auth':_0x81fff8,'json':!![]};return rp(_0x516c53)[_0xc35c('0xe')](function(_0x18ad0d){var _0x20c7c3=_0x18ad0d[_0xc35c('0x1a')][_0xc35c('0x11')];_0x44a6f2(_0x20c7c3);});});}function getRemoteTag(_0x175089,_0x595674,_0x3fb703,_0x373af1,_0x2325fc){return new Promise(function(_0x4731f6,_0x4ebbbf){var _0x10f8d6={'method':_0xc35c('0xc'),'uri':_0x3fb703+'label'+'?sysparm_query=name%3D'+_0x175089+'&'+_0x373af1,'auth':_0x595674,'json':!![]};return rp(_0x10f8d6)[_0xc35c('0xe')](function(_0x334db2){if(_0x334db2[_0xc35c('0x1a')][_0xc35c('0xf')]>0x0){var _0x64d40b=_0x334db2['result'][0x0][_0xc35c('0x11')];_0x4731f6(_0x64d40b);}else{return createRemoteTag(_0x175089,_0x595674,_0x3fb703,_0x373af1)[_0xc35c('0xe')](function(_0x1163c1){_0x4731f6(_0x1163c1);});}});});}function assignTagToIncident(_0x1d1f80,_0x5b88f9,_0x138025,_0x33decf,_0x1109f5){return new Promise(function(_0x2de9f4,_0x3c728d){var _0x11e81a={'method':'POST','uri':_0x138025+'label_entry'+'?'+_0x1109f5,'body':{'label':_0x1d1f80,'table':'incident','id_type':_0xc35c('0x47'),'table_key':_0x33decf[_0xc35c('0x48')],'title':'Incident\x20-\x20'+_0x33decf[_0xc35c('0x43')],'id_display':_0x33decf[_0xc35c('0x43')]},'auth':_0x5b88f9,'json':!![]};return rp(_0x11e81a)['then'](function(_0xe88838){_0x2de9f4();})[_0xc35c('0x2a')](function(){_0x2de9f4();});});}function manageTags(_0x1e12b8,_0x542924,_0x5c39b4,_0x4a281e,_0x483856,_0x20b484,_0x105c66){return new Promise(function(_0x1cb661,_0x2ffb4d){var _0x8fd1a8=[];_0x542924[_0xc35c('0x2b')](function(_0x476f83){_0x8fd1a8[_0xc35c('0x49')](getRemoteTag(_0x476f83,_0x5c39b4,_0x4a281e,_0x20b484,_0x105c66));});return Promise[_0xc35c('0x4a')](_0x8fd1a8)['then'](function(_0x32c38a){if(_0x32c38a[_0xc35c('0xf')]){logger[_0xc35c('0x12')]('['+[_0x1e12b8[_0xc35c('0x13')]()]+_0xc35c('0x4b'),_0x32c38a);var _0xb7365e=[];_0x32c38a[_0xc35c('0x2b')](function(_0x7b14e7){_0xb7365e[_0xc35c('0x49')](assignTagToIncident(_0x7b14e7,_0x5c39b4,_0x4a281e,_0x483856,_0x20b484));});return Promise[_0xc35c('0x4a')](_0xb7365e)['then'](function(){_0x1cb661();})[_0xc35c('0x2a')](function(){_0x1cb661();});}else{_0x1cb661();}});});}function getTags(_0x44f973,_0x343b84,_0x501d7b,_0xbb8523,_0x10c36f,_0x4eb662){return function(_0x419a5b){return new Promise(function(_0x2ef1b5,_0x105509){var _0x281d97=[];var _0x27ce7b=_0xbb8523[_0xc35c('0x4c')];if(_0x27ce7b&&_0x27ce7b[_0xc35c('0xf')]>0x0){_0x281d97=_['map'](_0x27ce7b,_0xc35c('0x39'));}if(_0x281d97[_0xc35c('0xf')]>0x0){return manageTags(_0x44f973,_0x281d97,_0x343b84,_0x501d7b,_0x419a5b,_0x10c36f,_0x4eb662)[_0xc35c('0xe')](function(){_0x2ef1b5(_0x419a5b);});}else{_0x2ef1b5(_0x419a5b);}});};}function emit(_0x584a89,_0xc6eee6,_0x21b3b4){var _0x38d395=_0xc35c('0x4d')+_0xc35c('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xc35c('0x4f');var _0x483e21={'uri':_0x584a89+_0xc35c('0x50')+_0x21b3b4+_0x38d395};io['to'](util[_0xc35c('0x51')](_0xc35c('0x52'),_0xc6eee6))['emit']('trigger:browser:url',_0x483e21);}exports['cs']=function(_0x3abc19,_0x3fc27e,_0x36cf4a,_0x1827c1,_0x1b6620,_0x3a1927,_0x1987f3,_0x1f86aa){var _0x454e80={};var _0x14bbb7={'user':_0x3a1927[_0xc35c('0x53')],'pass':_0x3a1927[_0xc35c('0x54')]};var _0x342de7='sysparm_limit=1';var _0x5e3d53=_0xc35c('0x55');_0x3a1927[_0xc35c('0x56')]=intUtil[_0xc35c('0x57')](_0x3a1927[_0xc35c('0x56')]);_0x3a1927[_0xc35c('0x58')]=intUtil[_0xc35c('0x57')](_0x3a1927[_0xc35c('0x58')]);var _0x49fb77=util[_0xc35c('0x51')](_0xc35c('0x59'),_0x3a1927[_0xc35c('0x56')]);_0x454e80['userEmail']=!_['isNil'](_0x1827c1)?_0x1827c1['email']:null;_0x454e80[_0xc35c('0x1e')]=_0x3a1927['email'];_0x454e80[_0xc35c('0x24')]=_0x1f86aa['toLowerCase']()===_0xc35c('0x3b')?_0x3fc27e[_0xc35c('0x5a')]:_0x3fc27e['calleridnum'];_0x454e80[_0xc35c('0x5b')]=_0x1f86aa===_0xc35c('0x5c')||_0x1f86aa===_0xc35c('0x5d')?_0xc35c('0x5c'):_0xc35c('0x3b');var _0x3608f0=util[_0xc35c('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a1927[_0xc35c('0x58')],_0x3fc27e[_0xc35c('0x5e')],md5(_0x3fc27e[_0xc35c('0x5e')]));if(_0x1b6620&&_0x1b6620[_0xc35c('0x5f')]){logger['info']('[QUEUE]',_0xc35c('0x60'));_0x3fc27e['recordingURL']=_0x3608f0;}else if(_0x1987f3&&_0x1987f3['recordingFormat']&&_0x1987f3[_0xc35c('0x61')]!==_0xc35c('0x62')){logger[_0xc35c('0x12')](_0xc35c('0x63'),_0xc35c('0x60'));_0x3fc27e['recordingURL']=_0x3608f0;}else{_0x3fc27e[_0xc35c('0x64')]='';}return getAdminUser(_0x1f86aa,_0x14bbb7,_0x454e80,_0x49fb77,_0x5e3d53,_0x342de7)[_0xc35c('0xe')](getUser(_0x1f86aa,_0x14bbb7,_0x49fb77,_0x5e3d53,_0x342de7))['then'](getEndUser(_0x1f86aa,_0x14bbb7,_0x49fb77,_0x5e3d53,_0x342de7))[_0xc35c('0xe')](getTicket(_0x1f86aa,_0x14bbb7,_0x49fb77,_0x36cf4a,_0x3fc27e,_0x5e3d53))[_0xc35c('0xe')](function(_0x2756ea){logger[_0xc35c('0x12')](util['format'](_0xc35c('0x65'),_0x2756ea[_0xc35c('0x48')]));logger[_0xc35c('0x12')](util[_0xc35c('0x51')](_0xc35c('0x66'),_0x1f86aa));if(_0x1f86aa!==_0xc35c('0x5d')){logger[_0xc35c('0x12')]('['+[_0x1f86aa[_0xc35c('0x13')]()]+']',_0xc35c('0x67'));emit(_0x3a1927[_0xc35c('0x56')],_0x1827c1[_0xc35c('0x39')],_0x2756ea['ticketId']);}})[_0xc35c('0x2a')](function(_0xc4db5f){logger[_0xc35c('0x14')]('['+[_0x1f86aa[_0xc35c('0x13')]()]+_0xc35c('0x68'),util[_0xc35c('0x69')](_0xc4db5f,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0x23f0=['remoteUri','serverUrl','%s/api/now/table/','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','./util','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','sys_id','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminId','sys_user?','endUserNumber','user','System','endUserId','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','stripTrailingSlash'];(function(_0xcfb8da,_0x5bc5ea){var _0x401156=function(_0x371187){while(--_0x371187){_0xcfb8da['push'](_0xcfb8da['shift']());}};_0x401156(++_0x5bc5ea);}(_0x23f0,0xe8));var _0x023f=function(_0x28e3cc,_0x4068b8){_0x28e3cc=_0x28e3cc-0x0;var _0x3f3b80=_0x23f0[_0x28e3cc];return _0x3f3b80;};'use strict';var _=require(_0x023f('0x0'));var Promise=require(_0x023f('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x023f('0x2'));var Redis=require('ioredis');var intUtil=require(_0x023f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x023f('0x4'))(_0x023f('0x5'));config[_0x023f('0x6')]=_['defaults'](config[_0x023f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x023f('0x7'))(new Redis(config['redis']));function getAdminUser(_0x3162e2,_0x30b266,_0x146f35,_0x4b6c93,_0xaa6d47,_0x5bfb71){return new Promise(function(_0x3bf6a1,_0x1f93ae){var _0x281d98={'method':_0x023f('0x8'),'uri':_0x4b6c93+_0x023f('0x9')+'&'+_0xaa6d47+'&'+_0x5bfb71,'auth':_0x30b266,'json':!![]};return rp(_0x281d98)['then'](function(_0x45d361){if(_0x45d361['result'][_0x023f('0xa')]>0x0){_0x146f35['adminId']=_0x45d361[_0x023f('0xb')][0x0][_0x023f('0xc')];}logger['info']('['+[_0x3162e2['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x146f35);_0x3bf6a1(_0x146f35);})['catch'](function(_0xc9c5d3){logger['error']('['+[_0x3162e2[_0x023f('0xd')]()]+']',_0xc9c5d3[_0x023f('0xe')]);_0x1f93ae(_0xc9c5d3[_0x023f('0xe')]);});});}function getUser(_0x2deb52,_0x257bdf,_0x4ed06a,_0x307069,_0x44d208){return function(_0x5710b0){logger['info']('['+[_0x2deb52['toUpperCase']()]+_0x023f('0xf'),_0x5710b0);return new Promise(function(_0xde2c6b,_0x2ecd92){if(intUtil[_0x023f('0x10')](_0x5710b0[_0x023f('0x11')])){var _0x496134={'method':_0x023f('0x8'),'uri':_0x4ed06a+_0x023f('0x12')+_0x5710b0['userEmail']+'&'+_0x307069+'&'+_0x44d208,'auth':_0x257bdf,'json':!![]};logger[_0x023f('0x13')]('['+[_0x2deb52[_0x023f('0xd')]()]+_0x023f('0x14'),_0x496134);return rp(_0x496134)[_0x023f('0x15')](function(_0x2d0fcd){logger[_0x023f('0x13')]('['+[_0x2deb52[_0x023f('0xd')]()]+_0x023f('0x16'),_0x2d0fcd);if(_0x2d0fcd[_0x023f('0xb')][_0x023f('0xa')]>0x0&&String(_0x2d0fcd[_0x023f('0xb')][0x0][_0x023f('0x17')])===_0x023f('0x18')){_0x5710b0['userId']=_0x2d0fcd['result'][0x0][_0x023f('0xc')];}else{_0x5710b0[_0x023f('0x19')]=_0x5710b0['adminId'];_0x5710b0[_0x023f('0x11')]=_0x5710b0[_0x023f('0x1a')];}logger['info']('['+[_0x2deb52[_0x023f('0xd')]()]+_0x023f('0x1b'),_0x5710b0);_0xde2c6b(_0x5710b0);})['catch'](function(_0x5d0445){logger[_0x023f('0x1c')]('['+[_0x2deb52[_0x023f('0xd')]()]+']',_0x5d0445['message']);_0x2ecd92(_0x5d0445[_0x023f('0xe')]);});}else{logger[_0x023f('0x13')]('['+[_0x2deb52['toUpperCase']()]+_0x023f('0x1d'));_0x5710b0[_0x023f('0x19')]=_0x5710b0[_0x023f('0x1e')];_0x5710b0[_0x023f('0x11')]=_0x5710b0['adminEmail'];_0xde2c6b(_0x5710b0);}});};}function createEndUser(_0x3ee07e,_0xe3115,_0x21d66e,_0x94f29,_0x29fe7e){logger[_0x023f('0x13')]('['+[_0x3ee07e[_0x023f('0xd')]()]+'],\x20createEndUser\x20input\x20crm',_0x21d66e);return new Promise(function(_0x10c040,_0x5690a5){var _0x32157e={'method':'POST','uri':_0x94f29+_0x023f('0x1f')+_0x29fe7e,'body':{'user_name':_0x21d66e[_0x023f('0x20')],'roles':_0x023f('0x21'),'first_name':_0x21d66e['endUserNumber'],'active':_0x023f('0x18'),'date_format':_0x023f('0x22'),'phone':_0x21d66e[_0x023f('0x20')]},'auth':_0xe3115,'json':!![]};return rp(_0x32157e)[_0x023f('0x15')](function(_0x16fa0a){logger[_0x023f('0x13')]('['+[_0x3ee07e['toUpperCase']()]+'],\x20EndUser\x20schema',_0x16fa0a[_0x023f('0xb')]);_0x21d66e[_0x023f('0x23')]=_0x16fa0a[_0x023f('0xb')][_0x023f('0xc')];_0x10c040(_0x21d66e);})[_0x023f('0x24')](function(_0x45030f){logger[_0x023f('0x1c')]('['+[_0x3ee07e['toUpperCase']()]+']',_0x45030f[_0x023f('0xe')]);_0x5690a5(_0x45030f[_0x023f('0xe')]);});});}function getEndUser(_0x3f44c6,_0x112825,_0x2fc94a,_0x20b29a,_0x3aba58){return function(_0x4425e7){logger[_0x023f('0x13')]('['+[_0x3f44c6[_0x023f('0xd')]()]+_0x023f('0x25'),_0x4425e7);return new Promise(function(_0x2bd6b8,_0x4baa9f){var _0x1212ec={'method':_0x023f('0x8'),'uri':_0x2fc94a+_0x023f('0x26')+_0x4425e7[_0x023f('0x20')]+'&'+_0x20b29a+'&'+_0x3aba58,'auth':_0x112825,'json':!![]};return rp(_0x1212ec)['then'](function(_0x121f60){if(_0x121f60[_0x023f('0xb')][_0x023f('0xa')]>0x0){_0x4425e7[_0x023f('0x23')]=_0x121f60['result'][0x0][_0x023f('0xc')];logger[_0x023f('0x13')]('['+[_0x3f44c6[_0x023f('0xd')]()]+_0x023f('0x27'),_0x4425e7);_0x2bd6b8(_0x4425e7);}else{return createEndUser(_0x3f44c6,_0x112825,_0x4425e7,_0x2fc94a,_0x20b29a)[_0x023f('0x15')](function(_0x269f5e){logger[_0x023f('0x13')]('['+[_0x3f44c6[_0x023f('0xd')]()]+_0x023f('0x28'),_0x269f5e);_0x2bd6b8(_0x269f5e);});}})[_0x023f('0x24')](function(_0x56dad1){logger['error']('['+[_0x3f44c6[_0x023f('0xd')]()]+']',_0x56dad1[_0x023f('0xe')]);_0x4baa9f(_0x56dad1[_0x023f('0xe')]);});});};}function getCustomFields(_0x5c8fcd,_0x523732){var _0x24d98d={};if(_0x5c8fcd[_0x023f('0xa')]>0x0){_[_0x023f('0x29')](_0x5c8fcd,function(_0x569829){if(_[_0x023f('0x2a')]([_0x023f('0x2b'),_0x023f('0x2c')],_0x569829[_0x023f('0x2d')])&&_0x569829[_0x023f('0x2e')]&&!_0x569829['customField']){_0x24d98d[_0x569829['nameField'][_0x023f('0x2f')]()]=_0x569829[_0x023f('0x30')]['toString']();}else if(_[_0x023f('0x2a')]([_0x023f('0x2b'),_0x023f('0x2c')],_0x569829[_0x023f('0x2d')])&&_0x569829[_0x023f('0x31')]&&_0x569829[_0x023f('0x32')]){_0x24d98d[_0x569829[_0x023f('0x31')][_0x023f('0x2f')]()]=_0x569829[_0x023f('0x30')][_0x023f('0x33')]();}else if(_0x569829[_0x023f('0x2d')]==='variable'&&_0x569829[_0x023f('0x34')]&&_0x569829[_0x023f('0x31')]&&_0x569829['customField']){_0x24d98d[_0x569829[_0x023f('0x31')][_0x023f('0x2f')]()]=_0x523732[_0x569829['variableName']]['toString']();}else if(_0x569829['type']===_0x023f('0x35')&&_0x569829['Variable']&&_0x569829[_0x023f('0x36')]['name']&&_0x569829[_0x023f('0x31')]&&_0x569829[_0x023f('0x32')]){_0x24d98d[_0x569829[_0x023f('0x31')][_0x023f('0x2f')]()]=_0x523732[_0x569829[_0x023f('0x36')][_0x023f('0x37')][_0x023f('0x2f')]()][_0x023f('0x33')]();}});}return _0x24d98d;}function getTicket(_0x75ab90,_0x1545e1,_0x19cab1,_0x422bde,_0x3131d7,_0x1c63f7){return function(_0x3ddfc0){logger['info']('['+[_0x75ab90[_0x023f('0xd')]()]+_0x023f('0x38'),_0x3ddfc0);return new Promise(function(_0x7133a1,_0x31e63b){var _0x467502=_0x75ab90['toLowerCase']()===_0x023f('0x39')?_0x3ddfc0['userId']:_0x3ddfc0[_0x023f('0x23')];var _0x112937={'method':_0x023f('0x3a'),'uri':_0x19cab1+'incident'+'?'+_0x1c63f7,'body':Object[_0x023f('0x3b')]({},{'active':_0x023f('0x18'),'caller_id':_0x467502,'assigned_to':_0x3ddfc0[_0x023f('0x19')],'short_description':intUtil[_0x023f('0x3c')](_0x422bde[_0x023f('0x3d')],_0x3131d7,'\x20'),'description':intUtil[_0x023f('0x3c')](_0x422bde['Descriptions'],_0x3131d7,'\x0a')},getCustomFields(_0x422bde[_0x023f('0x3e')],_0x3131d7)),'auth':_0x1545e1,'json':!![]};return rp(_0x112937)[_0x023f('0x15')](function(_0xb1c186){logger[_0x023f('0x13')]('['+[_0x75ab90['toUpperCase']()]+_0x023f('0x3f'),_0xb1c186[_0x023f('0xb')]);_0x3ddfc0[_0x023f('0x40')]=_0xb1c186[_0x023f('0xb')][_0x023f('0xc')];_0x3ddfc0[_0x023f('0x41')]=_0xb1c186['result'][_0x023f('0x42')];logger[_0x023f('0x13')]('['+[_0x75ab90[_0x023f('0xd')]()]+']\x20getTicket\x20crm',_0x3ddfc0);_0x7133a1(_0x3ddfc0);})[_0x023f('0x24')](function(_0x2a72fb){logger['error']('['+[_0x75ab90[_0x023f('0xd')]()]+']',_0x2a72fb[_0x023f('0xe')]);_0x31e63b(_0x2a72fb[_0x023f('0xe')]);});});};}function createRemoteTag(_0x341eed,_0x2fbdea,_0x1e05fb,_0x25c431){return new Promise(function(_0x36cb59,_0x375bee){var _0x5a80be={'method':'POST','uri':_0x1e05fb+_0x023f('0x43')+'?'+_0x25c431,'body':{'short_description':_0x341eed,'global':!![],'active':!![],'name':_0x341eed},'auth':_0x2fbdea,'json':!![]};return rp(_0x5a80be)['then'](function(_0x2e3c31){var _0xf84e8b=_0x2e3c31[_0x023f('0xb')]['sys_id'];_0x36cb59(_0xf84e8b);});});}function getRemoteTag(_0x50e743,_0x23c20a,_0x4e5f52,_0x921e93,_0x365a4e){return new Promise(function(_0x2845c1,_0x14b462){var _0x51aeb3={'method':_0x023f('0x8'),'uri':_0x4e5f52+_0x023f('0x43')+_0x023f('0x44')+_0x50e743+'&'+_0x921e93,'auth':_0x23c20a,'json':!![]};return rp(_0x51aeb3)[_0x023f('0x15')](function(_0x517531){if(_0x517531[_0x023f('0xb')][_0x023f('0xa')]>0x0){var _0x516da0=_0x517531['result'][0x0][_0x023f('0xc')];_0x2845c1(_0x516da0);}else{return createRemoteTag(_0x50e743,_0x23c20a,_0x4e5f52,_0x921e93)[_0x023f('0x15')](function(_0x5be893){_0x2845c1(_0x5be893);});}});});}function assignTagToIncident(_0xbc4b5b,_0x385787,_0x429bae,_0xe6a15e,_0x5530b0){return new Promise(function(_0xc89e07,_0xacb411){var _0x16656c={'method':_0x023f('0x3a'),'uri':_0x429bae+_0x023f('0x45')+'?'+_0x5530b0,'body':{'label':_0xbc4b5b,'table':'incident','id_type':'Incident','table_key':_0xe6a15e[_0x023f('0x40')],'title':'Incident\x20-\x20'+_0xe6a15e[_0x023f('0x41')],'id_display':_0xe6a15e['ticketNumber']},'auth':_0x385787,'json':!![]};return rp(_0x16656c)[_0x023f('0x15')](function(_0x464445){_0xc89e07();})[_0x023f('0x24')](function(){_0xc89e07();});});}function manageTags(_0x157207,_0x5049ad,_0x3a8afd,_0xbc376e,_0x4c7581,_0x4f15e5,_0x4db7bc){return new Promise(function(_0x45ed00,_0x33d538){var _0x1aa173=[];_0x5049ad[_0x023f('0x29')](function(_0x4ce191){_0x1aa173[_0x023f('0x46')](getRemoteTag(_0x4ce191,_0x3a8afd,_0xbc376e,_0x4f15e5,_0x4db7bc));});return Promise[_0x023f('0x47')](_0x1aa173)[_0x023f('0x15')](function(_0x11351c){if(_0x11351c[_0x023f('0xa')]){logger[_0x023f('0x13')]('['+[_0x157207[_0x023f('0xd')]()]+_0x023f('0x48'),_0x11351c);var _0x13d2bd=[];_0x11351c[_0x023f('0x29')](function(_0x4fb5c5){_0x13d2bd[_0x023f('0x46')](assignTagToIncident(_0x4fb5c5,_0x3a8afd,_0xbc376e,_0x4c7581,_0x4f15e5));});return Promise[_0x023f('0x47')](_0x13d2bd)[_0x023f('0x15')](function(){_0x45ed00();})[_0x023f('0x24')](function(){_0x45ed00();});}else{_0x45ed00();}});});}function getTags(_0x260f44,_0x2507a5,_0x52ec3d,_0x1794bc,_0x5d25e7,_0x59bcae){return function(_0xa4d7a){return new Promise(function(_0x201c76,_0xfd00a7){var _0x517c54=[];var _0x1c05b0=_0x1794bc[_0x023f('0x49')];if(_0x1c05b0&&_0x1c05b0[_0x023f('0xa')]>0x0){_0x517c54=_['map'](_0x1c05b0,_0x023f('0x37'));}if(_0x517c54[_0x023f('0xa')]>0x0){return manageTags(_0x260f44,_0x517c54,_0x2507a5,_0x52ec3d,_0xa4d7a,_0x5d25e7,_0x59bcae)[_0x023f('0x15')](function(){_0x201c76(_0xa4d7a);});}else{_0x201c76(_0xa4d7a);}});};}function emit(_0x2eab4d,_0x3e85b2,_0x5d095e){var _0x806421=_0x023f('0x4a')+_0x023f('0x4b')+_0x023f('0x4c')+_0x023f('0x4d');var _0x2ede02={'uri':_0x2eab4d+_0x023f('0x4e')+_0x5d095e+_0x806421};io['to'](util[_0x023f('0x4f')](_0x023f('0x50'),_0x3e85b2))[_0x023f('0x51')](_0x023f('0x52'),_0x2ede02);}exports['cs']=function(_0x221109,_0x5b0061,_0x2fc562,_0x3479f9,_0x2ae6dc,_0x4f426e,_0x55a8a6,_0x4e659b){var _0x1ca2ce={};var _0x1640fd={'user':_0x4f426e[_0x023f('0x53')],'pass':_0x4f426e[_0x023f('0x54')]};var _0x34aebf='sysparm_limit=1';var _0x365d09='sysparm_display_value=true';_0x4f426e['remoteUri']=intUtil[_0x023f('0x55')](_0x4f426e[_0x023f('0x56')]);_0x4f426e[_0x023f('0x57')]=intUtil[_0x023f('0x55')](_0x4f426e[_0x023f('0x57')]);var _0x2e9d13=util['format'](_0x023f('0x58'),_0x4f426e['remoteUri']);_0x1ca2ce[_0x023f('0x11')]=!_['isNil'](_0x3479f9)?_0x3479f9['email']:null;_0x1ca2ce[_0x023f('0x1a')]=_0x4f426e['email'];_0x1ca2ce[_0x023f('0x20')]=_0x4e659b['toLowerCase']()==='outbound'?_0x5b0061[_0x023f('0x59')]:_0x5b0061[_0x023f('0x5a')];_0x1ca2ce['callDirection']=_0x4e659b==='queue'||_0x4e659b===_0x023f('0x5b')?_0x023f('0x5c'):_0x023f('0x39');var _0x462940=util['format'](_0x023f('0x5d'),_0x4f426e['serverUrl'],_0x5b0061[_0x023f('0x5e')],md5(_0x5b0061[_0x023f('0x5e')]));if(_0x2ae6dc&&_0x2ae6dc[_0x023f('0x5f')]){logger[_0x023f('0x13')](_0x023f('0x60'),'Recording\x20is\x20enabled!');_0x5b0061[_0x023f('0x61')]=_0x462940;}else if(_0x55a8a6&&_0x55a8a6[_0x023f('0x62')]&&_0x55a8a6[_0x023f('0x62')]!==_0x023f('0x63')){logger['info'](_0x023f('0x64'),_0x023f('0x65'));_0x5b0061['recordingURL']=_0x462940;}else{_0x5b0061[_0x023f('0x61')]='';}return getAdminUser(_0x4e659b,_0x1640fd,_0x1ca2ce,_0x2e9d13,_0x365d09,_0x34aebf)['then'](getUser(_0x4e659b,_0x1640fd,_0x2e9d13,_0x365d09,_0x34aebf))[_0x023f('0x15')](getEndUser(_0x4e659b,_0x1640fd,_0x2e9d13,_0x365d09,_0x34aebf))[_0x023f('0x15')](getTicket(_0x4e659b,_0x1640fd,_0x2e9d13,_0x2fc562,_0x5b0061,_0x365d09))[_0x023f('0x15')](function(_0x56320b){logger[_0x023f('0x13')](util[_0x023f('0x4f')](_0x023f('0x66'),_0x56320b[_0x023f('0x40')]));logger[_0x023f('0x13')](util[_0x023f('0x4f')]('call\x20direction:\x20%s',_0x4e659b));if(_0x4e659b!==_0x023f('0x5b')){logger['info']('['+[_0x4e659b[_0x023f('0xd')]()]+']',_0x023f('0x67'));emit(_0x4f426e[_0x023f('0x56')],_0x3479f9['name'],_0x56320b[_0x023f('0x40')]);}})['catch'](function(_0x59cd86){logger['error']('['+[_0x4e659b[_0x023f('0xd')]()]+_0x023f('0x68'),util[_0x023f('0x69')](_0x59cd86,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index dd933a7..c0e7bed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24ad=['ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','Creating\x20new\x20ticket...','name','getString','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','format','toString','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','name_value_list','info','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','string','nameField','customField','toLowerCase','content','custom_fields','type','variable','customVariable','Variable','POST','username','password','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridnum','Fields','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','Inbound','request-promise','md5','util'];(function(_0x80764,_0x389472){var _0x461709=function(_0x1bbdc1){while(--_0x1bbdc1){_0x80764['push'](_0x80764['shift']());}};_0x461709(++_0x389472);}(_0x24ad,0xe3));var _0xd24a=function(_0x4babdd,_0x382cd3){_0x4babdd=_0x4babdd-0x0;var _0x4d2c00=_0x24ad[_0x4babdd];return _0x4d2c00;};'use strict';var _=require('lodash');var rp=require(_0xd24a('0x0'));var BPromise=require('bluebird');var md5=require(_0xd24a('0x1'));var util=require(_0xd24a('0x2'));var Redis=require(_0xd24a('0x3'));var intUtil=require('./util');var config=require(_0xd24a('0x4'));var logger=require(_0xd24a('0x5'))(_0xd24a('0x6'));config['redis']=_['defaults'](config[_0xd24a('0x7')],{'host':_0xd24a('0x8'),'port':0x18eb});var io=require(_0xd24a('0x9'))(new Redis(config[_0xd24a('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x27c1fd,_0x312453,_0x1b081f){io['to'](_0x27c1fd)['emit'](_0x312453,_0x1b081f);}function getTicket(_0x164b63,_0x17855d,_0x53b4ea,_0x6e85cb,_0x2c38cf,_0x1361b6,_0x3734a2,_0x2e84a6){logger['info'](_0xd24a('0xa'));var _0x41aaf1=new Date();var _0x33c87a=[{'name':_0xd24a('0xb'),'value':intUtil[_0xd24a('0xc')](_0x6e85cb['Subjects'],_0x2c38cf,'\x20')},{'name':'assigned_user_id','value':_0x17855d['id']},{'name':'created_by','value':_0x17855d['id']},{'name':_0xd24a('0xd'),'value':intUtil[_0xd24a('0xc')](_0x6e85cb[_0xd24a('0xe')],_0x2c38cf,'\x0a')},{'name':_0xd24a('0xf'),'value':_0x41aaf1[_0xd24a('0x10')]()[_0xd24a('0x11')](0x0,0x13)[_0xd24a('0x12')]('T','\x20')},{'name':_0xd24a('0x13'),'value':'0'},{'name':_0xd24a('0x14'),'value':'15'},{'name':'parent_id','value':_0x53b4ea['id']},{'name':'parent_type','value':_0xd24a('0x15')},{'name':_0xd24a('0x16'),'value':_0x53b4ea[_0xd24a('0xb')]},{'name':_0xd24a('0x17'),'value':_0x2e84a6}];if(_0x1361b6[_0xd24a('0x18')]){_[_0xd24a('0x19')](_0x1361b6,function(_0x1c7685){if(_0x2c38cf[_0x1c7685[_0xd24a('0x1a')]]){_0x33c87a[_0xd24a('0x1b')]({'name':_0x1c7685[_0xd24a('0x1c')],'value':_0x2c38cf[_0x1c7685['variableName']]});}});}return request({'form':{'method':_0xd24a('0x1d'),'input_type':_0xd24a('0x1e'),'response_type':_0xd24a('0x1e'),'rest_data':JSON['stringify']({'session':_0x3734a2['id'],'module_name':'Calls','name_value_list':_0x33c87a})}});}function getAuth(_0x3a5158){return util[_0xd24a('0x1f')]('Basic\x20%s',new Buffer(_0x3a5158['apiKey']+':X')[_0xd24a('0x20')]('base64'));}function getServerInfo(_0x4ff066){return request({'form':{'method':_0xd24a('0x21'),'input_type':_0xd24a('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd24a('0x22')]({'session':_0x4ff066['id']})}});}function getUser(_0x2c9cf1,_0x3c1f13,_0x2d71c5){if(!_[_0xd24a('0x23')](_0x3c1f13)){logger['info'](_0xd24a('0x24'),_0x3c1f13);return request({'form':{'method':_0xd24a('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd24a('0x22')]({'session':_0x2d71c5['id'],'module_name':'Employees','query':util['format'](_0xd24a('0x26'),_0x3c1f13),'order_by':'','offset':'0','select_fields':['id',_0xd24a('0xb'),_0xd24a('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd24a('0x28')](function(_0x3ee295){if(_0x3ee295['entry_list']['length']){var _0xa54e46=_[_0xd24a('0x29')](_0x3ee295['entry_list'],function(_0x23d129){return _0x23d129[_0xd24a('0x2a')][_0xd24a('0x27')]['value']===_0x3c1f13;});if(_0xa54e46){logger[_0xd24a('0x2b')](_0xd24a('0x2c'));return BPromise[_0xd24a('0x2d')]({'id':_0xa54e46['name_value_list']['id'][_0xd24a('0x2e')],'name':_0xa54e46['name_value_list'][_0xd24a('0xb')][_0xd24a('0x2e')]});}}logger[_0xd24a('0x2b')](_0xd24a('0x2f'));return BPromise[_0xd24a('0x2d')]({'id':_0x2d71c5[_0xd24a('0x2a')][_0xd24a('0x30')][_0xd24a('0x2e')],'name':_0x2d71c5[_0xd24a('0x2a')]['user_name'][_0xd24a('0x2e')]});});}else{logger[_0xd24a('0x2b')](_0xd24a('0x31'));return BPromise[_0xd24a('0x2d')]({'id':_0x2d71c5[_0xd24a('0x2a')][_0xd24a('0x30')][_0xd24a('0x2e')],'name':_0x2d71c5[_0xd24a('0x2a')][_0xd24a('0x27')][_0xd24a('0x2e')]});}}function getEndUser(_0x5be61b,_0x197105,_0x55d9dd,_0x22225e){logger['info'](_0xd24a('0x32'),_0x55d9dd);return request({'form':{'method':'get_entry_list','input_type':_0xd24a('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd24a('0x22')]({'session':_0x22225e['id'],'module_name':_0xd24a('0x15'),'query':util['format'](_0xd24a('0x33'),_0x55d9dd),'order_by':'','offset':'0','select_fields':['id','name',_0xd24a('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd24a('0x28')](function(_0x4da48b){if(_0x4da48b[_0xd24a('0x35')][_0xd24a('0x18')]){var _0x57bf23=_[_0xd24a('0x29')](_0x4da48b[_0xd24a('0x35')],function(_0x3765d7){return _0x3765d7['name_value_list'][_0xd24a('0x34')][_0xd24a('0x2e')]===_0x55d9dd;});if(_0x57bf23){logger[_0xd24a('0x2b')](_0xd24a('0x36'));return BPromise[_0xd24a('0x2d')]({'id':_0x57bf23['name_value_list']['id'][_0xd24a('0x2e')],'name':_0x57bf23['name_value_list'][_0xd24a('0xb')][_0xd24a('0x2e')],'phone':_0x57bf23[_0xd24a('0x2a')][_0xd24a('0x34')][_0xd24a('0x2e')]});}}else{logger[_0xd24a('0x2b')](_0xd24a('0x37'));return request({'form':{'method':'set_entry','input_type':_0xd24a('0x1e'),'response_type':_0xd24a('0x1e'),'rest_data':JSON[_0xd24a('0x22')]({'session':_0x22225e['id'],'module_name':_0xd24a('0x15'),'name_value_list':[{'name':_0xd24a('0x38'),'value':_0x197105!==_0xd24a('0x39')?_0x197105:util[_0xd24a('0x1f')](_0xd24a('0x3a'),_0x55d9dd)},{'name':_0xd24a('0x34'),'value':_0x55d9dd}]})}})[_0xd24a('0x28')](function(_0x347e7d){logger[_0xd24a('0x2b')](_0xd24a('0x3b'));return BPromise[_0xd24a('0x2d')]({'id':_0x347e7d['id'],'name':_0x347e7d[_0xd24a('0x35')][_0xd24a('0x38')][_0xd24a('0x2e')],'phone':_0x347e7d[_0xd24a('0x35')][_0xd24a('0x34')]['value']});});}});}function request(_0x1ddcae){logger[_0xd24a('0x3c')]('[HTTP]',JSON[_0xd24a('0x22')](_0x1ddcae));return rp(_[_0xd24a('0x3d')](def,_0x1ddcae));}function getTags(_0xbd4c8,_0x47b93b){var _0x28e8a5=[];if(_0xbd4c8&&_0xbd4c8[_0xd24a('0x18')]>0x0){_0x28e8a5=_[_0xd24a('0x3e')](_0xbd4c8,_0x47b93b);}return _0x28e8a5;}function getCustomFields(_0x1b76cf,_0x1ec613){var _0x3c7ba2=[];var _0x5a4c9b={'custom_fields':[]};if(_0x1b76cf[_0xd24a('0x18')]>0x0){_[_0xd24a('0x19')](_0x1b76cf,function(_0x590459){if(_0x590459['type']===_0xd24a('0x3f')&&_0x590459[_0xd24a('0x40')]&&!_0x590459[_0xd24a('0x41')]){_0x5a4c9b[_0x590459[_0xd24a('0x40')][_0xd24a('0x42')]()]=_0x590459[_0xd24a('0x43')][_0xd24a('0x20')]();}else if(_0x590459['type']===_0xd24a('0x3f')&&_0x590459['idField']&&_0x590459[_0xd24a('0x41')]){_0x5a4c9b[_0xd24a('0x44')][_0xd24a('0x1b')]({'id':_0x590459['idField'],'value':_0x590459[_0xd24a('0x43')][_0xd24a('0x20')]()});}else if(_0x590459[_0xd24a('0x45')]===_0xd24a('0x46')&&_0x590459[_0xd24a('0x1a')]&&_0x590459[_0xd24a('0x1c')]&&_0x590459[_0xd24a('0x41')]){_0x1ec613[_0x590459[_0xd24a('0x1a')]]&&_0x5a4c9b['custom_fields'][_0xd24a('0x1b')]({'id':_0x590459[_0xd24a('0x1c')],'value':_0x1ec613[_0x590459[_0xd24a('0x1a')]][_0xd24a('0x20')]()});}else if(_0x590459[_0xd24a('0x45')]===_0xd24a('0x47')&&_0x590459['Variable']&&_0x590459['Variable'][_0xd24a('0xb')]&&_0x590459[_0xd24a('0x1c')]&&_0x590459['customField']){_0x1ec613[_0x590459['Variable'][_0xd24a('0xb')][_0xd24a('0x42')]()]&&_0x5a4c9b[_0xd24a('0x44')][_0xd24a('0x1b')]({'id':_0x590459[_0xd24a('0x1c')],'value':_0x1ec613[_0x590459[_0xd24a('0x48')][_0xd24a('0xb')][_0xd24a('0x42')]()][_0xd24a('0x20')]()});}});}return _0x5a4c9b;}function getConnection(_0x375911){return request({'method':_0xd24a('0x49'),'form':{'method':'login','input_type':_0xd24a('0x1e'),'response_type':_0xd24a('0x1e'),'rest_data':JSON[_0xd24a('0x22')]({'user_auth':{'user_name':_0x375911[_0xd24a('0x4a')],'password':_0x375911[_0xd24a('0x4b')],'encryption':'PLAIN'},'application':_0xd24a('0x4c')})}})[_0xd24a('0x28')](function(_0x54fa8e){var _0x30c58c=_0x54fa8e;if(_0x30c58c['id']){def[_0xd24a('0x4d')]=_0x30c58c['id'];return BPromise[_0xd24a('0x2d')](_0x30c58c);}else{throw new Error(util[_0xd24a('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x375911['id']));}});}function setRelationship(_0x2bd147,_0xba6390,_0x3951d6,_0x3ab9fe){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xd24a('0x1e'),'rest_data':JSON[_0xd24a('0x22')]({'session':_0x2bd147['id'],'module_name':'Calls','module_id':_0x3951d6['id'],'link_field_name':_0x3ab9fe,'related_ids':[_0xba6390['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd24a('0x4e')]=function(_0x76487e,_0x5ce78e,_0x30c3f4,_0x32fa8f,_0x3fff2e,_0x3b11ef){var _0x33fd9d,_0x566db6,_0x4222ff,_0x3d26cf;_0x3b11ef[_0xd24a('0x4f')]=intUtil[_0xd24a('0x50')](_0x3b11ef[_0xd24a('0x4f')]);_0x3b11ef['serverUrl']=intUtil[_0xd24a('0x50')](_0x3b11ef[_0xd24a('0x51')]);def[_0xd24a('0x52')]=util['format'](_0xd24a('0x53'),_0x3b11ef[_0xd24a('0x4f')]);if(_0x3fff2e&&_0x3fff2e[_0xd24a('0x54')]){logger[_0xd24a('0x2b')](_0xd24a('0x55'),_0xd24a('0x56'));_0x5ce78e['recordingURL']=util[_0xd24a('0x1f')](_0xd24a('0x57'),_0x3b11ef[_0xd24a('0x51')],_0x5ce78e[_0xd24a('0x58')],md5(_0x5ce78e[_0xd24a('0x58')]));}else{_0x5ce78e['recordingURL']='';}return getConnection(_0x3b11ef)[_0xd24a('0x28')](function(_0x54bebc){_0x3d26cf=_0x54bebc;return getUser(_0x3b11ef,_0x32fa8f['name'],_0x3d26cf);})[_0xd24a('0x28')](function(_0x5b753e){_0x33fd9d=_0x5b753e;logger[_0xd24a('0x2b')](_0xd24a('0x59'),_0x33fd9d['id']);return getEndUser(_0x3b11ef,_0x5ce78e[_0xd24a('0x5a')],_0x5ce78e[_0xd24a('0x5b')],_0x3d26cf);})[_0xd24a('0x28')](function(_0x376f6c){_0x566db6=_0x376f6c;logger[_0xd24a('0x2b')]('The\x20Enduser\x20ID\x20is:',_0x566db6['id']);return getTicket(_0x3b11ef,_0x33fd9d,_0x566db6,_0x30c3f4,_0x5ce78e,_0x30c3f4['Fields'],_0x3d26cf,'Inbound');})[_0xd24a('0x28')](function(_0x440d4a){_0x4222ff=_0x440d4a;logger['info'](_0xd24a('0x5c'));logger[_0xd24a('0x2b')](_0xd24a('0x5d'),_0x4222ff['id']);return setRelationship(_0x3d26cf,_0x33fd9d,_0x4222ff,_0xd24a('0x5e'));})['then'](function(){return setRelationship(_0x3d26cf,_0x566db6,_0x4222ff,_0xd24a('0x5f'));})[_0xd24a('0x28')](function(){return getServerInfo(_0x3d26cf);})[_0xd24a('0x28')](function(_0x1eeda9){var _0x2bb68b=parseInt(_0x1eeda9[_0xd24a('0x60')]['charAt'](0x0));var _0x428cbd=util[_0xd24a('0x1f')](_0xd24a('0x61'),_0x3b11ef[_0xd24a('0x4f')],_0x4222ff['id']);if(_0x2bb68b>0x6){_0x428cbd=util[_0xd24a('0x1f')](_0xd24a('0x62'),_0x3b11ef[_0xd24a('0x4f')],_0x4222ff['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd24a('0x1f')](_0xd24a('0x63'),_0x32fa8f['name']),_0xd24a('0x64'),{'uri':_0x428cbd});})[_0xd24a('0x65')](function(_0x127874){logger[_0xd24a('0x66')](_0xd24a('0x55'),JSON[_0xd24a('0x22')](_0x127874));});};exports[_0xd24a('0x67')]=function(_0x134947,_0x227cc7,_0x3b9338,_0x28d43c,_0x103437,_0x33303c,_0xa035e7){var _0x3b0e30,_0xc1f6c1,_0x529128,_0x17a2e0;_0x33303c[_0xd24a('0x4f')]=intUtil[_0xd24a('0x50')](_0x33303c[_0xd24a('0x4f')]);_0x33303c['serverUrl']=intUtil[_0xd24a('0x50')](_0x33303c[_0xd24a('0x51')]);def[_0xd24a('0x52')]=util[_0xd24a('0x1f')](_0xd24a('0x53'),_0x33303c[_0xd24a('0x4f')]);if(_0xa035e7&&_0xa035e7['recordingFormat']&&_0xa035e7[_0xd24a('0x68')]!==_0xd24a('0x69')){logger['info'](_0xd24a('0x6a'),_0xd24a('0x56'));_0x227cc7[_0xd24a('0x6b')]=util[_0xd24a('0x1f')](_0xd24a('0x57'),_0x33303c[_0xd24a('0x51')],_0x227cc7[_0xd24a('0x58')],md5(_0x227cc7[_0xd24a('0x58')]));}return getConnection(_0x33303c)[_0xd24a('0x28')](function(_0x9d8d3b){_0x17a2e0=_0x9d8d3b;return getUser(_0x33303c,_0x28d43c[_0xd24a('0xb')],_0x17a2e0);})[_0xd24a('0x28')](function(_0x3a2813){_0x3b0e30=_0x3a2813;logger[_0xd24a('0x2b')](_0xd24a('0x59'),_0x3b0e30['id']);return getEndUser(_0x33303c,_0x227cc7['destcalleridname'],_0x227cc7[_0xd24a('0x6c')],_0x17a2e0);})['then'](function(_0x16b544){_0xc1f6c1=_0x16b544;logger[_0xd24a('0x2b')]('The\x20Enduser\x20ID\x20is:',_0xc1f6c1['id']);return getTicket(_0x33303c,_0x3b0e30,_0xc1f6c1,_0x3b9338,_0x227cc7,_0x3b9338[_0xd24a('0x6d')],_0x17a2e0,'Outbound');})[_0xd24a('0x28')](function(_0x2244d7){_0x529128=_0x2244d7;logger[_0xd24a('0x2b')](_0xd24a('0x5c'));logger[_0xd24a('0x2b')](_0xd24a('0x5d'),_0x529128['id']);return setRelationship(_0x17a2e0,_0x3b0e30,_0x529128,'users');})['then'](function(){return setRelationship(_0x17a2e0,_0xc1f6c1,_0x529128,'contacts');})[_0xd24a('0x28')](function(){return getServerInfo(_0x17a2e0);})['then'](function(_0x4b2cdc){var _0x5b9dda=parseInt(_0x4b2cdc[_0xd24a('0x60')]['charAt'](0x0));var _0x31df0a=util[_0xd24a('0x1f')](_0xd24a('0x61'),_0x33303c[_0xd24a('0x4f')],_0x529128['id']);if(_0x5b9dda>0x6){_0x31df0a=util[_0xd24a('0x1f')](_0xd24a('0x62'),_0x33303c[_0xd24a('0x4f')],_0x529128['id']);}logger[_0xd24a('0x2b')](_0xd24a('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd24a('0x1f')](_0xd24a('0x63'),_0x28d43c[_0xd24a('0xb')]),'trigger:browser:url',{'uri':_0x31df0a});})[_0xd24a('0x65')](function(_0x59b85b){logger[_0xd24a('0x66')](_0xd24a('0x6a'),JSON['stringify'](_0x59b85b));});};exports[_0xd24a('0x6e')]=function(_0xc11001,_0x49a985,_0x53e206,_0x2770ef,_0x16b4cf,_0xcdea0d){var _0x546a54,_0x349d9c,_0x5ca275,_0x318065;_0xcdea0d[_0xd24a('0x4f')]=intUtil[_0xd24a('0x50')](_0xcdea0d['remoteUri']);_0xcdea0d[_0xd24a('0x51')]=intUtil[_0xd24a('0x50')](_0xcdea0d['serverUrl']);def[_0xd24a('0x52')]=util[_0xd24a('0x1f')](_0xd24a('0x53'),_0xcdea0d[_0xd24a('0x4f')]);if(_0x16b4cf&&_0x16b4cf[_0xd24a('0x54')]){logger[_0xd24a('0x2b')]('['+_0x49a985[_0xd24a('0x6f')][_0xd24a('0x70')]()+']','Recording\x20is\x20enabled!');_0x49a985['recordingURL']=util['format'](_0xd24a('0x57'),_0xcdea0d[_0xd24a('0x51')],_0x49a985['uniqueid'],md5(_0x49a985['uniqueid']));}else{_0x49a985[_0xd24a('0x6b')]='';}return getConnection(_0xcdea0d)[_0xd24a('0x28')](function(_0x34a27a){_0x318065=_0x34a27a;if(!_[_0xd24a('0x23')](_0x2770ef)){return getUser(_0xcdea0d,_0x2770ef[_0xd24a('0xb')],_0x318065);}else{return getUser(_0xcdea0d,null,_0x318065);}})[_0xd24a('0x28')](function(_0x345ace){_0x546a54=_0x345ace;logger[_0xd24a('0x2b')](_0xd24a('0x59'),_0x546a54['id']);return getEndUser(_0xcdea0d,_0x49a985[_0xd24a('0x5a')],_0x49a985['calleridnum'],_0x318065);})[_0xd24a('0x28')](function(_0x3b9c9b){_0x349d9c=_0x3b9c9b;logger[_0xd24a('0x2b')](_0xd24a('0x71'),_0x349d9c['id']);return getTicket(_0xcdea0d,_0x546a54,_0x349d9c,_0x53e206,_0x49a985,_0x53e206['Fields'],_0x318065,_0xd24a('0x72'));})[_0xd24a('0x28')](function(_0x34d2dd){_0x5ca275=_0x34d2dd;logger['info']('Ticket\x20created!');logger[_0xd24a('0x2b')](_0xd24a('0x5d'),_0x5ca275['id']);return setRelationship(_0x318065,_0x546a54,_0x5ca275,'users');})[_0xd24a('0x28')](function(){return setRelationship(_0x318065,_0x349d9c,_0x5ca275,'contacts');})[_0xd24a('0x28')](function(){return getServerInfo(_0x318065);})['catch'](function(_0x3284bc){logger[_0xd24a('0x66')]('['+_0x49a985['lastevent'][_0xd24a('0x70')]()+']',JSON[_0xd24a('0x22')](_0x3284bc));});};
\ No newline at end of file
+var _0xdb77=['resolve','value','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','toLowerCase','content','toString','string','customField','custom_fields','push','variable','variableName','customVariable','Variable','login','username','password','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','[OUTBOUND]','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','lastevent','toUpperCase','calleridname','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','socket.io-emitter','redis','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','length','forEach','idField','set_entry','JSON','Calls','Basic\x20%s','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','Agent\x20found!'];(function(_0x5d6d28,_0x14d669){var _0x4d2ad1=function(_0x5c3ed2){while(--_0x5c3ed2){_0x5d6d28['push'](_0x5d6d28['shift']());}};_0x4d2ad1(++_0x14d669);}(_0xdb77,0xbb));var _0x7db7=function(_0x3b2006,_0x1a78aa){_0x3b2006=_0x3b2006-0x0;var _0x24f03e=_0xdb77[_0x3b2006];return _0x24f03e;};'use strict';var _=require('lodash');var rp=require(_0x7db7('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x7db7('0x1'));var Redis=require(_0x7db7('0x2'));var intUtil=require(_0x7db7('0x3'));var config=require(_0x7db7('0x4'));var logger=require(_0x7db7('0x5'))('sugarcrm');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7db7('0x6'))(new Redis(config[_0x7db7('0x7')]));var def={'method':_0x7db7('0x8'),'json':!![]};function emit(_0x3f91c6,_0x14a496,_0x49f577){io['to'](_0x3f91c6)['emit'](_0x14a496,_0x49f577);}function getTicket(_0x455292,_0x2b111e,_0xbcc5a4,_0x56ada5,_0x341f88,_0x5d58d3,_0x5c6de3,_0xf70eed){logger[_0x7db7('0x9')](_0x7db7('0xa'));var _0x5f1703=new Date();var _0x43463a=[{'name':_0x7db7('0xb'),'value':intUtil[_0x7db7('0xc')](_0x56ada5[_0x7db7('0xd')],_0x341f88,'\x20')},{'name':_0x7db7('0xe'),'value':_0x2b111e['id']},{'name':_0x7db7('0xf'),'value':_0x2b111e['id']},{'name':_0x7db7('0x10'),'value':intUtil[_0x7db7('0xc')](_0x56ada5[_0x7db7('0x11')],_0x341f88,'\x0a')},{'name':_0x7db7('0x12'),'value':_0x5f1703[_0x7db7('0x13')]()[_0x7db7('0x14')](0x0,0x13)[_0x7db7('0x15')]('T','\x20')},{'name':_0x7db7('0x16'),'value':'0'},{'name':_0x7db7('0x17'),'value':'15'},{'name':'parent_id','value':_0xbcc5a4['id']},{'name':'parent_type','value':_0x7db7('0x18')},{'name':'parent_name','value':_0xbcc5a4['name']},{'name':'direction','value':_0xf70eed}];if(_0x5d58d3[_0x7db7('0x19')]){_[_0x7db7('0x1a')](_0x5d58d3,function(_0x59b2f8){if(_0x341f88[_0x59b2f8['variableName']]){_0x43463a['push']({'name':_0x59b2f8[_0x7db7('0x1b')],'value':_0x341f88[_0x59b2f8['variableName']]});}});}return request({'form':{'method':_0x7db7('0x1c'),'input_type':_0x7db7('0x1d'),'response_type':_0x7db7('0x1d'),'rest_data':JSON['stringify']({'session':_0x5c6de3['id'],'module_name':_0x7db7('0x1e'),'name_value_list':_0x43463a})}});}function getAuth(_0x38e6c6){return util['format'](_0x7db7('0x1f'),new Buffer(_0x38e6c6['apiKey']+':X')['toString'](_0x7db7('0x20')));}function getServerInfo(_0xab1d3f){return request({'form':{'method':_0x7db7('0x21'),'input_type':'JSON','response_type':_0x7db7('0x1d'),'rest_data':JSON[_0x7db7('0x22')]({'session':_0xab1d3f['id']})}});}function getUser(_0x38a9c1,_0x466a46,_0xdf7df3){if(!_[_0x7db7('0x23')](_0x466a46)){logger['info'](_0x7db7('0x24'),_0x466a46);return request({'form':{'method':_0x7db7('0x25'),'input_type':'JSON','response_type':_0x7db7('0x1d'),'rest_data':JSON[_0x7db7('0x22')]({'session':_0xdf7df3['id'],'module_name':_0x7db7('0x26'),'query':util[_0x7db7('0x27')](_0x7db7('0x28'),_0x466a46),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7db7('0x29')](function(_0xc54a49){if(_0xc54a49[_0x7db7('0x2a')]['length']){var _0xc09f67=_[_0x7db7('0x2b')](_0xc54a49[_0x7db7('0x2a')],function(_0x16443e){return _0x16443e[_0x7db7('0x2c')][_0x7db7('0x2d')]['value']===_0x466a46;});if(_0xc09f67){logger[_0x7db7('0x9')](_0x7db7('0x2e'));return BPromise[_0x7db7('0x2f')]({'id':_0xc09f67[_0x7db7('0x2c')]['id'][_0x7db7('0x30')],'name':_0xc09f67[_0x7db7('0x2c')][_0x7db7('0xb')][_0x7db7('0x30')]});}}logger[_0x7db7('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xdf7df3['name_value_list'][_0x7db7('0x31')][_0x7db7('0x30')],'name':_0xdf7df3[_0x7db7('0x2c')][_0x7db7('0x2d')][_0x7db7('0x30')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7db7('0x2f')]({'id':_0xdf7df3[_0x7db7('0x2c')][_0x7db7('0x31')][_0x7db7('0x30')],'name':_0xdf7df3[_0x7db7('0x2c')]['user_name'][_0x7db7('0x30')]});}}function getEndUser(_0x240e3a,_0x4ab9ed,_0x3f0500,_0x29efc3){logger[_0x7db7('0x9')](_0x7db7('0x32'),_0x3f0500);return request({'form':{'method':_0x7db7('0x25'),'input_type':_0x7db7('0x1d'),'response_type':_0x7db7('0x1d'),'rest_data':JSON['stringify']({'session':_0x29efc3['id'],'module_name':_0x7db7('0x18'),'query':util[_0x7db7('0x27')](_0x7db7('0x33'),_0x3f0500),'order_by':'','offset':'0','select_fields':['id',_0x7db7('0xb'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7db7('0x29')](function(_0x2a13c4){if(_0x2a13c4[_0x7db7('0x2a')][_0x7db7('0x19')]){var _0x57a06d=_[_0x7db7('0x2b')](_0x2a13c4[_0x7db7('0x2a')],function(_0x316cef){return _0x316cef[_0x7db7('0x2c')][_0x7db7('0x34')]['value']===_0x3f0500;});if(_0x57a06d){logger[_0x7db7('0x9')](_0x7db7('0x35'));return BPromise[_0x7db7('0x2f')]({'id':_0x57a06d[_0x7db7('0x2c')]['id'][_0x7db7('0x30')],'name':_0x57a06d[_0x7db7('0x2c')]['name'][_0x7db7('0x30')],'phone':_0x57a06d[_0x7db7('0x2c')][_0x7db7('0x34')][_0x7db7('0x30')]});}}else{logger['info'](_0x7db7('0x36'));return request({'form':{'method':_0x7db7('0x1c'),'input_type':_0x7db7('0x1d'),'response_type':'JSON','rest_data':JSON[_0x7db7('0x22')]({'session':_0x29efc3['id'],'module_name':_0x7db7('0x18'),'name_value_list':[{'name':_0x7db7('0x37'),'value':_0x4ab9ed!==_0x7db7('0x38')?_0x4ab9ed:util[_0x7db7('0x27')]('Caller\x20-\x20%s',_0x3f0500)},{'name':_0x7db7('0x34'),'value':_0x3f0500}]})}})[_0x7db7('0x29')](function(_0x1b483f){logger['info'](_0x7db7('0x39'));return BPromise[_0x7db7('0x2f')]({'id':_0x1b483f['id'],'name':_0x1b483f[_0x7db7('0x2a')]['first_name']['value'],'phone':_0x1b483f['entry_list'][_0x7db7('0x34')]['value']});});}});}function request(_0x4b715e){logger[_0x7db7('0x3a')](_0x7db7('0x3b'),JSON[_0x7db7('0x22')](_0x4b715e));return rp(_[_0x7db7('0x3c')](def,_0x4b715e));}function getTags(_0x3eb661,_0x5ea889){var _0x1bf9b3=[];if(_0x3eb661&&_0x3eb661[_0x7db7('0x19')]>0x0){_0x1bf9b3=_[_0x7db7('0x3d')](_0x3eb661,_0x5ea889);}return _0x1bf9b3;}function getCustomFields(_0x3d8ae4,_0x2b96e8){var _0x89ecf8=[];var _0xeade54={'custom_fields':[]};if(_0x3d8ae4[_0x7db7('0x19')]>0x0){_[_0x7db7('0x1a')](_0x3d8ae4,function(_0x1ae9e4){if(_0x1ae9e4[_0x7db7('0x3e')]==='string'&&_0x1ae9e4[_0x7db7('0x3f')]&&!_0x1ae9e4['customField']){_0xeade54[_0x1ae9e4[_0x7db7('0x3f')][_0x7db7('0x40')]()]=_0x1ae9e4[_0x7db7('0x41')][_0x7db7('0x42')]();}else if(_0x1ae9e4[_0x7db7('0x3e')]===_0x7db7('0x43')&&_0x1ae9e4[_0x7db7('0x1b')]&&_0x1ae9e4[_0x7db7('0x44')]){_0xeade54[_0x7db7('0x45')][_0x7db7('0x46')]({'id':_0x1ae9e4['idField'],'value':_0x1ae9e4[_0x7db7('0x41')][_0x7db7('0x42')]()});}else if(_0x1ae9e4[_0x7db7('0x3e')]===_0x7db7('0x47')&&_0x1ae9e4[_0x7db7('0x48')]&&_0x1ae9e4[_0x7db7('0x1b')]&&_0x1ae9e4['customField']){_0x2b96e8[_0x1ae9e4[_0x7db7('0x48')]]&&_0xeade54[_0x7db7('0x45')][_0x7db7('0x46')]({'id':_0x1ae9e4[_0x7db7('0x1b')],'value':_0x2b96e8[_0x1ae9e4[_0x7db7('0x48')]]['toString']()});}else if(_0x1ae9e4['type']===_0x7db7('0x49')&&_0x1ae9e4['Variable']&&_0x1ae9e4['Variable']['name']&&_0x1ae9e4[_0x7db7('0x1b')]&&_0x1ae9e4['customField']){_0x2b96e8[_0x1ae9e4[_0x7db7('0x4a')][_0x7db7('0xb')][_0x7db7('0x40')]()]&&_0xeade54['custom_fields'][_0x7db7('0x46')]({'id':_0x1ae9e4[_0x7db7('0x1b')],'value':_0x2b96e8[_0x1ae9e4[_0x7db7('0x4a')][_0x7db7('0xb')][_0x7db7('0x40')]()][_0x7db7('0x42')]()});}});}return _0xeade54;}function getConnection(_0x5c6f8d){return request({'method':'POST','form':{'method':_0x7db7('0x4b'),'input_type':_0x7db7('0x1d'),'response_type':_0x7db7('0x1d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5c6f8d[_0x7db7('0x4c')],'password':_0x5c6f8d[_0x7db7('0x4d')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x442b9f){var _0xf0e80=_0x442b9f;if(_0xf0e80['id']){def['sessionID']=_0xf0e80['id'];return BPromise[_0x7db7('0x2f')](_0xf0e80);}else{throw new Error(util[_0x7db7('0x27')](_0x7db7('0x4e'),_0x5c6f8d['id']));}});}function setRelationship(_0xddbbe2,_0x48d2bb,_0x4c6559,_0x530359){return request({'form':{'method':_0x7db7('0x4f'),'input_type':_0x7db7('0x1d'),'response_type':_0x7db7('0x1d'),'rest_data':JSON[_0x7db7('0x22')]({'session':_0xddbbe2['id'],'module_name':_0x7db7('0x1e'),'module_id':_0x4c6559['id'],'link_field_name':_0x530359,'related_ids':[_0x48d2bb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7db7('0x50')]=function(_0x4e2cac,_0x59d298,_0x307a6d,_0x45a909,_0x3082d1,_0x26ef2f){var _0x3bda59,_0x5e5dea,_0x26a154,_0x2b7852;_0x26ef2f[_0x7db7('0x51')]=intUtil[_0x7db7('0x52')](_0x26ef2f[_0x7db7('0x51')]);_0x26ef2f['serverUrl']=intUtil[_0x7db7('0x52')](_0x26ef2f[_0x7db7('0x53')]);def[_0x7db7('0x54')]=util[_0x7db7('0x27')](_0x7db7('0x55'),_0x26ef2f['remoteUri']);if(_0x3082d1&&_0x3082d1[_0x7db7('0x56')]){logger[_0x7db7('0x9')](_0x7db7('0x57'),_0x7db7('0x58'));_0x59d298['recordingURL']=util[_0x7db7('0x27')](_0x7db7('0x59'),_0x26ef2f[_0x7db7('0x53')],_0x59d298[_0x7db7('0x5a')],md5(_0x59d298[_0x7db7('0x5a')]));}else{_0x59d298[_0x7db7('0x5b')]='';}return getConnection(_0x26ef2f)[_0x7db7('0x29')](function(_0x6ba8f5){_0x2b7852=_0x6ba8f5;return getUser(_0x26ef2f,_0x45a909[_0x7db7('0xb')],_0x2b7852);})[_0x7db7('0x29')](function(_0xdbaead){_0x3bda59=_0xdbaead;logger['info'](_0x7db7('0x5c'),_0x3bda59['id']);return getEndUser(_0x26ef2f,_0x59d298['calleridname'],_0x59d298[_0x7db7('0x5d')],_0x2b7852);})['then'](function(_0x47b2e5){_0x5e5dea=_0x47b2e5;logger[_0x7db7('0x9')](_0x7db7('0x5e'),_0x5e5dea['id']);return getTicket(_0x26ef2f,_0x3bda59,_0x5e5dea,_0x307a6d,_0x59d298,_0x307a6d[_0x7db7('0x5f')],_0x2b7852,_0x7db7('0x60'));})[_0x7db7('0x29')](function(_0x152da4){_0x26a154=_0x152da4;logger[_0x7db7('0x9')](_0x7db7('0x61'));logger[_0x7db7('0x9')](_0x7db7('0x62'),_0x26a154['id']);return setRelationship(_0x2b7852,_0x3bda59,_0x26a154,_0x7db7('0x63'));})[_0x7db7('0x29')](function(){return setRelationship(_0x2b7852,_0x5e5dea,_0x26a154,_0x7db7('0x64'));})[_0x7db7('0x29')](function(){return getServerInfo(_0x2b7852);})['then'](function(_0x16df9b){var _0x59f3bf=parseInt(_0x16df9b[_0x7db7('0x65')]['charAt'](0x0));var _0x4903d2=util[_0x7db7('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x26ef2f[_0x7db7('0x51')],_0x26a154['id']);if(_0x59f3bf>0x6){_0x4903d2=util[_0x7db7('0x27')](_0x7db7('0x66'),_0x26ef2f[_0x7db7('0x51')],_0x26a154['id']);}logger[_0x7db7('0x9')](_0x7db7('0x57'),_0x7db7('0x67'));emit(util[_0x7db7('0x27')](_0x7db7('0x68'),_0x45a909[_0x7db7('0xb')]),_0x7db7('0x69'),{'uri':_0x4903d2});})[_0x7db7('0x6a')](function(_0x29e5cd){logger[_0x7db7('0x6b')](_0x7db7('0x57'),JSON[_0x7db7('0x22')](_0x29e5cd));});};exports[_0x7db7('0x6c')]=function(_0x5b8b1a,_0x31cc07,_0x491527,_0x47b640,_0xdd8312,_0x21e2f5,_0x312418){var _0x4b8bda,_0x18bbcd,_0x148835,_0x3cbfe4;_0x21e2f5['remoteUri']=intUtil[_0x7db7('0x52')](_0x21e2f5[_0x7db7('0x51')]);_0x21e2f5[_0x7db7('0x53')]=intUtil['stripTrailingSlash'](_0x21e2f5[_0x7db7('0x53')]);def[_0x7db7('0x54')]=util[_0x7db7('0x27')]('%s/service/v4_1/rest.php',_0x21e2f5['remoteUri']);if(_0x312418&&_0x312418['recordingFormat']&&_0x312418['recordingFormat']!=='none'){logger['info'](_0x7db7('0x6d'),_0x7db7('0x58'));_0x31cc07[_0x7db7('0x5b')]=util[_0x7db7('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21e2f5[_0x7db7('0x53')],_0x31cc07[_0x7db7('0x5a')],md5(_0x31cc07['uniqueid']));}return getConnection(_0x21e2f5)[_0x7db7('0x29')](function(_0x3716e6){_0x3cbfe4=_0x3716e6;return getUser(_0x21e2f5,_0x47b640[_0x7db7('0xb')],_0x3cbfe4);})['then'](function(_0xe9d710){_0x4b8bda=_0xe9d710;logger[_0x7db7('0x9')]('The\x20User\x20ID\x20is:',_0x4b8bda['id']);return getEndUser(_0x21e2f5,_0x31cc07['destcalleridname'],_0x31cc07[_0x7db7('0x6e')],_0x3cbfe4);})[_0x7db7('0x29')](function(_0x105cd3){_0x18bbcd=_0x105cd3;logger['info'](_0x7db7('0x5e'),_0x18bbcd['id']);return getTicket(_0x21e2f5,_0x4b8bda,_0x18bbcd,_0x491527,_0x31cc07,_0x491527['Fields'],_0x3cbfe4,_0x7db7('0x6f'));})[_0x7db7('0x29')](function(_0x1897af){_0x148835=_0x1897af;logger[_0x7db7('0x9')]('Ticket\x20created!');logger[_0x7db7('0x9')](_0x7db7('0x62'),_0x148835['id']);return setRelationship(_0x3cbfe4,_0x4b8bda,_0x148835,_0x7db7('0x63'));})[_0x7db7('0x29')](function(){return setRelationship(_0x3cbfe4,_0x18bbcd,_0x148835,'contacts');})[_0x7db7('0x29')](function(){return getServerInfo(_0x3cbfe4);})[_0x7db7('0x29')](function(_0x35484b){var _0x1623c9=parseInt(_0x35484b[_0x7db7('0x65')]['charAt'](0x0));var _0x49527c=util['format'](_0x7db7('0x70'),_0x21e2f5[_0x7db7('0x51')],_0x148835['id']);if(_0x1623c9>0x6){_0x49527c=util[_0x7db7('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x21e2f5['remoteUri'],_0x148835['id']);}logger['info'](_0x7db7('0x6d'),_0x7db7('0x67'));emit(util[_0x7db7('0x27')](_0x7db7('0x68'),_0x47b640[_0x7db7('0xb')]),_0x7db7('0x69'),{'uri':_0x49527c});})['catch'](function(_0x5e7737){logger[_0x7db7('0x6b')]('[OUTBOUND]',JSON[_0x7db7('0x22')](_0x5e7737));});};exports[_0x7db7('0x71')]=function(_0x29e4d8,_0x471544,_0x54fe94,_0x2e4212,_0x250b7c,_0x3abfc5){var _0x54ad60,_0x59ff8a,_0xea2e9d,_0x6b17f6;_0x3abfc5['remoteUri']=intUtil[_0x7db7('0x52')](_0x3abfc5[_0x7db7('0x51')]);_0x3abfc5['serverUrl']=intUtil[_0x7db7('0x52')](_0x3abfc5[_0x7db7('0x53')]);def['uri']=util[_0x7db7('0x27')]('%s/service/v4_1/rest.php',_0x3abfc5[_0x7db7('0x51')]);if(_0x250b7c&&_0x250b7c['monitor_format']){logger[_0x7db7('0x9')]('['+_0x471544[_0x7db7('0x72')][_0x7db7('0x73')]()+']',_0x7db7('0x58'));_0x471544[_0x7db7('0x5b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3abfc5[_0x7db7('0x53')],_0x471544[_0x7db7('0x5a')],md5(_0x471544[_0x7db7('0x5a')]));}else{_0x471544['recordingURL']='';}return getConnection(_0x3abfc5)[_0x7db7('0x29')](function(_0x12165c){_0x6b17f6=_0x12165c;if(!_[_0x7db7('0x23')](_0x2e4212)){return getUser(_0x3abfc5,_0x2e4212[_0x7db7('0xb')],_0x6b17f6);}else{return getUser(_0x3abfc5,null,_0x6b17f6);}})[_0x7db7('0x29')](function(_0x1f94d5){_0x54ad60=_0x1f94d5;logger[_0x7db7('0x9')](_0x7db7('0x5c'),_0x54ad60['id']);return getEndUser(_0x3abfc5,_0x471544[_0x7db7('0x74')],_0x471544['calleridnum'],_0x6b17f6);})[_0x7db7('0x29')](function(_0x348a53){_0x59ff8a=_0x348a53;logger['info'](_0x7db7('0x5e'),_0x59ff8a['id']);return getTicket(_0x3abfc5,_0x54ad60,_0x59ff8a,_0x54fe94,_0x471544,_0x54fe94[_0x7db7('0x5f')],_0x6b17f6,_0x7db7('0x60'));})['then'](function(_0x613d92){_0xea2e9d=_0x613d92;logger[_0x7db7('0x9')](_0x7db7('0x61'));logger['info'](_0x7db7('0x62'),_0xea2e9d['id']);return setRelationship(_0x6b17f6,_0x54ad60,_0xea2e9d,'users');})[_0x7db7('0x29')](function(){return setRelationship(_0x6b17f6,_0x59ff8a,_0xea2e9d,'contacts');})[_0x7db7('0x29')](function(){return getServerInfo(_0x6b17f6);})[_0x7db7('0x6a')](function(_0xfe6c2f){logger['error']('['+_0x471544[_0x7db7('0x72')][_0x7db7('0x73')]()+']',JSON[_0x7db7('0x22')](_0xfe6c2f));});};
\ No newline at end of file
index f5582d6..6f40221 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa6ca=['format','key','keyContent','keyType','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x4dcd3b,_0x2fa37b){var _0x37c0ca=function(_0x27d5dd){while(--_0x27d5dd){_0x4dcd3b['push'](_0x4dcd3b['shift']());}};_0x37c0ca(++_0x2fa37b);}(_0xa6ca,0x1aa));var _0xaa6c=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xa6ca[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xaa6c('0x0'));var util=require(_0xaa6c('0x1'));exports['getString']=function(_0x6ae325,_0xe62323,_0x3467c7){var _0x16e5a5=[];if(_0x6ae325[_0xaa6c('0x2')]>0x0){var _0x28b60f=_[_0xaa6c('0x3')](_0x6ae325,['id']);for(var _0x3f625a=0x0;_0x3f625a<_0x28b60f['length'];_0x3f625a++){var _0x5a77f5=_0x28b60f[_0x3f625a];if(_0x5a77f5[_0xaa6c('0x4')]===_0xaa6c('0x5')){_0x16e5a5[_0xaa6c('0x6')](_0x5a77f5[_0xaa6c('0x7')]);}else if(_0x5a77f5[_0xaa6c('0x4')]===_0xaa6c('0x8')&&_0x5a77f5[_0xaa6c('0x9')]){_0xe62323[_0x5a77f5['variableName']]&&_0x16e5a5[_0xaa6c('0x6')](_0xe62323[_0x5a77f5['variableName']][_0xaa6c('0xa')]());}else if(_0x5a77f5[_0xaa6c('0x4')]===_0xaa6c('0xb')&&_0x5a77f5[_0xaa6c('0xc')]&&_0x5a77f5[_0xaa6c('0xc')]['name']){_0xe62323[_0x5a77f5[_0xaa6c('0xc')][_0xaa6c('0xd')]['toLowerCase']()]&&_0x16e5a5[_0xaa6c('0x6')](_0xe62323[_0x5a77f5[_0xaa6c('0xc')][_0xaa6c('0xd')][_0xaa6c('0xe')]()][_0xaa6c('0xa')]());}else if(_0x5a77f5[_0xaa6c('0x4')]===_0xaa6c('0xf')){if(_0x5a77f5['keyType']===_0xaa6c('0x5')&&_0x5a77f5['key']){_0x16e5a5[_0xaa6c('0x6')](util[_0xaa6c('0x10')]('%s:\x20%s',_0x5a77f5[_0xaa6c('0x11')],_0x5a77f5[_0xaa6c('0x12')]));}else if(_0x5a77f5[_0xaa6c('0x13')]===_0xaa6c('0x8')&&_0x5a77f5[_0xaa6c('0x9')]&&_0x5a77f5['key']){_0xe62323[_0x5a77f5['variableName']]&&_0x16e5a5[_0xaa6c('0x6')](util[_0xaa6c('0x10')]('%s:\x20%s',_0x5a77f5[_0xaa6c('0x11')],_0xe62323[_0x5a77f5[_0xaa6c('0x9')]]));}else if(_0x5a77f5[_0xaa6c('0x13')]===_0xaa6c('0xb')&&_0x5a77f5['Variable']&&_0x5a77f5[_0xaa6c('0xc')]['name']&&_0x5a77f5[_0xaa6c('0x11')]){_0xe62323[_0x5a77f5[_0xaa6c('0xc')][_0xaa6c('0xd')][_0xaa6c('0xe')]()]&&_0x16e5a5['push'](util[_0xaa6c('0x10')]('%s:\x20%s',_0x5a77f5['key'],_0xe62323[_0x5a77f5[_0xaa6c('0xc')]['name'][_0xaa6c('0xe')]()]));}}}}return _0x16e5a5[_0xaa6c('0x14')](_0x3467c7);};exports[_0xaa6c('0x15')]=function(_0x2e3003){var _0x1cefc5=_0x2e3003['slice'](-0x1);if(_0x1cefc5==='/'){_0x2e3003=_0x2e3003[_0xaa6c('0x16')](0x0,_0x2e3003[_0xaa6c('0x17')](_0x1cefc5));}return _0x2e3003;};exports[_0xaa6c('0x18')]=function(_0x4f005f){if(!_['isNil'](_0x4f005f)&&_0x4f005f!==''){var _0x3bed78=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3bed78[_0xaa6c('0x19')](String(_0x4f005f)[_0xaa6c('0xe')]());}else{return![];}};
\ No newline at end of file
+var _0xc439=['slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variable','variableName','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','customVariable','join'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xc439,0x14a));var _0x9c43=function(_0x542283,_0x3688f2){_0x542283=_0x542283-0x0;var _0x49149b=_0xc439[_0x542283];return _0x49149b;};'use strict';var _=require(_0x9c43('0x0'));var util=require(_0x9c43('0x1'));exports[_0x9c43('0x2')]=function(_0x22b571,_0x19ea65,_0x46038e){var _0x1ed414=[];if(_0x22b571[_0x9c43('0x3')]>0x0){var _0x2c84d1=_['sortBy'](_0x22b571,['id']);for(var _0x4c1f8b=0x0;_0x4c1f8b<_0x2c84d1[_0x9c43('0x3')];_0x4c1f8b++){var _0x1a9edf=_0x2c84d1[_0x4c1f8b];if(_0x1a9edf[_0x9c43('0x4')]===_0x9c43('0x5')){_0x1ed414[_0x9c43('0x6')](_0x1a9edf[_0x9c43('0x7')]);}else if(_0x1a9edf[_0x9c43('0x4')]===_0x9c43('0x8')&&_0x1a9edf['variableName']){_0x19ea65[_0x1a9edf[_0x9c43('0x9')]]&&_0x1ed414[_0x9c43('0x6')](_0x19ea65[_0x1a9edf['variableName']]['toString']());}else if(_0x1a9edf[_0x9c43('0x4')]==='customVariable'&&_0x1a9edf[_0x9c43('0xa')]&&_0x1a9edf[_0x9c43('0xa')]['name']){_0x19ea65[_0x1a9edf[_0x9c43('0xa')][_0x9c43('0xb')][_0x9c43('0xc')]()]&&_0x1ed414[_0x9c43('0x6')](_0x19ea65[_0x1a9edf[_0x9c43('0xa')][_0x9c43('0xb')][_0x9c43('0xc')]()]['toString']());}else if(_0x1a9edf[_0x9c43('0x4')]===_0x9c43('0xd')){if(_0x1a9edf['keyType']==='string'&&_0x1a9edf[_0x9c43('0xe')]){_0x1ed414[_0x9c43('0x6')](util[_0x9c43('0xf')](_0x9c43('0x10'),_0x1a9edf[_0x9c43('0xe')],_0x1a9edf[_0x9c43('0x11')]));}else if(_0x1a9edf[_0x9c43('0x12')]===_0x9c43('0x8')&&_0x1a9edf['variableName']&&_0x1a9edf[_0x9c43('0xe')]){_0x19ea65[_0x1a9edf[_0x9c43('0x9')]]&&_0x1ed414[_0x9c43('0x6')](util[_0x9c43('0xf')](_0x9c43('0x10'),_0x1a9edf['key'],_0x19ea65[_0x1a9edf[_0x9c43('0x9')]]));}else if(_0x1a9edf['keyType']===_0x9c43('0x13')&&_0x1a9edf[_0x9c43('0xa')]&&_0x1a9edf['Variable']['name']&&_0x1a9edf[_0x9c43('0xe')]){_0x19ea65[_0x1a9edf[_0x9c43('0xa')][_0x9c43('0xb')][_0x9c43('0xc')]()]&&_0x1ed414['push'](util[_0x9c43('0xf')]('%s:\x20%s',_0x1a9edf[_0x9c43('0xe')],_0x19ea65[_0x1a9edf['Variable']['name'][_0x9c43('0xc')]()]));}}}}return _0x1ed414[_0x9c43('0x14')](_0x46038e);};exports['stripTrailingSlash']=function(_0x33cd5f){var _0xbde00a=_0x33cd5f[_0x9c43('0x15')](-0x1);if(_0xbde00a==='/'){_0x33cd5f=_0x33cd5f[_0x9c43('0x16')](0x0,_0x33cd5f[_0x9c43('0x17')](_0xbde00a));}return _0x33cd5f;};exports[_0x9c43('0x18')]=function(_0x2d4d7a){if(!_[_0x9c43('0x19')](_0x2d4d7a)&&_0x2d4d7a!==''){var _0x5cfdb7=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x5cfdb7[_0x9c43('0x1a')](String(_0x2d4d7a)[_0x9c43('0xc')]());}else{return![];}};
\ No newline at end of file
index ebb802e..8dfeb73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x53859e,_0x2881ff){var _0x474194=function(_0x5080ea){while(--_0x5080ea){_0x53859e['push'](_0x53859e['shift']());}};_0x474194(++_0x2881ff);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});};
\ No newline at end of file
+var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x35452e,_0x30eb8b){var _0x11a7ec=function(_0x38935f){while(--_0x38935f){_0x35452e['push'](_0x35452e['shift']());}};_0x11a7ec(++_0x30eb8b);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});};
\ No newline at end of file
index 2b95a04..284aacf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb484=['%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/agent/tickets/%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','type','nameField','customField','toLowerCase','content','string','picklist','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0xb484,0xfb));var _0x4b48=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xb484[_0x5ac1e5];return _0x1bccc6;};'use strict';var _=require(_0x4b48('0x0'));var rp=require('request-promise');var md5=require(_0x4b48('0x1'));var util=require('util');var Redis=require(_0x4b48('0x2'));var intUtil=require('./util');var config=require(_0x4b48('0x3'));var logger=require(_0x4b48('0x4'))(_0x4b48('0x5'));config['redis']=_[_0x4b48('0x6')](config[_0x4b48('0x7')],{'host':_0x4b48('0x8'),'port':0x18eb});var io=require(_0x4b48('0x9'))(new Redis(config['redis']));function emit(_0x180568,_0x22d308,_0x413994){io['to'](_0x180568)[_0x4b48('0xa')](_0x22d308,_0x413994);}var headers={'Content-Type':_0x4b48('0xb'),'Accept':_0x4b48('0xb')};function getTicket(_0x57ee55,_0x43a52f,_0x3f571b,_0x577817,_0x24843a){logger[_0x4b48('0xc')](_0x4b48('0xd'));return request({'uri':util[_0x4b48('0xe')](_0x4b48('0xf'),_0x57ee55[_0x4b48('0x10')]),'method':'POST','body':{'ticket':_[_0x4b48('0x11')]({'requester_id':_0x3f571b['id'],'submitter_id':_0x43a52f?_0x43a52f['id']:undefined,'assignee_id':_0x43a52f?_0x43a52f['id']:undefined,'tags':getTags(_0x577817['Tags'],_0x4b48('0x12')),'subject':intUtil[_0x4b48('0x13')](_0x577817['Subjects'],_0x24843a,'\x20'),'description':intUtil[_0x4b48('0x13')](_0x577817[_0x4b48('0x14')],_0x24843a,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4b48('0x13')](_0x577817[_0x4b48('0x14')],_0x24843a,'\x0a')}},getCustomFields(_0x577817[_0x4b48('0x15')],_0x24843a))}})['then'](function(_0x263704){logger[_0x4b48('0xc')](_0x4b48('0x16'));return _0x263704[_0x4b48('0x17')];});}function getUser(_0x5aaa97,_0x13330e){if(intUtil['validateEmail'](_0x13330e)){logger['info'](_0x4b48('0x18'),_0x13330e);return request({'uri':util[_0x4b48('0xe')](_0x4b48('0x19'),_0x5aaa97[_0x4b48('0x10')]),'qs':{'query':util[_0x4b48('0xe')](_0x4b48('0x1a'),_0x13330e)}})[_0x4b48('0x1b')](function(_0xd6e807){if(_0xd6e807[_0x4b48('0x1c')]){logger[_0x4b48('0xc')]('Agent\x20found!');return _[_0x4b48('0x1d')](_0xd6e807[_0x4b48('0x1e')],{'email':_0x13330e,'role':_0x4b48('0x1f')});}else{logger[_0x4b48('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4b48('0xe')](_0x4b48('0x20'),_0x5aaa97[_0x4b48('0x10')])})[_0x4b48('0x1b')](function(_0x5ead25){logger[_0x4b48('0xc')](_0x4b48('0x21'));return _0x5ead25[_0x4b48('0x22')];});}});}else{logger[_0x4b48('0xc')](_0x4b48('0x23'));return request({'uri':util['format'](_0x4b48('0x20'),_0x5aaa97['remoteUri'])})[_0x4b48('0x1b')](function(_0x1540d6){logger[_0x4b48('0xc')](_0x4b48('0x21'));return _0x1540d6['user'];});}}function getEndUser(_0xf67730,_0x432dd1,_0x5db396){logger[_0x4b48('0xc')](_0x4b48('0x24'),_0x5db396);return request({'uri':util['format']('%s/search.json',_0xf67730[_0x4b48('0x10')]),'qs':{'query':util[_0x4b48('0xe')](_0x4b48('0x25'),_0x5db396)}})[_0x4b48('0x1b')](function(_0x31ba90){var _0x5d6fac;if(_0x31ba90[_0x4b48('0x1e')]['length']){_0x31ba90[_0x4b48('0x1e')]=_[_0x4b48('0x26')](_0x31ba90[_0x4b48('0x1e')],{'suspended':![],'role':'end-user'});if(_0x31ba90[_0x4b48('0x1e')][_0x4b48('0x27')]){_0x5d6fac=_['first'](_0x31ba90[_0x4b48('0x1e')]);}}if(_0x5d6fac){logger[_0x4b48('0xc')](_0x4b48('0x28'));return _0x5d6fac;}else{logger[_0x4b48('0xc')](_0x4b48('0x29'));return request({'uri':util[_0x4b48('0xe')]('%s/users.json',_0xf67730[_0x4b48('0x10')]),'method':_0x4b48('0x2a'),'body':{'user':{'role':'end-user','name':util[_0x4b48('0xe')](_0x4b48('0x2b'),_0x432dd1||_0x5db396),'phone':_0x5db396}}})['then'](function(_0xa2041){logger[_0x4b48('0xc')](_0x4b48('0x2c'));return _0xa2041[_0x4b48('0x22')];});}});}function getAuth(_0xddd9c){var _0x28d217;if(_0xddd9c[_0x4b48('0x2d')]===_0x4b48('0x2e')){_0x28d217=util['format'](_0x4b48('0x2f'),_0xddd9c['username'],_0xddd9c[_0x4b48('0x2e')]);}else if(_0xddd9c[_0x4b48('0x2d')]===_0x4b48('0x30')){_0x28d217=util['format']('%s/token:%s',_0xddd9c[_0x4b48('0x31')],_0xddd9c[_0x4b48('0x30')]);}return util[_0x4b48('0xe')](_0x4b48('0x32'),new Buffer(_0x28d217)[_0x4b48('0x33')](_0x4b48('0x34')));}function request(_0x4d919a){logger[_0x4b48('0x35')](_0x4b48('0x36'),JSON[_0x4b48('0x37')](_0x4d919a));return rp(_[_0x4b48('0x6')](_0x4d919a,{'method':_0x4b48('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x335174,_0x574522){var _0x103667=[];if(_0x335174&&_0x335174['length']>0x0){_0x103667=_['map'](_0x335174,_0x574522);}return _0x103667;}function getCustomFields(_0x514786,_0x2cdd83){var _0x415282=[];var _0xdf6f18={'custom_fields':[]};if(_0x514786[_0x4b48('0x27')]>0x0){_[_0x4b48('0x39')](_0x514786,function(_0x26f941){if(_[_0x4b48('0x3a')](['string','picklist'],_0x26f941[_0x4b48('0x3b')])&&_0x26f941[_0x4b48('0x3c')]&&!_0x26f941[_0x4b48('0x3d')]){_0xdf6f18[_0x26f941[_0x4b48('0x3c')][_0x4b48('0x3e')]()]=_0x26f941[_0x4b48('0x3f')]['toString']();}else if(_[_0x4b48('0x3a')]([_0x4b48('0x40'),_0x4b48('0x41')],_0x26f941[_0x4b48('0x3b')])&&_0x26f941[_0x4b48('0x42')]&&_0x26f941[_0x4b48('0x3d')]){_0xdf6f18[_0x4b48('0x43')]['push']({'id':_0x26f941[_0x4b48('0x42')],'value':_0x26f941[_0x4b48('0x3f')][_0x4b48('0x33')]()});}else if(_0x26f941['type']===_0x4b48('0x44')&&_0x26f941[_0x4b48('0x45')]&&_0x26f941['idField']&&_0x26f941[_0x4b48('0x3d')]){_0x2cdd83[_0x26f941['variableName']]&&_0xdf6f18[_0x4b48('0x43')][_0x4b48('0x46')]({'id':_0x26f941[_0x4b48('0x42')],'value':_0x2cdd83[_0x26f941['variableName']][_0x4b48('0x33')]()});}else if(_0x26f941[_0x4b48('0x3b')]===_0x4b48('0x47')&&_0x26f941[_0x4b48('0x48')]&&_0x26f941[_0x4b48('0x48')][_0x4b48('0x12')]&&_0x26f941[_0x4b48('0x42')]&&_0x26f941['customField']){_0x2cdd83[_0x26f941[_0x4b48('0x48')][_0x4b48('0x12')][_0x4b48('0x3e')]()]&&_0xdf6f18['custom_fields'][_0x4b48('0x46')]({'id':_0x26f941[_0x4b48('0x42')],'value':_0x2cdd83[_0x26f941[_0x4b48('0x48')][_0x4b48('0x12')]['toLowerCase']()][_0x4b48('0x33')]()});}});}return _0xdf6f18;}exports[_0x4b48('0x49')]=function(_0x34791b,_0x30e553,_0x242d95,_0x438e4d,_0x556f1a,_0x11ee9d){var _0x22f1e0,_0x2c4c33;_0x11ee9d[_0x4b48('0x10')]=intUtil[_0x4b48('0x4a')](_0x11ee9d['remoteUri']);_0x11ee9d[_0x4b48('0x4b')]=intUtil['stripTrailingSlash'](_0x11ee9d[_0x4b48('0x4b')]);if(_0x556f1a&&_0x556f1a['monitor_format']){logger[_0x4b48('0xc')](_0x4b48('0x4c'),_0x4b48('0x4d'));_0x30e553['recordingURL']=util[_0x4b48('0xe')](_0x4b48('0x4e'),_0x11ee9d[_0x4b48('0x4b')],_0x30e553[_0x4b48('0x4f')],md5(_0x30e553['uniqueid']));}else{_0x30e553[_0x4b48('0x50')]='';}headers[_0x4b48('0x51')]=getAuth(_0x11ee9d);return getUser(_0x11ee9d,_0x438e4d[_0x4b48('0x52')])[_0x4b48('0x1b')](function(_0x1fe801){_0x22f1e0=_0x1fe801;logger[_0x4b48('0xc')]('The\x20User\x20ID\x20is:',_0x22f1e0['id']);return getEndUser(_0x11ee9d,_0x30e553['calleridname'],_0x30e553[_0x4b48('0x53')]);})[_0x4b48('0x1b')](function(_0x1db549){_0x2c4c33=_0x1db549;logger[_0x4b48('0xc')](_0x4b48('0x54'),_0x2c4c33['id']);return getTicket(_0x11ee9d,_0x22f1e0,_0x2c4c33,_0x242d95,_0x30e553);})['then'](function(_0x4f8439){if(_0x4f8439){logger[_0x4b48('0xc')](_0x4b48('0x55'),_0x4f8439['id']);switch(_0x11ee9d[_0x4b48('0x3b')]){case _0x4b48('0x56'):logger['info'](_0x4b48('0x4c'),_0x4b48('0x57'));return request({'uri':util[_0x4b48('0xe')](_0x4b48('0x58'),_0x11ee9d[_0x4b48('0x10')],_0x22f1e0['id'],_0x4f8439['id']),'method':_0x4b48('0x2a')});case _0x4b48('0x59'):logger['info']('[QUEUE]',_0x4b48('0x5a'));emit(util[_0x4b48('0xe')](_0x4b48('0x5b'),_0x438e4d['name']),_0x4b48('0x5c'),{'uri':util[_0x4b48('0xe')]('%s/agent/tickets/%s',_0x11ee9d[_0x4b48('0x10')][_0x4b48('0x5d')](_0x4b48('0x5e'),''),_0x4f8439['id'])});break;default:logger[_0x4b48('0x5f')](_0x4b48('0x4c'),_0x4b48('0x60'));}}})['catch'](function(_0x10763a){logger[_0x4b48('0x5f')](_0x4b48('0x61'),util[_0x4b48('0x62')](_0x10763a,{'showHidden':!![],'depth':null}));});};exports[_0x4b48('0x63')]=function(_0x44e531,_0x46439b,_0x1f1f08,_0x53448c,_0x4d8ca9,_0x39260c,_0x1e30fe){var _0x2b6e21,_0x255bcd;_0x39260c[_0x4b48('0x10')]=intUtil[_0x4b48('0x4a')](_0x39260c[_0x4b48('0x10')]);_0x39260c[_0x4b48('0x4b')]=intUtil[_0x4b48('0x4a')](_0x39260c[_0x4b48('0x4b')]);if(_0x1e30fe&&_0x1e30fe[_0x4b48('0x64')]&&_0x1e30fe[_0x4b48('0x64')]!==_0x4b48('0x65')){logger[_0x4b48('0xc')](_0x4b48('0x66'),_0x4b48('0x4d'));_0x46439b[_0x4b48('0x50')]=util[_0x4b48('0xe')](_0x4b48('0x4e'),_0x39260c[_0x4b48('0x4b')],_0x46439b[_0x4b48('0x4f')],md5(_0x46439b['uniqueid']));}headers['Authorization']=getAuth(_0x39260c);return getUser(_0x39260c,_0x53448c[_0x4b48('0x52')])['then'](function(_0x2c39ca){_0x2b6e21=_0x2c39ca;logger[_0x4b48('0xc')](_0x4b48('0x67'),_0x2b6e21['id']);return getEndUser(_0x39260c,_0x46439b[_0x4b48('0x68')],_0x46439b[_0x4b48('0x69')]);})[_0x4b48('0x1b')](function(_0x1cd9b3){_0x255bcd=_0x1cd9b3;logger[_0x4b48('0xc')](_0x4b48('0x54'),_0x255bcd['id']);return getTicket(_0x39260c,_0x2b6e21,_0x255bcd,_0x1f1f08,_0x46439b);})[_0x4b48('0x1b')](function(_0x217121){if(_0x217121){logger['info'](_0x4b48('0x55'),_0x217121['id']);switch(_0x39260c[_0x4b48('0x3b')]){case _0x4b48('0x56'):logger[_0x4b48('0xc')](_0x4b48('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4b48('0xe')](_0x4b48('0x58'),_0x39260c[_0x4b48('0x10')],_0x2b6e21['id'],_0x217121['id']),'method':_0x4b48('0x2a')});case _0x4b48('0x59'):logger[_0x4b48('0xc')](_0x4b48('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4b48('0xe')](_0x4b48('0x5b'),_0x53448c[_0x4b48('0x12')]),_0x4b48('0x5c'),{'uri':util[_0x4b48('0xe')](_0x4b48('0x6a'),_0x39260c[_0x4b48('0x10')][_0x4b48('0x5d')]('/api/v2',''),_0x217121['id'])});break;default:logger[_0x4b48('0x5f')](_0x4b48('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x4b48('0x6b')](function(_0x3b2133){logger[_0x4b48('0x5f')](_0x4b48('0x6c'),util['inspect'](_0x3b2133,{'showHidden':!![],'depth':null}));});};exports[_0x4b48('0x6d')]=function(_0xf8c68a,_0x4adece,_0x2fc650,_0x520b56,_0x5c8fba,_0x31bc3d){var _0x2c2899,_0x5cf28c;_0x31bc3d[_0x4b48('0x10')]=intUtil[_0x4b48('0x4a')](_0x31bc3d[_0x4b48('0x10')]);_0x31bc3d[_0x4b48('0x4b')]=intUtil['stripTrailingSlash'](_0x31bc3d['serverUrl']);if(_0x5c8fba&&_0x5c8fba['monitor_format']){logger[_0x4b48('0xc')]('['+_0x4adece[_0x4b48('0x6e')]['toUpperCase']()+']',_0x4b48('0x4d'));_0x4adece[_0x4b48('0x50')]=util[_0x4b48('0xe')](_0x4b48('0x4e'),_0x31bc3d[_0x4b48('0x4b')],_0x4adece['uniqueid'],md5(_0x4adece[_0x4b48('0x4f')]));}else{_0x4adece[_0x4b48('0x50')]='';}headers[_0x4b48('0x51')]=getAuth(_0x31bc3d);return getUser(_0x31bc3d)[_0x4b48('0x1b')](function(_0x3c07c8){_0x2c2899=_0x3c07c8;logger['info'](_0x4b48('0x67'),_0x2c2899['id']);return getEndUser(_0x31bc3d,_0x4adece[_0x4b48('0x6f')],_0x4adece[_0x4b48('0x53')]);})[_0x4b48('0x1b')](function(_0x51647f){_0x5cf28c=_0x51647f;logger[_0x4b48('0xc')](_0x4b48('0x54'),_0x5cf28c['id']);return getTicket(_0x31bc3d,_0x2c2899,_0x5cf28c,_0x2fc650,_0x4adece);})[_0x4b48('0x1b')](function(_0x496982){if(_0x496982){logger[_0x4b48('0xc')](_0x4b48('0x55'),_0x496982['id']);}})[_0x4b48('0x6b')](function(_0x3e7669){logger[_0x4b48('0x5f')]('['+_0x4adece[_0x4b48('0x6e')]['toUpperCase']()+']'+_0x4b48('0x70'),util['inspect'](_0x3e7669,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0xa2b8=['Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','catch','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','The\x20Enduser\x20ID\x20is:','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','Fields','then'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0xa2b8,0x19f));var _0x8a2b=function(_0x19f418,_0x106db3){_0x19f418=_0x19f418-0x0;var _0x5871cb=_0xa2b8[_0x19f418];return _0x5871cb;};'use strict';var _=require('lodash');var rp=require(_0x8a2b('0x0'));var md5=require('md5');var util=require(_0x8a2b('0x1'));var Redis=require(_0x8a2b('0x2'));var intUtil=require('./util');var config=require(_0x8a2b('0x3'));var logger=require('../../../../config/logger')(_0x8a2b('0x4'));config[_0x8a2b('0x5')]=_['defaults'](config[_0x8a2b('0x5')],{'host':_0x8a2b('0x6'),'port':0x18eb});var io=require(_0x8a2b('0x7'))(new Redis(config[_0x8a2b('0x5')]));function emit(_0x4da66f,_0x37b850,_0x292dcf){io['to'](_0x4da66f)[_0x8a2b('0x8')](_0x37b850,_0x292dcf);}var headers={'Content-Type':_0x8a2b('0x9'),'Accept':'application/json'};function getTicket(_0x3d7cf5,_0x3110c9,_0x4ae214,_0x132236,_0x1adecb){logger[_0x8a2b('0xa')](_0x8a2b('0xb'));return request({'uri':util['format'](_0x8a2b('0xc'),_0x3d7cf5['remoteUri']),'method':_0x8a2b('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x4ae214['id'],'submitter_id':_0x3110c9?_0x3110c9['id']:undefined,'assignee_id':_0x3110c9?_0x3110c9['id']:undefined,'tags':getTags(_0x132236[_0x8a2b('0xe')],_0x8a2b('0xf')),'subject':intUtil[_0x8a2b('0x10')](_0x132236[_0x8a2b('0x11')],_0x1adecb,'\x20'),'description':intUtil[_0x8a2b('0x10')](_0x132236['Descriptions'],_0x1adecb,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8a2b('0x10')](_0x132236[_0x8a2b('0x12')],_0x1adecb,'\x0a')}},getCustomFields(_0x132236[_0x8a2b('0x13')],_0x1adecb))}})[_0x8a2b('0x14')](function(_0x55fb6e){logger[_0x8a2b('0xa')](_0x8a2b('0x15'));return _0x55fb6e[_0x8a2b('0x16')];});}function getUser(_0x3507a5,_0x387722){if(intUtil['validateEmail'](_0x387722)){logger[_0x8a2b('0xa')](_0x8a2b('0x17'),_0x387722);return request({'uri':util[_0x8a2b('0x18')](_0x8a2b('0x19'),_0x3507a5[_0x8a2b('0x1a')]),'qs':{'query':util[_0x8a2b('0x18')]('type:user\x20role:agent\x20email:%s',_0x387722)}})[_0x8a2b('0x14')](function(_0x43114f){if(_0x43114f[_0x8a2b('0x1b')]){logger['info']('Agent\x20found!');return _[_0x8a2b('0x1c')](_0x43114f['results'],{'email':_0x387722,'role':_0x8a2b('0x1d')});}else{logger[_0x8a2b('0xa')](_0x8a2b('0x1e'));return request({'uri':util[_0x8a2b('0x18')]('%s/users/me.json',_0x3507a5['remoteUri'])})['then'](function(_0x247e4f){logger[_0x8a2b('0xa')](_0x8a2b('0x1f'));return _0x247e4f[_0x8a2b('0x20')];});}});}else{logger[_0x8a2b('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8a2b('0x18')](_0x8a2b('0x21'),_0x3507a5['remoteUri'])})['then'](function(_0x214871){logger[_0x8a2b('0xa')]('Admin\x20account\x20selected.');return _0x214871[_0x8a2b('0x20')];});}}function getEndUser(_0x41f3b4,_0x4ac664,_0x14f1a0){logger['info'](_0x8a2b('0x22'),_0x14f1a0);return request({'uri':util[_0x8a2b('0x18')](_0x8a2b('0x19'),_0x41f3b4[_0x8a2b('0x1a')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x14f1a0)}})[_0x8a2b('0x14')](function(_0x4adb11){var _0x20408d;if(_0x4adb11[_0x8a2b('0x23')]['length']){_0x4adb11['results']=_[_0x8a2b('0x24')](_0x4adb11['results'],{'suspended':![],'role':_0x8a2b('0x25')});if(_0x4adb11['results'][_0x8a2b('0x26')]){_0x20408d=_[_0x8a2b('0x27')](_0x4adb11['results']);}}if(_0x20408d){logger[_0x8a2b('0xa')](_0x8a2b('0x28'));return _0x20408d;}else{logger[_0x8a2b('0xa')](_0x8a2b('0x29'));return request({'uri':util[_0x8a2b('0x18')](_0x8a2b('0x2a'),_0x41f3b4[_0x8a2b('0x1a')]),'method':_0x8a2b('0xd'),'body':{'user':{'role':_0x8a2b('0x25'),'name':util[_0x8a2b('0x18')](_0x8a2b('0x2b'),_0x4ac664||_0x14f1a0),'phone':_0x14f1a0}}})['then'](function(_0x31a6d6){logger[_0x8a2b('0xa')]('Enduser\x20created.');return _0x31a6d6[_0x8a2b('0x20')];});}});}function getAuth(_0x386fe9){var _0x4f9242;if(_0x386fe9[_0x8a2b('0x2c')]===_0x8a2b('0x2d')){_0x4f9242=util['format'](_0x8a2b('0x2e'),_0x386fe9[_0x8a2b('0x2f')],_0x386fe9[_0x8a2b('0x2d')]);}else if(_0x386fe9[_0x8a2b('0x2c')]==='token'){_0x4f9242=util[_0x8a2b('0x18')](_0x8a2b('0x30'),_0x386fe9['username'],_0x386fe9['token']);}return util[_0x8a2b('0x18')](_0x8a2b('0x31'),new Buffer(_0x4f9242)[_0x8a2b('0x32')](_0x8a2b('0x33')));}function request(_0x306ad1){logger['debug'](_0x8a2b('0x34'),JSON[_0x8a2b('0x35')](_0x306ad1));return rp(_[_0x8a2b('0x36')](_0x306ad1,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x14cdea,_0x4ac9b1){var _0x5a6c87=[];if(_0x14cdea&&_0x14cdea[_0x8a2b('0x26')]>0x0){_0x5a6c87=_[_0x8a2b('0x37')](_0x14cdea,_0x4ac9b1);}return _0x5a6c87;}function getCustomFields(_0x458c85,_0x1567f8){var _0x190237=[];var _0x4f902e={'custom_fields':[]};if(_0x458c85[_0x8a2b('0x26')]>0x0){_[_0x8a2b('0x38')](_0x458c85,function(_0x31c79d){if(_[_0x8a2b('0x39')]([_0x8a2b('0x3a'),_0x8a2b('0x3b')],_0x31c79d[_0x8a2b('0x3c')])&&_0x31c79d[_0x8a2b('0x3d')]&&!_0x31c79d[_0x8a2b('0x3e')]){_0x4f902e[_0x31c79d['nameField'][_0x8a2b('0x3f')]()]=_0x31c79d[_0x8a2b('0x40')]['toString']();}else if(_[_0x8a2b('0x39')](['string',_0x8a2b('0x3b')],_0x31c79d[_0x8a2b('0x3c')])&&_0x31c79d[_0x8a2b('0x41')]&&_0x31c79d[_0x8a2b('0x3e')]){_0x4f902e[_0x8a2b('0x42')][_0x8a2b('0x43')]({'id':_0x31c79d[_0x8a2b('0x41')],'value':_0x31c79d[_0x8a2b('0x40')]['toString']()});}else if(_0x31c79d[_0x8a2b('0x3c')]===_0x8a2b('0x44')&&_0x31c79d[_0x8a2b('0x45')]&&_0x31c79d[_0x8a2b('0x41')]&&_0x31c79d[_0x8a2b('0x3e')]){_0x1567f8[_0x31c79d[_0x8a2b('0x45')]]&&_0x4f902e[_0x8a2b('0x42')]['push']({'id':_0x31c79d[_0x8a2b('0x41')],'value':_0x1567f8[_0x31c79d[_0x8a2b('0x45')]][_0x8a2b('0x32')]()});}else if(_0x31c79d['type']===_0x8a2b('0x46')&&_0x31c79d['Variable']&&_0x31c79d['Variable'][_0x8a2b('0xf')]&&_0x31c79d[_0x8a2b('0x41')]&&_0x31c79d['customField']){_0x1567f8[_0x31c79d[_0x8a2b('0x47')]['name'][_0x8a2b('0x3f')]()]&&_0x4f902e[_0x8a2b('0x42')][_0x8a2b('0x43')]({'id':_0x31c79d[_0x8a2b('0x41')],'value':_0x1567f8[_0x31c79d[_0x8a2b('0x47')][_0x8a2b('0xf')][_0x8a2b('0x3f')]()][_0x8a2b('0x32')]()});}});}return _0x4f902e;}exports['queue']=function(_0x325246,_0x15b29a,_0x1c8770,_0x14d2d5,_0x27e8fc,_0xae95a3){var _0x2dec05,_0x82cd5f;_0xae95a3[_0x8a2b('0x1a')]=intUtil[_0x8a2b('0x48')](_0xae95a3[_0x8a2b('0x1a')]);_0xae95a3[_0x8a2b('0x49')]=intUtil['stripTrailingSlash'](_0xae95a3[_0x8a2b('0x49')]);if(_0x27e8fc&&_0x27e8fc['monitor_format']){logger['info'](_0x8a2b('0x4a'),_0x8a2b('0x4b'));_0x15b29a['recordingURL']=util[_0x8a2b('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xae95a3['serverUrl'],_0x15b29a['uniqueid'],md5(_0x15b29a[_0x8a2b('0x4c')]));}else{_0x15b29a[_0x8a2b('0x4d')]='';}headers[_0x8a2b('0x4e')]=getAuth(_0xae95a3);return getUser(_0xae95a3,_0x14d2d5['email'])[_0x8a2b('0x14')](function(_0xd88d44){_0x2dec05=_0xd88d44;logger[_0x8a2b('0xa')](_0x8a2b('0x4f'),_0x2dec05['id']);return getEndUser(_0xae95a3,_0x15b29a[_0x8a2b('0x50')],_0x15b29a['calleridnum']);})['then'](function(_0x1a4835){_0x82cd5f=_0x1a4835;logger[_0x8a2b('0xa')]('The\x20Enduser\x20ID\x20is:',_0x82cd5f['id']);return getTicket(_0xae95a3,_0x2dec05,_0x82cd5f,_0x1c8770,_0x15b29a);})[_0x8a2b('0x14')](function(_0x37057e){if(_0x37057e){logger[_0x8a2b('0xa')](_0x8a2b('0x51'),_0x37057e['id']);switch(_0xae95a3['type']){case _0x8a2b('0x52'):logger[_0x8a2b('0xa')]('[QUEUE]',_0x8a2b('0x53'));return request({'uri':util[_0x8a2b('0x18')](_0x8a2b('0x54'),_0xae95a3[_0x8a2b('0x1a')],_0x2dec05['id'],_0x37057e['id']),'method':_0x8a2b('0xd')});case _0x8a2b('0x55'):logger[_0x8a2b('0xa')](_0x8a2b('0x4a'),_0x8a2b('0x56'));emit(util['format'](_0x8a2b('0x57'),_0x14d2d5['name']),_0x8a2b('0x58'),{'uri':util[_0x8a2b('0x18')](_0x8a2b('0x59'),_0xae95a3[_0x8a2b('0x1a')]['replace'](_0x8a2b('0x5a'),''),_0x37057e['id'])});break;default:logger[_0x8a2b('0x5b')](_0x8a2b('0x4a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8a2b('0x5c')](function(_0x168c1c){logger[_0x8a2b('0x5b')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x168c1c,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x7a24f0,_0x383588,_0x52bb52,_0x519c14,_0x2227b6,_0x30a55c,_0x448181){var _0x1e8bf5,_0x28d46c;_0x30a55c[_0x8a2b('0x1a')]=intUtil[_0x8a2b('0x48')](_0x30a55c[_0x8a2b('0x1a')]);_0x30a55c[_0x8a2b('0x49')]=intUtil['stripTrailingSlash'](_0x30a55c['serverUrl']);if(_0x448181&&_0x448181[_0x8a2b('0x5d')]&&_0x448181[_0x8a2b('0x5d')]!==_0x8a2b('0x5e')){logger['info'](_0x8a2b('0x5f'),_0x8a2b('0x4b'));_0x383588[_0x8a2b('0x4d')]=util['format'](_0x8a2b('0x60'),_0x30a55c[_0x8a2b('0x49')],_0x383588[_0x8a2b('0x4c')],md5(_0x383588['uniqueid']));}headers['Authorization']=getAuth(_0x30a55c);return getUser(_0x30a55c,_0x519c14[_0x8a2b('0x61')])[_0x8a2b('0x14')](function(_0xbb1c6b){_0x1e8bf5=_0xbb1c6b;logger[_0x8a2b('0xa')](_0x8a2b('0x4f'),_0x1e8bf5['id']);return getEndUser(_0x30a55c,_0x383588[_0x8a2b('0x62')],_0x383588['destcalleridnum']);})[_0x8a2b('0x14')](function(_0x2affea){_0x28d46c=_0x2affea;logger[_0x8a2b('0xa')](_0x8a2b('0x63'),_0x28d46c['id']);return getTicket(_0x30a55c,_0x1e8bf5,_0x28d46c,_0x52bb52,_0x383588);})[_0x8a2b('0x14')](function(_0x1d6de8){if(_0x1d6de8){logger[_0x8a2b('0xa')](_0x8a2b('0x51'),_0x1d6de8['id']);switch(_0x30a55c['type']){case _0x8a2b('0x52'):logger[_0x8a2b('0xa')]('[OUTBOUND]',_0x8a2b('0x53'));return request({'uri':util[_0x8a2b('0x18')](_0x8a2b('0x54'),_0x30a55c[_0x8a2b('0x1a')],_0x1e8bf5['id'],_0x1d6de8['id']),'method':_0x8a2b('0xd')});case'newTab':logger[_0x8a2b('0xa')](_0x8a2b('0x5f'),_0x8a2b('0x56'));emit(util[_0x8a2b('0x18')](_0x8a2b('0x57'),_0x519c14['name']),_0x8a2b('0x58'),{'uri':util[_0x8a2b('0x18')](_0x8a2b('0x59'),_0x30a55c[_0x8a2b('0x1a')][_0x8a2b('0x64')](_0x8a2b('0x5a'),''),_0x1d6de8['id'])});break;default:logger[_0x8a2b('0x5b')](_0x8a2b('0x5f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8a2b('0x5c')](function(_0x7060bd){logger[_0x8a2b('0x5b')](_0x8a2b('0x65'),util[_0x8a2b('0x66')](_0x7060bd,{'showHidden':!![],'depth':null}));});};exports[_0x8a2b('0x67')]=function(_0x57b0c0,_0x142397,_0x24e050,_0x72307a,_0x3a9253,_0x5af77e){var _0x3ea63c,_0x303e87;_0x5af77e[_0x8a2b('0x1a')]=intUtil['stripTrailingSlash'](_0x5af77e['remoteUri']);_0x5af77e[_0x8a2b('0x49')]=intUtil[_0x8a2b('0x48')](_0x5af77e[_0x8a2b('0x49')]);if(_0x3a9253&&_0x3a9253[_0x8a2b('0x68')]){logger['info']('['+_0x142397['lastevent'][_0x8a2b('0x69')]()+']',_0x8a2b('0x4b'));_0x142397[_0x8a2b('0x4d')]=util[_0x8a2b('0x18')](_0x8a2b('0x60'),_0x5af77e[_0x8a2b('0x49')],_0x142397[_0x8a2b('0x4c')],md5(_0x142397['uniqueid']));}else{_0x142397[_0x8a2b('0x4d')]='';}headers[_0x8a2b('0x4e')]=getAuth(_0x5af77e);return getUser(_0x5af77e)[_0x8a2b('0x14')](function(_0x1e3174){_0x3ea63c=_0x1e3174;logger[_0x8a2b('0xa')](_0x8a2b('0x4f'),_0x3ea63c['id']);return getEndUser(_0x5af77e,_0x142397[_0x8a2b('0x50')],_0x142397[_0x8a2b('0x6a')]);})[_0x8a2b('0x14')](function(_0x4754e1){_0x303e87=_0x4754e1;logger[_0x8a2b('0xa')](_0x8a2b('0x63'),_0x303e87['id']);return getTicket(_0x5af77e,_0x3ea63c,_0x303e87,_0x24e050,_0x142397);})[_0x8a2b('0x14')](function(_0x1c8a43){if(_0x1c8a43){logger[_0x8a2b('0xa')](_0x8a2b('0x51'),_0x1c8a43['id']);}})[_0x8a2b('0x5c')](function(_0x43ba00){logger[_0x8a2b('0x5b')]('['+_0x142397[_0x8a2b('0x6b')][_0x8a2b('0x69')]()+']'+_0x8a2b('0x6c'),util[_0x8a2b('0x66')](_0x43ba00,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 718aac8..908c372 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b55=['user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','recordingURL','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','[OUTBOUND]','unmanaged','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','info','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','connect','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','/crm/v2/Calls','code','Call\x20created!','err','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x3859f5,_0x22db78){var _0x2025df=function(_0x410a6b){while(--_0x410a6b){_0x3859f5['push'](_0x3859f5['shift']());}};_0x2025df(++_0x22db78);}(_0x2b55,0x1f0));var _0x52b5=function(_0x33cc21,_0x502f93){_0x33cc21=_0x33cc21-0x0;var _0x8df5ee=_0x2b55[_0x33cc21];return _0x8df5ee;};'use strict';var _=require(_0x52b5('0x0'));var rp=require(_0x52b5('0x1'));var md5=require(_0x52b5('0x2'));var util=require('util');var intUtil=require(_0x52b5('0x3'));var moment=require(_0x52b5('0x4'));var Redis=require('ioredis');var BPromise=require(_0x52b5('0x5'));var config=require(_0x52b5('0x6'));var logger=require(_0x52b5('0x7'))(_0x52b5('0x8'));config[_0x52b5('0x9')]=_['defaults'](config[_0x52b5('0x9')],{'host':_0x52b5('0xa'),'port':0x18eb});var io=require(_0x52b5('0xb'))(new Redis(config[_0x52b5('0x9')]));function emit(_0x184152,_0x305344,_0x290523){io['to'](_0x184152)[_0x52b5('0xc')](_0x305344,_0x290523);}function request(_0x7bc05c){logger[_0x52b5('0xd')](_0x52b5('0xe'),JSON[_0x52b5('0xf')](_0x7bc05c));return rp(_0x7bc05c);}function getCustomFields(_0x31fc9c,_0x3b7101){var _0xd8a2f9={};if(_0x31fc9c['length']>0x0){_[_0x52b5('0x10')](_0x31fc9c,function(_0xd2ccdf){if(_['includes']([_0x52b5('0x11'),_0x52b5('0x12')],_0xd2ccdf[_0x52b5('0x13')])&&_0xd2ccdf[_0x52b5('0x14')]){_0xd8a2f9[_0xd2ccdf[_0x52b5('0x14')]]=_0xd2ccdf[_0x52b5('0x15')][_0x52b5('0x16')]();}else if(_0xd2ccdf['type']===_0x52b5('0x17')&&_0xd2ccdf[_0x52b5('0x18')]&&_0xd2ccdf[_0x52b5('0x14')]&&_0x3b7101[_0xd2ccdf[_0x52b5('0x18')]]){_0xd8a2f9[_0xd2ccdf['idField']]=_0x3b7101[_0xd2ccdf['variableName']][_0x52b5('0x16')]();}else if(_0xd2ccdf[_0x52b5('0x13')]===_0x52b5('0x19')&&_0xd2ccdf['Variable']&&_0xd2ccdf[_0x52b5('0x1a')][_0x52b5('0x1b')]&&_0xd2ccdf['idField']&&_0x3b7101[_0xd2ccdf[_0x52b5('0x1a')][_0x52b5('0x1b')][_0x52b5('0x1c')]()]){_0xd8a2f9[_0xd2ccdf[_0x52b5('0x14')]]=_0x3b7101[_0xd2ccdf[_0x52b5('0x1a')][_0x52b5('0x1b')]['toLowerCase']()][_0x52b5('0x16')]();}});}return _0xd8a2f9;}function getName(_0x1cb2b3){if(_0x1cb2b3[_0x52b5('0x1d')]('\x20')>0x0){var _0x6cfd32=_0x1cb2b3[_0x52b5('0x1e')](/ (.+)/);if(_0x6cfd32[0x1]){return _0x6cfd32;}}return[_0x1cb2b3,_0x1cb2b3];}var accountsTokens={};function getAccessToken(_0x1e4bad){return new Promise(function(_0x57a730,_0x588cfe){if(!_[_0x52b5('0x1f')](accountsTokens[_0x1e4bad['id']])&&!_[_0x52b5('0x1f')](accountsTokens[_0x1e4bad['id']][_0x52b5('0x20')])){if(moment()[_0x52b5('0x21')](accountsTokens[_0x1e4bad['id']][_0x52b5('0x22')])){_0x57a730(accountsTokens[_0x1e4bad['id']]['access_token']);}}var _0x26fb21;switch(_0x1e4bad[_0x52b5('0x23')]){case'US':_0x26fb21=_0x52b5('0x24');break;case'AU':_0x26fb21=_0x52b5('0x25');break;case'EU':_0x26fb21=_0x52b5('0x26');break;case'IN':_0x26fb21=_0x52b5('0x27');break;case'CN':_0x26fb21='https://accounts.zoho.com.cn';break;default:_0x26fb21=_0x52b5('0x26');break;}var _0x528539={'method':_0x52b5('0x28'),'uri':_0x26fb21+_0x52b5('0x29'),'qs':{'refresh_token':_0x1e4bad[_0x52b5('0x2a')],'client_id':_0x1e4bad[_0x52b5('0x2b')],'client_secret':_0x1e4bad[_0x52b5('0x2c')],'grant_type':_0x52b5('0x2d')},'json':!![]};return rp(_0x528539)[_0x52b5('0x2e')](function(_0xd10d63){accountsTokens[_0x1e4bad['id']]={'access_token':_0xd10d63[_0x52b5('0x20')],'expires_in':moment()['add'](_0xd10d63[_0x52b5('0x22')],_0x52b5('0x2f'))};_0x57a730(_0xd10d63['access_token']);})[_0x52b5('0x30')](function(_0x48602c){logger[_0x52b5('0x31')](_0x52b5('0x32'),_0x48602c[_0x52b5('0x33')]);_0x588cfe(_0x48602c);});});}function getUser(_0x37971e,_0x2f72a0,_0x39a850,_0x48aa69){logger['info'](_0x52b5('0x34'));return request({'method':'GET','uri':util[_0x52b5('0x35')](_0x52b5('0x36'),_0x2f72a0),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x52b5('0x37')+_0x37971e},'json':!![]})[_0x52b5('0x2e')](function(_0x1bd335){if(_0x1bd335[_0x52b5('0x38')]){var _0x23ab54=-0x1;if(_[_0x52b5('0x39')](_0x1bd335[_0x52b5('0x38')])){if(!_[_0x52b5('0x1f')](_0x48aa69)){_0x23ab54=_[_0x52b5('0x3a')](_0x1bd335[_0x52b5('0x38')],function(_0x2bb70b){return _0x2bb70b[_0x52b5('0x3b')]===_0x48aa69;});}if(_0x23ab54>=0x0){logger['info'](_0x52b5('0x3c'));}else{logger['info'](_0x52b5('0x3d'));_0x23ab54=_[_0x52b5('0x3a')](_0x1bd335['users'],function(_0x2417cb){return _0x2417cb[_0x52b5('0x3e')][_0x52b5('0x1b')]==='Administrator';});}return _0x1bd335['users'][_0x23ab54];}else{if(_0x1bd335['user'][_0x52b5('0x3e')][_0x52b5('0x1b')]==='Administrator'){logger[_0x52b5('0x3f')](_0x52b5('0x3d'));user=_0x1bd335['user'];return user;}else{logger[_0x52b5('0x31')](_0x52b5('0x40'),JSON[_0x52b5('0xf')](_0x1bd335));throw new Error(_0x52b5('0x41')+JSON[_0x52b5('0xf')](_0x1bd335));}}}else{logger[_0x52b5('0x31')](_0x52b5('0x40'),JSON[_0x52b5('0xf')](_0x1bd335));throw new Error(_0x52b5('0x41')+JSON['stringify'](_0x1bd335));}})[_0x52b5('0x30')](function(_0x532787){console[_0x52b5('0x31')](_0x532787);});}function getZohoUser(_0x438d44,_0xee3ee2){return new BPromise(function(_0x45b7f4,_0x206472){request(_0x438d44)[_0x52b5('0x2e')](function(_0x13fa5f){var _0x24e157=null;if(_0x13fa5f){_0x24e157=_0x13fa5f[_0x52b5('0x42')][0x0];_0x24e157['enduserType']=_0xee3ee2;}_0x45b7f4(_0x24e157);})['catch'](function(_0x39719a){_0x206472(_0x39719a);});});}function createEndUser(_0x5d4761,_0xc64363,_0x484359,_0x401bf4,_0x12ede7,_0x1db281){var _0x484359=getName(_0x484359);return request({'method':_0x52b5('0x28'),'uri':_0x52b5('0x43')+_0xc64363+'/crm/v2/'+_[_0x52b5('0x44')](_0x1db281[_0x52b5('0x45')])+'s','body':{'data':[{'Last_Name':_0x484359[0x1],'First_Name':_0x484359[0x0],'Phone':_0x401bf4,'Owner':{'name':!_[_0x52b5('0x1f')](_0x12ede7['role'][_0x52b5('0x1b')])?_0x12ede7[_0x52b5('0x46')][_0x52b5('0x1b')]:!_['isNil'](_0x12ede7[_0x52b5('0x47')])?_0x12ede7[_0x52b5('0x47')]+'\x20'+_0x12ede7[_0x52b5('0x48')]:_0x12ede7[_0x52b5('0x48')],'id':_0x12ede7['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d4761},'json':!![]})[_0x52b5('0x2e')](function(_0x5628be){if(_0x5628be&&_0x5628be[_0x52b5('0x42')][0x0]['code']===_0x52b5('0x49')){var _0x10522d=_0x5628be['data'][0x0][_0x52b5('0x4a')];_0x10522d[_0x52b5('0x4b')]=_[_0x52b5('0x44')](_0x1db281[_0x52b5('0x45')])+'s';return _0x10522d;}logger[_0x52b5('0x31')](_0x52b5('0x40'),JSON[_0x52b5('0xf')](data));throw new Error(_0x52b5('0x4c')+JSON[_0x52b5('0xf')](data));})['catch'](function(_0x5d6734){console[_0x52b5('0x4d')](_0x52b5('0x4e'),_0x5d6734);});}function getEndUser(_0x556349,_0x204ec5,_0x4f0e9c,_0x370bd5,_0x12c9cf,_0x27ef80,_0xea8dad){var _0x3fabf9={'method':_0x52b5('0x4f'),'uri':'','headers':{'Authorization':_0x52b5('0x37')+_0x556349},'json':!![]};switch(_0xea8dad[_0x52b5('0x50')]){case _0x52b5('0x51'):_0x3fabf9[_0x52b5('0x52')]=_0x52b5('0x43')+_0x204ec5+_0x52b5('0x53')+_0x12c9cf+'))';return getZohoUser(_0x3fabf9,_0x52b5('0x54'))[_0x52b5('0x2e')](function(_0x2eb478){if(_0x2eb478)return _0x2eb478;_0x3fabf9[_0x52b5('0x52')]=_0x52b5('0x43')+_0x204ec5+_0x52b5('0x55')+_0x12c9cf+'))';return getZohoUser(_0x3fabf9,_0x52b5('0x56'))['then'](function(_0x489292){if(_0x489292)return _0x489292;if(_0xea8dad[_0x52b5('0x45')]!=_0x52b5('0x57')){return createEndUser(_0x556349,_0x204ec5,_0x370bd5,_0x12c9cf,_0x27ef80,_0xea8dad);}else{return{};}});});break;case _0x52b5('0x58'):_0x3fabf9[_0x52b5('0x52')]=_0x52b5('0x43')+_0x204ec5+_0x52b5('0x53')+_0x12c9cf+'))';return getZohoUser(_0x3fabf9,_0x52b5('0x54'))[_0x52b5('0x2e')](function(_0x2b5cfc){if(_0x2b5cfc)return _0x2b5cfc;if(_0xea8dad['moduleCreate']!=_0x52b5('0x57')){return createEndUser(_0x556349,_0x204ec5,_0x370bd5,_0x12c9cf,_0x27ef80,_0xea8dad);}else{return{};}});break;case _0x52b5('0x59'):_0x3fabf9['uri']=_0x52b5('0x43')+_0x204ec5+_0x52b5('0x55')+_0x12c9cf+'))';return getZohoUser(_0x3fabf9,_0x52b5('0x56'))[_0x52b5('0x2e')](function(_0x76507){if(_0x76507)return _0x76507;if(_0xea8dad['moduleCreate']!='nothing'){return createEndUser(_0x556349,_0x204ec5,_0x370bd5,_0x12c9cf,_0x27ef80,_0xea8dad);}else{return{};}});break;}}function getCall(_0x4dc255,_0x4ef4d1,_0x3619bc,_0x47f069,_0x11994e,_0x3edb07,_0x44fc8c,_0x58eb33){logger[_0x52b5('0x3f')](_0x52b5('0x5a'));var _0x22b503={};_0x22b503[_0x52b5('0x5b')]={'name':!_[_0x52b5('0x1f')](_0x47f069['role'][_0x52b5('0x1b')])&&!_[_0x52b5('0x1f')](_0x47f069['profile'][_0x52b5('0x1b')])&&_0x47f069[_0x52b5('0x3e')][_0x52b5('0x1b')]===_0x52b5('0x5c')?_0x47f069[_0x52b5('0x46')][_0x52b5('0x1b')]:!_[_0x52b5('0x1f')](_0x47f069[_0x52b5('0x47')])?_0x47f069[_0x52b5('0x47')]+'\x20'+_0x47f069[_0x52b5('0x48')]:_0x47f069[_0x52b5('0x48')],'id':_0x47f069['id']};_0x22b503[_0x52b5('0x5d')]=intUtil[_0x52b5('0x5e')](_0x3edb07[_0x52b5('0x5f')],_0x44fc8c,'\x20');_0x22b503[_0x52b5('0x60')]=intUtil[_0x52b5('0x5e')](_0x3edb07[_0x52b5('0x61')],_0x44fc8c,'\x0a');if(_0x11994e[_0x52b5('0x4b')]===_0x52b5('0x54')){_0x22b503[_0x52b5('0x62')]={'name':!_[_0x52b5('0x1f')](_0x11994e['Full_Name'])?_0x11994e[_0x52b5('0x63')]:!_[_0x52b5('0x1f')](_0x11994e['First_Name'])?_0x11994e[_0x52b5('0x64')]+'\x20'+_0x11994e[_0x52b5('0x65')]:_0x11994e[_0x52b5('0x65')],'id':_0x11994e['id']};}if(_0x11994e[_0x52b5('0x4b')]==='Leads'){_0x22b503[_0x52b5('0x66')]={'name':!_[_0x52b5('0x1f')](_0x11994e[_0x52b5('0x63')])?_0x11994e['Full_Name']:!_[_0x52b5('0x1f')](_0x11994e[_0x52b5('0x64')])?_0x11994e['First_Name']+'\x20'+_0x11994e[_0x52b5('0x65')]:_0x11994e['Last_Name'],'id':_0x11994e['id']};_0x22b503[_0x52b5('0x67')]=_[_0x52b5('0x44')](_0x11994e[_0x52b5('0x4b')]);}if(_0x44fc8c[_0x52b5('0x68')]){_0x22b503[_0x52b5('0x69')]=moment[_0x52b5('0x6a')](parseInt(_0x44fc8c['talktime'])*0x3e8)[_0x52b5('0x35')](_0x52b5('0x6b'));}else if(_0x44fc8c[_0x52b5('0x6c')]&&_0x44fc8c[_0x52b5('0x6d')]){_0x22b503[_0x52b5('0x69')]=moment[_0x52b5('0x6a')](moment(_0x44fc8c[_0x52b5('0x6d')],'YYYY-MM-DDTHH:mm:ss')[_0x52b5('0x6e')](moment(_0x44fc8c[_0x52b5('0x6f')],_0x52b5('0x70'))))['format'](_0x52b5('0x6b'));}switch(_0x44fc8c[_0x52b5('0x71')]){case _0x52b5('0x72'):_0x22b503[_0x52b5('0x73')]=_0x52b5('0x74');break;case'complete':case _0x52b5('0x75'):_0x22b503[_0x52b5('0x73')]='Answered';break;case'rejected':_0x22b503[_0x52b5('0x73')]='Rejected';break;case _0x52b5('0x76'):_0x22b503[_0x52b5('0x73')]=_0x52b5('0x77');break;case _0x52b5('0x78'):_0x22b503[_0x52b5('0x73')]=_0x52b5('0x79');default:}_0x22b503[_0x52b5('0x7a')]=(_0x58eb33===_0x52b5('0x7b')?moment(_0x44fc8c[_0x52b5('0x6f')])[_0x52b5('0x35')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x44fc8c[_0x52b5('0x7c')])[_0x52b5('0x35')](_0x52b5('0x70')))||moment()[_0x52b5('0x35')](_0x52b5('0x70'));_0x22b503[_0x52b5('0x7d')]=_0x58eb33||_0x52b5('0x7e');_0x22b503=_['merge'](_0x22b503,getCustomFields(_0x3edb07['Fields'],_0x44fc8c));return request({'method':_0x52b5('0x28'),'uri':_0x52b5('0x43')+_0x4ef4d1+_0x52b5('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4dc255},'body':{'data':[_0x22b503]},'json':!![]})['then'](function(_0x35c8e6){if(_0x35c8e6&&_0x35c8e6[_0x52b5('0x42')][0x0][_0x52b5('0x80')]==='SUCCESS'){logger[_0x52b5('0x3f')](_0x52b5('0x81'));return{'id':_0x35c8e6[_0x52b5('0x42')][0x0]['details']['id']};}})[_0x52b5('0x30')](function(_0x25cec9){logger[_0x52b5('0x3f')]('err',_0x25cec9['stack']);console['log'](_0x52b5('0x82'),_0x25cec9);});}exports['queue']=function(_0x55ed84,_0x557db4,_0x3b559b,_0x5e1698,_0x176d64,_0xd2fb1f){var _0x41bbe2,_0x3bf483,_0x267679;_0xd2fb1f['host']=intUtil['stripTrailingSlash'](_0xd2fb1f['host']);_0xd2fb1f['serverUrl']=intUtil[_0x52b5('0x83')](_0xd2fb1f[_0x52b5('0x84')]);if(_0x176d64&&_0x176d64[_0x52b5('0x85')]){logger['info'](_0x52b5('0x86'),_0x52b5('0x87'));_0x557db4['recordingURL']=_0xd2fb1f[_0x52b5('0x84')]+'/api/voice/recordings/'+_0x557db4[_0x52b5('0x88')]+_0x52b5('0x89')+md5(_0x557db4['uniqueid']);}else{_0x557db4['recordingURL']='';}var _0x5df362=_0xd2fb1f[_0x52b5('0x8a')]===_0x52b5('0x8b')?'eu':_0x52b5('0x8c');return getAccessToken(_0xd2fb1f)[_0x52b5('0x2e')](function(_0xd485dd){_0x267679=_0xd485dd;return getUser(_0x267679,_0x5df362,_0xd2fb1f,_0x5e1698['email']);})[_0x52b5('0x2e')](function(_0x3f3947){_0x41bbe2=_0x3f3947;logger[_0x52b5('0x3f')]('The\x20User\x20ID\x20is:',_0x41bbe2['id']);return getEndUser(_0x267679,_0x5df362,_0xd2fb1f,_0x557db4[_0x52b5('0x8d')],_0x557db4[_0x52b5('0x8e')],_0x41bbe2,_0x3b559b);})[_0x52b5('0x2e')](function(_0x175e87){_0x3bf483=_0x175e87;return getCall(_0x267679,_0x5df362,_0xd2fb1f,_0x41bbe2,_0x3bf483,_0x3b559b,_0x557db4,_0x52b5('0x7e'));})[_0x52b5('0x2e')](function(_0x4de43d){if(_0x4de43d){logger[_0x52b5('0x3f')]('The\x20Call\x20ID\x20is:',_0x4de43d['id']);logger[_0x52b5('0x3f')](_0x52b5('0x86'),_0x52b5('0x8f'));emit(util[_0x52b5('0x35')](_0x52b5('0x90'),_0x5e1698['name']),'trigger:browser:url',{'uri':_0x52b5('0x91')+_0xd2fb1f[_0x52b5('0x8a')]+_0x52b5('0x92')+_0x4de43d['id']});}})['catch'](function(_0x1dbe33){logger[_0x52b5('0x31')](_0x52b5('0x86'),JSON['stringify'](_0x1dbe33));});};exports[_0x52b5('0x7b')]=function(_0x1d9031,_0x4c8bcd,_0x1ee665,_0x247abd,_0x2cb073,_0x180d6f,_0x4552fe){var _0x48adbe,_0xa04f35,_0x1a5d5b;_0x180d6f[_0x52b5('0x8a')]=intUtil[_0x52b5('0x83')](_0x180d6f[_0x52b5('0x8a')]);_0x180d6f['serverUrl']=intUtil[_0x52b5('0x83')](_0x180d6f[_0x52b5('0x84')]);if(_0x4552fe&&_0x4552fe['recordingFormat']&&_0x4552fe[_0x52b5('0x93')]!==_0x52b5('0x94')){logger[_0x52b5('0x3f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4c8bcd[_0x52b5('0x95')]=_0x180d6f[_0x52b5('0x84')]+_0x52b5('0x96')+_0x4c8bcd[_0x52b5('0x88')]+_0x52b5('0x89')+md5(_0x4c8bcd[_0x52b5('0x88')]);}var _0x56fa68=_0x180d6f[_0x52b5('0x8a')]===_0x52b5('0x8b')?'eu':_0x52b5('0x8c');return getAccessToken(_0x180d6f)['then'](function(_0x35017c){_0x1a5d5b=_0x35017c;return getUser(_0x1a5d5b,_0x56fa68,_0x180d6f,_0x247abd[_0x52b5('0x3b')]);})['then'](function(_0x14a3d9){_0x48adbe=_0x14a3d9;logger['info'](_0x52b5('0x97'),_0x48adbe['id']);return getEndUser(_0x1a5d5b,_0x56fa68,_0x180d6f,_0x4c8bcd[_0x52b5('0x98')],_0x4c8bcd[_0x52b5('0x99')],_0x48adbe,_0x1ee665);})[_0x52b5('0x2e')](function(_0x486fb9){_0xa04f35=_0x486fb9;return getCall(_0x1a5d5b,_0x56fa68,_0x180d6f,_0x48adbe,_0xa04f35,_0x1ee665,_0x4c8bcd,_0x52b5('0x9a'));})[_0x52b5('0x2e')](function(_0x49f110){if(_0x49f110){logger['info']('The\x20Call\x20ID\x20is:',_0x49f110['id']);logger[_0x52b5('0x3f')]('[OUTBOUND]',_0x52b5('0x8f'));emit(util[_0x52b5('0x35')](_0x52b5('0x90'),_0x247abd[_0x52b5('0x1b')]),_0x52b5('0x9b'),{'uri':_0x52b5('0x91')+_0x180d6f['host']+_0x52b5('0x92')+_0x49f110['id']});}})['catch'](function(_0x23a381){logger[_0x52b5('0x31')](_0x52b5('0x9c'),JSON[_0x52b5('0xf')](_0x23a381));});};exports[_0x52b5('0x9d')]=function(_0x518c94,_0xafcd69,_0x2b00ea,_0x2358df,_0x30a26c,_0x1cb04a){var _0xee4ce6,_0x3bafab,_0x19d73f;_0x1cb04a[_0x52b5('0x8a')]=intUtil[_0x52b5('0x83')](_0x1cb04a[_0x52b5('0x8a')]);_0x1cb04a[_0x52b5('0x84')]=intUtil[_0x52b5('0x83')](_0x1cb04a[_0x52b5('0x84')]);if(_0x30a26c&&_0x30a26c[_0x52b5('0x85')]){logger[_0x52b5('0x3f')]('['+_0xafcd69[_0x52b5('0x71')][_0x52b5('0x9e')]()+']','Recording\x20is\x20enabled!');_0xafcd69[_0x52b5('0x95')]=_0x1cb04a[_0x52b5('0x84')]+'/api/voice/recordings/'+_0xafcd69[_0x52b5('0x88')]+_0x52b5('0x89')+md5(_0xafcd69[_0x52b5('0x88')]);}else{_0xafcd69[_0x52b5('0x95')]='';}var _0x15e5a6=_0x1cb04a[_0x52b5('0x8a')]==='zoho.eu'?'eu':_0x52b5('0x8c');return getAccessToken(_0x1cb04a)[_0x52b5('0x2e')](function(_0x13e59b){_0x19d73f=_0x13e59b;return getUser(_0x19d73f,_0x15e5a6,_0x1cb04a);})[_0x52b5('0x2e')](function(_0x2ba550){_0xee4ce6=_0x2ba550;logger[_0x52b5('0x3f')]('The\x20User\x20ID\x20is:',_0xee4ce6['id']);return getEndUser(_0x19d73f,_0x15e5a6,_0x1cb04a,_0xafcd69['calleridname'],_0xafcd69['calleridnum'],_0xee4ce6,_0x2b00ea);})[_0x52b5('0x2e')](function(_0x1e5d7f){_0x3bafab=_0x1e5d7f;return getCall(_0x19d73f,_0x15e5a6,_0x1cb04a,_0xee4ce6,_0x3bafab,_0x2b00ea,_0xafcd69,_0x52b5('0x7e'));})['then'](function(_0x5c079f){if(_0x5c079f){logger['info'](_0x52b5('0x9f'),_0x5c079f['id']);}})[_0x52b5('0x30')](function(_0xe1b80c){logger['error']('['+_0xafcd69[_0x52b5('0x71')][_0x52b5('0x9e')]()+']',JSON[_0x52b5('0xf')](_0xe1b80c));});};
\ No newline at end of file
+var _0x14e0=['access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','findIndex','email','Using\x20the\x20admin\x20account!','users','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','mm:ss','answertime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','POST','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridnum','Inbound','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','/api/voice/recordings/','The\x20Call\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil'];(function(_0x572998,_0x365570){var _0x53d433=function(_0x140de3){while(--_0x140de3){_0x572998['push'](_0x572998['shift']());}};_0x53d433(++_0x365570);}(_0x14e0,0x11d));var _0x014e=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x14e0[_0x2cef86];return _0x46dfd6;};'use strict';var _=require(_0x014e('0x0'));var rp=require(_0x014e('0x1'));var md5=require(_0x014e('0x2'));var util=require(_0x014e('0x3'));var intUtil=require(_0x014e('0x4'));var moment=require(_0x014e('0x5'));var Redis=require(_0x014e('0x6'));var BPromise=require(_0x014e('0x7'));var config=require('../../../../config/environment');var logger=require(_0x014e('0x8'))(_0x014e('0x9'));config[_0x014e('0xa')]=_[_0x014e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x014e('0xa')]));function emit(_0x115cd0,_0x18bc18,_0x18531d){io['to'](_0x115cd0)[_0x014e('0xc')](_0x18bc18,_0x18531d);}function request(_0x2e0510){logger[_0x014e('0xd')](_0x014e('0xe'),JSON[_0x014e('0xf')](_0x2e0510));return rp(_0x2e0510);}function getCustomFields(_0x3fa266,_0x38e01c){var _0x3f4075={};if(_0x3fa266['length']>0x0){_[_0x014e('0x10')](_0x3fa266,function(_0x470de1){if(_[_0x014e('0x11')]([_0x014e('0x12'),_0x014e('0x13')],_0x470de1[_0x014e('0x14')])&&_0x470de1[_0x014e('0x15')]){_0x3f4075[_0x470de1[_0x014e('0x15')]]=_0x470de1['content']['toString']();}else if(_0x470de1[_0x014e('0x14')]===_0x014e('0x16')&&_0x470de1[_0x014e('0x17')]&&_0x470de1[_0x014e('0x15')]&&_0x38e01c[_0x470de1[_0x014e('0x17')]]){_0x3f4075[_0x470de1[_0x014e('0x15')]]=_0x38e01c[_0x470de1[_0x014e('0x17')]][_0x014e('0x18')]();}else if(_0x470de1[_0x014e('0x14')]==='customVariable'&&_0x470de1[_0x014e('0x19')]&&_0x470de1['Variable'][_0x014e('0x1a')]&&_0x470de1[_0x014e('0x15')]&&_0x38e01c[_0x470de1[_0x014e('0x19')][_0x014e('0x1a')][_0x014e('0x1b')]()]){_0x3f4075[_0x470de1['idField']]=_0x38e01c[_0x470de1[_0x014e('0x19')]['name'][_0x014e('0x1b')]()]['toString']();}});}return _0x3f4075;}function getName(_0x5d369e){if(_0x5d369e[_0x014e('0x1c')]('\x20')>0x0){var _0x3c49b0=_0x5d369e[_0x014e('0x1d')](/ (.+)/);if(_0x3c49b0[0x1]){return _0x3c49b0;}}return[_0x5d369e,_0x5d369e];}var accountsTokens={};function getAccessToken(_0x476826){return new Promise(function(_0x5ec6cc,_0x40c62d){if(!_[_0x014e('0x1e')](accountsTokens[_0x476826['id']])&&!_['isNil'](accountsTokens[_0x476826['id']][_0x014e('0x1f')])){if(moment()[_0x014e('0x20')](accountsTokens[_0x476826['id']][_0x014e('0x21')])){_0x5ec6cc(accountsTokens[_0x476826['id']][_0x014e('0x1f')]);}}var _0x1682a7;switch(_0x476826[_0x014e('0x22')]){case'US':_0x1682a7=_0x014e('0x23');break;case'AU':_0x1682a7=_0x014e('0x24');break;case'EU':_0x1682a7=_0x014e('0x25');break;case'IN':_0x1682a7=_0x014e('0x26');break;case'CN':_0x1682a7=_0x014e('0x27');break;default:_0x1682a7=_0x014e('0x25');break;}var _0x45f451={'method':'POST','uri':_0x1682a7+_0x014e('0x28'),'qs':{'refresh_token':_0x476826[_0x014e('0x29')],'client_id':_0x476826[_0x014e('0x2a')],'client_secret':_0x476826[_0x014e('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x45f451)[_0x014e('0x2c')](function(_0x16c0a8){accountsTokens[_0x476826['id']]={'access_token':_0x16c0a8['access_token'],'expires_in':moment()[_0x014e('0x2d')](_0x16c0a8[_0x014e('0x21')],_0x014e('0x2e'))};_0x5ec6cc(_0x16c0a8['access_token']);})[_0x014e('0x2f')](function(_0x1f42e6){logger[_0x014e('0x30')](_0x014e('0x31'),_0x1f42e6['stack']);_0x40c62d(_0x1f42e6);});});}function getUser(_0xed68ec,_0x4c4d78,_0xd401d8,_0x4328f3){logger[_0x014e('0x32')](_0x014e('0x33'));return request({'method':_0x014e('0x34'),'uri':util[_0x014e('0x35')](_0x014e('0x36'),_0x4c4d78),'qs':{'type':_0x014e('0x37')},'headers':{'Authorization':_0x014e('0x38')+_0xed68ec},'json':!![]})[_0x014e('0x2c')](function(_0x5d7b28){if(_0x5d7b28['users']){var _0x3e4e4b=-0x1;if(_['isArrayLikeObject'](_0x5d7b28['users'])){if(!_[_0x014e('0x1e')](_0x4328f3)){_0x3e4e4b=_[_0x014e('0x39')](_0x5d7b28['users'],function(_0x111a78){return _0x111a78[_0x014e('0x3a')]===_0x4328f3;});}if(_0x3e4e4b>=0x0){logger[_0x014e('0x32')]('Agent\x20found!');}else{logger['info'](_0x014e('0x3b'));_0x3e4e4b=_[_0x014e('0x39')](_0x5d7b28[_0x014e('0x3c')],function(_0x4021f2){return _0x4021f2['profile'][_0x014e('0x1a')]===_0x014e('0x3d');});}return _0x5d7b28[_0x014e('0x3c')][_0x3e4e4b];}else{if(_0x5d7b28[_0x014e('0x3e')]['profile']['name']===_0x014e('0x3d')){logger['info'](_0x014e('0x3b'));user=_0x5d7b28[_0x014e('0x3e')];return user;}else{logger[_0x014e('0x30')]('The\x20failing\x20result\x20is',JSON[_0x014e('0xf')](_0x5d7b28));throw new Error(_0x014e('0x3f')+JSON[_0x014e('0xf')](_0x5d7b28));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x014e('0xf')](_0x5d7b28));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x014e('0xf')](_0x5d7b28));}})[_0x014e('0x2f')](function(_0x38a515){console[_0x014e('0x30')](_0x38a515);});}function getZohoUser(_0x54f536,_0x57e247){return new BPromise(function(_0x477b43,_0x3198eb){request(_0x54f536)[_0x014e('0x2c')](function(_0x5ae685){var _0x2a2098=null;if(_0x5ae685){_0x2a2098=_0x5ae685[_0x014e('0x40')][0x0];_0x2a2098[_0x014e('0x41')]=_0x57e247;}_0x477b43(_0x2a2098);})[_0x014e('0x2f')](function(_0x12165b){_0x3198eb(_0x12165b);});});}function createEndUser(_0x1c8427,_0x499a7a,_0x47fe36,_0x4760d9,_0x47b6ad,_0x45f1b7){var _0x47fe36=getName(_0x47fe36);return request({'method':'POST','uri':_0x014e('0x42')+_0x499a7a+_0x014e('0x43')+_[_0x014e('0x44')](_0x45f1b7[_0x014e('0x45')])+'s','body':{'data':[{'Last_Name':_0x47fe36[0x1],'First_Name':_0x47fe36[0x0],'Phone':_0x4760d9,'Owner':{'name':!_[_0x014e('0x1e')](_0x47b6ad[_0x014e('0x46')][_0x014e('0x1a')])?_0x47b6ad[_0x014e('0x46')]['name']:!_['isNil'](_0x47b6ad[_0x014e('0x47')])?_0x47b6ad[_0x014e('0x47')]+'\x20'+_0x47b6ad[_0x014e('0x48')]:_0x47b6ad[_0x014e('0x48')],'id':_0x47b6ad['id']}}]},'headers':{'Authorization':_0x014e('0x38')+_0x1c8427},'json':!![]})[_0x014e('0x2c')](function(_0xb42dff){if(_0xb42dff&&_0xb42dff[_0x014e('0x40')][0x0][_0x014e('0x49')]===_0x014e('0x4a')){var _0x2dc4ce=_0xb42dff[_0x014e('0x40')][0x0][_0x014e('0x4b')];_0x2dc4ce[_0x014e('0x41')]=_[_0x014e('0x44')](_0x45f1b7['moduleCreate'])+'s';return _0x2dc4ce;}logger['error'](_0x014e('0x4c'),JSON['stringify'](data));throw new Error(_0x014e('0x4d')+JSON[_0x014e('0xf')](data));})[_0x014e('0x2f')](function(_0x1f0640){console[_0x014e('0x4e')](_0x014e('0x4f'),_0x1f0640);});}function getEndUser(_0x193212,_0x2d01ab,_0x4ca08f,_0x42ae58,_0x2bfe40,_0x3450f2,_0x2c4a30){var _0x47cddc={'method':_0x014e('0x34'),'uri':'','headers':{'Authorization':_0x014e('0x38')+_0x193212},'json':!![]};switch(_0x2c4a30[_0x014e('0x50')]){case _0x014e('0x51'):_0x47cddc[_0x014e('0x52')]='https://www.zohoapis.'+_0x2d01ab+_0x014e('0x53')+_0x2bfe40+'))';return getZohoUser(_0x47cddc,_0x014e('0x54'))[_0x014e('0x2c')](function(_0x408139){if(_0x408139)return _0x408139;_0x47cddc['uri']='https://www.zohoapis.'+_0x2d01ab+_0x014e('0x55')+_0x2bfe40+'))';return getZohoUser(_0x47cddc,_0x014e('0x56'))[_0x014e('0x2c')](function(_0x337087){if(_0x337087)return _0x337087;if(_0x2c4a30[_0x014e('0x45')]!=_0x014e('0x57')){return createEndUser(_0x193212,_0x2d01ab,_0x42ae58,_0x2bfe40,_0x3450f2,_0x2c4a30);}else{return{};}});});break;case _0x014e('0x58'):_0x47cddc[_0x014e('0x52')]='https://www.zohoapis.'+_0x2d01ab+_0x014e('0x53')+_0x2bfe40+'))';return getZohoUser(_0x47cddc,_0x014e('0x54'))[_0x014e('0x2c')](function(_0xbf5517){if(_0xbf5517)return _0xbf5517;if(_0x2c4a30['moduleCreate']!=_0x014e('0x57')){return createEndUser(_0x193212,_0x2d01ab,_0x42ae58,_0x2bfe40,_0x3450f2,_0x2c4a30);}else{return{};}});break;case'lead':_0x47cddc[_0x014e('0x52')]=_0x014e('0x42')+_0x2d01ab+_0x014e('0x55')+_0x2bfe40+'))';return getZohoUser(_0x47cddc,_0x014e('0x56'))[_0x014e('0x2c')](function(_0x33dd2a){if(_0x33dd2a)return _0x33dd2a;if(_0x2c4a30[_0x014e('0x45')]!=_0x014e('0x57')){return createEndUser(_0x193212,_0x2d01ab,_0x42ae58,_0x2bfe40,_0x3450f2,_0x2c4a30);}else{return{};}});break;}}function getCall(_0x4115c0,_0x2e0f20,_0x7f2972,_0x267f39,_0xf7601a,_0x49c32e,_0xb3caa4,_0x11a00d){logger[_0x014e('0x32')](_0x014e('0x59'));var _0x506f79={};_0x506f79['Owner']={'name':!_[_0x014e('0x1e')](_0x267f39[_0x014e('0x46')][_0x014e('0x1a')])&&!_['isNil'](_0x267f39['profile']['name'])&&_0x267f39[_0x014e('0x5a')][_0x014e('0x1a')]===_0x014e('0x5b')?_0x267f39[_0x014e('0x46')][_0x014e('0x1a')]:!_[_0x014e('0x1e')](_0x267f39[_0x014e('0x47')])?_0x267f39[_0x014e('0x47')]+'\x20'+_0x267f39[_0x014e('0x48')]:_0x267f39[_0x014e('0x48')],'id':_0x267f39['id']};_0x506f79[_0x014e('0x5c')]=intUtil[_0x014e('0x5d')](_0x49c32e[_0x014e('0x5e')],_0xb3caa4,'\x20');_0x506f79[_0x014e('0x5f')]=intUtil[_0x014e('0x5d')](_0x49c32e[_0x014e('0x60')],_0xb3caa4,'\x0a');if(_0xf7601a[_0x014e('0x41')]===_0x014e('0x54')){_0x506f79[_0x014e('0x61')]={'name':!_[_0x014e('0x1e')](_0xf7601a[_0x014e('0x62')])?_0xf7601a[_0x014e('0x62')]:!_['isNil'](_0xf7601a[_0x014e('0x63')])?_0xf7601a[_0x014e('0x63')]+'\x20'+_0xf7601a[_0x014e('0x64')]:_0xf7601a[_0x014e('0x64')],'id':_0xf7601a['id']};}if(_0xf7601a[_0x014e('0x41')]===_0x014e('0x56')){_0x506f79[_0x014e('0x65')]={'name':!_[_0x014e('0x1e')](_0xf7601a['Full_Name'])?_0xf7601a[_0x014e('0x62')]:!_[_0x014e('0x1e')](_0xf7601a[_0x014e('0x63')])?_0xf7601a[_0x014e('0x63')]+'\x20'+_0xf7601a['Last_Name']:_0xf7601a['Last_Name'],'id':_0xf7601a['id']};_0x506f79[_0x014e('0x66')]=_[_0x014e('0x44')](_0xf7601a['enduserType']);}if(_0xb3caa4[_0x014e('0x67')]){_0x506f79['Call_Duration']=moment['utc'](parseInt(_0xb3caa4['talktime'])*0x3e8)[_0x014e('0x35')](_0x014e('0x68'));}else if(_0xb3caa4[_0x014e('0x69')]&&_0xb3caa4['endtime']){_0x506f79['Call_Duration']=moment[_0x014e('0x6a')](moment(_0xb3caa4['endtime'],_0x014e('0x6b'))[_0x014e('0x6c')](moment(_0xb3caa4[_0x014e('0x6d')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x014e('0x68'));}switch(_0xb3caa4[_0x014e('0x6e')]){case _0x014e('0x6f'):_0x506f79[_0x014e('0x70')]='Called';break;case _0x014e('0x71'):case _0x014e('0x72'):_0x506f79[_0x014e('0x70')]='Answered';break;case _0x014e('0x73'):_0x506f79[_0x014e('0x70')]='Rejected';break;case _0x014e('0x74'):_0x506f79[_0x014e('0x70')]=_0x014e('0x75');break;case _0x014e('0x76'):_0x506f79['Call_Result']=_0x014e('0x77');default:}_0x506f79['Call_Start_Time']=(_0x11a00d===_0x014e('0x78')?moment(_0xb3caa4[_0x014e('0x6d')])['format'](_0x014e('0x6b')):moment(_0xb3caa4[_0x014e('0x79')])[_0x014e('0x35')](_0x014e('0x6b')))||moment()[_0x014e('0x35')](_0x014e('0x6b'));_0x506f79[_0x014e('0x7a')]=_0x11a00d||'Inbound';_0x506f79=_[_0x014e('0x7b')](_0x506f79,getCustomFields(_0x49c32e['Fields'],_0xb3caa4));return request({'method':_0x014e('0x7c'),'uri':_0x014e('0x42')+_0x2e0f20+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4115c0},'body':{'data':[_0x506f79]},'json':!![]})['then'](function(_0x300a2e){if(_0x300a2e&&_0x300a2e[_0x014e('0x40')][0x0][_0x014e('0x49')]===_0x014e('0x4a')){logger[_0x014e('0x32')](_0x014e('0x7d'));return{'id':_0x300a2e[_0x014e('0x40')][0x0][_0x014e('0x4b')]['id']};}})[_0x014e('0x2f')](function(_0x5b1d1b){logger[_0x014e('0x32')](_0x014e('0x7e'),_0x5b1d1b[_0x014e('0x7f')]);console[_0x014e('0x4e')](_0x014e('0x7e'),_0x5b1d1b);});}exports[_0x014e('0x80')]=function(_0x1ddb11,_0x325c22,_0x325779,_0x1889a0,_0x146510,_0x25aa4c){var _0x26196d,_0xe7413f,_0x4a8a7d;_0x25aa4c[_0x014e('0x81')]=intUtil[_0x014e('0x82')](_0x25aa4c[_0x014e('0x81')]);_0x25aa4c[_0x014e('0x83')]=intUtil['stripTrailingSlash'](_0x25aa4c[_0x014e('0x83')]);if(_0x146510&&_0x146510[_0x014e('0x84')]){logger[_0x014e('0x32')]('[QUEUE]','Recording\x20is\x20enabled!');_0x325c22[_0x014e('0x85')]=_0x25aa4c[_0x014e('0x83')]+'/api/voice/recordings/'+_0x325c22['uniqueid']+_0x014e('0x86')+md5(_0x325c22[_0x014e('0x87')]);}else{_0x325c22[_0x014e('0x85')]='';}var _0x3f3263=_0x25aa4c[_0x014e('0x81')]==='zoho.eu'?'eu':_0x014e('0x88');return getAccessToken(_0x25aa4c)[_0x014e('0x2c')](function(_0x5014f6){_0x4a8a7d=_0x5014f6;return getUser(_0x4a8a7d,_0x3f3263,_0x25aa4c,_0x1889a0[_0x014e('0x3a')]);})[_0x014e('0x2c')](function(_0xd87b7a){_0x26196d=_0xd87b7a;logger[_0x014e('0x32')](_0x014e('0x89'),_0x26196d['id']);return getEndUser(_0x4a8a7d,_0x3f3263,_0x25aa4c,_0x325c22['calleridname'],_0x325c22[_0x014e('0x8a')],_0x26196d,_0x325779);})[_0x014e('0x2c')](function(_0x14585d){_0xe7413f=_0x14585d;return getCall(_0x4a8a7d,_0x3f3263,_0x25aa4c,_0x26196d,_0xe7413f,_0x325779,_0x325c22,_0x014e('0x8b'));})[_0x014e('0x2c')](function(_0x13ca2c){if(_0x13ca2c){logger[_0x014e('0x32')]('The\x20Call\x20ID\x20is:',_0x13ca2c['id']);logger['info'](_0x014e('0x8c'),_0x014e('0x8d'));emit(util[_0x014e('0x35')](_0x014e('0x8e'),_0x1889a0['name']),_0x014e('0x8f'),{'uri':_0x014e('0x90')+_0x25aa4c[_0x014e('0x81')]+_0x014e('0x91')+_0x13ca2c['id']});}})[_0x014e('0x2f')](function(_0x45b317){logger[_0x014e('0x30')](_0x014e('0x8c'),JSON[_0x014e('0xf')](_0x45b317));});};exports[_0x014e('0x78')]=function(_0x2bae9a,_0x9a73b8,_0x2826b3,_0xaf537a,_0x381c4b,_0x40cb21,_0x4d461d){var _0x1f4271,_0x412dde,_0x4b040f;_0x40cb21[_0x014e('0x81')]=intUtil[_0x014e('0x82')](_0x40cb21['host']);_0x40cb21[_0x014e('0x83')]=intUtil['stripTrailingSlash'](_0x40cb21[_0x014e('0x83')]);if(_0x4d461d&&_0x4d461d['recordingFormat']&&_0x4d461d[_0x014e('0x92')]!==_0x014e('0x93')){logger['info'](_0x014e('0x94'),_0x014e('0x95'));_0x9a73b8['recordingURL']=_0x40cb21[_0x014e('0x83')]+'/api/voice/recordings/'+_0x9a73b8[_0x014e('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x9a73b8[_0x014e('0x87')]);}var _0x1e40e4=_0x40cb21[_0x014e('0x81')]===_0x014e('0x96')?'eu':_0x014e('0x88');return getAccessToken(_0x40cb21)['then'](function(_0x1451db){_0x4b040f=_0x1451db;return getUser(_0x4b040f,_0x1e40e4,_0x40cb21,_0xaf537a[_0x014e('0x3a')]);})[_0x014e('0x2c')](function(_0x5b3006){_0x1f4271=_0x5b3006;logger['info'](_0x014e('0x89'),_0x1f4271['id']);return getEndUser(_0x4b040f,_0x1e40e4,_0x40cb21,_0x9a73b8[_0x014e('0x97')],_0x9a73b8[_0x014e('0x98')],_0x1f4271,_0x2826b3);})[_0x014e('0x2c')](function(_0x59bc6e){_0x412dde=_0x59bc6e;return getCall(_0x4b040f,_0x1e40e4,_0x40cb21,_0x1f4271,_0x412dde,_0x2826b3,_0x9a73b8,_0x014e('0x99'));})['then'](function(_0x2ccdb3){if(_0x2ccdb3){logger['info']('The\x20Call\x20ID\x20is:',_0x2ccdb3['id']);logger[_0x014e('0x32')]('[OUTBOUND]',_0x014e('0x8d'));emit(util[_0x014e('0x35')](_0x014e('0x8e'),_0xaf537a[_0x014e('0x1a')]),_0x014e('0x8f'),{'uri':_0x014e('0x90')+_0x40cb21[_0x014e('0x81')]+_0x014e('0x91')+_0x2ccdb3['id']});}})[_0x014e('0x2f')](function(_0x46c68b){logger[_0x014e('0x30')](_0x014e('0x94'),JSON['stringify'](_0x46c68b));});};exports[_0x014e('0x9a')]=function(_0x4c1d87,_0x570a5a,_0x4a1152,_0x3848cc,_0x28e086,_0xe201b9){var _0x3f0982,_0x32df5d,_0x4613f6;_0xe201b9[_0x014e('0x81')]=intUtil[_0x014e('0x82')](_0xe201b9[_0x014e('0x81')]);_0xe201b9['serverUrl']=intUtil['stripTrailingSlash'](_0xe201b9['serverUrl']);if(_0x28e086&&_0x28e086[_0x014e('0x84')]){logger[_0x014e('0x32')]('['+_0x570a5a[_0x014e('0x6e')]['toUpperCase']()+']',_0x014e('0x95'));_0x570a5a[_0x014e('0x85')]=_0xe201b9[_0x014e('0x83')]+_0x014e('0x9b')+_0x570a5a[_0x014e('0x87')]+_0x014e('0x86')+md5(_0x570a5a[_0x014e('0x87')]);}else{_0x570a5a[_0x014e('0x85')]='';}var _0x10f1b7=_0xe201b9['host']===_0x014e('0x96')?'eu':_0x014e('0x88');return getAccessToken(_0xe201b9)['then'](function(_0x5b7089){_0x4613f6=_0x5b7089;return getUser(_0x4613f6,_0x10f1b7,_0xe201b9);})[_0x014e('0x2c')](function(_0x47dd1c){_0x3f0982=_0x47dd1c;logger['info']('The\x20User\x20ID\x20is:',_0x3f0982['id']);return getEndUser(_0x4613f6,_0x10f1b7,_0xe201b9,_0x570a5a['calleridname'],_0x570a5a[_0x014e('0x8a')],_0x3f0982,_0x4a1152);})[_0x014e('0x2c')](function(_0x561f7b){_0x32df5d=_0x561f7b;return getCall(_0x4613f6,_0x10f1b7,_0xe201b9,_0x3f0982,_0x32df5d,_0x4a1152,_0x570a5a,_0x014e('0x8b'));})[_0x014e('0x2c')](function(_0x5c1f1e){if(_0x5c1f1e){logger[_0x014e('0x32')](_0x014e('0x9c'),_0x5c1f1e['id']);}})['catch'](function(_0x2b6705){logger[_0x014e('0x30')]('['+_0x570a5a[_0x014e('0x6e')][_0x014e('0x9d')]()+']',JSON['stringify'](_0x2b6705));});};
\ No newline at end of file
index 8d00938..4ad593d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc501=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','exec','data2','Script','data3'];(function(_0x85fbb2,_0x55d447){var _0x2c94e5=function(_0x3bd403){while(--_0x3bd403){_0x85fbb2['push'](_0x85fbb2['shift']());}};_0x2c94e5(++_0x55d447);}(_0xc501,0x92));var _0x1c50=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xc501[_0x2543d6];return _0x55213c;};'use strict';var util=require(_0x1c50('0x0'));var sh=require('shelljs');var Mustache=require(_0x1c50('0x1'));var logger=require(_0x1c50('0x2'))(_0x1c50('0x3'));exports[_0x1c50('0x4')]=function(_0x1b5809,_0x416b93){var _0x57c896=_0x1b5809[_0x1c50('0x5')]?_0x1b5809[_0x1c50('0x5')]:_0x1c50('0x6');var _0x5bad59=_0x1b5809[_0x1c50('0x7')]?Mustache['render'](_0x1b5809['data3'],_0x416b93):_0x416b93;sh[_0x1c50('0x4')](_0x5bad59,function(_0xa38922,_0x28a85a,_0x31f90e){if(_0xa38922!==0x0){logger['error'](util[_0x1c50('0x8')](_0x1c50('0x9'),_0x57c896,_0x5bad59,_0xa38922,_0x31f90e));}else{logger['info'](util[_0x1c50('0x8')](_0x1c50('0xa'),_0x57c896,_0x5bad59,_0x28a85a));}});};
\ No newline at end of file
+var _0x9bdf=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','data2','Script','render','data3'];(function(_0x139ff6,_0xddca5){var _0x71b083=function(_0x4cf27a){while(--_0x4cf27a){_0x139ff6['push'](_0x139ff6['shift']());}};_0x71b083(++_0xddca5);}(_0x9bdf,0x154));var _0xf9bd=function(_0x33481a,_0x5d4316){_0x33481a=_0x33481a-0x0;var _0x408ab9=_0x9bdf[_0x33481a];return _0x408ab9;};'use strict';var util=require(_0xf9bd('0x0'));var sh=require('shelljs');var Mustache=require(_0xf9bd('0x1'));var logger=require(_0xf9bd('0x2'))(_0xf9bd('0x3'));exports['exec']=function(_0x1cb448,_0x3b47e0){var _0x1fc1a8=_0x1cb448[_0xf9bd('0x4')]?_0x1cb448[_0xf9bd('0x4')]:_0xf9bd('0x5');var _0x4655b9=_0x1cb448['data3']?Mustache[_0xf9bd('0x6')](_0x1cb448[_0xf9bd('0x7')],_0x3b47e0):_0x3b47e0;sh['exec'](_0x4655b9,function(_0x137101,_0x3008ad,_0x4a478e){if(_0x137101!==0x0){logger['error'](util[_0xf9bd('0x8')](_0xf9bd('0x9'),_0x1fc1a8,_0x4655b9,_0x137101,_0x4a478e));}else{logger[_0xf9bd('0xa')](util[_0xf9bd('0x8')](_0xf9bd('0xb'),_0x1fc1a8,_0x4655b9,_0x3008ad));}});};
\ No newline at end of file
index d1dfd11..5e120c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf5d=['message','data1','toUpperCase','data2','data5','number','headers','data6','parse','render','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','then','isNil','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name'];(function(_0x3421ac,_0x3228b5){var _0x16c2d2=function(_0xad864f){while(--_0xad864f){_0x3421ac['push'](_0x3421ac['shift']());}};_0x16c2d2(++_0x3228b5);}(_0xbf5d,0xd3));var _0xdbf5=function(_0xf8baeb,_0x4c83e8){_0xf8baeb=_0xf8baeb-0x0;var _0x5997a4=_0xbf5d[_0xf8baeb];return _0x5997a4;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x5519a5,_0x1c5f5e){var _0xe8b1ca,_0x47042b;var _0x42ac5d={'method':_0x5519a5[_0xdbf5('0x0')][_0xdbf5('0x1')](),'uri':Mustache['render'](_0x5519a5[_0xdbf5('0x2')],_0x1c5f5e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5519a5[_0xdbf5('0x3')])===_0xdbf5('0x4')&&parseInt(_0x5519a5[_0xdbf5('0x3')])>=0x1&&parseInt(_0x5519a5[_0xdbf5('0x3')])<=0xa?parseInt(_0x5519a5[_0xdbf5('0x3')])*0x3e8:0x5*0x3e8};try{_0x42ac5d[_0xdbf5('0x5')]=_0x5519a5[_0xdbf5('0x6')]?JSON[_0xdbf5('0x7')](Mustache[_0xdbf5('0x8')](_0x5519a5[_0xdbf5('0x6')],_0x1c5f5e)):{};}catch(_0xf48f92){logger[_0xdbf5('0x9')](_0xf48f92[_0xdbf5('0xa')]);}switch(_0x5519a5[_0xdbf5('0x0')][_0xdbf5('0x1')]()){case _0xdbf5('0xb'):case _0xdbf5('0xc'):_0xe8b1ca=null;_0x42ac5d['qs']=_0x1c5f5e;break;case _0xdbf5('0xd'):case _0xdbf5('0xe'):if(_0x5519a5['data7']){try{_0xe8b1ca=JSON[_0xdbf5('0x7')](Mustache['render'](_0x5519a5[_0xdbf5('0xf')],_0x1c5f5e));_0x42ac5d[_0xdbf5('0x10')]=_0xe8b1ca;}catch(_0x503723){logger['error'](_0x503723[_0xdbf5('0xa')]);logger[_0xdbf5('0x9')](_0xdbf5('0x11'));}}else{_0xe8b1ca=_0x1c5f5e;_0x42ac5d[_0xdbf5('0x10')]=_0xe8b1ca;}break;}logger['info'](util[_0xdbf5('0x12')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x5519a5['data1'],_0x5519a5[_0xdbf5('0x2')],JSON['stringify'](_0x42ac5d)));rp(_0x42ac5d)[_0xdbf5('0x13')](function(_0x57b794){_0xe8b1ca=!_[_0xdbf5('0x14')](_0xe8b1ca)?',\x20request\x20body:\x20'+_0xe8b1ca:'';_0x47042b=typeof _0x57b794['body']===_0xdbf5('0x15')?JSON[_0xdbf5('0x16')](_0x57b794[_0xdbf5('0x10')]):_0x57b794[_0xdbf5('0x10')];logger[_0xdbf5('0x17')](util[_0xdbf5('0x12')](_0xdbf5('0x18'),_0x5519a5[_0xdbf5('0x0')],_0x5519a5['data2'],_0x57b794[_0xdbf5('0x19')],_0x47042b));})[_0xdbf5('0x1a')](function(_0x3fb20c){logger[_0xdbf5('0x9')](util['format'](_0xdbf5('0x1b'),_0x5519a5[_0xdbf5('0x0')],_0x5519a5[_0xdbf5('0x2')],_0x3fb20c[_0xdbf5('0x19')],_0x3fb20c[_0xdbf5('0x1c')],_0x3fb20c[_0xdbf5('0x1d')]));});};
\ No newline at end of file
+var _0x0361=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','message','lodash','mustache','trigger','exec','data1','toUpperCase','data2','data5','data6','parse','stack','PUT','data7','render','body','error','info','format'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x0361,0xc6));var _0x1036=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0361[_0x3ab51d];return _0x29a04e;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x1036('0x0'));var Mustache=require(_0x1036('0x1'));var logger=require('../../../../config/logger')(_0x1036('0x2'));exports[_0x1036('0x3')]=function(_0x1eea08,_0x11eccd){var _0x58227c,_0x1ee612;var _0x45ba2a={'method':_0x1eea08[_0x1036('0x4')][_0x1036('0x5')](),'uri':Mustache['render'](_0x1eea08[_0x1036('0x6')],_0x11eccd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1eea08[_0x1036('0x7')])==='number'&&parseInt(_0x1eea08[_0x1036('0x7')])>=0x1&&parseInt(_0x1eea08[_0x1036('0x7')])<=0xa?parseInt(_0x1eea08[_0x1036('0x7')])*0x3e8:0x5*0x3e8};try{_0x45ba2a['headers']=_0x1eea08[_0x1036('0x8')]?JSON[_0x1036('0x9')](Mustache['render'](_0x1eea08[_0x1036('0x8')],_0x11eccd)):{};}catch(_0x36342f){logger['error'](_0x36342f[_0x1036('0xa')]);}switch(_0x1eea08[_0x1036('0x4')]['toUpperCase']()){case'GET':case'DELETE':_0x58227c=null;_0x45ba2a['qs']=_0x11eccd;break;case'POST':case _0x1036('0xb'):if(_0x1eea08[_0x1036('0xc')]){try{_0x58227c=JSON[_0x1036('0x9')](Mustache[_0x1036('0xd')](_0x1eea08['data7'],_0x11eccd));_0x45ba2a[_0x1036('0xe')]=_0x58227c;}catch(_0x46ecc0){logger['error'](_0x46ecc0[_0x1036('0xa')]);logger[_0x1036('0xf')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x58227c=_0x11eccd;_0x45ba2a[_0x1036('0xe')]=_0x58227c;}break;}logger[_0x1036('0x10')](util[_0x1036('0x11')](_0x1036('0x12'),_0x1eea08['data1'],_0x1eea08[_0x1036('0x6')],JSON['stringify'](_0x45ba2a)));rp(_0x45ba2a)['then'](function(_0x2e320d){_0x58227c=!_[_0x1036('0x13')](_0x58227c)?_0x1036('0x14')+_0x58227c:'';_0x1ee612=typeof _0x2e320d[_0x1036('0xe')]===_0x1036('0x15')?JSON[_0x1036('0x16')](_0x2e320d[_0x1036('0xe')]):_0x2e320d[_0x1036('0xe')];logger[_0x1036('0x10')](util['format'](_0x1036('0x17'),_0x1eea08[_0x1036('0x4')],_0x1eea08['data2'],_0x2e320d[_0x1036('0x18')],_0x1ee612));})[_0x1036('0x19')](function(_0x24c4a3){logger[_0x1036('0xf')](util[_0x1036('0x11')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x1eea08[_0x1036('0x4')],_0x1eea08[_0x1036('0x6')],_0x24c4a3[_0x1036('0x18')],_0x24c4a3['name'],_0x24c4a3[_0x1036('0x1a')]));});};
\ No newline at end of file
index 7c4fa62..d1f6f08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6053=['Request','request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x58d588,_0x1e948a){var _0x31c8b7=function(_0x1c7dba){while(--_0x1c7dba){_0x58d588['push'](_0x58d588['shift']());}};_0x31c8b7(++_0x1e948a);}(_0x6053,0x1a9));var _0x3605=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6053[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x3605('0x0'));var BPromise=require(_0x3605('0x1'));var logger=require(_0x3605('0x2'))(_0x3605('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x3605('0x4')]=function(_0x54d6c0,_0x4e6050){return new BPromise(function(_0x2de262,_0x5ede6e){return client[_0x3605('0x5')](_0x54d6c0,_0x4e6050)[_0x3605('0x6')](function(_0x15304a){logger[_0x3605('0x7')](_0x3605('0x8'),_0x3605('0x3'),_0x54d6c0,_0x4e6050,_0x15304a);if(_0x15304a[_0x3605('0x9')]){logger[_0x3605('0x9')](_0x3605('0x8'),'routing',_0x54d6c0,_0x15304a[_0x3605('0x9')][_0x3605('0xa')],_0x4e6050);return _0x5ede6e(_0x15304a['error'][_0x3605('0xa')]);}else{return _0x2de262(_0x15304a['result']);}})[_0x3605('0xb')](function(_0x162120){logger[_0x3605('0x9')](_0x3605('0x8'),_0x3605('0x3'),_0x54d6c0,_0x162120,_0x4e6050);return _0x5ede6e(_0x162120);});});};module[_0x3605('0xc')]=client;
\ No newline at end of file
+var _0x7b73=['request','then','debug','rpc','error','routing','message','result','catch','exports','jayson/promise','bluebird','http','Request'];(function(_0x12b1b2,_0x25000c){var _0x51f080=function(_0x5f24fb){while(--_0x5f24fb){_0x12b1b2['push'](_0x12b1b2['shift']());}};_0x51f080(++_0x25000c);}(_0x7b73,0x1f4));var _0x37b7=function(_0x2d6375,_0x149216){_0x2d6375=_0x2d6375-0x0;var _0x29186f=_0x7b73[_0x2d6375];return _0x29186f;};'use strict';var jayson=require(_0x37b7('0x0'));var BPromise=require(_0x37b7('0x1'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x37b7('0x2')]({'port':0x2329});client[_0x37b7('0x3')]=function(_0x2ecf3d,_0x3bc819){return new BPromise(function(_0x52cc4d,_0x5051f3){return client[_0x37b7('0x4')](_0x2ecf3d,_0x3bc819)[_0x37b7('0x5')](function(_0x1081bd){logger[_0x37b7('0x6')](_0x37b7('0x7'),'routing',_0x2ecf3d,_0x3bc819,_0x1081bd);if(_0x1081bd[_0x37b7('0x8')]){logger['error'](_0x37b7('0x7'),_0x37b7('0x9'),_0x2ecf3d,_0x1081bd[_0x37b7('0x8')][_0x37b7('0xa')],_0x3bc819);return _0x5051f3(_0x1081bd[_0x37b7('0x8')][_0x37b7('0xa')]);}else{return _0x52cc4d(_0x1081bd[_0x37b7('0xb')]);}})[_0x37b7('0xc')](function(_0x2f6efa){logger[_0x37b7('0x8')]('rpc','routing',_0x2ecf3d,_0x2f6efa,_0x3bc819);return _0x5051f3(_0x2f6efa);});});};module[_0x37b7('0xd')]=client;
\ No newline at end of file
index 84b162d..c18d146 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9207=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x4df58e,_0x30d830){var _0x2754d8=function(_0x6a550e){while(--_0x6a550e){_0x4df58e['push'](_0x4df58e['shift']());}};_0x2754d8(++_0x30d830);}(_0x9207,0x17f));var _0x7920=function(_0x2e748c,_0x55ec8e){_0x2e748c=_0x2e748c-0x0;var _0x37e219=_0x9207[_0x2e748c];return _0x37e219;};'use strict';var server=require(_0x7920('0x0'));var Realtime=require(_0x7920('0x1'));var EmailChannel=require(_0x7920('0x2'));var mailAccount=require(_0x7920('0x3'));var setting=require(_0x7920('0x4'));var logger=require(_0x7920('0x5'))(_0x7920('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7920('0x7')]()[_0x7920('0x8')](mailAccount['getMailAccounts']())['then'](realtime[_0x7920('0x9')]())[_0x7920('0x8')](function(){email['refresh'](realtime[_0x7920('0xa')]);return realtime;});}function main(){return server[_0x7920('0xb')](realtime,email)[_0x7920('0x8')](function(){return initRealtime();})[_0x7920('0x8')](function(){return setting['getSettings']();})[_0x7920('0x8')](function(_0x173df2){return setInterval(initRealtime,_0x173df2[_0x7920('0xc')]*0x3e8);})[_0x7920('0xd')](function(_0x37335f){logger[_0x7920('0xe')](_0x7920('0xf'),_0x37335f);});}main();
\ No newline at end of file
+var _0x6993=['Email\x20service\x20initialization','./lib/email','./rpc/setting','../../config/logger','email','then','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x6993,0x1a5));var _0x3699=function(_0x51bc84,_0x519320){_0x51bc84=_0x51bc84-0x0;var _0x3a953e=_0x6993[_0x51bc84];return _0x3a953e;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x3699('0x0'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3699('0x1'));var logger=require(_0x3699('0x2'))(_0x3699('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x3699('0x4')](mailAccount['getMailAccounts']())[_0x3699('0x4')](realtime[_0x3699('0x5')]())['then'](function(){email['refresh'](realtime[_0x3699('0x6')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x3699('0x4')](function(){return initRealtime();})[_0x3699('0x4')](function(){return setting[_0x3699('0x7')]();})[_0x3699('0x4')](function(_0x52e561){return setInterval(initRealtime,_0x52e561[_0x3699('0x8')]*0x3e8);})[_0x3699('0x9')](function(_0x592e6b){logger[_0x3699('0xa')](_0x3699('0xb'),_0x592e6b);});}main();
\ No newline at end of file
index 1f2a718..5edf898 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x75aa=['total','stringify','refresh','service','provider','custom','imapAccounts','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','isNil','disabled','messageStatus','connected','name','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','send','verifySmtp','Smtp','smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','prototype','emit','key','active','status','Imap'];(function(_0x20627e,_0x1a28cd){var _0x2abff2=function(_0x35a065){while(--_0x35a065){_0x20627e['push'](_0x20627e['shift']());}};_0x2abff2(++_0x1a28cd);}(_0x75aa,0x13d));var _0xa75a=function(_0x52e741,_0x1ff0f1){_0x52e741=_0x52e741-0x0;var _0x80acfd=_0x75aa[_0x52e741];return _0x80acfd;};'use strict';var _=require(_0xa75a('0x0'));var moment=require(_0xa75a('0x1'));var BPromise=require(_0xa75a('0x2'));var md5=require(_0xa75a('0x3'));var Redis=require(_0xa75a('0x4'));var config=require('../../../config/environment');var logger=require(_0xa75a('0x5'))(_0xa75a('0x6'));config['redis']=_['defaults'](config[_0xa75a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa75a('0x8'))(new Redis(config[_0xa75a('0x7')]));var EmailImap=require(_0xa75a('0x9'));var EmailSmtp=require(_0xa75a('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x32fba8){logger['info'](_0xa75a('0xb'));this[_0xa75a('0xc')]=_0x32fba8[_0xa75a('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xa75a('0xd')][_0xa75a('0xe')]=function(_0x5bfeea){var _0x2fcaca=this['mailAccounts'][_0x5bfeea];var _0x1e08b6={'id':_0x2fcaca['id'],'name':_0x2fcaca['name'],'key':_0x2fcaca[_0xa75a('0xf')],'active':_0x2fcaca[_0xa75a('0x10')],'Imap':{'status':_0x2fcaca['Imap'][_0xa75a('0x11')],'messageStatus':_0x2fcaca['Imap']['messageStatus'],'total':_0x2fcaca[_0xa75a('0x12')][_0xa75a('0x13')]}};if(_['isNil'](md5Accounts[_0x5bfeea])){md5Accounts[_0x5bfeea]={};}var _0x2bfc7f=md5(JSON[_0xa75a('0x14')](_0x1e08b6));if(md5Accounts[_0x5bfeea]['md5']!==_0x2bfc7f){md5Accounts[_0x5bfeea]['md5']=_0x2bfc7f;io[_0xa75a('0xe')]('mailAccount:update',_0x1e08b6);}};EmailChannel[_0xa75a('0xd')][_0xa75a('0x15')]=function(_0x4c7a8f){for(var _0x5f52e5 in _0x4c7a8f){if(_0x4c7a8f['hasOwnProperty'](_0x5f52e5)){if(_0x4c7a8f[_0x5f52e5][_0xa75a('0x12')]&&_0x4c7a8f[_0x5f52e5][_0xa75a('0x10')]){var _0x13508b=_0x4c7a8f[_0x5f52e5][_0xa75a('0x12')];if(!_0x13508b[_0xa75a('0x16')]&&_0x4c7a8f[_0x5f52e5][_0xa75a('0x17')]!==_0xa75a('0x18'))_0x13508b[_0xa75a('0x16')]=_0x4c7a8f[_0x5f52e5][_0xa75a('0x17')];if(!this[_0xa75a('0x19')][_0xa75a('0x1a')](_0x13508b['id'])){this[_0xa75a('0x19')][_0x13508b['id']]=new EmailImap(_0x13508b,_0x4c7a8f[_0x5f52e5][_0xa75a('0x6')]);this['imapAccounts'][_0x13508b['id']]['on'](_0xa75a('0x1b'),this[_0xa75a('0x1c')][_0xa75a('0x1d')](this,_0x5f52e5));this[_0xa75a('0x19')][_0x13508b['id']]['on'](_0xa75a('0x6'),this['handleImapEmail']['bind'](this,_0x5f52e5));this[_0xa75a('0x19')][_0x13508b['id']]['on'](_0xa75a('0x1e'),this[_0xa75a('0x1f')][_0xa75a('0x1d')](this,_0x5f52e5));this['imapAccounts'][_0x13508b['id']]['on'](_0xa75a('0x20'),this[_0xa75a('0x21')][_0xa75a('0x1d')](this,_0x5f52e5));}}else{if(_[_0xa75a('0x22')](this[_0xa75a('0xc')][_0x5f52e5][_0xa75a('0x12')])){this[_0xa75a('0xc')][_0x5f52e5]['Imap']={};}this[_0xa75a('0xc')][_0x5f52e5][_0xa75a('0x12')][_0xa75a('0x11')]=_0xa75a('0x23');this['mailAccounts'][_0x5f52e5]['Imap'][_0xa75a('0x24')]='';this['emit'](_0x5f52e5);}}}};EmailChannel[_0xa75a('0xd')][_0xa75a('0x1c')]=function(_0x1f5dc0,_0x1e60eb){if(this['mailAccounts'][_0x1f5dc0]){this[_0xa75a('0xc')][_0x1f5dc0][_0xa75a('0x12')][_0xa75a('0x11')]=_0xa75a('0x25');this[_0xa75a('0xc')][_0x1f5dc0][_0xa75a('0x12')][_0xa75a('0x24')]=_0x1e60eb[_0xa75a('0x26')];if(_0x1e60eb[_0xa75a('0x27')]){this[_0xa75a('0xc')][_0x1f5dc0][_0xa75a('0x12')][_0xa75a('0x13')]=_0x1e60eb['messages'][_0xa75a('0x13')];}return this[_0xa75a('0xe')](_0x1f5dc0);}};EmailChannel[_0xa75a('0xd')][_0xa75a('0x28')]=function(_0x451c78,_0x1f006b){logger[_0xa75a('0x29')](_0xa75a('0x2a'),_0x1f006b[_0xa75a('0x2b')],_0x1f006b[_0xa75a('0x2c')],_0x1f006b['from'],_0x451c78);if(this[_0xa75a('0xc')][_0x451c78]){return mailAccount[_0xa75a('0x2d')](_0x451c78,_0x1f006b)[_0xa75a('0x2e')](function(_0x11ee57){if(_0x11ee57){logger[_0xa75a('0x29')](_0xa75a('0x2f'));}})[_0xa75a('0x30')](function(_0x31946e){logger[_0xa75a('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xa75a('0x14')](_0x31946e));});}};EmailChannel['prototype'][_0xa75a('0x1f')]=function(_0x18d447){if(this['mailAccounts'][_0x18d447]&&this[_0xa75a('0xc')][_0x18d447][_0xa75a('0x12')]){if(this[_0xa75a('0x19')][this[_0xa75a('0xc')][_0x18d447]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x18d447][_0xa75a('0x12')]['id']];}this[_0xa75a('0xc')][_0x18d447]['Imap'][_0xa75a('0x31')]=moment();this['emit'](_0x18d447);}};EmailChannel['prototype'][_0xa75a('0x21')]=function(_0x36c8b6,_0x2cfa0e){if(this[_0xa75a('0xc')][_0x36c8b6]){this[_0xa75a('0xc')][_0x36c8b6][_0xa75a('0x12')][_0xa75a('0x11')]=_0xa75a('0x20');this[_0xa75a('0xc')][_0x36c8b6]['Imap'][_0xa75a('0x24')]=_0x2cfa0e;return this[_0xa75a('0xe')](_0x36c8b6);}};EmailChannel['prototype']['sendMail']=function(_0x315630,_0x2cc99c){return this['smtp'][_0xa75a('0x32')](_0x315630,_0x2cc99c);};EmailChannel['prototype'][_0xa75a('0x33')]=function(_0x460200){var _0x42fc7c=this;if(this['mailAccounts'][_0x460200['id']]){if(_[_0xa75a('0x22')](this[_0xa75a('0xc')][_0x460200['id']][_0xa75a('0x34')])){this['mailAccounts'][_0x460200['id']][_0xa75a('0x34')]={};}this[_0xa75a('0xc')][_0x460200['id']][_0xa75a('0x34')][_0xa75a('0x31')]=moment();return new BPromise(function(_0x22344a,_0x40efef){return _0x42fc7c[_0xa75a('0x35')][_0xa75a('0x36')](_0x460200)[_0xa75a('0x2e')](function(_0x333ed3){_0x42fc7c['mailAccounts'][_0x460200['id']][_0xa75a('0x34')][_0xa75a('0x11')]=_0xa75a('0x37');_0x42fc7c[_0xa75a('0xc')][_0x460200['id']][_0xa75a('0x34')]['messageStatus']='';_0x42fc7c[_0xa75a('0xe')](_0x460200['id']);_0x22344a(_0x333ed3);})[_0xa75a('0x30')](function(_0x1f587a){_0x42fc7c[_0xa75a('0xc')][_0x460200['id']]['Smtp'][_0xa75a('0x11')]=_0xa75a('0x20');_0x42fc7c[_0xa75a('0xc')][_0x460200['id']][_0xa75a('0x34')]['messageStatus']=_0x1f587a;_0x42fc7c['emit'](_0x460200['id']);_0x40efef(_0x1f587a);});});}return this[_0xa75a('0x35')]['verify'](_0x460200);};module['exports']=EmailChannel;
\ No newline at end of file
+var _0x6382=['mailAccounts','prototype','emit','name','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','email','box','bind','handleImapEnd','handleImapError','status','handleImapBox','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x6382,0x64));var _0x2638=function(_0x59b80e,_0x3c6f41){_0x59b80e=_0x59b80e-0x0;var _0x2c4395=_0x6382[_0x59b80e];return _0x2c4395;};'use strict';var _=require(_0x2638('0x0'));var moment=require(_0x2638('0x1'));var BPromise=require(_0x2638('0x2'));var md5=require(_0x2638('0x3'));var Redis=require(_0x2638('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config[_0x2638('0x5')]=_['defaults'](config[_0x2638('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2638('0x6'))(new Redis(config['redis']));var EmailImap=require(_0x2638('0x7'));var EmailSmtp=require(_0x2638('0x8'));var mailAccount=require(_0x2638('0x9'));var md5Accounts={};function EmailChannel(_0x294104){logger[_0x2638('0xa')](_0x2638('0xb'));this['mailAccounts']=_0x294104[_0x2638('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x2638('0xd')][_0x2638('0xe')]=function(_0x2536f4){var _0x523d8d=this['mailAccounts'][_0x2536f4];var _0x3304c2={'id':_0x523d8d['id'],'name':_0x523d8d[_0x2638('0xf')],'key':_0x523d8d['key'],'active':_0x523d8d['active'],'Imap':{'status':_0x523d8d[_0x2638('0x10')]['status'],'messageStatus':_0x523d8d[_0x2638('0x10')][_0x2638('0x11')],'total':_0x523d8d[_0x2638('0x10')][_0x2638('0x12')]}};if(_[_0x2638('0x13')](md5Accounts[_0x2536f4])){md5Accounts[_0x2536f4]={};}var _0x122673=md5(JSON[_0x2638('0x14')](_0x3304c2));if(md5Accounts[_0x2536f4]['md5']!==_0x122673){md5Accounts[_0x2536f4]['md5']=_0x122673;io[_0x2638('0xe')](_0x2638('0x15'),_0x3304c2);}};EmailChannel[_0x2638('0xd')][_0x2638('0x16')]=function(_0x55edfd){for(var _0x48d1f9 in _0x55edfd){if(_0x55edfd[_0x2638('0x17')](_0x48d1f9)){if(_0x55edfd[_0x48d1f9][_0x2638('0x10')]&&_0x55edfd[_0x48d1f9]['active']){var _0x3c462a=_0x55edfd[_0x48d1f9]['Imap'];if(!_0x3c462a[_0x2638('0x18')]&&_0x55edfd[_0x48d1f9][_0x2638('0x19')]!==_0x2638('0x1a'))_0x3c462a['service']=_0x55edfd[_0x48d1f9][_0x2638('0x19')];if(!this[_0x2638('0x1b')][_0x2638('0x17')](_0x3c462a['id'])){this[_0x2638('0x1b')][_0x3c462a['id']]=new EmailImap(_0x3c462a,_0x55edfd[_0x48d1f9][_0x2638('0x1c')]);this['imapAccounts'][_0x3c462a['id']]['on'](_0x2638('0x1d'),this['handleImapBox'][_0x2638('0x1e')](this,_0x48d1f9));this['imapAccounts'][_0x3c462a['id']]['on'](_0x2638('0x1c'),this['handleImapEmail'][_0x2638('0x1e')](this,_0x48d1f9));this[_0x2638('0x1b')][_0x3c462a['id']]['on']('end',this[_0x2638('0x1f')][_0x2638('0x1e')](this,_0x48d1f9));this[_0x2638('0x1b')][_0x3c462a['id']]['on']('error',this[_0x2638('0x20')]['bind'](this,_0x48d1f9));}}else{if(_[_0x2638('0x13')](this['mailAccounts'][_0x48d1f9]['Imap'])){this['mailAccounts'][_0x48d1f9][_0x2638('0x10')]={};}this['mailAccounts'][_0x48d1f9][_0x2638('0x10')][_0x2638('0x21')]='disabled';this[_0x2638('0xc')][_0x48d1f9][_0x2638('0x10')]['messageStatus']='';this[_0x2638('0xe')](_0x48d1f9);}}}};EmailChannel['prototype'][_0x2638('0x22')]=function(_0x2aa051,_0x1ed55c){if(this['mailAccounts'][_0x2aa051]){this[_0x2638('0xc')][_0x2aa051]['Imap']['status']=_0x2638('0x23');this[_0x2638('0xc')][_0x2aa051]['Imap'][_0x2638('0x11')]=_0x1ed55c['name'];if(_0x1ed55c[_0x2638('0x24')]){this[_0x2638('0xc')][_0x2aa051][_0x2638('0x10')][_0x2638('0x12')]=_0x1ed55c[_0x2638('0x24')]['total'];}return this[_0x2638('0xe')](_0x2aa051);}};EmailChannel['prototype'][_0x2638('0x25')]=function(_0x27ed11,_0x51541d){logger['info'](_0x2638('0x26'),_0x51541d[_0x2638('0x27')],_0x51541d[_0x2638('0x28')],_0x51541d[_0x2638('0x29')],_0x27ed11);if(this[_0x2638('0xc')][_0x27ed11]){return mailAccount[_0x2638('0x2a')](_0x27ed11,_0x51541d)[_0x2638('0x2b')](function(_0x4abf96){if(_0x4abf96){logger[_0x2638('0xa')](_0x2638('0x2c'));}})[_0x2638('0x2d')](function(_0x433b44){logger[_0x2638('0x2e')](_0x2638('0x2f'),JSON['stringify'](_0x433b44));});}};EmailChannel[_0x2638('0xd')][_0x2638('0x1f')]=function(_0x1f2638){if(this[_0x2638('0xc')][_0x1f2638]&&this[_0x2638('0xc')][_0x1f2638][_0x2638('0x10')]){if(this[_0x2638('0x1b')][this[_0x2638('0xc')][_0x1f2638][_0x2638('0x10')]['id']]){delete this[_0x2638('0x1b')][this[_0x2638('0xc')][_0x1f2638][_0x2638('0x10')]['id']];}this[_0x2638('0xc')][_0x1f2638]['Imap']['lastSync']=moment();this[_0x2638('0xe')](_0x1f2638);}};EmailChannel['prototype'][_0x2638('0x20')]=function(_0x30ee02,_0x198ab7){if(this[_0x2638('0xc')][_0x30ee02]){this[_0x2638('0xc')][_0x30ee02][_0x2638('0x10')][_0x2638('0x21')]=_0x2638('0x2e');this['mailAccounts'][_0x30ee02][_0x2638('0x10')][_0x2638('0x11')]=_0x198ab7;return this[_0x2638('0xe')](_0x30ee02);}};EmailChannel[_0x2638('0xd')][_0x2638('0x30')]=function(_0x41fef9,_0x327332){return this[_0x2638('0x31')][_0x2638('0x32')](_0x41fef9,_0x327332);};EmailChannel[_0x2638('0xd')][_0x2638('0x33')]=function(_0xdb967a){var _0x5d8d30=this;if(this[_0x2638('0xc')][_0xdb967a['id']]){if(_[_0x2638('0x13')](this['mailAccounts'][_0xdb967a['id']]['Smtp'])){this[_0x2638('0xc')][_0xdb967a['id']]['Smtp']={};}this[_0x2638('0xc')][_0xdb967a['id']][_0x2638('0x34')]['lastSync']=moment();return new BPromise(function(_0x7cc178,_0x3e8c3a){return _0x5d8d30[_0x2638('0x31')][_0x2638('0x35')](_0xdb967a)[_0x2638('0x2b')](function(_0x1fefdd){_0x5d8d30['mailAccounts'][_0xdb967a['id']]['Smtp'][_0x2638('0x21')]=_0x2638('0x36');_0x5d8d30[_0x2638('0xc')][_0xdb967a['id']][_0x2638('0x34')][_0x2638('0x11')]='';_0x5d8d30['emit'](_0xdb967a['id']);_0x7cc178(_0x1fefdd);})[_0x2638('0x2d')](function(_0x418c25){_0x5d8d30['mailAccounts'][_0xdb967a['id']][_0x2638('0x34')]['status']=_0x2638('0x2e');_0x5d8d30[_0x2638('0xc')][_0xdb967a['id']][_0x2638('0x34')][_0x2638('0x11')]=_0x418c25;_0x5d8d30[_0x2638('0xe')](_0xdb967a['id']);_0x3e8c3a(_0x418c25);});});}return this[_0x2638('0x31')][_0x2638('0x35')](_0xdb967a);};module[_0x2638('0x37')]=EmailChannel;
\ No newline at end of file
index 51c96fa..d9a74e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c52=['account','handleCloseBox','stringify','textCode','hasOwnProperty','exports','lodash','imap','mailparser','iconv','Iconv','events','../../../config/logger','email','mailbox','getAccount','handleReady','bind','end','handleEnd','error','handleError','connect','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','once','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x6c52,0x7e));var _0x26c5=function(_0x598072,_0x39758e){_0x598072=_0x598072-0x0;var _0xe8e115=_0x6c52[_0x598072];return _0xe8e115;};'use strict';var _=require(_0x26c5('0x0'));var util=require('util');var Imap=require(_0x26c5('0x1'));var simpleParser=require(_0x26c5('0x2'))['simpleParser'];var Iconv=require(_0x26c5('0x3'))[_0x26c5('0x4')];var EventEmitter=require(_0x26c5('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x26c5('0x6'))(_0x26c5('0x7'));function EmailImap(_0x52427d,_0x8ab09f){this['mailbox']=_0x52427d[_0x26c5('0x8')];this['account']=this[_0x26c5('0x9')](_0x52427d,_0x8ab09f);this[_0x26c5('0x1')]=new Imap(this['account']);this[_0x26c5('0x1')]['once']('ready',this[_0x26c5('0xa')][_0x26c5('0xb')](this));this[_0x26c5('0x1')]['once'](_0x26c5('0xc'),this[_0x26c5('0xd')]['bind'](this));this[_0x26c5('0x1')]['on'](_0x26c5('0xe'),this[_0x26c5('0xf')][_0x26c5('0xb')](this));this[_0x26c5('0x1')][_0x26c5('0x10')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x26c5('0x9')]=function(_0xb813e4,_0x29cf93){var _0x5300d7={'connTimeout':_0xb813e4[_0x26c5('0x11')]?_0xb813e4[_0x26c5('0x11')]*0x3e8:0x2710,'authTimeout':_0xb813e4['authTimeout']?_0xb813e4[_0x26c5('0x12')]*0x3e8:0x1388};if(_0xb813e4[_0x26c5('0x13')]){_0x5300d7[_0x26c5('0x14')]=_0xb813e4[_0x26c5('0x14')];if(_0xb813e4[_0x26c5('0x15')]){_0x5300d7[_0x26c5('0x16')]=utils[_0x26c5('0x17')](_0xb813e4['CloudProvider'][_0x26c5('0x18')],_0xb813e4[_0x26c5('0x14')]);}else{_0x5300d7['password']=_0xb813e4[_0x26c5('0x19')];}}else{if(_0xb813e4[_0x26c5('0x1a')]){_0x5300d7[_0x26c5('0x14')]=_0xb813e4[_0x26c5('0x14')];_0x5300d7[_0x26c5('0x19')]=_0xb813e4['password'];}}_0x5300d7[_0x26c5('0x7')]=_0x29cf93||_0xb813e4[_0x26c5('0x14')]||_0x26c5('0x1b');_0x5300d7[_0x26c5('0x1c')]=_0xb813e4[_0x26c5('0x1c')];_0x5300d7[_0x26c5('0x1d')]=_0xb813e4['port']||0x3e1;if(_0xb813e4[_0x26c5('0x1e')]){_0x5300d7[_0x26c5('0x1e')]=!![];}else{_0x5300d7['tls']=![];_0x5300d7['autotls']=_0x26c5('0x1f');}return _0x5300d7;};EmailImap[_0x26c5('0x20')]['handleReady']=function(){this[_0x26c5('0x1')][_0x26c5('0x21')](this[_0x26c5('0x8')],![],this[_0x26c5('0x22')]['bind'](this));};EmailImap[_0x26c5('0x20')][_0x26c5('0x22')]=function(_0x5aab00,_0x54070c){if(_0x5aab00){this[_0x26c5('0xf')](_0x5aab00,!![]);}else{this[_0x26c5('0x23')](_0x26c5('0x24'),_0x54070c);this[_0x26c5('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x5ef031){if(_0x5ef031){this[_0x26c5('0xf')](_0x5ef031,!![]);}else{this['imap'][_0x26c5('0xc')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x26c5('0x26')]([_0x26c5('0x27')],this[_0x26c5('0x28')][_0x26c5('0xb')](this));};EmailImap[_0x26c5('0x20')][_0x26c5('0x28')]=function(_0x362287,_0x32a6f0){if(_0x362287){this['handleError'](_0x362287,!![]);}else{if(_0x32a6f0[_0x26c5('0x29')]){try{var _0x3d6f56=this[_0x26c5('0x1')][_0x26c5('0x2a')](_0x32a6f0,{'bodies':'','markSeen':!![]});_0x3d6f56['on']('message',this[_0x26c5('0x2b')][_0x26c5('0xb')](this));_0x3d6f56[_0x26c5('0x2c')](_0x26c5('0xe'),this[_0x26c5('0x2d')][_0x26c5('0xb')](this));_0x3d6f56[_0x26c5('0x2c')]('end',this[_0x26c5('0x2e')][_0x26c5('0xb')](this));}catch(_0x5bce44){logger[_0x26c5('0xe')](_0x5bce44);}}else{this[_0x26c5('0x1')][_0x26c5('0x2f')](!![],this['handleCloseBox'][_0x26c5('0xb')](this));}}};EmailImap['prototype'][_0x26c5('0x2b')]=function(_0xf89e79){_0xf89e79['on'](_0x26c5('0x30'),this['handleMessageBody']['bind'](this));_0xf89e79['once'](_0x26c5('0x31'),this[_0x26c5('0x32')]['bind'](this));_0xf89e79[_0x26c5('0x2c')](_0x26c5('0xc'),this[_0x26c5('0x33')][_0x26c5('0xb')](this));};EmailImap[_0x26c5('0x20')]['handleMessageBody']=function(_0x2e84df){simpleParser(_0x2e84df,{'Iconv':Iconv},this[_0x26c5('0x34')][_0x26c5('0xb')](this));};EmailImap['prototype'][_0x26c5('0x32')]=function(){};EmailImap['prototype'][_0x26c5('0x33')]=function(){};EmailImap[_0x26c5('0x20')]['handleSimpleParser']=function(_0xce4823,_0x2e16a1){if(_0xce4823){logger['error'](_0xce4823);}else{var _0x43e05d=this;utils[_0x26c5('0x35')](this[_0x26c5('0x36')],_0x2e16a1,function(_0x4c4d11){_0x43e05d[_0x26c5('0x23')](_0x26c5('0x7'),_0x4c4d11);});}};EmailImap[_0x26c5('0x20')][_0x26c5('0x2e')]=function(){this[_0x26c5('0x1')][_0x26c5('0x2f')](!![],this[_0x26c5('0x37')][_0x26c5('0xb')](this));};EmailImap['prototype']['handleFetchError']=function(_0xd8adc8){this['handleError'](_0xd8adc8);this[_0x26c5('0x1')][_0x26c5('0x2f')](!![],this['handleCloseBox'][_0x26c5('0xb')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit']('end');};EmailImap[_0x26c5('0x20')]['handleError']=function(_0x586d03,_0x4c7a2b){logger['error'](_0x26c5('0xf'),this[_0x26c5('0x36')][_0x26c5('0x7')],JSON[_0x26c5('0x38')](_0x586d03));var _0x146987='';if(_0x586d03){if(_0x586d03[_0x26c5('0x39')]){_0x146987=_0x586d03['textCode'];}else{for(var _0x3ccd7b in _0x586d03){if(_0x586d03[_0x26c5('0x3a')](_0x3ccd7b)){_0x146987+=_['upperFirst'](_0x3ccd7b)+':\x20'+_0x586d03[_0x3ccd7b]+'\x0a';}}}}if(_0x4c7a2b){this[_0x26c5('0x1')]['end']();}else{this[_0x26c5('0x23')](_0x26c5('0xe'),_0x146987);this['emit'](_0x26c5('0xc'));}};module[_0x26c5('0x3b')]=EmailImap;
\ No newline at end of file
+var _0xf304=['handleReady','openBox','mailbox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','UNSEEN','length','fetch','handleFetchMessage','once','closeBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','./utils','../../../config/logger','email','account','getAccount','ready','bind','end','error','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required'];(function(_0x433186,_0x237342){var _0x5eb10b=function(_0x40d50c){while(--_0x40d50c){_0x433186['push'](_0x433186['shift']());}};_0x5eb10b(++_0x237342);}(_0xf304,0x19f));var _0x4f30=function(_0x258d6e,_0x54387b){_0x258d6e=_0x258d6e-0x0;var _0x1654f2=_0xf304[_0x258d6e];return _0x1654f2;};'use strict';var _=require(_0x4f30('0x0'));var util=require(_0x4f30('0x1'));var Imap=require(_0x4f30('0x2'));var simpleParser=require(_0x4f30('0x3'))[_0x4f30('0x4')];var Iconv=require(_0x4f30('0x5'))[_0x4f30('0x6')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x4f30('0x7'));var logger=require(_0x4f30('0x8'))(_0x4f30('0x9'));function EmailImap(_0x5a2268,_0x14fe11){this['mailbox']=_0x5a2268['mailbox'];this[_0x4f30('0xa')]=this[_0x4f30('0xb')](_0x5a2268,_0x14fe11);this['imap']=new Imap(this[_0x4f30('0xa')]);this[_0x4f30('0x2')]['once'](_0x4f30('0xc'),this['handleReady'][_0x4f30('0xd')](this));this[_0x4f30('0x2')]['once'](_0x4f30('0xe'),this['handleEnd'][_0x4f30('0xd')](this));this[_0x4f30('0x2')]['on'](_0x4f30('0xf'),this['handleError'][_0x4f30('0xd')](this));this[_0x4f30('0x2')]['connect']();}util[_0x4f30('0x10')](EmailImap,EventEmitter);EmailImap[_0x4f30('0x11')][_0x4f30('0xb')]=function(_0x1d812a,_0x35abc5){var _0x55e5c7={'connTimeout':_0x1d812a[_0x4f30('0x12')]?_0x1d812a['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1d812a[_0x4f30('0x13')]?_0x1d812a[_0x4f30('0x13')]*0x3e8:0x1388};if(_0x1d812a['service']){_0x55e5c7[_0x4f30('0x14')]=_0x1d812a[_0x4f30('0x14')];if(_0x1d812a[_0x4f30('0x15')]){_0x55e5c7[_0x4f30('0x16')]=utils[_0x4f30('0x17')](_0x1d812a['CloudProvider'][_0x4f30('0x18')],_0x1d812a['user']);}else{_0x55e5c7[_0x4f30('0x19')]=_0x1d812a[_0x4f30('0x19')];}}else{if(_0x1d812a[_0x4f30('0x1a')]){_0x55e5c7[_0x4f30('0x14')]=_0x1d812a['user'];_0x55e5c7['password']=_0x1d812a['password'];}}_0x55e5c7['email']=_0x35abc5||_0x1d812a[_0x4f30('0x14')]||_0x4f30('0x1b');_0x55e5c7[_0x4f30('0x1c')]=_0x1d812a[_0x4f30('0x1c')];_0x55e5c7[_0x4f30('0x1d')]=_0x1d812a[_0x4f30('0x1d')]||0x3e1;if(_0x1d812a[_0x4f30('0x1e')]){_0x55e5c7[_0x4f30('0x1e')]=!![];}else{_0x55e5c7[_0x4f30('0x1e')]=![];_0x55e5c7[_0x4f30('0x1f')]=_0x4f30('0x20');}return _0x55e5c7;};EmailImap[_0x4f30('0x11')][_0x4f30('0x21')]=function(){this['imap'][_0x4f30('0x22')](this[_0x4f30('0x23')],![],this[_0x4f30('0x24')][_0x4f30('0xd')](this));};EmailImap['prototype'][_0x4f30('0x24')]=function(_0x412166,_0x33c05d){if(_0x412166){this[_0x4f30('0x25')](_0x412166,!![]);}else{this[_0x4f30('0x26')]('box',_0x33c05d);this[_0x4f30('0x27')]();}};EmailImap[_0x4f30('0x11')][_0x4f30('0x28')]=function(_0x5aa079){if(_0x5aa079){this['handleError'](_0x5aa079,!![]);}else{this[_0x4f30('0x2')][_0x4f30('0xe')]();}};EmailImap[_0x4f30('0x11')][_0x4f30('0x27')]=function(){this['imap']['search']([_0x4f30('0x29')],this['handleReadUnseen'][_0x4f30('0xd')](this));};EmailImap[_0x4f30('0x11')]['handleReadUnseen']=function(_0x411f54,_0x3a92c6){if(_0x411f54){this[_0x4f30('0x25')](_0x411f54,!![]);}else{if(_0x3a92c6[_0x4f30('0x2a')]){try{var _0x1bc75a=this[_0x4f30('0x2')][_0x4f30('0x2b')](_0x3a92c6,{'bodies':'','markSeen':!![]});_0x1bc75a['on']('message',this[_0x4f30('0x2c')][_0x4f30('0xd')](this));_0x1bc75a[_0x4f30('0x2d')](_0x4f30('0xf'),this['handleFetchError'][_0x4f30('0xd')](this));_0x1bc75a['once'](_0x4f30('0xe'),this['handleFetchEnd'][_0x4f30('0xd')](this));}catch(_0x329724){logger['error'](_0x329724);}}else{this[_0x4f30('0x2')][_0x4f30('0x2e')](!![],this[_0x4f30('0x28')][_0x4f30('0xd')](this));}}};EmailImap[_0x4f30('0x11')]['handleFetchMessage']=function(_0x5e2c2e){_0x5e2c2e['on'](_0x4f30('0x2f'),this[_0x4f30('0x30')][_0x4f30('0xd')](this));_0x5e2c2e[_0x4f30('0x2d')]('attributes',this[_0x4f30('0x31')]['bind'](this));_0x5e2c2e[_0x4f30('0x2d')]('end',this['handleMessageEnd'][_0x4f30('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x2d6313){simpleParser(_0x2d6313,{'Iconv':Iconv},this[_0x4f30('0x32')][_0x4f30('0xd')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x4f30('0x33')]=function(){};EmailImap[_0x4f30('0x11')][_0x4f30('0x32')]=function(_0x30cd8c,_0x453d19){if(_0x30cd8c){logger[_0x4f30('0xf')](_0x30cd8c);}else{var _0x33ab7d=this;utils[_0x4f30('0x34')](this[_0x4f30('0xa')],_0x453d19,function(_0x2370b8){_0x33ab7d['emit'](_0x4f30('0x9'),_0x2370b8);});}};EmailImap[_0x4f30('0x11')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this['handleCloseBox'][_0x4f30('0xd')](this));};EmailImap['prototype']['handleFetchError']=function(_0x5d2909){this[_0x4f30('0x25')](_0x5d2909);this[_0x4f30('0x2')][_0x4f30('0x2e')](!![],this[_0x4f30('0x28')][_0x4f30('0xd')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x4f30('0x26')](_0x4f30('0xe'));};EmailImap[_0x4f30('0x11')][_0x4f30('0x25')]=function(_0x5a0a77,_0x5e8a28){logger['error'](_0x4f30('0x25'),this[_0x4f30('0xa')][_0x4f30('0x9')],JSON[_0x4f30('0x35')](_0x5a0a77));var _0x2b5faa='';if(_0x5a0a77){if(_0x5a0a77[_0x4f30('0x36')]){_0x2b5faa=_0x5a0a77['textCode'];}else{for(var _0x4bbe63 in _0x5a0a77){if(_0x5a0a77['hasOwnProperty'](_0x4bbe63)){_0x2b5faa+=_[_0x4f30('0x37')](_0x4bbe63)+':\x20'+_0x5a0a77[_0x4bbe63]+'\x0a';}}}}if(_0x5e8a28){this[_0x4f30('0x2')][_0x4f30('0xe')]();}else{this[_0x4f30('0x26')](_0x4f30('0xf'),_0x2b5faa);this[_0x4f30('0x26')](_0x4f30('0xe'));}};module['exports']=EmailImap;
\ No newline at end of file
index 5fb9d2f..f52609d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5503=['toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5503,0x14e));var _0x3550=function(_0x47b565,_0x5d3b6f){_0x47b565=_0x47b565-0x0;var _0x3a887a=_0x5503[_0x47b565];return _0x3a887a;};'use strict';var nodemailer=require(_0x3550('0x0'));var inlineBase64=require(_0x3550('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x3550('0x2')]=function(_0x104821,_0x21e4e1){return new Promise(function(_0x31c1d2,_0x532307){var _0x3ca5d2=nodemailer[_0x3550('0x3')](_0x104821);_0x3ca5d2[_0x3550('0x4')](_0x3550('0x5'),inlineBase64());_0x3ca5d2[_0x3550('0x6')](_0x21e4e1,function(_0x10f15c,_0x58cff2){if(_0x10f15c){_0x532307(_0x10f15c[_0x3550('0x7')]());}else{_0x31c1d2(_0x58cff2);}});});};EmailSmtp['prototype'][_0x3550('0x8')]=function(_0x20b34b){return new Promise(function(_0x3faa9b,_0x581cd0){var _0x2c5244=nodemailer[_0x3550('0x3')](_0x20b34b);_0x2c5244[_0x3550('0x8')](function(_0x5eced6,_0x38b6a9){if(_0x5eced6){_0x581cd0(_0x5eced6[_0x3550('0x7')]());}else{if(_0x38b6a9){_0x3faa9b(_0x38b6a9);}else{_0x581cd0(_0x3550('0x9'));}}});});};module[_0x3550('0xa')]=EmailSmtp;
\ No newline at end of file
+var _0xc020=['createTransport','verify','Not\x20verifired','prototype','compile','sendMail','toString'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc020,0xc7));var _0x0c02=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xc020[_0x4b2863];return _0x567d67;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x0c02('0x0')]['send']=function(_0x48fcf8,_0x493006){return new Promise(function(_0x22a5d3,_0x1cb8fe){var _0x1da61d=nodemailer['createTransport'](_0x48fcf8);_0x1da61d['use'](_0x0c02('0x1'),inlineBase64());_0x1da61d[_0x0c02('0x2')](_0x493006,function(_0x5948a3,_0x2d0f5a){if(_0x5948a3){_0x1cb8fe(_0x5948a3[_0x0c02('0x3')]());}else{_0x22a5d3(_0x2d0f5a);}});});};EmailSmtp['prototype']['verify']=function(_0x1bd12c){return new Promise(function(_0x43aa9f,_0x3b0f3b){var _0x5b0524=nodemailer[_0x0c02('0x4')](_0x1bd12c);_0x5b0524[_0x0c02('0x5')](function(_0x13cc69,_0x3ea543){if(_0x13cc69){_0x3b0f3b(_0x13cc69[_0x0c02('0x3')]());}else{if(_0x3ea543){_0x43aa9f(_0x3ea543);}else{_0x3b0f3b(_0x0c02('0x6'));}}});});};module['exports']=EmailSmtp;
\ No newline at end of file
index 3b4e858..e1b2393 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fbb=['node-tnef','../../../config/logger','head','address','@xcally.com','value','name','substring','indexOf','length','slice','join','Anonymous','split','pop','isEmpty','anonymous','generate','html','test','replace','includes','<img','attachments','forEach','push','filename','_SRC','_IMG','<span\x20style=font-weight:bold>\x20[Attachment:\x20','\x20]</span>','textAsHtml','body','<a\x20target=\x22_blank\x22\x20','originTo','message','originCc','email','bcc','attach','type','attachment','format','now','root','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Title','Data','generateXOAuth2Token','user=','utf-8','base64','lodash','moment','util'];(function(_0x39bdda,_0x384906){var _0x1f6bc8=function(_0x2090b3){while(--_0x2090b3){_0x39bdda['push'](_0x39bdda['shift']());}};_0x1f6bc8(++_0x384906);}(_0x1fbb,0x179));var _0xb1fb=function(_0xafb07b,_0x30cdab){_0xafb07b=_0xafb07b-0x0;var _0x4c55a8=_0x1fbb[_0xafb07b];return _0x4c55a8;};'use strict';var _=require(_0xb1fb('0x0'));var moment=require(_0xb1fb('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xb1fb('0x2'));var tnef=require(_0xb1fb('0x3'));var logger=require(_0xb1fb('0x4'))('email');var config=require('../../../config/environment');function getAddress(_0x6eab80){var _0xd19c22=_[_0xb1fb('0x5')](_0x6eab80['value']);return _0xd19c22&&_0xd19c22[_0xb1fb('0x6')]?_0xd19c22[_0xb1fb('0x6')]:'anonymous'+random['generate'](0x6)+_0xb1fb('0x7');}function getFirstName(_0x1fbdbc){var _0xe82ab4=_[_0xb1fb('0x5')](_0x1fbdbc[_0xb1fb('0x8')]);if(_0xe82ab4&&_0xe82ab4['name']){if(_0xe82ab4[_0xb1fb('0x9')]==_0xe82ab4[_0xb1fb('0x6')]){return _0xe82ab4[_0xb1fb('0x9')][_0xb1fb('0xa')](0x0,_0xe82ab4['name'][_0xb1fb('0xb')]('@'));}var _0x5594e4=_0xe82ab4[_0xb1fb('0x9')]['split'](/\s+/);return _0x5594e4[_0xb1fb('0xc')]>0x1?_0x5594e4[_0xb1fb('0xd')](0x0,-0x1)[_0xb1fb('0xe')]('\x20'):_0xe82ab4[_0xb1fb('0x9')];}return _0xb1fb('0xf');}function getLastName(_0x4e809b){var _0x2bfc08=_[_0xb1fb('0x5')](_0x4e809b[_0xb1fb('0x8')]);if(_0x2bfc08&&_0x2bfc08[_0xb1fb('0x9')]){var _0x11ba9f=_0x2bfc08['name'][_0xb1fb('0x10')](/\s+/);return _0x11ba9f[_0xb1fb('0xc')]>0x1?_0x11ba9f[_0xb1fb('0x11')]():'';}return'';}function getMails(_0x18b9de,_0x1661c2){var _0x123bff='';for(var _0x3ce6e8=0x0;_0x3ce6e8<_0x1661c2['value']['length'];_0x3ce6e8+=0x1){if(_0x1661c2[_0xb1fb('0x8')][_0x3ce6e8][_0xb1fb('0x6')]!==_0x18b9de){if(!_[_0xb1fb('0x12')](_0x123bff)){_0x123bff+=',';}_0x123bff+=_0x1661c2[_0xb1fb('0x8')][_0x3ce6e8][_0xb1fb('0x9')]||_0x1661c2[_0xb1fb('0x8')][_0x3ce6e8][_0xb1fb('0x6')]||'';_0x123bff+='\x20<';_0x123bff+=_0x1661c2['value'][_0x3ce6e8]['address']?_0x1661c2[_0xb1fb('0x8')][_0x3ce6e8][_0xb1fb('0x6')]:_0xb1fb('0x13')+random[_0xb1fb('0x14')](0x6)+'@xcally.com';_0x123bff+='>';}}return _0x123bff;}function parseEmail(_0x529c09,_0x348f37,_0x2e7953){if(_0x348f37[_0xb1fb('0x15')]){var _0x21dd18=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0x21dd18[_0xb1fb('0x16')](_0x348f37['html'])){_0x348f37[_0xb1fb('0x15')]=_0x348f37['html'][_0xb1fb('0x17')](_0x21dd18,'');}if(_0x348f37[_0xb1fb('0x15')][_0xb1fb('0x18')](_0xb1fb('0x19'))){var _0x5e1f57=[];_0x348f37[_0xb1fb('0x1a')][_0xb1fb('0x1b')](_0x449127=>{_0x5e1f57[_0xb1fb('0x1c')](_0x449127[_0xb1fb('0x1d')]);});var _0x43f4e3=/<img.*? _SRC(.*?)[^>]+>/g;var _0x143f6d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x500914=_0x348f37['html'][_0xb1fb('0x17')](_0x143f6d,_0xb1fb('0x1e'));var _0x3cb990=_0x500914[_0xb1fb('0x17')](_0x43f4e3,'_IMG');for(let _0x5108f6=0x0;_0x5108f6<_0x5e1f57['length'];_0x5108f6++){var _0x477e5f=_0x3cb990[_0xb1fb('0x17')](_0xb1fb('0x1f'),_0xb1fb('0x20')+_0x5e1f57[_0x5108f6]+_0xb1fb('0x21'));_0x3cb990=_0x477e5f;}_0x348f37[_0xb1fb('0x15')]=_0x3cb990;}_0x2e7953['body']=_0x348f37[_0xb1fb('0x15')];}else{_0x2e7953['body']=_0x348f37[_0xb1fb('0x22')];}if(_0x2e7953[_0xb1fb('0x23')]){_0x2e7953['body']=_0x2e7953[_0xb1fb('0x23')][_0xb1fb('0x17')](/<a\s+/gi,_0xb1fb('0x24'));}if(_0x348f37['to']){_0x2e7953['message'][_0xb1fb('0x25')]=getMails(null,_0x348f37['to']);var _0x482bb2=getMails(_0x529c09['email'],_0x348f37['to']);if(!_['isEmpty'](_0x482bb2)){_0x2e7953[_0xb1fb('0x26')]['cc']+=_0x482bb2;}}if(_0x348f37['cc']){_0x2e7953[_0xb1fb('0x26')][_0xb1fb('0x27')]=getMails(null,_0x348f37['cc']);var _0x1467f3=getMails(_0x529c09['email'],_0x348f37['cc']);if(!_['isEmpty'](_0x1467f3)){if(!_[_0xb1fb('0x12')](_0x2e7953[_0xb1fb('0x26')]['cc'])){_0x2e7953['message']['cc']+=',';}_0x2e7953[_0xb1fb('0x26')]['cc']+=_0x1467f3;}}if(!_[_0xb1fb('0x18')](_0x2e7953[_0xb1fb('0x26')][_0xb1fb('0x25')],_0x529c09[_0xb1fb('0x28')])&&!_['includes'](_0x2e7953['message'][_0xb1fb('0x27')],_0x529c09[_0xb1fb('0x28')])){_0x2e7953[_0xb1fb('0x26')][_0xb1fb('0x29')]=_0x529c09[_0xb1fb('0x28')];}if(_0x348f37[_0xb1fb('0x1a')]&&_0x348f37[_0xb1fb('0x1a')][_0xb1fb('0xc')]){_0x2e7953[_0xb1fb('0x26')][_0xb1fb('0x2a')]=_0x348f37[_0xb1fb('0x1a')][_0xb1fb('0xc')];for(var _0x453e6e=0x0,_0x5e2842,_0x4a8542,_0x1933de;_0x453e6e<_0x348f37[_0xb1fb('0x1a')][_0xb1fb('0xc')];_0x453e6e+=0x1){if(_0x348f37['attachments'][_0x453e6e][_0xb1fb('0x2b')]===_0xb1fb('0x2c')){_0x1933de=_0x348f37[_0xb1fb('0x1a')][_0x453e6e]['filename']||'attachment-'+_0x453e6e;_0x5e2842=util[_0xb1fb('0x2d')]('%s-%s',Date[_0xb1fb('0x2e')](),_0x1933de);_0x4a8542=path[_0xb1fb('0xe')](config[_0xb1fb('0x2f')],'server/files/attachments/',_0x5e2842);fs[_0xb1fb('0x30')](_0x4a8542,_0x348f37[_0xb1fb('0x1a')][_0x453e6e][_0xb1fb('0x31')]);_0x2e7953['message'][_0xb1fb('0x1a')][_0xb1fb('0x1c')]({'name':_0x1933de,'basename':_0x5e2842,'type':_0x348f37['attachments'][_0x453e6e][_0xb1fb('0x32')],'filepath':_0x4a8542});}}}if(_0x348f37[_0xb1fb('0x33')]&&_0x348f37[_0xb1fb('0x33')][_0xb1fb('0xc')]>0x0){var _0x49175a=[_0xb1fb('0x34'),_0xb1fb('0x35'),_0xb1fb('0x36')];for(var _0x74e2a7=0x0;_0x74e2a7<_0x348f37['headerLines'][_0xb1fb('0xc')];_0x74e2a7++){var _0x1f3d10=_['indexOf'](_0x49175a,_0x348f37[_0xb1fb('0x33')][_0x74e2a7]['line']);if(_0x1f3d10>=0x0){_0x2e7953['isAutoreply']=!![];}}}return _0x2e7953;}exports[_0xb1fb('0x37')]=function(_0x305a35,_0x4a0971,_0x49851d){var _0x135f95={'from':getAddress(_0x4a0971[_0xb1fb('0x38')]),'firstName':getFirstName(_0x4a0971[_0xb1fb('0x38')]),'lastName':getLastName(_0x4a0971[_0xb1fb('0x38')]),'mapKey':_0xb1fb('0x28'),'message':{'from':getMails(_0x305a35['email'],_0x4a0971['from']),'to':_0x305a35['email'],'cc':'','subject':_0x4a0971[_0xb1fb('0x39')]||'','messageId':_0x4a0971[_0xb1fb('0x3a')],'inReplyTo':_0x4a0971[_0xb1fb('0x3b')],'sentAt':moment(_0x4a0971[_0xb1fb('0x3c')])['format'](_0xb1fb('0x3d')),'attach':![],'attachments':[]}};if(!_0x4a0971[_0xb1fb('0x15')]&&!_0x4a0971[_0xb1fb('0x22')]){var _0x5c1307=_[_0xb1fb('0x3e')](_0x4a0971['attachments'],{'contentType':'application/ms-tnef'});if(_0x5c1307[_0xb1fb('0xc')]){logger[_0xb1fb('0x3f')](util[_0xb1fb('0x2d')](_0xb1fb('0x40'),_0x4a0971[_0xb1fb('0x3a')]));tnef[_0xb1fb('0x41')](_[_0xb1fb('0x42')](_0x5c1307)['content'],function(_0x17a077,_0x5a4abc){if(_0x5a4abc){_0x4a0971[_0xb1fb('0x15')]=_0x5a4abc[_0xb1fb('0x43')]||_0xb1fb('0x44');if(_0x5a4abc[_0xb1fb('0x45')]){for(var _0x2ee5e3=0x0;_0x2ee5e3<_0x5a4abc[_0xb1fb('0x45')][_0xb1fb('0xc')];_0x2ee5e3++){var _0x18588d=_0x5a4abc[_0xb1fb('0x45')][_0x2ee5e3];_0x135f95[_0xb1fb('0x26')][_0xb1fb('0x1a')]['push']({'filename':_0x18588d[_0xb1fb('0x46')],'content':Buffer[_0xb1fb('0x38')](_0x18588d[_0xb1fb('0x47')])});}}}_0x49851d(parseEmail(_0x305a35,_0x4a0971,_0x135f95));});}else{_0x4a0971[_0xb1fb('0x15')]='<p>Empty\x20message</p>';_0x49851d(parseEmail(_0x305a35,_0x4a0971,_0x135f95));}}else{_0x49851d(parseEmail(_0x305a35,_0x4a0971,_0x135f95));}};exports[_0xb1fb('0x48')]=function(_0x3a5b69,_0x5890f8){var _0x29d3d9=[_0xb1fb('0x49')+(_0x5890f8||''),'auth=Bearer\x20'+_0x3a5b69,'',''];return Buffer[_0xb1fb('0x38')](_0x29d3d9[_0xb1fb('0xe')]('\ 1'),_0xb1fb('0x4a'))['toString'](_0xb1fb('0x4b'));};
\ No newline at end of file
+var _0x9c3b=['\x20]</span>','body','textAsHtml','message','email','isEmpty','originCc','originTo','bcc','type','filename','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','from','subject','messageId','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','Attachments','<p>Empty\x20message</p>','generateXOAuth2Token','user=','base64','lodash','randomstring','path','node-tnef','../../../config/logger','../../../config/environment','head','value','generate','name','address','substring','indexOf','split','length','slice','join','Anonymous','pop','anonymous','@xcally.com','html','test','replace','includes','<img','attachments','forEach','push','_SRC','_IMG'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9c3b,0x13a));var _0xb9c3=function(_0x4fa1c7,_0x5b2ce3){_0x4fa1c7=_0x4fa1c7-0x0;var _0x31c4e9=_0x9c3b[_0x4fa1c7];return _0x31c4e9;};'use strict';var _=require(_0xb9c3('0x0'));var moment=require('moment');var random=require(_0xb9c3('0x1'));var fs=require('fs');var path=require(_0xb9c3('0x2'));var util=require('util');var tnef=require(_0xb9c3('0x3'));var logger=require(_0xb9c3('0x4'))('email');var config=require(_0xb9c3('0x5'));function getAddress(_0x190cf8){var _0x32f528=_[_0xb9c3('0x6')](_0x190cf8[_0xb9c3('0x7')]);return _0x32f528&&_0x32f528['address']?_0x32f528['address']:'anonymous'+random[_0xb9c3('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x4366ce){var _0x5b94e0=_[_0xb9c3('0x6')](_0x4366ce[_0xb9c3('0x7')]);if(_0x5b94e0&&_0x5b94e0[_0xb9c3('0x9')]){if(_0x5b94e0[_0xb9c3('0x9')]==_0x5b94e0[_0xb9c3('0xa')]){return _0x5b94e0[_0xb9c3('0x9')][_0xb9c3('0xb')](0x0,_0x5b94e0[_0xb9c3('0x9')][_0xb9c3('0xc')]('@'));}var _0x79d478=_0x5b94e0['name'][_0xb9c3('0xd')](/\s+/);return _0x79d478[_0xb9c3('0xe')]>0x1?_0x79d478[_0xb9c3('0xf')](0x0,-0x1)[_0xb9c3('0x10')]('\x20'):_0x5b94e0['name'];}return _0xb9c3('0x11');}function getLastName(_0x2dfc3d){var _0x36b716=_['head'](_0x2dfc3d[_0xb9c3('0x7')]);if(_0x36b716&&_0x36b716[_0xb9c3('0x9')]){var _0x3c5f0d=_0x36b716['name']['split'](/\s+/);return _0x3c5f0d[_0xb9c3('0xe')]>0x1?_0x3c5f0d[_0xb9c3('0x12')]():'';}return'';}function getMails(_0x1129e6,_0x9f47c8){var _0x4ac65b='';for(var _0x1ea12b=0x0;_0x1ea12b<_0x9f47c8['value'][_0xb9c3('0xe')];_0x1ea12b+=0x1){if(_0x9f47c8[_0xb9c3('0x7')][_0x1ea12b]['address']!==_0x1129e6){if(!_['isEmpty'](_0x4ac65b)){_0x4ac65b+=',';}_0x4ac65b+=_0x9f47c8[_0xb9c3('0x7')][_0x1ea12b][_0xb9c3('0x9')]||_0x9f47c8[_0xb9c3('0x7')][_0x1ea12b][_0xb9c3('0xa')]||'';_0x4ac65b+='\x20<';_0x4ac65b+=_0x9f47c8[_0xb9c3('0x7')][_0x1ea12b][_0xb9c3('0xa')]?_0x9f47c8[_0xb9c3('0x7')][_0x1ea12b][_0xb9c3('0xa')]:_0xb9c3('0x13')+random[_0xb9c3('0x8')](0x6)+_0xb9c3('0x14');_0x4ac65b+='>';}}return _0x4ac65b;}function parseEmail(_0x219907,_0x56979b,_0xc5002c){if(_0x56979b[_0xb9c3('0x15')]){var _0x352b95=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0x352b95[_0xb9c3('0x16')](_0x56979b[_0xb9c3('0x15')])){_0x56979b[_0xb9c3('0x15')]=_0x56979b[_0xb9c3('0x15')][_0xb9c3('0x17')](_0x352b95,'');}if(_0x56979b[_0xb9c3('0x15')][_0xb9c3('0x18')](_0xb9c3('0x19'))){var _0x45a7b3=[];_0x56979b[_0xb9c3('0x1a')][_0xb9c3('0x1b')](_0x2480e0=>{_0x45a7b3[_0xb9c3('0x1c')](_0x2480e0['filename']);});var _0x30ecdb=/<img.*? _SRC(.*?)[^>]+>/g;var _0x2944bd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4a22fe=_0x56979b[_0xb9c3('0x15')][_0xb9c3('0x17')](_0x2944bd,_0xb9c3('0x1d'));var _0x571ccb=_0x4a22fe['replace'](_0x30ecdb,_0xb9c3('0x1e'));for(let _0x5c5431=0x0;_0x5c5431<_0x45a7b3[_0xb9c3('0xe')];_0x5c5431++){var _0x29ae1c=_0x571ccb[_0xb9c3('0x17')](_0xb9c3('0x1e'),'<span\x20style=font-weight:bold>\x20[Attachment:\x20'+_0x45a7b3[_0x5c5431]+_0xb9c3('0x1f'));_0x571ccb=_0x29ae1c;}_0x56979b[_0xb9c3('0x15')]=_0x571ccb;}_0xc5002c[_0xb9c3('0x20')]=_0x56979b[_0xb9c3('0x15')];}else{_0xc5002c[_0xb9c3('0x20')]=_0x56979b[_0xb9c3('0x21')];}if(_0xc5002c[_0xb9c3('0x20')]){_0xc5002c['body']=_0xc5002c[_0xb9c3('0x20')]['replace'](/<a\s+/gi,'<a\x20target=\x22_blank\x22\x20');}if(_0x56979b['to']){_0xc5002c[_0xb9c3('0x22')]['originTo']=getMails(null,_0x56979b['to']);var _0x34607c=getMails(_0x219907[_0xb9c3('0x23')],_0x56979b['to']);if(!_[_0xb9c3('0x24')](_0x34607c)){_0xc5002c['message']['cc']+=_0x34607c;}}if(_0x56979b['cc']){_0xc5002c[_0xb9c3('0x22')][_0xb9c3('0x25')]=getMails(null,_0x56979b['cc']);var _0x15aca6=getMails(_0x219907[_0xb9c3('0x23')],_0x56979b['cc']);if(!_[_0xb9c3('0x24')](_0x15aca6)){if(!_['isEmpty'](_0xc5002c[_0xb9c3('0x22')]['cc'])){_0xc5002c[_0xb9c3('0x22')]['cc']+=',';}_0xc5002c[_0xb9c3('0x22')]['cc']+=_0x15aca6;}}if(!_[_0xb9c3('0x18')](_0xc5002c['message'][_0xb9c3('0x26')],_0x219907['email'])&&!_['includes'](_0xc5002c[_0xb9c3('0x22')]['originCc'],_0x219907[_0xb9c3('0x23')])){_0xc5002c[_0xb9c3('0x22')][_0xb9c3('0x27')]=_0x219907[_0xb9c3('0x23')];}if(_0x56979b['attachments']&&_0x56979b[_0xb9c3('0x1a')][_0xb9c3('0xe')]){_0xc5002c[_0xb9c3('0x22')]['attach']=_0x56979b[_0xb9c3('0x1a')][_0xb9c3('0xe')];for(var _0xc37151=0x0,_0x12148e,_0x28550b,_0x5ab49b;_0xc37151<_0x56979b[_0xb9c3('0x1a')]['length'];_0xc37151+=0x1){if(_0x56979b[_0xb9c3('0x1a')][_0xc37151][_0xb9c3('0x28')]==='attachment'){_0x5ab49b=_0x56979b[_0xb9c3('0x1a')][_0xc37151][_0xb9c3('0x29')]||_0xb9c3('0x2a')+_0xc37151;_0x12148e=util[_0xb9c3('0x2b')](_0xb9c3('0x2c'),Date['now'](),_0x5ab49b);_0x28550b=path[_0xb9c3('0x10')](config[_0xb9c3('0x2d')],_0xb9c3('0x2e'),_0x12148e);fs[_0xb9c3('0x2f')](_0x28550b,_0x56979b[_0xb9c3('0x1a')][_0xc37151][_0xb9c3('0x30')]);_0xc5002c[_0xb9c3('0x22')]['attachments'][_0xb9c3('0x1c')]({'name':_0x5ab49b,'basename':_0x12148e,'type':_0x56979b['attachments'][_0xc37151][_0xb9c3('0x31')],'filepath':_0x28550b});}}}if(_0x56979b[_0xb9c3('0x32')]&&_0x56979b['headerLines'][_0xb9c3('0xe')]>0x0){var _0xa87553=[_0xb9c3('0x33'),_0xb9c3('0x34'),_0xb9c3('0x35')];for(var _0x4ddf9c=0x0;_0x4ddf9c<_0x56979b[_0xb9c3('0x32')][_0xb9c3('0xe')];_0x4ddf9c++){var _0x54fe2f=_[_0xb9c3('0xc')](_0xa87553,_0x56979b[_0xb9c3('0x32')][_0x4ddf9c]['line']);if(_0x54fe2f>=0x0){_0xc5002c[_0xb9c3('0x36')]=!![];}}}return _0xc5002c;}exports['parser']=function(_0x4d582f,_0xf051b8,_0x22d07c){var _0xc2c1da={'from':getAddress(_0xf051b8['from']),'firstName':getFirstName(_0xf051b8['from']),'lastName':getLastName(_0xf051b8[_0xb9c3('0x37')]),'mapKey':_0xb9c3('0x23'),'message':{'from':getMails(_0x4d582f[_0xb9c3('0x23')],_0xf051b8[_0xb9c3('0x37')]),'to':_0x4d582f['email'],'cc':'','subject':_0xf051b8[_0xb9c3('0x38')]||'','messageId':_0xf051b8[_0xb9c3('0x39')],'inReplyTo':_0xf051b8['inReplyTo'],'sentAt':moment(_0xf051b8['date'])[_0xb9c3('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0xf051b8[_0xb9c3('0x15')]&&!_0xf051b8[_0xb9c3('0x21')]){var _0x48323a=_[_0xb9c3('0x3a')](_0xf051b8[_0xb9c3('0x1a')],{'contentType':_0xb9c3('0x3b')});if(_0x48323a[_0xb9c3('0xe')]){logger[_0xb9c3('0x3c')](util[_0xb9c3('0x2b')](_0xb9c3('0x3d'),_0xf051b8['messageId']));tnef[_0xb9c3('0x3e')](_[_0xb9c3('0x3f')](_0x48323a)[_0xb9c3('0x30')],function(_0xa1d045,_0x3fadec){if(_0x3fadec){_0xf051b8[_0xb9c3('0x15')]=_0x3fadec['BodyHTML']||'<p>Empty\x20message</p>';if(_0x3fadec[_0xb9c3('0x40')]){for(var _0x239286=0x0;_0x239286<_0x3fadec['Attachments']['length'];_0x239286++){var _0x335462=_0x3fadec[_0xb9c3('0x40')][_0x239286];_0xc2c1da['message'][_0xb9c3('0x1a')][_0xb9c3('0x1c')]({'filename':_0x335462['Title'],'content':Buffer[_0xb9c3('0x37')](_0x335462['Data'])});}}}_0x22d07c(parseEmail(_0x4d582f,_0xf051b8,_0xc2c1da));});}else{_0xf051b8[_0xb9c3('0x15')]=_0xb9c3('0x41');_0x22d07c(parseEmail(_0x4d582f,_0xf051b8,_0xc2c1da));}}else{_0x22d07c(parseEmail(_0x4d582f,_0xf051b8,_0xc2c1da));}};exports[_0xb9c3('0x42')]=function(_0x503c6a,_0x1cb5c5){var _0x19adbe=[_0xb9c3('0x43')+(_0x1cb5c5||''),'auth=Bearer\x20'+_0x503c6a,'',''];return Buffer[_0xb9c3('0x37')](_0x19adbe[_0xb9c3('0x10')]('\ 1'),'utf-8')['toString'](_0xb9c3('0x44'));};
\ No newline at end of file
index 1bd865f..677b62d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8eff=['lodash','name','key','SERV','active','Imap','Smtp','exports'];(function(_0x124722,_0x2a4971){var _0xec2ec4=function(_0x52cb70){while(--_0x52cb70){_0x124722['push'](_0x124722['shift']());}};_0xec2ec4(++_0x2a4971);}(_0x8eff,0x1a8));var _0xf8ef=function(_0x1598b0,_0x3e5461){_0x1598b0=_0x1598b0-0x0;var _0x4bdc11=_0x8eff[_0x1598b0];return _0x4bdc11;};'use strict';var _=require(_0xf8ef('0x0'));function MailAccount(_0x274f84){this['id']=_0x274f84['id']||0x0;this[_0xf8ef('0x1')]=_0x274f84[_0xf8ef('0x1')]||'Service';this[_0xf8ef('0x2')]=_0x274f84[_0xf8ef('0x2')]||_0xf8ef('0x3');this[_0xf8ef('0x4')]=_0x274f84[_0xf8ef('0x4')]||![];this[_0xf8ef('0x5')]=_0x274f84[_0xf8ef('0x5')]||[];this[_0xf8ef('0x6')]=_0x274f84[_0xf8ef('0x6')]||[];}module[_0xf8ef('0x7')]=MailAccount;
\ No newline at end of file
+var _0x0516=['key','SERV','active','Imap','exports','lodash','name'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x0516,0x171));var _0x6051=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x0516[_0x34325b];return _0x3da348;};'use strict';var _=require(_0x6051('0x0'));function MailAccount(_0x9a3ef1){this['id']=_0x9a3ef1['id']||0x0;this[_0x6051('0x1')]=_0x9a3ef1[_0x6051('0x1')]||'Service';this[_0x6051('0x2')]=_0x9a3ef1[_0x6051('0x2')]||_0x6051('0x3');this[_0x6051('0x4')]=_0x9a3ef1[_0x6051('0x4')]||![];this[_0x6051('0x5')]=_0x9a3ef1['Imap']||[];this['Smtp']=_0x9a3ef1['Smtp']||[];}module[_0x6051('0x6')]=MailAccount;
\ No newline at end of file
index c24ee72..82772a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69ec=['initMailAccounts','mailAccounts','length','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x4a96b8,_0x2c9f68){var _0x24439f=function(_0x88f9ad){while(--_0x88f9ad){_0x4a96b8['push'](_0x4a96b8['shift']());}};_0x24439f(++_0x2c9f68);}(_0x69ec,0xb9));var _0xc69e=function(_0x5ea34f,_0xb3d1db){_0x5ea34f=_0x5ea34f-0x0;var _0x4b9e25=_0x69ec[_0x5ea34f];return _0x4b9e25;};'use strict';var _=require('lodash');var MailAccount=require(_0xc69e('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x57f54e,_0x4662cd,_0x28a9c4){var _0x3a8fa6=_[_0xc69e('0x1')](_0x57f54e,function(_0x604845,_0xc974cf){return _0x604845[_0x28a9c4];});for(var _0xd0d39c in _0x4662cd){if(_0x4662cd[_0xc69e('0x2')](_0xd0d39c)){if(!_0x3a8fa6[_0xd0d39c]){delete _0x4662cd[_0xd0d39c];}}}}Realtime['prototype'][_0xc69e('0x3')]=function(_0xd2ab05,_0x58b0ff){for(var _0xe536e7 in _0x58b0ff){if(_0xd2ab05[_0xc69e('0x2')](_0xe536e7)){_0xd2ab05[_0xe536e7]=_0x58b0ff[_0xe536e7];}}};Realtime['prototype'][_0xc69e('0x4')]=function(){var _0x39d148=this;return function(_0x340f51){if(_0x340f51){freeIsNotKey(_0x340f51,_0x39d148[_0xc69e('0x5')],'id');for(var _0x5405e8=0x0,_0x3e6142={},_0x5cd695={};_0x5405e8<_0x340f51[_0xc69e('0x6')];_0x5405e8+=0x1){_0x3e6142=_0x340f51[_0x5405e8];if(_['isUndefined'](_0x39d148[_0xc69e('0x5')][_0x3e6142['id']])){_0x39d148['mailAccounts'][_0x3e6142['id']]=new MailAccount(_0x3e6142);}else{_['merge'](_0x39d148[_0xc69e('0x5')][_0x3e6142['id']],_0x3e6142);}}}return _0x39d148[_0xc69e('0x5')];};};module['exports']=Realtime;
\ No newline at end of file
+var _0x5005=['initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x5910ea,_0x537674){var _0x3ef685=function(_0x55a66a){while(--_0x55a66a){_0x5910ea['push'](_0x5910ea['shift']());}};_0x3ef685(++_0x537674);}(_0x5005,0x90));var _0x5500=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x5005[_0xfd495c];return _0x561dd8;};'use strict';var _=require(_0x5500('0x0'));var MailAccount=require(_0x5500('0x1'));var Realtime=function(){this[_0x5500('0x2')]={};};function freeIsNotKey(_0x37d579,_0x42f1d0,_0x4209f3){var _0x595043=_['mapKeys'](_0x37d579,function(_0x35f568,_0x21519b){return _0x35f568[_0x4209f3];});for(var _0x5a1859 in _0x42f1d0){if(_0x42f1d0[_0x5500('0x3')](_0x5a1859)){if(!_0x595043[_0x5a1859]){delete _0x42f1d0[_0x5a1859];}}}}Realtime[_0x5500('0x4')][_0x5500('0x5')]=function(_0x26ff42,_0x4d6808){for(var _0x1e3708 in _0x4d6808){if(_0x26ff42[_0x5500('0x3')](_0x1e3708)){_0x26ff42[_0x1e3708]=_0x4d6808[_0x1e3708];}}};Realtime['prototype'][_0x5500('0x6')]=function(){var _0x12dd0c=this;return function(_0x7e27b9){if(_0x7e27b9){freeIsNotKey(_0x7e27b9,_0x12dd0c['mailAccounts'],'id');for(var _0x71056a=0x0,_0x338962={},_0x53faa7={};_0x71056a<_0x7e27b9[_0x5500('0x7')];_0x71056a+=0x1){_0x338962=_0x7e27b9[_0x71056a];if(_[_0x5500('0x8')](_0x12dd0c['mailAccounts'][_0x338962['id']])){_0x12dd0c['mailAccounts'][_0x338962['id']]=new MailAccount(_0x338962);}else{_['merge'](_0x12dd0c[_0x5500('0x2')][_0x338962['id']],_0x338962);}}}return _0x12dd0c[_0x5500('0x2')];};};module[_0x5500('0x9')]=Realtime;
\ No newline at end of file
index 82a4800..a3c6e99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8861=['email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','type','getMailAccount','notify','NotifyMailAccount','Request','GetMailAccount','name','provider','service'];(function(_0x55086c,_0x373acb){var _0x415bda=function(_0x4b3d38){while(--_0x4b3d38){_0x55086c['push'](_0x55086c['shift']());}};_0x415bda(++_0x373acb);}(_0x8861,0x6d));var _0x1886=function(_0x258d2e,_0x28f8d8){_0x258d2e=_0x258d2e-0x0;var _0x2f70e0=_0x8861[_0x258d2e];return _0x2f70e0;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x1886('0x0')](_0x1886('0x1'),{'options':{'attributes':['id',_0x1886('0x2'),_0x1886('0x3'),_0x1886('0x4'),_0x1886('0x5'),_0x1886('0x6'),_0x1886('0x7'),_0x1886('0x8'),_0x1886('0x9')],'raw':![],'include':[{'model':_0x1886('0xa'),'as':_0x1886('0xb'),'include':[{'model':_0x1886('0xc'),'attributes':['id',_0x1886('0x2'),_0x1886('0x4'),'type',_0x1886('0xd')],'as':'CloudProvider'}]},{'model':_0x1886('0xe'),'as':'Smtp','include':[{'model':_0x1886('0xc'),'attributes':['id','name',_0x1886('0x4'),_0x1886('0xf'),_0x1886('0xd')],'as':_0x1886('0xc')}]}]},'log':_0x1886('0x10')});};};exports[_0x1886('0x11')]=function(_0x5a456a,_0x2a56c2){return client[_0x1886('0x0')](_0x1886('0x12'),{'account':{'id':_0x5a456a},'body':_0x2a56c2,'log':_0x1886('0x12')});};
\ No newline at end of file
+var _0x36e0=['service','MailServerOut','Smtp','data5','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','email','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x20f07f,_0x369c76){var _0x260e71=function(_0x502e15){while(--_0x502e15){_0x20f07f['push'](_0x20f07f['shift']());}};_0x260e71(++_0x369c76);}(_0x36e0,0x15c));var _0x036e=function(_0x1d4722,_0x2539a3){_0x1d4722=_0x1d4722-0x0;var _0x120705=_0x36e0[_0x1d4722];return _0x120705;};'use strict';var client=require(_0x036e('0x0'));exports[_0x036e('0x1')]=function(){return function(){return client['Request'](_0x036e('0x2'),{'options':{'attributes':['id',_0x036e('0x3'),_0x036e('0x4'),'service',_0x036e('0x5'),_0x036e('0x6'),'key',_0x036e('0x7'),_0x036e('0x8')],'raw':![],'include':[{'model':_0x036e('0x9'),'as':_0x036e('0xa'),'include':[{'model':_0x036e('0xb'),'attributes':['id',_0x036e('0x3'),_0x036e('0xc'),'type','data5'],'as':_0x036e('0xb')}]},{'model':_0x036e('0xd'),'as':_0x036e('0xe'),'include':[{'model':_0x036e('0xb'),'attributes':['id','name','service','type',_0x036e('0xf')],'as':_0x036e('0xb')}]}]},'log':_0x036e('0x10')});};};exports[_0x036e('0x11')]=function(_0x553688,_0x234239){return client[_0x036e('0x12')]('NotifyMailAccount',{'account':{'id':_0x553688},'body':_0x234239,'log':_0x036e('0x13')});};
\ No newline at end of file
index 0cb1a3d..25de891 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ff0=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x45e875,_0x4f2ee6){var _0x127d46=function(_0x4666e7){while(--_0x4666e7){_0x45e875['push'](_0x45e875['shift']());}};_0x127d46(++_0x4f2ee6);}(_0x0ff0,0x1bb));var _0x00ff=function(_0x7bd8a2,_0x16d903){_0x7bd8a2=_0x7bd8a2-0x0;var _0x280d6c=_0x0ff0[_0x7bd8a2];return _0x280d6c;};'use strict';var client=require(_0x00ff('0x0'));exports[_0x00ff('0x1')]=function(){return client[_0x00ff('0x2')](_0x00ff('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x00ff('0x4')]},'log':_0x00ff('0x5')});};
\ No newline at end of file
+var _0x4505=['ShowSetting','../client','Request'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x4505,0x18a));var _0x5450=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4505[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0x5450('0x0'));exports['getSettings']=function(){return client[_0x5450('0x1')](_0x5450('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});};
\ No newline at end of file
index f3999f5..d34f499 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});};
\ No newline at end of file
+var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});};
\ No newline at end of file
index 2756a30..4c0dba7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x427b=['../../config/express','../../routes','once','listening','log','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x427b,0x131));var _0xb427=function(_0x3bd127,_0x5052cd){_0x3bd127=_0x3bd127-0x0;var _0x478b12=_0x427b[_0x3bd127];return _0x478b12;};'use strict';var _=require('lodash');var http=require(_0xb427('0x0'));var express=require(_0xb427('0x1'));var sticky=require(_0xb427('0x2'));var Redis=require(_0xb427('0x3'));var config=require(_0xb427('0x4'));var app=express();var server=http[_0xb427('0x5')](app);server[_0xb427('0x6')]=0xdbba0;if(sticky[_0xb427('0x7')](server,config[_0xb427('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xb427('0x9'),_0xb427('0xa')]});config['redis']=_['defaults'](config[_0xb427('0xb')],{'host':_0xb427('0xc'),'port':0x18eb});socketio[_0xb427('0xd')](require(_0xb427('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb427('0xb')])}));require(_0xb427('0xf'))[_0xb427('0x10')]();require('../../config/socketio')[_0xb427('0x10')](socketio);require(_0xb427('0x11'))[_0xb427('0x10')](app);require(_0xb427('0x12'))[_0xb427('0x10')](app);}else{server[_0xb427('0x13')](_0xb427('0x14'),function(){console[_0xb427('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xb427('0x8')]);});}exports=module[_0xb427('0x16')]=app;
\ No newline at end of file
+var _0x4bf2=['adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','defaults','redis','localhost'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4bf2,0x178));var _0x24bf=function(_0x2616bc,_0x41c5e3){_0x2616bc=_0x2616bc-0x0;var _0x58e842=_0x4bf2[_0x2616bc];return _0x58e842;};'use strict';var _=require(_0x24bf('0x0'));var http=require(_0x24bf('0x1'));var express=require(_0x24bf('0x2'));var sticky=require(_0x24bf('0x3'));var Redis=require(_0x24bf('0x4'));var config=require(_0x24bf('0x5'));var app=express();var server=http[_0x24bf('0x6')](app);server[_0x24bf('0x7')]=0xdbba0;if(sticky[_0x24bf('0x8')](server,config[_0x24bf('0x9')])){var socketio=require(_0x24bf('0xa'))(server,{'transports':['websocket','polling']});config['redis']=_[_0x24bf('0xb')](config[_0x24bf('0xc')],{'host':_0x24bf('0xd'),'port':0x18eb});socketio[_0x24bf('0xe')](require(_0x24bf('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x24bf('0xc')])}));require(_0x24bf('0x10'))[_0x24bf('0x11')]();require(_0x24bf('0x12'))['default'](socketio);require(_0x24bf('0x13'))[_0x24bf('0x11')](app);require(_0x24bf('0x14'))['default'](app);}else{server[_0x24bf('0x15')](_0x24bf('0x16'),function(){console[_0x24bf('0x17')](_0x24bf('0x18'),config['port']);});}exports=module[_0x24bf('0x19')]=app;
\ No newline at end of file
index bcbbfaf..fef8098 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce1d=['http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client'];(function(_0x13773e,_0x1f3faf){var _0x103ec4=function(_0x2384ef){while(--_0x2384ef){_0x13773e['push'](_0x13773e['shift']());}};_0x103ec4(++_0x1f3faf);}(_0xce1d,0x1be));var _0xdce1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce1d[_0x14add3];return _0x4a174f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdce1('0x0'));var logger=require(_0xdce1('0x1'))(_0xdce1('0x2'));var client=jayson[_0xdce1('0x3')][_0xdce1('0x4')]({'port':0x2329});client[_0xdce1('0x5')]=function(_0x23a405,_0x4669ab){return new BPromise(function(_0x24db87,_0x5607ea){return client[_0xdce1('0x6')](_0x23a405,_0x4669ab)[_0xdce1('0x7')](function(_0x3f737d){logger[_0xdce1('0x8')](_0xdce1('0x9'),_0xdce1('0x2'),_0x23a405,_0x4669ab,_0x3f737d);if(_0x3f737d[_0xdce1('0xa')]){logger[_0xdce1('0xa')](_0xdce1('0x9'),_0xdce1('0x2'),_0x23a405,_0x3f737d['error'][_0xdce1('0xb')],_0x4669ab);return _0x5607ea(_0x3f737d[_0xdce1('0xa')]['message']);}else{return _0x24db87(_0x3f737d[_0xdce1('0xc')]);}})[_0xdce1('0xd')](function(_0x45920b){logger[_0xdce1('0xa')](_0xdce1('0x9'),'routing',_0x23a405,_0x45920b,_0x4669ab);return _0x5607ea(_0x45920b);});});};module[_0xdce1('0xe')]=client;
\ No newline at end of file
+var _0xb6d2=['client','http','Request','request','then','rpc','error','message','result','catch','bluebird','../../config/logger','routing'];(function(_0x1d31d4,_0x38e515){var _0x58aa03=function(_0x3f8895){while(--_0x3f8895){_0x1d31d4['push'](_0x1d31d4['shift']());}};_0x58aa03(++_0x38e515);}(_0xb6d2,0xb3));var _0x2b6d=function(_0x531baa,_0x2a66ef){_0x531baa=_0x531baa-0x0;var _0x5b2248=_0xb6d2[_0x531baa];return _0x5b2248;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2b6d('0x0'));var logger=require(_0x2b6d('0x1'))(_0x2b6d('0x2'));var client=jayson[_0x2b6d('0x3')][_0x2b6d('0x4')]({'port':0x2329});client[_0x2b6d('0x5')]=function(_0x45e655,_0x3659fc){return new BPromise(function(_0x53b5f8,_0x23be2a){return client[_0x2b6d('0x6')](_0x45e655,_0x3659fc)[_0x2b6d('0x7')](function(_0x39e507){logger['debug'](_0x2b6d('0x8'),_0x2b6d('0x2'),_0x45e655,_0x3659fc,_0x39e507);if(_0x39e507[_0x2b6d('0x9')]){logger[_0x2b6d('0x9')](_0x2b6d('0x8'),_0x2b6d('0x2'),_0x45e655,_0x39e507[_0x2b6d('0x9')][_0x2b6d('0xa')],_0x3659fc);return _0x23be2a(_0x39e507[_0x2b6d('0x9')][_0x2b6d('0xa')]);}else{return _0x53b5f8(_0x39e507[_0x2b6d('0xb')]);}})[_0x2b6d('0xc')](function(_0xc8ea9b){logger[_0x2b6d('0x9')](_0x2b6d('0x8'),_0x2b6d('0x2'),_0x45e655,_0xc8ea9b,_0x3659fc);return _0x23be2a(_0xc8ea9b);});});};module['exports']=client;
\ No newline at end of file
index 206a455..5cadead 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e20=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x4e20,0x113));var _0x04e2=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x4e20[_0x2d89ce];return _0x3fad10;};'use strict';var BPromise=require('bluebird');var server=require(_0x04e2('0x0'));var Realtime=require(_0x04e2('0x1'));var user=require(_0x04e2('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x04e2('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x04e2('0x4'));var faxQueue=require(_0x04e2('0x5'));var whatsappQueue=require(_0x04e2('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x04e2('0x7')]()[_0x04e2('0x8')](user[_0x04e2('0x9')]())['then'](realtime[_0x04e2('0xa')]())[_0x04e2('0x8')](interval[_0x04e2('0xb')]())[_0x04e2('0x8')](realtime[_0x04e2('0xc')]())['then'](openchannelQueue[_0x04e2('0xd')]())[_0x04e2('0x8')](realtime[_0x04e2('0xe')]())['then'](chatQueue[_0x04e2('0xf')]())['then'](realtime['initChatQueues']())[_0x04e2('0x8')](smsQueue['getSmsQueues']())[_0x04e2('0x8')](realtime['initSmsQueues']())[_0x04e2('0x8')](mailQueue[_0x04e2('0x10')]())[_0x04e2('0x8')](realtime[_0x04e2('0x11')]())[_0x04e2('0x8')](faxQueue[_0x04e2('0x12')]())[_0x04e2('0x8')](realtime[_0x04e2('0x13')]())['then'](whatsappQueue[_0x04e2('0x14')]())['then'](realtime[_0x04e2('0x15')]())[_0x04e2('0x8')](function(){return realtime;});}function main(){return server[_0x04e2('0x16')](realtime)[_0x04e2('0x8')](function(_0x55ccde){return initRealtime();})[_0x04e2('0x8')](function(_0x2b83ad){return setInterval(initRealtime,0x1388);})[_0x04e2('0x17')](function(_0x454d6b){console['log'](_0x454d6b);});}main();
\ No newline at end of file
+var _0x5c18=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird'];(function(_0x1e7f00,_0xd391aa){var _0x22ca61=function(_0x5ea3ad){while(--_0x5ea3ad){_0x1e7f00['push'](_0x1e7f00['shift']());}};_0x22ca61(++_0xd391aa);}(_0x5c18,0xa7));var _0x85c1=function(_0x2f4a61,_0x1d5a99){_0x2f4a61=_0x2f4a61-0x0;var _0x17c87e=_0x5c18[_0x2f4a61];return _0x17c87e;};'use strict';var BPromise=require(_0x85c1('0x0'));var server=require(_0x85c1('0x1'));var Realtime=require(_0x85c1('0x2'));var user=require(_0x85c1('0x3'));var interval=require(_0x85c1('0x4'));var openchannelQueue=require(_0x85c1('0x5'));var chatQueue=require(_0x85c1('0x6'));var smsQueue=require(_0x85c1('0x7'));var mailQueue=require(_0x85c1('0x8'));var faxQueue=require(_0x85c1('0x9'));var whatsappQueue=require(_0x85c1('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x85c1('0xb')]()[_0x85c1('0xc')](user[_0x85c1('0xd')]())[_0x85c1('0xc')](realtime['initAgents']())[_0x85c1('0xc')](interval[_0x85c1('0xe')]())[_0x85c1('0xc')](realtime[_0x85c1('0xf')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0x85c1('0xc')](realtime[_0x85c1('0x10')]())[_0x85c1('0xc')](chatQueue[_0x85c1('0x11')]())[_0x85c1('0xc')](realtime[_0x85c1('0x12')]())[_0x85c1('0xc')](smsQueue['getSmsQueues']())[_0x85c1('0xc')](realtime[_0x85c1('0x13')]())[_0x85c1('0xc')](mailQueue[_0x85c1('0x14')]())[_0x85c1('0xc')](realtime[_0x85c1('0x15')]())['then'](faxQueue[_0x85c1('0x16')]())[_0x85c1('0xc')](realtime[_0x85c1('0x17')]())['then'](whatsappQueue[_0x85c1('0x18')]())[_0x85c1('0xc')](realtime[_0x85c1('0x19')]())[_0x85c1('0xc')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x5c5066){return initRealtime();})[_0x85c1('0xc')](function(_0x1669fe){return setInterval(initRealtime,0x1388);})[_0x85c1('0x1a')](function(_0x1fbd13){console[_0x85c1('0x1b')](_0x1fbd13);});}main();
\ No newline at end of file
index fd1b874..12843d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x4405d7,_0x15c4b3){var _0x2072a0=function(_0x3fbf68){while(--_0x3fbf68){_0x4405d7['push'](_0x4405d7['shift']());}};_0x2072a0(++_0x15c4b3);}(_0x2ef3,0xba));var _0x32ef=function(_0x20fa3a,_0x4f4924){_0x20fa3a=_0x20fa3a-0x0;var _0x24eba3=_0x2ef3[_0x20fa3a];return _0x24eba3;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine;
\ No newline at end of file
+var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x153ed8,_0x5103b9){var _0xa62e50=function(_0xf1449c){while(--_0xf1449c){_0x153ed8['push'](_0x153ed8['shift']());}};_0xa62e50(++_0x5103b9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine;
\ No newline at end of file
index 7c7b683..d79c6f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x15a2=['jayson/promise','client','http','request','then','error','catch','sendMailMessage','SendMail','bluebird'];(function(_0x3dd69a,_0x5d70df){var _0x23b4a7=function(_0x3518d8){while(--_0x3518d8){_0x3dd69a['push'](_0x3dd69a['shift']());}};_0x23b4a7(++_0x5d70df);}(_0x15a2,0x12b));var _0x215a=function(_0x41caac,_0x50c421){_0x41caac=_0x41caac-0x0;var _0x28d2ba=_0x15a2[_0x41caac];return _0x28d2ba;};'use strict';var BPromise=require(_0x215a('0x0'));var jayson=require(_0x215a('0x1'));var client=jayson[_0x215a('0x2')][_0x215a('0x3')]({'port':0x232b});function request(_0x5874e4,_0x2e5463){return new BPromise(function(_0x35c486,_0x28895a){return client[_0x215a('0x4')](_0x5874e4,_0x2e5463)[_0x215a('0x5')](function(_0x243a00){if(_0x243a00[_0x215a('0x6')]){return _0x28895a(_0x243a00[_0x215a('0x6')]['message']);}else{return _0x35c486(_0x243a00['result']);}})[_0x215a('0x7')](function(_0x18e93f){return _0x28895a(_0x18e93f);});});}exports[_0x215a('0x8')]=function(_0x41c2bf,_0x1fc103){return request(_0x215a('0x9'),{'account':_0x41c2bf,'message':_0x1fc103});};
\ No newline at end of file
+var _0xb8ee=['client','http','request','then','error','message','catch','sendMailMessage','bluebird','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8ee,0x102));var _0xeb8e=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xb8ee[_0x3f8a03];return _0x147fb2;};'use strict';var BPromise=require(_0xeb8e('0x0'));var jayson=require(_0xeb8e('0x1'));var client=jayson[_0xeb8e('0x2')][_0xeb8e('0x3')]({'port':0x232b});function request(_0x306d72,_0x4d046b){return new BPromise(function(_0x3051d4,_0x9bd580){return client[_0xeb8e('0x4')](_0x306d72,_0x4d046b)[_0xeb8e('0x5')](function(_0x223c71){if(_0x223c71['error']){return _0x9bd580(_0x223c71[_0xeb8e('0x6')][_0xeb8e('0x7')]);}else{return _0x3051d4(_0x223c71['result']);}})[_0xeb8e('0x8')](function(_0x18979c){return _0x9bd580(_0x18979c);});});}exports[_0xeb8e('0x9')]=function(_0x3cb33f,_0x5d2c90){return request('SendMail',{'account':_0x3cb33f,'message':_0x5d2c90});};
\ No newline at end of file
index 64c159e..73b3035 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5a1=['mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busy','chatWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','whatsapp','length','StatusTime','toNumber','faxStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','mailWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity'];(function(_0x148d48,_0x3de661){var _0x495688=function(_0xfae78e){while(--_0xfae78e){_0x148d48['push'](_0x148d48['shift']());}};_0x495688(++_0x3de661);}(_0xb5a1,0x1ba));var _0x1b5a=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xb5a1[_0x2ad008];return _0x4538cf;};'use strict';var _=require(_0x1b5a('0x0'));var moment=require(_0x1b5a('0x1'));var md5=require(_0x1b5a('0x2'));var Redis=require(_0x1b5a('0x3'));var config=require('../../../config/environment');config[_0x1b5a('0x4')]=_[_0x1b5a('0x5')](config[_0x1b5a('0x4')],{'host':_0x1b5a('0x6'),'port':0x18eb});var io=require(_0x1b5a('0x7'))(new Redis(config[_0x1b5a('0x4')]));function Agent(_0x4d0819){this['id']=_0x4d0819['id']||0x0;this[_0x1b5a('0x8')]=_0x4d0819['name']||'';this['online']=_0x4d0819[_0x1b5a('0x9')]||!![];this['voicePause']=_0x4d0819[_0x1b5a('0xa')]||![];this['chatPause']=_0x4d0819[_0x1b5a('0xb')]||![];this[_0x1b5a('0xc')]=_0x4d0819['mailPause']||![];this[_0x1b5a('0xd')]=_0x4d0819[_0x1b5a('0xd')]||![];this[_0x1b5a('0xe')]=_0x4d0819[_0x1b5a('0xe')]||![];this[_0x1b5a('0xf')]=_0x4d0819[_0x1b5a('0xf')]||![];this[_0x1b5a('0x10')]='unknown';this[_0x1b5a('0x11')]=0x0;this[_0x1b5a('0x12')]=_0x4d0819[_0x1b5a('0x12')]||0x0;this[_0x1b5a('0x13')]=0x0;this[_0x1b5a('0x14')]='unknown';this[_0x1b5a('0x15')]=0x0;this['mailCapacity']=_0x4d0819[_0x1b5a('0x16')]||0x0;this[_0x1b5a('0x17')]=0x0;this['faxStatus']=_0x1b5a('0x18');this[_0x1b5a('0x19')]=0x0;this[_0x1b5a('0x1a')]=_0x4d0819[_0x1b5a('0x1a')]||0x0;this[_0x1b5a('0x1b')]=0x0;this[_0x1b5a('0x1c')]=_0x1b5a('0x18');this[_0x1b5a('0x1d')]=0x0;this[_0x1b5a('0x1e')]=_0x4d0819[_0x1b5a('0x1e')]||0x0;this[_0x1b5a('0x1f')]=0x0;this[_0x1b5a('0x20')]=_0x1b5a('0x18');this[_0x1b5a('0x21')]=0x0;this[_0x1b5a('0x22')]=_0x4d0819[_0x1b5a('0x22')]||0x0;this[_0x1b5a('0x23')]=0x0;this[_0x1b5a('0x24')]='unknown';this[_0x1b5a('0x25')]=0x0;this['openchannelCapacity']=_0x4d0819['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x1b5a('0x26')]=![];this['busyQueue']=undefined;this['md5']='';this[_0x1b5a('0x27')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this[_0x1b5a('0x28')]={};this[_0x1b5a('0x29')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x1b5a('0x2a')][_0x1b5a('0x2b')]=function(_0x219635){if(this[_0x219635+'CurrentCapacity']>0x0){if(this[_0x219635+_0x1b5a('0x2c')]>0x0&&this[_0x219635+_0x1b5a('0x2d')]>=this[_0x219635+_0x1b5a('0x2c')]){return _0x1b5a('0x2e');}else{return _0x1b5a('0x2f');}}else{return _0x1b5a('0x30');}};Agent[_0x1b5a('0x2a')][_0x1b5a('0x31')]=function(){var _0x550524=['mail',_0x1b5a('0x32'),_0x1b5a('0x33'),'fax','sms',_0x1b5a('0x34')];for(var _0x3adda7=0x0;_0x3adda7<_0x550524[_0x1b5a('0x35')];_0x3adda7+=0x1){var _0x471c9e=this[_0x1b5a('0x2b')](_0x550524[_0x3adda7]);if(this[_0x550524[_0x3adda7]+'Status']!==_0x471c9e){this[_0x550524[_0x3adda7]+_0x1b5a('0x36')]=_[_0x1b5a('0x37')](moment()['format']('x'));}this[_0x550524[_0x3adda7]+'Status']=_0x471c9e;}var _0x3d4590={'id':this['id'],'name':this[_0x1b5a('0x8')],'online':this['online'],'voicePause':this[_0x1b5a('0xa')],'chatPause':this[_0x1b5a('0xb')],'mailPause':this[_0x1b5a('0xc')],'smsPause':this[_0x1b5a('0xe')],'faxPause':this[_0x1b5a('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x1b5a('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x1b5a('0x12')],'chatCurrentCapacity':this[_0x1b5a('0x13')],'mailStatus':this[_0x1b5a('0x14')],'mailStatusTime':this[_0x1b5a('0x15')],'mailCapacity':this[_0x1b5a('0x16')],'mailCurrentCapacity':this[_0x1b5a('0x17')],'faxStatus':this[_0x1b5a('0x38')],'faxStatusTime':this[_0x1b5a('0x19')],'faxCapacity':this[_0x1b5a('0x1a')],'faxCurrentCapacity':this[_0x1b5a('0x1b')],'smsStatus':this[_0x1b5a('0x1c')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x1b5a('0x1e')],'smsCurrentCapacity':this[_0x1b5a('0x1f')],'whatsappStatus':this[_0x1b5a('0x20')],'whatsappStatusTime':this[_0x1b5a('0x21')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x1b5a('0x23')],'openchannelStatus':this[_0x1b5a('0x24')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x1b5a('0x39')],'openchannelCurrentCapacity':this[_0x1b5a('0x3a')],'busy':this['busy'],'busyQueue':this[_0x1b5a('0x3b')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x1b5a('0x3c')],'mailWaitingInteractions':this[_0x1b5a('0x3d')],'openchannelWaitingInteractions':this[_0x1b5a('0x28')],'smsWaitingInteractions':this[_0x1b5a('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x583f46=md5(JSON[_0x1b5a('0x3e')](_0x3d4590));if(this[_0x1b5a('0x2')]!==_0x583f46){this[_0x1b5a('0x2')]=_0x583f46;io[_0x1b5a('0x3f')](_0x1b5a('0x40'),_0x3d4590);}};module[_0x1b5a('0x41')]=Agent;
\ No newline at end of file
+var _0xdc42=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','updateRealtime','chat','openchannel','sms','length','StatusTime','toNumber','format','Status','mailCapacity','faxStatusTime','busy','smsWaitingInteractions','stringify','emit','exports','md5','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause'];(function(_0x21a99e,_0x28b022){var _0x2d6f08=function(_0x5eafda){while(--_0x5eafda){_0x21a99e['push'](_0x21a99e['shift']());}};_0x2d6f08(++_0x28b022);}(_0xdc42,0x1e6));var _0x2dc4=function(_0x4f63f4,_0x302cce){_0x4f63f4=_0x4f63f4-0x0;var _0x52fcaf=_0xdc42[_0x4f63f4];return _0x52fcaf;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x2dc4('0x0'));var Redis=require(_0x2dc4('0x1'));var config=require(_0x2dc4('0x2'));config[_0x2dc4('0x3')]=_['defaults'](config['redis'],{'host':_0x2dc4('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x3f8dbc){this['id']=_0x3f8dbc['id']||0x0;this[_0x2dc4('0x5')]=_0x3f8dbc['name']||'';this[_0x2dc4('0x6')]=_0x3f8dbc[_0x2dc4('0x6')]||!![];this['voicePause']=_0x3f8dbc[_0x2dc4('0x7')]||![];this[_0x2dc4('0x8')]=_0x3f8dbc[_0x2dc4('0x8')]||![];this['mailPause']=_0x3f8dbc[_0x2dc4('0x9')]||![];this[_0x2dc4('0xa')]=_0x3f8dbc[_0x2dc4('0xa')]||![];this[_0x2dc4('0xb')]=_0x3f8dbc[_0x2dc4('0xb')]||![];this[_0x2dc4('0xc')]=_0x3f8dbc[_0x2dc4('0xc')]||![];this[_0x2dc4('0xd')]=_0x2dc4('0xe');this[_0x2dc4('0xf')]=0x0;this[_0x2dc4('0x10')]=_0x3f8dbc[_0x2dc4('0x10')]||0x0;this[_0x2dc4('0x11')]=0x0;this[_0x2dc4('0x12')]=_0x2dc4('0xe');this[_0x2dc4('0x13')]=0x0;this['mailCapacity']=_0x3f8dbc['mailCapacity']||0x0;this[_0x2dc4('0x14')]=0x0;this['faxStatus']=_0x2dc4('0xe');this['faxStatusTime']=0x0;this[_0x2dc4('0x15')]=_0x3f8dbc['faxCapacity']||0x0;this[_0x2dc4('0x16')]=0x0;this[_0x2dc4('0x17')]=_0x2dc4('0xe');this[_0x2dc4('0x18')]=0x0;this[_0x2dc4('0x19')]=_0x3f8dbc[_0x2dc4('0x19')]||0x0;this[_0x2dc4('0x1a')]=0x0;this[_0x2dc4('0x1b')]=_0x2dc4('0xe');this[_0x2dc4('0x1c')]=0x0;this['whatsappCapacity']=_0x3f8dbc[_0x2dc4('0x1d')]||0x0;this[_0x2dc4('0x1e')]=0x0;this[_0x2dc4('0x1f')]=_0x2dc4('0xe');this[_0x2dc4('0x20')]=0x0;this['openchannelCapacity']=_0x3f8dbc[_0x2dc4('0x21')]||0x0;this[_0x2dc4('0x22')]=0x0;this['busy']=![];this[_0x2dc4('0x23')]=undefined;this[_0x2dc4('0x0')]='';this[_0x2dc4('0x24')]={};this[_0x2dc4('0x25')]={};this[_0x2dc4('0x26')]={};this[_0x2dc4('0x27')]={};this['smsWaitingInteractions']={};this[_0x2dc4('0x28')]={};this['updateRealtime']();}Agent[_0x2dc4('0x29')][_0x2dc4('0x2a')]=function(_0x392ded){if(this[_0x392ded+_0x2dc4('0x2b')]>0x0){if(this[_0x392ded+'Capacity']>0x0&&this[_0x392ded+'CurrentCapacity']>=this[_0x392ded+_0x2dc4('0x2c')]){return _0x2dc4('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x2dc4('0x29')][_0x2dc4('0x2e')]=function(){var _0x3dd875=['mail',_0x2dc4('0x2f'),_0x2dc4('0x30'),'fax',_0x2dc4('0x31'),'whatsapp'];for(var _0x5cd939=0x0;_0x5cd939<_0x3dd875[_0x2dc4('0x32')];_0x5cd939+=0x1){var _0x2d23eb=this[_0x2dc4('0x2a')](_0x3dd875[_0x5cd939]);if(this[_0x3dd875[_0x5cd939]+'Status']!==_0x2d23eb){this[_0x3dd875[_0x5cd939]+_0x2dc4('0x33')]=_[_0x2dc4('0x34')](moment()[_0x2dc4('0x35')]('x'));}this[_0x3dd875[_0x5cd939]+_0x2dc4('0x36')]=_0x2d23eb;}var _0x2cdc93={'id':this['id'],'name':this[_0x2dc4('0x5')],'online':this[_0x2dc4('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0x2dc4('0x8')],'mailPause':this[_0x2dc4('0x9')],'smsPause':this[_0x2dc4('0xb')],'faxPause':this[_0x2dc4('0xa')],'openchannelPause':this[_0x2dc4('0xc')],'chatStatus':this[_0x2dc4('0xd')],'chatStatusTime':this[_0x2dc4('0xf')],'chatCapacity':this[_0x2dc4('0x10')],'chatCurrentCapacity':this[_0x2dc4('0x11')],'mailStatus':this[_0x2dc4('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2dc4('0x37')],'mailCurrentCapacity':this[_0x2dc4('0x14')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x2dc4('0x38')],'faxCapacity':this[_0x2dc4('0x15')],'faxCurrentCapacity':this[_0x2dc4('0x16')],'smsStatus':this[_0x2dc4('0x17')],'smsStatusTime':this[_0x2dc4('0x18')],'smsCapacity':this[_0x2dc4('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x2dc4('0x1b')],'whatsappStatusTime':this[_0x2dc4('0x1c')],'whatsappCapacity':this[_0x2dc4('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x2dc4('0x1f')],'openchannelStatusTime':this[_0x2dc4('0x20')],'openchannelCapacity':this[_0x2dc4('0x21')],'openchannelCurrentCapacity':this[_0x2dc4('0x22')],'busy':this[_0x2dc4('0x39')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x2dc4('0x24')],'faxWaitingInteractions':this[_0x2dc4('0x25')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x2dc4('0x3a')],'whatsappWaitingInteractions':this[_0x2dc4('0x28')]};var _0x3bcf5c=md5(JSON[_0x2dc4('0x3b')](_0x2cdc93));if(this[_0x2dc4('0x0')]!==_0x3bcf5c){this[_0x2dc4('0x0')]=_0x3bcf5c;io[_0x2dc4('0x3c')]('user:save',_0x2cdc93);}};module[_0x2dc4('0x3d')]=Agent;
\ No newline at end of file
index d6a6da5..ec91316 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac30=['lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','stringify','md5','format','chat:queue:%s','emit'];(function(_0x8036e9,_0xb2a199){var _0x34a8eb=function(_0xa35740){while(--_0xa35740){_0x8036e9['push'](_0x8036e9['shift']());}};_0x34a8eb(++_0xb2a199);}(_0xac30,0x91));var _0x0ac3=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0xac30[_0x462999];return _0x4b1366;};'use strict';var _=require(_0x0ac3('0x0'));var md5=require('md5');var util=require(_0x0ac3('0x1'));var Redis=require(_0x0ac3('0x2'));var config=require(_0x0ac3('0x3'));config[_0x0ac3('0x4')]=_[_0x0ac3('0x5')](config[_0x0ac3('0x4')],{'host':_0x0ac3('0x6'),'port':0x18eb});var io=require(_0x0ac3('0x7'))(new Redis(config['redis']));function ChatQueue(_0x1c723c){this['id']=_0x1c723c['id']||0x0;this[_0x0ac3('0x8')]=_0x1c723c[_0x0ac3('0x8')]||'';this[_0x0ac3('0x9')]=_0x1c723c[_0x0ac3('0x9')]||0xa;this[_0x0ac3('0xa')]=_0x1c723c['strategy']||_0x0ac3('0xb');this['Agents']=_0x1c723c[_0x0ac3('0xc')];this[_0x0ac3('0xd')]={};this[_0x0ac3('0xe')]=0x0;this['md5']='';this[_0x0ac3('0xf')]();this[_0x0ac3('0x10')]();}ChatQueue[_0x0ac3('0x11')][_0x0ac3('0xf')]=function(){var _0x4df177=this['mapAgentsId'][_0x0ac3('0x12')];this[_0x0ac3('0xd')]=_[_0x0ac3('0x13')](this['Agents'],'id');this[_0x0ac3('0xd')]['_rr']=_0x4df177;};ChatQueue['prototype'][_0x0ac3('0x10')]=function(){this[_0x0ac3('0x14')]=0x0;this[_0x0ac3('0x15')]=0x0;for(var _0x69a7c1=0x0;_0x69a7c1<this[_0x0ac3('0xc')][_0x0ac3('0x16')];_0x69a7c1+=0x1){if(this[_0x0ac3('0xc')][_0x69a7c1]['online']){this['loggedIn']+=0x1;}if(this[_0x0ac3('0xc')][_0x69a7c1]['chatPause']){this['paused']+=0x1;}}this[_0x0ac3('0x17')]=this[_0x0ac3('0x14')]-this[_0x0ac3('0x15')];this[_0x0ac3('0x17')]=this['available']>=0x0?this[_0x0ac3('0x17')]:0x0;var _0x1637c2={'id':this['id'],'available':this[_0x0ac3('0x17')],'loggedIn':this[_0x0ac3('0x14')],'name':this[_0x0ac3('0x8')],'paused':this[_0x0ac3('0x15')],'waiting':this[_0x0ac3('0xe')]};var _0x17d485=md5(JSON[_0x0ac3('0x18')](_0x1637c2));if(this[_0x0ac3('0x19')]!==_0x17d485){this[_0x0ac3('0x19')]=_0x17d485;io['to'](util[_0x0ac3('0x1a')](_0x0ac3('0x1b'),_0x1637c2[_0x0ac3('0x8')]))[_0x0ac3('0x1c')]('chat_queue:save',_0x1637c2);}};module['exports']=ChatQueue;
\ No newline at end of file
+var _0xf3c5=['chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s'];(function(_0x4db241,_0x4c10db){var _0x180802=function(_0x322bed){while(--_0x322bed){_0x4db241['push'](_0x4db241['shift']());}};_0x180802(++_0x4c10db);}(_0xf3c5,0x98));var _0x5f3c=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0xf3c5[_0x2fab67];return _0x3b0237;};'use strict';var _=require(_0x5f3c('0x0'));var md5=require(_0x5f3c('0x1'));var util=require(_0x5f3c('0x2'));var Redis=require(_0x5f3c('0x3'));var config=require(_0x5f3c('0x4'));config[_0x5f3c('0x5')]=_[_0x5f3c('0x6')](config[_0x5f3c('0x5')],{'host':_0x5f3c('0x7'),'port':0x18eb});var io=require(_0x5f3c('0x8'))(new Redis(config['redis']));function ChatQueue(_0x462591){this['id']=_0x462591['id']||0x0;this[_0x5f3c('0x9')]=_0x462591['name']||'';this[_0x5f3c('0xa')]=_0x462591[_0x5f3c('0xa')]||0xa;this[_0x5f3c('0xb')]=_0x462591[_0x5f3c('0xb')]||_0x5f3c('0xc');this[_0x5f3c('0xd')]=_0x462591['Agents'];this[_0x5f3c('0xe')]={};this[_0x5f3c('0xf')]=0x0;this[_0x5f3c('0x1')]='';this[_0x5f3c('0x10')]();this[_0x5f3c('0x11')]();}ChatQueue[_0x5f3c('0x12')][_0x5f3c('0x10')]=function(){var _0x1de0f3=this[_0x5f3c('0xe')]['_rr'];this[_0x5f3c('0xe')]=_[_0x5f3c('0x13')](this[_0x5f3c('0xd')],'id');this[_0x5f3c('0xe')]['_rr']=_0x1de0f3;};ChatQueue['prototype'][_0x5f3c('0x11')]=function(){this[_0x5f3c('0x14')]=0x0;this[_0x5f3c('0x15')]=0x0;for(var _0x3f8dc0=0x0;_0x3f8dc0<this[_0x5f3c('0xd')][_0x5f3c('0x16')];_0x3f8dc0+=0x1){if(this[_0x5f3c('0xd')][_0x3f8dc0][_0x5f3c('0x17')]){this[_0x5f3c('0x14')]+=0x1;}if(this[_0x5f3c('0xd')][_0x3f8dc0][_0x5f3c('0x18')]){this[_0x5f3c('0x15')]+=0x1;}}this[_0x5f3c('0x19')]=this['loggedIn']-this[_0x5f3c('0x15')];this['available']=this[_0x5f3c('0x19')]>=0x0?this[_0x5f3c('0x19')]:0x0;var _0x2f7243={'id':this['id'],'available':this[_0x5f3c('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x5f3c('0xf')]};var _0x34038b=md5(JSON[_0x5f3c('0x1a')](_0x2f7243));if(this[_0x5f3c('0x1')]!==_0x34038b){this[_0x5f3c('0x1')]=_0x34038b;io['to'](util['format'](_0x5f3c('0x1b'),_0x2f7243[_0x5f3c('0x9')]))['emit'](_0x5f3c('0x1c'),_0x2f7243);}};module[_0x5f3c('0x1d')]=ChatQueue;
\ No newline at end of file
index 3446cb8..bdd72db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed3c=['strategy','beepall','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','faxPause','available','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x362519,_0x5d067b){var _0x134ba4=function(_0xc12a5e){while(--_0xc12a5e){_0x362519['push'](_0x362519['shift']());}};_0x134ba4(++_0x5d067b);}(_0xed3c,0x18d));var _0xced3=function(_0x3f5dd3,_0x171037){_0x3f5dd3=_0x3f5dd3-0x0;var _0x3cb003=_0xed3c[_0x3f5dd3];return _0x3cb003;};'use strict';var _=require(_0xced3('0x0'));var md5=require(_0xced3('0x1'));var util=require(_0xced3('0x2'));var Redis=require('ioredis');var config=require(_0xced3('0x3'));config[_0xced3('0x4')]=_[_0xced3('0x5')](config['redis'],{'host':_0xced3('0x6'),'port':0x18eb});var io=require(_0xced3('0x7'))(new Redis(config[_0xced3('0x4')]));function FaxQueue(_0x2ba2fd){this['id']=_0x2ba2fd['id']||0x0;this[_0xced3('0x8')]=_0x2ba2fd[_0xced3('0x8')]||'';this['timeout']=_0x2ba2fd['timeout']||0xa;this[_0xced3('0x9')]=_0x2ba2fd[_0xced3('0x9')]||_0xced3('0xa');this[_0xced3('0xb')]=_0x2ba2fd['Agents'];this['mapAgentsId']={};this[_0xced3('0xc')]=0x0;this[_0xced3('0x1')]='';this['updateRouting']();this[_0xced3('0xd')]();}FaxQueue['prototype'][_0xced3('0xe')]=function(){var _0x324388=this[_0xced3('0xf')][_0xced3('0x10')];this[_0xced3('0xf')]=_[_0xced3('0x11')](this['Agents'],'id');this[_0xced3('0xf')][_0xced3('0x10')]=_0x324388;};FaxQueue[_0xced3('0x12')][_0xced3('0xd')]=function(){this[_0xced3('0x13')]=0x0;this[_0xced3('0x14')]=0x0;for(var _0x197eaa=0x0;_0x197eaa<this[_0xced3('0xb')][_0xced3('0x15')];_0x197eaa+=0x1){if(this[_0xced3('0xb')][_0x197eaa]['online']){this[_0xced3('0x13')]+=0x1;}if(this['Agents'][_0x197eaa][_0xced3('0x16')]){this[_0xced3('0x14')]+=0x1;}}this[_0xced3('0x17')]=this[_0xced3('0x13')]-this[_0xced3('0x14')];this[_0xced3('0x17')]=this[_0xced3('0x17')]>=0x0?this[_0xced3('0x17')]:0x0;var _0x183c65={'id':this['id'],'available':this[_0xced3('0x17')],'loggedIn':this[_0xced3('0x13')],'name':this[_0xced3('0x8')],'paused':this[_0xced3('0x14')],'waiting':this[_0xced3('0xc')]};var _0x18be75=md5(JSON['stringify'](_0x183c65));if(this[_0xced3('0x1')]!==_0x18be75){this['md5']=_0x18be75;io['to'](util[_0xced3('0x18')](_0xced3('0x19'),_0x183c65['name']))[_0xced3('0x1a')](_0xced3('0x1b'),_0x183c65);}};module[_0xced3('0x1c')]=FaxQueue;
\ No newline at end of file
+var _0x7e3c=['length','online','faxPause','available','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused'];(function(_0x27fc3d,_0x15f1a5){var _0x9d574e=function(_0x2985ca){while(--_0x2985ca){_0x27fc3d['push'](_0x27fc3d['shift']());}};_0x9d574e(++_0x15f1a5);}(_0x7e3c,0x1c8));var _0xc7e3=function(_0x159663,_0x222e4d){_0x159663=_0x159663-0x0;var _0x39d088=_0x7e3c[_0x159663];return _0x39d088;};'use strict';var _=require(_0xc7e3('0x0'));var md5=require(_0xc7e3('0x1'));var util=require(_0xc7e3('0x2'));var Redis=require(_0xc7e3('0x3'));var config=require(_0xc7e3('0x4'));config[_0xc7e3('0x5')]=_[_0xc7e3('0x6')](config[_0xc7e3('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7e3('0x5')]));function FaxQueue(_0x457aac){this['id']=_0x457aac['id']||0x0;this[_0xc7e3('0x7')]=_0x457aac['name']||'';this[_0xc7e3('0x8')]=_0x457aac[_0xc7e3('0x8')]||0xa;this[_0xc7e3('0x9')]=_0x457aac[_0xc7e3('0x9')]||_0xc7e3('0xa');this[_0xc7e3('0xb')]=_0x457aac[_0xc7e3('0xb')];this[_0xc7e3('0xc')]={};this['waiting']=0x0;this[_0xc7e3('0x1')]='';this[_0xc7e3('0xd')]();this[_0xc7e3('0xe')]();}FaxQueue[_0xc7e3('0xf')]['updateRouting']=function(){var _0x3a8173=this[_0xc7e3('0xc')][_0xc7e3('0x10')];this[_0xc7e3('0xc')]=_['map'](this['Agents'],'id');this[_0xc7e3('0xc')]['_rr']=_0x3a8173;};FaxQueue[_0xc7e3('0xf')][_0xc7e3('0xe')]=function(){this[_0xc7e3('0x11')]=0x0;this[_0xc7e3('0x12')]=0x0;for(var _0xd0fda2=0x0;_0xd0fda2<this[_0xc7e3('0xb')][_0xc7e3('0x13')];_0xd0fda2+=0x1){if(this[_0xc7e3('0xb')][_0xd0fda2][_0xc7e3('0x14')]){this['loggedIn']+=0x1;}if(this[_0xc7e3('0xb')][_0xd0fda2][_0xc7e3('0x15')]){this[_0xc7e3('0x12')]+=0x1;}}this['available']=this[_0xc7e3('0x11')]-this[_0xc7e3('0x12')];this[_0xc7e3('0x16')]=this['available']>=0x0?this[_0xc7e3('0x16')]:0x0;var _0x3b7fe9={'id':this['id'],'available':this[_0xc7e3('0x16')],'loggedIn':this[_0xc7e3('0x11')],'name':this[_0xc7e3('0x7')],'paused':this[_0xc7e3('0x12')],'waiting':this['waiting']};var _0x1dc15f=md5(JSON['stringify'](_0x3b7fe9));if(this[_0xc7e3('0x1')]!==_0x1dc15f){this[_0xc7e3('0x1')]=_0x1dc15f;io['to'](util['format']('fax:queue:%s',_0x3b7fe9[_0xc7e3('0x7')]))[_0xc7e3('0x17')]('fax_queue:save',_0x3b7fe9);}};module[_0xc7e3('0x18')]=FaxQueue;
\ No newline at end of file
index da82023..8baa061 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4527=['Intervals','exports','name'];(function(_0xa66d8c,_0xe5aade){var _0x4caf28=function(_0x466662){while(--_0x466662){_0xa66d8c['push'](_0xa66d8c['shift']());}};_0x4caf28(++_0xe5aade);}(_0x4527,0x1eb));var _0x7452=function(_0x444d84,_0x5d5b48){_0x444d84=_0x444d84-0x0;var _0x501494=_0x4527[_0x444d84];return _0x501494;};'use strict';function Interval(_0x1aa7dc){this['id']=_0x1aa7dc['id']||0x0;this['name']=_0x1aa7dc[_0x7452('0x0')]||'';this[_0x7452('0x1')]=_0x1aa7dc['Intervals']||{};}module[_0x7452('0x2')]=Interval;
\ No newline at end of file
+var _0xabb4=['Intervals','name'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xabb4,0x10f));var _0x4abb=function(_0x9ce1c6,_0x3b24d8){_0x9ce1c6=_0x9ce1c6-0x0;var _0x234b5d=_0xabb4[_0x9ce1c6];return _0x234b5d;};'use strict';function Interval(_0x145cc4){this['id']=_0x145cc4['id']||0x0;this[_0x4abb('0x0')]=_0x145cc4[_0x4abb('0x0')]||'';this[_0x4abb('0x1')]=_0x145cc4[_0x4abb('0x1')]||{};}module['exports']=Interval;
\ No newline at end of file
index 0baaaa4..b19189e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa2b=['mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','md5','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online'];(function(_0x3b9ee4,_0x49de9b){var _0x2a2001=function(_0x55748e){while(--_0x55748e){_0x3b9ee4['push'](_0x3b9ee4['shift']());}};_0x2a2001(++_0x49de9b);}(_0xaa2b,0x1b8));var _0xbaa2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaa2b[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var md5=require(_0xbaa2('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xbaa2('0x1'));config['redis']=_[_0xbaa2('0x2')](config[_0xbaa2('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xbaa2('0x4'))(new Redis(config[_0xbaa2('0x3')]));function MailQueue(_0x1c52ca){this['id']=_0x1c52ca['id']||0x0;this['name']=_0x1c52ca[_0xbaa2('0x5')]||'';this[_0xbaa2('0x6')]=_0x1c52ca[_0xbaa2('0x6')]||0xa;this[_0xbaa2('0x7')]=_0x1c52ca['strategy']||_0xbaa2('0x8');this[_0xbaa2('0x9')]=_0x1c52ca[_0xbaa2('0x9')];this[_0xbaa2('0xa')]={};this[_0xbaa2('0xb')]=0x0;this[_0xbaa2('0x0')]='';this[_0xbaa2('0xc')]();this[_0xbaa2('0xd')]();}MailQueue[_0xbaa2('0xe')]['updateRouting']=function(){var _0x33c8c8=this[_0xbaa2('0xa')][_0xbaa2('0xf')];this[_0xbaa2('0xa')]=_[_0xbaa2('0x10')](this[_0xbaa2('0x9')],'id');this[_0xbaa2('0xa')][_0xbaa2('0xf')]=_0x33c8c8;};MailQueue[_0xbaa2('0xe')][_0xbaa2('0xd')]=function(){this[_0xbaa2('0x11')]=0x0;this['paused']=0x0;for(var _0x5753a4=0x0;_0x5753a4<this[_0xbaa2('0x9')]['length'];_0x5753a4+=0x1){if(this[_0xbaa2('0x9')][_0x5753a4][_0xbaa2('0x12')]){this[_0xbaa2('0x11')]+=0x1;}if(this[_0xbaa2('0x9')][_0x5753a4][_0xbaa2('0x13')]){this[_0xbaa2('0x14')]+=0x1;}}this[_0xbaa2('0x15')]=this[_0xbaa2('0x11')]-this[_0xbaa2('0x14')];this[_0xbaa2('0x15')]=this[_0xbaa2('0x15')]>=0x0?this[_0xbaa2('0x15')]:0x0;var _0x472f61={'id':this['id'],'available':this[_0xbaa2('0x15')],'loggedIn':this[_0xbaa2('0x11')],'name':this['name'],'paused':this[_0xbaa2('0x14')],'waiting':this[_0xbaa2('0xb')]};var _0x44ffce=md5(JSON['stringify'](_0x472f61));if(this[_0xbaa2('0x0')]!==_0x44ffce){this[_0xbaa2('0x0')]=_0x44ffce;io['to'](util[_0xbaa2('0x16')](_0xbaa2('0x17'),_0x472f61[_0xbaa2('0x5')]))[_0xbaa2('0x18')](_0xbaa2('0x19'),_0x472f61);}};module[_0xbaa2('0x1a')]=MailQueue;
\ No newline at end of file
+var _0xef4d=['waiting','updateRealtime','prototype','updateRouting','_rr','map','Agents','loggedIn','paused','online','mailPause','available','stringify','format','mail_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xef4d,0xef));var _0xdef4=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xef4d[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0xdef4('0x0'));var md5=require(_0xdef4('0x1'));var util=require(_0xdef4('0x2'));var Redis=require('ioredis');var config=require(_0xdef4('0x3'));config[_0xdef4('0x4')]=_[_0xdef4('0x5')](config[_0xdef4('0x4')],{'host':_0xdef4('0x6'),'port':0x18eb});var io=require(_0xdef4('0x7'))(new Redis(config['redis']));function MailQueue(_0x1e2e8d){this['id']=_0x1e2e8d['id']||0x0;this[_0xdef4('0x8')]=_0x1e2e8d[_0xdef4('0x8')]||'';this[_0xdef4('0x9')]=_0x1e2e8d[_0xdef4('0x9')]||0xa;this[_0xdef4('0xa')]=_0x1e2e8d['strategy']||_0xdef4('0xb');this['Agents']=_0x1e2e8d['Agents'];this[_0xdef4('0xc')]={};this[_0xdef4('0xd')]=0x0;this[_0xdef4('0x1')]='';this['updateRouting']();this[_0xdef4('0xe')]();}MailQueue[_0xdef4('0xf')][_0xdef4('0x10')]=function(){var _0x475896=this[_0xdef4('0xc')][_0xdef4('0x11')];this[_0xdef4('0xc')]=_[_0xdef4('0x12')](this[_0xdef4('0x13')],'id');this[_0xdef4('0xc')]['_rr']=_0x475896;};MailQueue[_0xdef4('0xf')][_0xdef4('0xe')]=function(){this[_0xdef4('0x14')]=0x0;this[_0xdef4('0x15')]=0x0;for(var _0x597a9d=0x0;_0x597a9d<this[_0xdef4('0x13')]['length'];_0x597a9d+=0x1){if(this[_0xdef4('0x13')][_0x597a9d][_0xdef4('0x16')]){this[_0xdef4('0x14')]+=0x1;}if(this[_0xdef4('0x13')][_0x597a9d][_0xdef4('0x17')]){this['paused']+=0x1;}}this[_0xdef4('0x18')]=this[_0xdef4('0x14')]-this['paused'];this[_0xdef4('0x18')]=this[_0xdef4('0x18')]>=0x0?this[_0xdef4('0x18')]:0x0;var _0x19af5f={'id':this['id'],'available':this[_0xdef4('0x18')],'loggedIn':this[_0xdef4('0x14')],'name':this[_0xdef4('0x8')],'paused':this[_0xdef4('0x15')],'waiting':this['waiting']};var _0x566074=md5(JSON[_0xdef4('0x19')](_0x19af5f));if(this['md5']!==_0x566074){this['md5']=_0x566074;io['to'](util[_0xdef4('0x1a')]('mail:queue:%s',_0x19af5f[_0xdef4('0x8')]))['emit'](_0xdef4('0x1b'),_0x19af5f);}};module['exports']=MailQueue;
\ No newline at end of file
index 2707458..f4a9261 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x29174f,_0x2e4f59){var _0x11cc15=function(_0x5b75cc){while(--_0x5b75cc){_0x29174f['push'](_0x29174f['shift']());}};_0x11cc15(++_0x2e4f59);}(_0x814b,0x1a2));var _0xb814=function(_0x282f9a,_0x63dff){_0x282f9a=_0x282f9a-0x0;var _0x52528c=_0x814b[_0x282f9a];return _0x52528c;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627<this[_0xb814('0xc')][_0xb814('0x16')];_0x2ab627+=0x1){if(this[_0xb814('0xc')][_0x2ab627][_0xb814('0x17')]){this[_0xb814('0x14')]+=0x1;}if(this[_0xb814('0xc')][_0x2ab627][_0xb814('0x18')]){this[_0xb814('0x15')]+=0x1;}}this[_0xb814('0x19')]=this[_0xb814('0x14')]-this[_0xb814('0x15')];this['available']=this[_0xb814('0x19')]>=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue;
\ No newline at end of file
+var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0<this[_0xac4a('0xa')][_0xac4a('0x13')];_0x3b71c0+=0x1){if(this[_0xac4a('0xa')][_0x3b71c0][_0xac4a('0x14')]){this[_0xac4a('0x11')]+=0x1;}if(this[_0xac4a('0xa')][_0x3b71c0]['openchannelPause']){this[_0xac4a('0x12')]+=0x1;}}this[_0xac4a('0x15')]=this[_0xac4a('0x11')]-this[_0xac4a('0x12')];this[_0xac4a('0x15')]=this[_0xac4a('0x15')]>=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue;
\ No newline at end of file
index ab09831..ffad581 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2fed=['_rr','map','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x2fed,0x7c));var _0xd2fe=function(_0x384839,_0x51fcab){_0x384839=_0x384839-0x0;var _0xee37fc=_0x2fed[_0x384839];return _0xee37fc;};'use strict';var _=require(_0xd2fe('0x0'));var md5=require(_0xd2fe('0x1'));var util=require(_0xd2fe('0x2'));var Redis=require(_0xd2fe('0x3'));var config=require(_0xd2fe('0x4'));config['redis']=_[_0xd2fe('0x5')](config[_0xd2fe('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2fe('0x6')]));function SmsQueue(_0x24ba90){this['id']=_0x24ba90['id']||0x0;this[_0xd2fe('0x7')]=_0x24ba90['name']||'';this[_0xd2fe('0x8')]=_0x24ba90[_0xd2fe('0x8')]||0xa;this[_0xd2fe('0x9')]=_0x24ba90[_0xd2fe('0x9')]||'beepall';this[_0xd2fe('0xa')]=_0x24ba90[_0xd2fe('0xa')];this[_0xd2fe('0xb')]={};this[_0xd2fe('0xc')]=0x0;this[_0xd2fe('0x1')]='';this[_0xd2fe('0xd')]();this[_0xd2fe('0xe')]();}SmsQueue[_0xd2fe('0xf')][_0xd2fe('0xd')]=function(){var _0x13c68f=this[_0xd2fe('0xb')][_0xd2fe('0x10')];this[_0xd2fe('0xb')]=_[_0xd2fe('0x11')](this[_0xd2fe('0xa')],'id');this[_0xd2fe('0xb')][_0xd2fe('0x10')]=_0x13c68f;};SmsQueue[_0xd2fe('0xf')]['updateRealtime']=function(){this[_0xd2fe('0x12')]=0x0;this[_0xd2fe('0x13')]=0x0;for(var _0x2a9355=0x0;_0x2a9355<this['Agents']['length'];_0x2a9355+=0x1){if(this['Agents'][_0x2a9355][_0xd2fe('0x14')]){this['loggedIn']+=0x1;}if(this[_0xd2fe('0xa')][_0x2a9355][_0xd2fe('0x15')]){this[_0xd2fe('0x13')]+=0x1;}}this[_0xd2fe('0x16')]=this[_0xd2fe('0x12')]-this[_0xd2fe('0x13')];this['available']=this['available']>=0x0?this[_0xd2fe('0x16')]:0x0;var _0x40162f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd2fe('0x12')],'name':this[_0xd2fe('0x7')],'paused':this[_0xd2fe('0x13')],'waiting':this[_0xd2fe('0xc')]};var _0x34c324=md5(JSON[_0xd2fe('0x17')](_0x40162f));if(this[_0xd2fe('0x1')]!==_0x34c324){this[_0xd2fe('0x1')]=_0x34c324;io['to'](util[_0xd2fe('0x18')](_0xd2fe('0x19'),_0x40162f['name']))[_0xd2fe('0x1a')]('sms_queue:save',_0x40162f);}};module[_0xd2fe('0x1b')]=SmsQueue;
\ No newline at end of file
+var _0xbe31=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','stringify','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x3b13f7,_0x261930){var _0xaa6278=function(_0x27b149){while(--_0x27b149){_0x3b13f7['push'](_0x3b13f7['shift']());}};_0xaa6278(++_0x261930);}(_0xbe31,0x83));var _0x1be3=function(_0x2184a0,_0x20e385){_0x2184a0=_0x2184a0-0x0;var _0x231317=_0xbe31[_0x2184a0];return _0x231317;};'use strict';var _=require('lodash');var md5=require(_0x1be3('0x0'));var util=require(_0x1be3('0x1'));var Redis=require(_0x1be3('0x2'));var config=require(_0x1be3('0x3'));config[_0x1be3('0x4')]=_[_0x1be3('0x5')](config[_0x1be3('0x4')],{'host':_0x1be3('0x6'),'port':0x18eb});var io=require(_0x1be3('0x7'))(new Redis(config['redis']));function SmsQueue(_0x2d4d97){this['id']=_0x2d4d97['id']||0x0;this['name']=_0x2d4d97[_0x1be3('0x8')]||'';this[_0x1be3('0x9')]=_0x2d4d97[_0x1be3('0x9')]||0xa;this[_0x1be3('0xa')]=_0x2d4d97[_0x1be3('0xa')]||_0x1be3('0xb');this[_0x1be3('0xc')]=_0x2d4d97[_0x1be3('0xc')];this[_0x1be3('0xd')]={};this[_0x1be3('0xe')]=0x0;this['md5']='';this[_0x1be3('0xf')]();this[_0x1be3('0x10')]();}SmsQueue[_0x1be3('0x11')][_0x1be3('0xf')]=function(){var _0x1f4ea8=this[_0x1be3('0xd')][_0x1be3('0x12')];this[_0x1be3('0xd')]=_[_0x1be3('0x13')](this['Agents'],'id');this[_0x1be3('0xd')]['_rr']=_0x1f4ea8;};SmsQueue[_0x1be3('0x11')][_0x1be3('0x10')]=function(){this['loggedIn']=0x0;this[_0x1be3('0x14')]=0x0;for(var _0x573684=0x0;_0x573684<this[_0x1be3('0xc')][_0x1be3('0x15')];_0x573684+=0x1){if(this[_0x1be3('0xc')][_0x573684][_0x1be3('0x16')]){this[_0x1be3('0x17')]+=0x1;}if(this[_0x1be3('0xc')][_0x573684]['smsPause']){this['paused']+=0x1;}}this['available']=this['loggedIn']-this[_0x1be3('0x14')];this['available']=this[_0x1be3('0x18')]>=0x0?this[_0x1be3('0x18')]:0x0;var _0xaa1d7b={'id':this['id'],'available':this[_0x1be3('0x18')],'loggedIn':this[_0x1be3('0x17')],'name':this[_0x1be3('0x8')],'paused':this[_0x1be3('0x14')],'waiting':this[_0x1be3('0xe')]};var _0x745447=md5(JSON[_0x1be3('0x19')](_0xaa1d7b));if(this[_0x1be3('0x0')]!==_0x745447){this[_0x1be3('0x0')]=_0x745447;io['to'](util['format']('sms:queue:%s',_0xaa1d7b[_0x1be3('0x8')]))['emit'](_0x1be3('0x1a'),_0xaa1d7b);}};module[_0x1be3('0x1b')]=SmsQueue;
\ No newline at end of file
index 3b900ac..4adb9d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53b0=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','length','online','available','waiting','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x53b0,0x6b));var _0x053b=function(_0x5520da,_0x38c8ba){_0x5520da=_0x5520da-0x0;var _0x138d1a=_0x53b0[_0x5520da];return _0x138d1a;};'use strict';var _=require(_0x053b('0x0'));var md5=require(_0x053b('0x1'));var util=require('util');var Redis=require(_0x053b('0x2'));var config=require(_0x053b('0x3'));config[_0x053b('0x4')]=_[_0x053b('0x5')](config[_0x053b('0x4')],{'host':_0x053b('0x6'),'port':0x18eb});var io=require(_0x053b('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x403215){this['id']=_0x403215['id']||0x0;this[_0x053b('0x8')]=_0x403215['name']||'';this[_0x053b('0x9')]=_0x403215[_0x053b('0x9')]||0xa;this[_0x053b('0xa')]=_0x403215[_0x053b('0xa')]||'beepall';this[_0x053b('0xb')]=_0x403215[_0x053b('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x053b('0x1')]='';this['updateRouting']();this[_0x053b('0xc')]();}WhatsappQueue[_0x053b('0xd')][_0x053b('0xe')]=function(){var _0x547f28=this[_0x053b('0xf')][_0x053b('0x10')];this['mapAgentsId']=_['map'](this[_0x053b('0xb')],'id');this[_0x053b('0xf')][_0x053b('0x10')]=_0x547f28;};WhatsappQueue['prototype'][_0x053b('0xc')]=function(){this[_0x053b('0x11')]=0x0;this[_0x053b('0x12')]=0x0;for(var _0x8ccf81=0x0;_0x8ccf81<this[_0x053b('0xb')][_0x053b('0x13')];_0x8ccf81+=0x1){if(this[_0x053b('0xb')][_0x8ccf81][_0x053b('0x14')]){this[_0x053b('0x11')]+=0x1;}if(this['Agents'][_0x8ccf81]['whatsappPause']){this[_0x053b('0x12')]+=0x1;}}this[_0x053b('0x15')]=this[_0x053b('0x11')]-this[_0x053b('0x12')];this[_0x053b('0x15')]=this['available']>=0x0?this[_0x053b('0x15')]:0x0;var _0x17e210={'id':this['id'],'available':this[_0x053b('0x15')],'loggedIn':this[_0x053b('0x11')],'name':this[_0x053b('0x8')],'paused':this['paused'],'waiting':this[_0x053b('0x16')]};var _0x1223c4=md5(JSON[_0x053b('0x17')](_0x17e210));if(this[_0x053b('0x1')]!==_0x1223c4){this[_0x053b('0x1')]=_0x1223c4;io['to'](util['format'](_0x053b('0x18'),_0x17e210['name']))[_0x053b('0x19')](_0x053b('0x1a'),_0x17e210);}};module[_0x053b('0x1b')]=WhatsappQueue;
\ No newline at end of file
+var _0xe0f0=['lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0xe0f0,0xd9));var _0x0e0f=function(_0x15b5d2,_0x2f76a7){_0x15b5d2=_0x15b5d2-0x0;var _0x3ca950=_0xe0f0[_0x15b5d2];return _0x3ca950;};'use strict';var _=require(_0x0e0f('0x0'));var md5=require(_0x0e0f('0x1'));var util=require(_0x0e0f('0x2'));var Redis=require('ioredis');var config=require(_0x0e0f('0x3'));config[_0x0e0f('0x4')]=_[_0x0e0f('0x5')](config[_0x0e0f('0x4')],{'host':_0x0e0f('0x6'),'port':0x18eb});var io=require(_0x0e0f('0x7'))(new Redis(config[_0x0e0f('0x4')]));function WhatsappQueue(_0x4d3c65){this['id']=_0x4d3c65['id']||0x0;this[_0x0e0f('0x8')]=_0x4d3c65[_0x0e0f('0x8')]||'';this[_0x0e0f('0x9')]=_0x4d3c65[_0x0e0f('0x9')]||0xa;this[_0x0e0f('0xa')]=_0x4d3c65[_0x0e0f('0xa')]||_0x0e0f('0xb');this[_0x0e0f('0xc')]=_0x4d3c65[_0x0e0f('0xc')];this[_0x0e0f('0xd')]={};this[_0x0e0f('0xe')]=0x0;this['md5']='';this[_0x0e0f('0xf')]();this[_0x0e0f('0x10')]();}WhatsappQueue[_0x0e0f('0x11')][_0x0e0f('0xf')]=function(){var _0x4fcf39=this[_0x0e0f('0xd')][_0x0e0f('0x12')];this[_0x0e0f('0xd')]=_[_0x0e0f('0x13')](this[_0x0e0f('0xc')],'id');this['mapAgentsId'][_0x0e0f('0x12')]=_0x4fcf39;};WhatsappQueue[_0x0e0f('0x11')][_0x0e0f('0x10')]=function(){this['loggedIn']=0x0;this[_0x0e0f('0x14')]=0x0;for(var _0x2ce968=0x0;_0x2ce968<this[_0x0e0f('0xc')][_0x0e0f('0x15')];_0x2ce968+=0x1){if(this[_0x0e0f('0xc')][_0x2ce968][_0x0e0f('0x16')]){this['loggedIn']+=0x1;}if(this[_0x0e0f('0xc')][_0x2ce968]['whatsappPause']){this[_0x0e0f('0x14')]+=0x1;}}this[_0x0e0f('0x17')]=this[_0x0e0f('0x18')]-this[_0x0e0f('0x14')];this[_0x0e0f('0x17')]=this['available']>=0x0?this[_0x0e0f('0x17')]:0x0;var _0x54427a={'id':this['id'],'available':this[_0x0e0f('0x17')],'loggedIn':this[_0x0e0f('0x18')],'name':this[_0x0e0f('0x8')],'paused':this[_0x0e0f('0x14')],'waiting':this[_0x0e0f('0xe')]};var _0x1e9e8f=md5(JSON[_0x0e0f('0x19')](_0x54427a));if(this[_0x0e0f('0x1')]!==_0x1e9e8f){this['md5']=_0x1e9e8f;io['to'](util[_0x0e0f('0x1a')](_0x0e0f('0x1b'),_0x54427a[_0x0e0f('0x8')]))[_0x0e0f('0x1c')](_0x0e0f('0x1d'),_0x54427a);}};module[_0x0e0f('0x1e')]=WhatsappQueue;
\ No newline at end of file
index 651f27a..348746a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x31c74a,_0x5bd1a9){var _0x1ba845=function(_0x3cf5c9){while(--_0x3cf5c9){_0x31c74a['push'](_0x31c74a['shift']());}};_0x1ba845(++_0x5bd1a9);}(_0xb10b,0x12a));var _0xbb10=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0xb10b[_0x2532a6];return _0x1d6b92;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime;
\ No newline at end of file
+var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime;
\ No newline at end of file
index f206d3d..663d65d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f22=['update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x662775,_0xf52a88){var _0x512980=function(_0x8837bf){while(--_0x8837bf){_0x662775['push'](_0x662775['shift']());}};_0x512980(++_0xf52a88);}(_0x0f22,0xf5));var _0x20f2=function(_0x269615,_0x37eae4){_0x269615=_0x269615-0x0;var _0x2dbb6e=_0x0f22[_0x269615];return _0x2dbb6e;};'use strict';var client=require(_0x20f2('0x0'));exports[_0x20f2('0x1')]=function(_0x521b54,_0x5e4cbc){return client[_0x20f2('0x2')](_0x20f2('0x3'),{'body':_0x5e4cbc,'options':{'where':{'id':_0x521b54}},'log':'updateChatInteraction'});};exports[_0x20f2('0x4')]=function(_0x9f6f25,_0x1892dc){return client[_0x20f2('0x2')](_0x20f2('0x5'),{'body':_0x1892dc,'options':{'where':{'id':_0x9f6f25}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
+var _0xc2c2=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc2c2,0x1d1));var _0x2c2c=function(_0x2fe691,_0x1a85ed){_0x2fe691=_0x2fe691-0x0;var _0x49cb1d=_0xc2c2[_0x2fe691];return _0x49cb1d;};'use strict';var client=require(_0x2c2c('0x0'));exports[_0x2c2c('0x1')]=function(_0x4877c5,_0x412535){return client[_0x2c2c('0x2')](_0x2c2c('0x3'),{'body':_0x412535,'options':{'where':{'id':_0x4877c5}},'log':_0x2c2c('0x4')});};exports[_0x2c2c('0x5')]=function(_0x4f605e,_0x325003){return client[_0x2c2c('0x2')](_0x2c2c('0x6'),{'body':_0x325003,'options':{'where':{'id':_0x4f605e}},'log':_0x2c2c('0x7')});};
\ No newline at end of file
index b71d884..8d3c518 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2f9=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe2f9,0x194));var _0x9e2f=function(_0x9a998b,_0x2fb091){_0x9a998b=_0x9a998b-0x0;var _0x35c369=_0xe2f9[_0x9a998b];return _0x35c369;};'use strict';var client=require(_0x9e2f('0x0'));exports[_0x9e2f('0x1')]=function(_0x56e00d){return client[_0x9e2f('0x2')](_0x9e2f('0x3'),{'body':_0x56e00d,'log':_0x9e2f('0x4')});};
\ No newline at end of file
+var _0x5332=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5332,0x16a));var _0x2533=function(_0x53ae11,_0x263dc2){_0x53ae11=_0x53ae11-0x0;var _0x22e824=_0x5332[_0x53ae11];return _0x22e824;};'use strict';var client=require(_0x2533('0x0'));exports[_0x2533('0x1')]=function(_0x4f381a){return client[_0x2533('0x2')](_0x2533('0x3'),{'body':_0x4f381a,'log':_0x2533('0x4')});};
\ No newline at end of file
index 2bbf624..0f277de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac21=['Request','name','strategy','User','chatPause','getChatQueues'];(function(_0x16adf1,_0x1273a5){var _0xc13362=function(_0x35e767){while(--_0x35e767){_0x16adf1['push'](_0x16adf1['shift']());}};_0xc13362(++_0x1273a5);}(_0xac21,0x1af));var _0x1ac2=function(_0x4143cd,_0x3c4f54){_0x4143cd=_0x4143cd-0x0;var _0x5d4396=_0xac21[_0x4143cd];return _0x5d4396;};'use strict';var client=require('../client');exports[_0x1ac2('0x0')]=function(){return function(){return client[_0x1ac2('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x1ac2('0x2'),'timeout',_0x1ac2('0x3')],'include':[{'model':_0x1ac2('0x4'),'as':'Agents','attributes':['id',_0x1ac2('0x2'),'online',_0x1ac2('0x5')]}]},'log':_0x1ac2('0x0')});};};
\ No newline at end of file
+var _0x1c3b=['../client','getChatQueues','Request','timeout','strategy','User','Agents','name','online'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1c3b,0xab));var _0xb1c3=function(_0x17ac16,_0x215845){_0x17ac16=_0x17ac16-0x0;var _0x196704=_0x1c3b[_0x17ac16];return _0x196704;};'use strict';var client=require(_0xb1c3('0x0'));exports[_0xb1c3('0x1')]=function(){return function(){return client[_0xb1c3('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xb1c3('0x3'),_0xb1c3('0x4')],'include':[{'model':_0xb1c3('0x5'),'as':_0xb1c3('0x6'),'attributes':['id',_0xb1c3('0x7'),_0xb1c3('0x8'),'chatPause']}]},'log':_0xb1c3('0x1')});};};
\ No newline at end of file
index 6ed29bc..5a9491c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc17=['CreateChatQueueReport','UpdateChatQueueReport','../client','create','Request'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0xbc17[_0x5651ef];return _0x392fba;};'use strict';var client=require(_0x7bc1('0x0'));exports[_0x7bc1('0x1')]=function(_0x5e8e5a){return client[_0x7bc1('0x2')](_0x7bc1('0x3'),{'body':_0x5e8e5a,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3ff36d,_0x7aa41e){return client['Request'](_0x7bc1('0x4'),{'body':_0x7aa41e,'options':{'where':{'uniqueid':_0x3ff36d},'order':[['id','DESC']],'limit':0x1},'log':_0x7bc1('0x4')});};
\ No newline at end of file
+var _0xd3b4=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x576b81,_0x5aeddf){_0x576b81=_0x576b81-0x0;var _0x347a44=_0xd3b4[_0x576b81];return _0x347a44;};'use strict';var client=require(_0x4d3b('0x0'));exports['create']=function(_0x5d886c){return client[_0x4d3b('0x1')](_0x4d3b('0x2'),{'body':_0x5d886c,'log':_0x4d3b('0x2')});};exports[_0x4d3b('0x3')]=function(_0x4b4133,_0x18ad10){return client['Request'](_0x4d3b('0x4'),{'body':_0x18ad10,'options':{'where':{'uniqueid':_0x4b4133},'order':[['id',_0x4d3b('0x5')]],'limit':0x1},'log':_0x4d3b('0x4')});};
\ No newline at end of file
index 38ac07d..329f5e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x7a54,0x106));var _0x47a5=function(_0x1bde38,_0x985653){_0x1bde38=_0x1bde38-0x0;var _0x9a624a=_0x7a54[_0x1bde38];return _0x9a624a;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});};
\ No newline at end of file
+var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x7a54,0x106));var _0x47a5=function(_0x4a670b,_0x34ddba){_0x4a670b=_0x4a670b-0x0;var _0x1bb940=_0x7a54[_0x4a670b];return _0x1bb940;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});};
\ No newline at end of file
index 6d4e66d..4b750fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6885=['Request','CreateFaxMessage','../client','create'];(function(_0x1aa4f0,_0x5907b8){var _0x5aba37=function(_0x99c95c){while(--_0x99c95c){_0x1aa4f0['push'](_0x1aa4f0['shift']());}};_0x5aba37(++_0x5907b8);}(_0x6885,0x13a));var _0x5688=function(_0x145c4f,_0x4c2eb9){_0x145c4f=_0x145c4f-0x0;var _0x14c56d=_0x6885[_0x145c4f];return _0x14c56d;};'use strict';var client=require(_0x5688('0x0'));exports[_0x5688('0x1')]=function(_0x2ad839){return client[_0x5688('0x2')](_0x5688('0x3'),{'body':_0x2ad839,'log':'createFaxMessage'});};
\ No newline at end of file
+var _0x256f=['create','createFaxMessage'];(function(_0x39d44,_0x1e01d3){var _0x435e0d=function(_0x19f5ee){while(--_0x19f5ee){_0x39d44['push'](_0x39d44['shift']());}};_0x435e0d(++_0x1e01d3);}(_0x256f,0x1ba));var _0xf256=function(_0x5f347d,_0x26795e){_0x5f347d=_0x5f347d-0x0;var _0x1a69f6=_0x256f[_0x5f347d];return _0x1a69f6;};'use strict';var client=require('../client');exports[_0xf256('0x0')]=function(_0x2870fe){return client['Request']('CreateFaxMessage',{'body':_0x2870fe,'log':_0xf256('0x1')});};
\ No newline at end of file
index 44882f2..ef5fd1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4fa=['GetFaxQueue','timeout','strategy','User','Agents','name','online','getFaxQueues','../client'];(function(_0x43f406,_0x59700c){var _0x41988c=function(_0x5c2ef0){while(--_0x5c2ef0){_0x43f406['push'](_0x43f406['shift']());}};_0x41988c(++_0x59700c);}(_0xb4fa,0xf2));var _0xab4f=function(_0xa75b90,_0x331a26){_0xa75b90=_0xa75b90-0x0;var _0x27b392=_0xb4fa[_0xa75b90];return _0x27b392;};'use strict';var client=require(_0xab4f('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xab4f('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xab4f('0x2'),_0xab4f('0x3')],'include':[{'model':_0xab4f('0x4'),'as':_0xab4f('0x5'),'attributes':['id',_0xab4f('0x6'),_0xab4f('0x7'),'faxPause']}]},'log':_0xab4f('0x8')});};};
\ No newline at end of file
+var _0x0d23=['../client','getFaxQueues','Request','GetFaxQueue','name','strategy','User','Agents','faxPause'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0d23,0x75));var _0x30d2=function(_0x1f42a8,_0x4ce5e4){_0x1f42a8=_0x1f42a8-0x0;var _0x42e7f4=_0x0d23[_0x1f42a8];return _0x42e7f4;};'use strict';var client=require(_0x30d2('0x0'));exports[_0x30d2('0x1')]=function(){return function(){return client[_0x30d2('0x2')](_0x30d2('0x3'),{'options':{'raw':![],'attributes':['id',_0x30d2('0x4'),'timeout',_0x30d2('0x5')],'include':[{'model':_0x30d2('0x6'),'as':_0x30d2('0x7'),'attributes':['id','name','online',_0x30d2('0x8')]}]},'log':_0x30d2('0x1')});};};
\ No newline at end of file
index 1a253cb..9782bbd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb2b=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xcb2b,0x156));var _0xbcb2=function(_0x5504fc,_0x2e161c){_0x5504fc=_0x5504fc-0x0;var _0xbad34c=_0xcb2b[_0x5504fc];return _0xbad34c;};'use strict';var client=require(_0xbcb2('0x0'));exports[_0xbcb2('0x1')]=function(_0x46f2d3){return client[_0xbcb2('0x2')](_0xbcb2('0x3'),{'body':_0x46f2d3,'log':_0xbcb2('0x3')});};exports[_0xbcb2('0x4')]=function(_0x14c572,_0x5f49b3){return client['Request'](_0xbcb2('0x5'),{'body':_0x5f49b3,'options':{'where':{'uniqueid':_0x14c572},'order':[['id','DESC']],'limit':0x1},'log':_0xbcb2('0x5')});};
\ No newline at end of file
+var _0x2732=['CreateFaxQueueReport','update','UpdateFaxQueueReport','create','Request'];(function(_0x1269b8,_0x71a937){var _0x18dc9f=function(_0x5f44a2){while(--_0x5f44a2){_0x1269b8['push'](_0x1269b8['shift']());}};_0x18dc9f(++_0x71a937);}(_0x2732,0x120));var _0x2273=function(_0x36183e,_0x2b74bd){_0x36183e=_0x36183e-0x0;var _0x23aa50=_0x2732[_0x36183e];return _0x23aa50;};'use strict';var client=require('../client');exports[_0x2273('0x0')]=function(_0x400126){return client[_0x2273('0x1')](_0x2273('0x2'),{'body':_0x400126,'log':_0x2273('0x2')});};exports[_0x2273('0x3')]=function(_0x597c46,_0x3de2c7){return client['Request'](_0x2273('0x4'),{'body':_0x3de2c7,'options':{'where':{'uniqueid':_0x597c46},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});};
\ No newline at end of file
index ecb279a..e6c3017 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x081f=['Intervals','name','interval','../client','getIntervals','GetInterval','Interval'];(function(_0x1ccc22,_0x254056){var _0x3b676f=function(_0x58f6c7){while(--_0x58f6c7){_0x1ccc22['push'](_0x1ccc22['shift']());}};_0x3b676f(++_0x254056);}(_0x081f,0x1ae));var _0xf081=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x081f[_0x3e531a];return _0x3c2574;};'use strict';var client=require(_0xf081('0x0'));exports[_0xf081('0x1')]=function(){return function(){return client['Request'](_0xf081('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf081('0x3'),'as':_0xf081('0x4'),'attributes':['id',_0xf081('0x5'),_0xf081('0x6')]}]},'log':'getIntervals'});};};
\ No newline at end of file
+var _0xb632=['../client','getIntervals','Request','GetInterval','name','Intervals','interval'];(function(_0x4a94a9,_0x11bf13){var _0x52d408=function(_0x42451f){while(--_0x42451f){_0x4a94a9['push'](_0x4a94a9['shift']());}};_0x52d408(++_0x11bf13);}(_0xb632,0x1f1));var _0x2b63=function(_0x3c3c67,_0x120b9d){_0x3c3c67=_0x3c3c67-0x0;var _0x5c47cc=_0xb632[_0x3c3c67];return _0x5c47cc;};'use strict';var client=require(_0x2b63('0x0'));exports[_0x2b63('0x1')]=function(){return function(){return client[_0x2b63('0x2')](_0x2b63('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2b63('0x4')],'include':[{'model':'Interval','as':_0x2b63('0x5'),'attributes':['id',_0x2b63('0x4'),_0x2b63('0x6')]}]},'log':_0x2b63('0x1')});};};
\ No newline at end of file
index f3e14cd..dfaa022 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4991=['AddTagsToMailInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4d255c,_0x11cb61){var _0xdac008=function(_0x3d2bb3){while(--_0x3d2bb3){_0x4d255c['push'](_0x4d255c['shift']());}};_0xdac008(++_0x11cb61);}(_0x4991,0xf7));var _0x1499=function(_0x3b757a,_0x521eec){_0x3b757a=_0x3b757a-0x0;var _0x5ebd86=_0x4991[_0x3b757a];return _0x5ebd86;};'use strict';var client=require(_0x1499('0x0'));exports['update']=function(_0x326758,_0x5bd577){return client[_0x1499('0x1')](_0x1499('0x2'),{'body':_0x5bd577,'options':{'where':{'id':_0x326758}},'log':_0x1499('0x3')});};exports[_0x1499('0x4')]=function(_0x1b291f,_0x158134){return client[_0x1499('0x1')](_0x1499('0x5'),{'body':_0x158134,'options':{'where':{'id':_0x1b291f}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
+var _0x7b84=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xe78376,_0x33cd94){var _0x5542c8=function(_0x32c849){while(--_0x32c849){_0xe78376['push'](_0xe78376['shift']());}};_0x5542c8(++_0x33cd94);}(_0x7b84,0x17c));var _0x47b8=function(_0x362e40,_0x236b6d){_0x362e40=_0x362e40-0x0;var _0x29148b=_0x7b84[_0x362e40];return _0x29148b;};'use strict';var client=require(_0x47b8('0x0'));exports[_0x47b8('0x1')]=function(_0x186f89,_0xda244a){return client[_0x47b8('0x2')](_0x47b8('0x3'),{'body':_0xda244a,'options':{'where':{'id':_0x186f89}},'log':_0x47b8('0x4')});};exports['addTags']=function(_0x445a5f,_0x1fa41a){return client[_0x47b8('0x2')](_0x47b8('0x5'),{'body':_0x1fa41a,'options':{'where':{'id':_0x445a5f}},'log':_0x47b8('0x6')});};
\ No newline at end of file
index 2045552..3804dc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf360=['../client','create','Request','CreateMailMessage'];(function(_0x3d976d,_0x3e449f){var _0x398551=function(_0x1be6dd){while(--_0x1be6dd){_0x3d976d['push'](_0x3d976d['shift']());}};_0x398551(++_0x3e449f);}(_0xf360,0x164));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x0f36('0x0'));exports[_0x0f36('0x1')]=function(_0x3531b9){return client[_0x0f36('0x2')](_0x0f36('0x3'),{'body':_0x3531b9,'log':'createMailMessage'});};
\ No newline at end of file
+var _0x306e=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x10d6f5,_0x140245){var _0x484db4=function(_0x2f7ec4){while(--_0x2f7ec4){_0x10d6f5['push'](_0x10d6f5['shift']());}};_0x484db4(++_0x140245);}(_0x306e,0x1ee));var _0xe306=function(_0x3f6dae,_0x585f1f){_0x3f6dae=_0x3f6dae-0x0;var _0x33d69f=_0x306e[_0x3f6dae];return _0x33d69f;};'use strict';var client=require('../client');exports[_0xe306('0x0')]=function(_0x166e46){return client[_0xe306('0x1')](_0xe306('0x2'),{'body':_0x166e46,'log':_0xe306('0x3')});};
\ No newline at end of file
index a001a07..b0e1342 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe8d5=['online','../client','getMailQueues','Request','GetMailQueue','timeout','Agents','name'];(function(_0xe480f0,_0x4c0dc1){var _0x57b198=function(_0x4d8304){while(--_0x4d8304){_0xe480f0['push'](_0xe480f0['shift']());}};_0x57b198(++_0x4c0dc1);}(_0xe8d5,0xa9));var _0x5e8d=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xe8d5[_0x3740fe];return _0x55492b;};'use strict';var client=require(_0x5e8d('0x0'));exports[_0x5e8d('0x1')]=function(){return function(){return client[_0x5e8d('0x2')](_0x5e8d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5e8d('0x4'),'strategy'],'include':[{'model':'User','as':_0x5e8d('0x5'),'attributes':['id',_0x5e8d('0x6'),_0x5e8d('0x7'),'mailPause']}]},'log':'getMailQueues'});};};
\ No newline at end of file
+var _0x0d85=['mailPause','getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x4dc9b1,_0x4017ee){var _0x2fc972=function(_0x52707e){while(--_0x52707e){_0x4dc9b1['push'](_0x4dc9b1['shift']());}};_0x2fc972(++_0x4017ee);}(_0x0d85,0x1da));var _0x50d8=function(_0x49a157,_0x51a8a9){_0x49a157=_0x49a157-0x0;var _0x133552=_0x0d85[_0x49a157];return _0x133552;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0x50d8('0x0'),{'options':{'raw':![],'attributes':['id',_0x50d8('0x1'),_0x50d8('0x2'),_0x50d8('0x3')],'include':[{'model':_0x50d8('0x4'),'as':_0x50d8('0x5'),'attributes':['id',_0x50d8('0x1'),'online',_0x50d8('0x6')]}]},'log':_0x50d8('0x7')});};};
\ No newline at end of file
index 5d323e9..d2407aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf757=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x30aa83,_0x447255){var _0x306bc0=function(_0x525623){while(--_0x525623){_0x30aa83['push'](_0x30aa83['shift']());}};_0x306bc0(++_0x447255);}(_0xf757,0x1d8));var _0x7f75=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xf757[_0x5a6de2];return _0x2c0525;};'use strict';var client=require(_0x7f75('0x0'));exports[_0x7f75('0x1')]=function(_0x3cd2a2){return client[_0x7f75('0x2')](_0x7f75('0x3'),{'body':_0x3cd2a2,'log':_0x7f75('0x3')});};exports[_0x7f75('0x4')]=function(_0x2f63a8,_0xe21990){return client[_0x7f75('0x2')](_0x7f75('0x5'),{'body':_0xe21990,'options':{'where':{'uniqueid':_0x2f63a8},'order':[['id',_0x7f75('0x6')]],'limit':0x1},'log':_0x7f75('0x5')});};
\ No newline at end of file
+var _0xe1fa=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe1fa,0x97));var _0xae1f=function(_0xfef581,_0x9143d5){_0xfef581=_0xfef581-0x0;var _0x15c2ef=_0xe1fa[_0xfef581];return _0x15c2ef;};'use strict';var client=require(_0xae1f('0x0'));exports[_0xae1f('0x1')]=function(_0x382514){return client[_0xae1f('0x2')](_0xae1f('0x3'),{'body':_0x382514,'log':_0xae1f('0x3')});};exports[_0xae1f('0x4')]=function(_0x13f54d,_0x5a2e17){return client[_0xae1f('0x2')](_0xae1f('0x5'),{'body':_0x5a2e17,'options':{'where':{'uniqueid':_0x13f54d},'order':[['id',_0xae1f('0x6')]],'limit':0x1},'log':_0xae1f('0x5')});};
\ No newline at end of file
index 69c2d03..8244a67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf56a=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','addTagsToChatInteraction','../client'];(function(_0x557399,_0x1c922a){var _0x363ded=function(_0x10e6d2){while(--_0x10e6d2){_0x557399['push'](_0x557399['shift']());}};_0x363ded(++_0x1c922a);}(_0xf56a,0x71));var _0xaf56=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0xf56a[_0x2b45b5];return _0x1d9c06;};'use strict';var client=require(_0xaf56('0x0'));exports[_0xaf56('0x1')]=function(_0x4850f0,_0x392d5d){return client['Request'](_0xaf56('0x2'),{'body':_0x392d5d,'options':{'where':{'id':_0x4850f0}},'log':_0xaf56('0x3')});};exports['addTags']=function(_0x3c4965,_0x5d2d68){return client[_0xaf56('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x5d2d68,'options':{'where':{'id':_0x3c4965}},'log':_0xaf56('0x5')});};
\ No newline at end of file
+var _0x8025=['update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8025,0x1cd));var _0x5802=function(_0x1b4a99,_0x3d0fec){_0x1b4a99=_0x1b4a99-0x0;var _0x510b74=_0x8025[_0x1b4a99];return _0x510b74;};'use strict';var client=require(_0x5802('0x0'));exports[_0x5802('0x1')]=function(_0x255d13,_0x45a3ec){return client[_0x5802('0x2')]('UpdateOpenchannelInteraction',{'body':_0x45a3ec,'options':{'where':{'id':_0x255d13}},'log':_0x5802('0x3')});};exports[_0x5802('0x4')]=function(_0x154441,_0x10d101){return client[_0x5802('0x2')](_0x5802('0x5'),{'body':_0x10d101,'options':{'where':{'id':_0x154441}},'log':_0x5802('0x6')});};
\ No newline at end of file
index a5fa537..638add3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4db5=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4db5,0xe4));var _0x54db=function(_0x5ba6d4,_0x33c28a){_0x5ba6d4=_0x5ba6d4-0x0;var _0x5245c0=_0x4db5[_0x5ba6d4];return _0x5245c0;};'use strict';var client=require(_0x54db('0x0'));exports[_0x54db('0x1')]=function(_0x260aa0){return client[_0x54db('0x2')](_0x54db('0x3'),{'body':_0x260aa0,'log':_0x54db('0x4')});};
\ No newline at end of file
+var _0x34d7=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x50f040,_0x359f43){var _0x2abb69=function(_0x4cad51){while(--_0x4cad51){_0x50f040['push'](_0x50f040['shift']());}};_0x2abb69(++_0x359f43);}(_0x34d7,0x118));var _0x734d=function(_0x20b0e3,_0x1f492d){_0x20b0e3=_0x20b0e3-0x0;var _0x472742=_0x34d7[_0x20b0e3];return _0x472742;};'use strict';var client=require('../client');exports['create']=function(_0x3e8489){return client[_0x734d('0x0')](_0x734d('0x1'),{'body':_0x3e8489,'log':_0x734d('0x2')});};
\ No newline at end of file
index 81eb947..c94ca88 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12ae=['name','online','getOpenchannelQueues','Request','strategy','User','Agents'];(function(_0xa99ab2,_0x32fca0){var _0x2595a8=function(_0xb748eb){while(--_0xb748eb){_0xa99ab2['push'](_0xa99ab2['shift']());}};_0x2595a8(++_0x32fca0);}(_0x12ae,0x175));var _0xe12a=function(_0x23a03d,_0x9f11e8){_0x23a03d=_0x23a03d-0x0;var _0x46b0d2=_0x12ae[_0x23a03d];return _0x46b0d2;};'use strict';var client=require('../client');exports[_0xe12a('0x0')]=function(){return function(){return client[_0xe12a('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xe12a('0x2')],'include':[{'model':_0xe12a('0x3'),'as':_0xe12a('0x4'),'attributes':['id',_0xe12a('0x5'),_0xe12a('0x6'),'openchannelPause']}]},'log':_0xe12a('0x0')});};};
\ No newline at end of file
+var _0xc511=['../client','Request','GetOpenchannelQueue','name','timeout','Agents','getOpenchannelQueues'];(function(_0x4afc6b,_0x5e8afd){var _0x42d3fe=function(_0x5503cc){while(--_0x5503cc){_0x4afc6b['push'](_0x4afc6b['shift']());}};_0x42d3fe(++_0x5e8afd);}(_0xc511,0x10a));var _0x1c51=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xc511[_0x4c7935];return _0x30651d;};'use strict';var client=require(_0x1c51('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x1c51('0x1')](_0x1c51('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c51('0x3'),_0x1c51('0x4'),'strategy'],'include':[{'model':'User','as':_0x1c51('0x5'),'attributes':['id','name','online','openchannelPause']}]},'log':_0x1c51('0x6')});};};
\ No newline at end of file
index 073e2dd..6f822ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a39=['DESC','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x2a39,0x1af));var _0x92a3=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0x2a39[_0x58fc2b];return _0x3937ce;};'use strict';var client=require(_0x92a3('0x0'));exports['create']=function(_0x4c17a3){return client[_0x92a3('0x1')](_0x92a3('0x2'),{'body':_0x4c17a3,'log':'CreateOpenchannelQueueReport'});};exports[_0x92a3('0x3')]=function(_0x4dd8b7,_0x3a53ab){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x3a53ab,'options':{'where':{'uniqueid':_0x4dd8b7},'order':[['id',_0x92a3('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});};
\ No newline at end of file
+var _0xc4b0=['DESC','../client','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xc4b0,0xfb));var _0x0c4b=function(_0x24fe48,_0x10e97e){_0x24fe48=_0x24fe48-0x0;var _0x51e7d5=_0xc4b0[_0x24fe48];return _0x51e7d5;};'use strict';var client=require(_0x0c4b('0x0'));exports['create']=function(_0x3eba0b){return client[_0x0c4b('0x1')](_0x0c4b('0x2'),{'body':_0x3eba0b,'log':_0x0c4b('0x2')});};exports['update']=function(_0xa04c22,_0xc8918e){return client[_0x0c4b('0x1')](_0x0c4b('0x3'),{'body':_0xc8918e,'options':{'where':{'uniqueid':_0xa04c22},'order':[['id',_0x0c4b('0x4')]],'limit':0x1},'log':_0x0c4b('0x3')});};
\ No newline at end of file
index 5d88027..0ca72cd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x536e=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x50e032,_0x8bb78f){var _0x36cd25=function(_0x559cb3){while(--_0x559cb3){_0x50e032['push'](_0x50e032['shift']());}};_0x36cd25(++_0x8bb78f);}(_0x536e,0x155));var _0xe536=function(_0x48c841,_0x27374a){_0x48c841=_0x48c841-0x0;var _0x22c86f=_0x536e[_0x48c841];return _0x22c86f;};'use strict';var client=require(_0xe536('0x0'));exports[_0xe536('0x1')]=function(_0x3fbffb,_0x416d98){return client[_0xe536('0x2')](_0xe536('0x3'),{'body':_0x416d98,'options':{'where':{'id':_0x3fbffb}},'log':_0xe536('0x4')});};exports[_0xe536('0x5')]=function(_0x26d7cb,_0x409e01){return client[_0xe536('0x2')](_0xe536('0x6'),{'body':_0x409e01,'options':{'where':{'id':_0x26d7cb}},'log':_0xe536('0x7')});};
\ No newline at end of file
+var _0x873a=['../client','update','Request','addTags','AddTagsToSmsInteraction'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x873a,0x1c2));var _0xa873=function(_0x82cc96,_0x4959cc){_0x82cc96=_0x82cc96-0x0;var _0x49966b=_0x873a[_0x82cc96];return _0x49966b;};'use strict';var client=require(_0xa873('0x0'));exports[_0xa873('0x1')]=function(_0x1bf738,_0x52186c){return client[_0xa873('0x2')]('UpdateSmsInteraction',{'body':_0x52186c,'options':{'where':{'id':_0x1bf738}},'log':'updateSmsInteraction'});};exports[_0xa873('0x3')]=function(_0x46971d,_0x5a0d23){return client[_0xa873('0x2')](_0xa873('0x4'),{'body':_0x5a0d23,'options':{'where':{'id':_0x46971d}},'log':'addTagsToSmsInteraction'});};
\ No newline at end of file
index afafd6a..5dd3ff2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ddc=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0x3c2d87,_0x623ad){var _0x142d3c=function(_0x3fa5a5){while(--_0x3fa5a5){_0x3c2d87['push'](_0x3c2d87['shift']());}};_0x142d3c(++_0x623ad);}(_0x3ddc,0x113));var _0xc3dd=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3ddc[_0x2be8c2];return _0x97f531;};'use strict';var client=require('../client');exports[_0xc3dd('0x0')]=function(_0x2a131d){return client[_0xc3dd('0x1')](_0xc3dd('0x2'),{'body':_0x2a131d,'log':_0xc3dd('0x3')});};
\ No newline at end of file
+var _0x7e6a=['createSmsMessage','CreateSmsMessage'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x7e6a,0x137));var _0xa7e6=function(_0x40bbfc,_0x31a04b){_0x40bbfc=_0x40bbfc-0x0;var _0x41ae4a=_0x7e6a[_0x40bbfc];return _0x41ae4a;};'use strict';var client=require('../client');exports['create']=function(_0x21f40e){return client['Request'](_0xa7e6('0x0'),{'body':_0x21f40e,'log':_0xa7e6('0x1')});};
\ No newline at end of file
index d7dfced..70c7b63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x1ae236,_0x33504a){var _0x57f020=function(_0x51c7cf){while(--_0x51c7cf){_0x1ae236['push'](_0x1ae236['shift']());}};_0x57f020(++_0x33504a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};};
\ No newline at end of file
+var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x7db51b,_0x1cc9e4){var _0x32c0a6=function(_0x1c7305){while(--_0x1c7305){_0x7db51b['push'](_0x7db51b['shift']());}};_0x32c0a6(++_0x1cc9e4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};};
\ No newline at end of file
index 904f624..33ef7c0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x2f065b,_0x378864){var _0x9456f7=function(_0x361524){while(--_0x361524){_0x2f065b['push'](_0x2f065b['shift']());}};_0x9456f7(++_0x378864);}(_0x34e8,0x12c));var _0x834e=function(_0x5e0a13,_0x2bd6d4){_0x5e0a13=_0x5e0a13-0x0;var _0x1a2028=_0x34e8[_0x5e0a13];return _0x1a2028;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});};
\ No newline at end of file
+var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x19e419,_0x1f0492){var _0x5579fb=function(_0x4bf508){while(--_0x4bf508){_0x19e419['push'](_0x19e419['shift']());}};_0x5579fb(++_0x1f0492);}(_0x70e0,0x17b));var _0x070e=function(_0x2dd930,_0x59efac){_0x2dd930=_0x2dd930-0x0;var _0xedfa23=_0x70e0[_0x2dd930];return _0xedfa23;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});};
\ No newline at end of file
index 2e58186..2e01541 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5af304,_0x357554){var _0x4b03b5=function(_0x316439){while(--_0x316439){_0x5af304['push'](_0x5af304['shift']());}};_0x4b03b5(++_0x357554);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};};
\ No newline at end of file
+var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x2a93bc,_0xc50cc2){var _0xc087=function(_0x363f8f){while(--_0x363f8f){_0x2a93bc['push'](_0x2a93bc['shift']());}};_0xc087(++_0xc50cc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};};
\ No newline at end of file
index e06c6cd..8f5a3ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6eec=['updateWhatsappInteraction','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc6ee('0x0'));exports[_0xc6ee('0x1')]=function(_0xfde252,_0x28512e){return client['Request'](_0xc6ee('0x2'),{'body':_0x28512e,'options':{'where':{'id':_0xfde252}},'log':_0xc6ee('0x3')});};exports['addTags']=function(_0x63587e,_0x26ee43){return client[_0xc6ee('0x4')](_0xc6ee('0x5'),{'body':_0x26ee43,'options':{'where':{'id':_0x63587e}},'log':_0xc6ee('0x6')});};
\ No newline at end of file
+var _0xc1fc=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x431a4d,_0x474639){var _0x78961e=function(_0xd0c27e){while(--_0xd0c27e){_0x431a4d['push'](_0x431a4d['shift']());}};_0x78961e(++_0x474639);}(_0xc1fc,0x93));var _0xcc1f=function(_0xdad066,_0x828b7){_0xdad066=_0xdad066-0x0;var _0x50193d=_0xc1fc[_0xdad066];return _0x50193d;};'use strict';var client=require('../client');exports[_0xcc1f('0x0')]=function(_0x39fcfb,_0x496619){return client[_0xcc1f('0x1')](_0xcc1f('0x2'),{'body':_0x496619,'options':{'where':{'id':_0x39fcfb}},'log':_0xcc1f('0x3')});};exports[_0xcc1f('0x4')]=function(_0x26d3b2,_0x52703d){return client[_0xcc1f('0x1')](_0xcc1f('0x5'),{'body':_0x52703d,'options':{'where':{'id':_0x26d3b2}},'log':'addTagsToWhatsappInteraction'});};
\ No newline at end of file
index 89fd1b0..fb9f373 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a2b=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a2b,0xa1));var _0xb7a2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7a2b[_0x18ab2a];return _0x16dcee;};'use strict';var client=require(_0xb7a2('0x0'));exports[_0xb7a2('0x1')]=function(_0x523f0f){return client['Request'](_0xb7a2('0x2'),{'body':_0x523f0f,'log':_0xb7a2('0x3')});};
\ No newline at end of file
+var _0x86ff=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x86ff,0x173));var _0xf86f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86ff[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf86f('0x0'));exports[_0xf86f('0x1')]=function(_0x83af40){return client[_0xf86f('0x2')](_0xf86f('0x3'),{'body':_0x83af40,'log':_0xf86f('0x4')});};
\ No newline at end of file
index 8a3cfcf..39a0f05 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe466=['Request','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client'];(function(_0x506d68,_0x33c064){var _0x10e1c2=function(_0x16c55c){while(--_0x16c55c){_0x506d68['push'](_0x506d68['shift']());}};_0x10e1c2(++_0x33c064);}(_0xe466,0xe9));var _0x6e46=function(_0x4a3bd9,_0x4c6ea8){_0x4a3bd9=_0x4a3bd9-0x0;var _0x45b132=_0xe466[_0x4a3bd9];return _0x45b132;};'use strict';var client=require(_0x6e46('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x6e46('0x1')](_0x6e46('0x2'),{'options':{'raw':![],'attributes':['id',_0x6e46('0x3'),'timeout',_0x6e46('0x4')],'include':[{'model':_0x6e46('0x5'),'as':_0x6e46('0x6'),'attributes':['id',_0x6e46('0x3'),_0x6e46('0x7'),_0x6e46('0x8')]}]},'log':'getWhatsappQueues'});};};
\ No newline at end of file
+var _0xd6e6=['strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0xd6e6,0x118));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x6d6e('0x0'));exports[_0x6d6e('0x1')]=function(){return function(){return client[_0x6d6e('0x2')](_0x6d6e('0x3'),{'options':{'raw':![],'attributes':['id',_0x6d6e('0x4'),_0x6d6e('0x5'),_0x6d6e('0x6')],'include':[{'model':_0x6d6e('0x7'),'as':_0x6d6e('0x8'),'attributes':['id',_0x6d6e('0x4'),_0x6d6e('0x9'),_0x6d6e('0xa')]}]},'log':_0x6d6e('0x1')});};};
\ No newline at end of file
index 291ff78..b459147 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa6b1=['UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xa6b1,0x10b));var _0x1a6b=function(_0x55448f,_0xa2cd4f){_0x55448f=_0x55448f-0x0;var _0x353910=_0xa6b1[_0x55448f];return _0x353910;};'use strict';var client=require('../client');exports[_0x1a6b('0x0')]=function(_0x2ccc2f){return client[_0x1a6b('0x1')]('CreateWhatsappQueueReport',{'body':_0x2ccc2f,'log':_0x1a6b('0x2')});};exports['update']=function(_0x459593,_0xb2d8b1){return client[_0x1a6b('0x1')](_0x1a6b('0x3'),{'body':_0xb2d8b1,'options':{'where':{'uniqueid':_0x459593},'order':[['id',_0x1a6b('0x4')]],'limit':0x1},'log':_0x1a6b('0x3')});};
\ No newline at end of file
+var _0x37b3=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x9af22c,_0x59a592){var _0x1d65ce=function(_0x25df2d){while(--_0x25df2d){_0x9af22c['push'](_0x9af22c['shift']());}};_0x1d65ce(++_0x59a592);}(_0x37b3,0x1d4));var _0x337b=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x37b3[_0x50e593];return _0x3821d0;};'use strict';var client=require(_0x337b('0x0'));exports[_0x337b('0x1')]=function(_0x58ba21){return client[_0x337b('0x2')](_0x337b('0x3'),{'body':_0x58ba21,'log':'CreateWhatsappQueueReport'});};exports[_0x337b('0x4')]=function(_0x543ad8,_0x4c9778){return client[_0x337b('0x2')](_0x337b('0x5'),{'body':_0x4c9778,'options':{'where':{'uniqueid':_0x543ad8},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});};
\ No newline at end of file
index 56671d1..4d14586 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ab7=['length','error','map','message','join','find','agents','createQueue','atimeout','channel','START:%s','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x2d91b5,_0x57e992){var _0x955dfc=function(_0x15f920){while(--_0x15f920){_0x2d91b5['push'](_0x2d91b5['shift']());}};_0x955dfc(++_0x57e992);}(_0x0ab7,0x10e));var _0x70ab=function(_0x55cf11,_0x294992){_0x55cf11=_0x55cf11-0x0;var _0x149e48=_0x0ab7[_0x55cf11];return _0x149e48;};'use strict';var schema=require(_0x70ab('0x0'));var _=require('lodash');var util=require(_0x70ab('0x1'));var seqqueue=require(_0x70ab('0x2'));var logger=require('../../../../config/logger')(_0x70ab('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x70ab('0x4')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xe3630e,_0x409f66,_0x4caf0){return logger['info'](util['format'](_0x70ab('0x5'),_0xe3630e,_0x409f66[_0x70ab('0x6')],_0x4caf0));}function handleFindAgent(_0x222ac5){return function(_0x4b0a28){return _0x4b0a28[_0x70ab('0x6')][_0x70ab('0x7')]()===_0x222ac5[_0x70ab('0x7')]();};}exports[_0x70ab('0x8')]=function(_0x595cb4,_0x1e711d,_0x7cdf2d,_0x59873c){return function(_0x513c48){try{var _0x52fda5={'name':_0x1e711d[0x0],'timeout':_0x1e711d[0x1]};var _0xc2740e=queue['validate'](_0x52fda5,{'typecast':!![]});if(_0xc2740e[_0x70ab('0x9')]){logger[_0x70ab('0xa')]('[%s][AGENT]\x20%s',_0x595cb4,_[_0x70ab('0xb')](_0xc2740e,_0x70ab('0xc'))[_0x70ab('0xd')](',\x20'));_0x513c48['stop']();}else{var _0x58df90=_[_0x70ab('0xe')](_0x7cdf2d[_0x70ab('0xf')],handleFindAgent(_0x52fda5[_0x70ab('0x6')]));if(_0x58df90){var _0x3271ff=(_0x52fda5['timeout']||0xa)*0x3e8;var _0x51bb2c,_0x5c6de3;var _0x21daac=seqqueue[_0x70ab('0x10')](_0x3271ff);_0x21daac['id']=_0x595cb4;_0x21daac[_0x70ab('0x11')]=_0x3271ff;_0x21daac[_0x70ab('0x12')]=_0x59873c['channel'];writeLog(_0x595cb4,_0x58df90,util['format'](_0x70ab('0x13'),_0x3271ff));_0x7cdf2d['rules'][_0x595cb4]['on'](_0x70ab('0x14'),function(){logger[_0x70ab('0x15')](_0x70ab('0x16'),_0x595cb4);clearTimeout(_0x5c6de3);_0x5c6de3=undefined;_0x21daac[_0x70ab('0x17')]();if(_0x7cdf2d[_0x70ab('0x18')][_0x595cb4]){delete _0x7cdf2d[_0x70ab('0x18')][_0x595cb4];}_0x513c48[_0x70ab('0x19')]();});_0x7cdf2d['rules'][_0x595cb4]['on']('complete',function(){if(_0x7cdf2d['rules'][_0x595cb4]){delete _0x7cdf2d['rules'][_0x595cb4];}});_0x5c6de3=setTimeout(function(){logger[_0x70ab('0x15')](_0x70ab('0x1a'),_0x595cb4);clearTimeout(_0x5c6de3);_0x21daac[_0x70ab('0x17')]();_0x513c48[_0x70ab('0x1b')]();},_0x3271ff);strategy[_0x70ab('0x1c')](_0x21daac,_0x58df90,_0x7cdf2d,_0x59873c);}else{logger[_0x70ab('0xa')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x595cb4,_0x52fda5[_0x70ab('0x6')]);_0x513c48[_0x70ab('0x19')]();}}}catch(_0x4215fe){console['log'](_0x4215fe);logger[_0x70ab('0xa')](_0x70ab('0x1d'),_0x595cb4,_0x4215fe[_0x70ab('0x1e')]);_0x513c48['stop']();}};};
\ No newline at end of file
+var _0xd07f=['map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','rules','end','close','complete','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s'];(function(_0x368f58,_0xcabf62){var _0x2af140=function(_0x44100e){while(--_0x44100e){_0x368f58['push'](_0x368f58['shift']());}};_0x2af140(++_0xcabf62);}(_0xd07f,0x17d));var _0xfd07=function(_0x1b03fe,_0x3572b1){_0x1b03fe=_0x1b03fe-0x0;var _0x5b0d40=_0xd07f[_0x1b03fe];return _0x5b0d40;};'use strict';var schema=require(_0xfd07('0x0'));var _=require(_0xfd07('0x1'));var util=require(_0xfd07('0x2'));var seqqueue=require(_0xfd07('0x3'));var logger=require(_0xfd07('0x4'))(_0xfd07('0x5'));var strategy=require(_0xfd07('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfd07('0x7'),'message':_0xfd07('0x8')}});function writeLog(_0x5baf6f,_0x54a6f8,_0x3a686b){return logger[_0xfd07('0x9')](util['format'](_0xfd07('0xa'),_0x5baf6f,_0x54a6f8[_0xfd07('0xb')],_0x3a686b));}function handleFindAgent(_0x1a8708){return function(_0x5d1ed8){return _0x5d1ed8['name'][_0xfd07('0xc')]()===_0x1a8708[_0xfd07('0xc')]();};}exports[_0xfd07('0xd')]=function(_0x4eee14,_0x1a4671,_0x525577,_0x180c54){return function(_0x591dc8){try{var _0x57a07b={'name':_0x1a4671[0x0],'timeout':_0x1a4671[0x1]};var _0x58d860=queue['validate'](_0x57a07b,{'typecast':!![]});if(_0x58d860['length']){logger['error'](_0xfd07('0xe'),_0x4eee14,_[_0xfd07('0xf')](_0x58d860,_0xfd07('0x10'))[_0xfd07('0x11')](',\x20'));_0x591dc8[_0xfd07('0x12')]();}else{var _0x929556=_[_0xfd07('0x13')](_0x525577[_0xfd07('0x14')],handleFindAgent(_0x57a07b[_0xfd07('0xb')]));if(_0x929556){var _0x1b0443=(_0x57a07b[_0xfd07('0x15')]||0xa)*0x3e8;var _0x2bf99e,_0x419d8d;var _0x45fbaa=seqqueue[_0xfd07('0x16')](_0x1b0443);_0x45fbaa['id']=_0x4eee14;_0x45fbaa[_0xfd07('0x17')]=_0x1b0443;_0x45fbaa[_0xfd07('0x18')]=_0x180c54['channel'];writeLog(_0x4eee14,_0x929556,util[_0xfd07('0x19')]('START:%s',_0x1b0443));_0x525577[_0xfd07('0x1a')][_0x4eee14]['on'](_0xfd07('0x1b'),function(){logger[_0xfd07('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4eee14);clearTimeout(_0x419d8d);_0x419d8d=undefined;_0x45fbaa[_0xfd07('0x1c')]();if(_0x525577[_0xfd07('0x1a')][_0x4eee14]){delete _0x525577[_0xfd07('0x1a')][_0x4eee14];}_0x591dc8[_0xfd07('0x12')]();});_0x525577['rules'][_0x4eee14]['on'](_0xfd07('0x1d'),function(){if(_0x525577[_0xfd07('0x1a')][_0x4eee14]){delete _0x525577['rules'][_0x4eee14];}});_0x419d8d=setTimeout(function(){logger[_0xfd07('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x4eee14);clearTimeout(_0x419d8d);_0x45fbaa['close']();_0x591dc8['next']();},_0x1b0443);strategy[_0xfd07('0x1e')](_0x45fbaa,_0x929556,_0x525577,_0x180c54);}else{logger[_0xfd07('0x1f')](_0xfd07('0x20'),_0x4eee14,_0x57a07b['name']);_0x591dc8['stop']();}}}catch(_0x41f269){console[_0xfd07('0x21')](_0x41f269);logger[_0xfd07('0x1f')](_0xfd07('0x22'),_0x4eee14,_0x41f269[_0xfd07('0x23')]);_0x591dc8[_0xfd07('0x12')]();}};};
\ No newline at end of file
index 13cab2a..8ec7ea7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab16=['Message','create','then','info','stringify','finally','stop','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender'];(function(_0x2d138a,_0x38524c){var _0x1c13e9=function(_0x342d00){while(--_0x342d00){_0x2d138a['push'](_0x2d138a['shift']());}};_0x1c13e9(++_0x38524c);}(_0xab16,0xb9));var _0x6ab1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xab16[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6ab1('0x0'));var moment=require(_0x6ab1('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x6ab1('0x2'))(_0x6ab1('0x3'));var rpc={'chatMessage':require(_0x6ab1('0x4')),'openchannelMessage':require(_0x6ab1('0x5')),'mailMessage':require(_0x6ab1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2d1cc7,_0xc53e6d){return function(_0x25cbdf){try{if(!_['isNil'](this[_0x6ab1('0x7')][_0x6ab1('0x8')])){logger['info'](_0x6ab1('0x9'),_0x2d1cc7,_0x6ab1('0xa'));return _0x25cbdf[_0x6ab1('0xb')]();}var _0x459c22={'ContactId':this[_0x6ab1('0xc')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x6ab1('0xd')]===_0x6ab1('0xe')||this[_0x6ab1('0xd')]==='whatsapp'){_0x459c22[_0x6ab1('0xf')]=this['interaction'][_0x6ab1('0xf')];}var _0x7d0d15=this[_0x6ab1('0xd')];if(_0x7d0d15===_0x6ab1('0x10')){_0x459c22[_0x6ab1('0x11')]=this[_0x6ab1('0x12')]['id'];}else{_0x459c22[_[_0x6ab1('0x13')](_0x7d0d15)+_0x6ab1('0x14')]=this['account']['id'];}_0x459c22[_[_0x6ab1('0x13')](_0x7d0d15)+'InteractionId']=this[_0x6ab1('0x7')]['id'];if(this['interaction'][_0x6ab1('0x15')]){var _0x1d773e=_0xc53e6d[0x4];if(!_[_0x6ab1('0x16')](_0x1d773e)){_0x459c22[_0x6ab1('0x17')]=utils[_0x6ab1('0x18')](_0x1d773e,this);return rpc[_0x7d0d15+_0x6ab1('0x19')][_0x6ab1('0x1a')](_0x459c22)[_0x6ab1('0x1b')](function(_0x6f4601){logger[_0x6ab1('0x1c')](_0x6ab1('0x9'),_0x2d1cc7,_0x459c22[_0x6ab1('0x17')]);})['catch'](function(_0x5381bc){logger['error'](_0x6ab1('0x9'),_0x2d1cc7,JSON[_0x6ab1('0x1d')](_0x5381bc));})[_0x6ab1('0x1e')](function(){logger[_0x6ab1('0x1c')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2d1cc7);_0x25cbdf[_0x6ab1('0x1f')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2d1cc7);_0x25cbdf['stop']();}}else{var _0x1d4048=this;var _0x249237=new AWS['LexRuntime']({'accessKeyId':_0xc53e6d[0x0],'secretAccessKey':_0xc53e6d[0x1],'region':_0xc53e6d[0x2]});var _0x2f46ae={'botAlias':_0x6ab1('0x20'),'botName':_0xc53e6d[0x3],'inputText':this[_0x6ab1('0x21')][_0x6ab1('0x17')],'userId':this['channel']+':'+this[_0x6ab1('0x7')]['id'][_0x6ab1('0x22')]()};_0x249237[_0x6ab1('0x23')](_0x2f46ae,function(_0x3ba700,_0x11ce0f){if(_0x3ba700){logger[_0x6ab1('0x24')](_0x6ab1('0x9'),_0x2d1cc7,_0x3ba700[_0x6ab1('0x21')]);_0x25cbdf['next']();}else if(_0x11ce0f&&_0x11ce0f['message']){_0x1d4048[_0x6ab1('0x17')][_0x6ab1('0x25')]=_0x11ce0f;_0x459c22[_0x6ab1('0x17')]=_0x11ce0f[_0x6ab1('0x21')];_0x459c22[_0x6ab1('0x26')]=_0x6ab1('0x25');_0x459c22[_0x6ab1('0x27')]=JSON['stringify'](_0x11ce0f);return rpc[_0x7d0d15+_0x6ab1('0x19')]['create'](_0x459c22)[_0x6ab1('0x1b')](function(_0x44e0c0){logger[_0x6ab1('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x2d1cc7,_0x459c22[_0x6ab1('0x17')]);if(_0x11ce0f[_0x6ab1('0x28')]==_0x6ab1('0x29')){_0x25cbdf[_0x6ab1('0xb')]();}else{_0x25cbdf[_0x6ab1('0x1f')]();}})['catch'](function(_0x4e31dd){logger[_0x6ab1('0x24')]('[%s][AMAZONLEX]\x20%s',_0x2d1cc7,JSON[_0x6ab1('0x1d')](_0x4e31dd));_0x25cbdf[_0x6ab1('0xb')]();});}else{_0x25cbdf['next']();}});}}catch(_0x48633b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2d1cc7,JSON[_0x6ab1('0x1d')](_0x48633b));_0x25cbdf[_0x6ab1('0x1f')]();}};};
\ No newline at end of file
+var _0xc57d=['out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerResponse','dialogState','Failed','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5b202f,_0x1bfb11){var _0x2743e5=function(_0x552223){while(--_0x552223){_0x5b202f['push'](_0x5b202f['shift']());}};_0x2743e5(++_0x1bfb11);}(_0xc57d,0x15a));var _0xdc57=function(_0x3f3bd5,_0x12f6b0){_0x3f3bd5=_0x3f3bd5-0x0;var _0x24b04c=_0xc57d[_0x3f3bd5];return _0x24b04c;};'use strict';var _=require(_0xdc57('0x0'));var moment=require(_0xdc57('0x1'));var AWS=require('aws-sdk');var utils=require(_0xdc57('0x2'));var logger=require('../../../../config/logger')(_0xdc57('0x3'));var rpc={'chatMessage':require(_0xdc57('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdc57('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdc57('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdc57('0x7')]=function(_0x3f5e08,_0x2e7553){return function(_0x13606d){try{if(!_[_0xdc57('0x8')](this[_0xdc57('0x9')]['UserId'])){logger[_0xdc57('0xa')](_0xdc57('0xb'),_0x3f5e08,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x13606d['next']();}var _0x5305e4={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdc57('0xc')](_0xdc57('0xd')),'direction':_0xdc57('0xe')};if(this[_0xdc57('0xf')]===_0xdc57('0x10')||this[_0xdc57('0xf')]==='whatsapp'){_0x5305e4['phone']=this[_0xdc57('0x9')][_0xdc57('0x11')];}var _0x44420e=this[_0xdc57('0xf')];if(_0x44420e===_0xdc57('0x12')){_0x5305e4[_0xdc57('0x13')]=this[_0xdc57('0x14')]['id'];}else{_0x5305e4[_[_0xdc57('0x15')](_0x44420e)+_0xdc57('0x16')]=this[_0xdc57('0x14')]['id'];}_0x5305e4[_[_0xdc57('0x15')](_0x44420e)+_0xdc57('0x17')]=this[_0xdc57('0x9')]['id'];if(this[_0xdc57('0x9')]['created']){var _0x6aae61=_0x2e7553[0x4];if(!_['isEmpty'](_0x6aae61)){_0x5305e4['body']=utils['getMustacheRender'](_0x6aae61,this);return rpc[_0x44420e+_0xdc57('0x18')][_0xdc57('0x19')](_0x5305e4)[_0xdc57('0x1a')](function(_0x4c5fba){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3f5e08,_0x5305e4[_0xdc57('0x1b')]);})[_0xdc57('0x1c')](function(_0x4ab37b){logger[_0xdc57('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3f5e08,JSON[_0xdc57('0x1e')](_0x4ab37b));})[_0xdc57('0x1f')](function(){logger[_0xdc57('0xa')](_0xdc57('0x20'),_0x3f5e08);_0x13606d[_0xdc57('0x21')]();});}else{logger['info'](_0xdc57('0x22'),_0x3f5e08);_0x13606d[_0xdc57('0x21')]();}}else{var _0x1bc138=this;var _0x363d7c=new AWS[(_0xdc57('0x23'))]({'accessKeyId':_0x2e7553[0x0],'secretAccessKey':_0x2e7553[0x1],'region':_0x2e7553[0x2]});var _0x640ddb={'botAlias':_0xdc57('0x24'),'botName':_0x2e7553[0x3],'inputText':this[_0xdc57('0x25')][_0xdc57('0x1b')],'userId':this['channel']+':'+this[_0xdc57('0x9')]['id'][_0xdc57('0x26')]()};_0x363d7c[_0xdc57('0x27')](_0x640ddb,function(_0x5d0ee1,_0x3e6376){if(_0x5d0ee1){logger[_0xdc57('0x1d')](_0xdc57('0xb'),_0x3f5e08,_0x5d0ee1['message']);_0x13606d[_0xdc57('0x28')]();}else if(_0x3e6376&&_0x3e6376['message']){_0x1bc138['body'][_0xdc57('0x29')]=_0x3e6376;_0x5305e4[_0xdc57('0x1b')]=_0x3e6376[_0xdc57('0x25')];_0x5305e4['providerName']=_0xdc57('0x29');_0x5305e4[_0xdc57('0x2a')]=JSON[_0xdc57('0x1e')](_0x3e6376);return rpc[_0x44420e+_0xdc57('0x18')][_0xdc57('0x19')](_0x5305e4)[_0xdc57('0x1a')](function(_0x29a8a2){logger[_0xdc57('0xa')](_0xdc57('0xb'),_0x3f5e08,_0x5305e4[_0xdc57('0x1b')]);if(_0x3e6376[_0xdc57('0x2b')]==_0xdc57('0x2c')){_0x13606d[_0xdc57('0x28')]();}else{_0x13606d[_0xdc57('0x21')]();}})[_0xdc57('0x1c')](function(_0x93a735){logger[_0xdc57('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3f5e08,JSON[_0xdc57('0x1e')](_0x93a735));_0x13606d[_0xdc57('0x28')]();});}else{_0x13606d['next']();}});}}catch(_0x3c2756){logger[_0xdc57('0x1d')](_0xdc57('0xb'),_0x3f5e08,JSON['stringify'](_0x3c2756));_0x13606d['stop']();}};};
\ No newline at end of file
index 1434357..a8f1386 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x149f=['autoreplyExecuted','info','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','inReplyTo','messageId','html','replace','<div\x20id=\x22xm-mail-content\x22','<div','</div>','auto-replied','All','auto_reply','sendMailMessage','account','smtpOptions','then','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','channel','mail','body','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent'];(function(_0x5c1d0e,_0x19fcac){var _0x339984=function(_0xcda02){while(--_0xcda02){_0x5c1d0e['push'](_0x5c1d0e['shift']());}};_0x339984(++_0x19fcac);}(_0x149f,0x73));var _0xf149=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x149f[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var moment=require(_0xf149('0x0'));var utils=require('./utils');var logger=require(_0xf149('0x1'))(_0xf149('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf149('0x3')),'mailMessage':require(_0xf149('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf149('0x5')),'whatsappMessage':require(_0xf149('0x6')),'chatInteraction':require(_0xf149('0x7')),'openchannelInteraction':require(_0xf149('0x8')),'mailInteraction':require(_0xf149('0x9')),'smsInteraction':require(_0xf149('0xa')),'faxInteraction':require(_0xf149('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x432c47,_0x366dc2,_0x4d0508,_0x4dc88d){return function(_0x34e7b9){try{var _0x2730a8=this[_0xf149('0xc')];if(_0x2730a8===_0xf149('0xd')&&_0x4dc88d[_0xf149('0xe')]['isAutoreply']){logger['info'](_0xf149('0xf'),_0x432c47,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x34e7b9[_0xf149('0x10')]();}if(_0x366dc2[0x0]==='1'&&(_[_0xf149('0x11')](this[_0xf149('0x12')][_0xf149('0x13')])||!this[_0xf149('0x12')][_0xf149('0x13')])){logger['info'](_0xf149('0xf'),_0x432c47,_0xf149('0x14'));return _0x34e7b9['next']();}if(_0x366dc2[0x0]==='2'&&this[_0xf149('0x12')][_0xf149('0x15')]){logger[_0xf149('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x432c47,_0xf149('0x17'));return _0x34e7b9['next']();}var _0x2590bf={'ContactId':this[_0xf149('0x18')]['id'],'sentAt':moment()[_0xf149('0x19')](_0xf149('0x1a')),'direction':_0xf149('0x1b')};if(this[_0xf149('0xc')]===_0xf149('0xd')){_0x2590bf[_0xf149('0xe')]=utils[_0xf149('0x1c')](_0x366dc2[0x2],this);}else{_0x2590bf[_0xf149('0xe')]=utils[_0xf149('0x1c')](_0x366dc2[0x1],this);}if(this[_0xf149('0x1d')]){_0x2590bf['to']=this[_0xf149('0x1d')][_0xf149('0x1e')]||'';if(this[_0xf149('0xc')]===_0xf149('0xd')&&_0x366dc2[0x1]==='1'){_0x2590bf['cc']=this[_0xf149('0x1d')]['cc']||'';}_0x2590bf[_0xf149('0x1e')]=this[_0xf149('0x1d')]['to']||'';_0x2590bf['phone']=this[_0xf149('0x1d')][_0xf149('0x1f')]||'';_0x2590bf[_0xf149('0x20')]=!![];if(this[_0xf149('0x1d')][_0xf149('0x21')]){_0x2590bf[_0xf149('0x21')]='';_0x2590bf[_0xf149('0x21')]+=_[_0xf149('0x22')](this[_0xf149('0x1d')][_0xf149('0x21')],'Re:')?'':_0xf149('0x23');_0x2590bf['subject']+=this['message']['subject'];}}if(this[_0xf149('0xc')]===_0xf149('0x24')){_0x2590bf[_0xf149('0x25')]=this['account']['id'];}else{_0x2590bf[_[_0xf149('0x26')](this['channel'])+_0xf149('0x27')]=this['account']['id'];}_0x2590bf[_[_0xf149('0x26')](this['channel'])+_0xf149('0x28')]=this[_0xf149('0x12')]['id'];var _0x2f4a82=this[_0xf149('0x12')];if(rpc[this[_0xf149('0xc')]+'Message']){if(this[_0xf149('0xc')]===_0xf149('0xd')){_0x2590bf[_0xf149('0x29')]=this[_0xf149('0x1d')][_0xf149('0x2a')];_0x2590bf[_0xf149('0x2b')]='<div\x20id=\x22xm-mail-content\x22>'+_[_0xf149('0x2c')](_0x2590bf[_0xf149('0xe')],_0xf149('0x2d'),_0xf149('0x2e'))+_0xf149('0x2f');_0x2590bf['headers']={'Auto-Submitted':_0xf149('0x30'),'X-Auto-Response-Suppress':_0xf149('0x31'),'Precedence':_0xf149('0x32')};return mailRpc[_0xf149('0x33')](this[_0xf149('0x34')][_0xf149('0x35')],_0x2590bf)[_0xf149('0x36')](function(_0x5d19ff){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x432c47);_0x2590bf[_0xf149('0x2a')]=_0x5d19ff[_0xf149('0x1d')][_0xf149('0x2a')];return rpc[_0x2730a8+_0xf149('0x37')][_0xf149('0x38')](_0x2590bf);})[_0xf149('0x36')](function(_0x265e94){logger[_0xf149('0x16')](_0xf149('0xf'),_0x432c47,JSON[_0xf149('0x39')](_0x265e94));})[_0xf149('0x3a')](function(_0x309068){logger[_0xf149('0x3b')](_0xf149('0x3c'),_0x432c47,JSON['stringify'](_0x309068));})[_0xf149('0x3d')](function(){Promise[_0xf149('0x3e')]()[_0xf149('0x36')](function(){if(_0x366dc2[0x0]!=='2'||_0x2f4a82[_0xf149('0x15')])return;return rpc[_0x2730a8+_0xf149('0x3f')][_0xf149('0x40')](_0x2f4a82['id'],{'autoreplyExecuted':!![]})[_0xf149('0x36')](function(_0xfbe0f8){logger['info'](_0xf149('0x41'),_0x432c47,JSON['stringify'](_0xfbe0f8));})['catch'](function(_0x2ccf10){logger['error'](_0xf149('0x42'),_0x432c47,JSON['stringify'](_0x2ccf10));});})['then'](function(){_0x34e7b9[_0xf149('0x10')]();});});}else{return rpc[this[_0xf149('0xc')]+'Message'][_0xf149('0x38')](_0x2590bf)[_0xf149('0x36')](function(){logger[_0xf149('0x16')]('[%s][AUTOREPLY]\x20%s',_0x432c47,_0x2590bf[_0xf149('0xe')]);})[_0xf149('0x3a')](function(_0x13f055){logger[_0xf149('0x3b')]('[%s][AUTOREPLY]\x20%s',_0x432c47,JSON[_0xf149('0x39')](_0x13f055));})[_0xf149('0x3d')](function(){Promise['resolve']()['then'](function(){if(_0x366dc2[0x0]!=='2'||_0x2f4a82[_0xf149('0x15')])return;return rpc[_0x2730a8+_0xf149('0x3f')]['update'](_0x2f4a82['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5e9ce8){logger[_0xf149('0x16')](_0xf149('0x41'),_0x432c47,JSON[_0xf149('0x39')](_0x5e9ce8));})[_0xf149('0x3a')](function(_0x4e1ae9){logger[_0xf149('0x3b')](_0xf149('0x42'),_0x432c47,JSON[_0xf149('0x39')](_0x4e1ae9));});})[_0xf149('0x36')](function(){_0x34e7b9[_0xf149('0x10')]();});});}}}catch(_0x5c358f){logger[_0xf149('0x3b')](_0xf149('0xf'),_0x432c47,JSON['stringify'](_0x5c358f));_0x34e7b9[_0xf149('0x43')]();}};};
\ No newline at end of file
+var _0x1b3d=['info','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','messageId','replace','<div\x20id=\x22xm-mail-content\x22','<div','headers','auto-replied','All','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x1b3d,0x131));var _0xd1b3=function(_0x271e26,_0x90bd68){_0x271e26=_0x271e26-0x0;var _0x2af7ef=_0x1b3d[_0x271e26];return _0x2af7ef;};'use strict';var _=require(_0xd1b3('0x0'));var moment=require(_0xd1b3('0x1'));var utils=require(_0xd1b3('0x2'));var logger=require(_0xd1b3('0x3'))(_0xd1b3('0x4'));var rpc={'chatMessage':require(_0xd1b3('0x5')),'openchannelMessage':require(_0xd1b3('0x6')),'mailMessage':require(_0xd1b3('0x7')),'smsMessage':require(_0xd1b3('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd1b3('0x9')),'chatInteraction':require(_0xd1b3('0xa')),'openchannelInteraction':require(_0xd1b3('0xb')),'mailInteraction':require(_0xd1b3('0xc')),'smsInteraction':require(_0xd1b3('0xd')),'faxInteraction':require(_0xd1b3('0xe')),'whatsappInteraction':require(_0xd1b3('0xf'))};var mailRpc=require(_0xd1b3('0x10'));exports['consequence']=function(_0x1bf4e0,_0x1c2a55,_0x44a3c8,_0x266f2b){return function(_0x8022e1){try{var _0x133aa1=this[_0xd1b3('0x11')];if(_0x133aa1===_0xd1b3('0x12')&&_0x266f2b[_0xd1b3('0x13')]['isAutoreply']){logger['info'](_0xd1b3('0x14'),_0x1bf4e0,_0xd1b3('0x15'));return _0x8022e1[_0xd1b3('0x16')]();}if(_0x1c2a55[0x0]==='1'&&(_[_0xd1b3('0x17')](this['interaction']['created'])||!this['interaction'][_0xd1b3('0x18')])){logger[_0xd1b3('0x19')](_0xd1b3('0x14'),_0x1bf4e0,'Autoreply\x20already\x20sent');return _0x8022e1[_0xd1b3('0x16')]();}if(_0x1c2a55[0x0]==='2'&&this[_0xd1b3('0x1a')][_0xd1b3('0x1b')]){logger[_0xd1b3('0x19')](_0xd1b3('0x1c'),_0x1bf4e0,'One\x20Time\x20already\x20sent');return _0x8022e1[_0xd1b3('0x16')]();}var _0x1eec15={'ContactId':this[_0xd1b3('0x1d')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd1b3('0x1e')};if(this[_0xd1b3('0x11')]===_0xd1b3('0x12')){_0x1eec15[_0xd1b3('0x13')]=utils['getMustacheRender'](_0x1c2a55[0x2],this);}else{_0x1eec15[_0xd1b3('0x13')]=utils[_0xd1b3('0x1f')](_0x1c2a55[0x1],this);}if(this[_0xd1b3('0x20')]){_0x1eec15['to']=this[_0xd1b3('0x20')][_0xd1b3('0x21')]||'';if(this[_0xd1b3('0x11')]===_0xd1b3('0x12')&&_0x1c2a55[0x1]==='1'){_0x1eec15['cc']=this[_0xd1b3('0x20')]['cc']||'';}_0x1eec15[_0xd1b3('0x21')]=this['message']['to']||'';_0x1eec15[_0xd1b3('0x22')]=this[_0xd1b3('0x20')]['phone']||'';_0x1eec15['read']=!![];if(this[_0xd1b3('0x20')]['subject']){_0x1eec15['subject']='';_0x1eec15[_0xd1b3('0x23')]+=_[_0xd1b3('0x24')](this['message']['subject'],_0xd1b3('0x25'))?'':_0xd1b3('0x26');_0x1eec15[_0xd1b3('0x23')]+=this['message'][_0xd1b3('0x23')];}}if(this['channel']===_0xd1b3('0x27')){_0x1eec15[_0xd1b3('0x28')]=this[_0xd1b3('0x29')]['id'];}else{_0x1eec15[_[_0xd1b3('0x2a')](this[_0xd1b3('0x11')])+_0xd1b3('0x2b')]=this[_0xd1b3('0x29')]['id'];}_0x1eec15[_[_0xd1b3('0x2a')](this[_0xd1b3('0x11')])+'InteractionId']=this[_0xd1b3('0x1a')]['id'];var _0x5e2e60=this[_0xd1b3('0x1a')];if(rpc[this[_0xd1b3('0x11')]+'Message']){if(this[_0xd1b3('0x11')]===_0xd1b3('0x12')){_0x1eec15['inReplyTo']=this[_0xd1b3('0x20')][_0xd1b3('0x2c')];_0x1eec15['html']='<div\x20id=\x22xm-mail-content\x22>'+_[_0xd1b3('0x2d')](_0x1eec15[_0xd1b3('0x13')],_0xd1b3('0x2e'),_0xd1b3('0x2f'))+'</div>';_0x1eec15[_0xd1b3('0x30')]={'Auto-Submitted':_0xd1b3('0x31'),'X-Auto-Response-Suppress':_0xd1b3('0x32'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0xd1b3('0x29')][_0xd1b3('0x33')],_0x1eec15)['then'](function(_0x28aae7){logger[_0xd1b3('0x19')](_0xd1b3('0x34'),_0x1bf4e0);_0x1eec15[_0xd1b3('0x2c')]=_0x28aae7[_0xd1b3('0x20')][_0xd1b3('0x2c')];return rpc[_0x133aa1+_0xd1b3('0x35')][_0xd1b3('0x36')](_0x1eec15);})[_0xd1b3('0x37')](function(_0x12bd01){logger[_0xd1b3('0x19')](_0xd1b3('0x14'),_0x1bf4e0,JSON[_0xd1b3('0x38')](_0x12bd01));})[_0xd1b3('0x39')](function(_0x567af7){logger[_0xd1b3('0x3a')](_0xd1b3('0x3b'),_0x1bf4e0,JSON['stringify'](_0x567af7));})[_0xd1b3('0x3c')](function(){Promise['resolve']()[_0xd1b3('0x37')](function(){if(_0x1c2a55[0x0]!=='2'||_0x5e2e60[_0xd1b3('0x1b')])return;return rpc[_0x133aa1+'Interaction'][_0xd1b3('0x3d')](_0x5e2e60['id'],{'autoreplyExecuted':!![]})[_0xd1b3('0x37')](function(_0x41a386){logger[_0xd1b3('0x19')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1bf4e0,JSON[_0xd1b3('0x38')](_0x41a386));})[_0xd1b3('0x39')](function(_0x552930){logger[_0xd1b3('0x3a')](_0xd1b3('0x3e'),_0x1bf4e0,JSON['stringify'](_0x552930));});})[_0xd1b3('0x37')](function(){_0x8022e1[_0xd1b3('0x16')]();});});}else{return rpc[this[_0xd1b3('0x11')]+_0xd1b3('0x35')][_0xd1b3('0x36')](_0x1eec15)['then'](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1bf4e0,_0x1eec15[_0xd1b3('0x13')]);})['catch'](function(_0x21ee09){logger['error'](_0xd1b3('0x14'),_0x1bf4e0,JSON[_0xd1b3('0x38')](_0x21ee09));})[_0xd1b3('0x3c')](function(){Promise[_0xd1b3('0x3f')]()['then'](function(){if(_0x1c2a55[0x0]!=='2'||_0x5e2e60['autoreplyExecuted'])return;return rpc[_0x133aa1+_0xd1b3('0x40')][_0xd1b3('0x3d')](_0x5e2e60['id'],{'autoreplyExecuted':!![]})[_0xd1b3('0x37')](function(_0x3d552b){logger[_0xd1b3('0x19')](_0xd1b3('0x1c'),_0x1bf4e0,JSON[_0xd1b3('0x38')](_0x3d552b));})[_0xd1b3('0x39')](function(_0x54e40e){logger[_0xd1b3('0x3a')](_0xd1b3('0x3e'),_0x1bf4e0,JSON['stringify'](_0x54e40e));});})[_0xd1b3('0x37')](function(){_0x8022e1['next']();});});}}}catch(_0x41e152){logger[_0xd1b3('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x1bf4e0,JSON[_0xd1b3('0x38')](_0x41e152));_0x8022e1[_0xd1b3('0x41')]();}};};
\ No newline at end of file
index d4cda05..387a0f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4db=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x7d1dce,_0x1e6764){var _0x5638e8=function(_0x3566e2){while(--_0x3566e2){_0x7d1dce['push'](_0x7d1dce['shift']());}};_0x5638e8(++_0x1e6764);}(_0xa4db,0xd4));var _0xba4d=function(_0x3b1763,_0x1e3af6){_0x3b1763=_0x3b1763-0x0;var _0x25f39d=_0xa4db[_0x3b1763];return _0x25f39d;};'use strict';var moment=require(_0xba4d('0x0'));var logger=require(_0xba4d('0x1'))(_0xba4d('0x2'));var rpc={'chatInteraction':require(_0xba4d('0x3')),'openchannelInteraction':require(_0xba4d('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xba4d('0x5')),'faxInteraction':require(_0xba4d('0x6')),'whatsappInteraction':require(_0xba4d('0x7'))};exports[_0xba4d('0x8')]=function(_0x5a69c5,_0x1378c2,_0x3b8cc9,_0x394091){return function(_0x3e7612){try{logger[_0xba4d('0x9')](_0xba4d('0xa'),_0x5a69c5,_0x1378c2[0x0]);var _0x562760={'closed':0x1,'closedAt':moment()['format'](_0xba4d('0xb')),'closeReason':_0xba4d('0xc'),'disposition':_0x1378c2[0x0]};if(rpc[_0x394091[_0xba4d('0xd')]+_0xba4d('0xe')]){rpc[_0x394091['channel']+_0xba4d('0xe')][_0xba4d('0xf')](_0x394091[_0xba4d('0x10')]['id'],_0x562760)[_0xba4d('0x11')](function(_0x3e5576){logger[_0xba4d('0x9')](_0xba4d('0x12'),_0x5a69c5,_0x394091[_0xba4d('0x10')]['id']);})[_0xba4d('0x13')](function(_0x14caa4){logger['error']('[%s][CLOSE]\x20%s',_0x5a69c5,JSON[_0xba4d('0x14')](_0x14caa4));})[_0xba4d('0x15')](function(){_0x3e7612[_0xba4d('0x16')]();});}}catch(_0x5abde0){logger[_0xba4d('0x17')]('[%s][CLOSE]\x20%s',_0x5a69c5,JSON[_0xba4d('0x14')](_0x5abde0));_0x3e7612[_0xba4d('0x16')]();}};};
\ No newline at end of file
+var _0x19f5=['../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','stop','moment'];(function(_0x95381d,_0x11c0bd){var _0x44682b=function(_0x58ed5b){while(--_0x58ed5b){_0x95381d['push'](_0x95381d['shift']());}};_0x44682b(++_0x11c0bd);}(_0x19f5,0x92));var _0x519f=function(_0x24bc51,_0x1d0c76){_0x24bc51=_0x24bc51-0x0;var _0x395f3a=_0x19f5[_0x24bc51];return _0x395f3a;};'use strict';var moment=require(_0x519f('0x0'));var logger=require(_0x519f('0x1'))(_0x519f('0x2'));var rpc={'chatInteraction':require(_0x519f('0x3')),'openchannelInteraction':require(_0x519f('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x519f('0x5')),'faxInteraction':require(_0x519f('0x6')),'whatsappInteraction':require(_0x519f('0x7'))};exports[_0x519f('0x8')]=function(_0x3dee2a,_0x4579e2,_0x539686,_0x40d327){return function(_0x46c068){try{logger[_0x519f('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x3dee2a,_0x4579e2[0x0]);var _0x147d36={'closed':0x1,'closedAt':moment()['format'](_0x519f('0xa')),'closeReason':_0x519f('0xb'),'disposition':_0x4579e2[0x0]};if(rpc[_0x40d327[_0x519f('0xc')]+_0x519f('0xd')]){rpc[_0x40d327[_0x519f('0xc')]+'Interaction'][_0x519f('0xe')](_0x40d327[_0x519f('0xf')]['id'],_0x147d36)['then'](function(_0x4bc208){logger[_0x519f('0x9')](_0x519f('0x10'),_0x3dee2a,_0x40d327[_0x519f('0xf')]['id']);})['catch'](function(_0x283400){logger[_0x519f('0x11')](_0x519f('0x12'),_0x3dee2a,JSON[_0x519f('0x13')](_0x283400));})['finally'](function(){_0x46c068[_0x519f('0x14')]();});}}catch(_0x117497){logger[_0x519f('0x11')](_0x519f('0x12'),_0x3dee2a,JSON['stringify'](_0x117497));_0x46c068[_0x519f('0x14')]();}};};
\ No newline at end of file
index 400d4ef..0706c28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0eb2=['metadata','endConversation','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','Message','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment','speech','providerName','providerResponse'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0eb2,0x11c));var _0x20eb=function(_0x313bb5,_0x4e3dd2){_0x313bb5=_0x313bb5-0x0;var _0x24f886=_0x0eb2[_0x313bb5];return _0x24f886;};'use strict';var _=require(_0x20eb('0x0'));var moment=require('moment');var apiai=require(_0x20eb('0x1'));var md5=require(_0x20eb('0x2'));var utils=require(_0x20eb('0x3'));var logger=require(_0x20eb('0x4'))(_0x20eb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x20eb('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x20eb('0x7'))};exports[_0x20eb('0x8')]=function(_0x19940,_0x4a7e1a){return function(_0x3dfc09){try{if(!_[_0x20eb('0x9')](this[_0x20eb('0xa')][_0x20eb('0xb')])){logger[_0x20eb('0xc')](_0x20eb('0xd'),_0x19940,_0x20eb('0xe'));return _0x3dfc09[_0x20eb('0xf')]();}var _0x354645={'ContactId':this[_0x20eb('0x10')]['id'],'sentAt':moment()[_0x20eb('0x11')](_0x20eb('0x12')),'direction':_0x20eb('0x13')};if(this[_0x20eb('0x14')]==='sms'||this[_0x20eb('0x14')]==='whatsapp'){_0x354645[_0x20eb('0x15')]=this['interaction'][_0x20eb('0x15')];}var _0x438c90=this[_0x20eb('0x14')];if(_0x438c90===_0x20eb('0x16')){_0x354645[_0x20eb('0x17')]=this[_0x20eb('0x18')]['id'];}else{_0x354645[_[_0x20eb('0x19')](_0x438c90)+_0x20eb('0x1a')]=this[_0x20eb('0x18')]['id'];}_0x354645[_[_0x20eb('0x19')](_0x438c90)+_0x20eb('0x1b')]=this[_0x20eb('0xa')]['id'];if(this[_0x20eb('0xa')][_0x20eb('0x1c')]){var _0xc2c994=_0x4a7e1a[0x2];if(!_['isEmpty'](_0xc2c994)){_0x354645[_0x20eb('0x1d')]=utils['getMustacheRender'](_0xc2c994,this);return rpc[_0x438c90+_0x20eb('0x1e')][_0x20eb('0x1f')](_0x354645)[_0x20eb('0x20')](function(_0x3c083a){logger[_0x20eb('0xc')](_0x20eb('0xd'),_0x19940,_0x354645[_0x20eb('0x1d')]);})['catch'](function(_0x1a3089){logger[_0x20eb('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x19940,JSON[_0x20eb('0x22')](_0x1a3089));})[_0x20eb('0x23')](function(){logger['info'](_0x20eb('0x24'),_0x19940);_0x3dfc09[_0x20eb('0x25')]();});}else{logger[_0x20eb('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x19940);_0x3dfc09[_0x20eb('0x25')]();}}else{var _0x258a64=this;var _0x431f82=apiai(_0x4a7e1a[0x0],{'language':_0x4a7e1a[0x1]||'en'});return _0x431f82['textRequest'](this[_0x20eb('0x26')][_0x20eb('0x1d')],{'sessionId':md5(this[_0x20eb('0xa')]['id'])})['then'](function(_0x2a1b56){_0x258a64['body'][_0x20eb('0x27')]=_0x2a1b56;_0x354645[_0x20eb('0x1d')]=_0x2a1b56[_0x20eb('0x28')][_0x20eb('0x29')][_0x20eb('0x2a')];_0x354645[_0x20eb('0x2b')]=_0x20eb('0x27');_0x354645[_0x20eb('0x2c')]=JSON[_0x20eb('0x22')](_0x2a1b56);return rpc[_0x438c90+'Message'][_0x20eb('0x1f')](_0x354645)[_0x20eb('0x20')](function(_0x25a523){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x19940,_0x354645['body']);if(_0x2a1b56['result'][_0x20eb('0x2d')][_0x20eb('0x2e')]){_0x3dfc09['next']();}else{_0x3dfc09[_0x20eb('0x25')]();}})['catch'](function(_0x4547d6){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x19940,JSON[_0x20eb('0x22')](_0x4547d6));_0x3dfc09[_0x20eb('0xf')]();});})['catch'](function(_0x5abe40){logger[_0x20eb('0x21')](_0x20eb('0xd'),_0x19940,_0x5abe40['message']);_0x3dfc09[_0x20eb('0xf')]();});}}catch(_0x25a81e){logger['error'](_0x20eb('0xd'),_0x19940,JSON[_0x20eb('0x22')](_0x25a81e));_0x3dfc09['stop']();}};};
\ No newline at end of file
+var _0x5398=['Message','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','speech','providerName','dialogflow','providerResponse','create','result','metadata','endConversation','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body'];(function(_0x12266d,_0x2dbd6c){var _0x8094b1=function(_0x38a722){while(--_0x38a722){_0x12266d['push'](_0x12266d['shift']());}};_0x8094b1(++_0x2dbd6c);}(_0x5398,0xe2));var _0x8539=function(_0x36a533,_0x473150){_0x36a533=_0x36a533-0x0;var _0x32b706=_0x5398[_0x36a533];return _0x32b706;};'use strict';var _=require('lodash');var moment=require(_0x8539('0x0'));var apiai=require(_0x8539('0x1'));var md5=require(_0x8539('0x2'));var utils=require(_0x8539('0x3'));var logger=require(_0x8539('0x4'))(_0x8539('0x5'));var rpc={'chatMessage':require(_0x8539('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8539('0x7')),'faxMessage':require(_0x8539('0x8')),'whatsappMessage':require(_0x8539('0x9'))};exports[_0x8539('0xa')]=function(_0x28f25c,_0x30f2ab){return function(_0x47c5be){try{if(!_[_0x8539('0xb')](this[_0x8539('0xc')][_0x8539('0xd')])){logger[_0x8539('0xe')](_0x8539('0xf'),_0x28f25c,_0x8539('0x10'));return _0x47c5be[_0x8539('0x11')]();}var _0x7884e2={'ContactId':this[_0x8539('0x12')]['id'],'sentAt':moment()[_0x8539('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8539('0x14')};if(this[_0x8539('0x15')]===_0x8539('0x16')||this['channel']===_0x8539('0x17')){_0x7884e2[_0x8539('0x18')]=this[_0x8539('0xc')][_0x8539('0x18')];}var _0x58c68d=this['channel'];if(_0x58c68d===_0x8539('0x19')){_0x7884e2[_0x8539('0x1a')]=this[_0x8539('0x1b')]['id'];}else{_0x7884e2[_[_0x8539('0x1c')](_0x58c68d)+_0x8539('0x1d')]=this['account']['id'];}_0x7884e2[_['upperFirst'](_0x58c68d)+_0x8539('0x1e')]=this[_0x8539('0xc')]['id'];if(this[_0x8539('0xc')][_0x8539('0x1f')]){var _0x159008=_0x30f2ab[0x2];if(!_[_0x8539('0x20')](_0x159008)){_0x7884e2[_0x8539('0x21')]=utils['getMustacheRender'](_0x159008,this);return rpc[_0x58c68d+_0x8539('0x22')]['create'](_0x7884e2)['then'](function(_0x5883f6){logger[_0x8539('0xe')](_0x8539('0xf'),_0x28f25c,_0x7884e2[_0x8539('0x21')]);})[_0x8539('0x23')](function(_0x17e9bc){logger[_0x8539('0x24')](_0x8539('0xf'),_0x28f25c,JSON[_0x8539('0x25')](_0x17e9bc));})[_0x8539('0x26')](function(){logger[_0x8539('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28f25c);_0x47c5be[_0x8539('0x27')]();});}else{logger['info'](_0x8539('0x28'),_0x28f25c);_0x47c5be['stop']();}}else{var _0x14befc=this;var _0x59a14e=apiai(_0x30f2ab[0x0],{'language':_0x30f2ab[0x1]||'en'});return _0x59a14e[_0x8539('0x29')](this[_0x8539('0x2a')][_0x8539('0x21')],{'sessionId':md5(this[_0x8539('0xc')]['id'])})[_0x8539('0x2b')](function(_0x3a0711){_0x14befc[_0x8539('0x21')]['dialogflow']=_0x3a0711;_0x7884e2[_0x8539('0x21')]=_0x3a0711['result']['fulfillment'][_0x8539('0x2c')];_0x7884e2[_0x8539('0x2d')]=_0x8539('0x2e');_0x7884e2[_0x8539('0x2f')]=JSON['stringify'](_0x3a0711);return rpc[_0x58c68d+'Message'][_0x8539('0x30')](_0x7884e2)[_0x8539('0x2b')](function(_0x56c11d){logger[_0x8539('0xe')](_0x8539('0xf'),_0x28f25c,_0x7884e2[_0x8539('0x21')]);if(_0x3a0711[_0x8539('0x31')][_0x8539('0x32')][_0x8539('0x33')]){_0x47c5be[_0x8539('0x11')]();}else{_0x47c5be[_0x8539('0x27')]();}})[_0x8539('0x23')](function(_0xedb079){logger[_0x8539('0x24')](_0x8539('0xf'),_0x28f25c,JSON[_0x8539('0x25')](_0xedb079));_0x47c5be[_0x8539('0x11')]();});})['catch'](function(_0x7aae36){logger[_0x8539('0x24')](_0x8539('0xf'),_0x28f25c,_0x7aae36['message']);_0x47c5be[_0x8539('0x11')]();});}}catch(_0x1a5fc1){logger['error'](_0x8539('0xf'),_0x28f25c,JSON['stringify'](_0x1a5fc1));_0x47c5be[_0x8539('0x27')]();}};};
\ No newline at end of file
index 163dc58..82d6e06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa181=['stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerResponse','fulfillmentText','push','all','next','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error'];(function(_0x434ddc,_0x1f9e59){var _0x283bf5=function(_0x5df633){while(--_0x5df633){_0x434ddc['push'](_0x434ddc['shift']());}};_0x283bf5(++_0x1f9e59);}(_0xa181,0x10a));var _0x1a18=function(_0x2a370e,_0x4c23ae){_0x2a370e=_0x2a370e-0x0;var _0x56f03d=_0xa181[_0x2a370e];return _0x56f03d;};'use strict';var _=require(_0x1a18('0x0'));var dialogflow=require(_0x1a18('0x1'));var md5=require(_0x1a18('0x2'));var moment=require('moment');var Promise=require(_0x1a18('0x3'));var logger=require(_0x1a18('0x4'))(_0x1a18('0x5'));var utils=require(_0x1a18('0x6'));var rpc={'chatMessage':require(_0x1a18('0x7')),'openchannelMessage':require(_0x1a18('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1a18('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1a18('0xa'))};function createMessage(_0x33ac27,_0x34f730,_0x436a14,_0x49e0ab){return new Promise(function(_0x394289,_0x1acc97){var _0x25d440=_['clone'](_0x436a14);_0x25d440[_0x1a18('0xb')]=_0x49e0ab;return rpc[_0x34f730+_0x1a18('0xc')]['create'](_0x25d440)[_0x1a18('0xd')](function(){logger[_0x1a18('0xe')](_0x1a18('0xf'),_0x33ac27,_0x25d440[_0x1a18('0xb')]);_0x394289();})[_0x1a18('0x10')](function(_0x53c22c){logger[_0x1a18('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x33ac27,JSON[_0x1a18('0x12')](_0x53c22c));_0x1acc97(_0x53c22c);});});}exports[_0x1a18('0x13')]=function(_0x4ef94e,_0x12c34d){return function(_0x4ea0eb){try{if(!_[_0x1a18('0x14')](this[_0x1a18('0x15')]['UserId'])){logger[_0x1a18('0xe')](_0x1a18('0xf'),_0x4ef94e,_0x1a18('0x16'));return _0x4ea0eb['next']();}var _0x2785f6={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1a18('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1a18('0x18')};if(this['channel']===_0x1a18('0x19')||this['channel']===_0x1a18('0x1a')){_0x2785f6[_0x1a18('0x1b')]=this[_0x1a18('0x15')][_0x1a18('0x1b')];}var _0x47dd3e=this['channel'];if(_0x47dd3e==='chat'){_0x2785f6[_0x1a18('0x1c')]=this[_0x1a18('0x1d')]['id'];}else{_0x2785f6[_[_0x1a18('0x1e')](_0x47dd3e)+_0x1a18('0x1f')]=this[_0x1a18('0x1d')]['id'];}_0x2785f6[_[_0x1a18('0x1e')](_0x47dd3e)+'InteractionId']=this[_0x1a18('0x15')]['id'];if(this[_0x1a18('0x15')][_0x1a18('0x20')]){var _0x312669=_0x12c34d[0x4];if(!_[_0x1a18('0x21')](_0x312669)){_0x2785f6[_0x1a18('0xb')]=utils[_0x1a18('0x22')](_0x312669,this);return rpc[_0x47dd3e+_0x1a18('0xc')][_0x1a18('0x23')](_0x2785f6)[_0x1a18('0xd')](function(_0xb4a0b8){logger[_0x1a18('0xe')](_0x1a18('0xf'),_0x4ef94e,_0x2785f6[_0x1a18('0xb')]);})[_0x1a18('0x10')](function(_0x27932b){logger[_0x1a18('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x4ef94e,JSON[_0x1a18('0x12')](_0x27932b));})[_0x1a18('0x24')](function(){logger[_0x1a18('0xe')](_0x1a18('0x25'),_0x4ef94e);_0x4ea0eb[_0x1a18('0x26')]();});}else{logger[_0x1a18('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4ef94e);_0x4ea0eb[_0x1a18('0x26')]();}}else{var _0x36e016=this;var _0x11d1e3=_0x12c34d[0x2][_0x1a18('0x27')](/\\n/g,'\x0a');var _0x54f60e={'credentials':{'private_key':_0x11d1e3,'client_email':_0x12c34d[0x1]}};var _0x3ea0b7=new dialogflow[(_0x1a18('0x28'))](_0x54f60e);var _0x299277=_0x3ea0b7[_0x1a18('0x29')](_0x12c34d[0x0],md5(_0x36e016[_0x1a18('0x15')]['id']));var _0x855cca={'session':_0x299277,'queryInput':{'text':{'text':_0x36e016[_0x1a18('0x2a')][_0x1a18('0xb')],'languageCode':_0x12c34d[0x3]||'en'}}};return _0x3ea0b7[_0x1a18('0x2b')](_0x855cca)[_0x1a18('0xd')](function(_0x3b566e){if(_0x3b566e&&_0x3b566e[_0x1a18('0x2c')]){_0x36e016[_0x1a18('0xb')][_0x1a18('0x2d')]=_0x3b566e;var _0x337130=_0x3b566e[0x0];var _0x54b624=_0x337130[_0x1a18('0x2e')]['diagnosticInfo']&&_0x337130[_0x1a18('0x2e')][_0x1a18('0x2f')]['fields']?_0x337130['queryResult']['diagnosticInfo'][_0x1a18('0x30')][_0x1a18('0x31')][_0x1a18('0x32')]:![];_0x36e016[_0x1a18('0xb')][_0x1a18('0x33')]=_0x337130[_0x1a18('0x2e')][_0x1a18('0x34')];_0x36e016[_0x1a18('0xb')][_0x1a18('0x35')]=_0x337130[_0x1a18('0x2e')]['allRequiredParamsPresent'];_0x36e016['body'][_0x1a18('0x36')]=_0x337130[_0x1a18('0x2e')][_0x1a18('0x2f')]&&_0x337130[_0x1a18('0x2e')][_0x1a18('0x2f')]['fields']?_0x337130['queryResult'][_0x1a18('0x2f')][_0x1a18('0x30')][_0x1a18('0x31')][_0x1a18('0x32')]:![];_0x36e016['body'][_0x1a18('0x37')]=_0x337130[_0x1a18('0x2e')]['intent'][_0x1a18('0x38')];_0x36e016['body'][_0x1a18('0x39')]=_0x337130[_0x1a18('0x2e')][_0x1a18('0x3a')][_0x1a18('0x3b')];_0x36e016[_0x1a18('0xb')][_0x1a18('0x3c')]=_0x337130[_0x1a18('0x2e')][_0x1a18('0x3a')][_0x1a18('0x3d')];_0x36e016[_0x1a18('0xb')][_0x1a18('0x3e')]=_0x337130[_0x1a18('0x2e')][_0x1a18('0x3f')];_0x36e016[_0x1a18('0xb')][_0x1a18('0x40')]=_0x337130['queryResult']['queryText'];_0x36e016['body'][_0x1a18('0x41')]=_0x337130[_0x1a18('0x2e')]['intentDetectionConfidence'];_0x2785f6['providerName']=_0x1a18('0x2d');_0x2785f6[_0x1a18('0x42')]=JSON[_0x1a18('0x12')](_0x3b566e);var _0x5232f9=[];for(var _0x6a6f51=0x0;_0x6a6f51<_0x3b566e[_0x1a18('0x2c')];_0x6a6f51++){var _0x5300ca=_0x3b566e[_0x6a6f51];if(_0x5300ca&&_0x5300ca[_0x1a18('0x2e')]&&_0x5300ca['queryResult'][_0x1a18('0x43')]){_0x5232f9[_0x1a18('0x44')](createMessage(_0x4ef94e,_0x47dd3e,_0x2785f6,_0x5300ca[_0x1a18('0x2e')][_0x1a18('0x43')]));}}return Promise[_0x1a18('0x45')](_0x5232f9)[_0x1a18('0xd')](function(){if(_0x54b624){_0x4ea0eb[_0x1a18('0x46')]();}else{_0x4ea0eb['stop']();}})[_0x1a18('0x10')](function(_0x33d6e7){logger[_0x1a18('0x11')](_0x1a18('0xf'),_0x4ef94e,JSON[_0x1a18('0x12')](_0x33d6e7));_0x4ea0eb[_0x1a18('0x46')]();});}})['catch'](function(_0x124498){logger['error'](_0x1a18('0xf'),_0x4ef94e,_0x124498['message']);_0x4ea0eb[_0x1a18('0x46')]();});}}catch(_0x42a8c2){logger[_0x1a18('0x11')](_0x1a18('0xf'),_0x4ef94e,JSON[_0x1a18('0x12')](_0x42a8c2));_0x4ea0eb['stop']();}};};
\ No newline at end of file
+var _0xf181=['created','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction'];(function(_0x2238ad,_0x383e40){var _0x3cf544=function(_0x57e2c1){while(--_0x57e2c1){_0x2238ad['push'](_0x2238ad['shift']());}};_0x3cf544(++_0x383e40);}(_0xf181,0x6c));var _0x1f18=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf181[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x1f18('0x0'));var dialogflow=require(_0x1f18('0x1'));var md5=require(_0x1f18('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x1f18('0x3'))(_0x1f18('0x4'));var utils=require(_0x1f18('0x5'));var rpc={'chatMessage':require(_0x1f18('0x6')),'openchannelMessage':require(_0x1f18('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1f18('0x8')),'faxMessage':require(_0x1f18('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x44baf2,_0x2c05ba,_0x4a39f4,_0x420562){return new Promise(function(_0x2d3ac7,_0x5da7fc){var _0x520139=_[_0x1f18('0xa')](_0x4a39f4);_0x520139[_0x1f18('0xb')]=_0x420562;return rpc[_0x2c05ba+_0x1f18('0xc')]['create'](_0x520139)[_0x1f18('0xd')](function(){logger[_0x1f18('0xe')](_0x1f18('0xf'),_0x44baf2,_0x520139[_0x1f18('0xb')]);_0x2d3ac7();})[_0x1f18('0x10')](function(_0x4c4dfe){logger[_0x1f18('0x11')](_0x1f18('0xf'),_0x44baf2,JSON[_0x1f18('0x12')](_0x4c4dfe));_0x5da7fc(_0x4c4dfe);});});}exports[_0x1f18('0x13')]=function(_0x4ff14f,_0x1ad468){return function(_0x2ec9b4){try{if(!_['isNil'](this['interaction'][_0x1f18('0x14')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x4ff14f,_0x1f18('0x15'));return _0x2ec9b4[_0x1f18('0x16')]();}var _0x2ee59e={'ContactId':this[_0x1f18('0x17')]['id'],'sentAt':moment()[_0x1f18('0x18')](_0x1f18('0x19')),'direction':_0x1f18('0x1a')};if(this['channel']===_0x1f18('0x1b')||this['channel']===_0x1f18('0x1c')){_0x2ee59e[_0x1f18('0x1d')]=this['interaction']['phone'];}var _0x239e9a=this[_0x1f18('0x1e')];if(_0x239e9a===_0x1f18('0x1f')){_0x2ee59e[_0x1f18('0x20')]=this['account']['id'];}else{_0x2ee59e[_[_0x1f18('0x21')](_0x239e9a)+_0x1f18('0x22')]=this[_0x1f18('0x23')]['id'];}_0x2ee59e[_[_0x1f18('0x21')](_0x239e9a)+_0x1f18('0x24')]=this[_0x1f18('0x25')]['id'];if(this[_0x1f18('0x25')][_0x1f18('0x26')]){var _0x1b6142=_0x1ad468[0x4];if(!_['isEmpty'](_0x1b6142)){_0x2ee59e[_0x1f18('0xb')]=utils['getMustacheRender'](_0x1b6142,this);return rpc[_0x239e9a+_0x1f18('0xc')]['create'](_0x2ee59e)[_0x1f18('0xd')](function(_0x166443){logger['info'](_0x1f18('0xf'),_0x4ff14f,_0x2ee59e['body']);})[_0x1f18('0x10')](function(_0x52714f){logger[_0x1f18('0x11')](_0x1f18('0xf'),_0x4ff14f,JSON['stringify'](_0x52714f));})[_0x1f18('0x27')](function(){logger[_0x1f18('0xe')](_0x1f18('0x28'),_0x4ff14f);_0x2ec9b4[_0x1f18('0x29')]();});}else{logger[_0x1f18('0xe')](_0x1f18('0x2a'),_0x4ff14f);_0x2ec9b4[_0x1f18('0x29')]();}}else{var _0x1e45e4=this;var _0x54b5d8=_0x1ad468[0x2][_0x1f18('0x2b')](/\\n/g,'\x0a');var _0x3a35c8={'credentials':{'private_key':_0x54b5d8,'client_email':_0x1ad468[0x1]}};var _0x1af29e=new dialogflow[(_0x1f18('0x2c'))](_0x3a35c8);var _0x4431e8=_0x1af29e['sessionPath'](_0x1ad468[0x0],md5(_0x1e45e4[_0x1f18('0x25')]['id']));var _0x4b0df0={'session':_0x4431e8,'queryInput':{'text':{'text':_0x1e45e4[_0x1f18('0x2d')][_0x1f18('0xb')],'languageCode':_0x1ad468[0x3]||'en'}}};return _0x1af29e['detectIntent'](_0x4b0df0)[_0x1f18('0xd')](function(_0x2ec038){if(_0x2ec038&&_0x2ec038[_0x1f18('0x2e')]){_0x1e45e4['body']['dialogflowV2']=_0x2ec038;var _0x1cc6dc=_0x2ec038[0x0];var _0x49b785=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x30')]&&_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x30')][_0x1f18('0x31')]?_0x1cc6dc[_0x1f18('0x2f')]['diagnosticInfo'][_0x1f18('0x31')][_0x1f18('0x32')][_0x1f18('0x33')]:![];_0x1e45e4[_0x1f18('0xb')][_0x1f18('0x34')]=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x35')];_0x1e45e4[_0x1f18('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x36')];_0x1e45e4[_0x1f18('0xb')][_0x1f18('0x37')]=_0x1cc6dc[_0x1f18('0x2f')]['diagnosticInfo']&&_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x30')][_0x1f18('0x31')]?_0x1cc6dc[_0x1f18('0x2f')]['diagnosticInfo'][_0x1f18('0x31')][_0x1f18('0x32')][_0x1f18('0x33')]:![];_0x1e45e4['body'][_0x1f18('0x38')]=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x39')][_0x1f18('0x3a')];_0x1e45e4[_0x1f18('0xb')][_0x1f18('0x3b')]=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x39')][_0x1f18('0x3c')];_0x1e45e4['body'][_0x1f18('0x3d')]=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x39')][_0x1f18('0x3e')];_0x1e45e4[_0x1f18('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x3f')];_0x1e45e4['body'][_0x1f18('0x40')]=_0x1cc6dc[_0x1f18('0x2f')][_0x1f18('0x41')];_0x1e45e4['body'][_0x1f18('0x42')]=_0x1cc6dc['queryResult']['intentDetectionConfidence'];_0x2ee59e[_0x1f18('0x43')]=_0x1f18('0x44');_0x2ee59e[_0x1f18('0x45')]=JSON[_0x1f18('0x12')](_0x2ec038);var _0x4e5e8e=[];for(var _0x51eeda=0x0;_0x51eeda<_0x2ec038[_0x1f18('0x2e')];_0x51eeda++){var _0x3caf2c=_0x2ec038[_0x51eeda];if(_0x3caf2c&&_0x3caf2c[_0x1f18('0x2f')]&&_0x3caf2c[_0x1f18('0x2f')][_0x1f18('0x46')]){_0x4e5e8e[_0x1f18('0x47')](createMessage(_0x4ff14f,_0x239e9a,_0x2ee59e,_0x3caf2c[_0x1f18('0x2f')][_0x1f18('0x46')]));}}return Promise[_0x1f18('0x48')](_0x4e5e8e)[_0x1f18('0xd')](function(){if(_0x49b785){_0x2ec9b4[_0x1f18('0x16')]();}else{_0x2ec9b4['stop']();}})[_0x1f18('0x10')](function(_0xae81ff){logger[_0x1f18('0x11')](_0x1f18('0xf'),_0x4ff14f,JSON['stringify'](_0xae81ff));_0x2ec9b4[_0x1f18('0x16')]();});}})[_0x1f18('0x10')](function(_0x12f462){logger['error'](_0x1f18('0xf'),_0x4ff14f,_0x12f462[_0x1f18('0x2d')]);_0x2ec9b4['next']();});}}catch(_0x41efc0){logger['error'](_0x1f18('0xf'),_0x4ff14f,JSON[_0x1f18('0x12')](_0x41efc0));_0x2ec9b4[_0x1f18('0x29')]();}};};
\ No newline at end of file
index 1647476..72efa48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ee9=['lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify'];(function(_0x4040cf,_0x5f0a83){var _0x19c295=function(_0x5c70f0){while(--_0x5c70f0){_0x4040cf['push'](_0x4040cf['shift']());}};_0x19c295(++_0x5f0a83);}(_0x2ee9,0x160));var _0x92ee=function(_0x3065de,_0x57fedd){_0x3065de=_0x3065de-0x0;var _0x31a573=_0x2ee9[_0x3065de];return _0x31a573;};'use strict';var schema=require('validate');var _=require(_0x92ee('0x0'));var htmlToText=require(_0x92ee('0x1'));var utils=require(_0x92ee('0x2'));var logger=require(_0x92ee('0x3'))(_0x92ee('0x4'));var gotoif=schema({'condition':{'type':_0x92ee('0x5'),'required':!![],'message':_0x92ee('0x6')},'priorityTrue':{'type':_0x92ee('0x7'),'message':_0x92ee('0x8')},'priorityFalse':{'type':_0x92ee('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x92ee('0x9')]=function(_0x1e3b0d,_0x5a226d){return function(_0x3a0851){try{var _0x1a8d35={'condition':htmlToText[_0x92ee('0xa')](utils['getMustacheRender'](_0x5a226d[0x0],this),{'wordwrap':![]})[_0x92ee('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5a226d[0x1],'priorityFalse':_0x5a226d[0x2]};var _0x37878e=gotoif[_0x92ee('0xc')](_0x1a8d35,{'typecast':!![]});if(_0x37878e[_0x92ee('0xd')]){logger[_0x92ee('0xe')](_0x92ee('0xf'),_0x1e3b0d,_[_0x92ee('0x10')](_0x37878e,_0x92ee('0x11'))[_0x92ee('0x12')](',\x20'));_0x3a0851['stop']();}else{try{var _0x44e5b2=eval('('+_0x1a8d35['condition']+')');var _0x31f7e2=_0x44e5b2?_0x1a8d35[_0x92ee('0x13')]:_0x1a8d35[_0x92ee('0x14')];logger[_0x92ee('0x15')](_0x92ee('0x16'),_0x1e3b0d,_0x1a8d35[_0x92ee('0x17')],_0x44e5b2,_0x31f7e2||_0x92ee('0x18'));if(_0x31f7e2){var _0x2bac43=_[_0x92ee('0x19')](_0x3a0851[_0x92ee('0x1a')](),{'p':_0x31f7e2});if(_0x2bac43>=0x0){logger[_0x92ee('0x15')](_0x92ee('0x1b'),_0x1e3b0d,_0x31f7e2||_0x92ee('0x18'),_0x2bac43);_0x3a0851[_0x92ee('0x18')](_0x2bac43);}else{logger[_0x92ee('0x15')](_0x92ee('0x1c'),_0x1e3b0d,_0x31f7e2||'next');_0x3a0851[_0x92ee('0x1d')]();}}else{_0x3a0851[_0x92ee('0x18')]();}}catch(_0x370dca){logger[_0x92ee('0xe')](_0x92ee('0x1e'),_0x1e3b0d,_0x370dca[_0x92ee('0x11')]);_0x3a0851[_0x92ee('0x1d')]();}}}catch(_0x2c7849){logger[_0x92ee('0xe')]('[%s][GOTOIF]\x20%s',_0x1e3b0d,JSON[_0x92ee('0x1f')](_0x2c7849));_0x3a0851[_0x92ee('0x1d')]();}};};
\ No newline at end of file
+var _0xd793=['getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','consequence'];(function(_0x511598,_0x50cf30){var _0x505848=function(_0x255e0f){while(--_0x255e0f){_0x511598['push'](_0x511598['shift']());}};_0x505848(++_0x50cf30);}(_0xd793,0x12a));var _0x3d79=function(_0x34750b,_0x34aae5){_0x34750b=_0x34750b-0x0;var _0x244258=_0xd793[_0x34750b];return _0x244258;};'use strict';var schema=require(_0x3d79('0x0'));var _=require(_0x3d79('0x1'));var htmlToText=require(_0x3d79('0x2'));var utils=require(_0x3d79('0x3'));var logger=require(_0x3d79('0x4'))(_0x3d79('0x5'));var gotoif=schema({'condition':{'type':_0x3d79('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x3d79('0x7')},'priorityFalse':{'type':_0x3d79('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x3d79('0x9')]=function(_0x4082b1,_0x42e71e){return function(_0x244867){try{var _0x2ee44c={'condition':htmlToText['fromString'](utils[_0x3d79('0xa')](_0x42e71e[0x0],this),{'wordwrap':![]})[_0x3d79('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x42e71e[0x1],'priorityFalse':_0x42e71e[0x2]};var _0x2bdbb1=gotoif[_0x3d79('0x0')](_0x2ee44c,{'typecast':!![]});if(_0x2bdbb1[_0x3d79('0xc')]){logger[_0x3d79('0xd')](_0x3d79('0xe'),_0x4082b1,_[_0x3d79('0xf')](_0x2bdbb1,_0x3d79('0x10'))[_0x3d79('0x11')](',\x20'));_0x244867[_0x3d79('0x12')]();}else{try{var _0x2905d7=eval('('+_0x2ee44c[_0x3d79('0x13')]+')');var _0x790ac4=_0x2905d7?_0x2ee44c['priorityTrue']:_0x2ee44c['priorityFalse'];logger[_0x3d79('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4082b1,_0x2ee44c['condition'],_0x2905d7,_0x790ac4||_0x3d79('0x15'));if(_0x790ac4){var _0x394ebd=_[_0x3d79('0x16')](_0x244867[_0x3d79('0x17')](),{'p':_0x790ac4});if(_0x394ebd>=0x0){logger[_0x3d79('0x14')](_0x3d79('0x18'),_0x4082b1,_0x790ac4||_0x3d79('0x15'),_0x394ebd);_0x244867[_0x3d79('0x15')](_0x394ebd);}else{logger[_0x3d79('0x14')](_0x3d79('0x19'),_0x4082b1,_0x790ac4||_0x3d79('0x15'));_0x244867[_0x3d79('0x12')]();}}else{_0x244867[_0x3d79('0x15')]();}}catch(_0x3f36c7){logger['error'](_0x3d79('0x1a'),_0x4082b1,_0x3f36c7['message']);_0x244867['stop']();}}}catch(_0x39c842){logger[_0x3d79('0xd')](_0x3d79('0xe'),_0x4082b1,JSON[_0x3d79('0x1b')](_0x39c842));_0x244867[_0x3d79('0x12')]();}};};
\ No newline at end of file
index 96a8c75..ba54778 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb57e=['consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x1c3e42,_0x1a4fe9){var _0x348fdc=function(_0x597394){while(--_0x597394){_0x1c3e42['push'](_0x1c3e42['shift']());}};_0x348fdc(++_0x1a4fe9);}(_0xb57e,0xd8));var _0xeb57=function(_0xa23e1a,_0x21327c){_0xa23e1a=_0xa23e1a-0x0;var _0x16bbc9=_0xb57e[_0xa23e1a];return _0x16bbc9;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xeb57('0x0'))(_0xeb57('0x1'));var gotop=schema({'priority':{'type':_0xeb57('0x2'),'required':!![],'message':_0xeb57('0x3')}});exports[_0xeb57('0x4')]=function(_0x5aee5b,_0x1bb7a3){return function(_0x305357){try{var _0x40ccc7={'priority':_0x1bb7a3[0x0]};var _0x54c98a=gotop[_0xeb57('0x5')](_0x40ccc7,{'typecast':!![]});if(_0x54c98a[_0xeb57('0x6')]){logger[_0xeb57('0x7')](_0xeb57('0x8'),_0x5aee5b,_[_0xeb57('0x9')](_0x54c98a,_0xeb57('0xa'))[_0xeb57('0xb')](',\x20'));_0x305357[_0xeb57('0xc')]();}else{logger[_0xeb57('0xd')](_0xeb57('0xe'),_0x5aee5b,_0x40ccc7[_0xeb57('0xf')]);if(_0x40ccc7[_0xeb57('0xf')]){var _0x3029aa=_['findIndex'](_0x305357[_0xeb57('0x10')](),{'p':_0x40ccc7[_0xeb57('0xf')]});if(_0x3029aa>=0x0){logger[_0xeb57('0xd')](_0xeb57('0x11'),_0x5aee5b,_0x40ccc7[_0xeb57('0xf')]||_0xeb57('0x12'),_0x3029aa);_0x305357[_0xeb57('0x12')](_0x3029aa);}else{logger[_0xeb57('0xd')](_0xeb57('0x13'),_0x5aee5b,_0x40ccc7[_0xeb57('0xf')]||'next');_0x305357[_0xeb57('0xc')]();}}else{_0x305357[_0xeb57('0x12')]();}}}catch(_0x494777){logger['error']('[%s][GOTOP]\x20%s',_0x5aee5b,JSON['stringify'](_0x494777));_0x305357[_0xeb57('0xc')]();}};};
\ No newline at end of file
+var _0x1b06=['stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','message'];(function(_0x45c0cf,_0x5d38c7){var _0x234fb9=function(_0x522dcd){while(--_0x522dcd){_0x45c0cf['push'](_0x45c0cf['shift']());}};_0x234fb9(++_0x5d38c7);}(_0x1b06,0xd5));var _0x61b0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1b06[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0x61b0('0x0'));var _=require(_0x61b0('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x61b0('0x2'),'required':!![],'message':_0x61b0('0x3')}});exports[_0x61b0('0x4')]=function(_0xb4952c,_0x49c3d3){return function(_0x30ebc6){try{var _0x57b024={'priority':_0x49c3d3[0x0]};var _0x7f48d5=gotop[_0x61b0('0x0')](_0x57b024,{'typecast':!![]});if(_0x7f48d5['length']){logger[_0x61b0('0x5')](_0x61b0('0x6'),_0xb4952c,_['map'](_0x7f48d5,_0x61b0('0x7'))['join'](',\x20'));_0x30ebc6[_0x61b0('0x8')]();}else{logger['info'](_0x61b0('0x9'),_0xb4952c,_0x57b024[_0x61b0('0xa')]);if(_0x57b024[_0x61b0('0xa')]){var _0x2564d8=_[_0x61b0('0xb')](_0x30ebc6[_0x61b0('0xc')](),{'p':_0x57b024[_0x61b0('0xa')]});if(_0x2564d8>=0x0){logger[_0x61b0('0xd')](_0x61b0('0xe'),_0xb4952c,_0x57b024[_0x61b0('0xa')]||_0x61b0('0xf'),_0x2564d8);_0x30ebc6[_0x61b0('0xf')](_0x2564d8);}else{logger[_0x61b0('0xd')](_0x61b0('0x10'),_0xb4952c,_0x57b024[_0x61b0('0xa')]||_0x61b0('0xf'));_0x30ebc6[_0x61b0('0x8')]();}}else{_0x30ebc6[_0x61b0('0xf')]();}}}catch(_0x374467){logger[_0x61b0('0x5')](_0x61b0('0x6'),_0xb4952c,JSON['stringify'](_0x374467));_0x30ebc6['stop']();}};};
\ No newline at end of file
index 3dfe110..4cf7502 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4899=['chat','account','upperFirst','AccountId','channel','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','stop','error','stringify','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender'];(function(_0x60878f,_0x1166d3){var _0x1fbefb=function(_0x375d8c){while(--_0x375d8c){_0x60878f['push'](_0x60878f['shift']());}};_0x1fbefb(++_0x1166d3);}(_0x4899,0x74));var _0x9489=function(_0xe719da,_0x4fe71b){_0xe719da=_0xe719da-0x0;var _0x494282=_0x4899[_0xe719da];return _0x494282;};'use strict';var _=require(_0x9489('0x0'));var utils=require('./utils');var logger=require(_0x9489('0x1'))('routing');var rpc={'chatMessage':require(_0x9489('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9489('0x3')),'smsMessage':require(_0x9489('0x4')),'faxMessage':require(_0x9489('0x5')),'whatsappMessage':require(_0x9489('0x6'))};exports[_0x9489('0x7')]=function(_0x49173a,_0x99c731){return function(_0x3d7499){try{var _0x411ebe={'body':utils[_0x9489('0x8')](_0x99c731[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x9489('0x9')){_0x411ebe['ChatWebsiteId']=this[_0x9489('0xa')]['id'];}else{_0x411ebe[_[_0x9489('0xb')](this['channel'])+_0x9489('0xc')]=this[_0x9489('0xa')]['id'];}_0x411ebe[_[_0x9489('0xb')](this[_0x9489('0xd')])+_0x9489('0xe')]=this[_0x9489('0xf')]['id'];if(rpc[this[_0x9489('0xd')]+_0x9489('0x10')]){return rpc[this['channel']+_0x9489('0x10')][_0x9489('0x11')](_0x411ebe)[_0x9489('0x12')](function(_0x5de484){logger['info'](_0x9489('0x13'),_0x49173a,_0x411ebe[_0x9489('0x14')]);_0x3d7499[_0x9489('0x15')]();})['catch'](function(_0x402022){logger['error'](_0x9489('0x13'),_0x49173a,JSON['stringify'](_0x402022));_0x3d7499[_0x9489('0x16')]();});}}catch(_0x18a0aa){logger[_0x9489('0x17')](_0x9489('0x13'),_0x49173a,JSON[_0x9489('0x18')](_0x18a0aa));_0x3d7499['stop']();}};};
\ No newline at end of file
+var _0x187c=['../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../rpc/chatMessage'];(function(_0x4cce81,_0x252735){var _0xad14bc=function(_0x53bc1e){while(--_0x53bc1e){_0x4cce81['push'](_0x4cce81['shift']());}};_0xad14bc(++_0x252735);}(_0x187c,0x11d));var _0xc187=function(_0x1cfe7c,_0x4ba448){_0x1cfe7c=_0x1cfe7c-0x0;var _0x3feac9=_0x187c[_0x1cfe7c];return _0x3feac9;};'use strict';var _=require(_0xc187('0x0'));var utils=require(_0xc187('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xc187('0x2')),'openchannelMessage':require(_0xc187('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc187('0x4')),'whatsappMessage':require(_0xc187('0x5'))};exports[_0xc187('0x6')]=function(_0x20b6b5,_0x330de5){return function(_0x1e47d4){try{var _0x2e6d12={'body':utils['getMustacheRender'](_0x330de5[0x0],this),'ContactId':this[_0xc187('0x7')]['id']};if(this[_0xc187('0x8')]===_0xc187('0x9')){_0x2e6d12[_0xc187('0xa')]=this[_0xc187('0xb')]['id'];}else{_0x2e6d12[_['upperFirst'](this['channel'])+_0xc187('0xc')]=this['account']['id'];}_0x2e6d12[_['upperFirst'](this[_0xc187('0x8')])+_0xc187('0xd')]=this['interaction']['id'];if(rpc[this[_0xc187('0x8')]+_0xc187('0xe')]){return rpc[this[_0xc187('0x8')]+_0xc187('0xe')][_0xc187('0xf')](_0x2e6d12)[_0xc187('0x10')](function(_0x153157){logger['info'](_0xc187('0x11'),_0x20b6b5,_0x2e6d12[_0xc187('0x12')]);_0x1e47d4[_0xc187('0x13')]();})[_0xc187('0x14')](function(_0x3c7046){logger[_0xc187('0x15')]('[%s][MESSAGE]\x20%s',_0x20b6b5,JSON[_0xc187('0x16')](_0x3c7046));_0x1e47d4[_0xc187('0x17')]();});}}catch(_0x25bdda){logger[_0xc187('0x15')]('[%s][MESSAGE]\x20%s',_0x20b6b5,JSON[_0xc187('0x16')](_0x25bdda));_0x1e47d4[_0xc187('0x17')]();}};};
\ No newline at end of file
index 415660d..7ced3a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10ea=['[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','consequence','getMustacheRender','next','error'];(function(_0x366901,_0x18ccb2){var _0x4e3979=function(_0x105622){while(--_0x105622){_0x366901['push'](_0x366901['shift']());}};_0x4e3979(++_0x18ccb2);}(_0x10ea,0xae));var _0xa10e=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x10ea[_0x30bd4d];return _0x306915;};'use strict';var utils=require(_0xa10e('0x0'));var logger=require(_0xa10e('0x1'))('routing');exports[_0xa10e('0x2')]=function(_0x2b45fd,_0x4e3559){return function(_0x595431){try{logger['info']('[%s][NOOP]\x20%s',_0x2b45fd,utils[_0xa10e('0x3')](_0x4e3559[0x0],this));_0x595431[_0xa10e('0x4')]();}catch(_0x563d66){logger[_0xa10e('0x5')](_0xa10e('0x6'),_0x2b45fd,JSON[_0xa10e('0x7')](_0x563d66));_0x595431[_0xa10e('0x8')]();}};};
\ No newline at end of file
+var _0xe41f=['[%s][NOOP]\x20%s','next','stringify','stop','./utils','consequence','info'];(function(_0xa7242e,_0x22572b){var _0x55dbc4=function(_0x54d6f6){while(--_0x54d6f6){_0xa7242e['push'](_0xa7242e['shift']());}};_0x55dbc4(++_0x22572b);}(_0xe41f,0xdd));var _0xfe41=function(_0x2f6c25,_0xe26db){_0x2f6c25=_0x2f6c25-0x0;var _0x377275=_0xe41f[_0x2f6c25];return _0x377275;};'use strict';var utils=require(_0xfe41('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0xfe41('0x1')]=function(_0x33ff89,_0x298e17){return function(_0xc992a4){try{logger[_0xfe41('0x2')](_0xfe41('0x3'),_0x33ff89,utils['getMustacheRender'](_0x298e17[0x0],this));_0xc992a4[_0xfe41('0x4')]();}catch(_0x4da322){logger['error'](_0xfe41('0x3'),_0x33ff89,JSON[_0xfe41('0x5')](_0x4da322));_0xc992a4[_0xfe41('0x6')]();}};};
\ No newline at end of file
index a6d3085..94ea0f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a22=['../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','redis','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport'];(function(_0x326e5e,_0x491c33){var _0x4d0fde=function(_0xcbcedc){while(--_0xcbcedc){_0x326e5e['push'](_0x326e5e['shift']());}};_0x4d0fde(++_0x491c33);}(_0x5a22,0x1a0));var _0x25a2=function(_0x3d7e29,_0x45278b){_0x3d7e29=_0x3d7e29-0x0;var _0x341000=_0x5a22[_0x3d7e29];return _0x341000;};'use strict';var schema=require(_0x25a2('0x0'));var _=require(_0x25a2('0x1'));var util=require(_0x25a2('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x25a2('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config[_0x25a2('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x25a2('0x5'))(new Redis(config[_0x25a2('0x4')]));var attributes=['id',_0x25a2('0x6'),_0x25a2('0x7'),'queue',_0x25a2('0x8'),_0x25a2('0x9')];function emit(_0x10282e,_0x1e33c4,_0x251170){io['to'](_0x10282e)[_0x25a2('0xa')](_0x1e33c4,_0x251170);}function emitChannelQueueInteraction(_0x4434ec,_0x4d201c,_0x17808f,_0x193ea3,_0x21d40a,_0x33cb35,_0x5cd589,_0x4d5e17){var _0x5ec856=_[_0x25a2('0xb')](_0x17808f);_0x5ec856['queue_id']=_0x4d5e17;_0x5ec856[_0x25a2('0xc')]=_0x4d201c;_0x5ec856[_0x25a2('0x7')]=_0x193ea3;_0x5ec856['id']=_0x21d40a;if(_0x33cb35){attributes[_0x25a2('0xd')](_[_0x25a2('0xe')](_0x4434ec)+_0x25a2('0xf'));_0x5cd589[util[_0x25a2('0x10')](_0x25a2('0x11'),_0x4434ec)][_0x21d40a]=_[_0x25a2('0x12')](_0x5ec856,attributes);}else{delete _0x5cd589[util['format'](_0x25a2('0x11'),_0x4434ec)][_0x21d40a];}emit(util['format']('%s:queue:%s',_0x4434ec,_0x4d201c),util[_0x25a2('0x10')](_0x25a2('0x13'),_0x4434ec,_0x33cb35?'save':_0x25a2('0x14')),_['pick'](_0x5ec856,attributes));}var rpc={'openchannelQueueReport':require(_0x25a2('0x15')),'mailQueueReport':require(_0x25a2('0x16')),'chatQueueReport':require(_0x25a2('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x25a2('0x18')),'whatsappQueueReport':require(_0x25a2('0x19'))};var queue=schema({'name':{'type':_0x25a2('0x1a'),'required':!![],'message':_0x25a2('0x1b')},'timeout':{'type':_0x25a2('0x1c'),'message':_0x25a2('0x1d')}});function startRouting(_0x17917d,_0x38a084,_0x298155,_0x23cdb2){if(_0x17917d&&_0x38a084&&_0x298155){_0x38a084['waiting']+=0x1;var _0x46bfa2={'uniqueid':_0x17917d,'from':_0x298155[_0x25a2('0x1e')]?_0x298155['body']['from']:'','joinAt':moment()[_0x25a2('0x10')](_0x25a2('0x1f')),'ContactId':_0x298155[_0x25a2('0x20')]?_0x298155[_0x25a2('0x20')]['id']:null,'ListId':_0x298155[_0x25a2('0x21')]?_0x298155['list']['id']:null};_0x46bfa2[_['upperFirst'](_0x298155['channel'])+'QueueId']=_0x38a084['id']||null;_0x46bfa2[_[_0x25a2('0x22')](_0x298155[_0x25a2('0x23')])+_0x25a2('0xf')]=_0x298155[_0x25a2('0x24')]?_0x298155[_0x25a2('0x24')]['id']:null;_0x46bfa2[_[_0x25a2('0x22')](_0x298155[_0x25a2('0x23')])+_0x25a2('0x25')]=_0x298155[_0x25a2('0x26')]?_0x298155[_0x25a2('0x26')]['id']:null;_0x46bfa2[_[_0x25a2('0x22')](_0x298155[_0x25a2('0x23')])+(_0x298155[_0x25a2('0x23')]!==_0x25a2('0x27')?_0x25a2('0x28'):_0x25a2('0x29'))]=_0x298155[_0x25a2('0x7')]?_0x298155[_0x25a2('0x7')]['id']:null;logger[_0x25a2('0x2a')](util['format'](_0x25a2('0x2b'),_0x17917d,_0x38a084[_0x25a2('0x2c')]));emitChannelQueueInteraction(_0x298155[_0x25a2('0x23')],_0x38a084[_0x25a2('0x2c')],_0x46bfa2,_0x298155['account'][_0x25a2('0x2c')],_0x298155[_0x25a2('0x26')]['id'],!![],_0x23cdb2,_0x38a084['id']);if(rpc[_0x298155[_0x25a2('0x23')]+_0x25a2('0x2d')]){return rpc[_0x298155[_0x25a2('0x23')]+_0x25a2('0x2d')]['create'](_0x46bfa2)[_0x25a2('0x2e')](function(_0x5142dd){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0xd0deb8,_0x49fe27,_0x51e573,_0x547807){if(_0xd0deb8&&_0x49fe27){_0x49fe27[_0x25a2('0x2f')]-=0x1;var _0x18b53c={'leaveAt':moment()[_0x25a2('0x10')](_0x25a2('0x1f')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x25a2('0x30')};logger['info'](util['format'](_0x25a2('0x31'),_0xd0deb8,_0x49fe27['name']));emitChannelQueueInteraction(_0x51e573['channel'],_0x49fe27[_0x25a2('0x2c')],_0x51e573[_0x25a2('0x1e')],_0x51e573[_0x25a2('0x7')][_0x25a2('0x2c')],_0x51e573['message']['id'],![],_0x547807,_0x49fe27['id']);if(rpc[_0x51e573[_0x25a2('0x23')]+_0x25a2('0x2d')]){return rpc[_0x51e573[_0x25a2('0x23')]+_0x25a2('0x2d')][_0x25a2('0x32')](_0xd0deb8,_0x18b53c)[_0x25a2('0x2e')](function(_0x62df2e){logger[_0x25a2('0x33')](_0x25a2('0x34'));});}}}function endRouting(_0x27b7ab,_0x48a4a5,_0x4798bc,_0x5a7f74){if(_0x27b7ab&&_0x48a4a5){_0x48a4a5[_0x25a2('0x2f')]-=0x1;var _0x1ee9f8={'leaveAt':moment()[_0x25a2('0x10')](_0x25a2('0x1f')),'exitAt':moment()[_0x25a2('0x10')](_0x25a2('0x1f')),'reason':'timeout'};logger[_0x25a2('0x2a')](util[_0x25a2('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x27b7ab,_0x48a4a5[_0x25a2('0x2c')]));emitChannelQueueInteraction(_0x4798bc['channel'],_0x48a4a5[_0x25a2('0x2c')],_0x4798bc[_0x25a2('0x1e')],_0x4798bc[_0x25a2('0x7')][_0x25a2('0x2c')],_0x4798bc[_0x25a2('0x26')]['id'],![],_0x5a7f74);if(rpc[_0x4798bc[_0x25a2('0x23')]+'QueueReport']){return rpc[_0x4798bc[_0x25a2('0x23')]+_0x25a2('0x2d')][_0x25a2('0x32')](_0x27b7ab,_0x1ee9f8)['catch'](function(_0x10b024){logger[_0x25a2('0x33')](_0x25a2('0x34'));});}}}function handleFindQueue(_0x3df9f5){return function(_0xddb8b5){return _0xddb8b5[_0x25a2('0x2c')][_0x25a2('0x35')]()===_0x3df9f5['toLowerCase']();};}exports[_0x25a2('0x36')]=function(_0x411d65,_0x8bbcb4,_0x18969c,_0x280939){return function(_0x32f593){try{var _0x196434={'name':_0x8bbcb4[0x0],'timeout':_0x8bbcb4[0x1]};var _0x1ee5a0=queue[_0x25a2('0x0')](_0x196434,{'typecast':!![]});if(_0x1ee5a0[_0x25a2('0x37')]){logger[_0x25a2('0x33')](_0x25a2('0x38'),_0x411d65,_[_0x25a2('0x39')](_0x1ee5a0,'message')[_0x25a2('0x3a')](',\x20'));_0x32f593[_0x25a2('0x3b')]();}else{var _0x2761fd=_[_0x25a2('0x3c')](_0x18969c[_0x280939[_0x25a2('0x23')]+_0x25a2('0x3d')],handleFindQueue(_0x196434[_0x25a2('0x2c')]));if(_0x2761fd){startRouting(_0x411d65,_0x2761fd,_0x280939,_0x18969c);var _0x2c871c=(_0x2761fd[_0x25a2('0x3e')]||0xa)*0x3e8;var _0x182e58=(_0x196434[_0x25a2('0x3e')]||0x14)*0x3e8;var _0x35d990;if(_0x2c871c>_0x182e58){_0x182e58=_0x2c871c;}var _0x1b4126=seqqueue['createQueue'](_0x2c871c);_0x1b4126['id']=_0x411d65;_0x1b4126[_0x25a2('0x3f')]=_0x2c871c;_0x1b4126[_0x25a2('0x40')]=_0x182e58;_0x1b4126[_0x25a2('0x23')]=_0x280939[_0x25a2('0x23')];_0x18969c['rules'][_0x411d65]['on'](_0x25a2('0x41'),function(){logger[_0x25a2('0x2a')](_0x25a2('0x42'),_0x411d65);stopRouting(_0x411d65,_0x2761fd,_0x280939,_0x18969c);clearTimeout(_0x35d990);_0x35d990=undefined;_0x1b4126[_0x25a2('0x43')](!![]);if(_0x18969c[_0x25a2('0x44')][_0x411d65]){delete _0x18969c['rules'][_0x411d65];}_0x32f593['stop']();});_0x18969c[_0x25a2('0x44')][_0x411d65]['on']('complete',function(){if(_0x18969c['rules'][_0x411d65]){delete _0x18969c[_0x25a2('0x44')][_0x411d65];}});_0x35d990=setTimeout(function(){logger['info'](_0x25a2('0x45'),_0x411d65);endRouting(_0x411d65,_0x2761fd,_0x280939,_0x18969c);clearTimeout(_0x35d990);_0x1b4126[_0x25a2('0x43')](!![]);_0x32f593[_0x25a2('0x46')]();},_0x182e58);switch(_0x2761fd['strategy']){case'rrmemory':strategy['rrmemory'](_0x1b4126,_0x2761fd,_0x18969c,_0x280939);break;default:strategy['beepall'](_0x1b4126,_0x2761fd,_0x18969c,_0x280939);}}else{logger[_0x25a2('0x33')](_0x25a2('0x47'),_0x411d65,_0x196434['name']);_0x32f593[_0x25a2('0x3b')]();}}}catch(_0x2dfa2a){console['log'](_0x2dfa2a);logger[_0x25a2('0x33')](_0x25a2('0x38'),_0x411d65,_0x2dfa2a[_0x25a2('0x48')]);_0x32f593[_0x25a2('0x3b')]();}};};
\ No newline at end of file
+var _0xd2a2=['defaults','localhost','socket.io-emitter','queue_id','account','queue','emit','clone','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','list','channel','interaction','upperFirst','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xd2a2,0x9b));var _0x2d2a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd2a2[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0x2d2a('0x0'));var _=require(_0x2d2a('0x1'));var util=require(_0x2d2a('0x2'));var seqqueue=require(_0x2d2a('0x3'));var moment=require(_0x2d2a('0x4'));var Redis=require(_0x2d2a('0x5'));var config=require(_0x2d2a('0x6'));var logger=require(_0x2d2a('0x7'))(_0x2d2a('0x8'));var strategy=require(_0x2d2a('0x9'));config[_0x2d2a('0xa')]=_[_0x2d2a('0xb')](config[_0x2d2a('0xa')],{'host':_0x2d2a('0xc'),'port':0x18eb});var io=require(_0x2d2a('0xd'))(new Redis(config['redis']));var attributes=['id',_0x2d2a('0xe'),_0x2d2a('0xf'),_0x2d2a('0x10'),'from','joinAt'];function emit(_0x258aad,_0x43b832,_0x985423){io['to'](_0x258aad)[_0x2d2a('0x11')](_0x43b832,_0x985423);}function emitChannelQueueInteraction(_0x1c8ebb,_0x29b84a,_0x788e8b,_0x1cfa72,_0x299828,_0x1d21bc,_0x410be6,_0x3125a2){var _0x5c2104=_[_0x2d2a('0x12')](_0x788e8b);_0x5c2104['queue_id']=_0x3125a2;_0x5c2104[_0x2d2a('0x10')]=_0x29b84a;_0x5c2104[_0x2d2a('0xf')]=_0x1cfa72;_0x5c2104['id']=_0x299828;if(_0x1d21bc){attributes[_0x2d2a('0x13')](_[_0x2d2a('0x14')](_0x1c8ebb)+_0x2d2a('0x15'));_0x410be6[util[_0x2d2a('0x16')]('%sQueuesWaitingInteractions',_0x1c8ebb)][_0x299828]=_[_0x2d2a('0x17')](_0x5c2104,attributes);}else{delete _0x410be6[util['format'](_0x2d2a('0x18'),_0x1c8ebb)][_0x299828];}emit(util[_0x2d2a('0x16')](_0x2d2a('0x19'),_0x1c8ebb,_0x29b84a),util[_0x2d2a('0x16')](_0x2d2a('0x1a'),_0x1c8ebb,_0x1d21bc?_0x2d2a('0x1b'):_0x2d2a('0x1c')),_['pick'](_0x5c2104,attributes));}var rpc={'openchannelQueueReport':require(_0x2d2a('0x1d')),'mailQueueReport':require(_0x2d2a('0x1e')),'chatQueueReport':require(_0x2d2a('0x1f')),'smsQueueReport':require(_0x2d2a('0x20')),'faxQueueReport':require(_0x2d2a('0x21')),'whatsappQueueReport':require(_0x2d2a('0x22'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x2d2a('0x23')},'timeout':{'type':_0x2d2a('0x24'),'message':_0x2d2a('0x25')}});function startRouting(_0x5a7555,_0x12fcba,_0x3e1f5a,_0x34b9bb){if(_0x5a7555&&_0x12fcba&&_0x3e1f5a){_0x12fcba[_0x2d2a('0x26')]+=0x1;var _0xbff0ac={'uniqueid':_0x5a7555,'from':_0x3e1f5a[_0x2d2a('0x27')]?_0x3e1f5a[_0x2d2a('0x27')][_0x2d2a('0x28')]:'','joinAt':moment()[_0x2d2a('0x16')](_0x2d2a('0x29')),'ContactId':_0x3e1f5a['contact']?_0x3e1f5a['contact']['id']:null,'ListId':_0x3e1f5a['list']?_0x3e1f5a[_0x2d2a('0x2a')]['id']:null};_0xbff0ac[_['upperFirst'](_0x3e1f5a[_0x2d2a('0x2b')])+'QueueId']=_0x12fcba['id']||null;_0xbff0ac[_['upperFirst'](_0x3e1f5a[_0x2d2a('0x2b')])+'InteractionId']=_0x3e1f5a['interaction']?_0x3e1f5a[_0x2d2a('0x2c')]['id']:null;_0xbff0ac[_[_0x2d2a('0x2d')](_0x3e1f5a['channel'])+'MessageId']=_0x3e1f5a[_0x2d2a('0x2e')]?_0x3e1f5a[_0x2d2a('0x2e')]['id']:null;_0xbff0ac[_[_0x2d2a('0x2d')](_0x3e1f5a[_0x2d2a('0x2b')])+(_0x3e1f5a[_0x2d2a('0x2b')]!==_0x2d2a('0x2f')?_0x2d2a('0x30'):_0x2d2a('0x31'))]=_0x3e1f5a['account']?_0x3e1f5a['account']['id']:null;logger['info'](util[_0x2d2a('0x16')](_0x2d2a('0x32'),_0x5a7555,_0x12fcba[_0x2d2a('0x33')]));emitChannelQueueInteraction(_0x3e1f5a[_0x2d2a('0x2b')],_0x12fcba[_0x2d2a('0x33')],_0xbff0ac,_0x3e1f5a[_0x2d2a('0xf')][_0x2d2a('0x33')],_0x3e1f5a[_0x2d2a('0x2e')]['id'],!![],_0x34b9bb,_0x12fcba['id']);if(rpc[_0x3e1f5a[_0x2d2a('0x2b')]+_0x2d2a('0x34')]){return rpc[_0x3e1f5a['channel']+_0x2d2a('0x34')][_0x2d2a('0x35')](_0xbff0ac)[_0x2d2a('0x36')](function(_0x2f160f){logger['error'](_0x2d2a('0x37'));});}}}function stopRouting(_0x35cf67,_0x54a437,_0x3a9aad,_0x16f049){if(_0x35cf67&&_0x54a437){_0x54a437[_0x2d2a('0x26')]-=0x1;var _0x1ce05a={'leaveAt':moment()['format'](_0x2d2a('0x29')),'acceptAt':moment()[_0x2d2a('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2d2a('0x38')};logger[_0x2d2a('0x39')](util[_0x2d2a('0x16')](_0x2d2a('0x3a'),_0x35cf67,_0x54a437[_0x2d2a('0x33')]));emitChannelQueueInteraction(_0x3a9aad[_0x2d2a('0x2b')],_0x54a437['name'],_0x3a9aad[_0x2d2a('0x27')],_0x3a9aad[_0x2d2a('0xf')][_0x2d2a('0x33')],_0x3a9aad[_0x2d2a('0x2e')]['id'],![],_0x16f049,_0x54a437['id']);if(rpc[_0x3a9aad['channel']+_0x2d2a('0x34')]){return rpc[_0x3a9aad[_0x2d2a('0x2b')]+_0x2d2a('0x34')]['update'](_0x35cf67,_0x1ce05a)[_0x2d2a('0x36')](function(_0x32ff61){logger[_0x2d2a('0x3b')](_0x2d2a('0x3c'));});}}}function endRouting(_0xeda305,_0x50fae9,_0x20353d,_0x5da32f){if(_0xeda305&&_0x50fae9){_0x50fae9[_0x2d2a('0x26')]-=0x1;var _0x4dd0ed={'leaveAt':moment()[_0x2d2a('0x16')](_0x2d2a('0x29')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2d2a('0x3d')};logger[_0x2d2a('0x39')](util[_0x2d2a('0x16')](_0x2d2a('0x3e'),_0xeda305,_0x50fae9[_0x2d2a('0x33')]));emitChannelQueueInteraction(_0x20353d['channel'],_0x50fae9['name'],_0x20353d[_0x2d2a('0x27')],_0x20353d[_0x2d2a('0xf')]['name'],_0x20353d[_0x2d2a('0x2e')]['id'],![],_0x5da32f);if(rpc[_0x20353d['channel']+_0x2d2a('0x34')]){return rpc[_0x20353d[_0x2d2a('0x2b')]+_0x2d2a('0x34')]['update'](_0xeda305,_0x4dd0ed)['catch'](function(_0x533820){logger['error'](_0x2d2a('0x3c'));});}}}function handleFindQueue(_0x4ed819){return function(_0x1763ad){return _0x1763ad[_0x2d2a('0x33')][_0x2d2a('0x3f')]()===_0x4ed819['toLowerCase']();};}exports[_0x2d2a('0x40')]=function(_0x350a11,_0x2a9557,_0x10696d,_0x2b1e6a){return function(_0x22377d){try{var _0x427be7={'name':_0x2a9557[0x0],'timeout':_0x2a9557[0x1]};var _0x363589=queue[_0x2d2a('0x0')](_0x427be7,{'typecast':!![]});if(_0x363589[_0x2d2a('0x41')]){logger[_0x2d2a('0x3b')](_0x2d2a('0x42'),_0x350a11,_[_0x2d2a('0x43')](_0x363589,_0x2d2a('0x2e'))[_0x2d2a('0x44')](',\x20'));_0x22377d[_0x2d2a('0x45')]();}else{var _0x400680=_[_0x2d2a('0x46')](_0x10696d[_0x2b1e6a['channel']+_0x2d2a('0x47')],handleFindQueue(_0x427be7['name']));if(_0x400680){startRouting(_0x350a11,_0x400680,_0x2b1e6a,_0x10696d);var _0x44edd9=(_0x400680[_0x2d2a('0x3d')]||0xa)*0x3e8;var _0x4c0fd5=(_0x427be7[_0x2d2a('0x3d')]||0x14)*0x3e8;var _0xe83cbc;if(_0x44edd9>_0x4c0fd5){_0x4c0fd5=_0x44edd9;}var _0x2f8410=seqqueue[_0x2d2a('0x48')](_0x44edd9);_0x2f8410['id']=_0x350a11;_0x2f8410[_0x2d2a('0x49')]=_0x44edd9;_0x2f8410[_0x2d2a('0x4a')]=_0x4c0fd5;_0x2f8410[_0x2d2a('0x2b')]=_0x2b1e6a['channel'];_0x10696d[_0x2d2a('0x4b')][_0x350a11]['on']('end',function(){logger[_0x2d2a('0x39')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x350a11);stopRouting(_0x350a11,_0x400680,_0x2b1e6a,_0x10696d);clearTimeout(_0xe83cbc);_0xe83cbc=undefined;_0x2f8410[_0x2d2a('0x4c')](!![]);if(_0x10696d[_0x2d2a('0x4b')][_0x350a11]){delete _0x10696d[_0x2d2a('0x4b')][_0x350a11];}_0x22377d[_0x2d2a('0x45')]();});_0x10696d[_0x2d2a('0x4b')][_0x350a11]['on'](_0x2d2a('0x4d'),function(){if(_0x10696d[_0x2d2a('0x4b')][_0x350a11]){delete _0x10696d[_0x2d2a('0x4b')][_0x350a11];}});_0xe83cbc=setTimeout(function(){logger[_0x2d2a('0x39')](_0x2d2a('0x4e'),_0x350a11);endRouting(_0x350a11,_0x400680,_0x2b1e6a,_0x10696d);clearTimeout(_0xe83cbc);_0x2f8410[_0x2d2a('0x4c')](!![]);_0x22377d[_0x2d2a('0x4f')]();},_0x4c0fd5);switch(_0x400680[_0x2d2a('0x50')]){case'rrmemory':strategy['rrmemory'](_0x2f8410,_0x400680,_0x10696d,_0x2b1e6a);break;default:strategy['beepall'](_0x2f8410,_0x400680,_0x10696d,_0x2b1e6a);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x350a11,_0x427be7[_0x2d2a('0x33')]);_0x22377d[_0x2d2a('0x45')]();}}}catch(_0x476951){console[_0x2d2a('0x51')](_0x476951);logger[_0x2d2a('0x3b')](_0x2d2a('0x42'),_0x350a11,_0x476951[_0x2d2a('0x52')]);_0x22377d[_0x2d2a('0x45')]();}};};
\ No newline at end of file
index ff2e617..e8bdc1f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x34e8,0x12c));var _0x834e=function(_0x114b11,_0x2816cb){_0x114b11=_0x114b11-0x0;var _0x5244bc=_0x34e8[_0x114b11];return _0x5244bc;};'use strict';var _=require(_0x834e('0x0'));var uuid=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var logger=require(_0x834e('0x3'))('routing');var Agent=function(_0x832422,_0x21e2e0,_0x472111,_0x31bf20){this[_0x834e('0x4')]=uuid['v4']();this[_0x834e('0x5')]=_0x832422;this[_0x834e('0x6')]=_0x21e2e0;this['realtime']=_0x472111;this[_0x834e('0x7')]=_0x31bf20;this['squeue'][_0x834e('0x8')](this[_0x834e('0x9')][_0x834e('0xa')](this),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xc'),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xd'),this[_0x834e('0xe')][_0x834e('0xa')](this));};Agent[_0x834e('0xf')][_0x834e('0x8')]=function(){this[_0x834e('0x5')][_0x834e('0x8')](this['handleRun'][_0x834e('0xa')](this),this[_0x834e('0xb')]['bind'](this));};Agent[_0x834e('0xf')][_0x834e('0xe')]=function(){this[_0x834e('0xb')](!![]);};Agent[_0x834e('0xf')]['handleRun']=function(){logger[_0x834e('0x10')](_0x834e('0x11'),this['squeue']['id'],this[_0x834e('0x6')]['id']);if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']])){logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x834e('0x8')][_0x834e('0xa')](this),0x3e8);}else{if(this[_0x834e('0x7')][_0x834e('0x15')]||util[_0x834e('0x16')](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']],this[_0x834e('0x5')][_0x834e('0x17')],![])){this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=!![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue'][_0x834e('0x17')]);util[_0x834e('0x1a')](this['notificationId'],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']],null,this[_0x834e('0x7')]);util[_0x834e('0x1b')](this['squeue']['id'],this['realtime'][_0x834e('0x13')][this['agent']['id']],_0x834e('0x1c')+(this[_0x834e('0x7')][_0x834e('0x15')]?_0x834e('0x1d'):''));}else{logger[_0x834e('0x10')](_0x834e('0x1e'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x834e('0xf')][_0x834e('0xb')]=function(_0x106d6a){if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']])){return logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this[_0x834e('0x6')]['id']);}else{logger[_0x834e('0x10')](_0x834e('0x1f'),this['squeue']['id'],this[_0x834e('0x6')]['id']);util['hideNotification'](this[_0x834e('0x4')],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],null,this[_0x834e('0x7')]);this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util[_0x834e('0x20')](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue']['channel']);util['writeLog'](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],_0x106d6a?_0x834e('0x21'):_0x834e('0x22'));}if(!_0x106d6a){setTimeout(this['push'][_0x834e('0xa')](this),0x3e8);}};function agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed){return new Agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed);}module[_0x834e('0x23')]=agent;
\ No newline at end of file
+var _0x68fc=['timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util','squeue','agent','realtime','routing','handleRun','bind','handleTimeout'];(function(_0x28e72b,_0x5e16ab){var _0x77418f=function(_0xe6d89d){while(--_0xe6d89d){_0x28e72b['push'](_0x28e72b['shift']());}};_0x77418f(++_0x5e16ab);}(_0x68fc,0xa5));var _0xc68f=function(_0x3c3cb4,_0x12cb83){_0x3c3cb4=_0x3c3cb4-0x0;var _0x8d6e07=_0x68fc[_0x3c3cb4];return _0x8d6e07;};'use strict';var _=require(_0xc68f('0x0'));var uuid=require(_0xc68f('0x1'));var util=require(_0xc68f('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x26513f,_0x506fb5,_0xe70787,_0x593648){this['notificationId']=uuid['v4']();this[_0xc68f('0x3')]=_0x26513f;this[_0xc68f('0x4')]=_0x506fb5;this[_0xc68f('0x5')]=_0xe70787;this[_0xc68f('0x6')]=_0x593648;this['squeue']['push'](this[_0xc68f('0x7')][_0xc68f('0x8')](this),this[_0xc68f('0x9')][_0xc68f('0x8')](this));this[_0xc68f('0x3')]['on'](_0xc68f('0xa'),this[_0xc68f('0x9')][_0xc68f('0x8')](this));this[_0xc68f('0x3')]['on'](_0xc68f('0xb'),this['handleDrained'][_0xc68f('0x8')](this));};Agent[_0xc68f('0xc')][_0xc68f('0xd')]=function(){this[_0xc68f('0x3')][_0xc68f('0xd')](this[_0xc68f('0x7')][_0xc68f('0x8')](this),this[_0xc68f('0x9')][_0xc68f('0x8')](this));};Agent[_0xc68f('0xc')][_0xc68f('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0xc68f('0xc')][_0xc68f('0x7')]=function(){logger[_0xc68f('0xf')](_0xc68f('0x10'),this[_0xc68f('0x3')]['id'],this[_0xc68f('0x4')]['id']);if(_[_0xc68f('0x11')](this[_0xc68f('0x5')][_0xc68f('0x12')][this['agent']['id']])){logger['debug'](_0xc68f('0x13'),this[_0xc68f('0x3')]['id'],this[_0xc68f('0x4')]['id']);setTimeout(this[_0xc68f('0xd')][_0xc68f('0x8')](this),0x3e8);}else{if(this[_0xc68f('0x6')]['forcedOwnership']||util[_0xc68f('0x14')](this[_0xc68f('0x3')]['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],this[_0xc68f('0x3')][_0xc68f('0x15')],![])){this[_0xc68f('0x5')]['agents'][this[_0xc68f('0x4')]['id']][_0xc68f('0x16')]=!![];this[_0xc68f('0x5')]['agents'][this[_0xc68f('0x4')]['id']][_0xc68f('0x17')]=undefined;util[_0xc68f('0x18')](this[_0xc68f('0x5')],this[_0xc68f('0x6')],this[_0xc68f('0x4')],this[_0xc68f('0x3')]['channel']);util[_0xc68f('0x19')](this[_0xc68f('0x1a')],this['squeue']['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],null,this[_0xc68f('0x6')]);util[_0xc68f('0x1b')](this['squeue']['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this['agent']['id']],_0xc68f('0x1c')+(this[_0xc68f('0x6')]['forcedOwnership']?_0xc68f('0x1d'):''));}else{logger[_0xc68f('0xf')](_0xc68f('0x1e'),this[_0xc68f('0x3')]['id'],this['agent']['id']);setTimeout(this[_0xc68f('0xd')][_0xc68f('0x8')](this),0x3e8);}}};Agent[_0xc68f('0xc')][_0xc68f('0x9')]=function(_0x1ba1ac){if(_[_0xc68f('0x11')](this[_0xc68f('0x5')][_0xc68f('0x12')][this['agent']['id']])){return logger[_0xc68f('0xf')](_0xc68f('0x13'),this['squeue']['id'],this[_0xc68f('0x4')]['id']);}else{logger[_0xc68f('0xf')](_0xc68f('0x1f'),this[_0xc68f('0x3')]['id'],this['agent']['id']);util[_0xc68f('0x20')](this[_0xc68f('0x1a')],this['squeue']['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],null,this[_0xc68f('0x6')]);this[_0xc68f('0x5')]['agents'][this['agent']['id']][_0xc68f('0x16')]=![];this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']][_0xc68f('0x17')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0xc68f('0x6')],this['agent'],this[_0xc68f('0x3')][_0xc68f('0x15')]);util[_0xc68f('0x1b')](this[_0xc68f('0x3')]['id'],this[_0xc68f('0x5')][_0xc68f('0x12')][this[_0xc68f('0x4')]['id']],_0x1ba1ac?'STOP':_0xc68f('0x21'));}if(!_0x1ba1ac){setTimeout(this[_0xc68f('0xd')][_0xc68f('0x8')](this),0x3e8);}};function agent(_0x360810,_0xc12ffb,_0x2555c0,_0x3c36f1){return new Agent(_0x360810,_0xc12ffb,_0x2555c0,_0x3c36f1);}module[_0xc68f('0x22')]=agent;
\ No newline at end of file
index 7526f73..ac5e69c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1997=['timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout'];(function(_0x1bfc0d,_0x1d94dd){var _0xb1ae42=function(_0xf0e6f1){while(--_0xf0e6f1){_0x1bfc0d['push'](_0x1bfc0d['shift']());}};_0xb1ae42(++_0x1d94dd);}(_0x1997,0x13e));var _0x7199=function(_0x115b6a,_0x24e5e3){_0x115b6a=_0x115b6a-0x0;var _0x4465c8=_0x1997[_0x115b6a];return _0x4465c8;};'use strict';var _=require(_0x7199('0x0'));var uuid=require(_0x7199('0x1'));var util=require('./util');var logger=require(_0x7199('0x2'))(_0x7199('0x3'));var Beepall=function(_0x16ab74,_0x206217,_0x5a4039,_0x17b64b){this[_0x7199('0x4')]=uuid['v4']();this[_0x7199('0x5')]=_0x16ab74;this[_0x7199('0x6')]=_0x206217;this[_0x7199('0x7')]=_0x5a4039;this[_0x7199('0x3')]=_0x17b64b;this[_0x7199('0x5')][_0x7199('0x8')](this[_0x7199('0x9')][_0x7199('0xa')](this),this[_0x7199('0xb')]['bind'](this));this[_0x7199('0x5')]['on'](_0x7199('0xc'),this[_0x7199('0xb')]['bind'](this));this[_0x7199('0x5')]['on'](_0x7199('0xd'),this[_0x7199('0xe')][_0x7199('0xa')](this));};Beepall['prototype'][_0x7199('0x8')]=function(){this['squeue'][_0x7199('0x8')](this['handleRun'][_0x7199('0xa')](this),this[_0x7199('0xb')][_0x7199('0xa')](this));};Beepall[_0x7199('0xf')][_0x7199('0xe')]=function(){this[_0x7199('0xb')](!![]);};Beepall[_0x7199('0xf')][_0x7199('0x9')]=function(){var _0x12d3fb=!![];if(!_[_0x7199('0x10')](this['queue'])&&!_[_0x7199('0x10')](this['queue'][_0x7199('0x11')])&&this[_0x7199('0x6')]['Agents'][_0x7199('0x12')]>0x0){for(var _0x4bd694=0x0,_0x587d40;_0x4bd694<this[_0x7199('0x6')][_0x7199('0x11')][_0x7199('0x12')];_0x4bd694+=0x1){_0x587d40=this[_0x7199('0x6')]['Agents'][_0x4bd694]['id'];if(_[_0x7199('0x10')](this[_0x7199('0x7')][_0x7199('0x13')][_0x587d40])){logger['debug']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7199('0x5')]['id'],_0x587d40);}else{if(util[_0x7199('0x14')](this['squeue']['id'],this['realtime'][_0x7199('0x13')][_0x587d40],this[_0x7199('0x5')][_0x7199('0x15')],!![])){_0x12d3fb=![];util[_0x7199('0x16')](this[_0x7199('0x5')]['id'],this[_0x7199('0x7')][_0x7199('0x13')][_0x587d40],_0x7199('0x17'));this[_0x7199('0x7')][_0x7199('0x13')][_0x587d40][_0x7199('0x18')]=!![];this[_0x7199('0x7')]['agents'][_0x587d40][_0x7199('0x19')]=this[_0x7199('0x6')][_0x7199('0x1a')];util['saveWaitingNotification'](this[_0x7199('0x7')],this[_0x7199('0x3')],this[_0x7199('0x6')][_0x7199('0x11')][_0x4bd694],this['squeue'][_0x7199('0x15')]);util[_0x7199('0x1b')](this[_0x7199('0x4')],this[_0x7199('0x5')]['id'],this[_0x7199('0x7')][_0x7199('0x13')][_0x587d40],this[_0x7199('0x6')],this[_0x7199('0x3')]);}}}if(_0x12d3fb){logger['debug'](_0x7199('0x1c'),this['squeue']['id']);setTimeout(this[_0x7199('0x8')][_0x7199('0xa')](this),0x3e8);}}else{logger[_0x7199('0x1d')]('[%s][QUEUE]\x20EMPTY',this[_0x7199('0x5')]['id']);setTimeout(this['push'][_0x7199('0xa')](this),0x3e8);}};Beepall[_0x7199('0xf')][_0x7199('0xb')]=function(_0x357a6f){if(!_['isNil'](this[_0x7199('0x6')])&&!_[_0x7199('0x10')](this[_0x7199('0x6')][_0x7199('0x11')])){for(var _0x43fc94=0x0,_0x1bae18;_0x43fc94<this['queue'][_0x7199('0x11')]['length'];_0x43fc94+=0x1){_0x1bae18=this[_0x7199('0x6')][_0x7199('0x11')][_0x43fc94]['id'];if(_[_0x7199('0x10')](this['realtime'][_0x7199('0x13')][_0x1bae18])){logger[_0x7199('0x1d')](_0x7199('0x1e'),this[_0x7199('0x5')]['id'],_0x1bae18);}else{util['hideNotification'](this[_0x7199('0x4')],this[_0x7199('0x5')]['id'],this[_0x7199('0x7')][_0x7199('0x13')][_0x1bae18],this['queue'],this[_0x7199('0x3')]);util[_0x7199('0x16')](this[_0x7199('0x5')]['id'],this[_0x7199('0x7')][_0x7199('0x13')][_0x1bae18],_0x357a6f?'STOP':_0x7199('0x1f'));this[_0x7199('0x7')][_0x7199('0x13')][_0x1bae18][_0x7199('0x18')]=![];this['realtime'][_0x7199('0x13')][_0x1bae18][_0x7199('0x19')]=undefined;util['removeWaitingNotification'](this[_0x7199('0x7')],this[_0x7199('0x3')],this[_0x7199('0x7')][_0x7199('0x13')][_0x1bae18],this['squeue'][_0x7199('0x15')]);}}}if(!_0x357a6f){setTimeout(this[_0x7199('0x8')][_0x7199('0xa')](this),0x3e8);}};function beepall(_0x545903,_0x2fd17a,_0x3da7cc,_0x31546b){return new Beepall(_0x545903,_0x2fd17a,_0x3da7cc,_0x31546b);}module[_0x7199('0x20')]=beepall;
\ No newline at end of file
+var _0x2f88=['bind','timeout','drained','prototype','isNil','queue','Agents','length','agents','debug','isAgentAvailable','channel','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','writeLog','STOP','busyQueue','removeWaitingNotification','lodash','uuid','./util','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout'];(function(_0xee209,_0x4858f4){var _0x48cd8c=function(_0x5e3eda){while(--_0x5e3eda){_0xee209['push'](_0xee209['shift']());}};_0x48cd8c(++_0x4858f4);}(_0x2f88,0x16c));var _0x82f8=function(_0x2f410d,_0x3c256b){_0x2f410d=_0x2f410d-0x0;var _0x550534=_0x2f88[_0x2f410d];return _0x550534;};'use strict';var _=require(_0x82f8('0x0'));var uuid=require(_0x82f8('0x1'));var util=require(_0x82f8('0x2'));var logger=require('../../../../../config/logger')(_0x82f8('0x3'));var Beepall=function(_0x1eb692,_0x7e710b,_0x4266c3,_0x4d198b){this[_0x82f8('0x4')]=uuid['v4']();this[_0x82f8('0x5')]=_0x1eb692;this['queue']=_0x7e710b;this[_0x82f8('0x6')]=_0x4266c3;this[_0x82f8('0x3')]=_0x4d198b;this[_0x82f8('0x5')][_0x82f8('0x7')](this[_0x82f8('0x8')]['bind'](this),this[_0x82f8('0x9')][_0x82f8('0xa')](this));this['squeue']['on'](_0x82f8('0xb'),this[_0x82f8('0x9')]['bind'](this));this[_0x82f8('0x5')]['on'](_0x82f8('0xc'),this['handleDrained'][_0x82f8('0xa')](this));};Beepall[_0x82f8('0xd')][_0x82f8('0x7')]=function(){this[_0x82f8('0x5')][_0x82f8('0x7')](this[_0x82f8('0x8')][_0x82f8('0xa')](this),this['handleTimeout']['bind'](this));};Beepall[_0x82f8('0xd')]['handleDrained']=function(){this[_0x82f8('0x9')](!![]);};Beepall[_0x82f8('0xd')][_0x82f8('0x8')]=function(){var _0x362053=!![];if(!_[_0x82f8('0xe')](this[_0x82f8('0xf')])&&!_[_0x82f8('0xe')](this['queue'][_0x82f8('0x10')])&&this[_0x82f8('0xf')][_0x82f8('0x10')][_0x82f8('0x11')]>0x0){for(var _0x3422e7=0x0,_0x18f99e;_0x3422e7<this[_0x82f8('0xf')][_0x82f8('0x10')]['length'];_0x3422e7+=0x1){_0x18f99e=this[_0x82f8('0xf')]['Agents'][_0x3422e7]['id'];if(_[_0x82f8('0xe')](this['realtime'][_0x82f8('0x12')][_0x18f99e])){logger[_0x82f8('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x82f8('0x5')]['id'],_0x18f99e);}else{if(util[_0x82f8('0x14')](this[_0x82f8('0x5')]['id'],this[_0x82f8('0x6')]['agents'][_0x18f99e],this['squeue'][_0x82f8('0x15')],!![])){_0x362053=![];util['writeLog'](this['squeue']['id'],this[_0x82f8('0x6')][_0x82f8('0x12')][_0x18f99e],'RINGING');this[_0x82f8('0x6')]['agents'][_0x18f99e][_0x82f8('0x16')]=!![];this[_0x82f8('0x6')]['agents'][_0x18f99e]['busyQueue']=this[_0x82f8('0xf')][_0x82f8('0x17')];util[_0x82f8('0x18')](this[_0x82f8('0x6')],this[_0x82f8('0x3')],this[_0x82f8('0xf')][_0x82f8('0x10')][_0x3422e7],this[_0x82f8('0x5')]['channel']);util[_0x82f8('0x19')](this[_0x82f8('0x4')],this[_0x82f8('0x5')]['id'],this[_0x82f8('0x6')]['agents'][_0x18f99e],this[_0x82f8('0xf')],this[_0x82f8('0x3')]);}}}if(_0x362053){logger['debug'](_0x82f8('0x1a'),this[_0x82f8('0x5')]['id']);setTimeout(this[_0x82f8('0x7')][_0x82f8('0xa')](this),0x3e8);}}else{logger[_0x82f8('0x13')](_0x82f8('0x1b'),this[_0x82f8('0x5')]['id']);setTimeout(this['push'][_0x82f8('0xa')](this),0x3e8);}};Beepall[_0x82f8('0xd')][_0x82f8('0x9')]=function(_0x4fd9c2){if(!_[_0x82f8('0xe')](this[_0x82f8('0xf')])&&!_[_0x82f8('0xe')](this['queue'][_0x82f8('0x10')])){for(var _0x2fb790=0x0,_0x5e5b95;_0x2fb790<this[_0x82f8('0xf')][_0x82f8('0x10')][_0x82f8('0x11')];_0x2fb790+=0x1){_0x5e5b95=this[_0x82f8('0xf')][_0x82f8('0x10')][_0x2fb790]['id'];if(_['isNil'](this[_0x82f8('0x6')]['agents'][_0x5e5b95])){logger[_0x82f8('0x13')](_0x82f8('0x1c'),this[_0x82f8('0x5')]['id'],_0x5e5b95);}else{util[_0x82f8('0x1d')](this[_0x82f8('0x4')],this[_0x82f8('0x5')]['id'],this[_0x82f8('0x6')][_0x82f8('0x12')][_0x5e5b95],this[_0x82f8('0xf')],this[_0x82f8('0x3')]);util[_0x82f8('0x1e')](this[_0x82f8('0x5')]['id'],this['realtime'][_0x82f8('0x12')][_0x5e5b95],_0x4fd9c2?_0x82f8('0x1f'):'TIMEOUT');this[_0x82f8('0x6')]['agents'][_0x5e5b95]['busy']=![];this['realtime']['agents'][_0x5e5b95][_0x82f8('0x20')]=undefined;util[_0x82f8('0x21')](this['realtime'],this[_0x82f8('0x3')],this['realtime'][_0x82f8('0x12')][_0x5e5b95],this[_0x82f8('0x5')][_0x82f8('0x15')]);}}}if(!_0x4fd9c2){setTimeout(this[_0x82f8('0x7')]['bind'](this),0x3e8);}};function beepall(_0x543f6d,_0x2e32ee,_0x5b76cc,_0x3e2a2d){return new Beepall(_0x543f6d,_0x2e32ee,_0x5b76cc,_0x3e2a2d);}module['exports']=beepall;
\ No newline at end of file
index 713909d..1ebfd0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a26=['./beepall'];(function(_0x1950d7,_0xeba905){var _0x3c312b=function(_0x8d0019){while(--_0x8d0019){_0x1950d7['push'](_0x1950d7['shift']());}};_0x3c312b(++_0xeba905);}(_0x6a26,0x76));var _0x66a2=function(_0x5e6ef0,_0x477041){_0x5e6ef0=_0x5e6ef0-0x0;var _0x3ce902=_0x6a26[_0x5e6ef0];return _0x3ce902;};'use strict';module['exports']={'rrmemory':require('./rrmemory'),'beepall':require(_0x66a2('0x0')),'agent':require('./agent')};
\ No newline at end of file
+var _0x67b9=['./beepall','./agent','./rrmemory'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x67b9,0x134));var _0x967b=function(_0x3600e4,_0x215e86){_0x3600e4=_0x3600e4-0x0;var _0x494bfa=_0x67b9[_0x3600e4];return _0x494bfa;};'use strict';module['exports']={'rrmemory':require(_0x967b('0x0')),'beepall':require(_0x967b('0x1')),'agent':require(_0x967b('0x2'))};
\ No newline at end of file
index 44277a1..3df685a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7694=['debug','[%s][QUEUE]\x20available\x20again\x20%s','agentId','done','mapAgentsId','isNil','agents','isAgentAvailable','busy','name','showNotification','writeLog','RINGING','handleCheckReject','[%s][QUEUE]\x20timeout\x20with\x20%s','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','busyQueue','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','intervals','push','handleRun','handleTimeout','bind','module','timeout','handleDrained','prototype','realtime','channel'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x7694,0x14d));var _0x4769=function(_0xff6ae1,_0x5c13e2){_0xff6ae1=_0xff6ae1-0x0;var _0x389fa2=_0x7694[_0xff6ae1];return _0x389fa2;};'use strict';var rr=require('rr');var _=require('lodash');var uuid=require(_0x4769('0x0'));var util=require(_0x4769('0x1'));var logger=require(_0x4769('0x2'))('routing');var RRMemory=function(_0x2b64f9,_0x26301e,_0x3ed943,_0x1b1815){this[_0x4769('0x3')]=uuid['v4']();this[_0x4769('0x4')]=_0x2b64f9;this[_0x4769('0x5')]=_0x26301e;this['realtime']=_0x3ed943;this[_0x4769('0x6')]=_0x1b1815;this[_0x4769('0x7')]={};this[_0x4769('0x4')][_0x4769('0x8')](this[_0x4769('0x9')]['bind'](this),this[_0x4769('0xa')][_0x4769('0xb')](this),this[_0x4769('0xc')]);this['squeue']['on'](_0x4769('0xd'),this['handleTimeout'][_0x4769('0xb')](this));this['squeue']['on']('drained',this[_0x4769('0xe')][_0x4769('0xb')](this));};RRMemory['prototype'][_0x4769('0x8')]=function(){this[_0x4769('0x4')][_0x4769('0x8')](this[_0x4769('0x9')][_0x4769('0xb')](this),this['handleTimeout'][_0x4769('0xb')](this));};RRMemory['prototype'][_0x4769('0xe')]=function(){this[_0x4769('0xa')](!![]);};RRMemory[_0x4769('0xf')]['handleCheckReject']=function(_0x43da22){if(util['isAgentAvailable'](this[_0x4769('0x4')]['id'],this[_0x4769('0x10')]['agents'][this['agentId']],this[_0x4769('0x4')][_0x4769('0x11')],!![])){logger[_0x4769('0x12')](_0x4769('0x13'),this[_0x4769('0x4')]['id'],this[_0x4769('0x14')]);clearInterval(this[_0x4769('0x7')][this[_0x4769('0x14')]]);_0x43da22[_0x4769('0x15')]();setTimeout(this[_0x4769('0x8')][_0x4769('0xb')](this),0x3e8);}};RRMemory['prototype'][_0x4769('0x9')]=function(_0x3ec002){this[_0x4769('0x14')]=rr(this[_0x4769('0x5')][_0x4769('0x16')]);logger[_0x4769('0x12')]('[%s][QUEUE]\x20try\x20with\x20%s',this[_0x4769('0x4')]['id'],this[_0x4769('0x14')]);if(_[_0x4769('0x17')](this['realtime'][_0x4769('0x18')][this[_0x4769('0x14')]])){logger['debug']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x4769('0x4')]['id'],this['agentId']);_0x3ec002[_0x4769('0x15')]();setTimeout(this[_0x4769('0x8')][_0x4769('0xb')](this),0x3e8);}else{if(util[_0x4769('0x19')](this['squeue']['id'],this[_0x4769('0x10')]['agents'][this[_0x4769('0x14')]],this[_0x4769('0x4')][_0x4769('0x11')],!![])){this[_0x4769('0x10')]['agents'][this[_0x4769('0x14')]][_0x4769('0x1a')]=!![];this['realtime'][_0x4769('0x18')][this[_0x4769('0x14')]]['busyQueue']=this[_0x4769('0x5')][_0x4769('0x1b')];util['saveWaitingNotification'](this['realtime'],this[_0x4769('0x6')],this[_0x4769('0x10')][_0x4769('0x18')][this[_0x4769('0x14')]],this[_0x4769('0x4')][_0x4769('0x11')]);util[_0x4769('0x1c')](this[_0x4769('0x3')],this[_0x4769('0x4')]['id'],this['realtime'][_0x4769('0x18')][this[_0x4769('0x14')]],this[_0x4769('0x5')],this[_0x4769('0x6')]);util[_0x4769('0x1d')](this[_0x4769('0x4')]['id'],this[_0x4769('0x10')][_0x4769('0x18')][this['agentId']],_0x4769('0x1e'));this[_0x4769('0x7')][this[_0x4769('0x14')]]=setInterval(this[_0x4769('0x1f')][_0x4769('0xb')](this,_0x3ec002),0x3e8);}else{logger[_0x4769('0x12')]('[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s',this[_0x4769('0x4')]['id'],this['agentId']);_0x3ec002[_0x4769('0x15')]();setTimeout(this[_0x4769('0x8')][_0x4769('0xb')](this),0x3e8);}}};RRMemory[_0x4769('0xf')][_0x4769('0xa')]=function(_0x3776e9){logger['debug'](_0x4769('0x20'),this[_0x4769('0x4')]['id'],this[_0x4769('0x14')]);if(_[_0x4769('0x17')](this[_0x4769('0x10')]['agents'][this[_0x4769('0x14')]])){logger[_0x4769('0x12')](_0x4769('0x21'),this['squeue']['id'],this[_0x4769('0x14')]);}else{clearInterval(this[_0x4769('0x7')][this[_0x4769('0x14')]]);util[_0x4769('0x22')](this[_0x4769('0x3')],this[_0x4769('0x4')]['id'],this[_0x4769('0x10')]['agents'][this[_0x4769('0x14')]],this[_0x4769('0x5')],this[_0x4769('0x6')]);util['writeLog'](this[_0x4769('0x4')]['id'],this['realtime'][_0x4769('0x18')][this[_0x4769('0x14')]],_0x4769('0x23'));this['realtime'][_0x4769('0x18')][this[_0x4769('0x14')]][_0x4769('0x1a')]=![];this[_0x4769('0x10')][_0x4769('0x18')][this[_0x4769('0x14')]][_0x4769('0x24')]=undefined;util[_0x4769('0x25')](this[_0x4769('0x10')],this['routing'],this['realtime'][_0x4769('0x18')][this[_0x4769('0x14')]],this[_0x4769('0x4')][_0x4769('0x11')]);}if(!_0x3776e9){setTimeout(this[_0x4769('0x8')]['bind'](this),0x3e8);}};function rrmemory(_0x1ca04f,_0x41184a,_0x33a07f,_0x3774a5){return new RRMemory(_0x1ca04f,_0x41184a,_0x33a07f,_0x3774a5);}module[_0x4769('0x26')]=rrmemory;
\ No newline at end of file
+var _0xd883=['handleDrained','push','prototype','handleCheckReject','isAgentAvailable','agents','agentId','channel','debug','[%s][QUEUE]\x20available\x20again\x20%s','done','mapAgentsId','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','saveWaitingNotification','showNotification','writeLog','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','busyQueue','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','intervals','handleRun','bind','handleTimeout','timeout','drained'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xd883,0xb4));var _0x3d88=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd883[_0x5f1391];return _0x50ebe3;};'use strict';var rr=require('rr');var _=require(_0x3d88('0x0'));var uuid=require(_0x3d88('0x1'));var util=require(_0x3d88('0x2'));var logger=require(_0x3d88('0x3'))(_0x3d88('0x4'));var RRMemory=function(_0x4ba510,_0x1e8142,_0x4973d4,_0x42acc1){this[_0x3d88('0x5')]=uuid['v4']();this[_0x3d88('0x6')]=_0x4ba510;this[_0x3d88('0x7')]=_0x1e8142;this[_0x3d88('0x8')]=_0x4973d4;this['routing']=_0x42acc1;this[_0x3d88('0x9')]={};this[_0x3d88('0x6')]['push'](this[_0x3d88('0xa')][_0x3d88('0xb')](this),this[_0x3d88('0xc')][_0x3d88('0xb')](this),this['module']);this[_0x3d88('0x6')]['on'](_0x3d88('0xd'),this[_0x3d88('0xc')]['bind'](this));this[_0x3d88('0x6')]['on'](_0x3d88('0xe'),this[_0x3d88('0xf')]['bind'](this));};RRMemory['prototype'][_0x3d88('0x10')]=function(){this[_0x3d88('0x6')][_0x3d88('0x10')](this[_0x3d88('0xa')][_0x3d88('0xb')](this),this[_0x3d88('0xc')][_0x3d88('0xb')](this));};RRMemory[_0x3d88('0x11')]['handleDrained']=function(){this[_0x3d88('0xc')](!![]);};RRMemory['prototype'][_0x3d88('0x12')]=function(_0x4914ce){if(util[_0x3d88('0x13')](this[_0x3d88('0x6')]['id'],this[_0x3d88('0x8')][_0x3d88('0x14')][this[_0x3d88('0x15')]],this[_0x3d88('0x6')][_0x3d88('0x16')],!![])){logger[_0x3d88('0x17')](_0x3d88('0x18'),this[_0x3d88('0x6')]['id'],this['agentId']);clearInterval(this[_0x3d88('0x9')][this['agentId']]);_0x4914ce[_0x3d88('0x19')]();setTimeout(this[_0x3d88('0x10')][_0x3d88('0xb')](this),0x3e8);}};RRMemory[_0x3d88('0x11')][_0x3d88('0xa')]=function(_0x117686){this[_0x3d88('0x15')]=rr(this['queue'][_0x3d88('0x1a')]);logger[_0x3d88('0x17')]('[%s][QUEUE]\x20try\x20with\x20%s',this[_0x3d88('0x6')]['id'],this[_0x3d88('0x15')]);if(_[_0x3d88('0x1b')](this['realtime'][_0x3d88('0x14')][this[_0x3d88('0x15')]])){logger['debug'](_0x3d88('0x1c'),this['squeue']['id'],this[_0x3d88('0x15')]);_0x117686[_0x3d88('0x19')]();setTimeout(this['push'][_0x3d88('0xb')](this),0x3e8);}else{if(util[_0x3d88('0x13')](this[_0x3d88('0x6')]['id'],this['realtime'][_0x3d88('0x14')][this['agentId']],this[_0x3d88('0x6')][_0x3d88('0x16')],!![])){this['realtime'][_0x3d88('0x14')][this['agentId']][_0x3d88('0x1d')]=!![];this[_0x3d88('0x8')][_0x3d88('0x14')][this['agentId']]['busyQueue']=this[_0x3d88('0x7')]['name'];util[_0x3d88('0x1e')](this[_0x3d88('0x8')],this[_0x3d88('0x4')],this['realtime'][_0x3d88('0x14')][this[_0x3d88('0x15')]],this[_0x3d88('0x6')][_0x3d88('0x16')]);util[_0x3d88('0x1f')](this[_0x3d88('0x5')],this[_0x3d88('0x6')]['id'],this[_0x3d88('0x8')][_0x3d88('0x14')][this[_0x3d88('0x15')]],this['queue'],this[_0x3d88('0x4')]);util[_0x3d88('0x20')](this[_0x3d88('0x6')]['id'],this[_0x3d88('0x8')][_0x3d88('0x14')][this[_0x3d88('0x15')]],'RINGING');this[_0x3d88('0x9')][this['agentId']]=setInterval(this[_0x3d88('0x12')][_0x3d88('0xb')](this,_0x117686),0x3e8);}else{logger['debug'](_0x3d88('0x21'),this[_0x3d88('0x6')]['id'],this[_0x3d88('0x15')]);_0x117686[_0x3d88('0x19')]();setTimeout(this[_0x3d88('0x10')][_0x3d88('0xb')](this),0x3e8);}}};RRMemory[_0x3d88('0x11')][_0x3d88('0xc')]=function(_0x4f2626){logger[_0x3d88('0x17')](_0x3d88('0x22'),this[_0x3d88('0x6')]['id'],this[_0x3d88('0x15')]);if(_['isNil'](this[_0x3d88('0x8')][_0x3d88('0x14')][this['agentId']])){logger[_0x3d88('0x17')](_0x3d88('0x1c'),this[_0x3d88('0x6')]['id'],this['agentId']);}else{clearInterval(this[_0x3d88('0x9')][this[_0x3d88('0x15')]]);util[_0x3d88('0x23')](this[_0x3d88('0x5')],this['squeue']['id'],this[_0x3d88('0x8')][_0x3d88('0x14')][this['agentId']],this[_0x3d88('0x7')],this['routing']);util[_0x3d88('0x20')](this['squeue']['id'],this[_0x3d88('0x8')]['agents'][this[_0x3d88('0x15')]],_0x3d88('0x24'));this[_0x3d88('0x8')][_0x3d88('0x14')][this[_0x3d88('0x15')]][_0x3d88('0x1d')]=![];this[_0x3d88('0x8')]['agents'][this[_0x3d88('0x15')]][_0x3d88('0x25')]=undefined;util['removeWaitingNotification'](this[_0x3d88('0x8')],this[_0x3d88('0x4')],this['realtime'][_0x3d88('0x14')][this[_0x3d88('0x15')]],this[_0x3d88('0x6')][_0x3d88('0x16')]);}if(!_0x4f2626){setTimeout(this[_0x3d88('0x10')][_0x3d88('0xb')](this),0x3e8);}};function rrmemory(_0x282a70,_0x13181e,_0x2255f8,_0x4b693f){return new RRMemory(_0x282a70,_0x13181e,_0x2255f8,_0x4b693f);}module[_0x3d88('0x26')]=rrmemory;
\ No newline at end of file
index f390f93..3d737af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa484=['util','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','user:%s','name','user:save','split','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','save','isAgentAvailable','busy','BUSY','online','Pause','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','interaction','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','message','writeLog'];(function(_0x1d37fc,_0x4db492){var _0x652aa6=function(_0x34f767){while(--_0x34f767){_0x1d37fc['push'](_0x1d37fc['shift']());}};_0x652aa6(++_0x4db492);}(_0xa484,0x1c2));var _0x4a48=function(_0x560914,_0x4ee5de){_0x560914=_0x560914-0x0;var _0x58fe58=_0xa484[_0x560914];return _0x58fe58;};'use strict';var _=require('lodash');var util=require(_0x4a48('0x0'));var utils=require('../utils');var Redis=require(_0x4a48('0x1'));var config=require('../../../../../config/environment');var logger=require(_0x4a48('0x2'))(_0x4a48('0x3'));config[_0x4a48('0x4')]=_['defaults'](config[_0x4a48('0x4')],{'host':_0x4a48('0x5'),'port':0x18eb});var io=require(_0x4a48('0x6'))(new Redis(config[_0x4a48('0x4')]));function sendNotification(_0xbef183,_0x5f229b,_0xa5cbf,_0x4991d3,_0x16c270,_0x9ade9f){io['to'](util['format'](_0x4a48('0x7'),_0x4991d3[_0x4a48('0x8')]))['emit'](_0x4a48('0x9'),_0x4991d3);var _0x122f45=_0x9ade9f||{};var _0x3c7868=_0xa5cbf[_0x4a48('0xa')]('.');var _0x4f6d1={'uniqueid':_0x5f229b,'channel':_0x3c7868[0x0],'id':_0x3c7868[0x1],'title':_0x3c7868[0x0]+'\x20interaction','interactionId':_0x3c7868[0x2],'queue':_0x16c270?_0x16c270[_0x4a48('0x8')]:null,'sound':_0x122f45[_0x4a48('0xb')][_0x4a48('0xc')],'shake':_0x122f45[_0x4a48('0xb')][_0x4a48('0xd')]};try{if(!_0x122f45['body']){_0x122f45[_0x4a48('0xe')]={};}if(_0x16c270){_0x122f45[_0x4a48('0xe')][_0x4a48('0xf')]=_0x16c270;}else if(_0x122f45[_0x4a48('0xe')][_0x4a48('0xf')]){delete _0x122f45[_0x4a48('0xe')][_0x4a48('0xf')];}_0x4f6d1['msg']=utils[_0x4a48('0x10')](_0x122f45['account'][_0x4a48('0x11')],_0x122f45);}catch(_0x254455){_0x4f6d1['msg']=_0x4a48('0x12');logger[_0x4a48('0x13')](util[_0x4a48('0x14')](_0x4a48('0x15'),_0x5f229b,_0x254455['message']));}io['to'](util[_0x4a48('0x14')]('user:%s',_0x4991d3[_0x4a48('0x8')]))['emit'](util[_0x4a48('0x14')]('notification:%s',_0xbef183?_0x4a48('0x16'):'remove'),_0x4f6d1);}function writeLog(_0xf3b6eb,_0x5cfab1,_0x283cc4){return logger['debug'](util[_0x4a48('0x14')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0xf3b6eb,_0x5cfab1[_0x4a48('0x8')],_0x283cc4));}exports[_0x4a48('0x17')]=function(_0x147982,_0x41f6e6,_0xe535b1,_0x31cec7){if(_0x41f6e6[_0x4a48('0x18')]){writeLog(_0x147982,_0x41f6e6,_0x4a48('0x19'));return![];}if(!_0x41f6e6[_0x4a48('0x1a')]){writeLog(_0x147982,_0x41f6e6,'OFFLINE');return![];}if(_0x41f6e6[_0xe535b1+_0x4a48('0x1b')]){writeLog(_0x147982,_0x41f6e6,'PAUSE');return![];}if(_0x31cec7&&_0x41f6e6[_0x4a48('0x1c')](_0xe535b1+_0x4a48('0x1d'))&&_0x41f6e6[_0x4a48('0x1c')](_0xe535b1+'CurrentCapacity')){if(_0x41f6e6[_0xe535b1+_0x4a48('0x1d')]>0x0&&_0x41f6e6[_0xe535b1+'CurrentCapacity']>=_0x41f6e6[_0xe535b1+_0x4a48('0x1d')]){writeLog(_0x147982,_0x41f6e6,_0xe535b1[_0x4a48('0x1e')]()+_0x4a48('0x1f'));return![];}}return!![];};exports['showNotification']=function(_0x338ae0,_0x4dc8a7,_0x3bc1fc,_0x14f0c4,_0x50d9fc){return sendNotification(!![],_0x338ae0,_0x4dc8a7,_0x3bc1fc,_0x14f0c4,_0x50d9fc);};exports[_0x4a48('0x20')]=function(_0x329ccf,_0x3d5746,_0x17f5a0,_0x305ece,_0x28f1ce){return sendNotification(![],_0x329ccf,_0x3d5746,_0x17f5a0,_0x305ece,_0x28f1ce);};exports['checkWaitingNotifications']=function(_0x12352a,_0x4e6954,_0x89d3c6){var _0x5a7349=_0x4e6954[_0x4a48('0x21')]['UserId'];if(!_0x5a7349&&_0x89d3c6){_0x5a7349=_0x89d3c6['id'];}var _0x48d4af=_[_0x4a48('0x22')](_0x12352a[_0x4e6954[_0x4a48('0x23')]+_0x4a48('0x24')],function(_0x156635){var _0x451ff9=_[_0x4a48('0x25')](_0x4e6954['channel'])+_0x4a48('0x26');return _0x156635[_0x451ff9]===_0x4e6954[_0x4a48('0x21')]['id'];});if(!_0x48d4af&&_0x5a7349){_0x48d4af=_[_0x4a48('0x22')](_0x12352a['agents'][_0x5a7349][_0x4e6954['channel']+_0x4a48('0x27')],function(_0x2e5b0d){return _0x2e5b0d['id']===_0x4e6954['interaction']['id'];});}return _0x48d4af;};exports[_0x4a48('0x28')]=function(_0x281e36,_0x3df0b3,_0x578110,_0x38be52){_0x281e36[_0x4a48('0x29')][_0x578110['id']][_0x38be52+_0x4a48('0x27')][_0x3df0b3['message']['id']]={'id':_0x3df0b3[_0x4a48('0x21')]['id']};};exports[_0x4a48('0x2a')]=function(_0x215d6f,_0xe866fe,_0x1b745c,_0xe137d4){delete _0x215d6f['agents'][_0x1b745c['id']][_0xe137d4+_0x4a48('0x27')][_0xe866fe[_0x4a48('0x2b')]['id']];};exports[_0x4a48('0x2c')]=writeLog;
\ No newline at end of file
+var _0xb2b0=['../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','ioredis'];(function(_0x5d877b,_0xe5361a){var _0x118eac=function(_0x952519){while(--_0x952519){_0x5d877b['push'](_0x5d877b['shift']());}};_0x118eac(++_0xe5361a);}(_0xb2b0,0xd1));var _0x0b2b=function(_0x2a847f,_0x4b57e5){_0x2a847f=_0x2a847f-0x0;var _0x43d754=_0xb2b0[_0x2a847f];return _0x43d754;};'use strict';var _=require(_0x0b2b('0x0'));var util=require(_0x0b2b('0x1'));var utils=require('../utils');var Redis=require(_0x0b2b('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x0b2b('0x3'))(_0x0b2b('0x4'));config[_0x0b2b('0x5')]=_[_0x0b2b('0x6')](config['redis'],{'host':_0x0b2b('0x7'),'port':0x18eb});var io=require(_0x0b2b('0x8'))(new Redis(config[_0x0b2b('0x5')]));function sendNotification(_0x3f02a9,_0x1e7315,_0x5148e5,_0x50cbfe,_0x32aca1,_0x4a144){io['to'](util[_0x0b2b('0x9')]('user:%s',_0x50cbfe[_0x0b2b('0xa')]))['emit'](_0x0b2b('0xb'),_0x50cbfe);var _0x4f77f0=_0x4a144||{};var _0x492f35=_0x5148e5['split']('.');var _0x98f8fa={'uniqueid':_0x1e7315,'channel':_0x492f35[0x0],'id':_0x492f35[0x1],'title':_0x492f35[0x0]+_0x0b2b('0xc'),'interactionId':_0x492f35[0x2],'queue':_0x32aca1?_0x32aca1[_0x0b2b('0xa')]:null,'sound':_0x4f77f0[_0x0b2b('0xd')][_0x0b2b('0xe')],'shake':_0x4f77f0['account'][_0x0b2b('0xf')]};try{if(!_0x4f77f0[_0x0b2b('0x10')]){_0x4f77f0['body']={};}if(_0x32aca1){_0x4f77f0[_0x0b2b('0x10')][_0x0b2b('0x11')]=_0x32aca1;}else if(_0x4f77f0['body'][_0x0b2b('0x11')]){delete _0x4f77f0[_0x0b2b('0x10')]['queue'];}_0x98f8fa['msg']=utils[_0x0b2b('0x12')](_0x4f77f0[_0x0b2b('0xd')][_0x0b2b('0x13')],_0x4f77f0);}catch(_0x5f084b){_0x98f8fa[_0x0b2b('0x14')]=_0x0b2b('0x15');logger[_0x0b2b('0x16')](util[_0x0b2b('0x9')](_0x0b2b('0x17'),_0x1e7315,_0x5f084b[_0x0b2b('0x18')]));}io['to'](util[_0x0b2b('0x9')](_0x0b2b('0x19'),_0x50cbfe['name']))[_0x0b2b('0x1a')](util[_0x0b2b('0x9')](_0x0b2b('0x1b'),_0x3f02a9?'save':_0x0b2b('0x1c')),_0x98f8fa);}function writeLog(_0x4a70ec,_0x86791f,_0x3b52b0){return logger['debug'](util[_0x0b2b('0x9')](_0x0b2b('0x1d'),_0x4a70ec,_0x86791f['name'],_0x3b52b0));}exports[_0x0b2b('0x1e')]=function(_0x344571,_0x1ccb32,_0x17b84e,_0xa6bea0){if(_0x1ccb32[_0x0b2b('0x1f')]){writeLog(_0x344571,_0x1ccb32,_0x0b2b('0x20'));return![];}if(!_0x1ccb32['online']){writeLog(_0x344571,_0x1ccb32,_0x0b2b('0x21'));return![];}if(_0x1ccb32[_0x17b84e+'Pause']){writeLog(_0x344571,_0x1ccb32,_0x0b2b('0x22'));return![];}if(_0xa6bea0&&_0x1ccb32[_0x0b2b('0x23')](_0x17b84e+_0x0b2b('0x24'))&&_0x1ccb32['hasOwnProperty'](_0x17b84e+_0x0b2b('0x25'))){if(_0x1ccb32[_0x17b84e+'Capacity']>0x0&&_0x1ccb32[_0x17b84e+_0x0b2b('0x25')]>=_0x1ccb32[_0x17b84e+'Capacity']){writeLog(_0x344571,_0x1ccb32,_0x17b84e[_0x0b2b('0x26')]()+_0x0b2b('0x27'));return![];}}return!![];};exports[_0x0b2b('0x28')]=function(_0x8c79d3,_0x1a2321,_0x32076b,_0xf98ef,_0x24b5cb){return sendNotification(!![],_0x8c79d3,_0x1a2321,_0x32076b,_0xf98ef,_0x24b5cb);};exports[_0x0b2b('0x29')]=function(_0x53bba9,_0x2de227,_0x3cbfa2,_0x5e8731,_0x43b0ef){return sendNotification(![],_0x53bba9,_0x2de227,_0x3cbfa2,_0x5e8731,_0x43b0ef);};exports[_0x0b2b('0x2a')]=function(_0x30c746,_0x146ca9,_0x30936f){var _0x2474a6=_0x146ca9[_0x0b2b('0x2b')]['UserId'];if(!_0x2474a6&&_0x30936f){_0x2474a6=_0x30936f['id'];}var _0x5c47a4=_[_0x0b2b('0x2c')](_0x30c746[_0x146ca9[_0x0b2b('0x2d')]+_0x0b2b('0x2e')],function(_0x2b92a2){var _0x9913a1=_['capitalize'](_0x146ca9[_0x0b2b('0x2d')])+_0x0b2b('0x2f');return _0x2b92a2[_0x9913a1]===_0x146ca9['interaction']['id'];});if(!_0x5c47a4&&_0x2474a6){_0x5c47a4=_[_0x0b2b('0x2c')](_0x30c746[_0x0b2b('0x30')][_0x2474a6][_0x146ca9[_0x0b2b('0x2d')]+_0x0b2b('0x31')],function(_0x4ca1b9){return _0x4ca1b9['id']===_0x146ca9[_0x0b2b('0x2b')]['id'];});}return _0x5c47a4;};exports[_0x0b2b('0x32')]=function(_0x5d412a,_0x31872a,_0x413004,_0xf4aa1){_0x5d412a[_0x0b2b('0x30')][_0x413004['id']][_0xf4aa1+'WaitingInteractions'][_0x31872a['message']['id']]={'id':_0x31872a[_0x0b2b('0x2b')]['id']};};exports[_0x0b2b('0x33')]=function(_0x1575a6,_0x352365,_0x2ab961,_0x4cd1db){delete _0x1575a6[_0x0b2b('0x30')][_0x2ab961['id']][_0x4cd1db+_0x0b2b('0x31')][_0x352365[_0x0b2b('0x18')]['id']];};exports[_0x0b2b('0x34')]=writeLog;
\ No newline at end of file
index 4ff40a5..9af36ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc9c=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','join','info'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xfc9c,0xb4));var _0xcfc9=function(_0x1ce648,_0x2baf66){_0x1ce648=_0x1ce648-0x0;var _0x108a79=_0xfc9c[_0x1ce648];return _0x108a79;};'use strict';var schema=require(_0xcfc9('0x0'));var sh=require(_0xcfc9('0x1'));var _=require('lodash');var utils=require(_0xcfc9('0x2'));var logger=require('../../../../config/logger')(_0xcfc9('0x3'));var system=schema({'command':{'type':_0xcfc9('0x4'),'required':!![],'message':_0xcfc9('0x5')}});exports[_0xcfc9('0x6')]=function(_0x5afcf8,_0x1004d0){return function(_0x191e8e){try{var _0x44288d={'command':_0x1004d0[0x0]};var _0x30c6c0=system['validate'](_0x44288d,{'typecast':!![]});if(_0x30c6c0['length']){logger[_0xcfc9('0x7')](_0xcfc9('0x8'),_0x5afcf8,_[_0xcfc9('0x9')](_0x30c6c0,'message')[_0xcfc9('0xa')](',\x20'));logger[_0xcfc9('0xb')](_0xcfc9('0xc'),_0x5afcf8);_0x191e8e[_0xcfc9('0xd')]();}else{var _0x3b43cb=this;var _0x32d4cf=utils['getMustacheRender'](_0x1004d0[0x0],this);logger[_0xcfc9('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5afcf8,_0x32d4cf);sh['exec'](_[_0xcfc9('0xe')](_0x32d4cf),function(_0x4338fc,_0x538c31){logger[_0xcfc9('0xb')](_0xcfc9('0xf'),_0x5afcf8,_0x4338fc);if(_0x4338fc==0x0){var _0x59d76a=_0x538c31[_0xcfc9('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xcfc9('0x11')](_0x1004d0[0x1])||_[_0xcfc9('0x12')](_0x1004d0[0x1])){logger[_0xcfc9('0xb')](_0xcfc9('0x13'),_0x5afcf8);_0x3b43cb[_0xcfc9('0x14')][_0x1004d0[0x1]]=_0x59d76a;}else{logger[_0xcfc9('0xb')](_0xcfc9('0x15'),_0x5afcf8,_0x1004d0[0x1],_0x59d76a);_0x3b43cb['body'][_0x1004d0[0x1]]=_0x59d76a;}}_0x191e8e[_0xcfc9('0xd')]();});}}catch(_0x553159){logger[_0xcfc9('0x7')]('[%s][SYSTEM]\x20%s',_0x5afcf8,_[_0xcfc9('0x16')](_0x553159)?JSON[_0xcfc9('0x17')](_0x553159):_0x553159);logger[_0xcfc9('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5afcf8);_0x191e8e[_0xcfc9('0xd')]();}};};
\ No newline at end of file
+var _0xe07c=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xe07c,0x1f3));var _0xce07=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe07c[_0x27af45];return _0x18df21;};'use strict';var schema=require(_0xce07('0x0'));var sh=require(_0xce07('0x1'));var _=require(_0xce07('0x2'));var utils=require(_0xce07('0x3'));var logger=require(_0xce07('0x4'))(_0xce07('0x5'));var system=schema({'command':{'type':_0xce07('0x6'),'required':!![],'message':_0xce07('0x7')}});exports['consequence']=function(_0x337b78,_0x1bf2a8){return function(_0x1a871c){try{var _0x220497={'command':_0x1bf2a8[0x0]};var _0x402ce1=system[_0xce07('0x0')](_0x220497,{'typecast':!![]});if(_0x402ce1[_0xce07('0x8')]){logger[_0xce07('0x9')](_0xce07('0xa'),_0x337b78,_[_0xce07('0xb')](_0x402ce1,_0xce07('0xc'))[_0xce07('0xd')](',\x20'));logger[_0xce07('0xe')](_0xce07('0xf'),_0x337b78);_0x1a871c[_0xce07('0x10')]();}else{var _0x140c3e=this;var _0x57d108=utils[_0xce07('0x11')](_0x1bf2a8[0x0],this);logger[_0xce07('0xe')](_0xce07('0x12'),_0x337b78,_0x57d108);sh['exec'](_[_0xce07('0x13')](_0x57d108),function(_0x3c5c37,_0x44a16f){logger[_0xce07('0xe')](_0xce07('0x14'),_0x337b78,_0x3c5c37);if(_0x3c5c37==0x0){var _0x487732=_0x44a16f[_0xce07('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0xce07('0x16')](_0x1bf2a8[0x1])||_[_0xce07('0x17')](_0x1bf2a8[0x1])){logger[_0xce07('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x337b78);_0x140c3e['body'][_0x1bf2a8[0x1]]=_0x487732;}else{logger[_0xce07('0xe')](_0xce07('0x18'),_0x337b78,_0x1bf2a8[0x1],_0x487732);_0x140c3e['body'][_0x1bf2a8[0x1]]=_0x487732;}}_0x1a871c[_0xce07('0x10')]();});}}catch(_0x1d0171){logger['error']('[%s][SYSTEM]\x20%s',_0x337b78,_[_0xce07('0x19')](_0x1d0171)?JSON[_0xce07('0x1a')](_0x1d0171):_0x1d0171);logger[_0xce07('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x337b78);_0x1a871c[_0xce07('0x10')]();}};};
\ No newline at end of file
index b34a4f4..e7bb7ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b3c=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','stringify','finally','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x2e96ee,_0x3ecaf5){var _0x499d0f=function(_0x241813){while(--_0x241813){_0x2e96ee['push'](_0x2e96ee['shift']());}};_0x499d0f(++_0x3ecaf5);}(_0x2b3c,0xa7));var _0xc2b3=function(_0x53d3cb,_0x2148b8){_0x53d3cb=_0x53d3cb-0x0;var _0x47b552=_0x2b3c[_0x53d3cb];return _0x47b552;};'use strict';var schema=require(_0xc2b3('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xc2b3('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc2b3('0x2')),'mailInteraction':require(_0xc2b3('0x3')),'faxInteraction':require(_0xc2b3('0x4')),'whatsappInteraction':require(_0xc2b3('0x5'))};var logger=require(_0xc2b3('0x6'))(_0xc2b3('0x7'));var tag=schema({'tag':{'type':_0xc2b3('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xc2b3('0x9')]=function(_0x2aa6e7,_0x1d0466,_0x5ce32d,_0x2c4b35){return function(_0xc078fa){try{var _0x16ca0e={'tag':_0x1d0466[0x0]};var _0xd8b09a=tag['validate'](_0x16ca0e,{'typecast':!![]});if(_0xd8b09a[_0xc2b3('0xa')]){logger[_0xc2b3('0xb')](_0xc2b3('0xc'),_0x2aa6e7,_[_0xc2b3('0xd')](_0xd8b09a,_0xc2b3('0xe'))['join'](',\x20'));logger[_0xc2b3('0xf')](_0xc2b3('0x10'),_0x2aa6e7);_0xc078fa[_0xc2b3('0x11')]();}else{var _0x52cdb8={'ids':[_0x1d0466[0x0]]};if(rpc[_0x2c4b35[_0xc2b3('0x12')]+_0xc2b3('0x13')]){rpc[_0x2c4b35['channel']+_0xc2b3('0x13')][_0xc2b3('0x14')](_0x2c4b35[_0xc2b3('0x15')]['id'],_0x52cdb8)[_0xc2b3('0x16')](function(_0x135725){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2aa6e7,_0x1d0466[0x1],_0x2c4b35[_0xc2b3('0x12')],_0x2c4b35[_0xc2b3('0x15')]['id']);})[_0xc2b3('0x17')](function(_0x430389){logger[_0xc2b3('0xb')](_0xc2b3('0xc'),_0x2aa6e7,JSON[_0xc2b3('0x18')](_0x430389));logger[_0xc2b3('0xf')](_0xc2b3('0x10'),_0x2aa6e7);})[_0xc2b3('0x19')](function(){_0xc078fa['next']();});}}}catch(_0x273e6f){logger[_0xc2b3('0xb')](_0xc2b3('0xc'),_0x2aa6e7,_['isObject'](_0x273e6f)?JSON[_0xc2b3('0x18')](_0x273e6f):_0x273e6f);logger[_0xc2b3('0xf')](_0xc2b3('0x10'),_0x2aa6e7);_0xc078fa[_0xc2b3('0x11')]();}};};
\ No newline at end of file
+var _0x834e=['interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x834e,0x18c));var _0xe834=function(_0x3a45b7,_0x2f4d40){_0x3a45b7=_0x3a45b7-0x0;var _0xa9782d=_0x834e[_0x3a45b7];return _0xa9782d;};'use strict';var schema=require(_0xe834('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe834('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xe834('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe834('0x3')),'whatsappInteraction':require(_0xe834('0x4'))};var logger=require('../../../../config/logger')(_0xe834('0x5'));var tag=schema({'tag':{'type':_0xe834('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xe834('0x7')]=function(_0x74ea76,_0x96fc2f,_0x4822ab,_0x5de8f0){return function(_0x4aed70){try{var _0x37cff8={'tag':_0x96fc2f[0x0]};var _0x2d3638=tag[_0xe834('0x0')](_0x37cff8,{'typecast':!![]});if(_0x2d3638[_0xe834('0x8')]){logger[_0xe834('0x9')](_0xe834('0xa'),_0x74ea76,_[_0xe834('0xb')](_0x2d3638,'message')['join'](',\x20'));logger[_0xe834('0xc')](_0xe834('0xd'),_0x74ea76);_0x4aed70[_0xe834('0xe')]();}else{var _0x4df2e2={'ids':[_0x96fc2f[0x0]]};if(rpc[_0x5de8f0['channel']+_0xe834('0xf')]){rpc[_0x5de8f0[_0xe834('0x10')]+_0xe834('0xf')][_0xe834('0x11')](_0x5de8f0[_0xe834('0x12')]['id'],_0x4df2e2)['then'](function(_0x45ba31){logger[_0xe834('0xc')](_0xe834('0x13'),_0x74ea76,_0x96fc2f[0x1],_0x5de8f0[_0xe834('0x10')],_0x5de8f0[_0xe834('0x12')]['id']);})[_0xe834('0x14')](function(_0x3bdd4e){logger[_0xe834('0x9')]('[%s][TAG]\x20%s',_0x74ea76,JSON[_0xe834('0x15')](_0x3bdd4e));logger[_0xe834('0xc')](_0xe834('0xd'),_0x74ea76);})['finally'](function(){_0x4aed70[_0xe834('0xe')]();});}}}catch(_0x1e5aab){logger[_0xe834('0x9')](_0xe834('0xa'),_0x74ea76,_[_0xe834('0x16')](_0x1e5aab)?JSON[_0xe834('0x15')](_0x1e5aab):_0x1e5aab);logger['info'](_0xe834('0xd'),_0x74ea76);_0x4aed70[_0xe834('0xe')]();}};};
\ No newline at end of file
index 872aef9..ef20937 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe64=['params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','request-promise','routing','lodash','consequence','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method'];(function(_0x4e6512,_0x22579b){var _0x53566f=function(_0x4cc6b2){while(--_0x4cc6b2){_0x4e6512['push'](_0x4e6512['shift']());}};_0x53566f(++_0x22579b);}(_0xbe64,0x64));var _0x4be6=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xbe64[_0x4849f6];return _0x1a3dcd;};'use strict';var rp=require(_0x4be6('0x0'));var logger=require('../../../../config/logger')(_0x4be6('0x1'));var _=require(_0x4be6('0x2'));var arr=[];exports[_0x4be6('0x3')]=function(_0x2fca97,_0x3d4437){return function(_0x54b808){var _0x199e0c=_0x3d4437[0xa];var _0x63a2=_0x3d4437[0xb];var _0x48e67d=_0x3d4437[0xc];var _0x262a0e=_0x3d4437[0xd];var _0x27fe58=_0x3d4437[0xe];var _0x49d7d3=_0x3d4437[0xf]['replace'](/\n/g,_0x4be6('0x4'));var _0x448f76=_0x3d4437[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x63a2)){arr[_0x4be6('0x5')](_0x63a2);var _0x2242c3=_0x3d4437[0x3];var _0x20b491=_0x3d4437[0x4];var _0x28765b=_0x3d4437[0x1];var _0x4a1d79=_0x3d4437[0x0];var _0xd12887={};_0xd12887[_0x4be6('0x6')]=_0x3d4437[0x8]+_0x4be6('0x7')+_0x48e67d+'|'+_0x199e0c+'|'+_0x262a0e+'|'+_0x63a2+'|'+_0x27fe58;_0xd12887[_0x4be6('0x8')]=_0x3d4437[0x7]+'?params='+_0x48e67d+'|'+_0x199e0c+'|'+_0x262a0e+'|'+_0x63a2+'|'+_0x27fe58+'|'+_0x49d7d3+'|'+_0x448f76;_0xd12887['title']=_0x3d4437[0x9];var _0x339945={};_0x339945[_0x4be6('0x9')]=_0x4be6('0xa');_0x339945[_0x4be6('0xb')]='login';var _0x59ab56=[];_0x59ab56['push'](_0x3d4437[0x2]);_0x59ab56['push'](_0x3d4437[0x5]);_0x59ab56[_0x4be6('0x5')](_0x3d4437[0x6]);_0x339945[_0x4be6('0xc')]=_0x59ab56;_0x339945['id']=0x1;var _0x3a533f=JSON[_0x4be6('0xd')](_0x339945);var _0xd90e70={'encoding':_0x4be6('0xe'),'method':'POST','timeout':0x2710,'url':_0x2242c3,'headers':{'Content-Type':'application/json-rpc'},'body':_0x3a533f};return rp(_0xd90e70)[_0x4be6('0xf')](function(_0x92a71c){const _0x25eb56=JSON[_0x4be6('0x10')](_0x92a71c);if(!_0x25eb56[_0x4be6('0x11')][_0x4be6('0x12')]){throw new Error(_0x4be6('0x13'));}var _0x3cbdc0=_0x63a2;var _0x18315b='channelId='+_0x28765b+_0x4be6('0x14')+_0x4a1d79+'&sessionId='+_0x3cbdc0+_0x4be6('0x15')+JSON['stringify'](_0xd12887);var _0xe7b079=_0x20b491+'?'+_0x18315b;return rp(_0xe7b079);})[_0x4be6('0xf')](function(_0x339bb8){logger[_0x4be6('0x16')](_0x4be6('0x17'),_0x2fca97,_0x339bb8);_0x54b808[_0x4be6('0x18')]();})['catch'](function(_0x479d59){logger[_0x4be6('0x19')](_0x4be6('0x1a'),_0x2fca97,_[_0x4be6('0x1b')](_0x479d59)?JSON[_0x4be6('0xd')](_0x479d59):_0x479d59);_0x54b808[_0x4be6('0x18')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2fca97);_0x54b808['next']();}};};
\ No newline at end of file
+var _0xf790=['parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','?params=','title','jsonrpc','2.0','login','params','stringify','utf8','application/json-rpc','then'];(function(_0xbb46f9,_0x259741){var _0x212134=function(_0x5d4236){while(--_0x5d4236){_0xbb46f9['push'](_0xbb46f9['shift']());}};_0x212134(++_0x259741);}(_0xf790,0x19b));var _0x0f79=function(_0x846538,_0x569f00){_0x846538=_0x846538-0x0;var _0x40c2a1=_0xf790[_0x846538];return _0x40c2a1;};'use strict';var rp=require(_0x0f79('0x0'));var logger=require(_0x0f79('0x1'))('routing');var _=require(_0x0f79('0x2'));var arr=[];exports[_0x0f79('0x3')]=function(_0x17d741,_0x28fa40){return function(_0x5255b2){var _0x5a399d=_0x28fa40[0xa];var _0x1005f7=_0x28fa40[0xb];var _0x526581=_0x28fa40[0xc];var _0x318c85=_0x28fa40[0xd];var _0x26ba5f=_0x28fa40[0xe];var _0x412ad5=_0x28fa40[0xf][_0x0f79('0x4')](/\n/g,_0x0f79('0x5'));var _0x5c6682=_0x28fa40[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x0f79('0x6')](_0x1005f7)){arr[_0x0f79('0x7')](_0x1005f7);var _0x8ad7e8=_0x28fa40[0x3];var _0x56fc82=_0x28fa40[0x4];var _0x3f3be6=_0x28fa40[0x1];var _0x1a0d27=_0x28fa40[0x0];var _0x1298de={};_0x1298de['urlOnAnswer']=_0x28fa40[0x8]+'?params='+_0x526581+'|'+_0x5a399d+'|'+_0x318c85+'|'+_0x1005f7+'|'+_0x26ba5f;_0x1298de['urlOnRing']=_0x28fa40[0x7]+_0x0f79('0x8')+_0x526581+'|'+_0x5a399d+'|'+_0x318c85+'|'+_0x1005f7+'|'+_0x26ba5f+'|'+_0x412ad5+'|'+_0x5c6682;_0x1298de[_0x0f79('0x9')]=_0x28fa40[0x9];var _0x24e763={};_0x24e763[_0x0f79('0xa')]=_0x0f79('0xb');_0x24e763['method']=_0x0f79('0xc');var _0x40fd8b=[];_0x40fd8b[_0x0f79('0x7')](_0x28fa40[0x2]);_0x40fd8b['push'](_0x28fa40[0x5]);_0x40fd8b[_0x0f79('0x7')](_0x28fa40[0x6]);_0x24e763[_0x0f79('0xd')]=_0x40fd8b;_0x24e763['id']=0x1;var _0x184471=JSON[_0x0f79('0xe')](_0x24e763);var _0x1ed72a={'encoding':_0x0f79('0xf'),'method':'POST','timeout':0x2710,'url':_0x8ad7e8,'headers':{'Content-Type':_0x0f79('0x10')},'body':_0x184471};return rp(_0x1ed72a)[_0x0f79('0x11')](function(_0x2ae810){const _0x4d23ef=JSON[_0x0f79('0x12')](_0x2ae810);if(!_0x4d23ef['result'][_0x0f79('0x13')]){throw new Error(_0x0f79('0x14'));}var _0xc2532f=_0x1005f7;var _0x43289e=_0x0f79('0x15')+_0x3f3be6+_0x0f79('0x16')+_0x1a0d27+_0x0f79('0x17')+_0xc2532f+_0x0f79('0x18')+JSON[_0x0f79('0xe')](_0x1298de);var _0x3504ab=_0x56fc82+'?'+_0x43289e;return rp(_0x3504ab);})[_0x0f79('0x11')](function(_0x4da8a7){logger[_0x0f79('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x17d741,_0x4da8a7);_0x5255b2[_0x0f79('0x1a')]();})[_0x0f79('0x1b')](function(_0x3b4cf3){logger[_0x0f79('0x1c')](_0x0f79('0x1d'),_0x17d741,_[_0x0f79('0x1e')](_0x3b4cf3)?JSON[_0x0f79('0xe')](_0x3b4cf3):_0x3b4cf3);_0x5255b2[_0x0f79('0x1a')]();});}else{logger[_0x0f79('0x19')](_0x0f79('0x1f'),_0x17d741);_0x5255b2[_0x0f79('0x20')]();}};};
\ No newline at end of file
index ff111c8..b14ef79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x470a5e,_0x5aab22){var _0xa29187=function(_0x2f44a8){while(--_0x2f44a8){_0x470a5e['push'](_0x470a5e['shift']());}};_0xa29187(++_0x5aab22);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}};
\ No newline at end of file
+var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x8da167,_0x333ddb){var _0x2f451b=function(_0x7410be){while(--_0x7410be){_0x8da167['push'](_0x8da167['shift']());}};_0x2f451b(++_0x333ddb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}};
\ No newline at end of file
index 2835f78..ab7f94b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe555=['app','.js','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','error','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','name','paused','mailQueues','available','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join'];(function(_0x4a5531,_0xe35c69){var _0xd8670f=function(_0xa4493d){while(--_0xa4493d){_0x4a5531['push'](_0x4a5531['shift']());}};_0xd8670f(++_0xe35c69);}(_0xe555,0x1d8));var _0x5e55=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xe555[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x5e55('0x0'));var util=require(_0x5e55('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x5e55('0x2'));var utils=require(_0x5e55('0x3'));var sUtils=require(_0x5e55('0x4'));var logger=require('../../../config/logger')(_0x5e55('0x5'));var rpc={'openchannelQueueReport':require(_0x5e55('0x6')),'mailQueueReport':require(_0x5e55('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x5e55('0x8')),'faxQueueReport':require(_0x5e55('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x5e55('0xa'));function getId(_0x2570d7,_0x10a306,_0x13bea8){return util[_0x5e55('0xb')](_0x5e55('0xc'),_0x2570d7,_0x10a306||0x0,_0x13bea8||0x0);}function getIntervals(_0x3b71c1,_0xd76cb8){var _0x1063ac=[];if(!_[_0x5e55('0xd')](_0xd76cb8[_0x5e55('0xe')])&&!_[_0x5e55('0xd')](_0x3b71c1[_0xd76cb8['IntervalId']])&&!_[_0x5e55('0xd')](_0x3b71c1[_0xd76cb8[_0x5e55('0xe')]][_0x5e55('0xf')])){_0x1063ac=_[_0x5e55('0x10')](_0x3b71c1[_0xd76cb8[_0x5e55('0xe')]][_0x5e55('0xf')],_0x5e55('0x11'));}else if(!_[_0x5e55('0xd')](_0xd76cb8['interval'])){_0x1063ac=[_0xd76cb8[_0x5e55('0x11')]];}return _0x1063ac;}exports['listen']=function(_0x5701ac){_0x5701ac[_0x5e55('0x12')]={};return new BPromise(function(_0x445db1,_0x15a513){var _0x43bd9a={'Start':function(_0x2941a1){var _0xde2154=this;return new Promise(function(_0x4e0aa2,_0x59ff56){if(_0x2941a1){try{var _0x4b2213=[];var _0x5f1acf=getId(_0x2941a1[_0x5e55('0x13')],_0x2941a1['message']?_0x2941a1[_0x5e55('0x14')]['id']:0x0,_0x2941a1[_0x5e55('0x15')]?_0x2941a1['interaction']['id']:0x0);var _0x4646b6=sUtils[_0x5e55('0x16')](_0x5701ac,_0x2941a1);if(!_0x4646b6&&_0x2941a1[_0x5e55('0x17')]&&_[_0x5e55('0x18')](_0x2941a1[_0x5e55('0x17')])&&_0x2941a1[_0x5e55('0x17')][_0x5e55('0x19')]){for(var _0x58ea0d=0x0;_0x58ea0d<_0x2941a1[_0x5e55('0x17')][_0x5e55('0x19')];_0x58ea0d+=0x1){var _0x4ae9f0=_0x2941a1[_0x5e55('0x17')][_0x58ea0d];if(fs[_0x5e55('0x1a')](path[_0x5e55('0x1b')](__dirname,'applications',_0x4ae9f0[_0x5e55('0x1c')]+_0x5e55('0x1d')))){var _0x5dbeb9=[];switch(_0x4ae9f0['app']['toLowerCase']()){case _0x5e55('0x1e'):var _0x5e78f4=_0x4ae9f0[_0x5e55('0x1f')][_0x5e55('0x20')](',');if(_0x2941a1[_0x5e55('0x13')]===_0x5e55('0x21')){_0x5dbeb9[_0x5e55('0x22')](_0x5e78f4[0x0]);_0x5dbeb9[_0x5e55('0x22')](_0x5e78f4[0x1]);_0x5dbeb9[_0x5e55('0x22')](_0x5e78f4[_0x5e55('0x23')](0x2,_0x5e78f4[_0x5e55('0x19')])[_0x5e55('0x1b')](','));}else{_0x5dbeb9[_0x5e55('0x22')](_0x5e78f4[0x0]);_0x5dbeb9['push'](_0x5e78f4[_0x5e55('0x23')](0x1,_0x5e78f4['length'])[_0x5e55('0x1b')](','));}break;case'dialogflow':var _0x2e6fdc=_0x4ae9f0[_0x5e55('0x1f')][_0x5e55('0x20')](',');_0x5dbeb9[_0x5e55('0x22')](_0x2e6fdc[0x0]);_0x5dbeb9[_0x5e55('0x22')](_0x2e6fdc[0x1]);_0x5dbeb9[_0x5e55('0x22')](_0x2e6fdc[_0x5e55('0x23')](0x2,_0x2e6fdc[_0x5e55('0x19')])[_0x5e55('0x1b')](','));break;case _0x5e55('0x24'):var _0x100646=_0x4ae9f0['appdata']['split'](',');_0x5dbeb9[_0x5e55('0x22')](_0x100646[0x0]);_0x5dbeb9[_0x5e55('0x22')](_0x100646[0x1]);_0x5dbeb9[_0x5e55('0x22')](_0x100646[0x2]);_0x5dbeb9[_0x5e55('0x22')](_0x100646[0x3]);_0x5dbeb9[_0x5e55('0x22')](_0x100646[_0x5e55('0x23')](0x4,_0x100646['length'])['join'](','));break;case _0x5e55('0x25'):var _0x5abcfb=_0x4ae9f0[_0x5e55('0x1f')][_0x5e55('0x20')](',');_0x5dbeb9[_0x5e55('0x22')](_0x5abcfb[0x0]);_0x5dbeb9[_0x5e55('0x22')](_0x5abcfb[0x1]);_0x5dbeb9[_0x5e55('0x22')](_0x5abcfb[0x2]);_0x5dbeb9[_0x5e55('0x22')](_0x5abcfb[0x3]);_0x5dbeb9[_0x5e55('0x22')](_0x5abcfb['slice'](0x4,_0x5abcfb[_0x5e55('0x19')])[_0x5e55('0x1b')](','));break;case _0x5e55('0x14'):_0x5dbeb9[_0x5e55('0x22')](_0x4ae9f0[_0x5e55('0x1f')]);break;case _0x5e55('0x26'):_0x5dbeb9[_0x5e55('0x22')](_0x4ae9f0[_0x5e55('0x27')]);_0x5dbeb9['push'](_0x4ae9f0[_0x5e55('0x1f')]);break;case _0x5e55('0x28'):var _0xf66a87=utils['getMustacheRender'](_0x2941a1[_0x5e55('0x29')][_0x5e55('0x2a')],_0x2941a1);var _0x38e0ef=_0x4ae9f0['appdata']['split'](',');_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x0]);_0x5dbeb9['push'](_0x38e0ef[0x1]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x2]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x3]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x4]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x5]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x6]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x7]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x8]);_0x5dbeb9[_0x5e55('0x22')](_0x38e0ef[0x9]);_0x5dbeb9['push'](_0x38e0ef[0xa]);_0x5dbeb9['push'](_0x2941a1[_0x5e55('0x15')]['id']);_0x5dbeb9['push'](_0x2941a1[_0x5e55('0x14')]['id']);_0x5dbeb9[_0x5e55('0x22')](_0x4ae9f0[_0x5e55('0x2b')]);_0x5dbeb9[_0x5e55('0x22')](_0x2941a1[_0x5e55('0x15')][_0x5e55('0x2c')]);_0x5dbeb9[_0x5e55('0x22')](_0x2941a1[_0x5e55('0x2d')][_0x5e55('0x2d')]);_0x5dbeb9[_0x5e55('0x22')](_0xf66a87);break;default:_0x5dbeb9=_[_0x5e55('0xd')](_0x4ae9f0[_0x5e55('0x1f')])?[]:_0x4ae9f0[_0x5e55('0x1f')][_0x5e55('0x20')](',');}var _0x3c9f95={'id':util[_0x5e55('0xb')](_0x5e55('0x2e'),_0x5f1acf,_0x4ae9f0['id'],_0x4ae9f0['app']),'condition':require(_0x5e55('0x2f'))['condition'](_0x5f1acf,getIntervals(_0x5701ac[_0x5e55('0x30')],_0x4ae9f0),_0x5701ac),'consequence':require(_0x5e55('0x31')+_0x4ae9f0[_0x5e55('0x1c')])['consequence'](_0x5f1acf,_0x5dbeb9,_0x5701ac,_0x2941a1),'p':_0x4ae9f0[_0x5e55('0x32')]||0x0};logger[_0x5e55('0x33')](_0x5e55('0x34'),_0x3c9f95['id'],'on\x20interval',getIntervals(_0x5701ac[_0x5e55('0x30')],_0x4ae9f0)['join']('\x20|\x20'));_0x4b2213[_0x5e55('0x22')](_0x3c9f95);}else{logger[_0x5e55('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x5e55('0x1b')](__dirname,_0x5e55('0x17'),_0x4ae9f0['app']+_0x5e55('0x1d')));}}_0x5701ac[_0x5e55('0x12')][_0x5f1acf]=new RuleEngine(_0x4b2213);_0x5701ac[_0x5e55('0x12')][_0x5f1acf][_0x5e55('0x36')](_0x2941a1,function(_0x465ab1){logger[_0x5e55('0x33')](_0x5e55('0x37'),JSON['stringify'](_0x465ab1[_0x5e55('0x38')]));if(_0x5701ac[_0x5e55('0x12')][_0x5f1acf]){_0x5701ac[_0x5e55('0x12')][_0x5f1acf][_0x5e55('0x39')](_0x5e55('0x3a'));}});return _0x4e0aa2({'code':0xc8,'message':_0x2941a1});}else{if(_0x4646b6){logger[_0x5e55('0x33')](util[_0x5e55('0xb')](_0x5e55('0x3b'),_0x5f1acf));}else{logger[_0x5e55('0x33')]('No\x20applications\x20to\x20execute');}return _0x4e0aa2({'code':0xc8,'message':_0x2941a1});}}catch(_0x2bbbaf){logger[_0x5e55('0x35')](_0x2bbbaf[_0x5e55('0x3c')]);return _0x59ff56(_0xde2154[_0x5e55('0x35')](0x1f4,_0x2bbbaf));}}return _0x59ff56(_0x5e55('0x3d'));});},'AcceptMessage':function(_0x284148){var _0x1e9945=this;return new Promise(function(_0x381780,_0x49ca64){if(_0x284148[_0x5e55('0x3e')]&&_0x284148['agent']['id']){if(_0x5701ac['agents'][_0x284148[_0x5e55('0x3e')]['id']]){_0x5701ac['agents'][_0x284148[_0x5e55('0x3e')]['id']][_0x5e55('0x3f')]=![];_0x5701ac[_0x5e55('0x40')][_0x284148[_0x5e55('0x3e')]['id']][_0x5e55('0x41')]=undefined;}}if(_0x284148[_0x5e55('0x14')]&&_0x284148[_0x5e55('0x14')]['id']){try{var _0x5c298d=getId(_0x284148[_0x5e55('0x13')],_0x284148[_0x5e55('0x14')]?_0x284148['message']['id']:0x0,_0x284148['interaction']?_0x284148[_0x5e55('0x15')]['id']:0x0);if(_0x5701ac[_0x5e55('0x12')][_0x5c298d]){_0x5701ac[_0x5e55('0x12')][_0x5c298d][_0x5e55('0x39')](_0x5e55('0x42'));if(rpc[_0x284148[_0x5e55('0x13')]+_0x5e55('0x43')]){rpc[_0x284148['channel']+'QueueReport']['update'](_0x5c298d,{'UserId':_0x284148[_0x5e55('0x14')][_0x5e55('0x44')]})['catch'](function(){logger[_0x5e55('0x35')](_0x5e55('0x45'));});}}return _0x381780({'code':0xc8,'message':_0x284148});}catch(_0x48c7aa){logger[_0x5e55('0x35')](_0x48c7aa['stack']);return _0x49ca64(_0x1e9945[_0x5e55('0x35')](0x1f4,_0x48c7aa));}}logger[_0x5e55('0x35')](_0x5e55('0x46'));return _0x49ca64(_0x1e9945[_0x5e55('0x35')](0x1f4,_0x5e55('0x46')));});},'RejectMessage':function(_0xb73fa1){var _0x2985df=this;return new Promise(function(_0x4b12cb,_0x50d48f){if(_0xb73fa1[_0x5e55('0x3e')]&&_0xb73fa1['agent']['id']){try{if(_0x5701ac['agents'][_0xb73fa1['agent']['id']]){_0x5701ac['agents'][_0xb73fa1['agent']['id']][_0x5e55('0x3f')]=![];_0x5701ac[_0x5e55('0x40')][_0xb73fa1[_0x5e55('0x3e')]['id']]['busyQueue']=undefined;}return _0x4b12cb({'code':0xc8,'message':_0xb73fa1});}catch(_0x2c3e0c){logger[_0x5e55('0x35')](_0x2c3e0c[_0x5e55('0x3c')]);return _0x50d48f(_0x2985df['error'](0x1f4,_0x2c3e0c));}}logger['error'](_0x5e55('0x46'));return _0x50d48f(_0x2985df['error'](0x1f4,_0x5e55('0x46')));});},'AbandonInteraction':function(_0x2bc3fe){var _0x187ab1=this;return new Promise(function(_0x4fedca,_0x1f6861){if(_0x2bc3fe[_0x5e55('0x13')]&&_0x2bc3fe[_0x5e55('0x15')]&&_0x2bc3fe[_0x5e55('0x15')]['id']){try{var _0x10236b=getId(_0x2bc3fe[_0x5e55('0x13')],_0x2bc3fe['message']?_0x2bc3fe[_0x5e55('0x14')]['id']:0x0,_0x2bc3fe[_0x5e55('0x15')]?_0x2bc3fe[_0x5e55('0x15')]['id']:0x0);if(_0x5701ac[_0x5e55('0x12')][_0x10236b]){_0x5701ac['rules'][_0x10236b][_0x5e55('0x39')](_0x5e55('0x42'));}return _0x4fedca({'code':0xc8,'message':_0x2bc3fe});}catch(_0xd60e42){logger[_0x5e55('0x35')](_0xd60e42[_0x5e55('0x3c')]);return _0x1f6861(_0x187ab1[_0x5e55('0x35')](0x1f4,_0xd60e42));}}logger[_0x5e55('0x35')](_0x5e55('0x46'));return _0x1f6861(_0x187ab1[_0x5e55('0x35')](0x1f4,_0x5e55('0x46')));});},'AgentCapacity':function(_0x5cb60c){var _0x51b341=this;return new Promise(function(_0x5b15ef,_0x5ed0d8){if(_0x5701ac[_0x5e55('0x40')][_0x5e55('0x47')](_0x5cb60c['id'])){for(var _0xc483b4 in _0x5cb60c[_0x5e55('0x48')]){if(_0x5cb60c[_0x5e55('0x48')]['hasOwnProperty'](_0xc483b4)){if(_0x5701ac['agents'][_0x5cb60c['id']][_0x5e55('0x47')](_0xc483b4+_0x5e55('0x49'))){_0x5701ac[_0x5e55('0x40')][_0x5cb60c['id']][_0xc483b4+_0x5e55('0x49')]=parseInt(_0x5cb60c['capacity'][_0xc483b4],0xa);}}}_0x5701ac[_0x5e55('0x40')][_0x5cb60c['id']][_0x5e55('0x4a')]();return _0x5b15ef({'code':0xc8,'message':_0x5701ac[_0x5e55('0x40')][_0x5cb60c['id']]});}else{return _0x5ed0d8(_0x51b341['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x17c761){return new Promise(function(_0x4641e9){var _0x4b2f94=_[_0x5e55('0x4b')](_0x5701ac[_0x5e55('0x40')]);if(_0x17c761&&_0x17c761['id']){var _0x2700b3=_[_0x5e55('0x4c')](_0x4b2f94,function(_0xb80f78){return _0xb80f78['id']===_0x17c761['id'];});_0x4641e9(_0x2700b3);}else{_0x4641e9({'count':_0x4b2f94[_0x5e55('0x19')],'rows':_0x4b2f94});}});},'ChatQueues':function(){return new Promise(function(_0x502160){var _0x344b04=[];for(var _0x383f1a in _0x5701ac[_0x5e55('0x4d')]){if(_0x5701ac[_0x5e55('0x4d')][_0x5e55('0x47')](_0x383f1a)){var _0x483b5a=_0x5701ac['chatQueues'][_0x383f1a];var _0x3c3fc5={'id':_0x483b5a['id'],'available':_0x483b5a['available'],'loggedIn':_0x483b5a['loggedIn'],'name':_0x483b5a[_0x5e55('0x4e')],'paused':_0x483b5a[_0x5e55('0x4f')],'waiting':_0x483b5a['waiting']};_0x344b04[_0x5e55('0x22')](_0x3c3fc5);}}_0x502160({'count':_0x344b04[_0x5e55('0x19')],'rows':_0x344b04});});},'MailQueues':function(){return new Promise(function(_0x18700e){var _0x1a004f=[];for(var _0xa28ff6 in _0x5701ac['mailQueues']){if(_0x5701ac[_0x5e55('0x50')][_0x5e55('0x47')](_0xa28ff6)){var _0x464488=_0x5701ac[_0x5e55('0x50')][_0xa28ff6];var _0x1088f9={'id':_0x464488['id'],'available':_0x464488[_0x5e55('0x51')],'loggedIn':_0x464488[_0x5e55('0x52')],'name':_0x464488['name'],'paused':_0x464488[_0x5e55('0x4f')],'waiting':_0x464488[_0x5e55('0x53')]};_0x1a004f[_0x5e55('0x22')](_0x1088f9);}}_0x18700e({'count':_0x1a004f['length'],'rows':_0x1a004f});});},'OpenchannelQueues':function(){return new Promise(function(_0xc8ae68){var _0x4a34a7=[];for(var _0x2445e8 in _0x5701ac[_0x5e55('0x54')]){if(_0x5701ac[_0x5e55('0x54')][_0x5e55('0x47')](_0x2445e8)){var _0x162b63=_0x5701ac['openchannelQueues'][_0x2445e8];var _0x3211ad={'id':_0x162b63['id'],'available':_0x162b63['available'],'loggedIn':_0x162b63[_0x5e55('0x52')],'name':_0x162b63[_0x5e55('0x4e')],'paused':_0x162b63[_0x5e55('0x4f')],'waiting':_0x162b63[_0x5e55('0x53')]};_0x4a34a7[_0x5e55('0x22')](_0x3211ad);}}_0xc8ae68({'count':_0x4a34a7[_0x5e55('0x19')],'rows':_0x4a34a7});});},'SmsQueues':function(){return new Promise(function(_0x208927){var _0x1fdf00=[];for(var _0x213125 in _0x5701ac[_0x5e55('0x55')]){if(_0x5701ac[_0x5e55('0x55')][_0x5e55('0x47')](_0x213125)){var _0x32e80c=_0x5701ac[_0x5e55('0x55')][_0x213125];var _0x372ff1={'id':_0x32e80c['id'],'available':_0x32e80c[_0x5e55('0x51')],'loggedIn':_0x32e80c[_0x5e55('0x52')],'name':_0x32e80c[_0x5e55('0x4e')],'paused':_0x32e80c[_0x5e55('0x4f')],'waiting':_0x32e80c[_0x5e55('0x53')]};_0x1fdf00[_0x5e55('0x22')](_0x372ff1);}}_0x208927({'count':_0x1fdf00[_0x5e55('0x19')],'rows':_0x1fdf00});});},'FaxQueues':function(){return new Promise(function(_0x59b842){var _0x11a4fe=[];for(var _0x3509f2 in _0x5701ac[_0x5e55('0x56')]){if(_0x5701ac[_0x5e55('0x56')][_0x5e55('0x47')](_0x3509f2)){var _0x3c44d0=_0x5701ac[_0x5e55('0x56')][_0x3509f2];var _0x569667={'id':_0x3c44d0['id'],'available':_0x3c44d0['available'],'loggedIn':_0x3c44d0[_0x5e55('0x52')],'name':_0x3c44d0[_0x5e55('0x4e')],'paused':_0x3c44d0['paused'],'waiting':_0x3c44d0['waiting']};_0x11a4fe[_0x5e55('0x22')](_0x569667);}}_0x59b842({'count':_0x11a4fe[_0x5e55('0x19')],'rows':_0x11a4fe});});},'WhatsappQueues':function(){return new Promise(function(_0x41b6b1){var _0x4aa352=[];for(var _0xf317ad in _0x5701ac[_0x5e55('0x57')]){if(_0x5701ac[_0x5e55('0x57')][_0x5e55('0x47')](_0xf317ad)){var _0x1c9a48=_0x5701ac[_0x5e55('0x57')][_0xf317ad];var _0xcb47a2={'id':_0x1c9a48['id'],'available':_0x1c9a48[_0x5e55('0x51')],'loggedIn':_0x1c9a48['loggedIn'],'name':_0x1c9a48[_0x5e55('0x4e')],'paused':_0x1c9a48[_0x5e55('0x4f')],'waiting':_0x1c9a48[_0x5e55('0x53')]};_0x4aa352[_0x5e55('0x22')](_0xcb47a2);}}_0x41b6b1({'count':_0x4aa352[_0x5e55('0x19')],'rows':_0x4aa352});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x13063c){var _0xaffeba=_[_0x5e55('0x4b')](_0x5701ac[_0x5e55('0x58')]);_0x13063c({'count':_0xaffeba[_0x5e55('0x19')],'rows':_0xaffeba});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x579898){var _0x406e8b=_['values'](_0x5701ac[_0x5e55('0x59')]);_0x579898({'count':_0x406e8b[_0x5e55('0x19')],'rows':_0x406e8b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x22ec60){var _0x4fbeff=_['values'](_0x5701ac[_0x5e55('0x5a')]);_0x22ec60({'count':_0x4fbeff[_0x5e55('0x19')],'rows':_0x4fbeff});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x17f002){var _0x8fd2fb=_[_0x5e55('0x4b')](_0x5701ac[_0x5e55('0x5b')]);_0x17f002({'count':_0x8fd2fb[_0x5e55('0x19')],'rows':_0x8fd2fb});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x33110a){var _0x4af7fe=_['values'](_0x5701ac[_0x5e55('0x5c')]);_0x33110a({'count':_0x4af7fe[_0x5e55('0x19')],'rows':_0x4af7fe});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xf625a0){var _0x4feb42=_[_0x5e55('0x4b')](_0x5701ac[_0x5e55('0x5d')]);_0xf625a0({'count':_0x4feb42['length'],'rows':_0x4feb42});});}};var _0x1bd172=jayson[_0x5e55('0x5e')](_0x43bd9a)[_0x5e55('0x5f')]();_0x1bd172['on'](_0x5e55('0x35'),function(_0x5d6ae5){logger[_0x5e55('0x35')](JSON[_0x5e55('0x60')](_0x5d6ae5));return _0x15a513(_0x5d6ae5);});_0x1bd172['listen'](0x232c,_0x5e55('0x61'),function(){console[_0x5e55('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x445db1(_0x5e55('0x63')+0x232c);});});};
\ No newline at end of file
+var _0x21c4=['No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','./applications/utils','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','TagId','tvox','account','ChatWebsiteId','body','%s:%s:%s','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x21c4,0x8a));var _0x421c=function(_0x9a29ea,_0x5b8b29){_0x9a29ea=_0x9a29ea-0x0;var _0x11f261=_0x21c4[_0x9a29ea];return _0x11f261;};'use strict';var _=require(_0x421c('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x421c('0x1'));var BPromise=require('bluebird');var utils=require(_0x421c('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0x421c('0x3'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x421c('0x4')),'chatQueueReport':require(_0x421c('0x5')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x421c('0x6')),'whatsappQueueReport':require(_0x421c('0x7'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x58bd14,_0x25c4ee,_0x1b5662){return util[_0x421c('0x8')]('%s.%s.%s',_0x58bd14,_0x25c4ee||0x0,_0x1b5662||0x0);}function getIntervals(_0x5610ba,_0x551ab7){var _0x375660=[];if(!_[_0x421c('0x9')](_0x551ab7[_0x421c('0xa')])&&!_[_0x421c('0x9')](_0x5610ba[_0x551ab7[_0x421c('0xa')]])&&!_[_0x421c('0x9')](_0x5610ba[_0x551ab7[_0x421c('0xa')]][_0x421c('0xb')])){_0x375660=_[_0x421c('0xc')](_0x5610ba[_0x551ab7[_0x421c('0xa')]][_0x421c('0xb')],_0x421c('0xd'));}else if(!_[_0x421c('0x9')](_0x551ab7[_0x421c('0xd')])){_0x375660=[_0x551ab7[_0x421c('0xd')]];}return _0x375660;}exports['listen']=function(_0x21e2a6){_0x21e2a6[_0x421c('0xe')]={};return new BPromise(function(_0x201625,_0x51435b){var _0x389f96={'Start':function(_0x3c090b){var _0x217b39=this;return new Promise(function(_0x5d52eb,_0x3102bc){if(_0x3c090b){try{var _0x2ffcfb=[];var _0x1965f2=getId(_0x3c090b[_0x421c('0xf')],_0x3c090b[_0x421c('0x10')]?_0x3c090b[_0x421c('0x10')]['id']:0x0,_0x3c090b[_0x421c('0x11')]?_0x3c090b[_0x421c('0x11')]['id']:0x0);var _0x1924bd=sUtils[_0x421c('0x12')](_0x21e2a6,_0x3c090b);if(!_0x1924bd&&_0x3c090b['applications']&&_[_0x421c('0x13')](_0x3c090b['applications'])&&_0x3c090b[_0x421c('0x14')]['length']){for(var _0xb49b48=0x0;_0xb49b48<_0x3c090b[_0x421c('0x14')][_0x421c('0x15')];_0xb49b48+=0x1){var _0x3df09b=_0x3c090b['applications'][_0xb49b48];if(fs[_0x421c('0x16')](path[_0x421c('0x17')](__dirname,_0x421c('0x14'),_0x3df09b[_0x421c('0x18')]+_0x421c('0x19')))){var _0x575553=[];switch(_0x3df09b[_0x421c('0x18')][_0x421c('0x1a')]()){case'autoreply':var _0x371fe3=_0x3df09b[_0x421c('0x1b')][_0x421c('0x1c')](',');if(_0x3c090b[_0x421c('0xf')]==='mail'){_0x575553[_0x421c('0x1d')](_0x371fe3[0x0]);_0x575553[_0x421c('0x1d')](_0x371fe3[0x1]);_0x575553['push'](_0x371fe3[_0x421c('0x1e')](0x2,_0x371fe3[_0x421c('0x15')])['join'](','));}else{_0x575553[_0x421c('0x1d')](_0x371fe3[0x0]);_0x575553[_0x421c('0x1d')](_0x371fe3['slice'](0x1,_0x371fe3[_0x421c('0x15')])[_0x421c('0x17')](','));}break;case _0x421c('0x1f'):var _0x1d5ed7=_0x3df09b[_0x421c('0x1b')][_0x421c('0x1c')](',');_0x575553['push'](_0x1d5ed7[0x0]);_0x575553[_0x421c('0x1d')](_0x1d5ed7[0x1]);_0x575553['push'](_0x1d5ed7[_0x421c('0x1e')](0x2,_0x1d5ed7[_0x421c('0x15')])['join'](','));break;case _0x421c('0x20'):var _0x3bb3d6=_0x3df09b[_0x421c('0x1b')][_0x421c('0x1c')](',');_0x575553['push'](_0x3bb3d6[0x0]);_0x575553[_0x421c('0x1d')](_0x3bb3d6[0x1]);_0x575553[_0x421c('0x1d')](_0x3bb3d6[0x2]);_0x575553[_0x421c('0x1d')](_0x3bb3d6[0x3]);_0x575553[_0x421c('0x1d')](_0x3bb3d6[_0x421c('0x1e')](0x4,_0x3bb3d6['length'])[_0x421c('0x17')](','));break;case'amazonlex':var _0x424117=_0x3df09b[_0x421c('0x1b')][_0x421c('0x1c')](',');_0x575553[_0x421c('0x1d')](_0x424117[0x0]);_0x575553['push'](_0x424117[0x1]);_0x575553['push'](_0x424117[0x2]);_0x575553[_0x421c('0x1d')](_0x424117[0x3]);_0x575553[_0x421c('0x1d')](_0x424117['slice'](0x4,_0x424117['length'])[_0x421c('0x17')](','));break;case _0x421c('0x10'):_0x575553[_0x421c('0x1d')](_0x3df09b['appdata']);break;case'tag':_0x575553[_0x421c('0x1d')](_0x3df09b[_0x421c('0x21')]);_0x575553['push'](_0x3df09b[_0x421c('0x1b')]);break;case _0x421c('0x22'):var _0x187f1c=utils['getMustacheRender'](_0x3c090b[_0x421c('0x23')]['notificationTemplate'],_0x3c090b);var _0x9a9785=_0x3df09b[_0x421c('0x1b')]['split'](',');_0x575553[_0x421c('0x1d')](_0x9a9785[0x0]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x1]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x2]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x3]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x4]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x5]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x6]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x7]);_0x575553['push'](_0x9a9785[0x8]);_0x575553[_0x421c('0x1d')](_0x9a9785[0x9]);_0x575553[_0x421c('0x1d')](_0x9a9785[0xa]);_0x575553['push'](_0x3c090b[_0x421c('0x11')]['id']);_0x575553[_0x421c('0x1d')](_0x3c090b[_0x421c('0x10')]['id']);_0x575553[_0x421c('0x1d')](_0x3df09b[_0x421c('0x24')]);_0x575553[_0x421c('0x1d')](_0x3c090b['interaction']['ContactId']);_0x575553[_0x421c('0x1d')](_0x3c090b[_0x421c('0x25')][_0x421c('0x25')]);_0x575553['push'](_0x187f1c);break;default:_0x575553=_['isNil'](_0x3df09b[_0x421c('0x1b')])?[]:_0x3df09b[_0x421c('0x1b')][_0x421c('0x1c')](',');}var _0x437746={'id':util[_0x421c('0x8')](_0x421c('0x26'),_0x1965f2,_0x3df09b['id'],_0x3df09b['app']),'condition':require('./interval')['condition'](_0x1965f2,getIntervals(_0x21e2a6[_0x421c('0x27')],_0x3df09b),_0x21e2a6),'consequence':require(_0x421c('0x28')+_0x3df09b[_0x421c('0x18')])[_0x421c('0x29')](_0x1965f2,_0x575553,_0x21e2a6,_0x3c090b),'p':_0x3df09b[_0x421c('0x2a')]||0x0};logger[_0x421c('0x2b')](_0x421c('0x2c'),_0x437746['id'],'on\x20interval',getIntervals(_0x21e2a6[_0x421c('0x27')],_0x3df09b)[_0x421c('0x17')](_0x421c('0x2d')));_0x2ffcfb[_0x421c('0x1d')](_0x437746);}else{logger[_0x421c('0x2e')](_0x421c('0x2f'),path[_0x421c('0x17')](__dirname,_0x421c('0x14'),_0x3df09b['app']+_0x421c('0x19')));}}_0x21e2a6[_0x421c('0xe')][_0x1965f2]=new RuleEngine(_0x2ffcfb);_0x21e2a6[_0x421c('0xe')][_0x1965f2][_0x421c('0x30')](_0x3c090b,function(_0x26c5f3){logger['info'](_0x421c('0x31'),JSON[_0x421c('0x32')](_0x26c5f3['matchPath']));if(_0x21e2a6[_0x421c('0xe')][_0x1965f2]){_0x21e2a6[_0x421c('0xe')][_0x1965f2][_0x421c('0x33')](_0x421c('0x34'));}});return _0x5d52eb({'code':0xc8,'message':_0x3c090b});}else{if(_0x1924bd){logger[_0x421c('0x2b')](util[_0x421c('0x8')](_0x421c('0x35'),_0x1965f2));}else{logger[_0x421c('0x2b')](_0x421c('0x36'));}return _0x5d52eb({'code':0xc8,'message':_0x3c090b});}}catch(_0x382951){logger[_0x421c('0x2e')](_0x382951[_0x421c('0x37')]);return _0x3102bc(_0x217b39['error'](0x1f4,_0x382951));}}return _0x3102bc(_0x421c('0x38'));});},'AcceptMessage':function(_0x1d262b){var _0x496626=this;return new Promise(function(_0x59cd13,_0xe97a03){if(_0x1d262b['agent']&&_0x1d262b[_0x421c('0x39')]['id']){if(_0x21e2a6[_0x421c('0x3a')][_0x1d262b[_0x421c('0x39')]['id']]){_0x21e2a6['agents'][_0x1d262b[_0x421c('0x39')]['id']][_0x421c('0x3b')]=![];_0x21e2a6[_0x421c('0x3a')][_0x1d262b[_0x421c('0x39')]['id']]['busyQueue']=undefined;}}if(_0x1d262b[_0x421c('0x10')]&&_0x1d262b[_0x421c('0x10')]['id']){try{var _0x308ca2=getId(_0x1d262b['channel'],_0x1d262b[_0x421c('0x10')]?_0x1d262b[_0x421c('0x10')]['id']:0x0,_0x1d262b[_0x421c('0x11')]?_0x1d262b[_0x421c('0x11')]['id']:0x0);if(_0x21e2a6[_0x421c('0xe')][_0x308ca2]){_0x21e2a6[_0x421c('0xe')][_0x308ca2][_0x421c('0x33')]('end');if(rpc[_0x1d262b[_0x421c('0xf')]+_0x421c('0x3c')]){rpc[_0x1d262b['channel']+_0x421c('0x3c')]['update'](_0x308ca2,{'UserId':_0x1d262b['message']['UserId']})['catch'](function(){logger[_0x421c('0x2e')](_0x421c('0x3d'));});}}return _0x59cd13({'code':0xc8,'message':_0x1d262b});}catch(_0x5286ac){logger[_0x421c('0x2e')](_0x5286ac[_0x421c('0x37')]);return _0xe97a03(_0x496626[_0x421c('0x2e')](0x1f4,_0x5286ac));}}logger['error'](_0x421c('0x3e'));return _0xe97a03(_0x496626[_0x421c('0x2e')](0x1f4,_0x421c('0x3e')));});},'RejectMessage':function(_0x5e340e){var _0x383ed5=this;return new Promise(function(_0x9c6fb9,_0x34420b){if(_0x5e340e[_0x421c('0x39')]&&_0x5e340e['agent']['id']){try{if(_0x21e2a6['agents'][_0x5e340e[_0x421c('0x39')]['id']]){_0x21e2a6[_0x421c('0x3a')][_0x5e340e[_0x421c('0x39')]['id']][_0x421c('0x3b')]=![];_0x21e2a6[_0x421c('0x3a')][_0x5e340e[_0x421c('0x39')]['id']][_0x421c('0x3f')]=undefined;}return _0x9c6fb9({'code':0xc8,'message':_0x5e340e});}catch(_0x5bfa6f){logger[_0x421c('0x2e')](_0x5bfa6f[_0x421c('0x37')]);return _0x34420b(_0x383ed5[_0x421c('0x2e')](0x1f4,_0x5bfa6f));}}logger[_0x421c('0x2e')](_0x421c('0x3e'));return _0x34420b(_0x383ed5[_0x421c('0x2e')](0x1f4,_0x421c('0x3e')));});},'AbandonInteraction':function(_0x1c3de1){var _0x342595=this;return new Promise(function(_0x59f4e4,_0x43e8fc){if(_0x1c3de1[_0x421c('0xf')]&&_0x1c3de1['interaction']&&_0x1c3de1[_0x421c('0x11')]['id']){try{var _0x482051=getId(_0x1c3de1[_0x421c('0xf')],_0x1c3de1[_0x421c('0x10')]?_0x1c3de1[_0x421c('0x10')]['id']:0x0,_0x1c3de1[_0x421c('0x11')]?_0x1c3de1[_0x421c('0x11')]['id']:0x0);if(_0x21e2a6[_0x421c('0xe')][_0x482051]){_0x21e2a6['rules'][_0x482051][_0x421c('0x33')](_0x421c('0x40'));}return _0x59f4e4({'code':0xc8,'message':_0x1c3de1});}catch(_0x404584){logger['error'](_0x404584[_0x421c('0x37')]);return _0x43e8fc(_0x342595[_0x421c('0x2e')](0x1f4,_0x404584));}}logger[_0x421c('0x2e')](_0x421c('0x3e'));return _0x43e8fc(_0x342595[_0x421c('0x2e')](0x1f4,_0x421c('0x3e')));});},'AgentCapacity':function(_0x15faeb){var _0x4673ef=this;return new Promise(function(_0x3c5ef7,_0x108757){if(_0x21e2a6[_0x421c('0x3a')]['hasOwnProperty'](_0x15faeb['id'])){for(var _0xd5b4c3 in _0x15faeb[_0x421c('0x41')]){if(_0x15faeb['capacity'][_0x421c('0x42')](_0xd5b4c3)){if(_0x21e2a6[_0x421c('0x3a')][_0x15faeb['id']][_0x421c('0x42')](_0xd5b4c3+_0x421c('0x43'))){_0x21e2a6[_0x421c('0x3a')][_0x15faeb['id']][_0xd5b4c3+_0x421c('0x43')]=parseInt(_0x15faeb[_0x421c('0x41')][_0xd5b4c3],0xa);}}}_0x21e2a6[_0x421c('0x3a')][_0x15faeb['id']][_0x421c('0x44')]();return _0x3c5ef7({'code':0xc8,'message':_0x21e2a6['agents'][_0x15faeb['id']]});}else{return _0x108757(_0x4673ef[_0x421c('0x2e')](0x1f4,_0x421c('0x45')));}});},'Agents':function(_0x439cca){return new Promise(function(_0x233013){var _0x150c3d=_['values'](_0x21e2a6[_0x421c('0x3a')]);if(_0x439cca&&_0x439cca['id']){var _0x5118a2=_[_0x421c('0x46')](_0x150c3d,function(_0x3dc58c){return _0x3dc58c['id']===_0x439cca['id'];});_0x233013(_0x5118a2);}else{_0x233013({'count':_0x150c3d[_0x421c('0x15')],'rows':_0x150c3d});}});},'ChatQueues':function(){return new Promise(function(_0x152c9d){var _0x58c91c=[];for(var _0x17493f in _0x21e2a6[_0x421c('0x47')]){if(_0x21e2a6[_0x421c('0x47')][_0x421c('0x42')](_0x17493f)){var _0x540fbf=_0x21e2a6[_0x421c('0x47')][_0x17493f];var _0x765d52={'id':_0x540fbf['id'],'available':_0x540fbf[_0x421c('0x48')],'loggedIn':_0x540fbf[_0x421c('0x49')],'name':_0x540fbf[_0x421c('0x4a')],'paused':_0x540fbf['paused'],'waiting':_0x540fbf[_0x421c('0x4b')]};_0x58c91c['push'](_0x765d52);}}_0x152c9d({'count':_0x58c91c[_0x421c('0x15')],'rows':_0x58c91c});});},'MailQueues':function(){return new Promise(function(_0x63f658){var _0x345a6e=[];for(var _0x4f63ce in _0x21e2a6[_0x421c('0x4c')]){if(_0x21e2a6[_0x421c('0x4c')]['hasOwnProperty'](_0x4f63ce)){var _0x3a4bc3=_0x21e2a6[_0x421c('0x4c')][_0x4f63ce];var _0x240d9e={'id':_0x3a4bc3['id'],'available':_0x3a4bc3[_0x421c('0x48')],'loggedIn':_0x3a4bc3['loggedIn'],'name':_0x3a4bc3[_0x421c('0x4a')],'paused':_0x3a4bc3[_0x421c('0x4d')],'waiting':_0x3a4bc3[_0x421c('0x4b')]};_0x345a6e[_0x421c('0x1d')](_0x240d9e);}}_0x63f658({'count':_0x345a6e['length'],'rows':_0x345a6e});});},'OpenchannelQueues':function(){return new Promise(function(_0x3c7722){var _0x5afcfb=[];for(var _0x11c11f in _0x21e2a6[_0x421c('0x4e')]){if(_0x21e2a6[_0x421c('0x4e')][_0x421c('0x42')](_0x11c11f)){var _0x315a20=_0x21e2a6[_0x421c('0x4e')][_0x11c11f];var _0x1ecc47={'id':_0x315a20['id'],'available':_0x315a20[_0x421c('0x48')],'loggedIn':_0x315a20[_0x421c('0x49')],'name':_0x315a20[_0x421c('0x4a')],'paused':_0x315a20[_0x421c('0x4d')],'waiting':_0x315a20['waiting']};_0x5afcfb[_0x421c('0x1d')](_0x1ecc47);}}_0x3c7722({'count':_0x5afcfb[_0x421c('0x15')],'rows':_0x5afcfb});});},'SmsQueues':function(){return new Promise(function(_0x172c1e){var _0x473966=[];for(var _0x5b4a44 in _0x21e2a6[_0x421c('0x4f')]){if(_0x21e2a6[_0x421c('0x4f')][_0x421c('0x42')](_0x5b4a44)){var _0x587d91=_0x21e2a6[_0x421c('0x4f')][_0x5b4a44];var _0x1675f4={'id':_0x587d91['id'],'available':_0x587d91[_0x421c('0x48')],'loggedIn':_0x587d91['loggedIn'],'name':_0x587d91['name'],'paused':_0x587d91[_0x421c('0x4d')],'waiting':_0x587d91[_0x421c('0x4b')]};_0x473966[_0x421c('0x1d')](_0x1675f4);}}_0x172c1e({'count':_0x473966[_0x421c('0x15')],'rows':_0x473966});});},'FaxQueues':function(){return new Promise(function(_0x4e4d87){var _0xbe51cc=[];for(var _0x40b3c0 in _0x21e2a6[_0x421c('0x50')]){if(_0x21e2a6['faxQueues'][_0x421c('0x42')](_0x40b3c0)){var _0x465740=_0x21e2a6[_0x421c('0x50')][_0x40b3c0];var _0x1e331b={'id':_0x465740['id'],'available':_0x465740[_0x421c('0x48')],'loggedIn':_0x465740[_0x421c('0x49')],'name':_0x465740[_0x421c('0x4a')],'paused':_0x465740[_0x421c('0x4d')],'waiting':_0x465740[_0x421c('0x4b')]};_0xbe51cc[_0x421c('0x1d')](_0x1e331b);}}_0x4e4d87({'count':_0xbe51cc[_0x421c('0x15')],'rows':_0xbe51cc});});},'WhatsappQueues':function(){return new Promise(function(_0x7bcbef){var _0x20e423=[];for(var _0xea9d7a in _0x21e2a6[_0x421c('0x51')]){if(_0x21e2a6[_0x421c('0x51')][_0x421c('0x42')](_0xea9d7a)){var _0x2cf0c2=_0x21e2a6['whatsappQueues'][_0xea9d7a];var _0x2f1397={'id':_0x2cf0c2['id'],'available':_0x2cf0c2[_0x421c('0x48')],'loggedIn':_0x2cf0c2['loggedIn'],'name':_0x2cf0c2[_0x421c('0x4a')],'paused':_0x2cf0c2['paused'],'waiting':_0x2cf0c2['waiting']};_0x20e423['push'](_0x2f1397);}}_0x7bcbef({'count':_0x20e423[_0x421c('0x15')],'rows':_0x20e423});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x532dab){var _0x202665=_[_0x421c('0x52')](_0x21e2a6[_0x421c('0x53')]);_0x532dab({'count':_0x202665[_0x421c('0x15')],'rows':_0x202665});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4cf5f0){var _0x3be848=_[_0x421c('0x52')](_0x21e2a6[_0x421c('0x54')]);_0x4cf5f0({'count':_0x3be848[_0x421c('0x15')],'rows':_0x3be848});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x49ec67){var _0x31810b=_[_0x421c('0x52')](_0x21e2a6[_0x421c('0x55')]);_0x49ec67({'count':_0x31810b[_0x421c('0x15')],'rows':_0x31810b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x375251){var _0x35a3f7=_[_0x421c('0x52')](_0x21e2a6[_0x421c('0x56')]);_0x375251({'count':_0x35a3f7[_0x421c('0x15')],'rows':_0x35a3f7});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3f13c9){var _0x8cd889=_[_0x421c('0x52')](_0x21e2a6[_0x421c('0x57')]);_0x3f13c9({'count':_0x8cd889[_0x421c('0x15')],'rows':_0x8cd889});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5c92e6){var _0x270a11=_['values'](_0x21e2a6[_0x421c('0x58')]);_0x5c92e6({'count':_0x270a11['length'],'rows':_0x270a11});});}};var _0x4088c8=jayson[_0x421c('0x59')](_0x389f96)[_0x421c('0x5a')]();_0x4088c8['on']('error',function(_0x3bb8ce){logger[_0x421c('0x2e')](JSON[_0x421c('0x32')](_0x3bb8ce));return _0x51435b(_0x3bb8ce);});_0x4088c8[_0x421c('0x5b')](0x232c,_0x421c('0x5c'),function(){console[_0x421c('0x5d')](_0x421c('0x5e'),0x232c);return _0x201625(_0x421c('0x5f')+0x232c);});});};
\ No newline at end of file
index b07698c..501be1b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a73=['message','result','catch','condition','rules','info','push','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','error'];(function(_0x512e72,_0x49ffe1){var _0x143086=function(_0x1d3921){while(--_0x1d3921){_0x512e72['push'](_0x512e72['shift']());}};_0x143086(++_0x49ffe1);}(_0x0a73,0x1e4));var _0x30a7=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0x0a73[_0x118733];return _0x4777af;};'use strict';var util=require(_0x30a7('0x0'));var BPromise=require(_0x30a7('0x1'));var jayson=require(_0x30a7('0x2'));var _=require(_0x30a7('0x3'));var logger=require(_0x30a7('0x4'))(_0x30a7('0x5'));var client=jayson[_0x30a7('0x6')][_0x30a7('0x7')]({'port':0x232a});function request(_0x2709c8,_0x313c70){return new BPromise(function(_0x2b9486,_0x17941a){return client['request'](_0x2709c8,_0x313c70)['then'](function(_0x2e1a85){if(_0x2e1a85[_0x30a7('0x8')]){return _0x17941a(_0x2e1a85['error'][_0x30a7('0x9')]);}else{return _0x2b9486(_0x2e1a85[_0x30a7('0xa')]);}})[_0x30a7('0xb')](function(_0xc80a51){return _0x17941a(_0xc80a51);});});}exports[_0x30a7('0xc')]=function(_0x4ad239,_0x5c82bf,_0x5c76d9){return function(_0x38f9f7){if(_0x5c76d9[_0x30a7('0xd')]&&!_0x5c76d9[_0x30a7('0xd')][_0x4ad239]){logger[_0x30a7('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4ad239);return _0x38f9f7['stop']();}var _0xe2cb0a=[];for(var _0x1c8a11=0x0;_0x1c8a11<_0x5c82bf['length'];_0x1c8a11+=0x1){_0xe2cb0a[_0x30a7('0xf')](request('Command',{'command':util[_0x30a7('0x10')](_0x30a7('0x11'),_0x5c82bf[_0x1c8a11])})[_0x30a7('0x12')](function(_0x766b84){return _0x766b84&&_0x766b84[_0x30a7('0x9')]&&_0x766b84['message'][_0x30a7('0x13')](_0x30a7('0x14'))>=0x0?!![]:![];})[_0x30a7('0xb')](function(_0x32a755){logger[_0x30a7('0x8')](_0x30a7('0x15'),_0x4ad239,_0x5c82bf[_0x1c8a11]);}));}BPromise[_0x30a7('0x16')](_0xe2cb0a)['then'](function(_0x29fde4){var _0x1dc74b=_[_0x30a7('0x17')](_0x29fde4);logger['info'](_0x30a7('0x18'),_0x4ad239,_0x5c82bf[_0x30a7('0x19')](_0x30a7('0x1a')),_0x1dc74b);_0x38f9f7['when'](_0x1dc74b);})[_0x30a7('0xb')](function(_0x351b4a){console['log'](_0x351b4a);logger[_0x30a7('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x4ad239,_0x5c82bf['join']('\x20|\x20'),_0x351b4a[_0x30a7('0x1b')]);_0x38f9f7[_0x30a7('0x1c')]();});};};
\ No newline at end of file
+var _0xc21f=['rules','info','stop','length','push','Command','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','lodash','../../../config/logger','client','then','error','message','catch','condition'];(function(_0x141131,_0x52b412){var _0x3287e7=function(_0x24f1d9){while(--_0x24f1d9){_0x141131['push'](_0x141131['shift']());}};_0x3287e7(++_0x52b412);}(_0xc21f,0x1b9));var _0xfc21=function(_0x3dec4e,_0x46a9e0){_0x3dec4e=_0x3dec4e-0x0;var _0xdfb095=_0xc21f[_0x3dec4e];return _0xdfb095;};'use strict';var util=require(_0xfc21('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xfc21('0x1'));var logger=require(_0xfc21('0x2'))('routing');var client=jayson[_0xfc21('0x3')]['http']({'port':0x232a});function request(_0x3aec10,_0x112b6f){return new BPromise(function(_0x514409,_0xcfe5fc){return client['request'](_0x3aec10,_0x112b6f)[_0xfc21('0x4')](function(_0x568c33){if(_0x568c33[_0xfc21('0x5')]){return _0xcfe5fc(_0x568c33[_0xfc21('0x5')][_0xfc21('0x6')]);}else{return _0x514409(_0x568c33['result']);}})[_0xfc21('0x7')](function(_0x56861d){return _0xcfe5fc(_0x56861d);});});}exports[_0xfc21('0x8')]=function(_0x491cd9,_0x5f3d3f,_0x3204d7){return function(_0x28aae2){if(_0x3204d7[_0xfc21('0x9')]&&!_0x3204d7[_0xfc21('0x9')][_0x491cd9]){logger[_0xfc21('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x491cd9);return _0x28aae2[_0xfc21('0xb')]();}var _0x235420=[];for(var _0x5d2da6=0x0;_0x5d2da6<_0x5f3d3f[_0xfc21('0xc')];_0x5d2da6+=0x1){_0x235420[_0xfc21('0xd')](request(_0xfc21('0xe'),{'command':util['format'](_0xfc21('0xf'),_0x5f3d3f[_0x5d2da6])})[_0xfc21('0x4')](function(_0x305729){return _0x305729&&_0x305729[_0xfc21('0x6')]&&_0x305729[_0xfc21('0x6')][_0xfc21('0x10')]('true')>=0x0?!![]:![];})['catch'](function(_0x37b3c0){logger[_0xfc21('0x5')](_0xfc21('0x11'),_0x491cd9,_0x5f3d3f[_0x5d2da6]);}));}BPromise[_0xfc21('0x12')](_0x235420)[_0xfc21('0x4')](function(_0x41ad98){var _0x1ad792=_['some'](_0x41ad98);logger['info'](_0xfc21('0x13'),_0x491cd9,_0x5f3d3f[_0xfc21('0x14')](_0xfc21('0x15')),_0x1ad792);_0x28aae2[_0xfc21('0x16')](_0x1ad792);})[_0xfc21('0x7')](function(_0x134190){console[_0xfc21('0x17')](_0x134190);logger[_0xfc21('0x5')](_0xfc21('0x13'),_0x491cd9,_0x5f3d3f[_0xfc21('0x14')](_0xfc21('0x15')),_0x134190[_0xfc21('0x18')]);_0x28aae2[_0xfc21('0xb')]();});};};
\ No newline at end of file
index 01280b9..263a6cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa74f=['calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answered_elsewhere','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','transferexten','transferuniqueid','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','indexOf','splice','complete','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue'];(function(_0x1565d4,_0x388f01){var _0x1f8ef9=function(_0x31f8b7){while(--_0x31f8b7){_0x1565d4['push'](_0x1565d4['shift']());}};_0x1f8ef9(++_0x388f01);}(_0xa74f,0x9a));var _0xfa74=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xa74f[_0x544099];return _0x20ab09;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xfa74('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4c4c00,_0x4b5765){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3'),_0x4c4c00[_0xfa74('0x4')],_0x4c4c00['channel'],_0x4c4c00[_0xfa74('0x5')],_0x4c4c00['membername'],_0x4c4c00['interface'],_0x4c4c00[_0xfa74('0x6')],_0x4c4c00[_0xfa74('0x7')],_0x4c4c00[_0xfa74('0x8')]));if(_0x4c4c00[_0xfa74('0x5')]){utils[_0xfa74('0x9')](_0x4c4c00[_0xfa74('0x5')])['then'](function(_0x32f55c){if(_0x32f55c){_0x4c4c00[_0xfa74('0xa')]=_0x32f55c[_0xfa74('0xa')];_0x4c4c00[_0xfa74('0xb')]=_0x4c4c00['agentcomplete']?_0x32f55c[_0xfa74('0xc')]:![];_0x4c4c00[_0xfa74('0xd')]=_0x4c4c00['agentacw']?_0x32f55c[_0xfa74('0xe')]:0x0;}utils[_0xfa74('0xf')](_0xfa74('0x10'),_0x4c4c00);});}else{utils[_0xfa74('0xf')]('CreateVoiceAgentReport',_0x4c4c00);}if(_0x4b5765){delete transfers[_0x4c4c00[_0xfa74('0x4')]];}else{delete agents[_0x4c4c00[_0xfa74('0x11')]];}}exports[_0xfa74('0x12')]=function(_0x278e8b){try{utils['debug'](util[_0xfa74('0x2')](_0xfa74('0x13'),_0x278e8b[_0xfa74('0x4')]),_0x278e8b);agents[_0x278e8b[_0xfa74('0x11')]]=_0x278e8b;agents[_0x278e8b[_0xfa74('0x11')]]['agentcalledAt']=utils[_0xfa74('0x14')]();agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x8')]=_0xfa74('0x15');agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x7')]=null;agents[_0x278e8b[_0xfa74('0x11')]]['connectedlinename']=null;utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x278e8b['uniqueid'],agents[_0x278e8b[_0xfa74('0x11')]][_0xfa74('0x16')],_0x278e8b[_0xfa74('0x11')]));}catch(_0x5a863f){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x13'),_0x278e8b['uniqueid']),_0x5a863f);}};exports[_0xfa74('0x18')]=function(_0x302eb4){try{if(!_[_0xfa74('0x19')](agents[_0x302eb4['destuniqueid']])){utils['debug'](util[_0xfa74('0x2')](_0xfa74('0x1a'),_0x302eb4[_0xfa74('0x4')]),_0x302eb4);utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x302eb4['uniqueid'],agents[_0x302eb4[_0xfa74('0x11')]]['membername'],_0x302eb4['destuniqueid']));agents[_0x302eb4['destuniqueid']][_0xfa74('0x18')]=!![];agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x1b')]=utils['now']();agents[_0x302eb4['destuniqueid']][_0xfa74('0x8')]=_0xfa74('0x1c');agents[_0x302eb4['destuniqueid']][_0xfa74('0x1d')]='timeout';agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x1e')]=_0x302eb4['ringtime']?parseInt(_0x302eb4[_0xfa74('0x1f')])/0x3e8:0x0;agents[_0x302eb4[_0xfa74('0x11')]][_0xfa74('0x20')]=0x0;unanswered[_0xfa74('0x21')](_0x302eb4['destuniqueid']);}}catch(_0xd9c55d){utils[_0xfa74('0x17')](util[_0xfa74('0x2')]('[%s][agents][agentringnoanswer]',_0x302eb4['uniqueid']),_0xd9c55d);}};exports[_0xfa74('0x22')]=function(_0x8b706e){try{_['forIn'](agents,function(_0x4b38fc,_0x343466){if(_0x4b38fc['uniqueid']==_0x8b706e[_0xfa74('0x4')]&&!_['includes'](unanswered,_0x4b38fc[_0xfa74('0x11')])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x24'),_0x8b706e['uniqueid']),_0x8b706e);utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x25'),_0x8b706e[_0xfa74('0x4')],_0x4b38fc[_0xfa74('0x16')],_0x4b38fc[_0xfa74('0x11')]));_0x4b38fc[_0xfa74('0x18')]=!![];_0x4b38fc['agentringnoanswerAt']=utils[_0xfa74('0x14')]();_0x4b38fc['lastevent']=_0xfa74('0x26');_0x4b38fc[_0xfa74('0x1d')]=_0xfa74('0x26');_0x4b38fc[_0xfa74('0x1e')]=_0x8b706e['holdtime'];_0x4b38fc['talktime']=0x0;writeDB(_0x4b38fc);}});}catch(_0x390ed4){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x24'),_0x8b706e['uniqueid']),_0x390ed4);}};exports[_0xfa74('0x27')]=function(_0x231698){try{if(agents[_0x231698['destuniqueid']]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x231698['uniqueid']),_0x231698);utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x28'),_0x231698[_0xfa74('0x4')],agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x16')],_0x231698[_0xfa74('0x11')]));agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x29')]=utils['now']();agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x7')]=_0x231698[_0xfa74('0x7')];agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x2a')]=_0x231698[_0xfa74('0x2a')];agents[_0x231698['destuniqueid']][_0xfa74('0x1e')]=_0x231698[_0xfa74('0x1f')];agents[_0x231698[_0xfa74('0x11')]][_0xfa74('0x8')]='connect';_[_0xfa74('0x2b')](agents,function(_0x13d9a5,_0xe8491b){if(_0x13d9a5[_0xfa74('0x11')]!=_0x231698['destuniqueid']&&_0x13d9a5[_0xfa74('0x4')]==_0x231698[_0xfa74('0x4')]){_0x13d9a5[_0xfa74('0x20')]=0x0;_0x13d9a5['holdtime']=_0x231698['ringtime'];_0x13d9a5[_0xfa74('0x18')]=!![];_0x13d9a5[_0xfa74('0x1b')]=utils[_0xfa74('0x14')]();_0x13d9a5[_0xfa74('0x8')]='answered_elsewhere';_0x13d9a5[_0xfa74('0x1d')]=_0xfa74('0x2c');_0x13d9a5['answeredelsewheredestinationuniqueid']=_0x231698['destuniqueid'];_0x13d9a5['answeredelsewheremembername']=_0x231698['membername'];writeDB(_0x13d9a5);}});}}catch(_0x95c891){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x2d'),_0x231698[_0xfa74('0x4')]),_0x95c891);}};exports[_0xfa74('0x2e')]=function(_0x7735c5){try{if(!_['isNil'](agents[_0x7735c5[_0xfa74('0x11')]])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x2f'),_0x7735c5[_0xfa74('0x4')]),_0x7735c5);utils['info'](util[_0xfa74('0x2')](_0xfa74('0x30'),_0x7735c5[_0xfa74('0x4')],agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x16')],_0x7735c5[_0xfa74('0x11')]));agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x2e')]=!![];agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x31')]=utils['now']();agents[_0x7735c5[_0xfa74('0x11')]]['talktime']=utils[_0xfa74('0x32')](agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x31')],agents[_0x7735c5[_0xfa74('0x11')]]['agentconnectAt']);agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x1d')]=_0x7735c5['reason'];agents[_0x7735c5[_0xfa74('0x11')]][_0xfa74('0x8')]='complete';writeDB(agents[_0x7735c5[_0xfa74('0x11')]]);}}catch(_0x134d95){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x2f'),_0x7735c5['uniqueid']),_0x134d95);}};exports['blindtransfer']=function(_0x36f6ca){try{if(!_[_0xfa74('0x19')](agents[_0x36f6ca['transfereruniqueid']])){utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x33'),_0x36f6ca['uniqueid']),_0x36f6ca);utils['info'](util[_0xfa74('0x2')](_0xfa74('0x34'),_0x36f6ca[_0xfa74('0x4')],agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x16')],agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x4')]));agents[_0x36f6ca[_0xfa74('0x35')]]['transfer']=!![];agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x36')]=_0xfa74('0x37');agents[_0x36f6ca[_0xfa74('0x35')]]['transferexten']=_0x36f6ca['extension'];agents[_0x36f6ca[_0xfa74('0x35')]]['transferuniqueid']=agents[_0x36f6ca[_0xfa74('0x35')]][_0xfa74('0x4')];}}catch(_0x427469){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x33'),_0x36f6ca[_0xfa74('0x4')]),_0x427469);}};exports['attendedtransfer']=function(_0x118cfc){try{utils['debug'](util[_0xfa74('0x2')]('[%s][agents][attendedtransfer]',_0x118cfc['origtransfereruniqueid']),_0x118cfc);if(_0x118cfc[_0xfa74('0x38')]==_0x118cfc[_0xfa74('0x39')]){if(!_['isNil'](agents[_0x118cfc['secondtransfereruniqueid']])){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3a'),_0x118cfc[_0xfa74('0x38')],agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x16')]));agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x3c')]=!![];agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x36')]='ATTENDED';agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x3d')]=_0x118cfc['origtransfererexten'];agents[_0x118cfc['secondtransfereruniqueid']][_0xfa74('0x3e')]=_0x118cfc[_0xfa74('0x38')];}if(_0x118cfc[_0xfa74('0x3f')]&&agents[_0x118cfc[_0xfa74('0x3f')]]){agents[_0x118cfc[_0xfa74('0x3f')]]['agententerreason']=0x1;transfers[_0x118cfc[_0xfa74('0x3f')]]=_['clone'](agents[_0x118cfc[_0xfa74('0x3f')]]);transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x6')]=agents[_0x118cfc['secondtransfereruniqueid']]['calleridnum'];transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x40')]=agents[_0x118cfc[_0xfa74('0x3b')]][_0xfa74('0x40')];transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x41')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x29')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc[_0xfa74('0x3f')]][_0xfa74('0x1e')]=0x0;transfers[_0x118cfc['transfereeuniqueid']][_0xfa74('0x42')]=0x2;}}else if(_0x118cfc['secondtransfereruniqueid']==_0x118cfc[_0xfa74('0x43')]){if(!_[_0xfa74('0x19')](agents[_0x118cfc[_0xfa74('0x38')]])){utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x3a'),_0x118cfc[_0xfa74('0x38')],agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x16')]));agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x3c')]=!![];agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x36')]=_0xfa74('0x44');agents[_0x118cfc[_0xfa74('0x38')]]['transferexten']=_0x118cfc[_0xfa74('0x45')];agents[_0x118cfc[_0xfa74('0x38')]]['transferuniqueid']=_0x118cfc['secondtransfereruniqueid'];}if(_0x118cfc[_0xfa74('0x46')]&&agents[_0x118cfc['transfertargetuniqueid']]){agents[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x42')]=0x1;transfers[_0x118cfc[_0xfa74('0x46')]]=_['clone'](agents[_0x118cfc[_0xfa74('0x46')]]);transfers[_0x118cfc['transfertargetuniqueid']]['calleridnum']=agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x6')];transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x40')]=agents[_0x118cfc[_0xfa74('0x38')]][_0xfa74('0x40')];transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x41')]=utils[_0xfa74('0x14')]();transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x29')]=utils['now']();transfers[_0x118cfc[_0xfa74('0x46')]]['holdtime']=0x0;transfers[_0x118cfc[_0xfa74('0x46')]][_0xfa74('0x42')]=0x2;}}}catch(_0x15b586){utils['error'](util[_0xfa74('0x2')](_0xfa74('0x47'),_0x118cfc[_0xfa74('0x38')]),_0x15b586);}};exports['hangup']=function(_0x1b8c06){try{utils[_0xfa74('0x23')](util[_0xfa74('0x2')](_0xfa74('0x48'),_0x1b8c06[_0xfa74('0x4')]),_0x1b8c06);if(agents[_0x1b8c06['uniqueid']]&&agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')]===_0xfa74('0x1c')){if(_0x1b8c06[_0xfa74('0x49')]==='21'){agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')]=_0xfa74('0x4a');agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]=_0xfa74('0x4a');}utils[_0xfa74('0x1')](util[_0xfa74('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1b8c06[_0xfa74('0x4')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]));writeDB(agents[_0x1b8c06[_0xfa74('0x4')]]);var _0x491529=unanswered[_0xfa74('0x4b')](_0x1b8c06[_0xfa74('0x4')]);if(_0x491529>-0x1){unanswered[_0xfa74('0x4c')](_0x491529,0x1);}}if(transfers[_0x1b8c06[_0xfa74('0x4')]]){transfers[_0x1b8c06['uniqueid']][_0xfa74('0x2e')]=!![];transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')]=utils[_0xfa74('0x14')]();transfers[_0x1b8c06['uniqueid']][_0xfa74('0x20')]=utils['diffTime'](transfers[_0x1b8c06['uniqueid']][_0xfa74('0x31')],transfers[_0x1b8c06['uniqueid']][_0xfa74('0x29')]);transfers[_0x1b8c06[_0xfa74('0x4')]]['reason']='agent';transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x8')]=_0xfa74('0x4d');utils[_0xfa74('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1b8c06['uniqueid'],transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],transfers[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x1d')],transfers[_0x1b8c06[_0xfa74('0x4')]]['lastevent']));writeDB(transfers[_0x1b8c06[_0xfa74('0x4')]],!![]);}if(agents[_0x1b8c06[_0xfa74('0x4')]]&&agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x29')]){agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x2e')]=!![];agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')]=utils[_0xfa74('0x14')]();agents[_0x1b8c06['uniqueid']]['talktime']=utils['diffTime'](agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x31')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x29')]);agents[_0x1b8c06[_0xfa74('0x4')]]['reason']=agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x3c')]?'transfer':_0xfa74('0x4e');agents[_0x1b8c06['uniqueid']][_0xfa74('0x8')]=_0xfa74('0x4d');utils[_0xfa74('0x1')](util[_0xfa74('0x2')](_0xfa74('0x4f'),_0x1b8c06[_0xfa74('0x4')],agents[_0x1b8c06[_0xfa74('0x4')]][_0xfa74('0x16')],agents[_0x1b8c06['uniqueid']]['reason'],agents[_0x1b8c06['uniqueid']][_0xfa74('0x8')]));writeDB(agents[_0x1b8c06[_0xfa74('0x4')]]);}}catch(_0x4d46e1){utils[_0xfa74('0x17')](util[_0xfa74('0x2')](_0xfa74('0x48'),_0x1b8c06[_0xfa74('0x4')]),_0x4d46e1);}};
\ No newline at end of file
+var _0x1339=['talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime'];(function(_0x6465b0,_0x45653a){var _0x4884fe=function(_0x427085){while(--_0x427085){_0x6465b0['push'](_0x6465b0['shift']());}};_0x4884fe(++_0x45653a);}(_0x1339,0x1ed));var _0x9133=function(_0xd7fdc7,_0x2a1ca6){_0xd7fdc7=_0xd7fdc7-0x0;var _0x1944fb=_0x1339[_0xd7fdc7];return _0x1944fb;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9133('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a91b2,_0x4611be){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3'),_0x2a91b2[_0x9133('0x4')],_0x2a91b2[_0x9133('0x5')],_0x2a91b2['queue'],_0x2a91b2[_0x9133('0x6')],_0x2a91b2[_0x9133('0x7')],_0x2a91b2[_0x9133('0x8')],_0x2a91b2['connectedlinenum'],_0x2a91b2[_0x9133('0x9')]));if(_0x2a91b2[_0x9133('0xa')]){utils[_0x9133('0xb')](_0x2a91b2[_0x9133('0xa')])[_0x9133('0xc')](function(_0x3a7a80){if(_0x3a7a80){_0x2a91b2[_0x9133('0xd')]=_0x3a7a80[_0x9133('0xd')];_0x2a91b2[_0x9133('0xe')]=_0x2a91b2[_0x9133('0xf')]?_0x3a7a80['acw']:![];_0x2a91b2[_0x9133('0x10')]=_0x2a91b2[_0x9133('0xe')]?_0x3a7a80[_0x9133('0x11')]:0x0;}utils[_0x9133('0x12')](_0x9133('0x13'),_0x2a91b2);});}else{utils[_0x9133('0x12')]('CreateVoiceAgentReport',_0x2a91b2);}if(_0x4611be){delete transfers[_0x2a91b2[_0x9133('0x4')]];}else{delete agents[_0x2a91b2[_0x9133('0x14')]];}}exports['agentcalled']=function(_0x5283a3){try{utils[_0x9133('0x15')](util['format'](_0x9133('0x16'),_0x5283a3[_0x9133('0x4')]),_0x5283a3);agents[_0x5283a3[_0x9133('0x14')]]=_0x5283a3;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();agents[_0x5283a3['destuniqueid']][_0x9133('0x9')]=_0x9133('0x19');agents[_0x5283a3['destuniqueid']][_0x9133('0x1a')]=null;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x1b')]=null;utils[_0x9133('0x1')](util['format'](_0x9133('0x1c'),_0x5283a3['uniqueid'],agents[_0x5283a3[_0x9133('0x14')]]['membername'],_0x5283a3[_0x9133('0x14')]));}catch(_0x1d6d0b){utils['error'](util[_0x9133('0x2')]('[%s][agents][agentcalled]',_0x5283a3[_0x9133('0x4')]),_0x1d6d0b);}};exports['agentringnoanswer']=function(_0x5e4f0c){try{if(!_[_0x9133('0x1d')](agents[_0x5e4f0c['destuniqueid']])){utils[_0x9133('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x5e4f0c['uniqueid']),_0x5e4f0c);utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5e4f0c[_0x9133('0x4')],agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x6')],_0x5e4f0c[_0x9133('0x14')]));agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1e')]=!![];agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1f')]=utils[_0x9133('0x18')]();agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x21')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x22')]=_0x5e4f0c['ringtime']?parseInt(_0x5e4f0c['ringtime'])/0x3e8:0x0;agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x23')]=0x0;unanswered[_0x9133('0x24')](_0x5e4f0c[_0x9133('0x14')]);}}catch(_0x4de894){utils['error'](util[_0x9133('0x2')](_0x9133('0x25'),_0x5e4f0c[_0x9133('0x4')]),_0x4de894);}};exports[_0x9133('0x26')]=function(_0x390f50){try{_[_0x9133('0x27')](agents,function(_0x48c713,_0x58afe0){if(_0x48c713['uniqueid']==_0x390f50[_0x9133('0x4')]&&!_['includes'](unanswered,_0x48c713[_0x9133('0x14')])){utils[_0x9133('0x15')](util['format'](_0x9133('0x28'),_0x390f50['uniqueid']),_0x390f50);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x29'),_0x390f50['uniqueid'],_0x48c713[_0x9133('0x6')],_0x48c713[_0x9133('0x14')]));_0x48c713[_0x9133('0x1e')]=!![];_0x48c713['agentringnoanswerAt']=utils[_0x9133('0x18')]();_0x48c713[_0x9133('0x9')]=_0x9133('0x2a');_0x48c713['reason']=_0x9133('0x2a');_0x48c713[_0x9133('0x22')]=_0x390f50[_0x9133('0x22')];_0x48c713[_0x9133('0x23')]=0x0;writeDB(_0x48c713);}});}catch(_0x5e4d5e){utils[_0x9133('0x2b')](util[_0x9133('0x2')]('[%s][agents][queuecallerabandon]',_0x390f50[_0x9133('0x4')]),_0x5e4d5e);}};exports[_0x9133('0x2c')]=function(_0x593fbe){try{if(agents[_0x593fbe[_0x9133('0x14')]]){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x2d'),_0x593fbe[_0x9133('0x4')]),_0x593fbe);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x2e'),_0x593fbe['uniqueid'],agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x6')],_0x593fbe['destuniqueid']));agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x2f')]=utils[_0x9133('0x18')]();agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x1a')]=_0x593fbe[_0x9133('0x1a')];agents[_0x593fbe['destuniqueid']]['connectedlinename']=_0x593fbe[_0x9133('0x1b')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x22')]=_0x593fbe[_0x9133('0x30')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x31');_[_0x9133('0x27')](agents,function(_0x720048,_0x5a3f73){if(_0x720048[_0x9133('0x14')]!=_0x593fbe[_0x9133('0x14')]&&_0x720048[_0x9133('0x4')]==_0x593fbe[_0x9133('0x4')]){_0x720048[_0x9133('0x23')]=0x0;_0x720048['holdtime']=_0x593fbe[_0x9133('0x30')];_0x720048[_0x9133('0x1e')]=!![];_0x720048[_0x9133('0x1f')]=utils[_0x9133('0x18')]();_0x720048['lastevent']=_0x9133('0x32');_0x720048[_0x9133('0x21')]=_0x9133('0x32');_0x720048[_0x9133('0x33')]=_0x593fbe[_0x9133('0x14')];_0x720048[_0x9133('0x34')]=_0x593fbe[_0x9133('0x6')];writeDB(_0x720048);}});}}catch(_0x4ca1a3){utils[_0x9133('0x2b')](util['format']('[%s][agents][agentconnect]',_0x593fbe[_0x9133('0x4')]),_0x4ca1a3);}};exports[_0x9133('0xf')]=function(_0x46156d){try{if(!_[_0x9133('0x1d')](agents[_0x46156d[_0x9133('0x14')]])){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x46156d);utils['info'](util[_0x9133('0x2')](_0x9133('0x36'),_0x46156d[_0x9133('0x4')],agents[_0x46156d['destuniqueid']]['membername'],_0x46156d[_0x9133('0x14')]));agents[_0x46156d[_0x9133('0x14')]]['agentcomplete']=!![];agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x23')]=utils['diffTime'](agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')],agents[_0x46156d[_0x9133('0x14')]]['agentconnectAt']);agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x21')]=_0x46156d['reason'];agents[_0x46156d['destuniqueid']][_0x9133('0x9')]=_0x9133('0x38');writeDB(agents[_0x46156d[_0x9133('0x14')]]);}}catch(_0x41fea9){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x41fea9);}};exports[_0x9133('0x39')]=function(_0xf07fbb){try{if(!_[_0x9133('0x1d')](agents[_0xf07fbb[_0x9133('0x3a')]])){utils['debug'](util['format'](_0x9133('0x3b'),_0xf07fbb['uniqueid']),_0xf07fbb);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3c'),_0xf07fbb[_0x9133('0x4')],agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x6')],agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x4')]));agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x3d')]=!![];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x3e')]='blind';agents[_0xf07fbb[_0x9133('0x3a')]]['transferexten']=_0xf07fbb[_0x9133('0x3f')];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x40')]=agents[_0xf07fbb[_0x9133('0x3a')]]['uniqueid'];}}catch(_0x4a346c){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x3b'),_0xf07fbb[_0x9133('0x4')]),_0x4a346c);}};exports[_0x9133('0x41')]=function(_0x565920){try{utils['debug'](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920['origtransfereruniqueid']),_0x565920);if(_0x565920[_0x9133('0x43')]==_0x565920[_0x9133('0x44')]){if(!_['isNil'](agents[_0x565920['secondtransfereruniqueid']])){utils['info'](util[_0x9133('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x45')]][_0x9133('0x6')]));agents[_0x565920[_0x9133('0x45')]]['transfer']=!![];agents[_0x565920[_0x9133('0x45')]]['transfertype']=_0x9133('0x46');agents[_0x565920[_0x9133('0x45')]][_0x9133('0x47')]=_0x565920[_0x9133('0x48')];agents[_0x565920[_0x9133('0x45')]][_0x9133('0x40')]=_0x565920['origtransfereruniqueid'];}if(_0x565920['transfereeuniqueid']&&agents[_0x565920['transfereeuniqueid']]){agents[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x49')]]=_['clone'](agents[_0x565920[_0x9133('0x49')]]);transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x45')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x45')]]['calleridname'];transfers[_0x565920[_0x9133('0x49')]]['agentcalledAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']][_0x9133('0x2f')]=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x2;}}else if(_0x565920[_0x9133('0x45')]==_0x565920[_0x9133('0x4c')]){if(!_[_0x9133('0x1d')](agents[_0x565920[_0x9133('0x43')]])){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x4d'),_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x43')]]['membername']));agents[_0x565920[_0x9133('0x43')]]['transfer']=!![];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x3e')]=_0x9133('0x46');agents[_0x565920[_0x9133('0x43')]][_0x9133('0x47')]=_0x565920['secondtransfererexten'];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x40')]=_0x565920[_0x9133('0x45')];}if(_0x565920[_0x9133('0x4e')]&&agents[_0x565920['transfertargetuniqueid']]){agents[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x4e')]]=_[_0x9133('0x4f')](agents[_0x565920['transfertargetuniqueid']]);transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x43')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x43')]]['calleridname'];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();transfers[_0x565920[_0x9133('0x4e')]]['agentconnectAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x22')]=0x0;transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x2;}}}catch(_0x39b46d){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920[_0x9133('0x43')]),_0x39b46d);}};exports['hangup']=function(_0x23bd83){try{utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x50'),_0x23bd83[_0x9133('0x4')]),_0x23bd83);if(agents[_0x23bd83['uniqueid']]&&agents[_0x23bd83['uniqueid']]['reason']===_0x9133('0x20')){if(_0x23bd83[_0x9133('0x51')]==='21'){agents[_0x23bd83[_0x9133('0x4')]]['reason']=_0x9133('0x52');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x52');}utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83[_0x9133('0x4')],agents[_0x23bd83['uniqueid']][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]]['reason'],agents[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);var _0x439352=unanswered[_0x9133('0x54')](_0x23bd83[_0x9133('0x4')]);if(_0x439352>-0x1){unanswered[_0x9133('0x55')](_0x439352,0x1);}}if(transfers[_0x23bd83['uniqueid']]){transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')]=utils['now']();transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x23')]=utils[_0x9133('0x56')](transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')]=_0x9133('0x57');transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83['uniqueid'],transfers[_0x23bd83[_0x9133('0x4')]]['membername'],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(transfers[_0x23bd83[_0x9133('0x4')]],!![]);}if(agents[_0x23bd83[_0x9133('0x4')]]&&agents[_0x23bd83[_0x9133('0x4')]]['agentconnectAt']){agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];agents[_0x23bd83['uniqueid']][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x23bd83[_0x9133('0x4')]]['talktime']=utils[_0x9133('0x56')](agents[_0x23bd83['uniqueid']][_0x9133('0x37')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);agents[_0x23bd83['uniqueid']][_0x9133('0x21')]=agents[_0x23bd83['uniqueid']][_0x9133('0x3d')]?_0x9133('0x3d'):_0x9133('0x57');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x23bd83[_0x9133('0x4')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],agents[_0x23bd83['uniqueid']][_0x9133('0x9')]));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);}}catch(_0x1b66d0){utils[_0x9133('0x2b')](util['format'](_0x9133('0x50'),_0x23bd83['uniqueid']),_0x1b66d0);}};
\ No newline at end of file
index 1245434..50b74d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb7e=['duration','diffTime','endtime','starttime','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','error','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt'];(function(_0xadcdc0,_0x4d0185){var _0x47a752=function(_0xc22ae7){while(--_0xc22ae7){_0xadcdc0['push'](_0xadcdc0['shift']());}};_0x47a752(++_0x4d0185);}(_0xdb7e,0x11a));var _0xedb7=function(_0x1288b3,_0x46485d){_0x1288b3=_0x1288b3-0x0;var _0x5040f6=_0xdb7e[_0x1288b3];return _0x5040f6;};'use strict';var _=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var utils=require(_0xedb7('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xedb7('0x3'),_0xedb7('0x4'),_0xedb7('0x4'),'NO\x20ANSWER',_0xedb7('0x3'),_0xedb7('0x3'),_0xedb7('0x5'),_0xedb7('0x6'),_0xedb7('0x4'),_0xedb7('0x4'),_0xedb7('0x4')];var channels={};function writeDB(_0x20a7c7){var _0x26774f;if(transfers[_0xedb7('0x7')][_0x20a7c7['uniqueid']]){_0x26774f=_0x20a7c7[_0xedb7('0x8')];_0x20a7c7[_0xedb7('0x8')]=transfers[_0xedb7('0x7')][_0x20a7c7[_0xedb7('0x8')]][_0xedb7('0x9')];}utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0xc'),_0x20a7c7[_0xedb7('0x8')],_0x20a7c7[_0xedb7('0xd')],_0x20a7c7[_0xedb7('0xe')],_0x20a7c7[_0xedb7('0xf')],_0x20a7c7[_0xedb7('0x10')],_0x20a7c7['calleridnum'],_0x20a7c7['connectedlinenum'],_0x20a7c7[_0xedb7('0x11')]));if(_0x20a7c7[_0xedb7('0x12')]){utils[_0xedb7('0x13')](_0x20a7c7[_0xedb7('0x12')])[_0xedb7('0x14')](function(_0x2923c2){if(_0x2923c2){_0x20a7c7[_0xedb7('0x15')]=_0x2923c2['id'];}utils[_0xedb7('0x16')](_0xedb7('0x17'),_0x20a7c7);});}else{utils['request']('CreateVoiceCallReport',_0x20a7c7);}if(channels[_0x20a7c7[_0xedb7('0x8')]]){delete channels[_0x20a7c7[_0xedb7('0x8')]];}else if(_0x26774f&&channels[_0x26774f]){if(!transfers[_0xedb7('0x7')][_0x26774f]['recording'])delete transfers[_0xedb7('0x7')][_0x26774f];delete channels[_0x26774f];}}exports[_0xedb7('0x18')]=function(_0x33554d){try{utils[_0xedb7('0x19')](util[_0xedb7('0xb')]('[%s][calls][newchannel]',_0x33554d['uniqueid']),_0x33554d);if(_0x33554d[_0xedb7('0x8')]==_0x33554d[_0xedb7('0x1a')]&&_0x33554d[_0xedb7('0xd')]!=_0xedb7('0x1b')){utils['info'](util[_0xedb7('0xb')](_0xedb7('0x1c'),_0x33554d[_0xedb7('0x8')],_0x33554d['context'],_0x33554d[_0xedb7('0x1d')]));channels[_0x33554d['uniqueid']]={'uniqueid':_0x33554d[_0xedb7('0x8')],'accountcode':_0x33554d[_0xedb7('0x12')],'source':_0x33554d[_0xedb7('0x1e')],'destination':_0x33554d['exten'],'destinationcontext':_0x33554d['context'],'channel':_0x33554d[_0xedb7('0xd')],'starttime':utils[_0xedb7('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xedb7('0x20')};}}catch(_0xff6827){utils['error'](util[_0xedb7('0xb')]('[%s][calls][newchannel]',_0x33554d['uniqueid']),_0xff6827);}};exports[_0xedb7('0x21')]=function(_0x45b331){try{utils['debug'](util[_0xedb7('0xb')](_0xedb7('0x22'),_0x45b331[_0xedb7('0x8')]),_0x45b331);if(!_[_0xedb7('0x23')](channels[_0x45b331[_0xedb7('0x8')]])&&_0x45b331[_0xedb7('0x24')]==0x6){utils[_0xedb7('0xa')](util[_0xedb7('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x45b331[_0xedb7('0x8')],_0x45b331['context'],_0x45b331['channel']));if(_[_0xedb7('0x23')](channels[_0x45b331[_0xedb7('0x8')]]['systemanswertime'])){channels[_0x45b331['uniqueid']][_0xedb7('0x25')]=utils['now']();}}else if(!_[_0xedb7('0x23')](channels[_0x45b331[_0xedb7('0x1a')]])&&_0x45b331[_0xedb7('0x24')]==0x6&&_0x45b331['context']!=_0xedb7('0x26')){utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x27'),_0x45b331[_0xedb7('0x8')],_0x45b331[_0xedb7('0x1a')],_0x45b331['context'],_0x45b331[_0xedb7('0xd')]));channels[_0x45b331['linkedid']][_0xedb7('0x12')]=_0x45b331['accountcode'];channels[_0x45b331[_0xedb7('0x1a')]]['destinationchannel']=_0x45b331[_0xedb7('0xd')];if(_[_0xedb7('0x23')](channels[_0x45b331[_0xedb7('0x1a')]]['answertime'])){channels[_0x45b331['linkedid']][_0xedb7('0x28')]=utils[_0xedb7('0x1f')]();}channels[_0x45b331[_0xedb7('0x1a')]]['disposition']=dispositions[_[_0xedb7('0x29')](_0x45b331['channelstate'])]||_0xedb7('0x5');}}catch(_0x182fcc){utils[_0xedb7('0x2a')](util[_0xedb7('0xb')](_0xedb7('0x22'),_0x45b331[_0xedb7('0x8')]),_0x182fcc);}};exports['hangup']=function(_0x401c28){try{if(!_[_0xedb7('0x23')](channels[_0x401c28['uniqueid']])){utils[_0xedb7('0x19')](util[_0xedb7('0xb')](_0xedb7('0x2b'),_0x401c28[_0xedb7('0x8')]),_0x401c28);if(_[_0xedb7('0x23')](channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x2c')])){channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x2c')]=_0x401c28[_0xedb7('0x2d')]+'\x20<'+_0x401c28[_0xedb7('0x1e')]+'>';}utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x2e'),_0x401c28['uniqueid'],channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x2c')],_0x401c28[_0xedb7('0x2f')]));channels[_0x401c28[_0xedb7('0x8')]]['endtime']=utils[_0xedb7('0x1f')]();channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x30')]=utils[_0xedb7('0x31')](channels[_0x401c28['uniqueid']][_0xedb7('0x32')],channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x33')]);channels[_0x401c28[_0xedb7('0x8')]]['billableseconds']=channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x28')]?utils[_0xedb7('0x31')](channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x32')],channels[_0x401c28[_0xedb7('0x8')]][_0xedb7('0x28')]):0x0;writeDB(channels[_0x401c28['uniqueid']]);}}catch(_0x14ebb7){utils['error'](util[_0xedb7('0xb')](_0xedb7('0x2b'),_0x401c28[_0xedb7('0x8')]),_0x14ebb7);}};exports['attendedtransfer']=function(_0x41fef4){try{if(!_[_0xedb7('0x23')](channels[_0x41fef4[_0xedb7('0x34')]])){utils[_0xedb7('0x19')](util[_0xedb7('0xb')]('[%s][calls][attendedtransfer]',_0x41fef4['origtransfereruniqueid']),_0x41fef4);if(channels[_0x41fef4[_0xedb7('0x34')]][_0xedb7('0xd')]==_0x41fef4[_0xedb7('0x35')]){utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x36'),_0x41fef4[_0xedb7('0x37')],_0x41fef4[_0xedb7('0x34')],_0x41fef4[_0xedb7('0x38')]));channels[_0x41fef4[_0xedb7('0x34')]][_0xedb7('0x39')]=_0x41fef4[_0xedb7('0x38')];channels[_0x41fef4[_0xedb7('0x34')]][_0xedb7('0x3a')]='_attended';}else if(channels[_0x41fef4[_0xedb7('0x34')]]['channel']=_0x41fef4[_0xedb7('0x3b')]){utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x36'),_0x41fef4[_0xedb7('0x37')],_0x41fef4[_0xedb7('0x34')],_0x41fef4[_0xedb7('0x3c')]));channels[_0x41fef4[_0xedb7('0x34')]][_0xedb7('0x39')]=_0x41fef4[_0xedb7('0x3c')];channels[_0x41fef4[_0xedb7('0x34')]][_0xedb7('0x3a')]=_0xedb7('0x3d');}}}catch(_0x3082fa){utils[_0xedb7('0x2a')](util[_0xedb7('0xb')]('[%s][calls][attendedtransfer]',_0x41fef4[_0xedb7('0x37')]),_0x3082fa);}};exports[_0xedb7('0x3e')]=function(_0x2e55ee){try{if(!_[_0xedb7('0x23')](channels[_0x2e55ee[_0xedb7('0x8')]])){utils[_0xedb7('0x19')](util[_0xedb7('0xb')](_0xedb7('0x3f'),_0x2e55ee[_0xedb7('0x8')]),_0x2e55ee);channels[_0x2e55ee[_0xedb7('0x8')]][_0xedb7('0x40')]=utils[_0xedb7('0x1f')]();utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x41'),_0x2e55ee[_0xedb7('0x8')],channels[_0x2e55ee[_0xedb7('0x8')]][_0xedb7('0x40')]));}}catch(_0x578751){utils['error'](util[_0xedb7('0xb')](_0xedb7('0x3f'),_0x2e55ee[_0xedb7('0x8')]),_0x578751);}};exports[_0xedb7('0x42')]=function(_0x41a834){try{if(!_[_0xedb7('0x23')](channels[_0x41a834['uniqueid']])){utils[_0xedb7('0x19')](util[_0xedb7('0xb')]('[%s][calls][musiconholdstop]',_0x41a834[_0xedb7('0x8')]),_0x41a834);if(!_[_0xedb7('0x23')](channels[_0x41a834['uniqueid']]['musiconholdstartAt'])){channels[_0x41a834[_0xedb7('0x8')]]['mohtime']+=utils[_0xedb7('0x31')](utils[_0xedb7('0x1f')](),channels[_0x41a834['uniqueid']]['musiconholdstartAt']);utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x43'),_0x41a834['uniqueid'],channels[_0x41a834[_0xedb7('0x8')]][_0xedb7('0x44')]));delete channels[_0x41a834['uniqueid']][_0xedb7('0x40')];}}}catch(_0x2defae){utils[_0xedb7('0x2a')](util[_0xedb7('0xb')](_0xedb7('0x45'),_0x41a834[_0xedb7('0x8')]),_0x2defae);}};exports['varset']=function(_0x523175){try{if(!_[_0xedb7('0x23')](channels[_0x523175[_0xedb7('0x8')]])){utils[_0xedb7('0x19')](util[_0xedb7('0xb')](_0xedb7('0x46'),_0x523175[_0xedb7('0x8')]),_0x523175);if(!_['isNil'](_0x523175[_0xedb7('0x47')]['xmd-originatecalleridnum'])){utils[_0xedb7('0xa')](util['format'](_0xedb7('0x48'),_0x523175[_0xedb7('0x8')],_0x523175[_0xedb7('0x49')]));channels[_0x523175['uniqueid']][_0xedb7('0x4a')]=_0x523175[_0xedb7('0x49')];}if(!_[_0xedb7('0x23')](_0x523175[_0xedb7('0x47')][_0xedb7('0x4b')])){utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x4c'),_0x523175[_0xedb7('0x8')],_0x523175['value']));channels[_0x523175[_0xedb7('0x8')]]['destination']=_0x523175[_0xedb7('0x49')];channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0x2c')]='\x22'+_0x523175[_0xedb7('0x49')]+_0xedb7('0x4d')+_0x523175[_0xedb7('0x49')]+'>';}if(!_[_0xedb7('0x23')](_0x523175['variable']['xmd-callerid-preview'])||!_['isNil'](_0x523175[_0xedb7('0x47')][_0xedb7('0x4e')])){utils['info'](util[_0xedb7('0xb')](_0xedb7('0x4f'),_0x523175['uniqueid'],!_[_0xedb7('0x23')](_0x523175['variable'][_0xedb7('0x50')])?_0xedb7('0x50'):'xmd-callerid',_0x523175[_0xedb7('0x49')]));channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0x2c')]=_0x523175[_0xedb7('0x49')];}if(!_[_0xedb7('0x23')](_0x523175['variable'][_0xedb7('0x51')])||!_[_0xedb7('0x23')](_0x523175[_0xedb7('0x47')][_0xedb7('0x52')])){utils['info'](util[_0xedb7('0xb')](_0xedb7('0x4f'),_0x523175[_0xedb7('0x8')],!_['isNil'](_0x523175[_0xedb7('0x47')][_0xedb7('0x51')])?'xmd-queue':_0xedb7('0x52'),_0x523175[_0xedb7('0x49')]));channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0x53')]=_0xedb7('0x54');channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0x55')]=_0x523175[_0xedb7('0x49')];channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0xe')]=!![];}if(!_[_0xedb7('0x23')](_0x523175['variable']['xmd-contactid'])){utils['info'](util[_0xedb7('0xb')](_0xedb7('0x56'),_0x523175[_0xedb7('0x8')],_0x523175['value']));channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0x57')]=_0x523175['value'];}if(!_[_0xedb7('0x23')](_0x523175['variable'][_0xedb7('0x58')])){utils[_0xedb7('0xa')](util['format'](_0xedb7('0x59'),_0x523175['uniqueid'],_0x523175[_0xedb7('0x49')]));channels[_0x523175[_0xedb7('0x8')]]['type']=_0x523175['value'];}if(!_[_0xedb7('0x23')](_0x523175[_0xedb7('0x47')][_0xedb7('0x5a')])){utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x5b'),_0x523175[_0xedb7('0x8')],_0x523175[_0xedb7('0x49')]));channels[_0x523175[_0xedb7('0x8')]]['routeid']=_0x523175[_0xedb7('0x49')];}if(!_['isNil'](_0x523175[_0xedb7('0x47')][_0xedb7('0x5c')])){utils[_0xedb7('0xa')](util[_0xedb7('0xb')](_0xedb7('0x5d'),_0x523175[_0xedb7('0x8')],_0x523175[_0xedb7('0x49')]));channels[_0x523175[_0xedb7('0x8')]][_0xedb7('0x5c')]=_0x523175[_0xedb7('0x49')];}}}catch(_0x20cb3f){utils[_0xedb7('0x2a')](util['format'](_0xedb7('0x46'),_0x523175['uniqueid']),_0x20cb3f);}};exports[_0xedb7('0x5e')]=function(_0x46695b){try{if(!_['isNil'](channels[_0x46695b[_0xedb7('0x8')]])){utils['debug'](util[_0xedb7('0xb')](_0xedb7('0x5f'),_0x46695b[_0xedb7('0x8')]),_0x46695b);utils[_0xedb7('0xa')](util[_0xedb7('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x46695b[_0xedb7('0x8')],_0x46695b['application'],_0x46695b[_0xedb7('0x60')]));if(_0x46695b[_0xedb7('0x61')][_0xedb7('0x62')]()==_0xedb7('0x63')&&_[_0xedb7('0x64')](_0x46695b[_0xedb7('0x60')][_0xedb7('0x62')](),_0xedb7('0x65'))){var _0x99ce77=_0x46695b[_0xedb7('0x60')][_0xedb7('0x66')]('=');var _0x2ff4bd=_0x99ce77[0x0][_0xedb7('0x67')](_0x99ce77[0x0][_0xedb7('0x68')]('(')+0x1,_0x99ce77[0x0][_0xedb7('0x68')](')'));var _0x27555c=_0x99ce77[0x1];channels[_0x46695b['uniqueid']][_0x2ff4bd]=_0x27555c;}if(!_[_0xedb7('0x69')]([_0xedb7('0x6a'),_0xedb7('0x6b'),_0xedb7('0x6c'),'set',_0xedb7('0x6d')],_0x46695b['application'][_0xedb7('0x62')]())){channels[_0x46695b['uniqueid']][_0xedb7('0x53')]=_0x46695b['application'];channels[_0x46695b[_0xedb7('0x8')]][_0xedb7('0x55')]=_0x46695b[_0xedb7('0x60')];}}}catch(_0x5f4532){utils['error'](util['format'](_0xedb7('0x5f'),_0x46695b['uniqueid']),_0x5f4532);}};
\ No newline at end of file
+var _0xea7e=['sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','gotoif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x1703b5,_0x43b249){var _0x16792c=function(_0x14d0c2){while(--_0x14d0c2){_0x1703b5['push'](_0x1703b5['shift']());}};_0x16792c(++_0x43b249);}(_0xea7e,0x143));var _0xeea7=function(_0x54c6ce,_0x5194e2){_0x54c6ce=_0x54c6ce-0x0;var _0x260983=_0xea7e[_0x54c6ce];return _0x260983;};'use strict';var _=require('lodash');var util=require(_0xeea7('0x0'));var utils=require(_0xeea7('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0xeea7('0x2'),_0xeea7('0x3'),_0xeea7('0x3'),'NO\x20ANSWER',_0xeea7('0x2'),_0xeea7('0x2'),_0xeea7('0x4'),_0xeea7('0x5'),_0xeea7('0x3'),_0xeea7('0x3'),_0xeea7('0x3')];var channels={};function writeDB(_0xe52304){var _0x3583d2;if(transfers[_0xeea7('0x6')][_0xe52304[_0xeea7('0x7')]]){_0x3583d2=_0xe52304['uniqueid'];_0xe52304[_0xeea7('0x7')]=transfers[_0xeea7('0x6')][_0xe52304[_0xeea7('0x7')]]['transfereeuniqueid'];}utils[_0xeea7('0x8')](util[_0xeea7('0x9')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xe52304[_0xeea7('0x7')],_0xe52304[_0xeea7('0xa')],_0xe52304[_0xeea7('0xb')],_0xe52304[_0xeea7('0xc')],_0xe52304[_0xeea7('0xd')],_0xe52304[_0xeea7('0xe')],_0xe52304[_0xeea7('0xf')],_0xe52304['lastevent']));if(_0xe52304['accountcode']){utils['getUserByInternal'](_0xe52304[_0xeea7('0x10')])[_0xeea7('0x11')](function(_0x534dac){if(_0x534dac){_0xe52304[_0xeea7('0x12')]=_0x534dac['id'];}utils[_0xeea7('0x13')](_0xeea7('0x14'),_0xe52304);});}else{utils['request'](_0xeea7('0x14'),_0xe52304);}if(channels[_0xe52304['uniqueid']]){delete channels[_0xe52304[_0xeea7('0x7')]];}else if(_0x3583d2&&channels[_0x3583d2]){if(!transfers['blinds'][_0x3583d2]['recording'])delete transfers[_0xeea7('0x6')][_0x3583d2];delete channels[_0x3583d2];}}exports[_0xeea7('0x15')]=function(_0x468c62){try{utils[_0xeea7('0x16')](util[_0xeea7('0x9')](_0xeea7('0x17'),_0x468c62[_0xeea7('0x7')]),_0x468c62);if(_0x468c62['uniqueid']==_0x468c62[_0xeea7('0x18')]&&_0x468c62['channel']!=_0xeea7('0x19')){utils['info'](util[_0xeea7('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x468c62[_0xeea7('0x7')],_0x468c62['context'],_0x468c62[_0xeea7('0x1a')]));channels[_0x468c62[_0xeea7('0x7')]]={'uniqueid':_0x468c62[_0xeea7('0x7')],'accountcode':_0x468c62[_0xeea7('0x10')],'source':_0x468c62[_0xeea7('0xe')],'destination':_0x468c62[_0xeea7('0x1a')],'destinationcontext':_0x468c62[_0xeea7('0x1b')],'channel':_0x468c62[_0xeea7('0xa')],'starttime':utils[_0xeea7('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xeea7('0x1d')};}}catch(_0x1ac42c){utils['error'](util[_0xeea7('0x9')]('[%s][calls][newchannel]',_0x468c62[_0xeea7('0x7')]),_0x1ac42c);}};exports[_0xeea7('0x1e')]=function(_0xeb0454){try{utils['debug'](util[_0xeea7('0x9')](_0xeea7('0x1f'),_0xeb0454[_0xeea7('0x7')]),_0xeb0454);if(!_[_0xeea7('0x20')](channels[_0xeb0454[_0xeea7('0x7')]])&&_0xeb0454[_0xeea7('0x21')]==0x6){utils[_0xeea7('0x8')](util[_0xeea7('0x9')](_0xeea7('0x22'),_0xeb0454[_0xeea7('0x7')],_0xeb0454[_0xeea7('0x1b')],_0xeb0454['channel']));if(_['isNil'](channels[_0xeb0454[_0xeea7('0x7')]]['systemanswertime'])){channels[_0xeb0454[_0xeea7('0x7')]][_0xeea7('0x23')]=utils['now']();}}else if(!_[_0xeea7('0x20')](channels[_0xeb0454[_0xeea7('0x18')]])&&_0xeb0454[_0xeea7('0x21')]==0x6&&_0xeb0454[_0xeea7('0x1b')]!='transfer'){utils[_0xeea7('0x8')](util[_0xeea7('0x9')](_0xeea7('0x24'),_0xeb0454['uniqueid'],_0xeb0454[_0xeea7('0x18')],_0xeb0454[_0xeea7('0x1b')],_0xeb0454['channel']));channels[_0xeb0454[_0xeea7('0x18')]]['accountcode']=_0xeb0454[_0xeea7('0x10')];channels[_0xeb0454['linkedid']][_0xeea7('0x25')]=_0xeb0454[_0xeea7('0xa')];if(_[_0xeea7('0x20')](channels[_0xeb0454['linkedid']][_0xeea7('0x26')])){channels[_0xeb0454[_0xeea7('0x18')]]['answertime']=utils[_0xeea7('0x1c')]();}channels[_0xeb0454['linkedid']][_0xeea7('0x27')]=dispositions[_[_0xeea7('0x28')](_0xeb0454[_0xeea7('0x21')])]||_0xeea7('0x4');}}catch(_0x1cf8aa){utils[_0xeea7('0x29')](util['format'](_0xeea7('0x1f'),_0xeb0454[_0xeea7('0x7')]),_0x1cf8aa);}};exports[_0xeea7('0x2a')]=function(_0x168e62){try{if(!_[_0xeea7('0x20')](channels[_0x168e62[_0xeea7('0x7')]])){utils[_0xeea7('0x16')](util[_0xeea7('0x9')]('[%s][calls][hangup]',_0x168e62[_0xeea7('0x7')]),_0x168e62);if(_[_0xeea7('0x20')](channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x2b')])){channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x2b')]=_0x168e62['calleridname']+'\x20<'+_0x168e62[_0xeea7('0xe')]+'>';}utils['info'](util[_0xeea7('0x9')](_0xeea7('0x2c'),_0x168e62[_0xeea7('0x7')],channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x2b')],_0x168e62['cause-txt']));channels[_0x168e62['uniqueid']][_0xeea7('0x2d')]=utils[_0xeea7('0x1c')]();channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x2e')]=utils[_0xeea7('0x2f')](channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x2d')],channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x30')]);channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x31')]=channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x26')]?utils['diffTime'](channels[_0x168e62['uniqueid']][_0xeea7('0x2d')],channels[_0x168e62[_0xeea7('0x7')]][_0xeea7('0x26')]):0x0;writeDB(channels[_0x168e62['uniqueid']]);}}catch(_0x199ab2){utils[_0xeea7('0x29')](util[_0xeea7('0x9')](_0xeea7('0x32'),_0x168e62[_0xeea7('0x7')]),_0x199ab2);}};exports[_0xeea7('0x33')]=function(_0xbe47f0){try{if(!_[_0xeea7('0x20')](channels[_0xbe47f0[_0xeea7('0x34')]])){utils[_0xeea7('0x16')](util[_0xeea7('0x9')]('[%s][calls][attendedtransfer]',_0xbe47f0[_0xeea7('0x35')]),_0xbe47f0);if(channels[_0xbe47f0['localtwolinkedid']]['channel']==_0xbe47f0[_0xeea7('0x36')]){utils['info'](util[_0xeea7('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xbe47f0[_0xeea7('0x35')],_0xbe47f0[_0xeea7('0x34')],_0xbe47f0['secondtransfererchannel']));channels[_0xbe47f0['localtwolinkedid']][_0xeea7('0x25')]=_0xbe47f0[_0xeea7('0x37')];channels[_0xbe47f0['localtwolinkedid']][_0xeea7('0x38')]=_0xeea7('0x39');}else if(channels[_0xbe47f0[_0xeea7('0x34')]][_0xeea7('0xa')]=_0xbe47f0[_0xeea7('0x3a')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xbe47f0[_0xeea7('0x35')],_0xbe47f0[_0xeea7('0x34')],_0xbe47f0[_0xeea7('0x3b')]));channels[_0xbe47f0['localtwolinkedid']][_0xeea7('0x25')]=_0xbe47f0[_0xeea7('0x3b')];channels[_0xbe47f0[_0xeea7('0x34')]][_0xeea7('0x38')]='_attended';}}}catch(_0x221c39){utils[_0xeea7('0x29')](util[_0xeea7('0x9')]('[%s][calls][attendedtransfer]',_0xbe47f0[_0xeea7('0x35')]),_0x221c39);}};exports[_0xeea7('0x3c')]=function(_0x316299){try{if(!_[_0xeea7('0x20')](channels[_0x316299[_0xeea7('0x7')]])){utils[_0xeea7('0x16')](util[_0xeea7('0x9')](_0xeea7('0x3d'),_0x316299[_0xeea7('0x7')]),_0x316299);channels[_0x316299['uniqueid']][_0xeea7('0x3e')]=utils['now']();utils['info'](util[_0xeea7('0x9')](_0xeea7('0x3f'),_0x316299[_0xeea7('0x7')],channels[_0x316299['uniqueid']][_0xeea7('0x3e')]));}}catch(_0x53616d){utils[_0xeea7('0x29')](util[_0xeea7('0x9')](_0xeea7('0x3d'),_0x316299[_0xeea7('0x7')]),_0x53616d);}};exports[_0xeea7('0x40')]=function(_0xd9692e){try{if(!_[_0xeea7('0x20')](channels[_0xd9692e[_0xeea7('0x7')]])){utils[_0xeea7('0x16')](util[_0xeea7('0x9')](_0xeea7('0x41'),_0xd9692e[_0xeea7('0x7')]),_0xd9692e);if(!_[_0xeea7('0x20')](channels[_0xd9692e[_0xeea7('0x7')]][_0xeea7('0x3e')])){channels[_0xd9692e[_0xeea7('0x7')]][_0xeea7('0x42')]+=utils[_0xeea7('0x2f')](utils[_0xeea7('0x1c')](),channels[_0xd9692e[_0xeea7('0x7')]][_0xeea7('0x3e')]);utils['info'](util['format'](_0xeea7('0x43'),_0xd9692e[_0xeea7('0x7')],channels[_0xd9692e[_0xeea7('0x7')]][_0xeea7('0x42')]));delete channels[_0xd9692e[_0xeea7('0x7')]][_0xeea7('0x3e')];}}}catch(_0x2e3e48){utils[_0xeea7('0x29')](util[_0xeea7('0x9')](_0xeea7('0x41'),_0xd9692e[_0xeea7('0x7')]),_0x2e3e48);}};exports[_0xeea7('0x44')]=function(_0x55733c){try{if(!_[_0xeea7('0x20')](channels[_0x55733c[_0xeea7('0x7')]])){utils[_0xeea7('0x16')](util['format'](_0xeea7('0x45'),_0x55733c[_0xeea7('0x7')]),_0x55733c);if(!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')]['xmd-originatecalleridnum'])){utils[_0xeea7('0x8')](util[_0xeea7('0x9')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x55733c[_0xeea7('0x7')],_0x55733c[_0xeea7('0x47')]));channels[_0x55733c[_0xeea7('0x7')]][_0xeea7('0x48')]=_0x55733c[_0xeea7('0x47')];}if(!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')][_0xeea7('0x49')])){utils[_0xeea7('0x8')](util['format'](_0xeea7('0x4a'),_0x55733c[_0xeea7('0x7')],_0x55733c[_0xeea7('0x47')]));channels[_0x55733c['uniqueid']][_0xeea7('0x4b')]=_0x55733c[_0xeea7('0x47')];channels[_0x55733c['uniqueid']]['callerid']='\x22'+_0x55733c['value']+_0xeea7('0x4c')+_0x55733c[_0xeea7('0x47')]+'>';}if(!_[_0xeea7('0x20')](_0x55733c['variable'][_0xeea7('0x4d')])||!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')]['xmd-callerid'])){utils[_0xeea7('0x8')](util[_0xeea7('0x9')](_0xeea7('0x4e'),_0x55733c[_0xeea7('0x7')],!_['isNil'](_0x55733c[_0xeea7('0x46')][_0xeea7('0x4d')])?_0xeea7('0x4d'):'xmd-callerid',_0x55733c[_0xeea7('0x47')]));channels[_0x55733c['uniqueid']]['callerid']=_0x55733c['value'];}if(!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')][_0xeea7('0x4f')])||!_['isNil'](_0x55733c['variable'][_0xeea7('0x50')])){utils['info'](util[_0xeea7('0x9')](_0xeea7('0x4e'),_0x55733c[_0xeea7('0x7')],!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')][_0xeea7('0x4f')])?'xmd-queue':_0xeea7('0x50'),_0x55733c[_0xeea7('0x47')]));channels[_0x55733c['uniqueid']][_0xeea7('0x51')]='Queue';channels[_0x55733c[_0xeea7('0x7')]][_0xeea7('0x52')]=_0x55733c['value'];channels[_0x55733c[_0xeea7('0x7')]]['queue']=!![];}if(!_['isNil'](_0x55733c['variable'][_0xeea7('0x53')])){utils[_0xeea7('0x8')](util[_0xeea7('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x55733c[_0xeea7('0x7')],_0x55733c[_0xeea7('0x47')]));channels[_0x55733c['uniqueid']][_0xeea7('0x54')]=_0x55733c[_0xeea7('0x47')];}if(!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')][_0xeea7('0x55')])){utils[_0xeea7('0x8')](util[_0xeea7('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x55733c['uniqueid'],_0x55733c[_0xeea7('0x47')]));channels[_0x55733c['uniqueid']][_0xeea7('0x56')]=_0x55733c[_0xeea7('0x47')];}if(!_['isNil'](_0x55733c[_0xeea7('0x46')][_0xeea7('0x57')])){utils[_0xeea7('0x8')](util[_0xeea7('0x9')](_0xeea7('0x58'),_0x55733c[_0xeea7('0x7')],_0x55733c[_0xeea7('0x47')]));channels[_0x55733c[_0xeea7('0x7')]]['routeid']=_0x55733c[_0xeea7('0x47')];}if(!_[_0xeea7('0x20')](_0x55733c[_0xeea7('0x46')][_0xeea7('0x59')])){utils[_0xeea7('0x8')](util[_0xeea7('0x9')](_0xeea7('0x5a'),_0x55733c[_0xeea7('0x7')],_0x55733c[_0xeea7('0x47')]));channels[_0x55733c['uniqueid']][_0xeea7('0x59')]=_0x55733c[_0xeea7('0x47')];}}}catch(_0x22aa9e){utils['error'](util['format'](_0xeea7('0x45'),_0x55733c['uniqueid']),_0x22aa9e);}};exports['newexten']=function(_0x557dc0){try{if(!_[_0xeea7('0x20')](channels[_0x557dc0[_0xeea7('0x7')]])){utils['debug'](util[_0xeea7('0x9')](_0xeea7('0x5b'),_0x557dc0[_0xeea7('0x7')]),_0x557dc0);utils[_0xeea7('0x8')](util[_0xeea7('0x9')](_0xeea7('0x5c'),_0x557dc0[_0xeea7('0x7')],_0x557dc0[_0xeea7('0x5d')],_0x557dc0[_0xeea7('0x5e')]));if(_0x557dc0['application'][_0xeea7('0x5f')]()==_0xeea7('0x60')&&_[_0xeea7('0x61')](_0x557dc0[_0xeea7('0x5e')][_0xeea7('0x5f')](),'cdr')){var _0x2bce24=_0x557dc0[_0xeea7('0x5e')][_0xeea7('0x62')]('=');var _0x2a9eac=_0x2bce24[0x0][_0xeea7('0x63')](_0x2bce24[0x0]['lastIndexOf']('(')+0x1,_0x2bce24[0x0][_0xeea7('0x64')](')'));var _0xcfd5ac=_0x2bce24[0x1];channels[_0x557dc0[_0xeea7('0x7')]][_0x2a9eac]=_0xcfd5ac;}if(!_[_0xeea7('0x65')]([_0xeea7('0x2a'),'noop','execif','set',_0xeea7('0x66')],_0x557dc0[_0xeea7('0x5d')][_0xeea7('0x5f')]())){channels[_0x557dc0[_0xeea7('0x7')]][_0xeea7('0x51')]=_0x557dc0[_0xeea7('0x5d')];channels[_0x557dc0['uniqueid']][_0xeea7('0x52')]=_0x557dc0[_0xeea7('0x5e')];}}}catch(_0x477d1f){utils['error'](util[_0xeea7('0x9')](_0xeea7('0x5b'),_0x557dc0[_0xeea7('0x7')]),_0x477d1f);}};
\ No newline at end of file
index 4e9a7f1..9372dd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcfde=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','./utils','connect'];(function(_0x9d3488,_0x37907f){var _0x16792e=function(_0x319043){while(--_0x319043){_0x9d3488['push'](_0x9d3488['shift']());}};_0x16792e(++_0x37907f);}(_0xcfde,0x111));var _0xecfd=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xcfde[_0x33032e];return _0x13316b;};'use strict';var utils=require(_0xecfd('0x0'));exports[_0xecfd('0x1')]=function(){utils[_0xecfd('0x2')](_0xecfd('0x3'));};exports[_0xecfd('0x4')]=function(){utils[_0xecfd('0x2')](_0xecfd('0x5'));};exports[_0xecfd('0x6')]=function(){utils[_0xecfd('0x2')](_0xecfd('0x7'));};exports[_0xecfd('0x8')]=function(_0x1aa003){utils[_0xecfd('0x8')]('[core]\x20error',_0x1aa003);};exports[_0xecfd('0x9')]=function(){utils['info'](_0xecfd('0xa'));};exports['managerevent']=function(_0x3e04ae){};
\ No newline at end of file
+var _0xcde3=['info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xcde3,0x14e));var _0x3cde=function(_0x35c2fc,_0xabea37){_0x35c2fc=_0x35c2fc-0x0;var _0x4727fd=_0xcde3[_0x35c2fc];return _0x4727fd;};'use strict';var utils=require(_0x3cde('0x0'));exports[_0x3cde('0x1')]=function(){utils[_0x3cde('0x2')]('[core]\x20connected');};exports[_0x3cde('0x3')]=function(){utils[_0x3cde('0x2')](_0x3cde('0x4'));};exports[_0x3cde('0x5')]=function(){utils[_0x3cde('0x2')](_0x3cde('0x6'));};exports[_0x3cde('0x7')]=function(_0x376918){utils[_0x3cde('0x7')](_0x3cde('0x8'),_0x376918);};exports[_0x3cde('0x9')]=function(){utils[_0x3cde('0x2')](_0x3cde('0xa'));};exports[_0x3cde('0xb')]=function(_0x57ee33){};
\ No newline at end of file
index cf14975..7a86675 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbecd=['error','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','endtime','holdtime','diffTime','answertime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','application','appdata','toLowerCase','set','startsWith','split','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbecd,0x174));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdbec('0x0'));var util=require(_0xdbec('0x1'));var utils=require('./utils');var dials={};function writeDB(_0xeaa0fd){utils[_0xdbec('0x2')](util[_0xdbec('0x3')](_0xdbec('0x4'),_0xeaa0fd['uniqueid'],_0xeaa0fd[_0xdbec('0x5')],_0xeaa0fd[_0xdbec('0x6')],_0xeaa0fd[_0xdbec('0x7')],_0xeaa0fd[_0xdbec('0x8')],_0xeaa0fd[_0xdbec('0x9')]));utils[_0xdbec('0xa')](_0xdbec('0xb'),_0xeaa0fd);delete dials[_0xeaa0fd['uniqueid']];}exports[_0xdbec('0xc')]=function(_0x103a39){try{utils[_0xdbec('0xd')](util[_0xdbec('0x3')](_0xdbec('0xe'),_0x103a39[_0xdbec('0xf')]),_0x103a39);utils['info'](util[_0xdbec('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x103a39[_0xdbec('0xf')],_0x103a39[_0xdbec('0x10')],_0x103a39[_0xdbec('0x11')]));if(_0x103a39[_0xdbec('0x10')][_0xdbec('0x12')]()==_0xdbec('0x13')&&_[_0xdbec('0x14')](_0x103a39[_0xdbec('0x11')][_0xdbec('0x12')](),'cdr(routeid)')){var _0x15cdf1=_0x103a39[_0xdbec('0x11')][_0xdbec('0x15')]('=');dials[_0x103a39[_0xdbec('0xf')]]={'routeId':_0x15cdf1[0x1]};}}catch(_0x3547a8){utils['error'](util[_0xdbec('0x3')](_0xdbec('0xe'),_0x103a39[_0xdbec('0xf')]),_0x3547a8);}};exports[_0xdbec('0x16')]=function(_0x84eed0){try{utils[_0xdbec('0xd')](util[_0xdbec('0x3')](_0xdbec('0x17'),_0x84eed0[_0xdbec('0xf')]),_0x84eed0);if(!_[_0xdbec('0x18')](_0x84eed0[_0xdbec('0x19')]['outboundrouteid'])){utils['info'](util[_0xdbec('0x3')](_0xdbec('0x1a'),_0x84eed0[_0xdbec('0xf')],_0x84eed0[_0xdbec('0x1b')]));dials[_0x84eed0['uniqueid']]={'routeId':_0x84eed0[_0xdbec('0x1b')]};}}catch(_0x13470c){utils[_0xdbec('0x1c')](util[_0xdbec('0x3')](_0xdbec('0x17'),_0x84eed0['uniqueid']),_0x13470c);}};exports['dialbegin']=function(_0x535114){try{if(!_[_0xdbec('0x18')](dials[_0x535114[_0xdbec('0xf')]])){utils[_0xdbec('0xd')](util[_0xdbec('0x3')]('[%s][dials][dialbegin]',_0x535114['uniqueid']),_0x535114);dials[_0x535114[_0xdbec('0xf')]]=_[_0xdbec('0x1d')](dials[_0x535114['uniqueid']],_0x535114);dials[_0x535114[_0xdbec('0xf')]][_0xdbec('0x1e')]=utils[_0xdbec('0x1f')]();dials[_0x535114[_0xdbec('0xf')]][_0xdbec('0x20')]=_0xdbec('0x21');utils['info'](util[_0xdbec('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x535114['uniqueid'],dials[_0x535114[_0xdbec('0xf')]][_0xdbec('0x1e')]));}}catch(_0x59d909){utils['error'](util[_0xdbec('0x3')](_0xdbec('0x22'),_0x535114[_0xdbec('0xf')]),_0x59d909);}};exports[_0xdbec('0x23')]=function(_0x201584){try{if(!_[_0xdbec('0x18')](dials[_0x201584[_0xdbec('0xf')]])){utils[_0xdbec('0xd')](util['format'](_0xdbec('0x24'),_0x201584[_0xdbec('0xf')]),_0x201584);dials[_0x201584[_0xdbec('0xf')]][_0xdbec('0x9')]=_0x201584['dialstatus'];if(_0x201584[_0xdbec('0x9')]=='ANSWER'){dials[_0x201584['uniqueid']]=_[_0xdbec('0x1d')](dials[_0x201584[_0xdbec('0xf')]],_0x201584);dials[_0x201584['uniqueid']]['answertime']=utils[_0xdbec('0x1f')]();dials[_0x201584[_0xdbec('0xf')]][_0xdbec('0x20')]=_0xdbec('0x25');utils[_0xdbec('0x2')](util[_0xdbec('0x3')](_0xdbec('0x26'),_0x201584[_0xdbec('0xf')],_0x201584['dialstatus'],dials[_0x201584[_0xdbec('0xf')]]['answertime']));}else{utils['info'](util[_0xdbec('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x201584[_0xdbec('0xf')],_0x201584['dialstatus']));}}}catch(_0x4d55dc){utils[_0xdbec('0x1c')](util[_0xdbec('0x3')](_0xdbec('0x24'),_0x201584['uniqueid']),_0x4d55dc);}};exports[_0xdbec('0x27')]=function(_0x569ad7){try{if(!_[_0xdbec('0x18')](dials[_0x569ad7[_0xdbec('0xf')]])){utils[_0xdbec('0xd')](util[_0xdbec('0x3')](_0xdbec('0x28'),_0x569ad7[_0xdbec('0xf')]),_0x569ad7);utils[_0xdbec('0x2')](util[_0xdbec('0x3')](_0xdbec('0x29'),_0x569ad7[_0xdbec('0xf')],_0x569ad7[_0xdbec('0x7')],_0x569ad7['calleridname'],_0x569ad7[_0xdbec('0x2a')]));dials[_0x569ad7['uniqueid']]=_[_0xdbec('0x1d')](dials[_0x569ad7[_0xdbec('0xf')]],{'endtime':utils[_0xdbec('0x1f')](),'lastevent':_0xdbec('0x2b')});dials[_0x569ad7['uniqueid']][_0xdbec('0x2c')]=utils['diffTime'](dials[_0x569ad7[_0xdbec('0xf')]][_0xdbec('0x2d')],dials[_0x569ad7[_0xdbec('0xf')]][_0xdbec('0x1e')]);dials[_0x569ad7['uniqueid']][_0xdbec('0x2e')]=utils[_0xdbec('0x2f')](dials[_0x569ad7[_0xdbec('0xf')]][_0xdbec('0x30')]||dials[_0x569ad7['uniqueid']]['endtime'],dials[_0x569ad7[_0xdbec('0xf')]][_0xdbec('0x1e')]);dials[_0x569ad7['uniqueid']][_0xdbec('0x31')]=dials[_0x569ad7[_0xdbec('0xf')]][_0xdbec('0x30')]?utils[_0xdbec('0x2f')](dials[_0x569ad7[_0xdbec('0xf')]][_0xdbec('0x2d')],dials[_0x569ad7[_0xdbec('0xf')]]['answertime']):0x0;writeDB(dials[_0x569ad7[_0xdbec('0xf')]]);}}catch(_0x2ce114){utils[_0xdbec('0x1c')](util['format'](_0xdbec('0x28'),_0x569ad7[_0xdbec('0xf')]),_0x2ce114);}};
\ No newline at end of file
+var _0x07fc=['[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x07fc,0x17c));var _0xc07f=function(_0x53cadf,_0x1f5afb){_0x53cadf=_0x53cadf-0x0;var _0x123026=_0x07fc[_0x53cadf];return _0x123026;};'use strict';var _=require('lodash');var util=require(_0xc07f('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x5f1b30){utils[_0xc07f('0x1')](util[_0xc07f('0x2')](_0xc07f('0x3'),_0x5f1b30['uniqueid'],_0x5f1b30[_0xc07f('0x4')],_0x5f1b30[_0xc07f('0x5')],_0x5f1b30[_0xc07f('0x6')],_0x5f1b30[_0xc07f('0x7')],_0x5f1b30[_0xc07f('0x8')]));utils[_0xc07f('0x9')](_0xc07f('0xa'),_0x5f1b30);delete dials[_0x5f1b30[_0xc07f('0xb')]];}exports[_0xc07f('0xc')]=function(_0x548ca3){try{utils[_0xc07f('0xd')](util[_0xc07f('0x2')]('[%s][dials][newexten]',_0x548ca3[_0xc07f('0xb')]),_0x548ca3);utils[_0xc07f('0x1')](util[_0xc07f('0x2')](_0xc07f('0xe'),_0x548ca3[_0xc07f('0xb')],_0x548ca3[_0xc07f('0xf')],_0x548ca3['appdata']));if(_0x548ca3[_0xc07f('0xf')][_0xc07f('0x10')]()==_0xc07f('0x11')&&_[_0xc07f('0x12')](_0x548ca3[_0xc07f('0x13')][_0xc07f('0x10')](),_0xc07f('0x14'))){var _0x43fae3=_0x548ca3[_0xc07f('0x13')][_0xc07f('0x15')]('=');dials[_0x548ca3[_0xc07f('0xb')]]={'routeId':_0x43fae3[0x1]};}}catch(_0x2dea43){utils[_0xc07f('0x16')](util[_0xc07f('0x2')](_0xc07f('0x17'),_0x548ca3[_0xc07f('0xb')]),_0x2dea43);}};exports[_0xc07f('0x18')]=function(_0x2a0776){try{utils[_0xc07f('0xd')](util['format'](_0xc07f('0x19'),_0x2a0776[_0xc07f('0xb')]),_0x2a0776);if(!_['isNil'](_0x2a0776[_0xc07f('0x1a')]['outboundrouteid'])){utils['info'](util['format'](_0xc07f('0x1b'),_0x2a0776[_0xc07f('0xb')],_0x2a0776[_0xc07f('0x1c')]));dials[_0x2a0776[_0xc07f('0xb')]]={'routeId':_0x2a0776[_0xc07f('0x1c')]};}}catch(_0x9d980e){utils[_0xc07f('0x16')](util[_0xc07f('0x2')]('[%s][dials][varset]',_0x2a0776[_0xc07f('0xb')]),_0x9d980e);}};exports['dialbegin']=function(_0x5332dc){try{if(!_[_0xc07f('0x1d')](dials[_0x5332dc[_0xc07f('0xb')]])){utils[_0xc07f('0xd')](util[_0xc07f('0x2')](_0xc07f('0x1e'),_0x5332dc['uniqueid']),_0x5332dc);dials[_0x5332dc[_0xc07f('0xb')]]=_[_0xc07f('0x1f')](dials[_0x5332dc[_0xc07f('0xb')]],_0x5332dc);dials[_0x5332dc[_0xc07f('0xb')]]['starttime']=utils[_0xc07f('0x20')]();dials[_0x5332dc[_0xc07f('0xb')]]['lastevent']=_0xc07f('0x21');utils[_0xc07f('0x1')](util[_0xc07f('0x2')](_0xc07f('0x22'),_0x5332dc[_0xc07f('0xb')],dials[_0x5332dc[_0xc07f('0xb')]][_0xc07f('0x23')]));}}catch(_0x21d093){utils[_0xc07f('0x16')](util[_0xc07f('0x2')](_0xc07f('0x1e'),_0x5332dc[_0xc07f('0xb')]),_0x21d093);}};exports[_0xc07f('0x24')]=function(_0xdf4008){try{if(!_[_0xc07f('0x1d')](dials[_0xdf4008[_0xc07f('0xb')]])){utils[_0xc07f('0xd')](util[_0xc07f('0x2')]('[%s][dials][dialend]',_0xdf4008[_0xc07f('0xb')]),_0xdf4008);dials[_0xdf4008[_0xc07f('0xb')]]['dialstatus']=_0xdf4008[_0xc07f('0x8')];if(_0xdf4008[_0xc07f('0x8')]==_0xc07f('0x25')){dials[_0xdf4008[_0xc07f('0xb')]]=_['assign'](dials[_0xdf4008['uniqueid']],_0xdf4008);dials[_0xdf4008[_0xc07f('0xb')]][_0xc07f('0x26')]=utils[_0xc07f('0x20')]();dials[_0xdf4008[_0xc07f('0xb')]]['lastevent']=_0xc07f('0x27');utils[_0xc07f('0x1')](util[_0xc07f('0x2')](_0xc07f('0x28'),_0xdf4008[_0xc07f('0xb')],_0xdf4008[_0xc07f('0x8')],dials[_0xdf4008[_0xc07f('0xb')]][_0xc07f('0x26')]));}else{utils[_0xc07f('0x1')](util['format'](_0xc07f('0x29'),_0xdf4008[_0xc07f('0xb')],_0xdf4008[_0xc07f('0x8')]));}}}catch(_0x55d431){utils[_0xc07f('0x16')](util[_0xc07f('0x2')](_0xc07f('0x2a'),_0xdf4008[_0xc07f('0xb')]),_0x55d431);}};exports[_0xc07f('0x2b')]=function(_0x45466f){try{if(!_['isNil'](dials[_0x45466f[_0xc07f('0xb')]])){utils[_0xc07f('0xd')](util[_0xc07f('0x2')]('[%s][dials][hangup]',_0x45466f[_0xc07f('0xb')]),_0x45466f);utils[_0xc07f('0x1')](util['format'](_0xc07f('0x2c'),_0x45466f[_0xc07f('0xb')],_0x45466f[_0xc07f('0x6')],_0x45466f['calleridname'],_0x45466f[_0xc07f('0x2d')]));dials[_0x45466f[_0xc07f('0xb')]]=_['assign'](dials[_0x45466f[_0xc07f('0xb')]],{'endtime':utils[_0xc07f('0x20')](),'lastevent':_0xc07f('0x2e')});dials[_0x45466f[_0xc07f('0xb')]][_0xc07f('0x2f')]=utils[_0xc07f('0x30')](dials[_0x45466f[_0xc07f('0xb')]][_0xc07f('0x31')],dials[_0x45466f['uniqueid']]['starttime']);dials[_0x45466f[_0xc07f('0xb')]][_0xc07f('0x32')]=utils[_0xc07f('0x30')](dials[_0x45466f[_0xc07f('0xb')]]['answertime']||dials[_0x45466f[_0xc07f('0xb')]][_0xc07f('0x31')],dials[_0x45466f[_0xc07f('0xb')]][_0xc07f('0x23')]);dials[_0x45466f['uniqueid']][_0xc07f('0x33')]=dials[_0x45466f['uniqueid']]['answertime']?utils[_0xc07f('0x30')](dials[_0x45466f[_0xc07f('0xb')]]['endtime'],dials[_0x45466f[_0xc07f('0xb')]][_0xc07f('0x26')]):0x0;writeDB(dials[_0x45466f[_0xc07f('0xb')]]);}}catch(_0x3bf214){utils[_0xc07f('0x16')](util[_0xc07f('0x2')](_0xc07f('0x34'),_0x45466f['uniqueid']),_0x3bf214);}};
\ No newline at end of file
index b860e57..f92a809 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa204=['[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa204,0x16f));var _0x4a20=function(_0x3d9ea9,_0x59d418){_0x3d9ea9=_0x3d9ea9-0x0;var _0x244234=_0xa204[_0x3d9ea9];return _0x244234;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x4a20('0x0'));var isXDREnabled=config[_0x4a20('0x1')]&&config[_0x4a20('0x1')][_0x4a20('0x2')]?!config['xdr'][_0x4a20('0x2')]:!![];var isProduction=config[_0x4a20('0x3')]==='production'||![];var isLocalAsterisk=config[_0x4a20('0x1')]&&config['xdr'][_0x4a20('0x4')]===!![]||![];var ami=new AsteriskManager(config[_0x4a20('0x5')][_0x4a20('0x6')],config[_0x4a20('0x5')]['ip'],config[_0x4a20('0x5')][_0x4a20('0x7')],config[_0x4a20('0x5')][_0x4a20('0x8')],!![]);ami[_0x4a20('0x9')]();if(!isXDREnabled){utils[_0x4a20('0xa')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x4a20('0xa')](_0x4a20('0xb'));}else{var agents=require(_0x4a20('0xc'));var calls=require('./calls.controller');var queues=require(_0x4a20('0xd'));var recordings=require(_0x4a20('0xe'));var members=require(_0x4a20('0xf'));var dials=require('./dials.controller');var transfers=require(_0x4a20('0x10'));var core=require(_0x4a20('0x11'));ami['on'](_0x4a20('0x12'),core[_0x4a20('0x12')]);ami['on'](_0x4a20('0x13'),core[_0x4a20('0x13')]);ami['on'](_0x4a20('0x14'),core[_0x4a20('0x14')]);ami['on'](_0x4a20('0x15'),core[_0x4a20('0x15')]);ami['on'](_0x4a20('0x16'),core[_0x4a20('0x16')]);ami['on'](_0x4a20('0x17'),core[_0x4a20('0x17')]);ami['on'](_0x4a20('0x18'),function(_0x441bdb){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')]('[%s][index][devicestatechange]',_0x441bdb[_0x4a20('0x1b')]),_0x441bdb);members[_0x4a20('0x18')](_0x441bdb);}catch(_0x1da29e){utils[_0x4a20('0x15')](util['format'](_0x4a20('0x1c'),_0x441bdb[_0x4a20('0x1b')]),_0x1da29e);}});ami['on'](_0x4a20('0x1d'),function(_0x1c9842){try{utils['debug'](util[_0x4a20('0x1a')](_0x4a20('0x1e'),_0x1c9842[_0x4a20('0x1f')]),_0x1c9842);agents[_0x4a20('0x1d')](_0x1c9842);}catch(_0x19e3ad){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x1e'),_0x1c9842['uniqueid']),_0x19e3ad);}});ami['on'](_0x4a20('0x20'),function(_0x32ba33){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x21'),_0x32ba33['uniqueid']),_0x32ba33);agents['agentringnoanswer'](_0x32ba33);}catch(_0x2d8e41){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x21'),_0x32ba33[_0x4a20('0x1f')]),_0x2d8e41);}});ami['on'](_0x4a20('0x22'),function(_0x53137b){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x23'),_0x53137b[_0x4a20('0x1f')]),_0x53137b);agents[_0x4a20('0x22')](_0x53137b);queues[_0x4a20('0x22')](_0x53137b);}catch(_0x1ebc79){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x23'),_0x53137b[_0x4a20('0x1f')]),_0x1ebc79);}});ami['on'](_0x4a20('0x24'),function(_0x25ed3b){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x25'),_0x25ed3b[_0x4a20('0x1f')]),_0x25ed3b);agents[_0x4a20('0x24')](_0x25ed3b);queues[_0x4a20('0x24')](_0x25ed3b);members[_0x4a20('0x24')](_0x25ed3b);}catch(_0x4403f3){utils[_0x4a20('0x15')](util['format'](_0x4a20('0x25'),_0x25ed3b[_0x4a20('0x1f')]),_0x4403f3);}});ami['on'](_0x4a20('0x26'),function(_0x31ed28){try{utils['debug'](util['format'](_0x4a20('0x27'),_0x31ed28['uniqueid']),_0x31ed28);agents['queuecallerabandon'](_0x31ed28);queues[_0x4a20('0x26')](_0x31ed28);}catch(_0x1ceb21){utils[_0x4a20('0x15')](util['format']('[%s][index][queuecallerabandon]',_0x31ed28[_0x4a20('0x1f')]),_0x1ceb21);}});ami['on'](_0x4a20('0x28'),function(_0x3abf72){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x29'),_0x3abf72[_0x4a20('0x1f')]),_0x3abf72);queues[_0x4a20('0x28')](_0x3abf72);recordings['queuecallerjoin'](_0x3abf72);}catch(_0x28042e){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x29'),_0x3abf72['uniqueid']),_0x28042e);}});ami['on'](_0x4a20('0x2a'),function(_0x168703){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x2b'),_0x168703['uniqueid']),_0x168703);queues[_0x4a20('0x2a')](_0x168703);}catch(_0x16e588){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')]('[%s][index][queuecallerleave]',_0x168703[_0x4a20('0x1f')]),_0x16e588);}});ami['on'](_0x4a20('0x2c'),function(_0x5b8630){try{utils[_0x4a20('0x19')](util['format']('[%s][index][musiconholdstart]',_0x5b8630[_0x4a20('0x1f')]),_0x5b8630);queues[_0x4a20('0x2c')](_0x5b8630);calls['musiconholdstart'](_0x5b8630);}catch(_0x3054ad){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x2d'),_0x5b8630[_0x4a20('0x1f')]),_0x3054ad);}});ami['on'](_0x4a20('0x2e'),function(_0x189ace){try{utils['debug'](util[_0x4a20('0x1a')](_0x4a20('0x2f'),_0x189ace[_0x4a20('0x1f')]),_0x189ace);queues[_0x4a20('0x2e')](_0x189ace);calls[_0x4a20('0x2e')](_0x189ace);}catch(_0x24e29f){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x2f'),_0x189ace[_0x4a20('0x1f')]),_0x24e29f);}});ami['on'](_0x4a20('0x30'),function(_0x16c81a){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x31'),_0x16c81a[_0x4a20('0x1f')]),_0x16c81a);calls['newstate'](_0x16c81a);recordings[_0x4a20('0x30')](_0x16c81a);}catch(_0x17b8c8){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x31'),_0x16c81a[_0x4a20('0x1f')]),_0x17b8c8);}});ami['on'](_0x4a20('0x32'),function(_0x5ea6ab){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x33'),_0x5ea6ab[_0x4a20('0x1f')]),_0x5ea6ab);calls[_0x4a20('0x32')](_0x5ea6ab);recordings[_0x4a20('0x32')](_0x5ea6ab);dials[_0x4a20('0x32')](_0x5ea6ab);agents['hangup'](_0x5ea6ab);queues[_0x4a20('0x32')](_0x5ea6ab);}catch(_0x2bc464){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')]('[%s][index][hangup]',_0x5ea6ab[_0x4a20('0x1f')]),_0x2bc464);}});ami['on'](_0x4a20('0x34'),function(_0x500dcf){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x35'),_0x500dcf[_0x4a20('0x1f')]),_0x500dcf);members[_0x4a20('0x34')](_0x500dcf);}catch(_0x57f980){utils[_0x4a20('0x15')](util['format'](_0x4a20('0x35'),_0x500dcf[_0x4a20('0x1f')]),_0x57f980);}});ami['on'](_0x4a20('0x36'),function(_0x4244d1){try{utils[_0x4a20('0x19')](util['format'](_0x4a20('0x37'),_0x4244d1[_0x4a20('0x1f')]),_0x4244d1);queues['blindtransfer'](_0x4244d1);agents[_0x4a20('0x36')](_0x4244d1);transfers[_0x4a20('0x36')](_0x4244d1);recordings[_0x4a20('0x36')](_0x4244d1);}catch(_0x31df9a){utils['error'](util[_0x4a20('0x1a')]('[%s][index][blindtransfer]',_0x4244d1[_0x4a20('0x1f')]),_0x31df9a);}});ami['on'](_0x4a20('0x38'),function(_0x3f1811){try{utils[_0x4a20('0x19')](util['format'](_0x4a20('0x39'),_0x3f1811[_0x4a20('0x3a')]),_0x3f1811);queues[_0x4a20('0x38')](_0x3f1811);transfers[_0x4a20('0x38')](_0x3f1811);agents[_0x4a20('0x38')](_0x3f1811);calls['attendedtransfer'](_0x3f1811);}catch(_0x4c4c42){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x39'),_0x3f1811[_0x4a20('0x3a')]),_0x4c4c42);}});ami['on'](_0x4a20('0x3b'),function(_0x239f83){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x3c'),_0x239f83[_0x4a20('0x1f')]),_0x239f83);queues[_0x4a20('0x3b')](_0x239f83);recordings[_0x4a20('0x3b')](_0x239f83);calls[_0x4a20('0x3b')](_0x239f83);dials[_0x4a20('0x3b')](_0x239f83);}catch(_0x401c7d){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x3c'),_0x239f83[_0x4a20('0x1f')]),_0x401c7d);}});ami['on'](_0x4a20('0x3d'),function(_0x28900a){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x3e'),_0x28900a[_0x4a20('0x1f')]),_0x28900a);calls[_0x4a20('0x3d')](_0x28900a);recordings[_0x4a20('0x3d')](_0x28900a);dials[_0x4a20('0x3d')](_0x28900a);}catch(_0x447e3f){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x3e'),_0x28900a['uniqueid']),_0x447e3f);}});ami['on']('newchannel',function(_0x1edf0d){try{utils['debug'](util['format'](_0x4a20('0x3f'),_0x1edf0d[_0x4a20('0x1f')]),_0x1edf0d);calls[_0x4a20('0x40')](_0x1edf0d);recordings['newchannel'](_0x1edf0d);}catch(_0x2d1424){utils[_0x4a20('0x15')](util['format']('[%s][index][newchannel]',_0x1edf0d[_0x4a20('0x1f')]),_0x2d1424);}});ami['on'](_0x4a20('0x41'),function(_0x2f0931){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')]('[%s][index][dialbegin]',_0x2f0931[_0x4a20('0x1f')]),_0x2f0931);dials[_0x4a20('0x41')](_0x2f0931);}catch(_0x520ead){utils[_0x4a20('0x15')](util[_0x4a20('0x1a')](_0x4a20('0x42'),_0x2f0931[_0x4a20('0x1f')]),_0x520ead);}});ami['on']('dialend',function(_0x2ed0ef){try{utils[_0x4a20('0x19')](util[_0x4a20('0x1a')](_0x4a20('0x43'),_0x2ed0ef[_0x4a20('0x1f')]),_0x2ed0ef);dials[_0x4a20('0x44')](_0x2ed0ef);}catch(_0x216f93){utils[_0x4a20('0x15')](util['format']('[%s][index][dialend]',_0x2ed0ef[_0x4a20('0x1f')]),_0x216f93);}});}
\ No newline at end of file
+var _0x1f20=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','xdr','disabled','production','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1f20,0xdd));var _0x01f2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1f20[_0x40a045];return _0x1a687c;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x01f2('0x0'));var util=require('util');var isXDREnabled=config[_0x01f2('0x1')]&&config[_0x01f2('0x1')]['disabled']?!config[_0x01f2('0x1')][_0x01f2('0x2')]:!![];var isProduction=config['env']===_0x01f2('0x3')||![];var isLocalAsterisk=config[_0x01f2('0x1')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x01f2('0x4')][_0x01f2('0x5')],config[_0x01f2('0x4')]['ip'],config[_0x01f2('0x4')][_0x01f2('0x6')],config[_0x01f2('0x4')][_0x01f2('0x7')],!![]);ami[_0x01f2('0x8')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x01f2('0x9')](_0x01f2('0xa'));}else{var agents=require(_0x01f2('0xb'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x01f2('0xc'));var members=require(_0x01f2('0xd'));var dials=require(_0x01f2('0xe'));var transfers=require(_0x01f2('0xf'));var core=require(_0x01f2('0x10'));ami['on'](_0x01f2('0x11'),core[_0x01f2('0x11')]);ami['on'](_0x01f2('0x12'),core[_0x01f2('0x12')]);ami['on'](_0x01f2('0x13'),core[_0x01f2('0x13')]);ami['on'](_0x01f2('0x14'),core['error']);ami['on'](_0x01f2('0x15'),core[_0x01f2('0x15')]);ami['on'](_0x01f2('0x16'),core['managerevent']);ami['on'](_0x01f2('0x17'),function(_0x168356){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x1a'),_0x168356['device']),_0x168356);members[_0x01f2('0x17')](_0x168356);}catch(_0x58e541){utils[_0x01f2('0x14')](util['format'](_0x01f2('0x1a'),_0x168356[_0x01f2('0x1b')]),_0x58e541);}});ami['on'](_0x01f2('0x1c'),function(_0x5e04f9){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x1d'),_0x5e04f9[_0x01f2('0x1e')]),_0x5e04f9);agents[_0x01f2('0x1c')](_0x5e04f9);}catch(_0x54e1f8){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x1d'),_0x5e04f9['uniqueid']),_0x54e1f8);}});ami['on'](_0x01f2('0x1f'),function(_0x448f0a){try{utils[_0x01f2('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x448f0a[_0x01f2('0x1e')]),_0x448f0a);agents[_0x01f2('0x1f')](_0x448f0a);}catch(_0x32c9d7){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x20'),_0x448f0a[_0x01f2('0x1e')]),_0x32c9d7);}});ami['on']('agentconnect',function(_0x2e497c){try{utils[_0x01f2('0x18')](util['format'](_0x01f2('0x21'),_0x2e497c['uniqueid']),_0x2e497c);agents[_0x01f2('0x22')](_0x2e497c);queues[_0x01f2('0x22')](_0x2e497c);}catch(_0x736b17){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x21'),_0x2e497c[_0x01f2('0x1e')]),_0x736b17);}});ami['on']('agentcomplete',function(_0x355d26){try{utils['debug'](util[_0x01f2('0x19')](_0x01f2('0x23'),_0x355d26[_0x01f2('0x1e')]),_0x355d26);agents[_0x01f2('0x24')](_0x355d26);queues['agentcomplete'](_0x355d26);members[_0x01f2('0x24')](_0x355d26);}catch(_0x3e2bb5){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x23'),_0x355d26[_0x01f2('0x1e')]),_0x3e2bb5);}});ami['on'](_0x01f2('0x25'),function(_0x2f44b4){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x26'),_0x2f44b4[_0x01f2('0x1e')]),_0x2f44b4);agents[_0x01f2('0x25')](_0x2f44b4);queues['queuecallerabandon'](_0x2f44b4);}catch(_0x22bf9e){utils[_0x01f2('0x14')](util['format'](_0x01f2('0x26'),_0x2f44b4[_0x01f2('0x1e')]),_0x22bf9e);}});ami['on'](_0x01f2('0x27'),function(_0x2ae740){try{utils['debug'](util[_0x01f2('0x19')](_0x01f2('0x28'),_0x2ae740[_0x01f2('0x1e')]),_0x2ae740);queues[_0x01f2('0x27')](_0x2ae740);recordings[_0x01f2('0x27')](_0x2ae740);}catch(_0x27e122){utils['error'](util[_0x01f2('0x19')](_0x01f2('0x28'),_0x2ae740[_0x01f2('0x1e')]),_0x27e122);}});ami['on'](_0x01f2('0x29'),function(_0x5dca7d){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x2a'),_0x5dca7d['uniqueid']),_0x5dca7d);queues[_0x01f2('0x29')](_0x5dca7d);}catch(_0x17487a){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x2a'),_0x5dca7d[_0x01f2('0x1e')]),_0x17487a);}});ami['on'](_0x01f2('0x2b'),function(_0x493348){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')]('[%s][index][musiconholdstart]',_0x493348[_0x01f2('0x1e')]),_0x493348);queues['musiconholdstart'](_0x493348);calls[_0x01f2('0x2b')](_0x493348);}catch(_0x18e808){utils[_0x01f2('0x14')](util[_0x01f2('0x19')]('[%s][index][musiconholdstart]',_0x493348[_0x01f2('0x1e')]),_0x18e808);}});ami['on'](_0x01f2('0x2c'),function(_0xcba296){try{utils['debug'](util[_0x01f2('0x19')](_0x01f2('0x2d'),_0xcba296[_0x01f2('0x1e')]),_0xcba296);queues[_0x01f2('0x2c')](_0xcba296);calls[_0x01f2('0x2c')](_0xcba296);}catch(_0x249342){utils[_0x01f2('0x14')](util[_0x01f2('0x19')]('[%s][index][musiconholdstop]',_0xcba296[_0x01f2('0x1e')]),_0x249342);}});ami['on']('newstate',function(_0x3a82e3){try{utils[_0x01f2('0x18')](util['format']('[%s][index][newstate]',_0x3a82e3['uniqueid']),_0x3a82e3);calls['newstate'](_0x3a82e3);recordings[_0x01f2('0x2e')](_0x3a82e3);}catch(_0x4af68d){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x2f'),_0x3a82e3[_0x01f2('0x1e')]),_0x4af68d);}});ami['on'](_0x01f2('0x30'),function(_0x54d164){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x31'),_0x54d164[_0x01f2('0x1e')]),_0x54d164);calls[_0x01f2('0x30')](_0x54d164);recordings[_0x01f2('0x30')](_0x54d164);dials[_0x01f2('0x30')](_0x54d164);agents['hangup'](_0x54d164);queues[_0x01f2('0x30')](_0x54d164);}catch(_0x50a0a0){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x31'),_0x54d164[_0x01f2('0x1e')]),_0x50a0a0);}});ami['on'](_0x01f2('0x32'),function(_0x1435ab){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x33'),_0x1435ab[_0x01f2('0x1e')]),_0x1435ab);members[_0x01f2('0x32')](_0x1435ab);}catch(_0x4c6b4c){utils['error'](util[_0x01f2('0x19')](_0x01f2('0x33'),_0x1435ab[_0x01f2('0x1e')]),_0x4c6b4c);}});ami['on'](_0x01f2('0x34'),function(_0x32aa6e){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x35'),_0x32aa6e['uniqueid']),_0x32aa6e);queues['blindtransfer'](_0x32aa6e);agents[_0x01f2('0x34')](_0x32aa6e);transfers[_0x01f2('0x34')](_0x32aa6e);recordings[_0x01f2('0x34')](_0x32aa6e);}catch(_0x3dca05){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x35'),_0x32aa6e[_0x01f2('0x1e')]),_0x3dca05);}});ami['on'](_0x01f2('0x36'),function(_0x5592d4){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x37'),_0x5592d4[_0x01f2('0x38')]),_0x5592d4);queues[_0x01f2('0x36')](_0x5592d4);transfers[_0x01f2('0x36')](_0x5592d4);agents[_0x01f2('0x36')](_0x5592d4);calls['attendedtransfer'](_0x5592d4);}catch(_0xf0f6ed){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x37'),_0x5592d4[_0x01f2('0x38')]),_0xf0f6ed);}});ami['on'](_0x01f2('0x39'),function(_0x22cbf3){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')]('[%s][index][varset]',_0x22cbf3[_0x01f2('0x1e')]),_0x22cbf3);queues[_0x01f2('0x39')](_0x22cbf3);recordings[_0x01f2('0x39')](_0x22cbf3);calls[_0x01f2('0x39')](_0x22cbf3);dials[_0x01f2('0x39')](_0x22cbf3);}catch(_0x462e1d){utils['error'](util[_0x01f2('0x19')](_0x01f2('0x3a'),_0x22cbf3[_0x01f2('0x1e')]),_0x462e1d);}});ami['on'](_0x01f2('0x3b'),function(_0x15f7f0){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x3c'),_0x15f7f0[_0x01f2('0x1e')]),_0x15f7f0);calls[_0x01f2('0x3b')](_0x15f7f0);recordings[_0x01f2('0x3b')](_0x15f7f0);dials['newexten'](_0x15f7f0);}catch(_0x5cffca){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x3c'),_0x15f7f0[_0x01f2('0x1e')]),_0x5cffca);}});ami['on'](_0x01f2('0x3d'),function(_0x574c2a){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')](_0x01f2('0x3e'),_0x574c2a['uniqueid']),_0x574c2a);calls[_0x01f2('0x3d')](_0x574c2a);recordings['newchannel'](_0x574c2a);}catch(_0x4bbaa9){utils[_0x01f2('0x14')](util['format'](_0x01f2('0x3e'),_0x574c2a[_0x01f2('0x1e')]),_0x4bbaa9);}});ami['on'](_0x01f2('0x3f'),function(_0x3da440){try{utils['debug'](util['format'](_0x01f2('0x40'),_0x3da440[_0x01f2('0x1e')]),_0x3da440);dials['dialbegin'](_0x3da440);}catch(_0x1b476a){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x41'),_0x3da440[_0x01f2('0x1e')]),_0x1b476a);}});ami['on'](_0x01f2('0x42'),function(_0xbf6fbf){try{utils[_0x01f2('0x18')](util[_0x01f2('0x19')]('[%s][index][dialend]',_0xbf6fbf[_0x01f2('0x1e')]),_0xbf6fbf);dials[_0x01f2('0x42')](_0xbf6fbf);}catch(_0xcffb11){utils[_0x01f2('0x14')](util[_0x01f2('0x19')](_0x01f2('0x43'),_0xbf6fbf[_0x01f2('0x1e')]),_0xcffb11);}});}
\ No newline at end of file
index bdc2738..fb4d60b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9f5=['[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data2','destination','data1','data3','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Queue:','info','uniqueid','channel','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','format','[%s][members][writeDB]','some','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','exitAt','duration','diffTime','[%s][members][devicestatechange]','agentcomplete','isNil','debug'];(function(_0x5d0012,_0x2835b5){var _0x1463b9=function(_0x451994){while(--_0x451994){_0x5d0012['push'](_0x5d0012['shift']());}};_0x1463b9(++_0x2835b5);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xc9f5[_0x4bc65f];return _0x44f85f;};'use strict';var _=require('lodash');var util=require(_0x5c9f('0x0'));var utils=require(_0x5c9f('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x5c9f('0x2')];function writeDB(_0x2fb7c4){utils[_0x5c9f('0x3')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2fb7c4[_0x5c9f('0x4')],_0x2fb7c4['interface'],_0x2fb7c4[_0x5c9f('0x5')],_0x2fb7c4['data2'],_0x2fb7c4[_0x5c9f('0x6')],_0x2fb7c4[_0x5c9f('0x7')]));if(_0x2fb7c4[_0x5c9f('0x8')]){utils[_0x5c9f('0x9')](_0x2fb7c4[_0x5c9f('0x8')])[_0x5c9f('0xa')](function(_0x216f5a){if(_0x216f5a){_0x2fb7c4[_0x5c9f('0x6')]=_0x216f5a[_0x5c9f('0xb')];_0x2fb7c4[_0x5c9f('0xc')]=_0x216f5a[_0x5c9f('0xc')];utils[_0x5c9f('0xd')](_0x5c9f('0xe'),_0x2fb7c4);}else{utils[_0x5c9f('0xf')](_0x2fb7c4[_0x5c9f('0x8')][_0x5c9f('0x10')]('/')[0x1])[_0x5c9f('0xa')](function(_0x589e03){if(_0x589e03){_0x2fb7c4[_0x5c9f('0x6')]=_0x589e03[_0x5c9f('0xb')];_0x2fb7c4[_0x5c9f('0xc')]=_0x589e03[_0x5c9f('0xc')];utils[_0x5c9f('0xd')](_0x5c9f('0xe'),_0x2fb7c4);}});}})['catch'](function(_0x29e02b){utils[_0x5c9f('0x11')](util[_0x5c9f('0x12')](_0x5c9f('0x13'),_0x2fb7c4[_0x5c9f('0x4')]),_0x29e02b);});}delete members[_0x2fb7c4[_0x5c9f('0x8')]];}function startsWith(_0x25d813,_0x281b49){return _[_0x5c9f('0x14')](_0x25d813,function(_0x5c4730){return _['startsWith'](_0x281b49,_0x5c4730);});}exports['devicestatechange']=function(_0x48feaf){try{utils['debug'](util['format']('[%s][members][devicestatechange]',members[_0x48feaf[_0x5c9f('0x15')]]?members[_0x48feaf[_0x5c9f('0x15')]]['uniqueid']:_0x48feaf['device']),_0x48feaf);utils[_0x5c9f('0x3')](util[_0x5c9f('0x12')](_0x5c9f('0x16'),members[_0x48feaf[_0x5c9f('0x15')]]?members[_0x48feaf[_0x5c9f('0x15')]][_0x5c9f('0x4')]:_0x48feaf[_0x5c9f('0x15')],_0x48feaf[_0x5c9f('0x17')],_0x48feaf[_0x5c9f('0x15')]));switch(_0x48feaf[_0x5c9f('0x17')]){case'INUSE':case _0x5c9f('0x18'):if(!startsWith(exclude,_0x48feaf[_0x5c9f('0x15')])){members[_0x48feaf[_0x5c9f('0x15')]]={'channel':_0x5c9f('0x19'),'interface':_0x48feaf[_0x5c9f('0x15')],'type':'TALKING','enterAt':utils[_0x5c9f('0x1a')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x48feaf['device']])){members[_0x48feaf[_0x5c9f('0x15')]][_0x5c9f('0x1b')]=utils['now']();members[_0x48feaf[_0x5c9f('0x15')]][_0x5c9f('0x1c')]=utils[_0x5c9f('0x1d')](members[_0x48feaf['device']][_0x5c9f('0x1b')],members[_0x48feaf[_0x5c9f('0x15')]]['enterAt']);if(members[_0x48feaf[_0x5c9f('0x15')]]['uniqueid']){writeDB(members[_0x48feaf[_0x5c9f('0x15')]]);}}break;default:break;}}catch(_0x99b611){utils[_0x5c9f('0x11')](util['format'](_0x5c9f('0x1e'),members[_0x48feaf[_0x5c9f('0x15')]]?members[_0x48feaf[_0x5c9f('0x15')]][_0x5c9f('0x4')]:_0x48feaf['device']),_0x99b611);}};exports[_0x5c9f('0x1f')]=function(_0x1a360a){try{if(!_[_0x5c9f('0x20')](members[_0x1a360a[_0x5c9f('0x8')]])){utils[_0x5c9f('0x21')](util['format'](_0x5c9f('0x22'),_0x1a360a['uniqueid']),_0x1a360a);utils[_0x5c9f('0x3')](util[_0x5c9f('0x12')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x1a360a[_0x5c9f('0x4')],_0x1a360a[_0x5c9f('0x8')],_0x1a360a[_0x5c9f('0x23')]));members[_0x1a360a['interface']]=_[_0x5c9f('0x24')](members[_0x1a360a[_0x5c9f('0x8')]],{'data4':_0x1a360a[_0x5c9f('0x23')],'uniqueid':_0x1a360a[_0x5c9f('0x4')]});}}catch(_0x495cd7){utils['error'](util[_0x5c9f('0x12')]('[%s][members][agentcomplete]',_0x1a360a['uniqueid']),_0x495cd7);}};exports[_0x5c9f('0x25')]=function(_0x50824a){try{utils[_0x5c9f('0x21')](util[_0x5c9f('0x12')](_0x5c9f('0x26'),_0x50824a['uniqueid']),_0x50824a);if(_0x50824a[_0x5c9f('0x5')]){var _0x46f5f0=_0x50824a['channel'][_0x5c9f('0x10')]('-')[0x0];if(!_[_0x5c9f('0x20')](members[_0x46f5f0])){members[_0x46f5f0]=_[_0x5c9f('0x24')](members[_0x46f5f0],{'data1':members[_0x46f5f0]['data1']||_0x50824a[_0x5c9f('0x7')],'data2':members[_0x46f5f0][_0x5c9f('0x27')]||_0x50824a['source'],'data3':members[_0x46f5f0]['data3']||_0x50824a[_0x5c9f('0x28')],'uniqueid':members[_0x46f5f0][_0x5c9f('0x4')]||_0x50824a[_0x5c9f('0x4')]});utils[_0x5c9f('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x50824a[_0x5c9f('0x4')],members[_0x46f5f0][_0x5c9f('0x29')],members[_0x46f5f0][_0x5c9f('0x27')],members[_0x46f5f0][_0x5c9f('0x2a')]));if(members[_0x46f5f0][_0x5c9f('0x1b')]){writeDB(members[_0x46f5f0]);}}}if(_0x50824a['destinationchannel']){var _0xc9c627=_0x50824a[_0x5c9f('0x2b')][_0x5c9f('0x10')]('-')[0x0];if(!_[_0x5c9f('0x20')](members[_0xc9c627])){members[_0xc9c627]=_[_0x5c9f('0x24')](members[_0xc9c627],{'data1':members[_0xc9c627][_0x5c9f('0x29')]||_0x50824a[_0x5c9f('0x7')],'data2':members[_0xc9c627][_0x5c9f('0x27')]||_0x50824a[_0x5c9f('0x2c')],'data3':members[_0xc9c627][_0x5c9f('0x2a')]||_0x50824a[_0x5c9f('0x28')],'uniqueid':members[_0xc9c627]['uniqueid']||_0x50824a[_0x5c9f('0x4')]});utils[_0x5c9f('0x3')](util[_0x5c9f('0x12')](_0x5c9f('0x2d'),_0x50824a[_0x5c9f('0x4')],members[_0xc9c627]['data1'],members[_0xc9c627][_0x5c9f('0x27')],members[_0xc9c627]['data3']));if(members[_0xc9c627][_0x5c9f('0x1b')]){writeDB(members[_0xc9c627]);}}}}catch(_0x1d04a5){utils['error'](util[_0x5c9f('0x12')](_0x5c9f('0x26'),_0x50824a[_0x5c9f('0x4')]),_0x1d04a5);}};
\ No newline at end of file
+var _0x84e6=['channel','membername','then','name','internal','request','split','CreateMemberReport','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data2','type','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','info','uniqueid','interface'];(function(_0x486eff,_0x5cb3b0){var _0x95293b=function(_0x25b947){while(--_0x25b947){_0x486eff['push'](_0x486eff['shift']());}};_0x95293b(++_0x5cb3b0);}(_0x84e6,0x8f));var _0x684e=function(_0x28a48d,_0x201dbf){_0x28a48d=_0x28a48d-0x0;var _0x2a0d4d=_0x84e6[_0x28a48d];return _0x2a0d4d;};'use strict';var _=require(_0x684e('0x0'));var util=require(_0x684e('0x1'));var utils=require(_0x684e('0x2'));var members={};var exclude=[_0x684e('0x3'),'Queue:'];function writeDB(_0x5c0eb3){utils[_0x684e('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5c0eb3[_0x684e('0x5')],_0x5c0eb3[_0x684e('0x6')],_0x5c0eb3[_0x684e('0x7')],_0x5c0eb3['data2'],_0x5c0eb3[_0x684e('0x8')],_0x5c0eb3['type']));if(_0x5c0eb3[_0x684e('0x6')]){utils['getUserByInterface'](_0x5c0eb3['interface'])[_0x684e('0x9')](function(_0xd35552){if(_0xd35552){_0x5c0eb3[_0x684e('0x8')]=_0xd35552[_0x684e('0xa')];_0x5c0eb3[_0x684e('0xb')]=_0xd35552[_0x684e('0xb')];utils[_0x684e('0xc')]('CreateMemberReport',_0x5c0eb3);}else{utils['getUserByName'](_0x5c0eb3[_0x684e('0x6')][_0x684e('0xd')]('/')[0x1])['then'](function(_0x102836){if(_0x102836){_0x5c0eb3[_0x684e('0x8')]=_0x102836['name'];_0x5c0eb3[_0x684e('0xb')]=_0x102836['internal'];utils[_0x684e('0xc')](_0x684e('0xe'),_0x5c0eb3);}});}})[_0x684e('0xf')](function(_0x175ecc){utils[_0x684e('0x10')](util[_0x684e('0x11')](_0x684e('0x12'),_0x5c0eb3[_0x684e('0x5')]),_0x175ecc);});}delete members[_0x5c0eb3[_0x684e('0x6')]];}function startsWith(_0x25f095,_0x255926){return _[_0x684e('0x13')](_0x25f095,function(_0x2a8e90){return _[_0x684e('0x14')](_0x255926,_0x2a8e90);});}exports[_0x684e('0x15')]=function(_0x8fa67b){try{utils[_0x684e('0x16')](util[_0x684e('0x11')]('[%s][members][devicestatechange]',members[_0x8fa67b['device']]?members[_0x8fa67b[_0x684e('0x17')]][_0x684e('0x5')]:_0x8fa67b['device']),_0x8fa67b);utils[_0x684e('0x4')](util[_0x684e('0x11')](_0x684e('0x18'),members[_0x8fa67b[_0x684e('0x17')]]?members[_0x8fa67b['device']][_0x684e('0x5')]:_0x8fa67b['device'],_0x8fa67b[_0x684e('0x19')],_0x8fa67b[_0x684e('0x17')]));switch(_0x8fa67b[_0x684e('0x19')]){case _0x684e('0x1a'):case _0x684e('0x1b'):if(!startsWith(exclude,_0x8fa67b['device'])){members[_0x8fa67b[_0x684e('0x17')]]={'channel':_0x684e('0x1c'),'interface':_0x8fa67b['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0x684e('0x1d')};}break;case _0x684e('0x1e'):if(!_[_0x684e('0x1f')](members[_0x8fa67b[_0x684e('0x17')]])){members[_0x8fa67b['device']][_0x684e('0x20')]=utils[_0x684e('0x21')]();members[_0x8fa67b[_0x684e('0x17')]]['duration']=utils[_0x684e('0x22')](members[_0x8fa67b['device']][_0x684e('0x20')],members[_0x8fa67b[_0x684e('0x17')]][_0x684e('0x23')]);if(members[_0x8fa67b[_0x684e('0x17')]][_0x684e('0x5')]){writeDB(members[_0x8fa67b[_0x684e('0x17')]]);}}break;default:break;}}catch(_0x50ee80){utils[_0x684e('0x10')](util['format'](_0x684e('0x24'),members[_0x8fa67b[_0x684e('0x17')]]?members[_0x8fa67b[_0x684e('0x17')]][_0x684e('0x5')]:_0x8fa67b[_0x684e('0x17')]),_0x50ee80);}};exports[_0x684e('0x25')]=function(_0x2406fd){try{if(!_[_0x684e('0x1f')](members[_0x2406fd['interface']])){utils[_0x684e('0x16')](util[_0x684e('0x11')](_0x684e('0x26'),_0x2406fd[_0x684e('0x5')]),_0x2406fd);utils[_0x684e('0x4')](util[_0x684e('0x11')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2406fd['uniqueid'],_0x2406fd['interface'],_0x2406fd[_0x684e('0x27')]));members[_0x2406fd['interface']]=_[_0x684e('0x28')](members[_0x2406fd[_0x684e('0x6')]],{'data4':_0x2406fd[_0x684e('0x27')],'uniqueid':_0x2406fd['uniqueid']});}}catch(_0x486be9){utils[_0x684e('0x10')](util['format'](_0x684e('0x26'),_0x2406fd['uniqueid']),_0x486be9);}};exports[_0x684e('0x29')]=function(_0x285c0a){try{utils[_0x684e('0x16')](util[_0x684e('0x11')]('[%s][members][cdr]',_0x285c0a[_0x684e('0x5')]),_0x285c0a);if(_0x285c0a[_0x684e('0x7')]){var _0x228fb0=_0x285c0a[_0x684e('0x7')][_0x684e('0xd')]('-')[0x0];if(!_['isNil'](members[_0x228fb0])){members[_0x228fb0]=_[_0x684e('0x28')](members[_0x228fb0],{'data1':members[_0x228fb0]['data1']||_0x285c0a['type'],'data2':members[_0x228fb0]['data2']||_0x285c0a[_0x684e('0x2a')],'data3':members[_0x228fb0][_0x684e('0x2b')]||_0x285c0a[_0x684e('0x2c')],'uniqueid':members[_0x228fb0][_0x684e('0x5')]||_0x285c0a[_0x684e('0x5')]});utils[_0x684e('0x4')](util[_0x684e('0x11')](_0x684e('0x2d'),_0x285c0a[_0x684e('0x5')],members[_0x228fb0][_0x684e('0x2e')],members[_0x228fb0][_0x684e('0x2f')],members[_0x228fb0][_0x684e('0x2b')]));if(members[_0x228fb0]['exitAt']){writeDB(members[_0x228fb0]);}}}if(_0x285c0a['destinationchannel']){var _0x3e8819=_0x285c0a['destinationchannel'][_0x684e('0xd')]('-')[0x0];if(!_[_0x684e('0x1f')](members[_0x3e8819])){members[_0x3e8819]=_[_0x684e('0x28')](members[_0x3e8819],{'data1':members[_0x3e8819][_0x684e('0x2e')]||_0x285c0a[_0x684e('0x30')],'data2':members[_0x3e8819][_0x684e('0x2f')]||_0x285c0a['source'],'data3':members[_0x3e8819]['data3']||_0x285c0a[_0x684e('0x2c')],'uniqueid':members[_0x3e8819][_0x684e('0x5')]||_0x285c0a[_0x684e('0x5')]});utils[_0x684e('0x4')](util[_0x684e('0x11')](_0x684e('0x2d'),_0x285c0a[_0x684e('0x5')],members[_0x3e8819][_0x684e('0x2e')],members[_0x3e8819][_0x684e('0x2f')],members[_0x3e8819][_0x684e('0x2b')]));if(members[_0x3e8819]['exitAt']){writeDB(members[_0x3e8819]);}}}}catch(_0x3e3d4e){utils['error'](util[_0x684e('0x11')](_0x684e('0x31'),_0x285c0a[_0x684e('0x5')]),_0x3e3d4e);}};
\ No newline at end of file
index 328ccf1..2e38065 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x539f=['EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','[%s][queues][agentcomplete]','membername','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','secondtransfererexten','ATTENDED','transferexten','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queueposition','queuecallerabandonAt','queuecallerexitAt'];(function(_0x3acb1f,_0x3952ab){var _0x24a289=function(_0x34512c){while(--_0x34512c){_0x3acb1f['push'](_0x3acb1f['shift']());}};_0x24a289(++_0x3952ab);}(_0x539f,0xa3));var _0xf539=function(_0x2374ed,_0x37016c){_0x2374ed=_0x2374ed-0x0;var _0x19b126=_0x539f[_0x2374ed];return _0x19b126;};'use strict';var _=require(_0xf539('0x0'));var util=require('util');var utils=require(_0xf539('0x1'));var queues={};function writeDB(_0x256f90){utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x4'),_0x256f90[_0xf539('0x5')],_0x256f90['channel'],_0x256f90[_0xf539('0x6')],_0x256f90[_0xf539('0x7')],_0x256f90['calleridnum'],_0x256f90[_0xf539('0x8')],_0x256f90[_0xf539('0x9')]));if(_0x256f90[_0xf539('0x6')]){utils[_0xf539('0xa')](_0x256f90[_0xf539('0x6')])[_0xf539('0xb')](function(_0x278f56){if(_0x278f56){_0x256f90[_0xf539('0xc')]=_0x278f56[_0xf539('0xc')];}utils['request']('CreateVoiceQueueReport',_0x256f90);});}else{utils[_0xf539('0xd')](_0xf539('0xe'),_0x256f90);}if(_0x256f90[_0xf539('0xf')]){delete queues[_0x256f90['transfereduniqueid']];}else{delete queues[_0x256f90[_0xf539('0x5')]];}}exports['queuecallerjoin']=function(_0x433784){try{utils[_0xf539('0x10')](util[_0xf539('0x3')](_0xf539('0x11'),_0x433784[_0xf539('0x5')]),_0x433784);utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x12'),_0x433784[_0xf539('0x5')],_0x433784['queue'],_0x433784[_0xf539('0x13')]));queues[_0x433784['uniqueid']]=_[_0xf539('0x14')](_0x433784,{'originalposition':_0x433784[_0xf539('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x81734d){utils[_0xf539('0x15')](util[_0xf539('0x3')](_0xf539('0x11'),_0x433784[_0xf539('0x5')]),_0x81734d);}};exports[_0xf539('0x16')]=function(_0x3deb9b){try{if(!_[_0xf539('0x17')](queues[_0x3deb9b['uniqueid']])){utils[_0xf539('0x10')](util['format'](_0xf539('0x18'),_0x3deb9b[_0xf539('0x5')]),_0x3deb9b);if(queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x19')]){if(!queues[_0x3deb9b['uniqueid']][_0xf539('0x1a')]&&!queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x1b')]){queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x1c')]=!![];queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x1d')]=utils[_0xf539('0x1e')]();queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x9')]='COMPLETEDBYAGENT';}utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x1f'),_0x3deb9b[_0xf539('0x5')],queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x20')],queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x9')]));writeDB(queues[_0x3deb9b[_0xf539('0x5')]]);}else if(queues[_0x3deb9b[_0xf539('0x5')]]['transfereduniqueid']){utils[_0xf539('0x2')](util['format'](_0xf539('0x21'),_0x3deb9b[_0xf539('0x5')],queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0x20')],queues[_0x3deb9b[_0xf539('0x5')]][_0xf539('0xf')]));queues[queues[_0x3deb9b[_0xf539('0x5')]]['transfereduniqueid']]=queues[_0x3deb9b[_0xf539('0x5')]];queues[queues[_0x3deb9b[_0xf539('0x5')]]['transfereduniqueid']][_0xf539('0x22')]=0x2;delete queues[_0x3deb9b['uniqueid']];}}}catch(_0x1709fb){utils[_0xf539('0x15')](util[_0xf539('0x3')]('[%s][queues][hangup]',_0x3deb9b[_0xf539('0x5')]),_0x1709fb);}};exports[_0xf539('0x23')]=function(_0x49bf97){try{utils['debug'](util['format'](_0xf539('0x24'),_0x49bf97[_0xf539('0x5')]),_0x49bf97);if(!_['isNil'](_0x49bf97[_0xf539('0x25')][_0xf539('0x26')])&&_0x49bf97[_0xf539('0x27')][_0xf539('0x28')]()!==_0xf539('0x29')){if(!_['isNil'](queues[_0x49bf97[_0xf539('0x5')]])){queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x1a')]=![];queues[_0x49bf97[_0xf539('0x5')]]['queuecallerabandonAt']=null;queues[_0x49bf97['uniqueid']][_0xf539('0x1b')]=!![];queues[_0x49bf97[_0xf539('0x5')]]['queuecallerexitAt']=utils[_0xf539('0x1e')]();queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x9')]=_0x49bf97[_0xf539('0x27')][_0xf539('0x28')]();utils[_0xf539('0x2')](util[_0xf539('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x49bf97[_0xf539('0x5')],queues[_0x49bf97['uniqueid']][_0xf539('0x20')],_0x49bf97[_0xf539('0x27')],queues[_0x49bf97['uniqueid']][_0xf539('0x9')]));writeDB(queues[_0x49bf97['uniqueid']]);}}else if(!_[_0xf539('0x17')](_0x49bf97[_0xf539('0x25')][_0xf539('0x2a')])){if(!_[_0xf539('0x17')](queues[_0x49bf97[_0xf539('0x5')]])&&!queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x1a')]){queues[_0x49bf97['uniqueid']][_0xf539('0x1a')]=![];queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x2b')]=null;queues[_0x49bf97['uniqueid']][_0xf539('0x1b')]=!![];queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x2c')]=utils['now']();queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x9')]=_0xf539('0x2d');utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x2e'),_0x49bf97['uniqueid'],queues[_0x49bf97[_0xf539('0x5')]][_0xf539('0x20')],_0x49bf97[_0xf539('0x27')],queues[_0x49bf97['uniqueid']][_0xf539('0x9')]));}}}catch(_0x545fde){utils[_0xf539('0x15')](util[_0xf539('0x3')](_0xf539('0x24'),_0x49bf97[_0xf539('0x5')]),_0x545fde);}};exports['queuecallerabandon']=function(_0x9cb13b){try{if(!_['isNil'](queues[_0x9cb13b['uniqueid']])){utils[_0xf539('0x10')](util[_0xf539('0x3')](_0xf539('0x2f'),_0x9cb13b[_0xf539('0x5')]),_0x9cb13b);queues[_0x9cb13b[_0xf539('0x5')]]['queuecallerexit']=![];queues[_0x9cb13b[_0xf539('0x5')]]['queuecallerexitAt']=null;queues[_0x9cb13b[_0xf539('0x5')]][_0xf539('0x1a')]=!![];queues[_0x9cb13b['uniqueid']]['queuecallerabandonAt']=utils[_0xf539('0x1e')]();queues[_0x9cb13b['uniqueid']][_0xf539('0x9')]=_0xf539('0x30');utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x31'),_0x9cb13b[_0xf539('0x5')],queues[_0x9cb13b[_0xf539('0x5')]]['name'],queues[_0x9cb13b[_0xf539('0x5')]]['queuecallerexitreason']));}}catch(_0x58c429){utils['error'](util[_0xf539('0x3')](_0xf539('0x2f'),_0x9cb13b[_0xf539('0x5')]),_0x58c429);}};exports[_0xf539('0x32')]=function(_0xaf02aa){try{if(!_[_0xf539('0x17')](queues[_0xaf02aa[_0xf539('0x5')]])){utils[_0xf539('0x10')](util[_0xf539('0x3')](_0xf539('0x33'),_0xaf02aa[_0xf539('0x5')]),_0xaf02aa);utils['info'](util[_0xf539('0x3')](_0xf539('0x34'),_0xaf02aa[_0xf539('0x5')],queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x20')],_0xaf02aa[_0xf539('0x35')],_0xaf02aa[_0xf539('0x36')]));queues[_0xaf02aa['uniqueid']]['queuecallerleave']=!![];queues[_0xaf02aa['uniqueid']][_0xf539('0x19')]=utils[_0xf539('0x1e')]();queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x37')]=utils[_0xf539('0x38')](queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x19')],queues[_0xaf02aa['uniqueid']][_0xf539('0x39')]);queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x13')]=_0xaf02aa[_0xf539('0x13')];queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x3a')]=_0xaf02aa[_0xf539('0x3a')];queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x35')]=_0xaf02aa[_0xf539('0x35')];queues[_0xaf02aa[_0xf539('0x5')]][_0xf539('0x36')]=_0xaf02aa[_0xf539('0x36')];}}catch(_0xcde7ea){utils[_0xf539('0x15')](util[_0xf539('0x3')](_0xf539('0x33'),_0xaf02aa[_0xf539('0x5')]),_0xcde7ea);}};exports[_0xf539('0x3b')]=function(_0x1a3266){try{if(!_[_0xf539('0x17')](queues[_0x1a3266[_0xf539('0x5')]])){utils[_0xf539('0x10')](util[_0xf539('0x3')](_0xf539('0x3c'),_0x1a3266[_0xf539('0x5')]),_0x1a3266);utils[_0xf539('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1a3266[_0xf539('0x5')],queues[_0x1a3266[_0xf539('0x5')]]['name'],_0x1a3266['membername'],_0x1a3266[_0xf539('0x3d')]));queues[_0x1a3266[_0xf539('0x5')]][_0xf539('0x1a')]=![];queues[_0x1a3266['uniqueid']][_0xf539('0x1a')]=![];queues[_0x1a3266[_0xf539('0x5')]][_0xf539('0x2b')]=null;queues[_0x1a3266['uniqueid']][_0xf539('0x1b')]=![];queues[_0x1a3266['uniqueid']][_0xf539('0x9')]=null;queues[_0x1a3266['uniqueid']]['queuecallerexitAt']=null;queues[_0x1a3266[_0xf539('0x5')]][_0xf539('0x3e')]=!![];queues[_0x1a3266[_0xf539('0x5')]][_0xf539('0x8')]=_0x1a3266[_0xf539('0x3d')];queues[_0x1a3266[_0xf539('0x5')]][_0xf539('0x7')]=_0x1a3266['membername'];}}catch(_0x13002e){utils[_0xf539('0x15')](util[_0xf539('0x3')](_0xf539('0x3c'),_0x1a3266['uniqueid']),_0x13002e);}};exports['agentcomplete']=function(_0x9e7c02){try{if(!_[_0xf539('0x17')](queues[_0x9e7c02['uniqueid']])){if(queues[_0x9e7c02[_0xf539('0x5')]][_0xf539('0x19')]){utils[_0xf539('0x10')](util[_0xf539('0x3')](_0xf539('0x3f'),_0x9e7c02['uniqueid']),_0x9e7c02);queues[_0x9e7c02[_0xf539('0x5')]]['queuecallerabandon']=![];queues[_0x9e7c02[_0xf539('0x5')]]['queuecallerabandon']=![];queues[_0x9e7c02[_0xf539('0x5')]]['queuecallerabandonAt']=null;queues[_0x9e7c02[_0xf539('0x5')]]['queuecallerexit']=![];queues[_0x9e7c02[_0xf539('0x5')]][_0xf539('0x2c')]=null;queues[_0x9e7c02[_0xf539('0x5')]]['assigned']=!![];queues[_0x9e7c02['uniqueid']][_0xf539('0x7')]=_0x9e7c02[_0xf539('0x40')];queues[_0x9e7c02[_0xf539('0x5')]][_0xf539('0x1c')]=!![];queues[_0x9e7c02[_0xf539('0x5')]][_0xf539('0x1d')]=utils[_0xf539('0x1e')]();if(_0x9e7c02[_0xf539('0x41')]==_0xf539('0x42')){if(!queues[_0x9e7c02['uniqueid']][_0xf539('0x42')]){queues[_0x9e7c02['uniqueid']][_0xf539('0x9')]=_0xf539('0x43');}}else{queues[_0x9e7c02['uniqueid']][_0xf539('0x9')]=_0xf539('0x44')+_0x9e7c02[_0xf539('0x41')][_0xf539('0x28')]();}utils[_0xf539('0x2')](util['format'](_0xf539('0x45'),_0x9e7c02[_0xf539('0x5')],queues[_0x9e7c02[_0xf539('0x5')]][_0xf539('0x20')],_0x9e7c02['membername'],queues[_0x9e7c02[_0xf539('0x5')]][_0xf539('0x9')]));writeDB(queues[_0x9e7c02[_0xf539('0x5')]]);}}}catch(_0x473784){utils[_0xf539('0x15')](util[_0xf539('0x3')](_0xf539('0x3f'),_0x9e7c02[_0xf539('0x5')]),_0x473784);}};exports[_0xf539('0x46')]=function(_0x5063ae){try{if(!_['isNil'](queues[_0x5063ae[_0xf539('0x47')]])){utils[_0xf539('0x10')](util['format'](_0xf539('0x48'),_0x5063ae['uniqueid']),_0x5063ae);queues[_0x5063ae['transfereeuniqueid']]['transfer']=!![];queues[_0x5063ae[_0xf539('0x47')]][_0xf539('0x49')]=_0xf539('0x4a');queues[_0x5063ae[_0xf539('0x47')]]['transferexten']=_0x5063ae['extension'];queues[_0x5063ae[_0xf539('0x47')]][_0xf539('0x4b')]=_0x5063ae['transfereeuniqueid'];queues[_0x5063ae[_0xf539('0x47')]][_0xf539('0x9')]='BLINDTRANSFER';utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x4c'),_0x5063ae[_0xf539('0x5')],queues[_0x5063ae['transfereeuniqueid']]['name'],_0x5063ae[_0xf539('0x47')],_0x5063ae[_0xf539('0x4d')]));}}catch(_0x9753a1){utils[_0xf539('0x15')](util[_0xf539('0x3')]('[%s][queues][blindtransfer]',_0x5063ae[_0xf539('0x5')]),_0x9753a1);}};exports[_0xf539('0x4e')]=function(_0x25b4e5){try{utils['debug'](util['format'](_0xf539('0x4f'),_0x25b4e5[_0xf539('0x50')]),_0x25b4e5);if(_0x25b4e5['origtransfereruniqueid']==_0x25b4e5[_0xf539('0x51')]){if(!_[_0xf539('0x17')](queues[_0x25b4e5['secondtransfererlinkedid']])){utils[_0xf539('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x25b4e5[_0xf539('0x50')],queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0x20')],_0x25b4e5['origtransfererexten']));queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0x42')]=!![];queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0x49')]='ATTENDED';queues[_0x25b4e5[_0xf539('0x52')]]['transferexten']=_0x25b4e5[_0xf539('0x53')];queues[_0x25b4e5['secondtransfererlinkedid']][_0xf539('0x4b')]=_0x25b4e5['origtransfereruniqueid'];queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0x9')]=_0xf539('0x54');}if(!_['isNil'](queues[_0x25b4e5[_0xf539('0x51')]])){if(_0x25b4e5[_0xf539('0x55')]&&queues[_0x25b4e5[_0xf539('0x55')]]){queues[_0x25b4e5[_0xf539('0x55')]][_0xf539('0x22')]=0x1;queues[_0x25b4e5[_0xf539('0x47')]]=_[_0xf539('0x56')](queues[_0x25b4e5['transfereelinkedid']]);queues[_0x25b4e5[_0xf539('0x47')]][_0xf539('0xf')]=_0x25b4e5[_0xf539('0x57')];queues[_0x25b4e5['transfereeuniqueid']][_0xf539('0x22')]=0x2;queues[_0x25b4e5[_0xf539('0x47')]][_0xf539('0x58')]=queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0x58')];queues[_0x25b4e5[_0xf539('0x47')]][_0xf539('0x59')]=queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0x59')];queues[_0x25b4e5['transfereeuniqueid']][_0xf539('0x39')]=utils['now']();queues[_0x25b4e5['transfereeuniqueid']][_0xf539('0x19')]=utils[_0xf539('0x1e')]();queues[_0x25b4e5['transfereeuniqueid']][_0xf539('0x37')]=0x0;queues[_0x25b4e5['transfereeuniqueid']][_0xf539('0x5a')]=0x0;utils['info'](util[_0xf539('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x25b4e5['origtransfereruniqueid'],queues[_0x25b4e5[_0xf539('0x47')]][_0xf539('0x20')],queues[_0x25b4e5[_0xf539('0x47')]][_0xf539('0x58')],queues[_0x25b4e5['transfereeuniqueid']][_0xf539('0x59')]));}else{utils[_0xf539('0x2')](util[_0xf539('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x25b4e5[_0xf539('0x50')],queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x20')],_0x25b4e5[_0xf539('0x52')]));queues[_0x25b4e5[_0xf539('0x51')]]['transfereduniqueid']=_0x25b4e5['secondtransfererlinkedid'];}}}else if(_0x25b4e5['secondtransfereruniqueid']==_0x25b4e5[_0xf539('0x52')]){if(!_[_0xf539('0x17')](queues[_0x25b4e5['origtransfererlinkedid']])){utils[_0xf539('0x2')](util[_0xf539('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x25b4e5['origtransfereruniqueid'],queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x20')],_0x25b4e5['secondtransfereruniqueid'],_0x25b4e5[_0xf539('0x5b')]));queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x42')]=!![];queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x49')]=_0xf539('0x5c');queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x5d')]=_0x25b4e5['secondtransfererexten'];queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x4b')]=_0x25b4e5[_0xf539('0x5e')];queues[_0x25b4e5[_0xf539('0x51')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xf539('0x17')](queues[_0x25b4e5['secondtransfererlinkedid']])){if(_0x25b4e5['transfertargetlinkedid']&&queues[_0x25b4e5[_0xf539('0x5f')]]){queues[_0x25b4e5[_0xf539('0x5f')]][_0xf539('0x22')]=0x1;queues[_0x25b4e5[_0xf539('0x57')]]=_[_0xf539('0x56')](queues[_0x25b4e5['transfertargetlinkedid']]);queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0xf')]=_0x25b4e5[_0xf539('0x57')];queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x22')]=0x2;queues[_0x25b4e5['transfertargetuniqueid']][_0xf539('0x58')]=queues[_0x25b4e5['origtransfererlinkedid']][_0xf539('0x58')];queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x59')]=queues[_0x25b4e5[_0xf539('0x51')]][_0xf539('0x59')];queues[_0x25b4e5[_0xf539('0x57')]]['queuecallerjoinAt']=utils[_0xf539('0x1e')]();queues[_0x25b4e5['transfertargetuniqueid']][_0xf539('0x19')]=utils[_0xf539('0x1e')]();queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x37')]=0x0;queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x5a')]=0x0;utils['info'](util[_0xf539('0x3')](_0xf539('0x60'),_0x25b4e5['origtransfereruniqueid'],queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x20')],queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0xf')],queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x58')],queues[_0x25b4e5[_0xf539('0x57')]][_0xf539('0x59')]));}else{utils[_0xf539('0x2')](util['format'](_0xf539('0x61'),_0x25b4e5[_0xf539('0x50')],queues[_0x25b4e5['secondtransfererlinkedid']][_0xf539('0x20')],_0x25b4e5[_0xf539('0x51')]));queues[_0x25b4e5[_0xf539('0x52')]][_0xf539('0xf')]=_0x25b4e5[_0xf539('0x51')];}}}}catch(_0x52ff1f){utils[_0xf539('0x15')](util[_0xf539('0x3')](_0xf539('0x4f'),_0x25b4e5[_0xf539('0x50')]),_0x52ff1f);}};exports['musiconholdstart']=function(_0x59b320){try{if(!_['isNil'](queues[_0x59b320[_0xf539('0x5')]])){utils[_0xf539('0x10')](util['format'](_0xf539('0x62'),_0x59b320[_0xf539('0x5')]),_0x59b320);queues[_0x59b320[_0xf539('0x5')]][_0xf539('0x63')]=utils[_0xf539('0x1e')]();utils[_0xf539('0x2')](util[_0xf539('0x3')](_0xf539('0x64'),_0x59b320[_0xf539('0x5')],queues[_0x59b320[_0xf539('0x5')]][_0xf539('0x20')],queues[_0x59b320[_0xf539('0x5')]][_0xf539('0x63')]));}}catch(_0x258630){utils[_0xf539('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x59b320[_0xf539('0x5')]),_0x258630);}};exports[_0xf539('0x65')]=function(_0x29e7a0){try{if(!_[_0xf539('0x17')](queues[_0x29e7a0['uniqueid']])){if(!_['isNil'](queues[_0x29e7a0[_0xf539('0x5')]][_0xf539('0x63')])){utils[_0xf539('0x10')](util[_0xf539('0x3')](_0xf539('0x66'),_0x29e7a0['uniqueid']),_0x29e7a0);queues[_0x29e7a0[_0xf539('0x5')]][_0xf539('0x5a')]+=utils[_0xf539('0x38')](utils[_0xf539('0x1e')](),queues[_0x29e7a0['uniqueid']][_0xf539('0x63')]);utils['info'](util[_0xf539('0x3')](_0xf539('0x67'),_0x29e7a0[_0xf539('0x5')],queues[_0x29e7a0[_0xf539('0x5')]][_0xf539('0x20')],queues[_0x29e7a0['uniqueid']][_0xf539('0x5a')]));delete queues[_0x29e7a0[_0xf539('0x5')]][_0xf539('0x63')];}}}catch(_0x1c92fa){utils['error'](util[_0xf539('0x3')](_0xf539('0x66'),_0x29e7a0[_0xf539('0x5')]),_0x1c92fa);}};
\ No newline at end of file
+var _0xaa30=['assigned','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','origtransfererlinkedid','transfereelinkedid','clone','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','diffTime','lodash','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','value','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','queuecallerjoinAt','count','connectedlinename','error','agentconnect','[%s][queues][agentconnect]','destaccountcode'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xaa30,0x96));var _0x0aa3=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xaa30[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0aa3('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0xb6030f){utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x3'),_0xb6030f['uniqueid'],_0xb6030f[_0x0aa3('0x4')],_0xb6030f[_0x0aa3('0x5')],_0xb6030f[_0x0aa3('0x6')],_0xb6030f[_0x0aa3('0x7')],_0xb6030f[_0x0aa3('0x8')],_0xb6030f[_0x0aa3('0x9')]));if(_0xb6030f[_0x0aa3('0x5')]){utils[_0x0aa3('0xa')](_0xb6030f[_0x0aa3('0x5')])[_0x0aa3('0xb')](function(_0x5c506d){if(_0x5c506d){_0xb6030f['type']=_0x5c506d[_0x0aa3('0xc')];}utils[_0x0aa3('0xd')](_0x0aa3('0xe'),_0xb6030f);});}else{utils[_0x0aa3('0xd')]('CreateVoiceQueueReport',_0xb6030f);}if(_0xb6030f['transfereduniqueid']){delete queues[_0xb6030f['transfereduniqueid']];}else{delete queues[_0xb6030f[_0x0aa3('0xf')]];}}exports[_0x0aa3('0x10')]=function(_0xe0464e){try{utils[_0x0aa3('0x11')](util['format'](_0x0aa3('0x12'),_0xe0464e['uniqueid']),_0xe0464e);utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x13'),_0xe0464e[_0x0aa3('0xf')],_0xe0464e[_0x0aa3('0x5')],_0xe0464e['position']));queues[_0xe0464e[_0x0aa3('0xf')]]=_[_0x0aa3('0x14')](_0xe0464e,{'originalposition':_0xe0464e[_0x0aa3('0x15')],'queuecallerjoinAt':utils[_0x0aa3('0x16')](),'mohtime':0x0});}catch(_0x155210){utils['error'](util[_0x0aa3('0x2')](_0x0aa3('0x12'),_0xe0464e[_0x0aa3('0xf')]),_0x155210);}};exports[_0x0aa3('0x17')]=function(_0x4153cb){try{if(!_['isNil'](queues[_0x4153cb['uniqueid']])){utils[_0x0aa3('0x11')](util[_0x0aa3('0x2')](_0x0aa3('0x18'),_0x4153cb[_0x0aa3('0xf')]),_0x4153cb);if(queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x19')]){if(!queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x1a')]&&!queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x1b')]){queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x1c')]=!![];queues[_0x4153cb['uniqueid']][_0x0aa3('0x1d')]=utils[_0x0aa3('0x16')]();queues[_0x4153cb['uniqueid']][_0x0aa3('0x9')]='COMPLETEDBYAGENT';}utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x1e'),_0x4153cb[_0x0aa3('0xf')],queues[_0x4153cb[_0x0aa3('0xf')]]['name'],queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x9')]));writeDB(queues[_0x4153cb[_0x0aa3('0xf')]]);}else if(queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x1f')]){utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x20'),_0x4153cb[_0x0aa3('0xf')],queues[_0x4153cb['uniqueid']][_0x0aa3('0x21')],queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x1f')]));queues[queues[_0x4153cb[_0x0aa3('0xf')]][_0x0aa3('0x1f')]]=queues[_0x4153cb['uniqueid']];queues[queues[_0x4153cb['uniqueid']][_0x0aa3('0x1f')]][_0x0aa3('0x22')]=0x2;delete queues[_0x4153cb['uniqueid']];}}}catch(_0x55dda5){utils['error'](util['format']('[%s][queues][hangup]',_0x4153cb[_0x0aa3('0xf')]),_0x55dda5);}};exports[_0x0aa3('0x23')]=function(_0x15e4cd){try{utils[_0x0aa3('0x11')](util[_0x0aa3('0x2')](_0x0aa3('0x24'),_0x15e4cd[_0x0aa3('0xf')]),_0x15e4cd);if(!_[_0x0aa3('0x25')](_0x15e4cd[_0x0aa3('0x26')][_0x0aa3('0x27')])&&_0x15e4cd['value'][_0x0aa3('0x28')]()!==_0x0aa3('0x29')){if(!_[_0x0aa3('0x25')](queues[_0x15e4cd[_0x0aa3('0xf')]])){queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x1a')]=![];queues[_0x15e4cd['uniqueid']]['queuecallerabandonAt']=null;queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x1b')]=!![];queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x2a')]=utils[_0x0aa3('0x16')]();queues[_0x15e4cd['uniqueid']][_0x0aa3('0x9')]=_0x15e4cd[_0x0aa3('0x2b')][_0x0aa3('0x28')]();utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x15e4cd[_0x0aa3('0xf')],queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x21')],_0x15e4cd[_0x0aa3('0x2b')],queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x9')]));writeDB(queues[_0x15e4cd[_0x0aa3('0xf')]]);}}else if(!_['isNil'](_0x15e4cd[_0x0aa3('0x26')][_0x0aa3('0x2c')])){if(!_[_0x0aa3('0x25')](queues[_0x15e4cd[_0x0aa3('0xf')]])&&!queues[_0x15e4cd['uniqueid']][_0x0aa3('0x1a')]){queues[_0x15e4cd[_0x0aa3('0xf')]]['queuecallerabandon']=![];queues[_0x15e4cd[_0x0aa3('0xf')]]['queuecallerabandonAt']=null;queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x1b')]=!![];queues[_0x15e4cd[_0x0aa3('0xf')]]['queuecallerexitAt']=utils[_0x0aa3('0x16')]();queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x9')]='EXITWITHKEY';utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x2d'),_0x15e4cd[_0x0aa3('0xf')],queues[_0x15e4cd[_0x0aa3('0xf')]][_0x0aa3('0x21')],_0x15e4cd['value'],queues[_0x15e4cd[_0x0aa3('0xf')]]['queuecallerexitreason']));}}}catch(_0x3f2e55){utils['error'](util[_0x0aa3('0x2')]('[%s][queues][varset]',_0x15e4cd[_0x0aa3('0xf')]),_0x3f2e55);}};exports[_0x0aa3('0x1a')]=function(_0x3dd35a){try{if(!_['isNil'](queues[_0x3dd35a['uniqueid']])){utils[_0x0aa3('0x11')](util[_0x0aa3('0x2')](_0x0aa3('0x2e'),_0x3dd35a['uniqueid']),_0x3dd35a);queues[_0x3dd35a[_0x0aa3('0xf')]][_0x0aa3('0x1b')]=![];queues[_0x3dd35a[_0x0aa3('0xf')]][_0x0aa3('0x2a')]=null;queues[_0x3dd35a[_0x0aa3('0xf')]][_0x0aa3('0x1a')]=!![];queues[_0x3dd35a[_0x0aa3('0xf')]][_0x0aa3('0x2f')]=utils['now']();queues[_0x3dd35a[_0x0aa3('0xf')]][_0x0aa3('0x9')]=_0x0aa3('0x30');utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x31'),_0x3dd35a['uniqueid'],queues[_0x3dd35a[_0x0aa3('0xf')]][_0x0aa3('0x21')],queues[_0x3dd35a[_0x0aa3('0xf')]]['queuecallerexitreason']));}}catch(_0xf551ef){utils['error'](util[_0x0aa3('0x2')](_0x0aa3('0x2e'),_0x3dd35a['uniqueid']),_0xf551ef);}};exports[_0x0aa3('0x32')]=function(_0x1f8edf){try{if(!_[_0x0aa3('0x25')](queues[_0x1f8edf[_0x0aa3('0xf')]])){utils[_0x0aa3('0x11')](util['format'](_0x0aa3('0x33'),_0x1f8edf['uniqueid']),_0x1f8edf);utils['info'](util[_0x0aa3('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1f8edf[_0x0aa3('0xf')],queues[_0x1f8edf[_0x0aa3('0xf')]][_0x0aa3('0x21')],_0x1f8edf[_0x0aa3('0x34')],_0x1f8edf['connectedlinename']));queues[_0x1f8edf[_0x0aa3('0xf')]][_0x0aa3('0x32')]=!![];queues[_0x1f8edf['uniqueid']][_0x0aa3('0x19')]=utils[_0x0aa3('0x16')]();queues[_0x1f8edf[_0x0aa3('0xf')]]['holdtime']=utils['diffTime'](queues[_0x1f8edf['uniqueid']][_0x0aa3('0x19')],queues[_0x1f8edf[_0x0aa3('0xf')]][_0x0aa3('0x35')]);queues[_0x1f8edf['uniqueid']][_0x0aa3('0x15')]=_0x1f8edf[_0x0aa3('0x15')];queues[_0x1f8edf[_0x0aa3('0xf')]]['count']=_0x1f8edf[_0x0aa3('0x36')];queues[_0x1f8edf[_0x0aa3('0xf')]][_0x0aa3('0x34')]=_0x1f8edf[_0x0aa3('0x34')];queues[_0x1f8edf[_0x0aa3('0xf')]][_0x0aa3('0x37')]=_0x1f8edf[_0x0aa3('0x37')];}}catch(_0x8830ab){utils[_0x0aa3('0x38')](util[_0x0aa3('0x2')](_0x0aa3('0x33'),_0x1f8edf['uniqueid']),_0x8830ab);}};exports[_0x0aa3('0x39')]=function(_0x31064e){try{if(!_[_0x0aa3('0x25')](queues[_0x31064e[_0x0aa3('0xf')]])){utils['debug'](util[_0x0aa3('0x2')](_0x0aa3('0x3a'),_0x31064e[_0x0aa3('0xf')]),_0x31064e);utils['info'](util[_0x0aa3('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x31064e[_0x0aa3('0xf')],queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x21')],_0x31064e['membername'],_0x31064e[_0x0aa3('0x3b')]));queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x1a')]=![];queues[_0x31064e['uniqueid']]['queuecallerabandon']=![];queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x2f')]=null;queues[_0x31064e['uniqueid']][_0x0aa3('0x1b')]=![];queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x9')]=null;queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x2a')]=null;queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x3c')]=!![];queues[_0x31064e[_0x0aa3('0xf')]][_0x0aa3('0x8')]=_0x31064e[_0x0aa3('0x3b')];queues[_0x31064e[_0x0aa3('0xf')]]['lastAssignedTo']=_0x31064e[_0x0aa3('0x3d')];}}catch(_0x33742d){utils[_0x0aa3('0x38')](util[_0x0aa3('0x2')]('[%s][queues][agentconnect]',_0x31064e[_0x0aa3('0xf')]),_0x33742d);}};exports[_0x0aa3('0x3e')]=function(_0x3da0af){try{if(!_[_0x0aa3('0x25')](queues[_0x3da0af[_0x0aa3('0xf')]])){if(queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x19')]){utils[_0x0aa3('0x11')](util[_0x0aa3('0x2')](_0x0aa3('0x3f'),_0x3da0af[_0x0aa3('0xf')]),_0x3da0af);queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x1a')]=![];queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x1a')]=![];queues[_0x3da0af['uniqueid']][_0x0aa3('0x2f')]=null;queues[_0x3da0af['uniqueid']][_0x0aa3('0x1b')]=![];queues[_0x3da0af['uniqueid']]['queuecallerexitAt']=null;queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x3c')]=!![];queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x6')]=_0x3da0af[_0x0aa3('0x3d')];queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x1c')]=!![];queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x1d')]=utils[_0x0aa3('0x16')]();if(_0x3da0af[_0x0aa3('0x40')]==_0x0aa3('0x41')){if(!queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x41')]){queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x9')]=_0x0aa3('0x42');}}else{queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x9')]=_0x0aa3('0x43')+_0x3da0af[_0x0aa3('0x40')][_0x0aa3('0x28')]();}utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x44'),_0x3da0af['uniqueid'],queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x21')],_0x3da0af[_0x0aa3('0x3d')],queues[_0x3da0af[_0x0aa3('0xf')]][_0x0aa3('0x9')]));writeDB(queues[_0x3da0af[_0x0aa3('0xf')]]);}}}catch(_0xf31884){utils[_0x0aa3('0x38')](util[_0x0aa3('0x2')](_0x0aa3('0x3f'),_0x3da0af[_0x0aa3('0xf')]),_0xf31884);}};exports['blindtransfer']=function(_0x54ba6b){try{if(!_['isNil'](queues[_0x54ba6b[_0x0aa3('0x45')]])){utils[_0x0aa3('0x11')](util['format']('[%s][queues][blindtransfer]',_0x54ba6b[_0x0aa3('0xf')]),_0x54ba6b);queues[_0x54ba6b[_0x0aa3('0x45')]][_0x0aa3('0x41')]=!![];queues[_0x54ba6b['transfereeuniqueid']]['transfertype']=_0x0aa3('0x46');queues[_0x54ba6b['transfereeuniqueid']][_0x0aa3('0x47')]=_0x54ba6b[_0x0aa3('0x48')];queues[_0x54ba6b['transfereeuniqueid']][_0x0aa3('0x49')]=_0x54ba6b['transfereeuniqueid'];queues[_0x54ba6b['transfereeuniqueid']][_0x0aa3('0x9')]=_0x0aa3('0x4a');utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x4b'),_0x54ba6b[_0x0aa3('0xf')],queues[_0x54ba6b['transfereeuniqueid']][_0x0aa3('0x21')],_0x54ba6b['transfereeuniqueid'],_0x54ba6b[_0x0aa3('0x48')]));}}catch(_0x585c1e){utils['error'](util[_0x0aa3('0x2')](_0x0aa3('0x4c'),_0x54ba6b[_0x0aa3('0xf')]),_0x585c1e);}};exports[_0x0aa3('0x4d')]=function(_0x126c5b){try{utils['debug'](util[_0x0aa3('0x2')]('[%s][queues][attendedtransfer]',_0x126c5b[_0x0aa3('0x4e')]),_0x126c5b);if(_0x126c5b[_0x0aa3('0x4e')]==_0x126c5b['origtransfererlinkedid']){if(!_[_0x0aa3('0x25')](queues[_0x126c5b[_0x0aa3('0x4f')]])){utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x50'),_0x126c5b[_0x0aa3('0x4e')],queues[_0x126c5b['secondtransfererlinkedid']][_0x0aa3('0x21')],_0x126c5b[_0x0aa3('0x51')]));queues[_0x126c5b['secondtransfererlinkedid']][_0x0aa3('0x41')]=!![];queues[_0x126c5b['secondtransfererlinkedid']][_0x0aa3('0x52')]=_0x0aa3('0x53');queues[_0x126c5b[_0x0aa3('0x4f')]][_0x0aa3('0x47')]=_0x126c5b[_0x0aa3('0x51')];queues[_0x126c5b[_0x0aa3('0x4f')]]['transferuniqueid']=_0x126c5b[_0x0aa3('0x4e')];queues[_0x126c5b[_0x0aa3('0x4f')]][_0x0aa3('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x0aa3('0x25')](queues[_0x126c5b[_0x0aa3('0x54')]])){if(_0x126c5b[_0x0aa3('0x55')]&&queues[_0x126c5b[_0x0aa3('0x55')]]){queues[_0x126c5b[_0x0aa3('0x55')]][_0x0aa3('0x22')]=0x1;queues[_0x126c5b['transfereeuniqueid']]=_[_0x0aa3('0x56')](queues[_0x126c5b[_0x0aa3('0x55')]]);queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x1f')]=_0x126c5b['transfertargetuniqueid'];queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x22')]=0x2;queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x7')]=queues[_0x126c5b[_0x0aa3('0x4f')]][_0x0aa3('0x7')];queues[_0x126c5b[_0x0aa3('0x45')]]['calleridname']=queues[_0x126c5b['secondtransfererlinkedid']][_0x0aa3('0x57')];queues[_0x126c5b['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x0aa3('0x16')]();queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x19')]=utils[_0x0aa3('0x16')]();queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x58')]=0x0;queues[_0x126c5b[_0x0aa3('0x45')]]['mohtime']=0x0;utils[_0x0aa3('0x1')](util['format'](_0x0aa3('0x59'),_0x126c5b[_0x0aa3('0x4e')],queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x21')],queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x7')],queues[_0x126c5b[_0x0aa3('0x45')]][_0x0aa3('0x57')]));}else{utils[_0x0aa3('0x1')](util['format'](_0x0aa3('0x5a'),_0x126c5b[_0x0aa3('0x4e')],queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x21')],_0x126c5b[_0x0aa3('0x4f')]));queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x1f')]=_0x126c5b[_0x0aa3('0x4f')];}}}else if(_0x126c5b['secondtransfereruniqueid']==_0x126c5b[_0x0aa3('0x4f')]){if(!_['isNil'](queues[_0x126c5b[_0x0aa3('0x54')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x126c5b[_0x0aa3('0x4e')],queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x21')],_0x126c5b[_0x0aa3('0x5b')],_0x126c5b[_0x0aa3('0x5c')]));queues[_0x126c5b['origtransfererlinkedid']][_0x0aa3('0x41')]=!![];queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x52')]='ATTENDED';queues[_0x126c5b[_0x0aa3('0x54')]]['transferexten']=_0x126c5b[_0x0aa3('0x5c')];queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x49')]=_0x126c5b['secondtransfereruniqueid'];queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x9')]=_0x0aa3('0x5d');}if(!_[_0x0aa3('0x25')](queues[_0x126c5b[_0x0aa3('0x4f')]])){if(_0x126c5b[_0x0aa3('0x5e')]&&queues[_0x126c5b[_0x0aa3('0x5e')]]){queues[_0x126c5b[_0x0aa3('0x5e')]][_0x0aa3('0x22')]=0x1;queues[_0x126c5b[_0x0aa3('0x5f')]]=_[_0x0aa3('0x56')](queues[_0x126c5b[_0x0aa3('0x5e')]]);queues[_0x126c5b[_0x0aa3('0x5f')]][_0x0aa3('0x1f')]=_0x126c5b[_0x0aa3('0x5f')];queues[_0x126c5b['transfertargetuniqueid']][_0x0aa3('0x22')]=0x2;queues[_0x126c5b['transfertargetuniqueid']][_0x0aa3('0x7')]=queues[_0x126c5b[_0x0aa3('0x54')]]['calleridnum'];queues[_0x126c5b['transfertargetuniqueid']][_0x0aa3('0x57')]=queues[_0x126c5b[_0x0aa3('0x54')]][_0x0aa3('0x57')];queues[_0x126c5b[_0x0aa3('0x5f')]][_0x0aa3('0x35')]=utils[_0x0aa3('0x16')]();queues[_0x126c5b['transfertargetuniqueid']][_0x0aa3('0x19')]=utils[_0x0aa3('0x16')]();queues[_0x126c5b[_0x0aa3('0x5f')]][_0x0aa3('0x58')]=0x0;queues[_0x126c5b[_0x0aa3('0x5f')]]['mohtime']=0x0;utils[_0x0aa3('0x1')](util['format'](_0x0aa3('0x60'),_0x126c5b['origtransfereruniqueid'],queues[_0x126c5b[_0x0aa3('0x5f')]][_0x0aa3('0x21')],queues[_0x126c5b['transfertargetuniqueid']][_0x0aa3('0x1f')],queues[_0x126c5b[_0x0aa3('0x5f')]]['calleridnum'],queues[_0x126c5b[_0x0aa3('0x5f')]][_0x0aa3('0x57')]));}else{utils['info'](util[_0x0aa3('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x126c5b['origtransfereruniqueid'],queues[_0x126c5b[_0x0aa3('0x4f')]]['name'],_0x126c5b[_0x0aa3('0x54')]));queues[_0x126c5b[_0x0aa3('0x4f')]][_0x0aa3('0x1f')]=_0x126c5b['origtransfererlinkedid'];}}}}catch(_0x3c206c){utils[_0x0aa3('0x38')](util[_0x0aa3('0x2')](_0x0aa3('0x61'),_0x126c5b[_0x0aa3('0x4e')]),_0x3c206c);}};exports['musiconholdstart']=function(_0x43502a){try{if(!_[_0x0aa3('0x25')](queues[_0x43502a[_0x0aa3('0xf')]])){utils[_0x0aa3('0x11')](util[_0x0aa3('0x2')](_0x0aa3('0x62'),_0x43502a[_0x0aa3('0xf')]),_0x43502a);queues[_0x43502a[_0x0aa3('0xf')]][_0x0aa3('0x63')]=utils[_0x0aa3('0x16')]();utils[_0x0aa3('0x1')](util[_0x0aa3('0x2')](_0x0aa3('0x64'),_0x43502a[_0x0aa3('0xf')],queues[_0x43502a['uniqueid']][_0x0aa3('0x21')],queues[_0x43502a[_0x0aa3('0xf')]][_0x0aa3('0x63')]));}}catch(_0x23a553){utils[_0x0aa3('0x38')](util['format'](_0x0aa3('0x62'),_0x43502a[_0x0aa3('0xf')]),_0x23a553);}};exports[_0x0aa3('0x65')]=function(_0x46c3c4){try{if(!_[_0x0aa3('0x25')](queues[_0x46c3c4['uniqueid']])){if(!_[_0x0aa3('0x25')](queues[_0x46c3c4[_0x0aa3('0xf')]][_0x0aa3('0x63')])){utils[_0x0aa3('0x11')](util['format'](_0x0aa3('0x66'),_0x46c3c4[_0x0aa3('0xf')]),_0x46c3c4);queues[_0x46c3c4[_0x0aa3('0xf')]][_0x0aa3('0x67')]+=utils[_0x0aa3('0x68')](utils[_0x0aa3('0x16')](),queues[_0x46c3c4[_0x0aa3('0xf')]][_0x0aa3('0x63')]);utils[_0x0aa3('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x46c3c4['uniqueid'],queues[_0x46c3c4['uniqueid']][_0x0aa3('0x21')],queues[_0x46c3c4[_0x0aa3('0xf')]]['mohtime']));delete queues[_0x46c3c4[_0x0aa3('0xf')]][_0x0aa3('0x63')];}}}catch(_0x8e657){utils[_0x0aa3('0x38')](util['format'](_0x0aa3('0x66'),_0x46c3c4[_0x0aa3('0xf')]),_0x8e657);}};
\ No newline at end of file
index c3f95b4..a506706 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcee2=['variable','[%s][recordings][varset]','value','endsWith','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcee2,0x18b));var _0x2cee=function(_0x1f4e0e,_0x1f0300){_0x1f4e0e=_0x1f4e0e-0x0;var _0x13b2f0=_0xcee2[_0x1f4e0e];return _0x13b2f0;};'use strict';var _=require(_0x2cee('0x0'));var util=require(_0x2cee('0x1'));var utils=require(_0x2cee('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x5ab6c3){var _0x495553;utils[_0x2cee('0x3')](util[_0x2cee('0x4')](_0x2cee('0x5'),_0x5ab6c3[_0x2cee('0x6')]));if(transfers[_0x2cee('0x7')][_0x5ab6c3[_0x2cee('0x6')]]){_0x495553=_0x5ab6c3[_0x2cee('0x6')];_0x5ab6c3[_0x2cee('0x6')]=transfers[_0x2cee('0x7')][_0x5ab6c3[_0x2cee('0x6')]][_0x2cee('0x8')];}if(_0x5ab6c3[_0x2cee('0x9')]){utils['getUserByInternal'](_0x5ab6c3[_0x2cee('0x9')])[_0x2cee('0xa')](function(_0x448d1c){if(_0x448d1c){_0x5ab6c3[_0x2cee('0xb')]=_0x448d1c[_0x2cee('0xc')];_0x5ab6c3[_0x2cee('0xd')]=_0x448d1c['id'];}utils[_0x2cee('0xe')](_0x2cee('0xf'),_0x5ab6c3);});}else{utils[_0x2cee('0xe')](_0x2cee('0xf'),_0x5ab6c3);}if(_0x495553)delete transfers[_0x2cee('0x7')][_0x495553];}exports['newchannel']=function(_0x12a30c){try{utils[_0x2cee('0x10')](util['format'](_0x2cee('0x11'),_0x12a30c[_0x2cee('0x6')]),_0x12a30c);if(_0x12a30c[_0x2cee('0x6')]==_0x12a30c[_0x2cee('0x12')]){utils[_0x2cee('0x3')](util[_0x2cee('0x4')](_0x2cee('0x13'),_0x12a30c['uniqueid'],_0x12a30c['context'],_0x12a30c[_0x2cee('0x14')]));recordings[_0x12a30c['uniqueid']]={'uniqueid':_0x12a30c['uniqueid'],'accountcode':_0x12a30c[_0x2cee('0x9')],'exten':_0x12a30c[_0x2cee('0x14')],'context':_0x12a30c[_0x2cee('0x15')],'channel':_0x12a30c['channel'],'monitors':[]};}}catch(_0x45a2d9){utils[_0x2cee('0x16')](util['format']('[%s][recordings][newchannel]',_0x12a30c['uniqueid']),_0x45a2d9);}};exports['newstate']=function(_0x56f6d3){try{utils[_0x2cee('0x10')](util[_0x2cee('0x4')](_0x2cee('0x17'),_0x56f6d3['uniqueid']),_0x56f6d3);if(!_[_0x2cee('0x18')](recordings[_0x56f6d3[_0x2cee('0x6')]])&&_0x56f6d3[_0x2cee('0x19')]==0x6){utils[_0x2cee('0x3')](util[_0x2cee('0x4')](_0x2cee('0x1a'),_0x56f6d3['uniqueid'],_0x56f6d3[_0x2cee('0x15')],_0x56f6d3[_0x2cee('0x1b')]));}else if(!_[_0x2cee('0x18')](recordings[_0x56f6d3[_0x2cee('0x12')]])&&_0x56f6d3[_0x2cee('0x19')]==0x6&&_0x56f6d3[_0x2cee('0x15')]!=_0x2cee('0x1c')){utils[_0x2cee('0x3')](util[_0x2cee('0x4')](_0x2cee('0x1d'),_0x56f6d3[_0x2cee('0x6')],_0x56f6d3['linkedid'],_0x56f6d3[_0x2cee('0x15')],_0x56f6d3[_0x2cee('0x1b')]));recordings[_0x56f6d3[_0x2cee('0x12')]][_0x2cee('0x9')]=_0x56f6d3['accountcode'];}}catch(_0x1dbb90){utils['error'](util['format']('[%s][recordings][newstate]',_0x56f6d3[_0x2cee('0x6')]),_0x1dbb90);}};exports[_0x2cee('0x1e')]=function(_0x2a5b9c){try{if(!_[_0x2cee('0x18')](_0x2a5b9c[_0x2cee('0x1f')])&&!_['isNil'](_0x2a5b9c[_0x2cee('0x1f')]['mixmonitor_filename'])){utils[_0x2cee('0x10')](util['format'](_0x2cee('0x20'),_0x2a5b9c['uniqueid']),_0x2a5b9c);utils[_0x2cee('0x3')](util[_0x2cee('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2a5b9c[_0x2cee('0x6')],_0x2a5b9c[_0x2cee('0x1f')],_0x2a5b9c[_0x2cee('0x21')]));if(_[_0x2cee('0x22')](_0x2a5b9c[_0x2cee('0x21')],_0x2cee('0x23'))){_0x2a5b9c['value']=_0x2a5b9c[_0x2cee('0x21')]['replace'](_0x2cee('0x23'),'.WAV');}if(recordings[_0x2a5b9c['linkedid']]){var _0x226034=_[_0x2cee('0x24')](recordings[_0x2a5b9c[_0x2cee('0x12')]]['monitors'],{'value':_0x2a5b9c['value']});if(_[_0x2cee('0x18')](_0x226034)){recordings[_0x2a5b9c[_0x2cee('0x12')]][_0x2cee('0x25')][_0x2cee('0x26')]({'value':_0x2a5b9c['value']});}}}}catch(_0x4da8d4){utils['error'](util[_0x2cee('0x4')](_0x2cee('0x20'),_0x2a5b9c[_0x2cee('0x6')]),_0x4da8d4);}};exports[_0x2cee('0x27')]=function(_0x252e55){try{if(!_[_0x2cee('0x18')](recordings[_0x252e55['uniqueid']])){utils[_0x2cee('0x10')](util[_0x2cee('0x4')](_0x2cee('0x28'),_0x252e55[_0x2cee('0x6')]),_0x252e55);utils['info'](util[_0x2cee('0x4')](_0x2cee('0x29'),_0x252e55['uniqueid'],_0x252e55['calleridnum'],_0x252e55[_0x2cee('0x2a')],_0x252e55['cause-txt']));recordings[_0x252e55[_0x2cee('0x6')]][_0x2cee('0x2b')]=_0x252e55[_0x2cee('0x2b')];recordings[_0x252e55['uniqueid']][_0x2cee('0x2a')]=_0x252e55[_0x2cee('0x2a')];recordings[_0x252e55['uniqueid']][_0x2cee('0x2c')]=_0x252e55['connectedlinenum'];recordings[_0x252e55[_0x2cee('0x6')]]['connectedlinename']=_0x252e55[_0x2cee('0x2d')];if(recordings[_0x252e55[_0x2cee('0x6')]][_0x2cee('0x2e')]==_0x2cee('0x2f')&&recordings[_0x252e55['uniqueid']][_0x2cee('0x9')]){recordings[_0x252e55[_0x2cee('0x6')]][_0x2cee('0x2c')]=recordings[_0x252e55[_0x2cee('0x6')]][_0x2cee('0x9')];recordings[_0x252e55[_0x2cee('0x6')]]['connectedlinename']='';}recordings[_0x252e55[_0x2cee('0x6')]][_0x2cee('0x25')][_0x2cee('0x30')](function(_0x3a0b38){var _0x336787=_[_0x2cee('0x31')](recordings[_0x252e55[_0x2cee('0x6')]]);_0x336787[_0x2cee('0x21')]=_0x3a0b38[_0x2cee('0x21')];writeDB(_0x336787);});delete recordings[_0x252e55[_0x2cee('0x6')]];}}catch(_0x1a160e){utils[_0x2cee('0x16')](util[_0x2cee('0x4')](_0x2cee('0x28'),_0x252e55[_0x2cee('0x6')]),_0x1a160e);}};exports[_0x2cee('0x32')]=function(_0x57ed47){try{if(!_[_0x2cee('0x18')](recordings[_0x57ed47[_0x2cee('0x6')]])){utils[_0x2cee('0x10')](util[_0x2cee('0x4')](_0x2cee('0x33'),_0x57ed47[_0x2cee('0x6')]),_0x57ed47);utils['info'](util[_0x2cee('0x4')](_0x2cee('0x34'),_0x57ed47[_0x2cee('0x6')],_0x57ed47[_0x2cee('0x35')],_0x57ed47[_0x2cee('0x36')]));if(_0x57ed47['application']['toLowerCase']()==_0x2cee('0x37')&&_['startsWith'](_0x57ed47[_0x2cee('0x36')][_0x2cee('0x38')](),'cdr')){var _0x386093=_0x57ed47['appdata'][_0x2cee('0x39')]('=');var _0x572659=_0x386093[0x0][_0x2cee('0x3a')](_0x386093[0x0][_0x2cee('0x3b')]('(')+0x1,_0x386093[0x0][_0x2cee('0x3b')](')'));var _0x3d82e2=_0x386093[0x1];recordings[_0x57ed47['uniqueid']][_0x572659]=_0x3d82e2;}}}catch(_0x207930){utils[_0x2cee('0x16')](util[_0x2cee('0x4')](_0x2cee('0x33'),_0x57ed47[_0x2cee('0x6')]),_0x207930);}};exports[_0x2cee('0x3c')]=function(_0x3797f7){try{if(!_[_0x2cee('0x18')](recordings[_0x3797f7[_0x2cee('0x6')]])){utils['debug'](util[_0x2cee('0x4')](_0x2cee('0x3d'),_0x3797f7[_0x2cee('0x6')]),_0x3797f7);utils[_0x2cee('0x3')](util[_0x2cee('0x4')](_0x2cee('0x3e'),_0x3797f7[_0x2cee('0x6')],_0x3797f7[_0x2cee('0x3f')]));recordings[_0x3797f7[_0x2cee('0x6')]][_0x2cee('0x3f')]=_0x3797f7[_0x2cee('0x3f')];}}catch(_0x9cccae){utils[_0x2cee('0x16')](util['format']('[%s][recordings][queuecallerjoin]',_0x3797f7[_0x2cee('0x6')]),_0x9cccae);}};exports['blindtransfer']=function(_0x405939){try{utils['debug'](util[_0x2cee('0x4')](_0x2cee('0x40'),_0x405939[_0x2cee('0x6')]),_0x405939);utils[_0x2cee('0x3')](util[_0x2cee('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x405939[_0x2cee('0x6')],_0x405939[_0x2cee('0x41')],_0x405939[_0x2cee('0x42')],_0x405939[_0x2cee('0x43')],_0x405939[_0x2cee('0x44')]));if(recordings[_0x405939['transfereruniqueid']]&&transfers['blinds'][_0x405939[_0x2cee('0x45')]]){transfers[_0x2cee('0x7')][_0x405939[_0x2cee('0x45')]][_0x2cee('0x46')]=!![];}}catch(_0x5046bc){utils[_0x2cee('0x16')](util[_0x2cee('0x4')](_0x2cee('0x40'),_0x405939[_0x2cee('0x6')]),_0x5046bc);}};
\ No newline at end of file
+var _0x2e57=['[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate'];(function(_0x44b656,_0x23cdae){var _0x30fdd9=function(_0x58ebb2){while(--_0x58ebb2){_0x44b656['push'](_0x44b656['shift']());}};_0x30fdd9(++_0x23cdae);}(_0x2e57,0x75));var _0x72e5=function(_0x57da2e,_0x2a33a8){_0x57da2e=_0x57da2e-0x0;var _0x47ac5a=_0x2e57[_0x57da2e];return _0x47ac5a;};'use strict';var _=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var utils=require(_0x72e5('0x2'));var transfers=require(_0x72e5('0x3'));var recordings={};function writeDB(_0x1c823c){var _0x335b3f;utils[_0x72e5('0x4')](util[_0x72e5('0x5')]('[%s][recordings][writeDB]',_0x1c823c[_0x72e5('0x6')]));if(transfers[_0x72e5('0x7')][_0x1c823c[_0x72e5('0x6')]]){_0x335b3f=_0x1c823c[_0x72e5('0x6')];_0x1c823c[_0x72e5('0x6')]=transfers[_0x72e5('0x7')][_0x1c823c[_0x72e5('0x6')]][_0x72e5('0x8')];}if(_0x1c823c['accountcode']){utils['getUserByInternal'](_0x1c823c[_0x72e5('0x9')])[_0x72e5('0xa')](function(_0xd7236c){if(_0xd7236c){_0x1c823c[_0x72e5('0xb')]=_0xd7236c[_0x72e5('0xc')];_0x1c823c[_0x72e5('0xd')]=_0xd7236c['id'];}utils['request'](_0x72e5('0xe'),_0x1c823c);});}else{utils['request'](_0x72e5('0xe'),_0x1c823c);}if(_0x335b3f)delete transfers[_0x72e5('0x7')][_0x335b3f];}exports['newchannel']=function(_0x4b9ad2){try{utils[_0x72e5('0xf')](util[_0x72e5('0x5')](_0x72e5('0x10'),_0x4b9ad2['uniqueid']),_0x4b9ad2);if(_0x4b9ad2['uniqueid']==_0x4b9ad2[_0x72e5('0x11')]){utils[_0x72e5('0x4')](util['format'](_0x72e5('0x12'),_0x4b9ad2[_0x72e5('0x6')],_0x4b9ad2[_0x72e5('0x13')],_0x4b9ad2['exten']));recordings[_0x4b9ad2[_0x72e5('0x6')]]={'uniqueid':_0x4b9ad2[_0x72e5('0x6')],'accountcode':_0x4b9ad2[_0x72e5('0x9')],'exten':_0x4b9ad2[_0x72e5('0x14')],'context':_0x4b9ad2[_0x72e5('0x13')],'channel':_0x4b9ad2[_0x72e5('0x15')],'monitors':[]};}}catch(_0x130c61){utils[_0x72e5('0x16')](util[_0x72e5('0x5')]('[%s][recordings][newchannel]',_0x4b9ad2[_0x72e5('0x6')]),_0x130c61);}};exports[_0x72e5('0x17')]=function(_0x365af9){try{utils[_0x72e5('0xf')](util[_0x72e5('0x5')](_0x72e5('0x18'),_0x365af9[_0x72e5('0x6')]),_0x365af9);if(!_[_0x72e5('0x19')](recordings[_0x365af9[_0x72e5('0x6')]])&&_0x365af9['channelstate']==0x6){utils[_0x72e5('0x4')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x365af9[_0x72e5('0x6')],_0x365af9[_0x72e5('0x13')],_0x365af9[_0x72e5('0x15')]));}else if(!_[_0x72e5('0x19')](recordings[_0x365af9['linkedid']])&&_0x365af9[_0x72e5('0x1a')]==0x6&&_0x365af9[_0x72e5('0x13')]!='transfer'){utils[_0x72e5('0x4')](util[_0x72e5('0x5')](_0x72e5('0x1b'),_0x365af9[_0x72e5('0x6')],_0x365af9[_0x72e5('0x11')],_0x365af9[_0x72e5('0x13')],_0x365af9[_0x72e5('0x15')]));recordings[_0x365af9[_0x72e5('0x11')]][_0x72e5('0x9')]=_0x365af9['accountcode'];}}catch(_0x49f344){utils['error'](util[_0x72e5('0x5')](_0x72e5('0x18'),_0x365af9[_0x72e5('0x6')]),_0x49f344);}};exports['varset']=function(_0x904b25){try{if(!_[_0x72e5('0x19')](_0x904b25[_0x72e5('0x1c')])&&!_['isNil'](_0x904b25[_0x72e5('0x1c')][_0x72e5('0x1d')])){utils['debug'](util[_0x72e5('0x5')](_0x72e5('0x1e'),_0x904b25[_0x72e5('0x6')]),_0x904b25);utils[_0x72e5('0x4')](util['format'](_0x72e5('0x1f'),_0x904b25[_0x72e5('0x6')],_0x904b25[_0x72e5('0x1c')],_0x904b25[_0x72e5('0x20')]));if(_[_0x72e5('0x21')](_0x904b25[_0x72e5('0x20')],'.wav49')){_0x904b25[_0x72e5('0x20')]=_0x904b25[_0x72e5('0x20')][_0x72e5('0x22')](_0x72e5('0x23'),_0x72e5('0x24'));}if(recordings[_0x904b25[_0x72e5('0x11')]]){var _0x44992e=_[_0x72e5('0x25')](recordings[_0x904b25[_0x72e5('0x11')]][_0x72e5('0x26')],{'value':_0x904b25['value']});if(_[_0x72e5('0x19')](_0x44992e)){recordings[_0x904b25[_0x72e5('0x11')]][_0x72e5('0x26')]['push']({'value':_0x904b25['value']});}}}}catch(_0x42615c){utils[_0x72e5('0x16')](util[_0x72e5('0x5')](_0x72e5('0x1e'),_0x904b25[_0x72e5('0x6')]),_0x42615c);}};exports[_0x72e5('0x27')]=function(_0x329f12){try{if(!_['isNil'](recordings[_0x329f12[_0x72e5('0x6')]])){utils[_0x72e5('0xf')](util[_0x72e5('0x5')]('[%s][recordings][hangup]',_0x329f12[_0x72e5('0x6')]),_0x329f12);utils['info'](util[_0x72e5('0x5')](_0x72e5('0x28'),_0x329f12[_0x72e5('0x6')],_0x329f12[_0x72e5('0x29')],_0x329f12[_0x72e5('0x2a')],_0x329f12[_0x72e5('0x2b')]));recordings[_0x329f12[_0x72e5('0x6')]][_0x72e5('0x29')]=_0x329f12[_0x72e5('0x29')];recordings[_0x329f12[_0x72e5('0x6')]]['calleridname']=_0x329f12[_0x72e5('0x2a')];recordings[_0x329f12[_0x72e5('0x6')]][_0x72e5('0x2c')]=_0x329f12[_0x72e5('0x2c')];recordings[_0x329f12[_0x72e5('0x6')]][_0x72e5('0x2d')]=_0x329f12[_0x72e5('0x2d')];if(recordings[_0x329f12[_0x72e5('0x6')]][_0x72e5('0x2e')]==_0x72e5('0x2f')&&recordings[_0x329f12[_0x72e5('0x6')]][_0x72e5('0x9')]){recordings[_0x329f12[_0x72e5('0x6')]]['connectedlinenum']=recordings[_0x329f12[_0x72e5('0x6')]][_0x72e5('0x9')];recordings[_0x329f12[_0x72e5('0x6')]]['connectedlinename']='';}recordings[_0x329f12['uniqueid']][_0x72e5('0x26')]['forEach'](function(_0x205c88){var _0x2e705f=_[_0x72e5('0x30')](recordings[_0x329f12[_0x72e5('0x6')]]);_0x2e705f[_0x72e5('0x20')]=_0x205c88[_0x72e5('0x20')];writeDB(_0x2e705f);});delete recordings[_0x329f12[_0x72e5('0x6')]];}}catch(_0x5f0d18){utils[_0x72e5('0x16')](util[_0x72e5('0x5')](_0x72e5('0x31'),_0x329f12[_0x72e5('0x6')]),_0x5f0d18);}};exports[_0x72e5('0x32')]=function(_0x148086){try{if(!_[_0x72e5('0x19')](recordings[_0x148086[_0x72e5('0x6')]])){utils[_0x72e5('0xf')](util['format']('[%s][recordings][newexten]',_0x148086[_0x72e5('0x6')]),_0x148086);utils['info'](util[_0x72e5('0x5')](_0x72e5('0x33'),_0x148086[_0x72e5('0x6')],_0x148086[_0x72e5('0x34')],_0x148086[_0x72e5('0x35')]));if(_0x148086[_0x72e5('0x34')][_0x72e5('0x36')]()==_0x72e5('0x37')&&_[_0x72e5('0x38')](_0x148086[_0x72e5('0x35')][_0x72e5('0x36')](),'cdr')){var _0x5cccea=_0x148086[_0x72e5('0x35')][_0x72e5('0x39')]('=');var _0x23fdb3=_0x5cccea[0x0]['substring'](_0x5cccea[0x0][_0x72e5('0x3a')]('(')+0x1,_0x5cccea[0x0][_0x72e5('0x3a')](')'));var _0x2df188=_0x5cccea[0x1];recordings[_0x148086[_0x72e5('0x6')]][_0x23fdb3]=_0x2df188;}}}catch(_0x5ed9cb){utils[_0x72e5('0x16')](util['format'](_0x72e5('0x3b'),_0x148086[_0x72e5('0x6')]),_0x5ed9cb);}};exports[_0x72e5('0x3c')]=function(_0x3dc8c3){try{if(!_[_0x72e5('0x19')](recordings[_0x3dc8c3[_0x72e5('0x6')]])){utils[_0x72e5('0xf')](util[_0x72e5('0x5')]('[%s][recordings][queuecallerjoin]',_0x3dc8c3['uniqueid']),_0x3dc8c3);utils[_0x72e5('0x4')](util[_0x72e5('0x5')](_0x72e5('0x3d'),_0x3dc8c3['uniqueid'],_0x3dc8c3[_0x72e5('0x3e')]));recordings[_0x3dc8c3[_0x72e5('0x6')]][_0x72e5('0x3e')]=_0x3dc8c3['queue'];}}catch(_0x2be291){utils['error'](util[_0x72e5('0x5')](_0x72e5('0x3f'),_0x3dc8c3[_0x72e5('0x6')]),_0x2be291);}};exports[_0x72e5('0x40')]=function(_0x4c247e){try{utils[_0x72e5('0xf')](util[_0x72e5('0x5')](_0x72e5('0x41'),_0x4c247e['uniqueid']),_0x4c247e);utils[_0x72e5('0x4')](util[_0x72e5('0x5')](_0x72e5('0x42'),_0x4c247e[_0x72e5('0x6')],_0x4c247e[_0x72e5('0x43')],_0x4c247e[_0x72e5('0x44')],_0x4c247e['transfereecalleridnum'],_0x4c247e[_0x72e5('0x45')]));if(recordings[_0x4c247e['transfereruniqueid']]&&transfers[_0x72e5('0x7')][_0x4c247e[_0x72e5('0x46')]]){transfers[_0x72e5('0x7')][_0x4c247e['transfereruniqueid']][_0x72e5('0x47')]=!![];}}catch(_0x56ef88){utils[_0x72e5('0x16')](util['format']('[%s][recordings][blindtransfer]',_0x4c247e['uniqueid']),_0x56ef88);}};
\ No newline at end of file
index a3232a1..60da59c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8981=['transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridname'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0x8981,0x7f));var _0x1898=function(_0x4d138e,_0x58211b){_0x4d138e=_0x4d138e-0x0;var _0x4a8935=_0x8981[_0x4d138e];return _0x4a8935;};'use strict';var _=require('lodash');var util=require(_0x1898('0x0'));var utils=require(_0x1898('0x1'));function writeDB(_0x40bca4){utils[_0x1898('0x2')](util['format'](_0x1898('0x3'),_0x40bca4[_0x1898('0x4')]===_0x1898('0x5')?_0x40bca4[_0x1898('0x6')]:_0x40bca4[_0x1898('0x7')],_0x40bca4[_0x1898('0x4')]));utils[_0x1898('0x8')](_0x1898('0x9'),_0x40bca4);}exports[_0x1898('0xa')]={};exports[_0x1898('0xb')]=function(_0x344965){try{utils[_0x1898('0xc')](util[_0x1898('0xd')]('[%s][transfers][blindtransfer]',_0x344965[_0x1898('0x7')]),_0x344965);utils[_0x1898('0x2')](util[_0x1898('0xd')](_0x1898('0xe'),_0x344965[_0x1898('0x7')],_0x344965[_0x1898('0xf')],_0x344965[_0x1898('0x10')],_0x344965[_0x1898('0x11')],_0x344965[_0x1898('0x12')]));_0x344965[_0x1898('0x4')]=_0x1898('0x13');exports[_0x1898('0xa')][_0x344965[_0x1898('0x14')]]=_0x344965;writeDB(_0x344965);}catch(_0x366f9f){utils[_0x1898('0x15')](util['format'](_0x1898('0x16'),_0x344965[_0x1898('0x7')]),_0x366f9f);}};exports['attendedtransfer']=function(_0x10723b){try{utils[_0x1898('0xc')](util['format'](_0x1898('0x17'),_0x10723b[_0x1898('0x6')]),_0x10723b);utils['info'](util[_0x1898('0xd')](_0x1898('0x18'),_0x10723b[_0x1898('0x6')],_0x10723b[_0x1898('0x19')],_0x10723b[_0x1898('0x1a')],_0x10723b[_0x1898('0x1b')],_0x10723b['transfertargetcalleridname']));_0x10723b=_[_0x1898('0x1c')](_0x10723b,{'transfererchannel':_0x10723b[_0x1898('0x1d')],'transferercalleridnum':_0x10723b[_0x1898('0x19')],'transferercalleridname':_0x10723b['origtransferercalleridname'],'transfererconnectedlinenum':_0x10723b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x10723b[_0x1898('0x1e')],'transfereraccountcode':_0x10723b[_0x1898('0x1f')],'transferercontext':_0x10723b['secondtransferercontext'],'transfererexten':_0x10723b[_0x1898('0x20')],'transfererlinkedid':_0x10723b['origtransfererlinkedid'],'context':_0x10723b['origtransferercontext'],'extension':_0x10723b[_0x1898('0x21')],'type':'attended'});if(_[_0x1898('0x22')](_0x10723b['transfereechannel'])){_0x10723b=_['assign'](_0x10723b,{'transfereechannel':_0x10723b[_0x1898('0x23')],'transfereecalleridnum':_0x10723b['transfertargetcalleridnum'],'transfereecalleridname':_0x10723b[_0x1898('0x24')],'transfereeconnectedlinenum':_0x10723b[_0x1898('0x25')],'transfereeconnectedlinename':_0x10723b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x10723b['transfertargetaccountcode'],'transfereecontext':_0x10723b[_0x1898('0x26')],'transfereeexten':_0x10723b[_0x1898('0x27')],'transfereelinkedid':_0x10723b[_0x1898('0x28')]});}writeDB(_0x10723b);}catch(_0x5d5c62){utils[_0x1898('0x15')](util[_0x1898('0xd')]('[%s][transfers][attendedtransfer]',_0x10723b['origtransfereruniqueid']),_0x5d5c62);}};
\ No newline at end of file
+var _0x03a2=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer','format','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03a2,0x78));var _0x203a=function(_0x221191,_0x3e1f7d){_0x221191=_0x221191-0x0;var _0x27fa45=_0x03a2[_0x221191];return _0x27fa45;};'use strict';var _=require(_0x203a('0x0'));var util=require(_0x203a('0x1'));var utils=require('./utils');function writeDB(_0x2704ea){utils[_0x203a('0x2')](util['format'](_0x203a('0x3'),_0x2704ea[_0x203a('0x4')]===_0x203a('0x5')?_0x2704ea[_0x203a('0x6')]:_0x2704ea[_0x203a('0x7')],_0x2704ea['type']));utils['request'](_0x203a('0x8'),_0x2704ea);}exports[_0x203a('0x9')]={};exports[_0x203a('0xa')]=function(_0x1cade3){try{utils[_0x203a('0xb')](util['format'](_0x203a('0xc'),_0x1cade3[_0x203a('0x7')]),_0x1cade3);utils['info'](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1cade3['uniqueid'],_0x1cade3[_0x203a('0xd')],_0x1cade3[_0x203a('0xe')],_0x1cade3[_0x203a('0xf')],_0x1cade3['transfereecalleridname']));_0x1cade3[_0x203a('0x4')]=_0x203a('0x10');exports[_0x203a('0x9')][_0x1cade3[_0x203a('0x11')]]=_0x1cade3;writeDB(_0x1cade3);}catch(_0x5e57da){utils[_0x203a('0x12')](util['format'](_0x203a('0xc'),_0x1cade3['uniqueid']),_0x5e57da);}};exports[_0x203a('0x13')]=function(_0x349646){try{utils[_0x203a('0xb')](util[_0x203a('0x14')](_0x203a('0x15'),_0x349646[_0x203a('0x6')]),_0x349646);utils['info'](util[_0x203a('0x14')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x349646[_0x203a('0x6')],_0x349646[_0x203a('0x16')],_0x349646[_0x203a('0x17')],_0x349646[_0x203a('0x18')],_0x349646[_0x203a('0x19')]));_0x349646=_[_0x203a('0x1a')](_0x349646,{'transfererchannel':_0x349646['origtransfererchannel'],'transferercalleridnum':_0x349646['origtransferercalleridnum'],'transferercalleridname':_0x349646[_0x203a('0x17')],'transfererconnectedlinenum':_0x349646[_0x203a('0x1b')],'transfererconnectedlinename':_0x349646[_0x203a('0x1c')],'transfereraccountcode':_0x349646[_0x203a('0x1d')],'transferercontext':_0x349646['secondtransferercontext'],'transfererexten':_0x349646[_0x203a('0x1e')],'transfererlinkedid':_0x349646[_0x203a('0x1f')],'context':_0x349646[_0x203a('0x20')],'extension':_0x349646[_0x203a('0x21')],'type':_0x203a('0x5')});if(_[_0x203a('0x22')](_0x349646['transfereechannel'])){_0x349646=_[_0x203a('0x1a')](_0x349646,{'transfereechannel':_0x349646[_0x203a('0x23')],'transfereecalleridnum':_0x349646[_0x203a('0x18')],'transfereecalleridname':_0x349646['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x349646[_0x203a('0x24')],'transfereeconnectedlinename':_0x349646[_0x203a('0x25')],'transfereeaccountcode':_0x349646['transfertargetaccountcode'],'transfereecontext':_0x349646['transfertargetcontext'],'transfereeexten':_0x349646[_0x203a('0x26')],'transfereelinkedid':_0x349646['transfertargetlinkedid']});}writeDB(_0x349646);}catch(_0x572a08){utils[_0x203a('0x12')](util[_0x203a('0x14')](_0x203a('0x15'),_0x349646[_0x203a('0x6')]),_0x572a08);}};
\ No newline at end of file
index 7a923bd..cc66320 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x56b1=['now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','then','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime'];(function(_0x452d3b,_0x18ba27){var _0x520d2e=function(_0x4f36e9){while(--_0x4f36e9){_0x452d3b['push'](_0x452d3b['shift']());}};_0x520d2e(++_0x18ba27);}(_0x56b1,0x168));var _0x156b=function(_0x34f2a8,_0x1e0053){_0x34f2a8=_0x34f2a8-0x0;var _0x4059a6=_0x56b1[_0x34f2a8];return _0x4059a6;};'use strict';var BPromise=require(_0x156b('0x0'));var jayson=require(_0x156b('0x1'));var moment=require('moment');var util=require(_0x156b('0x2'));var client=jayson[_0x156b('0x3')][_0x156b('0x4')]({'port':0x2329});var logger=require(_0x156b('0x5'))('xdr');exports[_0x156b('0x6')]=function(_0x169f5e,_0x52c342){logger[_0x156b('0x6')](_0x169f5e,_0x52c342?util[_0x156b('0x7')](_0x52c342,{'showHidden':![],'depth':null}):'');};exports[_0x156b('0x8')]=function(_0xc3cacf,_0xd1828a){logger['debug'](_0xc3cacf,_0xd1828a?util[_0x156b('0x7')](_0xd1828a,{'showHidden':![],'depth':null}):'');};exports[_0x156b('0x9')]=function(_0x4bf717,_0x40a2a7){logger[_0x156b('0x9')](_0x4bf717,_0x40a2a7?util['inspect'](_0x40a2a7,{'showHidden':![],'depth':null}):'');};exports[_0x156b('0xa')]=function(_0x31d190,_0x15bb5a){return client[_0x156b('0xa')](_0x31d190,{'body':_0x15bb5a})['then'](function(_0x424af6){logger[_0x156b('0x8')](_0x156b('0xb'),_0x31d190,_0x424af6?util[_0x156b('0x7')](_0x424af6,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x30b8ec){logger[_0x156b('0x9')](_0x156b('0xb'),_0x31d190,_0x30b8ec?util[_0x156b('0x7')](_0x30b8ec,{'showHidden':![],'depth':null}):'');});};function getUser(_0xa1a499){return client['request'](_0x156b('0xc'),{'options':{'raw':!![],'attributes':['id',_0x156b('0xd'),_0x156b('0xe'),_0x156b('0xf')],'where':_0xa1a499,'limit':0x1}})['then'](function(_0xc6e4b2){logger[_0x156b('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x156b('0x10')](_0xa1a499),_0xc6e4b2?util[_0x156b('0x7')](_0xc6e4b2,{'showHidden':![],'depth':null}):'');return _0xc6e4b2[_0x156b('0x11')][_0x156b('0x12')]?_0xc6e4b2[_0x156b('0x11')][0x0]:null;});}exports[_0x156b('0x13')]=function(_0x25b448){return new BPromise(function(_0x1d2b91,_0x5a3388){if(_0x25b448){return getUser({'internal':_0x25b448})['then'](function(_0x558075){logger[_0x156b('0x6')](_0x156b('0x14'),_0x25b448,_0x558075?_0x156b('0x15'):_0x156b('0x16'));return _0x1d2b91(_0x558075);})[_0x156b('0x17')](function(_0x25b510){logger['error'](_0x156b('0x18'),_0x25b510?util[_0x156b('0x7')](_0x25b510,{'showHidden':![],'depth':null}):'');return _0x1d2b91(null);});}return _0x1d2b91(null);});};exports[_0x156b('0x19')]=function(_0xc7f056){return new BPromise(function(_0x4814e7,_0x481be6){if(_0xc7f056){return getUser({'interface':_0xc7f056})[_0x156b('0x1a')](function(_0x3fd20b){logger['info'](_0x156b('0x1b'),_0xc7f056,_0x3fd20b?'found':_0x156b('0x16'));return _0x4814e7(_0x3fd20b);})['catch'](function(_0x1d05b4){logger[_0x156b('0x9')](_0x156b('0x1c'),_0x1d05b4?util[_0x156b('0x7')](_0x1d05b4,{'showHidden':![],'depth':null}):'');return _0x4814e7(null);});}return _0x4814e7(null);});};exports['getUserByName']=function(_0x2ef261){return new BPromise(function(_0x38a5d4,_0x38d4e7){if(_0x2ef261){return getUser({'name':_0x2ef261})[_0x156b('0x1a')](function(_0x100f3){logger[_0x156b('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2ef261,_0x100f3?_0x156b('0x15'):_0x156b('0x16'));return _0x38a5d4(_0x100f3);})[_0x156b('0x17')](function(_0x2ca15f){logger[_0x156b('0x9')](_0x156b('0x1d'),_0x2ca15f?util[_0x156b('0x7')](_0x2ca15f,{'showHidden':![],'depth':null}):'');return _0x38a5d4(null);});}return _0x38a5d4(null);});};exports[_0x156b('0x1e')]=function(_0x13e3cb){return new BPromise(function(_0xf3f553,_0x176695){if(_0x13e3cb){return client[_0x156b('0xa')](_0x156b('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x156b('0xe'),_0x156b('0x20'),_0x156b('0x21'),_0x156b('0x22')],'where':{'name':_0x13e3cb},'limit':0x1}})[_0x156b('0x1a')](function(_0x2c32d8){logger[_0x156b('0x8')](_0x156b('0x23'),_0x13e3cb,_0x2c32d8?util[_0x156b('0x7')](_0x2c32d8,{'showHidden':![],'depth':null}):'');logger[_0x156b('0x6')](_0x156b('0x24'),_0x13e3cb,_0x2c32d8?'found':_0x156b('0x16'));return _0xf3f553(_0x2c32d8['result']['length']?_0x2c32d8[_0x156b('0x11')][0x0]:null);})['catch'](function(_0x42d3a9){logger[_0x156b('0x9')](_0x156b('0x25'),_0x42d3a9?util[_0x156b('0x7')](_0x42d3a9,{'showHidden':![],'depth':null}):'');return _0xf3f553(null);});}return _0xf3f553(null);});};exports[_0x156b('0x26')]=function(_0x17fb55,_0x1590ea){return moment(_0x17fb55)[_0x156b('0x27')](_0x1590ea,_0x156b('0x28'))[_0x156b('0x29')](_0x156b('0x2a'));};exports[_0x156b('0x2b')]=function(_0x3d1e3a,_0x295fa3){return moment(_0x3d1e3a)[_0x156b('0x2c')](_0x295fa3,_0x156b('0x28'))[_0x156b('0x29')](_0x156b('0x2a'));};exports[_0x156b('0x2d')]=function(_0x134d99,_0x5873db){return moment(_0x134d99)[_0x156b('0x2e')](moment(_0x5873db),_0x156b('0x28'));};exports[_0x156b('0x2f')]=function(_0x3118c3,_0x1486f2){return parseInt(_0x3118c3,0xa)+parseInt(_0x1486f2,0xa);};exports[_0x156b('0x30')]=function(){return moment()['format'](_0x156b('0x2a'));};exports[_0x156b('0x31')]=function(_0x4b5736,_0x8e7f41){if(_0x8e7f41){return moment(_0x4b5736)[_0x156b('0x31')](_0x8e7f41);}return!![];};exports[_0x156b('0x32')]=function(_0x4bbbaf,_0x49999c){if(_0x49999c){return moment(_0x4bbbaf)[_0x156b('0x32')](_0x49999c);}else if(_0x4bbbaf){return!![];}return![];};
\ No newline at end of file
+var _0x5c10=['request','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','then','found','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','moment','http','../../config/logger','info','inspect','debug','error','[utils][request]\x20name:%s'];(function(_0x14eb61,_0x430de5){var _0x3ab5a0=function(_0x1d54d6){while(--_0x1d54d6){_0x14eb61['push'](_0x14eb61['shift']());}};_0x3ab5a0(++_0x430de5);}(_0x5c10,0x183));var _0x05c1=function(_0x178c92,_0x3760e0){_0x178c92=_0x178c92-0x0;var _0x509937=_0x5c10[_0x178c92];return _0x509937;};'use strict';var BPromise=require(_0x05c1('0x0'));var jayson=require('jayson/promise');var moment=require(_0x05c1('0x1'));var util=require('util');var client=jayson['client'][_0x05c1('0x2')]({'port':0x2329});var logger=require(_0x05c1('0x3'))('xdr');exports[_0x05c1('0x4')]=function(_0xf1f78e,_0x542deb){logger[_0x05c1('0x4')](_0xf1f78e,_0x542deb?util[_0x05c1('0x5')](_0x542deb,{'showHidden':![],'depth':null}):'');};exports[_0x05c1('0x6')]=function(_0x399a18,_0x51d30e){logger[_0x05c1('0x6')](_0x399a18,_0x51d30e?util['inspect'](_0x51d30e,{'showHidden':![],'depth':null}):'');};exports[_0x05c1('0x7')]=function(_0x49c5ee,_0x4ed2db){logger[_0x05c1('0x7')](_0x49c5ee,_0x4ed2db?util['inspect'](_0x4ed2db,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x42a1b7,_0x348340){return client['request'](_0x42a1b7,{'body':_0x348340})['then'](function(_0x5b3bc4){logger[_0x05c1('0x6')](_0x05c1('0x8'),_0x42a1b7,_0x5b3bc4?util['inspect'](_0x5b3bc4,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5f4896){logger['error'](_0x05c1('0x8'),_0x42a1b7,_0x5f4896?util['inspect'](_0x5f4896,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4f86a7){return client[_0x05c1('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x05c1('0xa'),'name',_0x05c1('0xb')],'where':_0x4f86a7,'limit':0x1}})['then'](function(_0x83f51){logger['debug'](_0x05c1('0xc'),JSON[_0x05c1('0xd')](_0x4f86a7),_0x83f51?util[_0x05c1('0x5')](_0x83f51,{'showHidden':![],'depth':null}):'');return _0x83f51[_0x05c1('0xe')][_0x05c1('0xf')]?_0x83f51[_0x05c1('0xe')][0x0]:null;});}exports[_0x05c1('0x10')]=function(_0x575b8d){return new BPromise(function(_0x4501b0,_0xce58b7){if(_0x575b8d){return getUser({'internal':_0x575b8d})[_0x05c1('0x11')](function(_0x53074c){logger[_0x05c1('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x575b8d,_0x53074c?_0x05c1('0x12'):_0x05c1('0x13'));return _0x4501b0(_0x53074c);})[_0x05c1('0x14')](function(_0x26708f){logger[_0x05c1('0x7')](_0x05c1('0x15'),_0x26708f?util[_0x05c1('0x5')](_0x26708f,{'showHidden':![],'depth':null}):'');return _0x4501b0(null);});}return _0x4501b0(null);});};exports['getUserByInterface']=function(_0xc637ae){return new BPromise(function(_0x51b862,_0x4e61c0){if(_0xc637ae){return getUser({'interface':_0xc637ae})[_0x05c1('0x11')](function(_0xbc07f9){logger[_0x05c1('0x4')](_0x05c1('0x16'),_0xc637ae,_0xbc07f9?'found':'notfound');return _0x51b862(_0xbc07f9);})['catch'](function(_0x461fdb){logger['error'](_0x05c1('0x17'),_0x461fdb?util['inspect'](_0x461fdb,{'showHidden':![],'depth':null}):'');return _0x51b862(null);});}return _0x51b862(null);});};exports[_0x05c1('0x18')]=function(_0x481006){return new BPromise(function(_0x6ed77d,_0x41720d){if(_0x481006){return getUser({'name':_0x481006})['then'](function(_0x833a6b){logger[_0x05c1('0x4')](_0x05c1('0x19'),_0x481006,_0x833a6b?_0x05c1('0x12'):_0x05c1('0x13'));return _0x6ed77d(_0x833a6b);})[_0x05c1('0x14')](function(_0x39f1a7){logger[_0x05c1('0x7')](_0x05c1('0x1a'),_0x39f1a7?util[_0x05c1('0x5')](_0x39f1a7,{'showHidden':![],'depth':null}):'');return _0x6ed77d(null);});}return _0x6ed77d(null);});};exports['getVoiceQueueByName']=function(_0x233577){return new BPromise(function(_0x239255,_0x1d199b){if(_0x233577){return client['request'](_0x05c1('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x05c1('0x1c'),_0x05c1('0x1d'),_0x05c1('0x1e'),_0x05c1('0x1f')],'where':{'name':_0x233577},'limit':0x1}})['then'](function(_0x156e6c){logger[_0x05c1('0x6')](_0x05c1('0x20'),_0x233577,_0x156e6c?util[_0x05c1('0x5')](_0x156e6c,{'showHidden':![],'depth':null}):'');logger[_0x05c1('0x4')](_0x05c1('0x21'),_0x233577,_0x156e6c?_0x05c1('0x12'):_0x05c1('0x13'));return _0x239255(_0x156e6c[_0x05c1('0xe')][_0x05c1('0xf')]?_0x156e6c[_0x05c1('0xe')][0x0]:null);})[_0x05c1('0x14')](function(_0x29e690){logger[_0x05c1('0x7')]('[utils][getVoiceQueueByName]',_0x29e690?util[_0x05c1('0x5')](_0x29e690,{'showHidden':![],'depth':null}):'');return _0x239255(null);});}return _0x239255(null);});};exports[_0x05c1('0x22')]=function(_0x22266d,_0x23a4ac){return moment(_0x22266d)[_0x05c1('0x23')](_0x23a4ac,_0x05c1('0x24'))[_0x05c1('0x25')](_0x05c1('0x26'));};exports['subtractTime']=function(_0x11324e,_0x473fc7){return moment(_0x11324e)['subtract'](_0x473fc7,_0x05c1('0x24'))[_0x05c1('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x20bd4b,_0xae5559){return moment(_0x20bd4b)[_0x05c1('0x27')](moment(_0xae5559),_0x05c1('0x24'));};exports[_0x05c1('0x28')]=function(_0x9b3796,_0x3c139e){return parseInt(_0x9b3796,0xa)+parseInt(_0x3c139e,0xa);};exports[_0x05c1('0x29')]=function(){return moment()[_0x05c1('0x25')](_0x05c1('0x26'));};exports[_0x05c1('0x2a')]=function(_0x113ce3,_0x33379a){if(_0x33379a){return moment(_0x113ce3)[_0x05c1('0x2a')](_0x33379a);}return!![];};exports[_0x05c1('0x2b')]=function(_0x1857d3,_0x57397b){if(_0x57397b){return moment(_0x1857d3)[_0x05c1('0x2b')](_0x57397b);}else if(_0x1857d3){return!![];}return![];};
\ No newline at end of file
index dc39c20..9a984a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x78bb=['other','agent_id','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','log','join','name','ensureDir','then','client','catch','user','no-user','data','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','role','inspect','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','statusCode','responseTime'];(function(_0x43a4c2,_0x4e400f){var _0x3cd4fb=function(_0x28ec58){while(--_0x28ec58){_0x43a4c2['push'](_0x43a4c2['shift']());}};_0x3cd4fb(++_0x4e400f);}(_0x78bb,0x1da));var _0xb78b=function(_0x651909,_0x15c6b4){_0x651909=_0x651909-0x0;var _0x572299=_0x78bb[_0x651909];return _0x572299;};var fs=require(_0xb78b('0x0'));var _=require(_0xb78b('0x1'));var ewinston=require(_0xb78b('0x2'));var path=require(_0xb78b('0x3'));var util=require(_0xb78b('0x4'));var fileLogger=require(_0xb78b('0x5'))[_0xb78b('0x6')];var safeTemplate=require(_0xb78b('0x7'))['safeTemplate'];var maskSensitiveData=require(_0xb78b('0x8'))[_0xb78b('0x9')];function ClientSideLogger(){function _0xd810b6(_0x368488){var _0x4e8e61=path['join']('/var',_0xb78b('0xa'),'xcally');var _0xd3a20f=path[_0xb78b('0xb')]('client',_0x368488['role']+'-'+_0x368488[_0xb78b('0xc')]);return fs[_0xb78b('0xd')](path['join'](_0x4e8e61,_0xd3a20f))[_0xb78b('0xe')](function(){var _0x3d78c0=fileLogger(_0xb78b('0xf'),path[_0xb78b('0xb')](_0x4e8e61,_0xd3a20f));return _0x3d78c0;})[_0xb78b('0x10')](function(_0x5f2163){throw _0x5f2163;});}this[_0xb78b('0xa')]=function(_0x455e41,_0x412a0d,_0xf41583,_0x4a5053){return _0xd810b6(_0x455e41[_0xb78b('0x11')])[_0xb78b('0xe')](function(_0x7c862){var _0x50f26f=_0x7c862[_0x412a0d];return _0x50f26f;})[_0xb78b('0xe')](function(_0x573482){var _0x2e08bc=_0x455e41[_0xb78b('0x11')]?_0x455e41[_0xb78b('0x11')]['id']:_0xb78b('0x12');var _0x2bd542=_0x4a5053[_0xb78b('0x13')];var _0xd670a4=_0x4a5053['timestamp'];var _0x2eba5f=new Date(Number(_0xd670a4));return _0x573482(_0x2e08bc,_0x2eba5f,_0xf41583,_0x2bd542);})[_0xb78b('0x10')](function(_0x5b507a){fileLogger(_0xb78b('0xf'))[_0xb78b('0x14')](_0x5b507a);});};}function setupLoggers(_0x44290e){return new Promise(function(_0x1ec56b){var _0x10e97f=new ClientSideLogger();var _0x48c1e6=fileLogger(_0xb78b('0x15'));var _0xeb6b6d=fileLogger(_0xb78b('0x16'));_0x44290e[_0xb78b('0x17')](_0xb78b('0x18'),_0x10e97f);_0x44290e[_0xb78b('0x19')](ewinston[_0xb78b('0x1a')]({'winstonInstance':_0x48c1e6,'meta':![],'statusLevels':!![],'msg':function(_0x996962,_0xc4652a){var _0x1abbc1=_0xb78b('0x1b');if(!_[_0xb78b('0x1c')](_0x996962[_0xb78b('0x1d')])){_0x1abbc1+='\x20body=%s';var _0x19ffc5=_0x996962[_0xb78b('0x1d')];maskSensitiveData(_0x19ffc5);}return safeTemplate(util[_0xb78b('0x1e')](_0x1abbc1,_0x996962[_0xb78b('0x1f')],_0x996962[_0xb78b('0x20')][_0xb78b('0x21')]?_0x996962[_0xb78b('0x20')]['x-forwarded-for']:_0x996962['connection'][_0xb78b('0x22')]||_0x996962['ip'],_0x996962[_0xb78b('0x23')],_0xc4652a['statusCode'],_0xc4652a['responseTime'],_0x996962['user']?_0x996962[_0xb78b('0x11')]['id']:null,_0x996962[_0xb78b('0x11')]?_0x996962['user'][_0xb78b('0xc')]:null,_0x996962[_0xb78b('0x11')]?_0x996962[_0xb78b('0x11')][_0xb78b('0x24')]:null,_0x19ffc5?util[_0xb78b('0x25')](_0x19ffc5,![],null):''));}}));_0x44290e[_0xb78b('0x19')](ewinston['logger']({'winstonInstance':_0xeb6b6d,'meta':![],'statusLevels':!![],'msg':function(_0x2bc0ca,_0x760785){var _0x1fdfde='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2bc0ca[_0xb78b('0x1d')]&&_0x2bc0ca[_0xb78b('0x1d')][_0xb78b('0x26')]&&_0x2bc0ca[_0xb78b('0x1d')]['agent_id']){_0x1fdfde=_0xb78b('0x27');}return util[_0xb78b('0x1e')](_0x1fdfde,_0x2bc0ca[_0xb78b('0x1f')],_0x2bc0ca[_0xb78b('0x20')][_0xb78b('0x21')]?_0x2bc0ca[_0xb78b('0x20')]['x-forwarded-for']:_0x2bc0ca[_0xb78b('0x28')][_0xb78b('0x22')]||_0x2bc0ca['ip'],_0x2bc0ca[_0xb78b('0x23')],_0x760785[_0xb78b('0x29')],_0x760785[_0xb78b('0x2a')],_0x2bc0ca[_0xb78b('0x11')]?_0x2bc0ca[_0xb78b('0x11')]['id']:null,_0x2bc0ca[_0xb78b('0x11')]?_0x2bc0ca['user'][_0xb78b('0xc')]:null,_0x2bc0ca['user']?_0x2bc0ca['user'][_0xb78b('0x24')]:null,_0x2bc0ca[_0xb78b('0x1d')]&&_0x2bc0ca['body'][_0xb78b('0x26')]?_0x2bc0ca[_0xb78b('0x1d')][_0xb78b('0x26')]:_0xb78b('0x2b'),_0x2bc0ca[_0xb78b('0x1d')]&&_0x2bc0ca[_0xb78b('0x1d')][_0xb78b('0x2c')]?_0x2bc0ca[_0xb78b('0x1d')]['agent_id']:'',_0x2bc0ca['body']&&_0x2bc0ca[_0xb78b('0x1d')][_0xb78b('0x2d')]?_0x2bc0ca[_0xb78b('0x1d')][_0xb78b('0x2d')]:'');},'ignoreRoute':function(_0x477da6){var _0x343fc7=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x343fc7['test'](_0x477da6[_0xb78b('0x23')]);}}));return _0x1ec56b();});}exports[_0xb78b('0x2e')]=setupLoggers;
\ No newline at end of file
+var _0xa9a9=['x-forwarded-for','connection','responseTime','name','use','device','remoteAddress','url','other','agent_id','agent_name','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','ensureDir','then','catch','user','no-user','data','timestamp','error','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers'];(function(_0x21be21,_0x248ea2){var _0x3007da=function(_0x4b285a){while(--_0x4b285a){_0x21be21['push'](_0x21be21['shift']());}};_0x3007da(++_0x248ea2);}(_0xa9a9,0xe2));var _0x9a9a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa9a9[_0x321bb2];return _0x9c12ed;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0x9a9a('0x0'));var path=require(_0x9a9a('0x1'));var util=require(_0x9a9a('0x2'));var fileLogger=require(_0x9a9a('0x3'))[_0x9a9a('0x4')];var safeTemplate=require('./safe-template')[_0x9a9a('0x5')];var maskSensitiveData=require(_0x9a9a('0x6'))[_0x9a9a('0x7')];function ClientSideLogger(){function _0x5536f2(_0x20fdf2){var _0x34eb45=path['join'](_0x9a9a('0x8'),_0x9a9a('0x9'),_0x9a9a('0xa'));var _0x2c6258=path[_0x9a9a('0xb')](_0x9a9a('0xc'),_0x20fdf2[_0x9a9a('0xd')]+'-'+_0x20fdf2['name']);return fs[_0x9a9a('0xe')](path[_0x9a9a('0xb')](_0x34eb45,_0x2c6258))[_0x9a9a('0xf')](function(){var _0x464119=fileLogger(_0x9a9a('0xc'),path[_0x9a9a('0xb')](_0x34eb45,_0x2c6258));return _0x464119;})[_0x9a9a('0x10')](function(_0x41c242){throw _0x41c242;});}this[_0x9a9a('0x9')]=function(_0x32f1e1,_0x316c06,_0xe51f10,_0x50fd90){return _0x5536f2(_0x32f1e1['user'])['then'](function(_0x4f794b){var _0x17d968=_0x4f794b[_0x316c06];return _0x17d968;})[_0x9a9a('0xf')](function(_0x11fe90){var _0x4f84f4=_0x32f1e1[_0x9a9a('0x11')]?_0x32f1e1['user']['id']:_0x9a9a('0x12');var _0x4d1a2e=_0x50fd90[_0x9a9a('0x13')];var _0x1b58ad=_0x50fd90[_0x9a9a('0x14')];var _0x50ee50=new Date(Number(_0x1b58ad));return _0x11fe90(_0x4f84f4,_0x50ee50,_0xe51f10,_0x4d1a2e);})['catch'](function(_0x5a8ea7){fileLogger(_0x9a9a('0xc'))[_0x9a9a('0x15')](_0x5a8ea7);});};}function setupLoggers(_0x463317){return new Promise(function(_0x416435){var _0x599295=new ClientSideLogger();var _0x96a7c1=fileLogger('api');var _0xe37142=fileLogger('auth');_0x463317[_0x9a9a('0x16')](_0x9a9a('0x17'),_0x599295);_0x463317['use'](ewinston[_0x9a9a('0x18')]({'winstonInstance':_0x96a7c1,'meta':![],'statusLevels':!![],'msg':function(_0x801f25,_0x109a5d){var _0x174665=_0x9a9a('0x19');if(!_[_0x9a9a('0x1a')](_0x801f25[_0x9a9a('0x1b')])){_0x174665+=_0x9a9a('0x1c');var _0x3d8520=_0x801f25['body'];maskSensitiveData(_0x3d8520);}return safeTemplate(util[_0x9a9a('0x1d')](_0x174665,_0x801f25[_0x9a9a('0x1e')],_0x801f25[_0x9a9a('0x1f')][_0x9a9a('0x20')]?_0x801f25['headers'][_0x9a9a('0x20')]:_0x801f25[_0x9a9a('0x21')]['remoteAddress']||_0x801f25['ip'],_0x801f25['url'],_0x109a5d['statusCode'],_0x109a5d[_0x9a9a('0x22')],_0x801f25['user']?_0x801f25[_0x9a9a('0x11')]['id']:null,_0x801f25[_0x9a9a('0x11')]?_0x801f25[_0x9a9a('0x11')][_0x9a9a('0x23')]:null,_0x801f25[_0x9a9a('0x11')]?_0x801f25[_0x9a9a('0x11')][_0x9a9a('0xd')]:null,_0x3d8520?util['inspect'](_0x3d8520,![],null):''));}}));_0x463317[_0x9a9a('0x24')](ewinston[_0x9a9a('0x18')]({'winstonInstance':_0xe37142,'meta':![],'statusLevels':!![],'msg':function(_0x1a366e,_0x4f5ff4){var _0x4d49b6='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1a366e[_0x9a9a('0x1b')]&&_0x1a366e[_0x9a9a('0x1b')][_0x9a9a('0x25')]&&_0x1a366e[_0x9a9a('0x1b')]['agent_id']){_0x4d49b6='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x9a9a('0x1d')](_0x4d49b6,_0x1a366e[_0x9a9a('0x1e')],_0x1a366e[_0x9a9a('0x1f')][_0x9a9a('0x20')]?_0x1a366e[_0x9a9a('0x1f')][_0x9a9a('0x20')]:_0x1a366e[_0x9a9a('0x21')][_0x9a9a('0x26')]||_0x1a366e['ip'],_0x1a366e[_0x9a9a('0x27')],_0x4f5ff4['statusCode'],_0x4f5ff4[_0x9a9a('0x22')],_0x1a366e[_0x9a9a('0x11')]?_0x1a366e[_0x9a9a('0x11')]['id']:null,_0x1a366e['user']?_0x1a366e[_0x9a9a('0x11')][_0x9a9a('0x23')]:null,_0x1a366e[_0x9a9a('0x11')]?_0x1a366e[_0x9a9a('0x11')][_0x9a9a('0xd')]:null,_0x1a366e[_0x9a9a('0x1b')]&&_0x1a366e['body']['device']?_0x1a366e[_0x9a9a('0x1b')]['device']:_0x9a9a('0x28'),_0x1a366e[_0x9a9a('0x1b')]&&_0x1a366e[_0x9a9a('0x1b')][_0x9a9a('0x29')]?_0x1a366e[_0x9a9a('0x1b')]['agent_id']:'',_0x1a366e[_0x9a9a('0x1b')]&&_0x1a366e[_0x9a9a('0x1b')][_0x9a9a('0x2a')]?_0x1a366e['body'][_0x9a9a('0x2a')]:'');},'ignoreRoute':function(_0x460a97){var _0x1d853f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1d853f['test'](_0x460a97[_0x9a9a('0x27')]);}}));return _0x416435();});}exports['setupLoggers']=setupLoggers;
\ No newline at end of file
index ea137c4..646fd35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ee3=['circularMonthInterval','clone','hours','minutes','isBefore','day','isBetween','timeCompare','format','dowCompare','date','daysInMonth','min','MMM','includes','monthCompare','guess','isMoment','split','length','padStart','iftime','lodash','moment-timezone','source','join','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort'];(function(_0xa5fdf4,_0x553bc8){var _0x45a73d=function(_0x3d6276){while(--_0x3d6276){_0xa5fdf4['push'](_0xa5fdf4['shift']());}};_0x45a73d(++_0x553bc8);}(_0x6ee3,0xca));var _0x36ee=function(_0x693350,_0x50f927){_0x693350=_0x693350-0x0;var _0x35f7e9=_0x6ee3[_0x693350];return _0x35f7e9;};var _=require(_0x36ee('0x0'));var moment=require(_0x36ee('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x37a36c){return _0x37a36c[_0x36ee('0x2')];})[_0x36ee('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x54cf75){if(!_0x54cf75['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4fb2d3){var _0x2038e4=_0x4fb2d3['split'](':')[_0x36ee('0x4')](function(_0x3c5ea4){return parseInt(_0x3c5ea4,0xa);});var _0x1ba630=_0x2038e4[0x0];var _0x43692d=_0x2038e4[0x1];if(_0x1ba630<0x0||_0x1ba630>0x17||_0x43692d<0x0||_0x43692d>0x3b){throw new Error(EINVALID_DATE);}return[_0x1ba630,_0x43692d];}function circularDoWInterval(_0x45837c,_0x2a234d){if(_0x45837c===_0x2a234d){return[_0x45837c];}else{var _0x3acca7=moment[_0x36ee('0x5')]();moment[_0x36ee('0x5')]('en');var _0x1ba65d=moment[_0x36ee('0x6')]()[_0x36ee('0x4')](function(_0x3a5075){return _0x3a5075[_0x36ee('0x7')]();});moment['locale'](_0x3acca7);var _0x2faa02=_0x1ba65d[_0x36ee('0x8')](_0x45837c);var _0x3077a3=_0x1ba65d[_0x36ee('0x8')](_0x2a234d);if(_0x3077a3>_0x2faa02){return _0x1ba65d[_0x36ee('0x9')](_0x2faa02,_0x3077a3+0x1);}else{var _0x50331c=_0x1ba65d[_0x36ee('0x9')](0x0,_0x3077a3+0x1);var _0xe8abdc=_0x1ba65d[_0x36ee('0x9')](_0x2faa02);return _0xe8abdc[_0x36ee('0xa')](_0x50331c);}}}module[_0x36ee('0xb')][_0x36ee('0xc')]=circularDoWInterval;function circularMonthInterval(_0x5b71e5,_0xf41c92){if(_0x5b71e5===_0xf41c92){return[_0x5b71e5];}else{var _0x11f51a=moment[_0x36ee('0x5')]();moment['locale']('en');var _0x32f0ab=moment[_0x36ee('0xd')]()[_0x36ee('0x4')](function(_0x2b7bf5){return _0x2b7bf5[_0x36ee('0x7')]();});moment['locale'](_0x11f51a);var _0x374860=_0x32f0ab[_0x36ee('0x8')](_0x5b71e5);var _0x1e4acd=_0x32f0ab[_0x36ee('0x8')](_0xf41c92);if(_0x1e4acd>_0x374860){return _0x32f0ab[_0x36ee('0x9')](_0x374860,_0x1e4acd+0x1);}else{var _0x372bc8=_0x32f0ab[_0x36ee('0x9')](0x0,_0x1e4acd+0x1);var _0x438814=_0x32f0ab[_0x36ee('0x9')](_0x374860);return _0x438814['concat'](_0x372bc8);}}}module[_0x36ee('0xb')][_0x36ee('0xe')]=circularMonthInterval;function parseDom(_0xd34fee){var _0xf58ebb=parseInt(_0xd34fee,0xa);if(_0xf58ebb<0x1||_0xf58ebb>0x1f){throw new Error(EINVALID_DATE);}return _0xf58ebb;}function timeCompare(_0x3db418,_0x4b59bb,_0x32c36f){var _0x237a24=_0x3db418[_0x36ee('0xf')]();var _0x5e3f04=extractTime(_0x4b59bb);var _0x102534=_0x5e3f04[0x0];var _0x5ef576=_0x5e3f04[0x1];var _0x43ee56=_0x3db418[_0x36ee('0xf')]()['hours'](_0x102534)['minutes'](_0x5ef576);throwIfDateNotValid(_0x43ee56);var _0x3ffcc7=extractTime(_0x32c36f);var _0x502993=_0x3ffcc7[0x0];var _0x24cc3f=_0x3ffcc7[0x1];var _0x37b9b5=_0x3db418[_0x36ee('0xf')]()[_0x36ee('0x10')](_0x502993)[_0x36ee('0x11')](_0x24cc3f);throwIfDateNotValid(_0x37b9b5);if(_0x37b9b5[_0x36ee('0x12')](_0x43ee56)){var _0x185b98=_0x237a24[_0x36ee('0xf')]()['startOf'](_0x36ee('0x13'));var _0x4a0aff=_0x237a24[_0x36ee('0xf')]()['endOf']('day');return _0x237a24[_0x36ee('0x14')](_0x43ee56,_0x4a0aff,undefined,'[]')||_0x237a24[_0x36ee('0x14')](_0x185b98,_0x37b9b5,undefined,'[]');}else{return _0x237a24['isBetween'](_0x43ee56,_0x37b9b5,undefined,'[]');}}module['exports'][_0x36ee('0x15')]=timeCompare;function dowCompare(_0x6b95ba,_0x1e6bf1,_0x2daa8a){var _0x3fcc4c=_0x6b95ba[_0x36ee('0x5')]('en')[_0x36ee('0x16')]('ddd')['toLowerCase']();return circularDoWInterval(_0x1e6bf1,_0x2daa8a)['includes'](_0x3fcc4c);}module['exports'][_0x36ee('0x17')]=dowCompare;function domCompare(_0x565801,_0x104a28,_0x1baa7d){var _0xfba692=_0x565801[_0x36ee('0x18')]();if(_0x104a28===_0x1baa7d){return _0xfba692===_0x104a28;}else{var _0x3de82e=_0x565801[_0x36ee('0x19')]();var _0x27f4d8=_0x104a28<_0x1baa7d;let _0x1982c2=![];var _0x980b7c=0x0;var _0x11854f=0x0;if(_0x27f4d8){_0x980b7c=Math['max'](0x1,_0x104a28);_0x11854f=Math[_0x36ee('0x1a')](_0x1baa7d,_0x3de82e);_0x1982c2=_0xfba692>=_0x980b7c&&_0xfba692<=_0x11854f;}else{_0x980b7c=Math[_0x36ee('0x1a')](_0x104a28,_0x3de82e);_0x11854f=Math['max'](0x1,_0x1baa7d);_0x1982c2=_0xfba692>=_0x980b7c||_0xfba692<=_0x11854f;}return _0x1982c2;}}module[_0x36ee('0xb')]['domCompare']=domCompare;function monthCompare(_0x457a42,_0x674a3f,_0x124c6e){var _0x2878c6=_0x457a42[_0x36ee('0x5')]('en')[_0x36ee('0x16')](_0x36ee('0x1b'))[_0x36ee('0x7')]();return circularMonthInterval(_0x674a3f,_0x124c6e)[_0x36ee('0x1c')](_0x2878c6);}module[_0x36ee('0xb')][_0x36ee('0x1d')]=monthCompare;function iftime(_0x16b29a,_0x5d30b5=moment['tz'][_0x36ee('0x1e')](),_0x4d8d27=moment()){if(!validateRx['test'](_0x16b29a)){throw new Error(EINVALID_STRING);}else{var _0x594946=(moment[_0x36ee('0x1f')](_0x4d8d27)?_0x4d8d27[_0x36ee('0xf')]():moment(_0x4d8d27))['tz'](_0x5d30b5)[_0x36ee('0x5')]('en');throwIfDateNotValid(_0x594946);var _0x270861=_0x16b29a[_0x36ee('0x20')](',');var _0x520db8=_0x270861[0x0];var _0x18e5f5=_0x270861[0x1];var _0x131961=_0x270861[0x2];var _0x40afe2=_0x270861[0x3];let _0x460ef5=!![];if(_0x520db8!=='*'){var _0x4d5e00=_0x520db8[_0x36ee('0x20')]('-');var _0x54b09b=_['padStart'](_0x4d5e00[0x0],0x5,'0');var _0x435fe9=_0x4d5e00[_0x36ee('0x21')]===0x2?_[_0x36ee('0x22')](_0x4d5e00[0x1],0x5,'0'):_0x54b09b;_0x460ef5=timeCompare(_0x594946,_0x54b09b,_0x435fe9);}let _0x846748=!![];if(_0x18e5f5!=='*'){var _0x413079=_0x18e5f5[_0x36ee('0x20')]('-');var _0x4e1aeb=_0x413079[0x0];var _0x389218=_0x413079[_0x36ee('0x21')]===0x2?_0x413079[0x1]:_0x4e1aeb;_0x846748=dowCompare(_0x594946,_0x4e1aeb,_0x389218);}let _0xf8f4bd=!![];if(_0x131961!=='*'){var _0x5192e1=_0x131961[_0x36ee('0x20')]('-');var _0x4d2d2c=parseDom(_0x5192e1[0x0]);var _0x5e7f4e=_0x5192e1[_0x36ee('0x21')]===0x2?parseDom(_0x5192e1[0x1]):_0x4d2d2c;_0xf8f4bd=domCompare(_0x594946,_0x4d2d2c,_0x5e7f4e);}let _0xa3d709=!![];if(_0x40afe2!=='*'){var _0x13ad2f=_0x40afe2[_0x36ee('0x20')]('-');var _0x1d6cf8=_0x13ad2f[0x0];var _0x4a7567=_0x13ad2f[_0x36ee('0x21')]===0x2?_0x13ad2f[0x1]:_0x13ad2f[0x0];_0xa3d709=monthCompare(_0x594946,_0x1d6cf8,_0x4a7567);}return _0x460ef5&&_0x846748&&_0xf8f4bd&&_0xa3d709;}}module[_0x36ee('0xb')][_0x36ee('0x23')]=iftime;
\ No newline at end of file
+var _0xbbec=['guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','minutes','clone','hours','isBefore','endOf','day','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0xbbec,0x180));var _0xcbbe=function(_0x13eea0,_0x40ad68){_0x13eea0=_0x13eea0-0x0;var _0x5a2e49=_0xbbec[_0x13eea0];return _0x5a2e49;};var _=require(_0xcbbe('0x0'));var moment=require(_0xcbbe('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xcbbe('0x2')](function(_0x5d36fc){return _0x5d36fc['source'];})[_0xcbbe('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcbbe('0x4');var EINVALID_DATE=_0xcbbe('0x5');function throwIfDateNotValid(_0x143a51){if(!_0x143a51[_0xcbbe('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3e0c2e){var _0xb7baa5=_0x3e0c2e[_0xcbbe('0x7')](':')[_0xcbbe('0x2')](function(_0x358d97){return parseInt(_0x358d97,0xa);});var _0x5db1e3=_0xb7baa5[0x0];var _0x285ce5=_0xb7baa5[0x1];if(_0x5db1e3<0x0||_0x5db1e3>0x17||_0x285ce5<0x0||_0x285ce5>0x3b){throw new Error(EINVALID_DATE);}return[_0x5db1e3,_0x285ce5];}function circularDoWInterval(_0x370644,_0x55f81f){if(_0x370644===_0x55f81f){return[_0x370644];}else{var _0x17ae20=moment['locale']();moment[_0xcbbe('0x8')]('en');var _0x359e7c=moment[_0xcbbe('0x9')]()[_0xcbbe('0x2')](function(_0xb70a27){return _0xb70a27[_0xcbbe('0xa')]();});moment[_0xcbbe('0x8')](_0x17ae20);var _0x3f9e20=_0x359e7c[_0xcbbe('0xb')](_0x370644);var _0x28b60c=_0x359e7c['indexOf'](_0x55f81f);if(_0x28b60c>_0x3f9e20){return _0x359e7c[_0xcbbe('0xc')](_0x3f9e20,_0x28b60c+0x1);}else{var _0x332c99=_0x359e7c[_0xcbbe('0xc')](0x0,_0x28b60c+0x1);var _0x18ae53=_0x359e7c['slice'](_0x3f9e20);return _0x18ae53[_0xcbbe('0xd')](_0x332c99);}}}module[_0xcbbe('0xe')][_0xcbbe('0xf')]=circularDoWInterval;function circularMonthInterval(_0x2a52f4,_0x41eef4){if(_0x2a52f4===_0x41eef4){return[_0x2a52f4];}else{var _0x3fed84=moment[_0xcbbe('0x8')]();moment['locale']('en');var _0x2c018e=moment[_0xcbbe('0x10')]()[_0xcbbe('0x2')](function(_0x3b8dab){return _0x3b8dab[_0xcbbe('0xa')]();});moment[_0xcbbe('0x8')](_0x3fed84);var _0x54fe60=_0x2c018e[_0xcbbe('0xb')](_0x2a52f4);var _0x5d5828=_0x2c018e['indexOf'](_0x41eef4);if(_0x5d5828>_0x54fe60){return _0x2c018e[_0xcbbe('0xc')](_0x54fe60,_0x5d5828+0x1);}else{var _0x315964=_0x2c018e[_0xcbbe('0xc')](0x0,_0x5d5828+0x1);var _0x15720a=_0x2c018e[_0xcbbe('0xc')](_0x54fe60);return _0x15720a[_0xcbbe('0xd')](_0x315964);}}}module[_0xcbbe('0xe')][_0xcbbe('0x11')]=circularMonthInterval;function parseDom(_0x854f49){var _0x571bea=parseInt(_0x854f49,0xa);if(_0x571bea<0x1||_0x571bea>0x1f){throw new Error(EINVALID_DATE);}return _0x571bea;}function timeCompare(_0x3096d9,_0x33741b,_0x36f9c9){var _0x364b2a=_0x3096d9['clone']();var _0x26ad4c=extractTime(_0x33741b);var _0x2a08a7=_0x26ad4c[0x0];var _0x4f87bd=_0x26ad4c[0x1];var _0x35676c=_0x3096d9['clone']()['hours'](_0x2a08a7)[_0xcbbe('0x12')](_0x4f87bd);throwIfDateNotValid(_0x35676c);var _0x2f5248=extractTime(_0x36f9c9);var _0x3ef2d0=_0x2f5248[0x0];var _0x10d7f3=_0x2f5248[0x1];var _0x37b503=_0x3096d9[_0xcbbe('0x13')]()[_0xcbbe('0x14')](_0x3ef2d0)[_0xcbbe('0x12')](_0x10d7f3);throwIfDateNotValid(_0x37b503);if(_0x37b503[_0xcbbe('0x15')](_0x35676c)){var _0x1a9c58=_0x364b2a[_0xcbbe('0x13')]()['startOf']('day');var _0x49be9d=_0x364b2a[_0xcbbe('0x13')]()[_0xcbbe('0x16')](_0xcbbe('0x17'));return _0x364b2a[_0xcbbe('0x18')](_0x35676c,_0x49be9d,undefined,'[]')||_0x364b2a['isBetween'](_0x1a9c58,_0x37b503,undefined,'[]');}else{return _0x364b2a[_0xcbbe('0x18')](_0x35676c,_0x37b503,undefined,'[]');}}module['exports'][_0xcbbe('0x19')]=timeCompare;function dowCompare(_0x469bac,_0x40a8b2,_0x56e285){var _0x3aa07c=_0x469bac[_0xcbbe('0x8')]('en')[_0xcbbe('0x1a')](_0xcbbe('0x1b'))['toLowerCase']();return circularDoWInterval(_0x40a8b2,_0x56e285)[_0xcbbe('0x1c')](_0x3aa07c);}module[_0xcbbe('0xe')]['dowCompare']=dowCompare;function domCompare(_0x4271ac,_0xccb203,_0x2b3f48){var _0x296862=_0x4271ac[_0xcbbe('0x1d')]();if(_0xccb203===_0x2b3f48){return _0x296862===_0xccb203;}else{var _0x333b49=_0x4271ac[_0xcbbe('0x1e')]();var _0x1838ce=_0xccb203<_0x2b3f48;let _0x3fa628=![];var _0x50cfaf=0x0;var _0x1772d9=0x0;if(_0x1838ce){_0x50cfaf=Math[_0xcbbe('0x1f')](0x1,_0xccb203);_0x1772d9=Math[_0xcbbe('0x20')](_0x2b3f48,_0x333b49);_0x3fa628=_0x296862>=_0x50cfaf&&_0x296862<=_0x1772d9;}else{_0x50cfaf=Math[_0xcbbe('0x20')](_0xccb203,_0x333b49);_0x1772d9=Math[_0xcbbe('0x1f')](0x1,_0x2b3f48);_0x3fa628=_0x296862>=_0x50cfaf||_0x296862<=_0x1772d9;}return _0x3fa628;}}module[_0xcbbe('0xe')][_0xcbbe('0x21')]=domCompare;function monthCompare(_0x59c221,_0x37ff79,_0x1dc044){var _0x555ac5=_0x59c221[_0xcbbe('0x8')]('en')[_0xcbbe('0x1a')](_0xcbbe('0x22'))[_0xcbbe('0xa')]();return circularMonthInterval(_0x37ff79,_0x1dc044)['includes'](_0x555ac5);}module[_0xcbbe('0xe')][_0xcbbe('0x23')]=monthCompare;function iftime(_0xa525e4,_0x1f25b4=moment['tz'][_0xcbbe('0x24')](),_0xb863cd=moment()){if(!validateRx[_0xcbbe('0x25')](_0xa525e4)){throw new Error(EINVALID_STRING);}else{var _0xee07e0=(moment[_0xcbbe('0x26')](_0xb863cd)?_0xb863cd[_0xcbbe('0x13')]():moment(_0xb863cd))['tz'](_0x1f25b4)[_0xcbbe('0x8')]('en');throwIfDateNotValid(_0xee07e0);var _0x459626=_0xa525e4[_0xcbbe('0x7')](',');var _0x1c8bd5=_0x459626[0x0];var _0x2696e2=_0x459626[0x1];var _0x40994d=_0x459626[0x2];var _0x401058=_0x459626[0x3];let _0x37bd69=!![];if(_0x1c8bd5!=='*'){var _0x264074=_0x1c8bd5[_0xcbbe('0x7')]('-');var _0xb5532b=_[_0xcbbe('0x27')](_0x264074[0x0],0x5,'0');var _0x4a04a4=_0x264074[_0xcbbe('0x28')]===0x2?_['padStart'](_0x264074[0x1],0x5,'0'):_0xb5532b;_0x37bd69=timeCompare(_0xee07e0,_0xb5532b,_0x4a04a4);}let _0x3d82a7=!![];if(_0x2696e2!=='*'){var _0x36ed02=_0x2696e2[_0xcbbe('0x7')]('-');var _0x33376e=_0x36ed02[0x0];var _0x574c9a=_0x36ed02[_0xcbbe('0x28')]===0x2?_0x36ed02[0x1]:_0x33376e;_0x3d82a7=dowCompare(_0xee07e0,_0x33376e,_0x574c9a);}let _0x4e55b0=!![];if(_0x40994d!=='*'){var _0x5b6a15=_0x40994d[_0xcbbe('0x7')]('-');var _0x1c054a=parseDom(_0x5b6a15[0x0]);var _0x5632ad=_0x5b6a15[_0xcbbe('0x28')]===0x2?parseDom(_0x5b6a15[0x1]):_0x1c054a;_0x4e55b0=domCompare(_0xee07e0,_0x1c054a,_0x5632ad);}let _0x3efd70=!![];if(_0x401058!=='*'){var _0x34ef8f=_0x401058[_0xcbbe('0x7')]('-');var _0x127015=_0x34ef8f[0x0];var _0x456e65=_0x34ef8f[_0xcbbe('0x28')]===0x2?_0x34ef8f[0x1]:_0x34ef8f[0x0];_0x3efd70=monthCompare(_0xee07e0,_0x127015,_0x456e65);}return _0x37bd69&&_0x3d82a7&&_0x4e55b0&&_0x3efd70;}}module[_0xcbbe('0xe')][_0xcbbe('0x29')]=iftime;
\ No newline at end of file
index 5d681ec..6c988a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8d2=['replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','transports','%s-%s','error','warn','consoleLogger','fileLogger','path','util','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc8d2,0x157));var _0x2c8d=function(_0x371ebb,_0xd72c82){_0x371ebb=_0x371ebb-0x0;var _0x5ed285=_0xc8d2[_0x371ebb];return _0x5ed285;};'use strict';var path=require(_0x2c8d('0x0'));var util=require(_0x2c8d('0x1'));var moment=require('moment');var winston=require(_0x2c8d('0x2'));var config=require('../config/environment');var debugLevel=config[_0x2c8d('0x3')]?config[_0x2c8d('0x3')][_0x2c8d('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2c8d('0x5'),'error':_0x2c8d('0x6'),'warn':_0x2c8d('0x7'),'info':'white','print':_0x2c8d('0x8'),'success':'bold\x20green','http':_0x2c8d('0x9'),'verbose':_0x2c8d('0xa'),'debug':_0x2c8d('0xb'),'silly':'bold\x20cyan'};winston[_0x2c8d('0xc')](XC_LOG_COLORS);function getLogFileName(_0x315ea0,_0x5bc501,_0x5916d5){var _0x44d96b=_0x315ea0||_0x2c8d('0xd');return path[_0x2c8d('0xe')](_0x44d96b,util[_0x2c8d('0xf')]('%s-%s.log',_0x5bc501,_0x5916d5));}function formatter(_0x5ee0f9,_0x53103e){_0x53103e['message']=_0x53103e[_0x2c8d('0x10')][_0x2c8d('0x11')](/@@{/g,_0x2c8d('0x12'))[_0x2c8d('0x11')](/}@@/g,_0x2c8d('0x13'))[_0x2c8d('0x11')](/@{/g,'{{')[_0x2c8d('0x11')](/}@/g,'}}');return util[_0x2c8d('0xf')](_0x2c8d('0x14'),moment()[_0x2c8d('0xf')](_0x2c8d('0x15')),_0x53103e[_0x2c8d('0x16')]['toUpperCase'](),_0x5ee0f9,_0x53103e[_0x2c8d('0x10')]);}function fileFormat(_0xe96f23,_0x530991){_0x530991[_0x2c8d('0x10')]=_0x530991[_0x2c8d('0x10')][_0x2c8d('0x11')](/@@{/g,_0x2c8d('0x12'))[_0x2c8d('0x11')](/}@@/g,_0x2c8d('0x13'))[_0x2c8d('0x11')](/@{/g,'{{')[_0x2c8d('0x11')](/}@/g,'}}');var _0x3a7325=_0x530991['meta']&&Object[_0x2c8d('0x17')](_0x530991[_0x2c8d('0x18')])[_0x2c8d('0x19')]?'\x0a\x09'+JSON[_0x2c8d('0x1a')](_0x530991[_0x2c8d('0x18')]):'';return util[_0x2c8d('0xf')](_0x2c8d('0x1b'),moment()[_0x2c8d('0xf')](_0x2c8d('0x15')),_0x530991[_0x2c8d('0x16')]['toUpperCase'](),_0xe96f23,_0x530991[_0x2c8d('0x10')],_0x3a7325);}function consoleLogger(){var _0x243d7b=new winston[(_0x2c8d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2c8d('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x487846){return formatter('',_0x487846);}})]});return _0x243d7b;}function fileLogger(_0xed2528,_0x689094){var _0x2d4309=new winston[(_0x2c8d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2c8d('0x1e'))]['File']({'name':util['format'](_0x2c8d('0x1f'),_0xed2528,_0x2c8d('0x20')),'filename':getLogFileName(_0x689094,_0xed2528,_0x2c8d('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d6f3a){return fileFormat(_0xed2528,_0x1d6f3a);}}),new winston[(_0x2c8d('0x1e'))]['File']({'name':util[_0x2c8d('0xf')](_0x2c8d('0x1f'),_0xed2528,debugLevel),'filename':getLogFileName(_0x689094,_0xed2528,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1df885){return fileFormat(_0xed2528,_0x1df885);}}),new winston['transports'][(_0x2c8d('0x1d'))]({'level':_0x2c8d('0x21'),'json':![],'formatter':function(_0x3b157a){return fileFormat(_0xed2528,_0x3b157a);}})]});return _0x2d4309;}exports[_0x2c8d('0x22')]=consoleLogger;exports[_0x2c8d('0x23')]=fileLogger;
\ No newline at end of file
+var _0xe4e2=['debugLevel','toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','File','%s-%s','error','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xe4e2,0xe5));var _0x2e4e=function(_0x1843b2,_0x15cfd4){_0x1843b2=_0x1843b2-0x0;var _0x2d070d=_0xe4e2[_0x1843b2];return _0x2d070d;};'use strict';var path=require(_0x2e4e('0x0'));var util=require(_0x2e4e('0x1'));var moment=require(_0x2e4e('0x2'));var winston=require(_0x2e4e('0x3'));var config=require(_0x2e4e('0x4'));var debugLevel=config[_0x2e4e('0x5')]?config[_0x2e4e('0x5')][_0x2e4e('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2e4e('0x7'),'error':'red','warn':_0x2e4e('0x8'),'info':_0x2e4e('0x9'),'print':_0x2e4e('0xa'),'success':_0x2e4e('0xb'),'http':_0x2e4e('0xc'),'verbose':_0x2e4e('0xd'),'debug':_0x2e4e('0xe'),'silly':_0x2e4e('0xf')};winston[_0x2e4e('0x10')](XC_LOG_COLORS);function getLogFileName(_0x59421f,_0x26f9c2,_0x390fb7){var _0x43076f=_0x59421f||_0x2e4e('0x11');return path['join'](_0x43076f,util[_0x2e4e('0x12')]('%s-%s.log',_0x26f9c2,_0x390fb7));}function formatter(_0x52a31d,_0xd0afd0){_0xd0afd0[_0x2e4e('0x13')]=_0xd0afd0[_0x2e4e('0x13')]['replace'](/@@{/g,'{{{')[_0x2e4e('0x14')](/}@@/g,_0x2e4e('0x15'))[_0x2e4e('0x14')](/@{/g,'{{')[_0x2e4e('0x14')](/}@/g,'}}');return util['format'](_0x2e4e('0x16'),moment()[_0x2e4e('0x12')](_0x2e4e('0x17')),_0xd0afd0[_0x2e4e('0x18')][_0x2e4e('0x19')](),_0x52a31d,_0xd0afd0[_0x2e4e('0x13')]);}function fileFormat(_0xddc0c2,_0x468b63){_0x468b63['message']=_0x468b63[_0x2e4e('0x13')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0x2e4e('0x15'))[_0x2e4e('0x14')](/@{/g,'{{')[_0x2e4e('0x14')](/}@/g,'}}');var _0x54bb5e=_0x468b63[_0x2e4e('0x1a')]&&Object[_0x2e4e('0x1b')](_0x468b63['meta'])['length']?'\x0a\x09'+JSON[_0x2e4e('0x1c')](_0x468b63[_0x2e4e('0x1a')]):'';return util[_0x2e4e('0x12')](_0x2e4e('0x1d'),moment()[_0x2e4e('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x468b63['level']['toUpperCase'](),_0xddc0c2,_0x468b63[_0x2e4e('0x13')],_0x54bb5e);}function consoleLogger(){var _0x1fec4d=new winston[(_0x2e4e('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2e4e('0x1f'))]['Console']({'level':_0x2e4e('0x20'),'json':![],'formatter':function(_0x133837){return formatter('',_0x133837);}})]});return _0x1fec4d;}function fileLogger(_0x27a847,_0x390abf){var _0x59c43f=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2e4e('0x1f'))][(_0x2e4e('0x21'))]({'name':util['format'](_0x2e4e('0x22'),_0x27a847,_0x2e4e('0x23')),'filename':getLogFileName(_0x390abf,_0x27a847,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x120dbc){return fileFormat(_0x27a847,_0x120dbc);}}),new winston[(_0x2e4e('0x1f'))][(_0x2e4e('0x21'))]({'name':util[_0x2e4e('0x12')](_0x2e4e('0x22'),_0x27a847,debugLevel),'filename':getLogFileName(_0x390abf,_0x27a847,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xbafd30){return fileFormat(_0x27a847,_0xbafd30);}}),new winston['transports'][(_0x2e4e('0x24'))]({'level':'warn','json':![],'formatter':function(_0x2387bf){return fileFormat(_0x27a847,_0x2387bf);}})]});return _0x59c43f;}exports[_0x2e4e('0x25')]=consoleLogger;exports[_0x2e4e('0x26')]=fileLogger;
\ No newline at end of file
index c1dd3ca..7446fc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x56b987,_0x31f0a5){var _0xe0ffb2=function(_0x27d80c){while(--_0x27d80c){_0x56b987['push'](_0x56b987['shift']());}};_0xe0ffb2(++_0x31f0a5);}(_0x14a0,0x8e));var _0x014a=function(_0x50530f,_0x4f5e81){_0x50530f=_0x50530f-0x0;var _0xa6eded=_0x14a0[_0x50530f];return _0xa6eded;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData;
\ No newline at end of file
+var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4975,0x86));var _0x5497=function(_0x1ae401,_0x5af4eb){_0x1ae401=_0x1ae401-0x0;var _0x412378=_0x4975[_0x1ae401];return _0x412378;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData;
\ No newline at end of file
index 64d7d5d..58b593e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x80ed=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string'];(function(_0x2bb82d,_0x42c7f8){var _0x5e0b92=function(_0x19f44b){while(--_0x19f44b){_0x2bb82d['push'](_0x2bb82d['shift']());}};_0x5e0b92(++_0x42c7f8);}(_0x80ed,0x11c));var _0xd80e=function(_0x4914f5,_0x437b05){_0x4914f5=_0x4914f5-0x0;var _0x6caf03=_0x80ed[_0x4914f5];return _0x6caf03;};var _=require(_0xd80e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5a14b2){return _0x5a14b2==='{{'?_0xd80e('0x1'):_0xd80e('0x2');}function safeTemplate(_0x4329e5){var _0x5052d7=_0x4329e5;if(typeof _0x4329e5===_0xd80e('0x3')){_0x5052d7=_0x4329e5[_0xd80e('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xd80e('0x5')](_0x4329e5)){_0x5052d7=_0x4329e5[_0xd80e('0x6')](function(_0x5ae6c6){return safeTemplate(_0x5ae6c6);});}else if(_[_0xd80e('0x7')](_0x4329e5)){_0x5052d7=Object[_0xd80e('0x8')](_0x4329e5)[_0xd80e('0x9')](function(_0x51c361,_0x411b3a){_0x51c361[_0x411b3a]=safeTemplate(_0x4329e5[_0x411b3a]);return _0x51c361;},{});}return _0x5052d7;}module[_0xd80e('0xa')][_0xd80e('0xb')]=safeTemplate;
\ No newline at end of file
+var _0x5c3c=['\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','{\x20{\x20'];(function(_0x4b2fc5,_0x3948ee){var _0x506fa7=function(_0x23b3cd){while(--_0x23b3cd){_0x4b2fc5['push'](_0x4b2fc5['shift']());}};_0x506fa7(++_0x3948ee);}(_0x5c3c,0x132));var _0xc5c3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x5c3c[_0x24259d];return _0x5a701;};var _=require(_0xc5c3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x40ad71){return _0x40ad71==='{{'?_0xc5c3('0x1'):_0xc5c3('0x2');}function safeTemplate(_0x4b9233){var _0x400726=_0x4b9233;if(typeof _0x4b9233===_0xc5c3('0x3')){_0x400726=_0x4b9233[_0xc5c3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc5c3('0x5')](_0x4b9233)){_0x400726=_0x4b9233[_0xc5c3('0x6')](function(_0x36525d){return safeTemplate(_0x36525d);});}else if(_[_0xc5c3('0x7')](_0x4b9233)){_0x400726=Object[_0xc5c3('0x8')](_0x4b9233)[_0xc5c3('0x9')](function(_0x5a392b,_0x4b8404){_0x5a392b[_0x4b8404]=safeTemplate(_0x4b9233[_0x4b8404]);return _0x5a392b;},{});}return _0x400726;}module['exports'][_0xc5c3('0xa')]=safeTemplate;
\ No newline at end of file
index b41daca..99068b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcd8=['writeJSON','exports','path','../config/environment','root','resolve','server/app.json','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json'];(function(_0x1e3a48,_0x27d885){var _0x5b54a5=function(_0x59a894){while(--_0x59a894){_0x1e3a48['push'](_0x1e3a48['shift']());}};_0x5b54a5(++_0x27d885);}(_0xfcd8,0xca));var _0x8fcd=function(_0x674ddb,_0x3a2b0f){_0x674ddb=_0x674ddb-0x0;var _0x133047=_0xfcd8[_0x674ddb];return _0x133047;};var fs=require('fs-extra');var path=require(_0x8fcd('0x0'));var config=require(_0x8fcd('0x1'));var root=config[_0x8fcd('0x2')];var APP_JSON_PATH=path[_0x8fcd('0x3')](root,_0x8fcd('0x4'));var NODEPATH=path['resolve'](root,_0x8fcd('0x5'));function setLegacyLibsNodeEnvPath(_0x42403d){let _0xa4dca7=![];if(Array['isArray'](_0x42403d[_0x8fcd('0x6')])){var _0x171525=_0x42403d['apps'][_0x8fcd('0x7')](function(_0x31df94){return _0x31df94[_0x8fcd('0x8')]===_0x8fcd('0x9');});if(_0x171525>-0x1){var _0x229101=_0x42403d[_0x8fcd('0x6')][_0x171525];if(typeof _0x229101[_0x8fcd('0xa')][_0x8fcd('0xb')]!==_0x8fcd('0xc')){_0x229101[_0x8fcd('0xa')][_0x8fcd('0xb')]=NODEPATH;_0xa4dca7=!![];}}return{'appConfig':_0x42403d,'updated':_0xa4dca7};}}function updateAppConfig(_0x31e3d8){return fs[_0x8fcd('0xd')](APP_JSON_PATH)[_0x8fcd('0xe')](function(_0x4d3b5e){if(_0x4d3b5e){return fs[_0x8fcd('0xf')](APP_JSON_PATH)[_0x8fcd('0xe')](function(_0x974ba6){var _0x58d6e3=setLegacyLibsNodeEnvPath(_0x974ba6);if(_0x58d6e3[_0x8fcd('0x10')]){_0x31e3d8['info'](_0x8fcd('0x11'));return fs[_0x8fcd('0x12')](APP_JSON_PATH,_0x974ba6,{'spaces':0x2});}else{return Promise[_0x8fcd('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x8fcd('0x13')]=updateAppConfig;
\ No newline at end of file
+var _0x366b=['then','readJSON','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x366b,0xb6));var _0xb366=function(_0x4d4611,_0x5907aa){_0x4d4611=_0x4d4611-0x0;var _0x15d1f0=_0x366b[_0x4d4611];return _0x15d1f0;};var fs=require(_0xb366('0x0'));var path=require(_0xb366('0x1'));var config=require(_0xb366('0x2'));var root=config[_0xb366('0x3')];var APP_JSON_PATH=path[_0xb366('0x4')](root,_0xb366('0x5'));var NODEPATH=path[_0xb366('0x4')](root,_0xb366('0x6'));function setLegacyLibsNodeEnvPath(_0x5ec9a5){let _0x307f1f=![];if(Array[_0xb366('0x7')](_0x5ec9a5[_0xb366('0x8')])){var _0x1c09e4=_0x5ec9a5[_0xb366('0x8')][_0xb366('0x9')](function(_0x5e0888){return _0x5e0888[_0xb366('0xa')]===_0xb366('0xb');});if(_0x1c09e4>-0x1){var _0x41afde=_0x5ec9a5['apps'][_0x1c09e4];if(typeof _0x41afde[_0xb366('0xc')][_0xb366('0xd')]!==_0xb366('0xe')){_0x41afde[_0xb366('0xc')]['NODE_PATH']=NODEPATH;_0x307f1f=!![];}}return{'appConfig':_0x5ec9a5,'updated':_0x307f1f};}}function updateAppConfig(_0x3cb32b){return fs[_0xb366('0xf')](APP_JSON_PATH)[_0xb366('0x10')](function(_0x368e17){if(_0x368e17){return fs[_0xb366('0x11')](APP_JSON_PATH)['then'](function(_0x6a8b1c){var _0x1243a3=setLegacyLibsNodeEnvPath(_0x6a8b1c);if(_0x1243a3[_0xb366('0x12')]){_0x3cb32b['info'](_0xb366('0x13'));return fs[_0xb366('0x14')](APP_JSON_PATH,_0x6a8b1c,{'spaces':0x2});}else{return Promise[_0xb366('0x4')]();}});}else{return Promise[_0xb366('0x4')]();}});}module[_0xb366('0x15')]=updateAppConfig;
\ No newline at end of file